From: support Date: Thu, 12 Jan 2023 15:46:42 +0000 (+0000) Subject: Built motion from commit ac06311e.|2.6.28 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=56674407a5aee4593ec1442e62dbfb6955dc0fa3;p=motion2.git Built motion from commit ac06311e.|2.6.28 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0f88d0d..7b4aac7 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-11T06:38:34.765Z", + "time": "2023-01-12T15:37:56.892Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 18452d9..0f3cae6 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-11T06:38:34.765Z", + "time": "2023-01-12T15:37:56.892Z", "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 d4aadc2..ed9b08d 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 _0x3b8b=['urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x189b1d,_0x1df005){var _0x3d8ab0=function(_0x59a27f){while(--_0x59a27f){_0x189b1d['push'](_0x189b1d['shift']());}};_0x3d8ab0(++_0x1df005);}(_0x3b8b,0x146));var _0xb3b8=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x3b8b[_0x40df5f];return _0x1573f1;};'use strict';var Sequelize=require(_0xb3b8('0x0'));module[_0xb3b8('0x1')]={'name':{'type':Sequelize[_0xb3b8('0x2')],'get':function(_0x47050d){return this[_0xb3b8('0x3')](_0xb3b8('0x4'));}},'action':{'type':Sequelize[_0xb3b8('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb3b8('0x6'),_0xb3b8('0x7'),_0xb3b8('0x8'),_0xb3b8('0x9'),_0xb3b8('0xa'),_0xb3b8('0xb'),'bot',_0xb3b8('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xb3b8('0xd')},'data1':{'type':Sequelize[_0xb3b8('0x5')](0x1000),'comment':_0xb3b8('0xe')},'data2':{'type':Sequelize[_0xb3b8('0x5')](0x1000),'comment':_0xb3b8('0xf')},'data3':{'type':Sequelize[_0xb3b8('0x5')](0x1000),'comment':_0xb3b8('0x10')},'data4':{'type':Sequelize[_0xb3b8('0x5')](0x1000),'comments':_0xb3b8('0x11')},'data5':{'type':Sequelize[_0xb3b8('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xb3b8('0x12')},'data7':{'type':Sequelize[_0xb3b8('0x13')],'comments':_0xb3b8('0x14')}}; \ No newline at end of file +var _0xe37a=['getDataValue','action','STRING','contactManager','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','sequelize','exports','VIRTUAL'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe37a,0x1bd));var _0xae37=function(_0x48b541,_0x5b7b2c){_0x48b541=_0x48b541-0x0;var _0x48aae3=_0xe37a[_0x48b541];return _0x48aae3;};'use strict';var Sequelize=require(_0xae37('0x0'));module[_0xae37('0x1')]={'name':{'type':Sequelize[_0xae37('0x2')],'get':function(_0x2bb14b){return this[_0xae37('0x3')](_0xae37('0x4'));}},'action':{'type':Sequelize[_0xae37('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xae37('0x6'),'integration',_0xae37('0x7'),_0xae37('0x8'),_0xae37('0x9'),_0xae37('0xa'),_0xae37('0xb'),_0xae37('0xc')]],'msg':_0xae37('0xd')}},'comment':_0xae37('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xae37('0xe')},'data2':{'type':Sequelize[_0xae37('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xae37('0x5')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xae37('0x5')](0x1000),'comments':_0xae37('0xf')},'data5':{'type':Sequelize[_0xae37('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1474ce7..12161ae 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 _0x100b=['destroy','eml-format','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','end','stack','name','send','body','Action','find','params','catch'];(function(_0x42aba4,_0x32aac1){var _0x3df2f6=function(_0x573672){while(--_0x573672){_0x42aba4['push'](_0x42aba4['shift']());}};_0x3df2f6(++_0x32aac1);}(_0x100b,0x171));var _0xb100=function(_0x2c2d7b,_0x10f5c3){_0x2c2d7b=_0x2c2d7b-0x0;var _0x5e56f3=_0x100b[_0x2c2d7b];return _0x5e56f3;};'use strict';var emlformat=require(_0xb100('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb100('0x1'));var moment=require(_0xb100('0x2'));var BPromise=require(_0xb100('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb100('0x4'));var sox=require(_0xb100('0x5'));var csv=require(_0xb100('0x6'));var ejs=require(_0xb100('0x7'));var fs=require('fs');var fs_extra=require(_0xb100('0x8'));var _=require(_0xb100('0x9'));var squel=require('squel');var crypto=require(_0xb100('0xa'));var jsforce=require(_0xb100('0xb'));var deskjs=require(_0xb100('0xc'));var toCsv=require(_0xb100('0x6'));var querystring=require(_0xb100('0xd'));var Papa=require(_0xb100('0xe'));var Redis=require(_0xb100('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb100('0x10'));var as=require(_0xb100('0x11'));var hardwareService=require(_0xb100('0x12'));var logger=require(_0xb100('0x13'))(_0xb100('0x14'));var utils=require(_0xb100('0x15'));var config=require(_0xb100('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb100('0x17'))['db'];function respondWithStatusCode(_0x559d15,_0x55b44e){_0x55b44e=_0x55b44e||0xcc;return function(_0x573602){if(_0x573602){return _0x559d15[_0xb100('0x18')](_0x55b44e);}return _0x559d15['status'](_0x55b44e)['end']();};}function respondWithResult(_0x4d58a1,_0x300c6a){_0x300c6a=_0x300c6a||0xc8;return function(_0x3c2460){if(_0x3c2460){return _0x4d58a1[_0xb100('0x19')](_0x300c6a)[_0xb100('0x1a')](_0x3c2460);}};}function respondWithFilteredResult(_0xbc59d7,_0x386f3a){return function(_0xe2374a){if(_0xe2374a){var _0x18a6a9=typeof _0x386f3a['offset']===_0xb100('0x1b')&&typeof _0x386f3a[_0xb100('0x1c')]===_0xb100('0x1b');var _0x320843=_0xe2374a[_0xb100('0x1d')];var _0x3ab46f=_0x18a6a9?0x0:_0x386f3a[_0xb100('0x1e')];var _0x3c89db=_0x18a6a9?_0xe2374a['count']:_0x386f3a[_0xb100('0x1e')]+_0x386f3a['limit'];var _0x33d9a8;if(_0x3c89db>=_0x320843){_0x3c89db=_0x320843;_0x33d9a8=0xc8;}else{_0x33d9a8=0xce;}_0xbc59d7[_0xb100('0x19')](_0x33d9a8);return _0xbc59d7[_0xb100('0x1f')](_0xb100('0x20'),_0x3ab46f+'-'+_0x3c89db+'/'+_0x320843)[_0xb100('0x1a')](_0xe2374a);}return null;};}function patchUpdates(_0x45c9ad){return function(_0x12028a){try{jsonpatch[_0xb100('0x21')](_0x12028a,_0x45c9ad,!![]);}catch(_0x6ef877){return BPromise[_0xb100('0x22')](_0x6ef877);}return _0x12028a['save']();};}function saveUpdates(_0x490b46,_0x4229fa){return function(_0x55ba39){if(_0x55ba39){return _0x55ba39['update'](_0x490b46)['then'](function(_0x37da67){return _0x37da67;});}return null;};}function removeEntity(_0x3d5ae3,_0x13905c){return function(_0x1b8df9){if(_0x1b8df9){return _0x1b8df9['destroy']()[_0xb100('0x23')](function(){_0x3d5ae3[_0xb100('0x19')](0xcc)[_0xb100('0x24')]();});}};}function handleEntityNotFound(_0x118f7a,_0x206fe8){return function(_0x5935c0){if(!_0x5935c0){_0x118f7a[_0xb100('0x18')](0x194);}return _0x5935c0;};}function handleError(_0x2f11b4,_0x3423e4){_0x3423e4=_0x3423e4||0x1f4;return function(_0x39350f){logger['error'](_0x39350f[_0xb100('0x25')]);if(_0x39350f[_0xb100('0x26')]){delete _0x39350f[_0xb100('0x26')];}_0x2f11b4[_0xb100('0x19')](_0x3423e4)[_0xb100('0x27')](_0x39350f);};}exports['update']=function(_0x108f8e,_0x53371a){if(_0x108f8e[_0xb100('0x28')]['id']){delete _0x108f8e[_0xb100('0x28')]['id'];}return db[_0xb100('0x29')][_0xb100('0x2a')]({'where':{'id':_0x108f8e[_0xb100('0x2b')]['id']}})[_0xb100('0x23')](handleEntityNotFound(_0x53371a,null))['then'](saveUpdates(_0x108f8e[_0xb100('0x28')],null))[_0xb100('0x23')](respondWithResult(_0x53371a,null))[_0xb100('0x2c')](handleError(_0x53371a,null));};exports[_0xb100('0x2d')]=function(_0x453723,_0x3fc1a1){return db['Action'][_0xb100('0x2a')]({'where':{'id':_0x453723[_0xb100('0x2b')]['id']}})[_0xb100('0x23')](handleEntityNotFound(_0x3fc1a1,null))['then'](removeEntity(_0x3fc1a1,null))[_0xb100('0x2c')](handleError(_0x3fc1a1,null));}; \ No newline at end of file +var _0x0d36=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','end','error','name','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x58205b,_0x33ef52){var _0x4fda4c=function(_0x10f4e8){while(--_0x10f4e8){_0x58205b['push'](_0x58205b['shift']());}};_0x4fda4c(++_0x33ef52);}(_0x0d36,0x1e8));var _0x60d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d36[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x60d3('0x0'));var rimraf=require(_0x60d3('0x1'));var zipdir=require(_0x60d3('0x2'));var jsonpatch=require(_0x60d3('0x3'));var rp=require('request-promise');var moment=require(_0x60d3('0x4'));var BPromise=require(_0x60d3('0x5'));var Mustache=require('mustache');var util=require(_0x60d3('0x6'));var path=require('path');var sox=require(_0x60d3('0x7'));var csv=require(_0x60d3('0x8'));var ejs=require(_0x60d3('0x9'));var fs=require('fs');var fs_extra=require(_0x60d3('0xa'));var _=require('lodash');var squel=require(_0x60d3('0xb'));var crypto=require(_0x60d3('0xc'));var jsforce=require(_0x60d3('0xd'));var deskjs=require(_0x60d3('0xe'));var toCsv=require(_0x60d3('0x8'));var querystring=require(_0x60d3('0xf'));var Papa=require(_0x60d3('0x10'));var Redis=require(_0x60d3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x60d3('0x12'));var as=require(_0x60d3('0x13'));var hardwareService=require(_0x60d3('0x14'));var logger=require(_0x60d3('0x15'))('api');var utils=require(_0x60d3('0x16'));var config=require(_0x60d3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x60d3('0x18'))['db'];function respondWithStatusCode(_0x284d83,_0xfc75c7){_0xfc75c7=_0xfc75c7||0xcc;return function(_0x340b57){if(_0x340b57){return _0x284d83[_0x60d3('0x19')](_0xfc75c7);}return _0x284d83[_0x60d3('0x1a')](_0xfc75c7)['end']();};}function respondWithResult(_0x1f84e7,_0x524255){_0x524255=_0x524255||0xc8;return function(_0x9cdd1d){if(_0x9cdd1d){return _0x1f84e7[_0x60d3('0x1a')](_0x524255)[_0x60d3('0x1b')](_0x9cdd1d);}};}function respondWithFilteredResult(_0xf36044,_0x299796){return function(_0x3782aa){if(_0x3782aa){var _0x107ab3=typeof _0x299796[_0x60d3('0x1c')]==='undefined'&&typeof _0x299796[_0x60d3('0x1d')]===_0x60d3('0x1e');var _0x150409=_0x3782aa['count'];var _0x4c7b8b=_0x107ab3?0x0:_0x299796[_0x60d3('0x1c')];var _0x3a9141=_0x107ab3?_0x3782aa[_0x60d3('0x1f')]:_0x299796[_0x60d3('0x1c')]+_0x299796[_0x60d3('0x1d')];var _0x3c16a5;if(_0x3a9141>=_0x150409){_0x3a9141=_0x150409;_0x3c16a5=0xc8;}else{_0x3c16a5=0xce;}_0xf36044[_0x60d3('0x1a')](_0x3c16a5);return _0xf36044[_0x60d3('0x20')](_0x60d3('0x21'),_0x4c7b8b+'-'+_0x3a9141+'/'+_0x150409)['json'](_0x3782aa);}return null;};}function patchUpdates(_0x4c8422){return function(_0x44ede5){try{jsonpatch[_0x60d3('0x22')](_0x44ede5,_0x4c8422,!![]);}catch(_0x57b808){return BPromise['reject'](_0x57b808);}return _0x44ede5['save']();};}function saveUpdates(_0x10c61d,_0x47e500){return function(_0xc9c0a5){if(_0xc9c0a5){return _0xc9c0a5[_0x60d3('0x23')](_0x10c61d)['then'](function(_0x560014){return _0x560014;});}return null;};}function removeEntity(_0x25349c,_0x59b471){return function(_0x131d04){if(_0x131d04){return _0x131d04[_0x60d3('0x24')]()[_0x60d3('0x25')](function(){_0x25349c[_0x60d3('0x1a')](0xcc)[_0x60d3('0x26')]();});}};}function handleEntityNotFound(_0x5a552f,_0xcbeaf7){return function(_0x325036){if(!_0x325036){_0x5a552f[_0x60d3('0x19')](0x194);}return _0x325036;};}function handleError(_0x53bef5,_0x249169){_0x249169=_0x249169||0x1f4;return function(_0x3179a9){logger[_0x60d3('0x27')](_0x3179a9['stack']);if(_0x3179a9['name']){delete _0x3179a9[_0x60d3('0x28')];}_0x53bef5[_0x60d3('0x1a')](_0x249169)['send'](_0x3179a9);};}exports[_0x60d3('0x23')]=function(_0x2ef93f,_0x51a066){if(_0x2ef93f[_0x60d3('0x29')]['id']){delete _0x2ef93f['body']['id'];}return db[_0x60d3('0x2a')][_0x60d3('0x2b')]({'where':{'id':_0x2ef93f[_0x60d3('0x2c')]['id']}})[_0x60d3('0x25')](handleEntityNotFound(_0x51a066,null))[_0x60d3('0x25')](saveUpdates(_0x2ef93f[_0x60d3('0x29')],null))[_0x60d3('0x25')](respondWithResult(_0x51a066,null))[_0x60d3('0x2d')](handleError(_0x51a066,null));};exports[_0x60d3('0x24')]=function(_0x286fab,_0x52f611){return db[_0x60d3('0x2a')][_0x60d3('0x2b')]({'where':{'id':_0x286fab[_0x60d3('0x2c')]['id']}})['then'](handleEntityNotFound(_0x52f611,null))[_0x60d3('0x25')](removeEntity(_0x52f611,null))[_0x60d3('0x2d')](handleError(_0x52f611,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 44157d2..31b5592 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 _0xe1e0=['exports','Action','lodash','../../config/logger','moment','bluebird','path','rimraf','./action.attributes'];(function(_0x13f729,_0x2689d0){var _0x5d1288=function(_0xd85899){while(--_0xd85899){_0x13f729['push'](_0x13f729['shift']());}};_0x5d1288(++_0x2689d0);}(_0xe1e0,0x1b2));var _0x0e1e=function(_0x3f5dc0,_0x5eb345){_0x3f5dc0=_0x3f5dc0-0x0;var _0x1bdeed=_0xe1e0[_0x3f5dc0];return _0x1bdeed;};'use strict';var _=require(_0x0e1e('0x0'));var util=require('util');var logger=require(_0x0e1e('0x1'))('api');var moment=require(_0x0e1e('0x2'));var BPromise=require(_0x0e1e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e1e('0x4'));var rimraf=require(_0x0e1e('0x5'));var config=require('../../config/environment');var attributes=require(_0x0e1e('0x6'));module[_0x0e1e('0x7')]=function(_0x1133e3,_0x1812c2){return _0x1133e3['define'](_0x0e1e('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x401f=['moment','bluebird','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api'];(function(_0x18a726,_0x408f55){var _0x9f85cb=function(_0x446d3c){while(--_0x446d3c){_0x18a726['push'](_0x18a726['shift']());}};_0x9f85cb(++_0x408f55);}(_0x401f,0x1b6));var _0xf401=function(_0x38f3db,_0x36d5ff){_0x38f3db=_0x38f3db-0x0;var _0x587bb5=_0x401f[_0x38f3db];return _0x587bb5;};'use strict';var _=require(_0xf401('0x0'));var util=require(_0xf401('0x1'));var logger=require(_0xf401('0x2'))(_0xf401('0x3'));var moment=require(_0xf401('0x4'));var BPromise=require(_0xf401('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf401('0x6'));var config=require(_0xf401('0x7'));var attributes=require(_0xf401('0x8'));module[_0xf401('0x9')]=function(_0x2189f6,_0x1748e6){return _0x2189f6[_0xf401('0xa')](_0xf401('0xb'),attributes,{'tableName':_0xf401('0xc'),'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 a01ab6d..bca1ca2 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x106b21,_0x22cefc){var _0x5b079f=function(_0x5b99aa){while(--_0x5b99aa){_0x106b21['push'](_0x106b21['shift']());}};_0x5b079f(++_0x22cefc);}(_0x5fab,0x177));var _0xb5fa=function(_0x2bb82d,_0x42c7f8){_0x2bb82d=_0x2bb82d-0x0;var _0x5e0b92=_0x5fab[_0x2bb82d];return _0x5e0b92;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x27858c,_0x1db761){var _0x326479=function(_0x3464ce){while(--_0x3464ce){_0x27858c['push'](_0x27858c['shift']());}};_0x326479(++_0x1db761);}(_0xe14b,0x93));var _0xbe14=function(_0x3b340f,_0x404d94){_0x3b340f=_0x3b340f-0x0;var _0x245337=_0xe14b[_0x3b340f];return _0x245337;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b654ba6..268ddc8 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 _0xe491=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x45b1a2,_0x5a25cb){var _0x10cbb0=function(_0x25e1bf){while(--_0x25e1bf){_0x45b1a2['push'](_0x45b1a2['shift']());}};_0x10cbb0(++_0x5a25cb);}(_0xe491,0xeb));var _0x1e49=function(_0x27a54a,_0x49939a){_0x27a54a=_0x27a54a-0x0;var _0x58e872=_0xe491[_0x27a54a];return _0x58e872;};'use strict';var multer=require(_0x1e49('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1e49('0x1'));var express=require(_0x1e49('0x2'));var router=express['Router']();var fs_extra=require(_0x1e49('0x3'));var auth=require(_0x1e49('0x4'));var interaction=require(_0x1e49('0x5'));var config=require(_0x1e49('0x6'));var controller=require('./action.controller');router[_0x1e49('0x7')](_0x1e49('0x8'),auth[_0x1e49('0x9')](),controller[_0x1e49('0xa')]);router[_0x1e49('0xb')]('/:id',auth[_0x1e49('0x9')](),controller[_0x1e49('0xc')]);module[_0x1e49('0xd')]=router; \ No newline at end of file +var _0x667d=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1efaea,_0x43e445){var _0x2e5b71=function(_0x5cf7eb){while(--_0x5cf7eb){_0x1efaea['push'](_0x1efaea['shift']());}};_0x2e5b71(++_0x43e445);}(_0x667d,0x86));var _0xd667=function(_0x364f17,_0x31e0e7){_0x364f17=_0x364f17-0x0;var _0x22e2cc=_0x667d[_0x364f17];return _0x22e2cc;};'use strict';var multer=require(_0xd667('0x0'));var util=require(_0xd667('0x1'));var path=require(_0xd667('0x2'));var timeout=require(_0xd667('0x3'));var express=require(_0xd667('0x4'));var router=express[_0xd667('0x5')]();var fs_extra=require(_0xd667('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd667('0x7'));var config=require(_0xd667('0x8'));var controller=require('./action.controller');router['put']('/:id',auth[_0xd667('0x9')](),controller[_0xd667('0xa')]);router[_0xd667('0xb')]('/:id',auth[_0xd667('0x9')](),controller[_0xd667('0xc')]);module[_0xd667('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 138f182..ece7732 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 _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x5c1192,_0x524754){var _0x1750b2=function(_0x3a6dc3){while(--_0x3a6dc3){_0x5c1192['push'](_0x5c1192['shift']());}};_0x1750b2(++_0x524754);}(_0xeec6,0x1c2));var _0x6eec=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xeec6[_0x198446];return _0x38d7b7;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x37c570,_0x3a2261){var _0xe4f999=function(_0xf77522){while(--_0xf77522){_0x37c570['push'](_0x37c570['shift']());}};_0xe4f999(++_0x3a2261);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x5fc3[_0x2dc96f];return _0xd012da;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7b8f3f5..fa1ed2d 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 _0xb7dc=['squel','crypto','jsforce','desk.js','to-csv','querystring','../../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','Content-Range','apply','save','update','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','filters','length','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','getFields','keyBy','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','SELECT','run','runReport','right_join','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash'];(function(_0x2e0137,_0x452292){var _0x26c7e4=function(_0x39c871){while(--_0x39c871){_0x2e0137['push'](_0x2e0137['shift']());}};_0x26c7e4(++_0x452292);}(_0xb7dc,0x9b));var _0xcb7d=function(_0x5e4d21,_0x403c67){_0x5e4d21=_0x5e4d21-0x0;var _0xf19fc6=_0xb7dc[_0x5e4d21];return _0xf19fc6;};'use strict';var emlformat=require(_0xcb7d('0x0'));var rimraf=require(_0xcb7d('0x1'));var zipdir=require(_0xcb7d('0x2'));var jsonpatch=require(_0xcb7d('0x3'));var rp=require(_0xcb7d('0x4'));var moment=require(_0xcb7d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb7d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcb7d('0x7'));var csv=require('to-csv');var ejs=require(_0xcb7d('0x8'));var fs=require('fs');var fs_extra=require(_0xcb7d('0x9'));var _=require(_0xcb7d('0xa'));var squel=require(_0xcb7d('0xb'));var crypto=require(_0xcb7d('0xc'));var jsforce=require(_0xcb7d('0xd'));var deskjs=require(_0xcb7d('0xe'));var toCsv=require(_0xcb7d('0xf'));var querystring=require(_0xcb7d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb7d('0x11'));var qs=require(_0xcb7d('0x12'));var as=require(_0xcb7d('0x13'));var hardwareService=require(_0xcb7d('0x14'));var logger=require('../../config/logger')(_0xcb7d('0x15'));var utils=require(_0xcb7d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcb7d('0x17'));var db=require(_0xcb7d('0x18'))['db'];var dbH=require(_0xcb7d('0x18'))[_0xcb7d('0x19')];function respondWithStatusCode(_0x408dac,_0x281c0a){_0x281c0a=_0x281c0a||0xcc;return function(_0x1c0c9c){if(_0x1c0c9c){return _0x408dac[_0xcb7d('0x1a')](_0x281c0a);}return _0x408dac[_0xcb7d('0x1b')](_0x281c0a)[_0xcb7d('0x1c')]();};}function respondWithResult(_0x249ba6,_0x118d46){_0x118d46=_0x118d46||0xc8;return function(_0x44b12d){if(_0x44b12d){return _0x249ba6[_0xcb7d('0x1b')](_0x118d46)[_0xcb7d('0x1d')](_0x44b12d);}};}function respondWithFilteredResult(_0x473dc7,_0x13e228){return function(_0x589cf6){if(_0x589cf6){var _0x1a1188=typeof _0x13e228[_0xcb7d('0x1e')]===_0xcb7d('0x1f')&&typeof _0x13e228[_0xcb7d('0x20')]===_0xcb7d('0x1f');var _0x49ac57=_0x589cf6['count'];var _0x4aba01=_0x1a1188?0x0:_0x13e228[_0xcb7d('0x1e')];var _0x3f3ab5=_0x1a1188?_0x589cf6['count']:_0x13e228[_0xcb7d('0x1e')]+_0x13e228[_0xcb7d('0x20')];var _0x221da7;if(_0x3f3ab5>=_0x49ac57){_0x3f3ab5=_0x49ac57;_0x221da7=0xc8;}else{_0x221da7=0xce;}_0x473dc7[_0xcb7d('0x1b')](_0x221da7);return _0x473dc7[_0xcb7d('0x21')](_0xcb7d('0x22'),_0x4aba01+'-'+_0x3f3ab5+'/'+_0x49ac57)['json'](_0x589cf6);}return null;};}function patchUpdates(_0x2f0ec8){return function(_0x19f049){try{jsonpatch[_0xcb7d('0x23')](_0x19f049,_0x2f0ec8,!![]);}catch(_0x1906e5){return BPromise['reject'](_0x1906e5);}return _0x19f049[_0xcb7d('0x24')]();};}function saveUpdates(_0x1a3437,_0x54ecca){return function(_0xbce2f2){if(_0xbce2f2){return _0xbce2f2[_0xcb7d('0x25')](_0x1a3437)[_0xcb7d('0x26')](function(_0x585763){return _0x585763;});}return null;};}function removeEntity(_0x3ec64a,_0x536252){return function(_0x4903f0){if(_0x4903f0){return _0x4903f0['destroy']()['then'](function(){var _0x50309b=_0x4903f0[_0xcb7d('0x27')]({'plain':!![]});var _0x15575f=_0xcb7d('0x28');return db[_0xcb7d('0x29')][_0xcb7d('0x2a')]({'where':{'type':_0x15575f,'resourceId':_0x50309b['id']}})[_0xcb7d('0x26')](function(){return _0x4903f0;});})[_0xcb7d('0x26')](function(){_0x3ec64a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x342ffe,_0x610c3b){return function(_0x190630){if(!_0x190630){_0x342ffe[_0xcb7d('0x1a')](0x194);}return _0x190630;};}function handleError(_0x1a7ab6,_0x2e85e1){_0x2e85e1=_0x2e85e1||0x1f4;return function(_0x30d972){logger[_0xcb7d('0x2b')](_0x30d972[_0xcb7d('0x2c')]);if(_0x30d972[_0xcb7d('0x2d')]){delete _0x30d972[_0xcb7d('0x2d')];}_0x1a7ab6[_0xcb7d('0x1b')](_0x2e85e1)[_0xcb7d('0x2e')](_0x30d972);};}exports[_0xcb7d('0x2f')]=function(_0x67db8b,_0x4dca72){var _0x3a0ee1={},_0x65ebf8={},_0x551b13={'count':0x0,'rows':[]};var _0x348c85=_[_0xcb7d('0x30')](db[_0xcb7d('0x31')][_0xcb7d('0x32')],function(_0x1a29d5){return{'name':_0x1a29d5['fieldName'],'type':_0x1a29d5['type']['key']};});_0x65ebf8[_0xcb7d('0x33')]=_[_0xcb7d('0x30')](_0x348c85,_0xcb7d('0x2d'));_0x65ebf8[_0xcb7d('0x34')]=_[_0xcb7d('0x35')](_0x67db8b[_0xcb7d('0x34')]);_0x65ebf8['filters']=_[_0xcb7d('0x36')](_0x65ebf8['model'],_0x65ebf8[_0xcb7d('0x34')]);_0x3a0ee1[_0xcb7d('0x37')]=_[_0xcb7d('0x36')](_0x65ebf8[_0xcb7d('0x33')],qs[_0xcb7d('0x38')](_0x67db8b[_0xcb7d('0x34')][_0xcb7d('0x38')]));_0x3a0ee1[_0xcb7d('0x37')]=_0x3a0ee1['attributes']['length']?_0x3a0ee1['attributes']:_0x65ebf8[_0xcb7d('0x33')];if(!_0x67db8b[_0xcb7d('0x34')][_0xcb7d('0x39')]('nolimit')){_0x3a0ee1[_0xcb7d('0x20')]=qs[_0xcb7d('0x20')](_0x67db8b['query'][_0xcb7d('0x20')]);_0x3a0ee1[_0xcb7d('0x1e')]=qs[_0xcb7d('0x1e')](_0x67db8b[_0xcb7d('0x34')][_0xcb7d('0x1e')]);}_0x3a0ee1[_0xcb7d('0x3a')]=qs['sort'](_0x67db8b[_0xcb7d('0x34')]['sort']);_0x3a0ee1[_0xcb7d('0x3b')]=qs['filters'](_[_0xcb7d('0x3c')](_0x67db8b[_0xcb7d('0x34')],_0x65ebf8['filters']),_0x348c85);if(_0x67db8b[_0xcb7d('0x34')][_0xcb7d('0x3d')]){_0x3a0ee1[_0xcb7d('0x3b')]=_[_0xcb7d('0x3e')](_0x3a0ee1[_0xcb7d('0x3b')],{'$or':_['map'](_0x348c85,function(_0x3f4740){if(_0x3f4740[_0xcb7d('0x3f')]!==_0xcb7d('0x40')){var _0xbd5481={};_0xbd5481[_0x3f4740[_0xcb7d('0x2d')]]={'$like':'%'+_0x67db8b['query'][_0xcb7d('0x3d')]+'%'};return _0xbd5481;}})});}_0x3a0ee1=_[_0xcb7d('0x3e')]({},_0x3a0ee1,_0x67db8b[_0xcb7d('0x41')]);var _0x1d968d={'where':_0x3a0ee1['where']};return db[_0xcb7d('0x31')]['count'](_0x1d968d)[_0xcb7d('0x26')](function(_0x7facf0){_0x551b13[_0xcb7d('0x42')]=_0x7facf0;if(_0x67db8b[_0xcb7d('0x34')][_0xcb7d('0x43')]){_0x3a0ee1[_0xcb7d('0x44')]=[{'all':!![]}];}return db[_0xcb7d('0x31')][_0xcb7d('0x45')](_0x3a0ee1);})['then'](function(_0xbcea30){_0x551b13[_0xcb7d('0x46')]=_0xbcea30;return _0x551b13;})[_0xcb7d('0x26')](respondWithFilteredResult(_0x4dca72,_0x3a0ee1))[_0xcb7d('0x47')](handleError(_0x4dca72,null));};exports['show']=function(_0x57242a,_0x221f8b){var _0x29f638={'raw':![],'where':{'id':_0x57242a[_0xcb7d('0x48')]['id']}},_0x2c3a4c={};_0x2c3a4c[_0xcb7d('0x33')]=_[_0xcb7d('0x35')](db[_0xcb7d('0x31')][_0xcb7d('0x32')]);_0x2c3a4c[_0xcb7d('0x34')]=_[_0xcb7d('0x35')](_0x57242a['query']);_0x2c3a4c[_0xcb7d('0x49')]=_[_0xcb7d('0x36')](_0x2c3a4c[_0xcb7d('0x33')],_0x2c3a4c['query']);_0x29f638[_0xcb7d('0x37')]=_[_0xcb7d('0x36')](_0x2c3a4c[_0xcb7d('0x33')],qs['fields'](_0x57242a[_0xcb7d('0x34')]['fields']));_0x29f638['attributes']=_0x29f638[_0xcb7d('0x37')][_0xcb7d('0x4a')]?_0x29f638[_0xcb7d('0x37')]:_0x2c3a4c[_0xcb7d('0x33')];if(_0x57242a[_0xcb7d('0x34')][_0xcb7d('0x43')]){_0x29f638[_0xcb7d('0x44')]=[{'all':!![]}];}_0x29f638=_[_0xcb7d('0x3e')]({},_0x29f638,_0x57242a[_0xcb7d('0x41')]);return db[_0xcb7d('0x31')][_0xcb7d('0x4b')](_0x29f638)[_0xcb7d('0x26')](handleEntityNotFound(_0x221f8b,null))[_0xcb7d('0x26')](respondWithResult(_0x221f8b,null))[_0xcb7d('0x47')](handleError(_0x221f8b,null));};exports[_0xcb7d('0x4c')]=function(_0x88136c,_0xb21444){return db['AnalyticCustomReport'][_0xcb7d('0x4c')](_0x88136c[_0xcb7d('0x4d')],{})[_0xcb7d('0x26')](function(_0x3e04de){var _0xfe9e9c=_0x88136c[_0xcb7d('0x4e')][_0xcb7d('0x27')]({'plain':!![]});if(!_0xfe9e9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe9e9c[_0xcb7d('0x4f')]==='user'){var _0x411a06=_0x3e04de[_0xcb7d('0x27')]({'plain':!![]});var _0x48dc8c=_0xcb7d('0x50');return db[_0xcb7d('0x51')][_0xcb7d('0x4b')]({'where':{'name':_0x48dc8c,'userProfileId':_0xfe9e9c[_0xcb7d('0x52')]},'raw':!![]})['then'](function(_0x513136){if(_0x513136&&_0x513136[_0xcb7d('0x53')]===0x0){return db[_0xcb7d('0x29')]['create']({'name':_0x411a06[_0xcb7d('0x2d')],'resourceId':_0x411a06['id'],'type':_0xcb7d('0x28'),'sectionId':_0x513136['id']},{})[_0xcb7d('0x26')](function(){return _0x3e04de;});}else{return _0x3e04de;}})[_0xcb7d('0x47')](function(_0x377220){logger[_0xcb7d('0x2b')](_0xcb7d('0x54'),_0x377220);throw _0x377220;});}return _0x3e04de;})[_0xcb7d('0x26')](respondWithResult(_0xb21444,0xc9))[_0xcb7d('0x47')](handleError(_0xb21444,null));};exports[_0xcb7d('0x25')]=function(_0x3791c9,_0x579859){if(_0x3791c9[_0xcb7d('0x4d')]['id']){delete _0x3791c9[_0xcb7d('0x4d')]['id'];}return db[_0xcb7d('0x31')][_0xcb7d('0x4b')]({'where':{'id':_0x3791c9[_0xcb7d('0x48')]['id']}})['then'](handleEntityNotFound(_0x579859,null))[_0xcb7d('0x26')](saveUpdates(_0x3791c9[_0xcb7d('0x4d')],null))[_0xcb7d('0x26')](respondWithResult(_0x579859,null))[_0xcb7d('0x47')](handleError(_0x579859,null));};exports[_0xcb7d('0x2a')]=function(_0x2bbf47,_0x11f9e0){return db['AnalyticCustomReport']['find']({'where':{'id':_0x2bbf47[_0xcb7d('0x48')]['id']}})[_0xcb7d('0x26')](handleEntityNotFound(_0x11f9e0,null))[_0xcb7d('0x26')](removeEntity(_0x11f9e0,null))[_0xcb7d('0x47')](handleError(_0x11f9e0,null));};exports[_0xcb7d('0x55')]=function(_0x22050d,_0x49ae82){var _0x3da166=0xa;var _0x3e7dfa=[_0xcb7d('0x56'),_0xcb7d('0x57'),'right_join',_0xcb7d('0x58')];var _0x2d6887={'SUM':_0xcb7d('0x59'),'COUNT':_0xcb7d('0x5a'),'COUNT DISTINCT':_0xcb7d('0x5b'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcb7d('0x5c'),'GROUP_CONCAT':_0xcb7d('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x59c6b3={'SEC_TO_TIME':_0xcb7d('0x5e'),'DATE':_0xcb7d('0x5f'),'HOUR':_0xcb7d('0x60'),'ROUND':_0xcb7d('0x61'),'UNIX_TIMESTAMP':_0xcb7d('0x62')};var _0x4fb959=function(_0x473c93){return!_[_0xcb7d('0x63')]([_0xcb7d('0x64'),'IS\x20NOT\x20NULL',_0xcb7d('0x65'),_0xcb7d('0x66')],_0x473c93);};var _0x211c18=function(_0x4a3b22){if(!_0x4a3b22||!_0x4a3b22[_0xcb7d('0x67')][_0xcb7d('0x4a')]){return'';}for(var _0x22f16b='(',_0x47bd99=0x0;_0x47bd99<_0x4a3b22['rules'][_0xcb7d('0x4a')];_0x47bd99+=0x1){_0x47bd99>0x0&&(_0x22f16b+='\x20'+_0x4a3b22[_0xcb7d('0x68')]+'\x20');_0x22f16b+=_0x4a3b22[_0xcb7d('0x67')][_0x47bd99][_0xcb7d('0x69')]?_0x211c18(_0x4a3b22[_0xcb7d('0x67')][_0x47bd99][_0xcb7d('0x69')]):_0x4a3b22[_0xcb7d('0x67')][_0x47bd99][_0xcb7d('0x6a')]+'\x20'+_0x4a3b22['rules'][_0x47bd99][_0xcb7d('0x6b')]+(_0x4fb959(_0x4a3b22[_0xcb7d('0x67')][_0x47bd99][_0xcb7d('0x6b')])?'\x20'+_0x4a3b22['rules'][_0x47bd99][_0xcb7d('0x6c')]:'');}return _0x22f16b+')';};var _0x5695ae={'where':{'id':_0x22050d[_0xcb7d('0x48')]['id']}},_0x3e00c2,_0x436853,_0x173d7a,_0x12034a,_0x2a22a5;_0x5695ae=_[_0xcb7d('0x3e')]({},_0x5695ae,_0x22050d[_0xcb7d('0x41')]);return db[_0xcb7d('0x31')]['find'](_0x5695ae)[_0xcb7d('0x26')](function(_0x5751dd){if(_0x5751dd){_0x3e00c2=_0x5751dd;return _0x5751dd['getFields']();}return null;})[_0xcb7d('0x26')](function(_0x5260f0){if(_0x5260f0){if(!_0x5260f0[_0xcb7d('0x4a')]){throw new db[(_0xcb7d('0x6d'))][(_0xcb7d('0x6e'))](_0xcb7d('0x6f'),0x193);}_0x436853=_0x5260f0;return db['AnalyticMetric'][_0xcb7d('0x45')]({'raw':!![]});}return null;})[_0xcb7d('0x26')](function(_0x1188bc){if(_0x1188bc){_0x173d7a=_['keyBy'](_0x1188bc,'id');var _0x3a97ae;var _0x10e3ac=squel['select']();_0x10e3ac[_0xcb7d('0x70')](_0x3e00c2[_0xcb7d('0x71')]);for(var _0x1b5e13=0x0;_0x1b5e13<_0x436853[_0xcb7d('0x4a')];_0x1b5e13+=0x1){_0x3a97ae=_0x436853[_0x1b5e13][_0xcb7d('0x72')]?_0x173d7a[_0x436853[_0x1b5e13][_0xcb7d('0x72')]][_0xcb7d('0x73')]:_0x436853[_0x1b5e13][_0xcb7d('0x6a')];_0x3a97ae=_0x436853[_0x1b5e13][_0xcb7d('0x74')]?_[_0xcb7d('0x75')](_0x2d6887[_0x436853[_0x1b5e13]['function']],'%s',_0x3a97ae):_0x3a97ae;_0x3a97ae=_0x436853[_0x1b5e13][_0xcb7d('0x76')]?_[_0xcb7d('0x75')](_0x59c6b3[_0x436853[_0x1b5e13]['format']],'%s',_0x3a97ae):_0x3a97ae;if(_0x436853[_0x1b5e13]['groupBy']){_0x10e3ac[_0xcb7d('0x69')](_0x3a97ae);}_0x436853[_0x1b5e13][_0xcb7d('0x77')]&&_0x10e3ac['order'](_0x3a97ae,_0x436853[_0x1b5e13][_0xcb7d('0x77')]===_0xcb7d('0x78')?![]:!![]);_0x10e3ac['field'](_0x3a97ae,_0x436853[_0x1b5e13][_0xcb7d('0x79')]||_0x3a97ae);}if(_0x3e00c2['joins']){_0x3e00c2[_0xcb7d('0x7a')]=JSON['parse'](_0x3e00c2[_0xcb7d('0x7a')]);for(var _0x281f2d=0x0;_0x281f2d<_0x3e00c2[_0xcb7d('0x7a')][_0xcb7d('0x4a')];_0x281f2d+=0x1){if(_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d]['type']&&_[_0xcb7d('0x63')](_0x3e7dfa,_0x3e00c2['joins'][_0x281f2d][_0xcb7d('0x3f')])&&_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d]['parentKey']&&_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d][_0xcb7d('0x7b')]&&_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d][_0xcb7d('0x7c')]){_0x10e3ac[_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d][_0xcb7d('0x3f')]](_0x3e00c2['joins'][_0x281f2d]['foreignTable'],null,util[_0xcb7d('0x76')](_0xcb7d('0x7d'),_0x3e00c2[_0xcb7d('0x71')],_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d][_0xcb7d('0x7e')],_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d][_0xcb7d('0x7b')],_0x3e00c2[_0xcb7d('0x7a')][_0x281f2d][_0xcb7d('0x7c')]));}}}if(_0x3e00c2[_0xcb7d('0x7f')]){_0x3e00c2[_0xcb7d('0x7f')]=JSON[_0xcb7d('0x80')](_0x3e00c2['conditions']);_0x10e3ac[_0xcb7d('0x3b')](_0x211c18(_0x3e00c2['conditions'][_0xcb7d('0x69')]));}_0x2a22a5=_0x10e3ac[_0xcb7d('0x81')]();_0x10e3ac[_0xcb7d('0x20')](_0x3da166);_0x10e3ac[_0xcb7d('0x1e')](0x0);logger['debug'](_0xcb7d('0x82'),_0x10e3ac['toString']());return dbH['sequelize'][_0xcb7d('0x34')](_0x10e3ac[_0xcb7d('0x83')](),{'type':dbH[_0xcb7d('0x84')][_0xcb7d('0x85')]['SELECT']});}})[_0xcb7d('0x26')](respondWithResult(_0x49ae82,null))[_0xcb7d('0x47')](handleError(_0x49ae82,null));};function runReport(_0x1524e0,_0x3b30c7,_0x324278){var _0x2514ac=_0x3b30c7[_0xcb7d('0x2d')];var _0x3959dd=0xa;var _0x5ac373=['join',_0xcb7d('0x57'),'right_join',_0xcb7d('0x58')];var _0x739ff2={'SUM':_0xcb7d('0x59'),'COUNT':_0xcb7d('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcb7d('0x86'),'MIN':_0xcb7d('0x87'),'AVG':_0xcb7d('0x5c'),'GROUP_CONCAT':_0xcb7d('0x5d'),'GROUP_CONCAT ASC':_0xcb7d('0x88'),'GROUP_CONCAT DESC':_0xcb7d('0x89')};var _0x195e73={'SEC_TO_TIME':_0xcb7d('0x5e'),'DATE':_0xcb7d('0x5f'),'HOUR':_0xcb7d('0x60'),'ROUND':_0xcb7d('0x61'),'UNIX_TIMESTAMP':_0xcb7d('0x62')};var _0xd8b525=function(_0x335f9e){return!_[_0xcb7d('0x63')]([_0xcb7d('0x64'),_0xcb7d('0x8a'),'IS\x20EMPTY',_0xcb7d('0x66')],_0x335f9e);};var _0x593bba=function(_0x2eee0f){if(!_0x2eee0f||!_0x2eee0f[_0xcb7d('0x67')]['length']){return'';}for(var _0x475575='(',_0x4c3f36=0x0;_0x4c3f36<_0x2eee0f['rules'][_0xcb7d('0x4a')];_0x4c3f36+=0x1){_0x4c3f36>0x0&&(_0x475575+='\x20'+_0x2eee0f[_0xcb7d('0x68')]+'\x20');_0x475575+=_0x2eee0f[_0xcb7d('0x67')][_0x4c3f36][_0xcb7d('0x69')]?_0x593bba(_0x2eee0f[_0xcb7d('0x67')][_0x4c3f36][_0xcb7d('0x69')]):_0x2eee0f['rules'][_0x4c3f36][_0xcb7d('0x6a')]+'\x20'+_0x2eee0f['rules'][_0x4c3f36][_0xcb7d('0x6b')]+(_0xd8b525(_0x2eee0f[_0xcb7d('0x67')][_0x4c3f36][_0xcb7d('0x6b')])?'\x20'+_0x2eee0f[_0xcb7d('0x67')][_0x4c3f36]['value']:'');}return _0x475575+')';};var _0x54fe6d={'where':{'id':_0x1524e0['id']}},_0xc54f14,_0xf6b5c,_0x250ddd,_0x492a78,_0xaca23d;_0x54fe6d=_[_0xcb7d('0x3e')]({},_0x54fe6d,_0x324278);return db[_0xcb7d('0x31')]['find'](_0x54fe6d)[_0xcb7d('0x26')](function(_0x29e787){if(_0x29e787){_0xc54f14=_0x29e787;return _0x29e787[_0xcb7d('0x8b')]();}return null;})[_0xcb7d('0x26')](function(_0x1a8441){if(_0x1a8441){if(!_0x1a8441[_0xcb7d('0x4a')]){throw new db[(_0xcb7d('0x6d'))][(_0xcb7d('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xf6b5c=_0x1a8441;return db['AnalyticMetric'][_0xcb7d('0x45')]({'raw':!![]});}return null;})[_0xcb7d('0x26')](function(_0x20c61b){if(_0x20c61b){_0x250ddd=_[_0xcb7d('0x8c')](_0x20c61b,'id');var _0x5ac9e6;var _0x4725d8=squel['select']();_0x4725d8[_0xcb7d('0x70')](_0xc54f14[_0xcb7d('0x71')]);for(var _0x4eeaa6=0x0;_0x4eeaa6<_0xf6b5c['length'];_0x4eeaa6+=0x1){_0x5ac9e6=_0xf6b5c[_0x4eeaa6][_0xcb7d('0x72')]?_0x250ddd[_0xf6b5c[_0x4eeaa6][_0xcb7d('0x72')]]['metric']:_0xf6b5c[_0x4eeaa6][_0xcb7d('0x6a')];_0x5ac9e6=_0xf6b5c[_0x4eeaa6][_0xcb7d('0x74')]?_[_0xcb7d('0x75')](_0x739ff2[_0xf6b5c[_0x4eeaa6][_0xcb7d('0x74')]],'%s',_0x5ac9e6):_0x5ac9e6;_0x5ac9e6=_0xf6b5c[_0x4eeaa6]['format']?_[_0xcb7d('0x75')](_0x195e73[_0xf6b5c[_0x4eeaa6]['format']],'%s',_0x5ac9e6):_0x5ac9e6;if(_0xf6b5c[_0x4eeaa6][_0xcb7d('0x8d')]){_0x4725d8[_0xcb7d('0x69')](_0x5ac9e6);}_0xf6b5c[_0x4eeaa6][_0xcb7d('0x77')]&&_0x4725d8['order'](_0x5ac9e6,_0xf6b5c[_0x4eeaa6]['orderBy']===_0xcb7d('0x78')?![]:!![]);_0x4725d8[_0xcb7d('0x6a')](_0x5ac9e6,_0xf6b5c[_0x4eeaa6][_0xcb7d('0x79')]||_0x5ac9e6);}if(_0xc54f14['joins']){_0xc54f14[_0xcb7d('0x7a')]=JSON[_0xcb7d('0x80')](_0xc54f14[_0xcb7d('0x7a')]);for(var _0x94023f=0x0;_0x94023f<_0xc54f14[_0xcb7d('0x7a')][_0xcb7d('0x4a')];_0x94023f+=0x1){if(_0xc54f14['joins'][_0x94023f][_0xcb7d('0x3f')]&&_[_0xcb7d('0x63')](_0x5ac373,_0xc54f14[_0xcb7d('0x7a')][_0x94023f][_0xcb7d('0x3f')])&&_0xc54f14[_0xcb7d('0x7a')][_0x94023f][_0xcb7d('0x7e')]&&_0xc54f14[_0xcb7d('0x7a')][_0x94023f]['foreignTable']&&_0xc54f14[_0xcb7d('0x7a')][_0x94023f][_0xcb7d('0x7c')]){_0x4725d8[_0xc54f14[_0xcb7d('0x7a')][_0x94023f][_0xcb7d('0x3f')]](_0xc54f14[_0xcb7d('0x7a')][_0x94023f][_0xcb7d('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0xc54f14[_0xcb7d('0x71')],_0xc54f14[_0xcb7d('0x7a')][_0x94023f][_0xcb7d('0x7e')],_0xc54f14[_0xcb7d('0x7a')][_0x94023f][_0xcb7d('0x7b')],_0xc54f14['joins'][_0x94023f][_0xcb7d('0x7c')]));}}}if(_0xc54f14[_0xcb7d('0x7f')]){_0xc54f14['conditions']=JSON[_0xcb7d('0x80')](_0xc54f14[_0xcb7d('0x7f')]);_0x4725d8[_0xcb7d('0x3b')](_0x593bba(_0xc54f14[_0xcb7d('0x7f')][_0xcb7d('0x69')]));}_0xaca23d=_0x4725d8['clone']();_0x4725d8[_0xcb7d('0x20')](_0x3959dd);_0x4725d8['offset'](0x0);return;}})[_0xcb7d('0x26')](function(){if(_0x3b30c7[_0xcb7d('0x8e')]===_0xcb7d('0x8f')){return null;}var _0x398494=_[_0xcb7d('0x3e')](_0x3b30c7,{'name':_0x3b30c7[_0xcb7d('0x90')]||_0x3b30c7['name']||_0xc54f14['name'],'basename':_0x2514ac,'savename':util[_0xcb7d('0x76')](_0xcb7d('0x91'),_0x3b30c7[_0xcb7d('0x2d')]||_0xc54f14['name'],require(_0xcb7d('0x92'))[_0xcb7d('0x93')](0x4),_0x3b30c7[_0xcb7d('0x8e')]||_0xcb7d('0x94')),'reportId':_0xc54f14['id'],'reportType':'custom'});return db['AnalyticExtractedReport']['create'](_0x398494,{'raw':!![]});})[_0xcb7d('0x26')](function(_0x356221){if(_0xc54f14[_0xcb7d('0x71')]===_0xcb7d('0x95')){_0xaca23d[_0xcb7d('0x3b')](_0xc54f14[_0xcb7d('0x71')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3b30c7[_0xcb7d('0x96')],_0x3b30c7[_0xcb7d('0x97')]);}else{_0xaca23d['where'](_0xc54f14[_0xcb7d('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3b30c7[_0xcb7d('0x96')],_0x3b30c7[_0xcb7d('0x97')]);}if(_0x356221){logger[_0xcb7d('0x98')](_0xcb7d('0x99'),_0xaca23d['toString']());require('child_process')[_0xcb7d('0x9a')](path[_0xcb7d('0x56')](__dirname,_0xcb7d('0x9b'),_0x356221[_0xcb7d('0x8e')]),[_0x356221['id'],_0xaca23d[_0xcb7d('0x83')](),path['join'](__dirname,_0xcb7d('0x9c'),_0x356221[_0xcb7d('0x9d')]),_0x2514ac]);return _0x356221;}else{var _0x529c1c=squel[_0xcb7d('0x9e')]();_0x529c1c['from']('('+_0xaca23d[_0xcb7d('0x83')]()+')',_0xcb7d('0x9f'));_0x529c1c[_0xcb7d('0x6a')](_0xcb7d('0xa0'),_0xcb7d('0x42'));_0xaca23d[_0xcb7d('0x20')](_0x3b30c7[_0xcb7d('0x20')]||_0x3959dd);_0xaca23d[_0xcb7d('0x1e')](_0x3b30c7[_0xcb7d('0x1e')]||0x0);return dbH[_0xcb7d('0x84')][_0xcb7d('0x34')](_0x529c1c['toString'](),{'type':dbH[_0xcb7d('0x84')][_0xcb7d('0x85')][_0xcb7d('0xa1')]})['then'](function(_0x1b8153){if(!_0x1b8153[_0xcb7d('0x4a')]){_0x492a78=0x0;}else{_0x492a78=_0x1b8153[0x0]['count']||0x0;}return dbH[_0xcb7d('0x84')][_0xcb7d('0x34')](_0xaca23d[_0xcb7d('0x83')](),{'type':dbH[_0xcb7d('0x84')][_0xcb7d('0x85')][_0xcb7d('0xa1')]});})[_0xcb7d('0x26')](function(_0x290d2b){return{'rows':_0x290d2b||[],'count':_0x492a78};});}});}exports[_0xcb7d('0xa2')]=function(_0x4ebf6e,_0x36f2a3){return runReport(_0x4ebf6e[_0xcb7d('0x48')],_0x4ebf6e[_0xcb7d('0x34')],_0x4ebf6e[_0xcb7d('0x41')])['then'](respondWithResult(_0x36f2a3,null))['catch'](handleError(_0x36f2a3,null));};exports[_0xcb7d('0xa3')]=runReport;exports['query']=function(_0x36b356,_0x41d677){var _0x3ea9aa=0xa;var _0x1d00f4=[_0xcb7d('0x56'),_0xcb7d('0x57'),_0xcb7d('0xa4'),'cross_join'];var _0x1da6ff={'SUM':'SUM(%s)','COUNT':_0xcb7d('0x5a'),'COUNT DISTINCT':_0xcb7d('0x5b'),'MAX':_0xcb7d('0x86'),'MIN':'MIN(%s)','AVG':_0xcb7d('0x5c'),'GROUP_CONCAT':_0xcb7d('0x5d'),'GROUP_CONCAT ASC':_0xcb7d('0x88'),'GROUP_CONCAT DESC':_0xcb7d('0x89')};var _0x2a1237={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcb7d('0x5f'),'HOUR':_0xcb7d('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2eaf7d=function(_0x3c1735){return!_[_0xcb7d('0x63')]([_0xcb7d('0x64'),_0xcb7d('0x8a'),_0xcb7d('0x65'),'IS\x20NOT\x20EMPTY'],_0x3c1735);};var _0x419cd4=function(_0x562517){if(!_0x562517||!_0x562517['rules'][_0xcb7d('0x4a')]){return'';}for(var _0xc54003='(',_0x3556a7=0x0;_0x3556a7<_0x562517[_0xcb7d('0x67')][_0xcb7d('0x4a')];_0x3556a7+=0x1){_0x3556a7>0x0&&(_0xc54003+='\x20'+_0x562517[_0xcb7d('0x68')]+'\x20');_0xc54003+=_0x562517[_0xcb7d('0x67')][_0x3556a7][_0xcb7d('0x69')]?_0x419cd4(_0x562517['rules'][_0x3556a7]['group']):_0x562517['rules'][_0x3556a7]['field']+'\x20'+_0x562517[_0xcb7d('0x67')][_0x3556a7]['condition']+(_0x2eaf7d(_0x562517[_0xcb7d('0x67')][_0x3556a7][_0xcb7d('0x6b')])?'\x20'+_0x562517['rules'][_0x3556a7]['value']:'');}return _0xc54003+')';};var _0x39c7fd={'where':{'id':_0x36b356[_0xcb7d('0x48')]['id']}},_0x41316d,_0x32524a,_0x487155,_0x163cf9,_0x4e3ee5;_0x39c7fd=_[_0xcb7d('0x3e')]({},_0x39c7fd,_0x36b356[_0xcb7d('0x41')]);return db[_0xcb7d('0x31')][_0xcb7d('0x4b')](_0x39c7fd)[_0xcb7d('0x26')](function(_0x1d7fd4){if(_0x1d7fd4){_0x41316d=_0x1d7fd4;return _0x1d7fd4[_0xcb7d('0x8b')]();}return null;})[_0xcb7d('0x26')](function(_0x3fce49){if(_0x3fce49){if(!_0x3fce49[_0xcb7d('0x4a')]){throw new db['Sequelize'][(_0xcb7d('0x6e'))](_0xcb7d('0x6f'),0x193);}_0x32524a=_0x3fce49;return db[_0xcb7d('0xa5')][_0xcb7d('0x45')]({'raw':!![]});}return null;})['then'](function(_0x4081fc){if(_0x4081fc){_0x487155=_[_0xcb7d('0x8c')](_0x4081fc,'id');var _0x337691;var _0xce2c68=squel['select']();_0xce2c68[_0xcb7d('0x70')](_0x41316d['table']);for(var _0x25494f=0x0;_0x25494f<_0x32524a[_0xcb7d('0x4a')];_0x25494f+=0x1){_0x337691=_0x32524a[_0x25494f]['MetricId']?_0x487155[_0x32524a[_0x25494f]['MetricId']]['metric']:_0x32524a[_0x25494f]['field'];_0x337691=_0x32524a[_0x25494f][_0xcb7d('0x74')]?_['replace'](_0x1da6ff[_0x32524a[_0x25494f][_0xcb7d('0x74')]],'%s',_0x337691):_0x337691;_0x337691=_0x32524a[_0x25494f]['format']?_[_0xcb7d('0x75')](_0x2a1237[_0x32524a[_0x25494f]['format']],'%s',_0x337691):_0x337691;if(_0x32524a[_0x25494f][_0xcb7d('0x8d')]){_0xce2c68[_0xcb7d('0x69')](_0x337691);}_0x32524a[_0x25494f]['orderBy']&&_0xce2c68[_0xcb7d('0x3a')](_0x337691,_0x32524a[_0x25494f]['orderBy']==='DESC'?![]:!![]);_0xce2c68['field'](_0x337691,_0x32524a[_0x25494f]['alias']||_0x337691);}if(_0x41316d[_0xcb7d('0x7a')]){_0x41316d[_0xcb7d('0x7a')]=JSON[_0xcb7d('0x80')](_0x41316d[_0xcb7d('0x7a')]);for(var _0x559e54=0x0;_0x559e54<_0x41316d[_0xcb7d('0x7a')][_0xcb7d('0x4a')];_0x559e54+=0x1){if(_0x41316d[_0xcb7d('0x7a')][_0x559e54][_0xcb7d('0x3f')]&&_[_0xcb7d('0x63')](_0x1d00f4,_0x41316d[_0xcb7d('0x7a')][_0x559e54][_0xcb7d('0x3f')])&&_0x41316d[_0xcb7d('0x7a')][_0x559e54]['parentKey']&&_0x41316d[_0xcb7d('0x7a')][_0x559e54][_0xcb7d('0x7b')]&&_0x41316d[_0xcb7d('0x7a')][_0x559e54][_0xcb7d('0x7c')]){_0xce2c68[_0x41316d['joins'][_0x559e54][_0xcb7d('0x3f')]](_0x41316d[_0xcb7d('0x7a')][_0x559e54][_0xcb7d('0x7b')],null,util['format'](_0xcb7d('0x7d'),_0x41316d['table'],_0x41316d[_0xcb7d('0x7a')][_0x559e54]['parentKey'],_0x41316d[_0xcb7d('0x7a')][_0x559e54][_0xcb7d('0x7b')],_0x41316d[_0xcb7d('0x7a')][_0x559e54]['foreignKey']));}}}if(_0x41316d[_0xcb7d('0x7f')]){_0x41316d['conditions']=JSON[_0xcb7d('0x80')](_0x41316d[_0xcb7d('0x7f')]);_0xce2c68[_0xcb7d('0x3b')](_0x419cd4(_0x41316d[_0xcb7d('0x7f')][_0xcb7d('0x69')]));}_0x4e3ee5=_0xce2c68['clone']();_0xce2c68[_0xcb7d('0x20')](_0x3ea9aa);_0xce2c68[_0xcb7d('0x1e')](0x0);logger['debug'](_0xcb7d('0x82'),_0xce2c68['toString']());return dbH[_0xcb7d('0x84')][_0xcb7d('0x34')](_0xce2c68[_0xcb7d('0x83')](),{'type':dbH[_0xcb7d('0x84')][_0xcb7d('0x85')][_0xcb7d('0xa1')]});}})[_0xcb7d('0x26')](function(){return{'sql':_0x4e3ee5[_0xcb7d('0x83')]()};})[_0xcb7d('0x26')](respondWithResult(_0x41d677,null))['catch'](handleError(_0x41d677,null));}; \ No newline at end of file +var _0x3a63=['sendStatus','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','preview','left_join','cross_join','SUM(%s)','COUNT(%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)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','condition','value','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','field','function','replace','format','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','parse','clone','Limited\x20Query:','toString','QueryTypes','SELECT','MAX(%s)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','groupBy','%s-%s.%s','randomstring','generate','output','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','join','../../components/export/','../../files/reports','savename','sequelize','runReport','right_join','debug','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','get','CustomReports'];(function(_0x450fa0,_0x5b14fc){var _0x26f1fe=function(_0x522c2a){while(--_0x522c2a){_0x450fa0['push'](_0x450fa0['shift']());}};_0x26f1fe(++_0x5b14fc);}(_0x3a63,0x11e));var _0x33a6=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x3a63[_0x34bc6c];return _0x168820;};'use strict';var emlformat=require(_0x33a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x33a6('0x1'));var rp=require(_0x33a6('0x2'));var moment=require(_0x33a6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x33a6('0x4'));var util=require('util');var path=require(_0x33a6('0x5'));var sox=require(_0x33a6('0x6'));var csv=require(_0x33a6('0x7'));var ejs=require(_0x33a6('0x8'));var fs=require('fs');var fs_extra=require(_0x33a6('0x9'));var _=require('lodash');var squel=require(_0x33a6('0xa'));var crypto=require(_0x33a6('0xb'));var jsforce=require(_0x33a6('0xc'));var deskjs=require(_0x33a6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x33a6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x33a6('0xf'));var as=require(_0x33a6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33a6('0x11'))(_0x33a6('0x12'));var utils=require(_0x33a6('0x13'));var config=require(_0x33a6('0x14'));var licenseUtil=require(_0x33a6('0x15'));var db=require(_0x33a6('0x16'))['db'];var dbH=require(_0x33a6('0x16'))[_0x33a6('0x17')];function respondWithStatusCode(_0x59366f,_0x224437){_0x224437=_0x224437||0xcc;return function(_0x5e67e0){if(_0x5e67e0){return _0x59366f['sendStatus'](_0x224437);}return _0x59366f[_0x33a6('0x18')](_0x224437)[_0x33a6('0x19')]();};}function respondWithResult(_0x2cf145,_0x1dcd8f){_0x1dcd8f=_0x1dcd8f||0xc8;return function(_0x26d7ce){if(_0x26d7ce){return _0x2cf145[_0x33a6('0x18')](_0x1dcd8f)['json'](_0x26d7ce);}};}function respondWithFilteredResult(_0x3503c6,_0x4a66d3){return function(_0x30f0b3){if(_0x30f0b3){var _0x464a78=typeof _0x4a66d3[_0x33a6('0x1a')]===_0x33a6('0x1b')&&typeof _0x4a66d3[_0x33a6('0x1c')]===_0x33a6('0x1b');var _0x49bb93=_0x30f0b3['count'];var _0x14e647=_0x464a78?0x0:_0x4a66d3[_0x33a6('0x1a')];var _0x2cfc70=_0x464a78?_0x30f0b3[_0x33a6('0x1d')]:_0x4a66d3[_0x33a6('0x1a')]+_0x4a66d3[_0x33a6('0x1c')];var _0x5541fc;if(_0x2cfc70>=_0x49bb93){_0x2cfc70=_0x49bb93;_0x5541fc=0xc8;}else{_0x5541fc=0xce;}_0x3503c6[_0x33a6('0x18')](_0x5541fc);return _0x3503c6['set'](_0x33a6('0x1e'),_0x14e647+'-'+_0x2cfc70+'/'+_0x49bb93)[_0x33a6('0x1f')](_0x30f0b3);}return null;};}function patchUpdates(_0xd5f8ee){return function(_0x3cdd2f){try{jsonpatch[_0x33a6('0x20')](_0x3cdd2f,_0xd5f8ee,!![]);}catch(_0x16432c){return BPromise[_0x33a6('0x21')](_0x16432c);}return _0x3cdd2f['save']();};}function saveUpdates(_0x190ba8,_0x4ec0d1){return function(_0x147a6b){if(_0x147a6b){return _0x147a6b[_0x33a6('0x22')](_0x190ba8)[_0x33a6('0x23')](function(_0x1673b2){return _0x1673b2;});}return null;};}function removeEntity(_0x3e41ed,_0x4f4b91){return function(_0x1b234e){if(_0x1b234e){return _0x1b234e['destroy']()[_0x33a6('0x23')](function(){var _0x105311=_0x1b234e[_0x33a6('0x24')]({'plain':!![]});var _0x1dfd65=_0x33a6('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x1dfd65,'resourceId':_0x105311['id']}})[_0x33a6('0x23')](function(){return _0x1b234e;});})['then'](function(){_0x3e41ed[_0x33a6('0x18')](0xcc)[_0x33a6('0x19')]();});}};}function handleEntityNotFound(_0x4789d1,_0x5005b5){return function(_0x50bfaf){if(!_0x50bfaf){_0x4789d1[_0x33a6('0x26')](0x194);}return _0x50bfaf;};}function handleError(_0x313ea0,_0x5c2794){_0x5c2794=_0x5c2794||0x1f4;return function(_0x488226){logger[_0x33a6('0x27')](_0x488226['stack']);if(_0x488226[_0x33a6('0x28')]){delete _0x488226[_0x33a6('0x28')];}_0x313ea0[_0x33a6('0x18')](_0x5c2794)[_0x33a6('0x29')](_0x488226);};}exports[_0x33a6('0x2a')]=function(_0x1793b2,_0x38fb55){var _0x3862ae={},_0x5696db={},_0x29b89c={'count':0x0,'rows':[]};var _0x2beb2a=_[_0x33a6('0x2b')](db[_0x33a6('0x2c')][_0x33a6('0x2d')],function(_0x39218c){return{'name':_0x39218c[_0x33a6('0x2e')],'type':_0x39218c[_0x33a6('0x2f')][_0x33a6('0x30')]};});_0x5696db['model']=_[_0x33a6('0x2b')](_0x2beb2a,_0x33a6('0x28'));_0x5696db[_0x33a6('0x31')]=_[_0x33a6('0x32')](_0x1793b2[_0x33a6('0x31')]);_0x5696db[_0x33a6('0x33')]=_['intersection'](_0x5696db[_0x33a6('0x34')],_0x5696db[_0x33a6('0x31')]);_0x3862ae['attributes']=_['intersection'](_0x5696db['model'],qs[_0x33a6('0x35')](_0x1793b2[_0x33a6('0x31')][_0x33a6('0x35')]));_0x3862ae['attributes']=_0x3862ae[_0x33a6('0x36')][_0x33a6('0x37')]?_0x3862ae['attributes']:_0x5696db[_0x33a6('0x34')];if(!_0x1793b2[_0x33a6('0x31')][_0x33a6('0x38')]('nolimit')){_0x3862ae[_0x33a6('0x1c')]=qs[_0x33a6('0x1c')](_0x1793b2[_0x33a6('0x31')][_0x33a6('0x1c')]);_0x3862ae[_0x33a6('0x1a')]=qs[_0x33a6('0x1a')](_0x1793b2[_0x33a6('0x31')][_0x33a6('0x1a')]);}_0x3862ae[_0x33a6('0x39')]=qs['sort'](_0x1793b2[_0x33a6('0x31')][_0x33a6('0x3a')]);_0x3862ae[_0x33a6('0x3b')]=qs[_0x33a6('0x33')](_[_0x33a6('0x3c')](_0x1793b2[_0x33a6('0x31')],_0x5696db['filters']),_0x2beb2a);if(_0x1793b2['query'][_0x33a6('0x3d')]){_0x3862ae[_0x33a6('0x3b')]=_[_0x33a6('0x3e')](_0x3862ae['where'],{'$or':_[_0x33a6('0x2b')](_0x2beb2a,function(_0x31e74e){if(_0x31e74e[_0x33a6('0x2f')]!==_0x33a6('0x3f')){var _0x4727f1={};_0x4727f1[_0x31e74e[_0x33a6('0x28')]]={'$like':'%'+_0x1793b2['query'][_0x33a6('0x3d')]+'%'};return _0x4727f1;}})});}_0x3862ae=_['merge']({},_0x3862ae,_0x1793b2[_0x33a6('0x40')]);var _0x225fca={'where':_0x3862ae[_0x33a6('0x3b')]};return db[_0x33a6('0x2c')][_0x33a6('0x1d')](_0x225fca)[_0x33a6('0x23')](function(_0x3fa482){_0x29b89c[_0x33a6('0x1d')]=_0x3fa482;if(_0x1793b2['query'][_0x33a6('0x41')]){_0x3862ae[_0x33a6('0x42')]=[{'all':!![]}];}return db[_0x33a6('0x2c')][_0x33a6('0x43')](_0x3862ae);})['then'](function(_0x544890){_0x29b89c[_0x33a6('0x44')]=_0x544890;return _0x29b89c;})[_0x33a6('0x23')](respondWithFilteredResult(_0x38fb55,_0x3862ae))[_0x33a6('0x45')](handleError(_0x38fb55,null));};exports[_0x33a6('0x46')]=function(_0x53b73f,_0x35b20b){var _0x1e4fe8={'raw':![],'where':{'id':_0x53b73f[_0x33a6('0x47')]['id']}},_0x66d3={};_0x66d3[_0x33a6('0x34')]=_[_0x33a6('0x32')](db[_0x33a6('0x2c')][_0x33a6('0x2d')]);_0x66d3['query']=_[_0x33a6('0x32')](_0x53b73f[_0x33a6('0x31')]);_0x66d3['filters']=_[_0x33a6('0x48')](_0x66d3[_0x33a6('0x34')],_0x66d3['query']);_0x1e4fe8['attributes']=_[_0x33a6('0x48')](_0x66d3[_0x33a6('0x34')],qs[_0x33a6('0x35')](_0x53b73f[_0x33a6('0x31')]['fields']));_0x1e4fe8['attributes']=_0x1e4fe8[_0x33a6('0x36')]['length']?_0x1e4fe8[_0x33a6('0x36')]:_0x66d3[_0x33a6('0x34')];if(_0x53b73f[_0x33a6('0x31')][_0x33a6('0x41')]){_0x1e4fe8[_0x33a6('0x42')]=[{'all':!![]}];}_0x1e4fe8=_[_0x33a6('0x3e')]({},_0x1e4fe8,_0x53b73f[_0x33a6('0x40')]);return db[_0x33a6('0x2c')][_0x33a6('0x49')](_0x1e4fe8)[_0x33a6('0x23')](handleEntityNotFound(_0x35b20b,null))[_0x33a6('0x23')](respondWithResult(_0x35b20b,null))[_0x33a6('0x45')](handleError(_0x35b20b,null));};exports[_0x33a6('0x4a')]=function(_0x50d2cb,_0x32183f){return db[_0x33a6('0x2c')][_0x33a6('0x4a')](_0x50d2cb[_0x33a6('0x4b')],{})[_0x33a6('0x23')](function(_0x1c8bf3){var _0x28c05b=_0x50d2cb[_0x33a6('0x4c')][_0x33a6('0x24')]({'plain':!![]});if(!_0x28c05b)throw new Error(_0x33a6('0x4d'));if(_0x28c05b[_0x33a6('0x4e')]==='user'){var _0x408b8d=_0x1c8bf3[_0x33a6('0x24')]({'plain':!![]});var _0x5792a3=_0x33a6('0x4f');return db[_0x33a6('0x50')][_0x33a6('0x49')]({'where':{'name':_0x5792a3,'userProfileId':_0x28c05b['userProfileId']},'raw':!![]})[_0x33a6('0x23')](function(_0x42049e){if(_0x42049e&&_0x42049e['autoAssociation']===0x0){return db[_0x33a6('0x51')][_0x33a6('0x4a')]({'name':_0x408b8d['name'],'resourceId':_0x408b8d['id'],'type':'CustomReports','sectionId':_0x42049e['id']},{})[_0x33a6('0x23')](function(){return _0x1c8bf3;});}else{return _0x1c8bf3;}})['catch'](function(_0x544270){logger[_0x33a6('0x27')](_0x33a6('0x52'),_0x544270);throw _0x544270;});}return _0x1c8bf3;})[_0x33a6('0x23')](respondWithResult(_0x32183f,0xc9))['catch'](handleError(_0x32183f,null));};exports['update']=function(_0x46deda,_0x49339c){if(_0x46deda[_0x33a6('0x4b')]['id']){delete _0x46deda[_0x33a6('0x4b')]['id'];}return db[_0x33a6('0x2c')]['find']({'where':{'id':_0x46deda[_0x33a6('0x47')]['id']}})['then'](handleEntityNotFound(_0x49339c,null))[_0x33a6('0x23')](saveUpdates(_0x46deda[_0x33a6('0x4b')],null))[_0x33a6('0x23')](respondWithResult(_0x49339c,null))[_0x33a6('0x45')](handleError(_0x49339c,null));};exports[_0x33a6('0x53')]=function(_0x5d412c,_0x247103){return db['AnalyticCustomReport'][_0x33a6('0x49')]({'where':{'id':_0x5d412c[_0x33a6('0x47')]['id']}})[_0x33a6('0x23')](handleEntityNotFound(_0x247103,null))[_0x33a6('0x23')](removeEntity(_0x247103,null))[_0x33a6('0x45')](handleError(_0x247103,null));};exports[_0x33a6('0x54')]=function(_0x3f6ee6,_0x5d6c39){var _0x3f9388=0xa;var _0x5e73d1=['join',_0x33a6('0x55'),'right_join',_0x33a6('0x56')];var _0x766134={'SUM':_0x33a6('0x57'),'COUNT':_0x33a6('0x58'),'COUNT DISTINCT':_0x33a6('0x59'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x33a6('0x5a'),'GROUP_CONCAT':_0x33a6('0x5b'),'GROUP_CONCAT ASC':_0x33a6('0x5c'),'GROUP_CONCAT DESC':_0x33a6('0x5d')};var _0x2ac3ba={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x33a6('0x5e'),'ROUND':_0x33a6('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x213a4d=function(_0x33649e){return!_[_0x33a6('0x60')]([_0x33a6('0x61'),_0x33a6('0x62'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x33649e);};var _0x4b5c80=function(_0x565e6c){if(!_0x565e6c||!_0x565e6c[_0x33a6('0x63')][_0x33a6('0x37')]){return'';}for(var _0x96a81e='(',_0x2699bf=0x0;_0x2699bf<_0x565e6c[_0x33a6('0x63')][_0x33a6('0x37')];_0x2699bf+=0x1){_0x2699bf>0x0&&(_0x96a81e+='\x20'+_0x565e6c[_0x33a6('0x64')]+'\x20');_0x96a81e+=_0x565e6c[_0x33a6('0x63')][_0x2699bf][_0x33a6('0x65')]?_0x4b5c80(_0x565e6c[_0x33a6('0x63')][_0x2699bf][_0x33a6('0x65')]):_0x565e6c[_0x33a6('0x63')][_0x2699bf]['field']+'\x20'+_0x565e6c[_0x33a6('0x63')][_0x2699bf][_0x33a6('0x66')]+(_0x213a4d(_0x565e6c[_0x33a6('0x63')][_0x2699bf]['condition'])?'\x20'+_0x565e6c[_0x33a6('0x63')][_0x2699bf][_0x33a6('0x67')]:'');}return _0x96a81e+')';};var _0x1e44cb={'where':{'id':_0x3f6ee6[_0x33a6('0x47')]['id']}},_0x55ab84,_0x479ff4,_0x4a4489,_0x18789e,_0x4d497f;_0x1e44cb=_[_0x33a6('0x3e')]({},_0x1e44cb,_0x3f6ee6['options']);return db[_0x33a6('0x2c')][_0x33a6('0x49')](_0x1e44cb)['then'](function(_0x3872d4){if(_0x3872d4){_0x55ab84=_0x3872d4;return _0x3872d4['getFields']();}return null;})[_0x33a6('0x23')](function(_0x234176){if(_0x234176){if(!_0x234176[_0x33a6('0x37')]){throw new db['Sequelize'][(_0x33a6('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x479ff4=_0x234176;return db['AnalyticMetric'][_0x33a6('0x43')]({'raw':!![]});}return null;})[_0x33a6('0x23')](function(_0x4ae312){if(_0x4ae312){_0x4a4489=_[_0x33a6('0x69')](_0x4ae312,'id');var _0x53db50;var _0x3c7f36=squel[_0x33a6('0x6a')]();_0x3c7f36[_0x33a6('0x6b')](_0x55ab84[_0x33a6('0x6c')]);for(var _0x221cf6=0x0;_0x221cf6<_0x479ff4[_0x33a6('0x37')];_0x221cf6+=0x1){_0x53db50=_0x479ff4[_0x221cf6][_0x33a6('0x6d')]?_0x4a4489[_0x479ff4[_0x221cf6][_0x33a6('0x6d')]][_0x33a6('0x6e')]:_0x479ff4[_0x221cf6][_0x33a6('0x6f')];_0x53db50=_0x479ff4[_0x221cf6][_0x33a6('0x70')]?_[_0x33a6('0x71')](_0x766134[_0x479ff4[_0x221cf6][_0x33a6('0x70')]],'%s',_0x53db50):_0x53db50;_0x53db50=_0x479ff4[_0x221cf6][_0x33a6('0x72')]?_[_0x33a6('0x71')](_0x2ac3ba[_0x479ff4[_0x221cf6][_0x33a6('0x72')]],'%s',_0x53db50):_0x53db50;if(_0x479ff4[_0x221cf6]['groupBy']){_0x3c7f36[_0x33a6('0x65')](_0x53db50);}_0x479ff4[_0x221cf6][_0x33a6('0x73')]&&_0x3c7f36[_0x33a6('0x39')](_0x53db50,_0x479ff4[_0x221cf6][_0x33a6('0x73')]===_0x33a6('0x74')?![]:!![]);_0x3c7f36['field'](_0x53db50,_0x479ff4[_0x221cf6][_0x33a6('0x75')]||_0x53db50);}if(_0x55ab84[_0x33a6('0x76')]){_0x55ab84[_0x33a6('0x76')]=JSON['parse'](_0x55ab84[_0x33a6('0x76')]);for(var _0x27ef0d=0x0;_0x27ef0d<_0x55ab84['joins'][_0x33a6('0x37')];_0x27ef0d+=0x1){if(_0x55ab84[_0x33a6('0x76')][_0x27ef0d]['type']&&_[_0x33a6('0x60')](_0x5e73d1,_0x55ab84[_0x33a6('0x76')][_0x27ef0d]['type'])&&_0x55ab84[_0x33a6('0x76')][_0x27ef0d]['parentKey']&&_0x55ab84[_0x33a6('0x76')][_0x27ef0d][_0x33a6('0x77')]&&_0x55ab84[_0x33a6('0x76')][_0x27ef0d][_0x33a6('0x78')]){_0x3c7f36[_0x55ab84[_0x33a6('0x76')][_0x27ef0d][_0x33a6('0x2f')]](_0x55ab84[_0x33a6('0x76')][_0x27ef0d]['foreignTable'],null,util[_0x33a6('0x72')](_0x33a6('0x79'),_0x55ab84[_0x33a6('0x6c')],_0x55ab84[_0x33a6('0x76')][_0x27ef0d][_0x33a6('0x7a')],_0x55ab84[_0x33a6('0x76')][_0x27ef0d][_0x33a6('0x77')],_0x55ab84['joins'][_0x27ef0d]['foreignKey']));}}}if(_0x55ab84[_0x33a6('0x7b')]){_0x55ab84['conditions']=JSON[_0x33a6('0x7c')](_0x55ab84[_0x33a6('0x7b')]);_0x3c7f36[_0x33a6('0x3b')](_0x4b5c80(_0x55ab84['conditions']['group']));}_0x4d497f=_0x3c7f36[_0x33a6('0x7d')]();_0x3c7f36[_0x33a6('0x1c')](_0x3f9388);_0x3c7f36['offset'](0x0);logger['debug'](_0x33a6('0x7e'),_0x3c7f36[_0x33a6('0x7f')]());return dbH['sequelize'][_0x33a6('0x31')](_0x3c7f36[_0x33a6('0x7f')](),{'type':dbH['sequelize'][_0x33a6('0x80')][_0x33a6('0x81')]});}})[_0x33a6('0x23')](respondWithResult(_0x5d6c39,null))[_0x33a6('0x45')](handleError(_0x5d6c39,null));};function runReport(_0x1a381b,_0x2ee519,_0x11a5e6){var _0x1c2a38=_0x2ee519[_0x33a6('0x28')];var _0x18d0cb=0xa;var _0x32deb0=['join',_0x33a6('0x55'),'right_join',_0x33a6('0x56')];var _0x26d524={'SUM':_0x33a6('0x57'),'COUNT':_0x33a6('0x58'),'COUNT DISTINCT':_0x33a6('0x59'),'MAX':_0x33a6('0x82'),'MIN':'MIN(%s)','AVG':_0x33a6('0x5a'),'GROUP_CONCAT':_0x33a6('0x5b'),'GROUP_CONCAT ASC':_0x33a6('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5c49da={'SEC_TO_TIME':_0x33a6('0x83'),'DATE':_0x33a6('0x84'),'HOUR':_0x33a6('0x5e'),'ROUND':_0x33a6('0x5f'),'UNIX_TIMESTAMP':_0x33a6('0x85')};var _0x279802=function(_0x19cb91){return!_[_0x33a6('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x33a6('0x86'),_0x33a6('0x87')],_0x19cb91);};var _0x5565fc=function(_0x221b64){if(!_0x221b64||!_0x221b64[_0x33a6('0x63')]['length']){return'';}for(var _0x4b01f0='(',_0x574f7e=0x0;_0x574f7e<_0x221b64['rules']['length'];_0x574f7e+=0x1){_0x574f7e>0x0&&(_0x4b01f0+='\x20'+_0x221b64['operator']+'\x20');_0x4b01f0+=_0x221b64['rules'][_0x574f7e]['group']?_0x5565fc(_0x221b64[_0x33a6('0x63')][_0x574f7e][_0x33a6('0x65')]):_0x221b64[_0x33a6('0x63')][_0x574f7e]['field']+'\x20'+_0x221b64[_0x33a6('0x63')][_0x574f7e][_0x33a6('0x66')]+(_0x279802(_0x221b64[_0x33a6('0x63')][_0x574f7e][_0x33a6('0x66')])?'\x20'+_0x221b64[_0x33a6('0x63')][_0x574f7e][_0x33a6('0x67')]:'');}return _0x4b01f0+')';};var _0x5bbbfa={'where':{'id':_0x1a381b['id']}},_0x1a5ace,_0x342694,_0x5b7f77,_0x50878b,_0x3f3582;_0x5bbbfa=_[_0x33a6('0x3e')]({},_0x5bbbfa,_0x11a5e6);return db[_0x33a6('0x2c')][_0x33a6('0x49')](_0x5bbbfa)[_0x33a6('0x23')](function(_0x47c4c5){if(_0x47c4c5){_0x1a5ace=_0x47c4c5;return _0x47c4c5[_0x33a6('0x88')]();}return null;})[_0x33a6('0x23')](function(_0x2aa3c0){if(_0x2aa3c0){if(!_0x2aa3c0[_0x33a6('0x37')]){throw new db[(_0x33a6('0x89'))][(_0x33a6('0x68'))](_0x33a6('0x8a'),0x193);}_0x342694=_0x2aa3c0;return db[_0x33a6('0x8b')][_0x33a6('0x43')]({'raw':!![]});}return null;})[_0x33a6('0x23')](function(_0x219c39){if(_0x219c39){_0x5b7f77=_[_0x33a6('0x69')](_0x219c39,'id');var _0x381f1f;var _0x284ba5=squel[_0x33a6('0x6a')]();_0x284ba5[_0x33a6('0x6b')](_0x1a5ace[_0x33a6('0x6c')]);for(var _0x5217bf=0x0;_0x5217bf<_0x342694['length'];_0x5217bf+=0x1){_0x381f1f=_0x342694[_0x5217bf][_0x33a6('0x6d')]?_0x5b7f77[_0x342694[_0x5217bf]['MetricId']][_0x33a6('0x6e')]:_0x342694[_0x5217bf][_0x33a6('0x6f')];_0x381f1f=_0x342694[_0x5217bf]['function']?_[_0x33a6('0x71')](_0x26d524[_0x342694[_0x5217bf][_0x33a6('0x70')]],'%s',_0x381f1f):_0x381f1f;_0x381f1f=_0x342694[_0x5217bf]['format']?_['replace'](_0x5c49da[_0x342694[_0x5217bf][_0x33a6('0x72')]],'%s',_0x381f1f):_0x381f1f;if(_0x342694[_0x5217bf][_0x33a6('0x8c')]){_0x284ba5[_0x33a6('0x65')](_0x381f1f);}_0x342694[_0x5217bf][_0x33a6('0x73')]&&_0x284ba5['order'](_0x381f1f,_0x342694[_0x5217bf][_0x33a6('0x73')]===_0x33a6('0x74')?![]:!![]);_0x284ba5['field'](_0x381f1f,_0x342694[_0x5217bf][_0x33a6('0x75')]||_0x381f1f);}if(_0x1a5ace[_0x33a6('0x76')]){_0x1a5ace[_0x33a6('0x76')]=JSON[_0x33a6('0x7c')](_0x1a5ace[_0x33a6('0x76')]);for(var _0x575a2f=0x0;_0x575a2f<_0x1a5ace['joins']['length'];_0x575a2f+=0x1){if(_0x1a5ace['joins'][_0x575a2f]['type']&&_[_0x33a6('0x60')](_0x32deb0,_0x1a5ace[_0x33a6('0x76')][_0x575a2f]['type'])&&_0x1a5ace[_0x33a6('0x76')][_0x575a2f][_0x33a6('0x7a')]&&_0x1a5ace[_0x33a6('0x76')][_0x575a2f][_0x33a6('0x77')]&&_0x1a5ace[_0x33a6('0x76')][_0x575a2f][_0x33a6('0x78')]){_0x284ba5[_0x1a5ace[_0x33a6('0x76')][_0x575a2f]['type']](_0x1a5ace[_0x33a6('0x76')][_0x575a2f][_0x33a6('0x77')],null,util[_0x33a6('0x72')](_0x33a6('0x79'),_0x1a5ace['table'],_0x1a5ace[_0x33a6('0x76')][_0x575a2f][_0x33a6('0x7a')],_0x1a5ace[_0x33a6('0x76')][_0x575a2f][_0x33a6('0x77')],_0x1a5ace[_0x33a6('0x76')][_0x575a2f]['foreignKey']));}}}if(_0x1a5ace['conditions']){_0x1a5ace[_0x33a6('0x7b')]=JSON[_0x33a6('0x7c')](_0x1a5ace['conditions']);_0x284ba5[_0x33a6('0x3b')](_0x5565fc(_0x1a5ace[_0x33a6('0x7b')][_0x33a6('0x65')]));}_0x3f3582=_0x284ba5[_0x33a6('0x7d')]();_0x284ba5[_0x33a6('0x1c')](_0x18d0cb);_0x284ba5[_0x33a6('0x1a')](0x0);return;}})['then'](function(){if(_0x2ee519['output']==='web'){return null;}var _0x321a13=_[_0x33a6('0x3e')](_0x2ee519,{'name':_0x2ee519['fullPath']||_0x2ee519['name']||_0x1a5ace[_0x33a6('0x28')],'basename':_0x1c2a38,'savename':util[_0x33a6('0x72')](_0x33a6('0x8d'),_0x2ee519['name']||_0x1a5ace[_0x33a6('0x28')],require(_0x33a6('0x8e'))[_0x33a6('0x8f')](0x4),_0x2ee519[_0x33a6('0x90')]||_0x33a6('0x91')),'reportId':_0x1a5ace['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x33a6('0x4a')](_0x321a13,{'raw':!![]});})[_0x33a6('0x23')](function(_0x455f37){if(_0x1a5ace[_0x33a6('0x6c')]==='cdr'){_0x3f3582['where'](_0x1a5ace[_0x33a6('0x6c')]+_0x33a6('0x92'),_0x2ee519[_0x33a6('0x93')],_0x2ee519['endDate']);}else{_0x3f3582['where'](_0x1a5ace[_0x33a6('0x6c')]+_0x33a6('0x94'),_0x2ee519['startDate'],_0x2ee519[_0x33a6('0x95')]);}if(_0x455f37){logger[_0x33a6('0x96')](_0x33a6('0x97'),_0x3f3582[_0x33a6('0x7f')]());require(_0x33a6('0x98'))[_0x33a6('0x99')](path[_0x33a6('0x9a')](__dirname,_0x33a6('0x9b'),_0x455f37[_0x33a6('0x90')]),[_0x455f37['id'],_0x3f3582['toString'](),path['join'](__dirname,_0x33a6('0x9c'),_0x455f37[_0x33a6('0x9d')]),_0x1c2a38]);return _0x455f37;}else{var _0x5482e0=squel[_0x33a6('0x6a')]();_0x5482e0['from']('('+_0x3f3582[_0x33a6('0x7f')]()+')','countTable');_0x5482e0[_0x33a6('0x6f')]('COUNT(*)',_0x33a6('0x1d'));_0x3f3582[_0x33a6('0x1c')](_0x2ee519[_0x33a6('0x1c')]||_0x18d0cb);_0x3f3582[_0x33a6('0x1a')](_0x2ee519[_0x33a6('0x1a')]||0x0);return dbH['sequelize'][_0x33a6('0x31')](_0x5482e0['toString'](),{'type':dbH[_0x33a6('0x9e')][_0x33a6('0x80')]['SELECT']})[_0x33a6('0x23')](function(_0x3e51be){if(!_0x3e51be['length']){_0x50878b=0x0;}else{_0x50878b=_0x3e51be[0x0]['count']||0x0;}return dbH['sequelize'][_0x33a6('0x31')](_0x3f3582[_0x33a6('0x7f')](),{'type':dbH[_0x33a6('0x9e')][_0x33a6('0x80')]['SELECT']});})[_0x33a6('0x23')](function(_0x2527f2){return{'rows':_0x2527f2||[],'count':_0x50878b};});}});}exports['run']=function(_0x5ab24c,_0x52ce28){return runReport(_0x5ab24c[_0x33a6('0x47')],_0x5ab24c[_0x33a6('0x31')],_0x5ab24c['options'])[_0x33a6('0x23')](respondWithResult(_0x52ce28,null))[_0x33a6('0x45')](handleError(_0x52ce28,null));};exports[_0x33a6('0x9f')]=runReport;exports[_0x33a6('0x31')]=function(_0x4e7196,_0x3ce7e3){var _0x11756d=0xa;var _0x4fd9c2=[_0x33a6('0x9a'),_0x33a6('0x55'),_0x33a6('0xa0'),_0x33a6('0x56')];var _0x2b72ca={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x33a6('0x5a'),'GROUP_CONCAT':_0x33a6('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x33a6('0x5d')};var _0x445984={'SEC_TO_TIME':_0x33a6('0x83'),'DATE':_0x33a6('0x84'),'HOUR':'HOUR(%s)','ROUND':_0x33a6('0x5f'),'UNIX_TIMESTAMP':_0x33a6('0x85')};var _0x4e9ac5=function(_0x2d3877){return!_[_0x33a6('0x60')]([_0x33a6('0x61'),'IS\x20NOT\x20NULL',_0x33a6('0x86'),_0x33a6('0x87')],_0x2d3877);};var _0x51e3d7=function(_0x21bb0e){if(!_0x21bb0e||!_0x21bb0e[_0x33a6('0x63')][_0x33a6('0x37')]){return'';}for(var _0x184ccb='(',_0x359632=0x0;_0x359632<_0x21bb0e[_0x33a6('0x63')]['length'];_0x359632+=0x1){_0x359632>0x0&&(_0x184ccb+='\x20'+_0x21bb0e[_0x33a6('0x64')]+'\x20');_0x184ccb+=_0x21bb0e['rules'][_0x359632][_0x33a6('0x65')]?_0x51e3d7(_0x21bb0e[_0x33a6('0x63')][_0x359632]['group']):_0x21bb0e[_0x33a6('0x63')][_0x359632][_0x33a6('0x6f')]+'\x20'+_0x21bb0e[_0x33a6('0x63')][_0x359632]['condition']+(_0x4e9ac5(_0x21bb0e[_0x33a6('0x63')][_0x359632][_0x33a6('0x66')])?'\x20'+_0x21bb0e['rules'][_0x359632][_0x33a6('0x67')]:'');}return _0x184ccb+')';};var _0x60dc1d={'where':{'id':_0x4e7196['params']['id']}},_0x44a76b,_0xd6312e,_0x3cc5ac,_0x57276b,_0x47315c;_0x60dc1d=_['merge']({},_0x60dc1d,_0x4e7196['options']);return db[_0x33a6('0x2c')][_0x33a6('0x49')](_0x60dc1d)[_0x33a6('0x23')](function(_0x22e13c){if(_0x22e13c){_0x44a76b=_0x22e13c;return _0x22e13c[_0x33a6('0x88')]();}return null;})['then'](function(_0x19672c){if(_0x19672c){if(!_0x19672c[_0x33a6('0x37')]){throw new db['Sequelize'][(_0x33a6('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xd6312e=_0x19672c;return db[_0x33a6('0x8b')][_0x33a6('0x43')]({'raw':!![]});}return null;})[_0x33a6('0x23')](function(_0x290e3b){if(_0x290e3b){_0x3cc5ac=_['keyBy'](_0x290e3b,'id');var _0x5f4825;var _0x27604c=squel[_0x33a6('0x6a')]();_0x27604c[_0x33a6('0x6b')](_0x44a76b[_0x33a6('0x6c')]);for(var _0x36c6de=0x0;_0x36c6de<_0xd6312e[_0x33a6('0x37')];_0x36c6de+=0x1){_0x5f4825=_0xd6312e[_0x36c6de][_0x33a6('0x6d')]?_0x3cc5ac[_0xd6312e[_0x36c6de]['MetricId']][_0x33a6('0x6e')]:_0xd6312e[_0x36c6de][_0x33a6('0x6f')];_0x5f4825=_0xd6312e[_0x36c6de][_0x33a6('0x70')]?_[_0x33a6('0x71')](_0x2b72ca[_0xd6312e[_0x36c6de][_0x33a6('0x70')]],'%s',_0x5f4825):_0x5f4825;_0x5f4825=_0xd6312e[_0x36c6de]['format']?_[_0x33a6('0x71')](_0x445984[_0xd6312e[_0x36c6de]['format']],'%s',_0x5f4825):_0x5f4825;if(_0xd6312e[_0x36c6de]['groupBy']){_0x27604c[_0x33a6('0x65')](_0x5f4825);}_0xd6312e[_0x36c6de][_0x33a6('0x73')]&&_0x27604c[_0x33a6('0x39')](_0x5f4825,_0xd6312e[_0x36c6de][_0x33a6('0x73')]===_0x33a6('0x74')?![]:!![]);_0x27604c['field'](_0x5f4825,_0xd6312e[_0x36c6de][_0x33a6('0x75')]||_0x5f4825);}if(_0x44a76b['joins']){_0x44a76b[_0x33a6('0x76')]=JSON[_0x33a6('0x7c')](_0x44a76b['joins']);for(var _0x328ff9=0x0;_0x328ff9<_0x44a76b[_0x33a6('0x76')][_0x33a6('0x37')];_0x328ff9+=0x1){if(_0x44a76b[_0x33a6('0x76')][_0x328ff9][_0x33a6('0x2f')]&&_[_0x33a6('0x60')](_0x4fd9c2,_0x44a76b[_0x33a6('0x76')][_0x328ff9][_0x33a6('0x2f')])&&_0x44a76b[_0x33a6('0x76')][_0x328ff9]['parentKey']&&_0x44a76b[_0x33a6('0x76')][_0x328ff9][_0x33a6('0x77')]&&_0x44a76b[_0x33a6('0x76')][_0x328ff9][_0x33a6('0x78')]){_0x27604c[_0x44a76b['joins'][_0x328ff9][_0x33a6('0x2f')]](_0x44a76b[_0x33a6('0x76')][_0x328ff9]['foreignTable'],null,util[_0x33a6('0x72')](_0x33a6('0x79'),_0x44a76b[_0x33a6('0x6c')],_0x44a76b[_0x33a6('0x76')][_0x328ff9]['parentKey'],_0x44a76b['joins'][_0x328ff9]['foreignTable'],_0x44a76b[_0x33a6('0x76')][_0x328ff9]['foreignKey']));}}}if(_0x44a76b['conditions']){_0x44a76b[_0x33a6('0x7b')]=JSON['parse'](_0x44a76b[_0x33a6('0x7b')]);_0x27604c[_0x33a6('0x3b')](_0x51e3d7(_0x44a76b['conditions'][_0x33a6('0x65')]));}_0x47315c=_0x27604c[_0x33a6('0x7d')]();_0x27604c['limit'](_0x11756d);_0x27604c[_0x33a6('0x1a')](0x0);logger[_0x33a6('0xa1')](_0x33a6('0x7e'),_0x27604c['toString']());return dbH[_0x33a6('0x9e')][_0x33a6('0x31')](_0x27604c[_0x33a6('0x7f')](),{'type':dbH[_0x33a6('0x9e')]['QueryTypes']['SELECT']});}})[_0x33a6('0x23')](function(){return{'sql':_0x47315c['toString']()};})[_0x33a6('0x23')](respondWithResult(_0x3ce7e3,null))[_0x33a6('0x45')](handleError(_0x3ce7e3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 445acd7..000d245 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 _0x28f6=['analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x28f6,0x79));var _0x628f=function(_0x5f1c59,_0x403efe){_0x5f1c59=_0x5f1c59-0x0;var _0x1364a5=_0x28f6[_0x5f1c59];return _0x1364a5;};'use strict';var _=require('lodash');var util=require(_0x628f('0x0'));var logger=require(_0x628f('0x1'))(_0x628f('0x2'));var moment=require(_0x628f('0x3'));var BPromise=require(_0x628f('0x4'));var rp=require(_0x628f('0x5'));var fs=require('fs');var path=require(_0x628f('0x6'));var rimraf=require('rimraf');var config=require(_0x628f('0x7'));var attributes=require(_0x628f('0x8'));module['exports']=function(_0x53cd83,_0x32dc9e){return _0x53cd83[_0x628f('0x9')](_0x628f('0xa'),attributes,{'tableName':_0x628f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x415b=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','analytics_custom_reports','util','../../config/logger'];(function(_0x37f089,_0x17720d){var _0x46f202=function(_0x50aece){while(--_0x50aece){_0x37f089['push'](_0x37f089['shift']());}};_0x46f202(++_0x17720d);}(_0x415b,0x198));var _0xb415=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x415b[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xb415('0x0'));var logger=require(_0xb415('0x1'))(_0xb415('0x2'));var moment=require('moment');var BPromise=require(_0xb415('0x3'));var rp=require(_0xb415('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb415('0x5'));var config=require(_0xb415('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xb415('0x7')]=function(_0x4b6e8a,_0x464c88){return _0x4b6e8a[_0xb415('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xb415('0x9'),'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 cd6fbf5..995be21 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 _0x8d31=['AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x133ef3,_0xc17ee6){var _0x35772d=function(_0x598d7d){while(--_0x598d7d){_0x133ef3['push'](_0x133ef3['shift']());}};_0x35772d(++_0xc17ee6);}(_0x8d31,0x121));var _0x18d3=function(_0x3d3334,_0x153407){_0x3d3334=_0x3d3334-0x0;var _0x521fa5=_0x8d31[_0x3d3334];return _0x521fa5;};'use strict';var _=require(_0x18d3('0x0'));var util=require(_0x18d3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x18d3('0x2'));var fs=require('fs');var Redis=require(_0x18d3('0x3'));var db=require(_0x18d3('0x4'))['db'];var utils=require(_0x18d3('0x5'));var logger=require(_0x18d3('0x6'))(_0x18d3('0x7'));var config=require(_0x18d3('0x8'));var jayson=require(_0x18d3('0x9'));var client=jayson[_0x18d3('0xa')][_0x18d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4299e9,_0x8cdb35,_0x2318dd){return new BPromise(function(_0x48f39d,_0x4e4e79){return client[_0x18d3('0xc')](_0x4299e9,_0x2318dd)[_0x18d3('0xd')](function(_0x1b3e14){logger[_0x18d3('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x8cdb35,_0x18d3('0xf'));logger[_0x18d3('0x10')](_0x18d3('0x11'),_0x8cdb35,_0x18d3('0xf'),JSON['stringify'](_0x1b3e14));if(_0x1b3e14['error']){if(_0x1b3e14[_0x18d3('0x12')]['code']===0x1f4){logger[_0x18d3('0x12')](_0x18d3('0x13'),_0x8cdb35,_0x1b3e14['error'][_0x18d3('0x14')]);return _0x4e4e79(_0x1b3e14[_0x18d3('0x12')][_0x18d3('0x14')]);}logger['error'](_0x18d3('0x13'),_0x8cdb35,_0x1b3e14[_0x18d3('0x12')][_0x18d3('0x14')]);return _0x48f39d(_0x1b3e14[_0x18d3('0x12')][_0x18d3('0x14')]);}else{logger[_0x18d3('0xe')](_0x18d3('0x13'),_0x8cdb35,_0x18d3('0xf'));_0x48f39d(_0x1b3e14[_0x18d3('0x15')][_0x18d3('0x14')]);}})['catch'](function(_0x570b48){logger['error'](_0x18d3('0x13'),_0x8cdb35,_0x570b48);_0x4e4e79(_0x570b48);});});} \ No newline at end of file +var _0xcd67=['randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird'];(function(_0x3afd0a,_0xa8a228){var _0x26651f=function(_0x301020){while(--_0x301020){_0x3afd0a['push'](_0x3afd0a['shift']());}};_0x26651f(++_0xa8a228);}(_0xcd67,0xa9));var _0x7cd6=function(_0x27e4aa,_0x1e8ce5){_0x27e4aa=_0x27e4aa-0x0;var _0x299c7a=_0xcd67[_0x27e4aa];return _0x299c7a;};'use strict';var _=require(_0x7cd6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7cd6('0x1'));var rs=require(_0x7cd6('0x2'));var fs=require('fs');var Redis=require(_0x7cd6('0x3'));var db=require(_0x7cd6('0x4'))['db'];var utils=require(_0x7cd6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7cd6('0x6')][_0x7cd6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bbbfc,_0x115ee3,_0x36c96e){return new BPromise(function(_0x4da491,_0x4ad5ec){return client[_0x7cd6('0x8')](_0x5bbbfc,_0x36c96e)[_0x7cd6('0x9')](function(_0x902e01){logger[_0x7cd6('0xa')](_0x7cd6('0xb'),_0x115ee3,_0x7cd6('0xc'));logger[_0x7cd6('0xd')](_0x7cd6('0xe'),_0x115ee3,_0x7cd6('0xc'),JSON['stringify'](_0x902e01));if(_0x902e01[_0x7cd6('0xf')]){if(_0x902e01[_0x7cd6('0xf')]['code']===0x1f4){logger[_0x7cd6('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x115ee3,_0x902e01[_0x7cd6('0xf')][_0x7cd6('0x10')]);return _0x4ad5ec(_0x902e01[_0x7cd6('0xf')][_0x7cd6('0x10')]);}logger[_0x7cd6('0xf')](_0x7cd6('0xb'),_0x115ee3,_0x902e01['error']['message']);return _0x4da491(_0x902e01[_0x7cd6('0xf')]['message']);}else{logger[_0x7cd6('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x115ee3,'request\x20sent');_0x4da491(_0x902e01[_0x7cd6('0x11')][_0x7cd6('0x10')]);}})[_0x7cd6('0x12')](function(_0x5bb98f){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x115ee3,_0x5bb98f);_0x4ad5ec(_0x5bb98f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9c492aa..b3d3f63 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 _0x314d=['post','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query'];(function(_0x5dbb30,_0xae62ea){var _0x34e7e0=function(_0x5d6b4b){while(--_0x5d6b4b){_0x5dbb30['push'](_0x5dbb30['shift']());}};_0x34e7e0(++_0xae62ea);}(_0x314d,0x82));var _0xd314=function(_0x1bdeaf,_0x23d54e){_0x1bdeaf=_0x1bdeaf-0x0;var _0x440ca4=_0x314d[_0x1bdeaf];return _0x440ca4;};'use strict';var multer=require(_0xd314('0x0'));var util=require('util');var path=require(_0xd314('0x1'));var timeout=require(_0xd314('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd314('0x3'));var auth=require(_0xd314('0x4'));var interaction=require(_0xd314('0x5'));var config=require(_0xd314('0x6'));var controller=require(_0xd314('0x7'));router[_0xd314('0x8')]('/',auth['isAuthenticated'](),controller[_0xd314('0x9')]);router[_0xd314('0x8')](_0xd314('0xa'),auth[_0xd314('0xb')](),controller[_0xd314('0xc')]);router['get'](_0xd314('0xd'),auth[_0xd314('0xb')](),controller[_0xd314('0xe')]);router[_0xd314('0x8')](_0xd314('0xf'),auth[_0xd314('0xb')](),controller['run']);router['get'](_0xd314('0x10'),auth['isAuthenticated'](),controller['query']);router[_0xd314('0x11')]('/',auth[_0xd314('0xb')](),controller['create']);router['put'](_0xd314('0xa'),auth[_0xd314('0xb')](),controller[_0xd314('0x12')]);router['delete']('/:id',auth[_0xd314('0xb')](),controller[_0xd314('0x13')]);module[_0xd314('0x14')]=router; \ No newline at end of file +var _0x52bc=['/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','post','create','put','delete','exports','connect-timeout','Router','fs-extra','../../components/interaction/service','./analyticCustomReport.controller','get'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x52bc,0xf9));var _0xc52b=function(_0x24f31c,_0x54144e){_0x24f31c=_0x24f31c-0x0;var _0x22cfc4=_0x52bc[_0x24f31c];return _0x22cfc4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc52b('0x0'));var express=require('express');var router=express[_0xc52b('0x1')]();var fs_extra=require(_0xc52b('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc52b('0x3'));var config=require('../../config/environment');var controller=require(_0xc52b('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc52b('0x5')](_0xc52b('0x6'),auth[_0xc52b('0x7')](),controller[_0xc52b('0x8')]);router[_0xc52b('0x5')](_0xc52b('0x9'),auth[_0xc52b('0x7')](),controller[_0xc52b('0xa')]);router['get'](_0xc52b('0xb'),auth[_0xc52b('0x7')](),controller['run']);router[_0xc52b('0x5')]('/:id/query',auth[_0xc52b('0x7')](),controller['query']);router[_0xc52b('0xc')]('/',auth[_0xc52b('0x7')](),controller[_0xc52b('0xd')]);router[_0xc52b('0xe')]('/:id',auth[_0xc52b('0x7')](),controller['update']);router[_0xc52b('0xf')](_0xc52b('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0xc52b('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index fecc3f4..d4d4e1f 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x258257,_0x32042d){var _0xafb58a=function(_0x506b5a){while(--_0x506b5a){_0x258257['push'](_0x258257['shift']());}};_0xafb58a(++_0x32042d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0xfdbd[_0x2b0875];return _0xedb8d7;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x2291cb,_0x3d2b79){var _0x53b5d2=function(_0x300c99){while(--_0x300c99){_0x2291cb['push'](_0x2291cb['shift']());}};_0x53b5d2(++_0x3d2b79);}(_0x2bd8,0x130));var _0x82bd=function(_0x4c1a9b,_0x31b98e){_0x4c1a9b=_0x4c1a9b-0x0;var _0x504fba=_0x2bd8[_0x4c1a9b];return _0x504fba;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9349e65..66cb44b 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 _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x53fb07,_0x513401){var _0x42eb6f=function(_0x4b4dc0){while(--_0x4b4dc0){_0x53fb07['push'](_0x53fb07['shift']());}};_0x42eb6f(++_0x513401);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2013b2,_0xfd0c3d){_0x2013b2=_0x2013b2-0x0;var _0x5e0c0a=_0x1cb9[_0x2013b2];return _0x5e0c0a;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x44694b,_0x523100){var _0xc6a8a2=function(_0xefdca4){while(--_0xefdca4){_0x44694b['push'](_0x44694b['shift']());}};_0xc6a8a2(++_0x523100);}(_0xda19,0xd5));var _0x9da1=function(_0x5856ec,_0x536dbc){_0x5856ec=_0x5856ec-0x0;var _0x52641f=_0xda19[_0x5856ec];return _0x52641f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3e29842..c939e62 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 _0x5c53=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util'];(function(_0xd4ec0c,_0x2afcd2){var _0x580218=function(_0x3b1cd4){while(--_0x3b1cd4){_0xd4ec0c['push'](_0xd4ec0c['shift']());}};_0x580218(++_0x2afcd2);}(_0x5c53,0x1ea));var _0x35c5=function(_0xc91901,_0x16041d){_0xc91901=_0xc91901-0x0;var _0x45ded1=_0x5c53[_0xc91901];return _0x45ded1;};'use strict';var _=require(_0x35c5('0x0'));var util=require(_0x35c5('0x1'));var logger=require('../../config/logger')(_0x35c5('0x2'));var moment=require(_0x35c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x35c5('0x4'));var fs=require('fs');var path=require(_0x35c5('0x5'));var rimraf=require(_0x35c5('0x6'));var config=require(_0x35c5('0x7'));var attributes=require(_0x35c5('0x8'));module[_0x35c5('0x9')]=function(_0x950087,_0x2071a3){return _0x950087[_0x35c5('0xa')](_0x35c5('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb11f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','analytics_default_reports'];(function(_0x3f8572,_0xe61af4){var _0x94e63e=function(_0x45db5e){while(--_0x45db5e){_0x3f8572['push'](_0x3f8572['shift']());}};_0x94e63e(++_0xe61af4);}(_0xb11f,0x1b0));var _0xfb11=function(_0x3f1618,_0x58b2da){_0x3f1618=_0x3f1618-0x0;var _0x1a6baa=_0xb11f[_0x3f1618];return _0x1a6baa;};'use strict';var _=require(_0xfb11('0x0'));var util=require(_0xfb11('0x1'));var logger=require(_0xfb11('0x2'))(_0xfb11('0x3'));var moment=require(_0xfb11('0x4'));var BPromise=require(_0xfb11('0x5'));var rp=require(_0xfb11('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb11('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x22ed5c,_0x59a4f6){return _0x22ed5c['define']('AnalyticDefaultReport',attributes,{'tableName':_0xfb11('0x8'),'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 cfa9736..9bbaf32 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 _0x60d4=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3815b2,_0xdeaa84){var _0x2ebd79=function(_0x4ed85a){while(--_0x4ed85a){_0x3815b2['push'](_0x3815b2['shift']());}};_0x2ebd79(++_0xdeaa84);}(_0x60d4,0x1ab));var _0x460d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x60d4[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x460d('0x0'));var util=require(_0x460d('0x1'));var moment=require(_0x460d('0x2'));var BPromise=require(_0x460d('0x3'));var rs=require(_0x460d('0x4'));var fs=require('fs');var Redis=require(_0x460d('0x5'));var db=require(_0x460d('0x6'))['db'];var utils=require(_0x460d('0x7'));var logger=require(_0x460d('0x8'))(_0x460d('0x9'));var config=require(_0x460d('0xa'));var jayson=require(_0x460d('0xb'));var client=jayson[_0x460d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b1328,_0x750b4c,_0x2c52ce){return new BPromise(function(_0x19b29e,_0x13b37f){return client[_0x460d('0xd')](_0x5b1328,_0x2c52ce)[_0x460d('0xe')](function(_0x391812){logger[_0x460d('0xf')](_0x460d('0x10'),_0x750b4c,_0x460d('0x11'));logger[_0x460d('0x12')](_0x460d('0x13'),_0x750b4c,'request\x20sent',JSON[_0x460d('0x14')](_0x391812));if(_0x391812['error']){if(_0x391812[_0x460d('0x15')][_0x460d('0x16')]===0x1f4){logger[_0x460d('0x15')](_0x460d('0x10'),_0x750b4c,_0x391812[_0x460d('0x15')][_0x460d('0x17')]);return _0x13b37f(_0x391812[_0x460d('0x15')][_0x460d('0x17')]);}logger['error'](_0x460d('0x10'),_0x750b4c,_0x391812[_0x460d('0x15')]['message']);return _0x19b29e(_0x391812[_0x460d('0x15')][_0x460d('0x17')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x750b4c,_0x460d('0x11'));_0x19b29e(_0x391812['result']['message']);}})[_0x460d('0x18')](function(_0x3798ba){logger[_0x460d('0x15')](_0x460d('0x10'),_0x750b4c,_0x3798ba);_0x13b37f(_0x3798ba);});});} \ No newline at end of file +var _0x59d6=['rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc438ce,_0x5eea69){var _0x5d6ef4=function(_0x29be45){while(--_0x29be45){_0xc438ce['push'](_0xc438ce['shift']());}};_0x5d6ef4(++_0x5eea69);}(_0x59d6,0x150));var _0x659d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x59d6[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x659d('0x0'));var util=require(_0x659d('0x1'));var moment=require(_0x659d('0x2'));var BPromise=require(_0x659d('0x3'));var rs=require(_0x659d('0x4'));var fs=require('fs');var Redis=require(_0x659d('0x5'));var db=require(_0x659d('0x6'))['db'];var utils=require(_0x659d('0x7'));var logger=require(_0x659d('0x8'))(_0x659d('0x9'));var config=require(_0x659d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x659d('0xb')][_0x659d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x432dd6,_0x315381,_0x3b929a){return new BPromise(function(_0x428437,_0x394d0a){return client[_0x659d('0xd')](_0x432dd6,_0x3b929a)[_0x659d('0xe')](function(_0x892b50){logger[_0x659d('0xf')](_0x659d('0x10'),_0x315381,'request\x20sent');logger['debug'](_0x659d('0x11'),_0x315381,_0x659d('0x12'),JSON[_0x659d('0x13')](_0x892b50));if(_0x892b50[_0x659d('0x14')]){if(_0x892b50[_0x659d('0x14')][_0x659d('0x15')]===0x1f4){logger[_0x659d('0x14')](_0x659d('0x10'),_0x315381,_0x892b50[_0x659d('0x14')][_0x659d('0x16')]);return _0x394d0a(_0x892b50[_0x659d('0x14')][_0x659d('0x16')]);}logger[_0x659d('0x14')](_0x659d('0x10'),_0x315381,_0x892b50['error'][_0x659d('0x16')]);return _0x428437(_0x892b50[_0x659d('0x14')]['message']);}else{logger[_0x659d('0xf')](_0x659d('0x10'),_0x315381,_0x659d('0x12'));_0x428437(_0x892b50['result'][_0x659d('0x16')]);}})['catch'](function(_0xfa942){logger[_0x659d('0x14')](_0x659d('0x10'),_0x315381,_0xfa942);_0x394d0a(_0xfa942);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index d7bb5d7..eb86713 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 _0x4cf1=['get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13408f,_0x5a7936){var _0x35d4ff=function(_0x4fc5bc){while(--_0x4fc5bc){_0x13408f['push'](_0x13408f['shift']());}};_0x35d4ff(++_0x5a7936);}(_0x4cf1,0x13c));var _0x14cf=function(_0x539bde,_0x14b7db){_0x539bde=_0x539bde-0x0;var _0x1718d4=_0x4cf1[_0x539bde];return _0x1718d4;};'use strict';var multer=require('multer');var util=require(_0x14cf('0x0'));var path=require(_0x14cf('0x1'));var timeout=require(_0x14cf('0x2'));var express=require(_0x14cf('0x3'));var router=express[_0x14cf('0x4')]();var fs_extra=require(_0x14cf('0x5'));var auth=require(_0x14cf('0x6'));var interaction=require(_0x14cf('0x7'));var config=require(_0x14cf('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x14cf('0x9')]('/',auth[_0x14cf('0xa')](),controller[_0x14cf('0xb')]);router[_0x14cf('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x14cf('0xc')]);router[_0x14cf('0x9')](_0x14cf('0xd'),auth[_0x14cf('0xa')](),controller[_0x14cf('0xe')]);router['get'](_0x14cf('0xf'),auth[_0x14cf('0xa')](),controller['run']);router[_0x14cf('0x9')](_0x14cf('0x10'),auth[_0x14cf('0xa')](),controller[_0x14cf('0x11')]);router[_0x14cf('0x12')]('/',auth[_0x14cf('0xa')](),controller[_0x14cf('0x13')]);router[_0x14cf('0x14')](_0x14cf('0x15'),auth[_0x14cf('0xa')](),controller[_0x14cf('0x16')]);router[_0x14cf('0x17')](_0x14cf('0x15'),auth[_0x14cf('0xa')](),controller['destroy']);module[_0x14cf('0x18')]=router; \ No newline at end of file +var _0xea0e=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xea0e,0x153));var _0xeea0=function(_0x3c1c0b,_0x30f0c5){_0x3c1c0b=_0x3c1c0b-0x0;var _0x40bf23=_0xea0e[_0x3c1c0b];return _0x40bf23;};'use strict';var multer=require(_0xeea0('0x0'));var util=require(_0xeea0('0x1'));var path=require(_0xeea0('0x2'));var timeout=require(_0xeea0('0x3'));var express=require(_0xeea0('0x4'));var router=express['Router']();var fs_extra=require(_0xeea0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeea0('0x6'));var config=require(_0xeea0('0x7'));var controller=require(_0xeea0('0x8'));router[_0xeea0('0x9')]('/',auth[_0xeea0('0xa')](),controller['index']);router[_0xeea0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xeea0('0xb')]);router[_0xeea0('0x9')](_0xeea0('0xc'),auth[_0xeea0('0xa')](),controller[_0xeea0('0xd')]);router[_0xeea0('0x9')](_0xeea0('0xe'),auth[_0xeea0('0xa')](),controller[_0xeea0('0xf')]);router[_0xeea0('0x9')](_0xeea0('0x10'),auth[_0xeea0('0xa')](),controller['query']);router[_0xeea0('0x11')]('/',auth[_0xeea0('0xa')](),controller[_0xeea0('0x12')]);router[_0xeea0('0x13')](_0xeea0('0x14'),auth[_0xeea0('0xa')](),controller[_0xeea0('0x15')]);router[_0xeea0('0x16')](_0xeea0('0x14'),auth[_0xeea0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 79cb7aa..517108f 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 _0xa19a=['INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled'];(function(_0x5dfe7f,_0xdbb004){var _0x43f978=function(_0x1b2a0e){while(--_0x1b2a0e){_0x5dfe7f['push'](_0x5dfe7f['shift']());}};_0x43f978(++_0xdbb004);}(_0xa19a,0x77));var _0xaa19=function(_0x5baeff,_0x3c0621){_0x5baeff=_0x5baeff-0x0;var _0x44c96e=_0xa19a[_0x5baeff];return _0x44c96e;};'use strict';var Sequelize=require(_0xaa19('0x0'));var moment=require(_0xaa19('0x1'));module['exports']={'name':{'type':Sequelize[_0xaa19('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xaa19('0x3')]('csv',_0xaa19('0x4'),_0xaa19('0x5')),'allowNull':![],'defaultValue':_0xaa19('0x6')},'savename':{'type':Sequelize[_0xaa19('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xaa19('0x7')]},'endDate':{'type':Sequelize[_0xaa19('0x7')]},'status':{'type':Sequelize[_0xaa19('0x2')],'defaultValue':_0xaa19('0x8')},'type':{'type':Sequelize[_0xaa19('0x3')](_0xaa19('0x9'),_0xaa19('0xa')),'allowNull':![],'defaultValue':_0xaa19('0x9')},'reportId':{'type':Sequelize[_0xaa19('0xb')](0xb)[_0xaa19('0xc')]},'reportType':{'type':Sequelize[_0xaa19('0x2')]}}; \ No newline at end of file +var _0x8380=['Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x240026,_0x113996){var _0x2a4011=function(_0x1b72f8){while(--_0x1b72f8){_0x240026['push'](_0x240026['shift']());}};_0x2a4011(++_0x113996);}(_0x8380,0xd7));var _0x0838=function(_0x3ee7c5,_0x52b517){_0x3ee7c5=_0x3ee7c5-0x0;var _0x41a97d=_0x8380[_0x3ee7c5];return _0x41a97d;};'use strict';var Sequelize=require(_0x0838('0x0'));var moment=require(_0x0838('0x1'));module[_0x0838('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x0838('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x0838('0x4')](_0x0838('0x5'),_0x0838('0x6'),_0x0838('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x0838('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x0838('0x8')]},'status':{'type':Sequelize[_0x0838('0x3')],'defaultValue':_0x0838('0x9')},'type':{'type':Sequelize['ENUM']('manual',_0x0838('0xa')),'allowNull':![],'defaultValue':_0x0838('0xb')},'reportId':{'type':Sequelize[_0x0838('0xc')](0xb)[_0x0838('0xd')]},'reportType':{'type':Sequelize[_0x0838('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9c43ce3..afc7727 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 _0x2e5b=['catch','show','params','length','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','join','%s.%s','toLowerCase','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','apply','reject','save','then','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows'];(function(_0x5166f8,_0x54812c){var _0x4a2a5b=function(_0xf820d0){while(--_0xf820d0){_0x5166f8['push'](_0x5166f8['shift']());}};_0x4a2a5b(++_0x54812c);}(_0x2e5b,0x7e));var _0xb2e5=function(_0x226fd5,_0x599267){_0x226fd5=_0x226fd5-0x0;var _0x5122b5=_0x2e5b[_0x226fd5];return _0x5122b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2e5('0x0'));var zipdir=require(_0xb2e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2e5('0x2'));var BPromise=require(_0xb2e5('0x3'));var Mustache=require(_0xb2e5('0x4'));var util=require('util');var path=require(_0xb2e5('0x5'));var sox=require('sox');var csv=require(_0xb2e5('0x6'));var ejs=require(_0xb2e5('0x7'));var fs=require('fs');var fs_extra=require(_0xb2e5('0x8'));var _=require(_0xb2e5('0x9'));var squel=require(_0xb2e5('0xa'));var crypto=require(_0xb2e5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2e5('0x6'));var querystring=require(_0xb2e5('0xc'));var Papa=require(_0xb2e5('0xd'));var Redis=require(_0xb2e5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb2e5('0xf'));var as=require(_0xb2e5('0x10'));var hardwareService=require(_0xb2e5('0x11'));var logger=require(_0xb2e5('0x12'))('api');var utils=require(_0xb2e5('0x13'));var config=require(_0xb2e5('0x14'));var licenseUtil=require(_0xb2e5('0x15'));var db=require(_0xb2e5('0x16'))['db'];function respondWithStatusCode(_0x2a5dc6,_0x34d9c9){_0x34d9c9=_0x34d9c9||0xcc;return function(_0x3575ed){if(_0x3575ed){return _0x2a5dc6[_0xb2e5('0x17')](_0x34d9c9);}return _0x2a5dc6[_0xb2e5('0x18')](_0x34d9c9)[_0xb2e5('0x19')]();};}function respondWithResult(_0x12a3ce,_0x1a2088){_0x1a2088=_0x1a2088||0xc8;return function(_0x314e){if(_0x314e){return _0x12a3ce[_0xb2e5('0x18')](_0x1a2088)['json'](_0x314e);}};}function respondWithFilteredResult(_0x273a27,_0x30589e){return function(_0x1242f0){if(_0x1242f0){var _0x1ce97b=typeof _0x30589e[_0xb2e5('0x1a')]==='undefined'&&typeof _0x30589e[_0xb2e5('0x1b')]===_0xb2e5('0x1c');var _0x461160=_0x1242f0[_0xb2e5('0x1d')];var _0x5ee708=_0x1ce97b?0x0:_0x30589e[_0xb2e5('0x1a')];var _0x38894c=_0x1ce97b?_0x1242f0[_0xb2e5('0x1d')]:_0x30589e[_0xb2e5('0x1a')]+_0x30589e[_0xb2e5('0x1b')];var _0x19f8e4;if(_0x38894c>=_0x461160){_0x38894c=_0x461160;_0x19f8e4=0xc8;}else{_0x19f8e4=0xce;}_0x273a27[_0xb2e5('0x18')](_0x19f8e4);return _0x273a27['set']('Content-Range',_0x5ee708+'-'+_0x38894c+'/'+_0x461160)['json'](_0x1242f0);}return null;};}function patchUpdates(_0x4b4c89){return function(_0x4a2cde){try{jsonpatch[_0xb2e5('0x1e')](_0x4a2cde,_0x4b4c89,!![]);}catch(_0x1a4259){return BPromise[_0xb2e5('0x1f')](_0x1a4259);}return _0x4a2cde[_0xb2e5('0x20')]();};}function saveUpdates(_0x22eaea,_0x59fc7c){return function(_0x5f1b30){if(_0x5f1b30){return _0x5f1b30['update'](_0x22eaea)[_0xb2e5('0x21')](function(_0x31668b){return _0x31668b;});}return null;};}function removeEntity(_0x59d121,_0x445281){return function(_0x460392){if(_0x460392){return _0x460392['destroy']()[_0xb2e5('0x21')](function(){var _0x1271fc=_0x460392['get']({'plain':!![]});var _0x294360=_0xb2e5('0x22');return db[_0xb2e5('0x23')]['destroy']({'where':{'type':_0x294360,'resourceId':_0x1271fc['id']}})[_0xb2e5('0x21')](function(){return _0x460392;});})[_0xb2e5('0x21')](function(){_0x59d121[_0xb2e5('0x18')](0xcc)[_0xb2e5('0x19')]();});}};}function handleEntityNotFound(_0x119f4b,_0xc30cb8){return function(_0x2be8f0){if(!_0x2be8f0){_0x119f4b[_0xb2e5('0x17')](0x194);}return _0x2be8f0;};}function handleError(_0x80ef7e,_0x362598){_0x362598=_0x362598||0x1f4;return function(_0x2f244b){logger[_0xb2e5('0x24')](_0x2f244b[_0xb2e5('0x25')]);if(_0x2f244b['name']){delete _0x2f244b[_0xb2e5('0x26')];}_0x80ef7e['status'](_0x362598)[_0xb2e5('0x27')](_0x2f244b);};}exports[_0xb2e5('0x28')]=function(_0x74e678,_0x3331ac){var _0x5a614f={},_0x176c3b={},_0x1fb0a8={'count':0x0,'rows':[]};var _0x1fb1d7=_[_0xb2e5('0x29')](db[_0xb2e5('0x2a')][_0xb2e5('0x2b')],function(_0x32f2fd){return{'name':_0x32f2fd[_0xb2e5('0x2c')],'type':_0x32f2fd['type'][_0xb2e5('0x2d')]};});_0x176c3b['model']=_[_0xb2e5('0x29')](_0x1fb1d7,'name');_0x176c3b[_0xb2e5('0x2e')]=_[_0xb2e5('0x2f')](_0x74e678[_0xb2e5('0x2e')]);_0x176c3b['filters']=_[_0xb2e5('0x30')](_0x176c3b[_0xb2e5('0x31')],_0x176c3b[_0xb2e5('0x2e')]);_0x5a614f[_0xb2e5('0x32')]=_['intersection'](_0x176c3b[_0xb2e5('0x31')],qs[_0xb2e5('0x33')](_0x74e678[_0xb2e5('0x2e')][_0xb2e5('0x33')]));_0x5a614f[_0xb2e5('0x32')]=_0x5a614f['attributes']['length']?_0x5a614f[_0xb2e5('0x32')]:_0x176c3b[_0xb2e5('0x31')];if(!_0x74e678[_0xb2e5('0x2e')][_0xb2e5('0x34')](_0xb2e5('0x35'))){_0x5a614f['limit']=qs[_0xb2e5('0x1b')](_0x74e678[_0xb2e5('0x2e')][_0xb2e5('0x1b')]);_0x5a614f['offset']=qs['offset'](_0x74e678['query'][_0xb2e5('0x1a')]);}_0x5a614f['order']=qs[_0xb2e5('0x36')](_0x74e678['query'][_0xb2e5('0x36')]);_0x5a614f[_0xb2e5('0x37')]=qs[_0xb2e5('0x38')](_[_0xb2e5('0x39')](_0x74e678[_0xb2e5('0x2e')],_0x176c3b['filters']),_0x1fb1d7);if(_0x74e678[_0xb2e5('0x2e')][_0xb2e5('0x3a')]){_0x5a614f['where']=_[_0xb2e5('0x3b')](_0x5a614f['where'],{'$or':_[_0xb2e5('0x29')](_0x1fb1d7,function(_0x5d9478){if(_0x5d9478['type']!==_0xb2e5('0x3c')){var _0x34d197={};_0x34d197[_0x5d9478['name']]={'$like':'%'+_0x74e678[_0xb2e5('0x2e')][_0xb2e5('0x3a')]+'%'};return _0x34d197;}})});}_0x5a614f=_['merge']({},_0x5a614f,_0x74e678['options']);var _0x4a616a={'where':_0x5a614f[_0xb2e5('0x37')]};return db['AnalyticExtractedReport'][_0xb2e5('0x1d')](_0x4a616a)['then'](function(_0x2eddf2){_0x1fb0a8[_0xb2e5('0x1d')]=_0x2eddf2;if(_0x74e678[_0xb2e5('0x2e')][_0xb2e5('0x3d')]){_0x5a614f['include']=[{'all':!![]}];}return db[_0xb2e5('0x2a')][_0xb2e5('0x3e')](_0x5a614f);})[_0xb2e5('0x21')](function(_0x3895c4){_0x1fb0a8[_0xb2e5('0x3f')]=_0x3895c4;return _0x1fb0a8;})[_0xb2e5('0x21')](respondWithFilteredResult(_0x3331ac,_0x5a614f))[_0xb2e5('0x40')](handleError(_0x3331ac,null));};exports[_0xb2e5('0x41')]=function(_0x583103,_0x4996da){var _0x2d03d4={'raw':!![],'where':{'id':_0x583103[_0xb2e5('0x42')]['id']}},_0x3d0b9d={};_0x3d0b9d[_0xb2e5('0x31')]=_['keys'](db[_0xb2e5('0x2a')][_0xb2e5('0x2b')]);_0x3d0b9d[_0xb2e5('0x2e')]=_[_0xb2e5('0x2f')](_0x583103[_0xb2e5('0x2e')]);_0x3d0b9d[_0xb2e5('0x38')]=_[_0xb2e5('0x30')](_0x3d0b9d[_0xb2e5('0x31')],_0x3d0b9d[_0xb2e5('0x2e')]);_0x2d03d4[_0xb2e5('0x32')]=_[_0xb2e5('0x30')](_0x3d0b9d['model'],qs[_0xb2e5('0x33')](_0x583103[_0xb2e5('0x2e')][_0xb2e5('0x33')]));_0x2d03d4[_0xb2e5('0x32')]=_0x2d03d4[_0xb2e5('0x32')][_0xb2e5('0x43')]?_0x2d03d4[_0xb2e5('0x32')]:_0x3d0b9d['model'];if(_0x583103['query'][_0xb2e5('0x3d')]){_0x2d03d4[_0xb2e5('0x44')]=[{'all':!![]}];}_0x2d03d4=_[_0xb2e5('0x3b')]({},_0x2d03d4,_0x583103['options']);return db[_0xb2e5('0x2a')][_0xb2e5('0x45')](_0x2d03d4)[_0xb2e5('0x21')](handleEntityNotFound(_0x4996da,null))[_0xb2e5('0x21')](respondWithResult(_0x4996da,null))[_0xb2e5('0x40')](handleError(_0x4996da,null));};exports[_0xb2e5('0x46')]=function(_0xb09436,_0x5323f9){return db['AnalyticExtractedReport'][_0xb2e5('0x46')](_0xb09436['body'],{})[_0xb2e5('0x21')](function(_0x557093){var _0x4defaa=_0xb09436[_0xb2e5('0x47')][_0xb2e5('0x48')]({'plain':!![]});if(!_0x4defaa)throw new Error(_0xb2e5('0x49'));if(_0x4defaa[_0xb2e5('0x4a')]===_0xb2e5('0x47')){var _0x1ff140=_0x557093[_0xb2e5('0x48')]({'plain':!![]});var _0xc6de14=_0xb2e5('0x22');return db[_0xb2e5('0x4b')][_0xb2e5('0x45')]({'where':{'name':_0xc6de14,'userProfileId':_0x4defaa[_0xb2e5('0x4c')]},'raw':!![]})[_0xb2e5('0x21')](function(_0x5d045c){if(_0x5d045c&&_0x5d045c[_0xb2e5('0x4d')]===0x0){return db[_0xb2e5('0x23')][_0xb2e5('0x46')]({'name':_0x1ff140[_0xb2e5('0x26')],'resourceId':_0x1ff140['id'],'type':_0x5d045c[_0xb2e5('0x26')],'sectionId':_0x5d045c['id']},{})[_0xb2e5('0x21')](function(){return _0x557093;});}else{return _0x557093;}})[_0xb2e5('0x40')](function(_0x372122){logger[_0xb2e5('0x24')](_0xb2e5('0x4e'),_0x372122);throw _0x372122;});}return _0x557093;})[_0xb2e5('0x21')](respondWithResult(_0x5323f9,0xc9))[_0xb2e5('0x40')](handleError(_0x5323f9,null));};exports[_0xb2e5('0x4f')]=function(_0x1bf1bc,_0x1b4327){if(_0x1bf1bc[_0xb2e5('0x50')]['id']){delete _0x1bf1bc[_0xb2e5('0x50')]['id'];}return db[_0xb2e5('0x2a')][_0xb2e5('0x45')]({'where':{'id':_0x1bf1bc[_0xb2e5('0x42')]['id']}})[_0xb2e5('0x21')](handleEntityNotFound(_0x1b4327,null))['then'](saveUpdates(_0x1bf1bc[_0xb2e5('0x50')],null))['then'](respondWithResult(_0x1b4327,null))[_0xb2e5('0x40')](handleError(_0x1b4327,null));};exports[_0xb2e5('0x51')]=function(_0x35c72a,_0x2969d0){return db[_0xb2e5('0x2a')][_0xb2e5('0x45')]({'where':{'id':_0x35c72a[_0xb2e5('0x42')]['id']}})[_0xb2e5('0x21')](handleEntityNotFound(_0x2969d0,null))[_0xb2e5('0x21')](removeEntity(_0x2969d0,null))[_0xb2e5('0x40')](handleError(_0x2969d0,null));};exports[_0xb2e5('0x52')]=function(_0x115136,_0x45b7ba,_0x506a57){return db[_0xb2e5('0x2a')][_0xb2e5('0x45')]({'where':{'id':_0x115136[_0xb2e5('0x42')]['id']},'attributes':['name',_0xb2e5('0x53'),_0xb2e5('0x54'),_0xb2e5('0x55')],'raw':!![]})[_0xb2e5('0x21')](handleEntityNotFound(_0x45b7ba,null))[_0xb2e5('0x21')](function(_0x1ca038){if(_0x1ca038){if(!fs[_0xb2e5('0x56')](path['join'](config[_0xb2e5('0x57')],_0xb2e5('0x58'),_0x1ca038[_0xb2e5('0x54')]))){throw new db[(_0xb2e5('0x59'))]['ValidationError'](_0xb2e5('0x5a'));}if(_0x115136[_0xb2e5('0x2e')][_0xb2e5('0x5b')]){return _0x45b7ba[_0xb2e5('0x17')](0xc8);}return _0x45b7ba[_0xb2e5('0x52')](path[_0xb2e5('0x5c')](config['root'],_0xb2e5('0x58'),_0x1ca038[_0xb2e5('0x54')]),util['format'](_0xb2e5('0x5d'),_0x1ca038[_0xb2e5('0x53')]||_0x1ca038[_0xb2e5('0x26')],_0x1ca038[_0xb2e5('0x55')][_0xb2e5('0x5e')]()));}})[_0xb2e5('0x40')](handleError(_0x45b7ba,null));}; \ No newline at end of file +var _0x8b5f=['query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','exists','format','%s.%s','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','type','key','model'];(function(_0x3b0598,_0x15100f){var _0x5e2198=function(_0x19aeb7){while(--_0x19aeb7){_0x3b0598['push'](_0x3b0598['shift']());}};_0x5e2198(++_0x15100f);}(_0x8b5f,0x1e7));var _0xf8b5=function(_0x47e8fc,_0x5db630){_0x47e8fc=_0x47e8fc-0x0;var _0x427452=_0x8b5f[_0x47e8fc];return _0x427452;};'use strict';var emlformat=require(_0xf8b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf8b5('0x2'));var BPromise=require(_0xf8b5('0x3'));var Mustache=require('mustache');var util=require(_0xf8b5('0x4'));var path=require(_0xf8b5('0x5'));var sox=require(_0xf8b5('0x6'));var csv=require(_0xf8b5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8b5('0x8'));var squel=require('squel');var crypto=require(_0xf8b5('0x9'));var jsforce=require(_0xf8b5('0xa'));var deskjs=require(_0xf8b5('0xb'));var toCsv=require(_0xf8b5('0x7'));var querystring=require('querystring');var Papa=require(_0xf8b5('0xc'));var Redis=require('ioredis');var authService=require(_0xf8b5('0xd'));var qs=require(_0xf8b5('0xe'));var as=require(_0xf8b5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf8b5('0x10'));var utils=require(_0xf8b5('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf8b5('0x12'));var db=require(_0xf8b5('0x13'))['db'];function respondWithStatusCode(_0x32b0ce,_0x24bf33){_0x24bf33=_0x24bf33||0xcc;return function(_0x3fac66){if(_0x3fac66){return _0x32b0ce[_0xf8b5('0x14')](_0x24bf33);}return _0x32b0ce[_0xf8b5('0x15')](_0x24bf33)[_0xf8b5('0x16')]();};}function respondWithResult(_0x2d2f4c,_0x1efe51){_0x1efe51=_0x1efe51||0xc8;return function(_0x44a0c3){if(_0x44a0c3){return _0x2d2f4c[_0xf8b5('0x15')](_0x1efe51)[_0xf8b5('0x17')](_0x44a0c3);}};}function respondWithFilteredResult(_0x3a908e,_0x64f2ac){return function(_0x20c76d){if(_0x20c76d){var _0x2f002e=typeof _0x64f2ac[_0xf8b5('0x18')]==='undefined'&&typeof _0x64f2ac[_0xf8b5('0x19')]===_0xf8b5('0x1a');var _0x303dc8=_0x20c76d[_0xf8b5('0x1b')];var _0x3547da=_0x2f002e?0x0:_0x64f2ac[_0xf8b5('0x18')];var _0x34d838=_0x2f002e?_0x20c76d[_0xf8b5('0x1b')]:_0x64f2ac[_0xf8b5('0x18')]+_0x64f2ac[_0xf8b5('0x19')];var _0x18d33a;if(_0x34d838>=_0x303dc8){_0x34d838=_0x303dc8;_0x18d33a=0xc8;}else{_0x18d33a=0xce;}_0x3a908e[_0xf8b5('0x15')](_0x18d33a);return _0x3a908e[_0xf8b5('0x1c')](_0xf8b5('0x1d'),_0x3547da+'-'+_0x34d838+'/'+_0x303dc8)['json'](_0x20c76d);}return null;};}function patchUpdates(_0x19e560){return function(_0x2b6249){try{jsonpatch[_0xf8b5('0x1e')](_0x2b6249,_0x19e560,!![]);}catch(_0x3198fa){return BPromise[_0xf8b5('0x1f')](_0x3198fa);}return _0x2b6249['save']();};}function saveUpdates(_0x335978,_0x1f56be){return function(_0x44fd60){if(_0x44fd60){return _0x44fd60['update'](_0x335978)[_0xf8b5('0x20')](function(_0x4e53e3){return _0x4e53e3;});}return null;};}function removeEntity(_0x20e1dc,_0x598066){return function(_0x40599a){if(_0x40599a){return _0x40599a[_0xf8b5('0x21')]()[_0xf8b5('0x20')](function(){var _0x5d6b43=_0x40599a[_0xf8b5('0x22')]({'plain':!![]});var _0x12a3fa=_0xf8b5('0x23');return db[_0xf8b5('0x24')][_0xf8b5('0x21')]({'where':{'type':_0x12a3fa,'resourceId':_0x5d6b43['id']}})['then'](function(){return _0x40599a;});})[_0xf8b5('0x20')](function(){_0x20e1dc['status'](0xcc)[_0xf8b5('0x16')]();});}};}function handleEntityNotFound(_0x2e3ebe,_0x4db8e9){return function(_0x416d90){if(!_0x416d90){_0x2e3ebe[_0xf8b5('0x14')](0x194);}return _0x416d90;};}function handleError(_0x1b85f9,_0x225cd3){_0x225cd3=_0x225cd3||0x1f4;return function(_0xa19c8){logger[_0xf8b5('0x25')](_0xa19c8[_0xf8b5('0x26')]);if(_0xa19c8[_0xf8b5('0x27')]){delete _0xa19c8[_0xf8b5('0x27')];}_0x1b85f9[_0xf8b5('0x15')](_0x225cd3)[_0xf8b5('0x28')](_0xa19c8);};}exports['index']=function(_0x4447e2,_0x9e7573){var _0x584005={},_0x5478c2={},_0x4c2868={'count':0x0,'rows':[]};var _0x51f06f=_[_0xf8b5('0x29')](db[_0xf8b5('0x2a')][_0xf8b5('0x2b')],function(_0x2516ea){return{'name':_0x2516ea['fieldName'],'type':_0x2516ea[_0xf8b5('0x2c')][_0xf8b5('0x2d')]};});_0x5478c2[_0xf8b5('0x2e')]=_[_0xf8b5('0x29')](_0x51f06f,_0xf8b5('0x27'));_0x5478c2[_0xf8b5('0x2f')]=_[_0xf8b5('0x30')](_0x4447e2[_0xf8b5('0x2f')]);_0x5478c2[_0xf8b5('0x31')]=_['intersection'](_0x5478c2[_0xf8b5('0x2e')],_0x5478c2[_0xf8b5('0x2f')]);_0x584005['attributes']=_[_0xf8b5('0x32')](_0x5478c2[_0xf8b5('0x2e')],qs[_0xf8b5('0x33')](_0x4447e2[_0xf8b5('0x2f')][_0xf8b5('0x33')]));_0x584005[_0xf8b5('0x34')]=_0x584005['attributes'][_0xf8b5('0x35')]?_0x584005['attributes']:_0x5478c2[_0xf8b5('0x2e')];if(!_0x4447e2[_0xf8b5('0x2f')]['hasOwnProperty'](_0xf8b5('0x36'))){_0x584005[_0xf8b5('0x19')]=qs['limit'](_0x4447e2[_0xf8b5('0x2f')][_0xf8b5('0x19')]);_0x584005[_0xf8b5('0x18')]=qs[_0xf8b5('0x18')](_0x4447e2['query'][_0xf8b5('0x18')]);}_0x584005[_0xf8b5('0x37')]=qs[_0xf8b5('0x38')](_0x4447e2[_0xf8b5('0x2f')][_0xf8b5('0x38')]);_0x584005[_0xf8b5('0x39')]=qs[_0xf8b5('0x31')](_[_0xf8b5('0x3a')](_0x4447e2[_0xf8b5('0x2f')],_0x5478c2['filters']),_0x51f06f);if(_0x4447e2['query'][_0xf8b5('0x3b')]){_0x584005['where']=_[_0xf8b5('0x3c')](_0x584005[_0xf8b5('0x39')],{'$or':_['map'](_0x51f06f,function(_0x1b46af){if(_0x1b46af[_0xf8b5('0x2c')]!==_0xf8b5('0x3d')){var _0x39f4fc={};_0x39f4fc[_0x1b46af[_0xf8b5('0x27')]]={'$like':'%'+_0x4447e2[_0xf8b5('0x2f')]['filter']+'%'};return _0x39f4fc;}})});}_0x584005=_[_0xf8b5('0x3c')]({},_0x584005,_0x4447e2[_0xf8b5('0x3e')]);var _0x132aff={'where':_0x584005[_0xf8b5('0x39')]};return db['AnalyticExtractedReport']['count'](_0x132aff)[_0xf8b5('0x20')](function(_0x53942e){_0x4c2868[_0xf8b5('0x1b')]=_0x53942e;if(_0x4447e2[_0xf8b5('0x2f')][_0xf8b5('0x3f')]){_0x584005['include']=[{'all':!![]}];}return db[_0xf8b5('0x2a')]['findAll'](_0x584005);})['then'](function(_0x29f733){_0x4c2868[_0xf8b5('0x40')]=_0x29f733;return _0x4c2868;})[_0xf8b5('0x20')](respondWithFilteredResult(_0x9e7573,_0x584005))['catch'](handleError(_0x9e7573,null));};exports['show']=function(_0x37e3db,_0x12b82e){var _0x18f6e4={'raw':!![],'where':{'id':_0x37e3db[_0xf8b5('0x41')]['id']}},_0x50c108={};_0x50c108[_0xf8b5('0x2e')]=_[_0xf8b5('0x30')](db['AnalyticExtractedReport']['rawAttributes']);_0x50c108[_0xf8b5('0x2f')]=_[_0xf8b5('0x30')](_0x37e3db[_0xf8b5('0x2f')]);_0x50c108[_0xf8b5('0x31')]=_[_0xf8b5('0x32')](_0x50c108[_0xf8b5('0x2e')],_0x50c108[_0xf8b5('0x2f')]);_0x18f6e4[_0xf8b5('0x34')]=_['intersection'](_0x50c108[_0xf8b5('0x2e')],qs[_0xf8b5('0x33')](_0x37e3db[_0xf8b5('0x2f')][_0xf8b5('0x33')]));_0x18f6e4[_0xf8b5('0x34')]=_0x18f6e4[_0xf8b5('0x34')]['length']?_0x18f6e4[_0xf8b5('0x34')]:_0x50c108[_0xf8b5('0x2e')];if(_0x37e3db[_0xf8b5('0x2f')][_0xf8b5('0x3f')]){_0x18f6e4[_0xf8b5('0x42')]=[{'all':!![]}];}_0x18f6e4=_[_0xf8b5('0x3c')]({},_0x18f6e4,_0x37e3db[_0xf8b5('0x3e')]);return db['AnalyticExtractedReport'][_0xf8b5('0x43')](_0x18f6e4)[_0xf8b5('0x20')](handleEntityNotFound(_0x12b82e,null))['then'](respondWithResult(_0x12b82e,null))[_0xf8b5('0x44')](handleError(_0x12b82e,null));};exports[_0xf8b5('0x45')]=function(_0x4bd456,_0x29cd53){return db[_0xf8b5('0x2a')][_0xf8b5('0x45')](_0x4bd456['body'],{})[_0xf8b5('0x20')](function(_0x61529f){var _0x3bb370=_0x4bd456[_0xf8b5('0x46')][_0xf8b5('0x22')]({'plain':!![]});if(!_0x3bb370)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bb370[_0xf8b5('0x47')]==='user'){var _0x33f4ff=_0x61529f[_0xf8b5('0x22')]({'plain':!![]});var _0xcc1b7a=_0xf8b5('0x23');return db[_0xf8b5('0x48')][_0xf8b5('0x43')]({'where':{'name':_0xcc1b7a,'userProfileId':_0x3bb370[_0xf8b5('0x49')]},'raw':!![]})[_0xf8b5('0x20')](function(_0x4d9cda){if(_0x4d9cda&&_0x4d9cda[_0xf8b5('0x4a')]===0x0){return db[_0xf8b5('0x24')]['create']({'name':_0x33f4ff[_0xf8b5('0x27')],'resourceId':_0x33f4ff['id'],'type':_0x4d9cda[_0xf8b5('0x27')],'sectionId':_0x4d9cda['id']},{})[_0xf8b5('0x20')](function(){return _0x61529f;});}else{return _0x61529f;}})[_0xf8b5('0x44')](function(_0x36fc0d){logger[_0xf8b5('0x25')](_0xf8b5('0x4b'),_0x36fc0d);throw _0x36fc0d;});}return _0x61529f;})[_0xf8b5('0x20')](respondWithResult(_0x29cd53,0xc9))[_0xf8b5('0x44')](handleError(_0x29cd53,null));};exports[_0xf8b5('0x4c')]=function(_0x194d70,_0x154afa){if(_0x194d70['body']['id']){delete _0x194d70[_0xf8b5('0x4d')]['id'];}return db[_0xf8b5('0x2a')]['find']({'where':{'id':_0x194d70[_0xf8b5('0x41')]['id']}})['then'](handleEntityNotFound(_0x154afa,null))[_0xf8b5('0x20')](saveUpdates(_0x194d70[_0xf8b5('0x4d')],null))[_0xf8b5('0x20')](respondWithResult(_0x154afa,null))[_0xf8b5('0x44')](handleError(_0x154afa,null));};exports[_0xf8b5('0x21')]=function(_0xf126f4,_0x13ecf9){return db[_0xf8b5('0x2a')][_0xf8b5('0x43')]({'where':{'id':_0xf126f4[_0xf8b5('0x41')]['id']}})[_0xf8b5('0x20')](handleEntityNotFound(_0x13ecf9,null))[_0xf8b5('0x20')](removeEntity(_0x13ecf9,null))[_0xf8b5('0x44')](handleError(_0x13ecf9,null));};exports[_0xf8b5('0x4e')]=function(_0x580ec6,_0x3bba0b,_0xd1ee5b){return db[_0xf8b5('0x2a')]['find']({'where':{'id':_0x580ec6['params']['id']},'attributes':[_0xf8b5('0x27'),_0xf8b5('0x4f'),_0xf8b5('0x50'),_0xf8b5('0x51')],'raw':!![]})[_0xf8b5('0x20')](handleEntityNotFound(_0x3bba0b,null))[_0xf8b5('0x20')](function(_0x471b66){if(_0x471b66){if(!fs[_0xf8b5('0x52')](path['join'](config[_0xf8b5('0x53')],_0xf8b5('0x54'),_0x471b66['savename']))){throw new db[(_0xf8b5('0x55'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x580ec6['query'][_0xf8b5('0x56')]){return _0x3bba0b[_0xf8b5('0x14')](0xc8);}return _0x3bba0b[_0xf8b5('0x4e')](path['join'](config['root'],_0xf8b5('0x54'),_0x471b66[_0xf8b5('0x50')]),util[_0xf8b5('0x57')](_0xf8b5('0x58'),_0x471b66['basename']||_0x471b66[_0xf8b5('0x27')],_0x471b66[_0xf8b5('0x51')]['toLowerCase']()));}})[_0xf8b5('0x44')](handleError(_0x3bba0b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c026d01..193efc1 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 _0x2440=['./analyticExtractedReport.attributes','exports','analytics_extracted_reports','lodash','util','api','request-promise','rimraf'];(function(_0x199018,_0x24ee71){var _0x3741d4=function(_0x190025){while(--_0x190025){_0x199018['push'](_0x199018['shift']());}};_0x3741d4(++_0x24ee71);}(_0x2440,0x1db));var _0x0244=function(_0x196f51,_0x56ed2e){_0x196f51=_0x196f51-0x0;var _0x3c30ba=_0x2440[_0x196f51];return _0x3c30ba;};'use strict';var _=require(_0x0244('0x0'));var util=require(_0x0244('0x1'));var logger=require('../../config/logger')(_0x0244('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0244('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0244('0x4'));var config=require('../../config/environment');var attributes=require(_0x0244('0x5'));module[_0x0244('0x6')]=function(_0x525553,_0x19936b){return _0x525553['define']('AnalyticExtractedReport',attributes,{'tableName':_0x0244('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe38d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x40ae42,_0xce6d5a){var _0x35132b=function(_0x24b634){while(--_0x24b634){_0x40ae42['push'](_0x40ae42['shift']());}};_0x35132b(++_0xce6d5a);}(_0xe38d,0xe9));var _0xde38=function(_0xb0a064,_0x2535a8){_0xb0a064=_0xb0a064-0x0;var _0x26e680=_0xe38d[_0xb0a064];return _0x26e680;};'use strict';var _=require(_0xde38('0x0'));var util=require(_0xde38('0x1'));var logger=require(_0xde38('0x2'))(_0xde38('0x3'));var moment=require(_0xde38('0x4'));var BPromise=require(_0xde38('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde38('0x6'));var rimraf=require(_0xde38('0x7'));var config=require(_0xde38('0x8'));var attributes=require(_0xde38('0x9'));module[_0xde38('0xa')]=function(_0x3f22f6,_0x1cf7f9){return _0x3f22f6['define'](_0xde38('0xb'),attributes,{'tableName':_0xde38('0xc'),'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 3ad8dad..b229292 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 _0xc4b0=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','AnalyticExtractedReport,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xc4b0,0xfb));var _0x0c4b=function(_0x2c69a1,_0x30b54b){_0x2c69a1=_0x2c69a1-0x0;var _0x50e57d=_0xc4b0[_0x2c69a1];return _0x50e57d;};'use strict';var _=require(_0x0c4b('0x0'));var util=require('util');var moment=require(_0x0c4b('0x1'));var BPromise=require(_0x0c4b('0x2'));var rs=require(_0x0c4b('0x3'));var fs=require('fs');var Redis=require(_0x0c4b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c4b('0x5'));var logger=require(_0x0c4b('0x6'))(_0x0c4b('0x7'));var config=require(_0x0c4b('0x8'));var jayson=require(_0x0c4b('0x9'));var client=jayson[_0x0c4b('0xa')][_0x0c4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5637ed,_0x4ace76,_0x2a1de0){return new BPromise(function(_0x52b5e8,_0x13067d){return client['request'](_0x5637ed,_0x2a1de0)[_0x0c4b('0xc')](function(_0x1b449d){logger[_0x0c4b('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ace76,_0x0c4b('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4ace76,_0x0c4b('0xe'),JSON[_0x0c4b('0xf')](_0x1b449d));if(_0x1b449d['error']){if(_0x1b449d['error']['code']===0x1f4){logger['error'](_0x0c4b('0x10'),_0x4ace76,_0x1b449d[_0x0c4b('0x11')][_0x0c4b('0x12')]);return _0x13067d(_0x1b449d[_0x0c4b('0x11')][_0x0c4b('0x12')]);}logger['error'](_0x0c4b('0x10'),_0x4ace76,_0x1b449d[_0x0c4b('0x11')]['message']);return _0x52b5e8(_0x1b449d['error'][_0x0c4b('0x12')]);}else{logger[_0x0c4b('0xd')](_0x0c4b('0x10'),_0x4ace76,_0x0c4b('0xe'));_0x52b5e8(_0x1b449d[_0x0c4b('0x13')][_0x0c4b('0x12')]);}})[_0x0c4b('0x14')](function(_0x1bbc52){logger[_0x0c4b('0x11')](_0x0c4b('0x10'),_0x4ace76,_0x1bbc52);_0x13067d(_0x1bbc52);});});} \ No newline at end of file +var _0xa4ad=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1bacfe,_0x8de443){var _0x23f634=function(_0x17b63b){while(--_0x17b63b){_0x1bacfe['push'](_0x1bacfe['shift']());}};_0x23f634(++_0x8de443);}(_0xa4ad,0x80));var _0xda4a=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xa4ad[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xda4a('0x0'));var util=require('util');var moment=require(_0xda4a('0x1'));var BPromise=require(_0xda4a('0x2'));var rs=require(_0xda4a('0x3'));var fs=require('fs');var Redis=require(_0xda4a('0x4'));var db=require(_0xda4a('0x5'))['db'];var utils=require(_0xda4a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xda4a('0x7'));var jayson=require(_0xda4a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33597c,_0x12d5b1,_0x1786c3){return new BPromise(function(_0x392abf,_0x236f49){return client[_0xda4a('0x9')](_0x33597c,_0x1786c3)[_0xda4a('0xa')](function(_0x1bec50){logger[_0xda4a('0xb')](_0xda4a('0xc'),_0x12d5b1,'request\x20sent');logger['debug'](_0xda4a('0xd'),_0x12d5b1,_0xda4a('0xe'),JSON['stringify'](_0x1bec50));if(_0x1bec50[_0xda4a('0xf')]){if(_0x1bec50[_0xda4a('0xf')][_0xda4a('0x10')]===0x1f4){logger[_0xda4a('0xf')](_0xda4a('0xc'),_0x12d5b1,_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);return _0x236f49(_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);}logger[_0xda4a('0xf')](_0xda4a('0xc'),_0x12d5b1,_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);return _0x392abf(_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);}else{logger[_0xda4a('0xb')](_0xda4a('0xc'),_0x12d5b1,_0xda4a('0xe'));_0x392abf(_0x1bec50[_0xda4a('0x12')][_0xda4a('0x11')]);}})['catch'](function(_0x3e9929){logger[_0xda4a('0xf')](_0xda4a('0xc'),_0x12d5b1,_0x3e9929);_0x236f49(_0x3e9929);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 257f446..1c21014 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 _0x42ff=['/:id/download','download','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42ff,0x111));var _0xf42f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x42ff[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xf42f('0x0'));var util=require(_0xf42f('0x1'));var path=require('path');var timeout=require(_0xf42f('0x2'));var express=require(_0xf42f('0x3'));var router=express[_0xf42f('0x4')]();var fs_extra=require(_0xf42f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf42f('0x6'));var config=require('../../config/environment');var controller=require(_0xf42f('0x7'));router[_0xf42f('0x8')]('/',auth[_0xf42f('0x9')](),controller[_0xf42f('0xa')]);router[_0xf42f('0x8')]('/:id',auth[_0xf42f('0x9')](),controller[_0xf42f('0xb')]);router[_0xf42f('0x8')](_0xf42f('0xc'),auth[_0xf42f('0x9')](),controller[_0xf42f('0xd')]);router['post']('/',auth[_0xf42f('0x9')](),controller[_0xf42f('0xe')]);router[_0xf42f('0xf')]('/:id',auth[_0xf42f('0x9')](),controller['update']);router['delete'](_0xf42f('0x10'),auth[_0xf42f('0x9')](),controller[_0xf42f('0x11')]);module[_0xf42f('0x12')]=router; \ No newline at end of file +var _0x8fab=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','download','create','update','delete','destroy','multer','connect-timeout','express'];(function(_0x4a35b3,_0x5bc5a1){var _0x4a8136=function(_0x215b0d){while(--_0x215b0d){_0x4a35b3['push'](_0x4a35b3['shift']());}};_0x4a8136(++_0x5bc5a1);}(_0x8fab,0x75));var _0xb8fa=function(_0x46bef8,_0x280566){_0x46bef8=_0x46bef8-0x0;var _0x2379ed=_0x8fab[_0x46bef8];return _0x2379ed;};'use strict';var multer=require(_0xb8fa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb8fa('0x1'));var express=require(_0xb8fa('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8fa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb8fa('0x4'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xb8fa('0x5')](),controller[_0xb8fa('0x6')]);router[_0xb8fa('0x7')](_0xb8fa('0x8'),auth[_0xb8fa('0x5')](),controller[_0xb8fa('0x9')]);router['get']('/:id/download',auth[_0xb8fa('0x5')](),controller[_0xb8fa('0xa')]);router['post']('/',auth[_0xb8fa('0x5')](),controller[_0xb8fa('0xb')]);router['put']('/:id',auth[_0xb8fa('0x5')](),controller[_0xb8fa('0xc')]);router[_0xb8fa('0xd')]('/:id',auth[_0xb8fa('0x5')](),controller[_0xb8fa('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 45bb778..cae3072 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 _0x6a7f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2f216d,_0x534bcc){var _0x2c3b4f=function(_0x1c46f1){while(--_0x1c46f1){_0x2f216d['push'](_0x2f216d['shift']());}};_0x2c3b4f(++_0x534bcc);}(_0x6a7f,0x9b));var _0xf6a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a7f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf6a7('0x0'));module[_0xf6a7('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf6a7('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xf6a7('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf6a7('0x2')]},'custom':{'type':Sequelize[_0xf6a7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x16d0=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0xa9a1d8,_0x54279c){var _0x1d7184=function(_0x1acac4){while(--_0x1acac4){_0xa9a1d8['push'](_0xa9a1d8['shift']());}};_0x1d7184(++_0x54279c);}(_0x16d0,0x145));var _0x016d=function(_0x592f78,_0x2638b0){_0x592f78=_0x592f78-0x0;var _0x2fe1ee=_0x16d0[_0x592f78];return _0x2fe1ee;};'use strict';var Sequelize=require(_0x016d('0x0'));module['exports']={'field':{'type':Sequelize[_0x016d('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x016d('0x2')]},'format':{'type':Sequelize[_0x016d('0x2')]},'groupBy':{'type':Sequelize[_0x016d('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x016d('0x2')]},'custom':{'type':Sequelize[_0x016d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9ace334..0448bd0 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 _0x6da0=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','AnalyticFieldReport','include','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x4f7e37,_0x291c9f){var _0x442ea8=function(_0x169420){while(--_0x169420){_0x4f7e37['push'](_0x4f7e37['shift']());}};_0x442ea8(++_0x291c9f);}(_0x6da0,0x10d));var _0x06da=function(_0x32bb62,_0x424698){_0x32bb62=_0x32bb62-0x0;var _0x528cf9=_0x6da0[_0x32bb62];return _0x528cf9;};'use strict';var emlformat=require(_0x06da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06da('0x1'));var jsonpatch=require(_0x06da('0x2'));var rp=require(_0x06da('0x3'));var moment=require(_0x06da('0x4'));var BPromise=require(_0x06da('0x5'));var Mustache=require(_0x06da('0x6'));var util=require('util');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('fs-extra');var _=require(_0x06da('0x7'));var squel=require(_0x06da('0x8'));var crypto=require(_0x06da('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x06da('0xa'));var querystring=require(_0x06da('0xb'));var Papa=require(_0x06da('0xc'));var Redis=require('ioredis');var authService=require(_0x06da('0xd'));var qs=require(_0x06da('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x06da('0xf'));var utils=require(_0x06da('0x10'));var config=require(_0x06da('0x11'));var licenseUtil=require(_0x06da('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x104c4d,_0x1a0af9){_0x1a0af9=_0x1a0af9||0xcc;return function(_0x343e44){if(_0x343e44){return _0x104c4d[_0x06da('0x13')](_0x1a0af9);}return _0x104c4d[_0x06da('0x14')](_0x1a0af9)['end']();};}function respondWithResult(_0x107964,_0x2a8c50){_0x2a8c50=_0x2a8c50||0xc8;return function(_0x5f4011){if(_0x5f4011){return _0x107964[_0x06da('0x14')](_0x2a8c50)[_0x06da('0x15')](_0x5f4011);}};}function respondWithFilteredResult(_0x33a388,_0xae9d86){return function(_0x58fa31){if(_0x58fa31){var _0x3cda5c=typeof _0xae9d86['offset']==='undefined'&&typeof _0xae9d86['limit']==='undefined';var _0x38aba0=_0x58fa31[_0x06da('0x16')];var _0x845d33=_0x3cda5c?0x0:_0xae9d86[_0x06da('0x17')];var _0xad57b6=_0x3cda5c?_0x58fa31[_0x06da('0x16')]:_0xae9d86['offset']+_0xae9d86[_0x06da('0x18')];var _0x27ff6e;if(_0xad57b6>=_0x38aba0){_0xad57b6=_0x38aba0;_0x27ff6e=0xc8;}else{_0x27ff6e=0xce;}_0x33a388[_0x06da('0x14')](_0x27ff6e);return _0x33a388[_0x06da('0x19')](_0x06da('0x1a'),_0x845d33+'-'+_0xad57b6+'/'+_0x38aba0)['json'](_0x58fa31);}return null;};}function patchUpdates(_0x3eca92){return function(_0x55472c){try{jsonpatch[_0x06da('0x1b')](_0x55472c,_0x3eca92,!![]);}catch(_0x5586d2){return BPromise[_0x06da('0x1c')](_0x5586d2);}return _0x55472c[_0x06da('0x1d')]();};}function saveUpdates(_0x1f43ac,_0x50c654){return function(_0x47f1ad){if(_0x47f1ad){return _0x47f1ad[_0x06da('0x1e')](_0x1f43ac)['then'](function(_0x47ad66){return _0x47ad66;});}return null;};}function removeEntity(_0x1bd345,_0x50322d){return function(_0x54f825){if(_0x54f825){return _0x54f825[_0x06da('0x1f')]()[_0x06da('0x20')](function(){_0x1bd345[_0x06da('0x14')](0xcc)[_0x06da('0x21')]();});}};}function handleEntityNotFound(_0x5bd3c1,_0x361c01){return function(_0x5796cc){if(!_0x5796cc){_0x5bd3c1['sendStatus'](0x194);}return _0x5796cc;};}function handleError(_0x2e8275,_0x53e657){_0x53e657=_0x53e657||0x1f4;return function(_0x3bdcf4){logger[_0x06da('0x22')](_0x3bdcf4[_0x06da('0x23')]);if(_0x3bdcf4['name']){delete _0x3bdcf4[_0x06da('0x24')];}_0x2e8275[_0x06da('0x14')](_0x53e657)['send'](_0x3bdcf4);};}exports['index']=function(_0x7f4dad,_0x41db17){var _0x1c68a8={},_0x193e8b={},_0x4581ac={'count':0x0,'rows':[]};var _0x198efd=_[_0x06da('0x25')](db['AnalyticFieldReport'][_0x06da('0x26')],function(_0x2b89e2){return{'name':_0x2b89e2[_0x06da('0x27')],'type':_0x2b89e2[_0x06da('0x28')][_0x06da('0x29')]};});_0x193e8b[_0x06da('0x2a')]=_['map'](_0x198efd,_0x06da('0x24'));_0x193e8b[_0x06da('0x2b')]=_[_0x06da('0x2c')](_0x7f4dad['query']);_0x193e8b[_0x06da('0x2d')]=_[_0x06da('0x2e')](_0x193e8b['model'],_0x193e8b['query']);_0x1c68a8['attributes']=_[_0x06da('0x2e')](_0x193e8b[_0x06da('0x2a')],qs[_0x06da('0x2f')](_0x7f4dad[_0x06da('0x2b')][_0x06da('0x2f')]));_0x1c68a8[_0x06da('0x30')]=_0x1c68a8[_0x06da('0x30')][_0x06da('0x31')]?_0x1c68a8[_0x06da('0x30')]:_0x193e8b[_0x06da('0x2a')];if(!_0x7f4dad[_0x06da('0x2b')][_0x06da('0x32')](_0x06da('0x33'))){_0x1c68a8[_0x06da('0x18')]=qs[_0x06da('0x18')](_0x7f4dad[_0x06da('0x2b')][_0x06da('0x18')]);_0x1c68a8[_0x06da('0x17')]=qs[_0x06da('0x17')](_0x7f4dad[_0x06da('0x2b')][_0x06da('0x17')]);}_0x1c68a8[_0x06da('0x34')]=qs[_0x06da('0x35')](_0x7f4dad[_0x06da('0x2b')][_0x06da('0x35')]);_0x1c68a8['where']=qs[_0x06da('0x2d')](_[_0x06da('0x36')](_0x7f4dad['query'],_0x193e8b[_0x06da('0x2d')]),_0x198efd);if(_0x7f4dad['query'][_0x06da('0x37')]){_0x1c68a8[_0x06da('0x38')]=_[_0x06da('0x39')](_0x1c68a8[_0x06da('0x38')],{'$or':_[_0x06da('0x25')](_0x198efd,function(_0x126d37){if(_0x126d37[_0x06da('0x28')]!==_0x06da('0x3a')){var _0x301440={};_0x301440[_0x126d37[_0x06da('0x24')]]={'$like':'%'+_0x7f4dad['query']['filter']+'%'};return _0x301440;}})});}_0x1c68a8=_[_0x06da('0x39')]({},_0x1c68a8,_0x7f4dad[_0x06da('0x3b')]);var _0xd7d936={'where':_0x1c68a8[_0x06da('0x38')]};return db['AnalyticFieldReport']['count'](_0xd7d936)[_0x06da('0x20')](function(_0x5ce879){_0x4581ac[_0x06da('0x16')]=_0x5ce879;if(_0x7f4dad[_0x06da('0x2b')][_0x06da('0x3c')]){_0x1c68a8['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x06da('0x3d')](_0x1c68a8);})[_0x06da('0x20')](function(_0x3e0dd5){_0x4581ac[_0x06da('0x3e')]=_0x3e0dd5;return _0x4581ac;})[_0x06da('0x20')](respondWithFilteredResult(_0x41db17,_0x1c68a8))[_0x06da('0x3f')](handleError(_0x41db17,null));};exports[_0x06da('0x40')]=function(_0x9d43a9,_0x14b029){var _0x59ec94={'raw':![],'where':{'id':_0x9d43a9[_0x06da('0x41')]['id']}},_0x3ab527={};_0x3ab527[_0x06da('0x2a')]=_['keys'](db[_0x06da('0x42')][_0x06da('0x26')]);_0x3ab527[_0x06da('0x2b')]=_[_0x06da('0x2c')](_0x9d43a9[_0x06da('0x2b')]);_0x3ab527['filters']=_[_0x06da('0x2e')](_0x3ab527[_0x06da('0x2a')],_0x3ab527[_0x06da('0x2b')]);_0x59ec94[_0x06da('0x30')]=_[_0x06da('0x2e')](_0x3ab527['model'],qs[_0x06da('0x2f')](_0x9d43a9[_0x06da('0x2b')][_0x06da('0x2f')]));_0x59ec94[_0x06da('0x30')]=_0x59ec94['attributes'][_0x06da('0x31')]?_0x59ec94['attributes']:_0x3ab527['model'];if(_0x9d43a9[_0x06da('0x2b')][_0x06da('0x3c')]){_0x59ec94[_0x06da('0x43')]=[{'all':!![]}];}_0x59ec94=_[_0x06da('0x39')]({},_0x59ec94,_0x9d43a9[_0x06da('0x3b')]);return db[_0x06da('0x42')][_0x06da('0x44')](_0x59ec94)['then'](handleEntityNotFound(_0x14b029,null))[_0x06da('0x20')](respondWithResult(_0x14b029,null))['catch'](handleError(_0x14b029,null));};exports['create']=function(_0x5e8fd5,_0x3240a4){return db[_0x06da('0x42')][_0x06da('0x45')](_0x5e8fd5[_0x06da('0x46')],{})['then'](respondWithResult(_0x3240a4,0xc9))[_0x06da('0x3f')](handleError(_0x3240a4,null));};exports[_0x06da('0x47')]=function(_0x48726c,_0x2774f2){return db[_0x06da('0x42')][_0x06da('0x47')](_0x48726c[_0x06da('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2774f2,0xc9))['catch'](handleError(_0x2774f2,null));};exports[_0x06da('0x1e')]=function(_0x1028b5,_0x2a120d){if(_0x1028b5[_0x06da('0x46')]['id']){delete _0x1028b5[_0x06da('0x46')]['id'];}return db[_0x06da('0x42')][_0x06da('0x44')]({'where':{'id':_0x1028b5['params']['id']}})['then'](handleEntityNotFound(_0x2a120d,null))['then'](saveUpdates(_0x1028b5[_0x06da('0x46')],null))[_0x06da('0x20')](respondWithResult(_0x2a120d,null))[_0x06da('0x3f')](handleError(_0x2a120d,null));};exports['destroy']=function(_0x38543a,_0x13b33f){return db[_0x06da('0x42')][_0x06da('0x44')]({'where':{'id':_0x38543a[_0x06da('0x41')]['id']}})['then'](handleEntityNotFound(_0x13b33f,null))['then'](removeEntity(_0x13b33f,null))[_0x06da('0x3f')](handleError(_0x13b33f,null));};exports['bulkDestroy']=function(_0x50fdc9,_0x2c4785){return db[_0x06da('0x42')][_0x06da('0x1f')]({'where':{'id':_0x50fdc9['query'][_0x06da('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x06da('0x20')](respondWithResult(_0x2c4785,0xcc))[_0x06da('0x3f')](handleError(_0x2c4785,null));};exports[_0x06da('0x49')]=function(_0x15b6ae,_0x34a569,_0x59e4a6){return db[_0x06da('0x4a')][_0x06da('0x4b')]({'where':{'id':_0x15b6ae[_0x06da('0x41')]['id']}})['then'](handleEntityNotFound(_0x34a569,null))['then'](function(_0x45988a){if(_0x45988a){return db[_0x06da('0x4c')][_0x06da('0x4d')](function(_0x437991){return db[_0x06da('0x42')]['destroy']({'where':{'CustomReportId':_0x15b6ae[_0x06da('0x41')]['id']},'transaction':_0x437991})['then'](function(_0xdad84c){var _0x39cee0=_[_0x06da('0x25')](_0x15b6ae[_0x06da('0x46')],function(_0x4aae99){delete _0x4aae99['id'];_0x4aae99[_0x06da('0x4e')]=_0x15b6ae['params']['id'];return _0x4aae99;});return db['AnalyticFieldReport'][_0x06da('0x47')](_0x39cee0,{'transaction':_0x437991});});})[_0x06da('0x20')](function(){return db[_0x06da('0x42')][_0x06da('0x3d')]({'where':{'CustomReportId':_0x15b6ae[_0x06da('0x41')]['id']}});});}})[_0x06da('0x20')](respondWithResult(_0x34a569,null))[_0x06da('0x3f')](handleError(_0x34a569,null));}; \ No newline at end of file +var _0x03d8=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','catch','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x1c7b8b,_0x2ce52c){var _0x273b99=function(_0x587511){while(--_0x587511){_0x1c7b8b['push'](_0x1c7b8b['shift']());}};_0x273b99(++_0x2ce52c);}(_0x03d8,0x72));var _0x803d=function(_0x24532f,_0x56d15b){_0x24532f=_0x24532f-0x0;var _0x4413dd=_0x03d8[_0x24532f];return _0x4413dd;};'use strict';var emlformat=require(_0x803d('0x0'));var rimraf=require(_0x803d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x803d('0x2'));var rp=require(_0x803d('0x3'));var moment=require(_0x803d('0x4'));var BPromise=require(_0x803d('0x5'));var Mustache=require(_0x803d('0x6'));var util=require(_0x803d('0x7'));var path=require('path');var sox=require(_0x803d('0x8'));var csv=require(_0x803d('0x9'));var ejs=require(_0x803d('0xa'));var fs=require('fs');var fs_extra=require(_0x803d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x803d('0xc'));var jsforce=require(_0x803d('0xd'));var deskjs=require(_0x803d('0xe'));var toCsv=require(_0x803d('0x9'));var querystring=require(_0x803d('0xf'));var Papa=require(_0x803d('0x10'));var Redis=require(_0x803d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x803d('0x12'));var as=require(_0x803d('0x13'));var hardwareService=require(_0x803d('0x14'));var logger=require(_0x803d('0x15'))('api');var utils=require(_0x803d('0x16'));var config=require(_0x803d('0x17'));var licenseUtil=require(_0x803d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a87b,_0x4ef729){_0x4ef729=_0x4ef729||0xcc;return function(_0x23859e){if(_0x23859e){return _0x56a87b[_0x803d('0x19')](_0x4ef729);}return _0x56a87b[_0x803d('0x1a')](_0x4ef729)[_0x803d('0x1b')]();};}function respondWithResult(_0x1b355d,_0x2ea0b6){_0x2ea0b6=_0x2ea0b6||0xc8;return function(_0x30ad2b){if(_0x30ad2b){return _0x1b355d[_0x803d('0x1a')](_0x2ea0b6)[_0x803d('0x1c')](_0x30ad2b);}};}function respondWithFilteredResult(_0x4dff90,_0x35e52c){return function(_0x281475){if(_0x281475){var _0xbe322e=typeof _0x35e52c['offset']===_0x803d('0x1d')&&typeof _0x35e52c['limit']===_0x803d('0x1d');var _0x1d3e6a=_0x281475[_0x803d('0x1e')];var _0x42ab78=_0xbe322e?0x0:_0x35e52c[_0x803d('0x1f')];var _0x452a65=_0xbe322e?_0x281475[_0x803d('0x1e')]:_0x35e52c[_0x803d('0x1f')]+_0x35e52c[_0x803d('0x20')];var _0x228c22;if(_0x452a65>=_0x1d3e6a){_0x452a65=_0x1d3e6a;_0x228c22=0xc8;}else{_0x228c22=0xce;}_0x4dff90[_0x803d('0x1a')](_0x228c22);return _0x4dff90[_0x803d('0x21')](_0x803d('0x22'),_0x42ab78+'-'+_0x452a65+'/'+_0x1d3e6a)[_0x803d('0x1c')](_0x281475);}return null;};}function patchUpdates(_0x174a0e){return function(_0x23fff1){try{jsonpatch[_0x803d('0x23')](_0x23fff1,_0x174a0e,!![]);}catch(_0x2b1993){return BPromise[_0x803d('0x24')](_0x2b1993);}return _0x23fff1[_0x803d('0x25')]();};}function saveUpdates(_0xf4b811,_0x494baa){return function(_0x2e0b22){if(_0x2e0b22){return _0x2e0b22[_0x803d('0x26')](_0xf4b811)[_0x803d('0x27')](function(_0x3cb1b0){return _0x3cb1b0;});}return null;};}function removeEntity(_0xfb4fdf,_0x2def65){return function(_0x43c322){if(_0x43c322){return _0x43c322['destroy']()[_0x803d('0x27')](function(){_0xfb4fdf[_0x803d('0x1a')](0xcc)[_0x803d('0x1b')]();});}};}function handleEntityNotFound(_0x471e7f,_0x1c6f21){return function(_0x368df2){if(!_0x368df2){_0x471e7f['sendStatus'](0x194);}return _0x368df2;};}function handleError(_0x25d06b,_0x4fe2fa){_0x4fe2fa=_0x4fe2fa||0x1f4;return function(_0x32dfba){logger[_0x803d('0x28')](_0x32dfba['stack']);if(_0x32dfba[_0x803d('0x29')]){delete _0x32dfba['name'];}_0x25d06b[_0x803d('0x1a')](_0x4fe2fa)[_0x803d('0x2a')](_0x32dfba);};}exports[_0x803d('0x2b')]=function(_0xca205b,_0x264fa2){var _0xcbadde={},_0x341bbe={},_0x375043={'count':0x0,'rows':[]};var _0x18775b=_[_0x803d('0x2c')](db[_0x803d('0x2d')][_0x803d('0x2e')],function(_0x176a4b){return{'name':_0x176a4b['fieldName'],'type':_0x176a4b[_0x803d('0x2f')][_0x803d('0x30')]};});_0x341bbe[_0x803d('0x31')]=_[_0x803d('0x2c')](_0x18775b,'name');_0x341bbe[_0x803d('0x32')]=_['keys'](_0xca205b[_0x803d('0x32')]);_0x341bbe[_0x803d('0x33')]=_[_0x803d('0x34')](_0x341bbe[_0x803d('0x31')],_0x341bbe[_0x803d('0x32')]);_0xcbadde[_0x803d('0x35')]=_['intersection'](_0x341bbe[_0x803d('0x31')],qs[_0x803d('0x36')](_0xca205b['query'][_0x803d('0x36')]));_0xcbadde[_0x803d('0x35')]=_0xcbadde[_0x803d('0x35')][_0x803d('0x37')]?_0xcbadde['attributes']:_0x341bbe['model'];if(!_0xca205b[_0x803d('0x32')][_0x803d('0x38')](_0x803d('0x39'))){_0xcbadde[_0x803d('0x20')]=qs[_0x803d('0x20')](_0xca205b[_0x803d('0x32')][_0x803d('0x20')]);_0xcbadde[_0x803d('0x1f')]=qs[_0x803d('0x1f')](_0xca205b[_0x803d('0x32')][_0x803d('0x1f')]);}_0xcbadde[_0x803d('0x3a')]=qs[_0x803d('0x3b')](_0xca205b['query'][_0x803d('0x3b')]);_0xcbadde['where']=qs[_0x803d('0x33')](_[_0x803d('0x3c')](_0xca205b[_0x803d('0x32')],_0x341bbe[_0x803d('0x33')]),_0x18775b);if(_0xca205b[_0x803d('0x32')][_0x803d('0x3d')]){_0xcbadde[_0x803d('0x3e')]=_[_0x803d('0x3f')](_0xcbadde[_0x803d('0x3e')],{'$or':_['map'](_0x18775b,function(_0x3477b6){if(_0x3477b6['type']!==_0x803d('0x40')){var _0x2fcf19={};_0x2fcf19[_0x3477b6[_0x803d('0x29')]]={'$like':'%'+_0xca205b['query']['filter']+'%'};return _0x2fcf19;}})});}_0xcbadde=_['merge']({},_0xcbadde,_0xca205b['options']);var _0x45c79b={'where':_0xcbadde[_0x803d('0x3e')]};return db[_0x803d('0x2d')]['count'](_0x45c79b)[_0x803d('0x27')](function(_0x235730){_0x375043[_0x803d('0x1e')]=_0x235730;if(_0xca205b[_0x803d('0x32')][_0x803d('0x41')]){_0xcbadde[_0x803d('0x42')]=[{'all':!![]}];}return db[_0x803d('0x2d')]['findAll'](_0xcbadde);})[_0x803d('0x27')](function(_0x33f655){_0x375043[_0x803d('0x43')]=_0x33f655;return _0x375043;})[_0x803d('0x27')](respondWithFilteredResult(_0x264fa2,_0xcbadde))['catch'](handleError(_0x264fa2,null));};exports[_0x803d('0x44')]=function(_0x14175d,_0x5b0a55){var _0x29564e={'raw':![],'where':{'id':_0x14175d[_0x803d('0x45')]['id']}},_0xc2f4f4={};_0xc2f4f4[_0x803d('0x31')]=_[_0x803d('0x46')](db[_0x803d('0x2d')][_0x803d('0x2e')]);_0xc2f4f4[_0x803d('0x32')]=_[_0x803d('0x46')](_0x14175d['query']);_0xc2f4f4['filters']=_[_0x803d('0x34')](_0xc2f4f4['model'],_0xc2f4f4[_0x803d('0x32')]);_0x29564e[_0x803d('0x35')]=_[_0x803d('0x34')](_0xc2f4f4[_0x803d('0x31')],qs[_0x803d('0x36')](_0x14175d[_0x803d('0x32')][_0x803d('0x36')]));_0x29564e[_0x803d('0x35')]=_0x29564e[_0x803d('0x35')]['length']?_0x29564e[_0x803d('0x35')]:_0xc2f4f4[_0x803d('0x31')];if(_0x14175d[_0x803d('0x32')]['includeAll']){_0x29564e[_0x803d('0x42')]=[{'all':!![]}];}_0x29564e=_['merge']({},_0x29564e,_0x14175d[_0x803d('0x47')]);return db[_0x803d('0x2d')][_0x803d('0x48')](_0x29564e)[_0x803d('0x27')](handleEntityNotFound(_0x5b0a55,null))['then'](respondWithResult(_0x5b0a55,null))[_0x803d('0x49')](handleError(_0x5b0a55,null));};exports[_0x803d('0x4a')]=function(_0x2e295c,_0x28ba0a){return db[_0x803d('0x2d')]['create'](_0x2e295c[_0x803d('0x4b')],{})[_0x803d('0x27')](respondWithResult(_0x28ba0a,0xc9))[_0x803d('0x49')](handleError(_0x28ba0a,null));};exports[_0x803d('0x4c')]=function(_0x13fb82,_0xb976e7){return db[_0x803d('0x2d')]['bulkCreate'](_0x13fb82[_0x803d('0x4b')],{'raw':![],'individualHooks':!![]})[_0x803d('0x27')](respondWithResult(_0xb976e7,0xc9))[_0x803d('0x49')](handleError(_0xb976e7,null));};exports['update']=function(_0x5b92f9,_0x55d609){if(_0x5b92f9[_0x803d('0x4b')]['id']){delete _0x5b92f9['body']['id'];}return db[_0x803d('0x2d')][_0x803d('0x48')]({'where':{'id':_0x5b92f9['params']['id']}})[_0x803d('0x27')](handleEntityNotFound(_0x55d609,null))[_0x803d('0x27')](saveUpdates(_0x5b92f9[_0x803d('0x4b')],null))[_0x803d('0x27')](respondWithResult(_0x55d609,null))[_0x803d('0x49')](handleError(_0x55d609,null));};exports[_0x803d('0x4d')]=function(_0x4fa295,_0x45d38a){return db['AnalyticFieldReport'][_0x803d('0x48')]({'where':{'id':_0x4fa295[_0x803d('0x45')]['id']}})[_0x803d('0x27')](handleEntityNotFound(_0x45d38a,null))[_0x803d('0x27')](removeEntity(_0x45d38a,null))[_0x803d('0x49')](handleError(_0x45d38a,null));};exports[_0x803d('0x4e')]=function(_0x403b86,_0x1ea016){return db[_0x803d('0x2d')][_0x803d('0x4d')]({'where':{'id':_0x403b86[_0x803d('0x32')][_0x803d('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x803d('0x27')](respondWithResult(_0x1ea016,0xcc))['catch'](handleError(_0x1ea016,null));};exports[_0x803d('0x50')]=function(_0x296f25,_0x5c0e73,_0x420ed8){return db[_0x803d('0x51')][_0x803d('0x52')]({'where':{'id':_0x296f25['params']['id']}})[_0x803d('0x27')](handleEntityNotFound(_0x5c0e73,null))[_0x803d('0x27')](function(_0x29f547){if(_0x29f547){return db[_0x803d('0x53')]['transaction'](function(_0x458876){return db[_0x803d('0x2d')][_0x803d('0x4d')]({'where':{'CustomReportId':_0x296f25['params']['id']},'transaction':_0x458876})[_0x803d('0x27')](function(_0x54ce58){var _0x161ea0=_[_0x803d('0x2c')](_0x296f25['body'],function(_0x3701f8){delete _0x3701f8['id'];_0x3701f8[_0x803d('0x54')]=_0x296f25[_0x803d('0x45')]['id'];return _0x3701f8;});return db[_0x803d('0x2d')]['bulkCreate'](_0x161ea0,{'transaction':_0x458876});});})[_0x803d('0x27')](function(){return db[_0x803d('0x2d')]['findAll']({'where':{'CustomReportId':_0x296f25[_0x803d('0x45')]['id']}});});}})['then'](respondWithResult(_0x5c0e73,null))[_0x803d('0x49')](handleError(_0x5c0e73,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 15cd0cd..9c781df 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 _0x9bee=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x4a322e,_0x43fe03){var _0xb8a78b=function(_0x1922a0){while(--_0x1922a0){_0x4a322e['push'](_0x4a322e['shift']());}};_0xb8a78b(++_0x43fe03);}(_0x9bee,0x120));var _0xe9be=function(_0x9cd23a,_0xee570b){_0x9cd23a=_0x9cd23a-0x0;var _0x1fbe49=_0x9bee[_0x9cd23a];return _0x1fbe49;};'use strict';var _=require(_0xe9be('0x0'));var util=require('util');var logger=require(_0xe9be('0x1'))(_0xe9be('0x2'));var moment=require(_0xe9be('0x3'));var BPromise=require('bluebird');var rp=require(_0xe9be('0x4'));var fs=require('fs');var path=require(_0xe9be('0x5'));var rimraf=require(_0xe9be('0x6'));var config=require(_0xe9be('0x7'));var attributes=require(_0xe9be('0x8'));module[_0xe9be('0x9')]=function(_0x1a57b3,_0x1c5636){return _0x1a57b3[_0xe9be('0xa')](_0xe9be('0xb'),attributes,{'tableName':_0xe9be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10e1=['lodash','../../config/logger','api','moment','bluebird','rimraf','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x117926,_0x268445){var _0xc34604=function(_0x67f9c5){while(--_0x67f9c5){_0x117926['push'](_0x117926['shift']());}};_0xc34604(++_0x268445);}(_0x10e1,0x99));var _0x110e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x10e1[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x110e('0x0'));var util=require('util');var logger=require(_0x110e('0x1'))(_0x110e('0x2'));var moment=require(_0x110e('0x3'));var BPromise=require(_0x110e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x110e('0x5'));var config=require('../../config/environment');var attributes=require(_0x110e('0x6'));module[_0x110e('0x7')]=function(_0xff28cd,_0x3460b3){return _0xff28cd['define'](_0x110e('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 610869c..df927a5 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 _0x1614=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info'];(function(_0x38a4da,_0x51dd44){var _0x58f069=function(_0x56e36e){while(--_0x56e36e){_0x38a4da['push'](_0x38a4da['shift']());}};_0x58f069(++_0x51dd44);}(_0x1614,0x16a));var _0x4161=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x1614[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require('lodash');var util=require(_0x4161('0x0'));var moment=require('moment');var BPromise=require(_0x4161('0x1'));var rs=require(_0x4161('0x2'));var fs=require('fs');var Redis=require(_0x4161('0x3'));var db=require(_0x4161('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4161('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4161('0x6'));var client=jayson[_0x4161('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1209,_0x20838a,_0x1867a7){return new BPromise(function(_0x51daf0,_0x47e84e){return client[_0x4161('0x8')](_0x3a1209,_0x1867a7)[_0x4161('0x9')](function(_0x1836da){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x20838a,_0x4161('0xa'));logger[_0x4161('0xb')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x20838a,'request\x20sent',JSON[_0x4161('0xc')](_0x1836da));if(_0x1836da[_0x4161('0xd')]){if(_0x1836da[_0x4161('0xd')][_0x4161('0xe')]===0x1f4){logger[_0x4161('0xd')](_0x4161('0xf'),_0x20838a,_0x1836da[_0x4161('0xd')][_0x4161('0x10')]);return _0x47e84e(_0x1836da[_0x4161('0xd')][_0x4161('0x10')]);}logger[_0x4161('0xd')](_0x4161('0xf'),_0x20838a,_0x1836da['error'][_0x4161('0x10')]);return _0x51daf0(_0x1836da[_0x4161('0xd')][_0x4161('0x10')]);}else{logger[_0x4161('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x20838a,_0x4161('0xa'));_0x51daf0(_0x1836da['result'][_0x4161('0x10')]);}})[_0x4161('0x12')](function(_0x5af787){logger[_0x4161('0xd')](_0x4161('0xf'),_0x20838a,_0x5af787);_0x47e84e(_0x5af787);});});} \ No newline at end of file +var _0x5b45=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','lodash','util'];(function(_0x40eac1,_0x29f24e){var _0x55321f=function(_0x29208b){while(--_0x29208b){_0x40eac1['push'](_0x40eac1['shift']());}};_0x55321f(++_0x29f24e);}(_0x5b45,0x132));var _0x55b4=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x5b45[_0x3b711c];return _0x2685f0;};'use strict';var _=require(_0x55b4('0x0'));var util=require(_0x55b4('0x1'));var moment=require(_0x55b4('0x2'));var BPromise=require('bluebird');var rs=require(_0x55b4('0x3'));var fs=require('fs');var Redis=require(_0x55b4('0x4'));var db=require(_0x55b4('0x5'))['db'];var utils=require(_0x55b4('0x6'));var logger=require(_0x55b4('0x7'))(_0x55b4('0x8'));var config=require(_0x55b4('0x9'));var jayson=require(_0x55b4('0xa'));var client=jayson[_0x55b4('0xb')][_0x55b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x320369,_0x1a2b8e,_0x3c85a9){return new BPromise(function(_0x5abb05,_0x5c114a){return client['request'](_0x320369,_0x3c85a9)[_0x55b4('0xd')](function(_0x4b1102){logger[_0x55b4('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1a2b8e,_0x55b4('0xf'));logger['debug'](_0x55b4('0x10'),_0x1a2b8e,'request\x20sent',JSON[_0x55b4('0x11')](_0x4b1102));if(_0x4b1102[_0x55b4('0x12')]){if(_0x4b1102[_0x55b4('0x12')][_0x55b4('0x13')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x1a2b8e,_0x4b1102['error'][_0x55b4('0x14')]);return _0x5c114a(_0x4b1102[_0x55b4('0x12')][_0x55b4('0x14')]);}logger[_0x55b4('0x12')](_0x55b4('0x15'),_0x1a2b8e,_0x4b1102[_0x55b4('0x12')][_0x55b4('0x14')]);return _0x5abb05(_0x4b1102[_0x55b4('0x12')][_0x55b4('0x14')]);}else{logger[_0x55b4('0xe')](_0x55b4('0x15'),_0x1a2b8e,_0x55b4('0xf'));_0x5abb05(_0x4b1102['result'][_0x55b4('0x14')]);}})['catch'](function(_0x6d04d7){logger[_0x55b4('0x12')](_0x55b4('0x15'),_0x1a2b8e,_0x6d04d7);_0x5c114a(_0x6d04d7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e423d4f..2660f66 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(_0x45cb01,_0x3df56b){var _0x20e409=function(_0x233f77){while(--_0x233f77){_0x45cb01['push'](_0x45cb01['shift']());}};_0x20e409(++_0x3df56b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x196f02,_0x5265c0){var _0x153425=function(_0x8851a8){while(--_0x8851a8){_0x196f02['push'](_0x196f02['shift']());}};_0x153425(++_0x5265c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 346c76d..519dada 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 _0xf53d=['exports','name','STRING','TEXT','sequelize'];(function(_0x319858,_0x7f2819){var _0x1fbade=function(_0x485282){while(--_0x485282){_0x319858['push'](_0x319858['shift']());}};_0x1fbade(++_0x7f2819);}(_0xf53d,0x199));var _0xdf53=function(_0x33e06f,_0x51be64){_0x33e06f=_0x33e06f-0x0;var _0x4675fd=_0xf53d[_0x33e06f];return _0x4675fd;};'use strict';var Sequelize=require(_0xdf53('0x0'));module[_0xdf53('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf53('0x2')},'table':{'type':Sequelize[_0xdf53('0x3')]},'metric':{'type':Sequelize[_0xdf53('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7e05=['sequelize','exports','name','TEXT','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7e05,0x69));var _0x57e0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7e05[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x57e0('0x0'));module[_0x57e0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x57e0('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x57e0('0x3')]},'description':{'type':Sequelize[_0x57e0('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ce855c7..2fb83f3 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 _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x26313e,_0x343448){var _0x16dd88=function(_0x265c77){while(--_0x265c77){_0x26313e['push'](_0x26313e['shift']());}};_0x16dd88(++_0x343448);}(_0x425d,0x1e0));var _0xd425=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x425d[_0xb66df];return _0x42a702;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x451ebe,_0x44c9fb){var _0x34de78=function(_0x25bbf2){while(--_0x25bbf2){_0x451ebe['push'](_0x451ebe['shift']());}};_0x34de78(++_0x44c9fb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x5fc3[_0x1e1965];return _0x1a2e96;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index af5a2c5..547e3ef 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 _0xbbbd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x346220,_0x177b7b){var _0x455e0c=function(_0x22daf7){while(--_0x22daf7){_0x346220['push'](_0x346220['shift']());}};_0x455e0c(++_0x177b7b);}(_0xbbbd,0x86));var _0xdbbb=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xbbbd[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var logger=require(_0xdbbb('0x2'))(_0xdbbb('0x3'));var moment=require(_0xdbbb('0x4'));var BPromise=require(_0xdbbb('0x5'));var rp=require(_0xdbbb('0x6'));var fs=require('fs');var path=require(_0xdbbb('0x7'));var rimraf=require(_0xdbbb('0x8'));var config=require(_0xdbbb('0x9'));var attributes=require(_0xdbbb('0xa'));module[_0xdbbb('0xb')]=function(_0x4e9523,_0xa5399d){return _0x4e9523[_0xdbbb('0xc')](_0xdbbb('0xd'),attributes,{'tableName':_0xdbbb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d95=['util','api','moment','bluebird','request-promise','path','../../config/environment','lodash'];(function(_0x5d37e0,_0x4b785e){var _0x50a47a=function(_0x462fab){while(--_0x462fab){_0x5d37e0['push'](_0x5d37e0['shift']());}};_0x50a47a(++_0x4b785e);}(_0x5d95,0x77));var _0x55d9=function(_0x3d0603,_0x2272c5){_0x3d0603=_0x3d0603-0x0;var _0x3338c0=_0x5d95[_0x3d0603];return _0x3338c0;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var logger=require('../../config/logger')(_0x55d9('0x2'));var moment=require(_0x55d9('0x3'));var BPromise=require(_0x55d9('0x4'));var rp=require(_0x55d9('0x5'));var fs=require('fs');var path=require(_0x55d9('0x6'));var rimraf=require('rimraf');var config=require(_0x55d9('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x25957e,_0x4244b4){return _0x25957e['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 758a3b8..512ce8d 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 _0x3866=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3cc977,_0x5a080e){var _0x21f180=function(_0x5da3f9){while(--_0x5da3f9){_0x3cc977['push'](_0x3cc977['shift']());}};_0x21f180(++_0x5a080e);}(_0x3866,0x145));var _0x6386=function(_0x2cd9a5,_0x4ccf41){_0x2cd9a5=_0x2cd9a5-0x0;var _0x33cb6e=_0x3866[_0x2cd9a5];return _0x33cb6e;};'use strict';var _=require('lodash');var util=require(_0x6386('0x0'));var moment=require(_0x6386('0x1'));var BPromise=require(_0x6386('0x2'));var rs=require(_0x6386('0x3'));var fs=require('fs');var Redis=require(_0x6386('0x4'));var db=require(_0x6386('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6386('0x6'))('rpc');var config=require(_0x6386('0x7'));var jayson=require(_0x6386('0x8'));var client=jayson[_0x6386('0x9')][_0x6386('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244173,_0x1c9370,_0x37fa21){return new BPromise(function(_0x34ef4f,_0x36feee){return client['request'](_0x244173,_0x37fa21)[_0x6386('0xb')](function(_0x50de48){logger[_0x6386('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x1c9370,_0x6386('0xd'));logger[_0x6386('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1c9370,_0x6386('0xd'),JSON[_0x6386('0xf')](_0x50de48));if(_0x50de48[_0x6386('0x10')]){if(_0x50de48[_0x6386('0x10')][_0x6386('0x11')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x1c9370,_0x50de48[_0x6386('0x10')][_0x6386('0x12')]);return _0x36feee(_0x50de48[_0x6386('0x10')]['message']);}logger[_0x6386('0x10')](_0x6386('0x13'),_0x1c9370,_0x50de48[_0x6386('0x10')][_0x6386('0x12')]);return _0x34ef4f(_0x50de48[_0x6386('0x10')][_0x6386('0x12')]);}else{logger['info'](_0x6386('0x13'),_0x1c9370,_0x6386('0xd'));_0x34ef4f(_0x50de48[_0x6386('0x14')][_0x6386('0x12')]);}})[_0x6386('0x15')](function(_0x3e7f11){logger['error'](_0x6386('0x13'),_0x1c9370,_0x3e7f11);_0x36feee(_0x3e7f11);});});} \ No newline at end of file +var _0x5271=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','AnalyticMetric,\x20%s,\x20%s','result','catch'];(function(_0x37e225,_0x1d19eb){var _0x478cf8=function(_0x5c83c6){while(--_0x5c83c6){_0x37e225['push'](_0x37e225['shift']());}};_0x478cf8(++_0x1d19eb);}(_0x5271,0x159));var _0x1527=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x5271[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x1527('0x0'));var util=require(_0x1527('0x1'));var moment=require(_0x1527('0x2'));var BPromise=require(_0x1527('0x3'));var rs=require(_0x1527('0x4'));var fs=require('fs');var Redis=require(_0x1527('0x5'));var db=require(_0x1527('0x6'))['db'];var utils=require(_0x1527('0x7'));var logger=require(_0x1527('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1527('0x9'));var client=jayson[_0x1527('0xa')][_0x1527('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x267606,_0x2d826b,_0x81b314){return new BPromise(function(_0xc76fa7,_0x401dbf){return client[_0x1527('0xc')](_0x267606,_0x81b314)[_0x1527('0xd')](function(_0x1fe86c){logger[_0x1527('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x2d826b,_0x1527('0xf'));logger[_0x1527('0x10')](_0x1527('0x11'),_0x2d826b,_0x1527('0xf'),JSON['stringify'](_0x1fe86c));if(_0x1fe86c['error']){if(_0x1fe86c['error']['code']===0x1f4){logger[_0x1527('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x2d826b,_0x1fe86c[_0x1527('0x12')]['message']);return _0x401dbf(_0x1fe86c[_0x1527('0x12')][_0x1527('0x13')]);}logger[_0x1527('0x12')](_0x1527('0x14'),_0x2d826b,_0x1fe86c['error'][_0x1527('0x13')]);return _0xc76fa7(_0x1fe86c[_0x1527('0x12')][_0x1527('0x13')]);}else{logger[_0x1527('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x2d826b,'request\x20sent');_0xc76fa7(_0x1fe86c[_0x1527('0x15')][_0x1527('0x13')]);}})[_0x1527('0x16')](function(_0x4a9baa){logger[_0x1527('0x12')](_0x1527('0x14'),_0x2d826b,_0x4a9baa);_0x401dbf(_0x4a9baa);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c1f88c2..40d8ee2 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 _0x22ed=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','isAuthenticated','show','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4b8f44,_0x5c9193){var _0x5b1265=function(_0x742f67){while(--_0x742f67){_0x4b8f44['push'](_0x4b8f44['shift']());}};_0x5b1265(++_0x5c9193);}(_0x22ed,0x1a9));var _0xd22e=function(_0x4c1078,_0xe10656){_0x4c1078=_0x4c1078-0x0;var _0x3f347d=_0x22ed[_0x4c1078];return _0x3f347d;};'use strict';var multer=require(_0xd22e('0x0'));var util=require(_0xd22e('0x1'));var path=require(_0xd22e('0x2'));var timeout=require(_0xd22e('0x3'));var express=require(_0xd22e('0x4'));var router=express[_0xd22e('0x5')]();var fs_extra=require(_0xd22e('0x6'));var auth=require(_0xd22e('0x7'));var interaction=require(_0xd22e('0x8'));var config=require(_0xd22e('0x9'));var controller=require(_0xd22e('0xa'));router[_0xd22e('0xb')]('/',auth['isAuthenticated'](),controller[_0xd22e('0xc')]);router[_0xd22e('0xb')]('/:id',auth[_0xd22e('0xd')](),controller[_0xd22e('0xe')]);router['post']('/',auth[_0xd22e('0xd')](),controller['create']);router['put'](_0xd22e('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd22e('0xf'),auth[_0xd22e('0xd')](),controller[_0xd22e('0x10')]);module[_0xd22e('0x11')]=router; \ No newline at end of file +var _0x12e9=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','update','delete','exports','path','express','Router'];(function(_0x48350f,_0x1a941a){var _0x2df5d4=function(_0xb7ccb1){while(--_0xb7ccb1){_0x48350f['push'](_0x48350f['shift']());}};_0x2df5d4(++_0x1a941a);}(_0x12e9,0x66));var _0x912e=function(_0x5eda74,_0x367e9d){_0x5eda74=_0x5eda74-0x0;var _0xe26e89=_0x12e9[_0x5eda74];return _0xe26e89;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x912e('0x0'));var timeout=require('connect-timeout');var express=require(_0x912e('0x1'));var router=express[_0x912e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x912e('0x3'));var interaction=require(_0x912e('0x4'));var config=require('../../config/environment');var controller=require(_0x912e('0x5'));router[_0x912e('0x6')]('/',auth[_0x912e('0x7')](),controller[_0x912e('0x8')]);router['get'](_0x912e('0x9'),auth[_0x912e('0x7')](),controller[_0x912e('0xa')]);router[_0x912e('0xb')]('/',auth[_0x912e('0x7')](),controller['create']);router['put']('/:id',auth[_0x912e('0x7')](),controller[_0x912e('0xc')]);router[_0x912e('0xd')](_0x912e('0x9'),auth[_0x912e('0x7')](),controller['destroy']);module[_0x912e('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a4585ab..a4cb07e 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 _0x4c14=['sequelize','exports','TEXT'];(function(_0x2007cf,_0x23a105){var _0x17d6c0=function(_0x329a29){while(--_0x329a29){_0x2007cf['push'](_0x2007cf['shift']());}};_0x17d6c0(++_0x23a105);}(_0x4c14,0xcc));var _0x44c1=function(_0x2343d9,_0x5c1cf7){_0x2343d9=_0x2343d9-0x0;var _0x3d488f=_0x4c14[_0x2343d9];return _0x3d488f;};'use strict';var Sequelize=require(_0x44c1('0x0'));module[_0x44c1('0x1')]={'tree':{'type':Sequelize[_0x44c1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd64b=['TEXT','sequelize'];(function(_0x3b6d0a,_0x28a113){var _0x2979cd=function(_0x44c34c){while(--_0x44c34c){_0x3b6d0a['push'](_0x3b6d0a['shift']());}};_0x2979cd(++_0x28a113);}(_0xd64b,0xc1));var _0xbd64=function(_0x342515,_0x6db444){_0x342515=_0x342515-0x0;var _0x5bdef4=_0xd64b[_0x342515];return _0x5bdef4;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'tree':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 87f3ad4..37aebe4 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 _0x7b75=['send','AnalyticTreeReport','rawAttributes','type','key','model','map','name','keys','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','catch','show','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','end','stack'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7b75,0x1d0));var _0x57b7=function(_0x3ebb0f,_0x4937b1){_0x3ebb0f=_0x3ebb0f-0x0;var _0x455bd2=_0x7b75[_0x3ebb0f];return _0x455bd2;};'use strict';var emlformat=require(_0x57b7('0x0'));var rimraf=require(_0x57b7('0x1'));var zipdir=require(_0x57b7('0x2'));var jsonpatch=require(_0x57b7('0x3'));var rp=require(_0x57b7('0x4'));var moment=require('moment');var BPromise=require(_0x57b7('0x5'));var Mustache=require(_0x57b7('0x6'));var util=require(_0x57b7('0x7'));var path=require(_0x57b7('0x8'));var sox=require(_0x57b7('0x9'));var csv=require(_0x57b7('0xa'));var ejs=require(_0x57b7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57b7('0xc'));var squel=require(_0x57b7('0xd'));var crypto=require(_0x57b7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x57b7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x57b7('0x10'));var Papa=require(_0x57b7('0x11'));var Redis=require(_0x57b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x57b7('0x13'));var as=require(_0x57b7('0x14'));var hardwareService=require(_0x57b7('0x15'));var logger=require(_0x57b7('0x16'))('api');var utils=require(_0x57b7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x57b7('0x18'));var db=require(_0x57b7('0x19'))['db'];function respondWithStatusCode(_0x2fd9fe,_0xa45459){_0xa45459=_0xa45459||0xcc;return function(_0x5ab902){if(_0x5ab902){return _0x2fd9fe[_0x57b7('0x1a')](_0xa45459);}return _0x2fd9fe[_0x57b7('0x1b')](_0xa45459)['end']();};}function respondWithResult(_0x3b31e1,_0x4c4c3e){_0x4c4c3e=_0x4c4c3e||0xc8;return function(_0xf3a49e){if(_0xf3a49e){return _0x3b31e1['status'](_0x4c4c3e)['json'](_0xf3a49e);}};}function respondWithFilteredResult(_0x198d7e,_0x14e155){return function(_0x5b77bc){if(_0x5b77bc){var _0x54d064=typeof _0x14e155[_0x57b7('0x1c')]===_0x57b7('0x1d')&&typeof _0x14e155[_0x57b7('0x1e')]===_0x57b7('0x1d');var _0x51fd0a=_0x5b77bc['count'];var _0x7a140b=_0x54d064?0x0:_0x14e155[_0x57b7('0x1c')];var _0x3f2587=_0x54d064?_0x5b77bc[_0x57b7('0x1f')]:_0x14e155['offset']+_0x14e155[_0x57b7('0x1e')];var _0x231576;if(_0x3f2587>=_0x51fd0a){_0x3f2587=_0x51fd0a;_0x231576=0xc8;}else{_0x231576=0xce;}_0x198d7e['status'](_0x231576);return _0x198d7e['set'](_0x57b7('0x20'),_0x7a140b+'-'+_0x3f2587+'/'+_0x51fd0a)[_0x57b7('0x21')](_0x5b77bc);}return null;};}function patchUpdates(_0x5060d3){return function(_0xddd82){try{jsonpatch['apply'](_0xddd82,_0x5060d3,!![]);}catch(_0x2f40f7){return BPromise[_0x57b7('0x22')](_0x2f40f7);}return _0xddd82[_0x57b7('0x23')]();};}function saveUpdates(_0x2798bf,_0x9eacde){return function(_0x1bdf6b){if(_0x1bdf6b){return _0x1bdf6b[_0x57b7('0x24')](_0x2798bf)[_0x57b7('0x25')](function(_0x46066a){return _0x46066a;});}return null;};}function removeEntity(_0x137c09,_0x3d7404){return function(_0x21b674){if(_0x21b674){return _0x21b674['destroy']()[_0x57b7('0x25')](function(){_0x137c09[_0x57b7('0x1b')](0xcc)[_0x57b7('0x26')]();});}};}function handleEntityNotFound(_0x2e2f30,_0x19ca8f){return function(_0x2e81c6){if(!_0x2e81c6){_0x2e2f30[_0x57b7('0x1a')](0x194);}return _0x2e81c6;};}function handleError(_0x3987d6,_0x2e2ff0){_0x2e2ff0=_0x2e2ff0||0x1f4;return function(_0x24bb07){logger['error'](_0x24bb07[_0x57b7('0x27')]);if(_0x24bb07['name']){delete _0x24bb07['name'];}_0x3987d6[_0x57b7('0x1b')](_0x2e2ff0)[_0x57b7('0x28')](_0x24bb07);};}exports['index']=function(_0x4b9f5a,_0x3c96e4){var _0x40e502={},_0x2d053e={},_0x5b3212={'count':0x0,'rows':[]};var _0x3a2baa=_['map'](db[_0x57b7('0x29')][_0x57b7('0x2a')],function(_0x3485c5){return{'name':_0x3485c5['fieldName'],'type':_0x3485c5[_0x57b7('0x2b')][_0x57b7('0x2c')]};});_0x2d053e[_0x57b7('0x2d')]=_[_0x57b7('0x2e')](_0x3a2baa,_0x57b7('0x2f'));_0x2d053e['query']=_[_0x57b7('0x30')](_0x4b9f5a['query']);_0x2d053e['filters']=_['intersection'](_0x2d053e[_0x57b7('0x2d')],_0x2d053e['query']);_0x40e502[_0x57b7('0x31')]=_[_0x57b7('0x32')](_0x2d053e[_0x57b7('0x2d')],qs[_0x57b7('0x33')](_0x4b9f5a[_0x57b7('0x34')][_0x57b7('0x33')]));_0x40e502[_0x57b7('0x31')]=_0x40e502[_0x57b7('0x31')][_0x57b7('0x35')]?_0x40e502['attributes']:_0x2d053e[_0x57b7('0x2d')];if(!_0x4b9f5a[_0x57b7('0x34')][_0x57b7('0x36')](_0x57b7('0x37'))){_0x40e502[_0x57b7('0x1e')]=qs[_0x57b7('0x1e')](_0x4b9f5a[_0x57b7('0x34')][_0x57b7('0x1e')]);_0x40e502[_0x57b7('0x1c')]=qs[_0x57b7('0x1c')](_0x4b9f5a['query']['offset']);}_0x40e502['order']=qs[_0x57b7('0x38')](_0x4b9f5a[_0x57b7('0x34')][_0x57b7('0x38')]);_0x40e502[_0x57b7('0x39')]=qs[_0x57b7('0x3a')](_[_0x57b7('0x3b')](_0x4b9f5a[_0x57b7('0x34')],_0x2d053e[_0x57b7('0x3a')]),_0x3a2baa);if(_0x4b9f5a[_0x57b7('0x34')][_0x57b7('0x3c')]){_0x40e502[_0x57b7('0x39')]=_[_0x57b7('0x3d')](_0x40e502[_0x57b7('0x39')],{'$or':_[_0x57b7('0x2e')](_0x3a2baa,function(_0x2bdbfb){if(_0x2bdbfb[_0x57b7('0x2b')]!==_0x57b7('0x3e')){var _0x5dda02={};_0x5dda02[_0x2bdbfb[_0x57b7('0x2f')]]={'$like':'%'+_0x4b9f5a[_0x57b7('0x34')]['filter']+'%'};return _0x5dda02;}})});}_0x40e502=_[_0x57b7('0x3d')]({},_0x40e502,_0x4b9f5a['options']);var _0x26d0f2={'where':_0x40e502[_0x57b7('0x39')]};return db[_0x57b7('0x29')][_0x57b7('0x1f')](_0x26d0f2)[_0x57b7('0x25')](function(_0x337fc3){_0x5b3212['count']=_0x337fc3;if(_0x4b9f5a[_0x57b7('0x34')]['includeAll']){_0x40e502[_0x57b7('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x57b7('0x40')](_0x40e502);})[_0x57b7('0x25')](function(_0x2942e0){_0x5b3212['rows']=_0x2942e0;return _0x5b3212;})[_0x57b7('0x25')](respondWithFilteredResult(_0x3c96e4,_0x40e502))[_0x57b7('0x41')](handleError(_0x3c96e4,null));};exports[_0x57b7('0x42')]=function(_0x325163,_0x24ca06){var _0x1d23f7={'raw':!![],'where':{'id':_0x325163['params']['id']}},_0x5bc737={};_0x5bc737['model']=_[_0x57b7('0x30')](db[_0x57b7('0x29')][_0x57b7('0x2a')]);_0x5bc737[_0x57b7('0x34')]=_[_0x57b7('0x30')](_0x325163['query']);_0x5bc737[_0x57b7('0x3a')]=_[_0x57b7('0x32')](_0x5bc737[_0x57b7('0x2d')],_0x5bc737[_0x57b7('0x34')]);_0x1d23f7[_0x57b7('0x31')]=_[_0x57b7('0x32')](_0x5bc737[_0x57b7('0x2d')],qs[_0x57b7('0x33')](_0x325163[_0x57b7('0x34')][_0x57b7('0x33')]));_0x1d23f7[_0x57b7('0x31')]=_0x1d23f7[_0x57b7('0x31')][_0x57b7('0x35')]?_0x1d23f7['attributes']:_0x5bc737[_0x57b7('0x2d')];if(_0x325163[_0x57b7('0x34')][_0x57b7('0x43')]){_0x1d23f7[_0x57b7('0x3f')]=[{'all':!![]}];}_0x1d23f7=_[_0x57b7('0x3d')]({},_0x1d23f7,_0x325163['options']);return db[_0x57b7('0x29')][_0x57b7('0x44')](_0x1d23f7)[_0x57b7('0x25')](handleEntityNotFound(_0x24ca06,null))[_0x57b7('0x25')](respondWithResult(_0x24ca06,null))[_0x57b7('0x41')](handleError(_0x24ca06,null));};exports[_0x57b7('0x45')]=function(_0x5910ce,_0x8ecfbc){return db[_0x57b7('0x29')]['create'](_0x5910ce[_0x57b7('0x46')],{})['then'](respondWithResult(_0x8ecfbc,0xc9))[_0x57b7('0x41')](handleError(_0x8ecfbc,null));};exports[_0x57b7('0x24')]=function(_0x31dff2,_0x26bb2f){if(_0x31dff2[_0x57b7('0x46')]['id']){delete _0x31dff2['body']['id'];}return db[_0x57b7('0x29')][_0x57b7('0x44')]({'where':{'id':_0x31dff2['params']['id']}})[_0x57b7('0x25')](handleEntityNotFound(_0x26bb2f,null))['then'](saveUpdates(_0x31dff2[_0x57b7('0x46')],null))['then'](respondWithResult(_0x26bb2f,null))[_0x57b7('0x41')](handleError(_0x26bb2f,null));};exports['destroy']=function(_0x3a04dc,_0x198a7d){return db[_0x57b7('0x29')]['find']({'where':{'id':_0x3a04dc[_0x57b7('0x47')]['id']}})[_0x57b7('0x25')](handleEntityNotFound(_0x198a7d,null))[_0x57b7('0x25')](removeEntity(_0x198a7d,null))[_0x57b7('0x41')](handleError(_0x198a7d,null));}; \ No newline at end of file +var _0xc009=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','end','sendStatus','error','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','length','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0xc009,0x88));var _0x9c00=function(_0x4e3189,_0x2a3f2b){_0x4e3189=_0x4e3189-0x0;var _0x256aac=_0xc009[_0x4e3189];return _0x256aac;};'use strict';var emlformat=require(_0x9c00('0x0'));var rimraf=require(_0x9c00('0x1'));var zipdir=require(_0x9c00('0x2'));var jsonpatch=require(_0x9c00('0x3'));var rp=require(_0x9c00('0x4'));var moment=require(_0x9c00('0x5'));var BPromise=require(_0x9c00('0x6'));var Mustache=require('mustache');var util=require(_0x9c00('0x7'));var path=require(_0x9c00('0x8'));var sox=require('sox');var csv=require(_0x9c00('0x9'));var ejs=require(_0x9c00('0xa'));var fs=require('fs');var fs_extra=require(_0x9c00('0xb'));var _=require(_0x9c00('0xc'));var squel=require(_0x9c00('0xd'));var crypto=require(_0x9c00('0xe'));var jsforce=require(_0x9c00('0xf'));var deskjs=require(_0x9c00('0x10'));var toCsv=require(_0x9c00('0x9'));var querystring=require(_0x9c00('0x11'));var Papa=require(_0x9c00('0x12'));var Redis=require(_0x9c00('0x13'));var authService=require(_0x9c00('0x14'));var qs=require(_0x9c00('0x15'));var as=require(_0x9c00('0x16'));var hardwareService=require(_0x9c00('0x17'));var logger=require(_0x9c00('0x18'))('api');var utils=require(_0x9c00('0x19'));var config=require(_0x9c00('0x1a'));var licenseUtil=require(_0x9c00('0x1b'));var db=require(_0x9c00('0x1c'))['db'];function respondWithStatusCode(_0x931e2b,_0x3dd695){_0x3dd695=_0x3dd695||0xcc;return function(_0x3b67dc){if(_0x3b67dc){return _0x931e2b['sendStatus'](_0x3dd695);}return _0x931e2b[_0x9c00('0x1d')](_0x3dd695)['end']();};}function respondWithResult(_0xdf30b4,_0x3e5e68){_0x3e5e68=_0x3e5e68||0xc8;return function(_0x25d54a){if(_0x25d54a){return _0xdf30b4[_0x9c00('0x1d')](_0x3e5e68)[_0x9c00('0x1e')](_0x25d54a);}};}function respondWithFilteredResult(_0x4228a2,_0x3407d8){return function(_0x263d2b){if(_0x263d2b){var _0x5327d1=typeof _0x3407d8[_0x9c00('0x1f')]===_0x9c00('0x20')&&typeof _0x3407d8['limit']===_0x9c00('0x20');var _0x3afd74=_0x263d2b[_0x9c00('0x21')];var _0x196067=_0x5327d1?0x0:_0x3407d8[_0x9c00('0x1f')];var _0x4c87a4=_0x5327d1?_0x263d2b[_0x9c00('0x21')]:_0x3407d8[_0x9c00('0x1f')]+_0x3407d8[_0x9c00('0x22')];var _0x26359c;if(_0x4c87a4>=_0x3afd74){_0x4c87a4=_0x3afd74;_0x26359c=0xc8;}else{_0x26359c=0xce;}_0x4228a2['status'](_0x26359c);return _0x4228a2[_0x9c00('0x23')](_0x9c00('0x24'),_0x196067+'-'+_0x4c87a4+'/'+_0x3afd74)[_0x9c00('0x1e')](_0x263d2b);}return null;};}function patchUpdates(_0x304bcb){return function(_0x3f36e8){try{jsonpatch[_0x9c00('0x25')](_0x3f36e8,_0x304bcb,!![]);}catch(_0x5db74c){return BPromise[_0x9c00('0x26')](_0x5db74c);}return _0x3f36e8[_0x9c00('0x27')]();};}function saveUpdates(_0x554c11,_0x2ac59d){return function(_0x543e42){if(_0x543e42){return _0x543e42['update'](_0x554c11)['then'](function(_0x2be5bf){return _0x2be5bf;});}return null;};}function removeEntity(_0x1fdb35,_0xa5c763){return function(_0x495fdb){if(_0x495fdb){return _0x495fdb['destroy']()[_0x9c00('0x28')](function(){_0x1fdb35[_0x9c00('0x1d')](0xcc)[_0x9c00('0x29')]();});}};}function handleEntityNotFound(_0x5924d8,_0x469d35){return function(_0x2d3a53){if(!_0x2d3a53){_0x5924d8[_0x9c00('0x2a')](0x194);}return _0x2d3a53;};}function handleError(_0x1d9694,_0x4436a3){_0x4436a3=_0x4436a3||0x1f4;return function(_0x4ffda5){logger[_0x9c00('0x2b')](_0x4ffda5['stack']);if(_0x4ffda5[_0x9c00('0x2c')]){delete _0x4ffda5[_0x9c00('0x2c')];}_0x1d9694[_0x9c00('0x1d')](_0x4436a3)[_0x9c00('0x2d')](_0x4ffda5);};}exports['index']=function(_0x103ad2,_0x1da4f4){var _0x5f0a49={},_0x4142f6={},_0x70550c={'count':0x0,'rows':[]};var _0x4799bb=_[_0x9c00('0x2e')](db[_0x9c00('0x2f')][_0x9c00('0x30')],function(_0x2fab47){return{'name':_0x2fab47[_0x9c00('0x31')],'type':_0x2fab47['type'][_0x9c00('0x32')]};});_0x4142f6[_0x9c00('0x33')]=_[_0x9c00('0x2e')](_0x4799bb,_0x9c00('0x2c'));_0x4142f6[_0x9c00('0x34')]=_[_0x9c00('0x35')](_0x103ad2[_0x9c00('0x34')]);_0x4142f6['filters']=_[_0x9c00('0x36')](_0x4142f6['model'],_0x4142f6[_0x9c00('0x34')]);_0x5f0a49[_0x9c00('0x37')]=_[_0x9c00('0x36')](_0x4142f6[_0x9c00('0x33')],qs[_0x9c00('0x38')](_0x103ad2[_0x9c00('0x34')][_0x9c00('0x38')]));_0x5f0a49[_0x9c00('0x37')]=_0x5f0a49[_0x9c00('0x37')]['length']?_0x5f0a49[_0x9c00('0x37')]:_0x4142f6[_0x9c00('0x33')];if(!_0x103ad2[_0x9c00('0x34')][_0x9c00('0x39')](_0x9c00('0x3a'))){_0x5f0a49[_0x9c00('0x22')]=qs[_0x9c00('0x22')](_0x103ad2[_0x9c00('0x34')]['limit']);_0x5f0a49[_0x9c00('0x1f')]=qs[_0x9c00('0x1f')](_0x103ad2[_0x9c00('0x34')][_0x9c00('0x1f')]);}_0x5f0a49['order']=qs[_0x9c00('0x3b')](_0x103ad2[_0x9c00('0x34')][_0x9c00('0x3b')]);_0x5f0a49[_0x9c00('0x3c')]=qs['filters'](_[_0x9c00('0x3d')](_0x103ad2[_0x9c00('0x34')],_0x4142f6[_0x9c00('0x3e')]),_0x4799bb);if(_0x103ad2[_0x9c00('0x34')][_0x9c00('0x3f')]){_0x5f0a49[_0x9c00('0x3c')]=_[_0x9c00('0x40')](_0x5f0a49[_0x9c00('0x3c')],{'$or':_['map'](_0x4799bb,function(_0x4d72e1){if(_0x4d72e1[_0x9c00('0x41')]!=='VIRTUAL'){var _0x339b03={};_0x339b03[_0x4d72e1[_0x9c00('0x2c')]]={'$like':'%'+_0x103ad2['query'][_0x9c00('0x3f')]+'%'};return _0x339b03;}})});}_0x5f0a49=_[_0x9c00('0x40')]({},_0x5f0a49,_0x103ad2[_0x9c00('0x42')]);var _0x5a528f={'where':_0x5f0a49['where']};return db[_0x9c00('0x2f')]['count'](_0x5a528f)[_0x9c00('0x28')](function(_0x3ac418){_0x70550c['count']=_0x3ac418;if(_0x103ad2[_0x9c00('0x34')][_0x9c00('0x43')]){_0x5f0a49[_0x9c00('0x44')]=[{'all':!![]}];}return db[_0x9c00('0x2f')][_0x9c00('0x45')](_0x5f0a49);})[_0x9c00('0x28')](function(_0x1bd820){_0x70550c[_0x9c00('0x46')]=_0x1bd820;return _0x70550c;})[_0x9c00('0x28')](respondWithFilteredResult(_0x1da4f4,_0x5f0a49))[_0x9c00('0x47')](handleError(_0x1da4f4,null));};exports['show']=function(_0x40c553,_0x4aeea6){var _0x363024={'raw':!![],'where':{'id':_0x40c553['params']['id']}},_0x3f511e={};_0x3f511e[_0x9c00('0x33')]=_[_0x9c00('0x35')](db[_0x9c00('0x2f')]['rawAttributes']);_0x3f511e[_0x9c00('0x34')]=_[_0x9c00('0x35')](_0x40c553[_0x9c00('0x34')]);_0x3f511e[_0x9c00('0x3e')]=_[_0x9c00('0x36')](_0x3f511e[_0x9c00('0x33')],_0x3f511e[_0x9c00('0x34')]);_0x363024[_0x9c00('0x37')]=_[_0x9c00('0x36')](_0x3f511e[_0x9c00('0x33')],qs[_0x9c00('0x38')](_0x40c553['query'][_0x9c00('0x38')]));_0x363024[_0x9c00('0x37')]=_0x363024['attributes'][_0x9c00('0x48')]?_0x363024[_0x9c00('0x37')]:_0x3f511e['model'];if(_0x40c553[_0x9c00('0x34')]['includeAll']){_0x363024['include']=[{'all':!![]}];}_0x363024=_[_0x9c00('0x40')]({},_0x363024,_0x40c553[_0x9c00('0x42')]);return db['AnalyticTreeReport'][_0x9c00('0x49')](_0x363024)[_0x9c00('0x28')](handleEntityNotFound(_0x4aeea6,null))[_0x9c00('0x28')](respondWithResult(_0x4aeea6,null))[_0x9c00('0x47')](handleError(_0x4aeea6,null));};exports['create']=function(_0x28e8c5,_0x346a10){return db['AnalyticTreeReport'][_0x9c00('0x4a')](_0x28e8c5[_0x9c00('0x4b')],{})['then'](respondWithResult(_0x346a10,0xc9))[_0x9c00('0x47')](handleError(_0x346a10,null));};exports[_0x9c00('0x4c')]=function(_0x2b0054,_0x5fce45){if(_0x2b0054[_0x9c00('0x4b')]['id']){delete _0x2b0054[_0x9c00('0x4b')]['id'];}return db[_0x9c00('0x2f')][_0x9c00('0x49')]({'where':{'id':_0x2b0054[_0x9c00('0x4d')]['id']}})[_0x9c00('0x28')](handleEntityNotFound(_0x5fce45,null))['then'](saveUpdates(_0x2b0054[_0x9c00('0x4b')],null))[_0x9c00('0x28')](respondWithResult(_0x5fce45,null))[_0x9c00('0x47')](handleError(_0x5fce45,null));};exports[_0x9c00('0x4e')]=function(_0x52bd5c,_0x3194bf){return db[_0x9c00('0x2f')][_0x9c00('0x49')]({'where':{'id':_0x52bd5c[_0x9c00('0x4d')]['id']}})[_0x9c00('0x28')](handleEntityNotFound(_0x3194bf,null))[_0x9c00('0x28')](removeEntity(_0x3194bf,null))[_0x9c00('0x47')](handleError(_0x3194bf,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c103bc3..6308148 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 _0xc070=['exports','define','AnalyticTreeReport','analytics_report_trees','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x317a90,_0x44bc7d){var _0x12bc5d=function(_0x1d49dc){while(--_0x1d49dc){_0x317a90['push'](_0x317a90['shift']());}};_0x12bc5d(++_0x44bc7d);}(_0xc070,0xd5));var _0x0c07=function(_0x44ad85,_0xfd29b){_0x44ad85=_0x44ad85-0x0;var _0x2bba7e=_0xc070[_0x44ad85];return _0x2bba7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0c07('0x0'));var moment=require(_0x0c07('0x1'));var BPromise=require(_0x0c07('0x2'));var rp=require(_0x0c07('0x3'));var fs=require('fs');var path=require(_0x0c07('0x4'));var rimraf=require(_0x0c07('0x5'));var config=require(_0x0c07('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x0c07('0x7')]=function(_0x28f47b,_0x49fcaf){return _0x28f47b[_0x0c07('0x8')](_0x0c07('0x9'),attributes,{'tableName':_0x0c07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a17=['AnalyticTreeReport','analytics_report_trees','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x29775f,_0x4e63a1){var _0x2d8e70=function(_0x1b36a4){while(--_0x1b36a4){_0x29775f['push'](_0x29775f['shift']());}};_0x2d8e70(++_0x4e63a1);}(_0x6a17,0x86));var _0x76a1=function(_0x343144,_0x20c43d){_0x343144=_0x343144-0x0;var _0x51bd95=_0x6a17[_0x343144];return _0x51bd95;};'use strict';var _=require('lodash');var util=require(_0x76a1('0x0'));var logger=require('../../config/logger')(_0x76a1('0x1'));var moment=require(_0x76a1('0x2'));var BPromise=require(_0x76a1('0x3'));var rp=require(_0x76a1('0x4'));var fs=require('fs');var path=require(_0x76a1('0x5'));var rimraf=require(_0x76a1('0x6'));var config=require(_0x76a1('0x7'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x2c760f,_0x1c48ae){return _0x2c760f[_0x76a1('0x8')](_0x76a1('0x9'),attributes,{'tableName':_0x76a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 57b1987..b8ac54a 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4beef0,_0x3bc828){var _0x4b30b8=function(_0x3dde0f){while(--_0x3dde0f){_0x4beef0['push'](_0x4beef0['shift']());}};_0x4b30b8(++_0x3bc828);}(_0x1261,0x144));var _0x1126=function(_0x43b1fb,_0x22e01e){_0x43b1fb=_0x43b1fb-0x0;var _0x2eb5bc=_0x1261[_0x43b1fb];return _0x2eb5bc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x3cc9e5,_0x29552f){var _0x5fd2ca=function(_0x4f092c){while(--_0x4f092c){_0x3cc9e5['push'](_0x3cc9e5['shift']());}};_0x5fd2ca(++_0x29552f);}(_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});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index ff79408..8e238c8 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 _0x62a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x343ff7,_0x2b6760){var _0x227a32=function(_0x268dba){while(--_0x268dba){_0x343ff7['push'](_0x343ff7['shift']());}};_0x227a32(++_0x2b6760);}(_0x62a4,0x10c));var _0x462a=function(_0x418b39,_0x4e054e){_0x418b39=_0x418b39-0x0;var _0x4f5f6b=_0x62a4[_0x418b39];return _0x4f5f6b;};'use strict';var multer=require('multer');var util=require(_0x462a('0x0'));var path=require('path');var timeout=require(_0x462a('0x1'));var express=require(_0x462a('0x2'));var router=express[_0x462a('0x3')]();var fs_extra=require(_0x462a('0x4'));var auth=require(_0x462a('0x5'));var interaction=require(_0x462a('0x6'));var config=require(_0x462a('0x7'));var controller=require(_0x462a('0x8'));router[_0x462a('0x9')]('/',auth[_0x462a('0xa')](),controller[_0x462a('0xb')]);router['get'](_0x462a('0xc'),auth[_0x462a('0xa')](),controller[_0x462a('0xd')]);router[_0x462a('0xe')]('/',auth[_0x462a('0xa')](),controller[_0x462a('0xf')]);router[_0x462a('0x10')](_0x462a('0xc'),auth[_0x462a('0xa')](),controller[_0x462a('0x11')]);router[_0x462a('0x12')](_0x462a('0xc'),auth[_0x462a('0xa')](),controller[_0x462a('0x13')]);module[_0x462a('0x14')]=router; \ No newline at end of file +var _0x7218=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','get','post','create','put','/:id','update','destroy','multer'];(function(_0x28886f,_0x26cbed){var _0x2723f3=function(_0x15ee56){while(--_0x15ee56){_0x28886f['push'](_0x28886f['shift']());}};_0x2723f3(++_0x26cbed);}(_0x7218,0x1b9));var _0x8721=function(_0x12786a,_0x1c3b7f){_0x12786a=_0x12786a-0x0;var _0x2f7507=_0x7218[_0x12786a];return _0x2f7507;};'use strict';var multer=require(_0x8721('0x0'));var util=require(_0x8721('0x1'));var path=require(_0x8721('0x2'));var timeout=require(_0x8721('0x3'));var express=require(_0x8721('0x4'));var router=express[_0x8721('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8721('0x6'));var interaction=require(_0x8721('0x7'));var config=require('../../config/environment');var controller=require(_0x8721('0x8'));router['get']('/',auth[_0x8721('0x9')](),controller['index']);router[_0x8721('0xa')]('/:id',auth[_0x8721('0x9')](),controller['show']);router[_0x8721('0xb')]('/',auth['isAuthenticated'](),controller[_0x8721('0xc')]);router[_0x8721('0xd')](_0x8721('0xe'),auth[_0x8721('0x9')](),controller[_0x8721('0xf')]);router['delete'](_0x8721('0xe'),auth[_0x8721('0x9')](),controller[_0x8721('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e9665a3..56f7551 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 _0x87df=['exports','STRING','sequelize'];(function(_0x39be0d,_0x232ec9){var _0x26239f=function(_0x3f1ce7){while(--_0x3f1ce7){_0x39be0d['push'](_0x39be0d['shift']());}};_0x26239f(++_0x232ec9);}(_0x87df,0x167));var _0xf87d=function(_0x4796eb,_0x2f8389){_0x4796eb=_0x4796eb-0x0;var _0x1fb1a4=_0x87df[_0x4796eb];return _0x1fb1a4;};'use strict';var Sequelize=require(_0xf87d('0x0'));module[_0xf87d('0x1')]={'name':{'type':Sequelize[_0xf87d('0x2')]},'basename':{'type':Sequelize[_0xf87d('0x2')]},'type':{'type':Sequelize[_0xf87d('0x2')]}}; \ No newline at end of file +var _0x340c=['STRING','sequelize','exports'];(function(_0x1a0cb3,_0x1080cd){var _0x54ac06=function(_0x1dfddc){while(--_0x1dfddc){_0x1a0cb3['push'](_0x1a0cb3['shift']());}};_0x54ac06(++_0x1080cd);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc340('0x0'));module[_0xc340('0x1')]={'name':{'type':Sequelize[_0xc340('0x2')]},'basename':{'type':Sequelize[_0xc340('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 223ce26..db011ae 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 _0xd6c6=['includeAll','clone','rawAttributes','options','find','get','omit','createdAt','body','updatedAt','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','count','include','Attachment','rows','catch','show','params','fields'];(function(_0x510af5,_0x54a233){var _0x219705=function(_0x4de1a0){while(--_0x4de1a0){_0x510af5['push'](_0x510af5['shift']());}};_0x219705(++_0x54a233);}(_0xd6c6,0x127));var _0x6d6c=function(_0x7dc160,_0x78ef75){_0x7dc160=_0x7dc160-0x0;var _0x84c2b1=_0xd6c6[_0x7dc160];return _0x84c2b1;};'use strict';var emlformat=require(_0x6d6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d6c('0x1'));var jsonpatch=require(_0x6d6c('0x2'));var rp=require(_0x6d6c('0x3'));var moment=require(_0x6d6c('0x4'));var BPromise=require(_0x6d6c('0x5'));var Mustache=require(_0x6d6c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6d6c('0x7'));var csv=require(_0x6d6c('0x8'));var ejs=require(_0x6d6c('0x9'));var fs=require('fs');var fs_extra=require(_0x6d6c('0xa'));var _=require(_0x6d6c('0xb'));var squel=require(_0x6d6c('0xc'));var crypto=require(_0x6d6c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6d6c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d6c('0xf'));var Redis=require(_0x6d6c('0x10'));var authService=require(_0x6d6c('0x11'));var qs=require(_0x6d6c('0x12'));var as=require(_0x6d6c('0x13'));var hardwareService=require(_0x6d6c('0x14'));var logger=require(_0x6d6c('0x15'))(_0x6d6c('0x16'));var utils=require(_0x6d6c('0x17'));var config=require(_0x6d6c('0x18'));var licenseUtil=require(_0x6d6c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bce85,_0x37b1f4){_0x37b1f4=_0x37b1f4||0xcc;return function(_0x41bf46){if(_0x41bf46){return _0x4bce85[_0x6d6c('0x1a')](_0x37b1f4);}return _0x4bce85[_0x6d6c('0x1b')](_0x37b1f4)[_0x6d6c('0x1c')]();};}function respondWithResult(_0x67625a,_0xbb652b){_0xbb652b=_0xbb652b||0xc8;return function(_0xe6d980){if(_0xe6d980){return _0x67625a[_0x6d6c('0x1b')](_0xbb652b)[_0x6d6c('0x1d')](_0xe6d980);}};}function respondWithFilteredResult(_0x1c9458,_0x2af7b8){return function(_0x38cdbf){if(_0x38cdbf){var _0x240223=typeof _0x2af7b8[_0x6d6c('0x1e')]===_0x6d6c('0x1f')&&typeof _0x2af7b8['limit']===_0x6d6c('0x1f');var _0x55daa1=_0x38cdbf['count'];var _0x129f72=_0x240223?0x0:_0x2af7b8[_0x6d6c('0x1e')];var _0x46c61f=_0x240223?_0x38cdbf['count']:_0x2af7b8[_0x6d6c('0x1e')]+_0x2af7b8[_0x6d6c('0x20')];var _0x9ac121;if(_0x46c61f>=_0x55daa1){_0x46c61f=_0x55daa1;_0x9ac121=0xc8;}else{_0x9ac121=0xce;}_0x1c9458['status'](_0x9ac121);return _0x1c9458[_0x6d6c('0x21')](_0x6d6c('0x22'),_0x129f72+'-'+_0x46c61f+'/'+_0x55daa1)[_0x6d6c('0x1d')](_0x38cdbf);}return null;};}function patchUpdates(_0x6ba5b3){return function(_0x5715db){try{jsonpatch[_0x6d6c('0x23')](_0x5715db,_0x6ba5b3,!![]);}catch(_0x144575){return BPromise[_0x6d6c('0x24')](_0x144575);}return _0x5715db['save']();};}function saveUpdates(_0x3e54ca,_0x474cf7){return function(_0x593cdb){if(_0x593cdb){return _0x593cdb[_0x6d6c('0x25')](_0x3e54ca)['then'](function(_0x4b00e1){return _0x4b00e1;});}return null;};}function removeEntity(_0x123cc7,_0x36b1de){return function(_0x4921dc){if(_0x4921dc){return _0x4921dc[_0x6d6c('0x26')]()[_0x6d6c('0x27')](function(){_0x123cc7[_0x6d6c('0x1b')](0xcc)[_0x6d6c('0x1c')]();});}};}function handleEntityNotFound(_0x47f0ec,_0x391113){return function(_0x3bbf4c){if(!_0x3bbf4c){_0x47f0ec[_0x6d6c('0x1a')](0x194);}return _0x3bbf4c;};}function handleError(_0x39fd7d,_0x790230){_0x790230=_0x790230||0x1f4;return function(_0x4e3c29){logger[_0x6d6c('0x28')](_0x4e3c29[_0x6d6c('0x29')]);if(_0x4e3c29[_0x6d6c('0x2a')]){delete _0x4e3c29[_0x6d6c('0x2a')];}_0x39fd7d['status'](_0x790230)[_0x6d6c('0x2b')](_0x4e3c29);};}exports['index']=function(_0x1524d6,_0x1a20b7){var _0x31a8fb={},_0x4a2107={},_0x52c892={'count':0x0,'rows':[]};var _0x5c5e4e=_[_0x6d6c('0x2c')](db['Attachment']['rawAttributes'],function(_0x466ee3){return{'name':_0x466ee3['fieldName'],'type':_0x466ee3[_0x6d6c('0x2d')][_0x6d6c('0x2e')]};});_0x4a2107[_0x6d6c('0x2f')]=_['map'](_0x5c5e4e,_0x6d6c('0x2a'));_0x4a2107[_0x6d6c('0x30')]=_[_0x6d6c('0x31')](_0x1524d6[_0x6d6c('0x30')]);_0x4a2107[_0x6d6c('0x32')]=_[_0x6d6c('0x33')](_0x4a2107[_0x6d6c('0x2f')],_0x4a2107['query']);_0x31a8fb[_0x6d6c('0x34')]=_[_0x6d6c('0x33')](_0x4a2107[_0x6d6c('0x2f')],qs['fields'](_0x1524d6[_0x6d6c('0x30')]['fields']));_0x31a8fb[_0x6d6c('0x34')]=_0x31a8fb[_0x6d6c('0x34')][_0x6d6c('0x35')]?_0x31a8fb[_0x6d6c('0x34')]:_0x4a2107['model'];if(!_0x1524d6[_0x6d6c('0x30')][_0x6d6c('0x36')]('nolimit')){_0x31a8fb[_0x6d6c('0x20')]=qs[_0x6d6c('0x20')](_0x1524d6[_0x6d6c('0x30')]['limit']);_0x31a8fb[_0x6d6c('0x1e')]=qs[_0x6d6c('0x1e')](_0x1524d6[_0x6d6c('0x30')]['offset']);}_0x31a8fb[_0x6d6c('0x37')]=qs[_0x6d6c('0x38')](_0x1524d6[_0x6d6c('0x30')]['sort']);_0x31a8fb['where']=qs[_0x6d6c('0x32')](_[_0x6d6c('0x39')](_0x1524d6[_0x6d6c('0x30')],_0x4a2107[_0x6d6c('0x32')]),_0x5c5e4e);if(_0x1524d6[_0x6d6c('0x30')][_0x6d6c('0x3a')]){_0x31a8fb[_0x6d6c('0x3b')]=_[_0x6d6c('0x3c')](_0x31a8fb[_0x6d6c('0x3b')],{'$or':_[_0x6d6c('0x2c')](_0x5c5e4e,function(_0x10e462){if(_0x10e462['type']!=='VIRTUAL'){var _0x51d3db={};_0x51d3db[_0x10e462['name']]={'$like':'%'+_0x1524d6[_0x6d6c('0x30')][_0x6d6c('0x3a')]+'%'};return _0x51d3db;}})});}_0x31a8fb=_[_0x6d6c('0x3c')]({},_0x31a8fb,_0x1524d6['options']);var _0x31a6de={'where':_0x31a8fb[_0x6d6c('0x3b')]};return db['Attachment'][_0x6d6c('0x3d')](_0x31a6de)['then'](function(_0xef7ed0){_0x52c892['count']=_0xef7ed0;if(_0x1524d6['query']['includeAll']){_0x31a8fb[_0x6d6c('0x3e')]=[{'all':!![]}];}return db[_0x6d6c('0x3f')]['findAll'](_0x31a8fb);})[_0x6d6c('0x27')](function(_0x30424a){_0x52c892[_0x6d6c('0x40')]=_0x30424a;return _0x52c892;})[_0x6d6c('0x27')](respondWithFilteredResult(_0x1a20b7,_0x31a8fb))[_0x6d6c('0x41')](handleError(_0x1a20b7,null));};exports[_0x6d6c('0x42')]=function(_0x43aa25,_0x5dd9e2){var _0x44be16={'raw':!![],'where':{'id':_0x43aa25[_0x6d6c('0x43')]['id']}},_0x2a1551={};_0x2a1551[_0x6d6c('0x2f')]=_[_0x6d6c('0x31')](db[_0x6d6c('0x3f')]['rawAttributes']);_0x2a1551[_0x6d6c('0x30')]=_['keys'](_0x43aa25[_0x6d6c('0x30')]);_0x2a1551[_0x6d6c('0x32')]=_[_0x6d6c('0x33')](_0x2a1551[_0x6d6c('0x2f')],_0x2a1551[_0x6d6c('0x30')]);_0x44be16['attributes']=_[_0x6d6c('0x33')](_0x2a1551[_0x6d6c('0x2f')],qs['fields'](_0x43aa25[_0x6d6c('0x30')][_0x6d6c('0x44')]));_0x44be16[_0x6d6c('0x34')]=_0x44be16[_0x6d6c('0x34')][_0x6d6c('0x35')]?_0x44be16[_0x6d6c('0x34')]:_0x2a1551[_0x6d6c('0x2f')];if(_0x43aa25['query'][_0x6d6c('0x45')]){_0x44be16[_0x6d6c('0x3e')]=[{'all':!![]}];}_0x44be16=_[_0x6d6c('0x3c')]({},_0x44be16,_0x43aa25['options']);return db[_0x6d6c('0x3f')]['find'](_0x44be16)[_0x6d6c('0x27')](handleEntityNotFound(_0x5dd9e2,null))[_0x6d6c('0x27')](respondWithResult(_0x5dd9e2,null))[_0x6d6c('0x41')](handleError(_0x5dd9e2,null));};exports[_0x6d6c('0x46')]=function(_0x201a66,_0x3e7f32){var _0x3b3050={'where':{'id':_0x201a66[_0x6d6c('0x43')]['id']}},_0x3ff4dc={};_0x3ff4dc['model']=_[_0x6d6c('0x31')](db[_0x6d6c('0x3f')][_0x6d6c('0x47')]);_0x3b3050['attributes']=_[_0x6d6c('0x33')](_0x3ff4dc['model'],qs[_0x6d6c('0x44')](_0x201a66[_0x6d6c('0x30')][_0x6d6c('0x44')]));_0x3b3050[_0x6d6c('0x34')]=_0x3b3050[_0x6d6c('0x34')][_0x6d6c('0x35')]?_0x3b3050[_0x6d6c('0x34')]:_0x3ff4dc[_0x6d6c('0x2f')];if(_0x201a66['query']['includeAll']){_0x3b3050[_0x6d6c('0x3e')]=[{'all':!![]}];}_0x3b3050=_[_0x6d6c('0x3c')]({},_0x3b3050,_0x201a66[_0x6d6c('0x48')]);return db[_0x6d6c('0x3f')][_0x6d6c('0x49')](_0x3b3050)[_0x6d6c('0x27')](handleEntityNotFound(_0x3e7f32,null))['then'](function(_0x56d942){if(_0x56d942){var _0x573bbc=_0x56d942[_0x6d6c('0x4a')]({'plain':!![]});_0x573bbc=qs[_0x6d6c('0x4b')](_0x573bbc,['id',_0x6d6c('0x4c'),'updatedAt']);_0x201a66[_0x6d6c('0x4d')]=_[_0x6d6c('0x4b')](_0x201a66['body'],['id',_0x6d6c('0x4c'),_0x6d6c('0x4e')]);return db['Attachment'][_0x6d6c('0x4f')](_[_0x6d6c('0x3c')](_0x573bbc,_0x201a66[_0x6d6c('0x4d')]),{'include':_0x201a66[_0x6d6c('0x30')][_0x6d6c('0x45')]?[{'all':!![]}]:undefined});}})[_0x6d6c('0x27')](respondWithResult(_0x3e7f32,0xc9))['catch'](handleError(_0x3e7f32,null));};exports[_0x6d6c('0x25')]=function(_0x47a023,_0x3cdb7f){if(_0x47a023['body']['id']){delete _0x47a023['body']['id'];}return db[_0x6d6c('0x3f')][_0x6d6c('0x49')]({'where':{'id':_0x47a023['params']['id']}})[_0x6d6c('0x27')](handleEntityNotFound(_0x3cdb7f,null))[_0x6d6c('0x27')](saveUpdates(_0x47a023[_0x6d6c('0x4d')],null))[_0x6d6c('0x27')](respondWithResult(_0x3cdb7f,null))[_0x6d6c('0x41')](handleError(_0x3cdb7f,null));};exports[_0x6d6c('0x26')]=function(_0x4e5817,_0x3c1258){return db[_0x6d6c('0x3f')][_0x6d6c('0x49')]({'where':{'id':_0x4e5817['params']['id']}})['then'](handleEntityNotFound(_0x3c1258,null))[_0x6d6c('0x27')](removeEntity(_0x3c1258,null))['catch'](handleError(_0x3c1258,null));};exports[_0x6d6c('0x4f')]=function(_0x122ab1,_0x53d3d7,_0x10785b){_0x122ab1[_0x6d6c('0x4d')]['name']=_0x122ab1[_0x6d6c('0x50')][_0x6d6c('0x51')];_0x122ab1[_0x6d6c('0x4d')][_0x6d6c('0x52')]=_0x122ab1[_0x6d6c('0x50')][_0x6d6c('0x53')];_0x122ab1['body'][_0x6d6c('0x2d')]=_0x122ab1[_0x6d6c('0x50')][_0x6d6c('0x54')];return db[_0x6d6c('0x3f')]['create'](_0x122ab1[_0x6d6c('0x4d')])[_0x6d6c('0x27')](respondWithResult(_0x53d3d7,0xc9))['catch'](handleError(_0x53d3d7,null));};exports['download']=function(_0x506eab,_0x4b8e1a,_0x859511){return db[_0x6d6c('0x3f')][_0x6d6c('0x55')]({'where':{'id':_0x506eab[_0x6d6c('0x43')]['id']},'raw':!![]})[_0x6d6c('0x27')](handleEntityNotFound(_0x4b8e1a,null))['then'](function(_0xb0272c){if(_0xb0272c){var _0x1ad853=_0xb0272c[_0x6d6c('0x56')]!==null;var _0x14ffcc=path[_0x6d6c('0x57')](config['root'],_0x6d6c('0x58'));if(_0x1ad853){_0x14ffcc=path[_0x6d6c('0x57')](_0x14ffcc,_0x6d6c('0x59'));}var _0x289d59=path[_0x6d6c('0x57')](_0x14ffcc,_0xb0272c[_0x6d6c('0x52')]);return _0x4b8e1a[_0x6d6c('0x5a')](_0x289d59);}})[_0x6d6c('0x41')](handleError(_0x4b8e1a,null));}; \ No newline at end of file +var _0x813a=['keys','find','get','omit','createdAt','updatedAt','body','create','params','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x23e47c,_0x3fd598){var _0x534fac=function(_0x349590){while(--_0x349590){_0x23e47c['push'](_0x23e47c['shift']());}};_0x534fac(++_0x3fd598);}(_0x813a,0x71));var _0xa813=function(_0x540b6b,_0x3c2ccb){_0x540b6b=_0x540b6b-0x0;var _0x5bfa80=_0x813a[_0x540b6b];return _0x5bfa80;};'use strict';var emlformat=require(_0xa813('0x0'));var rimraf=require(_0xa813('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa813('0x2'));var rp=require(_0xa813('0x3'));var moment=require(_0xa813('0x4'));var BPromise=require(_0xa813('0x5'));var Mustache=require('mustache');var util=require(_0xa813('0x6'));var path=require(_0xa813('0x7'));var sox=require(_0xa813('0x8'));var csv=require(_0xa813('0x9'));var ejs=require(_0xa813('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa813('0xb'));var squel=require(_0xa813('0xc'));var crypto=require(_0xa813('0xd'));var jsforce=require(_0xa813('0xe'));var deskjs=require(_0xa813('0xf'));var toCsv=require(_0xa813('0x9'));var querystring=require(_0xa813('0x10'));var Papa=require(_0xa813('0x11'));var Redis=require(_0xa813('0x12'));var authService=require(_0xa813('0x13'));var qs=require(_0xa813('0x14'));var as=require(_0xa813('0x15'));var hardwareService=require(_0xa813('0x16'));var logger=require(_0xa813('0x17'))('api');var utils=require(_0xa813('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa813('0x19'))['db'];function respondWithStatusCode(_0x480315,_0x2828e5){_0x2828e5=_0x2828e5||0xcc;return function(_0xfadb3c){if(_0xfadb3c){return _0x480315[_0xa813('0x1a')](_0x2828e5);}return _0x480315[_0xa813('0x1b')](_0x2828e5)[_0xa813('0x1c')]();};}function respondWithResult(_0x3591d6,_0x363668){_0x363668=_0x363668||0xc8;return function(_0x52b87d){if(_0x52b87d){return _0x3591d6[_0xa813('0x1b')](_0x363668)['json'](_0x52b87d);}};}function respondWithFilteredResult(_0x95e817,_0x45f994){return function(_0x5aa17d){if(_0x5aa17d){var _0x35cd3c=typeof _0x45f994[_0xa813('0x1d')]===_0xa813('0x1e')&&typeof _0x45f994[_0xa813('0x1f')]===_0xa813('0x1e');var _0x5e0d7b=_0x5aa17d[_0xa813('0x20')];var _0x4a4b5e=_0x35cd3c?0x0:_0x45f994['offset'];var _0x318148=_0x35cd3c?_0x5aa17d['count']:_0x45f994[_0xa813('0x1d')]+_0x45f994[_0xa813('0x1f')];var _0x49bef4;if(_0x318148>=_0x5e0d7b){_0x318148=_0x5e0d7b;_0x49bef4=0xc8;}else{_0x49bef4=0xce;}_0x95e817[_0xa813('0x1b')](_0x49bef4);return _0x95e817['set'](_0xa813('0x21'),_0x4a4b5e+'-'+_0x318148+'/'+_0x5e0d7b)[_0xa813('0x22')](_0x5aa17d);}return null;};}function patchUpdates(_0x1bb50a){return function(_0x5b4467){try{jsonpatch[_0xa813('0x23')](_0x5b4467,_0x1bb50a,!![]);}catch(_0x50325b){return BPromise[_0xa813('0x24')](_0x50325b);}return _0x5b4467[_0xa813('0x25')]();};}function saveUpdates(_0x263e71,_0xdf9e80){return function(_0x475371){if(_0x475371){return _0x475371[_0xa813('0x26')](_0x263e71)[_0xa813('0x27')](function(_0x535915){return _0x535915;});}return null;};}function removeEntity(_0x39b3a1,_0x37fd21){return function(_0x3317a2){if(_0x3317a2){return _0x3317a2[_0xa813('0x28')]()['then'](function(){_0x39b3a1['status'](0xcc)[_0xa813('0x1c')]();});}};}function handleEntityNotFound(_0x580fca,_0x16775c){return function(_0xefc5e5){if(!_0xefc5e5){_0x580fca[_0xa813('0x1a')](0x194);}return _0xefc5e5;};}function handleError(_0x5e38c5,_0x3e37a6){_0x3e37a6=_0x3e37a6||0x1f4;return function(_0x52e814){logger[_0xa813('0x29')](_0x52e814[_0xa813('0x2a')]);if(_0x52e814[_0xa813('0x2b')]){delete _0x52e814[_0xa813('0x2b')];}_0x5e38c5['status'](_0x3e37a6)['send'](_0x52e814);};}exports[_0xa813('0x2c')]=function(_0xa205f8,_0x11b3d0){var _0x3c45f1={},_0x1ae88b={},_0x703468={'count':0x0,'rows':[]};var _0x2f017a=_[_0xa813('0x2d')](db[_0xa813('0x2e')][_0xa813('0x2f')],function(_0x292f45){return{'name':_0x292f45[_0xa813('0x30')],'type':_0x292f45[_0xa813('0x31')][_0xa813('0x32')]};});_0x1ae88b[_0xa813('0x33')]=_[_0xa813('0x2d')](_0x2f017a,_0xa813('0x2b'));_0x1ae88b[_0xa813('0x34')]=_['keys'](_0xa205f8[_0xa813('0x34')]);_0x1ae88b[_0xa813('0x35')]=_['intersection'](_0x1ae88b['model'],_0x1ae88b[_0xa813('0x34')]);_0x3c45f1['attributes']=_[_0xa813('0x36')](_0x1ae88b[_0xa813('0x33')],qs[_0xa813('0x37')](_0xa205f8[_0xa813('0x34')]['fields']));_0x3c45f1[_0xa813('0x38')]=_0x3c45f1['attributes'][_0xa813('0x39')]?_0x3c45f1[_0xa813('0x38')]:_0x1ae88b[_0xa813('0x33')];if(!_0xa205f8['query'][_0xa813('0x3a')](_0xa813('0x3b'))){_0x3c45f1[_0xa813('0x1f')]=qs['limit'](_0xa205f8[_0xa813('0x34')]['limit']);_0x3c45f1[_0xa813('0x1d')]=qs[_0xa813('0x1d')](_0xa205f8[_0xa813('0x34')][_0xa813('0x1d')]);}_0x3c45f1[_0xa813('0x3c')]=qs[_0xa813('0x3d')](_0xa205f8[_0xa813('0x34')][_0xa813('0x3d')]);_0x3c45f1[_0xa813('0x3e')]=qs[_0xa813('0x35')](_['pick'](_0xa205f8['query'],_0x1ae88b['filters']),_0x2f017a);if(_0xa205f8[_0xa813('0x34')][_0xa813('0x3f')]){_0x3c45f1[_0xa813('0x3e')]=_[_0xa813('0x40')](_0x3c45f1[_0xa813('0x3e')],{'$or':_[_0xa813('0x2d')](_0x2f017a,function(_0x32dda5){if(_0x32dda5[_0xa813('0x31')]!==_0xa813('0x41')){var _0x43d90b={};_0x43d90b[_0x32dda5[_0xa813('0x2b')]]={'$like':'%'+_0xa205f8[_0xa813('0x34')][_0xa813('0x3f')]+'%'};return _0x43d90b;}})});}_0x3c45f1=_[_0xa813('0x40')]({},_0x3c45f1,_0xa205f8[_0xa813('0x42')]);var _0x1b1a12={'where':_0x3c45f1[_0xa813('0x3e')]};return db[_0xa813('0x2e')][_0xa813('0x20')](_0x1b1a12)[_0xa813('0x27')](function(_0x22a7de){_0x703468[_0xa813('0x20')]=_0x22a7de;if(_0xa205f8[_0xa813('0x34')][_0xa813('0x43')]){_0x3c45f1[_0xa813('0x44')]=[{'all':!![]}];}return db['Attachment'][_0xa813('0x45')](_0x3c45f1);})[_0xa813('0x27')](function(_0x1d3a4f){_0x703468[_0xa813('0x46')]=_0x1d3a4f;return _0x703468;})[_0xa813('0x27')](respondWithFilteredResult(_0x11b3d0,_0x3c45f1))[_0xa813('0x47')](handleError(_0x11b3d0,null));};exports[_0xa813('0x48')]=function(_0xc348ea,_0x43140e){var _0x3e475d={'raw':!![],'where':{'id':_0xc348ea['params']['id']}},_0x587376={};_0x587376[_0xa813('0x33')]=_['keys'](db[_0xa813('0x2e')][_0xa813('0x2f')]);_0x587376[_0xa813('0x34')]=_[_0xa813('0x49')](_0xc348ea[_0xa813('0x34')]);_0x587376['filters']=_['intersection'](_0x587376['model'],_0x587376[_0xa813('0x34')]);_0x3e475d['attributes']=_[_0xa813('0x36')](_0x587376['model'],qs['fields'](_0xc348ea[_0xa813('0x34')][_0xa813('0x37')]));_0x3e475d['attributes']=_0x3e475d['attributes']['length']?_0x3e475d[_0xa813('0x38')]:_0x587376[_0xa813('0x33')];if(_0xc348ea[_0xa813('0x34')][_0xa813('0x43')]){_0x3e475d[_0xa813('0x44')]=[{'all':!![]}];}_0x3e475d=_[_0xa813('0x40')]({},_0x3e475d,_0xc348ea[_0xa813('0x42')]);return db[_0xa813('0x2e')][_0xa813('0x4a')](_0x3e475d)[_0xa813('0x27')](handleEntityNotFound(_0x43140e,null))[_0xa813('0x27')](respondWithResult(_0x43140e,null))['catch'](handleError(_0x43140e,null));};exports['clone']=function(_0x1d9a4c,_0x123438){var _0x22377a={'where':{'id':_0x1d9a4c['params']['id']}},_0x3f149c={};_0x3f149c[_0xa813('0x33')]=_[_0xa813('0x49')](db[_0xa813('0x2e')][_0xa813('0x2f')]);_0x22377a[_0xa813('0x38')]=_['intersection'](_0x3f149c[_0xa813('0x33')],qs[_0xa813('0x37')](_0x1d9a4c[_0xa813('0x34')]['fields']));_0x22377a[_0xa813('0x38')]=_0x22377a[_0xa813('0x38')][_0xa813('0x39')]?_0x22377a[_0xa813('0x38')]:_0x3f149c[_0xa813('0x33')];if(_0x1d9a4c[_0xa813('0x34')][_0xa813('0x43')]){_0x22377a['include']=[{'all':!![]}];}_0x22377a=_[_0xa813('0x40')]({},_0x22377a,_0x1d9a4c['options']);return db[_0xa813('0x2e')]['find'](_0x22377a)[_0xa813('0x27')](handleEntityNotFound(_0x123438,null))['then'](function(_0xc44fa8){if(_0xc44fa8){var _0x2e55e5=_0xc44fa8[_0xa813('0x4b')]({'plain':!![]});_0x2e55e5=qs[_0xa813('0x4c')](_0x2e55e5,['id',_0xa813('0x4d'),_0xa813('0x4e')]);_0x1d9a4c[_0xa813('0x4f')]=_[_0xa813('0x4c')](_0x1d9a4c[_0xa813('0x4f')],['id',_0xa813('0x4d'),'updatedAt']);return db[_0xa813('0x2e')][_0xa813('0x50')](_[_0xa813('0x40')](_0x2e55e5,_0x1d9a4c[_0xa813('0x4f')]),{'include':_0x1d9a4c['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x123438,0xc9))[_0xa813('0x47')](handleError(_0x123438,null));};exports[_0xa813('0x26')]=function(_0x132145,_0x505f84){if(_0x132145[_0xa813('0x4f')]['id']){delete _0x132145[_0xa813('0x4f')]['id'];}return db[_0xa813('0x2e')][_0xa813('0x4a')]({'where':{'id':_0x132145[_0xa813('0x51')]['id']}})['then'](handleEntityNotFound(_0x505f84,null))['then'](saveUpdates(_0x132145['body'],null))[_0xa813('0x27')](respondWithResult(_0x505f84,null))[_0xa813('0x47')](handleError(_0x505f84,null));};exports[_0xa813('0x28')]=function(_0x177aaf,_0xa1dc4c){return db[_0xa813('0x2e')][_0xa813('0x4a')]({'where':{'id':_0x177aaf[_0xa813('0x51')]['id']}})['then'](handleEntityNotFound(_0xa1dc4c,null))[_0xa813('0x27')](removeEntity(_0xa1dc4c,null))[_0xa813('0x47')](handleError(_0xa1dc4c,null));};exports['create']=function(_0x2c3e5b,_0x18a963,_0x1e9942){_0x2c3e5b[_0xa813('0x4f')]['name']=_0x2c3e5b[_0xa813('0x52')][_0xa813('0x53')];_0x2c3e5b[_0xa813('0x4f')][_0xa813('0x54')]=_0x2c3e5b['file'][_0xa813('0x55')];_0x2c3e5b[_0xa813('0x4f')][_0xa813('0x31')]=_0x2c3e5b[_0xa813('0x52')][_0xa813('0x56')];return db[_0xa813('0x2e')]['create'](_0x2c3e5b[_0xa813('0x4f')])['then'](respondWithResult(_0x18a963,0xc9))[_0xa813('0x47')](handleError(_0x18a963,null));};exports[_0xa813('0x57')]=function(_0x5828dc,_0x1da8e2,_0x3b139c){return db[_0xa813('0x2e')][_0xa813('0x58')]({'where':{'id':_0x5828dc[_0xa813('0x51')]['id']},'raw':!![]})[_0xa813('0x27')](handleEntityNotFound(_0x1da8e2,null))[_0xa813('0x27')](function(_0x57bc86){if(_0x57bc86){var _0x1e02b5=_0x57bc86[_0xa813('0x59')]!==null;var _0x35e53d=path[_0xa813('0x5a')](config[_0xa813('0x5b')],'server/files/attachments/');if(_0x1e02b5){_0x35e53d=path[_0xa813('0x5a')](_0x35e53d,_0xa813('0x5c'));}var _0x281d44=path['join'](_0x35e53d,_0x57bc86['basename']);return _0x1da8e2[_0xa813('0x57')](_0x281d44);}})[_0xa813('0x47')](handleError(_0x1da8e2,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c24fcc9..5812d44 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 _0x10f5=['../../config/environment','./attachment.attributes','define','attachments','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x10f5,0x100));var _0x510f=function(_0x32a350,_0x32d6a7){_0x32a350=_0x32a350-0x0;var _0x5456ae=_0x10f5[_0x32a350];return _0x5456ae;};'use strict';var _=require(_0x510f('0x0'));var util=require(_0x510f('0x1'));var logger=require(_0x510f('0x2'))(_0x510f('0x3'));var moment=require(_0x510f('0x4'));var BPromise=require(_0x510f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x510f('0x6'));var rimraf=require(_0x510f('0x7'));var config=require(_0x510f('0x8'));var attributes=require(_0x510f('0x9'));module['exports']=function(_0x3954e0,_0x3deeb6){return _0x3954e0[_0x510f('0xa')]('Attachment',attributes,{'tableName':_0x510f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x944f=['./attachment.attributes','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2ff157,_0x2c252a){var _0xe775cf=function(_0x2aebfb){while(--_0x2aebfb){_0x2ff157['push'](_0x2ff157['shift']());}};_0xe775cf(++_0x2c252a);}(_0x944f,0x184));var _0xf944=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0x944f[_0x5c7525];return _0x2e2ec8;};'use strict';var _=require(_0xf944('0x0'));var util=require(_0xf944('0x1'));var logger=require(_0xf944('0x2'))(_0xf944('0x3'));var moment=require(_0xf944('0x4'));var BPromise=require(_0xf944('0x5'));var rp=require(_0xf944('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf944('0x7'));var config=require('../../config/environment');var attributes=require(_0xf944('0x8'));module['exports']=function(_0x3925ce,_0x7a14ec){return _0x3925ce[_0xf944('0x9')](_0xf944('0xa'),attributes,{'tableName':_0xf944('0xb'),'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 fa84f11..21f137f 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 _0x80df=['catch','CreateAttachment','Attachment','create','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});}exports[_0xf80d('0x19')]=function(_0x1d104a){var _0x34b49d=this;return new Promise(function(_0x2ea2c1,_0x7ba89c){return db[_0xf80d('0x1a')][_0xf80d('0x1b')](_0x1d104a['body'],{'raw':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf80d('0xe')](function(_0x539c80){logger[_0xf80d('0xf')](_0xf80d('0x19'),_0x1d104a);logger[_0xf80d('0x12')](_0xf80d('0x19'),_0x1d104a,JSON[_0xf80d('0x14')](_0x539c80));_0x2ea2c1(_0x539c80);})[_0xf80d('0x18')](function(_0x446153){logger[_0xf80d('0x15')](_0xf80d('0x19'),_0x446153[_0xf80d('0x16')],_0x1d104a);_0x7ba89c(_0x34b49d[_0xf80d('0x15')](0x1f4,_0x446153[_0xf80d('0x16')]));});});}; \ No newline at end of file +var _0x195e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateAttachment','create','body','options','raw','then','lodash'];(function(_0x469393,_0x247969){var _0x5f720d=function(_0x40aeb3){while(--_0x40aeb3){_0x469393['push'](_0x469393['shift']());}};_0x5f720d(++_0x247969);}(_0x195e,0xfb));var _0xe195=function(_0x90be7,_0x213364){_0x90be7=_0x90be7-0x0;var _0x510d22=_0x195e[_0x90be7];return _0x510d22;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1acc,_0x663106,_0x2ead59){return new BPromise(function(_0x28c1a9,_0x3164c3){return client['request'](_0x2a1acc,_0x2ead59)['then'](function(_0x5f333b){logger[_0xe195('0xd')](_0xe195('0xe'),_0x663106,_0xe195('0xf'));logger[_0xe195('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x663106,_0xe195('0xf'),JSON[_0xe195('0x11')](_0x5f333b));if(_0x5f333b[_0xe195('0x12')]){if(_0x5f333b['error'][_0xe195('0x13')]===0x1f4){logger[_0xe195('0x12')]('Attachment,\x20%s,\x20%s',_0x663106,_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);return _0x3164c3(_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);}logger['error'](_0xe195('0xe'),_0x663106,_0x5f333b[_0xe195('0x12')]['message']);return _0x28c1a9(_0x5f333b['error'][_0xe195('0x14')]);}else{logger['info'](_0xe195('0xe'),_0x663106,'request\x20sent');_0x28c1a9(_0x5f333b['result'][_0xe195('0x14')]);}})[_0xe195('0x15')](function(_0x277362){logger[_0xe195('0x12')](_0xe195('0xe'),_0x663106,_0x277362);_0x3164c3(_0x277362);});});}exports[_0xe195('0x16')]=function(_0x4784b1){var _0x41265d=this;return new Promise(function(_0x9c8ba5,_0x25818c){return db['Attachment'][_0xe195('0x17')](_0x4784b1[_0xe195('0x18')],{'raw':_0x4784b1[_0xe195('0x19')]?_0x4784b1[_0xe195('0x19')][_0xe195('0x1a')]===undefined?!![]:![]:!![]})[_0xe195('0x1b')](function(_0x496722){logger[_0xe195('0xd')](_0xe195('0x16'),_0x4784b1);logger[_0xe195('0x10')](_0xe195('0x16'),_0x4784b1,JSON['stringify'](_0x496722));_0x9c8ba5(_0x496722);})['catch'](function(_0x4e5f13){logger[_0xe195('0x12')](_0xe195('0x16'),_0x4e5f13[_0xe195('0x14')],_0x4784b1);_0x25818c(_0x41265d[_0xe195('0x12')](0x1f4,_0x4e5f13[_0xe195('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a44d3dd..2d981aa 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x2c090c,_0x38db9f){var _0x597b3d=function(_0x4d6ab0){while(--_0x4d6ab0){_0x2c090c['push'](_0x2c090c['shift']());}};_0x597b3d(++_0x38db9f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ce96b,_0x44f094){_0x5ce96b=_0x5ce96b-0x0;var _0xbe18=_0x5f2f[_0x5ce96b];return _0xbe18;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +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(_0x1b2cfa,_0x543a6d){var _0xf3151c=function(_0x55e1a7){while(--_0x55e1a7){_0x1b2cfa['push'](_0x1b2cfa['shift']());}};_0xf3151c(++_0x543a6d);}(_0x757a,0xde));var _0xa757=function(_0x363807,_0x112ada){_0x363807=_0x363807-0x0;var _0x1b32ea=_0x757a[_0x363807];return _0x1b32ea;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index c8f0243..3188496 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 _0x989a=['moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','url','domain','authenticate','error','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','disabled','blocked','blockedAt','online','admin','user','then','name','blockDuration','add','clearBlockUser','getLicense','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','use','ad-login','User','passport','passport-local'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x989a,0x1ae));var _0xa989=function(_0x35031c,_0x400fac){_0x35031c=_0x35031c-0x0;var _0x2a7adf=_0x989a[_0x35031c];return _0x2a7adf;};'use strict';var passport=require(_0xa989('0x0'));var LocalStrategy=require(_0xa989('0x1'))['Strategy'];var moment=require(_0xa989('0x2'));var ActiveDirectory=require(_0xa989('0x3'));var BPromise=require(_0xa989('0x4'));var util=require(_0xa989('0x5'));var db=require(_0xa989('0x6'))['db'];var authService=require(_0xa989('0x7'));var utils=require(_0xa989('0x8'));var config=require(_0xa989('0x9'));var logger=require(_0xa989('0xa'))('api');function isActiveDirectoryConfigured(_0x5735be){var _0x3f39d6=![];if(typeof _0x5735be[_0xa989('0xb')]!==_0xa989('0xc')){_0x3f39d6=_0x5735be[_0xa989('0xb')]['baseDN']&&_0x5735be[_0xa989('0xb')][_0xa989('0xd')]&&_0x5735be['activedirectory'][_0xa989('0xe')];}return _0x3f39d6;}function adAuthenticate(_0xd6ebe,_0x3fa427,_0x333c82){return new BPromise(function(_0x22990b,_0x20c364){try{var _0x3c8569=new ActiveDirectory(_0xd6ebe);_0x3c8569[_0xa989('0xf')](_0x3fa427,_0x333c82,function(_0x1a409c,_0x7d75de){if(_0x1a409c){logger[_0xa989('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x3fa427,util[_0xa989('0x11')](_0x1a409c,{'showHidden':![],'depth':null}));_0x20c364('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x7d75de){logger['error'](_0xa989('0x12'),_0x3fa427);_0x20c364('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x22990b(_0x7d75de);}});}catch(_0x592cc5){_0x20c364(_0x592cc5);}});}function ActiveDirectoryAuthenticate(_0x44b408,_0x179d53,_0x44844a,_0x50be28){var _0xd3ae18,_0x13529f;if(!isActiveDirectoryConfigured(config)){logger[_0xa989('0x10')](_0xa989('0x13'),_0x179d53);return _0x50be28(null,![],{'message':_0xa989('0x14')});}return db[_0xa989('0x15')][_0xa989('0x16')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})['then'](function(_0x304a9c){_0xd3ae18=_0x304a9c;if(!_0xd3ae18['adSsoEnabled']){logger['error'](_0xa989('0x17'),_0x179d53);throw new Error(_0xa989('0x14'));}return _0x44b408[_0xa989('0x16')]({'attributes':['id','name',_0xa989('0x18'),_0xa989('0x19'),'role',_0xa989('0x1a'),_0xa989('0x1b'),_0xa989('0x1c'),_0xa989('0x1d')],'where':{'name':_0x179d53,'role':{'$or':[_0xa989('0x1e'),_0xa989('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0xa989('0x20')](function(_0x25a025){if(!_0x25a025||_0x25a025&&_0x25a025[_0xa989('0x21')]!==_0x179d53){throw new Error(_0xa989('0x14'));}_0x13529f=_0x25a025;var _0x2aedfc=_0x13529f[_0xa989('0x21')]+'@'+config[_0xa989('0xb')][_0xa989('0xe')];return adAuthenticate(config['activedirectory'],_0x2aedfc,_0x44844a);})['then'](function(_0x4bfaa1){if(_0x13529f[_0xa989('0x1a')]){throw new Error(_0xa989('0x14'));}if(_0xd3ae18[_0xa989('0x22')]>0x0){if(_0x13529f['blocked']){if(moment(_0x13529f[_0xa989('0x1c')])[_0xa989('0x23')](_0xd3ae18['blockDuration'],'minutes')>moment()){throw new Error(_0xa989('0x14'));}return utils[_0xa989('0x24')](_0x13529f,0x0,![],null)['then'](function(){return utils[_0xa989('0x25')](_0x13529f);})['then'](function(){return _0x50be28(null,_0x13529f);});}else{return utils[_0xa989('0x25')](_0x13529f)[_0xa989('0x20')](function(){return _0x50be28(null,_0x13529f);});}}else{return utils[_0xa989('0x25')](_0x13529f)[_0xa989('0x20')](function(){return _0x50be28(null,_0x13529f);});}})['catch'](function(_0x483a5b){return _0x50be28(null,![],_0x483a5b);});}function handleError(_0x21897d,_0x34a73c,_0x33fcf4){return _0x21897d[_0xa989('0x26')](_0x34a73c||0x1f4)[_0xa989('0x27')]({'message':_0x33fcf4?_0x33fcf4[_0xa989('0x28')]||_0x33fcf4:''});}exports[_0xa989('0x29')]=function(_0x1af08c,_0x2118ed,_0x506f77){passport[_0xa989('0xf')]('ad-login',function(_0x33581a,_0x2d86ac,_0x16083c){var _0x11442e=_0x33581a||_0x16083c;if(_0x11442e){return handleError(_0x2118ed,0x191,_0x11442e);}if(!_0x2d86ac){return handleError(_0x2118ed,0x194,{'message':_0xa989('0x2a')});}else{var _0x1c1b98={'payload':{'id':_0x2d86ac['id'],'role':_0x2d86ac[_0xa989('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0xa989('0x2c')](_0x1c1b98)['then'](function(_0x3b0df3){_0x2118ed['json']({'id':_0x2d86ac['id'],'token':_0x3b0df3,'statusCall':'','isAlreadyLogged':_0x2d86ac[_0xa989('0x1d')]});});}})(_0x1af08c,_0x2118ed,_0x506f77);};passport[_0xa989('0x2d')](_0xa989('0x2e'),new LocalStrategy({'usernameField':_0xa989('0x21'),'passwordField':'password'},function(_0x17bd3a,_0x2c8435,_0x1cf0b9){return ActiveDirectoryAuthenticate(db[_0xa989('0x2f')],_0x17bd3a,_0x2c8435,_0x1cf0b9);})); \ No newline at end of file +var _0xecc6=['login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','ad-login','User','passport-local','Strategy','moment','activedirectory2','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','blocked','blockedAt','online','user','agent','then','disabled','getLicense','catch','status','send','message'];(function(_0xd89ad8,_0x347fda){var _0x1be90f=function(_0xa8f0ef){while(--_0xa8f0ef){_0xd89ad8['push'](_0xd89ad8['shift']());}};_0x1be90f(++_0x347fda);}(_0xecc6,0x148));var _0x6ecc=function(_0x519d9d,_0x5cc5d0){_0x519d9d=_0x519d9d-0x0;var _0x2c0d4c=_0xecc6[_0x519d9d];return _0x2c0d4c;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x6ecc('0x0'))[_0x6ecc('0x1')];var moment=require(_0x6ecc('0x2'));var ActiveDirectory=require(_0x6ecc('0x3'));var BPromise=require('bluebird');var util=require('util');var db=require(_0x6ecc('0x4'))['db'];var authService=require(_0x6ecc('0x5'));var utils=require(_0x6ecc('0x6'));var config=require(_0x6ecc('0x7'));var logger=require(_0x6ecc('0x8'))(_0x6ecc('0x9'));function isActiveDirectoryConfigured(_0x56a5b5){var _0x450edb=![];if(typeof _0x56a5b5['activedirectory']!==_0x6ecc('0xa')){_0x450edb=_0x56a5b5[_0x6ecc('0xb')]['baseDN']&&_0x56a5b5[_0x6ecc('0xb')][_0x6ecc('0xc')]&&_0x56a5b5[_0x6ecc('0xb')]['domain'];}return _0x450edb;}function adAuthenticate(_0x378c34,_0x59f2db,_0xcedc8f){return new BPromise(function(_0x18c8b1,_0x3082ec){try{var _0x2cb8b3=new ActiveDirectory(_0x378c34);_0x2cb8b3[_0x6ecc('0xd')](_0x59f2db,_0xcedc8f,function(_0x16a124,_0x142ea9){if(_0x16a124){logger[_0x6ecc('0xe')](_0x6ecc('0xf'),_0x59f2db,util[_0x6ecc('0x10')](_0x16a124,{'showHidden':![],'depth':null}));_0x3082ec('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x142ea9){logger[_0x6ecc('0xe')](_0x6ecc('0x11'),_0x59f2db);_0x3082ec(_0x6ecc('0x12'));}else{_0x18c8b1(_0x142ea9);}});}catch(_0xf8d071){_0x3082ec(_0xf8d071);}});}function ActiveDirectoryAuthenticate(_0x4af7d9,_0x16e519,_0x4e106c,_0x332753){var _0x5cd5ab,_0x50590a;if(!isActiveDirectoryConfigured(config)){logger[_0x6ecc('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x16e519);return _0x332753(null,![],{'message':_0x6ecc('0x12')});}return db[_0x6ecc('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x6ecc('0x14'),_0x6ecc('0x15')],'raw':!![]})['then'](function(_0x1cbdba){_0x5cd5ab=_0x1cbdba;if(!_0x5cd5ab['adSsoEnabled']){logger[_0x6ecc('0xe')](_0x6ecc('0x16'),_0x16e519);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x4af7d9[_0x6ecc('0x17')]({'attributes':['id',_0x6ecc('0x18'),_0x6ecc('0x19'),_0x6ecc('0x1a'),_0x6ecc('0x1b'),'disabled',_0x6ecc('0x1c'),_0x6ecc('0x1d'),_0x6ecc('0x1e')],'where':{'name':_0x16e519,'role':{'$or':['admin',_0x6ecc('0x1f'),_0x6ecc('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x5d86c1){if(!_0x5d86c1||_0x5d86c1&&_0x5d86c1[_0x6ecc('0x18')]!==_0x16e519){throw new Error(_0x6ecc('0x12'));}_0x50590a=_0x5d86c1;var _0x4fa737=_0x50590a[_0x6ecc('0x18')]+'@'+config[_0x6ecc('0xb')]['domain'];return adAuthenticate(config[_0x6ecc('0xb')],_0x4fa737,_0x4e106c);})[_0x6ecc('0x21')](function(_0x49c31a){if(_0x50590a[_0x6ecc('0x22')]){throw new Error(_0x6ecc('0x12'));}if(_0x5cd5ab['blockDuration']>0x0){if(_0x50590a['blocked']){if(moment(_0x50590a[_0x6ecc('0x1d')])['add'](_0x5cd5ab[_0x6ecc('0x15')],'minutes')>moment()){throw new Error(_0x6ecc('0x12'));}return utils['clearBlockUser'](_0x50590a,0x0,![],null)['then'](function(){return utils[_0x6ecc('0x23')](_0x50590a);})[_0x6ecc('0x21')](function(){return _0x332753(null,_0x50590a);});}else{return utils[_0x6ecc('0x23')](_0x50590a)[_0x6ecc('0x21')](function(){return _0x332753(null,_0x50590a);});}}else{return utils[_0x6ecc('0x23')](_0x50590a)[_0x6ecc('0x21')](function(){return _0x332753(null,_0x50590a);});}})[_0x6ecc('0x24')](function(_0x1042f9){return _0x332753(null,![],_0x1042f9);});}function handleError(_0x199a66,_0x151c2c,_0x1ec429){return _0x199a66[_0x6ecc('0x25')](_0x151c2c||0x1f4)[_0x6ecc('0x26')]({'message':_0x1ec429?_0x1ec429[_0x6ecc('0x27')]||_0x1ec429:''});}exports[_0x6ecc('0x28')]=function(_0x234689,_0x2d4be4,_0x4104e5){passport[_0x6ecc('0xd')]('ad-login',function(_0x4a86dc,_0x5da8e0,_0x299609){var _0x3a4fa7=_0x4a86dc||_0x299609;if(_0x3a4fa7){return handleError(_0x2d4be4,0x191,_0x3a4fa7);}if(!_0x5da8e0){return handleError(_0x2d4be4,0x194,{'message':_0x6ecc('0x29')});}else{var _0x4b0d15={'payload':{'id':_0x5da8e0['id'],'role':_0x5da8e0[_0x6ecc('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x6ecc('0x2a')](_0x4b0d15)[_0x6ecc('0x21')](function(_0x47fd22){_0x2d4be4[_0x6ecc('0x2b')]({'id':_0x5da8e0['id'],'token':_0x47fd22,'statusCall':'','isAlreadyLogged':_0x5da8e0[_0x6ecc('0x1e')]});});}})(_0x234689,_0x2d4be4,_0x4104e5);};passport['use'](_0x6ecc('0x2c'),new LocalStrategy({'usernameField':_0x6ecc('0x18'),'passwordField':'password'},function(_0x309afe,_0x304d1b,_0x3ce0cf){return ActiveDirectoryAuthenticate(db[_0x6ecc('0x2d')],_0x309afe,_0x304d1b,_0x3ce0cf);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3eb0c68..059f803 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 _0xb9d8=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x1fea7a,_0x40a9d2){var _0x5f8e8c=function(_0x4eecfb){while(--_0x4eecfb){_0x1fea7a['push'](_0x1fea7a['shift']());}};_0x5f8e8c(++_0x40a9d2);}(_0xb9d8,0x1c4));var _0x8b9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9d8[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x8b9d('0x0'));var router=express[_0x8b9d('0x1')]();var controller=require(_0x8b9d('0x2'));router[_0x8b9d('0x3')]('/',controller[_0x8b9d('0x4')]);module[_0x8b9d('0x5')]=router; \ No newline at end of file +var _0x7f92=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7f92,0x1f1));var _0x27f9=function(_0x1bd406,_0x3760bf){_0x1bd406=_0x1bd406-0x0;var _0x4a1ce4=_0x7f92[_0x1bd406];return _0x4a1ce4;};'use strict';var express=require(_0x27f9('0x0'));var router=express[_0x27f9('0x1')]();var controller=require(_0x27f9('0x2'));router['post']('/',controller[_0x27f9('0x3')]);module[_0x27f9('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f797f6d..9bfe32d 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x4e14b8,_0x1400ca){var _0x1b4e0a=function(_0x1607fe){while(--_0x1607fe){_0x4e14b8['push'](_0x4e14b8['shift']());}};_0x1b4e0a(++_0x1400ca);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7a54,0x106));var _0x47a5=function(_0x120cc3,_0xf43e10){_0x120cc3=_0x120cc3-0x0;var _0x456157=_0x7a54[_0x120cc3];return _0x456157;};'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 cf3772d..6c994b8 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 _0x460d=['../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller'];(function(_0x36a4c6,_0x20099e){var _0x600ba0=function(_0x5d8ac6){while(--_0x5d8ac6){_0x36a4c6['push'](_0x36a4c6['shift']());}};_0x600ba0(++_0x20099e);}(_0x460d,0x13d));var _0xd460=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x460d[_0x1ed116];return _0x574066;};'use strict';var express=require('express');var passport=require(_0xd460('0x0'));var router=express[_0xd460('0x1')]();var controller=require(_0xd460('0x2'));var userController=require(_0xd460('0x3'));var authService=require(_0xd460('0x4'));router[_0xd460('0x5')]('/',controller[_0xd460('0x6')]);router[_0xd460('0x5')](_0xd460('0x7'),controller['callback'],authService[_0xd460('0x8')],userController['login'],authService[_0xd460('0x9')]);module['exports']=router; \ No newline at end of file +var _0x3936=['../user/user.controller.js','get','login','/callback','callback','exports','express','Router','./authGoogle.controller'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x3936,0x1ec));var _0x6393=function(_0x548e64,_0x29e562){_0x548e64=_0x548e64-0x0;var _0x47d34e=_0x3936[_0x548e64];return _0x47d34e;};'use strict';var express=require(_0x6393('0x0'));var passport=require('passport');var router=express[_0x6393('0x1')]();var controller=require(_0x6393('0x2'));var userController=require(_0x6393('0x3'));var authService=require('../../components/auth/service');router[_0x6393('0x4')]('/',controller[_0x6393('0x5')]);router[_0x6393('0x4')](_0x6393('0x6'),controller[_0x6393('0x7')],authService['isMiddleware'],userController[_0x6393('0x5')],authService['setTokenCookie']);module[_0x6393('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index ece9a70..383db8d 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 _0x1384=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','util','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','clearBlockUser','getLicense','catch','MailAccount','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes'];(function(_0x210451,_0x1c9949){var _0xbccbe0=function(_0x41be90){while(--_0x41be90){_0x210451['push'](_0x210451['shift']());}};_0xbccbe0(++_0x1c9949);}(_0x1384,0x1f2));var _0x4138=function(_0x57030e,_0x1b9833){_0x57030e=_0x57030e-0x0;var _0x53979a=_0x1384[_0x57030e];return _0x53979a;};'use strict';var util=require(_0x4138('0x0'));var passport=require('passport');var LocalStrategy=require(_0x4138('0x1'))[_0x4138('0x2')];var jayson=require(_0x4138('0x3'));var _=require(_0x4138('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x4138('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x4138('0x6'));var client=jayson[_0x4138('0x7')][_0x4138('0x8')]({'port':0x232b});function localAuthenticate(_0x3f09d,_0x121e29,_0x42acb0,_0x3ead99){var _0x4907e6,_0x426759;return db[_0x4138('0x9')][_0x4138('0xa')]({'where':{'id':0x1},'attributes':[_0x4138('0xb'),'blockDuration'],'raw':!![]})[_0x4138('0xc')](function(_0x49488f){_0x4907e6=_0x49488f;return _0x3f09d[_0x4138('0xa')]({'attributes':['id',_0x4138('0xd'),_0x4138('0xe'),_0x4138('0xf'),_0x4138('0x10'),_0x4138('0x11'),_0x4138('0x12'),'blockedAt',_0x4138('0x13')],'where':{'name':_0x121e29,'role':{'$or':[_0x4138('0x14'),_0x4138('0x15'),_0x4138('0x16')]}}});})[_0x4138('0xc')](function(_0x434cae){if(!_0x434cae||_0x434cae&&_0x434cae[_0x4138('0xd')]!==_0x121e29){throw new Error(_0x4138('0x17'));}else{_0x426759=_0x434cae;return _0x426759;}})[_0x4138('0xc')](function(){_0x426759[_0x4138('0x18')](_0x42acb0,function(_0x54741e,_0x2f4e16){var _0x347cd0=_0x426759['loginAttempts']+0x1;if(_0x54741e){return _0x3ead99(_0x54741e);}else if(!_0x2f4e16){if(_0x426759['disabled']){return _0x3ead99(null,![],{'message':_0x4138('0x17')});}else if(_0x4907e6[_0x4138('0xb')]>0x0){if(_0x426759['blocked']){if(_0x4907e6[_0x4138('0x19')]>0x0){if(moment(_0x426759[_0x4138('0x1a')])[_0x4138('0x1b')](_0x4907e6[_0x4138('0x19')],'minutes')>moment()){return _0x3ead99(null,![],{'message':_0x4138('0x17')});}else{return utils[_0x4138('0x1c')](_0x426759,_0x347cd0,![],null)[_0x4138('0xc')](function(){return _0x3ead99(null,![],{'message':_0x4138('0x17')});});}}else{return _0x3ead99(null,![],{'message':_0x4138('0x17')});}}else{if(_0x347cd0>=_0x4907e6[_0x4138('0xb')]){return utils[_0x4138('0x1c')](_0x426759,0x0,!![],moment())[_0x4138('0xc')](function(){return _0x3ead99(null,![],{'message':_0x4138('0x17')});});}else{return utils[_0x4138('0x1c')](_0x426759,_0x347cd0,![],null)['then'](function(){return _0x3ead99(null,![],{'message':_0x4138('0x17')});});}}}else{return _0x3ead99(null,![],{'message':_0x4138('0x17')});}}else{if(_0x426759['disabled']){return _0x3ead99(null,![],{'message':_0x4138('0x17')});}else if(_0x4907e6['allowedLoginAttempts']>0x0){if(_0x426759[_0x4138('0x12')]){if(_0x4907e6[_0x4138('0x19')]>0x0){if(moment(_0x426759[_0x4138('0x1a')])[_0x4138('0x1b')](_0x4907e6[_0x4138('0x19')],'minutes')>moment()){return _0x3ead99(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4138('0x1c')](_0x426759,0x0,![],null)[_0x4138('0xc')](function(){return utils['getLicense'](_0x426759);})[_0x4138('0xc')](function(){return _0x3ead99(null,_0x426759);});}}else{return _0x3ead99(null,![],{'message':_0x4138('0x17')});}}else{return utils[_0x4138('0x1c')](_0x426759,0x0,![],null)['then'](function(){return utils[_0x4138('0x1d')](_0x426759);})[_0x4138('0xc')](function(){return _0x3ead99(null,_0x426759);})[_0x4138('0x1e')](function(_0x1877f9){return _0x3ead99(null,![],_0x1877f9);});}}else{if(_0x426759[_0x4138('0x12')]){return _0x3ead99(null,![],{'message':_0x4138('0x17')});}else{return utils[_0x4138('0x1d')](_0x426759)[_0x4138('0xc')](function(){return _0x3ead99(null,_0x426759);});}}}});})[_0x4138('0x1e')](function(_0x2ae1e0){return _0x3ead99(null,![],_0x2ae1e0);});}function sendServiceMail(_0x2abbf9){return db[_0x4138('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x4138('0xd'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x4138('0x20')],'as':_0x4138('0x20')}]}]})['then'](function(_0x146f77){if(!_0x146f77){throw new Error(_0x4138('0x21'));}var _0x133977=_0x146f77[_0x4138('0x22')]();var _0x1ce2f1={'account':_0x133977,'message':_[_0x4138('0x23')]({'from':util[_0x4138('0x24')](_0x4138('0x25'),_0x146f77[_0x4138('0xd')],_0x146f77[_0x4138('0x26')]||_0x146f77[_0x4138('0x27')]['user'])},_0x2abbf9)};return client[_0x4138('0x28')](_0x4138('0x29'),_0x1ce2f1);})[_0x4138('0xc')](function(_0x4db444){if(_0x4db444[_0x4138('0x2a')]){throw new Error(util[_0x4138('0x24')](_0x4138('0x2b'),_0x4db444[_0x4138('0x2a')][_0x4138('0x2c')]||JSON['stringify'](_0x4db444[_0x4138('0x2a')])));}return!![];});}function handleError(_0x4d0724,_0x2f79f8,_0x5d4ea7){return _0x4d0724[_0x4138('0x2d')](_0x2f79f8||0x1f4)['send']({'message':_0x5d4ea7?_0x5d4ea7[_0x4138('0x2c')]||_0x5d4ea7:''});}exports[_0x4138('0x2e')]=function(_0x14ae76,_0x2babc0,_0xa58f7c){passport[_0x4138('0x18')](_0x4138('0x2f'),function(_0x446713,_0x33b2cc,_0x3a9628){var _0x59a764=_0x446713||_0x3a9628;if(_0x59a764){return handleError(_0x2babc0,0x191,_0x59a764);}if(!_0x33b2cc){return handleError(_0x2babc0,0x194,{'message':_0x4138('0x30')});}else{var _0x2d3ddc={'payload':{'id':_0x33b2cc['id'],'role':_0x33b2cc[_0x4138('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x4138('0x31')](_0x2d3ddc)[_0x4138('0xc')](function(_0x11488b){_0x2babc0['json']({'id':_0x33b2cc['id'],'token':_0x11488b,'statusCall':'','isAlreadyLogged':_0x33b2cc[_0x4138('0x32')]});});}})(_0x14ae76,_0x2babc0,_0xa58f7c);};exports[_0x4138('0x33')]=function(_0x4c8fe4,_0xbdf6ba){if(!_0x4c8fe4[_0x4138('0x34')][_0x4138('0x26')]){return handleError(_0xbdf6ba,0x1f4,{'message':_0x4138('0x35')});}var _0x247ad8=rs[_0x4138('0x36')]();_0x4c8fe4[_0x4138('0x34')][_0x4138('0x26')]=_0x4c8fe4[_0x4138('0x34')][_0x4138('0x26')][_0x4138('0x37')]()[_0x4138('0x38')]();var _0x505270;return db[_0x4138('0x9')][_0x4138('0xa')]({'where':{'id':0x1},'attributes':[_0x4138('0xb'),_0x4138('0x19')],'raw':!![]})[_0x4138('0xc')](function(_0x26e8d6){_0x505270=_0x26e8d6;return db[_0x4138('0x39')][_0x4138('0x3a')]({'where':{'email':_0x4c8fe4['body'][_0x4138('0x26')]}});})[_0x4138('0xc')](function(_0x2a28b5){if(!_0x2a28b5){throw new Error(_0x4138('0x3b'));}if(_0x2a28b5[_0x4138('0x11')]){throw new Error(_0x4138('0x3c'));}if(_0x2a28b5[_0x4138('0x12')]){if(moment(_0x2a28b5['blockedAt'])[_0x4138('0x1b')](_0x505270[_0x4138('0x19')],_0x4138('0x3d'))>moment()){throw new Error(_0x4138('0x3e'));}else{_0x2a28b5['blocked']=![];_0x2a28b5[_0x4138('0x1a')]=null;}}_0x2a28b5[_0x4138('0x3f')]=_0x247ad8;_0x2a28b5['resetPasswordExpires']=Date[_0x4138('0x40')]()+0x36ee80;return _0x2a28b5[_0x4138('0x41')]();})[_0x4138('0xc')](function(){return sendServiceMail({'to':_0x4c8fe4[_0x4138('0x34')]['email'],'subject':_0x4138('0x42'),'text':_0x4138('0x43')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x4c8fe4[_0x4138('0x44')][_0x4138('0x45')]+_0x4138('0x46')+_0x247ad8+'\x0a\x0a'+_0x4138('0x47')});})[_0x4138('0xc')](function(){_0xbdf6ba['status'](0xc8)['send']({'message':_0x4138('0x48')});})[_0x4138('0x1e')](function(_0x160d8c){return handleError(_0xbdf6ba,0x1f4,_0x160d8c);});};exports[_0x4138('0x49')]=function(_0x3ae2ae,_0x47cd28){return db['User'][_0x4138('0x3a')]({'where':{'resetPasswordToken':_0x3ae2ae['params'][_0x4138('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x4138('0xc')](function(_0x53deb1){if(!_0x53deb1){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x4138('0x9')][_0x4138('0xa')]({'attributes':['id',_0x4138('0x4b'),_0x4138('0x4c'),_0x4138('0x4d')]})[_0x4138('0xc')](function(_0x34c6a4){if(_0x34c6a4[_0x4138('0x4b')])authService['validatePasswordPattern'](_0x3ae2ae[_0x4138('0x34')]['password']);if(!_0x34c6a4[_0x4138('0x4c')]||!_0x53deb1[_0x4138('0x4e')])return _0x53deb1;authService[_0x4138('0x4f')](_0x3ae2ae[_0x4138('0x34')][_0x4138('0xe')],_0x53deb1[_0x4138('0x4e')],_0x34c6a4['passwordHistoryLimit']);return _0x53deb1;})[_0x4138('0xc')](function(){_0x53deb1['password']=_0x3ae2ae[_0x4138('0x34')][_0x4138('0xe')];_0x53deb1['resetPasswordToken']=null;_0x53deb1['resetPasswordExpires']=null;return _0x53deb1[_0x4138('0x41')]();});})['then'](function(){_0x47cd28[_0x4138('0x2d')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x4138('0x1e')](function(_0x29c896){return handleError(_0x47cd28,0x1f4,_0x29c896);});};passport['use'](_0x4138('0x2f'),new LocalStrategy({'usernameField':_0x4138('0xd'),'passwordField':'password'},function(_0x4cab4e,_0x3d6bbf,_0x13ab3a){return localAuthenticate(db['User'],_0x4cab4e,_0x3d6bbf,_0x13ab3a);})); \ No newline at end of file +var _0xc1de=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','Password\x20reset!','util','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','MailServerOut','CloudProvider','getSmtpOptions','merge','format','email','SendMail','message','stringify','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x443533,_0x523dff){var _0x5b664b=function(_0x407d06){while(--_0x407d06){_0x443533['push'](_0x443533['shift']());}};_0x5b664b(++_0x523dff);}(_0xc1de,0x148));var _0xec1d=function(_0x469bae,_0x492367){_0x469bae=_0x469bae-0x0;var _0x2285bd=_0xc1de[_0x469bae];return _0x2285bd;};'use strict';var util=require(_0xec1d('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xec1d('0x1')];var jayson=require(_0xec1d('0x2'));var _=require(_0xec1d('0x3'));var rs=require(_0xec1d('0x4'));var moment=require(_0xec1d('0x5'));var db=require(_0xec1d('0x6'))['db'];var authService=require(_0xec1d('0x7'));var utils=require(_0xec1d('0x8'));var client=jayson[_0xec1d('0x9')][_0xec1d('0xa')]({'port':0x232b});function localAuthenticate(_0x1cd228,_0x4a73b2,_0x17f996,_0x449ed3){var _0x3e01bc,_0x1a0894;return db[_0xec1d('0xb')][_0xec1d('0xc')]({'where':{'id':0x1},'attributes':[_0xec1d('0xd'),'blockDuration'],'raw':!![]})[_0xec1d('0xe')](function(_0x4b10e1){_0x3e01bc=_0x4b10e1;return _0x1cd228[_0xec1d('0xc')]({'attributes':['id',_0xec1d('0xf'),_0xec1d('0x10'),_0xec1d('0x11'),_0xec1d('0x12'),'disabled',_0xec1d('0x13'),_0xec1d('0x14'),_0xec1d('0x15')],'where':{'name':_0x4a73b2,'role':{'$or':[_0xec1d('0x16'),_0xec1d('0x17'),_0xec1d('0x18')]}}});})[_0xec1d('0xe')](function(_0x4cf0b6){if(!_0x4cf0b6||_0x4cf0b6&&_0x4cf0b6[_0xec1d('0xf')]!==_0x4a73b2){throw new Error(_0xec1d('0x19'));}else{_0x1a0894=_0x4cf0b6;return _0x1a0894;}})[_0xec1d('0xe')](function(){_0x1a0894[_0xec1d('0x1a')](_0x17f996,function(_0x577dcc,_0x5c7a51){var _0x244ce0=_0x1a0894[_0xec1d('0x15')]+0x1;if(_0x577dcc){return _0x449ed3(_0x577dcc);}else if(!_0x5c7a51){if(_0x1a0894['disabled']){return _0x449ed3(null,![],{'message':_0xec1d('0x19')});}else if(_0x3e01bc[_0xec1d('0xd')]>0x0){if(_0x1a0894[_0xec1d('0x13')]){if(_0x3e01bc[_0xec1d('0x1b')]>0x0){if(moment(_0x1a0894[_0xec1d('0x14')])[_0xec1d('0x1c')](_0x3e01bc[_0xec1d('0x1b')],_0xec1d('0x1d'))>moment()){return _0x449ed3(null,![],{'message':_0xec1d('0x19')});}else{return utils['clearBlockUser'](_0x1a0894,_0x244ce0,![],null)[_0xec1d('0xe')](function(){return _0x449ed3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x449ed3(null,![],{'message':_0xec1d('0x19')});}}else{if(_0x244ce0>=_0x3e01bc[_0xec1d('0xd')]){return utils[_0xec1d('0x1e')](_0x1a0894,0x0,!![],moment())[_0xec1d('0xe')](function(){return _0x449ed3(null,![],{'message':_0xec1d('0x19')});});}else{return utils[_0xec1d('0x1e')](_0x1a0894,_0x244ce0,![],null)[_0xec1d('0xe')](function(){return _0x449ed3(null,![],{'message':_0xec1d('0x19')});});}}}else{return _0x449ed3(null,![],{'message':_0xec1d('0x19')});}}else{if(_0x1a0894[_0xec1d('0x1f')]){return _0x449ed3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3e01bc[_0xec1d('0xd')]>0x0){if(_0x1a0894[_0xec1d('0x13')]){if(_0x3e01bc[_0xec1d('0x1b')]>0x0){if(moment(_0x1a0894['blockedAt'])[_0xec1d('0x1c')](_0x3e01bc[_0xec1d('0x1b')],_0xec1d('0x1d'))>moment()){return _0x449ed3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xec1d('0x1e')](_0x1a0894,0x0,![],null)[_0xec1d('0xe')](function(){return utils[_0xec1d('0x20')](_0x1a0894);})[_0xec1d('0xe')](function(){return _0x449ed3(null,_0x1a0894);});}}else{return _0x449ed3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x1a0894,0x0,![],null)[_0xec1d('0xe')](function(){return utils['getLicense'](_0x1a0894);})['then'](function(){return _0x449ed3(null,_0x1a0894);})[_0xec1d('0x21')](function(_0x35dcaa){return _0x449ed3(null,![],_0x35dcaa);});}}else{if(_0x1a0894[_0xec1d('0x13')]){return _0x449ed3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xec1d('0x20')](_0x1a0894)[_0xec1d('0xe')](function(){return _0x449ed3(null,_0x1a0894);});}}}});})[_0xec1d('0x21')](function(_0x4fba7c){return _0x449ed3(null,![],_0x4fba7c);});}function sendServiceMail(_0x47ac1f){return db[_0xec1d('0x22')][_0xec1d('0x23')]({'where':{'service':!![]},'attributes':['id',_0xec1d('0xf'),'email'],'include':[{'model':db[_0xec1d('0x24')],'as':'Smtp','include':[{'model':db[_0xec1d('0x25')],'as':_0xec1d('0x25')}]}]})[_0xec1d('0xe')](function(_0x4840a6){if(!_0x4840a6){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x372997=_0x4840a6[_0xec1d('0x26')]();var _0x3afbf7={'account':_0x372997,'message':_[_0xec1d('0x27')]({'from':util[_0xec1d('0x28')]('\x22%s\x22\x20<%s>',_0x4840a6['name'],_0x4840a6[_0xec1d('0x29')]||_0x4840a6['Smtp']['user'])},_0x47ac1f)};return client['request'](_0xec1d('0x2a'),_0x3afbf7);})[_0xec1d('0xe')](function(_0x3f90f3){if(_0x3f90f3['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3f90f3['error'][_0xec1d('0x2b')]||JSON[_0xec1d('0x2c')](_0x3f90f3['error'])));}return!![];});}function handleError(_0x5cb9b4,_0x389a68,_0x156c63){return _0x5cb9b4['status'](_0x389a68||0x1f4)[_0xec1d('0x2d')]({'message':_0x156c63?_0x156c63[_0xec1d('0x2b')]||_0x156c63:''});}exports['login']=function(_0x4f7b78,_0x3ad5f8,_0x300f9a){passport[_0xec1d('0x1a')](_0xec1d('0x2e'),function(_0x47e994,_0x13792b,_0x4a2786){var _0x4420d3=_0x47e994||_0x4a2786;if(_0x4420d3){return handleError(_0x3ad5f8,0x191,_0x4420d3);}if(!_0x13792b){return handleError(_0x3ad5f8,0x194,{'message':_0xec1d('0x2f')});}else{var _0x4f96a6={'payload':{'id':_0x13792b['id'],'role':_0x13792b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4f96a6)[_0xec1d('0xe')](function(_0x60242c){_0x3ad5f8[_0xec1d('0x30')]({'id':_0x13792b['id'],'token':_0x60242c,'statusCall':'','isAlreadyLogged':_0x13792b[_0xec1d('0x31')]});});}})(_0x4f7b78,_0x3ad5f8,_0x300f9a);};exports[_0xec1d('0x32')]=function(_0x5029a5,_0x56914b){if(!_0x5029a5[_0xec1d('0x33')]['email']){return handleError(_0x56914b,0x1f4,{'message':_0xec1d('0x34')});}var _0x21a127=rs[_0xec1d('0x35')]();_0x5029a5[_0xec1d('0x33')][_0xec1d('0x29')]=_0x5029a5[_0xec1d('0x33')][_0xec1d('0x29')][_0xec1d('0x36')]()['toLowerCase']();var _0x340774;return db['Setting'][_0xec1d('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xec1d('0x1b')],'raw':!![]})['then'](function(_0x56fc95){_0x340774=_0x56fc95;return db[_0xec1d('0x37')][_0xec1d('0x23')]({'where':{'email':_0x5029a5[_0xec1d('0x33')][_0xec1d('0x29')]}});})[_0xec1d('0xe')](function(_0x56da49){if(!_0x56da49){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x56da49[_0xec1d('0x1f')]){throw new Error(_0xec1d('0x38'));}if(_0x56da49['blocked']){if(moment(_0x56da49[_0xec1d('0x14')])[_0xec1d('0x1c')](_0x340774[_0xec1d('0x1b')],_0xec1d('0x1d'))>moment()){throw new Error(_0xec1d('0x39'));}else{_0x56da49['blocked']=![];_0x56da49[_0xec1d('0x14')]=null;}}_0x56da49[_0xec1d('0x3a')]=_0x21a127;_0x56da49[_0xec1d('0x3b')]=Date[_0xec1d('0x3c')]()+0x36ee80;return _0x56da49[_0xec1d('0x3d')]();})['then'](function(){return sendServiceMail({'to':_0x5029a5[_0xec1d('0x33')][_0xec1d('0x29')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xec1d('0x3e')+_0xec1d('0x3f')+_0xec1d('0x40')+_0x5029a5['headers']['host']+_0xec1d('0x41')+_0x21a127+'\x0a\x0a'+_0xec1d('0x42')});})[_0xec1d('0xe')](function(){_0x56914b[_0xec1d('0x43')](0xc8)['send']({'message':_0xec1d('0x44')});})[_0xec1d('0x21')](function(_0x1ddc15){return handleError(_0x56914b,0x1f4,_0x1ddc15);});};exports['reset']=function(_0x8afe91,_0x2e8221){return db[_0xec1d('0x37')]['find']({'where':{'resetPasswordToken':_0x8afe91[_0xec1d('0x45')][_0xec1d('0x46')],'resetPasswordExpires':{'$gt':Date[_0xec1d('0x3c')]()}}})['then'](function(_0x37aa4e){if(!_0x37aa4e){throw new Error(_0xec1d('0x47'));}return db[_0xec1d('0xb')][_0xec1d('0xc')]({'attributes':['id',_0xec1d('0x48'),_0xec1d('0x49'),_0xec1d('0x4a')]})[_0xec1d('0xe')](function(_0x5c7b47){if(_0x5c7b47[_0xec1d('0x48')])authService['validatePasswordPattern'](_0x8afe91[_0xec1d('0x33')][_0xec1d('0x10')]);if(!_0x5c7b47[_0xec1d('0x49')]||!_0x37aa4e['previousPasswords'])return _0x37aa4e;authService['validatePasswordHistory'](_0x8afe91[_0xec1d('0x33')][_0xec1d('0x10')],_0x37aa4e[_0xec1d('0x4b')],_0x5c7b47['passwordHistoryLimit']);return _0x37aa4e;})[_0xec1d('0xe')](function(){_0x37aa4e[_0xec1d('0x10')]=_0x8afe91[_0xec1d('0x33')][_0xec1d('0x10')];_0x37aa4e[_0xec1d('0x3a')]=null;_0x37aa4e['resetPasswordExpires']=null;return _0x37aa4e[_0xec1d('0x3d')]();});})['then'](function(){_0x2e8221[_0xec1d('0x43')](0xc8)[_0xec1d('0x2d')]({'message':_0xec1d('0x4c')});})[_0xec1d('0x21')](function(_0x3a1db0){return handleError(_0x2e8221,0x1f4,_0x3a1db0);});};passport['use'](_0xec1d('0x2e'),new LocalStrategy({'usernameField':_0xec1d('0xf'),'passwordField':'password'},function(_0x3bc3cb,_0x118ee0,_0x1f30f7){return localAuthenticate(db['User'],_0x3bc3cb,_0x118ee0,_0x1f30f7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a79d1e9..9202e06 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 _0x1f67=['express','Router','./authLocal.controller','post','/forgot','forgot','reset','exports'];(function(_0x502159,_0x3244e2){var _0x265971=function(_0x193a56){while(--_0x193a56){_0x502159['push'](_0x502159['shift']());}};_0x265971(++_0x3244e2);}(_0x1f67,0x168));var _0x71f6=function(_0xca06e,_0x25a203){_0xca06e=_0xca06e-0x0;var _0x32bb7e=_0x1f67[_0xca06e];return _0x32bb7e;};'use strict';var express=require(_0x71f6('0x0'));var router=express[_0x71f6('0x1')]();var controller=require(_0x71f6('0x2'));router[_0x71f6('0x3')]('/',controller['login']);router[_0x71f6('0x3')](_0x71f6('0x4'),controller[_0x71f6('0x5')]);router[_0x71f6('0x3')]('/reset/:token',controller[_0x71f6('0x6')]);module[_0x71f6('0x7')]=router; \ No newline at end of file +var _0xb786=['post','login','/forgot','forgot','exports','express','./authLocal.controller'];(function(_0x118c30,_0x7eb1eb){var _0x569999=function(_0x550ba2){while(--_0x550ba2){_0x118c30['push'](_0x118c30['shift']());}};_0x569999(++_0x7eb1eb);}(_0xb786,0x19b));var _0x6b78=function(_0x4eabbb,_0x8ac99a){_0x4eabbb=_0x4eabbb-0x0;var _0x1d9d1e=_0xb786[_0x4eabbb];return _0x1d9d1e;};'use strict';var express=require(_0x6b78('0x0'));var router=express['Router']();var controller=require(_0x6b78('0x1'));router[_0x6b78('0x2')]('/',controller[_0x6b78('0x3')]);router[_0x6b78('0x2')](_0x6b78('0x4'),controller[_0x6b78('0x5')]);router[_0x6b78('0x2')]('/reset/:token',controller['reset']);module[_0x6b78('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ff25864..9013afd 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 _0x924e=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x924e,0x7a));var _0xe924=function(_0x17c2b1,_0x423e01){_0x17c2b1=_0x17c2b1-0x0;var _0x4c2b13=_0x924e[_0x17c2b1];return _0x4c2b13;};'use strict';var Sequelize=require('sequelize');module[_0xe924('0x0')]={'name':{'type':Sequelize[_0xe924('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe924('0x1')]},'description':{'type':Sequelize[_0xe924('0x1')]},'status':{'type':Sequelize[_0xe924('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe924('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xf64b=['STRING','INTEGER','exports'];(function(_0xdd2b37,_0x283385){var _0x54deb3=function(_0x57c859){while(--_0x57c859){_0xdd2b37['push'](_0xdd2b37['shift']());}};_0x54deb3(++_0x283385);}(_0xf64b,0x1d6));var _0xbf64=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xf64b[_0x46f1a6];return _0x38429a;};'use strict';var Sequelize=require('sequelize');module[_0xbf64('0x0')]={'name':{'type':Sequelize[_0xbf64('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf64('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbf64('0x2')],'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 989bdcb..2102cf8 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 _0xceb1=['mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','destroy','then','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','Automation','includeAll','include','findAll','rows','params','merge','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','getActions','Action','order','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x573624,_0x5e9cea){var _0x4f8393=function(_0x486de8){while(--_0x486de8){_0x573624['push'](_0x573624['shift']());}};_0x4f8393(++_0x5e9cea);}(_0xceb1,0x1f1));var _0x1ceb=function(_0x351456,_0x2f81d5){_0x351456=_0x351456-0x0;var _0x4f9217=_0xceb1[_0x351456];return _0x4f9217;};'use strict';var emlformat=require(_0x1ceb('0x0'));var rimraf=require(_0x1ceb('0x1'));var zipdir=require(_0x1ceb('0x2'));var jsonpatch=require(_0x1ceb('0x3'));var rp=require(_0x1ceb('0x4'));var moment=require(_0x1ceb('0x5'));var BPromise=require(_0x1ceb('0x6'));var Mustache=require(_0x1ceb('0x7'));var util=require(_0x1ceb('0x8'));var path=require(_0x1ceb('0x9'));var sox=require('sox');var csv=require(_0x1ceb('0xa'));var ejs=require(_0x1ceb('0xb'));var fs=require('fs');var fs_extra=require(_0x1ceb('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1ceb('0xd'));var deskjs=require(_0x1ceb('0xe'));var toCsv=require(_0x1ceb('0xa'));var querystring=require(_0x1ceb('0xf'));var Papa=require('papaparse');var Redis=require(_0x1ceb('0x10'));var authService=require(_0x1ceb('0x11'));var qs=require(_0x1ceb('0x12'));var as=require(_0x1ceb('0x13'));var hardwareService=require(_0x1ceb('0x14'));var logger=require(_0x1ceb('0x15'))(_0x1ceb('0x16'));var utils=require('../../config/utils');var config=require(_0x1ceb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ceb('0x18'))['db'];function respondWithStatusCode(_0x38e8b9,_0x16fbbc){_0x16fbbc=_0x16fbbc||0xcc;return function(_0x5d8459){if(_0x5d8459){return _0x38e8b9[_0x1ceb('0x19')](_0x16fbbc);}return _0x38e8b9[_0x1ceb('0x1a')](_0x16fbbc)[_0x1ceb('0x1b')]();};}function respondWithResult(_0x5281ce,_0x2daa67){_0x2daa67=_0x2daa67||0xc8;return function(_0x2d6ef1){if(_0x2d6ef1){return _0x5281ce[_0x1ceb('0x1a')](_0x2daa67)['json'](_0x2d6ef1);}};}function respondWithFilteredResult(_0xc7bf76,_0x14038e){return function(_0x4856e0){if(_0x4856e0){var _0xb6d67c=typeof _0x14038e['offset']==='undefined'&&typeof _0x14038e[_0x1ceb('0x1c')]===_0x1ceb('0x1d');var _0x5b1fcf=_0x4856e0[_0x1ceb('0x1e')];var _0x333460=_0xb6d67c?0x0:_0x14038e[_0x1ceb('0x1f')];var _0x26e006=_0xb6d67c?_0x4856e0['count']:_0x14038e[_0x1ceb('0x1f')]+_0x14038e[_0x1ceb('0x1c')];var _0x1a6ba8;if(_0x26e006>=_0x5b1fcf){_0x26e006=_0x5b1fcf;_0x1a6ba8=0xc8;}else{_0x1a6ba8=0xce;}_0xc7bf76[_0x1ceb('0x1a')](_0x1a6ba8);return _0xc7bf76[_0x1ceb('0x20')](_0x1ceb('0x21'),_0x333460+'-'+_0x26e006+'/'+_0x5b1fcf)[_0x1ceb('0x22')](_0x4856e0);}return null;};}function patchUpdates(_0x2e6cf6){return function(_0x4f9c2e){try{jsonpatch['apply'](_0x4f9c2e,_0x2e6cf6,!![]);}catch(_0x1b05e9){return BPromise[_0x1ceb('0x23')](_0x1b05e9);}return _0x4f9c2e[_0x1ceb('0x24')]();};}function saveUpdates(_0x4da214,_0x1e0159){return function(_0x3d83de){if(_0x3d83de){return _0x3d83de[_0x1ceb('0x25')](_0x4da214)['then'](function(_0x399519){return _0x399519;});}return null;};}function removeEntity(_0x33eea9,_0x49bf71){return function(_0x41df00){if(_0x41df00){return _0x41df00[_0x1ceb('0x26')]()[_0x1ceb('0x27')](function(){_0x33eea9[_0x1ceb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f731f,_0x5ef71b){return function(_0x1e91e8){if(!_0x1e91e8){_0x2f731f[_0x1ceb('0x19')](0x194);}return _0x1e91e8;};}function handleError(_0x4e6694,_0x2e3dac){_0x2e3dac=_0x2e3dac||0x1f4;return function(_0x5eba47){logger['error'](_0x5eba47['stack']);if(_0x5eba47[_0x1ceb('0x28')]){delete _0x5eba47[_0x1ceb('0x28')];}_0x4e6694[_0x1ceb('0x1a')](_0x2e3dac)[_0x1ceb('0x29')](_0x5eba47);};}exports[_0x1ceb('0x2a')]=function(_0x55c483,_0x5ed631){var _0x27ddc1={},_0x20cb72={},_0x45e717={'count':0x0,'rows':[]};var _0x15b92e=_['map'](db['Automation'][_0x1ceb('0x2b')],function(_0x392531){return{'name':_0x392531['fieldName'],'type':_0x392531[_0x1ceb('0x2c')][_0x1ceb('0x2d')]};});_0x20cb72[_0x1ceb('0x2e')]=_[_0x1ceb('0x2f')](_0x15b92e,_0x1ceb('0x28'));_0x20cb72[_0x1ceb('0x30')]=_[_0x1ceb('0x31')](_0x55c483['query']);_0x20cb72[_0x1ceb('0x32')]=_[_0x1ceb('0x33')](_0x20cb72[_0x1ceb('0x2e')],_0x20cb72['query']);_0x27ddc1[_0x1ceb('0x34')]=_[_0x1ceb('0x33')](_0x20cb72['model'],qs[_0x1ceb('0x35')](_0x55c483['query'][_0x1ceb('0x35')]));_0x27ddc1[_0x1ceb('0x34')]=_0x27ddc1[_0x1ceb('0x34')][_0x1ceb('0x36')]?_0x27ddc1[_0x1ceb('0x34')]:_0x20cb72[_0x1ceb('0x2e')];if(!_0x55c483[_0x1ceb('0x30')]['hasOwnProperty'](_0x1ceb('0x37'))){_0x27ddc1['limit']=qs[_0x1ceb('0x1c')](_0x55c483[_0x1ceb('0x30')][_0x1ceb('0x1c')]);_0x27ddc1[_0x1ceb('0x1f')]=qs[_0x1ceb('0x1f')](_0x55c483['query'][_0x1ceb('0x1f')]);}_0x27ddc1['order']=qs['sort'](_0x55c483[_0x1ceb('0x30')][_0x1ceb('0x38')]);_0x27ddc1[_0x1ceb('0x39')]=qs[_0x1ceb('0x32')](_[_0x1ceb('0x3a')](_0x55c483[_0x1ceb('0x30')],_0x20cb72[_0x1ceb('0x32')]),_0x15b92e);if(_0x55c483[_0x1ceb('0x30')]['filter']){_0x27ddc1['where']=_['merge'](_0x27ddc1[_0x1ceb('0x39')],{'$or':_['map'](_0x15b92e,function(_0x578490){if(_0x578490[_0x1ceb('0x2c')]!==_0x1ceb('0x3b')){var _0x35f61b={};_0x35f61b[_0x578490[_0x1ceb('0x28')]]={'$like':'%'+_0x55c483[_0x1ceb('0x30')][_0x1ceb('0x3c')]+'%'};return _0x35f61b;}})});}_0x27ddc1=_['merge']({},_0x27ddc1,_0x55c483['options']);var _0x4a1999={'where':_0x27ddc1[_0x1ceb('0x39')]};return db[_0x1ceb('0x3d')][_0x1ceb('0x1e')](_0x4a1999)['then'](function(_0x40c28f){_0x45e717['count']=_0x40c28f;if(_0x55c483[_0x1ceb('0x30')][_0x1ceb('0x3e')]){_0x27ddc1[_0x1ceb('0x3f')]=[{'all':!![]}];}return db[_0x1ceb('0x3d')][_0x1ceb('0x40')](_0x27ddc1);})[_0x1ceb('0x27')](function(_0x548a5f){_0x45e717[_0x1ceb('0x41')]=_0x548a5f;return _0x45e717;})[_0x1ceb('0x27')](respondWithFilteredResult(_0x5ed631,_0x27ddc1))['catch'](handleError(_0x5ed631,null));};exports['show']=function(_0x15099b,_0x425464){var _0x29c369={'raw':![],'where':{'id':_0x15099b[_0x1ceb('0x42')]['id']}},_0x190a78={};_0x190a78[_0x1ceb('0x2e')]=_[_0x1ceb('0x31')](db[_0x1ceb('0x3d')][_0x1ceb('0x2b')]);_0x190a78[_0x1ceb('0x30')]=_[_0x1ceb('0x31')](_0x15099b[_0x1ceb('0x30')]);_0x190a78[_0x1ceb('0x32')]=_[_0x1ceb('0x33')](_0x190a78[_0x1ceb('0x2e')],_0x190a78[_0x1ceb('0x30')]);_0x29c369[_0x1ceb('0x34')]=_[_0x1ceb('0x33')](_0x190a78[_0x1ceb('0x2e')],qs[_0x1ceb('0x35')](_0x15099b['query'][_0x1ceb('0x35')]));_0x29c369[_0x1ceb('0x34')]=_0x29c369[_0x1ceb('0x34')][_0x1ceb('0x36')]?_0x29c369[_0x1ceb('0x34')]:_0x190a78[_0x1ceb('0x2e')];if(_0x15099b[_0x1ceb('0x30')]['includeAll']){_0x29c369[_0x1ceb('0x3f')]=[{'all':!![]}];}_0x29c369=_[_0x1ceb('0x43')]({},_0x29c369,_0x15099b['options']);return db[_0x1ceb('0x3d')][_0x1ceb('0x44')](_0x29c369)[_0x1ceb('0x27')](handleEntityNotFound(_0x425464,null))['then'](respondWithResult(_0x425464,null))[_0x1ceb('0x45')](handleError(_0x425464,null));};exports[_0x1ceb('0x46')]=function(_0x44aef8,_0x59845b){return db['Automation'][_0x1ceb('0x46')](_0x44aef8['body'],{})[_0x1ceb('0x27')](respondWithResult(_0x59845b,0xc9))['catch'](handleError(_0x59845b,null));};exports[_0x1ceb('0x25')]=function(_0x166b06,_0x2150a4){if(_0x166b06[_0x1ceb('0x47')]['id']){delete _0x166b06[_0x1ceb('0x47')]['id'];}return db[_0x1ceb('0x3d')]['find']({'where':{'id':_0x166b06[_0x1ceb('0x42')]['id']}})['then'](handleEntityNotFound(_0x2150a4,null))['then'](saveUpdates(_0x166b06['body'],null))[_0x1ceb('0x27')](respondWithResult(_0x2150a4,null))[_0x1ceb('0x45')](handleError(_0x2150a4,null));};exports[_0x1ceb('0x26')]=function(_0x1876ba,_0x14feba){return db[_0x1ceb('0x3d')][_0x1ceb('0x44')]({'where':{'id':_0x1876ba[_0x1ceb('0x42')]['id']}})[_0x1ceb('0x27')](handleEntityNotFound(_0x14feba,null))[_0x1ceb('0x27')](removeEntity(_0x14feba,null))['catch'](handleError(_0x14feba,null));};exports[_0x1ceb('0x48')]=function(_0x113734,_0x388d03,_0x4fc8cf){return db[_0x1ceb('0x49')][_0x1ceb('0x44')]({'where':{'id':_0x113734[_0x1ceb('0x42')]['id']}})[_0x1ceb('0x27')](handleEntityNotFound(_0x388d03,null))['then'](function(_0x28b667){if(_0x28b667){return _0x28b667['addConditions'](_0x113734['body'][_0x1ceb('0x4a')],_[_0x1ceb('0x4b')](_0x113734[_0x1ceb('0x47')],[_0x1ceb('0x4a'),'id'])||{});}})[_0x1ceb('0x27')](respondWithResult(_0x388d03,null))['catch'](handleError(_0x388d03,null));};exports[_0x1ceb('0x4c')]=function(_0x31883a,_0x3b01ac,_0x3b4acc){var _0x46cfb5={};var _0x43ba45={};var _0xaa45a4;var _0x80ae6d;return db[_0x1ceb('0x3d')][_0x1ceb('0x4d')]({'where':{'id':_0x31883a[_0x1ceb('0x42')]['id']}})[_0x1ceb('0x27')](handleEntityNotFound(_0x3b01ac,null))[_0x1ceb('0x27')](function(_0x5eafd3){if(_0x5eafd3){_0xaa45a4=_0x5eafd3;_0x43ba45[_0x1ceb('0x2e')]=_[_0x1ceb('0x31')](db[_0x1ceb('0x49')][_0x1ceb('0x2b')]);_0x43ba45[_0x1ceb('0x30')]=_[_0x1ceb('0x31')](_0x31883a[_0x1ceb('0x30')]);_0x43ba45[_0x1ceb('0x32')]=_[_0x1ceb('0x33')](_0x43ba45[_0x1ceb('0x2e')],_0x43ba45[_0x1ceb('0x30')]);_0x46cfb5[_0x1ceb('0x34')]=_[_0x1ceb('0x33')](_0x43ba45[_0x1ceb('0x2e')],qs[_0x1ceb('0x35')](_0x31883a[_0x1ceb('0x30')][_0x1ceb('0x35')]));_0x46cfb5[_0x1ceb('0x34')]=_0x46cfb5[_0x1ceb('0x34')]['length']?_0x46cfb5['attributes']:_0x43ba45[_0x1ceb('0x2e')];_0x46cfb5['order']=qs['sort'](_0x31883a['query'][_0x1ceb('0x38')]);_0x46cfb5[_0x1ceb('0x39')]=qs[_0x1ceb('0x32')](_['pick'](_0x31883a[_0x1ceb('0x30')],_0x43ba45[_0x1ceb('0x32')]));if(_0x31883a[_0x1ceb('0x30')][_0x1ceb('0x3c')]){_0x46cfb5[_0x1ceb('0x39')]=_[_0x1ceb('0x43')](_0x46cfb5[_0x1ceb('0x39')],{'$or':_['map'](_0x46cfb5['attributes'],function(_0x7703c7){var _0x78ed26={};_0x78ed26[_0x7703c7]={'$like':'%'+_0x31883a[_0x1ceb('0x30')][_0x1ceb('0x3c')]+'%'};return _0x78ed26;})});}_0x46cfb5=_['merge']({},_0x46cfb5,_0x31883a['options']);return _0xaa45a4[_0x1ceb('0x4c')](_0x46cfb5);}})['then'](function(_0x3ecc4b){if(_0x3ecc4b){_0x80ae6d=_0x3ecc4b[_0x1ceb('0x36')];if(!_0x31883a[_0x1ceb('0x30')][_0x1ceb('0x4e')](_0x1ceb('0x37'))){_0x46cfb5['limit']=qs[_0x1ceb('0x1c')](_0x31883a[_0x1ceb('0x30')][_0x1ceb('0x1c')]);_0x46cfb5[_0x1ceb('0x1f')]=qs[_0x1ceb('0x1f')](_0x31883a[_0x1ceb('0x30')][_0x1ceb('0x1f')]);}return _0xaa45a4[_0x1ceb('0x4c')](_0x46cfb5);}})[_0x1ceb('0x27')](function(_0x8cfaf1){if(_0x8cfaf1){return _0x8cfaf1?{'count':_0x80ae6d,'rows':_0x8cfaf1}:null;}})[_0x1ceb('0x27')](respondWithResult(_0x3b01ac,null))[_0x1ceb('0x45')](handleError(_0x3b01ac,null));};exports['addActions']=function(_0x232b2b,_0xe2de43,_0x224c0d){return db['Action'][_0x1ceb('0x44')]({'where':{'id':_0x232b2b[_0x1ceb('0x42')]['id']}})[_0x1ceb('0x27')](handleEntityNotFound(_0xe2de43,null))['then'](function(_0x967563){if(_0x967563){return _0x967563[_0x1ceb('0x4f')](_0x232b2b['body'][_0x1ceb('0x4a')],_[_0x1ceb('0x4b')](_0x232b2b[_0x1ceb('0x47')],[_0x1ceb('0x4a'),'id'])||{});}})['then'](respondWithResult(_0xe2de43,null))[_0x1ceb('0x45')](handleError(_0xe2de43,null));};exports[_0x1ceb('0x50')]=function(_0x2c6199,_0x385788,_0x2b5bd5){var _0x4bd76a={};var _0x4d5e55={};var _0x56a5e4;var _0x490dde;return db[_0x1ceb('0x3d')][_0x1ceb('0x4d')]({'where':{'id':_0x2c6199[_0x1ceb('0x42')]['id']}})[_0x1ceb('0x27')](handleEntityNotFound(_0x385788,null))[_0x1ceb('0x27')](function(_0x237cad){if(_0x237cad){_0x56a5e4=_0x237cad;_0x4d5e55[_0x1ceb('0x2e')]=_[_0x1ceb('0x31')](db[_0x1ceb('0x51')]['rawAttributes']);_0x4d5e55[_0x1ceb('0x30')]=_[_0x1ceb('0x31')](_0x2c6199[_0x1ceb('0x30')]);_0x4d5e55[_0x1ceb('0x32')]=_[_0x1ceb('0x33')](_0x4d5e55['model'],_0x4d5e55[_0x1ceb('0x30')]);_0x4bd76a[_0x1ceb('0x34')]=_[_0x1ceb('0x33')](_0x4d5e55[_0x1ceb('0x2e')],qs[_0x1ceb('0x35')](_0x2c6199[_0x1ceb('0x30')]['fields']));_0x4bd76a['attributes']=_0x4bd76a['attributes'][_0x1ceb('0x36')]?_0x4bd76a['attributes']:_0x4d5e55[_0x1ceb('0x2e')];_0x4bd76a[_0x1ceb('0x52')]=qs['sort'](_0x2c6199[_0x1ceb('0x30')]['sort']);_0x4bd76a[_0x1ceb('0x39')]=qs[_0x1ceb('0x32')](_[_0x1ceb('0x3a')](_0x2c6199[_0x1ceb('0x30')],_0x4d5e55[_0x1ceb('0x32')]));if(_0x2c6199[_0x1ceb('0x30')]['filter']){_0x4bd76a[_0x1ceb('0x39')]=_[_0x1ceb('0x43')](_0x4bd76a[_0x1ceb('0x39')],{'$or':_[_0x1ceb('0x2f')](_0x4bd76a[_0x1ceb('0x34')],function(_0x599444){var _0x11181f={};_0x11181f[_0x599444]={'$like':'%'+_0x2c6199[_0x1ceb('0x30')][_0x1ceb('0x3c')]+'%'};return _0x11181f;})});}_0x4bd76a=_['merge']({},_0x4bd76a,_0x2c6199[_0x1ceb('0x53')]);return _0x56a5e4['getActions'](_0x4bd76a);}})[_0x1ceb('0x27')](function(_0x22bcb9){if(_0x22bcb9){_0x490dde=_0x22bcb9['length'];if(!_0x2c6199[_0x1ceb('0x30')]['hasOwnProperty']('nolimit')){_0x4bd76a[_0x1ceb('0x1c')]=qs[_0x1ceb('0x1c')](_0x2c6199[_0x1ceb('0x30')][_0x1ceb('0x1c')]);_0x4bd76a[_0x1ceb('0x1f')]=qs[_0x1ceb('0x1f')](_0x2c6199[_0x1ceb('0x30')][_0x1ceb('0x1f')]);}return _0x56a5e4[_0x1ceb('0x50')](_0x4bd76a);}})[_0x1ceb('0x27')](function(_0x1109b7){if(_0x1109b7){return _0x1109b7?{'count':_0x490dde,'rows':_0x1109b7}:null;}})[_0x1ceb('0x27')](respondWithResult(_0x385788,null))[_0x1ceb('0x45')](handleError(_0x385788,null));}; \ No newline at end of file +var _0xe0b4=['undefined','count','offset','set','Content-Range','json','save','update','then','end','error','stack','name','send','index','map','Automation','rawAttributes','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','addConditions','ids','omit','getConditions','findOne','Condition','order','pick','filter','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x9b2cd3,_0x344955){var _0x56995b=function(_0x46cc75){while(--_0x46cc75){_0x9b2cd3['push'](_0x9b2cd3['shift']());}};_0x56995b(++_0x344955);}(_0xe0b4,0x92));var _0x4e0b=function(_0x2791e3,_0x53720c){_0x2791e3=_0x2791e3-0x0;var _0x50a6f2=_0xe0b4[_0x2791e3];return _0x50a6f2;};'use strict';var emlformat=require(_0x4e0b('0x0'));var rimraf=require(_0x4e0b('0x1'));var zipdir=require(_0x4e0b('0x2'));var jsonpatch=require(_0x4e0b('0x3'));var rp=require(_0x4e0b('0x4'));var moment=require(_0x4e0b('0x5'));var BPromise=require(_0x4e0b('0x6'));var Mustache=require('mustache');var util=require(_0x4e0b('0x7'));var path=require(_0x4e0b('0x8'));var sox=require(_0x4e0b('0x9'));var csv=require('to-csv');var ejs=require(_0x4e0b('0xa'));var fs=require('fs');var fs_extra=require(_0x4e0b('0xb'));var _=require(_0x4e0b('0xc'));var squel=require(_0x4e0b('0xd'));var crypto=require(_0x4e0b('0xe'));var jsforce=require(_0x4e0b('0xf'));var deskjs=require(_0x4e0b('0x10'));var toCsv=require(_0x4e0b('0x11'));var querystring=require(_0x4e0b('0x12'));var Papa=require(_0x4e0b('0x13'));var Redis=require(_0x4e0b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x4e0b('0x15'));var as=require(_0x4e0b('0x16'));var hardwareService=require(_0x4e0b('0x17'));var logger=require('../../config/logger')(_0x4e0b('0x18'));var utils=require(_0x4e0b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4e0b('0x1a'));var db=require(_0x4e0b('0x1b'))['db'];function respondWithStatusCode(_0x2c5a9f,_0x57fb39){_0x57fb39=_0x57fb39||0xcc;return function(_0x1bcfa0){if(_0x1bcfa0){return _0x2c5a9f[_0x4e0b('0x1c')](_0x57fb39);}return _0x2c5a9f[_0x4e0b('0x1d')](_0x57fb39)['end']();};}function respondWithResult(_0x4d9456,_0x42604f){_0x42604f=_0x42604f||0xc8;return function(_0x324ca2){if(_0x324ca2){return _0x4d9456['status'](_0x42604f)['json'](_0x324ca2);}};}function respondWithFilteredResult(_0x1217e4,_0x5350f2){return function(_0x1862c4){if(_0x1862c4){var _0x3a5589=typeof _0x5350f2['offset']==='undefined'&&typeof _0x5350f2['limit']===_0x4e0b('0x1e');var _0x13c88b=_0x1862c4[_0x4e0b('0x1f')];var _0x3efc08=_0x3a5589?0x0:_0x5350f2['offset'];var _0x1e18c1=_0x3a5589?_0x1862c4['count']:_0x5350f2[_0x4e0b('0x20')]+_0x5350f2['limit'];var _0x21429d;if(_0x1e18c1>=_0x13c88b){_0x1e18c1=_0x13c88b;_0x21429d=0xc8;}else{_0x21429d=0xce;}_0x1217e4[_0x4e0b('0x1d')](_0x21429d);return _0x1217e4[_0x4e0b('0x21')](_0x4e0b('0x22'),_0x3efc08+'-'+_0x1e18c1+'/'+_0x13c88b)[_0x4e0b('0x23')](_0x1862c4);}return null;};}function patchUpdates(_0x5ec2da){return function(_0x1b601c){try{jsonpatch['apply'](_0x1b601c,_0x5ec2da,!![]);}catch(_0x2cf947){return BPromise['reject'](_0x2cf947);}return _0x1b601c[_0x4e0b('0x24')]();};}function saveUpdates(_0x295d95,_0x1f8885){return function(_0x11a974){if(_0x11a974){return _0x11a974[_0x4e0b('0x25')](_0x295d95)[_0x4e0b('0x26')](function(_0x2fc9f1){return _0x2fc9f1;});}return null;};}function removeEntity(_0x3b83a0,_0x3f70a7){return function(_0x481e49){if(_0x481e49){return _0x481e49['destroy']()[_0x4e0b('0x26')](function(){_0x3b83a0[_0x4e0b('0x1d')](0xcc)[_0x4e0b('0x27')]();});}};}function handleEntityNotFound(_0x5d9f29,_0x4d39a5){return function(_0x1f008e){if(!_0x1f008e){_0x5d9f29['sendStatus'](0x194);}return _0x1f008e;};}function handleError(_0x213ecd,_0x4631c4){_0x4631c4=_0x4631c4||0x1f4;return function(_0x324fa7){logger[_0x4e0b('0x28')](_0x324fa7[_0x4e0b('0x29')]);if(_0x324fa7[_0x4e0b('0x2a')]){delete _0x324fa7[_0x4e0b('0x2a')];}_0x213ecd['status'](_0x4631c4)[_0x4e0b('0x2b')](_0x324fa7);};}exports[_0x4e0b('0x2c')]=function(_0x47f163,_0x728e49){var _0x329c00={},_0x2f6cc0={},_0x5cda22={'count':0x0,'rows':[]};var _0x17b8d8=_[_0x4e0b('0x2d')](db[_0x4e0b('0x2e')][_0x4e0b('0x2f')],function(_0x8df4e7){return{'name':_0x8df4e7['fieldName'],'type':_0x8df4e7[_0x4e0b('0x30')]['key']};});_0x2f6cc0[_0x4e0b('0x31')]=_[_0x4e0b('0x2d')](_0x17b8d8,_0x4e0b('0x2a'));_0x2f6cc0[_0x4e0b('0x32')]=_['keys'](_0x47f163[_0x4e0b('0x32')]);_0x2f6cc0['filters']=_['intersection'](_0x2f6cc0[_0x4e0b('0x31')],_0x2f6cc0[_0x4e0b('0x32')]);_0x329c00[_0x4e0b('0x33')]=_[_0x4e0b('0x34')](_0x2f6cc0[_0x4e0b('0x31')],qs[_0x4e0b('0x35')](_0x47f163['query'][_0x4e0b('0x35')]));_0x329c00['attributes']=_0x329c00[_0x4e0b('0x33')][_0x4e0b('0x36')]?_0x329c00['attributes']:_0x2f6cc0[_0x4e0b('0x31')];if(!_0x47f163[_0x4e0b('0x32')][_0x4e0b('0x37')](_0x4e0b('0x38'))){_0x329c00['limit']=qs[_0x4e0b('0x39')](_0x47f163[_0x4e0b('0x32')][_0x4e0b('0x39')]);_0x329c00[_0x4e0b('0x20')]=qs['offset'](_0x47f163[_0x4e0b('0x32')][_0x4e0b('0x20')]);}_0x329c00['order']=qs['sort'](_0x47f163[_0x4e0b('0x32')][_0x4e0b('0x3a')]);_0x329c00[_0x4e0b('0x3b')]=qs['filters'](_['pick'](_0x47f163[_0x4e0b('0x32')],_0x2f6cc0[_0x4e0b('0x3c')]),_0x17b8d8);if(_0x47f163['query']['filter']){_0x329c00[_0x4e0b('0x3b')]=_[_0x4e0b('0x3d')](_0x329c00[_0x4e0b('0x3b')],{'$or':_[_0x4e0b('0x2d')](_0x17b8d8,function(_0xfdbb57){if(_0xfdbb57[_0x4e0b('0x30')]!==_0x4e0b('0x3e')){var _0x51b96d={};_0x51b96d[_0xfdbb57['name']]={'$like':'%'+_0x47f163[_0x4e0b('0x32')]['filter']+'%'};return _0x51b96d;}})});}_0x329c00=_[_0x4e0b('0x3d')]({},_0x329c00,_0x47f163[_0x4e0b('0x3f')]);var _0x304ede={'where':_0x329c00[_0x4e0b('0x3b')]};return db[_0x4e0b('0x2e')][_0x4e0b('0x1f')](_0x304ede)[_0x4e0b('0x26')](function(_0xcc0ce8){_0x5cda22[_0x4e0b('0x1f')]=_0xcc0ce8;if(_0x47f163['query'][_0x4e0b('0x40')]){_0x329c00[_0x4e0b('0x41')]=[{'all':!![]}];}return db[_0x4e0b('0x2e')][_0x4e0b('0x42')](_0x329c00);})[_0x4e0b('0x26')](function(_0xe9d877){_0x5cda22[_0x4e0b('0x43')]=_0xe9d877;return _0x5cda22;})[_0x4e0b('0x26')](respondWithFilteredResult(_0x728e49,_0x329c00))[_0x4e0b('0x44')](handleError(_0x728e49,null));};exports[_0x4e0b('0x45')]=function(_0x4198cb,_0x2e4cf2){var _0x3ac11b={'raw':![],'where':{'id':_0x4198cb[_0x4e0b('0x46')]['id']}},_0x49e1f6={};_0x49e1f6[_0x4e0b('0x31')]=_[_0x4e0b('0x47')](db[_0x4e0b('0x2e')][_0x4e0b('0x2f')]);_0x49e1f6[_0x4e0b('0x32')]=_['keys'](_0x4198cb['query']);_0x49e1f6[_0x4e0b('0x3c')]=_[_0x4e0b('0x34')](_0x49e1f6[_0x4e0b('0x31')],_0x49e1f6[_0x4e0b('0x32')]);_0x3ac11b['attributes']=_[_0x4e0b('0x34')](_0x49e1f6[_0x4e0b('0x31')],qs[_0x4e0b('0x35')](_0x4198cb['query'][_0x4e0b('0x35')]));_0x3ac11b['attributes']=_0x3ac11b['attributes'][_0x4e0b('0x36')]?_0x3ac11b[_0x4e0b('0x33')]:_0x49e1f6[_0x4e0b('0x31')];if(_0x4198cb[_0x4e0b('0x32')][_0x4e0b('0x40')]){_0x3ac11b[_0x4e0b('0x41')]=[{'all':!![]}];}_0x3ac11b=_[_0x4e0b('0x3d')]({},_0x3ac11b,_0x4198cb[_0x4e0b('0x3f')]);return db['Automation'][_0x4e0b('0x48')](_0x3ac11b)[_0x4e0b('0x26')](handleEntityNotFound(_0x2e4cf2,null))[_0x4e0b('0x26')](respondWithResult(_0x2e4cf2,null))[_0x4e0b('0x44')](handleError(_0x2e4cf2,null));};exports[_0x4e0b('0x49')]=function(_0x55d239,_0x373e1d){return db['Automation'][_0x4e0b('0x49')](_0x55d239[_0x4e0b('0x4a')],{})['then'](respondWithResult(_0x373e1d,0xc9))['catch'](handleError(_0x373e1d,null));};exports[_0x4e0b('0x25')]=function(_0x4a5887,_0x2fcda2){if(_0x4a5887['body']['id']){delete _0x4a5887[_0x4e0b('0x4a')]['id'];}return db[_0x4e0b('0x2e')][_0x4e0b('0x48')]({'where':{'id':_0x4a5887[_0x4e0b('0x46')]['id']}})[_0x4e0b('0x26')](handleEntityNotFound(_0x2fcda2,null))[_0x4e0b('0x26')](saveUpdates(_0x4a5887[_0x4e0b('0x4a')],null))[_0x4e0b('0x26')](respondWithResult(_0x2fcda2,null))['catch'](handleError(_0x2fcda2,null));};exports[_0x4e0b('0x4b')]=function(_0x491c6e,_0x552b82){return db[_0x4e0b('0x2e')][_0x4e0b('0x48')]({'where':{'id':_0x491c6e[_0x4e0b('0x46')]['id']}})[_0x4e0b('0x26')](handleEntityNotFound(_0x552b82,null))['then'](removeEntity(_0x552b82,null))['catch'](handleError(_0x552b82,null));};exports[_0x4e0b('0x4c')]=function(_0x2a348f,_0x231796,_0x1720df){return db['Condition']['find']({'where':{'id':_0x2a348f[_0x4e0b('0x46')]['id']}})[_0x4e0b('0x26')](handleEntityNotFound(_0x231796,null))[_0x4e0b('0x26')](function(_0x35de18){if(_0x35de18){return _0x35de18['addConditions'](_0x2a348f[_0x4e0b('0x4a')][_0x4e0b('0x4d')],_[_0x4e0b('0x4e')](_0x2a348f['body'],[_0x4e0b('0x4d'),'id'])||{});}})[_0x4e0b('0x26')](respondWithResult(_0x231796,null))[_0x4e0b('0x44')](handleError(_0x231796,null));};exports[_0x4e0b('0x4f')]=function(_0x153852,_0x5a165a,_0x555f78){var _0x9bfaac={};var _0x507984={};var _0x472bd7;var _0x318576;return db['Automation'][_0x4e0b('0x50')]({'where':{'id':_0x153852[_0x4e0b('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a165a,null))[_0x4e0b('0x26')](function(_0x4a9caa){if(_0x4a9caa){_0x472bd7=_0x4a9caa;_0x507984[_0x4e0b('0x31')]=_[_0x4e0b('0x47')](db[_0x4e0b('0x51')][_0x4e0b('0x2f')]);_0x507984[_0x4e0b('0x32')]=_['keys'](_0x153852[_0x4e0b('0x32')]);_0x507984[_0x4e0b('0x3c')]=_[_0x4e0b('0x34')](_0x507984['model'],_0x507984['query']);_0x9bfaac[_0x4e0b('0x33')]=_[_0x4e0b('0x34')](_0x507984[_0x4e0b('0x31')],qs['fields'](_0x153852[_0x4e0b('0x32')]['fields']));_0x9bfaac['attributes']=_0x9bfaac[_0x4e0b('0x33')][_0x4e0b('0x36')]?_0x9bfaac[_0x4e0b('0x33')]:_0x507984[_0x4e0b('0x31')];_0x9bfaac[_0x4e0b('0x52')]=qs[_0x4e0b('0x3a')](_0x153852['query'][_0x4e0b('0x3a')]);_0x9bfaac[_0x4e0b('0x3b')]=qs[_0x4e0b('0x3c')](_[_0x4e0b('0x53')](_0x153852['query'],_0x507984[_0x4e0b('0x3c')]));if(_0x153852[_0x4e0b('0x32')][_0x4e0b('0x54')]){_0x9bfaac[_0x4e0b('0x3b')]=_[_0x4e0b('0x3d')](_0x9bfaac[_0x4e0b('0x3b')],{'$or':_[_0x4e0b('0x2d')](_0x9bfaac['attributes'],function(_0x46142c){var _0xabfa52={};_0xabfa52[_0x46142c]={'$like':'%'+_0x153852[_0x4e0b('0x32')][_0x4e0b('0x54')]+'%'};return _0xabfa52;})});}_0x9bfaac=_[_0x4e0b('0x3d')]({},_0x9bfaac,_0x153852[_0x4e0b('0x3f')]);return _0x472bd7[_0x4e0b('0x4f')](_0x9bfaac);}})[_0x4e0b('0x26')](function(_0x25cae5){if(_0x25cae5){_0x318576=_0x25cae5[_0x4e0b('0x36')];if(!_0x153852['query'][_0x4e0b('0x37')]('nolimit')){_0x9bfaac[_0x4e0b('0x39')]=qs[_0x4e0b('0x39')](_0x153852['query'][_0x4e0b('0x39')]);_0x9bfaac[_0x4e0b('0x20')]=qs['offset'](_0x153852[_0x4e0b('0x32')]['offset']);}return _0x472bd7[_0x4e0b('0x4f')](_0x9bfaac);}})[_0x4e0b('0x26')](function(_0x1aa662){if(_0x1aa662){return _0x1aa662?{'count':_0x318576,'rows':_0x1aa662}:null;}})['then'](respondWithResult(_0x5a165a,null))[_0x4e0b('0x44')](handleError(_0x5a165a,null));};exports[_0x4e0b('0x55')]=function(_0x29b09b,_0x4aa2f9,_0x2fef51){return db[_0x4e0b('0x56')][_0x4e0b('0x48')]({'where':{'id':_0x29b09b[_0x4e0b('0x46')]['id']}})[_0x4e0b('0x26')](handleEntityNotFound(_0x4aa2f9,null))['then'](function(_0xc2c99a){if(_0xc2c99a){return _0xc2c99a[_0x4e0b('0x55')](_0x29b09b[_0x4e0b('0x4a')][_0x4e0b('0x4d')],_[_0x4e0b('0x4e')](_0x29b09b[_0x4e0b('0x4a')],[_0x4e0b('0x4d'),'id'])||{});}})[_0x4e0b('0x26')](respondWithResult(_0x4aa2f9,null))['catch'](handleError(_0x4aa2f9,null));};exports[_0x4e0b('0x57')]=function(_0x257c13,_0x38ab14,_0xd16dda){var _0xd154a4={};var _0x40fb01={};var _0x1a13ae;var _0x5e91d1;return db[_0x4e0b('0x2e')]['findOne']({'where':{'id':_0x257c13['params']['id']}})['then'](handleEntityNotFound(_0x38ab14,null))['then'](function(_0x18bf27){if(_0x18bf27){_0x1a13ae=_0x18bf27;_0x40fb01['model']=_[_0x4e0b('0x47')](db[_0x4e0b('0x56')][_0x4e0b('0x2f')]);_0x40fb01[_0x4e0b('0x32')]=_['keys'](_0x257c13[_0x4e0b('0x32')]);_0x40fb01[_0x4e0b('0x3c')]=_[_0x4e0b('0x34')](_0x40fb01[_0x4e0b('0x31')],_0x40fb01['query']);_0xd154a4['attributes']=_[_0x4e0b('0x34')](_0x40fb01['model'],qs['fields'](_0x257c13[_0x4e0b('0x32')][_0x4e0b('0x35')]));_0xd154a4[_0x4e0b('0x33')]=_0xd154a4[_0x4e0b('0x33')][_0x4e0b('0x36')]?_0xd154a4['attributes']:_0x40fb01[_0x4e0b('0x31')];_0xd154a4['order']=qs[_0x4e0b('0x3a')](_0x257c13[_0x4e0b('0x32')][_0x4e0b('0x3a')]);_0xd154a4[_0x4e0b('0x3b')]=qs['filters'](_[_0x4e0b('0x53')](_0x257c13['query'],_0x40fb01[_0x4e0b('0x3c')]));if(_0x257c13['query']['filter']){_0xd154a4[_0x4e0b('0x3b')]=_[_0x4e0b('0x3d')](_0xd154a4[_0x4e0b('0x3b')],{'$or':_[_0x4e0b('0x2d')](_0xd154a4[_0x4e0b('0x33')],function(_0x25eebe){var _0x4c9ee4={};_0x4c9ee4[_0x25eebe]={'$like':'%'+_0x257c13[_0x4e0b('0x32')]['filter']+'%'};return _0x4c9ee4;})});}_0xd154a4=_['merge']({},_0xd154a4,_0x257c13[_0x4e0b('0x3f')]);return _0x1a13ae['getActions'](_0xd154a4);}})[_0x4e0b('0x26')](function(_0x4e7555){if(_0x4e7555){_0x5e91d1=_0x4e7555['length'];if(!_0x257c13[_0x4e0b('0x32')][_0x4e0b('0x37')]('nolimit')){_0xd154a4[_0x4e0b('0x39')]=qs['limit'](_0x257c13[_0x4e0b('0x32')][_0x4e0b('0x39')]);_0xd154a4[_0x4e0b('0x20')]=qs['offset'](_0x257c13[_0x4e0b('0x32')][_0x4e0b('0x20')]);}return _0x1a13ae[_0x4e0b('0x57')](_0xd154a4);}})[_0x4e0b('0x26')](function(_0x49e424){if(_0x49e424){return _0x49e424?{'count':_0x5e91d1,'rows':_0x49e424}:null;}})['then'](respondWithResult(_0x38ab14,null))['catch'](handleError(_0x38ab14,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 0d5e8ec..ceb36c9 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 _0x5aa5=['moment','request-promise','path','rimraf','tools_automations','util','../../config/logger','api'];(function(_0x3a86a7,_0x12ade0){var _0x19b1b6=function(_0x2af9d0){while(--_0x2af9d0){_0x3a86a7['push'](_0x3a86a7['shift']());}};_0x19b1b6(++_0x12ade0);}(_0x5aa5,0x1dd));var _0x55aa=function(_0x3523aa,_0x52cd63){_0x3523aa=_0x3523aa-0x0;var _0x3231de=_0x5aa5[_0x3523aa];return _0x3231de;};'use strict';var _=require('lodash');var util=require(_0x55aa('0x0'));var logger=require(_0x55aa('0x1'))(_0x55aa('0x2'));var moment=require(_0x55aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x55aa('0x4'));var fs=require('fs');var path=require(_0x55aa('0x5'));var rimraf=require(_0x55aa('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module['exports']=function(_0x29847d,_0x2fede0){return _0x29847d['define']('Automation',attributes,{'tableName':_0x55aa('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x000e=['bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','Automation','../../config/logger','api'];(function(_0x16c6d6,_0x237525){var _0x1cf47c=function(_0x7444a6){while(--_0x7444a6){_0x16c6d6['push'](_0x16c6d6['shift']());}};_0x1cf47c(++_0x237525);}(_0x000e,0xee));var _0xe000=function(_0x2d3872,_0x30ccb9){_0x2d3872=_0x2d3872-0x0;var _0x274a11=_0x000e[_0x2d3872];return _0x274a11;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe000('0x0'))(_0xe000('0x1'));var moment=require('moment');var BPromise=require(_0xe000('0x2'));var rp=require(_0xe000('0x3'));var fs=require('fs');var path=require(_0xe000('0x4'));var rimraf=require(_0xe000('0x5'));var config=require(_0xe000('0x6'));var attributes=require(_0xe000('0x7'));module['exports']=function(_0x59f993,_0xb4e960){return _0x59f993[_0xe000('0x8')](_0xe000('0x9'),attributes,{'tableName':'tools_automations','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 30abdd2..6cccdd7 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 _0xe2cf=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x50c03b,_0x21a32f){var _0x4e03a8=function(_0x6deeb){while(--_0x6deeb){_0x50c03b['push'](_0x50c03b['shift']());}};_0x4e03a8(++_0x21a32f);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x27fa56,_0x4def9b){_0x27fa56=_0x27fa56-0x0;var _0x25b2bc=_0xe2cf[_0x27fa56];return _0x25b2bc;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('Automation,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('Automation,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});} \ No newline at end of file +var _0xfbbb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x113d60,_0x333f34){var _0xc7d380=function(_0x50ae36){while(--_0x50ae36){_0x113d60['push'](_0x113d60['shift']());}};_0xc7d380(++_0x333f34);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x597eb6,_0x4fbdea){_0x597eb6=_0x597eb6-0x0;var _0x58c0fb=_0xfbbb[_0x597eb6];return _0x58c0fb;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var moment=require(_0xbfbb('0x2'));var BPromise=require(_0xbfbb('0x3'));var rs=require(_0xbfbb('0x4'));var fs=require('fs');var Redis=require(_0xbfbb('0x5'));var db=require(_0xbfbb('0x6'))['db'];var utils=require(_0xbfbb('0x7'));var logger=require(_0xbfbb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbb('0x9'));var client=jayson['client'][_0xbfbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c6cc,_0x16a41c,_0x5a69b3){return new BPromise(function(_0x1f2c31,_0x3260a7){return client[_0xbfbb('0xb')](_0x16c6cc,_0x5a69b3)[_0xbfbb('0xc')](function(_0x1baefa){logger[_0xbfbb('0xd')]('Automation,\x20%s,\x20%s',_0x16a41c,_0xbfbb('0xe'));logger[_0xbfbb('0xf')](_0xbfbb('0x10'),_0x16a41c,_0xbfbb('0xe'),JSON['stringify'](_0x1baefa));if(_0x1baefa[_0xbfbb('0x11')]){if(_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x12')]===0x1f4){logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x3260a7(_0x1baefa[_0xbfbb('0x11')]['message']);}logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x1f2c31(_0x1baefa[_0xbfbb('0x11')]['message']);}else{logger[_0xbfbb('0xd')](_0xbfbb('0x13'),_0x16a41c,_0xbfbb('0xe'));_0x1f2c31(_0x1baefa[_0xbfbb('0x15')][_0xbfbb('0x14')]);}})[_0xbfbb('0x16')](function(_0x2f49e5){logger['error']('Automation,\x20%s,\x20%s',_0x16a41c,_0x2f49e5);_0x3260a7(_0x2f49e5);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 601403a..a9cbf71 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 _0x6ae0=['update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./automation.controller','get','index','/:id','isAuthenticated','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x6ae0,0x192));var _0x06ae=function(_0x2b22e6,_0x3f2337){_0x2b22e6=_0x2b22e6-0x0;var _0x225b25=_0x6ae0[_0x2b22e6];return _0x225b25;};'use strict';var multer=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var path=require(_0x06ae('0x2'));var timeout=require(_0x06ae('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x06ae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x06ae('0x5'));var config=require('../../config/environment');var controller=require(_0x06ae('0x6'));router[_0x06ae('0x7')]('/',auth['isAuthenticated'](),controller[_0x06ae('0x8')]);router['get'](_0x06ae('0x9'),auth[_0x06ae('0xa')](),controller['show']);router[_0x06ae('0x7')](_0x06ae('0xb'),auth[_0x06ae('0xa')](),controller[_0x06ae('0xc')]);router[_0x06ae('0x7')](_0x06ae('0xd'),auth[_0x06ae('0xa')](),controller['getActions']);router[_0x06ae('0xe')]('/',auth[_0x06ae('0xa')](),controller[_0x06ae('0xf')]);router[_0x06ae('0xe')](_0x06ae('0xb'),auth[_0x06ae('0xa')](),controller[_0x06ae('0x10')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0x06ae('0x11')]);router['put'](_0x06ae('0x9'),auth[_0x06ae('0xa')](),controller[_0x06ae('0x12')]);router[_0x06ae('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x06ae('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0c2b=['/:id/actions','post','addConditions','addActions','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index','get','/:id','isAuthenticated','show','/:id/conditions'];(function(_0xdaa456,_0x3dbbe5){var _0x288a4a=function(_0x4e4d5d){while(--_0x4e4d5d){_0xdaa456['push'](_0xdaa456['shift']());}};_0x288a4a(++_0x3dbbe5);}(_0x0c2b,0x134));var _0xb0c2=function(_0x22b7b5,_0x71b79){_0x22b7b5=_0x22b7b5-0x0;var _0x219a6d=_0x0c2b[_0x22b7b5];return _0x219a6d;};'use strict';var multer=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0c2('0x2'));var router=express['Router']();var fs_extra=require(_0xb0c2('0x3'));var auth=require(_0xb0c2('0x4'));var interaction=require(_0xb0c2('0x5'));var config=require(_0xb0c2('0x6'));var controller=require(_0xb0c2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb0c2('0x8')]);router[_0xb0c2('0x9')](_0xb0c2('0xa'),auth[_0xb0c2('0xb')](),controller[_0xb0c2('0xc')]);router[_0xb0c2('0x9')](_0xb0c2('0xd'),auth[_0xb0c2('0xb')](),controller['getConditions']);router[_0xb0c2('0x9')](_0xb0c2('0xe'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0xb0c2('0xb')](),controller['create']);router[_0xb0c2('0xf')](_0xb0c2('0xd'),auth['isAuthenticated'](),controller[_0xb0c2('0x10')]);router[_0xb0c2('0xf')](_0xb0c2('0xe'),auth[_0xb0c2('0xb')](),controller[_0xb0c2('0x11')]);router[_0xb0c2('0x12')](_0xb0c2('0xa'),auth[_0xb0c2('0xb')](),controller[_0xb0c2('0x13')]);router[_0xb0c2('0x14')](_0xb0c2('0xa'),auth['isAuthenticated'](),controller[_0xb0c2('0x15')]);module[_0xb0c2('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 79852c7..38d320e 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 _0x8a78=['INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\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)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED'];(function(_0x35d66b,_0x298440){var _0x3a0437=function(_0x4fa705){while(--_0x4fa705){_0x35d66b['push'](_0x35d66b['shift']());}};_0x3a0437(++_0x298440);}(_0x8a78,0x158));var _0x88a7=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x8a78[_0x3074f3];return _0x53f112;};'use strict';var Sequelize=require(_0x88a7('0x0'));module[_0x88a7('0x1')]={'name':{'type':Sequelize[_0x88a7('0x2')],'unique':_0x88a7('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x88a7('0x4')),'allowNull':![],'defaultValue':_0x88a7('0x4')},'description':{'type':Sequelize[_0x88a7('0x2')]},'active':{'type':Sequelize[_0x88a7('0x5')],'defaultValue':0x0,'comment':_0x88a7('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x88a7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x88a7('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x88a7('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88a7('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88a7('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x88a7('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x88a7('0xc')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x88a7('0x2')],'defaultValue':_0x88a7('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x88a7('0xe'),'never',_0x88a7('0xf')),'defaultValue':_0x88a7('0xe')},'dialAMDActive':{'type':Sequelize[_0x88a7('0x5')],'defaultValue':0x0,'comment':_0x88a7('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x88a7('0x8')](0x9)[_0x88a7('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x88a7('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x88a7('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x88a7('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x88a7('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x88a7('0x8')](0x9)[_0x88a7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x88a7('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x88a7('0x8')](0x9)[_0x88a7('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x88a7('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x88a7('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x88a7('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x88a7('0x15'),_0x88a7('0x16')),'defaultValue':_0x88a7('0x15')},'dialPrefix':{'type':Sequelize[_0x88a7('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x88a7('0x17')},'dialCutDigit':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88a7('0x18')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88a7('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88a7('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88a7('0x1b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88a7('0x1c')},'dialMachineMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88a7('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x88a7('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x88a7('0x8')](0x3)[_0x88a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x88a7('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x88a7('0x8')](0x5)[_0x88a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xcd3b=['#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\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcd3b,0x8b));var _0xbcd3=function(_0x16ded5,_0x56d67c){_0x16ded5=_0x16ded5-0x0;var _0x371b52=_0xcd3b[_0x16ded5];return _0x371b52;};'use strict';var Sequelize=require(_0xbcd3('0x0'));module[_0xbcd3('0x1')]={'name':{'type':Sequelize[_0xbcd3('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xbcd3('0x3')](_0xbcd3('0x4')),'allowNull':![],'defaultValue':_0xbcd3('0x4')},'description':{'type':Sequelize[_0xbcd3('0x2')]},'active':{'type':Sequelize[_0xbcd3('0x5')],'defaultValue':0x0,'comment':_0xbcd3('0x6')},'limitCalls':{'type':Sequelize[_0xbcd3('0x7')](0x4)[_0xbcd3('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xbcd3('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbcd3('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xbcd3('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)[_0xbcd3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbcd3('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbcd3('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbcd3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbcd3('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbcd3('0x7')](0x5)[_0xbcd3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)[_0xbcd3('0x8')],'defaultValue':0x3,'comment':_0xbcd3('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbcd3('0x7')](0x5)[_0xbcd3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)[_0xbcd3('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbcd3('0x10')},'dialTimezone':{'type':Sequelize[_0xbcd3('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbcd3('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xbcd3('0x3')](_0xbcd3('0x12'),'never',_0xbcd3('0x13')),'defaultValue':_0xbcd3('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbcd3('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbcd3('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbcd3('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbcd3('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbcd3('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbcd3('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbcd3('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbcd3('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbcd3('0x7')](0x5)[_0xbcd3('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbcd3('0x7')](0x9)[_0xbcd3('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbcd3('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbcd3('0x3')](_0xbcd3('0x1d'),'ASC'),'defaultValue':_0xbcd3('0x1d')},'dialPrefix':{'type':Sequelize[_0xbcd3('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbcd3('0x7')](0x3)[_0xbcd3('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbcd3('0x1e')},'dialCutDigit':{'type':Sequelize[_0xbcd3('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbcd3('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)[_0xbcd3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbcd3('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbcd3('0x7')](0x5)[_0xbcd3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)[_0xbcd3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbcd3('0x22')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbcd3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbcd3('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbcd3('0x7')](0x5)[_0xbcd3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)[_0xbcd3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbcd3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbcd3('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbcd3('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbcd3('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2c74a16..41af827 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 _0xd1d3=['index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','role','userProfileId','getHoppers','findOne','CmHopper','getHopperHistories','order','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','cm_hopper_additional_phones','cmHopperId','h.id','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','IvrCampaigns','UserProfileResource','sendStatus','error','name'];(function(_0x2cbb6b,_0xbc776d){var _0x2f98a1=function(_0x1eb9dd){while(--_0x1eb9dd){_0x2cbb6b['push'](_0x2cbb6b['shift']());}};_0x2f98a1(++_0xbc776d);}(_0xd1d3,0x68));var _0x3d1d=function(_0x5e35ab,_0x315186){_0x5e35ab=_0x5e35ab-0x0;var _0x44a8f0=_0xd1d3[_0x5e35ab];return _0x44a8f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d1d('0x0'));var zipdir=require(_0x3d1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d1d('0x2'));var Mustache=require(_0x3d1d('0x3'));var util=require('util');var path=require(_0x3d1d('0x4'));var sox=require(_0x3d1d('0x5'));var csv=require('to-csv');var ejs=require(_0x3d1d('0x6'));var fs=require('fs');var fs_extra=require(_0x3d1d('0x7'));var _=require(_0x3d1d('0x8'));var squel=require('squel');var crypto=require(_0x3d1d('0x9'));var jsforce=require(_0x3d1d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3d1d('0xb'));var querystring=require('querystring');var Papa=require(_0x3d1d('0xc'));var Redis=require('ioredis');var authService=require(_0x3d1d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x3d1d('0xe'));var hardwareService=require(_0x3d1d('0xf'));var logger=require(_0x3d1d('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d1d('0x11'))['db'];function respondWithStatusCode(_0x4a5005,_0xd725fe){_0xd725fe=_0xd725fe||0xcc;return function(_0x1bc123){if(_0x1bc123){return _0x4a5005['sendStatus'](_0xd725fe);}return _0x4a5005[_0x3d1d('0x12')](_0xd725fe)[_0x3d1d('0x13')]();};}function respondWithResult(_0x28e129,_0x374296){_0x374296=_0x374296||0xc8;return function(_0x36aede){if(_0x36aede){return _0x28e129['status'](_0x374296)[_0x3d1d('0x14')](_0x36aede);}};}function respondWithFilteredResult(_0x3e1f54,_0x2614db){return function(_0x3f7fbb){if(_0x3f7fbb){var _0x2453bc=typeof _0x2614db[_0x3d1d('0x15')]===_0x3d1d('0x16')&&typeof _0x2614db['limit']===_0x3d1d('0x16');var _0x3c52ba=_0x3f7fbb[_0x3d1d('0x17')];var _0x630b4a=_0x2453bc?0x0:_0x2614db[_0x3d1d('0x15')];var _0x257dc2=_0x2453bc?_0x3f7fbb[_0x3d1d('0x17')]:_0x2614db[_0x3d1d('0x15')]+_0x2614db[_0x3d1d('0x18')];var _0x5e0cf2;if(_0x257dc2>=_0x3c52ba){_0x257dc2=_0x3c52ba;_0x5e0cf2=0xc8;}else{_0x5e0cf2=0xce;}_0x3e1f54[_0x3d1d('0x12')](_0x5e0cf2);return _0x3e1f54[_0x3d1d('0x19')](_0x3d1d('0x1a'),_0x630b4a+'-'+_0x257dc2+'/'+_0x3c52ba)[_0x3d1d('0x14')](_0x3f7fbb);}return null;};}function patchUpdates(_0xca4143){return function(_0x129b25){try{jsonpatch[_0x3d1d('0x1b')](_0x129b25,_0xca4143,!![]);}catch(_0x568673){return BPromise['reject'](_0x568673);}return _0x129b25[_0x3d1d('0x1c')]();};}function saveUpdates(_0x452929,_0x30fa6f){return function(_0x1cab9a){if(_0x1cab9a){return _0x1cab9a[_0x3d1d('0x1d')](_0x452929)[_0x3d1d('0x1e')](function(_0x4bb782){return _0x4bb782;});}return null;};}function removeEntity(_0x596af5,_0x4420fb){return function(_0x4e3686){if(_0x4e3686){return _0x4e3686[_0x3d1d('0x1f')]()['then'](function(){var _0x265686=_0x4e3686['get']({'plain':!![]});var _0x5c8952=_0x3d1d('0x20');return db[_0x3d1d('0x21')][_0x3d1d('0x1f')]({'where':{'type':_0x5c8952,'resourceId':_0x265686['id']}})['then'](function(){return _0x4e3686;});})[_0x3d1d('0x1e')](function(){_0x596af5[_0x3d1d('0x12')](0xcc)[_0x3d1d('0x13')]();});}};}function handleEntityNotFound(_0x4cc223,_0x4b0e1d){return function(_0x18d7d5){if(!_0x18d7d5){_0x4cc223[_0x3d1d('0x22')](0x194);}return _0x18d7d5;};}function handleError(_0x155486,_0x3beaac){_0x3beaac=_0x3beaac||0x1f4;return function(_0x3b399b){logger[_0x3d1d('0x23')](_0x3b399b['stack']);if(_0x3b399b[_0x3d1d('0x24')]){delete _0x3b399b['name'];}_0x155486['status'](_0x3beaac)['send'](_0x3b399b);};}exports[_0x3d1d('0x25')]=function(_0x42de03,_0x5ee1fd){var _0x215d5e={},_0x1029b6={},_0x330146={'count':0x0,'rows':[]};var _0x35f7f9=_[_0x3d1d('0x26')](db[_0x3d1d('0x27')][_0x3d1d('0x28')],function(_0x4f0d9d){return{'name':_0x4f0d9d[_0x3d1d('0x29')],'type':_0x4f0d9d[_0x3d1d('0x2a')][_0x3d1d('0x2b')]};});_0x1029b6[_0x3d1d('0x2c')]=_[_0x3d1d('0x26')](_0x35f7f9,'name');_0x1029b6[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x42de03[_0x3d1d('0x2d')]);_0x1029b6['filters']=_[_0x3d1d('0x2f')](_0x1029b6[_0x3d1d('0x2c')],_0x1029b6[_0x3d1d('0x2d')]);_0x215d5e['attributes']=_['intersection'](_0x1029b6['model'],qs[_0x3d1d('0x30')](_0x42de03['query'][_0x3d1d('0x30')]));_0x215d5e[_0x3d1d('0x31')]=_0x215d5e[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x215d5e['attributes']:_0x1029b6[_0x3d1d('0x2c')];if(!_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x215d5e[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x215d5e['offset']=qs['offset'](_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x15')]);}_0x215d5e['order']=qs[_0x3d1d('0x35')](_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x35')]);_0x215d5e[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_[_0x3d1d('0x38')](_0x42de03[_0x3d1d('0x2d')],_0x1029b6[_0x3d1d('0x37')]),_0x35f7f9);if(_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x215d5e[_0x3d1d('0x36')]=_['merge'](_0x215d5e[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x35f7f9,function(_0x3b1c01){if(_0x3b1c01[_0x3d1d('0x2a')]!==_0x3d1d('0x3a')){var _0x2b7cbe={};_0x2b7cbe[_0x3b1c01[_0x3d1d('0x24')]]={'$like':'%'+_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x2b7cbe;}})});}_0x215d5e=_[_0x3d1d('0x3b')]({},_0x215d5e,_0x42de03[_0x3d1d('0x3c')]);var _0x2f4caf={'where':_0x215d5e[_0x3d1d('0x36')]};return db[_0x3d1d('0x27')][_0x3d1d('0x17')](_0x2f4caf)['then'](function(_0x4a58d5){_0x330146[_0x3d1d('0x17')]=_0x4a58d5;if(_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x215d5e['include']=[{'all':!![]}];}return db['Campaign'][_0x3d1d('0x3e')](_0x215d5e);})[_0x3d1d('0x1e')](function(_0x326177){_0x330146[_0x3d1d('0x3f')]=_0x326177;return _0x330146;})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x5ee1fd,_0x215d5e))[_0x3d1d('0x40')](handleError(_0x5ee1fd,null));};exports[_0x3d1d('0x41')]=function(_0x15c424,_0x199285){var _0x1edb1b={'raw':![],'where':{'id':_0x15c424[_0x3d1d('0x42')]['id']}},_0x496a8e={};_0x496a8e[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db['Campaign']['rawAttributes']);_0x496a8e[_0x3d1d('0x2d')]=_['keys'](_0x15c424['query']);_0x496a8e['filters']=_[_0x3d1d('0x2f')](_0x496a8e[_0x3d1d('0x2c')],_0x496a8e[_0x3d1d('0x2d')]);_0x1edb1b['attributes']=_['intersection'](_0x496a8e[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x15c424[_0x3d1d('0x2d')]['fields']));_0x1edb1b[_0x3d1d('0x31')]=_0x1edb1b['attributes'][_0x3d1d('0x32')]?_0x1edb1b[_0x3d1d('0x31')]:_0x496a8e[_0x3d1d('0x2c')];if(_0x15c424[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x1edb1b['include']=[{'all':!![]}];}_0x1edb1b=_[_0x3d1d('0x3b')]({},_0x1edb1b,_0x15c424[_0x3d1d('0x3c')]);return db[_0x3d1d('0x27')][_0x3d1d('0x43')](_0x1edb1b)[_0x3d1d('0x1e')](handleEntityNotFound(_0x199285,null))[_0x3d1d('0x1e')](respondWithResult(_0x199285,null))[_0x3d1d('0x40')](handleError(_0x199285,null));};exports[_0x3d1d('0x44')]=function(_0x21c54b,_0x31658b){return db['Campaign']['create'](_0x21c54b[_0x3d1d('0x45')],{})[_0x3d1d('0x1e')](function(_0xbdf332){var _0x2a5a0d=_0x21c54b['user']['get']({'plain':!![]});if(!_0x2a5a0d)throw new Error(_0x3d1d('0x46'));if(_0x2a5a0d['role']===_0x3d1d('0x47')){var _0x1009da=_0xbdf332[_0x3d1d('0x48')]({'plain':!![]});var _0x35c2f9=_0x3d1d('0x20');return db[_0x3d1d('0x49')][_0x3d1d('0x43')]({'where':{'name':_0x35c2f9,'userProfileId':_0x2a5a0d['userProfileId']},'raw':!![]})['then'](function(_0x13c88a){if(_0x13c88a&&_0x13c88a[_0x3d1d('0x4a')]===0x0){return db[_0x3d1d('0x21')][_0x3d1d('0x44')]({'name':_0x1009da[_0x3d1d('0x24')],'resourceId':_0x1009da['id'],'type':_0x13c88a[_0x3d1d('0x24')],'sectionId':_0x13c88a['id']},{})[_0x3d1d('0x1e')](function(){return _0xbdf332;});}else{return _0xbdf332;}})['catch'](function(_0x1db497){logger[_0x3d1d('0x23')](_0x3d1d('0x4b'),_0x1db497);throw _0x1db497;});}return _0xbdf332;})['then'](respondWithResult(_0x31658b,0xc9))[_0x3d1d('0x40')](handleError(_0x31658b,null));};exports[_0x3d1d('0x4c')]=function(_0x11b3a3,_0xdf6a0){var _0x5b1dd2={'where':{'id':_0x11b3a3[_0x3d1d('0x42')]['id']}},_0x4b3b18={};_0x4b3b18[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db[_0x3d1d('0x27')]['rawAttributes']);_0x5b1dd2[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x4b3b18[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x11b3a3[_0x3d1d('0x2d')]['fields']));_0x5b1dd2[_0x3d1d('0x31')]=_0x5b1dd2[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x5b1dd2[_0x3d1d('0x31')]:_0x4b3b18['model'];if(_0x11b3a3[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x5b1dd2[_0x3d1d('0x4d')]=[{'all':!![]}];}_0x5b1dd2=_[_0x3d1d('0x3b')]({},_0x5b1dd2,_0x11b3a3['options']);return db['Campaign'][_0x3d1d('0x43')](_0x5b1dd2)['then'](handleEntityNotFound(_0xdf6a0,null))[_0x3d1d('0x1e')](function(_0x4e2dcb){if(_0x4e2dcb){var _0x9c44ff=_0x4e2dcb['get']({'plain':!![]});_0x9c44ff=qs[_0x3d1d('0x4e')](_0x9c44ff,['id',_0x3d1d('0x4f'),_0x3d1d('0x50')]);_0x11b3a3[_0x3d1d('0x45')]=_[_0x3d1d('0x4e')](_0x11b3a3[_0x3d1d('0x45')],['id',_0x3d1d('0x4f'),_0x3d1d('0x50')]);return db[_0x3d1d('0x27')][_0x3d1d('0x44')](_[_0x3d1d('0x3b')](_0x9c44ff,_0x11b3a3[_0x3d1d('0x45')]),{'include':_0x11b3a3['query'][_0x3d1d('0x3d')]?[{'all':!![]}]:undefined})[_0x3d1d('0x1e')](function(_0x3f5c45){var _0x5452b8=_0x11b3a3[_0x3d1d('0x47')][_0x3d1d('0x48')]({'plain':!![]});if(!_0x5452b8)throw new Error(_0x3d1d('0x46'));if(_0x5452b8[_0x3d1d('0x51')]==='user'){var _0x584387=_0x3f5c45[_0x3d1d('0x48')]({'plain':!![]});var _0x59490a=_0x3d1d('0x20');return db['UserProfileSection'][_0x3d1d('0x43')]({'where':{'name':_0x59490a,'userProfileId':_0x5452b8[_0x3d1d('0x52')]},'raw':!![]})[_0x3d1d('0x1e')](function(_0x2a86f1){if(_0x2a86f1&&_0x2a86f1[_0x3d1d('0x4a')]===0x0){return db[_0x3d1d('0x21')][_0x3d1d('0x44')]({'name':_0x584387[_0x3d1d('0x24')],'resourceId':_0x584387['id'],'type':_0x2a86f1['name'],'sectionId':_0x2a86f1['id']},{})[_0x3d1d('0x1e')](function(){return _0x3f5c45;});}else{return _0x3f5c45;}})['catch'](function(_0x9d219d){logger[_0x3d1d('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9d219d);throw _0x9d219d;});}return _0x3f5c45;});}})[_0x3d1d('0x1e')](respondWithResult(_0xdf6a0,0xc9))[_0x3d1d('0x40')](handleError(_0xdf6a0,null));};exports[_0x3d1d('0x1d')]=function(_0x22fb54,_0x278ad6){if(_0x22fb54[_0x3d1d('0x45')]['id']){delete _0x22fb54[_0x3d1d('0x45')]['id'];}return db['Campaign'][_0x3d1d('0x43')]({'where':{'id':_0x22fb54[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x278ad6,null))['then'](saveUpdates(_0x22fb54[_0x3d1d('0x45')],null))['then'](respondWithResult(_0x278ad6,null))[_0x3d1d('0x40')](handleError(_0x278ad6,null));};exports['destroy']=function(_0x2fe10e,_0x9db056){return db[_0x3d1d('0x27')]['find']({'where':{'id':_0x2fe10e['params']['id']}})['then'](handleEntityNotFound(_0x9db056,null))['then'](removeEntity(_0x9db056,null))[_0x3d1d('0x40')](handleError(_0x9db056,null));};exports[_0x3d1d('0x53')]=function(_0x2f0c5c,_0x1a4f28,_0x4f8f7b){var _0x53eda1={'raw':!![],'where':{}};var _0x21ae9e={};var _0x3ed221={'count':0x0,'rows':[]};return db[_0x3d1d('0x27')][_0x3d1d('0x54')]({'where':{'id':_0x2f0c5c[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a4f28,null))['then'](function(_0x7c771f){if(_0x7c771f){_0x21ae9e['model']=_[_0x3d1d('0x2e')](db[_0x3d1d('0x55')][_0x3d1d('0x28')]);_0x21ae9e[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x2f0c5c[_0x3d1d('0x2d')]);_0x21ae9e['filters']=_['intersection'](_0x21ae9e[_0x3d1d('0x2c')],_0x21ae9e[_0x3d1d('0x2d')]);_0x53eda1[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x21ae9e[_0x3d1d('0x2c')],qs['fields'](_0x2f0c5c['query'][_0x3d1d('0x30')]));_0x53eda1['attributes']=_0x53eda1[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x53eda1[_0x3d1d('0x31')]:_0x21ae9e['model'];if(!_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x33')]('nolimit')){_0x53eda1['limit']=qs[_0x3d1d('0x18')](_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x53eda1[_0x3d1d('0x15')]=qs['offset'](_0x2f0c5c[_0x3d1d('0x2d')]['offset']);}_0x53eda1['order']=qs[_0x3d1d('0x35')](_0x2f0c5c['query'][_0x3d1d('0x35')]);_0x53eda1[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_['pick'](_0x2f0c5c['query'],_0x21ae9e[_0x3d1d('0x37')]));_0x53eda1[_0x3d1d('0x36')]['CampaignId']=_0x7c771f['id'];if(_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x53eda1[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x53eda1[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x53eda1['attributes'],function(_0x4b1629){var _0x41d6d5={};_0x41d6d5[_0x4b1629]={'$like':'%'+_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x41d6d5;})});}_0x53eda1=_[_0x3d1d('0x3b')]({},_0x53eda1,_0x2f0c5c[_0x3d1d('0x3c')]);return db['CmHopper'][_0x3d1d('0x17')]({'where':_0x53eda1[_0x3d1d('0x36')]})[_0x3d1d('0x1e')](function(_0x74eb92){_0x3ed221[_0x3d1d('0x17')]=_0x74eb92;if(_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x53eda1[_0x3d1d('0x4d')]=[{'all':!![]}];}return db[_0x3d1d('0x55')][_0x3d1d('0x3e')](_0x53eda1);})[_0x3d1d('0x1e')](function(_0x15db8a){_0x3ed221['rows']=_0x15db8a;return _0x3ed221;});}})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x1a4f28,_0x53eda1))[_0x3d1d('0x40')](handleError(_0x1a4f28,null));};exports[_0x3d1d('0x56')]=function(_0x1cc57f,_0x2a1f31,_0x54fe64){var _0x4886af={'raw':!![],'where':{}};var _0x54a6df={};var _0x49759d={'count':0x0,'rows':[]};return db['Campaign'][_0x3d1d('0x54')]({'where':{'id':_0x1cc57f[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x2a1f31,null))[_0x3d1d('0x1e')](function(_0x2bc0fc){if(_0x2bc0fc){_0x54a6df[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db['CmHopperHistory'][_0x3d1d('0x28')]);_0x54a6df['query']=_[_0x3d1d('0x2e')](_0x1cc57f[_0x3d1d('0x2d')]);_0x54a6df['filters']=_['intersection'](_0x54a6df[_0x3d1d('0x2c')],_0x54a6df['query']);_0x4886af[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x54a6df[_0x3d1d('0x2c')],qs['fields'](_0x1cc57f['query']['fields']));_0x4886af[_0x3d1d('0x31')]=_0x4886af[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x4886af[_0x3d1d('0x31')]:_0x54a6df[_0x3d1d('0x2c')];if(!_0x1cc57f['query'][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x4886af[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x1cc57f[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x4886af[_0x3d1d('0x15')]=qs['offset'](_0x1cc57f['query'][_0x3d1d('0x15')]);}_0x4886af[_0x3d1d('0x57')]=qs[_0x3d1d('0x35')](_0x1cc57f[_0x3d1d('0x2d')]['sort']);_0x4886af[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_[_0x3d1d('0x38')](_0x1cc57f[_0x3d1d('0x2d')],_0x54a6df[_0x3d1d('0x37')]));_0x4886af[_0x3d1d('0x36')][_0x3d1d('0x58')]=_0x2bc0fc['id'];if(_0x1cc57f[_0x3d1d('0x2d')]['filter']){_0x4886af[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x4886af[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x4886af[_0x3d1d('0x31')],function(_0x2a6530){var _0x42b8e9={};_0x42b8e9[_0x2a6530]={'$like':'%'+_0x1cc57f['query'][_0x3d1d('0x39')]+'%'};return _0x42b8e9;})});}_0x4886af=_[_0x3d1d('0x3b')]({},_0x4886af,_0x1cc57f['options']);return db['CmHopperHistory'][_0x3d1d('0x17')]({'where':_0x4886af[_0x3d1d('0x36')]})[_0x3d1d('0x1e')](function(_0x89f6e1){_0x49759d[_0x3d1d('0x17')]=_0x89f6e1;if(_0x1cc57f['query'][_0x3d1d('0x3d')]){_0x4886af['include']=[{'all':!![]}];}return db[_0x3d1d('0x59')]['findAll'](_0x4886af);})[_0x3d1d('0x1e')](function(_0x1ce410){_0x49759d['rows']=_0x1ce410;return _0x49759d;});}})['then'](respondWithFilteredResult(_0x2a1f31,_0x4886af))[_0x3d1d('0x40')](handleError(_0x2a1f31,null));};exports[_0x3d1d('0x5a')]=function(_0x594e42,_0x12c344,_0x242dd3){var _0x2a6bb5={'raw':!![],'where':{}};var _0x3e3c75={};var _0x4e0e80={'count':0x0,'rows':[]};return db[_0x3d1d('0x27')]['findOne']({'where':{'id':_0x594e42['params']['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x12c344,null))['then'](function(_0x19b723){if(_0x19b723){_0x3e3c75[_0x3d1d('0x2c')]=_['keys'](db[_0x3d1d('0x5b')][_0x3d1d('0x28')]);_0x3e3c75[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x594e42[_0x3d1d('0x2d')]);_0x3e3c75['filters']=_['intersection'](_0x3e3c75['model'],_0x3e3c75[_0x3d1d('0x2d')]);_0x2a6bb5[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x3e3c75[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x594e42['query'][_0x3d1d('0x30')]));_0x2a6bb5[_0x3d1d('0x31')]=_0x2a6bb5[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x2a6bb5[_0x3d1d('0x31')]:_0x3e3c75[_0x3d1d('0x2c')];if(!_0x594e42[_0x3d1d('0x2d')]['hasOwnProperty'](_0x3d1d('0x34'))){_0x2a6bb5[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x2a6bb5['offset']=qs[_0x3d1d('0x15')](_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x15')]);}_0x2a6bb5[_0x3d1d('0x57')]=qs[_0x3d1d('0x35')](_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x35')]);_0x2a6bb5[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_[_0x3d1d('0x38')](_0x594e42[_0x3d1d('0x2d')],_0x3e3c75[_0x3d1d('0x37')]));_0x2a6bb5[_0x3d1d('0x36')][_0x3d1d('0x58')]=_0x19b723['id'];if(_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x2a6bb5[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x2a6bb5[_0x3d1d('0x36')],{'$or':_['map'](_0x2a6bb5[_0x3d1d('0x31')],function(_0x2d0e07){var _0x5f2b37={};_0x5f2b37[_0x2d0e07]={'$like':'%'+_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x5f2b37;})});}_0x2a6bb5=_[_0x3d1d('0x3b')]({},_0x2a6bb5,_0x594e42['options']);return db[_0x3d1d('0x5b')][_0x3d1d('0x17')]({'where':_0x2a6bb5['where']})[_0x3d1d('0x1e')](function(_0x540a95){_0x4e0e80['count']=_0x540a95;if(_0x594e42['query']['includeAll']){_0x2a6bb5[_0x3d1d('0x4d')]=[{'all':!![]}];}return db[_0x3d1d('0x5b')][_0x3d1d('0x3e')](_0x2a6bb5);})[_0x3d1d('0x1e')](function(_0x28027d){_0x4e0e80[_0x3d1d('0x3f')]=_0x28027d;return _0x4e0e80;});}})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x12c344,_0x2a6bb5))[_0x3d1d('0x40')](handleError(_0x12c344,null));};exports[_0x3d1d('0x5c')]=function(_0x316a85,_0x32b24b,_0x3feb37){var _0x3f33be={'raw':!![],'where':{}};var _0x3b24ac={};var _0xd0958f={'count':0x0,'rows':[]};return db['Campaign'][_0x3d1d('0x54')]({'where':{'id':_0x316a85[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x32b24b,null))[_0x3d1d('0x1e')](function(_0x20b64a){if(_0x20b64a){_0x3b24ac[_0x3d1d('0x2c')]=_['keys'](db[_0x3d1d('0x5d')][_0x3d1d('0x28')]);_0x3b24ac[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x316a85[_0x3d1d('0x2d')]);_0x3b24ac[_0x3d1d('0x37')]=_[_0x3d1d('0x2f')](_0x3b24ac[_0x3d1d('0x2c')],_0x3b24ac[_0x3d1d('0x2d')]);_0x3f33be[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x3b24ac[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x316a85[_0x3d1d('0x2d')][_0x3d1d('0x30')]));_0x3f33be[_0x3d1d('0x31')]=_0x3f33be[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x3f33be[_0x3d1d('0x31')]:_0x3b24ac[_0x3d1d('0x2c')];if(!_0x316a85[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x3f33be[_0x3d1d('0x18')]=qs['limit'](_0x316a85[_0x3d1d('0x2d')]['limit']);_0x3f33be['offset']=qs['offset'](_0x316a85[_0x3d1d('0x2d')]['offset']);}_0x3f33be['order']=qs[_0x3d1d('0x35')](_0x316a85['query']['sort']);_0x3f33be[_0x3d1d('0x36')]=qs['filters'](_['pick'](_0x316a85[_0x3d1d('0x2d')],_0x3b24ac[_0x3d1d('0x37')]));_0x3f33be['where'][_0x3d1d('0x58')]=_0x20b64a['id'];if(_0x316a85[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x3f33be[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x3f33be[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x3f33be[_0x3d1d('0x31')],function(_0x150ffd){var _0x662e3a={};_0x662e3a[_0x150ffd]={'$like':'%'+_0x316a85['query'][_0x3d1d('0x39')]+'%'};return _0x662e3a;})});}_0x3f33be=_[_0x3d1d('0x3b')]({},_0x3f33be,_0x316a85['options']);return db[_0x3d1d('0x5d')][_0x3d1d('0x17')]({'where':_0x3f33be[_0x3d1d('0x36')]})[_0x3d1d('0x1e')](function(_0x105055){_0xd0958f[_0x3d1d('0x17')]=_0x105055;if(_0x316a85['query'][_0x3d1d('0x3d')]){_0x3f33be[_0x3d1d('0x4d')]=[{'all':!![]}];}return db[_0x3d1d('0x5d')]['findAll'](_0x3f33be);})[_0x3d1d('0x1e')](function(_0x3edefb){_0xd0958f[_0x3d1d('0x3f')]=_0x3edefb;return _0xd0958f;});}})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x32b24b,_0x3f33be))[_0x3d1d('0x40')](handleError(_0x32b24b,null));};exports[_0x3d1d('0x5e')]=function(_0x32ecc4,_0x5258b1,_0x478bcb){var _0x3cdbf3={};var _0x585349={};var _0x4583ae;var _0x2f2f0b;return db[_0x3d1d('0x27')]['findOne']({'where':{'id':_0x32ecc4[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x5258b1,null))[_0x3d1d('0x1e')](function(_0x1ab59f){if(_0x1ab59f){_0x4583ae=_0x1ab59f;_0x585349[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db[_0x3d1d('0x5f')][_0x3d1d('0x28')]);_0x585349[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x32ecc4[_0x3d1d('0x2d')]);_0x585349[_0x3d1d('0x37')]=_[_0x3d1d('0x2f')](_0x585349[_0x3d1d('0x2c')],_0x585349[_0x3d1d('0x2d')]);_0x3cdbf3[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x585349[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x30')]));_0x3cdbf3[_0x3d1d('0x31')]=_0x3cdbf3[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x3cdbf3['attributes']:_0x585349[_0x3d1d('0x2c')];_0x3cdbf3['order']=qs['sort'](_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x35')]);_0x3cdbf3[_0x3d1d('0x36')]=qs['filters'](_[_0x3d1d('0x38')](_0x32ecc4['query'],_0x585349[_0x3d1d('0x37')]));if(_0x32ecc4[_0x3d1d('0x2d')]['filter']){_0x3cdbf3['where']=_['merge'](_0x3cdbf3['where'],{'$or':_['map'](_0x3cdbf3[_0x3d1d('0x31')],function(_0x210107){var _0x126b6e={};_0x126b6e[_0x210107]={'$like':'%'+_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x126b6e;})});}_0x3cdbf3=_[_0x3d1d('0x3b')]({},_0x3cdbf3,_0x32ecc4[_0x3d1d('0x3c')]);return _0x4583ae[_0x3d1d('0x5e')](_0x3cdbf3);}})['then'](function(_0x589906){if(_0x589906){_0x2f2f0b=_0x589906[_0x3d1d('0x32')];if(!_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x3cdbf3['limit']=qs['limit'](_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x3cdbf3['offset']=qs['offset'](_0x32ecc4['query'][_0x3d1d('0x15')]);}return _0x4583ae['getLists'](_0x3cdbf3);}})[_0x3d1d('0x1e')](function(_0x539a00){if(_0x539a00){return _0x539a00?{'count':_0x2f2f0b,'rows':_0x539a00}:null;}})[_0x3d1d('0x1e')](respondWithResult(_0x5258b1,null))['catch'](handleError(_0x5258b1,null));};exports[_0x3d1d('0x60')]=function(_0x5884ac,_0x49c5ee,_0xa28476){var _0xea1882,_0x16366d;var _0xbd17f3=[];var _0x2fe902=moment()['format'](_0x3d1d('0x61'));return db['Campaign'][_0x3d1d('0x43')]({'where':{'id':_0x5884ac[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x49c5ee,null))['then'](function(_0x1cbfe0){if(_0x1cbfe0){_0x16366d=_0x1cbfe0;return _0x1cbfe0[_0x3d1d('0x60')](_0x5884ac[_0x3d1d('0x45')][_0x3d1d('0x62')],_[_0x3d1d('0x4e')](_0x5884ac[_0x3d1d('0x45')],[_0x3d1d('0x62'),'id'])||{});}return null;})['spread'](function(_0x3d0f25){var _0x1afb62;var _0x531884;_0xea1882=_0x3d0f25||[];var _0x4f735b=[];if(_0x3d0f25){for(var _0xf40d69=0x0;_0xf40d69<_0x3d0f25['length'];_0xf40d69+=0x1){var _0x381b9b=_0x3d0f25[_0xf40d69]['get']({'plain':!![]});_0x16366d[_0x3d1d('0x63')]=_0x5884ac[_0x3d1d('0x45')]['dialCheckDuplicateType']?_0x5884ac[_0x3d1d('0x45')]['dialCheckDuplicateType']:_0x16366d['dialCheckDuplicateType'];switch(_0x16366d[_0x3d1d('0x63')]){case _0x3d1d('0x64'):_0x1afb62=squel[_0x3d1d('0x65')]()['into'](_0x3d1d('0x66'))['fromQuery']([_0x3d1d('0x67'),_0x3d1d('0x68'),_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),'createdAt',_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x67'),'phone')['field'](_0x3d1d('0x6d'),'scheduledAt')[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))['field'](_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))['field'](_0x5884ac[_0x3d1d('0x42')]['id']['toString'](),'CampaignId')[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x50'))[_0x3d1d('0x70')](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))[_0x3d1d('0x36')](_0x3d1d('0x73'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())[_0x3d1d('0x36')](_0x3d1d('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3d1d('0x6c')](_0x3d1d('0x75'))[_0x3d1d('0x70')](_0x3d1d('0x76'))[_0x3d1d('0x36')](_0x3d1d('0x77'),_0x5884ac[_0x3d1d('0x42')]['id'][_0x3d1d('0x6f')]()))[_0x3d1d('0x36')](_0x3d1d('0x78'),squel[_0x3d1d('0x6b')]()['field'](_0x3d1d('0x79'))[_0x3d1d('0x70')](_0x3d1d('0x66'))[_0x3d1d('0x36')](_0x3d1d('0x77'),_0x5884ac[_0x3d1d('0x42')]['id']['toString']())))['toString']();break;case _0x3d1d('0x7a'):_0x1afb62=squel['insert']()[_0x3d1d('0x7b')]('cm_hopper')['fromQuery']([_0x3d1d('0x67'),_0x3d1d('0x68'),_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),_0x3d1d('0x4f'),_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x67'),_0x3d1d('0x67'))[_0x3d1d('0x6c')](_0x3d1d('0x6d'),_0x3d1d('0x68'))[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))[_0x3d1d('0x6c')](_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))[_0x3d1d('0x6c')](_0x5884ac[_0x3d1d('0x42')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x50'))[_0x3d1d('0x70')](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))[_0x3d1d('0x36')](_0x3d1d('0x73'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())[_0x3d1d('0x36')](_0x3d1d('0x74'))[_0x3d1d('0x36')](_0x3d1d('0x78'),squel['select']()[_0x3d1d('0x6c')]('COALESCE(phone,\x27\x27)')['from'](_0x3d1d('0x66'))[_0x3d1d('0x36')](_0x3d1d('0x77'),_0x5884ac['params']['id'][_0x3d1d('0x6f')]())))[_0x3d1d('0x6f')]();break;default:_0x1afb62=squel[_0x3d1d('0x65')]()[_0x3d1d('0x7b')]('cm_hopper')[_0x3d1d('0x7c')]([_0x3d1d('0x67'),'scheduledAt',_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),'createdAt','updatedAt'],squel['select']()['field'](_0x3d1d('0x67'),_0x3d1d('0x67'))[_0x3d1d('0x6c')](_0x3d1d('0x6d'),'scheduledAt')[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))[_0x3d1d('0x6c')](_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))[_0x3d1d('0x6c')](_0x5884ac[_0x3d1d('0x42')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x50'))['from'](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))['where'](_0x3d1d('0x73'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3d1d('0x6f')]();}_0x531884=squel[_0x3d1d('0x65')]()['into'](_0x3d1d('0x7d'))['fromQuery']([_0x3d1d('0x7e'),_0x3d1d('0x68'),_0x3d1d('0x67'),'OrderBy',_0x3d1d('0x4f'),_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x7f'),'id')[_0x3d1d('0x6c')](_0x3d1d('0x6d'),_0x3d1d('0x68'))[_0x3d1d('0x6c')]('ci.item',_0x3d1d('0x67'))['field']('ci.OrderBY',_0x3d1d('0x80'))['field']('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27','updatedAt')[_0x3d1d('0x70')](_0x3d1d('0x81'),'ci')[_0x3d1d('0x82')](_0x3d1d('0x66'),'h',_0x3d1d('0x83'))[_0x3d1d('0x36')](_0x3d1d('0x84'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())['where']('h.CampaignId=?',_0x5884ac[_0x3d1d('0x42')]['id'][_0x3d1d('0x6f')]())[_0x3d1d('0x36')]('h.createdAt\x20=\x20?',_0x2fe902))[_0x3d1d('0x6f')]();_0x4f735b['push'](db[_0x3d1d('0x85')][_0x3d1d('0x2d')](_0x1afb62));_0xbd17f3[_0x3d1d('0x86')](db[_0x3d1d('0x85')][_0x3d1d('0x2d')](_0x531884));}return BPromise[_0x3d1d('0x87')](_0x4f735b);}})['then'](function(){return BPromise['all'](_0xbd17f3);})['then'](function(){return _0xea1882;})['then'](respondWithResult(_0x49c5ee,null))[_0x3d1d('0x40')](handleError(_0x49c5ee,null));};exports[_0x3d1d('0x88')]=function(_0x5f2417,_0x496606,_0xa25353){return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0x5f2417[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x496606,null))['then'](function(_0x5d9f28){if(_0x5d9f28){return _0x5d9f28[_0x3d1d('0x88')](_0x5f2417[_0x3d1d('0x2d')]['ids']);}})['then'](function(_0x30297a){if(_0x30297a){return db[_0x3d1d('0x55')][_0x3d1d('0x1f')]({'where':{'ListId':_0x5f2417[_0x3d1d('0x2d')][_0x3d1d('0x62')],'CampaignId':_0x5f2417[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](function(){return _0x30297a;});}})[_0x3d1d('0x1e')](respondWithStatusCode(_0x496606,null))[_0x3d1d('0x40')](handleError(_0x496606,null));};exports[_0x3d1d('0x89')]=function(_0x41a7ae,_0x3d2e12,_0x38f0d8){var _0x1e4f67={};var _0x32902b={};var _0x29b234;var _0x6a54c1;return db[_0x3d1d('0x27')][_0x3d1d('0x54')]({'where':{'id':_0x41a7ae[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d2e12,null))[_0x3d1d('0x1e')](function(_0x42e1a6){if(_0x42e1a6){_0x29b234=_0x42e1a6;_0x32902b[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db[_0x3d1d('0x5f')][_0x3d1d('0x28')]);_0x32902b[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x41a7ae[_0x3d1d('0x2d')]);_0x32902b[_0x3d1d('0x37')]=_['intersection'](_0x32902b[_0x3d1d('0x2c')],_0x32902b[_0x3d1d('0x2d')]);_0x1e4f67[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x32902b[_0x3d1d('0x2c')],qs['fields'](_0x41a7ae['query'][_0x3d1d('0x30')]));_0x1e4f67[_0x3d1d('0x31')]=_0x1e4f67['attributes'][_0x3d1d('0x32')]?_0x1e4f67[_0x3d1d('0x31')]:_0x32902b[_0x3d1d('0x2c')];_0x1e4f67[_0x3d1d('0x57')]=qs['sort'](_0x41a7ae['query'][_0x3d1d('0x35')]);_0x1e4f67[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_['pick'](_0x41a7ae[_0x3d1d('0x2d')],_0x32902b['filters']));if(_0x41a7ae[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x1e4f67['where']=_[_0x3d1d('0x3b')](_0x1e4f67[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x1e4f67[_0x3d1d('0x31')],function(_0x3635f2){var _0x3e3960={};_0x3e3960[_0x3635f2]={'$like':'%'+_0x41a7ae[_0x3d1d('0x2d')]['filter']+'%'};return _0x3e3960;})});}_0x1e4f67=_[_0x3d1d('0x3b')]({},_0x1e4f67,_0x41a7ae[_0x3d1d('0x3c')]);return _0x29b234[_0x3d1d('0x89')](_0x1e4f67);}})['then'](function(_0x3f8e70){if(_0x3f8e70){_0x6a54c1=_0x3f8e70[_0x3d1d('0x32')];if(!_0x41a7ae[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x1e4f67[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x41a7ae[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x1e4f67[_0x3d1d('0x15')]=qs[_0x3d1d('0x15')](_0x41a7ae[_0x3d1d('0x2d')]['offset']);}return _0x29b234[_0x3d1d('0x89')](_0x1e4f67);}})[_0x3d1d('0x1e')](function(_0x43b94c){if(_0x43b94c){return _0x43b94c?{'count':_0x6a54c1,'rows':_0x43b94c}:null;}})[_0x3d1d('0x1e')](respondWithResult(_0x3d2e12,null))['catch'](handleError(_0x3d2e12,null));};exports[_0x3d1d('0x8a')]=function(_0xa52960,_0x588298,_0x49fc3f){var _0x478363,_0x49e39b;var _0x2a80da=[];var _0x446efb=moment()['format'](_0x3d1d('0x61'));return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0xa52960[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x588298,null))[_0x3d1d('0x1e')](function(_0x29b5d8){if(_0x29b5d8){_0x49e39b=_0x29b5d8;return _0x29b5d8[_0x3d1d('0x8a')](_0xa52960[_0x3d1d('0x45')]['ids'],_[_0x3d1d('0x4e')](_0xa52960[_0x3d1d('0x45')],[_0x3d1d('0x62'),'id'])||{});}return null;})[_0x3d1d('0x8b')](function(_0x2de8c7){var _0x508392;var _0x249b57;_0x478363=_0x2de8c7||[];var _0x376048=[];if(_0x2de8c7){for(var _0x41f231=0x0;_0x41f231<_0x2de8c7[_0x3d1d('0x32')];_0x41f231+=0x1){var _0x881406=_0x2de8c7[_0x41f231][_0x3d1d('0x48')]({'plain':!![]});_0x508392=squel[_0x3d1d('0x65')]()[_0x3d1d('0x7b')]('cm_hopper_black')[_0x3d1d('0x7c')]([_0x3d1d('0x67'),_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),_0x3d1d('0x4f'),_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x67'),_0x3d1d('0x67'))[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))['field'](_0x881406[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))[_0x3d1d('0x6c')](_0xa52960['params']['id'][_0x3d1d('0x6f')](),'CampaignId')['field']('NOW()',_0x3d1d('0x4f'))['field'](_0x3d1d('0x6d'),_0x3d1d('0x50'))['from'](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))[_0x3d1d('0x36')](_0x3d1d('0x73'),_0x881406['CmListId'][_0x3d1d('0x6f')]())[_0x3d1d('0x36')](_0x3d1d('0x74')))[_0x3d1d('0x6f')]();_0x376048[_0x3d1d('0x86')](db['sequelize'][_0x3d1d('0x2d')](_0x508392));}return BPromise[_0x3d1d('0x87')](_0x376048);}})[_0x3d1d('0x1e')](function(){return _0x478363;})[_0x3d1d('0x1e')](respondWithResult(_0x588298,null))['catch'](handleError(_0x588298,null));};exports[_0x3d1d('0x8c')]=function(_0x25c087,_0x1865e0,_0x1576f0){return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0x25c087[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x1865e0,null))['then'](function(_0xf55bf7){if(_0xf55bf7){return _0xf55bf7[_0x3d1d('0x8c')](_0x25c087[_0x3d1d('0x2d')]['ids']);}})['then'](function(_0x1342a7){if(_0x1342a7){return db[_0x3d1d('0x5d')]['destroy']({'where':{'ListId':_0x25c087[_0x3d1d('0x2d')]['ids'],'CampaignId':_0x25c087[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](function(){return _0x1342a7;});}})[_0x3d1d('0x1e')](respondWithStatusCode(_0x1865e0,null))[_0x3d1d('0x40')](handleError(_0x1865e0,null));}; \ No newline at end of file +var _0x1177=['fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','NOW()','insert','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','end','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','role','userProfileId','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','into','cm_hopper'];(function(_0x55334a,_0x140452){var _0x2945bd=function(_0x2e3617){while(--_0x2e3617){_0x55334a['push'](_0x55334a['shift']());}};_0x2945bd(++_0x140452);}(_0x1177,0x143));var _0x7117=function(_0x26fc6a,_0x1e7f49){_0x26fc6a=_0x26fc6a-0x0;var _0x5bf15c=_0x1177[_0x26fc6a];return _0x5bf15c;};'use strict';var emlformat=require(_0x7117('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7117('0x1'));var jsonpatch=require(_0x7117('0x2'));var rp=require(_0x7117('0x3'));var moment=require('moment');var BPromise=require(_0x7117('0x4'));var Mustache=require(_0x7117('0x5'));var util=require(_0x7117('0x6'));var path=require(_0x7117('0x7'));var sox=require(_0x7117('0x8'));var csv=require(_0x7117('0x9'));var ejs=require(_0x7117('0xa'));var fs=require('fs');var fs_extra=require(_0x7117('0xb'));var _=require(_0x7117('0xc'));var squel=require('squel');var crypto=require(_0x7117('0xd'));var jsforce=require(_0x7117('0xe'));var deskjs=require(_0x7117('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7117('0x10'));var Papa=require(_0x7117('0x11'));var Redis=require(_0x7117('0x12'));var authService=require(_0x7117('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7117('0x14'));var hardwareService=require(_0x7117('0x15'));var logger=require('../../config/logger')(_0x7117('0x16'));var utils=require(_0x7117('0x17'));var config=require(_0x7117('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165b1a,_0x288cc9){_0x288cc9=_0x288cc9||0xcc;return function(_0x532d3f){if(_0x532d3f){return _0x165b1a[_0x7117('0x19')](_0x288cc9);}return _0x165b1a['status'](_0x288cc9)['end']();};}function respondWithResult(_0x4bf645,_0x244406){_0x244406=_0x244406||0xc8;return function(_0x30342e){if(_0x30342e){return _0x4bf645[_0x7117('0x1a')](_0x244406)[_0x7117('0x1b')](_0x30342e);}};}function respondWithFilteredResult(_0x530040,_0x145e70){return function(_0x5f1be9){if(_0x5f1be9){var _0xe683af=typeof _0x145e70[_0x7117('0x1c')]===_0x7117('0x1d')&&typeof _0x145e70[_0x7117('0x1e')]==='undefined';var _0x227066=_0x5f1be9[_0x7117('0x1f')];var _0x4f32a9=_0xe683af?0x0:_0x145e70['offset'];var _0x3e3163=_0xe683af?_0x5f1be9[_0x7117('0x1f')]:_0x145e70['offset']+_0x145e70[_0x7117('0x1e')];var _0x308e39;if(_0x3e3163>=_0x227066){_0x3e3163=_0x227066;_0x308e39=0xc8;}else{_0x308e39=0xce;}_0x530040[_0x7117('0x1a')](_0x308e39);return _0x530040[_0x7117('0x20')](_0x7117('0x21'),_0x4f32a9+'-'+_0x3e3163+'/'+_0x227066)[_0x7117('0x1b')](_0x5f1be9);}return null;};}function patchUpdates(_0x56b843){return function(_0x10f278){try{jsonpatch['apply'](_0x10f278,_0x56b843,!![]);}catch(_0x458a49){return BPromise[_0x7117('0x22')](_0x458a49);}return _0x10f278[_0x7117('0x23')]();};}function saveUpdates(_0x3098aa,_0x4e9561){return function(_0x45f1e3){if(_0x45f1e3){return _0x45f1e3[_0x7117('0x24')](_0x3098aa)[_0x7117('0x25')](function(_0x296062){return _0x296062;});}return null;};}function removeEntity(_0x52b830,_0x13ed85){return function(_0x15503d){if(_0x15503d){return _0x15503d[_0x7117('0x26')]()[_0x7117('0x25')](function(){var _0x553add=_0x15503d[_0x7117('0x27')]({'plain':!![]});var _0x5e4033=_0x7117('0x28');return db['UserProfileResource'][_0x7117('0x26')]({'where':{'type':_0x5e4033,'resourceId':_0x553add['id']}})[_0x7117('0x25')](function(){return _0x15503d;});})[_0x7117('0x25')](function(){_0x52b830[_0x7117('0x1a')](0xcc)[_0x7117('0x29')]();});}};}function handleEntityNotFound(_0x581570,_0xb28511){return function(_0xdd1b4f){if(!_0xdd1b4f){_0x581570[_0x7117('0x19')](0x194);}return _0xdd1b4f;};}function handleError(_0xc5fb6f,_0x23f3e7){_0x23f3e7=_0x23f3e7||0x1f4;return function(_0x1eb600){logger[_0x7117('0x2a')](_0x1eb600[_0x7117('0x2b')]);if(_0x1eb600[_0x7117('0x2c')]){delete _0x1eb600['name'];}_0xc5fb6f['status'](_0x23f3e7)[_0x7117('0x2d')](_0x1eb600);};}exports[_0x7117('0x2e')]=function(_0x302f6d,_0xa04523){var _0x425a25={},_0x1c1ed1={},_0x412b1d={'count':0x0,'rows':[]};var _0x54c566=_[_0x7117('0x2f')](db[_0x7117('0x30')][_0x7117('0x31')],function(_0x33d762){return{'name':_0x33d762[_0x7117('0x32')],'type':_0x33d762[_0x7117('0x33')][_0x7117('0x34')]};});_0x1c1ed1[_0x7117('0x35')]=_[_0x7117('0x2f')](_0x54c566,_0x7117('0x2c'));_0x1c1ed1[_0x7117('0x36')]=_['keys'](_0x302f6d['query']);_0x1c1ed1[_0x7117('0x37')]=_[_0x7117('0x38')](_0x1c1ed1[_0x7117('0x35')],_0x1c1ed1[_0x7117('0x36')]);_0x425a25[_0x7117('0x39')]=_[_0x7117('0x38')](_0x1c1ed1[_0x7117('0x35')],qs['fields'](_0x302f6d['query'][_0x7117('0x3a')]));_0x425a25[_0x7117('0x39')]=_0x425a25[_0x7117('0x39')][_0x7117('0x3b')]?_0x425a25[_0x7117('0x39')]:_0x1c1ed1[_0x7117('0x35')];if(!_0x302f6d[_0x7117('0x36')]['hasOwnProperty'](_0x7117('0x3c'))){_0x425a25[_0x7117('0x1e')]=qs['limit'](_0x302f6d[_0x7117('0x36')][_0x7117('0x1e')]);_0x425a25['offset']=qs[_0x7117('0x1c')](_0x302f6d[_0x7117('0x36')]['offset']);}_0x425a25[_0x7117('0x3d')]=qs[_0x7117('0x3e')](_0x302f6d['query'][_0x7117('0x3e')]);_0x425a25[_0x7117('0x3f')]=qs['filters'](_[_0x7117('0x40')](_0x302f6d[_0x7117('0x36')],_0x1c1ed1[_0x7117('0x37')]),_0x54c566);if(_0x302f6d[_0x7117('0x36')][_0x7117('0x41')]){_0x425a25[_0x7117('0x3f')]=_[_0x7117('0x42')](_0x425a25[_0x7117('0x3f')],{'$or':_[_0x7117('0x2f')](_0x54c566,function(_0x37777a){if(_0x37777a[_0x7117('0x33')]!=='VIRTUAL'){var _0x21742a={};_0x21742a[_0x37777a[_0x7117('0x2c')]]={'$like':'%'+_0x302f6d[_0x7117('0x36')][_0x7117('0x41')]+'%'};return _0x21742a;}})});}_0x425a25=_[_0x7117('0x42')]({},_0x425a25,_0x302f6d[_0x7117('0x43')]);var _0xca9ae={'where':_0x425a25[_0x7117('0x3f')]};return db[_0x7117('0x30')]['count'](_0xca9ae)[_0x7117('0x25')](function(_0x4bc8a4){_0x412b1d[_0x7117('0x1f')]=_0x4bc8a4;if(_0x302f6d[_0x7117('0x36')][_0x7117('0x44')]){_0x425a25[_0x7117('0x45')]=[{'all':!![]}];}return db[_0x7117('0x30')][_0x7117('0x46')](_0x425a25);})[_0x7117('0x25')](function(_0x4f3ff0){_0x412b1d[_0x7117('0x47')]=_0x4f3ff0;return _0x412b1d;})[_0x7117('0x25')](respondWithFilteredResult(_0xa04523,_0x425a25))['catch'](handleError(_0xa04523,null));};exports[_0x7117('0x48')]=function(_0xa69ee2,_0x50dfa7){var _0x4f0de8={'raw':![],'where':{'id':_0xa69ee2[_0x7117('0x49')]['id']}},_0x112b47={};_0x112b47[_0x7117('0x35')]=_[_0x7117('0x4a')](db[_0x7117('0x30')][_0x7117('0x31')]);_0x112b47['query']=_[_0x7117('0x4a')](_0xa69ee2[_0x7117('0x36')]);_0x112b47[_0x7117('0x37')]=_['intersection'](_0x112b47[_0x7117('0x35')],_0x112b47[_0x7117('0x36')]);_0x4f0de8[_0x7117('0x39')]=_['intersection'](_0x112b47[_0x7117('0x35')],qs[_0x7117('0x3a')](_0xa69ee2[_0x7117('0x36')]['fields']));_0x4f0de8['attributes']=_0x4f0de8[_0x7117('0x39')][_0x7117('0x3b')]?_0x4f0de8[_0x7117('0x39')]:_0x112b47[_0x7117('0x35')];if(_0xa69ee2[_0x7117('0x36')]['includeAll']){_0x4f0de8['include']=[{'all':!![]}];}_0x4f0de8=_[_0x7117('0x42')]({},_0x4f0de8,_0xa69ee2[_0x7117('0x43')]);return db['Campaign'][_0x7117('0x4b')](_0x4f0de8)['then'](handleEntityNotFound(_0x50dfa7,null))['then'](respondWithResult(_0x50dfa7,null))[_0x7117('0x4c')](handleError(_0x50dfa7,null));};exports['create']=function(_0x33543e,_0x336ac7){return db[_0x7117('0x30')]['create'](_0x33543e[_0x7117('0x4d')],{})[_0x7117('0x25')](function(_0x1d39d3){var _0xcbd125=_0x33543e[_0x7117('0x4e')][_0x7117('0x27')]({'plain':!![]});if(!_0xcbd125)throw new Error(_0x7117('0x4f'));if(_0xcbd125['role']===_0x7117('0x4e')){var _0x161b33=_0x1d39d3[_0x7117('0x27')]({'plain':!![]});var _0x64d8ea=_0x7117('0x28');return db[_0x7117('0x50')][_0x7117('0x4b')]({'where':{'name':_0x64d8ea,'userProfileId':_0xcbd125['userProfileId']},'raw':!![]})[_0x7117('0x25')](function(_0x5e47d0){if(_0x5e47d0&&_0x5e47d0[_0x7117('0x51')]===0x0){return db[_0x7117('0x52')][_0x7117('0x53')]({'name':_0x161b33[_0x7117('0x2c')],'resourceId':_0x161b33['id'],'type':_0x5e47d0[_0x7117('0x2c')],'sectionId':_0x5e47d0['id']},{})['then'](function(){return _0x1d39d3;});}else{return _0x1d39d3;}})['catch'](function(_0x542a73){logger['error'](_0x7117('0x54'),_0x542a73);throw _0x542a73;});}return _0x1d39d3;})['then'](respondWithResult(_0x336ac7,0xc9))['catch'](handleError(_0x336ac7,null));};exports['clone']=function(_0xf35b32,_0x5cd0cd){var _0x2b8cc9={'where':{'id':_0xf35b32[_0x7117('0x49')]['id']}},_0x2f9b08={};_0x2f9b08[_0x7117('0x35')]=_[_0x7117('0x4a')](db[_0x7117('0x30')][_0x7117('0x31')]);_0x2b8cc9[_0x7117('0x39')]=_['intersection'](_0x2f9b08[_0x7117('0x35')],qs['fields'](_0xf35b32['query'][_0x7117('0x3a')]));_0x2b8cc9['attributes']=_0x2b8cc9['attributes'][_0x7117('0x3b')]?_0x2b8cc9[_0x7117('0x39')]:_0x2f9b08[_0x7117('0x35')];if(_0xf35b32['query'][_0x7117('0x44')]){_0x2b8cc9[_0x7117('0x45')]=[{'all':!![]}];}_0x2b8cc9=_[_0x7117('0x42')]({},_0x2b8cc9,_0xf35b32['options']);return db['Campaign'][_0x7117('0x4b')](_0x2b8cc9)[_0x7117('0x25')](handleEntityNotFound(_0x5cd0cd,null))[_0x7117('0x25')](function(_0x1ed9e0){if(_0x1ed9e0){var _0x4e8362=_0x1ed9e0[_0x7117('0x27')]({'plain':!![]});_0x4e8362=qs['omit'](_0x4e8362,['id',_0x7117('0x55'),_0x7117('0x56')]);_0xf35b32[_0x7117('0x4d')]=_[_0x7117('0x57')](_0xf35b32[_0x7117('0x4d')],['id',_0x7117('0x55'),'updatedAt']);return db[_0x7117('0x30')][_0x7117('0x53')](_[_0x7117('0x42')](_0x4e8362,_0xf35b32[_0x7117('0x4d')]),{'include':_0xf35b32['query']['includeAll']?[{'all':!![]}]:undefined})[_0x7117('0x25')](function(_0x46f44b){var _0x55af0d=_0xf35b32[_0x7117('0x4e')][_0x7117('0x27')]({'plain':!![]});if(!_0x55af0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55af0d[_0x7117('0x58')]===_0x7117('0x4e')){var _0x68a46b=_0x46f44b['get']({'plain':!![]});var _0x41e5df=_0x7117('0x28');return db[_0x7117('0x50')][_0x7117('0x4b')]({'where':{'name':_0x41e5df,'userProfileId':_0x55af0d[_0x7117('0x59')]},'raw':!![]})['then'](function(_0xeb4fad){if(_0xeb4fad&&_0xeb4fad[_0x7117('0x51')]===0x0){return db[_0x7117('0x52')][_0x7117('0x53')]({'name':_0x68a46b[_0x7117('0x2c')],'resourceId':_0x68a46b['id'],'type':_0xeb4fad[_0x7117('0x2c')],'sectionId':_0xeb4fad['id']},{})[_0x7117('0x25')](function(){return _0x46f44b;});}else{return _0x46f44b;}})['catch'](function(_0x1c9c04){logger['error'](_0x7117('0x54'),_0x1c9c04);throw _0x1c9c04;});}return _0x46f44b;});}})[_0x7117('0x25')](respondWithResult(_0x5cd0cd,0xc9))[_0x7117('0x4c')](handleError(_0x5cd0cd,null));};exports[_0x7117('0x24')]=function(_0x1ec9ba,_0xbc1fe5){if(_0x1ec9ba[_0x7117('0x4d')]['id']){delete _0x1ec9ba[_0x7117('0x4d')]['id'];}return db[_0x7117('0x30')][_0x7117('0x4b')]({'where':{'id':_0x1ec9ba[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0xbc1fe5,null))[_0x7117('0x25')](saveUpdates(_0x1ec9ba['body'],null))[_0x7117('0x25')](respondWithResult(_0xbc1fe5,null))[_0x7117('0x4c')](handleError(_0xbc1fe5,null));};exports['destroy']=function(_0x5a4cf0,_0x54f5ff){return db[_0x7117('0x30')]['find']({'where':{'id':_0x5a4cf0[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x54f5ff,null))['then'](removeEntity(_0x54f5ff,null))[_0x7117('0x4c')](handleError(_0x54f5ff,null));};exports[_0x7117('0x5a')]=function(_0x414dc1,_0x1780b8,_0x34758e){var _0x2582a4={'raw':!![],'where':{}};var _0xd3fb4e={};var _0x2d88c8={'count':0x0,'rows':[]};return db[_0x7117('0x30')][_0x7117('0x5b')]({'where':{'id':_0x414dc1[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x1780b8,null))['then'](function(_0x38f25d){if(_0x38f25d){_0xd3fb4e['model']=_[_0x7117('0x4a')](db[_0x7117('0x5c')][_0x7117('0x31')]);_0xd3fb4e[_0x7117('0x36')]=_[_0x7117('0x4a')](_0x414dc1[_0x7117('0x36')]);_0xd3fb4e[_0x7117('0x37')]=_[_0x7117('0x38')](_0xd3fb4e[_0x7117('0x35')],_0xd3fb4e[_0x7117('0x36')]);_0x2582a4[_0x7117('0x39')]=_['intersection'](_0xd3fb4e['model'],qs['fields'](_0x414dc1['query'][_0x7117('0x3a')]));_0x2582a4[_0x7117('0x39')]=_0x2582a4[_0x7117('0x39')][_0x7117('0x3b')]?_0x2582a4[_0x7117('0x39')]:_0xd3fb4e[_0x7117('0x35')];if(!_0x414dc1[_0x7117('0x36')][_0x7117('0x5d')](_0x7117('0x3c'))){_0x2582a4[_0x7117('0x1e')]=qs[_0x7117('0x1e')](_0x414dc1[_0x7117('0x36')]['limit']);_0x2582a4[_0x7117('0x1c')]=qs[_0x7117('0x1c')](_0x414dc1['query'][_0x7117('0x1c')]);}_0x2582a4[_0x7117('0x3d')]=qs['sort'](_0x414dc1[_0x7117('0x36')]['sort']);_0x2582a4[_0x7117('0x3f')]=qs[_0x7117('0x37')](_[_0x7117('0x40')](_0x414dc1[_0x7117('0x36')],_0xd3fb4e[_0x7117('0x37')]));_0x2582a4[_0x7117('0x3f')][_0x7117('0x5e')]=_0x38f25d['id'];if(_0x414dc1[_0x7117('0x36')]['filter']){_0x2582a4[_0x7117('0x3f')]=_[_0x7117('0x42')](_0x2582a4[_0x7117('0x3f')],{'$or':_[_0x7117('0x2f')](_0x2582a4[_0x7117('0x39')],function(_0x59dcd1){var _0x7286d2={};_0x7286d2[_0x59dcd1]={'$like':'%'+_0x414dc1[_0x7117('0x36')][_0x7117('0x41')]+'%'};return _0x7286d2;})});}_0x2582a4=_['merge']({},_0x2582a4,_0x414dc1[_0x7117('0x43')]);return db['CmHopper'][_0x7117('0x1f')]({'where':_0x2582a4[_0x7117('0x3f')]})[_0x7117('0x25')](function(_0x383254){_0x2d88c8['count']=_0x383254;if(_0x414dc1[_0x7117('0x36')][_0x7117('0x44')]){_0x2582a4['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2582a4);})['then'](function(_0x111fb8){_0x2d88c8['rows']=_0x111fb8;return _0x2d88c8;});}})[_0x7117('0x25')](respondWithFilteredResult(_0x1780b8,_0x2582a4))[_0x7117('0x4c')](handleError(_0x1780b8,null));};exports[_0x7117('0x5f')]=function(_0x34bf03,_0x5ec748,_0x2d1ce7){var _0x3d092e={'raw':!![],'where':{}};var _0x12833d={};var _0x48a084={'count':0x0,'rows':[]};return db['Campaign'][_0x7117('0x5b')]({'where':{'id':_0x34bf03[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x5ec748,null))[_0x7117('0x25')](function(_0x5be58c){if(_0x5be58c){_0x12833d[_0x7117('0x35')]=_['keys'](db[_0x7117('0x60')][_0x7117('0x31')]);_0x12833d[_0x7117('0x36')]=_[_0x7117('0x4a')](_0x34bf03[_0x7117('0x36')]);_0x12833d[_0x7117('0x37')]=_['intersection'](_0x12833d[_0x7117('0x35')],_0x12833d[_0x7117('0x36')]);_0x3d092e[_0x7117('0x39')]=_[_0x7117('0x38')](_0x12833d[_0x7117('0x35')],qs[_0x7117('0x3a')](_0x34bf03[_0x7117('0x36')]['fields']));_0x3d092e[_0x7117('0x39')]=_0x3d092e[_0x7117('0x39')]['length']?_0x3d092e['attributes']:_0x12833d[_0x7117('0x35')];if(!_0x34bf03[_0x7117('0x36')][_0x7117('0x5d')]('nolimit')){_0x3d092e[_0x7117('0x1e')]=qs[_0x7117('0x1e')](_0x34bf03[_0x7117('0x36')][_0x7117('0x1e')]);_0x3d092e['offset']=qs[_0x7117('0x1c')](_0x34bf03[_0x7117('0x36')][_0x7117('0x1c')]);}_0x3d092e['order']=qs[_0x7117('0x3e')](_0x34bf03['query'][_0x7117('0x3e')]);_0x3d092e[_0x7117('0x3f')]=qs[_0x7117('0x37')](_['pick'](_0x34bf03['query'],_0x12833d[_0x7117('0x37')]));_0x3d092e[_0x7117('0x3f')][_0x7117('0x5e')]=_0x5be58c['id'];if(_0x34bf03[_0x7117('0x36')][_0x7117('0x41')]){_0x3d092e[_0x7117('0x3f')]=_[_0x7117('0x42')](_0x3d092e['where'],{'$or':_[_0x7117('0x2f')](_0x3d092e['attributes'],function(_0x529c2f){var _0x171629={};_0x171629[_0x529c2f]={'$like':'%'+_0x34bf03[_0x7117('0x36')][_0x7117('0x41')]+'%'};return _0x171629;})});}_0x3d092e=_['merge']({},_0x3d092e,_0x34bf03[_0x7117('0x43')]);return db[_0x7117('0x60')][_0x7117('0x1f')]({'where':_0x3d092e['where']})[_0x7117('0x25')](function(_0x2ee189){_0x48a084[_0x7117('0x1f')]=_0x2ee189;if(_0x34bf03[_0x7117('0x36')][_0x7117('0x44')]){_0x3d092e[_0x7117('0x45')]=[{'all':!![]}];}return db[_0x7117('0x60')][_0x7117('0x46')](_0x3d092e);})['then'](function(_0x863a84){_0x48a084[_0x7117('0x47')]=_0x863a84;return _0x48a084;});}})['then'](respondWithFilteredResult(_0x5ec748,_0x3d092e))[_0x7117('0x4c')](handleError(_0x5ec748,null));};exports['getHopperFinals']=function(_0x5a7fa7,_0x295ad5,_0x18e6e2){var _0x34b04a={'raw':!![],'where':{}};var _0x4d504a={};var _0x419327={'count':0x0,'rows':[]};return db[_0x7117('0x30')][_0x7117('0x5b')]({'where':{'id':_0x5a7fa7['params']['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x295ad5,null))[_0x7117('0x25')](function(_0x192856){if(_0x192856){_0x4d504a[_0x7117('0x35')]=_[_0x7117('0x4a')](db[_0x7117('0x61')][_0x7117('0x31')]);_0x4d504a[_0x7117('0x36')]=_[_0x7117('0x4a')](_0x5a7fa7[_0x7117('0x36')]);_0x4d504a[_0x7117('0x37')]=_[_0x7117('0x38')](_0x4d504a[_0x7117('0x35')],_0x4d504a[_0x7117('0x36')]);_0x34b04a[_0x7117('0x39')]=_['intersection'](_0x4d504a['model'],qs[_0x7117('0x3a')](_0x5a7fa7[_0x7117('0x36')]['fields']));_0x34b04a[_0x7117('0x39')]=_0x34b04a['attributes'][_0x7117('0x3b')]?_0x34b04a[_0x7117('0x39')]:_0x4d504a[_0x7117('0x35')];if(!_0x5a7fa7[_0x7117('0x36')][_0x7117('0x5d')]('nolimit')){_0x34b04a[_0x7117('0x1e')]=qs[_0x7117('0x1e')](_0x5a7fa7['query'][_0x7117('0x1e')]);_0x34b04a[_0x7117('0x1c')]=qs[_0x7117('0x1c')](_0x5a7fa7[_0x7117('0x36')][_0x7117('0x1c')]);}_0x34b04a[_0x7117('0x3d')]=qs['sort'](_0x5a7fa7[_0x7117('0x36')]['sort']);_0x34b04a[_0x7117('0x3f')]=qs[_0x7117('0x37')](_[_0x7117('0x40')](_0x5a7fa7[_0x7117('0x36')],_0x4d504a[_0x7117('0x37')]));_0x34b04a['where']['CampaignId']=_0x192856['id'];if(_0x5a7fa7[_0x7117('0x36')]['filter']){_0x34b04a[_0x7117('0x3f')]=_[_0x7117('0x42')](_0x34b04a['where'],{'$or':_[_0x7117('0x2f')](_0x34b04a[_0x7117('0x39')],function(_0x4d957c){var _0x23470d={};_0x23470d[_0x4d957c]={'$like':'%'+_0x5a7fa7[_0x7117('0x36')][_0x7117('0x41')]+'%'};return _0x23470d;})});}_0x34b04a=_[_0x7117('0x42')]({},_0x34b04a,_0x5a7fa7[_0x7117('0x43')]);return db[_0x7117('0x61')][_0x7117('0x1f')]({'where':_0x34b04a[_0x7117('0x3f')]})['then'](function(_0x5ded33){_0x419327[_0x7117('0x1f')]=_0x5ded33;if(_0x5a7fa7['query'][_0x7117('0x44')]){_0x34b04a[_0x7117('0x45')]=[{'all':!![]}];}return db[_0x7117('0x61')][_0x7117('0x46')](_0x34b04a);})['then'](function(_0x2faa93){_0x419327[_0x7117('0x47')]=_0x2faa93;return _0x419327;});}})[_0x7117('0x25')](respondWithFilteredResult(_0x295ad5,_0x34b04a))[_0x7117('0x4c')](handleError(_0x295ad5,null));};exports[_0x7117('0x62')]=function(_0x328412,_0x2c1ca5,_0x1f3821){var _0x3fdb3b={'raw':!![],'where':{}};var _0x590c9f={};var _0x56bc40={'count':0x0,'rows':[]};return db[_0x7117('0x30')][_0x7117('0x5b')]({'where':{'id':_0x328412[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x2c1ca5,null))['then'](function(_0x1f78b4){if(_0x1f78b4){_0x590c9f['model']=_['keys'](db[_0x7117('0x63')]['rawAttributes']);_0x590c9f[_0x7117('0x36')]=_[_0x7117('0x4a')](_0x328412['query']);_0x590c9f['filters']=_[_0x7117('0x38')](_0x590c9f[_0x7117('0x35')],_0x590c9f[_0x7117('0x36')]);_0x3fdb3b['attributes']=_[_0x7117('0x38')](_0x590c9f[_0x7117('0x35')],qs[_0x7117('0x3a')](_0x328412['query'][_0x7117('0x3a')]));_0x3fdb3b[_0x7117('0x39')]=_0x3fdb3b[_0x7117('0x39')][_0x7117('0x3b')]?_0x3fdb3b[_0x7117('0x39')]:_0x590c9f[_0x7117('0x35')];if(!_0x328412[_0x7117('0x36')][_0x7117('0x5d')]('nolimit')){_0x3fdb3b[_0x7117('0x1e')]=qs[_0x7117('0x1e')](_0x328412[_0x7117('0x36')][_0x7117('0x1e')]);_0x3fdb3b['offset']=qs['offset'](_0x328412[_0x7117('0x36')][_0x7117('0x1c')]);}_0x3fdb3b[_0x7117('0x3d')]=qs[_0x7117('0x3e')](_0x328412[_0x7117('0x36')][_0x7117('0x3e')]);_0x3fdb3b[_0x7117('0x3f')]=qs[_0x7117('0x37')](_['pick'](_0x328412['query'],_0x590c9f[_0x7117('0x37')]));_0x3fdb3b[_0x7117('0x3f')][_0x7117('0x5e')]=_0x1f78b4['id'];if(_0x328412['query'][_0x7117('0x41')]){_0x3fdb3b[_0x7117('0x3f')]=_[_0x7117('0x42')](_0x3fdb3b['where'],{'$or':_[_0x7117('0x2f')](_0x3fdb3b[_0x7117('0x39')],function(_0x327061){var _0x209a97={};_0x209a97[_0x327061]={'$like':'%'+_0x328412[_0x7117('0x36')]['filter']+'%'};return _0x209a97;})});}_0x3fdb3b=_['merge']({},_0x3fdb3b,_0x328412[_0x7117('0x43')]);return db['CmHopperBlack'][_0x7117('0x1f')]({'where':_0x3fdb3b[_0x7117('0x3f')]})['then'](function(_0xd0e8da){_0x56bc40[_0x7117('0x1f')]=_0xd0e8da;if(_0x328412[_0x7117('0x36')][_0x7117('0x44')]){_0x3fdb3b['include']=[{'all':!![]}];}return db[_0x7117('0x63')][_0x7117('0x46')](_0x3fdb3b);})[_0x7117('0x25')](function(_0x38bcdb){_0x56bc40['rows']=_0x38bcdb;return _0x56bc40;});}})['then'](respondWithFilteredResult(_0x2c1ca5,_0x3fdb3b))[_0x7117('0x4c')](handleError(_0x2c1ca5,null));};exports['getLists']=function(_0xdf403e,_0x3d9739,_0x435291){var _0x396574={};var _0x3fa435={};var _0x46d47f;var _0x5e869e;return db['Campaign'][_0x7117('0x5b')]({'where':{'id':_0xdf403e['params']['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x3d9739,null))['then'](function(_0x499c05){if(_0x499c05){_0x46d47f=_0x499c05;_0x3fa435['model']=_[_0x7117('0x4a')](db[_0x7117('0x64')][_0x7117('0x31')]);_0x3fa435[_0x7117('0x36')]=_['keys'](_0xdf403e[_0x7117('0x36')]);_0x3fa435[_0x7117('0x37')]=_[_0x7117('0x38')](_0x3fa435[_0x7117('0x35')],_0x3fa435[_0x7117('0x36')]);_0x396574['attributes']=_[_0x7117('0x38')](_0x3fa435[_0x7117('0x35')],qs[_0x7117('0x3a')](_0xdf403e[_0x7117('0x36')][_0x7117('0x3a')]));_0x396574['attributes']=_0x396574['attributes'][_0x7117('0x3b')]?_0x396574[_0x7117('0x39')]:_0x3fa435[_0x7117('0x35')];_0x396574[_0x7117('0x3d')]=qs['sort'](_0xdf403e['query']['sort']);_0x396574['where']=qs[_0x7117('0x37')](_[_0x7117('0x40')](_0xdf403e['query'],_0x3fa435[_0x7117('0x37')]));if(_0xdf403e[_0x7117('0x36')][_0x7117('0x41')]){_0x396574[_0x7117('0x3f')]=_['merge'](_0x396574[_0x7117('0x3f')],{'$or':_[_0x7117('0x2f')](_0x396574[_0x7117('0x39')],function(_0x4256e2){var _0x133de3={};_0x133de3[_0x4256e2]={'$like':'%'+_0xdf403e['query']['filter']+'%'};return _0x133de3;})});}_0x396574=_['merge']({},_0x396574,_0xdf403e[_0x7117('0x43')]);return _0x46d47f['getLists'](_0x396574);}})[_0x7117('0x25')](function(_0x43568f){if(_0x43568f){_0x5e869e=_0x43568f[_0x7117('0x3b')];if(!_0xdf403e['query']['hasOwnProperty']('nolimit')){_0x396574[_0x7117('0x1e')]=qs[_0x7117('0x1e')](_0xdf403e['query'][_0x7117('0x1e')]);_0x396574[_0x7117('0x1c')]=qs[_0x7117('0x1c')](_0xdf403e[_0x7117('0x36')][_0x7117('0x1c')]);}return _0x46d47f['getLists'](_0x396574);}})[_0x7117('0x25')](function(_0x14221a){if(_0x14221a){return _0x14221a?{'count':_0x5e869e,'rows':_0x14221a}:null;}})['then'](respondWithResult(_0x3d9739,null))[_0x7117('0x4c')](handleError(_0x3d9739,null));};exports[_0x7117('0x65')]=function(_0x4b7f02,_0x23a2fc,_0x1e20e0){var _0x2250df,_0x1637b5;var _0x437abe=[];var _0x2a6ec9=moment()[_0x7117('0x66')](_0x7117('0x67'));return db[_0x7117('0x30')]['find']({'where':{'id':_0x4b7f02[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x23a2fc,null))['then'](function(_0x3d823f){if(_0x3d823f){_0x1637b5=_0x3d823f;return _0x3d823f[_0x7117('0x65')](_0x4b7f02[_0x7117('0x4d')][_0x7117('0x68')],_[_0x7117('0x57')](_0x4b7f02[_0x7117('0x4d')],['ids','id'])||{});}return null;})['spread'](function(_0x498516){var _0x386c59;var _0x3a2d47;_0x2250df=_0x498516||[];var _0x156fa3=[];if(_0x498516){for(var _0x585761=0x0;_0x585761<_0x498516[_0x7117('0x3b')];_0x585761+=0x1){var _0x565d20=_0x498516[_0x585761][_0x7117('0x27')]({'plain':!![]});_0x1637b5['dialCheckDuplicateType']=_0x4b7f02['body']['dialCheckDuplicateType']?_0x4b7f02['body'][_0x7117('0x69')]:_0x1637b5[_0x7117('0x69')];switch(_0x1637b5[_0x7117('0x69')]){case _0x7117('0x6a'):_0x386c59=squel['insert']()[_0x7117('0x6b')](_0x7117('0x6c'))[_0x7117('0x6d')]([_0x7117('0x6e'),_0x7117('0x6f'),_0x7117('0x70'),_0x7117('0x71'),_0x7117('0x5e'),'createdAt','updatedAt'],squel[_0x7117('0x72')]()[_0x7117('0x73')](_0x7117('0x6e'),_0x7117('0x6e'))[_0x7117('0x73')]('NOW()',_0x7117('0x6f'))[_0x7117('0x73')]('id',_0x7117('0x70'))[_0x7117('0x73')](_0x565d20[_0x7117('0x74')][_0x7117('0x75')](),_0x7117('0x71'))[_0x7117('0x73')](_0x4b7f02[_0x7117('0x49')]['id'][_0x7117('0x75')](),_0x7117('0x5e'))[_0x7117('0x73')]('\x27'+_0x2a6ec9+'\x27',_0x7117('0x55'))[_0x7117('0x73')]('\x27'+_0x2a6ec9+'\x27',_0x7117('0x56'))[_0x7117('0x76')](_0x7117('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0x7117('0x3f')](_0x7117('0x78'),_0x565d20['CmListId'][_0x7117('0x75')]())[_0x7117('0x3f')](_0x7117('0x79'))[_0x7117('0x3f')](_0x7117('0x7a'),squel[_0x7117('0x72')]()[_0x7117('0x73')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x7117('0x7b'))[_0x7117('0x3f')](_0x7117('0x7c'),_0x4b7f02['params']['id'][_0x7117('0x75')]()))[_0x7117('0x3f')](_0x7117('0x7a'),squel[_0x7117('0x72')]()[_0x7117('0x73')]('COALESCE(phone,\x27\x27)')[_0x7117('0x76')](_0x7117('0x6c'))[_0x7117('0x3f')](_0x7117('0x7c'),_0x4b7f02[_0x7117('0x49')]['id']['toString']())))['toString']();break;case _0x7117('0x7d'):_0x386c59=squel['insert']()[_0x7117('0x6b')]('cm_hopper')['fromQuery']([_0x7117('0x6e'),_0x7117('0x6f'),_0x7117('0x70'),_0x7117('0x71'),_0x7117('0x5e'),'createdAt','updatedAt'],squel[_0x7117('0x72')]()[_0x7117('0x73')](_0x7117('0x6e'),_0x7117('0x6e'))[_0x7117('0x73')]('NOW()',_0x7117('0x6f'))[_0x7117('0x73')]('id','ContactId')[_0x7117('0x73')](_0x565d20[_0x7117('0x74')][_0x7117('0x75')](),_0x7117('0x71'))[_0x7117('0x73')](_0x4b7f02[_0x7117('0x49')]['id'][_0x7117('0x75')](),_0x7117('0x5e'))[_0x7117('0x73')]('\x27'+_0x2a6ec9+'\x27',_0x7117('0x55'))[_0x7117('0x73')]('\x27'+_0x2a6ec9+'\x27','updatedAt')[_0x7117('0x76')](_0x7117('0x77'))[_0x7117('0x3f')](_0x7117('0x7e'))[_0x7117('0x3f')](_0x7117('0x78'),_0x565d20[_0x7117('0x74')][_0x7117('0x75')]())[_0x7117('0x3f')](_0x7117('0x79'))[_0x7117('0x3f')](_0x7117('0x7a'),squel[_0x7117('0x72')]()[_0x7117('0x73')]('COALESCE(phone,\x27\x27)')['from'](_0x7117('0x6c'))[_0x7117('0x3f')]('CampaignId\x20=\x20?',_0x4b7f02['params']['id'][_0x7117('0x75')]())))[_0x7117('0x75')]();break;default:_0x386c59=squel['insert']()['into'](_0x7117('0x6c'))[_0x7117('0x6d')]([_0x7117('0x6e'),'scheduledAt',_0x7117('0x70'),'ListId','CampaignId',_0x7117('0x55'),_0x7117('0x56')],squel[_0x7117('0x72')]()[_0x7117('0x73')](_0x7117('0x6e'),_0x7117('0x6e'))['field'](_0x7117('0x7f'),_0x7117('0x6f'))[_0x7117('0x73')]('id',_0x7117('0x70'))[_0x7117('0x73')](_0x565d20[_0x7117('0x74')][_0x7117('0x75')](),_0x7117('0x71'))[_0x7117('0x73')](_0x4b7f02['params']['id']['toString'](),_0x7117('0x5e'))['field']('\x27'+_0x2a6ec9+'\x27','createdAt')[_0x7117('0x73')]('\x27'+_0x2a6ec9+'\x27',_0x7117('0x56'))[_0x7117('0x76')](_0x7117('0x77'))[_0x7117('0x3f')](_0x7117('0x7e'))['where'](_0x7117('0x78'),_0x565d20[_0x7117('0x74')][_0x7117('0x75')]())['where'](_0x7117('0x79')))[_0x7117('0x75')]();}_0x3a2d47=squel[_0x7117('0x80')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x7117('0x81'),_0x7117('0x6f'),_0x7117('0x6e'),_0x7117('0x82'),'createdAt',_0x7117('0x56')],squel[_0x7117('0x72')]()[_0x7117('0x73')](_0x7117('0x83'),'id')[_0x7117('0x73')](_0x7117('0x7f'),'scheduledAt')[_0x7117('0x73')](_0x7117('0x84'),'phone')['field'](_0x7117('0x85'),_0x7117('0x82'))['field']('\x27'+_0x2a6ec9+'\x27','createdAt')[_0x7117('0x73')]('\x27'+_0x2a6ec9+'\x27',_0x7117('0x56'))[_0x7117('0x76')]('cm_contact_has_items','ci')[_0x7117('0x86')](_0x7117('0x6c'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x7117('0x3f')](_0x7117('0x87'),_0x565d20[_0x7117('0x74')][_0x7117('0x75')]())[_0x7117('0x3f')](_0x7117('0x88'),_0x4b7f02['params']['id'][_0x7117('0x75')]())[_0x7117('0x3f')](_0x7117('0x89'),_0x2a6ec9))[_0x7117('0x75')]();_0x156fa3[_0x7117('0x8a')](db[_0x7117('0x8b')][_0x7117('0x36')](_0x386c59));_0x437abe[_0x7117('0x8a')](db['sequelize'][_0x7117('0x36')](_0x3a2d47));}return BPromise[_0x7117('0x8c')](_0x156fa3);}})['then'](function(){return BPromise[_0x7117('0x8c')](_0x437abe);})[_0x7117('0x25')](function(){return _0x2250df;})[_0x7117('0x25')](respondWithResult(_0x23a2fc,null))[_0x7117('0x4c')](handleError(_0x23a2fc,null));};exports[_0x7117('0x8d')]=function(_0x38928e,_0x5e449d,_0x5aec8f){return db[_0x7117('0x30')][_0x7117('0x4b')]({'where':{'id':_0x38928e[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x5e449d,null))['then'](function(_0x2e0eb7){if(_0x2e0eb7){return _0x2e0eb7[_0x7117('0x8d')](_0x38928e[_0x7117('0x36')][_0x7117('0x68')]);}})[_0x7117('0x25')](function(_0xb95f8d){if(_0xb95f8d){return db[_0x7117('0x5c')][_0x7117('0x26')]({'where':{'ListId':_0x38928e[_0x7117('0x36')][_0x7117('0x68')],'CampaignId':_0x38928e[_0x7117('0x49')]['id']}})[_0x7117('0x25')](function(){return _0xb95f8d;});}})[_0x7117('0x25')](respondWithStatusCode(_0x5e449d,null))[_0x7117('0x4c')](handleError(_0x5e449d,null));};exports[_0x7117('0x8e')]=function(_0x469f70,_0x972e2b,_0x5c306c){var _0x49f531={};var _0x320be5={};var _0x5478a5;var _0x2cc047;return db[_0x7117('0x30')][_0x7117('0x5b')]({'where':{'id':_0x469f70[_0x7117('0x49')]['id']}})['then'](handleEntityNotFound(_0x972e2b,null))[_0x7117('0x25')](function(_0x512f11){if(_0x512f11){_0x5478a5=_0x512f11;_0x320be5[_0x7117('0x35')]=_[_0x7117('0x4a')](db['CmList']['rawAttributes']);_0x320be5[_0x7117('0x36')]=_[_0x7117('0x4a')](_0x469f70[_0x7117('0x36')]);_0x320be5[_0x7117('0x37')]=_[_0x7117('0x38')](_0x320be5['model'],_0x320be5[_0x7117('0x36')]);_0x49f531[_0x7117('0x39')]=_[_0x7117('0x38')](_0x320be5[_0x7117('0x35')],qs[_0x7117('0x3a')](_0x469f70[_0x7117('0x36')]['fields']));_0x49f531[_0x7117('0x39')]=_0x49f531[_0x7117('0x39')]['length']?_0x49f531['attributes']:_0x320be5[_0x7117('0x35')];_0x49f531['order']=qs[_0x7117('0x3e')](_0x469f70['query'][_0x7117('0x3e')]);_0x49f531['where']=qs[_0x7117('0x37')](_[_0x7117('0x40')](_0x469f70[_0x7117('0x36')],_0x320be5[_0x7117('0x37')]));if(_0x469f70[_0x7117('0x36')][_0x7117('0x41')]){_0x49f531[_0x7117('0x3f')]=_[_0x7117('0x42')](_0x49f531['where'],{'$or':_['map'](_0x49f531[_0x7117('0x39')],function(_0xe755b3){var _0x1a2786={};_0x1a2786[_0xe755b3]={'$like':'%'+_0x469f70[_0x7117('0x36')][_0x7117('0x41')]+'%'};return _0x1a2786;})});}_0x49f531=_[_0x7117('0x42')]({},_0x49f531,_0x469f70['options']);return _0x5478a5[_0x7117('0x8e')](_0x49f531);}})[_0x7117('0x25')](function(_0x3f136d){if(_0x3f136d){_0x2cc047=_0x3f136d['length'];if(!_0x469f70[_0x7117('0x36')]['hasOwnProperty'](_0x7117('0x3c'))){_0x49f531[_0x7117('0x1e')]=qs[_0x7117('0x1e')](_0x469f70[_0x7117('0x36')][_0x7117('0x1e')]);_0x49f531[_0x7117('0x1c')]=qs['offset'](_0x469f70[_0x7117('0x36')]['offset']);}return _0x5478a5['getBlackLists'](_0x49f531);}})['then'](function(_0x49efe6){if(_0x49efe6){return _0x49efe6?{'count':_0x2cc047,'rows':_0x49efe6}:null;}})[_0x7117('0x25')](respondWithResult(_0x972e2b,null))[_0x7117('0x4c')](handleError(_0x972e2b,null));};exports[_0x7117('0x8f')]=function(_0x240d7f,_0x54a799,_0x2297f1){var _0x555f49,_0x270ba1;var _0x4ebbe8=[];var _0x1c4a08=moment()[_0x7117('0x66')](_0x7117('0x67'));return db[_0x7117('0x30')]['find']({'where':{'id':_0x240d7f[_0x7117('0x49')]['id']}})['then'](handleEntityNotFound(_0x54a799,null))['then'](function(_0x49692e){if(_0x49692e){_0x270ba1=_0x49692e;return _0x49692e[_0x7117('0x8f')](_0x240d7f[_0x7117('0x4d')][_0x7117('0x68')],_[_0x7117('0x57')](_0x240d7f[_0x7117('0x4d')],[_0x7117('0x68'),'id'])||{});}return null;})['spread'](function(_0x4129a5){var _0x543c43;var _0xc587a0;_0x555f49=_0x4129a5||[];var _0x4504b2=[];if(_0x4129a5){for(var _0x36b8f8=0x0;_0x36b8f8<_0x4129a5[_0x7117('0x3b')];_0x36b8f8+=0x1){var _0x997b00=_0x4129a5[_0x36b8f8][_0x7117('0x27')]({'plain':!![]});_0x543c43=squel['insert']()[_0x7117('0x6b')]('cm_hopper_black')['fromQuery']([_0x7117('0x6e'),'ContactId',_0x7117('0x71'),_0x7117('0x5e'),'createdAt',_0x7117('0x56')],squel[_0x7117('0x72')]()[_0x7117('0x73')]('phone','phone')['field']('id',_0x7117('0x70'))[_0x7117('0x73')](_0x997b00['CmListId'][_0x7117('0x75')](),'ListId')['field'](_0x240d7f[_0x7117('0x49')]['id'][_0x7117('0x75')](),_0x7117('0x5e'))[_0x7117('0x73')](_0x7117('0x7f'),_0x7117('0x55'))[_0x7117('0x73')](_0x7117('0x7f'),'updatedAt')['from'](_0x7117('0x77'))['where'](_0x7117('0x7e'))[_0x7117('0x3f')](_0x7117('0x78'),_0x997b00['CmListId']['toString']())[_0x7117('0x3f')](_0x7117('0x79')))['toString']();_0x4504b2[_0x7117('0x8a')](db[_0x7117('0x8b')][_0x7117('0x36')](_0x543c43));}return BPromise[_0x7117('0x8c')](_0x4504b2);}})[_0x7117('0x25')](function(){return _0x555f49;})['then'](respondWithResult(_0x54a799,null))['catch'](handleError(_0x54a799,null));};exports['removeBlackLists']=function(_0x93ac5b,_0x18d998,_0x4c8118){return db[_0x7117('0x30')]['find']({'where':{'id':_0x93ac5b[_0x7117('0x49')]['id']}})[_0x7117('0x25')](handleEntityNotFound(_0x18d998,null))['then'](function(_0x23662a){if(_0x23662a){return _0x23662a['removeBlackLists'](_0x93ac5b['query'][_0x7117('0x68')]);}})[_0x7117('0x25')](function(_0x59dccc){if(_0x59dccc){return db[_0x7117('0x63')][_0x7117('0x26')]({'where':{'ListId':_0x93ac5b[_0x7117('0x36')][_0x7117('0x68')],'CampaignId':_0x93ac5b[_0x7117('0x49')]['id']}})[_0x7117('0x25')](function(){return _0x59dccc;});}})['then'](respondWithStatusCode(_0x18d998,null))[_0x7117('0x4c')](handleError(_0x18d998,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 4b0326a..b9244fa 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(_0x2b18e5,_0x1a141c){var _0x12e52c=function(_0x27ea16){while(--_0x27ea16){_0x2b18e5['push'](_0x2b18e5['shift']());}};_0x12e52c(++_0x1a141c);}(_0x7a54,0x106));var _0x47a5=function(_0x551fa8,_0x35f7b5){_0x551fa8=_0x551fa8-0x0;var _0x505d7c=_0x7a54[_0x551fa8];return _0x505d7c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 17c24af..f5198e7 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 _0x0624=['Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetCampaign','Campaign','options','raw','where','attributes','limit','map','include','model','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0624,0x132));var _0x4062=function(_0x189be2,_0x5139dc){_0x189be2=_0x189be2-0x0;var _0xeac5af=_0x0624[_0x189be2];return _0xeac5af;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4062('0x0'));var fs=require('fs');var Redis=require(_0x4062('0x1'));var db=require(_0x4062('0x2'))['db'];var utils=require(_0x4062('0x3'));var logger=require(_0x4062('0x4'))(_0x4062('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4062('0x6')][_0x4062('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f4928,_0xdff88c,_0x27794b){return new BPromise(function(_0x5d19e8,_0x75ce4e){return client['request'](_0x2f4928,_0x27794b)[_0x4062('0x8')](function(_0x35663b){logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,_0x4062('0xb'));logger[_0x4062('0xc')](_0x4062('0xd'),_0xdff88c,'request\x20sent',JSON[_0x4062('0xe')](_0x35663b));if(_0x35663b['error']){if(_0x35663b[_0x4062('0xf')][_0x4062('0x10')]===0x1f4){logger[_0x4062('0xf')](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')]['message']);return _0x75ce4e(_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);}logger['error'](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);return _0x5d19e8(_0x35663b['error']['message']);}else{logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,'request\x20sent');_0x5d19e8(_0x35663b['result']['message']);}})['catch'](function(_0x437432){logger['error'](_0x4062('0xa'),_0xdff88c,_0x437432);_0x75ce4e(_0x437432);});});}exports[_0x4062('0x12')]=function(_0x3d14bb){var _0x37cd8b=this;return new Promise(function(_0x2a04c7,_0x3942f2){return db[_0x4062('0x13')]['findAll']({'raw':_0x3d14bb[_0x4062('0x14')]?_0x3d14bb['options'][_0x4062('0x15')]===undefined?!![]:![]:!![],'where':_0x3d14bb['options']?_0x3d14bb[_0x4062('0x14')][_0x4062('0x16')]||null:null,'attributes':_0x3d14bb[_0x4062('0x14')]?_0x3d14bb[_0x4062('0x14')][_0x4062('0x17')]||null:null,'limit':_0x3d14bb[_0x4062('0x14')]?_0x3d14bb[_0x4062('0x14')][_0x4062('0x18')]||null:null,'include':_0x3d14bb[_0x4062('0x14')]?_0x3d14bb['options']['include']?_[_0x4062('0x19')](_0x3d14bb[_0x4062('0x14')][_0x4062('0x1a')],function(_0x1fa194){return{'model':db[_0x1fa194['model']],'as':_0x1fa194['as'],'attributes':_0x1fa194['attributes'],'include':_0x1fa194['include']?_[_0x4062('0x19')](_0x1fa194[_0x4062('0x1a')],function(_0x11b962){return{'model':db[_0x11b962[_0x4062('0x1b')]],'as':_0x11b962['as'],'attributes':_0x11b962[_0x4062('0x17')],'include':_0x11b962[_0x4062('0x1a')]?_['map'](_0x11b962[_0x4062('0x1a')],function(_0x448545){return{'model':db[_0x448545[_0x4062('0x1b')]],'as':_0x448545['as'],'attributes':_0x448545[_0x4062('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4062('0x8')](function(_0x5934d2){logger[_0x4062('0x9')]('GetCampaign',_0x3d14bb);logger['debug'](_0x4062('0x12'),_0x3d14bb,JSON['stringify'](_0x5934d2));_0x2a04c7(_0x5934d2);})[_0x4062('0x1c')](function(_0x169c12){logger[_0x4062('0xf')](_0x4062('0x12'),_0x169c12[_0x4062('0x11')],_0x3d14bb);_0x3942f2(_0x37cd8b[_0x4062('0xf')](0x1f4,_0x169c12[_0x4062('0x11')]));});});}; \ No newline at end of file +var _0x495e=['Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','raw','options','where','attributes','limit','include','map','model','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x51aae8,_0x5a9019){var _0x5c6831=function(_0x4bd810){while(--_0x4bd810){_0x51aae8['push'](_0x51aae8['shift']());}};_0x5c6831(++_0x5a9019);}(_0x495e,0xfb));var _0xe495=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x495e[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe495('0x1'));var rs=require(_0xe495('0x2'));var fs=require('fs');var Redis=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x5'))(_0xe495('0x6'));var config=require(_0xe495('0x7'));var jayson=require(_0xe495('0x8'));var client=jayson[_0xe495('0x9')][_0xe495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101a7e,_0x5745e3,_0x599ab4){return new BPromise(function(_0x5c17d0,_0x16f146){return client['request'](_0x101a7e,_0x599ab4)[_0xe495('0xb')](function(_0x3a9a00){logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));logger['debug'](_0xe495('0xf'),_0x5745e3,_0xe495('0xe'),JSON[_0xe495('0x10')](_0x3a9a00));if(_0x3a9a00['error']){if(_0x3a9a00[_0xe495('0x11')][_0xe495('0x12')]===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x16f146(_0x3a9a00['error'][_0xe495('0x13')]);}logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x5c17d0(_0x3a9a00['error'][_0xe495('0x13')]);}else{logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));_0x5c17d0(_0x3a9a00[_0xe495('0x14')]['message']);}})['catch'](function(_0x4de730){logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x4de730);_0x16f146(_0x4de730);});});}exports[_0xe495('0x15')]=function(_0x577fb7){var _0x1e602c=this;return new Promise(function(_0x302ca0,_0x3ba8cc){return db[_0xe495('0x16')][_0xe495('0x17')]({'raw':_0x577fb7['options']?_0x577fb7['options'][_0xe495('0x18')]===undefined?!![]:![]:!![],'where':_0x577fb7[_0xe495('0x19')]?_0x577fb7[_0xe495('0x19')][_0xe495('0x1a')]||null:null,'attributes':_0x577fb7['options']?_0x577fb7[_0xe495('0x19')][_0xe495('0x1b')]||null:null,'limit':_0x577fb7[_0xe495('0x19')]?_0x577fb7['options'][_0xe495('0x1c')]||null:null,'include':_0x577fb7[_0xe495('0x19')]?_0x577fb7[_0xe495('0x19')][_0xe495('0x1d')]?_[_0xe495('0x1e')](_0x577fb7['options'][_0xe495('0x1d')],function(_0x4d836b){return{'model':db[_0x4d836b[_0xe495('0x1f')]],'as':_0x4d836b['as'],'attributes':_0x4d836b[_0xe495('0x1b')],'include':_0x4d836b[_0xe495('0x1d')]?_['map'](_0x4d836b[_0xe495('0x1d')],function(_0x2a6fd6){return{'model':db[_0x2a6fd6[_0xe495('0x1f')]],'as':_0x2a6fd6['as'],'attributes':_0x2a6fd6[_0xe495('0x1b')],'include':_0x2a6fd6[_0xe495('0x1d')]?_[_0xe495('0x1e')](_0x2a6fd6[_0xe495('0x1d')],function(_0x48b2eb){return{'model':db[_0x48b2eb['model']],'as':_0x48b2eb['as'],'attributes':_0x48b2eb[_0xe495('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1651d4){logger[_0xe495('0xc')]('GetCampaign',_0x577fb7);logger['debug'](_0xe495('0x15'),_0x577fb7,JSON[_0xe495('0x10')](_0x1651d4));_0x302ca0(_0x1651d4);})[_0xe495('0x20')](function(_0x8623c1){logger[_0xe495('0x11')](_0xe495('0x15'),_0x8623c1[_0xe495('0x13')],_0x577fb7);_0x3ba8cc(_0x1e602c[_0xe495('0x11')](0x1f4,_0x8623c1['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index aaee105..ac05016 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 _0xc3f9=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x4b0c3e,_0x50754a){var _0xa99d4e=function(_0x1034a2){while(--_0x1034a2){_0x4b0c3e['push'](_0x4b0c3e['shift']());}};_0xa99d4e(++_0x50754a);}(_0xc3f9,0x125));var _0x9c3f=function(_0xe09a2,_0x4034bf){_0xe09a2=_0xe09a2-0x0;var _0x503d42=_0xc3f9[_0xe09a2];return _0x503d42;};'use strict';var multer=require(_0x9c3f('0x0'));var util=require(_0x9c3f('0x1'));var path=require(_0x9c3f('0x2'));var timeout=require(_0x9c3f('0x3'));var express=require(_0x9c3f('0x4'));var router=express[_0x9c3f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9c3f('0x6'));var interaction=require(_0x9c3f('0x7'));var config=require(_0x9c3f('0x8'));var controller=require(_0x9c3f('0x9'));router[_0x9c3f('0xa')]('/',auth['isAuthenticated'](),controller[_0x9c3f('0xb')]);router['get'](_0x9c3f('0xc'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0xe')]);router['get'](_0x9c3f('0xf'),auth['isAuthenticated'](),controller[_0x9c3f('0x10')]);router[_0x9c3f('0xa')](_0x9c3f('0x11'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x12')]);router[_0x9c3f('0xa')](_0x9c3f('0x13'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x14')]);router['get'](_0x9c3f('0x15'),auth[_0x9c3f('0xd')](),controller['getHopperBlacks']);router[_0x9c3f('0xa')](_0x9c3f('0x16'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x17')]);router['get'](_0x9c3f('0x18'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x19')]);router[_0x9c3f('0x1a')]('/',auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x1b')]);router[_0x9c3f('0x1a')](_0x9c3f('0x1c'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x1d')]);router[_0x9c3f('0x1a')]('/:id/lists',auth[_0x9c3f('0xd')](),controller['addLists']);router[_0x9c3f('0x1a')](_0x9c3f('0x18'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x1e')]);router['put'](_0x9c3f('0xc'),auth[_0x9c3f('0xd')](),controller['update']);router[_0x9c3f('0x1f')](_0x9c3f('0xc'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x20')]);router['delete'](_0x9c3f('0x16'),auth[_0x9c3f('0xd')](),controller[_0x9c3f('0x21')]);router['delete'](_0x9c3f('0x18'),auth[_0x9c3f('0xd')](),controller['removeBlackLists']);module[_0x9c3f('0x22')]=router; \ No newline at end of file +var _0x03fe=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','clone','addLists','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x5b6a86,_0x59489c){var _0x425888=function(_0x38fdfd){while(--_0x38fdfd){_0x5b6a86['push'](_0x5b6a86['shift']());}};_0x425888(++_0x59489c);}(_0x03fe,0x73));var _0xe03f=function(_0x273e4c,_0x24c349){_0x273e4c=_0x273e4c-0x0;var _0x11adb4=_0x03fe[_0x273e4c];return _0x11adb4;};'use strict';var multer=require(_0xe03f('0x0'));var util=require(_0xe03f('0x1'));var path=require(_0xe03f('0x2'));var timeout=require(_0xe03f('0x3'));var express=require('express');var router=express[_0xe03f('0x4')]();var fs_extra=require(_0xe03f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe03f('0x6'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xe03f('0x7')]('/',auth[_0xe03f('0x8')](),controller[_0xe03f('0x9')]);router[_0xe03f('0x7')](_0xe03f('0xa'),auth['isAuthenticated'](),controller[_0xe03f('0xb')]);router[_0xe03f('0x7')]('/:id/hoppers',auth[_0xe03f('0x8')](),controller[_0xe03f('0xc')]);router[_0xe03f('0x7')](_0xe03f('0xd'),auth[_0xe03f('0x8')](),controller[_0xe03f('0xe')]);router[_0xe03f('0x7')](_0xe03f('0xf'),auth[_0xe03f('0x8')](),controller[_0xe03f('0x10')]);router['get'](_0xe03f('0x11'),auth[_0xe03f('0x8')](),controller[_0xe03f('0x12')]);router[_0xe03f('0x7')](_0xe03f('0x13'),auth[_0xe03f('0x8')](),controller[_0xe03f('0x14')]);router[_0xe03f('0x7')](_0xe03f('0x15'),auth[_0xe03f('0x8')](),controller[_0xe03f('0x16')]);router['post']('/',auth[_0xe03f('0x8')](),controller['create']);router[_0xe03f('0x17')]('/:id/clone',auth['isAuthenticated'](),controller[_0xe03f('0x18')]);router['post'](_0xe03f('0x13'),auth['isAuthenticated'](),controller[_0xe03f('0x19')]);router[_0xe03f('0x17')](_0xe03f('0x15'),auth[_0xe03f('0x8')](),controller[_0xe03f('0x1a')]);router[_0xe03f('0x1b')](_0xe03f('0xa'),auth[_0xe03f('0x8')](),controller[_0xe03f('0x1c')]);router['delete'](_0xe03f('0xa'),auth['isAuthenticated'](),controller[_0xe03f('0x1d')]);router[_0xe03f('0x1e')](_0xe03f('0x13'),auth[_0xe03f('0x8')](),controller['removeLists']);router[_0xe03f('0x1e')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xe03f('0x1f')]);module[_0xe03f('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 326fca3..f1ffff2 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 _0x16e1=['medium','VIRTUAL','getDataValue','STRING','TEXT'];(function(_0x20629d,_0x1a6757){var _0x4ca950=function(_0x2c806c){while(--_0x2c806c){_0x20629d['push'](_0x20629d['shift']());}};_0x4ca950(++_0x1a6757);}(_0x16e1,0x120));var _0x116e=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x16e1[_0x336376];return _0x1d2a8e;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x116e('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x116e('0x1')],'length':_0x116e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x116e('0x0')]},'name':{'type':Sequelize[_0x116e('0x3')],'get':function(){return this[_0x116e('0x4')]('key');}}}; \ No newline at end of file +var _0xb8d2=['medium','key','sequelize','STRING','TEXT'];(function(_0x343abb,_0x4d8e75){var _0x2e53f9=function(_0x4d1c9b){while(--_0x4d1c9b){_0x343abb['push'](_0x343abb['shift']());}};_0x2e53f9(++_0x4d8e75);}(_0xb8d2,0x188));var _0x2b8d=function(_0x166294,_0x175bc9){_0x166294=_0x166294-0x0;var _0x304968=_0xb8d2[_0x166294];return _0x304968;};'use strict';var Sequelize=require(_0x2b8d('0x0'));module['exports']={'key':{'type':Sequelize[_0x2b8d('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x2b8d('0x2')],'length':_0x2b8d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2b8d('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x2b8d('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a4845b4..c831b78 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 _0xd7fd=['pick','where','filter','merge','options','CannedAnswer','includeAll','findAll','rows','catch','show','params','keys','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','index','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7fd,0x12f));var _0xdd7f=function(_0x5a2291,_0x3ddda7){_0x5a2291=_0x5a2291-0x0;var _0x10e3f5=_0xd7fd[_0x5a2291];return _0x10e3f5;};'use strict';var emlformat=require(_0xdd7f('0x0'));var rimraf=require(_0xdd7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd7f('0x2'));var rp=require(_0xdd7f('0x3'));var moment=require(_0xdd7f('0x4'));var BPromise=require(_0xdd7f('0x5'));var Mustache=require('mustache');var util=require(_0xdd7f('0x6'));var path=require(_0xdd7f('0x7'));var sox=require(_0xdd7f('0x8'));var csv=require('to-csv');var ejs=require(_0xdd7f('0x9'));var fs=require('fs');var fs_extra=require(_0xdd7f('0xa'));var _=require(_0xdd7f('0xb'));var squel=require(_0xdd7f('0xc'));var crypto=require(_0xdd7f('0xd'));var jsforce=require(_0xdd7f('0xe'));var deskjs=require(_0xdd7f('0xf'));var toCsv=require(_0xdd7f('0x10'));var querystring=require(_0xdd7f('0x11'));var Papa=require(_0xdd7f('0x12'));var Redis=require(_0xdd7f('0x13'));var authService=require(_0xdd7f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xdd7f('0x15'));var hardwareService=require(_0xdd7f('0x16'));var logger=require(_0xdd7f('0x17'))(_0xdd7f('0x18'));var utils=require('../../config/utils');var config=require(_0xdd7f('0x19'));var licenseUtil=require(_0xdd7f('0x1a'));var db=require(_0xdd7f('0x1b'))['db'];function respondWithStatusCode(_0x2d3c77,_0x5f5227){_0x5f5227=_0x5f5227||0xcc;return function(_0x10b2e3){if(_0x10b2e3){return _0x2d3c77[_0xdd7f('0x1c')](_0x5f5227);}return _0x2d3c77[_0xdd7f('0x1d')](_0x5f5227)['end']();};}function respondWithResult(_0x415620,_0x6480ae){_0x6480ae=_0x6480ae||0xc8;return function(_0x5ab3dc){if(_0x5ab3dc){return _0x415620[_0xdd7f('0x1d')](_0x6480ae)['json'](_0x5ab3dc);}};}function respondWithFilteredResult(_0x36ef28,_0x8a2e0d){return function(_0x26f5dc){if(_0x26f5dc){var _0xf3b5af=typeof _0x8a2e0d['offset']==='undefined'&&typeof _0x8a2e0d['limit']==='undefined';var _0x5f5c8d=_0x26f5dc[_0xdd7f('0x1e')];var _0x508069=_0xf3b5af?0x0:_0x8a2e0d[_0xdd7f('0x1f')];var _0x3099b1=_0xf3b5af?_0x26f5dc[_0xdd7f('0x1e')]:_0x8a2e0d['offset']+_0x8a2e0d[_0xdd7f('0x20')];var _0x52055d;if(_0x3099b1>=_0x5f5c8d){_0x3099b1=_0x5f5c8d;_0x52055d=0xc8;}else{_0x52055d=0xce;}_0x36ef28[_0xdd7f('0x1d')](_0x52055d);return _0x36ef28[_0xdd7f('0x21')](_0xdd7f('0x22'),_0x508069+'-'+_0x3099b1+'/'+_0x5f5c8d)[_0xdd7f('0x23')](_0x26f5dc);}return null;};}function patchUpdates(_0x166fba){return function(_0x2829e5){try{jsonpatch['apply'](_0x2829e5,_0x166fba,!![]);}catch(_0x3784de){return BPromise[_0xdd7f('0x24')](_0x3784de);}return _0x2829e5[_0xdd7f('0x25')]();};}function saveUpdates(_0x16a82b,_0x4d7c56){return function(_0x5be066){if(_0x5be066){return _0x5be066[_0xdd7f('0x26')](_0x16a82b)[_0xdd7f('0x27')](function(_0x3c79c7){return _0x3c79c7;});}return null;};}function removeEntity(_0x175a9d,_0x5b3ace){return function(_0x3c3328){if(_0x3c3328){return _0x3c3328[_0xdd7f('0x28')]()[_0xdd7f('0x27')](function(){var _0x455977=_0x3c3328[_0xdd7f('0x29')]({'plain':!![]});var _0xcc5dcb=_0xdd7f('0x2a');return db[_0xdd7f('0x2b')][_0xdd7f('0x28')]({'where':{'type':_0xcc5dcb,'resourceId':_0x455977['id']}})['then'](function(){return _0x3c3328;});})[_0xdd7f('0x27')](function(){_0x175a9d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f1492,_0x399b12){return function(_0xcac826){if(!_0xcac826){_0x2f1492[_0xdd7f('0x1c')](0x194);}return _0xcac826;};}function handleError(_0xabd864,_0x5cb3bb){_0x5cb3bb=_0x5cb3bb||0x1f4;return function(_0x2dea52){logger['error'](_0x2dea52[_0xdd7f('0x2c')]);if(_0x2dea52[_0xdd7f('0x2d')]){delete _0x2dea52[_0xdd7f('0x2d')];}_0xabd864[_0xdd7f('0x1d')](_0x5cb3bb)[_0xdd7f('0x2e')](_0x2dea52);};}exports[_0xdd7f('0x2f')]=function(_0x580c0a,_0x1105dd){var _0x6d13ad={},_0x2ef3cf={},_0x40dd49={'count':0x0,'rows':[]};var _0x1dd90a=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x3568fe){return{'name':_0x3568fe[_0xdd7f('0x30')],'type':_0x3568fe[_0xdd7f('0x31')]['key']};});_0x2ef3cf['model']=_[_0xdd7f('0x32')](_0x1dd90a,'name');_0x2ef3cf[_0xdd7f('0x33')]=_['keys'](_0x580c0a['query']);_0x2ef3cf[_0xdd7f('0x34')]=_[_0xdd7f('0x35')](_0x2ef3cf[_0xdd7f('0x36')],_0x2ef3cf['query']);_0x6d13ad[_0xdd7f('0x37')]=_[_0xdd7f('0x35')](_0x2ef3cf[_0xdd7f('0x36')],qs[_0xdd7f('0x38')](_0x580c0a[_0xdd7f('0x33')][_0xdd7f('0x38')]));_0x6d13ad[_0xdd7f('0x37')]=_0x6d13ad[_0xdd7f('0x37')][_0xdd7f('0x39')]?_0x6d13ad[_0xdd7f('0x37')]:_0x2ef3cf[_0xdd7f('0x36')];if(!_0x580c0a[_0xdd7f('0x33')]['hasOwnProperty'](_0xdd7f('0x3a'))){_0x6d13ad[_0xdd7f('0x20')]=qs[_0xdd7f('0x20')](_0x580c0a[_0xdd7f('0x33')][_0xdd7f('0x20')]);_0x6d13ad[_0xdd7f('0x1f')]=qs[_0xdd7f('0x1f')](_0x580c0a[_0xdd7f('0x33')][_0xdd7f('0x1f')]);}_0x6d13ad[_0xdd7f('0x3b')]=qs[_0xdd7f('0x3c')](_0x580c0a['query']['sort']);_0x6d13ad['where']=qs[_0xdd7f('0x34')](_[_0xdd7f('0x3d')](_0x580c0a[_0xdd7f('0x33')],_0x2ef3cf['filters']),_0x1dd90a);if(_0x580c0a[_0xdd7f('0x33')]['filter']){_0x6d13ad[_0xdd7f('0x3e')]=_['merge'](_0x6d13ad[_0xdd7f('0x3e')],{'$or':[{'key':{'$like':'%'+_0x580c0a['query'][_0xdd7f('0x3f')]+'%'}},{'value':{'$like':'%'+_0x580c0a[_0xdd7f('0x33')][_0xdd7f('0x3f')]+'%'}}]});}_0x6d13ad=_[_0xdd7f('0x40')]({},_0x6d13ad,_0x580c0a[_0xdd7f('0x41')]);var _0x2ea2de={'where':_0x6d13ad[_0xdd7f('0x3e')]};return db[_0xdd7f('0x42')][_0xdd7f('0x1e')](_0x2ea2de)['then'](function(_0x4f342f){_0x40dd49[_0xdd7f('0x1e')]=_0x4f342f;if(_0x580c0a[_0xdd7f('0x33')][_0xdd7f('0x43')]){_0x6d13ad['include']=[{'all':!![]}];}return db[_0xdd7f('0x42')][_0xdd7f('0x44')](_0x6d13ad);})['then'](function(_0x47ade5){_0x40dd49[_0xdd7f('0x45')]=_0x47ade5;return _0x40dd49;})['then'](respondWithFilteredResult(_0x1105dd,_0x6d13ad))[_0xdd7f('0x46')](handleError(_0x1105dd,null));};exports[_0xdd7f('0x47')]=function(_0x2be1f7,_0x2ee5ed){var _0x1d952f={'raw':!![],'where':{'id':_0x2be1f7[_0xdd7f('0x48')]['id']}},_0x31fd69={};_0x31fd69[_0xdd7f('0x36')]=_[_0xdd7f('0x49')](db[_0xdd7f('0x42')]['rawAttributes']);_0x31fd69[_0xdd7f('0x33')]=_[_0xdd7f('0x49')](_0x2be1f7['query']);_0x31fd69[_0xdd7f('0x34')]=_[_0xdd7f('0x35')](_0x31fd69[_0xdd7f('0x36')],_0x31fd69[_0xdd7f('0x33')]);_0x1d952f[_0xdd7f('0x37')]=_['intersection'](_0x31fd69['model'],qs[_0xdd7f('0x38')](_0x2be1f7['query'][_0xdd7f('0x38')]));_0x1d952f[_0xdd7f('0x37')]=_0x1d952f['attributes']['length']?_0x1d952f[_0xdd7f('0x37')]:_0x31fd69[_0xdd7f('0x36')];if(_0x2be1f7[_0xdd7f('0x33')]['includeAll']){_0x1d952f[_0xdd7f('0x4a')]=[{'all':!![]}];}_0x1d952f=_['merge']({},_0x1d952f,_0x2be1f7[_0xdd7f('0x41')]);return db[_0xdd7f('0x42')][_0xdd7f('0x4b')](_0x1d952f)[_0xdd7f('0x27')](handleEntityNotFound(_0x2ee5ed,null))[_0xdd7f('0x27')](respondWithResult(_0x2ee5ed,null))[_0xdd7f('0x46')](handleError(_0x2ee5ed,null));};exports[_0xdd7f('0x26')]=function(_0x1a1bb0,_0x2a09f5){if(_0x1a1bb0[_0xdd7f('0x4c')]['id']){delete _0x1a1bb0[_0xdd7f('0x4c')]['id'];}return db[_0xdd7f('0x42')]['find']({'where':{'id':_0x1a1bb0[_0xdd7f('0x48')]['id']}})[_0xdd7f('0x27')](handleEntityNotFound(_0x2a09f5,null))[_0xdd7f('0x27')](saveUpdates(_0x1a1bb0[_0xdd7f('0x4c')],null))[_0xdd7f('0x27')](respondWithResult(_0x2a09f5,null))[_0xdd7f('0x46')](handleError(_0x2a09f5,null));};exports[_0xdd7f('0x28')]=function(_0xc7318e,_0x97f9d0){return db[_0xdd7f('0x42')]['find']({'where':{'id':_0xc7318e['params']['id']}})['then'](handleEntityNotFound(_0x97f9d0,null))['then'](removeEntity(_0x97f9d0,null))[_0xdd7f('0x46')](handleError(_0x97f9d0,null));};exports[_0xdd7f('0x4d')]=function(_0x33897b,_0x580cf1){var _0xf92eea={'key':_0x33897b['body']['key']};if(_0x33897b[_0xdd7f('0x4c')][_0xdd7f('0x4e')]){_0xf92eea[_0xdd7f('0x4e')]=_0x33897b[_0xdd7f('0x4c')][_0xdd7f('0x4e')];}else if(_0x33897b['body'][_0xdd7f('0x4f')]){_0xf92eea['SmsAccountId']=_0x33897b[_0xdd7f('0x4c')][_0xdd7f('0x4f')];}else if(_0x33897b[_0xdd7f('0x4c')][_0xdd7f('0x50')]){_0xf92eea[_0xdd7f('0x50')]=_0x33897b[_0xdd7f('0x4c')][_0xdd7f('0x50')];}else if(_0x33897b[_0xdd7f('0x4c')]['ChatWebsiteId']){_0xf92eea[_0xdd7f('0x51')]=_0x33897b[_0xdd7f('0x4c')][_0xdd7f('0x51')];}return db['CannedAnswer'][_0xdd7f('0x4b')]({'where':_0xf92eea})[_0xdd7f('0x27')](function(_0x247903){if(_0x247903){throw new db[(_0xdd7f('0x52'))][(_0xdd7f('0x53'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xdd7f('0x42')][_0xdd7f('0x4d')](_0x33897b['body']);})[_0xdd7f('0x27')](function(_0x366059){var _0x16c306=_0x33897b[_0xdd7f('0x54')]['get']({'plain':!![]});if(!_0x16c306)throw new Error(_0xdd7f('0x55'));if(_0x16c306[_0xdd7f('0x56')]==='user'){var _0x5da8da=_0x366059[_0xdd7f('0x29')]({'plain':!![]});return db[_0xdd7f('0x57')][_0xdd7f('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x16c306['userProfileId']},'raw':!![]})[_0xdd7f('0x27')](function(_0x582c07){if(_0x582c07&&_0x582c07[_0xdd7f('0x58')]===0x0){return db[_0xdd7f('0x2b')]['create']({'name':_0x5da8da[_0xdd7f('0x2d')],'resourceId':_0x5da8da['id'],'type':_0x582c07['name'],'sectionId':_0x582c07['id']},{})[_0xdd7f('0x27')](function(){return _0x366059;});}else{return _0x366059;}})[_0xdd7f('0x46')](function(_0x8aa590){logger[_0xdd7f('0x59')](_0xdd7f('0x5a'),_0x8aa590);throw _0x8aa590;});}return _0x366059;})[_0xdd7f('0x27')](respondWithResult(_0x580cf1,0xc9))[_0xdd7f('0x46')](handleError(_0x580cf1,null));}; \ No newline at end of file +var _0x9119=['filter','merge','options','CannedAnswer','includeAll','findAll','catch','show','params','rawAttributes','include','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','CannedAnswers','UserProfileResource','end','error','name','send','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x221648,_0x2d46a5){var _0x3afc1f=function(_0x50ee4e){while(--_0x50ee4e){_0x221648['push'](_0x221648['shift']());}};_0x3afc1f(++_0x2d46a5);}(_0x9119,0x185));var _0x9911=function(_0x177b4b,_0x33f146){_0x177b4b=_0x177b4b-0x0;var _0x8ad94d=_0x9119[_0x177b4b];return _0x8ad94d;};'use strict';var emlformat=require(_0x9911('0x0'));var rimraf=require(_0x9911('0x1'));var zipdir=require(_0x9911('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9911('0x3'));var moment=require(_0x9911('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9911('0x5'));var util=require('util');var path=require(_0x9911('0x6'));var sox=require(_0x9911('0x7'));var csv=require(_0x9911('0x8'));var ejs=require(_0x9911('0x9'));var fs=require('fs');var fs_extra=require(_0x9911('0xa'));var _=require(_0x9911('0xb'));var squel=require(_0x9911('0xc'));var crypto=require(_0x9911('0xd'));var jsforce=require(_0x9911('0xe'));var deskjs=require(_0x9911('0xf'));var toCsv=require(_0x9911('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9911('0x10'));var authService=require(_0x9911('0x11'));var qs=require(_0x9911('0x12'));var as=require(_0x9911('0x13'));var hardwareService=require(_0x9911('0x14'));var logger=require(_0x9911('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9911('0x16'));var db=require(_0x9911('0x17'))['db'];function respondWithStatusCode(_0x2aaab2,_0x4ac66c){_0x4ac66c=_0x4ac66c||0xcc;return function(_0x419dac){if(_0x419dac){return _0x2aaab2[_0x9911('0x18')](_0x4ac66c);}return _0x2aaab2[_0x9911('0x19')](_0x4ac66c)['end']();};}function respondWithResult(_0x110ec6,_0xc28913){_0xc28913=_0xc28913||0xc8;return function(_0x38ebad){if(_0x38ebad){return _0x110ec6[_0x9911('0x19')](_0xc28913)[_0x9911('0x1a')](_0x38ebad);}};}function respondWithFilteredResult(_0x5dd660,_0x4c2a8d){return function(_0x56129e){if(_0x56129e){var _0x3f3ea5=typeof _0x4c2a8d[_0x9911('0x1b')]==='undefined'&&typeof _0x4c2a8d[_0x9911('0x1c')]==='undefined';var _0x293b66=_0x56129e[_0x9911('0x1d')];var _0x32af7c=_0x3f3ea5?0x0:_0x4c2a8d['offset'];var _0x16b395=_0x3f3ea5?_0x56129e[_0x9911('0x1d')]:_0x4c2a8d[_0x9911('0x1b')]+_0x4c2a8d['limit'];var _0x38a370;if(_0x16b395>=_0x293b66){_0x16b395=_0x293b66;_0x38a370=0xc8;}else{_0x38a370=0xce;}_0x5dd660[_0x9911('0x19')](_0x38a370);return _0x5dd660[_0x9911('0x1e')](_0x9911('0x1f'),_0x32af7c+'-'+_0x16b395+'/'+_0x293b66)[_0x9911('0x1a')](_0x56129e);}return null;};}function patchUpdates(_0x1d4dab){return function(_0x55a505){try{jsonpatch[_0x9911('0x20')](_0x55a505,_0x1d4dab,!![]);}catch(_0x26b38e){return BPromise[_0x9911('0x21')](_0x26b38e);}return _0x55a505[_0x9911('0x22')]();};}function saveUpdates(_0x4cff7c,_0x2221bc){return function(_0x31fe3c){if(_0x31fe3c){return _0x31fe3c['update'](_0x4cff7c)[_0x9911('0x23')](function(_0x333eb1){return _0x333eb1;});}return null;};}function removeEntity(_0x4a7888,_0x190b94){return function(_0x40117d){if(_0x40117d){return _0x40117d[_0x9911('0x24')]()['then'](function(){var _0x4915ef=_0x40117d['get']({'plain':!![]});var _0x5b8657=_0x9911('0x25');return db[_0x9911('0x26')]['destroy']({'where':{'type':_0x5b8657,'resourceId':_0x4915ef['id']}})[_0x9911('0x23')](function(){return _0x40117d;});})[_0x9911('0x23')](function(){_0x4a7888['status'](0xcc)[_0x9911('0x27')]();});}};}function handleEntityNotFound(_0xc8a03e,_0x1adcc0){return function(_0x5ec66c){if(!_0x5ec66c){_0xc8a03e[_0x9911('0x18')](0x194);}return _0x5ec66c;};}function handleError(_0x4a8bfc,_0x32bb80){_0x32bb80=_0x32bb80||0x1f4;return function(_0x4489f1){logger[_0x9911('0x28')](_0x4489f1['stack']);if(_0x4489f1[_0x9911('0x29')]){delete _0x4489f1[_0x9911('0x29')];}_0x4a8bfc[_0x9911('0x19')](_0x32bb80)[_0x9911('0x2a')](_0x4489f1);};}exports[_0x9911('0x2b')]=function(_0x37104f,_0x437567){var _0x4bc5da={},_0x412f09={},_0x24eeba={'count':0x0,'rows':[]};var _0x4eddbb=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x771f62){return{'name':_0x771f62[_0x9911('0x2c')],'type':_0x771f62[_0x9911('0x2d')][_0x9911('0x2e')]};});_0x412f09['model']=_['map'](_0x4eddbb,_0x9911('0x29'));_0x412f09[_0x9911('0x2f')]=_[_0x9911('0x30')](_0x37104f['query']);_0x412f09[_0x9911('0x31')]=_[_0x9911('0x32')](_0x412f09[_0x9911('0x33')],_0x412f09[_0x9911('0x2f')]);_0x4bc5da['attributes']=_[_0x9911('0x32')](_0x412f09[_0x9911('0x33')],qs[_0x9911('0x34')](_0x37104f[_0x9911('0x2f')][_0x9911('0x34')]));_0x4bc5da['attributes']=_0x4bc5da[_0x9911('0x35')][_0x9911('0x36')]?_0x4bc5da[_0x9911('0x35')]:_0x412f09[_0x9911('0x33')];if(!_0x37104f[_0x9911('0x2f')][_0x9911('0x37')](_0x9911('0x38'))){_0x4bc5da['limit']=qs[_0x9911('0x1c')](_0x37104f[_0x9911('0x2f')][_0x9911('0x1c')]);_0x4bc5da['offset']=qs[_0x9911('0x1b')](_0x37104f[_0x9911('0x2f')][_0x9911('0x1b')]);}_0x4bc5da[_0x9911('0x39')]=qs['sort'](_0x37104f[_0x9911('0x2f')][_0x9911('0x3a')]);_0x4bc5da[_0x9911('0x3b')]=qs[_0x9911('0x31')](_[_0x9911('0x3c')](_0x37104f[_0x9911('0x2f')],_0x412f09[_0x9911('0x31')]),_0x4eddbb);if(_0x37104f[_0x9911('0x2f')][_0x9911('0x3d')]){_0x4bc5da[_0x9911('0x3b')]=_[_0x9911('0x3e')](_0x4bc5da[_0x9911('0x3b')],{'$or':[{'key':{'$like':'%'+_0x37104f[_0x9911('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0x37104f['query'][_0x9911('0x3d')]+'%'}}]});}_0x4bc5da=_[_0x9911('0x3e')]({},_0x4bc5da,_0x37104f[_0x9911('0x3f')]);var _0x8d75f8={'where':_0x4bc5da[_0x9911('0x3b')]};return db[_0x9911('0x40')]['count'](_0x8d75f8)['then'](function(_0x367e02){_0x24eeba[_0x9911('0x1d')]=_0x367e02;if(_0x37104f[_0x9911('0x2f')][_0x9911('0x41')]){_0x4bc5da['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x9911('0x42')](_0x4bc5da);})[_0x9911('0x23')](function(_0x7521e8){_0x24eeba['rows']=_0x7521e8;return _0x24eeba;})['then'](respondWithFilteredResult(_0x437567,_0x4bc5da))[_0x9911('0x43')](handleError(_0x437567,null));};exports[_0x9911('0x44')]=function(_0xc6694e,_0x852582){var _0x212df1={'raw':!![],'where':{'id':_0xc6694e[_0x9911('0x45')]['id']}},_0x52ea2c={};_0x52ea2c[_0x9911('0x33')]=_[_0x9911('0x30')](db['CannedAnswer'][_0x9911('0x46')]);_0x52ea2c[_0x9911('0x2f')]=_[_0x9911('0x30')](_0xc6694e[_0x9911('0x2f')]);_0x52ea2c[_0x9911('0x31')]=_[_0x9911('0x32')](_0x52ea2c['model'],_0x52ea2c[_0x9911('0x2f')]);_0x212df1[_0x9911('0x35')]=_[_0x9911('0x32')](_0x52ea2c[_0x9911('0x33')],qs[_0x9911('0x34')](_0xc6694e[_0x9911('0x2f')][_0x9911('0x34')]));_0x212df1[_0x9911('0x35')]=_0x212df1[_0x9911('0x35')][_0x9911('0x36')]?_0x212df1[_0x9911('0x35')]:_0x52ea2c[_0x9911('0x33')];if(_0xc6694e[_0x9911('0x2f')][_0x9911('0x41')]){_0x212df1[_0x9911('0x47')]=[{'all':!![]}];}_0x212df1=_['merge']({},_0x212df1,_0xc6694e[_0x9911('0x3f')]);return db[_0x9911('0x40')][_0x9911('0x48')](_0x212df1)[_0x9911('0x23')](handleEntityNotFound(_0x852582,null))['then'](respondWithResult(_0x852582,null))['catch'](handleError(_0x852582,null));};exports[_0x9911('0x49')]=function(_0x2a00c5,_0x3db21d){if(_0x2a00c5[_0x9911('0x4a')]['id']){delete _0x2a00c5[_0x9911('0x4a')]['id'];}return db[_0x9911('0x40')][_0x9911('0x48')]({'where':{'id':_0x2a00c5[_0x9911('0x45')]['id']}})[_0x9911('0x23')](handleEntityNotFound(_0x3db21d,null))[_0x9911('0x23')](saveUpdates(_0x2a00c5[_0x9911('0x4a')],null))[_0x9911('0x23')](respondWithResult(_0x3db21d,null))[_0x9911('0x43')](handleError(_0x3db21d,null));};exports[_0x9911('0x24')]=function(_0x23b60e,_0x2eb18a){return db['CannedAnswer'][_0x9911('0x48')]({'where':{'id':_0x23b60e[_0x9911('0x45')]['id']}})[_0x9911('0x23')](handleEntityNotFound(_0x2eb18a,null))[_0x9911('0x23')](removeEntity(_0x2eb18a,null))[_0x9911('0x43')](handleError(_0x2eb18a,null));};exports[_0x9911('0x4b')]=function(_0x579cba,_0x552fd4){var _0x5cae87={'key':_0x579cba[_0x9911('0x4a')][_0x9911('0x2e')]};if(_0x579cba[_0x9911('0x4a')]['MailAccountId']){_0x5cae87[_0x9911('0x4c')]=_0x579cba[_0x9911('0x4a')][_0x9911('0x4c')];}else if(_0x579cba[_0x9911('0x4a')][_0x9911('0x4d')]){_0x5cae87['SmsAccountId']=_0x579cba[_0x9911('0x4a')][_0x9911('0x4d')];}else if(_0x579cba[_0x9911('0x4a')][_0x9911('0x4e')]){_0x5cae87[_0x9911('0x4e')]=_0x579cba['body'][_0x9911('0x4e')];}else if(_0x579cba[_0x9911('0x4a')]['ChatWebsiteId']){_0x5cae87[_0x9911('0x4f')]=_0x579cba[_0x9911('0x4a')][_0x9911('0x4f')];}return db[_0x9911('0x40')][_0x9911('0x48')]({'where':_0x5cae87})[_0x9911('0x23')](function(_0x418326){if(_0x418326){throw new db[(_0x9911('0x50'))][(_0x9911('0x51'))](_0x9911('0x52'));}return db[_0x9911('0x40')][_0x9911('0x4b')](_0x579cba['body']);})['then'](function(_0x4ef15f){var _0x10dbf6=_0x579cba['user']['get']({'plain':!![]});if(!_0x10dbf6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10dbf6[_0x9911('0x53')]===_0x9911('0x54')){var _0x4d2fa0=_0x4ef15f[_0x9911('0x55')]({'plain':!![]});return db[_0x9911('0x56')]['find']({'where':{'name':_0x9911('0x25'),'userProfileId':_0x10dbf6[_0x9911('0x57')]},'raw':!![]})[_0x9911('0x23')](function(_0x54f545){if(_0x54f545&&_0x54f545[_0x9911('0x58')]===0x0){return db[_0x9911('0x26')][_0x9911('0x4b')]({'name':_0x4d2fa0['name'],'resourceId':_0x4d2fa0['id'],'type':_0x54f545[_0x9911('0x29')],'sectionId':_0x54f545['id']},{})[_0x9911('0x23')](function(){return _0x4ef15f;});}else{return _0x4ef15f;}})[_0x9911('0x43')](function(_0x5e3ba2){logger[_0x9911('0x28')](_0x9911('0x59'),_0x5e3ba2);throw _0x5e3ba2;});}return _0x4ef15f;})[_0x9911('0x23')](respondWithResult(_0x552fd4,0xc9))[_0x9911('0x43')](handleError(_0x552fd4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1448795..ad90199 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 _0x8b54=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','./cannedAnswer.attributes','exports'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x8b54,0x1a8));var _0x48b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b54[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x48b5('0x0'));var util=require(_0x48b5('0x1'));var logger=require('../../config/logger')(_0x48b5('0x2'));var moment=require(_0x48b5('0x3'));var BPromise=require('bluebird');var rp=require(_0x48b5('0x4'));var fs=require('fs');var path=require(_0x48b5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x48b5('0x6'));module[_0x48b5('0x7')]=function(_0x129382,_0x33064f){return _0x129382['define'](_0x48b5('0x8'),attributes,{'tableName':_0x48b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x48b5('0xa'),'collate':_0x48b5('0xb')});}; \ No newline at end of file +var _0xc2e1=['./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3771eb,_0x2361c7){var _0x3e4a02=function(_0x5eb364){while(--_0x5eb364){_0x3771eb['push'](_0x3771eb['shift']());}};_0x3e4a02(++_0x2361c7);}(_0xc2e1,0x1b3));var _0x1c2e=function(_0x1a3f08,_0x1ac9e0){_0x1a3f08=_0x1a3f08-0x0;var _0x2057f6=_0xc2e1[_0x1a3f08];return _0x2057f6;};'use strict';var _=require(_0x1c2e('0x0'));var util=require('util');var logger=require(_0x1c2e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1c2e('0x2'));var rp=require(_0x1c2e('0x3'));var fs=require('fs');var path=require(_0x1c2e('0x4'));var rimraf=require(_0x1c2e('0x5'));var config=require(_0x1c2e('0x6'));var attributes=require(_0x1c2e('0x7'));module[_0x1c2e('0x8')]=function(_0x237fa8,_0x31a7df){return _0x237fa8[_0x1c2e('0x9')]('CannedAnswer',attributes,{'tableName':_0x1c2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1c2e('0xb'),'collate':_0x1c2e('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index c45f873..31bea5c 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(_0x329cff,_0x23abc1){var _0x7b53f4=function(_0x10bd89){while(--_0x10bd89){_0x329cff['push'](_0x329cff['shift']());}};_0x7b53f4(++_0x23abc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x181431,_0x414c32){var _0xc0536=function(_0x26a622){while(--_0x26a622){_0x181431['push'](_0x181431['shift']());}};_0xc0536(++_0x414c32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 a718be1..0e89e92 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 _0x8076=['get','isAuthenticated','show','post','put','/:id','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8076,0x169));var _0x6807=function(_0x90f7ae,_0x3d4ecf){_0x90f7ae=_0x90f7ae-0x0;var _0xfb7e10=_0x8076[_0x90f7ae];return _0xfb7e10;};'use strict';var multer=require(_0x6807('0x0'));var util=require(_0x6807('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6807('0x2')]();var fs_extra=require(_0x6807('0x3'));var auth=require(_0x6807('0x4'));var interaction=require(_0x6807('0x5'));var config=require('../../config/environment');var controller=require(_0x6807('0x6'));router[_0x6807('0x7')]('/',auth[_0x6807('0x8')](),controller['index']);router[_0x6807('0x7')]('/:id',auth[_0x6807('0x8')](),controller[_0x6807('0x9')]);router[_0x6807('0xa')]('/',auth[_0x6807('0x8')](),controller['create']);router[_0x6807('0xb')](_0x6807('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6807('0xd')](_0x6807('0xc'),auth['isAuthenticated'](),controller[_0x6807('0xe')]);module[_0x6807('0xf')]=router; \ No newline at end of file +var _0x9eb9=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x59a0f3,_0x1828e9){var _0x31ea30=function(_0x213711){while(--_0x213711){_0x59a0f3['push'](_0x59a0f3['shift']());}};_0x31ea30(++_0x1828e9);}(_0x9eb9,0x10c));var _0x99eb=function(_0x5a4bf8,_0x131755){_0x5a4bf8=_0x5a4bf8-0x0;var _0x4c0bb3=_0x9eb9[_0x5a4bf8];return _0x4c0bb3;};'use strict';var multer=require(_0x99eb('0x0'));var util=require(_0x99eb('0x1'));var path=require(_0x99eb('0x2'));var timeout=require(_0x99eb('0x3'));var express=require(_0x99eb('0x4'));var router=express[_0x99eb('0x5')]();var fs_extra=require(_0x99eb('0x6'));var auth=require(_0x99eb('0x7'));var interaction=require(_0x99eb('0x8'));var config=require(_0x99eb('0x9'));var controller=require(_0x99eb('0xa'));router[_0x99eb('0xb')]('/',auth[_0x99eb('0xc')](),controller[_0x99eb('0xd')]);router[_0x99eb('0xb')]('/:id',auth[_0x99eb('0xc')](),controller[_0x99eb('0xe')]);router[_0x99eb('0xf')]('/',auth[_0x99eb('0xc')](),controller[_0x99eb('0x10')]);router[_0x99eb('0x11')](_0x99eb('0x12'),auth[_0x99eb('0xc')](),controller[_0x99eb('0x13')]);router[_0x99eb('0x14')](_0x99eb('0x12'),auth[_0x99eb('0xc')](),controller[_0x99eb('0x15')]);module[_0x99eb('0x16')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 217e426..f43b2b3 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 _0x851d=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1df45d,_0x1a446d){var _0x512f7c=function(_0xbf46f3){while(--_0xbf46f3){_0x1df45d['push'](_0x1df45d['shift']());}};_0x512f7c(++_0x1a446d);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd851('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xd851('0x1')],'allowNull':![],'defaultValue':_0xd851('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xd851('0x3')]},'dst':{'type':Sequelize[_0xd851('0x3')]},'dcontext':{'type':Sequelize[_0xd851('0x3')]},'channel':{'type':Sequelize[_0xd851('0x3')]},'dstchannel':{'type':Sequelize[_0xd851('0x3')]},'lastapp':{'type':Sequelize[_0xd851('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd851('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd851('0x3')]},'amaflags':{'type':Sequelize[_0xd851('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd851('0x3')]},'userfield':{'type':Sequelize[_0xd851('0x3')]},'uniqueid':{'type':Sequelize[_0xd851('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xd851('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd851('0x3')]},'tag':{'type':Sequelize[_0xd851('0x3')]}}; \ No newline at end of file +var _0x5271=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x553019,_0x5dd7b9){var _0x2bc10e=function(_0x365bd4){while(--_0x365bd4){_0x553019['push'](_0x553019['shift']());}};_0x2bc10e(++_0x5dd7b9);}(_0x5271,0xa0));var _0x1527=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x5271[_0x5cb1af];return _0x8d7940;};'use strict';var Sequelize=require(_0x1527('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x1527('0x1')],'allowNull':![],'defaultValue':_0x1527('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x1527('0x3')]},'dst':{'type':Sequelize[_0x1527('0x3')]},'dcontext':{'type':Sequelize[_0x1527('0x3')]},'channel':{'type':Sequelize[_0x1527('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x1527('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1527('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1527('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x1527('0x3')]},'uniqueid':{'type':Sequelize[_0x1527('0x3')]},'linkedid':{'type':Sequelize[_0x1527('0x3')]},'sequence':{'type':Sequelize[_0x1527('0x3')]},'peeraccount':{'type':Sequelize[_0x1527('0x3')]},'type':{'type':Sequelize[_0x1527('0x3')]},'tag':{'type':Sequelize[_0x1527('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 61c305e..80ff259 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 _0x8375=['attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','destroy','then','error','stack','name','send','map','Cdr','fieldName','type','model','query','keys'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x8375,0xa8));var _0x5837=function(_0x45f5d2,_0x1d8c8a){_0x45f5d2=_0x45f5d2-0x0;var _0x20353b=_0x8375[_0x45f5d2];return _0x20353b;};'use strict';var emlformat=require(_0x5837('0x0'));var rimraf=require(_0x5837('0x1'));var zipdir=require(_0x5837('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require(_0x5837('0x6'));var util=require(_0x5837('0x7'));var path=require(_0x5837('0x8'));var sox=require('sox');var csv=require(_0x5837('0x9'));var ejs=require(_0x5837('0xa'));var fs=require('fs');var fs_extra=require(_0x5837('0xb'));var _=require(_0x5837('0xc'));var squel=require(_0x5837('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x9'));var querystring=require('querystring');var Papa=require(_0x5837('0xf'));var Redis=require('ioredis');var authService=require(_0x5837('0x10'));var qs=require(_0x5837('0x11'));var as=require(_0x5837('0x12'));var hardwareService=require(_0x5837('0x13'));var logger=require(_0x5837('0x14'))(_0x5837('0x15'));var utils=require('../../config/utils');var config=require(_0x5837('0x16'));var licenseUtil=require(_0x5837('0x17'));var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x10c1a1,_0x143210){_0x143210=_0x143210||0xcc;return function(_0x485366){if(_0x485366){return _0x10c1a1['sendStatus'](_0x143210);}return _0x10c1a1['status'](_0x143210)[_0x5837('0x19')]();};}function respondWithResult(_0x111dbf,_0x469903){_0x469903=_0x469903||0xc8;return function(_0xa5718d){if(_0xa5718d){return _0x111dbf[_0x5837('0x1a')](_0x469903)[_0x5837('0x1b')](_0xa5718d);}};}function respondWithFilteredResult(_0x206f02,_0x754f39){return function(_0x10d882){if(_0x10d882){var _0x59a378=typeof _0x754f39[_0x5837('0x1c')]===_0x5837('0x1d')&&typeof _0x754f39['limit']===_0x5837('0x1d');var _0x2297b4=_0x10d882[_0x5837('0x1e')];var _0x49279d=_0x59a378?0x0:_0x754f39['offset'];var _0x4bee08=_0x59a378?_0x10d882[_0x5837('0x1e')]:_0x754f39[_0x5837('0x1c')]+_0x754f39[_0x5837('0x1f')];var _0x58e7f7;if(_0x4bee08>=_0x2297b4){_0x4bee08=_0x2297b4;_0x58e7f7=0xc8;}else{_0x58e7f7=0xce;}_0x206f02[_0x5837('0x1a')](_0x58e7f7);return _0x206f02[_0x5837('0x20')](_0x5837('0x21'),_0x49279d+'-'+_0x4bee08+'/'+_0x2297b4)[_0x5837('0x1b')](_0x10d882);}return null;};}function patchUpdates(_0x5881ff){return function(_0x4908c2){try{jsonpatch['apply'](_0x4908c2,_0x5881ff,!![]);}catch(_0x3d352f){return BPromise['reject'](_0x3d352f);}return _0x4908c2[_0x5837('0x22')]();};}function saveUpdates(_0x2bd103,_0x32733a){return function(_0x3a7efe){if(_0x3a7efe){return _0x3a7efe['update'](_0x2bd103)['then'](function(_0x1b80db){return _0x1b80db;});}return null;};}function removeEntity(_0x2262b9,_0x406506){return function(_0x5e8089){if(_0x5e8089){return _0x5e8089[_0x5837('0x23')]()[_0x5837('0x24')](function(){_0x2262b9[_0x5837('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f86a,_0x2646ed){return function(_0x39babd){if(!_0x39babd){_0x41f86a['sendStatus'](0x194);}return _0x39babd;};}function handleError(_0x57baed,_0x1d545c){_0x1d545c=_0x1d545c||0x1f4;return function(_0x15655e){logger[_0x5837('0x25')](_0x15655e[_0x5837('0x26')]);if(_0x15655e[_0x5837('0x27')]){delete _0x15655e[_0x5837('0x27')];}_0x57baed[_0x5837('0x1a')](_0x1d545c)[_0x5837('0x28')](_0x15655e);};}exports['index']=function(_0x2f0c8d,_0x13830f){var _0x3cbd3f={},_0x3918ee={},_0x1c9f32={'count':0x0,'rows':[]};var _0x228f1=_[_0x5837('0x29')](db[_0x5837('0x2a')]['rawAttributes'],function(_0x4f7502){return{'name':_0x4f7502[_0x5837('0x2b')],'type':_0x4f7502[_0x5837('0x2c')]['key']};});_0x3918ee[_0x5837('0x2d')]=_[_0x5837('0x29')](_0x228f1,'name');_0x3918ee[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x2f0c8d[_0x5837('0x2e')]);_0x3918ee['filters']=_['intersection'](_0x3918ee['model'],_0x3918ee[_0x5837('0x2e')]);_0x3cbd3f[_0x5837('0x30')]=_[_0x5837('0x31')](_0x3918ee[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x2f0c8d['query']['fields']));_0x3cbd3f[_0x5837('0x30')]=_0x3cbd3f[_0x5837('0x30')]['length']?_0x3cbd3f['attributes']:_0x3918ee[_0x5837('0x2d')];if(!_0x2f0c8d['query']['hasOwnProperty'](_0x5837('0x33'))){_0x3cbd3f[_0x5837('0x1f')]=qs['limit'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1f')]);_0x3cbd3f[_0x5837('0x1c')]=qs['offset'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1c')]);}_0x3cbd3f[_0x5837('0x34')]=qs[_0x5837('0x35')](_0x2f0c8d[_0x5837('0x2e')]['sort']);_0x3cbd3f[_0x5837('0x36')]=qs['filters'](_['pick'](_0x2f0c8d[_0x5837('0x2e')],_0x3918ee[_0x5837('0x37')]),_0x228f1);if(_0x2f0c8d['query'][_0x5837('0x38')]){_0x3cbd3f[_0x5837('0x36')]=_[_0x5837('0x39')](_0x3cbd3f[_0x5837('0x36')],{'$or':_['map'](_0x228f1,function(_0x2ed688){if(_0x2ed688[_0x5837('0x2c')]!==_0x5837('0x3a')){var _0x5dcd18={};_0x5dcd18[_0x2ed688[_0x5837('0x27')]]={'$like':'%'+_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x38')]+'%'};return _0x5dcd18;}})});}_0x3cbd3f=_[_0x5837('0x39')]({},_0x3cbd3f,_0x2f0c8d[_0x5837('0x3b')]);var _0x76f00d={'where':_0x3cbd3f[_0x5837('0x36')]};return db[_0x5837('0x2a')][_0x5837('0x1e')](_0x76f00d)[_0x5837('0x24')](function(_0x1a5e2d){_0x1c9f32[_0x5837('0x1e')]=_0x1a5e2d;if(_0x2f0c8d['query']['includeAll']){_0x3cbd3f[_0x5837('0x3c')]=[{'all':!![]}];}return db[_0x5837('0x2a')]['findAll'](_0x3cbd3f);})[_0x5837('0x24')](function(_0x1ae168){_0x1c9f32[_0x5837('0x3d')]=_0x1ae168;return _0x1c9f32;})['then'](respondWithFilteredResult(_0x13830f,_0x3cbd3f))[_0x5837('0x3e')](handleError(_0x13830f,null));};exports[_0x5837('0x3f')]=function(_0x1c81ed,_0x3acdf5){var _0x4643e3={'raw':!![],'where':{'id':_0x1c81ed[_0x5837('0x40')]['id']}},_0xd443be={};_0xd443be[_0x5837('0x2d')]=_[_0x5837('0x2f')](db['Cdr'][_0x5837('0x41')]);_0xd443be[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x1c81ed['query']);_0xd443be['filters']=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],_0xd443be[_0x5837('0x2e')]);_0x4643e3[_0x5837('0x30')]=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x1c81ed[_0x5837('0x2e')][_0x5837('0x32')]));_0x4643e3[_0x5837('0x30')]=_0x4643e3[_0x5837('0x30')][_0x5837('0x42')]?_0x4643e3['attributes']:_0xd443be[_0x5837('0x2d')];if(_0x1c81ed['query'][_0x5837('0x43')]){_0x4643e3[_0x5837('0x3c')]=[{'all':!![]}];}_0x4643e3=_['merge']({},_0x4643e3,_0x1c81ed[_0x5837('0x3b')]);return db[_0x5837('0x2a')]['find'](_0x4643e3)[_0x5837('0x24')](handleEntityNotFound(_0x3acdf5,null))[_0x5837('0x24')](respondWithResult(_0x3acdf5,null))[_0x5837('0x3e')](handleError(_0x3acdf5,null));};exports[_0x5837('0x44')]=function(_0x54a23b,_0x55cf2b){return db[_0x5837('0x2a')][_0x5837('0x44')](_0x54a23b['body'],{})['then'](respondWithResult(_0x55cf2b,0xc9))['catch'](handleError(_0x55cf2b,null));};exports['update']=function(_0x38e987,_0x6423f2){if(_0x38e987[_0x5837('0x45')]['id']){delete _0x38e987['body']['id'];}return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x38e987[_0x5837('0x40')]['id']}})[_0x5837('0x24')](handleEntityNotFound(_0x6423f2,null))[_0x5837('0x24')](saveUpdates(_0x38e987[_0x5837('0x45')],null))[_0x5837('0x24')](respondWithResult(_0x6423f2,null))[_0x5837('0x3e')](handleError(_0x6423f2,null));};exports[_0x5837('0x23')]=function(_0x27f7b9,_0x38743a){return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x27f7b9[_0x5837('0x40')]['id']}})['then'](handleEntityNotFound(_0x38743a,null))[_0x5837('0x24')](removeEntity(_0x38743a,null))[_0x5837('0x3e')](handleError(_0x38743a,null));};exports[_0x5837('0x47')]=function(_0x397cd9,_0x38e75d){return db['Cdr'][_0x5837('0x47')]()[_0x5837('0x24')](respondWithResult(_0x38e75d,null))[_0x5837('0x3e')](handleError(_0x38e75d,null));}; \ No newline at end of file +var _0x86f4=['bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Cdr','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x17ed0e,_0x266562){var _0x16c92a=function(_0x28b59b){while(--_0x28b59b){_0x17ed0e['push'](_0x17ed0e['shift']());}};_0x16c92a(++_0x266562);}(_0x86f4,0x18a));var _0x486f=function(_0x43c7fa,_0x19eba1){_0x43c7fa=_0x43c7fa-0x0;var _0x42bf81=_0x86f4[_0x43c7fa];return _0x42bf81;};'use strict';var emlformat=require(_0x486f('0x0'));var rimraf=require(_0x486f('0x1'));var zipdir=require(_0x486f('0x2'));var jsonpatch=require(_0x486f('0x3'));var rp=require(_0x486f('0x4'));var moment=require(_0x486f('0x5'));var BPromise=require(_0x486f('0x6'));var Mustache=require('mustache');var util=require(_0x486f('0x7'));var path=require(_0x486f('0x8'));var sox=require('sox');var csv=require(_0x486f('0x9'));var ejs=require(_0x486f('0xa'));var fs=require('fs');var fs_extra=require(_0x486f('0xb'));var _=require(_0x486f('0xc'));var squel=require(_0x486f('0xd'));var crypto=require(_0x486f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x486f('0xf'));var toCsv=require(_0x486f('0x9'));var querystring=require(_0x486f('0x10'));var Papa=require(_0x486f('0x11'));var Redis=require(_0x486f('0x12'));var authService=require(_0x486f('0x13'));var qs=require(_0x486f('0x14'));var as=require(_0x486f('0x15'));var hardwareService=require(_0x486f('0x16'));var logger=require(_0x486f('0x17'))(_0x486f('0x18'));var utils=require(_0x486f('0x19'));var config=require(_0x486f('0x1a'));var licenseUtil=require(_0x486f('0x1b'));var db=require(_0x486f('0x1c'))['db'];function respondWithStatusCode(_0x4312fb,_0x1c4e55){_0x1c4e55=_0x1c4e55||0xcc;return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4312fb[_0x486f('0x1d')](_0x1c4e55);}return _0x4312fb['status'](_0x1c4e55)[_0x486f('0x1e')]();};}function respondWithResult(_0x2cc608,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x50bee8){if(_0x50bee8){return _0x2cc608['status'](_0x1ac871)[_0x486f('0x1f')](_0x50bee8);}};}function respondWithFilteredResult(_0x3a4fef,_0x51334f){return function(_0x16830e){if(_0x16830e){var _0x2ab753=typeof _0x51334f[_0x486f('0x20')]==='undefined'&&typeof _0x51334f['limit']===_0x486f('0x21');var _0x3eeae0=_0x16830e[_0x486f('0x22')];var _0x39bfac=_0x2ab753?0x0:_0x51334f['offset'];var _0x59deb8=_0x2ab753?_0x16830e[_0x486f('0x22')]:_0x51334f[_0x486f('0x20')]+_0x51334f[_0x486f('0x23')];var _0x20a1f7;if(_0x59deb8>=_0x3eeae0){_0x59deb8=_0x3eeae0;_0x20a1f7=0xc8;}else{_0x20a1f7=0xce;}_0x3a4fef[_0x486f('0x24')](_0x20a1f7);return _0x3a4fef[_0x486f('0x25')](_0x486f('0x26'),_0x39bfac+'-'+_0x59deb8+'/'+_0x3eeae0)[_0x486f('0x1f')](_0x16830e);}return null;};}function patchUpdates(_0xe0b1cc){return function(_0x3d79bc){try{jsonpatch[_0x486f('0x27')](_0x3d79bc,_0xe0b1cc,!![]);}catch(_0x4ccac0){return BPromise[_0x486f('0x28')](_0x4ccac0);}return _0x3d79bc[_0x486f('0x29')]();};}function saveUpdates(_0x26a909,_0x4a0eb5){return function(_0x4d784e){if(_0x4d784e){return _0x4d784e[_0x486f('0x2a')](_0x26a909)[_0x486f('0x2b')](function(_0x16a530){return _0x16a530;});}return null;};}function removeEntity(_0x14b309,_0x351f81){return function(_0x26822b){if(_0x26822b){return _0x26822b[_0x486f('0x2c')]()[_0x486f('0x2b')](function(){_0x14b309[_0x486f('0x24')](0xcc)[_0x486f('0x1e')]();});}};}function handleEntityNotFound(_0x2e983b,_0x71a26f){return function(_0x387462){if(!_0x387462){_0x2e983b[_0x486f('0x1d')](0x194);}return _0x387462;};}function handleError(_0x8b3277,_0x30b322){_0x30b322=_0x30b322||0x1f4;return function(_0x6f1e8e){logger[_0x486f('0x2d')](_0x6f1e8e[_0x486f('0x2e')]);if(_0x6f1e8e[_0x486f('0x2f')]){delete _0x6f1e8e[_0x486f('0x2f')];}_0x8b3277[_0x486f('0x24')](_0x30b322)['send'](_0x6f1e8e);};}exports['index']=function(_0x52fb3a,_0x5b4718){var _0x173512={},_0x5c994a={},_0x2003a3={'count':0x0,'rows':[]};var _0x3ffa45=_['map'](db[_0x486f('0x30')]['rawAttributes'],function(_0x1f9dee){return{'name':_0x1f9dee[_0x486f('0x31')],'type':_0x1f9dee[_0x486f('0x32')][_0x486f('0x33')]};});_0x5c994a[_0x486f('0x34')]=_[_0x486f('0x35')](_0x3ffa45,'name');_0x5c994a[_0x486f('0x36')]=_[_0x486f('0x37')](_0x52fb3a[_0x486f('0x36')]);_0x5c994a[_0x486f('0x38')]=_[_0x486f('0x39')](_0x5c994a[_0x486f('0x34')],_0x5c994a[_0x486f('0x36')]);_0x173512[_0x486f('0x3a')]=_['intersection'](_0x5c994a[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x52fb3a['query'][_0x486f('0x3b')]));_0x173512[_0x486f('0x3a')]=_0x173512[_0x486f('0x3a')][_0x486f('0x3c')]?_0x173512[_0x486f('0x3a')]:_0x5c994a['model'];if(!_0x52fb3a[_0x486f('0x36')][_0x486f('0x3d')](_0x486f('0x3e'))){_0x173512[_0x486f('0x23')]=qs[_0x486f('0x23')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x23')]);_0x173512['offset']=qs[_0x486f('0x20')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x20')]);}_0x173512['order']=qs['sort'](_0x52fb3a[_0x486f('0x36')][_0x486f('0x3f')]);_0x173512['where']=qs[_0x486f('0x38')](_['pick'](_0x52fb3a[_0x486f('0x36')],_0x5c994a[_0x486f('0x38')]),_0x3ffa45);if(_0x52fb3a['query']['filter']){_0x173512[_0x486f('0x40')]=_[_0x486f('0x41')](_0x173512[_0x486f('0x40')],{'$or':_[_0x486f('0x35')](_0x3ffa45,function(_0xdedd85){if(_0xdedd85[_0x486f('0x32')]!==_0x486f('0x42')){var _0x1742e0={};_0x1742e0[_0xdedd85[_0x486f('0x2f')]]={'$like':'%'+_0x52fb3a[_0x486f('0x36')][_0x486f('0x43')]+'%'};return _0x1742e0;}})});}_0x173512=_[_0x486f('0x41')]({},_0x173512,_0x52fb3a[_0x486f('0x44')]);var _0x43d9be={'where':_0x173512['where']};return db[_0x486f('0x30')][_0x486f('0x22')](_0x43d9be)['then'](function(_0x12f7dc){_0x2003a3[_0x486f('0x22')]=_0x12f7dc;if(_0x52fb3a[_0x486f('0x36')][_0x486f('0x45')]){_0x173512[_0x486f('0x46')]=[{'all':!![]}];}return db[_0x486f('0x30')][_0x486f('0x47')](_0x173512);})[_0x486f('0x2b')](function(_0x3205e0){_0x2003a3['rows']=_0x3205e0;return _0x2003a3;})['then'](respondWithFilteredResult(_0x5b4718,_0x173512))[_0x486f('0x48')](handleError(_0x5b4718,null));};exports[_0x486f('0x49')]=function(_0x3cf897,_0x42ef68){var _0x2937a6={'raw':!![],'where':{'id':_0x3cf897[_0x486f('0x4a')]['id']}},_0x250979={};_0x250979[_0x486f('0x34')]=_[_0x486f('0x37')](db['Cdr'][_0x486f('0x4b')]);_0x250979[_0x486f('0x36')]=_[_0x486f('0x37')](_0x3cf897[_0x486f('0x36')]);_0x250979['filters']=_[_0x486f('0x39')](_0x250979['model'],_0x250979[_0x486f('0x36')]);_0x2937a6[_0x486f('0x3a')]=_[_0x486f('0x39')](_0x250979[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x3cf897[_0x486f('0x36')]['fields']));_0x2937a6['attributes']=_0x2937a6[_0x486f('0x3a')][_0x486f('0x3c')]?_0x2937a6[_0x486f('0x3a')]:_0x250979[_0x486f('0x34')];if(_0x3cf897['query'][_0x486f('0x45')]){_0x2937a6[_0x486f('0x46')]=[{'all':!![]}];}_0x2937a6=_[_0x486f('0x41')]({},_0x2937a6,_0x3cf897['options']);return db[_0x486f('0x30')][_0x486f('0x4c')](_0x2937a6)[_0x486f('0x2b')](handleEntityNotFound(_0x42ef68,null))[_0x486f('0x2b')](respondWithResult(_0x42ef68,null))[_0x486f('0x48')](handleError(_0x42ef68,null));};exports[_0x486f('0x4d')]=function(_0xb65e98,_0x21f222){return db['Cdr'][_0x486f('0x4d')](_0xb65e98['body'],{})[_0x486f('0x2b')](respondWithResult(_0x21f222,0xc9))[_0x486f('0x48')](handleError(_0x21f222,null));};exports[_0x486f('0x2a')]=function(_0x1055cf,_0x34033e){if(_0x1055cf[_0x486f('0x4e')]['id']){delete _0x1055cf['body']['id'];}return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x1055cf[_0x486f('0x4a')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x2b')](saveUpdates(_0x1055cf[_0x486f('0x4e')],null))[_0x486f('0x2b')](respondWithResult(_0x34033e,null))[_0x486f('0x48')](handleError(_0x34033e,null));};exports[_0x486f('0x2c')]=function(_0x5cd989,_0x300de9){return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x5cd989['params']['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x300de9,null))[_0x486f('0x2b')](removeEntity(_0x300de9,null))[_0x486f('0x48')](handleError(_0x300de9,null));};exports['describe']=function(_0x195c9c,_0x372d2f){return db[_0x486f('0x30')][_0x486f('0x4f')]()['then'](respondWithResult(_0x372d2f,null))['catch'](handleError(_0x372d2f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4d6ab10..1f38ff8 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(_0x4133f6,_0xbb2204){var _0x108375=function(_0x5d789e){while(--_0x5d789e){_0x4133f6['push'](_0x4133f6['shift']());}};_0x108375(++_0xbb2204);}(_0x7a54,0x106));var _0x47a5=function(_0x2e516e,_0x29a816){_0x2e516e=_0x2e516e-0x0;var _0x588b23=_0x7a54[_0x2e516e];return _0x588b23;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x52ffc9,_0x3e3b69){var _0x30ea46=function(_0x4875da){while(--_0x4875da){_0x52ffc9['push'](_0x52ffc9['shift']());}};_0x30ea46(++_0x3e3b69);}(_0x7a54,0x106));var _0x47a5=function(_0x2eb3e5,_0x4e7609){_0x2eb3e5=_0x2eb3e5-0x0;var _0x43122d=_0x7a54[_0x2eb3e5];return _0x43122d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 40d7952..342903a 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 _0x2863=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x309113,_0xe6e4af){var _0x48ab78=function(_0x460938){while(--_0x460938){_0x309113['push'](_0x309113['shift']());}};_0x48ab78(++_0xe6e4af);}(_0x2863,0xc5));var _0x3286=function(_0xb7ba99,_0x26ea20){_0xb7ba99=_0xb7ba99-0x0;var _0x4a0dfa=_0x2863[_0xb7ba99];return _0x4a0dfa;};'use strict';var _=require(_0x3286('0x0'));var util=require(_0x3286('0x1'));var moment=require(_0x3286('0x2'));var BPromise=require(_0x3286('0x3'));var rs=require(_0x3286('0x4'));var fs=require('fs');var Redis=require(_0x3286('0x5'));var db=require(_0x3286('0x6'))['db'];var utils=require(_0x3286('0x7'));var logger=require(_0x3286('0x8'))(_0x3286('0x9'));var config=require(_0x3286('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3286('0xb')][_0x3286('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2a13,_0x31fbfe,_0x449f16){return new BPromise(function(_0x32b4a6,_0x25246e){return client[_0x3286('0xd')](_0x1e2a13,_0x449f16)[_0x3286('0xe')](function(_0x514b0c){logger[_0x3286('0xf')](_0x3286('0x10'),_0x31fbfe,_0x3286('0x11'));logger[_0x3286('0x12')](_0x3286('0x13'),_0x31fbfe,_0x3286('0x11'),JSON[_0x3286('0x14')](_0x514b0c));if(_0x514b0c[_0x3286('0x15')]){if(_0x514b0c[_0x3286('0x15')][_0x3286('0x16')]===0x1f4){logger['error'](_0x3286('0x10'),_0x31fbfe,_0x514b0c[_0x3286('0x15')][_0x3286('0x17')]);return _0x25246e(_0x514b0c[_0x3286('0x15')][_0x3286('0x17')]);}logger[_0x3286('0x15')](_0x3286('0x10'),_0x31fbfe,_0x514b0c['error']['message']);return _0x32b4a6(_0x514b0c['error'][_0x3286('0x17')]);}else{logger[_0x3286('0xf')]('Cdr,\x20%s,\x20%s',_0x31fbfe,_0x3286('0x11'));_0x32b4a6(_0x514b0c[_0x3286('0x18')][_0x3286('0x17')]);}})['catch'](function(_0x2f8557){logger[_0x3286('0x15')](_0x3286('0x10'),_0x31fbfe,_0x2f8557);_0x25246e(_0x2f8557);});});} \ No newline at end of file +var _0x934f=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x934f,0x17f));var _0xf934=function(_0x294f4d,_0x35032d){_0x294f4d=_0x294f4d-0x0;var _0x3519ce=_0x934f[_0x294f4d];return _0x3519ce;};'use strict';var _=require(_0xf934('0x0'));var util=require(_0xf934('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf934('0x2'));var fs=require('fs');var Redis=require(_0xf934('0x3'));var db=require(_0xf934('0x4'))['db'];var utils=require(_0xf934('0x5'));var logger=require(_0xf934('0x6'))(_0xf934('0x7'));var config=require(_0xf934('0x8'));var jayson=require(_0xf934('0x9'));var client=jayson[_0xf934('0xa')][_0xf934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ff30a,_0x3517ea,_0x2ef897){return new BPromise(function(_0x62ac2c,_0x562ceb){return client[_0xf934('0xc')](_0x1ff30a,_0x2ef897)['then'](function(_0x28e034){logger[_0xf934('0xd')](_0xf934('0xe'),_0x3517ea,_0xf934('0xf'));logger[_0xf934('0x10')](_0xf934('0x11'),_0x3517ea,_0xf934('0xf'),JSON[_0xf934('0x12')](_0x28e034));if(_0x28e034[_0xf934('0x13')]){if(_0x28e034[_0xf934('0x13')]['code']===0x1f4){logger[_0xf934('0x13')]('Cdr,\x20%s,\x20%s',_0x3517ea,_0x28e034[_0xf934('0x13')]['message']);return _0x562ceb(_0x28e034[_0xf934('0x13')]['message']);}logger[_0xf934('0x13')](_0xf934('0xe'),_0x3517ea,_0x28e034[_0xf934('0x13')][_0xf934('0x14')]);return _0x62ac2c(_0x28e034[_0xf934('0x13')][_0xf934('0x14')]);}else{logger[_0xf934('0xd')](_0xf934('0xe'),_0x3517ea,_0xf934('0xf'));_0x62ac2c(_0x28e034['result']['message']);}})[_0xf934('0x15')](function(_0x212ccb){logger[_0xf934('0x13')](_0xf934('0xe'),_0x3517ea,_0x212ccb);_0x562ceb(_0x212ccb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f539b15..3871972 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(_0x3bcb7c,_0x5af870){var _0x584411=function(_0x4b9a67){while(--_0x4b9a67){_0x3bcb7c['push'](_0x3bcb7c['shift']());}};_0x584411(++_0x5af870);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 a34c226..88bef2f 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 _0xfc18=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x2e343b,_0x865533){var _0x2f5490=function(_0x45fa91){while(--_0x45fa91){_0x2e343b['push'](_0x2e343b['shift']());}};_0x2f5490(++_0x865533);}(_0xfc18,0x90));var _0x8fc1=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xfc18[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x8fc1('0x0'));module[_0x8fc1('0x1')]={'priority':{'type':Sequelize[_0x8fc1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8fc1('0x3')],'allowNull':![],'defaultValue':_0x8fc1('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8fc1('0x5')}}; \ No newline at end of file +var _0xdc42=['*,*,*,*','sequelize','INTEGER','TEXT','STRING'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xdc42,0x1b4));var _0x2dc4=function(_0x40e74c,_0x1883a2){_0x40e74c=_0x40e74c-0x0;var _0x3a8c6b=_0xdc42[_0x40e74c];return _0x3a8c6b;};'use strict';var Sequelize=require(_0x2dc4('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2dc4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2dc4('0x2')]()},'description':{'type':Sequelize[_0x2dc4('0x3')]},'interval':{'type':Sequelize[_0x2dc4('0x3')],'defaultValue':_0x2dc4('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c031d05..cdf778e 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 _0x60e1=['stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','then','destroy','error'];(function(_0x5a9555,_0x5eb0c1){var _0x294298=function(_0x1b9c02){while(--_0x1b9c02){_0x5a9555['push'](_0x5a9555['shift']());}};_0x294298(++_0x5eb0c1);}(_0x60e1,0x14c));var _0x160e=function(_0x59096d,_0x5f4f59){_0x59096d=_0x59096d-0x0;var _0x40e56f=_0x60e1[_0x59096d];return _0x40e56f;};'use strict';var emlformat=require(_0x160e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x160e('0x1'));var jsonpatch=require(_0x160e('0x2'));var rp=require(_0x160e('0x3'));var moment=require(_0x160e('0x4'));var BPromise=require(_0x160e('0x5'));var Mustache=require(_0x160e('0x6'));var util=require(_0x160e('0x7'));var path=require(_0x160e('0x8'));var sox=require(_0x160e('0x9'));var csv=require(_0x160e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x160e('0xb'));var _=require('lodash');var squel=require(_0x160e('0xc'));var crypto=require(_0x160e('0xd'));var jsforce=require(_0x160e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x160e('0xa'));var querystring=require(_0x160e('0xf'));var Papa=require(_0x160e('0x10'));var Redis=require(_0x160e('0x11'));var authService=require(_0x160e('0x12'));var qs=require(_0x160e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x160e('0x14'));var logger=require(_0x160e('0x15'))(_0x160e('0x16'));var utils=require(_0x160e('0x17'));var config=require(_0x160e('0x18'));var licenseUtil=require(_0x160e('0x19'));var db=require(_0x160e('0x1a'))['db'];function respondWithStatusCode(_0x59dafa,_0x3b9da5){_0x3b9da5=_0x3b9da5||0xcc;return function(_0x3ea1f3){if(_0x3ea1f3){return _0x59dafa[_0x160e('0x1b')](_0x3b9da5);}return _0x59dafa[_0x160e('0x1c')](_0x3b9da5)['end']();};}function respondWithResult(_0x36948a,_0x1d754d){_0x1d754d=_0x1d754d||0xc8;return function(_0x3e0d93){if(_0x3e0d93){return _0x36948a[_0x160e('0x1c')](_0x1d754d)['json'](_0x3e0d93);}};}function respondWithFilteredResult(_0x4797b9,_0x5d618d){return function(_0x56a685){if(_0x56a685){var _0x302052=typeof _0x5d618d[_0x160e('0x1d')]===_0x160e('0x1e')&&typeof _0x5d618d[_0x160e('0x1f')]===_0x160e('0x1e');var _0x1ed6aa=_0x56a685['count'];var _0x37d722=_0x302052?0x0:_0x5d618d[_0x160e('0x1d')];var _0x5c7bde=_0x302052?_0x56a685[_0x160e('0x20')]:_0x5d618d[_0x160e('0x1d')]+_0x5d618d[_0x160e('0x1f')];var _0x34dbe9;if(_0x5c7bde>=_0x1ed6aa){_0x5c7bde=_0x1ed6aa;_0x34dbe9=0xc8;}else{_0x34dbe9=0xce;}_0x4797b9[_0x160e('0x1c')](_0x34dbe9);return _0x4797b9[_0x160e('0x21')]('Content-Range',_0x37d722+'-'+_0x5c7bde+'/'+_0x1ed6aa)[_0x160e('0x22')](_0x56a685);}return null;};}function patchUpdates(_0x4ca9d4){return function(_0x25ab88){try{jsonpatch[_0x160e('0x23')](_0x25ab88,_0x4ca9d4,!![]);}catch(_0x5c11fd){return BPromise[_0x160e('0x24')](_0x5c11fd);}return _0x25ab88['save']();};}function saveUpdates(_0x3e00ca,_0x4d1047){return function(_0x453266){if(_0x453266){return _0x453266['update'](_0x3e00ca)[_0x160e('0x25')](function(_0x13395b){return _0x13395b;});}return null;};}function removeEntity(_0x4ffc29,_0x280763){return function(_0x48aed9){if(_0x48aed9){return _0x48aed9[_0x160e('0x26')]()['then'](function(){_0x4ffc29[_0x160e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8d17,_0x7dc886){return function(_0x38fcce){if(!_0x38fcce){_0x5e8d17[_0x160e('0x1b')](0x194);}return _0x38fcce;};}function handleError(_0x1a563c,_0x3e8856){_0x3e8856=_0x3e8856||0x1f4;return function(_0x34979d){logger[_0x160e('0x27')](_0x34979d[_0x160e('0x28')]);if(_0x34979d[_0x160e('0x29')]){delete _0x34979d[_0x160e('0x29')];}_0x1a563c[_0x160e('0x1c')](_0x3e8856)[_0x160e('0x2a')](_0x34979d);};}exports['show']=function(_0x57d37e,_0x4ac531){var _0x1a49a0={'raw':!![],'where':{'id':_0x57d37e[_0x160e('0x2b')]['id']}},_0x4468ec={};_0x4468ec[_0x160e('0x2c')]=_[_0x160e('0x2d')](db[_0x160e('0x2e')][_0x160e('0x2f')]);_0x4468ec[_0x160e('0x30')]=_[_0x160e('0x2d')](_0x57d37e[_0x160e('0x30')]);_0x4468ec[_0x160e('0x31')]=_[_0x160e('0x32')](_0x4468ec[_0x160e('0x2c')],_0x4468ec['query']);_0x1a49a0[_0x160e('0x33')]=_[_0x160e('0x32')](_0x4468ec[_0x160e('0x2c')],qs['fields'](_0x57d37e[_0x160e('0x30')][_0x160e('0x34')]));_0x1a49a0[_0x160e('0x33')]=_0x1a49a0[_0x160e('0x33')][_0x160e('0x35')]?_0x1a49a0[_0x160e('0x33')]:_0x4468ec['model'];if(_0x57d37e[_0x160e('0x30')][_0x160e('0x36')]){_0x1a49a0[_0x160e('0x37')]=[{'all':!![]}];}_0x1a49a0=_[_0x160e('0x38')]({},_0x1a49a0,_0x57d37e[_0x160e('0x39')]);return db['ChatApplication'][_0x160e('0x3a')](_0x1a49a0)[_0x160e('0x25')](handleEntityNotFound(_0x4ac531,null))[_0x160e('0x25')](respondWithResult(_0x4ac531,null))[_0x160e('0x3b')](handleError(_0x4ac531,null));};exports[_0x160e('0x3c')]=function(_0x196e98,_0x30854e){if(_0x196e98[_0x160e('0x3d')]['id']){delete _0x196e98[_0x160e('0x3d')]['id'];}return db[_0x160e('0x2e')][_0x160e('0x3a')]({'where':{'id':_0x196e98[_0x160e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x30854e,null))['then'](saveUpdates(_0x196e98[_0x160e('0x3d')],null))[_0x160e('0x25')](respondWithResult(_0x30854e,null))[_0x160e('0x3b')](handleError(_0x30854e,null));};exports['destroy']=function(_0x3b9728,_0xa097b5){return db['ChatApplication'][_0x160e('0x3a')]({'where':{'id':_0x3b9728[_0x160e('0x2b')]['id']}})[_0x160e('0x25')](handleEntityNotFound(_0xa097b5,null))[_0x160e('0x25')](removeEntity(_0xa097b5,null))[_0x160e('0x3b')](handleError(_0xa097b5,null));}; \ No newline at end of file +var _0x5127=['sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','name','send','model','keys','ChatApplication','rawAttributes','intersection','fields','query','attributes','length','merge','options','find','catch','update','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path'];(function(_0x50aea5,_0x5dd077){var _0x4657f1=function(_0x57fb40){while(--_0x57fb40){_0x50aea5['push'](_0x50aea5['shift']());}};_0x4657f1(++_0x5dd077);}(_0x5127,0x18f));var _0x7512=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x5127[_0x170772];return _0x3ef69c;};'use strict';var emlformat=require(_0x7512('0x0'));var rimraf=require(_0x7512('0x1'));var zipdir=require(_0x7512('0x2'));var jsonpatch=require(_0x7512('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7512('0x4'));var Mustache=require('mustache');var util=require(_0x7512('0x5'));var path=require(_0x7512('0x6'));var sox=require(_0x7512('0x7'));var csv=require(_0x7512('0x8'));var ejs=require(_0x7512('0x9'));var fs=require('fs');var fs_extra=require(_0x7512('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7512('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7512('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7512('0xd'));var Papa=require(_0x7512('0xe'));var Redis=require(_0x7512('0xf'));var authService=require(_0x7512('0x10'));var qs=require(_0x7512('0x11'));var as=require(_0x7512('0x12'));var hardwareService=require(_0x7512('0x13'));var logger=require(_0x7512('0x14'))(_0x7512('0x15'));var utils=require(_0x7512('0x16'));var config=require(_0x7512('0x17'));var licenseUtil=require(_0x7512('0x18'));var db=require(_0x7512('0x19'))['db'];function respondWithStatusCode(_0x599ce4,_0x472323){_0x472323=_0x472323||0xcc;return function(_0x474746){if(_0x474746){return _0x599ce4[_0x7512('0x1a')](_0x472323);}return _0x599ce4['status'](_0x472323)[_0x7512('0x1b')]();};}function respondWithResult(_0x57813c,_0x3069a1){_0x3069a1=_0x3069a1||0xc8;return function(_0x3ef1fc){if(_0x3ef1fc){return _0x57813c[_0x7512('0x1c')](_0x3069a1)[_0x7512('0x1d')](_0x3ef1fc);}};}function respondWithFilteredResult(_0x4968a5,_0x519aad){return function(_0x5a4101){if(_0x5a4101){var _0x219f4c=typeof _0x519aad[_0x7512('0x1e')]===_0x7512('0x1f')&&typeof _0x519aad[_0x7512('0x20')]==='undefined';var _0x82484a=_0x5a4101['count'];var _0x10858d=_0x219f4c?0x0:_0x519aad[_0x7512('0x1e')];var _0x1d357b=_0x219f4c?_0x5a4101[_0x7512('0x21')]:_0x519aad[_0x7512('0x1e')]+_0x519aad[_0x7512('0x20')];var _0x67c45e;if(_0x1d357b>=_0x82484a){_0x1d357b=_0x82484a;_0x67c45e=0xc8;}else{_0x67c45e=0xce;}_0x4968a5[_0x7512('0x1c')](_0x67c45e);return _0x4968a5[_0x7512('0x22')](_0x7512('0x23'),_0x10858d+'-'+_0x1d357b+'/'+_0x82484a)['json'](_0x5a4101);}return null;};}function patchUpdates(_0x3c8b39){return function(_0x41bb33){try{jsonpatch['apply'](_0x41bb33,_0x3c8b39,!![]);}catch(_0x4862d6){return BPromise[_0x7512('0x24')](_0x4862d6);}return _0x41bb33[_0x7512('0x25')]();};}function saveUpdates(_0x16cabb,_0x2279a0){return function(_0x24baaf){if(_0x24baaf){return _0x24baaf['update'](_0x16cabb)[_0x7512('0x26')](function(_0x28aa80){return _0x28aa80;});}return null;};}function removeEntity(_0x101f57,_0x21cb99){return function(_0x14f0e2){if(_0x14f0e2){return _0x14f0e2['destroy']()[_0x7512('0x26')](function(){_0x101f57[_0x7512('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c88dd,_0x5e0cfd){return function(_0x5df068){if(!_0x5df068){_0x2c88dd[_0x7512('0x1a')](0x194);}return _0x5df068;};}function handleError(_0x3ccd5f,_0x1a5985){_0x1a5985=_0x1a5985||0x1f4;return function(_0x5784ba){logger['error'](_0x5784ba['stack']);if(_0x5784ba[_0x7512('0x27')]){delete _0x5784ba['name'];}_0x3ccd5f['status'](_0x1a5985)[_0x7512('0x28')](_0x5784ba);};}exports['show']=function(_0x1c0442,_0x133d18){var _0x2f8df2={'raw':!![],'where':{'id':_0x1c0442['params']['id']}},_0x4c676c={};_0x4c676c[_0x7512('0x29')]=_[_0x7512('0x2a')](db[_0x7512('0x2b')][_0x7512('0x2c')]);_0x4c676c['query']=_[_0x7512('0x2a')](_0x1c0442['query']);_0x4c676c['filters']=_[_0x7512('0x2d')](_0x4c676c[_0x7512('0x29')],_0x4c676c['query']);_0x2f8df2['attributes']=_[_0x7512('0x2d')](_0x4c676c['model'],qs[_0x7512('0x2e')](_0x1c0442[_0x7512('0x2f')][_0x7512('0x2e')]));_0x2f8df2[_0x7512('0x30')]=_0x2f8df2['attributes'][_0x7512('0x31')]?_0x2f8df2['attributes']:_0x4c676c[_0x7512('0x29')];if(_0x1c0442[_0x7512('0x2f')]['includeAll']){_0x2f8df2['include']=[{'all':!![]}];}_0x2f8df2=_[_0x7512('0x32')]({},_0x2f8df2,_0x1c0442[_0x7512('0x33')]);return db['ChatApplication'][_0x7512('0x34')](_0x2f8df2)[_0x7512('0x26')](handleEntityNotFound(_0x133d18,null))[_0x7512('0x26')](respondWithResult(_0x133d18,null))[_0x7512('0x35')](handleError(_0x133d18,null));};exports[_0x7512('0x36')]=function(_0x20e8fb,_0x5b566d){if(_0x20e8fb[_0x7512('0x37')]['id']){delete _0x20e8fb[_0x7512('0x37')]['id'];}return db[_0x7512('0x2b')]['find']({'where':{'id':_0x20e8fb[_0x7512('0x38')]['id']}})[_0x7512('0x26')](handleEntityNotFound(_0x5b566d,null))['then'](saveUpdates(_0x20e8fb[_0x7512('0x37')],null))[_0x7512('0x26')](respondWithResult(_0x5b566d,null))['catch'](handleError(_0x5b566d,null));};exports[_0x7512('0x39')]=function(_0x5cc6a1,_0x325da0){return db[_0x7512('0x2b')]['find']({'where':{'id':_0x5cc6a1[_0x7512('0x38')]['id']}})['then'](handleEntityNotFound(_0x325da0,null))[_0x7512('0x26')](removeEntity(_0x325da0,null))['catch'](handleError(_0x325da0,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4aed133..7a81c77 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 _0xb826=['rimraf','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0xb826,0x1b8));var _0x6b82=function(_0x1fb759,_0x2e03db){_0x1fb759=_0x1fb759-0x0;var _0x2600e7=_0xb826[_0x1fb759];return _0x2600e7;};'use strict';var _=require(_0x6b82('0x0'));var util=require(_0x6b82('0x1'));var logger=require(_0x6b82('0x2'))(_0x6b82('0x3'));var moment=require(_0x6b82('0x4'));var BPromise=require(_0x6b82('0x5'));var rp=require(_0x6b82('0x6'));var fs=require('fs');var path=require(_0x6b82('0x7'));var rimraf=require(_0x6b82('0x8'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x6b82('0x9')]=function(_0x55921b,_0x2edc5d){return _0x55921b[_0x6b82('0xa')](_0x6b82('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b82('0xc'),'collate':_0x6b82('0xd')});}; \ No newline at end of file +var _0x3f47=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x20f8bd,_0xcee953){var _0x3d6de3=function(_0x505ba9){while(--_0x505ba9){_0x20f8bd['push'](_0x20f8bd['shift']());}};_0x3d6de3(++_0xcee953);}(_0x3f47,0x10e));var _0x73f4=function(_0x1056c7,_0x279ac5){_0x1056c7=_0x1056c7-0x0;var _0x4ef73e=_0x3f47[_0x1056c7];return _0x4ef73e;};'use strict';var _=require(_0x73f4('0x0'));var util=require(_0x73f4('0x1'));var logger=require('../../config/logger')(_0x73f4('0x2'));var moment=require('moment');var BPromise=require(_0x73f4('0x3'));var rp=require(_0x73f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73f4('0x5'));var config=require(_0x73f4('0x6'));var attributes=require(_0x73f4('0x7'));module[_0x73f4('0x8')]=function(_0x5a852e,_0x101093){return _0x5a852e[_0x73f4('0x9')](_0x73f4('0xa'),attributes,{'tableName':_0x73f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x73f4('0xc'),'collate':_0x73f4('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b7904d4..4f2ca39 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 _0x70cb=['result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','client','http','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x32f099,_0x8e8c68){var _0x4d010a=function(_0x4c4d13){while(--_0x4c4d13){_0x32f099['push'](_0x32f099['shift']());}};_0x4d010a(++_0x8e8c68);}(_0x70cb,0x16b));var _0xb70c=function(_0x2d0669,_0xfd69a1){_0x2d0669=_0x2d0669-0x0;var _0x2b7d1a=_0x70cb[_0x2d0669];return _0x2b7d1a;};'use strict';var _=require(_0xb70c('0x0'));var util=require(_0xb70c('0x1'));var moment=require(_0xb70c('0x2'));var BPromise=require(_0xb70c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb70c('0x4'));var logger=require('../../config/logger')(_0xb70c('0x5'));var config=require('../../config/environment');var jayson=require(_0xb70c('0x6'));var client=jayson[_0xb70c('0x7')][_0xb70c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x229957,_0x327a3e,_0x1879bd){return new BPromise(function(_0x3137b6,_0x2b2bf9){return client['request'](_0x229957,_0x1879bd)['then'](function(_0x2a6eac){logger['info'](_0xb70c('0x9'),_0x327a3e,_0xb70c('0xa'));logger[_0xb70c('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x327a3e,_0xb70c('0xa'),JSON[_0xb70c('0xc')](_0x2a6eac));if(_0x2a6eac[_0xb70c('0xd')]){if(_0x2a6eac['error'][_0xb70c('0xe')]===0x1f4){logger[_0xb70c('0xd')](_0xb70c('0x9'),_0x327a3e,_0x2a6eac[_0xb70c('0xd')][_0xb70c('0xf')]);return _0x2b2bf9(_0x2a6eac['error'][_0xb70c('0xf')]);}logger[_0xb70c('0xd')](_0xb70c('0x9'),_0x327a3e,_0x2a6eac[_0xb70c('0xd')]['message']);return _0x3137b6(_0x2a6eac['error']['message']);}else{logger[_0xb70c('0x10')](_0xb70c('0x9'),_0x327a3e,_0xb70c('0xa'));_0x3137b6(_0x2a6eac[_0xb70c('0x11')][_0xb70c('0xf')]);}})[_0xb70c('0x12')](function(_0x1daabb){logger[_0xb70c('0xd')](_0xb70c('0x9'),_0x327a3e,_0x1daabb);_0x2b2bf9(_0x1daabb);});});} \ No newline at end of file +var _0xcd28=['stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2313e0,_0x31716d){var _0x58bd80=function(_0x3317e7){while(--_0x3317e7){_0x2313e0['push'](_0x2313e0['shift']());}};_0x58bd80(++_0x31716d);}(_0xcd28,0x133));var _0x8cd2=function(_0xee1383,_0xac1074){_0xee1383=_0xee1383-0x0;var _0x49f3b3=_0xcd28[_0xee1383];return _0x49f3b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8cd2('0x0'));var BPromise=require(_0x8cd2('0x1'));var rs=require(_0x8cd2('0x2'));var fs=require('fs');var Redis=require(_0x8cd2('0x3'));var db=require(_0x8cd2('0x4'))['db'];var utils=require(_0x8cd2('0x5'));var logger=require(_0x8cd2('0x6'))(_0x8cd2('0x7'));var config=require('../../config/environment');var jayson=require(_0x8cd2('0x8'));var client=jayson[_0x8cd2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26c45c,_0x114db3,_0x2aea94){return new BPromise(function(_0x23baba,_0x45c9be){return client[_0x8cd2('0xa')](_0x26c45c,_0x2aea94)[_0x8cd2('0xb')](function(_0x23043b){logger['info']('ChatApplication,\x20%s,\x20%s',_0x114db3,'request\x20sent');logger[_0x8cd2('0xc')](_0x8cd2('0xd'),_0x114db3,_0x8cd2('0xe'),JSON[_0x8cd2('0xf')](_0x23043b));if(_0x23043b[_0x8cd2('0x10')]){if(_0x23043b['error'][_0x8cd2('0x11')]===0x1f4){logger['error'](_0x8cd2('0x12'),_0x114db3,_0x23043b[_0x8cd2('0x10')][_0x8cd2('0x13')]);return _0x45c9be(_0x23043b['error'][_0x8cd2('0x13')]);}logger[_0x8cd2('0x10')](_0x8cd2('0x12'),_0x114db3,_0x23043b['error']['message']);return _0x23baba(_0x23043b['error'][_0x8cd2('0x13')]);}else{logger[_0x8cd2('0x14')](_0x8cd2('0x12'),_0x114db3,_0x8cd2('0xe'));_0x23baba(_0x23043b[_0x8cd2('0x15')]['message']);}})[_0x8cd2('0x16')](function(_0x19bc8e){logger[_0x8cd2('0x10')](_0x8cd2('0x12'),_0x114db3,_0x19bc8e);_0x45c9be(_0x19bc8e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 4c63380..246762b 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 _0xd268=['show','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x3dbf0a,_0x54530a){var _0x4ec977=function(_0x3b2251){while(--_0x3b2251){_0x3dbf0a['push'](_0x3dbf0a['shift']());}};_0x4ec977(++_0x54530a);}(_0xd268,0x1e1));var _0x8d26=function(_0x16847a,_0xb61ec){_0x16847a=_0x16847a-0x0;var _0x18dd33=_0xd268[_0x16847a];return _0x18dd33;};'use strict';var multer=require(_0x8d26('0x0'));var util=require(_0x8d26('0x1'));var path=require(_0x8d26('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d26('0x3'));var router=express[_0x8d26('0x4')]();var fs_extra=require(_0x8d26('0x5'));var auth=require(_0x8d26('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8d26('0x7'));var controller=require(_0x8d26('0x8'));router[_0x8d26('0x9')](_0x8d26('0xa'),auth[_0x8d26('0xb')](),controller[_0x8d26('0xc')]);router[_0x8d26('0xd')](_0x8d26('0xa'),auth['isAuthenticated'](),controller[_0x8d26('0xe')]);router[_0x8d26('0xf')]('/:id',auth[_0x8d26('0xb')](),controller[_0x8d26('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6583=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0x6583,0x1b9));var _0x3658=function(_0x34f3c7,_0x393441){_0x34f3c7=_0x34f3c7-0x0;var _0x258767=_0x6583[_0x34f3c7];return _0x258767;};'use strict';var multer=require(_0x3658('0x0'));var util=require(_0x3658('0x1'));var path=require(_0x3658('0x2'));var timeout=require('connect-timeout');var express=require(_0x3658('0x3'));var router=express['Router']();var fs_extra=require(_0x3658('0x4'));var auth=require(_0x3658('0x5'));var interaction=require(_0x3658('0x6'));var config=require(_0x3658('0x7'));var controller=require(_0x3658('0x8'));router[_0x3658('0x9')](_0x3658('0xa'),auth[_0x3658('0xb')](),controller[_0x3658('0xc')]);router[_0x3658('0xd')](_0x3658('0xa'),auth[_0x3658('0xb')](),controller[_0x3658('0xe')]);router[_0x3658('0xf')]('/:id',auth[_0x3658('0xb')](),controller[_0x3658('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 1d4832d..3ccfbfd 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 _0x5d59=['exports','STRING','BOOLEAN'];(function(_0x3d125f,_0x579fa8){var _0x4123d0=function(_0x3665c6){while(--_0x3665c6){_0x3d125f['push'](_0x3d125f['shift']());}};_0x4123d0(++_0x579fa8);}(_0x5d59,0x15f));var _0x95d5=function(_0x3c0c96,_0x449674){_0x3c0c96=_0x3c0c96-0x0;var _0x1780ec=_0x5d59[_0x3c0c96];return _0x1780ec;};'use strict';var Sequelize=require('sequelize');module[_0x95d5('0x0')]={'name':{'type':Sequelize[_0x95d5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x95d5('0x1')]},'write':{'type':Sequelize[_0x95d5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xef18=['STRING','BOOLEAN','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xef18,0xfb));var _0x8ef1=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xef18[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require('sequelize');module[_0x8ef1('0x0')]={'name':{'type':Sequelize[_0x8ef1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8ef1('0x1')]},'write':{'type':Sequelize[_0x8ef1('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 029fc2b..68e8cfb 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 _0xd654=['fields','length','find','create','body','catch','params','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','pick','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd654,0x154));var _0x4d65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd654[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4d65('0x0'));var rimraf=require(_0x4d65('0x1'));var zipdir=require(_0x4d65('0x2'));var jsonpatch=require(_0x4d65('0x3'));var rp=require(_0x4d65('0x4'));var moment=require(_0x4d65('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4d65('0x6'));var util=require(_0x4d65('0x7'));var path=require(_0x4d65('0x8'));var sox=require(_0x4d65('0x9'));var csv=require(_0x4d65('0xa'));var ejs=require(_0x4d65('0xb'));var fs=require('fs');var fs_extra=require(_0x4d65('0xc'));var _=require(_0x4d65('0xd'));var squel=require(_0x4d65('0xe'));var crypto=require(_0x4d65('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4d65('0x10'));var toCsv=require(_0x4d65('0xa'));var querystring=require(_0x4d65('0x11'));var Papa=require(_0x4d65('0x12'));var Redis=require('ioredis');var authService=require(_0x4d65('0x13'));var qs=require(_0x4d65('0x14'));var as=require(_0x4d65('0x15'));var hardwareService=require(_0x4d65('0x16'));var logger=require(_0x4d65('0x17'))(_0x4d65('0x18'));var utils=require(_0x4d65('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4d65('0x1a'));var db=require(_0x4d65('0x1b'))['db'];config[_0x4d65('0x1c')]=_[_0x4d65('0x1d')](config[_0x4d65('0x1c')],{'host':_0x4d65('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d65('0x1c')]));require(_0x4d65('0x1f'))[_0x4d65('0x20')](socket);function respondWithStatusCode(_0x2be655,_0x3e1234){_0x3e1234=_0x3e1234||0xcc;return function(_0x4d05bd){if(_0x4d05bd){return _0x2be655[_0x4d65('0x21')](_0x3e1234);}return _0x2be655[_0x4d65('0x22')](_0x3e1234)[_0x4d65('0x23')]();};}function respondWithResult(_0x461e03,_0x496ffa){_0x496ffa=_0x496ffa||0xc8;return function(_0x3e4f53){if(_0x3e4f53){return _0x461e03['status'](_0x496ffa)[_0x4d65('0x24')](_0x3e4f53);}};}function respondWithFilteredResult(_0x2c5f1a,_0x2f624e){return function(_0x5d6274){if(_0x5d6274){var _0x3bd0cc=typeof _0x2f624e[_0x4d65('0x25')]==='undefined'&&typeof _0x2f624e[_0x4d65('0x26')]==='undefined';var _0x1f99aa=_0x5d6274[_0x4d65('0x27')];var _0x15fbfd=_0x3bd0cc?0x0:_0x2f624e['offset'];var _0x14db02=_0x3bd0cc?_0x5d6274[_0x4d65('0x27')]:_0x2f624e[_0x4d65('0x25')]+_0x2f624e[_0x4d65('0x26')];var _0x467b45;if(_0x14db02>=_0x1f99aa){_0x14db02=_0x1f99aa;_0x467b45=0xc8;}else{_0x467b45=0xce;}_0x2c5f1a[_0x4d65('0x22')](_0x467b45);return _0x2c5f1a[_0x4d65('0x28')](_0x4d65('0x29'),_0x15fbfd+'-'+_0x14db02+'/'+_0x1f99aa)['json'](_0x5d6274);}return null;};}function patchUpdates(_0x3c7bf0){return function(_0x5195b2){try{jsonpatch['apply'](_0x5195b2,_0x3c7bf0,!![]);}catch(_0x100d6b){return BPromise[_0x4d65('0x2a')](_0x100d6b);}return _0x5195b2[_0x4d65('0x2b')]();};}function saveUpdates(_0x15c515,_0x5dc45f){return function(_0x231dd5){if(_0x231dd5){return _0x231dd5[_0x4d65('0x2c')](_0x15c515)[_0x4d65('0x2d')](function(_0x352bd4){return _0x352bd4;});}return null;};}function removeEntity(_0x3df43e,_0xa8f442){return function(_0x14ece5){if(_0x14ece5){return _0x14ece5[_0x4d65('0x2e')]()[_0x4d65('0x2d')](function(){_0x3df43e['status'](0xcc)[_0x4d65('0x23')]();});}};}function handleEntityNotFound(_0x30e6ae,_0x561ddf){return function(_0x2d2910){if(!_0x2d2910){_0x30e6ae[_0x4d65('0x21')](0x194);}return _0x2d2910;};}function handleError(_0x58ed7d,_0x4a95a9){_0x4a95a9=_0x4a95a9||0x1f4;return function(_0x5b15c7){logger[_0x4d65('0x2f')](_0x5b15c7[_0x4d65('0x30')]);if(_0x5b15c7[_0x4d65('0x31')]){delete _0x5b15c7['name'];}_0x58ed7d[_0x4d65('0x22')](_0x4a95a9)[_0x4d65('0x32')](_0x5b15c7);};}exports[_0x4d65('0x33')]=function(_0x1274f1,_0x1094f3){var _0x45d28e={},_0x41e19c={},_0x1db98c={'count':0x0,'rows':[]};var _0x16a749=_[_0x4d65('0x34')](db[_0x4d65('0x35')][_0x4d65('0x36')],function(_0x52eaa1){return{'name':_0x52eaa1[_0x4d65('0x37')],'type':_0x52eaa1[_0x4d65('0x38')]['key']};});_0x41e19c[_0x4d65('0x39')]=_[_0x4d65('0x34')](_0x16a749,_0x4d65('0x31'));_0x41e19c[_0x4d65('0x3a')]=_[_0x4d65('0x3b')](_0x1274f1['query']);_0x41e19c[_0x4d65('0x3c')]=_['intersection'](_0x41e19c[_0x4d65('0x39')],_0x41e19c[_0x4d65('0x3a')]);_0x45d28e[_0x4d65('0x3d')]=_[_0x4d65('0x3e')](_0x41e19c[_0x4d65('0x39')],qs['fields'](_0x1274f1[_0x4d65('0x3a')]['fields']));_0x45d28e['attributes']=_0x45d28e[_0x4d65('0x3d')]['length']?_0x45d28e[_0x4d65('0x3d')]:_0x41e19c[_0x4d65('0x39')];if(!_0x1274f1[_0x4d65('0x3a')][_0x4d65('0x3f')](_0x4d65('0x40'))){_0x45d28e['limit']=qs[_0x4d65('0x26')](_0x1274f1[_0x4d65('0x3a')]['limit']);_0x45d28e[_0x4d65('0x25')]=qs[_0x4d65('0x25')](_0x1274f1[_0x4d65('0x3a')]['offset']);}_0x45d28e['order']=qs['sort'](_0x1274f1['query'][_0x4d65('0x41')]);_0x45d28e[_0x4d65('0x42')]=qs[_0x4d65('0x3c')](_['pick'](_0x1274f1['query'],_0x41e19c[_0x4d65('0x3c')]),_0x16a749);if(_0x1274f1[_0x4d65('0x3a')]['filter']){_0x45d28e[_0x4d65('0x42')]=_[_0x4d65('0x43')](_0x45d28e[_0x4d65('0x42')],{'$or':_[_0x4d65('0x34')](_0x16a749,function(_0x5dbe0b){if(_0x5dbe0b['type']!==_0x4d65('0x44')){var _0x590642={};_0x590642[_0x5dbe0b[_0x4d65('0x31')]]={'$like':'%'+_0x1274f1[_0x4d65('0x3a')][_0x4d65('0x45')]+'%'};return _0x590642;}})});}_0x45d28e=_['merge']({},_0x45d28e,_0x1274f1[_0x4d65('0x46')]);var _0x363dd6={'where':_0x45d28e[_0x4d65('0x42')]};return db[_0x4d65('0x35')][_0x4d65('0x27')](_0x363dd6)['then'](function(_0x9c49e1){_0x1db98c[_0x4d65('0x27')]=_0x9c49e1;if(_0x1274f1['query'][_0x4d65('0x47')]){_0x45d28e[_0x4d65('0x48')]=[{'all':!![]}];}return db['ChatGroup'][_0x4d65('0x49')](_0x45d28e);})[_0x4d65('0x2d')](function(_0x272e6b){_0x1db98c[_0x4d65('0x4a')]=_0x272e6b;return _0x1db98c;})['then'](respondWithFilteredResult(_0x1094f3,_0x45d28e))['catch'](handleError(_0x1094f3,null));};exports[_0x4d65('0x4b')]=function(_0x5940e8,_0x1b2cb8){var _0x2055ee={'raw':!![],'where':{'id':_0x5940e8['params']['id']}},_0x2e22fb={};_0x2e22fb[_0x4d65('0x39')]=_['keys'](db[_0x4d65('0x35')]['rawAttributes']);_0x2e22fb['query']=_[_0x4d65('0x3b')](_0x5940e8[_0x4d65('0x3a')]);_0x2e22fb[_0x4d65('0x3c')]=_['intersection'](_0x2e22fb[_0x4d65('0x39')],_0x2e22fb[_0x4d65('0x3a')]);_0x2055ee[_0x4d65('0x3d')]=_[_0x4d65('0x3e')](_0x2e22fb[_0x4d65('0x39')],qs[_0x4d65('0x4c')](_0x5940e8[_0x4d65('0x3a')]['fields']));_0x2055ee[_0x4d65('0x3d')]=_0x2055ee[_0x4d65('0x3d')][_0x4d65('0x4d')]?_0x2055ee[_0x4d65('0x3d')]:_0x2e22fb[_0x4d65('0x39')];if(_0x5940e8['query'][_0x4d65('0x47')]){_0x2055ee[_0x4d65('0x48')]=[{'all':!![]}];}_0x2055ee=_[_0x4d65('0x43')]({},_0x2055ee,_0x5940e8[_0x4d65('0x46')]);return db[_0x4d65('0x35')][_0x4d65('0x4e')](_0x2055ee)[_0x4d65('0x2d')](handleEntityNotFound(_0x1b2cb8,null))[_0x4d65('0x2d')](respondWithResult(_0x1b2cb8,null))['catch'](handleError(_0x1b2cb8,null));};exports['create']=function(_0x484f88,_0x58d745){return db['ChatGroup'][_0x4d65('0x4f')](_0x484f88[_0x4d65('0x50')],{})[_0x4d65('0x2d')](respondWithResult(_0x58d745,0xc9))[_0x4d65('0x51')](handleError(_0x58d745,null));};exports[_0x4d65('0x2c')]=function(_0x21e084,_0x318837){if(_0x21e084[_0x4d65('0x50')]['id']){delete _0x21e084[_0x4d65('0x50')]['id'];}return db[_0x4d65('0x35')][_0x4d65('0x4e')]({'where':{'id':_0x21e084[_0x4d65('0x52')]['id']}})[_0x4d65('0x2d')](handleEntityNotFound(_0x318837,null))[_0x4d65('0x2d')](saveUpdates(_0x21e084['body'],null))[_0x4d65('0x2d')](respondWithResult(_0x318837,null))[_0x4d65('0x51')](handleError(_0x318837,null));};exports[_0x4d65('0x2e')]=function(_0x20a8cc,_0x152d73){return db['ChatGroup']['find']({'where':{'id':_0x20a8cc[_0x4d65('0x52')]['id']}})[_0x4d65('0x2d')](handleEntityNotFound(_0x152d73,null))[_0x4d65('0x2d')](removeEntity(_0x152d73,null))['catch'](handleError(_0x152d73,null));};exports['describe']=function(_0x28db00,_0x433bba){return db['ChatGroup'][_0x4d65('0x53')]()[_0x4d65('0x2d')](respondWithResult(_0x433bba,null))[_0x4d65('0x51')](handleError(_0x433bba,null));};exports[_0x4d65('0x54')]=function(_0x432699,_0x3bb500,_0x1fca67){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x432699[_0x4d65('0x52')]['id'],'ToId':_0x432699[_0x4d65('0x55')]['id'],'read':![]}})[_0x4d65('0x2d')](function(_0x544f30){return{'id':_[_0x4d65('0x56')](_0x432699[_0x4d65('0x52')]['id']),'count':_0x544f30};})[_0x4d65('0x2d')](respondWithResult(_0x3bb500,null))['catch'](handleError(_0x3bb500,null));};exports[_0x4d65('0x57')]=function(_0x4d5572,_0x5c3217,_0x27c635){return db[_0x4d65('0x35')][_0x4d65('0x4e')]({'where':{'id':_0x4d5572[_0x4d65('0x52')]['id']}})[_0x4d65('0x2d')](handleEntityNotFound(_0x5c3217,null))[_0x4d65('0x2d')](function(_0x3990f3){if(_0x3990f3){return _0x3990f3['addMembers'](_0x4d5572[_0x4d65('0x50')][_0x4d65('0x58')],_[_0x4d65('0x59')](_0x4d5572[_0x4d65('0x50')],[_0x4d65('0x58'),'id'])||{});}})[_0x4d65('0x2d')](respondWithResult(_0x5c3217,null))[_0x4d65('0x51')](handleError(_0x5c3217,null));};exports[_0x4d65('0x5a')]=function(_0x191097,_0x709c5e,_0x1aaf10){var _0x123b5b={};var _0x1c0b3d={};var _0x48c082;var _0x34e2f4;return db[_0x4d65('0x35')][_0x4d65('0x5b')]({'where':{'id':_0x191097[_0x4d65('0x52')]['id']}})['then'](handleEntityNotFound(_0x709c5e,null))[_0x4d65('0x2d')](function(_0x3973aa){if(_0x3973aa){_0x48c082=_0x3973aa;_0x1c0b3d[_0x4d65('0x39')]=_['keys'](db[_0x4d65('0x5c')][_0x4d65('0x36')]);_0x1c0b3d['query']=_[_0x4d65('0x3b')](_0x191097[_0x4d65('0x3a')]);_0x1c0b3d['filters']=_[_0x4d65('0x3e')](_0x1c0b3d[_0x4d65('0x39')],_0x1c0b3d[_0x4d65('0x3a')]);_0x123b5b[_0x4d65('0x3d')]=_['intersection'](_0x1c0b3d['model'],qs['fields'](_0x191097[_0x4d65('0x3a')][_0x4d65('0x4c')]));_0x123b5b['attributes']=_0x123b5b[_0x4d65('0x3d')][_0x4d65('0x4d')]?_0x123b5b[_0x4d65('0x3d')]:_0x1c0b3d[_0x4d65('0x39')];_0x123b5b[_0x4d65('0x5d')]=qs[_0x4d65('0x41')](_0x191097[_0x4d65('0x3a')][_0x4d65('0x41')]);_0x123b5b[_0x4d65('0x42')]=qs[_0x4d65('0x3c')](_[_0x4d65('0x5e')](_0x191097[_0x4d65('0x3a')],_0x1c0b3d['filters']));if(_0x191097[_0x4d65('0x3a')]['filter']){_0x123b5b[_0x4d65('0x42')]=_['merge'](_0x123b5b['where'],{'$or':_[_0x4d65('0x34')](_0x123b5b[_0x4d65('0x3d')],function(_0x5f5ae2){var _0x49b5b3={};_0x49b5b3[_0x5f5ae2]={'$like':'%'+_0x191097[_0x4d65('0x3a')][_0x4d65('0x45')]+'%'};return _0x49b5b3;})});}_0x123b5b=_[_0x4d65('0x43')]({},_0x123b5b,_0x191097[_0x4d65('0x46')]);return _0x48c082[_0x4d65('0x5a')](_0x123b5b);}})['then'](function(_0x462383){if(_0x462383){_0x34e2f4=_0x462383[_0x4d65('0x4d')];if(!_0x191097['query'][_0x4d65('0x3f')](_0x4d65('0x40'))){_0x123b5b[_0x4d65('0x26')]=qs[_0x4d65('0x26')](_0x191097[_0x4d65('0x3a')][_0x4d65('0x26')]);_0x123b5b[_0x4d65('0x25')]=qs[_0x4d65('0x25')](_0x191097[_0x4d65('0x3a')]['offset']);}return _0x48c082['getMembers'](_0x123b5b);}})[_0x4d65('0x2d')](function(_0x1a1b76){if(_0x1a1b76){return _0x1a1b76?{'count':_0x34e2f4,'rows':_0x1a1b76}:null;}})[_0x4d65('0x2d')](respondWithResult(_0x709c5e,null))[_0x4d65('0x51')](handleError(_0x709c5e,null));};exports['removeMembers']=function(_0x2c7ee6,_0x30199f,_0x5181bb){return db[_0x4d65('0x35')][_0x4d65('0x4e')]({'where':{'id':_0x2c7ee6[_0x4d65('0x52')]['id']}})['then'](handleEntityNotFound(_0x30199f,null))[_0x4d65('0x2d')](function(_0x281c0c){if(_0x281c0c){return _0x281c0c[_0x4d65('0x5f')](_0x2c7ee6[_0x4d65('0x3a')][_0x4d65('0x58')]);}})[_0x4d65('0x2d')](respondWithStatusCode(_0x30199f,null))[_0x4d65('0x51')](handleError(_0x30199f,null));};exports[_0x4d65('0x60')]=function(_0x1f6ddd,_0x126ec7,_0x15e96a){if(_0x1f6ddd['body']['id']){delete _0x1f6ddd[_0x4d65('0x50')]['id'];}return db[_0x4d65('0x35')][_0x4d65('0x4e')]({'where':{'id':_0x1f6ddd[_0x4d65('0x52')]['id']}})[_0x4d65('0x2d')](handleEntityNotFound(_0x126ec7,null))[_0x4d65('0x2d')](function(_0x3f66af){if(_0x3f66af){_0x1f6ddd[_0x4d65('0x50')][_0x4d65('0x61')]=_0x3f66af['id'];return db[_0x4d65('0x62')][_0x4d65('0x4f')](_0x1f6ddd[_0x4d65('0x50')]);}})[_0x4d65('0x2d')](respondWithResult(_0x126ec7,null))['catch'](handleError(_0x126ec7,null));};exports[_0x4d65('0x63')]=function(_0x13b3d5,_0x5d7781,_0x460889){var _0x184688={};var _0x1c5a8={};var _0x3f8fc6;var _0x45b529;return db[_0x4d65('0x35')][_0x4d65('0x5b')]({'where':{'id':_0x13b3d5['params']['id']}})[_0x4d65('0x2d')](handleEntityNotFound(_0x5d7781,null))[_0x4d65('0x2d')](function(_0x37ed0e){if(_0x37ed0e){_0x3f8fc6=_0x37ed0e;_0x1c5a8[_0x4d65('0x39')]=_['keys'](db[_0x4d65('0x62')][_0x4d65('0x36')]);_0x1c5a8[_0x4d65('0x3a')]=_[_0x4d65('0x3b')](_0x13b3d5[_0x4d65('0x3a')]);_0x1c5a8[_0x4d65('0x3c')]=_['intersection'](_0x1c5a8['model'],_0x1c5a8[_0x4d65('0x3a')]);_0x184688[_0x4d65('0x3d')]=_[_0x4d65('0x3e')](_0x1c5a8[_0x4d65('0x39')],qs[_0x4d65('0x4c')](_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x4c')]));_0x184688['attributes']=_0x184688[_0x4d65('0x3d')][_0x4d65('0x4d')]?_0x184688[_0x4d65('0x3d')]:_0x1c5a8[_0x4d65('0x39')];_0x184688[_0x4d65('0x5d')]=qs[_0x4d65('0x41')](_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x41')]);_0x184688['where']=qs['filters'](_[_0x4d65('0x5e')](_0x13b3d5[_0x4d65('0x3a')],_0x1c5a8[_0x4d65('0x3c')]));if(_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x45')]){_0x184688[_0x4d65('0x42')]=_[_0x4d65('0x43')](_0x184688[_0x4d65('0x42')],{'$or':_['map'](_0x184688['attributes'],function(_0x1dcdca){var _0x439f06={};_0x439f06[_0x1dcdca]={'$like':'%'+_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x45')]+'%'};return _0x439f06;})});}if(_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x64')]){var _0x1d1567=_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x64')][_0x4d65('0x65')](',');var _0x5eb2c0={};_0x5eb2c0[_0x1d1567[0x0]]={'$gte':moment(_0x1d1567[0x1])[_0x4d65('0x66')](_0x4d65('0x67'))};_0x184688[_0x4d65('0x42')]=_['merge'](_0x184688['where'],_0x5eb2c0);}_0x184688=_[_0x4d65('0x43')]({},_0x184688,_0x13b3d5[_0x4d65('0x46')]);return _0x3f8fc6[_0x4d65('0x63')](_0x184688);}})[_0x4d65('0x2d')](function(_0x14b396){if(_0x14b396){_0x45b529=_0x14b396['length'];if(!_0x13b3d5['query'][_0x4d65('0x3f')](_0x4d65('0x40'))){_0x184688['limit']=qs[_0x4d65('0x26')](_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x26')]);_0x184688['offset']=qs[_0x4d65('0x25')](_0x13b3d5[_0x4d65('0x3a')][_0x4d65('0x25')]);}return _0x3f8fc6[_0x4d65('0x63')](_0x184688);}})[_0x4d65('0x2d')](function(_0x2f3298){if(_0x2f3298){return _0x2f3298?{'count':_0x45b529,'rows':_0x2f3298}:null;}})[_0x4d65('0x2d')](respondWithResult(_0x5d7781,null))[_0x4d65('0x51')](handleError(_0x5d7781,null));}; \ No newline at end of file +var _0x3c94=['save','then','destroy','error','stack','name','send','ChatGroup','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','options','hasOwnProperty','nolimit','removeMembers','addMessage','getMessages','order','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatGroup.socket','register','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3c94,0x157));var _0x43c9=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0x3c94[_0x4cc280];return _0x16ed24;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43c9('0x0'));var rp=require(_0x43c9('0x1'));var moment=require(_0x43c9('0x2'));var BPromise=require(_0x43c9('0x3'));var Mustache=require(_0x43c9('0x4'));var util=require(_0x43c9('0x5'));var path=require('path');var sox=require(_0x43c9('0x6'));var csv=require('to-csv');var ejs=require(_0x43c9('0x7'));var fs=require('fs');var fs_extra=require(_0x43c9('0x8'));var _=require(_0x43c9('0x9'));var squel=require(_0x43c9('0xa'));var crypto=require(_0x43c9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x43c9('0xc'));var toCsv=require(_0x43c9('0xd'));var querystring=require('querystring');var Papa=require(_0x43c9('0xe'));var Redis=require('ioredis');var authService=require(_0x43c9('0xf'));var qs=require(_0x43c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43c9('0x11'));var logger=require(_0x43c9('0x12'))(_0x43c9('0x13'));var utils=require(_0x43c9('0x14'));var config=require(_0x43c9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x43c9('0x16'))['db'];config[_0x43c9('0x17')]=_['defaults'](config['redis'],{'host':_0x43c9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43c9('0x17')]));require(_0x43c9('0x19'))[_0x43c9('0x1a')](socket);function respondWithStatusCode(_0x559273,_0xe87853){_0xe87853=_0xe87853||0xcc;return function(_0x5edec2){if(_0x5edec2){return _0x559273['sendStatus'](_0xe87853);}return _0x559273['status'](_0xe87853)[_0x43c9('0x1b')]();};}function respondWithResult(_0x36bf21,_0x3f854a){_0x3f854a=_0x3f854a||0xc8;return function(_0x5c3345){if(_0x5c3345){return _0x36bf21[_0x43c9('0x1c')](_0x3f854a)[_0x43c9('0x1d')](_0x5c3345);}};}function respondWithFilteredResult(_0x28cbce,_0x1175eb){return function(_0x71c502){if(_0x71c502){var _0x265be4=typeof _0x1175eb[_0x43c9('0x1e')]===_0x43c9('0x1f')&&typeof _0x1175eb['limit']===_0x43c9('0x1f');var _0x3abd97=_0x71c502[_0x43c9('0x20')];var _0x34677f=_0x265be4?0x0:_0x1175eb[_0x43c9('0x1e')];var _0x142a28=_0x265be4?_0x71c502[_0x43c9('0x20')]:_0x1175eb[_0x43c9('0x1e')]+_0x1175eb[_0x43c9('0x21')];var _0x17388a;if(_0x142a28>=_0x3abd97){_0x142a28=_0x3abd97;_0x17388a=0xc8;}else{_0x17388a=0xce;}_0x28cbce[_0x43c9('0x1c')](_0x17388a);return _0x28cbce['set'](_0x43c9('0x22'),_0x34677f+'-'+_0x142a28+'/'+_0x3abd97)['json'](_0x71c502);}return null;};}function patchUpdates(_0x667627){return function(_0x4f25f4){try{jsonpatch[_0x43c9('0x23')](_0x4f25f4,_0x667627,!![]);}catch(_0x339b20){return BPromise[_0x43c9('0x24')](_0x339b20);}return _0x4f25f4[_0x43c9('0x25')]();};}function saveUpdates(_0x2a78a2,_0x566f83){return function(_0x211955){if(_0x211955){return _0x211955['update'](_0x2a78a2)[_0x43c9('0x26')](function(_0x2d0f46){return _0x2d0f46;});}return null;};}function removeEntity(_0x20adcb,_0x3632df){return function(_0x56ba4f){if(_0x56ba4f){return _0x56ba4f[_0x43c9('0x27')]()[_0x43c9('0x26')](function(){_0x20adcb[_0x43c9('0x1c')](0xcc)[_0x43c9('0x1b')]();});}};}function handleEntityNotFound(_0x247ff5,_0x1793c7){return function(_0x4a1898){if(!_0x4a1898){_0x247ff5['sendStatus'](0x194);}return _0x4a1898;};}function handleError(_0x1ba571,_0xdc9ef2){_0xdc9ef2=_0xdc9ef2||0x1f4;return function(_0x3e32e1){logger[_0x43c9('0x28')](_0x3e32e1[_0x43c9('0x29')]);if(_0x3e32e1[_0x43c9('0x2a')]){delete _0x3e32e1[_0x43c9('0x2a')];}_0x1ba571['status'](_0xdc9ef2)[_0x43c9('0x2b')](_0x3e32e1);};}exports['index']=function(_0x5d3b06,_0x221f2d){var _0x57fd07={},_0x555219={},_0x1274b7={'count':0x0,'rows':[]};var _0x5cc5e5=_['map'](db[_0x43c9('0x2c')]['rawAttributes'],function(_0x14f031){return{'name':_0x14f031['fieldName'],'type':_0x14f031[_0x43c9('0x2d')][_0x43c9('0x2e')]};});_0x555219['model']=_['map'](_0x5cc5e5,_0x43c9('0x2a'));_0x555219[_0x43c9('0x2f')]=_[_0x43c9('0x30')](_0x5d3b06[_0x43c9('0x2f')]);_0x555219[_0x43c9('0x31')]=_[_0x43c9('0x32')](_0x555219[_0x43c9('0x33')],_0x555219[_0x43c9('0x2f')]);_0x57fd07[_0x43c9('0x34')]=_[_0x43c9('0x32')](_0x555219[_0x43c9('0x33')],qs['fields'](_0x5d3b06[_0x43c9('0x2f')][_0x43c9('0x35')]));_0x57fd07[_0x43c9('0x34')]=_0x57fd07[_0x43c9('0x34')][_0x43c9('0x36')]?_0x57fd07[_0x43c9('0x34')]:_0x555219[_0x43c9('0x33')];if(!_0x5d3b06['query']['hasOwnProperty']('nolimit')){_0x57fd07[_0x43c9('0x21')]=qs['limit'](_0x5d3b06[_0x43c9('0x2f')][_0x43c9('0x21')]);_0x57fd07[_0x43c9('0x1e')]=qs[_0x43c9('0x1e')](_0x5d3b06[_0x43c9('0x2f')][_0x43c9('0x1e')]);}_0x57fd07['order']=qs[_0x43c9('0x37')](_0x5d3b06[_0x43c9('0x2f')][_0x43c9('0x37')]);_0x57fd07[_0x43c9('0x38')]=qs['filters'](_[_0x43c9('0x39')](_0x5d3b06[_0x43c9('0x2f')],_0x555219[_0x43c9('0x31')]),_0x5cc5e5);if(_0x5d3b06['query'][_0x43c9('0x3a')]){_0x57fd07[_0x43c9('0x38')]=_['merge'](_0x57fd07[_0x43c9('0x38')],{'$or':_['map'](_0x5cc5e5,function(_0x4cec43){if(_0x4cec43[_0x43c9('0x2d')]!==_0x43c9('0x3b')){var _0x5437c2={};_0x5437c2[_0x4cec43[_0x43c9('0x2a')]]={'$like':'%'+_0x5d3b06[_0x43c9('0x2f')]['filter']+'%'};return _0x5437c2;}})});}_0x57fd07=_[_0x43c9('0x3c')]({},_0x57fd07,_0x5d3b06['options']);var _0xee9b03={'where':_0x57fd07[_0x43c9('0x38')]};return db['ChatGroup'][_0x43c9('0x20')](_0xee9b03)[_0x43c9('0x26')](function(_0x3b3c67){_0x1274b7['count']=_0x3b3c67;if(_0x5d3b06['query'][_0x43c9('0x3d')]){_0x57fd07[_0x43c9('0x3e')]=[{'all':!![]}];}return db[_0x43c9('0x2c')][_0x43c9('0x3f')](_0x57fd07);})[_0x43c9('0x26')](function(_0xfd13ea){_0x1274b7[_0x43c9('0x40')]=_0xfd13ea;return _0x1274b7;})[_0x43c9('0x26')](respondWithFilteredResult(_0x221f2d,_0x57fd07))[_0x43c9('0x41')](handleError(_0x221f2d,null));};exports[_0x43c9('0x42')]=function(_0x50c08d,_0x45d619){var _0x48d878={'raw':!![],'where':{'id':_0x50c08d[_0x43c9('0x43')]['id']}},_0x5ba81d={};_0x5ba81d[_0x43c9('0x33')]=_[_0x43c9('0x30')](db[_0x43c9('0x2c')][_0x43c9('0x44')]);_0x5ba81d[_0x43c9('0x2f')]=_['keys'](_0x50c08d[_0x43c9('0x2f')]);_0x5ba81d[_0x43c9('0x31')]=_[_0x43c9('0x32')](_0x5ba81d[_0x43c9('0x33')],_0x5ba81d[_0x43c9('0x2f')]);_0x48d878[_0x43c9('0x34')]=_['intersection'](_0x5ba81d[_0x43c9('0x33')],qs['fields'](_0x50c08d['query'][_0x43c9('0x35')]));_0x48d878['attributes']=_0x48d878[_0x43c9('0x34')][_0x43c9('0x36')]?_0x48d878[_0x43c9('0x34')]:_0x5ba81d[_0x43c9('0x33')];if(_0x50c08d[_0x43c9('0x2f')][_0x43c9('0x3d')]){_0x48d878[_0x43c9('0x3e')]=[{'all':!![]}];}_0x48d878=_[_0x43c9('0x3c')]({},_0x48d878,_0x50c08d['options']);return db[_0x43c9('0x2c')][_0x43c9('0x45')](_0x48d878)['then'](handleEntityNotFound(_0x45d619,null))['then'](respondWithResult(_0x45d619,null))[_0x43c9('0x41')](handleError(_0x45d619,null));};exports['create']=function(_0x27bf81,_0x5169b0){return db[_0x43c9('0x2c')][_0x43c9('0x46')](_0x27bf81[_0x43c9('0x47')],{})['then'](respondWithResult(_0x5169b0,0xc9))[_0x43c9('0x41')](handleError(_0x5169b0,null));};exports[_0x43c9('0x48')]=function(_0x21919e,_0x47bf2d){if(_0x21919e[_0x43c9('0x47')]['id']){delete _0x21919e[_0x43c9('0x47')]['id'];}return db[_0x43c9('0x2c')][_0x43c9('0x45')]({'where':{'id':_0x21919e['params']['id']}})[_0x43c9('0x26')](handleEntityNotFound(_0x47bf2d,null))[_0x43c9('0x26')](saveUpdates(_0x21919e[_0x43c9('0x47')],null))[_0x43c9('0x26')](respondWithResult(_0x47bf2d,null))[_0x43c9('0x41')](handleError(_0x47bf2d,null));};exports['destroy']=function(_0x3e2575,_0x19b168){return db['ChatGroup'][_0x43c9('0x45')]({'where':{'id':_0x3e2575[_0x43c9('0x43')]['id']}})[_0x43c9('0x26')](handleEntityNotFound(_0x19b168,null))['then'](removeEntity(_0x19b168,null))[_0x43c9('0x41')](handleError(_0x19b168,null));};exports['describe']=function(_0x236037,_0x3bf7fb){return db[_0x43c9('0x2c')][_0x43c9('0x49')]()['then'](respondWithResult(_0x3bf7fb,null))[_0x43c9('0x41')](handleError(_0x3bf7fb,null));};exports[_0x43c9('0x4a')]=function(_0x29963a,_0x1cb2c2,_0x56a22a){return db[_0x43c9('0x4b')][_0x43c9('0x20')]({'where':{'ChatGroupId':_0x29963a[_0x43c9('0x43')]['id'],'ToId':_0x29963a[_0x43c9('0x4c')]['id'],'read':![]}})[_0x43c9('0x26')](function(_0x566bf5){return{'id':_[_0x43c9('0x4d')](_0x29963a[_0x43c9('0x43')]['id']),'count':_0x566bf5};})[_0x43c9('0x26')](respondWithResult(_0x1cb2c2,null))['catch'](handleError(_0x1cb2c2,null));};exports[_0x43c9('0x4e')]=function(_0x343fef,_0xb8fac5,_0x437d49){return db[_0x43c9('0x2c')][_0x43c9('0x45')]({'where':{'id':_0x343fef['params']['id']}})[_0x43c9('0x26')](handleEntityNotFound(_0xb8fac5,null))[_0x43c9('0x26')](function(_0x305fd6){if(_0x305fd6){return _0x305fd6[_0x43c9('0x4e')](_0x343fef[_0x43c9('0x47')]['ids'],_[_0x43c9('0x4f')](_0x343fef[_0x43c9('0x47')],[_0x43c9('0x50'),'id'])||{});}})[_0x43c9('0x26')](respondWithResult(_0xb8fac5,null))[_0x43c9('0x41')](handleError(_0xb8fac5,null));};exports[_0x43c9('0x51')]=function(_0x136ab3,_0x3d16da,_0x2e3eee){var _0x459322={};var _0x46225b={};var _0x45457f;var _0x5a5bcf;return db['ChatGroup'][_0x43c9('0x52')]({'where':{'id':_0x136ab3[_0x43c9('0x43')]['id']}})[_0x43c9('0x26')](handleEntityNotFound(_0x3d16da,null))[_0x43c9('0x26')](function(_0x261974){if(_0x261974){_0x45457f=_0x261974;_0x46225b['model']=_[_0x43c9('0x30')](db[_0x43c9('0x53')]['rawAttributes']);_0x46225b[_0x43c9('0x2f')]=_[_0x43c9('0x30')](_0x136ab3[_0x43c9('0x2f')]);_0x46225b[_0x43c9('0x31')]=_[_0x43c9('0x32')](_0x46225b[_0x43c9('0x33')],_0x46225b['query']);_0x459322['attributes']=_['intersection'](_0x46225b[_0x43c9('0x33')],qs['fields'](_0x136ab3[_0x43c9('0x2f')][_0x43c9('0x35')]));_0x459322[_0x43c9('0x34')]=_0x459322['attributes'][_0x43c9('0x36')]?_0x459322[_0x43c9('0x34')]:_0x46225b[_0x43c9('0x33')];_0x459322['order']=qs['sort'](_0x136ab3[_0x43c9('0x2f')][_0x43c9('0x37')]);_0x459322[_0x43c9('0x38')]=qs['filters'](_[_0x43c9('0x39')](_0x136ab3['query'],_0x46225b['filters']));if(_0x136ab3['query'][_0x43c9('0x3a')]){_0x459322[_0x43c9('0x38')]=_[_0x43c9('0x3c')](_0x459322['where'],{'$or':_['map'](_0x459322[_0x43c9('0x34')],function(_0x1964aa){var _0xc8116d={};_0xc8116d[_0x1964aa]={'$like':'%'+_0x136ab3[_0x43c9('0x2f')]['filter']+'%'};return _0xc8116d;})});}_0x459322=_['merge']({},_0x459322,_0x136ab3[_0x43c9('0x54')]);return _0x45457f[_0x43c9('0x51')](_0x459322);}})[_0x43c9('0x26')](function(_0xbf43da){if(_0xbf43da){_0x5a5bcf=_0xbf43da[_0x43c9('0x36')];if(!_0x136ab3[_0x43c9('0x2f')][_0x43c9('0x55')](_0x43c9('0x56'))){_0x459322['limit']=qs[_0x43c9('0x21')](_0x136ab3['query'][_0x43c9('0x21')]);_0x459322['offset']=qs[_0x43c9('0x1e')](_0x136ab3['query']['offset']);}return _0x45457f['getMembers'](_0x459322);}})[_0x43c9('0x26')](function(_0x42e2c3){if(_0x42e2c3){return _0x42e2c3?{'count':_0x5a5bcf,'rows':_0x42e2c3}:null;}})[_0x43c9('0x26')](respondWithResult(_0x3d16da,null))[_0x43c9('0x41')](handleError(_0x3d16da,null));};exports['removeMembers']=function(_0x3a3172,_0x3597fc,_0x3068a0){return db[_0x43c9('0x2c')]['find']({'where':{'id':_0x3a3172[_0x43c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x3597fc,null))[_0x43c9('0x26')](function(_0x36f444){if(_0x36f444){return _0x36f444[_0x43c9('0x57')](_0x3a3172[_0x43c9('0x2f')]['ids']);}})[_0x43c9('0x26')](respondWithStatusCode(_0x3597fc,null))[_0x43c9('0x41')](handleError(_0x3597fc,null));};exports[_0x43c9('0x58')]=function(_0x3ba594,_0x3855cc,_0x4a8bb5){if(_0x3ba594['body']['id']){delete _0x3ba594[_0x43c9('0x47')]['id'];}return db[_0x43c9('0x2c')]['find']({'where':{'id':_0x3ba594[_0x43c9('0x43')]['id']}})[_0x43c9('0x26')](handleEntityNotFound(_0x3855cc,null))['then'](function(_0x5d0f87){if(_0x5d0f87){_0x3ba594[_0x43c9('0x47')]['ChatGroupId']=_0x5d0f87['id'];return db['ChatInternalMessage'][_0x43c9('0x46')](_0x3ba594[_0x43c9('0x47')]);}})['then'](respondWithResult(_0x3855cc,null))[_0x43c9('0x41')](handleError(_0x3855cc,null));};exports[_0x43c9('0x59')]=function(_0x1a690f,_0x18b8aa,_0x484e76){var _0x1b9e68={};var _0x1046de={};var _0x53f371;var _0x4075fd;return db[_0x43c9('0x2c')][_0x43c9('0x52')]({'where':{'id':_0x1a690f[_0x43c9('0x43')]['id']}})[_0x43c9('0x26')](handleEntityNotFound(_0x18b8aa,null))[_0x43c9('0x26')](function(_0x83584c){if(_0x83584c){_0x53f371=_0x83584c;_0x1046de[_0x43c9('0x33')]=_[_0x43c9('0x30')](db['ChatInternalMessage'][_0x43c9('0x44')]);_0x1046de[_0x43c9('0x2f')]=_[_0x43c9('0x30')](_0x1a690f[_0x43c9('0x2f')]);_0x1046de[_0x43c9('0x31')]=_['intersection'](_0x1046de[_0x43c9('0x33')],_0x1046de[_0x43c9('0x2f')]);_0x1b9e68[_0x43c9('0x34')]=_[_0x43c9('0x32')](_0x1046de['model'],qs['fields'](_0x1a690f[_0x43c9('0x2f')]['fields']));_0x1b9e68[_0x43c9('0x34')]=_0x1b9e68[_0x43c9('0x34')]['length']?_0x1b9e68[_0x43c9('0x34')]:_0x1046de[_0x43c9('0x33')];_0x1b9e68[_0x43c9('0x5a')]=qs[_0x43c9('0x37')](_0x1a690f['query']['sort']);_0x1b9e68[_0x43c9('0x38')]=qs['filters'](_[_0x43c9('0x39')](_0x1a690f[_0x43c9('0x2f')],_0x1046de[_0x43c9('0x31')]));if(_0x1a690f[_0x43c9('0x2f')][_0x43c9('0x3a')]){_0x1b9e68['where']=_['merge'](_0x1b9e68['where'],{'$or':_[_0x43c9('0x5b')](_0x1b9e68['attributes'],function(_0x4ce8c1){var _0x380855={};_0x380855[_0x4ce8c1]={'$like':'%'+_0x1a690f[_0x43c9('0x2f')][_0x43c9('0x3a')]+'%'};return _0x380855;})});}if(_0x1a690f[_0x43c9('0x2f')][_0x43c9('0x5c')]){var _0x4d47db=_0x1a690f[_0x43c9('0x2f')]['$gte']['split'](',');var _0x208b07={};_0x208b07[_0x4d47db[0x0]]={'$gte':moment(_0x4d47db[0x1])[_0x43c9('0x5d')](_0x43c9('0x5e'))};_0x1b9e68[_0x43c9('0x38')]=_['merge'](_0x1b9e68[_0x43c9('0x38')],_0x208b07);}_0x1b9e68=_[_0x43c9('0x3c')]({},_0x1b9e68,_0x1a690f['options']);return _0x53f371[_0x43c9('0x59')](_0x1b9e68);}})[_0x43c9('0x26')](function(_0x5ce206){if(_0x5ce206){_0x4075fd=_0x5ce206[_0x43c9('0x36')];if(!_0x1a690f[_0x43c9('0x2f')][_0x43c9('0x55')](_0x43c9('0x56'))){_0x1b9e68[_0x43c9('0x21')]=qs[_0x43c9('0x21')](_0x1a690f[_0x43c9('0x2f')]['limit']);_0x1b9e68[_0x43c9('0x1e')]=qs[_0x43c9('0x1e')](_0x1a690f[_0x43c9('0x2f')][_0x43c9('0x1e')]);}return _0x53f371['getMessages'](_0x1b9e68);}})[_0x43c9('0x26')](function(_0x2fecfe){if(_0x2fecfe){return _0x2fecfe?{'count':_0x4075fd,'rows':_0x2fecfe}:null;}})[_0x43c9('0x26')](respondWithResult(_0x18b8aa,null))[_0x43c9('0x41')](handleError(_0x18b8aa,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1cee381..589a280 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 _0x1d0d=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hook'];(function(_0x532311,_0xdd4791){var _0x59f41f=function(_0xd4564d){while(--_0xd4564d){_0x532311['push'](_0x532311['shift']());}};_0x59f41f(++_0xdd4791);}(_0x1d0d,0x184));var _0xd1d0=function(_0x2783da,_0x1f84e0){_0x2783da=_0x2783da-0x0;var _0x49652f=_0x1d0d[_0x2783da];return _0x49652f;};'use strict';var EventEmitter=require(_0xd1d0('0x0'));var ChatGroup=require(_0xd1d0('0x1'))['db'][_0xd1d0('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd1d0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd1d0('0x4'),'afterDestroy':_0xd1d0('0x5')};function emitEvent(_0x5e6b12){return function(_0x1db763,_0x1c844c,_0x54fb90){ChatGroupEvents[_0xd1d0('0x6')](_0x5e6b12+':'+_0x1db763['id'],_0x1db763);ChatGroupEvents[_0xd1d0('0x6')](_0x5e6b12,_0x1db763);_0x54fb90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xd1d0('0x7')](e,emitEvent(event));}}module[_0xd1d0('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x5950=['ChatGroup','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5950,0x11e));var _0x0595=function(_0x4c68bc,_0x1957d7){_0x4c68bc=_0x4c68bc-0x0;var _0x17bb71=_0x5950[_0x4c68bc];return _0x17bb71;};'use strict';var EventEmitter=require(_0x0595('0x0'));var ChatGroup=require(_0x0595('0x1'))['db'][_0x0595('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0595('0x3')](0x0);var events={'afterCreate':_0x0595('0x4'),'afterUpdate':_0x0595('0x5'),'afterDestroy':_0x0595('0x6')};function emitEvent(_0x294438){return function(_0x18065f,_0x5ea571,_0x5ba764){ChatGroupEvents[_0x0595('0x7')](_0x294438+':'+_0x18065f['id'],_0x18065f);ChatGroupEvents[_0x0595('0x7')](_0x294438,_0x18065f);_0x5ba764(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x0595('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 34c6a6e..05ee16f 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 _0x8a5c=['ChatGroup','chat_groups','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x8a5c,0xe9));var _0xc8a5=function(_0xe63929,_0x296869){_0xe63929=_0xe63929-0x0;var _0x568ee7=_0x8a5c[_0xe63929];return _0x568ee7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc8a5('0x0'))('api');var moment=require(_0xc8a5('0x1'));var BPromise=require('bluebird');var rp=require(_0xc8a5('0x2'));var fs=require('fs');var path=require(_0xc8a5('0x3'));var rimraf=require(_0xc8a5('0x4'));var config=require(_0xc8a5('0x5'));var attributes=require(_0xc8a5('0x6'));module[_0xc8a5('0x7')]=function(_0x2efa0b,_0x5dcf21){return _0x2efa0b[_0xc8a5('0x8')](_0xc8a5('0x9'),attributes,{'tableName':_0xc8a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x893e=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash'];(function(_0x14ddd4,_0x5b527d){var _0x421616=function(_0x4f0a42){while(--_0x4f0a42){_0x14ddd4['push'](_0x14ddd4['shift']());}};_0x421616(++_0x5b527d);}(_0x893e,0x1a3));var _0xe893=function(_0xcf4560,_0xee698){_0xcf4560=_0xcf4560-0x0;var _0x1f8a96=_0x893e[_0xcf4560];return _0x1f8a96;};'use strict';var _=require(_0xe893('0x0'));var util=require('util');var logger=require(_0xe893('0x1'))(_0xe893('0x2'));var moment=require(_0xe893('0x3'));var BPromise=require(_0xe893('0x4'));var rp=require(_0xe893('0x5'));var fs=require('fs');var path=require(_0xe893('0x6'));var rimraf=require('rimraf');var config=require(_0xe893('0x7'));var attributes=require(_0xe893('0x8'));module[_0xe893('0x9')]=function(_0x2ce5c5,_0x40902a){return _0x2ce5c5['define'](_0xe893('0xa'),attributes,{'tableName':_0xe893('0xb'),'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 aa20aa1..6fd8e9b 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 _0x20ec=['./chatGroup.socket','register','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5d5cee,_0x1d2109){var _0x31e49a=function(_0x4f167a){while(--_0x4f167a){_0x5d5cee['push'](_0x5d5cee['shift']());}};_0x31e49a(++_0x1d2109);}(_0x20ec,0x12f));var _0xc20e=function(_0x11f1fd,_0xce95a8){_0x11f1fd=_0x11f1fd-0x0;var _0x2d1215=_0x20ec[_0x11f1fd];return _0x2d1215;};'use strict';var _=require(_0xc20e('0x0'));var util=require(_0xc20e('0x1'));var moment=require(_0xc20e('0x2'));var BPromise=require(_0xc20e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc20e('0x4'))['db'];var utils=require(_0xc20e('0x5'));var logger=require(_0xc20e('0x6'))(_0xc20e('0x7'));var config=require(_0xc20e('0x8'));var jayson=require(_0xc20e('0x9'));var client=jayson[_0xc20e('0xa')][_0xc20e('0xb')]({'port':0x232a});config[_0xc20e('0xc')]=_[_0xc20e('0xd')](config[_0xc20e('0xc')],{'host':_0xc20e('0xe'),'port':0x18eb});var socket=require(_0xc20e('0xf'))(new Redis(config['redis']));require(_0xc20e('0x10'))[_0xc20e('0x11')](socket);function respondWithRpcPromise(_0x302ba2,_0xa72501,_0x15fd37){return new BPromise(function(_0x1e45d9,_0x4c8dca){return client[_0xc20e('0x12')](_0x302ba2,_0x15fd37)[_0xc20e('0x13')](function(_0x5665c2){logger['info']('ChatGroup,\x20%s,\x20%s',_0xa72501,_0xc20e('0x14'));logger[_0xc20e('0x15')](_0xc20e('0x16'),_0xa72501,_0xc20e('0x14'),JSON['stringify'](_0x5665c2));if(_0x5665c2['error']){if(_0x5665c2[_0xc20e('0x17')]['code']===0x1f4){logger[_0xc20e('0x17')](_0xc20e('0x18'),_0xa72501,_0x5665c2[_0xc20e('0x17')][_0xc20e('0x19')]);return _0x4c8dca(_0x5665c2[_0xc20e('0x17')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0xa72501,_0x5665c2[_0xc20e('0x17')][_0xc20e('0x19')]);return _0x1e45d9(_0x5665c2[_0xc20e('0x17')][_0xc20e('0x19')]);}else{logger[_0xc20e('0x1a')](_0xc20e('0x18'),_0xa72501,_0xc20e('0x14'));_0x1e45d9(_0x5665c2[_0xc20e('0x1b')][_0xc20e('0x19')]);}})[_0xc20e('0x1c')](function(_0xfeae40){logger['error'](_0xc20e('0x18'),_0xa72501,_0xfeae40);_0x4c8dca(_0xfeae40);});});} \ No newline at end of file +var _0xfd28=['message','info','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0xfd28,0x148));var _0x8fd2=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xfd28[_0x38b14f];return _0x22a324;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});config[_0x8fd2('0xa')]=_['defaults'](config['redis'],{'host':_0x8fd2('0xb'),'port':0x18eb});var socket=require(_0x8fd2('0xc'))(new Redis(config[_0x8fd2('0xa')]));require('./chatGroup.socket')[_0x8fd2('0xd')](socket);function respondWithRpcPromise(_0x49ca87,_0x2842f3,_0x5aabf0){return new BPromise(function(_0x34ae5c,_0x4fdf0b){return client[_0x8fd2('0xe')](_0x49ca87,_0x5aabf0)['then'](function(_0x1b6558){logger['info'](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));logger[_0x8fd2('0x11')](_0x8fd2('0x12'),_0x2842f3,_0x8fd2('0x10'),JSON[_0x8fd2('0x13')](_0x1b6558));if(_0x1b6558[_0x8fd2('0x14')]){if(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x15')]===0x1f4){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);return _0x4fdf0b(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);}logger['error'](_0x8fd2('0xf'),_0x2842f3,_0x1b6558['error']['message']);return _0x34ae5c(_0x1b6558['error'][_0x8fd2('0x16')]);}else{logger[_0x8fd2('0x17')](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));_0x34ae5c(_0x1b6558['result'][_0x8fd2('0x16')]);}})[_0x8fd2('0x18')](function(_0x411943){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x411943);_0x4fdf0b(_0x411943);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5f50876..7ab62ef 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 _0x91e0=['update','emit','removeListener','register','./chatGroup.events','save','remove'];(function(_0x5015cc,_0x36ba25){var _0x5930d7=function(_0x5ee93a){while(--_0x5ee93a){_0x5015cc['push'](_0x5015cc['shift']());}};_0x5930d7(++_0x36ba25);}(_0x91e0,0xc1));var _0x091e=function(_0x2f35be,_0x5aa2c6){_0x2f35be=_0x2f35be-0x0;var _0x2d6a0c=_0x91e0[_0x2f35be];return _0x2d6a0c;};'use strict';var ChatGroupEvents=require(_0x091e('0x0'));var events=[_0x091e('0x1'),_0x091e('0x2'),_0x091e('0x3')];function createListener(_0x1bd7df,_0x5df8ea){return function(_0x56f74b){_0x5df8ea[_0x091e('0x4')](_0x1bd7df,_0x56f74b);};}function removeListener(_0x333065,_0x35b4c9){return function(){ChatGroupEvents[_0x091e('0x5')](_0x333065,_0x35b4c9);};}exports[_0x091e('0x6')]=function(_0x25c8aa){for(var _0x2e7f23=0x0,_0x516bac=events['length'];_0x2e7f23<_0x516bac;_0x2e7f23++){var _0x4a2c6c=events[_0x2e7f23];var _0x40c9f2=createListener('chatGroup:'+_0x4a2c6c,_0x25c8aa);ChatGroupEvents['on'](_0x4a2c6c,_0x40c9f2);}}; \ No newline at end of file +var _0x0573=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x450bfe,_0x5772a8){var _0x20d151=function(_0x3618de){while(--_0x3618de){_0x450bfe['push'](_0x450bfe['shift']());}};_0x20d151(++_0x5772a8);}(_0x0573,0xdc));var _0x3057=function(_0x360819,_0x3e8e07){_0x360819=_0x360819-0x0;var _0x353edf=_0x0573[_0x360819];return _0x353edf;};'use strict';var ChatGroupEvents=require(_0x3057('0x0'));var events=[_0x3057('0x1'),_0x3057('0x2'),_0x3057('0x3')];function createListener(_0xe8e06,_0x471aea){return function(_0x557113){_0x471aea[_0x3057('0x4')](_0xe8e06,_0x557113);};}function removeListener(_0x455bd9,_0x252fa2){return function(){ChatGroupEvents[_0x3057('0x5')](_0x455bd9,_0x252fa2);};}exports[_0x3057('0x6')]=function(_0x2fd4c6){for(var _0x2c1d90=0x0,_0x2ee40f=events[_0x3057('0x7')];_0x2c1d90<_0x2ee40f;_0x2c1d90++){var _0x2ac437=events[_0x2c1d90];var _0x4f5ebc=createListener(_0x3057('0x8')+_0x2ac437,_0x2fd4c6);ChatGroupEvents['on'](_0x2ac437,_0x4f5ebc);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6130bb9..745963a 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 _0x40f7=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','/:id/messages','addMessage','update','delete','removeMembers'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x40f7,0x75));var _0x740f=function(_0x40cb8c,_0x381f11){_0x40cb8c=_0x40cb8c-0x0;var _0x5315ce=_0x40f7[_0x40cb8c];return _0x5315ce;};'use strict';var multer=require(_0x740f('0x0'));var util=require(_0x740f('0x1'));var path=require('path');var timeout=require(_0x740f('0x2'));var express=require(_0x740f('0x3'));var router=express[_0x740f('0x4')]();var fs_extra=require(_0x740f('0x5'));var auth=require(_0x740f('0x6'));var interaction=require(_0x740f('0x7'));var config=require(_0x740f('0x8'));var controller=require(_0x740f('0x9'));router[_0x740f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x740f('0xa')](_0x740f('0xb'),auth[_0x740f('0xc')](),controller[_0x740f('0xd')]);router[_0x740f('0xa')](_0x740f('0xe'),auth['isAuthenticated'](),controller[_0x740f('0xf')]);router[_0x740f('0xa')](_0x740f('0x10'),auth['isAuthenticated'](),controller[_0x740f('0x11')]);router[_0x740f('0xa')](_0x740f('0x12'),auth[_0x740f('0xc')](),controller['getMembers']);router[_0x740f('0xa')]('/:id/messages',auth[_0x740f('0xc')](),controller[_0x740f('0x13')]);router[_0x740f('0x14')]('/',auth['isAuthenticated'](),controller[_0x740f('0x15')]);router[_0x740f('0x14')]('/:id/members',auth[_0x740f('0xc')](),controller[_0x740f('0x16')]);router[_0x740f('0x14')](_0x740f('0x17'),auth['isAuthenticated'](),controller[_0x740f('0x18')]);router['put'](_0x740f('0xe'),auth[_0x740f('0xc')](),controller[_0x740f('0x19')]);router[_0x740f('0x1a')](_0x740f('0xe'),auth[_0x740f('0xc')](),controller['destroy']);router['delete']('/:id/members',auth[_0x740f('0xc')](),controller[_0x740f('0x1b')]);module[_0x740f('0x1c')]=router; \ No newline at end of file +var _0x1e2b=['post','create','addMembers','addMessage','update','destroy','delete','removeMembers','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./chatGroup.controller','index','get','/describe','describe','/:id','show','/:id/unread','isAuthenticated','getUnread','/:id/members','getMembers','/:id/messages','getMessages'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x1e2b,0x1d9));var _0xb1e2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1e2b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb1e2('0x0'));var util=require(_0xb1e2('0x1'));var path=require(_0xb1e2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb1e2('0x3')]();var fs_extra=require(_0xb1e2('0x4'));var auth=require(_0xb1e2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb1e2('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb1e2('0x7')]);router[_0xb1e2('0x8')](_0xb1e2('0x9'),auth['isAuthenticated'](),controller[_0xb1e2('0xa')]);router['get'](_0xb1e2('0xb'),auth['isAuthenticated'](),controller[_0xb1e2('0xc')]);router[_0xb1e2('0x8')](_0xb1e2('0xd'),auth[_0xb1e2('0xe')](),controller[_0xb1e2('0xf')]);router[_0xb1e2('0x8')](_0xb1e2('0x10'),auth[_0xb1e2('0xe')](),controller[_0xb1e2('0x11')]);router[_0xb1e2('0x8')](_0xb1e2('0x12'),auth['isAuthenticated'](),controller[_0xb1e2('0x13')]);router[_0xb1e2('0x14')]('/',auth[_0xb1e2('0xe')](),controller[_0xb1e2('0x15')]);router[_0xb1e2('0x14')](_0xb1e2('0x10'),auth[_0xb1e2('0xe')](),controller[_0xb1e2('0x16')]);router[_0xb1e2('0x14')](_0xb1e2('0x12'),auth[_0xb1e2('0xe')](),controller[_0xb1e2('0x17')]);router['put'](_0xb1e2('0xb'),auth[_0xb1e2('0xe')](),controller[_0xb1e2('0x18')]);router['delete'](_0xb1e2('0xb'),auth[_0xb1e2('0xe')](),controller[_0xb1e2('0x19')]);router[_0xb1e2('0x1a')](_0xb1e2('0x10'),auth[_0xb1e2('0xe')](),controller[_0xb1e2('0x1b')]);module[_0xb1e2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a1782fa..f15da3f 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 _0x5797=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','exports'];(function(_0x126056,_0x1c4008){var _0xff1758=function(_0x5a87e5){while(--_0x5a87e5){_0x126056['push'](_0x126056['shift']());}};_0xff1758(++_0x1c4008);}(_0x5797,0x1b7));var _0x7579=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x5797[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require('sequelize');module[_0x7579('0x0')]={'closed':{'type':Sequelize[_0x7579('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7579('0x2')]},'ratingType':{'type':Sequelize[_0x7579('0x3')](_0x7579('0x4'),_0x7579('0x5')),'defaultValue':_0x7579('0x4')},'ratingMessage':{'type':Sequelize[_0x7579('0x6')]},'pathTranscript':{'type':Sequelize[_0x7579('0x6')]},'mailTranscript':{'type':Sequelize[_0x7579('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7579('0x8')]},'disposition':{'type':Sequelize[_0x7579('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7579('0x7')]},'note':{'type':Sequelize[_0x7579('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7579('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x7579('0x7')]},'deviceVendor':{'type':Sequelize[_0x7579('0x7')]},'deviceType':{'type':Sequelize[_0x7579('0x7')]},'referer':{'type':Sequelize[_0x7579('0x6')]},'customerIp':{'type':Sequelize[_0x7579('0x7')]},'formData':{'type':Sequelize[_0x7579('0x6')](_0x7579('0x9'))},'read1stAt':{'type':Sequelize[_0x7579('0x8')]},'lastMsgAt':{'type':Sequelize[_0x7579('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x7579('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7579('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x7579('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7579('0x2')]}}; \ No newline at end of file +var _0x9e61=['DATE','ENUM','sequelize','exports','INTEGER','star','thumb','TEXT','STRING','long'];(function(_0x169318,_0x3b4dfa){var _0x5d07b6=function(_0x1376a8){while(--_0x1376a8){_0x169318['push'](_0x169318['shift']());}};_0x5d07b6(++_0x3b4dfa);}(_0x9e61,0xca));var _0x19e6=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x9e61[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0x19e6('0x0'));module[_0x19e6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x19e6('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x19e6('0x3'),_0x19e6('0x4')),'defaultValue':_0x19e6('0x3')},'ratingMessage':{'type':Sequelize[_0x19e6('0x5')]},'pathTranscript':{'type':Sequelize[_0x19e6('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x19e6('0x6')]},'thirdDisposition':{'type':Sequelize[_0x19e6('0x6')]},'note':{'type':Sequelize[_0x19e6('0x6')]},'browserName':{'type':Sequelize[_0x19e6('0x6')]},'browserVersion':{'type':Sequelize[_0x19e6('0x6')]},'osName':{'type':Sequelize[_0x19e6('0x6')]},'osVersion':{'type':Sequelize[_0x19e6('0x6')]},'deviceModel':{'type':Sequelize[_0x19e6('0x6')]},'deviceVendor':{'type':Sequelize[_0x19e6('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x19e6('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x19e6('0x5')](_0x19e6('0x7'))},'read1stAt':{'type':Sequelize[_0x19e6('0x8')]},'lastMsgAt':{'type':Sequelize[_0x19e6('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x19e6('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x19e6('0x6')]},'customerPort':{'type':Sequelize[_0x19e6('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x19e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 71c72f6..ff7bc7f 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 _0x8553=['ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','type','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','length','agentAlias','System','customer','%s%d','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','findAll','getMyMessages','order','includeAgent','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','transcript-%d-%s.zip','push','firstName','lastName','attachments','read','Owner','get','mkdirSync','N.A.','toString','closedAt','YYYY-MM-DD\x20HH:mm:ss','osName','referer','customerIp','customerPort','tail','existsSync','out','secret','renderFile','views','downloadInteraction.ejs','.pdf','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','send','render','body','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','chat','query','user','show','params','model','keys','filters','intersection','fields','attributes','includeAll','include','merge','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','name','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url'];(function(_0x307e32,_0x292b7d){var _0x2fcc03=function(_0x5e43fb){while(--_0x5e43fb){_0x307e32['push'](_0x307e32['shift']());}};_0x2fcc03(++_0x292b7d);}(_0x8553,0x14b));var _0x3855=function(_0x212e46,_0x43365e){_0x212e46=_0x212e46-0x0;var _0x58ec67=_0x8553[_0x212e46];return _0x58ec67;};'use strict';var rimraf=require(_0x3855('0x0'));var zipdir=require(_0x3855('0x1'));var rp=require(_0x3855('0x2'));var moment=require(_0x3855('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3855('0x4'));var util=require('util');var path=require(_0x3855('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3855('0x6'));var Redis=require(_0x3855('0x7'));var interaction=require(_0x3855('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x3855('0x9'));var logger=require(_0x3855('0xa'))(_0x3855('0xb'));var config=require(_0x3855('0xc'));var db=require(_0x3855('0xd'))['db'];config[_0x3855('0xe')]=_[_0x3855('0xf')](config['redis'],{'host':_0x3855('0x10'),'port':0x18eb});var socket=require(_0x3855('0x11'))(new Redis(config[_0x3855('0xe')]));require(_0x3855('0x12'))[_0x3855('0x13')](socket);var jayson=require(_0x3855('0x14'));var client=jayson['client'][_0x3855('0x15')]({'port':0x232b});var client9004=jayson['client'][_0x3855('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x5a8b80,_0x12cb42,_0x32a0c8,_0x45a9b7){return new BPromise(function(_0x1929f2,_0x3a78d1){var _0x4a8208=_0x45a9b7||client;return _0x4a8208[_0x3855('0x16')](_0x5a8b80,_0x32a0c8)[_0x3855('0x17')](function(_0x366056){logger[_0x3855('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x12cb42,_0x3855('0x19'));logger[_0x3855('0x1a')](_0x3855('0x1b'),_0x12cb42,'request\x20sent',JSON['stringify'](_0x366056));if(_0x366056[_0x3855('0x1c')]){if(_0x366056[_0x3855('0x1c')][_0x3855('0x1d')]===0x1f4){logger[_0x3855('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x12cb42,_0x366056[_0x3855('0x1c')][_0x3855('0x1e')]);return _0x3a78d1(_0x366056['error']['message']);}logger[_0x3855('0x1c')](_0x3855('0x1f'),_0x12cb42,_0x366056['error']['message']);return _0x1929f2(_0x366056[_0x3855('0x1c')]['message']);}else{logger[_0x3855('0x18')](_0x3855('0x1f'),_0x12cb42,_0x3855('0x19'));_0x1929f2(_0x366056[_0x3855('0x20')]['message']);}})[_0x3855('0x21')](function(_0x58b38e){logger['error'](_0x3855('0x1f'),_0x12cb42,_0x58b38e);_0x3a78d1(_0x58b38e);});});}function respondWithStatusCode(_0x1f1a80,_0x2b0fdb){_0x2b0fdb=_0x2b0fdb||0xcc;return function(_0x4cbf13){if(_0x4cbf13){return _0x1f1a80['sendStatus'](_0x2b0fdb);}return _0x1f1a80['status'](_0x2b0fdb)[_0x3855('0x22')]();};}function respondWithResult(_0x24e9e8,_0x544e36){_0x544e36=_0x544e36||0xc8;return function(_0x435cc9){if(_0x435cc9){return _0x24e9e8[_0x3855('0x23')](_0x544e36)[_0x3855('0x24')](_0x435cc9);}};}function respondWithFilteredResult(_0x4ed6c6,_0x4e1e22){return function(_0x4bdcce){if(_0x4bdcce){var _0xe1f887=typeof _0x4e1e22[_0x3855('0x25')]===_0x3855('0x26')&&typeof _0x4e1e22[_0x3855('0x27')]==='undefined';var _0x536180=_0x4bdcce['count'];var _0x38e9a8=_0xe1f887?0x0:_0x4e1e22[_0x3855('0x25')];var _0x46cc5c=_0xe1f887?_0x4bdcce[_0x3855('0x28')]:_0x4e1e22[_0x3855('0x25')]+_0x4e1e22[_0x3855('0x27')];var _0x306e9e;if(_0x46cc5c>=_0x536180){_0x46cc5c=_0x536180;_0x306e9e=0xc8;}else{_0x306e9e=0xce;}_0x4ed6c6['status'](_0x306e9e);return _0x4ed6c6[_0x3855('0x29')](_0x3855('0x2a'),_0x38e9a8+'-'+_0x46cc5c+'/'+_0x536180)['json'](_0x4bdcce);}return null;};}function saveUpdates(_0x14d422){return function(_0x4345bd){if(_0x4345bd){return _0x4345bd[_0x3855('0x2b')](_0x14d422)['then'](function(_0x52d2eb){return _0x52d2eb;});}return null;};}function removeEntity(_0x436bdb){return function(_0x2cc89b){if(_0x2cc89b){return _0x2cc89b[_0x3855('0x2c')]()[_0x3855('0x17')](function(){_0x436bdb[_0x3855('0x23')](0xcc)[_0x3855('0x22')]();});}};}function handleEntityNotFound(_0x52eadb){return function(_0x596558){if(!_0x596558){_0x52eadb['sendStatus'](0x194);}return _0x596558;};}function handleError(_0x2d23f3,_0x5547a6){_0x5547a6=_0x5547a6||0x1f4;return function(_0x28f6f7){logger[_0x3855('0x1c')](_0x28f6f7[_0x3855('0x2d')]);if(_0x28f6f7['name']){delete _0x28f6f7['name'];}_0x2d23f3[_0x3855('0x23')](_0x5547a6)[_0x3855('0x2e')](_0x28f6f7);};}function getMustacheRender(_0x2c7e42,_0x35362e){return Mustache[_0x3855('0x2f')](_0x2c7e42,_['merge'](_0x35362e[_0x3855('0x30')],{'contact':_0x35362e['contact'],'message':_0x35362e[_0x3855('0x1e')],'agent':_0x35362e[_0x3855('0x31')],'interaction':_0x35362e[_0x3855('0x32')],'account':_0x35362e[_0x3855('0x33')]}))||'';}exports['index']=function(_0x570c95,_0x15e573){var _0x1abefa={};var _0x40bf0c=_[_0x3855('0x34')](db[_0x3855('0x35')][_0x3855('0x36')],function(_0x2d4516){return{'name':_0x2d4516[_0x3855('0x37')],'type':_0x2d4516['type'][_0x3855('0x38')]};});_0x1abefa=qs[_0x3855('0x39')](_0x40bf0c,_0x570c95);return interaction['findAll'](_0x3855('0x3a'),_0x570c95[_0x3855('0x3b')],_0x570c95[_0x3855('0x3c')],_0x1abefa,_0x40bf0c)[_0x3855('0x17')](respondWithFilteredResult(_0x15e573,_0x1abefa))[_0x3855('0x21')](handleError(_0x15e573,null));};exports[_0x3855('0x3d')]=function(_0x3a0db2,_0x231221){var _0x9c29f5={'raw':![],'where':{'id':_0x3a0db2[_0x3855('0x3e')]['id']}},_0x158fd8={};_0x158fd8[_0x3855('0x3f')]=_['keys'](db[_0x3855('0x35')][_0x3855('0x36')]);_0x158fd8[_0x3855('0x3b')]=_[_0x3855('0x40')](_0x3a0db2[_0x3855('0x3b')]);_0x158fd8[_0x3855('0x41')]=_[_0x3855('0x42')](_0x158fd8[_0x3855('0x3f')],_0x158fd8['query']);_0x9c29f5['attributes']=_[_0x3855('0x42')](_0x158fd8[_0x3855('0x3f')],qs[_0x3855('0x43')](_0x3a0db2[_0x3855('0x3b')][_0x3855('0x43')]));_0x9c29f5['attributes']=_0x9c29f5['attributes']['length']?_0x9c29f5[_0x3855('0x44')]:_0x158fd8[_0x3855('0x3f')];if(_0x3a0db2[_0x3855('0x3b')][_0x3855('0x45')]){_0x9c29f5[_0x3855('0x46')]=[{'all':!![]}];}_0x9c29f5=_[_0x3855('0x47')]({},_0x9c29f5,_0x3a0db2[_0x3855('0x48')]);return db[_0x3855('0x35')]['find'](_0x9c29f5)['then'](handleEntityNotFound(_0x231221,null))[_0x3855('0x17')](respondWithResult(_0x231221,null))['catch'](handleError(_0x231221,null));};exports[_0x3855('0x49')]=function(_0x37ef0b,_0x1ba697){return db['ChatInteraction'][_0x3855('0x49')](_0x37ef0b[_0x3855('0x30')],{})[_0x3855('0x17')](respondWithResult(_0x1ba697,0xc9))[_0x3855('0x21')](handleError(_0x1ba697,null));};exports[_0x3855('0x2b')]=function(_0xa3e654,_0x5dd3c9){if(_0xa3e654[_0x3855('0x30')]['id']){delete _0xa3e654[_0x3855('0x30')]['id'];}return db[_0x3855('0x35')][_0x3855('0x4a')]({'where':{'id':_0xa3e654[_0x3855('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5dd3c9,null))[_0x3855('0x17')](saveUpdates(_0xa3e654[_0x3855('0x30')],null))[_0x3855('0x17')](respondWithResult(_0x5dd3c9,null))[_0x3855('0x21')](handleError(_0x5dd3c9,null));};exports[_0x3855('0x2c')]=function(_0x198437,_0x13bf4f){return db[_0x3855('0x35')]['find']({'where':{'id':_0x198437['params']['id']}})[_0x3855('0x17')](handleEntityNotFound(_0x13bf4f,null))[_0x3855('0x17')](removeEntity(_0x13bf4f,null))[_0x3855('0x21')](handleError(_0x13bf4f,null));};exports[_0x3855('0x4b')]=function(_0x5aa073,_0xd70348){return db[_0x3855('0x35')][_0x3855('0x4b')]()[_0x3855('0x17')](respondWithResult(_0xd70348,null))[_0x3855('0x21')](handleError(_0xd70348,null));};exports[_0x3855('0x4c')]=function(_0x316335,_0x356705){var _0x56b5d5=_0x316335[_0x3855('0x3e')]['id'];var _0x9bb178;var _0x12c8e1;var _0xa24c71;return db['ChatInteraction'][_0x3855('0x4d')]({'where':{'id':_0x56b5d5}})[_0x3855('0x17')](function(_0x298144){_0x9bb178=_0x298144;return db[_0x3855('0x4e')][_0x3855('0x4d')]({'where':{'id':_0x298144[_0x3855('0x4f')]},'attributes':['id',_0x3855('0x50'),_0x3855('0x51'),'vidaooTopic',_0x3855('0x52'),_0x3855('0x53')],'raw':!![]});})['then'](function(_0x2f0c15){if(_0x2f0c15&&_0x2f0c15['vidaooApiKey']&&_0x2f0c15['vidaooEscalation']){_0x12c8e1=_0x2f0c15;var _0x1f918d={'interaction':{'id':_0x56b5d5},'agent':{'id':_0x316335['user']['id'],'name':_0x316335['user'][_0x3855('0x54')],'fullname':_0x316335[_0x3855('0x3c')][_0x3855('0x55')],'email':_0x316335[_0x3855('0x3c')][_0x3855('0x56')]},'contact':_0x316335[_0x3855('0x30')]['contact'],'account':_0x316335[_0x3855('0x30')]['account']};var _0x4b07f8={'rejectUnauthorized':![],'method':'POST','url':_0x3855('0x57'),'headers':{'X-APIKEY':_0x2f0c15[_0x3855('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x316335[_0x3855('0x3c')]['email']],'buttons':null,'topic':_0x12c8e1[_0x3855('0x58')],'note':_['isNull'](_0x12c8e1[_0x3855('0x52')])?null:getMustacheRender(_0x12c8e1[_0x3855('0x52')],_0x1f918d),'metadata':null},'redirect':_0x3855('0x59'),'json':!![]};try{if(!_[_0x3855('0x5a')](_0x12c8e1[_0x3855('0x53')])){var _0x750581=getMustacheRender(_0x12c8e1[_0x3855('0x53')],_0x1f918d);var _0x25a581=JSON[_0x3855('0x5b')](_0x750581);_0x4b07f8[_0x3855('0x30')][_0x3855('0x5c')]=_0x25a581;}}catch(_0x5775ee){throw new db[(_0x3855('0x5d'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x4b07f8);}else{throw new db[(_0x3855('0x5d'))][(_0x3855('0x5e'))](_0x3855('0x5f'));}})[_0x3855('0x17')](function(_0x1cf80a){_0xa24c71=_0x1cf80a;if(_0xa24c71['id']){var _0x2c783e={'body':_0xa24c71[_0x3855('0x60')],'ChatWebsiteId':_0x12c8e1['id'],'ChatInteractionId':_0x9bb178['id'],'direction':'out','UserId':_0x316335['user']['id']};return db[_0x3855('0x61')]['create'](_0x2c783e,{});}else{throw new db[(_0x3855('0x5d'))][(_0x3855('0x5e'))](_0x3855('0x62'));}})['then'](function(){return _0x9bb178[_0x3855('0x63')]({'vidaooSessionId':_0xa24c71['id']});})[_0x3855('0x17')](respondWithResult(_0x356705,null))[_0x3855('0x21')](handleError(_0x356705,null));};exports['customUpdate']=function(_0x4cc54b,_0x60858f){if(_0x4cc54b[_0x3855('0x30')]['id']){delete _0x4cc54b[_0x3855('0x30')]['id'];}return db['ChatInteraction'][_0x3855('0x4a')]({'where':{'id':_0x4cc54b[_0x3855('0x3e')]['id']},'include':[{'model':db[_0x3855('0x64')],'as':_0x3855('0x65')}]})[_0x3855('0x17')](handleEntityNotFound(_0x60858f,null))[_0x3855('0x17')](saveUpdates(_0x4cc54b[_0x3855('0x30')],null))['then'](respondWithResult(_0x60858f,null))[_0x3855('0x21')](handleError(_0x60858f,null));};exports[_0x3855('0x66')]=function(_0x5c9b94,_0x2ecbd9){if(_0x5c9b94[_0x3855('0x30')]['id']){delete _0x5c9b94['body']['id'];}return db[_0x3855('0x35')][_0x3855('0x4a')]({'where':{'id':_0x5c9b94[_0x3855('0x3e')]['id']}})['then'](function(_0x3a6edc){if(!_0x3a6edc){logger[_0x3855('0x1c')](_0x3855('0x67'),_0x3855('0x66'),0x194,_0x3855('0x68'));_0x2ecbd9[_0x3855('0x69')](0x194);}else{if(_0x3a6edc[_0x3855('0x6a')]){throw new db['Sequelize'][(_0x3855('0x5e'))](_0x3855('0x6b'));}}return _0x3a6edc;})[_0x3855('0x17')](function(_0x31d24d){if(_0x31d24d){return _0x31d24d[_0x3855('0x2b')]({'closed':_0x5c9b94[_0x3855('0x30')][_0x3855('0x6c')],'disposition':_0x5c9b94[_0x3855('0x30')][_0x3855('0x6d')]})[_0x3855('0x17')](function(_0x37156a){return _0x37156a;});}})[_0x3855('0x17')](function(){return respondWithRpcPromise(_0x3855('0x6e'),_0x3855('0x66'),_0x5c9b94[_0x3855('0x30')],client9004);})[_0x3855('0x17')](respondWithResult(_0x2ecbd9,null))[_0x3855('0x21')](handleError(_0x2ecbd9,null));};exports[_0x3855('0x6f')]=function(_0x1397ef,_0x3cd5b5){_0x1397ef[_0x3855('0x30')]['name']=_0x1397ef[_0x3855('0x70')][_0x3855('0x71')];_0x1397ef[_0x3855('0x30')][_0x3855('0x72')]=_0x1397ef[_0x3855('0x70')]['filename'];_0x1397ef[_0x3855('0x30')][_0x3855('0x73')]=_0x1397ef[_0x3855('0x70')][_0x3855('0x74')];return db['Attachment'][_0x3855('0x49')](_0x1397ef[_0x3855('0x30')])['then'](respondWithResult(_0x3cd5b5,0xc9))[_0x3855('0x21')](handleError(_0x3cd5b5,null));};exports[_0x3855('0x75')]=function(_0xe9e434,_0x59fb1c){return db['ChatInteraction'][_0x3855('0x4d')]({'where':{'id':_0xe9e434['params']['id']},'raw':!![]})[_0x3855('0x17')](handleEntityNotFound(_0x59fb1c,null))[_0x3855('0x17')](function(_0xfe0318){if(_0xfe0318){if(_0xfe0318[_0x3855('0x6c')]){return _0x59fb1c[_0x3855('0x23')](0x193)[_0x3855('0x24')]({'status':0x193,'message':_0x3855('0x76')});}return db[_0x3855('0x77')]['findOne']({'where':{'id':_0xe9e434[_0x3855('0x3b')][_0x3855('0x78')]},'raw':!![]})['then'](handleEntityNotFound(_0x59fb1c,null));}})['then'](function(_0x23a26b){if(_0x23a26b){var _0x4e49ec=_0x23a26b[_0x3855('0x79')]!==null;var _0x11daca=path[_0x3855('0x7a')](config[_0x3855('0x7b')],_0x3855('0x7c'));if(_0x4e49ec){_0x11daca=path[_0x3855('0x7a')](_0x11daca,_0x3855('0x7d'));}var _0x1152b0=path[_0x3855('0x7a')](_0x11daca,_0x23a26b[_0x3855('0x72')]);return _0x59fb1c[_0x3855('0x7e')](_0x1152b0);}})[_0x3855('0x21')](handleError(_0x59fb1c,null));};exports[_0x3855('0x7f')]=function(_0x16a6a4,_0x3089df){var _0x316801=null;var _0x4550d2=null;var _0x4aac2f=null;if(_0x16a6a4[_0x3855('0x30')]['id']){delete _0x16a6a4['body']['id'];}if(_0x16a6a4[_0x3855('0x30')][_0x3855('0x80')]){_0x4aac2f=path[_0x3855('0x7a')](config[_0x3855('0x7b')],'server/files/chat/upload/',util[_0x3855('0x81')](_0x3855('0x82'),Date[_0x3855('0x83')]()));_0x16a6a4[_0x3855('0x30')][_0x3855('0x84')]=_0x4aac2f;}return db[_0x3855('0x35')][_0x3855('0x4a')]({'where':{'id':_0x16a6a4[_0x3855('0x3e')]['id']},'include':[{'model':db[_0x3855('0x61')],'as':_0x3855('0x85'),'include':[{'model':db[_0x3855('0x86')],'as':'User'}]}]})[_0x3855('0x17')](handleEntityNotFound(_0x3089df,null))[_0x3855('0x17')](saveUpdates(_0x16a6a4[_0x3855('0x30')],null))['then'](function(_0x562195){if(_0x562195){_0x316801=_0x562195;return db[_0x3855('0x4e')][_0x3855('0x4a')]({'where':{'id':_0x316801[_0x3855('0x4f')]}});}})['then'](function(_0x1a5da5){if(_0x1a5da5){_0x4550d2=_0x1a5da5;return db['CmContact'][_0x3855('0x4a')]({'where':{'id':_0x316801[_0x3855('0x87')]}});}})[_0x3855('0x17')](function(_0x401d67){if(_0x401d67){if(_0x4aac2f){var _0x2d990b=null;for(var _0x463bc9=0x1;_0x463bc9<_0x316801[_0x3855('0x85')][_0x3855('0x88')];++_0x463bc9){_0x2d990b=_0x316801[_0x3855('0x85')][_0x463bc9];var _0x360cd5=_0x2d990b['UserId']?util['format']('%s%d',_0x4550d2[_0x3855('0x89')],_0x2d990b[_0x3855('0x6a')]):_0x3855('0x8a');var _0x560f81=_0x16a6a4[_0x3855('0x30')][_0x3855('0x8b')]||util[_0x3855('0x81')](_0x3855('0x8c'),'Visitor',_0x2d990b[_0x3855('0x87')]);switch(_0x4550d2[_0x3855('0x8d')]){case _0x3855('0x8e'):_0x360cd5=_0x2d990b['UserId']?util[_0x3855('0x81')](_0x3855('0x8c'),_0x4550d2[_0x3855('0x89')],_0x2d990b[_0x3855('0x6a')]):_0x3855('0x8a');break;case'agent_alias':_0x360cd5=_0x2d990b['UserId']?_0x2d990b[_0x3855('0x86')][_0x3855('0x8f')]||_0x2d990b['User'][_0x3855('0x55')]:_0x3855('0x8a');break;case _0x3855('0x90'):_0x360cd5=_0x2d990b[_0x3855('0x6a')]?_0x2d990b[_0x3855('0x86')][_0x3855('0x55')]:_0x3855('0x8a');break;default:_0x360cd5=_0x2d990b[_0x3855('0x6a')]?util['format']('%s%d',_0x4550d2[_0x3855('0x89')],_0x2d990b[_0x3855('0x6a')]):_0x3855('0x8a');}var _0x163562=util[_0x3855('0x81')](_0x3855('0x91'),moment(_0x2d990b[_0x3855('0x92')])[_0x3855('0x81')](_0x3855('0x93')),_0x2d990b[_0x3855('0x94')]==='in'?_0x560f81:_0x360cd5,_0x2d990b[_0x3855('0x30')]);if(!_0x2d990b['secret']){fs['appendFileSync'](_0x4aac2f,_0x163562);}}return db[_0x3855('0x95')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x3855('0x96')],'as':_0x3855('0x97'),'raw':!![],'include':[{'model':db[_0x3855('0x98')],'as':_0x3855('0x98'),'raw':!![]}]}]});}}})[_0x3855('0x17')](function(_0x3a8fa2){if(!_0x3a8fa2||!_0x3a8fa2[_0x3855('0x97')]||!_0x16a6a4[_0x3855('0x30')])return _0x316801;var _0x2dd60e=_0x3a8fa2[_0x3855('0x99')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x2dd60e,'message':{'from':util[_0x3855('0x81')]('\x22%s\x22\x20<%s>',_0x3a8fa2[_0x3855('0x54')],_0x3a8fa2[_0x3855('0x56')]||_0x3a8fa2[_0x3855('0x97')][_0x3855('0x3c')]),'to':_0x16a6a4['body']['mailTranscript'],'subject':_0x3855('0x9a'),'text':util[_0x3855('0x81')](_0x3855('0x9b'),_0x16a6a4['body'][_0x3855('0x80')]),'attachments':[{'path':_0x4aac2f}]}})['then'](function(){return _0x316801;})['catch'](function(_0x12f258){logger[_0x3855('0x1c')](_0x12f258);});})[_0x3855('0x17')](respondWithStatusCode(_0x3089df,0xc8))[_0x3855('0x21')](handleError(_0x3089df,null));};exports[_0x3855('0x9c')]=function(_0x11b4c2,_0x22364e){return db[_0x3855('0x61')]['find']({'where':{'id':_0x11b4c2[_0x3855('0x3e')]['id']}})[_0x3855('0x17')](handleEntityNotFound(_0x22364e,null))['then'](function(_0x55b3dd){if(_0x55b3dd){return _0x55b3dd['addMessage'](_0x11b4c2[_0x3855('0x30')]['ids'],_[_0x3855('0x9d')](_0x11b4c2[_0x3855('0x30')],[_0x3855('0x9e'),'id'])||{});}})[_0x3855('0x17')](respondWithResult(_0x22364e,null))[_0x3855('0x21')](handleError(_0x22364e,null));};exports['getMessages']=function(_0x280fc8,_0x2da0af){var _0x145f6f={'raw':![],'where':{}};var _0x5e2538={};var _0x221709={'count':0x0,'rows':[]};return db[_0x3855('0x35')]['findOne']({'where':{'id':_0x280fc8[_0x3855('0x3e')]['id']}})[_0x3855('0x17')](handleEntityNotFound(_0x2da0af,null))[_0x3855('0x17')](function(_0x401a06){if(_0x401a06){_0x5e2538[_0x3855('0x3f')]=_['keys'](db['ChatMessage'][_0x3855('0x36')]);_0x5e2538[_0x3855('0x3b')]=_[_0x3855('0x40')](_0x280fc8[_0x3855('0x3b')]);_0x5e2538[_0x3855('0x41')]=_['intersection'](_0x5e2538[_0x3855('0x3f')],_0x5e2538[_0x3855('0x3b')]);_0x145f6f[_0x3855('0x44')]=_[_0x3855('0x42')](_0x5e2538[_0x3855('0x3f')],qs[_0x3855('0x43')](_0x280fc8['query'][_0x3855('0x43')]));_0x145f6f[_0x3855('0x44')]=_0x145f6f[_0x3855('0x44')][_0x3855('0x88')]?_0x145f6f['attributes']:_0x5e2538[_0x3855('0x3f')];if(!_0x280fc8[_0x3855('0x3b')][_0x3855('0x9f')](_0x3855('0xa0'))){_0x145f6f[_0x3855('0x27')]=qs[_0x3855('0x27')](_0x280fc8[_0x3855('0x3b')]['limit']);_0x145f6f[_0x3855('0x25')]=qs[_0x3855('0x25')](_0x280fc8[_0x3855('0x3b')][_0x3855('0x25')]);}_0x145f6f['order']=qs['sort'](_0x280fc8[_0x3855('0x3b')][_0x3855('0xa1')]);_0x145f6f[_0x3855('0xa2')]=qs[_0x3855('0x41')](_[_0x3855('0xa3')](_0x280fc8[_0x3855('0x3b')],_0x5e2538[_0x3855('0x41')]));_0x145f6f['where'][_0x3855('0xa4')]=_0x401a06['id'];if(_0x280fc8['query'][_0x3855('0xa5')]){_0x145f6f[_0x3855('0xa2')]=_[_0x3855('0x47')](_0x145f6f[_0x3855('0xa2')],{'$or':_[_0x3855('0x34')](_0x145f6f[_0x3855('0x44')],function(_0x19dca0){var _0x20bdc8={};_0x20bdc8[_0x19dca0]={'$like':'%'+_0x280fc8['query']['filter']+'%'};return _0x20bdc8;})});}if(_0x280fc8[_0x3855('0x3b')][_0x3855('0xa6')]){var _0x5e7c80=_0x280fc8[_0x3855('0x3b')][_0x3855('0xa6')][_0x3855('0xa7')](',');var _0x4d75b4={};_0x4d75b4[_0x5e7c80[0x0]]={'$gte':moment(_0x5e7c80[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x145f6f[_0x3855('0xa2')]=_[_0x3855('0x47')](_0x145f6f[_0x3855('0xa2')],_0x4d75b4);}_0x145f6f=_[_0x3855('0x47')]({},_0x145f6f,_0x280fc8[_0x3855('0x48')]);return db['ChatMessage']['count']({'where':_0x145f6f[_0x3855('0xa2')]})[_0x3855('0x17')](function(_0x48d76a){_0x221709['count']=_0x48d76a;if(_0x280fc8[_0x3855('0x3b')][_0x3855('0x45')]){_0x145f6f[_0x3855('0x46')]=[{'all':!![]}];}return db[_0x3855('0x61')][_0x3855('0xa8')](_0x145f6f);})[_0x3855('0x17')](function(_0x546d3c){_0x221709['rows']=_0x546d3c;return _0x221709;});}})[_0x3855('0x17')](respondWithFilteredResult(_0x2da0af,_0x145f6f))['catch'](handleError(_0x2da0af,null));};exports[_0x3855('0xa9')]=function(_0x2adb8c,_0x173f36){var _0x368c84={'where':{}},_0x5944f9={},_0x513d18={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3855('0x4d')]({'where':{'id':_0x2adb8c[_0x3855('0x3e')]['id']}})[_0x3855('0x17')](handleEntityNotFound(_0x173f36,null))['then'](function(_0x246b50){if(_0x246b50){_0x5944f9[_0x3855('0x3f')]=_['keys'](db['ChatMessage'][_0x3855('0x36')]);_0x5944f9['query']=_[_0x3855('0x40')](_0x2adb8c[_0x3855('0x3b')]);_0x5944f9[_0x3855('0x41')]=_[_0x3855('0x42')](_0x5944f9[_0x3855('0x3f')],_0x5944f9[_0x3855('0x3b')]);_0x368c84[_0x3855('0x44')]=_[_0x3855('0x42')](_0x5944f9[_0x3855('0x3f')],qs[_0x3855('0x43')](_0x2adb8c[_0x3855('0x3b')][_0x3855('0x43')]));_0x368c84[_0x3855('0x44')]=_0x368c84[_0x3855('0x44')]['length']?_0x368c84[_0x3855('0x44')]:_0x5944f9[_0x3855('0x3f')];if(!_0x2adb8c[_0x3855('0x3b')][_0x3855('0x9f')]('nolimit')){_0x368c84[_0x3855('0x27')]=qs[_0x3855('0x27')](_0x2adb8c[_0x3855('0x3b')][_0x3855('0x27')]);_0x368c84['offset']=qs[_0x3855('0x25')](_0x2adb8c[_0x3855('0x3b')]['offset']);}_0x368c84[_0x3855('0xaa')]=qs[_0x3855('0xa1')](_0x2adb8c[_0x3855('0x3b')][_0x3855('0xa1')]);_0x368c84[_0x3855('0xa2')]=qs[_0x3855('0x41')](_[_0x3855('0xa3')](_0x2adb8c['query'],_0x5944f9[_0x3855('0x41')]));_0x368c84['where'][_0x3855('0xa4')]=_0x246b50['id'];if(_0x2adb8c[_0x3855('0x3b')][_0x3855('0xa5')]){_0x368c84['where']=_[_0x3855('0x47')](_0x368c84[_0x3855('0xa2')],{'$or':_[_0x3855('0x34')](_0x368c84[_0x3855('0x44')],function(_0x1999c8){var _0x49d9f9={};_0x49d9f9[_0x1999c8]={'$like':'%'+_0x2adb8c['query']['filter']+'%'};return _0x49d9f9;})});}_0x368c84[_0x3855('0xa2')]['secret']=![];if(_0x2adb8c[_0x3855('0x3b')]['id']){_0x368c84[_0x3855('0xa2')]['id']={'$gt':_0x2adb8c[_0x3855('0x3b')]['id']};}_0x368c84=_[_0x3855('0x47')]({},_0x368c84,_0x2adb8c[_0x3855('0x48')]);return db[_0x3855('0x61')]['count']({'where':_0x368c84[_0x3855('0xa2')]})[_0x3855('0x17')](function(_0x2db773){_0x513d18[_0x3855('0x28')]=_0x2db773;_0x368c84['include']=[];if(_0x2adb8c[_0x3855('0x3b')][_0x3855('0xab')]){_0x368c84[_0x3855('0x46')]['push']({'model':db[_0x3855('0x86')],'as':_0x3855('0x86'),'attributes':['id',_0x3855('0x55'),_0x3855('0x8f')]});}if(_0x2adb8c['query'][_0x3855('0x45')]){_0x368c84[_0x3855('0x46')]=[{'all':!![]}];}return db[_0x3855('0x61')]['findAll'](_0x368c84);})['then'](function(_0x2c2a1a){_0x513d18[_0x3855('0xac')]=_0x2c2a1a;return _0x513d18;});}})[_0x3855('0x17')](respondWithFilteredResult(_0x173f36,_0x368c84))[_0x3855('0x21')](handleError(_0x173f36,null));};exports[_0x3855('0xad')]=function(_0x4c8e2d,_0xfcfe4d){return db['ChatInteraction'][_0x3855('0x4a')]({'where':{'id':_0x4c8e2d['params']['id']}})[_0x3855('0x17')](handleEntityNotFound(_0xfcfe4d,null))[_0x3855('0x17')](function(_0x39eba2){if(_0x39eba2){return _0x39eba2[_0x3855('0xae')](_0x4c8e2d['body']['ids'],_[_0x3855('0x9d')](_0x4c8e2d[_0x3855('0x30')],[_0x3855('0x9e'),'id'])||{})[_0x3855('0xaf')](function(){return db[_0x3855('0xb0')][_0x3855('0xa8')]({'attributes':['id',_0x3855('0x54'),_0x3855('0xb1')],'where':{'id':_0x4c8e2d[_0x3855('0x30')][_0x3855('0x9e')]}});})['then'](function(_0x5e0d74){socket[_0x3855('0xb2')](_0x3855('0xb3'),{'id':Number(_0x4c8e2d[_0x3855('0x3e')]['id']),'tags':_0x5e0d74||[]});return{'id':Number(_0x4c8e2d[_0x3855('0x3e')]['id']),'tags':_0x5e0d74||[]};});}})[_0x3855('0x17')](respondWithResult(_0xfcfe4d,null))[_0x3855('0x21')](handleError(_0xfcfe4d,null));};exports['removeTags']=function(_0x415ea2,_0x5235fe){return db[_0x3855('0x35')]['find']({'where':{'id':_0x415ea2[_0x3855('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5235fe,null))[_0x3855('0x17')](function(_0x48f216){if(_0x48f216){return _0x48f216[_0x3855('0xb4')](_0x415ea2[_0x3855('0x3b')][_0x3855('0x9e')]);}})[_0x3855('0x17')](respondWithStatusCode(_0x5235fe,null))[_0x3855('0x21')](handleError(_0x5235fe,null));};exports[_0x3855('0x7e')]=function(_0x1a9b20,_0xc52278){var _0x38ce3a=moment()[_0x3855('0xb5')]()['toString']();var _0x5c8151=path['join'](config[_0x3855('0x7b')],_0x3855('0xb6'),_0x3855('0xb7'),_0x3855('0xb8'));var _0x59f445=path[_0x3855('0x7a')](config[_0x3855('0x7b')],_0x3855('0xb6'),_0x3855('0xb7'),'attachments');var _0x3f2241=path[_0x3855('0x7a')](_0x5c8151,_0x38ce3a);var _0xa6bb95=util[_0x3855('0x81')](_0x3855('0xb9'),_0x1a9b20[_0x3855('0x3e')]['id'],_0x38ce3a);var _0x480bf7=path[_0x3855('0x7a')](_0x5c8151,_0xa6bb95);var _0x2b3f30=[];_0x2b3f30[_0x3855('0xba')]({'model':db[_0x3855('0x86')],'as':_0x3855('0x86'),'attributes':['id','fullname'],'raw':!![]});_0x2b3f30[_0x3855('0xba')]({'model':db[_0x3855('0x64')],'as':_0x3855('0x65'),'attributes':['id',_0x3855('0xbb'),_0x3855('0xbc')],'raw':!![]});if(_0x1a9b20[_0x3855('0x3b')][_0x3855('0xbd')]){_0x2b3f30[_0x3855('0xba')]({'model':db['Attachment'],'as':_0x3855('0x77'),'raw':!![]});}var _0x2c261f=[{'model':db[_0x3855('0x61')],'as':_0x3855('0x85'),'attributes':['id',_0x3855('0x30'),_0x3855('0x92'),_0x3855('0x94'),'secret',_0x3855('0xbe')],'include':_0x2b3f30}];_0x2c261f['push']({'model':db[_0x3855('0x4e')],'as':'Account','attributes':['id',_0x3855('0x54')]});_0x2c261f[_0x3855('0xba')]({'model':db[_0x3855('0x86')],'as':_0x3855('0xbf'),'attributes':['id',_0x3855('0x55')]});return db['ChatInteraction'][_0x3855('0x4a')]({'where':{'id':_0x1a9b20[_0x3855('0x3e')]['id']},'include':_0x2c261f})['then'](handleEntityNotFound(_0xc52278,null))[_0x3855('0x17')](function(_0x459d31){if(_0x459d31){var _0x26df70=_0x459d31[_0x3855('0xc0')]({'plain':!![]});fs[_0x3855('0xc1')](_0x3f2241);var _0xdc64e4={'channel':'Chat','account':_0x26df70['Account'][_0x3855('0x54')],'agent':_0x26df70['Owner']?_0x26df70[_0x3855('0xbf')]['fullname']:_0x3855('0xc2'),'createdAt':moment(_0x26df70[_0x3855('0x92')])[_0x3855('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3855('0xc3')](),'closedAt':_0x26df70[_0x3855('0x6c')]?moment(_0x26df70[_0x3855('0xc4')])[_0x3855('0x81')](_0x3855('0xc5'))[_0x3855('0xc3')]():'','disposition':_0x26df70['disposition'],'chatInfo':{'browser':_0x26df70['browserName'],'os':_0x26df70[_0x3855('0xc6')],'referer':_0x26df70[_0x3855('0xc7')],'customerIp':_0x26df70[_0x3855('0xc8')],'customerPort':_0x26df70[_0x3855('0xc9')]?_0x26df70[_0x3855('0xc9')]:_0x3855('0xc2')},'messages':_(_0x26df70[_0x3855('0x85')])[_0x3855('0xca')]()[_0x3855('0xa5')]({'secret':![]})['map'](function(_0x381f34){if(_0x381f34[_0x3855('0x77')]){var _0x3afb95=path['join'](_0x59f445,_0x381f34[_0x3855('0x77')][_0x3855('0x72')]);if(fs[_0x3855('0xcb')](_0x3afb95)){fs['createReadStream'](_0x3afb95)['pipe'](fs['createWriteStream'](path['join'](_0x3f2241,_0x381f34['Attachment'][_0x3855('0x72')])));}}return{'date':moment(_0x381f34[_0x3855('0x92')])[_0x3855('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3855('0xc3')](),'sender':_0x381f34['direction']===_0x3855('0xcc')?_0x381f34[_0x3855('0x86')]?_0x381f34['User']['fullname']:_0x3855('0x8a'):_0x381f34[_0x3855('0x65')][_0x3855('0xbb')]+(_0x381f34[_0x3855('0x65')][_0x3855('0xbc')]?'\x20'+_0x381f34['Contact'][_0x3855('0xbc')]:''),'body':_0x381f34[_0x3855('0x77')]?_0x381f34[_0x3855('0x77')][_0x3855('0x72')]:_0x381f34[_0x3855('0x30')],'direction':_0x381f34[_0x3855('0x94')]===_0x3855('0xcc')?'A':'C','secret':_0x381f34[_0x3855('0xcd')],'read':_0x381f34['read'],'attachment':_0x381f34[_0x3855('0x77')]};})['value']()};return ejs[_0x3855('0xce')](path['join'](config[_0x3855('0x7b')],_0x3855('0xb6'),_0x3855('0xcf'),_0x3855('0xd0')),{'interaction':_0xdc64e4})['then'](function(_0x532f9a){var _0x43a611=path[_0x3855('0x7a')](_0x3f2241,'transcript-'+_0x26df70['id']+'-'+_0x38ce3a+_0x3855('0xd1'));var _0x10bd9c={'path':_0x43a611,'channel':_0x3855('0xd2'),'interactionId':_0x26df70['id']};return pdf[_0x3855('0xd3')](_0x532f9a,_0x10bd9c);})[_0x3855('0x17')](function(){return new Promise(function(_0x514893,_0x9f9bc6){zipdir(_0x3f2241,{'saveTo':_0x480bf7},function(_0x3dd95a,_0x2b929c){if(_0x3dd95a)return _0x9f9bc6(_0x3dd95a);return _0x514893(_0x2b929c);});})[_0x3855('0x17')](function(){return new BPromise(function(_0x46d934,_0x507295){rimraf(_0x3f2241,function(_0x3b9fa4){if(_0x3b9fa4)_0x507295(_0x3b9fa4);return _0x46d934();});});})[_0x3855('0x17')](function(){return _0xc52278[_0x3855('0x7e')](_0x480bf7,_0xa6bb95,function(_0x1f4cb7){if(_0x1f4cb7){logger[_0x3855('0x1c')](_0x3855('0xd4'),_0x1f4cb7);}else{fs[_0x3855('0xd5')](_0x480bf7);}});});});}else{return _0xc52278[_0x3855('0x69')](0xc8);}})[_0x3855('0x21')](handleError(_0xc52278,null));}; \ No newline at end of file +var _0xf064=['register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','stack','name','send','render','merge','body','contact','account','ChatInteraction','rawAttributes','type','findAll','chat','user','show','params','query','keys','intersection','model','fields','attributes','include','find','catch','create','update','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','Attachment','Unauthorized','attachId','join','server/files/attachments/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsiteId','ContactId','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','System','agent_alias','User','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','hasOwnProperty','nolimit','sort','where','ChatInteractionId','map','$gte','split','options','rows','getMyMessages','filters','length','pick','filter','secret','includeAgent','push','includeAll','addTags','setTags','spread','Tag','color','emit','removeTags','unix','toString','server','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x346149,_0x38a525){var _0xc2e79d=function(_0x757e0e){while(--_0x757e0e){_0x346149['push'](_0x346149['shift']());}};_0xc2e79d(++_0x38a525);}(_0xf064,0x193));var _0x4f06=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xf064[_0x492535];return _0x256620;};'use strict';var rimraf=require(_0x4f06('0x0'));var zipdir=require(_0x4f06('0x1'));var rp=require(_0x4f06('0x2'));var moment=require(_0x4f06('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4f06('0x4'));var util=require('util');var path=require(_0x4f06('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f06('0x6'));var Redis=require(_0x4f06('0x7'));var interaction=require(_0x4f06('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x4f06('0x9'));var logger=require(_0x4f06('0xa'))(_0x4f06('0xb'));var config=require(_0x4f06('0xc'));var db=require(_0x4f06('0xd'))['db'];config[_0x4f06('0xe')]=_[_0x4f06('0xf')](config['redis'],{'host':_0x4f06('0x10'),'port':0x18eb});var socket=require(_0x4f06('0x11'))(new Redis(config[_0x4f06('0xe')]));require(_0x4f06('0x12'))[_0x4f06('0x13')](socket);var jayson=require(_0x4f06('0x14'));var client=jayson[_0x4f06('0x15')]['http']({'port':0x232b});var client9004=jayson[_0x4f06('0x15')][_0x4f06('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x3c8d38,_0x407f1c,_0x3628aa,_0x5ddf27){return new BPromise(function(_0x2472a7,_0x30b230){var _0x381c7e=_0x5ddf27||client;return _0x381c7e[_0x4f06('0x17')](_0x3c8d38,_0x3628aa)[_0x4f06('0x18')](function(_0x237924){logger[_0x4f06('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x407f1c,_0x4f06('0x1a'));logger[_0x4f06('0x1b')](_0x4f06('0x1c'),_0x407f1c,_0x4f06('0x1a'),JSON[_0x4f06('0x1d')](_0x237924));if(_0x237924[_0x4f06('0x1e')]){if(_0x237924[_0x4f06('0x1e')][_0x4f06('0x1f')]===0x1f4){logger[_0x4f06('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x407f1c,_0x237924['error'][_0x4f06('0x20')]);return _0x30b230(_0x237924[_0x4f06('0x1e')][_0x4f06('0x20')]);}logger['error'](_0x4f06('0x21'),_0x407f1c,_0x237924[_0x4f06('0x1e')][_0x4f06('0x20')]);return _0x2472a7(_0x237924[_0x4f06('0x1e')][_0x4f06('0x20')]);}else{logger[_0x4f06('0x19')](_0x4f06('0x21'),_0x407f1c,_0x4f06('0x1a'));_0x2472a7(_0x237924[_0x4f06('0x22')][_0x4f06('0x20')]);}})['catch'](function(_0x1c3cce){logger[_0x4f06('0x1e')](_0x4f06('0x21'),_0x407f1c,_0x1c3cce);_0x30b230(_0x1c3cce);});});}function respondWithStatusCode(_0x53d146,_0x37fb71){_0x37fb71=_0x37fb71||0xcc;return function(_0x2a96f6){if(_0x2a96f6){return _0x53d146[_0x4f06('0x23')](_0x37fb71);}return _0x53d146['status'](_0x37fb71)[_0x4f06('0x24')]();};}function respondWithResult(_0x29f8c2,_0x6951f0){_0x6951f0=_0x6951f0||0xc8;return function(_0x3310cd){if(_0x3310cd){return _0x29f8c2[_0x4f06('0x25')](_0x6951f0)[_0x4f06('0x26')](_0x3310cd);}};}function respondWithFilteredResult(_0x207f46,_0x342742){return function(_0x56642a){if(_0x56642a){var _0x5741f3=typeof _0x342742['offset']==='undefined'&&typeof _0x342742[_0x4f06('0x27')]===_0x4f06('0x28');var _0x5620dd=_0x56642a[_0x4f06('0x29')];var _0x9adce4=_0x5741f3?0x0:_0x342742[_0x4f06('0x2a')];var _0x122083=_0x5741f3?_0x56642a[_0x4f06('0x29')]:_0x342742[_0x4f06('0x2a')]+_0x342742[_0x4f06('0x27')];var _0x429657;if(_0x122083>=_0x5620dd){_0x122083=_0x5620dd;_0x429657=0xc8;}else{_0x429657=0xce;}_0x207f46[_0x4f06('0x25')](_0x429657);return _0x207f46[_0x4f06('0x2b')](_0x4f06('0x2c'),_0x9adce4+'-'+_0x122083+'/'+_0x5620dd)['json'](_0x56642a);}return null;};}function saveUpdates(_0x5ce1c1){return function(_0x279e3f){if(_0x279e3f){return _0x279e3f['update'](_0x5ce1c1)[_0x4f06('0x18')](function(_0x2069cb){return _0x2069cb;});}return null;};}function removeEntity(_0x5e11b8){return function(_0x5ea30d){if(_0x5ea30d){return _0x5ea30d['destroy']()[_0x4f06('0x18')](function(){_0x5e11b8[_0x4f06('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x294245){return function(_0x4affb6){if(!_0x4affb6){_0x294245[_0x4f06('0x23')](0x194);}return _0x4affb6;};}function handleError(_0x4a5fcd,_0x43a6d6){_0x43a6d6=_0x43a6d6||0x1f4;return function(_0x86faac){logger['error'](_0x86faac[_0x4f06('0x2d')]);if(_0x86faac[_0x4f06('0x2e')]){delete _0x86faac[_0x4f06('0x2e')];}_0x4a5fcd[_0x4f06('0x25')](_0x43a6d6)[_0x4f06('0x2f')](_0x86faac);};}function getMustacheRender(_0x1ded17,_0x1a1249){return Mustache[_0x4f06('0x30')](_0x1ded17,_[_0x4f06('0x31')](_0x1a1249[_0x4f06('0x32')],{'contact':_0x1a1249[_0x4f06('0x33')],'message':_0x1a1249[_0x4f06('0x20')],'agent':_0x1a1249['agent'],'interaction':_0x1a1249['interaction'],'account':_0x1a1249[_0x4f06('0x34')]}))||'';}exports['index']=function(_0xb40b73,_0xfd5417){var _0x161669={};var _0x2c66b4=_['map'](db[_0x4f06('0x35')][_0x4f06('0x36')],function(_0x42e2b8){return{'name':_0x42e2b8['fieldName'],'type':_0x42e2b8[_0x4f06('0x37')]['key']};});_0x161669=qs['getOptions'](_0x2c66b4,_0xb40b73);return interaction[_0x4f06('0x38')](_0x4f06('0x39'),_0xb40b73['query'],_0xb40b73[_0x4f06('0x3a')],_0x161669,_0x2c66b4)[_0x4f06('0x18')](respondWithFilteredResult(_0xfd5417,_0x161669))['catch'](handleError(_0xfd5417,null));};exports[_0x4f06('0x3b')]=function(_0x1bd786,_0x5af8e6){var _0x16ca31={'raw':![],'where':{'id':_0x1bd786[_0x4f06('0x3c')]['id']}},_0x4cf163={};_0x4cf163['model']=_['keys'](db[_0x4f06('0x35')][_0x4f06('0x36')]);_0x4cf163[_0x4f06('0x3d')]=_[_0x4f06('0x3e')](_0x1bd786[_0x4f06('0x3d')]);_0x4cf163['filters']=_[_0x4f06('0x3f')](_0x4cf163[_0x4f06('0x40')],_0x4cf163[_0x4f06('0x3d')]);_0x16ca31['attributes']=_[_0x4f06('0x3f')](_0x4cf163[_0x4f06('0x40')],qs[_0x4f06('0x41')](_0x1bd786[_0x4f06('0x3d')]['fields']));_0x16ca31['attributes']=_0x16ca31['attributes']['length']?_0x16ca31[_0x4f06('0x42')]:_0x4cf163['model'];if(_0x1bd786[_0x4f06('0x3d')]['includeAll']){_0x16ca31[_0x4f06('0x43')]=[{'all':!![]}];}_0x16ca31=_['merge']({},_0x16ca31,_0x1bd786['options']);return db['ChatInteraction'][_0x4f06('0x44')](_0x16ca31)[_0x4f06('0x18')](handleEntityNotFound(_0x5af8e6,null))['then'](respondWithResult(_0x5af8e6,null))[_0x4f06('0x45')](handleError(_0x5af8e6,null));};exports[_0x4f06('0x46')]=function(_0x3ad316,_0x5e68bd){return db[_0x4f06('0x35')][_0x4f06('0x46')](_0x3ad316[_0x4f06('0x32')],{})[_0x4f06('0x18')](respondWithResult(_0x5e68bd,0xc9))['catch'](handleError(_0x5e68bd,null));};exports[_0x4f06('0x47')]=function(_0x582eb6,_0x3e1987){if(_0x582eb6[_0x4f06('0x32')]['id']){delete _0x582eb6[_0x4f06('0x32')]['id'];}return db[_0x4f06('0x35')][_0x4f06('0x44')]({'where':{'id':_0x582eb6[_0x4f06('0x3c')]['id']}})[_0x4f06('0x18')](handleEntityNotFound(_0x3e1987,null))[_0x4f06('0x18')](saveUpdates(_0x582eb6[_0x4f06('0x32')],null))[_0x4f06('0x18')](respondWithResult(_0x3e1987,null))['catch'](handleError(_0x3e1987,null));};exports[_0x4f06('0x48')]=function(_0x11dca7,_0x58a8ed){return db[_0x4f06('0x35')]['find']({'where':{'id':_0x11dca7[_0x4f06('0x3c')]['id']}})[_0x4f06('0x18')](handleEntityNotFound(_0x58a8ed,null))[_0x4f06('0x18')](removeEntity(_0x58a8ed,null))[_0x4f06('0x45')](handleError(_0x58a8ed,null));};exports[_0x4f06('0x49')]=function(_0x39a8e7,_0x48efd5){return db[_0x4f06('0x35')][_0x4f06('0x49')]()[_0x4f06('0x18')](respondWithResult(_0x48efd5,null))[_0x4f06('0x45')](handleError(_0x48efd5,null));};exports[_0x4f06('0x4a')]=function(_0x4b492e,_0x31c75c){var _0x33179a=_0x4b492e['params']['id'];var _0x310e34;var _0x273b5a;var _0x3c790c;return db[_0x4f06('0x35')][_0x4f06('0x4b')]({'where':{'id':_0x33179a}})[_0x4f06('0x18')](function(_0x11dea3){_0x310e34=_0x11dea3;return db[_0x4f06('0x4c')][_0x4f06('0x4b')]({'where':{'id':_0x11dea3['ChatWebsiteId']},'attributes':['id',_0x4f06('0x4d'),_0x4f06('0x4e'),'vidaooTopic',_0x4f06('0x4f'),_0x4f06('0x50')],'raw':!![]});})['then'](function(_0x56a13c){if(_0x56a13c&&_0x56a13c[_0x4f06('0x4d')]&&_0x56a13c[_0x4f06('0x4e')]){_0x273b5a=_0x56a13c;var _0x558cc6={'interaction':{'id':_0x33179a},'agent':{'id':_0x4b492e[_0x4f06('0x3a')]['id'],'name':_0x4b492e['user']['name'],'fullname':_0x4b492e['user'][_0x4f06('0x51')],'email':_0x4b492e['user'][_0x4f06('0x52')]},'contact':_0x4b492e['body'][_0x4f06('0x33')],'account':_0x4b492e[_0x4f06('0x32')][_0x4f06('0x34')]};var _0x3d2063={'rejectUnauthorized':![],'method':_0x4f06('0x53'),'url':_0x4f06('0x54'),'headers':{'X-APIKEY':_0x56a13c[_0x4f06('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4b492e[_0x4f06('0x3a')][_0x4f06('0x52')]],'buttons':null,'topic':_0x273b5a[_0x4f06('0x55')],'note':_[_0x4f06('0x56')](_0x273b5a[_0x4f06('0x4f')])?null:getMustacheRender(_0x273b5a[_0x4f06('0x4f')],_0x558cc6),'metadata':null},'redirect':_0x4f06('0x57'),'json':!![]};try{if(!_[_0x4f06('0x56')](_0x273b5a[_0x4f06('0x50')])){var _0x4a316a=getMustacheRender(_0x273b5a['vidaooMetadata'],_0x558cc6);var _0x3156dd=JSON['parse'](_0x4a316a);_0x3d2063['body']['metadata']=_0x3156dd;}}catch(_0x12cb2a){throw new db[(_0x4f06('0x58'))][(_0x4f06('0x59'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x3d2063);}else{throw new db[(_0x4f06('0x58'))][(_0x4f06('0x59'))](_0x4f06('0x5a'));}})[_0x4f06('0x18')](function(_0x6a08a1){_0x3c790c=_0x6a08a1;if(_0x3c790c['id']){var _0x2da217={'body':_0x3c790c[_0x4f06('0x5b')],'ChatWebsiteId':_0x273b5a['id'],'ChatInteractionId':_0x310e34['id'],'direction':_0x4f06('0x5c'),'UserId':_0x4b492e[_0x4f06('0x3a')]['id']};return db[_0x4f06('0x5d')][_0x4f06('0x46')](_0x2da217,{});}else{throw new db[(_0x4f06('0x58'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x4f06('0x18')](function(){return _0x310e34['updateAttributes']({'vidaooSessionId':_0x3c790c['id']});})[_0x4f06('0x18')](respondWithResult(_0x31c75c,null))[_0x4f06('0x45')](handleError(_0x31c75c,null));};exports[_0x4f06('0x5e')]=function(_0x5db13f,_0x3ace76){if(_0x5db13f[_0x4f06('0x32')]['id']){delete _0x5db13f[_0x4f06('0x32')]['id'];}return db[_0x4f06('0x35')][_0x4f06('0x44')]({'where':{'id':_0x5db13f[_0x4f06('0x3c')]['id']},'include':[{'model':db[_0x4f06('0x5f')],'as':_0x4f06('0x60')}]})[_0x4f06('0x18')](handleEntityNotFound(_0x3ace76,null))['then'](saveUpdates(_0x5db13f[_0x4f06('0x32')],null))[_0x4f06('0x18')](respondWithResult(_0x3ace76,null))[_0x4f06('0x45')](handleError(_0x3ace76,null));};exports[_0x4f06('0x61')]=function(_0x29c64b,_0x16df28){if(_0x29c64b[_0x4f06('0x32')]['id']){delete _0x29c64b['body']['id'];}return db[_0x4f06('0x35')][_0x4f06('0x44')]({'where':{'id':_0x29c64b[_0x4f06('0x3c')]['id']}})[_0x4f06('0x18')](function(_0x135d04){if(!_0x135d04){logger[_0x4f06('0x1e')](_0x4f06('0x62'),_0x4f06('0x61'),0x194,_0x4f06('0x63'));_0x16df28[_0x4f06('0x23')](0x194);}else{if(_0x135d04[_0x4f06('0x64')]){throw new db[(_0x4f06('0x58'))][(_0x4f06('0x59'))](_0x4f06('0x65'));}}return _0x135d04;})[_0x4f06('0x18')](function(_0x4c028d){if(_0x4c028d){return _0x4c028d['update']({'closed':_0x29c64b[_0x4f06('0x32')][_0x4f06('0x66')],'disposition':_0x29c64b[_0x4f06('0x32')][_0x4f06('0x67')]})['then'](function(_0x56dd87){return _0x56dd87;});}})[_0x4f06('0x18')](function(){return respondWithRpcPromise(_0x4f06('0x68'),_0x4f06('0x61'),_0x29c64b[_0x4f06('0x32')],client9004);})[_0x4f06('0x18')](respondWithResult(_0x16df28,null))[_0x4f06('0x45')](handleError(_0x16df28,null));};exports[_0x4f06('0x69')]=function(_0x53d82e,_0x326d9f){_0x53d82e['body'][_0x4f06('0x2e')]=_0x53d82e[_0x4f06('0x6a')][_0x4f06('0x6b')];_0x53d82e[_0x4f06('0x32')][_0x4f06('0x6c')]=_0x53d82e[_0x4f06('0x6a')]['filename'];_0x53d82e[_0x4f06('0x32')]['type']=_0x53d82e[_0x4f06('0x6a')][_0x4f06('0x6d')];return db[_0x4f06('0x6e')][_0x4f06('0x46')](_0x53d82e[_0x4f06('0x32')])[_0x4f06('0x18')](respondWithResult(_0x326d9f,0xc9))[_0x4f06('0x45')](handleError(_0x326d9f,null));};exports['attachmentDownload']=function(_0x14093b,_0x2b6452){return db[_0x4f06('0x35')]['findOne']({'where':{'id':_0x14093b['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2b6452,null))[_0x4f06('0x18')](function(_0x5a8ed2){if(_0x5a8ed2){if(_0x5a8ed2[_0x4f06('0x66')]){return _0x2b6452['status'](0x193)[_0x4f06('0x26')]({'status':0x193,'message':_0x4f06('0x6f')});}return db['Attachment'][_0x4f06('0x4b')]({'where':{'id':_0x14093b[_0x4f06('0x3d')][_0x4f06('0x70')]},'raw':!![]})[_0x4f06('0x18')](handleEntityNotFound(_0x2b6452,null));}})['then'](function(_0x5d250f){if(_0x5d250f){var _0x3afa41=_0x5d250f['ChatOfflineMessageId']!==null;var _0x5237e3=path[_0x4f06('0x71')](config['root'],_0x4f06('0x72'));if(_0x3afa41){_0x5237e3=path['join'](_0x5237e3,'offline-chat/');}var _0x4410dc=path[_0x4f06('0x71')](_0x5237e3,_0x5d250f[_0x4f06('0x6c')]);return _0x2b6452[_0x4f06('0x73')](_0x4410dc);}})[_0x4f06('0x45')](handleError(_0x2b6452,null));};exports[_0x4f06('0x74')]=function(_0x49be77,_0x3676d3){var _0x309ac2=null;var _0x158963=null;var _0x46fc4e=null;if(_0x49be77[_0x4f06('0x32')]['id']){delete _0x49be77['body']['id'];}if(_0x49be77[_0x4f06('0x32')][_0x4f06('0x75')]){_0x46fc4e=path[_0x4f06('0x71')](config[_0x4f06('0x76')],_0x4f06('0x77'),util[_0x4f06('0x78')](_0x4f06('0x79'),Date[_0x4f06('0x7a')]()));_0x49be77[_0x4f06('0x32')][_0x4f06('0x7b')]=_0x46fc4e;}return db[_0x4f06('0x35')][_0x4f06('0x44')]({'where':{'id':_0x49be77[_0x4f06('0x3c')]['id']},'include':[{'model':db[_0x4f06('0x5d')],'as':_0x4f06('0x7c'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x3676d3,null))[_0x4f06('0x18')](saveUpdates(_0x49be77[_0x4f06('0x32')],null))[_0x4f06('0x18')](function(_0x59cedb){if(_0x59cedb){_0x309ac2=_0x59cedb;return db[_0x4f06('0x4c')][_0x4f06('0x44')]({'where':{'id':_0x309ac2[_0x4f06('0x7d')]}});}})[_0x4f06('0x18')](function(_0x2e3978){if(_0x2e3978){_0x158963=_0x2e3978;return db['CmContact'][_0x4f06('0x44')]({'where':{'id':_0x309ac2[_0x4f06('0x7e')]}});}})[_0x4f06('0x18')](function(_0x4d208b){if(_0x4d208b){if(_0x46fc4e){var _0x4c924b=null;for(var _0x3056c7=0x1;_0x3056c7<_0x309ac2['Messages']['length'];++_0x3056c7){_0x4c924b=_0x309ac2[_0x4f06('0x7c')][_0x3056c7];var _0x5e8538=_0x4c924b[_0x4f06('0x64')]?util['format']('%s%d',_0x158963[_0x4f06('0x7f')],_0x4c924b[_0x4f06('0x64')]):'System';var _0x42bc88=_0x49be77[_0x4f06('0x32')][_0x4f06('0x80')]||util[_0x4f06('0x78')](_0x4f06('0x81'),_0x4f06('0x82'),_0x4c924b[_0x4f06('0x7e')]);switch(_0x158963[_0x4f06('0x83')]){case _0x4f06('0x84'):_0x5e8538=_0x4c924b[_0x4f06('0x64')]?util[_0x4f06('0x78')](_0x4f06('0x81'),_0x158963['agentAlias'],_0x4c924b[_0x4f06('0x64')]):_0x4f06('0x85');break;case _0x4f06('0x86'):_0x5e8538=_0x4c924b[_0x4f06('0x64')]?_0x4c924b[_0x4f06('0x87')][_0x4f06('0x88')]||_0x4c924b['User'][_0x4f06('0x51')]:_0x4f06('0x85');break;case'agent_fullname':_0x5e8538=_0x4c924b[_0x4f06('0x64')]?_0x4c924b['User']['fullname']:'System';break;default:_0x5e8538=_0x4c924b['UserId']?util[_0x4f06('0x78')](_0x4f06('0x81'),_0x158963[_0x4f06('0x7f')],_0x4c924b[_0x4f06('0x64')]):_0x4f06('0x85');}var _0x39c1ea=util[_0x4f06('0x78')](_0x4f06('0x89'),moment(_0x4c924b[_0x4f06('0x8a')])[_0x4f06('0x78')](_0x4f06('0x8b')),_0x4c924b[_0x4f06('0x8c')]==='in'?_0x42bc88:_0x5e8538,_0x4c924b[_0x4f06('0x32')]);if(!_0x4c924b['secret']){fs[_0x4f06('0x8d')](_0x46fc4e,_0x39c1ea);}}return db[_0x4f06('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4f06('0x8f'),'raw':!![],'include':[{'model':db[_0x4f06('0x90')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x4f0dd0){if(!_0x4f0dd0||!_0x4f0dd0[_0x4f06('0x8f')]||!_0x49be77[_0x4f06('0x32')])return _0x309ac2;var _0x44d48b=_0x4f0dd0[_0x4f06('0x91')]();return respondWithRpcPromise(_0x4f06('0x92'),_0x4f06('0x93'),{'account':_0x44d48b,'message':{'from':util[_0x4f06('0x78')](_0x4f06('0x94'),_0x4f0dd0['name'],_0x4f0dd0['email']||_0x4f0dd0[_0x4f06('0x8f')][_0x4f06('0x3a')]),'to':_0x49be77['body'][_0x4f06('0x75')],'subject':_0x4f06('0x95'),'text':util[_0x4f06('0x78')](_0x4f06('0x96'),_0x49be77[_0x4f06('0x32')][_0x4f06('0x75')]),'attachments':[{'path':_0x46fc4e}]}})[_0x4f06('0x18')](function(){return _0x309ac2;})[_0x4f06('0x45')](function(_0x58bfe9){logger[_0x4f06('0x1e')](_0x58bfe9);});})[_0x4f06('0x18')](respondWithStatusCode(_0x3676d3,0xc8))[_0x4f06('0x45')](handleError(_0x3676d3,null));};exports['addMessage']=function(_0x392ab8,_0x3c1623){return db[_0x4f06('0x5d')][_0x4f06('0x44')]({'where':{'id':_0x392ab8[_0x4f06('0x3c')]['id']}})[_0x4f06('0x18')](handleEntityNotFound(_0x3c1623,null))['then'](function(_0x4cb3be){if(_0x4cb3be){return _0x4cb3be['addMessage'](_0x392ab8[_0x4f06('0x32')][_0x4f06('0x97')],_[_0x4f06('0x98')](_0x392ab8[_0x4f06('0x32')],['ids','id'])||{});}})[_0x4f06('0x18')](respondWithResult(_0x3c1623,null))[_0x4f06('0x45')](handleError(_0x3c1623,null));};exports['getMessages']=function(_0xdd7c53,_0x4660e5){var _0x5e0416={'raw':![],'where':{}};var _0x3166bd={};var _0x292094={'count':0x0,'rows':[]};return db[_0x4f06('0x35')]['findOne']({'where':{'id':_0xdd7c53['params']['id']}})[_0x4f06('0x18')](handleEntityNotFound(_0x4660e5,null))[_0x4f06('0x18')](function(_0x204207){if(_0x204207){_0x3166bd['model']=_['keys'](db[_0x4f06('0x5d')][_0x4f06('0x36')]);_0x3166bd['query']=_[_0x4f06('0x3e')](_0xdd7c53['query']);_0x3166bd['filters']=_[_0x4f06('0x3f')](_0x3166bd[_0x4f06('0x40')],_0x3166bd[_0x4f06('0x3d')]);_0x5e0416[_0x4f06('0x42')]=_[_0x4f06('0x3f')](_0x3166bd['model'],qs[_0x4f06('0x41')](_0xdd7c53[_0x4f06('0x3d')]['fields']));_0x5e0416[_0x4f06('0x42')]=_0x5e0416[_0x4f06('0x42')]['length']?_0x5e0416[_0x4f06('0x42')]:_0x3166bd[_0x4f06('0x40')];if(!_0xdd7c53[_0x4f06('0x3d')][_0x4f06('0x99')](_0x4f06('0x9a'))){_0x5e0416[_0x4f06('0x27')]=qs[_0x4f06('0x27')](_0xdd7c53[_0x4f06('0x3d')][_0x4f06('0x27')]);_0x5e0416[_0x4f06('0x2a')]=qs[_0x4f06('0x2a')](_0xdd7c53[_0x4f06('0x3d')][_0x4f06('0x2a')]);}_0x5e0416['order']=qs[_0x4f06('0x9b')](_0xdd7c53[_0x4f06('0x3d')][_0x4f06('0x9b')]);_0x5e0416[_0x4f06('0x9c')]=qs['filters'](_['pick'](_0xdd7c53[_0x4f06('0x3d')],_0x3166bd['filters']));_0x5e0416[_0x4f06('0x9c')][_0x4f06('0x9d')]=_0x204207['id'];if(_0xdd7c53['query']['filter']){_0x5e0416[_0x4f06('0x9c')]=_['merge'](_0x5e0416[_0x4f06('0x9c')],{'$or':_[_0x4f06('0x9e')](_0x5e0416[_0x4f06('0x42')],function(_0x9a8ce7){var _0x181219={};_0x181219[_0x9a8ce7]={'$like':'%'+_0xdd7c53[_0x4f06('0x3d')]['filter']+'%'};return _0x181219;})});}if(_0xdd7c53[_0x4f06('0x3d')][_0x4f06('0x9f')]){var _0x30729c=_0xdd7c53[_0x4f06('0x3d')][_0x4f06('0x9f')][_0x4f06('0xa0')](',');var _0x17f31b={};_0x17f31b[_0x30729c[0x0]]={'$gte':moment(_0x30729c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5e0416['where']=_[_0x4f06('0x31')](_0x5e0416[_0x4f06('0x9c')],_0x17f31b);}_0x5e0416=_[_0x4f06('0x31')]({},_0x5e0416,_0xdd7c53[_0x4f06('0xa1')]);return db[_0x4f06('0x5d')]['count']({'where':_0x5e0416[_0x4f06('0x9c')]})[_0x4f06('0x18')](function(_0x4c17b9){_0x292094[_0x4f06('0x29')]=_0x4c17b9;if(_0xdd7c53[_0x4f06('0x3d')]['includeAll']){_0x5e0416['include']=[{'all':!![]}];}return db[_0x4f06('0x5d')]['findAll'](_0x5e0416);})[_0x4f06('0x18')](function(_0x194e8c){_0x292094[_0x4f06('0xa2')]=_0x194e8c;return _0x292094;});}})[_0x4f06('0x18')](respondWithFilteredResult(_0x4660e5,_0x5e0416))[_0x4f06('0x45')](handleError(_0x4660e5,null));};exports[_0x4f06('0xa3')]=function(_0x5d4037,_0x34dbbc){var _0x29d1dd={'where':{}},_0x2f58fd={},_0xcdd8fc={'count':0x0,'rows':[]};return db[_0x4f06('0x35')][_0x4f06('0x4b')]({'where':{'id':_0x5d4037[_0x4f06('0x3c')]['id']}})[_0x4f06('0x18')](handleEntityNotFound(_0x34dbbc,null))['then'](function(_0x27e8b9){if(_0x27e8b9){_0x2f58fd[_0x4f06('0x40')]=_[_0x4f06('0x3e')](db['ChatMessage'][_0x4f06('0x36')]);_0x2f58fd['query']=_[_0x4f06('0x3e')](_0x5d4037['query']);_0x2f58fd[_0x4f06('0xa4')]=_[_0x4f06('0x3f')](_0x2f58fd[_0x4f06('0x40')],_0x2f58fd['query']);_0x29d1dd['attributes']=_[_0x4f06('0x3f')](_0x2f58fd[_0x4f06('0x40')],qs[_0x4f06('0x41')](_0x5d4037[_0x4f06('0x3d')]['fields']));_0x29d1dd['attributes']=_0x29d1dd['attributes'][_0x4f06('0xa5')]?_0x29d1dd[_0x4f06('0x42')]:_0x2f58fd[_0x4f06('0x40')];if(!_0x5d4037[_0x4f06('0x3d')][_0x4f06('0x99')](_0x4f06('0x9a'))){_0x29d1dd[_0x4f06('0x27')]=qs[_0x4f06('0x27')](_0x5d4037[_0x4f06('0x3d')][_0x4f06('0x27')]);_0x29d1dd['offset']=qs[_0x4f06('0x2a')](_0x5d4037[_0x4f06('0x3d')]['offset']);}_0x29d1dd['order']=qs[_0x4f06('0x9b')](_0x5d4037[_0x4f06('0x3d')][_0x4f06('0x9b')]);_0x29d1dd['where']=qs[_0x4f06('0xa4')](_[_0x4f06('0xa6')](_0x5d4037[_0x4f06('0x3d')],_0x2f58fd[_0x4f06('0xa4')]));_0x29d1dd['where'][_0x4f06('0x9d')]=_0x27e8b9['id'];if(_0x5d4037[_0x4f06('0x3d')][_0x4f06('0xa7')]){_0x29d1dd[_0x4f06('0x9c')]=_[_0x4f06('0x31')](_0x29d1dd['where'],{'$or':_[_0x4f06('0x9e')](_0x29d1dd[_0x4f06('0x42')],function(_0x70bf48){var _0x569df3={};_0x569df3[_0x70bf48]={'$like':'%'+_0x5d4037[_0x4f06('0x3d')][_0x4f06('0xa7')]+'%'};return _0x569df3;})});}_0x29d1dd[_0x4f06('0x9c')][_0x4f06('0xa8')]=![];if(_0x5d4037[_0x4f06('0x3d')]['id']){_0x29d1dd[_0x4f06('0x9c')]['id']={'$gt':_0x5d4037['query']['id']};}_0x29d1dd=_[_0x4f06('0x31')]({},_0x29d1dd,_0x5d4037[_0x4f06('0xa1')]);return db['ChatMessage'][_0x4f06('0x29')]({'where':_0x29d1dd[_0x4f06('0x9c')]})[_0x4f06('0x18')](function(_0x116a1d){_0xcdd8fc[_0x4f06('0x29')]=_0x116a1d;_0x29d1dd['include']=[];if(_0x5d4037[_0x4f06('0x3d')][_0x4f06('0xa9')]){_0x29d1dd[_0x4f06('0x43')][_0x4f06('0xaa')]({'model':db[_0x4f06('0x87')],'as':'User','attributes':['id',_0x4f06('0x51'),_0x4f06('0x88')]});}if(_0x5d4037[_0x4f06('0x3d')][_0x4f06('0xab')]){_0x29d1dd['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x29d1dd);})[_0x4f06('0x18')](function(_0x8c8b8a){_0xcdd8fc[_0x4f06('0xa2')]=_0x8c8b8a;return _0xcdd8fc;});}})[_0x4f06('0x18')](respondWithFilteredResult(_0x34dbbc,_0x29d1dd))[_0x4f06('0x45')](handleError(_0x34dbbc,null));};exports[_0x4f06('0xac')]=function(_0x655a36,_0x523e20){return db[_0x4f06('0x35')][_0x4f06('0x44')]({'where':{'id':_0x655a36[_0x4f06('0x3c')]['id']}})['then'](handleEntityNotFound(_0x523e20,null))['then'](function(_0x51fc1a){if(_0x51fc1a){return _0x51fc1a[_0x4f06('0xad')](_0x655a36[_0x4f06('0x32')][_0x4f06('0x97')],_[_0x4f06('0x98')](_0x655a36[_0x4f06('0x32')],[_0x4f06('0x97'),'id'])||{})[_0x4f06('0xae')](function(){return db[_0x4f06('0xaf')]['findAll']({'attributes':['id',_0x4f06('0x2e'),_0x4f06('0xb0')],'where':{'id':_0x655a36[_0x4f06('0x32')][_0x4f06('0x97')]}});})['then'](function(_0x306eb1){socket[_0x4f06('0xb1')]('chatInteractionTags:save',{'id':Number(_0x655a36[_0x4f06('0x3c')]['id']),'tags':_0x306eb1||[]});return{'id':Number(_0x655a36['params']['id']),'tags':_0x306eb1||[]};});}})[_0x4f06('0x18')](respondWithResult(_0x523e20,null))[_0x4f06('0x45')](handleError(_0x523e20,null));};exports[_0x4f06('0xb2')]=function(_0xda1fcf,_0x1e9f48){return db[_0x4f06('0x35')]['find']({'where':{'id':_0xda1fcf['params']['id']}})[_0x4f06('0x18')](handleEntityNotFound(_0x1e9f48,null))['then'](function(_0x1ce628){if(_0x1ce628){return _0x1ce628['removeTags'](_0xda1fcf[_0x4f06('0x3d')]['ids']);}})[_0x4f06('0x18')](respondWithStatusCode(_0x1e9f48,null))[_0x4f06('0x45')](handleError(_0x1e9f48,null));};exports[_0x4f06('0x73')]=function(_0x234c96,_0xded0e4){var _0x92e6d4=moment()[_0x4f06('0xb3')]()[_0x4f06('0xb4')]();var _0x2368b8=path[_0x4f06('0x71')](config['root'],_0x4f06('0xb5'),'files',_0x4f06('0xb6'));var _0x3978da=path[_0x4f06('0x71')](config[_0x4f06('0x76')],'server','files',_0x4f06('0xb7'));var _0x21d630=path[_0x4f06('0x71')](_0x2368b8,_0x92e6d4);var _0x1337a0=util[_0x4f06('0x78')](_0x4f06('0xb8'),_0x234c96[_0x4f06('0x3c')]['id'],_0x92e6d4);var _0x19333c=path[_0x4f06('0x71')](_0x2368b8,_0x1337a0);var _0xfb6946=[];_0xfb6946[_0x4f06('0xaa')]({'model':db[_0x4f06('0x87')],'as':_0x4f06('0x87'),'attributes':['id','fullname'],'raw':!![]});_0xfb6946['push']({'model':db[_0x4f06('0x5f')],'as':_0x4f06('0x60'),'attributes':['id',_0x4f06('0xb9'),_0x4f06('0xba')],'raw':!![]});if(_0x234c96[_0x4f06('0x3d')][_0x4f06('0xb7')]){_0xfb6946[_0x4f06('0xaa')]({'model':db[_0x4f06('0x6e')],'as':_0x4f06('0x6e'),'raw':!![]});}var _0x388ef6=[{'model':db[_0x4f06('0x5d')],'as':_0x4f06('0x7c'),'attributes':['id','body',_0x4f06('0x8a'),_0x4f06('0x8c'),'secret',_0x4f06('0xbb')],'include':_0xfb6946}];_0x388ef6['push']({'model':db['ChatWebsite'],'as':_0x4f06('0xbc'),'attributes':['id',_0x4f06('0x2e')]});_0x388ef6['push']({'model':db[_0x4f06('0x87')],'as':_0x4f06('0xbd'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x4f06('0x44')]({'where':{'id':_0x234c96[_0x4f06('0x3c')]['id']},'include':_0x388ef6})[_0x4f06('0x18')](handleEntityNotFound(_0xded0e4,null))[_0x4f06('0x18')](function(_0x58f1db){if(_0x58f1db){var _0x48481a=_0x58f1db[_0x4f06('0xbe')]({'plain':!![]});fs[_0x4f06('0xbf')](_0x21d630);var _0x2d1978={'channel':_0x4f06('0xc0'),'account':_0x48481a[_0x4f06('0xbc')][_0x4f06('0x2e')],'agent':_0x48481a[_0x4f06('0xbd')]?_0x48481a['Owner']['fullname']:'N.A.','createdAt':moment(_0x48481a['createdAt'])['format'](_0x4f06('0xc1'))['toString'](),'closedAt':_0x48481a['closed']?moment(_0x48481a[_0x4f06('0xc2')])[_0x4f06('0x78')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x48481a[_0x4f06('0x67')],'chatInfo':{'browser':_0x48481a[_0x4f06('0xc3')],'os':_0x48481a[_0x4f06('0xc4')],'referer':_0x48481a[_0x4f06('0xc5')],'customerIp':_0x48481a[_0x4f06('0xc6')],'customerPort':_0x48481a['customerPort']?_0x48481a[_0x4f06('0xc7')]:'N.A.'},'messages':_(_0x48481a[_0x4f06('0x7c')])['tail']()[_0x4f06('0xa7')]({'secret':![]})[_0x4f06('0x9e')](function(_0x2b1a5f){if(_0x2b1a5f[_0x4f06('0x6e')]){var _0x1dbff4=path[_0x4f06('0x71')](_0x3978da,_0x2b1a5f[_0x4f06('0x6e')][_0x4f06('0x6c')]);if(fs[_0x4f06('0xc8')](_0x1dbff4)){fs[_0x4f06('0xc9')](_0x1dbff4)[_0x4f06('0xca')](fs[_0x4f06('0xcb')](path[_0x4f06('0x71')](_0x21d630,_0x2b1a5f[_0x4f06('0x6e')][_0x4f06('0x6c')])));}}return{'date':moment(_0x2b1a5f[_0x4f06('0x8a')])[_0x4f06('0x78')](_0x4f06('0xc1'))[_0x4f06('0xb4')](),'sender':_0x2b1a5f[_0x4f06('0x8c')]===_0x4f06('0x5c')?_0x2b1a5f[_0x4f06('0x87')]?_0x2b1a5f[_0x4f06('0x87')][_0x4f06('0x51')]:'System':_0x2b1a5f[_0x4f06('0x60')][_0x4f06('0xb9')]+(_0x2b1a5f[_0x4f06('0x60')]['lastName']?'\x20'+_0x2b1a5f['Contact'][_0x4f06('0xba')]:''),'body':_0x2b1a5f[_0x4f06('0x6e')]?_0x2b1a5f[_0x4f06('0x6e')]['basename']:_0x2b1a5f[_0x4f06('0x32')],'direction':_0x2b1a5f[_0x4f06('0x8c')]===_0x4f06('0x5c')?'A':'C','secret':_0x2b1a5f['secret'],'read':_0x2b1a5f[_0x4f06('0xbb')],'attachment':_0x2b1a5f[_0x4f06('0x6e')]};})[_0x4f06('0xcc')]()};return ejs[_0x4f06('0xcd')](path[_0x4f06('0x71')](config[_0x4f06('0x76')],'server',_0x4f06('0xce'),_0x4f06('0xcf')),{'interaction':_0x2d1978})[_0x4f06('0x18')](function(_0x148474){var _0x125939=path[_0x4f06('0x71')](_0x21d630,'transcript-'+_0x48481a['id']+'-'+_0x92e6d4+'.pdf');var _0x2783c6={'path':_0x125939,'channel':_0x4f06('0xc0'),'interactionId':_0x48481a['id']};return pdf[_0x4f06('0xd0')](_0x148474,_0x2783c6);})[_0x4f06('0x18')](function(){return new Promise(function(_0x2d7806,_0x402aa2){zipdir(_0x21d630,{'saveTo':_0x19333c},function(_0x55ce12,_0xda293e){if(_0x55ce12)return _0x402aa2(_0x55ce12);return _0x2d7806(_0xda293e);});})[_0x4f06('0x18')](function(){return new BPromise(function(_0x511691,_0x5b02ed){rimraf(_0x21d630,function(_0xdb9927){if(_0xdb9927)_0x5b02ed(_0xdb9927);return _0x511691();});});})[_0x4f06('0x18')](function(){return _0xded0e4[_0x4f06('0x73')](_0x19333c,_0x1337a0,function(_0x4d4b20){if(_0x4d4b20){logger['error'](_0x4f06('0xd1'),_0x4d4b20);}else{fs[_0x4f06('0xd2')](_0x19333c);}});});});}else{return _0xded0e4[_0x4f06('0x23')](0xc8);}})[_0x4f06('0x45')](handleError(_0xded0e4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 65c50e9..69eef7a 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 _0x7d4b=['Users','findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','then','setDataValue'];(function(_0x68b8db,_0x34578c){var _0x4f8173=function(_0x46adcb){while(--_0x46adcb){_0x68b8db['push'](_0x68b8db['shift']());}};_0x4f8173(++_0x34578c);}(_0x7d4b,0xb2));var _0xb7d4=function(_0x96b68a,_0x39e7ad){_0x96b68a=_0x96b68a-0x0;var _0x220e87=_0x7d4b[_0x96b68a];return _0x220e87;};'use strict';var EventEmitter=require(_0xb7d4('0x0'));var ChatInteraction=require(_0xb7d4('0x1'))['db'][_0xb7d4('0x2')];var ChatMessage=require(_0xb7d4('0x1'))['db'][_0xb7d4('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb7d4('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb7d4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x53de15){return function(_0x38a358,_0x4b0212,_0x2ca101){_0x38a358[_0xb7d4('0x6')]({'attributes':['id'],'raw':!![]})[_0xb7d4('0x7')](function(_0x583c07){_0x38a358[_0xb7d4('0x8')](_0xb7d4('0x9'),_0x583c07['map'](function(_0x39cc18){return{'id':_0x39cc18['id']};}));return ChatMessage[_0xb7d4('0xa')]({'where':{'ChatInteractionId':_0x38a358['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb7d4('0x7')](function(_0x4b1405){_0x38a358[_0xb7d4('0x8')](_0xb7d4('0xb'),_0x4b1405[_0xb7d4('0xc')]);ChatInteractionEvents['emit'](_0x53de15+':'+_0x38a358['id'],_0x38a358);ChatInteractionEvents['emit'](_0x53de15,_0x38a358);_0x2ca101(null);})[_0xb7d4('0xd')](_0x2ca101(null));};}for(var e in events){if(events[_0xb7d4('0xe')](e)){var event=events[e];ChatInteraction[_0xb7d4('0xf')](e,emitEvent(event));}}module[_0xb7d4('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x8080=['save','remove','getUsers','then','setDataValue','map','findAll','emit','hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8080,0x175));var _0x0808=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x8080[_0x4ea69d];return _0x5318e0;};'use strict';var EventEmitter=require(_0x0808('0x0'));var ChatInteraction=require(_0x0808('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x0808('0x1'))['db'][_0x0808('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0808('0x3')](0x0);var events={'afterCreate':_0x0808('0x4'),'afterUpdate':'update','afterDestroy':_0x0808('0x5')};function emitEvent(_0x377249){return function(_0x5ded0c,_0x19cd2c,_0xc8f2cc){_0x5ded0c[_0x0808('0x6')]({'attributes':['id'],'raw':!![]})[_0x0808('0x7')](function(_0x5b7ee2){_0x5ded0c[_0x0808('0x8')]('Users',_0x5b7ee2[_0x0808('0x9')](function(_0x3fa7c4){return{'id':_0x3fa7c4['id']};}));return ChatMessage[_0x0808('0xa')]({'where':{'ChatInteractionId':_0x5ded0c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0808('0x7')](function(_0x20776c){_0x5ded0c['setDataValue']('unreadMessages',_0x20776c['length']);ChatInteractionEvents[_0x0808('0xb')](_0x377249+':'+_0x5ded0c['id'],_0x5ded0c);ChatInteractionEvents[_0x0808('0xb')](_0x377249,_0x5ded0c);_0xc8f2cc(null);})['catch'](_0xc8f2cc(null));};}for(var e in events){if(events[_0x0808('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index bbb5f76..e223bef 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 _0xbd01=['changed','closed','closedAt','format','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions'];(function(_0x2d4510,_0x2b88be){var _0x3555d4=function(_0x4e5259){while(--_0x4e5259){_0x2d4510['push'](_0x2d4510['shift']());}};_0x3555d4(++_0x2b88be);}(_0xbd01,0xf3));var _0x1bd0=function(_0x158685,_0x58ab1a){_0x158685=_0x158685-0x0;var _0x273d9c=_0xbd01[_0x158685];return _0x273d9c;};'use strict';var _=require('lodash');var util=require(_0x1bd0('0x0'));var logger=require(_0x1bd0('0x1'))(_0x1bd0('0x2'));var moment=require(_0x1bd0('0x3'));var BPromise=require(_0x1bd0('0x4'));var rp=require(_0x1bd0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1bd0('0x6'));var config=require(_0x1bd0('0x7'));var attributes=require(_0x1bd0('0x8'));module['exports']=function(_0x4c2b55,_0x11de07){return _0x4c2b55[_0x1bd0('0x9')](_0x1bd0('0xa'),attributes,{'tableName':_0x1bd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1468a9,_0x1cbe01,_0x38f6fc){if(_0x1468a9[_0x1bd0('0xc')](_0x1bd0('0xd'))){_0x1468a9[_0x1bd0('0xe')]=moment()[_0x1bd0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x38f6fc(null,_0x1468a9);}},'charset':'utf8mb4','collate':_0x1bd0('0x10')});}; \ No newline at end of file +var _0x80d2=['moment','path','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','util','api'];(function(_0xb6f924,_0x2f7346){var _0x5e26a9=function(_0x87cf2f){while(--_0x87cf2f){_0xb6f924['push'](_0xb6f924['shift']());}};_0x5e26a9(++_0x2f7346);}(_0x80d2,0xb4));var _0x280d=function(_0x447e2f,_0x48d0e5){_0x447e2f=_0x447e2f-0x0;var _0x254527=_0x80d2[_0x447e2f];return _0x254527;};'use strict';var _=require('lodash');var util=require(_0x280d('0x0'));var logger=require('../../config/logger')(_0x280d('0x1'));var moment=require(_0x280d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x280d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x280d('0x4'));module[_0x280d('0x5')]=function(_0x5348fb,_0x50972d){return _0x5348fb[_0x280d('0x6')]('ChatInteraction',attributes,{'tableName':_0x280d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57c648,_0x5851be,_0x36ef54){if(_0x57c648[_0x280d('0x8')](_0x280d('0x9'))){_0x57c648[_0x280d('0xa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x36ef54(null,_0x57c648);}},'charset':_0x280d('0xb'),'collate':_0x280d('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index fcb91a0..ff84b09 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 _0xcbca=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','stringify','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xcbca,0x77));var _0xacbc=function(_0x5026ab,_0x25bd8b){_0x5026ab=_0x5026ab-0x0;var _0x55f39a=_0xcbca[_0x5026ab];return _0x55f39a;};'use strict';var _=require(_0xacbc('0x0'));var util=require(_0xacbc('0x1'));var moment=require(_0xacbc('0x2'));var BPromise=require(_0xacbc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacbc('0x4'));var db=require(_0xacbc('0x5'))['db'];var utils=require(_0xacbc('0x6'));var logger=require('../../config/logger')(_0xacbc('0x7'));var config=require(_0xacbc('0x8'));var jayson=require(_0xacbc('0x9'));var client=jayson[_0xacbc('0xa')]['http']({'port':0x232a});config[_0xacbc('0xb')]=_[_0xacbc('0xc')](config[_0xacbc('0xb')],{'host':_0xacbc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacbc('0xb')]));require(_0xacbc('0xe'))[_0xacbc('0xf')](socket);function respondWithRpcPromise(_0x549f14,_0x3c53c7,_0x517d32){return new BPromise(function(_0x5c1ecb,_0x2f45a5){return client['request'](_0x549f14,_0x517d32)[_0xacbc('0x10')](function(_0x539011){logger[_0xacbc('0x11')](_0xacbc('0x12'),_0x3c53c7,'request\x20sent');logger[_0xacbc('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3c53c7,_0xacbc('0x14'),JSON['stringify'](_0x539011));if(_0x539011['error']){if(_0x539011[_0xacbc('0x15')][_0xacbc('0x16')]===0x1f4){logger[_0xacbc('0x15')](_0xacbc('0x12'),_0x3c53c7,_0x539011[_0xacbc('0x15')]['message']);return _0x2f45a5(_0x539011['error'][_0xacbc('0x17')]);}logger[_0xacbc('0x15')](_0xacbc('0x12'),_0x3c53c7,_0x539011[_0xacbc('0x15')][_0xacbc('0x17')]);return _0x5c1ecb(_0x539011[_0xacbc('0x15')][_0xacbc('0x17')]);}else{logger[_0xacbc('0x11')](_0xacbc('0x12'),_0x3c53c7,'request\x20sent');_0x5c1ecb(_0x539011['result'][_0xacbc('0x17')]);}})[_0xacbc('0x18')](function(_0x20016a){logger[_0xacbc('0x15')](_0xacbc('0x12'),_0x3c53c7,_0x20016a);_0x2f45a5(_0x20016a);});});}exports['UpdateChatInteraction']=function(_0x12ca7a){var _0x465a18=this;return new Promise(function(_0x4a64a9,_0x4f6014){return db[_0xacbc('0x19')][_0xacbc('0x1a')](_0x12ca7a[_0xacbc('0x1b')],{'raw':_0x12ca7a[_0xacbc('0x1c')]?_0x12ca7a[_0xacbc('0x1c')][_0xacbc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ca7a[_0xacbc('0x1c')]?_0x12ca7a[_0xacbc('0x1c')][_0xacbc('0x1e')]||null:null,'attributes':_0x12ca7a['options']?_0x12ca7a[_0xacbc('0x1c')][_0xacbc('0x1f')]||null:null,'limit':_0x12ca7a[_0xacbc('0x1c')]?_0x12ca7a[_0xacbc('0x1c')][_0xacbc('0x20')]||null:null})[_0xacbc('0x10')](function(_0x6a8558){logger[_0xacbc('0x11')]('UpdateChatInteraction',_0x12ca7a);logger[_0xacbc('0x13')]('UpdateChatInteraction',_0x12ca7a,JSON[_0xacbc('0x21')](_0x6a8558));_0x4a64a9(_0x6a8558);})[_0xacbc('0x18')](function(_0x172dd5){logger[_0xacbc('0x15')](_0xacbc('0x22'),_0x172dd5[_0xacbc('0x17')],_0x12ca7a);_0x4f6014(_0x465a18[_0xacbc('0x15')](0x1f4,_0x172dd5['message']));});});};exports[_0xacbc('0x23')]=function(_0x3b12ba){return new Promise(function(_0x5b0604,_0x394ef4){return db[_0xacbc('0x19')][_0xacbc('0x24')]({'where':_0x3b12ba[_0xacbc('0x1c')]?_0x3b12ba[_0xacbc('0x1c')]['where']||null:null})[_0xacbc('0x10')](function(_0x448a4b){if(_0x448a4b){return _0x448a4b[_0xacbc('0x25')](_0x3b12ba[_0xacbc('0x1b')][_0xacbc('0x26')],_[_0xacbc('0x27')](_0x3b12ba[_0xacbc('0x1b')],[_0xacbc('0x26'),'id'])||{});}})['spread'](function(_0x25ef25){logger[_0xacbc('0x11')](_0xacbc('0x28'),_0x3b12ba);logger['debug'](_0xacbc('0x28'),_0x3b12ba,JSON['stringify'](_0x25ef25));_0x5b0604(_0x25ef25);})['catch'](function(_0x4b32a9){logger[_0xacbc('0x15')](_0xacbc('0x28'),_0x4b32a9[_0xacbc('0x17')],_0x3b12ba);_0x394ef4(_this[_0xacbc('0x15')](0x1f4,_0x4b32a9['message']));});});}; \ No newline at end of file +var _0x5ba4=['omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToChatInteraction','find','addTags','ids'];(function(_0x3e2080,_0x567e79){var _0x314d16=function(_0x5c3e3e){while(--_0x5c3e3e){_0x3e2080['push'](_0x3e2080['shift']());}};_0x314d16(++_0x567e79);}(_0x5ba4,0x163));var _0x45ba=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x5ba4[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x45ba('0x0'));var BPromise=require(_0x45ba('0x1'));var rs=require(_0x45ba('0x2'));var fs=require('fs');var Redis=require(_0x45ba('0x3'));var db=require(_0x45ba('0x4'))['db'];var utils=require(_0x45ba('0x5'));var logger=require(_0x45ba('0x6'))('rpc');var config=require(_0x45ba('0x7'));var jayson=require(_0x45ba('0x8'));var client=jayson[_0x45ba('0x9')][_0x45ba('0xa')]({'port':0x232a});config['redis']=_[_0x45ba('0xb')](config[_0x45ba('0xc')],{'host':_0x45ba('0xd'),'port':0x18eb});var socket=require(_0x45ba('0xe'))(new Redis(config[_0x45ba('0xc')]));require(_0x45ba('0xf'))[_0x45ba('0x10')](socket);function respondWithRpcPromise(_0x176ae8,_0x482a5c,_0x495d49){return new BPromise(function(_0xe8aeb0,_0x181dbb){return client['request'](_0x176ae8,_0x495d49)[_0x45ba('0x11')](function(_0x116b06){logger[_0x45ba('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x482a5c,_0x45ba('0x13'));logger[_0x45ba('0x14')](_0x45ba('0x15'),_0x482a5c,_0x45ba('0x13'),JSON['stringify'](_0x116b06));if(_0x116b06[_0x45ba('0x16')]){if(_0x116b06[_0x45ba('0x16')][_0x45ba('0x17')]===0x1f4){logger[_0x45ba('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x482a5c,_0x116b06[_0x45ba('0x16')][_0x45ba('0x18')]);return _0x181dbb(_0x116b06[_0x45ba('0x16')][_0x45ba('0x18')]);}logger['error'](_0x45ba('0x19'),_0x482a5c,_0x116b06[_0x45ba('0x16')][_0x45ba('0x18')]);return _0xe8aeb0(_0x116b06[_0x45ba('0x16')]['message']);}else{logger[_0x45ba('0x12')](_0x45ba('0x19'),_0x482a5c,_0x45ba('0x13'));_0xe8aeb0(_0x116b06[_0x45ba('0x1a')][_0x45ba('0x18')]);}})[_0x45ba('0x1b')](function(_0x2375b5){logger[_0x45ba('0x16')](_0x45ba('0x19'),_0x482a5c,_0x2375b5);_0x181dbb(_0x2375b5);});});}exports[_0x45ba('0x1c')]=function(_0x10520c){var _0x525732=this;return new Promise(function(_0x386ccf,_0x1676df){return db[_0x45ba('0x1d')]['update'](_0x10520c[_0x45ba('0x1e')],{'raw':_0x10520c[_0x45ba('0x1f')]?_0x10520c['options'][_0x45ba('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10520c['options']?_0x10520c[_0x45ba('0x1f')][_0x45ba('0x21')]||null:null,'attributes':_0x10520c[_0x45ba('0x1f')]?_0x10520c[_0x45ba('0x1f')][_0x45ba('0x22')]||null:null,'limit':_0x10520c[_0x45ba('0x1f')]?_0x10520c['options'][_0x45ba('0x23')]||null:null})[_0x45ba('0x11')](function(_0x33f086){logger[_0x45ba('0x12')]('UpdateChatInteraction',_0x10520c);logger[_0x45ba('0x14')]('UpdateChatInteraction',_0x10520c,JSON[_0x45ba('0x24')](_0x33f086));_0x386ccf(_0x33f086);})[_0x45ba('0x1b')](function(_0x5901d9){logger['error'](_0x45ba('0x1c'),_0x5901d9[_0x45ba('0x18')],_0x10520c);_0x1676df(_0x525732[_0x45ba('0x16')](0x1f4,_0x5901d9[_0x45ba('0x18')]));});});};exports[_0x45ba('0x25')]=function(_0x34e395){return new Promise(function(_0x1ddd63,_0x4d2d64){return db[_0x45ba('0x1d')][_0x45ba('0x26')]({'where':_0x34e395[_0x45ba('0x1f')]?_0x34e395[_0x45ba('0x1f')]['where']||null:null})[_0x45ba('0x11')](function(_0x336f5e){if(_0x336f5e){return _0x336f5e[_0x45ba('0x27')](_0x34e395[_0x45ba('0x1e')][_0x45ba('0x28')],_[_0x45ba('0x29')](_0x34e395[_0x45ba('0x1e')],[_0x45ba('0x28'),'id'])||{});}})[_0x45ba('0x2a')](function(_0x3695c2){logger['info'](_0x45ba('0x2b'),_0x34e395);logger[_0x45ba('0x14')](_0x45ba('0x2b'),_0x34e395,JSON[_0x45ba('0x24')](_0x3695c2));_0x1ddd63(_0x3695c2);})[_0x45ba('0x1b')](function(_0x1c5408){logger['error']('AddTags',_0x1c5408['message'],_0x34e395);_0x4d2d64(_this[_0x45ba('0x16')](0x1f4,_0x1c5408[_0x45ba('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 613e7f2..594b8de 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 _0xb2c5=['removeListener','register','length','chatInteraction:','remove','update','emit'];(function(_0x2860e7,_0x416e82){var _0x146fbe=function(_0x483f92){while(--_0x483f92){_0x2860e7['push'](_0x2860e7['shift']());}};_0x146fbe(++_0x416e82);}(_0xb2c5,0x146));var _0x5b2c=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0xb2c5[_0x138d06];return _0x1a01eb;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x5b2c('0x0'),_0x5b2c('0x1')];function createListener(_0x49aa61,_0x257f5e){return function(_0x52ed2b){_0x257f5e[_0x5b2c('0x2')](_0x49aa61,_0x52ed2b);};}function removeListener(_0x4fd498,_0x17a2fa){return function(){ChatInteractionEvents[_0x5b2c('0x3')](_0x4fd498,_0x17a2fa);};}exports[_0x5b2c('0x4')]=function(_0x22e0ed){for(var _0x29d748=0x0,_0x4f807a=events[_0x5b2c('0x5')];_0x29d748<_0x4f807a;_0x29d748++){var _0x2cc804=events[_0x29d748];var _0x599086=createListener(_0x5b2c('0x6')+_0x2cc804,_0x22e0ed);ChatInteractionEvents['on'](_0x2cc804,_0x599086);}}; \ No newline at end of file +var _0x620b=['length','update','emit','removeListener','register'];(function(_0x1d2b4b,_0x1b8974){var _0x54d25f=function(_0x1008e2){while(--_0x1008e2){_0x1d2b4b['push'](_0x1d2b4b['shift']());}};_0x54d25f(++_0x1b8974);}(_0x620b,0x1c3));var _0xb620=function(_0x3c87d6,_0x594412){_0x3c87d6=_0x3c87d6-0x0;var _0x1cc644=_0x620b[_0x3c87d6];return _0x1cc644;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0xb620('0x0')];function createListener(_0x45ff8c,_0x9eb788){return function(_0xb3ec6c){_0x9eb788[_0xb620('0x1')](_0x45ff8c,_0xb3ec6c);};}function removeListener(_0x18d566,_0xa30b3f){return function(){ChatInteractionEvents[_0xb620('0x2')](_0x18d566,_0xa30b3f);};}exports[_0xb620('0x3')]=function(_0x4c73ba){for(var _0x1a2332=0x0,_0x3819f8=events[_0xb620('0x4')];_0x1a2332<_0x3819f8;_0x1a2332++){var _0x4074ad=events[_0x1a2332];var _0x5153a9=createListener('chatInteraction:'+_0x4074ad,_0x4c73ba);ChatInteractionEvents['on'](_0x4074ad,_0x5153a9);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 469812b..b65f7ba 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 _0x87d2=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized'];(function(_0x2f5100,_0x565cbe){var _0x40c4bc=function(_0x525168){while(--_0x525168){_0x2f5100['push'](_0x2f5100['shift']());}};_0x40c4bc(++_0x565cbe);}(_0x87d2,0x8b));var _0x287d=function(_0x1f9ace,_0x694975){_0x1f9ace=_0x1f9ace-0x0;var _0x2c348d=_0x87d2[_0x1f9ace];return _0x2c348d;};'use strict';var multer=require(_0x287d('0x0'));var util=require(_0x287d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x287d('0x2'));var router=express['Router']();var fs_extra=require(_0x287d('0x3'));var auth=require(_0x287d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x287d('0x5'));var controller=require(_0x287d('0x6'));router[_0x287d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x287d('0x7')]('/describe',auth[_0x287d('0x8')](),controller[_0x287d('0x9')]);router[_0x287d('0x7')](_0x287d('0xa'),auth['isChatInteractionAuthorized'](),controller[_0x287d('0xb')]);router['get'](_0x287d('0xc'),auth[_0x287d('0xd')](),controller[_0x287d('0xe')]);router[_0x287d('0x7')](_0x287d('0xf'),auth['isAuthenticated'](),controller[_0x287d('0x10')]);router[_0x287d('0x7')](_0x287d('0x11'),auth[_0x287d('0xd')](),controller[_0x287d('0x12')]);router['get'](_0x287d('0x13'),auth[_0x287d('0x8')](),controller[_0x287d('0x14')]);router[_0x287d('0x15')]('/',auth['isAuthenticated'](),controller[_0x287d('0x16')]);router['post'](_0x287d('0x17'),auth['isAuthenticated'](),controller[_0x287d('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x223910,_0x12f5d6,_0x16d785){_0x16d785(null,path['join'](config[_0x287d('0x19')],_0x287d('0x1a')));},'filename':function(_0x13ab72,_0x19b8c5,_0x46c6ad){_0x46c6ad(null,util['format'](_0x287d('0x1b'),Date[_0x287d('0x1c')](),_0x19b8c5['originalname'][_0x287d('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x287d('0x15')](_0x287d('0x1e'),upload[_0x287d('0x1f')](_0x287d('0x20')),controller[_0x287d('0x21')]);router['post'](_0x287d('0xf'),auth[_0x287d('0xd')](),controller[_0x287d('0x22')]);router[_0x287d('0x15')]('/:id/tags',auth[_0x287d('0x8')](),interaction[_0x287d('0x23')]('chat','chatinteraction:addtags'),controller['addTags']);router[_0x287d('0x24')]('/:id',auth[_0x287d('0x8')](),interaction['tracked'](_0x287d('0x25'),_0x287d('0x26')),controller[_0x287d('0x27')]);router[_0x287d('0x24')](_0x287d('0x28'),controller[_0x287d('0x29')]);router['put'](_0x287d('0x2a'),auth['isChatInteractionAuthorized'](),controller[_0x287d('0x2b')]);router[_0x287d('0x24')](_0x287d('0x2c'),controller[_0x287d('0x2d')]);router[_0x287d('0x2e')](_0x287d('0xa'),auth[_0x287d('0x8')](),interaction['tracked']('chat',_0x287d('0x2f')),controller[_0x287d('0x30')]);router[_0x287d('0x2e')](_0x287d('0x31'),auth[_0x287d('0x8')](),controller[_0x287d('0x32')]);module['exports']=router; \ No newline at end of file +var _0x8f83=['/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages'];(function(_0x27f3b3,_0x456572){var _0x4890b6=function(_0x50eb5b){while(--_0x50eb5b){_0x27f3b3['push'](_0x27f3b3['shift']());}};_0x4890b6(++_0x456572);}(_0x8f83,0xe8));var _0x38f8=function(_0x3f746f,_0xf5194d){_0x3f746f=_0x3f746f-0x0;var _0x40746b=_0x8f83[_0x3f746f];return _0x40746b;};'use strict';var multer=require(_0x38f8('0x0'));var util=require(_0x38f8('0x1'));var path=require(_0x38f8('0x2'));var timeout=require(_0x38f8('0x3'));var express=require(_0x38f8('0x4'));var router=express[_0x38f8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x38f8('0x6'));var interaction=require(_0x38f8('0x7'));var config=require(_0x38f8('0x8'));var controller=require('./chatInteraction.controller');router[_0x38f8('0x9')]('/',auth[_0x38f8('0xa')](),controller['index']);router[_0x38f8('0x9')]('/describe',auth[_0x38f8('0xa')](),controller[_0x38f8('0xb')]);router[_0x38f8('0x9')](_0x38f8('0xc'),auth[_0x38f8('0xd')](),controller[_0x38f8('0xe')]);router[_0x38f8('0x9')](_0x38f8('0xf'),auth[_0x38f8('0xd')](),controller['attachmentDownload']);router[_0x38f8('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x38f8('0x10')]);router[_0x38f8('0x9')](_0x38f8('0x11'),auth[_0x38f8('0xd')](),controller['getMyMessages']);router['get'](_0x38f8('0x12'),auth[_0x38f8('0xa')](),controller[_0x38f8('0x13')]);router[_0x38f8('0x14')]('/',auth[_0x38f8('0xa')](),controller[_0x38f8('0x15')]);router['post'](_0x38f8('0x16'),auth['isAuthenticated'](),controller[_0x38f8('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42e0b6,_0x1e3cd6,_0x48f4ec){_0x48f4ec(null,path['join'](config[_0x38f8('0x18')],'server/files/attachments/'));},'filename':function(_0x5403b8,_0x3d3f69,_0x2708f5){_0x2708f5(null,util[_0x38f8('0x19')](_0x38f8('0x1a'),Date[_0x38f8('0x1b')](),_0x3d3f69[_0x38f8('0x1c')][_0x38f8('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x38f8('0x1e'),upload[_0x38f8('0x1f')](_0x38f8('0x20')),controller[_0x38f8('0x21')]);router[_0x38f8('0x14')](_0x38f8('0x22'),auth[_0x38f8('0xd')](),controller['addMessage']);router[_0x38f8('0x14')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x38f8('0x23')](_0x38f8('0x24'),_0x38f8('0x25')),controller['addTags']);router[_0x38f8('0x26')](_0x38f8('0xc'),auth[_0x38f8('0xa')](),interaction[_0x38f8('0x23')](_0x38f8('0x24'),'chatinteraction:update'),controller[_0x38f8('0x27')]);router[_0x38f8('0x26')](_0x38f8('0x28'),controller[_0x38f8('0x29')]);router[_0x38f8('0x26')](_0x38f8('0x2a'),auth[_0x38f8('0xd')](),controller[_0x38f8('0x2b')]);router[_0x38f8('0x26')](_0x38f8('0x2c'),controller[_0x38f8('0x2d')]);router[_0x38f8('0x2e')]('/:id',auth[_0x38f8('0xa')](),interaction[_0x38f8('0x23')](_0x38f8('0x24'),_0x38f8('0x2f')),controller[_0x38f8('0x30')]);router[_0x38f8('0x2e')]('/:id/tags',auth[_0x38f8('0xa')](),controller['removeTags']);module[_0x38f8('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 0683e77..cc92ad4 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 _0x1558=['sequelize','exports','medium','BOOLEAN','INTEGER'];(function(_0x2bb13b,_0x192734){var _0x2852a9=function(_0x323ec8){while(--_0x323ec8){_0x2bb13b['push'](_0x2bb13b['shift']());}};_0x2852a9(++_0x192734);}(_0x1558,0x9b));var _0x8155=function(_0x337651,_0x2af690){_0x337651=_0x337651-0x0;var _0x20893c=_0x1558[_0x337651];return _0x20893c;};'use strict';var Sequelize=require(_0x8155('0x0'));module[_0x8155('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8155('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8155('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8155('0x4')]}}; \ No newline at end of file +var _0x2a35=['sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x271697,_0x6897d6){var _0x426093=function(_0x4d4dfe){while(--_0x4d4dfe){_0x271697['push'](_0x271697['shift']());}};_0x426093(++_0x6897d6);}(_0x2a35,0x15e));var _0x52a3=function(_0x3f4424,_0x227813){_0x3f4424=_0x3f4424-0x0;var _0x13da17=_0x2a35[_0x3f4424];return _0x13da17;};'use strict';var Sequelize=require(_0x52a3('0x0'));module[_0x52a3('0x1')]={'body':{'type':Sequelize[_0x52a3('0x2')](_0x52a3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x52a3('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fff124e..62984f2 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 _0xf79f=['user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','sendStatus','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','filters','find','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0xf79f,0x15a));var _0xff79=function(_0x74895e,_0x298c35){_0x74895e=_0x74895e-0x0;var _0x40bc2a=_0xf79f[_0x74895e];return _0x40bc2a;};'use strict';var emlformat=require(_0xff79('0x0'));var rimraf=require(_0xff79('0x1'));var zipdir=require(_0xff79('0x2'));var jsonpatch=require(_0xff79('0x3'));var rp=require(_0xff79('0x4'));var moment=require('moment');var BPromise=require(_0xff79('0x5'));var Mustache=require(_0xff79('0x6'));var util=require(_0xff79('0x7'));var path=require(_0xff79('0x8'));var sox=require(_0xff79('0x9'));var csv=require('to-csv');var ejs=require(_0xff79('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xff79('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xff79('0xc'));var toCsv=require(_0xff79('0xd'));var querystring=require(_0xff79('0xe'));var Papa=require(_0xff79('0xf'));var Redis=require(_0xff79('0x10'));var authService=require(_0xff79('0x11'));var qs=require(_0xff79('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff79('0x13'));var logger=require(_0xff79('0x14'))(_0xff79('0x15'));var utils=require('../../config/utils');var config=require(_0xff79('0x16'));var licenseUtil=require(_0xff79('0x17'));var db=require('../../mysqldb')['db'];config[_0xff79('0x18')]=_[_0xff79('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff79('0x1a'))(new Redis(config[_0xff79('0x18')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x33d197,_0x1173ee){_0x1173ee=_0x1173ee||0xcc;return function(_0x13776e){if(_0x13776e){return _0x33d197['sendStatus'](_0x1173ee);}return _0x33d197[_0xff79('0x1b')](_0x1173ee)[_0xff79('0x1c')]();};}function respondWithResult(_0x79e163,_0x2a11d2){_0x2a11d2=_0x2a11d2||0xc8;return function(_0x5e032f){if(_0x5e032f){return _0x79e163['status'](_0x2a11d2)[_0xff79('0x1d')](_0x5e032f);}};}function respondWithFilteredResult(_0x4573ca,_0x5aaa56){return function(_0x49c3bb){if(_0x49c3bb){var _0x52c2fa=typeof _0x5aaa56[_0xff79('0x1e')]===_0xff79('0x1f')&&typeof _0x5aaa56[_0xff79('0x20')]===_0xff79('0x1f');var _0x4daf9f=_0x49c3bb['count'];var _0x11b7c1=_0x52c2fa?0x0:_0x5aaa56[_0xff79('0x1e')];var _0x48e908=_0x52c2fa?_0x49c3bb[_0xff79('0x21')]:_0x5aaa56[_0xff79('0x1e')]+_0x5aaa56[_0xff79('0x20')];var _0x37afe5;if(_0x48e908>=_0x4daf9f){_0x48e908=_0x4daf9f;_0x37afe5=0xc8;}else{_0x37afe5=0xce;}_0x4573ca[_0xff79('0x1b')](_0x37afe5);return _0x4573ca[_0xff79('0x22')]('Content-Range',_0x11b7c1+'-'+_0x48e908+'/'+_0x4daf9f)[_0xff79('0x1d')](_0x49c3bb);}return null;};}function patchUpdates(_0x4cca75){return function(_0x1407eb){try{jsonpatch[_0xff79('0x23')](_0x1407eb,_0x4cca75,!![]);}catch(_0x27a9a2){return BPromise[_0xff79('0x24')](_0x27a9a2);}return _0x1407eb['save']();};}function saveUpdates(_0x4d43b2,_0x2081db){return function(_0x5097eb){if(_0x5097eb){return _0x5097eb['update'](_0x4d43b2)['then'](function(_0x73ba89){return _0x73ba89;});}return null;};}function removeEntity(_0x5ed14f,_0x15169a){return function(_0x207ffa){if(_0x207ffa){return _0x207ffa[_0xff79('0x25')]()[_0xff79('0x26')](function(){_0x5ed14f[_0xff79('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x463e51,_0x143448){return function(_0x177406){if(!_0x177406){_0x463e51[_0xff79('0x27')](0x194);}return _0x177406;};}function handleError(_0x42f0cd,_0x2935ff){_0x2935ff=_0x2935ff||0x1f4;return function(_0x53294d){logger[_0xff79('0x28')](_0x53294d['stack']);if(_0x53294d[_0xff79('0x29')]){delete _0x53294d['name'];}_0x42f0cd[_0xff79('0x1b')](_0x2935ff)[_0xff79('0x2a')](_0x53294d);};}exports[_0xff79('0x2b')]=function(_0x4f47a0,_0x4790be){var _0x3632c6={},_0x362f3b={},_0x1826e2={'count':0x0,'rows':[]};var _0x32148b=_[_0xff79('0x2c')](db[_0xff79('0x2d')][_0xff79('0x2e')],function(_0x410fc1){return{'name':_0x410fc1[_0xff79('0x2f')],'type':_0x410fc1[_0xff79('0x30')]['key']};});_0x362f3b[_0xff79('0x31')]=_['map'](_0x32148b,_0xff79('0x29'));_0x362f3b[_0xff79('0x32')]=_[_0xff79('0x33')](_0x4f47a0[_0xff79('0x32')]);_0x362f3b['filters']=_[_0xff79('0x34')](_0x362f3b[_0xff79('0x31')],_0x362f3b['query']);_0x3632c6['attributes']=_[_0xff79('0x34')](_0x362f3b['model'],qs[_0xff79('0x35')](_0x4f47a0[_0xff79('0x32')][_0xff79('0x35')]));_0x3632c6[_0xff79('0x36')]=_0x3632c6['attributes'][_0xff79('0x37')]?_0x3632c6[_0xff79('0x36')]:_0x362f3b[_0xff79('0x31')];if(!_0x4f47a0[_0xff79('0x32')][_0xff79('0x38')](_0xff79('0x39'))){_0x3632c6[_0xff79('0x20')]=qs[_0xff79('0x20')](_0x4f47a0[_0xff79('0x32')][_0xff79('0x20')]);_0x3632c6[_0xff79('0x1e')]=qs[_0xff79('0x1e')](_0x4f47a0['query'][_0xff79('0x1e')]);}_0x3632c6['order']=qs[_0xff79('0x3a')](_0x4f47a0[_0xff79('0x32')][_0xff79('0x3a')]);_0x3632c6[_0xff79('0x3b')]=qs['filters'](_[_0xff79('0x3c')](_0x4f47a0['query'],_0x362f3b['filters']),_0x32148b);if(_0x4f47a0[_0xff79('0x32')][_0xff79('0x3d')]){_0x3632c6[_0xff79('0x3b')]=_[_0xff79('0x3e')](_0x3632c6['where'],{'$or':_[_0xff79('0x2c')](_0x32148b,function(_0x38b534){if(_0x38b534['type']!==_0xff79('0x3f')){var _0x513a0d={};_0x513a0d[_0x38b534['name']]={'$like':'%'+_0x4f47a0[_0xff79('0x32')]['filter']+'%'};return _0x513a0d;}})});}_0x3632c6=_[_0xff79('0x3e')]({},_0x3632c6,_0x4f47a0[_0xff79('0x40')]);var _0x3ce4fa={'where':_0x3632c6[_0xff79('0x3b')]};return db[_0xff79('0x2d')][_0xff79('0x21')](_0x3ce4fa)[_0xff79('0x26')](function(_0x42cbc6){_0x1826e2[_0xff79('0x21')]=_0x42cbc6;if(_0x4f47a0[_0xff79('0x32')][_0xff79('0x41')]){_0x3632c6[_0xff79('0x42')]=[{'all':!![]}];}return db[_0xff79('0x2d')][_0xff79('0x43')](_0x3632c6);})[_0xff79('0x26')](function(_0x2291aa){_0x1826e2['rows']=_0x2291aa;return _0x1826e2;})['then'](respondWithFilteredResult(_0x4790be,_0x3632c6))[_0xff79('0x44')](handleError(_0x4790be,null));};exports[_0xff79('0x45')]=function(_0x30209f,_0x3e6db6){var _0x2d6810={'raw':!![],'where':{'id':_0x30209f['params']['id']}},_0x2b54b9={};_0x2b54b9[_0xff79('0x31')]=_['keys'](db[_0xff79('0x2d')][_0xff79('0x2e')]);_0x2b54b9['query']=_[_0xff79('0x33')](_0x30209f['query']);_0x2b54b9[_0xff79('0x46')]=_[_0xff79('0x34')](_0x2b54b9[_0xff79('0x31')],_0x2b54b9['query']);_0x2d6810[_0xff79('0x36')]=_['intersection'](_0x2b54b9[_0xff79('0x31')],qs[_0xff79('0x35')](_0x30209f['query'][_0xff79('0x35')]));_0x2d6810[_0xff79('0x36')]=_0x2d6810[_0xff79('0x36')][_0xff79('0x37')]?_0x2d6810['attributes']:_0x2b54b9[_0xff79('0x31')];if(_0x30209f[_0xff79('0x32')][_0xff79('0x41')]){_0x2d6810['include']=[{'all':!![]}];}_0x2d6810=_['merge']({},_0x2d6810,_0x30209f['options']);return db[_0xff79('0x2d')][_0xff79('0x47')](_0x2d6810)[_0xff79('0x26')](handleEntityNotFound(_0x3e6db6,null))[_0xff79('0x26')](respondWithResult(_0x3e6db6,null))[_0xff79('0x44')](handleError(_0x3e6db6,null));};exports['create']=function(_0x4ac749,_0x3fe31e){return db[_0xff79('0x2d')]['create'](_0x4ac749[_0xff79('0x48')],{})[_0xff79('0x26')](respondWithResult(_0x3fe31e,0xc9))[_0xff79('0x44')](handleError(_0x3fe31e,null));};exports['update']=function(_0x6c6995,_0x3eed0e){if(_0x6c6995[_0xff79('0x48')]['id']){delete _0x6c6995[_0xff79('0x48')]['id'];}return db[_0xff79('0x2d')][_0xff79('0x47')]({'where':{'id':_0x6c6995[_0xff79('0x49')]['id']}})['then'](handleEntityNotFound(_0x3eed0e,null))['then'](saveUpdates(_0x6c6995[_0xff79('0x48')],null))[_0xff79('0x26')](respondWithResult(_0x3eed0e,null))[_0xff79('0x44')](handleError(_0x3eed0e,null));};exports[_0xff79('0x25')]=function(_0x1d62d3,_0x1756b0){return db['ChatInternalMessage'][_0xff79('0x47')]({'where':{'id':_0x1d62d3[_0xff79('0x49')]['id']}})['then'](handleEntityNotFound(_0x1756b0,null))[_0xff79('0x26')](removeEntity(_0x1756b0,null))[_0xff79('0x44')](handleError(_0x1756b0,null));};exports[_0xff79('0x4a')]=function(_0x2516be,_0xa10563){return db['ChatInternalMessage'][_0xff79('0x4a')]()[_0xff79('0x26')](respondWithResult(_0xa10563,null))['catch'](handleError(_0xa10563,null));};function wrapUser(_0x451021){return function(_0x538b37){var _0x237f45=_0x451021[_0xff79('0x4b')]({'plain':!![]});_0x237f45[_0xff79('0x4c')]=[];if(_0x538b37){_0x237f45[_0xff79('0x4d')]=_0x538b37[_0xff79('0x4e')];_0x237f45[_0xff79('0x4f')]=_0x538b37;}else{_0x237f45[_0xff79('0x4d')]=moment(0x0)[_0xff79('0x50')](_0xff79('0x51'));_0x237f45[_0xff79('0x4f')]={};}return _0x237f45;};}exports[_0xff79('0x52')]=function(_0x1fa9dc,_0x3cbd81,_0x47481){var _0x1f8a86=[];return db[_0xff79('0x53')][_0xff79('0x43')]({'where':{'role':[_0xff79('0x54'),_0xff79('0x55'),_0xff79('0x56')]},'attributes':['id','fullname',_0xff79('0x29'),_0xff79('0x57'),_0xff79('0x58'),_0xff79('0x59'),_0xff79('0x5a'),_0xff79('0x5b'),_0xff79('0x5c'),_0xff79('0x5d')],'order':qs['sort'](_0xff79('0x5e')),'include':[{'model':db[_0xff79('0x5f')],'as':_0xff79('0x60'),'attributes':['id',_0xff79('0x29'),_0xff79('0x30')],'through':{'attributes':[]}}]})[_0xff79('0x26')](function(_0x34b358){if(_0x34b358){var _0x3e4ba8=_0x1fa9dc[_0xff79('0x56')][_0xff79('0x4b')]({'plain':!![]});if(!_0x3e4ba8)throw new Error(_0xff79('0x61'));if(_0x3e4ba8[_0xff79('0x57')]===_0xff79('0x56')){return db[_0xff79('0x62')]['find']({'where':{'name':_0xff79('0x63'),'userProfileId':_0x3e4ba8['userProfileId']},'raw':!![]})[_0xff79('0x26')](function(_0xcd3bfb){if(_0xcd3bfb){if(_0xcd3bfb[_0xff79('0x64')]===0x0){return db[_0xff79('0x65')]['findAll']({'where':{'sectionId':_0xcd3bfb['id']},'raw':!![]})[_0xff79('0x26')](function(_0x3d32b4){var _0x1d5442=[];if(_[_0xff79('0x66')](_0x3d32b4)){_0x1d5442=_['filter'](_0x34b358,function(_0x219874){if(_0x219874[_0xff79('0x57')]!==_0xff79('0x54')){return _0x219874;}});return _0x1d5442;}else{for(var _0x551348=0x0;_0x551348<_0x34b358['length'];_0x551348++){var _0x255684=_0x34b358[_0x551348];if(_0x255684[_0xff79('0x57')]===_0xff79('0x54')){var _0x1327d1=_[_0xff79('0x47')](_0x3d32b4,function(_0x2ab86f){return _0x2ab86f[_0xff79('0x67')]===_0x255684['id'];});if(_0x1327d1)_0x1d5442[_0xff79('0x68')](_0x255684);}else{_0x1d5442[_0xff79('0x68')](_0x255684);}}return _0x1d5442;}});}else{return _0x34b358;}}else{var _0x407209=_[_0xff79('0x3d')](_0x34b358,function(_0x16d73c){if(_0x16d73c[_0xff79('0x57')]!=='agent'){return _0x16d73c;}});return _0x407209;}});}else{return _0x34b358;}}})[_0xff79('0x26')](function(_0x241d92){var _0x5d1a89=[];if(_0x241d92){_0x1f8a86=_0x241d92;for(var _0x402fdd=0x0;_0x402fdd<_0x241d92[_0xff79('0x37')];_0x402fdd+=0x1){_0x1f8a86[_0x402fdd][_0xff79('0x4c')]=[];_0x5d1a89[_0xff79('0x68')](db[_0xff79('0x2d')][_0xff79('0x47')]({'where':{'FromId':[_0x1fa9dc['user']['id'],_0x241d92[_0x402fdd]['id']],'ToId':[_0x1fa9dc['user']['id'],_0x241d92[_0x402fdd]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId','ToId',_0xff79('0x69'),'body'],'order':qs[_0xff79('0x3a')](_0xff79('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xff79('0x26')](wrapUser(_0x241d92[_0x402fdd])));}return BPromise[_0xff79('0x6b')](_0x5d1a89);}return[];})['then'](function(_0x191b23){return{'rows':_0x191b23,'count':_0x191b23[_0xff79('0x37')]};})['then'](respondWithResult(_0x3cbd81,null))[_0xff79('0x44')](handleError(_0x3cbd81,null));}; \ No newline at end of file +var _0xb50e=['VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','agent','resourceId','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','ChatInternalMessage','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','User','user','fullname','role','internal','lastLoginAt','-online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb50e,0x1c0));var _0xeb50=function(_0x58e389,_0x3ab426){_0x58e389=_0x58e389-0x0;var _0x1437df=_0xb50e[_0x58e389];return _0x1437df;};'use strict';var emlformat=require(_0xeb50('0x0'));var rimraf=require(_0xeb50('0x1'));var zipdir=require(_0xeb50('0x2'));var jsonpatch=require(_0xeb50('0x3'));var rp=require(_0xeb50('0x4'));var moment=require(_0xeb50('0x5'));var BPromise=require(_0xeb50('0x6'));var Mustache=require(_0xeb50('0x7'));var util=require(_0xeb50('0x8'));var path=require(_0xeb50('0x9'));var sox=require(_0xeb50('0xa'));var csv=require(_0xeb50('0xb'));var ejs=require(_0xeb50('0xc'));var fs=require('fs');var fs_extra=require(_0xeb50('0xd'));var _=require(_0xeb50('0xe'));var squel=require(_0xeb50('0xf'));var crypto=require(_0xeb50('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb50('0x11'));var Papa=require('papaparse');var Redis=require(_0xeb50('0x12'));var authService=require(_0xeb50('0x13'));var qs=require(_0xeb50('0x14'));var as=require(_0xeb50('0x15'));var hardwareService=require(_0xeb50('0x16'));var logger=require(_0xeb50('0x17'))(_0xeb50('0x18'));var utils=require(_0xeb50('0x19'));var config=require(_0xeb50('0x1a'));var licenseUtil=require(_0xeb50('0x1b'));var db=require(_0xeb50('0x1c'))['db'];config[_0xeb50('0x1d')]=_[_0xeb50('0x1e')](config[_0xeb50('0x1d')],{'host':_0xeb50('0x1f'),'port':0x18eb});var socket=require(_0xeb50('0x20'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xeb50('0x21')](socket);function respondWithStatusCode(_0x44746b,_0x3a26a1){_0x3a26a1=_0x3a26a1||0xcc;return function(_0x5ca221){if(_0x5ca221){return _0x44746b[_0xeb50('0x22')](_0x3a26a1);}return _0x44746b[_0xeb50('0x23')](_0x3a26a1)['end']();};}function respondWithResult(_0x79a31e,_0x4f761f){_0x4f761f=_0x4f761f||0xc8;return function(_0x559c1a){if(_0x559c1a){return _0x79a31e[_0xeb50('0x23')](_0x4f761f)[_0xeb50('0x24')](_0x559c1a);}};}function respondWithFilteredResult(_0x3809a1,_0x152080){return function(_0x3238e3){if(_0x3238e3){var _0x259e82=typeof _0x152080[_0xeb50('0x25')]==='undefined'&&typeof _0x152080['limit']==='undefined';var _0x11b546=_0x3238e3['count'];var _0x124282=_0x259e82?0x0:_0x152080[_0xeb50('0x25')];var _0x2f64de=_0x259e82?_0x3238e3[_0xeb50('0x26')]:_0x152080[_0xeb50('0x25')]+_0x152080[_0xeb50('0x27')];var _0x3f6651;if(_0x2f64de>=_0x11b546){_0x2f64de=_0x11b546;_0x3f6651=0xc8;}else{_0x3f6651=0xce;}_0x3809a1[_0xeb50('0x23')](_0x3f6651);return _0x3809a1[_0xeb50('0x28')](_0xeb50('0x29'),_0x124282+'-'+_0x2f64de+'/'+_0x11b546)['json'](_0x3238e3);}return null;};}function patchUpdates(_0x3b6860){return function(_0x5c9809){try{jsonpatch[_0xeb50('0x2a')](_0x5c9809,_0x3b6860,!![]);}catch(_0x4da4e4){return BPromise['reject'](_0x4da4e4);}return _0x5c9809[_0xeb50('0x2b')]();};}function saveUpdates(_0x2ec3f8,_0x3cabc2){return function(_0x352dd1){if(_0x352dd1){return _0x352dd1['update'](_0x2ec3f8)[_0xeb50('0x2c')](function(_0x59313b){return _0x59313b;});}return null;};}function removeEntity(_0x301aeb,_0x2747ab){return function(_0x4d652e){if(_0x4d652e){return _0x4d652e[_0xeb50('0x2d')]()[_0xeb50('0x2c')](function(){_0x301aeb[_0xeb50('0x23')](0xcc)[_0xeb50('0x2e')]();});}};}function handleEntityNotFound(_0x19d288,_0x6c8cfc){return function(_0xb9b4db){if(!_0xb9b4db){_0x19d288[_0xeb50('0x22')](0x194);}return _0xb9b4db;};}function handleError(_0x3a7630,_0x252990){_0x252990=_0x252990||0x1f4;return function(_0x254949){logger[_0xeb50('0x2f')](_0x254949[_0xeb50('0x30')]);if(_0x254949[_0xeb50('0x31')]){delete _0x254949[_0xeb50('0x31')];}_0x3a7630[_0xeb50('0x23')](_0x252990)['send'](_0x254949);};}exports[_0xeb50('0x32')]=function(_0x51e92b,_0x22479a){var _0xb20ec3={},_0x2ce348={},_0xf1019c={'count':0x0,'rows':[]};var _0x512acb=_[_0xeb50('0x33')](db[_0xeb50('0x34')]['rawAttributes'],function(_0x1268b6){return{'name':_0x1268b6['fieldName'],'type':_0x1268b6['type'][_0xeb50('0x35')]};});_0x2ce348[_0xeb50('0x36')]=_[_0xeb50('0x33')](_0x512acb,_0xeb50('0x31'));_0x2ce348[_0xeb50('0x37')]=_[_0xeb50('0x38')](_0x51e92b[_0xeb50('0x37')]);_0x2ce348[_0xeb50('0x39')]=_[_0xeb50('0x3a')](_0x2ce348['model'],_0x2ce348[_0xeb50('0x37')]);_0xb20ec3[_0xeb50('0x3b')]=_[_0xeb50('0x3a')](_0x2ce348['model'],qs['fields'](_0x51e92b[_0xeb50('0x37')][_0xeb50('0x3c')]));_0xb20ec3[_0xeb50('0x3b')]=_0xb20ec3[_0xeb50('0x3b')]['length']?_0xb20ec3[_0xeb50('0x3b')]:_0x2ce348[_0xeb50('0x36')];if(!_0x51e92b['query'][_0xeb50('0x3d')](_0xeb50('0x3e'))){_0xb20ec3[_0xeb50('0x27')]=qs[_0xeb50('0x27')](_0x51e92b['query'][_0xeb50('0x27')]);_0xb20ec3[_0xeb50('0x25')]=qs[_0xeb50('0x25')](_0x51e92b['query'][_0xeb50('0x25')]);}_0xb20ec3[_0xeb50('0x3f')]=qs[_0xeb50('0x40')](_0x51e92b[_0xeb50('0x37')]['sort']);_0xb20ec3['where']=qs[_0xeb50('0x39')](_[_0xeb50('0x41')](_0x51e92b[_0xeb50('0x37')],_0x2ce348[_0xeb50('0x39')]),_0x512acb);if(_0x51e92b[_0xeb50('0x37')][_0xeb50('0x42')]){_0xb20ec3[_0xeb50('0x43')]=_[_0xeb50('0x44')](_0xb20ec3['where'],{'$or':_[_0xeb50('0x33')](_0x512acb,function(_0x1514e7){if(_0x1514e7[_0xeb50('0x45')]!=='VIRTUAL'){var _0x562a67={};_0x562a67[_0x1514e7[_0xeb50('0x31')]]={'$like':'%'+_0x51e92b[_0xeb50('0x37')]['filter']+'%'};return _0x562a67;}})});}_0xb20ec3=_[_0xeb50('0x44')]({},_0xb20ec3,_0x51e92b[_0xeb50('0x46')]);var _0x4e8349={'where':_0xb20ec3[_0xeb50('0x43')]};return db[_0xeb50('0x34')]['count'](_0x4e8349)[_0xeb50('0x2c')](function(_0x1ad1dc){_0xf1019c[_0xeb50('0x26')]=_0x1ad1dc;if(_0x51e92b[_0xeb50('0x37')][_0xeb50('0x47')]){_0xb20ec3['include']=[{'all':!![]}];}return db[_0xeb50('0x34')][_0xeb50('0x48')](_0xb20ec3);})[_0xeb50('0x2c')](function(_0x294dcf){_0xf1019c[_0xeb50('0x49')]=_0x294dcf;return _0xf1019c;})[_0xeb50('0x2c')](respondWithFilteredResult(_0x22479a,_0xb20ec3))[_0xeb50('0x4a')](handleError(_0x22479a,null));};exports[_0xeb50('0x4b')]=function(_0x5205af,_0x5c237a){var _0x17cdd0={'raw':!![],'where':{'id':_0x5205af[_0xeb50('0x4c')]['id']}},_0x2d06b1={};_0x2d06b1[_0xeb50('0x36')]=_['keys'](db['ChatInternalMessage'][_0xeb50('0x4d')]);_0x2d06b1[_0xeb50('0x37')]=_['keys'](_0x5205af[_0xeb50('0x37')]);_0x2d06b1['filters']=_[_0xeb50('0x3a')](_0x2d06b1['model'],_0x2d06b1[_0xeb50('0x37')]);_0x17cdd0[_0xeb50('0x3b')]=_[_0xeb50('0x3a')](_0x2d06b1[_0xeb50('0x36')],qs[_0xeb50('0x3c')](_0x5205af[_0xeb50('0x37')][_0xeb50('0x3c')]));_0x17cdd0[_0xeb50('0x3b')]=_0x17cdd0[_0xeb50('0x3b')][_0xeb50('0x4e')]?_0x17cdd0['attributes']:_0x2d06b1[_0xeb50('0x36')];if(_0x5205af[_0xeb50('0x37')]['includeAll']){_0x17cdd0[_0xeb50('0x4f')]=[{'all':!![]}];}_0x17cdd0=_[_0xeb50('0x44')]({},_0x17cdd0,_0x5205af[_0xeb50('0x46')]);return db[_0xeb50('0x34')][_0xeb50('0x50')](_0x17cdd0)[_0xeb50('0x2c')](handleEntityNotFound(_0x5c237a,null))[_0xeb50('0x2c')](respondWithResult(_0x5c237a,null))['catch'](handleError(_0x5c237a,null));};exports[_0xeb50('0x51')]=function(_0x3f45af,_0x3b7841){return db[_0xeb50('0x34')]['create'](_0x3f45af[_0xeb50('0x52')],{})[_0xeb50('0x2c')](respondWithResult(_0x3b7841,0xc9))[_0xeb50('0x4a')](handleError(_0x3b7841,null));};exports['update']=function(_0x17d4b4,_0x2f7576){if(_0x17d4b4['body']['id']){delete _0x17d4b4[_0xeb50('0x52')]['id'];}return db[_0xeb50('0x34')][_0xeb50('0x50')]({'where':{'id':_0x17d4b4['params']['id']}})[_0xeb50('0x2c')](handleEntityNotFound(_0x2f7576,null))[_0xeb50('0x2c')](saveUpdates(_0x17d4b4['body'],null))[_0xeb50('0x2c')](respondWithResult(_0x2f7576,null))[_0xeb50('0x4a')](handleError(_0x2f7576,null));};exports[_0xeb50('0x2d')]=function(_0x4d96c4,_0x55f8c1){return db[_0xeb50('0x34')][_0xeb50('0x50')]({'where':{'id':_0x4d96c4['params']['id']}})[_0xeb50('0x2c')](handleEntityNotFound(_0x55f8c1,null))[_0xeb50('0x2c')](removeEntity(_0x55f8c1,null))[_0xeb50('0x4a')](handleError(_0x55f8c1,null));};exports[_0xeb50('0x53')]=function(_0x61e720,_0x2b1675){return db['ChatInternalMessage'][_0xeb50('0x53')]()[_0xeb50('0x2c')](respondWithResult(_0x2b1675,null))[_0xeb50('0x4a')](handleError(_0x2b1675,null));};function wrapUser(_0x14ca3b){return function(_0x341d17){var _0x37cae6=_0x14ca3b[_0xeb50('0x54')]({'plain':!![]});_0x37cae6[_0xeb50('0x55')]=[];if(_0x341d17){_0x37cae6[_0xeb50('0x56')]=_0x341d17[_0xeb50('0x57')];_0x37cae6[_0xeb50('0x58')]=_0x341d17;}else{_0x37cae6[_0xeb50('0x56')]=moment(0x0)[_0xeb50('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x37cae6[_0xeb50('0x58')]={};}return _0x37cae6;};}exports['getUsers']=function(_0xa69f1c,_0x1e3c58,_0x477e00){var _0x1b4319=[];return db[_0xeb50('0x5a')][_0xeb50('0x48')]({'where':{'role':['agent','admin',_0xeb50('0x5b')]},'attributes':['id',_0xeb50('0x5c'),_0xeb50('0x31'),_0xeb50('0x5d'),'userpic',_0xeb50('0x5e'),'online',_0xeb50('0x5f'),'allowmessenger','showWebBar'],'order':qs[_0xeb50('0x40')](_0xeb50('0x60')),'include':[{'model':db[_0xeb50('0x61')],'as':'VoiceQueues','attributes':['id',_0xeb50('0x31'),_0xeb50('0x45')],'through':{'attributes':[]}}]})[_0xeb50('0x2c')](function(_0x1f1a67){if(_0x1f1a67){var _0x15058b=_0xa69f1c[_0xeb50('0x5b')]['get']({'plain':!![]});if(!_0x15058b)throw new Error(_0xeb50('0x62'));if(_0x15058b[_0xeb50('0x5d')]===_0xeb50('0x5b')){return db[_0xeb50('0x63')][_0xeb50('0x50')]({'where':{'name':'Agents','userProfileId':_0x15058b[_0xeb50('0x64')]},'raw':!![]})[_0xeb50('0x2c')](function(_0x5f07cd){if(_0x5f07cd){if(_0x5f07cd['autoAssociation']===0x0){return db[_0xeb50('0x65')][_0xeb50('0x48')]({'where':{'sectionId':_0x5f07cd['id']},'raw':!![]})[_0xeb50('0x2c')](function(_0xc84453){var _0x56baba=[];if(_['isEmpty'](_0xc84453)){_0x56baba=_[_0xeb50('0x42')](_0x1f1a67,function(_0x532cd7){if(_0x532cd7['role']!==_0xeb50('0x66')){return _0x532cd7;}});return _0x56baba;}else{for(var _0xe0688b=0x0;_0xe0688b<_0x1f1a67[_0xeb50('0x4e')];_0xe0688b++){var _0x12258d=_0x1f1a67[_0xe0688b];if(_0x12258d[_0xeb50('0x5d')]===_0xeb50('0x66')){var _0x3a0e8b=_[_0xeb50('0x50')](_0xc84453,function(_0x49c9da){return _0x49c9da[_0xeb50('0x67')]===_0x12258d['id'];});if(_0x3a0e8b)_0x56baba[_0xeb50('0x68')](_0x12258d);}else{_0x56baba['push'](_0x12258d);}}return _0x56baba;}});}else{return _0x1f1a67;}}else{var _0x26a14e=_[_0xeb50('0x42')](_0x1f1a67,function(_0x5654d3){if(_0x5654d3[_0xeb50('0x5d')]!==_0xeb50('0x66')){return _0x5654d3;}});return _0x26a14e;}});}else{return _0x1f1a67;}}})[_0xeb50('0x2c')](function(_0x5827c0){var _0x4d8da7=[];if(_0x5827c0){_0x1b4319=_0x5827c0;for(var _0x4e8904=0x0;_0x4e8904<_0x5827c0[_0xeb50('0x4e')];_0x4e8904+=0x1){_0x1b4319[_0x4e8904][_0xeb50('0x55')]=[];_0x4d8da7[_0xeb50('0x68')](db[_0xeb50('0x34')][_0xeb50('0x50')]({'where':{'FromId':[_0xa69f1c[_0xeb50('0x5b')]['id'],_0x5827c0[_0x4e8904]['id']],'ToId':[_0xa69f1c[_0xeb50('0x5b')]['id'],_0x5827c0[_0x4e8904]['id']],'ChatGroupId':null},'attributes':['id',_0xeb50('0x57'),_0xeb50('0x69'),_0xeb50('0x6a'),_0xeb50('0x6b'),'body'],'order':qs['sort'](_0xeb50('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5827c0[_0x4e8904])));}return BPromise['all'](_0x4d8da7);}return[];})[_0xeb50('0x2c')](function(_0x55d430){return{'rows':_0x55d430,'count':_0x55d430[_0xeb50('0x4e')]};})[_0xeb50('0x2c')](respondWithResult(_0x1e3c58,null))[_0xeb50('0x4a')](handleError(_0x1e3c58,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 01b9fbe..a065cd4 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 _0xbcc2=['emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x4616b8,_0x18d11e){var _0x4fe895=function(_0x212fa7){while(--_0x212fa7){_0x4616b8['push'](_0x4616b8['shift']());}};_0x4fe895(++_0x18d11e);}(_0xbcc2,0x150));var _0x2bcc=function(_0x3f43fa,_0x1ccd65){_0x3f43fa=_0x3f43fa-0x0;var _0x3cf4bb=_0xbcc2[_0x3f43fa];return _0x3cf4bb;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x2bcc('0x0'))['db'][_0x2bcc('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2bcc('0x2')](0x0);var events={'afterCreate':_0x2bcc('0x3'),'afterUpdate':_0x2bcc('0x4'),'afterDestroy':_0x2bcc('0x5')};function emitEvent(_0x474025){return function(_0x2ca34b,_0x3c232b,_0x2ba3bb){ChatInternalMessageEvents[_0x2bcc('0x6')](_0x474025+':'+_0x2ca34b['id'],_0x2ca34b);ChatInternalMessageEvents[_0x2bcc('0x6')](_0x474025,_0x2ca34b);_0x2ba3bb(null);};}for(var e in events){if(events[_0x2bcc('0x7')](e)){var event=events[e];ChatInternalMessage[_0x2bcc('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x26fb=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3869c0,_0x293139){var _0x58fed5=function(_0xa44a1d){while(--_0xa44a1d){_0x3869c0['push'](_0x3869c0['shift']());}};_0x58fed5(++_0x293139);}(_0x26fb,0x1f4));var _0xb26f=function(_0x37bf43,_0x5b2339){_0x37bf43=_0x37bf43-0x0;var _0x4101c5=_0x26fb[_0x37bf43];return _0x4101c5;};'use strict';var EventEmitter=require(_0xb26f('0x0'));var ChatInternalMessage=require(_0xb26f('0x1'))['db'][_0xb26f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb26f('0x3')](0x0);var events={'afterCreate':_0xb26f('0x4'),'afterUpdate':_0xb26f('0x5'),'afterDestroy':_0xb26f('0x6')};function emitEvent(_0x150c69){return function(_0x5ac713,_0xa7193e,_0x1c50e8){ChatInternalMessageEvents[_0xb26f('0x7')](_0x150c69+':'+_0x5ac713['id'],_0x5ac713);ChatInternalMessageEvents[_0xb26f('0x7')](_0x150c69,_0x5ac713);_0x1c50e8(null);};}for(var e in events){if(events[_0xb26f('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xb26f('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b7439e2..99e489b 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 _0xb831=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb831,0x196));var _0x1b83=function(_0x2f037f,_0x2958c5){_0x2f037f=_0x2f037f-0x0;var _0x2d1573=_0xb831[_0x2f037f];return _0x2d1573;};'use strict';var _=require(_0x1b83('0x0'));var util=require(_0x1b83('0x1'));var logger=require(_0x1b83('0x2'))(_0x1b83('0x3'));var moment=require(_0x1b83('0x4'));var BPromise=require(_0x1b83('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b83('0x6'));var config=require(_0x1b83('0x7'));var attributes=require(_0x1b83('0x8'));module[_0x1b83('0x9')]=function(_0x64eae,_0x323392){return _0x64eae['define'](_0x1b83('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1b83('0xb')});}; \ No newline at end of file +var _0x1973=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x1973,0x74));var _0x3197=function(_0x34b410,_0x571fe7){_0x34b410=_0x34b410-0x0;var _0x5df540=_0x1973[_0x34b410];return _0x5df540;};'use strict';var _=require(_0x3197('0x0'));var util=require(_0x3197('0x1'));var logger=require(_0x3197('0x2'))(_0x3197('0x3'));var moment=require(_0x3197('0x4'));var BPromise=require(_0x3197('0x5'));var rp=require(_0x3197('0x6'));var fs=require('fs');var path=require(_0x3197('0x7'));var rimraf=require(_0x3197('0x8'));var config=require(_0x3197('0x9'));var attributes=require(_0x3197('0xa'));module[_0x3197('0xb')]=function(_0x62dd41,_0x5307aa){return _0x62dd41[_0x3197('0xc')](_0x3197('0xd'),attributes,{'tableName':_0x3197('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3197('0xf'),'collate':_0x3197('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1dd830d..9b70b2d 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 _0x5034=['error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x1d0c7e,_0x40b36c){var _0x30cf02=function(_0x2c8b55){while(--_0x2c8b55){_0x1d0c7e['push'](_0x1d0c7e['shift']());}};_0x30cf02(++_0x40b36c);}(_0x5034,0x8d));var _0x4503=function(_0x8ce10d,_0x77ee79){_0x8ce10d=_0x8ce10d-0x0;var _0x8facb1=_0x5034[_0x8ce10d];return _0x8facb1;};'use strict';var _=require(_0x4503('0x0'));var util=require(_0x4503('0x1'));var moment=require(_0x4503('0x2'));var BPromise=require('bluebird');var rs=require(_0x4503('0x3'));var fs=require('fs');var Redis=require(_0x4503('0x4'));var db=require(_0x4503('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4503('0x6'))(_0x4503('0x7'));var config=require(_0x4503('0x8'));var jayson=require(_0x4503('0x9'));var client=jayson[_0x4503('0xa')]['http']({'port':0x232a});config['redis']=_[_0x4503('0xb')](config[_0x4503('0xc')],{'host':_0x4503('0xd'),'port':0x18eb});var socket=require(_0x4503('0xe'))(new Redis(config[_0x4503('0xc')]));require('./chatInternalMessage.socket')[_0x4503('0xf')](socket);function respondWithRpcPromise(_0x29150e,_0x1b5be7,_0x302ed4){return new BPromise(function(_0x4e9737,_0x578d35){return client[_0x4503('0x10')](_0x29150e,_0x302ed4)[_0x4503('0x11')](function(_0x260eef){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x1b5be7,_0x4503('0x12'));logger[_0x4503('0x13')](_0x4503('0x14'),_0x1b5be7,_0x4503('0x12'),JSON['stringify'](_0x260eef));if(_0x260eef[_0x4503('0x15')]){if(_0x260eef['error'][_0x4503('0x16')]===0x1f4){logger[_0x4503('0x15')](_0x4503('0x17'),_0x1b5be7,_0x260eef[_0x4503('0x15')][_0x4503('0x18')]);return _0x578d35(_0x260eef['error'][_0x4503('0x18')]);}logger['error'](_0x4503('0x17'),_0x1b5be7,_0x260eef[_0x4503('0x15')][_0x4503('0x18')]);return _0x4e9737(_0x260eef[_0x4503('0x15')]['message']);}else{logger[_0x4503('0x19')](_0x4503('0x17'),_0x1b5be7,'request\x20sent');_0x4e9737(_0x260eef[_0x4503('0x1a')][_0x4503('0x18')]);}})['catch'](function(_0x5abf44){logger[_0x4503('0x15')](_0x4503('0x17'),_0x1b5be7,_0x5abf44);_0x578d35(_0x5abf44);});});} \ No newline at end of file +var _0x8f4e=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x8f4e,0x149));var _0xe8f4=function(_0x2954e5,_0x5f04b9){_0x2954e5=_0x2954e5-0x0;var _0x4b4deb=_0x8f4e[_0x2954e5];return _0x4b4deb;};'use strict';var _=require(_0xe8f4('0x0'));var util=require('util');var moment=require(_0xe8f4('0x1'));var BPromise=require(_0xe8f4('0x2'));var rs=require(_0xe8f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8f4('0x4'))['db'];var utils=require(_0xe8f4('0x5'));var logger=require(_0xe8f4('0x6'))(_0xe8f4('0x7'));var config=require(_0xe8f4('0x8'));var jayson=require(_0xe8f4('0x9'));var client=jayson['client'][_0xe8f4('0xa')]({'port':0x232a});config[_0xe8f4('0xb')]=_[_0xe8f4('0xc')](config[_0xe8f4('0xb')],{'host':_0xe8f4('0xd'),'port':0x18eb});var socket=require(_0xe8f4('0xe'))(new Redis(config[_0xe8f4('0xb')]));require(_0xe8f4('0xf'))[_0xe8f4('0x10')](socket);function respondWithRpcPromise(_0x5cce05,_0x5459e4,_0x525340){return new BPromise(function(_0x417426,_0x410a12){return client['request'](_0x5cce05,_0x525340)['then'](function(_0x6a15f){logger[_0xe8f4('0x11')](_0xe8f4('0x12'),_0x5459e4,_0xe8f4('0x13'));logger[_0xe8f4('0x14')](_0xe8f4('0x15'),_0x5459e4,_0xe8f4('0x13'),JSON[_0xe8f4('0x16')](_0x6a15f));if(_0x6a15f['error']){if(_0x6a15f[_0xe8f4('0x17')]['code']===0x1f4){logger[_0xe8f4('0x17')](_0xe8f4('0x12'),_0x5459e4,_0x6a15f[_0xe8f4('0x17')][_0xe8f4('0x18')]);return _0x410a12(_0x6a15f[_0xe8f4('0x17')][_0xe8f4('0x18')]);}logger['error'](_0xe8f4('0x12'),_0x5459e4,_0x6a15f['error']['message']);return _0x417426(_0x6a15f[_0xe8f4('0x17')][_0xe8f4('0x18')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x5459e4,'request\x20sent');_0x417426(_0x6a15f['result'][_0xe8f4('0x18')]);}})['catch'](function(_0x303258){logger['error'](_0xe8f4('0x12'),_0x5459e4,_0x303258);_0x410a12(_0x303258);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index eca6fc9..375e06d 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 _0x212d=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x212d,0x68));var _0xd212=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x212d[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0xd212('0x0'));var events=[_0xd212('0x1'),_0xd212('0x2'),_0xd212('0x3')];function createListener(_0x1876dd,_0x4e2eb7){return function(_0x3bf34c){_0x4e2eb7[_0xd212('0x4')](_0x1876dd,_0x3bf34c);};}function removeListener(_0x1d8766,_0x59736){return function(){ChatInternalMessageEvents[_0xd212('0x5')](_0x1d8766,_0x59736);};}exports[_0xd212('0x6')]=function(_0x7b88c9){for(var _0x4ae68a=0x0,_0x43e7c6=events[_0xd212('0x7')];_0x4ae68a<_0x43e7c6;_0x4ae68a++){var _0x3c182a=events[_0x4ae68a];var _0x2d7de5=createListener(_0xd212('0x8')+_0x3c182a,_0x7b88c9);ChatInternalMessageEvents['on'](_0x3c182a,_0x2d7de5);}}; \ No newline at end of file +var _0x9f2f=['chatInternalMessage:','save','remove','update','emit','removeListener','length'];(function(_0x27443b,_0x263605){var _0x2e00c0=function(_0x5243d1){while(--_0x5243d1){_0x27443b['push'](_0x27443b['shift']());}};_0x2e00c0(++_0x263605);}(_0x9f2f,0x8d));var _0xf9f2=function(_0x168a17,_0x19e250){_0x168a17=_0x168a17-0x0;var _0x53229d=_0x9f2f[_0x168a17];return _0x53229d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xf9f2('0x0'),_0xf9f2('0x1'),_0xf9f2('0x2')];function createListener(_0x242e89,_0x45d024){return function(_0x56c904){_0x45d024[_0xf9f2('0x3')](_0x242e89,_0x56c904);};}function removeListener(_0x5cad40,_0x3f11bd){return function(){ChatInternalMessageEvents[_0xf9f2('0x4')](_0x5cad40,_0x3f11bd);};}exports['register']=function(_0x5c8ae0){for(var _0x2dd0f5=0x0,_0x127c9f=events[_0xf9f2('0x5')];_0x2dd0f5<_0x127c9f;_0x2dd0f5++){var _0x3f3da2=events[_0x2dd0f5];var _0x2e556b=createListener(_0xf9f2('0x6')+_0x3f3da2,_0x5c8ae0);ChatInternalMessageEvents['on'](_0x3f3da2,_0x2e556b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 39b2070..bb38f5e 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 _0x7fcf=['get','isAuthenticated','index','/describe','/users','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7fcf,0xb5));var _0xf7fc=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7fcf[_0x4709c0];return _0x13348b;};'use strict';var multer=require('multer');var util=require(_0xf7fc('0x0'));var path=require(_0xf7fc('0x1'));var timeout=require(_0xf7fc('0x2'));var express=require(_0xf7fc('0x3'));var router=express[_0xf7fc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf7fc('0x5'));var interaction=require(_0xf7fc('0x6'));var config=require(_0xf7fc('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xf7fc('0x8')]('/',auth[_0xf7fc('0x9')](),controller[_0xf7fc('0xa')]);router[_0xf7fc('0x8')](_0xf7fc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xf7fc('0x8')](_0xf7fc('0xc'),auth[_0xf7fc('0x9')](),controller['getUsers']);router[_0xf7fc('0x8')](_0xf7fc('0xd'),auth[_0xf7fc('0x9')](),controller[_0xf7fc('0xe')]);router[_0xf7fc('0xf')]('/',auth[_0xf7fc('0x9')](),controller[_0xf7fc('0x10')]);router[_0xf7fc('0x11')](_0xf7fc('0xd'),controller[_0xf7fc('0x12')]);router[_0xf7fc('0x13')](_0xf7fc('0xd'),auth[_0xf7fc('0x9')](),controller[_0xf7fc('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf3bb=['getUsers','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users'];(function(_0x14bec3,_0x5acbb9){var _0x5e0f53=function(_0x57bcf0){while(--_0x57bcf0){_0x14bec3['push'](_0x14bec3['shift']());}};_0x5e0f53(++_0x5acbb9);}(_0xf3bb,0x129));var _0xbf3b=function(_0x3aff2d,_0xa1cd35){_0x3aff2d=_0x3aff2d-0x0;var _0x410121=_0xf3bb[_0x3aff2d];return _0x410121;};'use strict';var multer=require(_0xbf3b('0x0'));var util=require(_0xbf3b('0x1'));var path=require(_0xbf3b('0x2'));var timeout=require(_0xbf3b('0x3'));var express=require(_0xbf3b('0x4'));var router=express[_0xbf3b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbf3b('0x6'));var interaction=require(_0xbf3b('0x7'));var config=require(_0xbf3b('0x8'));var controller=require(_0xbf3b('0x9'));router[_0xbf3b('0xa')]('/',auth[_0xbf3b('0xb')](),controller[_0xbf3b('0xc')]);router[_0xbf3b('0xa')](_0xbf3b('0xd'),auth[_0xbf3b('0xb')](),controller['describe']);router[_0xbf3b('0xa')](_0xbf3b('0xe'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0xf')]);router['get'](_0xbf3b('0x10'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0x11')]);router[_0xbf3b('0x12')]('/',auth[_0xbf3b('0xb')](),controller[_0xbf3b('0x13')]);router[_0xbf3b('0x14')](_0xbf3b('0x10'),controller[_0xbf3b('0x15')]);router['delete'](_0xbf3b('0x10'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0x16')]);module[_0xbf3b('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 37ea59f..63d7f0f 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 _0x3266=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4df19,_0x32dbdc){var _0x1b7bab=function(_0x1baae2){while(--_0x1baae2){_0x4df19['push'](_0x4df19['shift']());}};_0x1b7bab(++_0x32dbdc);}(_0x3266,0x6a));var _0x6326=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x3266[_0xf2628e];return _0x13863a;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'body':{'type':Sequelize[_0x6326('0x2')](_0x6326('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6326('0x5')]('in',_0x6326('0x6')),'defaultValue':_0x6326('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6326('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1d21=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x1d21,0x158));var _0x11d2=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x1d21[_0x57f345];return _0x255e43;};'use strict';var Sequelize=require(_0x11d2('0x0'));module[_0x11d2('0x1')]={'body':{'type':Sequelize[_0x11d2('0x2')](_0x11d2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x11d2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x11d2('0x5')]('in',_0x11d2('0x6')),'defaultValue':_0x11d2('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x11d2('0x7')]},'providerResponse':{'type':Sequelize[_0x11d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 11b80f3..b7bd341 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 _0x4c18=['RejectMessage','rejectMessage','Sequelize','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','name','send','map','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','manual','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions'];(function(_0x4be97b,_0x419fac){var _0x3b1f2a=function(_0x709fa2){while(--_0x709fa2){_0x4be97b['push'](_0x4be97b['shift']());}};_0x3b1f2a(++_0x419fac);}(_0x4c18,0x8c));var _0x84c1=function(_0x15a1e0,_0x229403){_0x15a1e0=_0x15a1e0-0x0;var _0x246430=_0x4c18[_0x15a1e0];return _0x246430;};'use strict';var emlformat=require(_0x84c1('0x0'));var rimraf=require(_0x84c1('0x1'));var zipdir=require(_0x84c1('0x2'));var jsonpatch=require(_0x84c1('0x3'));var rp=require(_0x84c1('0x4'));var moment=require(_0x84c1('0x5'));var BPromise=require(_0x84c1('0x6'));var Mustache=require(_0x84c1('0x7'));var util=require('util');var path=require(_0x84c1('0x8'));var sox=require(_0x84c1('0x9'));var csv=require(_0x84c1('0xa'));var ejs=require(_0x84c1('0xb'));var fs=require('fs');var fs_extra=require(_0x84c1('0xc'));var _=require(_0x84c1('0xd'));var squel=require(_0x84c1('0xe'));var crypto=require(_0x84c1('0xf'));var jsforce=require(_0x84c1('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x84c1('0xa'));var querystring=require(_0x84c1('0x11'));var Papa=require('papaparse');var Redis=require(_0x84c1('0x12'));var authService=require(_0x84c1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x84c1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84c1('0x15'))(_0x84c1('0x16'));var utils=require(_0x84c1('0x17'));var config=require(_0x84c1('0x18'));var licenseUtil=require(_0x84c1('0x19'));var db=require(_0x84c1('0x1a'))['db'];config[_0x84c1('0x1b')]=_[_0x84c1('0x1c')](config['redis'],{'host':_0x84c1('0x1d'),'port':0x18eb});var socket=require(_0x84c1('0x1e'))(new Redis(config[_0x84c1('0x1b')]));require(_0x84c1('0x1f'))[_0x84c1('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x84c1('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x84c1('0x21')][_0x84c1('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x22c2fd,_0xa6eba8,_0x59c3e8,_0x199a0c){return new BPromise(function(_0x483b0a,_0xd166e9){var _0x438c94=_0x199a0c||client;return _0x438c94[_0x84c1('0x23')](_0x22c2fd,_0x59c3e8)[_0x84c1('0x24')](function(_0x5e0c4f){logger[_0x84c1('0x25')](_0x84c1('0x26'),_0xa6eba8,_0x84c1('0x27'));logger[_0x84c1('0x28')](_0x84c1('0x29'),_0xa6eba8,_0x84c1('0x27'),JSON[_0x84c1('0x2a')](_0x5e0c4f));if(_0x5e0c4f['error']){if(_0x5e0c4f[_0x84c1('0x2b')][_0x84c1('0x2c')]===0x1f4){logger[_0x84c1('0x2b')](_0x84c1('0x26'),_0xa6eba8,_0x5e0c4f['error'][_0x84c1('0x2d')]);return _0xd166e9(_0x5e0c4f['error'][_0x84c1('0x2d')]);}logger['error'](_0x84c1('0x26'),_0xa6eba8,_0x5e0c4f[_0x84c1('0x2b')][_0x84c1('0x2d')]);return _0x483b0a(_0x5e0c4f[_0x84c1('0x2b')][_0x84c1('0x2d')]);}else{logger[_0x84c1('0x25')]('ChatMessage,\x20%s,\x20%s',_0xa6eba8,_0x84c1('0x27'));_0x483b0a(_0x5e0c4f['result'][_0x84c1('0x2d')]);}})['catch'](function(_0x37c587){logger['error'](_0x84c1('0x26'),_0xa6eba8,_0x37c587);_0xd166e9(_0x37c587);});});}function respondWithStatusCode(_0x5b4c21,_0x45c2b6){_0x45c2b6=_0x45c2b6||0xcc;return function(_0xf82a69){if(_0xf82a69){return _0x5b4c21[_0x84c1('0x2e')](_0x45c2b6);}return _0x5b4c21[_0x84c1('0x2f')](_0x45c2b6)[_0x84c1('0x30')]();};}function respondWithResult(_0x5bdb6a,_0x114cc3){_0x114cc3=_0x114cc3||0xc8;return function(_0xd7a6f0){if(_0xd7a6f0){return _0x5bdb6a[_0x84c1('0x2f')](_0x114cc3)['json'](_0xd7a6f0);}};}function respondWithFilteredResult(_0x1721fc,_0x34c2c9){return function(_0x30d6c1){if(_0x30d6c1){var _0x4a274e=typeof _0x34c2c9['offset']===_0x84c1('0x31')&&typeof _0x34c2c9[_0x84c1('0x32')]===_0x84c1('0x31');var _0x1c704f=_0x30d6c1[_0x84c1('0x33')];var _0xf8645a=_0x4a274e?0x0:_0x34c2c9['offset'];var _0x4b0d2f=_0x4a274e?_0x30d6c1[_0x84c1('0x33')]:_0x34c2c9[_0x84c1('0x34')]+_0x34c2c9[_0x84c1('0x32')];var _0x39efbc;if(_0x4b0d2f>=_0x1c704f){_0x4b0d2f=_0x1c704f;_0x39efbc=0xc8;}else{_0x39efbc=0xce;}_0x1721fc[_0x84c1('0x2f')](_0x39efbc);return _0x1721fc[_0x84c1('0x35')]('Content-Range',_0xf8645a+'-'+_0x4b0d2f+'/'+_0x1c704f)[_0x84c1('0x36')](_0x30d6c1);}return null;};}function patchUpdates(_0x32411e){return function(_0x59efc1){try{jsonpatch[_0x84c1('0x37')](_0x59efc1,_0x32411e,!![]);}catch(_0x4e85c0){return BPromise[_0x84c1('0x38')](_0x4e85c0);}return _0x59efc1[_0x84c1('0x39')]();};}function saveUpdates(_0x1fddbc,_0x5815b4){return function(_0x30c24f){if(_0x30c24f){return _0x30c24f[_0x84c1('0x3a')](_0x1fddbc)['then'](function(_0x54f574){return _0x54f574;});}return null;};}function removeEntity(_0x403fc5,_0x579d7d){return function(_0x481733){if(_0x481733){return _0x481733[_0x84c1('0x3b')]()[_0x84c1('0x24')](function(){_0x403fc5['status'](0xcc)[_0x84c1('0x30')]();});}};}function handleEntityNotFound(_0x5c4064,_0x43e6de){return function(_0x3b2080){if(!_0x3b2080){_0x5c4064[_0x84c1('0x2e')](0x194);}return _0x3b2080;};}function handleError(_0x4f7dce,_0x3d75fc){_0x3d75fc=_0x3d75fc||0x1f4;return function(_0xdf2508){logger[_0x84c1('0x2b')](_0xdf2508['stack']);if(_0xdf2508[_0x84c1('0x3c')]){delete _0xdf2508[_0x84c1('0x3c')];}_0x4f7dce[_0x84c1('0x2f')](_0x3d75fc)[_0x84c1('0x3d')](_0xdf2508);};}exports['index']=function(_0x477948,_0x40c005){var _0x34841f={},_0x1e6e64={},_0x1f97ea={'count':0x0,'rows':[]};var _0x1028bf=_[_0x84c1('0x3e')](db['ChatMessage']['rawAttributes'],function(_0x147341){return{'name':_0x147341['fieldName'],'type':_0x147341[_0x84c1('0x3f')][_0x84c1('0x40')]};});_0x1e6e64[_0x84c1('0x41')]=_[_0x84c1('0x3e')](_0x1028bf,_0x84c1('0x3c'));_0x1e6e64['query']=_['keys'](_0x477948[_0x84c1('0x42')]);_0x1e6e64['filters']=_[_0x84c1('0x43')](_0x1e6e64['model'],_0x1e6e64[_0x84c1('0x42')]);_0x34841f['attributes']=_['intersection'](_0x1e6e64['model'],qs[_0x84c1('0x44')](_0x477948[_0x84c1('0x42')][_0x84c1('0x44')]));_0x34841f[_0x84c1('0x45')]=_0x34841f[_0x84c1('0x45')][_0x84c1('0x46')]?_0x34841f[_0x84c1('0x45')]:_0x1e6e64[_0x84c1('0x41')];if(!_0x477948[_0x84c1('0x42')]['hasOwnProperty'](_0x84c1('0x47'))){_0x34841f[_0x84c1('0x32')]=qs[_0x84c1('0x32')](_0x477948[_0x84c1('0x42')]['limit']);_0x34841f[_0x84c1('0x34')]=qs[_0x84c1('0x34')](_0x477948[_0x84c1('0x42')][_0x84c1('0x34')]);}_0x34841f[_0x84c1('0x48')]=qs[_0x84c1('0x49')](_0x477948[_0x84c1('0x42')][_0x84c1('0x49')]);_0x34841f[_0x84c1('0x4a')]=qs['filters'](_[_0x84c1('0x4b')](_0x477948[_0x84c1('0x42')],_0x1e6e64[_0x84c1('0x4c')]),_0x1028bf);if(_0x477948['query'][_0x84c1('0x4d')]){_0x34841f[_0x84c1('0x4a')]=_[_0x84c1('0x4e')](_0x34841f['where'],{'$or':_[_0x84c1('0x3e')](_0x1028bf,function(_0x16c57b){if(_0x16c57b['type']!==_0x84c1('0x4f')){var _0x36361d={};_0x36361d[_0x16c57b[_0x84c1('0x3c')]]={'$like':'%'+_0x477948['query'][_0x84c1('0x4d')]+'%'};return _0x36361d;}})});}_0x34841f=_['merge']({},_0x34841f,_0x477948[_0x84c1('0x50')]);var _0x295c90={'where':_0x34841f[_0x84c1('0x4a')]};return db[_0x84c1('0x51')][_0x84c1('0x33')](_0x295c90)[_0x84c1('0x24')](function(_0x2cb22e){_0x1f97ea[_0x84c1('0x33')]=_0x2cb22e;if(_0x477948[_0x84c1('0x42')][_0x84c1('0x52')]){_0x34841f[_0x84c1('0x53')]=[{'all':!![]}];}return db[_0x84c1('0x51')][_0x84c1('0x54')](_0x34841f);})[_0x84c1('0x24')](function(_0x58211a){_0x1f97ea[_0x84c1('0x55')]=_0x58211a;return _0x1f97ea;})[_0x84c1('0x24')](respondWithFilteredResult(_0x40c005,_0x34841f))['catch'](handleError(_0x40c005,null));};exports[_0x84c1('0x56')]=function(_0x7b2cd8,_0xf509cf){var _0x46c5df={'raw':!![],'where':{'id':_0x7b2cd8[_0x84c1('0x57')]['id']}},_0x51a823={};_0x51a823[_0x84c1('0x41')]=_[_0x84c1('0x58')](db['ChatMessage'][_0x84c1('0x59')]);_0x51a823[_0x84c1('0x42')]=_[_0x84c1('0x58')](_0x7b2cd8[_0x84c1('0x42')]);_0x51a823['filters']=_[_0x84c1('0x43')](_0x51a823[_0x84c1('0x41')],_0x51a823['query']);_0x46c5df[_0x84c1('0x45')]=_[_0x84c1('0x43')](_0x51a823[_0x84c1('0x41')],qs['fields'](_0x7b2cd8[_0x84c1('0x42')][_0x84c1('0x44')]));_0x46c5df['attributes']=_0x46c5df[_0x84c1('0x45')][_0x84c1('0x46')]?_0x46c5df[_0x84c1('0x45')]:_0x51a823['model'];if(_0x7b2cd8[_0x84c1('0x42')][_0x84c1('0x52')]){_0x46c5df[_0x84c1('0x53')]=[{'all':!![]}];}_0x46c5df=_[_0x84c1('0x4e')]({},_0x46c5df,_0x7b2cd8[_0x84c1('0x50')]);return db[_0x84c1('0x51')][_0x84c1('0x5a')](_0x46c5df)['then'](handleEntityNotFound(_0xf509cf,null))[_0x84c1('0x24')](respondWithResult(_0xf509cf,null))[_0x84c1('0x5b')](handleError(_0xf509cf,null));};exports[_0x84c1('0x5c')]=function(_0x37de6d,_0x1b8a27){return db['ChatMessage'][_0x84c1('0x5c')](_0x37de6d[_0x84c1('0x5d')],{})[_0x84c1('0x24')](respondWithResult(_0x1b8a27,0xc9))[_0x84c1('0x5b')](handleError(_0x1b8a27,null));};exports[_0x84c1('0x3a')]=function(_0x179a91,_0x17e3d9){if(_0x179a91['body']['id']){delete _0x179a91['body']['id'];}return db[_0x84c1('0x51')][_0x84c1('0x5a')]({'where':{'id':_0x179a91[_0x84c1('0x57')]['id']}})[_0x84c1('0x24')](handleEntityNotFound(_0x17e3d9,null))[_0x84c1('0x24')](saveUpdates(_0x179a91[_0x84c1('0x5d')],null))[_0x84c1('0x24')](respondWithResult(_0x17e3d9,null))['catch'](handleError(_0x17e3d9,null));};exports[_0x84c1('0x3b')]=function(_0x346521,_0x52e15e){return db[_0x84c1('0x51')][_0x84c1('0x5a')]({'where':{'id':_0x346521[_0x84c1('0x57')]['id']}})[_0x84c1('0x24')](handleEntityNotFound(_0x52e15e,null))[_0x84c1('0x24')](removeEntity(_0x52e15e,null))['catch'](handleError(_0x52e15e,null));};exports[_0x84c1('0x5e')]=function(_0x3096dd,_0x45ca9b){return db['ChatMessage'][_0x84c1('0x5e')]()[_0x84c1('0x24')](respondWithResult(_0x45ca9b,null))[_0x84c1('0x5b')](handleError(_0x45ca9b,null));};var interaction_log=require(_0x84c1('0x15'))('chat-interactions');exports[_0x84c1('0x5f')]=function(_0x19da11,_0x1df2ea,_0x1644cd){var _0x341768={'agent':{},'channel':_0x84c1('0x60')};if(_0x19da11[_0x84c1('0x5d')]['id']){delete _0x19da11['body']['id'];}_0x19da11[_0x84c1('0x5d')][_0x84c1('0x61')]=!![];_0x19da11[_0x84c1('0x5d')]['readAt']=moment()[_0x84c1('0x62')](_0x84c1('0x63'));_0x19da11[_0x84c1('0x5d')][_0x84c1('0x64')]=_0x19da11[_0x84c1('0x5d')][_0x84c1('0x64')]||_0x19da11[_0x84c1('0x65')]['id'];_0x341768[_0x84c1('0x66')]['id']=_0x19da11[_0x84c1('0x5d')][_0x84c1('0x64')];return db[_0x84c1('0x51')][_0x84c1('0x5a')]({'where':{'id':_0x19da11['params']['id'],'UserId':null}})[_0x84c1('0x24')](handleEntityNotFound(_0x1df2ea,null))[_0x84c1('0x24')](saveUpdates(_0x19da11[_0x84c1('0x5d')],null))['then'](function(_0x2b80b6){if(_0x2b80b6){_0x341768[_0x84c1('0x2d')]=_0x2b80b6[_0x84c1('0x67')]({'plain':!![]});return db[_0x84c1('0x68')]['find']({'where':{'id':_0x2b80b6[_0x84c1('0x69')]}});}return null;})[_0x84c1('0x24')](handleEntityNotFound(_0x1df2ea,null))[_0x84c1('0x24')](function(_0x182df5){if(_0x182df5){return _0x182df5[_0x84c1('0x3a')]({'UserId':_0x19da11[_0x84c1('0x5d')]['UserId'],'read1stAt':_[_0x84c1('0x6a')](_0x182df5[_0x84c1('0x6b')])?moment()['format'](_0x84c1('0x63')):undefined});}return null;})[_0x84c1('0x24')](function(_0xb38387){if(_0xb38387){_0x341768[_0x84c1('0x6c')]=_0xb38387[_0x84c1('0x67')]({'plain':!![]});interaction_log['info'](_0x84c1('0x6d'),_0x19da11[_0x84c1('0x65')]['id'],_0x19da11[_0x84c1('0x65')]['name'],_0x19da11['user'][_0x84c1('0x6e')],_0x341768[_0x84c1('0x6c')]['id'],_0x19da11['body']?JSON['stringify'](_0x19da11[_0x84c1('0x5d')]):_0x84c1('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x84c1('0x70'),_0x341768);}return null;})[_0x84c1('0x24')](function(_0x5c56eb){var _0x32fc51=_0x84c1('0x71')+_0x5c56eb[_0x84c1('0x2d')][_0x84c1('0x72')];return db[_0x84c1('0x73')]['query'](_0x32fc51,{'type':db['Sequelize']['QueryTypes'][_0x84c1('0x74')],'raw':!![]})[_0x84c1('0x24')](function(_0x2d73d2){return _0x2d73d2;});})[_0x84c1('0x24')](function(_0x5913d2){if(_0x5913d2){_0x341768[_0x84c1('0x2d')][_0x84c1('0x75')]=_0x5913d2[0x0];if(!_0x19da11['body']['UserId'])return;return db[_0x84c1('0x76')][_0x84c1('0x5a')]({'where':{'id':_0x19da11[_0x84c1('0x5d')][_0x84c1('0x64')],'role':_0x84c1('0x66')},'attributes':['id',_0x84c1('0x3c'),_0x84c1('0x77'),_0x84c1('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3cea15){if(!_0x3cea15)return null;_0x341768[_0x84c1('0x2d')][_0x84c1('0x66')]=_0x3cea15;return _0x341768;})[_0x84c1('0x24')](function(_0x499487){if(_0x499487){if(_0x19da11['body'][_0x84c1('0x79')]){_0x341768[_0x84c1('0x2d')]['interface']=util[_0x84c1('0x62')]('SIP/%s',_0x19da11['user'][_0x84c1('0x3c')]);_0x341768['message'][_0x84c1('0x7a')]=_0x341768['channel'];_0x341768[_0x84c1('0x2d')][_0x84c1('0x7b')]=_0x341768['channel'];_0x341768[_0x84c1('0x2d')][_0x84c1('0x7c')]=_0x84c1('0x5f');return respondWithRpcPromise('EventManager',_0x84c1('0x7d'),{'event':_0x84c1('0x7e'),'message':_[_0x84c1('0x4e')](_0x341768['message'],JSON[_0x84c1('0x7f')](_0x341768['interaction'][_0x84c1('0x80')]))},client9002)[_0x84c1('0x24')](function(){return _0x341768;});}return _0x341768;}return null;})[_0x84c1('0x24')](respondWithResult(_0x1df2ea,null))[_0x84c1('0x5b')](handleError(_0x1df2ea,null));};var interaction_log=require('../../config/logger')(_0x84c1('0x81'));exports[_0x84c1('0x38')]=function(_0x48ba7e,_0x4e128d,_0x19ee6d){var _0x5e03a1={'agent':{},'channel':_0x84c1('0x60')};if(_0x48ba7e[_0x84c1('0x5d')]['id']){delete _0x48ba7e['body']['id'];}_0x48ba7e['body'][_0x84c1('0x64')]=_0x48ba7e[_0x84c1('0x5d')][_0x84c1('0x64')]||_0x48ba7e[_0x84c1('0x65')]['id'];_0x5e03a1[_0x84c1('0x66')]['id']=_0x48ba7e['body'][_0x84c1('0x64')];return db[_0x84c1('0x51')][_0x84c1('0x5a')]({'where':{'id':_0x48ba7e[_0x84c1('0x57')]['id'],'UserId':null}})[_0x84c1('0x24')](handleEntityNotFound(_0x4e128d,null))[_0x84c1('0x24')](function(_0xcf173a){if(_0xcf173a){_0x5e03a1[_0x84c1('0x2d')]=_0xcf173a[_0x84c1('0x67')]({'plain':!![]});return db[_0x84c1('0x68')][_0x84c1('0x5a')]({'where':{'id':_0xcf173a[_0x84c1('0x69')]}});}return null;})[_0x84c1('0x24')](handleEntityNotFound(_0x4e128d,null))[_0x84c1('0x24')](function(_0x2d1212){if(_0x2d1212){_0x5e03a1[_0x84c1('0x6c')]=_0x2d1212[_0x84c1('0x67')]({'plain':!![]});interaction_log[_0x84c1('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48ba7e[_0x84c1('0x65')]['id'],_0x48ba7e[_0x84c1('0x65')]['name'],_0x48ba7e[_0x84c1('0x65')][_0x84c1('0x6e')],_0x5e03a1[_0x84c1('0x6c')]['id'],_0x48ba7e[_0x84c1('0x5d')]?JSON[_0x84c1('0x2a')](_0x48ba7e[_0x84c1('0x5d')]):'null');return respondWithRpcPromise(_0x84c1('0x82'),_0x84c1('0x83'),_0x5e03a1);}return null;})[_0x84c1('0x24')](function(_0x1e7405){var _0x3083f7=_0x84c1('0x71')+_0x1e7405[_0x84c1('0x2d')][_0x84c1('0x72')];return db[_0x84c1('0x73')][_0x84c1('0x42')](_0x3083f7,{'type':db[_0x84c1('0x84')]['QueryTypes'][_0x84c1('0x74')],'raw':!![]})[_0x84c1('0x24')](function(_0xffb50f){return _0xffb50f;});})[_0x84c1('0x24')](function(_0x1acc6b){if(_0x1acc6b){_0x5e03a1[_0x84c1('0x2d')][_0x84c1('0x75')]=_0x1acc6b[0x0];if(!_0x48ba7e[_0x84c1('0x5d')][_0x84c1('0x64')])return;return db['User']['find']({'where':{'id':_0x48ba7e[_0x84c1('0x5d')][_0x84c1('0x64')],'role':_0x84c1('0x66')},'attributes':['id','name','fullname',_0x84c1('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x355561){if(!_0x355561)return null;_0x5e03a1[_0x84c1('0x2d')][_0x84c1('0x66')]=_0x355561;return _0x5e03a1;})[_0x84c1('0x24')](function(_0x1f2184){if(_0x1f2184){_0x1f2184[_0x84c1('0x2d')][_0x84c1('0x85')]=util[_0x84c1('0x62')]('SIP/%s',_0x48ba7e[_0x84c1('0x65')]['name']);_0x1f2184[_0x84c1('0x2d')][_0x84c1('0x7a')]=_0x5e03a1[_0x84c1('0x7a')];_0x1f2184[_0x84c1('0x2d')][_0x84c1('0x7b')]=_0x5e03a1[_0x84c1('0x7a')];_0x1f2184['message'][_0x84c1('0x7c')]=_0x84c1('0x38');respondWithRpcPromise(_0x84c1('0x7d'),_0x84c1('0x7d'),{'event':_0x84c1('0x86'),'message':_[_0x84c1('0x4e')](_0x5e03a1['message'],JSON[_0x84c1('0x7f')](_0x5e03a1['interaction']['formData']))},client9002);return _0x5e03a1;}return null;})['then'](respondWithResult(_0x4e128d,null))[_0x84c1('0x5b')](handleError(_0x4e128d,null));}; \ No newline at end of file +var _0x3333=['message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','show','keys','include','options','find','body','update','params','describe','chat-interactions','accept','chat','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','ChatInteraction','read1stAt','format','get','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','parse','interaction','reject','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','User','interface','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4f72d2,_0x1bbac4){var _0x5709af=function(_0x16d769){while(--_0x16d769){_0x4f72d2['push'](_0x4f72d2['shift']());}};_0x5709af(++_0x1bbac4);}(_0x3333,0x1dd));var _0x3333=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x3333[_0x43b08];return _0x5e05f4;};'use strict';var emlformat=require(_0x3333('0x0'));var rimraf=require(_0x3333('0x1'));var zipdir=require(_0x3333('0x2'));var jsonpatch=require(_0x3333('0x3'));var rp=require(_0x3333('0x4'));var moment=require('moment');var BPromise=require(_0x3333('0x5'));var Mustache=require(_0x3333('0x6'));var util=require(_0x3333('0x7'));var path=require(_0x3333('0x8'));var sox=require(_0x3333('0x9'));var csv=require('to-csv');var ejs=require(_0x3333('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3333('0xb'));var squel=require(_0x3333('0xc'));var crypto=require('crypto');var jsforce=require(_0x3333('0xd'));var deskjs=require(_0x3333('0xe'));var toCsv=require(_0x3333('0xf'));var querystring=require(_0x3333('0x10'));var Papa=require(_0x3333('0x11'));var Redis=require(_0x3333('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3333('0x13'));var as=require(_0x3333('0x14'));var hardwareService=require(_0x3333('0x15'));var logger=require(_0x3333('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x3333('0x17'));var licenseUtil=require(_0x3333('0x18'));var db=require(_0x3333('0x19'))['db'];config[_0x3333('0x1a')]=_[_0x3333('0x1b')](config[_0x3333('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3333('0x1a')]));require(_0x3333('0x1c'))[_0x3333('0x1d')](socket);var jayson=require(_0x3333('0x1e'));var client=jayson[_0x3333('0x1f')][_0x3333('0x20')]({'port':0x232c});var client9002=jayson[_0x3333('0x1f')][_0x3333('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x49aa4e,_0x5df09d,_0x2dfca7,_0x38f50e){return new BPromise(function(_0x17d388,_0x1b8156){var _0x35e47c=_0x38f50e||client;return _0x35e47c[_0x3333('0x21')](_0x49aa4e,_0x2dfca7)[_0x3333('0x22')](function(_0x381a5f){logger[_0x3333('0x23')](_0x3333('0x24'),_0x5df09d,'request\x20sent');logger[_0x3333('0x25')](_0x3333('0x26'),_0x5df09d,_0x3333('0x27'),JSON[_0x3333('0x28')](_0x381a5f));if(_0x381a5f[_0x3333('0x29')]){if(_0x381a5f[_0x3333('0x29')][_0x3333('0x2a')]===0x1f4){logger['error'](_0x3333('0x24'),_0x5df09d,_0x381a5f[_0x3333('0x29')]['message']);return _0x1b8156(_0x381a5f[_0x3333('0x29')][_0x3333('0x2b')]);}logger['error'](_0x3333('0x24'),_0x5df09d,_0x381a5f[_0x3333('0x29')][_0x3333('0x2b')]);return _0x17d388(_0x381a5f[_0x3333('0x29')][_0x3333('0x2b')]);}else{logger[_0x3333('0x23')](_0x3333('0x24'),_0x5df09d,_0x3333('0x27'));_0x17d388(_0x381a5f[_0x3333('0x2c')][_0x3333('0x2b')]);}})[_0x3333('0x2d')](function(_0x20f743){logger['error'](_0x3333('0x24'),_0x5df09d,_0x20f743);_0x1b8156(_0x20f743);});});}function respondWithStatusCode(_0x11595f,_0x36885b){_0x36885b=_0x36885b||0xcc;return function(_0x4a1dcf){if(_0x4a1dcf){return _0x11595f[_0x3333('0x2e')](_0x36885b);}return _0x11595f[_0x3333('0x2f')](_0x36885b)['end']();};}function respondWithResult(_0x5e5fde,_0x3f2695){_0x3f2695=_0x3f2695||0xc8;return function(_0x576c3c){if(_0x576c3c){return _0x5e5fde[_0x3333('0x2f')](_0x3f2695)[_0x3333('0x30')](_0x576c3c);}};}function respondWithFilteredResult(_0xd2c3a1,_0x1658d9){return function(_0x1360e3){if(_0x1360e3){var _0x24d3be=typeof _0x1658d9[_0x3333('0x31')]==='undefined'&&typeof _0x1658d9[_0x3333('0x32')]==='undefined';var _0x2fd94d=_0x1360e3[_0x3333('0x33')];var _0x59547b=_0x24d3be?0x0:_0x1658d9[_0x3333('0x31')];var _0x105648=_0x24d3be?_0x1360e3[_0x3333('0x33')]:_0x1658d9['offset']+_0x1658d9[_0x3333('0x32')];var _0x181bcb;if(_0x105648>=_0x2fd94d){_0x105648=_0x2fd94d;_0x181bcb=0xc8;}else{_0x181bcb=0xce;}_0xd2c3a1[_0x3333('0x2f')](_0x181bcb);return _0xd2c3a1[_0x3333('0x34')](_0x3333('0x35'),_0x59547b+'-'+_0x105648+'/'+_0x2fd94d)[_0x3333('0x30')](_0x1360e3);}return null;};}function patchUpdates(_0x5440d8){return function(_0x4ccbd4){try{jsonpatch[_0x3333('0x36')](_0x4ccbd4,_0x5440d8,!![]);}catch(_0x40200c){return BPromise['reject'](_0x40200c);}return _0x4ccbd4[_0x3333('0x37')]();};}function saveUpdates(_0x7e1dd5,_0x3f58df){return function(_0x530f2b){if(_0x530f2b){return _0x530f2b['update'](_0x7e1dd5)[_0x3333('0x22')](function(_0x2258e7){return _0x2258e7;});}return null;};}function removeEntity(_0x4f7554,_0x315991){return function(_0x38fc50){if(_0x38fc50){return _0x38fc50[_0x3333('0x38')]()[_0x3333('0x22')](function(){_0x4f7554[_0x3333('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4158d5,_0x801bef){return function(_0x2d6617){if(!_0x2d6617){_0x4158d5[_0x3333('0x2e')](0x194);}return _0x2d6617;};}function handleError(_0x522846,_0x2f062e){_0x2f062e=_0x2f062e||0x1f4;return function(_0x492048){logger['error'](_0x492048[_0x3333('0x39')]);if(_0x492048[_0x3333('0x3a')]){delete _0x492048['name'];}_0x522846[_0x3333('0x2f')](_0x2f062e)[_0x3333('0x3b')](_0x492048);};}exports[_0x3333('0x3c')]=function(_0x55d850,_0x4893a4){var _0x564c3f={},_0x3c22e1={},_0x1e75e5={'count':0x0,'rows':[]};var _0x4326f6=_[_0x3333('0x3d')](db[_0x3333('0x3e')][_0x3333('0x3f')],function(_0x34ea14){return{'name':_0x34ea14['fieldName'],'type':_0x34ea14['type'][_0x3333('0x40')]};});_0x3c22e1['model']=_['map'](_0x4326f6,_0x3333('0x3a'));_0x3c22e1[_0x3333('0x41')]=_['keys'](_0x55d850[_0x3333('0x41')]);_0x3c22e1[_0x3333('0x42')]=_[_0x3333('0x43')](_0x3c22e1[_0x3333('0x44')],_0x3c22e1[_0x3333('0x41')]);_0x564c3f[_0x3333('0x45')]=_['intersection'](_0x3c22e1[_0x3333('0x44')],qs[_0x3333('0x46')](_0x55d850[_0x3333('0x41')]['fields']));_0x564c3f[_0x3333('0x45')]=_0x564c3f[_0x3333('0x45')][_0x3333('0x47')]?_0x564c3f['attributes']:_0x3c22e1[_0x3333('0x44')];if(!_0x55d850[_0x3333('0x41')][_0x3333('0x48')]('nolimit')){_0x564c3f[_0x3333('0x32')]=qs[_0x3333('0x32')](_0x55d850[_0x3333('0x41')]['limit']);_0x564c3f[_0x3333('0x31')]=qs[_0x3333('0x31')](_0x55d850[_0x3333('0x41')][_0x3333('0x31')]);}_0x564c3f['order']=qs[_0x3333('0x49')](_0x55d850[_0x3333('0x41')]['sort']);_0x564c3f[_0x3333('0x4a')]=qs[_0x3333('0x42')](_[_0x3333('0x4b')](_0x55d850[_0x3333('0x41')],_0x3c22e1[_0x3333('0x42')]),_0x4326f6);if(_0x55d850[_0x3333('0x41')][_0x3333('0x4c')]){_0x564c3f[_0x3333('0x4a')]=_[_0x3333('0x4d')](_0x564c3f[_0x3333('0x4a')],{'$or':_[_0x3333('0x3d')](_0x4326f6,function(_0x2f92bf){if(_0x2f92bf[_0x3333('0x4e')]!==_0x3333('0x4f')){var _0x336954={};_0x336954[_0x2f92bf[_0x3333('0x3a')]]={'$like':'%'+_0x55d850[_0x3333('0x41')][_0x3333('0x4c')]+'%'};return _0x336954;}})});}_0x564c3f=_['merge']({},_0x564c3f,_0x55d850['options']);var _0x2af8d8={'where':_0x564c3f[_0x3333('0x4a')]};return db[_0x3333('0x3e')][_0x3333('0x33')](_0x2af8d8)['then'](function(_0x3d2199){_0x1e75e5[_0x3333('0x33')]=_0x3d2199;if(_0x55d850[_0x3333('0x41')][_0x3333('0x50')]){_0x564c3f['include']=[{'all':!![]}];}return db[_0x3333('0x3e')]['findAll'](_0x564c3f);})[_0x3333('0x22')](function(_0x36e41c){_0x1e75e5['rows']=_0x36e41c;return _0x1e75e5;})[_0x3333('0x22')](respondWithFilteredResult(_0x4893a4,_0x564c3f))['catch'](handleError(_0x4893a4,null));};exports[_0x3333('0x51')]=function(_0x171ea,_0x26c2f2){var _0x3c54e9={'raw':!![],'where':{'id':_0x171ea['params']['id']}},_0x373a89={};_0x373a89[_0x3333('0x44')]=_[_0x3333('0x52')](db[_0x3333('0x3e')]['rawAttributes']);_0x373a89[_0x3333('0x41')]=_[_0x3333('0x52')](_0x171ea['query']);_0x373a89[_0x3333('0x42')]=_[_0x3333('0x43')](_0x373a89[_0x3333('0x44')],_0x373a89[_0x3333('0x41')]);_0x3c54e9[_0x3333('0x45')]=_[_0x3333('0x43')](_0x373a89['model'],qs['fields'](_0x171ea[_0x3333('0x41')][_0x3333('0x46')]));_0x3c54e9[_0x3333('0x45')]=_0x3c54e9[_0x3333('0x45')]['length']?_0x3c54e9[_0x3333('0x45')]:_0x373a89['model'];if(_0x171ea['query'][_0x3333('0x50')]){_0x3c54e9[_0x3333('0x53')]=[{'all':!![]}];}_0x3c54e9=_[_0x3333('0x4d')]({},_0x3c54e9,_0x171ea[_0x3333('0x54')]);return db[_0x3333('0x3e')][_0x3333('0x55')](_0x3c54e9)['then'](handleEntityNotFound(_0x26c2f2,null))['then'](respondWithResult(_0x26c2f2,null))[_0x3333('0x2d')](handleError(_0x26c2f2,null));};exports['create']=function(_0x3eb1e5,_0x5cb77b){return db[_0x3333('0x3e')]['create'](_0x3eb1e5[_0x3333('0x56')],{})[_0x3333('0x22')](respondWithResult(_0x5cb77b,0xc9))[_0x3333('0x2d')](handleError(_0x5cb77b,null));};exports[_0x3333('0x57')]=function(_0x687e4e,_0x20ea46){if(_0x687e4e[_0x3333('0x56')]['id']){delete _0x687e4e[_0x3333('0x56')]['id'];}return db[_0x3333('0x3e')][_0x3333('0x55')]({'where':{'id':_0x687e4e['params']['id']}})[_0x3333('0x22')](handleEntityNotFound(_0x20ea46,null))[_0x3333('0x22')](saveUpdates(_0x687e4e[_0x3333('0x56')],null))['then'](respondWithResult(_0x20ea46,null))[_0x3333('0x2d')](handleError(_0x20ea46,null));};exports[_0x3333('0x38')]=function(_0x461062,_0xaca69f){return db[_0x3333('0x3e')][_0x3333('0x55')]({'where':{'id':_0x461062[_0x3333('0x58')]['id']}})[_0x3333('0x22')](handleEntityNotFound(_0xaca69f,null))[_0x3333('0x22')](removeEntity(_0xaca69f,null))[_0x3333('0x2d')](handleError(_0xaca69f,null));};exports[_0x3333('0x59')]=function(_0x599234,_0x5024b0){return db[_0x3333('0x3e')][_0x3333('0x59')]()['then'](respondWithResult(_0x5024b0,null))[_0x3333('0x2d')](handleError(_0x5024b0,null));};var interaction_log=require(_0x3333('0x16'))(_0x3333('0x5a'));exports[_0x3333('0x5b')]=function(_0x44194d,_0x4cbb2d,_0x5b3540){var _0x14be2c={'agent':{},'channel':_0x3333('0x5c')};if(_0x44194d['body']['id']){delete _0x44194d[_0x3333('0x56')]['id'];}_0x44194d[_0x3333('0x56')]['read']=!![];_0x44194d[_0x3333('0x56')]['readAt']=moment()['format'](_0x3333('0x5d'));_0x44194d[_0x3333('0x56')]['UserId']=_0x44194d[_0x3333('0x56')]['UserId']||_0x44194d[_0x3333('0x5e')]['id'];_0x14be2c[_0x3333('0x5f')]['id']=_0x44194d['body'][_0x3333('0x60')];return db[_0x3333('0x3e')]['find']({'where':{'id':_0x44194d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4cbb2d,null))[_0x3333('0x22')](saveUpdates(_0x44194d[_0x3333('0x56')],null))[_0x3333('0x22')](function(_0x151084){if(_0x151084){_0x14be2c[_0x3333('0x2b')]=_0x151084['get']({'plain':!![]});return db[_0x3333('0x61')][_0x3333('0x55')]({'where':{'id':_0x151084['ChatInteractionId']}});}return null;})[_0x3333('0x22')](handleEntityNotFound(_0x4cbb2d,null))[_0x3333('0x22')](function(_0x297667){if(_0x297667){return _0x297667['update']({'UserId':_0x44194d[_0x3333('0x56')][_0x3333('0x60')],'read1stAt':_['isNil'](_0x297667[_0x3333('0x62')])?moment()[_0x3333('0x63')](_0x3333('0x5d')):undefined});}return null;})[_0x3333('0x22')](function(_0x38d39b){if(_0x38d39b){_0x14be2c['interaction']=_0x38d39b[_0x3333('0x64')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44194d[_0x3333('0x5e')]['id'],_0x44194d[_0x3333('0x5e')][_0x3333('0x3a')],_0x44194d[_0x3333('0x5e')][_0x3333('0x65')],_0x14be2c['interaction']['id'],_0x44194d[_0x3333('0x56')]?JSON[_0x3333('0x28')](_0x44194d[_0x3333('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3333('0x66'),_0x14be2c);}return null;})[_0x3333('0x22')](function(_0x29d465){var _0xf7df9c=_0x3333('0x67')+_0x29d465[_0x3333('0x2b')]['ContactId'];return db[_0x3333('0x68')][_0x3333('0x41')](_0xf7df9c,{'type':db[_0x3333('0x69')][_0x3333('0x6a')][_0x3333('0x6b')],'raw':!![]})[_0x3333('0x22')](function(_0x320a16){return _0x320a16;});})[_0x3333('0x22')](function(_0x13def5){if(_0x13def5){_0x14be2c[_0x3333('0x2b')][_0x3333('0x6c')]=_0x13def5[0x0];if(!_0x44194d[_0x3333('0x56')][_0x3333('0x60')])return;return db['User'][_0x3333('0x55')]({'where':{'id':_0x44194d[_0x3333('0x56')][_0x3333('0x60')],'role':_0x3333('0x5f')},'attributes':['id',_0x3333('0x3a'),_0x3333('0x6d'),_0x3333('0x6e'),_0x3333('0x6f')],'raw':!![]});}return null;})[_0x3333('0x22')](function(_0x9ef74f){if(!_0x9ef74f)return null;_0x14be2c['message'][_0x3333('0x5f')]=_0x9ef74f;return _0x14be2c;})[_0x3333('0x22')](function(_0x1d2775){if(_0x1d2775){if(_0x44194d[_0x3333('0x56')][_0x3333('0x70')]){_0x14be2c[_0x3333('0x2b')]['interface']=util['format'](_0x3333('0x71'),_0x44194d[_0x3333('0x5e')][_0x3333('0x3a')]);_0x14be2c[_0x3333('0x2b')][_0x3333('0x72')]=_0x14be2c[_0x3333('0x72')];_0x14be2c[_0x3333('0x2b')]['motionChannel']=_0x14be2c[_0x3333('0x72')];_0x14be2c['message'][_0x3333('0x73')]=_0x3333('0x5b');return respondWithRpcPromise(_0x3333('0x74'),_0x3333('0x74'),{'event':_0x3333('0x75'),'message':_['merge'](_0x14be2c[_0x3333('0x2b')],JSON[_0x3333('0x76')](_0x14be2c[_0x3333('0x77')]['formData']))},client9002)[_0x3333('0x22')](function(){return _0x14be2c;});}return _0x14be2c;}return null;})[_0x3333('0x22')](respondWithResult(_0x4cbb2d,null))[_0x3333('0x2d')](handleError(_0x4cbb2d,null));};var interaction_log=require(_0x3333('0x16'))('chat-interactions');exports[_0x3333('0x78')]=function(_0x9034be,_0x3346fd,_0x4ad004){var _0x3c8b3a={'agent':{},'channel':_0x3333('0x5c')};if(_0x9034be[_0x3333('0x56')]['id']){delete _0x9034be['body']['id'];}_0x9034be[_0x3333('0x56')][_0x3333('0x60')]=_0x9034be[_0x3333('0x56')][_0x3333('0x60')]||_0x9034be[_0x3333('0x5e')]['id'];_0x3c8b3a[_0x3333('0x5f')]['id']=_0x9034be[_0x3333('0x56')][_0x3333('0x60')];return db['ChatMessage'][_0x3333('0x55')]({'where':{'id':_0x9034be[_0x3333('0x58')]['id'],'UserId':null}})[_0x3333('0x22')](handleEntityNotFound(_0x3346fd,null))[_0x3333('0x22')](function(_0x3d3ae0){if(_0x3d3ae0){_0x3c8b3a[_0x3333('0x2b')]=_0x3d3ae0['get']({'plain':!![]});return db[_0x3333('0x61')][_0x3333('0x55')]({'where':{'id':_0x3d3ae0[_0x3333('0x79')]}});}return null;})[_0x3333('0x22')](handleEntityNotFound(_0x3346fd,null))['then'](function(_0x1dec05){if(_0x1dec05){_0x3c8b3a[_0x3333('0x77')]=_0x1dec05['get']({'plain':!![]});interaction_log[_0x3333('0x23')](_0x3333('0x7a'),_0x9034be[_0x3333('0x5e')]['id'],_0x9034be['user'][_0x3333('0x3a')],_0x9034be['user'][_0x3333('0x65')],_0x3c8b3a['interaction']['id'],_0x9034be[_0x3333('0x56')]?JSON[_0x3333('0x28')](_0x9034be[_0x3333('0x56')]):_0x3333('0x7b'));return respondWithRpcPromise(_0x3333('0x7c'),_0x3333('0x7d'),_0x3c8b3a);}return null;})['then'](function(_0x493b61){var _0x1bf187=_0x3333('0x67')+_0x493b61[_0x3333('0x2b')]['ContactId'];return db[_0x3333('0x68')]['query'](_0x1bf187,{'type':db[_0x3333('0x69')][_0x3333('0x6a')][_0x3333('0x6b')],'raw':!![]})[_0x3333('0x22')](function(_0x2a85e0){return _0x2a85e0;});})['then'](function(_0x39625d){if(_0x39625d){_0x3c8b3a['message'][_0x3333('0x6c')]=_0x39625d[0x0];if(!_0x9034be[_0x3333('0x56')][_0x3333('0x60')])return;return db[_0x3333('0x7e')][_0x3333('0x55')]({'where':{'id':_0x9034be[_0x3333('0x56')][_0x3333('0x60')],'role':_0x3333('0x5f')},'attributes':['id',_0x3333('0x3a'),_0x3333('0x6d'),_0x3333('0x6e'),'internal'],'raw':!![]});}return null;})[_0x3333('0x22')](function(_0x24325c){if(!_0x24325c)return null;_0x3c8b3a[_0x3333('0x2b')][_0x3333('0x5f')]=_0x24325c;return _0x3c8b3a;})[_0x3333('0x22')](function(_0x13c752){if(_0x13c752){_0x13c752[_0x3333('0x2b')][_0x3333('0x7f')]=util[_0x3333('0x63')]('SIP/%s',_0x9034be[_0x3333('0x5e')][_0x3333('0x3a')]);_0x13c752[_0x3333('0x2b')][_0x3333('0x72')]=_0x3c8b3a[_0x3333('0x72')];_0x13c752[_0x3333('0x2b')][_0x3333('0x80')]=_0x3c8b3a[_0x3333('0x72')];_0x13c752['message']['event']=_0x3333('0x78');respondWithRpcPromise(_0x3333('0x74'),'EventManager',{'event':_0x3333('0x81'),'message':_[_0x3333('0x4d')](_0x3c8b3a[_0x3333('0x2b')],JSON[_0x3333('0x76')](_0x3c8b3a[_0x3333('0x77')]['formData']))},client9002);return _0x3c8b3a;}return null;})[_0x3333('0x22')](respondWithResult(_0x3346fd,null))[_0x3333('0x2d')](handleError(_0x3346fd,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 309d50f..e8058db 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 _0xfa29=['setMaxListeners','update','remove','emit','hook','../../mysqldb'];(function(_0x185133,_0x29a472){var _0x862f7f=function(_0x25ea87){while(--_0x25ea87){_0x185133['push'](_0x185133['shift']());}};_0x862f7f(++_0x29a472);}(_0xfa29,0x95));var _0x9fa2=function(_0x3fa5f9,_0xb7f5df){_0x3fa5f9=_0x3fa5f9-0x0;var _0x4117ec=_0xfa29[_0x3fa5f9];return _0x4117ec;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x9fa2('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9fa2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9fa2('0x2'),'afterDestroy':_0x9fa2('0x3')};function emitEvent(_0x431e1e){return function(_0x4ae905,_0x3371cc,_0x5714ff){ChatMessageEvents['emit'](_0x431e1e+':'+_0x4ae905['id'],_0x4ae905);ChatMessageEvents[_0x9fa2('0x4')](_0x431e1e,_0x4ae905);_0x5714ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9fa2('0x5')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x543b=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x568022,_0x3954a8){var _0x3e557c=function(_0x190ef4){while(--_0x190ef4){_0x568022['push'](_0x568022['shift']());}};_0x3e557c(++_0x3954a8);}(_0x543b,0x1d6));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xb543('0x0'));var ChatMessage=require(_0xb543('0x1'))['db'][_0xb543('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb543('0x3')](0x0);var events={'afterCreate':_0xb543('0x4'),'afterUpdate':_0xb543('0x5'),'afterDestroy':_0xb543('0x6')};function emitEvent(_0x531592){return function(_0x47640e,_0x481d94,_0x55b006){ChatMessageEvents[_0xb543('0x7')](_0x531592+':'+_0x47640e['id'],_0x47640e);ChatMessageEvents[_0xb543('0x7')](_0x531592,_0x47640e);_0x55b006(null);};}for(var e in events){if(events[_0xb543('0x8')](e)){var event=events[e];ChatMessage[_0xb543('0x9')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 11d4891..5a45a66 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 _0x68da=['../../config/environment','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','body','models','get','toLowerCase','direction','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x68da,0x173));var _0xa68d=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x68da[_0x2c2980];return _0x2a20a9;};'use strict';var _=require(_0xa68d('0x0'));var util=require(_0xa68d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa68d('0x2'));var BPromise=require(_0xa68d('0x3'));var rp=require(_0xa68d('0x4'));var fs=require('fs');var path=require(_0xa68d('0x5'));var rimraf=require(_0xa68d('0x6'));var config=require(_0xa68d('0x7'));var attributes=require(_0xa68d('0x8'));module[_0xa68d('0x9')]=function(_0x1973bf,_0x15fb12){return _0x1973bf['define']('ChatMessage',attributes,{'tableName':_0xa68d('0xa'),'paranoid':![],'indexes':[{'name':_0xa68d('0xb'),'fields':[_0xa68d('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x342150,_0x1d0a66,_0x59abe9){var _0x1c371e=_0x1973bf[_0xa68d('0xd')];var _0x4e790a=_0x342150[_0xa68d('0xe')]({'plain':!![]});if(_0x4e790a['direction'][_0xa68d('0xf')]()==='in'||_0x4e790a[_0xa68d('0x10')][_0xa68d('0xf')]()==='out'&&!_0x4e790a['secret']&&!_[_0xa68d('0x11')](_0x4e790a[_0xa68d('0x12')])){_0x1c371e[_0xa68d('0x13')][_0xa68d('0x14')]({'where':{'id':_0x4e790a[_0xa68d('0x15')]}})['then'](function(_0x4d45ff){if(_0x4d45ff){_0x4d45ff[_0xa68d('0x16')]({'lastMsgAt':_0x4e790a['createdAt'],'lastMsgDirection':_0x4e790a[_0xa68d('0x10')]['toLowerCase']()});}})[_0xa68d('0x17')](function(_0x2fe339){console[_0xa68d('0x18')](_0x2fe339);});}_0x59abe9();}},'charset':_0xa68d('0x19'),'collate':_0xa68d('0x1a')});}; \ No newline at end of file +var _0xf890=['bluebird','request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','lodash','util','../../config/logger','api','moment'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xf890,0xa3));var _0x0f89=function(_0x327005,_0x3b2608){_0x327005=_0x327005-0x0;var _0x5211d7=_0xf890[_0x327005];return _0x5211d7;};'use strict';var _=require(_0x0f89('0x0'));var util=require(_0x0f89('0x1'));var logger=require(_0x0f89('0x2'))(_0x0f89('0x3'));var moment=require(_0x0f89('0x4'));var BPromise=require(_0x0f89('0x5'));var rp=require(_0x0f89('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0f89('0x7'));var attributes=require(_0x0f89('0x8'));module[_0x0f89('0x9')]=function(_0x5a532e,_0x20e5af){return _0x5a532e[_0x0f89('0xa')](_0x0f89('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x0f89('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5126c1,_0x3ce6e6,_0x421398){var _0x239229=_0x5a532e['models'];var _0x3e8c0f=_0x5126c1['get']({'plain':!![]});if(_0x3e8c0f[_0x0f89('0xd')][_0x0f89('0xe')]()==='in'||_0x3e8c0f[_0x0f89('0xd')][_0x0f89('0xe')]()==='out'&&!_0x3e8c0f[_0x0f89('0xf')]&&!_[_0x0f89('0x10')](_0x3e8c0f[_0x0f89('0x11')])){_0x239229[_0x0f89('0x12')][_0x0f89('0x13')]({'where':{'id':_0x3e8c0f[_0x0f89('0x14')]}})[_0x0f89('0x15')](function(_0x5c0b2e){if(_0x5c0b2e){_0x5c0b2e['update']({'lastMsgAt':_0x3e8c0f[_0x0f89('0x16')],'lastMsgDirection':_0x3e8c0f[_0x0f89('0xd')][_0x0f89('0xe')]()});}})[_0x0f89('0x17')](function(_0x51ea86){console['error'](_0x51ea86);});}_0x421398();}},'charset':'utf8mb4','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 2b44ca2..23f19a6 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 _0xb1dc=['CreateChatMessage','create','body','raw','then','debug','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x8d1dba,_0x19297d){var _0x230c62=function(_0x4ff4b1){while(--_0x4ff4b1){_0x8d1dba['push'](_0x8d1dba['shift']());}};_0x230c62(++_0x19297d);}(_0xb1dc,0x8a));var _0xcb1d=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xb1dc[_0x507ac5];return _0x12c1bc;};'use strict';var _=require('lodash');var util=require(_0xcb1d('0x0'));var moment=require(_0xcb1d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb1d('0x2'));var db=require(_0xcb1d('0x3'))['db'];var utils=require(_0xcb1d('0x4'));var logger=require(_0xcb1d('0x5'))('rpc');var config=require(_0xcb1d('0x6'));var jayson=require(_0xcb1d('0x7'));var client=jayson[_0xcb1d('0x8')][_0xcb1d('0x9')]({'port':0x232a});config[_0xcb1d('0xa')]=_[_0xcb1d('0xb')](config[_0xcb1d('0xa')],{'host':_0xcb1d('0xc'),'port':0x18eb});var socket=require(_0xcb1d('0xd'))(new Redis(config['redis']));require(_0xcb1d('0xe'))[_0xcb1d('0xf')](socket);function respondWithRpcPromise(_0x510ff8,_0x13d22b,_0x290936){return new BPromise(function(_0x4adf7a,_0x5f2a73){return client[_0xcb1d('0x10')](_0x510ff8,_0x290936)['then'](function(_0x599ee9){logger[_0xcb1d('0x11')]('ChatMessage,\x20%s,\x20%s',_0x13d22b,'request\x20sent');logger['debug'](_0xcb1d('0x12'),_0x13d22b,_0xcb1d('0x13'),JSON[_0xcb1d('0x14')](_0x599ee9));if(_0x599ee9[_0xcb1d('0x15')]){if(_0x599ee9[_0xcb1d('0x15')][_0xcb1d('0x16')]===0x1f4){logger[_0xcb1d('0x15')](_0xcb1d('0x17'),_0x13d22b,_0x599ee9[_0xcb1d('0x15')][_0xcb1d('0x18')]);return _0x5f2a73(_0x599ee9['error'][_0xcb1d('0x18')]);}logger[_0xcb1d('0x15')](_0xcb1d('0x17'),_0x13d22b,_0x599ee9[_0xcb1d('0x15')][_0xcb1d('0x18')]);return _0x4adf7a(_0x599ee9[_0xcb1d('0x15')][_0xcb1d('0x18')]);}else{logger[_0xcb1d('0x11')]('ChatMessage,\x20%s,\x20%s',_0x13d22b,'request\x20sent');_0x4adf7a(_0x599ee9[_0xcb1d('0x19')][_0xcb1d('0x18')]);}})[_0xcb1d('0x1a')](function(_0x35cecd){logger[_0xcb1d('0x15')](_0xcb1d('0x17'),_0x13d22b,_0x35cecd);_0x5f2a73(_0x35cecd);});});}exports[_0xcb1d('0x1b')]=function(_0x454c50){var _0x41f188=this;return new Promise(function(_0x26d03f,_0x379a6b){return db['ChatMessage'][_0xcb1d('0x1c')](_0x454c50[_0xcb1d('0x1d')],{'raw':_0x454c50['options']?_0x454c50['options'][_0xcb1d('0x1e')]===undefined?!![]:![]:!![]})[_0xcb1d('0x1f')](function(_0x1ead05){logger[_0xcb1d('0x11')](_0xcb1d('0x1b'),_0x454c50);logger[_0xcb1d('0x20')](_0xcb1d('0x1b'),_0x454c50,JSON[_0xcb1d('0x14')](_0x1ead05));_0x26d03f(_0x1ead05);})[_0xcb1d('0x1a')](function(_0x43b42e){logger['error'](_0xcb1d('0x1b'),_0x43b42e[_0xcb1d('0x18')],_0x454c50);_0x379a6b(_0x41f188[_0xcb1d('0x15')](0x1f4,_0x43b42e[_0xcb1d('0x18')]));});});}; \ No newline at end of file +var _0x23f9=['message','result','catch','CreateChatMessage','ChatMessage','create','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x16a2ea,_0x2a26ab){var _0x508a44=function(_0x55e3ee){while(--_0x55e3ee){_0x16a2ea['push'](_0x16a2ea['shift']());}};_0x508a44(++_0x2a26ab);}(_0x23f9,0x1d7));var _0x923f=function(_0x2a55f9,_0x370727){_0x2a55f9=_0x2a55f9-0x0;var _0x5a4454=_0x23f9[_0x2a55f9];return _0x5a4454;};'use strict';var _=require(_0x923f('0x0'));var util=require(_0x923f('0x1'));var moment=require(_0x923f('0x2'));var BPromise=require(_0x923f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x923f('0x4'));var db=require(_0x923f('0x5'))['db'];var utils=require(_0x923f('0x6'));var logger=require(_0x923f('0x7'))(_0x923f('0x8'));var config=require('../../config/environment');var jayson=require(_0x923f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x923f('0xa')]=_[_0x923f('0xb')](config[_0x923f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x923f('0xc'))(new Redis(config[_0x923f('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x41c75f,_0x49fa45,_0x2db217){return new BPromise(function(_0x1805c4,_0x4db75b){return client[_0x923f('0xd')](_0x41c75f,_0x2db217)[_0x923f('0xe')](function(_0x32f2eb){logger[_0x923f('0xf')](_0x923f('0x10'),_0x49fa45,_0x923f('0x11'));logger['debug'](_0x923f('0x12'),_0x49fa45,_0x923f('0x11'),JSON[_0x923f('0x13')](_0x32f2eb));if(_0x32f2eb[_0x923f('0x14')]){if(_0x32f2eb[_0x923f('0x14')][_0x923f('0x15')]===0x1f4){logger[_0x923f('0x14')](_0x923f('0x10'),_0x49fa45,_0x32f2eb[_0x923f('0x14')][_0x923f('0x16')]);return _0x4db75b(_0x32f2eb[_0x923f('0x14')][_0x923f('0x16')]);}logger[_0x923f('0x14')](_0x923f('0x10'),_0x49fa45,_0x32f2eb[_0x923f('0x14')][_0x923f('0x16')]);return _0x1805c4(_0x32f2eb[_0x923f('0x14')]['message']);}else{logger[_0x923f('0xf')]('ChatMessage,\x20%s,\x20%s',_0x49fa45,_0x923f('0x11'));_0x1805c4(_0x32f2eb[_0x923f('0x17')][_0x923f('0x16')]);}})[_0x923f('0x18')](function(_0x14c23a){logger[_0x923f('0x14')]('ChatMessage,\x20%s,\x20%s',_0x49fa45,_0x14c23a);_0x4db75b(_0x14c23a);});});}exports[_0x923f('0x19')]=function(_0x105ff4){var _0x410953=this;return new Promise(function(_0x25908f,_0x26c7e5){return db[_0x923f('0x1a')][_0x923f('0x1b')](_0x105ff4['body'],{'raw':_0x105ff4['options']?_0x105ff4['options'][_0x923f('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4fdd19){logger[_0x923f('0xf')](_0x923f('0x19'),_0x105ff4);logger['debug']('CreateChatMessage',_0x105ff4,JSON[_0x923f('0x13')](_0x4fdd19));_0x25908f(_0x4fdd19);})[_0x923f('0x18')](function(_0x49c005){logger['error']('CreateChatMessage',_0x49c005[_0x923f('0x16')],_0x105ff4);_0x26c7e5(_0x410953[_0x923f('0x14')](0x1f4,_0x49c005[_0x923f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ef7da23..8c12ad6 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 _0xe14b=['removeListener','register','length','./chatMessage.events','save','emit'];(function(_0xb67251,_0x1f6208){var _0x979d96=function(_0x41d0d0){while(--_0x41d0d0){_0xb67251['push'](_0xb67251['shift']());}};_0x979d96(++_0x1f6208);}(_0xe14b,0x93));var _0xbe14=function(_0x3d2a97,_0x1f0a9f){_0x3d2a97=_0x3d2a97-0x0;var _0x4cb991=_0xe14b[_0x3d2a97];return _0x4cb991;};'use strict';var ChatMessageEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){ChatMessageEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('chatMessage:'+_0x196fca,_0x1fe204);ChatMessageEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x1c3b=['removeListener','./chatMessage.events','save','remove','emit'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x1c3b,0xab));var _0xb1c3=function(_0x23c087,_0x1b37e4){_0x23c087=_0x23c087-0x0;var _0x45f28b=_0x1c3b[_0x23c087];return _0x45f28b;};'use strict';var ChatMessageEvents=require(_0xb1c3('0x0'));var events=[_0xb1c3('0x1'),_0xb1c3('0x2'),'update'];function createListener(_0x4eeac2,_0x28a375){return function(_0x89ce0b){_0x28a375[_0xb1c3('0x3')](_0x4eeac2,_0x89ce0b);};}function removeListener(_0x34dbb5,_0x24d4c0){return function(){ChatMessageEvents[_0xb1c3('0x4')](_0x34dbb5,_0x24d4c0);};}exports['register']=function(_0x472813){for(var _0x62da34=0x0,_0x211254=events['length'];_0x62da34<_0x211254;_0x62da34++){var _0x504fc9=events[_0x62da34];var _0x4ed6cf=createListener('chatMessage:'+_0x504fc9,_0x472813);ChatMessageEvents['on'](_0x504fc9,_0x4ed6cf);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 59faa5b..0f16a2a 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 _0xea02=['chatmessage:create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xea02,0x98));var _0x2ea0=function(_0x19a1c0,_0x14f0bb){_0x19a1c0=_0x19a1c0-0x0;var _0x2afb24=_0xea02[_0x19a1c0];return _0x2afb24;};'use strict';var multer=require(_0x2ea0('0x0'));var util=require(_0x2ea0('0x1'));var path=require(_0x2ea0('0x2'));var timeout=require('connect-timeout');var express=require(_0x2ea0('0x3'));var router=express[_0x2ea0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2ea0('0x5'));var interaction=require(_0x2ea0('0x6'));var config=require(_0x2ea0('0x7'));var controller=require(_0x2ea0('0x8'));router[_0x2ea0('0x9')]('/',auth[_0x2ea0('0xa')](),controller[_0x2ea0('0xb')]);router[_0x2ea0('0x9')](_0x2ea0('0xc'),auth[_0x2ea0('0xa')](),controller[_0x2ea0('0xd')]);router['get']('/:id',auth[_0x2ea0('0xa')](),controller[_0x2ea0('0xe')]);router['post']('/',auth[_0x2ea0('0xa')](),interaction[_0x2ea0('0xf')]('chat',_0x2ea0('0x10')),controller['create']);router[_0x2ea0('0x11')]('/:id',controller[_0x2ea0('0x12')]);router['put'](_0x2ea0('0x13'),auth[_0x2ea0('0xa')](),controller['accept']);router['put'](_0x2ea0('0x14'),auth['isAuthenticated'](),controller[_0x2ea0('0x15')]);router['delete']('/:id',auth[_0x2ea0('0xa')](),controller[_0x2ea0('0x16')]);module[_0x2ea0('0x17')]=router; \ No newline at end of file +var _0xea88=['reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','/:id/accept','/:id/reject'];(function(_0x193f7c,_0x742fdb){var _0x3b0f95=function(_0x18375e){while(--_0x18375e){_0x193f7c['push'](_0x193f7c['shift']());}};_0x3b0f95(++_0x742fdb);}(_0xea88,0x153));var _0x8ea8=function(_0xbf2b2b,_0x256e96){_0xbf2b2b=_0xbf2b2b-0x0;var _0x5f83ac=_0xea88[_0xbf2b2b];return _0x5f83ac;};'use strict';var multer=require(_0x8ea8('0x0'));var util=require(_0x8ea8('0x1'));var path=require(_0x8ea8('0x2'));var timeout=require(_0x8ea8('0x3'));var express=require(_0x8ea8('0x4'));var router=express[_0x8ea8('0x5')]();var fs_extra=require(_0x8ea8('0x6'));var auth=require(_0x8ea8('0x7'));var interaction=require(_0x8ea8('0x8'));var config=require('../../config/environment');var controller=require(_0x8ea8('0x9'));router[_0x8ea8('0xa')]('/',auth[_0x8ea8('0xb')](),controller[_0x8ea8('0xc')]);router[_0x8ea8('0xa')](_0x8ea8('0xd'),auth[_0x8ea8('0xb')](),controller['describe']);router['get'](_0x8ea8('0xe'),auth[_0x8ea8('0xb')](),controller[_0x8ea8('0xf')]);router[_0x8ea8('0x10')]('/',auth[_0x8ea8('0xb')](),interaction['tracked']('chat','chatmessage:create'),controller['create']);router[_0x8ea8('0x11')](_0x8ea8('0xe'),controller[_0x8ea8('0x12')]);router[_0x8ea8('0x11')](_0x8ea8('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x8ea8('0x14'),auth['isAuthenticated'](),controller[_0x8ea8('0x15')]);router[_0x8ea8('0x16')](_0x8ea8('0xe'),auth[_0x8ea8('0xb')](),controller[_0x8ea8('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 82330ef..8032123 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x55e0b2,_0x3e5579){var _0x53a220=function(_0x162ba8){while(--_0x162ba8){_0x55e0b2['push'](_0x55e0b2['shift']());}};_0x53a220(++_0x3e5579);}(_0xdb28,0x106));var _0x8db2=function(_0x119504,_0x265e38){_0x119504=_0x119504-0x0;var _0x5cf8f2=_0xdb28[_0x119504];return _0x5cf8f2;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x1516ad,_0x2d4ee7){var _0x30ee36=function(_0x2c622d){while(--_0x2c622d){_0x1516ad['push'](_0x1516ad['shift']());}};_0x30ee36(++_0x2d4ee7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48d952,_0x26065d){_0x48d952=_0x48d952-0x0;var _0x594455=_0x5f2f[_0x48d952];return _0x594455;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index c4ca166..2fc66ed 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x7a54,0x106));var _0x47a5=function(_0x3543c9,_0x8c4816){_0x3543c9=_0x3543c9-0x0;var _0x2c0cb8=_0x7a54[_0x3543c9];return _0x2c0cb8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x177a24,_0xcc1afe){_0x177a24=_0x177a24-0x0;var _0x46e21b=_0x7a54[_0x177a24];return _0x46e21b;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 0410ff8..0145930 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 _0xe144=['events','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x53fb5c,_0x19b33d){var _0x467ef8=function(_0x1e5d7c){while(--_0x1e5d7c){_0x53fb5c['push'](_0x53fb5c['shift']());}};_0x467ef8(++_0x19b33d);}(_0xe144,0x168));var _0x4e14=function(_0x31061a,_0x5ab647){_0x31061a=_0x31061a-0x0;var _0x48d92a=_0xe144[_0x31061a];return _0x48d92a;};'use strict';var EventEmitter=require(_0x4e14('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x4e14('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4e14('0x2')](0x0);var events={'afterCreate':_0x4e14('0x3'),'afterUpdate':_0x4e14('0x4'),'afterDestroy':_0x4e14('0x5')};function emitEvent(_0x451f57){return function(_0x388b22,_0x37241e,_0x279fde){ChatOfflineMessageEvents[_0x4e14('0x6')](_0x451f57+':'+_0x388b22['id'],_0x388b22);ChatOfflineMessageEvents[_0x4e14('0x6')](_0x451f57,_0x388b22);_0x279fde(null);};}for(var e in events){if(events[_0x4e14('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x4e14('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xbd08=['save','remove','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage'];(function(_0x3285a3,_0x42b059){var _0x38221e=function(_0x463c69){while(--_0x463c69){_0x3285a3['push'](_0x3285a3['shift']());}};_0x38221e(++_0x42b059);}(_0xbd08,0x6e));var _0x8bd0=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xbd08[_0x3fba9f];return _0x192cf1;};'use strict';var EventEmitter=require(_0x8bd0('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x8bd0('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8bd0('0x2'),'afterUpdate':'update','afterDestroy':_0x8bd0('0x3')};function emitEvent(_0x21dd29){return function(_0x316930,_0x5e9819,_0x2b53bd){ChatOfflineMessageEvents[_0x8bd0('0x4')](_0x21dd29+':'+_0x316930['id'],_0x316930);ChatOfflineMessageEvents['emit'](_0x21dd29,_0x316930);_0x2b53bd(null);};}for(var e in events){if(events[_0x8bd0('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x8bd0('0x6')](e,emitEvent(event));}}module[_0x8bd0('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8b8f6ff..f038495 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 _0x12e5=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports'];(function(_0xd9c274,_0x58f1ef){var _0x56aa81=function(_0x20029f){while(--_0x20029f){_0xd9c274['push'](_0xd9c274['shift']());}};_0x56aa81(++_0x58f1ef);}(_0x12e5,0x144));var _0x512e=function(_0x5f2330,_0x298a0d){_0x5f2330=_0x5f2330-0x0;var _0x1e9150=_0x12e5[_0x5f2330];return _0x1e9150;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x512e('0x0')]=function(_0x3da138){return _0x3da138['define'](_0x512e('0x1'),attributes,{'tableName':_0x512e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x512e('0x3'),'collate':_0x512e('0x4')});}; \ No newline at end of file +var _0x0b3c=['./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0xbea524,_0x39555b){var _0x28bc5f=function(_0x2f758d){while(--_0x2f758d){_0xbea524['push'](_0xbea524['shift']());}};_0x28bc5f(++_0x39555b);}(_0x0b3c,0xeb));var _0xc0b3=function(_0x3a5b1f,_0x57ee12){_0x3a5b1f=_0x3a5b1f-0x0;var _0x2e7fe8=_0x0b3c[_0x3a5b1f];return _0x2e7fe8;};'use strict';var attributes=require(_0xc0b3('0x0'));module['exports']=function(_0x27497c){return _0x27497c[_0xc0b3('0x1')](_0xc0b3('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0b3('0x3'),'collate':_0xc0b3('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a6d24b1..8d1b889 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 _0x3dd8=['then','info','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','request\x20sent','catch','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x55b026,_0x22dbc5){var _0xcd43fa=function(_0x3cae16){while(--_0x3cae16){_0x55b026['push'](_0x55b026['shift']());}};_0xcd43fa(++_0x22dbc5);}(_0x3dd8,0x199));var _0x83dd=function(_0x54ef43,_0x308497){_0x54ef43=_0x54ef43-0x0;var _0x4e3816=_0x3dd8[_0x54ef43];return _0x4e3816;};'use strict';var _=require('lodash');var util=require(_0x83dd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x83dd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x83dd('0x2'));var logger=require(_0x83dd('0x3'))(_0x83dd('0x4'));var config=require(_0x83dd('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x83dd('0x6')][_0x83dd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b01fa,_0x403e77,_0x5a6dd1){return new BPromise(function(_0x48d9b3,_0x19a488){return client[_0x83dd('0x8')](_0x5b01fa,_0x5a6dd1)[_0x83dd('0x9')](function(_0x3a78b1){logger[_0x83dd('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x403e77,'request\x20sent');logger[_0x83dd('0xb')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x403e77,'request\x20sent',JSON[_0x83dd('0xc')](_0x3a78b1));if(_0x3a78b1[_0x83dd('0xd')]){if(_0x3a78b1['error'][_0x83dd('0xe')]===0x1f4){logger[_0x83dd('0xd')](_0x83dd('0xf'),_0x403e77,_0x3a78b1[_0x83dd('0xd')][_0x83dd('0x10')]);return _0x19a488(_0x3a78b1[_0x83dd('0xd')][_0x83dd('0x10')]);}logger[_0x83dd('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x403e77,_0x3a78b1[_0x83dd('0xd')][_0x83dd('0x10')]);return _0x48d9b3(_0x3a78b1[_0x83dd('0xd')][_0x83dd('0x10')]);}else{logger[_0x83dd('0xa')](_0x83dd('0xf'),_0x403e77,_0x83dd('0x11'));_0x48d9b3(_0x3a78b1['result']['message']);}})[_0x83dd('0x12')](function(_0x178385){logger[_0x83dd('0xd')](_0x83dd('0xf'),_0x403e77,_0x178385);_0x19a488(_0x178385);});});} \ No newline at end of file +var _0xd241=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x5a0cfb,_0x299792){var _0x3a3558=function(_0x50a1cc){while(--_0x50a1cc){_0x5a0cfb['push'](_0x5a0cfb['shift']());}};_0x3a3558(++_0x299792);}(_0xd241,0x101));var _0x1d24=function(_0x1e5313,_0x4a63ea){_0x1e5313=_0x1e5313-0x0;var _0x41ba4d=_0xd241[_0x1e5313];return _0x41ba4d;};'use strict';var _=require(_0x1d24('0x0'));var util=require('util');var moment=require(_0x1d24('0x1'));var BPromise=require(_0x1d24('0x2'));var rs=require(_0x1d24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d24('0x4'))['db'];var utils=require(_0x1d24('0x5'));var logger=require(_0x1d24('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1d24('0x7'));var client=jayson['client'][_0x1d24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b9f94,_0x238cdf,_0x556a43){return new BPromise(function(_0x25479b,_0x215dad){return client[_0x1d24('0x9')](_0x4b9f94,_0x556a43)['then'](function(_0x59e191){logger[_0x1d24('0xa')](_0x1d24('0xb'),_0x238cdf,_0x1d24('0xc'));logger[_0x1d24('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x238cdf,_0x1d24('0xc'),JSON[_0x1d24('0xe')](_0x59e191));if(_0x59e191[_0x1d24('0xf')]){if(_0x59e191[_0x1d24('0xf')][_0x1d24('0x10')]===0x1f4){logger[_0x1d24('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x238cdf,_0x59e191[_0x1d24('0xf')][_0x1d24('0x11')]);return _0x215dad(_0x59e191[_0x1d24('0xf')][_0x1d24('0x11')]);}logger[_0x1d24('0xf')](_0x1d24('0xb'),_0x238cdf,_0x59e191[_0x1d24('0xf')][_0x1d24('0x11')]);return _0x25479b(_0x59e191[_0x1d24('0xf')]['message']);}else{logger[_0x1d24('0xa')](_0x1d24('0xb'),_0x238cdf,'request\x20sent');_0x25479b(_0x59e191[_0x1d24('0x12')][_0x1d24('0x11')]);}})[_0x1d24('0x13')](function(_0x5c5135){logger['error'](_0x1d24('0xb'),_0x238cdf,_0x5c5135);_0x215dad(_0x5c5135);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ebbdbfd..56c5805 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 _0xf7fe=['/describe','isAuthenticated','describe','show','post','/:id','update','delete','destroy','exports','util','path','Router','fs-extra','./chatOfflineMessage.controller','get','index'];(function(_0x30580f,_0xdec83d){var _0x276442=function(_0x427c44){while(--_0x427c44){_0x30580f['push'](_0x30580f['shift']());}};_0x276442(++_0xdec83d);}(_0xf7fe,0x1e6));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xef7f('0x0'));var path=require(_0xef7f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef7f('0x2')]();var fs_extra=require(_0xef7f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef7f('0x4'));router[_0xef7f('0x5')]('/',auth['isAuthenticated'](),controller[_0xef7f('0x6')]);router['get'](_0xef7f('0x7'),auth[_0xef7f('0x8')](),controller[_0xef7f('0x9')]);router['get']('/:id',auth[_0xef7f('0x8')](),controller[_0xef7f('0xa')]);router[_0xef7f('0xb')]('/',auth[_0xef7f('0x8')](),controller['create']);router['put'](_0xef7f('0xc'),auth['isAuthenticated'](),controller[_0xef7f('0xd')]);router[_0xef7f('0xe')]('/:id',auth[_0xef7f('0x8')](),controller[_0xef7f('0xf')]);module[_0xef7f('0x10')]=router; \ No newline at end of file +var _0x1e7e=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','multer','path'];(function(_0x2064c8,_0x168039){var _0x23af73=function(_0x2a2d10){while(--_0x2a2d10){_0x2064c8['push'](_0x2064c8['shift']());}};_0x23af73(++_0x168039);}(_0x1e7e,0xda));var _0xe1e7=function(_0x173672,_0x8bc880){_0x173672=_0x173672-0x0;var _0x201e46=_0x1e7e[_0x173672];return _0x201e46;};'use strict';var multer=require(_0xe1e7('0x0'));var util=require('util');var path=require(_0xe1e7('0x1'));var timeout=require(_0xe1e7('0x2'));var express=require('express');var router=express[_0xe1e7('0x3')]();var fs_extra=require(_0xe1e7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe1e7('0x5'));var config=require(_0xe1e7('0x6'));var controller=require(_0xe1e7('0x7'));router[_0xe1e7('0x8')]('/',auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xa')]);router['get'](_0xe1e7('0xb'),auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xc')]);router['get'](_0xe1e7('0xd'),auth[_0xe1e7('0x9')](),controller[_0xe1e7('0xe')]);router[_0xe1e7('0xf')]('/',auth[_0xe1e7('0x9')](),controller[_0xe1e7('0x10')]);router[_0xe1e7('0x11')](_0xe1e7('0xd'),auth[_0xe1e7('0x9')](),controller[_0xe1e7('0x12')]);router['delete'](_0xe1e7('0xd'),auth[_0xe1e7('0x9')](),controller[_0xe1e7('0x13')]);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 0b01288..cb56845 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 _0x1cea=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x2139b3,_0x8fac0e){var _0x41c80a=function(_0x4155d4){while(--_0x4155d4){_0x2139b3['push'](_0x2139b3['shift']());}};_0x41c80a(++_0x8fac0e);}(_0x1cea,0xd3));var _0xa1ce=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x1cea[_0x3a6e4b];return _0x36572d;};'use strict';var Sequelize=require(_0xa1ce('0x0'));module[_0xa1ce('0x1')]={'name':{'type':Sequelize[_0xa1ce('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa1ce('0x3'),_0xa1ce('0x4')),'defaultValue':_0xa1ce('0x3')},'selector':{'type':Sequelize[_0xa1ce('0x2')]},'timeout':{'type':Sequelize[_0xa1ce('0x5')]}}; \ No newline at end of file +var _0xef41=['STRING','INTEGER','sequelize','exports','ENUM','mouseOver','timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef41,0x121));var _0x1ef4=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xef41[_0xfb0cfd];return _0x2fd8aa;};'use strict';var Sequelize=require(_0x1ef4('0x0'));module[_0x1ef4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1ef4('0x2')](_0x1ef4('0x3'),_0x1ef4('0x4')),'defaultValue':_0x1ef4('0x3')},'selector':{'type':Sequelize[_0x1ef4('0x5')]},'timeout':{'type':Sequelize[_0x1ef4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c224e87..8568f59 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 _0x57cf=['include','merge','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','offset','count','set','apply','reject','save','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','fields'];(function(_0x458e6c,_0x206d46){var _0x1130c5=function(_0x1fdb2a){while(--_0x1fdb2a){_0x458e6c['push'](_0x458e6c['shift']());}};_0x1130c5(++_0x206d46);}(_0x57cf,0x11b));var _0xf57c=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x57cf[_0x513047];return _0x15b779;};'use strict';var emlformat=require(_0xf57c('0x0'));var rimraf=require(_0xf57c('0x1'));var zipdir=require(_0xf57c('0x2'));var jsonpatch=require(_0xf57c('0x3'));var rp=require(_0xf57c('0x4'));var moment=require(_0xf57c('0x5'));var BPromise=require(_0xf57c('0x6'));var Mustache=require(_0xf57c('0x7'));var util=require(_0xf57c('0x8'));var path=require(_0xf57c('0x9'));var sox=require('sox');var csv=require(_0xf57c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf57c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf57c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf57c('0xd'));var toCsv=require(_0xf57c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf57c('0xe'));var authService=require(_0xf57c('0xf'));var qs=require(_0xf57c('0x10'));var as=require(_0xf57c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57c('0x12'))(_0xf57c('0x13'));var utils=require(_0xf57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf57c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27de1b,_0x15e264){_0x15e264=_0x15e264||0xcc;return function(_0x4cc38b){if(_0x4cc38b){return _0x27de1b[_0xf57c('0x16')](_0x15e264);}return _0x27de1b['status'](_0x15e264)[_0xf57c('0x17')]();};}function respondWithResult(_0x598342,_0x23c2b5){_0x23c2b5=_0x23c2b5||0xc8;return function(_0xc56c5){if(_0xc56c5){return _0x598342[_0xf57c('0x18')](_0x23c2b5)[_0xf57c('0x19')](_0xc56c5);}};}function respondWithFilteredResult(_0x168f5c,_0x3d12a0){return function(_0x1fb5f5){if(_0x1fb5f5){var _0x3163eb=typeof _0x3d12a0['offset']===_0xf57c('0x1a')&&typeof _0x3d12a0['limit']===_0xf57c('0x1a');var _0x2d8386=_0x1fb5f5['count'];var _0x385a4f=_0x3163eb?0x0:_0x3d12a0[_0xf57c('0x1b')];var _0x3eb951=_0x3163eb?_0x1fb5f5[_0xf57c('0x1c')]:_0x3d12a0[_0xf57c('0x1b')]+_0x3d12a0['limit'];var _0x3c6e33;if(_0x3eb951>=_0x2d8386){_0x3eb951=_0x2d8386;_0x3c6e33=0xc8;}else{_0x3c6e33=0xce;}_0x168f5c[_0xf57c('0x18')](_0x3c6e33);return _0x168f5c[_0xf57c('0x1d')]('Content-Range',_0x385a4f+'-'+_0x3eb951+'/'+_0x2d8386)['json'](_0x1fb5f5);}return null;};}function patchUpdates(_0x3ac299){return function(_0x1f8a65){try{jsonpatch[_0xf57c('0x1e')](_0x1f8a65,_0x3ac299,!![]);}catch(_0x23a827){return BPromise[_0xf57c('0x1f')](_0x23a827);}return _0x1f8a65[_0xf57c('0x20')]();};}function saveUpdates(_0xea8ee8,_0x396e18){return function(_0xf3baee){if(_0xf3baee){return _0xf3baee['update'](_0xea8ee8)[_0xf57c('0x21')](function(_0x177e74){return _0x177e74;});}return null;};}function removeEntity(_0x551cf0,_0x5ad03e){return function(_0x3c4923){if(_0x3c4923){return _0x3c4923['destroy']()[_0xf57c('0x21')](function(){_0x551cf0[_0xf57c('0x18')](0xcc)[_0xf57c('0x17')]();});}};}function handleEntityNotFound(_0x584bc3,_0xc70f3e){return function(_0x195ae5){if(!_0x195ae5){_0x584bc3['sendStatus'](0x194);}return _0x195ae5;};}function handleError(_0x387d7c,_0x2ac666){_0x2ac666=_0x2ac666||0x1f4;return function(_0x1b12ff){logger[_0xf57c('0x22')](_0x1b12ff[_0xf57c('0x23')]);if(_0x1b12ff[_0xf57c('0x24')]){delete _0x1b12ff[_0xf57c('0x24')];}_0x387d7c[_0xf57c('0x18')](_0x2ac666)[_0xf57c('0x25')](_0x1b12ff);};}exports['show']=function(_0x35e6f8,_0x1f5f3b){var _0x56726f={'raw':!![],'where':{'id':_0x35e6f8[_0xf57c('0x26')]['id']}},_0x2e69e9={};_0x2e69e9[_0xf57c('0x27')]=_[_0xf57c('0x28')](db[_0xf57c('0x29')][_0xf57c('0x2a')]);_0x2e69e9[_0xf57c('0x2b')]=_[_0xf57c('0x28')](_0x35e6f8[_0xf57c('0x2b')]);_0x2e69e9[_0xf57c('0x2c')]=_['intersection'](_0x2e69e9[_0xf57c('0x27')],_0x2e69e9[_0xf57c('0x2b')]);_0x56726f[_0xf57c('0x2d')]=_['intersection'](_0x2e69e9['model'],qs['fields'](_0x35e6f8[_0xf57c('0x2b')][_0xf57c('0x2e')]));_0x56726f[_0xf57c('0x2d')]=_0x56726f[_0xf57c('0x2d')]['length']?_0x56726f[_0xf57c('0x2d')]:_0x2e69e9[_0xf57c('0x27')];if(_0x35e6f8[_0xf57c('0x2b')]['includeAll']){_0x56726f[_0xf57c('0x2f')]=[{'all':!![]}];}_0x56726f=_[_0xf57c('0x30')]({},_0x56726f,_0x35e6f8[_0xf57c('0x31')]);return db[_0xf57c('0x29')][_0xf57c('0x32')](_0x56726f)[_0xf57c('0x21')](handleEntityNotFound(_0x1f5f3b,null))['then'](respondWithResult(_0x1f5f3b,null))[_0xf57c('0x33')](handleError(_0x1f5f3b,null));};exports[_0xf57c('0x34')]=function(_0x4da04a,_0x533795){return db[_0xf57c('0x29')]['create'](_0x4da04a[_0xf57c('0x35')],{})['then'](respondWithResult(_0x533795,0xc9))[_0xf57c('0x33')](handleError(_0x533795,null));};exports[_0xf57c('0x36')]=function(_0x17e8dc,_0x136304){if(_0x17e8dc['body']['id']){delete _0x17e8dc[_0xf57c('0x35')]['id'];}return db['ChatProactiveAction'][_0xf57c('0x32')]({'where':{'id':_0x17e8dc[_0xf57c('0x26')]['id']}})[_0xf57c('0x21')](handleEntityNotFound(_0x136304,null))[_0xf57c('0x21')](saveUpdates(_0x17e8dc[_0xf57c('0x35')],null))[_0xf57c('0x21')](respondWithResult(_0x136304,null))['catch'](handleError(_0x136304,null));};exports['destroy']=function(_0x1d5bf9,_0x26a65b){return db[_0xf57c('0x29')]['find']({'where':{'id':_0x1d5bf9[_0xf57c('0x26')]['id']}})['then'](handleEntityNotFound(_0x26a65b,null))[_0xf57c('0x21')](removeEntity(_0x26a65b,null))[_0xf57c('0x33')](handleError(_0x26a65b,null));}; \ No newline at end of file +var _0xc9b0=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','then','catch','create','body','params','eml-format','rimraf'];(function(_0x1ae78b,_0x289a17){var _0x2046c9=function(_0x3f61a1){while(--_0x3f61a1){_0x1ae78b['push'](_0x1ae78b['shift']());}};_0x2046c9(++_0x289a17);}(_0xc9b0,0x143));var _0x0c9b=function(_0x316e51,_0x2be274){_0x316e51=_0x316e51-0x0;var _0x2ae55c=_0xc9b0[_0x316e51];return _0x2ae55c;};'use strict';var emlformat=require(_0x0c9b('0x0'));var rimraf=require(_0x0c9b('0x1'));var zipdir=require(_0x0c9b('0x2'));var jsonpatch=require(_0x0c9b('0x3'));var rp=require(_0x0c9b('0x4'));var moment=require(_0x0c9b('0x5'));var BPromise=require(_0x0c9b('0x6'));var Mustache=require(_0x0c9b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0c9b('0x8'));var csv=require(_0x0c9b('0x9'));var ejs=require(_0x0c9b('0xa'));var fs=require('fs');var fs_extra=require(_0x0c9b('0xb'));var _=require(_0x0c9b('0xc'));var squel=require(_0x0c9b('0xd'));var crypto=require(_0x0c9b('0xe'));var jsforce=require(_0x0c9b('0xf'));var deskjs=require(_0x0c9b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0c9b('0x11'));var authService=require(_0x0c9b('0x12'));var qs=require(_0x0c9b('0x13'));var as=require(_0x0c9b('0x14'));var hardwareService=require(_0x0c9b('0x15'));var logger=require(_0x0c9b('0x16'))('api');var utils=require(_0x0c9b('0x17'));var config=require(_0x0c9b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c9b('0x19'))['db'];function respondWithStatusCode(_0x4acc77,_0x273644){_0x273644=_0x273644||0xcc;return function(_0xe55deb){if(_0xe55deb){return _0x4acc77[_0x0c9b('0x1a')](_0x273644);}return _0x4acc77[_0x0c9b('0x1b')](_0x273644)[_0x0c9b('0x1c')]();};}function respondWithResult(_0x2bc058,_0x291aeb){_0x291aeb=_0x291aeb||0xc8;return function(_0x41603d){if(_0x41603d){return _0x2bc058[_0x0c9b('0x1b')](_0x291aeb)[_0x0c9b('0x1d')](_0x41603d);}};}function respondWithFilteredResult(_0x4daf5e,_0x5967a6){return function(_0x518486){if(_0x518486){var _0x3ac356=typeof _0x5967a6[_0x0c9b('0x1e')]==='undefined'&&typeof _0x5967a6[_0x0c9b('0x1f')]===_0x0c9b('0x20');var _0x3279cd=_0x518486[_0x0c9b('0x21')];var _0x2b2f65=_0x3ac356?0x0:_0x5967a6[_0x0c9b('0x1e')];var _0x39218d=_0x3ac356?_0x518486['count']:_0x5967a6['offset']+_0x5967a6[_0x0c9b('0x1f')];var _0x49d499;if(_0x39218d>=_0x3279cd){_0x39218d=_0x3279cd;_0x49d499=0xc8;}else{_0x49d499=0xce;}_0x4daf5e[_0x0c9b('0x1b')](_0x49d499);return _0x4daf5e[_0x0c9b('0x22')](_0x0c9b('0x23'),_0x2b2f65+'-'+_0x39218d+'/'+_0x3279cd)[_0x0c9b('0x1d')](_0x518486);}return null;};}function patchUpdates(_0x1bf9f1){return function(_0x3d335c){try{jsonpatch[_0x0c9b('0x24')](_0x3d335c,_0x1bf9f1,!![]);}catch(_0x2269d4){return BPromise[_0x0c9b('0x25')](_0x2269d4);}return _0x3d335c[_0x0c9b('0x26')]();};}function saveUpdates(_0x4cc5cc,_0x19f6e2){return function(_0x3dfd64){if(_0x3dfd64){return _0x3dfd64[_0x0c9b('0x27')](_0x4cc5cc)['then'](function(_0x428a74){return _0x428a74;});}return null;};}function removeEntity(_0x37ee51,_0x2409c6){return function(_0x5c83c8){if(_0x5c83c8){return _0x5c83c8[_0x0c9b('0x28')]()['then'](function(){_0x37ee51[_0x0c9b('0x1b')](0xcc)[_0x0c9b('0x1c')]();});}};}function handleEntityNotFound(_0x2d1ce5,_0x1824d2){return function(_0xd0733f){if(!_0xd0733f){_0x2d1ce5[_0x0c9b('0x1a')](0x194);}return _0xd0733f;};}function handleError(_0x29e457,_0x21748a){_0x21748a=_0x21748a||0x1f4;return function(_0x476c59){logger[_0x0c9b('0x29')](_0x476c59[_0x0c9b('0x2a')]);if(_0x476c59['name']){delete _0x476c59['name'];}_0x29e457[_0x0c9b('0x1b')](_0x21748a)[_0x0c9b('0x2b')](_0x476c59);};}exports[_0x0c9b('0x2c')]=function(_0x2c9f63,_0x4ca17d){var _0x361d03={'raw':!![],'where':{'id':_0x2c9f63['params']['id']}},_0x1391d1={};_0x1391d1[_0x0c9b('0x2d')]=_[_0x0c9b('0x2e')](db[_0x0c9b('0x2f')][_0x0c9b('0x30')]);_0x1391d1[_0x0c9b('0x31')]=_[_0x0c9b('0x2e')](_0x2c9f63['query']);_0x1391d1[_0x0c9b('0x32')]=_[_0x0c9b('0x33')](_0x1391d1['model'],_0x1391d1[_0x0c9b('0x31')]);_0x361d03[_0x0c9b('0x34')]=_[_0x0c9b('0x33')](_0x1391d1[_0x0c9b('0x2d')],qs[_0x0c9b('0x35')](_0x2c9f63[_0x0c9b('0x31')][_0x0c9b('0x35')]));_0x361d03[_0x0c9b('0x34')]=_0x361d03[_0x0c9b('0x34')][_0x0c9b('0x36')]?_0x361d03[_0x0c9b('0x34')]:_0x1391d1['model'];if(_0x2c9f63['query'][_0x0c9b('0x37')]){_0x361d03[_0x0c9b('0x38')]=[{'all':!![]}];}_0x361d03=_[_0x0c9b('0x39')]({},_0x361d03,_0x2c9f63[_0x0c9b('0x3a')]);return db[_0x0c9b('0x2f')][_0x0c9b('0x3b')](_0x361d03)[_0x0c9b('0x3c')](handleEntityNotFound(_0x4ca17d,null))[_0x0c9b('0x3c')](respondWithResult(_0x4ca17d,null))[_0x0c9b('0x3d')](handleError(_0x4ca17d,null));};exports[_0x0c9b('0x3e')]=function(_0x535ab7,_0x1a4513){return db['ChatProactiveAction'][_0x0c9b('0x3e')](_0x535ab7[_0x0c9b('0x3f')],{})[_0x0c9b('0x3c')](respondWithResult(_0x1a4513,0xc9))[_0x0c9b('0x3d')](handleError(_0x1a4513,null));};exports[_0x0c9b('0x27')]=function(_0x5b300a,_0x430db5){if(_0x5b300a['body']['id']){delete _0x5b300a['body']['id'];}return db[_0x0c9b('0x2f')]['find']({'where':{'id':_0x5b300a[_0x0c9b('0x40')]['id']}})[_0x0c9b('0x3c')](handleEntityNotFound(_0x430db5,null))[_0x0c9b('0x3c')](saveUpdates(_0x5b300a[_0x0c9b('0x3f')],null))[_0x0c9b('0x3c')](respondWithResult(_0x430db5,null))[_0x0c9b('0x3d')](handleError(_0x430db5,null));};exports[_0x0c9b('0x28')]=function(_0xa12618,_0x26e3ef){return db[_0x0c9b('0x2f')][_0x0c9b('0x3b')]({'where':{'id':_0xa12618[_0x0c9b('0x40')]['id']}})['then'](handleEntityNotFound(_0x26e3ef,null))[_0x0c9b('0x3c')](removeEntity(_0x26e3ef,null))[_0x0c9b('0x3d')](handleError(_0x26e3ef,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 02cd9c7..1fb7609 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 _0x4c8d=['moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api'];(function(_0x3fc105,_0x3cd614){var _0x1dc50c=function(_0x19ff17){while(--_0x19ff17){_0x3fc105['push'](_0x3fc105['shift']());}};_0x1dc50c(++_0x3cd614);}(_0x4c8d,0x69));var _0xd4c8=function(_0x481e5a,_0x4cfe56){_0x481e5a=_0x481e5a-0x0;var _0x35674e=_0x4c8d[_0x481e5a];return _0x35674e;};'use strict';var _=require(_0xd4c8('0x0'));var util=require(_0xd4c8('0x1'));var logger=require('../../config/logger')(_0xd4c8('0x2'));var moment=require(_0xd4c8('0x3'));var BPromise=require(_0xd4c8('0x4'));var rp=require(_0xd4c8('0x5'));var fs=require('fs');var path=require(_0xd4c8('0x6'));var rimraf=require('rimraf');var config=require(_0xd4c8('0x7'));var attributes=require(_0xd4c8('0x8'));module['exports']=function(_0x12ce4e,_0x565efd){return _0x12ce4e[_0xd4c8('0x9')](_0xd4c8('0xa'),attributes,{'tableName':_0xd4c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe700=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xe700,0x1e4));var _0x0e70=function(_0xd76c91,_0x15257d){_0xd76c91=_0xd76c91-0x0;var _0x245e91=_0xe700[_0xd76c91];return _0x245e91;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0e70('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e70('0x4'));var rimraf=require(_0x0e70('0x5'));var config=require(_0x0e70('0x6'));var attributes=require(_0x0e70('0x7'));module[_0x0e70('0x8')]=function(_0x5210af,_0x11188f){return _0x5210af[_0x0e70('0x9')](_0x0e70('0xa'),attributes,{'tableName':_0x0e70('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d44ea1c..0bdd05e 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 _0x2170=['rpc','../../config/environment','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x540381,_0x48e0ed){var _0x5e7c3d=function(_0x215b7a){while(--_0x215b7a){_0x540381['push'](_0x540381['shift']());}};_0x5e7c3d(++_0x48e0ed);}(_0x2170,0xa1));var _0x0217=function(_0x23b4df,_0x33dfa6){_0x23b4df=_0x23b4df-0x0;var _0x26b927=_0x2170[_0x23b4df];return _0x26b927;};'use strict';var _=require(_0x0217('0x0'));var util=require(_0x0217('0x1'));var moment=require(_0x0217('0x2'));var BPromise=require(_0x0217('0x3'));var rs=require(_0x0217('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0217('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0217('0x6'))(_0x0217('0x7'));var config=require(_0x0217('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0217('0x9')][_0x0217('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36379f,_0xfdbe80,_0x313f74){return new BPromise(function(_0x221e94,_0x48b98a){return client[_0x0217('0xb')](_0x36379f,_0x313f74)[_0x0217('0xc')](function(_0x53070d){logger['info'](_0x0217('0xd'),_0xfdbe80,_0x0217('0xe'));logger[_0x0217('0xf')](_0x0217('0x10'),_0xfdbe80,_0x0217('0xe'),JSON[_0x0217('0x11')](_0x53070d));if(_0x53070d[_0x0217('0x12')]){if(_0x53070d['error'][_0x0217('0x13')]===0x1f4){logger[_0x0217('0x12')](_0x0217('0xd'),_0xfdbe80,_0x53070d['error'][_0x0217('0x14')]);return _0x48b98a(_0x53070d[_0x0217('0x12')][_0x0217('0x14')]);}logger[_0x0217('0x12')](_0x0217('0xd'),_0xfdbe80,_0x53070d[_0x0217('0x12')][_0x0217('0x14')]);return _0x221e94(_0x53070d['error'][_0x0217('0x14')]);}else{logger[_0x0217('0x15')](_0x0217('0xd'),_0xfdbe80,_0x0217('0xe'));_0x221e94(_0x53070d[_0x0217('0x16')]['message']);}})[_0x0217('0x17')](function(_0x44c020){logger[_0x0217('0x12')](_0x0217('0xd'),_0xfdbe80,_0x44c020);_0x48b98a(_0x44c020);});});} \ No newline at end of file +var _0x4ad4=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x4ad4,0xb4));var _0x44ad=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x4ad4[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x44ad('0x0'));var moment=require(_0x44ad('0x1'));var BPromise=require(_0x44ad('0x2'));var rs=require(_0x44ad('0x3'));var fs=require('fs');var Redis=require(_0x44ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44ad('0x5'));var logger=require(_0x44ad('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x44ad('0x7'));var client=jayson['client'][_0x44ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a6602,_0x4fa4cb,_0x3f5938){return new BPromise(function(_0x1d234d,_0x1ed16a){return client['request'](_0x1a6602,_0x3f5938)[_0x44ad('0x9')](function(_0x442cff){logger['info'](_0x44ad('0xa'),_0x4fa4cb,'request\x20sent');logger[_0x44ad('0xb')](_0x44ad('0xc'),_0x4fa4cb,_0x44ad('0xd'),JSON[_0x44ad('0xe')](_0x442cff));if(_0x442cff[_0x44ad('0xf')]){if(_0x442cff[_0x44ad('0xf')][_0x44ad('0x10')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4fa4cb,_0x442cff[_0x44ad('0xf')][_0x44ad('0x11')]);return _0x1ed16a(_0x442cff[_0x44ad('0xf')]['message']);}logger['error'](_0x44ad('0xa'),_0x4fa4cb,_0x442cff[_0x44ad('0xf')]['message']);return _0x1d234d(_0x442cff[_0x44ad('0xf')][_0x44ad('0x11')]);}else{logger[_0x44ad('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x4fa4cb,_0x44ad('0xd'));_0x1d234d(_0x442cff[_0x44ad('0x13')][_0x44ad('0x11')]);}})['catch'](function(_0x29afbb){logger[_0x44ad('0xf')](_0x44ad('0xa'),_0x4fa4cb,_0x29afbb);_0x1ed16a(_0x29afbb);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1b6ab8b..208371b 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 _0x5fd1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','multer','path','connect-timeout','express'];(function(_0x22df57,_0xdf14d5){var _0x160738=function(_0x2865e8){while(--_0x2865e8){_0x22df57['push'](_0x22df57['shift']());}};_0x160738(++_0xdf14d5);}(_0x5fd1,0x155));var _0x15fd=function(_0x18f07e,_0x38a819){_0x18f07e=_0x18f07e-0x0;var _0x2b1a96=_0x5fd1[_0x18f07e];return _0x2b1a96;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x15fd('0x7')](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller[_0x15fd('0xa')]);router[_0x15fd('0xb')]('/',auth['isAuthenticated'](),controller[_0x15fd('0xc')]);router[_0x15fd('0xd')](_0x15fd('0x8'),auth['isAuthenticated'](),controller[_0x15fd('0xe')]);router['delete'](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller['destroy']);module['exports']=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(_0x1e2343,_0x47bf9f){var _0x19c248=function(_0x1346d9){while(--_0x1346d9){_0x1e2343['push'](_0x1e2343['shift']());}};_0x19c248(++_0x47bf9f);}(_0x814b,0x1a2));var _0xb814=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0x814b[_0x189d3c];return _0x485959;};'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 3b3d494..9281d71 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 _0xa3c7=['STRING','name','beepall','roundrobin'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa3c7,0xec));var _0x7a3c=function(_0x385603,_0x1cf762){_0x385603=_0x385603-0x0;var _0x2e10ca=_0xa3c7[_0x385603];return _0x2e10ca;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7a3c('0x0')],'unique':_0x7a3c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7a3c('0x2'),_0x7a3c('0x3'))}}; \ No newline at end of file +var _0x71a6=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x3ab313,_0x4d6b91){var _0x52e13f=function(_0x3e20e9){while(--_0x3e20e9){_0x3ab313['push'](_0x3ab313['shift']());}};_0x52e13f(++_0x4d6b91);}(_0x71a6,0x10e));var _0x671a=function(_0x380af2,_0x36cf66){_0x380af2=_0x380af2-0x0;var _0x1789dc=_0x71a6[_0x380af2];return _0x1789dc;};'use strict';var Sequelize=require('sequelize');module[_0x671a('0x0')]={'name':{'type':Sequelize[_0x671a('0x1')],'unique':_0x671a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x671a('0x1')]},'timeout':{'type':Sequelize[_0x671a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x671a('0x4')](_0x671a('0x5'),_0x671a('0x6'),_0x671a('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index fa98fc9..fa6ed34 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 _0x850f=['UserChatQueue','hasOwnProperty','order','sort','pick','filter','findAll','User','findAndCountAll','UserId','agent','chatPause','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','online','voicePause','interface','Agents','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','transaction','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','nolimit','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','ChatQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','where','include','query','ChatQueue','rows','params','keys','filters','intersection','attributes','model','fields','length','merge','options','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne'];(function(_0x873b4a,_0x530ded){var _0x127210=function(_0x1a57af){while(--_0x1a57af){_0x873b4a['push'](_0x873b4a['shift']());}};_0x127210(++_0x530ded);}(_0x850f,0xb6));var _0xf850=function(_0x2657ee,_0x18647f){_0x2657ee=_0x2657ee-0x0;var _0x2785f3=_0x850f[_0x2657ee];return _0x2785f3;};'use strict';var BPromise=require(_0xf850('0x0'));var util=require('util');var _=require(_0xf850('0x1'));var squel=require('squel');var Redis=require(_0xf850('0x2'));var qs=require(_0xf850('0x3'));var logger=require(_0xf850('0x4'))(_0xf850('0x5'));var config=require(_0xf850('0x6'));var db=require(_0xf850('0x7'))['db'];config[_0xf850('0x8')]=_[_0xf850('0x9')](config[_0xf850('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xf850('0xa'))(new Redis(config[_0xf850('0x8')]));require(_0xf850('0xb'))[_0xf850('0xc')](socket);function respondWithStatusCode(_0x14f3e9,_0x497d66){_0x497d66=_0x497d66||0xcc;return function(_0x48ec9e){if(_0x48ec9e){return _0x14f3e9[_0xf850('0xd')](_0x497d66);}return _0x14f3e9['status'](_0x497d66)[_0xf850('0xe')]();};}function respondWithResult(_0x370649,_0x221cdc){_0x221cdc=_0x221cdc||0xc8;return function(_0x5c7e7b){if(_0x5c7e7b){return _0x370649[_0xf850('0xf')](_0x221cdc)[_0xf850('0x10')](_0x5c7e7b);}};}function respondWithFilteredResult(_0xaa376e,_0x18ed1f){return function(_0x5b4b2f){if(_0x5b4b2f){var _0x5cd387=typeof _0x18ed1f[_0xf850('0x11')]==='undefined'&&typeof _0x18ed1f[_0xf850('0x12')]===_0xf850('0x13');var _0x2b0110=_0x5b4b2f['count'];var _0x32703b=_0x5cd387?0x0:_0x18ed1f[_0xf850('0x11')];var _0x47d7b5=_0x5cd387?_0x5b4b2f[_0xf850('0x14')]:_0x18ed1f[_0xf850('0x11')]+_0x18ed1f[_0xf850('0x12')];var _0x2ebbba;if(_0x47d7b5>=_0x2b0110){_0x47d7b5=_0x2b0110;_0x2ebbba=0xc8;}else{_0x2ebbba=0xce;}_0xaa376e[_0xf850('0xf')](_0x2ebbba);return _0xaa376e[_0xf850('0x15')](_0xf850('0x16'),_0x32703b+'-'+_0x47d7b5+'/'+_0x2b0110)[_0xf850('0x10')](_0x5b4b2f);}return null;};}function saveUpdates(_0x16ca2b){return function(_0x43e4b1){if(_0x43e4b1){return _0x43e4b1[_0xf850('0x17')](_0x16ca2b)[_0xf850('0x18')](function(_0x1a6f9e){return _0x1a6f9e;});}return null;};}function removeEntity(_0x1506e5){return function(_0x1a71d8){if(_0x1a71d8){return _0x1a71d8[_0xf850('0x19')]()[_0xf850('0x18')](function(){var _0x33eaaa=_0x1a71d8['get']({'plain':!![]});var _0x2b5d8e=_0xf850('0x1a');return db[_0xf850('0x1b')][_0xf850('0x19')]({'where':{'type':_0x2b5d8e,'resourceId':_0x33eaaa['id']}})['then'](function(){return _0x1a71d8;});})[_0xf850('0x18')](function(){_0x1506e5['status'](0xcc)[_0xf850('0xe')]();});}};}function handleEntityNotFound(_0x1af7ff){return function(_0x2d55b3){if(!_0x2d55b3){_0x1af7ff['sendStatus'](0x194);}return _0x2d55b3;};}function handleError(_0x5ad608,_0x146888){_0x146888=_0x146888||0x1f4;return function(_0x376ef8){logger[_0xf850('0x1c')](_0x376ef8[_0xf850('0x1d')]);if(_0x376ef8[_0xf850('0x1e')]){delete _0x376ef8[_0xf850('0x1e')];}_0x5ad608['status'](_0x146888)[_0xf850('0x1f')](_0x376ef8);};}exports[_0xf850('0x20')]=function(_0x44df32,_0x29cf7b){var _0x456aa3={};var _0x133bdf={'count':0x0,'rows':[]};var _0x42c3f4=_[_0xf850('0x21')](db['ChatQueue'][_0xf850('0x22')],function(_0x1cc98e){return{'name':_0x1cc98e[_0xf850('0x23')],'type':_0x1cc98e['type'][_0xf850('0x24')]};});_0x456aa3=qs[_0xf850('0x25')](_0x42c3f4,_0x44df32);var _0x1524dc={'where':_0x456aa3[_0xf850('0x26')]};return db['ChatQueue'][_0xf850('0x14')](_0x1524dc)[_0xf850('0x18')](function(_0x4c82eb){_0x133bdf['count']=_0x4c82eb;_0x456aa3[_0xf850('0x27')]=qs[_0xf850('0x27')](_0x44df32[_0xf850('0x28')]);return db[_0xf850('0x29')]['findAll'](_0x456aa3);})[_0xf850('0x18')](function(_0x4db3e0){_0x133bdf[_0xf850('0x2a')]=_0x4db3e0;return _0x133bdf;})[_0xf850('0x18')](respondWithFilteredResult(_0x29cf7b,_0x456aa3))['catch'](handleError(_0x29cf7b,null));};exports['show']=function(_0x20635e,_0x3dffed){var _0x32afaf={'raw':!![],'where':{'id':_0x20635e[_0xf850('0x2b')]['id']}},_0x1cf7e1={};_0x1cf7e1['model']=_['keys'](db['ChatQueue'][_0xf850('0x22')]);_0x1cf7e1[_0xf850('0x28')]=_[_0xf850('0x2c')](_0x20635e[_0xf850('0x28')]);_0x1cf7e1[_0xf850('0x2d')]=_[_0xf850('0x2e')](_0x1cf7e1['model'],_0x1cf7e1[_0xf850('0x28')]);_0x32afaf[_0xf850('0x2f')]=_[_0xf850('0x2e')](_0x1cf7e1[_0xf850('0x30')],qs[_0xf850('0x31')](_0x20635e[_0xf850('0x28')][_0xf850('0x31')]));_0x32afaf[_0xf850('0x2f')]=_0x32afaf[_0xf850('0x2f')][_0xf850('0x32')]?_0x32afaf['attributes']:_0x1cf7e1[_0xf850('0x30')];if(_0x20635e['query']['includeAll']){_0x32afaf[_0xf850('0x27')]=[{'all':!![]}];}_0x32afaf=_[_0xf850('0x33')]({},_0x32afaf,_0x20635e[_0xf850('0x34')]);return db[_0xf850('0x29')]['find'](_0x32afaf)['then'](handleEntityNotFound(_0x3dffed,null))['then'](respondWithResult(_0x3dffed,null))[_0xf850('0x35')](handleError(_0x3dffed,null));};exports[_0xf850('0x36')]=function(_0xdee3d3,_0x30139b){return db[_0xf850('0x29')]['create'](_0xdee3d3['body'],{})[_0xf850('0x18')](function(_0x48fce7){var _0x5714e5=_0xdee3d3[_0xf850('0x37')][_0xf850('0x38')]({'plain':!![]});if(!_0x5714e5)throw new Error(_0xf850('0x39'));if(_0x5714e5[_0xf850('0x3a')]===_0xf850('0x37')){var _0x5868ee=_0x48fce7[_0xf850('0x38')]({'plain':!![]});var _0x5a6077=_0xf850('0x1a');return db[_0xf850('0x3b')][_0xf850('0x3c')]({'where':{'name':_0x5a6077,'userProfileId':_0x5714e5[_0xf850('0x3d')]},'raw':!![]})['then'](function(_0x46d5f5){if(_0x46d5f5&&_0x46d5f5[_0xf850('0x3e')]===0x0){return db[_0xf850('0x1b')][_0xf850('0x36')]({'name':_0x5868ee[_0xf850('0x1e')],'resourceId':_0x5868ee['id'],'type':_0x46d5f5[_0xf850('0x1e')],'sectionId':_0x46d5f5['id']},{})[_0xf850('0x18')](function(){return _0x48fce7;});}else{return _0x48fce7;}})[_0xf850('0x35')](function(_0x1c8dc2){logger[_0xf850('0x1c')](_0xf850('0x3f'),_0x1c8dc2);throw _0x1c8dc2;});}return _0x48fce7;})[_0xf850('0x18')](respondWithResult(_0x30139b,0xc9))[_0xf850('0x35')](handleError(_0x30139b,null));};exports[_0xf850('0x17')]=function(_0x16cf53,_0x211782){if(_0x16cf53['body']['id']){delete _0x16cf53['body']['id'];}return db[_0xf850('0x29')]['find']({'where':{'id':_0x16cf53[_0xf850('0x2b')]['id']}})[_0xf850('0x18')](handleEntityNotFound(_0x211782,null))['then'](saveUpdates(_0x16cf53[_0xf850('0x40')],null))['then'](respondWithResult(_0x211782,null))[_0xf850('0x35')](handleError(_0x211782,null));};exports[_0xf850('0x19')]=function(_0x4178de,_0x307fb1){return db[_0xf850('0x29')][_0xf850('0x3c')]({'where':{'id':_0x4178de[_0xf850('0x2b')]['id']}})[_0xf850('0x18')](handleEntityNotFound(_0x307fb1,null))['then'](removeEntity(_0x307fb1,null))[_0xf850('0x35')](handleError(_0x307fb1,null));};exports['describe']=function(_0x37a97c,_0x42526b){return db['ChatQueue'][_0xf850('0x41')]()[_0xf850('0x18')](respondWithResult(_0x42526b,null))['catch'](handleError(_0x42526b,null));};exports[_0xf850('0x42')]=function(_0x2f7e0a,_0xc4d657){var _0x1a4b3e={'raw':!![],'where':{}},_0x2189b3={},_0x19b813;return db[_0xf850('0x29')][_0xf850('0x43')]({'where':{'id':_0x2f7e0a['params']['id']}})[_0xf850('0x18')](handleEntityNotFound(_0xc4d657,null))[_0xf850('0x18')](function(_0x2b9c0f){if(_0x2b9c0f){_0x19b813=_0x2b9c0f['get']({'plain':!![]});_0x2189b3[_0xf850('0x30')]=_[_0xf850('0x2c')](db[_0xf850('0x44')][_0xf850('0x22')]);_0x2189b3['query']=_[_0xf850('0x2c')](_0x2f7e0a[_0xf850('0x28')]);_0x2189b3[_0xf850('0x2d')]=_[_0xf850('0x2e')](_0x2189b3[_0xf850('0x30')],_0x2189b3[_0xf850('0x28')]);_0x1a4b3e['attributes']=_[_0xf850('0x2e')](_0x2189b3[_0xf850('0x30')],qs[_0xf850('0x31')](_0x2f7e0a['query']['fields']));_0x1a4b3e[_0xf850('0x2f')]=_0x1a4b3e[_0xf850('0x2f')][_0xf850('0x32')]?_0x1a4b3e[_0xf850('0x2f')]:_0x2189b3[_0xf850('0x30')];if(!_0x2f7e0a[_0xf850('0x28')][_0xf850('0x45')]('nolimit')){_0x1a4b3e['limit']=qs[_0xf850('0x12')](_0x2f7e0a[_0xf850('0x28')][_0xf850('0x12')]);_0x1a4b3e[_0xf850('0x11')]=qs[_0xf850('0x11')](_0x2f7e0a['query'][_0xf850('0x11')]);}_0x1a4b3e[_0xf850('0x46')]=qs[_0xf850('0x47')](_0x2f7e0a[_0xf850('0x28')]['sort']);_0x1a4b3e['where']=qs['filters'](_[_0xf850('0x48')](_0x2f7e0a['query'],_0x2189b3[_0xf850('0x2d')]));_0x1a4b3e[_0xf850('0x26')]['ChatQueueId']=_0x2b9c0f['id'];if(_0x2f7e0a['query']['filter']){_0x1a4b3e[_0xf850('0x26')]=_['merge'](_0x1a4b3e[_0xf850('0x26')],{'$or':_[_0xf850('0x21')](_0x1a4b3e[_0xf850('0x2f')],function(_0x42efc6){var _0x5e0382={};_0x5e0382[_0x42efc6]={'$like':'%'+_0x2f7e0a[_0xf850('0x28')][_0xf850('0x49')]+'%'};return _0x5e0382;})});}_0x1a4b3e=_[_0xf850('0x33')]({},_0x1a4b3e,_0x2f7e0a[_0xf850('0x34')]);return db[_0xf850('0x44')][_0xf850('0x4a')](_0x1a4b3e);}})['then'](function(_0x126aa9){if(_0x126aa9){return db[_0xf850('0x4b')][_0xf850('0x4c')]({'where':{'id':_[_0xf850('0x21')](_0x126aa9,_0xf850('0x4d')),'role':_0xf850('0x4e')},'attributes':['id',_0xf850('0x1e'),_0xf850('0x4f'),'updatedAt','createdAt']});}})[_0xf850('0x18')](function(_0x36f331){if(_0x36f331){return{'count':_0x36f331[_0xf850('0x14')],'rows':_['map'](_0x36f331['rows'],function(_0x4366d6){return{'membername':_0x4366d6[_0xf850('0x1e')],'UserId':_0x4366d6['id'],'queue_name':_0x19b813[_0xf850('0x1e')],'ChatQueueId':_0x19b813['id'],'interface':util['format'](_0xf850('0x50'),_0xf850('0x51'),_0x4366d6['name']),'penalty':0x0,'paused':_0x4366d6['chatPause'],'createdAt':_0x4366d6[_0xf850('0x52')],'updatedAt':_0x4366d6[_0xf850('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xc4d657,_0x1a4b3e))['catch'](handleError(_0xc4d657,null));};exports[_0xf850('0x54')]=function(_0x5c19ea,_0x49bad9){var _0x4832cf={};var _0x146146={};var _0x2bff35;var _0x3ff06c;return db['ChatQueue']['findOne']({'where':{'id':_0x5c19ea[_0xf850('0x2b')]['id']}})[_0xf850('0x18')](handleEntityNotFound(_0x49bad9,null))[_0xf850('0x18')](function(_0x2486b8){if(_0x2486b8){_0x2bff35=_0x2486b8;_0x146146[_0xf850('0x30')]=_[_0xf850('0x2c')](db[_0xf850('0x55')][_0xf850('0x22')]);_0x146146[_0xf850('0x28')]=_[_0xf850('0x2c')](_0x5c19ea['query']);_0x146146['filters']=_[_0xf850('0x2e')](_0x146146[_0xf850('0x30')],_0x146146[_0xf850('0x28')]);_0x4832cf['attributes']=_[_0xf850('0x2e')](_0x146146[_0xf850('0x30')],qs[_0xf850('0x31')](_0x5c19ea[_0xf850('0x28')][_0xf850('0x31')]));_0x4832cf['attributes']=_0x4832cf[_0xf850('0x2f')]['length']?_0x4832cf[_0xf850('0x2f')]:_0x146146[_0xf850('0x30')];_0x4832cf['order']=qs['sort'](_0x5c19ea[_0xf850('0x28')][_0xf850('0x47')]);_0x4832cf[_0xf850('0x26')]=qs[_0xf850('0x2d')](_['pick'](_0x5c19ea['query'],_0x146146[_0xf850('0x2d')]));if(_0x5c19ea[_0xf850('0x28')]['filter']){_0x4832cf[_0xf850('0x26')]=_[_0xf850('0x33')](_0x4832cf[_0xf850('0x26')],{'$or':_['map'](_0x4832cf['attributes'],function(_0x5ed9b5){var _0x2c32ee={};_0x2c32ee[_0x5ed9b5]={'$like':'%'+_0x5c19ea[_0xf850('0x28')]['filter']+'%'};return _0x2c32ee;})});}_0x4832cf=_['merge']({},_0x4832cf,_0x5c19ea[_0xf850('0x34')]);return _0x2bff35[_0xf850('0x54')](_0x4832cf);}})[_0xf850('0x18')](function(_0x84b2c1){if(_0x84b2c1){_0x3ff06c=_0x84b2c1[_0xf850('0x32')];if(!_0x5c19ea[_0xf850('0x28')][_0xf850('0x45')]('nolimit')){_0x4832cf['limit']=qs[_0xf850('0x12')](_0x5c19ea[_0xf850('0x28')]['limit']);_0x4832cf['offset']=qs['offset'](_0x5c19ea[_0xf850('0x28')]['offset']);}return _0x2bff35['getTeams'](_0x4832cf);}})[_0xf850('0x18')](function(_0x285b8){if(_0x285b8){return _0x285b8?{'count':_0x3ff06c,'rows':_0x285b8}:null;}})[_0xf850('0x18')](respondWithResult(_0x49bad9,null))[_0xf850('0x35')](handleError(_0x49bad9,null));};exports[_0xf850('0x56')]=function(_0x28a0a9,_0x22be54){var _0x6f37ff=_0x28a0a9[_0xf850('0x40')][_0xf850('0x57')];return db[_0xf850('0x55')][_0xf850('0x4a')]({'where':{'id':_0x6f37ff},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xf850('0x58'),_0xf850('0x59'),_0xf850('0x5a')],'raw':!![]}]})[_0xf850('0x18')](function(_0x23d873){if(_0x23d873){var _0x19c483=_['flatMap'](_0x23d873,function(_0x2b6a46){var _0x5e2880=_0x2b6a46[_0xf850('0x38')]({'plain':!![]});return _0x5e2880[_0xf850('0x5b')];});return db[_0xf850('0x29')][_0xf850('0x3c')]({'where':{'id':_0x28a0a9[_0xf850('0x2b')]['id']}})['then'](function(_0x17acdf){return db[_0xf850('0x5c')]['transaction'](function(_0x3a3640){return _0x17acdf[_0xf850('0x56')](_0x6f37ff,{'transaction':_0x3a3640})[_0xf850('0x18')](function(){return BPromise[_0xf850('0x5d')](_0x19c483,function(_0x454fcf){return db[_0xf850('0x44')][_0xf850('0x5e')]({'where':{'UserId':_0x454fcf['id'],'ChatQueueId':_0x28a0a9[_0xf850('0x2b')]['id']},'transaction':_0x3a3640});});})['then'](function(){_0x19c483[_0xf850('0x5f')](function(_0x3ac203){socket[_0xf850('0x60')](_0xf850('0x61'),{'UserId':_0x3ac203['id'],'ChatQueueId':_0x17acdf['id']});});});});});}})['then'](respondWithStatusCode(_0x22be54,null))[_0xf850('0x35')](handleError(_0x22be54,null));};exports[_0xf850('0x62')]=function(_0x400be6,_0x1b3dab){return db[_0xf850('0x55')][_0xf850('0x4a')]({'where':{'id':_0x400be6[_0xf850('0x28')][_0xf850('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf850('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1b3dab,null))[_0xf850('0x18')](function(_0x4a13e9){var _0x5837bc=_[_0xf850('0x21')](_0x4a13e9,'id');var _0x4cf6ec=[];var _0x22d112=[];var _0x4cb941=squel[_0xf850('0x63')]();_0x4cb941['field'](_0xf850('0x64'))[_0xf850('0x65')](_0xf850('0x66'),'tq')[_0xf850('0x67')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf850('0x26')](_0xf850('0x68'),_0x400be6[_0xf850('0x2b')]['id']);for(var _0x59d8fc=0x0;_0x59d8fc<_0x4a13e9[_0xf850('0x32')];_0x59d8fc+=0x1){let _0x4a658d=_0x4a13e9[_0x59d8fc];for(var _0x4d472f=0x0;_0x4d472f<_0x4a658d[_0xf850('0x5b')][_0xf850('0x32')];_0x4d472f+=0x1){let _0x1bf958=_0x4a658d[_0xf850('0x5b')][_0x4d472f];var _0x552613=_0x4cb941[_0xf850('0x69')]();_0x552613[_0xf850('0x26')](_0xf850('0x6a'),_0x1bf958['id']);_0x22d112[_0xf850('0x6b')](db[_0xf850('0x5c')][_0xf850('0x28')](_0x552613[_0xf850('0x6c')](),{'type':db['sequelize']['QueryTypes'][_0xf850('0x6d')]})['then'](function(_0x3ba0f6){if(_0x3ba0f6['length']===0x1){return _0x1bf958['id'];}else{var _0xe5b5b3=_[_0xf850('0x6e')](_[_0xf850('0x21')](_0x3ba0f6,_0xf850('0x6f')),function(_0x4c3db5){return _[_0xf850('0x70')](_0x5837bc,_0x4c3db5);});if(_0xe5b5b3){return _0x1bf958['id'];}}}));}}return BPromise[_0xf850('0x71')](_0x22d112)[_0xf850('0x18')](function(_0x530a49){_0x4cf6ec=_(_0x4cf6ec)[_0xf850('0x72')](_0x530a49)['compact']()[_0xf850('0x73')]();return db[_0xf850('0x29')]['find']({'where':{'id':_0x400be6[_0xf850('0x2b')]['id']}})['then'](function(_0xa795b6){return db['sequelize'][_0xf850('0x74')](function(_0x3a8c71){return _0xa795b6[_0xf850('0x62')](_0x400be6['query'][_0xf850('0x57')],{'transaction':_0x3a8c71})[_0xf850('0x18')](function(){if(!_['isEmpty'](_0x4cf6ec)){return _0xa795b6[_0xf850('0x75')](_0x4cf6ec,{'transaction':_0x3a8c71});}})['then'](function(){_0x4cf6ec[_0xf850('0x5f')](function(_0xd07c3f){socket[_0xf850('0x60')]('userChatQueue:remove',{'UserId':_0xd07c3f,'ChatQueueId':_0xa795b6['id']});});});});});});})[_0xf850('0x18')](respondWithStatusCode(_0x1b3dab,null))[_0xf850('0x35')](handleError(_0x1b3dab,null));};exports[_0xf850('0x76')]=function(_0x4752ac,_0x317ce0){return db[_0xf850('0x29')][_0xf850('0x3c')]({'where':{'id':_0x4752ac['params']['id']}})[_0xf850('0x18')](handleEntityNotFound(_0x317ce0,null))[_0xf850('0x18')](function(_0x377669){if(_0x377669){return _0x377669[_0xf850('0x76')](_0x4752ac[_0xf850('0x40')]['ids'],_[_0xf850('0x77')](_0x4752ac['body'],[_0xf850('0x57'),'id'])||{})[_0xf850('0x78')](function(_0x5ad861){for(var _0x41fd19=0x0;_0x41fd19<_0x4752ac[_0xf850('0x40')][_0xf850('0x57')][_0xf850('0x32')];_0x41fd19+=0x1){socket[_0xf850('0x60')](_0xf850('0x61'),{'UserId':Number(_0x4752ac[_0xf850('0x40')]['ids'][_0x41fd19]),'ChatQueueId':Number(_0x4752ac[_0xf850('0x2b')]['id'])});}return _0x5ad861;});}})[_0xf850('0x18')](respondWithResult(_0x317ce0,null))[_0xf850('0x35')](handleError(_0x317ce0,null));};exports['removeAgents']=function(_0x50caa6,_0x5662ec){return db[_0xf850('0x29')]['find']({'where':{'id':_0x50caa6[_0xf850('0x2b')]['id']}})[_0xf850('0x18')](handleEntityNotFound(_0x5662ec,null))[_0xf850('0x18')](function(_0x13f694){if(_0x13f694){return _0x13f694[_0xf850('0x75')](_0x50caa6[_0xf850('0x28')][_0xf850('0x57')])[_0xf850('0x18')](function(){if(_[_0xf850('0x79')](_0x50caa6['query'][_0xf850('0x57')])){for(var _0x580117=0x0;_0x580117<_0x50caa6[_0xf850('0x28')][_0xf850('0x57')][_0xf850('0x32')];_0x580117+=0x1){socket[_0xf850('0x60')](_0xf850('0x7a'),{'UserId':Number(_0x50caa6['query'][_0xf850('0x57')][_0x580117]),'ChatQueueId':Number(_0x50caa6[_0xf850('0x2b')]['id'])});}}else{socket['emit'](_0xf850('0x7a'),{'UserId':Number(_0x50caa6[_0xf850('0x28')][_0xf850('0x57')]),'ChatQueueId':Number(_0x50caa6[_0xf850('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x5662ec,null))[_0xf850('0x35')](handleError(_0x5662ec,null));};exports[_0xf850('0x7b')]=function(_0xf63c9e,_0x1645dc){var _0x4a55f0={};var _0x265427={};var _0x5cc060;var _0x2937e8;return db['ChatQueue']['findOne']({'where':{'id':_0xf63c9e[_0xf850('0x2b')]['id']}})[_0xf850('0x18')](handleEntityNotFound(_0x1645dc,null))['then'](function(_0xbe6fda){if(_0xbe6fda){_0x5cc060=_0xbe6fda;_0x265427[_0xf850('0x30')]=_[_0xf850('0x2c')](db['User'][_0xf850('0x22')]);_0x265427['query']=_['keys'](_0xf63c9e[_0xf850('0x28')]);_0x265427[_0xf850('0x2d')]=_[_0xf850('0x2e')](_0x265427[_0xf850('0x30')],_0x265427[_0xf850('0x28')]);_0x4a55f0[_0xf850('0x2f')]=_[_0xf850('0x2e')](_0x265427[_0xf850('0x30')],qs[_0xf850('0x31')](_0xf63c9e['query'][_0xf850('0x31')]));_0x4a55f0[_0xf850('0x2f')]=_0x4a55f0[_0xf850('0x2f')][_0xf850('0x32')]?_0x4a55f0[_0xf850('0x2f')]:_0x265427['model'];_0x4a55f0[_0xf850('0x46')]=qs[_0xf850('0x47')](_0xf63c9e[_0xf850('0x28')][_0xf850('0x47')]);_0x4a55f0[_0xf850('0x26')]=qs['filters'](_[_0xf850('0x48')](_0xf63c9e[_0xf850('0x28')],_0x265427['filters']));if(_0xf63c9e[_0xf850('0x28')][_0xf850('0x49')]){_0x4a55f0[_0xf850('0x26')]=_[_0xf850('0x33')](_0x4a55f0['where'],{'$or':_[_0xf850('0x21')](_0x4a55f0[_0xf850('0x2f')],function(_0x3412e5){var _0x769e5e={};_0x769e5e[_0x3412e5]={'$like':'%'+_0xf63c9e['query'][_0xf850('0x49')]+'%'};return _0x769e5e;})});}_0x4a55f0=_[_0xf850('0x33')]({},_0x4a55f0,_0xf63c9e['options']);return _0x5cc060[_0xf850('0x7b')](_0x4a55f0);}})[_0xf850('0x18')](function(_0x2d4cda){if(_0x2d4cda){_0x2937e8=_0x2d4cda['length'];if(!_0xf63c9e[_0xf850('0x28')]['hasOwnProperty'](_0xf850('0x7c'))){_0x4a55f0[_0xf850('0x12')]=qs[_0xf850('0x12')](_0xf63c9e['query'][_0xf850('0x12')]);_0x4a55f0[_0xf850('0x11')]=qs[_0xf850('0x11')](_0xf63c9e[_0xf850('0x28')][_0xf850('0x11')]);}return _0x5cc060['getAgents'](_0x4a55f0);}})['then'](function(_0x3d1574){if(_0x3d1574){return _0x3d1574?{'count':_0x2937e8,'rows':_0x3d1574}:null;}})[_0xf850('0x18')](respondWithResult(_0x1645dc,null))[_0xf850('0x35')](handleError(_0x1645dc,null));}; \ No newline at end of file +var _0xd35e=['userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','value','removeAgents','forEach','addAgents','spread','isArray','userChatQueue:remove','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','UserProfileResource','destroy','stack','name','index','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','merge','create','get','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','keys','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','map','options','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','getTeams','findOne','Team','order','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','emit'];(function(_0x510bd8,_0x46c1e6){var _0xcd6e09=function(_0x4adabe){while(--_0x4adabe){_0x510bd8['push'](_0x510bd8['shift']());}};_0xcd6e09(++_0x46c1e6);}(_0xd35e,0x17e));var _0xed35=function(_0x49d48d,_0xf1fdaa){_0x49d48d=_0x49d48d-0x0;var _0x46e093=_0xd35e[_0x49d48d];return _0x46e093;};'use strict';var BPromise=require('bluebird');var util=require(_0xed35('0x0'));var _=require(_0xed35('0x1'));var squel=require(_0xed35('0x2'));var Redis=require(_0xed35('0x3'));var qs=require(_0xed35('0x4'));var logger=require(_0xed35('0x5'))('api');var config=require(_0xed35('0x6'));var db=require('../../mysqldb')['db'];config[_0xed35('0x7')]=_[_0xed35('0x8')](config[_0xed35('0x7')],{'host':_0xed35('0x9'),'port':0x18eb});var socket=require(_0xed35('0xa'))(new Redis(config[_0xed35('0x7')]));require(_0xed35('0xb'))[_0xed35('0xc')](socket);function respondWithStatusCode(_0x5f387d,_0x297a68){_0x297a68=_0x297a68||0xcc;return function(_0x30e0ad){if(_0x30e0ad){return _0x5f387d[_0xed35('0xd')](_0x297a68);}return _0x5f387d[_0xed35('0xe')](_0x297a68)['end']();};}function respondWithResult(_0x1a66b9,_0x57e36a){_0x57e36a=_0x57e36a||0xc8;return function(_0x2337c9){if(_0x2337c9){return _0x1a66b9[_0xed35('0xe')](_0x57e36a)[_0xed35('0xf')](_0x2337c9);}};}function respondWithFilteredResult(_0x334059,_0x54acfe){return function(_0x42c087){if(_0x42c087){var _0x5818b8=typeof _0x54acfe['offset']===_0xed35('0x10')&&typeof _0x54acfe[_0xed35('0x11')]===_0xed35('0x10');var _0x9f5209=_0x42c087[_0xed35('0x12')];var _0x24b36d=_0x5818b8?0x0:_0x54acfe[_0xed35('0x13')];var _0x496021=_0x5818b8?_0x42c087[_0xed35('0x12')]:_0x54acfe[_0xed35('0x13')]+_0x54acfe['limit'];var _0xfe4249;if(_0x496021>=_0x9f5209){_0x496021=_0x9f5209;_0xfe4249=0xc8;}else{_0xfe4249=0xce;}_0x334059[_0xed35('0xe')](_0xfe4249);return _0x334059[_0xed35('0x14')](_0xed35('0x15'),_0x24b36d+'-'+_0x496021+'/'+_0x9f5209)['json'](_0x42c087);}return null;};}function saveUpdates(_0x7f651e){return function(_0x29f9a0){if(_0x29f9a0){return _0x29f9a0[_0xed35('0x16')](_0x7f651e)[_0xed35('0x17')](function(_0x52b4a6){return _0x52b4a6;});}return null;};}function removeEntity(_0x36cec5){return function(_0x18c61e){if(_0x18c61e){return _0x18c61e['destroy']()[_0xed35('0x17')](function(){var _0x54b4cc=_0x18c61e['get']({'plain':!![]});var _0x2321f5='ChatQueues';return db[_0xed35('0x18')][_0xed35('0x19')]({'where':{'type':_0x2321f5,'resourceId':_0x54b4cc['id']}})['then'](function(){return _0x18c61e;});})[_0xed35('0x17')](function(){_0x36cec5[_0xed35('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x474e2f){return function(_0x594af3){if(!_0x594af3){_0x474e2f[_0xed35('0xd')](0x194);}return _0x594af3;};}function handleError(_0x5d19a9,_0x3a4b82){_0x3a4b82=_0x3a4b82||0x1f4;return function(_0x31accf){logger['error'](_0x31accf[_0xed35('0x1a')]);if(_0x31accf['name']){delete _0x31accf[_0xed35('0x1b')];}_0x5d19a9[_0xed35('0xe')](_0x3a4b82)['send'](_0x31accf);};}exports[_0xed35('0x1c')]=function(_0x4c30cd,_0x5156b2){var _0x2170c3={};var _0x2edd46={'count':0x0,'rows':[]};var _0x5992b4=_['map'](db[_0xed35('0x1d')][_0xed35('0x1e')],function(_0x1ccc0e){return{'name':_0x1ccc0e[_0xed35('0x1f')],'type':_0x1ccc0e[_0xed35('0x20')][_0xed35('0x21')]};});_0x2170c3=qs[_0xed35('0x22')](_0x5992b4,_0x4c30cd);var _0x301bdb={'where':_0x2170c3[_0xed35('0x23')]};return db[_0xed35('0x1d')][_0xed35('0x12')](_0x301bdb)[_0xed35('0x17')](function(_0x1d1427){_0x2edd46[_0xed35('0x12')]=_0x1d1427;_0x2170c3[_0xed35('0x24')]=qs['include'](_0x4c30cd[_0xed35('0x25')]);return db[_0xed35('0x1d')]['findAll'](_0x2170c3);})[_0xed35('0x17')](function(_0x3d3c1a){_0x2edd46[_0xed35('0x26')]=_0x3d3c1a;return _0x2edd46;})['then'](respondWithFilteredResult(_0x5156b2,_0x2170c3))[_0xed35('0x27')](handleError(_0x5156b2,null));};exports[_0xed35('0x28')]=function(_0x4a2e3a,_0x3e1560){var _0x41ce87={'raw':!![],'where':{'id':_0x4a2e3a[_0xed35('0x29')]['id']}},_0x38a400={};_0x38a400[_0xed35('0x2a')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x38a400[_0xed35('0x25')]=_['keys'](_0x4a2e3a['query']);_0x38a400[_0xed35('0x2b')]=_[_0xed35('0x2c')](_0x38a400[_0xed35('0x2a')],_0x38a400[_0xed35('0x25')]);_0x41ce87[_0xed35('0x2d')]=_[_0xed35('0x2c')](_0x38a400['model'],qs['fields'](_0x4a2e3a['query'][_0xed35('0x2e')]));_0x41ce87[_0xed35('0x2d')]=_0x41ce87[_0xed35('0x2d')][_0xed35('0x2f')]?_0x41ce87[_0xed35('0x2d')]:_0x38a400[_0xed35('0x2a')];if(_0x4a2e3a[_0xed35('0x25')][_0xed35('0x30')]){_0x41ce87['include']=[{'all':!![]}];}_0x41ce87=_[_0xed35('0x31')]({},_0x41ce87,_0x4a2e3a['options']);return db[_0xed35('0x1d')]['find'](_0x41ce87)[_0xed35('0x17')](handleEntityNotFound(_0x3e1560,null))[_0xed35('0x17')](respondWithResult(_0x3e1560,null))[_0xed35('0x27')](handleError(_0x3e1560,null));};exports[_0xed35('0x32')]=function(_0xb779c9,_0x14c2a1){return db[_0xed35('0x1d')][_0xed35('0x32')](_0xb779c9['body'],{})['then'](function(_0x55c303){var _0x3885d8=_0xb779c9['user'][_0xed35('0x33')]({'plain':!![]});if(!_0x3885d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3885d8[_0xed35('0x34')]===_0xed35('0x35')){var _0x4ea937=_0x55c303[_0xed35('0x33')]({'plain':!![]});var _0x45750d=_0xed35('0x36');return db[_0xed35('0x37')]['find']({'where':{'name':_0x45750d,'userProfileId':_0x3885d8[_0xed35('0x38')]},'raw':!![]})['then'](function(_0x1205a8){if(_0x1205a8&&_0x1205a8[_0xed35('0x39')]===0x0){return db['UserProfileResource'][_0xed35('0x32')]({'name':_0x4ea937[_0xed35('0x1b')],'resourceId':_0x4ea937['id'],'type':_0x1205a8['name'],'sectionId':_0x1205a8['id']},{})[_0xed35('0x17')](function(){return _0x55c303;});}else{return _0x55c303;}})[_0xed35('0x27')](function(_0x5e5d43){logger['error'](_0xed35('0x3a'),_0x5e5d43);throw _0x5e5d43;});}return _0x55c303;})[_0xed35('0x17')](respondWithResult(_0x14c2a1,0xc9))[_0xed35('0x27')](handleError(_0x14c2a1,null));};exports[_0xed35('0x16')]=function(_0x3a00de,_0x1e103e){if(_0x3a00de[_0xed35('0x3b')]['id']){delete _0x3a00de[_0xed35('0x3b')]['id'];}return db[_0xed35('0x1d')][_0xed35('0x3c')]({'where':{'id':_0x3a00de['params']['id']}})['then'](handleEntityNotFound(_0x1e103e,null))[_0xed35('0x17')](saveUpdates(_0x3a00de[_0xed35('0x3b')],null))[_0xed35('0x17')](respondWithResult(_0x1e103e,null))[_0xed35('0x27')](handleError(_0x1e103e,null));};exports[_0xed35('0x19')]=function(_0x3ee5d1,_0x358066){return db[_0xed35('0x1d')][_0xed35('0x3c')]({'where':{'id':_0x3ee5d1[_0xed35('0x29')]['id']}})['then'](handleEntityNotFound(_0x358066,null))['then'](removeEntity(_0x358066,null))[_0xed35('0x27')](handleError(_0x358066,null));};exports['describe']=function(_0x29563d,_0x4fff9b){return db[_0xed35('0x1d')][_0xed35('0x3d')]()[_0xed35('0x17')](respondWithResult(_0x4fff9b,null))[_0xed35('0x27')](handleError(_0x4fff9b,null));};exports[_0xed35('0x3e')]=function(_0xb70763,_0x34d9f7){var _0x42b777={'raw':!![],'where':{}},_0x52d589={},_0x574819;return db[_0xed35('0x1d')]['findOne']({'where':{'id':_0xb70763[_0xed35('0x29')]['id']}})[_0xed35('0x17')](handleEntityNotFound(_0x34d9f7,null))[_0xed35('0x17')](function(_0x4263a3){if(_0x4263a3){_0x574819=_0x4263a3['get']({'plain':!![]});_0x52d589['model']=_[_0xed35('0x3f')](db[_0xed35('0x40')][_0xed35('0x1e')]);_0x52d589[_0xed35('0x25')]=_[_0xed35('0x3f')](_0xb70763['query']);_0x52d589[_0xed35('0x2b')]=_[_0xed35('0x2c')](_0x52d589[_0xed35('0x2a')],_0x52d589[_0xed35('0x25')]);_0x42b777[_0xed35('0x2d')]=_['intersection'](_0x52d589['model'],qs[_0xed35('0x2e')](_0xb70763[_0xed35('0x25')][_0xed35('0x2e')]));_0x42b777['attributes']=_0x42b777[_0xed35('0x2d')][_0xed35('0x2f')]?_0x42b777[_0xed35('0x2d')]:_0x52d589[_0xed35('0x2a')];if(!_0xb70763[_0xed35('0x25')][_0xed35('0x41')](_0xed35('0x42'))){_0x42b777[_0xed35('0x11')]=qs[_0xed35('0x11')](_0xb70763[_0xed35('0x25')][_0xed35('0x11')]);_0x42b777['offset']=qs['offset'](_0xb70763[_0xed35('0x25')]['offset']);}_0x42b777['order']=qs[_0xed35('0x43')](_0xb70763[_0xed35('0x25')][_0xed35('0x43')]);_0x42b777['where']=qs[_0xed35('0x2b')](_[_0xed35('0x44')](_0xb70763[_0xed35('0x25')],_0x52d589[_0xed35('0x2b')]));_0x42b777[_0xed35('0x23')][_0xed35('0x45')]=_0x4263a3['id'];if(_0xb70763[_0xed35('0x25')][_0xed35('0x46')]){_0x42b777['where']=_[_0xed35('0x31')](_0x42b777[_0xed35('0x23')],{'$or':_[_0xed35('0x47')](_0x42b777['attributes'],function(_0x10a8fb){var _0x111ac4={};_0x111ac4[_0x10a8fb]={'$like':'%'+_0xb70763[_0xed35('0x25')][_0xed35('0x46')]+'%'};return _0x111ac4;})});}_0x42b777=_['merge']({},_0x42b777,_0xb70763[_0xed35('0x48')]);return db['UserChatQueue'][_0xed35('0x49')](_0x42b777);}})[_0xed35('0x17')](function(_0x1a35ac){if(_0x1a35ac){return db[_0xed35('0x4a')]['findAndCountAll']({'where':{'id':_['map'](_0x1a35ac,_0xed35('0x4b')),'role':_0xed35('0x4c')},'attributes':['id','name',_0xed35('0x4d'),_0xed35('0x4e'),_0xed35('0x4f')]});}})[_0xed35('0x17')](function(_0x2d9699){if(_0x2d9699){return{'count':_0x2d9699[_0xed35('0x12')],'rows':_[_0xed35('0x47')](_0x2d9699[_0xed35('0x26')],function(_0x2fd9ec){return{'membername':_0x2fd9ec[_0xed35('0x1b')],'UserId':_0x2fd9ec['id'],'queue_name':_0x574819[_0xed35('0x1b')],'ChatQueueId':_0x574819['id'],'interface':util['format'](_0xed35('0x50'),'SIP',_0x2fd9ec[_0xed35('0x1b')]),'penalty':0x0,'paused':_0x2fd9ec[_0xed35('0x4d')],'createdAt':_0x2fd9ec[_0xed35('0x4f')],'updatedAt':_0x2fd9ec[_0xed35('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xed35('0x17')](respondWithFilteredResult(_0x34d9f7,_0x42b777))[_0xed35('0x27')](handleError(_0x34d9f7,null));};exports[_0xed35('0x51')]=function(_0xcb7fae,_0x11df9b){var _0x75782={};var _0x5d99f0={};var _0x1e2db8;var _0x430020;return db[_0xed35('0x1d')][_0xed35('0x52')]({'where':{'id':_0xcb7fae[_0xed35('0x29')]['id']}})[_0xed35('0x17')](handleEntityNotFound(_0x11df9b,null))['then'](function(_0x17b984){if(_0x17b984){_0x1e2db8=_0x17b984;_0x5d99f0[_0xed35('0x2a')]=_['keys'](db[_0xed35('0x53')][_0xed35('0x1e')]);_0x5d99f0[_0xed35('0x25')]=_[_0xed35('0x3f')](_0xcb7fae[_0xed35('0x25')]);_0x5d99f0[_0xed35('0x2b')]=_[_0xed35('0x2c')](_0x5d99f0['model'],_0x5d99f0['query']);_0x75782[_0xed35('0x2d')]=_['intersection'](_0x5d99f0[_0xed35('0x2a')],qs[_0xed35('0x2e')](_0xcb7fae['query'][_0xed35('0x2e')]));_0x75782[_0xed35('0x2d')]=_0x75782[_0xed35('0x2d')][_0xed35('0x2f')]?_0x75782['attributes']:_0x5d99f0[_0xed35('0x2a')];_0x75782[_0xed35('0x54')]=qs[_0xed35('0x43')](_0xcb7fae[_0xed35('0x25')][_0xed35('0x43')]);_0x75782[_0xed35('0x23')]=qs[_0xed35('0x2b')](_[_0xed35('0x44')](_0xcb7fae[_0xed35('0x25')],_0x5d99f0[_0xed35('0x2b')]));if(_0xcb7fae[_0xed35('0x25')][_0xed35('0x46')]){_0x75782[_0xed35('0x23')]=_[_0xed35('0x31')](_0x75782[_0xed35('0x23')],{'$or':_[_0xed35('0x47')](_0x75782[_0xed35('0x2d')],function(_0x1ea043){var _0x6a3cb5={};_0x6a3cb5[_0x1ea043]={'$like':'%'+_0xcb7fae['query'][_0xed35('0x46')]+'%'};return _0x6a3cb5;})});}_0x75782=_[_0xed35('0x31')]({},_0x75782,_0xcb7fae[_0xed35('0x48')]);return _0x1e2db8[_0xed35('0x51')](_0x75782);}})[_0xed35('0x17')](function(_0x3cdbb7){if(_0x3cdbb7){_0x430020=_0x3cdbb7['length'];if(!_0xcb7fae['query'][_0xed35('0x41')](_0xed35('0x42'))){_0x75782[_0xed35('0x11')]=qs[_0xed35('0x11')](_0xcb7fae['query'][_0xed35('0x11')]);_0x75782[_0xed35('0x13')]=qs[_0xed35('0x13')](_0xcb7fae[_0xed35('0x25')][_0xed35('0x13')]);}return _0x1e2db8[_0xed35('0x51')](_0x75782);}})[_0xed35('0x17')](function(_0x30e243){if(_0x30e243){return _0x30e243?{'count':_0x430020,'rows':_0x30e243}:null;}})[_0xed35('0x17')](respondWithResult(_0x11df9b,null))[_0xed35('0x27')](handleError(_0x11df9b,null));};exports['addTeams']=function(_0x3ca422,_0x57ae88){var _0x153923=_0x3ca422[_0xed35('0x3b')][_0xed35('0x55')];return db[_0xed35('0x53')][_0xed35('0x49')]({'where':{'id':_0x153923},'attributes':['id'],'include':[{'model':db[_0xed35('0x4a')],'as':_0xed35('0x56'),'attributes':['id',_0xed35('0x1b'),_0xed35('0x57'),_0xed35('0x58'),'interface'],'raw':!![]}]})['then'](function(_0x32fa1e){if(_0x32fa1e){var _0x2a8bb2=_['flatMap'](_0x32fa1e,function(_0x527027){var _0x3a531e=_0x527027[_0xed35('0x33')]({'plain':!![]});return _0x3a531e[_0xed35('0x56')];});return db['ChatQueue'][_0xed35('0x3c')]({'where':{'id':_0x3ca422[_0xed35('0x29')]['id']}})['then'](function(_0x370b2d){return db[_0xed35('0x59')][_0xed35('0x5a')](function(_0xdaf078){return _0x370b2d['addTeams'](_0x153923,{'transaction':_0xdaf078})[_0xed35('0x17')](function(){return BPromise[_0xed35('0x5b')](_0x2a8bb2,function(_0x4dff47){return db[_0xed35('0x40')][_0xed35('0x5c')]({'where':{'UserId':_0x4dff47['id'],'ChatQueueId':_0x3ca422['params']['id']},'transaction':_0xdaf078});});})[_0xed35('0x17')](function(){_0x2a8bb2['forEach'](function(_0x1b0f1e){socket[_0xed35('0x5d')](_0xed35('0x5e'),{'UserId':_0x1b0f1e['id'],'ChatQueueId':_0x370b2d['id']});});});});});}})['then'](respondWithStatusCode(_0x57ae88,null))[_0xed35('0x27')](handleError(_0x57ae88,null));};exports[_0xed35('0x5f')]=function(_0x18069f,_0x413565){return db[_0xed35('0x53')]['findAll']({'where':{'id':_0x18069f['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xed35('0x4a')],'as':_0xed35('0x56'),'attributes':['id'],'raw':!![]}]})[_0xed35('0x17')](handleEntityNotFound(_0x413565,null))['then'](function(_0x134818){var _0x47c2b1=_[_0xed35('0x47')](_0x134818,'id');var _0x14a1df=[];var _0x29f54f=[];var _0x32246c=squel[_0xed35('0x60')]();_0x32246c[_0xed35('0x61')](_0xed35('0x62'))['from'](_0xed35('0x63'),'tq')['join']('user_has_teams','ut',_0xed35('0x64'))[_0xed35('0x23')](_0xed35('0x65'),_0x18069f['params']['id']);for(var _0x3fb64e=0x0;_0x3fb64e<_0x134818[_0xed35('0x2f')];_0x3fb64e+=0x1){let _0x5f2b30=_0x134818[_0x3fb64e];for(var _0x206c96=0x0;_0x206c96<_0x5f2b30[_0xed35('0x56')][_0xed35('0x2f')];_0x206c96+=0x1){let _0x7fd552=_0x5f2b30['Agents'][_0x206c96];var _0x2794ad=_0x32246c[_0xed35('0x66')]();_0x2794ad[_0xed35('0x23')](_0xed35('0x67'),_0x7fd552['id']);_0x29f54f[_0xed35('0x68')](db[_0xed35('0x59')][_0xed35('0x25')](_0x2794ad[_0xed35('0x69')](),{'type':db[_0xed35('0x59')][_0xed35('0x6a')]['SELECT']})[_0xed35('0x17')](function(_0x2f73a7){if(_0x2f73a7[_0xed35('0x2f')]===0x1){return _0x7fd552['id'];}else{var _0x38be96=_[_0xed35('0x6b')](_[_0xed35('0x47')](_0x2f73a7,_0xed35('0x6c')),function(_0xf8f4b7){return _['includes'](_0x47c2b1,_0xf8f4b7);});if(_0x38be96){return _0x7fd552['id'];}}}));}}return BPromise[_0xed35('0x6d')](_0x29f54f)['then'](function(_0x55e697){_0x14a1df=_(_0x14a1df)[_0xed35('0x6e')](_0x55e697)['compact']()[_0xed35('0x6f')]();return db[_0xed35('0x1d')][_0xed35('0x3c')]({'where':{'id':_0x18069f['params']['id']}})[_0xed35('0x17')](function(_0x2cd00a){return db['sequelize'][_0xed35('0x5a')](function(_0x5c31ce){return _0x2cd00a[_0xed35('0x5f')](_0x18069f['query'][_0xed35('0x55')],{'transaction':_0x5c31ce})[_0xed35('0x17')](function(){if(!_['isEmpty'](_0x14a1df)){return _0x2cd00a[_0xed35('0x70')](_0x14a1df,{'transaction':_0x5c31ce});}})['then'](function(){_0x14a1df[_0xed35('0x71')](function(_0x3c2d8b){socket['emit']('userChatQueue:remove',{'UserId':_0x3c2d8b,'ChatQueueId':_0x2cd00a['id']});});});});});});})[_0xed35('0x17')](respondWithStatusCode(_0x413565,null))['catch'](handleError(_0x413565,null));};exports[_0xed35('0x72')]=function(_0x21a0db,_0x52acd0){return db[_0xed35('0x1d')]['find']({'where':{'id':_0x21a0db[_0xed35('0x29')]['id']}})['then'](handleEntityNotFound(_0x52acd0,null))['then'](function(_0x3dcc48){if(_0x3dcc48){return _0x3dcc48[_0xed35('0x72')](_0x21a0db[_0xed35('0x3b')][_0xed35('0x55')],_['omit'](_0x21a0db[_0xed35('0x3b')],[_0xed35('0x55'),'id'])||{})[_0xed35('0x73')](function(_0xc58052){for(var _0x448b8c=0x0;_0x448b8c<_0x21a0db[_0xed35('0x3b')][_0xed35('0x55')]['length'];_0x448b8c+=0x1){socket[_0xed35('0x5d')](_0xed35('0x5e'),{'UserId':Number(_0x21a0db[_0xed35('0x3b')][_0xed35('0x55')][_0x448b8c]),'ChatQueueId':Number(_0x21a0db['params']['id'])});}return _0xc58052;});}})['then'](respondWithResult(_0x52acd0,null))['catch'](handleError(_0x52acd0,null));};exports[_0xed35('0x70')]=function(_0x3f83f1,_0x250106){return db[_0xed35('0x1d')][_0xed35('0x3c')]({'where':{'id':_0x3f83f1[_0xed35('0x29')]['id']}})['then'](handleEntityNotFound(_0x250106,null))[_0xed35('0x17')](function(_0x5d407d){if(_0x5d407d){return _0x5d407d['removeAgents'](_0x3f83f1['query'][_0xed35('0x55')])[_0xed35('0x17')](function(){if(_[_0xed35('0x74')](_0x3f83f1[_0xed35('0x25')][_0xed35('0x55')])){for(var _0x3596a0=0x0;_0x3596a0<_0x3f83f1['query'][_0xed35('0x55')]['length'];_0x3596a0+=0x1){socket[_0xed35('0x5d')](_0xed35('0x75'),{'UserId':Number(_0x3f83f1['query']['ids'][_0x3596a0]),'ChatQueueId':Number(_0x3f83f1[_0xed35('0x29')]['id'])});}}else{socket[_0xed35('0x5d')](_0xed35('0x75'),{'UserId':Number(_0x3f83f1[_0xed35('0x25')][_0xed35('0x55')]),'ChatQueueId':Number(_0x3f83f1[_0xed35('0x29')]['id'])});}});}})[_0xed35('0x17')](respondWithStatusCode(_0x250106,null))[_0xed35('0x27')](handleError(_0x250106,null));};exports[_0xed35('0x76')]=function(_0x517e9a,_0x190e62){var _0x3ed7d3={};var _0x1a5a31={};var _0x1c7c55;var _0x1e4481;return db[_0xed35('0x1d')][_0xed35('0x52')]({'where':{'id':_0x517e9a['params']['id']}})[_0xed35('0x17')](handleEntityNotFound(_0x190e62,null))['then'](function(_0x1f014b){if(_0x1f014b){_0x1c7c55=_0x1f014b;_0x1a5a31[_0xed35('0x2a')]=_[_0xed35('0x3f')](db[_0xed35('0x4a')][_0xed35('0x1e')]);_0x1a5a31[_0xed35('0x25')]=_[_0xed35('0x3f')](_0x517e9a[_0xed35('0x25')]);_0x1a5a31['filters']=_['intersection'](_0x1a5a31[_0xed35('0x2a')],_0x1a5a31[_0xed35('0x25')]);_0x3ed7d3[_0xed35('0x2d')]=_[_0xed35('0x2c')](_0x1a5a31[_0xed35('0x2a')],qs[_0xed35('0x2e')](_0x517e9a[_0xed35('0x25')][_0xed35('0x2e')]));_0x3ed7d3['attributes']=_0x3ed7d3['attributes'][_0xed35('0x2f')]?_0x3ed7d3[_0xed35('0x2d')]:_0x1a5a31[_0xed35('0x2a')];_0x3ed7d3['order']=qs['sort'](_0x517e9a['query'][_0xed35('0x43')]);_0x3ed7d3[_0xed35('0x23')]=qs['filters'](_[_0xed35('0x44')](_0x517e9a['query'],_0x1a5a31[_0xed35('0x2b')]));if(_0x517e9a['query'][_0xed35('0x46')]){_0x3ed7d3[_0xed35('0x23')]=_['merge'](_0x3ed7d3['where'],{'$or':_['map'](_0x3ed7d3[_0xed35('0x2d')],function(_0x2ef8b5){var _0x1c3893={};_0x1c3893[_0x2ef8b5]={'$like':'%'+_0x517e9a[_0xed35('0x25')][_0xed35('0x46')]+'%'};return _0x1c3893;})});}_0x3ed7d3=_[_0xed35('0x31')]({},_0x3ed7d3,_0x517e9a[_0xed35('0x48')]);return _0x1c7c55['getAgents'](_0x3ed7d3);}})[_0xed35('0x17')](function(_0x517e14){if(_0x517e14){_0x1e4481=_0x517e14[_0xed35('0x2f')];if(!_0x517e9a['query'][_0xed35('0x41')](_0xed35('0x42'))){_0x3ed7d3['limit']=qs[_0xed35('0x11')](_0x517e9a[_0xed35('0x25')][_0xed35('0x11')]);_0x3ed7d3[_0xed35('0x13')]=qs[_0xed35('0x13')](_0x517e9a[_0xed35('0x25')][_0xed35('0x13')]);}return _0x1c7c55[_0xed35('0x76')](_0x3ed7d3);}})[_0xed35('0x17')](function(_0x5a5ede){if(_0x5a5ede){return _0x5a5ede?{'count':_0x1e4481,'rows':_0x5a5ede}:null;}})['then'](respondWithResult(_0x190e62,null))[_0xed35('0x27')](handleError(_0x190e62,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1205d94..56845b2 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 _0xcdc8=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x16a7bc,_0x3ee4fb){var _0x54e51d=function(_0x37aa57){while(--_0x37aa57){_0x16a7bc['push'](_0x16a7bc['shift']());}};_0x54e51d(++_0x3ee4fb);}(_0xcdc8,0x1a9));var _0x8cdc=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xcdc8[_0x134c2e];return _0x2825db;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x8cdc('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8cdc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8cdc('0x2'),'afterDestroy':_0x8cdc('0x3')};function emitEvent(_0x440424){return function(_0x5a5de8,_0x3591a5,_0x450ba0){ChatQueueEvents[_0x8cdc('0x4')](_0x440424+':'+_0x5a5de8['id'],_0x5a5de8);ChatQueueEvents[_0x8cdc('0x4')](_0x440424,_0x5a5de8);_0x450ba0(null);};}for(var e in events){if(events[_0x8cdc('0x5')](e)){var event=events[e];ChatQueue[_0x8cdc('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5a78=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2202cc,_0x2a5a73){var _0x4213c7=function(_0x569056){while(--_0x569056){_0x2202cc['push'](_0x2202cc['shift']());}};_0x4213c7(++_0x2a5a73);}(_0x5a78,0x1ac));var _0x85a7=function(_0x391c38,_0x43bc3d){_0x391c38=_0x391c38-0x0;var _0xbd82e4=_0x5a78[_0x391c38];return _0xbd82e4;};'use strict';var EventEmitter=require(_0x85a7('0x0'));var ChatQueue=require(_0x85a7('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x85a7('0x2')](0x0);var events={'afterCreate':_0x85a7('0x3'),'afterUpdate':'update','afterDestroy':_0x85a7('0x4')};function emitEvent(_0x4d19f4){return function(_0x580f7e,_0x40ad75,_0x3f675b){ChatQueueEvents[_0x85a7('0x5')](_0x4d19f4+':'+_0x580f7e['id'],_0x580f7e);ChatQueueEvents[_0x85a7('0x5')](_0x4d19f4,_0x580f7e);_0x3f675b(null);};}for(var e in events){if(events[_0x85a7('0x6')](e)){var event=events[e];ChatQueue[_0x85a7('0x7')](e,emitEvent(event));}}module[_0x85a7('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 bc849a0..adc4ba3 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 _0xdab2=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0xf31df4,_0x502718){var _0xb79fc=function(_0x237593){while(--_0x237593){_0xf31df4['push'](_0xf31df4['shift']());}};_0xb79fc(++_0x502718);}(_0xdab2,0x188));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require(_0x2dab('0x2'))(_0x2dab('0x3'));var moment=require(_0x2dab('0x4'));var BPromise=require(_0x2dab('0x5'));var rp=require(_0x2dab('0x6'));var fs=require('fs');var path=require(_0x2dab('0x7'));var rimraf=require(_0x2dab('0x8'));var config=require(_0x2dab('0x9'));var attributes=require(_0x2dab('0xa'));module[_0x2dab('0xb')]=function(_0x4c4802,_0x9cafa7){return _0x4c4802[_0x2dab('0xc')](_0x2dab('0xd'),attributes,{'tableName':_0x2dab('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe1a=['exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatQueue.attributes'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0xfe1a,0x1cb));var _0xafe1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfe1a[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xafe1('0x0'));var util=require(_0xafe1('0x1'));var logger=require(_0xafe1('0x2'))(_0xafe1('0x3'));var moment=require(_0xafe1('0x4'));var BPromise=require(_0xafe1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafe1('0x6'));var rimraf=require(_0xafe1('0x7'));var config=require('../../config/environment');var attributes=require(_0xafe1('0x8'));module[_0xafe1('0x9')]=function(_0x5217f3,_0x2a0b83){return _0x5217f3[_0xafe1('0xa')](_0xafe1('0xb'),attributes,{'tableName':_0xafe1('0xc'),'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 ecedcfb..656c8cf 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 _0x62ff=['map','model','then','ShowChatQueue','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','attributes','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62ff,0x1e5));var _0xf62f=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x62ff[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xf62f('0x0'));var util=require(_0xf62f('0x1'));var moment=require('moment');var BPromise=require(_0xf62f('0x2'));var rs=require(_0xf62f('0x3'));var fs=require('fs');var Redis=require(_0xf62f('0x4'));var db=require(_0xf62f('0x5'))['db'];var utils=require(_0xf62f('0x6'));var logger=require(_0xf62f('0x7'))(_0xf62f('0x8'));var config=require('../../config/environment');var jayson=require(_0xf62f('0x9'));var client=jayson[_0xf62f('0xa')][_0xf62f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf62f('0xc')],{'host':_0xf62f('0xd'),'port':0x18eb});var socket=require(_0xf62f('0xe'))(new Redis(config[_0xf62f('0xc')]));require(_0xf62f('0xf'))[_0xf62f('0x10')](socket);function respondWithRpcPromise(_0x5c10ee,_0x1ca783,_0x52624a){return new BPromise(function(_0x6e5ead,_0x226349){return client['request'](_0x5c10ee,_0x52624a)['then'](function(_0x3da720){logger[_0xf62f('0x11')](_0xf62f('0x12'),_0x1ca783,_0xf62f('0x13'));logger[_0xf62f('0x14')](_0xf62f('0x15'),_0x1ca783,_0xf62f('0x13'),JSON[_0xf62f('0x16')](_0x3da720));if(_0x3da720[_0xf62f('0x17')]){if(_0x3da720['error'][_0xf62f('0x18')]===0x1f4){logger[_0xf62f('0x17')](_0xf62f('0x12'),_0x1ca783,_0x3da720[_0xf62f('0x17')]['message']);return _0x226349(_0x3da720['error']['message']);}logger[_0xf62f('0x17')]('ChatQueue,\x20%s,\x20%s',_0x1ca783,_0x3da720[_0xf62f('0x17')][_0xf62f('0x19')]);return _0x6e5ead(_0x3da720[_0xf62f('0x17')][_0xf62f('0x19')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x1ca783,_0xf62f('0x13'));_0x6e5ead(_0x3da720[_0xf62f('0x1a')]['message']);}})[_0xf62f('0x1b')](function(_0x20255a){logger[_0xf62f('0x17')](_0xf62f('0x12'),_0x1ca783,_0x20255a);_0x226349(_0x20255a);});});}exports[_0xf62f('0x1c')]=function(_0x233009){var _0x334c48=this;return new Promise(function(_0x6e3326,_0x2f8a91){return db[_0xf62f('0x1d')][_0xf62f('0x1e')]({'raw':_0x233009['options']?_0x233009['options']['raw']===undefined?!![]:![]:!![],'where':_0x233009[_0xf62f('0x1f')]?_0x233009[_0xf62f('0x1f')]['where']||null:null,'attributes':_0x233009[_0xf62f('0x1f')]?_0x233009[_0xf62f('0x1f')][_0xf62f('0x20')]||null:null,'limit':_0x233009[_0xf62f('0x1f')]?_0x233009['options'][_0xf62f('0x21')]||null:null,'include':_0x233009['options']?_0x233009['options'][_0xf62f('0x22')]?_['map'](_0x233009['options'][_0xf62f('0x22')],function(_0x1fa792){return{'model':db[_0x1fa792['model']],'as':_0x1fa792['as'],'attributes':_0x1fa792['attributes'],'include':_0x1fa792['include']?_[_0xf62f('0x23')](_0x1fa792['include'],function(_0x3c8d64){return{'model':db[_0x3c8d64[_0xf62f('0x24')]],'as':_0x3c8d64['as'],'attributes':_0x3c8d64[_0xf62f('0x20')],'include':_0x3c8d64[_0xf62f('0x22')]?_[_0xf62f('0x23')](_0x3c8d64[_0xf62f('0x22')],function(_0x23dec6){return{'model':db[_0x23dec6[_0xf62f('0x24')]],'as':_0x23dec6['as'],'attributes':_0x23dec6[_0xf62f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf62f('0x25')](function(_0x1b2f33){logger[_0xf62f('0x11')](_0xf62f('0x1c'),_0x233009);logger[_0xf62f('0x14')]('GetChatQueue',_0x233009,JSON[_0xf62f('0x16')](_0x1b2f33));_0x6e3326(_0x1b2f33);})[_0xf62f('0x1b')](function(_0x2020dc){logger[_0xf62f('0x17')]('GetChatQueue',_0x2020dc[_0xf62f('0x19')],_0x233009);_0x2f8a91(_0x334c48[_0xf62f('0x17')](0x1f4,_0x2020dc[_0xf62f('0x19')]));});});};exports[_0xf62f('0x26')]=function(_0x529d6b){var _0x567da2=this;return new Promise(function(_0xd7e5b8,_0x10e00f){return db[_0xf62f('0x1d')]['find']({'raw':_0x529d6b['options']?_0x529d6b[_0xf62f('0x1f')][_0xf62f('0x27')]===undefined?!![]:![]:!![],'where':_0x529d6b[_0xf62f('0x1f')]?_0x529d6b['options']['where']||null:null,'attributes':_0x529d6b[_0xf62f('0x1f')]?_0x529d6b[_0xf62f('0x1f')]['attributes']||null:null,'include':_0x529d6b[_0xf62f('0x1f')]?_0x529d6b[_0xf62f('0x1f')][_0xf62f('0x22')]?_[_0xf62f('0x23')](_0x529d6b[_0xf62f('0x1f')][_0xf62f('0x22')],function(_0x4ed9ee){return{'model':db[_0x4ed9ee[_0xf62f('0x24')]],'as':_0x4ed9ee['as'],'attributes':_0x4ed9ee[_0xf62f('0x20')],'include':_0x4ed9ee[_0xf62f('0x22')]?_[_0xf62f('0x23')](_0x4ed9ee['include'],function(_0x36fb4c){return{'model':db[_0x36fb4c[_0xf62f('0x24')]],'as':_0x36fb4c['as'],'attributes':_0x36fb4c[_0xf62f('0x20')],'include':_0x36fb4c[_0xf62f('0x22')]?_[_0xf62f('0x23')](_0x36fb4c[_0xf62f('0x22')],function(_0x4c6e5e){return{'model':db[_0x4c6e5e[_0xf62f('0x24')]],'as':_0x4c6e5e['as'],'attributes':_0x4c6e5e[_0xf62f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf62f('0x25')](function(_0x11cdcf){logger[_0xf62f('0x11')](_0xf62f('0x26'),_0x529d6b);logger['debug']('ShowChatQueue',_0x529d6b,JSON[_0xf62f('0x16')](_0x11cdcf));_0xd7e5b8(_0x11cdcf);})[_0xf62f('0x1b')](function(_0x5d3649){logger[_0xf62f('0x17')](_0xf62f('0x26'),_0x5d3649[_0xf62f('0x19')],_0x529d6b);_0x10e00f(_0x567da2[_0xf62f('0x17')](0x1f4,_0x5d3649[_0xf62f('0x19')]));});});}; \ No newline at end of file +var _0x3d5d=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','include','map','model','attributes','ShowChatQueue','find','lodash','moment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3d5d,0xe2));var _0xd3d5=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0x3d5d[_0x1be3b3];return _0x4f8b2d;};'use strict';var _=require(_0xd3d5('0x0'));var util=require('util');var moment=require(_0xd3d5('0x1'));var BPromise=require(_0xd3d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3d5('0x3'))['db'];var utils=require(_0xd3d5('0x4'));var logger=require(_0xd3d5('0x5'))(_0xd3d5('0x6'));var config=require(_0xd3d5('0x7'));var jayson=require(_0xd3d5('0x8'));var client=jayson['client'][_0xd3d5('0x9')]({'port':0x232a});config[_0xd3d5('0xa')]=_[_0xd3d5('0xb')](config[_0xd3d5('0xa')],{'host':_0xd3d5('0xc'),'port':0x18eb});var socket=require(_0xd3d5('0xd'))(new Redis(config['redis']));require(_0xd3d5('0xe'))['register'](socket);function respondWithRpcPromise(_0x6b10a5,_0x3dd64e,_0x561ca9){return new BPromise(function(_0x30a079,_0x43308d){return client['request'](_0x6b10a5,_0x561ca9)[_0xd3d5('0xf')](function(_0x381d57){logger[_0xd3d5('0x10')]('ChatQueue,\x20%s,\x20%s',_0x3dd64e,'request\x20sent');logger[_0xd3d5('0x11')](_0xd3d5('0x12'),_0x3dd64e,'request\x20sent',JSON[_0xd3d5('0x13')](_0x381d57));if(_0x381d57['error']){if(_0x381d57[_0xd3d5('0x14')][_0xd3d5('0x15')]===0x1f4){logger[_0xd3d5('0x14')]('ChatQueue,\x20%s,\x20%s',_0x3dd64e,_0x381d57['error'][_0xd3d5('0x16')]);return _0x43308d(_0x381d57[_0xd3d5('0x14')]['message']);}logger[_0xd3d5('0x14')]('ChatQueue,\x20%s,\x20%s',_0x3dd64e,_0x381d57[_0xd3d5('0x14')][_0xd3d5('0x16')]);return _0x30a079(_0x381d57[_0xd3d5('0x14')]['message']);}else{logger[_0xd3d5('0x10')](_0xd3d5('0x17'),_0x3dd64e,'request\x20sent');_0x30a079(_0x381d57[_0xd3d5('0x18')]['message']);}})[_0xd3d5('0x19')](function(_0x3c9b37){logger[_0xd3d5('0x14')](_0xd3d5('0x17'),_0x3dd64e,_0x3c9b37);_0x43308d(_0x3c9b37);});});}exports[_0xd3d5('0x1a')]=function(_0x104367){var _0x5d10e4=this;return new Promise(function(_0x4053c5,_0x4893f6){return db[_0xd3d5('0x1b')][_0xd3d5('0x1c')]({'raw':_0x104367[_0xd3d5('0x1d')]?_0x104367[_0xd3d5('0x1d')][_0xd3d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x104367[_0xd3d5('0x1d')]?_0x104367[_0xd3d5('0x1d')][_0xd3d5('0x1f')]||null:null,'attributes':_0x104367[_0xd3d5('0x1d')]?_0x104367[_0xd3d5('0x1d')]['attributes']||null:null,'limit':_0x104367[_0xd3d5('0x1d')]?_0x104367[_0xd3d5('0x1d')]['limit']||null:null,'include':_0x104367[_0xd3d5('0x1d')]?_0x104367[_0xd3d5('0x1d')][_0xd3d5('0x20')]?_[_0xd3d5('0x21')](_0x104367[_0xd3d5('0x1d')][_0xd3d5('0x20')],function(_0x5dcd2d){return{'model':db[_0x5dcd2d[_0xd3d5('0x22')]],'as':_0x5dcd2d['as'],'attributes':_0x5dcd2d['attributes'],'include':_0x5dcd2d[_0xd3d5('0x20')]?_[_0xd3d5('0x21')](_0x5dcd2d['include'],function(_0x49270d){return{'model':db[_0x49270d[_0xd3d5('0x22')]],'as':_0x49270d['as'],'attributes':_0x49270d[_0xd3d5('0x23')],'include':_0x49270d[_0xd3d5('0x20')]?_[_0xd3d5('0x21')](_0x49270d[_0xd3d5('0x20')],function(_0x41b882){return{'model':db[_0x41b882[_0xd3d5('0x22')]],'as':_0x41b882['as'],'attributes':_0x41b882[_0xd3d5('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3167a8){logger['info'](_0xd3d5('0x1a'),_0x104367);logger['debug'](_0xd3d5('0x1a'),_0x104367,JSON['stringify'](_0x3167a8));_0x4053c5(_0x3167a8);})[_0xd3d5('0x19')](function(_0x472d6c){logger[_0xd3d5('0x14')](_0xd3d5('0x1a'),_0x472d6c[_0xd3d5('0x16')],_0x104367);_0x4893f6(_0x5d10e4[_0xd3d5('0x14')](0x1f4,_0x472d6c[_0xd3d5('0x16')]));});});};exports[_0xd3d5('0x24')]=function(_0x49f071){var _0x25e3ad=this;return new Promise(function(_0x58bb06,_0x274f99){return db[_0xd3d5('0x1b')][_0xd3d5('0x25')]({'raw':_0x49f071[_0xd3d5('0x1d')]?_0x49f071[_0xd3d5('0x1d')][_0xd3d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x49f071['options']?_0x49f071[_0xd3d5('0x1d')][_0xd3d5('0x1f')]||null:null,'attributes':_0x49f071[_0xd3d5('0x1d')]?_0x49f071['options'][_0xd3d5('0x23')]||null:null,'include':_0x49f071['options']?_0x49f071[_0xd3d5('0x1d')][_0xd3d5('0x20')]?_['map'](_0x49f071[_0xd3d5('0x1d')][_0xd3d5('0x20')],function(_0xffa54){return{'model':db[_0xffa54[_0xd3d5('0x22')]],'as':_0xffa54['as'],'attributes':_0xffa54[_0xd3d5('0x23')],'include':_0xffa54[_0xd3d5('0x20')]?_[_0xd3d5('0x21')](_0xffa54[_0xd3d5('0x20')],function(_0x4b3a1b){return{'model':db[_0x4b3a1b['model']],'as':_0x4b3a1b['as'],'attributes':_0x4b3a1b['attributes'],'include':_0x4b3a1b[_0xd3d5('0x20')]?_[_0xd3d5('0x21')](_0x4b3a1b[_0xd3d5('0x20')],function(_0x12fd1d){return{'model':db[_0x12fd1d[_0xd3d5('0x22')]],'as':_0x12fd1d['as'],'attributes':_0x12fd1d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3d5('0xf')](function(_0xb0e19e){logger[_0xd3d5('0x10')](_0xd3d5('0x24'),_0x49f071);logger[_0xd3d5('0x11')](_0xd3d5('0x24'),_0x49f071,JSON[_0xd3d5('0x13')](_0xb0e19e));_0x58bb06(_0xb0e19e);})[_0xd3d5('0x19')](function(_0x123884){logger[_0xd3d5('0x14')](_0xd3d5('0x24'),_0x123884['message'],_0x49f071);_0x274f99(_0x25e3ad[_0xd3d5('0x14')](0x1f4,_0x123884[_0xd3d5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 175df7e..f71919a 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 _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x00bb,0x1d8));var _0xb00b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x00bb[_0xb0f7c3];return _0x28ea68;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file +var _0x5ad3=['register','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x5ad3[_0x513047];return _0x15b779;};'use strict';var ChatQueueEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){ChatQueueEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);ChatQueueEvents['on'](_0x292521,_0x3cec3e);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f2d4cfd..10ccf04 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 _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(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x5fc3[_0x2dea24];return _0x309d58;};'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 +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x587183,_0x56a369){var _0x3b6591=function(_0x585dc9){while(--_0x585dc9){_0x587183['push'](_0x587183['shift']());}};_0x3b6591(++_0x56a369);}(_0x55ca,0x126));var _0xa55c=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x55ca[_0x1fc18b];return _0x16a351;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3380d97..3e95d41 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 _0x6865=['exports','STRING','DATE','sequelize'];(function(_0x1f932c,_0x661d29){var _0x5cd7e4=function(_0x45d726){while(--_0x45d726){_0x1f932c['push'](_0x1f932c['shift']());}};_0x5cd7e4(++_0x661d29);}(_0x6865,0x17f));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x5686('0x0'));module[_0x5686('0x1')]={'uniqueid':{'type':Sequelize[_0x5686('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5686('0x3')]},'acceptAt':{'type':Sequelize[_0x5686('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5686('0x2')]}}; \ No newline at end of file +var _0x6a24=['exports','STRING','DATE','moment','sequelize'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x6a24,0xb7));var _0x46a2=function(_0x36fcfb,_0x2e95df){_0x36fcfb=_0x36fcfb-0x0;var _0x545820=_0x6a24[_0x36fcfb];return _0x545820;};'use strict';var moment=require(_0x46a2('0x0'));var Sequelize=require(_0x46a2('0x1'));module[_0x46a2('0x2')]={'uniqueid':{'type':Sequelize[_0x46a2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x46a2('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x46a2('0x4')]},'exitAt':{'type':Sequelize[_0x46a2('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c6f0daf..50e332d 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 _0x9e69=['ChatQueueReport','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x9e69,0x150));var _0x99e6=function(_0x5f0789,_0x487895){_0x5f0789=_0x5f0789-0x0;var _0xb30640=_0x9e69[_0x5f0789];return _0xb30640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99e6('0x0'));var zipdir=require(_0x99e6('0x1'));var jsonpatch=require(_0x99e6('0x2'));var rp=require(_0x99e6('0x3'));var moment=require('moment');var BPromise=require(_0x99e6('0x4'));var Mustache=require(_0x99e6('0x5'));var util=require('util');var path=require(_0x99e6('0x6'));var sox=require(_0x99e6('0x7'));var csv=require(_0x99e6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99e6('0x9'));var _=require(_0x99e6('0xa'));var squel=require(_0x99e6('0xb'));var crypto=require('crypto');var jsforce=require(_0x99e6('0xc'));var deskjs=require(_0x99e6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x99e6('0xe'));var Papa=require(_0x99e6('0xf'));var Redis=require('ioredis');var authService=require(_0x99e6('0x10'));var qs=require(_0x99e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x99e6('0x12'))(_0x99e6('0x13'));var utils=require(_0x99e6('0x14'));var config=require(_0x99e6('0x15'));var licenseUtil=require(_0x99e6('0x16'));var db=require(_0x99e6('0x17'))['db'];function respondWithStatusCode(_0x51de85,_0x13a62b){_0x13a62b=_0x13a62b||0xcc;return function(_0x4033c5){if(_0x4033c5){return _0x51de85[_0x99e6('0x18')](_0x13a62b);}return _0x51de85['status'](_0x13a62b)[_0x99e6('0x19')]();};}function respondWithResult(_0x4061b2,_0x2cf6a4){_0x2cf6a4=_0x2cf6a4||0xc8;return function(_0x57111c){if(_0x57111c){return _0x4061b2['status'](_0x2cf6a4)['json'](_0x57111c);}};}function respondWithFilteredResult(_0x40fdb8,_0x4741c9){return function(_0x1d910a){if(_0x1d910a){var _0x5d5cd5=typeof _0x4741c9[_0x99e6('0x1a')]===_0x99e6('0x1b')&&typeof _0x4741c9[_0x99e6('0x1c')]===_0x99e6('0x1b');var _0x3a302d=_0x1d910a['count'];var _0x2e9e24=_0x5d5cd5?0x0:_0x4741c9['offset'];var _0x2749bf=_0x5d5cd5?_0x1d910a[_0x99e6('0x1d')]:_0x4741c9['offset']+_0x4741c9[_0x99e6('0x1c')];var _0x3c4cc8;if(_0x2749bf>=_0x3a302d){_0x2749bf=_0x3a302d;_0x3c4cc8=0xc8;}else{_0x3c4cc8=0xce;}_0x40fdb8[_0x99e6('0x1e')](_0x3c4cc8);return _0x40fdb8[_0x99e6('0x1f')](_0x99e6('0x20'),_0x2e9e24+'-'+_0x2749bf+'/'+_0x3a302d)[_0x99e6('0x21')](_0x1d910a);}return null;};}function patchUpdates(_0x41a32b){return function(_0x95a8e5){try{jsonpatch[_0x99e6('0x22')](_0x95a8e5,_0x41a32b,!![]);}catch(_0xef736c){return BPromise['reject'](_0xef736c);}return _0x95a8e5[_0x99e6('0x23')]();};}function saveUpdates(_0xef9c63,_0x16f05d){return function(_0x249872){if(_0x249872){return _0x249872[_0x99e6('0x24')](_0xef9c63)[_0x99e6('0x25')](function(_0x2a308f){return _0x2a308f;});}return null;};}function removeEntity(_0xa0b949,_0x2033af){return function(_0x1b4339){if(_0x1b4339){return _0x1b4339[_0x99e6('0x26')]()[_0x99e6('0x25')](function(){_0xa0b949[_0x99e6('0x1e')](0xcc)[_0x99e6('0x19')]();});}};}function handleEntityNotFound(_0x210b02,_0x19d2f1){return function(_0x17bc07){if(!_0x17bc07){_0x210b02['sendStatus'](0x194);}return _0x17bc07;};}function handleError(_0x43038d,_0x5390b3){_0x5390b3=_0x5390b3||0x1f4;return function(_0x30b956){logger[_0x99e6('0x27')](_0x30b956[_0x99e6('0x28')]);if(_0x30b956['name']){delete _0x30b956[_0x99e6('0x29')];}_0x43038d['status'](_0x5390b3)[_0x99e6('0x2a')](_0x30b956);};}exports['index']=function(_0x39ca5d,_0x46343f){var _0x4b58c7={},_0x4d6b19={},_0x2c9b92={'count':0x0,'rows':[]};var _0x350fa0=_[_0x99e6('0x2b')](db[_0x99e6('0x2c')][_0x99e6('0x2d')],function(_0x4b92af){return{'name':_0x4b92af[_0x99e6('0x2e')],'type':_0x4b92af[_0x99e6('0x2f')][_0x99e6('0x30')]};});_0x4d6b19['model']=_['map'](_0x350fa0,_0x99e6('0x29'));_0x4d6b19['query']=_['keys'](_0x39ca5d[_0x99e6('0x31')]);_0x4d6b19['filters']=_[_0x99e6('0x32')](_0x4d6b19[_0x99e6('0x33')],_0x4d6b19[_0x99e6('0x31')]);_0x4b58c7['attributes']=_[_0x99e6('0x32')](_0x4d6b19[_0x99e6('0x33')],qs[_0x99e6('0x34')](_0x39ca5d[_0x99e6('0x31')]['fields']));_0x4b58c7[_0x99e6('0x35')]=_0x4b58c7[_0x99e6('0x35')][_0x99e6('0x36')]?_0x4b58c7[_0x99e6('0x35')]:_0x4d6b19[_0x99e6('0x33')];if(!_0x39ca5d[_0x99e6('0x31')]['hasOwnProperty'](_0x99e6('0x37'))){_0x4b58c7['limit']=qs['limit'](_0x39ca5d['query'][_0x99e6('0x1c')]);_0x4b58c7[_0x99e6('0x1a')]=qs['offset'](_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x1a')]);}_0x4b58c7[_0x99e6('0x38')]=qs[_0x99e6('0x39')](_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x39')]);_0x4b58c7['where']=qs[_0x99e6('0x3a')](_[_0x99e6('0x3b')](_0x39ca5d[_0x99e6('0x31')],_0x4d6b19[_0x99e6('0x3a')]),_0x350fa0);if(_0x39ca5d['query'][_0x99e6('0x3c')]){_0x4b58c7[_0x99e6('0x3d')]=_[_0x99e6('0x3e')](_0x4b58c7[_0x99e6('0x3d')],{'$or':_[_0x99e6('0x2b')](_0x350fa0,function(_0x2fc6e5){if(_0x2fc6e5[_0x99e6('0x2f')]!=='VIRTUAL'){var _0x4b888c={};_0x4b888c[_0x2fc6e5['name']]={'$like':'%'+_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x3c')]+'%'};return _0x4b888c;}})});}_0x4b58c7=_['merge']({},_0x4b58c7,_0x39ca5d[_0x99e6('0x3f')]);var _0x2975d8={'where':_0x4b58c7[_0x99e6('0x3d')]};return db[_0x99e6('0x2c')][_0x99e6('0x1d')](_0x2975d8)[_0x99e6('0x25')](function(_0x26cade){_0x2c9b92[_0x99e6('0x1d')]=_0x26cade;if(_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x40')]){_0x4b58c7[_0x99e6('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x99e6('0x42')](_0x4b58c7);})[_0x99e6('0x25')](function(_0x13ee61){_0x2c9b92[_0x99e6('0x43')]=_0x13ee61;return _0x2c9b92;})[_0x99e6('0x25')](respondWithFilteredResult(_0x46343f,_0x4b58c7))[_0x99e6('0x44')](handleError(_0x46343f,null));};exports[_0x99e6('0x45')]=function(_0x34991f,_0x2f5b4f){var _0x534f05={'raw':!![],'where':{'id':_0x34991f['params']['id']}},_0x562921={};_0x562921['model']=_['keys'](db[_0x99e6('0x2c')][_0x99e6('0x2d')]);_0x562921['query']=_[_0x99e6('0x46')](_0x34991f[_0x99e6('0x31')]);_0x562921[_0x99e6('0x3a')]=_[_0x99e6('0x32')](_0x562921[_0x99e6('0x33')],_0x562921[_0x99e6('0x31')]);_0x534f05['attributes']=_[_0x99e6('0x32')](_0x562921[_0x99e6('0x33')],qs[_0x99e6('0x34')](_0x34991f[_0x99e6('0x31')][_0x99e6('0x34')]));_0x534f05[_0x99e6('0x35')]=_0x534f05[_0x99e6('0x35')][_0x99e6('0x36')]?_0x534f05[_0x99e6('0x35')]:_0x562921[_0x99e6('0x33')];if(_0x34991f[_0x99e6('0x31')][_0x99e6('0x40')]){_0x534f05[_0x99e6('0x41')]=[{'all':!![]}];}_0x534f05=_[_0x99e6('0x3e')]({},_0x534f05,_0x34991f['options']);return db['ChatQueueReport']['find'](_0x534f05)['then'](handleEntityNotFound(_0x2f5b4f,null))[_0x99e6('0x25')](respondWithResult(_0x2f5b4f,null))[_0x99e6('0x44')](handleError(_0x2f5b4f,null));};exports[_0x99e6('0x47')]=function(_0x10d693,_0x2c071f){return db['ChatQueueReport']['create'](_0x10d693[_0x99e6('0x48')],{})[_0x99e6('0x25')](respondWithResult(_0x2c071f,0xc9))['catch'](handleError(_0x2c071f,null));};exports['update']=function(_0x10a08e,_0x437bf2){if(_0x10a08e['body']['id']){delete _0x10a08e[_0x99e6('0x48')]['id'];}return db['ChatQueueReport'][_0x99e6('0x49')]({'where':{'id':_0x10a08e[_0x99e6('0x4a')]['id']}})[_0x99e6('0x25')](handleEntityNotFound(_0x437bf2,null))['then'](saveUpdates(_0x10a08e[_0x99e6('0x48')],null))[_0x99e6('0x25')](respondWithResult(_0x437bf2,null))['catch'](handleError(_0x437bf2,null));};exports[_0x99e6('0x26')]=function(_0x202159,_0x35973e){return db['ChatQueueReport']['find']({'where':{'id':_0x202159[_0x99e6('0x4a')]['id']}})[_0x99e6('0x25')](handleEntityNotFound(_0x35973e,null))['then'](removeEntity(_0x35973e,null))[_0x99e6('0x44')](handleError(_0x35973e,null));};exports[_0x99e6('0x4b')]=function(_0x20d286,_0x40de95){return db[_0x99e6('0x2c')][_0x99e6('0x4b')]()[_0x99e6('0x25')](respondWithResult(_0x40de95,null))['catch'](handleError(_0x40de95,null));}; \ No newline at end of file +var _0x1a61=['json','offset','limit','undefined','count','set','Content-Range','apply','destroy','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','includeAll','findAll','rows','catch','params','merge','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1a61,0x1e6));var _0x11a6=function(_0x244969,_0x3c218c){_0x244969=_0x244969-0x0;var _0x4fd27a=_0x1a61[_0x244969];return _0x4fd27a;};'use strict';var emlformat=require(_0x11a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11a6('0x2'));var moment=require(_0x11a6('0x3'));var BPromise=require(_0x11a6('0x4'));var Mustache=require(_0x11a6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x11a6('0x6'));var csv=require(_0x11a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11a6('0x8'));var _=require(_0x11a6('0x9'));var squel=require(_0x11a6('0xa'));var crypto=require(_0x11a6('0xb'));var jsforce=require(_0x11a6('0xc'));var deskjs=require(_0x11a6('0xd'));var toCsv=require(_0x11a6('0x7'));var querystring=require(_0x11a6('0xe'));var Papa=require(_0x11a6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x11a6('0x10'));var hardwareService=require(_0x11a6('0x11'));var logger=require('../../config/logger')(_0x11a6('0x12'));var utils=require(_0x11a6('0x13'));var config=require(_0x11a6('0x14'));var licenseUtil=require(_0x11a6('0x15'));var db=require(_0x11a6('0x16'))['db'];function respondWithStatusCode(_0x41c4aa,_0x52f39a){_0x52f39a=_0x52f39a||0xcc;return function(_0x52c999){if(_0x52c999){return _0x41c4aa[_0x11a6('0x17')](_0x52f39a);}return _0x41c4aa[_0x11a6('0x18')](_0x52f39a)['end']();};}function respondWithResult(_0x1d3123,_0x15d140){_0x15d140=_0x15d140||0xc8;return function(_0x5158ea){if(_0x5158ea){return _0x1d3123[_0x11a6('0x18')](_0x15d140)[_0x11a6('0x19')](_0x5158ea);}};}function respondWithFilteredResult(_0x5b8e51,_0x345c70){return function(_0x2c79f4){if(_0x2c79f4){var _0x1fec24=typeof _0x345c70[_0x11a6('0x1a')]==='undefined'&&typeof _0x345c70[_0x11a6('0x1b')]===_0x11a6('0x1c');var _0xe8ed8=_0x2c79f4[_0x11a6('0x1d')];var _0x1a9d43=_0x1fec24?0x0:_0x345c70[_0x11a6('0x1a')];var _0x2449bf=_0x1fec24?_0x2c79f4[_0x11a6('0x1d')]:_0x345c70[_0x11a6('0x1a')]+_0x345c70[_0x11a6('0x1b')];var _0x2516a4;if(_0x2449bf>=_0xe8ed8){_0x2449bf=_0xe8ed8;_0x2516a4=0xc8;}else{_0x2516a4=0xce;}_0x5b8e51[_0x11a6('0x18')](_0x2516a4);return _0x5b8e51[_0x11a6('0x1e')](_0x11a6('0x1f'),_0x1a9d43+'-'+_0x2449bf+'/'+_0xe8ed8)['json'](_0x2c79f4);}return null;};}function patchUpdates(_0x485a4f){return function(_0xbd4c49){try{jsonpatch[_0x11a6('0x20')](_0xbd4c49,_0x485a4f,!![]);}catch(_0x3d1efd){return BPromise['reject'](_0x3d1efd);}return _0xbd4c49['save']();};}function saveUpdates(_0x7120c0,_0x521f50){return function(_0x707dd2){if(_0x707dd2){return _0x707dd2['update'](_0x7120c0)['then'](function(_0x51fe97){return _0x51fe97;});}return null;};}function removeEntity(_0x5b3a27,_0x111a63){return function(_0x55a043){if(_0x55a043){return _0x55a043[_0x11a6('0x21')]()[_0x11a6('0x22')](function(){_0x5b3a27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ffd7f,_0x144cc5){return function(_0x34e230){if(!_0x34e230){_0x2ffd7f[_0x11a6('0x17')](0x194);}return _0x34e230;};}function handleError(_0x14f510,_0x407ae0){_0x407ae0=_0x407ae0||0x1f4;return function(_0x40e3b4){logger[_0x11a6('0x23')](_0x40e3b4[_0x11a6('0x24')]);if(_0x40e3b4[_0x11a6('0x25')]){delete _0x40e3b4[_0x11a6('0x25')];}_0x14f510[_0x11a6('0x18')](_0x407ae0)[_0x11a6('0x26')](_0x40e3b4);};}exports[_0x11a6('0x27')]=function(_0x304ad8,_0x453453){var _0x1ddbb2={},_0x1b7f4e={},_0x44c92d={'count':0x0,'rows':[]};var _0x2bfdf6=_[_0x11a6('0x28')](db[_0x11a6('0x29')][_0x11a6('0x2a')],function(_0x1ec7aa){return{'name':_0x1ec7aa[_0x11a6('0x2b')],'type':_0x1ec7aa['type'][_0x11a6('0x2c')]};});_0x1b7f4e['model']=_[_0x11a6('0x28')](_0x2bfdf6,_0x11a6('0x25'));_0x1b7f4e[_0x11a6('0x2d')]=_[_0x11a6('0x2e')](_0x304ad8[_0x11a6('0x2d')]);_0x1b7f4e['filters']=_[_0x11a6('0x2f')](_0x1b7f4e[_0x11a6('0x30')],_0x1b7f4e['query']);_0x1ddbb2['attributes']=_['intersection'](_0x1b7f4e[_0x11a6('0x30')],qs[_0x11a6('0x31')](_0x304ad8['query'][_0x11a6('0x31')]));_0x1ddbb2[_0x11a6('0x32')]=_0x1ddbb2[_0x11a6('0x32')][_0x11a6('0x33')]?_0x1ddbb2[_0x11a6('0x32')]:_0x1b7f4e['model'];if(!_0x304ad8[_0x11a6('0x2d')][_0x11a6('0x34')](_0x11a6('0x35'))){_0x1ddbb2[_0x11a6('0x1b')]=qs[_0x11a6('0x1b')](_0x304ad8[_0x11a6('0x2d')][_0x11a6('0x1b')]);_0x1ddbb2[_0x11a6('0x1a')]=qs[_0x11a6('0x1a')](_0x304ad8[_0x11a6('0x2d')][_0x11a6('0x1a')]);}_0x1ddbb2[_0x11a6('0x36')]=qs[_0x11a6('0x37')](_0x304ad8['query'][_0x11a6('0x37')]);_0x1ddbb2[_0x11a6('0x38')]=qs[_0x11a6('0x39')](_[_0x11a6('0x3a')](_0x304ad8[_0x11a6('0x2d')],_0x1b7f4e[_0x11a6('0x39')]),_0x2bfdf6);if(_0x304ad8[_0x11a6('0x2d')][_0x11a6('0x3b')]){_0x1ddbb2[_0x11a6('0x38')]=_['merge'](_0x1ddbb2[_0x11a6('0x38')],{'$or':_[_0x11a6('0x28')](_0x2bfdf6,function(_0x5f38c1){if(_0x5f38c1[_0x11a6('0x3c')]!==_0x11a6('0x3d')){var _0x38aaa7={};_0x38aaa7[_0x5f38c1['name']]={'$like':'%'+_0x304ad8[_0x11a6('0x2d')][_0x11a6('0x3b')]+'%'};return _0x38aaa7;}})});}_0x1ddbb2=_['merge']({},_0x1ddbb2,_0x304ad8['options']);var _0x10c485={'where':_0x1ddbb2['where']};return db[_0x11a6('0x29')][_0x11a6('0x1d')](_0x10c485)['then'](function(_0x275aa0){_0x44c92d['count']=_0x275aa0;if(_0x304ad8[_0x11a6('0x2d')][_0x11a6('0x3e')]){_0x1ddbb2['include']=[{'all':!![]}];}return db[_0x11a6('0x29')][_0x11a6('0x3f')](_0x1ddbb2);})[_0x11a6('0x22')](function(_0xd769e4){_0x44c92d[_0x11a6('0x40')]=_0xd769e4;return _0x44c92d;})[_0x11a6('0x22')](respondWithFilteredResult(_0x453453,_0x1ddbb2))[_0x11a6('0x41')](handleError(_0x453453,null));};exports['show']=function(_0x1d3a8b,_0x382182){var _0x5f44c1={'raw':!![],'where':{'id':_0x1d3a8b[_0x11a6('0x42')]['id']}},_0x588b96={};_0x588b96['model']=_[_0x11a6('0x2e')](db[_0x11a6('0x29')][_0x11a6('0x2a')]);_0x588b96['query']=_['keys'](_0x1d3a8b['query']);_0x588b96['filters']=_[_0x11a6('0x2f')](_0x588b96['model'],_0x588b96[_0x11a6('0x2d')]);_0x5f44c1[_0x11a6('0x32')]=_['intersection'](_0x588b96['model'],qs['fields'](_0x1d3a8b[_0x11a6('0x2d')][_0x11a6('0x31')]));_0x5f44c1['attributes']=_0x5f44c1[_0x11a6('0x32')]['length']?_0x5f44c1[_0x11a6('0x32')]:_0x588b96['model'];if(_0x1d3a8b[_0x11a6('0x2d')][_0x11a6('0x3e')]){_0x5f44c1['include']=[{'all':!![]}];}_0x5f44c1=_[_0x11a6('0x43')]({},_0x5f44c1,_0x1d3a8b['options']);return db[_0x11a6('0x29')][_0x11a6('0x44')](_0x5f44c1)[_0x11a6('0x22')](handleEntityNotFound(_0x382182,null))[_0x11a6('0x22')](respondWithResult(_0x382182,null))['catch'](handleError(_0x382182,null));};exports[_0x11a6('0x45')]=function(_0x18feb7,_0x25f137){return db[_0x11a6('0x29')][_0x11a6('0x45')](_0x18feb7[_0x11a6('0x46')],{})['then'](respondWithResult(_0x25f137,0xc9))[_0x11a6('0x41')](handleError(_0x25f137,null));};exports[_0x11a6('0x47')]=function(_0x41afe9,_0x5b8bbf){if(_0x41afe9[_0x11a6('0x46')]['id']){delete _0x41afe9[_0x11a6('0x46')]['id'];}return db[_0x11a6('0x29')][_0x11a6('0x44')]({'where':{'id':_0x41afe9[_0x11a6('0x42')]['id']}})[_0x11a6('0x22')](handleEntityNotFound(_0x5b8bbf,null))[_0x11a6('0x22')](saveUpdates(_0x41afe9[_0x11a6('0x46')],null))[_0x11a6('0x22')](respondWithResult(_0x5b8bbf,null))[_0x11a6('0x41')](handleError(_0x5b8bbf,null));};exports[_0x11a6('0x21')]=function(_0x2e105f,_0x1febf1){return db[_0x11a6('0x29')][_0x11a6('0x44')]({'where':{'id':_0x2e105f[_0x11a6('0x42')]['id']}})[_0x11a6('0x22')](handleEntityNotFound(_0x1febf1,null))[_0x11a6('0x22')](removeEntity(_0x1febf1,null))['catch'](handleError(_0x1febf1,null));};exports[_0x11a6('0x48')]=function(_0x5e7235,_0x27c59a){return db['ChatQueueReport'][_0x11a6('0x48')]()[_0x11a6('0x22')](respondWithResult(_0x27c59a,null))[_0x11a6('0x41')](handleError(_0x27c59a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 04395f5..4c7410c 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x478ecf,_0x5887bb){var _0x54ebc8=function(_0x23effb){while(--_0x23effb){_0x478ecf['push'](_0x478ecf['shift']());}};_0x54ebc8(++_0x5887bb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 98c2fbc..c4590d5 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 _0x2d50=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueueReport','create','body','options','raw','then','CreateChatQueueReport','debug','UpdateChatQueueReport','update','attributes','limit','lodash','util'];(function(_0x52bbc9,_0xb342e0){var _0x5909d0=function(_0x24370d){while(--_0x24370d){_0x52bbc9['push'](_0x52bbc9['shift']());}};_0x5909d0(++_0xb342e0);}(_0x2d50,0x106));var _0x02d5=function(_0x56d4f2,_0x3cc8bb){_0x56d4f2=_0x56d4f2-0x0;var _0x187f51=_0x2d50[_0x56d4f2];return _0x187f51;};'use strict';var _=require(_0x02d5('0x0'));var util=require(_0x02d5('0x1'));var moment=require(_0x02d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x02d5('0x4'));var logger=require(_0x02d5('0x5'))(_0x02d5('0x6'));var config=require(_0x02d5('0x7'));var jayson=require(_0x02d5('0x8'));var client=jayson['client'][_0x02d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4065de,_0x3ad800,_0x93874d){return new BPromise(function(_0x4bd172,_0x45f7c7){return client[_0x02d5('0xa')](_0x4065de,_0x93874d)['then'](function(_0x4734d9){logger[_0x02d5('0xb')](_0x02d5('0xc'),_0x3ad800,'request\x20sent');logger['debug'](_0x02d5('0xd'),_0x3ad800,_0x02d5('0xe'),JSON[_0x02d5('0xf')](_0x4734d9));if(_0x4734d9['error']){if(_0x4734d9[_0x02d5('0x10')][_0x02d5('0x11')]===0x1f4){logger[_0x02d5('0x10')](_0x02d5('0xc'),_0x3ad800,_0x4734d9[_0x02d5('0x10')]['message']);return _0x45f7c7(_0x4734d9[_0x02d5('0x10')][_0x02d5('0x12')]);}logger['error'](_0x02d5('0xc'),_0x3ad800,_0x4734d9[_0x02d5('0x10')][_0x02d5('0x12')]);return _0x4bd172(_0x4734d9[_0x02d5('0x10')]['message']);}else{logger[_0x02d5('0xb')](_0x02d5('0xc'),_0x3ad800,_0x02d5('0xe'));_0x4bd172(_0x4734d9[_0x02d5('0x13')][_0x02d5('0x12')]);}})[_0x02d5('0x14')](function(_0x3aaf05){logger['error'](_0x02d5('0xc'),_0x3ad800,_0x3aaf05);_0x45f7c7(_0x3aaf05);});});}exports['CreateChatQueueReport']=function(_0x4ce9b1){var _0x58bdba=this;return new Promise(function(_0x22e65c,_0x1952bc){return db[_0x02d5('0x15')][_0x02d5('0x16')](_0x4ce9b1[_0x02d5('0x17')],{'raw':_0x4ce9b1[_0x02d5('0x18')]?_0x4ce9b1[_0x02d5('0x18')][_0x02d5('0x19')]===undefined?!![]:![]:!![]})[_0x02d5('0x1a')](function(_0x1f9657){logger[_0x02d5('0xb')](_0x02d5('0x1b'),_0x4ce9b1);logger[_0x02d5('0x1c')](_0x02d5('0x1b'),_0x4ce9b1,JSON['stringify'](_0x1f9657));_0x22e65c(_0x1f9657);})['catch'](function(_0x2e0bac){logger['error']('CreateChatQueueReport',_0x2e0bac[_0x02d5('0x12')],_0x4ce9b1);_0x1952bc(_0x58bdba[_0x02d5('0x10')](0x1f4,_0x2e0bac['message']));});});};exports[_0x02d5('0x1d')]=function(_0x164122){var _0x36b9cb=this;return new Promise(function(_0x527f9b,_0x390b13){return db[_0x02d5('0x15')][_0x02d5('0x1e')](_0x164122[_0x02d5('0x17')],{'raw':_0x164122[_0x02d5('0x18')]?_0x164122[_0x02d5('0x18')][_0x02d5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x164122[_0x02d5('0x18')]?_0x164122[_0x02d5('0x18')]['where']||null:null,'attributes':_0x164122[_0x02d5('0x18')]?_0x164122['options'][_0x02d5('0x1f')]||null:null,'limit':_0x164122[_0x02d5('0x18')]?_0x164122[_0x02d5('0x18')][_0x02d5('0x20')]||null:null})[_0x02d5('0x1a')](function(_0xfa6253){logger[_0x02d5('0xb')]('UpdateChatQueueReport',_0x164122);logger[_0x02d5('0x1c')](_0x02d5('0x1d'),_0x164122,JSON['stringify'](_0xfa6253));_0x527f9b(_0xfa6253);})[_0x02d5('0x14')](function(_0x2de7df){logger['error'](_0x02d5('0x1d'),_0x2de7df[_0x02d5('0x12')],_0x164122);_0x390b13(_0x36b9cb[_0x02d5('0x10')](0x1f4,_0x2de7df[_0x02d5('0x12')]));});});}; \ No newline at end of file +var _0x2454=['../../config/logger','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','update','body','attributes','UpdateChatQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xba4220,_0x5217a7){var _0x4cdb9d=function(_0x32cae1){while(--_0x32cae1){_0xba4220['push'](_0xba4220['shift']());}};_0x4cdb9d(++_0x5217a7);}(_0x2454,0xea));var _0x4245=function(_0x124810,_0x158e53){_0x124810=_0x124810-0x0;var _0x48d191=_0x2454[_0x124810];return _0x48d191;};'use strict';var _=require('lodash');var util=require(_0x4245('0x0'));var moment=require(_0x4245('0x1'));var BPromise=require(_0x4245('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4245('0x3'));var db=require(_0x4245('0x4'))['db'];var utils=require(_0x4245('0x5'));var logger=require(_0x4245('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4245('0x7')][_0x4245('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fd457,_0x3cc444,_0x117de7){return new BPromise(function(_0xe0fcec,_0x409026){return client[_0x4245('0x9')](_0x2fd457,_0x117de7)[_0x4245('0xa')](function(_0x1193ec){logger['info'](_0x4245('0xb'),_0x3cc444,'request\x20sent');logger[_0x4245('0xc')](_0x4245('0xd'),_0x3cc444,_0x4245('0xe'),JSON[_0x4245('0xf')](_0x1193ec));if(_0x1193ec[_0x4245('0x10')]){if(_0x1193ec[_0x4245('0x10')][_0x4245('0x11')]===0x1f4){logger[_0x4245('0x10')](_0x4245('0xb'),_0x3cc444,_0x1193ec[_0x4245('0x10')][_0x4245('0x12')]);return _0x409026(_0x1193ec[_0x4245('0x10')][_0x4245('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3cc444,_0x1193ec[_0x4245('0x10')][_0x4245('0x12')]);return _0xe0fcec(_0x1193ec[_0x4245('0x10')][_0x4245('0x12')]);}else{logger[_0x4245('0x13')](_0x4245('0xb'),_0x3cc444,_0x4245('0xe'));_0xe0fcec(_0x1193ec['result'][_0x4245('0x12')]);}})[_0x4245('0x14')](function(_0x3d4dbb){logger['error'](_0x4245('0xb'),_0x3cc444,_0x3d4dbb);_0x409026(_0x3d4dbb);});});}exports[_0x4245('0x15')]=function(_0x4d75bf){var _0x500299=this;return new Promise(function(_0x229f68,_0x4e0c19){return db[_0x4245('0x16')][_0x4245('0x17')](_0x4d75bf['body'],{'raw':_0x4d75bf[_0x4245('0x18')]?_0x4d75bf[_0x4245('0x18')][_0x4245('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x520022){logger[_0x4245('0x13')](_0x4245('0x15'),_0x4d75bf);logger['debug']('CreateChatQueueReport',_0x4d75bf,JSON[_0x4245('0xf')](_0x520022));_0x229f68(_0x520022);})[_0x4245('0x14')](function(_0x58f389){logger[_0x4245('0x10')](_0x4245('0x15'),_0x58f389[_0x4245('0x12')],_0x4d75bf);_0x4e0c19(_0x500299[_0x4245('0x10')](0x1f4,_0x58f389[_0x4245('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x35eb47){var _0x4a0514=this;return new Promise(function(_0x513933,_0x242eb7){return db['ChatQueueReport'][_0x4245('0x1a')](_0x35eb47[_0x4245('0x1b')],{'raw':_0x35eb47[_0x4245('0x18')]?_0x35eb47[_0x4245('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35eb47[_0x4245('0x18')]?_0x35eb47[_0x4245('0x18')]['where']||null:null,'attributes':_0x35eb47['options']?_0x35eb47[_0x4245('0x18')][_0x4245('0x1c')]||null:null,'limit':_0x35eb47[_0x4245('0x18')]?_0x35eb47['options']['limit']||null:null})[_0x4245('0xa')](function(_0x210dc7){logger['info']('UpdateChatQueueReport',_0x35eb47);logger[_0x4245('0xc')](_0x4245('0x1d'),_0x35eb47,JSON['stringify'](_0x210dc7));_0x513933(_0x210dc7);})[_0x4245('0x14')](function(_0x10df76){logger['error'](_0x4245('0x1d'),_0x10df76[_0x4245('0x12')],_0x35eb47);_0x242eb7(_0x4a0514[_0x4245('0x10')](0x1f4,_0x10df76[_0x4245('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 157bb79..69a95c4 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 _0xbefe=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x39e46f,_0x2c9ba3){var _0x692df5=function(_0x4ae77a){while(--_0x4ae77a){_0x39e46f['push'](_0x39e46f['shift']());}};_0x692df5(++_0x2c9ba3);}(_0xbefe,0x156));var _0xebef=function(_0x35f154,_0x50c6e2){_0x35f154=_0x35f154-0x0;var _0x3302b6=_0xbefe[_0x35f154];return _0x3302b6;};'use strict';var multer=require(_0xebef('0x0'));var util=require('util');var path=require(_0xebef('0x1'));var timeout=require(_0xebef('0x2'));var express=require(_0xebef('0x3'));var router=express[_0xebef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xebef('0x5'));var interaction=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var controller=require(_0xebef('0x8'));router[_0xebef('0x9')]('/',auth[_0xebef('0xa')](),controller['index']);router[_0xebef('0x9')](_0xebef('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xebef('0xc'),auth[_0xebef('0xa')](),controller[_0xebef('0xd')]);router[_0xebef('0xe')]('/',auth[_0xebef('0xa')](),controller[_0xebef('0xf')]);router[_0xebef('0x10')]('/:id',auth[_0xebef('0xa')](),controller[_0xebef('0x11')]);router[_0xebef('0x12')](_0xebef('0xc'),auth[_0xebef('0xa')](),controller[_0xebef('0x13')]);module[_0xebef('0x14')]=router; \ No newline at end of file +var _0xe3cc=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra'];(function(_0x535246,_0xb9ab72){var _0x43d339=function(_0x41e19d){while(--_0x41e19d){_0x535246['push'](_0x535246['shift']());}};_0x43d339(++_0xb9ab72);}(_0xe3cc,0x9b));var _0xce3c=function(_0x4edae9,_0xc9cdc1){_0x4edae9=_0x4edae9-0x0;var _0x180f85=_0xe3cc[_0x4edae9];return _0x180f85;};'use strict';var multer=require(_0xce3c('0x0'));var util=require('util');var path=require(_0xce3c('0x1'));var timeout=require('connect-timeout');var express=require(_0xce3c('0x2'));var router=express[_0xce3c('0x3')]();var fs_extra=require(_0xce3c('0x4'));var auth=require(_0xce3c('0x5'));var interaction=require(_0xce3c('0x6'));var config=require(_0xce3c('0x7'));var controller=require('./chatQueueReport.controller');router[_0xce3c('0x8')]('/',auth['isAuthenticated'](),controller[_0xce3c('0x9')]);router['get'](_0xce3c('0xa'),auth[_0xce3c('0xb')](),controller[_0xce3c('0xc')]);router[_0xce3c('0x8')](_0xce3c('0xd'),auth[_0xce3c('0xb')](),controller['show']);router[_0xce3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xce3c('0xf')]);router[_0xce3c('0x10')](_0xce3c('0xd'),auth[_0xce3c('0xb')](),controller[_0xce3c('0x11')]);router[_0xce3c('0x12')](_0xce3c('0xd'),auth[_0xce3c('0xb')](),controller[_0xce3c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8576543..cc4a286 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x418d9f,_0x456b56){var _0x494dad=function(_0x234b8a){while(--_0x234b8a){_0x418d9f['push'](_0x418d9f['shift']());}};_0x494dad(++_0x456b56);}(_0xf4eb,0xec));var _0xbf4e=function(_0xd0af37,_0x36933a){_0xd0af37=_0xd0af37-0x0;var _0x8359f8=_0xf4eb[_0xd0af37];return _0x8359f8;};'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 +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1fe085,_0x43bea5){var _0x3a87aa=function(_0x17f072){while(--_0x17f072){_0x1fe085['push'](_0x1fe085['shift']());}};_0x3a87aa(++_0x43bea5);}(_0x70e0,0x17b));var _0x070e=function(_0x24d37b,_0x2bd674){_0x24d37b=_0x24d37b-0x0;var _0x3331f5=_0x70e0[_0x24d37b];return _0x3331f5;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d6b9ae6..1e1be1c 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 _0x83e1=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','merge','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x247f35,_0x26a86e){var _0x1d28bb=function(_0x2d944d){while(--_0x2d944d){_0x247f35['push'](_0x247f35['shift']());}};_0x1d28bb(++_0x26a86e);}(_0x83e1,0x168));var _0x183e=function(_0x36ab4b,_0xe17de5){_0x36ab4b=_0x36ab4b-0x0;var _0x4aa903=_0x83e1[_0x36ab4b];return _0x4aa903;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x183e('0x0'));var rp=require(_0x183e('0x1'));var moment=require(_0x183e('0x2'));var BPromise=require(_0x183e('0x3'));var Mustache=require(_0x183e('0x4'));var util=require(_0x183e('0x5'));var path=require(_0x183e('0x6'));var sox=require(_0x183e('0x7'));var csv=require(_0x183e('0x8'));var ejs=require(_0x183e('0x9'));var fs=require('fs');var fs_extra=require(_0x183e('0xa'));var _=require(_0x183e('0xb'));var squel=require(_0x183e('0xc'));var crypto=require('crypto');var jsforce=require(_0x183e('0xd'));var deskjs=require(_0x183e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x183e('0xf'));var Papa=require(_0x183e('0x10'));var Redis=require(_0x183e('0x11'));var authService=require(_0x183e('0x12'));var qs=require(_0x183e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x183e('0x14'));var logger=require(_0x183e('0x15'))(_0x183e('0x16'));var utils=require(_0x183e('0x17'));var config=require(_0x183e('0x18'));var licenseUtil=require(_0x183e('0x19'));var db=require(_0x183e('0x1a'))['db'];function respondWithStatusCode(_0x5baf0e,_0x537b43){_0x537b43=_0x537b43||0xcc;return function(_0x595824){if(_0x595824){return _0x5baf0e[_0x183e('0x1b')](_0x537b43);}return _0x5baf0e[_0x183e('0x1c')](_0x537b43)[_0x183e('0x1d')]();};}function respondWithResult(_0x1510ab,_0x27680b){_0x27680b=_0x27680b||0xc8;return function(_0x3be3be){if(_0x3be3be){return _0x1510ab[_0x183e('0x1c')](_0x27680b)[_0x183e('0x1e')](_0x3be3be);}};}function respondWithFilteredResult(_0x271c0b,_0x59b79c){return function(_0x428802){if(_0x428802){var _0x403b0d=typeof _0x59b79c[_0x183e('0x1f')]==='undefined'&&typeof _0x59b79c[_0x183e('0x20')]==='undefined';var _0x57a454=_0x428802[_0x183e('0x21')];var _0x3b22bc=_0x403b0d?0x0:_0x59b79c['offset'];var _0x14c337=_0x403b0d?_0x428802['count']:_0x59b79c[_0x183e('0x1f')]+_0x59b79c['limit'];var _0x1b23e3;if(_0x14c337>=_0x57a454){_0x14c337=_0x57a454;_0x1b23e3=0xc8;}else{_0x1b23e3=0xce;}_0x271c0b['status'](_0x1b23e3);return _0x271c0b[_0x183e('0x22')](_0x183e('0x23'),_0x3b22bc+'-'+_0x14c337+'/'+_0x57a454)[_0x183e('0x1e')](_0x428802);}return null;};}function patchUpdates(_0x35b109){return function(_0x2a0dff){try{jsonpatch['apply'](_0x2a0dff,_0x35b109,!![]);}catch(_0x1a1810){return BPromise[_0x183e('0x24')](_0x1a1810);}return _0x2a0dff['save']();};}function saveUpdates(_0x29a869,_0x22e970){return function(_0xe0832d){if(_0xe0832d){return _0xe0832d[_0x183e('0x25')](_0x29a869)[_0x183e('0x26')](function(_0x52f5b1){return _0x52f5b1;});}return null;};}function removeEntity(_0x43c5e0,_0x449373){return function(_0x1cc027){if(_0x1cc027){return _0x1cc027[_0x183e('0x27')]()[_0x183e('0x26')](function(){_0x43c5e0[_0x183e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fcb6e,_0x42b440){return function(_0x13d772){if(!_0x13d772){_0x2fcb6e[_0x183e('0x1b')](0x194);}return _0x13d772;};}function handleError(_0xf70c71,_0xe4ca7f){_0xe4ca7f=_0xe4ca7f||0x1f4;return function(_0xc68ba4){logger[_0x183e('0x28')](_0xc68ba4[_0x183e('0x29')]);if(_0xc68ba4[_0x183e('0x2a')]){delete _0xc68ba4[_0x183e('0x2a')];}_0xf70c71['status'](_0xe4ca7f)[_0x183e('0x2b')](_0xc68ba4);};}exports[_0x183e('0x2c')]=function(_0x2cb8d0,_0x2d7644){var _0x97c8f={},_0x1cca27={},_0x95bddf={'count':0x0,'rows':[]};var _0x7c47ae=_[_0x183e('0x2d')](db[_0x183e('0x2e')][_0x183e('0x2f')],function(_0x290652){return{'name':_0x290652[_0x183e('0x30')],'type':_0x290652[_0x183e('0x31')][_0x183e('0x32')]};});_0x1cca27['model']=_['map'](_0x7c47ae,_0x183e('0x2a'));_0x1cca27[_0x183e('0x33')]=_[_0x183e('0x34')](_0x2cb8d0['query']);_0x1cca27[_0x183e('0x35')]=_[_0x183e('0x36')](_0x1cca27[_0x183e('0x37')],_0x1cca27[_0x183e('0x33')]);_0x97c8f[_0x183e('0x38')]=_[_0x183e('0x36')](_0x1cca27[_0x183e('0x37')],qs[_0x183e('0x39')](_0x2cb8d0[_0x183e('0x33')][_0x183e('0x39')]));_0x97c8f['attributes']=_0x97c8f['attributes'][_0x183e('0x3a')]?_0x97c8f[_0x183e('0x38')]:_0x1cca27[_0x183e('0x37')];if(!_0x2cb8d0[_0x183e('0x33')][_0x183e('0x3b')]('nolimit')){_0x97c8f[_0x183e('0x20')]=qs[_0x183e('0x20')](_0x2cb8d0[_0x183e('0x33')][_0x183e('0x20')]);_0x97c8f[_0x183e('0x1f')]=qs[_0x183e('0x1f')](_0x2cb8d0[_0x183e('0x33')]['offset']);}_0x97c8f[_0x183e('0x3c')]=qs[_0x183e('0x3d')](_0x2cb8d0['query'][_0x183e('0x3d')]);_0x97c8f['where']=qs['filters'](_['pick'](_0x2cb8d0['query'],_0x1cca27[_0x183e('0x35')]),_0x7c47ae);if(_0x2cb8d0[_0x183e('0x33')][_0x183e('0x3e')]){_0x97c8f[_0x183e('0x3f')]=_['merge'](_0x97c8f[_0x183e('0x3f')],{'$or':_[_0x183e('0x2d')](_0x7c47ae,function(_0x5cf214){if(_0x5cf214[_0x183e('0x31')]!==_0x183e('0x40')){var _0x2804e2={};_0x2804e2[_0x5cf214[_0x183e('0x2a')]]={'$like':'%'+_0x2cb8d0['query']['filter']+'%'};return _0x2804e2;}})});}_0x97c8f=_['merge']({},_0x97c8f,_0x2cb8d0[_0x183e('0x41')]);var _0x92532={'where':_0x97c8f[_0x183e('0x3f')]};return db['ChatTransferReport'][_0x183e('0x21')](_0x92532)[_0x183e('0x26')](function(_0x28fa8f){_0x95bddf[_0x183e('0x21')]=_0x28fa8f;if(_0x2cb8d0['query'][_0x183e('0x42')]){_0x97c8f['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x183e('0x43')](_0x97c8f);})[_0x183e('0x26')](function(_0x3d72fe){_0x95bddf[_0x183e('0x44')]=_0x3d72fe;return _0x95bddf;})[_0x183e('0x26')](respondWithFilteredResult(_0x2d7644,_0x97c8f))[_0x183e('0x45')](handleError(_0x2d7644,null));};exports[_0x183e('0x46')]=function(_0x5b6ea7,_0x2430a3){var _0x4eb018={'raw':!![],'where':{'id':_0x5b6ea7[_0x183e('0x47')]['id']}},_0x1262ea={};_0x1262ea[_0x183e('0x37')]=_[_0x183e('0x34')](db[_0x183e('0x2e')][_0x183e('0x2f')]);_0x1262ea['query']=_['keys'](_0x5b6ea7[_0x183e('0x33')]);_0x1262ea['filters']=_[_0x183e('0x36')](_0x1262ea[_0x183e('0x37')],_0x1262ea['query']);_0x4eb018['attributes']=_['intersection'](_0x1262ea[_0x183e('0x37')],qs[_0x183e('0x39')](_0x5b6ea7[_0x183e('0x33')][_0x183e('0x39')]));_0x4eb018['attributes']=_0x4eb018[_0x183e('0x38')]['length']?_0x4eb018[_0x183e('0x38')]:_0x1262ea[_0x183e('0x37')];if(_0x5b6ea7['query'][_0x183e('0x42')]){_0x4eb018['include']=[{'all':!![]}];}_0x4eb018=_[_0x183e('0x48')]({},_0x4eb018,_0x5b6ea7[_0x183e('0x41')]);return db[_0x183e('0x2e')][_0x183e('0x49')](_0x4eb018)['then'](handleEntityNotFound(_0x2430a3,null))[_0x183e('0x26')](respondWithResult(_0x2430a3,null))[_0x183e('0x45')](handleError(_0x2430a3,null));};exports['create']=function(_0x625c4d,_0x1d5709){return db['ChatTransferReport'][_0x183e('0x4a')](_0x625c4d[_0x183e('0x4b')],{})['then'](respondWithResult(_0x1d5709,0xc9))['catch'](handleError(_0x1d5709,null));};exports[_0x183e('0x25')]=function(_0x3b741c,_0x1f8820){if(_0x3b741c[_0x183e('0x4b')]['id']){delete _0x3b741c[_0x183e('0x4b')]['id'];}return db[_0x183e('0x2e')][_0x183e('0x49')]({'where':{'id':_0x3b741c['params']['id']}})['then'](handleEntityNotFound(_0x1f8820,null))[_0x183e('0x26')](saveUpdates(_0x3b741c['body'],null))[_0x183e('0x26')](respondWithResult(_0x1f8820,null))[_0x183e('0x45')](handleError(_0x1f8820,null));};exports['destroy']=function(_0x386c35,_0x315585){return db[_0x183e('0x2e')]['find']({'where':{'id':_0x386c35[_0x183e('0x47')]['id']}})['then'](handleEntityNotFound(_0x315585,null))['then'](removeEntity(_0x315585,null))[_0x183e('0x45')](handleError(_0x315585,null));};exports[_0x183e('0x4c')]=function(_0x4f76c0,_0x525efe){return db['ChatTransferReport'][_0x183e('0x4c')]()[_0x183e('0x26')](respondWithResult(_0x525efe,null))[_0x183e('0x45')](handleError(_0x525efe,null));}; \ No newline at end of file +var _0x7121=['name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','length','includeAll','catch','create','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x17901f,_0x4dba8c){var _0x22aaba=function(_0x2a3574){while(--_0x2a3574){_0x17901f['push'](_0x17901f['shift']());}};_0x22aaba(++_0x4dba8c);}(_0x7121,0x1c1));var _0x1712=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7121[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0x1712('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1712('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1712('0x2'));var moment=require('moment');var BPromise=require(_0x1712('0x3'));var Mustache=require(_0x1712('0x4'));var util=require(_0x1712('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(_0x1712('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1712('0x7'));var deskjs=require(_0x1712('0x8'));var toCsv=require(_0x1712('0x9'));var querystring=require(_0x1712('0xa'));var Papa=require(_0x1712('0xb'));var Redis=require(_0x1712('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1712('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1712('0xe'))(_0x1712('0xf'));var utils=require(_0x1712('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x169606,_0x42467f){_0x42467f=_0x42467f||0xcc;return function(_0x1d4bb6){if(_0x1d4bb6){return _0x169606['sendStatus'](_0x42467f);}return _0x169606['status'](_0x42467f)['end']();};}function respondWithResult(_0x37c455,_0x19242f){_0x19242f=_0x19242f||0xc8;return function(_0xd0b00d){if(_0xd0b00d){return _0x37c455[_0x1712('0x11')](_0x19242f)[_0x1712('0x12')](_0xd0b00d);}};}function respondWithFilteredResult(_0x1dcf6a,_0x564389){return function(_0x47a93d){if(_0x47a93d){var _0x552ba7=typeof _0x564389[_0x1712('0x13')]==='undefined'&&typeof _0x564389[_0x1712('0x14')]===_0x1712('0x15');var _0x505d3e=_0x47a93d[_0x1712('0x16')];var _0x4fee71=_0x552ba7?0x0:_0x564389['offset'];var _0x2e2eeb=_0x552ba7?_0x47a93d[_0x1712('0x16')]:_0x564389[_0x1712('0x13')]+_0x564389[_0x1712('0x14')];var _0x28068b;if(_0x2e2eeb>=_0x505d3e){_0x2e2eeb=_0x505d3e;_0x28068b=0xc8;}else{_0x28068b=0xce;}_0x1dcf6a[_0x1712('0x11')](_0x28068b);return _0x1dcf6a[_0x1712('0x17')](_0x1712('0x18'),_0x4fee71+'-'+_0x2e2eeb+'/'+_0x505d3e)[_0x1712('0x12')](_0x47a93d);}return null;};}function patchUpdates(_0x4169ed){return function(_0x3029d6){try{jsonpatch[_0x1712('0x19')](_0x3029d6,_0x4169ed,!![]);}catch(_0x490e84){return BPromise['reject'](_0x490e84);}return _0x3029d6[_0x1712('0x1a')]();};}function saveUpdates(_0x2e7b45,_0x41083b){return function(_0x4488be){if(_0x4488be){return _0x4488be[_0x1712('0x1b')](_0x2e7b45)[_0x1712('0x1c')](function(_0x1c79a2){return _0x1c79a2;});}return null;};}function removeEntity(_0x545ac2,_0x5de94d){return function(_0x143660){if(_0x143660){return _0x143660[_0x1712('0x1d')]()[_0x1712('0x1c')](function(){_0x545ac2['status'](0xcc)[_0x1712('0x1e')]();});}};}function handleEntityNotFound(_0x59e57f,_0x2feef5){return function(_0x197639){if(!_0x197639){_0x59e57f[_0x1712('0x1f')](0x194);}return _0x197639;};}function handleError(_0x49b366,_0x5d566d){_0x5d566d=_0x5d566d||0x1f4;return function(_0x1b057b){logger[_0x1712('0x20')](_0x1b057b[_0x1712('0x21')]);if(_0x1b057b['name']){delete _0x1b057b[_0x1712('0x22')];}_0x49b366[_0x1712('0x11')](_0x5d566d)[_0x1712('0x23')](_0x1b057b);};}exports[_0x1712('0x24')]=function(_0x33b28d,_0x483ecf){var _0xcb8553={},_0x489d70={},_0x1adb16={'count':0x0,'rows':[]};var _0x238567=_[_0x1712('0x25')](db[_0x1712('0x26')][_0x1712('0x27')],function(_0x2fdeb4){return{'name':_0x2fdeb4[_0x1712('0x28')],'type':_0x2fdeb4[_0x1712('0x29')][_0x1712('0x2a')]};});_0x489d70[_0x1712('0x2b')]=_[_0x1712('0x25')](_0x238567,_0x1712('0x22'));_0x489d70[_0x1712('0x2c')]=_[_0x1712('0x2d')](_0x33b28d[_0x1712('0x2c')]);_0x489d70[_0x1712('0x2e')]=_['intersection'](_0x489d70[_0x1712('0x2b')],_0x489d70[_0x1712('0x2c')]);_0xcb8553[_0x1712('0x2f')]=_[_0x1712('0x30')](_0x489d70['model'],qs[_0x1712('0x31')](_0x33b28d[_0x1712('0x2c')][_0x1712('0x31')]));_0xcb8553[_0x1712('0x2f')]=_0xcb8553['attributes']['length']?_0xcb8553[_0x1712('0x2f')]:_0x489d70['model'];if(!_0x33b28d['query']['hasOwnProperty'](_0x1712('0x32'))){_0xcb8553[_0x1712('0x14')]=qs[_0x1712('0x14')](_0x33b28d[_0x1712('0x2c')][_0x1712('0x14')]);_0xcb8553[_0x1712('0x13')]=qs[_0x1712('0x13')](_0x33b28d[_0x1712('0x2c')]['offset']);}_0xcb8553[_0x1712('0x33')]=qs['sort'](_0x33b28d[_0x1712('0x2c')][_0x1712('0x34')]);_0xcb8553[_0x1712('0x35')]=qs['filters'](_[_0x1712('0x36')](_0x33b28d['query'],_0x489d70['filters']),_0x238567);if(_0x33b28d[_0x1712('0x2c')][_0x1712('0x37')]){_0xcb8553['where']=_['merge'](_0xcb8553[_0x1712('0x35')],{'$or':_['map'](_0x238567,function(_0x294a64){if(_0x294a64[_0x1712('0x29')]!==_0x1712('0x38')){var _0x12601c={};_0x12601c[_0x294a64[_0x1712('0x22')]]={'$like':'%'+_0x33b28d[_0x1712('0x2c')]['filter']+'%'};return _0x12601c;}})});}_0xcb8553=_[_0x1712('0x39')]({},_0xcb8553,_0x33b28d[_0x1712('0x3a')]);var _0x103570={'where':_0xcb8553[_0x1712('0x35')]};return db[_0x1712('0x26')][_0x1712('0x16')](_0x103570)[_0x1712('0x1c')](function(_0x15675b){_0x1adb16[_0x1712('0x16')]=_0x15675b;if(_0x33b28d[_0x1712('0x2c')]['includeAll']){_0xcb8553[_0x1712('0x3b')]=[{'all':!![]}];}return db[_0x1712('0x26')]['findAll'](_0xcb8553);})['then'](function(_0x59e6fd){_0x1adb16[_0x1712('0x3c')]=_0x59e6fd;return _0x1adb16;})[_0x1712('0x1c')](respondWithFilteredResult(_0x483ecf,_0xcb8553))['catch'](handleError(_0x483ecf,null));};exports[_0x1712('0x3d')]=function(_0x292995,_0x3098e8){var _0x5d714f={'raw':!![],'where':{'id':_0x292995['params']['id']}},_0x5095ef={};_0x5095ef['model']=_[_0x1712('0x2d')](db[_0x1712('0x26')]['rawAttributes']);_0x5095ef[_0x1712('0x2c')]=_[_0x1712('0x2d')](_0x292995[_0x1712('0x2c')]);_0x5095ef[_0x1712('0x2e')]=_[_0x1712('0x30')](_0x5095ef[_0x1712('0x2b')],_0x5095ef[_0x1712('0x2c')]);_0x5d714f[_0x1712('0x2f')]=_[_0x1712('0x30')](_0x5095ef[_0x1712('0x2b')],qs[_0x1712('0x31')](_0x292995[_0x1712('0x2c')][_0x1712('0x31')]));_0x5d714f[_0x1712('0x2f')]=_0x5d714f[_0x1712('0x2f')][_0x1712('0x3e')]?_0x5d714f[_0x1712('0x2f')]:_0x5095ef[_0x1712('0x2b')];if(_0x292995[_0x1712('0x2c')][_0x1712('0x3f')]){_0x5d714f['include']=[{'all':!![]}];}_0x5d714f=_['merge']({},_0x5d714f,_0x292995[_0x1712('0x3a')]);return db['ChatTransferReport']['find'](_0x5d714f)[_0x1712('0x1c')](handleEntityNotFound(_0x3098e8,null))[_0x1712('0x1c')](respondWithResult(_0x3098e8,null))[_0x1712('0x40')](handleError(_0x3098e8,null));};exports['create']=function(_0x5ae2dd,_0x4c16a9){return db[_0x1712('0x26')][_0x1712('0x41')](_0x5ae2dd[_0x1712('0x42')],{})[_0x1712('0x1c')](respondWithResult(_0x4c16a9,0xc9))[_0x1712('0x40')](handleError(_0x4c16a9,null));};exports[_0x1712('0x1b')]=function(_0x3f61a3,_0x5f4d83){if(_0x3f61a3[_0x1712('0x42')]['id']){delete _0x3f61a3[_0x1712('0x42')]['id'];}return db['ChatTransferReport'][_0x1712('0x43')]({'where':{'id':_0x3f61a3['params']['id']}})[_0x1712('0x1c')](handleEntityNotFound(_0x5f4d83,null))['then'](saveUpdates(_0x3f61a3[_0x1712('0x42')],null))[_0x1712('0x1c')](respondWithResult(_0x5f4d83,null))[_0x1712('0x40')](handleError(_0x5f4d83,null));};exports[_0x1712('0x1d')]=function(_0x243e5f,_0x5dd471){return db[_0x1712('0x26')][_0x1712('0x43')]({'where':{'id':_0x243e5f['params']['id']}})['then'](handleEntityNotFound(_0x5dd471,null))[_0x1712('0x1c')](removeEntity(_0x5dd471,null))[_0x1712('0x40')](handleError(_0x5dd471,null));};exports[_0x1712('0x44')]=function(_0x5cef41,_0x208d99){return db['ChatTransferReport'][_0x1712('0x44')]()[_0x1712('0x1c')](respondWithResult(_0x208d99,null))[_0x1712('0x40')](handleError(_0x208d99,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 037edc0..17dbf2b 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 _0x7072=['path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','request-promise'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7072,0xa8));var _0x2707=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7072[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2707('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2707('0x1'));var fs=require('fs');var path=require(_0x2707('0x2'));var rimraf=require(_0x2707('0x3'));var config=require(_0x2707('0x4'));var attributes=require('./chatTransferReport.attributes');module[_0x2707('0x5')]=function(_0x54a24c,_0x3bf38b){return _0x54a24c[_0x2707('0x6')](_0x2707('0x7'),attributes,{'tableName':_0x2707('0x8'),'paranoid':![],'indexes':[{'name':_0x2707('0x9'),'fields':[_0x2707('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc16b=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x5460e5,_0x13d3d3){var _0x3c327b=function(_0x52c43f){while(--_0x52c43f){_0x5460e5['push'](_0x5460e5['shift']());}};_0x3c327b(++_0x13d3d3);}(_0xc16b,0xa0));var _0xbc16=function(_0x5b3b3b,_0x245a9f){_0x5b3b3b=_0x5b3b3b-0x0;var _0x50cacf=_0xc16b[_0x5b3b3b];return _0x50cacf;};'use strict';var _=require(_0xbc16('0x0'));var util=require(_0xbc16('0x1'));var logger=require('../../config/logger')(_0xbc16('0x2'));var moment=require(_0xbc16('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc16('0x4'));var rimraf=require(_0xbc16('0x5'));var config=require(_0xbc16('0x6'));var attributes=require(_0xbc16('0x7'));module[_0xbc16('0x8')]=function(_0x4b98ba,_0x1a4e19){return _0x4b98ba[_0xbc16('0x9')](_0xbc16('0xa'),attributes,{'tableName':_0xbc16('0xb'),'paranoid':![],'indexes':[{'name':_0xbc16('0xc'),'fields':[_0xbc16('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 170b833..da49f48 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 _0xaa6e=['code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xaa6e,0xba));var _0xeaa6=function(_0x57e6c0,_0x5d630a){_0x57e6c0=_0x57e6c0-0x0;var _0x51c843=_0xaa6e[_0x57e6c0];return _0x51c843;};'use strict';var _=require(_0xeaa6('0x0'));var util=require(_0xeaa6('0x1'));var moment=require(_0xeaa6('0x2'));var BPromise=require(_0xeaa6('0x3'));var rs=require(_0xeaa6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaa6('0x5'))['db'];var utils=require(_0xeaa6('0x6'));var logger=require(_0xeaa6('0x7'))(_0xeaa6('0x8'));var config=require(_0xeaa6('0x9'));var jayson=require(_0xeaa6('0xa'));var client=jayson[_0xeaa6('0xb')][_0xeaa6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27d1a8,_0x13db04,_0x58beb7){return new BPromise(function(_0x38bf4d,_0x10cf77){return client[_0xeaa6('0xd')](_0x27d1a8,_0x58beb7)[_0xeaa6('0xe')](function(_0x514c71){logger[_0xeaa6('0xf')](_0xeaa6('0x10'),_0x13db04,'request\x20sent');logger[_0xeaa6('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x13db04,_0xeaa6('0x12'),JSON[_0xeaa6('0x13')](_0x514c71));if(_0x514c71[_0xeaa6('0x14')]){if(_0x514c71[_0xeaa6('0x14')][_0xeaa6('0x15')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x13db04,_0x514c71[_0xeaa6('0x14')]['message']);return _0x10cf77(_0x514c71[_0xeaa6('0x14')]['message']);}logger[_0xeaa6('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x13db04,_0x514c71[_0xeaa6('0x14')]['message']);return _0x38bf4d(_0x514c71[_0xeaa6('0x14')][_0xeaa6('0x16')]);}else{logger['info'](_0xeaa6('0x10'),_0x13db04,'request\x20sent');_0x38bf4d(_0x514c71['result'][_0xeaa6('0x16')]);}})['catch'](function(_0x39f452){logger[_0xeaa6('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x13db04,_0x39f452);_0x10cf77(_0x39f452);});});} \ No newline at end of file +var _0x6ab1=['debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ab1,0xfc));var _0x16ab=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x6ab1[_0x273f77];return _0x71e147;};'use strict';var _=require(_0x16ab('0x0'));var util=require(_0x16ab('0x1'));var moment=require(_0x16ab('0x2'));var BPromise=require(_0x16ab('0x3'));var rs=require(_0x16ab('0x4'));var fs=require('fs');var Redis=require(_0x16ab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x16ab('0x6'));var logger=require(_0x16ab('0x7'))('rpc');var config=require(_0x16ab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x16ab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f28dc,_0x47be60,_0x5ee303){return new BPromise(function(_0x1b8e08,_0x47271e){return client['request'](_0x2f28dc,_0x5ee303)[_0x16ab('0xa')](function(_0x199628){logger[_0x16ab('0xb')](_0x16ab('0xc'),_0x47be60,_0x16ab('0xd'));logger[_0x16ab('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x47be60,_0x16ab('0xd'),JSON[_0x16ab('0xf')](_0x199628));if(_0x199628[_0x16ab('0x10')]){if(_0x199628[_0x16ab('0x10')]['code']===0x1f4){logger[_0x16ab('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x47be60,_0x199628[_0x16ab('0x10')][_0x16ab('0x11')]);return _0x47271e(_0x199628[_0x16ab('0x10')][_0x16ab('0x11')]);}logger[_0x16ab('0x10')](_0x16ab('0xc'),_0x47be60,_0x199628[_0x16ab('0x10')]['message']);return _0x1b8e08(_0x199628[_0x16ab('0x10')][_0x16ab('0x11')]);}else{logger[_0x16ab('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x47be60,_0x16ab('0xd'));_0x1b8e08(_0x199628[_0x16ab('0x12')][_0x16ab('0x11')]);}})['catch'](function(_0x3fb621){logger[_0x16ab('0x10')](_0x16ab('0xc'),_0x47be60,_0x3fb621);_0x47271e(_0x3fb621);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2ea293c..4334230 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 _0x25a4=['get','/describe','isAuthenticated','describe','/:id','show','create','put','update','destroy','exports','util','connect-timeout','express','Router','../../config/environment'];(function(_0x5689e4,_0xca20b8){var _0x46ec6e=function(_0x16f4f2){while(--_0x16f4f2){_0x5689e4['push'](_0x5689e4['shift']());}};_0x46ec6e(++_0xca20b8);}(_0x25a4,0x10b));var _0x425a=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0x25a4[_0x2a390b];return _0x5df10a;};'use strict';var multer=require('multer');var util=require(_0x425a('0x0'));var path=require('path');var timeout=require(_0x425a('0x1'));var express=require(_0x425a('0x2'));var router=express[_0x425a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x425a('0x4'));var controller=require('./chatTransferReport.controller');router[_0x425a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x425a('0x6'),auth[_0x425a('0x7')](),controller[_0x425a('0x8')]);router[_0x425a('0x5')](_0x425a('0x9'),auth[_0x425a('0x7')](),controller[_0x425a('0xa')]);router['post']('/',auth[_0x425a('0x7')](),controller[_0x425a('0xb')]);router[_0x425a('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x425a('0xd')]);router['delete'](_0x425a('0x9'),auth['isAuthenticated'](),controller[_0x425a('0xe')]);module[_0x425a('0xf')]=router; \ No newline at end of file +var _0x5062=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','delete','destroy','exports','path','connect-timeout'];(function(_0x27793a,_0x1bf59a){var _0x4dc325=function(_0x2ccf27){while(--_0x2ccf27){_0x27793a['push'](_0x27793a['shift']());}};_0x4dc325(++_0x1bf59a);}(_0x5062,0xcf));var _0x2506=function(_0x3d6d0e,_0x5f5141){_0x3d6d0e=_0x3d6d0e-0x0;var _0xebbe34=_0x5062[_0x3d6d0e];return _0xebbe34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2506('0x0'));var timeout=require(_0x2506('0x1'));var express=require('express');var router=express[_0x2506('0x2')]();var fs_extra=require(_0x2506('0x3'));var auth=require(_0x2506('0x4'));var interaction=require(_0x2506('0x5'));var config=require(_0x2506('0x6'));var controller=require(_0x2506('0x7'));router[_0x2506('0x8')]('/',auth[_0x2506('0x9')](),controller[_0x2506('0xa')]);router[_0x2506('0x8')]('/describe',auth[_0x2506('0x9')](),controller[_0x2506('0xb')]);router[_0x2506('0x8')](_0x2506('0xc'),auth['isAuthenticated'](),controller[_0x2506('0xd')]);router[_0x2506('0xe')]('/',auth[_0x2506('0x9')](),controller['create']);router[_0x2506('0xf')](_0x2506('0xc'),auth[_0x2506('0x9')](),controller['update']);router[_0x2506('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2506('0x11')]);module[_0x2506('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index ffeb4af..e453a40 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 _0x498b=['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.','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','Send','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','star','thumb','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0x498b,0xa3));var _0xb498=function(_0xd0799f,_0x1968ab){_0xd0799f=_0xd0799f-0x0;var _0x3d0469=_0x498b[_0xd0799f];return _0x3d0469;};'use strict';var Sequelize=require(_0xb498('0x0'));var rs=require(_0xb498('0x1'));module['exports']={'name':{'type':Sequelize[_0xb498('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb498('0x3')},'description':{'type':Sequelize[_0xb498('0x2')]},'mapKey':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x5')},'customerAlias':{'type':Sequelize[_0xb498('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb498('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb498('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb498('0x2')],'allowNull':![],'defaultValue':_0xb498('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb498('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb498('0x2')]},'animation':{'type':Sequelize[_0xb498('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb498('0x9')]('rounded',_0xb498('0xa')),'defaultValue':_0xb498('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xb498('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0xc')},'header_offline':{'type':Sequelize[_0xb498('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xb498('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb498('0xd')]},'closingQuestion':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb498('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0xf')},'noteTitle':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x10')},'placeholderMessage':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x11')},'closingMessage':{'type':Sequelize[_0xb498('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0xc')},'skipMessageButton':{'type':Sequelize[_0xb498('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x12')},'ratingType':{'type':Sequelize['ENUM'](_0xb498('0x13'),_0xb498('0x14')),'defaultValue':_0xb498('0x13')},'ratingStarsNumber':{'type':Sequelize[_0xb498('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb498('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb498('0x15'),'variable':null,'config':{'placeholder':_0xb498('0x16'),'type':_0xb498('0x17'),'required':!![]},'props':{'title':_0xb498('0x16'),'helpText':''}},{'type':_0xb498('0x15'),'props':{'title':_0xb498('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb498('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb498('0x18')](_0xb498('0x19'))?JSON[_0xb498('0x1a')](this[_0xb498('0x18')]('onlineForm')):{};},'set':function(_0x4685e6){return this[_0xb498('0x1b')](_0xb498('0x19'),JSON[_0xb498('0x1c')](_0x4685e6));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb498('0x15'),'props':{'title':_0xb498('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb498('0x4'),'type':'email'},'variable':null},{'type':_0xb498('0x1d'),'config':{'placeholder':'Comments'},'props':{'title':_0xb498('0x1e'),'helpText':_0xb498('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xb498('0x18')](_0xb498('0x20'))?JSON['parse'](this[_0xb498('0x18')](_0xb498('0x20'))):{};},'set':function(_0x34ad0f){return this[_0xb498('0x1b')](_0xb498('0x20'),JSON[_0xb498('0x1c')](_0x34ad0f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xb498('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb498('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb498('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb498('0x21')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb498('0x22')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'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[_0xb498('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x23')},'skipUnmanaged':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x24')},'sendUnmanaged':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb498('0xd')]},'showAgentAvatar':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb498('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb498('0x25');}},'notificationSound':{'type':Sequelize[_0xb498('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb498('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xb498('0x26')},'verticalAlignment':{'type':Sequelize[_0xb498('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x27')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xb498('0xd')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb498('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb498('0x2')],'allowNull':![],'defaultValue':_0xb498('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb498('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb498('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb498('0x2')],'defaultValue':_0xb498('0x29')},'systemAvatar':{'type':Sequelize[_0xb498('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb498('0x7')],'comment':_0xb498('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![],'comment':_0xb498('0x2b'),'set':function(_0x1b47db){if(!_0x1b47db)this[_0xb498('0x1b')](_0xb498('0x2c'),null);this[_0xb498('0x1b')](_0xb498('0x2d'),_0x1b47db);}},'vidaooEscalation':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb498('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb498('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xb498('0x2f');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb498('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb498('0xd')]}}; \ No newline at end of file +var _0x2ce1=['ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','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.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent','#011F6A','INTEGER'];(function(_0x5a0fde,_0x1e9a29){var _0x4816db=function(_0x4af880){while(--_0x4af880){_0x5a0fde['push'](_0x5a0fde['shift']());}};_0x4816db(++_0x1e9a29);}(_0x2ce1,0x1df));var _0x12ce=function(_0x4e2a0a,_0x3ec730){_0x4e2a0a=_0x4e2a0a-0x0;var _0x1f063d=_0x2ce1[_0x4e2a0a];return _0x1f063d;};'use strict';var Sequelize=require(_0x12ce('0x0'));var rs=require(_0x12ce('0x1'));module['exports']={'name':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x12ce('0x2')]},'mapKey':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x3')},'mapKeyOffline':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':_0x12ce('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':_0x12ce('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x12ce('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x12ce('0x7')]('rounded',_0x12ce('0x8')),'defaultValue':_0x12ce('0x9')},'header_online':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0xa')},'start_chat_button':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0xb')},'offline_chat_button':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0xc')},'header_offline':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0xd')},'download_transcript':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x12ce('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x12ce('0x10')]},'closingQuestion':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x13')},'noteTitle':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x14')},'placeholderMessage':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x15')},'closingMessage':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0x17')},'conditionAgreement':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x18')},'ratingType':{'type':Sequelize[_0x12ce('0x7')](_0x12ce('0x19'),'thumb'),'defaultValue':_0x12ce('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x12ce('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x12ce('0x10')],'defaultValue':function(){return JSON[_0x12ce('0x1a')]({'items':[{'type':_0x12ce('0x1b'),'variable':null,'config':{'placeholder':_0x12ce('0x1c'),'type':_0x12ce('0x1d'),'required':!![]},'props':{'title':_0x12ce('0x1c'),'helpText':''}},{'type':_0x12ce('0x1b'),'props':{'title':_0x12ce('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x12ce('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x12ce('0x1e'))?JSON[_0x12ce('0x1f')](this[_0x12ce('0x20')](_0x12ce('0x1e'))):{};},'set':function(_0x440aa4){return this['setDataValue'](_0x12ce('0x1e'),JSON['stringify'](_0x440aa4));}},'offlineForm':{'type':Sequelize[_0x12ce('0x10')],'defaultValue':function(){return JSON[_0x12ce('0x1a')]({'items':[{'type':_0x12ce('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x12ce('0x3'),'type':_0x12ce('0x3')},'variable':null},{'type':_0x12ce('0x21'),'config':{'placeholder':_0x12ce('0x22')},'props':{'title':_0x12ce('0x22'),'helpText':_0x12ce('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x12ce('0x1f')](this['getDataValue'](_0x12ce('0x24'))):{};},'set':function(_0x303092){return this[_0x12ce('0x25')](_0x12ce('0x24'),JSON['stringify'](_0x303092));}},'token':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':function(){return rs[_0x12ce('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x12ce('0x2')]},'forwardOffline':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x12ce('0x2')]},'waitingTitle':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0x29')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0x17')},'sendUnmanaged':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x12ce('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x12ce('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x12ce('0x2b');}},'notificationSound':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x12ce('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x2d')},'verticalAlignment':{'type':Sequelize[_0x12ce('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x12ce('0x2e')},'messagesAlignment':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x12ce('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x12ce('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':_0x12ce('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x12ce('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x12ce('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':_0x12ce('0x30')},'systemAvatar':{'type':Sequelize[_0x12ce('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x12ce('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x12ce('0xe')],'defaultValue':![],'comment':_0x12ce('0x32'),'set':function(_0x5cc6d8){if(!_0x5cc6d8)this[_0x12ce('0x25')](_0x12ce('0x33'),null);this[_0x12ce('0x25')](_0x12ce('0x34'),_0x5cc6d8);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x12ce('0x2')]},'vidaooTopic':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x12ce('0x2')],'defaultValue':function(){return _0x12ce('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x12ce('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x12ce('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 84948b3..81eb114 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 _0xcfce=['end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','stack','name','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','stringify','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','show','params','length','options','find','body','address','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','testWildcardValidity','describe','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','asc','list','defaults','contact','headers','threadId','closed','ChatInteraction','referer','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','startRouting','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','getSnippet','Intervals','interval','virtual','chatLicenseExceeded','server/files/chat/iframe.ejs','3.9.0','origin','replace','testWebsiteWithWildcard','remote','connection','remoteAddress','render','alignment','verticalAlignment','color','textColor','textButtonColor','backgroundColor','hideWhenOffline','addApplications','transaction','Transaction','findAndCountAll','priority','finally','getApplications','chatProactiveAction','addProactiveActions','omit','getProactiveActions','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','User','getAgents','util','path','ejs','fs-extra','lodash','html-to-text','jayson/promise','../../components/parsers/qs','../../config/environment','../../errors/api','APIBadRequestError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','localhost','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','sendStatus','status'];(function(_0x3058b8,_0x5e12e1){var _0x282a80=function(_0x49bf6c){while(--_0x49bf6c){_0x3058b8['push'](_0x3058b8['shift']());}};_0x282a80(++_0x5e12e1);}(_0xcfce,0x115));var _0xecfc=function(_0x4bfaa7,_0x1033b0){_0x4bfaa7=_0x4bfaa7-0x0;var _0x282f8f=_0xcfce[_0x4bfaa7];return _0x282f8f;};'use strict';var Mustache=require('mustache');var util=require(_0xecfc('0x0'));var path=require(_0xecfc('0x1'));var ejs=require(_0xecfc('0x2'));var fs=require('fs');var fs_extra=require(_0xecfc('0x3'));var _=require(_0xecfc('0x4'));var querystring=require('querystring');var htmlToText=require(_0xecfc('0x5'));var Redis=require('ioredis');var jayson=require(_0xecfc('0x6'));var qs=require(_0xecfc('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xecfc('0x8'));var APIBadRequestError=require(_0xecfc('0x9'))[_0xecfc('0xa')];var APINotFoundError=require(_0xecfc('0x9'))['APINotFoundError'];var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0xecfc('0xb')];var APIConflictError=require(_0xecfc('0x9'))[_0xecfc('0xc')];var wildcardUtils=require(_0xecfc('0xd'));var URL=require(_0xecfc('0xe'))[_0xecfc('0xf')];var db=require('../../mysqldb')['db'];config[_0xecfc('0x10')]=_['defaults'](config[_0xecfc('0x10')],{'host':_0xecfc('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecfc('0x10')]));require('./chatWebsite.socket')[_0xecfc('0x12')](socket);var client=jayson[_0xecfc('0x13')]['http']({'port':0x232c});var client9002=jayson[_0xecfc('0x13')][_0xecfc('0x14')]({'port':0x232a});var client9003=jayson[_0xecfc('0x13')][_0xecfc('0x14')]({'port':0x232b});var client9001=jayson[_0xecfc('0x13')][_0xecfc('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x46235f,_0x3e03aa,_0x328c26,_0xbdc7f4){return new Promise(function(_0xd66403,_0x44c785){var _0x52c8d2=_0xbdc7f4||client;return _0x52c8d2['request'](_0x46235f,_0x328c26)[_0xecfc('0x15')](function(_0x59bc0e){logger[_0xecfc('0x16')](_0xecfc('0x17'),_0x3e03aa,'request\x20sent');logger[_0xecfc('0x18')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3e03aa,_0xecfc('0x19'),JSON['stringify'](_0x59bc0e));if(_0x59bc0e['error']){if(_0x59bc0e[_0xecfc('0x1a')]['code']===0x1f4){logger[_0xecfc('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x3e03aa,_0x59bc0e[_0xecfc('0x1a')]['message']);return _0x44c785(_0x59bc0e[_0xecfc('0x1a')][_0xecfc('0x1b')]);}logger[_0xecfc('0x1a')](_0xecfc('0x17'),_0x3e03aa,_0x59bc0e[_0xecfc('0x1a')]['message']);return _0xd66403(_0x59bc0e[_0xecfc('0x1a')][_0xecfc('0x1b')]);}else{logger[_0xecfc('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x3e03aa,_0xecfc('0x19'));_0xd66403(_0x59bc0e['result']['message']);}})[_0xecfc('0x1c')](function(_0x594272){logger[_0xecfc('0x1a')](_0xecfc('0x17'),_0x3e03aa,_0x594272);_0x44c785(_0x594272);});});}function respondWithStatusCode(_0x157dd6,_0x2de944){_0x2de944=_0x2de944||0xcc;return function(_0x449562){if(_0x449562){return _0x157dd6[_0xecfc('0x1d')](_0x2de944);}return _0x157dd6[_0xecfc('0x1e')](_0x2de944)[_0xecfc('0x1f')]();};}function respondWithResult(_0x120646,_0x2b4d69){_0x2b4d69=_0x2b4d69||0xc8;return function(_0x35554c){if(_0x35554c){return _0x120646[_0xecfc('0x1e')](_0x2b4d69)[_0xecfc('0x20')](_0x35554c);}};}function respondWithFilteredResult(_0x5c58e2,_0x803acd){return function(_0x381547){if(_0x381547){var _0x1e2f51=typeof _0x803acd[_0xecfc('0x21')]===_0xecfc('0x22')&&typeof _0x803acd[_0xecfc('0x23')]===_0xecfc('0x22');var _0x408541=_0x381547[_0xecfc('0x24')];var _0x2a8eb1=_0x1e2f51?0x0:_0x803acd[_0xecfc('0x21')];var _0x382773=_0x1e2f51?_0x381547[_0xecfc('0x24')]:_0x803acd[_0xecfc('0x21')]+_0x803acd[_0xecfc('0x23')];var _0x3c12b2;if(_0x382773>=_0x408541){_0x382773=_0x408541;_0x3c12b2=0xc8;}else{_0x3c12b2=0xce;}_0x5c58e2[_0xecfc('0x1e')](_0x3c12b2);return _0x5c58e2[_0xecfc('0x25')](_0xecfc('0x26'),_0x2a8eb1+'-'+_0x382773+'/'+_0x408541)['json'](_0x381547);}return null;};}function saveUpdates(_0x495f86){return function(_0x31b77a){if(_0x31b77a){return _0x31b77a['update'](_0x495f86)[_0xecfc('0x15')](function(_0x242511){return _0x242511;});}return null;};}function removeEntity(_0x353947){return function(_0x1b75bf){if(_0x1b75bf){return _0x1b75bf[_0xecfc('0x27')]()[_0xecfc('0x15')](function(){var _0x10f33e=_0x1b75bf[_0xecfc('0x28')]({'plain':!![]});var _0x11abaa=_0xecfc('0x29');return db[_0xecfc('0x2a')][_0xecfc('0x27')]({'where':{'type':_0x11abaa,'resourceId':_0x10f33e['id']}})[_0xecfc('0x15')](function(){return _0x1b75bf;});})[_0xecfc('0x15')](function(){_0x353947[_0xecfc('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cdc72){return function(_0x397a18){if(!_0x397a18){_0x1cdc72[_0xecfc('0x1d')](0x194);}return _0x397a18;};}function handleError(_0x29873e,_0x36f2af){_0x36f2af=_0x36f2af||0x1f4;return function(_0x115f1f){logger[_0xecfc('0x1a')](_0x115f1f[_0xecfc('0x2b')]);if(_0x115f1f[_0xecfc('0x2c')]){delete _0x115f1f['name'];}_0x29873e['status'](_0x36f2af)['send'](_0x115f1f);};}function createInteractionObject(_0x48dc53,_0x27c3ff,_0x4043b6,_0x284b42){var _0x45dd1b=require(_0xecfc('0x2d'));var _0x1a9faa=new _0x45dd1b();var _0x9ec64c=_0x1a9faa[_0xecfc('0x2e')](_0x4043b6[_0xecfc('0x2f')])[_0xecfc('0x30')]();var _0x2e86b1=_0x27c3ff[_0xecfc('0x31')];if(_0x4043b6[_0xecfc('0x32')]){_0x2e86b1=_0x4043b6['cf-connecting-ip'];}else if(_0x4043b6[_0xecfc('0x33')]){_0x2e86b1=_[_0xecfc('0x34')](_0x4043b6['x-forwarded-for']['split'](','));}return{'ContactId':_0x284b42['id'],'ChatWebsiteId':_0x48dc53,'from':(_0x284b42[_0xecfc('0x35')]||'')+'\x20'+(_0x284b42[_0xecfc('0x36')]||''),'customerIp':_0x2e86b1,'customerPort':_0x4043b6[_0xecfc('0x37')]?_0x4043b6[_0xecfc('0x37')]:null,'referer':_0x27c3ff['referer'],'browserName':_0x9ec64c['browser']['name']&&_0x9ec64c[_0xecfc('0x38')][_0xecfc('0x39')]?util[_0xecfc('0x3a')]('%s\x20%s',_0x9ec64c['browser']['name'],_0x9ec64c[_0xecfc('0x38')][_0xecfc('0x39')]):_0xecfc('0x3b'),'browserVersion':_0x9ec64c[_0xecfc('0x38')][_0xecfc('0x39')]||_0xecfc('0x3b'),'osName':util[_0xecfc('0x3a')](_0xecfc('0x3c'),_0x9ec64c['os'][_0xecfc('0x2c')],_0x9ec64c['os']['version']),'osVersion':_0x9ec64c['os'][_0xecfc('0x39')],'deviceModel':_0x9ec64c[_0xecfc('0x3d')][_0xecfc('0x3e')]&&_0x9ec64c[_0xecfc('0x3d')][_0xecfc('0x3f')]?util[_0xecfc('0x3a')](_0xecfc('0x40'),_0x9ec64c[_0xecfc('0x3d')][_0xecfc('0x3e')],_0x9ec64c[_0xecfc('0x3d')][_0xecfc('0x3f')],_0x9ec64c[_0xecfc('0x3d')]['type']):null,'deviceVendor':_0x9ec64c[_0xecfc('0x3d')][_0xecfc('0x3f')],'deviceType':_0x9ec64c[_0xecfc('0x3d')][_0xecfc('0x41')],'formData':JSON[_0xecfc('0x42')](_0x27c3ff)};}exports[_0xecfc('0x43')]=function(_0x15b425,_0x42e235){var _0x242533={'include':[{'model':db[_0xecfc('0x44')],'as':_0xecfc('0x45')}]},_0x10f7b5={},_0x5a764a={'count':0x0,'rows':[]};var _0x693885=_[_0xecfc('0x46')](db[_0xecfc('0x47')][_0xecfc('0x48')],function(_0x3f43d0){return{'name':_0x3f43d0[_0xecfc('0x49')],'type':_0x3f43d0[_0xecfc('0x41')][_0xecfc('0x4a')]};});_0x10f7b5[_0xecfc('0x3e')]=_[_0xecfc('0x46')](_0x693885,_0xecfc('0x2c'));_0x10f7b5[_0xecfc('0x4b')]=_[_0xecfc('0x4c')](_0x15b425[_0xecfc('0x4b')]);_0x10f7b5[_0xecfc('0x4d')]=_[_0xecfc('0x4e')](_0x10f7b5[_0xecfc('0x3e')],_0x10f7b5[_0xecfc('0x4b')]);_0x242533[_0xecfc('0x4f')]=_[_0xecfc('0x4e')](_0x10f7b5[_0xecfc('0x3e')],qs[_0xecfc('0x50')](_0x15b425['query'][_0xecfc('0x50')]));_0x242533[_0xecfc('0x4f')]=_0x242533[_0xecfc('0x4f')]['length']?_0x242533[_0xecfc('0x4f')]:_0x10f7b5[_0xecfc('0x3e')];if(!_0x15b425[_0xecfc('0x4b')][_0xecfc('0x51')](_0xecfc('0x52'))){_0x242533['limit']=qs[_0xecfc('0x23')](_0x15b425[_0xecfc('0x4b')]['limit']);_0x242533['offset']=qs[_0xecfc('0x21')](_0x15b425['query']['offset']);}_0x242533[_0xecfc('0x53')]=qs[_0xecfc('0x54')](_0x15b425['query'][_0xecfc('0x54')]);_0x242533[_0xecfc('0x55')]=qs[_0xecfc('0x4d')](_[_0xecfc('0x56')](_0x15b425[_0xecfc('0x4b')],_0x10f7b5[_0xecfc('0x4d')]),_0x693885);if(_0x15b425[_0xecfc('0x4b')][_0xecfc('0x57')]){_0x242533[_0xecfc('0x55')]=_[_0xecfc('0x58')](_0x242533[_0xecfc('0x55')],{'$or':_['map'](_0x693885,function(_0x34a1f9){if(_0x34a1f9[_0xecfc('0x41')]!=='VIRTUAL'){var _0x2630b6={};_0x2630b6[_0x34a1f9[_0xecfc('0x2c')]]={'$like':'%'+_0x15b425['query'][_0xecfc('0x57')]+'%'};return _0x2630b6;}})});}_0x242533=_[_0xecfc('0x58')]({},_0x242533,_0x15b425['options']);var _0x2ebf93={'where':_0x242533['where']};return db[_0xecfc('0x47')]['count'](_0x2ebf93)[_0xecfc('0x15')](function(_0x55be49){_0x5a764a['count']=_0x55be49;if(_0x15b425['query'][_0xecfc('0x59')]){_0x242533[_0xecfc('0x5a')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x242533);})[_0xecfc('0x15')](function(_0x633ded){_0x5a764a[_0xecfc('0x5b')]=_0x633ded;return _0x5a764a;})[_0xecfc('0x15')](respondWithFilteredResult(_0x42e235,_0x242533))[_0xecfc('0x1c')](handleError(_0x42e235,null));};exports[_0xecfc('0x5c')]=function(_0x1b6db5,_0x60783d){var _0xf40d5b={'raw':![],'where':{'id':_0x1b6db5[_0xecfc('0x5d')]['id']},'include':[{'model':db[_0xecfc('0x44')],'as':_0xecfc('0x45')}]},_0x3b5db1={};_0x3b5db1[_0xecfc('0x3e')]=_[_0xecfc('0x4c')](db['ChatWebsite'][_0xecfc('0x48')]);_0x3b5db1[_0xecfc('0x4b')]=_[_0xecfc('0x4c')](_0x1b6db5[_0xecfc('0x4b')]);_0x3b5db1[_0xecfc('0x4d')]=_[_0xecfc('0x4e')](_0x3b5db1[_0xecfc('0x3e')],_0x3b5db1[_0xecfc('0x4b')]);_0xf40d5b[_0xecfc('0x4f')]=_[_0xecfc('0x4e')](_0x3b5db1[_0xecfc('0x3e')],qs[_0xecfc('0x50')](_0x1b6db5[_0xecfc('0x4b')][_0xecfc('0x50')]));_0xf40d5b[_0xecfc('0x4f')]=_0xf40d5b['attributes'][_0xecfc('0x5e')]?_0xf40d5b[_0xecfc('0x4f')]:_0x3b5db1[_0xecfc('0x3e')];if(_0x1b6db5[_0xecfc('0x4b')][_0xecfc('0x59')]){_0xf40d5b['include']=[{'all':!![]}];}_0xf40d5b=_[_0xecfc('0x58')]({},_0xf40d5b,_0x1b6db5[_0xecfc('0x5f')]);return db['ChatWebsite'][_0xecfc('0x60')](_0xf40d5b)['then'](handleEntityNotFound(_0x60783d,null))[_0xecfc('0x15')](respondWithResult(_0x60783d,null))['catch'](handleError(_0x60783d,null));};exports['create']=function(_0x3ef8b2,_0xea67e7){if(!wildcardUtils['testWildcardValidity'](_0x3ef8b2[_0xecfc('0x61')][_0xecfc('0x62')])){return handleError(_0xea67e7,null)(new APIBadRequestError('\x22'+_0x3ef8b2[_0xecfc('0x61')][_0xecfc('0x62')]+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}return db['ChatWebsite'][_0xecfc('0x63')](_0x3ef8b2[_0xecfc('0x61')],{})[_0xecfc('0x15')](function(_0x4c96d0){var _0x131499=_0x3ef8b2[_0xecfc('0x64')][_0xecfc('0x28')]({'plain':!![]});if(!_0x131499)throw new Error(_0xecfc('0x65'));if(_0x131499[_0xecfc('0x66')]===_0xecfc('0x64')){var _0x126ad9=_0x4c96d0[_0xecfc('0x28')]({'plain':!![]});var _0x99d72d=_0xecfc('0x29');return db[_0xecfc('0x67')][_0xecfc('0x60')]({'where':{'name':_0x99d72d,'userProfileId':_0x131499[_0xecfc('0x68')]},'raw':!![]})[_0xecfc('0x15')](function(_0x534969){if(_0x534969&&_0x534969[_0xecfc('0x69')]===0x0){return db[_0xecfc('0x2a')][_0xecfc('0x63')]({'name':_0x126ad9[_0xecfc('0x2c')],'resourceId':_0x126ad9['id'],'type':_0x534969[_0xecfc('0x2c')],'sectionId':_0x534969['id']},{})[_0xecfc('0x15')](function(){return _0x4c96d0;});}else{return _0x4c96d0;}})[_0xecfc('0x1c')](function(_0x4868da){logger[_0xecfc('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4868da);throw _0x4868da;});}return _0x4c96d0;})[_0xecfc('0x15')](respondWithResult(_0xea67e7,0xc9))[_0xecfc('0x1c')](handleError(_0xea67e7,null));};exports[_0xecfc('0x6a')]=function(_0x3ad08e,_0x2744f2){if(!wildcardUtils[_0xecfc('0x6b')](_0x3ad08e['body'][_0xecfc('0x62')])){return handleError(_0x2744f2,null)(new APIBadRequestError('\x22'+_0x3ad08e[_0xecfc('0x61')]['address']+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}if(_0x3ad08e[_0xecfc('0x61')]['id']){delete _0x3ad08e[_0xecfc('0x61')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x3ad08e['params']['id']},'include':[{'model':db[_0xecfc('0x44')],'as':_0xecfc('0x45')}]})['then'](handleEntityNotFound(_0x2744f2,null))[_0xecfc('0x15')](saveUpdates(_0x3ad08e['body'],null))[_0xecfc('0x15')](respondWithResult(_0x2744f2,null))[_0xecfc('0x1c')](handleError(_0x2744f2,null));};exports[_0xecfc('0x27')]=function(_0x23c031,_0xde8504){return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0x23c031['params']['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0xde8504,null))[_0xecfc('0x15')](removeEntity(_0xde8504,null))[_0xecfc('0x1c')](handleError(_0xde8504,null));};exports[_0xecfc('0x6c')]=function(_0xd6fe69,_0x303fea){return db[_0xecfc('0x47')][_0xecfc('0x6c')]()['then'](respondWithResult(_0x303fea,null))[_0xecfc('0x1c')](handleError(_0x303fea,null));};exports['addDisposition']=function(_0x675dba,_0x565fe6){if(_0x675dba[_0xecfc('0x61')]['id']){delete _0x675dba[_0xecfc('0x61')]['id'];}return db['ChatWebsite'][_0xecfc('0x60')]({'where':{'id':_0x675dba[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x565fe6,null))[_0xecfc('0x15')](function(_0x331dde){if(_0x331dde){_0x675dba[_0xecfc('0x61')][_0xecfc('0x6d')]=_0x331dde['id'];return db[_0xecfc('0x6e')][_0xecfc('0x63')](_0x675dba[_0xecfc('0x61')]);}})[_0xecfc('0x15')](respondWithResult(_0x565fe6,null))[_0xecfc('0x1c')](handleError(_0x565fe6,null));};exports[_0xecfc('0x6f')]=function(_0x30e260,_0x391bf1){var _0x237071={'raw':![],'where':{}};var _0xb674e3={};var _0x5abb08={'count':0x0,'rows':[]};return db[_0xecfc('0x47')][_0xecfc('0x70')]({'where':{'id':_0x30e260['params']['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x391bf1,null))['then'](function(_0x1a2a76){if(_0x1a2a76){_0xb674e3[_0xecfc('0x3e')]=_['keys'](db[_0xecfc('0x6e')][_0xecfc('0x48')]);_0xb674e3[_0xecfc('0x4b')]=_[_0xecfc('0x4c')](_0x30e260[_0xecfc('0x4b')]);_0xb674e3[_0xecfc('0x4d')]=_['intersection'](_0xb674e3[_0xecfc('0x3e')],_0xb674e3[_0xecfc('0x4b')]);_0x237071[_0xecfc('0x4f')]=_['intersection'](_0xb674e3[_0xecfc('0x3e')],qs[_0xecfc('0x50')](_0x30e260[_0xecfc('0x4b')][_0xecfc('0x50')]));_0x237071[_0xecfc('0x4f')]=_0x237071[_0xecfc('0x4f')]['length']?_0x237071[_0xecfc('0x4f')]:_0xb674e3[_0xecfc('0x3e')];if(!_0x30e260[_0xecfc('0x4b')][_0xecfc('0x51')](_0xecfc('0x52'))){_0x237071[_0xecfc('0x23')]=qs[_0xecfc('0x23')](_0x30e260[_0xecfc('0x4b')][_0xecfc('0x23')]);_0x237071[_0xecfc('0x21')]=qs[_0xecfc('0x21')](_0x30e260[_0xecfc('0x4b')]['offset']);}_0x237071[_0xecfc('0x53')]=qs[_0xecfc('0x54')](_0x30e260['query']['sort']);_0x237071['where']=qs['filters'](_[_0xecfc('0x56')](_0x30e260[_0xecfc('0x4b')],_0xb674e3[_0xecfc('0x4d')]));_0x237071['where']['ChatWebsiteId']=_0x1a2a76['id'];if(_0x30e260['query'][_0xecfc('0x57')]){_0x237071[_0xecfc('0x55')]=_[_0xecfc('0x58')](_0x237071[_0xecfc('0x55')],{'$or':_['map'](_0x237071[_0xecfc('0x4f')],function(_0x417f5b){var _0xc334ac={};_0xc334ac[_0x417f5b]={'$like':'%'+_0x30e260['query']['filter']+'%'};return _0xc334ac;})});}_0x237071=_[_0xecfc('0x58')]({},_0x237071,_0x30e260['options']);return db[_0xecfc('0x6e')][_0xecfc('0x24')]({'where':_0x237071['where']})[_0xecfc('0x15')](function(_0x39a7e7){_0x5abb08[_0xecfc('0x24')]=_0x39a7e7;if(_0x30e260[_0xecfc('0x4b')][_0xecfc('0x59')]){_0x237071[_0xecfc('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0xecfc('0x71')](_0x237071);})['then'](function(_0x540df2){_0x5abb08[_0xecfc('0x5b')]=_0x540df2;return _0x5abb08;});}})[_0xecfc('0x15')](respondWithFilteredResult(_0x391bf1,_0x237071))[_0xecfc('0x1c')](handleError(_0x391bf1,null));};exports[_0xecfc('0x72')]=function(_0x22be92,_0x42ee28){return db['ChatWebsite']['find']({'where':{'id':_0x22be92[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x42ee28,null))[_0xecfc('0x15')](function(_0x4dfb95){if(_0x4dfb95){return _0x4dfb95[_0xecfc('0x72')](_0x22be92[_0xecfc('0x4b')][_0xecfc('0x73')]);}})[_0xecfc('0x15')](respondWithStatusCode(_0x42ee28,null))[_0xecfc('0x1c')](handleError(_0x42ee28,null));};exports['addAnswer']=function(_0xa4779a,_0x1ceeab){if(_0xa4779a[_0xecfc('0x61')]['id']){delete _0xa4779a[_0xecfc('0x61')]['id'];}return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0xa4779a['params']['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x1ceeab,null))[_0xecfc('0x15')](function(_0x5273a8){if(_0x5273a8){_0xa4779a[_0xecfc('0x61')][_0xecfc('0x6d')]=_0x5273a8['id'];return db['CannedAnswer']['create'](_0xa4779a[_0xecfc('0x61')]);}})[_0xecfc('0x15')](respondWithResult(_0x1ceeab,null))[_0xecfc('0x1c')](handleError(_0x1ceeab,null));};exports[_0xecfc('0x74')]=function(_0x57889f,_0x2811ea){var _0x48ab0f={'raw':![],'where':{}};var _0x551038={};var _0x22126d={'count':0x0,'rows':[]};return db[_0xecfc('0x47')][_0xecfc('0x70')]({'where':{'id':_0x57889f[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x2811ea,null))[_0xecfc('0x15')](function(_0x19ab28){if(_0x19ab28){_0x551038[_0xecfc('0x3e')]=_[_0xecfc('0x4c')](db[_0xecfc('0x75')][_0xecfc('0x48')]);_0x551038[_0xecfc('0x4b')]=_[_0xecfc('0x4c')](_0x57889f['query']);_0x551038['filters']=_['intersection'](_0x551038['model'],_0x551038[_0xecfc('0x4b')]);_0x48ab0f[_0xecfc('0x4f')]=_[_0xecfc('0x4e')](_0x551038[_0xecfc('0x3e')],qs[_0xecfc('0x50')](_0x57889f[_0xecfc('0x4b')][_0xecfc('0x50')]));_0x48ab0f[_0xecfc('0x4f')]=_0x48ab0f[_0xecfc('0x4f')][_0xecfc('0x5e')]?_0x48ab0f[_0xecfc('0x4f')]:_0x551038['model'];if(!_0x57889f[_0xecfc('0x4b')][_0xecfc('0x51')](_0xecfc('0x52'))){_0x48ab0f[_0xecfc('0x23')]=qs[_0xecfc('0x23')](_0x57889f[_0xecfc('0x4b')][_0xecfc('0x23')]);_0x48ab0f[_0xecfc('0x21')]=qs[_0xecfc('0x21')](_0x57889f['query'][_0xecfc('0x21')]);}_0x48ab0f[_0xecfc('0x53')]=qs[_0xecfc('0x54')](_0x57889f[_0xecfc('0x4b')]['sort']);_0x48ab0f[_0xecfc('0x55')]=qs[_0xecfc('0x4d')](_[_0xecfc('0x56')](_0x57889f[_0xecfc('0x4b')],_0x551038[_0xecfc('0x4d')]));_0x48ab0f[_0xecfc('0x55')][_0xecfc('0x6d')]=_0x19ab28['id'];if(_0x57889f[_0xecfc('0x4b')][_0xecfc('0x57')]){_0x48ab0f['where']=_[_0xecfc('0x58')](_0x48ab0f['where'],{'$or':_[_0xecfc('0x46')](_0x48ab0f[_0xecfc('0x4f')],function(_0x2b346e){var _0x7c906a={};_0x7c906a[_0x2b346e]={'$like':'%'+_0x57889f[_0xecfc('0x4b')]['filter']+'%'};return _0x7c906a;})});}_0x48ab0f=_['merge']({},_0x48ab0f,_0x57889f['options']);return db[_0xecfc('0x75')][_0xecfc('0x24')]({'where':_0x48ab0f[_0xecfc('0x55')]})[_0xecfc('0x15')](function(_0x569a83){_0x22126d['count']=_0x569a83;if(_0x57889f['query']['includeAll']){_0x48ab0f['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xecfc('0x71')](_0x48ab0f);})[_0xecfc('0x15')](function(_0x504eed){_0x22126d[_0xecfc('0x5b')]=_0x504eed;return _0x22126d;});}})[_0xecfc('0x15')](respondWithFilteredResult(_0x2811ea,_0x48ab0f))[_0xecfc('0x1c')](handleError(_0x2811ea,null));};exports[_0xecfc('0x76')]=function(_0xa0d3a,_0x264bf0){return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0xa0d3a['params']['id']}})['then'](handleEntityNotFound(_0x264bf0,null))[_0xecfc('0x15')](function(_0x76872a){if(_0x76872a){return _0x76872a[_0xecfc('0x76')](_0xa0d3a[_0xecfc('0x4b')][_0xecfc('0x73')]);}})[_0xecfc('0x15')](respondWithStatusCode(_0x264bf0,null))[_0xecfc('0x1c')](handleError(_0x264bf0,null));};exports[_0xecfc('0x77')]=function(_0x1c86e9,_0x50b2fa){_0x1c86e9[_0xecfc('0x61')][_0xecfc('0x78')]=_0x1c86e9[_0xecfc('0x79')]['filename'];return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0x1c86e9[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x50b2fa,null))[_0xecfc('0x15')](saveUpdates(_0x1c86e9[_0xecfc('0x61')],null))[_0xecfc('0x15')](respondWithResult(_0x50b2fa,null))[_0xecfc('0x1c')](handleError(_0x50b2fa,null));};exports['addAvatar']=function(_0x29d98f,_0x187310){_0x29d98f[_0xecfc('0x61')]['agentAvatar']=_0x29d98f[_0xecfc('0x79')][_0xecfc('0x7a')];return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0x29d98f[_0xecfc('0x5d')]['id']}})['then'](handleEntityNotFound(_0x187310,null))[_0xecfc('0x15')](saveUpdates(_0x29d98f[_0xecfc('0x61')],null))[_0xecfc('0x15')](respondWithResult(_0x187310,null))[_0xecfc('0x1c')](handleError(_0x187310,null));};exports[_0xecfc('0x7b')]=function(_0x432889,_0x5d081d){_0x432889[_0xecfc('0x61')][_0xecfc('0x7c')]=_0x432889[_0xecfc('0x79')][_0xecfc('0x7a')];return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0x432889[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x5d081d,null))[_0xecfc('0x15')](saveUpdates(_0x432889[_0xecfc('0x61')],null))[_0xecfc('0x15')](respondWithResult(_0x5d081d,null))[_0xecfc('0x1c')](handleError(_0x5d081d,null));};exports[_0xecfc('0x7d')]=function(_0x4d7713,_0x26bca4){_0x4d7713[_0xecfc('0x61')][_0xecfc('0x7e')]=_0x4d7713[_0xecfc('0x79')][_0xecfc('0x7a')];return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0x4d7713[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x26bca4,null))[_0xecfc('0x15')](saveUpdates(_0x4d7713['body'],null))[_0xecfc('0x15')](respondWithResult(_0x26bca4,null))[_0xecfc('0x1c')](handleError(_0x26bca4,null));};exports[_0xecfc('0x7f')]=function(_0x4492be,_0x4f6456){var _0x44c649=path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x82'));var _0x3251b9={'where':{'id':_0x4492be[_0xecfc('0x5d')]['id']},'attributes':['id',_0xecfc('0x78')],'raw':!![]};var _0x15b44f=![];return require(_0xecfc('0x83'))[_0xecfc('0x84')]()[_0xecfc('0x15')](function(_0x55a8aa){if(_0x55a8aa){_0x15b44f=_0x55a8aa[_0xecfc('0x85')];}})[_0xecfc('0x15')](function(){return db[_0xecfc('0x47')][_0xecfc('0x60')](_0x3251b9);})[_0xecfc('0x15')](handleEntityNotFound(_0x4f6456,null))[_0xecfc('0x15')](function(_0x1b66ad){if(_0x1b66ad){if(!_[_0xecfc('0x86')](_0x1b66ad[_0xecfc('0x78')])){if(fs[_0xecfc('0x87')](path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x88'),_0x1b66ad['sitepic']))&&_0x15b44f){_0x44c649=path[_0xecfc('0x80')](config[_0xecfc('0x81')],'server/files/images/logos/',_0x1b66ad[_0xecfc('0x78')]);}}return _0x4f6456['download'](_0x44c649);}})[_0xecfc('0x1c')](handleError(_0x4f6456,null));};exports[_0xecfc('0x89')]=function(_0x1c1c52,_0x46e0d1){var _0x1a9cc6=path['join'](config['root'],'server/files/images/avatars/default_avatar.png');var _0x45f68a={'where':{'id':_0x1c1c52['params']['id']},'attributes':['id',_0xecfc('0x8a')],'raw':!![]};return db[_0xecfc('0x47')]['find'](_0x45f68a)[_0xecfc('0x15')](handleEntityNotFound(_0x46e0d1,null))[_0xecfc('0x15')](function(_0x21093e){if(_0x21093e){if(!_[_0xecfc('0x86')](_0x21093e[_0xecfc('0x8a')])){if(fs[_0xecfc('0x87')](path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x8b'),_0x21093e[_0xecfc('0x8a')]))){_0x1a9cc6=path[_0xecfc('0x80')](config['root'],'server/files/images/avatars/',_0x21093e[_0xecfc('0x8a')]);}}return _0x46e0d1[_0xecfc('0x8c')](_0x1a9cc6);}})[_0xecfc('0x1c')](handleError(_0x46e0d1,null));};exports[_0xecfc('0x8d')]=function(_0x299b45,_0xd0e9a0){var _0x23fe25=path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x8e'));var _0xb87995={'where':{'id':_0x299b45[_0xecfc('0x5d')]['id']},'attributes':['id','customerAvatar',_0xecfc('0x8f')],'raw':!![]};return db[_0xecfc('0x47')]['find'](_0xb87995)['then'](handleEntityNotFound(_0xd0e9a0,null))[_0xecfc('0x15')](function(_0x4be8ad){if(_0x4be8ad){if(!_[_0xecfc('0x86')](_0x4be8ad[_0xecfc('0x7c')])){if(fs[_0xecfc('0x87')](path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x8b'),_0x4be8ad[_0xecfc('0x7c')]))&&_0x4be8ad[_0xecfc('0x8f')]){_0x23fe25=path[_0xecfc('0x80')](config['root'],_0xecfc('0x8b'),_0x4be8ad[_0xecfc('0x7c')]);}}return _0xd0e9a0[_0xecfc('0x8c')](_0x23fe25);}})[_0xecfc('0x1c')](handleError(_0xd0e9a0,null));};exports[_0xecfc('0x90')]=function(_0x21f34c,_0x1a2284){var _0x17f698=path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x91'));var _0x221f46={'where':{'id':_0x21f34c[_0xecfc('0x5d')]['id']},'attributes':['id',_0xecfc('0x7e')],'raw':!![]};return db[_0xecfc('0x47')][_0xecfc('0x60')](_0x221f46)['then'](handleEntityNotFound(_0x1a2284,null))[_0xecfc('0x15')](function(_0x480944){if(_0x480944){if(!_[_0xecfc('0x86')](_0x480944[_0xecfc('0x7e')])){if(fs['existsSync'](path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x8b'),_0x480944[_0xecfc('0x7e')]))){_0x17f698=path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0x8b'),_0x480944['systemAvatar']);}}return _0x1a2284[_0xecfc('0x8c')](_0x17f698);}})[_0xecfc('0x1c')](handleError(_0x1a2284,null));};function checkWebsiteInterval(_0x4c2d21){var _0xa4db28=_0x4c2d21[_0xecfc('0x92')];if(!_0xa4db28){return Promise[_0xecfc('0x93')](_0x4c2d21);}var _0x5adf73=_0x4c2d21[_0xecfc('0x94')]||undefined;return _0xa4db28[_0xecfc('0x95')](_0x5adf73)[_0xecfc('0x15')](function(_0x3240fd){if(!_0x3240fd){throw new APIOutOfIntervalError();}return _0x4c2d21;});}exports[_0xecfc('0x96')]=function(_0x2009a2,_0x3d299b){var _0x26fe81={'body':_0x2009a2[_0xecfc('0x61')],'channel':_0xecfc('0x97')};var _0x36c290=[];var _0x157bf7=[];var _0x4ee9c2={};var _0x34f252=![];if(_0x2009a2['body']['id']){delete _0x2009a2[_0xecfc('0x61')]['id'];}if(_[_0xecfc('0x86')](_0x2009a2[_0xecfc('0x61')][_0xecfc('0x98')])){throw new APIBadRequestError(_0xecfc('0x99'));}if(_[_0xecfc('0x86')](_0x2009a2[_0xecfc('0x61')][_0xecfc('0x9a')])){throw new APIBadRequestError(_0xecfc('0x9b'));}if(_[_0xecfc('0x9c')](_0x2009a2['body']['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x42b6f8=_0x2009a2[_0xecfc('0x61')]['customerIp']&&_0x2009a2['body']['referer'];return db[_0xecfc('0x9d')]['describe']()[_0xecfc('0x15')](function(_0x328612){if(!_0x328612){throw new Error(_0xecfc('0x9e'));}_0x36c290=Object['keys'](_0x328612)[_0xecfc('0x57')](function(_0x140ca9){return![_0xecfc('0x9f'),'updatedAt'][_0xecfc('0xa0')](_0x140ca9);});_0x157bf7=Object[_0xecfc('0x4c')](_0x328612)[_0xecfc('0x57')](function(_0x4f3687){return!['createdAt',_0xecfc('0xa1'),_0xecfc('0xa2'),_0xecfc('0xa3')]['includes'](_0x4f3687);});if(!_['includes'](_0x157bf7,_0x2009a2['body']['mapKey'])){throw new APIBadRequestError(_0xecfc('0xa4')+_0x157bf7[_0xecfc('0x80')](',\x20'));}_0x4ee9c2[_0x2009a2[_0xecfc('0x61')][_0xecfc('0x9a')]]=_0x2009a2[_0xecfc('0x61')]['from'];})[_0xecfc('0x15')](function(){return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0x2009a2[_0xecfc('0x5d')]['id']},'include':[{'model':db[_0xecfc('0xa5')],'as':_0xecfc('0xa6'),'include':[{'model':db['CmContact'],'as':_0xecfc('0xa7'),'where':_0x4ee9c2,'limit':0x1,'order':[[_0xecfc('0xa1'),_0xecfc('0xa8')]]}]},{'model':db[_0xecfc('0xa9')],'as':_0xecfc('0xaa')},{'model':db[_0xecfc('0x92')],'as':_0xecfc('0x92'),'include':[{'model':db[_0xecfc('0x92')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]});})['then'](function(_0x492f5f){if(!_0x492f5f){throw new APINotFoundError(util[_0xecfc('0x3a')](_0xecfc('0xab'),_0x2009a2['params']['id']));}if(_0x42b6f8){return checkWebsiteInterval(_0x492f5f);}return _0x492f5f;})['then'](function(_0x6cee5f){_0x26fe81[_0xecfc('0xac')]=_0x6cee5f;_0x26fe81[_0xecfc('0xad')]=_[_0xecfc('0xae')](_0x6cee5f[_0xecfc('0xaa')],['priority'],[_0xecfc('0xaf')]);if(_0x26fe81[_0xecfc('0xac')][_0xecfc('0xaa')]){delete _0x26fe81[_0xecfc('0xac')][_0xecfc('0xaa')];}_0x26fe81[_0xecfc('0xb0')]=_0x6cee5f['List']||{'id':_0x6cee5f[_0xecfc('0xa3')]};if(_0x26fe81[_0xecfc('0xb0')]&&_0x26fe81['list'][_0xecfc('0xa7')][_0xecfc('0x5e')]){return _0x26fe81[_0xecfc('0xb0')][_0xecfc('0xa7')][0x0];}var _0x2b84c7=_[_0xecfc('0xb1')](_0x2009a2[_0xecfc('0x61')],{'firstName':_0x2009a2['body'][_0xecfc('0x98')],'ListId':_0x6cee5f[_0xecfc('0xa3')]});_0x2b84c7[_0x2009a2[_0xecfc('0x61')][_0xecfc('0x9a')]]=_0x2009a2[_0xecfc('0x61')][_0xecfc('0x98')];return db[_0xecfc('0x9d')]['create'](_0x2b84c7,{'fields':_0x36c290,'raw':!![]});})[_0xecfc('0x15')](function(_0x4a7e48){_0x26fe81[_0xecfc('0xb2')]=_0x4a7e48;var _0x16fb89=createInteractionObject(_0x2009a2['params']['id'],_0x2009a2['body'],_0x2009a2[_0xecfc('0xb3')],_0x4a7e48);var _0x30ce1a={'ChatWebsiteId':_0x2009a2[_0xecfc('0x5d')]['id']};if(_0x2009a2[_0xecfc('0x61')][_0xecfc('0xb4')]){_0x30ce1a[_0xecfc('0xb4')]=_0x2009a2['body'][_0xecfc('0xb4')];_0x30ce1a[_0xecfc('0xb5')]=![];return db[_0xecfc('0xb6')][_0xecfc('0x60')]({'where':_0x30ce1a})[_0xecfc('0x15')](function(_0x471d40){var _0x49c966=_0x2009a2[_0xecfc('0x61')]['customerIp']&&_0x2009a2[_0xecfc('0x61')][_0xecfc('0xb7')];if(_0x471d40){_0x34f252=!![];return _0x471d40;}else if(!_0x49c966&&_0x471d40&&_0x471d40['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x16fb89[_0xecfc('0xb4')]=_0x2009a2['body']['threadId'];_0x16fb89[_0xecfc('0xb8')]=_0x2009a2[_0xecfc('0x61')][_0xecfc('0xb8')];return db['ChatInteraction'][_0xecfc('0x63')](_0x16fb89);});}_0x30ce1a[_0xecfc('0xb9')]=_0x4a7e48['id'];if(_0x2009a2[_0xecfc('0x61')][_0xecfc('0xba')]&&_0x2009a2[_0xecfc('0x61')][_0xecfc('0xba')]['id']){_0x30ce1a['id']=_0x2009a2[_0xecfc('0x61')]['interaction']['id'];return db[_0xecfc('0xb6')]['find']({'where':_0x30ce1a})[_0xecfc('0x15')](function(_0x4cc980){var _0x1a246b=_0x2009a2['body'][_0xecfc('0x31')]&&_0x2009a2[_0xecfc('0x61')][_0xecfc('0xb7')];if(!_0x1a246b&&_0x4cc980&&_0x4cc980[_0xecfc('0xb5')]){throw new APIConflictError(_0xecfc('0xbb'));}else if(_0x4cc980){_0x34f252=!![];return _0x4cc980;}else{return db[_0xecfc('0xb6')][_0xecfc('0x63')](_0x16fb89);}});}return db[_0xecfc('0xb6')][_0xecfc('0x63')](_0x16fb89);})[_0xecfc('0x15')](function(_0x383c21){if(!_0x34f252){return _0x383c21;}var _0x3cd7c3={'from':(_0x26fe81[_0xecfc('0xb2')][_0xecfc('0x35')]||'')+'\x20'+(_0x26fe81[_0xecfc('0xb2')][_0xecfc('0x36')]||'')};if(_0x2009a2['body'][_0xecfc('0xb4')]&&_0x2009a2[_0xecfc('0x61')]['messageId']&&_0x2009a2[_0xecfc('0x61')][_0xecfc('0xb4')]!=_0x2009a2[_0xecfc('0x61')][_0xecfc('0xbc')]){_0x3cd7c3['threadId']=_0x2009a2[_0xecfc('0x61')][_0xecfc('0xbc')];}return _0x383c21[_0xecfc('0x6a')](_0x3cd7c3);})[_0xecfc('0x15')](function(_0x18f8b8){_0x26fe81[_0xecfc('0xba')]=_0x18f8b8[_0xecfc('0x28')]({'plain':!![]});_0x26fe81[_0xecfc('0xba')][_0xecfc('0xbd')]=!_0x34f252;if(_0x26fe81[_0xecfc('0xba')][_0xecfc('0xbd')]){if(_0x26fe81[_0xecfc('0xac')][_0xecfc('0xbe')]){_0x26fe81[_0xecfc('0xad')]['push']({'id':0x0,'priority':_0x26fe81[_0xecfc('0xad')][_0xecfc('0x5e')]+0x1,'app':_0xecfc('0xbf'),'appdata':_0xecfc('0xc0'),'interval':_0xecfc('0xc1')});}}return db[_0xecfc('0xc2')][_0xecfc('0x63')]({'body':_0x2009a2[_0xecfc('0x61')]['body'],'ChatWebsiteId':_0x2009a2[_0xecfc('0x5d')]['id'],'ChatInteractionId':_0x18f8b8['id'],'direction':'in','ContactId':_0x26fe81[_0xecfc('0xb2')]['id'],'AttachmentId':_0x2009a2[_0xecfc('0x61')][_0xecfc('0xc3')]});})[_0xecfc('0x15')](function(_0x42b0b7){_0x26fe81[_0xecfc('0x1b')]=_0x42b0b7;if(!_0x26fe81['interaction'][_0xecfc('0xc4')]){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x26fe81[_0xecfc('0xba')]['UserId']}});})['then'](function(_0x49abf9){if(_0x49abf9){_0x26fe81['applications'][_0xecfc('0xc5')]({'id':0x0,'priority':0x0,'app':_0xecfc('0xc6'),'appdata':_0x49abf9[_0xecfc('0x2c')]+','+(_0x26fe81[_0xecfc('0xac')][_0xecfc('0xc7')]||0xa),'interval':'*,*,*,*'});_0x26fe81[_0xecfc('0xc8')]=!![];}if(!_0x26fe81['interaction'][_0xecfc('0xc9')]){return;}return db[_0xecfc('0xca')]['find']({'attributes':['id',_0xecfc('0x2c')],'where':{'id':_0x26fe81[_0xecfc('0xba')][_0xecfc('0xc9')]}});})['then'](function(_0x2f5515){if(_0x2f5515){_0x26fe81[_0xecfc('0xad')][_0xecfc('0xc5')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2f5515[_0xecfc('0x2c')]+','+(_0x26fe81[_0xecfc('0xac')][_0xecfc('0xcb')]||0x12c),'interval':_0xecfc('0xc1')});}return respondWithRpcPromise('Start',_0xecfc('0xcc'),_0x26fe81);})[_0xecfc('0x15')](function(_0x20f982){respondWithRpcPromise('EventManager','EventManager',{'event':_0xecfc('0x96'),'message':_0x20f982},client9002);return _0x20f982;})[_0xecfc('0x15')](respondWithResult(_0x3d299b,null))[_0xecfc('0x1c')](APIHandleError(_0x3d299b));};exports[_0xecfc('0xcd')]=function(_0x20d59e,_0x518520){var _0x1928f5,_0x3a67fb,_0x4b88fe;var _0x5e05ba=[];var _0x156132={};var _0x38aa84=_0x20d59e['files']||[];var _0x55df0d=[];var _0x2db4d1;return db[_0xecfc('0x9d')][_0xecfc('0x6c')]()[_0xecfc('0x15')](function(_0x541895){if(!_0x541895){throw new db[(_0xecfc('0xce'))][(_0xecfc('0xcf'))](_0xecfc('0xd0'));}_0x5e05ba=_[_0xecfc('0xd1')](_[_0xecfc('0x4c')](_0x541895),['createdAt',_0xecfc('0xa1'),_0xecfc('0xa2'),_0xecfc('0xa3')]);if(_0x20d59e[_0xecfc('0x61')]['id']){delete _0x20d59e[_0xecfc('0x61')]['id'];}if(_[_0xecfc('0x86')](_0x20d59e[_0xecfc('0x61')][_0xecfc('0x98')])){throw _0x518520[_0xecfc('0x1e')](0x1f4)['send'](new db[(_0xecfc('0xce'))]['ValidationError'](_0xecfc('0xd2')));}if(_[_0xecfc('0x86')](_0x20d59e[_0xecfc('0x61')][_0xecfc('0x61')])||_0x20d59e['body'][_0xecfc('0x61')]===''){throw _0x518520['status'](0x1f4)[_0xecfc('0xd3')](new db[(_0xecfc('0xce'))]['ValidationError'](_0xecfc('0xd4')));}if(_[_0xecfc('0x86')](_0x20d59e['body']['mapKeyOffline'])){throw _0x518520[_0xecfc('0x1e')](0x1f4)['send'](new db[(_0xecfc('0xce'))][(_0xecfc('0xcf'))](_0xecfc('0xd5')+_0x5e05ba));}if(!_[_0xecfc('0xa0')](_0x5e05ba,_0x20d59e[_0xecfc('0x61')][_0xecfc('0xd6')])){throw _0x518520[_0xecfc('0x1e')](0x1f4)[_0xecfc('0xd3')](new db[(_0xecfc('0xce'))][(_0xecfc('0xcf'))](_0xecfc('0xd7')+_0x5e05ba));}_0x156132[_0x20d59e[_0xecfc('0x61')][_0xecfc('0xd6')]]=_0x20d59e[_0xecfc('0x61')][_0xecfc('0x98')];})[_0xecfc('0x15')](function(){return db[_0xecfc('0x47')][_0xecfc('0x60')]({'where':{'id':_0x20d59e['params']['id']},'include':[{'model':db[_0xecfc('0xa5')],'as':_0xecfc('0xa6')},{'model':db[_0xecfc('0xd8')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x518520,null))[_0xecfc('0x15')](function(_0x3fe02b){if(_0x3fe02b&&_0x3fe02b[_0xecfc('0xa6')]){_0x3a67fb=_0x3fe02b;var _0x373901=_[_0xecfc('0xb1')](_0x20d59e[_0xecfc('0x61')],{'firstName':_0x20d59e['body']['from'],'phone':_0x20d59e[_0xecfc('0x61')][_0xecfc('0x98')],'ListId':_0x3fe02b['ListId']});_0x373901[_0x20d59e['body']['mapKeyOffline']]=_0x20d59e[_0xecfc('0x61')][_0xecfc('0x98')];return db[_0xecfc('0x9d')][_0xecfc('0xd9')]({'where':_0x156132,'defaults':_0x373901});}})['spread'](function(_0x24a39b){if(_0x24a39b){_0x4b88fe=_0x24a39b;var _0x277b8f=fs[_0xecfc('0xda')](path[_0xecfc('0x80')](config['root'],_0xecfc('0xdb')),_0xecfc('0xdc'));var _0x48e2a2=ejs['render'](_0x277b8f,{'body':_[_0xecfc('0xdd')](_0x20d59e[_0xecfc('0x61')][_0xecfc('0x61')]),'bodyTitle':_0x3a67fb['offlineMessageBody']});return db[_0xecfc('0xde')]['create']({'body':_0x48e2a2,'plainBody':htmlToText['fromString'](_0x48e2a2),'ContactId':_0x24a39b['id'],'ChatWebsiteId':_0x3a67fb['id']});}})[_0xecfc('0x15')](function(_0x4d0609){_0x2db4d1=_0x4d0609;if(_0x38aa84[_0xecfc('0x5e')]){var _0x1a5629=_0x38aa84['map'](function(_0x42f136){return{'name':_0x42f136[_0xecfc('0xdf')],'basename':_0x42f136[_0xecfc('0x7a')],'type':_0x42f136[_0xecfc('0xe0')],'ChatOfflineMessageId':_0x4d0609['id']};});_0x55df0d=_0x1a5629[_0xecfc('0x46')](_0x1a89a5=>{var _0x2a5053={'filename':_0x1a89a5[_0xecfc('0x2c')],'path':path['join'](config[_0xecfc('0x81')],_0xecfc('0xe1'),_0xecfc('0xe2'),_0xecfc('0xe3'),_0xecfc('0xe4'),_0x1a89a5[_0xecfc('0xe5')])};return _0x2a5053;});if(!_0x3a67fb[_0xecfc('0xe6')]){return db[_0xecfc('0xe7')]['transaction'](function(_0x52bf92){return db['Attachment'][_0xecfc('0xe8')](_0x1a5629,{'transaction':_0x52bf92});});}}})[_0xecfc('0x15')](function(){if(_0x2db4d1){_0x1928f5=_0x2db4d1;return db[_0xecfc('0xd8')][_0xecfc('0x70')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xecfc('0xe9'),'raw':!![],'include':[{'model':db[_0xecfc('0xea')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xecfc('0x15')](function(_0x35055f){if(_0x35055f&&_0x35055f[_0xecfc('0xe9')]&&_0x3a67fb[_0xecfc('0xeb')]&&_0x3a67fb[_0xecfc('0xec')]){var _0x42d33d=_0x35055f[_0xecfc('0xed')]();return respondWithRpcPromise(_0xecfc('0xee'),_0xecfc('0xef'),{'account':_0x42d33d,'message':{'from':util['format'](_0xecfc('0xf0'),_0x35055f[_0xecfc('0x2c')],_0x35055f[_0xecfc('0xf1')]||_0x35055f['Smtp']['user']),'to':_0x3a67fb[_0xecfc('0xec')],'subject':_0x3a67fb[_0xecfc('0xf2')],'html':_0x1928f5['body'],'attachments':_0x55df0d}},client9003)[_0xecfc('0x15')](function(){return _0x1928f5;})['catch'](function(_0x3c2993){logger[_0xecfc('0x1a')](_0x3c2993);});}})[_0xecfc('0x15')](function(){if(_0x3a67fb&&_0x3a67fb['openNewInteraction']&&_0x3a67fb[_0xecfc('0xf3')]){var _0xcdc2bd=[];if(_0x38aa84['length']){_0xcdc2bd=_0x38aa84['map'](function(_0x384aa0){return{'name':_0x384aa0['originalname'],'basename':_0x384aa0[_0xecfc('0x7a')],'type':_0x384aa0[_0xecfc('0xe0')],'ChatOfflineMessageId':_0x2db4d1['id']};});}var _0x3ac5ee;if(!_[_0xecfc('0x86')](_0x3a67fb[_0xecfc('0xf4')])){var _0x406fa5=_[_0xecfc('0x46')](_0x20d59e[_0xecfc('0x61')],function(_0x2e92c3){return _0x2e92c3;});var _0x1f57b6=_[_0xecfc('0xf5')](_0x406fa5)[0x0];var _0x17b9f3=_[_0xecfc('0xf6')](_0x1f57b6,function(_0x55e97e){return _0x55e97e;});_0x3ac5ee=_0x17b9f3[0x1][_0x3a67fb[_0xecfc('0xf4')]];}var _0x4472eb={'from':_0x4b88fe[_0xecfc('0xf1')],'firstName':_0x4b88fe[_0xecfc('0x35')],'lastName':_0x4b88fe[_0xecfc('0x36')],'mapKey':_0xecfc('0xf1'),'message':{'from':_0x4b88fe[_0xecfc('0xf1')],'to':_0x3a67fb[_0xecfc('0xd8')]['email'],'cc':'','subject':_[_0xecfc('0x86')](_0x3ac5ee)?_0x3a67fb[_0xecfc('0xf2')]:_0x3ac5ee,'messageId':'','sentAt':new Date(),'attach':_0xcdc2bd[_0xecfc('0x5e')],'attachments':_0xcdc2bd,'originChannel':'Chat','ChatWebsiteId':_0x3a67fb['id'],'ChatOfflineMessageId':_0x1928f5['id'],'originTo':_0x3a67fb[_0xecfc('0xd8')][_0xecfc('0xf1')]},'body':_0x1928f5[_0xecfc('0x61')]};var _0x3e6edc={'account':{'id':_0x3a67fb[_0xecfc('0xf3')]},'body':_0x4472eb,'log':_0xecfc('0xf7')};return respondWithRpcPromise('NotifyMailAccount',_0xecfc('0xf8'),_0x3e6edc,client9001)['then'](function(){return _0x1928f5;})['catch'](function(_0x30da41){logger[_0xecfc('0x1a')](_0x30da41);});}return;})['then'](function(){if(_0x1928f5){return _0x1928f5;}})['then'](respondWithResult(_0x518520,null))['catch'](function(){for(var _0x347d17 of _0x38aa84){var _0x551f50=path[_0xecfc('0x80')](config[_0xecfc('0x81')],_0xecfc('0xe1'),_0xecfc('0xe2'),_0xecfc('0xe3'),_0xecfc('0xe4'),_0x347d17[_0xecfc('0x7a')]);fs_extra[_0xecfc('0xf9')](_0x551f50)[_0xecfc('0x1c')](function(_0x2ce679){logger[_0xecfc('0x1a')](_0xecfc('0xfa'),_0x551f50,_0x2ce679);});}});};exports[_0xecfc('0xfb')]=function(_0x3c761e,_0x12b973){return db['ChatInteraction'][_0xecfc('0x60')]({'where':{'id':_0x3c761e[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x12b973,null))[_0xecfc('0x15')](function(_0x4f3162){if(_0x4f3162){return _0x4f3162[_0xecfc('0xfb')](_0x3c761e[_0xecfc('0x61')][_0xecfc('0x73')],_['omit'](_0x3c761e['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x12b973,null))['catch'](handleError(_0x12b973,null));};exports[_0xecfc('0xfc')]=function(_0x3b27ca,_0xc20cb2){var _0x35fb2f={'raw':![],'where':{}};var _0x3d83b9={};var _0x244268={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xecfc('0x70')]({'where':{'id':_0x3b27ca[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0xc20cb2,null))[_0xecfc('0x15')](function(_0x70804a){if(_0x70804a){_0x3d83b9['model']=_[_0xecfc('0x4c')](db[_0xecfc('0xb6')][_0xecfc('0x48')]);_0x3d83b9['query']=_['keys'](_0x3b27ca[_0xecfc('0x4b')]);_0x3d83b9[_0xecfc('0x4d')]=_[_0xecfc('0x4e')](_0x3d83b9[_0xecfc('0x3e')],_0x3d83b9[_0xecfc('0x4b')]);_0x35fb2f[_0xecfc('0x4f')]=_[_0xecfc('0x4e')](_0x3d83b9[_0xecfc('0x3e')],qs[_0xecfc('0x50')](_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x50')]));_0x35fb2f['attributes']=_0x35fb2f[_0xecfc('0x4f')][_0xecfc('0x5e')]?_0x35fb2f[_0xecfc('0x4f')]:_0x3d83b9['model'];if(!_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x51')](_0xecfc('0x52'))){_0x35fb2f[_0xecfc('0x23')]=qs['limit'](_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x23')]);_0x35fb2f[_0xecfc('0x21')]=qs[_0xecfc('0x21')](_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x21')]);}_0x35fb2f[_0xecfc('0x53')]=qs[_0xecfc('0x54')](_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x54')]);_0x35fb2f[_0xecfc('0x55')]=qs['filters'](_['pick'](_0x3b27ca[_0xecfc('0x4b')],_0x3d83b9['filters']));_0x35fb2f[_0xecfc('0x55')]['ChatWebsiteId']=_0x70804a['id'];if(_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x57')]){_0x35fb2f[_0xecfc('0x55')]=_[_0xecfc('0x58')](_0x35fb2f['where'],{'$or':_[_0xecfc('0x46')](_0x35fb2f[_0xecfc('0x4f')],function(_0x439c6b){var _0x412efa={};_0x412efa[_0x439c6b]={'$like':'%'+_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x57')]+'%'};return _0x412efa;})});}_0x35fb2f=_['merge']({},_0x35fb2f,_0x3b27ca[_0xecfc('0x5f')]);return db[_0xecfc('0xb6')][_0xecfc('0x24')]({'where':_0x35fb2f[_0xecfc('0x55')]})[_0xecfc('0x15')](function(_0x1af69f){_0x244268[_0xecfc('0x24')]=_0x1af69f;if(_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x59')]){_0x35fb2f[_0xecfc('0x5a')]=[{'model':db[_0xecfc('0x9d')],'as':_0xecfc('0xfd'),'required':![]},{'model':db['User'],'as':_0xecfc('0xfe'),'attributes':[_0xecfc('0x2c'),_0xecfc('0xff'),_0xecfc('0x100')],'required':![]},{'model':db[_0xecfc('0x101')],'as':_0xecfc('0x102'),'attributes':['id','name','color'],'where':_0x3b27ca[_0xecfc('0x4b')]['tag']?{'id':_0x3b27ca[_0xecfc('0x4b')]['tag']}:undefined,'required':_0x3b27ca[_0xecfc('0x4b')][_0xecfc('0x103')]?!![]:![]}];}return db[_0xecfc('0xb6')][_0xecfc('0x71')](_0x35fb2f);})[_0xecfc('0x15')](function(_0x30d621){_0x244268[_0xecfc('0x5b')]=_0x30d621;return _0x244268;});}})[_0xecfc('0x15')](respondWithFilteredResult(_0xc20cb2,_0x35fb2f))[_0xecfc('0x1c')](handleError(_0xc20cb2,null));};exports[_0xecfc('0x104')]=function(_0x239dc8,_0x1a319c){var _0x47686e=0x0;var _0x10d3fc=0x0;var _0x2fdc18=![];var _0x159f48;var _0x357421;return db[_0xecfc('0x47')]['find']({'where':{'id':_0x239dc8[_0xecfc('0x5d')]['id']},'include':[{'model':db['Interval'],'as':_0xecfc('0x92'),'include':[{'model':db[_0xecfc('0x92')],'as':_0xecfc('0x105'),'attributes':['id',_0xecfc('0x106')]}]}]})[_0xecfc('0x15')](handleEntityNotFound(_0x1a319c,null))[_0xecfc('0x15')](function(_0x2909d6){if(_0x2909d6){_0x159f48=_0x2909d6;return _0x2909d6['getProactiveActions']({'raw':!![]});}})[_0xecfc('0x15')](function(_0x4098e4){if(_0x159f48){if(_0x4098e4){_0x357421=_0x4098e4;}}return require('../../config/license/util')[_0xecfc('0x84')]();})['then'](function(_0x56c7ea){if(_0x56c7ea){_0x10d3fc=_0x56c7ea[_0xecfc('0x107')];_0x2fdc18=_0x56c7ea[_0xecfc('0x85')];}})[_0xecfc('0x15')](function(){return db[_0xecfc('0xb6')]['count']({'where':{'closed':![]}});})['then'](function(_0x4c2b43){_0x47686e=_0x4c2b43;if(_0x10d3fc&&_0x4c2b43>_0x10d3fc){return db['License']['findOne']({'where':{'id':0x1}})[_0xecfc('0x15')](function(_0x4505d4){if(_0x4505d4){_0x4505d4['increment'](_0xecfc('0x108'));}});}})[_0xecfc('0x15')](function(){var _0x55c011=_0x159f48[_0xecfc('0x92')];var _0x15f9d0=_0x159f48[_0xecfc('0x94')]||undefined;return _0x55c011?_0x55c011[_0xecfc('0x95')](_0x15f9d0):!![];})[_0xecfc('0x15')](function(_0x58ba8e){var _0x1c652c=fs[_0xecfc('0xda')](path['join'](config[_0xecfc('0x81')],_0xecfc('0x109')),_0xecfc('0xdc'));var _0xb6dbfe=_0xecfc('0x10a');var _0x5c26a0=![];try{const _0x45b6e3=new URL(_0x159f48[_0xecfc('0x62')]);_0x159f48[_0xecfc('0x62')]=_0x45b6e3[_0xecfc('0x10b')];}catch(_0x35dc73){}var _0x168357;if(_0x239dc8[_0xecfc('0xb3')][_0xecfc('0xb7')]){_0x239dc8[_0xecfc('0xb3')][_0xecfc('0xb7')]=_0x239dc8['headers'][_0xecfc('0xb7')][_0xecfc('0x10c')](/\/$/,'');_0x168357=wildcardUtils[_0xecfc('0x10d')](_0x159f48[_0xecfc('0x62')],_0x239dc8[_0xecfc('0xb3')][_0xecfc('0xb7')]);}else{_0x239dc8['headers']['referer']=_0x159f48['address'];_0x168357=!![];}var _0x1e807e={'chatVersion':_0xb6dbfe,'chatWebsiteAddressOrigin':_0x168357?_0x239dc8[_0xecfc('0xb3')][_0xecfc('0xb7')]:_0x159f48[_0xecfc('0x62')],'remote':_0x159f48[_0xecfc('0x10e')],'query':querystring['stringify'](_['merge'](_0x159f48[_0xecfc('0x28')]({'plain':!![]}),{'customerIp':_0x239dc8[_0xecfc('0xb3')][_0xecfc('0x33')]||_0x239dc8[_0xecfc('0xb3')]['x-real-ip']||_0x239dc8[_0xecfc('0x10f')][_0xecfc('0x110')]||_0x239dc8['ip'],'referer':_0x239dc8[_0xecfc('0xb3')][_0xecfc('0xb7')],'openedInteractions':_0x47686e,'maxInteractions':_0x10d3fc,'virtual':_0x2fdc18[_0xecfc('0x107')],'online':_0x58ba8e,'custom':_0x2fdc18,'address':_0x168357?_0x239dc8[_0xecfc('0xb3')][_0xecfc('0xb7')]:null}))[_0xecfc('0x10c')](/'/g,'\x5c\x27')};_0x1a319c[_0xecfc('0xd3')](ejs[_0xecfc('0x111')](Mustache[_0xecfc('0x111')](_0x1c652c,_0x1e807e),{'proactiveActions':_0x357421,'alignment':_0x159f48[_0xecfc('0x112')],'verticalAlignment':_0x159f48[_0xecfc('0x113')],'div_color':_0x159f48[_0xecfc('0x114')],'labelText':_0x159f48['labelText'],'text_color':_0x159f48[_0xecfc('0x115')],'text_button_color':_0x159f48[_0xecfc('0x116')],'button_color':_0x159f48['color_button'],'background_color':_0x159f48[_0xecfc('0x117')],'hideWhenOffline':_0x159f48[_0xecfc('0x118')],'intervalId':_0x159f48['IntervalId'],'isDevelopment':_0x5c26a0,'chatVersion':_0xb6dbfe}));})[_0xecfc('0x1c')](handleError(_0x1a319c,null));};exports[_0xecfc('0x119')]=function(_0x1993d0,_0x4ea016){var _0x35cdc0=_0x1993d0[_0xecfc('0x5d')]['id'];var _0x342f4c=_0x1993d0['body'];var _0x2ad29c=0xc8;var _0xbecb73=null;return db[_0xecfc('0xe7')][_0xecfc('0x11a')]({'isolationLevel':db[_0xecfc('0xe7')][_0xecfc('0x11b')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x122978){return db[_0xecfc('0x47')][_0xecfc('0x70')]({'where':{'id':_0x35cdc0},'transaction':_0x122978})[_0xecfc('0x15')](function(_0x50ca33){if(_0x50ca33){return db[_0xecfc('0xa9')][_0xecfc('0x27')]({'where':{'ChatWebsiteId':_0x35cdc0},'transaction':_0x122978})[_0xecfc('0x15')](function(){var _0x5ac590=_[_0xecfc('0x46')](_0x342f4c,function(_0x426032){_0x426032[_0xecfc('0x6d')]=_0x35cdc0;return _0x426032;});return db[_0xecfc('0xa9')][_0xecfc('0xe8')](_0x5ac590,{'transaction':_0x122978});});}else{_0x2ad29c=0x194;_0xbecb73=[];}});})[_0xecfc('0x15')](function(){if(_0x2ad29c!==0x194){return db['ChatApplication'][_0xecfc('0x11c')]({'where':{'ChatWebsiteId':_0x35cdc0},'order':_0xecfc('0x11d')})[_0xecfc('0x15')](function(_0x33c2ab){_0xbecb73=_0x33c2ab;});}})[_0xecfc('0x1c')](function(_0x2405b4){_0x2ad29c=0x1f4;logger[_0xecfc('0x1a')](_0x2405b4[_0xecfc('0x2b')]);if(_0x2405b4[_0xecfc('0x2c')]){delete _0x2405b4[_0xecfc('0x2c')];}_0xbecb73=_0x2405b4;})[_0xecfc('0x11e')](function(){if(_0xbecb73===null){_0x4ea016[_0xecfc('0x1d')](_0x2ad29c);}else{if(_0x2ad29c===0x1f4){_0x4ea016[_0xecfc('0x1e')](_0x2ad29c)[_0xecfc('0xd3')](_0xbecb73);}else{_0x4ea016[_0xecfc('0x1e')](_0x2ad29c)[_0xecfc('0x20')](_0xbecb73);}}});};exports[_0xecfc('0x11f')]=function(_0x30d0aa,_0x34f345){var _0x396bb1={};var _0x364a4e={};var _0x5a916b;var _0x5b15b0;return db['ChatWebsite'][_0xecfc('0x70')]({'where':{'id':_0x30d0aa[_0xecfc('0x5d')]['id']}})['then'](handleEntityNotFound(_0x34f345,null))[_0xecfc('0x15')](function(_0x2bfc22){if(_0x2bfc22){_0x5a916b=_0x2bfc22;_0x364a4e[_0xecfc('0x3e')]=_[_0xecfc('0x4c')](db[_0xecfc('0xa9')][_0xecfc('0x48')]);_0x364a4e[_0xecfc('0x4b')]=_[_0xecfc('0x4c')](_0x30d0aa[_0xecfc('0x4b')]);_0x364a4e[_0xecfc('0x4d')]=_[_0xecfc('0x4e')](_0x364a4e[_0xecfc('0x3e')],_0x364a4e[_0xecfc('0x4b')]);_0x396bb1['attributes']=_[_0xecfc('0x4e')](_0x364a4e['model'],qs['fields'](_0x30d0aa[_0xecfc('0x4b')][_0xecfc('0x50')]));_0x396bb1[_0xecfc('0x4f')]=_0x396bb1[_0xecfc('0x4f')]['length']?_0x396bb1[_0xecfc('0x4f')]:_0x364a4e['model'];_0x396bb1['order']=qs['sort'](_0x30d0aa['query'][_0xecfc('0x54')]);_0x396bb1[_0xecfc('0x55')]=qs[_0xecfc('0x4d')](_[_0xecfc('0x56')](_0x30d0aa[_0xecfc('0x4b')],_0x364a4e[_0xecfc('0x4d')]));if(_0x30d0aa[_0xecfc('0x4b')][_0xecfc('0x57')]){_0x396bb1[_0xecfc('0x55')]=_[_0xecfc('0x58')](_0x396bb1['where'],{'$or':_[_0xecfc('0x46')](_0x396bb1[_0xecfc('0x4f')],function(_0x38a24c){var _0x2e3ce8={};_0x2e3ce8[_0x38a24c]={'$like':'%'+_0x30d0aa[_0xecfc('0x4b')][_0xecfc('0x57')]+'%'};return _0x2e3ce8;})});}_0x396bb1=_[_0xecfc('0x58')]({},_0x396bb1,_0x30d0aa[_0xecfc('0x5f')]);return _0x5a916b[_0xecfc('0x11f')](_0x396bb1);}})['then'](function(_0x2b44af){if(_0x2b44af){_0x5b15b0=_0x2b44af[_0xecfc('0x5e')];if(!_0x30d0aa[_0xecfc('0x4b')][_0xecfc('0x51')](_0xecfc('0x52'))){_0x396bb1['limit']=qs[_0xecfc('0x23')](_0x30d0aa['query'][_0xecfc('0x23')]);_0x396bb1[_0xecfc('0x21')]=qs[_0xecfc('0x21')](_0x30d0aa[_0xecfc('0x4b')]['offset']);}return _0x5a916b[_0xecfc('0x11f')](_0x396bb1);}})[_0xecfc('0x15')](function(_0xaeb550){if(_0xaeb550){return _0xaeb550?{'count':_0x5b15b0,'rows':_0xaeb550}:null;}})[_0xecfc('0x15')](respondWithResult(_0x34f345,null))['catch'](handleError(_0x34f345,null));};exports['addProactiveActions']=function(_0x31b0b1,_0xfc8115){return db[_0xecfc('0x120')]['find']({'where':{'id':_0x31b0b1[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0xfc8115,null))['then'](function(_0x5957cc){if(_0x5957cc){return _0x5957cc[_0xecfc('0x121')](_0x31b0b1[_0xecfc('0x61')][_0xecfc('0x73')],_[_0xecfc('0x122')](_0x31b0b1['body'],['ids','id'])||{});}})[_0xecfc('0x15')](respondWithResult(_0xfc8115,null))[_0xecfc('0x1c')](handleError(_0xfc8115,null));};exports[_0xecfc('0x123')]=function(_0x234a9e,_0x29dcb1){var _0x14da84={};var _0x3876a6={};var _0x280c7e;var _0x353f19;return db['ChatWebsite']['findOne']({'where':{'id':_0x234a9e['params']['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x29dcb1,null))[_0xecfc('0x15')](function(_0x16c867){if(_0x16c867){_0x280c7e=_0x16c867;_0x3876a6[_0xecfc('0x3e')]=_[_0xecfc('0x4c')](db['ChatProactiveAction'][_0xecfc('0x48')]);_0x3876a6[_0xecfc('0x4b')]=_[_0xecfc('0x4c')](_0x234a9e[_0xecfc('0x4b')]);_0x3876a6[_0xecfc('0x4d')]=_[_0xecfc('0x4e')](_0x3876a6['model'],_0x3876a6[_0xecfc('0x4b')]);_0x14da84[_0xecfc('0x4f')]=_[_0xecfc('0x4e')](_0x3876a6['model'],qs[_0xecfc('0x50')](_0x234a9e['query']['fields']));_0x14da84['attributes']=_0x14da84['attributes']['length']?_0x14da84[_0xecfc('0x4f')]:_0x3876a6[_0xecfc('0x3e')];_0x14da84[_0xecfc('0x53')]=qs['sort'](_0x234a9e[_0xecfc('0x4b')][_0xecfc('0x54')]);_0x14da84[_0xecfc('0x55')]=qs[_0xecfc('0x4d')](_[_0xecfc('0x56')](_0x234a9e[_0xecfc('0x4b')],_0x3876a6[_0xecfc('0x4d')]));if(_0x234a9e[_0xecfc('0x4b')][_0xecfc('0x57')]){_0x14da84[_0xecfc('0x55')]=_[_0xecfc('0x58')](_0x14da84[_0xecfc('0x55')],{'$or':_[_0xecfc('0x46')](_0x14da84[_0xecfc('0x4f')],function(_0x37edd8){var _0x52c095={};_0x52c095[_0x37edd8]={'$like':'%'+_0x234a9e[_0xecfc('0x4b')]['filter']+'%'};return _0x52c095;})});}_0x14da84=_[_0xecfc('0x58')]({},_0x14da84,_0x234a9e['options']);return _0x280c7e[_0xecfc('0x123')](_0x14da84);}})['then'](function(_0x40a2a9){if(_0x40a2a9){_0x353f19=_0x40a2a9[_0xecfc('0x5e')];if(!_0x234a9e[_0xecfc('0x4b')][_0xecfc('0x51')]('nolimit')){_0x14da84[_0xecfc('0x23')]=qs[_0xecfc('0x23')](_0x234a9e[_0xecfc('0x4b')]['limit']);_0x14da84[_0xecfc('0x21')]=qs[_0xecfc('0x21')](_0x234a9e[_0xecfc('0x4b')][_0xecfc('0x21')]);}return _0x280c7e['getProactiveActions'](_0x14da84);}})['then'](function(_0x5bde02){if(_0x5bde02){return _0x5bde02?{'count':_0x353f19,'rows':_0x5bde02}:null;}})['then'](respondWithResult(_0x29dcb1,null))[_0xecfc('0x1c')](handleError(_0x29dcb1,null));};exports[_0xecfc('0x124')]=function(_0x2e379e,_0x29cf62){var _0x37981a=_0x2e379e[_0xecfc('0x4b')][_0xecfc('0x125')]===_0xecfc('0x126')?_0xecfc('0x127'):'onlineForm';return db[_0xecfc('0x47')]['find']({'attributes':['id',_0x37981a],'where':{'id':_0x2e379e[_0xecfc('0x5d')]['id']}})['then'](handleEntityNotFound(_0x29cf62,null))[_0xecfc('0x15')](function(_0x198c44){if(_0x198c44){var _0xc3e118=_0x198c44[_0x37981a];var _0x489fb6=_0xc3e118&&_0xc3e118[_0xecfc('0x128')]?_0xc3e118[_0xecfc('0x128')]:[];_0x29cf62['send']({'fromKey':_[_0xecfc('0x86')](_0xc3e118[_0xecfc('0x129')])?undefined:_0xc3e118['fromKey'],'count':_0x489fb6[_0xecfc('0x5e')],'rows':_0x489fb6});}})[_0xecfc('0x1c')](handleError(_0x29cf62,null));};exports[_0xecfc('0x12a')]=function(_0x5df7b2,_0x4fa67b){var _0x3d9e75={'raw':![],'where':{}};var _0x5d84fd={};var _0x129684={'count':0x0,'rows':[]};return db[_0xecfc('0x47')][_0xecfc('0x70')]({'where':{'id':_0x5df7b2[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x4fa67b,null))[_0xecfc('0x15')](function(_0x128aac){if(_0x128aac){_0x5d84fd[_0xecfc('0x3e')]=_['keys'](db[_0xecfc('0xde')]['rawAttributes']);_0x5d84fd['query']=_[_0xecfc('0x4c')](_0x5df7b2[_0xecfc('0x4b')]);_0x5d84fd[_0xecfc('0x4d')]=_[_0xecfc('0x4e')](_0x5d84fd[_0xecfc('0x3e')],_0x5d84fd[_0xecfc('0x4b')]);_0x3d9e75['attributes']=_[_0xecfc('0x4e')](_0x5d84fd[_0xecfc('0x3e')],qs['fields'](_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x50')]));_0x3d9e75[_0xecfc('0x4f')]=_0x3d9e75[_0xecfc('0x4f')][_0xecfc('0x5e')]?_0x3d9e75[_0xecfc('0x4f')]:_0x5d84fd[_0xecfc('0x3e')];if(!_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x51')]('nolimit')){_0x3d9e75['limit']=qs[_0xecfc('0x23')](_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x23')]);_0x3d9e75[_0xecfc('0x21')]=qs[_0xecfc('0x21')](_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x21')]);}_0x3d9e75[_0xecfc('0x53')]=qs[_0xecfc('0x54')](_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x54')]);_0x3d9e75[_0xecfc('0x55')]=qs[_0xecfc('0x4d')](_[_0xecfc('0x56')](_0x5df7b2[_0xecfc('0x4b')],_0x5d84fd['filters']));_0x3d9e75[_0xecfc('0x55')]['ChatWebsiteId']=_0x128aac['id'];if(_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x57')]){_0x3d9e75[_0xecfc('0x55')]=_['merge'](_0x3d9e75['where'],{'$or':_[_0xecfc('0x46')](_0x3d9e75[_0xecfc('0x4f')],function(_0xa982e1){var _0x5a9103={};_0x5a9103[_0xa982e1]={'$like':'%'+_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x57')]+'%'};return _0x5a9103;})});}_0x3d9e75=_[_0xecfc('0x58')]({},_0x3d9e75,_0x5df7b2['options']);return db['ChatOfflineMessage'][_0xecfc('0x24')]({'where':_0x3d9e75[_0xecfc('0x55')]})[_0xecfc('0x15')](function(_0x21fe38){_0x129684[_0xecfc('0x24')]=_0x21fe38;if(_0x5df7b2[_0xecfc('0x4b')][_0xecfc('0x59')]){_0x3d9e75['include']=[{'all':!![]}];}else{_0x3d9e75[_0xecfc('0x5a')]=[{'model':db[_0xecfc('0x9d')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xecfc('0x12b'),'required':![]}];}return db[_0xecfc('0xde')]['findAll'](_0x3d9e75);})[_0xecfc('0x15')](function(_0x18d5b2){_0x129684['rows']=_0x18d5b2;return _0x129684;});}})[_0xecfc('0x15')](respondWithFilteredResult(_0x4fa67b,_0x3d9e75))[_0xecfc('0x1c')](handleError(_0x4fa67b,null));};exports[_0xecfc('0x12c')]=function(_0x24cfe5,_0x3797f7){return db[_0xecfc('0x47')]['find']({'where':{'id':_0x24cfe5['params']['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x3797f7,null))[_0xecfc('0x15')](function(_0x45251c){if(_0x45251c){return _0x45251c[_0xecfc('0x12c')](_0x24cfe5[_0xecfc('0x61')][_0xecfc('0x73')],_[_0xecfc('0x122')](_0x24cfe5['body'],['ids','id'])||{})['spread'](function(_0x448a05){for(var _0x407dc6=0x0;_0x407dc6<_0x24cfe5[_0xecfc('0x61')][_0xecfc('0x73')]['length'];_0x407dc6+=0x1){socket[_0xecfc('0x12d')](_0xecfc('0x12e'),{'UserId':Number(_0x24cfe5[_0xecfc('0x61')]['ids'][_0x407dc6]),'ChatWebsiteId':Number(_0x24cfe5['params']['id'])});}return _0x448a05;});}})['then'](respondWithResult(_0x3797f7,null))['catch'](handleError(_0x3797f7,null));};exports[_0xecfc('0x12f')]=function(_0x5303b3,_0x542774){return db['ChatWebsite']['find']({'where':{'id':_0x5303b3[_0xecfc('0x5d')]['id']}})[_0xecfc('0x15')](handleEntityNotFound(_0x542774,null))[_0xecfc('0x15')](function(_0x387f0c){if(_0x387f0c){return _0x387f0c[_0xecfc('0x12f')](_0x5303b3[_0xecfc('0x4b')][_0xecfc('0x73')])['then'](function(){if(_[_0xecfc('0x130')](_0x5303b3[_0xecfc('0x4b')]['ids'])){for(var _0x486bee=0x0;_0x486bee<_0x5303b3[_0xecfc('0x4b')][_0xecfc('0x73')][_0xecfc('0x5e')];_0x486bee+=0x1){socket[_0xecfc('0x12d')](_0xecfc('0x131'),{'UserId':Number(_0x5303b3[_0xecfc('0x4b')][_0xecfc('0x73')][_0x486bee]),'ChatWebsiteId':Number(_0x5303b3['params']['id'])});}}else{socket['emit'](_0xecfc('0x131'),{'UserId':Number(_0x5303b3[_0xecfc('0x4b')][_0xecfc('0x73')]),'ChatWebsiteId':Number(_0x5303b3['params']['id'])});}});}})[_0xecfc('0x15')](respondWithStatusCode(_0x542774,null))[_0xecfc('0x1c')](handleError(_0x542774,null));};exports['getAgents']=function(_0x8e181,_0x29d989){var _0x5216dd={};var _0x392eac={};var _0x265359;var _0xe13dc8;return db[_0xecfc('0x47')][_0xecfc('0x70')]({'where':{'id':_0x8e181['params']['id']}})['then'](handleEntityNotFound(_0x29d989,null))[_0xecfc('0x15')](function(_0x557446){if(_0x557446){_0x265359=_0x557446;_0x392eac[_0xecfc('0x3e')]=_[_0xecfc('0x4c')](db[_0xecfc('0x132')]['rawAttributes']);_0x392eac[_0xecfc('0x4b')]=_[_0xecfc('0x4c')](_0x8e181[_0xecfc('0x4b')]);_0x392eac[_0xecfc('0x4d')]=_[_0xecfc('0x4e')](_0x392eac[_0xecfc('0x3e')],_0x392eac[_0xecfc('0x4b')]);_0x5216dd[_0xecfc('0x4f')]=_['intersection'](_0x392eac[_0xecfc('0x3e')],qs[_0xecfc('0x50')](_0x8e181[_0xecfc('0x4b')][_0xecfc('0x50')]));_0x5216dd[_0xecfc('0x4f')]=_0x5216dd[_0xecfc('0x4f')][_0xecfc('0x5e')]?_0x5216dd[_0xecfc('0x4f')]:_0x392eac[_0xecfc('0x3e')];_0x5216dd[_0xecfc('0x53')]=qs['sort'](_0x8e181[_0xecfc('0x4b')][_0xecfc('0x54')]);_0x5216dd[_0xecfc('0x55')]=qs[_0xecfc('0x4d')](_[_0xecfc('0x56')](_0x8e181[_0xecfc('0x4b')],_0x392eac[_0xecfc('0x4d')]));if(_0x8e181[_0xecfc('0x4b')]['filter']){_0x5216dd[_0xecfc('0x55')]=_[_0xecfc('0x58')](_0x5216dd[_0xecfc('0x55')],{'$or':_[_0xecfc('0x46')](_0x5216dd[_0xecfc('0x4f')],function(_0x3cc970){var _0x39f620={};_0x39f620[_0x3cc970]={'$like':'%'+_0x8e181[_0xecfc('0x4b')][_0xecfc('0x57')]+'%'};return _0x39f620;})});}_0x5216dd=_[_0xecfc('0x58')]({},_0x5216dd,_0x8e181[_0xecfc('0x5f')]);return _0x265359[_0xecfc('0x133')](_0x5216dd);}})[_0xecfc('0x15')](function(_0x4a0b0e){if(_0x4a0b0e){_0xe13dc8=_0x4a0b0e['length'];if(!_0x8e181['query'][_0xecfc('0x51')]('nolimit')){_0x5216dd[_0xecfc('0x23')]=qs[_0xecfc('0x23')](_0x8e181['query'][_0xecfc('0x23')]);_0x5216dd['offset']=qs[_0xecfc('0x21')](_0x8e181[_0xecfc('0x4b')][_0xecfc('0x21')]);}return _0x265359['getAgents'](_0x5216dd);}})[_0xecfc('0x15')](function(_0x2176b2){if(_0x2176b2){return _0x2176b2?{'count':_0xe13dc8,'rows':_0x2176b2}:null;}})[_0xecfc('0x15')](respondWithResult(_0x29d989,null))[_0xecfc('0x1c')](handleError(_0x29d989,null));}; \ No newline at end of file +var _0x5096=['params','length','find','catch','create','testWildcardValidity','body','address','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','resolve','timezone','ifTime','notify','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','ListId','from','contact','headers','threadId','closed','ChatInteraction','externalUrl','interaction','firstName','messageId','created','autoclose','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','*,*,*,*','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','ValidationError','difference','send','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','fromString','originalname','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','tag','getSnippet','interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','3.9.0','origin','remote','connection','remoteAddress','replace','alignment','color','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','json','getApplications','chatProactiveAction','addProactiveActions','getFields','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','User','getAgents','mustache','util','path','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','info','sendStatus','status','end','offset','undefined','count','update','get','ChatWebsites','destroy','stack','name','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','stringify','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','map','query','keys','intersection','attributes','fields','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show'];(function(_0x17aa2e,_0x15508a){var _0x11bee9=function(_0x2a6a99){while(--_0x2a6a99){_0x17aa2e['push'](_0x17aa2e['shift']());}};_0x11bee9(++_0x15508a);}(_0x5096,0xd6));var _0x6509=function(_0x65ff6c,_0x4c2da3){_0x65ff6c=_0x65ff6c-0x0;var _0x238215=_0x5096[_0x65ff6c];return _0x238215;};'use strict';var Mustache=require(_0x6509('0x0'));var util=require(_0x6509('0x1'));var path=require(_0x6509('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6509('0x3'));var _=require(_0x6509('0x4'));var querystring=require(_0x6509('0x5'));var htmlToText=require(_0x6509('0x6'));var Redis=require(_0x6509('0x7'));var jayson=require(_0x6509('0x8'));var qs=require(_0x6509('0x9'));var logger=require('../../config/logger')(_0x6509('0xa'));var config=require(_0x6509('0xb'));var APIBadRequestError=require(_0x6509('0xc'))[_0x6509('0xd')];var APINotFoundError=require(_0x6509('0xc'))[_0x6509('0xe')];var APIOutOfIntervalError=require(_0x6509('0xc'))[_0x6509('0xf')];var APIHandleError=require(_0x6509('0xc'))[_0x6509('0x10')];var APIConflictError=require(_0x6509('0xc'))['APIConflictError'];var wildcardUtils=require(_0x6509('0x11'));var URL=require(_0x6509('0x12'))[_0x6509('0x13')];var db=require(_0x6509('0x14'))['db'];config['redis']=_[_0x6509('0x15')](config[_0x6509('0x16')],{'host':_0x6509('0x17'),'port':0x18eb});var socket=require(_0x6509('0x18'))(new Redis(config[_0x6509('0x16')]));require(_0x6509('0x19'))[_0x6509('0x1a')](socket);var client=jayson[_0x6509('0x1b')][_0x6509('0x1c')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson['client'][_0x6509('0x1c')]({'port':0x232b});var client9001=jayson['client'][_0x6509('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x35df2b,_0xdb3430,_0x3b9978,_0x4ef411){return new Promise(function(_0x2acec6,_0x44bb20){var _0x53c174=_0x4ef411||client;return _0x53c174['request'](_0x35df2b,_0x3b9978)[_0x6509('0x1d')](function(_0x39267d){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xdb3430,_0x6509('0x1e'));logger[_0x6509('0x1f')](_0x6509('0x20'),_0xdb3430,_0x6509('0x1e'),JSON['stringify'](_0x39267d));if(_0x39267d[_0x6509('0x21')]){if(_0x39267d[_0x6509('0x21')][_0x6509('0x22')]===0x1f4){logger[_0x6509('0x21')](_0x6509('0x23'),_0xdb3430,_0x39267d[_0x6509('0x21')][_0x6509('0x24')]);return _0x44bb20(_0x39267d[_0x6509('0x21')][_0x6509('0x24')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0xdb3430,_0x39267d[_0x6509('0x21')][_0x6509('0x24')]);return _0x2acec6(_0x39267d['error'][_0x6509('0x24')]);}else{logger[_0x6509('0x25')](_0x6509('0x23'),_0xdb3430,_0x6509('0x1e'));_0x2acec6(_0x39267d['result']['message']);}})['catch'](function(_0x3015d1){logger[_0x6509('0x21')]('ChatWebsite,\x20%s,\x20%s',_0xdb3430,_0x3015d1);_0x44bb20(_0x3015d1);});});}function respondWithStatusCode(_0x3bc27b,_0x590948){_0x590948=_0x590948||0xcc;return function(_0x1ecc8b){if(_0x1ecc8b){return _0x3bc27b[_0x6509('0x26')](_0x590948);}return _0x3bc27b[_0x6509('0x27')](_0x590948)[_0x6509('0x28')]();};}function respondWithResult(_0x4287c6,_0xa7adf1){_0xa7adf1=_0xa7adf1||0xc8;return function(_0x261130){if(_0x261130){return _0x4287c6[_0x6509('0x27')](_0xa7adf1)['json'](_0x261130);}};}function respondWithFilteredResult(_0x37e9ef,_0x3f517e){return function(_0xcb9d99){if(_0xcb9d99){var _0xa91505=typeof _0x3f517e[_0x6509('0x29')]===_0x6509('0x2a')&&typeof _0x3f517e['limit']===_0x6509('0x2a');var _0x5733c8=_0xcb9d99[_0x6509('0x2b')];var _0x5ac1a8=_0xa91505?0x0:_0x3f517e[_0x6509('0x29')];var _0xbee06f=_0xa91505?_0xcb9d99[_0x6509('0x2b')]:_0x3f517e[_0x6509('0x29')]+_0x3f517e['limit'];var _0x3bb344;if(_0xbee06f>=_0x5733c8){_0xbee06f=_0x5733c8;_0x3bb344=0xc8;}else{_0x3bb344=0xce;}_0x37e9ef[_0x6509('0x27')](_0x3bb344);return _0x37e9ef['set']('Content-Range',_0x5ac1a8+'-'+_0xbee06f+'/'+_0x5733c8)['json'](_0xcb9d99);}return null;};}function saveUpdates(_0x27bd34){return function(_0x20713a){if(_0x20713a){return _0x20713a[_0x6509('0x2c')](_0x27bd34)[_0x6509('0x1d')](function(_0x34871d){return _0x34871d;});}return null;};}function removeEntity(_0x32db78){return function(_0x320b57){if(_0x320b57){return _0x320b57['destroy']()['then'](function(){var _0x3c9e0e=_0x320b57[_0x6509('0x2d')]({'plain':!![]});var _0x43760a=_0x6509('0x2e');return db['UserProfileResource'][_0x6509('0x2f')]({'where':{'type':_0x43760a,'resourceId':_0x3c9e0e['id']}})[_0x6509('0x1d')](function(){return _0x320b57;});})[_0x6509('0x1d')](function(){_0x32db78[_0x6509('0x27')](0xcc)[_0x6509('0x28')]();});}};}function handleEntityNotFound(_0x952bae){return function(_0x2229f9){if(!_0x2229f9){_0x952bae['sendStatus'](0x194);}return _0x2229f9;};}function handleError(_0x3165fa,_0x3613b2){_0x3613b2=_0x3613b2||0x1f4;return function(_0xdd0147){logger[_0x6509('0x21')](_0xdd0147[_0x6509('0x30')]);if(_0xdd0147[_0x6509('0x31')]){delete _0xdd0147[_0x6509('0x31')];}_0x3165fa[_0x6509('0x27')](_0x3613b2)['send'](_0xdd0147);};}function createInteractionObject(_0x1045f1,_0x3b4cb4,_0x14d81c,_0x5ab77f){var _0x19aab7=require(_0x6509('0x32'));var _0x2c1697=new _0x19aab7();var _0x3b6953=_0x2c1697[_0x6509('0x33')](_0x14d81c[_0x6509('0x34')])[_0x6509('0x35')]();var _0x30700b=_0x3b4cb4[_0x6509('0x36')];if(_0x14d81c[_0x6509('0x37')]){_0x30700b=_0x14d81c[_0x6509('0x37')];}else if(_0x14d81c['x-forwarded-for']){_0x30700b=_[_0x6509('0x38')](_0x14d81c[_0x6509('0x39')][_0x6509('0x3a')](','));}return{'ContactId':_0x5ab77f['id'],'ChatWebsiteId':_0x1045f1,'from':(_0x5ab77f['firstName']||'')+'\x20'+(_0x5ab77f[_0x6509('0x3b')]||''),'customerIp':_0x30700b,'customerPort':_0x14d81c['x-real-port']?_0x14d81c[_0x6509('0x3c')]:null,'referer':_0x3b4cb4[_0x6509('0x3d')],'browserName':_0x3b6953['browser']['name']&&_0x3b6953[_0x6509('0x3e')][_0x6509('0x3f')]?util[_0x6509('0x40')](_0x6509('0x41'),_0x3b6953[_0x6509('0x3e')]['name'],_0x3b6953['browser'][_0x6509('0x3f')]):_0x6509('0x42'),'browserVersion':_0x3b6953[_0x6509('0x3e')][_0x6509('0x3f')]||_0x6509('0x42'),'osName':util[_0x6509('0x40')](_0x6509('0x41'),_0x3b6953['os'][_0x6509('0x31')],_0x3b6953['os'][_0x6509('0x3f')]),'osVersion':_0x3b6953['os'][_0x6509('0x3f')],'deviceModel':_0x3b6953[_0x6509('0x43')][_0x6509('0x44')]&&_0x3b6953[_0x6509('0x43')][_0x6509('0x45')]?util[_0x6509('0x40')](_0x6509('0x46'),_0x3b6953[_0x6509('0x43')]['model'],_0x3b6953['device'][_0x6509('0x45')],_0x3b6953[_0x6509('0x43')][_0x6509('0x47')]):null,'deviceVendor':_0x3b6953[_0x6509('0x43')][_0x6509('0x45')],'deviceType':_0x3b6953[_0x6509('0x43')]['type'],'formData':JSON[_0x6509('0x48')](_0x3b4cb4)};}exports['index']=function(_0x480d57,_0x193757){var _0x52c02b={'include':[{'model':db[_0x6509('0x49')],'as':_0x6509('0x4a')}]},_0x4e475c={},_0x40f1d9={'count':0x0,'rows':[]};var _0x3b1303=_['map'](db[_0x6509('0x4b')][_0x6509('0x4c')],function(_0x296a44){return{'name':_0x296a44[_0x6509('0x4d')],'type':_0x296a44['type']['key']};});_0x4e475c['model']=_[_0x6509('0x4e')](_0x3b1303,_0x6509('0x31'));_0x4e475c[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x480d57[_0x6509('0x4f')]);_0x4e475c['filters']=_[_0x6509('0x51')](_0x4e475c[_0x6509('0x44')],_0x4e475c[_0x6509('0x4f')]);_0x52c02b[_0x6509('0x52')]=_[_0x6509('0x51')](_0x4e475c['model'],qs[_0x6509('0x53')](_0x480d57[_0x6509('0x4f')][_0x6509('0x53')]));_0x52c02b[_0x6509('0x52')]=_0x52c02b[_0x6509('0x52')]['length']?_0x52c02b[_0x6509('0x52')]:_0x4e475c['model'];if(!_0x480d57[_0x6509('0x4f')]['hasOwnProperty'](_0x6509('0x54'))){_0x52c02b[_0x6509('0x55')]=qs[_0x6509('0x55')](_0x480d57['query'][_0x6509('0x55')]);_0x52c02b[_0x6509('0x29')]=qs[_0x6509('0x29')](_0x480d57['query'][_0x6509('0x29')]);}_0x52c02b['order']=qs[_0x6509('0x56')](_0x480d57[_0x6509('0x4f')]['sort']);_0x52c02b[_0x6509('0x57')]=qs[_0x6509('0x58')](_[_0x6509('0x59')](_0x480d57['query'],_0x4e475c[_0x6509('0x58')]),_0x3b1303);if(_0x480d57['query'][_0x6509('0x5a')]){_0x52c02b['where']=_[_0x6509('0x5b')](_0x52c02b[_0x6509('0x57')],{'$or':_['map'](_0x3b1303,function(_0x548b5e){if(_0x548b5e['type']!==_0x6509('0x5c')){var _0x21ef44={};_0x21ef44[_0x548b5e[_0x6509('0x31')]]={'$like':'%'+_0x480d57['query'][_0x6509('0x5a')]+'%'};return _0x21ef44;}})});}_0x52c02b=_['merge']({},_0x52c02b,_0x480d57[_0x6509('0x5d')]);var _0x1b60a3={'where':_0x52c02b[_0x6509('0x57')]};return db[_0x6509('0x4b')][_0x6509('0x2b')](_0x1b60a3)[_0x6509('0x1d')](function(_0x3fb67a){_0x40f1d9[_0x6509('0x2b')]=_0x3fb67a;if(_0x480d57[_0x6509('0x4f')][_0x6509('0x5e')]){_0x52c02b[_0x6509('0x5f')]=[{'all':!![]}];}return db[_0x6509('0x4b')]['findAll'](_0x52c02b);})[_0x6509('0x1d')](function(_0x4a91eb){_0x40f1d9[_0x6509('0x60')]=_0x4a91eb;return _0x40f1d9;})[_0x6509('0x1d')](respondWithFilteredResult(_0x193757,_0x52c02b))['catch'](handleError(_0x193757,null));};exports[_0x6509('0x61')]=function(_0x353847,_0x13a567){var _0x443ace={'raw':![],'where':{'id':_0x353847[_0x6509('0x62')]['id']},'include':[{'model':db[_0x6509('0x49')],'as':_0x6509('0x4a')}]},_0x1f3178={};_0x1f3178[_0x6509('0x44')]=_[_0x6509('0x50')](db[_0x6509('0x4b')][_0x6509('0x4c')]);_0x1f3178[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x353847['query']);_0x1f3178['filters']=_[_0x6509('0x51')](_0x1f3178['model'],_0x1f3178[_0x6509('0x4f')]);_0x443ace['attributes']=_[_0x6509('0x51')](_0x1f3178[_0x6509('0x44')],qs[_0x6509('0x53')](_0x353847[_0x6509('0x4f')][_0x6509('0x53')]));_0x443ace[_0x6509('0x52')]=_0x443ace[_0x6509('0x52')][_0x6509('0x63')]?_0x443ace['attributes']:_0x1f3178['model'];if(_0x353847['query'][_0x6509('0x5e')]){_0x443ace[_0x6509('0x5f')]=[{'all':!![]}];}_0x443ace=_[_0x6509('0x5b')]({},_0x443ace,_0x353847[_0x6509('0x5d')]);return db[_0x6509('0x4b')][_0x6509('0x64')](_0x443ace)[_0x6509('0x1d')](handleEntityNotFound(_0x13a567,null))[_0x6509('0x1d')](respondWithResult(_0x13a567,null))[_0x6509('0x65')](handleError(_0x13a567,null));};exports[_0x6509('0x66')]=function(_0x5cb310,_0x114ef2){if(!wildcardUtils[_0x6509('0x67')](_0x5cb310[_0x6509('0x68')][_0x6509('0x69')])){return handleError(_0x114ef2,null)(new APIBadRequestError('\x22'+_0x5cb310['body'][_0x6509('0x69')]+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}return db[_0x6509('0x4b')][_0x6509('0x66')](_0x5cb310['body'],{})[_0x6509('0x1d')](function(_0x3899de){var _0xf3143a=_0x5cb310['user'][_0x6509('0x2d')]({'plain':!![]});if(!_0xf3143a)throw new Error(_0x6509('0x6a'));if(_0xf3143a[_0x6509('0x6b')]==='user'){var _0x5a1e8e=_0x3899de[_0x6509('0x2d')]({'plain':!![]});var _0x5a0820=_0x6509('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x5a0820,'userProfileId':_0xf3143a['userProfileId']},'raw':!![]})[_0x6509('0x1d')](function(_0x8cb18b){if(_0x8cb18b&&_0x8cb18b[_0x6509('0x6c')]===0x0){return db[_0x6509('0x6d')]['create']({'name':_0x5a1e8e['name'],'resourceId':_0x5a1e8e['id'],'type':_0x8cb18b['name'],'sectionId':_0x8cb18b['id']},{})[_0x6509('0x1d')](function(){return _0x3899de;});}else{return _0x3899de;}})['catch'](function(_0x59d131){logger[_0x6509('0x21')](_0x6509('0x6e'),_0x59d131);throw _0x59d131;});}return _0x3899de;})[_0x6509('0x1d')](respondWithResult(_0x114ef2,0xc9))[_0x6509('0x65')](handleError(_0x114ef2,null));};exports['update']=function(_0x2774b4,_0x46a69a){if(!wildcardUtils[_0x6509('0x67')](_0x2774b4[_0x6509('0x68')][_0x6509('0x69')])){return handleError(_0x46a69a,null)(new APIBadRequestError('\x22'+_0x2774b4[_0x6509('0x68')][_0x6509('0x69')]+_0x6509('0x6f')));}if(_0x2774b4[_0x6509('0x68')]['id']){delete _0x2774b4[_0x6509('0x68')]['id'];}return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x2774b4['params']['id']},'include':[{'model':db[_0x6509('0x49')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x46a69a,null))[_0x6509('0x1d')](saveUpdates(_0x2774b4[_0x6509('0x68')],null))['then'](respondWithResult(_0x46a69a,null))[_0x6509('0x65')](handleError(_0x46a69a,null));};exports[_0x6509('0x2f')]=function(_0x3276e5,_0xb85645){return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x3276e5[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0xb85645,null))[_0x6509('0x1d')](removeEntity(_0xb85645,null))[_0x6509('0x65')](handleError(_0xb85645,null));};exports[_0x6509('0x70')]=function(_0x2de805,_0x56e9e7){return db['ChatWebsite'][_0x6509('0x70')]()[_0x6509('0x1d')](respondWithResult(_0x56e9e7,null))[_0x6509('0x65')](handleError(_0x56e9e7,null));};exports[_0x6509('0x71')]=function(_0x52757a,_0x33daa8){if(_0x52757a[_0x6509('0x68')]['id']){delete _0x52757a[_0x6509('0x68')]['id'];}return db[_0x6509('0x4b')]['find']({'where':{'id':_0x52757a[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x33daa8,null))[_0x6509('0x1d')](function(_0x3152ff){if(_0x3152ff){_0x52757a[_0x6509('0x68')][_0x6509('0x72')]=_0x3152ff['id'];return db[_0x6509('0x73')][_0x6509('0x66')](_0x52757a[_0x6509('0x68')]);}})[_0x6509('0x1d')](respondWithResult(_0x33daa8,null))[_0x6509('0x65')](handleError(_0x33daa8,null));};exports[_0x6509('0x74')]=function(_0x3f5412,_0x521bef){var _0x2ac517={'raw':![],'where':{}};var _0x2feaf7={};var _0x3cd9bd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6509('0x75')]({'where':{'id':_0x3f5412[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x521bef,null))[_0x6509('0x1d')](function(_0x2938ba){if(_0x2938ba){_0x2feaf7[_0x6509('0x44')]=_['keys'](db[_0x6509('0x73')][_0x6509('0x4c')]);_0x2feaf7[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x3f5412['query']);_0x2feaf7[_0x6509('0x58')]=_[_0x6509('0x51')](_0x2feaf7[_0x6509('0x44')],_0x2feaf7['query']);_0x2ac517[_0x6509('0x52')]=_[_0x6509('0x51')](_0x2feaf7[_0x6509('0x44')],qs['fields'](_0x3f5412['query'][_0x6509('0x53')]));_0x2ac517['attributes']=_0x2ac517['attributes']['length']?_0x2ac517[_0x6509('0x52')]:_0x2feaf7['model'];if(!_0x3f5412['query'][_0x6509('0x76')](_0x6509('0x54'))){_0x2ac517[_0x6509('0x55')]=qs[_0x6509('0x55')](_0x3f5412[_0x6509('0x4f')]['limit']);_0x2ac517[_0x6509('0x29')]=qs['offset'](_0x3f5412[_0x6509('0x4f')][_0x6509('0x29')]);}_0x2ac517[_0x6509('0x77')]=qs[_0x6509('0x56')](_0x3f5412['query']['sort']);_0x2ac517[_0x6509('0x57')]=qs[_0x6509('0x58')](_[_0x6509('0x59')](_0x3f5412['query'],_0x2feaf7[_0x6509('0x58')]));_0x2ac517[_0x6509('0x57')][_0x6509('0x72')]=_0x2938ba['id'];if(_0x3f5412['query'][_0x6509('0x5a')]){_0x2ac517[_0x6509('0x57')]=_['merge'](_0x2ac517[_0x6509('0x57')],{'$or':_['map'](_0x2ac517['attributes'],function(_0x37554f){var _0x599a2f={};_0x599a2f[_0x37554f]={'$like':'%'+_0x3f5412[_0x6509('0x4f')][_0x6509('0x5a')]+'%'};return _0x599a2f;})});}_0x2ac517=_[_0x6509('0x5b')]({},_0x2ac517,_0x3f5412[_0x6509('0x5d')]);return db['Disposition'][_0x6509('0x2b')]({'where':_0x2ac517['where']})[_0x6509('0x1d')](function(_0x43fd3f){_0x3cd9bd[_0x6509('0x2b')]=_0x43fd3f;if(_0x3f5412[_0x6509('0x4f')]['includeAll']){_0x2ac517[_0x6509('0x5f')]=[{'all':!![]}];}return db[_0x6509('0x73')][_0x6509('0x78')](_0x2ac517);})[_0x6509('0x1d')](function(_0x3e22e6){_0x3cd9bd[_0x6509('0x60')]=_0x3e22e6;return _0x3cd9bd;});}})['then'](respondWithFilteredResult(_0x521bef,_0x2ac517))[_0x6509('0x65')](handleError(_0x521bef,null));};exports[_0x6509('0x79')]=function(_0x3e0b09,_0x2f9c6b){return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x3e0b09[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x2f9c6b,null))['then'](function(_0x3381f3){if(_0x3381f3){return _0x3381f3[_0x6509('0x79')](_0x3e0b09['query']['ids']);}})['then'](respondWithStatusCode(_0x2f9c6b,null))[_0x6509('0x65')](handleError(_0x2f9c6b,null));};exports[_0x6509('0x7a')]=function(_0x37e5ed,_0x3ce243){if(_0x37e5ed['body']['id']){delete _0x37e5ed[_0x6509('0x68')]['id'];}return db[_0x6509('0x4b')]['find']({'where':{'id':_0x37e5ed[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x3ce243,null))[_0x6509('0x1d')](function(_0x2aa56b){if(_0x2aa56b){_0x37e5ed[_0x6509('0x68')][_0x6509('0x72')]=_0x2aa56b['id'];return db[_0x6509('0x7b')][_0x6509('0x66')](_0x37e5ed[_0x6509('0x68')]);}})[_0x6509('0x1d')](respondWithResult(_0x3ce243,null))[_0x6509('0x65')](handleError(_0x3ce243,null));};exports[_0x6509('0x7c')]=function(_0x49a3f0,_0x3aefbb){var _0x3047c9={'raw':![],'where':{}};var _0x5b0749={};var _0x5c8212={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6509('0x75')]({'where':{'id':_0x49a3f0[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x3aefbb,null))['then'](function(_0x2dcfd7){if(_0x2dcfd7){_0x5b0749['model']=_[_0x6509('0x50')](db['CannedAnswer'][_0x6509('0x4c')]);_0x5b0749['query']=_[_0x6509('0x50')](_0x49a3f0['query']);_0x5b0749[_0x6509('0x58')]=_[_0x6509('0x51')](_0x5b0749[_0x6509('0x44')],_0x5b0749[_0x6509('0x4f')]);_0x3047c9[_0x6509('0x52')]=_['intersection'](_0x5b0749['model'],qs[_0x6509('0x53')](_0x49a3f0[_0x6509('0x4f')][_0x6509('0x53')]));_0x3047c9[_0x6509('0x52')]=_0x3047c9['attributes']['length']?_0x3047c9[_0x6509('0x52')]:_0x5b0749[_0x6509('0x44')];if(!_0x49a3f0[_0x6509('0x4f')][_0x6509('0x76')]('nolimit')){_0x3047c9[_0x6509('0x55')]=qs[_0x6509('0x55')](_0x49a3f0[_0x6509('0x4f')][_0x6509('0x55')]);_0x3047c9[_0x6509('0x29')]=qs[_0x6509('0x29')](_0x49a3f0[_0x6509('0x4f')]['offset']);}_0x3047c9['order']=qs[_0x6509('0x56')](_0x49a3f0['query'][_0x6509('0x56')]);_0x3047c9['where']=qs['filters'](_[_0x6509('0x59')](_0x49a3f0[_0x6509('0x4f')],_0x5b0749[_0x6509('0x58')]));_0x3047c9[_0x6509('0x57')][_0x6509('0x72')]=_0x2dcfd7['id'];if(_0x49a3f0[_0x6509('0x4f')][_0x6509('0x5a')]){_0x3047c9[_0x6509('0x57')]=_[_0x6509('0x5b')](_0x3047c9[_0x6509('0x57')],{'$or':_['map'](_0x3047c9['attributes'],function(_0x50270a){var _0x58c68d={};_0x58c68d[_0x50270a]={'$like':'%'+_0x49a3f0['query'][_0x6509('0x5a')]+'%'};return _0x58c68d;})});}_0x3047c9=_['merge']({},_0x3047c9,_0x49a3f0[_0x6509('0x5d')]);return db[_0x6509('0x7b')][_0x6509('0x2b')]({'where':_0x3047c9[_0x6509('0x57')]})[_0x6509('0x1d')](function(_0x130f11){_0x5c8212[_0x6509('0x2b')]=_0x130f11;if(_0x49a3f0['query'][_0x6509('0x5e')]){_0x3047c9[_0x6509('0x5f')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3047c9);})['then'](function(_0x1c8f7e){_0x5c8212[_0x6509('0x60')]=_0x1c8f7e;return _0x5c8212;});}})[_0x6509('0x1d')](respondWithFilteredResult(_0x3aefbb,_0x3047c9))['catch'](handleError(_0x3aefbb,null));};exports[_0x6509('0x7d')]=function(_0x5b91d4,_0x5a077f){return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x5b91d4[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x5a077f,null))[_0x6509('0x1d')](function(_0xacd415){if(_0xacd415){return _0xacd415[_0x6509('0x7d')](_0x5b91d4[_0x6509('0x4f')][_0x6509('0x7e')]);}})[_0x6509('0x1d')](respondWithStatusCode(_0x5a077f,null))['catch'](handleError(_0x5a077f,null));};exports[_0x6509('0x7f')]=function(_0x3ee6cf,_0x5c20a1){_0x3ee6cf[_0x6509('0x68')][_0x6509('0x80')]=_0x3ee6cf[_0x6509('0x81')]['filename'];return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x3ee6cf[_0x6509('0x62')]['id']}})['then'](handleEntityNotFound(_0x5c20a1,null))[_0x6509('0x1d')](saveUpdates(_0x3ee6cf[_0x6509('0x68')],null))[_0x6509('0x1d')](respondWithResult(_0x5c20a1,null))['catch'](handleError(_0x5c20a1,null));};exports[_0x6509('0x82')]=function(_0x207b0f,_0x33cded){_0x207b0f[_0x6509('0x68')][_0x6509('0x83')]=_0x207b0f[_0x6509('0x81')][_0x6509('0x84')];return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x207b0f[_0x6509('0x62')]['id']}})['then'](handleEntityNotFound(_0x33cded,null))[_0x6509('0x1d')](saveUpdates(_0x207b0f['body'],null))[_0x6509('0x1d')](respondWithResult(_0x33cded,null))[_0x6509('0x65')](handleError(_0x33cded,null));};exports['addCustomerAvatar']=function(_0x158232,_0x4b2421){_0x158232[_0x6509('0x68')][_0x6509('0x85')]=_0x158232[_0x6509('0x81')][_0x6509('0x84')];return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x158232[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x4b2421,null))[_0x6509('0x1d')](saveUpdates(_0x158232[_0x6509('0x68')],null))['then'](respondWithResult(_0x4b2421,null))[_0x6509('0x65')](handleError(_0x4b2421,null));};exports[_0x6509('0x86')]=function(_0xafdfc7,_0x32e990){_0xafdfc7[_0x6509('0x68')][_0x6509('0x87')]=_0xafdfc7[_0x6509('0x81')][_0x6509('0x84')];return db[_0x6509('0x4b')]['find']({'where':{'id':_0xafdfc7[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x32e990,null))['then'](saveUpdates(_0xafdfc7[_0x6509('0x68')],null))['then'](respondWithResult(_0x32e990,null))[_0x6509('0x65')](handleError(_0x32e990,null));};exports[_0x6509('0x88')]=function(_0x595926,_0x52b59e){var _0x578686=path[_0x6509('0x89')](config[_0x6509('0x8a')],'server/files/images/logos/default_logo.svg');var _0x89fb0e={'where':{'id':_0x595926[_0x6509('0x62')]['id']},'attributes':['id',_0x6509('0x80')],'raw':!![]};var _0x1b952a=![];return require(_0x6509('0x8b'))[_0x6509('0x8c')]()['then'](function(_0x1ded52){if(_0x1ded52){_0x1b952a=_0x1ded52[_0x6509('0x8d')];}})[_0x6509('0x1d')](function(){return db[_0x6509('0x4b')][_0x6509('0x64')](_0x89fb0e);})[_0x6509('0x1d')](handleEntityNotFound(_0x52b59e,null))[_0x6509('0x1d')](function(_0x4988a1){if(_0x4988a1){if(!_[_0x6509('0x8e')](_0x4988a1[_0x6509('0x80')])){if(fs['existsSync'](path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0x8f'),_0x4988a1[_0x6509('0x80')]))&&_0x1b952a){_0x578686=path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0x8f'),_0x4988a1[_0x6509('0x80')]);}}return _0x52b59e[_0x6509('0x90')](_0x578686);}})[_0x6509('0x65')](handleError(_0x52b59e,null));};exports[_0x6509('0x91')]=function(_0x87e938,_0x340011){var _0x1dd3a0=path[_0x6509('0x89')](config[_0x6509('0x8a')],'server/files/images/avatars/default_avatar.png');var _0x485a63={'where':{'id':_0x87e938['params']['id']},'attributes':['id',_0x6509('0x83')],'raw':!![]};return db['ChatWebsite']['find'](_0x485a63)[_0x6509('0x1d')](handleEntityNotFound(_0x340011,null))['then'](function(_0x450ee7){if(_0x450ee7){if(!_[_0x6509('0x8e')](_0x450ee7[_0x6509('0x83')])){if(fs[_0x6509('0x92')](path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0x93'),_0x450ee7['agentAvatar']))){_0x1dd3a0=path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0x93'),_0x450ee7[_0x6509('0x83')]);}}return _0x340011[_0x6509('0x90')](_0x1dd3a0);}})['catch'](handleError(_0x340011,null));};exports[_0x6509('0x94')]=function(_0x12f6b4,_0x30f3fa){var _0x1e0f90=path[_0x6509('0x89')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x599754={'where':{'id':_0x12f6b4[_0x6509('0x62')]['id']},'attributes':['id',_0x6509('0x85'),_0x6509('0x95')],'raw':!![]};return db[_0x6509('0x4b')][_0x6509('0x64')](_0x599754)['then'](handleEntityNotFound(_0x30f3fa,null))[_0x6509('0x1d')](function(_0x10f74e){if(_0x10f74e){if(!_[_0x6509('0x8e')](_0x10f74e[_0x6509('0x85')])){if(fs[_0x6509('0x92')](path['join'](config[_0x6509('0x8a')],_0x6509('0x93'),_0x10f74e['customerAvatar']))&&_0x10f74e['showCustomerAvatar']){_0x1e0f90=path[_0x6509('0x89')](config['root'],_0x6509('0x93'),_0x10f74e['customerAvatar']);}}return _0x30f3fa[_0x6509('0x90')](_0x1e0f90);}})[_0x6509('0x65')](handleError(_0x30f3fa,null));};exports[_0x6509('0x96')]=function(_0x3a74a4,_0x218ba1){var _0xc09a63=path['join'](config[_0x6509('0x8a')],'server/files/images/avatars/system_avatar.png');var _0x242a2d={'where':{'id':_0x3a74a4[_0x6509('0x62')]['id']},'attributes':['id',_0x6509('0x87')],'raw':!![]};return db[_0x6509('0x4b')][_0x6509('0x64')](_0x242a2d)['then'](handleEntityNotFound(_0x218ba1,null))[_0x6509('0x1d')](function(_0x573b7c){if(_0x573b7c){if(!_[_0x6509('0x8e')](_0x573b7c[_0x6509('0x87')])){if(fs[_0x6509('0x92')](path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0x93'),_0x573b7c[_0x6509('0x87')]))){_0xc09a63=path[_0x6509('0x89')](config['root'],_0x6509('0x93'),_0x573b7c['systemAvatar']);}}return _0x218ba1[_0x6509('0x90')](_0xc09a63);}})[_0x6509('0x65')](handleError(_0x218ba1,null));};function checkWebsiteInterval(_0x40df56){var _0x51c35c=_0x40df56['Interval'];if(!_0x51c35c){return Promise[_0x6509('0x97')](_0x40df56);}var _0x21c7f9=_0x40df56[_0x6509('0x98')]||undefined;return _0x51c35c[_0x6509('0x99')](_0x21c7f9)[_0x6509('0x1d')](function(_0x134b8d){if(!_0x134b8d){throw new APIOutOfIntervalError();}return _0x40df56;});}exports[_0x6509('0x9a')]=function(_0x20c370,_0x193d70){var _0x278d45={'body':_0x20c370[_0x6509('0x68')],'channel':_0x6509('0x9b')};var _0x170635=[];var _0x5460a4=[];var _0x572bf7={};var _0x169938=![];if(_0x20c370['body']['id']){delete _0x20c370['body']['id'];}if(_[_0x6509('0x8e')](_0x20c370['body']['from'])){throw new APIBadRequestError(_0x6509('0x9c'));}if(_[_0x6509('0x8e')](_0x20c370[_0x6509('0x68')][_0x6509('0x9d')])){throw new APIBadRequestError(_0x6509('0x9e'));}if(_[_0x6509('0x9f')](_0x20c370[_0x6509('0x68')][_0x6509('0x68')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x1c264e=_0x20c370[_0x6509('0x68')][_0x6509('0x36')]&&_0x20c370[_0x6509('0x68')][_0x6509('0x3d')];return db[_0x6509('0xa0')][_0x6509('0x70')]()['then'](function(_0x314b77){if(!_0x314b77){throw new Error(_0x6509('0xa1'));}_0x170635=Object['keys'](_0x314b77)['filter'](function(_0x1f3923){return![_0x6509('0xa2'),_0x6509('0xa3')]['includes'](_0x1f3923);});_0x5460a4=Object['keys'](_0x314b77)[_0x6509('0x5a')](function(_0x31860d){return![_0x6509('0xa2'),_0x6509('0xa3'),_0x6509('0xa4'),'ListId'][_0x6509('0xa5')](_0x31860d);});if(!_[_0x6509('0xa5')](_0x5460a4,_0x20c370[_0x6509('0x68')]['mapKey'])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x5460a4['join'](',\x20'));}_0x572bf7[_0x20c370[_0x6509('0x68')][_0x6509('0x9d')]]=_0x20c370[_0x6509('0x68')]['from'];})[_0x6509('0x1d')](function(){return db[_0x6509('0x4b')]['find']({'where':{'id':_0x20c370['params']['id']},'include':[{'model':db[_0x6509('0xa6')],'as':_0x6509('0xa7'),'include':[{'model':db[_0x6509('0xa0')],'as':_0x6509('0xa8'),'where':_0x572bf7,'limit':0x1,'order':[[_0x6509('0xa3'),_0x6509('0xa9')]]}]},{'model':db[_0x6509('0xaa')],'as':_0x6509('0xab')},{'model':db[_0x6509('0xac')],'as':'Interval','include':[{'model':db[_0x6509('0xac')],'as':_0x6509('0xad'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x6509('0x1d')](function(_0x4344f2){if(!_0x4344f2){throw new APINotFoundError(util[_0x6509('0x40')](_0x6509('0xae'),_0x20c370[_0x6509('0x62')]['id']));}if(_0x1c264e){return checkWebsiteInterval(_0x4344f2);}return _0x4344f2;})['then'](function(_0x2bc776){_0x278d45[_0x6509('0xaf')]=_0x2bc776;_0x278d45[_0x6509('0xb0')]=_[_0x6509('0xb1')](_0x2bc776[_0x6509('0xab')],[_0x6509('0xb2')],[_0x6509('0xb3')]);if(_0x278d45[_0x6509('0xaf')]['Applications']){delete _0x278d45[_0x6509('0xaf')][_0x6509('0xab')];}_0x278d45[_0x6509('0xb4')]=_0x2bc776['List']||{'id':_0x2bc776[_0x6509('0xb5')]};if(_0x278d45[_0x6509('0xb4')]&&_0x278d45[_0x6509('0xb4')]['Contacts'][_0x6509('0x63')]){return _0x278d45['list']['Contacts'][0x0];}var _0xb1613f=_[_0x6509('0x15')](_0x20c370[_0x6509('0x68')],{'firstName':_0x20c370[_0x6509('0x68')][_0x6509('0xb6')],'ListId':_0x2bc776[_0x6509('0xb5')]});_0xb1613f[_0x20c370['body'][_0x6509('0x9d')]]=_0x20c370[_0x6509('0x68')]['from'];return db['CmContact'][_0x6509('0x66')](_0xb1613f,{'fields':_0x170635,'raw':!![]});})['then'](function(_0x54b063){_0x278d45[_0x6509('0xb7')]=_0x54b063;var _0x3595b6=createInteractionObject(_0x20c370[_0x6509('0x62')]['id'],_0x20c370['body'],_0x20c370[_0x6509('0xb8')],_0x54b063);var _0x5d6f0e={'ChatWebsiteId':_0x20c370[_0x6509('0x62')]['id']};if(_0x20c370[_0x6509('0x68')][_0x6509('0xb9')]){_0x5d6f0e['threadId']=_0x20c370[_0x6509('0x68')][_0x6509('0xb9')];_0x5d6f0e[_0x6509('0xba')]=![];return db[_0x6509('0xbb')][_0x6509('0x64')]({'where':_0x5d6f0e})['then'](function(_0x1372be){var _0x4057e0=_0x20c370[_0x6509('0x68')][_0x6509('0x36')]&&_0x20c370[_0x6509('0x68')][_0x6509('0x3d')];if(_0x1372be){_0x169938=!![];return _0x1372be;}else if(!_0x4057e0&&_0x1372be&&_0x1372be['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x3595b6[_0x6509('0xb9')]=_0x20c370[_0x6509('0x68')]['threadId'];_0x3595b6[_0x6509('0xbc')]=_0x20c370[_0x6509('0x68')]['externalUrl'];return db['ChatInteraction'][_0x6509('0x66')](_0x3595b6);});}_0x5d6f0e['ContactId']=_0x54b063['id'];if(_0x20c370[_0x6509('0x68')]['interaction']&&_0x20c370[_0x6509('0x68')][_0x6509('0xbd')]['id']){_0x5d6f0e['id']=_0x20c370[_0x6509('0x68')][_0x6509('0xbd')]['id'];return db['ChatInteraction']['find']({'where':_0x5d6f0e})['then'](function(_0x4f0357){var _0x3667c3=_0x20c370[_0x6509('0x68')][_0x6509('0x36')]&&_0x20c370[_0x6509('0x68')]['referer'];if(!_0x3667c3&&_0x4f0357&&_0x4f0357[_0x6509('0xba')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x4f0357){_0x169938=!![];return _0x4f0357;}else{return db[_0x6509('0xbb')][_0x6509('0x66')](_0x3595b6);}});}return db[_0x6509('0xbb')]['create'](_0x3595b6);})[_0x6509('0x1d')](function(_0x28f24d){if(!_0x169938){return _0x28f24d;}var _0x524f73={'from':(_0x278d45[_0x6509('0xb7')][_0x6509('0xbe')]||'')+'\x20'+(_0x278d45['contact']['lastName']||'')};if(_0x20c370[_0x6509('0x68')][_0x6509('0xb9')]&&_0x20c370[_0x6509('0x68')][_0x6509('0xbf')]&&_0x20c370[_0x6509('0x68')][_0x6509('0xb9')]!=_0x20c370[_0x6509('0x68')][_0x6509('0xbf')]){_0x524f73['threadId']=_0x20c370[_0x6509('0x68')][_0x6509('0xbf')];}return _0x28f24d['update'](_0x524f73);})[_0x6509('0x1d')](function(_0x42d891){_0x278d45[_0x6509('0xbd')]=_0x42d891[_0x6509('0x2d')]({'plain':!![]});_0x278d45[_0x6509('0xbd')][_0x6509('0xc0')]=!_0x169938;if(_0x278d45[_0x6509('0xbd')][_0x6509('0xc0')]){if(_0x278d45[_0x6509('0xaf')][_0x6509('0xc1')]){_0x278d45['applications']['push']({'id':0x0,'priority':_0x278d45[_0x6509('0xb0')]['length']+0x1,'app':_0x6509('0xc2'),'appdata':_0x6509('0xc3'),'interval':'*,*,*,*'});}}return db[_0x6509('0xc4')][_0x6509('0x66')]({'body':_0x20c370[_0x6509('0x68')]['body'],'ChatWebsiteId':_0x20c370[_0x6509('0x62')]['id'],'ChatInteractionId':_0x42d891['id'],'direction':'in','ContactId':_0x278d45[_0x6509('0xb7')]['id'],'AttachmentId':_0x20c370['body'][_0x6509('0xc5')]});})[_0x6509('0x1d')](function(_0x16e17c){_0x278d45[_0x6509('0x24')]=_0x16e17c;if(!_0x278d45[_0x6509('0xbd')][_0x6509('0xc6')]){return;}return db['User']['find']({'attributes':['id',_0x6509('0x31')],'where':{'id':_0x278d45[_0x6509('0xbd')]['UserId']}});})['then'](function(_0x15ef3c){if(_0x15ef3c){_0x278d45['applications'][_0x6509('0xc7')]({'id':0x0,'priority':0x0,'app':_0x6509('0xc8'),'appdata':_0x15ef3c[_0x6509('0x31')]+','+(_0x278d45[_0x6509('0xaf')]['waitForTheAssignedAgent']||0xa),'interval':_0x6509('0xc9')});_0x278d45[_0x6509('0xca')]=!![];}if(!_0x278d45[_0x6509('0xbd')][_0x6509('0xcb')]){return;}return db[_0x6509('0xcc')][_0x6509('0x64')]({'attributes':['id','name'],'where':{'id':_0x278d45[_0x6509('0xbd')]['queueId']}});})[_0x6509('0x1d')](function(_0x4adf80){if(_0x4adf80){_0x278d45[_0x6509('0xb0')]['unshift']({'id':0x0,'priority':0x1,'app':_0x6509('0xcd'),'appdata':_0x4adf80[_0x6509('0x31')]+','+(_0x278d45['account'][_0x6509('0xce')]||0x12c),'interval':_0x6509('0xc9')});}return respondWithRpcPromise(_0x6509('0xcf'),'startRouting',_0x278d45);})[_0x6509('0x1d')](function(_0x3179f2){respondWithRpcPromise('EventManager',_0x6509('0xd0'),{'event':'notify','message':_0x3179f2},client9002);return _0x3179f2;})['then'](respondWithResult(_0x193d70,null))[_0x6509('0x65')](APIHandleError(_0x193d70));};exports[_0x6509('0xd1')]=function(_0x2a3f9a,_0x56aeea){var _0x110e2c,_0x278975,_0x1c13e0;var _0x40aaa1=[];var _0x436b4b={};var _0x57866f=_0x2a3f9a[_0x6509('0xd2')]||[];var _0x5c390a=[];var _0x1de4b8;return db['CmContact'][_0x6509('0x70')]()['then'](function(_0x27cf36){if(!_0x27cf36){throw new db['Sequelize'][(_0x6509('0xd3'))]('no\x20available\x20attributes');}_0x40aaa1=_[_0x6509('0xd4')](_['keys'](_0x27cf36),[_0x6509('0xa2'),_0x6509('0xa3'),_0x6509('0xa4'),_0x6509('0xb5')]);if(_0x2a3f9a[_0x6509('0x68')]['id']){delete _0x2a3f9a[_0x6509('0x68')]['id'];}if(_[_0x6509('0x8e')](_0x2a3f9a[_0x6509('0x68')][_0x6509('0xb6')])){throw _0x56aeea[_0x6509('0x27')](0x1f4)[_0x6509('0xd5')](new db[(_0x6509('0xd6'))][(_0x6509('0xd3'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x2a3f9a['body'][_0x6509('0x68')])||_0x2a3f9a['body'][_0x6509('0x68')]===''){throw _0x56aeea[_0x6509('0x27')](0x1f4)[_0x6509('0xd5')](new db[(_0x6509('0xd6'))][(_0x6509('0xd3'))](_0x6509('0xd7')));}if(_[_0x6509('0x8e')](_0x2a3f9a[_0x6509('0x68')]['mapKeyOffline'])){throw _0x56aeea['status'](0x1f4)[_0x6509('0xd5')](new db['Sequelize'][(_0x6509('0xd3'))](_0x6509('0xd8')+_0x40aaa1));}if(!_[_0x6509('0xa5')](_0x40aaa1,_0x2a3f9a[_0x6509('0x68')][_0x6509('0xd9')])){throw _0x56aeea['status'](0x1f4)[_0x6509('0xd5')](new db[(_0x6509('0xd6'))][(_0x6509('0xd3'))](_0x6509('0xda')+_0x40aaa1));}_0x436b4b[_0x2a3f9a['body'][_0x6509('0xd9')]]=_0x2a3f9a['body'][_0x6509('0xb6')];})[_0x6509('0x1d')](function(){return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x2a3f9a['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x6509('0xdb')],'as':_0x6509('0xdb')}]});})['then'](handleEntityNotFound(_0x56aeea,null))[_0x6509('0x1d')](function(_0x49172e){if(_0x49172e&&_0x49172e[_0x6509('0xa7')]){_0x278975=_0x49172e;var _0x55d74e=_[_0x6509('0x15')](_0x2a3f9a[_0x6509('0x68')],{'firstName':_0x2a3f9a[_0x6509('0x68')][_0x6509('0xb6')],'phone':_0x2a3f9a[_0x6509('0x68')][_0x6509('0xb6')],'ListId':_0x49172e[_0x6509('0xb5')]});_0x55d74e[_0x2a3f9a[_0x6509('0x68')]['mapKeyOffline']]=_0x2a3f9a[_0x6509('0x68')][_0x6509('0xb6')];return db[_0x6509('0xa0')][_0x6509('0xdc')]({'where':_0x436b4b,'defaults':_0x55d74e});}})[_0x6509('0xdd')](function(_0xb45f5d){if(_0xb45f5d){_0x1c13e0=_0xb45f5d;var _0x52cc3b=fs[_0x6509('0xde')](path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0xdf')),'utf8');var _0x4bc48b=ejs[_0x6509('0xe0')](_0x52cc3b,{'body':_[_0x6509('0xe1')](_0x2a3f9a['body']['body']),'bodyTitle':_0x278975[_0x6509('0xe2')]});return db['ChatOfflineMessage'][_0x6509('0x66')]({'body':_0x4bc48b,'plainBody':htmlToText[_0x6509('0xe3')](_0x4bc48b),'ContactId':_0xb45f5d['id'],'ChatWebsiteId':_0x278975['id']});}})['then'](function(_0x114439){_0x1de4b8=_0x114439;if(_0x57866f[_0x6509('0x63')]){var _0x568d63=_0x57866f[_0x6509('0x4e')](function(_0x4a7359){return{'name':_0x4a7359[_0x6509('0xe4')],'basename':_0x4a7359[_0x6509('0x84')],'type':_0x4a7359['mimetype'],'ChatOfflineMessageId':_0x114439['id']};});_0x5c390a=_0x568d63[_0x6509('0x4e')](_0x45d749=>{var _0x50e1a4={'filename':_0x45d749[_0x6509('0x31')],'path':path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0xe5'),'files',_0x6509('0xe6'),_0x6509('0xe7'),_0x45d749[_0x6509('0xe8')])};return _0x50e1a4;});if(!_0x278975[_0x6509('0xe9')]){return db[_0x6509('0xea')][_0x6509('0xeb')](function(_0x54e3b9){return db[_0x6509('0xec')][_0x6509('0xed')](_0x568d63,{'transaction':_0x54e3b9});});}}})[_0x6509('0x1d')](function(){if(_0x1de4b8){_0x110e2c=_0x1de4b8;return db[_0x6509('0xdb')][_0x6509('0x75')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x6509('0xee'),'raw':!![],'include':[{'model':db[_0x6509('0xef')],'as':_0x6509('0xef'),'raw':!![]}]}]});}})[_0x6509('0x1d')](function(_0x3e5565){if(_0x3e5565&&_0x3e5565[_0x6509('0xee')]&&_0x278975[_0x6509('0xf0')]&&_0x278975[_0x6509('0xf1')]){var _0x172e8f=_0x3e5565['getSmtpOptions']();return respondWithRpcPromise(_0x6509('0xf2'),_0x6509('0xf3'),{'account':_0x172e8f,'message':{'from':util[_0x6509('0x40')](_0x6509('0xf4'),_0x3e5565[_0x6509('0x31')],_0x3e5565[_0x6509('0xf5')]||_0x3e5565[_0x6509('0xee')]['user']),'to':_0x278975[_0x6509('0xf1')],'subject':_0x278975[_0x6509('0xf6')],'html':_0x110e2c[_0x6509('0x68')],'attachments':_0x5c390a}},client9003)[_0x6509('0x1d')](function(){return _0x110e2c;})[_0x6509('0x65')](function(_0x1494d4){logger[_0x6509('0x21')](_0x1494d4);});}})[_0x6509('0x1d')](function(){if(_0x278975&&_0x278975[_0x6509('0xe9')]&&_0x278975['MailAccountId']){var _0x13c12d=[];if(_0x57866f[_0x6509('0x63')]){_0x13c12d=_0x57866f[_0x6509('0x4e')](function(_0x4f7d4b){return{'name':_0x4f7d4b[_0x6509('0xe4')],'basename':_0x4f7d4b[_0x6509('0x84')],'type':_0x4f7d4b[_0x6509('0xf7')],'ChatOfflineMessageId':_0x1de4b8['id']};});}var _0x1d6026;if(!_[_0x6509('0x8e')](_0x278975[_0x6509('0xf8')])){var _0x5fc214=_[_0x6509('0x4e')](_0x2a3f9a[_0x6509('0x68')],function(_0x5d71e7){return _0x5d71e7;});var _0x488e99=_[_0x6509('0xf9')](_0x5fc214)[0x0];var _0x372a76=_[_0x6509('0xfa')](_0x488e99,function(_0x2b52ce){return _0x2b52ce;});_0x1d6026=_0x372a76[0x1][_0x278975[_0x6509('0xf8')]];}var _0x310a9c={'from':_0x1c13e0[_0x6509('0xf5')],'firstName':_0x1c13e0[_0x6509('0xbe')],'lastName':_0x1c13e0['lastName'],'mapKey':_0x6509('0xf5'),'message':{'from':_0x1c13e0[_0x6509('0xf5')],'to':_0x278975[_0x6509('0xdb')][_0x6509('0xf5')],'cc':'','subject':_['isNil'](_0x1d6026)?_0x278975[_0x6509('0xf6')]:_0x1d6026,'messageId':'','sentAt':new Date(),'attach':_0x13c12d[_0x6509('0x63')],'attachments':_0x13c12d,'originChannel':_0x6509('0xfb'),'ChatWebsiteId':_0x278975['id'],'ChatOfflineMessageId':_0x110e2c['id'],'originTo':_0x278975[_0x6509('0xdb')][_0x6509('0xf5')]},'body':_0x110e2c['body']};var _0x841651={'account':{'id':_0x278975[_0x6509('0xfc')]},'body':_0x310a9c,'log':_0x6509('0xfd')};return respondWithRpcPromise('NotifyMailAccount',_0x6509('0xfe'),_0x841651,client9001)[_0x6509('0x1d')](function(){return _0x110e2c;})[_0x6509('0x65')](function(_0x34d250){logger[_0x6509('0x21')](_0x34d250);});}return;})['then'](function(){if(_0x110e2c){return _0x110e2c;}})['then'](respondWithResult(_0x56aeea,null))[_0x6509('0x65')](function(){for(var _0x1cc558 of _0x57866f){var _0x210e0d=path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0xe5'),_0x6509('0xd2'),_0x6509('0xe6'),_0x6509('0xe7'),_0x1cc558[_0x6509('0x84')]);fs_extra['remove'](_0x210e0d)[_0x6509('0x65')](function(_0x9532cc){logger['error'](_0x6509('0xff'),_0x210e0d,_0x9532cc);});}});};exports['addInteraction']=function(_0x5c2bd8,_0x468dd2){return db[_0x6509('0xbb')][_0x6509('0x64')]({'where':{'id':_0x5c2bd8[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x468dd2,null))[_0x6509('0x1d')](function(_0x4ed066){if(_0x4ed066){return _0x4ed066[_0x6509('0x100')](_0x5c2bd8[_0x6509('0x68')][_0x6509('0x7e')],_[_0x6509('0x101')](_0x5c2bd8[_0x6509('0x68')],[_0x6509('0x7e'),'id'])||{});}})[_0x6509('0x1d')](respondWithResult(_0x468dd2,null))[_0x6509('0x65')](handleError(_0x468dd2,null));};exports[_0x6509('0x102')]=function(_0x33266a,_0x28a9ad){var _0x58677d={'raw':![],'where':{}};var _0x27db56={};var _0x2e12e3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6509('0x75')]({'where':{'id':_0x33266a['params']['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x28a9ad,null))[_0x6509('0x1d')](function(_0x211fd7){if(_0x211fd7){_0x27db56[_0x6509('0x44')]=_[_0x6509('0x50')](db[_0x6509('0xbb')][_0x6509('0x4c')]);_0x27db56[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x33266a[_0x6509('0x4f')]);_0x27db56[_0x6509('0x58')]=_[_0x6509('0x51')](_0x27db56['model'],_0x27db56['query']);_0x58677d[_0x6509('0x52')]=_[_0x6509('0x51')](_0x27db56[_0x6509('0x44')],qs['fields'](_0x33266a[_0x6509('0x4f')][_0x6509('0x53')]));_0x58677d[_0x6509('0x52')]=_0x58677d['attributes'][_0x6509('0x63')]?_0x58677d[_0x6509('0x52')]:_0x27db56[_0x6509('0x44')];if(!_0x33266a[_0x6509('0x4f')][_0x6509('0x76')](_0x6509('0x54'))){_0x58677d[_0x6509('0x55')]=qs[_0x6509('0x55')](_0x33266a['query'][_0x6509('0x55')]);_0x58677d['offset']=qs[_0x6509('0x29')](_0x33266a[_0x6509('0x4f')][_0x6509('0x29')]);}_0x58677d[_0x6509('0x77')]=qs[_0x6509('0x56')](_0x33266a['query'][_0x6509('0x56')]);_0x58677d['where']=qs[_0x6509('0x58')](_[_0x6509('0x59')](_0x33266a[_0x6509('0x4f')],_0x27db56['filters']));_0x58677d[_0x6509('0x57')][_0x6509('0x72')]=_0x211fd7['id'];if(_0x33266a[_0x6509('0x4f')][_0x6509('0x5a')]){_0x58677d[_0x6509('0x57')]=_[_0x6509('0x5b')](_0x58677d[_0x6509('0x57')],{'$or':_[_0x6509('0x4e')](_0x58677d[_0x6509('0x52')],function(_0x538ebe){var _0x3ec479={};_0x3ec479[_0x538ebe]={'$like':'%'+_0x33266a['query']['filter']+'%'};return _0x3ec479;})});}_0x58677d=_[_0x6509('0x5b')]({},_0x58677d,_0x33266a['options']);return db['ChatInteraction'][_0x6509('0x2b')]({'where':_0x58677d[_0x6509('0x57')]})[_0x6509('0x1d')](function(_0x542701){_0x2e12e3[_0x6509('0x2b')]=_0x542701;if(_0x33266a['query'][_0x6509('0x5e')]){_0x58677d[_0x6509('0x5f')]=[{'model':db['CmContact'],'as':_0x6509('0x103'),'required':![]},{'model':db['User'],'as':_0x6509('0x104'),'attributes':[_0x6509('0x31'),'fullname',_0x6509('0x105')],'required':![]},{'model':db[_0x6509('0x106')],'as':_0x6509('0x107'),'attributes':['id',_0x6509('0x31'),'color'],'where':_0x33266a[_0x6509('0x4f')][_0x6509('0x108')]?{'id':_0x33266a[_0x6509('0x4f')][_0x6509('0x108')]}:undefined,'required':_0x33266a[_0x6509('0x4f')]['tag']?!![]:![]}];}return db[_0x6509('0xbb')][_0x6509('0x78')](_0x58677d);})[_0x6509('0x1d')](function(_0x4642b8){_0x2e12e3[_0x6509('0x60')]=_0x4642b8;return _0x2e12e3;});}})[_0x6509('0x1d')](respondWithFilteredResult(_0x28a9ad,_0x58677d))[_0x6509('0x65')](handleError(_0x28a9ad,null));};exports[_0x6509('0x109')]=function(_0x3d1db9,_0x2e2292){var _0x3a84dd=0x0;var _0x69f4=0x0;var _0x1821f5=![];var _0x7fa3de;var _0x293af9;return db['ChatWebsite'][_0x6509('0x64')]({'where':{'id':_0x3d1db9[_0x6509('0x62')]['id']},'include':[{'model':db[_0x6509('0xac')],'as':_0x6509('0xac'),'include':[{'model':db[_0x6509('0xac')],'as':_0x6509('0xad'),'attributes':['id',_0x6509('0x10a')]}]}]})[_0x6509('0x1d')](handleEntityNotFound(_0x2e2292,null))[_0x6509('0x1d')](function(_0x388a4f){if(_0x388a4f){_0x7fa3de=_0x388a4f;return _0x388a4f[_0x6509('0x10b')]({'raw':!![]});}})[_0x6509('0x1d')](function(_0x298039){if(_0x7fa3de){if(_0x298039){_0x293af9=_0x298039;}}return require(_0x6509('0x8b'))[_0x6509('0x8c')]();})[_0x6509('0x1d')](function(_0x39b762){if(_0x39b762){_0x69f4=_0x39b762[_0x6509('0x10c')];_0x1821f5=_0x39b762[_0x6509('0x8d')];}})[_0x6509('0x1d')](function(){return db[_0x6509('0xbb')][_0x6509('0x2b')]({'where':{'closed':![]}});})[_0x6509('0x1d')](function(_0x18ad10){_0x3a84dd=_0x18ad10;if(_0x69f4&&_0x18ad10>_0x69f4){return db[_0x6509('0x10d')][_0x6509('0x75')]({'where':{'id':0x1}})['then'](function(_0x146353){if(_0x146353){_0x146353[_0x6509('0x10e')](_0x6509('0x10f'));}});}})[_0x6509('0x1d')](function(){var _0x3ee6a9=_0x7fa3de[_0x6509('0xac')];var _0x4bb759=_0x7fa3de[_0x6509('0x98')]||undefined;return _0x3ee6a9?_0x3ee6a9[_0x6509('0x99')](_0x4bb759):!![];})['then'](function(_0x3525dc){var _0x2cc222=fs[_0x6509('0xde')](path[_0x6509('0x89')](config[_0x6509('0x8a')],_0x6509('0x110')),_0x6509('0x111'));var _0x222a5f=_0x6509('0x112');var _0x19d233=![];try{const _0x249f86=new URL(_0x7fa3de['address']);_0x7fa3de[_0x6509('0x69')]=_0x249f86[_0x6509('0x113')];}catch(_0x5332b2){}var _0x160fe8;if(_0x3d1db9[_0x6509('0xb8')][_0x6509('0x3d')]){_0x3d1db9[_0x6509('0xb8')][_0x6509('0x3d')]=_0x3d1db9[_0x6509('0xb8')][_0x6509('0x3d')]['replace'](/\/$/,'');_0x160fe8=wildcardUtils['testWebsiteWithWildcard'](_0x7fa3de['address'],_0x3d1db9['headers'][_0x6509('0x3d')]);}else{_0x3d1db9[_0x6509('0xb8')][_0x6509('0x3d')]=_0x7fa3de['address'];_0x160fe8=!![];}var _0x3f22af={'chatVersion':_0x222a5f,'chatWebsiteAddressOrigin':_0x160fe8?_0x3d1db9[_0x6509('0xb8')]['referer']:_0x7fa3de['address'],'remote':_0x7fa3de[_0x6509('0x114')],'query':querystring[_0x6509('0x48')](_[_0x6509('0x5b')](_0x7fa3de[_0x6509('0x2d')]({'plain':!![]}),{'customerIp':_0x3d1db9[_0x6509('0xb8')]['x-forwarded-for']||_0x3d1db9[_0x6509('0xb8')]['x-real-ip']||_0x3d1db9[_0x6509('0x115')][_0x6509('0x116')]||_0x3d1db9['ip'],'referer':_0x3d1db9[_0x6509('0xb8')]['referer'],'openedInteractions':_0x3a84dd,'maxInteractions':_0x69f4,'virtual':_0x1821f5[_0x6509('0x10c')],'online':_0x3525dc,'custom':_0x1821f5,'address':_0x160fe8?_0x3d1db9['headers'][_0x6509('0x3d')]:null}))[_0x6509('0x117')](/'/g,'\x5c\x27')};_0x2e2292[_0x6509('0xd5')](ejs[_0x6509('0xe0')](Mustache[_0x6509('0xe0')](_0x2cc222,_0x3f22af),{'proactiveActions':_0x293af9,'alignment':_0x7fa3de[_0x6509('0x118')],'verticalAlignment':_0x7fa3de['verticalAlignment'],'div_color':_0x7fa3de[_0x6509('0x119')],'labelText':_0x7fa3de[_0x6509('0x11a')],'text_color':_0x7fa3de[_0x6509('0x11b')],'text_button_color':_0x7fa3de[_0x6509('0x11c')],'button_color':_0x7fa3de[_0x6509('0x11d')],'background_color':_0x7fa3de['backgroundColor'],'hideWhenOffline':_0x7fa3de[_0x6509('0x11e')],'intervalId':_0x7fa3de[_0x6509('0x11f')],'isDevelopment':_0x19d233,'chatVersion':_0x222a5f}));})[_0x6509('0x65')](handleError(_0x2e2292,null));};exports[_0x6509('0x120')]=function(_0x54afd6,_0x4069e2){var _0x3afc9d=_0x54afd6['params']['id'];var _0x46c887=_0x54afd6[_0x6509('0x68')];var _0x4240a3=0xc8;var _0xa8a847=null;return db[_0x6509('0xea')][_0x6509('0xeb')]({'isolationLevel':db[_0x6509('0xea')][_0x6509('0x121')][_0x6509('0x122')][_0x6509('0x123')]},function(_0x4c8c87){return db[_0x6509('0x4b')][_0x6509('0x75')]({'where':{'id':_0x3afc9d},'transaction':_0x4c8c87})[_0x6509('0x1d')](function(_0x3b4458){if(_0x3b4458){return db[_0x6509('0xaa')]['destroy']({'where':{'ChatWebsiteId':_0x3afc9d},'transaction':_0x4c8c87})[_0x6509('0x1d')](function(){var _0x21bd8b=_[_0x6509('0x4e')](_0x46c887,function(_0x56a0ea){_0x56a0ea['ChatWebsiteId']=_0x3afc9d;return _0x56a0ea;});return db[_0x6509('0xaa')][_0x6509('0xed')](_0x21bd8b,{'transaction':_0x4c8c87});});}else{_0x4240a3=0x194;_0xa8a847=[];}});})[_0x6509('0x1d')](function(){if(_0x4240a3!==0x194){return db['ChatApplication'][_0x6509('0x124')]({'where':{'ChatWebsiteId':_0x3afc9d},'order':_0x6509('0xb2')})[_0x6509('0x1d')](function(_0x42bb2c){_0xa8a847=_0x42bb2c;});}})[_0x6509('0x65')](function(_0x4688b0){_0x4240a3=0x1f4;logger[_0x6509('0x21')](_0x4688b0[_0x6509('0x30')]);if(_0x4688b0[_0x6509('0x31')]){delete _0x4688b0[_0x6509('0x31')];}_0xa8a847=_0x4688b0;})[_0x6509('0x125')](function(){if(_0xa8a847===null){_0x4069e2[_0x6509('0x26')](_0x4240a3);}else{if(_0x4240a3===0x1f4){_0x4069e2['status'](_0x4240a3)[_0x6509('0xd5')](_0xa8a847);}else{_0x4069e2[_0x6509('0x27')](_0x4240a3)[_0x6509('0x126')](_0xa8a847);}}});};exports['getApplications']=function(_0x3889d4,_0x17a289){var _0xbf786f={};var _0x2bcec4={};var _0x343aad;var _0x48ff9a;return db[_0x6509('0x4b')][_0x6509('0x75')]({'where':{'id':_0x3889d4['params']['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x17a289,null))[_0x6509('0x1d')](function(_0x4ccd96){if(_0x4ccd96){_0x343aad=_0x4ccd96;_0x2bcec4['model']=_[_0x6509('0x50')](db[_0x6509('0xaa')][_0x6509('0x4c')]);_0x2bcec4[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x3889d4['query']);_0x2bcec4[_0x6509('0x58')]=_[_0x6509('0x51')](_0x2bcec4['model'],_0x2bcec4['query']);_0xbf786f[_0x6509('0x52')]=_[_0x6509('0x51')](_0x2bcec4[_0x6509('0x44')],qs[_0x6509('0x53')](_0x3889d4[_0x6509('0x4f')]['fields']));_0xbf786f[_0x6509('0x52')]=_0xbf786f['attributes'][_0x6509('0x63')]?_0xbf786f[_0x6509('0x52')]:_0x2bcec4[_0x6509('0x44')];_0xbf786f['order']=qs[_0x6509('0x56')](_0x3889d4['query'][_0x6509('0x56')]);_0xbf786f[_0x6509('0x57')]=qs[_0x6509('0x58')](_[_0x6509('0x59')](_0x3889d4['query'],_0x2bcec4[_0x6509('0x58')]));if(_0x3889d4[_0x6509('0x4f')][_0x6509('0x5a')]){_0xbf786f['where']=_['merge'](_0xbf786f['where'],{'$or':_[_0x6509('0x4e')](_0xbf786f[_0x6509('0x52')],function(_0x3d02bf){var _0x4ba35e={};_0x4ba35e[_0x3d02bf]={'$like':'%'+_0x3889d4['query'][_0x6509('0x5a')]+'%'};return _0x4ba35e;})});}_0xbf786f=_[_0x6509('0x5b')]({},_0xbf786f,_0x3889d4['options']);return _0x343aad[_0x6509('0x127')](_0xbf786f);}})[_0x6509('0x1d')](function(_0x4dabf6){if(_0x4dabf6){_0x48ff9a=_0x4dabf6['length'];if(!_0x3889d4[_0x6509('0x4f')][_0x6509('0x76')](_0x6509('0x54'))){_0xbf786f['limit']=qs[_0x6509('0x55')](_0x3889d4['query'][_0x6509('0x55')]);_0xbf786f[_0x6509('0x29')]=qs[_0x6509('0x29')](_0x3889d4[_0x6509('0x4f')][_0x6509('0x29')]);}return _0x343aad[_0x6509('0x127')](_0xbf786f);}})[_0x6509('0x1d')](function(_0x5ce3f4){if(_0x5ce3f4){return _0x5ce3f4?{'count':_0x48ff9a,'rows':_0x5ce3f4}:null;}})['then'](respondWithResult(_0x17a289,null))[_0x6509('0x65')](handleError(_0x17a289,null));};exports['addProactiveActions']=function(_0x46f155,_0x4329c0){return db[_0x6509('0x128')]['find']({'where':{'id':_0x46f155[_0x6509('0x62')]['id']}})['then'](handleEntityNotFound(_0x4329c0,null))[_0x6509('0x1d')](function(_0x585285){if(_0x585285){return _0x585285[_0x6509('0x129')](_0x46f155[_0x6509('0x68')][_0x6509('0x7e')],_[_0x6509('0x101')](_0x46f155[_0x6509('0x68')],[_0x6509('0x7e'),'id'])||{});}})['then'](respondWithResult(_0x4329c0,null))[_0x6509('0x65')](handleError(_0x4329c0,null));};exports['getProactiveActions']=function(_0x3802d1,_0x2c7179){var _0x5c4108={};var _0x131a49={};var _0x2da7b4;var _0x1806be;return db[_0x6509('0x4b')][_0x6509('0x75')]({'where':{'id':_0x3802d1['params']['id']}})['then'](handleEntityNotFound(_0x2c7179,null))[_0x6509('0x1d')](function(_0x5cc69b){if(_0x5cc69b){_0x2da7b4=_0x5cc69b;_0x131a49[_0x6509('0x44')]=_[_0x6509('0x50')](db['ChatProactiveAction'][_0x6509('0x4c')]);_0x131a49[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x3802d1[_0x6509('0x4f')]);_0x131a49[_0x6509('0x58')]=_[_0x6509('0x51')](_0x131a49[_0x6509('0x44')],_0x131a49['query']);_0x5c4108[_0x6509('0x52')]=_[_0x6509('0x51')](_0x131a49[_0x6509('0x44')],qs[_0x6509('0x53')](_0x3802d1[_0x6509('0x4f')][_0x6509('0x53')]));_0x5c4108[_0x6509('0x52')]=_0x5c4108[_0x6509('0x52')][_0x6509('0x63')]?_0x5c4108[_0x6509('0x52')]:_0x131a49['model'];_0x5c4108[_0x6509('0x77')]=qs[_0x6509('0x56')](_0x3802d1[_0x6509('0x4f')][_0x6509('0x56')]);_0x5c4108['where']=qs[_0x6509('0x58')](_['pick'](_0x3802d1[_0x6509('0x4f')],_0x131a49[_0x6509('0x58')]));if(_0x3802d1['query'][_0x6509('0x5a')]){_0x5c4108[_0x6509('0x57')]=_[_0x6509('0x5b')](_0x5c4108[_0x6509('0x57')],{'$or':_[_0x6509('0x4e')](_0x5c4108[_0x6509('0x52')],function(_0x26a972){var _0x2aa41c={};_0x2aa41c[_0x26a972]={'$like':'%'+_0x3802d1[_0x6509('0x4f')]['filter']+'%'};return _0x2aa41c;})});}_0x5c4108=_['merge']({},_0x5c4108,_0x3802d1[_0x6509('0x5d')]);return _0x2da7b4['getProactiveActions'](_0x5c4108);}})[_0x6509('0x1d')](function(_0x45cea7){if(_0x45cea7){_0x1806be=_0x45cea7[_0x6509('0x63')];if(!_0x3802d1[_0x6509('0x4f')]['hasOwnProperty'](_0x6509('0x54'))){_0x5c4108[_0x6509('0x55')]=qs[_0x6509('0x55')](_0x3802d1[_0x6509('0x4f')][_0x6509('0x55')]);_0x5c4108[_0x6509('0x29')]=qs[_0x6509('0x29')](_0x3802d1[_0x6509('0x4f')][_0x6509('0x29')]);}return _0x2da7b4[_0x6509('0x10b')](_0x5c4108);}})['then'](function(_0x2de5c0){if(_0x2de5c0){return _0x2de5c0?{'count':_0x1806be,'rows':_0x2de5c0}:null;}})[_0x6509('0x1d')](respondWithResult(_0x2c7179,null))[_0x6509('0x65')](handleError(_0x2c7179,null));};exports[_0x6509('0x12a')]=function(_0x3cd06a,_0xd7fc00){var _0x51e175=_0x3cd06a[_0x6509('0x4f')]['online']==='false'?'offlineForm':_0x6509('0x12b');return db[_0x6509('0x4b')][_0x6509('0x64')]({'attributes':['id',_0x51e175],'where':{'id':_0x3cd06a[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0xd7fc00,null))['then'](function(_0x4fe515){if(_0x4fe515){var _0x535c3d=_0x4fe515[_0x51e175];var _0x161674=_0x535c3d&&_0x535c3d['items']?_0x535c3d[_0x6509('0x12c')]:[];_0xd7fc00[_0x6509('0xd5')]({'fromKey':_[_0x6509('0x8e')](_0x535c3d[_0x6509('0x12d')])?undefined:_0x535c3d['fromKey'],'count':_0x161674['length'],'rows':_0x161674});}})[_0x6509('0x65')](handleError(_0xd7fc00,null));};exports[_0x6509('0x12e')]=function(_0x5f004a,_0x59213b){var _0x2bc98b={'raw':![],'where':{}};var _0xf91ab6={};var _0x5df9fa={'count':0x0,'rows':[]};return db[_0x6509('0x4b')][_0x6509('0x75')]({'where':{'id':_0x5f004a[_0x6509('0x62')]['id']}})['then'](handleEntityNotFound(_0x59213b,null))[_0x6509('0x1d')](function(_0x967928){if(_0x967928){_0xf91ab6[_0x6509('0x44')]=_[_0x6509('0x50')](db['ChatOfflineMessage'][_0x6509('0x4c')]);_0xf91ab6[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x5f004a[_0x6509('0x4f')]);_0xf91ab6[_0x6509('0x58')]=_[_0x6509('0x51')](_0xf91ab6['model'],_0xf91ab6[_0x6509('0x4f')]);_0x2bc98b[_0x6509('0x52')]=_[_0x6509('0x51')](_0xf91ab6[_0x6509('0x44')],qs[_0x6509('0x53')](_0x5f004a['query']['fields']));_0x2bc98b[_0x6509('0x52')]=_0x2bc98b[_0x6509('0x52')][_0x6509('0x63')]?_0x2bc98b[_0x6509('0x52')]:_0xf91ab6[_0x6509('0x44')];if(!_0x5f004a['query'][_0x6509('0x76')](_0x6509('0x54'))){_0x2bc98b['limit']=qs[_0x6509('0x55')](_0x5f004a['query'][_0x6509('0x55')]);_0x2bc98b[_0x6509('0x29')]=qs[_0x6509('0x29')](_0x5f004a[_0x6509('0x4f')][_0x6509('0x29')]);}_0x2bc98b[_0x6509('0x77')]=qs[_0x6509('0x56')](_0x5f004a['query']['sort']);_0x2bc98b[_0x6509('0x57')]=qs[_0x6509('0x58')](_['pick'](_0x5f004a[_0x6509('0x4f')],_0xf91ab6[_0x6509('0x58')]));_0x2bc98b['where'][_0x6509('0x72')]=_0x967928['id'];if(_0x5f004a['query'][_0x6509('0x5a')]){_0x2bc98b['where']=_[_0x6509('0x5b')](_0x2bc98b[_0x6509('0x57')],{'$or':_[_0x6509('0x4e')](_0x2bc98b['attributes'],function(_0x2624d8){var _0x7f5a7c={};_0x7f5a7c[_0x2624d8]={'$like':'%'+_0x5f004a['query'][_0x6509('0x5a')]+'%'};return _0x7f5a7c;})});}_0x2bc98b=_[_0x6509('0x5b')]({},_0x2bc98b,_0x5f004a[_0x6509('0x5d')]);return db[_0x6509('0x12f')][_0x6509('0x2b')]({'where':_0x2bc98b[_0x6509('0x57')]})[_0x6509('0x1d')](function(_0x49b16d){_0x5df9fa[_0x6509('0x2b')]=_0x49b16d;if(_0x5f004a[_0x6509('0x4f')]['includeAll']){_0x2bc98b[_0x6509('0x5f')]=[{'all':!![]}];}else{_0x2bc98b[_0x6509('0x5f')]=[{'model':db[_0x6509('0xa0')],'as':_0x6509('0x103'),'required':![]},{'model':db['Attachment'],'as':_0x6509('0x130'),'required':![]}];}return db[_0x6509('0x12f')][_0x6509('0x78')](_0x2bc98b);})[_0x6509('0x1d')](function(_0x46c055){_0x5df9fa[_0x6509('0x60')]=_0x46c055;return _0x5df9fa;});}})[_0x6509('0x1d')](respondWithFilteredResult(_0x59213b,_0x2bc98b))['catch'](handleError(_0x59213b,null));};exports[_0x6509('0x131')]=function(_0x5e92af,_0x55cb59){return db[_0x6509('0x4b')][_0x6509('0x64')]({'where':{'id':_0x5e92af[_0x6509('0x62')]['id']}})['then'](handleEntityNotFound(_0x55cb59,null))[_0x6509('0x1d')](function(_0x52fa05){if(_0x52fa05){return _0x52fa05[_0x6509('0x131')](_0x5e92af[_0x6509('0x68')][_0x6509('0x7e')],_[_0x6509('0x101')](_0x5e92af['body'],[_0x6509('0x7e'),'id'])||{})['spread'](function(_0x3e1a15){for(var _0x30de87=0x0;_0x30de87<_0x5e92af[_0x6509('0x68')]['ids']['length'];_0x30de87+=0x1){socket[_0x6509('0x132')](_0x6509('0x133'),{'UserId':Number(_0x5e92af[_0x6509('0x68')][_0x6509('0x7e')][_0x30de87]),'ChatWebsiteId':Number(_0x5e92af[_0x6509('0x62')]['id'])});}return _0x3e1a15;});}})['then'](respondWithResult(_0x55cb59,null))[_0x6509('0x65')](handleError(_0x55cb59,null));};exports[_0x6509('0x134')]=function(_0x4c2302,_0x23725f){return db['ChatWebsite'][_0x6509('0x64')]({'where':{'id':_0x4c2302[_0x6509('0x62')]['id']}})['then'](handleEntityNotFound(_0x23725f,null))[_0x6509('0x1d')](function(_0x214ba6){if(_0x214ba6){return _0x214ba6[_0x6509('0x134')](_0x4c2302['query'][_0x6509('0x7e')])[_0x6509('0x1d')](function(){if(_['isArray'](_0x4c2302[_0x6509('0x4f')][_0x6509('0x7e')])){for(var _0x1b3d6a=0x0;_0x1b3d6a<_0x4c2302[_0x6509('0x4f')][_0x6509('0x7e')][_0x6509('0x63')];_0x1b3d6a+=0x1){socket[_0x6509('0x132')](_0x6509('0x135'),{'UserId':Number(_0x4c2302[_0x6509('0x4f')][_0x6509('0x7e')][_0x1b3d6a]),'ChatWebsiteId':Number(_0x4c2302['params']['id'])});}}else{socket['emit'](_0x6509('0x135'),{'UserId':Number(_0x4c2302['query'][_0x6509('0x7e')]),'ChatWebsiteId':Number(_0x4c2302[_0x6509('0x62')]['id'])});}});}})[_0x6509('0x1d')](respondWithStatusCode(_0x23725f,null))[_0x6509('0x65')](handleError(_0x23725f,null));};exports['getAgents']=function(_0x4fd797,_0x2611d7){var _0x206bcb={};var _0x16460a={};var _0x1f6462;var _0x374fda;return db[_0x6509('0x4b')][_0x6509('0x75')]({'where':{'id':_0x4fd797[_0x6509('0x62')]['id']}})[_0x6509('0x1d')](handleEntityNotFound(_0x2611d7,null))[_0x6509('0x1d')](function(_0x5ce300){if(_0x5ce300){_0x1f6462=_0x5ce300;_0x16460a[_0x6509('0x44')]=_[_0x6509('0x50')](db[_0x6509('0x136')][_0x6509('0x4c')]);_0x16460a[_0x6509('0x4f')]=_[_0x6509('0x50')](_0x4fd797[_0x6509('0x4f')]);_0x16460a[_0x6509('0x58')]=_[_0x6509('0x51')](_0x16460a[_0x6509('0x44')],_0x16460a[_0x6509('0x4f')]);_0x206bcb[_0x6509('0x52')]=_[_0x6509('0x51')](_0x16460a[_0x6509('0x44')],qs['fields'](_0x4fd797[_0x6509('0x4f')][_0x6509('0x53')]));_0x206bcb[_0x6509('0x52')]=_0x206bcb[_0x6509('0x52')]['length']?_0x206bcb[_0x6509('0x52')]:_0x16460a[_0x6509('0x44')];_0x206bcb[_0x6509('0x77')]=qs[_0x6509('0x56')](_0x4fd797[_0x6509('0x4f')][_0x6509('0x56')]);_0x206bcb['where']=qs[_0x6509('0x58')](_['pick'](_0x4fd797['query'],_0x16460a[_0x6509('0x58')]));if(_0x4fd797[_0x6509('0x4f')][_0x6509('0x5a')]){_0x206bcb[_0x6509('0x57')]=_[_0x6509('0x5b')](_0x206bcb[_0x6509('0x57')],{'$or':_[_0x6509('0x4e')](_0x206bcb[_0x6509('0x52')],function(_0x55fba5){var _0x1451dd={};_0x1451dd[_0x55fba5]={'$like':'%'+_0x4fd797['query'][_0x6509('0x5a')]+'%'};return _0x1451dd;})});}_0x206bcb=_[_0x6509('0x5b')]({},_0x206bcb,_0x4fd797[_0x6509('0x5d')]);return _0x1f6462[_0x6509('0x137')](_0x206bcb);}})[_0x6509('0x1d')](function(_0x5d0055){if(_0x5d0055){_0x374fda=_0x5d0055[_0x6509('0x63')];if(!_0x4fd797[_0x6509('0x4f')][_0x6509('0x76')](_0x6509('0x54'))){_0x206bcb[_0x6509('0x55')]=qs[_0x6509('0x55')](_0x4fd797['query'][_0x6509('0x55')]);_0x206bcb[_0x6509('0x29')]=qs[_0x6509('0x29')](_0x4fd797[_0x6509('0x4f')][_0x6509('0x29')]);}return _0x1f6462['getAgents'](_0x206bcb);}})[_0x6509('0x1d')](function(_0x15d848){if(_0x15d848){return _0x15d848?{'count':_0x374fda,'rows':_0x15d848}:null;}})['then'](respondWithResult(_0x2611d7,null))['catch'](handleError(_0x2611d7,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index be188bb..e6ecbdc 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 _0x83d3=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit'];(function(_0x547c35,_0x34928b){var _0x4b843b=function(_0x1bffc4){while(--_0x1bffc4){_0x547c35['push'](_0x547c35['shift']());}};_0x4b843b(++_0x34928b);}(_0x83d3,0x17c));var _0x383d=function(_0x35ce45,_0x57c22a){_0x35ce45=_0x35ce45-0x0;var _0x5cd865=_0x83d3[_0x35ce45];return _0x5cd865;};'use strict';var EventEmitter=require(_0x383d('0x0'));var ChatWebsite=require(_0x383d('0x1'))['db'][_0x383d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x383d('0x3')](0x0);var events={'afterCreate':_0x383d('0x4'),'afterUpdate':'update','afterDestroy':_0x383d('0x5')};function emitEvent(_0x1184a6){return function(_0x31cbfc,_0x202ffc,_0x52adf4){ChatWebsiteEvents[_0x383d('0x6')](_0x1184a6+':'+_0x31cbfc['id'],_0x31cbfc);ChatWebsiteEvents['emit'](_0x1184a6,_0x31cbfc);_0x52adf4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x383d('0x7')](e,emitEvent(event));}}module[_0x383d('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5ad3=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x29ec38,_0x179d68){var _0x4e1ba3=function(_0x4341b6){while(--_0x4341b6){_0x29ec38['push'](_0x29ec38['shift']());}};_0x4e1ba3(++_0x179d68);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x39cc8f,_0xb60cd8){_0x39cc8f=_0x39cc8f-0x0;var _0x15e616=_0x5ad3[_0x39cc8f];return _0x15e616;};'use strict';var EventEmitter=require(_0x35ad('0x0'));var ChatWebsite=require(_0x35ad('0x1'))['db'][_0x35ad('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x35ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ad('0x4'),'afterDestroy':_0x35ad('0x5')};function emitEvent(_0xc77352){return function(_0x69a0b3,_0x450f55,_0x1fed0d){ChatWebsiteEvents[_0x35ad('0x6')](_0xc77352+':'+_0x69a0b3['id'],_0x69a0b3);ChatWebsiteEvents[_0x35ad('0x6')](_0xc77352,_0x69a0b3);_0x1fed0d(null);};}for(var e in events){if(events[_0x35ad('0x7')](e)){var event=events[e];ChatWebsite[_0x35ad('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ce7ace3..549a9ec 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 _0x2fac=['./chatWebsite.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2fac,0x19b));var _0xc2fa=function(_0x30ad86,_0x31285b){_0x30ad86=_0x30ad86-0x0;var _0x48941a=_0x2fac[_0x30ad86];return _0x48941a;};'use strict';var _=require(_0xc2fa('0x0'));var util=require(_0xc2fa('0x1'));var logger=require(_0xc2fa('0x2'))(_0xc2fa('0x3'));var moment=require(_0xc2fa('0x4'));var BPromise=require(_0xc2fa('0x5'));var rp=require(_0xc2fa('0x6'));var fs=require('fs');var path=require(_0xc2fa('0x7'));var rimraf=require(_0xc2fa('0x8'));var config=require('../../config/environment');var attributes=require(_0xc2fa('0x9'));module[_0xc2fa('0xa')]=function(_0x1c505b,_0x52d413){return _0x1c505b[_0xc2fa('0xb')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44b2=['define','ChatWebsite','lodash','util','bluebird','path','../../config/environment','exports'];(function(_0x15e83d,_0x31f55d){var _0x35c8d3=function(_0x5cc854){while(--_0x5cc854){_0x15e83d['push'](_0x15e83d['shift']());}};_0x35c8d3(++_0x31f55d);}(_0x44b2,0x182));var _0x244b=function(_0x16c263,_0x2b7e51){_0x16c263=_0x16c263-0x0;var _0x4f1434=_0x44b2[_0x16c263];return _0x4f1434;};'use strict';var _=require(_0x244b('0x0'));var util=require(_0x244b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x244b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x244b('0x3'));var rimraf=require('rimraf');var config=require(_0x244b('0x4'));var attributes=require('./chatWebsite.attributes');module[_0x244b('0x5')]=function(_0x541c2f,_0x2ec1a4){return _0x541c2f[_0x244b('0x6')](_0x244b('0x7'),attributes,{'tableName':'chat_websites','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 845ebd7..a48528e 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 _0x4e12=['request\x20sent','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info'];(function(_0x531552,_0x2c78b4){var _0x3e0076=function(_0x4b7de6){while(--_0x4b7de6){_0x531552['push'](_0x531552['shift']());}};_0x3e0076(++_0x2c78b4);}(_0x4e12,0xaf));var _0x24e1=function(_0x65ac85,_0x588dd1){_0x65ac85=_0x65ac85-0x0;var _0x5b8e27=_0x4e12[_0x65ac85];return _0x5b8e27;};'use strict';var _=require(_0x24e1('0x0'));var util=require('util');var moment=require(_0x24e1('0x1'));var BPromise=require('bluebird');var rs=require(_0x24e1('0x2'));var fs=require('fs');var Redis=require(_0x24e1('0x3'));var db=require(_0x24e1('0x4'))['db'];var utils=require(_0x24e1('0x5'));var logger=require('../../config/logger')(_0x24e1('0x6'));var config=require(_0x24e1('0x7'));var jayson=require(_0x24e1('0x8'));var client=jayson['client'][_0x24e1('0x9')]({'port':0x232a});config[_0x24e1('0xa')]=_[_0x24e1('0xb')](config[_0x24e1('0xa')],{'host':_0x24e1('0xc'),'port':0x18eb});var socket=require(_0x24e1('0xd'))(new Redis(config[_0x24e1('0xa')]));require('./chatWebsite.socket')[_0x24e1('0xe')](socket);function respondWithRpcPromise(_0x2dfe94,_0x3a7986,_0x11483e){return new BPromise(function(_0x157eb3,_0x314ee7){return client['request'](_0x2dfe94,_0x11483e)[_0x24e1('0xf')](function(_0x3853c9){logger[_0x24e1('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x3a7986,_0x24e1('0x11'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3a7986,_0x24e1('0x11'),JSON['stringify'](_0x3853c9));if(_0x3853c9[_0x24e1('0x12')]){if(_0x3853c9[_0x24e1('0x12')][_0x24e1('0x13')]===0x1f4){logger['error'](_0x24e1('0x14'),_0x3a7986,_0x3853c9['error'][_0x24e1('0x15')]);return _0x314ee7(_0x3853c9[_0x24e1('0x12')][_0x24e1('0x15')]);}logger['error'](_0x24e1('0x14'),_0x3a7986,_0x3853c9[_0x24e1('0x12')]['message']);return _0x157eb3(_0x3853c9[_0x24e1('0x12')][_0x24e1('0x15')]);}else{logger[_0x24e1('0x10')](_0x24e1('0x14'),_0x3a7986,_0x24e1('0x11'));_0x157eb3(_0x3853c9[_0x24e1('0x16')]['message']);}})[_0x24e1('0x17')](function(_0x5e0357){logger['error'](_0x24e1('0x14'),_0x3a7986,_0x5e0357);_0x314ee7(_0x5e0357);});});} \ No newline at end of file +var _0x2bb3=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x10a66c,_0x2ffcbc){var _0x5e51f9=function(_0x5396fe){while(--_0x5396fe){_0x10a66c['push'](_0x10a66c['shift']());}};_0x5e51f9(++_0x2ffcbc);}(_0x2bb3,0x1ba));var _0x32bb=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x2bb3[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x32bb('0x0'));var util=require(_0x32bb('0x1'));var moment=require(_0x32bb('0x2'));var BPromise=require(_0x32bb('0x3'));var rs=require(_0x32bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32bb('0x5'))['db'];var utils=require(_0x32bb('0x6'));var logger=require(_0x32bb('0x7'))('rpc');var config=require(_0x32bb('0x8'));var jayson=require(_0x32bb('0x9'));var client=jayson[_0x32bb('0xa')]['http']({'port':0x232a});config[_0x32bb('0xb')]=_[_0x32bb('0xc')](config[_0x32bb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x32bb('0xd'))(new Redis(config['redis']));require(_0x32bb('0xe'))[_0x32bb('0xf')](socket);function respondWithRpcPromise(_0x3d4145,_0xe7df81,_0x1dc223){return new BPromise(function(_0x578d11,_0x454196){return client['request'](_0x3d4145,_0x1dc223)[_0x32bb('0x10')](function(_0x23bd0a){logger[_0x32bb('0x11')](_0x32bb('0x12'),_0xe7df81,_0x32bb('0x13'));logger['debug'](_0x32bb('0x14'),_0xe7df81,'request\x20sent',JSON[_0x32bb('0x15')](_0x23bd0a));if(_0x23bd0a[_0x32bb('0x16')]){if(_0x23bd0a[_0x32bb('0x16')]['code']===0x1f4){logger[_0x32bb('0x16')](_0x32bb('0x12'),_0xe7df81,_0x23bd0a[_0x32bb('0x16')][_0x32bb('0x17')]);return _0x454196(_0x23bd0a[_0x32bb('0x16')][_0x32bb('0x17')]);}logger[_0x32bb('0x16')](_0x32bb('0x12'),_0xe7df81,_0x23bd0a[_0x32bb('0x16')][_0x32bb('0x17')]);return _0x578d11(_0x23bd0a['error'][_0x32bb('0x17')]);}else{logger['info'](_0x32bb('0x12'),_0xe7df81,'request\x20sent');_0x578d11(_0x23bd0a[_0x32bb('0x18')]['message']);}})[_0x32bb('0x19')](function(_0x5d9bd2){logger[_0x32bb('0x16')](_0x32bb('0x12'),_0xe7df81,_0x5d9bd2);_0x454196(_0x5d9bd2);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4f9a8a6..3833ecd 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 _0x6bba=['./chatWebsite.events','save','remove','update','emit','removeListener','register','length','chatWebsite:'];(function(_0x2121d1,_0x3e17d6){var _0x404ec5=function(_0x2e4bc4){while(--_0x2e4bc4){_0x2121d1['push'](_0x2121d1['shift']());}};_0x404ec5(++_0x3e17d6);}(_0x6bba,0x1d4));var _0xa6bb=function(_0x44b057,_0x4f87f2){_0x44b057=_0x44b057-0x0;var _0x440a12=_0x6bba[_0x44b057];return _0x440a12;};'use strict';var ChatWebsiteEvents=require(_0xa6bb('0x0'));var events=[_0xa6bb('0x1'),_0xa6bb('0x2'),_0xa6bb('0x3')];function createListener(_0x153e0c,_0x1a9d36){return function(_0x40ee84){_0x1a9d36[_0xa6bb('0x4')](_0x153e0c,_0x40ee84);};}function removeListener(_0x112395,_0x2b8fc5){return function(){ChatWebsiteEvents[_0xa6bb('0x5')](_0x112395,_0x2b8fc5);};}exports[_0xa6bb('0x6')]=function(_0x30fa98){for(var _0x30f4c2=0x0,_0x3ae261=events[_0xa6bb('0x7')];_0x30f4c2<_0x3ae261;_0x30f4c2++){var _0xe17311=events[_0x30f4c2];var _0xcbc5e5=createListener(_0xa6bb('0x8')+_0xe17311,_0x30fa98);ChatWebsiteEvents['on'](_0xe17311,_0xcbc5e5);}}; \ No newline at end of file +var _0x0383=['remove','update','emit','removeListener','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x6e6589,_0x2fb432){var _0x105522=function(_0x3da193){while(--_0x3da193){_0x6e6589['push'](_0x6e6589['shift']());}};_0x105522(++_0x2fb432);}(_0x0383,0xf6));var _0x3038=function(_0x12dcc2,_0x213ca4){_0x12dcc2=_0x12dcc2-0x0;var _0x337017=_0x0383[_0x12dcc2];return _0x337017;};'use strict';var ChatWebsiteEvents=require(_0x3038('0x0'));var events=[_0x3038('0x1'),_0x3038('0x2'),_0x3038('0x3')];function createListener(_0x457a33,_0x164031){return function(_0x2e390d){_0x164031[_0x3038('0x4')](_0x457a33,_0x2e390d);};}function removeListener(_0x27ca42,_0x44d702){return function(){ChatWebsiteEvents[_0x3038('0x5')](_0x27ca42,_0x44d702);};}exports['register']=function(_0x3fd684){for(var _0x15f9a2=0x0,_0x594738=events[_0x3038('0x6')];_0x15f9a2<_0x594738;_0x15f9a2++){var _0xd55ce3=events[_0x15f9a2];var _0x1f2987=createListener(_0x3038('0x7')+_0xd55ce3,_0x3fd684);ChatWebsiteEvents['on'](_0xd55ce3,_0x1f2987);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 8f94f96..512d070 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6931=['test','([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','replace'];(function(_0x581efc,_0x51d419){var _0xf5939d=function(_0x10ffaa){while(--_0x10ffaa){_0x581efc['push'](_0x581efc['shift']());}};_0xf5939d(++_0x51d419);}(_0x6931,0xa5));var _0x1693=function(_0x4ac6c7,_0xcb8ac3){_0x4ac6c7=_0x4ac6c7-0x0;var _0x741168=_0x6931[_0x4ac6c7];return _0x741168;};var escapeRegExp=require(_0x1693('0x0'))[_0x1693('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0x7828b9){let _0x190052=!![];try{new URL(_0x7828b9[_0x1693('0x2')]('*','localhost'));}catch(_0x1c8ac6){_0x190052=![];}return _0x190052&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x1693('0x3')](_0x7828b9);}function testWebsiteWithWildcard(_0x2c6ed0,_0x576a1d){let _0x361381;const _0x4bd166=escapeRegExp(_0x2c6ed0)[_0x1693('0x2')]('\x5c*',_0x1693('0x4'));try{new URL(_0x2c6ed0[_0x1693('0x2')]('\x5c*',_0x1693('0x5')));_0x361381=new RegExp(_0x4bd166)[_0x1693('0x3')](_0x576a1d);}catch(_0x1c3da1){_0x361381=![];}return _0x361381;}module[_0x1693('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xf290=['replace','localhost','test','([\x5cw]+)','exports','escapeRegExp','URL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf290,0xde));var _0x0f29=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0xf290[_0x3c4a7c];return _0xf13d1e;};var escapeRegExp=require('../../../utils/misc')[_0x0f29('0x0')];var URL=require('url')[_0x0f29('0x1')];function testWildcardValidity(_0x4b16e4){let _0xb8a620=!![];try{new URL(_0x4b16e4[_0x0f29('0x2')]('*',_0x0f29('0x3')));}catch(_0x28b644){_0xb8a620=![];}return _0xb8a620&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x0f29('0x4')](_0x4b16e4);}function testWebsiteWithWildcard(_0x5984ba,_0x45d37d){let _0x4911fb;const _0x2d5350=escapeRegExp(_0x5984ba)[_0x0f29('0x2')]('\x5c*',_0x0f29('0x5'));try{new URL(_0x5984ba[_0x0f29('0x2')]('\x5c*',_0x0f29('0x3')));_0x4911fb=new RegExp(_0x2d5350)[_0x0f29('0x4')](_0x45d37d);}catch(_0x2be26e){_0x4911fb=![];}return _0x4911fb;}module[_0x0f29('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7c172b3..fc3922a 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 _0x983e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','addDisposition','join','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','format','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','any','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router'];(function(_0x37cf70,_0x3a4c38){var _0xc24675=function(_0x4ae381){while(--_0x4ae381){_0x37cf70['push'](_0x37cf70['shift']());}};_0xc24675(++_0x3a4c38);}(_0x983e,0x113));var _0xe983=function(_0xbee8ad,_0x1595fb){_0xbee8ad=_0xbee8ad-0x0;var _0x4665ff=_0x983e[_0xbee8ad];return _0x4665ff;};'use strict';var multer=require('multer');var util=require(_0xe983('0x0'));var path=require(_0xe983('0x1'));var timeout=require(_0xe983('0x2'));var express=require(_0xe983('0x3'));var router=express[_0xe983('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe983('0x5'));var interaction=require(_0xe983('0x6'));var config=require(_0xe983('0x7'));var controller=require(_0xe983('0x8'));router[_0xe983('0x9')]('/',auth[_0xe983('0xa')](),controller[_0xe983('0xb')]);router[_0xe983('0x9')](_0xe983('0xc'),auth[_0xe983('0xa')](),controller['describe']);router[_0xe983('0x9')](_0xe983('0xd'),auth[_0xe983('0xa')](),controller[_0xe983('0xe')]);router[_0xe983('0x9')](_0xe983('0xf'),auth['isAuthenticated'](),controller[_0xe983('0x10')]);router[_0xe983('0x9')](_0xe983('0x11'),auth[_0xe983('0xa')](),controller[_0xe983('0x12')]);router[_0xe983('0x9')](_0xe983('0x13'),controller[_0xe983('0x14')]);router[_0xe983('0x9')](_0xe983('0x15'),controller['getAvatar']);router[_0xe983('0x9')]('/:id/customer_avatar',controller[_0xe983('0x16')]);router['get'](_0xe983('0x17'),controller[_0xe983('0x18')]);router[_0xe983('0x9')](_0xe983('0x19'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe983('0x9')](_0xe983('0x1a'),controller[_0xe983('0x1b')]);router[_0xe983('0x9')](_0xe983('0x1c'),auth['isAuthenticated'](),controller[_0xe983('0x1d')]);router[_0xe983('0x9')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xe983('0x1e')]);router['get'](_0xe983('0x1f'),controller['getFields']);router[_0xe983('0x9')](_0xe983('0x20'),auth[_0xe983('0xa')](),controller[_0xe983('0x21')]);router[_0xe983('0x9')]('/:id/users',auth[_0xe983('0xa')](),controller[_0xe983('0x22')]);router['post']('/',auth[_0xe983('0xa')](),controller['create']);router[_0xe983('0x23')](_0xe983('0xf'),auth[_0xe983('0xa')](),controller[_0xe983('0x24')]);router[_0xe983('0x23')]('/:id/canned_answers',auth[_0xe983('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa2d16b,_0x48a89f,_0x3d50af){_0x3d50af(null,path[_0xe983('0x25')](config[_0xe983('0x26')],_0xe983('0x27')));},'filename':function(_0x4317b2,_0x113517,_0x7ce8f3){_0x7ce8f3(null,util['format'](_0xe983('0x28'),Date[_0xe983('0x29')](),_0x113517[_0xe983('0x2a')]));}})});router[_0xe983('0x23')](_0xe983('0x13'),upload[_0xe983('0x2b')](_0xe983('0x2c')),controller[_0xe983('0x2d')]);var upload=multer({'storage':multer[_0xe983('0x2e')]({'destination':function(_0x25253d,_0x84c5a,_0x1f5f93){_0x1f5f93(null,path[_0xe983('0x25')](config[_0xe983('0x26')],_0xe983('0x2f')));},'filename':function(_0x213c9e,_0x2a7fa4,_0xc3d89b){_0xc3d89b(null,util[_0xe983('0x30')]('%s-%s',Date[_0xe983('0x29')](),_0x2a7fa4['originalname']));}})});router['post']('/:id/avatar',upload[_0xe983('0x2b')](_0xe983('0x2c')),controller[_0xe983('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e0f6a,_0x57d42a,_0x153062){_0x153062(null,path[_0xe983('0x25')](config[_0xe983('0x26')],_0xe983('0x2f')));},'filename':function(_0x3864ca,_0x25d2e9,_0xf8adfe){_0xf8adfe(null,util[_0xe983('0x30')](_0xe983('0x28'),Date['now'](),_0x25d2e9[_0xe983('0x2a')]));}})});router[_0xe983('0x23')](_0xe983('0x32'),upload[_0xe983('0x2b')](_0xe983('0x2c')),controller[_0xe983('0x33')]);var upload=multer({'storage':multer[_0xe983('0x2e')]({'destination':function(_0x53d9c2,_0x101f42,_0x483d55){_0x483d55(null,path[_0xe983('0x25')](config['root'],_0xe983('0x2f')));},'filename':function(_0x4b4431,_0x27d068,_0x5b9199){_0x5b9199(null,util[_0xe983('0x30')](_0xe983('0x28'),Date[_0xe983('0x29')](),_0x27d068[_0xe983('0x2a')]));}})});router['post'](_0xe983('0x17'),upload[_0xe983('0x2b')](_0xe983('0x2c')),controller['addSystemAvatar']);router['post'](_0xe983('0x34'),controller[_0xe983('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xe983('0x2e')]({'destination':function(_0x4a4700,_0x148da6,_0x5d355d){const _0x5212a9=path[_0xe983('0x25')](config[_0xe983('0x26')],_0xe983('0x36'),_0xe983('0x37'),_0xe983('0x38'));fs_extra['ensureDir'](_0x5212a9,function(){_0x5d355d(null,_0x5212a9);});},'filename':function(_0x5d2e5e,_0x2e0757,_0x5a4cb6){const _0x4f0311=_0x2e0757[_0xe983('0x2a')][_0xe983('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5ccd78=path['extname'](_0x4f0311);const _0x1abf80=Date[_0xe983('0x29')]()+'-'+_0x4f0311['replace'](_0x5ccd78,'')+_0x5ccd78;_0x5a4cb6(null,_0x1abf80);}})});router[_0xe983('0x23')]('/:id/offline',offlineUploadMulter[_0xe983('0x3a')](),controller['offline']);router['post'](_0xe983('0x19'),auth[_0xe983('0xa')](),controller[_0xe983('0x3b')]);router[_0xe983('0x23')](_0xe983('0x1c'),auth[_0xe983('0xa')](),controller[_0xe983('0x3c')]);router[_0xe983('0x23')]('/:id/proactive_actions',auth[_0xe983('0xa')](),controller[_0xe983('0x3d')]);router['post'](_0xe983('0x3e'),auth['isAuthenticated'](),controller[_0xe983('0x3f')]);router['put'](_0xe983('0xd'),auth[_0xe983('0xa')](),controller[_0xe983('0x40')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xe983('0xf'),auth[_0xe983('0xa')](),controller[_0xe983('0x41')]);router[_0xe983('0x42')](_0xe983('0x11'),auth['isAuthenticated'](),controller[_0xe983('0x43')]);router[_0xe983('0x42')](_0xe983('0x3e'),auth[_0xe983('0xa')](),controller[_0xe983('0x44')]);module[_0xe983('0x45')]=router; \ No newline at end of file +var _0x8626=['originalname','single','file','addLogo','root','addAvatar','server/files/images/avatars/','now','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','any','addInteraction','addApplications','addProactiveActions','/:id/users','put','update','delete','/:id','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','describe','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getAgents','create','post','addDisposition','diskStorage','join','server/files/images/logos/','format','%s-%s'];(function(_0x11a008,_0x5474ab){var _0x42aff0=function(_0x8495a8){while(--_0x8495a8){_0x11a008['push'](_0x11a008['shift']());}};_0x42aff0(++_0x5474ab);}(_0x8626,0x1be));var _0x6862=function(_0x406c8a,_0x14e83e){_0x406c8a=_0x406c8a-0x0;var _0x2ba7e6=_0x8626[_0x406c8a];return _0x2ba7e6;};'use strict';var multer=require(_0x6862('0x0'));var util=require(_0x6862('0x1'));var path=require(_0x6862('0x2'));var timeout=require(_0x6862('0x3'));var express=require(_0x6862('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6862('0x5'));var interaction=require(_0x6862('0x6'));var config=require(_0x6862('0x7'));var controller=require(_0x6862('0x8'));router['get']('/',auth[_0x6862('0x9')](),controller[_0x6862('0xa')]);router[_0x6862('0xb')]('/describe',auth[_0x6862('0x9')](),controller[_0x6862('0xc')]);router[_0x6862('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6862('0xb')](_0x6862('0xd'),auth[_0x6862('0x9')](),controller[_0x6862('0xe')]);router[_0x6862('0xb')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6862('0xf')]);router[_0x6862('0xb')](_0x6862('0x10'),controller[_0x6862('0x11')]);router[_0x6862('0xb')](_0x6862('0x12'),controller[_0x6862('0x13')]);router[_0x6862('0xb')](_0x6862('0x14'),controller[_0x6862('0x15')]);router[_0x6862('0xb')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x6862('0xb')](_0x6862('0x16'),auth[_0x6862('0x9')](),controller['getInteractions']);router[_0x6862('0xb')]('/:id/snippet',controller[_0x6862('0x17')]);router[_0x6862('0xb')](_0x6862('0x18'),auth[_0x6862('0x9')](),controller['getApplications']);router[_0x6862('0xb')](_0x6862('0x19'),auth['isAuthenticated'](),controller[_0x6862('0x1a')]);router[_0x6862('0xb')](_0x6862('0x1b'),controller['getFields']);router[_0x6862('0xb')]('/:id/offline_messages',auth[_0x6862('0x9')](),controller['getOfflineMessages']);router[_0x6862('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0x6862('0x1c')]);router['post']('/',auth[_0x6862('0x9')](),controller[_0x6862('0x1d')]);router[_0x6862('0x1e')](_0x6862('0xd'),auth[_0x6862('0x9')](),controller[_0x6862('0x1f')]);router[_0x6862('0x1e')]('/:id/canned_answers',auth[_0x6862('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x6862('0x20')]({'destination':function(_0x31f4c2,_0x5239e0,_0xb1f6c3){_0xb1f6c3(null,path[_0x6862('0x21')](config['root'],_0x6862('0x22')));},'filename':function(_0xdc856a,_0x3252b7,_0x3ca963){_0x3ca963(null,util[_0x6862('0x23')](_0x6862('0x24'),Date['now'](),_0x3252b7[_0x6862('0x25')]));}})});router[_0x6862('0x1e')]('/:id/logo',upload[_0x6862('0x26')](_0x6862('0x27')),controller[_0x6862('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c8e0f,_0x373b60,_0xf4eec9){_0xf4eec9(null,path['join'](config[_0x6862('0x29')],'server/files/images/avatars/'));},'filename':function(_0x506f8f,_0x137645,_0x33cf0a){_0x33cf0a(null,util[_0x6862('0x23')]('%s-%s',Date['now'](),_0x137645[_0x6862('0x25')]));}})});router[_0x6862('0x1e')](_0x6862('0x12'),upload[_0x6862('0x26')](_0x6862('0x27')),controller[_0x6862('0x2a')]);var upload=multer({'storage':multer[_0x6862('0x20')]({'destination':function(_0x43153c,_0x23f962,_0x2ef709){_0x2ef709(null,path['join'](config['root'],_0x6862('0x2b')));},'filename':function(_0x4fabcf,_0x1ee7d1,_0x2498e8){_0x2498e8(null,util[_0x6862('0x23')](_0x6862('0x24'),Date[_0x6862('0x2c')](),_0x1ee7d1[_0x6862('0x25')]));}})});router['post']('/:id/customer_avatar',upload[_0x6862('0x26')](_0x6862('0x27')),controller[_0x6862('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x203d29,_0x21b8ab,_0x53f885){_0x53f885(null,path[_0x6862('0x21')](config[_0x6862('0x29')],_0x6862('0x2b')));},'filename':function(_0x90fab7,_0x81be14,_0x22f5b1){_0x22f5b1(null,util[_0x6862('0x23')](_0x6862('0x24'),Date['now'](),_0x81be14[_0x6862('0x25')]));}})});router[_0x6862('0x1e')](_0x6862('0x2e'),upload[_0x6862('0x26')](_0x6862('0x27')),controller[_0x6862('0x2f')]);router[_0x6862('0x1e')](_0x6862('0x30'),controller[_0x6862('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x6862('0x20')]({'destination':function(_0x28d3dc,_0x2b8af5,_0xcccac7){const _0x13e7b5=path[_0x6862('0x21')](config[_0x6862('0x29')],_0x6862('0x32'),_0x6862('0x33'),_0x6862('0x34'));fs_extra[_0x6862('0x35')](_0x13e7b5,function(){_0xcccac7(null,_0x13e7b5);});},'filename':function(_0x9911f0,_0x86f412,_0x55ecbc){const _0x5cfc3b=_0x86f412['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x204c95=path['extname'](_0x5cfc3b);const _0x44352f=Date[_0x6862('0x2c')]()+'-'+_0x5cfc3b[_0x6862('0x36')](_0x204c95,'')+_0x204c95;_0x55ecbc(null,_0x44352f);}})});router[_0x6862('0x1e')]('/:id/offline',offlineUploadMulter[_0x6862('0x37')](),controller['offline']);router[_0x6862('0x1e')]('/:id/interactions',auth[_0x6862('0x9')](),controller[_0x6862('0x38')]);router[_0x6862('0x1e')](_0x6862('0x18'),auth[_0x6862('0x9')](),controller[_0x6862('0x39')]);router['post'](_0x6862('0x19'),auth[_0x6862('0x9')](),controller[_0x6862('0x3a')]);router[_0x6862('0x1e')](_0x6862('0x3b'),auth[_0x6862('0x9')](),controller['addAgents']);router[_0x6862('0x3c')]('/:id',auth[_0x6862('0x9')](),controller[_0x6862('0x3d')]);router[_0x6862('0x3e')](_0x6862('0x3f'),auth['isAuthenticated'](),controller[_0x6862('0x40')]);router[_0x6862('0x3e')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x6862('0x3e')](_0x6862('0x41'),auth['isAuthenticated'](),controller[_0x6862('0x42')]);router[_0x6862('0x3e')](_0x6862('0x3b'),auth[_0x6862('0x9')](),controller[_0x6862('0x43')]);module[_0x6862('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index e211704..a04d3ff 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 _0x720c=['isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','get','client-side-logger','expressEndpoint','/client-logs','use'];(function(_0x1356ca,_0x491e8a){var _0x126bee=function(_0x5b1f8b){while(--_0x5b1f8b){_0x1356ca['push'](_0x1356ca['shift']());}};_0x126bee(++_0x491e8a);}(_0x720c,0x18d));var _0xc720=function(_0x3db140,_0x88e7d0){_0x3db140=_0x3db140-0x0;var _0x5c88cf=_0x720c[_0x3db140];return _0x5c88cf;};var beaverLogger=require(_0xc720('0x0'));var express=require(_0xc720('0x1'));var auth=require(_0xc720('0x2'));var config=require(_0xc720('0x3'));var router=express['Router']();var isProduction=config[_0xc720('0x4')]===_0xc720('0x5')||![];function clientSideLogs(_0x3164fd,_0x500a0c,_0x43630f){var _0x5cc48a=_0x3164fd['app'][_0xc720('0x6')](_0xc720('0x7'));if(!_0x5cc48a){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xc720('0x8')]({'uri':_0xc720('0x9'),'logger':_0x5cc48a,'enableCors':!isProduction})(_0x3164fd,_0x500a0c,_0x43630f);}router[_0xc720('0xa')](auth[_0xc720('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xe90d=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger'];(function(_0x53c2ec,_0x56b6f8){var _0xbd4cd0=function(_0x3640d1){while(--_0x3640d1){_0x53c2ec['push'](_0x53c2ec['shift']());}};_0xbd4cd0(++_0x56b6f8);}(_0xe90d,0x10e));var _0xde90=function(_0x1063d4,_0x483c4d){_0x1063d4=_0x1063d4-0x0;var _0x408256=_0xe90d[_0x1063d4];return _0x408256;};var beaverLogger=require(_0xde90('0x0'));var express=require(_0xde90('0x1'));var auth=require(_0xde90('0x2'));var config=require(_0xde90('0x3'));var router=express[_0xde90('0x4')]();var isProduction=config[_0xde90('0x5')]===_0xde90('0x6')||![];function clientSideLogs(_0x2b7d29,_0x232229,_0x2b4d70){var _0x51e360=_0x2b7d29[_0xde90('0x7')][_0xde90('0x8')](_0xde90('0x9'));if(!_0x51e360){throw new Error(_0xde90('0xa'));}return beaverLogger[_0xde90('0xb')]({'uri':_0xde90('0xc'),'logger':_0x51e360,'enableCors':!isProduction})(_0x2b7d29,_0x232229,_0x2b4d70);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0xde90('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 056df84..e3048b7 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 _0x6fc8=['sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x25cdb6,_0x1f9fd9){var _0xf6543=function(_0x5b7828){while(--_0x5b7828){_0x25cdb6['push'](_0x25cdb6['shift']());}};_0xf6543(++_0x1f9fd9);}(_0x6fc8,0x1dc));var _0x86fc=function(_0xf8f137,_0x31cea7){_0xf8f137=_0xf8f137-0x0;var _0x4bc7f2=_0x6fc8[_0xf8f137];return _0x4bc7f2;};'use strict';var Sequelize=require(_0x86fc('0x0'));module[_0x86fc('0x1')]={'name':{'type':Sequelize[_0x86fc('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x86fc('0x3')](_0x86fc('0x4'),_0x86fc('0x5'),_0x86fc('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x86fc('0x3')](_0x86fc('0x7'),_0x86fc('0x8'))},'data1':{'type':Sequelize[_0x86fc('0x2')],'comment':_0x86fc('0x9')},'data2':{'type':Sequelize[_0x86fc('0x2')],'comment':_0x86fc('0xa')},'data3':{'type':Sequelize[_0x86fc('0x2')],'comment':_0x86fc('0xb')},'data4':{'type':Sequelize[_0x86fc('0x2')],'comment':_0x86fc('0xc')},'data5':{'type':Sequelize['TEXT'],'comment':_0x86fc('0xd')},'data6':{'type':Sequelize[_0x86fc('0xe')],'comment':_0x86fc('0xf')},'data7':{'type':Sequelize[_0x86fc('0xe')],'comment':_0x86fc('0x10')}}; \ No newline at end of file +var _0x3843=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x20d3a2,_0x267ce1){var _0x259ff=function(_0x6645c){while(--_0x6645c){_0x20d3a2['push'](_0x20d3a2['shift']());}};_0x259ff(++_0x267ce1);}(_0x3843,0x1a5));var _0x3384=function(_0x424e46,_0x45de83){_0x424e46=_0x424e46-0x0;var _0x17b7f1=_0x3843[_0x424e46];return _0x17b7f1;};'use strict';var Sequelize=require(_0x3384('0x0'));module[_0x3384('0x1')]={'name':{'type':Sequelize[_0x3384('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3384('0x3')](_0x3384('0x4'),_0x3384('0x5'),_0x3384('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3384('0x3')](_0x3384('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x3384('0x2')],'comment':_0x3384('0x8')},'data2':{'type':Sequelize[_0x3384('0x2')],'comment':_0x3384('0x9')},'data3':{'type':Sequelize['STRING'],'comment':_0x3384('0xa')},'data4':{'type':Sequelize[_0x3384('0x2')],'comment':_0x3384('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x3384('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0x3384('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d6d28d4..b83beb6 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 _0x46d7=['socket.io-emitter','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','update','then','end','error','name','send','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MicrosoftAzure','decryptString','data3','catch','show','params','keys','fields','includeAll','include','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','encryptString','findOne','generateMicrosoftAuthorizationUrl','state','parse','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x46d7,0x15a));var _0x746d=function(_0x46e3ad,_0x27b6a1){_0x46e3ad=_0x46e3ad-0x0;var _0x3947c6=_0x46d7[_0x46e3ad];return _0x3947c6;};'use strict';var _=require(_0x746d('0x0'));var Redis=require(_0x746d('0x1'));var qs=require(_0x746d('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x746d('0x3'));var logger=require(_0x746d('0x4'))(_0x746d('0x5'));var db=require(_0x746d('0x6'))['db'];var oauth=require(_0x746d('0x7'));config['redis']=_[_0x746d('0x8')](config[_0x746d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x746d('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x746d('0x9')]);function respondWithStatusCode(_0x272aed,_0x5b4915){_0x5b4915=_0x5b4915||0xcc;return function(_0x414974){if(_0x414974){return _0x272aed[_0x746d('0xb')](_0x5b4915);}return _0x272aed['status'](_0x5b4915)['end']();};}function respondWithResult(_0x1047a3,_0x29c98){_0x29c98=_0x29c98||0xc8;return function(_0x4b7690){if(_0x4b7690){return _0x1047a3['status'](_0x29c98)[_0x746d('0xc')](_0x4b7690);}};}function respondWithFilteredResult(_0x255b3b,_0x4af3e5){return function(_0x4157d6){if(_0x4157d6){var _0x1ccae1=typeof _0x4af3e5[_0x746d('0xd')]===_0x746d('0xe')&&typeof _0x4af3e5['limit']==='undefined';var _0x449bd3=_0x4157d6[_0x746d('0xf')];var _0x434b8a=_0x1ccae1?0x0:_0x4af3e5[_0x746d('0xd')];var _0x4fa766=_0x1ccae1?_0x4157d6[_0x746d('0xf')]:_0x4af3e5[_0x746d('0xd')]+_0x4af3e5[_0x746d('0x10')];var _0x1d56ba;if(_0x4fa766>=_0x449bd3){_0x4fa766=_0x449bd3;_0x1d56ba=0xc8;}else{_0x1d56ba=0xce;}_0x255b3b[_0x746d('0x11')](_0x1d56ba);return _0x255b3b[_0x746d('0x12')](_0x746d('0x13'),_0x434b8a+'-'+_0x4fa766+'/'+_0x449bd3)['json'](_0x4157d6);}return null;};}function saveUpdates(_0x3a550a){return function(_0xe92eef){if(_0xe92eef){return _0xe92eef[_0x746d('0x14')](_0x3a550a)[_0x746d('0x15')](function(_0x538fb2){return _0x538fb2;});}return null;};}function removeEntity(_0x347c08){return function(_0x556e85){if(_0x556e85){return _0x556e85['destroy']()[_0x746d('0x15')](function(){_0x347c08[_0x746d('0x11')](0xcc)[_0x746d('0x16')]();});}};}function handleEntityNotFound(_0x319bdf){return function(_0x1025c2){if(!_0x1025c2){_0x319bdf[_0x746d('0xb')](0x194);}return _0x1025c2;};}function handleError(_0x69b0b6,_0x422b8c){_0x422b8c=_0x422b8c||0x1f4;return function(_0x4fceac){logger[_0x746d('0x17')](_0x4fceac['stack']);if(_0x4fceac['name']){delete _0x4fceac[_0x746d('0x18')];}_0x69b0b6[_0x746d('0x11')](_0x422b8c)[_0x746d('0x19')](_0x4fceac);};}function maskClientSecret(_0x267adb){return _[_0x746d('0x1a')](_0x267adb[_0x746d('0x1b')](0x0,0x3),0x14,'*');}exports[_0x746d('0x1c')]=function(_0x13f80a,_0x73ab28){var _0x50c61f={},_0x261efc={},_0x469d39={'count':0x0,'rows':[]};var _0x19a22c=_['map'](db[_0x746d('0x1d')][_0x746d('0x1e')],function(_0x102c54){return{'name':_0x102c54[_0x746d('0x1f')],'type':_0x102c54['type']['key']};});_0x261efc['model']=_[_0x746d('0x20')](_0x19a22c,_0x746d('0x18'));_0x261efc[_0x746d('0x21')]=_['keys'](_0x13f80a[_0x746d('0x21')]);_0x261efc[_0x746d('0x22')]=_[_0x746d('0x23')](_0x261efc[_0x746d('0x24')],_0x261efc[_0x746d('0x21')]);_0x50c61f[_0x746d('0x25')]=_[_0x746d('0x23')](_0x261efc[_0x746d('0x24')],qs['fields'](_0x13f80a['query']['fields']));_0x50c61f[_0x746d('0x25')]=_0x50c61f[_0x746d('0x25')][_0x746d('0x26')]?_0x50c61f[_0x746d('0x25')]:_0x261efc['model'];if(!_0x13f80a[_0x746d('0x21')]['hasOwnProperty'](_0x746d('0x27'))){_0x50c61f['limit']=qs[_0x746d('0x10')](_0x13f80a['query']['limit']);_0x50c61f[_0x746d('0xd')]=qs[_0x746d('0xd')](_0x13f80a[_0x746d('0x21')][_0x746d('0xd')]);}_0x50c61f[_0x746d('0x28')]=qs['sort'](_0x13f80a[_0x746d('0x21')][_0x746d('0x29')]);_0x50c61f[_0x746d('0x2a')]=qs[_0x746d('0x22')](_[_0x746d('0x2b')](_0x13f80a['query'],_0x261efc[_0x746d('0x22')]),_0x19a22c);if(_0x13f80a[_0x746d('0x21')][_0x746d('0x2c')]){_0x50c61f[_0x746d('0x2a')]=_[_0x746d('0x2d')](_0x50c61f[_0x746d('0x2a')],{'$or':_[_0x746d('0x20')](_0x19a22c,function(_0x2abf9f){if(_0x2abf9f[_0x746d('0x2e')]!==_0x746d('0x2f')){var _0xc45121={};_0xc45121[_0x2abf9f[_0x746d('0x18')]]={'$like':'%'+_0x13f80a[_0x746d('0x21')][_0x746d('0x2c')]+'%'};return _0xc45121;}})});}_0x50c61f=_[_0x746d('0x2d')]({},_0x50c61f,_0x13f80a[_0x746d('0x30')]);var _0x530409={'where':_0x50c61f[_0x746d('0x2a')]};return db[_0x746d('0x1d')]['count'](_0x530409)[_0x746d('0x15')](function(_0x607a21){_0x469d39[_0x746d('0xf')]=_0x607a21;if(_0x13f80a[_0x746d('0x21')]['includeAll']){_0x50c61f['include']=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x50c61f);})[_0x746d('0x15')](function(_0x46219f){_0x469d39['rows']=_[_0x746d('0x20')](_0x46219f,function(_0x56f45e){if(_0x56f45e['service']===_0x746d('0x31')){var _0x37e316=encryptor[_0x746d('0x32')](_0x56f45e[_0x746d('0x33')]);_0x56f45e['data3']=maskClientSecret(_0x37e316);}return _0x56f45e;});return _0x469d39;})[_0x746d('0x15')](respondWithFilteredResult(_0x73ab28,_0x50c61f))[_0x746d('0x34')](handleError(_0x73ab28,null));};exports[_0x746d('0x35')]=function(_0x2a48ab,_0x40fa09){var _0x503748={'raw':!![],'where':{'id':_0x2a48ab[_0x746d('0x36')]['id']}},_0x5a2822={};_0x5a2822[_0x746d('0x24')]=_[_0x746d('0x37')](db['CloudProvider'][_0x746d('0x1e')]);_0x5a2822['query']=_[_0x746d('0x37')](_0x2a48ab[_0x746d('0x21')]);_0x5a2822['filters']=_[_0x746d('0x23')](_0x5a2822['model'],_0x5a2822[_0x746d('0x21')]);_0x503748['attributes']=_[_0x746d('0x23')](_0x5a2822[_0x746d('0x24')],qs['fields'](_0x2a48ab['query'][_0x746d('0x38')]));_0x503748[_0x746d('0x25')]=_0x503748[_0x746d('0x25')][_0x746d('0x26')]?_0x503748[_0x746d('0x25')]:_0x5a2822['model'];if(_0x2a48ab['query'][_0x746d('0x39')]){_0x503748[_0x746d('0x3a')]=[{'all':!![]}];}_0x503748=_[_0x746d('0x2d')]({},_0x503748,_0x2a48ab['options']);return db[_0x746d('0x1d')][_0x746d('0x3b')](_0x503748)['then'](handleEntityNotFound(_0x40fa09,null))[_0x746d('0x15')](function(_0xcbb97f){if(_0xcbb97f[_0x746d('0x3c')]===_0x746d('0x31')){var _0xea4b3d=encryptor[_0x746d('0x32')](_0xcbb97f[_0x746d('0x33')]);_0xcbb97f[_0x746d('0x33')]=maskClientSecret(_0xea4b3d);}return _0xcbb97f;})[_0x746d('0x15')](respondWithResult(_0x40fa09,null))['catch'](handleError(_0x40fa09,null));};exports[_0x746d('0x3d')]=function(_0x4ab7cd,_0x25d26c){if(!_0x4ab7cd[_0x746d('0x3e')][_0x746d('0x18')])throw new Error(_0x746d('0x3f'));if(!_0x4ab7cd[_0x746d('0x3e')]['service'])throw new Error(_0x746d('0x40'));var _0x25919d=db[_0x746d('0x1d')][_0x746d('0x1e')][_0x746d('0x3c')][_0x746d('0x41')];if(!_0x25919d[_0x746d('0x42')](_0x4ab7cd[_0x746d('0x3e')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x25919d['join'](',\x20'));if(_0x4ab7cd['body'][_0x746d('0x3c')]==='MicrosoftAzure'&&_0x4ab7cd[_0x746d('0x3e')][_0x746d('0x33')]){_0x4ab7cd[_0x746d('0x3e')][_0x746d('0x33')]=encryptor['encryptString'](_0x4ab7cd[_0x746d('0x3e')][_0x746d('0x33')]);}return db[_0x746d('0x1d')][_0x746d('0x3d')](_0x4ab7cd[_0x746d('0x3e')],{})[_0x746d('0x15')](respondWithResult(_0x25d26c,0xc9))['catch'](handleError(_0x25d26c,null));};exports[_0x746d('0x14')]=function(_0xe02ad7,_0x5c926e){if(_0xe02ad7[_0x746d('0x3e')]['id']){delete _0xe02ad7[_0x746d('0x3e')]['id'];}return db[_0x746d('0x1d')]['find']({'where':{'id':_0xe02ad7['params']['id']}})['then'](handleEntityNotFound(_0x5c926e,null))[_0x746d('0x15')](function(_0x4204dd){if(_0x4204dd[_0x746d('0x3c')]===_0x746d('0x31')&&_0xe02ad7['body'][_0x746d('0x33')]){_0xe02ad7[_0x746d('0x3e')]['data3']=encryptor[_0x746d('0x43')](_0xe02ad7[_0x746d('0x3e')]['data3']);}return _0x4204dd;})[_0x746d('0x15')](saveUpdates(_0xe02ad7[_0x746d('0x3e')],null))['then'](respondWithResult(_0x5c926e,null))[_0x746d('0x34')](handleError(_0x5c926e,null));};exports['destroy']=function(_0x5f2734,_0x91f6ae){return db[_0x746d('0x1d')][_0x746d('0x3b')]({'where':{'id':_0x5f2734['params']['id']}})[_0x746d('0x15')](handleEntityNotFound(_0x91f6ae,null))[_0x746d('0x15')](removeEntity(_0x91f6ae,null))['catch'](handleError(_0x91f6ae,null));};exports['oauth2MicrosoftAuthorize']=function(_0x2bf66d,_0x39427e){return db[_0x746d('0x1d')][_0x746d('0x44')]({'where':{'id':_0x2bf66d['params']['id']},'raw':!![]})[_0x746d('0x15')](function(_0x30d28b){if(!_0x30d28b)return _0x39427e['sendStatus'](0x194);return{'url':oauth[_0x746d('0x45')](_0x30d28b,_0x2bf66d['user']['id'])};})[_0x746d('0x15')](respondWithResult(_0x39427e,null))['catch'](handleError(_0x39427e,null));};exports['oauth2MicrosoftCallback']=function(_0x40326f,_0x57c3c9){var _0x32a28b=_0x40326f[_0x746d('0x3e')];var _0x5cc58d;var _0x359c92;if(_0x32a28b[_0x746d('0x17')])throw _0x32a28b;redis['get'](_0x32a28b[_0x746d('0x46')])['then'](function(_0x45bab5){if(!_0x45bab5)throw new Error('Invalid\x20state\x20parameter');_0x5cc58d=JSON[_0x746d('0x47')](_0x45bab5);var _0x249ecb=Buffer['from'](_0x32a28b['state'],_0x746d('0x48'))['toString'](_0x746d('0x49'));_0x359c92=JSON[_0x746d('0x47')](_0x249ecb);if(!oauth['isValidIdToken'](_0x32a28b[_0x746d('0x4a')],_0x5cc58d[_0x746d('0x4b')]))throw new Error(_0x746d('0x4c'));redis[_0x746d('0x4d')](_0x32a28b['state']);return oauth[_0x746d('0x4e')](_0x32a28b[_0x746d('0x4f')],_0x5cc58d);})[_0x746d('0x15')](function(_0x36321b){_0x5cc58d[_0x746d('0x50')]=_0x36321b[_0x746d('0x51')];_0x5cc58d[_0x746d('0x52')]=_0x36321b['refresh_token'];return db[_0x746d('0x1d')][_0x746d('0x14')]({'data5':_0x5cc58d[_0x746d('0x50')],'data6':_0x5cc58d[_0x746d('0x52')]},{'where':{'id':_0x5cc58d['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x5cc58d);socket[_0x746d('0x53')](_0x746d('0x54'),{'id':_0x359c92['id']});return;})[_0x746d('0x15')](respondWithStatusCode(_0x57c3c9,null))['catch'](function(_0x5f4660){if(_0x359c92){socket[_0x746d('0x53')](_0x746d('0x55'),{'id':_0x359c92['id']});}if(!_0x5cc58d){logger[_0x746d('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x5f4660);return _0x57c3c9[_0x746d('0x11')](0x1f4)[_0x746d('0x19')](_0x5f4660[_0x746d('0x56')]);}logger[_0x746d('0x17')](_0x746d('0x57'),_0x5cc58d['id'],JSON[_0x746d('0x58')](_0x5f4660));});}; \ No newline at end of file +var _0x0135=['isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','stringify','ioredis','../../components/encryptor','../../config/environment','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','error','stack','name','send','padEnd','map','CloudProvider','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','then','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','length','options','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii'];(function(_0x1556da,_0x3d9ba9){var _0x4ba1ef=function(_0x2ed733){while(--_0x2ed733){_0x1556da['push'](_0x1556da['shift']());}};_0x4ba1ef(++_0x3d9ba9);}(_0x0135,0x71));var _0x5013=function(_0x556720,_0x43fcdc){_0x556720=_0x556720-0x0;var _0x25e3aa=_0x0135[_0x556720];return _0x25e3aa;};'use strict';var _=require('lodash');var Redis=require(_0x5013('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x5013('0x1'));var config=require(_0x5013('0x2'));var logger=require('../../config/logger')('api');var db=require(_0x5013('0x3'))['db'];var oauth=require(_0x5013('0x4'));config[_0x5013('0x5')]=_[_0x5013('0x6')](config[_0x5013('0x5')],{'host':_0x5013('0x7'),'port':0x18eb});var socket=require(_0x5013('0x8'))(new Redis(config[_0x5013('0x5')]));var redis=new Redis(config[_0x5013('0x5')]);function respondWithStatusCode(_0x32e58d,_0x8c0092){_0x8c0092=_0x8c0092||0xcc;return function(_0x32923b){if(_0x32923b){return _0x32e58d[_0x5013('0x9')](_0x8c0092);}return _0x32e58d[_0x5013('0xa')](_0x8c0092)[_0x5013('0xb')]();};}function respondWithResult(_0xfcf6cf,_0x32f617){_0x32f617=_0x32f617||0xc8;return function(_0x1a6469){if(_0x1a6469){return _0xfcf6cf[_0x5013('0xa')](_0x32f617)[_0x5013('0xc')](_0x1a6469);}};}function respondWithFilteredResult(_0x1bc574,_0x5534f4){return function(_0x3d7326){if(_0x3d7326){var _0x529430=typeof _0x5534f4['offset']===_0x5013('0xd')&&typeof _0x5534f4[_0x5013('0xe')]==='undefined';var _0x41d4bb=_0x3d7326[_0x5013('0xf')];var _0x31769d=_0x529430?0x0:_0x5534f4['offset'];var _0x8dc781=_0x529430?_0x3d7326['count']:_0x5534f4[_0x5013('0x10')]+_0x5534f4['limit'];var _0x2b3af6;if(_0x8dc781>=_0x41d4bb){_0x8dc781=_0x41d4bb;_0x2b3af6=0xc8;}else{_0x2b3af6=0xce;}_0x1bc574[_0x5013('0xa')](_0x2b3af6);return _0x1bc574['set'](_0x5013('0x11'),_0x31769d+'-'+_0x8dc781+'/'+_0x41d4bb)[_0x5013('0xc')](_0x3d7326);}return null;};}function saveUpdates(_0x122a18){return function(_0x4590c0){if(_0x4590c0){return _0x4590c0[_0x5013('0x12')](_0x122a18)['then'](function(_0xfccfd4){return _0xfccfd4;});}return null;};}function removeEntity(_0x1d6f18){return function(_0x5eb037){if(_0x5eb037){return _0x5eb037['destroy']()['then'](function(){_0x1d6f18[_0x5013('0xa')](0xcc)[_0x5013('0xb')]();});}};}function handleEntityNotFound(_0x558c74){return function(_0x4c04da){if(!_0x4c04da){_0x558c74['sendStatus'](0x194);}return _0x4c04da;};}function handleError(_0x1c6425,_0x2d4e66){_0x2d4e66=_0x2d4e66||0x1f4;return function(_0x5a17ca){logger[_0x5013('0x13')](_0x5a17ca[_0x5013('0x14')]);if(_0x5a17ca[_0x5013('0x15')]){delete _0x5a17ca[_0x5013('0x15')];}_0x1c6425['status'](_0x2d4e66)[_0x5013('0x16')](_0x5a17ca);};}function maskClientSecret(_0x3d74bd){return _[_0x5013('0x17')](_0x3d74bd['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x451543,_0x339beb){var _0x5a7bc8={},_0x231a07={},_0x614f83={'count':0x0,'rows':[]};var _0x49ec8d=_[_0x5013('0x18')](db[_0x5013('0x19')][_0x5013('0x1a')],function(_0x17d86e){return{'name':_0x17d86e[_0x5013('0x1b')],'type':_0x17d86e['type'][_0x5013('0x1c')]};});_0x231a07['model']=_['map'](_0x49ec8d,_0x5013('0x15'));_0x231a07['query']=_[_0x5013('0x1d')](_0x451543[_0x5013('0x1e')]);_0x231a07[_0x5013('0x1f')]=_[_0x5013('0x20')](_0x231a07[_0x5013('0x21')],_0x231a07[_0x5013('0x1e')]);_0x5a7bc8[_0x5013('0x22')]=_[_0x5013('0x20')](_0x231a07['model'],qs[_0x5013('0x23')](_0x451543[_0x5013('0x1e')][_0x5013('0x23')]));_0x5a7bc8[_0x5013('0x22')]=_0x5a7bc8[_0x5013('0x22')]['length']?_0x5a7bc8[_0x5013('0x22')]:_0x231a07['model'];if(!_0x451543[_0x5013('0x1e')][_0x5013('0x24')](_0x5013('0x25'))){_0x5a7bc8[_0x5013('0xe')]=qs[_0x5013('0xe')](_0x451543['query'][_0x5013('0xe')]);_0x5a7bc8[_0x5013('0x10')]=qs[_0x5013('0x10')](_0x451543['query'][_0x5013('0x10')]);}_0x5a7bc8[_0x5013('0x26')]=qs['sort'](_0x451543[_0x5013('0x1e')][_0x5013('0x27')]);_0x5a7bc8[_0x5013('0x28')]=qs[_0x5013('0x1f')](_[_0x5013('0x29')](_0x451543[_0x5013('0x1e')],_0x231a07[_0x5013('0x1f')]),_0x49ec8d);if(_0x451543['query'][_0x5013('0x2a')]){_0x5a7bc8[_0x5013('0x28')]=_[_0x5013('0x2b')](_0x5a7bc8['where'],{'$or':_[_0x5013('0x18')](_0x49ec8d,function(_0x262e46){if(_0x262e46[_0x5013('0x2c')]!=='VIRTUAL'){var _0x154bcd={};_0x154bcd[_0x262e46['name']]={'$like':'%'+_0x451543[_0x5013('0x1e')][_0x5013('0x2a')]+'%'};return _0x154bcd;}})});}_0x5a7bc8=_['merge']({},_0x5a7bc8,_0x451543['options']);var _0x481c8a={'where':_0x5a7bc8['where']};return db[_0x5013('0x19')]['count'](_0x481c8a)[_0x5013('0x2d')](function(_0x2786ba){_0x614f83[_0x5013('0xf')]=_0x2786ba;if(_0x451543['query'][_0x5013('0x2e')]){_0x5a7bc8[_0x5013('0x2f')]=[{'all':!![]}];}return db[_0x5013('0x19')][_0x5013('0x30')](_0x5a7bc8);})[_0x5013('0x2d')](function(_0xbd05e6){_0x614f83[_0x5013('0x31')]=_[_0x5013('0x18')](_0xbd05e6,function(_0x5108a8){if(_0x5108a8['service']===_0x5013('0x32')){var _0x15b537=encryptor[_0x5013('0x33')](_0x5108a8[_0x5013('0x34')]);_0x5108a8[_0x5013('0x34')]=maskClientSecret(_0x15b537);}return _0x5108a8;});return _0x614f83;})[_0x5013('0x2d')](respondWithFilteredResult(_0x339beb,_0x5a7bc8))[_0x5013('0x35')](handleError(_0x339beb,null));};exports[_0x5013('0x36')]=function(_0x507329,_0x50a2b6){var _0x4e85fd={'raw':!![],'where':{'id':_0x507329[_0x5013('0x37')]['id']}},_0x56ef52={};_0x56ef52[_0x5013('0x21')]=_['keys'](db['CloudProvider']['rawAttributes']);_0x56ef52[_0x5013('0x1e')]=_[_0x5013('0x1d')](_0x507329[_0x5013('0x1e')]);_0x56ef52['filters']=_[_0x5013('0x20')](_0x56ef52[_0x5013('0x21')],_0x56ef52[_0x5013('0x1e')]);_0x4e85fd['attributes']=_[_0x5013('0x20')](_0x56ef52[_0x5013('0x21')],qs['fields'](_0x507329[_0x5013('0x1e')][_0x5013('0x23')]));_0x4e85fd[_0x5013('0x22')]=_0x4e85fd[_0x5013('0x22')][_0x5013('0x38')]?_0x4e85fd[_0x5013('0x22')]:_0x56ef52[_0x5013('0x21')];if(_0x507329['query'][_0x5013('0x2e')]){_0x4e85fd[_0x5013('0x2f')]=[{'all':!![]}];}_0x4e85fd=_[_0x5013('0x2b')]({},_0x4e85fd,_0x507329[_0x5013('0x39')]);return db[_0x5013('0x19')][_0x5013('0x3a')](_0x4e85fd)['then'](handleEntityNotFound(_0x50a2b6,null))['then'](function(_0x4c0927){if(_0x4c0927[_0x5013('0x3b')]===_0x5013('0x32')){var _0x36a410=encryptor['decryptString'](_0x4c0927[_0x5013('0x34')]);_0x4c0927[_0x5013('0x34')]=maskClientSecret(_0x36a410);}return _0x4c0927;})[_0x5013('0x2d')](respondWithResult(_0x50a2b6,null))[_0x5013('0x35')](handleError(_0x50a2b6,null));};exports[_0x5013('0x3c')]=function(_0x4694e3,_0xb419fa){if(!_0x4694e3[_0x5013('0x3d')][_0x5013('0x15')])throw new Error(_0x5013('0x3e'));if(!_0x4694e3[_0x5013('0x3d')][_0x5013('0x3b')])throw new Error(_0x5013('0x3f'));var _0x3e47b0=db[_0x5013('0x19')]['rawAttributes'][_0x5013('0x3b')][_0x5013('0x40')];if(!_0x3e47b0[_0x5013('0x41')](_0x4694e3[_0x5013('0x3d')]['service']))throw new Error(_0x5013('0x42')+_0x3e47b0[_0x5013('0x43')](',\x20'));if(_0x4694e3[_0x5013('0x3d')]['service']===_0x5013('0x32')&&_0x4694e3[_0x5013('0x3d')][_0x5013('0x34')]){_0x4694e3[_0x5013('0x3d')][_0x5013('0x34')]=encryptor[_0x5013('0x44')](_0x4694e3[_0x5013('0x3d')][_0x5013('0x34')]);}return db[_0x5013('0x19')][_0x5013('0x3c')](_0x4694e3['body'],{})['then'](respondWithResult(_0xb419fa,0xc9))[_0x5013('0x35')](handleError(_0xb419fa,null));};exports[_0x5013('0x12')]=function(_0x470eb8,_0x38e3a7){if(_0x470eb8[_0x5013('0x3d')]['id']){delete _0x470eb8[_0x5013('0x3d')]['id'];}return db['CloudProvider'][_0x5013('0x3a')]({'where':{'id':_0x470eb8[_0x5013('0x37')]['id']}})[_0x5013('0x2d')](handleEntityNotFound(_0x38e3a7,null))['then'](function(_0x59de17){if(_0x59de17['service']==='MicrosoftAzure'&&_0x470eb8[_0x5013('0x3d')][_0x5013('0x34')]){_0x470eb8[_0x5013('0x3d')][_0x5013('0x34')]=encryptor[_0x5013('0x44')](_0x470eb8[_0x5013('0x3d')]['data3']);}return _0x59de17;})[_0x5013('0x2d')](saveUpdates(_0x470eb8[_0x5013('0x3d')],null))[_0x5013('0x2d')](respondWithResult(_0x38e3a7,null))['catch'](handleError(_0x38e3a7,null));};exports['destroy']=function(_0x3f2d53,_0x328625){return db['CloudProvider'][_0x5013('0x3a')]({'where':{'id':_0x3f2d53['params']['id']}})['then'](handleEntityNotFound(_0x328625,null))[_0x5013('0x2d')](removeEntity(_0x328625,null))[_0x5013('0x35')](handleError(_0x328625,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4da103,_0x5cdfbd){return db[_0x5013('0x19')][_0x5013('0x45')]({'where':{'id':_0x4da103[_0x5013('0x37')]['id']},'raw':!![]})[_0x5013('0x2d')](function(_0x56786d){if(!_0x56786d)return _0x5cdfbd[_0x5013('0x9')](0x194);return{'url':oauth[_0x5013('0x46')](_0x56786d,_0x4da103[_0x5013('0x47')]['id'])};})[_0x5013('0x2d')](respondWithResult(_0x5cdfbd,null))[_0x5013('0x35')](handleError(_0x5cdfbd,null));};exports[_0x5013('0x48')]=function(_0x3b8fa1,_0x2e096a){var _0x417ba7=_0x3b8fa1[_0x5013('0x3d')];var _0x4750a2;var _0x3a5ec4;if(_0x417ba7['error'])throw _0x417ba7;redis[_0x5013('0x49')](_0x417ba7['state'])[_0x5013('0x2d')](function(_0x29d87a){if(!_0x29d87a)throw new Error(_0x5013('0x4a'));_0x4750a2=JSON[_0x5013('0x4b')](_0x29d87a);var _0x4be7e8=Buffer[_0x5013('0x4c')](_0x417ba7[_0x5013('0x4d')],_0x5013('0x4e'))[_0x5013('0x4f')](_0x5013('0x50'));_0x3a5ec4=JSON['parse'](_0x4be7e8);if(!oauth[_0x5013('0x51')](_0x417ba7[_0x5013('0x52')],_0x4750a2[_0x5013('0x53')]))throw new Error(_0x5013('0x54'));redis[_0x5013('0x55')](_0x417ba7[_0x5013('0x4d')]);return oauth[_0x5013('0x56')](_0x417ba7[_0x5013('0x57')],_0x4750a2);})[_0x5013('0x2d')](function(_0x1c22dc){_0x4750a2['data5']=_0x1c22dc[_0x5013('0x58')];_0x4750a2[_0x5013('0x59')]=_0x1c22dc[_0x5013('0x5a')];return db[_0x5013('0x19')]['update']({'data5':_0x4750a2[_0x5013('0x5b')],'data6':_0x4750a2[_0x5013('0x59')]},{'where':{'id':_0x4750a2['id']}});})[_0x5013('0x2d')](function(){oauth[_0x5013('0x5c')](_0x4750a2);socket[_0x5013('0x5d')](_0x5013('0x5e'),{'id':_0x3a5ec4['id']});return;})[_0x5013('0x2d')](respondWithStatusCode(_0x2e096a,null))[_0x5013('0x35')](function(_0x3af067){if(_0x3a5ec4){socket[_0x5013('0x5d')](_0x5013('0x5f'),{'id':_0x3a5ec4['id']});}if(!_0x4750a2){logger[_0x5013('0x13')]('Invalid\x20authentication\x20state\x20parameter',_0x3af067);return _0x2e096a[_0x5013('0xa')](0x1f4)[_0x5013('0x16')](_0x3af067['message']);}logger[_0x5013('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4750a2['id'],JSON[_0x5013('0x60')](_0x3af067));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a3608bc..2942b4e 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 _0x556b=['path','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','api','moment'];(function(_0x357141,_0x4ca2e8){var _0x4e8661=function(_0xba31c4){while(--_0xba31c4){_0x357141['push'](_0x357141['shift']());}};_0x4e8661(++_0x4ca2e8);}(_0x556b,0x18c));var _0xb556=function(_0xcb4c93,_0x3bc387){_0xcb4c93=_0xcb4c93-0x0;var _0x39ce92=_0x556b[_0xcb4c93];return _0x39ce92;};'use strict';var _=require(_0xb556('0x0'));var util=require(_0xb556('0x1'));var logger=require('../../config/logger')(_0xb556('0x2'));var moment=require(_0xb556('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb556('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb556('0x5'));module[_0xb556('0x6')]=function(_0x59cfd2,_0x9074f3){return _0x59cfd2[_0xb556('0x7')](_0xb556('0x8'),attributes,{'tableName':_0xb556('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a1=['exports','define','cloud_providers','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe4a1,0x93));var _0x1e4a=function(_0x436b5a,_0x37433f){_0x436b5a=_0x436b5a-0x0;var _0x4e9145=_0xe4a1[_0x436b5a];return _0x4e9145;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e4a('0x0'))(_0x1e4a('0x1'));var moment=require(_0x1e4a('0x2'));var BPromise=require(_0x1e4a('0x3'));var rp=require(_0x1e4a('0x4'));var fs=require('fs');var path=require(_0x1e4a('0x5'));var rimraf=require(_0x1e4a('0x6'));var config=require(_0x1e4a('0x7'));var attributes=require(_0x1e4a('0x8'));module[_0x1e4a('0x9')]=function(_0x2ef4c3,_0x3d2611){return _0x2ef4c3[_0x1e4a('0xa')]('CloudProvider',attributes,{'tableName':_0x1e4a('0xb'),'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 412aa21..82a6a68 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 _0xb605=['data7','/.default','Outlook365','{TENANT_ID}','data2','id_token','from','toString','base64','randomBytes','hex','client_id','data1','redirect_uri','data4','form_post','scope','nonce','prompt','login','key','value','join','replace','set','stringify','decode','payload','audience','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','data5','access_token','update','catch','error','authorization_code','POST','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','util','../../components/encryptor','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb605,0x145));var _0x5b60=function(_0x27c24e,_0x5db1c7){_0x27c24e=_0x27c24e-0x0;var _0x39004a=_0xb605[_0x27c24e];return _0x39004a;};'use strict';var _=require(_0x5b60('0x0'));var crypto=require(_0x5b60('0x1'));var jwt=require(_0x5b60('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x5b60('0x3'));var encryptor=require(_0x5b60('0x4'));var config=require('../../config/environment');var logger=require(_0x5b60('0x5'))('api');var schedule=require(_0x5b60('0x6'));var db=require(_0x5b60('0x7'))['db'];config[_0x5b60('0x8')]=_[_0x5b60('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x5b60('0x8')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x5b60('0xa'),'profile',_0x5b60('0xb'),_0x5b60('0xc'),_0x5b60('0xd'),_0x5b60('0xe'),_0x5b60('0xf')],'Dynamics365':[_0x5b60('0xa'),_0x5b60('0xc')]};var MICROSOFT_AUTH_ENDPOINT=_0x5b60('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x5b60('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3ad09e){var _0xf6fc9e=_[_0x5b60('0x12')](AZURE_AUTH_SCOPES[_0x3ad09e[_0x5b60('0x13')]]);if(_0x3ad09e[_0x5b60('0x13')]==='Dynamics365')_0xf6fc9e['push'](_0x3ad09e[_0x5b60('0x14')]+_0x5b60('0x15'));return _0xf6fc9e['join']('\x20');}function getAccessTokenScope(_0xaef650){if(_0xaef650['type']===_0x5b60('0x16'))return _0x5b60('0xd');if(_0xaef650[_0x5b60('0x13')]==='Dynamics365')return _0xaef650['data7']+_0x5b60('0x15');}function generateMicrosoftAuthorizationUrl(_0x48d314,_0x8d987c){var _0x178f20=MICROSOFT_AUTH_URL['replace'](_0x5b60('0x17'),_0x48d314[_0x5b60('0x18')]);var _0x1ec039=['code',_0x5b60('0x19')];var _0xa724d7=Buffer[_0x5b60('0x1a')](JSON['stringify']({'id':_0x8d987c}))[_0x5b60('0x1b')](_0x5b60('0x1c'));var _0x17c442=crypto[_0x5b60('0x1d')](0x10)[_0x5b60('0x1b')](_0x5b60('0x1e'));var _0x259b14=getAuthorizationScopes(_0x48d314);var _0x32df78=[{'key':_0x5b60('0x1f'),'value':_0x48d314[_0x5b60('0x20')]},{'key':'response_type','value':encodeURIComponent(_0x1ec039['join']('\x20'))},{'key':_0x5b60('0x21'),'value':_0x48d314[_0x5b60('0x22')]},{'key':'response_mode','value':_0x5b60('0x23')},{'key':_0x5b60('0x24'),'value':encodeURIComponent(_0x259b14)},{'key':'state','value':_0xa724d7},{'key':_0x5b60('0x25'),'value':_0x17c442},{'key':_0x5b60('0x26'),'value':_0x5b60('0x27')}];var _0x341718=_0x178f20+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5b60('0x12')](_0x32df78,function(_0xd23e74){return _0xd23e74[_0x5b60('0x28')]+'='+_0xd23e74[_0x5b60('0x29')];})[_0x5b60('0x2a')]('&');_0x48d314['oauth2Claims']={'issuer':_0x178f20[_0x5b60('0x2b')]('oauth2/',''),'audience':_0x48d314['data1'],'state':_0xa724d7,'nonce':_0x17c442};redis[_0x5b60('0x2c')](_0xa724d7,JSON[_0x5b60('0x2d')](_0x48d314));return _0x341718;}function isValidIdToken(_0x44f133,_0x53ea1b){try{var _0x1620b3=jwt[_0x5b60('0x2e')](_0x44f133,{'complete':!![]});var _0x16c2f8=_0x1620b3[_0x5b60('0x2f')];if(_0x16c2f8['iss']!==_0x53ea1b['issuer'])return![];if(_0x16c2f8['aud']!==_0x53ea1b[_0x5b60('0x30')])return![];if(_0x16c2f8[_0x5b60('0x25')]!==_0x53ea1b[_0x5b60('0x25')])return![];if(moment()['isAfter'](moment['unix'](_0x16c2f8['exp'])))return![];return!![];}catch(_0x553f62){throw _0x553f62;}}function refreshOauth2MicrosoftAccessToken(_0x5c817f){return Promise['resolve']()[_0x5b60('0x31')](function(){if(_0x5c817f[_0x5b60('0x32')])return _0x5c817f;return db[_0x5b60('0x33')][_0x5b60('0x34')]({'where':{'id':_0x5c817f['id']},'raw':!![]});})[_0x5b60('0x31')](function(_0x18745f){var _0x2d0927={'grant_type':_0x5b60('0x35'),'refresh_token':_0x18745f[_0x5b60('0x36')],'scope':getAccessTokenScope(_0x18745f),'redirect_uri':_0x18745f['data4'],'client_id':_0x18745f['data1'],'client_secret':encryptor[_0x5b60('0x37')](_0x18745f[_0x5b60('0x32')])};var _0x53a53b={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x5b60('0x2b')](_0x5b60('0x17'),_0x18745f[_0x5b60('0x18')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2d0927,'json':!![]};return rp(_0x53a53b);})['then'](function(_0x3aa029){_0x5c817f[_0x5b60('0x38')]=_0x3aa029[_0x5b60('0x39')];_0x5c817f[_0x5b60('0x36')]=_0x3aa029[_0x5b60('0x35')];return db['CloudProvider'][_0x5b60('0x3a')]({'data5':_0x5c817f[_0x5b60('0x38')],'data6':_0x5c817f['data6']},{'where':{'id':_0x5c817f['id']}});})[_0x5b60('0x31')](function(){return _0x5c817f;})[_0x5b60('0x3b')](function(_0x1f582f){logger[_0x5b60('0x3c')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5c817f['id'],_0x1f582f);});}function getOauth2MicrosoftAccessToken(_0xdf28b5,_0x38d1e4){var _0x2c0875={'grant_type':_0x5b60('0x3d'),'code':_0xdf28b5,'scope':getAccessTokenScope(_0x38d1e4),'redirect_uri':_0x38d1e4[_0x5b60('0x22')],'client_id':_0x38d1e4['data1'],'client_secret':encryptor[_0x5b60('0x37')](_0x38d1e4['data3'])};var _0x2a2c47={'method':_0x5b60('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0x5b60('0x17'),_0x38d1e4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2c0875,'json':!![]};return rp(_0x2a2c47);}function startRefreshInterval(_0x5691bf){var _0x442fa1=schedule[_0x5b60('0x3f')];if(_0x442fa1[_0x5691bf['id']])clearInterval(_0x442fa1[_0x5691bf['id']]);_0x442fa1[_0x5691bf['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x5691bf['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x5b60('0x3f')]=_0x442fa1;}function startAllRefreshIntervals(){return db[_0x5b60('0x33')][_0x5b60('0x40')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x55468b){var _0x3dc5d7=_0x55468b[_0x5b60('0x12')](function(_0x20c247){return refreshOauth2MicrosoftAccessToken(_0x20c247)[_0x5b60('0x31')](function(_0x4c3449){startRefreshInterval(_0x4c3449);});});return Promise[_0x5b60('0x41')](_0x3dc5d7);})[_0x5b60('0x3b')](function(_0x83692){var _0x425b92=_0x83692?util[_0x5b60('0x42')](_0x83692,{'showHidden':![],'depth':null}):'';logger['error'](_0x5b60('0x43'),_0x425b92);});}module[_0x5b60('0x44')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xbaae=['code','from','base64','randomBytes','toString','hex','data1','response_type','redirect_uri','data4','response_mode','form_post','nonce','login','key','value','oauth2Claims','oauth2/','set','payload','iss','issuer','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','decryptString','POST','data2','data5','access_token','data6','refresh_token','catch','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}'];(function(_0x1b9306,_0x585dbe){var _0x3e0a1b=function(_0x3e7ae2){while(--_0x3e7ae2){_0x1b9306['push'](_0x1b9306['shift']());}};_0x3e0a1b(++_0x585dbe);}(_0xbaae,0x1a3));var _0xebaa=function(_0x1b4f29,_0x157eac){_0x1b4f29=_0x1b4f29-0x0;var _0x544af=_0xbaae[_0x1b4f29];return _0x544af;};'use strict';var _=require(_0xebaa('0x0'));var crypto=require(_0xebaa('0x1'));var jwt=require(_0xebaa('0x2'));var moment=require('moment');var Redis=require(_0xebaa('0x3'));var rp=require(_0xebaa('0x4'));var util=require(_0xebaa('0x5'));var encryptor=require(_0xebaa('0x6'));var config=require('../../config/environment');var logger=require(_0xebaa('0x7'))(_0xebaa('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xebaa('0x9'))['db'];config['redis']=_[_0xebaa('0xa')](config[_0xebaa('0xb')],{'host':_0xebaa('0xc'),'port':0x18eb});var redis=new Redis(config[_0xebaa('0xb')]);var MICROSOFT_AUTH_URL=_0xebaa('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xebaa('0xe'),_0xebaa('0xf'),_0xebaa('0x10'),_0xebaa('0x11'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xebaa('0x12'),_0xebaa('0x13')],'Dynamics365':[_0xebaa('0xe'),_0xebaa('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xebaa('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x558426){var _0x413630=_[_0xebaa('0x15')](AZURE_AUTH_SCOPES[_0x558426[_0xebaa('0x16')]]);if(_0x558426[_0xebaa('0x16')]===_0xebaa('0x17'))_0x413630[_0xebaa('0x18')](_0x558426['data7']+_0xebaa('0x19'));return _0x413630[_0xebaa('0x1a')]('\x20');}function getAccessTokenScope(_0x5f3bd8){if(_0x5f3bd8[_0xebaa('0x16')]===_0xebaa('0x1b'))return _0xebaa('0x1c');if(_0x5f3bd8[_0xebaa('0x16')]===_0xebaa('0x17'))return _0x5f3bd8['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x9b00a2,_0x31290b){var _0x5dab6e=MICROSOFT_AUTH_URL[_0xebaa('0x1d')](_0xebaa('0x1e'),_0x9b00a2['data2']);var _0x3eb0d3=[_0xebaa('0x1f'),'id_token'];var _0x2040d0=Buffer[_0xebaa('0x20')](JSON['stringify']({'id':_0x31290b}))['toString'](_0xebaa('0x21'));var _0x27c62e=crypto[_0xebaa('0x22')](0x10)[_0xebaa('0x23')](_0xebaa('0x24'));var _0x41203a=getAuthorizationScopes(_0x9b00a2);var _0x209e96=[{'key':'client_id','value':_0x9b00a2[_0xebaa('0x25')]},{'key':_0xebaa('0x26'),'value':encodeURIComponent(_0x3eb0d3['join']('\x20'))},{'key':_0xebaa('0x27'),'value':_0x9b00a2[_0xebaa('0x28')]},{'key':_0xebaa('0x29'),'value':_0xebaa('0x2a')},{'key':'scope','value':encodeURIComponent(_0x41203a)},{'key':'state','value':_0x2040d0},{'key':_0xebaa('0x2b'),'value':_0x27c62e},{'key':'prompt','value':_0xebaa('0x2c')}];var _0x3c6dc4=_0x5dab6e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xebaa('0x15')](_0x209e96,function(_0x22da3f){return _0x22da3f[_0xebaa('0x2d')]+'='+_0x22da3f[_0xebaa('0x2e')];})['join']('&');_0x9b00a2[_0xebaa('0x2f')]={'issuer':_0x5dab6e[_0xebaa('0x1d')](_0xebaa('0x30'),''),'audience':_0x9b00a2['data1'],'state':_0x2040d0,'nonce':_0x27c62e};redis[_0xebaa('0x31')](_0x2040d0,JSON['stringify'](_0x9b00a2));return _0x3c6dc4;}function isValidIdToken(_0x381da2,_0x110834){try{var _0x447188=jwt['decode'](_0x381da2,{'complete':!![]});var _0x3ca0ee=_0x447188[_0xebaa('0x32')];if(_0x3ca0ee[_0xebaa('0x33')]!==_0x110834[_0xebaa('0x34')])return![];if(_0x3ca0ee['aud']!==_0x110834[_0xebaa('0x35')])return![];if(_0x3ca0ee['nonce']!==_0x110834[_0xebaa('0x2b')])return![];if(moment()[_0xebaa('0x36')](moment[_0xebaa('0x37')](_0x3ca0ee[_0xebaa('0x38')])))return![];return!![];}catch(_0x2258b4){throw _0x2258b4;}}function refreshOauth2MicrosoftAccessToken(_0x11b40e){return Promise[_0xebaa('0x39')]()[_0xebaa('0x3a')](function(){if(_0x11b40e[_0xebaa('0x3b')])return _0x11b40e;return db[_0xebaa('0x3c')]['findOne']({'where':{'id':_0x11b40e['id']},'raw':!![]});})[_0xebaa('0x3a')](function(_0x38f76f){var _0x157f03={'grant_type':'refresh_token','refresh_token':_0x38f76f['data6'],'scope':getAccessTokenScope(_0x38f76f),'redirect_uri':_0x38f76f[_0xebaa('0x28')],'client_id':_0x38f76f[_0xebaa('0x25')],'client_secret':encryptor[_0xebaa('0x3d')](_0x38f76f[_0xebaa('0x3b')])};var _0x43c5d1={'method':_0xebaa('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xebaa('0x1d')](_0xebaa('0x1e'),_0x38f76f[_0xebaa('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x157f03,'json':!![]};return rp(_0x43c5d1);})[_0xebaa('0x3a')](function(_0xe36e5a){_0x11b40e[_0xebaa('0x40')]=_0xe36e5a[_0xebaa('0x41')];_0x11b40e[_0xebaa('0x42')]=_0xe36e5a[_0xebaa('0x43')];return db[_0xebaa('0x3c')]['update']({'data5':_0x11b40e[_0xebaa('0x40')],'data6':_0x11b40e[_0xebaa('0x42')]},{'where':{'id':_0x11b40e['id']}});})[_0xebaa('0x3a')](function(){return _0x11b40e;})[_0xebaa('0x44')](function(_0x44f86c){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x11b40e['id'],_0x44f86c);});}function getOauth2MicrosoftAccessToken(_0x568c54,_0x2d58e2){var _0x3f0d07={'grant_type':'authorization_code','code':_0x568c54,'scope':getAccessTokenScope(_0x2d58e2),'redirect_uri':_0x2d58e2[_0xebaa('0x28')],'client_id':_0x2d58e2[_0xebaa('0x25')],'client_secret':encryptor['decryptString'](_0x2d58e2['data3'])};var _0x3b717b={'method':_0xebaa('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xebaa('0x1d')]('{TENANT_ID}',_0x2d58e2[_0xebaa('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f0d07,'json':!![]};return rp(_0x3b717b);}function startRefreshInterval(_0x85e9aa){var _0x5751d2=schedule['intervals'];if(_0x5751d2[_0x85e9aa['id']])clearInterval(_0x5751d2[_0x85e9aa['id']]);_0x5751d2[_0x85e9aa['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xebaa('0x45')](this,{'id':_0x85e9aa['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5751d2;}function startAllRefreshIntervals(){return db[_0xebaa('0x3c')][_0xebaa('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x51e13f){var _0x5f3052=_0x51e13f[_0xebaa('0x15')](function(_0xc68884){return refreshOauth2MicrosoftAccessToken(_0xc68884)[_0xebaa('0x3a')](function(_0x5aa804){startRefreshInterval(_0x5aa804);});});return Promise['all'](_0x5f3052);})[_0xebaa('0x44')](function(_0x5220c3){var _0xe732b0=_0x5220c3?util[_0xebaa('0x47')](_0x5220c3,{'showHidden':![],'depth':null}):'';logger[_0xebaa('0x48')](_0xebaa('0x49'),_0xe732b0);});}module[_0xebaa('0x4a')]={'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 189a3a0..06c4ec6 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 _0x7d8a=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x7d8a[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var moment=require(_0xa7d8('0x2'));var BPromise=require(_0xa7d8('0x3'));var rs=require(_0xa7d8('0x4'));var fs=require('fs');var Redis=require(_0xa7d8('0x5'));var db=require(_0xa7d8('0x6'))['db'];var utils=require(_0xa7d8('0x7'));var logger=require(_0xa7d8('0x8'))(_0xa7d8('0x9'));var config=require(_0xa7d8('0xa'));var jayson=require(_0xa7d8('0xb'));var client=jayson[_0xa7d8('0xc')][_0xa7d8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x55bb66,_0x410b09,_0x2e1955){return new BPromise(function(_0x1807cc,_0x455082){return client[_0xa7d8('0xe')](_0x55bb66,_0x2e1955)['then'](function(_0x40f419){logger['info'](_0xa7d8('0xf'),_0x410b09,'request\x20sent');logger[_0xa7d8('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x410b09,_0xa7d8('0x11'),JSON[_0xa7d8('0x12')](_0x40f419));if(_0x40f419['error']){if(_0x40f419[_0xa7d8('0x13')]['code']===0x1f4){logger[_0xa7d8('0x13')](_0xa7d8('0xf'),_0x410b09,_0x40f419[_0xa7d8('0x13')]['message']);return _0x455082(_0x40f419[_0xa7d8('0x13')][_0xa7d8('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x410b09,_0x40f419['error'][_0xa7d8('0x14')]);return _0x1807cc(_0x40f419[_0xa7d8('0x13')][_0xa7d8('0x14')]);}else{logger[_0xa7d8('0x15')](_0xa7d8('0xf'),_0x410b09,_0xa7d8('0x11'));_0x1807cc(_0x40f419[_0xa7d8('0x16')][_0xa7d8('0x14')]);}})[_0xa7d8('0x17')](function(_0xfc0284){logger[_0xa7d8('0x13')](_0xa7d8('0xf'),_0x410b09,_0xfc0284);_0x455082(_0xfc0284);});});} \ No newline at end of file +var _0x87bc=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','client'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x87bc,0x189));var _0xc87b=function(_0x56f292,_0x113fc9){_0x56f292=_0x56f292-0x0;var _0x117ee9=_0x87bc[_0x56f292];return _0x117ee9;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc87b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc87b('0x5')][_0xc87b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402aac,_0x5d1813,_0x50b19b){return new BPromise(function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x7')](_0x402aac,_0x50b19b)[_0xc87b('0x8')](function(_0x19b571){logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));logger[_0xc87b('0xc')](_0xc87b('0xd'),_0x5d1813,'request\x20sent',JSON['stringify'](_0x19b571));if(_0x19b571[_0xc87b('0xe')]){if(_0x19b571['error'][_0xc87b('0xf')]===0x1f4){logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571[_0xc87b('0xe')]['message']);return _0x1999f8(_0x19b571[_0xc87b('0xe')]['message']);}logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571['error'][_0xc87b('0x10')]);return _0x4ed0c5(_0x19b571[_0xc87b('0xe')]['message']);}else{logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));_0x4ed0c5(_0x19b571[_0xc87b('0x11')][_0xc87b('0x10')]);}})[_0xc87b('0x12')](function(_0x4009ef){logger[_0xc87b('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5d1813,_0x4009ef);_0x1999f8(_0x4009ef);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9ae2f90..ce91ee8 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0xd695,_0x4469af){var _0x3f4bf1=function(_0x1eae51){while(--_0x1eae51){_0xd695['push'](_0xd695['shift']());}};_0x3f4bf1(++_0x4469af);}(_0x2ef3,0xba));var _0x32ef=function(_0x2da418,_0x11591a){_0x2da418=_0x2da418-0x0;var _0x56ee3b=_0x2ef3[_0x2da418];return _0x56ee3b;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x24e1f3,_0x424234){var _0x34fe3f=function(_0x32b238){while(--_0x32b238){_0x24e1f3['push'](_0x24e1f3['shift']());}};_0x34fe3f(++_0x424234);}(_0x2ef3,0xba));var _0x32ef=function(_0x2575d9,_0x7fade9){_0x2575d9=_0x2575d9-0x0;var _0x2fae9e=_0x2ef3[_0x2575d9];return _0x2fae9e;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 63d9306..2a0880b 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 _0x9e87=['name','exports','STRING'];(function(_0x56e07e,_0xfd0481){var _0x446548=function(_0x20dfe4){while(--_0x20dfe4){_0x56e07e['push'](_0x56e07e['shift']());}};_0x446548(++_0xfd0481);}(_0x9e87,0x1ba));var _0x79e8=function(_0x36616c,_0x23a468){_0x36616c=_0x36616c-0x0;var _0x56e518=_0x9e87[_0x36616c];return _0x56e518;};'use strict';var Sequelize=require('sequelize');module[_0x79e8('0x0')]={'name':{'type':Sequelize[_0x79e8('0x1')],'unique':_0x79e8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x79e8('0x1')]},'companyId':{'type':Sequelize[_0x79e8('0x1')]},'website':{'type':Sequelize[_0x79e8('0x1')]},'phone':{'type':Sequelize[_0x79e8('0x1')]},'fax':{'type':Sequelize[_0x79e8('0x1')]},'type':{'type':Sequelize[_0x79e8('0x1')]},'street':{'type':Sequelize[_0x79e8('0x1')]},'postalCode':{'type':Sequelize[_0x79e8('0x1')]},'city':{'type':Sequelize[_0x79e8('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x79e8('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x79e8('0x1')]},'sStreet':{'type':Sequelize[_0x79e8('0x1')]},'sPostalCode':{'type':Sequelize[_0x79e8('0x1')]},'sCity':{'type':Sequelize[_0x79e8('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79e8('0x1')]}}; \ No newline at end of file +var _0xfd28=['exports','STRING'];(function(_0x5cc666,_0x4607f3){var _0x379fd0=function(_0x3918af){while(--_0x3918af){_0x5cc666['push'](_0x5cc666['shift']());}};_0x379fd0(++_0x4607f3);}(_0xfd28,0x148));var _0x8fd2=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xfd28[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require('sequelize');module[_0x8fd2('0x0')]={'name':{'type':Sequelize[_0x8fd2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8fd2('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x8fd2('0x1')]},'phone':{'type':Sequelize[_0x8fd2('0x1')]},'fax':{'type':Sequelize[_0x8fd2('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8fd2('0x1')]},'postalCode':{'type':Sequelize[_0x8fd2('0x1')]},'city':{'type':Sequelize[_0x8fd2('0x1')]},'country':{'type':Sequelize[_0x8fd2('0x1')]},'email':{'type':Sequelize[_0x8fd2('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8fd2('0x1')]},'sCity':{'type':Sequelize[_0x8fd2('0x1')]},'sCountry':{'type':Sequelize[_0x8fd2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d7a0084..c4a2fe2 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 _0x7c84=['user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','options','CmCompany','includeAll','findAll','rows','catch','params','include','merge','find','create','body'];(function(_0x215c68,_0xfb7290){var _0x16682a=function(_0x21de61){while(--_0x21de61){_0x215c68['push'](_0x215c68['shift']());}};_0x16682a(++_0xfb7290);}(_0x7c84,0xb5));var _0x47c8=function(_0x525428,_0x396124){_0x525428=_0x525428-0x0;var _0x133d40=_0x7c84[_0x525428];return _0x133d40;};'use strict';var emlformat=require(_0x47c8('0x0'));var rimraf=require(_0x47c8('0x1'));var zipdir=require(_0x47c8('0x2'));var jsonpatch=require(_0x47c8('0x3'));var rp=require(_0x47c8('0x4'));var moment=require('moment');var BPromise=require(_0x47c8('0x5'));var Mustache=require(_0x47c8('0x6'));var util=require(_0x47c8('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x47c8('0x8'));var fs=require('fs');var fs_extra=require(_0x47c8('0x9'));var _=require(_0x47c8('0xa'));var squel=require(_0x47c8('0xb'));var crypto=require('crypto');var jsforce=require(_0x47c8('0xc'));var deskjs=require(_0x47c8('0xd'));var toCsv=require(_0x47c8('0xe'));var querystring=require(_0x47c8('0xf'));var Papa=require(_0x47c8('0x10'));var Redis=require(_0x47c8('0x11'));var authService=require(_0x47c8('0x12'));var qs=require(_0x47c8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47c8('0x14'));var logger=require('../../config/logger')(_0x47c8('0x15'));var utils=require(_0x47c8('0x16'));var config=require(_0x47c8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x47c8('0x18'))['db'];function respondWithStatusCode(_0x41e9fe,_0x2e5ba5){_0x2e5ba5=_0x2e5ba5||0xcc;return function(_0x4ea7d0){if(_0x4ea7d0){return _0x41e9fe[_0x47c8('0x19')](_0x2e5ba5);}return _0x41e9fe[_0x47c8('0x1a')](_0x2e5ba5)[_0x47c8('0x1b')]();};}function respondWithResult(_0x5f552c,_0x17e973){_0x17e973=_0x17e973||0xc8;return function(_0x4f050a){if(_0x4f050a){return _0x5f552c['status'](_0x17e973)[_0x47c8('0x1c')](_0x4f050a);}};}function respondWithFilteredResult(_0x582713,_0x5df296){return function(_0x1caa01){if(_0x1caa01){var _0x45d92a=typeof _0x5df296[_0x47c8('0x1d')]===_0x47c8('0x1e')&&typeof _0x5df296[_0x47c8('0x1f')]===_0x47c8('0x1e');var _0x5aead3=_0x1caa01[_0x47c8('0x20')];var _0x3a730a=_0x45d92a?0x0:_0x5df296[_0x47c8('0x1d')];var _0xf4ce37=_0x45d92a?_0x1caa01[_0x47c8('0x20')]:_0x5df296[_0x47c8('0x1d')]+_0x5df296['limit'];var _0x11bc69;if(_0xf4ce37>=_0x5aead3){_0xf4ce37=_0x5aead3;_0x11bc69=0xc8;}else{_0x11bc69=0xce;}_0x582713[_0x47c8('0x1a')](_0x11bc69);return _0x582713[_0x47c8('0x21')]('Content-Range',_0x3a730a+'-'+_0xf4ce37+'/'+_0x5aead3)[_0x47c8('0x1c')](_0x1caa01);}return null;};}function patchUpdates(_0x4ed8b6){return function(_0x44d4f8){try{jsonpatch[_0x47c8('0x22')](_0x44d4f8,_0x4ed8b6,!![]);}catch(_0x5cddc3){return BPromise[_0x47c8('0x23')](_0x5cddc3);}return _0x44d4f8[_0x47c8('0x24')]();};}function saveUpdates(_0x21039f,_0x2baddc){return function(_0x6f6c7c){if(_0x6f6c7c){return _0x6f6c7c[_0x47c8('0x25')](_0x21039f)[_0x47c8('0x26')](function(_0x19a68b){return _0x19a68b;});}return null;};}function removeEntity(_0x1e3336,_0x13845a){return function(_0x1c464c){if(_0x1c464c){return _0x1c464c[_0x47c8('0x27')]()[_0x47c8('0x26')](function(){var _0x420b02=_0x1c464c[_0x47c8('0x28')]({'plain':!![]});var _0x2f1a85=_0x47c8('0x29');return db[_0x47c8('0x2a')][_0x47c8('0x27')]({'where':{'type':_0x2f1a85,'resourceId':_0x420b02['id']}})['then'](function(){return _0x1c464c;});})[_0x47c8('0x26')](function(){_0x1e3336[_0x47c8('0x1a')](0xcc)[_0x47c8('0x1b')]();});}};}function handleEntityNotFound(_0x545912,_0x37aa9f){return function(_0x36cfcc){if(!_0x36cfcc){_0x545912[_0x47c8('0x19')](0x194);}return _0x36cfcc;};}function handleError(_0x393901,_0x3ef589){_0x3ef589=_0x3ef589||0x1f4;return function(_0x589f73){logger[_0x47c8('0x2b')](_0x589f73['stack']);if(_0x589f73[_0x47c8('0x2c')]){delete _0x589f73[_0x47c8('0x2c')];}_0x393901[_0x47c8('0x1a')](_0x3ef589)[_0x47c8('0x2d')](_0x589f73);};}exports['index']=function(_0x3d3445,_0x2a8d7e){var _0x406404={},_0x463d27={},_0xbbbebf={'count':0x0,'rows':[]};return db['CmCompany'][_0x47c8('0x2e')]()[_0x47c8('0x26')](function(_0x30c42a){_0x463d27[_0x47c8('0x2f')]=_[_0x47c8('0x30')](_0x30c42a);_0x463d27[_0x47c8('0x31')]=_['keys'](_0x3d3445[_0x47c8('0x31')]);_0x463d27[_0x47c8('0x32')]=_[_0x47c8('0x33')](_0x463d27['model'],_0x463d27[_0x47c8('0x31')]);_0x406404[_0x47c8('0x34')]=_[_0x47c8('0x33')](_0x463d27[_0x47c8('0x2f')],qs['fields'](_0x3d3445['query'][_0x47c8('0x35')]));_0x406404[_0x47c8('0x34')]=_0x406404[_0x47c8('0x34')][_0x47c8('0x36')]?_0x406404['attributes']:_0x463d27[_0x47c8('0x2f')];if(!_0x3d3445['query'][_0x47c8('0x37')](_0x47c8('0x38'))){_0x406404[_0x47c8('0x1f')]=qs['limit'](_0x3d3445[_0x47c8('0x31')][_0x47c8('0x1f')]);_0x406404[_0x47c8('0x1d')]=qs[_0x47c8('0x1d')](_0x3d3445[_0x47c8('0x31')][_0x47c8('0x1d')]);}_0x406404[_0x47c8('0x39')]=qs[_0x47c8('0x3a')](_0x3d3445[_0x47c8('0x31')][_0x47c8('0x3a')]);_0x406404[_0x47c8('0x3b')]=qs[_0x47c8('0x32')](_['pick'](_0x3d3445[_0x47c8('0x31')],_0x463d27[_0x47c8('0x32')]),_0x30c42a);if(_0x3d3445['query'][_0x47c8('0x3c')]){_0x406404['where']=_['merge'](_0x406404['where'],{'$or':_[_0x47c8('0x3d')](_0x406404['attributes'],function(_0x18bdb6){var _0x556c3b={};_0x556c3b[_0x18bdb6]={'$like':'%'+_0x3d3445['query'][_0x47c8('0x3c')]+'%'};return _0x556c3b;})});}_0x406404=_['merge']({},_0x406404,_0x3d3445[_0x47c8('0x3e')]);var _0x5dae22={'where':_0x406404[_0x47c8('0x3b')]};return db[_0x47c8('0x3f')]['count'](_0x5dae22)['then'](function(_0x3bc375){_0xbbbebf[_0x47c8('0x20')]=_0x3bc375;if(_0x3d3445[_0x47c8('0x31')][_0x47c8('0x40')]){_0x406404['include']=[{'all':!![]}];}return db[_0x47c8('0x3f')][_0x47c8('0x41')](_0x406404);})[_0x47c8('0x26')](function(_0x42bc17){_0xbbbebf[_0x47c8('0x42')]=_0x42bc17;return _0xbbbebf;})['then'](respondWithFilteredResult(_0x2a8d7e,_0x406404))[_0x47c8('0x43')](handleError(_0x2a8d7e,null));})[_0x47c8('0x43')](handleError(_0x2a8d7e,null));};exports['show']=function(_0x7a9861,_0xb64e6f){var _0x41be0c={'raw':![],'where':{'id':_0x7a9861[_0x47c8('0x44')]['id']}},_0x42d0de={};_0x42d0de[_0x47c8('0x2f')]=_[_0x47c8('0x30')](db['CmCompany']['rawAttributes']);_0x42d0de[_0x47c8('0x31')]=_['keys'](_0x7a9861[_0x47c8('0x31')]);_0x42d0de[_0x47c8('0x32')]=_[_0x47c8('0x33')](_0x42d0de['model'],_0x42d0de[_0x47c8('0x31')]);_0x41be0c[_0x47c8('0x34')]=_[_0x47c8('0x33')](_0x42d0de['model'],qs[_0x47c8('0x35')](_0x7a9861[_0x47c8('0x31')]['fields']));_0x41be0c['attributes']=_0x41be0c[_0x47c8('0x34')][_0x47c8('0x36')]?_0x41be0c[_0x47c8('0x34')]:_0x42d0de['model'];if(_0x7a9861[_0x47c8('0x31')]['includeAll']){_0x41be0c[_0x47c8('0x45')]=[{'all':!![]}];}_0x41be0c=_[_0x47c8('0x46')]({},_0x41be0c,_0x7a9861[_0x47c8('0x3e')]);return db[_0x47c8('0x3f')][_0x47c8('0x47')](_0x41be0c)['then'](handleEntityNotFound(_0xb64e6f,null))[_0x47c8('0x26')](respondWithResult(_0xb64e6f,null))[_0x47c8('0x43')](handleError(_0xb64e6f,null));};exports[_0x47c8('0x48')]=function(_0x304a31,_0x5528e7){return db['CmCompany']['create'](_0x304a31[_0x47c8('0x49')],{})['then'](function(_0x9bf9d){var _0x4948fa=_0x304a31[_0x47c8('0x4a')]['get']({'plain':!![]});if(!_0x4948fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4948fa[_0x47c8('0x4b')]===_0x47c8('0x4a')){var _0x2cd941=_0x9bf9d['get']({'plain':!![]});var _0xa3b960='Companies';return db[_0x47c8('0x4c')][_0x47c8('0x47')]({'where':{'name':_0xa3b960,'userProfileId':_0x4948fa[_0x47c8('0x4d')]},'raw':!![]})[_0x47c8('0x26')](function(_0x329328){if(_0x329328&&_0x329328['autoAssociation']===0x0){return db[_0x47c8('0x2a')][_0x47c8('0x48')]({'name':_0x2cd941[_0x47c8('0x2c')],'resourceId':_0x2cd941['id'],'type':_0x329328[_0x47c8('0x2c')],'sectionId':_0x329328['id']},{})['then'](function(){return _0x9bf9d;});}else{return _0x9bf9d;}})[_0x47c8('0x43')](function(_0x5de1b1){logger[_0x47c8('0x2b')](_0x47c8('0x4e'),_0x5de1b1);throw _0x5de1b1;});}return _0x9bf9d;})[_0x47c8('0x26')](respondWithResult(_0x5528e7,0xc9))[_0x47c8('0x43')](handleError(_0x5528e7,null));};exports[_0x47c8('0x25')]=function(_0x217c41,_0x5616aa){if(_0x217c41[_0x47c8('0x49')]['id']){delete _0x217c41[_0x47c8('0x49')]['id'];}return db[_0x47c8('0x3f')][_0x47c8('0x47')]({'where':{'id':_0x217c41[_0x47c8('0x44')]['id']}})[_0x47c8('0x26')](handleEntityNotFound(_0x5616aa,null))[_0x47c8('0x26')](saveUpdates(_0x217c41[_0x47c8('0x49')],null))['then'](respondWithResult(_0x5616aa,null))[_0x47c8('0x43')](handleError(_0x5616aa,null));};exports[_0x47c8('0x27')]=function(_0x17b0ea,_0x117a76){return db[_0x47c8('0x3f')][_0x47c8('0x47')]({'where':{'id':_0x17b0ea[_0x47c8('0x44')]['id']}})[_0x47c8('0x26')](handleEntityNotFound(_0x117a76,null))[_0x47c8('0x26')](removeEntity(_0x117a76,null))[_0x47c8('0x43')](handleError(_0x117a76,null));};exports['describe']=function(_0x532557,_0x322534){return db[_0x47c8('0x3f')][_0x47c8('0x2e')]()[_0x47c8('0x26')](respondWithResult(_0x322534,null))[_0x47c8('0x43')](handleError(_0x322534,null));};exports[_0x47c8('0x4f')]=function(_0x4ece88,_0x1e3876,_0x14a7c3){return db[_0x47c8('0x50')][_0x47c8('0x47')]({'where':{'id':_0x4ece88[_0x47c8('0x44')]['id']}})[_0x47c8('0x26')](handleEntityNotFound(_0x1e3876,null))[_0x47c8('0x26')](function(_0x461f6c){if(_0x461f6c){return _0x461f6c['addContacts'](_0x4ece88[_0x47c8('0x49')][_0x47c8('0x51')],_[_0x47c8('0x52')](_0x4ece88[_0x47c8('0x49')],[_0x47c8('0x51'),'id'])||{});}})[_0x47c8('0x26')](respondWithResult(_0x1e3876,null))['catch'](handleError(_0x1e3876,null));};exports[_0x47c8('0x53')]=function(_0x7a5d60,_0x81cd69,_0x505b95){var _0x21b4a7={};var _0x2c46bc={};var _0x10aaff;var _0x204ead;return db['CmCompany']['findOne']({'where':{'id':_0x7a5d60[_0x47c8('0x44')]['id']}})['then'](handleEntityNotFound(_0x81cd69,null))['then'](function(_0xab44bb){if(_0xab44bb){_0x10aaff=_0xab44bb;_0x2c46bc[_0x47c8('0x2f')]=_[_0x47c8('0x30')](db[_0x47c8('0x50')][_0x47c8('0x54')]);_0x2c46bc[_0x47c8('0x31')]=_[_0x47c8('0x30')](_0x7a5d60[_0x47c8('0x31')]);_0x2c46bc['filters']=_[_0x47c8('0x33')](_0x2c46bc[_0x47c8('0x2f')],_0x2c46bc[_0x47c8('0x31')]);_0x21b4a7[_0x47c8('0x34')]=_[_0x47c8('0x33')](_0x2c46bc[_0x47c8('0x2f')],qs['fields'](_0x7a5d60['query'][_0x47c8('0x35')]));_0x21b4a7['attributes']=_0x21b4a7[_0x47c8('0x34')]['length']?_0x21b4a7[_0x47c8('0x34')]:_0x2c46bc[_0x47c8('0x2f')];_0x21b4a7[_0x47c8('0x39')]=qs[_0x47c8('0x3a')](_0x7a5d60[_0x47c8('0x31')]['sort']);_0x21b4a7['where']=qs[_0x47c8('0x32')](_['pick'](_0x7a5d60[_0x47c8('0x31')],_0x2c46bc[_0x47c8('0x32')]));if(_0x7a5d60[_0x47c8('0x31')][_0x47c8('0x3c')]){_0x21b4a7[_0x47c8('0x3b')]=_[_0x47c8('0x46')](_0x21b4a7[_0x47c8('0x3b')],{'$or':_[_0x47c8('0x3d')](_0x21b4a7[_0x47c8('0x34')],function(_0x5a7c1b){var _0x187214={};_0x187214[_0x5a7c1b]={'$like':'%'+_0x7a5d60[_0x47c8('0x31')][_0x47c8('0x3c')]+'%'};return _0x187214;})});}_0x21b4a7=_[_0x47c8('0x46')]({},_0x21b4a7,_0x7a5d60['options']);return _0x10aaff[_0x47c8('0x53')](_0x21b4a7);}})[_0x47c8('0x26')](function(_0x8b06e9){if(_0x8b06e9){_0x204ead=_0x8b06e9[_0x47c8('0x36')];if(!_0x7a5d60['query']['hasOwnProperty']('nolimit')){_0x21b4a7['limit']=qs[_0x47c8('0x1f')](_0x7a5d60['query'][_0x47c8('0x1f')]);_0x21b4a7['offset']=qs['offset'](_0x7a5d60[_0x47c8('0x31')]['offset']);}return _0x10aaff['getContacts'](_0x21b4a7);}})['then'](function(_0xa3b8db){if(_0xa3b8db){return _0xa3b8db?{'count':_0x204ead,'rows':_0xa3b8db}:null;}})[_0x47c8('0x26')](respondWithResult(_0x81cd69,null))[_0x47c8('0x43')](handleError(_0x81cd69,null));}; \ No newline at end of file +var _0x1171=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids','omit','findOne','order','map','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','count','limit','set','update','then','destroy','get','Companies','end','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource'];(function(_0x57c235,_0x3e998f){var _0x46bdc2=function(_0x43db6b){while(--_0x43db6b){_0x57c235['push'](_0x57c235['shift']());}};_0x46bdc2(++_0x3e998f);}(_0x1171,0x15f));var _0x1117=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0x1171[_0x5b8646];return _0x363e4c;};'use strict';var emlformat=require(_0x1117('0x0'));var rimraf=require(_0x1117('0x1'));var zipdir=require(_0x1117('0x2'));var jsonpatch=require(_0x1117('0x3'));var rp=require(_0x1117('0x4'));var moment=require(_0x1117('0x5'));var BPromise=require(_0x1117('0x6'));var Mustache=require(_0x1117('0x7'));var util=require(_0x1117('0x8'));var path=require(_0x1117('0x9'));var sox=require('sox');var csv=require(_0x1117('0xa'));var ejs=require(_0x1117('0xb'));var fs=require('fs');var fs_extra=require(_0x1117('0xc'));var _=require(_0x1117('0xd'));var squel=require('squel');var crypto=require(_0x1117('0xe'));var jsforce=require(_0x1117('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1117('0x10'));var Papa=require(_0x1117('0x11'));var Redis=require(_0x1117('0x12'));var authService=require(_0x1117('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1117('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1117('0x15'))('api');var utils=require(_0x1117('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1117('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f6cc9,_0x19e013){_0x19e013=_0x19e013||0xcc;return function(_0x48302f){if(_0x48302f){return _0x4f6cc9[_0x1117('0x18')](_0x19e013);}return _0x4f6cc9[_0x1117('0x19')](_0x19e013)['end']();};}function respondWithResult(_0xd97153,_0x212b1d){_0x212b1d=_0x212b1d||0xc8;return function(_0x4e53dd){if(_0x4e53dd){return _0xd97153[_0x1117('0x19')](_0x212b1d)[_0x1117('0x1a')](_0x4e53dd);}};}function respondWithFilteredResult(_0x4cbc80,_0x2e6b5f){return function(_0x4c51ca){if(_0x4c51ca){var _0x40718b=typeof _0x2e6b5f[_0x1117('0x1b')]==='undefined'&&typeof _0x2e6b5f['limit']==='undefined';var _0xda8d86=_0x4c51ca[_0x1117('0x1c')];var _0x15eb78=_0x40718b?0x0:_0x2e6b5f[_0x1117('0x1b')];var _0x812fbf=_0x40718b?_0x4c51ca['count']:_0x2e6b5f[_0x1117('0x1b')]+_0x2e6b5f[_0x1117('0x1d')];var _0x14ba55;if(_0x812fbf>=_0xda8d86){_0x812fbf=_0xda8d86;_0x14ba55=0xc8;}else{_0x14ba55=0xce;}_0x4cbc80['status'](_0x14ba55);return _0x4cbc80[_0x1117('0x1e')]('Content-Range',_0x15eb78+'-'+_0x812fbf+'/'+_0xda8d86)[_0x1117('0x1a')](_0x4c51ca);}return null;};}function patchUpdates(_0x5c480b){return function(_0x340388){try{jsonpatch['apply'](_0x340388,_0x5c480b,!![]);}catch(_0x5df12b){return BPromise['reject'](_0x5df12b);}return _0x340388['save']();};}function saveUpdates(_0x53c82f,_0x5a377a){return function(_0x4dec7d){if(_0x4dec7d){return _0x4dec7d[_0x1117('0x1f')](_0x53c82f)[_0x1117('0x20')](function(_0x33ae68){return _0x33ae68;});}return null;};}function removeEntity(_0x474f7c,_0x4494f5){return function(_0x540aa6){if(_0x540aa6){return _0x540aa6[_0x1117('0x21')]()[_0x1117('0x20')](function(){var _0x2b8bf1=_0x540aa6[_0x1117('0x22')]({'plain':!![]});var _0x4bced6=_0x1117('0x23');return db['UserProfileResource'][_0x1117('0x21')]({'where':{'type':_0x4bced6,'resourceId':_0x2b8bf1['id']}})[_0x1117('0x20')](function(){return _0x540aa6;});})['then'](function(){_0x474f7c[_0x1117('0x19')](0xcc)[_0x1117('0x24')]();});}};}function handleEntityNotFound(_0x1e4cac,_0x5e160c){return function(_0x3e6d69){if(!_0x3e6d69){_0x1e4cac['sendStatus'](0x194);}return _0x3e6d69;};}function handleError(_0x339639,_0x135b4c){_0x135b4c=_0x135b4c||0x1f4;return function(_0x1859dd){logger[_0x1117('0x25')](_0x1859dd[_0x1117('0x26')]);if(_0x1859dd[_0x1117('0x27')]){delete _0x1859dd[_0x1117('0x27')];}_0x339639[_0x1117('0x19')](_0x135b4c)[_0x1117('0x28')](_0x1859dd);};}exports[_0x1117('0x29')]=function(_0x968d67,_0x1044b9){var _0x45b55a={},_0x222f85={},_0x451533={'count':0x0,'rows':[]};return db[_0x1117('0x2a')][_0x1117('0x2b')]()[_0x1117('0x20')](function(_0x8233fe){_0x222f85[_0x1117('0x2c')]=_[_0x1117('0x2d')](_0x8233fe);_0x222f85[_0x1117('0x2e')]=_[_0x1117('0x2d')](_0x968d67[_0x1117('0x2e')]);_0x222f85['filters']=_[_0x1117('0x2f')](_0x222f85[_0x1117('0x2c')],_0x222f85[_0x1117('0x2e')]);_0x45b55a[_0x1117('0x30')]=_['intersection'](_0x222f85[_0x1117('0x2c')],qs[_0x1117('0x31')](_0x968d67[_0x1117('0x2e')]['fields']));_0x45b55a[_0x1117('0x30')]=_0x45b55a['attributes'][_0x1117('0x32')]?_0x45b55a[_0x1117('0x30')]:_0x222f85['model'];if(!_0x968d67[_0x1117('0x2e')][_0x1117('0x33')](_0x1117('0x34'))){_0x45b55a[_0x1117('0x1d')]=qs['limit'](_0x968d67[_0x1117('0x2e')]['limit']);_0x45b55a[_0x1117('0x1b')]=qs[_0x1117('0x1b')](_0x968d67['query'][_0x1117('0x1b')]);}_0x45b55a['order']=qs[_0x1117('0x35')](_0x968d67['query'][_0x1117('0x35')]);_0x45b55a['where']=qs['filters'](_[_0x1117('0x36')](_0x968d67[_0x1117('0x2e')],_0x222f85[_0x1117('0x37')]),_0x8233fe);if(_0x968d67['query'][_0x1117('0x38')]){_0x45b55a[_0x1117('0x39')]=_[_0x1117('0x3a')](_0x45b55a[_0x1117('0x39')],{'$or':_['map'](_0x45b55a['attributes'],function(_0x28074c){var _0x409284={};_0x409284[_0x28074c]={'$like':'%'+_0x968d67[_0x1117('0x2e')][_0x1117('0x38')]+'%'};return _0x409284;})});}_0x45b55a=_[_0x1117('0x3a')]({},_0x45b55a,_0x968d67[_0x1117('0x3b')]);var _0x2ab875={'where':_0x45b55a[_0x1117('0x39')]};return db['CmCompany'][_0x1117('0x1c')](_0x2ab875)[_0x1117('0x20')](function(_0x5e2f58){_0x451533['count']=_0x5e2f58;if(_0x968d67[_0x1117('0x2e')][_0x1117('0x3c')]){_0x45b55a[_0x1117('0x3d')]=[{'all':!![]}];}return db[_0x1117('0x2a')]['findAll'](_0x45b55a);})[_0x1117('0x20')](function(_0x356aa8){_0x451533[_0x1117('0x3e')]=_0x356aa8;return _0x451533;})[_0x1117('0x20')](respondWithFilteredResult(_0x1044b9,_0x45b55a))['catch'](handleError(_0x1044b9,null));})[_0x1117('0x3f')](handleError(_0x1044b9,null));};exports[_0x1117('0x40')]=function(_0x48c238,_0x12dead){var _0x56c142={'raw':![],'where':{'id':_0x48c238['params']['id']}},_0x2468f5={};_0x2468f5[_0x1117('0x2c')]=_[_0x1117('0x2d')](db[_0x1117('0x2a')][_0x1117('0x41')]);_0x2468f5[_0x1117('0x2e')]=_[_0x1117('0x2d')](_0x48c238[_0x1117('0x2e')]);_0x2468f5[_0x1117('0x37')]=_[_0x1117('0x2f')](_0x2468f5[_0x1117('0x2c')],_0x2468f5[_0x1117('0x2e')]);_0x56c142[_0x1117('0x30')]=_[_0x1117('0x2f')](_0x2468f5[_0x1117('0x2c')],qs[_0x1117('0x31')](_0x48c238[_0x1117('0x2e')][_0x1117('0x31')]));_0x56c142[_0x1117('0x30')]=_0x56c142[_0x1117('0x30')]['length']?_0x56c142['attributes']:_0x2468f5[_0x1117('0x2c')];if(_0x48c238[_0x1117('0x2e')]['includeAll']){_0x56c142['include']=[{'all':!![]}];}_0x56c142=_[_0x1117('0x3a')]({},_0x56c142,_0x48c238[_0x1117('0x3b')]);return db['CmCompany'][_0x1117('0x42')](_0x56c142)['then'](handleEntityNotFound(_0x12dead,null))[_0x1117('0x20')](respondWithResult(_0x12dead,null))[_0x1117('0x3f')](handleError(_0x12dead,null));};exports['create']=function(_0x233e8a,_0x2457dc){return db[_0x1117('0x2a')][_0x1117('0x43')](_0x233e8a['body'],{})[_0x1117('0x20')](function(_0x3875d3){var _0x3a78b0=_0x233e8a[_0x1117('0x44')][_0x1117('0x22')]({'plain':!![]});if(!_0x3a78b0)throw new Error(_0x1117('0x45'));if(_0x3a78b0[_0x1117('0x46')]===_0x1117('0x44')){var _0x4c78e7=_0x3875d3[_0x1117('0x22')]({'plain':!![]});var _0x5f1dff=_0x1117('0x23');return db[_0x1117('0x47')][_0x1117('0x42')]({'where':{'name':_0x5f1dff,'userProfileId':_0x3a78b0['userProfileId']},'raw':!![]})[_0x1117('0x20')](function(_0x13fcc1){if(_0x13fcc1&&_0x13fcc1[_0x1117('0x48')]===0x0){return db[_0x1117('0x49')][_0x1117('0x43')]({'name':_0x4c78e7[_0x1117('0x27')],'resourceId':_0x4c78e7['id'],'type':_0x13fcc1[_0x1117('0x27')],'sectionId':_0x13fcc1['id']},{})[_0x1117('0x20')](function(){return _0x3875d3;});}else{return _0x3875d3;}})[_0x1117('0x3f')](function(_0x5a8b4a){logger[_0x1117('0x25')](_0x1117('0x4a'),_0x5a8b4a);throw _0x5a8b4a;});}return _0x3875d3;})[_0x1117('0x20')](respondWithResult(_0x2457dc,0xc9))[_0x1117('0x3f')](handleError(_0x2457dc,null));};exports['update']=function(_0x21e231,_0x1e04f9){if(_0x21e231[_0x1117('0x4b')]['id']){delete _0x21e231[_0x1117('0x4b')]['id'];}return db[_0x1117('0x2a')][_0x1117('0x42')]({'where':{'id':_0x21e231['params']['id']}})['then'](handleEntityNotFound(_0x1e04f9,null))[_0x1117('0x20')](saveUpdates(_0x21e231[_0x1117('0x4b')],null))[_0x1117('0x20')](respondWithResult(_0x1e04f9,null))['catch'](handleError(_0x1e04f9,null));};exports[_0x1117('0x21')]=function(_0x3df7cf,_0x28e879){return db[_0x1117('0x2a')]['find']({'where':{'id':_0x3df7cf[_0x1117('0x4c')]['id']}})[_0x1117('0x20')](handleEntityNotFound(_0x28e879,null))[_0x1117('0x20')](removeEntity(_0x28e879,null))[_0x1117('0x3f')](handleError(_0x28e879,null));};exports[_0x1117('0x2b')]=function(_0x332d21,_0x532f0d){return db[_0x1117('0x2a')]['describe']()[_0x1117('0x20')](respondWithResult(_0x532f0d,null))[_0x1117('0x3f')](handleError(_0x532f0d,null));};exports[_0x1117('0x4d')]=function(_0x3456ca,_0x203eaf,_0x481ef2){return db[_0x1117('0x4e')][_0x1117('0x42')]({'where':{'id':_0x3456ca[_0x1117('0x4c')]['id']}})[_0x1117('0x20')](handleEntityNotFound(_0x203eaf,null))[_0x1117('0x20')](function(_0x58a63e){if(_0x58a63e){return _0x58a63e[_0x1117('0x4d')](_0x3456ca[_0x1117('0x4b')][_0x1117('0x4f')],_[_0x1117('0x50')](_0x3456ca[_0x1117('0x4b')],[_0x1117('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x203eaf,null))['catch'](handleError(_0x203eaf,null));};exports['getContacts']=function(_0x25c0ed,_0x85a3c,_0x2c5896){var _0x122230={};var _0x448420={};var _0x5080b1;var _0x4eb8ba;return db[_0x1117('0x2a')][_0x1117('0x51')]({'where':{'id':_0x25c0ed[_0x1117('0x4c')]['id']}})[_0x1117('0x20')](handleEntityNotFound(_0x85a3c,null))[_0x1117('0x20')](function(_0x13def3){if(_0x13def3){_0x5080b1=_0x13def3;_0x448420['model']=_[_0x1117('0x2d')](db[_0x1117('0x4e')][_0x1117('0x41')]);_0x448420[_0x1117('0x2e')]=_['keys'](_0x25c0ed[_0x1117('0x2e')]);_0x448420['filters']=_['intersection'](_0x448420[_0x1117('0x2c')],_0x448420[_0x1117('0x2e')]);_0x122230[_0x1117('0x30')]=_[_0x1117('0x2f')](_0x448420[_0x1117('0x2c')],qs[_0x1117('0x31')](_0x25c0ed[_0x1117('0x2e')][_0x1117('0x31')]));_0x122230[_0x1117('0x30')]=_0x122230['attributes'][_0x1117('0x32')]?_0x122230['attributes']:_0x448420['model'];_0x122230[_0x1117('0x52')]=qs[_0x1117('0x35')](_0x25c0ed['query']['sort']);_0x122230[_0x1117('0x39')]=qs[_0x1117('0x37')](_[_0x1117('0x36')](_0x25c0ed[_0x1117('0x2e')],_0x448420['filters']));if(_0x25c0ed['query'][_0x1117('0x38')]){_0x122230[_0x1117('0x39')]=_[_0x1117('0x3a')](_0x122230[_0x1117('0x39')],{'$or':_[_0x1117('0x53')](_0x122230[_0x1117('0x30')],function(_0x2871c9){var _0x5376a1={};_0x5376a1[_0x2871c9]={'$like':'%'+_0x25c0ed[_0x1117('0x2e')][_0x1117('0x38')]+'%'};return _0x5376a1;})});}_0x122230=_[_0x1117('0x3a')]({},_0x122230,_0x25c0ed[_0x1117('0x3b')]);return _0x5080b1['getContacts'](_0x122230);}})[_0x1117('0x20')](function(_0x5198e5){if(_0x5198e5){_0x4eb8ba=_0x5198e5[_0x1117('0x32')];if(!_0x25c0ed[_0x1117('0x2e')][_0x1117('0x33')]('nolimit')){_0x122230[_0x1117('0x1d')]=qs['limit'](_0x25c0ed[_0x1117('0x2e')][_0x1117('0x1d')]);_0x122230['offset']=qs['offset'](_0x25c0ed[_0x1117('0x2e')][_0x1117('0x1b')]);}return _0x5080b1[_0x1117('0x54')](_0x122230);}})['then'](function(_0x58143d){if(_0x58143d){return _0x58143d?{'count':_0x4eb8ba,'rows':_0x58143d}:null;}})[_0x1117('0x20')](respondWithResult(_0x85a3c,null))[_0x1117('0x3f')](handleError(_0x85a3c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 1181ca1..088be2d 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 _0x335c=['path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13023b,_0x51328e){var _0x458326=function(_0x24d4cf){while(--_0x24d4cf){_0x13023b['push'](_0x13023b['shift']());}};_0x458326(++_0x51328e);}(_0x335c,0x1da));var _0xc335=function(_0xf4f3c2,_0x48bcbc){_0xf4f3c2=_0xf4f3c2-0x0;var _0x1380d6=_0x335c[_0xf4f3c2];return _0x1380d6;};'use strict';var _=require(_0xc335('0x0'));var util=require(_0xc335('0x1'));var logger=require(_0xc335('0x2'))(_0xc335('0x3'));var moment=require(_0xc335('0x4'));var BPromise=require(_0xc335('0x5'));var rp=require(_0xc335('0x6'));var fs=require('fs');var path=require(_0xc335('0x7'));var rimraf=require('rimraf');var config=require(_0xc335('0x8'));var attributes=require(_0xc335('0x9'));module[_0xc335('0xa')]=function(_0x3f2d9b,_0x1a133d){return _0x3f2d9b[_0xc335('0xb')](_0xc335('0xc'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a58=['moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','CmCompany','cm_companies','lodash','../../config/logger'];(function(_0x5108f0,_0x3a8263){var _0x7157df=function(_0x442b03){while(--_0x442b03){_0x5108f0['push'](_0x5108f0['shift']());}};_0x7157df(++_0x3a8263);}(_0x1a58,0x12a));var _0x81a5=function(_0x410ccc,_0x53359f){_0x410ccc=_0x410ccc-0x0;var _0x3472f5=_0x1a58[_0x410ccc];return _0x3472f5;};'use strict';var _=require(_0x81a5('0x0'));var util=require('util');var logger=require(_0x81a5('0x1'))('api');var moment=require(_0x81a5('0x2'));var BPromise=require(_0x81a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81a5('0x4'));var rimraf=require(_0x81a5('0x5'));var config=require(_0x81a5('0x6'));var attributes=require(_0x81a5('0x7'));module['exports']=function(_0x19312c,_0x3def88){return _0x19312c['define'](_0x81a5('0x8'),attributes,{'tableName':_0x81a5('0x9'),'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 f014c4c..4dad229 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 _0xba6d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x146beb,_0x57b1f4){var _0x404c81=function(_0x320269){while(--_0x320269){_0x146beb['push'](_0x146beb['shift']());}};_0x404c81(++_0x57b1f4);}(_0xba6d,0xeb));var _0xdba6=function(_0x17be5e,_0x35edc6){_0x17be5e=_0x17be5e-0x0;var _0x7b900f=_0xba6d[_0x17be5e];return _0x7b900f;};'use strict';var _=require('lodash');var util=require(_0xdba6('0x0'));var moment=require(_0xdba6('0x1'));var BPromise=require(_0xdba6('0x2'));var rs=require(_0xdba6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdba6('0x4'))['db'];var utils=require(_0xdba6('0x5'));var logger=require(_0xdba6('0x6'))('rpc');var config=require(_0xdba6('0x7'));var jayson=require(_0xdba6('0x8'));var client=jayson[_0xdba6('0x9')][_0xdba6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x305f55,_0x16d39a,_0x304b16){return new BPromise(function(_0x103077,_0x29da7c){return client['request'](_0x305f55,_0x304b16)[_0xdba6('0xb')](function(_0x5ad502){logger[_0xdba6('0xc')](_0xdba6('0xd'),_0x16d39a,_0xdba6('0xe'));logger[_0xdba6('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x16d39a,_0xdba6('0xe'),JSON[_0xdba6('0x10')](_0x5ad502));if(_0x5ad502['error']){if(_0x5ad502[_0xdba6('0x11')]['code']===0x1f4){logger[_0xdba6('0x11')](_0xdba6('0xd'),_0x16d39a,_0x5ad502['error'][_0xdba6('0x12')]);return _0x29da7c(_0x5ad502[_0xdba6('0x11')][_0xdba6('0x12')]);}logger[_0xdba6('0x11')](_0xdba6('0xd'),_0x16d39a,_0x5ad502[_0xdba6('0x11')][_0xdba6('0x12')]);return _0x103077(_0x5ad502[_0xdba6('0x11')][_0xdba6('0x12')]);}else{logger[_0xdba6('0xc')](_0xdba6('0xd'),_0x16d39a,_0xdba6('0xe'));_0x103077(_0x5ad502[_0xdba6('0x13')]['message']);}})['catch'](function(_0x5b1bdd){logger[_0xdba6('0x11')](_0xdba6('0xd'),_0x16d39a,_0x5b1bdd);_0x29da7c(_0x5b1bdd);});});} \ No newline at end of file +var _0x9268=['../../config/utils','../../config/logger','../../config/environment','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1a3cc7,_0x2900e3){var _0x338438=function(_0x5a4872){while(--_0x5a4872){_0x1a3cc7['push'](_0x1a3cc7['shift']());}};_0x338438(++_0x2900e3);}(_0x9268,0x10b));var _0x8926=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0x9268[_0x1bb812];return _0x372adb;};'use strict';var _=require(_0x8926('0x0'));var util=require(_0x8926('0x1'));var moment=require(_0x8926('0x2'));var BPromise=require(_0x8926('0x3'));var rs=require(_0x8926('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8926('0x5'))['db'];var utils=require(_0x8926('0x6'));var logger=require(_0x8926('0x7'))('rpc');var config=require(_0x8926('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2abd,_0x54f988,_0x20c783){return new BPromise(function(_0x31f2b6,_0x1215b9){return client[_0x8926('0x9')](_0x1c2abd,_0x20c783)[_0x8926('0xa')](function(_0xe2bb31){logger[_0x8926('0xb')](_0x8926('0xc'),_0x54f988,_0x8926('0xd'));logger[_0x8926('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x54f988,_0x8926('0xd'),JSON[_0x8926('0xf')](_0xe2bb31));if(_0xe2bb31[_0x8926('0x10')]){if(_0xe2bb31[_0x8926('0x10')][_0x8926('0x11')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x54f988,_0xe2bb31[_0x8926('0x10')][_0x8926('0x12')]);return _0x1215b9(_0xe2bb31[_0x8926('0x10')]['message']);}logger[_0x8926('0x10')](_0x8926('0xc'),_0x54f988,_0xe2bb31[_0x8926('0x10')][_0x8926('0x12')]);return _0x31f2b6(_0xe2bb31[_0x8926('0x10')][_0x8926('0x12')]);}else{logger['info'](_0x8926('0xc'),_0x54f988,_0x8926('0xd'));_0x31f2b6(_0xe2bb31[_0x8926('0x13')][_0x8926('0x12')]);}})[_0x8926('0x14')](function(_0x576674){logger[_0x8926('0x10')]('CmCompany,\x20%s,\x20%s',_0x54f988,_0x576674);_0x1215b9(_0x576674);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5ff1e48..8f876fe 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 _0x0cfe=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','delete','exports','multer','express','Router'];(function(_0x5b5317,_0x2a49c4){var _0x3a212a=function(_0x44c6ba){while(--_0x44c6ba){_0x5b5317['push'](_0x5b5317['shift']());}};_0x3a212a(++_0x2a49c4);}(_0x0cfe,0xb5));var _0xe0cf=function(_0x4a9446,_0x511bb8){_0x4a9446=_0x4a9446-0x0;var _0x5065eb=_0x0cfe[_0x4a9446];return _0x5065eb;};'use strict';var multer=require(_0xe0cf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe0cf('0x1'));var router=express[_0xe0cf('0x2')]();var fs_extra=require(_0xe0cf('0x3'));var auth=require(_0xe0cf('0x4'));var interaction=require(_0xe0cf('0x5'));var config=require(_0xe0cf('0x6'));var controller=require(_0xe0cf('0x7'));router['get']('/',auth[_0xe0cf('0x8')](),controller[_0xe0cf('0x9')]);router[_0xe0cf('0xa')](_0xe0cf('0xb'),auth[_0xe0cf('0x8')](),controller[_0xe0cf('0xc')]);router[_0xe0cf('0xa')](_0xe0cf('0xd'),auth[_0xe0cf('0x8')](),controller[_0xe0cf('0xe')]);router[_0xe0cf('0xa')](_0xe0cf('0xf'),auth[_0xe0cf('0x8')](),controller[_0xe0cf('0x10')]);router[_0xe0cf('0x11')]('/',auth[_0xe0cf('0x8')](),controller[_0xe0cf('0x12')]);router['post'](_0xe0cf('0xf'),auth[_0xe0cf('0x8')](),controller[_0xe0cf('0x13')]);router[_0xe0cf('0x14')]('/:id',auth[_0xe0cf('0x8')](),controller['update']);router[_0xe0cf('0x15')](_0xe0cf('0xd'),auth[_0xe0cf('0x8')](),controller['destroy']);module[_0xe0cf('0x16')]=router; \ No newline at end of file +var _0x9ab2=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id/contacts','post','create','addContacts','/:id','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ab2,0x192));var _0x29ab=function(_0x138c60,_0x437d9a){_0x138c60=_0x138c60-0x0;var _0xfc850b=_0x9ab2[_0x138c60];return _0xfc850b;};'use strict';var multer=require(_0x29ab('0x0'));var util=require(_0x29ab('0x1'));var path=require('path');var timeout=require(_0x29ab('0x2'));var express=require(_0x29ab('0x3'));var router=express[_0x29ab('0x4')]();var fs_extra=require(_0x29ab('0x5'));var auth=require(_0x29ab('0x6'));var interaction=require(_0x29ab('0x7'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x29ab('0x8')]('/',auth[_0x29ab('0x9')](),controller['index']);router['get'](_0x29ab('0xa'),auth[_0x29ab('0x9')](),controller['describe']);router[_0x29ab('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x29ab('0x8')](_0x29ab('0xb'),auth['isAuthenticated'](),controller['getContacts']);router[_0x29ab('0xc')]('/',auth[_0x29ab('0x9')](),controller[_0x29ab('0xd')]);router[_0x29ab('0xc')](_0x29ab('0xb'),auth[_0x29ab('0x9')](),controller[_0x29ab('0xe')]);router['put'](_0x29ab('0xf'),auth['isAuthenticated'](),controller[_0x29ab('0x10')]);router[_0x29ab('0x11')](_0x29ab('0xf'),auth[_0x29ab('0x9')](),controller[_0x29ab('0x12')]);module[_0x29ab('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3c8fd36..04e8bd5 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 _0x9528=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9528,0xae));var _0x8952=function(_0x1417be,_0x1558c7){_0x1417be=_0x1417be-0x0;var _0x34a33e=_0x9528[_0x1417be];return _0x34a33e;};'use strict';var _=require(_0x8952('0x0'));var Sequelize=require('sequelize');module[_0x8952('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8952('0x2')]},'street':{'type':Sequelize[_0x8952('0x2')]},'postalCode':{'type':Sequelize[_0x8952('0x2')]},'city':{'type':Sequelize[_0x8952('0x2')]},'country':{'type':Sequelize[_0x8952('0x2')]},'dateOfBirth':{'type':Sequelize[_0x8952('0x2')]},'description':{'type':Sequelize[_0x8952('0x3')]},'phone':{'type':Sequelize[_0x8952('0x2')]},'mobile':{'type':Sequelize[_0x8952('0x2')]},'fax':{'type':Sequelize[_0x8952('0x2')]},'email':{'type':Sequelize[_0x8952('0x2')]},'url':{'type':Sequelize[_0x8952('0x2')]},'facebook':{'type':Sequelize[_0x8952('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x8952('0x2')]},'teams':{'type':Sequelize[_0x8952('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x8952('0x2')]},'wechat':{'type':Sequelize[_0x8952('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x8952('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x8952('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8952('0x5')],'defaultValue':Sequelize[_0x8952('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x8952('0x4')]}}; \ No newline at end of file +var _0x0b5e=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x4b96b4,_0x9041f1){var _0x10222b=function(_0x470cf7){while(--_0x470cf7){_0x4b96b4['push'](_0x4b96b4['shift']());}};_0x10222b(++_0x9041f1);}(_0x0b5e,0xd0));var _0xe0b5=function(_0x2a0078,_0x44254d){_0x2a0078=_0x2a0078-0x0;var _0x485cc2=_0x0b5e[_0x2a0078];return _0x485cc2;};'use strict';var _=require(_0xe0b5('0x0'));var Sequelize=require(_0xe0b5('0x1'));module[_0xe0b5('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b5('0x3')]},'street':{'type':Sequelize[_0xe0b5('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe0b5('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe0b5('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xe0b5('0x3')]},'fax':{'type':Sequelize[_0xe0b5('0x3')]},'email':{'type':Sequelize[_0xe0b5('0x3')]},'url':{'type':Sequelize[_0xe0b5('0x3')]},'facebook':{'type':Sequelize[_0xe0b5('0x3')]},'fb_data':{'type':Sequelize[_0xe0b5('0x3')]},'twitter':{'type':Sequelize[_0xe0b5('0x3')]},'skype':{'type':Sequelize[_0xe0b5('0x3')]},'teams':{'type':Sequelize[_0xe0b5('0x3')]},'viber':{'type':Sequelize[_0xe0b5('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b5('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xe0b5('0x3')]},'priority':{'type':Sequelize[_0xe0b5('0x5')](0x2)[_0xe0b5('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b5('0x7')],'defaultValue':Sequelize[_0xe0b5('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'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 6823c58..e860084 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 _0xf7a5=['../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','query','user','CmContact','find','params','tags','keys','startsWith','cf_','columnName','displayName','analytics','CmCustomField','length','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','findAll','from','get','mergeWith','isArray','CmHopper','CmHopperBlack','ChatInteraction','ChatMessage','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','catch','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','ListId','findOrCreate','spread','push','all','Tag','Tags','color','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','pickBy','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','options','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','create','item','PHONE','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','getHoppers','nolimit','ContactId','filter','includeAll','getHopperHistories','include','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','agent','binding','../../components/import/cm/csv2','stringify','exit','importUpdates','User','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','note','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','DESC','browserName','customerIp','customerPort','deviceModel','ratingType','ratingValue','referer','subject','Interaction','reverse','value','slice','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs'];(function(_0x27b39b,_0x1b9786){var _0x700a04=function(_0x2dab19){while(--_0x2dab19){_0x27b39b['push'](_0x27b39b['shift']());}};_0x700a04(++_0x1b9786);}(_0xf7a5,0x1ef));var _0x5f7a=function(_0x4d94db,_0x5a2d71){_0x4d94db=_0x4d94db-0x0;var _0x41d157=_0xf7a5[_0x4d94db];return _0x41d157;};'use strict';var moment=require('moment');var BPromise=require(_0x5f7a('0x0'));var util=require(_0x5f7a('0x1'));var path=require(_0x5f7a('0x2'));var fs=require('fs');var _=require(_0x5f7a('0x3'));var squel=require(_0x5f7a('0x4'));var Papa=require(_0x5f7a('0x5'));var Redis=require(_0x5f7a('0x6'));var contacts=require(_0x5f7a('0x7'));var qs=require(_0x5f7a('0x8'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var shared=require(_0x5f7a('0x9'));var db=require(_0x5f7a('0xa'))['db'];config[_0x5f7a('0xb')]=_[_0x5f7a('0xc')](config[_0x5f7a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f7a('0xd'))(new Redis(config[_0x5f7a('0xb')]));require(_0x5f7a('0xe'))[_0x5f7a('0xf')](socket);function respondWithResult(_0x426cae,_0x36d61f){_0x36d61f=_0x36d61f||0xc8;return function(_0xdf92fa){if(_0xdf92fa){return _0x426cae[_0x5f7a('0x10')](_0x36d61f)[_0x5f7a('0x11')](_0xdf92fa);}};}function respondWithFilteredResult(_0x32db85,_0x6834aa){return function(_0x11c27d){if(_0x11c27d){var _0x245e62=typeof _0x6834aa[_0x5f7a('0x12')]===_0x5f7a('0x13')&&typeof _0x6834aa[_0x5f7a('0x14')]==='undefined';var _0x8e44bf=_0x11c27d[_0x5f7a('0x15')];var _0x8bf680=_0x245e62?0x0:_0x6834aa[_0x5f7a('0x12')];var _0x539fa6=_0x245e62?_0x11c27d[_0x5f7a('0x15')]:_0x6834aa[_0x5f7a('0x12')]+_0x6834aa[_0x5f7a('0x14')];var _0x46d7c7;if(_0x539fa6>=_0x8e44bf){_0x539fa6=_0x8e44bf;_0x46d7c7=0xc8;}else{_0x46d7c7=0xce;}_0x32db85[_0x5f7a('0x10')](_0x46d7c7);return _0x32db85[_0x5f7a('0x16')](_0x5f7a('0x17'),_0x8bf680+'-'+_0x539fa6+'/'+_0x8e44bf)[_0x5f7a('0x11')](_0x11c27d);}return null;};}function saveUpdates(_0x558073){return function(_0x24c3d7){if(_0x24c3d7){return _0x24c3d7['update'](_0x558073)[_0x5f7a('0x18')](function(_0x21d604){return _0x21d604;});}return null;};}function removeEntity(_0x170bc3){return function(_0x37b30a){if(_0x37b30a){return _0x37b30a[_0x5f7a('0x19')]()[_0x5f7a('0x18')](function(){_0x170bc3['status'](0xcc)[_0x5f7a('0x1a')]();});}};}function handleEntityNotFound(_0x3d4df4){return function(_0x4573f0){if(!_0x4573f0){_0x3d4df4[_0x5f7a('0x1b')](0x194);}return _0x4573f0;};}function handleError(_0x531903,_0x3604ff){_0x3604ff=_0x3604ff||0x1f4;return function(_0x4b7b0b){logger[_0x5f7a('0x1c')](_0x4b7b0b[_0x5f7a('0x1d')]);if(_0x4b7b0b[_0x5f7a('0x1e')]){delete _0x4b7b0b[_0x5f7a('0x1e')];}_0x531903[_0x5f7a('0x10')](_0x3604ff)[_0x5f7a('0x1f')](_0x4b7b0b);};}exports[_0x5f7a('0x20')]=function(_0x29ba7f,_0x2aa3dd){var _0x3ee9fb={};return contacts[_0x5f7a('0x21')]()[_0x5f7a('0x18')](function(_0xdf6496){_0x3ee9fb=qs[_0x5f7a('0x22')](_0xdf6496,_0x29ba7f);return contacts['findAll'](_0x29ba7f[_0x5f7a('0x23')],_0x29ba7f[_0x5f7a('0x24')],_0x3ee9fb,_0xdf6496);})[_0x5f7a('0x18')](respondWithFilteredResult(_0x2aa3dd,_0x3ee9fb))['catch'](handleError(_0x2aa3dd,null));};exports[_0x5f7a('0x19')]=function(_0x2a437e,_0x1b4dd4){return db[_0x5f7a('0x25')][_0x5f7a('0x26')]({'where':{'id':_0x2a437e[_0x5f7a('0x27')]['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0x1b4dd4,null))[_0x5f7a('0x18')](removeEntity(_0x1b4dd4,null))['catch'](handleError(_0x1b4dd4,null));};exports[_0x5f7a('0x21')]=function(_0x136f41,_0x325ca5){return db[_0x5f7a('0x25')][_0x5f7a('0x21')]()[_0x5f7a('0x18')](function(_0x439ad6){delete _0x439ad6[_0x5f7a('0x28')];for(var _0x34dd5e=0x0;_0x34dd5e0x0){return new Promise(function(_0x18457d){var _0x492519=[];for(var _0x4a3e55=0x0;_0x4a3e55<_0x11b463[_0x5f7a('0x30')];_0x4a3e55++){_0x492519[_0x5f7a('0x67')](insertAdditionalPhones(_0x11b463[_0x4a3e55]['contact'],_0x11b463[_0x4a3e55][_0x5f7a('0x5f')]));}Promise[_0x5f7a('0x68')](_0x492519)[_0x5f7a('0x18')](function(){_0x18457d(0x1);});})[_0x5f7a('0x18')](function(){return{'success':_0x316a39,'failure':_0x475e35,'duplicates':_0x41bb4a};});}else{return{'success':_0x316a39,'failure':_0x475e35,'duplicates':_0x41bb4a};}}})['then'](respondWithResult(_0x5d445c,0xc9))[_0x5f7a('0x59')](handleError(_0x5d445c,null));};exports['show']=function(_0x17f65f,_0x5467b2){var _0x2750b9;return db['CmContact'][_0x5f7a('0x21')]()[_0x5f7a('0x18')](function(_0x24aedf){return db[_0x5f7a('0x25')][_0x5f7a('0x26')]({'where':{'id':_0x17f65f['params']['id']},'include':[{'model':db[_0x5f7a('0x69')],'as':_0x5f7a('0x6a'),'attributes':['id',_0x5f7a('0x1e'),_0x5f7a('0x6b')],'required':_0x17f65f[_0x5f7a('0x23')][_0x5f7a('0x6c')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x17f65f[_0x5f7a('0x27')]['id']},'required':![],'include':[{'model':db[_0x5f7a('0x6d')],'as':_0x5f7a('0x6e')}]}],'order':[db[_0x5f7a('0x6f')][_0x5f7a('0x70')](_0x5f7a('0x71'))],'attributes':_[_0x5f7a('0x29')](_0x24aedf)});})[_0x5f7a('0x18')](function(_0x483ed0){if(!_[_0x5f7a('0x5b')](_0x483ed0)){_0x2750b9=_0x483ed0['get']({'plain':!![]});var _0x411905={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x483ed0&&_0x483ed0['ListId']){if(_0x483ed0[_0x5f7a('0x64')]){_0x411905[_0x5f7a('0x63')][_0x5f7a('0x72')]['push']({'ListId':{'$ne':_0x483ed0[_0x5f7a('0x64')]}});}}return db['CmCustomField'][_0x5f7a('0x3b')](_0x411905);}})[_0x5f7a('0x18')](function(_0x5aebf9){if(!_[_0x5f7a('0x5b')](_0x5aebf9)){return _[_0x5f7a('0x73')](_0x2750b9,_[_0x5f7a('0x74')](_0x5aebf9,function(_0x3d9c08){return util[_0x5f7a('0x75')]('cf_%d',_0x3d9c08['id']);}));}})[_0x5f7a('0x18')](handleEntityNotFound(_0x5467b2,null))[_0x5f7a('0x18')](respondWithResult(_0x5467b2,null))[_0x5f7a('0x59')](handleError(_0x5467b2,null));};exports['update']=function(_0x1c58b7,_0x242c75){var _0x413028;if(_0x1c58b7[_0x5f7a('0x3a')]['id']){delete _0x1c58b7['body']['id'];}if(!_[_0x5f7a('0x5b')](_0x1c58b7['body']['dialTimezone'])){var _0x537fb3=_0x1c58b7[_0x5f7a('0x3a')]['dialTimezone'];if(!_[_0x5f7a('0x5b')](shared[_0x5f7a('0x5d')][_0x537fb3]))_0x1c58b7[_0x5f7a('0x3a')][_0x5f7a('0x5e')]=shared['timezones'][_0x537fb3]['utcOffset'];}return db[_0x5f7a('0x25')][_0x5f7a('0x26')]({'where':{'id':_0x1c58b7[_0x5f7a('0x27')]['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0x242c75,null))['then'](saveUpdates(_0x1c58b7[_0x5f7a('0x3a')],null))[_0x5f7a('0x18')](function(_0x3bf856){_0x413028=_0x3bf856;var _0x19641d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3bf856&&_0x3bf856[_0x5f7a('0x64')]){if(_0x3bf856[_0x5f7a('0x64')]){_0x19641d[_0x5f7a('0x63')]['$and'][_0x5f7a('0x67')]({'ListId':{'$ne':_0x3bf856['ListId']}});}}return db['CmCustomField'][_0x5f7a('0x3b')](_0x19641d);})['then'](function(_0x3dfa89){if(_0x3dfa89){return _[_0x5f7a('0x73')](_[_0x5f7a('0x76')](_0x1c58b7[_0x5f7a('0x3a')],function(_0x544144,_0x3b6fd7){return _[_0x5f7a('0x2a')](_0x3b6fd7,_0x5f7a('0x2b'));}),_[_0x5f7a('0x74')](_0x3dfa89,function(_0x107572){return util[_0x5f7a('0x75')](_0x5f7a('0x77'),_0x107572['id']);}));}})[_0x5f7a('0x18')](function(_0x2e351f){if(_0x2e351f&&!_[_0x5f7a('0x78')](_0x2e351f)){var _0x4a4648=squel[_0x5f7a('0x44')]()['table'](_0x5f7a('0x79'))['setFields'](_0x2e351f)[_0x5f7a('0x63')](_0x5f7a('0x7a'),_0x1c58b7[_0x5f7a('0x27')]['id'])[_0x5f7a('0x7b')]();return db['sequelize'][_0x5f7a('0x23')](_0x4a4648['text'],{'replacements':_0x4a4648[_0x5f7a('0x34')]});}})[_0x5f7a('0x18')](function(){if(_0x1c58b7[_0x5f7a('0x3a')][_0x5f7a('0x7c')]&&_0x413028){return db['CmHopper'][_0x5f7a('0x44')]({'phone':_0x1c58b7[_0x5f7a('0x3a')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x413028['id']}});}})[_0x5f7a('0x18')](function(){return _0x413028;})[_0x5f7a('0x18')](respondWithResult(_0x242c75,null))[_0x5f7a('0x59')](handleError(_0x242c75,null));};exports[_0x5f7a('0x7d')]=function(_0x1e2877,_0x2fe923){var _0x598982={};var _0x5e65ab={};var _0x1455b1;var _0x384cc9;return db['CmContact'][_0x5f7a('0x7e')]({'where':{'id':_0x1e2877[_0x5f7a('0x27')]['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0x2fe923,null))[_0x5f7a('0x18')](function(_0x16fedb){if(_0x16fedb){_0x1455b1=_0x16fedb;_0x5e65ab['model']=_['keys'](db['Tag'][_0x5f7a('0x7f')]);_0x5e65ab['query']=_[_0x5f7a('0x29')](_0x1e2877[_0x5f7a('0x23')]);_0x5e65ab[_0x5f7a('0x80')]=_[_0x5f7a('0x81')](_0x5e65ab[_0x5f7a('0x82')],_0x5e65ab[_0x5f7a('0x23')]);_0x598982[_0x5f7a('0x83')]=_['intersection'](_0x5e65ab['model'],qs[_0x5f7a('0x84')](_0x1e2877[_0x5f7a('0x23')][_0x5f7a('0x84')]));_0x598982[_0x5f7a('0x83')]=_0x598982['attributes'][_0x5f7a('0x30')]?_0x598982[_0x5f7a('0x83')]:_0x5e65ab['model'];_0x598982[_0x5f7a('0x85')]=qs[_0x5f7a('0x86')](_0x1e2877[_0x5f7a('0x23')][_0x5f7a('0x86')]);_0x598982['where']=qs['filters'](_[_0x5f7a('0x87')](_0x1e2877['query'],_0x5e65ab['filters']));if(_0x1e2877['query']['filter']){_0x598982[_0x5f7a('0x63')]=_[_0x5f7a('0x39')](_0x598982[_0x5f7a('0x63')],{'$or':_[_0x5f7a('0x74')](_0x598982[_0x5f7a('0x83')],function(_0x4a4838){var _0x1efaf7={};_0x1efaf7[_0x4a4838]={'$like':'%'+_0x1e2877[_0x5f7a('0x23')]['filter']+'%'};return _0x1efaf7;})});}_0x598982=_[_0x5f7a('0x39')]({},_0x598982,_0x1e2877[_0x5f7a('0x88')]);return _0x1455b1[_0x5f7a('0x7d')](_0x598982);}})[_0x5f7a('0x18')](function(_0x23ef67){if(_0x23ef67){_0x384cc9=_0x23ef67[_0x5f7a('0x30')];if(!_0x1e2877[_0x5f7a('0x23')]['hasOwnProperty']('nolimit')){_0x598982[_0x5f7a('0x14')]=qs['limit'](_0x1e2877[_0x5f7a('0x23')][_0x5f7a('0x14')]);_0x598982['offset']=qs[_0x5f7a('0x12')](_0x1e2877[_0x5f7a('0x23')][_0x5f7a('0x12')]);}return _0x1455b1[_0x5f7a('0x7d')](_0x598982);}})[_0x5f7a('0x18')](function(_0x2e302c){if(_0x2e302c){return _0x2e302c?{'count':_0x384cc9,'rows':_0x2e302c}:null;}})['then'](respondWithResult(_0x2fe923,null))[_0x5f7a('0x59')](handleError(_0x2fe923,null));};exports[_0x5f7a('0x89')]=function(_0x273453,_0x5dc277){if(_0x273453['body']['id']){delete _0x273453[_0x5f7a('0x3a')]['id'];}return db['CmContact'][_0x5f7a('0x7e')]({'where':{'id':_0x273453['params']['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0x5dc277,null))[_0x5f7a('0x18')](function(_0x2158e8){if(_0x2158e8){return _0x2158e8[_0x5f7a('0x89')](_0x273453[_0x5f7a('0x3a')][_0x5f7a('0x8a')]||[]);}return null;})[_0x5f7a('0x18')](respondWithResult(_0x5dc277,null))[_0x5f7a('0x59')](handleError(_0x5dc277,null));};exports['setAdditionalPhones']=function(_0x32efd1,_0x1d66da){var _0x3c967b=[];_0x3c967b[_0x5f7a('0x67')](addAdditionalPhones(_0x32efd1[_0x5f7a('0x3a')]));Promise[_0x5f7a('0x68')](_0x3c967b)[_0x5f7a('0x18')](function(){_0x3c967b=[];_0x3c967b[_0x5f7a('0x67')](deleteCmHopperPhones(_0x32efd1[_0x5f7a('0x3a')]['id']));_0x3c967b['push'](addCmHopperPhones(_0x32efd1['body']['id']));Promise[_0x5f7a('0x68')](_0x3c967b)['then'](function(){return[0x1];})[_0x5f7a('0x18')](respondWithResult(_0x1d66da,null));});};function addAdditionalPhones(_0x2d5e77){var _0x1c15d9;return new Promise(function(_0x43e535){return db[_0x5f7a('0x4e')][_0x5f7a('0x19')]({'where':{'CmContactId':_0x2d5e77['id']}})[_0x5f7a('0x18')](function(){db[_0x5f7a('0x6d')][_0x5f7a('0x3b')]({'raw':!![],'attributes':['id',_0x5f7a('0x8b')]})[_0x5f7a('0x18')](function(_0xed4ecc){var _0x378317=[];for(var _0x4ab771=0x0;_0x4ab771<_0x2d5e77[_0x5f7a('0x8c')][_0x5f7a('0x30')];_0x4ab771++){var _0x365685=_0x2d5e77['item_types']?_[_0x5f7a('0x5b')](_0x2d5e77[_0x5f7a('0x8d')][_0x4ab771])?'':_0x2d5e77[_0x5f7a('0x8d')][_0x4ab771]:_0x2d5e77[_0x5f7a('0x8c')][_0x4ab771][_0x5f7a('0x8e')]?_0x2d5e77[_0x5f7a('0x8c')][_0x4ab771][_0x5f7a('0x8e')]:'';var _0x7cd8a9=_[_0x5f7a('0x5b')](_0x2d5e77[_0x5f7a('0x8c')][_0x4ab771][_0x5f7a('0x8f')])?'':_0x2d5e77[_0x5f7a('0x8c')][_0x4ab771][_0x5f7a('0x8f')];var _0x86bb60=_0x365685+':'+_0x2d5e77['items'][_0x4ab771][_0x5f7a('0x7c')]+'§'+_0x7cd8a9;if(_[_0x5f7a('0x5b')](_0x1c15d9))_0x1c15d9=_0x86bb60;else _0x1c15d9+=';'+_0x86bb60;var _0x42881b=null;var _0x9c2ca6=null;if(_0x2d5e77[_0x5f7a('0x8d')]){if(!_['isNil'](_0x2d5e77['item_types'][_0x4ab771])){_0x9c2ca6=_[_0x5f7a('0x26')](_0xed4ecc,function(_0x1e16de){return _0x1e16de['id']===_0x2d5e77[_0x5f7a('0x8d')][_0x4ab771];});if(!_[_0x5f7a('0x5b')](_0x9c2ca6)){_0x42881b=_0x9c2ca6['OrderBy'];}}}else{if(!_[_0x5f7a('0x5b')](_0x2d5e77[_0x5f7a('0x8c')][_0x4ab771])){_0x9c2ca6=_['find'](_0xed4ecc,function(_0x367fe6){return _0x367fe6['id']===_0x2d5e77[_0x5f7a('0x8c')][_0x4ab771][_0x5f7a('0x8e')];});if(!_[_0x5f7a('0x5b')](_0x9c2ca6)){_0x42881b=_0x4ab771;}}}if(_[_0x5f7a('0x5b')](_0x42881b)){_0x42881b=0x64;}_0x378317[_0x5f7a('0x67')](addAdditionalPhone(_0x2d5e77['id'],_0x2d5e77['items'][_0x4ab771][_0x5f7a('0x7c')],_0x2d5e77[_0x5f7a('0x8d')]?_[_0x5f7a('0x5b')](_0x2d5e77[_0x5f7a('0x8d')][_0x4ab771])?null:_0x2d5e77[_0x5f7a('0x8d')][_0x4ab771]:_0x2d5e77[_0x5f7a('0x8c')][_0x4ab771][_0x5f7a('0x8e')]?_0x2d5e77['items'][_0x4ab771][_0x5f7a('0x8e')]:null,_0x42881b,_0x7cd8a9));}Promise[_0x5f7a('0x68')](_0x378317)['then'](function(){db[_0x5f7a('0x25')][_0x5f7a('0x44')]({'AdditionalPhones':_0x1c15d9},{'where':{'id':_0x2d5e77['id']}})['then'](function(){_0x43e535(0x1);});});});});});}function addAdditionalPhone(_0xa1dc1b,_0x209c50,_0x24fcc0,_0x52fc66,_0x2b34e9){return db['CmContactHasItem'][_0x5f7a('0x26')]({'where':{'CmContactId':_0xa1dc1b,'item':_0x209c50}})['then'](function(_0x3339a0){if(_0x3339a0)logger[_0x5f7a('0x35')]('contact\x20phone\x20exists',_0x3339a0);else{db[_0x5f7a('0x4e')][_0x5f7a('0x90')]({'CmContactId':_0xa1dc1b,'item':_0x209c50,'ItemTypeId':_0x24fcc0,'OrderBy':_0x52fc66,'ItemClass':'PHONE','description':_0x2b34e9});}});}function deleteCmHopperPhones(_0x543306){return new Promise(function(_0x4c080b){return db[_0x5f7a('0x40')][_0x5f7a('0x3b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x543306}})[_0x5f7a('0x18')](function(_0x479985){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x479985,'id')}}});})['then'](function(){_0x4c080b(0x1);});});}function addCmHopperPhones(_0x14b603){return new Promise(function(_0x37b963){return db[_0x5f7a('0x40')][_0x5f7a('0x3b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x14b603}})[_0x5f7a('0x18')](function(_0x3323ab){var _0x433deb=[];_[_0x5f7a('0x74')](_0x3323ab,function(_0x1d98c7){_0x433deb['push'](createCmHopperPhone(_0x14b603,_0x1d98c7['id']));});Promise[_0x5f7a('0x68')](_0x433deb)[_0x5f7a('0x18')](function(){_0x37b963(0x1);});});});}function createCmHopperPhone(_0x3ae03a,_0x1d3993){return new Promise(function(_0x465bc7){db[_0x5f7a('0x4e')][_0x5f7a('0x3b')]({'raw':!![],'attributes':[_0x5f7a('0x91'),_0x5f7a('0x8b')],'where':{'CmContactId':_0x3ae03a,'ItemClass':_0x5f7a('0x92')},'include':[{'model':db[_0x5f7a('0x6d')],'attributes':[_0x5f7a('0x8b')],'as':_0x5f7a('0x6e')}],'order':[_0x5f7a('0x8b'),db['sequelize'][_0x5f7a('0x70')](_0x5f7a('0x93'))]})[_0x5f7a('0x18')](function(_0x4bdeef){var _0x57c97b=0x1;var _0x147155=_[_0x5f7a('0x74')](_0x4bdeef,function(_0x1d2e47){_0x1d2e47[_0x5f7a('0x94')]=_0x1d3993;_0x1d2e47[_0x5f7a('0x7c')]=_0x1d2e47[_0x5f7a('0x91')];_0x1d2e47[_0x5f7a('0x8b')]=_0x57c97b;delete _0x1d2e47[_0x5f7a('0x95')];_0x57c97b=_0x57c97b+0x1;return _0x1d2e47;});return db[_0x5f7a('0x96')]['bulkCreate'](_0x147155,{});})['then'](function(){_0x465bc7(0x1);});});}function insertAdditionalPhones(_0x4c98cf,_0x1e233f){return new Promise(function(_0x2d931b){var _0x4c2d6f=[];for(var _0x1328a3=0x0;_0x1328a3<_0x1e233f['length'];_0x1328a3++){var _0x2a87a0=_0x1e233f[_0x1328a3];_0x4c2d6f[_0x5f7a('0x67')](parseContactItemType(_0x2a87a0));}Promise[_0x5f7a('0x68')](_0x4c2d6f)[_0x5f7a('0x18')](function(){var _0x593b47={'id':_0x4c98cf['id'],'items':_0x1e233f};return addAdditionalPhones(_0x593b47)[_0x5f7a('0x18')](function(){return addCmHopperPhones(_0x4c98cf['id']);});})[_0x5f7a('0x18')](function(){_0x2d931b(_0x4c98cf);});});}function parseContactItemType(_0x3b3b5b){return new Promise(function(_0x2f60eb){if(_0x3b3b5b['hasOwnProperty'](_0x5f7a('0x8e'))){_0x2f60eb(_0x3b3b5b);}else{return db[_0x5f7a('0x6d')][_0x5f7a('0x26')]({'where':{'name':_0x3b3b5b['ItemType']}})['then'](function(_0xcfe7ab){if(_[_0x5f7a('0x5b')](_0xcfe7ab))_0x3b3b5b[_0x5f7a('0x8e')]=null;else _0x3b3b5b['ItemTypeId']=_0xcfe7ab['id'];_0x2f60eb(_0x3b3b5b);});}});}exports[_0x5f7a('0x97')]=function(_0x2244f8,_0x1fdaab){return db[_0x5f7a('0x4e')]['findAll']({'raw':!![],'where':{'CmContactId':_0x2244f8[_0x5f7a('0x27')]['id'],'ItemClass':_0x5f7a('0x92')},'include':[{'model':db[_0x5f7a('0x6d')],'as':_0x5f7a('0x6e')}],'order':[['OrderBy'],[db[_0x5f7a('0x6f')]['literal'](_0x5f7a('0x93'))]]})['then'](function(_0x441565){return _0x441565;})[_0x5f7a('0x18')](respondWithResult(_0x1fdaab,null))[_0x5f7a('0x59')](handleError(_0x1fdaab,null));};exports[_0x5f7a('0x98')]=function(_0x441fcf,_0x35dded){return db[_0x5f7a('0x4e')][_0x5f7a('0x3b')]({'raw':!![],'where':{'CmContactId':_0x441fcf['body'][_0x5f7a('0x99')]}})['then'](function(_0x2d680c){var _0x4fcd23=_['map'](_0x2d680c,function(_0x5868ad){_0x5868ad[_0x5f7a('0x9a')]=_0x441fcf['body'][_0x5f7a('0x9b')];return _0x5868ad;});return db[_0x5f7a('0x4e')][_0x5f7a('0x60')](_0x4fcd23,{});})['then'](function(){return addCmHopperPhones(_0x441fcf[_0x5f7a('0x3a')][_0x5f7a('0x9b')]);})[_0x5f7a('0x18')](function(){return['ok'];})[_0x5f7a('0x18')](respondWithResult(_0x35dded,null))['catch'](handleError(_0x35dded,null));};exports['rescheduleAdditionalPhones']=function(_0x472cca,_0x46ed39){var _0x17bd6f=[];_0x17bd6f[_0x5f7a('0x67')](createCmHopperPhone(_0x472cca[_0x5f7a('0x3a')]['id'],_0x472cca[_0x5f7a('0x3a')]['hopperId']));Promise[_0x5f7a('0x68')](_0x17bd6f)[_0x5f7a('0x18')](function(){return[0x1];})[_0x5f7a('0x18')](respondWithResult(_0x46ed39,null));};exports[_0x5f7a('0x9c')]=function(_0x247fd2,_0x5d070c){var _0x5b6dcc={'raw':![],'where':{}};var _0x5cc09c={};var _0x3715b1={'count':0x0,'rows':[]};return db[_0x5f7a('0x25')][_0x5f7a('0x7e')]({'where':{'id':_0x247fd2[_0x5f7a('0x27')]['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0x5d070c,null))[_0x5f7a('0x18')](function(_0x222490){if(_0x222490){_0x5cc09c[_0x5f7a('0x82')]=_[_0x5f7a('0x29')](db[_0x5f7a('0x40')][_0x5f7a('0x7f')]);_0x5cc09c['query']=_[_0x5f7a('0x29')](_0x247fd2[_0x5f7a('0x23')]);_0x5cc09c['filters']=_[_0x5f7a('0x81')](_0x5cc09c[_0x5f7a('0x82')],_0x5cc09c['query']);_0x5b6dcc['attributes']=_[_0x5f7a('0x81')](_0x5cc09c[_0x5f7a('0x82')],qs[_0x5f7a('0x84')](_0x247fd2[_0x5f7a('0x23')][_0x5f7a('0x84')]));_0x5b6dcc[_0x5f7a('0x83')]=_0x5b6dcc[_0x5f7a('0x83')][_0x5f7a('0x30')]?_0x5b6dcc[_0x5f7a('0x83')]:_0x5cc09c['model'];if(!_0x247fd2[_0x5f7a('0x23')][_0x5f7a('0x38')](_0x5f7a('0x9d'))){_0x5b6dcc[_0x5f7a('0x14')]=qs[_0x5f7a('0x14')](_0x247fd2[_0x5f7a('0x23')][_0x5f7a('0x14')]);_0x5b6dcc[_0x5f7a('0x12')]=qs[_0x5f7a('0x12')](_0x247fd2[_0x5f7a('0x23')][_0x5f7a('0x12')]);}_0x5b6dcc['order']=qs[_0x5f7a('0x86')](_0x247fd2['query']['sort']);_0x5b6dcc[_0x5f7a('0x63')]=qs[_0x5f7a('0x80')](_[_0x5f7a('0x87')](_0x247fd2['query'],_0x5cc09c[_0x5f7a('0x80')]));_0x5b6dcc['where'][_0x5f7a('0x9e')]=_0x222490['id'];if(_0x247fd2[_0x5f7a('0x23')][_0x5f7a('0x9f')]){_0x5b6dcc[_0x5f7a('0x63')]=_[_0x5f7a('0x39')](_0x5b6dcc[_0x5f7a('0x63')],{'$or':_[_0x5f7a('0x74')](_0x5b6dcc[_0x5f7a('0x83')],function(_0x518648){var _0x3d98a8={};_0x3d98a8[_0x518648]={'$like':'%'+_0x247fd2[_0x5f7a('0x23')][_0x5f7a('0x9f')]+'%'};return _0x3d98a8;})});}_0x5b6dcc=_[_0x5f7a('0x39')]({},_0x5b6dcc,_0x247fd2[_0x5f7a('0x88')]);return db[_0x5f7a('0x40')][_0x5f7a('0x15')]({'where':_0x5b6dcc[_0x5f7a('0x63')]})[_0x5f7a('0x18')](function(_0x46f03a){_0x3715b1[_0x5f7a('0x15')]=_0x46f03a;if(_0x247fd2[_0x5f7a('0x23')][_0x5f7a('0xa0')]){_0x5b6dcc['include']=[{'all':!![]}];}return db['CmHopper'][_0x5f7a('0x3b')](_0x5b6dcc);})['then'](function(_0x2d8238){_0x3715b1['rows']=_0x2d8238;return _0x3715b1;});}})['then'](respondWithFilteredResult(_0x5d070c,_0x5b6dcc))[_0x5f7a('0x59')](handleError(_0x5d070c,null));};exports[_0x5f7a('0xa1')]=function(_0x5c73f3,_0xd1bd54){var _0x44df0d={'raw':!![],'where':{}};var _0x51325a={};var _0x100965={'count':0x0,'rows':[]};return db[_0x5f7a('0x25')]['findOne']({'where':{'id':_0x5c73f3[_0x5f7a('0x27')]['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0xd1bd54,null))[_0x5f7a('0x18')](function(_0x4890de){if(_0x4890de){_0x51325a[_0x5f7a('0x82')]=_[_0x5f7a('0x29')](db['CmHopperHistory'][_0x5f7a('0x7f')]);_0x51325a[_0x5f7a('0x23')]=_['keys'](_0x5c73f3['query']);_0x51325a[_0x5f7a('0x80')]=_[_0x5f7a('0x81')](_0x51325a[_0x5f7a('0x82')],_0x51325a[_0x5f7a('0x23')]);_0x44df0d[_0x5f7a('0x83')]=_[_0x5f7a('0x81')](_0x51325a['model'],qs[_0x5f7a('0x84')](_0x5c73f3[_0x5f7a('0x23')][_0x5f7a('0x84')]));_0x44df0d[_0x5f7a('0x83')]=_0x44df0d[_0x5f7a('0x83')][_0x5f7a('0x30')]?_0x44df0d[_0x5f7a('0x83')]:_0x51325a[_0x5f7a('0x82')];if(!_0x5c73f3[_0x5f7a('0x23')][_0x5f7a('0x38')](_0x5f7a('0x9d'))){_0x44df0d[_0x5f7a('0x14')]=qs[_0x5f7a('0x14')](_0x5c73f3['query'][_0x5f7a('0x14')]);_0x44df0d[_0x5f7a('0x12')]=qs[_0x5f7a('0x12')](_0x5c73f3[_0x5f7a('0x23')][_0x5f7a('0x12')]);}_0x44df0d[_0x5f7a('0x85')]=qs[_0x5f7a('0x86')](_0x5c73f3[_0x5f7a('0x23')]['sort']);_0x44df0d['where']=qs[_0x5f7a('0x80')](_[_0x5f7a('0x87')](_0x5c73f3[_0x5f7a('0x23')],_0x51325a[_0x5f7a('0x80')]));_0x44df0d[_0x5f7a('0x63')][_0x5f7a('0x9e')]=_0x4890de['id'];if(_0x5c73f3['query'][_0x5f7a('0x9f')]){_0x44df0d['where']=_[_0x5f7a('0x39')](_0x44df0d[_0x5f7a('0x63')],{'$or':_[_0x5f7a('0x74')](_0x44df0d[_0x5f7a('0x83')],function(_0x5e9856){var _0x1b4be5={};_0x1b4be5[_0x5e9856]={'$like':'%'+_0x5c73f3['query']['filter']+'%'};return _0x1b4be5;})});}_0x44df0d=_[_0x5f7a('0x39')]({},_0x44df0d,_0x5c73f3[_0x5f7a('0x88')]);return db['CmHopperHistory'][_0x5f7a('0x15')]({'where':_0x44df0d[_0x5f7a('0x63')]})['then'](function(_0x51011e){_0x100965['count']=_0x51011e;if(_0x5c73f3[_0x5f7a('0x23')][_0x5f7a('0xa0')]){_0x44df0d[_0x5f7a('0xa2')]=[{'all':!![]}];}return db[_0x5f7a('0x50')]['findAll'](_0x44df0d);})['then'](function(_0x4fd742){_0x100965[_0x5f7a('0xa3')]=_0x4fd742;return _0x100965;});}})['then'](respondWithFilteredResult(_0xd1bd54,_0x44df0d))[_0x5f7a('0x59')](handleError(_0xd1bd54,null));};exports['getHopperFinals']=function(_0x2b791f,_0x4e4a4a){var _0x26eb9e={'raw':!![],'where':{}};var _0x1ee2e8={};var _0x14a215={'count':0x0,'rows':[]};return db[_0x5f7a('0x25')][_0x5f7a('0x7e')]({'where':{'id':_0x2b791f[_0x5f7a('0x27')]['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0x4e4a4a,null))[_0x5f7a('0x18')](function(_0x51b95c){if(_0x51b95c){_0x1ee2e8[_0x5f7a('0x82')]=_[_0x5f7a('0x29')](db[_0x5f7a('0x4f')][_0x5f7a('0x7f')]);_0x1ee2e8[_0x5f7a('0x23')]=_[_0x5f7a('0x29')](_0x2b791f[_0x5f7a('0x23')]);_0x1ee2e8[_0x5f7a('0x80')]=_['intersection'](_0x1ee2e8[_0x5f7a('0x82')],_0x1ee2e8['query']);_0x26eb9e[_0x5f7a('0x83')]=_['intersection'](_0x1ee2e8['model'],qs[_0x5f7a('0x84')](_0x2b791f[_0x5f7a('0x23')][_0x5f7a('0x84')]));_0x26eb9e[_0x5f7a('0x83')]=_0x26eb9e['attributes'][_0x5f7a('0x30')]?_0x26eb9e['attributes']:_0x1ee2e8['model'];if(!_0x2b791f[_0x5f7a('0x23')]['hasOwnProperty'](_0x5f7a('0x9d'))){_0x26eb9e['limit']=qs[_0x5f7a('0x14')](_0x2b791f['query']['limit']);_0x26eb9e[_0x5f7a('0x12')]=qs[_0x5f7a('0x12')](_0x2b791f[_0x5f7a('0x23')][_0x5f7a('0x12')]);}_0x26eb9e[_0x5f7a('0x85')]=qs[_0x5f7a('0x86')](_0x2b791f['query']['sort']);_0x26eb9e[_0x5f7a('0x63')]=qs[_0x5f7a('0x80')](_['pick'](_0x2b791f[_0x5f7a('0x23')],_0x1ee2e8['filters']));_0x26eb9e[_0x5f7a('0x63')][_0x5f7a('0x9e')]=_0x51b95c['id'];if(_0x2b791f['query'][_0x5f7a('0x9f')]){_0x26eb9e['where']=_['merge'](_0x26eb9e[_0x5f7a('0x63')],{'$or':_['map'](_0x26eb9e[_0x5f7a('0x83')],function(_0x436e86){var _0x10ffed={};_0x10ffed[_0x436e86]={'$like':'%'+_0x2b791f[_0x5f7a('0x23')][_0x5f7a('0x9f')]+'%'};return _0x10ffed;})});}_0x26eb9e=_[_0x5f7a('0x39')]({},_0x26eb9e,_0x2b791f[_0x5f7a('0x88')]);return db[_0x5f7a('0x4f')][_0x5f7a('0x15')]({'where':_0x26eb9e['where']})[_0x5f7a('0x18')](function(_0x45838e){_0x14a215[_0x5f7a('0x15')]=_0x45838e;if(_0x2b791f[_0x5f7a('0x23')][_0x5f7a('0xa0')]){_0x26eb9e[_0x5f7a('0xa2')]=[{'all':!![]}];}return db[_0x5f7a('0x4f')][_0x5f7a('0x3b')](_0x26eb9e);})['then'](function(_0x4f65a5){_0x14a215['rows']=_0x4f65a5;return _0x14a215;});}})[_0x5f7a('0x18')](respondWithFilteredResult(_0x4e4a4a,_0x26eb9e))[_0x5f7a('0x59')](handleError(_0x4e4a4a,null));};exports[_0x5f7a('0xa4')]=function(_0x329085,_0x2fd2b2){var _0x526769={'raw':!![],'where':{}};var _0x5d5185={};var _0x136942={'count':0x0,'rows':[]};return db['CmContact'][_0x5f7a('0x7e')]({'where':{'id':_0x329085[_0x5f7a('0x27')]['id']}})[_0x5f7a('0x18')](handleEntityNotFound(_0x2fd2b2,null))[_0x5f7a('0x18')](function(_0xe06987){if(_0xe06987){_0x5d5185[_0x5f7a('0x82')]=_[_0x5f7a('0x29')](db['JscriptySessionReport']['rawAttributes']);_0x5d5185[_0x5f7a('0x23')]=_[_0x5f7a('0x29')](_0x329085['query']);_0x5d5185[_0x5f7a('0x80')]=_['intersection'](_0x5d5185['model'],_0x5d5185['query']);_0x526769[_0x5f7a('0x83')]=_['intersection'](_0x5d5185['model'],qs[_0x5f7a('0x84')](_0x329085[_0x5f7a('0x23')][_0x5f7a('0x84')]));_0x526769[_0x5f7a('0x83')]=_0x526769[_0x5f7a('0x83')]['length']?_0x526769[_0x5f7a('0x83')]:_0x5d5185[_0x5f7a('0x82')];if(!_0x329085[_0x5f7a('0x23')][_0x5f7a('0x38')](_0x5f7a('0x9d'))){_0x526769[_0x5f7a('0x14')]=qs['limit'](_0x329085[_0x5f7a('0x23')][_0x5f7a('0x14')]);_0x526769['offset']=qs['offset'](_0x329085[_0x5f7a('0x23')][_0x5f7a('0x12')]);}_0x526769[_0x5f7a('0x85')]=qs[_0x5f7a('0x86')](_0x329085['query']['sort']);_0x526769[_0x5f7a('0x63')]=qs[_0x5f7a('0x80')](_[_0x5f7a('0x87')](_0x329085['query'],_0x5d5185['filters']));_0x526769[_0x5f7a('0x63')][_0x5f7a('0x9e')]=_0xe06987['id'];if(_0x329085[_0x5f7a('0x23')]['filter']){_0x526769['where']=_[_0x5f7a('0x39')](_0x526769['where'],{'$or':_[_0x5f7a('0x74')](_0x526769[_0x5f7a('0x83')],function(_0x1b75e9){var _0x441d23={};_0x441d23[_0x1b75e9]={'$like':'%'+_0x329085[_0x5f7a('0x23')][_0x5f7a('0x9f')]+'%'};return _0x441d23;})});}_0x526769=_['merge']({},_0x526769,_0x329085[_0x5f7a('0x88')]);return db[_0x5f7a('0x55')][_0x5f7a('0x15')]({'where':_0x526769[_0x5f7a('0x63')]})['then'](function(_0x4cd723){_0x136942[_0x5f7a('0x15')]=_0x4cd723;if(_0x329085[_0x5f7a('0x23')]['includeAll']){_0x526769[_0x5f7a('0xa2')]=[{'all':!![]}];}return db[_0x5f7a('0x55')]['findAll'](_0x526769);})[_0x5f7a('0x18')](function(_0x50cb6a){_0x136942['rows']=_0x50cb6a;return _0x136942;});}})[_0x5f7a('0x18')](respondWithFilteredResult(_0x2fd2b2,_0x526769))[_0x5f7a('0x59')](handleError(_0x2fd2b2,null));};exports[_0x5f7a('0xa5')]=function(_0x178f66,_0x48960e){try{if(!_0x178f66['body']['ListId']){throw new Error(_0x5f7a('0xa6'));}if(!_0x178f66['body'][_0x5f7a('0xa7')]){throw new Error(_0x5f7a('0xa8'));}if(!_0x178f66['body'][_0x5f7a('0xa9')]){throw new Error(_0x5f7a('0xaa'));}if(!_0x178f66['body'][_0x5f7a('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x36cf3b=_0x178f66[_0x5f7a('0x3a')]['binding_keys'][_0x5f7a('0xac')](',');var _0x644335=_0x178f66[_0x5f7a('0x3a')]['binding_values'][_0x5f7a('0xac')](',');if(!_0x36cf3b[_0x5f7a('0x30')]||!_0x644335['length']||_0x36cf3b[_0x5f7a('0x30')]!==_0x644335[_0x5f7a('0x30')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x178f66[_0x5f7a('0x3a')][_0x5f7a('0x84')]=_[_0x5f7a('0xad')](_0x36cf3b,_0x644335);if(!_0x178f66[_0x5f7a('0x3a')][_0x5f7a('0x84')][_0x5f7a('0x7c')]){throw new Error(_0x5f7a('0xae'));}if(!_0x178f66[_0x5f7a('0x3a')]['fields'][_0x5f7a('0xaf')]){throw new Error(_0x5f7a('0xb0'));}var _0x193239=path[_0x5f7a('0x5a')](config[_0x5f7a('0xb1')],_0x5f7a('0xb2'),_0x178f66[_0x5f7a('0xb3')]['filename']);fs['chmodSync'](_0x193239,parseInt(_0x5f7a('0xb4'),0x8));var _0x3f6197=require(_0x5f7a('0xb5'))[_0x5f7a('0xb6')](path[_0x5f7a('0x5a')](__dirname,_0x5f7a('0xb7')),[_0x193239,_0x178f66['body']['binding_keys'],_0x178f66['body']['binding_values'],_0x178f66[_0x5f7a('0x3a')][_0x5f7a('0x64')],_0x178f66[_0x5f7a('0x3a')][_0x5f7a('0xb8')],_0x178f66[_0x5f7a('0x3a')]['duplicates'],_0x178f66[_0x5f7a('0x3a')][_0x5f7a('0xab')]]);return _0x48960e[_0x5f7a('0x10')](0xc8)[_0x5f7a('0x11')]({'message':_0x5f7a('0xb9'),'pid':_0x3f6197[_0x5f7a('0xba')]});}catch(_0x2c4af2){return _0x48960e[_0x5f7a('0x10')](0x1f4)['send'](_0x2c4af2);}};exports[_0x5f7a('0xbb')]=function(_0x4aac67,_0x115e66){var _0xc5fb8=fs[_0x5f7a('0xbc')](_0x4aac67['file']['path']);Papa['parse'](_0xc5fb8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x52ce14){return _0x115e66[_0x5f7a('0x10')](0xc8)[_0x5f7a('0x11')]({'file':_0x4aac67[_0x5f7a('0xb3')],'fields':_0x52ce14[_0x5f7a('0xbd')]['fields']});}});};exports[_0x5f7a('0xbe')]=function(_0x46d4d9,_0x2c1ac2){return db['User'][_0x5f7a('0x3b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5f7a('0xbf')}})['then'](function(_0x5ee561){var _0x2251ce=![];if(!_0x46d4d9[_0x5f7a('0x3a')]['ListId']){throw new Error(_0x5f7a('0xa6'));}if(!_0x46d4d9[_0x5f7a('0x3a')][_0x5f7a('0xc0')][_0x5f7a('0x7c')]){throw new Error(_0x5f7a('0xae'));}if(!_0x46d4d9[_0x5f7a('0x3a')][_0x5f7a('0xc0')][_0x5f7a('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x46d4d9[_0x5f7a('0x3a')][_0x5f7a('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3e464b=require(_0x5f7a('0xb5'))['fork'](path[_0x5f7a('0x5a')](__dirname,_0x5f7a('0xc1')),[_0x46d4d9[_0x5f7a('0x27')]['id'],JSON[_0x5f7a('0xc2')](_0x46d4d9[_0x5f7a('0x3a')]),JSON['stringify'](_0x5ee561)]);_0x3e464b['on']('message',function(){_0x2251ce=!![];return _0x2c1ac2[_0x5f7a('0x10')](0xc8)[_0x5f7a('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x3e464b[_0x5f7a('0xba')]});});_0x3e464b['on'](_0x5f7a('0xc3'),function(_0x39f9a6){if(_0x39f9a6&&!_0x2251ce){return _0x2c1ac2['status'](0x1f4)[_0x5f7a('0x11')]({'message':'error\x20child\x20process','pid':_0x3e464b[_0x5f7a('0xba')]});}});})[_0x5f7a('0x59')](handleError(_0x2c1ac2,null));};exports[_0x5f7a('0xc4')]=function(_0x58275b,_0x40d407){return db[_0x5f7a('0xc5')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x5f7a('0x18')](function(_0x488697){var _0x514758=![];if(!_0x58275b['body'][_0x5f7a('0x64')]){throw new Error(_0x5f7a('0xa6'));}if(!_0x58275b[_0x5f7a('0x3a')]['binding'][_0x5f7a('0x7c')]){throw new Error(_0x5f7a('0xae'));}if(!_0x58275b[_0x5f7a('0x3a')][_0x5f7a('0xc0')][_0x5f7a('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x58275b['body'][_0x5f7a('0xab')]){throw new Error(_0x5f7a('0xc6'));}var _0xfc098f=require(_0x5f7a('0xb5'))[_0x5f7a('0xb6')](path['join'](__dirname,_0x5f7a('0xc7')),[_0x58275b[_0x5f7a('0x27')]['id'],JSON[_0x5f7a('0xc2')](_0x58275b[_0x5f7a('0x3a')]),JSON[_0x5f7a('0xc2')](_0x488697)]);_0xfc098f['on']('message',function(){_0x514758=!![];return _0x40d407[_0x5f7a('0x10')](0xc8)[_0x5f7a('0x11')]({'message':_0x5f7a('0xc8'),'pid':_0xfc098f[_0x5f7a('0xba')]});});_0xfc098f['on']('exit',function(_0x58596f){if(_0x58596f&&!_0x514758){return _0x40d407[_0x5f7a('0x10')](0x1f4)['json']({'message':_0x5f7a('0xc9'),'pid':_0xfc098f[_0x5f7a('0xba')]});}});})[_0x5f7a('0x59')](handleError(_0x40d407,null));};exports[_0x5f7a('0xca')]=function(_0xb0beea,_0xef1479){var _0x3ccd80=[_0x5f7a('0xcb'),_0x5f7a('0xcc'),_0x5f7a('0xcd'),_0x5f7a('0xce'),'fax',_0x5f7a('0xcf'),_0x5f7a('0xd0')];var _0x44bf38={'offset':0x0,'order':qs[_0x5f7a('0x86')](_0x5f7a('0xd1'))},_0x23e11d={'count':0x0,'rows':[]};Promise[_0x5f7a('0xd2')]()[_0x5f7a('0x18')](function(){if(_0xb0beea[_0x5f7a('0x23')][_0x5f7a('0xd3')]){if(!_['includes'](_0x3ccd80,_0xb0beea[_0x5f7a('0x23')][_0x5f7a('0xd3')][_0x5f7a('0xd4')]())){throw new Error('Invalid\x20channel');}_0x3ccd80=[_0xb0beea['query']['channel'][_0x5f7a('0xd4')]()];}if(_0xb0beea['query'][_0x5f7a('0xd5')]){try{var _0x315a58=JSON[_0x5f7a('0xd6')](_0xb0beea[_0x5f7a('0x23')][_0x5f7a('0xd5')]);if(!moment(_0x315a58[_0x5f7a('0x3c')])[_0x5f7a('0xd7')]()){throw new Error(_0x5f7a('0xd8'));}if(!moment(_0x315a58['to'])[_0x5f7a('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0xd3a936){throw new Error(_0x5f7a('0xd9'));}}if(!_0xb0beea[_0x5f7a('0x23')][_0x5f7a('0x38')](_0x5f7a('0x9d'))){_0x44bf38[_0x5f7a('0x14')]=qs['limit'](_0xb0beea[_0x5f7a('0x23')][_0x5f7a('0x14')]||0xa);_0x44bf38[_0x5f7a('0x12')]=qs[_0x5f7a('0x12')](_0xb0beea[_0x5f7a('0x23')][_0x5f7a('0x12')]);}var _0x8833a4=_0x3ccd80[_0x5f7a('0x74')](function(_0x41bf2b){if(_0x41bf2b===_0x5f7a('0xd0')){var _0x328dfa={'attributes':['id',_0x5f7a('0xda'),_0x5f7a('0x33'),_0x5f7a('0xdb'),_0x5f7a('0xdc'),_0x5f7a('0xdd'),'starttime','endtime','duration',_0x5f7a('0xde'),'createdAt','userDisposition',_0x5f7a('0xdf'),_0x5f7a('0xe0'),_0x5f7a('0xe1')],'where':{'ContactId':_0xb0beea[_0x5f7a('0x27')]['id']},'include':[{'model':db[_0x5f7a('0xc5')],'as':_0x5f7a('0xc5'),'attributes':['id',_0x5f7a('0x1e'),_0x5f7a('0xe2'),'alias']}],'order':[[_0x5f7a('0xe3'),'DESC']]};if(_0xb0beea['query'][_0x5f7a('0xd5')]){_0x328dfa[_0x5f7a('0x63')][_0x5f7a('0xe3')]={'$gte':_0x315a58[_0x5f7a('0x3c')],'$lte':_0x315a58['to']};}return db[_0x5f7a('0x51')][_0x5f7a('0xe4')](_0x328dfa)[_0x5f7a('0x18')](function(_0x1d88d5){_0x23e11d['count']+=_0x1d88d5[_0x5f7a('0x15')];return _['map'](_0x1d88d5['rows'],function(_0x595d76){var _0x5a177a=_0x595d76['get']({'plain':!![]});_0x5a177a[_0x5f7a('0xd3')]=_0x41bf2b;if(_0x5a177a['User']){_0x5a177a[_0x5f7a('0xc5')]={'id':_0x5a177a[_0x5f7a('0xc5')]['id'],'name':_0x5a177a[_0x5f7a('0xc5')][_0x5f7a('0x1e')],'fullname':_0x5a177a[_0x5f7a('0xc5')][_0x5f7a('0xe2')],'alias':_0x5a177a['User']['alias']};}return _0x5a177a;});});}else{var _0x3dae67=_[_0x5f7a('0xe5')](_0x41bf2b)+(_0x41bf2b===_0x5f7a('0xcc')?_0x5f7a('0xe6'):_0x5f7a('0xe7'));var _0xa5a607={'attributes':['id',_0x5f7a('0xe8'),_0x5f7a('0xe9'),_0x5f7a('0xe3'),_0x5f7a('0xde'),_0x5f7a('0xea'),_0x5f7a('0xeb'),_0x5f7a('0xec'),_0x5f7a('0xe1'),_0x3dae67+'Id'],'where':{'ContactId':_0xb0beea['params']['id']},'include':[{'model':db[_0x3dae67],'as':_0x5f7a('0xe7'),'attributes':['id',_0x5f7a('0x1e'),_0x5f7a('0xed')]},{'model':db[_0x5f7a('0xc5')],'as':_0x5f7a('0xee'),'attributes':['id',_0x5f7a('0x1e'),'fullname']},{'model':db[_0x5f7a('0x69')],'as':_0x5f7a('0x6a'),'attributes':['id',_0x5f7a('0x1e'),_0x5f7a('0x6b')],'through':{'attributes':[]}}],'order':[[_0x5f7a('0xe3'),_0x5f7a('0xef')]]};if(_0xb0beea['query']['range']){_0xa5a607['where'][_0x5f7a('0xe3')]={'$gte':_0x315a58[_0x5f7a('0x3c')],'$lte':_0x315a58['to']};}switch(_0x41bf2b){case _0x5f7a('0xcc'):_0xa5a607[_0x5f7a('0x83')][_0x5f7a('0x67')](_0x5f7a('0xf0'),_0x5f7a('0xf1'),_0x5f7a('0xf2'),_0x5f7a('0xf3'),'osName','ratingMessage',_0x5f7a('0xf4'),_0x5f7a('0xf5'),_0x5f7a('0xf6'));break;case _0x5f7a('0xcb'):_0xa5a607['attributes'][_0x5f7a('0x67')](_0x5f7a('0xf7'),'substatus');break;case'openchannel':_0xa5a607[_0x5f7a('0x83')]['push']('externalUrl','threadId');break;}return db[_['startCase'](_0x41bf2b)+_0x5f7a('0xf8')][_0x5f7a('0xe4')](_0xa5a607)[_0x5f7a('0x18')](function(_0x3f8976){_0x23e11d[_0x5f7a('0x15')]+=_0x3f8976[_0x5f7a('0x15')];return _[_0x5f7a('0x74')](_0x3f8976[_0x5f7a('0xa3')],function(_0x3ae633){var _0x2b0c83=_0x3ae633[_0x5f7a('0x3d')]({'plain':!![]});_0x2b0c83[_0x5f7a('0xd3')]=_0x41bf2b;if(_0x2b0c83[_0x5f7a('0xee')]){_0x2b0c83[_0x5f7a('0xee')]={'id':_0x2b0c83[_0x5f7a('0xee')]['id'],'name':_0x2b0c83[_0x5f7a('0xee')][_0x5f7a('0x1e')],'fullname':_0x2b0c83['Owner'][_0x5f7a('0xe2')]};}return _0x2b0c83;});});}});return Promise['all'](_0x8833a4);})[_0x5f7a('0x18')](function(_0xaf5345){return _(_0xaf5345)['flatten']()['sortBy'](_0x5f7a('0xe3'))[_0x5f7a('0xf9')]()[_0x5f7a('0xfa')]();})[_0x5f7a('0x18')](function(_0x18747d){_0x23e11d[_0x5f7a('0xa3')]=_0x44bf38['limit']?_0x18747d[_0x5f7a('0xfb')](_0x44bf38[_0x5f7a('0x12')],_0x44bf38['offset']+_0x44bf38[_0x5f7a('0x14')]):_0x18747d;return _0x23e11d;})[_0x5f7a('0x18')](respondWithFilteredResult(_0xef1479,_0x44bf38))[_0x5f7a('0x59')](handleError(_0xef1479,null));}; \ No newline at end of file +var _0xeb95=['ids','setAdditionalPhones','all','ContactItemType','OrderBy','item_types','ItemTypeId','items','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','fromContactId','CmContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','order','ContactId','includeAll','include','getHopperHistories','rows','getHopperFinals','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','split','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','binding','firstName','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','mail','chat','sms','fax','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','voice','uniqueid','source','destination','callerid','endtime','duration','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','Website','Account','closed','closedAt','note','disposition','secondDisposition','thirdDisposition','key','Owner','Tags','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','threadId','findAndCountAll','reverse','slice','moment','bluebird','util','lodash','papaparse','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','json','undefined','offset','count','limit','set','Content-Range','then','status','sendStatus','error','name','send','index','describe','user','catch','destroy','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','query','analytics','CmCustomField','displayName','alias','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','findAll','from','get','mergeWith','isArray','join','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','create','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','findOrCreate','contact','show','Tag','color','tag','Phones','ItemType','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','timezones','isEmpty','table','setFields','toParam','text','phone','filters','intersection','model','attributes','fields','sort','pick','filter','options','nolimit','setTags','findOne'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xeb95,0x176));var _0x5eb9=function(_0x3adcf4,_0x5d78f8){_0x3adcf4=_0x3adcf4-0x0;var _0x495984=_0xeb95[_0x3adcf4];return _0x495984;};'use strict';var moment=require(_0x5eb9('0x0'));var BPromise=require(_0x5eb9('0x1'));var util=require(_0x5eb9('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x5eb9('0x3'));var squel=require('squel');var Papa=require(_0x5eb9('0x4'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x5eb9('0x5'));var shared=require('../../config/environment/shared');var db=require(_0x5eb9('0x6'))['db'];config[_0x5eb9('0x7')]=_[_0x5eb9('0x8')](config['redis'],{'host':_0x5eb9('0x9'),'port':0x18eb});var socket=require(_0x5eb9('0xa'))(new Redis(config[_0x5eb9('0x7')]));require(_0x5eb9('0xb'))['register'](socket);function respondWithResult(_0x38d0ee,_0x3aa7e6){_0x3aa7e6=_0x3aa7e6||0xc8;return function(_0x4c5149){if(_0x4c5149){return _0x38d0ee['status'](_0x3aa7e6)[_0x5eb9('0xc')](_0x4c5149);}};}function respondWithFilteredResult(_0x5f1f31,_0x4f0618){return function(_0x443969){if(_0x443969){var _0x319bb3=typeof _0x4f0618['offset']==='undefined'&&typeof _0x4f0618['limit']===_0x5eb9('0xd');var _0x55969d=_0x443969['count'];var _0x1782f3=_0x319bb3?0x0:_0x4f0618[_0x5eb9('0xe')];var _0x3cff1c=_0x319bb3?_0x443969[_0x5eb9('0xf')]:_0x4f0618[_0x5eb9('0xe')]+_0x4f0618[_0x5eb9('0x10')];var _0x228803;if(_0x3cff1c>=_0x55969d){_0x3cff1c=_0x55969d;_0x228803=0xc8;}else{_0x228803=0xce;}_0x5f1f31['status'](_0x228803);return _0x5f1f31[_0x5eb9('0x11')](_0x5eb9('0x12'),_0x1782f3+'-'+_0x3cff1c+'/'+_0x55969d)[_0x5eb9('0xc')](_0x443969);}return null;};}function saveUpdates(_0x11ee6){return function(_0x669600){if(_0x669600){return _0x669600['update'](_0x11ee6)[_0x5eb9('0x13')](function(_0x570c74){return _0x570c74;});}return null;};}function removeEntity(_0x2381ff){return function(_0x346437){if(_0x346437){return _0x346437['destroy']()['then'](function(){_0x2381ff[_0x5eb9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c6689){return function(_0x456f14){if(!_0x456f14){_0x9c6689[_0x5eb9('0x15')](0x194);}return _0x456f14;};}function handleError(_0x3539cc,_0x7b8cb3){_0x7b8cb3=_0x7b8cb3||0x1f4;return function(_0x13bd39){logger[_0x5eb9('0x16')](_0x13bd39['stack']);if(_0x13bd39[_0x5eb9('0x17')]){delete _0x13bd39[_0x5eb9('0x17')];}_0x3539cc[_0x5eb9('0x14')](_0x7b8cb3)[_0x5eb9('0x18')](_0x13bd39);};}exports[_0x5eb9('0x19')]=function(_0x27d9d6,_0x2daf82){var _0x329aab={};return contacts[_0x5eb9('0x1a')]()['then'](function(_0x3e3cb7){_0x329aab=qs['getOptions'](_0x3e3cb7,_0x27d9d6);return contacts['findAll'](_0x27d9d6['query'],_0x27d9d6[_0x5eb9('0x1b')],_0x329aab,_0x3e3cb7);})[_0x5eb9('0x13')](respondWithFilteredResult(_0x2daf82,_0x329aab))[_0x5eb9('0x1c')](handleError(_0x2daf82,null));};exports[_0x5eb9('0x1d')]=function(_0x2c89f2,_0x4c0405){return db[_0x5eb9('0x1e')][_0x5eb9('0x1f')]({'where':{'id':_0x2c89f2[_0x5eb9('0x20')]['id']}})[_0x5eb9('0x13')](handleEntityNotFound(_0x4c0405,null))['then'](removeEntity(_0x4c0405,null))[_0x5eb9('0x1c')](handleError(_0x4c0405,null));};exports[_0x5eb9('0x1a')]=function(_0x1898a6,_0x44ce75){return db[_0x5eb9('0x1e')][_0x5eb9('0x1a')]()['then'](function(_0x155282){delete _0x155282[_0x5eb9('0x21')];for(var _0x38d416=0x0;_0x38d4160x0){return new Promise(function(_0x410ba3){var _0x48e5aa=[];for(var _0x22c06b=0x0;_0x22c06b<_0x45b1a7[_0x5eb9('0x23')];_0x22c06b++){_0x48e5aa[_0x5eb9('0x5f')](insertAdditionalPhones(_0x45b1a7[_0x22c06b][_0x5eb9('0x63')],_0x45b1a7[_0x22c06b]['additionalPhones']));}Promise['all'](_0x48e5aa)[_0x5eb9('0x13')](function(){_0x410ba3(0x1);});})[_0x5eb9('0x13')](function(){return{'success':_0x17ac6a,'failure':_0x58508d,'duplicates':_0x5cfc9e};});}else{return{'success':_0x17ac6a,'failure':_0x58508d,'duplicates':_0x5cfc9e};}}})[_0x5eb9('0x13')](respondWithResult(_0x589861,0xc9))[_0x5eb9('0x1c')](handleError(_0x589861,null));};exports[_0x5eb9('0x64')]=function(_0x3e930d,_0x114ee8){var _0x1b6f69;return db['CmContact']['describe']()[_0x5eb9('0x13')](function(_0x44c74f){return db[_0x5eb9('0x1e')][_0x5eb9('0x1f')]({'where':{'id':_0x3e930d[_0x5eb9('0x20')]['id']},'include':[{'model':db[_0x5eb9('0x65')],'as':'Tags','attributes':['id','name',_0x5eb9('0x66')],'required':_0x3e930d['query'][_0x5eb9('0x67')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x5eb9('0x68'),'where':{'CmContactId':_0x3e930d[_0x5eb9('0x20')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x5eb9('0x69')}]}],'order':[db['sequelize'][_0x5eb9('0x6a')](_0x5eb9('0x6b'))],'attributes':_[_0x5eb9('0x22')](_0x44c74f)});})['then'](function(_0xb48a95){if(!_[_0x5eb9('0x57')](_0xb48a95)){_0x1b6f69=_0xb48a95['get']({'plain':!![]});var _0x99a145={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xb48a95&&_0xb48a95[_0x5eb9('0x61')]){if(_0xb48a95[_0x5eb9('0x61')]){_0x99a145[_0x5eb9('0x60')][_0x5eb9('0x6c')]['push']({'ListId':{'$ne':_0xb48a95[_0x5eb9('0x61')]}});}}return db[_0x5eb9('0x29')]['findAll'](_0x99a145);}})['then'](function(_0x5c5244){if(!_[_0x5eb9('0x57')](_0x5c5244)){return _[_0x5eb9('0x6d')](_0x1b6f69,_[_0x5eb9('0x6e')](_0x5c5244,function(_0x4d3f41){return util[_0x5eb9('0x6f')](_0x5eb9('0x70'),_0x4d3f41['id']);}));}})[_0x5eb9('0x13')](handleEntityNotFound(_0x114ee8,null))[_0x5eb9('0x13')](respondWithResult(_0x114ee8,null))[_0x5eb9('0x1c')](handleError(_0x114ee8,null));};exports[_0x5eb9('0x40')]=function(_0x5f2abe,_0x24a0af){var _0x174518;if(_0x5f2abe[_0x5eb9('0x32')]['id']){delete _0x5f2abe['body']['id'];}if(!_[_0x5eb9('0x57')](_0x5f2abe[_0x5eb9('0x32')][_0x5eb9('0x58')])){var _0x35b252=_0x5f2abe[_0x5eb9('0x32')][_0x5eb9('0x58')];if(!_['isNil'](shared['timezones'][_0x35b252]))_0x5f2abe[_0x5eb9('0x32')][_0x5eb9('0x59')]=shared[_0x5eb9('0x71')][_0x35b252][_0x5eb9('0x59')];}return db['CmContact'][_0x5eb9('0x1f')]({'where':{'id':_0x5f2abe[_0x5eb9('0x20')]['id']}})[_0x5eb9('0x13')](handleEntityNotFound(_0x24a0af,null))['then'](saveUpdates(_0x5f2abe[_0x5eb9('0x32')],null))[_0x5eb9('0x13')](function(_0x1b8a49){_0x174518=_0x1b8a49;var _0x1b6d58={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1b8a49&&_0x1b8a49[_0x5eb9('0x61')]){if(_0x1b8a49[_0x5eb9('0x61')]){_0x1b6d58[_0x5eb9('0x60')]['$and'][_0x5eb9('0x5f')]({'ListId':{'$ne':_0x1b8a49['ListId']}});}}return db[_0x5eb9('0x29')][_0x5eb9('0x33')](_0x1b6d58);})[_0x5eb9('0x13')](function(_0x1252a7){if(_0x1252a7){return _[_0x5eb9('0x6d')](_['pickBy'](_0x5f2abe[_0x5eb9('0x32')],function(_0x41fb46,_0x36418a){return _['startsWith'](_0x36418a,_0x5eb9('0x25'));}),_[_0x5eb9('0x6e')](_0x1252a7,function(_0x35319a){return util[_0x5eb9('0x6f')](_0x5eb9('0x70'),_0x35319a['id']);}));}})[_0x5eb9('0x13')](function(_0x543f0e){if(_0x543f0e&&!_[_0x5eb9('0x72')](_0x543f0e)){var _0x41f6cc=squel['update']()[_0x5eb9('0x73')]('cm_contacts')[_0x5eb9('0x74')](_0x543f0e)[_0x5eb9('0x60')]('id\x20=\x20?',_0x5f2abe['params']['id'])[_0x5eb9('0x75')]();return db['sequelize'][_0x5eb9('0x27')](_0x41f6cc[_0x5eb9('0x76')],{'replacements':_0x41f6cc['values']});}})['then'](function(){if(_0x5f2abe[_0x5eb9('0x32')][_0x5eb9('0x77')]&&_0x174518){return db[_0x5eb9('0x39')][_0x5eb9('0x40')]({'phone':_0x5f2abe[_0x5eb9('0x32')][_0x5eb9('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x174518['id']}});}})['then'](function(){return _0x174518;})[_0x5eb9('0x13')](respondWithResult(_0x24a0af,null))[_0x5eb9('0x1c')](handleError(_0x24a0af,null));};exports['getTags']=function(_0x247764,_0x4cba14){var _0x3a8bb4={};var _0x17330f={};var _0x247382;var _0x86a0d;return db['CmContact']['findOne']({'where':{'id':_0x247764[_0x5eb9('0x20')]['id']}})[_0x5eb9('0x13')](handleEntityNotFound(_0x4cba14,null))['then'](function(_0x198cea){if(_0x198cea){_0x247382=_0x198cea;_0x17330f['model']=_['keys'](db['Tag']['rawAttributes']);_0x17330f[_0x5eb9('0x27')]=_['keys'](_0x247764[_0x5eb9('0x27')]);_0x17330f[_0x5eb9('0x78')]=_[_0x5eb9('0x79')](_0x17330f[_0x5eb9('0x7a')],_0x17330f['query']);_0x3a8bb4[_0x5eb9('0x7b')]=_[_0x5eb9('0x79')](_0x17330f[_0x5eb9('0x7a')],qs[_0x5eb9('0x7c')](_0x247764[_0x5eb9('0x27')][_0x5eb9('0x7c')]));_0x3a8bb4[_0x5eb9('0x7b')]=_0x3a8bb4[_0x5eb9('0x7b')][_0x5eb9('0x23')]?_0x3a8bb4['attributes']:_0x17330f[_0x5eb9('0x7a')];_0x3a8bb4['order']=qs[_0x5eb9('0x7d')](_0x247764[_0x5eb9('0x27')][_0x5eb9('0x7d')]);_0x3a8bb4[_0x5eb9('0x60')]=qs[_0x5eb9('0x78')](_[_0x5eb9('0x7e')](_0x247764[_0x5eb9('0x27')],_0x17330f[_0x5eb9('0x78')]));if(_0x247764[_0x5eb9('0x27')]['filter']){_0x3a8bb4['where']=_['merge'](_0x3a8bb4[_0x5eb9('0x60')],{'$or':_[_0x5eb9('0x6e')](_0x3a8bb4[_0x5eb9('0x7b')],function(_0x12903d){var _0x3a91dd={};_0x3a91dd[_0x12903d]={'$like':'%'+_0x247764[_0x5eb9('0x27')][_0x5eb9('0x7f')]+'%'};return _0x3a91dd;})});}_0x3a8bb4=_['merge']({},_0x3a8bb4,_0x247764[_0x5eb9('0x80')]);return _0x247382['getTags'](_0x3a8bb4);}})['then'](function(_0x58f409){if(_0x58f409){_0x86a0d=_0x58f409[_0x5eb9('0x23')];if(!_0x247764[_0x5eb9('0x27')]['hasOwnProperty'](_0x5eb9('0x81'))){_0x3a8bb4[_0x5eb9('0x10')]=qs['limit'](_0x247764[_0x5eb9('0x27')][_0x5eb9('0x10')]);_0x3a8bb4['offset']=qs[_0x5eb9('0xe')](_0x247764['query'][_0x5eb9('0xe')]);}return _0x247382['getTags'](_0x3a8bb4);}})[_0x5eb9('0x13')](function(_0x5da203){if(_0x5da203){return _0x5da203?{'count':_0x86a0d,'rows':_0x5da203}:null;}})['then'](respondWithResult(_0x4cba14,null))[_0x5eb9('0x1c')](handleError(_0x4cba14,null));};exports[_0x5eb9('0x82')]=function(_0x1b8eb3,_0xfc423){if(_0x1b8eb3[_0x5eb9('0x32')]['id']){delete _0x1b8eb3[_0x5eb9('0x32')]['id'];}return db[_0x5eb9('0x1e')][_0x5eb9('0x83')]({'where':{'id':_0x1b8eb3['params']['id']}})[_0x5eb9('0x13')](handleEntityNotFound(_0xfc423,null))[_0x5eb9('0x13')](function(_0x2d1e70){if(_0x2d1e70){return _0x2d1e70['setTags'](_0x1b8eb3[_0x5eb9('0x32')][_0x5eb9('0x84')]||[]);}return null;})['then'](respondWithResult(_0xfc423,null))[_0x5eb9('0x1c')](handleError(_0xfc423,null));};exports[_0x5eb9('0x85')]=function(_0x542dfa,_0x48e722){var _0x548577=[];_0x548577['push'](addAdditionalPhones(_0x542dfa['body']));Promise[_0x5eb9('0x86')](_0x548577)[_0x5eb9('0x13')](function(){_0x548577=[];_0x548577[_0x5eb9('0x5f')](deleteCmHopperPhones(_0x542dfa['body']['id']));_0x548577['push'](addCmHopperPhones(_0x542dfa[_0x5eb9('0x32')]['id']));Promise[_0x5eb9('0x86')](_0x548577)[_0x5eb9('0x13')](function(){return[0x1];})[_0x5eb9('0x13')](respondWithResult(_0x48e722,null));});};function addAdditionalPhones(_0x3ed1ea){var _0x43fbe3;return new Promise(function(_0x509b4a){return db['CmContactHasItem'][_0x5eb9('0x1d')]({'where':{'CmContactId':_0x3ed1ea['id']}})[_0x5eb9('0x13')](function(){db[_0x5eb9('0x87')][_0x5eb9('0x33')]({'raw':!![],'attributes':['id',_0x5eb9('0x88')]})[_0x5eb9('0x13')](function(_0x579182){var _0x17fc39=[];for(var _0x14d572=0x0;_0x14d572<_0x3ed1ea['items'][_0x5eb9('0x23')];_0x14d572++){var _0x3d76e6=_0x3ed1ea[_0x5eb9('0x89')]?_[_0x5eb9('0x57')](_0x3ed1ea[_0x5eb9('0x89')][_0x14d572])?'':_0x3ed1ea[_0x5eb9('0x89')][_0x14d572]:_0x3ed1ea['items'][_0x14d572][_0x5eb9('0x8a')]?_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572][_0x5eb9('0x8a')]:'';var _0x321928=_['isNil'](_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572]['description'])?'':_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572][_0x5eb9('0x8c')];var _0x183784=_0x3d76e6+':'+_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572][_0x5eb9('0x77')]+'§'+_0x321928;if(_['isNil'](_0x43fbe3))_0x43fbe3=_0x183784;else _0x43fbe3+=';'+_0x183784;var _0x33237e=null;var _0x5ca85d=null;if(_0x3ed1ea['item_types']){if(!_[_0x5eb9('0x57')](_0x3ed1ea[_0x5eb9('0x89')][_0x14d572])){_0x5ca85d=_[_0x5eb9('0x1f')](_0x579182,function(_0x44197a){return _0x44197a['id']===_0x3ed1ea[_0x5eb9('0x89')][_0x14d572];});if(!_[_0x5eb9('0x57')](_0x5ca85d)){_0x33237e=_0x5ca85d[_0x5eb9('0x88')];}}}else{if(!_['isNil'](_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572])){_0x5ca85d=_[_0x5eb9('0x1f')](_0x579182,function(_0x3550b2){return _0x3550b2['id']===_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572]['ItemTypeId'];});if(!_[_0x5eb9('0x57')](_0x5ca85d)){_0x33237e=_0x14d572;}}}if(_['isNil'](_0x33237e)){_0x33237e=0x64;}_0x17fc39['push'](addAdditionalPhone(_0x3ed1ea['id'],_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572][_0x5eb9('0x77')],_0x3ed1ea['item_types']?_['isNil'](_0x3ed1ea[_0x5eb9('0x89')][_0x14d572])?null:_0x3ed1ea[_0x5eb9('0x89')][_0x14d572]:_0x3ed1ea[_0x5eb9('0x8b')][_0x14d572][_0x5eb9('0x8a')]?_0x3ed1ea['items'][_0x14d572][_0x5eb9('0x8a')]:null,_0x33237e,_0x321928));}Promise[_0x5eb9('0x86')](_0x17fc39)[_0x5eb9('0x13')](function(){db['CmContact']['update']({'AdditionalPhones':_0x43fbe3},{'where':{'id':_0x3ed1ea['id']}})['then'](function(){_0x509b4a(0x1);});});});});});}function addAdditionalPhone(_0x1c2f02,_0x21f10f,_0xa5fcaf,_0xb20b1,_0x4045b2){return db[_0x5eb9('0x4a')][_0x5eb9('0x1f')]({'where':{'CmContactId':_0x1c2f02,'item':_0x21f10f}})[_0x5eb9('0x13')](function(_0xc69348){if(_0xc69348)logger[_0x5eb9('0x3a')](_0x5eb9('0x8d'),_0xc69348);else{db[_0x5eb9('0x4a')][_0x5eb9('0x56')]({'CmContactId':_0x1c2f02,'item':_0x21f10f,'ItemTypeId':_0xa5fcaf,'OrderBy':_0xb20b1,'ItemClass':_0x5eb9('0x8e'),'description':_0x4045b2});}});}function deleteCmHopperPhones(_0xfaa274){return new Promise(function(_0x2e1783){return db[_0x5eb9('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xfaa274}})[_0x5eb9('0x13')](function(_0x3c1a3a){db[_0x5eb9('0x8f')][_0x5eb9('0x1d')]({'where':{'CmHopperId':{'$in':_[_0x5eb9('0x6e')](_0x3c1a3a,'id')}}});})['then'](function(){_0x2e1783(0x1);});});}function addCmHopperPhones(_0x3cb022){return new Promise(function(_0x467c43){return db[_0x5eb9('0x39')][_0x5eb9('0x33')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3cb022}})[_0x5eb9('0x13')](function(_0x1763c4){var _0x4f3c98=[];_[_0x5eb9('0x6e')](_0x1763c4,function(_0x534881){_0x4f3c98[_0x5eb9('0x5f')](createCmHopperPhone(_0x3cb022,_0x534881['id']));});Promise[_0x5eb9('0x86')](_0x4f3c98)['then'](function(){_0x467c43(0x1);});});});}function createCmHopperPhone(_0x5c383b,_0x396ede){return new Promise(function(_0x46e626){db['CmContactHasItem'][_0x5eb9('0x33')]({'raw':!![],'attributes':[_0x5eb9('0x90'),_0x5eb9('0x88')],'where':{'CmContactId':_0x5c383b,'ItemClass':_0x5eb9('0x8e')},'include':[{'model':db[_0x5eb9('0x87')],'attributes':[_0x5eb9('0x88')],'as':'ItemType'}],'order':['OrderBy',db[_0x5eb9('0x91')][_0x5eb9('0x6a')](_0x5eb9('0x92'))]})['then'](function(_0x2492d2){var _0x57dda2=0x1;var _0x4d6401=_[_0x5eb9('0x6e')](_0x2492d2,function(_0x31933c){_0x31933c[_0x5eb9('0x93')]=_0x396ede;_0x31933c['phone']=_0x31933c[_0x5eb9('0x90')];_0x31933c[_0x5eb9('0x88')]=_0x57dda2;delete _0x31933c[_0x5eb9('0x94')];_0x57dda2=_0x57dda2+0x1;return _0x31933c;});return db[_0x5eb9('0x8f')][_0x5eb9('0x5b')](_0x4d6401,{});})[_0x5eb9('0x13')](function(){_0x46e626(0x1);});});}function insertAdditionalPhones(_0x6b431d,_0x3865ca){return new Promise(function(_0x3451c8){var _0x58c996=[];for(var _0x285562=0x0;_0x285562<_0x3865ca['length'];_0x285562++){var _0x3751db=_0x3865ca[_0x285562];_0x58c996[_0x5eb9('0x5f')](parseContactItemType(_0x3751db));}Promise[_0x5eb9('0x86')](_0x58c996)[_0x5eb9('0x13')](function(){var _0x18bc36={'id':_0x6b431d['id'],'items':_0x3865ca};return addAdditionalPhones(_0x18bc36)[_0x5eb9('0x13')](function(){return addCmHopperPhones(_0x6b431d['id']);});})[_0x5eb9('0x13')](function(){_0x3451c8(_0x6b431d);});});}function parseContactItemType(_0x4215bc){return new Promise(function(_0x2a35d2){if(_0x4215bc[_0x5eb9('0x30')](_0x5eb9('0x8a'))){_0x2a35d2(_0x4215bc);}else{return db[_0x5eb9('0x87')][_0x5eb9('0x1f')]({'where':{'name':_0x4215bc[_0x5eb9('0x69')]}})[_0x5eb9('0x13')](function(_0x29430f){if(_[_0x5eb9('0x57')](_0x29430f))_0x4215bc[_0x5eb9('0x8a')]=null;else _0x4215bc[_0x5eb9('0x8a')]=_0x29430f['id'];_0x2a35d2(_0x4215bc);});}});}exports['getAdditionalPhones']=function(_0x40e791,_0x158ffd){return db[_0x5eb9('0x4a')][_0x5eb9('0x33')]({'raw':!![],'where':{'CmContactId':_0x40e791[_0x5eb9('0x20')]['id'],'ItemClass':_0x5eb9('0x8e')},'include':[{'model':db[_0x5eb9('0x87')],'as':_0x5eb9('0x69')}],'order':[[_0x5eb9('0x88')],[db[_0x5eb9('0x91')][_0x5eb9('0x6a')](_0x5eb9('0x92'))]]})[_0x5eb9('0x13')](function(_0x25c22f){return _0x25c22f;})[_0x5eb9('0x13')](respondWithResult(_0x158ffd,null))[_0x5eb9('0x1c')](handleError(_0x158ffd,null));};exports['duplicateAdditionalPhones']=function(_0x10f196,_0x4aa0e3){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x10f196['body'][_0x5eb9('0x95')]}})[_0x5eb9('0x13')](function(_0x4da1cd){var _0x4014de=_['map'](_0x4da1cd,function(_0x229f52){_0x229f52[_0x5eb9('0x96')]=_0x10f196[_0x5eb9('0x32')]['toContactId'];return _0x229f52;});return db['CmContactHasItem'][_0x5eb9('0x5b')](_0x4014de,{});})[_0x5eb9('0x13')](function(){return addCmHopperPhones(_0x10f196[_0x5eb9('0x32')]['toContactId']);})['then'](function(){return['ok'];})[_0x5eb9('0x13')](respondWithResult(_0x4aa0e3,null))[_0x5eb9('0x1c')](handleError(_0x4aa0e3,null));};exports[_0x5eb9('0x97')]=function(_0x31729d,_0x4a6449){var _0x581c68=[];_0x581c68[_0x5eb9('0x5f')](createCmHopperPhone(_0x31729d[_0x5eb9('0x32')]['id'],_0x31729d[_0x5eb9('0x32')][_0x5eb9('0x98')]));Promise['all'](_0x581c68)[_0x5eb9('0x13')](function(){return[0x1];})[_0x5eb9('0x13')](respondWithResult(_0x4a6449,null));};exports[_0x5eb9('0x99')]=function(_0x202cd7,_0x24394f){var _0x2a8b7a={'raw':![],'where':{}};var _0x1b59a7={};var _0x2fd5cb={'count':0x0,'rows':[]};return db[_0x5eb9('0x1e')]['findOne']({'where':{'id':_0x202cd7[_0x5eb9('0x20')]['id']}})['then'](handleEntityNotFound(_0x24394f,null))['then'](function(_0x1edf79){if(_0x1edf79){_0x1b59a7['model']=_['keys'](db[_0x5eb9('0x39')][_0x5eb9('0x9a')]);_0x1b59a7[_0x5eb9('0x27')]=_[_0x5eb9('0x22')](_0x202cd7[_0x5eb9('0x27')]);_0x1b59a7[_0x5eb9('0x78')]=_['intersection'](_0x1b59a7[_0x5eb9('0x7a')],_0x1b59a7[_0x5eb9('0x27')]);_0x2a8b7a['attributes']=_[_0x5eb9('0x79')](_0x1b59a7[_0x5eb9('0x7a')],qs['fields'](_0x202cd7['query'][_0x5eb9('0x7c')]));_0x2a8b7a[_0x5eb9('0x7b')]=_0x2a8b7a[_0x5eb9('0x7b')][_0x5eb9('0x23')]?_0x2a8b7a[_0x5eb9('0x7b')]:_0x1b59a7['model'];if(!_0x202cd7['query'][_0x5eb9('0x30')](_0x5eb9('0x81'))){_0x2a8b7a[_0x5eb9('0x10')]=qs[_0x5eb9('0x10')](_0x202cd7[_0x5eb9('0x27')][_0x5eb9('0x10')]);_0x2a8b7a[_0x5eb9('0xe')]=qs[_0x5eb9('0xe')](_0x202cd7[_0x5eb9('0x27')][_0x5eb9('0xe')]);}_0x2a8b7a[_0x5eb9('0x9b')]=qs['sort'](_0x202cd7[_0x5eb9('0x27')][_0x5eb9('0x7d')]);_0x2a8b7a['where']=qs[_0x5eb9('0x78')](_[_0x5eb9('0x7e')](_0x202cd7['query'],_0x1b59a7[_0x5eb9('0x78')]));_0x2a8b7a[_0x5eb9('0x60')][_0x5eb9('0x9c')]=_0x1edf79['id'];if(_0x202cd7[_0x5eb9('0x27')][_0x5eb9('0x7f')]){_0x2a8b7a['where']=_[_0x5eb9('0x31')](_0x2a8b7a[_0x5eb9('0x60')],{'$or':_[_0x5eb9('0x6e')](_0x2a8b7a[_0x5eb9('0x7b')],function(_0x392f8d){var _0x35fd99={};_0x35fd99[_0x392f8d]={'$like':'%'+_0x202cd7[_0x5eb9('0x27')][_0x5eb9('0x7f')]+'%'};return _0x35fd99;})});}_0x2a8b7a=_[_0x5eb9('0x31')]({},_0x2a8b7a,_0x202cd7['options']);return db['CmHopper']['count']({'where':_0x2a8b7a['where']})[_0x5eb9('0x13')](function(_0xd07728){_0x2fd5cb[_0x5eb9('0xf')]=_0xd07728;if(_0x202cd7[_0x5eb9('0x27')][_0x5eb9('0x9d')]){_0x2a8b7a[_0x5eb9('0x9e')]=[{'all':!![]}];}return db[_0x5eb9('0x39')][_0x5eb9('0x33')](_0x2a8b7a);})[_0x5eb9('0x13')](function(_0x27a89e){_0x2fd5cb['rows']=_0x27a89e;return _0x2fd5cb;});}})[_0x5eb9('0x13')](respondWithFilteredResult(_0x24394f,_0x2a8b7a))[_0x5eb9('0x1c')](handleError(_0x24394f,null));};exports[_0x5eb9('0x9f')]=function(_0x268507,_0x33ccde){var _0x40915e={'raw':!![],'where':{}};var _0x2e88da={};var _0x8959b5={'count':0x0,'rows':[]};return db[_0x5eb9('0x1e')][_0x5eb9('0x83')]({'where':{'id':_0x268507[_0x5eb9('0x20')]['id']}})[_0x5eb9('0x13')](handleEntityNotFound(_0x33ccde,null))[_0x5eb9('0x13')](function(_0x156cc7){if(_0x156cc7){_0x2e88da[_0x5eb9('0x7a')]=_[_0x5eb9('0x22')](db[_0x5eb9('0x4c')][_0x5eb9('0x9a')]);_0x2e88da['query']=_['keys'](_0x268507[_0x5eb9('0x27')]);_0x2e88da[_0x5eb9('0x78')]=_['intersection'](_0x2e88da[_0x5eb9('0x7a')],_0x2e88da[_0x5eb9('0x27')]);_0x40915e[_0x5eb9('0x7b')]=_[_0x5eb9('0x79')](_0x2e88da['model'],qs[_0x5eb9('0x7c')](_0x268507[_0x5eb9('0x27')][_0x5eb9('0x7c')]));_0x40915e['attributes']=_0x40915e['attributes'][_0x5eb9('0x23')]?_0x40915e[_0x5eb9('0x7b')]:_0x2e88da[_0x5eb9('0x7a')];if(!_0x268507[_0x5eb9('0x27')][_0x5eb9('0x30')](_0x5eb9('0x81'))){_0x40915e[_0x5eb9('0x10')]=qs[_0x5eb9('0x10')](_0x268507['query'][_0x5eb9('0x10')]);_0x40915e['offset']=qs['offset'](_0x268507['query'][_0x5eb9('0xe')]);}_0x40915e[_0x5eb9('0x9b')]=qs['sort'](_0x268507[_0x5eb9('0x27')]['sort']);_0x40915e[_0x5eb9('0x60')]=qs[_0x5eb9('0x78')](_['pick'](_0x268507[_0x5eb9('0x27')],_0x2e88da[_0x5eb9('0x78')]));_0x40915e[_0x5eb9('0x60')][_0x5eb9('0x9c')]=_0x156cc7['id'];if(_0x268507[_0x5eb9('0x27')][_0x5eb9('0x7f')]){_0x40915e['where']=_['merge'](_0x40915e[_0x5eb9('0x60')],{'$or':_['map'](_0x40915e[_0x5eb9('0x7b')],function(_0xea6b74){var _0x54ba07={};_0x54ba07[_0xea6b74]={'$like':'%'+_0x268507[_0x5eb9('0x27')][_0x5eb9('0x7f')]+'%'};return _0x54ba07;})});}_0x40915e=_[_0x5eb9('0x31')]({},_0x40915e,_0x268507['options']);return db[_0x5eb9('0x4c')]['count']({'where':_0x40915e[_0x5eb9('0x60')]})[_0x5eb9('0x13')](function(_0x8cb772){_0x8959b5[_0x5eb9('0xf')]=_0x8cb772;if(_0x268507['query'][_0x5eb9('0x9d')]){_0x40915e[_0x5eb9('0x9e')]=[{'all':!![]}];}return db[_0x5eb9('0x4c')]['findAll'](_0x40915e);})[_0x5eb9('0x13')](function(_0x55df11){_0x8959b5[_0x5eb9('0xa0')]=_0x55df11;return _0x8959b5;});}})['then'](respondWithFilteredResult(_0x33ccde,_0x40915e))['catch'](handleError(_0x33ccde,null));};exports[_0x5eb9('0xa1')]=function(_0x2bb565,_0x5f1ac2){var _0x5df4f4={'raw':!![],'where':{}};var _0x2a6f36={};var _0x486dc3={'count':0x0,'rows':[]};return db[_0x5eb9('0x1e')][_0x5eb9('0x83')]({'where':{'id':_0x2bb565[_0x5eb9('0x20')]['id']}})[_0x5eb9('0x13')](handleEntityNotFound(_0x5f1ac2,null))[_0x5eb9('0x13')](function(_0x168235){if(_0x168235){_0x2a6f36[_0x5eb9('0x7a')]=_['keys'](db[_0x5eb9('0x4b')][_0x5eb9('0x9a')]);_0x2a6f36[_0x5eb9('0x27')]=_['keys'](_0x2bb565['query']);_0x2a6f36[_0x5eb9('0x78')]=_['intersection'](_0x2a6f36[_0x5eb9('0x7a')],_0x2a6f36['query']);_0x5df4f4[_0x5eb9('0x7b')]=_[_0x5eb9('0x79')](_0x2a6f36[_0x5eb9('0x7a')],qs[_0x5eb9('0x7c')](_0x2bb565[_0x5eb9('0x27')][_0x5eb9('0x7c')]));_0x5df4f4['attributes']=_0x5df4f4[_0x5eb9('0x7b')][_0x5eb9('0x23')]?_0x5df4f4[_0x5eb9('0x7b')]:_0x2a6f36[_0x5eb9('0x7a')];if(!_0x2bb565[_0x5eb9('0x27')][_0x5eb9('0x30')](_0x5eb9('0x81'))){_0x5df4f4['limit']=qs[_0x5eb9('0x10')](_0x2bb565['query'][_0x5eb9('0x10')]);_0x5df4f4[_0x5eb9('0xe')]=qs['offset'](_0x2bb565['query']['offset']);}_0x5df4f4[_0x5eb9('0x9b')]=qs[_0x5eb9('0x7d')](_0x2bb565[_0x5eb9('0x27')]['sort']);_0x5df4f4[_0x5eb9('0x60')]=qs[_0x5eb9('0x78')](_[_0x5eb9('0x7e')](_0x2bb565['query'],_0x2a6f36[_0x5eb9('0x78')]));_0x5df4f4[_0x5eb9('0x60')]['ContactId']=_0x168235['id'];if(_0x2bb565[_0x5eb9('0x27')][_0x5eb9('0x7f')]){_0x5df4f4[_0x5eb9('0x60')]=_['merge'](_0x5df4f4[_0x5eb9('0x60')],{'$or':_[_0x5eb9('0x6e')](_0x5df4f4[_0x5eb9('0x7b')],function(_0x26814f){var _0x553a00={};_0x553a00[_0x26814f]={'$like':'%'+_0x2bb565['query'][_0x5eb9('0x7f')]+'%'};return _0x553a00;})});}_0x5df4f4=_[_0x5eb9('0x31')]({},_0x5df4f4,_0x2bb565[_0x5eb9('0x80')]);return db[_0x5eb9('0x4b')]['count']({'where':_0x5df4f4[_0x5eb9('0x60')]})['then'](function(_0x4694d7){_0x486dc3['count']=_0x4694d7;if(_0x2bb565['query'][_0x5eb9('0x9d')]){_0x5df4f4['include']=[{'all':!![]}];}return db[_0x5eb9('0x4b')]['findAll'](_0x5df4f4);})['then'](function(_0x14d441){_0x486dc3[_0x5eb9('0xa0')]=_0x14d441;return _0x486dc3;});}})[_0x5eb9('0x13')](respondWithFilteredResult(_0x5f1ac2,_0x5df4f4))[_0x5eb9('0x1c')](handleError(_0x5f1ac2,null));};exports[_0x5eb9('0xa2')]=function(_0x1d7bdf,_0x3b0f27){var _0x36f43d={'raw':!![],'where':{}};var _0xca12c1={};var _0x15fe48={'count':0x0,'rows':[]};return db[_0x5eb9('0x1e')][_0x5eb9('0x83')]({'where':{'id':_0x1d7bdf[_0x5eb9('0x20')]['id']}})['then'](handleEntityNotFound(_0x3b0f27,null))[_0x5eb9('0x13')](function(_0x10a7dc){if(_0x10a7dc){_0xca12c1[_0x5eb9('0x7a')]=_[_0x5eb9('0x22')](db[_0x5eb9('0x54')][_0x5eb9('0x9a')]);_0xca12c1[_0x5eb9('0x27')]=_[_0x5eb9('0x22')](_0x1d7bdf[_0x5eb9('0x27')]);_0xca12c1[_0x5eb9('0x78')]=_['intersection'](_0xca12c1[_0x5eb9('0x7a')],_0xca12c1[_0x5eb9('0x27')]);_0x36f43d[_0x5eb9('0x7b')]=_[_0x5eb9('0x79')](_0xca12c1[_0x5eb9('0x7a')],qs[_0x5eb9('0x7c')](_0x1d7bdf[_0x5eb9('0x27')][_0x5eb9('0x7c')]));_0x36f43d[_0x5eb9('0x7b')]=_0x36f43d[_0x5eb9('0x7b')][_0x5eb9('0x23')]?_0x36f43d[_0x5eb9('0x7b')]:_0xca12c1['model'];if(!_0x1d7bdf[_0x5eb9('0x27')][_0x5eb9('0x30')](_0x5eb9('0x81'))){_0x36f43d['limit']=qs[_0x5eb9('0x10')](_0x1d7bdf[_0x5eb9('0x27')][_0x5eb9('0x10')]);_0x36f43d[_0x5eb9('0xe')]=qs[_0x5eb9('0xe')](_0x1d7bdf[_0x5eb9('0x27')][_0x5eb9('0xe')]);}_0x36f43d[_0x5eb9('0x9b')]=qs[_0x5eb9('0x7d')](_0x1d7bdf['query'][_0x5eb9('0x7d')]);_0x36f43d[_0x5eb9('0x60')]=qs[_0x5eb9('0x78')](_[_0x5eb9('0x7e')](_0x1d7bdf[_0x5eb9('0x27')],_0xca12c1[_0x5eb9('0x78')]));_0x36f43d[_0x5eb9('0x60')][_0x5eb9('0x9c')]=_0x10a7dc['id'];if(_0x1d7bdf['query']['filter']){_0x36f43d[_0x5eb9('0x60')]=_['merge'](_0x36f43d[_0x5eb9('0x60')],{'$or':_[_0x5eb9('0x6e')](_0x36f43d[_0x5eb9('0x7b')],function(_0x28f8a7){var _0x47529d={};_0x47529d[_0x28f8a7]={'$like':'%'+_0x1d7bdf['query']['filter']+'%'};return _0x47529d;})});}_0x36f43d=_[_0x5eb9('0x31')]({},_0x36f43d,_0x1d7bdf['options']);return db[_0x5eb9('0x54')]['count']({'where':_0x36f43d[_0x5eb9('0x60')]})['then'](function(_0x37aff9){_0x15fe48['count']=_0x37aff9;if(_0x1d7bdf[_0x5eb9('0x27')][_0x5eb9('0x9d')]){_0x36f43d[_0x5eb9('0x9e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x36f43d);})[_0x5eb9('0x13')](function(_0x2a3ab5){_0x15fe48[_0x5eb9('0xa0')]=_0x2a3ab5;return _0x15fe48;});}})[_0x5eb9('0x13')](respondWithFilteredResult(_0x3b0f27,_0x36f43d))[_0x5eb9('0x1c')](handleError(_0x3b0f27,null));};exports[_0x5eb9('0xa3')]=function(_0x3ba9a4,_0x58272e){try{if(!_0x3ba9a4['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0xa4')]){throw new Error(_0x5eb9('0xa5'));}if(!_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0xa6')]){throw new Error(_0x5eb9('0xa7'));}if(!_0x3ba9a4[_0x5eb9('0x32')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x959d8d=_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0xa4')][_0x5eb9('0xa8')](',');var _0x3bd72b=_0x3ba9a4[_0x5eb9('0x32')]['binding_values'][_0x5eb9('0xa8')](',');if(!_0x959d8d[_0x5eb9('0x23')]||!_0x3bd72b[_0x5eb9('0x23')]||_0x959d8d['length']!==_0x3bd72b[_0x5eb9('0x23')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0x7c')]=_['zipObject'](_0x959d8d,_0x3bd72b);if(!_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0x7c')][_0x5eb9('0x77')]){throw new Error(_0x5eb9('0xa9'));}if(!_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0x7c')]['firstName']){throw new Error(_0x5eb9('0xaa'));}var _0xdb7b82=path['join'](config[_0x5eb9('0xab')],'server/files/tmp',_0x3ba9a4[_0x5eb9('0xac')][_0x5eb9('0xad')]);fs[_0x5eb9('0xae')](_0xdb7b82,parseInt(_0x5eb9('0xaf'),0x8));var _0x1b1fd1=require(_0x5eb9('0xb0'))[_0x5eb9('0xb1')](path[_0x5eb9('0x38')](__dirname,_0x5eb9('0xb2')),[_0xdb7b82,_0x3ba9a4[_0x5eb9('0x32')]['binding_keys'],_0x3ba9a4['body'][_0x5eb9('0xa6')],_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0x61')],_0x3ba9a4[_0x5eb9('0x32')]['CompanyId'],_0x3ba9a4[_0x5eb9('0x32')][_0x5eb9('0x5d')],_0x3ba9a4['body'][_0x5eb9('0xb3')]]);return _0x58272e[_0x5eb9('0x14')](0xc8)[_0x5eb9('0xc')]({'message':_0x5eb9('0xb4'),'pid':_0x1b1fd1['pid']});}catch(_0x3d5bb3){return _0x58272e[_0x5eb9('0x14')](0x1f4)['send'](_0x3d5bb3);}};exports[_0x5eb9('0xb5')]=function(_0x3ee98c,_0x5d8bea){var _0x2c63eb=fs[_0x5eb9('0xb6')](_0x3ee98c[_0x5eb9('0xac')]['path']);Papa[_0x5eb9('0xb7')](_0x2c63eb,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xe866db){return _0x5d8bea[_0x5eb9('0x14')](0xc8)['json']({'file':_0x3ee98c[_0x5eb9('0xac')],'fields':_0xe866db[_0x5eb9('0xb8')]['fields']});}});};exports[_0x5eb9('0xb9')]=function(_0x22cf3c,_0x25ef91){return db[_0x5eb9('0xba')][_0x5eb9('0x33')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5eb9('0xbb')}})[_0x5eb9('0x13')](function(_0x448280){var _0x1bd22b=![];if(!_0x22cf3c[_0x5eb9('0x32')][_0x5eb9('0x61')]){throw new Error(_0x5eb9('0xbc'));}if(!_0x22cf3c['body'][_0x5eb9('0xbd')]['phone']){throw new Error(_0x5eb9('0xa9'));}if(!_0x22cf3c[_0x5eb9('0x32')][_0x5eb9('0xbd')][_0x5eb9('0xbe')]){throw new Error(_0x5eb9('0xaa'));}if(!_0x22cf3c[_0x5eb9('0x32')][_0x5eb9('0xb3')]){throw new Error(_0x5eb9('0xbf'));}var _0xf83ede=require(_0x5eb9('0xb0'))[_0x5eb9('0xb1')](path[_0x5eb9('0x38')](__dirname,_0x5eb9('0xc0')),[_0x22cf3c[_0x5eb9('0x20')]['id'],JSON['stringify'](_0x22cf3c[_0x5eb9('0x32')]),JSON[_0x5eb9('0xc1')](_0x448280)]);_0xf83ede['on'](_0x5eb9('0xc2'),function(){_0x1bd22b=!![];return _0x25ef91[_0x5eb9('0x14')](0xc8)[_0x5eb9('0xc')]({'message':_0x5eb9('0xc3'),'pid':_0xf83ede[_0x5eb9('0xc4')]});});_0xf83ede['on'](_0x5eb9('0xc5'),function(_0x3299df){if(_0x3299df&&!_0x1bd22b){return _0x25ef91[_0x5eb9('0x14')](0x1f4)[_0x5eb9('0xc')]({'message':_0x5eb9('0xc6'),'pid':_0xf83ede['pid']});}});})['catch'](handleError(_0x25ef91,null));};exports[_0x5eb9('0xc7')]=function(_0x101a02,_0x1564af){return db['User'][_0x5eb9('0x33')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5eb9('0xbb')}})[_0x5eb9('0x13')](function(_0x228905){var _0x4b92c4=![];if(!_0x101a02[_0x5eb9('0x32')][_0x5eb9('0x61')]){throw new Error(_0x5eb9('0xbc'));}if(!_0x101a02[_0x5eb9('0x32')][_0x5eb9('0xbd')][_0x5eb9('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x101a02[_0x5eb9('0x32')][_0x5eb9('0xbd')][_0x5eb9('0xbe')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x101a02[_0x5eb9('0x32')][_0x5eb9('0xb3')]){throw new Error(_0x5eb9('0xbf'));}var _0x1ab86c=require(_0x5eb9('0xb0'))[_0x5eb9('0xb1')](path[_0x5eb9('0x38')](__dirname,_0x5eb9('0xc8')),[_0x101a02[_0x5eb9('0x20')]['id'],JSON[_0x5eb9('0xc1')](_0x101a02['body']),JSON['stringify'](_0x228905)]);_0x1ab86c['on'](_0x5eb9('0xc2'),function(){_0x4b92c4=!![];return _0x1564af['status'](0xc8)[_0x5eb9('0xc')]({'message':_0x5eb9('0xc3'),'pid':_0x1ab86c[_0x5eb9('0xc4')]});});_0x1ab86c['on'](_0x5eb9('0xc5'),function(_0x738790){if(_0x738790&&!_0x4b92c4){return _0x1564af['status'](0x1f4)[_0x5eb9('0xc')]({'message':_0x5eb9('0xc6'),'pid':_0x1ab86c[_0x5eb9('0xc4')]});}});})[_0x5eb9('0x1c')](handleError(_0x1564af,null));};exports['getJourney']=function(_0x55eec5,_0x24e68f){var _0xe0b38b=[_0x5eb9('0xc9'),_0x5eb9('0xca'),_0x5eb9('0xcb'),'openchannel',_0x5eb9('0xcc'),'whatsapp','voice'];var _0x48f79f={'offset':0x0,'order':qs[_0x5eb9('0x7d')](_0x5eb9('0xcd'))},_0x2d70da={'count':0x0,'rows':[]};Promise[_0x5eb9('0xce')]()['then'](function(){if(_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0xcf')]){if(!_[_0x5eb9('0xd0')](_0xe0b38b,_0x55eec5['query'][_0x5eb9('0xcf')][_0x5eb9('0xd1')]())){throw new Error(_0x5eb9('0xd2'));}_0xe0b38b=[_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0xcf')]['toLowerCase']()];}if(_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0xd3')]){try{var _0x46d355=JSON[_0x5eb9('0xb7')](_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0xd3')]);if(!moment(_0x46d355['from'])[_0x5eb9('0xd4')]()){throw new Error(_0x5eb9('0xd5'));}if(!moment(_0x46d355['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x481147){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x55eec5[_0x5eb9('0x27')]['hasOwnProperty'](_0x5eb9('0x81'))){_0x48f79f[_0x5eb9('0x10')]=qs[_0x5eb9('0x10')](_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0x10')]||0xa);_0x48f79f[_0x5eb9('0xe')]=qs[_0x5eb9('0xe')](_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0xe')]);}var _0x403c7f=_0xe0b38b['map'](function(_0x12ad72){if(_0x12ad72===_0x5eb9('0xd6')){var _0x405aa8={'attributes':['id',_0x5eb9('0xd7'),_0x5eb9('0x2c'),_0x5eb9('0xd8'),_0x5eb9('0xd9'),_0x5eb9('0xda'),'starttime',_0x5eb9('0xdb'),_0x5eb9('0xdc'),'note',_0x5eb9('0xdd'),'userDisposition',_0x5eb9('0xde'),_0x5eb9('0xdf'),_0x5eb9('0xe0')],'where':{'ContactId':_0x55eec5[_0x5eb9('0x20')]['id']},'include':[{'model':db['User'],'as':_0x5eb9('0xba'),'attributes':['id',_0x5eb9('0x17'),_0x5eb9('0xe1'),_0x5eb9('0x2b')]}],'order':[[_0x5eb9('0xdd'),_0x5eb9('0xe2')]]};if(_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0xd3')]){_0x405aa8[_0x5eb9('0x60')][_0x5eb9('0xdd')]={'$gte':_0x46d355['from'],'$lte':_0x46d355['to']};}return db[_0x5eb9('0x4e')]['findAndCountAll'](_0x405aa8)['then'](function(_0x1789f1){_0x2d70da['count']+=_0x1789f1[_0x5eb9('0xf')];return _['map'](_0x1789f1[_0x5eb9('0xa0')],function(_0x377d12){var _0x4310db=_0x377d12[_0x5eb9('0x35')]({'plain':!![]});_0x4310db[_0x5eb9('0xcf')]=_0x12ad72;if(_0x4310db[_0x5eb9('0xba')]){_0x4310db[_0x5eb9('0xba')]={'id':_0x4310db[_0x5eb9('0xba')]['id'],'name':_0x4310db[_0x5eb9('0xba')]['name'],'fullname':_0x4310db['User'][_0x5eb9('0xe1')],'alias':_0x4310db[_0x5eb9('0xba')]['alias']};}return _0x4310db;});});}else{var _0x4fb5a1=_['startCase'](_0x12ad72)+(_0x12ad72==='chat'?_0x5eb9('0xe3'):_0x5eb9('0xe4'));var _0x17bf30={'attributes':['id',_0x5eb9('0xe5'),_0x5eb9('0xe6'),'createdAt',_0x5eb9('0xe7'),_0x5eb9('0xe8'),_0x5eb9('0xe9'),_0x5eb9('0xea'),'UserId',_0x4fb5a1+'Id'],'where':{'ContactId':_0x55eec5[_0x5eb9('0x20')]['id']},'include':[{'model':db[_0x4fb5a1],'as':_0x5eb9('0xe4'),'attributes':['id','name',_0x5eb9('0xeb')]},{'model':db['User'],'as':_0x5eb9('0xec'),'attributes':['id','name',_0x5eb9('0xe1')]},{'model':db[_0x5eb9('0x65')],'as':_0x5eb9('0xed'),'attributes':['id',_0x5eb9('0x17'),_0x5eb9('0x66')],'through':{'attributes':[]}}],'order':[[_0x5eb9('0xdd'),_0x5eb9('0xe2')]]};if(_0x55eec5[_0x5eb9('0x27')][_0x5eb9('0xd3')]){_0x17bf30[_0x5eb9('0x60')][_0x5eb9('0xdd')]={'$gte':_0x46d355[_0x5eb9('0x34')],'$lte':_0x46d355['to']};}switch(_0x12ad72){case _0x5eb9('0xca'):_0x17bf30[_0x5eb9('0x7b')][_0x5eb9('0x5f')](_0x5eb9('0xee'),_0x5eb9('0xef'),_0x5eb9('0xf0'),_0x5eb9('0xf1'),'osName',_0x5eb9('0xf2'),_0x5eb9('0xf3'),_0x5eb9('0xf4'),_0x5eb9('0xf5'));break;case _0x5eb9('0xc9'):_0x17bf30[_0x5eb9('0x7b')][_0x5eb9('0x5f')](_0x5eb9('0xf6'),_0x5eb9('0xf7'));break;case _0x5eb9('0xf8'):_0x17bf30['attributes'][_0x5eb9('0x5f')]('externalUrl',_0x5eb9('0xf9'));break;}return db[_['startCase'](_0x12ad72)+'Interaction'][_0x5eb9('0xfa')](_0x17bf30)['then'](function(_0x55b6f8){_0x2d70da[_0x5eb9('0xf')]+=_0x55b6f8[_0x5eb9('0xf')];return _[_0x5eb9('0x6e')](_0x55b6f8[_0x5eb9('0xa0')],function(_0x16c7e8){var _0x356a60=_0x16c7e8[_0x5eb9('0x35')]({'plain':!![]});_0x356a60[_0x5eb9('0xcf')]=_0x12ad72;if(_0x356a60[_0x5eb9('0xec')]){_0x356a60[_0x5eb9('0xec')]={'id':_0x356a60[_0x5eb9('0xec')]['id'],'name':_0x356a60[_0x5eb9('0xec')][_0x5eb9('0x17')],'fullname':_0x356a60['Owner'][_0x5eb9('0xe1')]};}return _0x356a60;});});}});return Promise[_0x5eb9('0x86')](_0x403c7f);})[_0x5eb9('0x13')](function(_0x362166){return _(_0x362166)['flatten']()['sortBy'](_0x5eb9('0xdd'))[_0x5eb9('0xfb')]()['value']();})[_0x5eb9('0x13')](function(_0x46f306){_0x2d70da[_0x5eb9('0xa0')]=_0x48f79f[_0x5eb9('0x10')]?_0x46f306[_0x5eb9('0xfc')](_0x48f79f[_0x5eb9('0xe')],_0x48f79f[_0x5eb9('0xe')]+_0x48f79f[_0x5eb9('0x10')]):_0x46f306;return _0x2d70da;})[_0x5eb9('0x13')](respondWithFilteredResult(_0x24e68f,_0x48f79f))['catch'](handleError(_0x24e68f,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 6160adb..de519e3 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 _0x6dfb=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xbf09eb,_0x1c2276){var _0x31e8af=function(_0x23b600){while(--_0x23b600){_0xbf09eb['push'](_0xbf09eb['shift']());}};_0x31e8af(++_0x1c2276);}(_0x6dfb,0x99));var _0xb6df=function(_0x289ded,_0x422ee8){_0x289ded=_0x289ded-0x0;var _0x4509f3=_0x6dfb[_0x289ded];return _0x4509f3;};'use strict';var EventEmitter=require(_0xb6df('0x0'));var CmContact=require(_0xb6df('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb6df('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb6df('0x3'),'afterDestroy':_0xb6df('0x4')};function emitEvent(_0x2045db){return function(_0x2b6e43,_0x2931c2,_0x138baa){CmContactEvents[_0xb6df('0x5')](_0x2045db+':'+_0x2b6e43['id'],_0x2b6e43);CmContactEvents[_0xb6df('0x5')](_0x2045db,_0x2b6e43);_0x138baa(null);};}for(var e in events){if(events[_0xb6df('0x6')](e)){var event=events[e];CmContact[_0xb6df('0x7')](e,emitEvent(event));}}module[_0xb6df('0x8')]=CmContactEvents; \ No newline at end of file +var _0x685c=['exports','events','CmContact','remove','emit','hook'];(function(_0x4e421e,_0x1cf50f){var _0x58e0aa=function(_0xf760c0){while(--_0xf760c0){_0x4e421e['push'](_0x4e421e['shift']());}};_0x58e0aa(++_0x1cf50f);}(_0x685c,0xf1));var _0xc685=function(_0x55b684,_0x56ae50){_0x55b684=_0x55b684-0x0;var _0x45cb0f=_0x685c[_0x55b684];return _0x45cb0f;};'use strict';var EventEmitter=require(_0xc685('0x0'));var CmContact=require('../../mysqldb')['db'][_0xc685('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc685('0x2')};function emitEvent(_0x1fe203){return function(_0x34f83c,_0x4e385b,_0x2903b0){CmContactEvents[_0xc685('0x3')](_0x1fe203+':'+_0x34f83c['id'],_0x34f83c);CmContactEvents[_0xc685('0x3')](_0x1fe203,_0x34f83c);_0x2903b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xc685('0x4')](e,emitEvent(event));}}module[_0xc685('0x5')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 5c32f9d..86114f3 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 _0xf1a1=['timezones','utcOffset','add','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','error','minutes','\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','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','BlackLists','message','onlyIfOpen','Campaign','cmContact,\x20%s,\x20%s','List\x20not\x20found','models','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','get','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','then','dialTimezone'];(function(_0x26e9df,_0x46bb15){var _0x2a0d2b=function(_0x2c9773){while(--_0x2c9773){_0x26e9df['push'](_0x26e9df['shift']());}};_0x2a0d2b(++_0x46bb15);}(_0xf1a1,0x1d9));var _0x1f1a=function(_0x413629,_0x35dcb2){_0x413629=_0x413629-0x0;var _0x4b23cd=_0xf1a1[_0x413629];return _0x4b23cd;};'use strict';var _=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var logger=require(_0x1f1a('0x2'))(_0x1f1a('0x3'));var moment=require(_0x1f1a('0x4'));var BPromise=require(_0x1f1a('0x5'));var rp=require(_0x1f1a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f1a('0x7'));var config=require('../../config/environment');var shared=require(_0x1f1a('0x8'));var attributes=require(_0x1f1a('0x9'));module[_0x1f1a('0xa')]=function(_0x28e701,_0x28750f){return _0x28e701['define'](_0x1f1a('0xb'),attributes,{'tableName':_0x1f1a('0xc'),'paranoid':!![],'indexes':[{'name':_0x1f1a('0xd'),'fields':[_0x1f1a('0xd')]},{'name':_0x1f1a('0xe'),'fields':['firstName',_0x1f1a('0xf'),'phone',_0x1f1a('0x10'),_0x1f1a('0x11'),_0x1f1a('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x1f1a('0x13'),'collate':_0x1f1a('0x14'),'hooks':{'afterCreate':function(_0x471432,_0x2792f1,_0x487ea0){var _0x25d96c=_0x28e701['models'];var _0x4546b3=_0x471432[_0x1f1a('0x15')]({'plain':!![]});function _0x3b0964(){return function(_0x471534){logger['error']('cmContact',_0x1f1a('0x16'),util[_0x1f1a('0x17')](_0x471534,{'showHidden':![],'depth':null}));};}function _0x380d6d(_0x50c2cf,_0x55dd4e){var _0x125264=_0x55dd4e[_0x1f1a('0x18')]?_0x55dd4e[_0x1f1a('0x18')]:moment()[_0x1f1a('0x19')](_0x1f1a('0x1a'));return new BPromise(function(_0x3f88b0,_0x161535){if(_[_0x1f1a('0x1b')](_0x55dd4e['dialTimezone'])){_0x3f88b0({'ret':_0x125264});}else{_0x25d96c[_0x1f1a('0x1c')]['findOne']({'where':{'id':_0x50c2cf['id']}})[_0x1f1a('0x1d')](function(_0x234f96){if(!_[_0x1f1a('0x1b')](_0x234f96)){var _0x4a0390=_0x234f96[_0x1f1a('0x1e')];if(!_[_0x1f1a('0x1b')](_0x4a0390)){var _0x83abf9=shared[_0x1f1a('0x1f')];var _0x6616ab=_0x83abf9[_0x4a0390];var _0x57c4df=_0x83abf9[_0x55dd4e['dialTimezone']];if(!_[_0x1f1a('0x1b')](_0x6616ab)&&!_[_0x1f1a('0x1b')](_0x57c4df)){var _0x1292e5=_0x6616ab['utcOffset']-_0x57c4df[_0x1f1a('0x20')];_0x125264=_0x55dd4e['scheduledat']?_0x55dd4e[_0x1f1a('0x18')]:moment();var _0x1d8b2c=moment(_0x125264)[_0x1f1a('0x21')](_0x1292e5,'minutes');_0x3f88b0({'ret':_0x1d8b2c['format'](_0x1f1a('0x1a'))});}else _0x3f88b0({'ret':_0x125264});}else _0x3f88b0({'ret':_0x125264});}else{_0x3f88b0({'ret':_0x125264});}});}});return 0xa;}var _0x93cfac=function(_0x50e809){return new BPromise(function(_0x69652,_0x4102b8){_0x380d6d(_0x50e809,_0x4546b3)[_0x1f1a('0x1d')](function(_0x13ef6d){_0x4546b3[_0x1f1a('0x18')]=_0x13ef6d[_0x1f1a('0x22')];_0x25d96c[_0x1f1a('0x23')][_0x1f1a('0x24')]({'where':{'phone':_0x4546b3[_0x1f1a('0xd')],'VoiceQueueId':_0x50e809['id']}})[_0x1f1a('0x1d')](function(_0x5b0ec2){if(!_[_0x1f1a('0x1b')](_0x5b0ec2)){throw new Error(_0x1f1a('0x25')+_0x4546b3[_0x1f1a('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x50e809['id']);}return _0x25d96c[_0x1f1a('0x23')]['create']({'phone':_0x4546b3[_0x1f1a('0xd')],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3[_0x1f1a('0x26')],'priority':_0x4546b3['priority']?_0x4546b3[_0x1f1a('0x27')]:0x2,'scheduledat':_0x4546b3['scheduledat']?_0x4546b3['scheduledat']:moment()[_0x1f1a('0x19')](_0x1f1a('0x1a')),'callback':_0x4546b3['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4546b3['callbackUniqueid']?_0x4546b3[_0x1f1a('0x28')]:undefined,'callbackat':_0x4546b3[_0x1f1a('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x50e809['id']});})[_0x1f1a('0x29')](function(_0x10bbb8){_0x4102b8(_0x10bbb8);});});});};var _0xde0dc0=function(_0x33a836){return new BPromise(function(_0x251ae5,_0x264f22){_0x380d6d(_0x33a836,_0x4546b3)[_0x1f1a('0x1d')](function(_0x2eb45b){_0x4546b3[_0x1f1a('0x18')]=_0x2eb45b[_0x1f1a('0x22')];_0x25d96c[_0x1f1a('0x23')][_0x1f1a('0x24')]({'where':{'phone':_0x4546b3['phone'],'VoiceQueueId':_0x33a836['id']}})['then'](function(_0x1571ee){if(!_[_0x1f1a('0x1b')](_0x1571ee)){throw new Error(_0x1f1a('0x25')+_0x4546b3[_0x1f1a('0xd')]+_0x1f1a('0x2a')+_0x33a836['id']);}return _0x25d96c[_0x1f1a('0x2b')]['findOne']({'where':{'calleridnum':_0x4546b3[_0x1f1a('0xd')],'VoiceQueueId':_0x33a836['id']}});})[_0x1f1a('0x1d')](function(_0x388396){if(!_['isNil'](_0x388396)){throw new Error(_0x1f1a('0x2c')+_0x4546b3[_0x1f1a('0xd')]+_0x1f1a('0x2d')+_0x33a836['id']);}return _0x25d96c['CmHopper'][_0x1f1a('0x2e')]({'phone':_0x4546b3[_0x1f1a('0xd')],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3[_0x1f1a('0x26')],'priority':_0x4546b3['priority']?_0x4546b3[_0x1f1a('0x27')]:0x2,'scheduledat':_0x4546b3[_0x1f1a('0x18')]?_0x4546b3[_0x1f1a('0x18')]:moment()[_0x1f1a('0x19')](_0x1f1a('0x1a')),'callback':_0x4546b3[_0x1f1a('0x28')]?!![]:![],'callbackuniqueid':_0x4546b3['callbackUniqueid']?_0x4546b3[_0x1f1a('0x28')]:undefined,'callbackat':_0x4546b3['callbackUniqueid']?moment()['format'](_0x1f1a('0x1a')):undefined,'VoiceQueueId':_0x33a836['id']});})[_0x1f1a('0x29')](function(_0x4b799b){_0x264f22(_0x4b799b);});});});};function _0x47501d(){return function(_0x2a11b1){logger[_0x1f1a('0x2f')]('cmContact',_0x1f1a('0x16'),util[_0x1f1a('0x17')](_0x2a11b1,{'showHidden':![],'depth':null}));};}function _0x49c26e(_0x26d6e2,_0x1b6b6a){var _0x2b0bbd=_0x1b6b6a['scheduledat']?_0x1b6b6a[_0x1f1a('0x18')]:moment()[_0x1f1a('0x19')](_0x1f1a('0x1a'));return new BPromise(function(_0x59093c,_0x1879fe){if(_[_0x1f1a('0x1b')](_0x1b6b6a['dialTimezone'])){_0x59093c({'ret':_0x2b0bbd});}else{_0x25d96c['Campaign'][_0x1f1a('0x24')]({'where':{'id':_0x26d6e2['id']}})[_0x1f1a('0x1d')](function(_0x22f998){if(!_[_0x1f1a('0x1b')](_0x22f998)){var _0x28f39b=_0x22f998['dialTimezone'];if(!_[_0x1f1a('0x1b')](_0x28f39b)){var _0x49c19c=shared['timezones'];var _0x4d7ac3=_0x49c19c[_0x28f39b];var _0x433c68=_0x49c19c[_0x1b6b6a[_0x1f1a('0x1e')]];if(!_[_0x1f1a('0x1b')](_0x4d7ac3)&&!_[_0x1f1a('0x1b')](_0x433c68)){var _0x39f1a9=_0x4d7ac3[_0x1f1a('0x20')]-_0x433c68[_0x1f1a('0x20')];_0x2b0bbd=_0x1b6b6a[_0x1f1a('0x18')]?_0x1b6b6a[_0x1f1a('0x18')]:moment();var _0x4812b2=moment(_0x2b0bbd)[_0x1f1a('0x21')](_0x39f1a9,_0x1f1a('0x30'));_0x59093c({'ret':_0x4812b2[_0x1f1a('0x19')](_0x1f1a('0x1a'))});}else _0x59093c({'ret':_0x2b0bbd});}else _0x59093c({'ret':_0x2b0bbd});}else{_0x59093c({'ret':_0x2b0bbd});}});}});return 0xa;}var _0x520a66=function(_0x5f5aad){return new BPromise(function(_0x42e9a6,_0x15904c){_0x49c26e(_0x5f5aad,_0x4546b3)['then'](function(_0x94b050){_0x4546b3['scheduledat']=_0x94b050[_0x1f1a('0x22')];_0x25d96c['CmHopper'][_0x1f1a('0x24')]({'where':{'phone':_0x4546b3[_0x1f1a('0xd')],'CampaignId':_0x5f5aad['id']}})[_0x1f1a('0x1d')](function(_0x4babc9){if(!_['isNil'](_0x4babc9)){throw new Error(_0x1f1a('0x25')+_0x4546b3[_0x1f1a('0xd')]+_0x1f1a('0x31')+_0x5f5aad['id']);}return _0x25d96c[_0x1f1a('0x23')][_0x1f1a('0x2e')]({'phone':_0x4546b3['phone'],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3[_0x1f1a('0x26')],'priority':_0x4546b3[_0x1f1a('0x27')]?_0x4546b3[_0x1f1a('0x27')]:0x2,'scheduledat':_0x4546b3[_0x1f1a('0x18')]?_0x4546b3['scheduledat']:moment()[_0x1f1a('0x19')](_0x1f1a('0x1a')),'callback':_0x4546b3[_0x1f1a('0x28')]?!![]:![],'callbackuniqueid':_0x4546b3[_0x1f1a('0x28')]?_0x4546b3['callbackUniqueid']:undefined,'callbackat':_0x4546b3[_0x1f1a('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5f5aad['id']});})[_0x1f1a('0x29')](function(_0x58a3b6){_0x15904c(_0x58a3b6);});});});};var _0x565937=function(_0x577baa){return new BPromise(function(_0x2438a0,_0x291373){_0x49c26e(_0x577baa,_0x4546b3)[_0x1f1a('0x1d')](function(_0x2315a1){_0x4546b3[_0x1f1a('0x18')]=_0x2315a1[_0x1f1a('0x22')];_0x25d96c[_0x1f1a('0x23')][_0x1f1a('0x24')]({'where':{'phone':_0x4546b3[_0x1f1a('0xd')],'CampaignId':_0x577baa['id']}})['then'](function(_0x4bbe90){if(!_['isNil'](_0x4bbe90)){throw new Error(_0x1f1a('0x25')+_0x4546b3[_0x1f1a('0xd')]+_0x1f1a('0x32')+_0x577baa['id']);}return _0x25d96c['CmHopperFinal'][_0x1f1a('0x24')]({'where':{'calleridnum':_0x4546b3[_0x1f1a('0xd')],'CampaignId':_0x577baa['id']}});})['then'](function(_0x5bb655){if(!_[_0x1f1a('0x1b')](_0x5bb655)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4546b3[_0x1f1a('0xd')]+_0x1f1a('0x33')+_0x577baa['id']);}return _0x25d96c['CmHopper'][_0x1f1a('0x2e')]({'phone':_0x4546b3[_0x1f1a('0xd')],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3[_0x1f1a('0x26')],'priority':_0x4546b3[_0x1f1a('0x27')]?_0x4546b3[_0x1f1a('0x27')]:0x2,'scheduledat':_0x4546b3[_0x1f1a('0x18')]?_0x4546b3[_0x1f1a('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4546b3[_0x1f1a('0x28')]?!![]:![],'callbackuniqueid':_0x4546b3[_0x1f1a('0x28')]?_0x4546b3['callbackUniqueid']:undefined,'callbackat':_0x4546b3['callbackUniqueid']?moment()[_0x1f1a('0x19')](_0x1f1a('0x1a')):undefined,'CampaignId':_0x577baa['id']});})[_0x1f1a('0x29')](function(_0x533ae9){_0x291373(_0x533ae9);});});});};if(_0x4546b3['ListId']){_0x25d96c[_0x1f1a('0x1c')][_0x1f1a('0x34')]({'where':{'type':_0x1f1a('0x35')},'attributes':['id',_0x1f1a('0x36'),_0x1f1a('0x1e')],'include':[{'model':_0x25d96c[_0x1f1a('0x37')],'as':_0x1f1a('0x38'),'where':{'id':_0x4546b3[_0x1f1a('0x26')]}}]})[_0x1f1a('0x1d')](function(_0x349452){if(_0x349452){var _0x3de1e3=[];for(var _0x63ee3f=0x0,_0x38b6f7;_0x63ee3f<_0x349452[_0x1f1a('0x39')];_0x63ee3f+=0x1){_0x38b6f7=_0x349452[_0x63ee3f][_0x1f1a('0x15')]({'plain':!![]});switch(_0x38b6f7[_0x1f1a('0x36')]){case'always':_0xde0dc0(_0x38b6f7)['catch'](_0x3b0964());break;case'onlyIfOpen':_0x93cfac(_0x38b6f7)[_0x1f1a('0x29')](_0x3b0964());break;default:_0x49c26e(_0x38b6f7,_0x4546b3)[_0x1f1a('0x1d')](function(_0x283398){_0x4546b3[_0x1f1a('0x18')]=_0x283398[_0x1f1a('0x22')];_0x25d96c[_0x1f1a('0x23')][_0x1f1a('0x2e')]({'phone':_0x4546b3['phone'],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3[_0x1f1a('0x26')],'scheduledat':_0x4546b3[_0x1f1a('0x18')]?_0x4546b3[_0x1f1a('0x18')]:moment()[_0x1f1a('0x19')](_0x1f1a('0x1a')),'priority':_0x4546b3[_0x1f1a('0x27')]?_0x4546b3[_0x1f1a('0x27')]:0x2,'callback':_0x4546b3[_0x1f1a('0x28')]?!![]:![],'callbackuniqueid':_0x4546b3['callbackUniqueid']?_0x4546b3[_0x1f1a('0x28')]:undefined,'callbackat':_0x4546b3[_0x1f1a('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x38b6f7['id']})[_0x1f1a('0x29')](_0x3b0964());});}}}})[_0x1f1a('0x1d')](function(){return _0x25d96c[_0x1f1a('0x1c')][_0x1f1a('0x34')]({'where':{'type':_0x1f1a('0x35')},'attributes':['id'],'include':[{'model':_0x25d96c[_0x1f1a('0x37')],'as':_0x1f1a('0x3a'),'where':{'id':_0x4546b3[_0x1f1a('0x26')]}}]})[_0x1f1a('0x1d')](function(_0x6cc3ca){if(_0x6cc3ca){var _0x5e0f60=[];for(var _0x10e591=0x0,_0x10df19;_0x10e591<_0x6cc3ca['length'];_0x10e591+=0x1){_0x10df19=_0x6cc3ca[_0x10e591][_0x1f1a('0x15')]({'plain':!![]});_0x25d96c['CmHopperBlack'][_0x1f1a('0x2e')]({'phone':_0x4546b3[_0x1f1a('0xd')],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3[_0x1f1a('0x26')],'VoiceQueueId':_0x10df19['id']})[_0x1f1a('0x29')](function(_0x1776ff){logger[_0x1f1a('0x2f')]('cmContact,\x20%s,\x20%s','afterCreate',_0x1776ff[_0x1f1a('0x3b')]);});}}});})[_0x1f1a('0x1d')](function(){return _0x25d96c['Campaign'][_0x1f1a('0x34')]({'attributes':['id',_0x1f1a('0x36'),_0x1f1a('0x1e')],'include':[{'model':_0x25d96c[_0x1f1a('0x37')],'as':_0x1f1a('0x38'),'where':{'id':_0x4546b3[_0x1f1a('0x26')]}}]})[_0x1f1a('0x1d')](function(_0x1fb223){if(_0x1fb223){var _0xc4ad1=[];for(var _0x37963c=0x0,_0x131306;_0x37963c<_0x1fb223[_0x1f1a('0x39')];_0x37963c+=0x1){_0x131306=_0x1fb223[_0x37963c][_0x1f1a('0x15')]({'plain':!![]});switch(_0x131306['dialCheckDuplicateType']){case'always':_0x565937(_0x131306)[_0x1f1a('0x29')](_0x47501d());break;case _0x1f1a('0x3c'):_0x520a66(_0x131306)[_0x1f1a('0x29')](_0x47501d());break;default:_0x25d96c[_0x1f1a('0x23')][_0x1f1a('0x2e')]({'phone':_0x4546b3['phone'],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3['ListId'],'scheduledat':_0x4546b3[_0x1f1a('0x18')]?_0x4546b3[_0x1f1a('0x18')]:moment()[_0x1f1a('0x19')](_0x1f1a('0x1a')),'priority':_0x4546b3[_0x1f1a('0x27')]?_0x4546b3['priority']:0x2,'callback':_0x4546b3[_0x1f1a('0x28')]?!![]:![],'callbackuniqueid':_0x4546b3[_0x1f1a('0x28')]?_0x4546b3[_0x1f1a('0x28')]:undefined,'callbackat':_0x4546b3['callbackUniqueid']?moment()['format'](_0x1f1a('0x1a')):undefined,'CampaignId':_0x131306['id']})['catch'](_0x47501d());}}}});})[_0x1f1a('0x1d')](function(){return _0x25d96c[_0x1f1a('0x3d')][_0x1f1a('0x34')]({'attributes':['id'],'include':[{'model':_0x25d96c[_0x1f1a('0x37')],'as':_0x1f1a('0x3a'),'where':{'id':_0x4546b3[_0x1f1a('0x26')]}}]})['then'](function(_0x1c93ed){if(_0x1c93ed){var _0x5a45a0=[];for(var _0x577d05=0x0,_0x4711a8;_0x577d05<_0x1c93ed[_0x1f1a('0x39')];_0x577d05+=0x1){_0x4711a8=_0x1c93ed[_0x577d05]['get']({'plain':!![]});_0x25d96c['CmHopperBlack'][_0x1f1a('0x2e')]({'phone':_0x4546b3[_0x1f1a('0xd')],'ContactId':_0x4546b3['id'],'ListId':_0x4546b3[_0x1f1a('0x26')],'CampaignId':_0x4711a8['id']})[_0x1f1a('0x29')](function(_0x4aa328){logger[_0x1f1a('0x2f')](_0x1f1a('0x3e'),_0x1f1a('0x16'),_0x4aa328[_0x1f1a('0x3b')]);});}}});})[_0x1f1a('0x1d')](function(){_0x487ea0();})['catch'](function(_0x5925ac){logger[_0x1f1a('0x2f')](_0x1f1a('0x3e'),_0x1f1a('0x16'),_0x5925ac[_0x1f1a('0x3b')]);_0x487ea0(_0x5925ac);});}else{_0x487ea0(new Error(_0x1f1a('0x3f')));}},'afterDestroy':function(_0x3ae4d0,_0x339506,_0x881858){var _0x2702b9=_0x28e701[_0x1f1a('0x40')];var _0x39bc73=_0x3ae4d0[_0x1f1a('0x15')]({'plain':!![]});return _0x2702b9[_0x1f1a('0x23')][_0x1f1a('0x34')]({'raw':!![],'where':{'ListId':_0x39bc73[_0x1f1a('0x26')],'ContactId':_0x39bc73['id']}})[_0x1f1a('0x1d')](function(_0x1b8cc0){if(!_['isEmpty'](_0x1b8cc0)){var _0x39a3fb=[];for(var _0x61a006=0x0;_0x61a006<_0x1b8cc0['length'];_0x61a006+=0x1){var _0x43322b=_0x2702b9['CmHopper']['destroy']({'where':{'ListId':_0x1b8cc0[_0x61a006][_0x1f1a('0x26')],'ContactId':_0x1b8cc0[_0x61a006][_0x1f1a('0x41')],'VoiceQueueId':_0x1b8cc0[_0x61a006][_0x1f1a('0x42')],'CampaignId':_0x1b8cc0[_0x61a006][_0x1f1a('0x43')]}});_0x39a3fb[_0x1f1a('0x44')](_0x43322b);}return BPromise[_0x1f1a('0x45')](_0x39a3fb);}})[_0x1f1a('0x1d')](function(_0x18eabb){logger[_0x1f1a('0x46')](_0x1f1a('0x47'),util[_0x1f1a('0x17')](_0x18eabb,{'showHidden':![],'depth':null}));_0x881858();})[_0x1f1a('0x29')](function(_0x26a2c8){logger['error']('[CmContact][afterDestroy][Error]',util['inspect'](_0x26a2c8,{'showHidden':![],'depth':null}));_0x881858(_0x26a2c8);});}}});}; \ No newline at end of file +var _0x6f3e=['all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','afterCreate','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority','callbackUniqueid','catch','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','create','cmContact','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','VoiceQueueId','CampaignId','push'];(function(_0x568e0c,_0x5bab3e){var _0x1abdd9=function(_0x1d6d2e){while(--_0x1d6d2e){_0x568e0c['push'](_0x568e0c['shift']());}};_0x1abdd9(++_0x5bab3e);}(_0x6f3e,0x1ad));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe6f3('0x1'));var moment=require(_0xe6f3('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6f3('0x3'));var fs=require('fs');var path=require(_0xe6f3('0x4'));var rimraf=require(_0xe6f3('0x5'));var config=require(_0xe6f3('0x6'));var shared=require('../../config/environment/shared');var attributes=require(_0xe6f3('0x7'));module[_0xe6f3('0x8')]=function(_0x55671b,_0x39a676){return _0x55671b[_0xe6f3('0x9')](_0xe6f3('0xa'),attributes,{'tableName':_0xe6f3('0xb'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xe6f3('0xc')]},{'name':_0xe6f3('0xd'),'fields':[_0xe6f3('0xe'),_0xe6f3('0xf'),_0xe6f3('0xc'),_0xe6f3('0x10'),'fax',_0xe6f3('0x11')],'type':_0xe6f3('0x12')}],'timestamps':!![],'charset':_0xe6f3('0x13'),'collate':_0xe6f3('0x14'),'hooks':{'afterCreate':function(_0x3501f8,_0x592e0c,_0x38cf35){var _0x3bba66=_0x55671b['models'];var _0x1d0fc5=_0x3501f8[_0xe6f3('0x15')]({'plain':!![]});function _0x33eb0e(){return function(_0x32cede){logger[_0xe6f3('0x16')]('cmContact',_0xe6f3('0x17'),util['inspect'](_0x32cede,{'showHidden':![],'depth':null}));};}function _0x5955da(_0x9dc236,_0x225690){var _0x4aeba6=_0x225690['scheduledat']?_0x225690[_0xe6f3('0x18')]:moment()[_0xe6f3('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2d8d6d,_0x32b05c){if(_[_0xe6f3('0x1a')](_0x225690[_0xe6f3('0x1b')])){_0x2d8d6d({'ret':_0x4aeba6});}else{_0x3bba66[_0xe6f3('0x1c')]['findOne']({'where':{'id':_0x9dc236['id']}})[_0xe6f3('0x1d')](function(_0x175833){if(!_[_0xe6f3('0x1a')](_0x175833)){var _0x335177=_0x175833[_0xe6f3('0x1b')];if(!_[_0xe6f3('0x1a')](_0x335177)){var _0x2e3640=shared[_0xe6f3('0x1e')];var _0x4d6325=_0x2e3640[_0x335177];var _0xf4b607=_0x2e3640[_0x225690[_0xe6f3('0x1b')]];if(!_[_0xe6f3('0x1a')](_0x4d6325)&&!_[_0xe6f3('0x1a')](_0xf4b607)){var _0x3b2fa2=_0x4d6325[_0xe6f3('0x1f')]-_0xf4b607[_0xe6f3('0x1f')];_0x4aeba6=_0x225690[_0xe6f3('0x18')]?_0x225690['scheduledat']:moment();var _0x359b0c=moment(_0x4aeba6)[_0xe6f3('0x20')](_0x3b2fa2,_0xe6f3('0x21'));_0x2d8d6d({'ret':_0x359b0c[_0xe6f3('0x19')](_0xe6f3('0x22'))});}else _0x2d8d6d({'ret':_0x4aeba6});}else _0x2d8d6d({'ret':_0x4aeba6});}else{_0x2d8d6d({'ret':_0x4aeba6});}});}});return 0xa;}var _0x45e234=function(_0x3bdbf6){return new BPromise(function(_0x2cf507,_0x38abff){_0x5955da(_0x3bdbf6,_0x1d0fc5)['then'](function(_0x103d26){_0x1d0fc5['scheduledat']=_0x103d26[_0xe6f3('0x23')];_0x3bba66[_0xe6f3('0x24')]['findOne']({'where':{'phone':_0x1d0fc5[_0xe6f3('0xc')],'VoiceQueueId':_0x3bdbf6['id']}})[_0xe6f3('0x1d')](function(_0x4402c7){if(!_[_0xe6f3('0x1a')](_0x4402c7)){throw new Error(_0xe6f3('0x25')+_0x1d0fc5[_0xe6f3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x3bdbf6['id']);}return _0x3bba66['CmHopper']['create']({'phone':_0x1d0fc5[_0xe6f3('0xc')],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'priority':_0x1d0fc5[_0xe6f3('0x27')]?_0x1d0fc5[_0xe6f3('0x27')]:0x2,'scheduledat':_0x1d0fc5[_0xe6f3('0x18')]?_0x1d0fc5[_0xe6f3('0x18')]:moment()[_0xe6f3('0x19')](_0xe6f3('0x22')),'callback':_0x1d0fc5[_0xe6f3('0x28')]?!![]:![],'callbackuniqueid':_0x1d0fc5[_0xe6f3('0x28')]?_0x1d0fc5[_0xe6f3('0x28')]:undefined,'callbackat':_0x1d0fc5['callbackUniqueid']?moment()[_0xe6f3('0x19')](_0xe6f3('0x22')):undefined,'VoiceQueueId':_0x3bdbf6['id']});})[_0xe6f3('0x29')](function(_0x3f39b6){_0x38abff(_0x3f39b6);});});});};var _0x3c1ac4=function(_0x44755e){return new BPromise(function(_0x698bc,_0x25304c){_0x5955da(_0x44755e,_0x1d0fc5)[_0xe6f3('0x1d')](function(_0x4c7dd2){_0x1d0fc5[_0xe6f3('0x18')]=_0x4c7dd2[_0xe6f3('0x23')];_0x3bba66[_0xe6f3('0x24')][_0xe6f3('0x2a')]({'where':{'phone':_0x1d0fc5[_0xe6f3('0xc')],'VoiceQueueId':_0x44755e['id']}})[_0xe6f3('0x1d')](function(_0x9e6bff){if(!_[_0xe6f3('0x1a')](_0x9e6bff)){throw new Error(_0xe6f3('0x25')+_0x1d0fc5[_0xe6f3('0xc')]+_0xe6f3('0x2b')+_0x44755e['id']);}return _0x3bba66[_0xe6f3('0x2c')][_0xe6f3('0x2a')]({'where':{'calleridnum':_0x1d0fc5['phone'],'VoiceQueueId':_0x44755e['id']}});})[_0xe6f3('0x1d')](function(_0x5d23da){if(!_[_0xe6f3('0x1a')](_0x5d23da)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x1d0fc5['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x44755e['id']);}return _0x3bba66[_0xe6f3('0x24')][_0xe6f3('0x2d')]({'phone':_0x1d0fc5[_0xe6f3('0xc')],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'priority':_0x1d0fc5['priority']?_0x1d0fc5['priority']:0x2,'scheduledat':_0x1d0fc5[_0xe6f3('0x18')]?_0x1d0fc5[_0xe6f3('0x18')]:moment()[_0xe6f3('0x19')](_0xe6f3('0x22')),'callback':_0x1d0fc5[_0xe6f3('0x28')]?!![]:![],'callbackuniqueid':_0x1d0fc5[_0xe6f3('0x28')]?_0x1d0fc5[_0xe6f3('0x28')]:undefined,'callbackat':_0x1d0fc5[_0xe6f3('0x28')]?moment()[_0xe6f3('0x19')](_0xe6f3('0x22')):undefined,'VoiceQueueId':_0x44755e['id']});})[_0xe6f3('0x29')](function(_0x5e75af){_0x25304c(_0x5e75af);});});});};function _0x38012e(){return function(_0x4a618e){logger['error'](_0xe6f3('0x2e'),_0xe6f3('0x17'),util[_0xe6f3('0x2f')](_0x4a618e,{'showHidden':![],'depth':null}));};}function _0x4e7b89(_0x4bbe46,_0x9cb891){var _0x2c5031=_0x9cb891[_0xe6f3('0x18')]?_0x9cb891[_0xe6f3('0x18')]:moment()['format'](_0xe6f3('0x22'));return new BPromise(function(_0x5762ec,_0x14e5fe){if(_['isNil'](_0x9cb891['dialTimezone'])){_0x5762ec({'ret':_0x2c5031});}else{_0x3bba66[_0xe6f3('0x30')][_0xe6f3('0x2a')]({'where':{'id':_0x4bbe46['id']}})[_0xe6f3('0x1d')](function(_0x104cf5){if(!_['isNil'](_0x104cf5)){var _0xd1cdfe=_0x104cf5[_0xe6f3('0x1b')];if(!_['isNil'](_0xd1cdfe)){var _0xa43e57=shared[_0xe6f3('0x1e')];var _0x3cf547=_0xa43e57[_0xd1cdfe];var _0x4f1142=_0xa43e57[_0x9cb891['dialTimezone']];if(!_[_0xe6f3('0x1a')](_0x3cf547)&&!_['isNil'](_0x4f1142)){var _0x2719ca=_0x3cf547['utcOffset']-_0x4f1142[_0xe6f3('0x1f')];_0x2c5031=_0x9cb891[_0xe6f3('0x18')]?_0x9cb891['scheduledat']:moment();var _0x5467fd=moment(_0x2c5031)[_0xe6f3('0x20')](_0x2719ca,_0xe6f3('0x21'));_0x5762ec({'ret':_0x5467fd[_0xe6f3('0x19')](_0xe6f3('0x22'))});}else _0x5762ec({'ret':_0x2c5031});}else _0x5762ec({'ret':_0x2c5031});}else{_0x5762ec({'ret':_0x2c5031});}});}});return 0xa;}var _0x132ff6=function(_0x2e629c){return new BPromise(function(_0x12366f,_0x3ba7a1){_0x4e7b89(_0x2e629c,_0x1d0fc5)[_0xe6f3('0x1d')](function(_0x2fd6e5){_0x1d0fc5[_0xe6f3('0x18')]=_0x2fd6e5[_0xe6f3('0x23')];_0x3bba66[_0xe6f3('0x24')][_0xe6f3('0x2a')]({'where':{'phone':_0x1d0fc5[_0xe6f3('0xc')],'CampaignId':_0x2e629c['id']}})['then'](function(_0x1cf9aa){if(!_[_0xe6f3('0x1a')](_0x1cf9aa)){throw new Error(_0xe6f3('0x25')+_0x1d0fc5[_0xe6f3('0xc')]+_0xe6f3('0x31')+_0x2e629c['id']);}return _0x3bba66['CmHopper'][_0xe6f3('0x2d')]({'phone':_0x1d0fc5[_0xe6f3('0xc')],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'priority':_0x1d0fc5[_0xe6f3('0x27')]?_0x1d0fc5[_0xe6f3('0x27')]:0x2,'scheduledat':_0x1d0fc5[_0xe6f3('0x18')]?_0x1d0fc5[_0xe6f3('0x18')]:moment()['format'](_0xe6f3('0x22')),'callback':_0x1d0fc5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1d0fc5[_0xe6f3('0x28')]?_0x1d0fc5['callbackUniqueid']:undefined,'callbackat':_0x1d0fc5[_0xe6f3('0x28')]?moment()[_0xe6f3('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2e629c['id']});})[_0xe6f3('0x29')](function(_0x20598d){_0x3ba7a1(_0x20598d);});});});};var _0x3364ef=function(_0xf9969){return new BPromise(function(_0x388f5e,_0x2b2bd4){_0x4e7b89(_0xf9969,_0x1d0fc5)['then'](function(_0x214d45){_0x1d0fc5[_0xe6f3('0x18')]=_0x214d45[_0xe6f3('0x23')];_0x3bba66[_0xe6f3('0x24')][_0xe6f3('0x2a')]({'where':{'phone':_0x1d0fc5['phone'],'CampaignId':_0xf9969['id']}})['then'](function(_0x524489){if(!_[_0xe6f3('0x1a')](_0x524489)){throw new Error(_0xe6f3('0x25')+_0x1d0fc5['phone']+_0xe6f3('0x32')+_0xf9969['id']);}return _0x3bba66[_0xe6f3('0x2c')]['findOne']({'where':{'calleridnum':_0x1d0fc5[_0xe6f3('0xc')],'CampaignId':_0xf9969['id']}});})['then'](function(_0x5a41eb){if(!_[_0xe6f3('0x1a')](_0x5a41eb)){throw new Error(_0xe6f3('0x33')+_0x1d0fc5[_0xe6f3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0xf9969['id']);}return _0x3bba66[_0xe6f3('0x24')]['create']({'phone':_0x1d0fc5[_0xe6f3('0xc')],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'priority':_0x1d0fc5[_0xe6f3('0x27')]?_0x1d0fc5[_0xe6f3('0x27')]:0x2,'scheduledat':_0x1d0fc5[_0xe6f3('0x18')]?_0x1d0fc5[_0xe6f3('0x18')]:moment()[_0xe6f3('0x19')](_0xe6f3('0x22')),'callback':_0x1d0fc5[_0xe6f3('0x28')]?!![]:![],'callbackuniqueid':_0x1d0fc5[_0xe6f3('0x28')]?_0x1d0fc5[_0xe6f3('0x28')]:undefined,'callbackat':_0x1d0fc5[_0xe6f3('0x28')]?moment()[_0xe6f3('0x19')](_0xe6f3('0x22')):undefined,'CampaignId':_0xf9969['id']});})[_0xe6f3('0x29')](function(_0x176acb){_0x2b2bd4(_0x176acb);});});});};if(_0x1d0fc5['ListId']){_0x3bba66[_0xe6f3('0x1c')][_0xe6f3('0x34')]({'where':{'type':_0xe6f3('0x35')},'attributes':['id',_0xe6f3('0x36'),_0xe6f3('0x1b')],'include':[{'model':_0x3bba66[_0xe6f3('0x37')],'as':'Lists','where':{'id':_0x1d0fc5['ListId']}}]})[_0xe6f3('0x1d')](function(_0x538699){if(_0x538699){var _0x185f51=[];for(var _0x51ed3a=0x0,_0xb7aadb;_0x51ed3a<_0x538699[_0xe6f3('0x38')];_0x51ed3a+=0x1){_0xb7aadb=_0x538699[_0x51ed3a][_0xe6f3('0x15')]({'plain':!![]});switch(_0xb7aadb[_0xe6f3('0x36')]){case _0xe6f3('0x39'):_0x3c1ac4(_0xb7aadb)['catch'](_0x33eb0e());break;case _0xe6f3('0x3a'):_0x45e234(_0xb7aadb)[_0xe6f3('0x29')](_0x33eb0e());break;default:_0x4e7b89(_0xb7aadb,_0x1d0fc5)[_0xe6f3('0x1d')](function(_0x5d3083){_0x1d0fc5['scheduledat']=_0x5d3083[_0xe6f3('0x23')];_0x3bba66[_0xe6f3('0x24')][_0xe6f3('0x2d')]({'phone':_0x1d0fc5['phone'],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'scheduledat':_0x1d0fc5[_0xe6f3('0x18')]?_0x1d0fc5[_0xe6f3('0x18')]:moment()[_0xe6f3('0x19')](_0xe6f3('0x22')),'priority':_0x1d0fc5['priority']?_0x1d0fc5['priority']:0x2,'callback':_0x1d0fc5[_0xe6f3('0x28')]?!![]:![],'callbackuniqueid':_0x1d0fc5['callbackUniqueid']?_0x1d0fc5['callbackUniqueid']:undefined,'callbackat':_0x1d0fc5[_0xe6f3('0x28')]?moment()[_0xe6f3('0x19')](_0xe6f3('0x22')):undefined,'VoiceQueueId':_0xb7aadb['id']})[_0xe6f3('0x29')](_0x33eb0e());});}}}})[_0xe6f3('0x1d')](function(){return _0x3bba66[_0xe6f3('0x1c')][_0xe6f3('0x34')]({'where':{'type':_0xe6f3('0x35')},'attributes':['id'],'include':[{'model':_0x3bba66[_0xe6f3('0x37')],'as':_0xe6f3('0x3b'),'where':{'id':_0x1d0fc5[_0xe6f3('0x26')]}}]})['then'](function(_0x17e23b){if(_0x17e23b){var _0x66a7d1=[];for(var _0x22a199=0x0,_0x3a84e7;_0x22a199<_0x17e23b['length'];_0x22a199+=0x1){_0x3a84e7=_0x17e23b[_0x22a199][_0xe6f3('0x15')]({'plain':!![]});_0x3bba66[_0xe6f3('0x3c')][_0xe6f3('0x2d')]({'phone':_0x1d0fc5[_0xe6f3('0xc')],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'VoiceQueueId':_0x3a84e7['id']})['catch'](function(_0x1975a9){logger[_0xe6f3('0x16')](_0xe6f3('0x3d'),_0xe6f3('0x17'),_0x1975a9['message']);});}}});})[_0xe6f3('0x1d')](function(){return _0x3bba66[_0xe6f3('0x30')][_0xe6f3('0x34')]({'attributes':['id',_0xe6f3('0x36'),'dialTimezone'],'include':[{'model':_0x3bba66['CmList'],'as':'Lists','where':{'id':_0x1d0fc5['ListId']}}]})[_0xe6f3('0x1d')](function(_0x437b9f){if(_0x437b9f){var _0x54944a=[];for(var _0x131714=0x0,_0x1c86f3;_0x131714<_0x437b9f[_0xe6f3('0x38')];_0x131714+=0x1){_0x1c86f3=_0x437b9f[_0x131714][_0xe6f3('0x15')]({'plain':!![]});switch(_0x1c86f3[_0xe6f3('0x36')]){case'always':_0x3364ef(_0x1c86f3)[_0xe6f3('0x29')](_0x38012e());break;case'onlyIfOpen':_0x132ff6(_0x1c86f3)['catch'](_0x38012e());break;default:_0x3bba66[_0xe6f3('0x24')][_0xe6f3('0x2d')]({'phone':_0x1d0fc5[_0xe6f3('0xc')],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'scheduledat':_0x1d0fc5[_0xe6f3('0x18')]?_0x1d0fc5[_0xe6f3('0x18')]:moment()[_0xe6f3('0x19')](_0xe6f3('0x22')),'priority':_0x1d0fc5['priority']?_0x1d0fc5[_0xe6f3('0x27')]:0x2,'callback':_0x1d0fc5[_0xe6f3('0x28')]?!![]:![],'callbackuniqueid':_0x1d0fc5['callbackUniqueid']?_0x1d0fc5[_0xe6f3('0x28')]:undefined,'callbackat':_0x1d0fc5[_0xe6f3('0x28')]?moment()[_0xe6f3('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1c86f3['id']})[_0xe6f3('0x29')](_0x38012e());}}}});})[_0xe6f3('0x1d')](function(){return _0x3bba66[_0xe6f3('0x30')][_0xe6f3('0x34')]({'attributes':['id'],'include':[{'model':_0x3bba66[_0xe6f3('0x37')],'as':_0xe6f3('0x3b'),'where':{'id':_0x1d0fc5[_0xe6f3('0x26')]}}]})[_0xe6f3('0x1d')](function(_0x51fa56){if(_0x51fa56){var _0x3e4e1f=[];for(var _0x1863a1=0x0,_0xb2a16f;_0x1863a1<_0x51fa56[_0xe6f3('0x38')];_0x1863a1+=0x1){_0xb2a16f=_0x51fa56[_0x1863a1][_0xe6f3('0x15')]({'plain':!![]});_0x3bba66['CmHopperBlack'][_0xe6f3('0x2d')]({'phone':_0x1d0fc5[_0xe6f3('0xc')],'ContactId':_0x1d0fc5['id'],'ListId':_0x1d0fc5[_0xe6f3('0x26')],'CampaignId':_0xb2a16f['id']})[_0xe6f3('0x29')](function(_0x516ae5){logger['error'](_0xe6f3('0x3d'),'afterCreate',_0x516ae5[_0xe6f3('0x3e')]);});}}});})[_0xe6f3('0x1d')](function(){_0x38cf35();})[_0xe6f3('0x29')](function(_0x520378){logger['error'](_0xe6f3('0x3d'),'afterCreate',_0x520378[_0xe6f3('0x3e')]);_0x38cf35(_0x520378);});}else{_0x38cf35(new Error(_0xe6f3('0x3f')));}},'afterDestroy':function(_0x39f0ca,_0x37db56,_0x4d50b0){var _0x44c214=_0x55671b['models'];var _0x210b4f=_0x39f0ca[_0xe6f3('0x15')]({'plain':!![]});return _0x44c214[_0xe6f3('0x24')][_0xe6f3('0x34')]({'raw':!![],'where':{'ListId':_0x210b4f[_0xe6f3('0x26')],'ContactId':_0x210b4f['id']}})[_0xe6f3('0x1d')](function(_0x3d5af0){if(!_['isEmpty'](_0x3d5af0)){var _0x454c4b=[];for(var _0x1ac429=0x0;_0x1ac429<_0x3d5af0['length'];_0x1ac429+=0x1){var _0x585a34=_0x44c214[_0xe6f3('0x24')][_0xe6f3('0x40')]({'where':{'ListId':_0x3d5af0[_0x1ac429][_0xe6f3('0x26')],'ContactId':_0x3d5af0[_0x1ac429]['ContactId'],'VoiceQueueId':_0x3d5af0[_0x1ac429][_0xe6f3('0x41')],'CampaignId':_0x3d5af0[_0x1ac429][_0xe6f3('0x42')]}});_0x454c4b[_0xe6f3('0x43')](_0x585a34);}return BPromise[_0xe6f3('0x44')](_0x454c4b);}})[_0xe6f3('0x1d')](function(_0x1f15b5){logger['info'](_0xe6f3('0x45'),util[_0xe6f3('0x2f')](_0x1f15b5,{'showHidden':![],'depth':null}));_0x4d50b0();})[_0xe6f3('0x29')](function(_0x3c0bc2){logger[_0xe6f3('0x16')](_0xe6f3('0x46'),util['inspect'](_0x3c0bc2,{'showHidden':![],'depth':null}));_0x4d50b0(_0x3c0bc2);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 0547f7e..28fb9f4 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(_0x2d4c24,_0x25aae6){var _0x4343ab=function(_0x536ba2){while(--_0x536ba2){_0x2d4c24['push'](_0x2d4c24['shift']());}};_0x4343ab(++_0x25aae6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x4731c3,_0x37333d){var _0x5297a3=function(_0xa0466e){while(--_0xa0466e){_0x4731c3['push'](_0x4731c3['shift']());}};_0x5297a3(++_0x37333d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 f8634c2..ee58ae2 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 _0x74f0=['INTEGER','STRING','PHONE','exports'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x74f0,0xf3));var _0x074f=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x74f0[_0x1e081a];return _0x428209;};'use strict';var Sequelize=require('sequelize');module[_0x074f('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x074f('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x074f('0x2')],'defaultValue':_0x074f('0x3')},'OrderBy':{'type':Sequelize[_0x074f('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x6898=['INTEGER','STRING','PHONE','sequelize'];(function(_0x43c157,_0x146178){var _0x59f117=function(_0x1fc3de){while(--_0x1fc3de){_0x43c157['push'](_0x43c157['shift']());}};_0x59f117(++_0x146178);}(_0x6898,0x11b));var _0x8689=function(_0x2842ac,_0x4c5e1d){_0x2842ac=_0x2842ac-0x0;var _0x43f566=_0x6898[_0x2842ac];return _0x43f566;};'use strict';var Sequelize=require(_0x8689('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x8689('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x8689('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x8689('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8689('0x2')],'defaultValue':_0x8689('0x3')},'OrderBy':{'type':Sequelize[_0x8689('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x8689('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index f11543a..b0dca19 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 _0x3a23=['intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','update','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','then','destroy','get','CmContactHasItems','stack','name','send','index','map','CmContactHasItem','rawAttributes','model','query','keys','filters'];(function(_0x19a830,_0x4d4bd0){var _0x5ecb96=function(_0x43f735){while(--_0x43f735){_0x19a830['push'](_0x19a830['shift']());}};_0x5ecb96(++_0x4d4bd0);}(_0x3a23,0x14b));var _0x33a2=function(_0x5a6446,_0xf7be6b){_0x5a6446=_0x5a6446-0x0;var _0x5dd9c1=_0x3a23[_0x5a6446];return _0x5dd9c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33a2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33a2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x33a2('0x2'));var Mustache=require(_0x33a2('0x3'));var util=require(_0x33a2('0x4'));var path=require(_0x33a2('0x5'));var sox=require(_0x33a2('0x6'));var csv=require(_0x33a2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33a2('0x8'));var _=require('lodash');var squel=require(_0x33a2('0x9'));var crypto=require(_0x33a2('0xa'));var jsforce=require(_0x33a2('0xb'));var deskjs=require(_0x33a2('0xc'));var toCsv=require(_0x33a2('0x7'));var querystring=require(_0x33a2('0xd'));var Papa=require(_0x33a2('0xe'));var Redis=require(_0x33a2('0xf'));var authService=require(_0x33a2('0x10'));var qs=require(_0x33a2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33a2('0x12'));var logger=require(_0x33a2('0x13'))(_0x33a2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x33a2('0x15'));var db=require(_0x33a2('0x16'))['db'];function respondWithStatusCode(_0xff10c,_0x19a349){_0x19a349=_0x19a349||0xcc;return function(_0x561177){if(_0x561177){return _0xff10c[_0x33a2('0x17')](_0x19a349);}return _0xff10c[_0x33a2('0x18')](_0x19a349)[_0x33a2('0x19')]();};}function respondWithResult(_0x9e260f,_0x4feb59){_0x4feb59=_0x4feb59||0xc8;return function(_0x4180a0){if(_0x4180a0){return _0x9e260f[_0x33a2('0x18')](_0x4feb59)['json'](_0x4180a0);}};}function respondWithFilteredResult(_0x45ba59,_0x529e5c){return function(_0x3061e6){if(_0x3061e6){var _0x1ab46e=typeof _0x529e5c[_0x33a2('0x1a')]==='undefined'&&typeof _0x529e5c[_0x33a2('0x1b')]==='undefined';var _0x1e8fce=_0x3061e6[_0x33a2('0x1c')];var _0x161334=_0x1ab46e?0x0:_0x529e5c['offset'];var _0x55daf6=_0x1ab46e?_0x3061e6[_0x33a2('0x1c')]:_0x529e5c['offset']+_0x529e5c['limit'];var _0x6402a4;if(_0x55daf6>=_0x1e8fce){_0x55daf6=_0x1e8fce;_0x6402a4=0xc8;}else{_0x6402a4=0xce;}_0x45ba59[_0x33a2('0x18')](_0x6402a4);return _0x45ba59[_0x33a2('0x1d')]('Content-Range',_0x161334+'-'+_0x55daf6+'/'+_0x1e8fce)[_0x33a2('0x1e')](_0x3061e6);}return null;};}function patchUpdates(_0x4676d4){return function(_0x28c7aa){try{jsonpatch[_0x33a2('0x1f')](_0x28c7aa,_0x4676d4,!![]);}catch(_0x163f4b){return BPromise[_0x33a2('0x20')](_0x163f4b);}return _0x28c7aa[_0x33a2('0x21')]();};}function saveUpdates(_0x47c0e4,_0x3eb58e){return function(_0x2318a7){if(_0x2318a7){return _0x2318a7['update'](_0x47c0e4)[_0x33a2('0x22')](function(_0x473539){return _0x473539;});}return null;};}function removeEntity(_0x452571,_0x585962){return function(_0x10dcb4){if(_0x10dcb4){return _0x10dcb4[_0x33a2('0x23')]()[_0x33a2('0x22')](function(){var _0xf7a6f6=_0x10dcb4[_0x33a2('0x24')]({'plain':!![]});var _0x49de1d=_0x33a2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x49de1d,'resourceId':_0xf7a6f6['id']}})[_0x33a2('0x22')](function(){return _0x10dcb4;});})[_0x33a2('0x22')](function(){_0x452571[_0x33a2('0x18')](0xcc)[_0x33a2('0x19')]();});}};}function handleEntityNotFound(_0x4fc219,_0x24734d){return function(_0x5eb1ec){if(!_0x5eb1ec){_0x4fc219['sendStatus'](0x194);}return _0x5eb1ec;};}function handleError(_0x2af529,_0x28f74e){_0x28f74e=_0x28f74e||0x1f4;return function(_0x14b7e5){logger['error'](_0x14b7e5[_0x33a2('0x26')]);if(_0x14b7e5[_0x33a2('0x27')]){delete _0x14b7e5[_0x33a2('0x27')];}_0x2af529[_0x33a2('0x18')](_0x28f74e)[_0x33a2('0x28')](_0x14b7e5);};}exports[_0x33a2('0x29')]=function(_0x5ec962,_0x38a429){var _0x5db7e3={},_0xfb22de={},_0x4afac5={'count':0x0,'rows':[]};var _0x11381b=_[_0x33a2('0x2a')](db[_0x33a2('0x2b')][_0x33a2('0x2c')],function(_0x55f6bb){return{'name':_0x55f6bb['fieldName'],'type':_0x55f6bb['type']['key']};});_0xfb22de[_0x33a2('0x2d')]=_[_0x33a2('0x2a')](_0x11381b,_0x33a2('0x27'));_0xfb22de[_0x33a2('0x2e')]=_[_0x33a2('0x2f')](_0x5ec962[_0x33a2('0x2e')]);_0xfb22de[_0x33a2('0x30')]=_[_0x33a2('0x31')](_0xfb22de[_0x33a2('0x2d')],_0xfb22de[_0x33a2('0x2e')]);_0x5db7e3[_0x33a2('0x32')]=_[_0x33a2('0x31')](_0xfb22de[_0x33a2('0x2d')],qs[_0x33a2('0x33')](_0x5ec962['query'][_0x33a2('0x33')]));_0x5db7e3[_0x33a2('0x32')]=_0x5db7e3[_0x33a2('0x32')][_0x33a2('0x34')]?_0x5db7e3[_0x33a2('0x32')]:_0xfb22de['model'];if(!_0x5ec962[_0x33a2('0x2e')][_0x33a2('0x35')]('nolimit')){_0x5db7e3[_0x33a2('0x1b')]=qs[_0x33a2('0x1b')](_0x5ec962[_0x33a2('0x2e')][_0x33a2('0x1b')]);_0x5db7e3['offset']=qs[_0x33a2('0x1a')](_0x5ec962[_0x33a2('0x2e')]['offset']);}_0x5db7e3['order']=qs[_0x33a2('0x36')](_0x5ec962[_0x33a2('0x2e')][_0x33a2('0x36')]);_0x5db7e3[_0x33a2('0x37')]=qs[_0x33a2('0x30')](_['pick'](_0x5ec962['query'],_0xfb22de[_0x33a2('0x30')]),_0x11381b);if(_0x5ec962[_0x33a2('0x2e')][_0x33a2('0x38')]){_0x5db7e3[_0x33a2('0x37')]=_[_0x33a2('0x39')](_0x5db7e3[_0x33a2('0x37')],{'$or':_[_0x33a2('0x2a')](_0x11381b,function(_0x344eda){if(_0x344eda['type']!==_0x33a2('0x3a')){var _0x598a9e={};_0x598a9e[_0x344eda[_0x33a2('0x27')]]={'$like':'%'+_0x5ec962[_0x33a2('0x2e')][_0x33a2('0x38')]+'%'};return _0x598a9e;}})});}_0x5db7e3=_[_0x33a2('0x39')]({},_0x5db7e3,_0x5ec962[_0x33a2('0x3b')]);var _0x4f3f5b={'where':_0x5db7e3[_0x33a2('0x37')]};return db[_0x33a2('0x2b')]['count'](_0x4f3f5b)[_0x33a2('0x22')](function(_0x451a78){_0x4afac5[_0x33a2('0x1c')]=_0x451a78;if(_0x5ec962[_0x33a2('0x2e')]['includeAll']){_0x5db7e3['include']=[{'all':!![]}];}return db[_0x33a2('0x2b')][_0x33a2('0x3c')](_0x5db7e3);})[_0x33a2('0x22')](function(_0x47ebf7){_0x4afac5[_0x33a2('0x3d')]=_0x47ebf7;return _0x4afac5;})[_0x33a2('0x22')](respondWithFilteredResult(_0x38a429,_0x5db7e3))[_0x33a2('0x3e')](handleError(_0x38a429,null));};exports[_0x33a2('0x3f')]=function(_0x6cba58,_0x1d9d20){var _0x23dc5a={'raw':!![],'where':{'id':_0x6cba58[_0x33a2('0x40')]['id']}},_0xdb5828={};_0xdb5828['model']=_[_0x33a2('0x2f')](db['CmContactHasItem'][_0x33a2('0x2c')]);_0xdb5828['query']=_[_0x33a2('0x2f')](_0x6cba58['query']);_0xdb5828['filters']=_['intersection'](_0xdb5828[_0x33a2('0x2d')],_0xdb5828[_0x33a2('0x2e')]);_0x23dc5a[_0x33a2('0x32')]=_[_0x33a2('0x31')](_0xdb5828[_0x33a2('0x2d')],qs[_0x33a2('0x33')](_0x6cba58[_0x33a2('0x2e')][_0x33a2('0x33')]));_0x23dc5a[_0x33a2('0x32')]=_0x23dc5a[_0x33a2('0x32')][_0x33a2('0x34')]?_0x23dc5a[_0x33a2('0x32')]:_0xdb5828['model'];if(_0x6cba58[_0x33a2('0x2e')][_0x33a2('0x41')]){_0x23dc5a[_0x33a2('0x42')]=[{'all':!![]}];}_0x23dc5a=_['merge']({},_0x23dc5a,_0x6cba58['options']);return db[_0x33a2('0x2b')][_0x33a2('0x43')](_0x23dc5a)[_0x33a2('0x22')](handleEntityNotFound(_0x1d9d20,null))[_0x33a2('0x22')](respondWithResult(_0x1d9d20,null))[_0x33a2('0x3e')](handleError(_0x1d9d20,null));};exports[_0x33a2('0x44')]=function(_0x4a097c,_0x42717f){return db['CmContactHasItem'][_0x33a2('0x44')](_0x4a097c[_0x33a2('0x45')],{})['then'](function(_0x58f2fa){var _0x2d7f27=_0x4a097c[_0x33a2('0x46')][_0x33a2('0x24')]({'plain':!![]});if(!_0x2d7f27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d7f27[_0x33a2('0x47')]===_0x33a2('0x46')){var _0x3f51ae=_0x58f2fa[_0x33a2('0x24')]({'plain':!![]});var _0x465ba1=_0x33a2('0x25');return db[_0x33a2('0x48')][_0x33a2('0x43')]({'where':{'name':_0x465ba1,'userProfileId':_0x2d7f27[_0x33a2('0x49')]},'raw':!![]})[_0x33a2('0x22')](function(_0x1b38d3){if(_0x1b38d3&&_0x1b38d3[_0x33a2('0x4a')]===0x0){return db['UserProfileResource'][_0x33a2('0x44')]({'name':_0x3f51ae[_0x33a2('0x27')],'resourceId':_0x3f51ae['id'],'type':_0x1b38d3[_0x33a2('0x27')],'sectionId':_0x1b38d3['id']},{})[_0x33a2('0x22')](function(){return _0x58f2fa;});}else{return _0x58f2fa;}})[_0x33a2('0x3e')](function(_0x301535){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x301535);throw _0x301535;});}return _0x58f2fa;})['then'](respondWithResult(_0x42717f,0xc9))['catch'](handleError(_0x42717f,null));};exports[_0x33a2('0x4b')]=function(_0x34e616,_0x2f56e8){if(_0x34e616[_0x33a2('0x45')]['id']){delete _0x34e616[_0x33a2('0x45')]['id'];}return db[_0x33a2('0x2b')]['find']({'where':{'id':_0x34e616['params']['id']}})['then'](handleEntityNotFound(_0x2f56e8,null))['then'](saveUpdates(_0x34e616['body'],null))[_0x33a2('0x22')](respondWithResult(_0x2f56e8,null))[_0x33a2('0x3e')](handleError(_0x2f56e8,null));};exports[_0x33a2('0x23')]=function(_0xf46bb5,_0x4a3151){return db['CmContactHasItem'][_0x33a2('0x43')]({'where':{'id':_0xf46bb5[_0x33a2('0x40')]['id']}})[_0x33a2('0x22')](handleEntityNotFound(_0x4a3151,null))['then'](removeEntity(_0x4a3151,null))[_0x33a2('0x3e')](handleError(_0x4a3151,null));}; \ No newline at end of file +var _0xa3dd=['where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','stack','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3d1a14,_0x25aa8c){var _0x1117c1=function(_0x1d4860){while(--_0x1d4860){_0x3d1a14['push'](_0x3d1a14['shift']());}};_0x1117c1(++_0x25aa8c);}(_0xa3dd,0x116));var _0xda3d=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0xa3dd[_0x2f54b6];return _0x169f21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda3d('0x0'));var zipdir=require(_0xda3d('0x1'));var jsonpatch=require(_0xda3d('0x2'));var rp=require(_0xda3d('0x3'));var moment=require(_0xda3d('0x4'));var BPromise=require(_0xda3d('0x5'));var Mustache=require(_0xda3d('0x6'));var util=require(_0xda3d('0x7'));var path=require(_0xda3d('0x8'));var sox=require('sox');var csv=require(_0xda3d('0x9'));var ejs=require(_0xda3d('0xa'));var fs=require('fs');var fs_extra=require(_0xda3d('0xb'));var _=require(_0xda3d('0xc'));var squel=require(_0xda3d('0xd'));var crypto=require('crypto');var jsforce=require(_0xda3d('0xe'));var deskjs=require(_0xda3d('0xf'));var toCsv=require(_0xda3d('0x9'));var querystring=require('querystring');var Papa=require(_0xda3d('0x10'));var Redis=require('ioredis');var authService=require(_0xda3d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xda3d('0x12'));var hardwareService=require(_0xda3d('0x13'));var logger=require('../../config/logger')(_0xda3d('0x14'));var utils=require(_0xda3d('0x15'));var config=require(_0xda3d('0x16'));var licenseUtil=require(_0xda3d('0x17'));var db=require(_0xda3d('0x18'))['db'];function respondWithStatusCode(_0x407514,_0x4deb35){_0x4deb35=_0x4deb35||0xcc;return function(_0xbffbca){if(_0xbffbca){return _0x407514[_0xda3d('0x19')](_0x4deb35);}return _0x407514[_0xda3d('0x1a')](_0x4deb35)['end']();};}function respondWithResult(_0x27ec50,_0x158b83){_0x158b83=_0x158b83||0xc8;return function(_0x221cf0){if(_0x221cf0){return _0x27ec50['status'](_0x158b83)['json'](_0x221cf0);}};}function respondWithFilteredResult(_0x546838,_0x46358a){return function(_0x4e9c74){if(_0x4e9c74){var _0x21f577=typeof _0x46358a[_0xda3d('0x1b')]===_0xda3d('0x1c')&&typeof _0x46358a[_0xda3d('0x1d')]===_0xda3d('0x1c');var _0x3b8d20=_0x4e9c74['count'];var _0x55b61f=_0x21f577?0x0:_0x46358a['offset'];var _0xc26058=_0x21f577?_0x4e9c74[_0xda3d('0x1e')]:_0x46358a[_0xda3d('0x1b')]+_0x46358a[_0xda3d('0x1d')];var _0x27e903;if(_0xc26058>=_0x3b8d20){_0xc26058=_0x3b8d20;_0x27e903=0xc8;}else{_0x27e903=0xce;}_0x546838[_0xda3d('0x1a')](_0x27e903);return _0x546838[_0xda3d('0x1f')](_0xda3d('0x20'),_0x55b61f+'-'+_0xc26058+'/'+_0x3b8d20)[_0xda3d('0x21')](_0x4e9c74);}return null;};}function patchUpdates(_0x1cff3d){return function(_0xf58725){try{jsonpatch[_0xda3d('0x22')](_0xf58725,_0x1cff3d,!![]);}catch(_0x5a83f8){return BPromise[_0xda3d('0x23')](_0x5a83f8);}return _0xf58725[_0xda3d('0x24')]();};}function saveUpdates(_0x205d25,_0x39fae1){return function(_0x54ffbd){if(_0x54ffbd){return _0x54ffbd[_0xda3d('0x25')](_0x205d25)[_0xda3d('0x26')](function(_0x162c7d){return _0x162c7d;});}return null;};}function removeEntity(_0x34b10a,_0x3a79bd){return function(_0x3a72e4){if(_0x3a72e4){return _0x3a72e4[_0xda3d('0x27')]()[_0xda3d('0x26')](function(){var _0x2a5663=_0x3a72e4[_0xda3d('0x28')]({'plain':!![]});var _0x4dddd0=_0xda3d('0x29');return db[_0xda3d('0x2a')][_0xda3d('0x27')]({'where':{'type':_0x4dddd0,'resourceId':_0x2a5663['id']}})[_0xda3d('0x26')](function(){return _0x3a72e4;});})[_0xda3d('0x26')](function(){_0x34b10a[_0xda3d('0x1a')](0xcc)[_0xda3d('0x2b')]();});}};}function handleEntityNotFound(_0x101fb3,_0x53b3a7){return function(_0x5bc504){if(!_0x5bc504){_0x101fb3[_0xda3d('0x19')](0x194);}return _0x5bc504;};}function handleError(_0xb4c982,_0x31684b){_0x31684b=_0x31684b||0x1f4;return function(_0x2aead2){logger[_0xda3d('0x2c')](_0x2aead2[_0xda3d('0x2d')]);if(_0x2aead2['name']){delete _0x2aead2['name'];}_0xb4c982[_0xda3d('0x1a')](_0x31684b)[_0xda3d('0x2e')](_0x2aead2);};}exports[_0xda3d('0x2f')]=function(_0x52f418,_0x1e2a38){var _0x25fe97={},_0x2f2998={},_0x2ef1e4={'count':0x0,'rows':[]};var _0x42d82a=_[_0xda3d('0x30')](db[_0xda3d('0x31')][_0xda3d('0x32')],function(_0x3a7981){return{'name':_0x3a7981[_0xda3d('0x33')],'type':_0x3a7981[_0xda3d('0x34')]['key']};});_0x2f2998[_0xda3d('0x35')]=_[_0xda3d('0x30')](_0x42d82a,_0xda3d('0x36'));_0x2f2998[_0xda3d('0x37')]=_[_0xda3d('0x38')](_0x52f418[_0xda3d('0x37')]);_0x2f2998[_0xda3d('0x39')]=_[_0xda3d('0x3a')](_0x2f2998[_0xda3d('0x35')],_0x2f2998[_0xda3d('0x37')]);_0x25fe97['attributes']=_[_0xda3d('0x3a')](_0x2f2998['model'],qs[_0xda3d('0x3b')](_0x52f418[_0xda3d('0x37')][_0xda3d('0x3b')]));_0x25fe97[_0xda3d('0x3c')]=_0x25fe97[_0xda3d('0x3c')][_0xda3d('0x3d')]?_0x25fe97[_0xda3d('0x3c')]:_0x2f2998[_0xda3d('0x35')];if(!_0x52f418['query'][_0xda3d('0x3e')](_0xda3d('0x3f'))){_0x25fe97['limit']=qs[_0xda3d('0x1d')](_0x52f418[_0xda3d('0x37')][_0xda3d('0x1d')]);_0x25fe97[_0xda3d('0x1b')]=qs[_0xda3d('0x1b')](_0x52f418[_0xda3d('0x37')][_0xda3d('0x1b')]);}_0x25fe97[_0xda3d('0x40')]=qs['sort'](_0x52f418[_0xda3d('0x37')][_0xda3d('0x41')]);_0x25fe97[_0xda3d('0x42')]=qs['filters'](_[_0xda3d('0x43')](_0x52f418[_0xda3d('0x37')],_0x2f2998[_0xda3d('0x39')]),_0x42d82a);if(_0x52f418[_0xda3d('0x37')]['filter']){_0x25fe97['where']=_[_0xda3d('0x44')](_0x25fe97[_0xda3d('0x42')],{'$or':_['map'](_0x42d82a,function(_0x2dd1f8){if(_0x2dd1f8[_0xda3d('0x34')]!==_0xda3d('0x45')){var _0x43502c={};_0x43502c[_0x2dd1f8['name']]={'$like':'%'+_0x52f418[_0xda3d('0x37')][_0xda3d('0x46')]+'%'};return _0x43502c;}})});}_0x25fe97=_['merge']({},_0x25fe97,_0x52f418[_0xda3d('0x47')]);var _0x111ddf={'where':_0x25fe97[_0xda3d('0x42')]};return db['CmContactHasItem']['count'](_0x111ddf)[_0xda3d('0x26')](function(_0x2d8c85){_0x2ef1e4[_0xda3d('0x1e')]=_0x2d8c85;if(_0x52f418[_0xda3d('0x37')][_0xda3d('0x48')]){_0x25fe97[_0xda3d('0x49')]=[{'all':!![]}];}return db[_0xda3d('0x31')]['findAll'](_0x25fe97);})[_0xda3d('0x26')](function(_0x4eef1c){_0x2ef1e4[_0xda3d('0x4a')]=_0x4eef1c;return _0x2ef1e4;})['then'](respondWithFilteredResult(_0x1e2a38,_0x25fe97))[_0xda3d('0x4b')](handleError(_0x1e2a38,null));};exports[_0xda3d('0x4c')]=function(_0x118852,_0x220f75){var _0x4a61e8={'raw':!![],'where':{'id':_0x118852[_0xda3d('0x4d')]['id']}},_0x5b68a6={};_0x5b68a6['model']=_[_0xda3d('0x38')](db[_0xda3d('0x31')][_0xda3d('0x32')]);_0x5b68a6['query']=_[_0xda3d('0x38')](_0x118852[_0xda3d('0x37')]);_0x5b68a6[_0xda3d('0x39')]=_['intersection'](_0x5b68a6[_0xda3d('0x35')],_0x5b68a6[_0xda3d('0x37')]);_0x4a61e8['attributes']=_['intersection'](_0x5b68a6[_0xda3d('0x35')],qs['fields'](_0x118852[_0xda3d('0x37')][_0xda3d('0x3b')]));_0x4a61e8[_0xda3d('0x3c')]=_0x4a61e8[_0xda3d('0x3c')][_0xda3d('0x3d')]?_0x4a61e8['attributes']:_0x5b68a6['model'];if(_0x118852[_0xda3d('0x37')][_0xda3d('0x48')]){_0x4a61e8[_0xda3d('0x49')]=[{'all':!![]}];}_0x4a61e8=_[_0xda3d('0x44')]({},_0x4a61e8,_0x118852['options']);return db[_0xda3d('0x31')][_0xda3d('0x4e')](_0x4a61e8)[_0xda3d('0x26')](handleEntityNotFound(_0x220f75,null))[_0xda3d('0x26')](respondWithResult(_0x220f75,null))['catch'](handleError(_0x220f75,null));};exports[_0xda3d('0x4f')]=function(_0x2e1eb4,_0x3c9f21){return db[_0xda3d('0x31')][_0xda3d('0x4f')](_0x2e1eb4[_0xda3d('0x50')],{})[_0xda3d('0x26')](function(_0x5c1edb){var _0x2bd3ea=_0x2e1eb4[_0xda3d('0x51')]['get']({'plain':!![]});if(!_0x2bd3ea)throw new Error(_0xda3d('0x52'));if(_0x2bd3ea[_0xda3d('0x53')]===_0xda3d('0x51')){var _0xeb9da8=_0x5c1edb[_0xda3d('0x28')]({'plain':!![]});var _0x5486f1=_0xda3d('0x29');return db['UserProfileSection'][_0xda3d('0x4e')]({'where':{'name':_0x5486f1,'userProfileId':_0x2bd3ea['userProfileId']},'raw':!![]})[_0xda3d('0x26')](function(_0x2a8ef0){if(_0x2a8ef0&&_0x2a8ef0[_0xda3d('0x54')]===0x0){return db['UserProfileResource'][_0xda3d('0x4f')]({'name':_0xeb9da8['name'],'resourceId':_0xeb9da8['id'],'type':_0x2a8ef0[_0xda3d('0x36')],'sectionId':_0x2a8ef0['id']},{})[_0xda3d('0x26')](function(){return _0x5c1edb;});}else{return _0x5c1edb;}})[_0xda3d('0x4b')](function(_0x32c03d){logger['error'](_0xda3d('0x55'),_0x32c03d);throw _0x32c03d;});}return _0x5c1edb;})['then'](respondWithResult(_0x3c9f21,0xc9))[_0xda3d('0x4b')](handleError(_0x3c9f21,null));};exports[_0xda3d('0x25')]=function(_0x5c1bf2,_0x2942b5){if(_0x5c1bf2['body']['id']){delete _0x5c1bf2[_0xda3d('0x50')]['id'];}return db[_0xda3d('0x31')][_0xda3d('0x4e')]({'where':{'id':_0x5c1bf2['params']['id']}})[_0xda3d('0x26')](handleEntityNotFound(_0x2942b5,null))[_0xda3d('0x26')](saveUpdates(_0x5c1bf2[_0xda3d('0x50')],null))[_0xda3d('0x26')](respondWithResult(_0x2942b5,null))[_0xda3d('0x4b')](handleError(_0x2942b5,null));};exports[_0xda3d('0x27')]=function(_0x41a5e5,_0x78b090){return db[_0xda3d('0x31')][_0xda3d('0x4e')]({'where':{'id':_0x41a5e5[_0xda3d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x78b090,null))[_0xda3d('0x26')](removeEntity(_0x78b090,null))[_0xda3d('0x4b')](handleError(_0x78b090,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index f09ab65..126a119 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 _0x9b6a=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x286243,_0x1118af){var _0x4c5212=function(_0x1c99a6){while(--_0x1c99a6){_0x286243['push'](_0x286243['shift']());}};_0x4c5212(++_0x1118af);}(_0x9b6a,0x10d));var _0xa9b6=function(_0x519ee1,_0x3aab5c){_0x519ee1=_0x519ee1-0x0;var _0x101c5a=_0x9b6a[_0x519ee1];return _0x101c5a;};'use strict';var _=require(_0xa9b6('0x0'));var util=require(_0xa9b6('0x1'));var logger=require('../../config/logger')(_0xa9b6('0x2'));var moment=require(_0xa9b6('0x3'));var BPromise=require(_0xa9b6('0x4'));var rp=require(_0xa9b6('0x5'));var fs=require('fs');var path=require(_0xa9b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9b6('0x7'));module[_0xa9b6('0x8')]=function(_0x49b2f6,_0xe1a0f0){return _0x49b2f6[_0xa9b6('0x9')](_0xa9b6('0xa'),attributes,{'tableName':_0xa9b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3984=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','CmContactHasItem','lodash'];(function(_0x2b8c78,_0x177a37){var _0x3c6158=function(_0x4b0d63){while(--_0x4b0d63){_0x2b8c78['push'](_0x2b8c78['shift']());}};_0x3c6158(++_0x177a37);}(_0x3984,0xb3));var _0x4398=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x3984[_0x3a8dc1];return _0x4b3595;};'use strict';var _=require(_0x4398('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4398('0x1'));var moment=require(_0x4398('0x2'));var BPromise=require(_0x4398('0x3'));var rp=require(_0x4398('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4398('0x5'));var config=require(_0x4398('0x6'));var attributes=require(_0x4398('0x7'));module['exports']=function(_0x285f3f,_0x540502){return _0x285f3f['define'](_0x4398('0x8'),attributes,{'tableName':'cm_contact_has_items','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 7838e1a..d2d5bb6 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 _0x9e3d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1e0ff0,_0xa596fd){var _0x1a9571=function(_0x455d5f){while(--_0x455d5f){_0x1e0ff0['push'](_0x1e0ff0['shift']());}};_0x1a9571(++_0xa596fd);}(_0x9e3d,0x16b));var _0xd9e3=function(_0x5699ab,_0x2748c9){_0x5699ab=_0x5699ab-0x0;var _0x41ee55=_0x9e3d[_0x5699ab];return _0x41ee55;};'use strict';var _=require(_0xd9e3('0x0'));var util=require(_0xd9e3('0x1'));var moment=require('moment');var BPromise=require(_0xd9e3('0x2'));var rs=require(_0xd9e3('0x3'));var fs=require('fs');var Redis=require(_0xd9e3('0x4'));var db=require(_0xd9e3('0x5'))['db'];var utils=require(_0xd9e3('0x6'));var logger=require(_0xd9e3('0x7'))(_0xd9e3('0x8'));var config=require(_0xd9e3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9e3('0xa')][_0xd9e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ca640,_0x2245f6,_0x4118fd){return new BPromise(function(_0x55652c,_0x115189){return client[_0xd9e3('0xc')](_0x4ca640,_0x4118fd)[_0xd9e3('0xd')](function(_0xf535c3){logger[_0xd9e3('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x2245f6,_0xd9e3('0xf'));logger[_0xd9e3('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x2245f6,_0xd9e3('0xf'),JSON['stringify'](_0xf535c3));if(_0xf535c3[_0xd9e3('0x11')]){if(_0xf535c3[_0xd9e3('0x11')][_0xd9e3('0x12')]===0x1f4){logger[_0xd9e3('0x11')](_0xd9e3('0x13'),_0x2245f6,_0xf535c3[_0xd9e3('0x11')]['message']);return _0x115189(_0xf535c3[_0xd9e3('0x11')][_0xd9e3('0x14')]);}logger['error'](_0xd9e3('0x13'),_0x2245f6,_0xf535c3[_0xd9e3('0x11')]['message']);return _0x55652c(_0xf535c3[_0xd9e3('0x11')][_0xd9e3('0x14')]);}else{logger[_0xd9e3('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x2245f6,_0xd9e3('0xf'));_0x55652c(_0xf535c3[_0xd9e3('0x15')]['message']);}})[_0xd9e3('0x16')](function(_0x1b6d13){logger['error'](_0xd9e3('0x13'),_0x2245f6,_0x1b6d13);_0x115189(_0x1b6d13);});});} \ No newline at end of file +var _0x5bf8=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','lodash','util'];(function(_0x455284,_0x383648){var _0x3e70dc=function(_0x5297cf){while(--_0x5297cf){_0x455284['push'](_0x455284['shift']());}};_0x3e70dc(++_0x383648);}(_0x5bf8,0x17a));var _0x85bf=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x5bf8[_0x4991d6];return _0x50faf7;};'use strict';var _=require(_0x85bf('0x0'));var util=require(_0x85bf('0x1'));var moment=require('moment');var BPromise=require(_0x85bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85bf('0x3'));var db=require(_0x85bf('0x4'))['db'];var utils=require(_0x85bf('0x5'));var logger=require('../../config/logger')(_0x85bf('0x6'));var config=require(_0x85bf('0x7'));var jayson=require(_0x85bf('0x8'));var client=jayson[_0x85bf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x497aed,_0x5a85aa,_0xc28413){return new BPromise(function(_0x3f6ee6,_0x516c08){return client[_0x85bf('0xa')](_0x497aed,_0xc28413)['then'](function(_0x8ba89d){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x5a85aa,_0x85bf('0xb'));logger[_0x85bf('0xc')](_0x85bf('0xd'),_0x5a85aa,_0x85bf('0xb'),JSON[_0x85bf('0xe')](_0x8ba89d));if(_0x8ba89d[_0x85bf('0xf')]){if(_0x8ba89d[_0x85bf('0xf')][_0x85bf('0x10')]===0x1f4){logger[_0x85bf('0xf')](_0x85bf('0x11'),_0x5a85aa,_0x8ba89d[_0x85bf('0xf')][_0x85bf('0x12')]);return _0x516c08(_0x8ba89d[_0x85bf('0xf')][_0x85bf('0x12')]);}logger[_0x85bf('0xf')](_0x85bf('0x11'),_0x5a85aa,_0x8ba89d[_0x85bf('0xf')][_0x85bf('0x12')]);return _0x3f6ee6(_0x8ba89d['error'][_0x85bf('0x12')]);}else{logger[_0x85bf('0x13')](_0x85bf('0x11'),_0x5a85aa,_0x85bf('0xb'));_0x3f6ee6(_0x8ba89d['result']['message']);}})['catch'](function(_0x14edf9){logger[_0x85bf('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x5a85aa,_0x14edf9);_0x516c08(_0x14edf9);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4218397..4ffcc4e 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 _0xd6de=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x38ee7c,_0x2df4be){var _0x52706a=function(_0x9c9cf0){while(--_0x9c9cf0){_0x38ee7c['push'](_0x38ee7c['shift']());}};_0x52706a(++_0x2df4be);}(_0xd6de,0x14a));var _0xed6d=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xd6de[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require(_0xed6d('0x0'));var util=require(_0xed6d('0x1'));var path=require(_0xed6d('0x2'));var timeout=require(_0xed6d('0x3'));var express=require(_0xed6d('0x4'));var router=express[_0xed6d('0x5')]();var fs_extra=require(_0xed6d('0x6'));var auth=require(_0xed6d('0x7'));var interaction=require(_0xed6d('0x8'));var config=require(_0xed6d('0x9'));var controller=require('./cmContactHasItem.controller');router[_0xed6d('0xa')]('/',auth[_0xed6d('0xb')](),controller[_0xed6d('0xc')]);router[_0xed6d('0xa')](_0xed6d('0xd'),auth['isAuthenticated'](),controller[_0xed6d('0xe')]);router[_0xed6d('0xf')]('/',auth['isAuthenticated'](),controller[_0xed6d('0x10')]);router['put'](_0xed6d('0xd'),auth[_0xed6d('0xb')](),controller[_0xed6d('0x11')]);router[_0xed6d('0x12')](_0xed6d('0xd'),auth[_0xed6d('0xb')](),controller[_0xed6d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc482=['show','post','isAuthenticated','put','update','exports','multer','util','path','express','fs-extra','../../config/environment','./cmContactHasItem.controller','get','index','/:id'];(function(_0x3dbf82,_0x80e2a4){var _0x514652=function(_0x70cd61){while(--_0x70cd61){_0x3dbf82['push'](_0x3dbf82['shift']());}};_0x514652(++_0x80e2a4);}(_0xc482,0x96));var _0x2c48=function(_0x40d59b,_0x2efc7b){_0x40d59b=_0x40d59b-0x0;var _0x1f66dc=_0xc482[_0x40d59b];return _0x1f66dc;};'use strict';var multer=require(_0x2c48('0x0'));var util=require(_0x2c48('0x1'));var path=require(_0x2c48('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c48('0x3'));var router=express['Router']();var fs_extra=require(_0x2c48('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c48('0x5'));var controller=require(_0x2c48('0x6'));router[_0x2c48('0x7')]('/',auth['isAuthenticated'](),controller[_0x2c48('0x8')]);router['get'](_0x2c48('0x9'),auth['isAuthenticated'](),controller[_0x2c48('0xa')]);router[_0x2c48('0xb')]('/',auth[_0x2c48('0xc')](),controller['create']);router[_0x2c48('0xd')](_0x2c48('0x9'),auth[_0x2c48('0xc')](),controller[_0x2c48('0xe')]);router['delete'](_0x2c48('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2c48('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3932bb8..646936c 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 _0xa211=['voice','lodash','exports','VIRTUAL','alias','setDataValue','getDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM'];(function(_0x430129,_0x5946c8){var _0x3aa221=function(_0x40b73a){while(--_0x40b73a){_0x430129['push'](_0x430129['shift']());}};_0x3aa221(++_0x5946c8);}(_0xa211,0x19f));var _0x1a21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa211[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1a21('0x0'));module[_0x1a21('0x1')]={'name':{'type':Sequelize[_0x1a21('0x2')],'get':function(_0x1b40b5){return this['getDataValue'](_0x1a21('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xd177d4){this[_0x1a21('0x4')](_0x1a21('0x3'),_0xd177d4?_0xd177d4:this[_0x1a21('0x5')](_0x1a21('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x1a21('0x7')](_0x1a21('0x8')),'get':function(){if(this[_0x1a21('0x5')](_0x1a21('0x9'))===_0x1a21('0xa')){return JSON[_0x1a21('0xb')](this[_0x1a21('0x5')](_0x1a21('0xc')));}else{return this[_0x1a21('0x5')](_0x1a21('0xc'));}},'set':function(_0xbf42d4){if(Array[_0x1a21('0xd')](_0xbf42d4)){this[_0x1a21('0x4')](_0x1a21('0xc'),JSON[_0x1a21('0xe')](_0xbf42d4));}else{this[_0x1a21('0x4')]('values',_0xbf42d4);}}},'required':{'type':Sequelize[_0x1a21('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1a21('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1a21('0x10')](_0x1a21('0x11'))}}; \ No newline at end of file +var _0xd7d5=['alias','setDataValue','name','STRING','long','getDataValue','isArray','stringify','values','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL'];(function(_0xcc0273,_0x5b67c5){var _0x3bc2b3=function(_0x75a416){while(--_0x75a416){_0xcc0273['push'](_0xcc0273['shift']());}};_0x3bc2b3(++_0x5b67c5);}(_0xd7d5,0xcf));var _0x5d7d=function(_0x427cfc,_0x2f0925){_0x427cfc=_0x427cfc-0x0;var _0x4f2425=_0xd7d5[_0x427cfc];return _0x4f2425;};'use strict';var Sequelize=require(_0x5d7d('0x0'));var _=require(_0x5d7d('0x1'));module['exports']={'name':{'type':Sequelize[_0x5d7d('0x2')],'get':function(_0x175d17){return this['getDataValue'](_0x5d7d('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x272c25){this[_0x5d7d('0x4')]('alias',_0x272c25?_0x272c25:this['getDataValue'](_0x5d7d('0x5')));}},'type':{'type':Sequelize[_0x5d7d('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x5d7d('0x7')),'get':function(){if(this[_0x5d7d('0x8')]('type')==='select'){return JSON['parse'](this[_0x5d7d('0x8')]('values'));}else{return this[_0x5d7d('0x8')]('values');}},'set':function(_0x212fcf){if(Array[_0x5d7d('0x9')](_0x212fcf)){this['setDataValue']('values',JSON[_0x5d7d('0xa')](_0x212fcf));}else{this[_0x5d7d('0x4')](_0x5d7d('0xb'),_0x212fcf);}}},'required':{'type':Sequelize[_0x5d7d('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5d7d('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5d7d('0xd')](_0x5d7d('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 65fb635..5e37c2a 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 _0x559c=['cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','length','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn'];(function(_0x117968,_0x25b1e2){var _0x39f3b2=function(_0x2ad8f4){while(--_0x2ad8f4){_0x117968['push'](_0x117968['shift']());}};_0x39f3b2(++_0x25b1e2);}(_0x559c,0x166));var _0xc559=function(_0x2a75cd,_0x247962){_0x2a75cd=_0x2a75cd-0x0;var _0x2319bc=_0x559c[_0x2a75cd];return _0x2319bc;};'use strict';var emlformat=require(_0xc559('0x0'));var rimraf=require(_0xc559('0x1'));var zipdir=require(_0xc559('0x2'));var jsonpatch=require(_0xc559('0x3'));var rp=require(_0xc559('0x4'));var moment=require(_0xc559('0x5'));var BPromise=require(_0xc559('0x6'));var Mustache=require(_0xc559('0x7'));var util=require(_0xc559('0x8'));var path=require('path');var sox=require(_0xc559('0x9'));var csv=require(_0xc559('0xa'));var ejs=require(_0xc559('0xb'));var fs=require('fs');var fs_extra=require(_0xc559('0xc'));var _=require('lodash');var squel=require(_0xc559('0xd'));var crypto=require(_0xc559('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc559('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc559('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc559('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc559('0x12'));var hardwareService=require(_0xc559('0x13'));var logger=require(_0xc559('0x14'))(_0xc559('0x15'));var utils=require(_0xc559('0x16'));var config=require(_0xc559('0x17'));var licenseUtil=require(_0xc559('0x18'));var db=require(_0xc559('0x19'))['db'];function respondWithStatusCode(_0x3e31bb,_0x5efb3a){_0x5efb3a=_0x5efb3a||0xcc;return function(_0x411e10){if(_0x411e10){return _0x3e31bb['sendStatus'](_0x5efb3a);}return _0x3e31bb[_0xc559('0x1a')](_0x5efb3a)[_0xc559('0x1b')]();};}function respondWithResult(_0x280932,_0x4985bf){_0x4985bf=_0x4985bf||0xc8;return function(_0x413d92){if(_0x413d92){return _0x280932[_0xc559('0x1a')](_0x4985bf)[_0xc559('0x1c')](_0x413d92);}};}function respondWithFilteredResult(_0x50c5a0,_0x49b9a6){return function(_0x388105){if(_0x388105){var _0xc8b6c5=typeof _0x49b9a6[_0xc559('0x1d')]===_0xc559('0x1e')&&typeof _0x49b9a6[_0xc559('0x1f')]===_0xc559('0x1e');var _0x1085bb=_0x388105[_0xc559('0x20')];var _0xa8a499=_0xc8b6c5?0x0:_0x49b9a6['offset'];var _0x532cdd=_0xc8b6c5?_0x388105[_0xc559('0x20')]:_0x49b9a6[_0xc559('0x1d')]+_0x49b9a6[_0xc559('0x1f')];var _0x3d9252;if(_0x532cdd>=_0x1085bb){_0x532cdd=_0x1085bb;_0x3d9252=0xc8;}else{_0x3d9252=0xce;}_0x50c5a0[_0xc559('0x1a')](_0x3d9252);return _0x50c5a0[_0xc559('0x21')](_0xc559('0x22'),_0xa8a499+'-'+_0x532cdd+'/'+_0x1085bb)[_0xc559('0x1c')](_0x388105);}return null;};}function patchUpdates(_0x2afea5){return function(_0x3dcfdd){try{jsonpatch['apply'](_0x3dcfdd,_0x2afea5,!![]);}catch(_0x2588a0){return BPromise[_0xc559('0x23')](_0x2588a0);}return _0x3dcfdd['save']();};}function saveUpdates(_0x6f9358,_0x1c8128){return function(_0x46bb0a){if(_0x46bb0a){return _0x46bb0a[_0xc559('0x24')](_0x6f9358)[_0xc559('0x25')](function(_0x347580){return _0x347580;});}return null;};}function removeEntity(_0x3217b7,_0x384078){return function(_0x363c42){if(_0x363c42){return _0x363c42[_0xc559('0x26')]()[_0xc559('0x25')](function(){_0x3217b7[_0xc559('0x1a')](0xcc)[_0xc559('0x1b')]();});}};}function handleEntityNotFound(_0x3d60a8,_0x48dec5){return function(_0x447328){if(!_0x447328){_0x3d60a8[_0xc559('0x27')](0x194);}return _0x447328;};}function handleError(_0x49f120,_0x20dcc1){_0x20dcc1=_0x20dcc1||0x1f4;return function(_0x3e7fe7){logger[_0xc559('0x28')](_0x3e7fe7['stack']);if(_0x3e7fe7['name']){delete _0x3e7fe7[_0xc559('0x29')];}_0x49f120['status'](_0x20dcc1)[_0xc559('0x2a')](_0x3e7fe7);};}exports[_0xc559('0x2b')]=function(_0x4ae753,_0x144597){var _0x1d4c02={},_0x4048db={},_0x56ccd9={'count':0x0,'rows':[]};var _0x519077=_[_0xc559('0x2c')](db[_0xc559('0x2d')][_0xc559('0x2e')],function(_0x43b23c){return{'name':_0x43b23c[_0xc559('0x2f')],'type':_0x43b23c[_0xc559('0x30')][_0xc559('0x31')]};});_0x4048db[_0xc559('0x32')]=_[_0xc559('0x33')](_[_0xc559('0x2c')](_0x519077,_0xc559('0x29')),['name']);_0x4048db[_0xc559('0x34')]=_[_0xc559('0x35')](_0x4ae753[_0xc559('0x34')]);_0x4048db[_0xc559('0x36')]=_[_0xc559('0x37')](_0x4048db['model'],_0x4048db[_0xc559('0x34')]);_0x1d4c02['attributes']=_[_0xc559('0x37')](_0x4048db[_0xc559('0x32')],qs[_0xc559('0x38')](_0x4ae753[_0xc559('0x34')][_0xc559('0x38')]));_0x1d4c02[_0xc559('0x39')]=_0x1d4c02[_0xc559('0x39')]['length']?_0x1d4c02[_0xc559('0x39')]:_0x4048db[_0xc559('0x32')];if(!_0x4ae753[_0xc559('0x34')]['hasOwnProperty'](_0xc559('0x3a'))){_0x1d4c02[_0xc559('0x1f')]=qs[_0xc559('0x1f')](_0x4ae753[_0xc559('0x34')]['limit']);_0x1d4c02[_0xc559('0x1d')]=qs[_0xc559('0x1d')](_0x4ae753[_0xc559('0x34')][_0xc559('0x1d')]);}_0x1d4c02[_0xc559('0x3b')]=qs[_0xc559('0x3c')](_0x4ae753['query'][_0xc559('0x3c')]);_0x1d4c02[_0xc559('0x3d')]=qs[_0xc559('0x36')](_[_0xc559('0x3e')](_0x4ae753[_0xc559('0x34')],_0x4048db['filters']),_0x519077);if(_0x4ae753[_0xc559('0x34')]['filter']){_0x1d4c02[_0xc559('0x3d')]=_[_0xc559('0x3f')](_0x1d4c02[_0xc559('0x3d')],{'$or':_[_0xc559('0x2c')](_0x519077,function(_0x323b49){if(_0x323b49['type']!==_0xc559('0x40')){var _0x171aa2={};_0x171aa2[_0x323b49[_0xc559('0x29')]]={'$like':'%'+_0x4ae753['query'][_0xc559('0x41')]+'%'};return _0x171aa2;}})});}_0x1d4c02=_['merge']({},_0x1d4c02,_0x4ae753[_0xc559('0x42')]);var _0x3f4ca4={'where':_0x1d4c02[_0xc559('0x3d')]};return db[_0xc559('0x2d')][_0xc559('0x20')](_0x3f4ca4)[_0xc559('0x25')](function(_0x15831b){_0x56ccd9[_0xc559('0x20')]=_0x15831b;if(_0x4ae753[_0xc559('0x34')][_0xc559('0x43')]){_0x1d4c02[_0xc559('0x44')]=[{'all':!![]}];}return db[_0xc559('0x2d')]['findAll'](_0x1d4c02);})['then'](function(_0x624911){_0x56ccd9[_0xc559('0x45')]=_0x624911;return _0x56ccd9;})[_0xc559('0x25')](respondWithFilteredResult(_0x144597,_0x1d4c02))[_0xc559('0x46')](handleError(_0x144597,null));};exports['show']=function(_0x465a16,_0x49a9c4){var _0x49a443={'raw':!![],'where':{'id':_0x465a16[_0xc559('0x47')]['id']}},_0x469d8={};_0x469d8[_0xc559('0x32')]=_['keys'](db[_0xc559('0x2d')]['rawAttributes']);_0x469d8[_0xc559('0x34')]=_[_0xc559('0x35')](_0x465a16[_0xc559('0x34')]);_0x469d8[_0xc559('0x36')]=_['intersection'](_0x469d8[_0xc559('0x32')],_0x469d8[_0xc559('0x34')]);_0x49a443['attributes']=_[_0xc559('0x37')](_0x469d8[_0xc559('0x32')],qs[_0xc559('0x38')](_0x465a16[_0xc559('0x34')][_0xc559('0x38')]));_0x49a443[_0xc559('0x39')]=_0x49a443[_0xc559('0x39')][_0xc559('0x48')]?_0x49a443[_0xc559('0x39')]:_0x469d8['model'];if(_0x465a16[_0xc559('0x34')][_0xc559('0x43')]){_0x49a443['include']=[{'all':!![]}];}_0x49a443=_[_0xc559('0x3f')]({},_0x49a443,_0x465a16[_0xc559('0x42')]);return db[_0xc559('0x2d')][_0xc559('0x49')](_0x49a443)[_0xc559('0x25')](handleEntityNotFound(_0x49a9c4,null))[_0xc559('0x25')](respondWithResult(_0x49a9c4,null))[_0xc559('0x46')](handleError(_0x49a9c4,null));};exports[_0xc559('0x24')]=function(_0x3265ef,_0x168eb2){if(_0x3265ef[_0xc559('0x4a')]['id']){delete _0x3265ef[_0xc559('0x4a')]['id'];}return db['CmCustomField'][_0xc559('0x49')]({'where':{'id':_0x3265ef[_0xc559('0x47')]['id']}})[_0xc559('0x25')](handleEntityNotFound(_0x168eb2,null))[_0xc559('0x25')](saveUpdates(_0x3265ef[_0xc559('0x4a')],null))[_0xc559('0x25')](respondWithResult(_0x168eb2,null))[_0xc559('0x46')](handleError(_0x168eb2,null));};exports[_0xc559('0x26')]=function(_0x6d4987,_0x42ee63){return db[_0xc559('0x2d')]['find']({'where':{'id':_0x6d4987[_0xc559('0x47')]['id']}})[_0xc559('0x25')](handleEntityNotFound(_0x42ee63,null))[_0xc559('0x25')](removeEntity(_0x42ee63,null))[_0xc559('0x46')](handleError(_0x42ee63,null));};exports[_0xc559('0x4b')]=function(_0x1b8119,_0x5dc59f){var _0x136052;return db[_0xc559('0x4c')][_0xc559('0x4d')](function(_0x54ff8b){return db['CmCustomField'][_0xc559('0x4b')](_0x1b8119[_0xc559('0x4a')],{'transaction':_0x54ff8b})[_0xc559('0x25')](function(_0x4813e7){_0x136052=_0x4813e7;var _0x41b725={'type':db[_0xc559('0x4e')][_0xc559('0x4f')],'transaction':_0x54ff8b};switch(_0x1b8119[_0xc559('0x4a')]['type']){case _0xc559('0x50'):_0x41b725[_0xc559('0x30')]=db['Sequelize']['TEXT'];break;case _0xc559('0x51'):_0x41b725['type']=db[_0xc559('0x4e')][_0xc559('0x52')];break;case'switch':_0x41b725['type']=db[_0xc559('0x4e')][_0xc559('0x53')];_0x41b725[_0xc559('0x54')]=![];break;default:}return db[_0xc559('0x4c')][_0xc559('0x55')][_0xc559('0x56')](_0xc559('0x57'),util['format'](_0xc559('0x58'),_0x136052['id']),_0x41b725);})['then'](function(){return _0x136052;});})[_0xc559('0x25')](respondWithResult(_0x5dc59f,0xc9))['catch'](handleError(_0x5dc59f,null));}; \ No newline at end of file +var _0xa370=['show','params','include','find','catch','body','sequelize','transaction','create','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','index','map','CmCustomField','rawAttributes','model','differenceBy','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x2587f8,_0x93567a){var _0x282571=function(_0x2bae50){while(--_0x2bae50){_0x2587f8['push'](_0x2587f8['shift']());}};_0x282571(++_0x93567a);}(_0xa370,0x172));var _0x0a37=function(_0x15d59a,_0x4b13c2){_0x15d59a=_0x15d59a-0x0;var _0x575cd5=_0xa370[_0x15d59a];return _0x575cd5;};'use strict';var emlformat=require(_0x0a37('0x0'));var rimraf=require(_0x0a37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a37('0x2'));var rp=require(_0x0a37('0x3'));var moment=require(_0x0a37('0x4'));var BPromise=require(_0x0a37('0x5'));var Mustache=require(_0x0a37('0x6'));var util=require('util');var path=require(_0x0a37('0x7'));var sox=require(_0x0a37('0x8'));var csv=require('to-csv');var ejs=require(_0x0a37('0x9'));var fs=require('fs');var fs_extra=require(_0x0a37('0xa'));var _=require(_0x0a37('0xb'));var squel=require(_0x0a37('0xc'));var crypto=require(_0x0a37('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a37('0xe'));var toCsv=require(_0x0a37('0xf'));var querystring=require(_0x0a37('0x10'));var Papa=require(_0x0a37('0x11'));var Redis=require(_0x0a37('0x12'));var authService=require(_0x0a37('0x13'));var qs=require(_0x0a37('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a37('0x15'));var logger=require(_0x0a37('0x16'))(_0x0a37('0x17'));var utils=require(_0x0a37('0x18'));var config=require(_0x0a37('0x19'));var licenseUtil=require(_0x0a37('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x131f2b,_0x44c978){_0x44c978=_0x44c978||0xcc;return function(_0x2cf95d){if(_0x2cf95d){return _0x131f2b['sendStatus'](_0x44c978);}return _0x131f2b['status'](_0x44c978)['end']();};}function respondWithResult(_0x49419a,_0xe2f38f){_0xe2f38f=_0xe2f38f||0xc8;return function(_0x14c6df){if(_0x14c6df){return _0x49419a[_0x0a37('0x1b')](_0xe2f38f)[_0x0a37('0x1c')](_0x14c6df);}};}function respondWithFilteredResult(_0x3af45e,_0x4cfbb5){return function(_0x9390dd){if(_0x9390dd){var _0x4ac71a=typeof _0x4cfbb5[_0x0a37('0x1d')]==='undefined'&&typeof _0x4cfbb5[_0x0a37('0x1e')]===_0x0a37('0x1f');var _0x5cff0a=_0x9390dd['count'];var _0x41fa3d=_0x4ac71a?0x0:_0x4cfbb5['offset'];var _0x2e4e69=_0x4ac71a?_0x9390dd[_0x0a37('0x20')]:_0x4cfbb5[_0x0a37('0x1d')]+_0x4cfbb5[_0x0a37('0x1e')];var _0x453753;if(_0x2e4e69>=_0x5cff0a){_0x2e4e69=_0x5cff0a;_0x453753=0xc8;}else{_0x453753=0xce;}_0x3af45e[_0x0a37('0x1b')](_0x453753);return _0x3af45e[_0x0a37('0x21')](_0x0a37('0x22'),_0x41fa3d+'-'+_0x2e4e69+'/'+_0x5cff0a)[_0x0a37('0x1c')](_0x9390dd);}return null;};}function patchUpdates(_0x38f79f){return function(_0xcfa166){try{jsonpatch[_0x0a37('0x23')](_0xcfa166,_0x38f79f,!![]);}catch(_0x2e334b){return BPromise[_0x0a37('0x24')](_0x2e334b);}return _0xcfa166[_0x0a37('0x25')]();};}function saveUpdates(_0x153802,_0x5195e7){return function(_0x4600be){if(_0x4600be){return _0x4600be[_0x0a37('0x26')](_0x153802)[_0x0a37('0x27')](function(_0x55fa4e){return _0x55fa4e;});}return null;};}function removeEntity(_0x5c1468,_0x4056a1){return function(_0x45e4bc){if(_0x45e4bc){return _0x45e4bc[_0x0a37('0x28')]()[_0x0a37('0x27')](function(){_0x5c1468[_0x0a37('0x1b')](0xcc)[_0x0a37('0x29')]();});}};}function handleEntityNotFound(_0x337a0e,_0x41f697){return function(_0x1ce122){if(!_0x1ce122){_0x337a0e[_0x0a37('0x2a')](0x194);}return _0x1ce122;};}function handleError(_0x3b7e8f,_0x5e808c){_0x5e808c=_0x5e808c||0x1f4;return function(_0xf4f402){logger['error'](_0xf4f402[_0x0a37('0x2b')]);if(_0xf4f402[_0x0a37('0x2c')]){delete _0xf4f402[_0x0a37('0x2c')];}_0x3b7e8f[_0x0a37('0x1b')](_0x5e808c)['send'](_0xf4f402);};}exports[_0x0a37('0x2d')]=function(_0x2e0608,_0x383615){var _0x1badc2={},_0x465a54={},_0x58f402={'count':0x0,'rows':[]};var _0x212c33=_[_0x0a37('0x2e')](db[_0x0a37('0x2f')][_0x0a37('0x30')],function(_0x492925){return{'name':_0x492925['fieldName'],'type':_0x492925['type']['key']};});_0x465a54[_0x0a37('0x31')]=_[_0x0a37('0x32')](_[_0x0a37('0x2e')](_0x212c33,_0x0a37('0x2c')),[_0x0a37('0x2c')]);_0x465a54[_0x0a37('0x33')]=_[_0x0a37('0x34')](_0x2e0608[_0x0a37('0x33')]);_0x465a54['filters']=_[_0x0a37('0x35')](_0x465a54['model'],_0x465a54[_0x0a37('0x33')]);_0x1badc2[_0x0a37('0x36')]=_['intersection'](_0x465a54[_0x0a37('0x31')],qs['fields'](_0x2e0608['query'][_0x0a37('0x37')]));_0x1badc2[_0x0a37('0x36')]=_0x1badc2[_0x0a37('0x36')][_0x0a37('0x38')]?_0x1badc2[_0x0a37('0x36')]:_0x465a54['model'];if(!_0x2e0608[_0x0a37('0x33')]['hasOwnProperty']('nolimit')){_0x1badc2[_0x0a37('0x1e')]=qs[_0x0a37('0x1e')](_0x2e0608[_0x0a37('0x33')][_0x0a37('0x1e')]);_0x1badc2[_0x0a37('0x1d')]=qs[_0x0a37('0x1d')](_0x2e0608[_0x0a37('0x33')]['offset']);}_0x1badc2[_0x0a37('0x39')]=qs[_0x0a37('0x3a')](_0x2e0608[_0x0a37('0x33')][_0x0a37('0x3a')]);_0x1badc2[_0x0a37('0x3b')]=qs[_0x0a37('0x3c')](_[_0x0a37('0x3d')](_0x2e0608[_0x0a37('0x33')],_0x465a54[_0x0a37('0x3c')]),_0x212c33);if(_0x2e0608[_0x0a37('0x33')][_0x0a37('0x3e')]){_0x1badc2[_0x0a37('0x3b')]=_[_0x0a37('0x3f')](_0x1badc2[_0x0a37('0x3b')],{'$or':_[_0x0a37('0x2e')](_0x212c33,function(_0x7f2451){if(_0x7f2451[_0x0a37('0x40')]!==_0x0a37('0x41')){var _0x532fcb={};_0x532fcb[_0x7f2451[_0x0a37('0x2c')]]={'$like':'%'+_0x2e0608['query'][_0x0a37('0x3e')]+'%'};return _0x532fcb;}})});}_0x1badc2=_[_0x0a37('0x3f')]({},_0x1badc2,_0x2e0608[_0x0a37('0x42')]);var _0x19a542={'where':_0x1badc2['where']};return db[_0x0a37('0x2f')][_0x0a37('0x20')](_0x19a542)[_0x0a37('0x27')](function(_0x314a04){_0x58f402[_0x0a37('0x20')]=_0x314a04;if(_0x2e0608[_0x0a37('0x33')][_0x0a37('0x43')]){_0x1badc2['include']=[{'all':!![]}];}return db['CmCustomField'][_0x0a37('0x44')](_0x1badc2);})['then'](function(_0x5c3705){_0x58f402[_0x0a37('0x45')]=_0x5c3705;return _0x58f402;})['then'](respondWithFilteredResult(_0x383615,_0x1badc2))['catch'](handleError(_0x383615,null));};exports[_0x0a37('0x46')]=function(_0x7466b9,_0x1db49b){var _0x4ff5f0={'raw':!![],'where':{'id':_0x7466b9[_0x0a37('0x47')]['id']}},_0x5aa841={};_0x5aa841['model']=_[_0x0a37('0x34')](db['CmCustomField'][_0x0a37('0x30')]);_0x5aa841['query']=_[_0x0a37('0x34')](_0x7466b9[_0x0a37('0x33')]);_0x5aa841[_0x0a37('0x3c')]=_[_0x0a37('0x35')](_0x5aa841[_0x0a37('0x31')],_0x5aa841[_0x0a37('0x33')]);_0x4ff5f0[_0x0a37('0x36')]=_[_0x0a37('0x35')](_0x5aa841[_0x0a37('0x31')],qs[_0x0a37('0x37')](_0x7466b9[_0x0a37('0x33')][_0x0a37('0x37')]));_0x4ff5f0[_0x0a37('0x36')]=_0x4ff5f0['attributes'][_0x0a37('0x38')]?_0x4ff5f0[_0x0a37('0x36')]:_0x5aa841['model'];if(_0x7466b9['query'][_0x0a37('0x43')]){_0x4ff5f0[_0x0a37('0x48')]=[{'all':!![]}];}_0x4ff5f0=_[_0x0a37('0x3f')]({},_0x4ff5f0,_0x7466b9['options']);return db[_0x0a37('0x2f')][_0x0a37('0x49')](_0x4ff5f0)[_0x0a37('0x27')](handleEntityNotFound(_0x1db49b,null))[_0x0a37('0x27')](respondWithResult(_0x1db49b,null))[_0x0a37('0x4a')](handleError(_0x1db49b,null));};exports[_0x0a37('0x26')]=function(_0x1b61ba,_0x40d103){if(_0x1b61ba[_0x0a37('0x4b')]['id']){delete _0x1b61ba[_0x0a37('0x4b')]['id'];}return db[_0x0a37('0x2f')][_0x0a37('0x49')]({'where':{'id':_0x1b61ba[_0x0a37('0x47')]['id']}})['then'](handleEntityNotFound(_0x40d103,null))[_0x0a37('0x27')](saveUpdates(_0x1b61ba[_0x0a37('0x4b')],null))[_0x0a37('0x27')](respondWithResult(_0x40d103,null))[_0x0a37('0x4a')](handleError(_0x40d103,null));};exports['destroy']=function(_0x3d06c4,_0x5903f2){return db['CmCustomField']['find']({'where':{'id':_0x3d06c4['params']['id']}})['then'](handleEntityNotFound(_0x5903f2,null))[_0x0a37('0x27')](removeEntity(_0x5903f2,null))[_0x0a37('0x4a')](handleError(_0x5903f2,null));};exports['create']=function(_0xef9d81,_0x3d483f){var _0x263977;return db[_0x0a37('0x4c')][_0x0a37('0x4d')](function(_0xd013c9){return db['CmCustomField'][_0x0a37('0x4e')](_0xef9d81[_0x0a37('0x4b')],{'transaction':_0xd013c9})['then'](function(_0x30824a){_0x263977=_0x30824a;var _0x435006={'type':db[_0x0a37('0x4f')]['TEXT'],'transaction':_0xd013c9};switch(_0xef9d81['body'][_0x0a37('0x40')]){case'text':_0x435006[_0x0a37('0x40')]=db[_0x0a37('0x4f')][_0x0a37('0x50')];break;case _0x0a37('0x51'):_0x435006['type']=db[_0x0a37('0x4f')][_0x0a37('0x52')];break;case'switch':_0x435006['type']=db['Sequelize'][_0x0a37('0x53')];_0x435006['defaultValue']=![];break;default:}return db[_0x0a37('0x4c')][_0x0a37('0x54')]['addColumn'](_0x0a37('0x55'),util[_0x0a37('0x56')](_0x0a37('0x57'),_0x263977['id']),_0x435006);})[_0x0a37('0x27')](function(){return _0x263977;});})[_0x0a37('0x27')](respondWithResult(_0x3d483f,0xc9))['catch'](handleError(_0x3d483f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 97a32b9..a78673c 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 _0x3ae0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','util','api'];(function(_0x318f48,_0x5e9633){var _0x532d2e=function(_0x12bc3a){while(--_0x12bc3a){_0x318f48['push'](_0x318f48['shift']());}};_0x532d2e(++_0x5e9633);}(_0x3ae0,0x17e));var _0x03ae=function(_0x3304d7,_0x550912){_0x3304d7=_0x3304d7-0x0;var _0x2f6b15=_0x3ae0[_0x3304d7];return _0x2f6b15;};'use strict';var _=require('lodash');var util=require(_0x03ae('0x0'));var logger=require('../../config/logger')(_0x03ae('0x1'));var moment=require(_0x03ae('0x2'));var BPromise=require(_0x03ae('0x3'));var rp=require(_0x03ae('0x4'));var fs=require('fs');var path=require(_0x03ae('0x5'));var rimraf=require(_0x03ae('0x6'));var config=require(_0x03ae('0x7'));var attributes=require(_0x03ae('0x8'));module[_0x03ae('0x9')]=function(_0xf3437d,_0x1cb69c){return _0xf3437d['define'](_0x03ae('0xa'),attributes,{'tableName':_0x03ae('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb234=['api','moment','bluebird','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger'];(function(_0x376968,_0x1ec758){var _0x1ade54=function(_0x11b8d6){while(--_0x11b8d6){_0x376968['push'](_0x376968['shift']());}};_0x1ade54(++_0x1ec758);}(_0xb234,0x142));var _0x4b23=function(_0x233e11,_0x329344){_0x233e11=_0x233e11-0x0;var _0xa3d525=_0xb234[_0x233e11];return _0xa3d525;};'use strict';var _=require(_0x4b23('0x0'));var util=require('util');var logger=require(_0x4b23('0x1'))(_0x4b23('0x2'));var moment=require(_0x4b23('0x3'));var BPromise=require(_0x4b23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b23('0x5'));var rimraf=require('rimraf');var config=require(_0x4b23('0x6'));var attributes=require(_0x4b23('0x7'));module[_0x4b23('0x8')]=function(_0x3c70de,_0x4897fd){return _0x3c70de[_0x4b23('0x9')](_0x4b23('0xa'),attributes,{'tableName':_0x4b23('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 2b9d5a6..f50684b 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 _0x5de8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1a03e2,_0x3e2733){var _0x44e20c=function(_0x3cb863){while(--_0x3cb863){_0x1a03e2['push'](_0x1a03e2['shift']());}};_0x44e20c(++_0x3e2733);}(_0x5de8,0xf7));var _0x85de=function(_0x1c51e2,_0x9d617c){_0x1c51e2=_0x1c51e2-0x0;var _0x508bb0=_0x5de8[_0x1c51e2];return _0x508bb0;};'use strict';var _=require('lodash');var util=require(_0x85de('0x0'));var moment=require(_0x85de('0x1'));var BPromise=require('bluebird');var rs=require(_0x85de('0x2'));var fs=require('fs');var Redis=require(_0x85de('0x3'));var db=require(_0x85de('0x4'))['db'];var utils=require(_0x85de('0x5'));var logger=require(_0x85de('0x6'))(_0x85de('0x7'));var config=require(_0x85de('0x8'));var jayson=require(_0x85de('0x9'));var client=jayson[_0x85de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383bea,_0x437691,_0x3b240b){return new BPromise(function(_0x1c55ca,_0x4b40c2){return client[_0x85de('0xb')](_0x383bea,_0x3b240b)['then'](function(_0x569097){logger[_0x85de('0xc')](_0x85de('0xd'),_0x437691,_0x85de('0xe'));logger[_0x85de('0xf')](_0x85de('0x10'),_0x437691,_0x85de('0xe'),JSON[_0x85de('0x11')](_0x569097));if(_0x569097[_0x85de('0x12')]){if(_0x569097[_0x85de('0x12')][_0x85de('0x13')]===0x1f4){logger[_0x85de('0x12')](_0x85de('0xd'),_0x437691,_0x569097[_0x85de('0x12')][_0x85de('0x14')]);return _0x4b40c2(_0x569097['error'][_0x85de('0x14')]);}logger[_0x85de('0x12')](_0x85de('0xd'),_0x437691,_0x569097[_0x85de('0x12')][_0x85de('0x14')]);return _0x1c55ca(_0x569097[_0x85de('0x12')][_0x85de('0x14')]);}else{logger[_0x85de('0xc')](_0x85de('0xd'),_0x437691,_0x85de('0xe'));_0x1c55ca(_0x569097[_0x85de('0x15')][_0x85de('0x14')]);}})[_0x85de('0x16')](function(_0x118cc1){logger[_0x85de('0x12')](_0x85de('0xd'),_0x437691,_0x118cc1);_0x4b40c2(_0x118cc1);});});} \ No newline at end of file +var _0x8d13=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x8d13,0xa1));var _0x38d1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8d13[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x38d1('0x0'));var util=require(_0x38d1('0x1'));var moment=require(_0x38d1('0x2'));var BPromise=require(_0x38d1('0x3'));var rs=require(_0x38d1('0x4'));var fs=require('fs');var Redis=require(_0x38d1('0x5'));var db=require(_0x38d1('0x6'))['db'];var utils=require(_0x38d1('0x7'));var logger=require(_0x38d1('0x8'))(_0x38d1('0x9'));var config=require(_0x38d1('0xa'));var jayson=require(_0x38d1('0xb'));var client=jayson[_0x38d1('0xc')][_0x38d1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2cb399,_0x56316c,_0x4e036f){return new BPromise(function(_0x2ea058,_0x4065d6){return client[_0x38d1('0xe')](_0x2cb399,_0x4e036f)['then'](function(_0xadf1df){logger[_0x38d1('0xf')](_0x38d1('0x10'),_0x56316c,_0x38d1('0x11'));logger[_0x38d1('0x12')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x56316c,'request\x20sent',JSON['stringify'](_0xadf1df));if(_0xadf1df[_0x38d1('0x13')]){if(_0xadf1df['error'][_0x38d1('0x14')]===0x1f4){logger['error'](_0x38d1('0x10'),_0x56316c,_0xadf1df[_0x38d1('0x13')]['message']);return _0x4065d6(_0xadf1df[_0x38d1('0x13')]['message']);}logger[_0x38d1('0x13')]('CmCustomField,\x20%s,\x20%s',_0x56316c,_0xadf1df[_0x38d1('0x13')]['message']);return _0x2ea058(_0xadf1df[_0x38d1('0x13')][_0x38d1('0x15')]);}else{logger[_0x38d1('0xf')](_0x38d1('0x10'),_0x56316c,_0x38d1('0x11'));_0x2ea058(_0xadf1df['result'][_0x38d1('0x15')]);}})[_0x38d1('0x16')](function(_0x52f970){logger[_0x38d1('0x13')](_0x38d1('0x10'),_0x56316c,_0x52f970);_0x4065d6(_0x52f970);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b0a1458..6ebe6ef 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 _0xb55e=['isAuthenticated','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id'];(function(_0xba370,_0x8b56f1){var _0x575aa9=function(_0x95be54){while(--_0x95be54){_0xba370['push'](_0xba370['shift']());}};_0x575aa9(++_0x8b56f1);}(_0xb55e,0x106));var _0xeb55=function(_0x4caa44,_0xef800a){_0x4caa44=_0x4caa44-0x0;var _0x40bf7d=_0xb55e[_0x4caa44];return _0x40bf7d;};'use strict';var multer=require(_0xeb55('0x0'));var util=require(_0xeb55('0x1'));var path=require(_0xeb55('0x2'));var timeout=require(_0xeb55('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeb55('0x4'));var auth=require(_0xeb55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeb55('0x6'));var controller=require('./cmCustomField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xeb55('0x7')]);router[_0xeb55('0x8')](_0xeb55('0x9'),auth[_0xeb55('0xa')](),controller[_0xeb55('0xb')]);router[_0xeb55('0xc')]('/',auth[_0xeb55('0xa')](),controller[_0xeb55('0xd')]);router['put']('/:id',auth[_0xeb55('0xa')](),controller[_0xeb55('0xe')]);router['delete'](_0xeb55('0x9'),auth['isAuthenticated'](),controller[_0xeb55('0xf')]);module[_0xeb55('0x10')]=router; \ No newline at end of file +var _0xff3c=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xff3c,0x179));var _0xcff3=function(_0x55b6af,_0x50fd5a){_0x55b6af=_0x55b6af-0x0;var _0x2646b2=_0xff3c[_0x55b6af];return _0x2646b2;};'use strict';var multer=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var path=require('path');var timeout=require(_0xcff3('0x2'));var express=require(_0xcff3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcff3('0x4'));var interaction=require(_0xcff3('0x5'));var config=require(_0xcff3('0x6'));var controller=require(_0xcff3('0x7'));router[_0xcff3('0x8')]('/',auth[_0xcff3('0x9')](),controller['index']);router['get'](_0xcff3('0xa'),auth['isAuthenticated'](),controller[_0xcff3('0xb')]);router['post']('/',auth[_0xcff3('0x9')](),controller[_0xcff3('0xc')]);router[_0xcff3('0xd')](_0xcff3('0xa'),auth[_0xcff3('0x9')](),controller[_0xcff3('0xe')]);router[_0xcff3('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xcff3('0x10')]);module[_0xcff3('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a520e12..4d05377 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 _0x5c04=['DATE','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x263e6a,_0x5e7919){var _0x4dc3d4=function(_0x577209){while(--_0x577209){_0x263e6a['push'](_0x263e6a['shift']());}};_0x4dc3d4(++_0x5e7919);}(_0x5c04,0x193));var _0x45c0=function(_0x44cdb7,_0x54961f){_0x44cdb7=_0x44cdb7-0x0;var _0x14c551=_0x5c04[_0x44cdb7];return _0x14c551;};'use strict';var moment=require(_0x45c0('0x0'));var Sequelize=require('sequelize');module[_0x45c0('0x1')]={'phone':{'type':Sequelize[_0x45c0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x45c0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x45c0('0x4')](_0x45c0('0x5'))},'countbusyretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x45c0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x45c0('0x7')]},'priority':{'type':Sequelize[_0x45c0('0x6')](0x2)[_0x45c0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x45c0('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x45c0('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x45c0('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x45c0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x45c0('0x6')],'unique':_0x45c0('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x45c0('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x45c0('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x45c0('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa81d=['contactListQueue','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','BOOLEAN'];(function(_0x1a088d,_0x44a119){var _0x237d60=function(_0x2d52e9){while(--_0x2d52e9){_0x1a088d['push'](_0x1a088d['shift']());}};_0x237d60(++_0x44a119);}(_0xa81d,0x157));var _0xda81=function(_0x2a1db6,_0x5bd31a){_0x2a1db6=_0x2a1db6-0x0;var _0x41d420=_0xa81d[_0x2a1db6];return _0x41d420;};'use strict';var moment=require(_0xda81('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xda81('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xda81('0x2')],'defaultValue':moment()[_0xda81('0x3')](_0xda81('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xda81('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda81('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xda81('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xda81('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xda81('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xda81('0x8')},'ListId':{'type':Sequelize[_0xda81('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xda81('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xda81('0x5')],'unique':_0xda81('0x8')},'CampaignId':{'type':Sequelize[_0xda81('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xda81('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda81('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda81('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xda81('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda81('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xda81('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 f3d95ab..8d591e3 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 _0x23f4=['VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','priority','findOne','recallme','LOCK','Contact','CmCompany','Queue','dialActive','getPreviewRecall','transaction','scheduledat','UPDATE','Company','CmList','List','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notILike','$overlap','$any','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filter','where'];(function(_0x4a77e1,_0x213125){var _0x1bd46d=function(_0x1ab441){while(--_0x1ab441){_0x4a77e1['push'](_0x4a77e1['shift']());}};_0x1bd46d(++_0x213125);}(_0x23f4,0x1ee));var _0x423f=function(_0x1e2928,_0x4e4955){_0x1e2928=_0x1e2928-0x0;var _0xf29ab1=_0x23f4[_0x1e2928];return _0xf29ab1;};'use strict';var moment=require('moment');var _=require(_0x423f('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x423f('0x1'));var shared=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];function respondWithResult(_0x3503a0,_0x1ab106){_0x1ab106=_0x1ab106||0xc8;return function(_0x129dba){if(_0x129dba){return _0x3503a0[_0x423f('0x4')](_0x1ab106)[_0x423f('0x5')](_0x129dba);}};}function respondWithFilteredResult(_0x34a2d9,_0x51066b){return function(_0x260eae){if(_0x260eae){var _0x47716d=typeof _0x51066b['offset']===_0x423f('0x6')&&typeof _0x51066b[_0x423f('0x7')]===_0x423f('0x6');var _0x50301a=_0x260eae['count'];var _0x4b8a90=_0x47716d?0x0:_0x51066b[_0x423f('0x8')];var _0x481c41=_0x47716d?_0x260eae[_0x423f('0x9')]:_0x51066b[_0x423f('0x8')]+_0x51066b[_0x423f('0x7')];var _0x162c83;if(_0x481c41>=_0x50301a){_0x481c41=_0x50301a;_0x162c83=0xc8;}else{_0x162c83=0xce;}_0x34a2d9['status'](_0x162c83);return _0x34a2d9[_0x423f('0xa')](_0x423f('0xb'),_0x4b8a90+'-'+_0x481c41+'/'+_0x50301a)[_0x423f('0x5')](_0x260eae);}return null;};}function saveUpdates(_0x3d4027,_0x216360){return function(_0x5275b0){if(_0x5275b0){return _0x5275b0[_0x423f('0xc')](_0x3d4027)[_0x423f('0xd')](function(_0x2ebc8c){return _0x2ebc8c;});}return null;};}function handleEntityNotFound(_0x1c894f,_0x44e1d5){return function(_0x3b531d){if(!_0x3b531d){_0x1c894f[_0x423f('0xe')](0x194);}return _0x3b531d;};}function handleError(_0x21d804,_0x252e6c){_0x252e6c=_0x252e6c||0x1f4;return function(_0x235c86){logger[_0x423f('0xf')](_0x235c86[_0x423f('0x10')]);if(_0x235c86[_0x423f('0x11')]){delete _0x235c86[_0x423f('0x11')];}_0x21d804[_0x423f('0x4')](_0x252e6c)[_0x423f('0x12')](_0x235c86);};}exports[_0x423f('0x13')]=function(_0x34e968,_0x26b6d1){var _0x5424e6={},_0x99435f={},_0x569fd0={'count':0x0,'rows':[]};var _0x504d8b=_[_0x423f('0x14')](db['CmHopper'][_0x423f('0x15')],function(_0xd7b80e){return{'name':_0xd7b80e['fieldName'],'type':_0xd7b80e[_0x423f('0x16')][_0x423f('0x17')]};});_0x99435f['model']=_[_0x423f('0x14')](_0x504d8b,_0x423f('0x11'));_0x99435f['query']=_[_0x423f('0x18')](_0x34e968[_0x423f('0x19')]);_0x99435f['filters']=_[_0x423f('0x1a')](_0x99435f['model'],_0x99435f[_0x423f('0x19')]);_0x99435f[_0x423f('0x1b')]=_[_0x423f('0x1c')](_0x99435f[_0x423f('0x1b')],[_0x423f('0x1d'),_0x423f('0x1e'),_0x423f('0x1f'),_0x423f('0x20'),_0x423f('0x21'),_0x423f('0x22'),_0x423f('0x23'),_0x423f('0x24'),_0x423f('0x25'),_0x423f('0x26'),'$notBetween',_0x423f('0x27'),_0x423f('0x28'),_0x423f('0x29'),'$notLike','$iLike',_0x423f('0x2a'),_0x423f('0x29'),_0x423f('0x2b'),'$contains','$contained',_0x423f('0x2c')]);_0x5424e6[_0x423f('0x2d')]=_['intersection'](_0x99435f[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x34e968[_0x423f('0x19')][_0x423f('0x2f')]));_0x5424e6['attributes']=_0x5424e6[_0x423f('0x2d')][_0x423f('0x30')]?_0x5424e6[_0x423f('0x2d')]:_0x99435f[_0x423f('0x2e')];if(!_0x34e968['query'][_0x423f('0x31')](_0x423f('0x32'))){_0x5424e6[_0x423f('0x7')]=qs[_0x423f('0x7')](_0x34e968[_0x423f('0x19')][_0x423f('0x7')]);_0x5424e6[_0x423f('0x8')]=qs[_0x423f('0x8')](_0x34e968[_0x423f('0x19')][_0x423f('0x8')]);}_0x5424e6['order']=qs[_0x423f('0x33')](_0x34e968[_0x423f('0x19')][_0x423f('0x33')]);_0x5424e6['where']=qs[_0x423f('0x1b')](_['pick'](_0x34e968[_0x423f('0x19')],_0x99435f[_0x423f('0x1b')]),_0x504d8b);if(_0x34e968[_0x423f('0x19')][_0x423f('0x34')]){_0x5424e6[_0x423f('0x35')]=_['merge'](_0x5424e6['where'],{'$or':_[_0x423f('0x14')](_0x504d8b,function(_0x5a2225){if(_0x5a2225[_0x423f('0x16')]!==_0x423f('0x36')){var _0x3e4c9f={};_0x3e4c9f[_0x5a2225[_0x423f('0x11')]]={'$like':'%'+_0x34e968[_0x423f('0x19')][_0x423f('0x34')]+'%'};return _0x3e4c9f;}})});}_0x5424e6=_[_0x423f('0x37')]({},_0x5424e6,_0x34e968[_0x423f('0x38')]);var _0x3aeb17={'where':_0x5424e6[_0x423f('0x35')]};return db[_0x423f('0x39')]['count'](_0x3aeb17)['then'](function(_0x382f91){_0x569fd0[_0x423f('0x9')]=_0x382f91;if(_0x34e968[_0x423f('0x19')][_0x423f('0x3a')]){_0x5424e6[_0x423f('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0x423f('0x3c')](_0x5424e6);})[_0x423f('0xd')](function(_0x2e6d28){_0x569fd0[_0x423f('0x3d')]=_0x2e6d28;return _0x569fd0;})[_0x423f('0xd')](respondWithFilteredResult(_0x26b6d1,_0x5424e6))[_0x423f('0x3e')](handleError(_0x26b6d1,null));};exports[_0x423f('0x3f')]=function(_0x1d280f,_0x3464e3){var _0x40571a={'raw':!![],'where':{'id':_0x1d280f['params']['id']}},_0x4fb566={};_0x4fb566[_0x423f('0x2e')]=_[_0x423f('0x18')](db[_0x423f('0x39')][_0x423f('0x15')]);_0x4fb566[_0x423f('0x19')]=_[_0x423f('0x18')](_0x1d280f['query']);_0x4fb566[_0x423f('0x1b')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],_0x4fb566[_0x423f('0x19')]);_0x40571a[_0x423f('0x2d')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x1d280f['query'][_0x423f('0x2f')]));_0x40571a[_0x423f('0x2d')]=_0x40571a[_0x423f('0x2d')][_0x423f('0x30')]?_0x40571a[_0x423f('0x2d')]:_0x4fb566[_0x423f('0x2e')];if(_0x1d280f[_0x423f('0x19')][_0x423f('0x3a')]){_0x40571a[_0x423f('0x3b')]=[{'all':!![]}];}_0x40571a=_['merge']({},_0x40571a,_0x1d280f[_0x423f('0x38')]);return db['CmHopper'][_0x423f('0x40')](_0x40571a)[_0x423f('0xd')](handleEntityNotFound(_0x3464e3,null))[_0x423f('0xd')](respondWithResult(_0x3464e3,null))[_0x423f('0x3e')](handleError(_0x3464e3,null));};exports[_0x423f('0x41')]=function(_0x3ad48c,_0x3087e4){return db[_0x423f('0x39')][_0x423f('0x41')](_0x3ad48c[_0x423f('0x42')],{})[_0x423f('0xd')](respondWithResult(_0x3087e4,0xc9))[_0x423f('0x3e')](handleError(_0x3087e4,null));};exports[_0x423f('0xc')]=function(_0x350e11,_0xa7708c){if(_0x350e11[_0x423f('0x42')]['id']){delete _0x350e11[_0x423f('0x42')]['id'];}return db[_0x423f('0x39')][_0x423f('0x40')]({'where':{'id':_0x350e11[_0x423f('0x43')]['id']}})['then'](handleEntityNotFound(_0xa7708c,null))[_0x423f('0xd')](saveUpdates(_0x350e11['body'],null))[_0x423f('0xd')](respondWithResult(_0xa7708c,null))[_0x423f('0x3e')](handleError(_0xa7708c,null));};exports[_0x423f('0x44')]=function(_0x37035a,_0x57f5d6){return db[_0x423f('0x39')][_0x423f('0x44')]()[_0x423f('0xd')](respondWithResult(_0x57f5d6,null))[_0x423f('0x3e')](handleError(_0x57f5d6,null));};exports[_0x423f('0x45')]=function(_0x31b88e,_0x2dcbec){var _0x489894;var _0x1e2b9f=_0x31b88e[_0x423f('0x43')]['id'];return db['CmHopper'][_0x423f('0x40')]({'where':{'id':_0x31b88e['params']['id']}})[_0x423f('0xd')](handleEntityNotFound(_0x2dcbec,null))['then'](function(_0x56e907){if(_0x56e907){return _0x56e907[_0x423f('0x45')]()[_0x423f('0xd')](function(_0x1668d4){return _0x1668d4;});}})[_0x423f('0xd')](function(_0x545476){_0x489894=_0x545476;if(_0x545476){if(_0x545476[_0x423f('0x46')]||_0x545476['CampaignId']){return db[_0x545476[_0x423f('0x46')]?_0x423f('0x47'):_0x423f('0x48')][_0x423f('0x40')]({'where':{'id':_0x545476[_0x423f('0x46')]?_0x545476[_0x423f('0x46')]:_0x545476[_0x423f('0x49')]},'attributes':['id',_0x423f('0x11')],'raw':!![]});}}})[_0x423f('0xd')](function(_0x4e3003){var _0x104fd9={};if(_0x4e3003){_[_0x423f('0x37')](_0x104fd9,_['omit'](_0x489894[_0x423f('0x4a')],['createdAt',_0x423f('0x4b'),'id']));_0x104fd9[_0x423f('0x4c')]=0x15;_0x104fd9[_0x423f('0x4d')]=_0x423f('0x4e');_0x104fd9[_0x423f('0x4f')]=_0x4e3003[_0x423f('0x11')];_0x104fd9['membername']=_0x31b88e['user'][_0x423f('0x11')];_0x104fd9[_0x423f('0x50')]=_0x31b88e[_0x423f('0x51')]['id'];_0x104fd9[_0x423f('0x4e')]=!![];_0x104fd9[_0x423f('0x52')]=moment()[_0x423f('0x53')](_0x423f('0x54'));_0x104fd9[_0x423f('0x55')]=_0x489894[_0x423f('0x56')];_0x104fd9['campaigntype']=_0x489894[_0x423f('0x46')]?_0x423f('0x57'):'ivr';return db[_0x423f('0x58')]['find']({'where':{'id':_0x104fd9[_0x423f('0x59')]},'attributes':[_0x423f('0x5a'),_0x423f('0x5b')]})['then'](function(_0x5c39e4){if(!_[_0x423f('0x5c')](_0x2dcbec)&&!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5a')])){_0x104fd9['calleridname']=_0x5c39e4[_0x423f('0x5a')];if(!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5b')])){_0x104fd9[_0x423f('0x5d')]+='\x20'+_0x5c39e4[_0x423f('0x5b')];}}})[_0x423f('0x5e')](function(){return db[_0x423f('0x5f')]['create'](_0x104fd9);});}})[_0x423f('0xd')](function(_0x588483){return db[_0x423f('0x60')][_0x423f('0x45')]({'where':{'CmHopperId':_0x1e2b9f}});})[_0x423f('0xd')](function(){return _0x2dcbec[_0x423f('0x4')](0xcc)['end']();})[_0x423f('0x3e')](handleError(_0x2dcbec,null));};exports[_0x423f('0x61')]=function(_0x4c33c7,_0x5ae8a9){var _0xfe89a9=[];return db[_0x423f('0x58')]['describe']()[_0x423f('0xd')](function(_0x1897ff){_0xfe89a9=_['keys'](_0x1897ff);return _0x4c33c7['user']['getVoiceQueues']({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':_0x423f('0x63')},'attributes':['id',_0x423f('0x64'),_0x423f('0x65')],'raw':!![]});})['then'](function(_0x4fa0ef){if(_0x4fa0ef&&_0x4fa0ef[_0x423f('0x30')]){return db[_0x423f('0x66')]['transaction'](function(_0x43b569){var _0x13ed0b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_[_0x423f('0x14')](_0x4fa0ef,'id')},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x116605={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4fa0ef)['filter']([_0x423f('0x65'),0x0])[_0x423f('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x223e8c={'$or':[_0x13ed0b,_0x116605]};var _0x3e5d47=[];if(_0x4c33c7['body'][_0x423f('0x67')]&&_0x4c33c7[_0x423f('0x42')][_0x423f('0x67')]===_0x423f('0x68')){if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')])){_0x223e8c['id']={'$in':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[['priority',_0x423f('0x6b')],[_0x423f('0x6c'),_0x4fa0ef[0x0][_0x423f('0x64')]===_0x423f('0x6b')?'DESC':_0x423f('0x6b')],db[_0x423f('0x66')][_0x423f('0x6d')](_0x423f('0x6e')),['id',_0x423f('0x6f')]];}else{if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')]['hopperIds'])){_0x223e8c['id']={'$notIn':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[[_0x423f('0x70'),_0x423f('0x6f')],['scheduledAt',_0x4fa0ef[0x0][_0x423f('0x64')]],db[_0x423f('0x66')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x423f('0x6b')]];}return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id','scheduledat',_0x423f('0x56'),_0x423f('0x72')],'where':_0x223e8c,'order':_0x3e5d47,'transaction':_0x43b569,'lock':_0x43b569[_0x423f('0x73')]['UPDATE'],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0xfe89a9,'include':[{'model':db[_0x423f('0x75')],'as':'Company','attributes':['id',_0x423f('0x11')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':_0x423f('0x76'),'attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})['then'](function(_0x29e60c){if(_0x29e60c){return _0x29e60c[_0x423f('0xc')]({'UserId':_0x4c33c7[_0x423f('0x51')]['id']},{'transaction':_0x43b569});}});});}})[_0x423f('0xd')](handleEntityNotFound(_0x5ae8a9,null))[_0x423f('0xd')](respondWithResult(_0x5ae8a9,null))[_0x423f('0x3e')](handleError(_0x5ae8a9,null));};exports[_0x423f('0x78')]=function(_0x5b9577,_0x4e1e04,_0xd9409e){var _0x320528=[];var _0xe76487=_0x5b9577[_0x423f('0x43')]['id'];var _0x3cffc3=_0x5b9577['user']['id'];return db[_0x423f('0x58')][_0x423f('0x44')]()[_0x423f('0xd')](function(_0x358ab3){_0x320528=_[_0x423f('0x18')](_0x358ab3);return db[_0x423f('0x66')][_0x423f('0x79')](function(_0x1db383){const _0x20bd00={'id':_0xe76487};return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id',_0x423f('0x7a'),_0x423f('0x72')],'where':_0x20bd00,'transaction':_0x1db383,'lock':_0x1db383['LOCK'][_0x423f('0x7b')],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0x320528,'include':[{'model':db[_0x423f('0x75')],'as':_0x423f('0x7c'),'attributes':['id','name']}]},{'model':db[_0x423f('0x7d')],'as':_0x423f('0x7e'),'attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':'Queue','attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})[_0x423f('0xd')](function(_0x3832b6){if(_0x3832b6){return _0x3832b6[_0x423f('0xc')]({'UserId':_0x3cffc3},{'transaction':_0x1db383});}});});})[_0x423f('0xd')](handleEntityNotFound(_0x4e1e04,null))[_0x423f('0xd')](respondWithResult(_0x4e1e04,null))[_0x423f('0x3e')](handleError(_0x4e1e04,null));};exports[_0x423f('0x7f')]=function(_0x22f2af,_0x3c78c7){return _0x22f2af[_0x423f('0x51')][_0x423f('0x80')]({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x423f('0xd')](function(_0x5333b7){if(_0x5333b7&&_0x5333b7['length']){return db[_0x423f('0x39')][_0x423f('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_['map'](_0x5333b7,'id')},'$or':[{'UserId':null},{'UserId':_0x22f2af[_0x423f('0x51')]['id']}]}});}return 0x0;})['then'](function(_0xf18525){if(!_[_0x423f('0x5c')](_0xf18525)&&_[_0x423f('0x81')](_0xf18525)){return _0x3c78c7[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'contacts':_0xf18525});}else{logger['error'](_0x423f('0x82'),'getOpenContacts',0x194,_0x423f('0x83'));_0x3c78c7['sendStatus'](0x194);}})[_0x423f('0x3e')](handleError(_0x3c78c7,null));};exports[_0x423f('0x84')]=function(_0x1990ec,_0x5697e8){var _0xbcf529=shared[_0x423f('0x85')];var _0x3ecfd5=[];_[_0x423f('0x14')](_0xbcf529,function(_0x5baf51){_0x3ecfd5[_0x423f('0x86')]({'id':_0x5baf51[_0x423f('0x11')],'name':_0x5baf51['name'],'utcOffset':_0x5baf51[_0x423f('0x87')]});});return _0x5697e8[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'tz':_0x3ecfd5});};exports[_0x423f('0x88')]=function(_0x36241e,_0x2bb2ba){var _0x140db1=shared[_0x423f('0x85')];var _0x2ede33={};if(!_[_0x423f('0x5c')](_0x140db1[_0x36241e['body']['id']]))_0x2ede33=_0x140db1[_0x36241e['body']['id']];return _0x2bb2ba[_0x423f('0x4')](0xc8)['json'](_0x2ede33);}; \ No newline at end of file +var _0x9221=['$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','CmHopper','catch','params','length','include','create','body','update','find','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','hopperIds','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','transaction','LOCK','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','timezones','push','utcOffset','lodash','../../components/parsers/qs','api','../../config/environment','status','json','offset','undefined','count','set','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike'];(function(_0x53582d,_0x22989b){var _0x119039=function(_0x4e7977){while(--_0x4e7977){_0x53582d['push'](_0x53582d['shift']());}};_0x119039(++_0x22989b);}(_0x9221,0x64));var _0x1922=function(_0x1c011c,_0x384710){_0x1c011c=_0x1c011c-0x0;var _0x277506=_0x9221[_0x1c011c];return _0x277506;};'use strict';var moment=require('moment');var _=require(_0x1922('0x0'));var qs=require(_0x1922('0x1'));var logger=require('../../config/logger')(_0x1922('0x2'));var shared=require(_0x1922('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x309b6b,_0x43c8a3){_0x43c8a3=_0x43c8a3||0xc8;return function(_0x459eee){if(_0x459eee){return _0x309b6b[_0x1922('0x4')](_0x43c8a3)[_0x1922('0x5')](_0x459eee);}};}function respondWithFilteredResult(_0x1944a5,_0x1351a0){return function(_0x5aa05c){if(_0x5aa05c){var _0x116227=typeof _0x1351a0[_0x1922('0x6')]===_0x1922('0x7')&&typeof _0x1351a0['limit']===_0x1922('0x7');var _0x5e9060=_0x5aa05c[_0x1922('0x8')];var _0xc1ae7=_0x116227?0x0:_0x1351a0[_0x1922('0x6')];var _0x47ba98=_0x116227?_0x5aa05c[_0x1922('0x8')]:_0x1351a0[_0x1922('0x6')]+_0x1351a0['limit'];var _0x38dc10;if(_0x47ba98>=_0x5e9060){_0x47ba98=_0x5e9060;_0x38dc10=0xc8;}else{_0x38dc10=0xce;}_0x1944a5['status'](_0x38dc10);return _0x1944a5[_0x1922('0x9')]('Content-Range',_0xc1ae7+'-'+_0x47ba98+'/'+_0x5e9060)[_0x1922('0x5')](_0x5aa05c);}return null;};}function saveUpdates(_0x1d7cf5,_0x2db5b9){return function(_0x58cfe7){if(_0x58cfe7){return _0x58cfe7['update'](_0x1d7cf5)[_0x1922('0xa')](function(_0x1f1bc6){return _0x1f1bc6;});}return null;};}function handleEntityNotFound(_0x3d1bfb,_0x3116dc){return function(_0x33b35d){if(!_0x33b35d){_0x3d1bfb['sendStatus'](0x194);}return _0x33b35d;};}function handleError(_0x5db997,_0x4cb94e){_0x4cb94e=_0x4cb94e||0x1f4;return function(_0x6b9389){logger[_0x1922('0xb')](_0x6b9389[_0x1922('0xc')]);if(_0x6b9389[_0x1922('0xd')]){delete _0x6b9389['name'];}_0x5db997[_0x1922('0x4')](_0x4cb94e)[_0x1922('0xe')](_0x6b9389);};}exports[_0x1922('0xf')]=function(_0x56b01b,_0x482f68){var _0x372875={},_0x51acda={},_0x3c6f9a={'count':0x0,'rows':[]};var _0x1266c0=_['map'](db['CmHopper'][_0x1922('0x10')],function(_0x5f54b9){return{'name':_0x5f54b9[_0x1922('0x11')],'type':_0x5f54b9[_0x1922('0x12')][_0x1922('0x13')]};});_0x51acda[_0x1922('0x14')]=_['map'](_0x1266c0,_0x1922('0xd'));_0x51acda[_0x1922('0x15')]=_[_0x1922('0x16')](_0x56b01b[_0x1922('0x15')]);_0x51acda['filters']=_[_0x1922('0x17')](_0x51acda[_0x1922('0x14')],_0x51acda[_0x1922('0x15')]);_0x51acda['filters']=_[_0x1922('0x18')](_0x51acda['filters'],['$and',_0x1922('0x19'),_0x1922('0x1a'),_0x1922('0x1b'),_0x1922('0x1c'),_0x1922('0x1d'),_0x1922('0x1e'),_0x1922('0x1f'),_0x1922('0x20'),_0x1922('0x21'),_0x1922('0x22'),_0x1922('0x23'),'$notIn',_0x1922('0x24'),'$notLike',_0x1922('0x25'),_0x1922('0x26'),_0x1922('0x24'),_0x1922('0x27'),_0x1922('0x28'),_0x1922('0x29'),_0x1922('0x2a')]);_0x372875[_0x1922('0x2b')]=_[_0x1922('0x17')](_0x51acda['model'],qs[_0x1922('0x2c')](_0x56b01b[_0x1922('0x15')][_0x1922('0x2c')]));_0x372875[_0x1922('0x2b')]=_0x372875[_0x1922('0x2b')]['length']?_0x372875[_0x1922('0x2b')]:_0x51acda[_0x1922('0x14')];if(!_0x56b01b[_0x1922('0x15')][_0x1922('0x2d')](_0x1922('0x2e'))){_0x372875[_0x1922('0x2f')]=qs[_0x1922('0x2f')](_0x56b01b['query'][_0x1922('0x2f')]);_0x372875[_0x1922('0x6')]=qs[_0x1922('0x6')](_0x56b01b[_0x1922('0x15')][_0x1922('0x6')]);}_0x372875[_0x1922('0x30')]=qs['sort'](_0x56b01b[_0x1922('0x15')][_0x1922('0x31')]);_0x372875[_0x1922('0x32')]=qs[_0x1922('0x33')](_[_0x1922('0x34')](_0x56b01b[_0x1922('0x15')],_0x51acda[_0x1922('0x33')]),_0x1266c0);if(_0x56b01b['query'][_0x1922('0x35')]){_0x372875[_0x1922('0x32')]=_[_0x1922('0x36')](_0x372875[_0x1922('0x32')],{'$or':_[_0x1922('0x37')](_0x1266c0,function(_0x1870f9){if(_0x1870f9['type']!==_0x1922('0x38')){var _0x83fd0f={};_0x83fd0f[_0x1870f9['name']]={'$like':'%'+_0x56b01b[_0x1922('0x15')][_0x1922('0x35')]+'%'};return _0x83fd0f;}})});}_0x372875=_['merge']({},_0x372875,_0x56b01b[_0x1922('0x39')]);var _0x12a534={'where':_0x372875[_0x1922('0x32')]};return db['CmHopper'][_0x1922('0x8')](_0x12a534)[_0x1922('0xa')](function(_0x51eb82){_0x3c6f9a[_0x1922('0x8')]=_0x51eb82;if(_0x56b01b[_0x1922('0x15')][_0x1922('0x3a')]){_0x372875['include']=[{'all':!![]}];}return db[_0x1922('0x3b')]['findAll'](_0x372875);})[_0x1922('0xa')](function(_0x575110){_0x3c6f9a['rows']=_0x575110;return _0x3c6f9a;})[_0x1922('0xa')](respondWithFilteredResult(_0x482f68,_0x372875))[_0x1922('0x3c')](handleError(_0x482f68,null));};exports['show']=function(_0x119bba,_0x447b8e){var _0x3bc2c9={'raw':!![],'where':{'id':_0x119bba[_0x1922('0x3d')]['id']}},_0x1d57d3={};_0x1d57d3['model']=_['keys'](db[_0x1922('0x3b')][_0x1922('0x10')]);_0x1d57d3[_0x1922('0x15')]=_[_0x1922('0x16')](_0x119bba[_0x1922('0x15')]);_0x1d57d3[_0x1922('0x33')]=_['intersection'](_0x1d57d3[_0x1922('0x14')],_0x1d57d3[_0x1922('0x15')]);_0x3bc2c9[_0x1922('0x2b')]=_[_0x1922('0x17')](_0x1d57d3[_0x1922('0x14')],qs[_0x1922('0x2c')](_0x119bba[_0x1922('0x15')]['fields']));_0x3bc2c9[_0x1922('0x2b')]=_0x3bc2c9[_0x1922('0x2b')][_0x1922('0x3e')]?_0x3bc2c9['attributes']:_0x1d57d3[_0x1922('0x14')];if(_0x119bba['query'][_0x1922('0x3a')]){_0x3bc2c9[_0x1922('0x3f')]=[{'all':!![]}];}_0x3bc2c9=_[_0x1922('0x36')]({},_0x3bc2c9,_0x119bba[_0x1922('0x39')]);return db[_0x1922('0x3b')]['find'](_0x3bc2c9)[_0x1922('0xa')](handleEntityNotFound(_0x447b8e,null))[_0x1922('0xa')](respondWithResult(_0x447b8e,null))[_0x1922('0x3c')](handleError(_0x447b8e,null));};exports[_0x1922('0x40')]=function(_0x4910ed,_0x24dce1){return db['CmHopper'][_0x1922('0x40')](_0x4910ed[_0x1922('0x41')],{})[_0x1922('0xa')](respondWithResult(_0x24dce1,0xc9))[_0x1922('0x3c')](handleError(_0x24dce1,null));};exports[_0x1922('0x42')]=function(_0x4cd5c,_0x19faee){if(_0x4cd5c['body']['id']){delete _0x4cd5c['body']['id'];}return db['CmHopper'][_0x1922('0x43')]({'where':{'id':_0x4cd5c[_0x1922('0x3d')]['id']}})[_0x1922('0xa')](handleEntityNotFound(_0x19faee,null))[_0x1922('0xa')](saveUpdates(_0x4cd5c[_0x1922('0x41')],null))[_0x1922('0xa')](respondWithResult(_0x19faee,null))[_0x1922('0x3c')](handleError(_0x19faee,null));};exports[_0x1922('0x44')]=function(_0x5da273,_0x5b34d3){return db[_0x1922('0x3b')]['describe']()[_0x1922('0xa')](respondWithResult(_0x5b34d3,null))[_0x1922('0x3c')](handleError(_0x5b34d3,null));};exports[_0x1922('0x45')]=function(_0x1c241b,_0x1e6d2f){var _0x5b51c2;var _0x4f25cb=_0x1c241b['params']['id'];return db[_0x1922('0x3b')]['find']({'where':{'id':_0x1c241b['params']['id']}})[_0x1922('0xa')](handleEntityNotFound(_0x1e6d2f,null))[_0x1922('0xa')](function(_0x22d668){if(_0x22d668){return _0x22d668['destroy']()['then'](function(_0x57a002){return _0x57a002;});}})['then'](function(_0x2234da){_0x5b51c2=_0x2234da;if(_0x2234da){if(_0x2234da[_0x1922('0x46')]||_0x2234da[_0x1922('0x47')]){return db[_0x2234da[_0x1922('0x46')]?'VoiceQueue':_0x1922('0x48')][_0x1922('0x43')]({'where':{'id':_0x2234da[_0x1922('0x46')]?_0x2234da[_0x1922('0x46')]:_0x2234da['CampaignId']},'attributes':['id',_0x1922('0xd')],'raw':!![]});}}})[_0x1922('0xa')](function(_0x4a3416){var _0x256a47={};if(_0x4a3416){_[_0x1922('0x36')](_0x256a47,_[_0x1922('0x49')](_0x5b51c2[_0x1922('0x4a')],[_0x1922('0x4b'),_0x1922('0x4c'),'id']));_0x256a47[_0x1922('0x4d')]=0x15;_0x256a47[_0x1922('0x4e')]=_0x1922('0x4f');_0x256a47[_0x1922('0x50')]=_0x4a3416[_0x1922('0xd')];_0x256a47[_0x1922('0x51')]=_0x1c241b[_0x1922('0x52')][_0x1922('0xd')];_0x256a47[_0x1922('0x53')]=_0x1c241b['user']['id'];_0x256a47[_0x1922('0x4f')]=!![];_0x256a47[_0x1922('0x54')]=moment()[_0x1922('0x55')](_0x1922('0x56'));_0x256a47['calleridnum']=_0x5b51c2['phone'];_0x256a47['campaigntype']=_0x5b51c2[_0x1922('0x46')]?_0x1922('0x57'):_0x1922('0x58');return db[_0x1922('0x59')][_0x1922('0x43')]({'where':{'id':_0x256a47[_0x1922('0x5a')]},'attributes':[_0x1922('0x5b'),_0x1922('0x5c')]})[_0x1922('0xa')](function(_0x4b2aa0){if(!_[_0x1922('0x5d')](_0x1e6d2f)&&!_['isNil'](_0x4b2aa0[_0x1922('0x5b')])){_0x256a47['calleridname']=_0x4b2aa0[_0x1922('0x5b')];if(!_[_0x1922('0x5d')](_0x4b2aa0['lastName'])){_0x256a47[_0x1922('0x5e')]+='\x20'+_0x4b2aa0['lastName'];}}})[_0x1922('0x5f')](function(){return db[_0x1922('0x60')][_0x1922('0x40')](_0x256a47);});}})[_0x1922('0xa')](function(_0x2e227d){return db[_0x1922('0x61')]['destroy']({'where':{'CmHopperId':_0x4f25cb}});})[_0x1922('0xa')](function(){return _0x1e6d2f[_0x1922('0x4')](0xcc)[_0x1922('0x62')]();})[_0x1922('0x3c')](handleError(_0x1e6d2f,null));};exports[_0x1922('0x63')]=function(_0x105271,_0x10a7ce){var _0x39f5da=[];return db[_0x1922('0x59')][_0x1922('0x44')]()[_0x1922('0xa')](function(_0x4ff467){_0x39f5da=_[_0x1922('0x16')](_0x4ff467);return _0x105271[_0x1922('0x52')][_0x1922('0x64')]({'where':{'type':_0x1922('0x65'),'dialActive':!![],'dialMethod':_0x1922('0x66')},'attributes':['id',_0x1922('0x67'),_0x1922('0x68')],'raw':!![]});})[_0x1922('0xa')](function(_0x2cc3a3){if(_0x2cc3a3&&_0x2cc3a3[_0x1922('0x3e')]){return db[_0x1922('0x69')]['transaction'](function(_0x1c53d7){var _0x3f1a8e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1922('0x55')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x1922('0x37')](_0x2cc3a3,'id')},'$or':[{'UserId':null},{'UserId':_0x105271[_0x1922('0x52')]['id']}]};var _0x287726={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2cc3a3)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x1922('0x37')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x105271[_0x1922('0x52')]['id']}]};var _0x232ea0={'$or':[_0x3f1a8e,_0x287726]};var _0x20c36d=[];if(_0x105271[_0x1922('0x41')]['direction']&&_0x105271[_0x1922('0x41')][_0x1922('0x6a')]===_0x1922('0x6b')){if(!_[_0x1922('0x6c')](_0x105271[_0x1922('0x41')]['hopperIds'])){_0x232ea0['id']={'$in':_0x105271[_0x1922('0x41')]['hopperIds']};}_0x20c36d=[[_0x1922('0x6d'),_0x1922('0x6e')],[_0x1922('0x6f'),_0x2cc3a3[0x0]['dialOrderByScheduledAt']===_0x1922('0x6e')?'DESC':'ASC'],db[_0x1922('0x69')]['literal'](_0x1922('0x70')),['id',_0x1922('0x71')]];}else{if(!_[_0x1922('0x6c')](_0x105271[_0x1922('0x41')][_0x1922('0x72')])){_0x232ea0['id']={'$notIn':_0x105271[_0x1922('0x41')][_0x1922('0x72')]};}_0x20c36d=[[_0x1922('0x6d'),'DESC'],[_0x1922('0x6f'),_0x2cc3a3[0x0][_0x1922('0x67')]],db[_0x1922('0x69')][_0x1922('0x73')](_0x1922('0x74')),['id',_0x1922('0x6e')]];}return db[_0x1922('0x3b')][_0x1922('0x75')]({'attributes':['id',_0x1922('0x76'),_0x1922('0x77'),_0x1922('0x78')],'where':_0x232ea0,'order':_0x20c36d,'transaction':_0x1c53d7,'lock':_0x1c53d7['LOCK'][_0x1922('0x79')],'include':[{'model':db[_0x1922('0x59')],'as':_0x1922('0x7a'),'attributes':_0x39f5da,'include':[{'model':db[_0x1922('0x7b')],'as':_0x1922('0x7c'),'attributes':['id',_0x1922('0xd')]}]},{'model':db[_0x1922('0x7d')],'as':_0x1922('0x7e'),'attributes':['id',_0x1922('0xd')]},{'model':db[_0x1922('0x7f')],'as':_0x1922('0x80'),'attributes':['id',_0x1922('0xd'),_0x1922('0x81')]}]})[_0x1922('0xa')](function(_0x2b4e65){if(_0x2b4e65){return _0x2b4e65[_0x1922('0x42')]({'UserId':_0x105271[_0x1922('0x52')]['id']},{'transaction':_0x1c53d7});}});});}})[_0x1922('0xa')](handleEntityNotFound(_0x10a7ce,null))[_0x1922('0xa')](respondWithResult(_0x10a7ce,null))[_0x1922('0x3c')](handleError(_0x10a7ce,null));};exports[_0x1922('0x82')]=function(_0x9eaf53,_0x4caf03,_0x362013){var _0x1e6fbd=[];var _0x390dba=_0x9eaf53[_0x1922('0x3d')]['id'];var _0x188aa8=_0x9eaf53['user']['id'];return db[_0x1922('0x59')]['describe']()[_0x1922('0xa')](function(_0x3274e5){_0x1e6fbd=_[_0x1922('0x16')](_0x3274e5);return db[_0x1922('0x69')][_0x1922('0x83')](function(_0x300f26){const _0x472e27={'id':_0x390dba};return db['CmHopper'][_0x1922('0x75')]({'attributes':['id',_0x1922('0x76'),_0x1922('0x78')],'where':_0x472e27,'transaction':_0x300f26,'lock':_0x300f26[_0x1922('0x84')][_0x1922('0x79')],'include':[{'model':db[_0x1922('0x59')],'as':_0x1922('0x7a'),'attributes':_0x1e6fbd,'include':[{'model':db['CmCompany'],'as':_0x1922('0x7c'),'attributes':['id',_0x1922('0xd')]}]},{'model':db[_0x1922('0x7d')],'as':_0x1922('0x7e'),'attributes':['id',_0x1922('0xd')]},{'model':db[_0x1922('0x7f')],'as':_0x1922('0x80'),'attributes':['id',_0x1922('0xd'),_0x1922('0x81')]}]})[_0x1922('0xa')](function(_0x50bc2a){if(_0x50bc2a){return _0x50bc2a[_0x1922('0x42')]({'UserId':_0x188aa8},{'transaction':_0x300f26});}});});})['then'](handleEntityNotFound(_0x4caf03,null))[_0x1922('0xa')](respondWithResult(_0x4caf03,null))[_0x1922('0x3c')](handleError(_0x4caf03,null));};exports[_0x1922('0x85')]=function(_0x146038,_0x5da520){return _0x146038['user'][_0x1922('0x64')]({'where':{'type':_0x1922('0x65'),'dialActive':!![],'dialMethod':_0x1922('0x66')},'attributes':['id'],'raw':!![]})['then'](function(_0x430369){if(_0x430369&&_0x430369['length']){return db[_0x1922('0x3b')][_0x1922('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1922('0x55')](_0x1922('0x56'))},'VoiceQueueId':{'$in':_[_0x1922('0x37')](_0x430369,'id')},'$or':[{'UserId':null},{'UserId':_0x146038[_0x1922('0x52')]['id']}]}});}return 0x0;})[_0x1922('0xa')](function(_0x3688c5){if(!_['isNil'](_0x3688c5)&&_['isNumber'](_0x3688c5)){return _0x5da520['status'](0xc8)[_0x1922('0x5')]({'contacts':_0x3688c5});}else{logger[_0x1922('0xb')](_0x1922('0x86'),_0x1922('0x85'),0x194,'entity\x20not\x20found');_0x5da520[_0x1922('0x87')](0x194);}})['catch'](handleError(_0x5da520,null));};exports['getTimezones']=function(_0x58348f,_0x1ea53b){var _0x24e99d=shared[_0x1922('0x88')];var _0x5d2f1a=[];_['map'](_0x24e99d,function(_0xb13ce3){_0x5d2f1a[_0x1922('0x89')]({'id':_0xb13ce3[_0x1922('0xd')],'name':_0xb13ce3[_0x1922('0xd')],'utcOffset':_0xb13ce3[_0x1922('0x8a')]});});return _0x1ea53b['status'](0xc8)[_0x1922('0x5')]({'tz':_0x5d2f1a});};exports['getTimezone']=function(_0x3ab941,_0x4672a3){var _0x2c70b6=shared[_0x1922('0x88')];var _0x203037={};if(!_[_0x1922('0x5d')](_0x2c70b6[_0x3ab941[_0x1922('0x41')]['id']]))_0x203037=_0x2c70b6[_0x3ab941[_0x1922('0x41')]['id']];return _0x4672a3[_0x1922('0x4')](0xc8)[_0x1922('0x5')](_0x203037);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c1faea2..dfe4408 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 _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39a333,_0x5581a4){var _0x5366f1=function(_0x41599c){while(--_0x41599c){_0x39a333['push'](_0x39a333['shift']());}};_0x5366f1(++_0x5581a4);}(_0x5fab,0x177));var _0xb5fa=function(_0x453016,_0x2bd244){_0x453016=_0x453016-0x0;var _0x3352f5=_0x5fab[_0x453016];return _0x3352f5;};'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':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x5ef70d,_0x1b14c0){var _0x307667=function(_0x49509b){while(--_0x49509b){_0x5ef70d['push'](_0x5ef70d['shift']());}};_0x307667(++_0x1b14c0);}(_0x2a07,0x74));var _0x72a0=function(_0x178619,_0x35734e){_0x178619=_0x178619-0x0;var _0x2a71e9=_0x2a07[_0x178619];return _0x2a71e9;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index fdc7021..d68ca62 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 _0x2127=['CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','order','User','Agent','name','voicePause','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','LOCK','UPDATE','length','GetCmHopperPreview','Contact','keys','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','find','raw'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2127,0x8a));var _0x7212=function(_0x4b1b84,_0xa9dba){_0x4b1b84=_0x4b1b84-0x0;var _0x48daf9=_0x2127[_0x4b1b84];return _0x48daf9;};'use strict';var _=require(_0x7212('0x0'));var util=require(_0x7212('0x1'));var moment=require(_0x7212('0x2'));var BPromise=require(_0x7212('0x3'));var db=require(_0x7212('0x4'))['db'];var logger=require(_0x7212('0x5'))(_0x7212('0x6'));exports[_0x7212('0x7')]=function(_0x1e4dc0){var _0x4d45e4=this;return new Promise(function(_0x49813c,_0x293eaf){return db[_0x7212('0x8')]['findAll']({'raw':_0x1e4dc0[_0x7212('0x9')]?_0x1e4dc0[_0x7212('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x1e4dc0[_0x7212('0x9')]?_0x1e4dc0['options'][_0x7212('0xa')]||null:null,'attributes':_0x1e4dc0[_0x7212('0x9')]?_0x1e4dc0['options'][_0x7212('0xb')]||null:null,'limit':_0x1e4dc0[_0x7212('0x9')]?_0x1e4dc0[_0x7212('0x9')][_0x7212('0xc')]||null:null,'include':_0x1e4dc0[_0x7212('0x9')]?_0x1e4dc0['options'][_0x7212('0xd')]?_[_0x7212('0xe')](_0x1e4dc0[_0x7212('0x9')]['include'],function(_0x290934){return{'model':db[_0x290934['model']],'as':_0x290934['as'],'attributes':_0x290934[_0x7212('0xb')],'include':_0x290934[_0x7212('0xd')]?_[_0x7212('0xe')](_0x290934[_0x7212('0xd')],function(_0x204a09){return{'model':db[_0x204a09[_0x7212('0xf')]],'as':_0x204a09['as'],'attributes':_0x204a09[_0x7212('0xb')],'include':_0x204a09[_0x7212('0xd')]?_[_0x7212('0xe')](_0x204a09[_0x7212('0xd')],function(_0x2334e6){return{'model':db[_0x2334e6[_0x7212('0xf')]],'as':_0x2334e6['as'],'attributes':_0x2334e6[_0x7212('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7212('0x10')](function(_0x4b9b57){logger[_0x7212('0x11')](_0x7212('0x7'),_0x1e4dc0);logger[_0x7212('0x12')](_0x7212('0x7'),_0x1e4dc0,JSON[_0x7212('0x13')](_0x4b9b57));_0x49813c(_0x4b9b57);})[_0x7212('0x14')](function(_0x2cf4f0){logger[_0x7212('0x15')]('GetCmHopper',_0x2cf4f0[_0x7212('0x16')],_0x1e4dc0);_0x293eaf(_0x4d45e4[_0x7212('0x15')](0x1f4,_0x2cf4f0['message']));});});};exports[_0x7212('0x17')]=function(_0x2fdbe6){var _0x5f6004=this;return new Promise(function(_0x2048bc,_0x5c6fe1){return db[_0x7212('0x8')][_0x7212('0x18')]({'raw':_0x2fdbe6[_0x7212('0x9')]?_0x2fdbe6['options'][_0x7212('0x19')]===undefined?!![]:![]:!![],'where':_0x2fdbe6[_0x7212('0x9')]?_0x2fdbe6[_0x7212('0x9')][_0x7212('0xa')]||null:null,'attributes':_0x2fdbe6[_0x7212('0x9')]?_0x2fdbe6[_0x7212('0x9')]['attributes']||null:null,'include':_0x2fdbe6[_0x7212('0x9')]?_0x2fdbe6[_0x7212('0x9')][_0x7212('0xd')]?_['map'](_0x2fdbe6[_0x7212('0x9')]['include'],function(_0x30e1be){return{'model':db[_0x30e1be[_0x7212('0xf')]],'as':_0x30e1be['as'],'attributes':_0x30e1be[_0x7212('0xb')],'include':_0x30e1be[_0x7212('0xd')]?_[_0x7212('0xe')](_0x30e1be[_0x7212('0xd')],function(_0x7741e8){return{'model':db[_0x7741e8['model']],'as':_0x7741e8['as'],'attributes':_0x7741e8[_0x7212('0xb')],'include':_0x7741e8[_0x7212('0xd')]?_[_0x7212('0xe')](_0x7741e8['include'],function(_0x3d7411){return{'model':db[_0x3d7411['model']],'as':_0x3d7411['as'],'attributes':_0x3d7411[_0x7212('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7212('0x10')](function(_0x3b8957){logger[_0x7212('0x11')](_0x7212('0x17'),_0x2fdbe6);logger[_0x7212('0x12')](_0x7212('0x17'),_0x2fdbe6,JSON[_0x7212('0x13')](_0x3b8957));_0x2048bc(_0x3b8957);})[_0x7212('0x14')](function(_0x1d3441){logger['error'](_0x7212('0x17'),_0x1d3441[_0x7212('0x16')],_0x2fdbe6);_0x5c6fe1(_0x5f6004['error'](0x1f4,_0x1d3441[_0x7212('0x16')]));});});};exports[_0x7212('0x1a')]=function(_0x127c53){var _0x2ef272=this;return new Promise(function(_0x36a74e,_0xa1f6dc){return db['CmHopper'][_0x7212('0x1b')](_0x127c53['body'],{'raw':_0x127c53['options']?_0x127c53[_0x7212('0x9')]['raw']===undefined?!![]:![]:!![]})[_0x7212('0x10')](function(_0x4eaec2){logger[_0x7212('0x11')](_0x7212('0x1a'),_0x127c53);logger[_0x7212('0x12')](_0x7212('0x1a'),_0x127c53,JSON['stringify'](_0x4eaec2));_0x36a74e(_0x4eaec2);})[_0x7212('0x14')](function(_0x15acac){logger[_0x7212('0x15')]('CreateCmHopper',_0x15acac[_0x7212('0x16')],_0x127c53);_0xa1f6dc(_0x2ef272[_0x7212('0x15')](0x1f4,_0x15acac[_0x7212('0x16')]));});});};exports[_0x7212('0x1c')]=function(_0x14f2d3){var _0x33c5ec=this;return new Promise(function(_0x116b98,_0x6bf1ad){return db[_0x7212('0x8')][_0x7212('0x1d')](_0x14f2d3[_0x7212('0x1e')],{'raw':_0x14f2d3[_0x7212('0x9')]?_0x14f2d3[_0x7212('0x9')][_0x7212('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f2d3[_0x7212('0x9')]?_0x14f2d3[_0x7212('0x9')][_0x7212('0xa')]||null:null,'attributes':_0x14f2d3['options']?_0x14f2d3[_0x7212('0x9')][_0x7212('0xb')]||null:null,'limit':_0x14f2d3[_0x7212('0x9')]?_0x14f2d3[_0x7212('0x9')]['limit']||null:null})[_0x7212('0x10')](function(_0x54da93){logger[_0x7212('0x11')](_0x7212('0x1c'),_0x14f2d3);logger[_0x7212('0x11')](_0x7212('0x1f'),JSON[_0x7212('0x13')](_0x14f2d3[_0x7212('0x9')][_0x7212('0xa')]),_0x14f2d3[_0x7212('0x1e')][_0x7212('0x20')]);logger['debug'](_0x7212('0x1c'),_0x14f2d3,JSON[_0x7212('0x13')](_0x54da93));_0x116b98(_0x54da93);})['catch'](function(_0x140366){logger['error'](_0x7212('0x1c'),_0x140366[_0x7212('0x16')],_0x14f2d3);_0x6bf1ad(_0x33c5ec[_0x7212('0x15')](0x1f4,_0x140366[_0x7212('0x16')]));});});};exports[_0x7212('0x21')]=function(_0x1f7efa){var _0x3daef0=this;return new Promise(function(_0x121eba,_0x3766f8){return db[_0x7212('0x8')][_0x7212('0x22')]({'where':_0x1f7efa[_0x7212('0x9')]?_0x1f7efa[_0x7212('0x9')][_0x7212('0xa')]||null:null})[_0x7212('0x10')](function(_0x15c761){logger[_0x7212('0x11')](_0x7212('0x21'),_0x1f7efa);logger[_0x7212('0x12')](_0x7212('0x21'),_0x1f7efa,JSON[_0x7212('0x13')](_0x15c761));_0x121eba(_0x15c761);})['catch'](function(_0x5bc516){logger[_0x7212('0x15')]('DestroyCmHopper',_0x5bc516[_0x7212('0x16')],_0x1f7efa);_0x3766f8(_0x3daef0[_0x7212('0x15')](0x1f4,_0x5bc516[_0x7212('0x16')]));});});};exports[_0x7212('0x23')]=function(_0x6b5214){var _0x5461a8=this;return new Promise(function(_0x518e82,_0x107d20){return db[_0x7212('0x24')][_0x7212('0x25')]()['then'](function(_0xf6c42){return db[_0x7212('0x26')]['transaction'](function(_0x35a2af){return db[_0x7212('0x8')][_0x7212('0x27')]({'where':_0x6b5214['options']?_0x6b5214[_0x7212('0x9')]['where']||null:null,'attributes':_0x6b5214['options']?_0x6b5214['options']['attributes']||null:null,'limit':_0x6b5214[_0x7212('0x9')]?_0x6b5214['options'][_0x7212('0xc')]||null:null,'order':_0x6b5214[_0x7212('0x9')]?_0x6b5214[_0x7212('0x9')][_0x7212('0x28')]||null:null,'transaction':_0x35a2af,'lock':_0x35a2af['LOCK']['UPDATE'],'include':[{'model':db[_0x7212('0x24')],'as':'Contact','attributes':_['keys'](_0xf6c42)},{'model':db[_0x7212('0x29')],'as':_0x7212('0x2a'),'attributes':['id',_0x7212('0x2b'),_0x7212('0x2c')]}]})[_0x7212('0x10')](function(_0x25245d){var _0x16ed42=[];var _0xdd08af=[];for(var _0xb6ca29=0x0;_0xb6ca29<_0x25245d['length'];_0xb6ca29+=0x1){var _0x237716=_0x25245d[_0xb6ca29][_0x7212('0x2d')];if(_0x237716===null){_0x16ed42[_0x7212('0x2e')](_0x25245d[_0xb6ca29][_0x7212('0x1d')](_0x6b5214[_0x7212('0x1e')],{'transaction':_0x35a2af}));}else if(!_0xdd08af[_0x7212('0x2f')](_0x237716)){_0xdd08af[_0x7212('0x2e')](_0x237716);_0x16ed42[_0x7212('0x2e')](_0x25245d[_0xb6ca29]['update'](_0x6b5214[_0x7212('0x1e')],{'transaction':_0x35a2af}));}}return BPromise[_0x7212('0x30')](_0x16ed42);});})[_0x7212('0x10')](function(_0x280e1f){logger[_0x7212('0x11')](_0x7212('0x23'),_0x6b5214);if(_0x280e1f['length']>0x0){logger['info'](_0x7212('0x31'),_0x280e1f[0x0][_0x7212('0x32')]['id'],_0x280e1f[0x0][_0x7212('0x32')][_0x7212('0x33')],_0x280e1f[0x0]['dataValues'][_0x7212('0x20')]);}logger[_0x7212('0x12')](_0x7212('0x23'),_0x6b5214,JSON['stringify'](_0x280e1f));_0x518e82(_0x280e1f);})['catch'](function(_0x4a9ed3){logger[_0x7212('0x15')](_0x7212('0x23'),_0x4a9ed3[_0x7212('0x16')],_0x6b5214);_0x107d20(_0x5461a8['error'](0x1f4,_0x4a9ed3['message']));});});});};exports[_0x7212('0x34')]=function(_0x5e4254){var _0x59fcff=this;return new Promise(function(_0x2f2cb6,_0x4c9c02){return db[_0x7212('0x26')][_0x7212('0x35')](function(_0xfec660){return db[_0x7212('0x36')]['create'](_0x5e4254[_0x7212('0x1e')],{'raw':_0x5e4254[_0x7212('0x9')]?_0x5e4254[_0x7212('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0xfec660})[_0x7212('0x10')](function(){logger[_0x7212('0x11')](_0x7212('0x37'),JSON['stringify'](_0x5e4254[_0x7212('0x9')][_0x7212('0xa')]),_0x5e4254[_0x7212('0x9')][_0x7212('0xa')][_0x7212('0x20')]);return db[_0x7212('0x8')][_0x7212('0x22')]({'where':_0x5e4254['options']?_0x5e4254[_0x7212('0x9')][_0x7212('0xa')]||null:null,'transaction':_0xfec660});});})['then'](function(_0x52be94){logger[_0x7212('0x11')]('MoveContactManagedDialer',_0x5e4254);logger['debug'](_0x7212('0x34'),_0x5e4254,JSON[_0x7212('0x13')](_0x52be94));_0x2f2cb6(_0x52be94);})[_0x7212('0x14')](function(_0x186b56){logger[_0x7212('0x15')](_0x7212('0x34'),_0x186b56[_0x7212('0x16')],_0x5e4254);_0x4c9c02(_0x59fcff[_0x7212('0x15')](0x1f4,_0x186b56['message']));});});};exports[_0x7212('0x38')]=function(_0x2988f7){var _0x574e0e=this;return new Promise(function(_0x4226ee,_0x43cd38){return db['CmHopper'][_0x7212('0x27')]({'raw':_0x2988f7[_0x7212('0x9')]?_0x2988f7['options'][_0x7212('0x19')]===undefined?!![]:![]:!![],'where':_0x2988f7[_0x7212('0x9')]?_0x2988f7['options'][_0x7212('0xa')]||null:null,'attributes':[[db[_0x7212('0x26')]['fn'](_0x7212('0x39'),db[_0x7212('0x26')]['fn']('IF',db[_0x7212('0x26')]['literal']('`scheduledat`\x20>=\x20'+util['format'](_0x7212('0x3a'),moment()[_0x7212('0x3b')](_0x7212('0x3c')))+_0x7212('0x3d')))),'contactsRescheduled']]})[_0x7212('0x10')](function(_0x626378){logger[_0x7212('0x11')](_0x7212('0x38'),_0x2988f7);logger[_0x7212('0x12')](_0x7212('0x38'),_0x2988f7,JSON[_0x7212('0x13')](_0x626378));_0x4226ee(_0x626378);})[_0x7212('0x14')](function(_0x31c883){logger[_0x7212('0x15')]('CountReScheduled',_0x31c883[_0x7212('0x16')],_0x2988f7);_0x43cd38(_0x574e0e[_0x7212('0x15')](0x1f4,_0x31c883['message']));});});};exports[_0x7212('0x3e')]=function(_0x2282ad){var _0x3bf370=this;return new Promise(function(_0x44126e,_0x56e1ea){return db[_0x7212('0x24')][_0x7212('0x25')]()[_0x7212('0x10')](function(){return db[_0x7212('0x26')][_0x7212('0x35')](function(_0x379fff){return db[_0x7212('0x8')][_0x7212('0x27')]({'where':_0x2282ad[_0x7212('0x9')]?_0x2282ad[_0x7212('0x9')][_0x7212('0xa')]||null:null,'attributes':_0x2282ad['options']?_0x2282ad[_0x7212('0x9')][_0x7212('0xb')]||null:null,'limit':0x1,'order':_0x2282ad[_0x7212('0x9')]?_0x2282ad[_0x7212('0x9')][_0x7212('0x28')]||null:null,'group':db[_0x7212('0x8')][_0x7212('0x2d')],'transaction':_0x379fff,'lock':_0x379fff[_0x7212('0x3f')][_0x7212('0x40')],'include':_0x2282ad[_0x7212('0x9')]?_0x2282ad[_0x7212('0x9')][_0x7212('0xd')]?_['map'](_0x2282ad[_0x7212('0x9')]['include'],function(_0x3f938c){return{'model':db[_0x3f938c[_0x7212('0xf')]],'as':_0x3f938c['as'],'attributes':_0x3f938c[_0x7212('0xb')],'include':_0x3f938c['include']?_[_0x7212('0xe')](_0x3f938c['include'],function(_0x93c2ee){return{'model':db[_0x93c2ee[_0x7212('0xf')]],'as':_0x93c2ee['as'],'attributes':_0x93c2ee[_0x7212('0xb')],'include':_0x93c2ee[_0x7212('0xd')]?_['map'](_0x93c2ee['include'],function(_0x16041a){return{'model':db[_0x16041a['model']],'as':_0x16041a['as'],'attributes':_0x16041a[_0x7212('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7212('0x10')](function(_0x440604){var _0x1147b9=[];for(var _0x505b9b=0x0;_0x505b9b<_0x440604[_0x7212('0x41')];_0x505b9b+=0x1){_0x1147b9['push'](_0x440604[_0x505b9b][_0x7212('0x1d')](_0x2282ad[_0x7212('0x1e')],{'transaction':_0x379fff}));}return BPromise[_0x7212('0x30')](_0x1147b9);});})[_0x7212('0x10')](function(_0x5973ae){logger[_0x7212('0x11')](_0x7212('0x3e'),_0x2282ad);logger[_0x7212('0x12')]('GetContactRecallMe',_0x2282ad,JSON['stringify'](_0x5973ae));_0x44126e(_0x5973ae);})[_0x7212('0x14')](function(_0x41a6a3){logger[_0x7212('0x15')]('GetContactRecallMe',_0x41a6a3[_0x7212('0x16')],_0x2282ad);_0x56e1ea(_0x3bf370[_0x7212('0x15')](0x1f4,_0x41a6a3[_0x7212('0x16')]));});});});};exports[_0x7212('0x42')]=function(_0x447bba){var _0x17dc59=this;return new Promise(function(_0x3afe1c,_0x3a1793){db[_0x7212('0x24')][_0x7212('0x25')]()[_0x7212('0x10')](function(_0x1afdd2){return db[_0x7212('0x8')][_0x7212('0x27')]({'raw':_0x447bba[_0x7212('0x9')]?_0x447bba['options'][_0x7212('0x19')]===undefined?!![]:![]:!![],'where':_0x447bba[_0x7212('0x9')]?_0x447bba[_0x7212('0x9')][_0x7212('0xa')]||null:null,'attributes':_0x447bba[_0x7212('0x9')]?_0x447bba['options']['attributes']||null:null,'limit':_0x447bba['options']?_0x447bba[_0x7212('0x9')][_0x7212('0xc')]||null:null,'include':_0x447bba[_0x7212('0x9')]?_0x447bba[_0x7212('0x9')][_0x7212('0xd')]?_[_0x7212('0xe')](_0x447bba[_0x7212('0x9')][_0x7212('0xd')],function(_0x5c74db){return{'model':db[_0x5c74db[_0x7212('0xf')]],'as':_0x5c74db['as'],'attributes':_0x5c74db['as']===_0x7212('0x43')?_[_0x7212('0x44')](_0x1afdd2):_0x5c74db[_0x7212('0xb')],'include':_0x5c74db['include']?_[_0x7212('0xe')](_0x5c74db['include'],function(_0x55ff2e){return{'model':db[_0x55ff2e[_0x7212('0xf')]],'as':_0x55ff2e['as'],'attributes':_0x55ff2e[_0x7212('0xb')],'include':_0x55ff2e[_0x7212('0xd')]?_[_0x7212('0xe')](_0x55ff2e['include'],function(_0x1fc5b4){return{'model':db[_0x1fc5b4[_0x7212('0xf')]],'as':_0x1fc5b4['as'],'attributes':_0x1fc5b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7212('0x10')](function(_0x564fd8){logger[_0x7212('0x11')](_0x7212('0x7'),_0x447bba);logger['debug'](_0x7212('0x7'),_0x447bba,JSON[_0x7212('0x13')](_0x564fd8));_0x3afe1c(_0x564fd8);})[_0x7212('0x14')](function(_0x157ca8){logger[_0x7212('0x15')](_0x7212('0x7'),_0x157ca8[_0x7212('0x16')],_0x447bba);_0x3a1793(_0x17dc59['error'](0x1f4,_0x157ca8[_0x7212('0x16')]));});});});};exports['GetContactByPhone']=function(_0x214e81){var _0x205e14=this;return new Promise(function(_0x50274e,_0x39054e){return db[_0x7212('0x24')]['findOne']({'raw':!![],'where':{'phone':_0x214e81['options'][_0x7212('0xa')][_0x7212('0x45')]},'attributes':['id',_0x7212('0x46')],'order':[['id',_0x7212('0x47')]]})[_0x7212('0x10')](function(_0xee3560){logger[_0x7212('0x11')](_0x7212('0x48'),_0x214e81);logger[_0x7212('0x12')](_0x7212('0x48'),_0x214e81,JSON[_0x7212('0x13')](_0xee3560));_0x50274e(_0xee3560);})[_0x7212('0x14')](function(_0x2a85dc){logger[_0x7212('0x15')]('getContactByPhone',_0x2a85dc[_0x7212('0x16')],_0x214e81);_0x39054e(_0x205e14[_0x7212('0x15')](0x1f4,_0x2a85dc[_0x7212('0x16')]));});});};exports[_0x7212('0x49')]=function(_0x18d760){var _0x2ed5df=this;return new Promise(function(_0x5b12ec,_0xbd8d38){return db['sequelize']['transaction'](function(_0x5b7413){var _0x1b41a8=_0x18d760[_0x7212('0x9')]&&_0x18d760[_0x7212('0x9')][_0x7212('0xa')]?_0x18d760['options'][_0x7212('0xa')]:{};return db[_0x7212('0x8')]['update'](_0x18d760[_0x7212('0x1e')],{'where':_0x1b41a8,'transaction':_0x5b7413})['then'](function(_0x25e896){logger[_0x7212('0x11')](_0x7212('0x49'),_0x18d760);logger['debug']('ResetActiveCalls',_0x18d760,JSON[_0x7212('0x13')](_0x25e896));_0x5b12ec(_0x25e896);})['catch'](function(_0x3ed664){logger[_0x7212('0x15')](_0x7212('0x49'),_0x3ed664[_0x7212('0x16')],_0x18d760);_0xbd8d38(_0x2ed5df[_0x7212('0x15')](0x1f4,_0x3ed664[_0x7212('0x16')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x3d325f){var _0x19d02f=this;var _0x17e312=_0x3d325f[_0x7212('0x1e')][_0x7212('0xa')][_0x7212('0x4a')];var _0x2f3eaa=_0x3d325f[_0x7212('0x1e')][_0x7212('0xa')][_0x7212('0x4b')];var _0x34df71=_0x3d325f[_0x7212('0x1e')]['where']['availableAgentsIds'];return new Promise(function(_0xe1b975,_0x1f176d){return db[_0x7212('0x8')][_0x7212('0x27')]({'where':{'voiceQueueId':{'$in':_0x17e312},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x7212('0x4c')](_0x7212('0x4d')+_0x2f3eaa+'\x20MINUTE'),'$gt':db['sequelize']['literal'](_0x7212('0x4e'))}},'UserId':{'$in':_0x34df71}},'include':[{'model':db['CmContact'],'as':_0x7212('0x43')},{'model':db[_0x7212('0x29')],'as':'Agent','attributes':['id',_0x7212('0x2b'),_0x7212('0x2c')]},{'model':db[_0x7212('0x4f')],'as':_0x7212('0x50')}]})[_0x7212('0x10')](function(_0x3d3616){if(_0x3d3616[_0x7212('0x41')]>0x0){return db[_0x7212('0x26')]['transaction'](function(_0x145e5d){return db[_0x7212('0x8')]['update']({'recallmeNotifiedDate':db[_0x7212('0x26')]['literal'](_0x7212('0x4e'))},{'where':{'id':{'$in':_[_0x7212('0xe')](_0x3d3616,'id')}},'transaction':_0x145e5d})[_0x7212('0x10')](function(){_0xe1b975(_0x3d3616);})[_0x7212('0x14')](function(_0x4ac19d){logger['error'](_0x7212('0x51'),_0x4ac19d[_0x7212('0x16')],_0x3d325f);_0x1f176d(_0x19d02f['error'](0x1f4,_0x4ac19d[_0x7212('0x16')]));});})[_0x7212('0x14')](function(_0x3b4ab8){logger[_0x7212('0x15')]('CmHopperHandlePreviewRecallNotifications',_0x3b4ab8['message'],_0x3d325f);_0x1f176d(_0x19d02f[_0x7212('0x15')](0x1f4,_0x3b4ab8[_0x7212('0x16')]));});}else{_0xe1b975(_0x3d3616);}});});}; \ No newline at end of file +var _0xf5fd=['UPDATE','CmContact','Contact','keys','User','Agent','name','length','includes','push','update','all','GetContactDialer','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','UserId','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','lodash','util','moment','bluebird','GetCmHopper','CmHopper','findAll','options','raw','where','limit','map','include','model','attributes','then','debug','stringify','catch','error','message','ShowCmHopper','find','info','create','body','CreateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','UpdateCmHopper','DestroyCmHopper','destroy','describe','sequelize','transaction','order','LOCK'];(function(_0xe6e557,_0x4f724b){var _0x15f8a1=function(_0x50a1cf){while(--_0x50a1cf){_0xe6e557['push'](_0xe6e557['shift']());}};_0x15f8a1(++_0x4f724b);}(_0xf5fd,0xc8));var _0xdf5f=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xf5fd[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xdf5f('0x0'));var util=require(_0xdf5f('0x1'));var moment=require(_0xdf5f('0x2'));var BPromise=require(_0xdf5f('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');exports[_0xdf5f('0x4')]=function(_0x3ad100){var _0x356f09=this;return new Promise(function(_0x31f9f8,_0x4835a8){return db[_0xdf5f('0x5')][_0xdf5f('0x6')]({'raw':_0x3ad100[_0xdf5f('0x7')]?_0x3ad100['options'][_0xdf5f('0x8')]===undefined?!![]:![]:!![],'where':_0x3ad100[_0xdf5f('0x7')]?_0x3ad100[_0xdf5f('0x7')][_0xdf5f('0x9')]||null:null,'attributes':_0x3ad100[_0xdf5f('0x7')]?_0x3ad100['options']['attributes']||null:null,'limit':_0x3ad100[_0xdf5f('0x7')]?_0x3ad100[_0xdf5f('0x7')][_0xdf5f('0xa')]||null:null,'include':_0x3ad100[_0xdf5f('0x7')]?_0x3ad100[_0xdf5f('0x7')]['include']?_[_0xdf5f('0xb')](_0x3ad100[_0xdf5f('0x7')][_0xdf5f('0xc')],function(_0x42f66b){return{'model':db[_0x42f66b[_0xdf5f('0xd')]],'as':_0x42f66b['as'],'attributes':_0x42f66b[_0xdf5f('0xe')],'include':_0x42f66b[_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x42f66b[_0xdf5f('0xc')],function(_0x28954b){return{'model':db[_0x28954b[_0xdf5f('0xd')]],'as':_0x28954b['as'],'attributes':_0x28954b['attributes'],'include':_0x28954b[_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x28954b[_0xdf5f('0xc')],function(_0x25a40c){return{'model':db[_0x25a40c[_0xdf5f('0xd')]],'as':_0x25a40c['as'],'attributes':_0x25a40c[_0xdf5f('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdf5f('0xf')](function(_0x3844ea){logger['info'](_0xdf5f('0x4'),_0x3ad100);logger[_0xdf5f('0x10')](_0xdf5f('0x4'),_0x3ad100,JSON[_0xdf5f('0x11')](_0x3844ea));_0x31f9f8(_0x3844ea);})[_0xdf5f('0x12')](function(_0x3b40b3){logger[_0xdf5f('0x13')](_0xdf5f('0x4'),_0x3b40b3[_0xdf5f('0x14')],_0x3ad100);_0x4835a8(_0x356f09[_0xdf5f('0x13')](0x1f4,_0x3b40b3[_0xdf5f('0x14')]));});});};exports[_0xdf5f('0x15')]=function(_0x49008f){var _0x1d3b6b=this;return new Promise(function(_0x9c63e7,_0x19b674){return db['CmHopper'][_0xdf5f('0x16')]({'raw':_0x49008f[_0xdf5f('0x7')]?_0x49008f[_0xdf5f('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x49008f[_0xdf5f('0x7')]?_0x49008f['options']['where']||null:null,'attributes':_0x49008f['options']?_0x49008f[_0xdf5f('0x7')][_0xdf5f('0xe')]||null:null,'include':_0x49008f[_0xdf5f('0x7')]?_0x49008f[_0xdf5f('0x7')][_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x49008f['options'][_0xdf5f('0xc')],function(_0x18415d){return{'model':db[_0x18415d[_0xdf5f('0xd')]],'as':_0x18415d['as'],'attributes':_0x18415d[_0xdf5f('0xe')],'include':_0x18415d[_0xdf5f('0xc')]?_['map'](_0x18415d[_0xdf5f('0xc')],function(_0x54cb1d){return{'model':db[_0x54cb1d[_0xdf5f('0xd')]],'as':_0x54cb1d['as'],'attributes':_0x54cb1d['attributes'],'include':_0x54cb1d[_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x54cb1d[_0xdf5f('0xc')],function(_0x37f092){return{'model':db[_0x37f092[_0xdf5f('0xd')]],'as':_0x37f092['as'],'attributes':_0x37f092['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf5f('0xf')](function(_0x454712){logger[_0xdf5f('0x17')]('ShowCmHopper',_0x49008f);logger[_0xdf5f('0x10')](_0xdf5f('0x15'),_0x49008f,JSON[_0xdf5f('0x11')](_0x454712));_0x9c63e7(_0x454712);})[_0xdf5f('0x12')](function(_0x78d926){logger[_0xdf5f('0x13')]('ShowCmHopper',_0x78d926[_0xdf5f('0x14')],_0x49008f);_0x19b674(_0x1d3b6b[_0xdf5f('0x13')](0x1f4,_0x78d926[_0xdf5f('0x14')]));});});};exports['CreateCmHopper']=function(_0x475251){var _0x501f37=this;return new Promise(function(_0x1afa54,_0x20f4df){return db[_0xdf5f('0x5')][_0xdf5f('0x18')](_0x475251[_0xdf5f('0x19')],{'raw':_0x475251['options']?_0x475251[_0xdf5f('0x7')][_0xdf5f('0x8')]===undefined?!![]:![]:!![]})[_0xdf5f('0xf')](function(_0x2a1aac){logger['info']('CreateCmHopper',_0x475251);logger['debug'](_0xdf5f('0x1a'),_0x475251,JSON[_0xdf5f('0x11')](_0x2a1aac));_0x1afa54(_0x2a1aac);})[_0xdf5f('0x12')](function(_0x39a09a){logger[_0xdf5f('0x13')](_0xdf5f('0x1a'),_0x39a09a[_0xdf5f('0x14')],_0x475251);_0x20f4df(_0x501f37[_0xdf5f('0x13')](0x1f4,_0x39a09a['message']));});});};exports['UpdateCmHopper']=function(_0x9325c0){var _0x49bcc8=this;return new Promise(function(_0x37b8c4,_0x51fb53){return db[_0xdf5f('0x5')]['update'](_0x9325c0[_0xdf5f('0x19')],{'raw':_0x9325c0[_0xdf5f('0x7')]?_0x9325c0[_0xdf5f('0x7')][_0xdf5f('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9325c0[_0xdf5f('0x7')]?_0x9325c0['options'][_0xdf5f('0x9')]||null:null,'attributes':_0x9325c0[_0xdf5f('0x7')]?_0x9325c0[_0xdf5f('0x7')][_0xdf5f('0xe')]||null:null,'limit':_0x9325c0['options']?_0x9325c0[_0xdf5f('0x7')][_0xdf5f('0xa')]||null:null})['then'](function(_0x3b1692){logger['info']('UpdateCmHopper',_0x9325c0);logger[_0xdf5f('0x17')](_0xdf5f('0x1b'),JSON[_0xdf5f('0x11')](_0x9325c0['options'][_0xdf5f('0x9')]),_0x9325c0[_0xdf5f('0x19')][_0xdf5f('0x1c')]);logger[_0xdf5f('0x10')](_0xdf5f('0x1d'),_0x9325c0,JSON[_0xdf5f('0x11')](_0x3b1692));_0x37b8c4(_0x3b1692);})[_0xdf5f('0x12')](function(_0x4329f2){logger[_0xdf5f('0x13')](_0xdf5f('0x1d'),_0x4329f2[_0xdf5f('0x14')],_0x9325c0);_0x51fb53(_0x49bcc8[_0xdf5f('0x13')](0x1f4,_0x4329f2[_0xdf5f('0x14')]));});});};exports[_0xdf5f('0x1e')]=function(_0x5e3bf0){var _0x42dfd4=this;return new Promise(function(_0x207120,_0x40a40b){return db[_0xdf5f('0x5')][_0xdf5f('0x1f')]({'where':_0x5e3bf0[_0xdf5f('0x7')]?_0x5e3bf0['options'][_0xdf5f('0x9')]||null:null})[_0xdf5f('0xf')](function(_0x522b8b){logger['info'](_0xdf5f('0x1e'),_0x5e3bf0);logger[_0xdf5f('0x10')]('DestroyCmHopper',_0x5e3bf0,JSON[_0xdf5f('0x11')](_0x522b8b));_0x207120(_0x522b8b);})[_0xdf5f('0x12')](function(_0x2cde7a){logger['error'](_0xdf5f('0x1e'),_0x2cde7a[_0xdf5f('0x14')],_0x5e3bf0);_0x40a40b(_0x42dfd4[_0xdf5f('0x13')](0x1f4,_0x2cde7a[_0xdf5f('0x14')]));});});};exports['GetContactDialer']=function(_0x3e7222){var _0x4f8a25=this;return new Promise(function(_0x1b71f6,_0x3e36db){return db['CmContact'][_0xdf5f('0x20')]()[_0xdf5f('0xf')](function(_0x33d81a){return db[_0xdf5f('0x21')][_0xdf5f('0x22')](function(_0x3c3e5a){return db['CmHopper'][_0xdf5f('0x6')]({'where':_0x3e7222[_0xdf5f('0x7')]?_0x3e7222['options']['where']||null:null,'attributes':_0x3e7222[_0xdf5f('0x7')]?_0x3e7222['options']['attributes']||null:null,'limit':_0x3e7222[_0xdf5f('0x7')]?_0x3e7222[_0xdf5f('0x7')][_0xdf5f('0xa')]||null:null,'order':_0x3e7222[_0xdf5f('0x7')]?_0x3e7222[_0xdf5f('0x7')][_0xdf5f('0x23')]||null:null,'transaction':_0x3c3e5a,'lock':_0x3c3e5a[_0xdf5f('0x24')][_0xdf5f('0x25')],'include':[{'model':db[_0xdf5f('0x26')],'as':_0xdf5f('0x27'),'attributes':_[_0xdf5f('0x28')](_0x33d81a)},{'model':db[_0xdf5f('0x29')],'as':_0xdf5f('0x2a'),'attributes':['id',_0xdf5f('0x2b'),'voicePause']}]})[_0xdf5f('0xf')](function(_0x258391){var _0x34a776=[];var _0x5f05ee=[];for(var _0x559244=0x0;_0x559244<_0x258391[_0xdf5f('0x2c')];_0x559244+=0x1){var _0x2991c4=_0x258391[_0x559244]['UserId'];if(_0x2991c4===null){_0x34a776['push'](_0x258391[_0x559244]['update'](_0x3e7222[_0xdf5f('0x19')],{'transaction':_0x3c3e5a}));}else if(!_0x5f05ee[_0xdf5f('0x2d')](_0x2991c4)){_0x5f05ee[_0xdf5f('0x2e')](_0x2991c4);_0x34a776[_0xdf5f('0x2e')](_0x258391[_0x559244][_0xdf5f('0x2f')](_0x3e7222['body'],{'transaction':_0x3c3e5a}));}}return BPromise[_0xdf5f('0x30')](_0x34a776);});})[_0xdf5f('0xf')](function(_0x3c3065){logger[_0xdf5f('0x17')](_0xdf5f('0x31'),_0x3e7222);if(_0x3c3065[_0xdf5f('0x2c')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x3c3065[0x0][_0xdf5f('0x32')]['id'],_0x3c3065[0x0][_0xdf5f('0x32')][_0xdf5f('0x33')],_0x3c3065[0x0][_0xdf5f('0x32')][_0xdf5f('0x1c')]);}logger['debug']('GetContactDialer',_0x3e7222,JSON['stringify'](_0x3c3065));_0x1b71f6(_0x3c3065);})[_0xdf5f('0x12')](function(_0x2d90ad){logger[_0xdf5f('0x13')](_0xdf5f('0x31'),_0x2d90ad[_0xdf5f('0x14')],_0x3e7222);_0x3e36db(_0x4f8a25['error'](0x1f4,_0x2d90ad[_0xdf5f('0x14')]));});});});};exports[_0xdf5f('0x34')]=function(_0x55edc3){var _0x425645=this;return new Promise(function(_0x290232,_0x3a05c2){return db[_0xdf5f('0x21')]['transaction'](function(_0x2377ec){return db[_0xdf5f('0x35')][_0xdf5f('0x18')](_0x55edc3['body'],{'raw':_0x55edc3[_0xdf5f('0x7')]?_0x55edc3[_0xdf5f('0x7')][_0xdf5f('0x8')]===undefined?!![]:![]:!![],'transaction':_0x2377ec})['then'](function(){logger[_0xdf5f('0x17')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdf5f('0x11')](_0x55edc3['options'][_0xdf5f('0x9')]),_0x55edc3[_0xdf5f('0x7')][_0xdf5f('0x9')][_0xdf5f('0x1c')]);return db[_0xdf5f('0x5')][_0xdf5f('0x1f')]({'where':_0x55edc3[_0xdf5f('0x7')]?_0x55edc3[_0xdf5f('0x7')]['where']||null:null,'transaction':_0x2377ec});});})['then'](function(_0x1a6a0d){logger[_0xdf5f('0x17')]('MoveContactManagedDialer',_0x55edc3);logger[_0xdf5f('0x10')](_0xdf5f('0x34'),_0x55edc3,JSON[_0xdf5f('0x11')](_0x1a6a0d));_0x290232(_0x1a6a0d);})[_0xdf5f('0x12')](function(_0x23d223){logger[_0xdf5f('0x13')](_0xdf5f('0x34'),_0x23d223['message'],_0x55edc3);_0x3a05c2(_0x425645['error'](0x1f4,_0x23d223[_0xdf5f('0x14')]));});});};exports[_0xdf5f('0x36')]=function(_0x2ee129){var _0x4ad5a4=this;return new Promise(function(_0xfb146a,_0x3138de){return db['CmHopper'][_0xdf5f('0x6')]({'raw':_0x2ee129[_0xdf5f('0x7')]?_0x2ee129[_0xdf5f('0x7')][_0xdf5f('0x8')]===undefined?!![]:![]:!![],'where':_0x2ee129[_0xdf5f('0x7')]?_0x2ee129[_0xdf5f('0x7')][_0xdf5f('0x9')]||null:null,'attributes':[[db[_0xdf5f('0x21')]['fn'](_0xdf5f('0x37'),db[_0xdf5f('0x21')]['fn']('IF',db['sequelize'][_0xdf5f('0x38')](_0xdf5f('0x39')+util[_0xdf5f('0x3a')](_0xdf5f('0x3b'),moment()[_0xdf5f('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xdf5f('0x3c')))),'contactsRescheduled']]})[_0xdf5f('0xf')](function(_0x426b10){logger[_0xdf5f('0x17')]('CountReScheduled',_0x2ee129);logger[_0xdf5f('0x10')](_0xdf5f('0x36'),_0x2ee129,JSON[_0xdf5f('0x11')](_0x426b10));_0xfb146a(_0x426b10);})['catch'](function(_0x12a232){logger[_0xdf5f('0x13')](_0xdf5f('0x36'),_0x12a232['message'],_0x2ee129);_0x3138de(_0x4ad5a4[_0xdf5f('0x13')](0x1f4,_0x12a232[_0xdf5f('0x14')]));});});};exports['GetContactRecallMe']=function(_0x201ad6){var _0x32b6bd=this;return new Promise(function(_0x9ff6c6,_0x309830){return db['CmContact'][_0xdf5f('0x20')]()[_0xdf5f('0xf')](function(){return db[_0xdf5f('0x21')][_0xdf5f('0x22')](function(_0x22405f){return db[_0xdf5f('0x5')][_0xdf5f('0x6')]({'where':_0x201ad6['options']?_0x201ad6[_0xdf5f('0x7')][_0xdf5f('0x9')]||null:null,'attributes':_0x201ad6['options']?_0x201ad6[_0xdf5f('0x7')][_0xdf5f('0xe')]||null:null,'limit':0x1,'order':_0x201ad6[_0xdf5f('0x7')]?_0x201ad6['options'][_0xdf5f('0x23')]||null:null,'group':db[_0xdf5f('0x5')][_0xdf5f('0x3d')],'transaction':_0x22405f,'lock':_0x22405f[_0xdf5f('0x24')]['UPDATE'],'include':_0x201ad6[_0xdf5f('0x7')]?_0x201ad6[_0xdf5f('0x7')][_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x201ad6[_0xdf5f('0x7')]['include'],function(_0x39146e){return{'model':db[_0x39146e[_0xdf5f('0xd')]],'as':_0x39146e['as'],'attributes':_0x39146e['attributes'],'include':_0x39146e[_0xdf5f('0xc')]?_['map'](_0x39146e[_0xdf5f('0xc')],function(_0x24e3bb){return{'model':db[_0x24e3bb[_0xdf5f('0xd')]],'as':_0x24e3bb['as'],'attributes':_0x24e3bb[_0xdf5f('0xe')],'include':_0x24e3bb[_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x24e3bb[_0xdf5f('0xc')],function(_0x2ca082){return{'model':db[_0x2ca082[_0xdf5f('0xd')]],'as':_0x2ca082['as'],'attributes':_0x2ca082['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x371bc3){var _0x4478a1=[];for(var _0x5ee9ec=0x0;_0x5ee9ec<_0x371bc3[_0xdf5f('0x2c')];_0x5ee9ec+=0x1){_0x4478a1['push'](_0x371bc3[_0x5ee9ec][_0xdf5f('0x2f')](_0x201ad6[_0xdf5f('0x19')],{'transaction':_0x22405f}));}return BPromise[_0xdf5f('0x30')](_0x4478a1);});})[_0xdf5f('0xf')](function(_0x28ec8f){logger[_0xdf5f('0x17')](_0xdf5f('0x3e'),_0x201ad6);logger[_0xdf5f('0x10')]('GetContactRecallMe',_0x201ad6,JSON[_0xdf5f('0x11')](_0x28ec8f));_0x9ff6c6(_0x28ec8f);})['catch'](function(_0x40cd59){logger['error'](_0xdf5f('0x3e'),_0x40cd59[_0xdf5f('0x14')],_0x201ad6);_0x309830(_0x32b6bd[_0xdf5f('0x13')](0x1f4,_0x40cd59[_0xdf5f('0x14')]));});});});};exports[_0xdf5f('0x3f')]=function(_0x5c02b6){var _0x51964f=this;return new Promise(function(_0x5ad55e,_0x32a889){db['CmContact'][_0xdf5f('0x20')]()['then'](function(_0xd324b6){return db[_0xdf5f('0x5')]['findAll']({'raw':_0x5c02b6[_0xdf5f('0x7')]?_0x5c02b6[_0xdf5f('0x7')][_0xdf5f('0x8')]===undefined?!![]:![]:!![],'where':_0x5c02b6['options']?_0x5c02b6[_0xdf5f('0x7')][_0xdf5f('0x9')]||null:null,'attributes':_0x5c02b6[_0xdf5f('0x7')]?_0x5c02b6['options']['attributes']||null:null,'limit':_0x5c02b6[_0xdf5f('0x7')]?_0x5c02b6[_0xdf5f('0x7')][_0xdf5f('0xa')]||null:null,'include':_0x5c02b6[_0xdf5f('0x7')]?_0x5c02b6[_0xdf5f('0x7')][_0xdf5f('0xc')]?_['map'](_0x5c02b6[_0xdf5f('0x7')]['include'],function(_0x2df93e){return{'model':db[_0x2df93e['model']],'as':_0x2df93e['as'],'attributes':_0x2df93e['as']===_0xdf5f('0x27')?_['keys'](_0xd324b6):_0x2df93e[_0xdf5f('0xe')],'include':_0x2df93e[_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x2df93e[_0xdf5f('0xc')],function(_0x5498ca){return{'model':db[_0x5498ca['model']],'as':_0x5498ca['as'],'attributes':_0x5498ca[_0xdf5f('0xe')],'include':_0x5498ca[_0xdf5f('0xc')]?_[_0xdf5f('0xb')](_0x5498ca['include'],function(_0x52f353){return{'model':db[_0x52f353[_0xdf5f('0xd')]],'as':_0x52f353['as'],'attributes':_0x52f353[_0xdf5f('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdf5f('0xf')](function(_0x25a58d){logger[_0xdf5f('0x17')]('GetCmHopper',_0x5c02b6);logger[_0xdf5f('0x10')](_0xdf5f('0x4'),_0x5c02b6,JSON[_0xdf5f('0x11')](_0x25a58d));_0x5ad55e(_0x25a58d);})[_0xdf5f('0x12')](function(_0x23842d){logger['error'](_0xdf5f('0x4'),_0x23842d[_0xdf5f('0x14')],_0x5c02b6);_0x32a889(_0x51964f[_0xdf5f('0x13')](0x1f4,_0x23842d[_0xdf5f('0x14')]));});});});};exports[_0xdf5f('0x40')]=function(_0x2e3deb){var _0x170545=this;return new Promise(function(_0x54fea0,_0x1eae72){return db['CmContact'][_0xdf5f('0x41')]({'raw':!![],'where':{'phone':_0x2e3deb[_0xdf5f('0x7')][_0xdf5f('0x9')][_0xdf5f('0x42')]},'attributes':['id',_0xdf5f('0x43')],'order':[['id',_0xdf5f('0x44')]]})['then'](function(_0x2aa88d){logger[_0xdf5f('0x17')](_0xdf5f('0x45'),_0x2e3deb);logger[_0xdf5f('0x10')](_0xdf5f('0x45'),_0x2e3deb,JSON['stringify'](_0x2aa88d));_0x54fea0(_0x2aa88d);})[_0xdf5f('0x12')](function(_0x2005db){logger['error']('getContactByPhone',_0x2005db[_0xdf5f('0x14')],_0x2e3deb);_0x1eae72(_0x170545['error'](0x1f4,_0x2005db[_0xdf5f('0x14')]));});});};exports[_0xdf5f('0x46')]=function(_0x12f008){var _0x312baa=this;return new Promise(function(_0x5dbb5b,_0x55ace3){return db[_0xdf5f('0x21')][_0xdf5f('0x22')](function(_0x7e89cf){var _0x4f6f80=_0x12f008[_0xdf5f('0x7')]&&_0x12f008[_0xdf5f('0x7')][_0xdf5f('0x9')]?_0x12f008[_0xdf5f('0x7')][_0xdf5f('0x9')]:{};return db[_0xdf5f('0x5')]['update'](_0x12f008[_0xdf5f('0x19')],{'where':_0x4f6f80,'transaction':_0x7e89cf})[_0xdf5f('0xf')](function(_0x4cbfaa){logger['info'](_0xdf5f('0x46'),_0x12f008);logger[_0xdf5f('0x10')](_0xdf5f('0x46'),_0x12f008,JSON['stringify'](_0x4cbfaa));_0x5dbb5b(_0x4cbfaa);})[_0xdf5f('0x12')](function(_0x54072d){logger[_0xdf5f('0x13')]('ResetActiveCalls',_0x54072d[_0xdf5f('0x14')],_0x12f008);_0x55ace3(_0x312baa[_0xdf5f('0x13')](0x1f4,_0x54072d['message']));});});});};exports[_0xdf5f('0x47')]=function(_0x5ba3b3){var _0x1a9321=this;var _0x14e687=_0x5ba3b3[_0xdf5f('0x19')]['where'][_0xdf5f('0x48')];var _0x227fe0=_0x5ba3b3[_0xdf5f('0x19')][_0xdf5f('0x9')][_0xdf5f('0x49')];var _0x1860b3=_0x5ba3b3['body']['where'][_0xdf5f('0x4a')];return new Promise(function(_0x3c4d5c,_0x14cd07){return db[_0xdf5f('0x5')]['findAll']({'where':{'voiceQueueId':{'$in':_0x14e687},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xdf5f('0x38')](_0xdf5f('0x4b')+_0x227fe0+_0xdf5f('0x4c')),'$gt':db['sequelize']['literal'](_0xdf5f('0x4d'))}},'UserId':{'$in':_0x1860b3}},'include':[{'model':db[_0xdf5f('0x26')],'as':_0xdf5f('0x27')},{'model':db[_0xdf5f('0x29')],'as':_0xdf5f('0x2a'),'attributes':['id',_0xdf5f('0x2b'),'voicePause']},{'model':db[_0xdf5f('0x4e')],'as':'List'}]})[_0xdf5f('0xf')](function(_0x30ad6c){if(_0x30ad6c[_0xdf5f('0x2c')]>0x0){return db[_0xdf5f('0x21')][_0xdf5f('0x22')](function(_0x2d9be2){return db[_0xdf5f('0x5')][_0xdf5f('0x2f')]({'recallmeNotifiedDate':db['sequelize']['literal'](_0xdf5f('0x4d'))},{'where':{'id':{'$in':_[_0xdf5f('0xb')](_0x30ad6c,'id')}},'transaction':_0x2d9be2})['then'](function(){_0x3c4d5c(_0x30ad6c);})[_0xdf5f('0x12')](function(_0x22e16d){logger[_0xdf5f('0x13')](_0xdf5f('0x47'),_0x22e16d[_0xdf5f('0x14')],_0x5ba3b3);_0x14cd07(_0x1a9321[_0xdf5f('0x13')](0x1f4,_0x22e16d[_0xdf5f('0x14')]));});})[_0xdf5f('0x12')](function(_0x5197b0){logger['error'](_0xdf5f('0x47'),_0x5197b0[_0xdf5f('0x14')],_0x5ba3b3);_0x14cd07(_0x1a9321[_0xdf5f('0x13')](0x1f4,_0x5197b0['message']));});}else{_0x3c4d5c(_0x30ad6c);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index cc577d7..7b054a0 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 _0xcc60=['getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','Router','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones'];(function(_0x5016d0,_0xaa7512){var _0x3f2cae=function(_0x1a8a5e){while(--_0x1a8a5e){_0x5016d0['push'](_0x5016d0['shift']());}};_0x3f2cae(++_0xaa7512);}(_0xcc60,0x1c2));var _0x0cc6=function(_0x4cc4af,_0xff9505){_0x4cc4af=_0x4cc4af-0x0;var _0x2bdac8=_0xcc60[_0x4cc4af];return _0x2bdac8;};'use strict';var express=require('express');var router=express[_0x0cc6('0x0')]();var auth=require(_0x0cc6('0x1'));var controller=require('./cmHopper.controller');router[_0x0cc6('0x2')]('/',auth['isAuthenticated'](),controller[_0x0cc6('0x3')]);router[_0x0cc6('0x2')](_0x0cc6('0x4'),auth[_0x0cc6('0x5')](),controller[_0x0cc6('0x6')]);router[_0x0cc6('0x2')](_0x0cc6('0x7'),auth['isAuthenticated'](),controller[_0x0cc6('0x8')]);router[_0x0cc6('0x2')](_0x0cc6('0x9'),auth[_0x0cc6('0x5')](),controller[_0x0cc6('0xa')]);router['get'](_0x0cc6('0xb'),auth[_0x0cc6('0x5')](),controller['show']);router[_0x0cc6('0x2')](_0x0cc6('0xc'),auth[_0x0cc6('0x5')](),controller[_0x0cc6('0xd')]);router[_0x0cc6('0xe')]('/',auth[_0x0cc6('0x5')](),controller[_0x0cc6('0xf')]);router[_0x0cc6('0xe')](_0x0cc6('0x10'),auth[_0x0cc6('0x5')](),controller[_0x0cc6('0x11')]);router[_0x0cc6('0xe')](_0x0cc6('0x12'),auth[_0x0cc6('0x5')](),controller[_0x0cc6('0x13')]);router['put']('/:id',auth[_0x0cc6('0x5')](),controller[_0x0cc6('0x14')]);router[_0x0cc6('0x15')]('/:id',auth[_0x0cc6('0x5')](),controller[_0x0cc6('0x16')]);module['exports']=router; \ No newline at end of file +var _0x9071=['describe','/opencontacts','getOpenContacts','/timezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete','exports','Router','../../components/auth/service','get','isAuthenticated','/describe'];(function(_0x469cae,_0x22fd94){var _0x4f85aa=function(_0x20a62f){while(--_0x20a62f){_0x469cae['push'](_0x469cae['shift']());}};_0x4f85aa(++_0x22fd94);}(_0x9071,0x16b));var _0x1907=function(_0x399d08,_0x314da5){_0x399d08=_0x399d08-0x0;var _0x46edd2=_0x9071[_0x399d08];return _0x46edd2;};'use strict';var express=require('express');var router=express[_0x1907('0x0')]();var auth=require(_0x1907('0x1'));var controller=require('./cmHopper.controller');router[_0x1907('0x2')]('/',auth[_0x1907('0x3')](),controller['index']);router[_0x1907('0x2')](_0x1907('0x4'),auth[_0x1907('0x3')](),controller[_0x1907('0x5')]);router[_0x1907('0x2')](_0x1907('0x6'),auth[_0x1907('0x3')](),controller[_0x1907('0x7')]);router['get'](_0x1907('0x8'),auth[_0x1907('0x3')](),controller['getTimezones']);router[_0x1907('0x2')](_0x1907('0x9'),auth[_0x1907('0x3')](),controller[_0x1907('0xa')]);router[_0x1907('0x2')](_0x1907('0xb'),auth[_0x1907('0x3')](),controller[_0x1907('0xc')]);router[_0x1907('0xd')]('/',auth['isAuthenticated'](),controller[_0x1907('0xe')]);router['post'](_0x1907('0xf'),auth[_0x1907('0x3')](),controller[_0x1907('0x10')]);router[_0x1907('0xd')](_0x1907('0x11'),auth[_0x1907('0x3')](),controller[_0x1907('0x12')]);router[_0x1907('0x13')](_0x1907('0x9'),auth[_0x1907('0x3')](),controller[_0x1907('0x14')]);router[_0x1907('0x15')](_0x1907('0x9'),auth[_0x1907('0x3')](),controller['destroy']);module[_0x1907('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index db7cb5b..46021c5 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 _0xcd01=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER','DATE','format'];(function(_0x3aae33,_0x4ad899){var _0x527e87=function(_0x524f74){while(--_0x524f74){_0x3aae33['push'](_0x3aae33['shift']());}};_0x527e87(++_0x4ad899);}(_0xcd01,0xd9));var _0x1cd0=function(_0x24136f,_0x526392){_0x24136f=_0x24136f-0x0;var _0x38dc46=_0xcd01[_0x24136f];return _0x38dc46;};'use strict';var moment=require('moment');var Sequelize=require(_0x1cd0('0x0'));module[_0x1cd0('0x1')]={'CmHopperId':{'type':Sequelize[_0x1cd0('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x1cd0('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1cd0('0x3')],'defaultValue':moment()[_0x1cd0('0x4')](_0x1cd0('0x5'))},'countbusyretry':{'type':Sequelize[_0x1cd0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1cd0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1cd0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1cd0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1cd0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1cd0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6173=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','INTEGER','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6173,0x156));var _0x3617=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6173[_0x1035c1];return _0x308d67;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x3617('0x0')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3617('0x2')],'defaultValue':moment()[_0x3617('0x3')](_0x3617('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3617('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 2383b43..8fd108d 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 _0x7277=['save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','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','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x157ef5,_0x2d2e5f){var _0x1f6596=function(_0x446c1d){while(--_0x446c1d){_0x157ef5['push'](_0x157ef5['shift']());}};_0x1f6596(++_0x2d2e5f);}(_0x7277,0x84));var _0x7727=function(_0x46a00e,_0x595365){_0x46a00e=_0x46a00e-0x0;var _0x1b3984=_0x7277[_0x46a00e];return _0x1b3984;};'use strict';var emlformat=require(_0x7727('0x0'));var rimraf=require(_0x7727('0x1'));var zipdir=require(_0x7727('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7727('0x3'));var moment=require('moment');var BPromise=require(_0x7727('0x4'));var Mustache=require(_0x7727('0x5'));var util=require(_0x7727('0x6'));var path=require('path');var sox=require(_0x7727('0x7'));var csv=require(_0x7727('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7727('0x9'));var _=require('lodash');var squel=require(_0x7727('0xa'));var crypto=require(_0x7727('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7727('0xc'));var Papa=require(_0x7727('0xd'));var Redis=require(_0x7727('0xe'));var authService=require(_0x7727('0xf'));var qs=require(_0x7727('0x10'));var as=require(_0x7727('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7727('0x12'));var utils=require(_0x7727('0x13'));var config=require(_0x7727('0x14'));var licenseUtil=require(_0x7727('0x15'));var db=require(_0x7727('0x16'))['db'];function respondWithStatusCode(_0x1887b4,_0x203654){_0x203654=_0x203654||0xcc;return function(_0x93fe64){if(_0x93fe64){return _0x1887b4[_0x7727('0x17')](_0x203654);}return _0x1887b4[_0x7727('0x18')](_0x203654)[_0x7727('0x19')]();};}function respondWithResult(_0x4979b3,_0x151d0d){_0x151d0d=_0x151d0d||0xc8;return function(_0x2582ef){if(_0x2582ef){return _0x4979b3[_0x7727('0x18')](_0x151d0d)[_0x7727('0x1a')](_0x2582ef);}};}function respondWithFilteredResult(_0x760572,_0x2065f8){return function(_0x567301){if(_0x567301){var _0x407ca3=typeof _0x2065f8[_0x7727('0x1b')]===_0x7727('0x1c')&&typeof _0x2065f8[_0x7727('0x1d')]==='undefined';var _0x715d7f=_0x567301[_0x7727('0x1e')];var _0x305054=_0x407ca3?0x0:_0x2065f8['offset'];var _0x191594=_0x407ca3?_0x567301[_0x7727('0x1e')]:_0x2065f8['offset']+_0x2065f8[_0x7727('0x1d')];var _0x572075;if(_0x191594>=_0x715d7f){_0x191594=_0x715d7f;_0x572075=0xc8;}else{_0x572075=0xce;}_0x760572[_0x7727('0x18')](_0x572075);return _0x760572['set'](_0x7727('0x1f'),_0x305054+'-'+_0x191594+'/'+_0x715d7f)[_0x7727('0x1a')](_0x567301);}return null;};}function patchUpdates(_0x2626a8){return function(_0x58a497){try{jsonpatch[_0x7727('0x20')](_0x58a497,_0x2626a8,!![]);}catch(_0x1fc08c){return BPromise[_0x7727('0x21')](_0x1fc08c);}return _0x58a497[_0x7727('0x22')]();};}function saveUpdates(_0xc2bbb8,_0x1e3760){return function(_0x25ac9e){if(_0x25ac9e){return _0x25ac9e['update'](_0xc2bbb8)[_0x7727('0x23')](function(_0x5bc02d){return _0x5bc02d;});}return null;};}function removeEntity(_0x5c5452,_0x3d2f92){return function(_0x518481){if(_0x518481){return _0x518481[_0x7727('0x24')]()['then'](function(){var _0x289e3a=_0x518481[_0x7727('0x25')]({'plain':!![]});var _0x114c86=_0x7727('0x26');return db[_0x7727('0x27')]['destroy']({'where':{'type':_0x114c86,'resourceId':_0x289e3a['id']}})[_0x7727('0x23')](function(){return _0x518481;});})[_0x7727('0x23')](function(){_0x5c5452[_0x7727('0x18')](0xcc)[_0x7727('0x19')]();});}};}function handleEntityNotFound(_0x2199a1,_0x2c2520){return function(_0x4cf606){if(!_0x4cf606){_0x2199a1['sendStatus'](0x194);}return _0x4cf606;};}function handleError(_0x33095b,_0x1981ac){_0x1981ac=_0x1981ac||0x1f4;return function(_0x519af1){logger[_0x7727('0x28')](_0x519af1['stack']);if(_0x519af1[_0x7727('0x29')]){delete _0x519af1['name'];}_0x33095b[_0x7727('0x18')](_0x1981ac)[_0x7727('0x2a')](_0x519af1);};}exports[_0x7727('0x2b')]=function(_0x46a64f,_0x4d7310){var _0x1971ca={},_0x26bd29={},_0xce5cf5={'count':0x0,'rows':[]};var _0x2f00bc=_[_0x7727('0x2c')](db[_0x7727('0x2d')][_0x7727('0x2e')],function(_0x199431){return{'name':_0x199431[_0x7727('0x2f')],'type':_0x199431[_0x7727('0x30')][_0x7727('0x31')]};});_0x26bd29[_0x7727('0x32')]=_[_0x7727('0x2c')](_0x2f00bc,'name');_0x26bd29[_0x7727('0x33')]=_['keys'](_0x46a64f[_0x7727('0x33')]);_0x26bd29[_0x7727('0x34')]=_[_0x7727('0x35')](_0x26bd29['model'],_0x26bd29[_0x7727('0x33')]);_0x1971ca[_0x7727('0x36')]=_['intersection'](_0x26bd29[_0x7727('0x32')],qs[_0x7727('0x37')](_0x46a64f[_0x7727('0x33')][_0x7727('0x37')]));_0x1971ca[_0x7727('0x36')]=_0x1971ca[_0x7727('0x36')][_0x7727('0x38')]?_0x1971ca[_0x7727('0x36')]:_0x26bd29[_0x7727('0x32')];if(!_0x46a64f[_0x7727('0x33')]['hasOwnProperty'](_0x7727('0x39'))){_0x1971ca[_0x7727('0x1d')]=qs[_0x7727('0x1d')](_0x46a64f[_0x7727('0x33')][_0x7727('0x1d')]);_0x1971ca['offset']=qs[_0x7727('0x1b')](_0x46a64f[_0x7727('0x33')][_0x7727('0x1b')]);}_0x1971ca['order']=qs[_0x7727('0x3a')](_0x46a64f[_0x7727('0x33')][_0x7727('0x3a')]);_0x1971ca[_0x7727('0x3b')]=qs[_0x7727('0x34')](_[_0x7727('0x3c')](_0x46a64f['query'],_0x26bd29[_0x7727('0x34')]),_0x2f00bc);if(_0x46a64f[_0x7727('0x33')][_0x7727('0x3d')]){_0x1971ca[_0x7727('0x3b')]=_[_0x7727('0x3e')](_0x1971ca['where'],{'$or':_[_0x7727('0x2c')](_0x2f00bc,function(_0x75b67){if(_0x75b67['type']!==_0x7727('0x3f')){var _0x830515={};_0x830515[_0x75b67[_0x7727('0x29')]]={'$like':'%'+_0x46a64f[_0x7727('0x33')][_0x7727('0x3d')]+'%'};return _0x830515;}})});}_0x1971ca=_['merge']({},_0x1971ca,_0x46a64f['options']);var _0x26bfc6={'where':_0x1971ca[_0x7727('0x3b')]};return db[_0x7727('0x2d')]['count'](_0x26bfc6)[_0x7727('0x23')](function(_0x195d45){_0xce5cf5[_0x7727('0x1e')]=_0x195d45;if(_0x46a64f['query'][_0x7727('0x40')]){_0x1971ca[_0x7727('0x41')]=[{'all':!![]}];}return db[_0x7727('0x2d')][_0x7727('0x42')](_0x1971ca);})['then'](function(_0x3bc5a7){_0xce5cf5[_0x7727('0x43')]=_0x3bc5a7;return _0xce5cf5;})[_0x7727('0x23')](respondWithFilteredResult(_0x4d7310,_0x1971ca))[_0x7727('0x44')](handleError(_0x4d7310,null));};exports[_0x7727('0x45')]=function(_0x1f929e,_0x1f2d6c){var _0x4925f4={'raw':!![],'where':{'id':_0x1f929e[_0x7727('0x46')]['id']}},_0x2f5d22={};_0x2f5d22[_0x7727('0x32')]=_[_0x7727('0x47')](db[_0x7727('0x2d')][_0x7727('0x2e')]);_0x2f5d22[_0x7727('0x33')]=_[_0x7727('0x47')](_0x1f929e['query']);_0x2f5d22[_0x7727('0x34')]=_[_0x7727('0x35')](_0x2f5d22[_0x7727('0x32')],_0x2f5d22[_0x7727('0x33')]);_0x4925f4['attributes']=_[_0x7727('0x35')](_0x2f5d22[_0x7727('0x32')],qs[_0x7727('0x37')](_0x1f929e[_0x7727('0x33')][_0x7727('0x37')]));_0x4925f4[_0x7727('0x36')]=_0x4925f4[_0x7727('0x36')][_0x7727('0x38')]?_0x4925f4['attributes']:_0x2f5d22['model'];if(_0x1f929e[_0x7727('0x33')][_0x7727('0x40')]){_0x4925f4['include']=[{'all':!![]}];}_0x4925f4=_[_0x7727('0x3e')]({},_0x4925f4,_0x1f929e[_0x7727('0x48')]);return db[_0x7727('0x2d')][_0x7727('0x49')](_0x4925f4)[_0x7727('0x23')](handleEntityNotFound(_0x1f2d6c,null))[_0x7727('0x23')](respondWithResult(_0x1f2d6c,null))[_0x7727('0x44')](handleError(_0x1f2d6c,null));};exports[_0x7727('0x4a')]=function(_0x46a04b,_0x50f184){return db[_0x7727('0x2d')][_0x7727('0x4a')](_0x46a04b[_0x7727('0x4b')],{})[_0x7727('0x23')](function(_0x415193){var _0x2b1fb1=_0x46a04b[_0x7727('0x4c')][_0x7727('0x25')]({'plain':!![]});if(!_0x2b1fb1)throw new Error(_0x7727('0x4d'));if(_0x2b1fb1[_0x7727('0x4e')]==='user'){var _0x14068f=_0x415193[_0x7727('0x25')]({'plain':!![]});var _0x4eadef='CmHopperAdditionalPhones';return db['UserProfileSection']['find']({'where':{'name':_0x4eadef,'userProfileId':_0x2b1fb1[_0x7727('0x4f')]},'raw':!![]})[_0x7727('0x23')](function(_0xb2b34f){if(_0xb2b34f&&_0xb2b34f[_0x7727('0x50')]===0x0){return db[_0x7727('0x27')][_0x7727('0x4a')]({'name':_0x14068f[_0x7727('0x29')],'resourceId':_0x14068f['id'],'type':_0xb2b34f[_0x7727('0x29')],'sectionId':_0xb2b34f['id']},{})[_0x7727('0x23')](function(){return _0x415193;});}else{return _0x415193;}})[_0x7727('0x44')](function(_0x559521){logger[_0x7727('0x28')](_0x7727('0x51'),_0x559521);throw _0x559521;});}return _0x415193;})['then'](respondWithResult(_0x50f184,0xc9))[_0x7727('0x44')](handleError(_0x50f184,null));};exports[_0x7727('0x52')]=function(_0x27b9b7,_0x137d4a){if(_0x27b9b7[_0x7727('0x4b')]['id']){delete _0x27b9b7['body']['id'];}return db[_0x7727('0x2d')][_0x7727('0x49')]({'where':{'id':_0x27b9b7[_0x7727('0x46')]['id']}})[_0x7727('0x23')](handleEntityNotFound(_0x137d4a,null))[_0x7727('0x23')](saveUpdates(_0x27b9b7[_0x7727('0x4b')],null))[_0x7727('0x23')](respondWithResult(_0x137d4a,null))[_0x7727('0x44')](handleError(_0x137d4a,null));};exports['destroy']=function(_0x1da7a9,_0x2f5be6){return db[_0x7727('0x2d')][_0x7727('0x49')]({'where':{'id':_0x1da7a9[_0x7727('0x46')]['id']}})[_0x7727('0x23')](handleEntityNotFound(_0x2f5be6,null))[_0x7727('0x23')](removeEntity(_0x2f5be6,null))[_0x7727('0x44')](handleError(_0x2f5be6,null));}; \ No newline at end of file +var _0x2a5a=['options','CmHopperAdditionalPhone','includeAll','include','findAll','catch','show','params','keys','find','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x1741c2,_0x22b19c){var _0x3ed7d=function(_0x415158){while(--_0x415158){_0x1741c2['push'](_0x1741c2['shift']());}};_0x3ed7d(++_0x22b19c);}(_0x2a5a,0x10a));var _0xa2a5=function(_0x305d91,_0x273939){_0x305d91=_0x305d91-0x0;var _0x5a545d=_0x2a5a[_0x305d91];return _0x5a545d;};'use strict';var emlformat=require(_0xa2a5('0x0'));var rimraf=require(_0xa2a5('0x1'));var zipdir=require(_0xa2a5('0x2'));var jsonpatch=require(_0xa2a5('0x3'));var rp=require(_0xa2a5('0x4'));var moment=require(_0xa2a5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa2a5('0x6'));var path=require(_0xa2a5('0x7'));var sox=require('sox');var csv=require(_0xa2a5('0x8'));var ejs=require(_0xa2a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2a5('0xa'));var squel=require(_0xa2a5('0xb'));var crypto=require('crypto');var jsforce=require(_0xa2a5('0xc'));var deskjs=require(_0xa2a5('0xd'));var toCsv=require(_0xa2a5('0x8'));var querystring=require(_0xa2a5('0xe'));var Papa=require(_0xa2a5('0xf'));var Redis=require('ioredis');var authService=require(_0xa2a5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2a5('0x11'));var logger=require('../../config/logger')(_0xa2a5('0x12'));var utils=require(_0xa2a5('0x13'));var config=require(_0xa2a5('0x14'));var licenseUtil=require(_0xa2a5('0x15'));var db=require(_0xa2a5('0x16'))['db'];function respondWithStatusCode(_0x167ed1,_0x3386ae){_0x3386ae=_0x3386ae||0xcc;return function(_0x4a7e1a){if(_0x4a7e1a){return _0x167ed1[_0xa2a5('0x17')](_0x3386ae);}return _0x167ed1['status'](_0x3386ae)[_0xa2a5('0x18')]();};}function respondWithResult(_0x334234,_0x1a1d47){_0x1a1d47=_0x1a1d47||0xc8;return function(_0x1be6ab){if(_0x1be6ab){return _0x334234[_0xa2a5('0x19')](_0x1a1d47)[_0xa2a5('0x1a')](_0x1be6ab);}};}function respondWithFilteredResult(_0x186df9,_0x45909d){return function(_0x4ccdf6){if(_0x4ccdf6){var _0x9c074f=typeof _0x45909d['offset']==='undefined'&&typeof _0x45909d['limit']==='undefined';var _0x2c3e94=_0x4ccdf6[_0xa2a5('0x1b')];var _0x43dec1=_0x9c074f?0x0:_0x45909d[_0xa2a5('0x1c')];var _0xd46a0d=_0x9c074f?_0x4ccdf6[_0xa2a5('0x1b')]:_0x45909d[_0xa2a5('0x1c')]+_0x45909d[_0xa2a5('0x1d')];var _0x223e2f;if(_0xd46a0d>=_0x2c3e94){_0xd46a0d=_0x2c3e94;_0x223e2f=0xc8;}else{_0x223e2f=0xce;}_0x186df9[_0xa2a5('0x19')](_0x223e2f);return _0x186df9[_0xa2a5('0x1e')](_0xa2a5('0x1f'),_0x43dec1+'-'+_0xd46a0d+'/'+_0x2c3e94)[_0xa2a5('0x1a')](_0x4ccdf6);}return null;};}function patchUpdates(_0x2d2174){return function(_0x429f34){try{jsonpatch[_0xa2a5('0x20')](_0x429f34,_0x2d2174,!![]);}catch(_0x1f6415){return BPromise[_0xa2a5('0x21')](_0x1f6415);}return _0x429f34['save']();};}function saveUpdates(_0x404549,_0x1895f6){return function(_0x58dc7b){if(_0x58dc7b){return _0x58dc7b[_0xa2a5('0x22')](_0x404549)[_0xa2a5('0x23')](function(_0x179bc9){return _0x179bc9;});}return null;};}function removeEntity(_0x20e0ee,_0x1e9aa0){return function(_0x4b50bb){if(_0x4b50bb){return _0x4b50bb[_0xa2a5('0x24')]()['then'](function(){var _0x49ac0c=_0x4b50bb['get']({'plain':!![]});var _0x118b5e=_0xa2a5('0x25');return db[_0xa2a5('0x26')][_0xa2a5('0x24')]({'where':{'type':_0x118b5e,'resourceId':_0x49ac0c['id']}})[_0xa2a5('0x23')](function(){return _0x4b50bb;});})[_0xa2a5('0x23')](function(){_0x20e0ee[_0xa2a5('0x19')](0xcc)[_0xa2a5('0x18')]();});}};}function handleEntityNotFound(_0x49770d,_0x48cabd){return function(_0x5c9fa7){if(!_0x5c9fa7){_0x49770d[_0xa2a5('0x17')](0x194);}return _0x5c9fa7;};}function handleError(_0x5e61bb,_0x138553){_0x138553=_0x138553||0x1f4;return function(_0x50dc15){logger[_0xa2a5('0x27')](_0x50dc15[_0xa2a5('0x28')]);if(_0x50dc15['name']){delete _0x50dc15[_0xa2a5('0x29')];}_0x5e61bb[_0xa2a5('0x19')](_0x138553)[_0xa2a5('0x2a')](_0x50dc15);};}exports[_0xa2a5('0x2b')]=function(_0x45ca62,_0x37535a){var _0x788847={},_0x12de21={},_0x2d16e1={'count':0x0,'rows':[]};var _0x180442=_[_0xa2a5('0x2c')](db['CmHopperAdditionalPhone'][_0xa2a5('0x2d')],function(_0x5620d0){return{'name':_0x5620d0['fieldName'],'type':_0x5620d0['type'][_0xa2a5('0x2e')]};});_0x12de21[_0xa2a5('0x2f')]=_[_0xa2a5('0x2c')](_0x180442,_0xa2a5('0x29'));_0x12de21[_0xa2a5('0x30')]=_['keys'](_0x45ca62[_0xa2a5('0x30')]);_0x12de21[_0xa2a5('0x31')]=_['intersection'](_0x12de21[_0xa2a5('0x2f')],_0x12de21[_0xa2a5('0x30')]);_0x788847[_0xa2a5('0x32')]=_[_0xa2a5('0x33')](_0x12de21[_0xa2a5('0x2f')],qs[_0xa2a5('0x34')](_0x45ca62[_0xa2a5('0x30')][_0xa2a5('0x34')]));_0x788847[_0xa2a5('0x32')]=_0x788847[_0xa2a5('0x32')][_0xa2a5('0x35')]?_0x788847['attributes']:_0x12de21[_0xa2a5('0x2f')];if(!_0x45ca62[_0xa2a5('0x30')][_0xa2a5('0x36')]('nolimit')){_0x788847[_0xa2a5('0x1d')]=qs[_0xa2a5('0x1d')](_0x45ca62[_0xa2a5('0x30')][_0xa2a5('0x1d')]);_0x788847['offset']=qs[_0xa2a5('0x1c')](_0x45ca62[_0xa2a5('0x30')][_0xa2a5('0x1c')]);}_0x788847[_0xa2a5('0x37')]=qs[_0xa2a5('0x38')](_0x45ca62[_0xa2a5('0x30')]['sort']);_0x788847[_0xa2a5('0x39')]=qs['filters'](_[_0xa2a5('0x3a')](_0x45ca62[_0xa2a5('0x30')],_0x12de21[_0xa2a5('0x31')]),_0x180442);if(_0x45ca62['query']['filter']){_0x788847['where']=_['merge'](_0x788847[_0xa2a5('0x39')],{'$or':_[_0xa2a5('0x2c')](_0x180442,function(_0x4f91b5){if(_0x4f91b5['type']!==_0xa2a5('0x3b')){var _0x435e32={};_0x435e32[_0x4f91b5[_0xa2a5('0x29')]]={'$like':'%'+_0x45ca62['query'][_0xa2a5('0x3c')]+'%'};return _0x435e32;}})});}_0x788847=_[_0xa2a5('0x3d')]({},_0x788847,_0x45ca62[_0xa2a5('0x3e')]);var _0x4b2440={'where':_0x788847[_0xa2a5('0x39')]};return db[_0xa2a5('0x3f')][_0xa2a5('0x1b')](_0x4b2440)[_0xa2a5('0x23')](function(_0x3410a6){_0x2d16e1[_0xa2a5('0x1b')]=_0x3410a6;if(_0x45ca62[_0xa2a5('0x30')][_0xa2a5('0x40')]){_0x788847[_0xa2a5('0x41')]=[{'all':!![]}];}return db[_0xa2a5('0x3f')][_0xa2a5('0x42')](_0x788847);})['then'](function(_0x474f37){_0x2d16e1['rows']=_0x474f37;return _0x2d16e1;})[_0xa2a5('0x23')](respondWithFilteredResult(_0x37535a,_0x788847))[_0xa2a5('0x43')](handleError(_0x37535a,null));};exports[_0xa2a5('0x44')]=function(_0x28cc79,_0x5478de){var _0x557534={'raw':!![],'where':{'id':_0x28cc79[_0xa2a5('0x45')]['id']}},_0x2e70e9={};_0x2e70e9[_0xa2a5('0x2f')]=_[_0xa2a5('0x46')](db[_0xa2a5('0x3f')]['rawAttributes']);_0x2e70e9[_0xa2a5('0x30')]=_[_0xa2a5('0x46')](_0x28cc79[_0xa2a5('0x30')]);_0x2e70e9[_0xa2a5('0x31')]=_[_0xa2a5('0x33')](_0x2e70e9['model'],_0x2e70e9['query']);_0x557534[_0xa2a5('0x32')]=_[_0xa2a5('0x33')](_0x2e70e9[_0xa2a5('0x2f')],qs[_0xa2a5('0x34')](_0x28cc79[_0xa2a5('0x30')][_0xa2a5('0x34')]));_0x557534[_0xa2a5('0x32')]=_0x557534[_0xa2a5('0x32')][_0xa2a5('0x35')]?_0x557534['attributes']:_0x2e70e9[_0xa2a5('0x2f')];if(_0x28cc79['query'][_0xa2a5('0x40')]){_0x557534[_0xa2a5('0x41')]=[{'all':!![]}];}_0x557534=_[_0xa2a5('0x3d')]({},_0x557534,_0x28cc79['options']);return db[_0xa2a5('0x3f')][_0xa2a5('0x47')](_0x557534)[_0xa2a5('0x23')](handleEntityNotFound(_0x5478de,null))[_0xa2a5('0x23')](respondWithResult(_0x5478de,null))[_0xa2a5('0x43')](handleError(_0x5478de,null));};exports['create']=function(_0x56856c,_0x236e41){return db[_0xa2a5('0x3f')][_0xa2a5('0x48')](_0x56856c['body'],{})['then'](function(_0x26c8ce){var _0x319787=_0x56856c[_0xa2a5('0x49')][_0xa2a5('0x4a')]({'plain':!![]});if(!_0x319787)throw new Error(_0xa2a5('0x4b'));if(_0x319787[_0xa2a5('0x4c')]==='user'){var _0x57b08f=_0x26c8ce[_0xa2a5('0x4a')]({'plain':!![]});var _0x3e79d6='CmHopperAdditionalPhones';return db[_0xa2a5('0x4d')][_0xa2a5('0x47')]({'where':{'name':_0x3e79d6,'userProfileId':_0x319787[_0xa2a5('0x4e')]},'raw':!![]})['then'](function(_0xeebd30){if(_0xeebd30&&_0xeebd30[_0xa2a5('0x4f')]===0x0){return db[_0xa2a5('0x26')][_0xa2a5('0x48')]({'name':_0x57b08f[_0xa2a5('0x29')],'resourceId':_0x57b08f['id'],'type':_0xeebd30['name'],'sectionId':_0xeebd30['id']},{})[_0xa2a5('0x23')](function(){return _0x26c8ce;});}else{return _0x26c8ce;}})['catch'](function(_0x603e38){logger[_0xa2a5('0x27')](_0xa2a5('0x50'),_0x603e38);throw _0x603e38;});}return _0x26c8ce;})[_0xa2a5('0x23')](respondWithResult(_0x236e41,0xc9))[_0xa2a5('0x43')](handleError(_0x236e41,null));};exports['update']=function(_0x1f6bcf,_0x20d3bb){if(_0x1f6bcf[_0xa2a5('0x51')]['id']){delete _0x1f6bcf[_0xa2a5('0x51')]['id'];}return db[_0xa2a5('0x3f')][_0xa2a5('0x47')]({'where':{'id':_0x1f6bcf[_0xa2a5('0x45')]['id']}})['then'](handleEntityNotFound(_0x20d3bb,null))[_0xa2a5('0x23')](saveUpdates(_0x1f6bcf[_0xa2a5('0x51')],null))['then'](respondWithResult(_0x20d3bb,null))[_0xa2a5('0x43')](handleError(_0x20d3bb,null));};exports[_0xa2a5('0x24')]=function(_0x3364e5,_0x31b136){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x3364e5['params']['id']}})[_0xa2a5('0x23')](handleEntityNotFound(_0x31b136,null))[_0xa2a5('0x23')](removeEntity(_0x31b136,null))[_0xa2a5('0x43')](handleError(_0x31b136,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7645189..a8b651b 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 _0x3ba6=['request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_additional_phones','util','api'];(function(_0x1e17df,_0x31e2af){var _0x390268=function(_0x27cdba){while(--_0x27cdba){_0x1e17df['push'](_0x1e17df['shift']());}};_0x390268(++_0x31e2af);}(_0x3ba6,0x73));var _0x63ba=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x3ba6[_0x1597e2];return _0x4c8c0a;};'use strict';var _=require('lodash');var util=require(_0x63ba('0x0'));var logger=require('../../config/logger')(_0x63ba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x63ba('0x2'));var fs=require('fs');var path=require(_0x63ba('0x3'));var rimraf=require(_0x63ba('0x4'));var config=require(_0x63ba('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x63ba('0x6')]=function(_0x6ce43d,_0x241d93){return _0x6ce43d[_0x63ba('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x63ba('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3590=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','define','cm_hopper_additional_phones','lodash'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3590,0x167));var _0x0359=function(_0x174158,_0x50e28b){_0x174158=_0x174158-0x0;var _0x748afa=_0x3590[_0x174158];return _0x748afa;};'use strict';var _=require(_0x0359('0x0'));var util=require(_0x0359('0x1'));var logger=require(_0x0359('0x2'))(_0x0359('0x3'));var moment=require('moment');var BPromise=require(_0x0359('0x4'));var rp=require(_0x0359('0x5'));var fs=require('fs');var path=require(_0x0359('0x6'));var rimraf=require(_0x0359('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x21e3d2,_0x3b06fc){return _0x21e3d2[_0x0359('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x0359('0x9'),'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 63b588e..3bfa8cf 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 _0x8a85=['CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','body','ContactId','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnosuchnumberretry','countdropretry','countagentrejectretry','catch','SwapAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat','add','minutes','updatedAt','phone','createdAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x616fb8,_0x177e11){var _0x739e20=function(_0xfe27e9){while(--_0xfe27e9){_0x616fb8['push'](_0x616fb8['shift']());}};_0x739e20(++_0x177e11);}(_0x8a85,0x64));var _0x58a8=function(_0x37f433,_0x53c8f3){_0x37f433=_0x37f433-0x0;var _0x13d946=_0x8a85[_0x37f433];return _0x13d946;};'use strict';var _=require('lodash');var util=require(_0x58a8('0x0'));var moment=require('moment');var BPromise=require(_0x58a8('0x1'));var rs=require(_0x58a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58a8('0x3'));var logger=require(_0x58a8('0x4'))(_0x58a8('0x5'));var config=require(_0x58a8('0x6'));var jayson=require(_0x58a8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b35d4,_0x17824c,_0x32f0d3){return new BPromise(function(_0x474aac,_0x1aceb1){return client['request'](_0x2b35d4,_0x32f0d3)[_0x58a8('0x8')](function(_0x427f42){logger[_0x58a8('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x17824c,'request\x20sent');logger['debug'](_0x58a8('0xa'),_0x17824c,_0x58a8('0xb'),JSON[_0x58a8('0xc')](_0x427f42));if(_0x427f42[_0x58a8('0xd')]){if(_0x427f42[_0x58a8('0xd')][_0x58a8('0xe')]===0x1f4){logger[_0x58a8('0xd')](_0x58a8('0xf'),_0x17824c,_0x427f42['error'][_0x58a8('0x10')]);return _0x1aceb1(_0x427f42[_0x58a8('0xd')][_0x58a8('0x10')]);}logger[_0x58a8('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x17824c,_0x427f42[_0x58a8('0xd')][_0x58a8('0x10')]);return _0x474aac(_0x427f42[_0x58a8('0xd')]['message']);}else{logger[_0x58a8('0x9')](_0x58a8('0xf'),_0x17824c,_0x58a8('0xb'));_0x474aac(_0x427f42[_0x58a8('0x11')][_0x58a8('0x10')]);}})['catch'](function(_0x1e45cf){logger['error'](_0x58a8('0xf'),_0x17824c,_0x1e45cf);_0x1aceb1(_0x1e45cf);});});}exports[_0x58a8('0x12')]=function(_0x241854){var _0x46db7c=this;return new Promise(function(_0x2cc44b,_0x47237f){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x241854[_0x58a8('0x13')][_0x58a8('0x14')],'ListId':_0x241854[_0x58a8('0x13')][_0x58a8('0x15')],'VoiceQueueId':_0x241854[_0x58a8('0x13')][_0x58a8('0x16')]===undefined?null:_0x241854[_0x58a8('0x13')][_0x58a8('0x16')],'CampaignId':_0x241854[_0x58a8('0x13')][_0x58a8('0x17')]===undefined?null:_0x241854['body'][_0x58a8('0x17')]}})['then'](function(_0x473dc3){if(_0x473dc3!=null){return db['CmHopperAdditionalPhone'][_0x58a8('0x18')]({'raw':!![],'where':{'CmHopperId':_0x473dc3['id'],'OrderBy':{'$gt':_0x473dc3[_0x58a8('0x19')]}},'order':[[_0x58a8('0x19'),_0x58a8('0x1a')]]})[_0x58a8('0x8')](function(_0x5f4ac3){var _0x3306f5=0x0;if(_0x5f4ac3){if(_0x5f4ac3[_0x58a8('0x1b')]+_0x5f4ac3[_0x58a8('0x1c')]+_0x5f4ac3[_0x58a8('0x1d')]+_0x5f4ac3['countnosuchnumberretry']+_0x5f4ac3['countdropretry']+_0x5f4ac3[_0x58a8('0x1e')]+_0x5f4ac3[_0x58a8('0x1f')]+_0x5f4ac3['countagentrejectretry']<_0x241854[_0x58a8('0x20')][_0x58a8('0x21')])_0x3306f5=0x1;_0x2cc44b({'additional':_0x3306f5});}else{return db[_0x58a8('0x22')][_0x58a8('0x18')]({'raw':!![],'where':{'CmHopperId':_0x473dc3['id']},'order':[[_0x58a8('0x19'),_0x58a8('0x1a')]]})[_0x58a8('0x8')](function(_0x11c916){var _0x52fe37=0x0;if(_0x11c916){if(_0x11c916[_0x58a8('0x1b')]+_0x11c916[_0x58a8('0x1c')]+_0x11c916[_0x58a8('0x1d')]+_0x11c916[_0x58a8('0x23')]+_0x11c916[_0x58a8('0x24')]+_0x11c916['countabandonedretry']+_0x11c916[_0x58a8('0x1f')]+_0x11c916[_0x58a8('0x25')]<_0x241854[_0x58a8('0x20')][_0x58a8('0x21')])_0x52fe37=0x1;_0x2cc44b({'additional':_0x52fe37});}else{_0x2cc44b({'additional':0x0});}})['catch'](function(_0xee55b3){logger[_0x58a8('0xd')](_0x58a8('0x12'),_0xee55b3[_0x58a8('0x10')]);_0x47237f(_0x46db7c[_0x58a8('0xd')](0x1f4,_0xee55b3['message']));});}})[_0x58a8('0x26')](function(_0x5d1140){logger['error']('VerifyAdditionalPhones',_0x5d1140['message']);_0x47237f(_0x46db7c[_0x58a8('0xd')](0x1f4,_0x5d1140['message']));});}else _0x2cc44b({'additional':0x0});});});};exports[_0x58a8('0x27')]=function(_0x27c257){var _0x2b8ca3=this;return new Promise(function(_0x29f356,_0x3d2404){return db[_0x58a8('0x28')][_0x58a8('0x18')]({'raw':!![],'where':{'ContactId':_0x27c257[_0x58a8('0x13')][_0x58a8('0x14')],'ListId':_0x27c257[_0x58a8('0x13')][_0x58a8('0x15')],'VoiceQueueId':_0x27c257[_0x58a8('0x13')][_0x58a8('0x16')]===undefined?null:_0x27c257[_0x58a8('0x13')][_0x58a8('0x16')],'CampaignId':_0x27c257[_0x58a8('0x13')][_0x58a8('0x17')]===undefined?null:_0x27c257['body']['CampaignId']}})['then'](function(_0xcbea7){if(_0xcbea7!=null){return db['CmHopperAdditionalPhone'][_0x58a8('0x18')]({'raw':!![],'where':{'CmHopperId':_0xcbea7['id'],'OrderBy':{'$gte':_0xcbea7[_0x58a8('0x19')]}},'order':[[_0x58a8('0x19'),_0x58a8('0x1a')]]})['then'](function(_0xf79089){if(_0xf79089)return activateAdditionalPhone(_0xcbea7,_0x27c257[_0x58a8('0x13')],_0xf79089,_0x27c257[_0x58a8('0x29')],_0x27c257[_0x58a8('0x2a')])[_0x58a8('0x8')](function(_0x5c0364){_0x29f356(_0x5c0364);});else{return db[_0x58a8('0x22')][_0x58a8('0x18')]({'raw':!![],'where':{'CmHopperId':_0xcbea7['id']},'order':[['OrderBy',_0x58a8('0x1a')]]})[_0x58a8('0x8')](function(_0x309a20){if(_0x309a20)return activateAdditionalPhone(_0xcbea7,_0x27c257[_0x58a8('0x13')],_0x309a20,_0x27c257[_0x58a8('0x29')],_0x27c257[_0x58a8('0x2a')])[_0x58a8('0x8')](function(_0x2ca70e){_0x29f356(_0x2ca70e);});else{_0x29f356({'id':_0xcbea7['id'],'phone':''});}})[_0x58a8('0x26')](function(_0x5c938a){logger[_0x58a8('0xd')]('VerifyAdditionalPhones',_0x5c938a[_0x58a8('0x10')]);_0x3d2404(_0x2b8ca3[_0x58a8('0xd')](0x1f4,_0x5c938a[_0x58a8('0x10')]));});}})[_0x58a8('0x26')](function(_0x2de08b){logger['error'](_0x58a8('0x12'),_0x2de08b['message']);_0x3d2404(_0x2b8ca3[_0x58a8('0xd')](0x1f4,_0x2de08b[_0x58a8('0x10')]));});}else _0x29f356(0x1);});});};function activateAdditionalPhone(_0x4529eb,_0x208209,_0x10b0f4,_0x468663,_0x18e164){return new Promise(function(_0x296640,_0x27e74e){var _0x40b1b5;if(_[_0x58a8('0x2b')](_0x10b0f4[_0x58a8('0x2c')])){_0x10b0f4[_0x58a8('0x2c')]=moment();}if(moment()>moment(_0x10b0f4['scheduledat'])){_0x40b1b5=moment()[_0x58a8('0x2d')](_0x18e164||0x3,_0x58a8('0x2e'));}else{if(_0x10b0f4[_0x58a8('0x19')]==0x0){_0x40b1b5=moment(_0x10b0f4[_0x58a8('0x2c')]);}else{_0x40b1b5=moment()[_0x58a8('0x2d')](_0x18e164||0x3,_0x58a8('0x2e'));}}if(_[_0x58a8('0x2b')](_0x40b1b5)){_0x40b1b5=moment()[_0x58a8('0x2d')](_0x18e164||0x3,_0x58a8('0x2e'));}var _0x4ef815={'phone':_0x4529eb['phone'],'active':0x0,'OrderBy':_[_0x58a8('0x2b')](_0x4529eb['OrderBy'])?0x0:_0x4529eb[_0x58a8('0x19')],'scheduledat':moment()[_0x58a8('0x2d')](_0x468663||0x1,_0x58a8('0x2e')),'countbusyretry':_0x208209[_0x58a8('0x1b')],'countcongestionretry':_0x208209[_0x58a8('0x1c')],'countnoanswerretry':_0x208209[_0x58a8('0x1d')],'countnosuchnumberretry':_0x208209['countnosuchnumberretry'],'countdropretry':_0x208209['countdropretry'],'countabandonedretry':_0x208209[_0x58a8('0x1e')],'countmachineretry':_0x208209[_0x58a8('0x1f')],'countagentrejectretry':_0x208209[_0x58a8('0x25')],'createdAt':_0x208209['createdAt'],'updatedAt':_0x208209[_0x58a8('0x2f')]};var _0x3c3dcf={'CmHopperId':_0x4529eb['id'],'phone':_0x10b0f4[_0x58a8('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x10b0f4[_0x58a8('0x19')])?0x0:_0x10b0f4['OrderBy'],'scheduledat':_0x40b1b5,'countbusyretry':_0x10b0f4['countbusyretry'],'countcongestionretry':_0x10b0f4['countcongestionretry'],'countnoanswerretry':_0x10b0f4[_0x58a8('0x1d')],'countnosuchnumberretry':_0x10b0f4[_0x58a8('0x23')],'countdropretry':_0x10b0f4['countdropretry'],'countabandonedretry':_0x10b0f4['countabandonedretry'],'countmachineretry':_0x10b0f4[_0x58a8('0x1f')],'countagentrejectretry':_0x10b0f4[_0x58a8('0x25')],'createdAt':_0x10b0f4[_0x58a8('0x31')],'updatedAt':_0x10b0f4['updatedAt']};return db[_0x58a8('0x32')]['transaction'](function(_0x21d5aa){return db[_0x58a8('0x22')][_0x58a8('0x33')](_0x4ef815,{'where':{'id':_0x10b0f4['id']}},{'transaction':_0x21d5aa})[_0x58a8('0x8')](function(){return db[_0x58a8('0x28')][_0x58a8('0x33')](_0x3c3dcf,{'where':{'id':_0x4529eb['id']}},{'transaction':_0x21d5aa});});})[_0x58a8('0x8')](function(_0x5b3666){_0x296640({'id':_0x4529eb['id'],'phone':_0x10b0f4[_0x58a8('0x30')]});})[_0x58a8('0x26')](function(_0x503c76){logger[_0x58a8('0xd')](_0x58a8('0x34'),_0x503c76[_0x58a8('0x10')]);_0x27e74e({'error':_0x503c76['message']});});});}exports[_0x58a8('0x35')]=function(_0x5d0a0b){var _0x32dcbd=this;return new Promise(function(_0x19ffb5,_0x2b308a){return db[_0x58a8('0x28')][_0x58a8('0x33')](_0x5d0a0b['body'][_0x58a8('0x36')],{'where':{'id':_0x5d0a0b[_0x58a8('0x13')]['id']}})[_0x58a8('0x8')](function(_0x24d12a){_0x19ffb5(_0x24d12a);})[_0x58a8('0x26')](function(_0x5298e4){logger[_0x58a8('0xd')](_0x58a8('0x35'),_0x5298e4[_0x58a8('0x10')]);_0x2b308a(_0x32dcbd[_0x58a8('0xd')](0x1f4,_0x5298e4[_0x58a8('0x10')]));});});}; \ No newline at end of file +var _0x4cf0=['countbusyretry','countabandonedretry','entity','SwapAdditionalPhones','CmHopper','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0x4cf0,0x13a));var _0x04cf=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4cf0[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x04cf('0x0'));var util=require(_0x04cf('0x1'));var moment=require(_0x04cf('0x2'));var BPromise=require(_0x04cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04cf('0x4'));var db=require(_0x04cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x04cf('0x6'))('rpc');var config=require(_0x04cf('0x7'));var jayson=require(_0x04cf('0x8'));var client=jayson[_0x04cf('0x9')][_0x04cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f2029,_0x1f055d,_0x225ae7){return new BPromise(function(_0x6fe5d4,_0x586a63){return client[_0x04cf('0xb')](_0x1f2029,_0x225ae7)['then'](function(_0x5b6a46){logger[_0x04cf('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1f055d,_0x04cf('0xd'));logger[_0x04cf('0xe')](_0x04cf('0xf'),_0x1f055d,_0x04cf('0xd'),JSON[_0x04cf('0x10')](_0x5b6a46));if(_0x5b6a46[_0x04cf('0x11')]){if(_0x5b6a46[_0x04cf('0x11')][_0x04cf('0x12')]===0x1f4){logger[_0x04cf('0x11')](_0x04cf('0x13'),_0x1f055d,_0x5b6a46[_0x04cf('0x11')]['message']);return _0x586a63(_0x5b6a46[_0x04cf('0x11')]['message']);}logger['error'](_0x04cf('0x13'),_0x1f055d,_0x5b6a46['error'][_0x04cf('0x14')]);return _0x6fe5d4(_0x5b6a46['error'][_0x04cf('0x14')]);}else{logger[_0x04cf('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1f055d,'request\x20sent');_0x6fe5d4(_0x5b6a46['result'][_0x04cf('0x14')]);}})[_0x04cf('0x15')](function(_0x9eafde){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1f055d,_0x9eafde);_0x586a63(_0x9eafde);});});}exports[_0x04cf('0x16')]=function(_0x3525d2){var _0x955111=this;return new Promise(function(_0x3bee15,_0x368507){return db['CmHopper'][_0x04cf('0x17')]({'raw':!![],'where':{'ContactId':_0x3525d2[_0x04cf('0x18')][_0x04cf('0x19')],'ListId':_0x3525d2[_0x04cf('0x18')][_0x04cf('0x1a')],'VoiceQueueId':_0x3525d2['body'][_0x04cf('0x1b')]===undefined?null:_0x3525d2[_0x04cf('0x18')]['VoiceQueueId'],'CampaignId':_0x3525d2[_0x04cf('0x18')][_0x04cf('0x1c')]===undefined?null:_0x3525d2[_0x04cf('0x18')][_0x04cf('0x1c')]}})[_0x04cf('0x1d')](function(_0x551761){if(_0x551761!=null){return db[_0x04cf('0x1e')][_0x04cf('0x17')]({'raw':!![],'where':{'CmHopperId':_0x551761['id'],'OrderBy':{'$gt':_0x551761[_0x04cf('0x1f')]}},'order':[[_0x04cf('0x1f'),_0x04cf('0x20')]]})[_0x04cf('0x1d')](function(_0x2b801f){var _0x2f1fcc=0x0;if(_0x2b801f){if(_0x2b801f['countbusyretry']+_0x2b801f[_0x04cf('0x21')]+_0x2b801f[_0x04cf('0x22')]+_0x2b801f[_0x04cf('0x23')]+_0x2b801f[_0x04cf('0x24')]+_0x2b801f['countabandonedretry']+_0x2b801f[_0x04cf('0x25')]+_0x2b801f[_0x04cf('0x26')]<_0x3525d2['entity'][_0x04cf('0x27')])_0x2f1fcc=0x1;_0x3bee15({'additional':_0x2f1fcc});}else{return db[_0x04cf('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x551761['id']},'order':[[_0x04cf('0x1f'),'ASC']]})[_0x04cf('0x1d')](function(_0x44143f){var _0x1b064d=0x0;if(_0x44143f){if(_0x44143f[_0x04cf('0x28')]+_0x44143f[_0x04cf('0x21')]+_0x44143f['countnoanswerretry']+_0x44143f['countnosuchnumberretry']+_0x44143f[_0x04cf('0x24')]+_0x44143f[_0x04cf('0x29')]+_0x44143f[_0x04cf('0x25')]+_0x44143f[_0x04cf('0x26')]<_0x3525d2[_0x04cf('0x2a')]['dialGlobalMaxRetry'])_0x1b064d=0x1;_0x3bee15({'additional':_0x1b064d});}else{_0x3bee15({'additional':0x0});}})[_0x04cf('0x15')](function(_0x41fde6){logger[_0x04cf('0x11')](_0x04cf('0x16'),_0x41fde6[_0x04cf('0x14')]);_0x368507(_0x955111['error'](0x1f4,_0x41fde6[_0x04cf('0x14')]));});}})[_0x04cf('0x15')](function(_0x1b63da){logger[_0x04cf('0x11')](_0x04cf('0x16'),_0x1b63da[_0x04cf('0x14')]);_0x368507(_0x955111[_0x04cf('0x11')](0x1f4,_0x1b63da[_0x04cf('0x14')]));});}else _0x3bee15({'additional':0x0});});});};exports[_0x04cf('0x2b')]=function(_0x38adbe){var _0x421ebb=this;return new Promise(function(_0x53b155,_0x4a6caf){return db[_0x04cf('0x2c')][_0x04cf('0x17')]({'raw':!![],'where':{'ContactId':_0x38adbe[_0x04cf('0x18')]['ContactId'],'ListId':_0x38adbe['body'][_0x04cf('0x1a')],'VoiceQueueId':_0x38adbe[_0x04cf('0x18')][_0x04cf('0x1b')]===undefined?null:_0x38adbe[_0x04cf('0x18')][_0x04cf('0x1b')],'CampaignId':_0x38adbe[_0x04cf('0x18')][_0x04cf('0x1c')]===undefined?null:_0x38adbe[_0x04cf('0x18')][_0x04cf('0x1c')]}})[_0x04cf('0x1d')](function(_0x1be0d8){if(_0x1be0d8!=null){return db[_0x04cf('0x1e')][_0x04cf('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1be0d8['id'],'OrderBy':{'$gte':_0x1be0d8[_0x04cf('0x1f')]}},'order':[[_0x04cf('0x1f'),_0x04cf('0x20')]]})['then'](function(_0x213a97){if(_0x213a97)return activateAdditionalPhone(_0x1be0d8,_0x38adbe[_0x04cf('0x18')],_0x213a97,_0x38adbe['duration'],_0x38adbe[_0x04cf('0x2d')])['then'](function(_0x2cdb42){_0x53b155(_0x2cdb42);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1be0d8['id']},'order':[['OrderBy',_0x04cf('0x20')]]})['then'](function(_0x5b52e6){if(_0x5b52e6)return activateAdditionalPhone(_0x1be0d8,_0x38adbe['body'],_0x5b52e6,_0x38adbe['duration'],_0x38adbe[_0x04cf('0x2d')])[_0x04cf('0x1d')](function(_0x767ba6){_0x53b155(_0x767ba6);});else{_0x53b155({'id':_0x1be0d8['id'],'phone':''});}})[_0x04cf('0x15')](function(_0x3d542d){logger[_0x04cf('0x11')](_0x04cf('0x16'),_0x3d542d[_0x04cf('0x14')]);_0x4a6caf(_0x421ebb['error'](0x1f4,_0x3d542d[_0x04cf('0x14')]));});}})['catch'](function(_0x40b95d){logger[_0x04cf('0x11')](_0x04cf('0x16'),_0x40b95d[_0x04cf('0x14')]);_0x4a6caf(_0x421ebb[_0x04cf('0x11')](0x1f4,_0x40b95d[_0x04cf('0x14')]));});}else _0x53b155(0x1);});});};function activateAdditionalPhone(_0x1bea28,_0x2a669b,_0x6af6a1,_0x5a39b9,_0xd309b2){return new Promise(function(_0x4b53d8,_0x48df49){var _0x892813;if(_['isNil'](_0x6af6a1[_0x04cf('0x2e')])){_0x6af6a1[_0x04cf('0x2e')]=moment();}if(moment()>moment(_0x6af6a1[_0x04cf('0x2e')])){_0x892813=moment()[_0x04cf('0x2f')](_0xd309b2||0x3,_0x04cf('0x30'));}else{if(_0x6af6a1[_0x04cf('0x1f')]==0x0){_0x892813=moment(_0x6af6a1[_0x04cf('0x2e')]);}else{_0x892813=moment()[_0x04cf('0x2f')](_0xd309b2||0x3,_0x04cf('0x30'));}}if(_[_0x04cf('0x31')](_0x892813)){_0x892813=moment()[_0x04cf('0x2f')](_0xd309b2||0x3,_0x04cf('0x30'));}var _0x32c151={'phone':_0x1bea28[_0x04cf('0x32')],'active':0x0,'OrderBy':_[_0x04cf('0x31')](_0x1bea28['OrderBy'])?0x0:_0x1bea28['OrderBy'],'scheduledat':moment()[_0x04cf('0x2f')](_0x5a39b9||0x1,_0x04cf('0x30')),'countbusyretry':_0x2a669b[_0x04cf('0x28')],'countcongestionretry':_0x2a669b['countcongestionretry'],'countnoanswerretry':_0x2a669b['countnoanswerretry'],'countnosuchnumberretry':_0x2a669b[_0x04cf('0x23')],'countdropretry':_0x2a669b[_0x04cf('0x24')],'countabandonedretry':_0x2a669b[_0x04cf('0x29')],'countmachineretry':_0x2a669b[_0x04cf('0x25')],'countagentrejectretry':_0x2a669b[_0x04cf('0x26')],'createdAt':_0x2a669b[_0x04cf('0x33')],'updatedAt':_0x2a669b[_0x04cf('0x34')]};var _0x5a6d9d={'CmHopperId':_0x1bea28['id'],'phone':_0x6af6a1['phone'],'active':0x0,'OrderBy':_['isNil'](_0x6af6a1[_0x04cf('0x1f')])?0x0:_0x6af6a1[_0x04cf('0x1f')],'scheduledat':_0x892813,'countbusyretry':_0x6af6a1[_0x04cf('0x28')],'countcongestionretry':_0x6af6a1[_0x04cf('0x21')],'countnoanswerretry':_0x6af6a1[_0x04cf('0x22')],'countnosuchnumberretry':_0x6af6a1[_0x04cf('0x23')],'countdropretry':_0x6af6a1[_0x04cf('0x24')],'countabandonedretry':_0x6af6a1[_0x04cf('0x29')],'countmachineretry':_0x6af6a1[_0x04cf('0x25')],'countagentrejectretry':_0x6af6a1[_0x04cf('0x26')],'createdAt':_0x6af6a1[_0x04cf('0x33')],'updatedAt':_0x6af6a1[_0x04cf('0x34')]};return db[_0x04cf('0x35')][_0x04cf('0x36')](function(_0x59cedb){return db[_0x04cf('0x1e')][_0x04cf('0x37')](_0x32c151,{'where':{'id':_0x6af6a1['id']}},{'transaction':_0x59cedb})[_0x04cf('0x1d')](function(){return db[_0x04cf('0x2c')][_0x04cf('0x37')](_0x5a6d9d,{'where':{'id':_0x1bea28['id']}},{'transaction':_0x59cedb});});})[_0x04cf('0x1d')](function(_0x467e30){_0x4b53d8({'id':_0x1bea28['id'],'phone':_0x6af6a1[_0x04cf('0x32')]});})[_0x04cf('0x15')](function(_0x209e2a){logger[_0x04cf('0x11')](_0x04cf('0x38'),_0x209e2a[_0x04cf('0x14')]);_0x48df49({'error':_0x209e2a[_0x04cf('0x14')]});});});}exports[_0x04cf('0x39')]=function(_0x5d2117){var _0x30e3dc=this;return new Promise(function(_0x388177,_0x3b03b5){return db[_0x04cf('0x2c')][_0x04cf('0x37')](_0x5d2117[_0x04cf('0x18')][_0x04cf('0x3a')],{'where':{'id':_0x5d2117['body']['id']}})[_0x04cf('0x1d')](function(_0x10e906){_0x388177(_0x10e906);})['catch'](function(_0x45fabc){logger['error'](_0x04cf('0x39'),_0x45fabc['message']);_0x3b03b5(_0x30e3dc[_0x04cf('0x11')](0x1f4,_0x45fabc['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 43da0ec..0dddfaf 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 _0xf3b2=['connect-timeout','express','Router','fs-extra','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','multer','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf3b2,0x152));var _0x2f3b=function(_0x5c1829,_0x5e5b18){_0x5c1829=_0x5c1829-0x0;var _0x45dd65=_0xf3b2[_0x5c1829];return _0x45dd65;};'use strict';var multer=require(_0x2f3b('0x0'));var util=require('util');var path=require(_0x2f3b('0x1'));var timeout=require(_0x2f3b('0x2'));var express=require(_0x2f3b('0x3'));var router=express[_0x2f3b('0x4')]();var fs_extra=require(_0x2f3b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f3b('0x6'));var controller=require(_0x2f3b('0x7'));router['get']('/',auth[_0x2f3b('0x8')](),controller[_0x2f3b('0x9')]);router[_0x2f3b('0xa')](_0x2f3b('0xb'),auth[_0x2f3b('0x8')](),controller[_0x2f3b('0xc')]);router[_0x2f3b('0xd')]('/',auth[_0x2f3b('0x8')](),controller[_0x2f3b('0xe')]);router[_0x2f3b('0xf')]('/:id',auth[_0x2f3b('0x8')](),controller['update']);router['delete'](_0x2f3b('0xb'),auth[_0x2f3b('0x8')](),controller[_0x2f3b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8581=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','util','path'];(function(_0x1d231f,_0x47f708){var _0x18fd60=function(_0x51eb89){while(--_0x51eb89){_0x1d231f['push'](_0x1d231f['shift']());}};_0x18fd60(++_0x47f708);}(_0x8581,0x163));var _0x1858=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x8581[_0x276468];return _0x36dc3a;};'use strict';var multer=require('multer');var util=require(_0x1858('0x0'));var path=require(_0x1858('0x1'));var timeout=require('connect-timeout');var express=require(_0x1858('0x2'));var router=express[_0x1858('0x3')]();var fs_extra=require(_0x1858('0x4'));var auth=require(_0x1858('0x5'));var interaction=require(_0x1858('0x6'));var config=require(_0x1858('0x7'));var controller=require(_0x1858('0x8'));router[_0x1858('0x9')]('/',auth[_0x1858('0xa')](),controller[_0x1858('0xb')]);router[_0x1858('0x9')](_0x1858('0xc'),auth[_0x1858('0xa')](),controller['show']);router[_0x1858('0xd')]('/',auth[_0x1858('0xa')](),controller[_0x1858('0xe')]);router['put']('/:id',auth[_0x1858('0xa')](),controller['update']);router[_0x1858('0xf')](_0x1858('0xc'),auth[_0x1858('0xa')](),controller[_0x1858('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index fdaf80c..f07d4c3 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 _0xb8f1=['contactListQueue','moment','sequelize','STRING','INTEGER'];(function(_0x4a4d88,_0x2be95a){var _0x479329=function(_0x37bb8e){while(--_0x37bb8e){_0x4a4d88['push'](_0x4a4d88['shift']());}};_0x479329(++_0x2be95a);}(_0xb8f1,0x15f));var _0x1b8f=function(_0x493bb7,_0x26e7a4){_0x493bb7=_0x493bb7-0x0;var _0xe727c6=_0xb8f1[_0x493bb7];return _0xe727c6;};'use strict';var moment=require(_0x1b8f('0x0'));var Sequelize=require(_0x1b8f('0x1'));module['exports']={'phone':{'type':Sequelize[_0x1b8f('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1b8f('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x1b8f('0x4')},'VoiceQueueId':{'type':Sequelize[_0x1b8f('0x3')],'unique':_0x1b8f('0x4')}}; \ No newline at end of file +var _0xef4e=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x1ed928,_0x3c33b0){var _0x36712a=function(_0x4cbcf6){while(--_0x4cbcf6){_0x1ed928['push'](_0x1ed928['shift']());}};_0x36712a(++_0x3c33b0);}(_0xef4e,0xc2));var _0xeef4=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xef4e[_0x40be86];return _0xda3c3b;};'use strict';var moment=require(_0xeef4('0x0'));var Sequelize=require(_0xeef4('0x1'));module[_0xeef4('0x2')]={'phone':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xeef4('0x4')],'unique':_0xeef4('0x5')},'ListId':{'type':Sequelize[_0xeef4('0x4')],'unique':_0xeef4('0x5')},'VoiceQueueId':{'type':Sequelize[_0xeef4('0x4')],'unique':_0xeef4('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c7046f9..339988d 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 _0xf40b=['keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','findAll','rows','catch','show','include','body','find','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','map','CmHopperBlack','rawAttributes','fieldName','query'];(function(_0x31f9bd,_0x544e9b){var _0x291f0e=function(_0x476024){while(--_0x476024){_0x31f9bd['push'](_0x31f9bd['shift']());}};_0x291f0e(++_0x544e9b);}(_0xf40b,0xf7));var _0xbf40=function(_0x51de21,_0x2143bb){_0x51de21=_0x51de21-0x0;var _0x11e461=_0xf40b[_0x51de21];return _0x11e461;};'use strict';var emlformat=require(_0xbf40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf40('0x2'));var moment=require(_0xbf40('0x3'));var BPromise=require(_0xbf40('0x4'));var Mustache=require(_0xbf40('0x5'));var util=require(_0xbf40('0x6'));var path=require(_0xbf40('0x7'));var sox=require(_0xbf40('0x8'));var csv=require('to-csv');var ejs=require(_0xbf40('0x9'));var fs=require('fs');var fs_extra=require(_0xbf40('0xa'));var _=require(_0xbf40('0xb'));var squel=require(_0xbf40('0xc'));var crypto=require(_0xbf40('0xd'));var jsforce=require(_0xbf40('0xe'));var deskjs=require(_0xbf40('0xf'));var toCsv=require(_0xbf40('0x10'));var querystring=require(_0xbf40('0x11'));var Papa=require(_0xbf40('0x12'));var Redis=require(_0xbf40('0x13'));var authService=require(_0xbf40('0x14'));var qs=require(_0xbf40('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf40('0x16'))(_0xbf40('0x17'));var utils=require(_0xbf40('0x18'));var config=require(_0xbf40('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf40('0x1a'))['db'];function respondWithStatusCode(_0x5c6fa6,_0xb1fa36){_0xb1fa36=_0xb1fa36||0xcc;return function(_0xe759ce){if(_0xe759ce){return _0x5c6fa6[_0xbf40('0x1b')](_0xb1fa36);}return _0x5c6fa6['status'](_0xb1fa36)[_0xbf40('0x1c')]();};}function respondWithResult(_0x1d3045,_0x81c2a4){_0x81c2a4=_0x81c2a4||0xc8;return function(_0x3aa14a){if(_0x3aa14a){return _0x1d3045[_0xbf40('0x1d')](_0x81c2a4)[_0xbf40('0x1e')](_0x3aa14a);}};}function respondWithFilteredResult(_0x566daa,_0x4857d1){return function(_0x5cc271){if(_0x5cc271){var _0x70e952=typeof _0x4857d1[_0xbf40('0x1f')]===_0xbf40('0x20')&&typeof _0x4857d1[_0xbf40('0x21')]==='undefined';var _0x4bc7c3=_0x5cc271['count'];var _0x3326af=_0x70e952?0x0:_0x4857d1[_0xbf40('0x1f')];var _0x15c7e9=_0x70e952?_0x5cc271[_0xbf40('0x22')]:_0x4857d1['offset']+_0x4857d1[_0xbf40('0x21')];var _0x31dc5f;if(_0x15c7e9>=_0x4bc7c3){_0x15c7e9=_0x4bc7c3;_0x31dc5f=0xc8;}else{_0x31dc5f=0xce;}_0x566daa['status'](_0x31dc5f);return _0x566daa[_0xbf40('0x23')]('Content-Range',_0x3326af+'-'+_0x15c7e9+'/'+_0x4bc7c3)[_0xbf40('0x1e')](_0x5cc271);}return null;};}function patchUpdates(_0x14dfcf){return function(_0x23aa64){try{jsonpatch[_0xbf40('0x24')](_0x23aa64,_0x14dfcf,!![]);}catch(_0xb0a4bb){return BPromise[_0xbf40('0x25')](_0xb0a4bb);}return _0x23aa64[_0xbf40('0x26')]();};}function saveUpdates(_0x4a249f,_0x1d6f8c){return function(_0x21f50a){if(_0x21f50a){return _0x21f50a[_0xbf40('0x27')](_0x4a249f)[_0xbf40('0x28')](function(_0x43164d){return _0x43164d;});}return null;};}function removeEntity(_0x298db8,_0x493fb5){return function(_0x167a41){if(_0x167a41){return _0x167a41[_0xbf40('0x29')]()[_0xbf40('0x28')](function(){_0x298db8[_0xbf40('0x1d')](0xcc)[_0xbf40('0x1c')]();});}};}function handleEntityNotFound(_0x53d29d,_0x4890d2){return function(_0xcdf32e){if(!_0xcdf32e){_0x53d29d[_0xbf40('0x1b')](0x194);}return _0xcdf32e;};}function handleError(_0x56cb50,_0x7b097d){_0x7b097d=_0x7b097d||0x1f4;return function(_0x445002){logger[_0xbf40('0x2a')](_0x445002['stack']);if(_0x445002[_0xbf40('0x2b')]){delete _0x445002[_0xbf40('0x2b')];}_0x56cb50['status'](_0x7b097d)['send'](_0x445002);};}exports['index']=function(_0x5b2d42,_0x49abb6){var _0x3ee0f5={},_0xf9517b={},_0x373efe={'count':0x0,'rows':[]};var _0x3b322c=_[_0xbf40('0x2c')](db[_0xbf40('0x2d')][_0xbf40('0x2e')],function(_0x3c5ef5){return{'name':_0x3c5ef5[_0xbf40('0x2f')],'type':_0x3c5ef5['type']['key']};});_0xf9517b['model']=_[_0xbf40('0x2c')](_0x3b322c,_0xbf40('0x2b'));_0xf9517b[_0xbf40('0x30')]=_[_0xbf40('0x31')](_0x5b2d42[_0xbf40('0x30')]);_0xf9517b['filters']=_[_0xbf40('0x32')](_0xf9517b[_0xbf40('0x33')],_0xf9517b['query']);_0x3ee0f5[_0xbf40('0x34')]=_[_0xbf40('0x32')](_0xf9517b[_0xbf40('0x33')],qs['fields'](_0x5b2d42[_0xbf40('0x30')][_0xbf40('0x35')]));_0x3ee0f5[_0xbf40('0x34')]=_0x3ee0f5[_0xbf40('0x34')][_0xbf40('0x36')]?_0x3ee0f5['attributes']:_0xf9517b['model'];if(!_0x5b2d42[_0xbf40('0x30')]['hasOwnProperty'](_0xbf40('0x37'))){_0x3ee0f5[_0xbf40('0x21')]=qs[_0xbf40('0x21')](_0x5b2d42[_0xbf40('0x30')][_0xbf40('0x21')]);_0x3ee0f5['offset']=qs[_0xbf40('0x1f')](_0x5b2d42[_0xbf40('0x30')][_0xbf40('0x1f')]);}_0x3ee0f5[_0xbf40('0x38')]=qs[_0xbf40('0x39')](_0x5b2d42[_0xbf40('0x30')][_0xbf40('0x39')]);_0x3ee0f5[_0xbf40('0x3a')]=qs[_0xbf40('0x3b')](_[_0xbf40('0x3c')](_0x5b2d42[_0xbf40('0x30')],_0xf9517b[_0xbf40('0x3b')]),_0x3b322c);if(_0x5b2d42[_0xbf40('0x30')]['filter']){_0x3ee0f5[_0xbf40('0x3a')]=_[_0xbf40('0x3d')](_0x3ee0f5[_0xbf40('0x3a')],{'$or':_[_0xbf40('0x2c')](_0x3b322c,function(_0x4adfe1){if(_0x4adfe1[_0xbf40('0x3e')]!==_0xbf40('0x3f')){var _0x19d24c={};_0x19d24c[_0x4adfe1[_0xbf40('0x2b')]]={'$like':'%'+_0x5b2d42[_0xbf40('0x30')]['filter']+'%'};return _0x19d24c;}})});}_0x3ee0f5=_[_0xbf40('0x3d')]({},_0x3ee0f5,_0x5b2d42[_0xbf40('0x40')]);var _0x51f4a8={'where':_0x3ee0f5['where']};return db['CmHopperBlack'][_0xbf40('0x22')](_0x51f4a8)['then'](function(_0x4cf67a){_0x373efe[_0xbf40('0x22')]=_0x4cf67a;if(_0x5b2d42['query']['includeAll']){_0x3ee0f5['include']=[{'all':!![]}];}return db[_0xbf40('0x2d')][_0xbf40('0x41')](_0x3ee0f5);})[_0xbf40('0x28')](function(_0x4c1a27){_0x373efe[_0xbf40('0x42')]=_0x4c1a27;return _0x373efe;})[_0xbf40('0x28')](respondWithFilteredResult(_0x49abb6,_0x3ee0f5))[_0xbf40('0x43')](handleError(_0x49abb6,null));};exports[_0xbf40('0x44')]=function(_0x20e9d3,_0xd8ad6b){var _0x2e59ad={'raw':!![],'where':{'id':_0x20e9d3['params']['id']}},_0x40104a={};_0x40104a[_0xbf40('0x33')]=_[_0xbf40('0x31')](db[_0xbf40('0x2d')][_0xbf40('0x2e')]);_0x40104a[_0xbf40('0x30')]=_[_0xbf40('0x31')](_0x20e9d3['query']);_0x40104a[_0xbf40('0x3b')]=_[_0xbf40('0x32')](_0x40104a[_0xbf40('0x33')],_0x40104a[_0xbf40('0x30')]);_0x2e59ad[_0xbf40('0x34')]=_['intersection'](_0x40104a[_0xbf40('0x33')],qs[_0xbf40('0x35')](_0x20e9d3[_0xbf40('0x30')]['fields']));_0x2e59ad['attributes']=_0x2e59ad['attributes'][_0xbf40('0x36')]?_0x2e59ad[_0xbf40('0x34')]:_0x40104a[_0xbf40('0x33')];if(_0x20e9d3['query']['includeAll']){_0x2e59ad[_0xbf40('0x45')]=[{'all':!![]}];}_0x2e59ad=_['merge']({},_0x2e59ad,_0x20e9d3[_0xbf40('0x40')]);return db[_0xbf40('0x2d')]['find'](_0x2e59ad)[_0xbf40('0x28')](handleEntityNotFound(_0xd8ad6b,null))[_0xbf40('0x28')](respondWithResult(_0xd8ad6b,null))[_0xbf40('0x43')](handleError(_0xd8ad6b,null));};exports['update']=function(_0x48afe5,_0x58aa0d){if(_0x48afe5['body']['id']){delete _0x48afe5[_0xbf40('0x46')]['id'];}return db[_0xbf40('0x2d')][_0xbf40('0x47')]({'where':{'id':_0x48afe5['params']['id']}})[_0xbf40('0x28')](handleEntityNotFound(_0x58aa0d,null))[_0xbf40('0x28')](saveUpdates(_0x48afe5[_0xbf40('0x46')],null))[_0xbf40('0x28')](respondWithResult(_0x58aa0d,null))[_0xbf40('0x43')](handleError(_0x58aa0d,null));};exports[_0xbf40('0x29')]=function(_0x4fc4bd,_0x454920){return db['CmHopperBlack'][_0xbf40('0x47')]({'where':{'id':_0x4fc4bd[_0xbf40('0x48')]['id']}})['then'](handleEntityNotFound(_0x454920,null))[_0xbf40('0x28')](removeEntity(_0x454920,null))[_0xbf40('0x43')](handleError(_0x454920,null));};exports['describe']=function(_0x241eef,_0x1394fd){return db[_0xbf40('0x2d')][_0xbf40('0x49')]()[_0xbf40('0x28')](respondWithResult(_0x1394fd,null))['catch'](handleError(_0x1394fd,null));}; \ No newline at end of file +var _0x3cfc=['count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','CmHopperBlack','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit'];(function(_0x486dce,_0xa9f04d){var _0x310dbd=function(_0x19258c){while(--_0x19258c){_0x486dce['push'](_0x486dce['shift']());}};_0x310dbd(++_0xa9f04d);}(_0x3cfc,0x1e2));var _0xc3cf=function(_0x297360,_0x48a996){_0x297360=_0x297360-0x0;var _0x5676a8=_0x3cfc[_0x297360];return _0x5676a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3cf('0x0'));var zipdir=require(_0xc3cf('0x1'));var jsonpatch=require(_0xc3cf('0x2'));var rp=require(_0xc3cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc3cf('0x4'));var util=require(_0xc3cf('0x5'));var path=require(_0xc3cf('0x6'));var sox=require(_0xc3cf('0x7'));var csv=require(_0xc3cf('0x8'));var ejs=require(_0xc3cf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3cf('0xa'));var squel=require(_0xc3cf('0xb'));var crypto=require(_0xc3cf('0xc'));var jsforce=require(_0xc3cf('0xd'));var deskjs=require(_0xc3cf('0xe'));var toCsv=require(_0xc3cf('0x8'));var querystring=require(_0xc3cf('0xf'));var Papa=require(_0xc3cf('0x10'));var Redis=require(_0xc3cf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc3cf('0x12'));var as=require(_0xc3cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3cf('0x14'))(_0xc3cf('0x15'));var utils=require(_0xc3cf('0x16'));var config=require(_0xc3cf('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20bd55,_0x55bb7a){_0x55bb7a=_0x55bb7a||0xcc;return function(_0x4ac423){if(_0x4ac423){return _0x20bd55[_0xc3cf('0x18')](_0x55bb7a);}return _0x20bd55[_0xc3cf('0x19')](_0x55bb7a)[_0xc3cf('0x1a')]();};}function respondWithResult(_0x3abe64,_0x23e4a8){_0x23e4a8=_0x23e4a8||0xc8;return function(_0xe7dcfb){if(_0xe7dcfb){return _0x3abe64['status'](_0x23e4a8)['json'](_0xe7dcfb);}};}function respondWithFilteredResult(_0x11a16f,_0x547295){return function(_0x4040f4){if(_0x4040f4){var _0x3d678f=typeof _0x547295[_0xc3cf('0x1b')]==='undefined'&&typeof _0x547295[_0xc3cf('0x1c')]==='undefined';var _0x3b6bdf=_0x4040f4['count'];var _0x27c1c5=_0x3d678f?0x0:_0x547295[_0xc3cf('0x1b')];var _0x3c9295=_0x3d678f?_0x4040f4[_0xc3cf('0x1d')]:_0x547295[_0xc3cf('0x1b')]+_0x547295[_0xc3cf('0x1c')];var _0x1ebd9c;if(_0x3c9295>=_0x3b6bdf){_0x3c9295=_0x3b6bdf;_0x1ebd9c=0xc8;}else{_0x1ebd9c=0xce;}_0x11a16f[_0xc3cf('0x19')](_0x1ebd9c);return _0x11a16f[_0xc3cf('0x1e')](_0xc3cf('0x1f'),_0x27c1c5+'-'+_0x3c9295+'/'+_0x3b6bdf)[_0xc3cf('0x20')](_0x4040f4);}return null;};}function patchUpdates(_0x5a7732){return function(_0x2f419c){try{jsonpatch[_0xc3cf('0x21')](_0x2f419c,_0x5a7732,!![]);}catch(_0x1a57b3){return BPromise[_0xc3cf('0x22')](_0x1a57b3);}return _0x2f419c[_0xc3cf('0x23')]();};}function saveUpdates(_0xb562d3,_0x1554f5){return function(_0x18d0b6){if(_0x18d0b6){return _0x18d0b6[_0xc3cf('0x24')](_0xb562d3)[_0xc3cf('0x25')](function(_0x31ef90){return _0x31ef90;});}return null;};}function removeEntity(_0x5bf437,_0x9a5a3f){return function(_0x1c751d){if(_0x1c751d){return _0x1c751d[_0xc3cf('0x26')]()['then'](function(){_0x5bf437[_0xc3cf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2e5a,_0x289e9c){return function(_0x39a180){if(!_0x39a180){_0x1c2e5a['sendStatus'](0x194);}return _0x39a180;};}function handleError(_0xc1f4e1,_0x41f1d5){_0x41f1d5=_0x41f1d5||0x1f4;return function(_0x228655){logger[_0xc3cf('0x27')](_0x228655['stack']);if(_0x228655[_0xc3cf('0x28')]){delete _0x228655[_0xc3cf('0x28')];}_0xc1f4e1[_0xc3cf('0x19')](_0x41f1d5)[_0xc3cf('0x29')](_0x228655);};}exports[_0xc3cf('0x2a')]=function(_0x15643e,_0x29a953){var _0x220597={},_0x5b1065={},_0x415d1f={'count':0x0,'rows':[]};var _0x467ae4=_['map'](db[_0xc3cf('0x2b')]['rawAttributes'],function(_0x55bf34){return{'name':_0x55bf34[_0xc3cf('0x2c')],'type':_0x55bf34[_0xc3cf('0x2d')]['key']};});_0x5b1065[_0xc3cf('0x2e')]=_[_0xc3cf('0x2f')](_0x467ae4,'name');_0x5b1065[_0xc3cf('0x30')]=_['keys'](_0x15643e[_0xc3cf('0x30')]);_0x5b1065[_0xc3cf('0x31')]=_[_0xc3cf('0x32')](_0x5b1065[_0xc3cf('0x2e')],_0x5b1065['query']);_0x220597[_0xc3cf('0x33')]=_[_0xc3cf('0x32')](_0x5b1065[_0xc3cf('0x2e')],qs[_0xc3cf('0x34')](_0x15643e[_0xc3cf('0x30')][_0xc3cf('0x34')]));_0x220597[_0xc3cf('0x33')]=_0x220597['attributes'][_0xc3cf('0x35')]?_0x220597[_0xc3cf('0x33')]:_0x5b1065[_0xc3cf('0x2e')];if(!_0x15643e[_0xc3cf('0x30')]['hasOwnProperty'](_0xc3cf('0x36'))){_0x220597[_0xc3cf('0x1c')]=qs[_0xc3cf('0x1c')](_0x15643e['query']['limit']);_0x220597[_0xc3cf('0x1b')]=qs[_0xc3cf('0x1b')](_0x15643e['query'][_0xc3cf('0x1b')]);}_0x220597[_0xc3cf('0x37')]=qs['sort'](_0x15643e[_0xc3cf('0x30')][_0xc3cf('0x38')]);_0x220597[_0xc3cf('0x39')]=qs[_0xc3cf('0x31')](_[_0xc3cf('0x3a')](_0x15643e[_0xc3cf('0x30')],_0x5b1065[_0xc3cf('0x31')]),_0x467ae4);if(_0x15643e[_0xc3cf('0x30')][_0xc3cf('0x3b')]){_0x220597[_0xc3cf('0x39')]=_[_0xc3cf('0x3c')](_0x220597[_0xc3cf('0x39')],{'$or':_['map'](_0x467ae4,function(_0x51db27){if(_0x51db27[_0xc3cf('0x2d')]!=='VIRTUAL'){var _0x1bd8ff={};_0x1bd8ff[_0x51db27[_0xc3cf('0x28')]]={'$like':'%'+_0x15643e[_0xc3cf('0x30')][_0xc3cf('0x3b')]+'%'};return _0x1bd8ff;}})});}_0x220597=_[_0xc3cf('0x3c')]({},_0x220597,_0x15643e[_0xc3cf('0x3d')]);var _0x4435bb={'where':_0x220597[_0xc3cf('0x39')]};return db[_0xc3cf('0x2b')][_0xc3cf('0x1d')](_0x4435bb)[_0xc3cf('0x25')](function(_0x51808c){_0x415d1f['count']=_0x51808c;if(_0x15643e[_0xc3cf('0x30')][_0xc3cf('0x3e')]){_0x220597[_0xc3cf('0x3f')]=[{'all':!![]}];}return db[_0xc3cf('0x2b')]['findAll'](_0x220597);})[_0xc3cf('0x25')](function(_0x31f7cb){_0x415d1f[_0xc3cf('0x40')]=_0x31f7cb;return _0x415d1f;})[_0xc3cf('0x25')](respondWithFilteredResult(_0x29a953,_0x220597))[_0xc3cf('0x41')](handleError(_0x29a953,null));};exports[_0xc3cf('0x42')]=function(_0x4da18c,_0x55c95b){var _0x42312a={'raw':!![],'where':{'id':_0x4da18c[_0xc3cf('0x43')]['id']}},_0x1e4abe={};_0x1e4abe[_0xc3cf('0x2e')]=_['keys'](db['CmHopperBlack'][_0xc3cf('0x44')]);_0x1e4abe[_0xc3cf('0x30')]=_[_0xc3cf('0x45')](_0x4da18c[_0xc3cf('0x30')]);_0x1e4abe['filters']=_[_0xc3cf('0x32')](_0x1e4abe[_0xc3cf('0x2e')],_0x1e4abe[_0xc3cf('0x30')]);_0x42312a[_0xc3cf('0x33')]=_[_0xc3cf('0x32')](_0x1e4abe[_0xc3cf('0x2e')],qs[_0xc3cf('0x34')](_0x4da18c[_0xc3cf('0x30')][_0xc3cf('0x34')]));_0x42312a[_0xc3cf('0x33')]=_0x42312a['attributes']['length']?_0x42312a['attributes']:_0x1e4abe['model'];if(_0x4da18c['query'][_0xc3cf('0x3e')]){_0x42312a[_0xc3cf('0x3f')]=[{'all':!![]}];}_0x42312a=_[_0xc3cf('0x3c')]({},_0x42312a,_0x4da18c[_0xc3cf('0x3d')]);return db['CmHopperBlack'][_0xc3cf('0x46')](_0x42312a)[_0xc3cf('0x25')](handleEntityNotFound(_0x55c95b,null))[_0xc3cf('0x25')](respondWithResult(_0x55c95b,null))['catch'](handleError(_0x55c95b,null));};exports[_0xc3cf('0x24')]=function(_0x35a3ba,_0x1f2cbd){if(_0x35a3ba[_0xc3cf('0x47')]['id']){delete _0x35a3ba[_0xc3cf('0x47')]['id'];}return db[_0xc3cf('0x2b')][_0xc3cf('0x46')]({'where':{'id':_0x35a3ba[_0xc3cf('0x43')]['id']}})[_0xc3cf('0x25')](handleEntityNotFound(_0x1f2cbd,null))['then'](saveUpdates(_0x35a3ba[_0xc3cf('0x47')],null))[_0xc3cf('0x25')](respondWithResult(_0x1f2cbd,null))[_0xc3cf('0x41')](handleError(_0x1f2cbd,null));};exports[_0xc3cf('0x26')]=function(_0x3831a4,_0x129602){return db[_0xc3cf('0x2b')][_0xc3cf('0x46')]({'where':{'id':_0x3831a4[_0xc3cf('0x43')]['id']}})[_0xc3cf('0x25')](handleEntityNotFound(_0x129602,null))['then'](removeEntity(_0x129602,null))[_0xc3cf('0x41')](handleError(_0x129602,null));};exports[_0xc3cf('0x48')]=function(_0x41d5b0,_0x5cb80b){return db['CmHopperBlack']['describe']()['then'](respondWithResult(_0x5cb80b,null))['catch'](handleError(_0x5cb80b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d88efbc..713597e 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 _0xf5b9=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black'];(function(_0x575494,_0x77fca8){var _0x7fd47d=function(_0x442e3d){while(--_0x442e3d){_0x575494['push'](_0x575494['shift']());}};_0x7fd47d(++_0x77fca8);}(_0xf5b9,0x1d4));var _0x9f5b=function(_0x54a31f,_0x5b00d0){_0x54a31f=_0x54a31f-0x0;var _0x1ae377=_0xf5b9[_0x54a31f];return _0x1ae377;};'use strict';var _=require(_0x9f5b('0x0'));var util=require(_0x9f5b('0x1'));var logger=require(_0x9f5b('0x2'))(_0x9f5b('0x3'));var moment=require(_0x9f5b('0x4'));var BPromise=require(_0x9f5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f5b('0x6'));var config=require(_0x9f5b('0x7'));var attributes=require(_0x9f5b('0x8'));module['exports']=function(_0x16e2c9,_0x2eb856){return _0x16e2c9[_0x9f5b('0x9')](_0x9f5b('0xa'),attributes,{'tableName':_0x9f5b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c6c=['lodash','../../config/logger','api','rimraf','./cmHopperBlack.attributes','exports','cm_hopper_black'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7c6c,0x1ea));var _0xc7c6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7c6c[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xc7c6('0x0'));var util=require('util');var logger=require(_0xc7c6('0x1'))(_0xc7c6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc7c6('0x3'));var config=require('../../config/environment');var attributes=require(_0xc7c6('0x4'));module[_0xc7c6('0x5')]=function(_0x86a643,_0xa76b33){return _0x86a643['define']('CmHopperBlack',attributes,{'tableName':_0xc7c6('0x6'),'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 4a39492..f6f39be 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 _0x3a9a=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','include','map','model','attributes','then','UpdateCmHopperBlack','update','limit','destroy','DestroyCmHopperBlack','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0xf437c5,_0x5cb65c){var _0x302843=function(_0xa0111){while(--_0xa0111){_0xf437c5['push'](_0xf437c5['shift']());}};_0x302843(++_0x5cb65c);}(_0x3a9a,0x16d));var _0xa3a9=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x3a9a[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xa3a9('0x0'));var util=require(_0xa3a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3a9('0x3'))['db'];var utils=require(_0xa3a9('0x4'));var logger=require(_0xa3a9('0x5'))(_0xa3a9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3a9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdad778,_0x3091fb,_0x107b10){return new BPromise(function(_0x34c262,_0xdb1426){return client[_0xa3a9('0x8')](_0xdad778,_0x107b10)['then'](function(_0x257505){logger[_0xa3a9('0x9')](_0xa3a9('0xa'),_0x3091fb,_0xa3a9('0xb'));logger[_0xa3a9('0xc')](_0xa3a9('0xd'),_0x3091fb,_0xa3a9('0xb'),JSON[_0xa3a9('0xe')](_0x257505));if(_0x257505[_0xa3a9('0xf')]){if(_0x257505[_0xa3a9('0xf')][_0xa3a9('0x10')]===0x1f4){logger['error'](_0xa3a9('0xa'),_0x3091fb,_0x257505[_0xa3a9('0xf')][_0xa3a9('0x11')]);return _0xdb1426(_0x257505[_0xa3a9('0xf')]['message']);}logger['error'](_0xa3a9('0xa'),_0x3091fb,_0x257505[_0xa3a9('0xf')][_0xa3a9('0x11')]);return _0x34c262(_0x257505[_0xa3a9('0xf')][_0xa3a9('0x11')]);}else{logger[_0xa3a9('0x9')](_0xa3a9('0xa'),_0x3091fb,_0xa3a9('0xb'));_0x34c262(_0x257505['result']['message']);}})[_0xa3a9('0x12')](function(_0x56334e){logger[_0xa3a9('0xf')](_0xa3a9('0xa'),_0x3091fb,_0x56334e);_0xdb1426(_0x56334e);});});}exports[_0xa3a9('0x13')]=function(_0xb2764a){var _0x40936f=this;return new Promise(function(_0x4ceb7d,_0x4a8b5d){return db[_0xa3a9('0x14')]['findAll']({'raw':_0xb2764a['options']?_0xb2764a[_0xa3a9('0x15')][_0xa3a9('0x16')]===undefined?!![]:![]:!![],'where':_0xb2764a['options']?_0xb2764a['options'][_0xa3a9('0x17')]||null:null,'attributes':_0xb2764a[_0xa3a9('0x15')]?_0xb2764a['options']['attributes']||null:null,'limit':_0xb2764a[_0xa3a9('0x15')]?_0xb2764a[_0xa3a9('0x15')]['limit']||null:null,'include':_0xb2764a[_0xa3a9('0x15')]?_0xb2764a['options'][_0xa3a9('0x18')]?_[_0xa3a9('0x19')](_0xb2764a[_0xa3a9('0x15')][_0xa3a9('0x18')],function(_0xda1117){return{'model':db[_0xda1117[_0xa3a9('0x1a')]],'as':_0xda1117['as'],'attributes':_0xda1117['attributes'],'include':_0xda1117[_0xa3a9('0x18')]?_['map'](_0xda1117[_0xa3a9('0x18')],function(_0x18847a){return{'model':db[_0x18847a[_0xa3a9('0x1a')]],'as':_0x18847a['as'],'attributes':_0x18847a[_0xa3a9('0x1b')],'include':_0x18847a['include']?_[_0xa3a9('0x19')](_0x18847a[_0xa3a9('0x18')],function(_0x96e5fa){return{'model':db[_0x96e5fa[_0xa3a9('0x1a')]],'as':_0x96e5fa['as'],'attributes':_0x96e5fa['attributes']};}):[]};}):[]};}):[]:[]})[_0xa3a9('0x1c')](function(_0x42b01a){logger[_0xa3a9('0x9')]('GetCmHopperBlack',_0xb2764a);logger[_0xa3a9('0xc')](_0xa3a9('0x13'),_0xb2764a,JSON[_0xa3a9('0xe')](_0x42b01a));_0x4ceb7d(_0x42b01a);})['catch'](function(_0x112b56){logger['error'](_0xa3a9('0x13'),_0x112b56['message'],_0xb2764a);_0x4a8b5d(_0x40936f['error'](0x1f4,_0x112b56[_0xa3a9('0x11')]));});});};exports[_0xa3a9('0x1d')]=function(_0x465cb6){var _0x4f6a0e=this;return new Promise(function(_0x4d49ea,_0x1b5176){return db[_0xa3a9('0x14')][_0xa3a9('0x1e')](_0x465cb6['body'],{'raw':_0x465cb6[_0xa3a9('0x15')]?_0x465cb6['options'][_0xa3a9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x465cb6[_0xa3a9('0x15')]?_0x465cb6[_0xa3a9('0x15')][_0xa3a9('0x17')]||null:null,'attributes':_0x465cb6[_0xa3a9('0x15')]?_0x465cb6[_0xa3a9('0x15')][_0xa3a9('0x1b')]||null:null,'limit':_0x465cb6[_0xa3a9('0x15')]?_0x465cb6[_0xa3a9('0x15')][_0xa3a9('0x1f')]||null:null})['then'](function(_0x3016c5){logger[_0xa3a9('0x9')](_0xa3a9('0x1d'),_0x465cb6);logger['debug'](_0xa3a9('0x1d'),_0x465cb6,JSON[_0xa3a9('0xe')](_0x3016c5));_0x4d49ea(_0x3016c5);})[_0xa3a9('0x12')](function(_0x2f8d59){logger['error'](_0xa3a9('0x1d'),_0x2f8d59[_0xa3a9('0x11')],_0x465cb6);_0x1b5176(_0x4f6a0e['error'](0x1f4,_0x2f8d59['message']));});});};exports['DestroyCmHopperBlack']=function(_0x326106){var _0x1bedf6=this;return new Promise(function(_0x5d2495,_0x57f9ad){return db[_0xa3a9('0x14')][_0xa3a9('0x20')]({'where':_0x326106[_0xa3a9('0x15')]?_0x326106[_0xa3a9('0x15')][_0xa3a9('0x17')]||null:null})[_0xa3a9('0x1c')](function(_0x2a5349){logger[_0xa3a9('0x9')](_0xa3a9('0x21'),_0x326106);logger[_0xa3a9('0xc')](_0xa3a9('0x21'),_0x326106,JSON[_0xa3a9('0xe')](_0x2a5349));_0x5d2495(_0x2a5349);})[_0xa3a9('0x12')](function(_0x31f95e){logger[_0xa3a9('0xf')]('DestroyCmHopperBlack',_0x31f95e['message'],_0x326106);_0x57f9ad(_0x1bedf6[_0xa3a9('0xf')](0x1f4,_0x31f95e['message']));});});}; \ No newline at end of file +var _0x941b=['result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message'];(function(_0x12fb25,_0x4f82f3){var _0x2ec03a=function(_0x2f4b67){while(--_0x2f4b67){_0x12fb25['push'](_0x12fb25['shift']());}};_0x2ec03a(++_0x4f82f3);}(_0x941b,0xef));var _0xb941=function(_0x2a7c75,_0x4dc168){_0x2a7c75=_0x2a7c75-0x0;var _0x3efdf9=_0x941b[_0x2a7c75];return _0x3efdf9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb941('0x0'));var BPromise=require(_0xb941('0x1'));var rs=require(_0xb941('0x2'));var fs=require('fs');var Redis=require(_0xb941('0x3'));var db=require(_0xb941('0x4'))['db'];var utils=require(_0xb941('0x5'));var logger=require(_0xb941('0x6'))(_0xb941('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb941('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58cdba,_0x2ae72b,_0x26649c){return new BPromise(function(_0xc4e8b5,_0xaa9c71){return client[_0xb941('0x9')](_0x58cdba,_0x26649c)[_0xb941('0xa')](function(_0x1bffcd){logger[_0xb941('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x2ae72b,_0xb941('0xc'));logger[_0xb941('0xd')](_0xb941('0xe'),_0x2ae72b,_0xb941('0xc'),JSON[_0xb941('0xf')](_0x1bffcd));if(_0x1bffcd[_0xb941('0x10')]){if(_0x1bffcd[_0xb941('0x10')][_0xb941('0x11')]===0x1f4){logger['error'](_0xb941('0x12'),_0x2ae72b,_0x1bffcd[_0xb941('0x10')][_0xb941('0x13')]);return _0xaa9c71(_0x1bffcd[_0xb941('0x10')]['message']);}logger['error'](_0xb941('0x12'),_0x2ae72b,_0x1bffcd[_0xb941('0x10')][_0xb941('0x13')]);return _0xc4e8b5(_0x1bffcd['error']['message']);}else{logger[_0xb941('0xb')](_0xb941('0x12'),_0x2ae72b,'request\x20sent');_0xc4e8b5(_0x1bffcd[_0xb941('0x14')][_0xb941('0x13')]);}})[_0xb941('0x15')](function(_0x1c1902){logger[_0xb941('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2ae72b,_0x1c1902);_0xaa9c71(_0x1c1902);});});}exports[_0xb941('0x16')]=function(_0x1f9247){var _0x1ffe6b=this;return new Promise(function(_0x71d37a,_0x324dbc){return db['CmHopperBlack'][_0xb941('0x17')]({'raw':_0x1f9247[_0xb941('0x18')]?_0x1f9247[_0xb941('0x18')][_0xb941('0x19')]===undefined?!![]:![]:!![],'where':_0x1f9247[_0xb941('0x18')]?_0x1f9247[_0xb941('0x18')][_0xb941('0x1a')]||null:null,'attributes':_0x1f9247[_0xb941('0x18')]?_0x1f9247[_0xb941('0x18')][_0xb941('0x1b')]||null:null,'limit':_0x1f9247[_0xb941('0x18')]?_0x1f9247['options'][_0xb941('0x1c')]||null:null,'include':_0x1f9247[_0xb941('0x18')]?_0x1f9247[_0xb941('0x18')][_0xb941('0x1d')]?_['map'](_0x1f9247[_0xb941('0x18')]['include'],function(_0x114db7){return{'model':db[_0x114db7['model']],'as':_0x114db7['as'],'attributes':_0x114db7[_0xb941('0x1b')],'include':_0x114db7[_0xb941('0x1d')]?_[_0xb941('0x1e')](_0x114db7[_0xb941('0x1d')],function(_0x212f6c){return{'model':db[_0x212f6c['model']],'as':_0x212f6c['as'],'attributes':_0x212f6c[_0xb941('0x1b')],'include':_0x212f6c[_0xb941('0x1d')]?_[_0xb941('0x1e')](_0x212f6c[_0xb941('0x1d')],function(_0x4d98f0){return{'model':db[_0x4d98f0['model']],'as':_0x4d98f0['as'],'attributes':_0x4d98f0[_0xb941('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x437f08){logger[_0xb941('0xb')](_0xb941('0x16'),_0x1f9247);logger['debug']('GetCmHopperBlack',_0x1f9247,JSON[_0xb941('0xf')](_0x437f08));_0x71d37a(_0x437f08);})[_0xb941('0x15')](function(_0x468425){logger[_0xb941('0x10')](_0xb941('0x16'),_0x468425[_0xb941('0x13')],_0x1f9247);_0x324dbc(_0x1ffe6b[_0xb941('0x10')](0x1f4,_0x468425[_0xb941('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x1a26cb){var _0x28e39d=this;return new Promise(function(_0x552417,_0xecb4f4){return db[_0xb941('0x1f')][_0xb941('0x20')](_0x1a26cb[_0xb941('0x21')],{'raw':_0x1a26cb[_0xb941('0x18')]?_0x1a26cb['options'][_0xb941('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a26cb['options']?_0x1a26cb[_0xb941('0x18')][_0xb941('0x1a')]||null:null,'attributes':_0x1a26cb[_0xb941('0x18')]?_0x1a26cb['options'][_0xb941('0x1b')]||null:null,'limit':_0x1a26cb[_0xb941('0x18')]?_0x1a26cb[_0xb941('0x18')]['limit']||null:null})[_0xb941('0xa')](function(_0x3bcdfc){logger[_0xb941('0xb')]('UpdateCmHopperBlack',_0x1a26cb);logger[_0xb941('0xd')]('UpdateCmHopperBlack',_0x1a26cb,JSON[_0xb941('0xf')](_0x3bcdfc));_0x552417(_0x3bcdfc);})[_0xb941('0x15')](function(_0x58e4ce){logger['error'](_0xb941('0x22'),_0x58e4ce['message'],_0x1a26cb);_0xecb4f4(_0x28e39d[_0xb941('0x10')](0x1f4,_0x58e4ce[_0xb941('0x13')]));});});};exports[_0xb941('0x23')]=function(_0x4b07ed){var _0x1c4521=this;return new Promise(function(_0x36b751,_0x31d0b3){return db[_0xb941('0x1f')][_0xb941('0x24')]({'where':_0x4b07ed[_0xb941('0x18')]?_0x4b07ed['options'][_0xb941('0x1a')]||null:null})[_0xb941('0xa')](function(_0x1cc1f9){logger['info'](_0xb941('0x23'),_0x4b07ed);logger[_0xb941('0xd')](_0xb941('0x23'),_0x4b07ed,JSON['stringify'](_0x1cc1f9));_0x36b751(_0x1cc1f9);})[_0xb941('0x15')](function(_0x531d90){logger[_0xb941('0x10')](_0xb941('0x23'),_0x531d90[_0xb941('0x13')],_0x4b07ed);_0x31d0b3(_0x1c4521[_0xb941('0x10')](0x1f4,_0x531d90[_0xb941('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 05d4b38..8d303c3 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 _0xba34=['./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x52c6e3,_0x4f614b){var _0x2f320f=function(_0x3655bb){while(--_0x3655bb){_0x52c6e3['push'](_0x52c6e3['shift']());}};_0x2f320f(++_0x4f614b);}(_0xba34,0x119));var _0x4ba3=function(_0xdb9b57,_0x4b1ad6){_0xdb9b57=_0xdb9b57-0x0;var _0x2a6aa2=_0xba34[_0xdb9b57];return _0x2a6aa2;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1883=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4240d8,_0x4dba1b){var _0x3b42d4=function(_0x4cddd3){while(--_0x4cddd3){_0x4240d8['push'](_0x4240d8['shift']());}};_0x3b42d4(++_0x4dba1b);}(_0x1883,0xab));var _0x3188=function(_0x13b46b,_0x5911b6){_0x13b46b=_0x13b46b-0x0;var _0x28719b=_0x1883[_0x13b46b];return _0x28719b;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['describe']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['put'](_0x3188('0xf'),auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')]('/:id',auth[_0x3188('0xc')](),controller[_0x3188('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2fe6b46..685e60f 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 _0x7e0d=['setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','endtime'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x7e0d,0x165));var _0xd7e0=function(_0x132168,_0x4e5d6c){_0x132168=_0x132168-0x0;var _0x25c815=_0x7e0d[_0x132168];return _0x25c815;};'use strict';var Sequelize=require(_0xd7e0('0x0'));var moment=require(_0xd7e0('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd7e0('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd7e0('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd7e0('0x3')]},'starttime':{'type':Sequelize[_0xd7e0('0x4')]},'responsetime':{'type':Sequelize[_0xd7e0('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd7e0('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd7e0('0x3')]},'membername':{'type':Sequelize[_0xd7e0('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd7e0('0x3')]},'secondDisposition':{'type':Sequelize[_0xd7e0('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd7e0('0x3')]},'dispositionat':{'type':Sequelize[_0xd7e0('0x4')],'set':function(_0x5621e1){var _0x3dfc67=this['getDataValue'](_0xd7e0('0x5'));if(_0x3dfc67&&_0x5621e1){this[_0xd7e0('0x6')](_0xd7e0('0x7'),moment(_0x5621e1)[_0xd7e0('0x8')](moment(_0x3dfc67),_0xd7e0('0x9')));}}},'amd':{'type':Sequelize[_0xd7e0('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd7e0('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd7e0('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd7e0('0x4')]},'callback':{'type':Sequelize[_0xd7e0('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd7e0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd7e0('0x4')]},'deleted':{'type':Sequelize[_0xd7e0('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd7e0('0x4')]},'recallme':{'type':Sequelize[_0xd7e0('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd7e0('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd7e0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf715=['DATE','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x57a749,_0xbeb6a1){var _0x140804=function(_0x28aec0){while(--_0x28aec0){_0x57a749['push'](_0x57a749['shift']());}};_0x140804(++_0xbeb6a1);}(_0xf715,0x16f));var _0x5f71=function(_0x5ad07a,_0x29f321){_0x5ad07a=_0x5ad07a-0x0;var _0x216e17=_0xf715[_0x5ad07a];return _0x216e17;};'use strict';var Sequelize=require(_0x5f71('0x0'));var moment=require(_0x5f71('0x1'));module[_0x5f71('0x2')]={'state':{'type':Sequelize[_0x5f71('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x5f71('0x4')]},'scheduledat':{'type':Sequelize[_0x5f71('0x5')]},'countbusyretry':{'type':Sequelize[_0x5f71('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5f71('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5f71('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5f71('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5f71('0x4')]},'calleridnum':{'type':Sequelize[_0x5f71('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5f71('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5f71('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5f71('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5f71('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5f71('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5f71('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5f71('0x4')]},'membername':{'type':Sequelize[_0x5f71('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5f71('0x4')]},'secondDisposition':{'type':Sequelize[_0x5f71('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5f71('0x4')]},'dispositionat':{'type':Sequelize[_0x5f71('0x5')],'set':function(_0x507e8d){var _0x29fcf6=this[_0x5f71('0x6')](_0x5f71('0x7'));if(_0x29fcf6&&_0x507e8d){this[_0x5f71('0x8')](_0x5f71('0x9'),moment(_0x507e8d)['diff'](moment(_0x29fcf6),_0x5f71('0xa')));}}},'amd':{'type':Sequelize[_0x5f71('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5f71('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5f71('0x5')]},'callback':{'type':Sequelize[_0x5f71('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5f71('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5f71('0x5')]},'deleted':{'type':Sequelize[_0x5f71('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5f71('0x5')]},'recallme':{'type':Sequelize[_0x5f71('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5f71('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5f71('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5f71('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5f71('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 dc54f03..a470b79 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x23ad03,_0x5bced3){var _0x2f5991=function(_0xddde8d){while(--_0xddde8d){_0x23ad03['push'](_0x23ad03['shift']());}};_0x2f5991(++_0x5bced3);}(_0x1883,0xab));var _0x3188=function(_0xed3cfb,_0x1a335f){_0xed3cfb=_0xed3cfb-0x0;var _0xe8f878=_0x1883[_0xed3cfb];return _0xe8f878;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));}; \ No newline at end of file +var _0xba34=['insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`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','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xba34,0x119));var _0x4ba3=function(_0x27ea16,_0x32fec4){_0x27ea16=_0x27ea16-0x0;var _0x2ba757=_0xba34[_0x27ea16];return _0x2ba757;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['describe']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['describe']()[_0x4ba3('0x26')](respondWithResult(_0x1fe115,null))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports[_0x4ba3('0x25')]=function(_0x58648d,_0x47f588){if(_0x58648d[_0x4ba3('0x49')]['uniqueid']){delete _0x58648d[_0x4ba3('0x49')][_0x4ba3('0x4a')];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'uniqueid':_0x58648d[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x47f588,null))['then'](saveUpdates(_0x58648d[_0x4ba3('0x49')],null))[_0x4ba3('0x26')](respondWithResult(_0x47f588,null))['catch'](handleError(_0x47f588,null));};exports[_0x4ba3('0x4c')]=function(_0x12ae6f,_0x156c2d,_0x19d6a3){return db[_0x4ba3('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x12ae6f[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),_0x4ba3('0x53')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4ba3('0x54')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5a')))),_0x4ba3('0x5b')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x156c2d,null))[_0x4ba3('0x26')](respondWithResult(_0x156c2d,null))[_0x4ba3('0x46')](handleError(_0x156c2d,null));};exports[_0x4ba3('0x5d')]=function(_0xf0fd32,_0x4b5289,_0x3d9a7e){return db[_0x4ba3('0x2d')][_0x4ba3('0x44')]({'raw':![],'where':{'CampaignId':_0xf0fd32[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),'noAnswerContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x5e')))),'busyContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5f')))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4ba3('0x5b')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x4b5289,null))['then'](respondWithResult(_0x4b5289,null))[_0x4ba3('0x46')](handleError(_0x4b5289,null));};exports[_0x4ba3('0x60')]=function(_0x5dce8f,_0x37fedb,_0x2ed729){return db[_0x4ba3('0x61')][_0x4ba3('0x48')]({'where':{'id':_0x5dce8f[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x37fedb,null))[_0x4ba3('0x26')](function(_0x329874){var _0x360127;if(_0x329874){_0x360127=squel['insert']()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),_0x4ba3('0x66'),_0x4ba3('0x67'),_0x4ba3('0x68'),_0x4ba3('0x69'),_0x4ba3('0x6a'),_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')]('ANY_VALUE(calleridnum)',_0x4ba3('0x65'))[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')]('ANY_VALUE(ContactId)','ContactId')[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x6f'),_0x4ba3('0x69'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')]('state\x20=\x20?',_0x5dce8f[_0x4ba3('0x49')][_0x4ba3('0x75')][_0x4ba3('0x74')]())['where'](_0x4ba3('0x76'))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')]('cm_hopper')['where'](_0x4ba3('0x73'),_0x5dce8f['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field']('calleridnum')[_0x4ba3('0x71')](_0x4ba3('0x72'))['where'](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')](_0x4ba3('0x67')))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x360127);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x37fedb,null))['catch'](handleError(_0x37fedb,null));};exports[_0x4ba3('0x7a')]=function(_0x13dbc4,_0x4e334c,_0x39d1d3){return db[_0x4ba3('0x7b')]['find']({'where':{'id':_0x13dbc4['params']['id']}})['then'](handleEntityNotFound(_0x4e334c,null))['then'](function(_0x206e93){var _0x2d57a7;if(_0x206e93){_0x2d57a7=squel[_0x4ba3('0x7c')]()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),'scheduledAt',_0x4ba3('0x67'),'ListId',_0x4ba3('0x7d'),'createdAt',_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x7e'),_0x4ba3('0x65'))['field']('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')](_0x4ba3('0x7f'),_0x4ba3('0x67'))[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x80'),_0x4ba3('0x7d'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x81'),_0x13dbc4['body']['state'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x76'))['where'](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')](_0x4ba3('0x63'))['where'](_0x4ba3('0x82'),_0x13dbc4['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field'](_0x4ba3('0x83'))[_0x4ba3('0x71')]('cm_hopper_final')[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')]('ContactId'))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x2d57a7);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x4e334c,null))['catch'](handleError(_0x4e334c,null));};exports[_0x4ba3('0x84')]=function(_0x38a7a8,_0x5553eb,_0x402ab1){return db[_0x4ba3('0x85')][_0x4ba3('0x86')]({'where':{'VoiceQueueId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x69')],'CampaignId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x7d')],'ContactId':_0x38a7a8[_0x4ba3('0x49')]['ContactId']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5553eb,null))[_0x4ba3('0x26')](function(_0xfb16a6){if(_0xfb16a6){return _0xfb16a6;}return null;})[_0x4ba3('0x26')](respondWithResult(_0x5553eb,null))[_0x4ba3('0x46')](handleError(_0x5553eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index e6bcb40..dde3af8 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 _0x0c29=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x408ec6,_0x3654a8){var _0x49e017=function(_0x4e3e05){while(--_0x4e3e05){_0x408ec6['push'](_0x408ec6['shift']());}};_0x49e017(++_0x3654a8);}(_0x0c29,0x14f));var _0x90c2=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0x0c29[_0x214266];return _0x568f75;};'use strict';var _=require(_0x90c2('0x0'));var util=require(_0x90c2('0x1'));var logger=require(_0x90c2('0x2'))('api');var moment=require(_0x90c2('0x3'));var BPromise=require(_0x90c2('0x4'));var rp=require(_0x90c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90c2('0x6'));var config=require(_0x90c2('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x90c2('0x8')]=function(_0x6f43e3,_0x1068ed){return _0x6f43e3[_0x90c2('0x9')]('CmHopperFinal',attributes,{'tableName':_0x90c2('0xa'),'paranoid':![],'indexes':[{'name':_0x90c2('0xb'),'fields':[_0x90c2('0xb')]},{'name':_0x90c2('0xc'),'fields':[_0x90c2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa20=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x408828,_0x3f348c){var _0x4cbdec=function(_0x61c756){while(--_0x61c756){_0x408828['push'](_0x408828['shift']());}};_0x4cbdec(++_0x3f348c);}(_0xfa20,0xc9));var _0x0fa2=function(_0x2fcd6e,_0xc2f135){_0x2fcd6e=_0x2fcd6e-0x0;var _0x7789a3=_0xfa20[_0x2fcd6e];return _0x7789a3;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));var moment=require(_0x0fa2('0x4'));var BPromise=require(_0x0fa2('0x5'));var rp=require(_0x0fa2('0x6'));var fs=require('fs');var path=require(_0x0fa2('0x7'));var rimraf=require(_0x0fa2('0x8'));var config=require(_0x0fa2('0x9'));var attributes=require(_0x0fa2('0xa'));module['exports']=function(_0x189740,_0x3a9a5f){return _0x189740[_0x0fa2('0xb')](_0x0fa2('0xc'),attributes,{'tableName':_0x0fa2('0xd'),'paranoid':![],'indexes':[{'name':_0x0fa2('0xe'),'fields':[_0x0fa2('0xe')]},{'name':'uniqueid','fields':[_0x0fa2('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 76b78af..1233f4c 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(_0x60f36,_0x4160bb){var _0x25c221=function(_0x5414c6){while(--_0x5414c6){_0x60f36['push'](_0x60f36['shift']());}};_0x25c221(++_0x4160bb);}(_0xb10b,0x12a));var _0xbb10=function(_0x273fd1,_0x388bbe){_0x273fd1=_0x273fd1-0x0;var _0x5d3dbf=_0xb10b[_0x273fd1];return _0x5d3dbf;};'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(_0x2f4e06,_0x458e2c){var _0x25fb60=function(_0x56a29f){while(--_0x56a29f){_0x2f4e06['push'](_0x2f4e06['shift']());}};_0x25fb60(++_0x458e2c);}(_0xb10b,0x12a));var _0xbb10=function(_0x28f3a5,_0x2a84af){_0x28f3a5=_0x28f3a5-0x0;var _0x1a60bc=_0xb10b[_0x28f3a5];return _0x1a60bc;};'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 eb2335d..c34d6af 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 _0xa467=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xa467,0x143));var _0x7a46=function(_0x50c192,_0x33e66f){_0x50c192=_0x50c192-0x0;var _0x2b9aa9=_0xa467[_0x50c192];return _0x2b9aa9;};'use strict';var multer=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var path=require(_0x7a46('0x2'));var timeout=require(_0x7a46('0x3'));var express=require(_0x7a46('0x4'));var router=express[_0x7a46('0x5')]();var fs_extra=require(_0x7a46('0x6'));var auth=require(_0x7a46('0x7'));var interaction=require(_0x7a46('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x7a46('0x9')]('/',auth[_0x7a46('0xa')](),controller[_0x7a46('0xb')]);router[_0x7a46('0x9')](_0x7a46('0xc'),auth['isAuthenticated'](),controller[_0x7a46('0xd')]);router[_0x7a46('0x9')](_0x7a46('0xe'),auth[_0x7a46('0xa')](),controller[_0x7a46('0xf')]);router[_0x7a46('0x9')]('/voice/queue/countAttributes/:id',auth[_0x7a46('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x7a46('0x9')]('/campaign/countAttributes/:id',auth[_0x7a46('0xa')](),controller[_0x7a46('0x10')]);router[_0x7a46('0x11')](_0x7a46('0x12'),auth[_0x7a46('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x7a46('0x11')](_0x7a46('0x13'),auth[_0x7a46('0xa')](),controller[_0x7a46('0x14')]);router[_0x7a46('0x11')]('/checkContactHopper',auth[_0x7a46('0xa')](),controller['checkContactHopper']);router['put'](_0x7a46('0xe'),auth[_0x7a46('0xa')](),controller['update']);module[_0x7a46('0x15')]=router; \ No newline at end of file +var _0x2ef4=['isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperFinal.controller','get'];(function(_0x34d0de,_0x1e83d0){var _0x2a50e8=function(_0x1724f8){while(--_0x1724f8){_0x34d0de['push'](_0x34d0de['shift']());}};_0x2a50e8(++_0x1e83d0);}(_0x2ef4,0x143));var _0x42ef=function(_0x43134c,_0x429046){_0x43134c=_0x43134c-0x0;var _0x402213=_0x2ef4[_0x43134c];return _0x402213;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x42ef('0x0'));var timeout=require(_0x42ef('0x1'));var express=require(_0x42ef('0x2'));var router=express[_0x42ef('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x42ef('0x4'));var config=require('../../config/environment');var controller=require(_0x42ef('0x5'));router[_0x42ef('0x6')]('/',auth[_0x42ef('0x7')](),controller['index']);router[_0x42ef('0x6')](_0x42ef('0x8'),auth[_0x42ef('0x7')](),controller[_0x42ef('0x9')]);router['get'](_0x42ef('0xa'),auth[_0x42ef('0x7')](),controller[_0x42ef('0xb')]);router['get'](_0x42ef('0xc'),auth[_0x42ef('0x7')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x42ef('0x6')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x42ef('0xd')]);router[_0x42ef('0xe')](_0x42ef('0xf'),auth[_0x42ef('0x7')](),controller[_0x42ef('0x10')]);router[_0x42ef('0xe')]('/voice/campaign/moveContacts/:id',auth[_0x42ef('0x7')](),controller[_0x42ef('0x11')]);router[_0x42ef('0xe')](_0x42ef('0x12'),auth['isAuthenticated'](),controller[_0x42ef('0x13')]);router[_0x42ef('0x14')](_0x42ef('0xa'),auth[_0x42ef('0x7')](),controller['update']);module[_0x42ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index fbfdc52..604540e 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 _0x50a1=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x141ca5,_0x3cf958){var _0xfe9f6e=function(_0x5780e5){while(--_0x5780e5){_0x141ca5['push'](_0x141ca5['shift']());}};_0xfe9f6e(++_0x3cf958);}(_0x50a1,0x9a));var _0x150a=function(_0x14768a,_0x49d653){_0x14768a=_0x14768a-0x0;var _0x47ab06=_0x50a1[_0x14768a];return _0x47ab06;};'use strict';var Sequelize=require(_0x150a('0x0'));module[_0x150a('0x1')]={'state':{'type':Sequelize[_0x150a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x150a('0x3')]},'scheduledat':{'type':Sequelize[_0x150a('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x150a('0x3')]},'originatecalleridname':{'type':Sequelize[_0x150a('0x3')]},'calleridnum':{'type':Sequelize[_0x150a('0x3')]},'calleridname':{'type':Sequelize[_0x150a('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x150a('0x4')]},'answertime':{'type':Sequelize[_0x150a('0x4')]},'droptime':{'type':Sequelize[_0x150a('0x4')]},'endtime':{'type':Sequelize[_0x150a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x150a('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x150a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x150a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x150a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x150a('0x4')]},'recallme':{'type':Sequelize[_0x150a('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x150a('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa1ad=['BOOLEAN','sequelize','exports','INTEGER','DATE','STRING'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xa1ad,0xf7));var _0xda1a=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0xa1ad[_0x2af160];return _0x439d67;};'use strict';var Sequelize=require(_0xda1a('0x0'));module[_0xda1a('0x1')]={'state':{'type':Sequelize[_0xda1a('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xda1a('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xda1a('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xda1a('0x4')]},'originatecalleridname':{'type':Sequelize[_0xda1a('0x4')]},'calleridnum':{'type':Sequelize[_0xda1a('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xda1a('0x3')]},'responsetime':{'type':Sequelize[_0xda1a('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xda1a('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xda1a('0x4')]},'campaign':{'type':Sequelize[_0xda1a('0x4')]},'campaigntype':{'type':Sequelize[_0xda1a('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xda1a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xda1a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xda1a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xda1a('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xda1a('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xda1a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda1a('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xda1a('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 42d3ff9..dd349bf 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 _0x7044=['query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','fields','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../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','reject','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model'];(function(_0x2b1e5c,_0x57f934){var _0x21ce0d=function(_0x24b1c9){while(--_0x24b1c9){_0x2b1e5c['push'](_0x2b1e5c['shift']());}};_0x21ce0d(++_0x57f934);}(_0x7044,0x147));var _0x4704=function(_0x13d915,_0x306818){_0x13d915=_0x13d915-0x0;var _0x3e1907=_0x7044[_0x13d915];return _0x3e1907;};'use strict';var emlformat=require(_0x4704('0x0'));var rimraf=require(_0x4704('0x1'));var zipdir=require(_0x4704('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4704('0x3'));var moment=require(_0x4704('0x4'));var BPromise=require(_0x4704('0x5'));var Mustache=require(_0x4704('0x6'));var util=require('util');var path=require(_0x4704('0x7'));var sox=require('sox');var csv=require(_0x4704('0x8'));var ejs=require(_0x4704('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4704('0xa'));var crypto=require(_0x4704('0xb'));var jsforce=require(_0x4704('0xc'));var deskjs=require(_0x4704('0xd'));var toCsv=require(_0x4704('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4704('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4704('0xf'));var as=require(_0x4704('0x10'));var hardwareService=require(_0x4704('0x11'));var logger=require(_0x4704('0x12'))(_0x4704('0x13'));var utils=require('../../config/utils');var config=require(_0x4704('0x14'));var licenseUtil=require(_0x4704('0x15'));var db=require(_0x4704('0x16'))['db'];function respondWithStatusCode(_0x30f8e8,_0x39ee42){_0x39ee42=_0x39ee42||0xcc;return function(_0x268453){if(_0x268453){return _0x30f8e8['sendStatus'](_0x39ee42);}return _0x30f8e8[_0x4704('0x17')](_0x39ee42)[_0x4704('0x18')]();};}function respondWithResult(_0x290e8e,_0x2ae487){_0x2ae487=_0x2ae487||0xc8;return function(_0x246765){if(_0x246765){return _0x290e8e[_0x4704('0x17')](_0x2ae487)[_0x4704('0x19')](_0x246765);}};}function respondWithFilteredResult(_0x3acce4,_0x27c4b8){return function(_0x5d5f3b){if(_0x5d5f3b){var _0x51ea30=typeof _0x27c4b8[_0x4704('0x1a')]===_0x4704('0x1b')&&typeof _0x27c4b8[_0x4704('0x1c')]===_0x4704('0x1b');var _0x185f39=_0x5d5f3b['count'];var _0x44440b=_0x51ea30?0x0:_0x27c4b8[_0x4704('0x1a')];var _0x10ff93=_0x51ea30?_0x5d5f3b[_0x4704('0x1d')]:_0x27c4b8[_0x4704('0x1a')]+_0x27c4b8['limit'];var _0x14b553;if(_0x10ff93>=_0x185f39){_0x10ff93=_0x185f39;_0x14b553=0xc8;}else{_0x14b553=0xce;}_0x3acce4['status'](_0x14b553);return _0x3acce4[_0x4704('0x1e')](_0x4704('0x1f'),_0x44440b+'-'+_0x10ff93+'/'+_0x185f39)[_0x4704('0x19')](_0x5d5f3b);}return null;};}function patchUpdates(_0x91fc0f){return function(_0x568704){try{jsonpatch[_0x4704('0x20')](_0x568704,_0x91fc0f,!![]);}catch(_0x4a7642){return BPromise[_0x4704('0x21')](_0x4a7642);}return _0x568704['save']();};}function saveUpdates(_0x3e7d5b,_0x85ac91){return function(_0x18d3d6){if(_0x18d3d6){return _0x18d3d6[_0x4704('0x22')](_0x3e7d5b)[_0x4704('0x23')](function(_0x59a444){return _0x59a444;});}return null;};}function removeEntity(_0xd41c4b,_0x26d9b1){return function(_0x48bbb1){if(_0x48bbb1){return _0x48bbb1[_0x4704('0x24')]()[_0x4704('0x23')](function(){_0xd41c4b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3e2d,_0x10f5a6){return function(_0x148e0c){if(!_0x148e0c){_0x1c3e2d[_0x4704('0x25')](0x194);}return _0x148e0c;};}function handleError(_0x1538cd,_0x5e3018){_0x5e3018=_0x5e3018||0x1f4;return function(_0x2d4c42){logger[_0x4704('0x26')](_0x2d4c42['stack']);if(_0x2d4c42[_0x4704('0x27')]){delete _0x2d4c42[_0x4704('0x27')];}_0x1538cd[_0x4704('0x17')](_0x5e3018)[_0x4704('0x28')](_0x2d4c42);};}exports[_0x4704('0x29')]=function(_0x42521f,_0x3b6dc3){var _0x99c5f1={},_0x2d1177={},_0x10086d={'count':0x0,'rows':[]};var _0x53dba4=_[_0x4704('0x2a')](db[_0x4704('0x2b')][_0x4704('0x2c')],function(_0x480128){return{'name':_0x480128['fieldName'],'type':_0x480128[_0x4704('0x2d')][_0x4704('0x2e')]};});_0x2d1177[_0x4704('0x2f')]=_[_0x4704('0x2a')](_0x53dba4,_0x4704('0x27'));_0x2d1177[_0x4704('0x30')]=_[_0x4704('0x31')](_0x42521f[_0x4704('0x30')]);_0x2d1177['filters']=_[_0x4704('0x32')](_0x2d1177['model'],_0x2d1177[_0x4704('0x30')]);_0x99c5f1[_0x4704('0x33')]=_[_0x4704('0x32')](_0x2d1177[_0x4704('0x2f')],qs['fields'](_0x42521f['query']['fields']));_0x99c5f1[_0x4704('0x33')]=_0x99c5f1[_0x4704('0x33')][_0x4704('0x34')]?_0x99c5f1[_0x4704('0x33')]:_0x2d1177[_0x4704('0x2f')];if(!_0x42521f[_0x4704('0x30')][_0x4704('0x35')](_0x4704('0x36'))){_0x99c5f1[_0x4704('0x1c')]=qs[_0x4704('0x1c')](_0x42521f[_0x4704('0x30')][_0x4704('0x1c')]);_0x99c5f1[_0x4704('0x1a')]=qs[_0x4704('0x1a')](_0x42521f['query'][_0x4704('0x1a')]);}_0x99c5f1[_0x4704('0x37')]=qs[_0x4704('0x38')](_0x42521f[_0x4704('0x30')][_0x4704('0x38')]);_0x99c5f1[_0x4704('0x39')]=qs['filters'](_[_0x4704('0x3a')](_0x42521f[_0x4704('0x30')],_0x2d1177[_0x4704('0x3b')]),_0x53dba4);if(_0x42521f[_0x4704('0x30')][_0x4704('0x3c')]){_0x99c5f1[_0x4704('0x39')]=_[_0x4704('0x3d')](_0x99c5f1[_0x4704('0x39')],{'$or':_[_0x4704('0x2a')](_0x53dba4,function(_0x1c830f){if(_0x1c830f[_0x4704('0x2d')]!==_0x4704('0x3e')){var _0x321daf={};_0x321daf[_0x1c830f[_0x4704('0x27')]]={'$like':'%'+_0x42521f['query']['filter']+'%'};return _0x321daf;}})});}_0x99c5f1=_[_0x4704('0x3d')]({},_0x99c5f1,_0x42521f['options']);var _0x8e225b={'where':_0x99c5f1[_0x4704('0x39')]};return db[_0x4704('0x2b')]['count'](_0x8e225b)[_0x4704('0x23')](function(_0x36d74d){_0x10086d[_0x4704('0x1d')]=_0x36d74d;if(_0x42521f[_0x4704('0x30')][_0x4704('0x3f')]){_0x99c5f1[_0x4704('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4704('0x41')](_0x99c5f1);})['then'](function(_0x253fce){_0x10086d['rows']=_0x253fce;return _0x10086d;})[_0x4704('0x23')](respondWithFilteredResult(_0x3b6dc3,_0x99c5f1))[_0x4704('0x42')](handleError(_0x3b6dc3,null));};exports['show']=function(_0x2886fa,_0x15998c){var _0x5afc09={'raw':!![],'where':{'id':_0x2886fa[_0x4704('0x43')]['id']}},_0x55f50e={};_0x55f50e[_0x4704('0x2f')]=_[_0x4704('0x31')](db['CmHopperHistory'][_0x4704('0x2c')]);_0x55f50e[_0x4704('0x30')]=_[_0x4704('0x31')](_0x2886fa[_0x4704('0x30')]);_0x55f50e[_0x4704('0x3b')]=_[_0x4704('0x32')](_0x55f50e[_0x4704('0x2f')],_0x55f50e[_0x4704('0x30')]);_0x5afc09[_0x4704('0x33')]=_[_0x4704('0x32')](_0x55f50e['model'],qs[_0x4704('0x44')](_0x2886fa['query'][_0x4704('0x44')]));_0x5afc09[_0x4704('0x33')]=_0x5afc09[_0x4704('0x33')][_0x4704('0x34')]?_0x5afc09['attributes']:_0x55f50e[_0x4704('0x2f')];if(_0x2886fa[_0x4704('0x30')]['includeAll']){_0x5afc09['include']=[{'all':!![]}];}_0x5afc09=_[_0x4704('0x3d')]({},_0x5afc09,_0x2886fa[_0x4704('0x45')]);return db[_0x4704('0x2b')][_0x4704('0x46')](_0x5afc09)[_0x4704('0x23')](handleEntityNotFound(_0x15998c,null))[_0x4704('0x23')](respondWithResult(_0x15998c,null))[_0x4704('0x42')](handleError(_0x15998c,null));};exports[_0x4704('0x47')]=function(_0x54c4bf,_0x20cfd7){return db['CmHopperHistory'][_0x4704('0x47')](_0x54c4bf[_0x4704('0x48')],{})[_0x4704('0x23')](respondWithResult(_0x20cfd7,0xc9))[_0x4704('0x42')](handleError(_0x20cfd7,null));};exports[_0x4704('0x49')]=function(_0x113c8f,_0x30f4a4){return db[_0x4704('0x2b')][_0x4704('0x49')]()[_0x4704('0x23')](respondWithResult(_0x30f4a4,null))[_0x4704('0x42')](handleError(_0x30f4a4,null));};exports[_0x4704('0x22')]=function(_0x51cb60,_0x1c496c){if(_0x51cb60[_0x4704('0x48')][_0x4704('0x4a')]){delete _0x51cb60['body'][_0x4704('0x4a')];}return db[_0x4704('0x2b')][_0x4704('0x46')]({'where':{'uniqueid':_0x51cb60[_0x4704('0x43')]['id']}})[_0x4704('0x23')](handleEntityNotFound(_0x1c496c,null))[_0x4704('0x23')](saveUpdates(_0x51cb60['body'],null))[_0x4704('0x23')](respondWithResult(_0x1c496c,null))['catch'](handleError(_0x1c496c,null));}; \ No newline at end of file +var _0xe82e=['destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','CmHopperHistory','includeAll','catch','show','params','keys','find','create','describe','update','uniqueid','body','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x1e28e7,_0x3f1a89){var _0x1ea986=function(_0x5df3ee){while(--_0x5df3ee){_0x1e28e7['push'](_0x1e28e7['shift']());}};_0x1ea986(++_0x3f1a89);}(_0xe82e,0x6f));var _0xee82=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe82e[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee82('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee82('0x1'));var rp=require('request-promise');var moment=require(_0xee82('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xee82('0x3'));var util=require(_0xee82('0x4'));var path=require(_0xee82('0x5'));var sox=require(_0xee82('0x6'));var csv=require('to-csv');var ejs=require(_0xee82('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee82('0x8'));var squel=require('squel');var crypto=require(_0xee82('0x9'));var jsforce=require(_0xee82('0xa'));var deskjs=require(_0xee82('0xb'));var toCsv=require(_0xee82('0xc'));var querystring=require(_0xee82('0xd'));var Papa=require(_0xee82('0xe'));var Redis=require(_0xee82('0xf'));var authService=require(_0xee82('0x10'));var qs=require(_0xee82('0x11'));var as=require(_0xee82('0x12'));var hardwareService=require(_0xee82('0x13'));var logger=require('../../config/logger')(_0xee82('0x14'));var utils=require(_0xee82('0x15'));var config=require(_0xee82('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa1196d,_0x131179){_0x131179=_0x131179||0xcc;return function(_0x2ffecc){if(_0x2ffecc){return _0xa1196d['sendStatus'](_0x131179);}return _0xa1196d[_0xee82('0x17')](_0x131179)[_0xee82('0x18')]();};}function respondWithResult(_0x18e19f,_0x40114e){_0x40114e=_0x40114e||0xc8;return function(_0x4b9c19){if(_0x4b9c19){return _0x18e19f[_0xee82('0x17')](_0x40114e)[_0xee82('0x19')](_0x4b9c19);}};}function respondWithFilteredResult(_0x359fef,_0x40d008){return function(_0x55505d){if(_0x55505d){var _0x42a6ae=typeof _0x40d008[_0xee82('0x1a')]==='undefined'&&typeof _0x40d008[_0xee82('0x1b')]===_0xee82('0x1c');var _0x571992=_0x55505d[_0xee82('0x1d')];var _0x183425=_0x42a6ae?0x0:_0x40d008[_0xee82('0x1a')];var _0x4648c5=_0x42a6ae?_0x55505d[_0xee82('0x1d')]:_0x40d008['offset']+_0x40d008[_0xee82('0x1b')];var _0x5c1feb;if(_0x4648c5>=_0x571992){_0x4648c5=_0x571992;_0x5c1feb=0xc8;}else{_0x5c1feb=0xce;}_0x359fef[_0xee82('0x17')](_0x5c1feb);return _0x359fef[_0xee82('0x1e')](_0xee82('0x1f'),_0x183425+'-'+_0x4648c5+'/'+_0x571992)['json'](_0x55505d);}return null;};}function patchUpdates(_0x11455d){return function(_0x296dcd){try{jsonpatch[_0xee82('0x20')](_0x296dcd,_0x11455d,!![]);}catch(_0x2d6790){return BPromise[_0xee82('0x21')](_0x2d6790);}return _0x296dcd[_0xee82('0x22')]();};}function saveUpdates(_0x33dd59,_0x242a3a){return function(_0x5d988d){if(_0x5d988d){return _0x5d988d['update'](_0x33dd59)['then'](function(_0x35e0b3){return _0x35e0b3;});}return null;};}function removeEntity(_0x161bd4,_0x55629e){return function(_0x301108){if(_0x301108){return _0x301108[_0xee82('0x23')]()[_0xee82('0x24')](function(){_0x161bd4[_0xee82('0x17')](0xcc)[_0xee82('0x18')]();});}};}function handleEntityNotFound(_0x38b596,_0x957307){return function(_0x1f9b27){if(!_0x1f9b27){_0x38b596[_0xee82('0x25')](0x194);}return _0x1f9b27;};}function handleError(_0x1c2af4,_0x43f0fe){_0x43f0fe=_0x43f0fe||0x1f4;return function(_0x1b6135){logger[_0xee82('0x26')](_0x1b6135[_0xee82('0x27')]);if(_0x1b6135['name']){delete _0x1b6135[_0xee82('0x28')];}_0x1c2af4[_0xee82('0x17')](_0x43f0fe)[_0xee82('0x29')](_0x1b6135);};}exports[_0xee82('0x2a')]=function(_0x10d7d5,_0x54b2fb){var _0x22416b={},_0x1f25e1={},_0x1394a5={'count':0x0,'rows':[]};var _0x2b5113=_[_0xee82('0x2b')](db['CmHopperHistory'][_0xee82('0x2c')],function(_0x236299){return{'name':_0x236299[_0xee82('0x2d')],'type':_0x236299['type']['key']};});_0x1f25e1[_0xee82('0x2e')]=_[_0xee82('0x2b')](_0x2b5113,'name');_0x1f25e1[_0xee82('0x2f')]=_['keys'](_0x10d7d5[_0xee82('0x2f')]);_0x1f25e1[_0xee82('0x30')]=_[_0xee82('0x31')](_0x1f25e1['model'],_0x1f25e1[_0xee82('0x2f')]);_0x22416b['attributes']=_[_0xee82('0x31')](_0x1f25e1[_0xee82('0x2e')],qs[_0xee82('0x32')](_0x10d7d5[_0xee82('0x2f')]['fields']));_0x22416b[_0xee82('0x33')]=_0x22416b[_0xee82('0x33')]['length']?_0x22416b[_0xee82('0x33')]:_0x1f25e1[_0xee82('0x2e')];if(!_0x10d7d5['query'][_0xee82('0x34')](_0xee82('0x35'))){_0x22416b[_0xee82('0x1b')]=qs['limit'](_0x10d7d5[_0xee82('0x2f')][_0xee82('0x1b')]);_0x22416b[_0xee82('0x1a')]=qs[_0xee82('0x1a')](_0x10d7d5[_0xee82('0x2f')][_0xee82('0x1a')]);}_0x22416b[_0xee82('0x36')]=qs[_0xee82('0x37')](_0x10d7d5['query'][_0xee82('0x37')]);_0x22416b['where']=qs[_0xee82('0x30')](_['pick'](_0x10d7d5['query'],_0x1f25e1['filters']),_0x2b5113);if(_0x10d7d5['query'][_0xee82('0x38')]){_0x22416b[_0xee82('0x39')]=_[_0xee82('0x3a')](_0x22416b[_0xee82('0x39')],{'$or':_[_0xee82('0x2b')](_0x2b5113,function(_0x1a8b04){if(_0x1a8b04[_0xee82('0x3b')]!=='VIRTUAL'){var _0x580e58={};_0x580e58[_0x1a8b04[_0xee82('0x28')]]={'$like':'%'+_0x10d7d5[_0xee82('0x2f')]['filter']+'%'};return _0x580e58;}})});}_0x22416b=_[_0xee82('0x3a')]({},_0x22416b,_0x10d7d5[_0xee82('0x3c')]);var _0x354d58={'where':_0x22416b[_0xee82('0x39')]};return db[_0xee82('0x3d')][_0xee82('0x1d')](_0x354d58)[_0xee82('0x24')](function(_0x558674){_0x1394a5[_0xee82('0x1d')]=_0x558674;if(_0x10d7d5[_0xee82('0x2f')][_0xee82('0x3e')]){_0x22416b['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x22416b);})[_0xee82('0x24')](function(_0x3322a9){_0x1394a5['rows']=_0x3322a9;return _0x1394a5;})['then'](respondWithFilteredResult(_0x54b2fb,_0x22416b))[_0xee82('0x3f')](handleError(_0x54b2fb,null));};exports[_0xee82('0x40')]=function(_0xdef93f,_0xbf9200){var _0x2b680e={'raw':!![],'where':{'id':_0xdef93f[_0xee82('0x41')]['id']}},_0x1ac01e={};_0x1ac01e[_0xee82('0x2e')]=_['keys'](db[_0xee82('0x3d')]['rawAttributes']);_0x1ac01e[_0xee82('0x2f')]=_[_0xee82('0x42')](_0xdef93f[_0xee82('0x2f')]);_0x1ac01e[_0xee82('0x30')]=_['intersection'](_0x1ac01e['model'],_0x1ac01e['query']);_0x2b680e[_0xee82('0x33')]=_[_0xee82('0x31')](_0x1ac01e[_0xee82('0x2e')],qs[_0xee82('0x32')](_0xdef93f[_0xee82('0x2f')][_0xee82('0x32')]));_0x2b680e['attributes']=_0x2b680e[_0xee82('0x33')]['length']?_0x2b680e[_0xee82('0x33')]:_0x1ac01e[_0xee82('0x2e')];if(_0xdef93f[_0xee82('0x2f')]['includeAll']){_0x2b680e['include']=[{'all':!![]}];}_0x2b680e=_['merge']({},_0x2b680e,_0xdef93f['options']);return db[_0xee82('0x3d')][_0xee82('0x43')](_0x2b680e)[_0xee82('0x24')](handleEntityNotFound(_0xbf9200,null))['then'](respondWithResult(_0xbf9200,null))[_0xee82('0x3f')](handleError(_0xbf9200,null));};exports[_0xee82('0x44')]=function(_0x103fad,_0x4a6a28){return db[_0xee82('0x3d')]['create'](_0x103fad['body'],{})[_0xee82('0x24')](respondWithResult(_0x4a6a28,0xc9))[_0xee82('0x3f')](handleError(_0x4a6a28,null));};exports['describe']=function(_0x84f5ca,_0x2e15fd){return db[_0xee82('0x3d')][_0xee82('0x45')]()[_0xee82('0x24')](respondWithResult(_0x2e15fd,null))[_0xee82('0x3f')](handleError(_0x2e15fd,null));};exports[_0xee82('0x46')]=function(_0x5d33b6,_0x453368){if(_0x5d33b6['body'][_0xee82('0x47')]){delete _0x5d33b6['body'][_0xee82('0x47')];}return db[_0xee82('0x3d')]['find']({'where':{'uniqueid':_0x5d33b6[_0xee82('0x41')]['id']}})[_0xee82('0x24')](handleEntityNotFound(_0x453368,null))['then'](saveUpdates(_0x5d33b6[_0xee82('0x48')],null))[_0xee82('0x24')](respondWithResult(_0x453368,null))['catch'](handleError(_0x453368,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a9fd88e..2dae5e2 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 _0x5f66=['request-promise','path','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','api','moment','bluebird'];(function(_0xab1305,_0x1d6f73){var _0x527ba0=function(_0x2642ff){while(--_0x2642ff){_0xab1305['push'](_0xab1305['shift']());}};_0x527ba0(++_0x1d6f73);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'name':_0x65f6('0xa'),'fields':[_0x65f6('0xa')]},{'name':_0x65f6('0xb'),'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c9a=['request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x23e962,_0x15e268){var _0x5d068d=function(_0xd8e831){while(--_0xd8e831){_0x23e962['push'](_0x23e962['shift']());}};_0x5d068d(++_0x15e268);}(_0x1c9a,0x98));var _0xa1c9=function(_0x1c9ec1,_0xca352d){_0x1c9ec1=_0x1c9ec1-0x0;var _0x279a60=_0x1c9a[_0x1c9ec1];return _0x279a60;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var logger=require(_0xa1c9('0x1'))('api');var moment=require(_0xa1c9('0x2'));var BPromise=require(_0xa1c9('0x3'));var rp=require(_0xa1c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c9('0x5'));var config=require(_0xa1c9('0x6'));var attributes=require(_0xa1c9('0x7'));module[_0xa1c9('0x8')]=function(_0x572229,_0x144e91){return _0x572229['define'](_0xa1c9('0x9'),attributes,{'tableName':_0xa1c9('0xa'),'paranoid':![],'indexes':[{'name':_0xa1c9('0xb'),'fields':['endtime']},{'name':_0xa1c9('0xc'),'fields':[_0xa1c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2a696be..94fc478 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 _0x8a1b=['predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','then','AvgHandleTime','raw','sequelize','COUNT','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x6d50dc,_0x5809dc){_0x6d50dc=_0x6d50dc-0x0;var _0x2d7b6e=_0x8a1b[_0x6d50dc];return _0x2d7b6e;};'use strict';var _=require(_0xb8a1('0x0'));var util=require(_0xb8a1('0x1'));var moment=require('moment');var BPromise=require(_0xb8a1('0x2'));var rs=require(_0xb8a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb8a1('0x4'));var logger=require(_0xb8a1('0x5'))(_0xb8a1('0x6'));var config=require(_0xb8a1('0x7'));var jayson=require(_0xb8a1('0x8'));var client=jayson['client'][_0xb8a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x444ef7,_0x1e8118,_0x3f34e5){return new BPromise(function(_0x2370d3,_0x546519){return client[_0xb8a1('0xa')](_0x444ef7,_0x3f34e5)['then'](function(_0x4e398a){logger[_0xb8a1('0xb')](_0xb8a1('0xc'),_0x1e8118,'request\x20sent');logger[_0xb8a1('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1e8118,_0xb8a1('0xe'),JSON[_0xb8a1('0xf')](_0x4e398a));if(_0x4e398a[_0xb8a1('0x10')]){if(_0x4e398a[_0xb8a1('0x10')]['code']===0x1f4){logger[_0xb8a1('0x10')](_0xb8a1('0xc'),_0x1e8118,_0x4e398a[_0xb8a1('0x10')][_0xb8a1('0x11')]);return _0x546519(_0x4e398a['error'][_0xb8a1('0x11')]);}logger[_0xb8a1('0x10')](_0xb8a1('0xc'),_0x1e8118,_0x4e398a[_0xb8a1('0x10')][_0xb8a1('0x11')]);return _0x2370d3(_0x4e398a[_0xb8a1('0x10')][_0xb8a1('0x11')]);}else{logger[_0xb8a1('0xb')](_0xb8a1('0xc'),_0x1e8118,_0xb8a1('0xe'));_0x2370d3(_0x4e398a[_0xb8a1('0x12')]['message']);}})[_0xb8a1('0x13')](function(_0x3fed21){logger[_0xb8a1('0x10')](_0xb8a1('0xc'),_0x1e8118,_0x3fed21);_0x546519(_0x3fed21);});});}exports[_0xb8a1('0x14')]=function(_0x2ad525){var _0x291ff3=this;return new Promise(function(_0xdf75f0,_0x1bc506){return db[_0xb8a1('0x15')][_0xb8a1('0x16')](_0x2ad525[_0xb8a1('0x17')],{'raw':_0x2ad525[_0xb8a1('0x18')]?_0x2ad525['options']['raw']===undefined?!![]:![]:!![]})[_0xb8a1('0x19')](function(_0x51859f){logger['info'](_0xb8a1('0x14'),_0x2ad525);logger[_0xb8a1('0xd')](_0xb8a1('0x14'),_0x2ad525,JSON[_0xb8a1('0xf')](_0x51859f));_0xdf75f0(_0x51859f);})[_0xb8a1('0x13')](function(_0x3f616f){logger[_0xb8a1('0x10')](_0xb8a1('0x14'),_0x3f616f[_0xb8a1('0x11')],_0x2ad525);_0x1bc506(_0x291ff3[_0xb8a1('0x10')](0x1f4,_0x3f616f[_0xb8a1('0x11')]));});});};exports[_0xb8a1('0x1a')]=function(_0x2d9d56){var _0x54025f=this;return new Promise(function(_0x475b19,_0x116232){return db['CmHopperHistory']['findAll']({'raw':_0x2d9d56[_0xb8a1('0x18')]?_0x2d9d56[_0xb8a1('0x18')][_0xb8a1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d9d56[_0xb8a1('0x18')]?_0x2d9d56['options']['where']||null:null,'attributes':[[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['col']('id')),_0xb8a1('0x1e')],[db['sequelize']['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db['sequelize'][_0xb8a1('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0xb8a1('0x20')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')]['literal'](_0xb8a1('0x21')))),_0xb8a1('0x22')],[db['sequelize']['fn'](_0xb8a1('0x1d'),db['sequelize']['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')](_0xb8a1('0x23')))),_0xb8a1('0x24')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x25'),db['sequelize']['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')](_0xb8a1('0x26')))),_0xb8a1('0x27')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x25'),db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xb8a1('0x28')]]})['then'](function(_0x452c9f){logger[_0xb8a1('0xb')](_0xb8a1('0x1a'),_0x2d9d56);logger[_0xb8a1('0xd')](_0xb8a1('0x1a'),_0x2d9d56,JSON[_0xb8a1('0xf')](_0x452c9f));_0x475b19(_0x452c9f);})[_0xb8a1('0x13')](function(_0x3d2eeb){logger[_0xb8a1('0x10')](_0xb8a1('0x1a'),_0x3d2eeb[_0xb8a1('0x11')],_0x2d9d56);_0x116232(_0x54025f[_0xb8a1('0x10')](0x1f4,_0x3d2eeb[_0xb8a1('0x11')]));});});};exports[_0xb8a1('0x29')]=function(_0x24f664){var _0x434e5c=this;return new Promise(function(_0x2857e2,_0x57f861){return db[_0xb8a1('0x15')][_0xb8a1('0x2a')]({'raw':_0x24f664[_0xb8a1('0x18')]?_0x24f664[_0xb8a1('0x18')][_0xb8a1('0x1b')]===undefined?!![]:![]:!![],'where':_0x24f664[_0xb8a1('0x18')]?_0x24f664['options'][_0xb8a1('0x2b')]||null:null,'attributes':[[_0xb8a1('0x2c'),_0xb8a1('0x2d')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')](_0xb8a1('0x2e')))),_0xb8a1('0x2f')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0xb8a1('0x30')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db['sequelize'][_0xb8a1('0x1f')](_0xb8a1('0x31')))),_0xb8a1('0x32')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xb8a1('0x33')))),_0xb8a1('0x34')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')](_0xb8a1('0x35')))),_0xb8a1('0x36')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db['sequelize'][_0xb8a1('0x1f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb8a1('0x37')],[db[_0xb8a1('0x1c')]['fn']('COUNT',db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')](_0xb8a1('0x38')))),_0xb8a1('0x39')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')](_0xb8a1('0x3a')))),_0xb8a1('0x3b')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xb8a1('0x1f')](_0xb8a1('0x3c')))),'outboundBlacklistCallsDay'],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xb8a1('0x3d')))),_0xb8a1('0x3e')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db['sequelize'][_0xb8a1('0x1f')](_0xb8a1('0x3f')))),_0xb8a1('0x40')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')][_0xb8a1('0x1f')](_0xb8a1('0x41')))),_0xb8a1('0x40')],[db[_0xb8a1('0x1c')]['fn'](_0xb8a1('0x1d'),db[_0xb8a1('0x1c')]['fn']('IF',db['sequelize'][_0xb8a1('0x1f')](_0xb8a1('0x42')))),_0xb8a1('0x43')]],'group':[_0xb8a1('0x2c')]})[_0xb8a1('0x19')](function(_0x41dc40){logger[_0xb8a1('0xb')](_0xb8a1('0x29'),_0x24f664);logger['debug']('GetVoiceQueueHopperHistory',_0x24f664,JSON[_0xb8a1('0xf')](_0x41dc40));_0x2857e2(_0x41dc40);})[_0xb8a1('0x13')](function(_0x3b10de){logger['error'](_0xb8a1('0x29'),_0x3b10de[_0xb8a1('0x11')],_0x24f664);_0x57f861(_0x434e5c[_0xb8a1('0x10')](0x1f4,_0x3b10de['message']));});});};exports[_0xb8a1('0x44')]=function(_0xbd4741){var _0x302d2f=this;return new Promise(function(_0xcde915,_0x19a392){return db[_0xb8a1('0x15')][_0xb8a1('0x2a')]({'raw':_0xbd4741[_0xb8a1('0x18')]?_0xbd4741[_0xb8a1('0x18')][_0xb8a1('0x1b')]===undefined?!![]:![]:!![],'where':_0xbd4741['options']?_0xbd4741[_0xb8a1('0x18')][_0xb8a1('0x2b')]||null:null,'attributes':[['campaign','name'],[db[_0xb8a1('0x1c')]['fn']('COUNT',db[_0xb8a1('0x1c')][_0xb8a1('0x45')]('id')),_0xb8a1('0x46')],[db[_0xb8a1('0x1c')]['fn']('COUNT',db[_0xb8a1('0x1c')]['fn']('IF',db[_0xb8a1('0x1c')]['literal'](_0xb8a1('0x31')))),_0xb8a1('0x47')]],'group':[_0xb8a1('0x2c')]})[_0xb8a1('0x19')](function(_0x59ef7d){logger['info'](_0xb8a1('0x44'),_0xbd4741);logger[_0xb8a1('0xd')](_0xb8a1('0x44'),_0xbd4741,JSON[_0xb8a1('0xf')](_0x59ef7d));_0xcde915(_0x59ef7d);})[_0xb8a1('0x13')](function(_0x19dba9){logger[_0xb8a1('0x10')](_0xb8a1('0x44'),_0x19dba9[_0xb8a1('0x11')],_0xbd4741);_0x19a392(_0x302d2f[_0xb8a1('0x10')](0x1f4,_0x19dba9[_0xb8a1('0x11')]));});});}; \ No newline at end of file +var _0x3dbb=['sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','where','COUNT'];(function(_0x1635ae,_0x5e84be){var _0x38f747=function(_0x27ef79){while(--_0x27ef79){_0x1635ae['push'](_0x1635ae['shift']());}};_0x38f747(++_0x5e84be);}(_0x3dbb,0x67));var _0xb3db=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0x3dbb[_0x2f32c4];return _0x95b5dc;};'use strict';var _=require(_0xb3db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3db('0x1'));var rs=require(_0xb3db('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3db('0x3'))['db'];var utils=require(_0xb3db('0x4'));var logger=require(_0xb3db('0x5'))(_0xb3db('0x6'));var config=require('../../config/environment');var jayson=require(_0xb3db('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe5b11b,_0xb11a52,_0x3e6f98){return new BPromise(function(_0x4ab503,_0x20ae30){return client['request'](_0xe5b11b,_0x3e6f98)[_0xb3db('0x8')](function(_0x43fdd4){logger['info'](_0xb3db('0x9'),_0xb11a52,_0xb3db('0xa'));logger[_0xb3db('0xb')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb11a52,_0xb3db('0xa'),JSON[_0xb3db('0xc')](_0x43fdd4));if(_0x43fdd4[_0xb3db('0xd')]){if(_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xe')]===0x1f4){logger['error'](_0xb3db('0x9'),_0xb11a52,_0x43fdd4['error'][_0xb3db('0xf')]);return _0x20ae30(_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xf')]);}logger['error'](_0xb3db('0x9'),_0xb11a52,_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xf')]);return _0x4ab503(_0x43fdd4['error'][_0xb3db('0xf')]);}else{logger[_0xb3db('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0xb11a52,_0xb3db('0xa'));_0x4ab503(_0x43fdd4[_0xb3db('0x11')][_0xb3db('0xf')]);}})[_0xb3db('0x12')](function(_0x38da8c){logger[_0xb3db('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0xb11a52,_0x38da8c);_0x20ae30(_0x38da8c);});});}exports[_0xb3db('0x13')]=function(_0x40939f){var _0x5dd370=this;return new Promise(function(_0x1e9e84,_0x4210aa){return db[_0xb3db('0x14')][_0xb3db('0x15')](_0x40939f[_0xb3db('0x16')],{'raw':_0x40939f['options']?_0x40939f[_0xb3db('0x17')][_0xb3db('0x18')]===undefined?!![]:![]:!![]})[_0xb3db('0x8')](function(_0x325d53){logger['info'](_0xb3db('0x13'),_0x40939f);logger[_0xb3db('0xb')](_0xb3db('0x13'),_0x40939f,JSON[_0xb3db('0xc')](_0x325d53));_0x1e9e84(_0x325d53);})[_0xb3db('0x12')](function(_0x52d719){logger[_0xb3db('0xd')]('CreateCmHopperHistory',_0x52d719[_0xb3db('0xf')],_0x40939f);_0x4210aa(_0x5dd370[_0xb3db('0xd')](0x1f4,_0x52d719[_0xb3db('0xf')]));});});};exports['AvgHandleTime']=function(_0x42cf59){var _0x391598=this;return new Promise(function(_0x46c69a,_0x2c8e16){return db[_0xb3db('0x14')]['findAll']({'raw':_0x42cf59['options']?_0x42cf59[_0xb3db('0x17')][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x42cf59[_0xb3db('0x17')]?_0x42cf59[_0xb3db('0x17')][_0xb3db('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')][_0xb3db('0x1c')]('id')),_0xb3db('0x1d')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x20')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),_0xb3db('0x21')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xb3db('0x22')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x23'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xb3db('0x24')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x23'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x25')))),_0xb3db('0x26')]]})['then'](function(_0x5596ae){logger[_0xb3db('0x10')](_0xb3db('0x27'),_0x42cf59);logger[_0xb3db('0xb')](_0xb3db('0x27'),_0x42cf59,JSON['stringify'](_0x5596ae));_0x46c69a(_0x5596ae);})['catch'](function(_0x3e59e0){logger['error'](_0xb3db('0x27'),_0x3e59e0['message'],_0x42cf59);_0x2c8e16(_0x391598['error'](0x1f4,_0x3e59e0[_0xb3db('0xf')]));});});};exports[_0xb3db('0x28')]=function(_0x555a20){var _0x5a1880=this;return new Promise(function(_0x506f1e,_0x125a0c){return db['CmHopperHistory'][_0xb3db('0x29')]({'raw':_0x555a20[_0xb3db('0x17')]?_0x555a20['options'][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x555a20[_0xb3db('0x17')]?_0x555a20[_0xb3db('0x17')][_0xb3db('0x19')]||null:null,'attributes':[[_0xb3db('0x2a'),'name'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal'](_0xb3db('0x2b')))),_0xb3db('0x2c')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xb3db('0x2d')))),_0xb3db('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x2f')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xb3db('0x30')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x31')))),'outboundCongestionCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal'](_0xb3db('0x32')))),_0xb3db('0x33')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xb3db('0x1a'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x34')))),_0xb3db('0x35')],[db[_0xb3db('0x1b')]['fn']('COUNT',db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x36')))),_0xb3db('0x37')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x39')))),_0xb3db('0x3a')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x3b')))),_0xb3db('0x3a')],[db[_0xb3db('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xb3db('0x3c')]],'group':[_0xb3db('0x2a')]})[_0xb3db('0x8')](function(_0x4a9209){logger[_0xb3db('0x10')](_0xb3db('0x28'),_0x555a20);logger['debug'](_0xb3db('0x28'),_0x555a20,JSON[_0xb3db('0xc')](_0x4a9209));_0x506f1e(_0x4a9209);})[_0xb3db('0x12')](function(_0x31dd93){logger[_0xb3db('0xd')]('GetVoiceQueueHopperHistory',_0x31dd93['message'],_0x555a20);_0x125a0c(_0x5a1880[_0xb3db('0xd')](0x1f4,_0x31dd93[_0xb3db('0xf')]));});});};exports[_0xb3db('0x3d')]=function(_0x4be0cd){var _0xd1a45=this;return new Promise(function(_0x4cf00c,_0x329bc8){return db[_0xb3db('0x14')][_0xb3db('0x29')]({'raw':_0x4be0cd[_0xb3db('0x17')]?_0x4be0cd['options'][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x4be0cd[_0xb3db('0x17')]?_0x4be0cd['options'][_0xb3db('0x19')]||null:null,'attributes':[[_0xb3db('0x2a'),_0xb3db('0x3e')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['col']('id')),_0xb3db('0x3f')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x40')]],'group':['campaign']})[_0xb3db('0x8')](function(_0x1075fa){logger[_0xb3db('0x10')](_0xb3db('0x3d'),_0x4be0cd);logger[_0xb3db('0xb')]('GetCampaignHopperHistory',_0x4be0cd,JSON[_0xb3db('0xc')](_0x1075fa));_0x4cf00c(_0x1075fa);})[_0xb3db('0x12')](function(_0x9a62f6){logger[_0xb3db('0xd')]('GetCampaignHopperHistory',_0x9a62f6['message'],_0x4be0cd);_0x329bc8(_0xd1a45['error'](0x1f4,_0x9a62f6[_0xb3db('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 36de37e..fcaa0b9 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 _0xd286=['/:id','post','put','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd286,0x16b));var _0x6d28=function(_0x12742e,_0x43f6fa){_0x12742e=_0x12742e-0x0;var _0x173452=_0xd286[_0x12742e];return _0x173452;};'use strict';var multer=require(_0x6d28('0x0'));var util=require(_0x6d28('0x1'));var path=require(_0x6d28('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d28('0x3'));var router=express['Router']();var fs_extra=require(_0x6d28('0x4'));var auth=require(_0x6d28('0x5'));var interaction=require(_0x6d28('0x6'));var config=require(_0x6d28('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x6d28('0x8')]('/',auth[_0x6d28('0x9')](),controller[_0x6d28('0xa')]);router['get'](_0x6d28('0xb'),auth[_0x6d28('0x9')](),controller['describe']);router[_0x6d28('0x8')](_0x6d28('0xc'),auth[_0x6d28('0x9')](),controller['show']);router[_0x6d28('0xd')]('/',auth[_0x6d28('0x9')](),controller['create']);router[_0x6d28('0xe')](_0x6d28('0xc'),auth[_0x6d28('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x4987=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','util','connect-timeout'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0x4987,0x1eb));var _0x7498=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4987[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require(_0x7498('0x0'));var path=require('path');var timeout=require(_0x7498('0x1'));var express=require(_0x7498('0x2'));var router=express[_0x7498('0x3')]();var fs_extra=require(_0x7498('0x4'));var auth=require(_0x7498('0x5'));var interaction=require(_0x7498('0x6'));var config=require('../../config/environment');var controller=require(_0x7498('0x7'));router[_0x7498('0x8')]('/',auth[_0x7498('0x9')](),controller[_0x7498('0xa')]);router[_0x7498('0x8')]('/describe',auth[_0x7498('0x9')](),controller[_0x7498('0xb')]);router['get'](_0x7498('0xc'),auth[_0x7498('0x9')](),controller['show']);router[_0x7498('0xd')]('/',auth[_0x7498('0x9')](),controller[_0x7498('0xe')]);router[_0x7498('0xf')]('/:id',auth[_0x7498('0x9')](),controller[_0x7498('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a6f6062..391952d 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 _0x0f3c=['sequelize','exports','STRING'];(function(_0x36e654,_0x4e5c13){var _0x58cf6c=function(_0xff4bf1){while(--_0xff4bf1){_0x36e654['push'](_0x36e654['shift']());}};_0x58cf6c(++_0x4e5c13);}(_0x0f3c,0x189));var _0xc0f3=function(_0x2c2dcc,_0x297f6f){_0x2c2dcc=_0x2c2dcc-0x0;var _0x334d78=_0x0f3c[_0x2c2dcc];return _0x334d78;};'use strict';var Sequelize=require(_0xc0f3('0x0'));module[_0xc0f3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xc0f3('0x2')]}}; \ No newline at end of file +var _0x2029=['STRING','sequelize','exports','name'];(function(_0x157f40,_0x402ef7){var _0x2305fd=function(_0x38da7f){while(--_0x38da7f){_0x157f40['push'](_0x157f40['shift']());}};_0x2305fd(++_0x402ef7);}(_0x2029,0x171));var _0x9202=function(_0x2e48e4,_0x35a055){_0x2e48e4=_0x2e48e4-0x0;var _0x34476e=_0x2029[_0x2e48e4];return _0x34476e;};'use strict';var Sequelize=require(_0x9202('0x0'));module[_0x9202('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9202('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9202('0x3')]},'dialPrefix':{'type':Sequelize[_0x9202('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d0bc5a8..8028225 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 _0xf459=['Lists','UserProfileResource','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','getDispositions','findOne','Disposition','order','ListId','removeDispositions','ids','isArray','tags','join','push','each','CmContact','omit','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','from','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','destroy','then','get'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf459,0x73));var _0x9f45=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0xf459[_0x1abeb2];return _0x48da20;};'use strict';var emlformat=require(_0x9f45('0x0'));var rimraf=require(_0x9f45('0x1'));var zipdir=require(_0x9f45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f45('0x3'));var moment=require(_0x9f45('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9f45('0x5'));var util=require(_0x9f45('0x6'));var path=require(_0x9f45('0x7'));var sox=require(_0x9f45('0x8'));var csv=require(_0x9f45('0x9'));var ejs=require(_0x9f45('0xa'));var fs=require('fs');var fs_extra=require(_0x9f45('0xb'));var _=require(_0x9f45('0xc'));var squel=require(_0x9f45('0xd'));var crypto=require(_0x9f45('0xe'));var jsforce=require(_0x9f45('0xf'));var deskjs=require(_0x9f45('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9f45('0x11'));var Papa=require(_0x9f45('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f45('0x13'));var hardwareService=require(_0x9f45('0x14'));var logger=require('../../config/logger')(_0x9f45('0x15'));var utils=require(_0x9f45('0x16'));var config=require(_0x9f45('0x17'));var licenseUtil=require(_0x9f45('0x18'));var db=require(_0x9f45('0x19'))['db'];var csv_results;config[_0x9f45('0x1a')]=_[_0x9f45('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f45('0x1a')]));require('./cmList.socket')[_0x9f45('0x1c')](socket);function respondWithStatusCode(_0x382701,_0x368893){_0x368893=_0x368893||0xcc;return function(_0x15df9a){if(_0x15df9a){return _0x382701[_0x9f45('0x1d')](_0x368893);}return _0x382701[_0x9f45('0x1e')](_0x368893)[_0x9f45('0x1f')]();};}function respondWithResult(_0x4f7f7c,_0x11a626){_0x11a626=_0x11a626||0xc8;return function(_0x1a1632){if(_0x1a1632){return _0x4f7f7c[_0x9f45('0x1e')](_0x11a626)[_0x9f45('0x20')](_0x1a1632);}};}function respondWithFilteredResult(_0x8a7d15,_0x242d4a){return function(_0x4b9077){if(_0x4b9077){var _0x55380f=typeof _0x242d4a[_0x9f45('0x21')]==='undefined'&&typeof _0x242d4a['limit']==='undefined';var _0x44f7a6=_0x4b9077[_0x9f45('0x22')];var _0x191ee8=_0x55380f?0x0:_0x242d4a['offset'];var _0xf0e5ba=_0x55380f?_0x4b9077[_0x9f45('0x22')]:_0x242d4a[_0x9f45('0x21')]+_0x242d4a[_0x9f45('0x23')];var _0x1c9fff;if(_0xf0e5ba>=_0x44f7a6){_0xf0e5ba=_0x44f7a6;_0x1c9fff=0xc8;}else{_0x1c9fff=0xce;}_0x8a7d15['status'](_0x1c9fff);return _0x8a7d15[_0x9f45('0x24')]('Content-Range',_0x191ee8+'-'+_0xf0e5ba+'/'+_0x44f7a6)[_0x9f45('0x20')](_0x4b9077);}return null;};}function patchUpdates(_0xaf3cc8){return function(_0x49a435){try{jsonpatch[_0x9f45('0x25')](_0x49a435,_0xaf3cc8,!![]);}catch(_0x3d4b89){return BPromise[_0x9f45('0x26')](_0x3d4b89);}return _0x49a435[_0x9f45('0x27')]();};}function saveUpdates(_0x2df2dd,_0x3d69d1){return function(_0x2ab3d9){if(_0x2ab3d9){return _0x2ab3d9[_0x9f45('0x28')](_0x2df2dd)['then'](function(_0x34edfe){return _0x34edfe;});}return null;};}function removeEntity(_0x4fd9e4,_0x4ed18c){return function(_0x550133){if(_0x550133){return _0x550133[_0x9f45('0x29')]()[_0x9f45('0x2a')](function(){var _0x6eacee=_0x550133[_0x9f45('0x2b')]({'plain':!![]});var _0x226b93=_0x9f45('0x2c');return db[_0x9f45('0x2d')]['destroy']({'where':{'type':_0x226b93,'resourceId':_0x6eacee['id']}})[_0x9f45('0x2a')](function(){return _0x550133;});})['then'](function(){_0x4fd9e4[_0x9f45('0x1e')](0xcc)[_0x9f45('0x1f')]();});}};}function handleEntityNotFound(_0x58a7e3,_0x21d35a){return function(_0x52f033){if(!_0x52f033){_0x58a7e3[_0x9f45('0x1d')](0x194);}return _0x52f033;};}function handleError(_0x574f0d,_0x18754d){_0x18754d=_0x18754d||0x1f4;return function(_0x2a62e9){logger['error'](_0x2a62e9[_0x9f45('0x2e')]);if(_0x2a62e9['name']){delete _0x2a62e9[_0x9f45('0x2f')];}_0x574f0d[_0x9f45('0x1e')](_0x18754d)[_0x9f45('0x30')](_0x2a62e9);};}exports['index']=function(_0x541f72,_0x31a953){var _0x32ea28={},_0x1319b4={},_0x54a0f3={'count':0x0,'rows':[]};var _0x4874e0=_[_0x9f45('0x31')](db[_0x9f45('0x32')][_0x9f45('0x33')],function(_0x4d6ba3){return{'name':_0x4d6ba3[_0x9f45('0x34')],'type':_0x4d6ba3[_0x9f45('0x35')][_0x9f45('0x36')]};});_0x1319b4['model']=_[_0x9f45('0x31')](_0x4874e0,_0x9f45('0x2f'));_0x1319b4[_0x9f45('0x37')]=_[_0x9f45('0x38')](_0x541f72['query']);_0x1319b4[_0x9f45('0x39')]=_[_0x9f45('0x3a')](_0x1319b4[_0x9f45('0x3b')],_0x1319b4[_0x9f45('0x37')]);_0x32ea28[_0x9f45('0x3c')]=_[_0x9f45('0x3a')](_0x1319b4[_0x9f45('0x3b')],qs[_0x9f45('0x3d')](_0x541f72[_0x9f45('0x37')][_0x9f45('0x3d')]));_0x32ea28[_0x9f45('0x3c')]=_0x32ea28['attributes'][_0x9f45('0x3e')]?_0x32ea28[_0x9f45('0x3c')]:_0x1319b4[_0x9f45('0x3b')];if(!_0x541f72[_0x9f45('0x37')][_0x9f45('0x3f')](_0x9f45('0x40'))){_0x32ea28[_0x9f45('0x23')]=qs['limit'](_0x541f72[_0x9f45('0x37')]['limit']);_0x32ea28['offset']=qs[_0x9f45('0x21')](_0x541f72['query']['offset']);}_0x32ea28['order']=qs[_0x9f45('0x41')](_0x541f72['query']['sort']);_0x32ea28['where']=qs[_0x9f45('0x39')](_[_0x9f45('0x42')](_0x541f72['query'],_0x1319b4[_0x9f45('0x39')]),_0x4874e0);if(_0x541f72[_0x9f45('0x37')][_0x9f45('0x43')]){_0x32ea28[_0x9f45('0x44')]=_[_0x9f45('0x45')](_0x32ea28[_0x9f45('0x44')],{'$or':_[_0x9f45('0x31')](_0x4874e0,function(_0x50a863){if(_0x50a863[_0x9f45('0x35')]!==_0x9f45('0x46')){var _0xdf6703={};_0xdf6703[_0x50a863[_0x9f45('0x2f')]]={'$like':'%'+_0x541f72[_0x9f45('0x37')]['filter']+'%'};return _0xdf6703;}})});}_0x32ea28=_[_0x9f45('0x45')]({},_0x32ea28,_0x541f72['options']);var _0x55cb31={'where':_0x32ea28[_0x9f45('0x44')]};return db['CmList'][_0x9f45('0x22')](_0x55cb31)[_0x9f45('0x2a')](function(_0x4fca5e){_0x54a0f3[_0x9f45('0x22')]=_0x4fca5e;if(_0x541f72[_0x9f45('0x37')]['includeAll']){_0x32ea28[_0x9f45('0x47')]=[{'all':!![]}];}return db['CmList'][_0x9f45('0x48')](_0x32ea28);})[_0x9f45('0x2a')](function(_0x4766e9){_0x54a0f3[_0x9f45('0x49')]=_0x4766e9;return _0x54a0f3;})[_0x9f45('0x2a')](respondWithFilteredResult(_0x31a953,_0x32ea28))[_0x9f45('0x4a')](handleError(_0x31a953,null));};exports[_0x9f45('0x4b')]=function(_0x4a3e6a,_0x52ddd6){var _0x37af15={'raw':![],'where':{'id':_0x4a3e6a['params']['id']}},_0x3ebd7b={};_0x3ebd7b[_0x9f45('0x3b')]=_[_0x9f45('0x38')](db['CmList'][_0x9f45('0x33')]);_0x3ebd7b['query']=_[_0x9f45('0x38')](_0x4a3e6a[_0x9f45('0x37')]);_0x3ebd7b[_0x9f45('0x39')]=_['intersection'](_0x3ebd7b[_0x9f45('0x3b')],_0x3ebd7b['query']);_0x37af15['attributes']=_['intersection'](_0x3ebd7b[_0x9f45('0x3b')],qs[_0x9f45('0x3d')](_0x4a3e6a[_0x9f45('0x37')]['fields']));_0x37af15['attributes']=_0x37af15['attributes'][_0x9f45('0x3e')]?_0x37af15['attributes']:_0x3ebd7b[_0x9f45('0x3b')];if(_0x4a3e6a['query'][_0x9f45('0x4c')]){_0x37af15['include']=[{'all':!![]}];}_0x37af15=_[_0x9f45('0x45')]({},_0x37af15,_0x4a3e6a[_0x9f45('0x4d')]);return db[_0x9f45('0x32')][_0x9f45('0x4e')](_0x37af15)[_0x9f45('0x2a')](handleEntityNotFound(_0x52ddd6,null))[_0x9f45('0x2a')](respondWithResult(_0x52ddd6,null))['catch'](handleError(_0x52ddd6,null));};exports[_0x9f45('0x4f')]=function(_0x46f889,_0x30ffad){return db[_0x9f45('0x32')][_0x9f45('0x4f')](_0x46f889[_0x9f45('0x50')],{})['then'](function(_0x1fbe67){var _0x547fea=_0x46f889['user'][_0x9f45('0x2b')]({'plain':!![]});if(!_0x547fea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x547fea['role']==='user'){var _0x5a6565=_0x1fbe67['get']({'plain':!![]});var _0x45d053=_0x9f45('0x2c');return db[_0x9f45('0x51')][_0x9f45('0x4e')]({'where':{'name':_0x45d053,'userProfileId':_0x547fea['userProfileId']},'raw':!![]})[_0x9f45('0x2a')](function(_0x36950c){if(_0x36950c&&_0x36950c['autoAssociation']===0x0){return db[_0x9f45('0x2d')][_0x9f45('0x4f')]({'name':_0x5a6565['name'],'resourceId':_0x5a6565['id'],'type':_0x36950c[_0x9f45('0x2f')],'sectionId':_0x36950c['id']},{})[_0x9f45('0x2a')](function(){return _0x1fbe67;});}else{return _0x1fbe67;}})[_0x9f45('0x4a')](function(_0xaa75d1){logger[_0x9f45('0x52')](_0x9f45('0x53'),_0xaa75d1);throw _0xaa75d1;});}return _0x1fbe67;})[_0x9f45('0x2a')](respondWithResult(_0x30ffad,0xc9))['catch'](handleError(_0x30ffad,null));};exports[_0x9f45('0x28')]=function(_0x39f214,_0xe77912){if(_0x39f214['body']['id']){delete _0x39f214[_0x9f45('0x50')]['id'];}return db[_0x9f45('0x32')]['find']({'where':{'id':_0x39f214['params']['id']}})[_0x9f45('0x2a')](handleEntityNotFound(_0xe77912,null))['then'](saveUpdates(_0x39f214['body'],null))[_0x9f45('0x2a')](respondWithResult(_0xe77912,null))[_0x9f45('0x4a')](handleError(_0xe77912,null));};exports[_0x9f45('0x29')]=function(_0x3da207,_0x5496b){return db[_0x9f45('0x32')][_0x9f45('0x4e')]({'where':{'id':_0x3da207[_0x9f45('0x54')]['id']}})[_0x9f45('0x2a')](handleEntityNotFound(_0x5496b,null))[_0x9f45('0x2a')](removeEntity(_0x5496b,null))['catch'](handleError(_0x5496b,null));};exports[_0x9f45('0x55')]=function(_0x10fc2e,_0x421241){return db['CmList']['describe']()[_0x9f45('0x2a')](respondWithResult(_0x421241,null))[_0x9f45('0x4a')](handleError(_0x421241,null));};exports[_0x9f45('0x56')]=function(_0x15f99a,_0x3c469e,_0x1f3541){if(_0x15f99a[_0x9f45('0x50')]['id']){delete _0x15f99a['body']['id'];}return db[_0x9f45('0x32')][_0x9f45('0x4e')]({'where':{'id':_0x15f99a['params']['id']}})['then'](handleEntityNotFound(_0x3c469e,null))[_0x9f45('0x2a')](function(_0x1eaec8){if(_0x1eaec8){_0x15f99a[_0x9f45('0x50')]['ListId']=_0x1eaec8['id'];return db['Disposition'][_0x9f45('0x4f')](_0x15f99a[_0x9f45('0x50')]);}})[_0x9f45('0x2a')](respondWithResult(_0x3c469e,null))[_0x9f45('0x4a')](handleError(_0x3c469e,null));};exports[_0x9f45('0x57')]=function(_0x5f5a42,_0x105105,_0x4b7aa6){var _0x123923={'raw':![],'where':{}};var _0x1c9c0a={};var _0x106ca6={'count':0x0,'rows':[]};return db['CmList'][_0x9f45('0x58')]({'where':{'id':_0x5f5a42[_0x9f45('0x54')]['id']}})[_0x9f45('0x2a')](handleEntityNotFound(_0x105105,null))[_0x9f45('0x2a')](function(_0x42f398){if(_0x42f398){_0x1c9c0a[_0x9f45('0x3b')]=_['keys'](db[_0x9f45('0x59')]['rawAttributes']);_0x1c9c0a['query']=_['keys'](_0x5f5a42['query']);_0x1c9c0a[_0x9f45('0x39')]=_[_0x9f45('0x3a')](_0x1c9c0a[_0x9f45('0x3b')],_0x1c9c0a['query']);_0x123923[_0x9f45('0x3c')]=_['intersection'](_0x1c9c0a[_0x9f45('0x3b')],qs[_0x9f45('0x3d')](_0x5f5a42[_0x9f45('0x37')][_0x9f45('0x3d')]));_0x123923[_0x9f45('0x3c')]=_0x123923[_0x9f45('0x3c')][_0x9f45('0x3e')]?_0x123923['attributes']:_0x1c9c0a[_0x9f45('0x3b')];if(!_0x5f5a42[_0x9f45('0x37')][_0x9f45('0x3f')]('nolimit')){_0x123923[_0x9f45('0x23')]=qs[_0x9f45('0x23')](_0x5f5a42[_0x9f45('0x37')][_0x9f45('0x23')]);_0x123923['offset']=qs[_0x9f45('0x21')](_0x5f5a42[_0x9f45('0x37')][_0x9f45('0x21')]);}_0x123923[_0x9f45('0x5a')]=qs[_0x9f45('0x41')](_0x5f5a42[_0x9f45('0x37')][_0x9f45('0x41')]);_0x123923[_0x9f45('0x44')]=qs[_0x9f45('0x39')](_[_0x9f45('0x42')](_0x5f5a42[_0x9f45('0x37')],_0x1c9c0a[_0x9f45('0x39')]));_0x123923['where'][_0x9f45('0x5b')]=_0x42f398['id'];if(_0x5f5a42[_0x9f45('0x37')]['filter']){_0x123923[_0x9f45('0x44')]=_['merge'](_0x123923[_0x9f45('0x44')],{'$or':_[_0x9f45('0x31')](_0x123923[_0x9f45('0x3c')],function(_0x219532){var _0xd25b4f={};_0xd25b4f[_0x219532]={'$like':'%'+_0x5f5a42[_0x9f45('0x37')]['filter']+'%'};return _0xd25b4f;})});}_0x123923=_[_0x9f45('0x45')]({},_0x123923,_0x5f5a42[_0x9f45('0x4d')]);return db[_0x9f45('0x59')][_0x9f45('0x22')]({'where':_0x123923[_0x9f45('0x44')]})[_0x9f45('0x2a')](function(_0x1e9d44){_0x106ca6['count']=_0x1e9d44;if(_0x5f5a42[_0x9f45('0x37')][_0x9f45('0x4c')]){_0x123923[_0x9f45('0x47')]=[{'all':!![]}];}return db[_0x9f45('0x59')][_0x9f45('0x48')](_0x123923);})[_0x9f45('0x2a')](function(_0x2d7a6b){_0x106ca6[_0x9f45('0x49')]=_0x2d7a6b;return _0x106ca6;});}})[_0x9f45('0x2a')](respondWithFilteredResult(_0x105105,_0x123923))[_0x9f45('0x4a')](handleError(_0x105105,null));};exports[_0x9f45('0x5c')]=function(_0x5d3cbd,_0x3cfc7f,_0x4398cb){return db['CmList'][_0x9f45('0x4e')]({'where':{'id':_0x5d3cbd[_0x9f45('0x54')]['id']}})[_0x9f45('0x2a')](handleEntityNotFound(_0x3cfc7f,null))[_0x9f45('0x2a')](function(_0x5a6f20){if(_0x5a6f20){return _0x5a6f20[_0x9f45('0x5c')](_0x5d3cbd[_0x9f45('0x37')][_0x9f45('0x5d')]);}})[_0x9f45('0x2a')](respondWithStatusCode(_0x3cfc7f,null))[_0x9f45('0x4a')](handleError(_0x3cfc7f,null));};exports['addContacts']=function(_0x1081cc,_0x173ef5,_0x110b15){return db['CmList'][_0x9f45('0x4e')]({'where':{'id':_0x1081cc[_0x9f45('0x54')]['id']}})[_0x9f45('0x2a')](handleEntityNotFound(_0x173ef5,null))[_0x9f45('0x2a')](function(_0x56272f){if(_0x56272f){var _0x360f1c=[];var _0x276c31={'success':[],'errors':[]};return db['CmContact'][_0x9f45('0x55')]()[_0x9f45('0x2a')](function(_0x4caa4e){if(_0x1081cc[_0x9f45('0x50')]['tags']&&_[_0x9f45('0x5e')](_0x1081cc[_0x9f45('0x50')][_0x9f45('0x5f')])){if(_0x1081cc[_0x9f45('0x50')]['tags'][_0x9f45('0x3e')]){_0x1081cc['body'][_0x9f45('0x5f')]=_0x1081cc[_0x9f45('0x50')][_0x9f45('0x5f')][_0x9f45('0x60')](';')+';';}else{_0x1081cc[_0x9f45('0x50')][_0x9f45('0x5f')]=null;}}else{_0x1081cc['body'][_0x9f45('0x5f')]=null;}if(_0x1081cc[_0x9f45('0x50')]&&_[_0x9f45('0x5e')](_0x1081cc['body'])){for(var _0x54519d=0x0;_0x54519d<_0x1081cc['body'][_0x9f45('0x3e')];_0x54519d+=0x1){_0x1081cc['body'][_0x54519d]['ListId']=_0x1081cc[_0x9f45('0x54')]['id'];_0x360f1c[_0x9f45('0x61')](_0x1081cc[_0x9f45('0x50')][_0x54519d]);}return BPromise[_0x9f45('0x62')](_0x360f1c,function(_0x10f557){return db[_0x9f45('0x63')]['create'](_[_0x9f45('0x64')](_0x10f557,[_0x9f45('0x5d'),'id'])||{},{'fields':_[_0x9f45('0x38')](_0x4caa4e),'raw':!![]})[_0x9f45('0x2a')](function(_0x333bb6){_0x276c31[_0x9f45('0x65')][_0x9f45('0x61')](_0x333bb6[_0x9f45('0x66')]);})[_0x9f45('0x4a')](function(_0x3af106){_0x276c31['errors']['push']({'data':_0x10f557,'error':_0x3af106['message']});});})['then'](function(_0x495d58){return _0x276c31;})[_0x9f45('0x4a')](function(_0x2c1276){return _0x2c1276;});}else{_0x173ef5['status'](0x190)[_0x9f45('0x20')]({'message':_0x9f45('0x67')});}});}})[_0x9f45('0x2a')](respondWithResult(_0x173ef5,null))['catch'](handleError(_0x173ef5,null));};exports[_0x9f45('0x68')]=function(_0x4f9d73,_0x2a3863,_0x36d6cc){var _0x257874;return db[_0x9f45('0x32')][_0x9f45('0x4e')]({'where':{'id':_0x4f9d73[_0x9f45('0x54')]['id']},'include':[{'model':db[_0x9f45('0x69')],'as':_0x9f45('0x6a')}]})[_0x9f45('0x2a')](handleEntityNotFound(_0x2a3863,null))[_0x9f45('0x2a')](function(_0x4b9a8f){if(_0x4b9a8f){_0x257874=_0x4b9a8f;return db['CmContact'][_0x9f45('0x33')];}})['then'](function(_0x1268ad){if(_0x1268ad){var _0x1adae6={};var _0x36f8fc={};_0x36f8fc[_0x9f45('0x3b')]=_[_0x9f45('0x6b')](_['keys'](_0x1268ad),_[_0x9f45('0x31')](_0x257874[_0x9f45('0x6a')],function(_0xea17ba){return util[_0x9f45('0x6c')]('cf_%d',_0xea17ba['id']);}));_0x36f8fc[_0x9f45('0x37')]=_['keys'](_0x4f9d73[_0x9f45('0x37')]);_0x36f8fc['filters']=_[_0x9f45('0x3a')](_0x36f8fc[_0x9f45('0x3b')],_0x36f8fc[_0x9f45('0x37')]);_0x1adae6[_0x9f45('0x3c')]=_['intersection'](_0x36f8fc[_0x9f45('0x3b')],qs[_0x9f45('0x3d')](_0x4f9d73[_0x9f45('0x37')][_0x9f45('0x3d')]));_0x1adae6['attributes']=_0x1adae6[_0x9f45('0x3c')][_0x9f45('0x3e')]?_0x1adae6['attributes']:_0x36f8fc[_0x9f45('0x3b')];if(!_0x4f9d73[_0x9f45('0x37')][_0x9f45('0x3f')](_0x9f45('0x40'))){_0x1adae6[_0x9f45('0x23')]=qs[_0x9f45('0x23')](_0x4f9d73[_0x9f45('0x37')][_0x9f45('0x23')]);_0x1adae6[_0x9f45('0x21')]=qs[_0x9f45('0x21')](_0x4f9d73[_0x9f45('0x37')][_0x9f45('0x21')]);}_0x1adae6[_0x9f45('0x5a')]=qs[_0x9f45('0x41')](_0x4f9d73['query'][_0x9f45('0x41')]);_0x1adae6['where']=qs[_0x9f45('0x39')](_[_0x9f45('0x42')](_0x4f9d73['query'],_0x36f8fc['filters']));_0x1adae6['raw']=!![];if(_0x4f9d73[_0x9f45('0x37')][_0x9f45('0x43')]){_0x1adae6[_0x9f45('0x44')]=_['merge'](_0x1adae6[_0x9f45('0x44')],{'$or':_[_0x9f45('0x31')](_0x1adae6['attributes'],function(_0x35f6bf){var _0x189652={};_0x189652[_0x35f6bf]={'$like':'%'+_0x4f9d73[_0x9f45('0x37')][_0x9f45('0x43')]+'%'};return _0x189652;})});}_0x1adae6=_[_0x9f45('0x45')]({},_0x1adae6,_0x4f9d73['options']);return _0x257874[_0x9f45('0x68')](_0x1adae6);}})[_0x9f45('0x2a')](respondWithResult(_0x2a3863,null))[_0x9f45('0x4a')](handleError(_0x2a3863,null));};exports['getContactsCsv']=function(_0x43af7c,_0x2c56ec,_0x3f8a35){var _0xa9a5b7;var _0x2d33df;var _0x53b338;var _0x15392a=_0x43af7c[_0x9f45('0x54')]['id'];csv_results=[];return db[_0x9f45('0x6d')][_0x9f45('0x48')]({'attributes':['id','name'],'raw':!![],'order':[_0x9f45('0x6e')]})[_0x9f45('0x2a')](function(_0xf3df3){_0xa9a5b7=_0xf3df3;var _0x326c43=_[_0x9f45('0x38')](db[_0x9f45('0x63')]['rawAttributes']);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x9f45('0x6f')]})[_0x9f45('0x2a')](function(_0x18c4b9){_0x2d33df=_0x18c4b9;var _0x476c76=squel[_0x9f45('0x70')]()[_0x9f45('0x3d')](_0x326c43)['from'](_0x9f45('0x71'),'c')[_0x9f45('0x44')](_0x9f45('0x72'),_0x15392a)['where'](_0x9f45('0x73'))[_0x9f45('0x74')]();for(var _0x533128=0x0;_0x533128<_0x2d33df['length'];_0x533128++){_0x476c76[_0x9f45('0x75')]('c.cf_'+_0x2d33df[_0x533128]['id'],_0x9f45('0x76')+_0x2d33df[_0x533128][_0x9f45('0x6f')]);}for(var _0x533128=0x0;_0x533128<_0xa9a5b7[_0x9f45('0x3e')];_0x533128++){_0x476c76[_0x9f45('0x75')](squel[_0x9f45('0x70')]()[_0x9f45('0x75')]('item')['from'](_0x9f45('0x77'))['where']('ItemTypeId\x20=\x20?',_0xa9a5b7[_0x533128]['id'])[_0x9f45('0x44')](_0x9f45('0x78')),_0x9f45('0x79')+_0xa9a5b7[_0x533128][_0x9f45('0x2f')]);_0x476c76[_0x9f45('0x75')](squel[_0x9f45('0x70')]()[_0x9f45('0x75')](_0x9f45('0x7a'))[_0x9f45('0x7b')](_0x9f45('0x77'))['where'](_0x9f45('0x7c'),_0xa9a5b7[_0x533128]['id'])[_0x9f45('0x44')](_0x9f45('0x78')),_0x9f45('0x7d')+_0xa9a5b7[_0x533128][_0x9f45('0x2f')]);}var _0x15b471=[];_0x15b471[_0x9f45('0x61')](_0x476c76[_0x9f45('0x7e')]());BPromise[_0x9f45('0x62')](_0x15b471,handleQuery)[_0x9f45('0x2a')](function(_0x115a64){handleQuery(_0x476c76[_0x9f45('0x7e')]());var _0xc6c72a=csv_results[0x0];if(!_['isEmpty'](_0xc6c72a)){var _0x1a5782=toCsv(_0xc6c72a);var _0x15df6e=Date[_0x9f45('0x7f')]();fs[_0x9f45('0x80')](util['format'](_0x9f45('0x81'),_0x15392a,_0x15df6e),_0x1a5782);_0x2c56ec[_0x9f45('0x82')](_0x9f45('0x83'),'attachment;\x20filename='+util[_0x9f45('0x6c')]('list_%d_%s.csv',_0x15392a,_0x15df6e));_0x2c56ec['setHeader'](_0x9f45('0x84'),_0x9f45('0x85'));return _0x2c56ec['download'](util[_0x9f45('0x6c')](_0x9f45('0x81'),_0x15392a,_0x15df6e));}else{return _0x2c56ec['sendStatus'](0xcc);}});});});};exports[_0x9f45('0x86')]=function(_0x5d560c,_0x2c9582,_0x1f2979){var _0x11e67b;delete _0x5d560c[_0x9f45('0x50')]['id'];return db['CmList'][_0x9f45('0x58')]({'where':{'id':_0x5d560c['params']['id']}})[_0x9f45('0x2a')](handleEntityNotFound(_0x2c9582,null))[_0x9f45('0x2a')](function(_0x4799df){if(_0x4799df){return db['sequelize'][_0x9f45('0x87')](function(_0x291846){return db[_0x9f45('0x69')][_0x9f45('0x4f')](_0x5d560c[_0x9f45('0x50')],{'transaction':_0x291846})['then'](function(_0x290b71){_0x11e67b=_0x290b71;return _0x4799df[_0x9f45('0x88')](_0x290b71,{'transaction':_0x291846});})['then'](function(){var _0x45ffb8={'type':db[_0x9f45('0x89')][_0x9f45('0x8a')],'transaction':_0x291846};switch(_0x5d560c[_0x9f45('0x50')][_0x9f45('0x35')]){case _0x9f45('0x8b'):_0x45ffb8['type']=db[_0x9f45('0x89')]['TEXT'];break;case _0x9f45('0x8c'):_0x45ffb8[_0x9f45('0x35')]=db['Sequelize'][_0x9f45('0x8d')];break;case _0x9f45('0x8e'):_0x45ffb8['type']=db['Sequelize'][_0x9f45('0x8f')];_0x45ffb8[_0x9f45('0x90')]=![];break;default:}return db[_0x9f45('0x91')][_0x9f45('0x92')][_0x9f45('0x93')](_0x9f45('0x71'),util[_0x9f45('0x6c')](_0x9f45('0x94'),_0x11e67b['id']),_0x45ffb8);})['then'](function(){return _0x11e67b;});});}})[_0x9f45('0x2a')](respondWithResult(_0x2c9582,null))['catch'](handleError(_0x2c9582,null));};exports[_0x9f45('0x95')]=function(_0x1fb77a,_0x3f98d0,_0x5540ea){var _0x5b5527={};var _0x2cab8e={};var _0x16fe69;var _0x114a24;return db[_0x9f45('0x32')][_0x9f45('0x58')]({'where':{'id':_0x1fb77a[_0x9f45('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f98d0,null))[_0x9f45('0x2a')](function(_0x19c02e){if(_0x19c02e){_0x16fe69=_0x19c02e;_0x2cab8e[_0x9f45('0x3b')]=_[_0x9f45('0x38')](db[_0x9f45('0x69')][_0x9f45('0x33')]);_0x2cab8e[_0x9f45('0x37')]=_['keys'](_0x1fb77a[_0x9f45('0x37')]);_0x2cab8e[_0x9f45('0x39')]=_[_0x9f45('0x3a')](_0x2cab8e[_0x9f45('0x3b')],_0x2cab8e[_0x9f45('0x37')]);_0x5b5527[_0x9f45('0x3c')]=_[_0x9f45('0x3a')](_0x2cab8e['model'],qs[_0x9f45('0x3d')](_0x1fb77a[_0x9f45('0x37')][_0x9f45('0x3d')]));_0x5b5527[_0x9f45('0x3c')]=_0x5b5527[_0x9f45('0x3c')][_0x9f45('0x3e')]?_0x5b5527[_0x9f45('0x3c')]:_0x2cab8e[_0x9f45('0x3b')];_0x5b5527[_0x9f45('0x5a')]=qs['sort'](_0x1fb77a[_0x9f45('0x37')][_0x9f45('0x41')]);_0x5b5527['where']=qs[_0x9f45('0x39')](_[_0x9f45('0x42')](_0x1fb77a[_0x9f45('0x37')],_0x2cab8e['filters']));_0x5b5527['where']=_['merge'](_0x5b5527[_0x9f45('0x44')],{'$or':[{'ListId':_0x19c02e['id']},{'ListId':null}]});if(_0x1fb77a['query'][_0x9f45('0x43')]){_0x5b5527[_0x9f45('0x44')]=_[_0x9f45('0x45')](_0x5b5527[_0x9f45('0x44')],{'$or':_['map'](_0x5b5527[_0x9f45('0x3c')],function(_0x2cacfe){var _0x86a193={};_0x86a193[_0x2cacfe]={'$like':'%'+_0x1fb77a[_0x9f45('0x37')][_0x9f45('0x43')]+'%'};return _0x86a193;})});}_0x5b5527=_[_0x9f45('0x45')]({},_0x5b5527,_0x1fb77a[_0x9f45('0x4d')]);return db['CmCustomField'][_0x9f45('0x96')](_0x5b5527);}})[_0x9f45('0x2a')](respondWithResult(_0x3f98d0,null))['catch'](handleError(_0x3f98d0,null));};exports['getGlobalCustomFields']=function(_0x42f2d1,_0x234b02){return db['CmCustomField'][_0x9f45('0x96')]({'where':{'ListId':null}})[_0x9f45('0x2a')](handleEntityNotFound(_0x234b02,null))[_0x9f45('0x2a')](function(_0x457ffe){return _0x457ffe;})[_0x9f45('0x2a')](respondWithResult(_0x234b02,null))[_0x9f45('0x4a')](handleError(_0x234b02,null));};exports['addAgents']=function(_0x255fef,_0x31cb54,_0x4bb555){return db[_0x9f45('0x32')][_0x9f45('0x4e')]({'where':{'id':_0x255fef[_0x9f45('0x54')]['id']}})['then'](handleEntityNotFound(_0x31cb54,null))['then'](function(_0x399947){if(_0x399947){return _0x399947['addAgents'](_0x255fef[_0x9f45('0x50')][_0x9f45('0x5d')],_[_0x9f45('0x64')](_0x255fef['body'],[_0x9f45('0x5d'),'id'])||{})['spread'](function(_0x3ea5a8){for(var _0x143e1f=0x0;_0x143e1f<_0x255fef[_0x9f45('0x50')]['ids'][_0x9f45('0x3e')];_0x143e1f+=0x1){socket[_0x9f45('0x97')](_0x9f45('0x98'),{'UserId':Number(_0x255fef['body']['ids'][_0x143e1f]),'CmListId':Number(_0x255fef[_0x9f45('0x54')]['id'])});}return _0x3ea5a8;});}})[_0x9f45('0x2a')](respondWithResult(_0x31cb54,null))[_0x9f45('0x4a')](handleError(_0x31cb54,null));};exports[_0x9f45('0x99')]=function(_0x5ac472,_0x63ee54,_0x5d2b39){return db[_0x9f45('0x32')][_0x9f45('0x4e')]({'where':{'id':_0x5ac472[_0x9f45('0x54')]['id']}})[_0x9f45('0x2a')](handleEntityNotFound(_0x63ee54,null))[_0x9f45('0x2a')](function(_0x3279d7){if(_0x3279d7){return _0x3279d7[_0x9f45('0x99')](_0x5ac472[_0x9f45('0x37')]['ids'])['then'](function(){if(_['isArray'](_0x5ac472[_0x9f45('0x37')]['ids'])){for(var _0x4a5f40=0x0;_0x4a5f40<_0x5ac472[_0x9f45('0x37')]['ids'][_0x9f45('0x3e')];_0x4a5f40+=0x1){socket[_0x9f45('0x97')](_0x9f45('0x9a'),{'UserId':Number(_0x5ac472[_0x9f45('0x37')][_0x9f45('0x5d')][_0x4a5f40]),'CmListId':Number(_0x5ac472[_0x9f45('0x54')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x5ac472[_0x9f45('0x37')][_0x9f45('0x5d')]),'CmListId':Number(_0x5ac472[_0x9f45('0x54')]['id'])});}});}})[_0x9f45('0x2a')](respondWithStatusCode(_0x63ee54,null))[_0x9f45('0x4a')](handleError(_0x63ee54,null));};exports[_0x9f45('0x9b')]=function(_0x2c110f,_0x45297a,_0x375f09){var _0x570776={};var _0x54b5dc={};var _0x4130e5;var _0x186d27;return db[_0x9f45('0x32')][_0x9f45('0x58')]({'where':{'id':_0x2c110f[_0x9f45('0x54')]['id']}})['then'](handleEntityNotFound(_0x45297a,null))[_0x9f45('0x2a')](function(_0x292364){if(_0x292364){_0x4130e5=_0x292364;_0x54b5dc[_0x9f45('0x3b')]=_[_0x9f45('0x38')](db[_0x9f45('0x9c')][_0x9f45('0x33')]);_0x54b5dc[_0x9f45('0x37')]=_[_0x9f45('0x38')](_0x2c110f['query']);_0x54b5dc[_0x9f45('0x39')]=_['intersection'](_0x54b5dc[_0x9f45('0x3b')],_0x54b5dc[_0x9f45('0x37')]);_0x570776[_0x9f45('0x3c')]=_[_0x9f45('0x3a')](_0x54b5dc['model'],qs[_0x9f45('0x3d')](_0x2c110f['query'][_0x9f45('0x3d')]));_0x570776[_0x9f45('0x3c')]=_0x570776['attributes']['length']?_0x570776[_0x9f45('0x3c')]:_0x54b5dc['model'];_0x570776[_0x9f45('0x5a')]=qs[_0x9f45('0x41')](_0x2c110f[_0x9f45('0x37')][_0x9f45('0x41')]);_0x570776[_0x9f45('0x44')]=qs[_0x9f45('0x39')](_['pick'](_0x2c110f[_0x9f45('0x37')],_0x54b5dc['filters']));if(_0x2c110f[_0x9f45('0x37')]['filter']){_0x570776[_0x9f45('0x44')]=_[_0x9f45('0x45')](_0x570776[_0x9f45('0x44')],{'$or':_[_0x9f45('0x31')](_0x570776[_0x9f45('0x3c')],function(_0xdf700d){var _0x47d61e={};_0x47d61e[_0xdf700d]={'$like':'%'+_0x2c110f[_0x9f45('0x37')]['filter']+'%'};return _0x47d61e;})});}_0x570776=_['merge']({},_0x570776,_0x2c110f[_0x9f45('0x4d')]);return _0x4130e5[_0x9f45('0x9b')](_0x570776);}})[_0x9f45('0x2a')](function(_0x188bc8){if(_0x188bc8){_0x186d27=_0x188bc8[_0x9f45('0x3e')];if(!_0x2c110f[_0x9f45('0x37')]['hasOwnProperty']('nolimit')){_0x570776[_0x9f45('0x23')]=qs[_0x9f45('0x23')](_0x2c110f[_0x9f45('0x37')][_0x9f45('0x23')]);_0x570776[_0x9f45('0x21')]=qs['offset'](_0x2c110f[_0x9f45('0x37')][_0x9f45('0x21')]);}return _0x4130e5[_0x9f45('0x9b')](_0x570776);}})[_0x9f45('0x2a')](function(_0x155a41){if(_0x155a41){return _0x155a41?{'count':_0x186d27,'rows':_0x155a41}:null;}})[_0x9f45('0x2a')](respondWithResult(_0x45297a,null))[_0x9f45('0x4a')](handleError(_0x45297a,null));};function handleQuery(_0x1496c4){logger[_0x9f45('0x9d')](_0x1496c4);return db[_0x9f45('0x91')][_0x9f45('0x37')](_0x1496c4)['spread'](function(_0x31f37f){csv_results['push'](_0x31f37f);})['catch'](function(_0x1555d2){logger[_0x9f45('0x52')](_0x1555d2[_0x9f45('0x9e')]);});} \ No newline at end of file +var _0xc327=['CmList','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields','include','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','ListId','Disposition','getDispositions','order','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','omit','success','dataValues','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','findOne','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','Lists','UserProfileResource','stack','name','send','index','map'];(function(_0x2309da,_0x136002){var _0x792c1c=function(_0x5c4dd3){while(--_0x5c4dd3){_0x2309da['push'](_0x2309da['shift']());}};_0x792c1c(++_0x136002);}(_0xc327,0x1c7));var _0x7c32=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc327[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c32('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c32('0x1'));var rp=require('request-promise');var moment=require(_0x7c32('0x2'));var BPromise=require(_0x7c32('0x3'));var Mustache=require(_0x7c32('0x4'));var util=require('util');var path=require(_0x7c32('0x5'));var sox=require(_0x7c32('0x6'));var csv=require(_0x7c32('0x7'));var ejs=require(_0x7c32('0x8'));var fs=require('fs');var fs_extra=require(_0x7c32('0x9'));var _=require(_0x7c32('0xa'));var squel=require(_0x7c32('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7c32('0xc'));var toCsv=require(_0x7c32('0x7'));var querystring=require(_0x7c32('0xd'));var Papa=require(_0x7c32('0xe'));var Redis=require(_0x7c32('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7c32('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c32('0x11'))(_0x7c32('0x12'));var utils=require(_0x7c32('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7c32('0x14'));var db=require(_0x7c32('0x15'))['db'];var csv_results;config[_0x7c32('0x16')]=_[_0x7c32('0x17')](config[_0x7c32('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c32('0x18'))(new Redis(config[_0x7c32('0x16')]));require('./cmList.socket')[_0x7c32('0x19')](socket);function respondWithStatusCode(_0x138ae2,_0x472bfd){_0x472bfd=_0x472bfd||0xcc;return function(_0x3d5acc){if(_0x3d5acc){return _0x138ae2[_0x7c32('0x1a')](_0x472bfd);}return _0x138ae2[_0x7c32('0x1b')](_0x472bfd)[_0x7c32('0x1c')]();};}function respondWithResult(_0x5866d5,_0x1e5d9){_0x1e5d9=_0x1e5d9||0xc8;return function(_0x324b4d){if(_0x324b4d){return _0x5866d5[_0x7c32('0x1b')](_0x1e5d9)['json'](_0x324b4d);}};}function respondWithFilteredResult(_0x33a282,_0x28560f){return function(_0x4cdb70){if(_0x4cdb70){var _0x515ba0=typeof _0x28560f[_0x7c32('0x1d')]===_0x7c32('0x1e')&&typeof _0x28560f['limit']==='undefined';var _0x25d63a=_0x4cdb70['count'];var _0x55a2bb=_0x515ba0?0x0:_0x28560f[_0x7c32('0x1d')];var _0x342461=_0x515ba0?_0x4cdb70[_0x7c32('0x1f')]:_0x28560f['offset']+_0x28560f[_0x7c32('0x20')];var _0x6c68cb;if(_0x342461>=_0x25d63a){_0x342461=_0x25d63a;_0x6c68cb=0xc8;}else{_0x6c68cb=0xce;}_0x33a282[_0x7c32('0x1b')](_0x6c68cb);return _0x33a282[_0x7c32('0x21')](_0x7c32('0x22'),_0x55a2bb+'-'+_0x342461+'/'+_0x25d63a)[_0x7c32('0x23')](_0x4cdb70);}return null;};}function patchUpdates(_0x2383d0){return function(_0x4c7c19){try{jsonpatch[_0x7c32('0x24')](_0x4c7c19,_0x2383d0,!![]);}catch(_0xba50cd){return BPromise[_0x7c32('0x25')](_0xba50cd);}return _0x4c7c19[_0x7c32('0x26')]();};}function saveUpdates(_0x515ed4,_0x1058ce){return function(_0x2db403){if(_0x2db403){return _0x2db403[_0x7c32('0x27')](_0x515ed4)[_0x7c32('0x28')](function(_0x4e1e24){return _0x4e1e24;});}return null;};}function removeEntity(_0x1dd551,_0x18e623){return function(_0x1afed5){if(_0x1afed5){return _0x1afed5['destroy']()[_0x7c32('0x28')](function(){var _0x197f55=_0x1afed5[_0x7c32('0x29')]({'plain':!![]});var _0xae0ce4=_0x7c32('0x2a');return db[_0x7c32('0x2b')]['destroy']({'where':{'type':_0xae0ce4,'resourceId':_0x197f55['id']}})['then'](function(){return _0x1afed5;});})[_0x7c32('0x28')](function(){_0x1dd551[_0x7c32('0x1b')](0xcc)[_0x7c32('0x1c')]();});}};}function handleEntityNotFound(_0x35eafb,_0x20ffe6){return function(_0x238edc){if(!_0x238edc){_0x35eafb[_0x7c32('0x1a')](0x194);}return _0x238edc;};}function handleError(_0x295c88,_0x52b1df){_0x52b1df=_0x52b1df||0x1f4;return function(_0x2e8f1b){logger['error'](_0x2e8f1b[_0x7c32('0x2c')]);if(_0x2e8f1b[_0x7c32('0x2d')]){delete _0x2e8f1b[_0x7c32('0x2d')];}_0x295c88[_0x7c32('0x1b')](_0x52b1df)[_0x7c32('0x2e')](_0x2e8f1b);};}exports[_0x7c32('0x2f')]=function(_0x335007,_0x5350cc){var _0x258ace={},_0x3e530a={},_0x52a7b2={'count':0x0,'rows':[]};var _0x5652f8=_[_0x7c32('0x30')](db[_0x7c32('0x31')]['rawAttributes'],function(_0x53916c){return{'name':_0x53916c[_0x7c32('0x32')],'type':_0x53916c[_0x7c32('0x33')][_0x7c32('0x34')]};});_0x3e530a[_0x7c32('0x35')]=_[_0x7c32('0x30')](_0x5652f8,_0x7c32('0x2d'));_0x3e530a[_0x7c32('0x36')]=_['keys'](_0x335007[_0x7c32('0x36')]);_0x3e530a[_0x7c32('0x37')]=_['intersection'](_0x3e530a['model'],_0x3e530a[_0x7c32('0x36')]);_0x258ace['attributes']=_[_0x7c32('0x38')](_0x3e530a[_0x7c32('0x35')],qs['fields'](_0x335007[_0x7c32('0x36')]['fields']));_0x258ace[_0x7c32('0x39')]=_0x258ace[_0x7c32('0x39')][_0x7c32('0x3a')]?_0x258ace[_0x7c32('0x39')]:_0x3e530a[_0x7c32('0x35')];if(!_0x335007[_0x7c32('0x36')][_0x7c32('0x3b')](_0x7c32('0x3c'))){_0x258ace['limit']=qs[_0x7c32('0x20')](_0x335007[_0x7c32('0x36')][_0x7c32('0x20')]);_0x258ace[_0x7c32('0x1d')]=qs[_0x7c32('0x1d')](_0x335007['query']['offset']);}_0x258ace['order']=qs[_0x7c32('0x3d')](_0x335007['query']['sort']);_0x258ace['where']=qs[_0x7c32('0x37')](_[_0x7c32('0x3e')](_0x335007[_0x7c32('0x36')],_0x3e530a['filters']),_0x5652f8);if(_0x335007[_0x7c32('0x36')]['filter']){_0x258ace[_0x7c32('0x3f')]=_[_0x7c32('0x40')](_0x258ace[_0x7c32('0x3f')],{'$or':_[_0x7c32('0x30')](_0x5652f8,function(_0x55baf2){if(_0x55baf2[_0x7c32('0x33')]!==_0x7c32('0x41')){var _0x7799a3={};_0x7799a3[_0x55baf2[_0x7c32('0x2d')]]={'$like':'%'+_0x335007[_0x7c32('0x36')][_0x7c32('0x42')]+'%'};return _0x7799a3;}})});}_0x258ace=_[_0x7c32('0x40')]({},_0x258ace,_0x335007['options']);var _0x1eaea4={'where':_0x258ace[_0x7c32('0x3f')]};return db[_0x7c32('0x31')]['count'](_0x1eaea4)['then'](function(_0xc785e8){_0x52a7b2[_0x7c32('0x1f')]=_0xc785e8;if(_0x335007[_0x7c32('0x36')][_0x7c32('0x43')]){_0x258ace['include']=[{'all':!![]}];}return db['CmList'][_0x7c32('0x44')](_0x258ace);})[_0x7c32('0x28')](function(_0x427059){_0x52a7b2[_0x7c32('0x45')]=_0x427059;return _0x52a7b2;})['then'](respondWithFilteredResult(_0x5350cc,_0x258ace))[_0x7c32('0x46')](handleError(_0x5350cc,null));};exports[_0x7c32('0x47')]=function(_0x3ac823,_0x2eb9b8){var _0x502a57={'raw':![],'where':{'id':_0x3ac823[_0x7c32('0x48')]['id']}},_0x2338dd={};_0x2338dd[_0x7c32('0x35')]=_[_0x7c32('0x49')](db[_0x7c32('0x31')][_0x7c32('0x4a')]);_0x2338dd[_0x7c32('0x36')]=_[_0x7c32('0x49')](_0x3ac823[_0x7c32('0x36')]);_0x2338dd[_0x7c32('0x37')]=_[_0x7c32('0x38')](_0x2338dd['model'],_0x2338dd[_0x7c32('0x36')]);_0x502a57[_0x7c32('0x39')]=_['intersection'](_0x2338dd[_0x7c32('0x35')],qs[_0x7c32('0x4b')](_0x3ac823[_0x7c32('0x36')][_0x7c32('0x4b')]));_0x502a57[_0x7c32('0x39')]=_0x502a57['attributes']['length']?_0x502a57[_0x7c32('0x39')]:_0x2338dd['model'];if(_0x3ac823[_0x7c32('0x36')][_0x7c32('0x43')]){_0x502a57[_0x7c32('0x4c')]=[{'all':!![]}];}_0x502a57=_[_0x7c32('0x40')]({},_0x502a57,_0x3ac823[_0x7c32('0x4d')]);return db['CmList']['find'](_0x502a57)[_0x7c32('0x28')](handleEntityNotFound(_0x2eb9b8,null))[_0x7c32('0x28')](respondWithResult(_0x2eb9b8,null))[_0x7c32('0x46')](handleError(_0x2eb9b8,null));};exports[_0x7c32('0x4e')]=function(_0x145929,_0x520588){return db[_0x7c32('0x31')]['create'](_0x145929['body'],{})[_0x7c32('0x28')](function(_0x194871){var _0x24409f=_0x145929['user'][_0x7c32('0x29')]({'plain':!![]});if(!_0x24409f)throw new Error(_0x7c32('0x4f'));if(_0x24409f[_0x7c32('0x50')]===_0x7c32('0x51')){var _0x67ea2c=_0x194871[_0x7c32('0x29')]({'plain':!![]});var _0x56c55f=_0x7c32('0x2a');return db[_0x7c32('0x52')][_0x7c32('0x53')]({'where':{'name':_0x56c55f,'userProfileId':_0x24409f[_0x7c32('0x54')]},'raw':!![]})[_0x7c32('0x28')](function(_0x335c1f){if(_0x335c1f&&_0x335c1f[_0x7c32('0x55')]===0x0){return db[_0x7c32('0x2b')][_0x7c32('0x4e')]({'name':_0x67ea2c['name'],'resourceId':_0x67ea2c['id'],'type':_0x335c1f[_0x7c32('0x2d')],'sectionId':_0x335c1f['id']},{})[_0x7c32('0x28')](function(){return _0x194871;});}else{return _0x194871;}})[_0x7c32('0x46')](function(_0x261a08){logger[_0x7c32('0x56')](_0x7c32('0x57'),_0x261a08);throw _0x261a08;});}return _0x194871;})['then'](respondWithResult(_0x520588,0xc9))['catch'](handleError(_0x520588,null));};exports[_0x7c32('0x27')]=function(_0x17da97,_0x553f09){if(_0x17da97['body']['id']){delete _0x17da97[_0x7c32('0x58')]['id'];}return db[_0x7c32('0x31')][_0x7c32('0x53')]({'where':{'id':_0x17da97[_0x7c32('0x48')]['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x553f09,null))[_0x7c32('0x28')](saveUpdates(_0x17da97[_0x7c32('0x58')],null))[_0x7c32('0x28')](respondWithResult(_0x553f09,null))[_0x7c32('0x46')](handleError(_0x553f09,null));};exports[_0x7c32('0x59')]=function(_0x1b7dc3,_0x12213a){return db[_0x7c32('0x31')]['find']({'where':{'id':_0x1b7dc3['params']['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x12213a,null))[_0x7c32('0x28')](removeEntity(_0x12213a,null))[_0x7c32('0x46')](handleError(_0x12213a,null));};exports[_0x7c32('0x5a')]=function(_0x385c57,_0xfd6fb3){return db[_0x7c32('0x31')][_0x7c32('0x5a')]()[_0x7c32('0x28')](respondWithResult(_0xfd6fb3,null))['catch'](handleError(_0xfd6fb3,null));};exports[_0x7c32('0x5b')]=function(_0x57a8f6,_0x572711,_0x577c2a){if(_0x57a8f6['body']['id']){delete _0x57a8f6[_0x7c32('0x58')]['id'];}return db[_0x7c32('0x31')][_0x7c32('0x53')]({'where':{'id':_0x57a8f6[_0x7c32('0x48')]['id']}})['then'](handleEntityNotFound(_0x572711,null))[_0x7c32('0x28')](function(_0x17c048){if(_0x17c048){_0x57a8f6[_0x7c32('0x58')][_0x7c32('0x5c')]=_0x17c048['id'];return db[_0x7c32('0x5d')]['create'](_0x57a8f6['body']);}})[_0x7c32('0x28')](respondWithResult(_0x572711,null))[_0x7c32('0x46')](handleError(_0x572711,null));};exports[_0x7c32('0x5e')]=function(_0x3fcff0,_0x302f9c,_0x483a9e){var _0x1b5ed3={'raw':![],'where':{}};var _0x835d32={};var _0x19eec8={'count':0x0,'rows':[]};return db[_0x7c32('0x31')]['findOne']({'where':{'id':_0x3fcff0[_0x7c32('0x48')]['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x302f9c,null))['then'](function(_0x271994){if(_0x271994){_0x835d32[_0x7c32('0x35')]=_[_0x7c32('0x49')](db[_0x7c32('0x5d')][_0x7c32('0x4a')]);_0x835d32[_0x7c32('0x36')]=_[_0x7c32('0x49')](_0x3fcff0[_0x7c32('0x36')]);_0x835d32[_0x7c32('0x37')]=_[_0x7c32('0x38')](_0x835d32[_0x7c32('0x35')],_0x835d32[_0x7c32('0x36')]);_0x1b5ed3[_0x7c32('0x39')]=_['intersection'](_0x835d32['model'],qs['fields'](_0x3fcff0[_0x7c32('0x36')]['fields']));_0x1b5ed3[_0x7c32('0x39')]=_0x1b5ed3[_0x7c32('0x39')]['length']?_0x1b5ed3[_0x7c32('0x39')]:_0x835d32['model'];if(!_0x3fcff0[_0x7c32('0x36')][_0x7c32('0x3b')](_0x7c32('0x3c'))){_0x1b5ed3[_0x7c32('0x20')]=qs['limit'](_0x3fcff0['query'][_0x7c32('0x20')]);_0x1b5ed3[_0x7c32('0x1d')]=qs[_0x7c32('0x1d')](_0x3fcff0[_0x7c32('0x36')]['offset']);}_0x1b5ed3[_0x7c32('0x5f')]=qs[_0x7c32('0x3d')](_0x3fcff0[_0x7c32('0x36')][_0x7c32('0x3d')]);_0x1b5ed3[_0x7c32('0x3f')]=qs[_0x7c32('0x37')](_['pick'](_0x3fcff0['query'],_0x835d32[_0x7c32('0x37')]));_0x1b5ed3['where'][_0x7c32('0x5c')]=_0x271994['id'];if(_0x3fcff0[_0x7c32('0x36')][_0x7c32('0x42')]){_0x1b5ed3['where']=_[_0x7c32('0x40')](_0x1b5ed3[_0x7c32('0x3f')],{'$or':_[_0x7c32('0x30')](_0x1b5ed3[_0x7c32('0x39')],function(_0xb4bafd){var _0x272d1b={};_0x272d1b[_0xb4bafd]={'$like':'%'+_0x3fcff0['query'][_0x7c32('0x42')]+'%'};return _0x272d1b;})});}_0x1b5ed3=_['merge']({},_0x1b5ed3,_0x3fcff0['options']);return db[_0x7c32('0x5d')][_0x7c32('0x1f')]({'where':_0x1b5ed3[_0x7c32('0x3f')]})[_0x7c32('0x28')](function(_0x115097){_0x19eec8['count']=_0x115097;if(_0x3fcff0[_0x7c32('0x36')][_0x7c32('0x43')]){_0x1b5ed3[_0x7c32('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0x7c32('0x44')](_0x1b5ed3);})[_0x7c32('0x28')](function(_0x1e94cd){_0x19eec8[_0x7c32('0x45')]=_0x1e94cd;return _0x19eec8;});}})[_0x7c32('0x28')](respondWithFilteredResult(_0x302f9c,_0x1b5ed3))[_0x7c32('0x46')](handleError(_0x302f9c,null));};exports['removeDispositions']=function(_0x4a2e7f,_0x74f5b4,_0xc293ee){return db['CmList']['find']({'where':{'id':_0x4a2e7f[_0x7c32('0x48')]['id']}})['then'](handleEntityNotFound(_0x74f5b4,null))['then'](function(_0x425a8e){if(_0x425a8e){return _0x425a8e[_0x7c32('0x60')](_0x4a2e7f[_0x7c32('0x36')][_0x7c32('0x61')]);}})[_0x7c32('0x28')](respondWithStatusCode(_0x74f5b4,null))[_0x7c32('0x46')](handleError(_0x74f5b4,null));};exports[_0x7c32('0x62')]=function(_0x337a1c,_0xab3ae8,_0x4a0a63){return db[_0x7c32('0x31')][_0x7c32('0x53')]({'where':{'id':_0x337a1c[_0x7c32('0x48')]['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0xab3ae8,null))[_0x7c32('0x28')](function(_0x1dfd21){if(_0x1dfd21){var _0x2e10df=[];var _0x166f55={'success':[],'errors':[]};return db[_0x7c32('0x63')][_0x7c32('0x5a')]()[_0x7c32('0x28')](function(_0x3ef940){if(_0x337a1c[_0x7c32('0x58')][_0x7c32('0x64')]&&_[_0x7c32('0x65')](_0x337a1c[_0x7c32('0x58')]['tags'])){if(_0x337a1c[_0x7c32('0x58')]['tags'][_0x7c32('0x3a')]){_0x337a1c['body'][_0x7c32('0x64')]=_0x337a1c['body'][_0x7c32('0x64')]['join'](';')+';';}else{_0x337a1c['body'][_0x7c32('0x64')]=null;}}else{_0x337a1c[_0x7c32('0x58')][_0x7c32('0x64')]=null;}if(_0x337a1c[_0x7c32('0x58')]&&_[_0x7c32('0x65')](_0x337a1c[_0x7c32('0x58')])){for(var _0xbbd7ea=0x0;_0xbbd7ea<_0x337a1c['body']['length'];_0xbbd7ea+=0x1){_0x337a1c[_0x7c32('0x58')][_0xbbd7ea][_0x7c32('0x5c')]=_0x337a1c[_0x7c32('0x48')]['id'];_0x2e10df['push'](_0x337a1c[_0x7c32('0x58')][_0xbbd7ea]);}return BPromise[_0x7c32('0x66')](_0x2e10df,function(_0x219d94){return db[_0x7c32('0x63')][_0x7c32('0x4e')](_[_0x7c32('0x67')](_0x219d94,[_0x7c32('0x61'),'id'])||{},{'fields':_[_0x7c32('0x49')](_0x3ef940),'raw':!![]})[_0x7c32('0x28')](function(_0x2af2f0){_0x166f55[_0x7c32('0x68')]['push'](_0x2af2f0[_0x7c32('0x69')]);})[_0x7c32('0x46')](function(_0x51cfa5){_0x166f55['errors'][_0x7c32('0x6a')]({'data':_0x219d94,'error':_0x51cfa5[_0x7c32('0x6b')]});});})[_0x7c32('0x28')](function(_0xc98bbe){return _0x166f55;})['catch'](function(_0xda4d5c){return _0xda4d5c;});}else{_0xab3ae8[_0x7c32('0x1b')](0x190)[_0x7c32('0x23')]({'message':_0x7c32('0x6c')});}});}})[_0x7c32('0x28')](respondWithResult(_0xab3ae8,null))[_0x7c32('0x46')](handleError(_0xab3ae8,null));};exports[_0x7c32('0x6d')]=function(_0x3c8bae,_0x2871f9,_0x326ccc){var _0x5d90dd;return db[_0x7c32('0x31')][_0x7c32('0x53')]({'where':{'id':_0x3c8bae[_0x7c32('0x48')]['id']},'include':[{'model':db[_0x7c32('0x6e')],'as':_0x7c32('0x6f')}]})[_0x7c32('0x28')](handleEntityNotFound(_0x2871f9,null))[_0x7c32('0x28')](function(_0x56b320){if(_0x56b320){_0x5d90dd=_0x56b320;return db[_0x7c32('0x63')][_0x7c32('0x4a')];}})['then'](function(_0x2a0a06){if(_0x2a0a06){var _0x44a143={};var _0x794e91={};_0x794e91[_0x7c32('0x35')]=_['concat'](_[_0x7c32('0x49')](_0x2a0a06),_[_0x7c32('0x30')](_0x5d90dd[_0x7c32('0x6f')],function(_0x5b1f60){return util['format']('cf_%d',_0x5b1f60['id']);}));_0x794e91[_0x7c32('0x36')]=_[_0x7c32('0x49')](_0x3c8bae[_0x7c32('0x36')]);_0x794e91[_0x7c32('0x37')]=_['intersection'](_0x794e91[_0x7c32('0x35')],_0x794e91[_0x7c32('0x36')]);_0x44a143[_0x7c32('0x39')]=_[_0x7c32('0x38')](_0x794e91['model'],qs[_0x7c32('0x4b')](_0x3c8bae['query'][_0x7c32('0x4b')]));_0x44a143['attributes']=_0x44a143[_0x7c32('0x39')][_0x7c32('0x3a')]?_0x44a143[_0x7c32('0x39')]:_0x794e91[_0x7c32('0x35')];if(!_0x3c8bae[_0x7c32('0x36')][_0x7c32('0x3b')](_0x7c32('0x3c'))){_0x44a143[_0x7c32('0x20')]=qs['limit'](_0x3c8bae[_0x7c32('0x36')][_0x7c32('0x20')]);_0x44a143[_0x7c32('0x1d')]=qs[_0x7c32('0x1d')](_0x3c8bae['query'][_0x7c32('0x1d')]);}_0x44a143[_0x7c32('0x5f')]=qs[_0x7c32('0x3d')](_0x3c8bae['query'][_0x7c32('0x3d')]);_0x44a143[_0x7c32('0x3f')]=qs[_0x7c32('0x37')](_[_0x7c32('0x3e')](_0x3c8bae['query'],_0x794e91['filters']));_0x44a143['raw']=!![];if(_0x3c8bae[_0x7c32('0x36')][_0x7c32('0x42')]){_0x44a143[_0x7c32('0x3f')]=_[_0x7c32('0x40')](_0x44a143[_0x7c32('0x3f')],{'$or':_['map'](_0x44a143['attributes'],function(_0x3ea8d3){var _0x393e5b={};_0x393e5b[_0x3ea8d3]={'$like':'%'+_0x3c8bae[_0x7c32('0x36')][_0x7c32('0x42')]+'%'};return _0x393e5b;})});}_0x44a143=_[_0x7c32('0x40')]({},_0x44a143,_0x3c8bae[_0x7c32('0x4d')]);return _0x5d90dd[_0x7c32('0x6d')](_0x44a143);}})[_0x7c32('0x28')](respondWithResult(_0x2871f9,null))['catch'](handleError(_0x2871f9,null));};exports['getContactsCsv']=function(_0x1da29e,_0x17f229,_0x1a5b8f){var _0x1394dd;var _0x6b32ee;var _0xd1eccd;var _0x2ac07b=_0x1da29e[_0x7c32('0x48')]['id'];csv_results=[];return db[_0x7c32('0x70')]['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0x7c32('0x71')]})[_0x7c32('0x28')](function(_0x4355d0){_0x1394dd=_0x4355d0;var _0x3baf7a=_['keys'](db[_0x7c32('0x63')][_0x7c32('0x4a')]);return db[_0x7c32('0x6e')]['findAll']({'raw':!![],'attributes':['id',_0x7c32('0x72')]})[_0x7c32('0x28')](function(_0x4118de){_0x6b32ee=_0x4118de;var _0x52f5f1=squel[_0x7c32('0x73')]()[_0x7c32('0x4b')](_0x3baf7a)[_0x7c32('0x74')](_0x7c32('0x75'),'c')['where'](_0x7c32('0x76'),_0x2ac07b)[_0x7c32('0x3f')](_0x7c32('0x77'))[_0x7c32('0x78')]();for(var _0x37d55a=0x0;_0x37d55a<_0x6b32ee['length'];_0x37d55a++){_0x52f5f1[_0x7c32('0x79')](_0x7c32('0x7a')+_0x6b32ee[_0x37d55a]['id'],_0x7c32('0x7b')+_0x6b32ee[_0x37d55a][_0x7c32('0x72')]);}for(var _0x37d55a=0x0;_0x37d55a<_0x1394dd[_0x7c32('0x3a')];_0x37d55a++){_0x52f5f1[_0x7c32('0x79')](squel[_0x7c32('0x73')]()['field'](_0x7c32('0x7c'))[_0x7c32('0x74')](_0x7c32('0x7d'))[_0x7c32('0x3f')](_0x7c32('0x7e'),_0x1394dd[_0x37d55a]['id'])['where'](_0x7c32('0x7f')),_0x7c32('0x80')+_0x1394dd[_0x37d55a][_0x7c32('0x2d')]);_0x52f5f1['field'](squel['select']()[_0x7c32('0x79')](_0x7c32('0x81'))[_0x7c32('0x74')]('cm_contact_has_items')[_0x7c32('0x3f')](_0x7c32('0x7e'),_0x1394dd[_0x37d55a]['id'])[_0x7c32('0x3f')](_0x7c32('0x7f')),'description_additionalPhone_'+_0x1394dd[_0x37d55a][_0x7c32('0x2d')]);}var _0x4c57b2=[];_0x4c57b2[_0x7c32('0x6a')](_0x52f5f1[_0x7c32('0x82')]());BPromise[_0x7c32('0x66')](_0x4c57b2,handleQuery)['then'](function(_0x135770){handleQuery(_0x52f5f1[_0x7c32('0x82')]());var _0x4980f3=csv_results[0x0];if(!_[_0x7c32('0x83')](_0x4980f3)){var _0x8891fe=toCsv(_0x4980f3);var _0x3c106b=Date[_0x7c32('0x84')]();fs[_0x7c32('0x85')](util[_0x7c32('0x86')](_0x7c32('0x87'),_0x2ac07b,_0x3c106b),_0x8891fe);_0x17f229[_0x7c32('0x88')](_0x7c32('0x89'),_0x7c32('0x8a')+util[_0x7c32('0x86')](_0x7c32('0x8b'),_0x2ac07b,_0x3c106b));_0x17f229[_0x7c32('0x88')]('Content-type',_0x7c32('0x8c'));return _0x17f229[_0x7c32('0x8d')](util[_0x7c32('0x86')](_0x7c32('0x87'),_0x2ac07b,_0x3c106b));}else{return _0x17f229[_0x7c32('0x1a')](0xcc);}});});});};exports[_0x7c32('0x8e')]=function(_0x21de30,_0x4d21e7,_0x35addf){var _0xcad400;delete _0x21de30['body']['id'];return db[_0x7c32('0x31')][_0x7c32('0x8f')]({'where':{'id':_0x21de30[_0x7c32('0x48')]['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x4d21e7,null))[_0x7c32('0x28')](function(_0x2a954d){if(_0x2a954d){return db['sequelize']['transaction'](function(_0x3a765c){return db[_0x7c32('0x6e')][_0x7c32('0x4e')](_0x21de30[_0x7c32('0x58')],{'transaction':_0x3a765c})['then'](function(_0xf2301e){_0xcad400=_0xf2301e;return _0x2a954d[_0x7c32('0x90')](_0xf2301e,{'transaction':_0x3a765c});})[_0x7c32('0x28')](function(){var _0x43e4fc={'type':db[_0x7c32('0x91')]['TEXT'],'transaction':_0x3a765c};switch(_0x21de30[_0x7c32('0x58')][_0x7c32('0x33')]){case _0x7c32('0x92'):_0x43e4fc[_0x7c32('0x33')]=db['Sequelize'][_0x7c32('0x93')];break;case _0x7c32('0x94'):_0x43e4fc[_0x7c32('0x33')]=db[_0x7c32('0x91')][_0x7c32('0x95')];break;case _0x7c32('0x96'):_0x43e4fc[_0x7c32('0x33')]=db[_0x7c32('0x91')][_0x7c32('0x97')];_0x43e4fc[_0x7c32('0x98')]=![];break;default:}return db[_0x7c32('0x99')][_0x7c32('0x9a')][_0x7c32('0x9b')](_0x7c32('0x75'),util[_0x7c32('0x86')]('cf_%s',_0xcad400['id']),_0x43e4fc);})[_0x7c32('0x28')](function(){return _0xcad400;});});}})[_0x7c32('0x28')](respondWithResult(_0x4d21e7,null))[_0x7c32('0x46')](handleError(_0x4d21e7,null));};exports[_0x7c32('0x9c')]=function(_0x486e76,_0x48309d,_0x1783ec){var _0x26f246={};var _0x33b188={};var _0x35ac70;var _0x1796c9;return db[_0x7c32('0x31')][_0x7c32('0x8f')]({'where':{'id':_0x486e76['params']['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x48309d,null))[_0x7c32('0x28')](function(_0x2fdb2d){if(_0x2fdb2d){_0x35ac70=_0x2fdb2d;_0x33b188[_0x7c32('0x35')]=_[_0x7c32('0x49')](db['CmCustomField'][_0x7c32('0x4a')]);_0x33b188[_0x7c32('0x36')]=_[_0x7c32('0x49')](_0x486e76['query']);_0x33b188[_0x7c32('0x37')]=_['intersection'](_0x33b188[_0x7c32('0x35')],_0x33b188[_0x7c32('0x36')]);_0x26f246[_0x7c32('0x39')]=_[_0x7c32('0x38')](_0x33b188[_0x7c32('0x35')],qs[_0x7c32('0x4b')](_0x486e76['query'][_0x7c32('0x4b')]));_0x26f246['attributes']=_0x26f246[_0x7c32('0x39')][_0x7c32('0x3a')]?_0x26f246[_0x7c32('0x39')]:_0x33b188[_0x7c32('0x35')];_0x26f246[_0x7c32('0x5f')]=qs[_0x7c32('0x3d')](_0x486e76[_0x7c32('0x36')][_0x7c32('0x3d')]);_0x26f246['where']=qs['filters'](_[_0x7c32('0x3e')](_0x486e76[_0x7c32('0x36')],_0x33b188[_0x7c32('0x37')]));_0x26f246[_0x7c32('0x3f')]=_[_0x7c32('0x40')](_0x26f246[_0x7c32('0x3f')],{'$or':[{'ListId':_0x2fdb2d['id']},{'ListId':null}]});if(_0x486e76[_0x7c32('0x36')][_0x7c32('0x42')]){_0x26f246[_0x7c32('0x3f')]=_[_0x7c32('0x40')](_0x26f246[_0x7c32('0x3f')],{'$or':_[_0x7c32('0x30')](_0x26f246[_0x7c32('0x39')],function(_0x5a0aa6){var _0x5cd953={};_0x5cd953[_0x5a0aa6]={'$like':'%'+_0x486e76[_0x7c32('0x36')][_0x7c32('0x42')]+'%'};return _0x5cd953;})});}_0x26f246=_['merge']({},_0x26f246,_0x486e76[_0x7c32('0x4d')]);return db[_0x7c32('0x6e')]['findAndCountAll'](_0x26f246);}})[_0x7c32('0x28')](respondWithResult(_0x48309d,null))[_0x7c32('0x46')](handleError(_0x48309d,null));};exports[_0x7c32('0x9d')]=function(_0x3efb8a,_0x4581a3){return db[_0x7c32('0x6e')][_0x7c32('0x9e')]({'where':{'ListId':null}})[_0x7c32('0x28')](handleEntityNotFound(_0x4581a3,null))[_0x7c32('0x28')](function(_0x4f6d9e){return _0x4f6d9e;})[_0x7c32('0x28')](respondWithResult(_0x4581a3,null))['catch'](handleError(_0x4581a3,null));};exports[_0x7c32('0x9f')]=function(_0x5149a5,_0x16ab6f,_0x5ef535){return db[_0x7c32('0x31')][_0x7c32('0x53')]({'where':{'id':_0x5149a5[_0x7c32('0x48')]['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x16ab6f,null))[_0x7c32('0x28')](function(_0x5789ec){if(_0x5789ec){return _0x5789ec[_0x7c32('0x9f')](_0x5149a5['body']['ids'],_['omit'](_0x5149a5[_0x7c32('0x58')],[_0x7c32('0x61'),'id'])||{})[_0x7c32('0xa0')](function(_0x1682d5){for(var _0x4a6d69=0x0;_0x4a6d69<_0x5149a5[_0x7c32('0x58')][_0x7c32('0x61')][_0x7c32('0x3a')];_0x4a6d69+=0x1){socket[_0x7c32('0xa1')](_0x7c32('0xa2'),{'UserId':Number(_0x5149a5[_0x7c32('0x58')][_0x7c32('0x61')][_0x4a6d69]),'CmListId':Number(_0x5149a5[_0x7c32('0x48')]['id'])});}return _0x1682d5;});}})[_0x7c32('0x28')](respondWithResult(_0x16ab6f,null))[_0x7c32('0x46')](handleError(_0x16ab6f,null));};exports[_0x7c32('0xa3')]=function(_0x35eedd,_0x563dd3,_0x2a3949){return db[_0x7c32('0x31')][_0x7c32('0x53')]({'where':{'id':_0x35eedd['params']['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x563dd3,null))['then'](function(_0xbdf8d6){if(_0xbdf8d6){return _0xbdf8d6['removeAgents'](_0x35eedd[_0x7c32('0x36')]['ids'])[_0x7c32('0x28')](function(){if(_[_0x7c32('0x65')](_0x35eedd[_0x7c32('0x36')][_0x7c32('0x61')])){for(var _0x3a28c8=0x0;_0x3a28c8<_0x35eedd[_0x7c32('0x36')][_0x7c32('0x61')][_0x7c32('0x3a')];_0x3a28c8+=0x1){socket[_0x7c32('0xa1')](_0x7c32('0xa4'),{'UserId':Number(_0x35eedd['query']['ids'][_0x3a28c8]),'CmListId':Number(_0x35eedd[_0x7c32('0x48')]['id'])});}}else{socket[_0x7c32('0xa1')]('userCmList:remove',{'UserId':Number(_0x35eedd[_0x7c32('0x36')][_0x7c32('0x61')]),'CmListId':Number(_0x35eedd['params']['id'])});}});}})[_0x7c32('0x28')](respondWithStatusCode(_0x563dd3,null))['catch'](handleError(_0x563dd3,null));};exports[_0x7c32('0xa5')]=function(_0x37baa3,_0x1b918,_0x4630f1){var _0x298cc5={};var _0x544c9b={};var _0x952baa;var _0x42c059;return db[_0x7c32('0x31')][_0x7c32('0x8f')]({'where':{'id':_0x37baa3[_0x7c32('0x48')]['id']}})[_0x7c32('0x28')](handleEntityNotFound(_0x1b918,null))[_0x7c32('0x28')](function(_0x3c0c61){if(_0x3c0c61){_0x952baa=_0x3c0c61;_0x544c9b[_0x7c32('0x35')]=_[_0x7c32('0x49')](db[_0x7c32('0xa6')][_0x7c32('0x4a')]);_0x544c9b[_0x7c32('0x36')]=_[_0x7c32('0x49')](_0x37baa3[_0x7c32('0x36')]);_0x544c9b[_0x7c32('0x37')]=_[_0x7c32('0x38')](_0x544c9b[_0x7c32('0x35')],_0x544c9b[_0x7c32('0x36')]);_0x298cc5['attributes']=_[_0x7c32('0x38')](_0x544c9b['model'],qs[_0x7c32('0x4b')](_0x37baa3[_0x7c32('0x36')]['fields']));_0x298cc5[_0x7c32('0x39')]=_0x298cc5[_0x7c32('0x39')][_0x7c32('0x3a')]?_0x298cc5['attributes']:_0x544c9b[_0x7c32('0x35')];_0x298cc5[_0x7c32('0x5f')]=qs[_0x7c32('0x3d')](_0x37baa3[_0x7c32('0x36')][_0x7c32('0x3d')]);_0x298cc5[_0x7c32('0x3f')]=qs[_0x7c32('0x37')](_['pick'](_0x37baa3['query'],_0x544c9b[_0x7c32('0x37')]));if(_0x37baa3['query']['filter']){_0x298cc5[_0x7c32('0x3f')]=_[_0x7c32('0x40')](_0x298cc5[_0x7c32('0x3f')],{'$or':_[_0x7c32('0x30')](_0x298cc5[_0x7c32('0x39')],function(_0x5adeb4){var _0x3d09f7={};_0x3d09f7[_0x5adeb4]={'$like':'%'+_0x37baa3[_0x7c32('0x36')][_0x7c32('0x42')]+'%'};return _0x3d09f7;})});}_0x298cc5=_[_0x7c32('0x40')]({},_0x298cc5,_0x37baa3[_0x7c32('0x4d')]);return _0x952baa[_0x7c32('0xa5')](_0x298cc5);}})['then'](function(_0x4e1c37){if(_0x4e1c37){_0x42c059=_0x4e1c37[_0x7c32('0x3a')];if(!_0x37baa3['query'][_0x7c32('0x3b')](_0x7c32('0x3c'))){_0x298cc5[_0x7c32('0x20')]=qs['limit'](_0x37baa3[_0x7c32('0x36')][_0x7c32('0x20')]);_0x298cc5[_0x7c32('0x1d')]=qs[_0x7c32('0x1d')](_0x37baa3['query']['offset']);}return _0x952baa['getAgents'](_0x298cc5);}})[_0x7c32('0x28')](function(_0x5853d5){if(_0x5853d5){return _0x5853d5?{'count':_0x42c059,'rows':_0x5853d5}:null;}})[_0x7c32('0x28')](respondWithResult(_0x1b918,null))[_0x7c32('0x46')](handleError(_0x1b918,null));};function handleQuery(_0x16ea3e){logger[_0x7c32('0xa7')](_0x16ea3e);return db[_0x7c32('0x99')][_0x7c32('0x36')](_0x16ea3e)[_0x7c32('0xa0')](function(_0x230bf1){csv_results[_0x7c32('0x6a')](_0x230bf1);})['catch'](function(_0x3a6ed0){logger[_0x7c32('0x56')](_0x3a6ed0[_0x7c32('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c0e4fbc..fbf9e68 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x156792,_0x5c22ca){var _0xf6a038=function(_0x1cb52e){while(--_0x1cb52e){_0x156792['push'](_0x156792['shift']());}};_0xf6a038(++_0x5c22ca);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x20d7a4,_0x140fc3){var _0x56cdc8=function(_0x178f82){while(--_0x178f82){_0x20d7a4['push'](_0x20d7a4['shift']());}};_0x56cdc8(++_0x140fc3);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('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 f261911..5036387 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 _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x36abe6,_0x7b8e40){var _0x6e2568=function(_0x510825){while(--_0x510825){_0x36abe6['push'](_0x36abe6['shift']());}};_0x6e2568(++_0x7b8e40);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2108f4,_0x596050){_0x2108f4=_0x2108f4-0x0;var _0x269f76=_0xb43b[_0x2108f4];return _0x269f76;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x56c230,_0x56a54b){var _0x3170fa=function(_0x4a74a5){while(--_0x4a74a5){_0x56c230['push'](_0x56c230['shift']());}};_0x3170fa(++_0x56a54b);}(_0xbec5,0xe5));var _0x5bec=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0xbec5[_0x2a7b50];return _0x4224c9;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2193888..95bbf1a 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 _0xd7a3=['../../config/logger','rpc','../../config/environment','http','redis','localhost','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2e6184,_0xf2fc16){var _0x1e4c2c=function(_0x1dc66b){while(--_0x1dc66b){_0x2e6184['push'](_0x2e6184['shift']());}};_0x1e4c2c(++_0xf2fc16);}(_0xd7a3,0x15a));var _0x3d7a=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xd7a3[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require(_0x3d7a('0x0'));var moment=require(_0x3d7a('0x1'));var BPromise=require(_0x3d7a('0x2'));var rs=require(_0x3d7a('0x3'));var fs=require('fs');var Redis=require(_0x3d7a('0x4'));var db=require(_0x3d7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d7a('0x6'))(_0x3d7a('0x7'));var config=require(_0x3d7a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3d7a('0x9')]({'port':0x232a});config[_0x3d7a('0xa')]=_['defaults'](config['redis'],{'host':_0x3d7a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d7a('0xa')]));require(_0x3d7a('0xc'))[_0x3d7a('0xd')](socket);function respondWithRpcPromise(_0x423c8e,_0x219fe0,_0x344d19){return new BPromise(function(_0x3a6438,_0x20c568){return client[_0x3d7a('0xe')](_0x423c8e,_0x344d19)['then'](function(_0x2c48ba){logger[_0x3d7a('0xf')](_0x3d7a('0x10'),_0x219fe0,_0x3d7a('0x11'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x219fe0,'request\x20sent',JSON[_0x3d7a('0x12')](_0x2c48ba));if(_0x2c48ba['error']){if(_0x2c48ba[_0x3d7a('0x13')]['code']===0x1f4){logger[_0x3d7a('0x13')](_0x3d7a('0x10'),_0x219fe0,_0x2c48ba[_0x3d7a('0x13')]['message']);return _0x20c568(_0x2c48ba[_0x3d7a('0x13')][_0x3d7a('0x14')]);}logger[_0x3d7a('0x13')](_0x3d7a('0x10'),_0x219fe0,_0x2c48ba[_0x3d7a('0x13')]['message']);return _0x3a6438(_0x2c48ba[_0x3d7a('0x13')][_0x3d7a('0x14')]);}else{logger[_0x3d7a('0xf')]('CmList,\x20%s,\x20%s',_0x219fe0,_0x3d7a('0x11'));_0x3a6438(_0x2c48ba[_0x3d7a('0x15')][_0x3d7a('0x14')]);}})['catch'](function(_0x1d29d9){logger[_0x3d7a('0x13')](_0x3d7a('0x10'),_0x219fe0,_0x1d29d9);_0x20c568(_0x1d29d9);});});} \ No newline at end of file +var _0x84fd=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x84fd,0x134));var _0xd84f=function(_0xbf4c60,_0x4756fd){_0xbf4c60=_0xbf4c60-0x0;var _0x3c9136=_0x84fd[_0xbf4c60];return _0x3c9136;};'use strict';var _=require(_0xd84f('0x0'));var util=require(_0xd84f('0x1'));var moment=require(_0xd84f('0x2'));var BPromise=require(_0xd84f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd84f('0x4'));var db=require(_0xd84f('0x5'))['db'];var utils=require(_0xd84f('0x6'));var logger=require(_0xd84f('0x7'))(_0xd84f('0x8'));var config=require('../../config/environment');var jayson=require(_0xd84f('0x9'));var client=jayson[_0xd84f('0xa')]['http']({'port':0x232a});config[_0xd84f('0xb')]=_[_0xd84f('0xc')](config[_0xd84f('0xb')],{'host':_0xd84f('0xd'),'port':0x18eb});var socket=require(_0xd84f('0xe'))(new Redis(config['redis']));require(_0xd84f('0xf'))[_0xd84f('0x10')](socket);function respondWithRpcPromise(_0x3f0207,_0x4ad08d,_0x27d908){return new BPromise(function(_0x4ba248,_0x30e1f8){return client[_0xd84f('0x11')](_0x3f0207,_0x27d908)['then'](function(_0x537ff5){logger[_0xd84f('0x12')](_0xd84f('0x13'),_0x4ad08d,'request\x20sent');logger[_0xd84f('0x14')](_0xd84f('0x15'),_0x4ad08d,'request\x20sent',JSON[_0xd84f('0x16')](_0x537ff5));if(_0x537ff5[_0xd84f('0x17')]){if(_0x537ff5[_0xd84f('0x17')]['code']===0x1f4){logger[_0xd84f('0x17')](_0xd84f('0x13'),_0x4ad08d,_0x537ff5[_0xd84f('0x17')]['message']);return _0x30e1f8(_0x537ff5['error'][_0xd84f('0x18')]);}logger['error'](_0xd84f('0x13'),_0x4ad08d,_0x537ff5[_0xd84f('0x17')][_0xd84f('0x18')]);return _0x4ba248(_0x537ff5[_0xd84f('0x17')][_0xd84f('0x18')]);}else{logger[_0xd84f('0x12')]('CmList,\x20%s,\x20%s',_0x4ad08d,_0xd84f('0x19'));_0x4ba248(_0x537ff5[_0xd84f('0x1a')]['message']);}})[_0xd84f('0x1b')](function(_0x196e4a){logger[_0xd84f('0x17')](_0xd84f('0x13'),_0x4ad08d,_0x196e4a);_0x30e1f8(_0x196e4a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 45e8e2c..d4c0bb3 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 _0xace8=['removeListener','length','cmList:','./cmList.events','save','remove','update'];(function(_0x5b8566,_0x2152e2){var _0x557e4b=function(_0x52908f){while(--_0x52908f){_0x5b8566['push'](_0x5b8566['shift']());}};_0x557e4b(++_0x2152e2);}(_0xace8,0x88));var _0x8ace=function(_0x52d441,_0x343fb0){_0x52d441=_0x52d441-0x0;var _0x5cf70f=_0xace8[_0x52d441];return _0x5cf70f;};'use strict';var CmListEvents=require(_0x8ace('0x0'));var events=[_0x8ace('0x1'),_0x8ace('0x2'),_0x8ace('0x3')];function createListener(_0x2810d7,_0x7046bc){return function(_0x21b48c){_0x7046bc['emit'](_0x2810d7,_0x21b48c);};}function removeListener(_0x198de9,_0x3c8d2a){return function(){CmListEvents[_0x8ace('0x4')](_0x198de9,_0x3c8d2a);};}exports['register']=function(_0x56b566){for(var _0x571c6c=0x0,_0x2c8d91=events[_0x8ace('0x5')];_0x571c6c<_0x2c8d91;_0x571c6c++){var _0xf7c200=events[_0x571c6c];var _0x42d103=createListener(_0x8ace('0x6')+_0xf7c200,_0x56b566);CmListEvents['on'](_0xf7c200,_0x42d103);}}; \ No newline at end of file +var _0x12c6=['register','length','./cmList.events','save','update','removeListener'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x12c6,0x68));var _0x612c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x12c6[_0x4ae6ef];return _0x3cbb4e;};'use strict';var CmListEvents=require(_0x612c('0x0'));var events=[_0x612c('0x1'),'remove',_0x612c('0x2')];function createListener(_0x2eba7d,_0x157769){return function(_0x4f042a){_0x157769['emit'](_0x2eba7d,_0x4f042a);};}function removeListener(_0x3208b1,_0x25baae){return function(){CmListEvents[_0x612c('0x3')](_0x3208b1,_0x25baae);};}exports[_0x612c('0x4')]=function(_0x5ee8f1){for(var _0x58d38f=0x0,_0x260938=events[_0x612c('0x5')];_0x58d38f<_0x260938;_0x58d38f++){var _0x4b2e37=events[_0x58d38f];var _0x5aa725=createListener('cmList:'+_0x4b2e37,_0x5ee8f1);CmListEvents['on'](_0x4b2e37,_0x5aa725);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b27d076..a99c907 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 _0x1f77=['get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','addDisposition','addContacts','/:id/users','addAgents','delete','destroy','removeDispositions','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x446148,_0x4b816c){var _0x90ab91=function(_0x20127c){while(--_0x20127c){_0x446148['push'](_0x446148['shift']());}};_0x90ab91(++_0x4b816c);}(_0x1f77,0x131));var _0x71f7=function(_0x41b0e6,_0x7a9383){_0x41b0e6=_0x41b0e6-0x0;var _0x125443=_0x1f77[_0x41b0e6];return _0x125443;};'use strict';var multer=require(_0x71f7('0x0'));var util=require(_0x71f7('0x1'));var path=require(_0x71f7('0x2'));var timeout=require(_0x71f7('0x3'));var express=require(_0x71f7('0x4'));var router=express[_0x71f7('0x5')]();var fs_extra=require(_0x71f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x71f7('0x7'));var config=require(_0x71f7('0x8'));var controller=require(_0x71f7('0x9'));router[_0x71f7('0xa')]('/',auth[_0x71f7('0xb')](),controller[_0x71f7('0xc')]);router[_0x71f7('0xa')](_0x71f7('0xd'),auth[_0x71f7('0xb')](),controller[_0x71f7('0xe')]);router[_0x71f7('0xa')](_0x71f7('0xf'),auth['isAuthenticated'](),controller[_0x71f7('0x10')]);router['get'](_0x71f7('0x11'),auth[_0x71f7('0xb')](),controller['show']);router['get'](_0x71f7('0x12'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x13')]);router['get'](_0x71f7('0x14'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x15')]);router[_0x71f7('0xa')](_0x71f7('0x16'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x17')]);router[_0x71f7('0xa')](_0x71f7('0x18'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x19')]);router[_0x71f7('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x71f7('0x1a')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x71f7('0x1b')](_0x71f7('0x12'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x1c')]);router[_0x71f7('0x1b')](_0x71f7('0x14'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x1d')]);router[_0x71f7('0x1b')](_0x71f7('0x18'),auth['isAuthenticated'](),controller['addCustomField']);router['post'](_0x71f7('0x1e'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x1f')]);router['put'](_0x71f7('0x11'),auth[_0x71f7('0xb')](),controller['update']);router[_0x71f7('0x20')](_0x71f7('0x11'),auth['isAuthenticated'](),controller[_0x71f7('0x21')]);router[_0x71f7('0x20')](_0x71f7('0x12'),auth[_0x71f7('0xb')](),controller[_0x71f7('0x22')]);router[_0x71f7('0x20')](_0x71f7('0x1e'),auth[_0x71f7('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x367c=['update','delete','removeDispositions','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0x367c,0x1b4));var _0xc367=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x367c[_0x1f71d8];return _0x10b045;};'use strict';var multer=require('multer');var util=require(_0xc367('0x0'));var path=require(_0xc367('0x1'));var timeout=require(_0xc367('0x2'));var express=require(_0xc367('0x3'));var router=express[_0xc367('0x4')]();var fs_extra=require(_0xc367('0x5'));var auth=require(_0xc367('0x6'));var interaction=require(_0xc367('0x7'));var config=require(_0xc367('0x8'));var controller=require(_0xc367('0x9'));router[_0xc367('0xa')]('/',auth[_0xc367('0xb')](),controller['index']);router['get'](_0xc367('0xc'),auth[_0xc367('0xb')](),controller[_0xc367('0xd')]);router[_0xc367('0xa')](_0xc367('0xe'),auth[_0xc367('0xb')](),controller[_0xc367('0xf')]);router[_0xc367('0xa')]('/:id',auth[_0xc367('0xb')](),controller[_0xc367('0x10')]);router[_0xc367('0xa')](_0xc367('0x11'),auth[_0xc367('0xb')](),controller[_0xc367('0x12')]);router[_0xc367('0xa')](_0xc367('0x13'),auth['isAuthenticated'](),controller[_0xc367('0x14')]);router['get'](_0xc367('0x15'),auth[_0xc367('0xb')](),controller['getContactsCsv']);router[_0xc367('0xa')](_0xc367('0x16'),auth[_0xc367('0xb')](),controller[_0xc367('0x17')]);router['get'](_0xc367('0x18'),auth['isAuthenticated'](),controller[_0xc367('0x19')]);router[_0xc367('0x1a')]('/',auth[_0xc367('0xb')](),controller[_0xc367('0x1b')]);router[_0xc367('0x1a')](_0xc367('0x11'),auth[_0xc367('0xb')](),controller[_0xc367('0x1c')]);router[_0xc367('0x1a')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xc367('0x1d')]);router[_0xc367('0x1a')](_0xc367('0x16'),auth[_0xc367('0xb')](),controller[_0xc367('0x1e')]);router['post'](_0xc367('0x18'),auth[_0xc367('0xb')](),controller['addAgents']);router['put'](_0xc367('0x1f'),auth['isAuthenticated'](),controller[_0xc367('0x20')]);router[_0xc367('0x21')](_0xc367('0x1f'),auth[_0xc367('0xb')](),controller['destroy']);router[_0xc367('0x21')](_0xc367('0x11'),auth[_0xc367('0xb')](),controller[_0xc367('0x22')]);router[_0xc367('0x21')](_0xc367('0x18'),auth[_0xc367('0xb')](),controller[_0xc367('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 262f702..726e2ac 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 _0x601a=['STRING','sequelize','exports','getDataValue','field'];(function(_0x28e405,_0x155e72){var _0x190254=function(_0x3271ab){while(--_0x3271ab){_0x28e405['push'](_0x28e405['shift']());}};_0x190254(++_0x155e72);}(_0x601a,0x1d2));var _0xa601=function(_0x296666,_0xc1fb98){_0x296666=_0x296666-0x0;var _0x1278ef=_0x601a[_0x296666];return _0x1278ef;};'use strict';var Sequelize=require(_0xa601('0x0'));module[_0xa601('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f727d){return this[_0xa601('0x2')](_0xa601('0x3'));}},'field':{'type':Sequelize[_0xa601('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xa601('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xa601('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0087=['STRING','exports','VIRTUAL','field'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x0087,0x65));var _0x7008=function(_0x39b5bd,_0x398098){_0x39b5bd=_0x39b5bd-0x0;var _0x3791cb=_0x0087[_0x39b5bd];return _0x3791cb;};'use strict';var Sequelize=require('sequelize');module[_0x7008('0x0')]={'name':{'type':Sequelize[_0x7008('0x1')],'get':function(_0x3d8d7b){return this['getDataValue'](_0x7008('0x2'));}},'field':{'type':Sequelize[_0x7008('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x7008('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x7008('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 39350f4..3c05cf3 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(_0x46e5af,_0x5056a2){var _0x501446=function(_0x5327b1){while(--_0x5327b1){_0x46e5af['push'](_0x46e5af['shift']());}};_0x501446(++_0x5056a2);}(_0x7a54,0x106));var _0x47a5=function(_0x4508cf,_0x3df8fb){_0x4508cf=_0x4508cf-0x0;var _0x4a8d8e=_0x7a54[_0x4508cf];return _0x4a8d8e;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4f90b9,_0x15b058){var _0x34fc60=function(_0x4d7263){while(--_0x4d7263){_0x4f90b9['push'](_0x4f90b9['shift']());}};_0x34fc60(++_0x15b058);}(_0x7a54,0x106));var _0x47a5=function(_0x1eab65,_0x59148d){_0x1eab65=_0x1eab65-0x0;var _0x172d34=_0x7a54[_0x1eab65];return _0x172d34;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 37925b3..7b9a868 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 _0x0bd0=['bluebird','request-promise','rimraf','./condition.attributes','define','Condition','tools_conditions','lodash','util','../../config/logger','api'];(function(_0x14d0d7,_0x32df52){var _0x36da65=function(_0x1b1839){while(--_0x1b1839){_0x14d0d7['push'](_0x14d0d7['shift']());}};_0x36da65(++_0x32df52);}(_0x0bd0,0x167));var _0x00bd=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0bd0[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x00bd('0x0'));var util=require(_0x00bd('0x1'));var logger=require(_0x00bd('0x2'))(_0x00bd('0x3'));var moment=require('moment');var BPromise=require(_0x00bd('0x4'));var rp=require(_0x00bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00bd('0x6'));var config=require('../../config/environment');var attributes=require(_0x00bd('0x7'));module['exports']=function(_0xaa0b94,_0x172e01){return _0xaa0b94[_0x00bd('0x8')](_0x00bd('0x9'),attributes,{'tableName':_0x00bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa256=['rimraf','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x53c493,_0x425909){var _0x1478ab=function(_0x411efa){while(--_0x411efa){_0x53c493['push'](_0x53c493['shift']());}};_0x1478ab(++_0x425909);}(_0xa256,0x13e));var _0x6a25=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa256[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require(_0x6a25('0x0'));var logger=require(_0x6a25('0x1'))(_0x6a25('0x2'));var moment=require('moment');var BPromise=require(_0x6a25('0x3'));var rp=require(_0x6a25('0x4'));var fs=require('fs');var path=require(_0x6a25('0x5'));var rimraf=require(_0x6a25('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a25('0x7'));module[_0x6a25('0x8')]=function(_0x2650d6,_0x19f251){return _0x2650d6[_0x6a25('0x9')](_0x6a25('0xa'),attributes,{'tableName':_0x6a25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 83ce478..165f655 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 _0xaf6f=['rpc','../../config/environment','jayson/promise','client','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3ccc44,_0x207b0c){var _0x5d74bb=function(_0x59989a){while(--_0x59989a){_0x3ccc44['push'](_0x3ccc44['shift']());}};_0x5d74bb(++_0x207b0c);}(_0xaf6f,0x7e));var _0xfaf6=function(_0x615438,_0x83e83){_0x615438=_0x615438-0x0;var _0x7f1b53=_0xaf6f[_0x615438];return _0x7f1b53;};'use strict';var _=require(_0xfaf6('0x0'));var util=require(_0xfaf6('0x1'));var moment=require('moment');var BPromise=require(_0xfaf6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfaf6('0x3'));var db=require(_0xfaf6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaf6('0x5'))(_0xfaf6('0x6'));var config=require(_0xfaf6('0x7'));var jayson=require(_0xfaf6('0x8'));var client=jayson[_0xfaf6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180bcb,_0x31687b,_0x9a9c6c){return new BPromise(function(_0x6744c4,_0x11551e){return client['request'](_0x180bcb,_0x9a9c6c)[_0xfaf6('0xa')](function(_0x4c0e32){logger[_0xfaf6('0xb')](_0xfaf6('0xc'),_0x31687b,_0xfaf6('0xd'));logger[_0xfaf6('0xe')](_0xfaf6('0xf'),_0x31687b,_0xfaf6('0xd'),JSON[_0xfaf6('0x10')](_0x4c0e32));if(_0x4c0e32['error']){if(_0x4c0e32[_0xfaf6('0x11')][_0xfaf6('0x12')]===0x1f4){logger[_0xfaf6('0x11')](_0xfaf6('0xc'),_0x31687b,_0x4c0e32[_0xfaf6('0x11')][_0xfaf6('0x13')]);return _0x11551e(_0x4c0e32['error'][_0xfaf6('0x13')]);}logger[_0xfaf6('0x11')](_0xfaf6('0xc'),_0x31687b,_0x4c0e32[_0xfaf6('0x11')][_0xfaf6('0x13')]);return _0x6744c4(_0x4c0e32[_0xfaf6('0x11')][_0xfaf6('0x13')]);}else{logger[_0xfaf6('0xb')](_0xfaf6('0xc'),_0x31687b,'request\x20sent');_0x6744c4(_0x4c0e32[_0xfaf6('0x14')][_0xfaf6('0x13')]);}})[_0xfaf6('0x15')](function(_0x3c8b04){logger[_0xfaf6('0x11')](_0xfaf6('0xc'),_0x31687b,_0x3c8b04);_0x11551e(_0x3c8b04);});});} \ No newline at end of file +var _0x70cf=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x416728,_0x286fd8){var _0x4204d1=function(_0x38efaa){while(--_0x38efaa){_0x416728['push'](_0x416728['shift']());}};_0x4204d1(++_0x286fd8);}(_0x70cf,0x158));var _0xf70c=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x70cf[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0xf70c('0x0'));var util=require('util');var moment=require(_0xf70c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf70c('0x2'));var db=require(_0xf70c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf70c('0x4'))(_0xf70c('0x5'));var config=require(_0xf70c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf70c('0x7')][_0xf70c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x297faa,_0x26d638,_0x2a6d85){return new BPromise(function(_0x176d2a,_0x4df111){return client[_0xf70c('0x9')](_0x297faa,_0x2a6d85)[_0xf70c('0xa')](function(_0x4e3582){logger[_0xf70c('0xb')](_0xf70c('0xc'),_0x26d638,_0xf70c('0xd'));logger[_0xf70c('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x26d638,_0xf70c('0xd'),JSON[_0xf70c('0xf')](_0x4e3582));if(_0x4e3582[_0xf70c('0x10')]){if(_0x4e3582[_0xf70c('0x10')][_0xf70c('0x11')]===0x1f4){logger[_0xf70c('0x10')]('Condition,\x20%s,\x20%s',_0x26d638,_0x4e3582['error'][_0xf70c('0x12')]);return _0x4df111(_0x4e3582[_0xf70c('0x10')][_0xf70c('0x12')]);}logger['error'](_0xf70c('0xc'),_0x26d638,_0x4e3582[_0xf70c('0x10')][_0xf70c('0x12')]);return _0x176d2a(_0x4e3582[_0xf70c('0x10')][_0xf70c('0x12')]);}else{logger[_0xf70c('0xb')](_0xf70c('0xc'),_0x26d638,_0xf70c('0xd'));_0x176d2a(_0x4e3582[_0xf70c('0x13')]['message']);}})[_0xf70c('0x14')](function(_0x540a9e){logger['error'](_0xf70c('0xc'),_0x26d638,_0x540a9e);_0x4df111(_0x540a9e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3b5e935..b051211 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 _0xcf5f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x184438,_0x3ea61c){var _0x1f2c93=function(_0x5ed587){while(--_0x5ed587){_0x184438['push'](_0x184438['shift']());}};_0x1f2c93(++_0x3ea61c);}(_0xcf5f,0x82));var _0xfcf5=function(_0x4349a7,_0x8ad8a7){_0x4349a7=_0x4349a7-0x0;var _0x1db191=_0xcf5f[_0x4349a7];return _0x1db191;};'use strict';var multer=require(_0xfcf5('0x0'));var util=require(_0xfcf5('0x1'));var path=require(_0xfcf5('0x2'));var timeout=require(_0xfcf5('0x3'));var express=require('express');var router=express[_0xfcf5('0x4')]();var fs_extra=require(_0xfcf5('0x5'));var auth=require(_0xfcf5('0x6'));var interaction=require(_0xfcf5('0x7'));var config=require(_0xfcf5('0x8'));var controller=require(_0xfcf5('0x9'));router[_0xfcf5('0xa')]('/:id',auth[_0xfcf5('0xb')](),controller[_0xfcf5('0xc')]);router['delete']('/:id',auth[_0xfcf5('0xb')](),controller[_0xfcf5('0xd')]);module[_0xfcf5('0xe')]=router; \ No newline at end of file +var _0x34fc=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','delete','multer'];(function(_0x2d86f2,_0x5e1b5c){var _0x4d2124=function(_0x4b6c2f){while(--_0x4b6c2f){_0x2d86f2['push'](_0x2d86f2['shift']());}};_0x4d2124(++_0x5e1b5c);}(_0x34fc,0xd7));var _0xc34f=function(_0x19677a,_0x5a5a53){_0x19677a=_0x19677a-0x0;var _0x5895aa=_0x34fc[_0x19677a];return _0x5895aa;};'use strict';var multer=require(_0xc34f('0x0'));var util=require(_0xc34f('0x1'));var path=require(_0xc34f('0x2'));var timeout=require(_0xc34f('0x3'));var express=require('express');var router=express[_0xc34f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc34f('0x5'));var interaction=require(_0xc34f('0x6'));var config=require(_0xc34f('0x7'));var controller=require('./condition.controller');router[_0xc34f('0x8')](_0xc34f('0x9'),auth[_0xc34f('0xa')](),controller['update']);router[_0xc34f('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index ab840ed..617daaf 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 _0x091c=['STRING','INTEGER','exports'];(function(_0x44960d,_0x27ab5f){var _0x370dbf=function(_0x1a8098){while(--_0x1a8098){_0x44960d['push'](_0x44960d['shift']());}};_0x370dbf(++_0x27ab5f);}(_0x091c,0x1af));var _0xc091=function(_0x40dd31,_0x4a887a){_0x40dd31=_0x40dd31-0x0;var _0x2da8de=_0x091c[_0x40dd31];return _0x2da8de;};'use strict';var Sequelize=require('sequelize');module[_0xc091('0x0')]={'name':{'type':Sequelize[_0xc091('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xc091('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc091('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xad13=['INTEGER','sequelize','STRING','name'];(function(_0x2351fe,_0x3d5327){var _0x98f64c=function(_0x540471){while(--_0x540471){_0x2351fe['push'](_0x2351fe['shift']());}};_0x98f64c(++_0x3d5327);}(_0xad13,0x79));var _0x3ad1=function(_0x101951,_0x42317d){_0x101951=_0x101951-0x0;var _0x114fd2=_0xad13[_0x101951];return _0x114fd2;};'use strict';var Sequelize=require(_0x3ad1('0x0'));module['exports']={'name':{'type':Sequelize[_0x3ad1('0x1')],'allowNull':![],'unique':_0x3ad1('0x2')},'OrderBy':{'type':Sequelize[_0x3ad1('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3ad1('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 6e7fc46..392e291 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 _0x1399=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName'];(function(_0x1b6d4a,_0x2d0bdc){var _0x55e0c4=function(_0x59c1d5){while(--_0x59c1d5){_0x1b6d4a['push'](_0x1b6d4a['shift']());}};_0x55e0c4(++_0x2d0bdc);}(_0x1399,0x16c));var _0x9139=function(_0x151002,_0x1c9af6){_0x151002=_0x151002-0x0;var _0x1a7a58=_0x1399[_0x151002];return _0x1a7a58;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){var _0x31c22d=_0x1a7350['get']({'plain':!![]});var _0x3ed4da=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x3ed4da,'resourceId':_0x31c22d['id']}})[_0x9139('0x22')](function(){return _0x1a7350;});})[_0x9139('0x22')](function(){_0x1aee3b['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x39e8cf,_0x452d9a){return function(_0x55e95f){if(!_0x55e95f){_0x39e8cf[_0x9139('0x25')](0x194);}return _0x55e95f;};}function handleError(_0x22e11e,_0x2a35fd){_0x2a35fd=_0x2a35fd||0x1f4;return function(_0x22994c){logger[_0x9139('0x26')](_0x22994c[_0x9139('0x27')]);if(_0x22994c[_0x9139('0x28')]){delete _0x22994c['name'];}_0x22e11e['status'](_0x2a35fd)[_0x9139('0x29')](_0x22994c);};}exports[_0x9139('0x2a')]=function(_0xd27355,_0x4c1693){var _0x50d545={},_0x24e8d5={},_0x2118a2={'count':0x0,'rows':[]};var _0x2dff49=_[_0x9139('0x2b')](db[_0x9139('0x2c')]['rawAttributes'],function(_0x5a1673){return{'name':_0x5a1673[_0x9139('0x2d')],'type':_0x5a1673['type']['key']};});_0x24e8d5[_0x9139('0x2e')]=_[_0x9139('0x2b')](_0x2dff49,'name');_0x24e8d5[_0x9139('0x2f')]=_[_0x9139('0x30')](_0xd27355['query']);_0x24e8d5[_0x9139('0x31')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],_0x24e8d5[_0x9139('0x2f')]);_0x50d545[_0x9139('0x33')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],qs[_0x9139('0x34')](_0xd27355[_0x9139('0x2f')][_0x9139('0x34')]));_0x50d545[_0x9139('0x33')]=_0x50d545['attributes'][_0x9139('0x35')]?_0x50d545[_0x9139('0x33')]:_0x24e8d5['model'];if(!_0xd27355[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x50d545['limit']=qs[_0x9139('0x1a')](_0xd27355[_0x9139('0x2f')][_0x9139('0x1a')]);_0x50d545[_0x9139('0x18')]=qs[_0x9139('0x18')](_0xd27355[_0x9139('0x2f')][_0x9139('0x18')]);}_0x50d545[_0x9139('0x38')]=qs[_0x9139('0x39')](_0xd27355[_0x9139('0x2f')]['sort']);_0x50d545[_0x9139('0x3a')]=qs[_0x9139('0x31')](_[_0x9139('0x3b')](_0xd27355[_0x9139('0x2f')],_0x24e8d5[_0x9139('0x31')]),_0x2dff49);if(_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]){_0x50d545['where']=_[_0x9139('0x3d')](_0x50d545['where'],{'$or':_[_0x9139('0x2b')](_0x2dff49,function(_0x11789e){if(_0x11789e[_0x9139('0x3e')]!=='VIRTUAL'){var _0x1228b6={};_0x1228b6[_0x11789e[_0x9139('0x28')]]={'$like':'%'+_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x1228b6;}})});}_0x50d545=_[_0x9139('0x3d')]({},_0x50d545,_0xd27355[_0x9139('0x3f')]);var _0x3c98a4={'where':_0x50d545[_0x9139('0x3a')]};return db[_0x9139('0x2c')][_0x9139('0x40')](_0x3c98a4)['then'](function(_0xf14393){_0x2118a2[_0x9139('0x40')]=_0xf14393;if(_0xd27355[_0x9139('0x2f')]['includeAll']){_0x50d545['include']=[{'all':!![]}];}return db['ContactItemType'][_0x9139('0x41')](_0x50d545);})[_0x9139('0x22')](function(_0x3611b4){_0x2118a2[_0x9139('0x42')]=_0x3611b4;return _0x2118a2;})[_0x9139('0x22')](respondWithFilteredResult(_0x4c1693,_0x50d545))['catch'](handleError(_0x4c1693,null));};exports[_0x9139('0x43')]=function(_0x2f3ed4,_0x40fd52){var _0xf81f77={'raw':!![],'where':{'id':_0x2f3ed4['params']['id']}},_0x2197ff={};_0x2197ff[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2197ff['query']=_['keys'](_0x2f3ed4[_0x9139('0x2f')]);_0x2197ff[_0x9139('0x31')]=_['intersection'](_0x2197ff['model'],_0x2197ff[_0x9139('0x2f')]);_0xf81f77[_0x9139('0x33')]=_['intersection'](_0x2197ff[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2f3ed4['query'][_0x9139('0x34')]));_0xf81f77['attributes']=_0xf81f77['attributes'][_0x9139('0x35')]?_0xf81f77[_0x9139('0x33')]:_0x2197ff[_0x9139('0x2e')];if(_0x2f3ed4[_0x9139('0x2f')][_0x9139('0x45')]){_0xf81f77['include']=[{'all':!![]}];}_0xf81f77=_[_0x9139('0x3d')]({},_0xf81f77,_0x2f3ed4[_0x9139('0x3f')]);return db[_0x9139('0x2c')]['find'](_0xf81f77)[_0x9139('0x22')](handleEntityNotFound(_0x40fd52,null))[_0x9139('0x22')](respondWithResult(_0x40fd52,null))[_0x9139('0x46')](handleError(_0x40fd52,null));};exports[_0x9139('0x47')]=function(_0x215793,_0x31395f){return db[_0x9139('0x2c')][_0x9139('0x47')](_0x215793[_0x9139('0x48')],{})[_0x9139('0x22')](function(_0x2da28c){var _0x54c926=_0x215793[_0x9139('0x49')][_0x9139('0x4a')]({'plain':!![]});if(!_0x54c926)throw new Error(_0x9139('0x4b'));if(_0x54c926['role']===_0x9139('0x49')){var _0x46f77a=_0x2da28c['get']({'plain':!![]});var _0x2f4a6f=_0x9139('0x23');return db[_0x9139('0x4c')]['find']({'where':{'name':_0x2f4a6f,'userProfileId':_0x54c926[_0x9139('0x4d')]},'raw':!![]})[_0x9139('0x22')](function(_0x1404ce){if(_0x1404ce&&_0x1404ce[_0x9139('0x4e')]===0x0){return db['UserProfileResource'][_0x9139('0x47')]({'name':_0x46f77a[_0x9139('0x28')],'resourceId':_0x46f77a['id'],'type':_0x1404ce[_0x9139('0x28')],'sectionId':_0x1404ce['id']},{})['then'](function(){return _0x2da28c;});}else{return _0x2da28c;}})[_0x9139('0x46')](function(_0x146201){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x146201);throw _0x146201;});}return _0x2da28c;})[_0x9139('0x22')](respondWithResult(_0x31395f,0xc9))[_0x9139('0x46')](handleError(_0x31395f,null));};exports[_0x9139('0x21')]=function(_0x5857bf,_0x35002d){if(_0x5857bf[_0x9139('0x48')]['id']){delete _0x5857bf['body']['id'];}return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x5857bf[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x35002d,null))[_0x9139('0x22')](saveUpdates(_0x5857bf['body'],null))[_0x9139('0x22')](respondWithResult(_0x35002d,null))[_0x9139('0x46')](handleError(_0x35002d,null));};exports['destroy']=function(_0x500863,_0x212d56){return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x500863['params']['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x212d56,null))['then'](db['CmContactHasItem'][_0x9139('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x500863[_0x9139('0x51')]['id']}}))[_0x9139('0x22')](removeEntity(_0x212d56,null))[_0x9139('0x46')](handleError(_0x212d56,null));}; \ No newline at end of file +var _0x6d11=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x2f9d3e,_0x29345f){var _0x32d8e6=function(_0x9f63fc){while(--_0x9f63fc){_0x2f9d3e['push'](_0x2f9d3e['shift']());}};_0x32d8e6(++_0x29345f);}(_0x6d11,0xbf));var _0x16d1=function(_0x3bbdc6,_0x262329){_0x3bbdc6=_0x3bbdc6-0x0;var _0x50a293=_0x6d11[_0x3bbdc6];return _0x50a293;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){var _0x21e122=_0x215c23[_0x16d1('0x24')]({'plain':!![]});var _0x335c24=_0x16d1('0x25');return db[_0x16d1('0x26')][_0x16d1('0x23')]({'where':{'type':_0x335c24,'resourceId':_0x21e122['id']}})[_0x16d1('0x22')](function(){return _0x215c23;});})[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae4e,_0x440a47){return function(_0x4257f1){if(!_0x4257f1){_0x25ae4e['sendStatus'](0x194);}return _0x4257f1;};}function handleError(_0x28837c,_0x1deb1e){_0x1deb1e=_0x1deb1e||0x1f4;return function(_0x364bf7){logger[_0x16d1('0x27')](_0x364bf7[_0x16d1('0x28')]);if(_0x364bf7[_0x16d1('0x29')]){delete _0x364bf7[_0x16d1('0x29')];}_0x28837c['status'](_0x1deb1e)[_0x16d1('0x2a')](_0x364bf7);};}exports[_0x16d1('0x2b')]=function(_0x31c4e9,_0x30cd8f){var _0x55c021={},_0x4b27f6={},_0x2f16ee={'count':0x0,'rows':[]};var _0x4ab3d4=_[_0x16d1('0x2c')](db[_0x16d1('0x2d')][_0x16d1('0x2e')],function(_0x2b4dbd){return{'name':_0x2b4dbd[_0x16d1('0x2f')],'type':_0x2b4dbd[_0x16d1('0x30')][_0x16d1('0x31')]};});_0x4b27f6[_0x16d1('0x32')]=_[_0x16d1('0x2c')](_0x4ab3d4,_0x16d1('0x29'));_0x4b27f6[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x31c4e9['query']);_0x4b27f6[_0x16d1('0x35')]=_['intersection'](_0x4b27f6[_0x16d1('0x32')],_0x4b27f6[_0x16d1('0x33')]);_0x55c021[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x4b27f6[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x31c4e9['query']['fields']));_0x55c021['attributes']=_0x55c021[_0x16d1('0x36')][_0x16d1('0x39')]?_0x55c021[_0x16d1('0x36')]:_0x4b27f6[_0x16d1('0x32')];if(!_0x31c4e9['query'][_0x16d1('0x3a')](_0x16d1('0x3b'))){_0x55c021['limit']=qs['limit'](_0x31c4e9['query'][_0x16d1('0x1f')]);_0x55c021[_0x16d1('0x1d')]=qs[_0x16d1('0x1d')](_0x31c4e9['query'][_0x16d1('0x1d')]);}_0x55c021[_0x16d1('0x3c')]=qs[_0x16d1('0x3d')](_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3d')]);_0x55c021[_0x16d1('0x3e')]=qs[_0x16d1('0x35')](_['pick'](_0x31c4e9['query'],_0x4b27f6['filters']),_0x4ab3d4);if(_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3f')]){_0x55c021[_0x16d1('0x3e')]=_[_0x16d1('0x40')](_0x55c021[_0x16d1('0x3e')],{'$or':_[_0x16d1('0x2c')](_0x4ab3d4,function(_0x364c39){if(_0x364c39[_0x16d1('0x30')]!=='VIRTUAL'){var _0x180f55={};_0x180f55[_0x364c39['name']]={'$like':'%'+_0x31c4e9['query'][_0x16d1('0x3f')]+'%'};return _0x180f55;}})});}_0x55c021=_[_0x16d1('0x40')]({},_0x55c021,_0x31c4e9[_0x16d1('0x41')]);var _0x3a0343={'where':_0x55c021[_0x16d1('0x3e')]};return db[_0x16d1('0x2d')]['count'](_0x3a0343)[_0x16d1('0x22')](function(_0x525212){_0x2f16ee['count']=_0x525212;if(_0x31c4e9['query']['includeAll']){_0x55c021[_0x16d1('0x42')]=[{'all':!![]}];}return db[_0x16d1('0x2d')][_0x16d1('0x43')](_0x55c021);})[_0x16d1('0x22')](function(_0x53de06){_0x2f16ee[_0x16d1('0x44')]=_0x53de06;return _0x2f16ee;})['then'](respondWithFilteredResult(_0x30cd8f,_0x55c021))[_0x16d1('0x45')](handleError(_0x30cd8f,null));};exports[_0x16d1('0x46')]=function(_0x19ac7c,_0x2e4971){var _0x1a109d={'raw':!![],'where':{'id':_0x19ac7c[_0x16d1('0x47')]['id']}},_0x116f51={};_0x116f51[_0x16d1('0x32')]=_[_0x16d1('0x34')](db[_0x16d1('0x2d')][_0x16d1('0x2e')]);_0x116f51[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x19ac7c[_0x16d1('0x33')]);_0x116f51[_0x16d1('0x35')]=_['intersection'](_0x116f51['model'],_0x116f51[_0x16d1('0x33')]);_0x1a109d[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x116f51[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x19ac7c[_0x16d1('0x33')]['fields']));_0x1a109d[_0x16d1('0x36')]=_0x1a109d[_0x16d1('0x36')][_0x16d1('0x39')]?_0x1a109d['attributes']:_0x116f51['model'];if(_0x19ac7c[_0x16d1('0x33')][_0x16d1('0x48')]){_0x1a109d['include']=[{'all':!![]}];}_0x1a109d=_[_0x16d1('0x40')]({},_0x1a109d,_0x19ac7c['options']);return db[_0x16d1('0x2d')][_0x16d1('0x49')](_0x1a109d)[_0x16d1('0x22')](handleEntityNotFound(_0x2e4971,null))[_0x16d1('0x22')](respondWithResult(_0x2e4971,null))['catch'](handleError(_0x2e4971,null));};exports['create']=function(_0x1d92cd,_0x8bb0c1){return db['ContactItemType'][_0x16d1('0x4a')](_0x1d92cd[_0x16d1('0x4b')],{})[_0x16d1('0x22')](function(_0x117da5){var _0x3b77db=_0x1d92cd['user'][_0x16d1('0x24')]({'plain':!![]});if(!_0x3b77db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b77db[_0x16d1('0x4c')]===_0x16d1('0x4d')){var _0x5d384c=_0x117da5[_0x16d1('0x24')]({'plain':!![]});var _0xd3a7f8=_0x16d1('0x25');return db[_0x16d1('0x4e')]['find']({'where':{'name':_0xd3a7f8,'userProfileId':_0x3b77db['userProfileId']},'raw':!![]})['then'](function(_0x34e266){if(_0x34e266&&_0x34e266[_0x16d1('0x4f')]===0x0){return db[_0x16d1('0x26')][_0x16d1('0x4a')]({'name':_0x5d384c['name'],'resourceId':_0x5d384c['id'],'type':_0x34e266[_0x16d1('0x29')],'sectionId':_0x34e266['id']},{})[_0x16d1('0x22')](function(){return _0x117da5;});}else{return _0x117da5;}})['catch'](function(_0x1e1bbc){logger[_0x16d1('0x27')](_0x16d1('0x50'),_0x1e1bbc);throw _0x1e1bbc;});}return _0x117da5;})[_0x16d1('0x22')](respondWithResult(_0x8bb0c1,0xc9))['catch'](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x51')]=function(_0x2b0aa7,_0xb9fb43){if(_0x2b0aa7['body']['id']){delete _0x2b0aa7['body']['id'];}return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x2b0aa7['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0xb9fb43,null))[_0x16d1('0x22')](saveUpdates(_0x2b0aa7[_0x16d1('0x4b')],null))['then'](respondWithResult(_0xb9fb43,null))[_0x16d1('0x45')](handleError(_0xb9fb43,null));};exports[_0x16d1('0x23')]=function(_0x11209f,_0x4b3079){return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x11209f['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x4b3079,null))[_0x16d1('0x22')](db['CmContactHasItem'][_0x16d1('0x51')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x11209f[_0x16d1('0x47')]['id']}}))[_0x16d1('0x22')](removeEntity(_0x4b3079,null))[_0x16d1('0x45')](handleError(_0x4b3079,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 3674f5d..353e09f 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 _0xc222=['util','moment','bluebird','rimraf','../../config/environment','exports','ContactItemType','tools_contact_item_types','lodash'];(function(_0x1c2c21,_0x44c147){var _0x359c41=function(_0x4c8207){while(--_0x4c8207){_0x1c2c21['push'](_0x1c2c21['shift']());}};_0x359c41(++_0x44c147);}(_0xc222,0x194));var _0x2c22=function(_0x48f4fb,_0x2d5e58){_0x48f4fb=_0x48f4fb-0x0;var _0x47e4cf=_0xc222[_0x48f4fb];return _0x47e4cf;};'use strict';var _=require(_0x2c22('0x0'));var util=require(_0x2c22('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2c22('0x2'));var BPromise=require(_0x2c22('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2c22('0x4'));var config=require(_0x2c22('0x5'));var attributes=require('./contactItemType.attributes');module[_0x2c22('0x6')]=function(_0x2f7b5c,_0xf3cee0){return _0x2f7b5c['define'](_0x2c22('0x7'),attributes,{'tableName':_0x2c22('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa196=['bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x4287fe,_0x14ad49){var _0x329a39=function(_0x3c30a9){while(--_0x3c30a9){_0x4287fe['push'](_0x4287fe['shift']());}};_0x329a39(++_0x14ad49);}(_0xa196,0x1f0));var _0x6a19=function(_0x2b1b6e,_0x5703bb){_0x2b1b6e=_0x2b1b6e-0x0;var _0xc8f810=_0xa196[_0x2b1b6e];return _0xc8f810;};'use strict';var _=require(_0x6a19('0x0'));var util=require(_0x6a19('0x1'));var logger=require(_0x6a19('0x2'))(_0x6a19('0x3'));var moment=require('moment');var BPromise=require(_0x6a19('0x4'));var rp=require(_0x6a19('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a19('0x6'));var config=require(_0x6a19('0x7'));var attributes=require(_0x6a19('0x8'));module[_0x6a19('0x9')]=function(_0x40bba7,_0xa55607){return _0x40bba7['define']('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index e61f215..d16a492 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 _0x766f=['then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request'];(function(_0x1b34dc,_0x514cf8){var _0x136e3e=function(_0x191c5a){while(--_0x191c5a){_0x1b34dc['push'](_0x1b34dc['shift']());}};_0x136e3e(++_0x514cf8);}(_0x766f,0x14f));var _0xf766=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x766f[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf766('0x0'));var fs=require('fs');var Redis=require(_0xf766('0x1'));var db=require(_0xf766('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf766('0x3'));var config=require(_0xf766('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf766('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2284f8,_0x1d394d,_0x4e283a){return new BPromise(function(_0x3c48b1,_0x577129){return client[_0xf766('0x6')](_0x2284f8,_0x4e283a)[_0xf766('0x7')](function(_0x59142d){logger['info'](_0xf766('0x8'),_0x1d394d,_0xf766('0x9'));logger[_0xf766('0xa')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1d394d,_0xf766('0x9'),JSON[_0xf766('0xb')](_0x59142d));if(_0x59142d[_0xf766('0xc')]){if(_0x59142d[_0xf766('0xc')][_0xf766('0xd')]===0x1f4){logger[_0xf766('0xc')](_0xf766('0x8'),_0x1d394d,_0x59142d[_0xf766('0xc')]['message']);return _0x577129(_0x59142d['error'][_0xf766('0xe')]);}logger[_0xf766('0xc')](_0xf766('0x8'),_0x1d394d,_0x59142d[_0xf766('0xc')][_0xf766('0xe')]);return _0x3c48b1(_0x59142d['error'][_0xf766('0xe')]);}else{logger[_0xf766('0xf')](_0xf766('0x8'),_0x1d394d,'request\x20sent');_0x3c48b1(_0x59142d[_0xf766('0x10')]['message']);}})[_0xf766('0x11')](function(_0x19350d){logger[_0xf766('0xc')](_0xf766('0x8'),_0x1d394d,_0x19350d);_0x577129(_0x19350d);});});} \ No newline at end of file +var _0x08ff=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x271e94,_0x3f0a3c){var _0x4ff072=function(_0xc3d40a){while(--_0xc3d40a){_0x271e94['push'](_0x271e94['shift']());}};_0x4ff072(++_0x3f0a3c);}(_0x08ff,0x72));var _0xf08f=function(_0x41e393,_0x35417e){_0x41e393=_0x41e393-0x0;var _0x27db09=_0x08ff[_0x41e393];return _0x27db09;};'use strict';var _=require(_0xf08f('0x0'));var util=require(_0xf08f('0x1'));var moment=require(_0xf08f('0x2'));var BPromise=require(_0xf08f('0x3'));var rs=require(_0xf08f('0x4'));var fs=require('fs');var Redis=require(_0xf08f('0x5'));var db=require(_0xf08f('0x6'))['db'];var utils=require(_0xf08f('0x7'));var logger=require('../../config/logger')(_0xf08f('0x8'));var config=require(_0xf08f('0x9'));var jayson=require(_0xf08f('0xa'));var client=jayson[_0xf08f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54f3e3,_0x3e73b6,_0x423606){return new BPromise(function(_0x61cf64,_0x2679b6){return client[_0xf08f('0xc')](_0x54f3e3,_0x423606)[_0xf08f('0xd')](function(_0x202f7a){logger[_0xf08f('0xe')](_0xf08f('0xf'),_0x3e73b6,'request\x20sent');logger['debug'](_0xf08f('0x10'),_0x3e73b6,_0xf08f('0x11'),JSON[_0xf08f('0x12')](_0x202f7a));if(_0x202f7a[_0xf08f('0x13')]){if(_0x202f7a[_0xf08f('0x13')][_0xf08f('0x14')]===0x1f4){logger[_0xf08f('0x13')](_0xf08f('0xf'),_0x3e73b6,_0x202f7a[_0xf08f('0x13')]['message']);return _0x2679b6(_0x202f7a['error'][_0xf08f('0x15')]);}logger['error'](_0xf08f('0xf'),_0x3e73b6,_0x202f7a[_0xf08f('0x13')]['message']);return _0x61cf64(_0x202f7a[_0xf08f('0x13')][_0xf08f('0x15')]);}else{logger[_0xf08f('0xe')](_0xf08f('0xf'),_0x3e73b6,_0xf08f('0x11'));_0x61cf64(_0x202f7a[_0xf08f('0x16')]['message']);}})['catch'](function(_0x5ce845){logger[_0xf08f('0x13')]('ContactItemType,\x20%s,\x20%s',_0x3e73b6,_0x5ce845);_0x2679b6(_0x5ce845);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 556d06e..0037285 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 _0x4c7a=['path','express','Router','fs-extra','../../components/interaction/service','./contactItemType.controller','get','/:id','isAuthenticated','put','exports','multer','util'];(function(_0x31f5ec,_0x4106ee){var _0x44eee0=function(_0x21bc95){while(--_0x21bc95){_0x31f5ec['push'](_0x31f5ec['shift']());}};_0x44eee0(++_0x4106ee);}(_0x4c7a,0x19e));var _0xa4c7=function(_0x4eb179,_0x311360){_0x4eb179=_0x4eb179-0x0;var _0x547d07=_0x4c7a[_0x4eb179];return _0x547d07;};'use strict';var multer=require(_0xa4c7('0x0'));var util=require(_0xa4c7('0x1'));var path=require(_0xa4c7('0x2'));var timeout=require('connect-timeout');var express=require(_0xa4c7('0x3'));var router=express[_0xa4c7('0x4')]();var fs_extra=require(_0xa4c7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa4c7('0x6'));var config=require('../../config/environment');var controller=require(_0xa4c7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa4c7('0x8')](_0xa4c7('0x9'),auth[_0xa4c7('0xa')](),controller['show']);router['post']('/',auth[_0xa4c7('0xa')](),controller['create']);router[_0xa4c7('0xb')](_0xa4c7('0x9'),auth[_0xa4c7('0xa')](),controller['update']);router['delete'](_0xa4c7('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa4c7('0xc')]=router; \ No newline at end of file +var _0x61b6=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x26ec0e,_0x55d2e3){var _0x4da538=function(_0x2aecf0){while(--_0x2aecf0){_0x26ec0e['push'](_0x26ec0e['shift']());}};_0x4da538(++_0x55d2e3);}(_0x61b6,0x18d));var _0x661b=function(_0x1cbac5,_0x4647d1){_0x1cbac5=_0x1cbac5-0x0;var _0x45d333=_0x61b6[_0x1cbac5];return _0x45d333;};'use strict';var multer=require(_0x661b('0x0'));var util=require(_0x661b('0x1'));var path=require(_0x661b('0x2'));var timeout=require(_0x661b('0x3'));var express=require(_0x661b('0x4'));var router=express['Router']();var fs_extra=require(_0x661b('0x5'));var auth=require(_0x661b('0x6'));var interaction=require(_0x661b('0x7'));var config=require('../../config/environment');var controller=require(_0x661b('0x8'));router[_0x661b('0x9')]('/',auth[_0x661b('0xa')](),controller[_0x661b('0xb')]);router[_0x661b('0x9')](_0x661b('0xc'),auth['isAuthenticated'](),controller[_0x661b('0xd')]);router[_0x661b('0xe')]('/',auth[_0x661b('0xa')](),controller['create']);router[_0x661b('0xf')]('/:id',auth[_0x661b('0xa')](),controller[_0x661b('0x10')]);router[_0x661b('0x11')]('/:id',auth[_0x661b('0xa')](),controller[_0x661b('0x12')]);module[_0x661b('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 09672d3..0474803 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x5c35f1,_0x4a72b4){var _0x53e5b5=function(_0x3bdb78){while(--_0x3bdb78){_0x5c35f1['push'](_0x5c35f1['shift']());}};_0x53e5b5(++_0x4a72b4);}(_0x757a,0xde));var _0xa757=function(_0x54ed8f,_0x55782c){_0x54ed8f=_0x54ed8f-0x0;var _0x408c0d=_0x757a[_0x54ed8f];return _0x408c0d;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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 cd62630..9b3513c 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 _0x1d9b=['attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','total','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','length','pick','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','CustomDashboards','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Dashboard','include','rows','catch','show','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','UserProfileSection','userProfileId','error','destroy','attrUrl','attrs','value','custom'];(function(_0x5d2214,_0x3bdb78){var _0x5410f5=function(_0x458db3){while(--_0x458db3){_0x5d2214['push'](_0x5d2214['shift']());}};_0x5410f5(++_0x3bdb78);}(_0x1d9b,0x19d));var _0xb1d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d9b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb1d9('0x0'));var rimraf=require(_0xb1d9('0x1'));var zipdir=require(_0xb1d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1d9('0x3'));var moment=require(_0xb1d9('0x4'));var BPromise=require(_0xb1d9('0x5'));var Mustache=require(_0xb1d9('0x6'));var util=require(_0xb1d9('0x7'));var path=require('path');var sox=require(_0xb1d9('0x8'));var csv=require('to-csv');var ejs=require(_0xb1d9('0x9'));var fs=require('fs');var fs_extra=require(_0xb1d9('0xa'));var _=require(_0xb1d9('0xb'));var squel=require(_0xb1d9('0xc'));var crypto=require(_0xb1d9('0xd'));var jsforce=require(_0xb1d9('0xe'));var deskjs=require(_0xb1d9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb1d9('0x10'));var Papa=require('papaparse');var Redis=require(_0xb1d9('0x11'));var authService=require(_0xb1d9('0x12'));var qs=require(_0xb1d9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1d9('0x14'));var logger=require(_0xb1d9('0x15'))('api');var utils=require(_0xb1d9('0x16'));var config=require(_0xb1d9('0x17'));var licenseUtil=require(_0xb1d9('0x18'));var db=require(_0xb1d9('0x19'))['db'];config[_0xb1d9('0x1a')]=_[_0xb1d9('0x1b')](config[_0xb1d9('0x1a')],{'host':_0xb1d9('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1d9('0x1a')]));require('./dashboard.socket')[_0xb1d9('0x1d')](socket);function respondWithStatusCode(_0x29e032,_0x539aa0){_0x539aa0=_0x539aa0||0xcc;return function(_0x537ffb){if(_0x537ffb){return _0x29e032[_0xb1d9('0x1e')](_0x539aa0);}return _0x29e032['status'](_0x539aa0)[_0xb1d9('0x1f')]();};}function respondWithResult(_0x167155,_0x4a03c0){_0x4a03c0=_0x4a03c0||0xc8;return function(_0x153938){if(_0x153938){return _0x167155[_0xb1d9('0x20')](_0x4a03c0)['json'](_0x153938);}};}function respondWithFilteredResult(_0x4906a4,_0x681b77){return function(_0x1e3175){if(_0x1e3175){var _0x81e4c9=typeof _0x681b77[_0xb1d9('0x21')]===_0xb1d9('0x22')&&typeof _0x681b77[_0xb1d9('0x23')]===_0xb1d9('0x22');var _0x1ba04e=_0x1e3175[_0xb1d9('0x24')];var _0x2c3a43=_0x81e4c9?0x0:_0x681b77[_0xb1d9('0x21')];var _0x2aca4b=_0x81e4c9?_0x1e3175[_0xb1d9('0x24')]:_0x681b77[_0xb1d9('0x21')]+_0x681b77[_0xb1d9('0x23')];var _0x4bacca;if(_0x2aca4b>=_0x1ba04e){_0x2aca4b=_0x1ba04e;_0x4bacca=0xc8;}else{_0x4bacca=0xce;}_0x4906a4[_0xb1d9('0x20')](_0x4bacca);return _0x4906a4[_0xb1d9('0x25')](_0xb1d9('0x26'),_0x2c3a43+'-'+_0x2aca4b+'/'+_0x1ba04e)[_0xb1d9('0x27')](_0x1e3175);}return null;};}function patchUpdates(_0x5f8c65){return function(_0x586e0d){try{jsonpatch[_0xb1d9('0x28')](_0x586e0d,_0x5f8c65,!![]);}catch(_0x1db030){return BPromise[_0xb1d9('0x29')](_0x1db030);}return _0x586e0d['save']();};}function saveUpdates(_0x341da2,_0x3b355b){return function(_0x1384cf){if(_0x1384cf){return _0x1384cf[_0xb1d9('0x2a')](_0x341da2)[_0xb1d9('0x2b')](function(_0x150c8e){return _0x150c8e;});}return null;};}function removeEntity(_0x222ffc,_0x3e361a){return function(_0x5a4858){if(_0x5a4858){return _0x5a4858['destroy']()[_0xb1d9('0x2b')](function(){var _0x33825a=_0x5a4858['get']({'plain':!![]});var _0x352232=_0xb1d9('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x352232,'resourceId':_0x33825a['id']}})[_0xb1d9('0x2b')](function(){return _0x5a4858;});})[_0xb1d9('0x2b')](function(){_0x222ffc[_0xb1d9('0x20')](0xcc)[_0xb1d9('0x1f')]();});}};}function handleEntityNotFound(_0x57d980,_0x35f1cd){return function(_0x2d650b){if(!_0x2d650b){_0x57d980[_0xb1d9('0x1e')](0x194);}return _0x2d650b;};}function handleError(_0x2f6bd2,_0x4bc26b){_0x4bc26b=_0x4bc26b||0x1f4;return function(_0x301ed8){logger['error'](_0x301ed8[_0xb1d9('0x2d')]);if(_0x301ed8[_0xb1d9('0x2e')]){delete _0x301ed8[_0xb1d9('0x2e')];}_0x2f6bd2[_0xb1d9('0x20')](_0x4bc26b)['send'](_0x301ed8);};}exports[_0xb1d9('0x2f')]=function(_0x5eee7a,_0x6bb965){var _0xecf170={},_0x23e284={},_0x21b488={'count':0x0,'rows':[]};var _0x2d5caa=_[_0xb1d9('0x30')](db['Dashboard'][_0xb1d9('0x31')],function(_0x1c1bbb){return{'name':_0x1c1bbb[_0xb1d9('0x32')],'type':_0x1c1bbb[_0xb1d9('0x33')][_0xb1d9('0x34')]};});_0x23e284[_0xb1d9('0x35')]=_[_0xb1d9('0x30')](_0x2d5caa,'name');_0x23e284['query']=_[_0xb1d9('0x36')](_0x5eee7a[_0xb1d9('0x37')]);_0x23e284[_0xb1d9('0x38')]=_['intersection'](_0x23e284[_0xb1d9('0x35')],_0x23e284[_0xb1d9('0x37')]);_0xecf170[_0xb1d9('0x39')]=_[_0xb1d9('0x3a')](_0x23e284[_0xb1d9('0x35')],qs['fields'](_0x5eee7a['query']['fields']));_0xecf170[_0xb1d9('0x39')]=_0xecf170['attributes']['length']?_0xecf170[_0xb1d9('0x39')]:_0x23e284['model'];if(!_0x5eee7a[_0xb1d9('0x37')]['hasOwnProperty'](_0xb1d9('0x3b'))){_0xecf170[_0xb1d9('0x23')]=qs[_0xb1d9('0x23')](_0x5eee7a[_0xb1d9('0x37')][_0xb1d9('0x23')]);_0xecf170[_0xb1d9('0x21')]=qs[_0xb1d9('0x21')](_0x5eee7a[_0xb1d9('0x37')]['offset']);}_0xecf170[_0xb1d9('0x3c')]=qs[_0xb1d9('0x3d')](_0x5eee7a[_0xb1d9('0x37')]['sort']);_0xecf170[_0xb1d9('0x3e')]=qs[_0xb1d9('0x38')](_['pick'](_0x5eee7a[_0xb1d9('0x37')],_0x23e284[_0xb1d9('0x38')]),_0x2d5caa);if(_0x5eee7a[_0xb1d9('0x37')][_0xb1d9('0x3f')]){_0xecf170[_0xb1d9('0x3e')]=_[_0xb1d9('0x40')](_0xecf170[_0xb1d9('0x3e')],{'$or':_[_0xb1d9('0x30')](_0x2d5caa,function(_0xd2daf3){if(_0xd2daf3[_0xb1d9('0x33')]!==_0xb1d9('0x41')){var _0x5e95a5={};_0x5e95a5[_0xd2daf3[_0xb1d9('0x2e')]]={'$like':'%'+_0x5eee7a[_0xb1d9('0x37')][_0xb1d9('0x3f')]+'%'};return _0x5e95a5;}})});}_0xecf170=_['merge']({},_0xecf170,_0x5eee7a[_0xb1d9('0x42')]);var _0x35fc77={'where':_0xecf170[_0xb1d9('0x3e')]};return db[_0xb1d9('0x43')][_0xb1d9('0x24')](_0x35fc77)[_0xb1d9('0x2b')](function(_0x37049f){_0x21b488[_0xb1d9('0x24')]=_0x37049f;if(_0x5eee7a[_0xb1d9('0x37')]['includeAll']){_0xecf170[_0xb1d9('0x44')]=[{'all':!![]}];}return db[_0xb1d9('0x43')]['findAll'](_0xecf170);})[_0xb1d9('0x2b')](function(_0x1655a3){_0x21b488[_0xb1d9('0x45')]=_0x1655a3;return _0x21b488;})[_0xb1d9('0x2b')](respondWithFilteredResult(_0x6bb965,_0xecf170))[_0xb1d9('0x46')](handleError(_0x6bb965,null));};exports[_0xb1d9('0x47')]=function(_0x19701f,_0x1987ae){var _0x4d95e9={'raw':![],'where':{'id':_0x19701f[_0xb1d9('0x48')]['id']}},_0x194bdc={};_0x194bdc['model']=_[_0xb1d9('0x36')](db[_0xb1d9('0x43')][_0xb1d9('0x31')]);_0x194bdc['query']=_[_0xb1d9('0x36')](_0x19701f[_0xb1d9('0x37')]);_0x194bdc[_0xb1d9('0x38')]=_['intersection'](_0x194bdc[_0xb1d9('0x35')],_0x194bdc[_0xb1d9('0x37')]);_0x4d95e9[_0xb1d9('0x39')]=_[_0xb1d9('0x3a')](_0x194bdc[_0xb1d9('0x35')],qs[_0xb1d9('0x49')](_0x19701f[_0xb1d9('0x37')][_0xb1d9('0x49')]));_0x4d95e9[_0xb1d9('0x39')]=_0x4d95e9[_0xb1d9('0x39')]['length']?_0x4d95e9[_0xb1d9('0x39')]:_0x194bdc[_0xb1d9('0x35')];if(_0x19701f[_0xb1d9('0x37')][_0xb1d9('0x4a')]){_0x4d95e9[_0xb1d9('0x44')]=[{'all':!![]}];}_0x4d95e9=_[_0xb1d9('0x40')]({},_0x4d95e9,_0x19701f[_0xb1d9('0x42')]);return db[_0xb1d9('0x43')][_0xb1d9('0x4b')](_0x4d95e9)['then'](handleEntityNotFound(_0x1987ae,null))[_0xb1d9('0x2b')](respondWithResult(_0x1987ae,null))[_0xb1d9('0x46')](handleError(_0x1987ae,null));};exports[_0xb1d9('0x4c')]=function(_0x55e6c3,_0x9c0e19){return db[_0xb1d9('0x43')]['create'](_0x55e6c3[_0xb1d9('0x4d')],{})['then'](function(_0x2acae7){var _0x3bc217=_0x55e6c3[_0xb1d9('0x4e')]['get']({'plain':!![]});if(!_0x3bc217)throw new Error(_0xb1d9('0x4f'));if(_0x3bc217[_0xb1d9('0x50')]==='user'){var _0x2be559=_0x2acae7[_0xb1d9('0x51')]({'plain':!![]});var _0x150697=_0xb1d9('0x2c');return db['UserProfileSection'][_0xb1d9('0x4b')]({'where':{'name':_0x150697,'userProfileId':_0x3bc217['userProfileId']},'raw':!![]})[_0xb1d9('0x2b')](function(_0x3909dd){if(_0x3909dd&&_0x3909dd[_0xb1d9('0x52')]===0x0){return db['UserProfileResource'][_0xb1d9('0x4c')]({'name':_0x2be559[_0xb1d9('0x2e')],'resourceId':_0x2be559['id'],'type':_0x3909dd[_0xb1d9('0x2e')],'sectionId':_0x3909dd['id']},{})[_0xb1d9('0x2b')](function(){return _0x2acae7;});}else{return _0x2acae7;}})[_0xb1d9('0x46')](function(_0x34033b){logger['error'](_0xb1d9('0x53'),_0x34033b);throw _0x34033b;});}return _0x2acae7;})[_0xb1d9('0x2b')](respondWithResult(_0x9c0e19,0xc9))['catch'](handleError(_0x9c0e19,null));};exports[_0xb1d9('0x54')]=function(_0x53592a,_0x3b797d){var _0x1ffdf1={'where':{'id':_0x53592a[_0xb1d9('0x48')]['id']}},_0x5c5f32={};_0x5c5f32[_0xb1d9('0x35')]=_[_0xb1d9('0x36')](db['Dashboard']['rawAttributes']);_0x1ffdf1[_0xb1d9('0x39')]=_[_0xb1d9('0x3a')](_0x5c5f32[_0xb1d9('0x35')],qs[_0xb1d9('0x49')](_0x53592a[_0xb1d9('0x37')][_0xb1d9('0x49')]));_0x1ffdf1['attributes']=_0x1ffdf1[_0xb1d9('0x39')]['length']?_0x1ffdf1[_0xb1d9('0x39')]:_0x5c5f32[_0xb1d9('0x35')];if(_0x53592a[_0xb1d9('0x37')][_0xb1d9('0x4a')]){_0x1ffdf1[_0xb1d9('0x44')]=[{'all':!![]}];}_0x1ffdf1=_[_0xb1d9('0x40')]({},_0x1ffdf1,_0x53592a[_0xb1d9('0x42')]);return db[_0xb1d9('0x43')][_0xb1d9('0x4b')](_0x1ffdf1)[_0xb1d9('0x2b')](handleEntityNotFound(_0x3b797d,null))[_0xb1d9('0x2b')](function(_0x4042f2){if(_0x4042f2){var _0x7c7150=_0x4042f2[_0xb1d9('0x51')]({'plain':!![]});_0x7c7150=qs[_0xb1d9('0x55')](_0x7c7150,['id',_0xb1d9('0x56'),'updatedAt']);_0x53592a[_0xb1d9('0x4d')]=_[_0xb1d9('0x55')](_0x53592a['body'],['id','createdAt','updatedAt']);return db['Dashboard'][_0xb1d9('0x4c')](_[_0xb1d9('0x40')](_0x7c7150,_0x53592a[_0xb1d9('0x4d')]),{'include':_0x53592a[_0xb1d9('0x37')][_0xb1d9('0x4a')]?[{'all':!![]}]:undefined})[_0xb1d9('0x2b')](function(_0xa8ba0c){var _0x28a456=_0x53592a[_0xb1d9('0x4e')]['get']({'plain':!![]});if(!_0x28a456)throw new Error(_0xb1d9('0x4f'));if(_0x28a456['role']==='user'){var _0x4a8ab4=_0xa8ba0c[_0xb1d9('0x51')]({'plain':!![]});var _0x1cf6ac=_0xb1d9('0x2c');return db[_0xb1d9('0x57')][_0xb1d9('0x4b')]({'where':{'name':_0x1cf6ac,'userProfileId':_0x28a456[_0xb1d9('0x58')]},'raw':!![]})['then'](function(_0x18b810){if(_0x18b810&&_0x18b810[_0xb1d9('0x52')]===0x0){return db['UserProfileResource'][_0xb1d9('0x4c')]({'name':_0x4a8ab4[_0xb1d9('0x2e')],'resourceId':_0x4a8ab4['id'],'type':_0x18b810[_0xb1d9('0x2e')],'sectionId':_0x18b810['id']},{})[_0xb1d9('0x2b')](function(){return _0xa8ba0c;});}else{return _0xa8ba0c;}})['catch'](function(_0x5e77f5){logger[_0xb1d9('0x59')](_0xb1d9('0x53'),_0x5e77f5);throw _0x5e77f5;});}return _0xa8ba0c;});}})[_0xb1d9('0x2b')](respondWithResult(_0x3b797d,0xc9))['catch'](handleError(_0x3b797d,null));};exports[_0xb1d9('0x2a')]=function(_0x452960,_0x34363c){if(_0x452960[_0xb1d9('0x4d')]['id']){delete _0x452960[_0xb1d9('0x4d')]['id'];}return db['Dashboard'][_0xb1d9('0x4b')]({'where':{'id':_0x452960[_0xb1d9('0x48')]['id']}})[_0xb1d9('0x2b')](handleEntityNotFound(_0x34363c,null))[_0xb1d9('0x2b')](saveUpdates(_0x452960['body'],null))[_0xb1d9('0x2b')](respondWithResult(_0x34363c,null))[_0xb1d9('0x46')](handleError(_0x34363c,null));};exports[_0xb1d9('0x5a')]=function(_0x2641e7,_0x590ee5){return db[_0xb1d9('0x43')][_0xb1d9('0x4b')]({'where':{'id':_0x2641e7[_0xb1d9('0x48')]['id']}})[_0xb1d9('0x2b')](handleEntityNotFound(_0x590ee5,null))[_0xb1d9('0x2b')](removeEntity(_0x590ee5,null))[_0xb1d9('0x46')](handleError(_0x590ee5,null));};function widgetAttributes(_0x217daf){try{switch(_0x217daf['type']){case'iframe':return[{'name':_0xb1d9('0x5b'),'value':_0x217daf['attrUrl']||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf['attrs'][0x0]?_0x217daf[_0xb1d9('0x5c')][0x0][_0xb1d9('0x5d')]:undefined)||'https://'}];case _0xb1d9('0x5e'):return[{'name':_0xb1d9('0x5f'),'value':_0x217daf[_0xb1d9('0x5f')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x0]?_0x217daf[_0xb1d9('0x5c')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xb1d9('0x60'),'value':_0x217daf[_0xb1d9('0x60')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x0]?_0x217daf[_0xb1d9('0x5c')][0x0][_0xb1d9('0x5d')]:undefined)||_0xb1d9('0x61')},{'name':_0xb1d9('0x62'),'value':_0x217daf[_0xb1d9('0x62')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x1]?_0x217daf[_0xb1d9('0x5c')][0x1][_0xb1d9('0x5d')]:undefined)||_0xb1d9('0x63')},{'name':_0xb1d9('0x64'),'value':_0x217daf[_0xb1d9('0x64')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x2]?_0x217daf[_0xb1d9('0x5c')][0x2][_0xb1d9('0x5d')]:undefined)||0xc}];case _0xb1d9('0x65'):return[{'name':_0xb1d9('0x66'),'value':_0x217daf[_0xb1d9('0x66')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x0]?_0x217daf['attrs'][0x0][_0xb1d9('0x5d')]:undefined)||'total'},{'name':_0xb1d9('0x67'),'value':_0x217daf['attrVoiceQueues']||(_0x217daf['attrs']&&_0x217daf[_0xb1d9('0x5c')][0x1]?_0x217daf[_0xb1d9('0x5c')][0x1][_0xb1d9('0x5d')]:undefined)||[]},{'name':_0xb1d9('0x64'),'value':_0x217daf[_0xb1d9('0x64')]||(_0x217daf['attrs']&&_0x217daf[_0xb1d9('0x5c')][0x2]?_0x217daf[_0xb1d9('0x5c')][0x2][_0xb1d9('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x217daf[_0xb1d9('0x68')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x3]?_0x217daf[_0xb1d9('0x5c')][0x3][_0xb1d9('0x5d')]:undefined)||_0xb1d9('0x69')},{'name':'attrEmailAccounts','value':_0x217daf[_0xb1d9('0x6a')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x4]?_0x217daf['attrs'][0x4]['value']:undefined)||''},{'name':_0xb1d9('0x6b'),'value':_0x217daf[_0xb1d9('0x6b')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x5]?_0x217daf['attrs'][0x5][_0xb1d9('0x5d')]:undefined)||''},{'name':_0xb1d9('0x6c'),'value':_0x217daf['attrSmsAccounts']||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf['attrs'][0x6]?_0x217daf[_0xb1d9('0x5c')][0x6][_0xb1d9('0x5d')]:undefined)||''},{'name':_0xb1d9('0x6d'),'value':_0x217daf[_0xb1d9('0x6d')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf['attrs'][0x7]?_0x217daf['attrs'][0x7][_0xb1d9('0x5d')]:undefined)||''},{'name':_0xb1d9('0x6e'),'value':_0x217daf[_0xb1d9('0x6e')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf['attrs'][0x8]?_0x217daf[_0xb1d9('0x5c')][0x8][_0xb1d9('0x5d')]:undefined)||''},{'name':_0xb1d9('0x6f'),'value':_0x217daf[_0xb1d9('0x6f')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x9]?_0x217daf[_0xb1d9('0x5c')][0x9][_0xb1d9('0x5d')]:undefined)||''}];case _0xb1d9('0x70'):case _0xb1d9('0x71'):return[{'name':'attrSerie1','value':_0x217daf['attrSerie1']||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x0]?_0x217daf[_0xb1d9('0x5c')][0x0][_0xb1d9('0x5d')]:undefined)||_0xb1d9('0x72')},{'name':'attrSerie2','value':_0x217daf['attrSerie2']||(_0x217daf['attrs']&&_0x217daf[_0xb1d9('0x5c')][0x1]?_0x217daf[_0xb1d9('0x5c')][0x1][_0xb1d9('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x217daf[_0xb1d9('0x73')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x2]?_0x217daf[_0xb1d9('0x5c')][0x2][_0xb1d9('0x5d')]:undefined)||null},{'name':_0xb1d9('0x67'),'value':_0x217daf[_0xb1d9('0x67')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x3]?_0x217daf[_0xb1d9('0x5c')][0x3][_0xb1d9('0x5d')]:undefined)||[]},{'name':_0xb1d9('0x68'),'value':_0x217daf[_0xb1d9('0x68')]||(_0x217daf['attrs']&&_0x217daf['attrs'][0x4]?_0x217daf['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0xb1d9('0x6a'),'value':_0x217daf['attrEmailAccounts']||(_0x217daf['attrs']&&_0x217daf[_0xb1d9('0x5c')][0x5]?_0x217daf[_0xb1d9('0x5c')][0x5][_0xb1d9('0x5d')]:undefined)||''},{'name':_0xb1d9('0x6b'),'value':_0x217daf[_0xb1d9('0x6b')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf['attrs'][0x6]?_0x217daf[_0xb1d9('0x5c')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x217daf['attrSmsAccounts']||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x7]?_0x217daf[_0xb1d9('0x5c')][0x7]['value']:undefined)||''},{'name':_0xb1d9('0x6d'),'value':_0x217daf[_0xb1d9('0x6d')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x8]?_0x217daf[_0xb1d9('0x5c')][0x8][_0xb1d9('0x5d')]:undefined)||''},{'name':_0xb1d9('0x6e'),'value':_0x217daf['attrWhatsappAccounts']||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x9]?_0x217daf[_0xb1d9('0x5c')][0x9][_0xb1d9('0x5d')]:undefined)||''},{'name':_0xb1d9('0x6f'),'value':_0x217daf[_0xb1d9('0x6f')]||(_0x217daf['attrs']&&_0x217daf['attrs'][0xa]?_0x217daf[_0xb1d9('0x5c')][0xa]['value']:undefined)||''}];case _0xb1d9('0x74'):return[{'name':_0xb1d9('0x75'),'type':_0x217daf['reportType']||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x0]?_0x217daf['attrs'][0x0]['type']:undefined)||null,'value':_0x217daf[_0xb1d9('0x75')]||(_0x217daf['attrs']&&_0x217daf['attrs'][0x0]?_0x217daf[_0xb1d9('0x5c')][0x0][_0xb1d9('0x5d')]:undefined)||null},{'name':_0xb1d9('0x76'),'value':_0x217daf[_0xb1d9('0x76')]||(_0x217daf[_0xb1d9('0x5c')]&&_0x217daf[_0xb1d9('0x5c')][0x1]?_0x217daf['attrs'][0x1][_0xb1d9('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x1a3cfc){logger['error'](_0xb1d9('0x77'),JSON['stringify'](_0x1a3cfc));return[];}}exports[_0xb1d9('0x78')]=function(_0xe36ec2,_0x30f22a,_0x1deee8){if(_0xe36ec2[_0xb1d9('0x4d')]['id']){delete _0xe36ec2[_0xb1d9('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xe36ec2[_0xb1d9('0x48')]['id']}})[_0xb1d9('0x2b')](handleEntityNotFound(_0x30f22a,null))[_0xb1d9('0x2b')](function(_0x4615fb){if(_0x4615fb){_0xe36ec2['body'][_0xb1d9('0x79')]=_0x4615fb['id'];_0xe36ec2[_0xb1d9('0x4d')][_0xb1d9('0x5c')]=widgetAttributes(_0xe36ec2['body']);return db[_0xb1d9('0x7a')][_0xb1d9('0x4c')](_0xe36ec2[_0xb1d9('0x4d')]);}})[_0xb1d9('0x2b')](respondWithResult(_0x30f22a,null))[_0xb1d9('0x46')](handleError(_0x30f22a,null));};exports['getItems']=function(_0x25a947,_0x5598cd,_0x2db747){var _0x287e92={};var _0xcab721={};var _0x54c04b;var _0x5ecbd4;return db[_0xb1d9('0x43')][_0xb1d9('0x7b')]({'where':{'id':_0x25a947[_0xb1d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x5598cd,null))[_0xb1d9('0x2b')](function(_0xed9c84){if(_0xed9c84){_0x54c04b=_0xed9c84;_0xcab721[_0xb1d9('0x35')]=_[_0xb1d9('0x36')](db[_0xb1d9('0x7a')][_0xb1d9('0x31')]);_0xcab721[_0xb1d9('0x37')]=_['keys'](_0x25a947[_0xb1d9('0x37')]);_0xcab721[_0xb1d9('0x38')]=_['intersection'](_0xcab721[_0xb1d9('0x35')],_0xcab721[_0xb1d9('0x37')]);_0x287e92[_0xb1d9('0x39')]=_[_0xb1d9('0x3a')](_0xcab721[_0xb1d9('0x35')],qs[_0xb1d9('0x49')](_0x25a947[_0xb1d9('0x37')][_0xb1d9('0x49')]));_0x287e92[_0xb1d9('0x39')]=_0x287e92[_0xb1d9('0x39')][_0xb1d9('0x7c')]?_0x287e92[_0xb1d9('0x39')]:_0xcab721[_0xb1d9('0x35')];_0x287e92[_0xb1d9('0x3c')]=qs[_0xb1d9('0x3d')](_0x25a947['query'][_0xb1d9('0x3d')]);_0x287e92['where']=qs['filters'](_[_0xb1d9('0x7d')](_0x25a947[_0xb1d9('0x37')],_0xcab721[_0xb1d9('0x38')]));if(_0x25a947[_0xb1d9('0x37')][_0xb1d9('0x3f')]){_0x287e92[_0xb1d9('0x3e')]=_[_0xb1d9('0x40')](_0x287e92[_0xb1d9('0x3e')],{'$or':_['map'](_0x287e92[_0xb1d9('0x39')],function(_0x38b2ef){var _0x1b07d9={};_0x1b07d9[_0x38b2ef]={'$like':'%'+_0x25a947[_0xb1d9('0x37')]['filter']+'%'};return _0x1b07d9;})});}_0x287e92=_[_0xb1d9('0x40')]({},_0x287e92,_0x25a947[_0xb1d9('0x42')]);return _0x54c04b['getItems'](_0x287e92);}})[_0xb1d9('0x2b')](function(_0x10e192){if(_0x10e192){_0x5ecbd4=_0x10e192[_0xb1d9('0x7c')];if(!_0x25a947[_0xb1d9('0x37')]['hasOwnProperty'](_0xb1d9('0x3b'))){_0x287e92[_0xb1d9('0x23')]=qs[_0xb1d9('0x23')](_0x25a947[_0xb1d9('0x37')][_0xb1d9('0x23')]);_0x287e92[_0xb1d9('0x21')]=qs[_0xb1d9('0x21')](_0x25a947[_0xb1d9('0x37')][_0xb1d9('0x21')]);}return _0x54c04b[_0xb1d9('0x7e')](_0x287e92);}})['then'](function(_0x1de3f6){if(_0x1de3f6){return _0x1de3f6?{'count':_0x5ecbd4,'rows':_0x1de3f6}:null;}})[_0xb1d9('0x2b')](respondWithResult(_0x5598cd,null))[_0xb1d9('0x46')](handleError(_0x5598cd,null));}; \ No newline at end of file +var _0x2c5e=['attrSerie2','attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./dashboard.socket','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','key','query','keys','filters','model','fields','attributes','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1'];(function(_0x6b48b0,_0x29e7bb){var _0x47318e=function(_0x51f9d8){while(--_0x51f9d8){_0x6b48b0['push'](_0x6b48b0['shift']());}};_0x47318e(++_0x29e7bb);}(_0x2c5e,0x181));var _0xe2c5=function(_0x46ef1e,_0x57d69b){_0x46ef1e=_0x46ef1e-0x0;var _0x34d2cf=_0x2c5e[_0x46ef1e];return _0x34d2cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2c5('0x0'));var zipdir=require(_0xe2c5('0x1'));var jsonpatch=require(_0xe2c5('0x2'));var rp=require(_0xe2c5('0x3'));var moment=require(_0xe2c5('0x4'));var BPromise=require(_0xe2c5('0x5'));var Mustache=require(_0xe2c5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe2c5('0x7'));var csv=require(_0xe2c5('0x8'));var ejs=require(_0xe2c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe2c5('0xa'));var crypto=require(_0xe2c5('0xb'));var jsforce=require(_0xe2c5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe2c5('0x8'));var querystring=require(_0xe2c5('0xd'));var Papa=require(_0xe2c5('0xe'));var Redis=require(_0xe2c5('0xf'));var authService=require(_0xe2c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe2c5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe2c5('0x12'));var utils=require(_0xe2c5('0x13'));var config=require(_0xe2c5('0x14'));var licenseUtil=require(_0xe2c5('0x15'));var db=require('../../mysqldb')['db'];config[_0xe2c5('0x16')]=_[_0xe2c5('0x17')](config[_0xe2c5('0x16')],{'host':_0xe2c5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe2c5('0x19'))['register'](socket);function respondWithStatusCode(_0x3dead0,_0xb84ee9){_0xb84ee9=_0xb84ee9||0xcc;return function(_0x43df6a){if(_0x43df6a){return _0x3dead0[_0xe2c5('0x1a')](_0xb84ee9);}return _0x3dead0[_0xe2c5('0x1b')](_0xb84ee9)['end']();};}function respondWithResult(_0x39472f,_0x14aba6){_0x14aba6=_0x14aba6||0xc8;return function(_0x408e4d){if(_0x408e4d){return _0x39472f['status'](_0x14aba6)[_0xe2c5('0x1c')](_0x408e4d);}};}function respondWithFilteredResult(_0x56e73d,_0x43f6e6){return function(_0x29162f){if(_0x29162f){var _0x340438=typeof _0x43f6e6[_0xe2c5('0x1d')]==='undefined'&&typeof _0x43f6e6['limit']==='undefined';var _0x27990e=_0x29162f[_0xe2c5('0x1e')];var _0x163a08=_0x340438?0x0:_0x43f6e6['offset'];var _0x52cfe4=_0x340438?_0x29162f['count']:_0x43f6e6[_0xe2c5('0x1d')]+_0x43f6e6[_0xe2c5('0x1f')];var _0x72f398;if(_0x52cfe4>=_0x27990e){_0x52cfe4=_0x27990e;_0x72f398=0xc8;}else{_0x72f398=0xce;}_0x56e73d[_0xe2c5('0x1b')](_0x72f398);return _0x56e73d[_0xe2c5('0x20')](_0xe2c5('0x21'),_0x163a08+'-'+_0x52cfe4+'/'+_0x27990e)[_0xe2c5('0x1c')](_0x29162f);}return null;};}function patchUpdates(_0x531714){return function(_0x560e02){try{jsonpatch[_0xe2c5('0x22')](_0x560e02,_0x531714,!![]);}catch(_0x5f3bc2){return BPromise[_0xe2c5('0x23')](_0x5f3bc2);}return _0x560e02[_0xe2c5('0x24')]();};}function saveUpdates(_0x435ccc,_0x3993a7){return function(_0x5a6084){if(_0x5a6084){return _0x5a6084[_0xe2c5('0x25')](_0x435ccc)[_0xe2c5('0x26')](function(_0x4b60c5){return _0x4b60c5;});}return null;};}function removeEntity(_0x5d882a,_0x10749e){return function(_0x5d2888){if(_0x5d2888){return _0x5d2888[_0xe2c5('0x27')]()[_0xe2c5('0x26')](function(){var _0x5de39e=_0x5d2888[_0xe2c5('0x28')]({'plain':!![]});var _0x422261='CustomDashboards';return db[_0xe2c5('0x29')]['destroy']({'where':{'type':_0x422261,'resourceId':_0x5de39e['id']}})[_0xe2c5('0x26')](function(){return _0x5d2888;});})[_0xe2c5('0x26')](function(){_0x5d882a[_0xe2c5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32816e,_0x2dfb96){return function(_0x1f638f){if(!_0x1f638f){_0x32816e[_0xe2c5('0x1a')](0x194);}return _0x1f638f;};}function handleError(_0x2587a6,_0x39c311){_0x39c311=_0x39c311||0x1f4;return function(_0x41c96c){logger[_0xe2c5('0x2a')](_0x41c96c[_0xe2c5('0x2b')]);if(_0x41c96c[_0xe2c5('0x2c')]){delete _0x41c96c[_0xe2c5('0x2c')];}_0x2587a6['status'](_0x39c311)['send'](_0x41c96c);};}exports[_0xe2c5('0x2d')]=function(_0x1e6e1d,_0x515f00){var _0x2b7611={},_0x1320ba={},_0x5a65cf={'count':0x0,'rows':[]};var _0x2f474b=_[_0xe2c5('0x2e')](db[_0xe2c5('0x2f')][_0xe2c5('0x30')],function(_0x5907a6){return{'name':_0x5907a6['fieldName'],'type':_0x5907a6['type'][_0xe2c5('0x31')]};});_0x1320ba['model']=_[_0xe2c5('0x2e')](_0x2f474b,_0xe2c5('0x2c'));_0x1320ba[_0xe2c5('0x32')]=_[_0xe2c5('0x33')](_0x1e6e1d[_0xe2c5('0x32')]);_0x1320ba[_0xe2c5('0x34')]=_['intersection'](_0x1320ba['model'],_0x1320ba[_0xe2c5('0x32')]);_0x2b7611['attributes']=_['intersection'](_0x1320ba[_0xe2c5('0x35')],qs[_0xe2c5('0x36')](_0x1e6e1d[_0xe2c5('0x32')][_0xe2c5('0x36')]));_0x2b7611['attributes']=_0x2b7611[_0xe2c5('0x37')]['length']?_0x2b7611[_0xe2c5('0x37')]:_0x1320ba['model'];if(!_0x1e6e1d[_0xe2c5('0x32')]['hasOwnProperty']('nolimit')){_0x2b7611[_0xe2c5('0x1f')]=qs['limit'](_0x1e6e1d[_0xe2c5('0x32')]['limit']);_0x2b7611[_0xe2c5('0x1d')]=qs['offset'](_0x1e6e1d[_0xe2c5('0x32')]['offset']);}_0x2b7611[_0xe2c5('0x38')]=qs['sort'](_0x1e6e1d['query'][_0xe2c5('0x39')]);_0x2b7611['where']=qs[_0xe2c5('0x34')](_[_0xe2c5('0x3a')](_0x1e6e1d['query'],_0x1320ba['filters']),_0x2f474b);if(_0x1e6e1d['query'][_0xe2c5('0x3b')]){_0x2b7611[_0xe2c5('0x3c')]=_[_0xe2c5('0x3d')](_0x2b7611[_0xe2c5('0x3c')],{'$or':_['map'](_0x2f474b,function(_0x380390){if(_0x380390['type']!==_0xe2c5('0x3e')){var _0xbde236={};_0xbde236[_0x380390[_0xe2c5('0x2c')]]={'$like':'%'+_0x1e6e1d[_0xe2c5('0x32')][_0xe2c5('0x3b')]+'%'};return _0xbde236;}})});}_0x2b7611=_['merge']({},_0x2b7611,_0x1e6e1d[_0xe2c5('0x3f')]);var _0x889c7f={'where':_0x2b7611[_0xe2c5('0x3c')]};return db[_0xe2c5('0x2f')]['count'](_0x889c7f)['then'](function(_0x4df152){_0x5a65cf[_0xe2c5('0x1e')]=_0x4df152;if(_0x1e6e1d['query'][_0xe2c5('0x40')]){_0x2b7611[_0xe2c5('0x41')]=[{'all':!![]}];}return db[_0xe2c5('0x2f')][_0xe2c5('0x42')](_0x2b7611);})['then'](function(_0x542c68){_0x5a65cf['rows']=_0x542c68;return _0x5a65cf;})[_0xe2c5('0x26')](respondWithFilteredResult(_0x515f00,_0x2b7611))[_0xe2c5('0x43')](handleError(_0x515f00,null));};exports['show']=function(_0x56857d,_0x305eb8){var _0x480c9b={'raw':![],'where':{'id':_0x56857d[_0xe2c5('0x44')]['id']}},_0x2315d3={};_0x2315d3['model']=_[_0xe2c5('0x33')](db[_0xe2c5('0x2f')]['rawAttributes']);_0x2315d3['query']=_[_0xe2c5('0x33')](_0x56857d[_0xe2c5('0x32')]);_0x2315d3[_0xe2c5('0x34')]=_[_0xe2c5('0x45')](_0x2315d3['model'],_0x2315d3[_0xe2c5('0x32')]);_0x480c9b[_0xe2c5('0x37')]=_[_0xe2c5('0x45')](_0x2315d3['model'],qs[_0xe2c5('0x36')](_0x56857d[_0xe2c5('0x32')]['fields']));_0x480c9b[_0xe2c5('0x37')]=_0x480c9b[_0xe2c5('0x37')][_0xe2c5('0x46')]?_0x480c9b[_0xe2c5('0x37')]:_0x2315d3[_0xe2c5('0x35')];if(_0x56857d[_0xe2c5('0x32')][_0xe2c5('0x40')]){_0x480c9b[_0xe2c5('0x41')]=[{'all':!![]}];}_0x480c9b=_[_0xe2c5('0x3d')]({},_0x480c9b,_0x56857d[_0xe2c5('0x3f')]);return db[_0xe2c5('0x2f')][_0xe2c5('0x47')](_0x480c9b)['then'](handleEntityNotFound(_0x305eb8,null))[_0xe2c5('0x26')](respondWithResult(_0x305eb8,null))[_0xe2c5('0x43')](handleError(_0x305eb8,null));};exports[_0xe2c5('0x48')]=function(_0x40a641,_0x108329){return db[_0xe2c5('0x2f')][_0xe2c5('0x48')](_0x40a641[_0xe2c5('0x49')],{})[_0xe2c5('0x26')](function(_0x169d09){var _0x4d52ab=_0x40a641[_0xe2c5('0x4a')][_0xe2c5('0x28')]({'plain':!![]});if(!_0x4d52ab)throw new Error(_0xe2c5('0x4b'));if(_0x4d52ab['role']==='user'){var _0x17fcd4=_0x169d09[_0xe2c5('0x28')]({'plain':!![]});var _0x102537=_0xe2c5('0x4c');return db[_0xe2c5('0x4d')][_0xe2c5('0x47')]({'where':{'name':_0x102537,'userProfileId':_0x4d52ab[_0xe2c5('0x4e')]},'raw':!![]})['then'](function(_0x347686){if(_0x347686&&_0x347686[_0xe2c5('0x4f')]===0x0){return db[_0xe2c5('0x29')][_0xe2c5('0x48')]({'name':_0x17fcd4[_0xe2c5('0x2c')],'resourceId':_0x17fcd4['id'],'type':_0x347686[_0xe2c5('0x2c')],'sectionId':_0x347686['id']},{})[_0xe2c5('0x26')](function(){return _0x169d09;});}else{return _0x169d09;}})[_0xe2c5('0x43')](function(_0x8cf475){logger[_0xe2c5('0x2a')](_0xe2c5('0x50'),_0x8cf475);throw _0x8cf475;});}return _0x169d09;})[_0xe2c5('0x26')](respondWithResult(_0x108329,0xc9))['catch'](handleError(_0x108329,null));};exports[_0xe2c5('0x51')]=function(_0x3a7d97,_0x19b9bc){var _0x1679cd={'where':{'id':_0x3a7d97[_0xe2c5('0x44')]['id']}},_0x278aae={};_0x278aae[_0xe2c5('0x35')]=_['keys'](db[_0xe2c5('0x2f')]['rawAttributes']);_0x1679cd[_0xe2c5('0x37')]=_[_0xe2c5('0x45')](_0x278aae['model'],qs[_0xe2c5('0x36')](_0x3a7d97[_0xe2c5('0x32')][_0xe2c5('0x36')]));_0x1679cd['attributes']=_0x1679cd[_0xe2c5('0x37')][_0xe2c5('0x46')]?_0x1679cd[_0xe2c5('0x37')]:_0x278aae['model'];if(_0x3a7d97[_0xe2c5('0x32')]['includeAll']){_0x1679cd[_0xe2c5('0x41')]=[{'all':!![]}];}_0x1679cd=_['merge']({},_0x1679cd,_0x3a7d97[_0xe2c5('0x3f')]);return db[_0xe2c5('0x2f')]['find'](_0x1679cd)[_0xe2c5('0x26')](handleEntityNotFound(_0x19b9bc,null))['then'](function(_0x4779f3){if(_0x4779f3){var _0x1d0f5e=_0x4779f3[_0xe2c5('0x28')]({'plain':!![]});_0x1d0f5e=qs[_0xe2c5('0x52')](_0x1d0f5e,['id',_0xe2c5('0x53'),'updatedAt']);_0x3a7d97[_0xe2c5('0x49')]=_['omit'](_0x3a7d97[_0xe2c5('0x49')],['id','createdAt',_0xe2c5('0x54')]);return db[_0xe2c5('0x2f')]['create'](_[_0xe2c5('0x3d')](_0x1d0f5e,_0x3a7d97[_0xe2c5('0x49')]),{'include':_0x3a7d97[_0xe2c5('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xe2c5('0x26')](function(_0x2ecbee){var _0x5178eb=_0x3a7d97['user'][_0xe2c5('0x28')]({'plain':!![]});if(!_0x5178eb)throw new Error(_0xe2c5('0x4b'));if(_0x5178eb[_0xe2c5('0x55')]===_0xe2c5('0x4a')){var _0x11e65f=_0x2ecbee[_0xe2c5('0x28')]({'plain':!![]});var _0x2d1580=_0xe2c5('0x4c');return db['UserProfileSection'][_0xe2c5('0x47')]({'where':{'name':_0x2d1580,'userProfileId':_0x5178eb[_0xe2c5('0x4e')]},'raw':!![]})['then'](function(_0x83a82f){if(_0x83a82f&&_0x83a82f[_0xe2c5('0x4f')]===0x0){return db['UserProfileResource'][_0xe2c5('0x48')]({'name':_0x11e65f[_0xe2c5('0x2c')],'resourceId':_0x11e65f['id'],'type':_0x83a82f[_0xe2c5('0x2c')],'sectionId':_0x83a82f['id']},{})['then'](function(){return _0x2ecbee;});}else{return _0x2ecbee;}})[_0xe2c5('0x43')](function(_0x38773c){logger[_0xe2c5('0x2a')](_0xe2c5('0x50'),_0x38773c);throw _0x38773c;});}return _0x2ecbee;});}})['then'](respondWithResult(_0x19b9bc,0xc9))[_0xe2c5('0x43')](handleError(_0x19b9bc,null));};exports['update']=function(_0x131e12,_0x347fd8){if(_0x131e12[_0xe2c5('0x49')]['id']){delete _0x131e12[_0xe2c5('0x49')]['id'];}return db[_0xe2c5('0x2f')][_0xe2c5('0x47')]({'where':{'id':_0x131e12[_0xe2c5('0x44')]['id']}})['then'](handleEntityNotFound(_0x347fd8,null))[_0xe2c5('0x26')](saveUpdates(_0x131e12[_0xe2c5('0x49')],null))[_0xe2c5('0x26')](respondWithResult(_0x347fd8,null))['catch'](handleError(_0x347fd8,null));};exports[_0xe2c5('0x27')]=function(_0x4af9e6,_0x5c08f9){return db[_0xe2c5('0x2f')][_0xe2c5('0x47')]({'where':{'id':_0x4af9e6[_0xe2c5('0x44')]['id']}})[_0xe2c5('0x26')](handleEntityNotFound(_0x5c08f9,null))[_0xe2c5('0x26')](removeEntity(_0x5c08f9,null))[_0xe2c5('0x43')](handleError(_0x5c08f9,null));};function widgetAttributes(_0x3bb69b){try{switch(_0x3bb69b['type']){case _0xe2c5('0x56'):return[{'name':'attrUrl','value':_0x3bb69b[_0xe2c5('0x57')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x0]?_0x3bb69b['attrs'][0x0]['value']:undefined)||'https://'}];case _0xe2c5('0x59'):return[{'name':_0xe2c5('0x5a'),'value':_0x3bb69b[_0xe2c5('0x5a')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x0]?_0x3bb69b[_0xe2c5('0x58')][0x0][_0xe2c5('0x5b')]:undefined)||''}];case _0xe2c5('0x5c'):return[{'name':_0xe2c5('0x5d'),'value':_0x3bb69b[_0xe2c5('0x5d')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x0]?_0x3bb69b[_0xe2c5('0x58')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xe2c5('0x5e'),'value':_0x3bb69b[_0xe2c5('0x5e')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x1]?_0x3bb69b[_0xe2c5('0x58')][0x1][_0xe2c5('0x5b')]:undefined)||_0xe2c5('0x5f')},{'name':_0xe2c5('0x60'),'value':_0x3bb69b[_0xe2c5('0x60')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x2]?_0x3bb69b[_0xe2c5('0x58')][0x2][_0xe2c5('0x5b')]:undefined)||0xc}];case _0xe2c5('0x61'):return[{'name':_0xe2c5('0x62'),'value':_0x3bb69b[_0xe2c5('0x62')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b['attrs'][0x0]?_0x3bb69b[_0xe2c5('0x58')][0x0]['value']:undefined)||_0xe2c5('0x63')},{'name':_0xe2c5('0x64'),'value':_0x3bb69b[_0xe2c5('0x64')]||(_0x3bb69b['attrs']&&_0x3bb69b[_0xe2c5('0x58')][0x1]?_0x3bb69b['attrs'][0x1]['value']:undefined)||[]},{'name':_0xe2c5('0x60'),'value':_0x3bb69b[_0xe2c5('0x60')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x2]?_0x3bb69b[_0xe2c5('0x58')][0x2][_0xe2c5('0x5b')]:undefined)||0x14},{'name':_0xe2c5('0x65'),'value':_0x3bb69b[_0xe2c5('0x65')]||(_0x3bb69b['attrs']&&_0x3bb69b[_0xe2c5('0x58')][0x3]?_0x3bb69b[_0xe2c5('0x58')][0x3]['value']:undefined)||_0xe2c5('0x66')},{'name':_0xe2c5('0x67'),'value':_0x3bb69b[_0xe2c5('0x67')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x4]?_0x3bb69b[_0xe2c5('0x58')][0x4]['value']:undefined)||''},{'name':_0xe2c5('0x68'),'value':_0x3bb69b[_0xe2c5('0x68')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x5]?_0x3bb69b[_0xe2c5('0x58')][0x5][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x69'),'value':_0x3bb69b['attrSmsAccounts']||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x6]?_0x3bb69b[_0xe2c5('0x58')][0x6][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x6a'),'value':_0x3bb69b[_0xe2c5('0x6a')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x7]?_0x3bb69b['attrs'][0x7][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x6b'),'value':_0x3bb69b[_0xe2c5('0x6b')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x8]?_0x3bb69b[_0xe2c5('0x58')][0x8][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x6c'),'value':_0x3bb69b[_0xe2c5('0x6c')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x9]?_0x3bb69b['attrs'][0x9]['value']:undefined)||''}];case'multibar-chart':case _0xe2c5('0x6d'):return[{'name':_0xe2c5('0x6e'),'value':_0x3bb69b[_0xe2c5('0x6e')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x0]?_0x3bb69b['attrs'][0x0][_0xe2c5('0x5b')]:undefined)||_0xe2c5('0x63')},{'name':_0xe2c5('0x6f'),'value':_0x3bb69b[_0xe2c5('0x6f')]||(_0x3bb69b['attrs']&&_0x3bb69b[_0xe2c5('0x58')][0x1]?_0x3bb69b[_0xe2c5('0x58')][0x1][_0xe2c5('0x5b')]:undefined)||null},{'name':_0xe2c5('0x70'),'value':_0x3bb69b[_0xe2c5('0x70')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x2]?_0x3bb69b[_0xe2c5('0x58')][0x2]['value']:undefined)||null},{'name':_0xe2c5('0x64'),'value':_0x3bb69b[_0xe2c5('0x64')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b['attrs'][0x3]?_0x3bb69b['attrs'][0x3][_0xe2c5('0x5b')]:undefined)||[]},{'name':_0xe2c5('0x65'),'value':_0x3bb69b['attrChannel']||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b['attrs'][0x4]?_0x3bb69b[_0xe2c5('0x58')][0x4][_0xe2c5('0x5b')]:undefined)||_0xe2c5('0x66')},{'name':_0xe2c5('0x67'),'value':_0x3bb69b[_0xe2c5('0x67')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x5]?_0x3bb69b[_0xe2c5('0x58')][0x5][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x68'),'value':_0x3bb69b['attrFaxAccounts']||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x6]?_0x3bb69b[_0xe2c5('0x58')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3bb69b[_0xe2c5('0x69')]||(_0x3bb69b['attrs']&&_0x3bb69b['attrs'][0x7]?_0x3bb69b[_0xe2c5('0x58')][0x7][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x6a'),'value':_0x3bb69b[_0xe2c5('0x6a')]||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x8]?_0x3bb69b[_0xe2c5('0x58')][0x8][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x6b'),'value':_0x3bb69b[_0xe2c5('0x6b')]||(_0x3bb69b['attrs']&&_0x3bb69b['attrs'][0x9]?_0x3bb69b[_0xe2c5('0x58')][0x9][_0xe2c5('0x5b')]:undefined)||''},{'name':_0xe2c5('0x6c'),'value':_0x3bb69b[_0xe2c5('0x6c')]||(_0x3bb69b['attrs']&&_0x3bb69b['attrs'][0xa]?_0x3bb69b[_0xe2c5('0x58')][0xa]['value']:undefined)||''}];case _0xe2c5('0x71'):return[{'name':_0xe2c5('0x72'),'type':_0x3bb69b['reportType']||(_0x3bb69b['attrs']&&_0x3bb69b['attrs'][0x0]?_0x3bb69b[_0xe2c5('0x58')][0x0][_0xe2c5('0x73')]:undefined)||null,'value':_0x3bb69b['attrReport']||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x0]?_0x3bb69b[_0xe2c5('0x58')][0x0][_0xe2c5('0x5b')]:undefined)||null},{'name':_0xe2c5('0x74'),'value':_0x3bb69b['attrRefresh']||(_0x3bb69b[_0xe2c5('0x58')]&&_0x3bb69b[_0xe2c5('0x58')][0x1]?_0x3bb69b[_0xe2c5('0x58')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x28bf59){logger[_0xe2c5('0x2a')](_0xe2c5('0x75'),JSON[_0xe2c5('0x76')](_0x28bf59));return[];}}exports['addItem']=function(_0x40849b,_0x2d749e,_0x405583){if(_0x40849b['body']['id']){delete _0x40849b['body']['id'];}return db[_0xe2c5('0x2f')][_0xe2c5('0x47')]({'where':{'id':_0x40849b[_0xe2c5('0x44')]['id']}})[_0xe2c5('0x26')](handleEntityNotFound(_0x2d749e,null))[_0xe2c5('0x26')](function(_0x4e0c19){if(_0x4e0c19){_0x40849b[_0xe2c5('0x49')][_0xe2c5('0x77')]=_0x4e0c19['id'];_0x40849b[_0xe2c5('0x49')][_0xe2c5('0x58')]=widgetAttributes(_0x40849b[_0xe2c5('0x49')]);return db[_0xe2c5('0x78')][_0xe2c5('0x48')](_0x40849b[_0xe2c5('0x49')]);}})['then'](respondWithResult(_0x2d749e,null))[_0xe2c5('0x43')](handleError(_0x2d749e,null));};exports[_0xe2c5('0x79')]=function(_0xff353d,_0x47b757,_0x3d8e0d){var _0x1890fe={};var _0x3cc245={};var _0x4478c3;var _0x2b9fb4;return db[_0xe2c5('0x2f')][_0xe2c5('0x7a')]({'where':{'id':_0xff353d[_0xe2c5('0x44')]['id']}})[_0xe2c5('0x26')](handleEntityNotFound(_0x47b757,null))[_0xe2c5('0x26')](function(_0x2bd39d){if(_0x2bd39d){_0x4478c3=_0x2bd39d;_0x3cc245[_0xe2c5('0x35')]=_[_0xe2c5('0x33')](db['DashboardItem'][_0xe2c5('0x30')]);_0x3cc245[_0xe2c5('0x32')]=_['keys'](_0xff353d['query']);_0x3cc245['filters']=_[_0xe2c5('0x45')](_0x3cc245['model'],_0x3cc245[_0xe2c5('0x32')]);_0x1890fe['attributes']=_[_0xe2c5('0x45')](_0x3cc245['model'],qs['fields'](_0xff353d[_0xe2c5('0x32')]['fields']));_0x1890fe[_0xe2c5('0x37')]=_0x1890fe[_0xe2c5('0x37')][_0xe2c5('0x46')]?_0x1890fe[_0xe2c5('0x37')]:_0x3cc245[_0xe2c5('0x35')];_0x1890fe['order']=qs[_0xe2c5('0x39')](_0xff353d[_0xe2c5('0x32')][_0xe2c5('0x39')]);_0x1890fe[_0xe2c5('0x3c')]=qs[_0xe2c5('0x34')](_[_0xe2c5('0x3a')](_0xff353d['query'],_0x3cc245['filters']));if(_0xff353d[_0xe2c5('0x32')]['filter']){_0x1890fe['where']=_['merge'](_0x1890fe[_0xe2c5('0x3c')],{'$or':_['map'](_0x1890fe[_0xe2c5('0x37')],function(_0x261ba9){var _0x3fd286={};_0x3fd286[_0x261ba9]={'$like':'%'+_0xff353d[_0xe2c5('0x32')]['filter']+'%'};return _0x3fd286;})});}_0x1890fe=_['merge']({},_0x1890fe,_0xff353d[_0xe2c5('0x3f')]);return _0x4478c3[_0xe2c5('0x79')](_0x1890fe);}})[_0xe2c5('0x26')](function(_0x1af378){if(_0x1af378){_0x2b9fb4=_0x1af378[_0xe2c5('0x46')];if(!_0xff353d[_0xe2c5('0x32')]['hasOwnProperty'](_0xe2c5('0x7b'))){_0x1890fe[_0xe2c5('0x1f')]=qs[_0xe2c5('0x1f')](_0xff353d[_0xe2c5('0x32')][_0xe2c5('0x1f')]);_0x1890fe['offset']=qs['offset'](_0xff353d[_0xe2c5('0x32')][_0xe2c5('0x1d')]);}return _0x4478c3[_0xe2c5('0x79')](_0x1890fe);}})['then'](function(_0x2b6d58){if(_0x2b6d58){return _0x2b6d58?{'count':_0x2b9fb4,'rows':_0x2b6d58}:null;}})[_0xe2c5('0x26')](respondWithResult(_0x47b757,null))[_0xe2c5('0x43')](handleError(_0x47b757,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a6c369c..3f174b8 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 _0xfa2c=['Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x14a5c5,_0x4d4186){var _0x4e8c6c=function(_0x1a948c){while(--_0x1a948c){_0x14a5c5['push'](_0x14a5c5['shift']());}};_0x4e8c6c(++_0x4d4186);}(_0xfa2c,0x1e4));var _0xcfa2=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0xfa2c[_0x562ec5];return _0x279c8c;};'use strict';var EventEmitter=require(_0xcfa2('0x0'));var Dashboard=require(_0xcfa2('0x1'))['db'][_0xcfa2('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xcfa2('0x3')](0x0);var events={'afterCreate':_0xcfa2('0x4'),'afterUpdate':_0xcfa2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x587ef1){return function(_0x6ad29f,_0x36229e,_0x55aaab){DashboardEvents[_0xcfa2('0x6')](_0x587ef1+':'+_0x6ad29f['id'],_0x6ad29f);DashboardEvents['emit'](_0x587ef1,_0x6ad29f);_0x55aaab(null);};}for(var e in events){if(events[_0xcfa2('0x7')](e)){var event=events[e];Dashboard[_0xcfa2('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x9583=['events','../../mysqldb','Dashboard','save','emit','hook','exports'];(function(_0x51069d,_0x51ce9d){var _0x3d9440=function(_0x14f0e5){while(--_0x14f0e5){_0x51069d['push'](_0x51069d['shift']());}};_0x3d9440(++_0x51ce9d);}(_0x9583,0xcb));var _0x3958=function(_0x43aac1,_0x181944){_0x43aac1=_0x43aac1-0x0;var _0x3cc143=_0x9583[_0x43aac1];return _0x3cc143;};'use strict';var EventEmitter=require(_0x3958('0x0'));var Dashboard=require(_0x3958('0x1'))['db'][_0x3958('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3958('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x54d56a){return function(_0x432cf7,_0x3b9d9c,_0xeab3b4){DashboardEvents[_0x3958('0x4')](_0x54d56a+':'+_0x432cf7['id'],_0x432cf7);DashboardEvents[_0x3958('0x4')](_0x54d56a,_0x432cf7);_0xeab3b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x3958('0x5')](e,emitEvent(event));}}module[_0x3958('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d2973ed..6e16e9a 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 _0x5f4e=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','Dashboard'];(function(_0x2ceaa7,_0xb70f45){var _0x34648f=function(_0x1716ee){while(--_0x1716ee){_0x2ceaa7['push'](_0x2ceaa7['shift']());}};_0x34648f(++_0xb70f45);}(_0x5f4e,0x1cc));var _0xe5f4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f4e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe5f4('0x0'));var util=require(_0xe5f4('0x1'));var logger=require('../../config/logger')(_0xe5f4('0x2'));var moment=require(_0xe5f4('0x3'));var BPromise=require(_0xe5f4('0x4'));var rp=require(_0xe5f4('0x5'));var fs=require('fs');var path=require(_0xe5f4('0x6'));var rimraf=require(_0xe5f4('0x7'));var config=require(_0xe5f4('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x44f13b,_0x40d50d){return _0x44f13b['define'](_0xe5f4('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeff=['api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util'];(function(_0x15ca40,_0x3fed78){var _0x5be3f1=function(_0x1e58d4){while(--_0x1e58d4){_0x15ca40['push'](_0x15ca40['shift']());}};_0x5be3f1(++_0x3fed78);}(_0xdeff,0x82));var _0xfdef=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xdeff[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0xfdef('0x0'));var util=require(_0xfdef('0x1'));var logger=require('../../config/logger')(_0xfdef('0x2'));var moment=require(_0xfdef('0x3'));var BPromise=require(_0xfdef('0x4'));var rp=require(_0xfdef('0x5'));var fs=require('fs');var path=require(_0xfdef('0x6'));var rimraf=require('rimraf');var config=require(_0xfdef('0x7'));var attributes=require(_0xfdef('0x8'));module[_0xfdef('0x9')]=function(_0x4a14ab,_0x5e3669){return _0x4a14ab[_0xfdef('0xa')](_0xfdef('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 139efcf..3d529b4 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 _0x5cff=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','localhost','request','info','Dashboard,\x20%s,\x20%s'];(function(_0x17d713,_0x19b690){var _0x452666=function(_0xaff2b4){while(--_0xaff2b4){_0x17d713['push'](_0x17d713['shift']());}};_0x452666(++_0x19b690);}(_0x5cff,0x129));var _0xf5cf=function(_0x5efaf0,_0x4cfe84){_0x5efaf0=_0x5efaf0-0x0;var _0x202e48=_0x5cff[_0x5efaf0];return _0x202e48;};'use strict';var _=require(_0xf5cf('0x0'));var util=require(_0xf5cf('0x1'));var moment=require(_0xf5cf('0x2'));var BPromise=require(_0xf5cf('0x3'));var rs=require(_0xf5cf('0x4'));var fs=require('fs');var Redis=require(_0xf5cf('0x5'));var db=require(_0xf5cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf5cf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5cf('0x8')][_0xf5cf('0x9')]({'port':0x232a});config[_0xf5cf('0xa')]=_['defaults'](config[_0xf5cf('0xa')],{'host':_0xf5cf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5cf('0xa')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x5d27e2,_0x5c42ba,_0xe44988){return new BPromise(function(_0x197515,_0x3ba017){return client[_0xf5cf('0xc')](_0x5d27e2,_0xe44988)['then'](function(_0x57e1de){logger[_0xf5cf('0xd')](_0xf5cf('0xe'),_0x5c42ba,_0xf5cf('0xf'));logger[_0xf5cf('0x10')](_0xf5cf('0x11'),_0x5c42ba,_0xf5cf('0xf'),JSON[_0xf5cf('0x12')](_0x57e1de));if(_0x57e1de[_0xf5cf('0x13')]){if(_0x57e1de[_0xf5cf('0x13')][_0xf5cf('0x14')]===0x1f4){logger[_0xf5cf('0x13')](_0xf5cf('0xe'),_0x5c42ba,_0x57e1de[_0xf5cf('0x13')]['message']);return _0x3ba017(_0x57e1de['error'][_0xf5cf('0x15')]);}logger[_0xf5cf('0x13')](_0xf5cf('0xe'),_0x5c42ba,_0x57e1de[_0xf5cf('0x13')]['message']);return _0x197515(_0x57e1de[_0xf5cf('0x13')][_0xf5cf('0x15')]);}else{logger['info'](_0xf5cf('0xe'),_0x5c42ba,_0xf5cf('0xf'));_0x197515(_0x57e1de[_0xf5cf('0x16')]['message']);}})[_0xf5cf('0x17')](function(_0x1a0717){logger[_0xf5cf('0x13')](_0xf5cf('0xe'),_0x5c42ba,_0x1a0717);_0x3ba017(_0x1a0717);});});} \ No newline at end of file +var _0x3703=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3703,0x8a));var _0x3370=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x3703[_0x421263];return _0x34e4b5;};'use strict';var _=require(_0x3370('0x0'));var util=require(_0x3370('0x1'));var moment=require(_0x3370('0x2'));var BPromise=require(_0x3370('0x3'));var rs=require(_0x3370('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3370('0x5'))(_0x3370('0x6'));var config=require(_0x3370('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3370('0x8')][_0x3370('0x9')]({'port':0x232a});config[_0x3370('0xa')]=_[_0x3370('0xb')](config[_0x3370('0xa')],{'host':_0x3370('0xc'),'port':0x18eb});var socket=require(_0x3370('0xd'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x48c3d0,_0x2b09b8,_0x5a5f7f){return new BPromise(function(_0x1b396c,_0x3299fb){return client[_0x3370('0xe')](_0x48c3d0,_0x5a5f7f)[_0x3370('0xf')](function(_0x50890c){logger[_0x3370('0x10')](_0x3370('0x11'),_0x2b09b8,_0x3370('0x12'));logger[_0x3370('0x13')](_0x3370('0x14'),_0x2b09b8,'request\x20sent',JSON[_0x3370('0x15')](_0x50890c));if(_0x50890c[_0x3370('0x16')]){if(_0x50890c[_0x3370('0x16')][_0x3370('0x17')]===0x1f4){logger[_0x3370('0x16')](_0x3370('0x11'),_0x2b09b8,_0x50890c[_0x3370('0x16')][_0x3370('0x18')]);return _0x3299fb(_0x50890c['error'][_0x3370('0x18')]);}logger['error'](_0x3370('0x11'),_0x2b09b8,_0x50890c[_0x3370('0x16')][_0x3370('0x18')]);return _0x1b396c(_0x50890c[_0x3370('0x16')][_0x3370('0x18')]);}else{logger[_0x3370('0x10')](_0x3370('0x11'),_0x2b09b8,_0x3370('0x12'));_0x1b396c(_0x50890c[_0x3370('0x19')][_0x3370('0x18')]);}})['catch'](function(_0x50b14b){logger[_0x3370('0x16')](_0x3370('0x11'),_0x2b09b8,_0x50b14b);_0x3299fb(_0x50b14b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2f033da..3563e05 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 _0xd86d=['update','emit','removeListener','length','dashboard:','./dashboard.events','remove'];(function(_0x3d859b,_0x1fb1ae){var _0x8a14ec=function(_0x333dc4){while(--_0x333dc4){_0x3d859b['push'](_0x3d859b['shift']());}};_0x8a14ec(++_0x1fb1ae);}(_0xd86d,0x116));var _0xdd86=function(_0x14b26a,_0x2d4f23){_0x14b26a=_0x14b26a-0x0;var _0x2141e4=_0xd86d[_0x14b26a];return _0x2141e4;};'use strict';var DashboardEvents=require(_0xdd86('0x0'));var events=['save',_0xdd86('0x1'),_0xdd86('0x2')];function createListener(_0x15b4e0,_0x5eda1a){return function(_0x4f505a){_0x5eda1a[_0xdd86('0x3')](_0x15b4e0,_0x4f505a);};}function removeListener(_0x1a0fea,_0x524b64){return function(){DashboardEvents[_0xdd86('0x4')](_0x1a0fea,_0x524b64);};}exports['register']=function(_0x30910e){for(var _0x3336c3=0x0,_0x5cd294=events[_0xdd86('0x5')];_0x3336c3<_0x5cd294;_0x3336c3++){var _0x5cf6cc=events[_0x3336c3];var _0x329755=createListener(_0xdd86('0x6')+_0x5cf6cc,_0x30910e);DashboardEvents['on'](_0x5cf6cc,_0x329755);}}; \ No newline at end of file +var _0x3623=['length','dashboard:','save','remove','emit','register'];(function(_0x165615,_0x5db1d5){var _0x2ed9e0=function(_0x1acbe8){while(--_0x1acbe8){_0x165615['push'](_0x165615['shift']());}};_0x2ed9e0(++_0x5db1d5);}(_0x3623,0x74));var _0x3362=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0x3623[_0x2df84d];return _0x2634ce;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x3362('0x0'),_0x3362('0x1'),'update'];function createListener(_0x110c52,_0x2f0a4d){return function(_0x20434c){_0x2f0a4d[_0x3362('0x2')](_0x110c52,_0x20434c);};}function removeListener(_0x28523e,_0x49a998){return function(){DashboardEvents['removeListener'](_0x28523e,_0x49a998);};}exports[_0x3362('0x3')]=function(_0x371a02){for(var _0x2e98cf=0x0,_0x533f91=events[_0x3362('0x4')];_0x2e98cf<_0x533f91;_0x2e98cf++){var _0x15b736=events[_0x2e98cf];var _0x2469e5=createListener(_0x3362('0x5')+_0x15b736,_0x371a02);DashboardEvents['on'](_0x15b736,_0x2469e5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f07a83a..b5de714 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 _0x80ec=['/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getItems','create','post','/:id/clone','clone','/:id/items','addItem','put','update','delete'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x80ec,0x182));var _0xc80e=function(_0x5e7b03,_0x43a679){_0x5e7b03=_0x5e7b03-0x0;var _0x292226=_0x80ec[_0x5e7b03];return _0x292226;};'use strict';var multer=require(_0xc80e('0x0'));var util=require(_0xc80e('0x1'));var path=require(_0xc80e('0x2'));var timeout=require(_0xc80e('0x3'));var express=require(_0xc80e('0x4'));var router=express['Router']();var fs_extra=require(_0xc80e('0x5'));var auth=require(_0xc80e('0x6'));var interaction=require(_0xc80e('0x7'));var config=require(_0xc80e('0x8'));var controller=require('./dashboard.controller');router[_0xc80e('0x9')]('/',auth[_0xc80e('0xa')](),controller['index']);router[_0xc80e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc80e('0xb')]);router['get']('/:id/items',auth['isAuthenticated'](),controller[_0xc80e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc80e('0xd')]);router[_0xc80e('0xe')](_0xc80e('0xf'),auth[_0xc80e('0xa')](),controller[_0xc80e('0x10')]);router['post'](_0xc80e('0x11'),auth[_0xc80e('0xa')](),controller[_0xc80e('0x12')]);router[_0xc80e('0x13')]('/:id',auth[_0xc80e('0xa')](),controller[_0xc80e('0x14')]);router[_0xc80e('0x15')](_0xc80e('0x16'),auth[_0xc80e('0xa')](),controller[_0xc80e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5f6d=['create','/:id/clone','clone','addItem','put','/:id','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post'];(function(_0xb92b7a,_0x1cb4e7){var _0x4b2aac=function(_0x3c3103){while(--_0x3c3103){_0xb92b7a['push'](_0xb92b7a['shift']());}};_0x4b2aac(++_0x1cb4e7);}(_0x5f6d,0x162));var _0xd5f6=function(_0x6ee51a,_0xc35002){_0x6ee51a=_0x6ee51a-0x0;var _0x3b6017=_0x5f6d[_0x6ee51a];return _0x3b6017;};'use strict';var multer=require(_0xd5f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd5f6('0x1'));var express=require(_0xd5f6('0x2'));var router=express['Router']();var fs_extra=require(_0xd5f6('0x3'));var auth=require(_0xd5f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd5f6('0x5'));var controller=require(_0xd5f6('0x6'));router[_0xd5f6('0x7')]('/',auth[_0xd5f6('0x8')](),controller[_0xd5f6('0x9')]);router['get']('/:id',auth[_0xd5f6('0x8')](),controller[_0xd5f6('0xa')]);router[_0xd5f6('0x7')](_0xd5f6('0xb'),auth[_0xd5f6('0x8')](),controller[_0xd5f6('0xc')]);router[_0xd5f6('0xd')]('/',auth[_0xd5f6('0x8')](),controller[_0xd5f6('0xe')]);router[_0xd5f6('0xd')](_0xd5f6('0xf'),auth[_0xd5f6('0x8')](),controller[_0xd5f6('0x10')]);router[_0xd5f6('0xd')](_0xd5f6('0xb'),auth[_0xd5f6('0x8')](),controller[_0xd5f6('0x11')]);router[_0xd5f6('0x12')](_0xd5f6('0x13'),auth[_0xd5f6('0x8')](),controller['update']);router[_0xd5f6('0x14')](_0xd5f6('0x13'),auth['isAuthenticated'](),controller[_0xd5f6('0x15')]);module[_0xd5f6('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8c0db71..adb7591 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 _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x5b6dd2,_0x43f939){var _0x4a62e8=function(_0xa07ca4){while(--_0xa07ca4){_0x5b6dd2['push'](_0x5b6dd2['shift']());}};_0x4a62e8(++_0x43f939);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xabce=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabce,0x103));var _0xeabc=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xabce[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0xeabc('0x0'));var squel=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));module[_0xeabc('0x3')]={'title':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xeabc('0x5')),'get':function(){try{return JSON[_0xeabc('0x6')](this[_0xeabc('0x7')]('attrs'));}catch(_0x54e4a8){return[];}},'set':function(_0x1b07a8){try{this['setDataValue'](_0xeabc('0x8'),JSON['stringify'](_0x1b07a8));}catch(_0x3bdc29){this[_0xeabc('0x9')](_0xeabc('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeabc('0xa')]},'col':{'type':Sequelize[_0xeabc('0xa')]},'background':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xeabc('0x4')]},'titleFontSize':{'type':Sequelize[_0xeabc('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 75a24af..1256cac 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 _0x8efc=['apply','reject','update','then','destroy','error','name','show','model','rawAttributes','keys','intersection','query','attributes','fields','includeAll','include','options','DashboardItem','find','catch','params','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSmsAccounts','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','zip-dir','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','limit','set','Content-Range','json'];(function(_0x12b6df,_0x5571aa){var _0x4ec969=function(_0x3f7965){while(--_0x3f7965){_0x12b6df['push'](_0x12b6df['shift']());}};_0x4ec969(++_0x5571aa);}(_0x8efc,0x8f));var _0xc8ef=function(_0x1f8f66,_0x5dc25a){_0x1f8f66=_0x1f8f66-0x0;var _0x3b992d=_0x8efc[_0x1f8f66];return _0x3b992d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc8ef('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8ef('0x1'));var moment=require('moment');var BPromise=require(_0xc8ef('0x2'));var Mustache=require(_0xc8ef('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc8ef('0x4'));var csv=require('to-csv');var ejs=require(_0xc8ef('0x5'));var fs=require('fs');var fs_extra=require(_0xc8ef('0x6'));var _=require(_0xc8ef('0x7'));var squel=require(_0xc8ef('0x8'));var crypto=require(_0xc8ef('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc8ef('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc8ef('0xb'));var Papa=require(_0xc8ef('0xc'));var Redis=require(_0xc8ef('0xd'));var authService=require(_0xc8ef('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8ef('0xf'))(_0xc8ef('0x10'));var utils=require(_0xc8ef('0x11'));var config=require(_0xc8ef('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8ef('0x13'))['db'];config[_0xc8ef('0x14')]=_[_0xc8ef('0x15')](config[_0xc8ef('0x14')],{'host':_0xc8ef('0x16'),'port':0x18eb});var socket=require(_0xc8ef('0x17'))(new Redis(config[_0xc8ef('0x14')]));require(_0xc8ef('0x18'))['register'](socket);function respondWithStatusCode(_0x562685,_0xc4572e){_0xc4572e=_0xc4572e||0xcc;return function(_0x2d9ecf){if(_0x2d9ecf){return _0x562685[_0xc8ef('0x19')](_0xc4572e);}return _0x562685[_0xc8ef('0x1a')](_0xc4572e)[_0xc8ef('0x1b')]();};}function respondWithResult(_0x19054b,_0x957bb6){_0x957bb6=_0x957bb6||0xc8;return function(_0x4026c6){if(_0x4026c6){return _0x19054b['status'](_0x957bb6)['json'](_0x4026c6);}};}function respondWithFilteredResult(_0x38cad6,_0x1dc488){return function(_0x166ec4){if(_0x166ec4){var _0x183c85=typeof _0x1dc488['offset']==='undefined'&&typeof _0x1dc488['limit']==='undefined';var _0x14f7a0=_0x166ec4['count'];var _0x46a1b7=_0x183c85?0x0:_0x1dc488[_0xc8ef('0x1c')];var _0x12d604=_0x183c85?_0x166ec4['count']:_0x1dc488[_0xc8ef('0x1c')]+_0x1dc488[_0xc8ef('0x1d')];var _0x190ec2;if(_0x12d604>=_0x14f7a0){_0x12d604=_0x14f7a0;_0x190ec2=0xc8;}else{_0x190ec2=0xce;}_0x38cad6[_0xc8ef('0x1a')](_0x190ec2);return _0x38cad6[_0xc8ef('0x1e')](_0xc8ef('0x1f'),_0x46a1b7+'-'+_0x12d604+'/'+_0x14f7a0)[_0xc8ef('0x20')](_0x166ec4);}return null;};}function patchUpdates(_0x16bf51){return function(_0x20204f){try{jsonpatch[_0xc8ef('0x21')](_0x20204f,_0x16bf51,!![]);}catch(_0x1790d1){return BPromise[_0xc8ef('0x22')](_0x1790d1);}return _0x20204f['save']();};}function saveUpdates(_0x509619,_0x24b251){return function(_0x3688aa){if(_0x3688aa){return _0x3688aa[_0xc8ef('0x23')](_0x509619)[_0xc8ef('0x24')](function(_0x16c6d4){return _0x16c6d4;});}return null;};}function removeEntity(_0x50238c,_0x5093d3){return function(_0x14c3d0){if(_0x14c3d0){return _0x14c3d0[_0xc8ef('0x25')]()[_0xc8ef('0x24')](function(){_0x50238c['status'](0xcc)[_0xc8ef('0x1b')]();});}};}function handleEntityNotFound(_0x3d7a62,_0xf285d9){return function(_0xc6749){if(!_0xc6749){_0x3d7a62['sendStatus'](0x194);}return _0xc6749;};}function handleError(_0x5524dc,_0x1aad6e){_0x1aad6e=_0x1aad6e||0x1f4;return function(_0xc203df){logger[_0xc8ef('0x26')](_0xc203df['stack']);if(_0xc203df[_0xc8ef('0x27')]){delete _0xc203df[_0xc8ef('0x27')];}_0x5524dc[_0xc8ef('0x1a')](_0x1aad6e)['send'](_0xc203df);};}exports[_0xc8ef('0x28')]=function(_0x5c7b7b,_0x30dd95){var _0x3a54d4={'raw':![],'where':{'id':_0x5c7b7b['params']['id']}},_0x17c07c={};_0x17c07c[_0xc8ef('0x29')]=_['keys'](db['DashboardItem'][_0xc8ef('0x2a')]);_0x17c07c['query']=_[_0xc8ef('0x2b')](_0x5c7b7b['query']);_0x17c07c['filters']=_[_0xc8ef('0x2c')](_0x17c07c[_0xc8ef('0x29')],_0x17c07c[_0xc8ef('0x2d')]);_0x3a54d4[_0xc8ef('0x2e')]=_[_0xc8ef('0x2c')](_0x17c07c[_0xc8ef('0x29')],qs['fields'](_0x5c7b7b[_0xc8ef('0x2d')][_0xc8ef('0x2f')]));_0x3a54d4['attributes']=_0x3a54d4[_0xc8ef('0x2e')]['length']?_0x3a54d4['attributes']:_0x17c07c[_0xc8ef('0x29')];if(_0x5c7b7b[_0xc8ef('0x2d')][_0xc8ef('0x30')]){_0x3a54d4[_0xc8ef('0x31')]=[{'all':!![]}];}_0x3a54d4=_['merge']({},_0x3a54d4,_0x5c7b7b[_0xc8ef('0x32')]);return db[_0xc8ef('0x33')][_0xc8ef('0x34')](_0x3a54d4)[_0xc8ef('0x24')](handleEntityNotFound(_0x30dd95,null))[_0xc8ef('0x24')](respondWithResult(_0x30dd95,null))[_0xc8ef('0x35')](handleError(_0x30dd95,null));};exports[_0xc8ef('0x25')]=function(_0x5d32c8,_0x21e53d){return db['DashboardItem']['find']({'where':{'id':_0x5d32c8[_0xc8ef('0x36')]['id']}})[_0xc8ef('0x24')](handleEntityNotFound(_0x21e53d,null))[_0xc8ef('0x24')](removeEntity(_0x21e53d,null))[_0xc8ef('0x35')](handleError(_0x21e53d,null));};function widgetAttributes(_0xc1f2cf){try{switch(_0xc1f2cf[_0xc8ef('0x37')]){case _0xc8ef('0x38'):return[{'name':_0xc8ef('0x39'),'value':_0xc1f2cf[_0xc8ef('0x39')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||'https://'}];case'custom':return[{'name':_0xc8ef('0x3c'),'value':_0xc1f2cf[_0xc8ef('0x3c')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0]['value']:undefined)||''}];case _0xc8ef('0x3d'):return[{'name':_0xc8ef('0x3e'),'value':_0xc1f2cf['attrHourFormat']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x3f')},{'name':_0xc8ef('0x40'),'value':_0xc1f2cf['attrTimezone']||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x41')},{'name':'attrFontSize','value':_0xc1f2cf[_0xc8ef('0x42')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x2]?_0xc1f2cf[_0xc8ef('0x3a')][0x2][_0xc8ef('0x3b')]:undefined)||0xc}];case _0xc8ef('0x43'):return[{'name':_0xc8ef('0x44'),'value':_0xc1f2cf['attrMetric']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x45')},{'name':_0xc8ef('0x46'),'value':_0xc1f2cf[_0xc8ef('0x46')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||[]},{'name':_0xc8ef('0x42'),'value':_0xc1f2cf[_0xc8ef('0x42')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x2]?_0xc1f2cf[_0xc8ef('0x3a')][0x2]['value']:undefined)||0x14},{'name':_0xc8ef('0x47'),'value':_0xc1f2cf[_0xc8ef('0x47')]||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x3]?_0xc1f2cf['attrs'][0x3][_0xc8ef('0x3b')]:undefined)||'voice'},{'name':_0xc8ef('0x48'),'value':_0xc1f2cf[_0xc8ef('0x48')]||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0x4]?_0xc1f2cf['attrs'][0x4]['value']:undefined)||''},{'name':_0xc8ef('0x49'),'value':_0xc1f2cf[_0xc8ef('0x49')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x5]?_0xc1f2cf[_0xc8ef('0x3a')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0xc1f2cf['attrSmsAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x6]?_0xc1f2cf[_0xc8ef('0x3a')][0x6][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x4a'),'value':_0xc1f2cf[_0xc8ef('0x4a')]||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x7]?_0xc1f2cf[_0xc8ef('0x3a')][0x7]['value']:undefined)||''},{'name':_0xc8ef('0x4b'),'value':_0xc1f2cf['attrWhatsappAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x8]?_0xc1f2cf['attrs'][0x8][_0xc8ef('0x3b')]:undefined)||''},{'name':'attrChatWebsites','value':_0xc1f2cf[_0xc8ef('0x4c')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x9]?_0xc1f2cf[_0xc8ef('0x3a')][0x9]['value']:undefined)||''}];case _0xc8ef('0x4d'):case _0xc8ef('0x4e'):return[{'name':_0xc8ef('0x4f'),'value':_0xc1f2cf['attrSerie1']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x45')},{'name':_0xc8ef('0x50'),'value':_0xc1f2cf[_0xc8ef('0x50')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||null},{'name':'attrSerie3','value':_0xc1f2cf['attrSerie3']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x2]?_0xc1f2cf[_0xc8ef('0x3a')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0xc1f2cf[_0xc8ef('0x46')]||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0x3]?_0xc1f2cf[_0xc8ef('0x3a')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0xc1f2cf['attrChannel']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x4]?_0xc1f2cf['attrs'][0x4][_0xc8ef('0x3b')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0xc1f2cf[_0xc8ef('0x48')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x5]?_0xc1f2cf[_0xc8ef('0x3a')][0x5][_0xc8ef('0x3b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xc1f2cf['attrFaxAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x6]?_0xc1f2cf['attrs'][0x6][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x51'),'value':_0xc1f2cf['attrSmsAccounts']||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0x7]?_0xc1f2cf[_0xc8ef('0x3a')][0x7]['value']:undefined)||''},{'name':_0xc8ef('0x4a'),'value':_0xc1f2cf[_0xc8ef('0x4a')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x8]?_0xc1f2cf['attrs'][0x8][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x4b'),'value':_0xc1f2cf['attrWhatsappAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x9]?_0xc1f2cf[_0xc8ef('0x3a')][0x9][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x4c'),'value':_0xc1f2cf[_0xc8ef('0x4c')]||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0xa]?_0xc1f2cf[_0xc8ef('0x3a')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xc8ef('0x52'),'type':_0xc1f2cf['reportType']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x37')]:undefined)||null,'value':_0xc1f2cf[_0xc8ef('0x52')]||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||null},{'name':_0xc8ef('0x53'),'value':_0xc1f2cf[_0xc8ef('0x53')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x36f35b){logger[_0xc8ef('0x26')](_0xc8ef('0x54'),JSON[_0xc8ef('0x55')](_0x36f35b));return[];}}exports[_0xc8ef('0x56')]=function(_0x493bc8,_0x403dee){if(_0x493bc8[_0xc8ef('0x57')]){_0x493bc8[_0xc8ef('0x57')][_0xc8ef('0x3a')]=widgetAttributes(_0x493bc8[_0xc8ef('0x57')]);}return db['DashboardItem'][_0xc8ef('0x56')](_0x493bc8[_0xc8ef('0x57')],{})[_0xc8ef('0x24')](respondWithResult(_0x403dee,0xc9))['catch'](handleError(_0x403dee,null));};exports[_0xc8ef('0x23')]=function(_0x5c8bfa,_0x23dc4a){if(_0x5c8bfa[_0xc8ef('0x57')]['id']){delete _0x5c8bfa[_0xc8ef('0x57')]['id'];}_0x5c8bfa[_0xc8ef('0x57')][_0xc8ef('0x3a')]=widgetAttributes(_0x5c8bfa['body']);return db[_0xc8ef('0x33')][_0xc8ef('0x34')]({'where':{'id':_0x5c8bfa[_0xc8ef('0x36')]['id']}})['then'](handleEntityNotFound(_0x23dc4a,null))[_0xc8ef('0x24')](saveUpdates(_0x5c8bfa[_0xc8ef('0x57')],null))['then'](respondWithResult(_0x23dc4a,null))[_0xc8ef('0x35')](handleError(_0x23dc4a,null));}; \ No newline at end of file +var _0xb145=['localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','name','show','model','keys','query','intersection','attributes','fields','include','options','DashboardItem','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x2daca8,_0x1def67){var _0x17d635=function(_0x4235d2){while(--_0x4235d2){_0x2daca8['push'](_0x2daca8['shift']());}};_0x17d635(++_0x1def67);}(_0xb145,0xa3));var _0x5b14=function(_0x4f52d6,_0x10798c){_0x4f52d6=_0x4f52d6-0x0;var _0x412e9e=_0xb145[_0x4f52d6];return _0x412e9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];config[_0x5b14('0x19')]=_[_0x5b14('0x1a')](config[_0x5b14('0x19')],{'host':_0x5b14('0x1b'),'port':0x18eb});var socket=require(_0x5b14('0x1c'))(new Redis(config['redis']));require(_0x5b14('0x1d'))[_0x5b14('0x1e')](socket);function respondWithStatusCode(_0x35fb8b,_0x1dfa26){_0x1dfa26=_0x1dfa26||0xcc;return function(_0xba7e13){if(_0xba7e13){return _0x35fb8b[_0x5b14('0x1f')](_0x1dfa26);}return _0x35fb8b[_0x5b14('0x20')](_0x1dfa26)[_0x5b14('0x21')]();};}function respondWithResult(_0x183b0a,_0x287bb7){_0x287bb7=_0x287bb7||0xc8;return function(_0x221344){if(_0x221344){return _0x183b0a[_0x5b14('0x20')](_0x287bb7)['json'](_0x221344);}};}function respondWithFilteredResult(_0x24cfd0,_0x50866a){return function(_0x48d395){if(_0x48d395){var _0x58bf3c=typeof _0x50866a[_0x5b14('0x22')]===_0x5b14('0x23')&&typeof _0x50866a[_0x5b14('0x24')]===_0x5b14('0x23');var _0x3786f7=_0x48d395[_0x5b14('0x25')];var _0x19e6f8=_0x58bf3c?0x0:_0x50866a['offset'];var _0x525176=_0x58bf3c?_0x48d395['count']:_0x50866a[_0x5b14('0x22')]+_0x50866a[_0x5b14('0x24')];var _0x9a9495;if(_0x525176>=_0x3786f7){_0x525176=_0x3786f7;_0x9a9495=0xc8;}else{_0x9a9495=0xce;}_0x24cfd0[_0x5b14('0x20')](_0x9a9495);return _0x24cfd0['set'](_0x5b14('0x26'),_0x19e6f8+'-'+_0x525176+'/'+_0x3786f7)[_0x5b14('0x27')](_0x48d395);}return null;};}function patchUpdates(_0x4857c7){return function(_0x2d7b38){try{jsonpatch[_0x5b14('0x28')](_0x2d7b38,_0x4857c7,!![]);}catch(_0x50951f){return BPromise[_0x5b14('0x29')](_0x50951f);}return _0x2d7b38['save']();};}function saveUpdates(_0x59282c,_0x5e0780){return function(_0x4def4b){if(_0x4def4b){return _0x4def4b[_0x5b14('0x2a')](_0x59282c)[_0x5b14('0x2b')](function(_0x153a25){return _0x153a25;});}return null;};}function removeEntity(_0x5da505,_0x46f86a){return function(_0x3bf8e5){if(_0x3bf8e5){return _0x3bf8e5[_0x5b14('0x2c')]()[_0x5b14('0x2b')](function(){_0x5da505[_0x5b14('0x20')](0xcc)[_0x5b14('0x21')]();});}};}function handleEntityNotFound(_0x422d22,_0x205842){return function(_0x296d65){if(!_0x296d65){_0x422d22[_0x5b14('0x1f')](0x194);}return _0x296d65;};}function handleError(_0xbe39bc,_0x1ab33f){_0x1ab33f=_0x1ab33f||0x1f4;return function(_0x1c3c52){logger[_0x5b14('0x2d')](_0x1c3c52['stack']);if(_0x1c3c52[_0x5b14('0x2e')]){delete _0x1c3c52[_0x5b14('0x2e')];}_0xbe39bc['status'](_0x1ab33f)['send'](_0x1c3c52);};}exports[_0x5b14('0x2f')]=function(_0x3fb23b,_0x5dca4f){var _0x4c1f0e={'raw':![],'where':{'id':_0x3fb23b['params']['id']}},_0x21b43b={};_0x21b43b[_0x5b14('0x30')]=_[_0x5b14('0x31')](db['DashboardItem']['rawAttributes']);_0x21b43b[_0x5b14('0x32')]=_[_0x5b14('0x31')](_0x3fb23b[_0x5b14('0x32')]);_0x21b43b['filters']=_[_0x5b14('0x33')](_0x21b43b['model'],_0x21b43b[_0x5b14('0x32')]);_0x4c1f0e[_0x5b14('0x34')]=_[_0x5b14('0x33')](_0x21b43b[_0x5b14('0x30')],qs['fields'](_0x3fb23b[_0x5b14('0x32')][_0x5b14('0x35')]));_0x4c1f0e[_0x5b14('0x34')]=_0x4c1f0e[_0x5b14('0x34')]['length']?_0x4c1f0e[_0x5b14('0x34')]:_0x21b43b[_0x5b14('0x30')];if(_0x3fb23b[_0x5b14('0x32')]['includeAll']){_0x4c1f0e[_0x5b14('0x36')]=[{'all':!![]}];}_0x4c1f0e=_['merge']({},_0x4c1f0e,_0x3fb23b[_0x5b14('0x37')]);return db[_0x5b14('0x38')]['find'](_0x4c1f0e)[_0x5b14('0x2b')](handleEntityNotFound(_0x5dca4f,null))[_0x5b14('0x2b')](respondWithResult(_0x5dca4f,null))['catch'](handleError(_0x5dca4f,null));};exports[_0x5b14('0x2c')]=function(_0x53e829,_0x1ce6bb){return db[_0x5b14('0x38')][_0x5b14('0x39')]({'where':{'id':_0x53e829[_0x5b14('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1ce6bb,null))[_0x5b14('0x2b')](removeEntity(_0x1ce6bb,null))[_0x5b14('0x3b')](handleError(_0x1ce6bb,null));};function widgetAttributes(_0x15d4c4){try{switch(_0x15d4c4[_0x5b14('0x3c')]){case _0x5b14('0x3d'):return[{'name':_0x5b14('0x3e'),'value':_0x15d4c4[_0x5b14('0x3e')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x0]?_0x15d4c4[_0x5b14('0x3f')][0x0][_0x5b14('0x40')]:undefined)||_0x5b14('0x41')}];case _0x5b14('0x42'):return[{'name':_0x5b14('0x43'),'value':_0x15d4c4[_0x5b14('0x43')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4['attrs'][0x0]?_0x15d4c4[_0x5b14('0x3f')][0x0]['value']:undefined)||''}];case _0x5b14('0x44'):return[{'name':_0x5b14('0x45'),'value':_0x15d4c4['attrHourFormat']||(_0x15d4c4['attrs']&&_0x15d4c4['attrs'][0x0]?_0x15d4c4[_0x5b14('0x3f')][0x0][_0x5b14('0x40')]:undefined)||'HH:mm:ss'},{'name':_0x5b14('0x46'),'value':_0x15d4c4[_0x5b14('0x46')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x1]?_0x15d4c4[_0x5b14('0x3f')][0x1]['value']:undefined)||_0x5b14('0x47')},{'name':_0x5b14('0x48'),'value':_0x15d4c4['attrFontSize']||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x2]?_0x15d4c4[_0x5b14('0x3f')][0x2][_0x5b14('0x40')]:undefined)||0xc}];case'counter':return[{'name':_0x5b14('0x49'),'value':_0x15d4c4[_0x5b14('0x49')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x0]?_0x15d4c4['attrs'][0x0][_0x5b14('0x40')]:undefined)||_0x5b14('0x4a')},{'name':_0x5b14('0x4b'),'value':_0x15d4c4[_0x5b14('0x4b')]||(_0x15d4c4['attrs']&&_0x15d4c4['attrs'][0x1]?_0x15d4c4[_0x5b14('0x3f')][0x1][_0x5b14('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x15d4c4[_0x5b14('0x48')]||(_0x15d4c4['attrs']&&_0x15d4c4[_0x5b14('0x3f')][0x2]?_0x15d4c4[_0x5b14('0x3f')][0x2][_0x5b14('0x40')]:undefined)||0x14},{'name':_0x5b14('0x4c'),'value':_0x15d4c4[_0x5b14('0x4c')]||(_0x15d4c4['attrs']&&_0x15d4c4[_0x5b14('0x3f')][0x3]?_0x15d4c4[_0x5b14('0x3f')][0x3][_0x5b14('0x40')]:undefined)||_0x5b14('0x4d')},{'name':_0x5b14('0x4e'),'value':_0x15d4c4['attrEmailAccounts']||(_0x15d4c4['attrs']&&_0x15d4c4[_0x5b14('0x3f')][0x4]?_0x15d4c4['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x15d4c4[_0x5b14('0x4f')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x5]?_0x15d4c4[_0x5b14('0x3f')][0x5][_0x5b14('0x40')]:undefined)||''},{'name':_0x5b14('0x50'),'value':_0x15d4c4[_0x5b14('0x50')]||(_0x15d4c4['attrs']&&_0x15d4c4['attrs'][0x6]?_0x15d4c4['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x15d4c4[_0x5b14('0x51')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x7]?_0x15d4c4[_0x5b14('0x3f')][0x7][_0x5b14('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x15d4c4['attrWhatsappAccounts']||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x8]?_0x15d4c4['attrs'][0x8][_0x5b14('0x40')]:undefined)||''},{'name':_0x5b14('0x52'),'value':_0x15d4c4['attrChatWebsites']||(_0x15d4c4['attrs']&&_0x15d4c4[_0x5b14('0x3f')][0x9]?_0x15d4c4[_0x5b14('0x3f')][0x9][_0x5b14('0x40')]:undefined)||''}];case'multibar-chart':case _0x5b14('0x53'):return[{'name':_0x5b14('0x54'),'value':_0x15d4c4[_0x5b14('0x54')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x0]?_0x15d4c4[_0x5b14('0x3f')][0x0][_0x5b14('0x40')]:undefined)||'total'},{'name':_0x5b14('0x55'),'value':_0x15d4c4['attrSerie2']||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x1]?_0x15d4c4[_0x5b14('0x3f')][0x1][_0x5b14('0x40')]:undefined)||null},{'name':_0x5b14('0x56'),'value':_0x15d4c4[_0x5b14('0x56')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x2]?_0x15d4c4[_0x5b14('0x3f')][0x2][_0x5b14('0x40')]:undefined)||null},{'name':_0x5b14('0x4b'),'value':_0x15d4c4[_0x5b14('0x4b')]||(_0x15d4c4['attrs']&&_0x15d4c4['attrs'][0x3]?_0x15d4c4['attrs'][0x3][_0x5b14('0x40')]:undefined)||[]},{'name':_0x5b14('0x4c'),'value':_0x15d4c4[_0x5b14('0x4c')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x4]?_0x15d4c4[_0x5b14('0x3f')][0x4][_0x5b14('0x40')]:undefined)||'voice'},{'name':_0x5b14('0x4e'),'value':_0x15d4c4[_0x5b14('0x4e')]||(_0x15d4c4['attrs']&&_0x15d4c4['attrs'][0x5]?_0x15d4c4[_0x5b14('0x3f')][0x5][_0x5b14('0x40')]:undefined)||''},{'name':_0x5b14('0x4f'),'value':_0x15d4c4[_0x5b14('0x4f')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x6]?_0x15d4c4['attrs'][0x6][_0x5b14('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x15d4c4[_0x5b14('0x50')]||(_0x15d4c4['attrs']&&_0x15d4c4[_0x5b14('0x3f')][0x7]?_0x15d4c4[_0x5b14('0x3f')][0x7][_0x5b14('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x15d4c4[_0x5b14('0x51')]||(_0x15d4c4['attrs']&&_0x15d4c4[_0x5b14('0x3f')][0x8]?_0x15d4c4[_0x5b14('0x3f')][0x8][_0x5b14('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x15d4c4[_0x5b14('0x57')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x9]?_0x15d4c4[_0x5b14('0x3f')][0x9]['value']:undefined)||''},{'name':_0x5b14('0x52'),'value':_0x15d4c4['attrChatWebsites']||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0xa]?_0x15d4c4['attrs'][0xa]['value']:undefined)||''}];case _0x5b14('0x58'):return[{'name':_0x5b14('0x59'),'type':_0x15d4c4[_0x5b14('0x5a')]||(_0x15d4c4['attrs']&&_0x15d4c4[_0x5b14('0x3f')][0x0]?_0x15d4c4[_0x5b14('0x3f')][0x0]['type']:undefined)||null,'value':_0x15d4c4[_0x5b14('0x59')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4[_0x5b14('0x3f')][0x0]?_0x15d4c4[_0x5b14('0x3f')][0x0][_0x5b14('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x15d4c4[_0x5b14('0x5b')]||(_0x15d4c4[_0x5b14('0x3f')]&&_0x15d4c4['attrs'][0x1]?_0x15d4c4['attrs'][0x1][_0x5b14('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x1b25e1){logger['error']('widgetAttributes:\x20%s',JSON[_0x5b14('0x5c')](_0x1b25e1));return[];}}exports[_0x5b14('0x5d')]=function(_0x327b7e,_0x5b4831){if(_0x327b7e[_0x5b14('0x5e')]){_0x327b7e[_0x5b14('0x5e')][_0x5b14('0x3f')]=widgetAttributes(_0x327b7e['body']);}return db[_0x5b14('0x38')][_0x5b14('0x5d')](_0x327b7e[_0x5b14('0x5e')],{})['then'](respondWithResult(_0x5b4831,0xc9))[_0x5b14('0x3b')](handleError(_0x5b4831,null));};exports[_0x5b14('0x2a')]=function(_0x215072,_0x2ca6dd){if(_0x215072[_0x5b14('0x5e')]['id']){delete _0x215072[_0x5b14('0x5e')]['id'];}_0x215072[_0x5b14('0x5e')]['attrs']=widgetAttributes(_0x215072['body']);return db['DashboardItem']['find']({'where':{'id':_0x215072[_0x5b14('0x3a')]['id']}})[_0x5b14('0x2b')](handleEntityNotFound(_0x2ca6dd,null))[_0x5b14('0x2b')](saveUpdates(_0x215072[_0x5b14('0x5e')],null))[_0x5b14('0x2b')](respondWithResult(_0x2ca6dd,null))['catch'](handleError(_0x2ca6dd,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f200fa7..4b983a2 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 _0x4d02=['DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5f25b2,_0x46fe2a){var _0x5fc13b=function(_0x52eb58){while(--_0x52eb58){_0x5f25b2['push'](_0x5f25b2['shift']());}};_0x5fc13b(++_0x46fe2a);}(_0x4d02,0x10c));var _0x24d0=function(_0x3fc59d,_0x57ecb6){_0x3fc59d=_0x3fc59d-0x0;var _0x4f900d=_0x4d02[_0x3fc59d];return _0x4f900d;};'use strict';var EventEmitter=require(_0x24d0('0x0'));var DashboardItem=require(_0x24d0('0x1'))['db'][_0x24d0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x24d0('0x3')](0x0);var events={'afterCreate':_0x24d0('0x4'),'afterUpdate':_0x24d0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x47cfe2){return function(_0xd8e803,_0xc8a73f,_0x787c4a){DashboardItemEvents[_0x24d0('0x6')](_0x47cfe2+':'+_0xd8e803['id'],_0xd8e803);DashboardItemEvents[_0x24d0('0x6')](_0x47cfe2,_0xd8e803);_0x787c4a(null);};}for(var e in events){if(events[_0x24d0('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x24d0('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x156d=['emit','hasOwnProperty','hook','exports','DashboardItem','setMaxListeners','save'];(function(_0x1e7261,_0x12a56f){var _0x1d5505=function(_0x54cadc){while(--_0x54cadc){_0x1e7261['push'](_0x1e7261['shift']());}};_0x1d5505(++_0x12a56f);}(_0x156d,0x162));var _0xd156=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x156d[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xd156('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd156('0x1')](0x0);var events={'afterCreate':_0xd156('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b432d){return function(_0x16a821,_0xf1f7c3,_0x27c11b){DashboardItemEvents['emit'](_0x3b432d+':'+_0x16a821['id'],_0x16a821);DashboardItemEvents[_0xd156('0x3')](_0x3b432d,_0x16a821);_0x27c11b(null);};}for(var e in events){if(events[_0xd156('0x4')](e)){var event=events[e];DashboardItem[_0xd156('0x5')](e,emitEvent(event));}}module[_0xd156('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b169e3a..a5b8dc9 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 _0xa87e=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa87e,0x118));var _0xea87=function(_0x9d0fc6,_0x23d10f){_0x9d0fc6=_0x9d0fc6-0x0;var _0x3f161e=_0xa87e[_0x9d0fc6];return _0x3f161e;};'use strict';var _=require('lodash');var util=require(_0xea87('0x0'));var logger=require(_0xea87('0x1'))('api');var moment=require(_0xea87('0x2'));var BPromise=require(_0xea87('0x3'));var rp=require(_0xea87('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea87('0x5'));var config=require(_0xea87('0x6'));var attributes=require(_0xea87('0x7'));module['exports']=function(_0x59bd54,_0x2cd40f){return _0x59bd54[_0xea87('0x8')]('DashboardItem',attributes,{'tableName':_0xea87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64e6=['api','moment','request-promise','path','exports','define','dashboard_items','util','../../config/logger'];(function(_0x56d916,_0x380ed0){var _0x364716=function(_0x32c065){while(--_0x32c065){_0x56d916['push'](_0x56d916['shift']());}};_0x364716(++_0x380ed0);}(_0x64e6,0xcd));var _0x664e=function(_0x405113,_0x12834a){_0x405113=_0x405113-0x0;var _0x890bcc=_0x64e6[_0x405113];return _0x890bcc;};'use strict';var _=require('lodash');var util=require(_0x664e('0x0'));var logger=require(_0x664e('0x1'))(_0x664e('0x2'));var moment=require(_0x664e('0x3'));var BPromise=require('bluebird');var rp=require(_0x664e('0x4'));var fs=require('fs');var path=require(_0x664e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x664e('0x6')]=function(_0x4d634c,_0x2e3184){return _0x4d634c[_0x664e('0x7')]('DashboardItem',attributes,{'tableName':_0x664e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 8d0fb98..8319b3b 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 _0xe5d7=['redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x549565,_0x54bdb0){var _0x23c3cd=function(_0x3a81e7){while(--_0x3a81e7){_0x549565['push'](_0x549565['shift']());}};_0x23c3cd(++_0x54bdb0);}(_0xe5d7,0xc5));var _0x7e5d=function(_0x50b049,_0x3ac6f5){_0x50b049=_0x50b049-0x0;var _0x32ebe9=_0xe5d7[_0x50b049];return _0x32ebe9;};'use strict';var _=require('lodash');var util=require(_0x7e5d('0x0'));var moment=require(_0x7e5d('0x1'));var BPromise=require(_0x7e5d('0x2'));var rs=require(_0x7e5d('0x3'));var fs=require('fs');var Redis=require(_0x7e5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e5d('0x5'));var logger=require(_0x7e5d('0x6'))(_0x7e5d('0x7'));var config=require(_0x7e5d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7e5d('0x9')][_0x7e5d('0xa')]({'port':0x232a});config[_0x7e5d('0xb')]=_[_0x7e5d('0xc')](config[_0x7e5d('0xb')],{'host':_0x7e5d('0xd'),'port':0x18eb});var socket=require(_0x7e5d('0xe'))(new Redis(config[_0x7e5d('0xb')]));require(_0x7e5d('0xf'))[_0x7e5d('0x10')](socket);function respondWithRpcPromise(_0x1f6fce,_0xc02d3b,_0x510abc){return new BPromise(function(_0x5a61f2,_0x34c4ed){return client['request'](_0x1f6fce,_0x510abc)[_0x7e5d('0x11')](function(_0x3fd6b1){logger[_0x7e5d('0x12')](_0x7e5d('0x13'),_0xc02d3b,_0x7e5d('0x14'));logger[_0x7e5d('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xc02d3b,'request\x20sent',JSON[_0x7e5d('0x16')](_0x3fd6b1));if(_0x3fd6b1[_0x7e5d('0x17')]){if(_0x3fd6b1[_0x7e5d('0x17')]['code']===0x1f4){logger[_0x7e5d('0x17')](_0x7e5d('0x13'),_0xc02d3b,_0x3fd6b1[_0x7e5d('0x17')]['message']);return _0x34c4ed(_0x3fd6b1[_0x7e5d('0x17')]['message']);}logger[_0x7e5d('0x17')](_0x7e5d('0x13'),_0xc02d3b,_0x3fd6b1['error'][_0x7e5d('0x18')]);return _0x5a61f2(_0x3fd6b1[_0x7e5d('0x17')][_0x7e5d('0x18')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0xc02d3b,_0x7e5d('0x14'));_0x5a61f2(_0x3fd6b1[_0x7e5d('0x19')][_0x7e5d('0x18')]);}})['catch'](function(_0x3bbb6a){logger[_0x7e5d('0x17')](_0x7e5d('0x13'),_0xc02d3b,_0x3bbb6a);_0x34c4ed(_0x3bbb6a);});});} \ No newline at end of file +var _0xfee6=['./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4347c9,_0x5e702f){var _0x863115=function(_0x1a3b36){while(--_0x1a3b36){_0x4347c9['push'](_0x4347c9['shift']());}};_0x863115(++_0x5e702f);}(_0xfee6,0xff));var _0x6fee=function(_0x20c12a,_0x2585e5){_0x20c12a=_0x20c12a-0x0;var _0x1f7791=_0xfee6[_0x20c12a];return _0x1f7791;};'use strict';var _=require(_0x6fee('0x0'));var util=require(_0x6fee('0x1'));var moment=require(_0x6fee('0x2'));var BPromise=require(_0x6fee('0x3'));var rs=require(_0x6fee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6fee('0x5'));var logger=require('../../config/logger')(_0x6fee('0x6'));var config=require(_0x6fee('0x7'));var jayson=require(_0x6fee('0x8'));var client=jayson[_0x6fee('0x9')][_0x6fee('0xa')]({'port':0x232a});config[_0x6fee('0xb')]=_[_0x6fee('0xc')](config['redis'],{'host':_0x6fee('0xd'),'port':0x18eb});var socket=require(_0x6fee('0xe'))(new Redis(config['redis']));require(_0x6fee('0xf'))[_0x6fee('0x10')](socket);function respondWithRpcPromise(_0x31992b,_0x180533,_0x3c4340){return new BPromise(function(_0x57c8a6,_0x5e717f){return client[_0x6fee('0x11')](_0x31992b,_0x3c4340)[_0x6fee('0x12')](function(_0x288c48){logger[_0x6fee('0x13')]('DashboardItem,\x20%s,\x20%s',_0x180533,_0x6fee('0x14'));logger[_0x6fee('0x15')](_0x6fee('0x16'),_0x180533,_0x6fee('0x14'),JSON[_0x6fee('0x17')](_0x288c48));if(_0x288c48[_0x6fee('0x18')]){if(_0x288c48[_0x6fee('0x18')][_0x6fee('0x19')]===0x1f4){logger[_0x6fee('0x18')](_0x6fee('0x1a'),_0x180533,_0x288c48[_0x6fee('0x18')][_0x6fee('0x1b')]);return _0x5e717f(_0x288c48[_0x6fee('0x18')][_0x6fee('0x1b')]);}logger[_0x6fee('0x18')](_0x6fee('0x1a'),_0x180533,_0x288c48[_0x6fee('0x18')][_0x6fee('0x1b')]);return _0x57c8a6(_0x288c48[_0x6fee('0x18')]['message']);}else{logger[_0x6fee('0x13')](_0x6fee('0x1a'),_0x180533,_0x6fee('0x14'));_0x57c8a6(_0x288c48[_0x6fee('0x1c')][_0x6fee('0x1b')]);}})[_0x6fee('0x1d')](function(_0x54bcaf){logger[_0x6fee('0x18')](_0x6fee('0x1a'),_0x180533,_0x54bcaf);_0x5e717f(_0x54bcaf);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index bc3eb0a..09b5860 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 _0xc30f=['update','register','length','dashboardItem:','save'];(function(_0x360512,_0x5a3d66){var _0x355ca3=function(_0x469552){while(--_0x469552){_0x360512['push'](_0x360512['shift']());}};_0x355ca3(++_0x5a3d66);}(_0xc30f,0x1cb));var _0xfc30=function(_0x17d06b,_0x91eb8b){_0x17d06b=_0x17d06b-0x0;var _0x43f5df=_0xc30f[_0x17d06b];return _0x43f5df;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xfc30('0x0'),'remove',_0xfc30('0x1')];function createListener(_0x1a8e77,_0x56b770){return function(_0x187e33){_0x56b770['emit'](_0x1a8e77,_0x187e33);};}function removeListener(_0x3769b4,_0x21dd7e){return function(){DashboardItemEvents['removeListener'](_0x3769b4,_0x21dd7e);};}exports[_0xfc30('0x2')]=function(_0x57dbbd){for(var _0x416755=0x0,_0x1b19d1=events[_0xfc30('0x3')];_0x416755<_0x1b19d1;_0x416755++){var _0x394ff5=events[_0x416755];var _0x2e4a1d=createListener(_0xfc30('0x4')+_0x394ff5,_0x57dbbd);DashboardItemEvents['on'](_0x394ff5,_0x2e4a1d);}}; \ No newline at end of file +var _0xb9a0=['./dashboardItem.events','save','remove','update','emit','register','dashboardItem:'];(function(_0x1d930b,_0xb8483b){var _0x4ce07d=function(_0x497ccf){while(--_0x497ccf){_0x1d930b['push'](_0x1d930b['shift']());}};_0x4ce07d(++_0xb8483b);}(_0xb9a0,0xa1));var _0x0b9a=function(_0x595619,_0x3b7ea6){_0x595619=_0x595619-0x0;var _0x30a1e4=_0xb9a0[_0x595619];return _0x30a1e4;};'use strict';var DashboardItemEvents=require(_0x0b9a('0x0'));var events=[_0x0b9a('0x1'),_0x0b9a('0x2'),_0x0b9a('0x3')];function createListener(_0x1a11aa,_0x53801a){return function(_0x474f7d){_0x53801a[_0x0b9a('0x4')](_0x1a11aa,_0x474f7d);};}function removeListener(_0x52ec31,_0x24eee5){return function(){DashboardItemEvents['removeListener'](_0x52ec31,_0x24eee5);};}exports[_0x0b9a('0x5')]=function(_0x33230f){for(var _0x312e3e=0x0,_0x4ac088=events['length'];_0x312e3e<_0x4ac088;_0x312e3e++){var _0x1465b5=events[_0x312e3e];var _0x1b50f7=createListener(_0x0b9a('0x6')+_0x1465b5,_0x33230f);DashboardItemEvents['on'](_0x1465b5,_0x1b50f7);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1d2d6e3..39ec3c0 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 _0xeb18=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0x46b6dc,_0x5a248a){var _0x5727af=function(_0x5bce81){while(--_0x5bce81){_0x46b6dc['push'](_0x46b6dc['shift']());}};_0x5727af(++_0x5a248a);}(_0xeb18,0x1e0));var _0x8eb1=function(_0x3ddd2f,_0x46335c){_0x3ddd2f=_0x3ddd2f-0x0;var _0x569fb7=_0xeb18[_0x3ddd2f];return _0x569fb7;};'use strict';var multer=require(_0x8eb1('0x0'));var util=require(_0x8eb1('0x1'));var path=require(_0x8eb1('0x2'));var timeout=require(_0x8eb1('0x3'));var express=require(_0x8eb1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8eb1('0x5'));var interaction=require(_0x8eb1('0x6'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router['get'](_0x8eb1('0x7'),auth[_0x8eb1('0x8')](),controller[_0x8eb1('0x9')]);router['post']('/',auth[_0x8eb1('0x8')](),controller[_0x8eb1('0xa')]);router[_0x8eb1('0xb')](_0x8eb1('0x7'),auth[_0x8eb1('0x8')](),controller[_0x8eb1('0xc')]);router[_0x8eb1('0xd')]('/:id',auth[_0x8eb1('0x8')](),controller[_0x8eb1('0xe')]);module[_0x8eb1('0xf')]=router; \ No newline at end of file +var _0x7f4f=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get'];(function(_0x5d9d06,_0x347308){var _0x18cf4a=function(_0x23d263){while(--_0x23d263){_0x5d9d06['push'](_0x5d9d06['shift']());}};_0x18cf4a(++_0x347308);}(_0x7f4f,0xdb));var _0xf7f4=function(_0x4f8669,_0x1095dd){_0x4f8669=_0x4f8669-0x0;var _0x581aaa=_0x7f4f[_0x4f8669];return _0x581aaa;};'use strict';var multer=require(_0xf7f4('0x0'));var util=require('util');var path=require(_0xf7f4('0x1'));var timeout=require(_0xf7f4('0x2'));var express=require(_0xf7f4('0x3'));var router=express[_0xf7f4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf7f4('0x5'));var interaction=require(_0xf7f4('0x6'));var config=require('../../config/environment');var controller=require(_0xf7f4('0x7'));router[_0xf7f4('0x8')](_0xf7f4('0x9'),auth[_0xf7f4('0xa')](),controller[_0xf7f4('0xb')]);router[_0xf7f4('0xc')]('/',auth[_0xf7f4('0xa')](),controller[_0xf7f4('0xd')]);router[_0xf7f4('0xe')](_0xf7f4('0x9'),auth[_0xf7f4('0xa')](),controller[_0xf7f4('0xf')]);router[_0xf7f4('0x10')](_0xf7f4('0x9'),auth[_0xf7f4('0xa')](),controller[_0xf7f4('0x11')]);module[_0xf7f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6917023..f0e6377 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 _0x0d11=['ENUM','second','third','STRING','exports'];(function(_0x25b439,_0xb20872){var _0xbf2210=function(_0x518b01){while(--_0x518b01){_0x25b439['push'](_0x25b439['shift']());}};_0xbf2210(++_0xb20872);}(_0x0d11,0x1b2));var _0x10d1=function(_0x30173c,_0x599eb2){_0x30173c=_0x30173c-0x0;var _0x210c49=_0x0d11[_0x30173c];return _0x210c49;};'use strict';var Sequelize=require('sequelize');module[_0x10d1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x10d1('0x1')]('first',_0x10d1('0x2'),_0x10d1('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x10d1('0x4')]}}; \ No newline at end of file +var _0x2df3=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x39e4a1,_0x4edcc5){var _0x55b30e=function(_0x5efd8e){while(--_0x5efd8e){_0x39e4a1['push'](_0x39e4a1['shift']());}};_0x55b30e(++_0x4edcc5);}(_0x2df3,0xd0));var _0x32df=function(_0x3ce2ba,_0x1fcb4d){_0x3ce2ba=_0x3ce2ba-0x0;var _0xe75af3=_0x2df3[_0x3ce2ba];return _0xe75af3;};'use strict';var Sequelize=require(_0x32df('0x0'));module[_0x32df('0x1')]={'name':{'type':Sequelize[_0x32df('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x32df('0x3')](_0x32df('0x4'),_0x32df('0x5'),_0x32df('0x6')),'allowNull':![],'defaultValue':_0x32df('0x4')},'description':{'type':Sequelize[_0x32df('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 81cab2f..9a555ad 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 _0x5f6f=['fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0xa31cbb,_0x3920ac){var _0xa34c42=function(_0x5b387c){while(--_0x5b387c){_0xa31cbb['push'](_0xa31cbb['shift']());}};_0xa34c42(++_0x3920ac);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x38c2b5,_0x4de8fa){_0x38c2b5=_0x38c2b5-0x0;var _0x46deb3=_0x5f6f[_0x38c2b5];return _0x46deb3;};'use strict';var emlformat=require(_0xf5f6('0x0'));var rimraf=require(_0xf5f6('0x1'));var zipdir=require(_0xf5f6('0x2'));var jsonpatch=require(_0xf5f6('0x3'));var rp=require(_0xf5f6('0x4'));var moment=require('moment');var BPromise=require(_0xf5f6('0x5'));var Mustache=require(_0xf5f6('0x6'));var util=require(_0xf5f6('0x7'));var path=require('path');var sox=require(_0xf5f6('0x8'));var csv=require(_0xf5f6('0x9'));var ejs=require(_0xf5f6('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf5f6('0xc'));var jsforce=require(_0xf5f6('0xd'));var deskjs=require(_0xf5f6('0xe'));var toCsv=require(_0xf5f6('0x9'));var querystring=require(_0xf5f6('0xf'));var Papa=require(_0xf5f6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf5f6('0x11'));var as=require(_0xf5f6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f6('0x13'))(_0xf5f6('0x14'));var utils=require(_0xf5f6('0x15'));var config=require(_0xf5f6('0x16'));var licenseUtil=require(_0xf5f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b407d,_0x4cde56){_0x4cde56=_0x4cde56||0xcc;return function(_0x2a62c5){if(_0x2a62c5){return _0x3b407d[_0xf5f6('0x18')](_0x4cde56);}return _0x3b407d[_0xf5f6('0x19')](_0x4cde56)[_0xf5f6('0x1a')]();};}function respondWithResult(_0x52648d,_0x96661c){_0x96661c=_0x96661c||0xc8;return function(_0x33cc8a){if(_0x33cc8a){return _0x52648d[_0xf5f6('0x19')](_0x96661c)[_0xf5f6('0x1b')](_0x33cc8a);}};}function respondWithFilteredResult(_0x504cd9,_0x1e3037){return function(_0x3f9f49){if(_0x3f9f49){var _0x21ccf7=typeof _0x1e3037[_0xf5f6('0x1c')]==='undefined'&&typeof _0x1e3037['limit']===_0xf5f6('0x1d');var _0x59a37e=_0x3f9f49[_0xf5f6('0x1e')];var _0x4dd3ae=_0x21ccf7?0x0:_0x1e3037[_0xf5f6('0x1c')];var _0x294af2=_0x21ccf7?_0x3f9f49[_0xf5f6('0x1e')]:_0x1e3037[_0xf5f6('0x1c')]+_0x1e3037[_0xf5f6('0x1f')];var _0x3199f0;if(_0x294af2>=_0x59a37e){_0x294af2=_0x59a37e;_0x3199f0=0xc8;}else{_0x3199f0=0xce;}_0x504cd9['status'](_0x3199f0);return _0x504cd9[_0xf5f6('0x20')](_0xf5f6('0x21'),_0x4dd3ae+'-'+_0x294af2+'/'+_0x59a37e)[_0xf5f6('0x1b')](_0x3f9f49);}return null;};}function patchUpdates(_0x261015){return function(_0x46de8c){try{jsonpatch['apply'](_0x46de8c,_0x261015,!![]);}catch(_0x1049e8){return BPromise[_0xf5f6('0x22')](_0x1049e8);}return _0x46de8c[_0xf5f6('0x23')]();};}function saveUpdates(_0x579375,_0x253b42){return function(_0x32f27e){if(_0x32f27e){return _0x32f27e[_0xf5f6('0x24')](_0x579375)[_0xf5f6('0x25')](function(_0x49906c){return _0x49906c;});}return null;};}function removeEntity(_0x4adf54,_0x1503e0){return function(_0x198cbb){if(_0x198cbb){return _0x198cbb[_0xf5f6('0x26')]()['then'](function(){var _0x31d0fb=_0x198cbb[_0xf5f6('0x27')]({'plain':!![]});var _0x9500e5='Dispositions';return db['UserProfileResource'][_0xf5f6('0x26')]({'where':{'type':_0x9500e5,'resourceId':_0x31d0fb['id']}})[_0xf5f6('0x25')](function(){return _0x198cbb;});})[_0xf5f6('0x25')](function(){_0x4adf54[_0xf5f6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb2fab7,_0x345242){return function(_0x52dfe3){if(!_0x52dfe3){_0xb2fab7[_0xf5f6('0x18')](0x194);}return _0x52dfe3;};}function handleError(_0x4c6cbf,_0x3fa834){_0x3fa834=_0x3fa834||0x1f4;return function(_0x8867ac){logger['error'](_0x8867ac[_0xf5f6('0x28')]);if(_0x8867ac[_0xf5f6('0x29')]){delete _0x8867ac[_0xf5f6('0x29')];}_0x4c6cbf[_0xf5f6('0x19')](_0x3fa834)['send'](_0x8867ac);};}exports[_0xf5f6('0x2a')]=function(_0x58f320,_0x254810){var _0x301a59={},_0x202565={},_0x1c4832={'count':0x0,'rows':[]};var _0x5bc8b1=_[_0xf5f6('0x2b')](db['Disposition'][_0xf5f6('0x2c')],function(_0x1dd7af){return{'name':_0x1dd7af['fieldName'],'type':_0x1dd7af[_0xf5f6('0x2d')][_0xf5f6('0x2e')]};});_0x202565[_0xf5f6('0x2f')]=_[_0xf5f6('0x2b')](_0x5bc8b1,_0xf5f6('0x29'));_0x202565[_0xf5f6('0x30')]=_[_0xf5f6('0x31')](_0x58f320['query']);_0x202565[_0xf5f6('0x32')]=_['intersection'](_0x202565[_0xf5f6('0x2f')],_0x202565[_0xf5f6('0x30')]);_0x301a59['attributes']=_['intersection'](_0x202565[_0xf5f6('0x2f')],qs[_0xf5f6('0x33')](_0x58f320[_0xf5f6('0x30')][_0xf5f6('0x33')]));_0x301a59[_0xf5f6('0x34')]=_0x301a59[_0xf5f6('0x34')][_0xf5f6('0x35')]?_0x301a59[_0xf5f6('0x34')]:_0x202565['model'];if(!_0x58f320[_0xf5f6('0x30')][_0xf5f6('0x36')](_0xf5f6('0x37'))){_0x301a59['limit']=qs['limit'](_0x58f320[_0xf5f6('0x30')]['limit']);_0x301a59['offset']=qs[_0xf5f6('0x1c')](_0x58f320[_0xf5f6('0x30')][_0xf5f6('0x1c')]);}_0x301a59['order']=qs[_0xf5f6('0x38')](_0x58f320[_0xf5f6('0x30')]['sort']);_0x301a59[_0xf5f6('0x39')]=qs['filters'](_['pick'](_0x58f320[_0xf5f6('0x30')],_0x202565['filters']),_0x5bc8b1);if(_0x58f320['query'][_0xf5f6('0x3a')]){_0x301a59[_0xf5f6('0x39')]=_[_0xf5f6('0x3b')](_0x301a59['where'],{'$or':_['map'](_0x5bc8b1,function(_0x2e7742){if(_0x2e7742[_0xf5f6('0x2d')]!==_0xf5f6('0x3c')){var _0x47e5c3={};_0x47e5c3[_0x2e7742[_0xf5f6('0x29')]]={'$like':'%'+_0x58f320[_0xf5f6('0x30')][_0xf5f6('0x3a')]+'%'};return _0x47e5c3;}})});}_0x301a59=_[_0xf5f6('0x3b')]({},_0x301a59,_0x58f320[_0xf5f6('0x3d')]);var _0x3798bd={'where':_0x301a59[_0xf5f6('0x39')]};return db[_0xf5f6('0x3e')][_0xf5f6('0x1e')](_0x3798bd)['then'](function(_0xc344b3){_0x1c4832[_0xf5f6('0x1e')]=_0xc344b3;if(_0x58f320[_0xf5f6('0x30')][_0xf5f6('0x3f')]){_0x301a59[_0xf5f6('0x40')]=[{'all':!![]}];}return db[_0xf5f6('0x3e')][_0xf5f6('0x41')](_0x301a59);})[_0xf5f6('0x25')](function(_0x37d9a2){_0x1c4832[_0xf5f6('0x42')]=_0x37d9a2;return _0x1c4832;})[_0xf5f6('0x25')](respondWithFilteredResult(_0x254810,_0x301a59))['catch'](handleError(_0x254810,null));};exports[_0xf5f6('0x43')]=function(_0x334ce0,_0x3c9fea){var _0x479824={'raw':!![],'where':{'id':_0x334ce0[_0xf5f6('0x44')]['id']}},_0x4548b0={};_0x4548b0['model']=_[_0xf5f6('0x31')](db['Disposition']['rawAttributes']);_0x4548b0[_0xf5f6('0x30')]=_[_0xf5f6('0x31')](_0x334ce0[_0xf5f6('0x30')]);_0x4548b0['filters']=_[_0xf5f6('0x45')](_0x4548b0[_0xf5f6('0x2f')],_0x4548b0[_0xf5f6('0x30')]);_0x479824['attributes']=_[_0xf5f6('0x45')](_0x4548b0['model'],qs[_0xf5f6('0x33')](_0x334ce0['query'][_0xf5f6('0x33')]));_0x479824[_0xf5f6('0x34')]=_0x479824[_0xf5f6('0x34')][_0xf5f6('0x35')]?_0x479824[_0xf5f6('0x34')]:_0x4548b0['model'];if(_0x334ce0['query'][_0xf5f6('0x3f')]){_0x479824['include']=[{'all':!![]}];}_0x479824=_[_0xf5f6('0x3b')]({},_0x479824,_0x334ce0[_0xf5f6('0x3d')]);return db[_0xf5f6('0x3e')]['find'](_0x479824)[_0xf5f6('0x25')](handleEntityNotFound(_0x3c9fea,null))[_0xf5f6('0x25')](respondWithResult(_0x3c9fea,null))[_0xf5f6('0x46')](handleError(_0x3c9fea,null));};exports[_0xf5f6('0x47')]=function(_0x44c264,_0x1fe5a5){return db['Disposition'][_0xf5f6('0x47')](_0x44c264[_0xf5f6('0x48')],{})['then'](function(_0xf092b6){var _0x8c09ff=_0x44c264[_0xf5f6('0x49')][_0xf5f6('0x27')]({'plain':!![]});if(!_0x8c09ff)throw new Error(_0xf5f6('0x4a'));if(_0x8c09ff[_0xf5f6('0x4b')]===_0xf5f6('0x49')){var _0x18c9cf=_0xf092b6['get']({'plain':!![]});var _0x3ac888='Dispositions';return db[_0xf5f6('0x4c')][_0xf5f6('0x4d')]({'where':{'name':_0x3ac888,'userProfileId':_0x8c09ff[_0xf5f6('0x4e')]},'raw':!![]})['then'](function(_0x28ef8c){if(_0x28ef8c&&_0x28ef8c[_0xf5f6('0x4f')]===0x0){return db[_0xf5f6('0x50')]['create']({'name':_0x18c9cf[_0xf5f6('0x29')],'resourceId':_0x18c9cf['id'],'type':_0x28ef8c[_0xf5f6('0x29')],'sectionId':_0x28ef8c['id']},{})[_0xf5f6('0x25')](function(){return _0xf092b6;});}else{return _0xf092b6;}})[_0xf5f6('0x46')](function(_0x24de8f){logger[_0xf5f6('0x51')](_0xf5f6('0x52'),_0x24de8f);throw _0x24de8f;});}return _0xf092b6;})['then'](respondWithResult(_0x1fe5a5,0xc9))[_0xf5f6('0x46')](handleError(_0x1fe5a5,null));};exports[_0xf5f6('0x24')]=function(_0x1f8ae7,_0x54aeac){if(_0x1f8ae7[_0xf5f6('0x48')]['id']){delete _0x1f8ae7['body']['id'];}return db[_0xf5f6('0x3e')][_0xf5f6('0x4d')]({'where':{'id':_0x1f8ae7[_0xf5f6('0x44')]['id']}})[_0xf5f6('0x25')](handleEntityNotFound(_0x54aeac,null))[_0xf5f6('0x25')](saveUpdates(_0x1f8ae7[_0xf5f6('0x48')],null))[_0xf5f6('0x25')](respondWithResult(_0x54aeac,null))[_0xf5f6('0x46')](handleError(_0x54aeac,null));};exports[_0xf5f6('0x26')]=function(_0x26ab99,_0x438427){return db[_0xf5f6('0x3e')][_0xf5f6('0x4d')]({'where':{'id':_0x26ab99[_0xf5f6('0x44')]['id']}})[_0xf5f6('0x25')](handleEntityNotFound(_0x438427,null))[_0xf5f6('0x25')](removeEntity(_0x438427,null))[_0xf5f6('0x46')](handleError(_0x438427,null));}; \ No newline at end of file +var _0x4a99=['includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','user','role','find','userProfileId','autoAssociation','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','error','stack','name','index','map','Disposition','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x220902,_0x421928){var _0x5e7f1b=function(_0x35aaf2){while(--_0x35aaf2){_0x220902['push'](_0x220902['shift']());}};_0x5e7f1b(++_0x421928);}(_0x4a99,0x1aa));var _0x94a9=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x4a99[_0x49ca18];return _0x145d54;};'use strict';var emlformat=require(_0x94a9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x94a9('0x1'));var rp=require(_0x94a9('0x2'));var moment=require('moment');var BPromise=require(_0x94a9('0x3'));var Mustache=require('mustache');var util=require(_0x94a9('0x4'));var path=require(_0x94a9('0x5'));var sox=require(_0x94a9('0x6'));var csv=require('to-csv');var ejs=require(_0x94a9('0x7'));var fs=require('fs');var fs_extra=require(_0x94a9('0x8'));var _=require('lodash');var squel=require(_0x94a9('0x9'));var crypto=require(_0x94a9('0xa'));var jsforce=require(_0x94a9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x94a9('0xc'));var querystring=require('querystring');var Papa=require(_0x94a9('0xd'));var Redis=require(_0x94a9('0xe'));var authService=require(_0x94a9('0xf'));var qs=require(_0x94a9('0x10'));var as=require(_0x94a9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x94a9('0x12'))(_0x94a9('0x13'));var utils=require(_0x94a9('0x14'));var config=require(_0x94a9('0x15'));var licenseUtil=require(_0x94a9('0x16'));var db=require(_0x94a9('0x17'))['db'];function respondWithStatusCode(_0x458862,_0x54800a){_0x54800a=_0x54800a||0xcc;return function(_0x5c2acb){if(_0x5c2acb){return _0x458862[_0x94a9('0x18')](_0x54800a);}return _0x458862[_0x94a9('0x19')](_0x54800a)[_0x94a9('0x1a')]();};}function respondWithResult(_0x1fecdc,_0x3d29a3){_0x3d29a3=_0x3d29a3||0xc8;return function(_0xb1794d){if(_0xb1794d){return _0x1fecdc[_0x94a9('0x19')](_0x3d29a3)['json'](_0xb1794d);}};}function respondWithFilteredResult(_0x4fe0ff,_0x352197){return function(_0x25f346){if(_0x25f346){var _0x5b3006=typeof _0x352197['offset']===_0x94a9('0x1b')&&typeof _0x352197[_0x94a9('0x1c')]===_0x94a9('0x1b');var _0x1fd764=_0x25f346[_0x94a9('0x1d')];var _0x32596a=_0x5b3006?0x0:_0x352197[_0x94a9('0x1e')];var _0x50f4a6=_0x5b3006?_0x25f346[_0x94a9('0x1d')]:_0x352197[_0x94a9('0x1e')]+_0x352197[_0x94a9('0x1c')];var _0x4bbed8;if(_0x50f4a6>=_0x1fd764){_0x50f4a6=_0x1fd764;_0x4bbed8=0xc8;}else{_0x4bbed8=0xce;}_0x4fe0ff['status'](_0x4bbed8);return _0x4fe0ff[_0x94a9('0x1f')](_0x94a9('0x20'),_0x32596a+'-'+_0x50f4a6+'/'+_0x1fd764)['json'](_0x25f346);}return null;};}function patchUpdates(_0x369210){return function(_0x1fb178){try{jsonpatch[_0x94a9('0x21')](_0x1fb178,_0x369210,!![]);}catch(_0x346ee1){return BPromise[_0x94a9('0x22')](_0x346ee1);}return _0x1fb178[_0x94a9('0x23')]();};}function saveUpdates(_0x397db8,_0xa0f131){return function(_0x5244df){if(_0x5244df){return _0x5244df[_0x94a9('0x24')](_0x397db8)['then'](function(_0x23038e){return _0x23038e;});}return null;};}function removeEntity(_0x39b9b8,_0x4e96b1){return function(_0x5ebc84){if(_0x5ebc84){return _0x5ebc84[_0x94a9('0x25')]()['then'](function(){var _0x5924c6=_0x5ebc84[_0x94a9('0x26')]({'plain':!![]});var _0x1b393e=_0x94a9('0x27');return db[_0x94a9('0x28')][_0x94a9('0x25')]({'where':{'type':_0x1b393e,'resourceId':_0x5924c6['id']}})['then'](function(){return _0x5ebc84;});})[_0x94a9('0x29')](function(){_0x39b9b8[_0x94a9('0x19')](0xcc)[_0x94a9('0x1a')]();});}};}function handleEntityNotFound(_0x1b6a5a,_0x2f6033){return function(_0x5aedca){if(!_0x5aedca){_0x1b6a5a[_0x94a9('0x18')](0x194);}return _0x5aedca;};}function handleError(_0x51487f,_0x3dd9f8){_0x3dd9f8=_0x3dd9f8||0x1f4;return function(_0x196b1c){logger[_0x94a9('0x2a')](_0x196b1c[_0x94a9('0x2b')]);if(_0x196b1c[_0x94a9('0x2c')]){delete _0x196b1c['name'];}_0x51487f[_0x94a9('0x19')](_0x3dd9f8)['send'](_0x196b1c);};}exports[_0x94a9('0x2d')]=function(_0xbfc50d,_0x300404){var _0x3ed257={},_0x46b386={},_0x334010={'count':0x0,'rows':[]};var _0x2e51ee=_[_0x94a9('0x2e')](db[_0x94a9('0x2f')][_0x94a9('0x30')],function(_0x1a339a){return{'name':_0x1a339a['fieldName'],'type':_0x1a339a[_0x94a9('0x31')][_0x94a9('0x32')]};});_0x46b386[_0x94a9('0x33')]=_[_0x94a9('0x2e')](_0x2e51ee,_0x94a9('0x2c'));_0x46b386[_0x94a9('0x34')]=_['keys'](_0xbfc50d[_0x94a9('0x34')]);_0x46b386[_0x94a9('0x35')]=_[_0x94a9('0x36')](_0x46b386[_0x94a9('0x33')],_0x46b386[_0x94a9('0x34')]);_0x3ed257['attributes']=_[_0x94a9('0x36')](_0x46b386[_0x94a9('0x33')],qs['fields'](_0xbfc50d[_0x94a9('0x34')][_0x94a9('0x37')]));_0x3ed257[_0x94a9('0x38')]=_0x3ed257[_0x94a9('0x38')]['length']?_0x3ed257[_0x94a9('0x38')]:_0x46b386[_0x94a9('0x33')];if(!_0xbfc50d[_0x94a9('0x34')][_0x94a9('0x39')]('nolimit')){_0x3ed257[_0x94a9('0x1c')]=qs[_0x94a9('0x1c')](_0xbfc50d[_0x94a9('0x34')]['limit']);_0x3ed257[_0x94a9('0x1e')]=qs[_0x94a9('0x1e')](_0xbfc50d[_0x94a9('0x34')][_0x94a9('0x1e')]);}_0x3ed257[_0x94a9('0x3a')]=qs[_0x94a9('0x3b')](_0xbfc50d[_0x94a9('0x34')][_0x94a9('0x3b')]);_0x3ed257[_0x94a9('0x3c')]=qs[_0x94a9('0x35')](_[_0x94a9('0x3d')](_0xbfc50d[_0x94a9('0x34')],_0x46b386[_0x94a9('0x35')]),_0x2e51ee);if(_0xbfc50d[_0x94a9('0x34')][_0x94a9('0x3e')]){_0x3ed257[_0x94a9('0x3c')]=_[_0x94a9('0x3f')](_0x3ed257['where'],{'$or':_[_0x94a9('0x2e')](_0x2e51ee,function(_0x531f6d){if(_0x531f6d[_0x94a9('0x31')]!==_0x94a9('0x40')){var _0xe599f6={};_0xe599f6[_0x531f6d[_0x94a9('0x2c')]]={'$like':'%'+_0xbfc50d['query'][_0x94a9('0x3e')]+'%'};return _0xe599f6;}})});}_0x3ed257=_[_0x94a9('0x3f')]({},_0x3ed257,_0xbfc50d[_0x94a9('0x41')]);var _0x4534f8={'where':_0x3ed257['where']};return db[_0x94a9('0x2f')][_0x94a9('0x1d')](_0x4534f8)[_0x94a9('0x29')](function(_0x51875e){_0x334010[_0x94a9('0x1d')]=_0x51875e;if(_0xbfc50d[_0x94a9('0x34')][_0x94a9('0x42')]){_0x3ed257[_0x94a9('0x43')]=[{'all':!![]}];}return db[_0x94a9('0x2f')][_0x94a9('0x44')](_0x3ed257);})[_0x94a9('0x29')](function(_0x4f9167){_0x334010[_0x94a9('0x45')]=_0x4f9167;return _0x334010;})[_0x94a9('0x29')](respondWithFilteredResult(_0x300404,_0x3ed257))[_0x94a9('0x46')](handleError(_0x300404,null));};exports[_0x94a9('0x47')]=function(_0x4a7ae3,_0x2feae9){var _0x42603c={'raw':!![],'where':{'id':_0x4a7ae3[_0x94a9('0x48')]['id']}},_0x3afb20={};_0x3afb20[_0x94a9('0x33')]=_[_0x94a9('0x49')](db[_0x94a9('0x2f')][_0x94a9('0x30')]);_0x3afb20[_0x94a9('0x34')]=_[_0x94a9('0x49')](_0x4a7ae3[_0x94a9('0x34')]);_0x3afb20['filters']=_['intersection'](_0x3afb20[_0x94a9('0x33')],_0x3afb20[_0x94a9('0x34')]);_0x42603c[_0x94a9('0x38')]=_[_0x94a9('0x36')](_0x3afb20['model'],qs['fields'](_0x4a7ae3['query'][_0x94a9('0x37')]));_0x42603c['attributes']=_0x42603c[_0x94a9('0x38')][_0x94a9('0x4a')]?_0x42603c[_0x94a9('0x38')]:_0x3afb20[_0x94a9('0x33')];if(_0x4a7ae3[_0x94a9('0x34')][_0x94a9('0x42')]){_0x42603c[_0x94a9('0x43')]=[{'all':!![]}];}_0x42603c=_[_0x94a9('0x3f')]({},_0x42603c,_0x4a7ae3[_0x94a9('0x41')]);return db[_0x94a9('0x2f')]['find'](_0x42603c)[_0x94a9('0x29')](handleEntityNotFound(_0x2feae9,null))['then'](respondWithResult(_0x2feae9,null))['catch'](handleError(_0x2feae9,null));};exports[_0x94a9('0x4b')]=function(_0xd28312,_0x4e617c){return db[_0x94a9('0x2f')][_0x94a9('0x4b')](_0xd28312[_0x94a9('0x4c')],{})['then'](function(_0x526d9a){var _0x4d2997=_0xd28312[_0x94a9('0x4d')][_0x94a9('0x26')]({'plain':!![]});if(!_0x4d2997)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d2997[_0x94a9('0x4e')]===_0x94a9('0x4d')){var _0xe707e6=_0x526d9a['get']({'plain':!![]});var _0x3e77f2=_0x94a9('0x27');return db['UserProfileSection'][_0x94a9('0x4f')]({'where':{'name':_0x3e77f2,'userProfileId':_0x4d2997[_0x94a9('0x50')]},'raw':!![]})[_0x94a9('0x29')](function(_0xc0f61b){if(_0xc0f61b&&_0xc0f61b[_0x94a9('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0xe707e6[_0x94a9('0x2c')],'resourceId':_0xe707e6['id'],'type':_0xc0f61b[_0x94a9('0x2c')],'sectionId':_0xc0f61b['id']},{})[_0x94a9('0x29')](function(){return _0x526d9a;});}else{return _0x526d9a;}})[_0x94a9('0x46')](function(_0x143d8f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x143d8f);throw _0x143d8f;});}return _0x526d9a;})[_0x94a9('0x29')](respondWithResult(_0x4e617c,0xc9))['catch'](handleError(_0x4e617c,null));};exports[_0x94a9('0x24')]=function(_0x1829df,_0x34575f){if(_0x1829df['body']['id']){delete _0x1829df['body']['id'];}return db['Disposition'][_0x94a9('0x4f')]({'where':{'id':_0x1829df[_0x94a9('0x48')]['id']}})[_0x94a9('0x29')](handleEntityNotFound(_0x34575f,null))['then'](saveUpdates(_0x1829df[_0x94a9('0x4c')],null))[_0x94a9('0x29')](respondWithResult(_0x34575f,null))[_0x94a9('0x46')](handleError(_0x34575f,null));};exports[_0x94a9('0x25')]=function(_0x4d6362,_0x543c01){return db['Disposition'][_0x94a9('0x4f')]({'where':{'id':_0x4d6362[_0x94a9('0x48')]['id']}})[_0x94a9('0x29')](handleEntityNotFound(_0x543c01,null))[_0x94a9('0x29')](removeEntity(_0x543c01,null))['catch'](handleError(_0x543c01,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d3be639..382b4e1 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 _0x1514=['bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x1514,0x164));var _0x4151=function(_0x5965da,_0x1e1e13){_0x5965da=_0x5965da-0x0;var _0x5407f1=_0x1514[_0x5965da];return _0x5407f1;};'use strict';var _=require(_0x4151('0x0'));var util=require(_0x4151('0x1'));var logger=require(_0x4151('0x2'))('api');var moment=require(_0x4151('0x3'));var BPromise=require(_0x4151('0x4'));var rp=require(_0x4151('0x5'));var fs=require('fs');var path=require(_0x4151('0x6'));var rimraf=require('rimraf');var config=require(_0x4151('0x7'));var attributes=require(_0x4151('0x8'));module[_0x4151('0x9')]=function(_0x6875f7,_0x5d24b4){return _0x6875f7[_0x4151('0xa')](_0x4151('0xb'),attributes,{'tableName':_0x4151('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4151('0xd'),'fields':[_0x4151('0xe'),_0x4151('0xf')]},{'unique':!![],'name':_0x4151('0x10'),'fields':['name',_0x4151('0x11')]},{'unique':!![],'name':'name_mail','fields':[_0x4151('0xe'),_0x4151('0x12')]},{'unique':!![],'name':_0x4151('0x13'),'fields':[_0x4151('0xe'),_0x4151('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x4151('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x4151('0x15'),'fields':[_0x4151('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0x4151('0x16'),'fields':[_0x4151('0xe'),_0x4151('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1773=['name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./disposition.attributes','define','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms'];(function(_0x51fc4d,_0x105298){var _0x48788e=function(_0x1d87f7){while(--_0x1d87f7){_0x51fc4d['push'](_0x51fc4d['shift']());}};_0x48788e(++_0x105298);}(_0x1773,0x1a9));var _0x3177=function(_0x47e915,_0x4afe78){_0x47e915=_0x47e915-0x0;var _0x3f6ccf=_0x1773[_0x47e915];return _0x3f6ccf;};'use strict';var _=require(_0x3177('0x0'));var util=require(_0x3177('0x1'));var logger=require(_0x3177('0x2'))(_0x3177('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3177('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3177('0x5'));var config=require(_0x3177('0x6'));var attributes=require(_0x3177('0x7'));module['exports']=function(_0x16e885,_0x3d07a7){return _0x16e885[_0x3177('0x8')]('Disposition',attributes,{'tableName':_0x3177('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3177('0xa'),_0x3177('0xb')]},{'unique':!![],'name':_0x3177('0xc'),'fields':['name',_0x3177('0xd')]},{'unique':!![],'name':_0x3177('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x3177('0xf'),'fields':[_0x3177('0xa'),'SmsAccountId']},{'unique':!![],'name':_0x3177('0x10'),'fields':[_0x3177('0xa'),_0x3177('0x11')]},{'unique':!![],'name':_0x3177('0x12'),'fields':[_0x3177('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0x3177('0x13'),'fields':[_0x3177('0xa'),_0x3177('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index ba7b6bb..1d0c4f4 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(_0xda92d,_0x458622){var _0x3e25f9=function(_0x188df6){while(--_0x188df6){_0xda92d['push'](_0xda92d['shift']());}};_0x3e25f9(++_0x458622);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x13cc36,_0x121bfe){var _0x391fd2=function(_0x424002){while(--_0x424002){_0x13cc36['push'](_0x13cc36['shift']());}};_0x391fd2(++_0x121bfe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 7520fb2..7a70169 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 _0x5b10=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b10,0x13e));var _0x05b1=function(_0xd692fc,_0xdc3122){_0xd692fc=_0xd692fc-0x0;var _0x40a450=_0x5b10[_0xd692fc];return _0x40a450;};'use strict';var multer=require(_0x05b1('0x0'));var util=require(_0x05b1('0x1'));var path=require(_0x05b1('0x2'));var timeout=require(_0x05b1('0x3'));var express=require(_0x05b1('0x4'));var router=express[_0x05b1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x05b1('0x6'));var interaction=require(_0x05b1('0x7'));var config=require(_0x05b1('0x8'));var controller=require(_0x05b1('0x9'));router[_0x05b1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x05b1('0xb'),auth['isAuthenticated'](),controller[_0x05b1('0xc')]);router[_0x05b1('0xd')]('/',auth[_0x05b1('0xe')](),controller[_0x05b1('0xf')]);router[_0x05b1('0x10')](_0x05b1('0xb'),auth['isAuthenticated'](),controller[_0x05b1('0x11')]);router[_0x05b1('0x12')](_0x05b1('0xb'),auth[_0x05b1('0xe')](),controller[_0x05b1('0x13')]);module[_0x05b1('0x14')]=router; \ No newline at end of file +var _0x9af4=['update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','put'];(function(_0x2ee69d,_0x308214){var _0x3abd2a=function(_0x37f5d4){while(--_0x37f5d4){_0x2ee69d['push'](_0x2ee69d['shift']());}};_0x3abd2a(++_0x308214);}(_0x9af4,0x183));var _0x49af=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9af4[_0x279d37];return _0x530173;};'use strict';var multer=require(_0x49af('0x0'));var util=require(_0x49af('0x1'));var path=require(_0x49af('0x2'));var timeout=require('connect-timeout');var express=require(_0x49af('0x3'));var router=express[_0x49af('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x49af('0x5'));var config=require(_0x49af('0x6'));var controller=require('./disposition.controller');router[_0x49af('0x7')]('/',auth['isAuthenticated'](),controller[_0x49af('0x8')]);router['get'](_0x49af('0x9'),auth[_0x49af('0xa')](),controller['show']);router['post']('/',auth[_0x49af('0xa')](),controller[_0x49af('0xb')]);router[_0x49af('0xc')](_0x49af('0x9'),auth[_0x49af('0xa')](),controller[_0x49af('0xd')]);router[_0x49af('0xe')](_0x49af('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x49af('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index de3a591..681386b 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 _0x1db9=['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','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','7200','9600','12000','14400','4800','2400','INTEGER','IAX','DADHI','KHOMP','SIP'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x1db9,0x176));var _0x91db=function(_0x177077,_0x2fa057){_0x177077=_0x177077-0x0;var _0x50a2f9=_0x1db9[_0x177077];return _0x50a2f9;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]},'ecm':{'type':Sequelize[_0x91db('0x3')](_0x91db('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x91db('0x2')],'defaultValue':_0x91db('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x91db('0x3')]('2400','4800',_0x91db('0x6'),_0x91db('0x7'),_0x91db('0x8'),_0x91db('0x9')),'defaultValue':_0x91db('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x91db('0xb'),'4800',_0x91db('0x6'),_0x91db('0x7'),_0x91db('0x8'),'14400'),'defaultValue':_0x91db('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x91db('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x91db('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x91db('0xd'),_0x91db('0xe'),_0x91db('0xf')),'defaultValue':_0x91db('0x10')},'key':{'type':Sequelize[_0x91db('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x91db('0x11');}},'notificationSound':{'type':Sequelize[_0x91db('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x91db('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x91db('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x91db('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x91db('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x91db('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x91db('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x91db('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x91db('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x91db('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x91db('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f744f){if(!_0x3f744f)this[_0x91db('0x14')](_0x91db('0x15'),null);this[_0x91db('0x14')](_0x91db('0x16'),_0x3f744f);}}}; \ No newline at end of file +var _0xeff8=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x15b192,_0x38c235){var _0x396e73=function(_0x4ba480){while(--_0x4ba480){_0x15b192['push'](_0x15b192['shift']());}};_0x396e73(++_0x38c235);}(_0xeff8,0x186));var _0x8eff=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xeff8[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eff('0x2')]},'ecm':{'type':Sequelize[_0x8eff('0x3')](_0x8eff('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8eff('0x2')],'defaultValue':_0x8eff('0x5')},'localstationid':{'type':Sequelize[_0x8eff('0x2')],'unique':_0x8eff('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x8eff('0x7'),_0x8eff('0x8'),_0x8eff('0x9'),_0x8eff('0xa'),'12000',_0x8eff('0xb')),'defaultValue':_0x8eff('0x8')},'maxrate':{'type':Sequelize[_0x8eff('0x3')](_0x8eff('0x7'),'4800','7200',_0x8eff('0xa'),_0x8eff('0xc'),_0x8eff('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x8eff('0x2')],'defaultValue':_0x8eff('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8eff('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8eff('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x8eff('0xf'),_0x8eff('0x10'),_0x8eff('0x11')),'defaultValue':_0x8eff('0x12')},'key':{'type':Sequelize[_0x8eff('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8eff('0x13');}},'notificationSound':{'type':Sequelize[_0x8eff('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8eff('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8eff('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8eff('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8eff('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8eff('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8eff('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8eff('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8eff('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x8eff('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8eff('0x16'),'set':function(_0x38fb15){if(!_0x38fb15)this[_0x8eff('0x17')](_0x8eff('0x18'),null);this[_0x8eff('0x17')](_0x8eff('0x19'),_0x38fb15);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 833c983..31cae74 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 _0x2e4d=['ecm','gateway','maxrate','minrate','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','FaxMessage','split','format','send','CmList','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','fax','List','defaults','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','isArray','emit','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','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','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','include','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set'];(function(_0x51e3ab,_0xa7c312){var _0x4e3bc4=function(_0x1941c6){while(--_0x1941c6){_0x51e3ab['push'](_0x51e3ab['shift']());}};_0x4e3bc4(++_0xa7c312);}(_0x2e4d,0x1bb));var _0xd2e4=function(_0x2f8b91,_0x3a05a5){_0x2f8b91=_0x2f8b91-0x0;var _0x27f513=_0x2e4d[_0x2f8b91];return _0x27f513;};'use strict';var emlformat=require(_0xd2e4('0x0'));var rimraf=require(_0xd2e4('0x1'));var zipdir=require(_0xd2e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2e4('0x3'));var moment=require(_0xd2e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2e4('0x5'));var util=require(_0xd2e4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd2e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2e4('0x8'));var _=require(_0xd2e4('0x9'));var squel=require(_0xd2e4('0xa'));var crypto=require(_0xd2e4('0xb'));var jsforce=require(_0xd2e4('0xc'));var deskjs=require(_0xd2e4('0xd'));var toCsv=require(_0xd2e4('0x7'));var querystring=require('querystring');var Papa=require(_0xd2e4('0xe'));var Redis=require(_0xd2e4('0xf'));var authService=require(_0xd2e4('0x10'));var qs=require(_0xd2e4('0x11'));var as=require(_0xd2e4('0x12'));var hardwareService=require(_0xd2e4('0x13'));var logger=require('../../config/logger')(_0xd2e4('0x14'));var utils=require(_0xd2e4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd2e4('0x16'));var db=require(_0xd2e4('0x17'))['db'];config[_0xd2e4('0x18')]=_['defaults'](config['redis'],{'host':_0xd2e4('0x19'),'port':0x18eb});var socket=require(_0xd2e4('0x1a'))(new Redis(config[_0xd2e4('0x18')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0xd2e4('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd2e4('0x1c')][_0xd2e4('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x411d4,_0x31b729,_0x4334e0,_0x208eaa){return new BPromise(function(_0x4b8f4f,_0x55cc03){var _0x4b3f48=_0x208eaa||client;return _0x4b3f48[_0xd2e4('0x1e')](_0x411d4,_0x4334e0)[_0xd2e4('0x1f')](function(_0x5d7ce3){logger[_0xd2e4('0x20')](_0xd2e4('0x21'),_0x31b729,'request\x20sent');logger[_0xd2e4('0x22')](_0xd2e4('0x23'),_0x31b729,_0xd2e4('0x24'),JSON[_0xd2e4('0x25')](_0x5d7ce3));if(_0x5d7ce3[_0xd2e4('0x26')]){if(_0x5d7ce3[_0xd2e4('0x26')][_0xd2e4('0x27')]===0x1f4){logger[_0xd2e4('0x26')](_0xd2e4('0x21'),_0x31b729,_0x5d7ce3[_0xd2e4('0x26')][_0xd2e4('0x28')]);return _0x55cc03(_0x5d7ce3[_0xd2e4('0x26')]['message']);}logger[_0xd2e4('0x26')](_0xd2e4('0x21'),_0x31b729,_0x5d7ce3['error']['message']);return _0x4b8f4f(_0x5d7ce3[_0xd2e4('0x26')][_0xd2e4('0x28')]);}else{logger['info'](_0xd2e4('0x21'),_0x31b729,_0xd2e4('0x24'));_0x4b8f4f(_0x5d7ce3[_0xd2e4('0x29')][_0xd2e4('0x28')]);}})[_0xd2e4('0x2a')](function(_0x151d02){logger[_0xd2e4('0x26')](_0xd2e4('0x21'),_0x31b729,_0x151d02);_0x55cc03(_0x151d02);});});}function respondWithStatusCode(_0x42b8f7,_0x1d1285){_0x1d1285=_0x1d1285||0xcc;return function(_0x404d3b){if(_0x404d3b){return _0x42b8f7[_0xd2e4('0x2b')](_0x1d1285);}return _0x42b8f7[_0xd2e4('0x2c')](_0x1d1285)['end']();};}function respondWithResult(_0x55c488,_0x5d1169){_0x5d1169=_0x5d1169||0xc8;return function(_0x3fb136){if(_0x3fb136){return _0x55c488['status'](_0x5d1169)[_0xd2e4('0x2d')](_0x3fb136);}};}function respondWithFilteredResult(_0x35b170,_0x30930d){return function(_0x4738fb){if(_0x4738fb){var _0x5cf975=typeof _0x30930d[_0xd2e4('0x2e')]==='undefined'&&typeof _0x30930d['limit']===_0xd2e4('0x2f');var _0x4a1470=_0x4738fb[_0xd2e4('0x30')];var _0x354e10=_0x5cf975?0x0:_0x30930d['offset'];var _0x1776a5=_0x5cf975?_0x4738fb[_0xd2e4('0x30')]:_0x30930d[_0xd2e4('0x2e')]+_0x30930d[_0xd2e4('0x31')];var _0x14ee09;if(_0x1776a5>=_0x4a1470){_0x1776a5=_0x4a1470;_0x14ee09=0xc8;}else{_0x14ee09=0xce;}_0x35b170[_0xd2e4('0x2c')](_0x14ee09);return _0x35b170[_0xd2e4('0x32')]('Content-Range',_0x354e10+'-'+_0x1776a5+'/'+_0x4a1470)[_0xd2e4('0x2d')](_0x4738fb);}return null;};}function patchUpdates(_0x5756a5){return function(_0x2e18de){try{jsonpatch[_0xd2e4('0x33')](_0x2e18de,_0x5756a5,!![]);}catch(_0x1eb7b0){return BPromise[_0xd2e4('0x34')](_0x1eb7b0);}return _0x2e18de['save']();};}function saveUpdates(_0x49d500,_0xe445b9){return function(_0x3a4e26){if(_0x3a4e26){return _0x3a4e26[_0xd2e4('0x35')](_0x49d500)[_0xd2e4('0x1f')](function(_0x4fc8c2){return _0x4fc8c2;});}return null;};}function removeEntity(_0x21c7ef,_0x4b45e1){return function(_0x33678c){if(_0x33678c){return _0x33678c[_0xd2e4('0x36')]()[_0xd2e4('0x1f')](function(){var _0x58fe94=_0x33678c[_0xd2e4('0x37')]({'plain':!![]});var _0x463822=_0xd2e4('0x38');return db[_0xd2e4('0x39')][_0xd2e4('0x36')]({'where':{'type':_0x463822,'resourceId':_0x58fe94['id']}})['then'](function(){return _0x33678c;});})[_0xd2e4('0x1f')](function(){_0x21c7ef[_0xd2e4('0x2c')](0xcc)[_0xd2e4('0x3a')]();});}};}function handleEntityNotFound(_0xa19660,_0x226685){return function(_0x3111bf){if(!_0x3111bf){_0xa19660[_0xd2e4('0x2b')](0x194);}return _0x3111bf;};}function handleError(_0x510c3d,_0xfb71e0){_0xfb71e0=_0xfb71e0||0x1f4;return function(_0x4aed72){logger['error'](_0x4aed72[_0xd2e4('0x3b')]);if(_0x4aed72[_0xd2e4('0x3c')]){delete _0x4aed72[_0xd2e4('0x3c')];}_0x510c3d[_0xd2e4('0x2c')](_0xfb71e0)['send'](_0x4aed72);};}exports[_0xd2e4('0x3d')]=function(_0x56c9c5,_0xb2f287){var _0x27c0c7={'include':[{'model':db[_0xd2e4('0x3e')],'as':_0xd2e4('0x3f')}]},_0x405a50={},_0x3e01f7={'count':0x0,'rows':[]};var _0xf6764=_['map'](db[_0xd2e4('0x40')][_0xd2e4('0x41')],function(_0x148898){return{'name':_0x148898['fieldName'],'type':_0x148898[_0xd2e4('0x42')][_0xd2e4('0x43')]};});_0x405a50[_0xd2e4('0x44')]=_[_0xd2e4('0x45')](_0xf6764,_0xd2e4('0x3c'));_0x405a50[_0xd2e4('0x46')]=_[_0xd2e4('0x47')](_0x56c9c5[_0xd2e4('0x46')]);_0x405a50[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0x405a50[_0xd2e4('0x44')],_0x405a50[_0xd2e4('0x46')]);_0x27c0c7[_0xd2e4('0x4a')]=_[_0xd2e4('0x49')](_0x405a50[_0xd2e4('0x44')],qs[_0xd2e4('0x4b')](_0x56c9c5[_0xd2e4('0x46')][_0xd2e4('0x4b')]));_0x27c0c7['attributes']=_0x27c0c7['attributes']['length']?_0x27c0c7[_0xd2e4('0x4a')]:_0x405a50['model'];if(!_0x56c9c5[_0xd2e4('0x46')][_0xd2e4('0x4c')](_0xd2e4('0x4d'))){_0x27c0c7[_0xd2e4('0x31')]=qs['limit'](_0x56c9c5[_0xd2e4('0x46')][_0xd2e4('0x31')]);_0x27c0c7[_0xd2e4('0x2e')]=qs['offset'](_0x56c9c5['query'][_0xd2e4('0x2e')]);}_0x27c0c7[_0xd2e4('0x4e')]=qs[_0xd2e4('0x4f')](_0x56c9c5['query']['sort']);_0x27c0c7[_0xd2e4('0x50')]=qs[_0xd2e4('0x48')](_[_0xd2e4('0x51')](_0x56c9c5[_0xd2e4('0x46')],_0x405a50[_0xd2e4('0x48')]),_0xf6764);if(_0x56c9c5[_0xd2e4('0x46')]['filter']){_0x27c0c7['where']=_[_0xd2e4('0x52')](_0x27c0c7[_0xd2e4('0x50')],{'$or':_['map'](_0xf6764,function(_0x4006aa){if(_0x4006aa[_0xd2e4('0x42')]!=='VIRTUAL'){var _0x53da0c={};_0x53da0c[_0x4006aa['name']]={'$like':'%'+_0x56c9c5['query'][_0xd2e4('0x53')]+'%'};return _0x53da0c;}})});}_0x27c0c7=_['merge']({},_0x27c0c7,_0x56c9c5[_0xd2e4('0x54')]);var _0x3665d8={'where':_0x27c0c7['where']};return db[_0xd2e4('0x40')][_0xd2e4('0x30')](_0x3665d8)[_0xd2e4('0x1f')](function(_0x8c9351){_0x3e01f7[_0xd2e4('0x30')]=_0x8c9351;if(_0x56c9c5['query'][_0xd2e4('0x55')]){_0x27c0c7['include']=[{'all':!![]}];}return db[_0xd2e4('0x40')][_0xd2e4('0x56')](_0x27c0c7);})['then'](function(_0x340da4){_0x3e01f7[_0xd2e4('0x57')]=_0x340da4;return _0x3e01f7;})[_0xd2e4('0x1f')](respondWithFilteredResult(_0xb2f287,_0x27c0c7))[_0xd2e4('0x2a')](handleError(_0xb2f287,null));};exports['show']=function(_0x335dea,_0x3f4a9c){var _0x3c680e={'raw':![],'where':{'id':_0x335dea[_0xd2e4('0x58')]['id']},'include':[{'model':db[_0xd2e4('0x3e')],'as':_0xd2e4('0x3f')}]},_0x48be77={};_0x48be77[_0xd2e4('0x44')]=_[_0xd2e4('0x47')](db[_0xd2e4('0x40')][_0xd2e4('0x41')]);_0x48be77[_0xd2e4('0x46')]=_[_0xd2e4('0x47')](_0x335dea['query']);_0x48be77[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0x48be77['model'],_0x48be77[_0xd2e4('0x46')]);_0x3c680e['attributes']=_[_0xd2e4('0x49')](_0x48be77[_0xd2e4('0x44')],qs['fields'](_0x335dea[_0xd2e4('0x46')][_0xd2e4('0x4b')]));_0x3c680e[_0xd2e4('0x4a')]=_0x3c680e['attributes'][_0xd2e4('0x59')]?_0x3c680e['attributes']:_0x48be77['model'];if(_0x335dea[_0xd2e4('0x46')][_0xd2e4('0x55')]){_0x3c680e['include']=[{'all':!![]}];}_0x3c680e=_['merge']({},_0x3c680e,_0x335dea['options']);return db['FaxAccount'][_0xd2e4('0x5a')](_0x3c680e)['then'](handleEntityNotFound(_0x3f4a9c,null))['then'](respondWithResult(_0x3f4a9c,null))[_0xd2e4('0x2a')](handleError(_0x3f4a9c,null));};exports[_0xd2e4('0x5b')]=function(_0x4c5a5a,_0x539152){return db['FaxAccount'][_0xd2e4('0x5b')](_0x4c5a5a['body'],{})[_0xd2e4('0x1f')](function(_0x4b3d42){var _0x160088=_0x4c5a5a[_0xd2e4('0x5c')]['get']({'plain':!![]});if(!_0x160088)throw new Error(_0xd2e4('0x5d'));if(_0x160088['role']===_0xd2e4('0x5c')){var _0x380dd2=_0x4b3d42[_0xd2e4('0x37')]({'plain':!![]});var _0x5dcf90='FaxAccounts';return db['UserProfileSection'][_0xd2e4('0x5a')]({'where':{'name':_0x5dcf90,'userProfileId':_0x160088['userProfileId']},'raw':!![]})[_0xd2e4('0x1f')](function(_0x3df800){if(_0x3df800&&_0x3df800[_0xd2e4('0x5e')]===0x0){return db[_0xd2e4('0x39')][_0xd2e4('0x5b')]({'name':_0x380dd2[_0xd2e4('0x3c')],'resourceId':_0x380dd2['id'],'type':_0x3df800[_0xd2e4('0x3c')],'sectionId':_0x3df800['id']},{})[_0xd2e4('0x1f')](function(){return _0x4b3d42;});}else{return _0x4b3d42;}})[_0xd2e4('0x2a')](function(_0x30c9a4){logger[_0xd2e4('0x26')](_0xd2e4('0x5f'),_0x30c9a4);throw _0x30c9a4;});}return _0x4b3d42;})[_0xd2e4('0x1f')](respondWithResult(_0x539152,0xc9))[_0xd2e4('0x2a')](handleError(_0x539152,null));};exports[_0xd2e4('0x35')]=function(_0x576191,_0x33800c){if(_0x576191[_0xd2e4('0x60')]['id']){delete _0x576191[_0xd2e4('0x60')]['id'];}return db['FaxAccount'][_0xd2e4('0x5a')]({'where':{'id':_0x576191[_0xd2e4('0x58')]['id']},'include':[{'model':db[_0xd2e4('0x3e')],'as':_0xd2e4('0x3f')}]})[_0xd2e4('0x1f')](handleEntityNotFound(_0x33800c,null))[_0xd2e4('0x1f')](saveUpdates(_0x576191[_0xd2e4('0x60')],null))['then'](respondWithResult(_0x33800c,null))[_0xd2e4('0x2a')](handleError(_0x33800c,null));};exports[_0xd2e4('0x36')]=function(_0x27ac03,_0x1de24d){return db[_0xd2e4('0x40')][_0xd2e4('0x5a')]({'where':{'id':_0x27ac03[_0xd2e4('0x58')]['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x1de24d,null))[_0xd2e4('0x1f')](removeEntity(_0x1de24d,null))[_0xd2e4('0x2a')](handleError(_0x1de24d,null));};exports['describe']=function(_0xa42d3b,_0x105b79){return db[_0xd2e4('0x40')][_0xd2e4('0x61')]()[_0xd2e4('0x1f')](respondWithResult(_0x105b79,null))[_0xd2e4('0x2a')](handleError(_0x105b79,null));};exports[_0xd2e4('0x62')]=function(_0x96c65c,_0x4e2793,_0x28deda){if(_0x96c65c[_0xd2e4('0x60')]['id']){delete _0x96c65c[_0xd2e4('0x60')]['id'];}return db['FaxAccount'][_0xd2e4('0x5a')]({'where':{'id':_0x96c65c['params']['id']}})['then'](handleEntityNotFound(_0x4e2793,null))[_0xd2e4('0x1f')](function(_0x16d418){if(_0x16d418){_0x96c65c[_0xd2e4('0x60')][_0xd2e4('0x63')]=_0x16d418['id'];return db[_0xd2e4('0x64')]['create'](_0x96c65c[_0xd2e4('0x60')]);}})[_0xd2e4('0x1f')](respondWithResult(_0x4e2793,null))['catch'](handleError(_0x4e2793,null));};exports[_0xd2e4('0x65')]=function(_0x331097,_0x445c0f,_0x246da5){var _0x47535d={'raw':![],'where':{}};var _0x165a9e={};var _0x4dd6f0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd2e4('0x66')]({'where':{'id':_0x331097[_0xd2e4('0x58')]['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x445c0f,null))['then'](function(_0x5ed094){if(_0x5ed094){_0x165a9e[_0xd2e4('0x44')]=_[_0xd2e4('0x47')](db[_0xd2e4('0x64')][_0xd2e4('0x41')]);_0x165a9e[_0xd2e4('0x46')]=_[_0xd2e4('0x47')](_0x331097[_0xd2e4('0x46')]);_0x165a9e[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0x165a9e['model'],_0x165a9e[_0xd2e4('0x46')]);_0x47535d[_0xd2e4('0x4a')]=_[_0xd2e4('0x49')](_0x165a9e[_0xd2e4('0x44')],qs[_0xd2e4('0x4b')](_0x331097[_0xd2e4('0x46')][_0xd2e4('0x4b')]));_0x47535d[_0xd2e4('0x4a')]=_0x47535d[_0xd2e4('0x4a')]['length']?_0x47535d[_0xd2e4('0x4a')]:_0x165a9e['model'];if(!_0x331097[_0xd2e4('0x46')][_0xd2e4('0x4c')](_0xd2e4('0x4d'))){_0x47535d[_0xd2e4('0x31')]=qs[_0xd2e4('0x31')](_0x331097[_0xd2e4('0x46')][_0xd2e4('0x31')]);_0x47535d['offset']=qs[_0xd2e4('0x2e')](_0x331097[_0xd2e4('0x46')]['offset']);}_0x47535d[_0xd2e4('0x4e')]=qs['sort'](_0x331097[_0xd2e4('0x46')][_0xd2e4('0x4f')]);_0x47535d[_0xd2e4('0x50')]=qs['filters'](_[_0xd2e4('0x51')](_0x331097['query'],_0x165a9e[_0xd2e4('0x48')]));_0x47535d['where'][_0xd2e4('0x63')]=_0x5ed094['id'];if(_0x331097['query'][_0xd2e4('0x53')]){_0x47535d['where']=_[_0xd2e4('0x52')](_0x47535d[_0xd2e4('0x50')],{'$or':_[_0xd2e4('0x45')](_0x47535d[_0xd2e4('0x4a')],function(_0x3ea85b){var _0x37eae0={};_0x37eae0[_0x3ea85b]={'$like':'%'+_0x331097[_0xd2e4('0x46')][_0xd2e4('0x53')]+'%'};return _0x37eae0;})});}_0x47535d=_[_0xd2e4('0x52')]({},_0x47535d,_0x331097[_0xd2e4('0x54')]);return db['Disposition'][_0xd2e4('0x30')]({'where':_0x47535d[_0xd2e4('0x50')]})[_0xd2e4('0x1f')](function(_0x55d32c){_0x4dd6f0[_0xd2e4('0x30')]=_0x55d32c;if(_0x331097[_0xd2e4('0x46')][_0xd2e4('0x55')]){_0x47535d[_0xd2e4('0x67')]=[{'all':!![]}];}return db[_0xd2e4('0x64')][_0xd2e4('0x56')](_0x47535d);})[_0xd2e4('0x1f')](function(_0x1195f4){_0x4dd6f0[_0xd2e4('0x57')]=_0x1195f4;return _0x4dd6f0;});}})[_0xd2e4('0x1f')](respondWithFilteredResult(_0x445c0f,_0x47535d))[_0xd2e4('0x2a')](handleError(_0x445c0f,null));};exports[_0xd2e4('0x68')]=function(_0x3aafed,_0x52381f,_0x1cac8d){return db[_0xd2e4('0x40')][_0xd2e4('0x5a')]({'where':{'id':_0x3aafed['params']['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x52381f,null))[_0xd2e4('0x1f')](function(_0x3ffba4){if(_0x3ffba4){return _0x3ffba4[_0xd2e4('0x68')](_0x3aafed[_0xd2e4('0x46')][_0xd2e4('0x69')]);}})[_0xd2e4('0x1f')](respondWithStatusCode(_0x52381f,null))['catch'](handleError(_0x52381f,null));};exports['addAnswer']=function(_0xb030e3,_0x289135,_0x3df46a){if(_0xb030e3[_0xd2e4('0x60')]['id']){delete _0xb030e3['body']['id'];}return db[_0xd2e4('0x40')][_0xd2e4('0x5a')]({'where':{'id':_0xb030e3['params']['id']}})['then'](handleEntityNotFound(_0x289135,null))['then'](function(_0x4a9e26){if(_0x4a9e26){_0xb030e3['body']['FaxAccountId']=_0x4a9e26['id'];return db[_0xd2e4('0x6a')][_0xd2e4('0x5b')](_0xb030e3[_0xd2e4('0x60')]);}})[_0xd2e4('0x1f')](respondWithResult(_0x289135,null))[_0xd2e4('0x2a')](handleError(_0x289135,null));};exports[_0xd2e4('0x6b')]=function(_0x210ec7,_0x27723b,_0x501f27){var _0x117eb3={'raw':![],'where':{}};var _0x1d9f41={};var _0x45766e={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd2e4('0x66')]({'where':{'id':_0x210ec7[_0xd2e4('0x58')]['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x27723b,null))[_0xd2e4('0x1f')](function(_0x1a9452){if(_0x1a9452){_0x1d9f41[_0xd2e4('0x44')]=_[_0xd2e4('0x47')](db['CannedAnswer'][_0xd2e4('0x41')]);_0x1d9f41[_0xd2e4('0x46')]=_['keys'](_0x210ec7['query']);_0x1d9f41[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0x1d9f41['model'],_0x1d9f41[_0xd2e4('0x46')]);_0x117eb3[_0xd2e4('0x4a')]=_[_0xd2e4('0x49')](_0x1d9f41[_0xd2e4('0x44')],qs[_0xd2e4('0x4b')](_0x210ec7[_0xd2e4('0x46')]['fields']));_0x117eb3['attributes']=_0x117eb3[_0xd2e4('0x4a')][_0xd2e4('0x59')]?_0x117eb3[_0xd2e4('0x4a')]:_0x1d9f41['model'];if(!_0x210ec7['query']['hasOwnProperty'](_0xd2e4('0x4d'))){_0x117eb3['limit']=qs[_0xd2e4('0x31')](_0x210ec7[_0xd2e4('0x46')][_0xd2e4('0x31')]);_0x117eb3[_0xd2e4('0x2e')]=qs['offset'](_0x210ec7[_0xd2e4('0x46')]['offset']);}_0x117eb3['order']=qs[_0xd2e4('0x4f')](_0x210ec7[_0xd2e4('0x46')][_0xd2e4('0x4f')]);_0x117eb3[_0xd2e4('0x50')]=qs[_0xd2e4('0x48')](_[_0xd2e4('0x51')](_0x210ec7[_0xd2e4('0x46')],_0x1d9f41[_0xd2e4('0x48')]));_0x117eb3[_0xd2e4('0x50')][_0xd2e4('0x63')]=_0x1a9452['id'];if(_0x210ec7[_0xd2e4('0x46')][_0xd2e4('0x53')]){_0x117eb3[_0xd2e4('0x50')]=_['merge'](_0x117eb3[_0xd2e4('0x50')],{'$or':_['map'](_0x117eb3['attributes'],function(_0x357208){var _0xb54550={};_0xb54550[_0x357208]={'$like':'%'+_0x210ec7[_0xd2e4('0x46')][_0xd2e4('0x53')]+'%'};return _0xb54550;})});}_0x117eb3=_[_0xd2e4('0x52')]({},_0x117eb3,_0x210ec7['options']);return db[_0xd2e4('0x6a')]['count']({'where':_0x117eb3[_0xd2e4('0x50')]})[_0xd2e4('0x1f')](function(_0x4824d7){_0x45766e[_0xd2e4('0x30')]=_0x4824d7;if(_0x210ec7[_0xd2e4('0x46')][_0xd2e4('0x55')]){_0x117eb3[_0xd2e4('0x67')]=[{'all':!![]}];}return db[_0xd2e4('0x6a')][_0xd2e4('0x56')](_0x117eb3);})[_0xd2e4('0x1f')](function(_0x43c4df){_0x45766e['rows']=_0x43c4df;return _0x45766e;});}})['then'](respondWithFilteredResult(_0x27723b,_0x117eb3))['catch'](handleError(_0x27723b,null));};exports[_0xd2e4('0x6c')]=function(_0x182f1e,_0x3a21aa,_0x3f7276){return db[_0xd2e4('0x40')][_0xd2e4('0x5a')]({'where':{'id':_0x182f1e[_0xd2e4('0x58')]['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x3a21aa,null))[_0xd2e4('0x1f')](function(_0x3bab52){if(_0x3bab52){return _0x3bab52[_0xd2e4('0x6c')](_0x182f1e['query']['ids']);}})['then'](respondWithStatusCode(_0x3a21aa,null))['catch'](handleError(_0x3a21aa,null));};exports[_0xd2e4('0x6d')]=function(_0xde22b7,_0x56c952,_0x15146e){return db['FaxInteraction'][_0xd2e4('0x5a')]({'where':{'id':_0xde22b7['params']['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x56c952,null))[_0xd2e4('0x1f')](function(_0x44123e){if(_0x44123e){return _0x44123e[_0xd2e4('0x6d')](_0xde22b7[_0xd2e4('0x60')][_0xd2e4('0x69')],_[_0xd2e4('0x6e')](_0xde22b7[_0xd2e4('0x60')],[_0xd2e4('0x69'),'id'])||{});}})[_0xd2e4('0x1f')](respondWithResult(_0x56c952,null))[_0xd2e4('0x2a')](handleError(_0x56c952,null));};exports[_0xd2e4('0x6f')]=function(_0x3ef6df,_0x2df365,_0x2f8fae){var _0x9fb8d0={'raw':![],'where':{}};var _0x2970ab={};var _0x1c6a50={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd2e4('0x66')]({'where':{'id':_0x3ef6df[_0xd2e4('0x58')]['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x2df365,null))['then'](function(_0x559438){if(_0x559438){_0x2970ab[_0xd2e4('0x44')]=_[_0xd2e4('0x47')](db[_0xd2e4('0x70')][_0xd2e4('0x41')]);_0x2970ab[_0xd2e4('0x46')]=_['keys'](_0x3ef6df[_0xd2e4('0x46')]);_0x2970ab[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0x2970ab[_0xd2e4('0x44')],_0x2970ab[_0xd2e4('0x46')]);_0x9fb8d0[_0xd2e4('0x4a')]=_[_0xd2e4('0x49')](_0x2970ab[_0xd2e4('0x44')],qs['fields'](_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x4b')]));_0x9fb8d0[_0xd2e4('0x4a')]=_0x9fb8d0[_0xd2e4('0x4a')][_0xd2e4('0x59')]?_0x9fb8d0[_0xd2e4('0x4a')]:_0x2970ab['model'];if(!_0x3ef6df[_0xd2e4('0x46')]['hasOwnProperty'](_0xd2e4('0x4d'))){_0x9fb8d0[_0xd2e4('0x31')]=qs['limit'](_0x3ef6df['query'][_0xd2e4('0x31')]);_0x9fb8d0[_0xd2e4('0x2e')]=qs[_0xd2e4('0x2e')](_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x2e')]);}_0x9fb8d0[_0xd2e4('0x4e')]=qs['sort'](_0x3ef6df[_0xd2e4('0x46')]['sort']);_0x9fb8d0[_0xd2e4('0x50')]=qs[_0xd2e4('0x48')](_[_0xd2e4('0x51')](_0x3ef6df['query'],_0x2970ab[_0xd2e4('0x48')]));_0x9fb8d0[_0xd2e4('0x50')]['FaxAccountId']=_0x559438['id'];if(_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x53')]){_0x9fb8d0[_0xd2e4('0x50')]=_[_0xd2e4('0x52')](_0x9fb8d0[_0xd2e4('0x50')],{'$or':_[_0xd2e4('0x45')](_0x9fb8d0['attributes'],function(_0x49e439){var _0x15a46a={};_0x15a46a[_0x49e439]={'$like':'%'+_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x53')]+'%'};return _0x15a46a;})});}_0x9fb8d0=_[_0xd2e4('0x52')]({},_0x9fb8d0,_0x3ef6df[_0xd2e4('0x54')]);return db[_0xd2e4('0x70')][_0xd2e4('0x30')]({'where':_0x9fb8d0[_0xd2e4('0x50')]})[_0xd2e4('0x1f')](function(_0x344149){_0x1c6a50[_0xd2e4('0x30')]=_0x344149;if(_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x55')]){_0x9fb8d0[_0xd2e4('0x67')]=[{'model':db[_0xd2e4('0x71')],'as':_0xd2e4('0x72'),'required':![]},{'model':db['User'],'as':_0xd2e4('0x73'),'attributes':[_0xd2e4('0x3c'),_0xd2e4('0x74'),_0xd2e4('0x75')],'required':![]},{'model':db[_0xd2e4('0x76')],'as':_0xd2e4('0x77'),'attributes':['id',_0xd2e4('0x3c'),'color'],'where':_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x78')]?{'id':_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x78')]}:undefined,'required':_0x3ef6df[_0xd2e4('0x46')][_0xd2e4('0x78')]?!![]:![]}];}return db[_0xd2e4('0x70')][_0xd2e4('0x56')](_0x9fb8d0);})[_0xd2e4('0x1f')](function(_0x1eef43){_0x1c6a50[_0xd2e4('0x57')]=_0x1eef43;return _0x1c6a50;});}})[_0xd2e4('0x1f')](respondWithFilteredResult(_0x2df365,_0x9fb8d0))[_0xd2e4('0x2a')](handleError(_0x2df365,null));};exports[_0xd2e4('0x79')]=function(_0x3310cb,_0x27d594){var _0x23b744=_0x3310cb['params']['id'];var _0x4fe018=_0x3310cb['body'];var _0x2e7235=0xc8;var _0x45f7c7=null;return db['sequelize'][_0xd2e4('0x7a')]({'isolationLevel':db['sequelize'][_0xd2e4('0x7b')][_0xd2e4('0x7c')][_0xd2e4('0x7d')]},function(_0x1c3ff9){return db[_0xd2e4('0x40')]['findOne']({'where':{'id':_0x23b744},'transaction':_0x1c3ff9})[_0xd2e4('0x1f')](function(_0x30e521){if(_0x30e521){return db[_0xd2e4('0x7e')]['destroy']({'where':{'FaxAccountId':_0x23b744},'transaction':_0x1c3ff9})[_0xd2e4('0x1f')](function(){var _0x34abae=_[_0xd2e4('0x45')](_0x4fe018,function(_0x2e88a2){_0x2e88a2[_0xd2e4('0x63')]=_0x23b744;return _0x2e88a2;});return db[_0xd2e4('0x7e')]['bulkCreate'](_0x34abae,{'transaction':_0x1c3ff9});});}else{_0x2e7235=0x194;_0x45f7c7=[];}});})[_0xd2e4('0x1f')](function(){if(_0x2e7235!==0x194){return db[_0xd2e4('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0x23b744},'order':_0xd2e4('0x7f')})[_0xd2e4('0x1f')](function(_0xa492fc){_0x45f7c7=_0xa492fc;});}})[_0xd2e4('0x2a')](function(_0x230ed0){_0x2e7235=0x1f4;logger[_0xd2e4('0x26')](_0x230ed0['stack']);if(_0x230ed0[_0xd2e4('0x3c')]){delete _0x230ed0[_0xd2e4('0x3c')];}_0x45f7c7=_0x230ed0;})[_0xd2e4('0x80')](function(){if(_0x45f7c7===null){_0x27d594[_0xd2e4('0x2b')](_0x2e7235);}else{if(_0x2e7235===0x1f4){_0x27d594['status'](_0x2e7235)['send'](_0x45f7c7);}else{_0x27d594['status'](_0x2e7235)[_0xd2e4('0x2d')](_0x45f7c7);}}});};exports[_0xd2e4('0x81')]=function(_0x303a88,_0xae7543,_0x49d124){var _0x16f518={};var _0xeb19a4={};var _0x355c48;var _0x5c3e5a;return db[_0xd2e4('0x40')][_0xd2e4('0x66')]({'where':{'id':_0x303a88['params']['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0xae7543,null))[_0xd2e4('0x1f')](function(_0x242d53){if(_0x242d53){_0x355c48=_0x242d53;_0xeb19a4[_0xd2e4('0x44')]=_[_0xd2e4('0x47')](db[_0xd2e4('0x7e')]['rawAttributes']);_0xeb19a4[_0xd2e4('0x46')]=_[_0xd2e4('0x47')](_0x303a88['query']);_0xeb19a4[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0xeb19a4[_0xd2e4('0x44')],_0xeb19a4[_0xd2e4('0x46')]);_0x16f518[_0xd2e4('0x4a')]=_['intersection'](_0xeb19a4[_0xd2e4('0x44')],qs[_0xd2e4('0x4b')](_0x303a88['query']['fields']));_0x16f518['attributes']=_0x16f518[_0xd2e4('0x4a')]['length']?_0x16f518['attributes']:_0xeb19a4[_0xd2e4('0x44')];_0x16f518['order']=qs[_0xd2e4('0x4f')](_0x303a88['query'][_0xd2e4('0x4f')]);_0x16f518['where']=qs[_0xd2e4('0x48')](_[_0xd2e4('0x51')](_0x303a88[_0xd2e4('0x46')],_0xeb19a4[_0xd2e4('0x48')]));if(_0x303a88[_0xd2e4('0x46')][_0xd2e4('0x53')]){_0x16f518[_0xd2e4('0x50')]=_['merge'](_0x16f518['where'],{'$or':_[_0xd2e4('0x45')](_0x16f518[_0xd2e4('0x4a')],function(_0x27878c){var _0x3c45da={};_0x3c45da[_0x27878c]={'$like':'%'+_0x303a88[_0xd2e4('0x46')][_0xd2e4('0x53')]+'%'};return _0x3c45da;})});}_0x16f518=_['merge']({},_0x16f518,_0x303a88[_0xd2e4('0x54')]);return _0x355c48[_0xd2e4('0x81')](_0x16f518);}})[_0xd2e4('0x1f')](function(_0x1573e9){if(_0x1573e9){_0x5c3e5a=_0x1573e9[_0xd2e4('0x59')];if(!_0x303a88['query'][_0xd2e4('0x4c')](_0xd2e4('0x4d'))){_0x16f518['limit']=qs['limit'](_0x303a88[_0xd2e4('0x46')]['limit']);_0x16f518[_0xd2e4('0x2e')]=qs['offset'](_0x303a88['query'][_0xd2e4('0x2e')]);}return _0x355c48[_0xd2e4('0x81')](_0x16f518);}})[_0xd2e4('0x1f')](function(_0x3638b2){if(_0x3638b2){return _0x3638b2?{'count':_0x5c3e5a,'rows':_0x3638b2}:null;}})[_0xd2e4('0x1f')](respondWithResult(_0xae7543,null))[_0xd2e4('0x2a')](handleError(_0xae7543,null));};function Extension(_0x4b05da,_0x3874e4,_0x3e8dd0,_0x4c6f89){this[_0xd2e4('0x82')]=_0xd2e4('0x83');this[_0xd2e4('0x84')]=_0x4b05da[_0xd2e4('0x85')];this[_0xd2e4('0x86')]=_0x4c6f89;this['type']='system';this[_0xd2e4('0x87')]=_0xd2e4('0x88');this['FaxAccountId']=_0x4b05da['id'];this[_0xd2e4('0x7f')]=_0x3874e4;this[_0xd2e4('0x89')]=_0x3e8dd0;}function createExtensionsReciveFax(_0x50a24c){var _0x58b363=0x1;var _0x1950fa=[];_0x1950fa[_0xd2e4('0x8a')](new Extension(_0x50a24c,_0x58b363,'',_0xd2e4('0x8b')));_0x58b363+=0x1;_0x1950fa['push'](new Extension(_0x50a24c,_0x58b363,_0xd2e4('0x8c'),_0xd2e4('0x8d')));_0x58b363+=0x1;for(var _0x4ee4ca in _0x50a24c){if(_0x50a24c['hasOwnProperty'](_0x4ee4ca)&&(_0x4ee4ca===_0xd2e4('0x8e')||_0x4ee4ca===_0xd2e4('0x85')||_0x4ee4ca===_0xd2e4('0x8f')||_0x4ee4ca==='faxdetect'||_0x4ee4ca==='headerinfo'||_0x4ee4ca===_0xd2e4('0x90')||_0x4ee4ca===_0xd2e4('0x91')||_0x4ee4ca==='modem'||_0x4ee4ca==='t38timeout')){_0x1950fa[_0xd2e4('0x8a')](new Extension(_0x50a24c,_0x58b363,_0xd2e4('0x92')+_0x4ee4ca+')='+_0x50a24c[_0x4ee4ca],_0xd2e4('0x8d')));_0x58b363+=0x1;}}_0x1950fa[_0xd2e4('0x8a')](new Extension(_0x50a24c,_0x58b363,'6',_0xd2e4('0x93')));_0x58b363+=0x1;_0x1950fa[_0xd2e4('0x8a')](new Extension(_0x50a24c,_0x58b363,_0xd2e4('0x94'),_0xd2e4('0x95')));_0x58b363=0x0;return _0x1950fa;}exports[_0xd2e4('0x96')]=function(_0x1161e6,_0x21fba5,_0x208ac6){var _0x48e6f6;return db[_0xd2e4('0x97')]['transaction'](function(_0x215835){return db[_0xd2e4('0x40')][_0xd2e4('0x5b')](_0x1161e6[_0xd2e4('0x60')],{'transaction':_0x215835})[_0xd2e4('0x1f')](function(_0x427d27){_0x48e6f6=_0x427d27[_0xd2e4('0x37')]({'plain':!![]});return db[_0xd2e4('0x98')][_0xd2e4('0x99')](createExtensionsReciveFax(_0x48e6f6),{'transaction':_0x215835});});})[_0xd2e4('0x1f')](function(){return _0x48e6f6;})[_0xd2e4('0x1f')](respondWithResult(_0x21fba5,null))[_0xd2e4('0x2a')](handleError(_0x21fba5,null));};exports[_0xd2e4('0x9a')]=function(_0x1d6948,_0x3eb758,_0x161683){var _0xbfb95d;return db[_0xd2e4('0x97')][_0xd2e4('0x7a')](function(_0x111fc7){return db[_0xd2e4('0x40')]['update'](_0x1d6948[_0xd2e4('0x60')],{'where':{'id':_0x1d6948[_0xd2e4('0x60')]['id']},'transaction':_0x111fc7})['then'](function(_0x3b06a9){return db['VoiceExtension'][_0xd2e4('0x36')]({'where':{'FaxAccountId':_0x1d6948[_0xd2e4('0x60')]['id']},'transaction':_0x111fc7})[_0xd2e4('0x1f')](function(_0x349512){return db['VoiceExtension'][_0xd2e4('0x99')](createExtensionsReciveFax(_[_0xd2e4('0x6e')](_0x1d6948[_0xd2e4('0x60')],[_0xd2e4('0x9b'),_0xd2e4('0x43'),_0xd2e4('0x9c'),_0xd2e4('0x9d'),'TrunkId',_0xd2e4('0x9e')])),{'transaction':_0x111fc7});});});})[_0xd2e4('0x1f')](function(){return db[_0xd2e4('0x40')][_0xd2e4('0x9f')](_0x1d6948[_0xd2e4('0x60')]['id']);})[_0xd2e4('0x1f')](respondWithResult(_0x3eb758,null))[_0xd2e4('0x2a')](handleError(_0x3eb758,null));};exports['getMessages']=function(_0x298668,_0x176cf9,_0x5cdac5){var _0x3357b3={'raw':!![],'where':{}};var _0x3b6901={};var _0xd1170d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd2e4('0x66')]({'where':{'id':_0x298668['params']['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x176cf9,null))[_0xd2e4('0x1f')](function(_0x5bc1ee){if(_0x5bc1ee){_0x3b6901['model']=_[_0xd2e4('0x47')](db[_0xd2e4('0xa0')][_0xd2e4('0x41')]);_0x3b6901[_0xd2e4('0x46')]=_[_0xd2e4('0x47')](_0x298668[_0xd2e4('0x46')]);_0x3b6901[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0x3b6901['model'],_0x3b6901['query']);_0x3357b3[_0xd2e4('0x4a')]=_[_0xd2e4('0x49')](_0x3b6901[_0xd2e4('0x44')],qs[_0xd2e4('0x4b')](_0x298668[_0xd2e4('0x46')][_0xd2e4('0x4b')]));_0x3357b3['attributes']=_0x3357b3[_0xd2e4('0x4a')][_0xd2e4('0x59')]?_0x3357b3[_0xd2e4('0x4a')]:_0x3b6901[_0xd2e4('0x44')];if(!_0x298668['query'][_0xd2e4('0x4c')](_0xd2e4('0x4d'))){_0x3357b3['limit']=qs['limit'](_0x298668[_0xd2e4('0x46')][_0xd2e4('0x31')]);_0x3357b3[_0xd2e4('0x2e')]=qs[_0xd2e4('0x2e')](_0x298668[_0xd2e4('0x46')][_0xd2e4('0x2e')]);}_0x3357b3[_0xd2e4('0x4e')]=qs[_0xd2e4('0x4f')](_0x298668[_0xd2e4('0x46')]['sort']);_0x3357b3[_0xd2e4('0x50')]=qs[_0xd2e4('0x48')](_[_0xd2e4('0x51')](_0x298668[_0xd2e4('0x46')],_0x3b6901[_0xd2e4('0x48')]));_0x3357b3[_0xd2e4('0x50')][_0xd2e4('0x63')]=_0x5bc1ee['id'];if(_0x298668[_0xd2e4('0x46')][_0xd2e4('0x53')]){_0x3357b3['where']=_[_0xd2e4('0x52')](_0x3357b3[_0xd2e4('0x50')],{'$or':_['map'](_0x3357b3[_0xd2e4('0x4a')],function(_0x28c245){var _0x3fce67={};_0x3fce67[_0x28c245]={'$like':'%'+_0x298668[_0xd2e4('0x46')][_0xd2e4('0x53')]+'%'};return _0x3fce67;})});}if(_0x298668[_0xd2e4('0x46')]['$gte']){var _0x167de8=_0x298668[_0xd2e4('0x46')]['$gte'][_0xd2e4('0xa1')](',');var _0x2b0921={};_0x2b0921[_0x167de8[0x0]]={'$gte':moment(_0x167de8[0x1])[_0xd2e4('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3357b3[_0xd2e4('0x50')]=_[_0xd2e4('0x52')](_0x3357b3[_0xd2e4('0x50')],_0x2b0921);}_0x3357b3=_[_0xd2e4('0x52')]({},_0x3357b3,_0x298668[_0xd2e4('0x54')]);return db[_0xd2e4('0xa0')][_0xd2e4('0x30')]({'where':_0x3357b3['where']})[_0xd2e4('0x1f')](function(_0x7ae7c3){_0xd1170d[_0xd2e4('0x30')]=_0x7ae7c3;if(_0x298668[_0xd2e4('0x46')][_0xd2e4('0x55')]){_0x3357b3[_0xd2e4('0x67')]=[{'all':!![]}];}return db[_0xd2e4('0xa0')][_0xd2e4('0x56')](_0x3357b3);})[_0xd2e4('0x1f')](function(_0x111858){_0xd1170d['rows']=_0x111858;return _0xd1170d;});}})[_0xd2e4('0x1f')](respondWithFilteredResult(_0x176cf9,_0x3357b3))[_0xd2e4('0x2a')](handleError(_0x176cf9,null));};exports[_0xd2e4('0xa3')]=function(_0x2a9549,_0xa953e1,_0x440dd8){var _0xf0a7cc,_0x376dac={},_0x31a365;if(_0x2a9549['body']['to']){_0x31a365=_0x2a9549['body']['to'][0x0];}return db[_0xd2e4('0x40')][_0xd2e4('0x5a')]({'where':{'id':_0x2a9549[_0xd2e4('0x58')]['id']},'include':[{'model':db[_0xd2e4('0xa4')],'as':'List','include':[{'model':db[_0xd2e4('0x71')],'as':_0xd2e4('0xa5'),'where':{'fax':_0x31a365},'limit':0x1,'order':[[_0xd2e4('0x9d'),_0xd2e4('0xa6')]]}]}]})[_0xd2e4('0x1f')](handleEntityNotFound(_0xa953e1,null))[_0xd2e4('0x1f')](function(_0x2be3ba){_0xf0a7cc=_0x2be3ba;if(_0x2a9549['body'][_0xd2e4('0xa7')]&&_0x2a9549['body'][_0xd2e4('0xa7')][_0xd2e4('0x59')]){for(var _0xba7f04=0x0;_0xba7f04<_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][_0xd2e4('0x59')];_0xba7f04+=0x1){_0x2a9549[_0xd2e4('0x60')]['attachments'][_0xba7f04]={'filename':_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][_0xba7f04][_0xd2e4('0x3c')],'id':_0x2a9549['body'][_0xd2e4('0xa7')][_0xba7f04]['id'],'path':path['join'](config[_0xd2e4('0xa8')],_0xd2e4('0xa9'),_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][_0xba7f04][_0xd2e4('0xaa')])};}}return respondWithRpcPromise(_0xd2e4('0xab'),_0xd2e4('0xab'),{'FaxAccountId':_[_0xd2e4('0xac')](_0x2a9549[_0xd2e4('0x58')]['id'])?undefined:_0x2a9549[_0xd2e4('0x58')]['id'],'path':_[_0xd2e4('0xac')](_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][0x0][_0xd2e4('0xad')])?undefined:_0x2a9549['body'][_0xd2e4('0xa7')][0x0][_0xd2e4('0xad')],'fax':_[_0xd2e4('0xac')](_0x2a9549[_0xd2e4('0x60')]['to'][0x0])?undefined:_0x2a9549[_0xd2e4('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0xf0a7cc){if(_[_0xd2e4('0xac')](_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xae')])){_0x2a9549['body'][_0xd2e4('0xae')]=util[_0xd2e4('0xa2')]('\x22%s\x22\x20<%s>',_0xf0a7cc[_0xd2e4('0x3c')],_0xf0a7cc[_0xd2e4('0xaf')]);}if(_0xf0a7cc['List']){if(_0xf0a7cc[_0xd2e4('0xb0')][_0xd2e4('0xa5')][_0xd2e4('0x59')]){return _0xf0a7cc['List'][_0xd2e4('0xa5')][0x0];}else{return db[_0xd2e4('0x71')]['create'](_[_0xd2e4('0xb1')](_0x2a9549[_0xd2e4('0x60')],{'firstName':_0x2a9549[_0xd2e4('0x60')]['to'][0x0],'phone':_0x2a9549[_0xd2e4('0x60')]['to'][0x0],'fax':_0x2a9549[_0xd2e4('0x60')]['to'][0x0],'ListId':_0xf0a7cc['ListId']}));}}else{throw new Error(_0xd2e4('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xd2e4('0x1f')](function(_0x553578){if(_0x553578){return db[_0xd2e4('0x70')][_0xd2e4('0x5a')]({'where':{'ContactId':_0x553578['id'],'closed':![],'FaxAccountId':_0xf0a7cc['id']}})[_0xd2e4('0x1f')](function(_0x4b5cc8){if(_0x4b5cc8){return[_0x4b5cc8,![]];}return db[_0xd2e4('0x70')]['create']({'UserId':_0x2a9549['user']['id'],'ContactId':_0x553578['id'],'FaxAccountId':_0xf0a7cc['id'],'fax':_0x2a9549['body']['to'][0x0],'firstMsgDirection':_0xd2e4('0xb3'),'Messages':[_['merge'](_0x2a9549['body'],{'read':![],'body':_0x2a9549[_0xd2e4('0x60')]['attachments'][0x0][_0xd2e4('0xb4')],'FaxAccountId':_0xf0a7cc['id'],'UserId':_0x2a9549[_0xd2e4('0x5c')]['id'],'ContactId':_0x553578['id'],'AttachmentId':_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xd2e4('0xb5')}]})[_0xd2e4('0x1f')](function(_0x301510){return[_0x301510,!![]];});});}else{throw new Error(_0xd2e4('0xb6'));}})[_0xd2e4('0xb7')](function(_0x7b2814,_0x375127){if(_0x375127){return _0x7b2814;}return db[_0xd2e4('0xa0')][_0xd2e4('0x5b')]({'direction':_0xd2e4('0xb3'),'read':![],'body':_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][0x0]['filename'],'FaxAccountId':_0xf0a7cc['id'],'FaxInteractionId':_0x7b2814['id'],'UserId':_0x2a9549[_0xd2e4('0x5c')]['id'],'ContactId':_0x7b2814[_0xd2e4('0xb8')],'AttachmentId':_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][0x0]['id']})[_0xd2e4('0x1f')](function(_0x44dbeb){_0x7b2814[_0xd2e4('0xb9')]['Messages']=[];_0x7b2814[_0xd2e4('0xb9')][_0xd2e4('0xb5')][_0xd2e4('0x8a')](_0x44dbeb[_0xd2e4('0xb9')]);return _0x7b2814;});})[_0xd2e4('0x1f')](function(_0x1bf809){respondWithRpcPromise(_0xd2e4('0xba'),_0xd2e4('0xba'),{'FaxAccountId':_[_0xd2e4('0xac')](_0x2a9549[_0xd2e4('0x58')]['id'])?undefined:_0x2a9549[_0xd2e4('0x58')]['id'],'path':_[_0xd2e4('0xac')](_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][0x0][_0xd2e4('0xad')])?undefined:_0x2a9549[_0xd2e4('0x60')]['attachments'][0x0][_0xd2e4('0xad')],'fax':_[_0xd2e4('0xac')](_0x2a9549[_0xd2e4('0x60')]['to'][0x0])?undefined:_0x2a9549['body']['to'][0x0],'AttachmentId':_0x2a9549[_0xd2e4('0x60')][_0xd2e4('0xa7')][0x0]['id']},client9002)[_0xd2e4('0x1f')](function(_0x5a7b88){logger[_0xd2e4('0x20')](_0xd2e4('0xbb'),_0x5a7b88);})[_0xd2e4('0x2a')](function(_0x4a8a2a){logger[_0xd2e4('0x20')]('SendFaxRpc,\x20%s',_0x4a8a2a);});return _0x1bf809;})[_0xd2e4('0x1f')](respondWithResult(_0xa953e1,null))[_0xd2e4('0x2a')](handleError(_0xa953e1,null));};exports[_0xd2e4('0xbc')]=function(_0xc9952e,_0x40b6a9,_0x59c805){return db[_0xd2e4('0x40')][_0xd2e4('0x5a')]({'where':{'id':_0xc9952e['params']['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x40b6a9,null))[_0xd2e4('0x1f')](function(_0xd0b8b){if(_0xd0b8b){return _0xd0b8b[_0xd2e4('0xbc')](_0xc9952e[_0xd2e4('0x60')][_0xd2e4('0x69')],_[_0xd2e4('0x6e')](_0xc9952e[_0xd2e4('0x60')],[_0xd2e4('0x69'),'id'])||{})[_0xd2e4('0xb7')](function(_0x4a692b){for(var _0x9b03d0=0x0;_0x9b03d0<_0xc9952e[_0xd2e4('0x60')][_0xd2e4('0x69')][_0xd2e4('0x59')];_0x9b03d0+=0x1){socket['emit'](_0xd2e4('0xbd'),{'UserId':Number(_0xc9952e['body'][_0xd2e4('0x69')][_0x9b03d0]),'FaxAccountId':Number(_0xc9952e[_0xd2e4('0x58')]['id'])});}return _0x4a692b;});}})[_0xd2e4('0x1f')](respondWithResult(_0x40b6a9,null))[_0xd2e4('0x2a')](handleError(_0x40b6a9,null));};exports['removeAgents']=function(_0x53571d,_0x38ecb8,_0xe089f8){return db[_0xd2e4('0x40')][_0xd2e4('0x5a')]({'where':{'id':_0x53571d[_0xd2e4('0x58')]['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0x38ecb8,null))[_0xd2e4('0x1f')](function(_0x10d7c7){if(_0x10d7c7){return _0x10d7c7['removeAgents'](_0x53571d['query'][_0xd2e4('0x69')])[_0xd2e4('0x1f')](function(){if(_[_0xd2e4('0xbe')](_0x53571d[_0xd2e4('0x46')][_0xd2e4('0x69')])){for(var _0x1b8a6f=0x0;_0x1b8a6f<_0x53571d[_0xd2e4('0x46')][_0xd2e4('0x69')]['length'];_0x1b8a6f+=0x1){socket[_0xd2e4('0xbf')](_0xd2e4('0xc0'),{'UserId':Number(_0x53571d[_0xd2e4('0x46')][_0xd2e4('0x69')][_0x1b8a6f]),'FaxAccountId':Number(_0x53571d[_0xd2e4('0x58')]['id'])});}}else{socket[_0xd2e4('0xbf')](_0xd2e4('0xc0'),{'UserId':Number(_0x53571d[_0xd2e4('0x46')]['ids']),'FaxAccountId':Number(_0x53571d['params']['id'])});}});}})[_0xd2e4('0x1f')](respondWithStatusCode(_0x38ecb8,null))[_0xd2e4('0x2a')](handleError(_0x38ecb8,null));};exports[_0xd2e4('0xc1')]=function(_0x13d324,_0xbbbf58,_0x11c63d){var _0x321119={};var _0x4cea41={};var _0x365264;var _0x34b200;return db[_0xd2e4('0x40')]['findOne']({'where':{'id':_0x13d324[_0xd2e4('0x58')]['id']}})[_0xd2e4('0x1f')](handleEntityNotFound(_0xbbbf58,null))[_0xd2e4('0x1f')](function(_0x4a7f50){if(_0x4a7f50){_0x365264=_0x4a7f50;_0x4cea41['model']=_[_0xd2e4('0x47')](db[_0xd2e4('0xc2')]['rawAttributes']);_0x4cea41[_0xd2e4('0x46')]=_[_0xd2e4('0x47')](_0x13d324[_0xd2e4('0x46')]);_0x4cea41[_0xd2e4('0x48')]=_[_0xd2e4('0x49')](_0x4cea41[_0xd2e4('0x44')],_0x4cea41[_0xd2e4('0x46')]);_0x321119[_0xd2e4('0x4a')]=_[_0xd2e4('0x49')](_0x4cea41[_0xd2e4('0x44')],qs[_0xd2e4('0x4b')](_0x13d324[_0xd2e4('0x46')][_0xd2e4('0x4b')]));_0x321119['attributes']=_0x321119[_0xd2e4('0x4a')][_0xd2e4('0x59')]?_0x321119['attributes']:_0x4cea41[_0xd2e4('0x44')];_0x321119[_0xd2e4('0x4e')]=qs[_0xd2e4('0x4f')](_0x13d324[_0xd2e4('0x46')][_0xd2e4('0x4f')]);_0x321119[_0xd2e4('0x50')]=qs['filters'](_[_0xd2e4('0x51')](_0x13d324[_0xd2e4('0x46')],_0x4cea41[_0xd2e4('0x48')]));if(_0x13d324[_0xd2e4('0x46')][_0xd2e4('0x53')]){_0x321119['where']=_[_0xd2e4('0x52')](_0x321119['where'],{'$or':_[_0xd2e4('0x45')](_0x321119['attributes'],function(_0x15cc33){var _0x5c03a2={};_0x5c03a2[_0x15cc33]={'$like':'%'+_0x13d324[_0xd2e4('0x46')]['filter']+'%'};return _0x5c03a2;})});}_0x321119=_['merge']({},_0x321119,_0x13d324['options']);return _0x365264['getAgents'](_0x321119);}})['then'](function(_0x57b970){if(_0x57b970){_0x34b200=_0x57b970[_0xd2e4('0x59')];if(!_0x13d324['query']['hasOwnProperty'](_0xd2e4('0x4d'))){_0x321119[_0xd2e4('0x31')]=qs['limit'](_0x13d324[_0xd2e4('0x46')][_0xd2e4('0x31')]);_0x321119[_0xd2e4('0x2e')]=qs[_0xd2e4('0x2e')](_0x13d324[_0xd2e4('0x46')][_0xd2e4('0x2e')]);}return _0x365264[_0xd2e4('0xc1')](_0x321119);}})[_0xd2e4('0x1f')](function(_0x315e8e){if(_0x315e8e){return _0x315e8e?{'count':_0x34b200,'rows':_0x315e8e}:null;}})['then'](respondWithResult(_0xbbbf58,null))[_0xd2e4('0x2a')](handleError(_0xbbbf58,null));}; \ No newline at end of file +var _0x7ac9=['apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','mandatoryDispositionPause','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','priority','finally','send','getApplications','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','gateway','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./faxAccount.socket','jayson/promise','client','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','undefined','count','offset','limit','set','json'];(function(_0x214a03,_0x2e4061){var _0xda476a=function(_0x1c46b2){while(--_0x1c46b2){_0x214a03['push'](_0x214a03['shift']());}};_0xda476a(++_0x2e4061);}(_0x7ac9,0x157));var _0x97ac=function(_0x476e8b,_0x42e119){_0x476e8b=_0x476e8b-0x0;var _0x5068c8=_0x7ac9[_0x476e8b];return _0x5068c8;};'use strict';var emlformat=require(_0x97ac('0x0'));var rimraf=require(_0x97ac('0x1'));var zipdir=require(_0x97ac('0x2'));var jsonpatch=require(_0x97ac('0x3'));var rp=require('request-promise');var moment=require(_0x97ac('0x4'));var BPromise=require(_0x97ac('0x5'));var Mustache=require(_0x97ac('0x6'));var util=require(_0x97ac('0x7'));var path=require(_0x97ac('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x97ac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97ac('0xa'));var crypto=require(_0x97ac('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x97ac('0xc'));var toCsv=require(_0x97ac('0xd'));var querystring=require('querystring');var Papa=require(_0x97ac('0xe'));var Redis=require(_0x97ac('0xf'));var authService=require(_0x97ac('0x10'));var qs=require(_0x97ac('0x11'));var as=require(_0x97ac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97ac('0x13'))(_0x97ac('0x14'));var utils=require(_0x97ac('0x15'));var config=require(_0x97ac('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x97ac('0x17')]=_['defaults'](config[_0x97ac('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x97ac('0x18'))(new Redis(config['redis']));require(_0x97ac('0x19'))['register'](socket);var jayson=require(_0x97ac('0x1a'));var client=jayson[_0x97ac('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x97ac('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48dc7a,_0x1aeb52,_0x32eb1d,_0xe2ba5a){return new BPromise(function(_0x128b10,_0x48edf7){var _0x2e265d=_0xe2ba5a||client;return _0x2e265d[_0x97ac('0x1c')](_0x48dc7a,_0x32eb1d)[_0x97ac('0x1d')](function(_0x524b6e){logger[_0x97ac('0x1e')](_0x97ac('0x1f'),_0x1aeb52,'request\x20sent');logger['debug'](_0x97ac('0x20'),_0x1aeb52,_0x97ac('0x21'),JSON[_0x97ac('0x22')](_0x524b6e));if(_0x524b6e[_0x97ac('0x23')]){if(_0x524b6e[_0x97ac('0x23')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1aeb52,_0x524b6e[_0x97ac('0x23')]['message']);return _0x48edf7(_0x524b6e[_0x97ac('0x23')][_0x97ac('0x24')]);}logger[_0x97ac('0x23')](_0x97ac('0x1f'),_0x1aeb52,_0x524b6e['error'][_0x97ac('0x24')]);return _0x128b10(_0x524b6e[_0x97ac('0x23')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1aeb52,_0x97ac('0x21'));_0x128b10(_0x524b6e[_0x97ac('0x25')]['message']);}})[_0x97ac('0x26')](function(_0x5c3989){logger[_0x97ac('0x23')](_0x97ac('0x1f'),_0x1aeb52,_0x5c3989);_0x48edf7(_0x5c3989);});});}function respondWithStatusCode(_0x32a5c8,_0x34f904){_0x34f904=_0x34f904||0xcc;return function(_0x53e27b){if(_0x53e27b){return _0x32a5c8['sendStatus'](_0x34f904);}return _0x32a5c8[_0x97ac('0x27')](_0x34f904)[_0x97ac('0x28')]();};}function respondWithResult(_0x57abaf,_0x66b08e){_0x66b08e=_0x66b08e||0xc8;return function(_0x56b78b){if(_0x56b78b){return _0x57abaf[_0x97ac('0x27')](_0x66b08e)['json'](_0x56b78b);}};}function respondWithFilteredResult(_0x1fae3f,_0x4920b5){return function(_0x44c2f4){if(_0x44c2f4){var _0x2ede9e=typeof _0x4920b5['offset']==='undefined'&&typeof _0x4920b5['limit']===_0x97ac('0x29');var _0x134612=_0x44c2f4[_0x97ac('0x2a')];var _0x1dfab6=_0x2ede9e?0x0:_0x4920b5[_0x97ac('0x2b')];var _0x3ffbb9=_0x2ede9e?_0x44c2f4[_0x97ac('0x2a')]:_0x4920b5['offset']+_0x4920b5[_0x97ac('0x2c')];var _0x14d7f6;if(_0x3ffbb9>=_0x134612){_0x3ffbb9=_0x134612;_0x14d7f6=0xc8;}else{_0x14d7f6=0xce;}_0x1fae3f[_0x97ac('0x27')](_0x14d7f6);return _0x1fae3f[_0x97ac('0x2d')]('Content-Range',_0x1dfab6+'-'+_0x3ffbb9+'/'+_0x134612)[_0x97ac('0x2e')](_0x44c2f4);}return null;};}function patchUpdates(_0x9334bb){return function(_0x4d4d7f){try{jsonpatch[_0x97ac('0x2f')](_0x4d4d7f,_0x9334bb,!![]);}catch(_0x2edfde){return BPromise[_0x97ac('0x30')](_0x2edfde);}return _0x4d4d7f[_0x97ac('0x31')]();};}function saveUpdates(_0x43f709,_0x3140a4){return function(_0x172a95){if(_0x172a95){return _0x172a95[_0x97ac('0x32')](_0x43f709)['then'](function(_0x5cb814){return _0x5cb814;});}return null;};}function removeEntity(_0x541a55,_0x57395f){return function(_0x29d70e){if(_0x29d70e){return _0x29d70e[_0x97ac('0x33')]()[_0x97ac('0x1d')](function(){var _0xc6d041=_0x29d70e[_0x97ac('0x34')]({'plain':!![]});var _0x35581d=_0x97ac('0x35');return db[_0x97ac('0x36')]['destroy']({'where':{'type':_0x35581d,'resourceId':_0xc6d041['id']}})[_0x97ac('0x1d')](function(){return _0x29d70e;});})[_0x97ac('0x1d')](function(){_0x541a55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5913ae,_0x2c70c5){return function(_0xe07cc0){if(!_0xe07cc0){_0x5913ae[_0x97ac('0x37')](0x194);}return _0xe07cc0;};}function handleError(_0x2e9909,_0x3e1ac7){_0x3e1ac7=_0x3e1ac7||0x1f4;return function(_0x28e6b7){logger[_0x97ac('0x23')](_0x28e6b7[_0x97ac('0x38')]);if(_0x28e6b7[_0x97ac('0x39')]){delete _0x28e6b7['name'];}_0x2e9909[_0x97ac('0x27')](_0x3e1ac7)['send'](_0x28e6b7);};}exports[_0x97ac('0x3a')]=function(_0x5eae43,_0x961e44){var _0x562eea={'include':[{'model':db[_0x97ac('0x3b')],'as':'mandatoryDispositionPause'}]},_0x1c7b93={},_0x39ced8={'count':0x0,'rows':[]};var _0x70b783=_[_0x97ac('0x3c')](db[_0x97ac('0x3d')][_0x97ac('0x3e')],function(_0x2c7e23){return{'name':_0x2c7e23[_0x97ac('0x3f')],'type':_0x2c7e23[_0x97ac('0x40')][_0x97ac('0x41')]};});_0x1c7b93[_0x97ac('0x42')]=_[_0x97ac('0x3c')](_0x70b783,'name');_0x1c7b93[_0x97ac('0x43')]=_['keys'](_0x5eae43[_0x97ac('0x43')]);_0x1c7b93[_0x97ac('0x44')]=_['intersection'](_0x1c7b93[_0x97ac('0x42')],_0x1c7b93[_0x97ac('0x43')]);_0x562eea[_0x97ac('0x45')]=_[_0x97ac('0x46')](_0x1c7b93[_0x97ac('0x42')],qs[_0x97ac('0x47')](_0x5eae43['query'][_0x97ac('0x47')]));_0x562eea[_0x97ac('0x45')]=_0x562eea['attributes'][_0x97ac('0x48')]?_0x562eea[_0x97ac('0x45')]:_0x1c7b93[_0x97ac('0x42')];if(!_0x5eae43[_0x97ac('0x43')]['hasOwnProperty'](_0x97ac('0x49'))){_0x562eea[_0x97ac('0x2c')]=qs[_0x97ac('0x2c')](_0x5eae43['query'][_0x97ac('0x2c')]);_0x562eea[_0x97ac('0x2b')]=qs['offset'](_0x5eae43[_0x97ac('0x43')][_0x97ac('0x2b')]);}_0x562eea[_0x97ac('0x4a')]=qs[_0x97ac('0x4b')](_0x5eae43['query']['sort']);_0x562eea[_0x97ac('0x4c')]=qs[_0x97ac('0x44')](_['pick'](_0x5eae43[_0x97ac('0x43')],_0x1c7b93[_0x97ac('0x44')]),_0x70b783);if(_0x5eae43[_0x97ac('0x43')]['filter']){_0x562eea['where']=_[_0x97ac('0x4d')](_0x562eea[_0x97ac('0x4c')],{'$or':_[_0x97ac('0x3c')](_0x70b783,function(_0x770c8b){if(_0x770c8b[_0x97ac('0x40')]!==_0x97ac('0x4e')){var _0x1c3f6a={};_0x1c3f6a[_0x770c8b['name']]={'$like':'%'+_0x5eae43['query'][_0x97ac('0x4f')]+'%'};return _0x1c3f6a;}})});}_0x562eea=_[_0x97ac('0x4d')]({},_0x562eea,_0x5eae43[_0x97ac('0x50')]);var _0x1156b0={'where':_0x562eea['where']};return db['FaxAccount'][_0x97ac('0x2a')](_0x1156b0)[_0x97ac('0x1d')](function(_0x1e7ea8){_0x39ced8[_0x97ac('0x2a')]=_0x1e7ea8;if(_0x5eae43[_0x97ac('0x43')][_0x97ac('0x51')]){_0x562eea[_0x97ac('0x52')]=[{'all':!![]}];}return db[_0x97ac('0x3d')][_0x97ac('0x53')](_0x562eea);})[_0x97ac('0x1d')](function(_0x218bdf){_0x39ced8['rows']=_0x218bdf;return _0x39ced8;})[_0x97ac('0x1d')](respondWithFilteredResult(_0x961e44,_0x562eea))[_0x97ac('0x26')](handleError(_0x961e44,null));};exports['show']=function(_0x53917a,_0x506c2c){var _0x1ead3e={'raw':![],'where':{'id':_0x53917a[_0x97ac('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x97ac('0x55')}]},_0x12162c={};_0x12162c[_0x97ac('0x42')]=_[_0x97ac('0x56')](db[_0x97ac('0x3d')][_0x97ac('0x3e')]);_0x12162c['query']=_['keys'](_0x53917a[_0x97ac('0x43')]);_0x12162c['filters']=_[_0x97ac('0x46')](_0x12162c[_0x97ac('0x42')],_0x12162c[_0x97ac('0x43')]);_0x1ead3e[_0x97ac('0x45')]=_[_0x97ac('0x46')](_0x12162c[_0x97ac('0x42')],qs['fields'](_0x53917a[_0x97ac('0x43')][_0x97ac('0x47')]));_0x1ead3e['attributes']=_0x1ead3e[_0x97ac('0x45')][_0x97ac('0x48')]?_0x1ead3e[_0x97ac('0x45')]:_0x12162c['model'];if(_0x53917a[_0x97ac('0x43')][_0x97ac('0x51')]){_0x1ead3e[_0x97ac('0x52')]=[{'all':!![]}];}_0x1ead3e=_[_0x97ac('0x4d')]({},_0x1ead3e,_0x53917a['options']);return db['FaxAccount'][_0x97ac('0x57')](_0x1ead3e)[_0x97ac('0x1d')](handleEntityNotFound(_0x506c2c,null))[_0x97ac('0x1d')](respondWithResult(_0x506c2c,null))['catch'](handleError(_0x506c2c,null));};exports[_0x97ac('0x58')]=function(_0x19aee0,_0x40e398){return db[_0x97ac('0x3d')][_0x97ac('0x58')](_0x19aee0[_0x97ac('0x59')],{})[_0x97ac('0x1d')](function(_0x1cf3c8){var _0x1ebd44=_0x19aee0[_0x97ac('0x5a')][_0x97ac('0x34')]({'plain':!![]});if(!_0x1ebd44)throw new Error(_0x97ac('0x5b'));if(_0x1ebd44[_0x97ac('0x5c')]==='user'){var _0x49def8=_0x1cf3c8['get']({'plain':!![]});var _0x2d82ae=_0x97ac('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x2d82ae,'userProfileId':_0x1ebd44[_0x97ac('0x5d')]},'raw':!![]})[_0x97ac('0x1d')](function(_0x41fde8){if(_0x41fde8&&_0x41fde8[_0x97ac('0x5e')]===0x0){return db['UserProfileResource'][_0x97ac('0x58')]({'name':_0x49def8[_0x97ac('0x39')],'resourceId':_0x49def8['id'],'type':_0x41fde8[_0x97ac('0x39')],'sectionId':_0x41fde8['id']},{})[_0x97ac('0x1d')](function(){return _0x1cf3c8;});}else{return _0x1cf3c8;}})[_0x97ac('0x26')](function(_0x6bc80a){logger['error'](_0x97ac('0x5f'),_0x6bc80a);throw _0x6bc80a;});}return _0x1cf3c8;})[_0x97ac('0x1d')](respondWithResult(_0x40e398,0xc9))[_0x97ac('0x26')](handleError(_0x40e398,null));};exports[_0x97ac('0x32')]=function(_0x18f4a2,_0x43f365){if(_0x18f4a2[_0x97ac('0x59')]['id']){delete _0x18f4a2[_0x97ac('0x59')]['id'];}return db[_0x97ac('0x3d')][_0x97ac('0x57')]({'where':{'id':_0x18f4a2[_0x97ac('0x54')]['id']},'include':[{'model':db[_0x97ac('0x3b')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x43f365,null))[_0x97ac('0x1d')](saveUpdates(_0x18f4a2[_0x97ac('0x59')],null))[_0x97ac('0x1d')](respondWithResult(_0x43f365,null))[_0x97ac('0x26')](handleError(_0x43f365,null));};exports['destroy']=function(_0x2cd9da,_0xfa3e64){return db['FaxAccount'][_0x97ac('0x57')]({'where':{'id':_0x2cd9da[_0x97ac('0x54')]['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0xfa3e64,null))['then'](removeEntity(_0xfa3e64,null))[_0x97ac('0x26')](handleError(_0xfa3e64,null));};exports[_0x97ac('0x60')]=function(_0x26a496,_0x49dfc0){return db['FaxAccount'][_0x97ac('0x60')]()[_0x97ac('0x1d')](respondWithResult(_0x49dfc0,null))[_0x97ac('0x26')](handleError(_0x49dfc0,null));};exports[_0x97ac('0x61')]=function(_0x438145,_0x39341e,_0x5b0c9e){if(_0x438145['body']['id']){delete _0x438145[_0x97ac('0x59')]['id'];}return db['FaxAccount'][_0x97ac('0x57')]({'where':{'id':_0x438145['params']['id']}})['then'](handleEntityNotFound(_0x39341e,null))[_0x97ac('0x1d')](function(_0x301f1b){if(_0x301f1b){_0x438145[_0x97ac('0x59')][_0x97ac('0x62')]=_0x301f1b['id'];return db[_0x97ac('0x63')][_0x97ac('0x58')](_0x438145[_0x97ac('0x59')]);}})[_0x97ac('0x1d')](respondWithResult(_0x39341e,null))[_0x97ac('0x26')](handleError(_0x39341e,null));};exports[_0x97ac('0x64')]=function(_0x1f3cfa,_0x23ccdc,_0x4b2b9e){var _0x12860e={'raw':![],'where':{}};var _0x254348={};var _0x54d408={'count':0x0,'rows':[]};return db[_0x97ac('0x3d')][_0x97ac('0x65')]({'where':{'id':_0x1f3cfa[_0x97ac('0x54')]['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0x23ccdc,null))[_0x97ac('0x1d')](function(_0x3d4eb){if(_0x3d4eb){_0x254348['model']=_[_0x97ac('0x56')](db[_0x97ac('0x63')][_0x97ac('0x3e')]);_0x254348[_0x97ac('0x43')]=_[_0x97ac('0x56')](_0x1f3cfa[_0x97ac('0x43')]);_0x254348[_0x97ac('0x44')]=_[_0x97ac('0x46')](_0x254348[_0x97ac('0x42')],_0x254348[_0x97ac('0x43')]);_0x12860e['attributes']=_[_0x97ac('0x46')](_0x254348['model'],qs['fields'](_0x1f3cfa['query'][_0x97ac('0x47')]));_0x12860e[_0x97ac('0x45')]=_0x12860e[_0x97ac('0x45')]['length']?_0x12860e[_0x97ac('0x45')]:_0x254348[_0x97ac('0x42')];if(!_0x1f3cfa[_0x97ac('0x43')][_0x97ac('0x66')]('nolimit')){_0x12860e[_0x97ac('0x2c')]=qs['limit'](_0x1f3cfa[_0x97ac('0x43')][_0x97ac('0x2c')]);_0x12860e['offset']=qs['offset'](_0x1f3cfa['query'][_0x97ac('0x2b')]);}_0x12860e[_0x97ac('0x4a')]=qs[_0x97ac('0x4b')](_0x1f3cfa[_0x97ac('0x43')][_0x97ac('0x4b')]);_0x12860e[_0x97ac('0x4c')]=qs['filters'](_[_0x97ac('0x67')](_0x1f3cfa['query'],_0x254348[_0x97ac('0x44')]));_0x12860e['where'][_0x97ac('0x62')]=_0x3d4eb['id'];if(_0x1f3cfa['query'][_0x97ac('0x4f')]){_0x12860e[_0x97ac('0x4c')]=_[_0x97ac('0x4d')](_0x12860e[_0x97ac('0x4c')],{'$or':_[_0x97ac('0x3c')](_0x12860e[_0x97ac('0x45')],function(_0x6dfbf0){var _0x470eb6={};_0x470eb6[_0x6dfbf0]={'$like':'%'+_0x1f3cfa[_0x97ac('0x43')][_0x97ac('0x4f')]+'%'};return _0x470eb6;})});}_0x12860e=_['merge']({},_0x12860e,_0x1f3cfa['options']);return db[_0x97ac('0x63')][_0x97ac('0x2a')]({'where':_0x12860e[_0x97ac('0x4c')]})[_0x97ac('0x1d')](function(_0x2d3505){_0x54d408[_0x97ac('0x2a')]=_0x2d3505;if(_0x1f3cfa[_0x97ac('0x43')][_0x97ac('0x51')]){_0x12860e[_0x97ac('0x52')]=[{'all':!![]}];}return db[_0x97ac('0x63')]['findAll'](_0x12860e);})['then'](function(_0x41fd65){_0x54d408[_0x97ac('0x68')]=_0x41fd65;return _0x54d408;});}})['then'](respondWithFilteredResult(_0x23ccdc,_0x12860e))['catch'](handleError(_0x23ccdc,null));};exports[_0x97ac('0x69')]=function(_0x4cf2cd,_0x60133f,_0x27b7a4){return db[_0x97ac('0x3d')][_0x97ac('0x57')]({'where':{'id':_0x4cf2cd[_0x97ac('0x54')]['id']}})['then'](handleEntityNotFound(_0x60133f,null))[_0x97ac('0x1d')](function(_0x34a54a){if(_0x34a54a){return _0x34a54a[_0x97ac('0x69')](_0x4cf2cd[_0x97ac('0x43')][_0x97ac('0x6a')]);}})[_0x97ac('0x1d')](respondWithStatusCode(_0x60133f,null))[_0x97ac('0x26')](handleError(_0x60133f,null));};exports[_0x97ac('0x6b')]=function(_0x19acbb,_0x34cb4a,_0x51c0a9){if(_0x19acbb[_0x97ac('0x59')]['id']){delete _0x19acbb[_0x97ac('0x59')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x19acbb['params']['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0x34cb4a,null))[_0x97ac('0x1d')](function(_0x40152f){if(_0x40152f){_0x19acbb[_0x97ac('0x59')][_0x97ac('0x62')]=_0x40152f['id'];return db[_0x97ac('0x6c')][_0x97ac('0x58')](_0x19acbb[_0x97ac('0x59')]);}})['then'](respondWithResult(_0x34cb4a,null))[_0x97ac('0x26')](handleError(_0x34cb4a,null));};exports[_0x97ac('0x6d')]=function(_0x4c6754,_0x415c9c,_0x3f8542){var _0x2bedbd={'raw':![],'where':{}};var _0x1959a2={};var _0x5b5bec={'count':0x0,'rows':[]};return db[_0x97ac('0x3d')][_0x97ac('0x65')]({'where':{'id':_0x4c6754[_0x97ac('0x54')]['id']}})['then'](handleEntityNotFound(_0x415c9c,null))[_0x97ac('0x1d')](function(_0xc8616d){if(_0xc8616d){_0x1959a2[_0x97ac('0x42')]=_[_0x97ac('0x56')](db[_0x97ac('0x6c')][_0x97ac('0x3e')]);_0x1959a2[_0x97ac('0x43')]=_[_0x97ac('0x56')](_0x4c6754[_0x97ac('0x43')]);_0x1959a2['filters']=_[_0x97ac('0x46')](_0x1959a2['model'],_0x1959a2[_0x97ac('0x43')]);_0x2bedbd[_0x97ac('0x45')]=_[_0x97ac('0x46')](_0x1959a2[_0x97ac('0x42')],qs[_0x97ac('0x47')](_0x4c6754['query'][_0x97ac('0x47')]));_0x2bedbd[_0x97ac('0x45')]=_0x2bedbd[_0x97ac('0x45')]['length']?_0x2bedbd['attributes']:_0x1959a2[_0x97ac('0x42')];if(!_0x4c6754['query']['hasOwnProperty']('nolimit')){_0x2bedbd['limit']=qs[_0x97ac('0x2c')](_0x4c6754[_0x97ac('0x43')][_0x97ac('0x2c')]);_0x2bedbd[_0x97ac('0x2b')]=qs[_0x97ac('0x2b')](_0x4c6754[_0x97ac('0x43')][_0x97ac('0x2b')]);}_0x2bedbd[_0x97ac('0x4a')]=qs[_0x97ac('0x4b')](_0x4c6754['query'][_0x97ac('0x4b')]);_0x2bedbd['where']=qs[_0x97ac('0x44')](_[_0x97ac('0x67')](_0x4c6754[_0x97ac('0x43')],_0x1959a2['filters']));_0x2bedbd[_0x97ac('0x4c')][_0x97ac('0x62')]=_0xc8616d['id'];if(_0x4c6754[_0x97ac('0x43')][_0x97ac('0x4f')]){_0x2bedbd[_0x97ac('0x4c')]=_['merge'](_0x2bedbd[_0x97ac('0x4c')],{'$or':_['map'](_0x2bedbd['attributes'],function(_0x2f9f0f){var _0x542e31={};_0x542e31[_0x2f9f0f]={'$like':'%'+_0x4c6754['query']['filter']+'%'};return _0x542e31;})});}_0x2bedbd=_[_0x97ac('0x4d')]({},_0x2bedbd,_0x4c6754[_0x97ac('0x50')]);return db[_0x97ac('0x6c')][_0x97ac('0x2a')]({'where':_0x2bedbd[_0x97ac('0x4c')]})[_0x97ac('0x1d')](function(_0x576057){_0x5b5bec[_0x97ac('0x2a')]=_0x576057;if(_0x4c6754[_0x97ac('0x43')]['includeAll']){_0x2bedbd[_0x97ac('0x52')]=[{'all':!![]}];}return db[_0x97ac('0x6c')][_0x97ac('0x53')](_0x2bedbd);})[_0x97ac('0x1d')](function(_0x1cf9ed){_0x5b5bec[_0x97ac('0x68')]=_0x1cf9ed;return _0x5b5bec;});}})['then'](respondWithFilteredResult(_0x415c9c,_0x2bedbd))[_0x97ac('0x26')](handleError(_0x415c9c,null));};exports['removeAnswers']=function(_0x52ab79,_0x6ebd53,_0x4417ec){return db[_0x97ac('0x3d')][_0x97ac('0x57')]({'where':{'id':_0x52ab79[_0x97ac('0x54')]['id']}})['then'](handleEntityNotFound(_0x6ebd53,null))[_0x97ac('0x1d')](function(_0x40242c){if(_0x40242c){return _0x40242c[_0x97ac('0x6e')](_0x52ab79['query']['ids']);}})[_0x97ac('0x1d')](respondWithStatusCode(_0x6ebd53,null))[_0x97ac('0x26')](handleError(_0x6ebd53,null));};exports[_0x97ac('0x6f')]=function(_0x49c6cb,_0x26a820,_0x1113fd){return db[_0x97ac('0x70')][_0x97ac('0x57')]({'where':{'id':_0x49c6cb[_0x97ac('0x54')]['id']}})['then'](handleEntityNotFound(_0x26a820,null))[_0x97ac('0x1d')](function(_0x544003){if(_0x544003){return _0x544003[_0x97ac('0x6f')](_0x49c6cb[_0x97ac('0x59')][_0x97ac('0x6a')],_['omit'](_0x49c6cb['body'],[_0x97ac('0x6a'),'id'])||{});}})[_0x97ac('0x1d')](respondWithResult(_0x26a820,null))[_0x97ac('0x26')](handleError(_0x26a820,null));};exports[_0x97ac('0x71')]=function(_0x554048,_0x395121,_0x291746){var _0x5ed641={'raw':![],'where':{}};var _0xb71c3f={};var _0x226d40={'count':0x0,'rows':[]};return db[_0x97ac('0x3d')]['findOne']({'where':{'id':_0x554048[_0x97ac('0x54')]['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0x395121,null))[_0x97ac('0x1d')](function(_0xd101a1){if(_0xd101a1){_0xb71c3f[_0x97ac('0x42')]=_[_0x97ac('0x56')](db['FaxInteraction'][_0x97ac('0x3e')]);_0xb71c3f[_0x97ac('0x43')]=_['keys'](_0x554048['query']);_0xb71c3f['filters']=_[_0x97ac('0x46')](_0xb71c3f[_0x97ac('0x42')],_0xb71c3f[_0x97ac('0x43')]);_0x5ed641['attributes']=_['intersection'](_0xb71c3f[_0x97ac('0x42')],qs[_0x97ac('0x47')](_0x554048['query'][_0x97ac('0x47')]));_0x5ed641[_0x97ac('0x45')]=_0x5ed641[_0x97ac('0x45')][_0x97ac('0x48')]?_0x5ed641[_0x97ac('0x45')]:_0xb71c3f[_0x97ac('0x42')];if(!_0x554048[_0x97ac('0x43')]['hasOwnProperty'](_0x97ac('0x49'))){_0x5ed641[_0x97ac('0x2c')]=qs[_0x97ac('0x2c')](_0x554048[_0x97ac('0x43')][_0x97ac('0x2c')]);_0x5ed641[_0x97ac('0x2b')]=qs['offset'](_0x554048[_0x97ac('0x43')][_0x97ac('0x2b')]);}_0x5ed641[_0x97ac('0x4a')]=qs[_0x97ac('0x4b')](_0x554048['query'][_0x97ac('0x4b')]);_0x5ed641[_0x97ac('0x4c')]=qs[_0x97ac('0x44')](_[_0x97ac('0x67')](_0x554048[_0x97ac('0x43')],_0xb71c3f[_0x97ac('0x44')]));_0x5ed641[_0x97ac('0x4c')][_0x97ac('0x62')]=_0xd101a1['id'];if(_0x554048[_0x97ac('0x43')][_0x97ac('0x4f')]){_0x5ed641['where']=_[_0x97ac('0x4d')](_0x5ed641[_0x97ac('0x4c')],{'$or':_['map'](_0x5ed641[_0x97ac('0x45')],function(_0xe37173){var _0x2530a6={};_0x2530a6[_0xe37173]={'$like':'%'+_0x554048[_0x97ac('0x43')]['filter']+'%'};return _0x2530a6;})});}_0x5ed641=_['merge']({},_0x5ed641,_0x554048[_0x97ac('0x50')]);return db['FaxInteraction'][_0x97ac('0x2a')]({'where':_0x5ed641['where']})[_0x97ac('0x1d')](function(_0x4b9e8a){_0x226d40['count']=_0x4b9e8a;if(_0x554048['query'][_0x97ac('0x51')]){_0x5ed641[_0x97ac('0x52')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x97ac('0x72')],'as':_0x97ac('0x73'),'attributes':[_0x97ac('0x39'),_0x97ac('0x74'),_0x97ac('0x75')],'required':![]},{'model':db[_0x97ac('0x76')],'as':_0x97ac('0x77'),'attributes':['id',_0x97ac('0x39'),'color'],'where':_0x554048[_0x97ac('0x43')][_0x97ac('0x78')]?{'id':_0x554048['query']['tag']}:undefined,'required':_0x554048['query']['tag']?!![]:![]}];}return db[_0x97ac('0x70')][_0x97ac('0x53')](_0x5ed641);})[_0x97ac('0x1d')](function(_0x5f0c0d){_0x226d40['rows']=_0x5f0c0d;return _0x226d40;});}})[_0x97ac('0x1d')](respondWithFilteredResult(_0x395121,_0x5ed641))[_0x97ac('0x26')](handleError(_0x395121,null));};exports['addApplications']=function(_0x11b4d3,_0x5cfb23){var _0x21d606=_0x11b4d3['params']['id'];var _0x22a061=_0x11b4d3['body'];var _0x34114a=0xc8;var _0x393f9b=null;return db[_0x97ac('0x79')][_0x97ac('0x7a')]({'isolationLevel':db[_0x97ac('0x79')][_0x97ac('0x7b')][_0x97ac('0x7c')]['READ_COMMITTED']},function(_0x2c7e07){return db['FaxAccount'][_0x97ac('0x65')]({'where':{'id':_0x21d606},'transaction':_0x2c7e07})[_0x97ac('0x1d')](function(_0x4cfc69){if(_0x4cfc69){return db[_0x97ac('0x7d')][_0x97ac('0x33')]({'where':{'FaxAccountId':_0x21d606},'transaction':_0x2c7e07})['then'](function(){var _0xbbb55f=_[_0x97ac('0x3c')](_0x22a061,function(_0x1a427a){_0x1a427a[_0x97ac('0x62')]=_0x21d606;return _0x1a427a;});return db[_0x97ac('0x7d')][_0x97ac('0x7e')](_0xbbb55f,{'transaction':_0x2c7e07});});}else{_0x34114a=0x194;_0x393f9b=[];}});})[_0x97ac('0x1d')](function(){if(_0x34114a!==0x194){return db[_0x97ac('0x7d')]['findAndCountAll']({'where':{'FaxAccountId':_0x21d606},'order':_0x97ac('0x7f')})['then'](function(_0x1876b2){_0x393f9b=_0x1876b2;});}})['catch'](function(_0x23c69c){_0x34114a=0x1f4;logger['error'](_0x23c69c[_0x97ac('0x38')]);if(_0x23c69c[_0x97ac('0x39')]){delete _0x23c69c[_0x97ac('0x39')];}_0x393f9b=_0x23c69c;})[_0x97ac('0x80')](function(){if(_0x393f9b===null){_0x5cfb23['sendStatus'](_0x34114a);}else{if(_0x34114a===0x1f4){_0x5cfb23['status'](_0x34114a)[_0x97ac('0x81')](_0x393f9b);}else{_0x5cfb23[_0x97ac('0x27')](_0x34114a)[_0x97ac('0x2e')](_0x393f9b);}}});};exports['getApplications']=function(_0x5c3332,_0x324204,_0x62d53b){var _0x219ff6={};var _0x528281={};var _0xb22101;var _0x59835e;return db[_0x97ac('0x3d')]['findOne']({'where':{'id':_0x5c3332[_0x97ac('0x54')]['id']}})['then'](handleEntityNotFound(_0x324204,null))['then'](function(_0x2cd41b){if(_0x2cd41b){_0xb22101=_0x2cd41b;_0x528281[_0x97ac('0x42')]=_[_0x97ac('0x56')](db[_0x97ac('0x7d')][_0x97ac('0x3e')]);_0x528281[_0x97ac('0x43')]=_[_0x97ac('0x56')](_0x5c3332['query']);_0x528281['filters']=_[_0x97ac('0x46')](_0x528281[_0x97ac('0x42')],_0x528281[_0x97ac('0x43')]);_0x219ff6[_0x97ac('0x45')]=_[_0x97ac('0x46')](_0x528281['model'],qs['fields'](_0x5c3332['query'][_0x97ac('0x47')]));_0x219ff6[_0x97ac('0x45')]=_0x219ff6[_0x97ac('0x45')]['length']?_0x219ff6['attributes']:_0x528281[_0x97ac('0x42')];_0x219ff6[_0x97ac('0x4a')]=qs[_0x97ac('0x4b')](_0x5c3332['query'][_0x97ac('0x4b')]);_0x219ff6[_0x97ac('0x4c')]=qs[_0x97ac('0x44')](_[_0x97ac('0x67')](_0x5c3332[_0x97ac('0x43')],_0x528281[_0x97ac('0x44')]));if(_0x5c3332[_0x97ac('0x43')][_0x97ac('0x4f')]){_0x219ff6[_0x97ac('0x4c')]=_[_0x97ac('0x4d')](_0x219ff6['where'],{'$or':_[_0x97ac('0x3c')](_0x219ff6[_0x97ac('0x45')],function(_0x391aed){var _0x507ae7={};_0x507ae7[_0x391aed]={'$like':'%'+_0x5c3332[_0x97ac('0x43')]['filter']+'%'};return _0x507ae7;})});}_0x219ff6=_[_0x97ac('0x4d')]({},_0x219ff6,_0x5c3332[_0x97ac('0x50')]);return _0xb22101[_0x97ac('0x82')](_0x219ff6);}})[_0x97ac('0x1d')](function(_0x3a9aba){if(_0x3a9aba){_0x59835e=_0x3a9aba[_0x97ac('0x48')];if(!_0x5c3332[_0x97ac('0x43')][_0x97ac('0x66')](_0x97ac('0x49'))){_0x219ff6[_0x97ac('0x2c')]=qs[_0x97ac('0x2c')](_0x5c3332[_0x97ac('0x43')][_0x97ac('0x2c')]);_0x219ff6['offset']=qs[_0x97ac('0x2b')](_0x5c3332[_0x97ac('0x43')][_0x97ac('0x2b')]);}return _0xb22101[_0x97ac('0x82')](_0x219ff6);}})[_0x97ac('0x1d')](function(_0x56141a){if(_0x56141a){return _0x56141a?{'count':_0x59835e,'rows':_0x56141a}:null;}})[_0x97ac('0x1d')](respondWithResult(_0x324204,null))['catch'](handleError(_0x324204,null));};function Extension(_0x435044,_0x26e787,_0x2ed5fa,_0x35e417){this['context']=_0x97ac('0x83');this[_0x97ac('0x84')]=_0x435044[_0x97ac('0x85')];this[_0x97ac('0x86')]=_0x35e417;this[_0x97ac('0x40')]='system';this[_0x97ac('0x87')]=_0x97ac('0x88');this[_0x97ac('0x62')]=_0x435044['id'];this[_0x97ac('0x7f')]=_0x26e787;this[_0x97ac('0x89')]=_0x2ed5fa;}function createExtensionsReciveFax(_0x29a8ba){var _0x22eb87=0x1;var _0x21c656=[];_0x21c656[_0x97ac('0x8a')](new Extension(_0x29a8ba,_0x22eb87,'',_0x97ac('0x8b')));_0x22eb87+=0x1;_0x21c656[_0x97ac('0x8a')](new Extension(_0x29a8ba,_0x22eb87,_0x97ac('0x8c'),'Set'));_0x22eb87+=0x1;for(var _0x31c26b in _0x29a8ba){if(_0x29a8ba[_0x97ac('0x66')](_0x31c26b)&&(_0x31c26b==='ecm'||_0x31c26b===_0x97ac('0x85')||_0x31c26b===_0x97ac('0x8d')||_0x31c26b==='faxdetect'||_0x31c26b==='headerinfo'||_0x31c26b===_0x97ac('0x8e')||_0x31c26b===_0x97ac('0x8f')||_0x31c26b===_0x97ac('0x90')||_0x31c26b===_0x97ac('0x91'))){_0x21c656[_0x97ac('0x8a')](new Extension(_0x29a8ba,_0x22eb87,'FAXOPT('+_0x31c26b+')='+_0x29a8ba[_0x31c26b],_0x97ac('0x92')));_0x22eb87+=0x1;}}_0x21c656[_0x97ac('0x8a')](new Extension(_0x29a8ba,_0x22eb87,'6',_0x97ac('0x93')));_0x22eb87+=0x1;_0x21c656[_0x97ac('0x8a')](new Extension(_0x29a8ba,_0x22eb87,_0x97ac('0x94'),'ReceiveFax'));_0x22eb87=0x0;return _0x21c656;}exports[_0x97ac('0x95')]=function(_0x39504b,_0x536cec,_0x56118d){var _0x5d5ea7;return db[_0x97ac('0x79')][_0x97ac('0x7a')](function(_0x1d71ea){return db[_0x97ac('0x3d')][_0x97ac('0x58')](_0x39504b[_0x97ac('0x59')],{'transaction':_0x1d71ea})[_0x97ac('0x1d')](function(_0x47bf18){_0x5d5ea7=_0x47bf18[_0x97ac('0x34')]({'plain':!![]});return db[_0x97ac('0x96')][_0x97ac('0x7e')](createExtensionsReciveFax(_0x5d5ea7),{'transaction':_0x1d71ea});});})[_0x97ac('0x1d')](function(){return _0x5d5ea7;})[_0x97ac('0x1d')](respondWithResult(_0x536cec,null))[_0x97ac('0x26')](handleError(_0x536cec,null));};exports[_0x97ac('0x97')]=function(_0x2846db,_0x561f61,_0x247cd8){var _0x598b50;return db['sequelize'][_0x97ac('0x7a')](function(_0x3cea14){return db[_0x97ac('0x3d')][_0x97ac('0x32')](_0x2846db[_0x97ac('0x59')],{'where':{'id':_0x2846db[_0x97ac('0x59')]['id']},'transaction':_0x3cea14})[_0x97ac('0x1d')](function(_0x451e9f){return db['VoiceExtension'][_0x97ac('0x33')]({'where':{'FaxAccountId':_0x2846db[_0x97ac('0x59')]['id']},'transaction':_0x3cea14})[_0x97ac('0x1d')](function(_0x470eff){return db['VoiceExtension'][_0x97ac('0x7e')](createExtensionsReciveFax(_[_0x97ac('0x98')](_0x2846db[_0x97ac('0x59')],[_0x97ac('0x99'),_0x97ac('0x41'),_0x97ac('0x9a'),_0x97ac('0x9b'),_0x97ac('0x9c'),_0x97ac('0x9d')])),{'transaction':_0x3cea14});});});})[_0x97ac('0x1d')](function(){return db[_0x97ac('0x3d')]['findById'](_0x2846db[_0x97ac('0x59')]['id']);})[_0x97ac('0x1d')](respondWithResult(_0x561f61,null))[_0x97ac('0x26')](handleError(_0x561f61,null));};exports[_0x97ac('0x9e')]=function(_0x589754,_0x514779,_0x5c9325){var _0x386b8e={'raw':!![],'where':{}};var _0x4856b5={};var _0x17740b={'count':0x0,'rows':[]};return db[_0x97ac('0x3d')]['findOne']({'where':{'id':_0x589754[_0x97ac('0x54')]['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0x514779,null))[_0x97ac('0x1d')](function(_0x23f2c6){if(_0x23f2c6){_0x4856b5['model']=_[_0x97ac('0x56')](db[_0x97ac('0x9f')][_0x97ac('0x3e')]);_0x4856b5[_0x97ac('0x43')]=_[_0x97ac('0x56')](_0x589754[_0x97ac('0x43')]);_0x4856b5[_0x97ac('0x44')]=_['intersection'](_0x4856b5[_0x97ac('0x42')],_0x4856b5[_0x97ac('0x43')]);_0x386b8e[_0x97ac('0x45')]=_['intersection'](_0x4856b5[_0x97ac('0x42')],qs['fields'](_0x589754[_0x97ac('0x43')][_0x97ac('0x47')]));_0x386b8e[_0x97ac('0x45')]=_0x386b8e['attributes'][_0x97ac('0x48')]?_0x386b8e[_0x97ac('0x45')]:_0x4856b5[_0x97ac('0x42')];if(!_0x589754[_0x97ac('0x43')][_0x97ac('0x66')](_0x97ac('0x49'))){_0x386b8e[_0x97ac('0x2c')]=qs[_0x97ac('0x2c')](_0x589754['query'][_0x97ac('0x2c')]);_0x386b8e[_0x97ac('0x2b')]=qs[_0x97ac('0x2b')](_0x589754[_0x97ac('0x43')][_0x97ac('0x2b')]);}_0x386b8e[_0x97ac('0x4a')]=qs[_0x97ac('0x4b')](_0x589754[_0x97ac('0x43')]['sort']);_0x386b8e[_0x97ac('0x4c')]=qs[_0x97ac('0x44')](_[_0x97ac('0x67')](_0x589754[_0x97ac('0x43')],_0x4856b5['filters']));_0x386b8e[_0x97ac('0x4c')][_0x97ac('0x62')]=_0x23f2c6['id'];if(_0x589754[_0x97ac('0x43')][_0x97ac('0x4f')]){_0x386b8e[_0x97ac('0x4c')]=_[_0x97ac('0x4d')](_0x386b8e[_0x97ac('0x4c')],{'$or':_['map'](_0x386b8e['attributes'],function(_0x2f57a8){var _0x12fbda={};_0x12fbda[_0x2f57a8]={'$like':'%'+_0x589754[_0x97ac('0x43')][_0x97ac('0x4f')]+'%'};return _0x12fbda;})});}if(_0x589754[_0x97ac('0x43')][_0x97ac('0xa0')]){var _0x2df71b=_0x589754[_0x97ac('0x43')]['$gte'][_0x97ac('0xa1')](',');var _0x189312={};_0x189312[_0x2df71b[0x0]]={'$gte':moment(_0x2df71b[0x1])[_0x97ac('0xa2')](_0x97ac('0xa3'))};_0x386b8e['where']=_[_0x97ac('0x4d')](_0x386b8e[_0x97ac('0x4c')],_0x189312);}_0x386b8e=_[_0x97ac('0x4d')]({},_0x386b8e,_0x589754[_0x97ac('0x50')]);return db[_0x97ac('0x9f')][_0x97ac('0x2a')]({'where':_0x386b8e[_0x97ac('0x4c')]})[_0x97ac('0x1d')](function(_0x5953d8){_0x17740b[_0x97ac('0x2a')]=_0x5953d8;if(_0x589754[_0x97ac('0x43')][_0x97ac('0x51')]){_0x386b8e[_0x97ac('0x52')]=[{'all':!![]}];}return db[_0x97ac('0x9f')]['findAll'](_0x386b8e);})[_0x97ac('0x1d')](function(_0x3ccdff){_0x17740b[_0x97ac('0x68')]=_0x3ccdff;return _0x17740b;});}})[_0x97ac('0x1d')](respondWithFilteredResult(_0x514779,_0x386b8e))[_0x97ac('0x26')](handleError(_0x514779,null));};exports[_0x97ac('0x81')]=function(_0xce6f50,_0x4c6d20,_0x2541a2){var _0x342196,_0x5d3aff={},_0x5e5282;if(_0xce6f50[_0x97ac('0x59')]['to']){_0x5e5282=_0xce6f50['body']['to'][0x0];}return db[_0x97ac('0x3d')][_0x97ac('0x57')]({'where':{'id':_0xce6f50['params']['id']},'include':[{'model':db[_0x97ac('0xa4')],'as':_0x97ac('0xa5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x5e5282},'limit':0x1,'order':[[_0x97ac('0x9b'),_0x97ac('0xa6')]]}]}]})[_0x97ac('0x1d')](handleEntityNotFound(_0x4c6d20,null))['then'](function(_0x459f10){_0x342196=_0x459f10;if(_0xce6f50[_0x97ac('0x59')]['attachments']&&_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')]['length']){for(var _0xd28d6e=0x0;_0xd28d6e<_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][_0x97ac('0x48')];_0xd28d6e+=0x1){_0xce6f50['body'][_0x97ac('0xa7')][_0xd28d6e]={'filename':_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][_0xd28d6e]['name'],'id':_0xce6f50[_0x97ac('0x59')]['attachments'][_0xd28d6e]['id'],'path':path[_0x97ac('0xa8')](config[_0x97ac('0xa9')],_0x97ac('0xaa'),_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][_0xd28d6e]['basename'])};}}return respondWithRpcPromise(_0x97ac('0xab'),_0x97ac('0xab'),{'FaxAccountId':_[_0x97ac('0xac')](_0xce6f50[_0x97ac('0x54')]['id'])?undefined:_0xce6f50[_0x97ac('0x54')]['id'],'path':_[_0x97ac('0xac')](_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][0x0][_0x97ac('0x8')])?undefined:_0xce6f50[_0x97ac('0x59')]['attachments'][0x0][_0x97ac('0x8')],'fax':_[_0x97ac('0xac')](_0xce6f50[_0x97ac('0x59')]['to'][0x0])?undefined:_0xce6f50[_0x97ac('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x342196){if(_[_0x97ac('0xac')](_0xce6f50[_0x97ac('0x59')][_0x97ac('0xad')])){_0xce6f50[_0x97ac('0x59')]['from']=util[_0x97ac('0xa2')](_0x97ac('0xae'),_0x342196[_0x97ac('0x39')],_0x342196[_0x97ac('0xaf')]);}if(_0x342196['List']){if(_0x342196[_0x97ac('0xa5')][_0x97ac('0xb0')]['length']){return _0x342196['List'][_0x97ac('0xb0')][0x0];}else{return db['CmContact'][_0x97ac('0x58')](_[_0x97ac('0xb1')](_0xce6f50[_0x97ac('0x59')],{'firstName':_0xce6f50['body']['to'][0x0],'phone':_0xce6f50[_0x97ac('0x59')]['to'][0x0],'fax':_0xce6f50[_0x97ac('0x59')]['to'][0x0],'ListId':_0x342196[_0x97ac('0x9d')]}));}}else{throw new Error(_0x97ac('0xb2'));}}else{throw new Error(_0x97ac('0xb3'));}})[_0x97ac('0x1d')](function(_0x569ab3){if(_0x569ab3){return db['FaxInteraction'][_0x97ac('0x57')]({'where':{'ContactId':_0x569ab3['id'],'closed':![],'FaxAccountId':_0x342196['id']}})['then'](function(_0x2fc64d){if(_0x2fc64d){return[_0x2fc64d,![]];}return db['FaxInteraction'][_0x97ac('0x58')]({'UserId':_0xce6f50[_0x97ac('0x5a')]['id'],'ContactId':_0x569ab3['id'],'FaxAccountId':_0x342196['id'],'fax':_0xce6f50[_0x97ac('0x59')]['to'][0x0],'firstMsgDirection':_0x97ac('0xb4'),'Messages':[_[_0x97ac('0x4d')](_0xce6f50[_0x97ac('0x59')],{'read':![],'body':_0xce6f50['body'][_0x97ac('0xa7')][0x0]['filename'],'FaxAccountId':_0x342196['id'],'UserId':_0xce6f50[_0x97ac('0x5a')]['id'],'ContactId':_0x569ab3['id'],'AttachmentId':_0xce6f50[_0x97ac('0x59')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x97ac('0x9f')],'as':_0x97ac('0xb5')}]})[_0x97ac('0x1d')](function(_0x4b8322){return[_0x4b8322,!![]];});});}else{throw new Error(_0x97ac('0xb6'));}})[_0x97ac('0xb7')](function(_0x3d2d6d,_0x1c0232){if(_0x1c0232){return _0x3d2d6d;}return db['FaxMessage'][_0x97ac('0x58')]({'direction':'out','read':![],'body':_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][0x0][_0x97ac('0xb8')],'FaxAccountId':_0x342196['id'],'FaxInteractionId':_0x3d2d6d['id'],'UserId':_0xce6f50[_0x97ac('0x5a')]['id'],'ContactId':_0x3d2d6d['ContactId'],'AttachmentId':_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][0x0]['id']})[_0x97ac('0x1d')](function(_0x48a385){_0x3d2d6d[_0x97ac('0xb9')][_0x97ac('0xb5')]=[];_0x3d2d6d[_0x97ac('0xb9')][_0x97ac('0xb5')][_0x97ac('0x8a')](_0x48a385[_0x97ac('0xb9')]);return _0x3d2d6d;});})[_0x97ac('0x1d')](function(_0x451090){respondWithRpcPromise(_0x97ac('0xba'),_0x97ac('0xba'),{'FaxAccountId':_[_0x97ac('0xac')](_0xce6f50[_0x97ac('0x54')]['id'])?undefined:_0xce6f50[_0x97ac('0x54')]['id'],'path':_[_0x97ac('0xac')](_0xce6f50[_0x97ac('0x59')]['attachments'][0x0]['path'])?undefined:_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][0x0][_0x97ac('0x8')],'fax':_[_0x97ac('0xac')](_0xce6f50[_0x97ac('0x59')]['to'][0x0])?undefined:_0xce6f50[_0x97ac('0x59')]['to'][0x0],'AttachmentId':_0xce6f50[_0x97ac('0x59')][_0x97ac('0xa7')][0x0]['id']},client9002)[_0x97ac('0x1d')](function(_0x53660d){logger[_0x97ac('0x1e')](_0x97ac('0xbb'),_0x53660d);})[_0x97ac('0x26')](function(_0x12bef9){logger['info'](_0x97ac('0xbb'),_0x12bef9);});return _0x451090;})['then'](respondWithResult(_0x4c6d20,null))[_0x97ac('0x26')](handleError(_0x4c6d20,null));};exports[_0x97ac('0xbc')]=function(_0x525b58,_0x4a29c4,_0x41be14){return db[_0x97ac('0x3d')][_0x97ac('0x57')]({'where':{'id':_0x525b58['params']['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0x4a29c4,null))[_0x97ac('0x1d')](function(_0x2371e6){if(_0x2371e6){return _0x2371e6[_0x97ac('0xbc')](_0x525b58['body']['ids'],_[_0x97ac('0x98')](_0x525b58[_0x97ac('0x59')],[_0x97ac('0x6a'),'id'])||{})['spread'](function(_0x24bf94){for(var _0x3bec30=0x0;_0x3bec30<_0x525b58[_0x97ac('0x59')][_0x97ac('0x6a')]['length'];_0x3bec30+=0x1){socket['emit'](_0x97ac('0xbd'),{'UserId':Number(_0x525b58[_0x97ac('0x59')]['ids'][_0x3bec30]),'FaxAccountId':Number(_0x525b58[_0x97ac('0x54')]['id'])});}return _0x24bf94;});}})['then'](respondWithResult(_0x4a29c4,null))[_0x97ac('0x26')](handleError(_0x4a29c4,null));};exports[_0x97ac('0xbe')]=function(_0x4ec3bb,_0x2d09f2,_0x4920b3){return db[_0x97ac('0x3d')][_0x97ac('0x57')]({'where':{'id':_0x4ec3bb[_0x97ac('0x54')]['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0x2d09f2,null))['then'](function(_0x13579b){if(_0x13579b){return _0x13579b[_0x97ac('0xbe')](_0x4ec3bb[_0x97ac('0x43')]['ids'])['then'](function(){if(_[_0x97ac('0xbf')](_0x4ec3bb['query'][_0x97ac('0x6a')])){for(var _0x310fcc=0x0;_0x310fcc<_0x4ec3bb[_0x97ac('0x43')][_0x97ac('0x6a')][_0x97ac('0x48')];_0x310fcc+=0x1){socket['emit'](_0x97ac('0xc0'),{'UserId':Number(_0x4ec3bb['query'][_0x97ac('0x6a')][_0x310fcc]),'FaxAccountId':Number(_0x4ec3bb['params']['id'])});}}else{socket[_0x97ac('0xc1')](_0x97ac('0xc0'),{'UserId':Number(_0x4ec3bb[_0x97ac('0x43')]['ids']),'FaxAccountId':Number(_0x4ec3bb[_0x97ac('0x54')]['id'])});}});}})[_0x97ac('0x1d')](respondWithStatusCode(_0x2d09f2,null))['catch'](handleError(_0x2d09f2,null));};exports['getAgents']=function(_0x33ccd5,_0x3923bc,_0x345575){var _0x160dff={};var _0x112ccb={};var _0x24bfd6;var _0x36a0f7;return db[_0x97ac('0x3d')]['findOne']({'where':{'id':_0x33ccd5[_0x97ac('0x54')]['id']}})[_0x97ac('0x1d')](handleEntityNotFound(_0x3923bc,null))[_0x97ac('0x1d')](function(_0x289f88){if(_0x289f88){_0x24bfd6=_0x289f88;_0x112ccb[_0x97ac('0x42')]=_['keys'](db[_0x97ac('0x72')]['rawAttributes']);_0x112ccb['query']=_[_0x97ac('0x56')](_0x33ccd5[_0x97ac('0x43')]);_0x112ccb[_0x97ac('0x44')]=_[_0x97ac('0x46')](_0x112ccb[_0x97ac('0x42')],_0x112ccb[_0x97ac('0x43')]);_0x160dff[_0x97ac('0x45')]=_['intersection'](_0x112ccb[_0x97ac('0x42')],qs[_0x97ac('0x47')](_0x33ccd5['query'][_0x97ac('0x47')]));_0x160dff[_0x97ac('0x45')]=_0x160dff[_0x97ac('0x45')][_0x97ac('0x48')]?_0x160dff[_0x97ac('0x45')]:_0x112ccb[_0x97ac('0x42')];_0x160dff['order']=qs['sort'](_0x33ccd5[_0x97ac('0x43')][_0x97ac('0x4b')]);_0x160dff[_0x97ac('0x4c')]=qs[_0x97ac('0x44')](_[_0x97ac('0x67')](_0x33ccd5[_0x97ac('0x43')],_0x112ccb['filters']));if(_0x33ccd5['query'][_0x97ac('0x4f')]){_0x160dff[_0x97ac('0x4c')]=_[_0x97ac('0x4d')](_0x160dff[_0x97ac('0x4c')],{'$or':_[_0x97ac('0x3c')](_0x160dff[_0x97ac('0x45')],function(_0x2cdb17){var _0x490b51={};_0x490b51[_0x2cdb17]={'$like':'%'+_0x33ccd5['query']['filter']+'%'};return _0x490b51;})});}_0x160dff=_[_0x97ac('0x4d')]({},_0x160dff,_0x33ccd5[_0x97ac('0x50')]);return _0x24bfd6[_0x97ac('0xc2')](_0x160dff);}})[_0x97ac('0x1d')](function(_0x30738d){if(_0x30738d){_0x36a0f7=_0x30738d['length'];if(!_0x33ccd5[_0x97ac('0x43')][_0x97ac('0x66')]('nolimit')){_0x160dff[_0x97ac('0x2c')]=qs[_0x97ac('0x2c')](_0x33ccd5['query'][_0x97ac('0x2c')]);_0x160dff[_0x97ac('0x2b')]=qs['offset'](_0x33ccd5[_0x97ac('0x43')]['offset']);}return _0x24bfd6[_0x97ac('0xc2')](_0x160dff);}})[_0x97ac('0x1d')](function(_0x4016e8){if(_0x4016e8){return _0x4016e8?{'count':_0x36a0f7,'rows':_0x4016e8}:null;}})[_0x97ac('0x1d')](respondWithResult(_0x3923bc,null))[_0x97ac('0x26')](handleError(_0x3923bc,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 25dda80..f7fe296 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 _0x211e=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x530090,_0x74ce3e){var _0x258633=function(_0x3b90eb){while(--_0x3b90eb){_0x530090['push'](_0x530090['shift']());}};_0x258633(++_0x74ce3e);}(_0x211e,0x1b1));var _0xe211=function(_0x494b17,_0x5bb833){_0x494b17=_0x494b17-0x0;var _0x288f59=_0x211e[_0x494b17];return _0x288f59;};'use strict';var EventEmitter=require(_0xe211('0x0'));var FaxAccount=require(_0xe211('0x1'))['db'][_0xe211('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe211('0x3')](0x0);var events={'afterCreate':_0xe211('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38cabc){return function(_0x2344b0,_0x3dcb93,_0x461a87){FaxAccountEvents['emit'](_0x38cabc+':'+_0x2344b0['id'],_0x2344b0);FaxAccountEvents[_0xe211('0x5')](_0x38cabc,_0x2344b0);_0x461a87(null);};}for(var e in events){if(events[_0xe211('0x6')](e)){var event=events[e];FaxAccount[_0xe211('0x7')](e,emitEvent(event));}}module[_0xe211('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xc5e5=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xc5e5,0x1e1));var _0x5c5e=function(_0x451b05,_0xf7b9c6){_0x451b05=_0x451b05-0x0;var _0x55fcc4=_0xc5e5[_0x451b05];return _0x55fcc4;};'use strict';var EventEmitter=require(_0x5c5e('0x0'));var FaxAccount=require(_0x5c5e('0x1'))['db'][_0x5c5e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5c5e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5c5e('0x4'),'afterDestroy':_0x5c5e('0x5')};function emitEvent(_0xf3454a){return function(_0x1b98a6,_0xb1f72c,_0x5c76c5){FaxAccountEvents[_0x5c5e('0x6')](_0xf3454a+':'+_0x1b98a6['id'],_0x1b98a6);FaxAccountEvents[_0x5c5e('0x6')](_0xf3454a,_0x1b98a6);_0x5c76c5(null);};}for(var e in events){if(events[_0x5c5e('0x7')](e)){var event=events[e];FaxAccount[_0x5c5e('0x8')](e,emitEvent(event));}}module[_0x5c5e('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e07e22d..3482e65 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 _0x8768=['fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','FaxAccount'];(function(_0x419044,_0x48aa83){var _0x5a69dd=function(_0x384102){while(--_0x384102){_0x419044['push'](_0x419044['shift']());}};_0x5a69dd(++_0x48aa83);}(_0x8768,0xa6));var _0x8876=function(_0x3cd0c4,_0x4f4fbb){_0x3cd0c4=_0x3cd0c4-0x0;var _0x466479=_0x8768[_0x3cd0c4];return _0x466479;};'use strict';var _=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var logger=require(_0x8876('0x2'))(_0x8876('0x3'));var moment=require(_0x8876('0x4'));var BPromise=require(_0x8876('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8876('0x6'));var config=require(_0x8876('0x7'));var attributes=require('./faxAccount.attributes');module[_0x8876('0x8')]=function(_0x1ba0c3,_0x16d773){return _0x1ba0c3['define'](_0x8876('0x9'),attributes,{'tableName':_0x8876('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5406=['./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger','moment','rimraf'];(function(_0x558980,_0x19bd71){var _0x3bbc70=function(_0x2a93af){while(--_0x2a93af){_0x558980['push'](_0x558980['shift']());}};_0x3bbc70(++_0x19bd71);}(_0x5406,0x17e));var _0x6540=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x5406[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x6540('0x0'));var util=require(_0x6540('0x1'));var logger=require(_0x6540('0x2'))('api');var moment=require(_0x6540('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6540('0x4'));var config=require('../../config/environment');var attributes=require(_0x6540('0x5'));module[_0x6540('0x6')]=function(_0x298321,_0x3fd186){return _0x298321[_0x6540('0x7')](_0x6540('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 0aeca73..3c3d94d 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 _0xd8ae=['Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','account','CmList','List','DESC','FaxApplication','applications','list','orderBy','asc','Applications','Contacts','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','length','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','queueId','FaxQueue','queue','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxAccount.socket','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','map','include','model','NotifyFaxAccount','body','fax','CmContact','then','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','createdAt','CompanyId','isNil'];(function(_0x2a0024,_0x42e869){var _0x1c4d43=function(_0x5f11b5){while(--_0x5f11b5){_0x2a0024['push'](_0x2a0024['shift']());}};_0x1c4d43(++_0x42e869);}(_0xd8ae,0x19b));var _0xed8a=function(_0x1356cf,_0x2d3f6e){_0x1356cf=_0x1356cf-0x0;var _0x4b9340=_0xd8ae[_0x1356cf];return _0x4b9340;};'use strict';var _=require(_0xed8a('0x0'));var util=require(_0xed8a('0x1'));var moment=require(_0xed8a('0x2'));var BPromise=require(_0xed8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed8a('0x4'));var db=require(_0xed8a('0x5'))['db'];var utils=require(_0xed8a('0x6'));var logger=require(_0xed8a('0x7'))(_0xed8a('0x8'));var config=require(_0xed8a('0x9'));var jayson=require(_0xed8a('0xa'));var client=jayson[_0xed8a('0xb')]['http']({'port':0x232c});config[_0xed8a('0xc')]=_['defaults'](config[_0xed8a('0xc')],{'host':_0xed8a('0xd'),'port':0x18eb});var socket=require(_0xed8a('0xe'))(new Redis(config[_0xed8a('0xc')]));require(_0xed8a('0xf'))['register'](socket);function respondWithRpcPromise(_0x223387,_0xf92fe7,_0x5b51b0){return new BPromise(function(_0x5f10df,_0x6c68ab){return client[_0xed8a('0x10')](_0x223387,_0x5b51b0)['then'](function(_0x3be4a8){logger[_0xed8a('0x11')]('FaxAccount,\x20%s,\x20%s',_0xf92fe7,_0xed8a('0x12'));logger[_0xed8a('0x13')](_0xed8a('0x14'),_0xf92fe7,_0xed8a('0x12'),JSON[_0xed8a('0x15')](_0x3be4a8));if(_0x3be4a8[_0xed8a('0x16')]){if(_0x3be4a8['error']['code']===0x1f4){logger[_0xed8a('0x16')](_0xed8a('0x17'),_0xf92fe7,_0x3be4a8[_0xed8a('0x16')][_0xed8a('0x18')]);return _0x6c68ab(_0x3be4a8[_0xed8a('0x16')][_0xed8a('0x18')]);}logger[_0xed8a('0x16')](_0xed8a('0x17'),_0xf92fe7,_0x3be4a8['error'][_0xed8a('0x18')]);return _0x5f10df(_0x3be4a8['error'][_0xed8a('0x18')]);}else{logger[_0xed8a('0x11')](_0xed8a('0x17'),_0xf92fe7,_0xed8a('0x12'));_0x5f10df(_0x3be4a8[_0xed8a('0x19')][_0xed8a('0x18')]);}})[_0xed8a('0x1a')](function(_0x4045b3){logger[_0xed8a('0x16')](_0xed8a('0x17'),_0xf92fe7,_0x4045b3);_0x6c68ab(_0x4045b3);});});}exports[_0xed8a('0x1b')]=function(_0x10a88e){var _0x5b12bd=this;return new Promise(function(_0x14fb6a,_0x2be2c8){return db['FaxAccount'][_0xed8a('0x1c')]({'raw':_0x10a88e[_0xed8a('0x1d')]?_0x10a88e[_0xed8a('0x1d')][_0xed8a('0x1e')]===undefined?!![]:![]:!![],'where':_0x10a88e['options']?_0x10a88e['options']['where']||null:null,'attributes':_0x10a88e[_0xed8a('0x1d')]?_0x10a88e[_0xed8a('0x1d')][_0xed8a('0x1f')]||null:null,'limit':_0x10a88e[_0xed8a('0x1d')]?_0x10a88e[_0xed8a('0x1d')][_0xed8a('0x20')]||null:null,'include':_0x10a88e[_0xed8a('0x1d')]?_0x10a88e[_0xed8a('0x1d')]['include']?_[_0xed8a('0x21')](_0x10a88e[_0xed8a('0x1d')]['include'],function(_0xfddef8){return{'model':db[_0xfddef8['model']],'as':_0xfddef8['as'],'attributes':_0xfddef8['attributes'],'include':_0xfddef8[_0xed8a('0x22')]?_[_0xed8a('0x21')](_0xfddef8[_0xed8a('0x22')],function(_0x1139a7){return{'model':db[_0x1139a7[_0xed8a('0x23')]],'as':_0x1139a7['as'],'attributes':_0x1139a7[_0xed8a('0x1f')],'include':_0x1139a7[_0xed8a('0x22')]?_['map'](_0x1139a7[_0xed8a('0x22')],function(_0x3e91db){return{'model':db[_0x3e91db[_0xed8a('0x23')]],'as':_0x3e91db['as'],'attributes':_0x3e91db[_0xed8a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x417d97){logger[_0xed8a('0x11')](_0xed8a('0x1b'),_0x10a88e);logger[_0xed8a('0x13')](_0xed8a('0x1b'),_0x10a88e,JSON['stringify'](_0x417d97));_0x14fb6a(_0x417d97);})[_0xed8a('0x1a')](function(_0x3da44d){logger['error'](_0xed8a('0x1b'),_0x3da44d[_0xed8a('0x18')],_0x10a88e);_0x2be2c8(_0x5b12bd['error'](0x1f4,_0x3da44d['message']));});});};exports[_0xed8a('0x24')]=function(_0x551cd4,_0xe891ba,_0xa2edd9){var _0x23d32c=this;return new Promise(function(_0xb2cf51,_0x3a2dd9){var _0x52093c={'body':_0x551cd4[_0xed8a('0x25')],'channel':_0xed8a('0x26')};var _0x5e98f4=[];var _0xd38a16=[];var _0x23a6c6={};return db[_0xed8a('0x27')]['describe']()[_0xed8a('0x28')](function(_0x307991){if(!_0x307991){throw new db['Sequelize'][(_0xed8a('0x29'))](_0xed8a('0x2a'));}_0x5e98f4=_['difference'](_[_0xed8a('0x2b')](_0x307991),['createdAt',_0xed8a('0x2c')]);_0xd38a16=_[_0xed8a('0x2d')](_[_0xed8a('0x2b')](_0x307991),[_0xed8a('0x2e'),'updatedAt',_0xed8a('0x2f'),'ListId']);if(_0x551cd4['body']['id']){delete _0x551cd4[_0xed8a('0x25')]['id'];}if(_[_0xed8a('0x30')](_0x551cd4[_0xed8a('0x25')]['from'])){throw new db[(_0xed8a('0x31'))][(_0xed8a('0x29'))](_0xed8a('0x32'));}if(_['isNil'](_0x551cd4[_0xed8a('0x25')][_0xed8a('0x25')])||_0x551cd4[_0xed8a('0x25')][_0xed8a('0x25')]===''){throw new db[(_0xed8a('0x31'))][(_0xed8a('0x29'))](_0xed8a('0x33'));}if(_[_0xed8a('0x30')](_0x551cd4[_0xed8a('0x25')][_0xed8a('0x34')])){throw new db[(_0xed8a('0x31'))][(_0xed8a('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd38a16);}if(!_[_0xed8a('0x35')](_0xd38a16,_0x551cd4['body'][_0xed8a('0x34')])){throw new db[(_0xed8a('0x31'))][(_0xed8a('0x29'))](_0xed8a('0x36')+_0xd38a16);}_0x23a6c6[_0x551cd4[_0xed8a('0x25')]['mapKey']]=_0x551cd4[_0xed8a('0x25')][_0xed8a('0x37')];})[_0xed8a('0x28')](function(){return db[_0xed8a('0x38')][_0xed8a('0x39')]({'where':{'id':_0x551cd4[_0xed8a('0x3a')]['id']},'include':[{'model':db[_0xed8a('0x3b')],'as':_0xed8a('0x3c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x23a6c6,'limit':0x1,'order':[[_0xed8a('0x2c'),_0xed8a('0x3d')]]}]},{'model':db[_0xed8a('0x3e')],'as':'Applications'}]});})[_0xed8a('0x28')](function(_0x5437ab){if(_0x5437ab&&_0x5437ab['List']){var _0x3311df=_0x5437ab['get']({'plain':!![]});_0x52093c[_0xed8a('0x3a')]=_0x3311df;_0x52093c[_0xed8a('0x3f')]=_0x3311df['Applications'];_0x52093c[_0xed8a('0x40')]=_0x3311df['List'];_0x52093c[_0xed8a('0x3f')]=_[_0xed8a('0x41')](_0x52093c[_0xed8a('0x3f')],['priority'],[_0xed8a('0x42')]);if(_0x52093c['account'][_0xed8a('0x43')]){delete _0x52093c[_0xed8a('0x3a')]['Applications'];}if(_0x52093c[_0xed8a('0x3a')][_0xed8a('0x3c')]&&_0x52093c[_0xed8a('0x3a')]['List']['Contacts']['length']){return _0x52093c[_0xed8a('0x3a')][_0xed8a('0x3c')][_0xed8a('0x44')][0x0];}var _0x15b170=_[_0xed8a('0x45')](_0x551cd4[_0xed8a('0x25')],{'firstName':_0x551cd4[_0xed8a('0x25')]['from'],'ListId':_0x3311df['ListId']});_0x15b170[_0x551cd4[_0xed8a('0x25')][_0xed8a('0x34')]]=_0x551cd4[_0xed8a('0x25')][_0xed8a('0x37')];return db[_0xed8a('0x27')][_0xed8a('0x46')](_0x15b170,{'fields':_0x5e98f4,'raw':!![]});}})['then'](function(_0x2e50e4){_0x52093c[_0xed8a('0x47')]=_0x2e50e4;if(_0x2e50e4){var _0x1f4949={'ContactId':_0x2e50e4['id'],'FaxAccountId':_0x551cd4[_0xed8a('0x3a')]['id'],'fax':_0x2e50e4[_0xed8a('0x26')]};return db[_0xed8a('0x48')][_0xed8a('0x39')]({'where':{'ContactId':_0x2e50e4['id'],'closed':![],'FaxAccountId':_0x551cd4[_0xed8a('0x3a')]['id']}})[_0xed8a('0x28')](function(_0x40609c){if(_0x40609c){return[_0x40609c,![]];}return db[_0xed8a('0x48')][_0xed8a('0x46')](_0x1f4949)[_0xed8a('0x28')](function(_0x4834f3){return[_0x4834f3,!![]];});});}else{throw new Error(_0xed8a('0x49'));}})[_0xed8a('0x4a')](function(_0x4700e6,_0x40af6b){var _0x3d9ea4=_0x4700e6['get']({'plain':!![]});if(_0x40af6b){if(_0x52093c[_0xed8a('0x3a')]['autoclose']){_0x52093c[_0xed8a('0x3f')][_0xed8a('0x4b')]({'id':0x0,'priority':_0x52093c[_0xed8a('0x3f')][_0xed8a('0x4c')]+0x1,'app':'close','appdata':_0xed8a('0x4d'),'interval':_0xed8a('0x4e')});}_0x3d9ea4[_0xed8a('0x4f')]=!![];}else{_0x3d9ea4[_0xed8a('0x4f')]=![];}_0x52093c[_0xed8a('0x50')]=_0x3d9ea4;return db[_0xed8a('0x51')][_0xed8a('0x46')]({'body':_0x551cd4[_0xed8a('0x25')][_0xed8a('0x25')],'FaxAccountId':_0x551cd4[_0xed8a('0x3a')]['id'],'FaxInteractionId':_0x4700e6['id'],'direction':'in','ContactId':_0x4700e6[_0xed8a('0x52')],'AttachmentId':_0x551cd4[_0xed8a('0x25')][_0xed8a('0x53')]});})[_0xed8a('0x28')](function(_0x3d1a20){_0x52093c[_0xed8a('0x18')]=_0x3d1a20;if(!_0x52093c['interaction'][_0xed8a('0x54')])return;return db['User']['find']({'attributes':['id',_0xed8a('0x55')],'where':{'id':_0x52093c[_0xed8a('0x50')]['UserId']}});})[_0xed8a('0x28')](function(_0x2ec451){if(_0x2ec451){_0x52093c[_0xed8a('0x3f')][_0xed8a('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2ec451[_0xed8a('0x55')]+','+(_0x52093c[_0xed8a('0x3a')][_0xed8a('0x57')]||0xa),'interval':'*,*,*,*'});}if(!_0x52093c[_0xed8a('0x50')][_0xed8a('0x58')])return;return db[_0xed8a('0x59')]['find']({'attributes':['id',_0xed8a('0x55')],'where':{'id':_0x52093c[_0xed8a('0x50')]['queueId']}});})[_0xed8a('0x28')](function(_0x2189c1){if(_0x2189c1){_0x52093c[_0xed8a('0x3f')][_0xed8a('0x56')]({'id':0x0,'priority':0x1,'app':_0xed8a('0x5a'),'appdata':_0x2189c1['name']+','+(_0x52093c[_0xed8a('0x3a')]['waitForTheAssignedQueue']||0x12c),'interval':_0xed8a('0x4e')});}return respondWithRpcPromise(_0xed8a('0x5b'),'startRouting',_0x52093c);})[_0xed8a('0x28')](function(_0x1cc85a){_0xb2cf51(_0x1cc85a);})[_0xed8a('0x1a')](function(_0x3f8468){_0x3a2dd9(_0x23d32c[_0xed8a('0x16')](0x1f4,_0x3f8468[_0xed8a('0x18')]));});});}; \ No newline at end of file +var _0x51a3=['waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','Applications','applications','list','orderBy','priority','asc','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','length','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent'];(function(_0x493299,_0xfb0840){var _0x4f291a=function(_0x14495c){while(--_0x14495c){_0x493299['push'](_0x493299['shift']());}};_0x4f291a(++_0xfb0840);}(_0x51a3,0xcb));var _0x351a=function(_0x18f146,_0x49aaad){_0x18f146=_0x18f146-0x0;var _0x29073d=_0x51a3[_0x18f146];return _0x29073d;};'use strict';var _=require('lodash');var util=require(_0x351a('0x0'));var moment=require('moment');var BPromise=require(_0x351a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x351a('0x2'));var db=require(_0x351a('0x3'))['db'];var utils=require(_0x351a('0x4'));var logger=require(_0x351a('0x5'))(_0x351a('0x6'));var config=require('../../config/environment');var jayson=require(_0x351a('0x7'));var client=jayson[_0x351a('0x8')][_0x351a('0x9')]({'port':0x232c});config[_0x351a('0xa')]=_['defaults'](config[_0x351a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x351a('0xb'))(new Redis(config['redis']));require(_0x351a('0xc'))[_0x351a('0xd')](socket);function respondWithRpcPromise(_0x59ad5b,_0x88396e,_0x2c1b49){return new BPromise(function(_0x398ab0,_0x81aa0b){return client[_0x351a('0xe')](_0x59ad5b,_0x2c1b49)[_0x351a('0xf')](function(_0x20e994){logger[_0x351a('0x10')]('FaxAccount,\x20%s,\x20%s',_0x88396e,'request\x20sent');logger[_0x351a('0x11')](_0x351a('0x12'),_0x88396e,_0x351a('0x13'),JSON['stringify'](_0x20e994));if(_0x20e994[_0x351a('0x14')]){if(_0x20e994['error'][_0x351a('0x15')]===0x1f4){logger[_0x351a('0x14')](_0x351a('0x16'),_0x88396e,_0x20e994[_0x351a('0x14')]['message']);return _0x81aa0b(_0x20e994[_0x351a('0x14')]['message']);}logger[_0x351a('0x14')](_0x351a('0x16'),_0x88396e,_0x20e994['error'][_0x351a('0x17')]);return _0x398ab0(_0x20e994[_0x351a('0x14')][_0x351a('0x17')]);}else{logger[_0x351a('0x10')](_0x351a('0x16'),_0x88396e,_0x351a('0x13'));_0x398ab0(_0x20e994[_0x351a('0x18')][_0x351a('0x17')]);}})[_0x351a('0x19')](function(_0x2d228e){logger[_0x351a('0x14')]('FaxAccount,\x20%s,\x20%s',_0x88396e,_0x2d228e);_0x81aa0b(_0x2d228e);});});}exports[_0x351a('0x1a')]=function(_0x53abc1){var _0x38cd8d=this;return new Promise(function(_0x36fd89,_0x11bf41){return db[_0x351a('0x1b')][_0x351a('0x1c')]({'raw':_0x53abc1[_0x351a('0x1d')]?_0x53abc1[_0x351a('0x1d')][_0x351a('0x1e')]===undefined?!![]:![]:!![],'where':_0x53abc1['options']?_0x53abc1['options'][_0x351a('0x1f')]||null:null,'attributes':_0x53abc1[_0x351a('0x1d')]?_0x53abc1['options'][_0x351a('0x20')]||null:null,'limit':_0x53abc1[_0x351a('0x1d')]?_0x53abc1['options'][_0x351a('0x21')]||null:null,'include':_0x53abc1[_0x351a('0x1d')]?_0x53abc1[_0x351a('0x1d')][_0x351a('0x22')]?_[_0x351a('0x23')](_0x53abc1[_0x351a('0x1d')]['include'],function(_0x2ba065){return{'model':db[_0x2ba065['model']],'as':_0x2ba065['as'],'attributes':_0x2ba065[_0x351a('0x20')],'include':_0x2ba065[_0x351a('0x22')]?_[_0x351a('0x23')](_0x2ba065['include'],function(_0x4000e1){return{'model':db[_0x4000e1['model']],'as':_0x4000e1['as'],'attributes':_0x4000e1[_0x351a('0x20')],'include':_0x4000e1[_0x351a('0x22')]?_[_0x351a('0x23')](_0x4000e1['include'],function(_0x42ccd3){return{'model':db[_0x42ccd3[_0x351a('0x24')]],'as':_0x42ccd3['as'],'attributes':_0x42ccd3[_0x351a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42e95a){logger[_0x351a('0x10')](_0x351a('0x1a'),_0x53abc1);logger[_0x351a('0x11')]('GetFaxAccount',_0x53abc1,JSON['stringify'](_0x42e95a));_0x36fd89(_0x42e95a);})[_0x351a('0x19')](function(_0x2e8c3e){logger[_0x351a('0x14')](_0x351a('0x1a'),_0x2e8c3e[_0x351a('0x17')],_0x53abc1);_0x11bf41(_0x38cd8d[_0x351a('0x14')](0x1f4,_0x2e8c3e[_0x351a('0x17')]));});});};exports[_0x351a('0x25')]=function(_0x363b8f,_0x4576f4,_0x512911){var _0x239e61=this;return new Promise(function(_0x5e54e9,_0x5e4ff2){var _0x378789={'body':_0x363b8f[_0x351a('0x26')],'channel':_0x351a('0x27')};var _0x2c448c=[];var _0x5b610a=[];var _0x305636={};return db[_0x351a('0x28')][_0x351a('0x29')]()[_0x351a('0xf')](function(_0x3a4fb7){if(!_0x3a4fb7){throw new db[(_0x351a('0x2a'))][(_0x351a('0x2b'))](_0x351a('0x2c'));}_0x2c448c=_[_0x351a('0x2d')](_[_0x351a('0x2e')](_0x3a4fb7),[_0x351a('0x2f'),_0x351a('0x30')]);_0x5b610a=_[_0x351a('0x2d')](_[_0x351a('0x2e')](_0x3a4fb7),['createdAt',_0x351a('0x30'),'CompanyId',_0x351a('0x31')]);if(_0x363b8f[_0x351a('0x26')]['id']){delete _0x363b8f[_0x351a('0x26')]['id'];}if(_['isNil'](_0x363b8f[_0x351a('0x26')][_0x351a('0x32')])){throw new db['Sequelize']['ValidationError'](_0x351a('0x33'));}if(_[_0x351a('0x34')](_0x363b8f[_0x351a('0x26')][_0x351a('0x26')])||_0x363b8f[_0x351a('0x26')][_0x351a('0x26')]===''){throw new db['Sequelize'][(_0x351a('0x2b'))](_0x351a('0x35'));}if(_[_0x351a('0x34')](_0x363b8f[_0x351a('0x26')][_0x351a('0x36')])){throw new db[(_0x351a('0x2a'))][(_0x351a('0x2b'))](_0x351a('0x37')+_0x5b610a);}if(!_[_0x351a('0x38')](_0x5b610a,_0x363b8f[_0x351a('0x26')][_0x351a('0x36')])){throw new db['Sequelize'][(_0x351a('0x2b'))](_0x351a('0x39')+_0x5b610a);}_0x305636[_0x363b8f['body'][_0x351a('0x36')]]=_0x363b8f[_0x351a('0x26')]['from'];})[_0x351a('0xf')](function(){return db['FaxAccount'][_0x351a('0x3a')]({'where':{'id':_0x363b8f[_0x351a('0x3b')]['id']},'include':[{'model':db[_0x351a('0x3c')],'as':_0x351a('0x3d'),'include':[{'model':db[_0x351a('0x28')],'as':_0x351a('0x3e'),'where':_0x305636,'limit':0x1,'order':[[_0x351a('0x30'),_0x351a('0x3f')]]}]},{'model':db['FaxApplication'],'as':_0x351a('0x40')}]});})[_0x351a('0xf')](function(_0x3d90e0){if(_0x3d90e0&&_0x3d90e0['List']){var _0x5e0a93=_0x3d90e0['get']({'plain':!![]});_0x378789['account']=_0x5e0a93;_0x378789[_0x351a('0x41')]=_0x5e0a93['Applications'];_0x378789[_0x351a('0x42')]=_0x5e0a93[_0x351a('0x3d')];_0x378789[_0x351a('0x41')]=_[_0x351a('0x43')](_0x378789[_0x351a('0x41')],[_0x351a('0x44')],[_0x351a('0x45')]);if(_0x378789[_0x351a('0x3b')][_0x351a('0x40')]){delete _0x378789[_0x351a('0x3b')][_0x351a('0x40')];}if(_0x378789[_0x351a('0x3b')]['List']&&_0x378789[_0x351a('0x3b')][_0x351a('0x3d')][_0x351a('0x3e')]['length']){return _0x378789[_0x351a('0x3b')][_0x351a('0x3d')][_0x351a('0x3e')][0x0];}var _0x3b13b4=_[_0x351a('0x46')](_0x363b8f[_0x351a('0x26')],{'firstName':_0x363b8f[_0x351a('0x26')][_0x351a('0x32')],'ListId':_0x5e0a93[_0x351a('0x31')]});_0x3b13b4[_0x363b8f[_0x351a('0x26')]['mapKey']]=_0x363b8f[_0x351a('0x26')][_0x351a('0x32')];return db[_0x351a('0x28')][_0x351a('0x47')](_0x3b13b4,{'fields':_0x2c448c,'raw':!![]});}})[_0x351a('0xf')](function(_0x2f0008){_0x378789[_0x351a('0x48')]=_0x2f0008;if(_0x2f0008){var _0x1952c3={'ContactId':_0x2f0008['id'],'FaxAccountId':_0x363b8f[_0x351a('0x3b')]['id'],'fax':_0x2f0008[_0x351a('0x27')]};return db[_0x351a('0x49')][_0x351a('0x3a')]({'where':{'ContactId':_0x2f0008['id'],'closed':![],'FaxAccountId':_0x363b8f[_0x351a('0x3b')]['id']}})[_0x351a('0xf')](function(_0x2d5df3){if(_0x2d5df3){return[_0x2d5df3,![]];}return db[_0x351a('0x49')][_0x351a('0x47')](_0x1952c3)[_0x351a('0xf')](function(_0x15413e){return[_0x15413e,!![]];});});}else{throw new Error(_0x351a('0x4a'));}})[_0x351a('0x4b')](function(_0x1f4652,_0x45c670){var _0x5e6aea=_0x1f4652[_0x351a('0x4c')]({'plain':!![]});if(_0x45c670){if(_0x378789[_0x351a('0x3b')][_0x351a('0x4d')]){_0x378789['applications']['push']({'id':0x0,'priority':_0x378789['applications'][_0x351a('0x4e')]+0x1,'app':'close','appdata':_0x351a('0x4f'),'interval':_0x351a('0x50')});}_0x5e6aea['created']=!![];}else{_0x5e6aea[_0x351a('0x51')]=![];}_0x378789['interaction']=_0x5e6aea;return db[_0x351a('0x52')][_0x351a('0x47')]({'body':_0x363b8f[_0x351a('0x26')]['body'],'FaxAccountId':_0x363b8f[_0x351a('0x3b')]['id'],'FaxInteractionId':_0x1f4652['id'],'direction':'in','ContactId':_0x1f4652[_0x351a('0x53')],'AttachmentId':_0x363b8f[_0x351a('0x26')][_0x351a('0x54')]});})[_0x351a('0xf')](function(_0x41d049){_0x378789[_0x351a('0x17')]=_0x41d049;if(!_0x378789[_0x351a('0x55')][_0x351a('0x56')])return;return db[_0x351a('0x57')][_0x351a('0x3a')]({'attributes':['id',_0x351a('0x58')],'where':{'id':_0x378789['interaction'][_0x351a('0x56')]}});})[_0x351a('0xf')](function(_0x2af48f){if(_0x2af48f){_0x378789[_0x351a('0x41')][_0x351a('0x59')]({'id':0x0,'priority':0x0,'app':_0x351a('0x5a'),'appdata':_0x2af48f['name']+','+(_0x378789[_0x351a('0x3b')][_0x351a('0x5b')]||0xa),'interval':_0x351a('0x50')});}if(!_0x378789[_0x351a('0x55')][_0x351a('0x5c')])return;return db[_0x351a('0x5d')][_0x351a('0x3a')]({'attributes':['id','name'],'where':{'id':_0x378789['interaction']['queueId']}});})[_0x351a('0xf')](function(_0x5e5155){if(_0x5e5155){_0x378789[_0x351a('0x41')][_0x351a('0x59')]({'id':0x0,'priority':0x1,'app':_0x351a('0x5e'),'appdata':_0x5e5155[_0x351a('0x58')]+','+(_0x378789[_0x351a('0x3b')][_0x351a('0x5f')]||0x12c),'interval':_0x351a('0x50')});}return respondWithRpcPromise(_0x351a('0x60'),_0x351a('0x61'),_0x378789);})['then'](function(_0x3a2102){_0x5e54e9(_0x3a2102);})['catch'](function(_0x524d24){_0x5e4ff2(_0x239e61['error'](0x1f4,_0x524d24[_0x351a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9085152..6826af6 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 _0x84c6=['remove','update','emit','register','length','faxAccount:','save'];(function(_0x96a05,_0x1f4b8c){var _0x253e31=function(_0xca8d69){while(--_0xca8d69){_0x96a05['push'](_0x96a05['shift']());}};_0x253e31(++_0x1f4b8c);}(_0x84c6,0x14f));var _0x684c=function(_0xe1d179,_0x705e21){_0xe1d179=_0xe1d179-0x0;var _0x1a5abb=_0x84c6[_0xe1d179];return _0x1a5abb;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x684c('0x0'),_0x684c('0x1'),_0x684c('0x2')];function createListener(_0x3353ec,_0x36eba7){return function(_0x56a45c){_0x36eba7[_0x684c('0x3')](_0x3353ec,_0x56a45c);};}function removeListener(_0x251c31,_0x4fdda9){return function(){FaxAccountEvents['removeListener'](_0x251c31,_0x4fdda9);};}exports[_0x684c('0x4')]=function(_0xa10907){for(var _0x4a6370=0x0,_0x44de69=events[_0x684c('0x5')];_0x4a6370<_0x44de69;_0x4a6370++){var _0x2d0cd7=events[_0x4a6370];var _0x149eef=createListener(_0x684c('0x6')+_0x2d0cd7,_0xa10907);FaxAccountEvents['on'](_0x2d0cd7,_0x149eef);}}; \ No newline at end of file +var _0x7126=['update','removeListener','length','faxAccount:','save','remove'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0x7126,0x18a));var _0x6712=function(_0x24a3dd,_0x467fa3){_0x24a3dd=_0x24a3dd-0x0;var _0x2467ee=_0x7126[_0x24a3dd];return _0x2467ee;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6712('0x0'),_0x6712('0x1'),_0x6712('0x2')];function createListener(_0x500ee3,_0x14945e){return function(_0x44562d){_0x14945e['emit'](_0x500ee3,_0x44562d);};}function removeListener(_0x1011bb,_0x185cef){return function(){FaxAccountEvents[_0x6712('0x3')](_0x1011bb,_0x185cef);};}exports['register']=function(_0x4c012d){for(var _0x25921d=0x0,_0xa1587e=events[_0x6712('0x4')];_0x25921d<_0xa1587e;_0x25921d++){var _0x41917e=events[_0x25921d];var _0x455eab=createListener(_0x6712('0x5')+_0x41917e,_0x4c012d);FaxAccountEvents['on'](_0x41917e,_0x455eab);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 55be8e9..2319c8c 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 _0xbe49=['/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe49,0xa4));var _0x9be4=function(_0x2cee1b,_0x2bc0a9){_0x2cee1b=_0x2cee1b-0x0;var _0x19c8a2=_0xbe49[_0x2cee1b];return _0x19c8a2;};'use strict';var multer=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var path=require(_0x9be4('0x2'));var timeout=require(_0x9be4('0x3'));var express=require(_0x9be4('0x4'));var router=express[_0x9be4('0x5')]();var fs_extra=require(_0x9be4('0x6'));var auth=require(_0x9be4('0x7'));var interaction=require(_0x9be4('0x8'));var config=require(_0x9be4('0x9'));var controller=require(_0x9be4('0xa'));router[_0x9be4('0xb')]('/',auth[_0x9be4('0xc')](),controller[_0x9be4('0xd')]);router['get'](_0x9be4('0xe'),auth[_0x9be4('0xc')](),controller[_0x9be4('0xf')]);router[_0x9be4('0xb')](_0x9be4('0x10'),auth['isAuthenticated'](),controller[_0x9be4('0x11')]);router['get'](_0x9be4('0x12'),auth[_0x9be4('0xc')](),controller[_0x9be4('0x13')]);router[_0x9be4('0xb')](_0x9be4('0x14'),auth[_0x9be4('0xc')](),controller['getAnswers']);router[_0x9be4('0xb')](_0x9be4('0x15'),auth[_0x9be4('0xc')](),controller[_0x9be4('0x16')]);router[_0x9be4('0xb')](_0x9be4('0x17'),auth['isAuthenticated'](),controller[_0x9be4('0x18')]);router['get']('/:id/messages',auth[_0x9be4('0xc')](),controller[_0x9be4('0x19')]);router[_0x9be4('0xb')]('/:id/users',auth[_0x9be4('0xc')](),controller[_0x9be4('0x1a')]);router[_0x9be4('0x1b')]('/',auth['isAuthenticated'](),controller[_0x9be4('0x1c')]);router[_0x9be4('0x1b')]('/:id/dispositions',auth[_0x9be4('0xc')](),controller[_0x9be4('0x1d')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9be4('0x1e')]);router['post'](_0x9be4('0x15'),auth['isAuthenticated'](),controller[_0x9be4('0x1f')]);router['post'](_0x9be4('0x17'),auth[_0x9be4('0xc')](),controller[_0x9be4('0x20')]);router[_0x9be4('0x1b')](_0x9be4('0x21'),auth[_0x9be4('0xc')](),controller[_0x9be4('0x22')]);router[_0x9be4('0x1b')](_0x9be4('0x23'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x9be4('0x1b')](_0x9be4('0x24'),auth[_0x9be4('0xc')](),controller['send']);router[_0x9be4('0x1b')]('/:id/users',auth[_0x9be4('0xc')](),controller[_0x9be4('0x25')]);router[_0x9be4('0x26')](_0x9be4('0x10'),auth[_0x9be4('0xc')](),controller[_0x9be4('0x27')]);router[_0x9be4('0x28')](_0x9be4('0x10'),auth[_0x9be4('0xc')](),controller[_0x9be4('0x29')]);router['delete'](_0x9be4('0x12'),auth[_0x9be4('0xc')](),controller[_0x9be4('0x2a')]);router[_0x9be4('0x28')]('/:id/canned_answers',auth[_0x9be4('0xc')](),controller[_0x9be4('0x2b')]);router[_0x9be4('0x28')]('/:id/users',auth[_0x9be4('0xc')](),controller[_0x9be4('0x2c')]);module[_0x9be4('0x2d')]=router; \ No newline at end of file +var _0x2a9e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','/:id/dispositions','addDisposition','addAnswer','post','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','removeDispositions','removeAnswers','delete','removeAgents','exports','multer','path','connect-timeout'];(function(_0x1d5663,_0x2f6a69){var _0x344a4d=function(_0x3f3e93){while(--_0x3f3e93){_0x1d5663['push'](_0x1d5663['shift']());}};_0x344a4d(++_0x2f6a69);}(_0x2a9e,0x16e));var _0xe2a9=function(_0x44c01f,_0xf8d144){_0x44c01f=_0x44c01f-0x0;var _0x5a0c7c=_0x2a9e[_0x44c01f];return _0x5a0c7c;};'use strict';var multer=require(_0xe2a9('0x0'));var util=require('util');var path=require(_0xe2a9('0x1'));var timeout=require(_0xe2a9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe2a9('0x3'));var auth=require(_0xe2a9('0x4'));var interaction=require(_0xe2a9('0x5'));var config=require(_0xe2a9('0x6'));var controller=require(_0xe2a9('0x7'));router[_0xe2a9('0x8')]('/',auth['isAuthenticated'](),controller[_0xe2a9('0x9')]);router[_0xe2a9('0x8')](_0xe2a9('0xa'),auth[_0xe2a9('0xb')](),controller['describe']);router[_0xe2a9('0x8')](_0xe2a9('0xc'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0xd')]);router[_0xe2a9('0x8')]('/:id/dispositions',auth[_0xe2a9('0xb')](),controller['getDispositions']);router['get'](_0xe2a9('0xe'),auth[_0xe2a9('0xb')](),controller['getAnswers']);router['get'](_0xe2a9('0xf'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x10')]);router[_0xe2a9('0x8')](_0xe2a9('0x11'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x12')]);router[_0xe2a9('0x8')](_0xe2a9('0x13'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x14')]);router[_0xe2a9('0x8')](_0xe2a9('0x15'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x16')]);router['post']('/',auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x17')]);router['post'](_0xe2a9('0x18'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x19')]);router['post'](_0xe2a9('0xe'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x1a')]);router[_0xe2a9('0x1b')](_0xe2a9('0xf'),auth[_0xe2a9('0xb')](),controller['addInteraction']);router[_0xe2a9('0x1b')](_0xe2a9('0x11'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x1c')]);router[_0xe2a9('0x1b')](_0xe2a9('0x1d'),auth[_0xe2a9('0xb')](),controller['addAccountApplications']);router[_0xe2a9('0x1b')](_0xe2a9('0x1e'),auth['isAuthenticated'](),controller[_0xe2a9('0x1f')]);router[_0xe2a9('0x1b')](_0xe2a9('0x20'),auth[_0xe2a9('0xb')](),controller['send']);router[_0xe2a9('0x1b')]('/:id/users',auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x21')]);router[_0xe2a9('0x22')](_0xe2a9('0xc'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x23')]);router['delete'](_0xe2a9('0xc'),auth[_0xe2a9('0xb')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe2a9('0x24')]);router['delete'](_0xe2a9('0xe'),auth['isAuthenticated'](),controller[_0xe2a9('0x25')]);router[_0xe2a9('0x26')](_0xe2a9('0x15'),auth[_0xe2a9('0xb')](),controller[_0xe2a9('0x27')]);module[_0xe2a9('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 02e06e4..a64d8e2 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 _0xdfb3=['exports','STRING'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xdfb3,0xe2));var _0x3dfb=function(_0x5ed3b1,_0x3e59b2){_0x5ed3b1=_0x5ed3b1-0x0;var _0x3cc545=_0xdfb3[_0x5ed3b1];return _0x3cc545;};'use strict';var Sequelize=require('sequelize');module[_0x3dfb('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3dfb('0x1')]},'interval':{'type':Sequelize[_0x3dfb('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa135=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x387603,_0x5a2d1){var _0x55ea9e=function(_0x46c5be){while(--_0x46c5be){_0x387603['push'](_0x387603['shift']());}};_0x55ea9e(++_0x5a2d1);}(_0xa135,0x1e8));var _0x5a13=function(_0xdbe65d,_0x39a0f9){_0xdbe65d=_0xdbe65d-0x0;var _0x463ed=_0xa135[_0xdbe65d];return _0x463ed;};'use strict';var Sequelize=require(_0x5a13('0x0'));module[_0x5a13('0x1')]={'priority':{'type':Sequelize[_0x5a13('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5a13('0x3')],'allowNull':![],'defaultValue':_0x5a13('0x4')},'appdata':{'type':Sequelize[_0x5a13('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5a13('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 36e36f1..4fb66d0 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 _0x4518=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','name','index','FaxApplication','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','length','find'];(function(_0x3ddc08,_0x394e4a){var _0x3984a3=function(_0x1094d2){while(--_0x1094d2){_0x3ddc08['push'](_0x3ddc08['shift']());}};_0x3984a3(++_0x394e4a);}(_0x4518,0x1c4));var _0x8451=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x4518[_0x46ec32];return _0x338f60;};'use strict';var emlformat=require(_0x8451('0x0'));var rimraf=require(_0x8451('0x1'));var zipdir=require(_0x8451('0x2'));var jsonpatch=require(_0x8451('0x3'));var rp=require(_0x8451('0x4'));var moment=require(_0x8451('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8451('0x6'));var util=require(_0x8451('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8451('0x8'));var ejs=require(_0x8451('0x9'));var fs=require('fs');var fs_extra=require(_0x8451('0xa'));var _=require(_0x8451('0xb'));var squel=require(_0x8451('0xc'));var crypto=require(_0x8451('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8451('0xe'));var toCsv=require(_0x8451('0x8'));var querystring=require(_0x8451('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8451('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8451('0x11'));var logger=require(_0x8451('0x12'))(_0x8451('0x13'));var utils=require(_0x8451('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8451('0x15'));var db=require(_0x8451('0x16'))['db'];function respondWithStatusCode(_0x1a25cc,_0x393153){_0x393153=_0x393153||0xcc;return function(_0x27c60a){if(_0x27c60a){return _0x1a25cc[_0x8451('0x17')](_0x393153);}return _0x1a25cc[_0x8451('0x18')](_0x393153)['end']();};}function respondWithResult(_0x505043,_0x5df614){_0x5df614=_0x5df614||0xc8;return function(_0x2decfa){if(_0x2decfa){return _0x505043[_0x8451('0x18')](_0x5df614)['json'](_0x2decfa);}};}function respondWithFilteredResult(_0x5a4499,_0x3de4e8){return function(_0x6b4b44){if(_0x6b4b44){var _0x3eccce=typeof _0x3de4e8['offset']===_0x8451('0x19')&&typeof _0x3de4e8[_0x8451('0x1a')]==='undefined';var _0x4b6607=_0x6b4b44[_0x8451('0x1b')];var _0x3b3fa2=_0x3eccce?0x0:_0x3de4e8[_0x8451('0x1c')];var _0xb2b252=_0x3eccce?_0x6b4b44['count']:_0x3de4e8[_0x8451('0x1c')]+_0x3de4e8[_0x8451('0x1a')];var _0x45bc26;if(_0xb2b252>=_0x4b6607){_0xb2b252=_0x4b6607;_0x45bc26=0xc8;}else{_0x45bc26=0xce;}_0x5a4499[_0x8451('0x18')](_0x45bc26);return _0x5a4499[_0x8451('0x1d')](_0x8451('0x1e'),_0x3b3fa2+'-'+_0xb2b252+'/'+_0x4b6607)[_0x8451('0x1f')](_0x6b4b44);}return null;};}function patchUpdates(_0x28d97d){return function(_0x336065){try{jsonpatch[_0x8451('0x20')](_0x336065,_0x28d97d,!![]);}catch(_0x44f7cd){return BPromise[_0x8451('0x21')](_0x44f7cd);}return _0x336065[_0x8451('0x22')]();};}function saveUpdates(_0x22d98e,_0x17cd7a){return function(_0x22d915){if(_0x22d915){return _0x22d915[_0x8451('0x23')](_0x22d98e)['then'](function(_0x1eef8c){return _0x1eef8c;});}return null;};}function removeEntity(_0x1fb1ed,_0x1b83fa){return function(_0x24547b){if(_0x24547b){return _0x24547b[_0x8451('0x24')]()[_0x8451('0x25')](function(){_0x1fb1ed[_0x8451('0x18')](0xcc)[_0x8451('0x26')]();});}};}function handleEntityNotFound(_0x5a5d20,_0x954e93){return function(_0x4e0670){if(!_0x4e0670){_0x5a5d20[_0x8451('0x17')](0x194);}return _0x4e0670;};}function handleError(_0x9cc75a,_0x15cec2){_0x15cec2=_0x15cec2||0x1f4;return function(_0x3e46e4){logger[_0x8451('0x27')](_0x3e46e4['stack']);if(_0x3e46e4[_0x8451('0x28')]){delete _0x3e46e4[_0x8451('0x28')];}_0x9cc75a[_0x8451('0x18')](_0x15cec2)['send'](_0x3e46e4);};}exports[_0x8451('0x29')]=function(_0x472854,_0x2f2b54){var _0x6a0980={},_0x243d6c={},_0x56ae4b={'count':0x0,'rows':[]};var _0x511e0e=_['map'](db[_0x8451('0x2a')][_0x8451('0x2b')],function(_0x16035a){return{'name':_0x16035a[_0x8451('0x2c')],'type':_0x16035a[_0x8451('0x2d')][_0x8451('0x2e')]};});_0x243d6c['model']=_[_0x8451('0x2f')](_0x511e0e,_0x8451('0x28'));_0x243d6c[_0x8451('0x30')]=_[_0x8451('0x31')](_0x472854[_0x8451('0x30')]);_0x243d6c['filters']=_[_0x8451('0x32')](_0x243d6c[_0x8451('0x33')],_0x243d6c['query']);_0x6a0980[_0x8451('0x34')]=_[_0x8451('0x32')](_0x243d6c[_0x8451('0x33')],qs[_0x8451('0x35')](_0x472854[_0x8451('0x30')][_0x8451('0x35')]));_0x6a0980[_0x8451('0x34')]=_0x6a0980['attributes']['length']?_0x6a0980[_0x8451('0x34')]:_0x243d6c['model'];if(!_0x472854[_0x8451('0x30')][_0x8451('0x36')](_0x8451('0x37'))){_0x6a0980['limit']=qs[_0x8451('0x1a')](_0x472854[_0x8451('0x30')][_0x8451('0x1a')]);_0x6a0980[_0x8451('0x1c')]=qs['offset'](_0x472854['query']['offset']);}_0x6a0980[_0x8451('0x38')]=qs[_0x8451('0x39')](_0x472854[_0x8451('0x30')][_0x8451('0x39')]);_0x6a0980[_0x8451('0x3a')]=qs[_0x8451('0x3b')](_[_0x8451('0x3c')](_0x472854[_0x8451('0x30')],_0x243d6c[_0x8451('0x3b')]),_0x511e0e);if(_0x472854[_0x8451('0x30')][_0x8451('0x3d')]){_0x6a0980[_0x8451('0x3a')]=_['merge'](_0x6a0980[_0x8451('0x3a')],{'$or':_[_0x8451('0x2f')](_0x511e0e,function(_0x3e72a4){if(_0x3e72a4[_0x8451('0x2d')]!==_0x8451('0x3e')){var _0x361f16={};_0x361f16[_0x3e72a4[_0x8451('0x28')]]={'$like':'%'+_0x472854[_0x8451('0x30')]['filter']+'%'};return _0x361f16;}})});}_0x6a0980=_[_0x8451('0x3f')]({},_0x6a0980,_0x472854[_0x8451('0x40')]);var _0x16a353={'where':_0x6a0980[_0x8451('0x3a')]};return db[_0x8451('0x2a')][_0x8451('0x1b')](_0x16a353)['then'](function(_0x1f7d5f){_0x56ae4b[_0x8451('0x1b')]=_0x1f7d5f;if(_0x472854['query'][_0x8451('0x41')]){_0x6a0980[_0x8451('0x42')]=[{'all':!![]}];}return db[_0x8451('0x2a')][_0x8451('0x43')](_0x6a0980);})[_0x8451('0x25')](function(_0x276acf){_0x56ae4b[_0x8451('0x44')]=_0x276acf;return _0x56ae4b;})[_0x8451('0x25')](respondWithFilteredResult(_0x2f2b54,_0x6a0980))[_0x8451('0x45')](handleError(_0x2f2b54,null));};exports['show']=function(_0x315722,_0x54bb24){var _0x157924={'raw':!![],'where':{'id':_0x315722[_0x8451('0x46')]['id']}},_0xe8367b={};_0xe8367b[_0x8451('0x33')]=_['keys'](db['FaxApplication'][_0x8451('0x2b')]);_0xe8367b[_0x8451('0x30')]=_[_0x8451('0x31')](_0x315722['query']);_0xe8367b[_0x8451('0x3b')]=_[_0x8451('0x32')](_0xe8367b[_0x8451('0x33')],_0xe8367b[_0x8451('0x30')]);_0x157924[_0x8451('0x34')]=_[_0x8451('0x32')](_0xe8367b[_0x8451('0x33')],qs[_0x8451('0x35')](_0x315722[_0x8451('0x30')][_0x8451('0x35')]));_0x157924[_0x8451('0x34')]=_0x157924['attributes'][_0x8451('0x47')]?_0x157924[_0x8451('0x34')]:_0xe8367b[_0x8451('0x33')];if(_0x315722[_0x8451('0x30')][_0x8451('0x41')]){_0x157924[_0x8451('0x42')]=[{'all':!![]}];}_0x157924=_[_0x8451('0x3f')]({},_0x157924,_0x315722[_0x8451('0x40')]);return db[_0x8451('0x2a')][_0x8451('0x48')](_0x157924)[_0x8451('0x25')](handleEntityNotFound(_0x54bb24,null))['then'](respondWithResult(_0x54bb24,null))[_0x8451('0x45')](handleError(_0x54bb24,null));};exports[_0x8451('0x49')]=function(_0x4f606d,_0x2a6006){return db[_0x8451('0x2a')][_0x8451('0x49')](_0x4f606d[_0x8451('0x4a')],{})[_0x8451('0x25')](respondWithResult(_0x2a6006,0xc9))['catch'](handleError(_0x2a6006,null));};exports['update']=function(_0x1cccfa,_0x4851db){if(_0x1cccfa['body']['id']){delete _0x1cccfa[_0x8451('0x4a')]['id'];}return db[_0x8451('0x2a')][_0x8451('0x48')]({'where':{'id':_0x1cccfa['params']['id']}})[_0x8451('0x25')](handleEntityNotFound(_0x4851db,null))[_0x8451('0x25')](saveUpdates(_0x1cccfa['body'],null))[_0x8451('0x25')](respondWithResult(_0x4851db,null))[_0x8451('0x45')](handleError(_0x4851db,null));};exports['destroy']=function(_0x2a11b0,_0x20a955){return db[_0x8451('0x2a')][_0x8451('0x48')]({'where':{'id':_0x2a11b0['params']['id']}})['then'](handleEntityNotFound(_0x20a955,null))['then'](removeEntity(_0x20a955,null))[_0x8451('0x45')](handleError(_0x20a955,null));}; \ No newline at end of file +var _0xfda0=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','rimraf','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x465e89,_0x2cc5a3){var _0x3234a0=function(_0x47824a){while(--_0x47824a){_0x465e89['push'](_0x465e89['shift']());}};_0x3234a0(++_0x2cc5a3);}(_0xfda0,0xce));var _0x0fda=function(_0x4eb3b1,_0x3aec62){_0x4eb3b1=_0x4eb3b1-0x0;var _0x51c22c=_0xfda0[_0x4eb3b1];return _0x51c22c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fda('0x0'));var zipdir=require(_0x0fda('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fda('0x2'));var moment=require('moment');var BPromise=require(_0x0fda('0x3'));var Mustache=require(_0x0fda('0x4'));var util=require(_0x0fda('0x5'));var path=require(_0x0fda('0x6'));var sox=require(_0x0fda('0x7'));var csv=require('to-csv');var ejs=require(_0x0fda('0x8'));var fs=require('fs');var fs_extra=require(_0x0fda('0x9'));var _=require(_0x0fda('0xa'));var squel=require(_0x0fda('0xb'));var crypto=require(_0x0fda('0xc'));var jsforce=require(_0x0fda('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0fda('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0fda('0xf'));var qs=require(_0x0fda('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fda('0x11'))(_0x0fda('0x12'));var utils=require(_0x0fda('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fda('0x14'))['db'];function respondWithStatusCode(_0x3f7f29,_0x37a9f9){_0x37a9f9=_0x37a9f9||0xcc;return function(_0x1c678d){if(_0x1c678d){return _0x3f7f29[_0x0fda('0x15')](_0x37a9f9);}return _0x3f7f29[_0x0fda('0x16')](_0x37a9f9)[_0x0fda('0x17')]();};}function respondWithResult(_0xfa8e9c,_0x347363){_0x347363=_0x347363||0xc8;return function(_0xa6526e){if(_0xa6526e){return _0xfa8e9c[_0x0fda('0x16')](_0x347363)[_0x0fda('0x18')](_0xa6526e);}};}function respondWithFilteredResult(_0x50ad6b,_0x3f1c6d){return function(_0x19dcd0){if(_0x19dcd0){var _0x105f2f=typeof _0x3f1c6d['offset']===_0x0fda('0x19')&&typeof _0x3f1c6d['limit']==='undefined';var _0x19f6d7=_0x19dcd0[_0x0fda('0x1a')];var _0x47b025=_0x105f2f?0x0:_0x3f1c6d[_0x0fda('0x1b')];var _0x40d4d2=_0x105f2f?_0x19dcd0[_0x0fda('0x1a')]:_0x3f1c6d[_0x0fda('0x1b')]+_0x3f1c6d['limit'];var _0x43cf1f;if(_0x40d4d2>=_0x19f6d7){_0x40d4d2=_0x19f6d7;_0x43cf1f=0xc8;}else{_0x43cf1f=0xce;}_0x50ad6b[_0x0fda('0x16')](_0x43cf1f);return _0x50ad6b[_0x0fda('0x1c')](_0x0fda('0x1d'),_0x47b025+'-'+_0x40d4d2+'/'+_0x19f6d7)[_0x0fda('0x18')](_0x19dcd0);}return null;};}function patchUpdates(_0x29098f){return function(_0x803539){try{jsonpatch['apply'](_0x803539,_0x29098f,!![]);}catch(_0x66c421){return BPromise[_0x0fda('0x1e')](_0x66c421);}return _0x803539[_0x0fda('0x1f')]();};}function saveUpdates(_0x29c44b,_0x5b0d6f){return function(_0x5d6c4c){if(_0x5d6c4c){return _0x5d6c4c['update'](_0x29c44b)[_0x0fda('0x20')](function(_0x2afa2c){return _0x2afa2c;});}return null;};}function removeEntity(_0x292002,_0xb475a){return function(_0x5a2f22){if(_0x5a2f22){return _0x5a2f22[_0x0fda('0x21')]()['then'](function(){_0x292002[_0x0fda('0x16')](0xcc)[_0x0fda('0x17')]();});}};}function handleEntityNotFound(_0x4f374a,_0x48552e){return function(_0x183a7){if(!_0x183a7){_0x4f374a['sendStatus'](0x194);}return _0x183a7;};}function handleError(_0x35987d,_0x546e93){_0x546e93=_0x546e93||0x1f4;return function(_0x50f419){logger[_0x0fda('0x22')](_0x50f419[_0x0fda('0x23')]);if(_0x50f419['name']){delete _0x50f419[_0x0fda('0x24')];}_0x35987d[_0x0fda('0x16')](_0x546e93)[_0x0fda('0x25')](_0x50f419);};}exports[_0x0fda('0x26')]=function(_0x155024,_0x35d82e){var _0x4bf153={},_0x537992={},_0x37e5dc={'count':0x0,'rows':[]};var _0x1bac52=_[_0x0fda('0x27')](db[_0x0fda('0x28')][_0x0fda('0x29')],function(_0x40a3ee){return{'name':_0x40a3ee['fieldName'],'type':_0x40a3ee[_0x0fda('0x2a')][_0x0fda('0x2b')]};});_0x537992[_0x0fda('0x2c')]=_[_0x0fda('0x27')](_0x1bac52,_0x0fda('0x24'));_0x537992[_0x0fda('0x2d')]=_[_0x0fda('0x2e')](_0x155024[_0x0fda('0x2d')]);_0x537992[_0x0fda('0x2f')]=_['intersection'](_0x537992[_0x0fda('0x2c')],_0x537992[_0x0fda('0x2d')]);_0x4bf153[_0x0fda('0x30')]=_[_0x0fda('0x31')](_0x537992[_0x0fda('0x2c')],qs[_0x0fda('0x32')](_0x155024[_0x0fda('0x2d')][_0x0fda('0x32')]));_0x4bf153[_0x0fda('0x30')]=_0x4bf153[_0x0fda('0x30')]['length']?_0x4bf153[_0x0fda('0x30')]:_0x537992[_0x0fda('0x2c')];if(!_0x155024[_0x0fda('0x2d')][_0x0fda('0x33')](_0x0fda('0x34'))){_0x4bf153[_0x0fda('0x35')]=qs[_0x0fda('0x35')](_0x155024[_0x0fda('0x2d')]['limit']);_0x4bf153[_0x0fda('0x1b')]=qs['offset'](_0x155024[_0x0fda('0x2d')][_0x0fda('0x1b')]);}_0x4bf153['order']=qs['sort'](_0x155024['query'][_0x0fda('0x36')]);_0x4bf153['where']=qs[_0x0fda('0x2f')](_[_0x0fda('0x37')](_0x155024[_0x0fda('0x2d')],_0x537992['filters']),_0x1bac52);if(_0x155024[_0x0fda('0x2d')][_0x0fda('0x38')]){_0x4bf153[_0x0fda('0x39')]=_[_0x0fda('0x3a')](_0x4bf153[_0x0fda('0x39')],{'$or':_[_0x0fda('0x27')](_0x1bac52,function(_0xb7eed9){if(_0xb7eed9[_0x0fda('0x2a')]!==_0x0fda('0x3b')){var _0x4dc06d={};_0x4dc06d[_0xb7eed9[_0x0fda('0x24')]]={'$like':'%'+_0x155024[_0x0fda('0x2d')][_0x0fda('0x38')]+'%'};return _0x4dc06d;}})});}_0x4bf153=_[_0x0fda('0x3a')]({},_0x4bf153,_0x155024[_0x0fda('0x3c')]);var _0x2e8132={'where':_0x4bf153['where']};return db[_0x0fda('0x28')][_0x0fda('0x1a')](_0x2e8132)[_0x0fda('0x20')](function(_0xc5b532){_0x37e5dc['count']=_0xc5b532;if(_0x155024['query'][_0x0fda('0x3d')]){_0x4bf153[_0x0fda('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x4bf153);})[_0x0fda('0x20')](function(_0x1d2765){_0x37e5dc[_0x0fda('0x3f')]=_0x1d2765;return _0x37e5dc;})[_0x0fda('0x20')](respondWithFilteredResult(_0x35d82e,_0x4bf153))[_0x0fda('0x40')](handleError(_0x35d82e,null));};exports[_0x0fda('0x41')]=function(_0x571f58,_0x4e4db7){var _0x44b909={'raw':!![],'where':{'id':_0x571f58[_0x0fda('0x42')]['id']}},_0x3fe0e4={};_0x3fe0e4[_0x0fda('0x2c')]=_[_0x0fda('0x2e')](db[_0x0fda('0x28')][_0x0fda('0x29')]);_0x3fe0e4[_0x0fda('0x2d')]=_[_0x0fda('0x2e')](_0x571f58[_0x0fda('0x2d')]);_0x3fe0e4['filters']=_[_0x0fda('0x31')](_0x3fe0e4['model'],_0x3fe0e4[_0x0fda('0x2d')]);_0x44b909['attributes']=_[_0x0fda('0x31')](_0x3fe0e4[_0x0fda('0x2c')],qs[_0x0fda('0x32')](_0x571f58['query'][_0x0fda('0x32')]));_0x44b909[_0x0fda('0x30')]=_0x44b909[_0x0fda('0x30')]['length']?_0x44b909['attributes']:_0x3fe0e4[_0x0fda('0x2c')];if(_0x571f58[_0x0fda('0x2d')][_0x0fda('0x3d')]){_0x44b909[_0x0fda('0x3e')]=[{'all':!![]}];}_0x44b909=_[_0x0fda('0x3a')]({},_0x44b909,_0x571f58[_0x0fda('0x3c')]);return db[_0x0fda('0x28')][_0x0fda('0x43')](_0x44b909)['then'](handleEntityNotFound(_0x4e4db7,null))[_0x0fda('0x20')](respondWithResult(_0x4e4db7,null))[_0x0fda('0x40')](handleError(_0x4e4db7,null));};exports[_0x0fda('0x44')]=function(_0x21f028,_0x124176){return db['FaxApplication'][_0x0fda('0x44')](_0x21f028[_0x0fda('0x45')],{})[_0x0fda('0x20')](respondWithResult(_0x124176,0xc9))[_0x0fda('0x40')](handleError(_0x124176,null));};exports[_0x0fda('0x46')]=function(_0x217727,_0xb37f47){if(_0x217727['body']['id']){delete _0x217727[_0x0fda('0x45')]['id'];}return db[_0x0fda('0x28')][_0x0fda('0x43')]({'where':{'id':_0x217727['params']['id']}})[_0x0fda('0x20')](handleEntityNotFound(_0xb37f47,null))[_0x0fda('0x20')](saveUpdates(_0x217727['body'],null))[_0x0fda('0x20')](respondWithResult(_0xb37f47,null))['catch'](handleError(_0xb37f47,null));};exports['destroy']=function(_0x1bfc86,_0x267e6a){return db[_0x0fda('0x28')][_0x0fda('0x43')]({'where':{'id':_0x1bfc86[_0x0fda('0x42')]['id']}})[_0x0fda('0x20')](handleEntityNotFound(_0x267e6a,null))['then'](removeEntity(_0x267e6a,null))[_0x0fda('0x40')](handleError(_0x267e6a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 19bad67..0dd2f91 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 _0xf541=['request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x393c99,_0x166f01){var _0x2f35fe=function(_0x62ab32){while(--_0x62ab32){_0x393c99['push'](_0x393c99['shift']());}};_0x2f35fe(++_0x166f01);}(_0xf541,0x78));var _0x1f54=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xf541[_0x5216e0];return _0x5b3f40;};'use strict';var _=require(_0x1f54('0x0'));var util=require(_0x1f54('0x1'));var logger=require(_0x1f54('0x2'))(_0x1f54('0x3'));var moment=require(_0x1f54('0x4'));var BPromise=require(_0x1f54('0x5'));var rp=require(_0x1f54('0x6'));var fs=require('fs');var path=require(_0x1f54('0x7'));var rimraf=require('rimraf');var config=require(_0x1f54('0x8'));var attributes=require(_0x1f54('0x9'));module[_0x1f54('0xa')]=function(_0x32fe95,_0x1756ab){return _0x32fe95[_0x1f54('0xb')]('FaxApplication',attributes,{'tableName':_0x1f54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f54('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdbb0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbb0,0x195));var _0x0dbb=function(_0x1c725e,_0x4196b7){_0x1c725e=_0x1c725e-0x0;var _0x57c74d=_0xdbb0[_0x1c725e];return _0x57c74d;};'use strict';var _=require(_0x0dbb('0x0'));var util=require(_0x0dbb('0x1'));var logger=require(_0x0dbb('0x2'))(_0x0dbb('0x3'));var moment=require(_0x0dbb('0x4'));var BPromise=require(_0x0dbb('0x5'));var rp=require(_0x0dbb('0x6'));var fs=require('fs');var path=require(_0x0dbb('0x7'));var rimraf=require(_0x0dbb('0x8'));var config=require(_0x0dbb('0x9'));var attributes=require(_0x0dbb('0xa'));module[_0x0dbb('0xb')]=function(_0x2841d7,_0x1bf306){return _0x2841d7['define'](_0x0dbb('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0dbb('0xd'),'collate':_0x0dbb('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f879b23..6ad7da6 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 _0xd4a5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','limit','util','moment'];(function(_0x2f0eaf,_0x162021){var _0x108d21=function(_0x407ff6){while(--_0x407ff6){_0x2f0eaf['push'](_0x2f0eaf['shift']());}};_0x108d21(++_0x162021);}(_0xd4a5,0x166));var _0x5d4a=function(_0x4fc0a3,_0x297edf){_0x4fc0a3=_0x4fc0a3-0x0;var _0x12ea75=_0xd4a5[_0x4fc0a3];return _0x12ea75;};'use strict';var _=require('lodash');var util=require(_0x5d4a('0x0'));var moment=require(_0x5d4a('0x1'));var BPromise=require(_0x5d4a('0x2'));var rs=require(_0x5d4a('0x3'));var fs=require('fs');var Redis=require(_0x5d4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d4a('0x5'));var logger=require(_0x5d4a('0x6'))(_0x5d4a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d4a('0x8')][_0x5d4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59f13c,_0x2a288b,_0x25bf8e){return new BPromise(function(_0x36c216,_0x9c6ac5){return client[_0x5d4a('0xa')](_0x59f13c,_0x25bf8e)[_0x5d4a('0xb')](function(_0x559d07){logger[_0x5d4a('0xc')]('FaxApplication,\x20%s,\x20%s',_0x2a288b,_0x5d4a('0xd'));logger[_0x5d4a('0xe')](_0x5d4a('0xf'),_0x2a288b,_0x5d4a('0xd'),JSON[_0x5d4a('0x10')](_0x559d07));if(_0x559d07[_0x5d4a('0x11')]){if(_0x559d07[_0x5d4a('0x11')][_0x5d4a('0x12')]===0x1f4){logger[_0x5d4a('0x11')](_0x5d4a('0x13'),_0x2a288b,_0x559d07['error'][_0x5d4a('0x14')]);return _0x9c6ac5(_0x559d07[_0x5d4a('0x11')]['message']);}logger[_0x5d4a('0x11')](_0x5d4a('0x13'),_0x2a288b,_0x559d07[_0x5d4a('0x11')][_0x5d4a('0x14')]);return _0x36c216(_0x559d07[_0x5d4a('0x11')][_0x5d4a('0x14')]);}else{logger[_0x5d4a('0xc')](_0x5d4a('0x13'),_0x2a288b,_0x5d4a('0xd'));_0x36c216(_0x559d07[_0x5d4a('0x15')][_0x5d4a('0x14')]);}})[_0x5d4a('0x16')](function(_0x125d48){logger[_0x5d4a('0x11')]('FaxApplication,\x20%s,\x20%s',_0x2a288b,_0x125d48);_0x9c6ac5(_0x125d48);});});}exports[_0x5d4a('0x17')]=function(_0x540a17){var _0x27eceb=this;return new Promise(function(_0x54a72e,_0x54c7f8){return db[_0x5d4a('0x18')]['update'](_0x540a17['body'],{'raw':_0x540a17[_0x5d4a('0x19')]?_0x540a17[_0x5d4a('0x19')][_0x5d4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540a17['options']?_0x540a17[_0x5d4a('0x19')][_0x5d4a('0x1b')]||null:null,'attributes':_0x540a17[_0x5d4a('0x19')]?_0x540a17[_0x5d4a('0x19')][_0x5d4a('0x1c')]||null:null,'limit':_0x540a17['options']?_0x540a17[_0x5d4a('0x19')][_0x5d4a('0x1d')]||null:null})[_0x5d4a('0xb')](function(_0xb7053e){logger[_0x5d4a('0xc')](_0x5d4a('0x17'),_0x540a17);logger[_0x5d4a('0xe')](_0x5d4a('0x17'),_0x540a17,JSON[_0x5d4a('0x10')](_0xb7053e));_0x54a72e(_0xb7053e);})[_0x5d4a('0x16')](function(_0x2229d8){logger['error']('UpdateFaxApplication',_0x2229d8[_0x5d4a('0x14')],_0x540a17);_0x54c7f8(_0x27eceb[_0x5d4a('0x11')](0x1f4,_0x2229d8[_0x5d4a('0x14')]));});});}; \ No newline at end of file +var _0xc9e1=['code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a51db,_0x2eecdc){var _0xea0473=function(_0x54b391){while(--_0x54b391){_0x1a51db['push'](_0x1a51db['shift']());}};_0xea0473(++_0x2eecdc);}(_0xc9e1,0x1cb));var _0x1c9e=function(_0x2c4a16,_0x47f017){_0x2c4a16=_0x2c4a16-0x0;var _0x36b838=_0xc9e1[_0x2c4a16];return _0x36b838;};'use strict';var _=require(_0x1c9e('0x0'));var util=require(_0x1c9e('0x1'));var moment=require(_0x1c9e('0x2'));var BPromise=require(_0x1c9e('0x3'));var rs=require(_0x1c9e('0x4'));var fs=require('fs');var Redis=require(_0x1c9e('0x5'));var db=require(_0x1c9e('0x6'))['db'];var utils=require(_0x1c9e('0x7'));var logger=require('../../config/logger')(_0x1c9e('0x8'));var config=require(_0x1c9e('0x9'));var jayson=require(_0x1c9e('0xa'));var client=jayson[_0x1c9e('0xb')][_0x1c9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x192fa5,_0x5ed43d,_0x16db80){return new BPromise(function(_0x3430e2,_0x278783){return client[_0x1c9e('0xd')](_0x192fa5,_0x16db80)[_0x1c9e('0xe')](function(_0x1acc25){logger[_0x1c9e('0xf')](_0x1c9e('0x10'),_0x5ed43d,_0x1c9e('0x11'));logger['debug'](_0x1c9e('0x12'),_0x5ed43d,'request\x20sent',JSON[_0x1c9e('0x13')](_0x1acc25));if(_0x1acc25[_0x1c9e('0x14')]){if(_0x1acc25[_0x1c9e('0x14')][_0x1c9e('0x15')]===0x1f4){logger['error'](_0x1c9e('0x10'),_0x5ed43d,_0x1acc25['error']['message']);return _0x278783(_0x1acc25['error'][_0x1c9e('0x16')]);}logger[_0x1c9e('0x14')](_0x1c9e('0x10'),_0x5ed43d,_0x1acc25['error']['message']);return _0x3430e2(_0x1acc25['error']['message']);}else{logger[_0x1c9e('0xf')](_0x1c9e('0x10'),_0x5ed43d,_0x1c9e('0x11'));_0x3430e2(_0x1acc25[_0x1c9e('0x17')]['message']);}})[_0x1c9e('0x18')](function(_0x1443b2){logger[_0x1c9e('0x14')](_0x1c9e('0x10'),_0x5ed43d,_0x1443b2);_0x278783(_0x1443b2);});});}exports[_0x1c9e('0x19')]=function(_0x3b6f2d){var _0x363563=this;return new Promise(function(_0x4ab3a4,_0xf02070){return db[_0x1c9e('0x1a')]['update'](_0x3b6f2d[_0x1c9e('0x1b')],{'raw':_0x3b6f2d['options']?_0x3b6f2d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6f2d[_0x1c9e('0x1c')]?_0x3b6f2d[_0x1c9e('0x1c')][_0x1c9e('0x1d')]||null:null,'attributes':_0x3b6f2d['options']?_0x3b6f2d[_0x1c9e('0x1c')]['attributes']||null:null,'limit':_0x3b6f2d[_0x1c9e('0x1c')]?_0x3b6f2d[_0x1c9e('0x1c')][_0x1c9e('0x1e')]||null:null})[_0x1c9e('0xe')](function(_0x3879d5){logger['info']('UpdateFaxApplication',_0x3b6f2d);logger[_0x1c9e('0x1f')](_0x1c9e('0x19'),_0x3b6f2d,JSON[_0x1c9e('0x13')](_0x3879d5));_0x4ab3a4(_0x3879d5);})[_0x1c9e('0x18')](function(_0x1eac5e){logger[_0x1c9e('0x14')](_0x1c9e('0x19'),_0x1eac5e['message'],_0x3b6f2d);_0xf02070(_0x363563['error'](0x1f4,_0x1eac5e[_0x1c9e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 52a16c6..78a2ef2 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 _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5cb83e,_0x3ed092){var _0x531b33=function(_0x443aa5){while(--_0x443aa5){_0x5cb83e['push'](_0x5cb83e['shift']());}};_0x531b33(++_0x3ed092);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file +var _0x6e6c=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./faxApplication.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xe')]);module[_0xc6e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a08da85..8ff8b91 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 _0x1623=['INTEGER','sequelize','DATE','STRING','ENUM'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1623,0xab));var _0x3162=function(_0x10ab7b,_0x59b410){_0x10ab7b=_0x10ab7b-0x0;var _0x277cab=_0x1623[_0x10ab7b];return _0x277cab;};'use strict';var Sequelize=require(_0x3162('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3162('0x1')]},'disposition':{'type':Sequelize[_0x3162('0x2')]},'secondDisposition':{'type':Sequelize[_0x3162('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3162('0x2')]},'note':{'type':Sequelize[_0x3162('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x3162('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3162('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x3162('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x3162('0x4')]}}; \ No newline at end of file +var _0x66fa=['exports','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x66fa,0x117));var _0xa66f=function(_0x58d615,_0xfa01b9){_0x58d615=_0x58d615-0x0;var _0xadb66f=_0x66fa[_0x58d615];return _0xadb66f;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa66f('0x2')]},'disposition':{'type':Sequelize[_0xa66f('0x3')]},'secondDisposition':{'type':Sequelize[_0xa66f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa66f('0x3')]},'note':{'type':Sequelize[_0xa66f('0x3')]},'read1stAt':{'type':Sequelize[_0xa66f('0x2')]},'fax':{'type':Sequelize[_0xa66f('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa66f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa66f('0x4')]('in',_0xa66f('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xa66f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 6af2f85..75c4f73 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 _0xc9d4=['addMessage','FaxMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','Tag','color','emit','faxInteractionTags:save','removeTags','download','toString','join','root','server','tmp','files','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','createReadStream','pipe','basename','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','index','map','FaxInteraction','rawAttributes','fieldName','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','create','body','find','describe'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0xc9d4,0x8f));var _0x4c9d=function(_0x1b1252,_0x35686e){_0x1b1252=_0x1b1252-0x0;var _0x253b7b=_0xc9d4[_0x1b1252];return _0x253b7b;};'use strict';var rimraf=require(_0x4c9d('0x0'));var zipdir=require(_0x4c9d('0x1'));var moment=require(_0x4c9d('0x2'));var BPromise=require(_0x4c9d('0x3'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x4c9d('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x4c9d('0x5'));var logger=require('../../config/logger')(_0x4c9d('0x6'));var config=require(_0x4c9d('0x7'));var db=require('../../mysqldb')['db'];config[_0x4c9d('0x8')]=_['defaults'](config['redis'],{'host':_0x4c9d('0x9'),'port':0x18eb});var socket=require(_0x4c9d('0xa'))(new Redis(config[_0x4c9d('0x8')]));require('./faxInteraction.socket')[_0x4c9d('0xb')](socket);function respondWithStatusCode(_0x18932c,_0x2e9aa9){_0x2e9aa9=_0x2e9aa9||0xcc;return function(_0x292c48){if(_0x292c48){return _0x18932c[_0x4c9d('0xc')](_0x2e9aa9);}return _0x18932c[_0x4c9d('0xd')](_0x2e9aa9)[_0x4c9d('0xe')]();};}function respondWithResult(_0x265b5c,_0x2b1036){_0x2b1036=_0x2b1036||0xc8;return function(_0xeb84a4){if(_0xeb84a4){return _0x265b5c[_0x4c9d('0xd')](_0x2b1036)[_0x4c9d('0xf')](_0xeb84a4);}};}function respondWithFilteredResult(_0x38b2a2,_0x3312bd){return function(_0x3f3f17){if(_0x3f3f17){var _0x1cff7b=typeof _0x3312bd[_0x4c9d('0x10')]===_0x4c9d('0x11')&&typeof _0x3312bd[_0x4c9d('0x12')]===_0x4c9d('0x11');var _0x59bdb9=_0x3f3f17[_0x4c9d('0x13')];var _0x3496e3=_0x1cff7b?0x0:_0x3312bd[_0x4c9d('0x10')];var _0x1e2c2c=_0x1cff7b?_0x3f3f17[_0x4c9d('0x13')]:_0x3312bd[_0x4c9d('0x10')]+_0x3312bd[_0x4c9d('0x12')];var _0x3ddf0e;if(_0x1e2c2c>=_0x59bdb9){_0x1e2c2c=_0x59bdb9;_0x3ddf0e=0xc8;}else{_0x3ddf0e=0xce;}_0x38b2a2['status'](_0x3ddf0e);return _0x38b2a2[_0x4c9d('0x14')](_0x4c9d('0x15'),_0x3496e3+'-'+_0x1e2c2c+'/'+_0x59bdb9)['json'](_0x3f3f17);}return null;};}function saveUpdates(_0x6f1ab0){return function(_0x57c932){if(_0x57c932){return _0x57c932[_0x4c9d('0x16')](_0x6f1ab0)[_0x4c9d('0x17')](function(_0x229c61){return _0x229c61;});}return null;};}function removeEntity(_0x27821){return function(_0x315b65){if(_0x315b65){return _0x315b65[_0x4c9d('0x18')]()['then'](function(){_0x27821[_0x4c9d('0xd')](0xcc)[_0x4c9d('0xe')]();});}};}function handleEntityNotFound(_0x1eb31c){return function(_0x5ccfd9){if(!_0x5ccfd9){_0x1eb31c[_0x4c9d('0xc')](0x194);}return _0x5ccfd9;};}function handleError(_0x4d2f03,_0x634429){_0x634429=_0x634429||0x1f4;return function(_0x22a810){logger['error'](_0x22a810['stack']);if(_0x22a810[_0x4c9d('0x19')]){delete _0x22a810[_0x4c9d('0x19')];}_0x4d2f03['status'](_0x634429)[_0x4c9d('0x1a')](_0x22a810);};}exports[_0x4c9d('0x1b')]=function(_0x267904,_0x45b16f){var _0x8698c5={};var _0x960d2f=_[_0x4c9d('0x1c')](db[_0x4c9d('0x1d')][_0x4c9d('0x1e')],function(_0x2c0027){return{'name':_0x2c0027[_0x4c9d('0x1f')],'type':_0x2c0027['type']['key']};});_0x8698c5=qs['getOptions'](_0x960d2f,_0x267904);return interaction[_0x4c9d('0x20')](_0x4c9d('0x21'),_0x267904[_0x4c9d('0x22')],_0x267904[_0x4c9d('0x23')],_0x8698c5,_0x960d2f)['then'](respondWithFilteredResult(_0x45b16f,_0x8698c5))[_0x4c9d('0x24')](handleError(_0x45b16f,null));};exports[_0x4c9d('0x25')]=function(_0x5c6f11,_0x273901){var _0x7dc19d={'raw':![],'where':{'id':_0x5c6f11[_0x4c9d('0x26')]['id']}},_0x1defef={};_0x1defef[_0x4c9d('0x27')]=_[_0x4c9d('0x28')](db[_0x4c9d('0x1d')][_0x4c9d('0x1e')]);_0x1defef[_0x4c9d('0x22')]=_[_0x4c9d('0x28')](_0x5c6f11['query']);_0x1defef[_0x4c9d('0x29')]=_[_0x4c9d('0x2a')](_0x1defef[_0x4c9d('0x27')],_0x1defef[_0x4c9d('0x22')]);_0x7dc19d[_0x4c9d('0x2b')]=_[_0x4c9d('0x2a')](_0x1defef[_0x4c9d('0x27')],qs[_0x4c9d('0x2c')](_0x5c6f11[_0x4c9d('0x22')][_0x4c9d('0x2c')]));_0x7dc19d['attributes']=_0x7dc19d[_0x4c9d('0x2b')][_0x4c9d('0x2d')]?_0x7dc19d[_0x4c9d('0x2b')]:_0x1defef[_0x4c9d('0x27')];if(_0x5c6f11[_0x4c9d('0x22')][_0x4c9d('0x2e')]){_0x7dc19d[_0x4c9d('0x2f')]=[{'all':!![]}];}_0x7dc19d=_['merge']({},_0x7dc19d,_0x5c6f11[_0x4c9d('0x30')]);return db[_0x4c9d('0x1d')]['find'](_0x7dc19d)[_0x4c9d('0x17')](handleEntityNotFound(_0x273901,null))[_0x4c9d('0x17')](respondWithResult(_0x273901,null))[_0x4c9d('0x24')](handleError(_0x273901,null));};exports[_0x4c9d('0x31')]=function(_0x36192c,_0x2532d7){return db['FaxInteraction'][_0x4c9d('0x31')](_0x36192c[_0x4c9d('0x32')],{})['then'](respondWithResult(_0x2532d7,0xc9))[_0x4c9d('0x24')](handleError(_0x2532d7,null));};exports[_0x4c9d('0x16')]=function(_0x1ab7a2,_0x4a4dff){if(_0x1ab7a2['body']['id']){delete _0x1ab7a2['body']['id'];}return db['FaxInteraction'][_0x4c9d('0x33')]({'where':{'id':_0x1ab7a2[_0x4c9d('0x26')]['id']}})[_0x4c9d('0x17')](handleEntityNotFound(_0x4a4dff,null))[_0x4c9d('0x17')](saveUpdates(_0x1ab7a2[_0x4c9d('0x32')],null))[_0x4c9d('0x17')](respondWithResult(_0x4a4dff,null))[_0x4c9d('0x24')](handleError(_0x4a4dff,null));};exports['destroy']=function(_0x2e6bcf,_0x18dd6c){return db[_0x4c9d('0x1d')][_0x4c9d('0x33')]({'where':{'id':_0x2e6bcf[_0x4c9d('0x26')]['id']}})[_0x4c9d('0x17')](handleEntityNotFound(_0x18dd6c,null))['then'](removeEntity(_0x18dd6c,null))[_0x4c9d('0x24')](handleError(_0x18dd6c,null));};exports[_0x4c9d('0x34')]=function(_0x235abe,_0x5916a1){return db[_0x4c9d('0x1d')][_0x4c9d('0x34')]()[_0x4c9d('0x17')](respondWithResult(_0x5916a1,null))[_0x4c9d('0x24')](handleError(_0x5916a1,null));};exports[_0x4c9d('0x35')]=function(_0x375c01,_0x1d1764){return db[_0x4c9d('0x36')][_0x4c9d('0x33')]({'where':{'id':_0x375c01[_0x4c9d('0x26')]['id']}})[_0x4c9d('0x17')](handleEntityNotFound(_0x1d1764,null))[_0x4c9d('0x17')](function(_0x3cfaf4){if(_0x3cfaf4){return _0x3cfaf4['addMessage'](_0x375c01[_0x4c9d('0x32')][_0x4c9d('0x37')],_[_0x4c9d('0x38')](_0x375c01[_0x4c9d('0x32')],['ids','id'])||{});}})['then'](respondWithResult(_0x1d1764,null))[_0x4c9d('0x24')](handleError(_0x1d1764,null));};exports[_0x4c9d('0x39')]=function(_0x584a37,_0x351362){var _0x2b7704={'raw':![],'where':{}};var _0x1a2ad6={};var _0x5671c5={'count':0x0,'rows':[]};return db[_0x4c9d('0x1d')]['findOne']({'where':{'id':_0x584a37['params']['id']}})['then'](handleEntityNotFound(_0x351362,null))['then'](function(_0xa63956){if(_0xa63956){_0x1a2ad6[_0x4c9d('0x27')]=_['keys'](db[_0x4c9d('0x36')]['rawAttributes']);_0x1a2ad6[_0x4c9d('0x22')]=_[_0x4c9d('0x28')](_0x584a37[_0x4c9d('0x22')]);_0x1a2ad6['filters']=_[_0x4c9d('0x2a')](_0x1a2ad6[_0x4c9d('0x27')],_0x1a2ad6[_0x4c9d('0x22')]);_0x2b7704[_0x4c9d('0x2b')]=_['intersection'](_0x1a2ad6[_0x4c9d('0x27')],qs[_0x4c9d('0x2c')](_0x584a37[_0x4c9d('0x22')]['fields']));_0x2b7704[_0x4c9d('0x2b')]=_0x2b7704[_0x4c9d('0x2b')][_0x4c9d('0x2d')]?_0x2b7704['attributes']:_0x1a2ad6[_0x4c9d('0x27')];if(!_0x584a37[_0x4c9d('0x22')][_0x4c9d('0x3a')](_0x4c9d('0x3b'))){_0x2b7704[_0x4c9d('0x12')]=qs['limit'](_0x584a37[_0x4c9d('0x22')][_0x4c9d('0x12')]);_0x2b7704[_0x4c9d('0x10')]=qs[_0x4c9d('0x10')](_0x584a37[_0x4c9d('0x22')][_0x4c9d('0x10')]);}_0x2b7704['order']=qs['sort'](_0x584a37[_0x4c9d('0x22')][_0x4c9d('0x3c')]);_0x2b7704[_0x4c9d('0x3d')]=qs['filters'](_['pick'](_0x584a37[_0x4c9d('0x22')],_0x1a2ad6[_0x4c9d('0x29')]));_0x2b7704[_0x4c9d('0x3d')][_0x4c9d('0x3e')]=_0xa63956['id'];if(_0x584a37[_0x4c9d('0x22')][_0x4c9d('0x3f')]){_0x2b7704[_0x4c9d('0x3d')]=_['merge'](_0x2b7704[_0x4c9d('0x3d')],{'$or':_[_0x4c9d('0x1c')](_0x2b7704[_0x4c9d('0x2b')],function(_0x28bdbe){var _0xd47377={};_0xd47377[_0x28bdbe]={'$like':'%'+_0x584a37[_0x4c9d('0x22')]['filter']+'%'};return _0xd47377;})});}if(_0x584a37[_0x4c9d('0x22')][_0x4c9d('0x40')]){var _0x135604=_0x584a37[_0x4c9d('0x22')]['$gte'][_0x4c9d('0x41')](',');var _0x5afd98={};_0x5afd98[_0x135604[0x0]]={'$gte':moment(_0x135604[0x1])[_0x4c9d('0x42')](_0x4c9d('0x43'))};_0x2b7704[_0x4c9d('0x3d')]=_[_0x4c9d('0x44')](_0x2b7704[_0x4c9d('0x3d')],_0x5afd98);}_0x2b7704=_[_0x4c9d('0x44')]({},_0x2b7704,_0x584a37[_0x4c9d('0x30')]);return db[_0x4c9d('0x36')][_0x4c9d('0x13')]({'where':_0x2b7704[_0x4c9d('0x3d')]})[_0x4c9d('0x17')](function(_0x3e8ff1){_0x5671c5[_0x4c9d('0x13')]=_0x3e8ff1;if(_0x584a37[_0x4c9d('0x22')][_0x4c9d('0x2e')]){_0x2b7704[_0x4c9d('0x2f')]=[{'all':!![]}];}return db[_0x4c9d('0x36')][_0x4c9d('0x20')](_0x2b7704);})[_0x4c9d('0x17')](function(_0x27d0f4){_0x5671c5[_0x4c9d('0x45')]=_0x27d0f4;return _0x5671c5;});}})[_0x4c9d('0x17')](respondWithFilteredResult(_0x351362,_0x2b7704))['catch'](handleError(_0x351362,null));};exports[_0x4c9d('0x46')]=function(_0x413b75,_0x576009){return db[_0x4c9d('0x1d')]['find']({'where':{'id':_0x413b75[_0x4c9d('0x26')]['id']}})[_0x4c9d('0x17')](handleEntityNotFound(_0x576009,null))[_0x4c9d('0x17')](function(_0x4d39cf){if(_0x4d39cf){return _0x4d39cf[_0x4c9d('0x47')](_0x413b75[_0x4c9d('0x32')][_0x4c9d('0x37')],_['omit'](_0x413b75[_0x4c9d('0x32')],[_0x4c9d('0x37'),'id'])||{})['spread'](function(){return db[_0x4c9d('0x48')][_0x4c9d('0x20')]({'attributes':['id',_0x4c9d('0x19'),_0x4c9d('0x49')],'where':{'id':_0x413b75[_0x4c9d('0x32')]['ids']}});})[_0x4c9d('0x17')](function(_0x2ae99d){socket[_0x4c9d('0x4a')](_0x4c9d('0x4b'),{'id':Number(_0x413b75[_0x4c9d('0x26')]['id']),'tags':_0x2ae99d||[]});return{'id':Number(_0x413b75[_0x4c9d('0x26')]['id']),'tags':_0x2ae99d||[]};});}})[_0x4c9d('0x17')](respondWithResult(_0x576009,null))['catch'](handleError(_0x576009,null));};exports[_0x4c9d('0x4c')]=function(_0x280808,_0x864286){return db[_0x4c9d('0x1d')][_0x4c9d('0x33')]({'where':{'id':_0x280808[_0x4c9d('0x26')]['id']}})[_0x4c9d('0x17')](handleEntityNotFound(_0x864286,null))[_0x4c9d('0x17')](function(_0xcf91f){if(_0xcf91f){return _0xcf91f[_0x4c9d('0x4c')](_0x280808['query'][_0x4c9d('0x37')]);}})[_0x4c9d('0x17')](respondWithStatusCode(_0x864286,null))[_0x4c9d('0x24')](handleError(_0x864286,null));};exports[_0x4c9d('0x4d')]=function(_0x2dca9b,_0x24c892){var _0x275ee5=moment()['unix']()[_0x4c9d('0x4e')]();var _0x4efff4=path[_0x4c9d('0x4f')](config[_0x4c9d('0x50')],_0x4c9d('0x51'),'files',_0x4c9d('0x52'));var _0x47592b=path['join'](config['root'],'server',_0x4c9d('0x53'),'attachments');var _0x37a740=path['join'](_0x4efff4,_0x275ee5);var _0x38dc9a=util[_0x4c9d('0x42')](_0x4c9d('0x54'),_0x2dca9b[_0x4c9d('0x26')]['id'],_0x275ee5);var _0x47e2ea=path[_0x4c9d('0x4f')](_0x4efff4,_0x38dc9a);var _0x2c2990=[];_0x2c2990[_0x4c9d('0x55')]({'model':db[_0x4c9d('0x56')],'as':_0x4c9d('0x56'),'raw':!![]});var _0x3dce41=[{'model':db[_0x4c9d('0x36')],'as':_0x4c9d('0x57'),'attributes':['id',_0x4c9d('0x32'),_0x4c9d('0x58')],'include':_0x2c2990}];return db['FaxInteraction']['find']({'where':{'id':_0x2dca9b[_0x4c9d('0x26')]['id']},'include':_0x3dce41})['then'](handleEntityNotFound(_0x24c892,null))['then'](function(_0x439851){if(_0x439851&&_0x439851[_0x4c9d('0x57')]){var _0x575847=_0x439851[_0x4c9d('0x59')]({'plain':!![]});fs[_0x4c9d('0x5a')](_0x37a740);for(var _0x1a6e90=0x0;_0x1a6e90<_0x575847[_0x4c9d('0x57')][_0x4c9d('0x2d')];_0x1a6e90++){var _0x1e81f1=_0x575847[_0x4c9d('0x57')][_0x1a6e90]['Attachment'];if(_0x1e81f1){var _0x371e0c=path['join'](_0x47592b,_0x1e81f1['basename']);if(fs['existsSync'](_0x371e0c)){fs[_0x4c9d('0x5b')](_0x371e0c)[_0x4c9d('0x5c')](fs['createWriteStream'](path[_0x4c9d('0x4f')](_0x37a740,_0x1e81f1[_0x4c9d('0x5d')])));}}}return BPromise[_0x4c9d('0x5e')]()['then'](function(){return new BPromise(function(_0xa12c63,_0x31b38a){zipdir(_0x37a740,{'saveTo':_0x47e2ea},function(_0x52f729,_0x477033){if(_0x52f729)return _0x31b38a(_0x52f729);return _0xa12c63(_0x477033);});})['then'](function(){return new BPromise(function(_0x1c38b9,_0x22c24f){rimraf(_0x37a740,function(_0x35afd0){if(_0x35afd0)_0x22c24f(_0x35afd0);return _0x1c38b9();});});})[_0x4c9d('0x17')](function(){return _0x24c892[_0x4c9d('0x4d')](_0x47e2ea,_0x38dc9a,function(_0x14b39b){if(_0x14b39b){console[_0x4c9d('0x5f')](_0x4c9d('0x60'),_0x14b39b);}else{fs[_0x4c9d('0x61')](_0x47e2ea);}});});});}else{return _0x24c892[_0x4c9d('0xc')](0xc8);}})[_0x4c9d('0x24')](handleError(_0x24c892,null));}; \ No newline at end of file +var _0xfe31=['nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','count','findAll','rows','addTags','setTags','omit','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','createReadStream','pipe','basename','resolve','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','then','error','stack','name','send','index','map','FaxInteraction','rawAttributes','type','getOptions','query','user','show','params','model','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','destroy','describe','FaxMessage','addMessage','ids','getMessages','findOne','keys','hasOwnProperty'];(function(_0x5327c1,_0xd44ccf){var _0x24b11b=function(_0x52c3a5){while(--_0x52c3a5){_0x5327c1['push'](_0x5327c1['shift']());}};_0x24b11b(++_0xd44ccf);}(_0xfe31,0x164));var _0x1fe3=function(_0x505ce0,_0x2dedbf){_0x505ce0=_0x505ce0-0x0;var _0x268528=_0xfe31[_0x505ce0];return _0x268528;};'use strict';var rimraf=require(_0x1fe3('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1fe3('0x1'));var BPromise=require(_0x1fe3('0x2'));var util=require(_0x1fe3('0x3'));var path=require(_0x1fe3('0x4'));var fs=require('fs');var _=require(_0x1fe3('0x5'));var Redis=require(_0x1fe3('0x6'));var interaction=require(_0x1fe3('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x1fe3('0x8'))(_0x1fe3('0x9'));var config=require('../../config/environment');var db=require(_0x1fe3('0xa'))['db'];config[_0x1fe3('0xb')]=_[_0x1fe3('0xc')](config[_0x1fe3('0xb')],{'host':_0x1fe3('0xd'),'port':0x18eb});var socket=require(_0x1fe3('0xe'))(new Redis(config['redis']));require(_0x1fe3('0xf'))[_0x1fe3('0x10')](socket);function respondWithStatusCode(_0x52d256,_0xb088ec){_0xb088ec=_0xb088ec||0xcc;return function(_0x587d2c){if(_0x587d2c){return _0x52d256[_0x1fe3('0x11')](_0xb088ec);}return _0x52d256[_0x1fe3('0x12')](_0xb088ec)[_0x1fe3('0x13')]();};}function respondWithResult(_0x2df20d,_0x122bcc){_0x122bcc=_0x122bcc||0xc8;return function(_0x41088e){if(_0x41088e){return _0x2df20d[_0x1fe3('0x12')](_0x122bcc)['json'](_0x41088e);}};}function respondWithFilteredResult(_0x1d1858,_0x1aaa33){return function(_0x207663){if(_0x207663){var _0x79fb96=typeof _0x1aaa33[_0x1fe3('0x14')]===_0x1fe3('0x15')&&typeof _0x1aaa33[_0x1fe3('0x16')]==='undefined';var _0x82082f=_0x207663['count'];var _0x519d6a=_0x79fb96?0x0:_0x1aaa33['offset'];var _0x1d8d4c=_0x79fb96?_0x207663['count']:_0x1aaa33[_0x1fe3('0x14')]+_0x1aaa33[_0x1fe3('0x16')];var _0x29902b;if(_0x1d8d4c>=_0x82082f){_0x1d8d4c=_0x82082f;_0x29902b=0xc8;}else{_0x29902b=0xce;}_0x1d1858['status'](_0x29902b);return _0x1d1858[_0x1fe3('0x17')](_0x1fe3('0x18'),_0x519d6a+'-'+_0x1d8d4c+'/'+_0x82082f)['json'](_0x207663);}return null;};}function saveUpdates(_0x338704){return function(_0x59a84d){if(_0x59a84d){return _0x59a84d['update'](_0x338704)['then'](function(_0x58b847){return _0x58b847;});}return null;};}function removeEntity(_0x1c028c){return function(_0x74d1e1){if(_0x74d1e1){return _0x74d1e1['destroy']()[_0x1fe3('0x19')](function(){_0x1c028c['status'](0xcc)[_0x1fe3('0x13')]();});}};}function handleEntityNotFound(_0x10eb2e){return function(_0x3e5b06){if(!_0x3e5b06){_0x10eb2e[_0x1fe3('0x11')](0x194);}return _0x3e5b06;};}function handleError(_0x3d3e87,_0x330c06){_0x330c06=_0x330c06||0x1f4;return function(_0x3266fc){logger[_0x1fe3('0x1a')](_0x3266fc[_0x1fe3('0x1b')]);if(_0x3266fc['name']){delete _0x3266fc[_0x1fe3('0x1c')];}_0x3d3e87[_0x1fe3('0x12')](_0x330c06)[_0x1fe3('0x1d')](_0x3266fc);};}exports[_0x1fe3('0x1e')]=function(_0x382847,_0x516235){var _0x26d0f5={};var _0xa7f917=_[_0x1fe3('0x1f')](db[_0x1fe3('0x20')][_0x1fe3('0x21')],function(_0x1730ec){return{'name':_0x1730ec['fieldName'],'type':_0x1730ec[_0x1fe3('0x22')]['key']};});_0x26d0f5=qs[_0x1fe3('0x23')](_0xa7f917,_0x382847);return interaction['findAll']('fax',_0x382847[_0x1fe3('0x24')],_0x382847[_0x1fe3('0x25')],_0x26d0f5,_0xa7f917)['then'](respondWithFilteredResult(_0x516235,_0x26d0f5))['catch'](handleError(_0x516235,null));};exports[_0x1fe3('0x26')]=function(_0x229726,_0x39c5d8){var _0x1efead={'raw':![],'where':{'id':_0x229726[_0x1fe3('0x27')]['id']}},_0x2b7554={};_0x2b7554[_0x1fe3('0x28')]=_['keys'](db[_0x1fe3('0x20')]['rawAttributes']);_0x2b7554[_0x1fe3('0x24')]=_['keys'](_0x229726[_0x1fe3('0x24')]);_0x2b7554[_0x1fe3('0x29')]=_[_0x1fe3('0x2a')](_0x2b7554[_0x1fe3('0x28')],_0x2b7554['query']);_0x1efead[_0x1fe3('0x2b')]=_[_0x1fe3('0x2a')](_0x2b7554['model'],qs['fields'](_0x229726[_0x1fe3('0x24')][_0x1fe3('0x2c')]));_0x1efead[_0x1fe3('0x2b')]=_0x1efead[_0x1fe3('0x2b')][_0x1fe3('0x2d')]?_0x1efead[_0x1fe3('0x2b')]:_0x2b7554[_0x1fe3('0x28')];if(_0x229726[_0x1fe3('0x24')][_0x1fe3('0x2e')]){_0x1efead[_0x1fe3('0x2f')]=[{'all':!![]}];}_0x1efead=_[_0x1fe3('0x30')]({},_0x1efead,_0x229726[_0x1fe3('0x31')]);return db['FaxInteraction'][_0x1fe3('0x32')](_0x1efead)[_0x1fe3('0x19')](handleEntityNotFound(_0x39c5d8,null))[_0x1fe3('0x19')](respondWithResult(_0x39c5d8,null))[_0x1fe3('0x33')](handleError(_0x39c5d8,null));};exports[_0x1fe3('0x34')]=function(_0x365eee,_0x45fb75){return db[_0x1fe3('0x20')][_0x1fe3('0x34')](_0x365eee[_0x1fe3('0x35')],{})['then'](respondWithResult(_0x45fb75,0xc9))['catch'](handleError(_0x45fb75,null));};exports[_0x1fe3('0x36')]=function(_0x2dd1ba,_0x1fecb6){if(_0x2dd1ba[_0x1fe3('0x35')]['id']){delete _0x2dd1ba['body']['id'];}return db[_0x1fe3('0x20')][_0x1fe3('0x32')]({'where':{'id':_0x2dd1ba[_0x1fe3('0x27')]['id']}})[_0x1fe3('0x19')](handleEntityNotFound(_0x1fecb6,null))[_0x1fe3('0x19')](saveUpdates(_0x2dd1ba[_0x1fe3('0x35')],null))[_0x1fe3('0x19')](respondWithResult(_0x1fecb6,null))[_0x1fe3('0x33')](handleError(_0x1fecb6,null));};exports[_0x1fe3('0x37')]=function(_0x2c97d4,_0x4abeee){return db[_0x1fe3('0x20')][_0x1fe3('0x32')]({'where':{'id':_0x2c97d4[_0x1fe3('0x27')]['id']}})[_0x1fe3('0x19')](handleEntityNotFound(_0x4abeee,null))['then'](removeEntity(_0x4abeee,null))[_0x1fe3('0x33')](handleError(_0x4abeee,null));};exports[_0x1fe3('0x38')]=function(_0x4d31b9,_0x1622c4){return db[_0x1fe3('0x20')][_0x1fe3('0x38')]()['then'](respondWithResult(_0x1622c4,null))[_0x1fe3('0x33')](handleError(_0x1622c4,null));};exports['addMessage']=function(_0x1e8cce,_0xa15313){return db[_0x1fe3('0x39')]['find']({'where':{'id':_0x1e8cce[_0x1fe3('0x27')]['id']}})[_0x1fe3('0x19')](handleEntityNotFound(_0xa15313,null))[_0x1fe3('0x19')](function(_0x5356b6){if(_0x5356b6){return _0x5356b6[_0x1fe3('0x3a')](_0x1e8cce['body']['ids'],_['omit'](_0x1e8cce[_0x1fe3('0x35')],[_0x1fe3('0x3b'),'id'])||{});}})[_0x1fe3('0x19')](respondWithResult(_0xa15313,null))['catch'](handleError(_0xa15313,null));};exports[_0x1fe3('0x3c')]=function(_0x3c98e8,_0x1d0e4e){var _0x3ab375={'raw':![],'where':{}};var _0x5605f1={};var _0x33551c={'count':0x0,'rows':[]};return db[_0x1fe3('0x20')][_0x1fe3('0x3d')]({'where':{'id':_0x3c98e8[_0x1fe3('0x27')]['id']}})['then'](handleEntityNotFound(_0x1d0e4e,null))[_0x1fe3('0x19')](function(_0x27479d){if(_0x27479d){_0x5605f1[_0x1fe3('0x28')]=_[_0x1fe3('0x3e')](db[_0x1fe3('0x39')][_0x1fe3('0x21')]);_0x5605f1[_0x1fe3('0x24')]=_[_0x1fe3('0x3e')](_0x3c98e8[_0x1fe3('0x24')]);_0x5605f1['filters']=_['intersection'](_0x5605f1[_0x1fe3('0x28')],_0x5605f1[_0x1fe3('0x24')]);_0x3ab375[_0x1fe3('0x2b')]=_[_0x1fe3('0x2a')](_0x5605f1[_0x1fe3('0x28')],qs[_0x1fe3('0x2c')](_0x3c98e8['query'][_0x1fe3('0x2c')]));_0x3ab375[_0x1fe3('0x2b')]=_0x3ab375[_0x1fe3('0x2b')][_0x1fe3('0x2d')]?_0x3ab375[_0x1fe3('0x2b')]:_0x5605f1[_0x1fe3('0x28')];if(!_0x3c98e8[_0x1fe3('0x24')][_0x1fe3('0x3f')](_0x1fe3('0x40'))){_0x3ab375[_0x1fe3('0x16')]=qs[_0x1fe3('0x16')](_0x3c98e8[_0x1fe3('0x24')][_0x1fe3('0x16')]);_0x3ab375[_0x1fe3('0x14')]=qs['offset'](_0x3c98e8['query'][_0x1fe3('0x14')]);}_0x3ab375[_0x1fe3('0x41')]=qs[_0x1fe3('0x42')](_0x3c98e8[_0x1fe3('0x24')][_0x1fe3('0x42')]);_0x3ab375[_0x1fe3('0x43')]=qs[_0x1fe3('0x29')](_['pick'](_0x3c98e8[_0x1fe3('0x24')],_0x5605f1['filters']));_0x3ab375[_0x1fe3('0x43')][_0x1fe3('0x44')]=_0x27479d['id'];if(_0x3c98e8['query']['filter']){_0x3ab375[_0x1fe3('0x43')]=_[_0x1fe3('0x30')](_0x3ab375[_0x1fe3('0x43')],{'$or':_[_0x1fe3('0x1f')](_0x3ab375[_0x1fe3('0x2b')],function(_0x555cdc){var _0x57ada7={};_0x57ada7[_0x555cdc]={'$like':'%'+_0x3c98e8[_0x1fe3('0x24')][_0x1fe3('0x45')]+'%'};return _0x57ada7;})});}if(_0x3c98e8[_0x1fe3('0x24')][_0x1fe3('0x46')]){var _0x12c70e=_0x3c98e8[_0x1fe3('0x24')]['$gte'][_0x1fe3('0x47')](',');var _0xc0e4be={};_0xc0e4be[_0x12c70e[0x0]]={'$gte':moment(_0x12c70e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3ab375[_0x1fe3('0x43')]=_[_0x1fe3('0x30')](_0x3ab375['where'],_0xc0e4be);}_0x3ab375=_[_0x1fe3('0x30')]({},_0x3ab375,_0x3c98e8[_0x1fe3('0x31')]);return db['FaxMessage']['count']({'where':_0x3ab375[_0x1fe3('0x43')]})[_0x1fe3('0x19')](function(_0x19aa98){_0x33551c[_0x1fe3('0x48')]=_0x19aa98;if(_0x3c98e8[_0x1fe3('0x24')][_0x1fe3('0x2e')]){_0x3ab375[_0x1fe3('0x2f')]=[{'all':!![]}];}return db['FaxMessage'][_0x1fe3('0x49')](_0x3ab375);})[_0x1fe3('0x19')](function(_0x48ca0e){_0x33551c[_0x1fe3('0x4a')]=_0x48ca0e;return _0x33551c;});}})[_0x1fe3('0x19')](respondWithFilteredResult(_0x1d0e4e,_0x3ab375))['catch'](handleError(_0x1d0e4e,null));};exports[_0x1fe3('0x4b')]=function(_0x5682a9,_0x36e558){return db[_0x1fe3('0x20')][_0x1fe3('0x32')]({'where':{'id':_0x5682a9[_0x1fe3('0x27')]['id']}})[_0x1fe3('0x19')](handleEntityNotFound(_0x36e558,null))[_0x1fe3('0x19')](function(_0x530c6f){if(_0x530c6f){return _0x530c6f[_0x1fe3('0x4c')](_0x5682a9[_0x1fe3('0x35')][_0x1fe3('0x3b')],_[_0x1fe3('0x4d')](_0x5682a9[_0x1fe3('0x35')],[_0x1fe3('0x3b'),'id'])||{})['spread'](function(){return db[_0x1fe3('0x4e')][_0x1fe3('0x49')]({'attributes':['id',_0x1fe3('0x1c'),_0x1fe3('0x4f')],'where':{'id':_0x5682a9[_0x1fe3('0x35')][_0x1fe3('0x3b')]}});})[_0x1fe3('0x19')](function(_0x40b3aa){socket[_0x1fe3('0x50')](_0x1fe3('0x51'),{'id':Number(_0x5682a9['params']['id']),'tags':_0x40b3aa||[]});return{'id':Number(_0x5682a9[_0x1fe3('0x27')]['id']),'tags':_0x40b3aa||[]};});}})[_0x1fe3('0x19')](respondWithResult(_0x36e558,null))[_0x1fe3('0x33')](handleError(_0x36e558,null));};exports[_0x1fe3('0x52')]=function(_0x5f4cea,_0x7eff24){return db[_0x1fe3('0x20')][_0x1fe3('0x32')]({'where':{'id':_0x5f4cea[_0x1fe3('0x27')]['id']}})[_0x1fe3('0x19')](handleEntityNotFound(_0x7eff24,null))[_0x1fe3('0x19')](function(_0x50a0be){if(_0x50a0be){return _0x50a0be[_0x1fe3('0x52')](_0x5f4cea[_0x1fe3('0x24')][_0x1fe3('0x3b')]);}})['then'](respondWithStatusCode(_0x7eff24,null))[_0x1fe3('0x33')](handleError(_0x7eff24,null));};exports[_0x1fe3('0x53')]=function(_0x223013,_0x33cffb){var _0x1cccfa=moment()[_0x1fe3('0x54')]()['toString']();var _0x4b8c8e=path[_0x1fe3('0x55')](config[_0x1fe3('0x56')],_0x1fe3('0x57'),_0x1fe3('0x58'),_0x1fe3('0x59'));var _0x4d90d6=path[_0x1fe3('0x55')](config[_0x1fe3('0x56')],_0x1fe3('0x57'),_0x1fe3('0x58'),_0x1fe3('0x5a'));var _0x29eb06=path[_0x1fe3('0x55')](_0x4b8c8e,_0x1cccfa);var _0x41eba9=util['format'](_0x1fe3('0x5b'),_0x223013['params']['id'],_0x1cccfa);var _0x402300=path[_0x1fe3('0x55')](_0x4b8c8e,_0x41eba9);var _0x36f141=[];_0x36f141[_0x1fe3('0x5c')]({'model':db[_0x1fe3('0x5d')],'as':_0x1fe3('0x5d'),'raw':!![]});var _0x1a893f=[{'model':db[_0x1fe3('0x39')],'as':_0x1fe3('0x5e'),'attributes':['id',_0x1fe3('0x35'),_0x1fe3('0x5f')],'include':_0x36f141}];return db['FaxInteraction']['find']({'where':{'id':_0x223013[_0x1fe3('0x27')]['id']},'include':_0x1a893f})[_0x1fe3('0x19')](handleEntityNotFound(_0x33cffb,null))[_0x1fe3('0x19')](function(_0x23a59e){if(_0x23a59e&&_0x23a59e['Messages']){var _0x4308cf=_0x23a59e[_0x1fe3('0x60')]({'plain':!![]});fs[_0x1fe3('0x61')](_0x29eb06);for(var _0x5adcf4=0x0;_0x5adcf4<_0x4308cf['Messages']['length'];_0x5adcf4++){var _0x4f1cec=_0x4308cf[_0x1fe3('0x5e')][_0x5adcf4][_0x1fe3('0x5d')];if(_0x4f1cec){var _0xa66b71=path[_0x1fe3('0x55')](_0x4d90d6,_0x4f1cec['basename']);if(fs['existsSync'](_0xa66b71)){fs[_0x1fe3('0x62')](_0xa66b71)[_0x1fe3('0x63')](fs['createWriteStream'](path['join'](_0x29eb06,_0x4f1cec[_0x1fe3('0x64')])));}}}return BPromise[_0x1fe3('0x65')]()[_0x1fe3('0x19')](function(){return new BPromise(function(_0x5f21db,_0x582b44){zipdir(_0x29eb06,{'saveTo':_0x402300},function(_0x556f52,_0x5a1639){if(_0x556f52)return _0x582b44(_0x556f52);return _0x5f21db(_0x5a1639);});})[_0x1fe3('0x19')](function(){return new BPromise(function(_0x4dacde,_0x1478f0){rimraf(_0x29eb06,function(_0x55f9d4){if(_0x55f9d4)_0x1478f0(_0x55f9d4);return _0x4dacde();});});})['then'](function(){return _0x33cffb[_0x1fe3('0x53')](_0x402300,_0x41eba9,function(_0x4298ba){if(_0x4298ba){console[_0x1fe3('0x66')](_0x1fe3('0x67'),_0x4298ba);}else{fs[_0x1fe3('0x68')](_0x402300);}});});});}else{return _0x33cffb['sendStatus'](0xc8);}})[_0x1fe3('0x33')](handleError(_0x33cffb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 95555fa..77efc69 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 _0x8f47=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','catch','hasOwnProperty','hook','events'];(function(_0x9d93d1,_0x21e0c6){var _0x67fa0=function(_0x4e098d){while(--_0x4e098d){_0x9d93d1['push'](_0x9d93d1['shift']());}};_0x67fa0(++_0x21e0c6);}(_0x8f47,0x141));var _0x78f4=function(_0x25bd0c,_0x10a934){_0x25bd0c=_0x25bd0c-0x0;var _0x1c8e6e=_0x8f47[_0x25bd0c];return _0x1c8e6e;};'use strict';var EventEmitter=require(_0x78f4('0x0'));var FaxInteraction=require(_0x78f4('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x78f4('0x1'))['db'][_0x78f4('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x78f4('0x3')](0x0);var events={'afterCreate':_0x78f4('0x4'),'afterUpdate':_0x78f4('0x5'),'afterDestroy':_0x78f4('0x6')};function emitEvent(_0x207154){return function(_0x2094c0,_0x541492,_0x4328be){_0x2094c0[_0x78f4('0x7')]({'attributes':['id'],'raw':!![]})[_0x78f4('0x8')](function(_0x3482a8){_0x2094c0[_0x78f4('0x9')]('Users',_0x3482a8['map'](function(_0x490c7b){return{'id':_0x490c7b['id']};}));return FaxMessage[_0x78f4('0xa')]({'where':{'FaxInteractionId':_0x2094c0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x78f4('0x8')](function(_0x1125b8){_0x2094c0[_0x78f4('0x9')]('unreadMessages',_0x1125b8['length']);FaxInteractionEvents['emit'](_0x207154+':'+_0x2094c0['id'],_0x2094c0);FaxInteractionEvents['emit'](_0x207154,_0x2094c0);_0x4328be(null);})[_0x78f4('0xb')](_0x4328be(null));};}for(var e in events){if(events[_0x78f4('0xc')](e)){var event=events[e];FaxInteraction[_0x78f4('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x06d9=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x2912a4,_0x4a2496){var _0x575068=function(_0x16cdff){while(--_0x16cdff){_0x2912a4['push'](_0x2912a4['shift']());}};_0x575068(++_0x4a2496);}(_0x06d9,0x7a));var _0x906d=function(_0x3ae5b4,_0x14348e){_0x3ae5b4=_0x3ae5b4-0x0;var _0x29d7e5=_0x06d9[_0x3ae5b4];return _0x29d7e5;};'use strict';var EventEmitter=require(_0x906d('0x0'));var FaxInteraction=require(_0x906d('0x1'))['db'][_0x906d('0x2')];var FaxMessage=require(_0x906d('0x1'))['db'][_0x906d('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x906d('0x4')](0x0);var events={'afterCreate':_0x906d('0x5'),'afterUpdate':_0x906d('0x6'),'afterDestroy':_0x906d('0x7')};function emitEvent(_0x4f4f27){return function(_0x48de9f,_0x22ae22,_0x6aa187){_0x48de9f[_0x906d('0x8')]({'attributes':['id'],'raw':!![]})[_0x906d('0x9')](function(_0x186050){_0x48de9f[_0x906d('0xa')]('Users',_0x186050['map'](function(_0x16a954){return{'id':_0x16a954['id']};}));return FaxMessage[_0x906d('0xb')]({'where':{'FaxInteractionId':_0x48de9f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x906d('0x9')](function(_0x2280c2){_0x48de9f[_0x906d('0xa')](_0x906d('0xc'),_0x2280c2[_0x906d('0xd')]);FaxInteractionEvents[_0x906d('0xe')](_0x4f4f27+':'+_0x48de9f['id'],_0x48de9f);FaxInteractionEvents[_0x906d('0xe')](_0x4f4f27,_0x48de9f);_0x6aa187(null);})[_0x906d('0xf')](_0x6aa187(null));};}for(var e in events){if(events[_0x906d('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x906d('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 828d672..43e50ac 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 _0x9627=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed'];(function(_0x219536,_0x8e0b9b){var _0x231e4d=function(_0x37b376){while(--_0x37b376){_0x219536['push'](_0x219536['shift']());}};_0x231e4d(++_0x8e0b9b);}(_0x9627,0x8a));var _0x7962=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9627[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x7962('0x0'));var util=require('util');var logger=require(_0x7962('0x1'))(_0x7962('0x2'));var moment=require(_0x7962('0x3'));var BPromise=require(_0x7962('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7962('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7962('0x6'));module[_0x7962('0x7')]=function(_0x13a5b7,_0x10e060){return _0x13a5b7[_0x7962('0x8')]('FaxInteraction',attributes,{'tableName':_0x7962('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1446d1,_0x27072f,_0x4309c8){if(_0x1446d1[_0x7962('0xa')](_0x7962('0xb'))){_0x1446d1[_0x7962('0xc')]=moment()[_0x7962('0xd')](_0x7962('0xe'));}_0x4309c8(null,_0x1446d1);}}});}; \ No newline at end of file +var _0x27d6=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','path','rimraf'];(function(_0x5639e1,_0x421603){var _0x197e82=function(_0x150da4){while(--_0x150da4){_0x5639e1['push'](_0x5639e1['shift']());}};_0x197e82(++_0x421603);}(_0x27d6,0x14a));var _0x627d=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x27d6[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x627d('0x0'));var util=require(_0x627d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x627d('0x2'));var BPromise=require('bluebird');var rp=require(_0x627d('0x3'));var fs=require('fs');var path=require(_0x627d('0x4'));var rimraf=require(_0x627d('0x5'));var config=require(_0x627d('0x6'));var attributes=require(_0x627d('0x7'));module[_0x627d('0x8')]=function(_0x2fbe1f,_0x586b91){return _0x2fbe1f[_0x627d('0x9')](_0x627d('0xa'),attributes,{'tableName':_0x627d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16e7af,_0x3db293,_0x4ac54c){if(_0x16e7af[_0x627d('0xc')]('closed')){_0x16e7af[_0x627d('0xd')]=moment()[_0x627d('0xe')](_0x627d('0xf'));}_0x4ac54c(null,_0x16e7af);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 09262f9..8aea57c 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 _0xf2ce=['then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxInteraction,\x20%s,\x20%s','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','catch','AddTagsToFaxInteraction','find','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','./faxInteraction.socket','register'];(function(_0x2cfca0,_0x210a08){var _0x293e83=function(_0x46b608){while(--_0x46b608){_0x2cfca0['push'](_0x2cfca0['shift']());}};_0x293e83(++_0x210a08);}(_0xf2ce,0x12a));var _0xef2c=function(_0x2d4979,_0x1011ad){_0x2d4979=_0x2d4979-0x0;var _0x4ce245=_0xf2ce[_0x2d4979];return _0x4ce245;};'use strict';var _=require('lodash');var util=require(_0xef2c('0x0'));var moment=require(_0xef2c('0x1'));var BPromise=require(_0xef2c('0x2'));var rs=require(_0xef2c('0x3'));var fs=require('fs');var Redis=require(_0xef2c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef2c('0x5'));var logger=require(_0xef2c('0x6'))(_0xef2c('0x7'));var config=require(_0xef2c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xef2c('0x9')]({'port':0x232a});config['redis']=_[_0xef2c('0xa')](config[_0xef2c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xef2c('0xc'))[_0xef2c('0xd')](socket);function respondWithRpcPromise(_0x3654bb,_0x5a7c66,_0x56afc4){return new BPromise(function(_0x21bdee,_0x5b1bd4){return client['request'](_0x3654bb,_0x56afc4)[_0xef2c('0xe')](function(_0x44c438){logger[_0xef2c('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x5a7c66,_0xef2c('0x10'));logger['debug'](_0xef2c('0x11'),_0x5a7c66,_0xef2c('0x10'),JSON[_0xef2c('0x12')](_0x44c438));if(_0x44c438['error']){if(_0x44c438[_0xef2c('0x13')]['code']===0x1f4){logger[_0xef2c('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5a7c66,_0x44c438['error'][_0xef2c('0x14')]);return _0x5b1bd4(_0x44c438[_0xef2c('0x13')][_0xef2c('0x14')]);}logger[_0xef2c('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5a7c66,_0x44c438[_0xef2c('0x13')][_0xef2c('0x14')]);return _0x21bdee(_0x44c438[_0xef2c('0x13')][_0xef2c('0x14')]);}else{logger['info'](_0xef2c('0x15'),_0x5a7c66,'request\x20sent');_0x21bdee(_0x44c438[_0xef2c('0x16')][_0xef2c('0x14')]);}})['catch'](function(_0x11f533){logger['error'](_0xef2c('0x15'),_0x5a7c66,_0x11f533);_0x5b1bd4(_0x11f533);});});}exports[_0xef2c('0x17')]=function(_0x3e7395){var _0x24c8fe=this;return new Promise(function(_0x4bdcb4,_0x3c7def){return db[_0xef2c('0x18')][_0xef2c('0x19')](_0x3e7395[_0xef2c('0x1a')],{'raw':_0x3e7395[_0xef2c('0x1b')]?_0x3e7395[_0xef2c('0x1b')][_0xef2c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e7395[_0xef2c('0x1b')]?_0x3e7395[_0xef2c('0x1b')][_0xef2c('0x1d')]||null:null,'attributes':_0x3e7395[_0xef2c('0x1b')]?_0x3e7395['options'][_0xef2c('0x1e')]||null:null,'limit':_0x3e7395[_0xef2c('0x1b')]?_0x3e7395[_0xef2c('0x1b')][_0xef2c('0x1f')]||null:null})[_0xef2c('0xe')](function(_0x220813){logger[_0xef2c('0xf')]('UpdateFaxInteraction',_0x3e7395);logger[_0xef2c('0x20')](_0xef2c('0x17'),_0x3e7395,JSON[_0xef2c('0x12')](_0x220813));_0x4bdcb4(_0x220813);})[_0xef2c('0x21')](function(_0x2567bf){logger[_0xef2c('0x13')](_0xef2c('0x17'),_0x2567bf[_0xef2c('0x14')],_0x3e7395);_0x3c7def(_0x24c8fe[_0xef2c('0x13')](0x1f4,_0x2567bf[_0xef2c('0x14')]));});});};exports[_0xef2c('0x22')]=function(_0x29c78d){return new Promise(function(_0x42c9ef,_0x1b7e56){return db[_0xef2c('0x18')][_0xef2c('0x23')]({'where':_0x29c78d[_0xef2c('0x1b')]?_0x29c78d['options'][_0xef2c('0x1d')]||null:null})[_0xef2c('0xe')](function(_0x39211c){if(_0x39211c){return _0x39211c['addTags'](_0x29c78d[_0xef2c('0x1a')]['ids'],_[_0xef2c('0x24')](_0x29c78d['body'],['ids','id'])||{});}})[_0xef2c('0x25')](function(_0x49680e){logger['info'](_0xef2c('0x26'),_0x29c78d);logger[_0xef2c('0x20')](_0xef2c('0x26'),_0x29c78d,JSON[_0xef2c('0x12')](_0x49680e));_0x42c9ef(_0x49680e);})[_0xef2c('0x21')](function(_0x210ba1){logger[_0xef2c('0x13')]('AddTags',_0x210ba1[_0xef2c('0x14')],_0x29c78d);_0x1b7e56(_this['error'](0x1f4,_0x210ba1[_0xef2c('0x14')]));});});}; \ No newline at end of file +var _0x14be=['../../config/environment','client','http','defaults','redis','localhost','./faxInteraction.socket','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','limit','stringify','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17aee4,_0x3b7f0f){var _0x34b091=function(_0x53435d){while(--_0x53435d){_0x17aee4['push'](_0x17aee4['shift']());}};_0x34b091(++_0x3b7f0f);}(_0x14be,0x70));var _0xe14b=function(_0x53c7e3,_0x4b7c9f){_0x53c7e3=_0x53c7e3-0x0;var _0x2de5d6=_0x14be[_0x53c7e3];return _0x2de5d6;};'use strict';var _=require(_0xe14b('0x0'));var util=require('util');var moment=require(_0xe14b('0x1'));var BPromise=require(_0xe14b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe14b('0x3'));var db=require(_0xe14b('0x4'))['db'];var utils=require(_0xe14b('0x5'));var logger=require(_0xe14b('0x6'))(_0xe14b('0x7'));var config=require(_0xe14b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe14b('0x9')][_0xe14b('0xa')]({'port':0x232a});config['redis']=_[_0xe14b('0xb')](config[_0xe14b('0xc')],{'host':_0xe14b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe14b('0xc')]));require(_0xe14b('0xe'))['register'](socket);function respondWithRpcPromise(_0x6f75e3,_0x52dcaf,_0x47a6b1){return new BPromise(function(_0x17a5bc,_0x3b1f0d){return client[_0xe14b('0xf')](_0x6f75e3,_0x47a6b1)[_0xe14b('0x10')](function(_0x22c940){logger[_0xe14b('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x52dcaf,_0xe14b('0x12'));logger[_0xe14b('0x13')](_0xe14b('0x14'),_0x52dcaf,_0xe14b('0x12'),JSON['stringify'](_0x22c940));if(_0x22c940[_0xe14b('0x15')]){if(_0x22c940[_0xe14b('0x15')][_0xe14b('0x16')]===0x1f4){logger[_0xe14b('0x15')](_0xe14b('0x17'),_0x52dcaf,_0x22c940[_0xe14b('0x15')][_0xe14b('0x18')]);return _0x3b1f0d(_0x22c940[_0xe14b('0x15')]['message']);}logger['error'](_0xe14b('0x17'),_0x52dcaf,_0x22c940['error']['message']);return _0x17a5bc(_0x22c940[_0xe14b('0x15')][_0xe14b('0x18')]);}else{logger['info'](_0xe14b('0x17'),_0x52dcaf,_0xe14b('0x12'));_0x17a5bc(_0x22c940[_0xe14b('0x19')]['message']);}})[_0xe14b('0x1a')](function(_0x13b89c){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x52dcaf,_0x13b89c);_0x3b1f0d(_0x13b89c);});});}exports[_0xe14b('0x1b')]=function(_0x58758){var _0x562182=this;return new Promise(function(_0x550618,_0x50a6be){return db[_0xe14b('0x1c')]['update'](_0x58758[_0xe14b('0x1d')],{'raw':_0x58758[_0xe14b('0x1e')]?_0x58758[_0xe14b('0x1e')][_0xe14b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58758[_0xe14b('0x1e')]?_0x58758['options'][_0xe14b('0x20')]||null:null,'attributes':_0x58758[_0xe14b('0x1e')]?_0x58758[_0xe14b('0x1e')]['attributes']||null:null,'limit':_0x58758[_0xe14b('0x1e')]?_0x58758[_0xe14b('0x1e')][_0xe14b('0x21')]||null:null})[_0xe14b('0x10')](function(_0x27b65d){logger[_0xe14b('0x11')](_0xe14b('0x1b'),_0x58758);logger[_0xe14b('0x13')](_0xe14b('0x1b'),_0x58758,JSON[_0xe14b('0x22')](_0x27b65d));_0x550618(_0x27b65d);})['catch'](function(_0xc7a79e){logger['error'](_0xe14b('0x1b'),_0xc7a79e[_0xe14b('0x18')],_0x58758);_0x50a6be(_0x562182[_0xe14b('0x15')](0x1f4,_0xc7a79e[_0xe14b('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x15d8ac){return new Promise(function(_0x55da78,_0x1892a3){return db['FaxInteraction'][_0xe14b('0x23')]({'where':_0x15d8ac[_0xe14b('0x1e')]?_0x15d8ac['options'][_0xe14b('0x20')]||null:null})[_0xe14b('0x10')](function(_0x383e01){if(_0x383e01){return _0x383e01[_0xe14b('0x24')](_0x15d8ac[_0xe14b('0x1d')][_0xe14b('0x25')],_[_0xe14b('0x26')](_0x15d8ac[_0xe14b('0x1d')],[_0xe14b('0x25'),'id'])||{});}})['spread'](function(_0x59b6d4){logger['info'](_0xe14b('0x27'),_0x15d8ac);logger['debug'](_0xe14b('0x27'),_0x15d8ac,JSON[_0xe14b('0x22')](_0x59b6d4));_0x55da78(_0x59b6d4);})[_0xe14b('0x1a')](function(_0x1f72fb){logger['error']('AddTags',_0x1f72fb[_0xe14b('0x18')],_0x15d8ac);_0x1892a3(_this[_0xe14b('0x15')](0x1f4,_0x1f72fb[_0xe14b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index fd4a38c..679dbc6 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 _0x34df=['save','update','emit','removeListener','register','length','./faxInteraction.events'];(function(_0x247ab8,_0x47cd65){var _0x4a02aa=function(_0x5c4933){while(--_0x5c4933){_0x247ab8['push'](_0x247ab8['shift']());}};_0x4a02aa(++_0x47cd65);}(_0x34df,0x15d));var _0xf34d=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x34df[_0x1678c8];return _0x387aa9;};'use strict';var FaxInteractionEvents=require(_0xf34d('0x0'));var events=[_0xf34d('0x1'),'remove',_0xf34d('0x2')];function createListener(_0x23cc73,_0x1ee703){return function(_0x17803b){_0x1ee703[_0xf34d('0x3')](_0x23cc73,_0x17803b);};}function removeListener(_0xc8d90a,_0x573b5c){return function(){FaxInteractionEvents[_0xf34d('0x4')](_0xc8d90a,_0x573b5c);};}exports[_0xf34d('0x5')]=function(_0x4ab7b5){for(var _0xc46b9f=0x0,_0x26e203=events[_0xf34d('0x6')];_0xc46b9f<_0x26e203;_0xc46b9f++){var _0x20bab0=events[_0xc46b9f];var _0x2e2722=createListener('faxInteraction:'+_0x20bab0,_0x4ab7b5);FaxInteractionEvents['on'](_0x20bab0,_0x2e2722);}}; \ No newline at end of file +var _0xe91e=['update','removeListener','register','length','save','remove'];(function(_0x37e167,_0x199c30){var _0x501687=function(_0x44ebb9){while(--_0x44ebb9){_0x37e167['push'](_0x37e167['shift']());}};_0x501687(++_0x199c30);}(_0xe91e,0x1c0));var _0xee91=function(_0x5178fb,_0x121e19){_0x5178fb=_0x5178fb-0x0;var _0x348183=_0xe91e[_0x5178fb];return _0x348183;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xee91('0x0'),_0xee91('0x1'),_0xee91('0x2')];function createListener(_0x12d041,_0x3b7208){return function(_0x3d539b){_0x3b7208['emit'](_0x12d041,_0x3d539b);};}function removeListener(_0x2b757e,_0xcc9ca5){return function(){FaxInteractionEvents[_0xee91('0x3')](_0x2b757e,_0xcc9ca5);};}exports[_0xee91('0x4')]=function(_0x5e8509){for(var _0x229ff4=0x0,_0x473b18=events[_0xee91('0x5')];_0x229ff4<_0x473b18;_0x229ff4++){var _0x2f4a89=events[_0x229ff4];var _0x32cefc=createListener('faxInteraction:'+_0x2f4a89,_0x5e8509);FaxInteractionEvents['on'](_0x2f4a89,_0x32cefc);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c4ba0bc..ef040fb 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 _0x9ca1=['post','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ca1,0x1cc));var _0x19ca=function(_0x4e6cc2,_0x21f546){_0x4e6cc2=_0x4e6cc2-0x0;var _0x23f9f6=_0x9ca1[_0x4e6cc2];return _0x23f9f6;};'use strict';var multer=require(_0x19ca('0x0'));var util=require(_0x19ca('0x1'));var path=require(_0x19ca('0x2'));var timeout=require(_0x19ca('0x3'));var express=require(_0x19ca('0x4'));var router=express[_0x19ca('0x5')]();var fs_extra=require(_0x19ca('0x6'));var auth=require(_0x19ca('0x7'));var interaction=require(_0x19ca('0x8'));var config=require(_0x19ca('0x9'));var controller=require(_0x19ca('0xa'));router['get']('/',auth[_0x19ca('0xb')](),controller[_0x19ca('0xc')]);router[_0x19ca('0xd')]('/describe',auth[_0x19ca('0xb')](),controller[_0x19ca('0xe')]);router['get'](_0x19ca('0xf'),auth[_0x19ca('0xb')](),controller['show']);router[_0x19ca('0xd')](_0x19ca('0x10'),auth[_0x19ca('0xb')](),controller[_0x19ca('0x11')]);router[_0x19ca('0xd')](_0x19ca('0x12'),auth[_0x19ca('0xb')](),controller[_0x19ca('0x13')]);router[_0x19ca('0x14')]('/',auth[_0x19ca('0xb')](),controller['create']);router[_0x19ca('0x14')]('/:id/messages',auth[_0x19ca('0xb')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x19ca('0xb')](),interaction[_0x19ca('0x15')](_0x19ca('0x16'),_0x19ca('0x17')),controller[_0x19ca('0x18')]);router[_0x19ca('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x19ca('0x15')]('fax',_0x19ca('0x1a')),controller[_0x19ca('0x1b')]);router[_0x19ca('0x1c')](_0x19ca('0xf'),auth[_0x19ca('0xb')](),interaction['tracked']('fax',_0x19ca('0x1d')),controller[_0x19ca('0x1e')]);router[_0x19ca('0x1c')]('/:id/tags',auth[_0x19ca('0xb')](),controller['removeTags']);module[_0x19ca('0x1f')]=router; \ No newline at end of file +var _0x5c34=['connect-timeout','express','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','post','/:id/tags','faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update','delete','faxinteraction:destroy','destroy','multer','util','path'];(function(_0x26ce8e,_0x587330){var _0x37368a=function(_0x431afd){while(--_0x431afd){_0x26ce8e['push'](_0x26ce8e['shift']());}};_0x37368a(++_0x587330);}(_0x5c34,0x129));var _0x45c3=function(_0x210fd8,_0x243d3b){_0x210fd8=_0x210fd8-0x0;var _0x235a17=_0x5c34[_0x210fd8];return _0x235a17;};'use strict';var multer=require(_0x45c3('0x0'));var util=require(_0x45c3('0x1'));var path=require(_0x45c3('0x2'));var timeout=require(_0x45c3('0x3'));var express=require(_0x45c3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x45c3('0x5'));var controller=require('./faxInteraction.controller');router[_0x45c3('0x6')]('/',auth[_0x45c3('0x7')](),controller['index']);router[_0x45c3('0x6')](_0x45c3('0x8'),auth[_0x45c3('0x7')](),controller[_0x45c3('0x9')]);router[_0x45c3('0x6')](_0x45c3('0xa'),auth[_0x45c3('0x7')](),controller[_0x45c3('0xb')]);router[_0x45c3('0x6')](_0x45c3('0xc'),auth[_0x45c3('0x7')](),controller[_0x45c3('0xd')]);router[_0x45c3('0x6')]('/:id/download',auth[_0x45c3('0x7')](),controller['download']);router[_0x45c3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x45c3('0xc'),auth[_0x45c3('0x7')](),controller['addMessage']);router[_0x45c3('0xe')](_0x45c3('0xf'),auth[_0x45c3('0x7')](),interaction['tracked']('fax',_0x45c3('0x10')),controller[_0x45c3('0x11')]);router[_0x45c3('0x12')]('/:id',auth[_0x45c3('0x7')](),interaction[_0x45c3('0x13')](_0x45c3('0x14'),_0x45c3('0x15')),controller['update']);router[_0x45c3('0x16')](_0x45c3('0xa'),auth[_0x45c3('0x7')](),interaction[_0x45c3('0x13')](_0x45c3('0x14'),_0x45c3('0x17')),controller[_0x45c3('0x18')]);router[_0x45c3('0x16')](_0x45c3('0xf'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 9c482e7..40e70c1 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 _0x6108=['medium','BOOLEAN','out','sequelize','TEXT'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x6108,0xbc));var _0x8610=function(_0x12828d,_0x44137e){_0x12828d=_0x12828d-0x0;var _0x43a236=_0x6108[_0x12828d];return _0x43a236;};'use strict';var Sequelize=require(_0x8610('0x0'));module['exports']={'body':{'type':Sequelize[_0x8610('0x1')](_0x8610('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8610('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8610('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8610('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xda65=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x54f180,_0x1c9c4c){var _0x411cdd=function(_0x3c1818){while(--_0x3c1818){_0x54f180['push'](_0x54f180['shift']());}};_0x411cdd(++_0x1c9c4c);}(_0xda65,0x1d0));var _0x5da6=function(_0x386006,_0x152ea0){_0x386006=_0x386006-0x0;var _0x122563=_0xda65[_0x386006];return _0x122563;};'use strict';var Sequelize=require(_0x5da6('0x0'));module[_0x5da6('0x1')]={'body':{'type':Sequelize[_0x5da6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5da6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5da6('0x4')]('in',_0x5da6('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5da6('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 92fb769..ddc1ea5 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 _0x2ae3=['basename','download','server','files','attachments','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','update','body','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','fax-interactions','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','SELECT','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s'];(function(_0x38651d,_0x5ca1bc){var _0x3f4c9b=function(_0x553aa1){while(--_0x553aa1){_0x38651d['push'](_0x38651d['shift']());}};_0x3f4c9b(++_0x5ca1bc);}(_0x2ae3,0x94));var _0x32ae=function(_0x18a5d2,_0x11ded9){_0x18a5d2=_0x18a5d2-0x0;var _0x26e9d8=_0x2ae3[_0x18a5d2];return _0x26e9d8;};'use strict';var emlformat=require(_0x32ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32ae('0x1'));var jsonpatch=require(_0x32ae('0x2'));var rp=require(_0x32ae('0x3'));var moment=require(_0x32ae('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x32ae('0x5'));var path=require('path');var sox=require(_0x32ae('0x6'));var csv=require('to-csv');var ejs=require(_0x32ae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ae('0x8'));var squel=require('squel');var crypto=require(_0x32ae('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x32ae('0xa'));var toCsv=require(_0x32ae('0xb'));var querystring=require(_0x32ae('0xc'));var Papa=require(_0x32ae('0xd'));var Redis=require('ioredis');var authService=require(_0x32ae('0xe'));var qs=require(_0x32ae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x32ae('0x10'));var utils=require(_0x32ae('0x11'));var config=require(_0x32ae('0x12'));var licenseUtil=require(_0x32ae('0x13'));var db=require(_0x32ae('0x14'))['db'];config[_0x32ae('0x15')]=_[_0x32ae('0x16')](config[_0x32ae('0x15')],{'host':_0x32ae('0x17'),'port':0x18eb});var socket=require(_0x32ae('0x18'))(new Redis(config[_0x32ae('0x15')]));require(_0x32ae('0x19'))['register'](socket);var jayson=require(_0x32ae('0x1a'));var client=jayson[_0x32ae('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x32ae('0x1b')][_0x32ae('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x46ca4e,_0x38a8cf,_0x1ca714,_0x223029){return new BPromise(function(_0x51b20f,_0x16f87a){var _0x47b2df=_0x223029||client;return _0x47b2df[_0x32ae('0x1d')](_0x46ca4e,_0x1ca714)[_0x32ae('0x1e')](function(_0x201a4d){logger[_0x32ae('0x1f')](_0x32ae('0x20'),_0x38a8cf,_0x32ae('0x21'));logger[_0x32ae('0x22')](_0x32ae('0x23'),_0x38a8cf,_0x32ae('0x21'),JSON['stringify'](_0x201a4d));if(_0x201a4d['error']){if(_0x201a4d[_0x32ae('0x24')]['code']===0x1f4){logger['error'](_0x32ae('0x20'),_0x38a8cf,_0x201a4d[_0x32ae('0x24')][_0x32ae('0x25')]);return _0x16f87a(_0x201a4d['error'][_0x32ae('0x25')]);}logger[_0x32ae('0x24')](_0x32ae('0x20'),_0x38a8cf,_0x201a4d[_0x32ae('0x24')]['message']);return _0x51b20f(_0x201a4d[_0x32ae('0x24')]['message']);}else{logger[_0x32ae('0x1f')](_0x32ae('0x20'),_0x38a8cf,_0x32ae('0x21'));_0x51b20f(_0x201a4d[_0x32ae('0x26')]['message']);}})[_0x32ae('0x27')](function(_0x56f3b2){logger[_0x32ae('0x24')](_0x32ae('0x20'),_0x38a8cf,_0x56f3b2);_0x16f87a(_0x56f3b2);});});}function respondWithStatusCode(_0x26896f,_0xe678c3){_0xe678c3=_0xe678c3||0xcc;return function(_0x59920b){if(_0x59920b){return _0x26896f[_0x32ae('0x28')](_0xe678c3);}return _0x26896f[_0x32ae('0x29')](_0xe678c3)[_0x32ae('0x2a')]();};}function respondWithResult(_0x3b8530,_0x7596fc){_0x7596fc=_0x7596fc||0xc8;return function(_0x36387a){if(_0x36387a){return _0x3b8530[_0x32ae('0x29')](_0x7596fc)[_0x32ae('0x2b')](_0x36387a);}};}function respondWithFilteredResult(_0x12886f,_0x5b5057){return function(_0x1c7514){if(_0x1c7514){var _0x3e5fc2=typeof _0x5b5057[_0x32ae('0x2c')]===_0x32ae('0x2d')&&typeof _0x5b5057[_0x32ae('0x2e')]==='undefined';var _0x1c6d7a=_0x1c7514['count'];var _0x3fc276=_0x3e5fc2?0x0:_0x5b5057[_0x32ae('0x2c')];var _0x35afac=_0x3e5fc2?_0x1c7514[_0x32ae('0x2f')]:_0x5b5057[_0x32ae('0x2c')]+_0x5b5057[_0x32ae('0x2e')];var _0x11df12;if(_0x35afac>=_0x1c6d7a){_0x35afac=_0x1c6d7a;_0x11df12=0xc8;}else{_0x11df12=0xce;}_0x12886f['status'](_0x11df12);return _0x12886f[_0x32ae('0x30')](_0x32ae('0x31'),_0x3fc276+'-'+_0x35afac+'/'+_0x1c6d7a)[_0x32ae('0x2b')](_0x1c7514);}return null;};}function patchUpdates(_0x358615){return function(_0x3eee2a){try{jsonpatch['apply'](_0x3eee2a,_0x358615,!![]);}catch(_0x597b59){return BPromise[_0x32ae('0x32')](_0x597b59);}return _0x3eee2a[_0x32ae('0x33')]();};}function saveUpdates(_0x1cc7e7,_0x3f0187){return function(_0x1618e7){if(_0x1618e7){return _0x1618e7['update'](_0x1cc7e7)[_0x32ae('0x1e')](function(_0x4293e0){return _0x4293e0;});}return null;};}function removeEntity(_0x59478a,_0xda00b8){return function(_0x108250){if(_0x108250){return _0x108250[_0x32ae('0x34')]()['then'](function(){_0x59478a[_0x32ae('0x29')](0xcc)[_0x32ae('0x2a')]();});}};}function handleEntityNotFound(_0x49c4bf,_0x3840da){return function(_0xf7b5ca){if(!_0xf7b5ca){_0x49c4bf[_0x32ae('0x28')](0x194);}return _0xf7b5ca;};}function handleError(_0x3cbe59,_0x5d86e2){_0x5d86e2=_0x5d86e2||0x1f4;return function(_0x1f3d98){logger['error'](_0x1f3d98[_0x32ae('0x35')]);if(_0x1f3d98[_0x32ae('0x36')]){delete _0x1f3d98[_0x32ae('0x36')];}_0x3cbe59['status'](_0x5d86e2)[_0x32ae('0x37')](_0x1f3d98);};}exports[_0x32ae('0x38')]=function(_0x1794ae,_0x275471){var _0x16ef4e={},_0x3a6a7c={},_0x2f73e6={'count':0x0,'rows':[]};var _0x318e76=_[_0x32ae('0x39')](db[_0x32ae('0x3a')][_0x32ae('0x3b')],function(_0x17404e){return{'name':_0x17404e[_0x32ae('0x3c')],'type':_0x17404e[_0x32ae('0x3d')][_0x32ae('0x3e')]};});_0x3a6a7c[_0x32ae('0x3f')]=_[_0x32ae('0x39')](_0x318e76,_0x32ae('0x36'));_0x3a6a7c[_0x32ae('0x40')]=_['keys'](_0x1794ae[_0x32ae('0x40')]);_0x3a6a7c[_0x32ae('0x41')]=_[_0x32ae('0x42')](_0x3a6a7c[_0x32ae('0x3f')],_0x3a6a7c[_0x32ae('0x40')]);_0x16ef4e['attributes']=_['intersection'](_0x3a6a7c['model'],qs[_0x32ae('0x43')](_0x1794ae['query'][_0x32ae('0x43')]));_0x16ef4e[_0x32ae('0x44')]=_0x16ef4e[_0x32ae('0x44')][_0x32ae('0x45')]?_0x16ef4e[_0x32ae('0x44')]:_0x3a6a7c[_0x32ae('0x3f')];if(!_0x1794ae['query'][_0x32ae('0x46')](_0x32ae('0x47'))){_0x16ef4e[_0x32ae('0x2e')]=qs[_0x32ae('0x2e')](_0x1794ae[_0x32ae('0x40')][_0x32ae('0x2e')]);_0x16ef4e[_0x32ae('0x2c')]=qs[_0x32ae('0x2c')](_0x1794ae[_0x32ae('0x40')][_0x32ae('0x2c')]);}_0x16ef4e['order']=qs[_0x32ae('0x48')](_0x1794ae[_0x32ae('0x40')][_0x32ae('0x48')]);_0x16ef4e[_0x32ae('0x49')]=qs[_0x32ae('0x41')](_[_0x32ae('0x4a')](_0x1794ae[_0x32ae('0x40')],_0x3a6a7c['filters']),_0x318e76);if(_0x1794ae[_0x32ae('0x40')][_0x32ae('0x4b')]){_0x16ef4e[_0x32ae('0x49')]=_[_0x32ae('0x4c')](_0x16ef4e[_0x32ae('0x49')],{'$or':_[_0x32ae('0x39')](_0x318e76,function(_0x4e8e6a){if(_0x4e8e6a[_0x32ae('0x3d')]!==_0x32ae('0x4d')){var _0xb47813={};_0xb47813[_0x4e8e6a[_0x32ae('0x36')]]={'$like':'%'+_0x1794ae[_0x32ae('0x40')]['filter']+'%'};return _0xb47813;}})});}_0x16ef4e=_[_0x32ae('0x4c')]({},_0x16ef4e,_0x1794ae[_0x32ae('0x4e')]);var _0x7638ef={'where':_0x16ef4e[_0x32ae('0x49')]};return db[_0x32ae('0x3a')]['count'](_0x7638ef)[_0x32ae('0x1e')](function(_0x433ffc){_0x2f73e6[_0x32ae('0x2f')]=_0x433ffc;if(_0x1794ae[_0x32ae('0x40')][_0x32ae('0x4f')]){_0x16ef4e[_0x32ae('0x50')]=[{'all':!![]}];}return db[_0x32ae('0x3a')][_0x32ae('0x51')](_0x16ef4e);})[_0x32ae('0x1e')](function(_0x40879b){_0x2f73e6[_0x32ae('0x52')]=_0x40879b;return _0x2f73e6;})[_0x32ae('0x1e')](respondWithFilteredResult(_0x275471,_0x16ef4e))['catch'](handleError(_0x275471,null));};exports['show']=function(_0x3ef125,_0x2956c8){var _0x37b5bd={'raw':!![],'where':{'id':_0x3ef125[_0x32ae('0x53')]['id']}},_0x3d6f6b={};_0x3d6f6b[_0x32ae('0x3f')]=_[_0x32ae('0x54')](db['FaxMessage'][_0x32ae('0x3b')]);_0x3d6f6b['query']=_[_0x32ae('0x54')](_0x3ef125['query']);_0x3d6f6b['filters']=_[_0x32ae('0x42')](_0x3d6f6b[_0x32ae('0x3f')],_0x3d6f6b[_0x32ae('0x40')]);_0x37b5bd[_0x32ae('0x44')]=_[_0x32ae('0x42')](_0x3d6f6b[_0x32ae('0x3f')],qs[_0x32ae('0x43')](_0x3ef125[_0x32ae('0x40')]['fields']));_0x37b5bd['attributes']=_0x37b5bd[_0x32ae('0x44')][_0x32ae('0x45')]?_0x37b5bd[_0x32ae('0x44')]:_0x3d6f6b[_0x32ae('0x3f')];if(_0x3ef125[_0x32ae('0x40')]['includeAll']){_0x37b5bd[_0x32ae('0x50')]=[{'all':!![]}];}_0x37b5bd=_[_0x32ae('0x4c')]({},_0x37b5bd,_0x3ef125['options']);return db[_0x32ae('0x3a')][_0x32ae('0x55')](_0x37b5bd)['then'](handleEntityNotFound(_0x2956c8,null))['then'](respondWithResult(_0x2956c8,null))[_0x32ae('0x27')](handleError(_0x2956c8,null));};exports[_0x32ae('0x56')]=function(_0x272301,_0x4b4da0){if(_0x272301[_0x32ae('0x57')]['id']){delete _0x272301[_0x32ae('0x57')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x272301[_0x32ae('0x53')]['id']}})[_0x32ae('0x1e')](handleEntityNotFound(_0x4b4da0,null))['then'](saveUpdates(_0x272301['body'],null))[_0x32ae('0x1e')](respondWithResult(_0x4b4da0,null))[_0x32ae('0x27')](handleError(_0x4b4da0,null));};exports[_0x32ae('0x34')]=function(_0x2c2f87,_0x39f11f){return db[_0x32ae('0x3a')][_0x32ae('0x55')]({'where':{'id':_0x2c2f87[_0x32ae('0x53')]['id']}})['then'](handleEntityNotFound(_0x39f11f,null))[_0x32ae('0x1e')](removeEntity(_0x39f11f,null))[_0x32ae('0x27')](handleError(_0x39f11f,null));};exports[_0x32ae('0x58')]=function(_0x4639d9,_0x68f99a){return db[_0x32ae('0x3a')][_0x32ae('0x58')]()[_0x32ae('0x1e')](respondWithResult(_0x68f99a,null))[_0x32ae('0x27')](handleError(_0x68f99a,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x32ae('0x59')]=function(_0x33865b,_0x3eae45,_0xac00ea){var _0x4159a4={'agent':{},'channel':_0x32ae('0x5a')};if(_0x33865b[_0x32ae('0x57')]['id']){delete _0x33865b[_0x32ae('0x57')]['id'];}_0x33865b[_0x32ae('0x57')][_0x32ae('0x5b')]=!![];_0x33865b[_0x32ae('0x57')][_0x32ae('0x5c')]=moment()[_0x32ae('0x5d')](_0x32ae('0x5e'));_0x33865b[_0x32ae('0x57')][_0x32ae('0x5f')]=_0x33865b[_0x32ae('0x57')][_0x32ae('0x5f')]||_0x33865b['user']['id'];_0x4159a4['agent']['id']=_0x33865b['body'][_0x32ae('0x5f')];return db['FaxMessage'][_0x32ae('0x55')]({'where':{'id':_0x33865b[_0x32ae('0x53')]['id'],'UserId':null}})[_0x32ae('0x1e')](handleEntityNotFound(_0x3eae45,null))[_0x32ae('0x1e')](saveUpdates(_0x33865b[_0x32ae('0x57')],null))[_0x32ae('0x1e')](function(_0x1fc9a3){if(_0x1fc9a3){_0x4159a4['message']=_0x1fc9a3[_0x32ae('0x60')]({'plain':!![]});return db[_0x32ae('0x61')][_0x32ae('0x55')]({'where':{'id':_0x1fc9a3[_0x32ae('0x62')]}});}return null;})[_0x32ae('0x1e')](handleEntityNotFound(_0x3eae45,null))[_0x32ae('0x1e')](function(_0x5bc851){if(_0x5bc851){return _0x5bc851[_0x32ae('0x56')]({'UserId':_0x33865b[_0x32ae('0x57')][_0x32ae('0x5f')],'read1stAt':_[_0x32ae('0x63')](_0x5bc851['read1stAt'])?moment()[_0x32ae('0x5d')](_0x32ae('0x5e')):undefined});}return null;})[_0x32ae('0x1e')](function(_0x4cadca){if(_0x4cadca){_0x4159a4['interaction']=_0x4cadca[_0x32ae('0x60')]({'plain':!![]});interaction_log['info'](_0x32ae('0x64'),_0x33865b[_0x32ae('0x65')]['id'],_0x33865b[_0x32ae('0x65')][_0x32ae('0x36')],_0x33865b[_0x32ae('0x65')]['role'],_0x4159a4['interaction']['id'],_0x33865b[_0x32ae('0x57')]?JSON[_0x32ae('0x66')](_0x33865b[_0x32ae('0x57')]):_0x32ae('0x67'));return respondWithRpcPromise(_0x32ae('0x68'),_0x32ae('0x69'),_0x4159a4);}return null;})[_0x32ae('0x1e')](function(_0x349e0e){var _0x583fac=_0x32ae('0x6a')+_0x349e0e[_0x32ae('0x25')]['ContactId'];return db[_0x32ae('0x6b')]['query'](_0x583fac,{'type':db['Sequelize'][_0x32ae('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x4a29b9){return _0x4a29b9;});})[_0x32ae('0x1e')](function(_0x79c0b){if(_0x79c0b){_0x4159a4[_0x32ae('0x25')]['contact']=_0x79c0b[0x0];if(!_0x33865b[_0x32ae('0x57')][_0x32ae('0x5f')])return;return db[_0x32ae('0x6d')][_0x32ae('0x55')]({'where':{'id':_0x33865b[_0x32ae('0x57')][_0x32ae('0x5f')],'role':_0x32ae('0x6e')},'attributes':['id',_0x32ae('0x36'),_0x32ae('0x6f'),'email',_0x32ae('0x70')],'raw':!![]});}return null;})[_0x32ae('0x1e')](function(_0x2918a0){if(!_0x2918a0)return null;_0x4159a4['message'][_0x32ae('0x6e')]=_0x2918a0;return _0x4159a4;})[_0x32ae('0x1e')](function(_0x1c7d09){if(_0x1c7d09){if(_0x33865b[_0x32ae('0x57')][_0x32ae('0x71')]){_0x4159a4['message'][_0x32ae('0x72')]=util[_0x32ae('0x5d')](_0x32ae('0x73'),_0x33865b[_0x32ae('0x65')][_0x32ae('0x36')]);_0x4159a4[_0x32ae('0x25')]['channel']=_0x4159a4[_0x32ae('0x74')];_0x4159a4[_0x32ae('0x25')][_0x32ae('0x75')]=_0x4159a4['channel'];_0x4159a4[_0x32ae('0x25')][_0x32ae('0x76')]=_0x32ae('0x59');return respondWithRpcPromise('EventManager',_0x32ae('0x77'),{'event':'acceptmessage','message':_0x4159a4['message']},client9002)['then'](function(){return _0x4159a4;});}return _0x4159a4;}return null;})[_0x32ae('0x1e')](respondWithResult(_0x3eae45,null))[_0x32ae('0x27')](handleError(_0x3eae45,null));};var interaction_log=require(_0x32ae('0x78'))(_0x32ae('0x79'));exports[_0x32ae('0x32')]=function(_0x51d7f2,_0x44db8e,_0xab893e){var _0x2e8b99={'agent':{},'channel':_0x32ae('0x5a')};if(_0x51d7f2[_0x32ae('0x57')]['id']){delete _0x51d7f2[_0x32ae('0x57')]['id'];}_0x51d7f2[_0x32ae('0x57')][_0x32ae('0x5f')]=_0x51d7f2[_0x32ae('0x57')]['UserId']||_0x51d7f2[_0x32ae('0x65')]['id'];_0x2e8b99[_0x32ae('0x6e')]['id']=_0x51d7f2[_0x32ae('0x57')][_0x32ae('0x5f')];return db[_0x32ae('0x3a')]['find']({'where':{'id':_0x51d7f2['params']['id'],'UserId':null}})[_0x32ae('0x1e')](handleEntityNotFound(_0x44db8e,null))['then'](function(_0x1dc821){if(_0x1dc821){_0x2e8b99['message']=_0x1dc821[_0x32ae('0x60')]({'plain':!![]});return db[_0x32ae('0x61')][_0x32ae('0x55')]({'where':{'id':_0x1dc821[_0x32ae('0x62')]}});}return null;})[_0x32ae('0x1e')](handleEntityNotFound(_0x44db8e,null))[_0x32ae('0x1e')](function(_0x11a641){if(_0x11a641){_0x2e8b99[_0x32ae('0x7a')]=_0x11a641['get']({'plain':!![]});interaction_log[_0x32ae('0x1f')](_0x32ae('0x7b'),_0x51d7f2[_0x32ae('0x65')]['id'],_0x51d7f2[_0x32ae('0x65')]['name'],_0x51d7f2['user'][_0x32ae('0x7c')],_0x2e8b99[_0x32ae('0x7a')]['id'],_0x51d7f2['body']?JSON[_0x32ae('0x66')](_0x51d7f2[_0x32ae('0x57')]):_0x32ae('0x67'));return respondWithRpcPromise(_0x32ae('0x7d'),_0x32ae('0x7e'),_0x2e8b99);}return null;})[_0x32ae('0x1e')](function(_0x33edef){var _0x5306c7=_0x32ae('0x6a')+_0x33edef[_0x32ae('0x25')][_0x32ae('0x7f')];return db[_0x32ae('0x6b')][_0x32ae('0x40')](_0x5306c7,{'type':db['Sequelize']['QueryTypes'][_0x32ae('0x80')],'raw':!![]})[_0x32ae('0x1e')](function(_0x1fec7f){return _0x1fec7f;});})[_0x32ae('0x1e')](function(_0x125d3a){if(_0x125d3a){_0x2e8b99[_0x32ae('0x25')]['contact']=_0x125d3a[0x0];if(!_0x51d7f2[_0x32ae('0x57')]['UserId'])return;return db[_0x32ae('0x6d')][_0x32ae('0x55')]({'where':{'id':_0x51d7f2[_0x32ae('0x57')][_0x32ae('0x5f')],'role':_0x32ae('0x6e')},'attributes':['id',_0x32ae('0x36'),_0x32ae('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x32ae('0x1e')](function(_0x4084ef){if(!_0x4084ef)return null;_0x2e8b99[_0x32ae('0x25')][_0x32ae('0x6e')]=_0x4084ef;return _0x2e8b99;})[_0x32ae('0x1e')](function(_0x11b90f){if(_0x11b90f){_0x11b90f[_0x32ae('0x25')]['interface']=util[_0x32ae('0x5d')]('SIP/%s',_0x51d7f2[_0x32ae('0x65')][_0x32ae('0x36')]);_0x11b90f['message'][_0x32ae('0x74')]=_0x2e8b99[_0x32ae('0x74')];_0x11b90f['message'][_0x32ae('0x75')]=_0x2e8b99[_0x32ae('0x74')];_0x11b90f[_0x32ae('0x25')][_0x32ae('0x76')]='reject';respondWithRpcPromise(_0x32ae('0x77'),_0x32ae('0x77'),{'event':_0x32ae('0x81'),'message':_0x11b90f[_0x32ae('0x25')]},client9002);return _0x2e8b99;}return null;})['then'](respondWithResult(_0x44db8e,null))[_0x32ae('0x27')](handleError(_0x44db8e,null));};exports[_0x32ae('0x82')]=function(_0x417a4e,_0x4d8d57){var _0x243933;return db[_0x32ae('0x3a')][_0x32ae('0x82')](_0x417a4e[_0x32ae('0x57')],{})['then'](function(_0x28be1f){_0x243933=_0x28be1f;return db['CmContact'][_0x32ae('0x83')]({'where':{'id':_0x243933[_0x32ae('0x7f')]}});})[_0x32ae('0x1e')](function(_0x46b9a5){if(_[_0x32ae('0x63')](_0x46b9a5)){return;}else{_0x243933[_0x32ae('0x5a')]=_0x46b9a5['fax'];return db[_0x32ae('0x84')][_0x32ae('0x83')]({'where':{'id':_0x243933[_0x32ae('0x85')]}});}})[_0x32ae('0x1e')](function(_0x2f2fb6){return respondWithRpcPromise(_0x32ae('0x86'),_0x32ae('0x86'),{'FaxAccountId':_[_0x32ae('0x63')](_0x417a4e[_0x32ae('0x57')])?undefined:_0x417a4e[_0x32ae('0x57')]['FaxAccountId'],'path':_[_0x32ae('0x63')](_0x2f2fb6)?undefined:util[_0x32ae('0x5d')](_0x32ae('0x87'),_0x2f2fb6[_0x32ae('0x88')]),'fax':_['isNil'](_0x243933[_0x32ae('0x5a')])?undefined:_0x243933['fax'],'AttachmentId':_0x243933['AttachmentId']},client9002);})[_0x32ae('0x1e')](respondWithResult(_0x4d8d57,0xc9))[_0x32ae('0x27')](handleError(_0x4d8d57,null));};exports[_0x32ae('0x89')]=function(_0x37928d,_0x4810ad){var _0x578b09=path['join'](config['root'],_0x32ae('0x8a'),_0x32ae('0x8b'),_0x32ae('0x8c'));return db[_0x32ae('0x3a')]['find']({'where':{'id':_0x37928d[_0x32ae('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0x32ae('0x84')}]})[_0x32ae('0x1e')](handleEntityNotFound(_0x4810ad,null))[_0x32ae('0x1e')](function(_0x10b188){if(_0x10b188){return _0x4810ad[_0x32ae('0x89')](path[_0x32ae('0x8d')](_0x578b09,_0x10b188[_0x32ae('0x84')][_0x32ae('0x88')]));}})[_0x32ae('0x27')](handleError(_0x4810ad,null));}; \ No newline at end of file +var _0xc4bd=['UserId','user','agent','get','FaxInteraction','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','User','motionChannel','create','CmContact','Attachment','AttachmentId','FaxAccountId','download','server','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','params','length','find','update','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0xc4bd,0x1d5));var _0xdc4b=function(_0x4fe660,_0xa13ead){_0x4fe660=_0x4fe660-0x0;var _0x5413ae=_0xc4bd[_0x4fe660];return _0x5413ae;};'use strict';var emlformat=require(_0xdc4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc4b('0x1'));var jsonpatch=require(_0xdc4b('0x2'));var rp=require(_0xdc4b('0x3'));var moment=require(_0xdc4b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc4b('0x5'));var util=require(_0xdc4b('0x6'));var path=require(_0xdc4b('0x7'));var sox=require(_0xdc4b('0x8'));var csv=require('to-csv');var ejs=require(_0xdc4b('0x9'));var fs=require('fs');var fs_extra=require(_0xdc4b('0xa'));var _=require(_0xdc4b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdc4b('0xc'));var deskjs=require(_0xdc4b('0xd'));var toCsv=require(_0xdc4b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdc4b('0xf'));var authService=require(_0xdc4b('0x10'));var qs=require(_0xdc4b('0x11'));var as=require(_0xdc4b('0x12'));var hardwareService=require(_0xdc4b('0x13'));var logger=require(_0xdc4b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xdc4b('0x15'));var licenseUtil=require(_0xdc4b('0x16'));var db=require(_0xdc4b('0x17'))['db'];config[_0xdc4b('0x18')]=_[_0xdc4b('0x19')](config[_0xdc4b('0x18')],{'host':_0xdc4b('0x1a'),'port':0x18eb});var socket=require(_0xdc4b('0x1b'))(new Redis(config[_0xdc4b('0x18')]));require(_0xdc4b('0x1c'))[_0xdc4b('0x1d')](socket);var jayson=require(_0xdc4b('0x1e'));var client=jayson[_0xdc4b('0x1f')][_0xdc4b('0x20')]({'port':0x232c});var client9002=jayson[_0xdc4b('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x132263,_0x10e927,_0x5cc1f6,_0x5e58fb){return new BPromise(function(_0x53611e,_0x40553b){var _0x4b89ac=_0x5e58fb||client;return _0x4b89ac[_0xdc4b('0x21')](_0x132263,_0x5cc1f6)['then'](function(_0x1fb1d7){logger[_0xdc4b('0x22')]('FaxMessage,\x20%s,\x20%s',_0x10e927,_0xdc4b('0x23'));logger[_0xdc4b('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x10e927,_0xdc4b('0x23'),JSON[_0xdc4b('0x25')](_0x1fb1d7));if(_0x1fb1d7['error']){if(_0x1fb1d7[_0xdc4b('0x26')][_0xdc4b('0x27')]===0x1f4){logger['error'](_0xdc4b('0x28'),_0x10e927,_0x1fb1d7[_0xdc4b('0x26')]['message']);return _0x40553b(_0x1fb1d7['error'][_0xdc4b('0x29')]);}logger[_0xdc4b('0x26')](_0xdc4b('0x28'),_0x10e927,_0x1fb1d7['error'][_0xdc4b('0x29')]);return _0x53611e(_0x1fb1d7[_0xdc4b('0x26')]['message']);}else{logger['info'](_0xdc4b('0x28'),_0x10e927,_0xdc4b('0x23'));_0x53611e(_0x1fb1d7[_0xdc4b('0x2a')]['message']);}})[_0xdc4b('0x2b')](function(_0x1daae1){logger[_0xdc4b('0x26')](_0xdc4b('0x28'),_0x10e927,_0x1daae1);_0x40553b(_0x1daae1);});});}function respondWithStatusCode(_0x120f01,_0x2eabe0){_0x2eabe0=_0x2eabe0||0xcc;return function(_0x4c19f8){if(_0x4c19f8){return _0x120f01[_0xdc4b('0x2c')](_0x2eabe0);}return _0x120f01[_0xdc4b('0x2d')](_0x2eabe0)['end']();};}function respondWithResult(_0x2a270f,_0xa3cad){_0xa3cad=_0xa3cad||0xc8;return function(_0x1b3b7e){if(_0x1b3b7e){return _0x2a270f[_0xdc4b('0x2d')](_0xa3cad)[_0xdc4b('0x2e')](_0x1b3b7e);}};}function respondWithFilteredResult(_0x525d20,_0xc0a6a0){return function(_0x4c4251){if(_0x4c4251){var _0x3417ce=typeof _0xc0a6a0['offset']===_0xdc4b('0x2f')&&typeof _0xc0a6a0[_0xdc4b('0x30')]===_0xdc4b('0x2f');var _0x4d84c5=_0x4c4251[_0xdc4b('0x31')];var _0x22689e=_0x3417ce?0x0:_0xc0a6a0[_0xdc4b('0x32')];var _0x4a70b0=_0x3417ce?_0x4c4251[_0xdc4b('0x31')]:_0xc0a6a0[_0xdc4b('0x32')]+_0xc0a6a0[_0xdc4b('0x30')];var _0x116dd2;if(_0x4a70b0>=_0x4d84c5){_0x4a70b0=_0x4d84c5;_0x116dd2=0xc8;}else{_0x116dd2=0xce;}_0x525d20[_0xdc4b('0x2d')](_0x116dd2);return _0x525d20[_0xdc4b('0x33')]('Content-Range',_0x22689e+'-'+_0x4a70b0+'/'+_0x4d84c5)[_0xdc4b('0x2e')](_0x4c4251);}return null;};}function patchUpdates(_0x91125b){return function(_0x118143){try{jsonpatch[_0xdc4b('0x34')](_0x118143,_0x91125b,!![]);}catch(_0x8bf43){return BPromise[_0xdc4b('0x35')](_0x8bf43);}return _0x118143['save']();};}function saveUpdates(_0x3bf994,_0x1f4331){return function(_0x5f2595){if(_0x5f2595){return _0x5f2595['update'](_0x3bf994)['then'](function(_0x487ec7){return _0x487ec7;});}return null;};}function removeEntity(_0x4c4528,_0xdcf62){return function(_0x414531){if(_0x414531){return _0x414531[_0xdc4b('0x36')]()['then'](function(){_0x4c4528['status'](0xcc)[_0xdc4b('0x37')]();});}};}function handleEntityNotFound(_0x12d1e3,_0x54d3d5){return function(_0x1b4e6e){if(!_0x1b4e6e){_0x12d1e3[_0xdc4b('0x2c')](0x194);}return _0x1b4e6e;};}function handleError(_0x408360,_0x557622){_0x557622=_0x557622||0x1f4;return function(_0x5ea5db){logger['error'](_0x5ea5db[_0xdc4b('0x38')]);if(_0x5ea5db[_0xdc4b('0x39')]){delete _0x5ea5db[_0xdc4b('0x39')];}_0x408360[_0xdc4b('0x2d')](_0x557622)[_0xdc4b('0x3a')](_0x5ea5db);};}exports[_0xdc4b('0x3b')]=function(_0x3db90a,_0x1d18f1){var _0x794bed={},_0x35c9a0={},_0x4c7622={'count':0x0,'rows':[]};var _0x21611b=_[_0xdc4b('0x3c')](db[_0xdc4b('0x3d')][_0xdc4b('0x3e')],function(_0x38cd98){return{'name':_0x38cd98['fieldName'],'type':_0x38cd98[_0xdc4b('0x3f')][_0xdc4b('0x40')]};});_0x35c9a0[_0xdc4b('0x41')]=_['map'](_0x21611b,_0xdc4b('0x39'));_0x35c9a0['query']=_[_0xdc4b('0x42')](_0x3db90a[_0xdc4b('0x43')]);_0x35c9a0[_0xdc4b('0x44')]=_[_0xdc4b('0x45')](_0x35c9a0[_0xdc4b('0x41')],_0x35c9a0[_0xdc4b('0x43')]);_0x794bed['attributes']=_[_0xdc4b('0x45')](_0x35c9a0[_0xdc4b('0x41')],qs[_0xdc4b('0x46')](_0x3db90a[_0xdc4b('0x43')][_0xdc4b('0x46')]));_0x794bed[_0xdc4b('0x47')]=_0x794bed['attributes']['length']?_0x794bed['attributes']:_0x35c9a0[_0xdc4b('0x41')];if(!_0x3db90a['query']['hasOwnProperty'](_0xdc4b('0x48'))){_0x794bed['limit']=qs['limit'](_0x3db90a['query'][_0xdc4b('0x30')]);_0x794bed[_0xdc4b('0x32')]=qs[_0xdc4b('0x32')](_0x3db90a['query'][_0xdc4b('0x32')]);}_0x794bed[_0xdc4b('0x49')]=qs[_0xdc4b('0x4a')](_0x3db90a[_0xdc4b('0x43')][_0xdc4b('0x4a')]);_0x794bed[_0xdc4b('0x4b')]=qs[_0xdc4b('0x44')](_[_0xdc4b('0x4c')](_0x3db90a[_0xdc4b('0x43')],_0x35c9a0['filters']),_0x21611b);if(_0x3db90a[_0xdc4b('0x43')][_0xdc4b('0x4d')]){_0x794bed[_0xdc4b('0x4b')]=_['merge'](_0x794bed[_0xdc4b('0x4b')],{'$or':_['map'](_0x21611b,function(_0x40f0a6){if(_0x40f0a6['type']!==_0xdc4b('0x4e')){var _0x460bb2={};_0x460bb2[_0x40f0a6['name']]={'$like':'%'+_0x3db90a['query'][_0xdc4b('0x4d')]+'%'};return _0x460bb2;}})});}_0x794bed=_[_0xdc4b('0x4f')]({},_0x794bed,_0x3db90a[_0xdc4b('0x50')]);var _0x2051ae={'where':_0x794bed[_0xdc4b('0x4b')]};return db['FaxMessage'][_0xdc4b('0x31')](_0x2051ae)[_0xdc4b('0x51')](function(_0x522201){_0x4c7622[_0xdc4b('0x31')]=_0x522201;if(_0x3db90a['query'][_0xdc4b('0x52')]){_0x794bed[_0xdc4b('0x53')]=[{'all':!![]}];}return db[_0xdc4b('0x3d')][_0xdc4b('0x54')](_0x794bed);})[_0xdc4b('0x51')](function(_0x1c5a2c){_0x4c7622[_0xdc4b('0x55')]=_0x1c5a2c;return _0x4c7622;})[_0xdc4b('0x51')](respondWithFilteredResult(_0x1d18f1,_0x794bed))[_0xdc4b('0x2b')](handleError(_0x1d18f1,null));};exports[_0xdc4b('0x56')]=function(_0x55463d,_0xcc5c44){var _0x13510b={'raw':!![],'where':{'id':_0x55463d[_0xdc4b('0x57')]['id']}},_0x2d8bb4={};_0x2d8bb4['model']=_[_0xdc4b('0x42')](db[_0xdc4b('0x3d')][_0xdc4b('0x3e')]);_0x2d8bb4['query']=_[_0xdc4b('0x42')](_0x55463d[_0xdc4b('0x43')]);_0x2d8bb4[_0xdc4b('0x44')]=_[_0xdc4b('0x45')](_0x2d8bb4['model'],_0x2d8bb4[_0xdc4b('0x43')]);_0x13510b[_0xdc4b('0x47')]=_[_0xdc4b('0x45')](_0x2d8bb4[_0xdc4b('0x41')],qs[_0xdc4b('0x46')](_0x55463d['query'][_0xdc4b('0x46')]));_0x13510b[_0xdc4b('0x47')]=_0x13510b[_0xdc4b('0x47')][_0xdc4b('0x58')]?_0x13510b[_0xdc4b('0x47')]:_0x2d8bb4['model'];if(_0x55463d[_0xdc4b('0x43')]['includeAll']){_0x13510b[_0xdc4b('0x53')]=[{'all':!![]}];}_0x13510b=_[_0xdc4b('0x4f')]({},_0x13510b,_0x55463d[_0xdc4b('0x50')]);return db[_0xdc4b('0x3d')][_0xdc4b('0x59')](_0x13510b)['then'](handleEntityNotFound(_0xcc5c44,null))[_0xdc4b('0x51')](respondWithResult(_0xcc5c44,null))['catch'](handleError(_0xcc5c44,null));};exports[_0xdc4b('0x5a')]=function(_0x3da8f5,_0x33d050){if(_0x3da8f5[_0xdc4b('0x5b')]['id']){delete _0x3da8f5[_0xdc4b('0x5b')]['id'];}return db[_0xdc4b('0x3d')][_0xdc4b('0x59')]({'where':{'id':_0x3da8f5[_0xdc4b('0x57')]['id']}})[_0xdc4b('0x51')](handleEntityNotFound(_0x33d050,null))[_0xdc4b('0x51')](saveUpdates(_0x3da8f5[_0xdc4b('0x5b')],null))[_0xdc4b('0x51')](respondWithResult(_0x33d050,null))[_0xdc4b('0x2b')](handleError(_0x33d050,null));};exports['destroy']=function(_0x85827,_0x5b7f9b){return db[_0xdc4b('0x3d')]['find']({'where':{'id':_0x85827[_0xdc4b('0x57')]['id']}})[_0xdc4b('0x51')](handleEntityNotFound(_0x5b7f9b,null))[_0xdc4b('0x51')](removeEntity(_0x5b7f9b,null))['catch'](handleError(_0x5b7f9b,null));};exports[_0xdc4b('0x5c')]=function(_0x3dd763,_0x133405){return db['FaxMessage'][_0xdc4b('0x5c')]()[_0xdc4b('0x51')](respondWithResult(_0x133405,null))[_0xdc4b('0x2b')](handleError(_0x133405,null));};var interaction_log=require(_0xdc4b('0x14'))(_0xdc4b('0x5d'));exports[_0xdc4b('0x5e')]=function(_0x2da3d9,_0x382edb,_0x4a8a92){var _0x29fcc8={'agent':{},'channel':_0xdc4b('0x5f')};if(_0x2da3d9[_0xdc4b('0x5b')]['id']){delete _0x2da3d9[_0xdc4b('0x5b')]['id'];}_0x2da3d9['body'][_0xdc4b('0x60')]=!![];_0x2da3d9[_0xdc4b('0x5b')]['readAt']=moment()[_0xdc4b('0x61')](_0xdc4b('0x62'));_0x2da3d9['body'][_0xdc4b('0x63')]=_0x2da3d9['body']['UserId']||_0x2da3d9[_0xdc4b('0x64')]['id'];_0x29fcc8[_0xdc4b('0x65')]['id']=_0x2da3d9['body'][_0xdc4b('0x63')];return db['FaxMessage'][_0xdc4b('0x59')]({'where':{'id':_0x2da3d9[_0xdc4b('0x57')]['id'],'UserId':null}})[_0xdc4b('0x51')](handleEntityNotFound(_0x382edb,null))['then'](saveUpdates(_0x2da3d9[_0xdc4b('0x5b')],null))['then'](function(_0x2061c8){if(_0x2061c8){_0x29fcc8['message']=_0x2061c8[_0xdc4b('0x66')]({'plain':!![]});return db[_0xdc4b('0x67')][_0xdc4b('0x59')]({'where':{'id':_0x2061c8['FaxInteractionId']}});}return null;})[_0xdc4b('0x51')](handleEntityNotFound(_0x382edb,null))[_0xdc4b('0x51')](function(_0x2d282a){if(_0x2d282a){return _0x2d282a['update']({'UserId':_0x2da3d9[_0xdc4b('0x5b')][_0xdc4b('0x63')],'read1stAt':_[_0xdc4b('0x68')](_0x2d282a[_0xdc4b('0x69')])?moment()[_0xdc4b('0x61')](_0xdc4b('0x62')):undefined});}return null;})[_0xdc4b('0x51')](function(_0x335923){if(_0x335923){_0x29fcc8['interaction']=_0x335923[_0xdc4b('0x66')]({'plain':!![]});interaction_log[_0xdc4b('0x22')](_0xdc4b('0x6a'),_0x2da3d9[_0xdc4b('0x64')]['id'],_0x2da3d9['user'][_0xdc4b('0x39')],_0x2da3d9[_0xdc4b('0x64')][_0xdc4b('0x6b')],_0x29fcc8[_0xdc4b('0x6c')]['id'],_0x2da3d9['body']?JSON[_0xdc4b('0x25')](_0x2da3d9['body']):_0xdc4b('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xdc4b('0x6e'),_0x29fcc8);}return null;})[_0xdc4b('0x51')](function(_0x270b68){var _0x46b4e8=_0xdc4b('0x6f')+_0x270b68[_0xdc4b('0x29')][_0xdc4b('0x70')];return db[_0xdc4b('0x71')]['query'](_0x46b4e8,{'type':db[_0xdc4b('0x72')][_0xdc4b('0x73')]['SELECT'],'raw':!![]})[_0xdc4b('0x51')](function(_0x549761){return _0x549761;});})[_0xdc4b('0x51')](function(_0x3962c4){if(_0x3962c4){_0x29fcc8[_0xdc4b('0x29')]['contact']=_0x3962c4[0x0];if(!_0x2da3d9[_0xdc4b('0x5b')][_0xdc4b('0x63')])return;return db['User']['find']({'where':{'id':_0x2da3d9[_0xdc4b('0x5b')][_0xdc4b('0x63')],'role':_0xdc4b('0x65')},'attributes':['id',_0xdc4b('0x39'),_0xdc4b('0x74'),'email',_0xdc4b('0x75')],'raw':!![]});}return null;})['then'](function(_0x2980be){if(!_0x2980be)return null;_0x29fcc8[_0xdc4b('0x29')][_0xdc4b('0x65')]=_0x2980be;return _0x29fcc8;})['then'](function(_0x3d6f07){if(_0x3d6f07){if(_0x2da3d9[_0xdc4b('0x5b')][_0xdc4b('0x76')]){_0x29fcc8[_0xdc4b('0x29')][_0xdc4b('0x77')]=util['format'](_0xdc4b('0x78'),_0x2da3d9['user']['name']);_0x29fcc8[_0xdc4b('0x29')]['channel']=_0x29fcc8['channel'];_0x29fcc8[_0xdc4b('0x29')]['motionChannel']=_0x29fcc8[_0xdc4b('0x79')];_0x29fcc8[_0xdc4b('0x29')][_0xdc4b('0x7a')]=_0xdc4b('0x5e');return respondWithRpcPromise(_0xdc4b('0x7b'),_0xdc4b('0x7b'),{'event':_0xdc4b('0x7c'),'message':_0x29fcc8[_0xdc4b('0x29')]},client9002)[_0xdc4b('0x51')](function(){return _0x29fcc8;});}return _0x29fcc8;}return null;})[_0xdc4b('0x51')](respondWithResult(_0x382edb,null))[_0xdc4b('0x2b')](handleError(_0x382edb,null));};var interaction_log=require('../../config/logger')(_0xdc4b('0x5d'));exports[_0xdc4b('0x35')]=function(_0x505946,_0x6374a0,_0x4171ac){var _0x7c4fb3={'agent':{},'channel':'fax'};if(_0x505946[_0xdc4b('0x5b')]['id']){delete _0x505946[_0xdc4b('0x5b')]['id'];}_0x505946[_0xdc4b('0x5b')][_0xdc4b('0x63')]=_0x505946[_0xdc4b('0x5b')][_0xdc4b('0x63')]||_0x505946[_0xdc4b('0x64')]['id'];_0x7c4fb3[_0xdc4b('0x65')]['id']=_0x505946[_0xdc4b('0x5b')][_0xdc4b('0x63')];return db[_0xdc4b('0x3d')]['find']({'where':{'id':_0x505946[_0xdc4b('0x57')]['id'],'UserId':null}})[_0xdc4b('0x51')](handleEntityNotFound(_0x6374a0,null))['then'](function(_0x314ec6){if(_0x314ec6){_0x7c4fb3[_0xdc4b('0x29')]=_0x314ec6['get']({'plain':!![]});return db[_0xdc4b('0x67')]['find']({'where':{'id':_0x314ec6[_0xdc4b('0x7d')]}});}return null;})[_0xdc4b('0x51')](handleEntityNotFound(_0x6374a0,null))[_0xdc4b('0x51')](function(_0x13fa43){if(_0x13fa43){_0x7c4fb3['interaction']=_0x13fa43[_0xdc4b('0x66')]({'plain':!![]});interaction_log[_0xdc4b('0x22')](_0xdc4b('0x7e'),_0x505946[_0xdc4b('0x64')]['id'],_0x505946[_0xdc4b('0x64')][_0xdc4b('0x39')],_0x505946['user'][_0xdc4b('0x6b')],_0x7c4fb3[_0xdc4b('0x6c')]['id'],_0x505946[_0xdc4b('0x5b')]?JSON['stringify'](_0x505946[_0xdc4b('0x5b')]):'null');return respondWithRpcPromise(_0xdc4b('0x7f'),_0xdc4b('0x80'),_0x7c4fb3);}return null;})[_0xdc4b('0x51')](function(_0x1b1799){var _0x1ba6f4=_0xdc4b('0x6f')+_0x1b1799[_0xdc4b('0x29')][_0xdc4b('0x70')];return db['sequelize'][_0xdc4b('0x43')](_0x1ba6f4,{'type':db['Sequelize'][_0xdc4b('0x73')][_0xdc4b('0x81')],'raw':!![]})[_0xdc4b('0x51')](function(_0x488b3f){return _0x488b3f;});})[_0xdc4b('0x51')](function(_0x16fabb){if(_0x16fabb){_0x7c4fb3['message'][_0xdc4b('0x82')]=_0x16fabb[0x0];if(!_0x505946[_0xdc4b('0x5b')]['UserId'])return;return db[_0xdc4b('0x83')][_0xdc4b('0x59')]({'where':{'id':_0x505946['body']['UserId'],'role':_0xdc4b('0x65')},'attributes':['id',_0xdc4b('0x39'),_0xdc4b('0x74'),'email','internal'],'raw':!![]});}return null;})[_0xdc4b('0x51')](function(_0x441c6a){if(!_0x441c6a)return null;_0x7c4fb3[_0xdc4b('0x29')]['agent']=_0x441c6a;return _0x7c4fb3;})[_0xdc4b('0x51')](function(_0x15469f){if(_0x15469f){_0x15469f[_0xdc4b('0x29')][_0xdc4b('0x77')]=util[_0xdc4b('0x61')](_0xdc4b('0x78'),_0x505946[_0xdc4b('0x64')][_0xdc4b('0x39')]);_0x15469f[_0xdc4b('0x29')][_0xdc4b('0x79')]=_0x7c4fb3['channel'];_0x15469f['message'][_0xdc4b('0x84')]=_0x7c4fb3[_0xdc4b('0x79')];_0x15469f[_0xdc4b('0x29')]['event']=_0xdc4b('0x35');respondWithRpcPromise(_0xdc4b('0x7b'),_0xdc4b('0x7b'),{'event':'rejectmessage','message':_0x15469f[_0xdc4b('0x29')]},client9002);return _0x7c4fb3;}return null;})['then'](respondWithResult(_0x6374a0,null))[_0xdc4b('0x2b')](handleError(_0x6374a0,null));};exports[_0xdc4b('0x85')]=function(_0x339139,_0x316d0f){var _0xe8e3d3;return db[_0xdc4b('0x3d')][_0xdc4b('0x85')](_0x339139['body'],{})[_0xdc4b('0x51')](function(_0x5810bb){_0xe8e3d3=_0x5810bb;return db[_0xdc4b('0x86')]['findOne']({'where':{'id':_0xe8e3d3[_0xdc4b('0x70')]}});})['then'](function(_0xa092d4){if(_['isNil'](_0xa092d4)){return;}else{_0xe8e3d3[_0xdc4b('0x5f')]=_0xa092d4[_0xdc4b('0x5f')];return db[_0xdc4b('0x87')]['findOne']({'where':{'id':_0xe8e3d3[_0xdc4b('0x88')]}});}})[_0xdc4b('0x51')](function(_0x19b3f6){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xdc4b('0x68')](_0x339139[_0xdc4b('0x5b')])?undefined:_0x339139[_0xdc4b('0x5b')][_0xdc4b('0x89')],'path':_[_0xdc4b('0x68')](_0x19b3f6)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x19b3f6['basename']),'fax':_[_0xdc4b('0x68')](_0xe8e3d3['fax'])?undefined:_0xe8e3d3[_0xdc4b('0x5f')],'AttachmentId':_0xe8e3d3['AttachmentId']},client9002);})[_0xdc4b('0x51')](respondWithResult(_0x316d0f,0xc9))[_0xdc4b('0x2b')](handleError(_0x316d0f,null));};exports[_0xdc4b('0x8a')]=function(_0x5cc2b6,_0x4c4897){var _0x3cf048=path['join'](config['root'],_0xdc4b('0x8b'),_0xdc4b('0x8c'),_0xdc4b('0x8d'));return db[_0xdc4b('0x3d')][_0xdc4b('0x59')]({'where':{'id':_0x5cc2b6[_0xdc4b('0x57')]['id']},'include':[{'model':db[_0xdc4b('0x87')],'as':'Attachment'}]})[_0xdc4b('0x51')](handleEntityNotFound(_0x4c4897,null))[_0xdc4b('0x51')](function(_0x197b77){if(_0x197b77){return _0x4c4897[_0xdc4b('0x8a')](path['join'](_0x3cf048,_0x197b77[_0xdc4b('0x87')]['basename']));}})[_0xdc4b('0x2b')](handleError(_0x4c4897,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9b0becc..3e926a0 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 _0xb016=['remove','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb016,0x159));var _0x6b01=function(_0x501af0,_0x2de2a4){_0x501af0=_0x501af0-0x0;var _0x3f4b06=_0xb016[_0x501af0];return _0x3f4b06;};'use strict';var EventEmitter=require(_0x6b01('0x0'));var FaxMessage=require(_0x6b01('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b01('0x2'),'afterUpdate':'update','afterDestroy':_0x6b01('0x3')};function emitEvent(_0x464e83){return function(_0x161b59,_0x3b9de1,_0x5964ca){FaxMessageEvents[_0x6b01('0x4')](_0x464e83+':'+_0x161b59['id'],_0x161b59);FaxMessageEvents[_0x6b01('0x4')](_0x464e83,_0x161b59);_0x5964ca(null);};}for(var e in events){if(events[_0x6b01('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x9f02=['save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x97501e,_0x48c8fd){var _0x5919c8=function(_0x4033bd){while(--_0x4033bd){_0x97501e['push'](_0x97501e['shift']());}};_0x5919c8(++_0x48c8fd);}(_0x9f02,0x68));var _0x29f0=function(_0x5a2c29,_0x4ee316){_0x5a2c29=_0x5a2c29-0x0;var _0x215ab2=_0x9f02[_0x5a2c29];return _0x215ab2;};'use strict';var EventEmitter=require(_0x29f0('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29f0('0x1'),'afterUpdate':_0x29f0('0x2'),'afterDestroy':_0x29f0('0x3')};function emitEvent(_0x24792b){return function(_0x1a49c1,_0x47e569,_0x204fc4){FaxMessageEvents['emit'](_0x24792b+':'+_0x1a49c1['id'],_0x1a49c1);FaxMessageEvents[_0x29f0('0x4')](_0x24792b,_0x1a49c1);_0x204fc4(null);};}for(var e in events){if(events[_0x29f0('0x5')](e)){var event=events[e];FaxMessage[_0x29f0('0x6')](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 f1f8993..8ac48c9 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 _0x3789=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','models','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x27604a,_0x6bec61){var _0x52eeae=function(_0x9f96c1){while(--_0x9f96c1){_0x27604a['push'](_0x27604a['shift']());}};_0x52eeae(++_0x6bec61);}(_0x3789,0x196));var _0x9378=function(_0x194bd1,_0x4d1cfd){_0x194bd1=_0x194bd1-0x0;var _0xfc5812=_0x3789[_0x194bd1];return _0xfc5812;};'use strict';var _=require(_0x9378('0x0'));var util=require(_0x9378('0x1'));var logger=require(_0x9378('0x2'))(_0x9378('0x3'));var moment=require(_0x9378('0x4'));var BPromise=require(_0x9378('0x5'));var rp=require(_0x9378('0x6'));var fs=require('fs');var path=require(_0x9378('0x7'));var rimraf=require(_0x9378('0x8'));var config=require(_0x9378('0x9'));var attributes=require(_0x9378('0xa'));module[_0x9378('0xb')]=function(_0x483b54,_0x57761c){return _0x483b54[_0x9378('0xc')](_0x9378('0xd'),attributes,{'tableName':_0x9378('0xe'),'paranoid':![],'indexes':[{'name':_0x9378('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x935a68,_0x5061ea,_0x18bca1){var _0x28f758=_0x483b54[_0x9378('0x10')];var _0x1146a5=_0x935a68['get']({'plain':!![]});if(_0x1146a5[_0x9378('0x11')][_0x9378('0x12')]()==='in'||_0x1146a5[_0x9378('0x11')][_0x9378('0x12')]()===_0x9378('0x13')&&!_0x1146a5[_0x9378('0x14')]&&!_[_0x9378('0x15')](_0x1146a5['UserId'])){_0x28f758[_0x9378('0x16')][_0x9378('0x17')]({'where':{'id':_0x1146a5[_0x9378('0x18')]}})[_0x9378('0x19')](function(_0xfe9778){if(_0xfe9778){_0xfe9778[_0x9378('0x1a')]({'lastMsgAt':_0x1146a5[_0x9378('0x1b')],'lastMsgDirection':_0x1146a5[_0x9378('0x11')]['toLowerCase']()});}})[_0x9378('0x1c')](function(_0x2b7adf){console[_0x9378('0x1d')](_0x2b7adf);});}_0x18bca1();}},'charset':_0x9378('0x1e'),'collate':_0x9378('0x1f')});}; \ No newline at end of file +var _0xbddb=['./faxMessage.attributes','exports','fti_fax_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x17ad38,_0x5e4031){var _0x4c8d1e=function(_0x508628){while(--_0x508628){_0x17ad38['push'](_0x17ad38['shift']());}};_0x4c8d1e(++_0x5e4031);}(_0xbddb,0x1ba));var _0xbbdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbddb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbdd('0x0'));var util=require(_0xbbdd('0x1'));var logger=require(_0xbbdd('0x2'))(_0xbbdd('0x3'));var moment=require('moment');var BPromise=require(_0xbbdd('0x4'));var rp=require(_0xbbdd('0x5'));var fs=require('fs');var path=require(_0xbbdd('0x6'));var rimraf=require('rimraf');var config=require(_0xbbdd('0x7'));var attributes=require(_0xbbdd('0x8'));module[_0xbbdd('0x9')]=function(_0x1851f2,_0x36aaf1){return _0x1851f2['define']('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xbbdd('0xa'),'fields':[_0xbbdd('0xb')],'type':_0xbbdd('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x425706,_0x31e323,_0x2203bd){var _0x54c3cd=_0x1851f2['models'];var _0x1d1b55=_0x425706['get']({'plain':!![]});if(_0x1d1b55[_0xbbdd('0xd')][_0xbbdd('0xe')]()==='in'||_0x1d1b55['direction'][_0xbbdd('0xe')]()===_0xbbdd('0xf')&&!_0x1d1b55[_0xbbdd('0x10')]&&!_['isNil'](_0x1d1b55[_0xbbdd('0x11')])){_0x54c3cd[_0xbbdd('0x12')][_0xbbdd('0x13')]({'where':{'id':_0x1d1b55[_0xbbdd('0x14')]}})[_0xbbdd('0x15')](function(_0xc95c2){if(_0xc95c2){_0xc95c2[_0xbbdd('0x16')]({'lastMsgAt':_0x1d1b55[_0xbbdd('0x17')],'lastMsgDirection':_0x1d1b55[_0xbbdd('0xd')][_0xbbdd('0xe')]()});}})[_0xbbdd('0x18')](function(_0x26d716){console['error'](_0x26d716);});}_0x2203bd();}},'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 91b9be1..686d590 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 _0x98a8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','stringify','lodash','util','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x98a8,0x12c));var _0x898a=function(_0x1c5a77,_0x101791){_0x1c5a77=_0x1c5a77-0x0;var _0x318197=_0x98a8[_0x1c5a77];return _0x318197;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});}exports[_0x898a('0x1b')]=function(_0x58c3ab){var _0x4d374b=this;return new Promise(function(_0x12bc0f,_0x26449a){return db[_0x898a('0x1c')][_0x898a('0x1d')](_0x58c3ab[_0x898a('0x1e')],{'raw':_0x58c3ab[_0x898a('0x1f')]?_0x58c3ab[_0x898a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x898a('0x10')](function(_0x50718e){logger[_0x898a('0x11')](_0x898a('0x1b'),_0x58c3ab);logger[_0x898a('0x13')](_0x898a('0x1b'),_0x58c3ab,JSON['stringify'](_0x50718e));_0x12bc0f(_0x50718e);})[_0x898a('0x1a')](function(_0x16c318){logger[_0x898a('0x15')](_0x898a('0x1b'),_0x16c318[_0x898a('0x18')],_0x58c3ab);_0x26449a(_0x4d374b[_0x898a('0x15')](0x1f4,_0x16c318['message']));});});};exports[_0x898a('0x20')]=function(_0x51d501){var _0x513c6b=this;return new Promise(function(_0x53ddb2,_0x3678be){return db[_0x898a('0x1c')][_0x898a('0x21')](_0x51d501[_0x898a('0x1e')],{'raw':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')]['where']||null:null,'attributes':_0x51d501['options']?_0x51d501['options'][_0x898a('0x23')]||null:null,'limit':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x24')]||null:null})[_0x898a('0x10')](function(_0x560000){logger[_0x898a('0x11')](_0x898a('0x20'),_0x51d501);logger[_0x898a('0x13')](_0x898a('0x20'),_0x51d501,JSON[_0x898a('0x25')](_0x560000));_0x53ddb2(_0x560000);})[_0x898a('0x1a')](function(_0x494127){logger[_0x898a('0x15')](_0x898a('0x20'),_0x494127[_0x898a('0x18')],_0x51d501);_0x3678be(_0x513c6b[_0x898a('0x15')](0x1f4,_0x494127[_0x898a('0x18')]));});});}; \ No newline at end of file +var _0x84ab=['code','message','result','catch','FaxMessage','create','body','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x6a6235,_0xcda51){var _0x4bb608=function(_0x1b2231){while(--_0x1b2231){_0x6a6235['push'](_0x6a6235['shift']());}};_0x4bb608(++_0xcda51);}(_0x84ab,0x12f));var _0xb84a=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x84ab[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb84a('0xa')](config['redis'],{'host':_0xb84a('0xb'),'port':0x18eb});var socket=require(_0xb84a('0xc'))(new Redis(config['redis']));require(_0xb84a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e6a71,_0x1886e0,_0x42daf5){return new BPromise(function(_0x5d3b29,_0x5a34f7){return client['request'](_0x2e6a71,_0x42daf5)[_0xb84a('0xe')](function(_0x17379b){logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));logger['debug'](_0xb84a('0x12'),_0x1886e0,_0xb84a('0x11'),JSON[_0xb84a('0x13')](_0x17379b));if(_0x17379b[_0xb84a('0x14')]){if(_0x17379b[_0xb84a('0x14')][_0xb84a('0x15')]===0x1f4){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5a34f7(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}logger['error'](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5d3b29(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}else{logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));_0x5d3b29(_0x17379b[_0xb84a('0x17')][_0xb84a('0x16')]);}})[_0xb84a('0x18')](function(_0x2de49c){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x2de49c);_0x5a34f7(_0x2de49c);});});}exports['CreateFaxMessage']=function(_0x1a0056){var _0x319216=this;return new Promise(function(_0x55a633,_0xac76d3){return db[_0xb84a('0x19')][_0xb84a('0x1a')](_0x1a0056[_0xb84a('0x1b')],{'raw':_0x1a0056['options']?_0x1a0056['options'][_0xb84a('0x1c')]===undefined?!![]:![]:!![]})[_0xb84a('0xe')](function(_0x2d70fd){logger[_0xb84a('0xf')](_0xb84a('0x1d'),_0x1a0056);logger[_0xb84a('0x1e')](_0xb84a('0x1d'),_0x1a0056,JSON[_0xb84a('0x13')](_0x2d70fd));_0x55a633(_0x2d70fd);})[_0xb84a('0x18')](function(_0x26fe42){logger[_0xb84a('0x14')](_0xb84a('0x1d'),_0x26fe42[_0xb84a('0x16')],_0x1a0056);_0xac76d3(_0x319216[_0xb84a('0x14')](0x1f4,_0x26fe42[_0xb84a('0x16')]));});});};exports[_0xb84a('0x1f')]=function(_0x378ce1){var _0x3ff0bc=this;return new Promise(function(_0x3b6805,_0xd468c3){return db[_0xb84a('0x19')][_0xb84a('0x20')](_0x378ce1[_0xb84a('0x1b')],{'raw':_0x378ce1[_0xb84a('0x21')]?_0x378ce1[_0xb84a('0x21')][_0xb84a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378ce1['options']?_0x378ce1['options'][_0xb84a('0x22')]||null:null,'attributes':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options'][_0xb84a('0x23')]||null:null,'limit':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options']['limit']||null:null})[_0xb84a('0xe')](function(_0x8e9319){logger['info'](_0xb84a('0x1f'),_0x378ce1);logger[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x378ce1,JSON[_0xb84a('0x13')](_0x8e9319));_0x3b6805(_0x8e9319);})[_0xb84a('0x18')](function(_0x144c25){logger[_0xb84a('0x14')](_0xb84a('0x1f'),_0x144c25['message'],_0x378ce1);_0xd468c3(_0x3ff0bc[_0xb84a('0x14')](0x1f4,_0x144c25['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 87e3eae..9b941ce 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 _0xa72c=['register','length','./faxMessage.events','save','remove','update','emit'];(function(_0x27e3c7,_0x52db3b){var _0x5c26fe=function(_0x44efba){while(--_0x44efba){_0x27e3c7['push'](_0x27e3c7['shift']());}};_0x5c26fe(++_0x52db3b);}(_0xa72c,0x1bb));var _0xca72=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0xa72c[_0x3c4dad];return _0x1a4f49;};'use strict';var FaxMessageEvents=require(_0xca72('0x0'));var events=[_0xca72('0x1'),_0xca72('0x2'),_0xca72('0x3')];function createListener(_0x3cfa04,_0x4a5737){return function(_0x5aacda){_0x4a5737[_0xca72('0x4')](_0x3cfa04,_0x5aacda);};}function removeListener(_0x6d55b0,_0x5e6f31){return function(){FaxMessageEvents['removeListener'](_0x6d55b0,_0x5e6f31);};}exports[_0xca72('0x5')]=function(_0x42015f){for(var _0x56f51c=0x0,_0x16e639=events[_0xca72('0x6')];_0x56f51c<_0x16e639;_0x56f51c++){var _0x42aadf=events[_0x56f51c];var _0x28e06c=createListener('faxMessage:'+_0x42aadf,_0x42015f);FaxMessageEvents['on'](_0x42aadf,_0x28e06c);}}; \ No newline at end of file +var _0x8864=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8864,0x17b));var _0x4886=function(_0x3a1522,_0x51684f){_0x3a1522=_0x3a1522-0x0;var _0x2c7785=_0x8864[_0x3a1522];return _0x2c7785;};'use strict';var FaxMessageEvents=require(_0x4886('0x0'));var events=[_0x4886('0x1'),_0x4886('0x2'),'update'];function createListener(_0x3283b3,_0x4f9f21){return function(_0x5bf8ff){_0x4f9f21[_0x4886('0x3')](_0x3283b3,_0x5bf8ff);};}function removeListener(_0x1c0eb7,_0x4bd31b){return function(){FaxMessageEvents[_0x4886('0x4')](_0x1c0eb7,_0x4bd31b);};}exports[_0x4886('0x5')]=function(_0x199e79){for(var _0x2bb926=0x0,_0x5b78ad=events[_0x4886('0x6')];_0x2bb926<_0x5b78ad;_0x2bb926++){var _0x1d1c33=events[_0x2bb926];var _0x4fd6d2=createListener(_0x4886('0x7')+_0x1d1c33,_0x199e79);FaxMessageEvents['on'](_0x1d1c33,_0x4fd6d2);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 6b6b808..5e8291f 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 _0xb7e7=['get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7e7,0x121));var _0x7b7e=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xb7e7[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')]('/',auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x11')](_0x7b7e('0x12'),_0x7b7e('0x13')),controller[_0x7b7e('0x14')]);router[_0x7b7e('0x15')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x15')]('/:id/accept',auth[_0x7b7e('0xc')](),controller['accept']);router['put'](_0x7b7e('0x17'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x1a')]=router; \ No newline at end of file +var _0x6e6c=['reject','/:id','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./faxMessage.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0xc')]('/',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0xd')](_0xc6e6('0xe'),_0xc6e6('0xf')),controller['create']);router[_0xc6e6('0x10')]('/:id',auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x11')]);router[_0xc6e6('0x10')](_0xc6e6('0x12'),auth['isAuthenticated'](),controller[_0xc6e6('0x13')]);router[_0xc6e6('0x10')](_0xc6e6('0x14'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x15')]);router['delete'](_0xc6e6('0x16'),auth[_0xc6e6('0x7')](),controller['destroy']);module[_0xc6e6('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6d643d3..b9659e9 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 _0xd7d5=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x2984b3,_0x1b9e16){var _0xb49a4b=function(_0x30bd40){while(--_0x30bd40){_0x2984b3['push'](_0x2984b3['shift']());}};_0xb49a4b(++_0x1b9e16);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x4432b6,_0x5b0491){_0x4432b6=_0x4432b6-0x0;var _0x47b47d=_0xd7d5[_0x4432b6];return _0x47b47d;};'use strict';var Sequelize=require(_0x5d7d('0x0'));module[_0x5d7d('0x1')]={'name':{'type':Sequelize[_0x5d7d('0x2')],'unique':_0x5d7d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5d7d('0x2')]},'timeout':{'type':Sequelize[_0x5d7d('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5d7d('0x5')]('rrmemory',_0x5d7d('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5d7d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeab8=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x474e27,_0x3c0c1b){var _0x525979=function(_0xf4cbad){while(--_0xf4cbad){_0x474e27['push'](_0x474e27['shift']());}};_0x525979(++_0x3c0c1b);}(_0xeab8,0x147));var _0x8eab=function(_0x1dd313,_0x9edf){_0x1dd313=_0x1dd313-0x0;var _0x20bede=_0xeab8[_0x1dd313];return _0x20bede;};'use strict';var Sequelize=require(_0x8eab('0x0'));module['exports']={'name':{'type':Sequelize[_0x8eab('0x1')],'unique':_0x8eab('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8eab('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8eab('0x4')](_0x8eab('0x5'),_0x8eab('0x6'),_0x8eab('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8eab('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f0c16ee..e7264f6 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 _0x3fc6=['forEach','userFaxQueue:save','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','update','then','get','FaxQueues','destroy','error','name','index','FaxQueue','rawAttributes','type','getOptions','where','count','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','UserFaxQueue','nolimit','order','sort','pick','FaxQueueId','filter','options','User','findAndCountAll','UserId','createdAt','map','format','%s/%s','faxPause','updatedAt','Team','length','getTeams','hasOwnProperty','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3fc6,0x115));var _0x63fc=function(_0x51cf3b,_0x59c725){_0x51cf3b=_0x51cf3b-0x0;var _0x4119a7=_0x3fc6[_0x51cf3b];return _0x4119a7;};'use strict';var BPromise=require(_0x63fc('0x0'));var util=require('util');var _=require(_0x63fc('0x1'));var squel=require(_0x63fc('0x2'));var Redis=require(_0x63fc('0x3'));var qs=require(_0x63fc('0x4'));var logger=require('../../config/logger')(_0x63fc('0x5'));var config=require(_0x63fc('0x6'));var db=require(_0x63fc('0x7'))['db'];config['redis']=_[_0x63fc('0x8')](config['redis'],{'host':_0x63fc('0x9'),'port':0x18eb});var socket=require(_0x63fc('0xa'))(new Redis(config[_0x63fc('0xb')]));require('./faxQueue.socket')[_0x63fc('0xc')](socket);function respondWithStatusCode(_0xffe000,_0x144c55){_0x144c55=_0x144c55||0xcc;return function(_0x31e20c){if(_0x31e20c){return _0xffe000[_0x63fc('0xd')](_0x144c55);}return _0xffe000['status'](_0x144c55)[_0x63fc('0xe')]();};}function respondWithResult(_0x544f22,_0x5ad9a0){_0x5ad9a0=_0x5ad9a0||0xc8;return function(_0x6b8e8f){if(_0x6b8e8f){return _0x544f22[_0x63fc('0xf')](_0x5ad9a0)[_0x63fc('0x10')](_0x6b8e8f);}};}function respondWithFilteredResult(_0x4445ba,_0xddc7fe){return function(_0x240ea7){if(_0x240ea7){var _0x215fb5=typeof _0xddc7fe[_0x63fc('0x11')]==='undefined'&&typeof _0xddc7fe[_0x63fc('0x12')]===_0x63fc('0x13');var _0x3aef1d=_0x240ea7['count'];var _0x265e98=_0x215fb5?0x0:_0xddc7fe[_0x63fc('0x11')];var _0x3979f4=_0x215fb5?_0x240ea7['count']:_0xddc7fe[_0x63fc('0x11')]+_0xddc7fe[_0x63fc('0x12')];var _0x426479;if(_0x3979f4>=_0x3aef1d){_0x3979f4=_0x3aef1d;_0x426479=0xc8;}else{_0x426479=0xce;}_0x4445ba[_0x63fc('0xf')](_0x426479);return _0x4445ba[_0x63fc('0x14')](_0x63fc('0x15'),_0x265e98+'-'+_0x3979f4+'/'+_0x3aef1d)[_0x63fc('0x10')](_0x240ea7);}return null;};}function saveUpdates(_0x19a3f2){return function(_0x304ef6){if(_0x304ef6){return _0x304ef6[_0x63fc('0x16')](_0x19a3f2)[_0x63fc('0x17')](function(_0x2db18b){return _0x2db18b;});}return null;};}function removeEntity(_0x1283f8){return function(_0x2e1fb8){if(_0x2e1fb8){return _0x2e1fb8['destroy']()[_0x63fc('0x17')](function(){var _0x32aec1=_0x2e1fb8[_0x63fc('0x18')]({'plain':!![]});var _0x3c8735=_0x63fc('0x19');return db['UserProfileResource'][_0x63fc('0x1a')]({'where':{'type':_0x3c8735,'resourceId':_0x32aec1['id']}})[_0x63fc('0x17')](function(){return _0x2e1fb8;});})[_0x63fc('0x17')](function(){_0x1283f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39afb5){return function(_0x383d10){if(!_0x383d10){_0x39afb5[_0x63fc('0xd')](0x194);}return _0x383d10;};}function handleError(_0x5810b8,_0x1053c7){_0x1053c7=_0x1053c7||0x1f4;return function(_0x26e442){logger[_0x63fc('0x1b')](_0x26e442['stack']);if(_0x26e442[_0x63fc('0x1c')]){delete _0x26e442['name'];}_0x5810b8[_0x63fc('0xf')](_0x1053c7)['send'](_0x26e442);};}exports[_0x63fc('0x1d')]=function(_0x153a1b,_0x1f26b6){var _0x327dc2={};var _0x1a349d={'count':0x0,'rows':[]};var _0x214424=_['map'](db[_0x63fc('0x1e')][_0x63fc('0x1f')],function(_0x2dda64){return{'name':_0x2dda64['fieldName'],'type':_0x2dda64[_0x63fc('0x20')]['key']};});_0x327dc2=qs[_0x63fc('0x21')](_0x214424,_0x153a1b);var _0x5ed7a5={'where':_0x327dc2[_0x63fc('0x22')]};return db[_0x63fc('0x1e')]['count'](_0x5ed7a5)[_0x63fc('0x17')](function(_0x380bea){_0x1a349d[_0x63fc('0x23')]=_0x380bea;_0x327dc2[_0x63fc('0x24')]=qs['include'](_0x153a1b[_0x63fc('0x25')]);return db['FaxQueue'][_0x63fc('0x26')](_0x327dc2);})[_0x63fc('0x17')](function(_0x5e8d3c){_0x1a349d[_0x63fc('0x27')]=_0x5e8d3c;return _0x1a349d;})[_0x63fc('0x17')](respondWithFilteredResult(_0x1f26b6,_0x327dc2))[_0x63fc('0x28')](handleError(_0x1f26b6,null));};exports[_0x63fc('0x29')]=function(_0x609a64,_0x3eecac){var _0x2e95fd={'raw':!![],'where':{'id':_0x609a64[_0x63fc('0x2a')]['id']}},_0x1206bb={};_0x1206bb[_0x63fc('0x2b')]=_['keys'](db[_0x63fc('0x1e')]['rawAttributes']);_0x1206bb[_0x63fc('0x25')]=_[_0x63fc('0x2c')](_0x609a64[_0x63fc('0x25')]);_0x1206bb[_0x63fc('0x2d')]=_[_0x63fc('0x2e')](_0x1206bb[_0x63fc('0x2b')],_0x1206bb[_0x63fc('0x25')]);_0x2e95fd['attributes']=_[_0x63fc('0x2e')](_0x1206bb[_0x63fc('0x2b')],qs[_0x63fc('0x2f')](_0x609a64[_0x63fc('0x25')]['fields']));_0x2e95fd['attributes']=_0x2e95fd[_0x63fc('0x30')]['length']?_0x2e95fd[_0x63fc('0x30')]:_0x1206bb[_0x63fc('0x2b')];if(_0x609a64[_0x63fc('0x25')][_0x63fc('0x31')]){_0x2e95fd[_0x63fc('0x24')]=[{'all':!![]}];}_0x2e95fd=_[_0x63fc('0x32')]({},_0x2e95fd,_0x609a64['options']);return db[_0x63fc('0x1e')]['find'](_0x2e95fd)[_0x63fc('0x17')](handleEntityNotFound(_0x3eecac,null))[_0x63fc('0x17')](respondWithResult(_0x3eecac,null))['catch'](handleError(_0x3eecac,null));};exports[_0x63fc('0x33')]=function(_0x1e6f68,_0x43f97f){return db[_0x63fc('0x1e')][_0x63fc('0x33')](_0x1e6f68[_0x63fc('0x34')],{})[_0x63fc('0x17')](function(_0x37edef){var _0x319b91=_0x1e6f68[_0x63fc('0x35')][_0x63fc('0x18')]({'plain':!![]});if(!_0x319b91)throw new Error(_0x63fc('0x36'));if(_0x319b91[_0x63fc('0x37')]===_0x63fc('0x35')){var _0x3f06aa=_0x37edef['get']({'plain':!![]});var _0x5bde5f='FaxQueues';return db[_0x63fc('0x38')]['find']({'where':{'name':_0x5bde5f,'userProfileId':_0x319b91[_0x63fc('0x39')]},'raw':!![]})['then'](function(_0x106b3c){if(_0x106b3c&&_0x106b3c[_0x63fc('0x3a')]===0x0){return db[_0x63fc('0x3b')][_0x63fc('0x33')]({'name':_0x3f06aa[_0x63fc('0x1c')],'resourceId':_0x3f06aa['id'],'type':_0x106b3c[_0x63fc('0x1c')],'sectionId':_0x106b3c['id']},{})[_0x63fc('0x17')](function(){return _0x37edef;});}else{return _0x37edef;}})['catch'](function(_0x48cce1){logger[_0x63fc('0x1b')](_0x63fc('0x3c'),_0x48cce1);throw _0x48cce1;});}return _0x37edef;})[_0x63fc('0x17')](respondWithResult(_0x43f97f,0xc9))[_0x63fc('0x28')](handleError(_0x43f97f,null));};exports[_0x63fc('0x16')]=function(_0x37cf7c,_0x132aa0){if(_0x37cf7c[_0x63fc('0x34')]['id']){delete _0x37cf7c[_0x63fc('0x34')]['id'];}return db[_0x63fc('0x1e')][_0x63fc('0x3d')]({'where':{'id':_0x37cf7c['params']['id']}})[_0x63fc('0x17')](handleEntityNotFound(_0x132aa0,null))['then'](saveUpdates(_0x37cf7c['body'],null))[_0x63fc('0x17')](respondWithResult(_0x132aa0,null))[_0x63fc('0x28')](handleError(_0x132aa0,null));};exports['destroy']=function(_0x15e550,_0x2c36da){return db[_0x63fc('0x1e')]['find']({'where':{'id':_0x15e550['params']['id']}})[_0x63fc('0x17')](handleEntityNotFound(_0x2c36da,null))[_0x63fc('0x17')](removeEntity(_0x2c36da,null))[_0x63fc('0x28')](handleError(_0x2c36da,null));};exports[_0x63fc('0x3e')]=function(_0x5918da,_0x210c3e){return db[_0x63fc('0x1e')][_0x63fc('0x3e')]()[_0x63fc('0x17')](respondWithResult(_0x210c3e,null))['catch'](handleError(_0x210c3e,null));};exports[_0x63fc('0x3f')]=function(_0x31b6af,_0x9d3f91){var _0x1b3bb7={'raw':!![],'where':{}},_0x1a796f={},_0xc47db9;return db[_0x63fc('0x1e')][_0x63fc('0x40')]({'where':{'id':_0x31b6af[_0x63fc('0x2a')]['id']}})[_0x63fc('0x17')](handleEntityNotFound(_0x9d3f91,null))[_0x63fc('0x17')](function(_0x5a3b2d){if(_0x5a3b2d){_0xc47db9=_0x5a3b2d['get']({'plain':!![]});_0x1a796f[_0x63fc('0x2b')]=_[_0x63fc('0x2c')](db[_0x63fc('0x41')][_0x63fc('0x1f')]);_0x1a796f[_0x63fc('0x25')]=_[_0x63fc('0x2c')](_0x31b6af['query']);_0x1a796f['filters']=_['intersection'](_0x1a796f['model'],_0x1a796f['query']);_0x1b3bb7[_0x63fc('0x30')]=_['intersection'](_0x1a796f[_0x63fc('0x2b')],qs['fields'](_0x31b6af[_0x63fc('0x25')][_0x63fc('0x2f')]));_0x1b3bb7[_0x63fc('0x30')]=_0x1b3bb7[_0x63fc('0x30')]['length']?_0x1b3bb7[_0x63fc('0x30')]:_0x1a796f['model'];if(!_0x31b6af['query']['hasOwnProperty'](_0x63fc('0x42'))){_0x1b3bb7['limit']=qs['limit'](_0x31b6af[_0x63fc('0x25')][_0x63fc('0x12')]);_0x1b3bb7[_0x63fc('0x11')]=qs[_0x63fc('0x11')](_0x31b6af[_0x63fc('0x25')][_0x63fc('0x11')]);}_0x1b3bb7[_0x63fc('0x43')]=qs[_0x63fc('0x44')](_0x31b6af['query']['sort']);_0x1b3bb7['where']=qs[_0x63fc('0x2d')](_[_0x63fc('0x45')](_0x31b6af['query'],_0x1a796f['filters']));_0x1b3bb7[_0x63fc('0x22')][_0x63fc('0x46')]=_0x5a3b2d['id'];if(_0x31b6af[_0x63fc('0x25')][_0x63fc('0x47')]){_0x1b3bb7[_0x63fc('0x22')]=_['merge'](_0x1b3bb7['where'],{'$or':_['map'](_0x1b3bb7[_0x63fc('0x30')],function(_0x47c79e){var _0x2c2e46={};_0x2c2e46[_0x47c79e]={'$like':'%'+_0x31b6af[_0x63fc('0x25')][_0x63fc('0x47')]+'%'};return _0x2c2e46;})});}_0x1b3bb7=_['merge']({},_0x1b3bb7,_0x31b6af[_0x63fc('0x48')]);return db['UserFaxQueue'][_0x63fc('0x26')](_0x1b3bb7);}})[_0x63fc('0x17')](function(_0x478202){if(_0x478202){return db[_0x63fc('0x49')][_0x63fc('0x4a')]({'where':{'id':_['map'](_0x478202,_0x63fc('0x4b')),'role':'agent'},'attributes':['id',_0x63fc('0x1c'),'faxPause','updatedAt',_0x63fc('0x4c')]});}})[_0x63fc('0x17')](function(_0x5a97b9){if(_0x5a97b9){return{'count':_0x5a97b9['count'],'rows':_[_0x63fc('0x4d')](_0x5a97b9['rows'],function(_0x2dfc9b){return{'membername':_0x2dfc9b[_0x63fc('0x1c')],'UserId':_0x2dfc9b['id'],'queue_name':_0xc47db9[_0x63fc('0x1c')],'FaxQueueId':_0xc47db9['id'],'interface':util[_0x63fc('0x4e')](_0x63fc('0x4f'),'SIP',_0x2dfc9b[_0x63fc('0x1c')]),'penalty':0x0,'paused':_0x2dfc9b[_0x63fc('0x50')],'createdAt':_0x2dfc9b['createdAt'],'updatedAt':_0x2dfc9b[_0x63fc('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x63fc('0x17')](respondWithFilteredResult(_0x9d3f91,_0x1b3bb7))[_0x63fc('0x28')](handleError(_0x9d3f91,null));};exports['getTeams']=function(_0x5ded6c,_0x1e3d71){var _0x36fcf9={};var _0x4dfbdc={};var _0x3ba07e;var _0x3ab0fd;return db[_0x63fc('0x1e')]['findOne']({'where':{'id':_0x5ded6c[_0x63fc('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1e3d71,null))[_0x63fc('0x17')](function(_0x60be36){if(_0x60be36){_0x3ba07e=_0x60be36;_0x4dfbdc[_0x63fc('0x2b')]=_['keys'](db[_0x63fc('0x52')][_0x63fc('0x1f')]);_0x4dfbdc[_0x63fc('0x25')]=_[_0x63fc('0x2c')](_0x5ded6c['query']);_0x4dfbdc[_0x63fc('0x2d')]=_[_0x63fc('0x2e')](_0x4dfbdc[_0x63fc('0x2b')],_0x4dfbdc['query']);_0x36fcf9[_0x63fc('0x30')]=_[_0x63fc('0x2e')](_0x4dfbdc[_0x63fc('0x2b')],qs[_0x63fc('0x2f')](_0x5ded6c['query']['fields']));_0x36fcf9[_0x63fc('0x30')]=_0x36fcf9[_0x63fc('0x30')][_0x63fc('0x53')]?_0x36fcf9[_0x63fc('0x30')]:_0x4dfbdc[_0x63fc('0x2b')];_0x36fcf9[_0x63fc('0x43')]=qs[_0x63fc('0x44')](_0x5ded6c[_0x63fc('0x25')][_0x63fc('0x44')]);_0x36fcf9[_0x63fc('0x22')]=qs[_0x63fc('0x2d')](_[_0x63fc('0x45')](_0x5ded6c[_0x63fc('0x25')],_0x4dfbdc['filters']));if(_0x5ded6c[_0x63fc('0x25')][_0x63fc('0x47')]){_0x36fcf9[_0x63fc('0x22')]=_[_0x63fc('0x32')](_0x36fcf9[_0x63fc('0x22')],{'$or':_[_0x63fc('0x4d')](_0x36fcf9[_0x63fc('0x30')],function(_0x360d6a){var _0x4a3064={};_0x4a3064[_0x360d6a]={'$like':'%'+_0x5ded6c['query'][_0x63fc('0x47')]+'%'};return _0x4a3064;})});}_0x36fcf9=_[_0x63fc('0x32')]({},_0x36fcf9,_0x5ded6c[_0x63fc('0x48')]);return _0x3ba07e[_0x63fc('0x54')](_0x36fcf9);}})['then'](function(_0xf06633){if(_0xf06633){_0x3ab0fd=_0xf06633['length'];if(!_0x5ded6c[_0x63fc('0x25')][_0x63fc('0x55')](_0x63fc('0x42'))){_0x36fcf9[_0x63fc('0x12')]=qs[_0x63fc('0x12')](_0x5ded6c[_0x63fc('0x25')][_0x63fc('0x12')]);_0x36fcf9['offset']=qs[_0x63fc('0x11')](_0x5ded6c['query'][_0x63fc('0x11')]);}return _0x3ba07e['getTeams'](_0x36fcf9);}})['then'](function(_0x20c0ed){if(_0x20c0ed){return _0x20c0ed?{'count':_0x3ab0fd,'rows':_0x20c0ed}:null;}})[_0x63fc('0x17')](respondWithResult(_0x1e3d71,null))[_0x63fc('0x28')](handleError(_0x1e3d71,null));};exports[_0x63fc('0x56')]=function(_0x3d45b3,_0x486861){var _0x351a9b=_0x3d45b3[_0x63fc('0x34')][_0x63fc('0x57')];return db[_0x63fc('0x52')][_0x63fc('0x26')]({'where':{'id':_0x351a9b},'attributes':['id'],'include':[{'model':db[_0x63fc('0x49')],'as':_0x63fc('0x58'),'attributes':['id',_0x63fc('0x1c'),_0x63fc('0x59'),_0x63fc('0x5a'),'interface'],'raw':!![]}]})[_0x63fc('0x17')](function(_0x77e628){if(_0x77e628){var _0x1e3bb5=_[_0x63fc('0x5b')](_0x77e628,function(_0x34cea9){var _0x53b78a=_0x34cea9[_0x63fc('0x18')]({'plain':!![]});return _0x53b78a[_0x63fc('0x58')];});return db[_0x63fc('0x1e')][_0x63fc('0x3d')]({'where':{'id':_0x3d45b3[_0x63fc('0x2a')]['id']}})[_0x63fc('0x17')](function(_0x10594f){return db['sequelize'][_0x63fc('0x5c')](function(_0x3e4358){return _0x10594f[_0x63fc('0x56')](_0x351a9b,{'transaction':_0x3e4358})['then'](function(){return BPromise[_0x63fc('0x5d')](_0x1e3bb5,function(_0x354828){return db[_0x63fc('0x41')][_0x63fc('0x5e')]({'where':{'UserId':_0x354828['id'],'FaxQueueId':_0x3d45b3[_0x63fc('0x2a')]['id']},'transaction':_0x3e4358});});})[_0x63fc('0x17')](function(){_0x1e3bb5[_0x63fc('0x5f')](function(_0x13f7d8){socket['emit'](_0x63fc('0x60'),{'UserId':_0x13f7d8['id'],'FaxQueueId':_0x10594f['id']});});});});});}})[_0x63fc('0x17')](respondWithStatusCode(_0x486861,null))[_0x63fc('0x28')](handleError(_0x486861,null));};exports['removeTeams']=function(_0x1b2229,_0x1e35d6){return db['Team'][_0x63fc('0x26')]({'where':{'id':_0x1b2229[_0x63fc('0x25')][_0x63fc('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x63fc('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e35d6,null))[_0x63fc('0x17')](function(_0x35d4c9){var _0xa60f2e=_[_0x63fc('0x4d')](_0x35d4c9,'id');var _0x1ab188=[];var _0x134388=[];var _0x5c3230=squel['select']();_0x5c3230[_0x63fc('0x61')](_0x63fc('0x62'))[_0x63fc('0x63')]('team_has_fax_queues','tq')[_0x63fc('0x64')](_0x63fc('0x65'),'ut',_0x63fc('0x66'))[_0x63fc('0x22')]('FaxQueueId\x20=\x20?',_0x1b2229[_0x63fc('0x2a')]['id']);for(var _0x357082=0x0;_0x357082<_0x35d4c9[_0x63fc('0x53')];_0x357082+=0x1){let _0x1f34b5=_0x35d4c9[_0x357082];for(var _0x1cda73=0x0;_0x1cda73<_0x1f34b5[_0x63fc('0x58')]['length'];_0x1cda73+=0x1){let _0x543582=_0x1f34b5['Agents'][_0x1cda73];var _0x5a656f=_0x5c3230['clone']();_0x5a656f[_0x63fc('0x22')](_0x63fc('0x67'),_0x543582['id']);_0x134388['push'](db[_0x63fc('0x68')][_0x63fc('0x25')](_0x5a656f[_0x63fc('0x69')](),{'type':db[_0x63fc('0x68')][_0x63fc('0x6a')][_0x63fc('0x6b')]})[_0x63fc('0x17')](function(_0x46485c){if(_0x46485c['length']===0x1){return _0x543582['id'];}else{var _0x21da38=_[_0x63fc('0x6c')](_[_0x63fc('0x4d')](_0x46485c,_0x63fc('0x6d')),function(_0x559626){return _[_0x63fc('0x6e')](_0xa60f2e,_0x559626);});if(_0x21da38){return _0x543582['id'];}}}));}}return BPromise[_0x63fc('0x6f')](_0x134388)['then'](function(_0x38c3dc){_0x1ab188=_(_0x1ab188)[_0x63fc('0x70')](_0x38c3dc)['compact']()[_0x63fc('0x71')]();return db[_0x63fc('0x1e')][_0x63fc('0x3d')]({'where':{'id':_0x1b2229[_0x63fc('0x2a')]['id']}})[_0x63fc('0x17')](function(_0x2a2f77){return db[_0x63fc('0x68')][_0x63fc('0x5c')](function(_0x244293){return _0x2a2f77[_0x63fc('0x72')](_0x1b2229[_0x63fc('0x25')][_0x63fc('0x57')],{'transaction':_0x244293})[_0x63fc('0x17')](function(){if(!_[_0x63fc('0x73')](_0x1ab188)){return _0x2a2f77['removeAgents'](_0x1ab188,{'transaction':_0x244293});}})['then'](function(){_0x1ab188[_0x63fc('0x5f')](function(_0x150724){socket[_0x63fc('0x74')](_0x63fc('0x75'),{'UserId':_0x150724,'FaxQueueId':_0x2a2f77['id']});});});});});});})[_0x63fc('0x17')](respondWithStatusCode(_0x1e35d6,null))[_0x63fc('0x28')](handleError(_0x1e35d6,null));};exports[_0x63fc('0x76')]=function(_0x51b610,_0x855ec7){return db[_0x63fc('0x1e')][_0x63fc('0x3d')]({'where':{'id':_0x51b610[_0x63fc('0x2a')]['id']}})[_0x63fc('0x17')](handleEntityNotFound(_0x855ec7,null))['then'](function(_0x4610b4){if(_0x4610b4){return _0x4610b4[_0x63fc('0x76')](_0x51b610['body'][_0x63fc('0x57')],_[_0x63fc('0x77')](_0x51b610[_0x63fc('0x34')],['ids','id'])||{})[_0x63fc('0x78')](function(_0x225c18){for(var _0x5ebfc9=0x0;_0x5ebfc9<_0x51b610[_0x63fc('0x34')][_0x63fc('0x57')][_0x63fc('0x53')];_0x5ebfc9+=0x1){socket[_0x63fc('0x74')]('userFaxQueue:save',{'UserId':Number(_0x51b610['body']['ids'][_0x5ebfc9]),'FaxQueueId':Number(_0x51b610[_0x63fc('0x2a')]['id'])});}return _0x225c18;});}})[_0x63fc('0x17')](respondWithResult(_0x855ec7,null))['catch'](handleError(_0x855ec7,null));};exports[_0x63fc('0x79')]=function(_0x27e49b,_0x2a2660){return db[_0x63fc('0x1e')]['find']({'where':{'id':_0x27e49b['params']['id']}})[_0x63fc('0x17')](handleEntityNotFound(_0x2a2660,null))['then'](function(_0x4c6578){if(_0x4c6578){return _0x4c6578[_0x63fc('0x79')](_0x27e49b[_0x63fc('0x25')][_0x63fc('0x57')])[_0x63fc('0x17')](function(){if(_[_0x63fc('0x7a')](_0x27e49b['query'][_0x63fc('0x57')])){for(var _0x3ca1e6=0x0;_0x3ca1e6<_0x27e49b[_0x63fc('0x25')][_0x63fc('0x57')][_0x63fc('0x53')];_0x3ca1e6+=0x1){socket[_0x63fc('0x74')](_0x63fc('0x75'),{'UserId':Number(_0x27e49b[_0x63fc('0x25')]['ids'][_0x3ca1e6]),'FaxQueueId':Number(_0x27e49b['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x27e49b[_0x63fc('0x25')][_0x63fc('0x57')]),'FaxQueueId':Number(_0x27e49b[_0x63fc('0x2a')]['id'])});}});}})[_0x63fc('0x17')](respondWithStatusCode(_0x2a2660,null))['catch'](handleError(_0x2a2660,null));};exports[_0x63fc('0x7b')]=function(_0x1c707f,_0x1ad5f9){var _0x26ad64={};var _0x4b1d68={};var _0x1da4cb;var _0x417e86;return db['FaxQueue'][_0x63fc('0x40')]({'where':{'id':_0x1c707f[_0x63fc('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1ad5f9,null))[_0x63fc('0x17')](function(_0x5ad271){if(_0x5ad271){_0x1da4cb=_0x5ad271;_0x4b1d68[_0x63fc('0x2b')]=_[_0x63fc('0x2c')](db[_0x63fc('0x49')][_0x63fc('0x1f')]);_0x4b1d68[_0x63fc('0x25')]=_['keys'](_0x1c707f[_0x63fc('0x25')]);_0x4b1d68[_0x63fc('0x2d')]=_[_0x63fc('0x2e')](_0x4b1d68[_0x63fc('0x2b')],_0x4b1d68[_0x63fc('0x25')]);_0x26ad64['attributes']=_[_0x63fc('0x2e')](_0x4b1d68[_0x63fc('0x2b')],qs[_0x63fc('0x2f')](_0x1c707f[_0x63fc('0x25')][_0x63fc('0x2f')]));_0x26ad64[_0x63fc('0x30')]=_0x26ad64['attributes'][_0x63fc('0x53')]?_0x26ad64['attributes']:_0x4b1d68[_0x63fc('0x2b')];_0x26ad64['order']=qs[_0x63fc('0x44')](_0x1c707f['query'][_0x63fc('0x44')]);_0x26ad64[_0x63fc('0x22')]=qs[_0x63fc('0x2d')](_[_0x63fc('0x45')](_0x1c707f[_0x63fc('0x25')],_0x4b1d68[_0x63fc('0x2d')]));if(_0x1c707f[_0x63fc('0x25')]['filter']){_0x26ad64[_0x63fc('0x22')]=_[_0x63fc('0x32')](_0x26ad64['where'],{'$or':_[_0x63fc('0x4d')](_0x26ad64[_0x63fc('0x30')],function(_0x1a547d){var _0x3015e1={};_0x3015e1[_0x1a547d]={'$like':'%'+_0x1c707f[_0x63fc('0x25')][_0x63fc('0x47')]+'%'};return _0x3015e1;})});}_0x26ad64=_[_0x63fc('0x32')]({},_0x26ad64,_0x1c707f[_0x63fc('0x48')]);return _0x1da4cb['getAgents'](_0x26ad64);}})[_0x63fc('0x17')](function(_0x461556){if(_0x461556){_0x417e86=_0x461556[_0x63fc('0x53')];if(!_0x1c707f[_0x63fc('0x25')]['hasOwnProperty'](_0x63fc('0x42'))){_0x26ad64[_0x63fc('0x12')]=qs[_0x63fc('0x12')](_0x1c707f[_0x63fc('0x25')][_0x63fc('0x12')]);_0x26ad64[_0x63fc('0x11')]=qs[_0x63fc('0x11')](_0x1c707f[_0x63fc('0x25')][_0x63fc('0x11')]);}return _0x1da4cb['getAgents'](_0x26ad64);}})[_0x63fc('0x17')](function(_0x1c4f06){if(_0x1c4f06){return _0x1c4f06?{'count':_0x417e86,'rows':_0x1c4f06}:null;}})['then'](respondWithResult(_0x1ad5f9,null))[_0x63fc('0x28')](handleError(_0x1ad5f9,null));}; \ No newline at end of file +var _0x6eec=['isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','FaxQueue','include','findAll','rows','catch','model','keys','query','filters','intersection','fields','attributes','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','%s/%s','SIP','faxPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','all','compact','value'];(function(_0x31e4bd,_0xd39c02){var _0x2cdebc=function(_0x387d98){while(--_0x387d98){_0x31e4bd['push'](_0x31e4bd['shift']());}};_0x2cdebc(++_0xd39c02);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var _=require(_0xc6ee('0x2'));var squel=require(_0xc6ee('0x3'));var Redis=require('ioredis');var qs=require(_0xc6ee('0x4'));var logger=require(_0xc6ee('0x5'))('api');var config=require(_0xc6ee('0x6'));var db=require(_0xc6ee('0x7'))['db'];config[_0xc6ee('0x8')]=_[_0xc6ee('0x9')](config[_0xc6ee('0x8')],{'host':_0xc6ee('0xa'),'port':0x18eb});var socket=require(_0xc6ee('0xb'))(new Redis(config[_0xc6ee('0x8')]));require(_0xc6ee('0xc'))['register'](socket);function respondWithStatusCode(_0x5d1421,_0xfcd175){_0xfcd175=_0xfcd175||0xcc;return function(_0x2a4706){if(_0x2a4706){return _0x5d1421['sendStatus'](_0xfcd175);}return _0x5d1421[_0xc6ee('0xd')](_0xfcd175)['end']();};}function respondWithResult(_0x294274,_0x2e999c){_0x2e999c=_0x2e999c||0xc8;return function(_0x405ce3){if(_0x405ce3){return _0x294274[_0xc6ee('0xd')](_0x2e999c)['json'](_0x405ce3);}};}function respondWithFilteredResult(_0x122a94,_0x1727a7){return function(_0xe87f07){if(_0xe87f07){var _0x4b415c=typeof _0x1727a7[_0xc6ee('0xe')]===_0xc6ee('0xf')&&typeof _0x1727a7[_0xc6ee('0x10')]==='undefined';var _0x2380d2=_0xe87f07[_0xc6ee('0x11')];var _0x42fb9c=_0x4b415c?0x0:_0x1727a7['offset'];var _0xe04579=_0x4b415c?_0xe87f07[_0xc6ee('0x11')]:_0x1727a7[_0xc6ee('0xe')]+_0x1727a7['limit'];var _0x43ef07;if(_0xe04579>=_0x2380d2){_0xe04579=_0x2380d2;_0x43ef07=0xc8;}else{_0x43ef07=0xce;}_0x122a94[_0xc6ee('0xd')](_0x43ef07);return _0x122a94[_0xc6ee('0x12')](_0xc6ee('0x13'),_0x42fb9c+'-'+_0xe04579+'/'+_0x2380d2)[_0xc6ee('0x14')](_0xe87f07);}return null;};}function saveUpdates(_0x18fea5){return function(_0x26b187){if(_0x26b187){return _0x26b187[_0xc6ee('0x15')](_0x18fea5)[_0xc6ee('0x16')](function(_0x26862c){return _0x26862c;});}return null;};}function removeEntity(_0x2ca012){return function(_0x27818f){if(_0x27818f){return _0x27818f[_0xc6ee('0x17')]()[_0xc6ee('0x16')](function(){var _0x14d899=_0x27818f[_0xc6ee('0x18')]({'plain':!![]});var _0x1997cd=_0xc6ee('0x19');return db[_0xc6ee('0x1a')][_0xc6ee('0x17')]({'where':{'type':_0x1997cd,'resourceId':_0x14d899['id']}})[_0xc6ee('0x16')](function(){return _0x27818f;});})['then'](function(){_0x2ca012[_0xc6ee('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525e66){return function(_0x3beb1e){if(!_0x3beb1e){_0x525e66[_0xc6ee('0x1b')](0x194);}return _0x3beb1e;};}function handleError(_0x459db2,_0x561d66){_0x561d66=_0x561d66||0x1f4;return function(_0x8247b0){logger['error'](_0x8247b0[_0xc6ee('0x1c')]);if(_0x8247b0['name']){delete _0x8247b0[_0xc6ee('0x1d')];}_0x459db2[_0xc6ee('0xd')](_0x561d66)[_0xc6ee('0x1e')](_0x8247b0);};}exports[_0xc6ee('0x1f')]=function(_0x1b48a4,_0xfe2627){var _0x5f57cc={};var _0x5240e2={'count':0x0,'rows':[]};var _0x3ec62b=_[_0xc6ee('0x20')](db['FaxQueue'][_0xc6ee('0x21')],function(_0x5674c6){return{'name':_0x5674c6[_0xc6ee('0x22')],'type':_0x5674c6[_0xc6ee('0x23')][_0xc6ee('0x24')]};});_0x5f57cc=qs['getOptions'](_0x3ec62b,_0x1b48a4);var _0x29757f={'where':_0x5f57cc[_0xc6ee('0x25')]};return db[_0xc6ee('0x26')][_0xc6ee('0x11')](_0x29757f)[_0xc6ee('0x16')](function(_0x3c9ece){_0x5240e2[_0xc6ee('0x11')]=_0x3c9ece;_0x5f57cc['include']=qs[_0xc6ee('0x27')](_0x1b48a4['query']);return db[_0xc6ee('0x26')][_0xc6ee('0x28')](_0x5f57cc);})[_0xc6ee('0x16')](function(_0x425bb7){_0x5240e2[_0xc6ee('0x29')]=_0x425bb7;return _0x5240e2;})['then'](respondWithFilteredResult(_0xfe2627,_0x5f57cc))[_0xc6ee('0x2a')](handleError(_0xfe2627,null));};exports['show']=function(_0x2702f3,_0x9b269f){var _0x46b964={'raw':!![],'where':{'id':_0x2702f3['params']['id']}},_0x2e0526={};_0x2e0526[_0xc6ee('0x2b')]=_[_0xc6ee('0x2c')](db['FaxQueue'][_0xc6ee('0x21')]);_0x2e0526['query']=_[_0xc6ee('0x2c')](_0x2702f3[_0xc6ee('0x2d')]);_0x2e0526[_0xc6ee('0x2e')]=_[_0xc6ee('0x2f')](_0x2e0526[_0xc6ee('0x2b')],_0x2e0526['query']);_0x46b964['attributes']=_[_0xc6ee('0x2f')](_0x2e0526['model'],qs[_0xc6ee('0x30')](_0x2702f3[_0xc6ee('0x2d')][_0xc6ee('0x30')]));_0x46b964[_0xc6ee('0x31')]=_0x46b964[_0xc6ee('0x31')][_0xc6ee('0x32')]?_0x46b964[_0xc6ee('0x31')]:_0x2e0526[_0xc6ee('0x2b')];if(_0x2702f3['query']['includeAll']){_0x46b964[_0xc6ee('0x27')]=[{'all':!![]}];}_0x46b964=_[_0xc6ee('0x33')]({},_0x46b964,_0x2702f3[_0xc6ee('0x34')]);return db[_0xc6ee('0x26')]['find'](_0x46b964)[_0xc6ee('0x16')](handleEntityNotFound(_0x9b269f,null))[_0xc6ee('0x16')](respondWithResult(_0x9b269f,null))[_0xc6ee('0x2a')](handleError(_0x9b269f,null));};exports[_0xc6ee('0x35')]=function(_0x19bbb0,_0x148a74){return db['FaxQueue']['create'](_0x19bbb0[_0xc6ee('0x36')],{})['then'](function(_0x526043){var _0x185a19=_0x19bbb0[_0xc6ee('0x37')][_0xc6ee('0x18')]({'plain':!![]});if(!_0x185a19)throw new Error(_0xc6ee('0x38'));if(_0x185a19['role']===_0xc6ee('0x37')){var _0x2a577b=_0x526043[_0xc6ee('0x18')]({'plain':!![]});var _0x969c3c=_0xc6ee('0x19');return db[_0xc6ee('0x39')]['find']({'where':{'name':_0x969c3c,'userProfileId':_0x185a19[_0xc6ee('0x3a')]},'raw':!![]})[_0xc6ee('0x16')](function(_0x300018){if(_0x300018&&_0x300018[_0xc6ee('0x3b')]===0x0){return db['UserProfileResource'][_0xc6ee('0x35')]({'name':_0x2a577b['name'],'resourceId':_0x2a577b['id'],'type':_0x300018[_0xc6ee('0x1d')],'sectionId':_0x300018['id']},{})[_0xc6ee('0x16')](function(){return _0x526043;});}else{return _0x526043;}})['catch'](function(_0x5c6452){logger['error'](_0xc6ee('0x3c'),_0x5c6452);throw _0x5c6452;});}return _0x526043;})[_0xc6ee('0x16')](respondWithResult(_0x148a74,0xc9))['catch'](handleError(_0x148a74,null));};exports['update']=function(_0x4d8b7a,_0x5a0c22){if(_0x4d8b7a['body']['id']){delete _0x4d8b7a[_0xc6ee('0x36')]['id'];}return db[_0xc6ee('0x26')][_0xc6ee('0x3d')]({'where':{'id':_0x4d8b7a['params']['id']}})['then'](handleEntityNotFound(_0x5a0c22,null))['then'](saveUpdates(_0x4d8b7a['body'],null))['then'](respondWithResult(_0x5a0c22,null))['catch'](handleError(_0x5a0c22,null));};exports['destroy']=function(_0x1a1bf2,_0x55f159){return db['FaxQueue'][_0xc6ee('0x3d')]({'where':{'id':_0x1a1bf2[_0xc6ee('0x3e')]['id']}})[_0xc6ee('0x16')](handleEntityNotFound(_0x55f159,null))[_0xc6ee('0x16')](removeEntity(_0x55f159,null))[_0xc6ee('0x2a')](handleError(_0x55f159,null));};exports[_0xc6ee('0x3f')]=function(_0x5d5afc,_0x1ffe0c){return db[_0xc6ee('0x26')]['describe']()['then'](respondWithResult(_0x1ffe0c,null))[_0xc6ee('0x2a')](handleError(_0x1ffe0c,null));};exports[_0xc6ee('0x40')]=function(_0x43b9cf,_0xbf853a){var _0x124a5b={'raw':!![],'where':{}},_0x38cb59={},_0x5ae2e5;return db[_0xc6ee('0x26')][_0xc6ee('0x41')]({'where':{'id':_0x43b9cf[_0xc6ee('0x3e')]['id']}})['then'](handleEntityNotFound(_0xbf853a,null))[_0xc6ee('0x16')](function(_0x4f8784){if(_0x4f8784){_0x5ae2e5=_0x4f8784[_0xc6ee('0x18')]({'plain':!![]});_0x38cb59[_0xc6ee('0x2b')]=_[_0xc6ee('0x2c')](db[_0xc6ee('0x42')][_0xc6ee('0x21')]);_0x38cb59[_0xc6ee('0x2d')]=_[_0xc6ee('0x2c')](_0x43b9cf[_0xc6ee('0x2d')]);_0x38cb59['filters']=_['intersection'](_0x38cb59[_0xc6ee('0x2b')],_0x38cb59[_0xc6ee('0x2d')]);_0x124a5b[_0xc6ee('0x31')]=_[_0xc6ee('0x2f')](_0x38cb59['model'],qs['fields'](_0x43b9cf['query'][_0xc6ee('0x30')]));_0x124a5b[_0xc6ee('0x31')]=_0x124a5b['attributes']['length']?_0x124a5b['attributes']:_0x38cb59[_0xc6ee('0x2b')];if(!_0x43b9cf['query'][_0xc6ee('0x43')](_0xc6ee('0x44'))){_0x124a5b['limit']=qs['limit'](_0x43b9cf['query'][_0xc6ee('0x10')]);_0x124a5b[_0xc6ee('0xe')]=qs['offset'](_0x43b9cf['query'][_0xc6ee('0xe')]);}_0x124a5b[_0xc6ee('0x45')]=qs[_0xc6ee('0x46')](_0x43b9cf['query'][_0xc6ee('0x46')]);_0x124a5b['where']=qs[_0xc6ee('0x2e')](_[_0xc6ee('0x47')](_0x43b9cf[_0xc6ee('0x2d')],_0x38cb59[_0xc6ee('0x2e')]));_0x124a5b['where'][_0xc6ee('0x48')]=_0x4f8784['id'];if(_0x43b9cf[_0xc6ee('0x2d')][_0xc6ee('0x49')]){_0x124a5b[_0xc6ee('0x25')]=_[_0xc6ee('0x33')](_0x124a5b['where'],{'$or':_['map'](_0x124a5b[_0xc6ee('0x31')],function(_0xafdbe7){var _0x1a2dd5={};_0x1a2dd5[_0xafdbe7]={'$like':'%'+_0x43b9cf[_0xc6ee('0x2d')][_0xc6ee('0x49')]+'%'};return _0x1a2dd5;})});}_0x124a5b=_[_0xc6ee('0x33')]({},_0x124a5b,_0x43b9cf[_0xc6ee('0x34')]);return db[_0xc6ee('0x42')][_0xc6ee('0x28')](_0x124a5b);}})[_0xc6ee('0x16')](function(_0x5358a9){if(_0x5358a9){return db[_0xc6ee('0x4a')][_0xc6ee('0x4b')]({'where':{'id':_['map'](_0x5358a9,'UserId'),'role':_0xc6ee('0x4c')},'attributes':['id','name','faxPause',_0xc6ee('0x4d'),_0xc6ee('0x4e')]});}})[_0xc6ee('0x16')](function(_0x4b9c54){if(_0x4b9c54){return{'count':_0x4b9c54[_0xc6ee('0x11')],'rows':_[_0xc6ee('0x20')](_0x4b9c54['rows'],function(_0x408104){return{'membername':_0x408104['name'],'UserId':_0x408104['id'],'queue_name':_0x5ae2e5['name'],'FaxQueueId':_0x5ae2e5['id'],'interface':util['format'](_0xc6ee('0x4f'),_0xc6ee('0x50'),_0x408104[_0xc6ee('0x1d')]),'penalty':0x0,'paused':_0x408104[_0xc6ee('0x51')],'createdAt':_0x408104[_0xc6ee('0x4e')],'updatedAt':_0x408104[_0xc6ee('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6ee('0x16')](respondWithFilteredResult(_0xbf853a,_0x124a5b))['catch'](handleError(_0xbf853a,null));};exports[_0xc6ee('0x52')]=function(_0x1108b0,_0x4b198d){var _0x2cd6c6={};var _0x2ca821={};var _0x306a02;var _0x192ee5;return db[_0xc6ee('0x26')][_0xc6ee('0x41')]({'where':{'id':_0x1108b0[_0xc6ee('0x3e')]['id']}})[_0xc6ee('0x16')](handleEntityNotFound(_0x4b198d,null))['then'](function(_0x1e707b){if(_0x1e707b){_0x306a02=_0x1e707b;_0x2ca821[_0xc6ee('0x2b')]=_[_0xc6ee('0x2c')](db[_0xc6ee('0x53')][_0xc6ee('0x21')]);_0x2ca821[_0xc6ee('0x2d')]=_[_0xc6ee('0x2c')](_0x1108b0[_0xc6ee('0x2d')]);_0x2ca821[_0xc6ee('0x2e')]=_[_0xc6ee('0x2f')](_0x2ca821['model'],_0x2ca821[_0xc6ee('0x2d')]);_0x2cd6c6[_0xc6ee('0x31')]=_[_0xc6ee('0x2f')](_0x2ca821[_0xc6ee('0x2b')],qs[_0xc6ee('0x30')](_0x1108b0['query'][_0xc6ee('0x30')]));_0x2cd6c6['attributes']=_0x2cd6c6['attributes']['length']?_0x2cd6c6[_0xc6ee('0x31')]:_0x2ca821[_0xc6ee('0x2b')];_0x2cd6c6['order']=qs[_0xc6ee('0x46')](_0x1108b0['query']['sort']);_0x2cd6c6[_0xc6ee('0x25')]=qs[_0xc6ee('0x2e')](_[_0xc6ee('0x47')](_0x1108b0[_0xc6ee('0x2d')],_0x2ca821[_0xc6ee('0x2e')]));if(_0x1108b0['query']['filter']){_0x2cd6c6['where']=_[_0xc6ee('0x33')](_0x2cd6c6[_0xc6ee('0x25')],{'$or':_[_0xc6ee('0x20')](_0x2cd6c6[_0xc6ee('0x31')],function(_0x229e08){var _0xe35b6f={};_0xe35b6f[_0x229e08]={'$like':'%'+_0x1108b0[_0xc6ee('0x2d')][_0xc6ee('0x49')]+'%'};return _0xe35b6f;})});}_0x2cd6c6=_['merge']({},_0x2cd6c6,_0x1108b0['options']);return _0x306a02['getTeams'](_0x2cd6c6);}})['then'](function(_0x577250){if(_0x577250){_0x192ee5=_0x577250[_0xc6ee('0x32')];if(!_0x1108b0[_0xc6ee('0x2d')]['hasOwnProperty'](_0xc6ee('0x44'))){_0x2cd6c6[_0xc6ee('0x10')]=qs[_0xc6ee('0x10')](_0x1108b0[_0xc6ee('0x2d')][_0xc6ee('0x10')]);_0x2cd6c6[_0xc6ee('0xe')]=qs['offset'](_0x1108b0['query'][_0xc6ee('0xe')]);}return _0x306a02[_0xc6ee('0x52')](_0x2cd6c6);}})[_0xc6ee('0x16')](function(_0x5720cc){if(_0x5720cc){return _0x5720cc?{'count':_0x192ee5,'rows':_0x5720cc}:null;}})[_0xc6ee('0x16')](respondWithResult(_0x4b198d,null))['catch'](handleError(_0x4b198d,null));};exports[_0xc6ee('0x54')]=function(_0x49ac50,_0x27248c){var _0x2b4223=_0x49ac50[_0xc6ee('0x36')][_0xc6ee('0x55')];return db[_0xc6ee('0x53')][_0xc6ee('0x28')]({'where':{'id':_0x2b4223},'attributes':['id'],'include':[{'model':db[_0xc6ee('0x4a')],'as':_0xc6ee('0x56'),'attributes':['id','name',_0xc6ee('0x57'),_0xc6ee('0x58'),_0xc6ee('0x59')],'raw':!![]}]})['then'](function(_0x1e7567){if(_0x1e7567){var _0x3cbc05=_[_0xc6ee('0x5a')](_0x1e7567,function(_0x9ef9d5){var _0x4c50ed=_0x9ef9d5[_0xc6ee('0x18')]({'plain':!![]});return _0x4c50ed[_0xc6ee('0x56')];});return db[_0xc6ee('0x26')]['find']({'where':{'id':_0x49ac50[_0xc6ee('0x3e')]['id']}})[_0xc6ee('0x16')](function(_0x4b722a){return db[_0xc6ee('0x5b')][_0xc6ee('0x5c')](function(_0x636040){return _0x4b722a[_0xc6ee('0x54')](_0x2b4223,{'transaction':_0x636040})[_0xc6ee('0x16')](function(){return BPromise[_0xc6ee('0x5d')](_0x3cbc05,function(_0x34a046){return db[_0xc6ee('0x42')]['findOrCreate']({'where':{'UserId':_0x34a046['id'],'FaxQueueId':_0x49ac50[_0xc6ee('0x3e')]['id']},'transaction':_0x636040});});})[_0xc6ee('0x16')](function(){_0x3cbc05[_0xc6ee('0x5e')](function(_0x1e4a38){socket[_0xc6ee('0x5f')](_0xc6ee('0x60'),{'UserId':_0x1e4a38['id'],'FaxQueueId':_0x4b722a['id']});});});});});}})['then'](respondWithStatusCode(_0x27248c,null))['catch'](handleError(_0x27248c,null));};exports['removeTeams']=function(_0x3c2e8f,_0x1bf18c){return db[_0xc6ee('0x53')][_0xc6ee('0x28')]({'where':{'id':_0x3c2e8f[_0xc6ee('0x2d')][_0xc6ee('0x55')]},'attributes':['id'],'include':[{'model':db[_0xc6ee('0x4a')],'as':_0xc6ee('0x56'),'attributes':['id'],'raw':!![]}]})[_0xc6ee('0x16')](handleEntityNotFound(_0x1bf18c,null))[_0xc6ee('0x16')](function(_0x4b6a81){var _0x50404b=_[_0xc6ee('0x20')](_0x4b6a81,'id');var _0x3ab874=[];var _0x2c05d6=[];var _0x5aef5e=squel['select']();_0x5aef5e[_0xc6ee('0x61')](_0xc6ee('0x62'))['from']('team_has_fax_queues','tq')['join'](_0xc6ee('0x63'),'ut',_0xc6ee('0x64'))[_0xc6ee('0x25')](_0xc6ee('0x65'),_0x3c2e8f['params']['id']);for(var _0x2e2e47=0x0;_0x2e2e47<_0x4b6a81[_0xc6ee('0x32')];_0x2e2e47+=0x1){let _0xe416e9=_0x4b6a81[_0x2e2e47];for(var _0x47d35a=0x0;_0x47d35a<_0xe416e9[_0xc6ee('0x56')][_0xc6ee('0x32')];_0x47d35a+=0x1){let _0x5460cc=_0xe416e9[_0xc6ee('0x56')][_0x47d35a];var _0x4a193f=_0x5aef5e[_0xc6ee('0x66')]();_0x4a193f[_0xc6ee('0x25')](_0xc6ee('0x67'),_0x5460cc['id']);_0x2c05d6[_0xc6ee('0x68')](db[_0xc6ee('0x5b')][_0xc6ee('0x2d')](_0x4a193f[_0xc6ee('0x69')](),{'type':db[_0xc6ee('0x5b')]['QueryTypes']['SELECT']})[_0xc6ee('0x16')](function(_0x17ea1a){if(_0x17ea1a['length']===0x1){return _0x5460cc['id'];}else{var _0x411f9d=_[_0xc6ee('0x6a')](_[_0xc6ee('0x20')](_0x17ea1a,'TeamId'),function(_0x2f3536){return _['includes'](_0x50404b,_0x2f3536);});if(_0x411f9d){return _0x5460cc['id'];}}}));}}return BPromise[_0xc6ee('0x6b')](_0x2c05d6)[_0xc6ee('0x16')](function(_0x2e4390){_0x3ab874=_(_0x3ab874)['union'](_0x2e4390)[_0xc6ee('0x6c')]()[_0xc6ee('0x6d')]();return db['FaxQueue'][_0xc6ee('0x3d')]({'where':{'id':_0x3c2e8f[_0xc6ee('0x3e')]['id']}})[_0xc6ee('0x16')](function(_0x5c11da){return db['sequelize'][_0xc6ee('0x5c')](function(_0x44e4cc){return _0x5c11da['removeTeams'](_0x3c2e8f['query'][_0xc6ee('0x55')],{'transaction':_0x44e4cc})['then'](function(){if(!_[_0xc6ee('0x6e')](_0x3ab874)){return _0x5c11da[_0xc6ee('0x6f')](_0x3ab874,{'transaction':_0x44e4cc});}})['then'](function(){_0x3ab874[_0xc6ee('0x5e')](function(_0x294fc4){socket[_0xc6ee('0x5f')](_0xc6ee('0x70'),{'UserId':_0x294fc4,'FaxQueueId':_0x5c11da['id']});});});});});});})[_0xc6ee('0x16')](respondWithStatusCode(_0x1bf18c,null))[_0xc6ee('0x2a')](handleError(_0x1bf18c,null));};exports[_0xc6ee('0x71')]=function(_0x2970c0,_0x2fe2d5){return db[_0xc6ee('0x26')][_0xc6ee('0x3d')]({'where':{'id':_0x2970c0[_0xc6ee('0x3e')]['id']}})[_0xc6ee('0x16')](handleEntityNotFound(_0x2fe2d5,null))[_0xc6ee('0x16')](function(_0x3928f1){if(_0x3928f1){return _0x3928f1[_0xc6ee('0x71')](_0x2970c0[_0xc6ee('0x36')][_0xc6ee('0x55')],_[_0xc6ee('0x72')](_0x2970c0[_0xc6ee('0x36')],[_0xc6ee('0x55'),'id'])||{})[_0xc6ee('0x73')](function(_0x2385c9){for(var _0x2966c8=0x0;_0x2966c8<_0x2970c0['body'][_0xc6ee('0x55')][_0xc6ee('0x32')];_0x2966c8+=0x1){socket[_0xc6ee('0x5f')](_0xc6ee('0x60'),{'UserId':Number(_0x2970c0[_0xc6ee('0x36')][_0xc6ee('0x55')][_0x2966c8]),'FaxQueueId':Number(_0x2970c0[_0xc6ee('0x3e')]['id'])});}return _0x2385c9;});}})[_0xc6ee('0x16')](respondWithResult(_0x2fe2d5,null))[_0xc6ee('0x2a')](handleError(_0x2fe2d5,null));};exports[_0xc6ee('0x6f')]=function(_0x384db5,_0x129035){return db[_0xc6ee('0x26')][_0xc6ee('0x3d')]({'where':{'id':_0x384db5[_0xc6ee('0x3e')]['id']}})[_0xc6ee('0x16')](handleEntityNotFound(_0x129035,null))[_0xc6ee('0x16')](function(_0x380971){if(_0x380971){return _0x380971['removeAgents'](_0x384db5[_0xc6ee('0x2d')]['ids'])[_0xc6ee('0x16')](function(){if(_[_0xc6ee('0x74')](_0x384db5[_0xc6ee('0x2d')][_0xc6ee('0x55')])){for(var _0x30e9fd=0x0;_0x30e9fd<_0x384db5['query'][_0xc6ee('0x55')][_0xc6ee('0x32')];_0x30e9fd+=0x1){socket[_0xc6ee('0x5f')](_0xc6ee('0x70'),{'UserId':Number(_0x384db5[_0xc6ee('0x2d')][_0xc6ee('0x55')][_0x30e9fd]),'FaxQueueId':Number(_0x384db5[_0xc6ee('0x3e')]['id'])});}}else{socket[_0xc6ee('0x5f')]('userFaxQueue:remove',{'UserId':Number(_0x384db5[_0xc6ee('0x2d')]['ids']),'FaxQueueId':Number(_0x384db5[_0xc6ee('0x3e')]['id'])});}});}})['then'](respondWithStatusCode(_0x129035,null))[_0xc6ee('0x2a')](handleError(_0x129035,null));};exports[_0xc6ee('0x75')]=function(_0x2546cc,_0x21ad9e){var _0x55d720={};var _0x554c69={};var _0x326373;var _0xcf06b5;return db[_0xc6ee('0x26')][_0xc6ee('0x41')]({'where':{'id':_0x2546cc[_0xc6ee('0x3e')]['id']}})[_0xc6ee('0x16')](handleEntityNotFound(_0x21ad9e,null))[_0xc6ee('0x16')](function(_0x16ca4d){if(_0x16ca4d){_0x326373=_0x16ca4d;_0x554c69[_0xc6ee('0x2b')]=_[_0xc6ee('0x2c')](db[_0xc6ee('0x4a')]['rawAttributes']);_0x554c69['query']=_[_0xc6ee('0x2c')](_0x2546cc[_0xc6ee('0x2d')]);_0x554c69[_0xc6ee('0x2e')]=_[_0xc6ee('0x2f')](_0x554c69['model'],_0x554c69[_0xc6ee('0x2d')]);_0x55d720[_0xc6ee('0x31')]=_['intersection'](_0x554c69[_0xc6ee('0x2b')],qs[_0xc6ee('0x30')](_0x2546cc[_0xc6ee('0x2d')][_0xc6ee('0x30')]));_0x55d720[_0xc6ee('0x31')]=_0x55d720['attributes'][_0xc6ee('0x32')]?_0x55d720['attributes']:_0x554c69[_0xc6ee('0x2b')];_0x55d720[_0xc6ee('0x45')]=qs['sort'](_0x2546cc['query'][_0xc6ee('0x46')]);_0x55d720[_0xc6ee('0x25')]=qs[_0xc6ee('0x2e')](_[_0xc6ee('0x47')](_0x2546cc[_0xc6ee('0x2d')],_0x554c69['filters']));if(_0x2546cc['query'][_0xc6ee('0x49')]){_0x55d720[_0xc6ee('0x25')]=_[_0xc6ee('0x33')](_0x55d720[_0xc6ee('0x25')],{'$or':_[_0xc6ee('0x20')](_0x55d720['attributes'],function(_0x770a2b){var _0x3d2248={};_0x3d2248[_0x770a2b]={'$like':'%'+_0x2546cc['query']['filter']+'%'};return _0x3d2248;})});}_0x55d720=_[_0xc6ee('0x33')]({},_0x55d720,_0x2546cc[_0xc6ee('0x34')]);return _0x326373[_0xc6ee('0x75')](_0x55d720);}})['then'](function(_0x1cedf5){if(_0x1cedf5){_0xcf06b5=_0x1cedf5[_0xc6ee('0x32')];if(!_0x2546cc[_0xc6ee('0x2d')]['hasOwnProperty'](_0xc6ee('0x44'))){_0x55d720[_0xc6ee('0x10')]=qs[_0xc6ee('0x10')](_0x2546cc[_0xc6ee('0x2d')][_0xc6ee('0x10')]);_0x55d720[_0xc6ee('0xe')]=qs[_0xc6ee('0xe')](_0x2546cc[_0xc6ee('0x2d')][_0xc6ee('0xe')]);}return _0x326373[_0xc6ee('0x75')](_0x55d720);}})['then'](function(_0x21965c){if(_0x21965c){return _0x21965c?{'count':_0xcf06b5,'rows':_0x21965c}:null;}})[_0xc6ee('0x16')](respondWithResult(_0x21ad9e,null))[_0xc6ee('0x2a')](handleError(_0x21ad9e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index aef3368..fe41a86 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 _0xe635=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x90ae4b,_0x40a3b6){var _0x23e212=function(_0xdf876b){while(--_0xdf876b){_0x90ae4b['push'](_0x90ae4b['shift']());}};_0x23e212(++_0x40a3b6);}(_0xe635,0x185));var _0x5e63=function(_0x19da88,_0x2f2280){_0x19da88=_0x19da88-0x0;var _0x36ed9b=_0xe635[_0x19da88];return _0x36ed9b;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x5e63('0x0'))['db'][_0x5e63('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5e63('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e63('0x3'),'afterDestroy':_0x5e63('0x4')};function emitEvent(_0x1fd4e8){return function(_0x1455b1,_0x451c0f,_0x1590c9){FaxQueueEvents['emit'](_0x1fd4e8+':'+_0x1455b1['id'],_0x1455b1);FaxQueueEvents[_0x5e63('0x5')](_0x1fd4e8,_0x1455b1);_0x1590c9(null);};}for(var e in events){if(events[_0x5e63('0x6')](e)){var event=events[e];FaxQueue[_0x5e63('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xeb41=['emit','hasOwnProperty','hook','exports','events','FaxQueue','save'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xeb41,0x1a1));var _0x1eb4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xeb41[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x1eb4('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x1eb4('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1eb4('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x319070){return function(_0x31d918,_0x54da67,_0x5bea0d){FaxQueueEvents[_0x1eb4('0x3')](_0x319070+':'+_0x31d918['id'],_0x31d918);FaxQueueEvents['emit'](_0x319070,_0x31d918);_0x5bea0d(null);};}for(var e in events){if(events[_0x1eb4('0x4')](e)){var event=events[e];FaxQueue[_0x1eb4('0x5')](e,emitEvent(event));}}module[_0x1eb4('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index bacd7d3..9ce0ad3 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 _0x9c17=['exports','define','FaxQueue','fax_queues','util','../../config/logger','api','request-promise','../../config/environment','./faxQueue.attributes'];(function(_0x23e505,_0x241c28){var _0x17a476=function(_0x80780e){while(--_0x80780e){_0x23e505['push'](_0x23e505['shift']());}};_0x17a476(++_0x241c28);}(_0x9c17,0x112));var _0x79c1=function(_0xe65ac8,_0x2691be){_0xe65ac8=_0xe65ac8-0x0;var _0x202ba1=_0x9c17[_0xe65ac8];return _0x202ba1;};'use strict';var _=require('lodash');var util=require(_0x79c1('0x0'));var logger=require(_0x79c1('0x1'))(_0x79c1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79c1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x79c1('0x4'));var attributes=require(_0x79c1('0x5'));module[_0x79c1('0x6')]=function(_0x345233,_0x475a25){return _0x345233[_0x79c1('0x7')](_0x79c1('0x8'),attributes,{'tableName':_0x79c1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6619=['bluebird','request-promise','path','define','fax_queues','lodash','util','api','moment'];(function(_0x2ae8f5,_0x5ce818){var _0x454f5d=function(_0x382af1){while(--_0x382af1){_0x2ae8f5['push'](_0x2ae8f5['shift']());}};_0x454f5d(++_0x5ce818);}(_0x6619,0x140));var _0x9661=function(_0x7e10a2,_0x2bc699){_0x7e10a2=_0x7e10a2-0x0;var _0x4ad2be=_0x6619[_0x7e10a2];return _0x4ad2be;};'use strict';var _=require(_0x9661('0x0'));var util=require(_0x9661('0x1'));var logger=require('../../config/logger')(_0x9661('0x2'));var moment=require(_0x9661('0x3'));var BPromise=require(_0x9661('0x4'));var rp=require(_0x9661('0x5'));var fs=require('fs');var path=require(_0x9661('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module['exports']=function(_0x4cce26,_0x4937d1){return _0x4cce26[_0x9661('0x7')]('FaxQueue',attributes,{'tableName':_0x9661('0x8'),'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 b443d71..d81d552 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 _0x2a62=['FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','ShowFaxQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','FaxQueue,\x20%s,\x20%s','catch','GetFaxQueue'];(function(_0x40253e,_0x48fce2){var _0x346e29=function(_0x4e156b){while(--_0x4e156b){_0x40253e['push'](_0x40253e['shift']());}};_0x346e29(++_0x48fce2);}(_0x2a62,0xcb));var _0x22a6=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x2a62[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require(_0x22a6('0x0'));var moment=require(_0x22a6('0x1'));var BPromise=require(_0x22a6('0x2'));var rs=require(_0x22a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22a6('0x4'))['db'];var utils=require(_0x22a6('0x5'));var logger=require('../../config/logger')(_0x22a6('0x6'));var config=require(_0x22a6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x22a6('0x8')]['http']({'port':0x232a});config[_0x22a6('0x9')]=_[_0x22a6('0xa')](config[_0x22a6('0x9')],{'host':_0x22a6('0xb'),'port':0x18eb});var socket=require(_0x22a6('0xc'))(new Redis(config[_0x22a6('0x9')]));require(_0x22a6('0xd'))[_0x22a6('0xe')](socket);function respondWithRpcPromise(_0x4f59d7,_0x472361,_0x549649){return new BPromise(function(_0xca3943,_0x21321a){return client[_0x22a6('0xf')](_0x4f59d7,_0x549649)['then'](function(_0x511f67){logger[_0x22a6('0x10')]('FaxQueue,\x20%s,\x20%s',_0x472361,'request\x20sent');logger['debug'](_0x22a6('0x11'),_0x472361,_0x22a6('0x12'),JSON[_0x22a6('0x13')](_0x511f67));if(_0x511f67[_0x22a6('0x14')]){if(_0x511f67[_0x22a6('0x14')]['code']===0x1f4){logger[_0x22a6('0x14')]('FaxQueue,\x20%s,\x20%s',_0x472361,_0x511f67[_0x22a6('0x14')]['message']);return _0x21321a(_0x511f67['error'][_0x22a6('0x15')]);}logger[_0x22a6('0x14')]('FaxQueue,\x20%s,\x20%s',_0x472361,_0x511f67['error'][_0x22a6('0x15')]);return _0xca3943(_0x511f67[_0x22a6('0x14')][_0x22a6('0x15')]);}else{logger['info'](_0x22a6('0x16'),_0x472361,_0x22a6('0x12'));_0xca3943(_0x511f67['result'][_0x22a6('0x15')]);}})[_0x22a6('0x17')](function(_0x960cd6){logger[_0x22a6('0x14')]('FaxQueue,\x20%s,\x20%s',_0x472361,_0x960cd6);_0x21321a(_0x960cd6);});});}exports[_0x22a6('0x18')]=function(_0x979224){var _0x141657=this;return new Promise(function(_0x482ca2,_0x508a2b){return db[_0x22a6('0x19')][_0x22a6('0x1a')]({'raw':_0x979224[_0x22a6('0x1b')]?_0x979224[_0x22a6('0x1b')][_0x22a6('0x1c')]===undefined?!![]:![]:!![],'where':_0x979224[_0x22a6('0x1b')]?_0x979224['options'][_0x22a6('0x1d')]||null:null,'attributes':_0x979224[_0x22a6('0x1b')]?_0x979224[_0x22a6('0x1b')][_0x22a6('0x1e')]||null:null,'limit':_0x979224[_0x22a6('0x1b')]?_0x979224[_0x22a6('0x1b')][_0x22a6('0x1f')]||null:null,'include':_0x979224[_0x22a6('0x1b')]?_0x979224[_0x22a6('0x1b')]['include']?_[_0x22a6('0x20')](_0x979224[_0x22a6('0x1b')]['include'],function(_0x1bab42){return{'model':db[_0x1bab42['model']],'as':_0x1bab42['as'],'attributes':_0x1bab42[_0x22a6('0x1e')],'include':_0x1bab42[_0x22a6('0x21')]?_[_0x22a6('0x20')](_0x1bab42[_0x22a6('0x21')],function(_0x3386dc){return{'model':db[_0x3386dc['model']],'as':_0x3386dc['as'],'attributes':_0x3386dc[_0x22a6('0x1e')],'include':_0x3386dc[_0x22a6('0x21')]?_[_0x22a6('0x20')](_0x3386dc[_0x22a6('0x21')],function(_0x270e02){return{'model':db[_0x270e02[_0x22a6('0x22')]],'as':_0x270e02['as'],'attributes':_0x270e02['attributes']};}):[]};}):[]};}):[]:[]})[_0x22a6('0x23')](function(_0x3e3401){logger['info'](_0x22a6('0x18'),_0x979224);logger[_0x22a6('0x24')](_0x22a6('0x18'),_0x979224,JSON[_0x22a6('0x13')](_0x3e3401));_0x482ca2(_0x3e3401);})['catch'](function(_0x3458cf){logger['error'](_0x22a6('0x18'),_0x3458cf[_0x22a6('0x15')],_0x979224);_0x508a2b(_0x141657[_0x22a6('0x14')](0x1f4,_0x3458cf[_0x22a6('0x15')]));});});};exports['ShowFaxQueue']=function(_0x2c49db){var _0x4c2ce2=this;return new Promise(function(_0x1bec87,_0x4ab95d){return db[_0x22a6('0x19')]['find']({'raw':_0x2c49db[_0x22a6('0x1b')]?_0x2c49db[_0x22a6('0x1b')][_0x22a6('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c49db['options']?_0x2c49db[_0x22a6('0x1b')][_0x22a6('0x1d')]||null:null,'attributes':_0x2c49db[_0x22a6('0x1b')]?_0x2c49db['options'][_0x22a6('0x1e')]||null:null,'include':_0x2c49db[_0x22a6('0x1b')]?_0x2c49db[_0x22a6('0x1b')]['include']?_['map'](_0x2c49db[_0x22a6('0x1b')][_0x22a6('0x21')],function(_0xceb6a2){return{'model':db[_0xceb6a2[_0x22a6('0x22')]],'as':_0xceb6a2['as'],'attributes':_0xceb6a2['attributes'],'include':_0xceb6a2[_0x22a6('0x21')]?_[_0x22a6('0x20')](_0xceb6a2[_0x22a6('0x21')],function(_0x49e32e){return{'model':db[_0x49e32e['model']],'as':_0x49e32e['as'],'attributes':_0x49e32e['attributes'],'include':_0x49e32e[_0x22a6('0x21')]?_[_0x22a6('0x20')](_0x49e32e[_0x22a6('0x21')],function(_0x55946c){return{'model':db[_0x55946c[_0x22a6('0x22')]],'as':_0x55946c['as'],'attributes':_0x55946c['attributes']};}):[]};}):[]};}):[]:[]})[_0x22a6('0x23')](function(_0x14a748){logger[_0x22a6('0x10')]('ShowFaxQueue',_0x2c49db);logger[_0x22a6('0x24')](_0x22a6('0x25'),_0x2c49db,JSON[_0x22a6('0x13')](_0x14a748));_0x1bec87(_0x14a748);})[_0x22a6('0x17')](function(_0x5d1dd2){logger['error'](_0x22a6('0x25'),_0x5d1dd2[_0x22a6('0x15')],_0x2c49db);_0x4ab95d(_0x4c2ce2[_0x22a6('0x14')](0x1f4,_0x5d1dd2[_0x22a6('0x15')]));});});}; \ No newline at end of file +var _0x10ad=['http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x25b439,_0xb20872){var _0xbf2210=function(_0x518b01){while(--_0x518b01){_0x25b439['push'](_0x25b439['shift']());}};_0xbf2210(++_0xb20872);}(_0x10ad,0xbc));var _0xd10a=function(_0x554426,_0x2f4360){_0x554426=_0x554426-0x0;var _0x49ad51=_0x10ad[_0x554426];return _0x49ad51;};'use strict';var _=require(_0xd10a('0x0'));var util=require(_0xd10a('0x1'));var moment=require(_0xd10a('0x2'));var BPromise=require(_0xd10a('0x3'));var rs=require(_0xd10a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd10a('0x5'))['db'];var utils=require(_0xd10a('0x6'));var logger=require(_0xd10a('0x7'))(_0xd10a('0x8'));var config=require(_0xd10a('0x9'));var jayson=require(_0xd10a('0xa'));var client=jayson[_0xd10a('0xb')][_0xd10a('0xc')]({'port':0x232a});config[_0xd10a('0xd')]=_[_0xd10a('0xe')](config['redis'],{'host':_0xd10a('0xf'),'port':0x18eb});var socket=require(_0xd10a('0x10'))(new Redis(config[_0xd10a('0xd')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x16e9e3,_0x15b261,_0x22cb45){return new BPromise(function(_0x1cbed5,_0x1e1173){return client[_0xd10a('0x11')](_0x16e9e3,_0x22cb45)[_0xd10a('0x12')](function(_0x5ca2aa){logger[_0xd10a('0x13')](_0xd10a('0x14'),_0x15b261,'request\x20sent');logger[_0xd10a('0x15')](_0xd10a('0x16'),_0x15b261,_0xd10a('0x17'),JSON[_0xd10a('0x18')](_0x5ca2aa));if(_0x5ca2aa[_0xd10a('0x19')]){if(_0x5ca2aa[_0xd10a('0x19')][_0xd10a('0x1a')]===0x1f4){logger[_0xd10a('0x19')](_0xd10a('0x14'),_0x15b261,_0x5ca2aa[_0xd10a('0x19')]['message']);return _0x1e1173(_0x5ca2aa[_0xd10a('0x19')][_0xd10a('0x1b')]);}logger[_0xd10a('0x19')](_0xd10a('0x14'),_0x15b261,_0x5ca2aa[_0xd10a('0x19')]['message']);return _0x1cbed5(_0x5ca2aa[_0xd10a('0x19')][_0xd10a('0x1b')]);}else{logger[_0xd10a('0x13')](_0xd10a('0x14'),_0x15b261,_0xd10a('0x17'));_0x1cbed5(_0x5ca2aa['result'][_0xd10a('0x1b')]);}})[_0xd10a('0x1c')](function(_0xd40d63){logger[_0xd10a('0x19')](_0xd10a('0x14'),_0x15b261,_0xd40d63);_0x1e1173(_0xd40d63);});});}exports[_0xd10a('0x1d')]=function(_0xc295de){var _0x2ee625=this;return new Promise(function(_0x44e6bf,_0x51ef1d){return db[_0xd10a('0x1e')]['findAll']({'raw':_0xc295de[_0xd10a('0x1f')]?_0xc295de[_0xd10a('0x1f')][_0xd10a('0x20')]===undefined?!![]:![]:!![],'where':_0xc295de[_0xd10a('0x1f')]?_0xc295de[_0xd10a('0x1f')][_0xd10a('0x21')]||null:null,'attributes':_0xc295de[_0xd10a('0x1f')]?_0xc295de['options'][_0xd10a('0x22')]||null:null,'limit':_0xc295de[_0xd10a('0x1f')]?_0xc295de['options'][_0xd10a('0x23')]||null:null,'include':_0xc295de[_0xd10a('0x1f')]?_0xc295de[_0xd10a('0x1f')][_0xd10a('0x24')]?_[_0xd10a('0x25')](_0xc295de['options'][_0xd10a('0x24')],function(_0x338598){return{'model':db[_0x338598[_0xd10a('0x26')]],'as':_0x338598['as'],'attributes':_0x338598[_0xd10a('0x22')],'include':_0x338598['include']?_[_0xd10a('0x25')](_0x338598['include'],function(_0x4eb156){return{'model':db[_0x4eb156['model']],'as':_0x4eb156['as'],'attributes':_0x4eb156['attributes'],'include':_0x4eb156['include']?_[_0xd10a('0x25')](_0x4eb156[_0xd10a('0x24')],function(_0x4dda06){return{'model':db[_0x4dda06[_0xd10a('0x26')]],'as':_0x4dda06['as'],'attributes':_0x4dda06[_0xd10a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd10a('0x12')](function(_0x3d3c62){logger[_0xd10a('0x13')](_0xd10a('0x1d'),_0xc295de);logger[_0xd10a('0x15')](_0xd10a('0x1d'),_0xc295de,JSON[_0xd10a('0x18')](_0x3d3c62));_0x44e6bf(_0x3d3c62);})[_0xd10a('0x1c')](function(_0x1589be){logger[_0xd10a('0x19')](_0xd10a('0x1d'),_0x1589be['message'],_0xc295de);_0x51ef1d(_0x2ee625[_0xd10a('0x19')](0x1f4,_0x1589be[_0xd10a('0x1b')]));});});};exports['ShowFaxQueue']=function(_0x421060){var _0x4db87d=this;return new Promise(function(_0x161815,_0x17a3bd){return db[_0xd10a('0x1e')]['find']({'raw':_0x421060[_0xd10a('0x1f')]?_0x421060['options'][_0xd10a('0x20')]===undefined?!![]:![]:!![],'where':_0x421060[_0xd10a('0x1f')]?_0x421060[_0xd10a('0x1f')][_0xd10a('0x21')]||null:null,'attributes':_0x421060[_0xd10a('0x1f')]?_0x421060[_0xd10a('0x1f')][_0xd10a('0x22')]||null:null,'include':_0x421060[_0xd10a('0x1f')]?_0x421060[_0xd10a('0x1f')][_0xd10a('0x24')]?_[_0xd10a('0x25')](_0x421060[_0xd10a('0x1f')][_0xd10a('0x24')],function(_0x5cacf9){return{'model':db[_0x5cacf9[_0xd10a('0x26')]],'as':_0x5cacf9['as'],'attributes':_0x5cacf9[_0xd10a('0x22')],'include':_0x5cacf9[_0xd10a('0x24')]?_[_0xd10a('0x25')](_0x5cacf9[_0xd10a('0x24')],function(_0x337502){return{'model':db[_0x337502['model']],'as':_0x337502['as'],'attributes':_0x337502[_0xd10a('0x22')],'include':_0x337502['include']?_[_0xd10a('0x25')](_0x337502[_0xd10a('0x24')],function(_0x220969){return{'model':db[_0x220969[_0xd10a('0x26')]],'as':_0x220969['as'],'attributes':_0x220969[_0xd10a('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9c6d){logger[_0xd10a('0x13')](_0xd10a('0x27'),_0x421060);logger[_0xd10a('0x15')](_0xd10a('0x27'),_0x421060,JSON[_0xd10a('0x18')](_0x5e9c6d));_0x161815(_0x5e9c6d);})['catch'](function(_0x2e742a){logger[_0xd10a('0x19')](_0xd10a('0x27'),_0x2e742a['message'],_0x421060);_0x17a3bd(_0x4db87d['error'](0x1f4,_0x2e742a[_0xd10a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1ee64b3..56ba73d 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 _0xabe7=['register','length','faxQueue:','save','remove','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xabe7,0x1c3));var _0x7abe=function(_0x2cb454,_0x53cf1a){_0x2cb454=_0x2cb454-0x0;var _0x1d4f64=_0xabe7[_0x2cb454];return _0x1d4f64;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x7abe('0x0'),_0x7abe('0x1'),_0x7abe('0x2')];function createListener(_0x3d1a41,_0x1e304d){return function(_0x1a2b51){_0x1e304d[_0x7abe('0x3')](_0x3d1a41,_0x1a2b51);};}function removeListener(_0x27faff,_0x3f8bf8){return function(){FaxQueueEvents[_0x7abe('0x4')](_0x27faff,_0x3f8bf8);};}exports[_0x7abe('0x5')]=function(_0xcac5d1){for(var _0x324837=0x0,_0x3e2736=events[_0x7abe('0x6')];_0x324837<_0x3e2736;_0x324837++){var _0x56cd8d=events[_0x324837];var _0x3830c7=createListener(_0x7abe('0x7')+_0x56cd8d,_0xcac5d1);FaxQueueEvents['on'](_0x56cd8d,_0x3830c7);}}; \ No newline at end of file +var _0xcebf=['remove','update','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x10acdf,_0xa50b51){var _0x476063=function(_0x1b973d){while(--_0x1b973d){_0x10acdf['push'](_0x10acdf['shift']());}};_0x476063(++_0xa50b51);}(_0xcebf,0xd6));var _0xfceb=function(_0x442d41,_0x547170){_0x442d41=_0x442d41-0x0;var _0x45bb52=_0xcebf[_0x442d41];return _0x45bb52;};'use strict';var FaxQueueEvents=require(_0xfceb('0x0'));var events=[_0xfceb('0x1'),_0xfceb('0x2'),_0xfceb('0x3')];function createListener(_0xbd63bd,_0x5b5067){return function(_0x4c06a4){_0x5b5067['emit'](_0xbd63bd,_0x4c06a4);};}function removeListener(_0x1bc3a2,_0x1b7e47){return function(){FaxQueueEvents[_0xfceb('0x4')](_0x1bc3a2,_0x1b7e47);};}exports[_0xfceb('0x5')]=function(_0x931525){for(var _0x261e08=0x0,_0x16b240=events[_0xfceb('0x6')];_0x261e08<_0x16b240;_0x261e08++){var _0x513190=events[_0x261e08];var _0x5e8920=createListener(_0xfceb('0x7')+_0x513190,_0x931525);FaxQueueEvents['on'](_0x513190,_0x5e8920);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 31cedcb..765eeae 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 _0xcf98=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x5decec,_0x4e5761){var _0x35e1b4=function(_0x27066d){while(--_0x27066d){_0x5decec['push'](_0x5decec['shift']());}};_0x35e1b4(++_0x4e5761);}(_0xcf98,0x8d));var _0x8cf9=function(_0x279bb4,_0x3c8a2e){_0x279bb4=_0x279bb4-0x0;var _0x30d8a4=_0xcf98[_0x279bb4];return _0x30d8a4;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var controller=require(_0x8cf9('0x7'));router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0x8')]('/:id',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xd')]);router['get'](_0x8cf9('0xe'),auth['isAuthenticated'](),controller[_0x8cf9('0xf')]);router[_0x8cf9('0x8')](_0x8cf9('0x10'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x11')]);router[_0x8cf9('0x8')](_0x8cf9('0x12'),auth['isAuthenticated'](),controller[_0x8cf9('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8cf9('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8cf9('0x15')]);router[_0x8cf9('0x14')](_0x8cf9('0x12'),auth['isAuthenticated'](),controller[_0x8cf9('0x16')]);router[_0x8cf9('0x17')]('/:id',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x18')]);router[_0x8cf9('0x19')](_0x8cf9('0x1a'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x1b')]);router[_0x8cf9('0x19')](_0x8cf9('0x10'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x1c')]);router[_0x8cf9('0x19')](_0x8cf9('0x12'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x1d')]);module[_0x8cf9('0x1e')]=router; \ No newline at end of file +var _0x8085=['Router','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','connect-timeout','express'];(function(_0x7b73ce,_0x13b3fe){var _0x31a748=function(_0x224d79){while(--_0x224d79){_0x7b73ce['push'](_0x7b73ce['shift']());}};_0x31a748(++_0x13b3fe);}(_0x8085,0x71));var _0x5808=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x8085[_0x28611e];return _0x530f69;};'use strict';var multer=require(_0x5808('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5808('0x1'));var express=require(_0x5808('0x2'));var router=express[_0x5808('0x3')]();var fs_extra=require(_0x5808('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5808('0x5'));var controller=require(_0x5808('0x6'));router['get']('/',auth[_0x5808('0x7')](),controller[_0x5808('0x8')]);router[_0x5808('0x9')](_0x5808('0xa'),auth[_0x5808('0x7')](),controller[_0x5808('0xb')]);router[_0x5808('0x9')](_0x5808('0xc'),auth[_0x5808('0x7')](),controller[_0x5808('0xd')]);router[_0x5808('0x9')](_0x5808('0xe'),auth[_0x5808('0x7')](),controller[_0x5808('0xf')]);router[_0x5808('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5808('0x10')]);router[_0x5808('0x9')](_0x5808('0x11'),auth[_0x5808('0x7')](),controller[_0x5808('0x12')]);router[_0x5808('0x13')]('/',auth[_0x5808('0x7')](),controller['create']);router['post'](_0x5808('0x14'),auth[_0x5808('0x7')](),controller[_0x5808('0x15')]);router[_0x5808('0x13')](_0x5808('0x11'),auth[_0x5808('0x7')](),controller[_0x5808('0x16')]);router[_0x5808('0x17')](_0x5808('0xc'),auth[_0x5808('0x7')](),controller[_0x5808('0x18')]);router['delete'](_0x5808('0xc'),auth['isAuthenticated'](),controller[_0x5808('0x19')]);router[_0x5808('0x1a')](_0x5808('0x14'),auth['isAuthenticated'](),controller[_0x5808('0x1b')]);router[_0x5808('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0x5808('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ec7858b..8e95fc8 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 _0xf9ae=['STRING','DATE','moment','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf9ae,0xa7));var _0xef9a=function(_0x1da4bc,_0x148afa){_0x1da4bc=_0x1da4bc-0x0;var _0x3cb3f9=_0xf9ae[_0x1da4bc];return _0x3cb3f9;};'use strict';var moment=require(_0xef9a('0x0'));var Sequelize=require(_0xef9a('0x1'));module[_0xef9a('0x2')]={'uniqueid':{'type':Sequelize[_0xef9a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xef9a('0x4')]},'leaveAt':{'type':Sequelize[_0xef9a('0x4')]},'acceptAt':{'type':Sequelize[_0xef9a('0x4')]},'exitAt':{'type':Sequelize[_0xef9a('0x4')]},'reason':{'type':Sequelize[_0xef9a('0x3')]}}; \ No newline at end of file +var _0xa48b=['STRING','moment','sequelize','exports','DATE'];(function(_0x57d19e,_0x33f1a8){var _0x1dfa04=function(_0x22df5b){while(--_0x22df5b){_0x57d19e['push'](_0x57d19e['shift']());}};_0x1dfa04(++_0x33f1a8);}(_0xa48b,0xc4));var _0xba48=function(_0x3bb8bd,_0x1aa192){_0x3bb8bd=_0x3bb8bd-0x0;var _0x47461e=_0xa48b[_0x3bb8bd];return _0x47461e;};'use strict';var moment=require(_0xba48('0x0'));var Sequelize=require(_0xba48('0x1'));module[_0xba48('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xba48('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xba48('0x3')]},'reason':{'type':Sequelize[_0xba48('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 89bc4ca..0ea1af2 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 _0xb58b=['save','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x11f85b,_0x1c368d){var _0x573270=function(_0x590e74){while(--_0x590e74){_0x11f85b['push'](_0x11f85b['shift']());}};_0x573270(++_0x1c368d);}(_0xb58b,0x1f1));var _0xbb58=function(_0x385801,_0x1fb29f){_0x385801=_0x385801-0x0;var _0x3817c2=_0xb58b[_0x385801];return _0x3817c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x2d556a,_0x15e4c5){return function(_0x4e0303){if(!_0x4e0303){_0x2d556a[_0xbb58('0x18')](0x194);}return _0x4e0303;};}function handleError(_0x3bd550,_0x1be0ae){_0x1be0ae=_0x1be0ae||0x1f4;return function(_0x129094){logger[_0xbb58('0x27')](_0x129094[_0xbb58('0x28')]);if(_0x129094[_0xbb58('0x29')]){delete _0x129094[_0xbb58('0x29')];}_0x3bd550[_0xbb58('0x19')](_0x1be0ae)[_0xbb58('0x2a')](_0x129094);};}exports[_0xbb58('0x2b')]=function(_0x28b3a3,_0x2a0481){var _0x4157c4={},_0x3559b6={},_0x573cca={'count':0x0,'rows':[]};var _0x2b0f73=_[_0xbb58('0x2c')](db[_0xbb58('0x2d')][_0xbb58('0x2e')],function(_0x3304b9){return{'name':_0x3304b9[_0xbb58('0x2f')],'type':_0x3304b9[_0xbb58('0x30')][_0xbb58('0x31')]};});_0x3559b6[_0xbb58('0x32')]=_['map'](_0x2b0f73,_0xbb58('0x29'));_0x3559b6[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x28b3a3[_0xbb58('0x33')]);_0x3559b6[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],_0x3559b6[_0xbb58('0x33')]);_0x4157c4[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x28b3a3[_0xbb58('0x33')]['fields']));_0x4157c4['attributes']=_0x4157c4['attributes'][_0xbb58('0x39')]?_0x4157c4[_0xbb58('0x37')]:_0x3559b6[_0xbb58('0x32')];if(!_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3a')](_0xbb58('0x3b'))){_0x4157c4[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x28b3a3['query'][_0xbb58('0x1e')]);_0x4157c4[_0xbb58('0x1c')]=qs['offset'](_0x28b3a3[_0xbb58('0x33')]['offset']);}_0x4157c4[_0xbb58('0x3c')]=qs['sort'](_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3d')]);_0x4157c4['where']=qs[_0xbb58('0x35')](_[_0xbb58('0x3e')](_0x28b3a3[_0xbb58('0x33')],_0x3559b6[_0xbb58('0x35')]),_0x2b0f73);if(_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3f')]){_0x4157c4[_0xbb58('0x40')]=_[_0xbb58('0x41')](_0x4157c4['where'],{'$or':_[_0xbb58('0x2c')](_0x2b0f73,function(_0x31aa4b){if(_0x31aa4b[_0xbb58('0x30')]!=='VIRTUAL'){var _0x4dbd5e={};_0x4dbd5e[_0x31aa4b[_0xbb58('0x29')]]={'$like':'%'+_0x28b3a3['query'][_0xbb58('0x3f')]+'%'};return _0x4dbd5e;}})});}_0x4157c4=_[_0xbb58('0x41')]({},_0x4157c4,_0x28b3a3[_0xbb58('0x42')]);var _0x560911={'where':_0x4157c4['where']};return db[_0xbb58('0x2d')][_0xbb58('0x1d')](_0x560911)[_0xbb58('0x26')](function(_0x24d82d){_0x573cca[_0xbb58('0x1d')]=_0x24d82d;if(_0x28b3a3[_0xbb58('0x33')]['includeAll']){_0x4157c4[_0xbb58('0x43')]=[{'all':!![]}];}return db[_0xbb58('0x2d')][_0xbb58('0x44')](_0x4157c4);})[_0xbb58('0x26')](function(_0x1185b3){_0x573cca[_0xbb58('0x45')]=_0x1185b3;return _0x573cca;})['then'](respondWithFilteredResult(_0x2a0481,_0x4157c4))[_0xbb58('0x46')](handleError(_0x2a0481,null));};exports['show']=function(_0x22f1c3,_0x285ad4){var _0x29fb1c={'raw':!![],'where':{'id':_0x22f1c3['params']['id']}},_0x45817f={};_0x45817f[_0xbb58('0x32')]=_[_0xbb58('0x34')](db[_0xbb58('0x2d')][_0xbb58('0x2e')]);_0x45817f['query']=_[_0xbb58('0x34')](_0x22f1c3['query']);_0x45817f[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],_0x45817f[_0xbb58('0x33')]);_0x29fb1c[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x22f1c3[_0xbb58('0x33')][_0xbb58('0x38')]));_0x29fb1c[_0xbb58('0x37')]=_0x29fb1c[_0xbb58('0x37')][_0xbb58('0x39')]?_0x29fb1c['attributes']:_0x45817f[_0xbb58('0x32')];if(_0x22f1c3['query']['includeAll']){_0x29fb1c[_0xbb58('0x43')]=[{'all':!![]}];}_0x29fb1c=_[_0xbb58('0x41')]({},_0x29fb1c,_0x22f1c3[_0xbb58('0x42')]);return db[_0xbb58('0x2d')][_0xbb58('0x47')](_0x29fb1c)[_0xbb58('0x26')](handleEntityNotFound(_0x285ad4,null))[_0xbb58('0x26')](respondWithResult(_0x285ad4,null))[_0xbb58('0x46')](handleError(_0x285ad4,null));};exports[_0xbb58('0x48')]=function(_0x39995e,_0x440fb3){return db['FaxQueueReport'][_0xbb58('0x48')](_0x39995e[_0xbb58('0x49')],{})['then'](respondWithResult(_0x440fb3,0xc9))[_0xbb58('0x46')](handleError(_0x440fb3,null));};exports[_0xbb58('0x24')]=function(_0xf94897,_0xdb0ff7){if(_0xf94897['body']['id']){delete _0xf94897[_0xbb58('0x49')]['id'];}return db['FaxQueueReport'][_0xbb58('0x47')]({'where':{'id':_0xf94897[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0xdb0ff7,null))['then'](saveUpdates(_0xf94897[_0xbb58('0x49')],null))[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,null))['catch'](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x25')]=function(_0x4ca201,_0x28301d){return db[_0xbb58('0x2d')][_0xbb58('0x47')]({'where':{'id':_0x4ca201[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x28301d,null))[_0xbb58('0x26')](removeEntity(_0x28301d,null))[_0xbb58('0x46')](handleError(_0x28301d,null));};exports['describe']=function(_0x449088,_0x1fd892){return db['FaxQueueReport'][_0xbb58('0x4b')]()[_0xbb58('0x26')](respondWithResult(_0x1fd892,null))['catch'](handleError(_0x1fd892,null));}; \ No newline at end of file +var _0xe79a=['../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','update','destroy','then','name','send','map','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','FaxQueueReport','includeAll','rows','catch','show','rawAttributes','keys','include','find','create','body','params','describe','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0xe79a,0x70));var _0xae79=function(_0x4941c6,_0x3ca9f8){_0x4941c6=_0x4941c6-0x0;var _0x4d3654=_0xe79a[_0x4941c6];return _0x4d3654;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae79('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae79('0x1'));var moment=require(_0xae79('0x2'));var BPromise=require(_0xae79('0x3'));var Mustache=require(_0xae79('0x4'));var util=require('util');var path=require(_0xae79('0x5'));var sox=require(_0xae79('0x6'));var csv=require(_0xae79('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae79('0x8'));var _=require(_0xae79('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae79('0xa'));var deskjs=require(_0xae79('0xb'));var toCsv=require('to-csv');var querystring=require(_0xae79('0xc'));var Papa=require('papaparse');var Redis=require(_0xae79('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xae79('0xe'));var hardwareService=require(_0xae79('0xf'));var logger=require(_0xae79('0x10'))('api');var utils=require(_0xae79('0x11'));var config=require(_0xae79('0x12'));var licenseUtil=require(_0xae79('0x13'));var db=require(_0xae79('0x14'))['db'];function respondWithStatusCode(_0x326e99,_0x147a72){_0x147a72=_0x147a72||0xcc;return function(_0x1e1dbc){if(_0x1e1dbc){return _0x326e99[_0xae79('0x15')](_0x147a72);}return _0x326e99[_0xae79('0x16')](_0x147a72)[_0xae79('0x17')]();};}function respondWithResult(_0x478937,_0xdbae20){_0xdbae20=_0xdbae20||0xc8;return function(_0x456180){if(_0x456180){return _0x478937[_0xae79('0x16')](_0xdbae20)[_0xae79('0x18')](_0x456180);}};}function respondWithFilteredResult(_0x4c8f9a,_0x4e4615){return function(_0x101327){if(_0x101327){var _0x27809a=typeof _0x4e4615['offset']===_0xae79('0x19')&&typeof _0x4e4615['limit']===_0xae79('0x19');var _0x44f55e=_0x101327[_0xae79('0x1a')];var _0x371944=_0x27809a?0x0:_0x4e4615[_0xae79('0x1b')];var _0x5cb7d5=_0x27809a?_0x101327[_0xae79('0x1a')]:_0x4e4615[_0xae79('0x1b')]+_0x4e4615[_0xae79('0x1c')];var _0x23fd7d;if(_0x5cb7d5>=_0x44f55e){_0x5cb7d5=_0x44f55e;_0x23fd7d=0xc8;}else{_0x23fd7d=0xce;}_0x4c8f9a[_0xae79('0x16')](_0x23fd7d);return _0x4c8f9a[_0xae79('0x1d')]('Content-Range',_0x371944+'-'+_0x5cb7d5+'/'+_0x44f55e)[_0xae79('0x18')](_0x101327);}return null;};}function patchUpdates(_0x1c4840){return function(_0x27b5fe){try{jsonpatch['apply'](_0x27b5fe,_0x1c4840,!![]);}catch(_0xb0d047){return BPromise[_0xae79('0x1e')](_0xb0d047);}return _0x27b5fe['save']();};}function saveUpdates(_0x2c83e3,_0x2d006d){return function(_0x173ded){if(_0x173ded){return _0x173ded[_0xae79('0x1f')](_0x2c83e3)['then'](function(_0x42fbbc){return _0x42fbbc;});}return null;};}function removeEntity(_0x33f0c5,_0x49c55e){return function(_0x5d4a57){if(_0x5d4a57){return _0x5d4a57[_0xae79('0x20')]()[_0xae79('0x21')](function(){_0x33f0c5['status'](0xcc)[_0xae79('0x17')]();});}};}function handleEntityNotFound(_0x6a289b,_0x819255){return function(_0x1621e0){if(!_0x1621e0){_0x6a289b['sendStatus'](0x194);}return _0x1621e0;};}function handleError(_0x1e8618,_0x504d65){_0x504d65=_0x504d65||0x1f4;return function(_0x3ee7ea){logger['error'](_0x3ee7ea['stack']);if(_0x3ee7ea[_0xae79('0x22')]){delete _0x3ee7ea['name'];}_0x1e8618[_0xae79('0x16')](_0x504d65)[_0xae79('0x23')](_0x3ee7ea);};}exports['index']=function(_0x55731c,_0x85caa7){var _0x5b43cd={},_0x7281ce={},_0x15a04b={'count':0x0,'rows':[]};var _0xcd6911=_[_0xae79('0x24')](db['FaxQueueReport']['rawAttributes'],function(_0x36a0cf){return{'name':_0x36a0cf['fieldName'],'type':_0x36a0cf[_0xae79('0x25')][_0xae79('0x26')]};});_0x7281ce[_0xae79('0x27')]=_[_0xae79('0x24')](_0xcd6911,_0xae79('0x22'));_0x7281ce[_0xae79('0x28')]=_['keys'](_0x55731c[_0xae79('0x28')]);_0x7281ce[_0xae79('0x29')]=_[_0xae79('0x2a')](_0x7281ce['model'],_0x7281ce[_0xae79('0x28')]);_0x5b43cd[_0xae79('0x2b')]=_[_0xae79('0x2a')](_0x7281ce[_0xae79('0x27')],qs[_0xae79('0x2c')](_0x55731c['query'][_0xae79('0x2c')]));_0x5b43cd[_0xae79('0x2b')]=_0x5b43cd[_0xae79('0x2b')]['length']?_0x5b43cd['attributes']:_0x7281ce[_0xae79('0x27')];if(!_0x55731c[_0xae79('0x28')][_0xae79('0x2d')]('nolimit')){_0x5b43cd[_0xae79('0x1c')]=qs[_0xae79('0x1c')](_0x55731c['query'][_0xae79('0x1c')]);_0x5b43cd[_0xae79('0x1b')]=qs[_0xae79('0x1b')](_0x55731c['query'][_0xae79('0x1b')]);}_0x5b43cd[_0xae79('0x2e')]=qs[_0xae79('0x2f')](_0x55731c[_0xae79('0x28')][_0xae79('0x2f')]);_0x5b43cd['where']=qs[_0xae79('0x29')](_[_0xae79('0x30')](_0x55731c[_0xae79('0x28')],_0x7281ce[_0xae79('0x29')]),_0xcd6911);if(_0x55731c['query'][_0xae79('0x31')]){_0x5b43cd[_0xae79('0x32')]=_[_0xae79('0x33')](_0x5b43cd['where'],{'$or':_[_0xae79('0x24')](_0xcd6911,function(_0x377b46){if(_0x377b46[_0xae79('0x25')]!=='VIRTUAL'){var _0x19d6f1={};_0x19d6f1[_0x377b46[_0xae79('0x22')]]={'$like':'%'+_0x55731c['query'][_0xae79('0x31')]+'%'};return _0x19d6f1;}})});}_0x5b43cd=_[_0xae79('0x33')]({},_0x5b43cd,_0x55731c[_0xae79('0x34')]);var _0x50c9e4={'where':_0x5b43cd[_0xae79('0x32')]};return db[_0xae79('0x35')][_0xae79('0x1a')](_0x50c9e4)[_0xae79('0x21')](function(_0x343b7a){_0x15a04b[_0xae79('0x1a')]=_0x343b7a;if(_0x55731c[_0xae79('0x28')][_0xae79('0x36')]){_0x5b43cd['include']=[{'all':!![]}];}return db[_0xae79('0x35')]['findAll'](_0x5b43cd);})[_0xae79('0x21')](function(_0x3a8c4b){_0x15a04b[_0xae79('0x37')]=_0x3a8c4b;return _0x15a04b;})[_0xae79('0x21')](respondWithFilteredResult(_0x85caa7,_0x5b43cd))[_0xae79('0x38')](handleError(_0x85caa7,null));};exports[_0xae79('0x39')]=function(_0x5b8962,_0x2ea9d6){var _0x326d50={'raw':!![],'where':{'id':_0x5b8962['params']['id']}},_0x40cbe9={};_0x40cbe9[_0xae79('0x27')]=_['keys'](db[_0xae79('0x35')][_0xae79('0x3a')]);_0x40cbe9[_0xae79('0x28')]=_[_0xae79('0x3b')](_0x5b8962[_0xae79('0x28')]);_0x40cbe9['filters']=_[_0xae79('0x2a')](_0x40cbe9[_0xae79('0x27')],_0x40cbe9[_0xae79('0x28')]);_0x326d50[_0xae79('0x2b')]=_[_0xae79('0x2a')](_0x40cbe9[_0xae79('0x27')],qs['fields'](_0x5b8962[_0xae79('0x28')]['fields']));_0x326d50[_0xae79('0x2b')]=_0x326d50[_0xae79('0x2b')]['length']?_0x326d50[_0xae79('0x2b')]:_0x40cbe9[_0xae79('0x27')];if(_0x5b8962['query']['includeAll']){_0x326d50[_0xae79('0x3c')]=[{'all':!![]}];}_0x326d50=_[_0xae79('0x33')]({},_0x326d50,_0x5b8962['options']);return db['FaxQueueReport'][_0xae79('0x3d')](_0x326d50)[_0xae79('0x21')](handleEntityNotFound(_0x2ea9d6,null))[_0xae79('0x21')](respondWithResult(_0x2ea9d6,null))[_0xae79('0x38')](handleError(_0x2ea9d6,null));};exports['create']=function(_0x5b15b9,_0x596a2b){return db['FaxQueueReport'][_0xae79('0x3e')](_0x5b15b9[_0xae79('0x3f')],{})[_0xae79('0x21')](respondWithResult(_0x596a2b,0xc9))[_0xae79('0x38')](handleError(_0x596a2b,null));};exports[_0xae79('0x1f')]=function(_0x34f1b4,_0x2cea67){if(_0x34f1b4[_0xae79('0x3f')]['id']){delete _0x34f1b4['body']['id'];}return db[_0xae79('0x35')][_0xae79('0x3d')]({'where':{'id':_0x34f1b4[_0xae79('0x40')]['id']}})[_0xae79('0x21')](handleEntityNotFound(_0x2cea67,null))[_0xae79('0x21')](saveUpdates(_0x34f1b4[_0xae79('0x3f')],null))['then'](respondWithResult(_0x2cea67,null))[_0xae79('0x38')](handleError(_0x2cea67,null));};exports[_0xae79('0x20')]=function(_0x7f74fb,_0x6865a8){return db['FaxQueueReport']['find']({'where':{'id':_0x7f74fb[_0xae79('0x40')]['id']}})[_0xae79('0x21')](handleEntityNotFound(_0x6865a8,null))['then'](removeEntity(_0x6865a8,null))[_0xae79('0x38')](handleError(_0x6865a8,null));};exports['describe']=function(_0x384f6a,_0x26aa45){return db[_0xae79('0x35')][_0xae79('0x41')]()['then'](respondWithResult(_0x26aa45,null))[_0xae79('0x38')](handleError(_0x26aa45,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f3a2a7e..b22bf0e 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 _0x0295=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path'];(function(_0xa4674c,_0x59b5fc){var _0x5c0f8b=function(_0x19c493){while(--_0x19c493){_0xa4674c['push'](_0xa4674c['shift']());}};_0x5c0f8b(++_0x59b5fc);}(_0x0295,0x1f0));var _0x5029=function(_0x34ac64,_0x23f246){_0x34ac64=_0x34ac64-0x0;var _0xae8ae9=_0x0295[_0x34ac64];return _0xae8ae9;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5029('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x25327e,_0xb2a66d){var _0xdc22cb=function(_0x1eac23){while(--_0x1eac23){_0x25327e['push'](_0x25327e['shift']());}};_0xdc22cb(++_0xb2a66d);}(_0x5fab,0x177));var _0xb5fa=function(_0x469218,_0x440d05){_0x469218=_0x469218-0x0;var _0x187b4a=_0x5fab[_0x469218];return _0x187b4a;};'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':[{'name':_0xb5fa('0xd'),'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 ff77267..1c26e7f 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 _0x52a2=['raw','where','attributes','limit','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','body','options','then','UpdateFaxQueueReport','FaxQueueReport','update'];(function(_0x284cd1,_0x87b55b){var _0x4b6653=function(_0x1f4a87){while(--_0x1f4a87){_0x284cd1['push'](_0x284cd1['shift']());}};_0x4b6653(++_0x87b55b);}(_0x52a2,0xaf));var _0x252a=function(_0x35faf2,_0x56a899){_0x35faf2=_0x35faf2-0x0;var _0x113601=_0x52a2[_0x35faf2];return _0x113601;};'use strict';var _=require(_0x252a('0x0'));var util=require('util');var moment=require(_0x252a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x252a('0x2'));var db=require(_0x252a('0x3'))['db'];var utils=require(_0x252a('0x4'));var logger=require(_0x252a('0x5'))('rpc');var config=require(_0x252a('0x6'));var jayson=require(_0x252a('0x7'));var client=jayson[_0x252a('0x8')][_0x252a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x597d34,_0x42e918,_0x1eb5fa){return new BPromise(function(_0x39bd5c,_0xc8d9bf){return client[_0x252a('0xa')](_0x597d34,_0x1eb5fa)['then'](function(_0x16d066){logger[_0x252a('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x42e918,_0x252a('0xc'));logger[_0x252a('0xd')](_0x252a('0xe'),_0x42e918,'request\x20sent',JSON['stringify'](_0x16d066));if(_0x16d066[_0x252a('0xf')]){if(_0x16d066[_0x252a('0xf')][_0x252a('0x10')]===0x1f4){logger[_0x252a('0xf')](_0x252a('0x11'),_0x42e918,_0x16d066['error'][_0x252a('0x12')]);return _0xc8d9bf(_0x16d066[_0x252a('0xf')][_0x252a('0x12')]);}logger[_0x252a('0xf')](_0x252a('0x11'),_0x42e918,_0x16d066[_0x252a('0xf')][_0x252a('0x12')]);return _0x39bd5c(_0x16d066[_0x252a('0xf')][_0x252a('0x12')]);}else{logger[_0x252a('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x42e918,_0x252a('0xc'));_0x39bd5c(_0x16d066[_0x252a('0x13')][_0x252a('0x12')]);}})[_0x252a('0x14')](function(_0x1408d6){logger[_0x252a('0xf')](_0x252a('0x11'),_0x42e918,_0x1408d6);_0xc8d9bf(_0x1408d6);});});}exports[_0x252a('0x15')]=function(_0x479235){var _0x5ceb14=this;return new Promise(function(_0x22e3cc,_0x1985b0){return db['FaxQueueReport'][_0x252a('0x16')](_0x479235[_0x252a('0x17')],{'raw':_0x479235[_0x252a('0x18')]?_0x479235[_0x252a('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x252a('0x19')](function(_0x34c98b){logger[_0x252a('0xb')]('CreateFaxQueueReport',_0x479235);logger[_0x252a('0xd')](_0x252a('0x15'),_0x479235,JSON['stringify'](_0x34c98b));_0x22e3cc(_0x34c98b);})[_0x252a('0x14')](function(_0x2d0e2d){logger[_0x252a('0xf')](_0x252a('0x15'),_0x2d0e2d[_0x252a('0x12')],_0x479235);_0x1985b0(_0x5ceb14[_0x252a('0xf')](0x1f4,_0x2d0e2d['message']));});});};exports[_0x252a('0x1a')]=function(_0x4515a7){var _0x313532=this;return new Promise(function(_0x55555d,_0xb10e24){return db[_0x252a('0x1b')][_0x252a('0x1c')](_0x4515a7['body'],{'raw':_0x4515a7[_0x252a('0x18')]?_0x4515a7[_0x252a('0x18')][_0x252a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4515a7[_0x252a('0x18')]?_0x4515a7[_0x252a('0x18')][_0x252a('0x1e')]||null:null,'attributes':_0x4515a7['options']?_0x4515a7['options'][_0x252a('0x1f')]||null:null,'limit':_0x4515a7['options']?_0x4515a7['options'][_0x252a('0x20')]||null:null})[_0x252a('0x19')](function(_0x1d40bf){logger[_0x252a('0xb')]('UpdateFaxQueueReport',_0x4515a7);logger[_0x252a('0xd')](_0x252a('0x1a'),_0x4515a7,JSON[_0x252a('0x21')](_0x1d40bf));_0x55555d(_0x1d40bf);})['catch'](function(_0x5c7546){logger[_0x252a('0xf')]('UpdateFaxQueueReport',_0x5c7546[_0x252a('0x12')],_0x4515a7);_0xb10e24(_0x313532[_0x252a('0xf')](0x1f4,_0x5c7546[_0x252a('0x12')]));});});}; \ No newline at end of file +var _0xface=['update','raw','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','info','UpdateFaxQueueReport'];(function(_0x1b640f,_0x215390){var _0x560770=function(_0x5335ba){while(--_0x5335ba){_0x1b640f['push'](_0x1b640f['shift']());}};_0x560770(++_0x215390);}(_0xface,0xcb));var _0xefac=function(_0x256179,_0x1d3bdf){_0x256179=_0x256179-0x0;var _0x13dc42=_0xface[_0x256179];return _0x13dc42;};'use strict';var _=require('lodash');var util=require(_0xefac('0x0'));var moment=require(_0xefac('0x1'));var BPromise=require(_0xefac('0x2'));var rs=require(_0xefac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefac('0x4'))['db'];var utils=require(_0xefac('0x5'));var logger=require('../../config/logger')(_0xefac('0x6'));var config=require(_0xefac('0x7'));var jayson=require(_0xefac('0x8'));var client=jayson[_0xefac('0x9')][_0xefac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58f17d,_0x9f3109,_0x1e2b2e){return new BPromise(function(_0x5f44b4,_0x479ec8){return client['request'](_0x58f17d,_0x1e2b2e)[_0xefac('0xb')](function(_0x5bdc8b){logger['info'](_0xefac('0xc'),_0x9f3109,_0xefac('0xd'));logger[_0xefac('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x9f3109,'request\x20sent',JSON[_0xefac('0xf')](_0x5bdc8b));if(_0x5bdc8b['error']){if(_0x5bdc8b[_0xefac('0x10')][_0xefac('0x11')]===0x1f4){logger['error'](_0xefac('0xc'),_0x9f3109,_0x5bdc8b[_0xefac('0x10')][_0xefac('0x12')]);return _0x479ec8(_0x5bdc8b[_0xefac('0x10')][_0xefac('0x12')]);}logger[_0xefac('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x9f3109,_0x5bdc8b[_0xefac('0x10')][_0xefac('0x12')]);return _0x5f44b4(_0x5bdc8b[_0xefac('0x10')][_0xefac('0x12')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x9f3109,'request\x20sent');_0x5f44b4(_0x5bdc8b[_0xefac('0x13')][_0xefac('0x12')]);}})[_0xefac('0x14')](function(_0x32deaf){logger[_0xefac('0x10')](_0xefac('0xc'),_0x9f3109,_0x32deaf);_0x479ec8(_0x32deaf);});});}exports[_0xefac('0x15')]=function(_0x275daa){var _0x58732f=this;return new Promise(function(_0x5f382c,_0x3c1ea9){return db[_0xefac('0x16')][_0xefac('0x17')](_0x275daa[_0xefac('0x18')],{'raw':_0x275daa[_0xefac('0x19')]?_0x275daa[_0xefac('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2548e4){logger[_0xefac('0x1a')](_0xefac('0x15'),_0x275daa);logger[_0xefac('0xe')]('CreateFaxQueueReport',_0x275daa,JSON[_0xefac('0xf')](_0x2548e4));_0x5f382c(_0x2548e4);})[_0xefac('0x14')](function(_0x35d038){logger[_0xefac('0x10')](_0xefac('0x15'),_0x35d038[_0xefac('0x12')],_0x275daa);_0x3c1ea9(_0x58732f[_0xefac('0x10')](0x1f4,_0x35d038['message']));});});};exports[_0xefac('0x1b')]=function(_0x402602){var _0x133c9d=this;return new Promise(function(_0x5bd096,_0xa9b324){return db['FaxQueueReport'][_0xefac('0x1c')](_0x402602[_0xefac('0x18')],{'raw':_0x402602[_0xefac('0x19')]?_0x402602['options'][_0xefac('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x402602[_0xefac('0x19')]?_0x402602[_0xefac('0x19')][_0xefac('0x1e')]||null:null,'attributes':_0x402602[_0xefac('0x19')]?_0x402602[_0xefac('0x19')][_0xefac('0x1f')]||null:null,'limit':_0x402602[_0xefac('0x19')]?_0x402602[_0xefac('0x19')][_0xefac('0x20')]||null:null})[_0xefac('0xb')](function(_0x56e565){logger[_0xefac('0x1a')](_0xefac('0x1b'),_0x402602);logger[_0xefac('0xe')]('UpdateFaxQueueReport',_0x402602,JSON[_0xefac('0xf')](_0x56e565));_0x5bd096(_0x56e565);})[_0xefac('0x14')](function(_0x2384d5){logger[_0xefac('0x10')](_0xefac('0x1b'),_0x2384d5[_0xefac('0x12')],_0x402602);_0xa9b324(_0x133c9d[_0xefac('0x10')](0x1f4,_0x2384d5[_0xefac('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 7a6cfb5..ca1ce14 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 _0xd3c5=['post','create','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xd3c5,0x181));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x5d3c('0x0'));var path=require(_0x5d3c('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d3c('0x2'));var router=express[_0x5d3c('0x3')]();var fs_extra=require(_0x5d3c('0x4'));var auth=require(_0x5d3c('0x5'));var interaction=require(_0x5d3c('0x6'));var config=require(_0x5d3c('0x7'));var controller=require(_0x5d3c('0x8'));router[_0x5d3c('0x9')]('/',auth[_0x5d3c('0xa')](),controller[_0x5d3c('0xb')]);router[_0x5d3c('0x9')](_0x5d3c('0xc'),auth[_0x5d3c('0xa')](),controller['describe']);router[_0x5d3c('0x9')](_0x5d3c('0xd'),auth[_0x5d3c('0xa')](),controller[_0x5d3c('0xe')]);router[_0x5d3c('0xf')]('/',auth['isAuthenticated'](),controller[_0x5d3c('0x10')]);router['put'](_0x5d3c('0xd'),auth['isAuthenticated'](),controller[_0x5d3c('0x11')]);router[_0x5d3c('0x12')](_0x5d3c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5d3c('0x13')]=router; \ No newline at end of file +var _0x72ff=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','update','delete','exports','multer','util','path'];(function(_0x3d3b94,_0x51a2e4){var _0x515d33=function(_0x2aaa05){while(--_0x2aaa05){_0x3d3b94['push'](_0x3d3b94['shift']());}};_0x515d33(++_0x51a2e4);}(_0x72ff,0x129));var _0xf72f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x72ff[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xf72f('0x0'));var util=require(_0xf72f('0x1'));var path=require(_0xf72f('0x2'));var timeout=require(_0xf72f('0x3'));var express=require(_0xf72f('0x4'));var router=express[_0xf72f('0x5')]();var fs_extra=require(_0xf72f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf72f('0x7'));var config=require('../../config/environment');var controller=require(_0xf72f('0x8'));router[_0xf72f('0x9')]('/',auth[_0xf72f('0xa')](),controller[_0xf72f('0xb')]);router[_0xf72f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf72f('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf72f('0xd')]);router[_0xf72f('0xe')]('/',auth[_0xf72f('0xa')](),controller['create']);router[_0xf72f('0xf')](_0xf72f('0x10'),auth[_0xf72f('0xa')](),controller[_0xf72f('0x11')]);router[_0xf72f('0x12')](_0xf72f('0x10'),auth[_0xf72f('0xa')](),controller['destroy']);module[_0xf72f('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a73277e..1c17add 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1cd106,_0x2ec7f1){var _0x13ad91=function(_0x2be497){while(--_0x2be497){_0x1cd106['push'](_0x1cd106['shift']());}};_0x13ad91(++_0x2ec7f1);}(_0x70e0,0x17b));var _0x070e=function(_0x104a29,_0x2666db){_0x104a29=_0x104a29-0x0;var _0x6649c8=_0x70e0[_0x104a29];return _0x6649c8;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4358cb,_0x1f1c23){var _0x59a7e4=function(_0x5a1e15){while(--_0x5a1e15){_0x4358cb['push'](_0x4358cb['shift']());}};_0x59a7e4(++_0x1f1c23);}(_0x54ef,0x112));var _0xf54e=function(_0x5b60ba,_0x1b4054){_0x5b60ba=_0x5b60ba-0x0;var _0x2de4d2=_0x54ef[_0x5b60ba];return _0x2de4d2;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b5db75e..a88f47c 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 _0x9a62=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x59926a,_0x329fdd){var _0x1a756b=function(_0x315afd){while(--_0x315afd){_0x59926a['push'](_0x59926a['shift']());}};_0x1a756b(++_0x329fdd);}(_0x9a62,0x134));var _0x29a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9a62[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x29a6('0x0'));var rimraf=require(_0x29a6('0x1'));var zipdir=require(_0x29a6('0x2'));var jsonpatch=require(_0x29a6('0x3'));var rp=require(_0x29a6('0x4'));var moment=require(_0x29a6('0x5'));var BPromise=require(_0x29a6('0x6'));var Mustache=require('mustache');var util=require(_0x29a6('0x7'));var path=require(_0x29a6('0x8'));var sox=require(_0x29a6('0x9'));var csv=require(_0x29a6('0xa'));var ejs=require(_0x29a6('0xb'));var fs=require('fs');var fs_extra=require(_0x29a6('0xc'));var _=require(_0x29a6('0xd'));var squel=require(_0x29a6('0xe'));var crypto=require(_0x29a6('0xf'));var jsforce=require(_0x29a6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x29a6('0xa'));var querystring=require(_0x29a6('0x11'));var Papa=require(_0x29a6('0x12'));var Redis=require(_0x29a6('0x13'));var authService=require(_0x29a6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x29a6('0x15'));var hardwareService=require(_0x29a6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x29a6('0x17'));var config=require(_0x29a6('0x18'));var licenseUtil=require(_0x29a6('0x19'));var db=require(_0x29a6('0x1a'))['db'];function respondWithStatusCode(_0x2a4d71,_0x181928){_0x181928=_0x181928||0xcc;return function(_0x354b82){if(_0x354b82){return _0x2a4d71[_0x29a6('0x1b')](_0x181928);}return _0x2a4d71['status'](_0x181928)[_0x29a6('0x1c')]();};}function respondWithResult(_0x1fa847,_0x475062){_0x475062=_0x475062||0xc8;return function(_0xf7227f){if(_0xf7227f){return _0x1fa847[_0x29a6('0x1d')](_0x475062)[_0x29a6('0x1e')](_0xf7227f);}};}function respondWithFilteredResult(_0x33483f,_0x14e439){return function(_0x43c8ed){if(_0x43c8ed){var _0x5dbad6=typeof _0x14e439[_0x29a6('0x1f')]==='undefined'&&typeof _0x14e439[_0x29a6('0x20')]===_0x29a6('0x21');var _0x290ebf=_0x43c8ed[_0x29a6('0x22')];var _0x2811be=_0x5dbad6?0x0:_0x14e439[_0x29a6('0x1f')];var _0x547552=_0x5dbad6?_0x43c8ed[_0x29a6('0x22')]:_0x14e439['offset']+_0x14e439[_0x29a6('0x20')];var _0x1c748b;if(_0x547552>=_0x290ebf){_0x547552=_0x290ebf;_0x1c748b=0xc8;}else{_0x1c748b=0xce;}_0x33483f['status'](_0x1c748b);return _0x33483f['set'](_0x29a6('0x23'),_0x2811be+'-'+_0x547552+'/'+_0x290ebf)[_0x29a6('0x1e')](_0x43c8ed);}return null;};}function patchUpdates(_0x1706e4){return function(_0x578922){try{jsonpatch[_0x29a6('0x24')](_0x578922,_0x1706e4,!![]);}catch(_0xe85170){return BPromise[_0x29a6('0x25')](_0xe85170);}return _0x578922[_0x29a6('0x26')]();};}function saveUpdates(_0x3aed11,_0x4454b5){return function(_0x59c6a1){if(_0x59c6a1){return _0x59c6a1[_0x29a6('0x27')](_0x3aed11)[_0x29a6('0x28')](function(_0xdda6ce){return _0xdda6ce;});}return null;};}function removeEntity(_0x1750be,_0x31c33a){return function(_0x30af1a){if(_0x30af1a){return _0x30af1a[_0x29a6('0x29')]()[_0x29a6('0x28')](function(){_0x1750be['status'](0xcc)[_0x29a6('0x1c')]();});}};}function handleEntityNotFound(_0x2bc121,_0x4d843d){return function(_0x2865b0){if(!_0x2865b0){_0x2bc121[_0x29a6('0x1b')](0x194);}return _0x2865b0;};}function handleError(_0x3be467,_0x446ac5){_0x446ac5=_0x446ac5||0x1f4;return function(_0x1e38ca){logger[_0x29a6('0x2a')](_0x1e38ca[_0x29a6('0x2b')]);if(_0x1e38ca[_0x29a6('0x2c')]){delete _0x1e38ca[_0x29a6('0x2c')];}_0x3be467['status'](_0x446ac5)[_0x29a6('0x2d')](_0x1e38ca);};}exports[_0x29a6('0x2e')]=function(_0xd425e,_0x51ecc3){var _0x55a730={},_0x156745={},_0x2f9efe={'count':0x0,'rows':[]};var _0x7a916c=_[_0x29a6('0x2f')](db[_0x29a6('0x30')][_0x29a6('0x31')],function(_0x40c731){return{'name':_0x40c731[_0x29a6('0x32')],'type':_0x40c731['type'][_0x29a6('0x33')]};});_0x156745[_0x29a6('0x34')]=_['map'](_0x7a916c,_0x29a6('0x2c'));_0x156745['query']=_[_0x29a6('0x35')](_0xd425e[_0x29a6('0x36')]);_0x156745[_0x29a6('0x37')]=_[_0x29a6('0x38')](_0x156745[_0x29a6('0x34')],_0x156745[_0x29a6('0x36')]);_0x55a730[_0x29a6('0x39')]=_[_0x29a6('0x38')](_0x156745[_0x29a6('0x34')],qs['fields'](_0xd425e['query'][_0x29a6('0x3a')]));_0x55a730[_0x29a6('0x39')]=_0x55a730[_0x29a6('0x39')][_0x29a6('0x3b')]?_0x55a730[_0x29a6('0x39')]:_0x156745[_0x29a6('0x34')];if(!_0xd425e[_0x29a6('0x36')]['hasOwnProperty'](_0x29a6('0x3c'))){_0x55a730['limit']=qs[_0x29a6('0x20')](_0xd425e[_0x29a6('0x36')][_0x29a6('0x20')]);_0x55a730[_0x29a6('0x1f')]=qs[_0x29a6('0x1f')](_0xd425e[_0x29a6('0x36')]['offset']);}_0x55a730[_0x29a6('0x3d')]=qs[_0x29a6('0x3e')](_0xd425e[_0x29a6('0x36')][_0x29a6('0x3e')]);_0x55a730[_0x29a6('0x3f')]=qs[_0x29a6('0x37')](_[_0x29a6('0x40')](_0xd425e[_0x29a6('0x36')],_0x156745['filters']),_0x7a916c);if(_0xd425e['query']['filter']){_0x55a730[_0x29a6('0x3f')]=_[_0x29a6('0x41')](_0x55a730[_0x29a6('0x3f')],{'$or':_[_0x29a6('0x2f')](_0x7a916c,function(_0xc1546c){if(_0xc1546c[_0x29a6('0x42')]!==_0x29a6('0x43')){var _0x45bbf5={};_0x45bbf5[_0xc1546c['name']]={'$like':'%'+_0xd425e[_0x29a6('0x36')][_0x29a6('0x44')]+'%'};return _0x45bbf5;}})});}_0x55a730=_[_0x29a6('0x41')]({},_0x55a730,_0xd425e['options']);var _0x1596e9={'where':_0x55a730[_0x29a6('0x3f')]};return db[_0x29a6('0x30')][_0x29a6('0x22')](_0x1596e9)[_0x29a6('0x28')](function(_0x29ad4f){_0x2f9efe[_0x29a6('0x22')]=_0x29ad4f;if(_0xd425e[_0x29a6('0x36')][_0x29a6('0x45')]){_0x55a730[_0x29a6('0x46')]=[{'all':!![]}];}return db[_0x29a6('0x30')][_0x29a6('0x47')](_0x55a730);})['then'](function(_0x8a1b63){_0x2f9efe[_0x29a6('0x48')]=_0x8a1b63;return _0x2f9efe;})['then'](respondWithFilteredResult(_0x51ecc3,_0x55a730))[_0x29a6('0x49')](handleError(_0x51ecc3,null));};exports['show']=function(_0x22b169,_0xda95fb){var _0x13bc35={'raw':!![],'where':{'id':_0x22b169[_0x29a6('0x4a')]['id']}},_0x540799={};_0x540799[_0x29a6('0x34')]=_[_0x29a6('0x35')](db[_0x29a6('0x30')]['rawAttributes']);_0x540799[_0x29a6('0x36')]=_[_0x29a6('0x35')](_0x22b169[_0x29a6('0x36')]);_0x540799[_0x29a6('0x37')]=_[_0x29a6('0x38')](_0x540799[_0x29a6('0x34')],_0x540799[_0x29a6('0x36')]);_0x13bc35[_0x29a6('0x39')]=_[_0x29a6('0x38')](_0x540799[_0x29a6('0x34')],qs['fields'](_0x22b169[_0x29a6('0x36')][_0x29a6('0x3a')]));_0x13bc35[_0x29a6('0x39')]=_0x13bc35['attributes'][_0x29a6('0x3b')]?_0x13bc35[_0x29a6('0x39')]:_0x540799[_0x29a6('0x34')];if(_0x22b169[_0x29a6('0x36')][_0x29a6('0x45')]){_0x13bc35['include']=[{'all':!![]}];}_0x13bc35=_[_0x29a6('0x41')]({},_0x13bc35,_0x22b169[_0x29a6('0x4b')]);return db['FaxTransferReport'][_0x29a6('0x4c')](_0x13bc35)[_0x29a6('0x28')](handleEntityNotFound(_0xda95fb,null))[_0x29a6('0x28')](respondWithResult(_0xda95fb,null))[_0x29a6('0x49')](handleError(_0xda95fb,null));};exports[_0x29a6('0x4d')]=function(_0x1208e8,_0x15af53){return db[_0x29a6('0x30')][_0x29a6('0x4d')](_0x1208e8['body'],{})[_0x29a6('0x28')](respondWithResult(_0x15af53,0xc9))[_0x29a6('0x49')](handleError(_0x15af53,null));};exports[_0x29a6('0x27')]=function(_0x2efb5c,_0x5f050c){if(_0x2efb5c['body']['id']){delete _0x2efb5c[_0x29a6('0x4e')]['id'];}return db['FaxTransferReport'][_0x29a6('0x4c')]({'where':{'id':_0x2efb5c[_0x29a6('0x4a')]['id']}})[_0x29a6('0x28')](handleEntityNotFound(_0x5f050c,null))['then'](saveUpdates(_0x2efb5c[_0x29a6('0x4e')],null))['then'](respondWithResult(_0x5f050c,null))[_0x29a6('0x49')](handleError(_0x5f050c,null));};exports[_0x29a6('0x29')]=function(_0x368dfb,_0x193c9f){return db[_0x29a6('0x30')][_0x29a6('0x4c')]({'where':{'id':_0x368dfb['params']['id']}})[_0x29a6('0x28')](handleEntityNotFound(_0x193c9f,null))[_0x29a6('0x28')](removeEntity(_0x193c9f,null))[_0x29a6('0x49')](handleError(_0x193c9f,null));};exports['describe']=function(_0x1d6a5b,_0x28d3a0){return db[_0x29a6('0x30')][_0x29a6('0x4f')]()[_0x29a6('0x28')](respondWithResult(_0x28d3a0,null))['catch'](handleError(_0x28d3a0,null));}; \ No newline at end of file +var _0x2ea6=['util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','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','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4b88f8,_0x20ae18){var _0x15ecc5=function(_0x24bb95){while(--_0x24bb95){_0x4b88f8['push'](_0x4b88f8['shift']());}};_0x15ecc5(++_0x20ae18);}(_0x2ea6,0xe1));var _0x62ea=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x2ea6[_0xd1c39b];return _0x58f5bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62ea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62ea('0x1'));var rp=require(_0x62ea('0x2'));var moment=require(_0x62ea('0x3'));var BPromise=require(_0x62ea('0x4'));var Mustache=require(_0x62ea('0x5'));var util=require(_0x62ea('0x6'));var path=require(_0x62ea('0x7'));var sox=require('sox');var csv=require(_0x62ea('0x8'));var ejs=require(_0x62ea('0x9'));var fs=require('fs');var fs_extra=require(_0x62ea('0xa'));var _=require(_0x62ea('0xb'));var squel=require('squel');var crypto=require(_0x62ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x62ea('0xd'));var toCsv=require(_0x62ea('0x8'));var querystring=require('querystring');var Papa=require(_0x62ea('0xe'));var Redis=require(_0x62ea('0xf'));var authService=require(_0x62ea('0x10'));var qs=require(_0x62ea('0x11'));var as=require(_0x62ea('0x12'));var hardwareService=require(_0x62ea('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x62ea('0x14'));var config=require(_0x62ea('0x15'));var licenseUtil=require(_0x62ea('0x16'));var db=require(_0x62ea('0x17'))['db'];function respondWithStatusCode(_0x427b8d,_0x286fbc){_0x286fbc=_0x286fbc||0xcc;return function(_0x5bc82e){if(_0x5bc82e){return _0x427b8d[_0x62ea('0x18')](_0x286fbc);}return _0x427b8d[_0x62ea('0x19')](_0x286fbc)[_0x62ea('0x1a')]();};}function respondWithResult(_0x447ccb,_0x45bb94){_0x45bb94=_0x45bb94||0xc8;return function(_0x211e92){if(_0x211e92){return _0x447ccb[_0x62ea('0x19')](_0x45bb94)[_0x62ea('0x1b')](_0x211e92);}};}function respondWithFilteredResult(_0xe01d77,_0x366c29){return function(_0x4ebd79){if(_0x4ebd79){var _0x5aac9b=typeof _0x366c29[_0x62ea('0x1c')]===_0x62ea('0x1d')&&typeof _0x366c29[_0x62ea('0x1e')]===_0x62ea('0x1d');var _0x5dbf7f=_0x4ebd79[_0x62ea('0x1f')];var _0x4bc6bb=_0x5aac9b?0x0:_0x366c29['offset'];var _0x339735=_0x5aac9b?_0x4ebd79[_0x62ea('0x1f')]:_0x366c29[_0x62ea('0x1c')]+_0x366c29['limit'];var _0x8ccd58;if(_0x339735>=_0x5dbf7f){_0x339735=_0x5dbf7f;_0x8ccd58=0xc8;}else{_0x8ccd58=0xce;}_0xe01d77['status'](_0x8ccd58);return _0xe01d77[_0x62ea('0x20')]('Content-Range',_0x4bc6bb+'-'+_0x339735+'/'+_0x5dbf7f)['json'](_0x4ebd79);}return null;};}function patchUpdates(_0x2d8677){return function(_0x10b276){try{jsonpatch[_0x62ea('0x21')](_0x10b276,_0x2d8677,!![]);}catch(_0x2de664){return BPromise[_0x62ea('0x22')](_0x2de664);}return _0x10b276['save']();};}function saveUpdates(_0x180c07,_0x532c1d){return function(_0x17eea0){if(_0x17eea0){return _0x17eea0[_0x62ea('0x23')](_0x180c07)['then'](function(_0xa0bc9f){return _0xa0bc9f;});}return null;};}function removeEntity(_0x3de059,_0x2c43ee){return function(_0x4b8881){if(_0x4b8881){return _0x4b8881['destroy']()[_0x62ea('0x24')](function(){_0x3de059[_0x62ea('0x19')](0xcc)[_0x62ea('0x1a')]();});}};}function handleEntityNotFound(_0x33cf04,_0x224c39){return function(_0x4ac647){if(!_0x4ac647){_0x33cf04['sendStatus'](0x194);}return _0x4ac647;};}function handleError(_0xa2dc65,_0x214b2e){_0x214b2e=_0x214b2e||0x1f4;return function(_0x377c3e){logger[_0x62ea('0x25')](_0x377c3e[_0x62ea('0x26')]);if(_0x377c3e[_0x62ea('0x27')]){delete _0x377c3e[_0x62ea('0x27')];}_0xa2dc65[_0x62ea('0x19')](_0x214b2e)[_0x62ea('0x28')](_0x377c3e);};}exports[_0x62ea('0x29')]=function(_0x3806a8,_0x8c154a){var _0x825732={},_0x14dc18={},_0x48e805={'count':0x0,'rows':[]};var _0x1f8ec9=_[_0x62ea('0x2a')](db[_0x62ea('0x2b')]['rawAttributes'],function(_0x16e3d6){return{'name':_0x16e3d6[_0x62ea('0x2c')],'type':_0x16e3d6[_0x62ea('0x2d')][_0x62ea('0x2e')]};});_0x14dc18[_0x62ea('0x2f')]=_['map'](_0x1f8ec9,_0x62ea('0x27'));_0x14dc18[_0x62ea('0x30')]=_[_0x62ea('0x31')](_0x3806a8[_0x62ea('0x30')]);_0x14dc18[_0x62ea('0x32')]=_[_0x62ea('0x33')](_0x14dc18['model'],_0x14dc18[_0x62ea('0x30')]);_0x825732['attributes']=_[_0x62ea('0x33')](_0x14dc18['model'],qs['fields'](_0x3806a8[_0x62ea('0x30')][_0x62ea('0x34')]));_0x825732[_0x62ea('0x35')]=_0x825732[_0x62ea('0x35')][_0x62ea('0x36')]?_0x825732[_0x62ea('0x35')]:_0x14dc18[_0x62ea('0x2f')];if(!_0x3806a8[_0x62ea('0x30')][_0x62ea('0x37')]('nolimit')){_0x825732['limit']=qs[_0x62ea('0x1e')](_0x3806a8['query']['limit']);_0x825732['offset']=qs[_0x62ea('0x1c')](_0x3806a8[_0x62ea('0x30')][_0x62ea('0x1c')]);}_0x825732[_0x62ea('0x38')]=qs[_0x62ea('0x39')](_0x3806a8[_0x62ea('0x30')]['sort']);_0x825732['where']=qs['filters'](_[_0x62ea('0x3a')](_0x3806a8[_0x62ea('0x30')],_0x14dc18[_0x62ea('0x32')]),_0x1f8ec9);if(_0x3806a8[_0x62ea('0x30')]['filter']){_0x825732['where']=_['merge'](_0x825732[_0x62ea('0x3b')],{'$or':_[_0x62ea('0x2a')](_0x1f8ec9,function(_0x1d412a){if(_0x1d412a[_0x62ea('0x2d')]!==_0x62ea('0x3c')){var _0xc25f95={};_0xc25f95[_0x1d412a['name']]={'$like':'%'+_0x3806a8[_0x62ea('0x30')][_0x62ea('0x3d')]+'%'};return _0xc25f95;}})});}_0x825732=_[_0x62ea('0x3e')]({},_0x825732,_0x3806a8[_0x62ea('0x3f')]);var _0x142366={'where':_0x825732[_0x62ea('0x3b')]};return db[_0x62ea('0x2b')][_0x62ea('0x1f')](_0x142366)[_0x62ea('0x24')](function(_0x53e49c){_0x48e805[_0x62ea('0x1f')]=_0x53e49c;if(_0x3806a8[_0x62ea('0x30')]['includeAll']){_0x825732['include']=[{'all':!![]}];}return db[_0x62ea('0x2b')][_0x62ea('0x40')](_0x825732);})[_0x62ea('0x24')](function(_0x278aa1){_0x48e805[_0x62ea('0x41')]=_0x278aa1;return _0x48e805;})['then'](respondWithFilteredResult(_0x8c154a,_0x825732))[_0x62ea('0x42')](handleError(_0x8c154a,null));};exports[_0x62ea('0x43')]=function(_0x91090b,_0x48c84f){var _0x45e855={'raw':!![],'where':{'id':_0x91090b[_0x62ea('0x44')]['id']}},_0x124558={};_0x124558[_0x62ea('0x2f')]=_['keys'](db['FaxTransferReport'][_0x62ea('0x45')]);_0x124558[_0x62ea('0x30')]=_[_0x62ea('0x31')](_0x91090b[_0x62ea('0x30')]);_0x124558[_0x62ea('0x32')]=_[_0x62ea('0x33')](_0x124558[_0x62ea('0x2f')],_0x124558['query']);_0x45e855[_0x62ea('0x35')]=_[_0x62ea('0x33')](_0x124558[_0x62ea('0x2f')],qs['fields'](_0x91090b[_0x62ea('0x30')][_0x62ea('0x34')]));_0x45e855['attributes']=_0x45e855['attributes'][_0x62ea('0x36')]?_0x45e855['attributes']:_0x124558[_0x62ea('0x2f')];if(_0x91090b[_0x62ea('0x30')][_0x62ea('0x46')]){_0x45e855[_0x62ea('0x47')]=[{'all':!![]}];}_0x45e855=_[_0x62ea('0x3e')]({},_0x45e855,_0x91090b[_0x62ea('0x3f')]);return db[_0x62ea('0x2b')][_0x62ea('0x48')](_0x45e855)['then'](handleEntityNotFound(_0x48c84f,null))['then'](respondWithResult(_0x48c84f,null))['catch'](handleError(_0x48c84f,null));};exports['create']=function(_0x1689c7,_0x3d6747){return db[_0x62ea('0x2b')][_0x62ea('0x49')](_0x1689c7[_0x62ea('0x4a')],{})['then'](respondWithResult(_0x3d6747,0xc9))[_0x62ea('0x42')](handleError(_0x3d6747,null));};exports[_0x62ea('0x23')]=function(_0x1e572e,_0x317879){if(_0x1e572e['body']['id']){delete _0x1e572e['body']['id'];}return db[_0x62ea('0x2b')]['find']({'where':{'id':_0x1e572e['params']['id']}})[_0x62ea('0x24')](handleEntityNotFound(_0x317879,null))[_0x62ea('0x24')](saveUpdates(_0x1e572e[_0x62ea('0x4a')],null))[_0x62ea('0x24')](respondWithResult(_0x317879,null))[_0x62ea('0x42')](handleError(_0x317879,null));};exports[_0x62ea('0x4b')]=function(_0x5d476a,_0x20e09c){return db[_0x62ea('0x2b')][_0x62ea('0x48')]({'where':{'id':_0x5d476a['params']['id']}})['then'](handleEntityNotFound(_0x20e09c,null))[_0x62ea('0x24')](removeEntity(_0x20e09c,null))['catch'](handleError(_0x20e09c,null));};exports[_0x62ea('0x4c')]=function(_0x163d30,_0x598517){return db[_0x62ea('0x2b')][_0x62ea('0x4c')]()[_0x62ea('0x24')](respondWithResult(_0x598517,null))[_0x62ea('0x42')](handleError(_0x598517,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 3509427..2100313 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 _0x34e0=['util','../../config/logger','moment','bluebird','path','define','FaxTransferReport','uniqueid'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x34e0,0xa0));var _0x034e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x34e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x034e('0x0'));var logger=require(_0x034e('0x1'))('api');var moment=require(_0x034e('0x2'));var BPromise=require(_0x034e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x034e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x39740a,_0x1a3b1d){return _0x39740a[_0x034e('0x5')](_0x034e('0x6'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x034e('0x7'),'fields':[_0x034e('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd4=['../../config/logger','api','moment','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','uniqueid','lodash'];(function(_0x42062c,_0x4be70b){var _0x5bf454=function(_0x3e792f){while(--_0x3e792f){_0x42062c['push'](_0x42062c['shift']());}};_0x5bf454(++_0x4be70b);}(_0xbdd4,0xe6));var _0x4bdd=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xbdd4[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x4bdd('0x0'));var util=require('util');var logger=require(_0x4bdd('0x1'))(_0x4bdd('0x2'));var moment=require(_0x4bdd('0x3'));var BPromise=require('bluebird');var rp=require(_0x4bdd('0x4'));var fs=require('fs');var path=require(_0x4bdd('0x5'));var rimraf=require(_0x4bdd('0x6'));var config=require('../../config/environment');var attributes=require(_0x4bdd('0x7'));module[_0x4bdd('0x8')]=function(_0x4dbb2e,_0x57b374){return _0x4dbb2e[_0x4bdd('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x4bdd('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 3e88c10..38bd9fc 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 _0x8992=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xa0a3d0,_0x14cddb){var _0x5c7fea=function(_0x28c54f){while(--_0x28c54f){_0xa0a3d0['push'](_0xa0a3d0['shift']());}};_0x5c7fea(++_0x14cddb);}(_0x8992,0x6d));var _0x2899=function(_0x1ea750,_0x1eef90){_0x1ea750=_0x1ea750-0x0;var _0x4e2baf=_0x8992[_0x1ea750];return _0x4e2baf;};'use strict';var _=require(_0x2899('0x0'));var util=require(_0x2899('0x1'));var moment=require(_0x2899('0x2'));var BPromise=require(_0x2899('0x3'));var rs=require(_0x2899('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2899('0x5'))['db'];var utils=require(_0x2899('0x6'));var logger=require('../../config/logger')(_0x2899('0x7'));var config=require(_0x2899('0x8'));var jayson=require(_0x2899('0x9'));var client=jayson[_0x2899('0xa')][_0x2899('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaf77ed,_0x3a3540,_0x4e82bb){return new BPromise(function(_0x3c8cbf,_0x3fab59){return client[_0x2899('0xc')](_0xaf77ed,_0x4e82bb)['then'](function(_0x3370b9){logger['info'](_0x2899('0xd'),_0x3a3540,_0x2899('0xe'));logger['debug'](_0x2899('0xf'),_0x3a3540,_0x2899('0xe'),JSON[_0x2899('0x10')](_0x3370b9));if(_0x3370b9[_0x2899('0x11')]){if(_0x3370b9[_0x2899('0x11')][_0x2899('0x12')]===0x1f4){logger['error'](_0x2899('0xd'),_0x3a3540,_0x3370b9['error'][_0x2899('0x13')]);return _0x3fab59(_0x3370b9['error']['message']);}logger[_0x2899('0x11')](_0x2899('0xd'),_0x3a3540,_0x3370b9[_0x2899('0x11')]['message']);return _0x3c8cbf(_0x3370b9['error'][_0x2899('0x13')]);}else{logger[_0x2899('0x14')](_0x2899('0xd'),_0x3a3540,'request\x20sent');_0x3c8cbf(_0x3370b9[_0x2899('0x15')][_0x2899('0x13')]);}})[_0x2899('0x16')](function(_0x500eb7){logger[_0x2899('0x11')](_0x2899('0xd'),_0x3a3540,_0x500eb7);_0x3fab59(_0x500eb7);});});} \ No newline at end of file +var _0x9323=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch'];(function(_0x51cf27,_0x7cbe9b){var _0x19b777=function(_0x21265a){while(--_0x21265a){_0x51cf27['push'](_0x51cf27['shift']());}};_0x19b777(++_0x7cbe9b);}(_0x9323,0x1b8));var _0x3932=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9323[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3932('0x0'));var util=require(_0x3932('0x1'));var moment=require(_0x3932('0x2'));var BPromise=require(_0x3932('0x3'));var rs=require(_0x3932('0x4'));var fs=require('fs');var Redis=require(_0x3932('0x5'));var db=require(_0x3932('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3932('0x7'));var config=require(_0x3932('0x8'));var jayson=require(_0x3932('0x9'));var client=jayson[_0x3932('0xa')][_0x3932('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f8737,_0x20450f,_0x2b1705){return new BPromise(function(_0x436de3,_0xabaa85){return client[_0x3932('0xc')](_0x4f8737,_0x2b1705)[_0x3932('0xd')](function(_0x45f226){logger[_0x3932('0xe')](_0x3932('0xf'),_0x20450f,'request\x20sent');logger[_0x3932('0x10')](_0x3932('0x11'),_0x20450f,_0x3932('0x12'),JSON['stringify'](_0x45f226));if(_0x45f226[_0x3932('0x13')]){if(_0x45f226[_0x3932('0x13')]['code']===0x1f4){logger[_0x3932('0x13')](_0x3932('0xf'),_0x20450f,_0x45f226[_0x3932('0x13')][_0x3932('0x14')]);return _0xabaa85(_0x45f226[_0x3932('0x13')][_0x3932('0x14')]);}logger[_0x3932('0x13')](_0x3932('0xf'),_0x20450f,_0x45f226['error']['message']);return _0x436de3(_0x45f226[_0x3932('0x13')]['message']);}else{logger[_0x3932('0xe')](_0x3932('0xf'),_0x20450f,'request\x20sent');_0x436de3(_0x45f226['result'][_0x3932('0x14')]);}})[_0x3932('0x15')](function(_0x38affa){logger[_0x3932('0x13')](_0x3932('0xf'),_0x20450f,_0x38affa);_0xabaa85(_0x38affa);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index dcf5bee..2c57215 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 _0x6f9b=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','delete','/:id','destroy','multer','util'];(function(_0x305b00,_0x103b96){var _0x177978=function(_0x44caed){while(--_0x44caed){_0x305b00['push'](_0x305b00['shift']());}};_0x177978(++_0x103b96);}(_0x6f9b,0x1cc));var _0xb6f9=function(_0x2efac2,_0x4414b9){_0x2efac2=_0x2efac2-0x0;var _0x33c6d3=_0x6f9b[_0x2efac2];return _0x33c6d3;};'use strict';var multer=require(_0xb6f9('0x0'));var util=require(_0xb6f9('0x1'));var path=require(_0xb6f9('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6f9('0x3'));var router=express[_0xb6f9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6f9('0x5'));var interaction=require(_0xb6f9('0x6'));var config=require(_0xb6f9('0x7'));var controller=require(_0xb6f9('0x8'));router[_0xb6f9('0x9')]('/',auth[_0xb6f9('0xa')](),controller[_0xb6f9('0xb')]);router[_0xb6f9('0x9')](_0xb6f9('0xc'),auth['isAuthenticated'](),controller[_0xb6f9('0xd')]);router[_0xb6f9('0x9')]('/:id',auth[_0xb6f9('0xa')](),controller[_0xb6f9('0xe')]);router[_0xb6f9('0xf')]('/',auth[_0xb6f9('0xa')](),controller[_0xb6f9('0x10')]);router[_0xb6f9('0x11')]('/:id',auth[_0xb6f9('0xa')](),controller['update']);router[_0xb6f9('0x12')](_0xb6f9('0x13'),auth['isAuthenticated'](),controller[_0xb6f9('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd65f=['express','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','util','path'];(function(_0x364273,_0x12ac4c){var _0x4d8673=function(_0xc5ea44){while(--_0xc5ea44){_0x364273['push'](_0x364273['shift']());}};_0x4d8673(++_0x12ac4c);}(_0xd65f,0xfa));var _0xfd65=function(_0x478970,_0x5df032){_0x478970=_0x478970-0x0;var _0x1759f1=_0xd65f[_0x478970];return _0x1759f1;};'use strict';var multer=require('multer');var util=require(_0xfd65('0x0'));var path=require(_0xfd65('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd65('0x2'));var router=express['Router']();var fs_extra=require(_0xfd65('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfd65('0x4'));var config=require(_0xfd65('0x5'));var controller=require(_0xfd65('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfd65('0x7')](_0xfd65('0x8'),auth[_0xfd65('0x9')](),controller[_0xfd65('0xa')]);router[_0xfd65('0x7')](_0xfd65('0xb'),auth[_0xfd65('0x9')](),controller['show']);router[_0xfd65('0xc')]('/',auth[_0xfd65('0x9')](),controller[_0xfd65('0xd')]);router[_0xfd65('0xe')]('/:id',auth[_0xfd65('0x9')](),controller['update']);router[_0xfd65('0xf')](_0xfd65('0xb'),auth[_0xfd65('0x9')](),controller[_0xfd65('0x10')]);module[_0xfd65('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c53ce3c..2ecd6c2 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 _0x3c2d=['post','put','/:id','update','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields'];(function(_0x40c58c,_0x2d371f){var _0x4bcb9f=function(_0x3e5df3){while(--_0x3e5df3){_0x40c58c['push'](_0x40c58c['shift']());}};_0x4bcb9f(++_0x2d371f);}(_0x3c2d,0x1d9));var _0xd3c2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3c2d[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xd3c2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd3c2('0x1'));var express=require('express');var router=express[_0xd3c2('0x2')]();var fs_extra=require(_0xd3c2('0x3'));var auth=require(_0xd3c2('0x4'));var interaction=require(_0xd3c2('0x5'));var config=require(_0xd3c2('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0xd3c2('0x7')](),controller[_0xd3c2('0x8')]);router[_0xd3c2('0x9')]('/:id',auth[_0xd3c2('0x7')](),controller['show']);router[_0xd3c2('0x9')]('/:id/configurations',auth[_0xd3c2('0x7')](),controller[_0xd3c2('0xa')]);router[_0xd3c2('0x9')](_0xd3c2('0xb'),auth[_0xd3c2('0x7')](),controller[_0xd3c2('0xc')]);router[_0xd3c2('0xd')]('/',auth[_0xd3c2('0x7')](),controller['create']);router['post']('/:id/configurations',auth[_0xd3c2('0x7')](),controller['addConfiguration']);router[_0xd3c2('0xe')](_0xd3c2('0xf'),auth[_0xd3c2('0x7')](),controller[_0xd3c2('0x10')]);router['delete']('/:id',auth[_0xd3c2('0x7')](),controller['destroy']);module[_0xd3c2('0x11')]=router; \ No newline at end of file +var _0xbb48=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','getConfigurations','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xbb48,0x9b));var _0x8bb4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbb48[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x8bb4('0x0'));var util=require(_0x8bb4('0x1'));var path=require(_0x8bb4('0x2'));var timeout=require(_0x8bb4('0x3'));var express=require('express');var router=express[_0x8bb4('0x4')]();var fs_extra=require(_0x8bb4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8bb4('0x6'));var controller=require(_0x8bb4('0x7'));router['get']('/',auth[_0x8bb4('0x8')](),controller[_0x8bb4('0x9')]);router[_0x8bb4('0xa')](_0x8bb4('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x8bb4('0xc')]);router[_0x8bb4('0xa')](_0x8bb4('0xd'),auth[_0x8bb4('0x8')](),controller['getFields']);router[_0x8bb4('0xe')]('/',auth[_0x8bb4('0x8')](),controller[_0x8bb4('0xf')]);router[_0x8bb4('0xe')](_0x8bb4('0x10'),auth[_0x8bb4('0x8')](),controller['addConfiguration']);router[_0x8bb4('0x11')]('/:id',auth[_0x8bb4('0x8')](),controller[_0x8bb4('0x12')]);router[_0x8bb4('0x13')]('/:id',auth[_0x8bb4('0x8')](),controller[_0x8bb4('0x14')]);module[_0x8bb4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index cf48b7e..e6d7229 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 _0xbfa8=['integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xbfa8,0x17b));var _0x8bfa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbfa8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8bfa('0x0'));module[_0x8bfa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8bfa('0x2')]},'username':{'type':Sequelize[_0x8bfa('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x8bfa('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x8bfa('0x2')]},'consumerSecret':{'type':Sequelize[_0x8bfa('0x2')]},'token':{'type':Sequelize[_0x8bfa('0x2')]},'tokenSecret':{'type':Sequelize[_0x8bfa('0x2')]},'serverUrl':{'type':Sequelize[_0x8bfa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8bfa('0x4')](_0x8bfa('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc63a=['STRING','ENUM','basic','newTab','integrationTab','exports'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xc63a,0x77));var _0xac63=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0xc63a[_0xbb14db];return _0x36bed7;};'use strict';var Sequelize=require('sequelize');module[_0xac63('0x0')]={'name':{'type':Sequelize[_0xac63('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xac63('0x1')]},'authType':{'type':Sequelize[_0xac63('0x2')](_0xac63('0x3')),'defaultValue':_0xac63('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xac63('0x1')]},'token':{'type':Sequelize[_0xac63('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xac63('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xac63('0x4')),'defaultValue':_0xac63('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index d40f1cd..56022a2 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 _0x199d=['slice','substring','%s/custom_fields','application/json','basic','headers','Authorization','format','toString','base64','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','offset','status','set','apply','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','update','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','token','tokenSecret','remoteUri'];(function(_0x17e5ac,_0x502081){var _0x30a779=function(_0x433710){while(--_0x433710){_0x17e5ac['push'](_0x17e5ac['shift']());}};_0x30a779(++_0x502081);}(_0x199d,0x160));var _0xd199=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x199d[_0x2431d6];return _0x4d0f9b;};'use strict';var emlformat=require(_0xd199('0x0'));var rimraf=require(_0xd199('0x1'));var zipdir=require(_0xd199('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd199('0x3'));var BPromise=require(_0xd199('0x4'));var Mustache=require('mustache');var util=require(_0xd199('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd199('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd199('0x7'));var _=require(_0xd199('0x8'));var squel=require(_0xd199('0x9'));var crypto=require(_0xd199('0xa'));var jsforce=require(_0xd199('0xb'));var deskjs=require(_0xd199('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd199('0xd'));var Papa=require('papaparse');var Redis=require(_0xd199('0xe'));var authService=require(_0xd199('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd199('0x10'));var hardwareService=require(_0xd199('0x11'));var logger=require(_0xd199('0x12'))(_0xd199('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd199('0x14'));var db=require(_0xd199('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2288e4,_0x1dacc5){_0x1dacc5=_0x1dacc5||0xcc;return function(_0x4a05c2){if(_0x4a05c2){return _0x2288e4[_0xd199('0x16')](_0x1dacc5);}return _0x2288e4['status'](_0x1dacc5)[_0xd199('0x17')]();};}function respondWithResult(_0x268425,_0x454040){_0x454040=_0x454040||0xc8;return function(_0x4ee1b8){if(_0x4ee1b8){return _0x268425['status'](_0x454040)[_0xd199('0x18')](_0x4ee1b8);}};}function respondWithFilteredResult(_0x54b80c,_0x34af96){return function(_0x26f673){if(_0x26f673){var _0x5b2518=typeof _0x34af96['offset']==='undefined'&&typeof _0x34af96[_0xd199('0x19')]===_0xd199('0x1a');var _0x52e037=_0x26f673['count'];var _0x54b763=_0x5b2518?0x0:_0x34af96[_0xd199('0x1b')];var _0x2a85b4=_0x5b2518?_0x26f673['count']:_0x34af96['offset']+_0x34af96[_0xd199('0x19')];var _0x597bde;if(_0x2a85b4>=_0x52e037){_0x2a85b4=_0x52e037;_0x597bde=0xc8;}else{_0x597bde=0xce;}_0x54b80c[_0xd199('0x1c')](_0x597bde);return _0x54b80c[_0xd199('0x1d')]('Content-Range',_0x54b763+'-'+_0x2a85b4+'/'+_0x52e037)['json'](_0x26f673);}return null;};}function patchUpdates(_0x414b05){return function(_0xb60e62){try{jsonpatch[_0xd199('0x1e')](_0xb60e62,_0x414b05,!![]);}catch(_0x15cf11){return BPromise['reject'](_0x15cf11);}return _0xb60e62['save']();};}function saveUpdates(_0x4afc7f,_0x4fbf11){return function(_0x43b7f1){if(_0x43b7f1){return _0x43b7f1['update'](_0x4afc7f)['then'](function(_0x50f8b6){return _0x50f8b6;});}return null;};}function removeEntity(_0x1524ea,_0x23a4e7){return function(_0xeccc4f){if(_0xeccc4f){return _0xeccc4f[_0xd199('0x1f')]()[_0xd199('0x20')](function(){_0x1524ea[_0xd199('0x1c')](0xcc)[_0xd199('0x17')]();});}};}function handleEntityNotFound(_0x467006,_0xea898f){return function(_0x1c5297){if(!_0x1c5297){_0x467006['sendStatus'](0x194);}return _0x1c5297;};}function handleError(_0x18e2dc,_0x332f6a){_0x332f6a=_0x332f6a||0x1f4;return function(_0x221ea8){logger[_0xd199('0x21')](_0x221ea8[_0xd199('0x22')]);if(_0x221ea8[_0xd199('0x23')]){delete _0x221ea8[_0xd199('0x23')];}_0x18e2dc[_0xd199('0x1c')](_0x332f6a)[_0xd199('0x24')](_0x221ea8);};}exports[_0xd199('0x25')]=function(_0x104018,_0x569bf4){var _0x31966b={},_0x128282={},_0x38b87d={'count':0x0,'rows':[]};var _0x166280=_[_0xd199('0x26')](db[_0xd199('0x27')][_0xd199('0x28')],function(_0x275661){return{'name':_0x275661[_0xd199('0x29')],'type':_0x275661[_0xd199('0x2a')][_0xd199('0x2b')]};});_0x128282[_0xd199('0x2c')]=_[_0xd199('0x26')](_0x166280,'name');_0x128282[_0xd199('0x2d')]=_['keys'](_0x104018[_0xd199('0x2d')]);_0x128282[_0xd199('0x2e')]=_['intersection'](_0x128282['model'],_0x128282[_0xd199('0x2d')]);_0x31966b[_0xd199('0x2f')]=_['intersection'](_0x128282['model'],qs[_0xd199('0x30')](_0x104018['query'][_0xd199('0x30')]));_0x31966b[_0xd199('0x2f')]=_0x31966b[_0xd199('0x2f')][_0xd199('0x31')]?_0x31966b[_0xd199('0x2f')]:_0x128282['model'];if(!_0x104018[_0xd199('0x2d')][_0xd199('0x32')](_0xd199('0x33'))){_0x31966b[_0xd199('0x19')]=qs[_0xd199('0x19')](_0x104018[_0xd199('0x2d')][_0xd199('0x19')]);_0x31966b[_0xd199('0x1b')]=qs[_0xd199('0x1b')](_0x104018['query'][_0xd199('0x1b')]);}_0x31966b[_0xd199('0x34')]=qs[_0xd199('0x35')](_0x104018[_0xd199('0x2d')][_0xd199('0x35')]);_0x31966b[_0xd199('0x36')]=qs['filters'](_['pick'](_0x104018[_0xd199('0x2d')],_0x128282['filters']),_0x166280);if(_0x104018[_0xd199('0x2d')][_0xd199('0x37')]){_0x31966b['where']=_['merge'](_0x31966b[_0xd199('0x36')],{'$or':_['map'](_0x166280,function(_0x16cb63){if(_0x16cb63[_0xd199('0x2a')]!==_0xd199('0x38')){var _0x1958e3={};_0x1958e3[_0x16cb63['name']]={'$like':'%'+_0x104018[_0xd199('0x2d')][_0xd199('0x37')]+'%'};return _0x1958e3;}})});}_0x31966b=_[_0xd199('0x39')]({},_0x31966b,_0x104018[_0xd199('0x3a')]);var _0x70bc6b={'where':_0x31966b[_0xd199('0x36')]};return db['DeskAccount'][_0xd199('0x3b')](_0x70bc6b)[_0xd199('0x20')](function(_0x53cbad){_0x38b87d[_0xd199('0x3b')]=_0x53cbad;if(_0x104018[_0xd199('0x2d')][_0xd199('0x3c')]){_0x31966b[_0xd199('0x3d')]=[{'all':!![]}];}return db[_0xd199('0x27')][_0xd199('0x3e')](_0x31966b);})[_0xd199('0x20')](function(_0x512994){_0x38b87d[_0xd199('0x3f')]=_0x512994;return _0x38b87d;})[_0xd199('0x20')](respondWithFilteredResult(_0x569bf4,_0x31966b))[_0xd199('0x40')](handleError(_0x569bf4,null));};exports[_0xd199('0x41')]=function(_0x456f58,_0x2f3cac){var _0x587177={'raw':![],'where':{'id':_0x456f58[_0xd199('0x42')]['id']}},_0x36a6ee={};_0x36a6ee[_0xd199('0x2c')]=_[_0xd199('0x43')](db['DeskAccount'][_0xd199('0x28')]);_0x36a6ee['query']=_[_0xd199('0x43')](_0x456f58['query']);_0x36a6ee[_0xd199('0x2e')]=_['intersection'](_0x36a6ee[_0xd199('0x2c')],_0x36a6ee[_0xd199('0x2d')]);_0x587177['attributes']=_[_0xd199('0x44')](_0x36a6ee[_0xd199('0x2c')],qs[_0xd199('0x30')](_0x456f58[_0xd199('0x2d')]['fields']));_0x587177[_0xd199('0x2f')]=_0x587177[_0xd199('0x2f')][_0xd199('0x31')]?_0x587177[_0xd199('0x2f')]:_0x36a6ee[_0xd199('0x2c')];if(_0x456f58['query'][_0xd199('0x3c')]){_0x587177[_0xd199('0x3d')]=[{'all':!![]}];}_0x587177=_[_0xd199('0x39')]({},_0x587177,_0x456f58['options']);return db[_0xd199('0x27')][_0xd199('0x45')](_0x587177)['then'](handleEntityNotFound(_0x2f3cac,null))['then'](respondWithResult(_0x2f3cac,null))[_0xd199('0x40')](handleError(_0x2f3cac,null));};exports[_0xd199('0x46')]=function(_0x51979c,_0x416619){return db['DeskAccount'][_0xd199('0x46')](_0x51979c['body'],{})[_0xd199('0x20')](respondWithResult(_0x416619,0xc9))[_0xd199('0x40')](handleError(_0x416619,null));};exports[_0xd199('0x47')]=function(_0x3a668a,_0x4b201d){if(_0x3a668a[_0xd199('0x48')]['id']){delete _0x3a668a[_0xd199('0x48')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x3a668a[_0xd199('0x42')]['id']}})[_0xd199('0x20')](handleEntityNotFound(_0x4b201d,null))['then'](saveUpdates(_0x3a668a[_0xd199('0x48')],null))['then'](respondWithResult(_0x4b201d,null))['catch'](handleError(_0x4b201d,null));};exports[_0xd199('0x1f')]=function(_0x139928,_0x42a81a){return db[_0xd199('0x27')][_0xd199('0x45')]({'where':{'id':_0x139928[_0xd199('0x42')]['id']}})[_0xd199('0x20')](handleEntityNotFound(_0x42a81a,null))[_0xd199('0x20')](removeEntity(_0x42a81a,null))[_0xd199('0x40')](handleError(_0x42a81a,null));};exports[_0xd199('0x49')]=function(_0x20205d,_0x320ba6,_0x1f3cb8){var _0x37ced0={};var _0x39c3fd={};var _0x203488;var _0x25b47e;return db['DeskAccount'][_0xd199('0x4a')]({'where':{'id':_0x20205d[_0xd199('0x42')]['id']}})['then'](handleEntityNotFound(_0x320ba6,null))[_0xd199('0x20')](function(_0x350023){if(_0x350023){_0x203488=_0x350023;_0x39c3fd[_0xd199('0x2c')]=_[_0xd199('0x43')](db[_0xd199('0x4b')][_0xd199('0x28')]);_0x39c3fd[_0xd199('0x2d')]=_['keys'](_0x20205d[_0xd199('0x2d')]);_0x39c3fd['filters']=_['intersection'](_0x39c3fd[_0xd199('0x2c')],_0x39c3fd[_0xd199('0x2d')]);_0x37ced0[_0xd199('0x2f')]=_[_0xd199('0x44')](_0x39c3fd[_0xd199('0x2c')],qs[_0xd199('0x30')](_0x20205d[_0xd199('0x2d')][_0xd199('0x30')]));_0x37ced0['attributes']=_0x37ced0[_0xd199('0x2f')][_0xd199('0x31')]?_0x37ced0[_0xd199('0x2f')]:_0x39c3fd[_0xd199('0x2c')];_0x37ced0['order']=qs[_0xd199('0x35')](_0x20205d[_0xd199('0x2d')][_0xd199('0x35')]);_0x37ced0[_0xd199('0x36')]=qs[_0xd199('0x2e')](_['pick'](_0x20205d['query'],_0x39c3fd['filters']));if(_0x20205d['query']['filter']){_0x37ced0[_0xd199('0x36')]=_[_0xd199('0x39')](_0x37ced0[_0xd199('0x36')],{'$or':_[_0xd199('0x26')](_0x37ced0[_0xd199('0x2f')],function(_0x57d88f){var _0x15e690={};_0x15e690[_0x57d88f]={'$like':'%'+_0x20205d['query']['filter']+'%'};return _0x15e690;})});}_0x37ced0=_[_0xd199('0x39')]({},_0x37ced0,_0x20205d[_0xd199('0x3a')]);return _0x203488[_0xd199('0x49')](_0x37ced0);}})[_0xd199('0x20')](function(_0x5acf43){if(_0x5acf43){_0x25b47e=_0x5acf43[_0xd199('0x31')];if(!_0x20205d[_0xd199('0x2d')][_0xd199('0x32')](_0xd199('0x33'))){_0x37ced0[_0xd199('0x19')]=qs[_0xd199('0x19')](_0x20205d['query']['limit']);_0x37ced0[_0xd199('0x1b')]=qs[_0xd199('0x1b')](_0x20205d['query'][_0xd199('0x1b')]);}return _0x203488['getConfigurations'](_0x37ced0);}})[_0xd199('0x20')](function(_0x4cf286){if(_0x4cf286){return _0x4cf286?{'count':_0x25b47e,'rows':_0x4cf286}:null;}})[_0xd199('0x20')](respondWithResult(_0x320ba6,null))['catch'](handleError(_0x320ba6,null));};exports[_0xd199('0x4c')]=function(_0x508410,_0x27eaf0,_0x2fd838){if(_0x508410[_0xd199('0x48')]['id']){delete _0x508410[_0xd199('0x48')]['id'];}return db[_0xd199('0x27')][_0xd199('0x4a')]({'where':{'id':_0x508410[_0xd199('0x42')]['id']}})[_0xd199('0x20')](handleEntityNotFound(_0x27eaf0,null))[_0xd199('0x20')](function(_0x5c2756){if(_0x5c2756){_0x508410['body'][_0xd199('0x4d')]=_0x5c2756['id'];_0x508410[_0xd199('0x48')][_0xd199('0x4e')]=integrations[_0xd199('0x4f')](_0x508410[_0xd199('0x48')][_0xd199('0x50')],_0x508410[_0xd199('0x48')][_0xd199('0x2a')]);_0x508410['body'][_0xd199('0x51')]=integrations[_0xd199('0x52')](_0x508410[_0xd199('0x48')][_0xd199('0x50')],_0x508410['body'][_0xd199('0x2a')]);return db['DeskConfiguration'][_0xd199('0x46')](_0x508410[_0xd199('0x48')],{'include':[{'model':db[_0xd199('0x53')],'as':_0xd199('0x4e')},{'model':db[_0xd199('0x53')],'as':_0xd199('0x51')}]});}return null;})[_0xd199('0x20')](respondWithResult(_0x27eaf0,null))['catch'](handleError(_0x27eaf0,null));};exports[_0xd199('0x54')]=function(_0x28e914,_0xcda67d,_0x46e6f7){var _0x1771af=[{'name':_0xd199('0x55'),'label':_0xd199('0x55'),'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 _0x332f6d='';return db[_0xd199('0x27')]['findOne']({'where':{'id':_0x28e914[_0xd199('0x42')]['id']},'attributes':['id','remoteUri',_0xd199('0x56'),_0xd199('0x57'),_0xd199('0x58'),'consumerKey','consumerSecret',_0xd199('0x59'),_0xd199('0x5a')]})[_0xd199('0x20')](handleEntityNotFound(_0xcda67d,null))[_0xd199('0x20')](function(_0x1027ef){if(_0x1027ef){_0x332f6d=_0x1027ef[_0xd199('0x5b')];var _0x22bd9f=_0x332f6d[_0xd199('0x5c')](-0x1);if(_0x22bd9f==='/'){_0x332f6d=_0x332f6d[_0xd199('0x5d')](0x0,_0x332f6d['lastIndexOf'](_0x22bd9f));}var _0x19a06d={'method':'GET','uri':util['format'](_0xd199('0x5e'),_0x332f6d),'headers':{'Content-Type':_0xd199('0x5f'),'Accept':_0xd199('0x5f')},'json':!![]};if(_0x1027ef['authType']===_0xd199('0x60')){_0x19a06d[_0xd199('0x61')][_0xd199('0x62')]=util[_0xd199('0x63')]('Basic\x20%s',new Buffer(util[_0xd199('0x63')]('%s:%s',_0x1027ef[_0xd199('0x57')],_0x1027ef[_0xd199('0x58')]))[_0xd199('0x64')](_0xd199('0x65')));}return rp(_0x19a06d)[_0xd199('0x20')](function(_0x1d0309){return _0x1771af[_0xd199('0x66')](_['map'](_0x1d0309[_0xd199('0x67')]['entries'],function(_0x3762e1){return{'id':_0x3762e1[_0xd199('0x23')],'name':_0x3762e1[_0xd199('0x23')],'type':_0x3762e1[_0xd199('0x2a')],'active':_0x3762e1[_0xd199('0x68')],'label':_0x3762e1[_0xd199('0x69')],'custom':!![]};}));});}})['then'](function(_0x2b904e){return{'count':_0x2b904e[_0xd199('0x31')],'rows':_0x2b904e};})[_0xd199('0x20')](respondWithResult(_0xcda67d,null))[_0xd199('0x40')](function(_0x29ae6d){var _0xb13b02=_0x28e914['query']['test']?0x1f4:_0x29ae6d[_0xd199('0x6a')]||0x1f4;logger[_0xd199('0x21')](_0xd199('0x6b'),'getFields',_0xb13b02,JSON[_0xd199('0x6c')](_0x29ae6d));delete _0x29ae6d[_0xd199('0x23')];if(_0xb13b02===0x191){_0xb13b02=0x190;}_0xcda67d[_0xd199('0x1c')](_0xb13b02)['send'](_0x28e914[_0xd199('0x2d')][_0xd199('0x6d')]?{'message':_0xd199('0x6e'),'statusCode':_0x29ae6d[_0xd199('0x6a')]}:_0x29ae6d);});}; \ No newline at end of file +var _0xbdcb=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','show','params','includeAll','catch','create','body','update','find','getConfigurations','length','addConfiguration','findOne','AccountId','channel','getDescriptions','DeskConfiguration','DeskField','Subjects','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','basic','Authorization','format','%s:%s','username','password','toString','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x48d7aa,_0x52349c){var _0x138fc6=function(_0x273dd9){while(--_0x273dd9){_0x48d7aa['push'](_0x48d7aa['shift']());}};_0x138fc6(++_0x52349c);}(_0xbdcb,0x13d));var _0xbbdc=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xbdcb[_0x173441];return _0x2423a8;};'use strict';var emlformat=require(_0xbbdc('0x0'));var rimraf=require(_0xbbdc('0x1'));var zipdir=require(_0xbbdc('0x2'));var jsonpatch=require(_0xbbdc('0x3'));var rp=require(_0xbbdc('0x4'));var moment=require(_0xbbdc('0x5'));var BPromise=require(_0xbbdc('0x6'));var Mustache=require(_0xbbdc('0x7'));var util=require('util');var path=require(_0xbbdc('0x8'));var sox=require('sox');var csv=require(_0xbbdc('0x9'));var ejs=require(_0xbbdc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbdc('0xb'));var squel=require(_0xbbdc('0xc'));var crypto=require('crypto');var jsforce=require(_0xbbdc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbdc('0x9'));var querystring=require(_0xbbdc('0xe'));var Papa=require(_0xbbdc('0xf'));var Redis=require(_0xbbdc('0x10'));var authService=require(_0xbbdc('0x11'));var qs=require(_0xbbdc('0x12'));var as=require(_0xbbdc('0x13'));var hardwareService=require(_0xbbdc('0x14'));var logger=require(_0xbbdc('0x15'))(_0xbbdc('0x16'));var utils=require(_0xbbdc('0x17'));var config=require(_0xbbdc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbdc('0x19'))['db'];var integrations=require(_0xbbdc('0x1a'));function respondWithStatusCode(_0x59f1b3,_0x19f00a){_0x19f00a=_0x19f00a||0xcc;return function(_0x575b83){if(_0x575b83){return _0x59f1b3[_0xbbdc('0x1b')](_0x19f00a);}return _0x59f1b3[_0xbbdc('0x1c')](_0x19f00a)[_0xbbdc('0x1d')]();};}function respondWithResult(_0x32f94a,_0x33f3c8){_0x33f3c8=_0x33f3c8||0xc8;return function(_0x45a6a2){if(_0x45a6a2){return _0x32f94a[_0xbbdc('0x1c')](_0x33f3c8)[_0xbbdc('0x1e')](_0x45a6a2);}};}function respondWithFilteredResult(_0x12a743,_0x1f094a){return function(_0xba1ec3){if(_0xba1ec3){var _0xe9db45=typeof _0x1f094a[_0xbbdc('0x1f')]==='undefined'&&typeof _0x1f094a[_0xbbdc('0x20')]===_0xbbdc('0x21');var _0x11109e=_0xba1ec3['count'];var _0x3fb965=_0xe9db45?0x0:_0x1f094a[_0xbbdc('0x1f')];var _0xded6c2=_0xe9db45?_0xba1ec3[_0xbbdc('0x22')]:_0x1f094a[_0xbbdc('0x1f')]+_0x1f094a[_0xbbdc('0x20')];var _0x3042b3;if(_0xded6c2>=_0x11109e){_0xded6c2=_0x11109e;_0x3042b3=0xc8;}else{_0x3042b3=0xce;}_0x12a743[_0xbbdc('0x1c')](_0x3042b3);return _0x12a743[_0xbbdc('0x23')](_0xbbdc('0x24'),_0x3fb965+'-'+_0xded6c2+'/'+_0x11109e)[_0xbbdc('0x1e')](_0xba1ec3);}return null;};}function patchUpdates(_0x45275d){return function(_0x259f30){try{jsonpatch[_0xbbdc('0x25')](_0x259f30,_0x45275d,!![]);}catch(_0x30b623){return BPromise[_0xbbdc('0x26')](_0x30b623);}return _0x259f30[_0xbbdc('0x27')]();};}function saveUpdates(_0x1478a1,_0xf7ef4d){return function(_0x1266d6){if(_0x1266d6){return _0x1266d6['update'](_0x1478a1)[_0xbbdc('0x28')](function(_0x53eae1){return _0x53eae1;});}return null;};}function removeEntity(_0x921301,_0x20644a){return function(_0x1188cd){if(_0x1188cd){return _0x1188cd[_0xbbdc('0x29')]()[_0xbbdc('0x28')](function(){_0x921301[_0xbbdc('0x1c')](0xcc)[_0xbbdc('0x1d')]();});}};}function handleEntityNotFound(_0x2cc37b,_0x1e7479){return function(_0x310120){if(!_0x310120){_0x2cc37b[_0xbbdc('0x1b')](0x194);}return _0x310120;};}function handleError(_0x5019b1,_0x24498b){_0x24498b=_0x24498b||0x1f4;return function(_0x201458){logger[_0xbbdc('0x2a')](_0x201458[_0xbbdc('0x2b')]);if(_0x201458['name']){delete _0x201458[_0xbbdc('0x2c')];}_0x5019b1[_0xbbdc('0x1c')](_0x24498b)[_0xbbdc('0x2d')](_0x201458);};}exports[_0xbbdc('0x2e')]=function(_0x3d50dc,_0x3dba0e){var _0x575928={},_0x5cdd78={},_0x2aa231={'count':0x0,'rows':[]};var _0x2b2095=_['map'](db[_0xbbdc('0x2f')][_0xbbdc('0x30')],function(_0x5a7085){return{'name':_0x5a7085[_0xbbdc('0x31')],'type':_0x5a7085[_0xbbdc('0x32')][_0xbbdc('0x33')]};});_0x5cdd78[_0xbbdc('0x34')]=_[_0xbbdc('0x35')](_0x2b2095,_0xbbdc('0x2c'));_0x5cdd78[_0xbbdc('0x36')]=_[_0xbbdc('0x37')](_0x3d50dc['query']);_0x5cdd78[_0xbbdc('0x38')]=_[_0xbbdc('0x39')](_0x5cdd78[_0xbbdc('0x34')],_0x5cdd78[_0xbbdc('0x36')]);_0x575928['attributes']=_['intersection'](_0x5cdd78['model'],qs[_0xbbdc('0x3a')](_0x3d50dc['query'][_0xbbdc('0x3a')]));_0x575928[_0xbbdc('0x3b')]=_0x575928[_0xbbdc('0x3b')]['length']?_0x575928['attributes']:_0x5cdd78['model'];if(!_0x3d50dc[_0xbbdc('0x36')][_0xbbdc('0x3c')](_0xbbdc('0x3d'))){_0x575928[_0xbbdc('0x20')]=qs[_0xbbdc('0x20')](_0x3d50dc[_0xbbdc('0x36')][_0xbbdc('0x20')]);_0x575928[_0xbbdc('0x1f')]=qs[_0xbbdc('0x1f')](_0x3d50dc[_0xbbdc('0x36')]['offset']);}_0x575928[_0xbbdc('0x3e')]=qs[_0xbbdc('0x3f')](_0x3d50dc['query'][_0xbbdc('0x3f')]);_0x575928[_0xbbdc('0x40')]=qs[_0xbbdc('0x38')](_[_0xbbdc('0x41')](_0x3d50dc[_0xbbdc('0x36')],_0x5cdd78['filters']),_0x2b2095);if(_0x3d50dc[_0xbbdc('0x36')][_0xbbdc('0x42')]){_0x575928[_0xbbdc('0x40')]=_[_0xbbdc('0x43')](_0x575928[_0xbbdc('0x40')],{'$or':_[_0xbbdc('0x35')](_0x2b2095,function(_0x31ec1a){if(_0x31ec1a['type']!==_0xbbdc('0x44')){var _0x1097b1={};_0x1097b1[_0x31ec1a[_0xbbdc('0x2c')]]={'$like':'%'+_0x3d50dc[_0xbbdc('0x36')][_0xbbdc('0x42')]+'%'};return _0x1097b1;}})});}_0x575928=_[_0xbbdc('0x43')]({},_0x575928,_0x3d50dc[_0xbbdc('0x45')]);var _0x5208d8={'where':_0x575928[_0xbbdc('0x40')]};return db[_0xbbdc('0x2f')][_0xbbdc('0x22')](_0x5208d8)['then'](function(_0x82cf57){_0x2aa231[_0xbbdc('0x22')]=_0x82cf57;if(_0x3d50dc[_0xbbdc('0x36')]['includeAll']){_0x575928['include']=[{'all':!![]}];}return db[_0xbbdc('0x2f')]['findAll'](_0x575928);})['then'](function(_0x376e2d){_0x2aa231['rows']=_0x376e2d;return _0x2aa231;})['then'](respondWithFilteredResult(_0x3dba0e,_0x575928))['catch'](handleError(_0x3dba0e,null));};exports[_0xbbdc('0x46')]=function(_0x565014,_0x3d71d2){var _0x36f873={'raw':![],'where':{'id':_0x565014[_0xbbdc('0x47')]['id']}},_0x486321={};_0x486321[_0xbbdc('0x34')]=_[_0xbbdc('0x37')](db['DeskAccount']['rawAttributes']);_0x486321[_0xbbdc('0x36')]=_[_0xbbdc('0x37')](_0x565014[_0xbbdc('0x36')]);_0x486321[_0xbbdc('0x38')]=_['intersection'](_0x486321[_0xbbdc('0x34')],_0x486321['query']);_0x36f873[_0xbbdc('0x3b')]=_[_0xbbdc('0x39')](_0x486321['model'],qs['fields'](_0x565014[_0xbbdc('0x36')][_0xbbdc('0x3a')]));_0x36f873[_0xbbdc('0x3b')]=_0x36f873[_0xbbdc('0x3b')]['length']?_0x36f873[_0xbbdc('0x3b')]:_0x486321[_0xbbdc('0x34')];if(_0x565014[_0xbbdc('0x36')][_0xbbdc('0x48')]){_0x36f873['include']=[{'all':!![]}];}_0x36f873=_[_0xbbdc('0x43')]({},_0x36f873,_0x565014['options']);return db[_0xbbdc('0x2f')]['find'](_0x36f873)[_0xbbdc('0x28')](handleEntityNotFound(_0x3d71d2,null))[_0xbbdc('0x28')](respondWithResult(_0x3d71d2,null))[_0xbbdc('0x49')](handleError(_0x3d71d2,null));};exports[_0xbbdc('0x4a')]=function(_0x497059,_0x3fcafe){return db[_0xbbdc('0x2f')][_0xbbdc('0x4a')](_0x497059[_0xbbdc('0x4b')],{})[_0xbbdc('0x28')](respondWithResult(_0x3fcafe,0xc9))[_0xbbdc('0x49')](handleError(_0x3fcafe,null));};exports[_0xbbdc('0x4c')]=function(_0x5cd03c,_0x2412b0){if(_0x5cd03c['body']['id']){delete _0x5cd03c[_0xbbdc('0x4b')]['id'];}return db[_0xbbdc('0x2f')][_0xbbdc('0x4d')]({'where':{'id':_0x5cd03c[_0xbbdc('0x47')]['id']}})['then'](handleEntityNotFound(_0x2412b0,null))[_0xbbdc('0x28')](saveUpdates(_0x5cd03c[_0xbbdc('0x4b')],null))[_0xbbdc('0x28')](respondWithResult(_0x2412b0,null))[_0xbbdc('0x49')](handleError(_0x2412b0,null));};exports['destroy']=function(_0x896dcc,_0x121880){return db[_0xbbdc('0x2f')]['find']({'where':{'id':_0x896dcc['params']['id']}})[_0xbbdc('0x28')](handleEntityNotFound(_0x121880,null))[_0xbbdc('0x28')](removeEntity(_0x121880,null))['catch'](handleError(_0x121880,null));};exports[_0xbbdc('0x4e')]=function(_0x4adbf3,_0x4cfd38,_0x363d24){var _0x48891f={};var _0x1b58ef={};var _0x20eba7;var _0x430702;return db['DeskAccount']['findOne']({'where':{'id':_0x4adbf3['params']['id']}})[_0xbbdc('0x28')](handleEntityNotFound(_0x4cfd38,null))[_0xbbdc('0x28')](function(_0x33894d){if(_0x33894d){_0x20eba7=_0x33894d;_0x1b58ef[_0xbbdc('0x34')]=_[_0xbbdc('0x37')](db['DeskConfiguration'][_0xbbdc('0x30')]);_0x1b58ef['query']=_[_0xbbdc('0x37')](_0x4adbf3[_0xbbdc('0x36')]);_0x1b58ef['filters']=_[_0xbbdc('0x39')](_0x1b58ef['model'],_0x1b58ef[_0xbbdc('0x36')]);_0x48891f[_0xbbdc('0x3b')]=_['intersection'](_0x1b58ef[_0xbbdc('0x34')],qs[_0xbbdc('0x3a')](_0x4adbf3[_0xbbdc('0x36')][_0xbbdc('0x3a')]));_0x48891f[_0xbbdc('0x3b')]=_0x48891f[_0xbbdc('0x3b')]['length']?_0x48891f[_0xbbdc('0x3b')]:_0x1b58ef[_0xbbdc('0x34')];_0x48891f[_0xbbdc('0x3e')]=qs[_0xbbdc('0x3f')](_0x4adbf3['query'][_0xbbdc('0x3f')]);_0x48891f['where']=qs[_0xbbdc('0x38')](_[_0xbbdc('0x41')](_0x4adbf3['query'],_0x1b58ef[_0xbbdc('0x38')]));if(_0x4adbf3[_0xbbdc('0x36')]['filter']){_0x48891f[_0xbbdc('0x40')]=_[_0xbbdc('0x43')](_0x48891f['where'],{'$or':_[_0xbbdc('0x35')](_0x48891f[_0xbbdc('0x3b')],function(_0x540cb1){var _0x27f882={};_0x27f882[_0x540cb1]={'$like':'%'+_0x4adbf3['query'][_0xbbdc('0x42')]+'%'};return _0x27f882;})});}_0x48891f=_['merge']({},_0x48891f,_0x4adbf3[_0xbbdc('0x45')]);return _0x20eba7[_0xbbdc('0x4e')](_0x48891f);}})['then'](function(_0x2a58c6){if(_0x2a58c6){_0x430702=_0x2a58c6[_0xbbdc('0x4f')];if(!_0x4adbf3[_0xbbdc('0x36')][_0xbbdc('0x3c')](_0xbbdc('0x3d'))){_0x48891f[_0xbbdc('0x20')]=qs[_0xbbdc('0x20')](_0x4adbf3[_0xbbdc('0x36')][_0xbbdc('0x20')]);_0x48891f[_0xbbdc('0x1f')]=qs['offset'](_0x4adbf3[_0xbbdc('0x36')][_0xbbdc('0x1f')]);}return _0x20eba7[_0xbbdc('0x4e')](_0x48891f);}})[_0xbbdc('0x28')](function(_0x3d7a96){if(_0x3d7a96){return _0x3d7a96?{'count':_0x430702,'rows':_0x3d7a96}:null;}})[_0xbbdc('0x28')](respondWithResult(_0x4cfd38,null))[_0xbbdc('0x49')](handleError(_0x4cfd38,null));};exports[_0xbbdc('0x50')]=function(_0x807376,_0x287893,_0x1f5f4c){if(_0x807376[_0xbbdc('0x4b')]['id']){delete _0x807376[_0xbbdc('0x4b')]['id'];}return db['DeskAccount'][_0xbbdc('0x51')]({'where':{'id':_0x807376[_0xbbdc('0x47')]['id']}})[_0xbbdc('0x28')](handleEntityNotFound(_0x287893,null))['then'](function(_0x5731ed){if(_0x5731ed){_0x807376[_0xbbdc('0x4b')][_0xbbdc('0x52')]=_0x5731ed['id'];_0x807376['body']['Subjects']=integrations['getSubjects'](_0x807376[_0xbbdc('0x4b')][_0xbbdc('0x53')],_0x807376['body']['type']);_0x807376['body']['Descriptions']=integrations[_0xbbdc('0x54')](_0x807376[_0xbbdc('0x4b')][_0xbbdc('0x53')],_0x807376[_0xbbdc('0x4b')][_0xbbdc('0x32')]);return db[_0xbbdc('0x55')][_0xbbdc('0x4a')](_0x807376[_0xbbdc('0x4b')],{'include':[{'model':db[_0xbbdc('0x56')],'as':_0xbbdc('0x57')},{'model':db[_0xbbdc('0x56')],'as':'Descriptions'}]});}return null;})[_0xbbdc('0x28')](respondWithResult(_0x287893,null))[_0xbbdc('0x49')](handleError(_0x287893,null));};exports[_0xbbdc('0x58')]=function(_0x3937b0,_0x48b3ea,_0x287c55){var _0x2e89e9=[{'name':_0xbbdc('0x59'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3a6e3d='';return db['DeskAccount'][_0xbbdc('0x51')]({'where':{'id':_0x3937b0[_0xbbdc('0x47')]['id']},'attributes':['id',_0xbbdc('0x5a'),_0xbbdc('0x5b'),'username','password',_0xbbdc('0x5c'),_0xbbdc('0x5d'),'token',_0xbbdc('0x5e')]})['then'](handleEntityNotFound(_0x48b3ea,null))[_0xbbdc('0x28')](function(_0x58ec03){if(_0x58ec03){_0x3a6e3d=_0x58ec03[_0xbbdc('0x5a')];var _0x2e69a6=_0x3a6e3d['slice'](-0x1);if(_0x2e69a6==='/'){_0x3a6e3d=_0x3a6e3d[_0xbbdc('0x5f')](0x0,_0x3a6e3d[_0xbbdc('0x60')](_0x2e69a6));}var _0x55012f={'method':_0xbbdc('0x61'),'uri':util['format'](_0xbbdc('0x62'),_0x3a6e3d),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x58ec03[_0xbbdc('0x5b')]===_0xbbdc('0x63')){_0x55012f['headers'][_0xbbdc('0x64')]=util[_0xbbdc('0x65')]('Basic\x20%s',new Buffer(util[_0xbbdc('0x65')](_0xbbdc('0x66'),_0x58ec03[_0xbbdc('0x67')],_0x58ec03[_0xbbdc('0x68')]))[_0xbbdc('0x69')](_0xbbdc('0x6a')));}return rp(_0x55012f)[_0xbbdc('0x28')](function(_0x5d28c2){return _0x2e89e9[_0xbbdc('0x6b')](_[_0xbbdc('0x35')](_0x5d28c2[_0xbbdc('0x6c')]['entries'],function(_0x5c75a7){return{'id':_0x5c75a7[_0xbbdc('0x2c')],'name':_0x5c75a7['name'],'type':_0x5c75a7[_0xbbdc('0x32')],'active':_0x5c75a7[_0xbbdc('0x6d')],'label':_0x5c75a7[_0xbbdc('0x6e')],'custom':!![]};}));});}})['then'](function(_0x1d05d7){return{'count':_0x1d05d7[_0xbbdc('0x4f')],'rows':_0x1d05d7};})[_0xbbdc('0x28')](respondWithResult(_0x48b3ea,null))[_0xbbdc('0x49')](function(_0x62bd5d){var _0x18189b=_0x3937b0[_0xbbdc('0x36')][_0xbbdc('0x6f')]?0x1f4:_0x62bd5d[_0xbbdc('0x70')]||0x1f4;logger[_0xbbdc('0x2a')](_0xbbdc('0x71'),_0xbbdc('0x58'),_0x18189b,JSON['stringify'](_0x62bd5d));delete _0x62bd5d[_0xbbdc('0x2c')];if(_0x18189b===0x191){_0x18189b=0x190;}_0x48b3ea[_0xbbdc('0x1c')](_0x18189b)[_0xbbdc('0x2d')](_0x3937b0['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x62bd5d['statusCode']}:_0x62bd5d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cb63907..d77035a 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 _0xde2f=['../../components/integrations/configuration','exports','define','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x114be8,_0x323182){var _0x89020c=function(_0x30a38a){while(--_0x30a38a){_0x114be8['push'](_0x114be8['shift']());}};_0x89020c(++_0x323182);}(_0xde2f,0x92));var _0xfde2=function(_0x1c31dc,_0x2a8ca8){_0x1c31dc=_0x1c31dc-0x0;var _0x14c76e=_0xde2f[_0x1c31dc];return _0x14c76e;};'use strict';var _=require(_0xfde2('0x0'));var util=require(_0xfde2('0x1'));var logger=require('../../config/logger')(_0xfde2('0x2'));var moment=require(_0xfde2('0x3'));var BPromise=require('bluebird');var rp=require(_0xfde2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfde2('0x5'));var config=require(_0xfde2('0x6'));var attributes=require(_0xfde2('0x7'));var integrations=require(_0xfde2('0x8'));module[_0xfde2('0x9')]=function(_0x3ec0b8,_0x4ebd66){return _0x3ec0b8[_0xfde2('0xa')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb5=['DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x411631,_0x5cc5c3){var _0x490190=function(_0x19148d){while(--_0x19148d){_0x411631['push'](_0x411631['shift']());}};_0x490190(++_0x5cc5c3);}(_0xafb5,0x141));var _0x5afb=function(_0x14ee3f,_0x9befd8){_0x14ee3f=_0x14ee3f-0x0;var _0x34a03b=_0xafb5[_0x14ee3f];return _0x34a03b;};'use strict';var _=require(_0x5afb('0x0'));var util=require('util');var logger=require(_0x5afb('0x1'))(_0x5afb('0x2'));var moment=require(_0x5afb('0x3'));var BPromise=require('bluebird');var rp=require(_0x5afb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5afb('0x5'));var attributes=require(_0x5afb('0x6'));var integrations=require(_0x5afb('0x7'));module[_0x5afb('0x8')]=function(_0x156f6e,_0x43ccb9){return _0x156f6e['define'](_0x5afb('0x9'),attributes,{'tableName':_0x5afb('0xa'),'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 e78d80b..2bef3a7 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 _0xe0fb=['options','raw','where','attributes','include','map','model','catch','find','ShowDeskAccount','stringify','lodash','util','moment','randomstring','ioredis','../../config/environment','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','GetDeskAccount','DeskAccount'];(function(_0x3b18cf,_0x3b2b9a){var _0x31c179=function(_0x57bcb2){while(--_0x57bcb2){_0x3b18cf['push'](_0x3b18cf['shift']());}};_0x31c179(++_0x3b2b9a);}(_0xe0fb,0x155));var _0xbe0f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe0fb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xbe0f('0x0'));var util=require(_0xbe0f('0x1'));var moment=require(_0xbe0f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe0f('0x3'));var fs=require('fs');var Redis=require(_0xbe0f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbe0f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe0f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x36215d,_0x502634,_0x422b4a){return new BPromise(function(_0x13344a,_0x3d4bd8){return client[_0xbe0f('0x7')](_0x36215d,_0x422b4a)[_0xbe0f('0x8')](function(_0x53296e){logger['info'](_0xbe0f('0x9'),_0x502634,_0xbe0f('0xa'));logger[_0xbe0f('0xb')](_0xbe0f('0xc'),_0x502634,_0xbe0f('0xa'),JSON['stringify'](_0x53296e));if(_0x53296e[_0xbe0f('0xd')]){if(_0x53296e['error'][_0xbe0f('0xe')]===0x1f4){logger[_0xbe0f('0xd')](_0xbe0f('0x9'),_0x502634,_0x53296e[_0xbe0f('0xd')][_0xbe0f('0xf')]);return _0x3d4bd8(_0x53296e[_0xbe0f('0xd')][_0xbe0f('0xf')]);}logger[_0xbe0f('0xd')]('DeskAccount,\x20%s,\x20%s',_0x502634,_0x53296e[_0xbe0f('0xd')][_0xbe0f('0xf')]);return _0x13344a(_0x53296e[_0xbe0f('0xd')][_0xbe0f('0xf')]);}else{logger[_0xbe0f('0x10')](_0xbe0f('0x9'),_0x502634,_0xbe0f('0xa'));_0x13344a(_0x53296e['result'][_0xbe0f('0xf')]);}})['catch'](function(_0x33d806){logger[_0xbe0f('0xd')]('DeskAccount,\x20%s,\x20%s',_0x502634,_0x33d806);_0x3d4bd8(_0x33d806);});});}exports[_0xbe0f('0x11')]=function(_0x169995){var _0x1f721e=this;return new Promise(function(_0x34c09d,_0x5c40ea){return db[_0xbe0f('0x12')]['findAll']({'raw':_0x169995[_0xbe0f('0x13')]?_0x169995[_0xbe0f('0x13')][_0xbe0f('0x14')]===undefined?!![]:![]:!![],'where':_0x169995['options']?_0x169995[_0xbe0f('0x13')][_0xbe0f('0x15')]||null:null,'attributes':_0x169995['options']?_0x169995[_0xbe0f('0x13')][_0xbe0f('0x16')]||null:null,'limit':_0x169995[_0xbe0f('0x13')]?_0x169995['options']['limit']||null:null,'include':_0x169995[_0xbe0f('0x13')]?_0x169995[_0xbe0f('0x13')][_0xbe0f('0x17')]?_[_0xbe0f('0x18')](_0x169995[_0xbe0f('0x13')][_0xbe0f('0x17')],function(_0x218277){return{'model':db[_0x218277[_0xbe0f('0x19')]],'as':_0x218277['as'],'attributes':_0x218277[_0xbe0f('0x16')],'include':_0x218277[_0xbe0f('0x17')]?_[_0xbe0f('0x18')](_0x218277['include'],function(_0x11f437){return{'model':db[_0x11f437['model']],'as':_0x11f437['as'],'attributes':_0x11f437[_0xbe0f('0x16')],'include':_0x11f437[_0xbe0f('0x17')]?_[_0xbe0f('0x18')](_0x11f437[_0xbe0f('0x17')],function(_0x2a8776){return{'model':db[_0x2a8776[_0xbe0f('0x19')]],'as':_0x2a8776['as'],'attributes':_0x2a8776['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe0f('0x8')](function(_0x4299b7){logger['info']('GetDeskAccount',_0x169995);logger['debug'](_0xbe0f('0x11'),_0x169995,JSON['stringify'](_0x4299b7));_0x34c09d(_0x4299b7);})[_0xbe0f('0x1a')](function(_0x496f8d){logger['error']('GetDeskAccount',_0x496f8d[_0xbe0f('0xf')],_0x169995);_0x5c40ea(_0x1f721e[_0xbe0f('0xd')](0x1f4,_0x496f8d[_0xbe0f('0xf')]));});});};exports['ShowDeskAccount']=function(_0x43ee7d){var _0x1398f2=this;return new Promise(function(_0x3b76e4,_0x46b0c0){return db[_0xbe0f('0x12')][_0xbe0f('0x1b')]({'raw':_0x43ee7d[_0xbe0f('0x13')]?_0x43ee7d[_0xbe0f('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x43ee7d[_0xbe0f('0x13')]?_0x43ee7d['options']['where']||null:null,'attributes':_0x43ee7d[_0xbe0f('0x13')]?_0x43ee7d[_0xbe0f('0x13')][_0xbe0f('0x16')]||null:null,'include':_0x43ee7d[_0xbe0f('0x13')]?_0x43ee7d[_0xbe0f('0x13')][_0xbe0f('0x17')]?_[_0xbe0f('0x18')](_0x43ee7d[_0xbe0f('0x13')][_0xbe0f('0x17')],function(_0x328d7c){return{'model':db[_0x328d7c[_0xbe0f('0x19')]],'as':_0x328d7c['as'],'attributes':_0x328d7c[_0xbe0f('0x16')],'include':_0x328d7c[_0xbe0f('0x17')]?_[_0xbe0f('0x18')](_0x328d7c['include'],function(_0x160680){return{'model':db[_0x160680[_0xbe0f('0x19')]],'as':_0x160680['as'],'attributes':_0x160680[_0xbe0f('0x16')],'include':_0x160680[_0xbe0f('0x17')]?_[_0xbe0f('0x18')](_0x160680[_0xbe0f('0x17')],function(_0x54a76d){return{'model':db[_0x54a76d[_0xbe0f('0x19')]],'as':_0x54a76d['as'],'attributes':_0x54a76d[_0xbe0f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbe0f('0x8')](function(_0x45301f){logger[_0xbe0f('0x10')](_0xbe0f('0x1c'),_0x43ee7d);logger[_0xbe0f('0xb')](_0xbe0f('0x1c'),_0x43ee7d,JSON[_0xbe0f('0x1d')](_0x45301f));_0x3b76e4(_0x45301f);})[_0xbe0f('0x1a')](function(_0x44a770){logger[_0xbe0f('0xd')](_0xbe0f('0x1c'),_0x44a770[_0xbe0f('0xf')],_0x43ee7d);_0x46b0c0(_0x1398f2[_0xbe0f('0xd')](0x1f4,_0x44a770['message']));});});}; \ No newline at end of file +var _0x4a02=['findAll','options','raw','where','attributes','limit','map','include','model','GetDeskAccount','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x4a02,0x192));var _0x24a0=function(_0x52ba85,_0x571ad9){_0x52ba85=_0x52ba85-0x0;var _0x111605=_0x4a02[_0x52ba85];return _0x111605;};'use strict';var _=require(_0x24a0('0x0'));var util=require(_0x24a0('0x1'));var moment=require(_0x24a0('0x2'));var BPromise=require(_0x24a0('0x3'));var rs=require(_0x24a0('0x4'));var fs=require('fs');var Redis=require(_0x24a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x24a0('0x6'));var logger=require(_0x24a0('0x7'))(_0x24a0('0x8'));var config=require(_0x24a0('0x9'));var jayson=require(_0x24a0('0xa'));var client=jayson[_0x24a0('0xb')][_0x24a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c19ce,_0x16c619,_0x9e65a0){return new BPromise(function(_0x3af9ef,_0xd9e1b7){return client[_0x24a0('0xd')](_0x5c19ce,_0x9e65a0)[_0x24a0('0xe')](function(_0x3d613e){logger[_0x24a0('0xf')]('DeskAccount,\x20%s,\x20%s',_0x16c619,_0x24a0('0x10'));logger[_0x24a0('0x11')](_0x24a0('0x12'),_0x16c619,_0x24a0('0x10'),JSON[_0x24a0('0x13')](_0x3d613e));if(_0x3d613e[_0x24a0('0x14')]){if(_0x3d613e[_0x24a0('0x14')][_0x24a0('0x15')]===0x1f4){logger[_0x24a0('0x14')](_0x24a0('0x16'),_0x16c619,_0x3d613e[_0x24a0('0x14')][_0x24a0('0x17')]);return _0xd9e1b7(_0x3d613e[_0x24a0('0x14')][_0x24a0('0x17')]);}logger[_0x24a0('0x14')]('DeskAccount,\x20%s,\x20%s',_0x16c619,_0x3d613e[_0x24a0('0x14')][_0x24a0('0x17')]);return _0x3af9ef(_0x3d613e[_0x24a0('0x14')]['message']);}else{logger[_0x24a0('0xf')]('DeskAccount,\x20%s,\x20%s',_0x16c619,_0x24a0('0x10'));_0x3af9ef(_0x3d613e[_0x24a0('0x18')][_0x24a0('0x17')]);}})[_0x24a0('0x19')](function(_0x193949){logger['error']('DeskAccount,\x20%s,\x20%s',_0x16c619,_0x193949);_0xd9e1b7(_0x193949);});});}exports['GetDeskAccount']=function(_0x3b3187){var _0xc943a8=this;return new Promise(function(_0xef19af,_0x34b8c4){return db[_0x24a0('0x1a')][_0x24a0('0x1b')]({'raw':_0x3b3187[_0x24a0('0x1c')]?_0x3b3187[_0x24a0('0x1c')][_0x24a0('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b3187[_0x24a0('0x1c')]?_0x3b3187['options'][_0x24a0('0x1e')]||null:null,'attributes':_0x3b3187[_0x24a0('0x1c')]?_0x3b3187[_0x24a0('0x1c')][_0x24a0('0x1f')]||null:null,'limit':_0x3b3187[_0x24a0('0x1c')]?_0x3b3187[_0x24a0('0x1c')][_0x24a0('0x20')]||null:null,'include':_0x3b3187[_0x24a0('0x1c')]?_0x3b3187[_0x24a0('0x1c')]['include']?_[_0x24a0('0x21')](_0x3b3187[_0x24a0('0x1c')][_0x24a0('0x22')],function(_0x423665){return{'model':db[_0x423665[_0x24a0('0x23')]],'as':_0x423665['as'],'attributes':_0x423665[_0x24a0('0x1f')],'include':_0x423665[_0x24a0('0x22')]?_[_0x24a0('0x21')](_0x423665[_0x24a0('0x22')],function(_0x43931a){return{'model':db[_0x43931a[_0x24a0('0x23')]],'as':_0x43931a['as'],'attributes':_0x43931a[_0x24a0('0x1f')],'include':_0x43931a[_0x24a0('0x22')]?_['map'](_0x43931a[_0x24a0('0x22')],function(_0x2b50da){return{'model':db[_0x2b50da['model']],'as':_0x2b50da['as'],'attributes':_0x2b50da[_0x24a0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x24a0('0xe')](function(_0xad2997){logger[_0x24a0('0xf')](_0x24a0('0x24'),_0x3b3187);logger[_0x24a0('0x11')](_0x24a0('0x24'),_0x3b3187,JSON['stringify'](_0xad2997));_0xef19af(_0xad2997);})[_0x24a0('0x19')](function(_0xc73ad5){logger['error'](_0x24a0('0x24'),_0xc73ad5[_0x24a0('0x17')],_0x3b3187);_0x34b8c4(_0xc943a8[_0x24a0('0x14')](0x1f4,_0xc73ad5[_0x24a0('0x17')]));});});};exports[_0x24a0('0x25')]=function(_0x4f3cf5){var _0x2a2a83=this;return new Promise(function(_0x34fc97,_0x1959c0){return db[_0x24a0('0x1a')][_0x24a0('0x26')]({'raw':_0x4f3cf5[_0x24a0('0x1c')]?_0x4f3cf5[_0x24a0('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4f3cf5[_0x24a0('0x1c')]?_0x4f3cf5['options'][_0x24a0('0x1e')]||null:null,'attributes':_0x4f3cf5[_0x24a0('0x1c')]?_0x4f3cf5['options']['attributes']||null:null,'include':_0x4f3cf5['options']?_0x4f3cf5[_0x24a0('0x1c')][_0x24a0('0x22')]?_['map'](_0x4f3cf5[_0x24a0('0x1c')][_0x24a0('0x22')],function(_0x3c4296){return{'model':db[_0x3c4296[_0x24a0('0x23')]],'as':_0x3c4296['as'],'attributes':_0x3c4296['attributes'],'include':_0x3c4296[_0x24a0('0x22')]?_[_0x24a0('0x21')](_0x3c4296[_0x24a0('0x22')],function(_0x1dddb6){return{'model':db[_0x1dddb6[_0x24a0('0x23')]],'as':_0x1dddb6['as'],'attributes':_0x1dddb6['attributes'],'include':_0x1dddb6['include']?_[_0x24a0('0x21')](_0x1dddb6[_0x24a0('0x22')],function(_0x5a6d8a){return{'model':db[_0x5a6d8a[_0x24a0('0x23')]],'as':_0x5a6d8a['as'],'attributes':_0x5a6d8a[_0x24a0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x24a0('0xe')](function(_0x193b4a){logger[_0x24a0('0xf')](_0x24a0('0x25'),_0x4f3cf5);logger[_0x24a0('0x11')]('ShowDeskAccount',_0x4f3cf5,JSON[_0x24a0('0x13')](_0x193b4a));_0x34fc97(_0x193b4a);})[_0x24a0('0x19')](function(_0x2d47a3){logger[_0x24a0('0x14')]('ShowDeskAccount',_0x2d47a3[_0x24a0('0x17')],_0x4f3cf5);_0x1959c0(_0x2a2a83[_0x24a0('0x14')](0x1f4,_0x2d47a3[_0x24a0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e4d793b..21e5667 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x55ca,0x126));var _0xa55c=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0x55ca[_0x2ae2bc];return _0x53c290;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x8fa4bc,_0x5cd2af){var _0x35b6a7=function(_0x357c25){while(--_0x357c25){_0x8fa4bc['push'](_0x8fa4bc['shift']());}};_0x35b6a7(++_0x5cd2af);}(_0x55ca,0x126));var _0xa55c=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0x55ca[_0x578275];return _0xf78041;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ce5da19..ae6ae99 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 _0x0a68=['sequelize','exports','STRING'];(function(_0x11e000,_0x12a8e5){var _0x110c27=function(_0x10d468){while(--_0x10d468){_0x11e000['push'](_0x11e000['shift']());}};_0x110c27(++_0x12a8e5);}(_0x0a68,0xba));var _0x80a6=function(_0x5a2b24,_0x21aeb2){_0x5a2b24=_0x5a2b24-0x0;var _0x200841=_0x0a68[_0x5a2b24];return _0x200841;};'use strict';var Sequelize=require(_0x80a6('0x0'));module[_0x80a6('0x1')]={'name':{'type':Sequelize[_0x80a6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaeb8=['STRING'];(function(_0x557cac,_0xf0d45f){var _0x45a05f=function(_0x506d17){while(--_0x506d17){_0x557cac['push'](_0x557cac['shift']());}};_0x45a05f(++_0xf0d45f);}(_0xaeb8,0x109));var _0x8aeb=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xaeb8[_0x4599b6];return _0x2e014c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8aeb('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 60de5e3..c19e893 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 _0x85cc=['error','stack','name','send','map','DeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','getFields','findOne','DeskField','sort','getSubjects','getDescriptions','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','end'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0x85cc,0x122));var _0xc85c=function(_0x29b612,_0x2ef1a7){_0x29b612=_0x29b612-0x0;var _0xd0ddf4=_0x85cc[_0x29b612];return _0xd0ddf4;};'use strict';var emlformat=require(_0xc85c('0x0'));var rimraf=require(_0xc85c('0x1'));var zipdir=require(_0xc85c('0x2'));var jsonpatch=require(_0xc85c('0x3'));var rp=require(_0xc85c('0x4'));var moment=require(_0xc85c('0x5'));var BPromise=require(_0xc85c('0x6'));var Mustache=require('mustache');var util=require(_0xc85c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc85c('0x8'));var ejs=require(_0xc85c('0x9'));var fs=require('fs');var fs_extra=require(_0xc85c('0xa'));var _=require(_0xc85c('0xb'));var squel=require(_0xc85c('0xc'));var crypto=require(_0xc85c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc85c('0x8'));var querystring=require(_0xc85c('0xe'));var Papa=require(_0xc85c('0xf'));var Redis=require('ioredis');var authService=require(_0xc85c('0x10'));var qs=require(_0xc85c('0x11'));var as=require(_0xc85c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc85c('0x13'))(_0xc85c('0x14'));var utils=require(_0xc85c('0x15'));var config=require(_0xc85c('0x16'));var licenseUtil=require(_0xc85c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x563890,_0x599c9c){_0x599c9c=_0x599c9c||0xcc;return function(_0x45736e){if(_0x45736e){return _0x563890[_0xc85c('0x18')](_0x599c9c);}return _0x563890[_0xc85c('0x19')](_0x599c9c)['end']();};}function respondWithResult(_0x520ddb,_0x517924){_0x517924=_0x517924||0xc8;return function(_0xa6eed5){if(_0xa6eed5){return _0x520ddb['status'](_0x517924)[_0xc85c('0x1a')](_0xa6eed5);}};}function respondWithFilteredResult(_0xdf8916,_0x47497b){return function(_0x193925){if(_0x193925){var _0x24ce1a=typeof _0x47497b[_0xc85c('0x1b')]==='undefined'&&typeof _0x47497b[_0xc85c('0x1c')]===_0xc85c('0x1d');var _0x539e48=_0x193925[_0xc85c('0x1e')];var _0x43ff22=_0x24ce1a?0x0:_0x47497b[_0xc85c('0x1b')];var _0x139422=_0x24ce1a?_0x193925[_0xc85c('0x1e')]:_0x47497b['offset']+_0x47497b[_0xc85c('0x1c')];var _0x64c8ee;if(_0x139422>=_0x539e48){_0x139422=_0x539e48;_0x64c8ee=0xc8;}else{_0x64c8ee=0xce;}_0xdf8916['status'](_0x64c8ee);return _0xdf8916[_0xc85c('0x1f')](_0xc85c('0x20'),_0x43ff22+'-'+_0x139422+'/'+_0x539e48)[_0xc85c('0x1a')](_0x193925);}return null;};}function patchUpdates(_0x4e4eb2){return function(_0x4cfbfe){try{jsonpatch['apply'](_0x4cfbfe,_0x4e4eb2,!![]);}catch(_0x100837){return BPromise[_0xc85c('0x21')](_0x100837);}return _0x4cfbfe[_0xc85c('0x22')]();};}function saveUpdates(_0x4915c3,_0x3a07d1){return function(_0x165654){if(_0x165654){return _0x165654['update'](_0x4915c3)['then'](function(_0x144786){return _0x144786;});}return null;};}function removeEntity(_0x54ec76,_0x12c73b){return function(_0x118a96){if(_0x118a96){return _0x118a96[_0xc85c('0x23')]()[_0xc85c('0x24')](function(){_0x54ec76[_0xc85c('0x19')](0xcc)[_0xc85c('0x25')]();});}};}function handleEntityNotFound(_0x143abc,_0x4c7d90){return function(_0x2d85b9){if(!_0x2d85b9){_0x143abc['sendStatus'](0x194);}return _0x2d85b9;};}function handleError(_0x231bb2,_0x1846e9){_0x1846e9=_0x1846e9||0x1f4;return function(_0x17c38c){logger[_0xc85c('0x26')](_0x17c38c[_0xc85c('0x27')]);if(_0x17c38c[_0xc85c('0x28')]){delete _0x17c38c['name'];}_0x231bb2[_0xc85c('0x19')](_0x1846e9)[_0xc85c('0x29')](_0x17c38c);};}exports['index']=function(_0x4faebe,_0x3624c9){var _0x47fd24={},_0x349453={},_0x5e59dd={'count':0x0,'rows':[]};var _0x435873=_[_0xc85c('0x2a')](db[_0xc85c('0x2b')][_0xc85c('0x2c')],function(_0x1104c5){return{'name':_0x1104c5['fieldName'],'type':_0x1104c5[_0xc85c('0x2d')][_0xc85c('0x2e')]};});_0x349453[_0xc85c('0x2f')]=_[_0xc85c('0x2a')](_0x435873,_0xc85c('0x28'));_0x349453['query']=_[_0xc85c('0x30')](_0x4faebe[_0xc85c('0x31')]);_0x349453[_0xc85c('0x32')]=_[_0xc85c('0x33')](_0x349453['model'],_0x349453[_0xc85c('0x31')]);_0x47fd24[_0xc85c('0x34')]=_[_0xc85c('0x33')](_0x349453['model'],qs[_0xc85c('0x35')](_0x4faebe[_0xc85c('0x31')][_0xc85c('0x35')]));_0x47fd24['attributes']=_0x47fd24['attributes'][_0xc85c('0x36')]?_0x47fd24['attributes']:_0x349453[_0xc85c('0x2f')];if(!_0x4faebe[_0xc85c('0x31')][_0xc85c('0x37')](_0xc85c('0x38'))){_0x47fd24[_0xc85c('0x1c')]=qs[_0xc85c('0x1c')](_0x4faebe[_0xc85c('0x31')]['limit']);_0x47fd24[_0xc85c('0x1b')]=qs['offset'](_0x4faebe[_0xc85c('0x31')][_0xc85c('0x1b')]);}_0x47fd24[_0xc85c('0x39')]=qs['sort'](_0x4faebe[_0xc85c('0x31')]['sort']);_0x47fd24['where']=qs['filters'](_[_0xc85c('0x3a')](_0x4faebe['query'],_0x349453[_0xc85c('0x32')]),_0x435873);if(_0x4faebe['query'][_0xc85c('0x3b')]){_0x47fd24[_0xc85c('0x3c')]=_[_0xc85c('0x3d')](_0x47fd24[_0xc85c('0x3c')],{'$or':_[_0xc85c('0x2a')](_0x435873,function(_0x42c255){if(_0x42c255['type']!==_0xc85c('0x3e')){var _0x43e7d6={};_0x43e7d6[_0x42c255[_0xc85c('0x28')]]={'$like':'%'+_0x4faebe[_0xc85c('0x31')][_0xc85c('0x3b')]+'%'};return _0x43e7d6;}})});}_0x47fd24=_[_0xc85c('0x3d')]({},_0x47fd24,_0x4faebe[_0xc85c('0x3f')]);var _0x2fe799={'where':_0x47fd24[_0xc85c('0x3c')]};return db[_0xc85c('0x2b')]['count'](_0x2fe799)[_0xc85c('0x24')](function(_0x261a2f){_0x5e59dd['count']=_0x261a2f;if(_0x4faebe[_0xc85c('0x31')][_0xc85c('0x40')]){_0x47fd24[_0xc85c('0x41')]=[{'all':!![]}];}return db[_0xc85c('0x2b')]['findAll'](_0x47fd24);})[_0xc85c('0x24')](function(_0x551ff4){_0x5e59dd[_0xc85c('0x42')]=_0x551ff4;return _0x5e59dd;})[_0xc85c('0x24')](respondWithFilteredResult(_0x3624c9,_0x47fd24))[_0xc85c('0x43')](handleError(_0x3624c9,null));};exports[_0xc85c('0x44')]=function(_0x35cf37,_0x1045be){var _0x146ca2={'raw':![],'where':{'id':_0x35cf37[_0xc85c('0x45')]['id']}},_0x5b398e={};_0x5b398e['model']=_[_0xc85c('0x30')](db[_0xc85c('0x2b')][_0xc85c('0x2c')]);_0x5b398e[_0xc85c('0x31')]=_[_0xc85c('0x30')](_0x35cf37[_0xc85c('0x31')]);_0x5b398e[_0xc85c('0x32')]=_[_0xc85c('0x33')](_0x5b398e['model'],_0x5b398e[_0xc85c('0x31')]);_0x146ca2[_0xc85c('0x34')]=_[_0xc85c('0x33')](_0x5b398e[_0xc85c('0x2f')],qs['fields'](_0x35cf37[_0xc85c('0x31')]['fields']));_0x146ca2[_0xc85c('0x34')]=_0x146ca2[_0xc85c('0x34')][_0xc85c('0x36')]?_0x146ca2[_0xc85c('0x34')]:_0x5b398e['model'];if(_0x35cf37[_0xc85c('0x31')][_0xc85c('0x40')]){_0x146ca2[_0xc85c('0x41')]=[{'all':!![]}];}_0x146ca2=_[_0xc85c('0x3d')]({},_0x146ca2,_0x35cf37[_0xc85c('0x3f')]);return db[_0xc85c('0x2b')][_0xc85c('0x46')](_0x146ca2)[_0xc85c('0x24')](handleEntityNotFound(_0x1045be,null))[_0xc85c('0x24')](respondWithResult(_0x1045be,null))[_0xc85c('0x43')](handleError(_0x1045be,null));};exports[_0xc85c('0x47')]=function(_0x19d7c6,_0x59fb6c){return db['DeskConfiguration'][_0xc85c('0x47')](_0x19d7c6[_0xc85c('0x48')],{})['then'](respondWithResult(_0x59fb6c,0xc9))[_0xc85c('0x43')](handleError(_0x59fb6c,null));};exports[_0xc85c('0x49')]=function(_0x5b416b,_0x367ef7){if(_0x5b416b[_0xc85c('0x48')]['id']){delete _0x5b416b['body']['id'];}return db[_0xc85c('0x2b')]['find']({'where':{'id':_0x5b416b[_0xc85c('0x45')]['id']}})[_0xc85c('0x24')](handleEntityNotFound(_0x367ef7,null))[_0xc85c('0x24')](saveUpdates(_0x5b416b['body'],null))['then'](respondWithResult(_0x367ef7,null))['catch'](handleError(_0x367ef7,null));};exports[_0xc85c('0x23')]=function(_0x530a8b,_0x4a931c){return db[_0xc85c('0x2b')][_0xc85c('0x46')]({'where':{'id':_0x530a8b[_0xc85c('0x45')]['id']}})[_0xc85c('0x24')](handleEntityNotFound(_0x4a931c,null))[_0xc85c('0x24')](removeEntity(_0x4a931c,null))[_0xc85c('0x43')](handleError(_0x4a931c,null));};exports[_0xc85c('0x4a')]=function(_0x31373b,_0x211b12,_0x533133){var _0x4ddff1={};var _0xb1d8={};var _0x5da573;var _0x369322;return db[_0xc85c('0x2b')][_0xc85c('0x4b')]({'where':{'id':_0x31373b['params']['id']}})[_0xc85c('0x24')](handleEntityNotFound(_0x211b12,null))[_0xc85c('0x24')](function(_0x4b2c1e){if(_0x4b2c1e){_0x5da573=_0x4b2c1e;_0xb1d8['model']=_[_0xc85c('0x30')](db[_0xc85c('0x4c')][_0xc85c('0x2c')]);_0xb1d8[_0xc85c('0x31')]=_[_0xc85c('0x30')](_0x31373b[_0xc85c('0x31')]);_0xb1d8[_0xc85c('0x32')]=_[_0xc85c('0x33')](_0xb1d8['model'],_0xb1d8[_0xc85c('0x31')]);_0x4ddff1[_0xc85c('0x34')]=_[_0xc85c('0x33')](_0xb1d8[_0xc85c('0x2f')],qs[_0xc85c('0x35')](_0x31373b[_0xc85c('0x31')][_0xc85c('0x35')]));_0x4ddff1[_0xc85c('0x34')]=_0x4ddff1[_0xc85c('0x34')][_0xc85c('0x36')]?_0x4ddff1[_0xc85c('0x34')]:_0xb1d8[_0xc85c('0x2f')];_0x4ddff1[_0xc85c('0x39')]=qs[_0xc85c('0x4d')](_0x31373b[_0xc85c('0x31')][_0xc85c('0x4d')]);_0x4ddff1[_0xc85c('0x3c')]=qs['filters'](_[_0xc85c('0x3a')](_0x31373b['query'],_0xb1d8['filters']));if(_0x31373b[_0xc85c('0x31')]['filter']){_0x4ddff1[_0xc85c('0x3c')]=_['merge'](_0x4ddff1[_0xc85c('0x3c')],{'$or':_[_0xc85c('0x2a')](_0x4ddff1[_0xc85c('0x34')],function(_0x8aa07d){var _0x2c645b={};_0x2c645b[_0x8aa07d]={'$like':'%'+_0x31373b[_0xc85c('0x31')][_0xc85c('0x3b')]+'%'};return _0x2c645b;})});}_0x4ddff1=_[_0xc85c('0x3d')]({},_0x4ddff1,_0x31373b[_0xc85c('0x3f')]);return _0x5da573['getFields'](_0x4ddff1);}})[_0xc85c('0x24')](function(_0x26889e){if(_0x26889e){_0x369322=_0x26889e[_0xc85c('0x36')];if(!_0x31373b[_0xc85c('0x31')][_0xc85c('0x37')](_0xc85c('0x38'))){_0x4ddff1['limit']=qs[_0xc85c('0x1c')](_0x31373b[_0xc85c('0x31')][_0xc85c('0x1c')]);_0x4ddff1['offset']=qs[_0xc85c('0x1b')](_0x31373b[_0xc85c('0x31')]['offset']);}return _0x5da573[_0xc85c('0x4a')](_0x4ddff1);}})['then'](function(_0x1cf400){if(_0x1cf400){return _0x1cf400?{'count':_0x369322,'rows':_0x1cf400}:null;}})[_0xc85c('0x24')](respondWithResult(_0x211b12,null))[_0xc85c('0x43')](handleError(_0x211b12,null));};exports[_0xc85c('0x4e')]=function(_0x288699,_0x2de455,_0x144b08){var _0xaac358={};var _0x31d03c={};var _0x4e511b;var _0xf6a20b;return db[_0xc85c('0x2b')][_0xc85c('0x4b')]({'where':{'id':_0x288699[_0xc85c('0x45')]['id']}})[_0xc85c('0x24')](handleEntityNotFound(_0x2de455,null))['then'](function(_0x5eddba){if(_0x5eddba){_0x4e511b=_0x5eddba;_0x31d03c[_0xc85c('0x2f')]=_[_0xc85c('0x30')](db[_0xc85c('0x4c')][_0xc85c('0x2c')]);_0x31d03c[_0xc85c('0x31')]=_['keys'](_0x288699[_0xc85c('0x31')]);_0x31d03c[_0xc85c('0x32')]=_[_0xc85c('0x33')](_0x31d03c['model'],_0x31d03c['query']);_0xaac358['attributes']=_[_0xc85c('0x33')](_0x31d03c[_0xc85c('0x2f')],qs[_0xc85c('0x35')](_0x288699[_0xc85c('0x31')][_0xc85c('0x35')]));_0xaac358['attributes']=_0xaac358[_0xc85c('0x34')][_0xc85c('0x36')]?_0xaac358['attributes']:_0x31d03c['model'];_0xaac358[_0xc85c('0x39')]=qs[_0xc85c('0x4d')](_0x288699[_0xc85c('0x31')]['sort']);_0xaac358[_0xc85c('0x3c')]=qs[_0xc85c('0x32')](_[_0xc85c('0x3a')](_0x288699[_0xc85c('0x31')],_0x31d03c[_0xc85c('0x32')]));if(_0x288699[_0xc85c('0x31')][_0xc85c('0x3b')]){_0xaac358['where']=_[_0xc85c('0x3d')](_0xaac358['where'],{'$or':_['map'](_0xaac358['attributes'],function(_0x39ea1a){var _0x59aade={};_0x59aade[_0x39ea1a]={'$like':'%'+_0x288699[_0xc85c('0x31')][_0xc85c('0x3b')]+'%'};return _0x59aade;})});}_0xaac358=_[_0xc85c('0x3d')]({},_0xaac358,_0x288699[_0xc85c('0x3f')]);return _0x4e511b[_0xc85c('0x4e')](_0xaac358);}})[_0xc85c('0x24')](function(_0x4600a4){if(_0x4600a4){_0xf6a20b=_0x4600a4['length'];if(!_0x288699['query'][_0xc85c('0x37')](_0xc85c('0x38'))){_0xaac358['limit']=qs['limit'](_0x288699['query'][_0xc85c('0x1c')]);_0xaac358[_0xc85c('0x1b')]=qs[_0xc85c('0x1b')](_0x288699[_0xc85c('0x31')][_0xc85c('0x1b')]);}return _0x4e511b[_0xc85c('0x4e')](_0xaac358);}})[_0xc85c('0x24')](function(_0x331c13){if(_0x331c13){return _0x331c13?{'count':_0xf6a20b,'rows':_0x331c13}:null;}})['then'](respondWithResult(_0x2de455,null))[_0xc85c('0x43')](handleError(_0x2de455,null));};exports[_0xc85c('0x4f')]=function(_0x1e8625,_0x4a82d3,_0x482aed){var _0x384556={};var _0xc834d7={};var _0x5338cb;var _0x169dba;return db[_0xc85c('0x2b')][_0xc85c('0x4b')]({'where':{'id':_0x1e8625[_0xc85c('0x45')]['id']}})[_0xc85c('0x24')](handleEntityNotFound(_0x4a82d3,null))[_0xc85c('0x24')](function(_0x1dda62){if(_0x1dda62){_0x5338cb=_0x1dda62;_0xc834d7[_0xc85c('0x2f')]=_[_0xc85c('0x30')](db[_0xc85c('0x4c')][_0xc85c('0x2c')]);_0xc834d7[_0xc85c('0x31')]=_[_0xc85c('0x30')](_0x1e8625['query']);_0xc834d7[_0xc85c('0x32')]=_['intersection'](_0xc834d7[_0xc85c('0x2f')],_0xc834d7[_0xc85c('0x31')]);_0x384556['attributes']=_['intersection'](_0xc834d7[_0xc85c('0x2f')],qs[_0xc85c('0x35')](_0x1e8625[_0xc85c('0x31')][_0xc85c('0x35')]));_0x384556[_0xc85c('0x34')]=_0x384556[_0xc85c('0x34')][_0xc85c('0x36')]?_0x384556[_0xc85c('0x34')]:_0xc834d7[_0xc85c('0x2f')];_0x384556['order']=qs[_0xc85c('0x4d')](_0x1e8625[_0xc85c('0x31')]['sort']);_0x384556[_0xc85c('0x3c')]=qs[_0xc85c('0x32')](_['pick'](_0x1e8625[_0xc85c('0x31')],_0xc834d7[_0xc85c('0x32')]));if(_0x1e8625[_0xc85c('0x31')]['filter']){_0x384556['where']=_['merge'](_0x384556[_0xc85c('0x3c')],{'$or':_['map'](_0x384556[_0xc85c('0x34')],function(_0x268369){var _0x7649f0={};_0x7649f0[_0x268369]={'$like':'%'+_0x1e8625[_0xc85c('0x31')][_0xc85c('0x3b')]+'%'};return _0x7649f0;})});}_0x384556=_['merge']({},_0x384556,_0x1e8625['options']);return _0x5338cb['getDescriptions'](_0x384556);}})[_0xc85c('0x24')](function(_0x10796f){if(_0x10796f){_0x169dba=_0x10796f[_0xc85c('0x36')];if(!_0x1e8625[_0xc85c('0x31')][_0xc85c('0x37')](_0xc85c('0x38'))){_0x384556[_0xc85c('0x1c')]=qs[_0xc85c('0x1c')](_0x1e8625[_0xc85c('0x31')][_0xc85c('0x1c')]);_0x384556[_0xc85c('0x1b')]=qs[_0xc85c('0x1b')](_0x1e8625[_0xc85c('0x31')]['offset']);}return _0x5338cb[_0xc85c('0x4f')](_0x384556);}})[_0xc85c('0x24')](function(_0x480a68){if(_0x480a68){return _0x480a68?{'count':_0x169dba,'rows':_0x480a68}:null;}})['then'](respondWithResult(_0x4a82d3,null))[_0xc85c('0x43')](handleError(_0x4a82d3,null));};exports[_0xc85c('0x50')]=function(_0x4427a4,_0x5895dd,_0x140468){var _0x1de179={};var _0x3b9ee2={};var _0x25c248;var _0x3c4a1f;return db[_0xc85c('0x2b')]['findOne']({'where':{'id':_0x4427a4[_0xc85c('0x45')]['id']}})[_0xc85c('0x24')](handleEntityNotFound(_0x5895dd,null))[_0xc85c('0x24')](function(_0x4180d6){if(_0x4180d6){_0x25c248=_0x4180d6;_0x3b9ee2[_0xc85c('0x2f')]=_['keys'](db['Tag'][_0xc85c('0x2c')]);_0x3b9ee2['query']=_[_0xc85c('0x30')](_0x4427a4[_0xc85c('0x31')]);_0x3b9ee2[_0xc85c('0x32')]=_['intersection'](_0x3b9ee2['model'],_0x3b9ee2[_0xc85c('0x31')]);_0x1de179[_0xc85c('0x34')]=_['intersection'](_0x3b9ee2['model'],qs[_0xc85c('0x35')](_0x4427a4[_0xc85c('0x31')][_0xc85c('0x35')]));_0x1de179[_0xc85c('0x34')]=_0x1de179[_0xc85c('0x34')]['length']?_0x1de179[_0xc85c('0x34')]:_0x3b9ee2[_0xc85c('0x2f')];_0x1de179[_0xc85c('0x39')]=qs[_0xc85c('0x4d')](_0x4427a4[_0xc85c('0x31')]['sort']);_0x1de179[_0xc85c('0x3c')]=qs[_0xc85c('0x32')](_[_0xc85c('0x3a')](_0x4427a4[_0xc85c('0x31')],_0x3b9ee2[_0xc85c('0x32')]));if(_0x4427a4[_0xc85c('0x31')][_0xc85c('0x3b')]){_0x1de179[_0xc85c('0x3c')]=_['merge'](_0x1de179[_0xc85c('0x3c')],{'$or':_['map'](_0x1de179[_0xc85c('0x34')],function(_0xb05c8e){var _0x2ad515={};_0x2ad515[_0xb05c8e]={'$like':'%'+_0x4427a4[_0xc85c('0x31')][_0xc85c('0x3b')]+'%'};return _0x2ad515;})});}_0x1de179=_[_0xc85c('0x3d')]({},_0x1de179,_0x4427a4[_0xc85c('0x3f')]);return _0x25c248['getTags'](_0x1de179);}})['then'](function(_0x40f9a9){if(_0x40f9a9){_0x3c4a1f=_0x40f9a9[_0xc85c('0x36')];if(!_0x4427a4[_0xc85c('0x31')][_0xc85c('0x37')](_0xc85c('0x38'))){_0x1de179['limit']=qs[_0xc85c('0x1c')](_0x4427a4['query'][_0xc85c('0x1c')]);_0x1de179['offset']=qs[_0xc85c('0x1b')](_0x4427a4[_0xc85c('0x31')]['offset']);}return _0x25c248[_0xc85c('0x50')](_0x1de179);}})[_0xc85c('0x24')](function(_0x3c2e8f){if(_0x3c2e8f){return _0x3c2e8f?{'count':_0x3c4a1f,'rows':_0x3c2e8f}:null;}})[_0xc85c('0x24')](respondWithResult(_0x5895dd,null))[_0xc85c('0x43')](handleError(_0x5895dd,null));};exports['setTags']=function(_0x25da2f,_0x4a6e3b,_0x25ab1b){if(_0x25da2f[_0xc85c('0x48')]['id']){delete _0x25da2f[_0xc85c('0x48')]['id'];}return db[_0xc85c('0x2b')][_0xc85c('0x4b')]({'where':{'id':_0x25da2f[_0xc85c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a6e3b,null))[_0xc85c('0x24')](function(_0x2d5649){if(_0x2d5649){return _0x2d5649['setTags'](_0x25da2f[_0xc85c('0x48')][_0xc85c('0x51')]||[]);}return null;})[_0xc85c('0x24')](respondWithResult(_0x4a6e3b,null))[_0xc85c('0x43')](handleError(_0x4a6e3b,null));}; \ No newline at end of file +var _0x9f93=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','send','map','DeskConfiguration','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getFields','findOne','keys','nolimit','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2157ab,_0x2b4a5b){var _0x5121e0=function(_0x46ab70){while(--_0x46ab70){_0x2157ab['push'](_0x2157ab['shift']());}};_0x5121e0(++_0x2b4a5b);}(_0x9f93,0x93));var _0x39f9=function(_0x4718c4,_0x522978){_0x4718c4=_0x4718c4-0x0;var _0x5f58a3=_0x9f93[_0x4718c4];return _0x5f58a3;};'use strict';var emlformat=require(_0x39f9('0x0'));var rimraf=require(_0x39f9('0x1'));var zipdir=require(_0x39f9('0x2'));var jsonpatch=require(_0x39f9('0x3'));var rp=require(_0x39f9('0x4'));var moment=require(_0x39f9('0x5'));var BPromise=require(_0x39f9('0x6'));var Mustache=require(_0x39f9('0x7'));var util=require(_0x39f9('0x8'));var path=require(_0x39f9('0x9'));var sox=require(_0x39f9('0xa'));var csv=require(_0x39f9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39f9('0xc'));var _=require('lodash');var squel=require(_0x39f9('0xd'));var crypto=require(_0x39f9('0xe'));var jsforce=require(_0x39f9('0xf'));var deskjs=require(_0x39f9('0x10'));var toCsv=require(_0x39f9('0xb'));var querystring=require('querystring');var Papa=require(_0x39f9('0x11'));var Redis=require(_0x39f9('0x12'));var authService=require(_0x39f9('0x13'));var qs=require(_0x39f9('0x14'));var as=require(_0x39f9('0x15'));var hardwareService=require(_0x39f9('0x16'));var logger=require('../../config/logger')(_0x39f9('0x17'));var utils=require(_0x39f9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x39f9('0x19'));var db=require(_0x39f9('0x1a'))['db'];function respondWithStatusCode(_0xcbc741,_0x4da622){_0x4da622=_0x4da622||0xcc;return function(_0x5f5aa8){if(_0x5f5aa8){return _0xcbc741[_0x39f9('0x1b')](_0x4da622);}return _0xcbc741[_0x39f9('0x1c')](_0x4da622)['end']();};}function respondWithResult(_0x207320,_0x4a4986){_0x4a4986=_0x4a4986||0xc8;return function(_0x45c42a){if(_0x45c42a){return _0x207320[_0x39f9('0x1c')](_0x4a4986)['json'](_0x45c42a);}};}function respondWithFilteredResult(_0x10f396,_0x518e7b){return function(_0x577bf4){if(_0x577bf4){var _0x87dcf6=typeof _0x518e7b[_0x39f9('0x1d')]===_0x39f9('0x1e')&&typeof _0x518e7b[_0x39f9('0x1f')]===_0x39f9('0x1e');var _0x259404=_0x577bf4[_0x39f9('0x20')];var _0x301df2=_0x87dcf6?0x0:_0x518e7b[_0x39f9('0x1d')];var _0x4ba267=_0x87dcf6?_0x577bf4[_0x39f9('0x20')]:_0x518e7b[_0x39f9('0x1d')]+_0x518e7b[_0x39f9('0x1f')];var _0x4741ad;if(_0x4ba267>=_0x259404){_0x4ba267=_0x259404;_0x4741ad=0xc8;}else{_0x4741ad=0xce;}_0x10f396[_0x39f9('0x1c')](_0x4741ad);return _0x10f396[_0x39f9('0x21')]('Content-Range',_0x301df2+'-'+_0x4ba267+'/'+_0x259404)[_0x39f9('0x22')](_0x577bf4);}return null;};}function patchUpdates(_0x164e02){return function(_0x43d95a){try{jsonpatch['apply'](_0x43d95a,_0x164e02,!![]);}catch(_0x316f31){return BPromise[_0x39f9('0x23')](_0x316f31);}return _0x43d95a[_0x39f9('0x24')]();};}function saveUpdates(_0x5dca0f,_0x41f8ea){return function(_0x5ab9e1){if(_0x5ab9e1){return _0x5ab9e1[_0x39f9('0x25')](_0x5dca0f)[_0x39f9('0x26')](function(_0x12aa11){return _0x12aa11;});}return null;};}function removeEntity(_0x1bde76,_0x43a1ac){return function(_0x9e7fcb){if(_0x9e7fcb){return _0x9e7fcb[_0x39f9('0x27')]()[_0x39f9('0x26')](function(){_0x1bde76['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26e28c,_0x5294e5){return function(_0x2904b3){if(!_0x2904b3){_0x26e28c['sendStatus'](0x194);}return _0x2904b3;};}function handleError(_0x3c7e69,_0x57e1b4){_0x57e1b4=_0x57e1b4||0x1f4;return function(_0xd5ecea){logger[_0x39f9('0x28')](_0xd5ecea[_0x39f9('0x29')]);if(_0xd5ecea['name']){delete _0xd5ecea[_0x39f9('0x2a')];}_0x3c7e69[_0x39f9('0x1c')](_0x57e1b4)[_0x39f9('0x2b')](_0xd5ecea);};}exports['index']=function(_0x3b9ab5,_0x4da713){var _0x3d7116={},_0x10b948={},_0x40e26a={'count':0x0,'rows':[]};var _0x368762=_[_0x39f9('0x2c')](db[_0x39f9('0x2d')][_0x39f9('0x2e')],function(_0x178fee){return{'name':_0x178fee['fieldName'],'type':_0x178fee[_0x39f9('0x2f')]['key']};});_0x10b948['model']=_[_0x39f9('0x2c')](_0x368762,_0x39f9('0x2a'));_0x10b948[_0x39f9('0x30')]=_['keys'](_0x3b9ab5[_0x39f9('0x30')]);_0x10b948[_0x39f9('0x31')]=_[_0x39f9('0x32')](_0x10b948[_0x39f9('0x33')],_0x10b948[_0x39f9('0x30')]);_0x3d7116[_0x39f9('0x34')]=_[_0x39f9('0x32')](_0x10b948[_0x39f9('0x33')],qs['fields'](_0x3b9ab5[_0x39f9('0x30')][_0x39f9('0x35')]));_0x3d7116[_0x39f9('0x34')]=_0x3d7116[_0x39f9('0x34')]['length']?_0x3d7116[_0x39f9('0x34')]:_0x10b948[_0x39f9('0x33')];if(!_0x3b9ab5[_0x39f9('0x30')][_0x39f9('0x36')]('nolimit')){_0x3d7116[_0x39f9('0x1f')]=qs[_0x39f9('0x1f')](_0x3b9ab5[_0x39f9('0x30')]['limit']);_0x3d7116[_0x39f9('0x1d')]=qs[_0x39f9('0x1d')](_0x3b9ab5[_0x39f9('0x30')][_0x39f9('0x1d')]);}_0x3d7116[_0x39f9('0x37')]=qs[_0x39f9('0x38')](_0x3b9ab5['query'][_0x39f9('0x38')]);_0x3d7116[_0x39f9('0x39')]=qs[_0x39f9('0x31')](_[_0x39f9('0x3a')](_0x3b9ab5[_0x39f9('0x30')],_0x10b948['filters']),_0x368762);if(_0x3b9ab5[_0x39f9('0x30')]['filter']){_0x3d7116[_0x39f9('0x39')]=_[_0x39f9('0x3b')](_0x3d7116[_0x39f9('0x39')],{'$or':_['map'](_0x368762,function(_0x68e2a9){if(_0x68e2a9[_0x39f9('0x2f')]!==_0x39f9('0x3c')){var _0x46a00b={};_0x46a00b[_0x68e2a9[_0x39f9('0x2a')]]={'$like':'%'+_0x3b9ab5['query'][_0x39f9('0x3d')]+'%'};return _0x46a00b;}})});}_0x3d7116=_[_0x39f9('0x3b')]({},_0x3d7116,_0x3b9ab5[_0x39f9('0x3e')]);var _0x5ddc67={'where':_0x3d7116[_0x39f9('0x39')]};return db[_0x39f9('0x2d')][_0x39f9('0x20')](_0x5ddc67)[_0x39f9('0x26')](function(_0x1c76fe){_0x40e26a[_0x39f9('0x20')]=_0x1c76fe;if(_0x3b9ab5[_0x39f9('0x30')][_0x39f9('0x3f')]){_0x3d7116[_0x39f9('0x40')]=[{'all':!![]}];}return db[_0x39f9('0x2d')][_0x39f9('0x41')](_0x3d7116);})[_0x39f9('0x26')](function(_0x590375){_0x40e26a[_0x39f9('0x42')]=_0x590375;return _0x40e26a;})[_0x39f9('0x26')](respondWithFilteredResult(_0x4da713,_0x3d7116))[_0x39f9('0x43')](handleError(_0x4da713,null));};exports[_0x39f9('0x44')]=function(_0x17cce8,_0x4ffd6c){var _0x5d80ae={'raw':![],'where':{'id':_0x17cce8['params']['id']}},_0xc1deed={};_0xc1deed[_0x39f9('0x33')]=_['keys'](db[_0x39f9('0x2d')]['rawAttributes']);_0xc1deed[_0x39f9('0x30')]=_['keys'](_0x17cce8[_0x39f9('0x30')]);_0xc1deed['filters']=_['intersection'](_0xc1deed[_0x39f9('0x33')],_0xc1deed[_0x39f9('0x30')]);_0x5d80ae[_0x39f9('0x34')]=_[_0x39f9('0x32')](_0xc1deed[_0x39f9('0x33')],qs['fields'](_0x17cce8[_0x39f9('0x30')][_0x39f9('0x35')]));_0x5d80ae[_0x39f9('0x34')]=_0x5d80ae[_0x39f9('0x34')][_0x39f9('0x45')]?_0x5d80ae[_0x39f9('0x34')]:_0xc1deed['model'];if(_0x17cce8['query']['includeAll']){_0x5d80ae[_0x39f9('0x40')]=[{'all':!![]}];}_0x5d80ae=_['merge']({},_0x5d80ae,_0x17cce8[_0x39f9('0x3e')]);return db[_0x39f9('0x2d')][_0x39f9('0x46')](_0x5d80ae)['then'](handleEntityNotFound(_0x4ffd6c,null))[_0x39f9('0x26')](respondWithResult(_0x4ffd6c,null))[_0x39f9('0x43')](handleError(_0x4ffd6c,null));};exports[_0x39f9('0x47')]=function(_0x5a036e,_0x11a59f){return db[_0x39f9('0x2d')][_0x39f9('0x47')](_0x5a036e['body'],{})['then'](respondWithResult(_0x11a59f,0xc9))[_0x39f9('0x43')](handleError(_0x11a59f,null));};exports[_0x39f9('0x25')]=function(_0x325f86,_0x1bf20e){if(_0x325f86[_0x39f9('0x48')]['id']){delete _0x325f86[_0x39f9('0x48')]['id'];}return db[_0x39f9('0x2d')][_0x39f9('0x46')]({'where':{'id':_0x325f86['params']['id']}})[_0x39f9('0x26')](handleEntityNotFound(_0x1bf20e,null))[_0x39f9('0x26')](saveUpdates(_0x325f86[_0x39f9('0x48')],null))['then'](respondWithResult(_0x1bf20e,null))['catch'](handleError(_0x1bf20e,null));};exports['destroy']=function(_0x2b31a9,_0x131a98){return db[_0x39f9('0x2d')]['find']({'where':{'id':_0x2b31a9[_0x39f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x131a98,null))[_0x39f9('0x26')](removeEntity(_0x131a98,null))['catch'](handleError(_0x131a98,null));};exports[_0x39f9('0x4a')]=function(_0x5065c5,_0x202449,_0x5de5fb){var _0x12ae2f={};var _0x258371={};var _0x53227e;var _0x3d901c;return db[_0x39f9('0x2d')][_0x39f9('0x4b')]({'where':{'id':_0x5065c5[_0x39f9('0x49')]['id']}})[_0x39f9('0x26')](handleEntityNotFound(_0x202449,null))[_0x39f9('0x26')](function(_0x16cfd2){if(_0x16cfd2){_0x53227e=_0x16cfd2;_0x258371[_0x39f9('0x33')]=_[_0x39f9('0x4c')](db['DeskField'][_0x39f9('0x2e')]);_0x258371['query']=_['keys'](_0x5065c5[_0x39f9('0x30')]);_0x258371[_0x39f9('0x31')]=_[_0x39f9('0x32')](_0x258371[_0x39f9('0x33')],_0x258371['query']);_0x12ae2f['attributes']=_[_0x39f9('0x32')](_0x258371['model'],qs[_0x39f9('0x35')](_0x5065c5[_0x39f9('0x30')][_0x39f9('0x35')]));_0x12ae2f['attributes']=_0x12ae2f[_0x39f9('0x34')][_0x39f9('0x45')]?_0x12ae2f[_0x39f9('0x34')]:_0x258371[_0x39f9('0x33')];_0x12ae2f[_0x39f9('0x37')]=qs[_0x39f9('0x38')](_0x5065c5['query']['sort']);_0x12ae2f[_0x39f9('0x39')]=qs['filters'](_['pick'](_0x5065c5[_0x39f9('0x30')],_0x258371[_0x39f9('0x31')]));if(_0x5065c5[_0x39f9('0x30')][_0x39f9('0x3d')]){_0x12ae2f[_0x39f9('0x39')]=_['merge'](_0x12ae2f[_0x39f9('0x39')],{'$or':_[_0x39f9('0x2c')](_0x12ae2f['attributes'],function(_0xe078f4){var _0x2680b9={};_0x2680b9[_0xe078f4]={'$like':'%'+_0x5065c5[_0x39f9('0x30')][_0x39f9('0x3d')]+'%'};return _0x2680b9;})});}_0x12ae2f=_['merge']({},_0x12ae2f,_0x5065c5[_0x39f9('0x3e')]);return _0x53227e[_0x39f9('0x4a')](_0x12ae2f);}})['then'](function(_0x26e0ec){if(_0x26e0ec){_0x3d901c=_0x26e0ec[_0x39f9('0x45')];if(!_0x5065c5[_0x39f9('0x30')][_0x39f9('0x36')](_0x39f9('0x4d'))){_0x12ae2f[_0x39f9('0x1f')]=qs['limit'](_0x5065c5['query'][_0x39f9('0x1f')]);_0x12ae2f['offset']=qs[_0x39f9('0x1d')](_0x5065c5['query'][_0x39f9('0x1d')]);}return _0x53227e['getFields'](_0x12ae2f);}})[_0x39f9('0x26')](function(_0x1ca38f){if(_0x1ca38f){return _0x1ca38f?{'count':_0x3d901c,'rows':_0x1ca38f}:null;}})[_0x39f9('0x26')](respondWithResult(_0x202449,null))[_0x39f9('0x43')](handleError(_0x202449,null));};exports['getSubjects']=function(_0x35ff25,_0x10707e,_0x388b5c){var _0x3ce845={};var _0x8f5436={};var _0x415763;var _0x380b1e;return db[_0x39f9('0x2d')][_0x39f9('0x4b')]({'where':{'id':_0x35ff25[_0x39f9('0x49')]['id']}})[_0x39f9('0x26')](handleEntityNotFound(_0x10707e,null))['then'](function(_0x300ce9){if(_0x300ce9){_0x415763=_0x300ce9;_0x8f5436[_0x39f9('0x33')]=_[_0x39f9('0x4c')](db[_0x39f9('0x4e')]['rawAttributes']);_0x8f5436[_0x39f9('0x30')]=_[_0x39f9('0x4c')](_0x35ff25[_0x39f9('0x30')]);_0x8f5436['filters']=_[_0x39f9('0x32')](_0x8f5436['model'],_0x8f5436[_0x39f9('0x30')]);_0x3ce845[_0x39f9('0x34')]=_[_0x39f9('0x32')](_0x8f5436['model'],qs[_0x39f9('0x35')](_0x35ff25[_0x39f9('0x30')][_0x39f9('0x35')]));_0x3ce845[_0x39f9('0x34')]=_0x3ce845[_0x39f9('0x34')][_0x39f9('0x45')]?_0x3ce845['attributes']:_0x8f5436[_0x39f9('0x33')];_0x3ce845['order']=qs['sort'](_0x35ff25[_0x39f9('0x30')][_0x39f9('0x38')]);_0x3ce845[_0x39f9('0x39')]=qs['filters'](_[_0x39f9('0x3a')](_0x35ff25[_0x39f9('0x30')],_0x8f5436[_0x39f9('0x31')]));if(_0x35ff25[_0x39f9('0x30')][_0x39f9('0x3d')]){_0x3ce845['where']=_['merge'](_0x3ce845[_0x39f9('0x39')],{'$or':_[_0x39f9('0x2c')](_0x3ce845['attributes'],function(_0x116a0d){var _0x5b68c7={};_0x5b68c7[_0x116a0d]={'$like':'%'+_0x35ff25[_0x39f9('0x30')]['filter']+'%'};return _0x5b68c7;})});}_0x3ce845=_[_0x39f9('0x3b')]({},_0x3ce845,_0x35ff25[_0x39f9('0x3e')]);return _0x415763[_0x39f9('0x4f')](_0x3ce845);}})[_0x39f9('0x26')](function(_0x47baa1){if(_0x47baa1){_0x380b1e=_0x47baa1['length'];if(!_0x35ff25[_0x39f9('0x30')][_0x39f9('0x36')](_0x39f9('0x4d'))){_0x3ce845[_0x39f9('0x1f')]=qs[_0x39f9('0x1f')](_0x35ff25[_0x39f9('0x30')][_0x39f9('0x1f')]);_0x3ce845[_0x39f9('0x1d')]=qs[_0x39f9('0x1d')](_0x35ff25['query'][_0x39f9('0x1d')]);}return _0x415763[_0x39f9('0x4f')](_0x3ce845);}})[_0x39f9('0x26')](function(_0x21f8ad){if(_0x21f8ad){return _0x21f8ad?{'count':_0x380b1e,'rows':_0x21f8ad}:null;}})[_0x39f9('0x26')](respondWithResult(_0x10707e,null))[_0x39f9('0x43')](handleError(_0x10707e,null));};exports[_0x39f9('0x50')]=function(_0x159b42,_0x436b95,_0x1fe8a6){var _0xaaf1d5={};var _0x339ff2={};var _0x1039fb;var _0x3a1a92;return db[_0x39f9('0x2d')][_0x39f9('0x4b')]({'where':{'id':_0x159b42[_0x39f9('0x49')]['id']}})[_0x39f9('0x26')](handleEntityNotFound(_0x436b95,null))[_0x39f9('0x26')](function(_0x1f7ee0){if(_0x1f7ee0){_0x1039fb=_0x1f7ee0;_0x339ff2[_0x39f9('0x33')]=_['keys'](db[_0x39f9('0x4e')][_0x39f9('0x2e')]);_0x339ff2[_0x39f9('0x30')]=_[_0x39f9('0x4c')](_0x159b42[_0x39f9('0x30')]);_0x339ff2[_0x39f9('0x31')]=_[_0x39f9('0x32')](_0x339ff2[_0x39f9('0x33')],_0x339ff2['query']);_0xaaf1d5['attributes']=_[_0x39f9('0x32')](_0x339ff2[_0x39f9('0x33')],qs['fields'](_0x159b42[_0x39f9('0x30')][_0x39f9('0x35')]));_0xaaf1d5['attributes']=_0xaaf1d5[_0x39f9('0x34')][_0x39f9('0x45')]?_0xaaf1d5['attributes']:_0x339ff2[_0x39f9('0x33')];_0xaaf1d5[_0x39f9('0x37')]=qs['sort'](_0x159b42[_0x39f9('0x30')][_0x39f9('0x38')]);_0xaaf1d5[_0x39f9('0x39')]=qs[_0x39f9('0x31')](_[_0x39f9('0x3a')](_0x159b42[_0x39f9('0x30')],_0x339ff2[_0x39f9('0x31')]));if(_0x159b42['query'][_0x39f9('0x3d')]){_0xaaf1d5[_0x39f9('0x39')]=_[_0x39f9('0x3b')](_0xaaf1d5[_0x39f9('0x39')],{'$or':_['map'](_0xaaf1d5[_0x39f9('0x34')],function(_0x12a4cc){var _0x1ac109={};_0x1ac109[_0x12a4cc]={'$like':'%'+_0x159b42[_0x39f9('0x30')][_0x39f9('0x3d')]+'%'};return _0x1ac109;})});}_0xaaf1d5=_[_0x39f9('0x3b')]({},_0xaaf1d5,_0x159b42['options']);return _0x1039fb['getDescriptions'](_0xaaf1d5);}})[_0x39f9('0x26')](function(_0xe6cbb0){if(_0xe6cbb0){_0x3a1a92=_0xe6cbb0[_0x39f9('0x45')];if(!_0x159b42['query'][_0x39f9('0x36')](_0x39f9('0x4d'))){_0xaaf1d5['limit']=qs[_0x39f9('0x1f')](_0x159b42[_0x39f9('0x30')][_0x39f9('0x1f')]);_0xaaf1d5[_0x39f9('0x1d')]=qs[_0x39f9('0x1d')](_0x159b42[_0x39f9('0x30')][_0x39f9('0x1d')]);}return _0x1039fb[_0x39f9('0x50')](_0xaaf1d5);}})[_0x39f9('0x26')](function(_0x561843){if(_0x561843){return _0x561843?{'count':_0x3a1a92,'rows':_0x561843}:null;}})['then'](respondWithResult(_0x436b95,null))[_0x39f9('0x43')](handleError(_0x436b95,null));};exports[_0x39f9('0x51')]=function(_0x32f1f7,_0x342f91,_0x1e94bd){var _0x3e0763={};var _0x3b4249={};var _0x447d35;var _0x3a9b25;return db[_0x39f9('0x2d')]['findOne']({'where':{'id':_0x32f1f7[_0x39f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x342f91,null))[_0x39f9('0x26')](function(_0x560154){if(_0x560154){_0x447d35=_0x560154;_0x3b4249[_0x39f9('0x33')]=_[_0x39f9('0x4c')](db[_0x39f9('0x52')]['rawAttributes']);_0x3b4249[_0x39f9('0x30')]=_[_0x39f9('0x4c')](_0x32f1f7[_0x39f9('0x30')]);_0x3b4249['filters']=_[_0x39f9('0x32')](_0x3b4249['model'],_0x3b4249[_0x39f9('0x30')]);_0x3e0763[_0x39f9('0x34')]=_[_0x39f9('0x32')](_0x3b4249[_0x39f9('0x33')],qs['fields'](_0x32f1f7[_0x39f9('0x30')]['fields']));_0x3e0763[_0x39f9('0x34')]=_0x3e0763['attributes'][_0x39f9('0x45')]?_0x3e0763[_0x39f9('0x34')]:_0x3b4249[_0x39f9('0x33')];_0x3e0763[_0x39f9('0x37')]=qs[_0x39f9('0x38')](_0x32f1f7[_0x39f9('0x30')][_0x39f9('0x38')]);_0x3e0763[_0x39f9('0x39')]=qs[_0x39f9('0x31')](_[_0x39f9('0x3a')](_0x32f1f7[_0x39f9('0x30')],_0x3b4249[_0x39f9('0x31')]));if(_0x32f1f7[_0x39f9('0x30')]['filter']){_0x3e0763[_0x39f9('0x39')]=_[_0x39f9('0x3b')](_0x3e0763[_0x39f9('0x39')],{'$or':_[_0x39f9('0x2c')](_0x3e0763[_0x39f9('0x34')],function(_0x5e2dff){var _0xc8eae6={};_0xc8eae6[_0x5e2dff]={'$like':'%'+_0x32f1f7[_0x39f9('0x30')][_0x39f9('0x3d')]+'%'};return _0xc8eae6;})});}_0x3e0763=_[_0x39f9('0x3b')]({},_0x3e0763,_0x32f1f7['options']);return _0x447d35['getTags'](_0x3e0763);}})['then'](function(_0x554fda){if(_0x554fda){_0x3a9b25=_0x554fda[_0x39f9('0x45')];if(!_0x32f1f7[_0x39f9('0x30')]['hasOwnProperty'](_0x39f9('0x4d'))){_0x3e0763[_0x39f9('0x1f')]=qs[_0x39f9('0x1f')](_0x32f1f7[_0x39f9('0x30')][_0x39f9('0x1f')]);_0x3e0763[_0x39f9('0x1d')]=qs[_0x39f9('0x1d')](_0x32f1f7[_0x39f9('0x30')][_0x39f9('0x1d')]);}return _0x447d35[_0x39f9('0x51')](_0x3e0763);}})[_0x39f9('0x26')](function(_0x1aeca6){if(_0x1aeca6){return _0x1aeca6?{'count':_0x3a9b25,'rows':_0x1aeca6}:null;}})[_0x39f9('0x26')](respondWithResult(_0x342f91,null))[_0x39f9('0x43')](handleError(_0x342f91,null));};exports['setTags']=function(_0x950778,_0x183cbd,_0x29c7e4){if(_0x950778[_0x39f9('0x48')]['id']){delete _0x950778['body']['id'];}return db[_0x39f9('0x2d')][_0x39f9('0x4b')]({'where':{'id':_0x950778[_0x39f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x183cbd,null))[_0x39f9('0x26')](function(_0x4d1d91){if(_0x4d1d91){return _0x4d1d91[_0x39f9('0x53')](_0x950778[_0x39f9('0x48')][_0x39f9('0x54')]||[]);}return null;})[_0x39f9('0x26')](respondWithResult(_0x183cbd,null))[_0x39f9('0x43')](handleError(_0x183cbd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 7be91ed..9722a04 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 _0xae55=['moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api'];(function(_0x1f5520,_0x1b36d9){var _0x53e003=function(_0x4e5116){while(--_0x4e5116){_0x1f5520['push'](_0x1f5520['shift']());}};_0x53e003(++_0x1b36d9);}(_0xae55,0xbf));var _0x5ae5=function(_0x4b0b10,_0x5ef8a8){_0x4b0b10=_0x4b0b10-0x0;var _0x5f5dd1=_0xae55[_0x4b0b10];return _0x5f5dd1;};'use strict';var _=require(_0x5ae5('0x0'));var util=require(_0x5ae5('0x1'));var logger=require(_0x5ae5('0x2'))(_0x5ae5('0x3'));var moment=require(_0x5ae5('0x4'));var BPromise=require(_0x5ae5('0x5'));var rp=require(_0x5ae5('0x6'));var fs=require('fs');var path=require(_0x5ae5('0x7'));var rimraf=require('rimraf');var config=require(_0x5ae5('0x8'));var attributes=require(_0x5ae5('0x9'));module[_0x5ae5('0xa')]=function(_0x1ab4f9,_0x2623bc){return _0x1ab4f9[_0x5ae5('0xb')](_0x5ae5('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0580=['bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0580,0x1d0));var _0x0058=function(_0x131f98,_0x58cf97){_0x131f98=_0x131f98-0x0;var _0x474238=_0x0580[_0x131f98];return _0x474238;};'use strict';var _=require(_0x0058('0x0'));var util=require(_0x0058('0x1'));var logger=require(_0x0058('0x2'))('api');var moment=require(_0x0058('0x3'));var BPromise=require(_0x0058('0x4'));var rp=require(_0x0058('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0058('0x6'));var config=require(_0x0058('0x7'));var attributes=require(_0x0058('0x8'));module[_0x0058('0x9')]=function(_0x2a4dbc,_0xc3712a){return _0x2a4dbc[_0x0058('0xa')](_0x0058('0xb'),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 810c2e6..6381fc8 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 _0x5713=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4a05a2,_0x46f343){var _0x557e0b=function(_0x30e156){while(--_0x30e156){_0x4a05a2['push'](_0x4a05a2['shift']());}};_0x557e0b(++_0x46f343);}(_0x5713,0x1c7));var _0x3571=function(_0x4cf95f,_0x31abea){_0x4cf95f=_0x4cf95f-0x0;var _0x26c707=_0x5713[_0x4cf95f];return _0x26c707;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var moment=require('moment');var BPromise=require(_0x3571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3571('0x3'));var db=require(_0x3571('0x4'))['db'];var utils=require(_0x3571('0x5'));var logger=require(_0x3571('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3571('0x7'));var client=jayson[_0x3571('0x8')][_0x3571('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432a48,_0x3a6f29,_0x1f8f0f){return new BPromise(function(_0x48b06d,_0x358ba1){return client[_0x3571('0xa')](_0x432a48,_0x1f8f0f)[_0x3571('0xb')](function(_0x288fc8){logger[_0x3571('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x3a6f29,'request\x20sent');logger[_0x3571('0xd')](_0x3571('0xe'),_0x3a6f29,_0x3571('0xf'),JSON['stringify'](_0x288fc8));if(_0x288fc8['error']){if(_0x288fc8['error']['code']===0x1f4){logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x358ba1(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x48b06d(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}else{logger[_0x3571('0xc')](_0x3571('0x11'),_0x3a6f29,_0x3571('0xf'));_0x48b06d(_0x288fc8[_0x3571('0x13')]['message']);}})['catch'](function(_0x48c77e){logger[_0x3571('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x3a6f29,_0x48c77e);_0x358ba1(_0x48c77e);});});} \ No newline at end of file +var _0xafa7=['error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xafa7,0x122));var _0x7afa=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0xafa7[_0x4d67b8];return _0x55af3b;};'use strict';var _=require(_0x7afa('0x0'));var util=require(_0x7afa('0x1'));var moment=require('moment');var BPromise=require(_0x7afa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7afa('0x3'));var db=require(_0x7afa('0x4'))['db'];var utils=require(_0x7afa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7afa('0x6'));var jayson=require(_0x7afa('0x7'));var client=jayson[_0x7afa('0x8')][_0x7afa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2243f6,_0x2b826f,_0x59c1f0){return new BPromise(function(_0xde102c,_0x225de7){return client[_0x7afa('0xa')](_0x2243f6,_0x59c1f0)[_0x7afa('0xb')](function(_0x40bff1){logger[_0x7afa('0xc')](_0x7afa('0xd'),_0x2b826f,'request\x20sent');logger[_0x7afa('0xe')](_0x7afa('0xf'),_0x2b826f,_0x7afa('0x10'),JSON[_0x7afa('0x11')](_0x40bff1));if(_0x40bff1[_0x7afa('0x12')]){if(_0x40bff1[_0x7afa('0x12')][_0x7afa('0x13')]===0x1f4){logger[_0x7afa('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x2b826f,_0x40bff1['error']['message']);return _0x225de7(_0x40bff1[_0x7afa('0x12')][_0x7afa('0x14')]);}logger[_0x7afa('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x2b826f,_0x40bff1[_0x7afa('0x12')][_0x7afa('0x14')]);return _0xde102c(_0x40bff1[_0x7afa('0x12')]['message']);}else{logger['info'](_0x7afa('0xd'),_0x2b826f,'request\x20sent');_0xde102c(_0x40bff1[_0x7afa('0x15')]['message']);}})['catch'](function(_0xc6fd10){logger[_0x7afa('0x12')](_0x7afa('0xd'),_0x2b826f,_0xc6fd10);_0x225de7(_0xc6fd10);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 12899dc..4847279 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 _0x0ea9=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','multer','util'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0x0ea9,0x130));var _0x90ea=function(_0x4ccb0b,_0x21a542){_0x4ccb0b=_0x4ccb0b-0x0;var _0x47130c=_0x0ea9[_0x4ccb0b];return _0x47130c;};'use strict';var multer=require(_0x90ea('0x0'));var util=require(_0x90ea('0x1'));var path=require(_0x90ea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x90ea('0x3')]();var fs_extra=require(_0x90ea('0x4'));var auth=require(_0x90ea('0x5'));var interaction=require(_0x90ea('0x6'));var config=require('../../config/environment');var controller=require(_0x90ea('0x7'));router[_0x90ea('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x90ea('0x8')](_0x90ea('0x9'),auth[_0x90ea('0xa')](),controller[_0x90ea('0xb')]);router[_0x90ea('0xc')]('/',auth[_0x90ea('0xa')](),controller[_0x90ea('0xd')]);router[_0x90ea('0xe')](_0x90ea('0x9'),auth[_0x90ea('0xa')](),controller[_0x90ea('0xf')]);router[_0x90ea('0x10')](_0x90ea('0x9'),auth[_0x90ea('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd3f3=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4148e2,_0x23b194){var _0x34f35e=function(_0x3fba92){while(--_0x3fba92){_0x4148e2['push'](_0x4148e2['shift']());}};_0x34f35e(++_0x23b194);}(_0xd3f3,0xf0));var _0x3d3f=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0xd3f3[_0x4b6830];return _0x239e4a;};'use strict';var multer=require(_0x3d3f('0x0'));var util=require('util');var path=require(_0x3d3f('0x1'));var timeout=require(_0x3d3f('0x2'));var express=require(_0x3d3f('0x3'));var router=express[_0x3d3f('0x4')]();var fs_extra=require(_0x3d3f('0x5'));var auth=require(_0x3d3f('0x6'));var interaction=require(_0x3d3f('0x7'));var config=require(_0x3d3f('0x8'));var controller=require('./intDeskField.controller');router[_0x3d3f('0x9')]('/',auth[_0x3d3f('0xa')](),controller[_0x3d3f('0xb')]);router[_0x3d3f('0x9')](_0x3d3f('0xc'),auth[_0x3d3f('0xa')](),controller[_0x3d3f('0xd')]);router[_0x3d3f('0xe')]('/',auth[_0x3d3f('0xa')](),controller['create']);router[_0x3d3f('0xf')](_0x3d3f('0xc'),auth[_0x3d3f('0xa')](),controller[_0x3d3f('0x10')]);router['delete'](_0x3d3f('0xc'),auth[_0x3d3f('0xa')](),controller[_0x3d3f('0x11')]);module[_0x3d3f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e4f3cf1..4362dea 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 _0x4c96=['keyValue','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4c96,0x8c));var _0x64c9=function(_0x119598,_0x56f8f8){_0x119598=_0x119598-0x0;var _0x1e984f=_0x4c96[_0x119598];return _0x1e984f;};'use strict';var Sequelize=require('sequelize');module[_0x64c9('0x0')]={'type':{'type':Sequelize[_0x64c9('0x1')](_0x64c9('0x2'),_0x64c9('0x3'),'customVariable',_0x64c9('0x4'),'picklist'),'defaultValue':_0x64c9('0x2')},'content':{'type':Sequelize[_0x64c9('0x5')]},'key':{'type':Sequelize[_0x64c9('0x5')]},'keyType':{'type':Sequelize[_0x64c9('0x1')](_0x64c9('0x2'),_0x64c9('0x3'),_0x64c9('0x6'))},'keyContent':{'type':Sequelize[_0x64c9('0x5')]},'idField':{'type':Sequelize[_0x64c9('0x5')]},'nameField':{'type':Sequelize[_0x64c9('0x5')]},'customField':{'type':Sequelize[_0x64c9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x64c9('0x5')]}}; \ No newline at end of file +var _0xa7e3=['string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x2f345b,_0x1503eb){var _0x2c556b=function(_0x378633){while(--_0x378633){_0x2f345b['push'](_0x2f345b['shift']());}};_0x2c556b(++_0x1503eb);}(_0xa7e3,0x1d0));var _0x3a7e=function(_0x48beb3,_0x5a0a80){_0x48beb3=_0x48beb3-0x0;var _0x2e94be=_0xa7e3[_0x48beb3];return _0x2e94be;};'use strict';var Sequelize=require(_0x3a7e('0x0'));module[_0x3a7e('0x1')]={'type':{'type':Sequelize[_0x3a7e('0x2')]('string','variable',_0x3a7e('0x3'),_0x3a7e('0x4'),_0x3a7e('0x5')),'defaultValue':_0x3a7e('0x6')},'content':{'type':Sequelize[_0x3a7e('0x7')]},'key':{'type':Sequelize[_0x3a7e('0x7')]},'keyType':{'type':Sequelize[_0x3a7e('0x2')](_0x3a7e('0x6'),_0x3a7e('0x8'),_0x3a7e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3a7e('0x7')]},'nameField':{'type':Sequelize[_0x3a7e('0x7')]},'customField':{'type':Sequelize[_0x3a7e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3a7e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0ff8d75..7f064a1 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 _0xeb98=['util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','DeskField','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','mustache'];(function(_0x3e151d,_0x5b96a8){var _0x10ad6a=function(_0x57fddf){while(--_0x57fddf){_0x3e151d['push'](_0x3e151d['shift']());}};_0x10ad6a(++_0x5b96a8);}(_0xeb98,0xe0));var _0x8eb9=function(_0x41dcda,_0x21e8cc){_0x41dcda=_0x41dcda-0x0;var _0x4b0e10=_0xeb98[_0x41dcda];return _0x4b0e10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8eb9('0x0'));var zipdir=require(_0x8eb9('0x1'));var jsonpatch=require(_0x8eb9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8eb9('0x3'));var util=require(_0x8eb9('0x4'));var path=require(_0x8eb9('0x5'));var sox=require(_0x8eb9('0x6'));var csv=require('to-csv');var ejs=require(_0x8eb9('0x7'));var fs=require('fs');var fs_extra=require(_0x8eb9('0x8'));var _=require(_0x8eb9('0x9'));var squel=require('squel');var crypto=require(_0x8eb9('0xa'));var jsforce=require(_0x8eb9('0xb'));var deskjs=require(_0x8eb9('0xc'));var toCsv=require(_0x8eb9('0xd'));var querystring=require(_0x8eb9('0xe'));var Papa=require(_0x8eb9('0xf'));var Redis=require(_0x8eb9('0x10'));var authService=require(_0x8eb9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8eb9('0x12'));var hardwareService=require(_0x8eb9('0x13'));var logger=require(_0x8eb9('0x14'))('api');var utils=require(_0x8eb9('0x15'));var config=require(_0x8eb9('0x16'));var licenseUtil=require(_0x8eb9('0x17'));var db=require(_0x8eb9('0x18'))['db'];function respondWithStatusCode(_0x3b8697,_0x4f0a7e){_0x4f0a7e=_0x4f0a7e||0xcc;return function(_0x3f39b3){if(_0x3f39b3){return _0x3b8697[_0x8eb9('0x19')](_0x4f0a7e);}return _0x3b8697['status'](_0x4f0a7e)[_0x8eb9('0x1a')]();};}function respondWithResult(_0x2106c6,_0x1fe3ec){_0x1fe3ec=_0x1fe3ec||0xc8;return function(_0x45ca9c){if(_0x45ca9c){return _0x2106c6[_0x8eb9('0x1b')](_0x1fe3ec)[_0x8eb9('0x1c')](_0x45ca9c);}};}function respondWithFilteredResult(_0x192572,_0x4c46e7){return function(_0x1cacd2){if(_0x1cacd2){var _0x43f3a4=typeof _0x4c46e7['offset']===_0x8eb9('0x1d')&&typeof _0x4c46e7[_0x8eb9('0x1e')]===_0x8eb9('0x1d');var _0x483bc7=_0x1cacd2[_0x8eb9('0x1f')];var _0x647eec=_0x43f3a4?0x0:_0x4c46e7[_0x8eb9('0x20')];var _0x515114=_0x43f3a4?_0x1cacd2[_0x8eb9('0x1f')]:_0x4c46e7[_0x8eb9('0x20')]+_0x4c46e7[_0x8eb9('0x1e')];var _0x51e79b;if(_0x515114>=_0x483bc7){_0x515114=_0x483bc7;_0x51e79b=0xc8;}else{_0x51e79b=0xce;}_0x192572[_0x8eb9('0x1b')](_0x51e79b);return _0x192572[_0x8eb9('0x21')](_0x8eb9('0x22'),_0x647eec+'-'+_0x515114+'/'+_0x483bc7)[_0x8eb9('0x1c')](_0x1cacd2);}return null;};}function patchUpdates(_0x5c2591){return function(_0x19f43e){try{jsonpatch[_0x8eb9('0x23')](_0x19f43e,_0x5c2591,!![]);}catch(_0x8e4cac){return BPromise[_0x8eb9('0x24')](_0x8e4cac);}return _0x19f43e[_0x8eb9('0x25')]();};}function saveUpdates(_0x1a5570,_0x2e5258){return function(_0x11cd9c){if(_0x11cd9c){return _0x11cd9c[_0x8eb9('0x26')](_0x1a5570)[_0x8eb9('0x27')](function(_0x363abd){return _0x363abd;});}return null;};}function removeEntity(_0x565370,_0x4c3aad){return function(_0x180f48){if(_0x180f48){return _0x180f48[_0x8eb9('0x28')]()['then'](function(){_0x565370['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cea83,_0x1e80f4){return function(_0x4ab7ee){if(!_0x4ab7ee){_0x4cea83[_0x8eb9('0x19')](0x194);}return _0x4ab7ee;};}function handleError(_0x51da61,_0x20c57d){_0x20c57d=_0x20c57d||0x1f4;return function(_0x2a410){logger[_0x8eb9('0x29')](_0x2a410[_0x8eb9('0x2a')]);if(_0x2a410['name']){delete _0x2a410[_0x8eb9('0x2b')];}_0x51da61['status'](_0x20c57d)[_0x8eb9('0x2c')](_0x2a410);};}exports[_0x8eb9('0x2d')]=function(_0x432038,_0x25896c){var _0xc3896a={},_0x576421={},_0x5be067={'count':0x0,'rows':[]};var _0x132f8f=_['map'](db[_0x8eb9('0x2e')]['rawAttributes'],function(_0x382764){return{'name':_0x382764[_0x8eb9('0x2f')],'type':_0x382764[_0x8eb9('0x30')][_0x8eb9('0x31')]};});_0x576421['model']=_['map'](_0x132f8f,_0x8eb9('0x2b'));_0x576421[_0x8eb9('0x32')]=_[_0x8eb9('0x33')](_0x432038[_0x8eb9('0x32')]);_0x576421[_0x8eb9('0x34')]=_[_0x8eb9('0x35')](_0x576421[_0x8eb9('0x36')],_0x576421['query']);_0xc3896a[_0x8eb9('0x37')]=_[_0x8eb9('0x35')](_0x576421[_0x8eb9('0x36')],qs[_0x8eb9('0x38')](_0x432038['query'][_0x8eb9('0x38')]));_0xc3896a['attributes']=_0xc3896a[_0x8eb9('0x37')][_0x8eb9('0x39')]?_0xc3896a[_0x8eb9('0x37')]:_0x576421['model'];if(!_0x432038[_0x8eb9('0x32')][_0x8eb9('0x3a')]('nolimit')){_0xc3896a['limit']=qs[_0x8eb9('0x1e')](_0x432038['query']['limit']);_0xc3896a[_0x8eb9('0x20')]=qs[_0x8eb9('0x20')](_0x432038[_0x8eb9('0x32')][_0x8eb9('0x20')]);}_0xc3896a['order']=qs[_0x8eb9('0x3b')](_0x432038[_0x8eb9('0x32')][_0x8eb9('0x3b')]);_0xc3896a[_0x8eb9('0x3c')]=qs['filters'](_[_0x8eb9('0x3d')](_0x432038[_0x8eb9('0x32')],_0x576421[_0x8eb9('0x34')]),_0x132f8f);if(_0x432038[_0x8eb9('0x32')][_0x8eb9('0x3e')]){_0xc3896a[_0x8eb9('0x3c')]=_[_0x8eb9('0x3f')](_0xc3896a[_0x8eb9('0x3c')],{'$or':_[_0x8eb9('0x40')](_0x132f8f,function(_0x557a52){if(_0x557a52[_0x8eb9('0x30')]!==_0x8eb9('0x41')){var _0xaf114e={};_0xaf114e[_0x557a52[_0x8eb9('0x2b')]]={'$like':'%'+_0x432038[_0x8eb9('0x32')]['filter']+'%'};return _0xaf114e;}})});}_0xc3896a=_[_0x8eb9('0x3f')]({},_0xc3896a,_0x432038[_0x8eb9('0x42')]);var _0x4365d5={'where':_0xc3896a[_0x8eb9('0x3c')]};return db[_0x8eb9('0x2e')][_0x8eb9('0x1f')](_0x4365d5)[_0x8eb9('0x27')](function(_0x3e814e){_0x5be067[_0x8eb9('0x1f')]=_0x3e814e;if(_0x432038['query'][_0x8eb9('0x43')]){_0xc3896a[_0x8eb9('0x44')]=[{'all':!![]}];}return db[_0x8eb9('0x2e')]['findAll'](_0xc3896a);})[_0x8eb9('0x27')](function(_0x311f76){_0x5be067[_0x8eb9('0x45')]=_0x311f76;return _0x5be067;})[_0x8eb9('0x27')](respondWithFilteredResult(_0x25896c,_0xc3896a))[_0x8eb9('0x46')](handleError(_0x25896c,null));};exports['show']=function(_0x3875cd,_0xa8bf49){var _0x29be00={'raw':!![],'where':{'id':_0x3875cd[_0x8eb9('0x47')]['id']}},_0xc5e561={};_0xc5e561[_0x8eb9('0x36')]=_[_0x8eb9('0x33')](db[_0x8eb9('0x2e')][_0x8eb9('0x48')]);_0xc5e561[_0x8eb9('0x32')]=_[_0x8eb9('0x33')](_0x3875cd[_0x8eb9('0x32')]);_0xc5e561['filters']=_[_0x8eb9('0x35')](_0xc5e561['model'],_0xc5e561[_0x8eb9('0x32')]);_0x29be00[_0x8eb9('0x37')]=_[_0x8eb9('0x35')](_0xc5e561[_0x8eb9('0x36')],qs[_0x8eb9('0x38')](_0x3875cd['query'][_0x8eb9('0x38')]));_0x29be00['attributes']=_0x29be00[_0x8eb9('0x37')]['length']?_0x29be00[_0x8eb9('0x37')]:_0xc5e561[_0x8eb9('0x36')];if(_0x3875cd['query'][_0x8eb9('0x43')]){_0x29be00[_0x8eb9('0x44')]=[{'all':!![]}];}_0x29be00=_['merge']({},_0x29be00,_0x3875cd[_0x8eb9('0x42')]);return db[_0x8eb9('0x2e')][_0x8eb9('0x49')](_0x29be00)[_0x8eb9('0x27')](handleEntityNotFound(_0xa8bf49,null))[_0x8eb9('0x27')](respondWithResult(_0xa8bf49,null))[_0x8eb9('0x46')](handleError(_0xa8bf49,null));};exports[_0x8eb9('0x4a')]=function(_0x45227a,_0x2816d2){return db[_0x8eb9('0x2e')][_0x8eb9('0x4a')](_0x45227a[_0x8eb9('0x4b')],{})[_0x8eb9('0x27')](respondWithResult(_0x2816d2,0xc9))[_0x8eb9('0x46')](handleError(_0x2816d2,null));};exports[_0x8eb9('0x26')]=function(_0x2653a1,_0x1d140a){if(_0x2653a1[_0x8eb9('0x4b')]['id']){delete _0x2653a1[_0x8eb9('0x4b')]['id'];}return db['DeskField'][_0x8eb9('0x49')]({'where':{'id':_0x2653a1[_0x8eb9('0x47')]['id']}})[_0x8eb9('0x27')](handleEntityNotFound(_0x1d140a,null))[_0x8eb9('0x27')](saveUpdates(_0x2653a1['body'],null))['then'](respondWithResult(_0x1d140a,null))['catch'](handleError(_0x1d140a,null));};exports['destroy']=function(_0x4187be,_0x4ec711){return db[_0x8eb9('0x2e')][_0x8eb9('0x49')]({'where':{'id':_0x4187be['params']['id']}})[_0x8eb9('0x27')](handleEntityNotFound(_0x4ec711,null))[_0x8eb9('0x27')](removeEntity(_0x4ec711,null))[_0x8eb9('0x46')](handleError(_0x4ec711,null));}; \ No newline at end of file +var _0x29af=['merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0x29af,0x134));var _0xf29a=function(_0x4bc346,_0x32aa26){_0x4bc346=_0x4bc346-0x0;var _0x5277db=_0x29af[_0x4bc346];return _0x5277db;};'use strict';var emlformat=require(_0xf29a('0x0'));var rimraf=require(_0xf29a('0x1'));var zipdir=require(_0xf29a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf29a('0x3'));var moment=require(_0xf29a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf29a('0x5'));var util=require('util');var path=require(_0xf29a('0x6'));var sox=require(_0xf29a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf29a('0x8'));var _=require(_0xf29a('0x9'));var squel=require(_0xf29a('0xa'));var crypto=require(_0xf29a('0xb'));var jsforce=require(_0xf29a('0xc'));var deskjs=require(_0xf29a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf29a('0xe'));var Papa=require(_0xf29a('0xf'));var Redis=require(_0xf29a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf29a('0x11'));var hardwareService=require(_0xf29a('0x12'));var logger=require(_0xf29a('0x13'))(_0xf29a('0x14'));var utils=require(_0xf29a('0x15'));var config=require(_0xf29a('0x16'));var licenseUtil=require(_0xf29a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x446d4a,_0x19aa54){_0x19aa54=_0x19aa54||0xcc;return function(_0x23db30){if(_0x23db30){return _0x446d4a[_0xf29a('0x18')](_0x19aa54);}return _0x446d4a[_0xf29a('0x19')](_0x19aa54)[_0xf29a('0x1a')]();};}function respondWithResult(_0x3af6e8,_0x4de143){_0x4de143=_0x4de143||0xc8;return function(_0x4fc117){if(_0x4fc117){return _0x3af6e8['status'](_0x4de143)[_0xf29a('0x1b')](_0x4fc117);}};}function respondWithFilteredResult(_0x38dd20,_0x19de15){return function(_0x16913b){if(_0x16913b){var _0x17faf4=typeof _0x19de15['offset']===_0xf29a('0x1c')&&typeof _0x19de15[_0xf29a('0x1d')]===_0xf29a('0x1c');var _0x283fe5=_0x16913b[_0xf29a('0x1e')];var _0xd4ca39=_0x17faf4?0x0:_0x19de15[_0xf29a('0x1f')];var _0x296829=_0x17faf4?_0x16913b[_0xf29a('0x1e')]:_0x19de15[_0xf29a('0x1f')]+_0x19de15['limit'];var _0x474e1f;if(_0x296829>=_0x283fe5){_0x296829=_0x283fe5;_0x474e1f=0xc8;}else{_0x474e1f=0xce;}_0x38dd20[_0xf29a('0x19')](_0x474e1f);return _0x38dd20['set'](_0xf29a('0x20'),_0xd4ca39+'-'+_0x296829+'/'+_0x283fe5)[_0xf29a('0x1b')](_0x16913b);}return null;};}function patchUpdates(_0x191534){return function(_0x5c9395){try{jsonpatch[_0xf29a('0x21')](_0x5c9395,_0x191534,!![]);}catch(_0x560b73){return BPromise[_0xf29a('0x22')](_0x560b73);}return _0x5c9395[_0xf29a('0x23')]();};}function saveUpdates(_0x7bc34e,_0x1c3187){return function(_0x4d557c){if(_0x4d557c){return _0x4d557c[_0xf29a('0x24')](_0x7bc34e)[_0xf29a('0x25')](function(_0x43ce76){return _0x43ce76;});}return null;};}function removeEntity(_0xc0484c,_0x35af39){return function(_0x162538){if(_0x162538){return _0x162538[_0xf29a('0x26')]()['then'](function(){_0xc0484c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a5f,_0x4b610c){return function(_0x3635a6){if(!_0x3635a6){_0x262a5f[_0xf29a('0x18')](0x194);}return _0x3635a6;};}function handleError(_0x45a396,_0x5aee4a){_0x5aee4a=_0x5aee4a||0x1f4;return function(_0x181c3a){logger[_0xf29a('0x27')](_0x181c3a[_0xf29a('0x28')]);if(_0x181c3a[_0xf29a('0x29')]){delete _0x181c3a[_0xf29a('0x29')];}_0x45a396[_0xf29a('0x19')](_0x5aee4a)['send'](_0x181c3a);};}exports[_0xf29a('0x2a')]=function(_0x43b4ab,_0x524c16){var _0x4b7e38={},_0x4fdd1b={},_0x2707ef={'count':0x0,'rows':[]};var _0x2dfe2a=_[_0xf29a('0x2b')](db[_0xf29a('0x2c')][_0xf29a('0x2d')],function(_0x1a3c70){return{'name':_0x1a3c70[_0xf29a('0x2e')],'type':_0x1a3c70['type'][_0xf29a('0x2f')]};});_0x4fdd1b[_0xf29a('0x30')]=_[_0xf29a('0x2b')](_0x2dfe2a,_0xf29a('0x29'));_0x4fdd1b[_0xf29a('0x31')]=_[_0xf29a('0x32')](_0x43b4ab[_0xf29a('0x31')]);_0x4fdd1b['filters']=_[_0xf29a('0x33')](_0x4fdd1b['model'],_0x4fdd1b[_0xf29a('0x31')]);_0x4b7e38[_0xf29a('0x34')]=_[_0xf29a('0x33')](_0x4fdd1b[_0xf29a('0x30')],qs[_0xf29a('0x35')](_0x43b4ab['query'][_0xf29a('0x35')]));_0x4b7e38['attributes']=_0x4b7e38[_0xf29a('0x34')][_0xf29a('0x36')]?_0x4b7e38['attributes']:_0x4fdd1b[_0xf29a('0x30')];if(!_0x43b4ab[_0xf29a('0x31')]['hasOwnProperty'](_0xf29a('0x37'))){_0x4b7e38[_0xf29a('0x1d')]=qs[_0xf29a('0x1d')](_0x43b4ab[_0xf29a('0x31')][_0xf29a('0x1d')]);_0x4b7e38[_0xf29a('0x1f')]=qs['offset'](_0x43b4ab[_0xf29a('0x31')][_0xf29a('0x1f')]);}_0x4b7e38[_0xf29a('0x38')]=qs['sort'](_0x43b4ab[_0xf29a('0x31')][_0xf29a('0x39')]);_0x4b7e38[_0xf29a('0x3a')]=qs[_0xf29a('0x3b')](_[_0xf29a('0x3c')](_0x43b4ab[_0xf29a('0x31')],_0x4fdd1b[_0xf29a('0x3b')]),_0x2dfe2a);if(_0x43b4ab[_0xf29a('0x31')][_0xf29a('0x3d')]){_0x4b7e38[_0xf29a('0x3a')]=_[_0xf29a('0x3e')](_0x4b7e38[_0xf29a('0x3a')],{'$or':_['map'](_0x2dfe2a,function(_0x4d3ddb){if(_0x4d3ddb[_0xf29a('0x3f')]!==_0xf29a('0x40')){var _0x27243d={};_0x27243d[_0x4d3ddb['name']]={'$like':'%'+_0x43b4ab[_0xf29a('0x31')][_0xf29a('0x3d')]+'%'};return _0x27243d;}})});}_0x4b7e38=_[_0xf29a('0x3e')]({},_0x4b7e38,_0x43b4ab[_0xf29a('0x41')]);var _0x18d95d={'where':_0x4b7e38[_0xf29a('0x3a')]};return db[_0xf29a('0x2c')][_0xf29a('0x1e')](_0x18d95d)[_0xf29a('0x25')](function(_0x56e9f3){_0x2707ef[_0xf29a('0x1e')]=_0x56e9f3;if(_0x43b4ab['query'][_0xf29a('0x42')]){_0x4b7e38['include']=[{'all':!![]}];}return db[_0xf29a('0x2c')][_0xf29a('0x43')](_0x4b7e38);})['then'](function(_0x492d41){_0x2707ef['rows']=_0x492d41;return _0x2707ef;})[_0xf29a('0x25')](respondWithFilteredResult(_0x524c16,_0x4b7e38))[_0xf29a('0x44')](handleError(_0x524c16,null));};exports[_0xf29a('0x45')]=function(_0xe8375d,_0x41aa32){var _0x548345={'raw':!![],'where':{'id':_0xe8375d[_0xf29a('0x46')]['id']}},_0x19d031={};_0x19d031[_0xf29a('0x30')]=_[_0xf29a('0x32')](db['DeskField'][_0xf29a('0x2d')]);_0x19d031[_0xf29a('0x31')]=_[_0xf29a('0x32')](_0xe8375d[_0xf29a('0x31')]);_0x19d031[_0xf29a('0x3b')]=_[_0xf29a('0x33')](_0x19d031[_0xf29a('0x30')],_0x19d031[_0xf29a('0x31')]);_0x548345[_0xf29a('0x34')]=_[_0xf29a('0x33')](_0x19d031[_0xf29a('0x30')],qs[_0xf29a('0x35')](_0xe8375d[_0xf29a('0x31')][_0xf29a('0x35')]));_0x548345[_0xf29a('0x34')]=_0x548345[_0xf29a('0x34')][_0xf29a('0x36')]?_0x548345[_0xf29a('0x34')]:_0x19d031[_0xf29a('0x30')];if(_0xe8375d[_0xf29a('0x31')]['includeAll']){_0x548345['include']=[{'all':!![]}];}_0x548345=_[_0xf29a('0x3e')]({},_0x548345,_0xe8375d[_0xf29a('0x41')]);return db[_0xf29a('0x2c')][_0xf29a('0x47')](_0x548345)[_0xf29a('0x25')](handleEntityNotFound(_0x41aa32,null))[_0xf29a('0x25')](respondWithResult(_0x41aa32,null))[_0xf29a('0x44')](handleError(_0x41aa32,null));};exports[_0xf29a('0x48')]=function(_0x1cf705,_0x3a892c){return db[_0xf29a('0x2c')][_0xf29a('0x48')](_0x1cf705[_0xf29a('0x49')],{})[_0xf29a('0x25')](respondWithResult(_0x3a892c,0xc9))[_0xf29a('0x44')](handleError(_0x3a892c,null));};exports[_0xf29a('0x24')]=function(_0x2ec29f,_0x2ba2f0){if(_0x2ec29f[_0xf29a('0x49')]['id']){delete _0x2ec29f[_0xf29a('0x49')]['id'];}return db[_0xf29a('0x2c')][_0xf29a('0x47')]({'where':{'id':_0x2ec29f['params']['id']}})[_0xf29a('0x25')](handleEntityNotFound(_0x2ba2f0,null))[_0xf29a('0x25')](saveUpdates(_0x2ec29f[_0xf29a('0x49')],null))[_0xf29a('0x25')](respondWithResult(_0x2ba2f0,null))[_0xf29a('0x44')](handleError(_0x2ba2f0,null));};exports['destroy']=function(_0x348e3f,_0x1f8e53){return db[_0xf29a('0x2c')]['find']({'where':{'id':_0x348e3f['params']['id']}})['then'](handleEntityNotFound(_0x1f8e53,null))[_0xf29a('0x25')](removeEntity(_0x1f8e53,null))[_0xf29a('0x44')](handleError(_0x1f8e53,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index fb031c5..8b183d6 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 _0x2d0d=['define','int_desk_fields','desk_unique_index','FieldId','util','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports'];(function(_0x30a6f4,_0x36ec40){var _0x2b3a92=function(_0x5cbccc){while(--_0x5cbccc){_0x30a6f4['push'](_0x30a6f4['shift']());}};_0x2b3a92(++_0x36ec40);}(_0x2d0d,0x1f2));var _0xd2d0=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x2d0d[_0x55fa03];return _0x2cd7cd;};'use strict';var _=require('lodash');var util=require(_0xd2d0('0x0'));var logger=require('../../config/logger')(_0xd2d0('0x1'));var moment=require(_0xd2d0('0x2'));var BPromise=require(_0xd2d0('0x3'));var rp=require(_0xd2d0('0x4'));var fs=require('fs');var path=require(_0xd2d0('0x5'));var rimraf=require('rimraf');var config=require(_0xd2d0('0x6'));var attributes=require(_0xd2d0('0x7'));module[_0xd2d0('0x8')]=function(_0x1beaa0,_0x41b5e9){return _0x1beaa0[_0xd2d0('0x9')]('DeskField',attributes,{'tableName':_0xd2d0('0xa'),'paranoid':![],'indexes':[{'name':_0xd2d0('0xb'),'fields':['idField',_0xd2d0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8262=['api','request-promise','path','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x55abcb,_0x1c8ce0){var _0x10b891=function(_0x2d58cd){while(--_0x2d58cd){_0x55abcb['push'](_0x55abcb['shift']());}};_0x10b891(++_0x1c8ce0);}(_0x8262,0x176));var _0x2826=function(_0x5272a9,_0x4efdfc){_0x5272a9=_0x5272a9-0x0;var _0xa7a812=_0x8262[_0x5272a9];return _0xa7a812;};'use strict';var _=require(_0x2826('0x0'));var util=require(_0x2826('0x1'));var logger=require(_0x2826('0x2'))(_0x2826('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2826('0x4'));var fs=require('fs');var path=require(_0x2826('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2826('0x6'));module[_0x2826('0x7')]=function(_0x4ff12a,_0x58ca8f){return _0x4ff12a[_0x2826('0x8')](_0x2826('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x2826('0xa'),'fields':[_0x2826('0xb'),_0x2826('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 c12c0a7..86e0953 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 _0xeded=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message'];(function(_0x430524,_0x23b611){var _0x3a726d=function(_0x5cc39d){while(--_0x5cc39d){_0x430524['push'](_0x430524['shift']());}};_0x3a726d(++_0x23b611);}(_0xeded,0x128));var _0xdede=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeded[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdede('0x0'));var util=require(_0xdede('0x1'));var moment=require('moment');var BPromise=require(_0xdede('0x2'));var rs=require(_0xdede('0x3'));var fs=require('fs');var Redis=require(_0xdede('0x4'));var db=require(_0xdede('0x5'))['db'];var utils=require(_0xdede('0x6'));var logger=require(_0xdede('0x7'))(_0xdede('0x8'));var config=require(_0xdede('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdede('0xa')][_0xdede('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c694f,_0x54eef7,_0x45798f){return new BPromise(function(_0x3da2af,_0x32c7fb){return client['request'](_0x1c694f,_0x45798f)['then'](function(_0x5097e5){logger['info'](_0xdede('0xc'),_0x54eef7,'request\x20sent');logger[_0xdede('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x54eef7,_0xdede('0xe'),JSON[_0xdede('0xf')](_0x5097e5));if(_0x5097e5['error']){if(_0x5097e5['error'][_0xdede('0x10')]===0x1f4){logger[_0xdede('0x11')]('DeskField,\x20%s,\x20%s',_0x54eef7,_0x5097e5[_0xdede('0x11')][_0xdede('0x12')]);return _0x32c7fb(_0x5097e5[_0xdede('0x11')]['message']);}logger['error'](_0xdede('0xc'),_0x54eef7,_0x5097e5[_0xdede('0x11')]['message']);return _0x3da2af(_0x5097e5['error'][_0xdede('0x12')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x54eef7,'request\x20sent');_0x3da2af(_0x5097e5[_0xdede('0x13')][_0xdede('0x12')]);}})[_0xdede('0x14')](function(_0x1f6872){logger[_0xdede('0x11')](_0xdede('0xc'),_0x54eef7,_0x1f6872);_0x32c7fb(_0x1f6872);});});} \ No newline at end of file +var _0x83ac=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46c93e,_0x51e179){var _0x1fbd53=function(_0x5e710a){while(--_0x5e710a){_0x46c93e['push'](_0x46c93e['shift']());}};_0x1fbd53(++_0x51e179);}(_0x83ac,0x13b));var _0xc83a=function(_0x58cb7f,_0x381869){_0x58cb7f=_0x58cb7f-0x0;var _0x4076dc=_0x83ac[_0x58cb7f];return _0x4076dc;};'use strict';var _=require('lodash');var util=require(_0xc83a('0x0'));var moment=require(_0xc83a('0x1'));var BPromise=require(_0xc83a('0x2'));var rs=require(_0xc83a('0x3'));var fs=require('fs');var Redis=require(_0xc83a('0x4'));var db=require(_0xc83a('0x5'))['db'];var utils=require(_0xc83a('0x6'));var logger=require(_0xc83a('0x7'))('rpc');var config=require(_0xc83a('0x8'));var jayson=require(_0xc83a('0x9'));var client=jayson[_0xc83a('0xa')][_0xc83a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b347f,_0x5f618b,_0x3fcf5f){return new BPromise(function(_0x37ef9f,_0x266588){return client['request'](_0x1b347f,_0x3fcf5f)[_0xc83a('0xc')](function(_0x8cbf2b){logger[_0xc83a('0xd')](_0xc83a('0xe'),_0x5f618b,'request\x20sent');logger['debug'](_0xc83a('0xf'),_0x5f618b,_0xc83a('0x10'),JSON[_0xc83a('0x11')](_0x8cbf2b));if(_0x8cbf2b[_0xc83a('0x12')]){if(_0x8cbf2b[_0xc83a('0x12')][_0xc83a('0x13')]===0x1f4){logger[_0xc83a('0x12')](_0xc83a('0xe'),_0x5f618b,_0x8cbf2b['error'][_0xc83a('0x14')]);return _0x266588(_0x8cbf2b[_0xc83a('0x12')][_0xc83a('0x14')]);}logger[_0xc83a('0x12')](_0xc83a('0xe'),_0x5f618b,_0x8cbf2b[_0xc83a('0x12')][_0xc83a('0x14')]);return _0x37ef9f(_0x8cbf2b[_0xc83a('0x12')][_0xc83a('0x14')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x5f618b,_0xc83a('0x10'));_0x37ef9f(_0x8cbf2b[_0xc83a('0x15')][_0xc83a('0x14')]);}})[_0xc83a('0x16')](function(_0x495008){logger['error'](_0xc83a('0xe'),_0x5f618b,_0x495008);_0x266588(_0x495008);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 531e0af..a289c85 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 _0x3e0a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports','path','connect-timeout','express'];(function(_0x29beb6,_0x282503){var _0xcfac88=function(_0x97222e){while(--_0x97222e){_0x29beb6['push'](_0x29beb6['shift']());}};_0xcfac88(++_0x282503);}(_0x3e0a,0x18c));var _0xa3e0=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x3e0a[_0x38a3d6];return _0x3768d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3e0('0x0'));var timeout=require(_0xa3e0('0x1'));var express=require(_0xa3e0('0x2'));var router=express[_0xa3e0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa3e0('0x4'));var interaction=require(_0xa3e0('0x5'));var config=require(_0xa3e0('0x6'));var controller=require(_0xa3e0('0x7'));router[_0xa3e0('0x8')]('/',auth[_0xa3e0('0x9')](),controller[_0xa3e0('0xa')]);router['get'](_0xa3e0('0xb'),auth[_0xa3e0('0x9')](),controller['show']);router[_0xa3e0('0x8')](_0xa3e0('0xc'),auth[_0xa3e0('0x9')](),controller[_0xa3e0('0xd')]);router['get']('/:id/fields',auth[_0xa3e0('0x9')](),controller[_0xa3e0('0xe')]);router[_0xa3e0('0xf')]('/',auth[_0xa3e0('0x9')](),controller[_0xa3e0('0x10')]);router[_0xa3e0('0xf')](_0xa3e0('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa3e0('0x11')](_0xa3e0('0xb'),auth[_0xa3e0('0x9')](),controller[_0xa3e0('0x12')]);router['delete'](_0xa3e0('0xb'),auth['isAuthenticated'](),controller[_0xa3e0('0x13')]);module[_0xa3e0('0x14')]=router; \ No newline at end of file +var _0xf5ef=['/:id/fields','getFields','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x3140a9,_0x4a71a2){var _0x410664=function(_0x531c07){while(--_0x531c07){_0x3140a9['push'](_0x3140a9['shift']());}};_0x410664(++_0x4a71a2);}(_0xf5ef,0xcd));var _0xff5e=function(_0x4d3b3c,_0x4263d8){_0x4d3b3c=_0x4d3b3c-0x0;var _0x404715=_0xf5ef[_0x4d3b3c];return _0x404715;};'use strict';var multer=require(_0xff5e('0x0'));var util=require(_0xff5e('0x1'));var path=require(_0xff5e('0x2'));var timeout=require(_0xff5e('0x3'));var express=require(_0xff5e('0x4'));var router=express[_0xff5e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xff5e('0x6'));var interaction=require(_0xff5e('0x7'));var config=require(_0xff5e('0x8'));var controller=require('./intDynamics365Account.controller');router[_0xff5e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff5e('0x9')](_0xff5e('0xa'),auth[_0xff5e('0xb')](),controller[_0xff5e('0xc')]);router['get'](_0xff5e('0xd'),auth[_0xff5e('0xb')](),controller[_0xff5e('0xe')]);router[_0xff5e('0x9')](_0xff5e('0xf'),auth[_0xff5e('0xb')](),controller[_0xff5e('0x10')]);router['post']('/',auth[_0xff5e('0xb')](),controller[_0xff5e('0x11')]);router['post'](_0xff5e('0xd'),auth[_0xff5e('0xb')](),controller['addConfiguration']);router[_0xff5e('0x12')](_0xff5e('0xa'),auth[_0xff5e('0xb')](),controller[_0xff5e('0x13')]);router[_0xff5e('0x14')]('/:id',auth[_0xff5e('0xb')](),controller[_0xff5e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3b00cc0..657a8b3 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 _0x2b83=['STRING','exports'];(function(_0x4e2eea,_0x3781b8){var _0x3973b3=function(_0x4f11be){while(--_0x4f11be){_0x4e2eea['push'](_0x4e2eea['shift']());}};_0x3973b3(++_0x3781b8);}(_0x2b83,0x1d3));var _0x32b8=function(_0x3fcf38,_0x521826){_0x3fcf38=_0x3fcf38-0x0;var _0xd7594=_0x2b83[_0x3fcf38];return _0xd7594;};'use strict';var Sequelize=require('sequelize');module[_0x32b8('0x0')]={'name':{'type':Sequelize[_0x32b8('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x32b8('0x1')]},'remoteUri':{'type':Sequelize[_0x32b8('0x1')]},'tenantId':{'type':Sequelize[_0x32b8('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x32b8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x32b8('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xdb94=['STRING','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb94,0xe5));var _0x4db9=function(_0x137167,_0x201304){_0x137167=_0x137167-0x0;var _0x14c105=_0xdb94[_0x137167];return _0x14c105;};'use strict';var Sequelize=require('sequelize');module[_0x4db9('0x0')]={'name':{'type':Sequelize[_0x4db9('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4db9('0x1')]},'remoteUri':{'type':Sequelize[_0x4db9('0x1')]},'tenantId':{'type':Sequelize[_0x4db9('0x1')]},'clientId':{'type':Sequelize[_0x4db9('0x1')]},'clientSecret':{'type':Sequelize[_0x4db9('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4db9('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 5c4fa01..c9b6608 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 _0x954f=['LogicalName','@odata.type','PicklistAttributeMetadata','all','forEach','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','util','lodash','../../components/parsers/qs','api','status','offset','limit','undefined','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','destroy','findOne','Dynamics365Configuration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','remove','includes'];(function(_0x33250d,_0x39efc1){var _0x1ea1f4=function(_0x3a5bfb){while(--_0x3a5bfb){_0x33250d['push'](_0x33250d['shift']());}};_0x1ea1f4(++_0x39efc1);}(_0x954f,0xdc));var _0xf954=function(_0xd351b8,_0x410fa3){_0xd351b8=_0xd351b8-0x0;var _0x3f8a1c=_0x954f[_0xd351b8];return _0x3f8a1c;};'use strict';var rp=require('request-promise');var util=require(_0xf954('0x0'));var _=require(_0xf954('0x1'));var qs=require(_0xf954('0x2'));var logger=require('../../config/logger')(_0xf954('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x34973c,_0x1ca836){_0x1ca836=_0x1ca836||0xc8;return function(_0x27b1e9){if(_0x27b1e9){return _0x34973c[_0xf954('0x4')](_0x1ca836)['json'](_0x27b1e9);}};}function respondWithFilteredResult(_0x5d64d1,_0x479a3f){return function(_0x5270aa){if(_0x5270aa){var _0x55326d=typeof _0x479a3f[_0xf954('0x5')]==='undefined'&&typeof _0x479a3f[_0xf954('0x6')]===_0xf954('0x7');var _0x28a306=_0x5270aa[_0xf954('0x8')];var _0x480d24=_0x55326d?0x0:_0x479a3f['offset'];var _0x4f39c3=_0x55326d?_0x5270aa[_0xf954('0x8')]:_0x479a3f['offset']+_0x479a3f[_0xf954('0x6')];var _0x39440f;if(_0x4f39c3>=_0x28a306){_0x4f39c3=_0x28a306;_0x39440f=0xc8;}else{_0x39440f=0xce;}_0x5d64d1['status'](_0x39440f);return _0x5d64d1[_0xf954('0x9')](_0xf954('0xa'),_0x480d24+'-'+_0x4f39c3+'/'+_0x28a306)['json'](_0x5270aa);}return null;};}function saveUpdates(_0x57356b){return function(_0x61cdf2){if(_0x61cdf2){return _0x61cdf2[_0xf954('0xb')](_0x57356b)['then'](function(_0x4b45f8){return _0x4b45f8;});}return null;};}function removeEntity(_0x448633){return function(_0x2c2907){if(_0x2c2907){return _0x2c2907['destroy']()[_0xf954('0xc')](function(){_0x448633['status'](0xcc)[_0xf954('0xd')]();});}};}function handleEntityNotFound(_0x435bcc){return function(_0x5693eb){if(!_0x5693eb){_0x435bcc[_0xf954('0xe')](0x194);}return _0x5693eb;};}function handleError(_0x2fcfc8,_0x38d3f3){_0x38d3f3=_0x38d3f3||0x1f4;return function(_0x1b29a5){logger[_0xf954('0xf')](_0x1b29a5[_0xf954('0x10')]);if(_0x1b29a5[_0xf954('0x11')]){delete _0x1b29a5[_0xf954('0x11')];}_0x2fcfc8[_0xf954('0x4')](_0x38d3f3)[_0xf954('0x12')](_0x1b29a5);};}exports[_0xf954('0x13')]=function(_0x5a1c35,_0x1eda66){var _0x1b1854={},_0x40d987={},_0x45634b={'count':0x0,'rows':[]};var _0x36597c=_[_0xf954('0x14')](db[_0xf954('0x15')][_0xf954('0x16')],function(_0x4c8b7e){return{'name':_0x4c8b7e['fieldName'],'type':_0x4c8b7e[_0xf954('0x17')][_0xf954('0x18')]};});_0x40d987[_0xf954('0x19')]=_['map'](_0x36597c,_0xf954('0x11'));_0x40d987[_0xf954('0x1a')]=_[_0xf954('0x1b')](_0x5a1c35['query']);_0x40d987[_0xf954('0x1c')]=_['intersection'](_0x40d987['model'],_0x40d987[_0xf954('0x1a')]);_0x1b1854['attributes']=_[_0xf954('0x1d')](_0x40d987[_0xf954('0x19')],qs['fields'](_0x5a1c35[_0xf954('0x1a')]['fields']));_0x1b1854['attributes']=_0x1b1854[_0xf954('0x1e')][_0xf954('0x1f')]?_0x1b1854[_0xf954('0x1e')]:_0x40d987[_0xf954('0x19')];if(!_0x5a1c35[_0xf954('0x1a')]['hasOwnProperty'](_0xf954('0x20'))){_0x1b1854[_0xf954('0x6')]=qs['limit'](_0x5a1c35[_0xf954('0x1a')][_0xf954('0x6')]);_0x1b1854[_0xf954('0x5')]=qs['offset'](_0x5a1c35['query'][_0xf954('0x5')]);}_0x1b1854[_0xf954('0x21')]=qs[_0xf954('0x22')](_0x5a1c35['query'][_0xf954('0x22')]);_0x1b1854[_0xf954('0x23')]=qs[_0xf954('0x1c')](_[_0xf954('0x24')](_0x5a1c35[_0xf954('0x1a')],_0x40d987[_0xf954('0x1c')]),_0x36597c);if(_0x5a1c35[_0xf954('0x1a')][_0xf954('0x25')]){_0x1b1854['where']=_[_0xf954('0x26')](_0x1b1854[_0xf954('0x23')],{'$or':_[_0xf954('0x14')](_0x36597c,function(_0x32dbfc){if(_0x32dbfc[_0xf954('0x17')]!==_0xf954('0x27')){var _0x4611fe={};_0x4611fe[_0x32dbfc[_0xf954('0x11')]]={'$like':'%'+_0x5a1c35['query']['filter']+'%'};return _0x4611fe;}})});}_0x1b1854=_[_0xf954('0x26')]({},_0x1b1854,_0x5a1c35[_0xf954('0x28')]);var _0x5f3d1b={'where':_0x1b1854['where']};return db['Dynamics365Account'][_0xf954('0x8')](_0x5f3d1b)[_0xf954('0xc')](function(_0x25c44a){_0x45634b[_0xf954('0x8')]=_0x25c44a;if(_0x5a1c35[_0xf954('0x1a')][_0xf954('0x29')]){_0x1b1854[_0xf954('0x2a')]=[{'all':!![]}];}return db[_0xf954('0x15')][_0xf954('0x2b')](_0x1b1854);})[_0xf954('0xc')](function(_0x3d1902){_0x45634b[_0xf954('0x2c')]=_0x3d1902;return _0x45634b;})[_0xf954('0xc')](respondWithFilteredResult(_0x1eda66,_0x1b1854))[_0xf954('0x2d')](handleError(_0x1eda66,null));};exports[_0xf954('0x2e')]=function(_0x445a87,_0x52b4bf){var _0xf3a44d={'raw':![],'where':{'id':_0x445a87[_0xf954('0x2f')]['id']}},_0x1e26fc={};_0x1e26fc[_0xf954('0x19')]=_[_0xf954('0x1b')](db[_0xf954('0x15')][_0xf954('0x16')]);_0x1e26fc[_0xf954('0x1a')]=_['keys'](_0x445a87['query']);_0x1e26fc[_0xf954('0x1c')]=_[_0xf954('0x1d')](_0x1e26fc['model'],_0x1e26fc['query']);_0xf3a44d['attributes']=_[_0xf954('0x1d')](_0x1e26fc[_0xf954('0x19')],qs['fields'](_0x445a87[_0xf954('0x1a')][_0xf954('0x30')]));_0xf3a44d['attributes']=_0xf3a44d[_0xf954('0x1e')][_0xf954('0x1f')]?_0xf3a44d[_0xf954('0x1e')]:_0x1e26fc['model'];if(_0x445a87[_0xf954('0x1a')][_0xf954('0x29')]){_0xf3a44d['include']=[{'all':!![]}];}_0xf3a44d=_[_0xf954('0x26')]({},_0xf3a44d,_0x445a87['options']);return db[_0xf954('0x15')]['find'](_0xf3a44d)['then'](handleEntityNotFound(_0x52b4bf,null))[_0xf954('0xc')](respondWithResult(_0x52b4bf,null))[_0xf954('0x2d')](handleError(_0x52b4bf,null));};exports[_0xf954('0x31')]=function(_0x4e4569,_0x2010c9){return db[_0xf954('0x15')][_0xf954('0x31')](_0x4e4569[_0xf954('0x32')],{})[_0xf954('0xc')](respondWithResult(_0x2010c9,0xc9))[_0xf954('0x2d')](handleError(_0x2010c9,null));};exports[_0xf954('0xb')]=function(_0x30b451,_0x2f6952){if(_0x30b451[_0xf954('0x32')]['id']){delete _0x30b451['body']['id'];}return db[_0xf954('0x15')][_0xf954('0x33')]({'where':{'id':_0x30b451[_0xf954('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f6952,null))[_0xf954('0xc')](saveUpdates(_0x30b451['body'],null))[_0xf954('0xc')](respondWithResult(_0x2f6952,null))['catch'](handleError(_0x2f6952,null));};exports[_0xf954('0x34')]=function(_0x3a7f0f,_0x5edb7c){return db[_0xf954('0x15')][_0xf954('0x33')]({'where':{'id':_0x3a7f0f[_0xf954('0x2f')]['id']}})[_0xf954('0xc')](handleEntityNotFound(_0x5edb7c,null))[_0xf954('0xc')](removeEntity(_0x5edb7c,null))['catch'](handleError(_0x5edb7c,null));};exports['getConfigurations']=function(_0x17f271,_0x296f9a){var _0x259b25={};var _0x1b4f37={};var _0x3a23fd;var _0x325331;return db[_0xf954('0x15')][_0xf954('0x35')]({'where':{'id':_0x17f271[_0xf954('0x2f')]['id']}})[_0xf954('0xc')](handleEntityNotFound(_0x296f9a,null))[_0xf954('0xc')](function(_0x16f083){if(_0x16f083){_0x3a23fd=_0x16f083;_0x1b4f37[_0xf954('0x19')]=_[_0xf954('0x1b')](db[_0xf954('0x36')]['rawAttributes']);_0x1b4f37[_0xf954('0x1a')]=_[_0xf954('0x1b')](_0x17f271[_0xf954('0x1a')]);_0x1b4f37[_0xf954('0x1c')]=_[_0xf954('0x1d')](_0x1b4f37[_0xf954('0x19')],_0x1b4f37[_0xf954('0x1a')]);_0x259b25['attributes']=_[_0xf954('0x1d')](_0x1b4f37[_0xf954('0x19')],qs[_0xf954('0x30')](_0x17f271[_0xf954('0x1a')][_0xf954('0x30')]));_0x259b25['attributes']=_0x259b25[_0xf954('0x1e')][_0xf954('0x1f')]?_0x259b25[_0xf954('0x1e')]:_0x1b4f37[_0xf954('0x19')];_0x259b25['order']=qs['sort'](_0x17f271[_0xf954('0x1a')]['sort']);_0x259b25[_0xf954('0x23')]=qs[_0xf954('0x1c')](_[_0xf954('0x24')](_0x17f271[_0xf954('0x1a')],_0x1b4f37[_0xf954('0x1c')]));if(_0x17f271[_0xf954('0x1a')][_0xf954('0x25')]){_0x259b25[_0xf954('0x23')]=_['merge'](_0x259b25[_0xf954('0x23')],{'$or':_['map'](_0x259b25[_0xf954('0x1e')],function(_0x186ee6){var _0x250459={};_0x250459[_0x186ee6]={'$like':'%'+_0x17f271[_0xf954('0x1a')]['filter']+'%'};return _0x250459;})});}_0x259b25=_[_0xf954('0x26')]({},_0x259b25,_0x17f271[_0xf954('0x28')]);return _0x3a23fd[_0xf954('0x37')](_0x259b25);}})[_0xf954('0xc')](function(_0x4f16da){if(_0x4f16da){_0x325331=_0x4f16da['length'];if(!_0x17f271[_0xf954('0x1a')]['hasOwnProperty']('nolimit')){_0x259b25['limit']=qs[_0xf954('0x6')](_0x17f271['query'][_0xf954('0x6')]);_0x259b25['offset']=qs[_0xf954('0x5')](_0x17f271[_0xf954('0x1a')]['offset']);}return _0x3a23fd['getConfigurations'](_0x259b25);}})[_0xf954('0xc')](function(_0x3e602d){if(_0x3e602d){return _0x3e602d?{'count':_0x325331,'rows':_0x3e602d}:null;}})[_0xf954('0xc')](respondWithResult(_0x296f9a,null))[_0xf954('0x2d')](handleError(_0x296f9a,null));};exports['addConfiguration']=function(_0x3ce863,_0x15bdfb){if(_0x3ce863['body']['id']){delete _0x3ce863[_0xf954('0x32')]['id'];}return db[_0xf954('0x15')][_0xf954('0x35')]({'where':{'id':_0x3ce863[_0xf954('0x2f')]['id']}})[_0xf954('0xc')](handleEntityNotFound(_0x15bdfb,null))[_0xf954('0xc')](function(_0x50d014){if(_0x50d014){_0x3ce863['body'][_0xf954('0x38')]=_0x50d014['id'];_0x3ce863[_0xf954('0x32')][_0xf954('0x39')]=integrations[_0xf954('0x3a')](_0x3ce863[_0xf954('0x32')][_0xf954('0x3b')],_0x3ce863[_0xf954('0x32')][_0xf954('0x17')]);_0x3ce863[_0xf954('0x32')][_0xf954('0x3c')]=integrations[_0xf954('0x3d')](_0x3ce863[_0xf954('0x32')][_0xf954('0x3b')],_0x3ce863[_0xf954('0x32')][_0xf954('0x17')]);return db[_0xf954('0x36')][_0xf954('0x31')](_0x3ce863[_0xf954('0x32')],{'include':[{'model':db[_0xf954('0x3e')],'as':_0xf954('0x39')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xf954('0xc')](respondWithResult(_0x15bdfb,null))[_0xf954('0x2d')](handleError(_0x15bdfb,null));};function sanitizeRemoteUri(_0x582610){var _0x1d3341=_0x582610[_0xf954('0x3f')](-0x1);if(_0x1d3341==='/')return _0x582610[_0xf954('0x40')](0x0,_0x582610[_0xf954('0x41')](_0x1d3341));return _0x582610;}function getWebApiUrl(_0x42abd5){return util[_0xf954('0x42')](_0xf954('0x43'),_0x42abd5);}exports[_0xf954('0x44')]=function(_0x4efd56,_0x246a81){var _0x26ac18=_0x4efd56[_0xf954('0x1a')][_0xf954('0x45')];var _0x5511fc=_0x26ac18==='incident'?_0xf954('0x46'):_0xf954('0x47');var _0x344687='';var _0x471dfc='';var _0x193825='';var _0x5198e6='';var _0x151dbb='';var _0x18aa5b='';var _0x44ec08='';var _0x522488='';var _0x4ce2c3=[_0xf954('0x48'),_0xf954('0x49'),_0xf954('0x4a'),_0xf954('0x4b'),_0xf954('0x4c'),_0xf954('0x4d'),_0xf954('0x4e'),_0xf954('0x4f'),_0xf954('0x50'),_0xf954('0x51')];var _0x204fad=[_0xf954('0x52'),_0xf954('0x53'),_0xf954('0x54'),'billedserviceunits','contactidname',_0xf954('0x55'),_0xf954('0x56'),_0xf954('0x57'),_0xf954('0x58'),'createdbyexternalpartyyominame',_0xf954('0x59'),_0xf954('0x5a'),_0xf954('0x5b'),_0xf954('0x5c'),_0xf954('0x5d'),_0xf954('0x5e'),_0xf954('0x5f'),_0xf954('0x60'),'emailaddress',_0xf954('0x61'),_0xf954('0x62'),_0xf954('0x63'),_0xf954('0x64'),_0xf954('0x65'),'firstresponsebykpiidname',_0xf954('0x66'),_0xf954('0x67'),_0xf954('0x68'),_0xf954('0x69'),_0xf954('0x6a'),'masteridname',_0xf954('0x6b'),_0xf954('0x6c'),_0xf954('0x6d'),_0xf954('0x6e'),_0xf954('0x6f'),'modifiedonbehalfbyname',_0xf954('0x70'),_0xf954('0x71'),_0xf954('0x72'),_0xf954('0x73'),'onholdtime',_0xf954('0x74'),'owneridname',_0xf954('0x75'),_0xf954('0x76'),_0xf954('0x77'),_0xf954('0x78'),'primarycontactidyominame',_0xf954('0x79'),_0xf954('0x7a'),'productserialnumber',_0xf954('0x7b'),_0xf954('0x7c'),_0xf954('0x7d'),_0xf954('0x7e'),_0xf954('0x7f'),_0xf954('0x80'),_0xf954('0x81'),'slaname',_0xf954('0x82'),_0xf954('0x83'),'statuscode',_0xf954('0x84'),_0xf954('0x85'),_0xf954('0x86'),_0xf954('0x87'),_0xf954('0x88'),'utcconversiontimezonecode','versionnumber'];var _0x31c4c0=_0x4ce2c3[_0xf954('0x89')](_0x204fad);return db[_0xf954('0x15')][_0xf954('0x35')]({'where':{'id':_0x4efd56['params']['id']},'attributes':['id',_0xf954('0x8a'),_0xf954('0x8b'),_0xf954('0x8c'),'tenantId',_0xf954('0x8d'),_0xf954('0x8e'),_0xf954('0x8f')],'include':[{'model':db[_0xf954('0x90')],'as':_0xf954('0x90'),'attributes':['id',_0xf954('0x91'),_0xf954('0x92')]}]})[_0xf954('0xc')](handleEntityNotFound(_0x246a81,null))['then'](function(_0x581785){if(_0x581785){if(_0x581785[_0xf954('0x8f')]){_0x581785['access_token']=_0x581785['CloudProvider']['data5'];_0x522488=sanitizeRemoteUri(_0x581785['CloudProvider'][_0xf954('0x92')]);_0x44ec08=getWebApiUrl(_0x522488);return _0x581785;}_0x522488=sanitizeRemoteUri(_0x581785[_0xf954('0x8c')]);_0x44ec08=getWebApiUrl(_0x522488);var _0x516cab={'method':_0xf954('0x93'),'uri':_0xf954('0x94')+_0x581785['tenantId']+_0xf954('0x95'),'form':{'client_id':_0x581785[_0xf954('0x8d')],'resource':_0x522488,'username':_0x581785[_0xf954('0x8a')],'password':_0x581785[_0xf954('0x8b')],'grant_type':'password','client_secret':_0x581785['clientSecret']},'json':!![]};return rp(_0x516cab);}})[_0xf954('0xc')](function(_0x1bc496){_0x18aa5b=_0x1bc496[_0xf954('0x96')];var _0x3222a7={'method':_0xf954('0x97'),'uri':encodeURI(_0x44ec08+_0xf954('0x98')+_0x5511fc+'\x27'),'headers':{'Authorization':_0xf954('0x99')+_0x18aa5b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3222a7);})[_0xf954('0xc')](function(_0x2e6005){var _0xcb21b9=_0x2e6005[_0xf954('0x9a')][0x0];var _0x55413f=_0xcb21b9[_0xf954('0x9b')];var _0x52b2a2={'method':_0xf954('0x97'),'uri':_0x44ec08+_0xf954('0x9c')+_0x55413f+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf954('0x99')+_0x18aa5b,'If-None-Match':null,'OData-Version':_0xf954('0x9d')},'json':!![]};return rp(_0x52b2a2);})[_0xf954('0xc')](function(_0x402301){_0x344687=_0x402301;_0x471dfc=_0x344687['Attributes'];_0x471dfc=_[_0xf954('0x9e')](_0x471dfc,function(_0x3b0bfa){return!_0x31c4c0[_0xf954('0x9f')](_0x3b0bfa[_0xf954('0xa0')]);});var _0x10ac1a=[];var _0x1d17d5=[];_0x471dfc['forEach'](function(_0x3735c){if(_0x3735c[_0xf954('0xa1')]){var _0x4ef3dd=_0x3735c[_0xf954('0xa1')][_0xf954('0x40')](_0x3735c[_0xf954('0xa1')][_0xf954('0x41')]('.')+0x1);if(_0x4ef3dd===_0xf954('0xa2')){_0x10ac1a['push'](getSelectList(_0x44ec08,_0x26ac18,_0x1d17d5,_0x344687[_0xf954('0x9b')],_0x3735c[_0xf954('0x9b')],_0x18aa5b));}}});return Promise[_0xf954('0xa3')](_0x10ac1a);})[_0xf954('0xc')](function(_0x20c807){_0x193825=_0x20c807[0x0];var _0x238df8=[];var _0x777283=[];_0x471dfc[_0xf954('0xa4')](function(_0x1cc7aa){if(!_['isNil'](_0x1cc7aa['@odata.type'])){var _0x33f3a7=_0x1cc7aa[_0xf954('0xa1')][_0xf954('0x40')](_0x1cc7aa[_0xf954('0xa1')][_0xf954('0x41')]('.')+0x1);if(_0x33f3a7==='BooleanAttributeMetadata'){_0x238df8[_0xf954('0xa5')](getBooleanList(_0x44ec08,_0x26ac18,_0x777283,_0x344687[_0xf954('0x9b')],_0x1cc7aa[_0xf954('0x9b')],_0x18aa5b));}}});return Promise[_0xf954('0xa3')](_0x238df8);})[_0xf954('0xc')](function(_0x56bd05){_0x5198e6=_0x56bd05[0x0];var _0x1b282e=[];var _0x422d56=[];_0x471dfc['forEach'](function(_0x4032b5){if(_0x4032b5['@odata.type']){var _0x2301d9=_0x4032b5[_0xf954('0xa1')][_0xf954('0x40')](_0x4032b5[_0xf954('0xa1')][_0xf954('0x41')]('.')+0x1);if(_0x2301d9===_0xf954('0xa6')||_0x2301d9===_0xf954('0xa7')||_0x2301d9===_0xf954('0xa8')||_0x2301d9===_0xf954('0xa9')||_0x2301d9===_0xf954('0xaa')||_0x2301d9===_0xf954('0xab')||_0x2301d9==='StatusAttributeMetadata'||_0x2301d9===_0xf954('0xac')||_0x2301d9===_0xf954('0xad')||_0x2301d9==='DecimalAttributeMetadata'){_0x1b282e[_0xf954('0xa5')](getInputList(_0x44ec08,_0x26ac18,_0x2301d9,_0x422d56,_0x344687[_0xf954('0x9b')],_0x4032b5[_0xf954('0x9b')],_0x18aa5b));}}});return Promise[_0xf954('0xa3')](_0x1b282e);})[_0xf954('0xc')](function(_0x433a08){_0x151dbb=_0x433a08[0x0];var _0x444eef=_0x193825[_0xf954('0x89')](_0x5198e6)[_0xf954('0x89')](_0x151dbb);var _0x352936={'count':_0x444eef[_0xf954('0x1f')],'rows':_0x444eef};return _0x352936;})['then'](respondWithResult(_0x246a81,null))[_0xf954('0x2d')](function(_0x168e43){var _0x32f403=_0x4efd56[_0xf954('0x1a')][_0xf954('0xae')]?0x1f4:_0x168e43[_0xf954('0xaf')]||0x1f4;logger[_0xf954('0xf')](_0x168e43[_0xf954('0x10')]);delete _0x168e43[_0xf954('0x11')];if(_0x32f403===0x191){_0x32f403=0x190;}_0x246a81[_0xf954('0x4')](_0x32f403)[_0xf954('0x12')](_0x4efd56[_0xf954('0x1a')][_0xf954('0xae')]?{'message':_0xf954('0xb0'),'statusCode':_0x168e43[_0xf954('0xaf')]}:_0x168e43);});};function getSelectList(_0x53ac18,_0x519ecd,_0x4d5b0d,_0x175f93,_0x4ec6b6,_0x2d45ef){var _0x159f21={'method':'GET','uri':_0x53ac18+'EntityDefinitions('+_0x175f93+_0xf954('0xb1')+_0x4ec6b6+_0xf954('0xb2')+_0xf954('0xb3'),'headers':{'Authorization':'Bearer\x20'+_0x2d45ef,'If-None-Match':null,'OData-Version':_0xf954('0x9d')},'json':!![]};return rp(_0x159f21)['then'](function(_0x39c888){var _0x235d9d=[];var _0x207b12=_0x39c888[_0xf954('0xb4')][_0xf954('0xb5')];_0x207b12[_0xf954('0xa4')](function(_0x5b5455){_0x235d9d[_0xf954('0xa5')]({'name':_0x5b5455[_0xf954('0xb6')]['UserLocalizedLabel'][_0xf954('0xb6')],'value':String(_0x5b5455['Value'])});});var _0x18ec6a={'id':_0x519ecd+'_'+_0x39c888[_0xf954('0xa0')],'name':_0x39c888['DisplayName'][_0xf954('0xb7')]['Label'],'custom':![],'options':_0x235d9d};_0x4d5b0d[_0xf954('0xa5')](_0x18ec6a);return _0x4d5b0d;});}function getBooleanList(_0xbac284,_0xc9f05e,_0x41c752,_0x44581c,_0x37e67f,_0x20bd9f){var _0x3511c3={'method':_0xf954('0x97'),'uri':_0xbac284+_0xf954('0x9c')+_0x44581c+_0xf954('0xb1')+_0x37e67f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xf954('0x99')+_0x20bd9f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3511c3)[_0xf954('0xc')](function(_0x4f609d){var _0x382244=[];_0x382244[_0xf954('0xa5')]({'name':_0x4f609d[_0xf954('0xb4')][_0xf954('0xb8')][_0xf954('0xb6')][_0xf954('0xb7')][_0xf954('0xb6')],'value':_0xf954('0xb9')},{'name':_0x4f609d['OptionSet'][_0xf954('0xba')]['Label'][_0xf954('0xb7')][_0xf954('0xb6')],'value':_0xf954('0xbb')});var _0x39b373={'id':_0xc9f05e+'_'+_0x4f609d[_0xf954('0xa0')],'name':_0x4f609d[_0xf954('0xbc')][_0xf954('0xb7')][_0xf954('0xb6')],'custom':![],'options':_0x382244};_0x41c752['push'](_0x39b373);return _0x41c752;});}function getInputList(_0x2c9832,_0xae1fd4,_0x200b55,_0x22d44f,_0x4631ea,_0x3ae3b5,_0x42f724){var _0x2dbf32={'method':_0xf954('0x97'),'uri':_0x2c9832+'EntityDefinitions('+_0x4631ea+')/Attributes('+_0x3ae3b5+_0xf954('0xbd')+_0x200b55+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xf954('0x99')+_0x42f724,'If-None-Match':null,'OData-Version':_0xf954('0x9d')},'json':!![]};return rp(_0x2dbf32)['then'](function(_0x4ba684){var _0x702a33={'id':_0xae1fd4+'_'+_0x4ba684[_0xf954('0xa0')],'name':_0x4ba684[_0xf954('0xbc')][_0xf954('0xb7')]?_0x4ba684['DisplayName'][_0xf954('0xb7')][_0xf954('0xb6')]:_0x4ba684[_0xf954('0xa0')],'custom':![],'options':[]};_0x22d44f[_0xf954('0xa5')](_0x702a33);return _0x22d44f;});} \ No newline at end of file +var _0xcb67=['msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','remoteUri','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','all','isNil','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','length','statusCode','status','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','count','limit','set','Content-Range','destroy','then','sendStatus','error','stack','name','send','index','map','Dynamics365Account','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','body','update','find','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedonbehalfbyname'];(function(_0xf1f37e,_0x159a20){var _0x2e3a6d=function(_0x4163cd){while(--_0x4163cd){_0xf1f37e['push'](_0xf1f37e['shift']());}};_0x2e3a6d(++_0x159a20);}(_0xcb67,0x104));var _0x7cb6=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xcb67[_0x56e4e7];return _0x383618;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var qs=require(_0x7cb6('0x0'));var logger=require(_0x7cb6('0x1'))(_0x7cb6('0x2'));var db=require(_0x7cb6('0x3'))['db'];var integrations=require(_0x7cb6('0x4'));function respondWithResult(_0xdcc2fc,_0x389202){_0x389202=_0x389202||0xc8;return function(_0x11c7f5){if(_0x11c7f5){return _0xdcc2fc['status'](_0x389202)[_0x7cb6('0x5')](_0x11c7f5);}};}function respondWithFilteredResult(_0x4b9f51,_0xbf489f){return function(_0x3c5fcc){if(_0x3c5fcc){var _0x3d6b69=typeof _0xbf489f[_0x7cb6('0x6')]===_0x7cb6('0x7')&&typeof _0xbf489f['limit']===_0x7cb6('0x7');var _0x54f222=_0x3c5fcc[_0x7cb6('0x8')];var _0x3760d7=_0x3d6b69?0x0:_0xbf489f[_0x7cb6('0x6')];var _0x5e903e=_0x3d6b69?_0x3c5fcc['count']:_0xbf489f['offset']+_0xbf489f[_0x7cb6('0x9')];var _0xe52fca;if(_0x5e903e>=_0x54f222){_0x5e903e=_0x54f222;_0xe52fca=0xc8;}else{_0xe52fca=0xce;}_0x4b9f51['status'](_0xe52fca);return _0x4b9f51[_0x7cb6('0xa')](_0x7cb6('0xb'),_0x3760d7+'-'+_0x5e903e+'/'+_0x54f222)[_0x7cb6('0x5')](_0x3c5fcc);}return null;};}function saveUpdates(_0x250054){return function(_0x1103c6){if(_0x1103c6){return _0x1103c6['update'](_0x250054)['then'](function(_0x25eaf0){return _0x25eaf0;});}return null;};}function removeEntity(_0x45c11d){return function(_0x1fccde){if(_0x1fccde){return _0x1fccde[_0x7cb6('0xc')]()[_0x7cb6('0xd')](function(){_0x45c11d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ea7){return function(_0x75a3ad){if(!_0x75a3ad){_0x55ea7[_0x7cb6('0xe')](0x194);}return _0x75a3ad;};}function handleError(_0x5d6588,_0x11854e){_0x11854e=_0x11854e||0x1f4;return function(_0x14b5c4){logger[_0x7cb6('0xf')](_0x14b5c4[_0x7cb6('0x10')]);if(_0x14b5c4[_0x7cb6('0x11')]){delete _0x14b5c4['name'];}_0x5d6588['status'](_0x11854e)[_0x7cb6('0x12')](_0x14b5c4);};}exports[_0x7cb6('0x13')]=function(_0x309f1f,_0x11cbd3){var _0xefba5={},_0x5d133b={},_0x79e822={'count':0x0,'rows':[]};var _0x492ed7=_[_0x7cb6('0x14')](db[_0x7cb6('0x15')]['rawAttributes'],function(_0x8eb4b6){return{'name':_0x8eb4b6['fieldName'],'type':_0x8eb4b6[_0x7cb6('0x16')][_0x7cb6('0x17')]};});_0x5d133b[_0x7cb6('0x18')]=_['map'](_0x492ed7,_0x7cb6('0x11'));_0x5d133b[_0x7cb6('0x19')]=_[_0x7cb6('0x1a')](_0x309f1f['query']);_0x5d133b['filters']=_['intersection'](_0x5d133b[_0x7cb6('0x18')],_0x5d133b[_0x7cb6('0x19')]);_0xefba5[_0x7cb6('0x1b')]=_[_0x7cb6('0x1c')](_0x5d133b[_0x7cb6('0x18')],qs[_0x7cb6('0x1d')](_0x309f1f[_0x7cb6('0x19')][_0x7cb6('0x1d')]));_0xefba5['attributes']=_0xefba5[_0x7cb6('0x1b')]['length']?_0xefba5['attributes']:_0x5d133b[_0x7cb6('0x18')];if(!_0x309f1f[_0x7cb6('0x19')][_0x7cb6('0x1e')](_0x7cb6('0x1f'))){_0xefba5['limit']=qs[_0x7cb6('0x9')](_0x309f1f[_0x7cb6('0x19')]['limit']);_0xefba5[_0x7cb6('0x6')]=qs[_0x7cb6('0x6')](_0x309f1f[_0x7cb6('0x19')][_0x7cb6('0x6')]);}_0xefba5[_0x7cb6('0x20')]=qs[_0x7cb6('0x21')](_0x309f1f[_0x7cb6('0x19')][_0x7cb6('0x21')]);_0xefba5[_0x7cb6('0x22')]=qs['filters'](_['pick'](_0x309f1f[_0x7cb6('0x19')],_0x5d133b[_0x7cb6('0x23')]),_0x492ed7);if(_0x309f1f['query'][_0x7cb6('0x24')]){_0xefba5[_0x7cb6('0x22')]=_[_0x7cb6('0x25')](_0xefba5[_0x7cb6('0x22')],{'$or':_['map'](_0x492ed7,function(_0x4d59e2){if(_0x4d59e2[_0x7cb6('0x16')]!=='VIRTUAL'){var _0x375734={};_0x375734[_0x4d59e2[_0x7cb6('0x11')]]={'$like':'%'+_0x309f1f[_0x7cb6('0x19')][_0x7cb6('0x24')]+'%'};return _0x375734;}})});}_0xefba5=_[_0x7cb6('0x25')]({},_0xefba5,_0x309f1f[_0x7cb6('0x26')]);var _0x278a37={'where':_0xefba5[_0x7cb6('0x22')]};return db[_0x7cb6('0x15')][_0x7cb6('0x8')](_0x278a37)[_0x7cb6('0xd')](function(_0x15c0f5){_0x79e822['count']=_0x15c0f5;if(_0x309f1f['query'][_0x7cb6('0x27')]){_0xefba5[_0x7cb6('0x28')]=[{'all':!![]}];}return db[_0x7cb6('0x15')][_0x7cb6('0x29')](_0xefba5);})[_0x7cb6('0xd')](function(_0x48875f){_0x79e822['rows']=_0x48875f;return _0x79e822;})[_0x7cb6('0xd')](respondWithFilteredResult(_0x11cbd3,_0xefba5))[_0x7cb6('0x2a')](handleError(_0x11cbd3,null));};exports[_0x7cb6('0x2b')]=function(_0x7173ea,_0x50b798){var _0x8abf1f={'raw':![],'where':{'id':_0x7173ea[_0x7cb6('0x2c')]['id']}},_0x2f5fb4={};_0x2f5fb4['model']=_[_0x7cb6('0x1a')](db[_0x7cb6('0x15')][_0x7cb6('0x2d')]);_0x2f5fb4[_0x7cb6('0x19')]=_[_0x7cb6('0x1a')](_0x7173ea[_0x7cb6('0x19')]);_0x2f5fb4[_0x7cb6('0x23')]=_[_0x7cb6('0x1c')](_0x2f5fb4['model'],_0x2f5fb4[_0x7cb6('0x19')]);_0x8abf1f[_0x7cb6('0x1b')]=_[_0x7cb6('0x1c')](_0x2f5fb4['model'],qs[_0x7cb6('0x1d')](_0x7173ea[_0x7cb6('0x19')][_0x7cb6('0x1d')]));_0x8abf1f[_0x7cb6('0x1b')]=_0x8abf1f['attributes']['length']?_0x8abf1f[_0x7cb6('0x1b')]:_0x2f5fb4['model'];if(_0x7173ea[_0x7cb6('0x19')]['includeAll']){_0x8abf1f[_0x7cb6('0x28')]=[{'all':!![]}];}_0x8abf1f=_[_0x7cb6('0x25')]({},_0x8abf1f,_0x7173ea[_0x7cb6('0x26')]);return db['Dynamics365Account']['find'](_0x8abf1f)[_0x7cb6('0xd')](handleEntityNotFound(_0x50b798,null))['then'](respondWithResult(_0x50b798,null))[_0x7cb6('0x2a')](handleError(_0x50b798,null));};exports['create']=function(_0x20e4da,_0x32df41){return db[_0x7cb6('0x15')]['create'](_0x20e4da[_0x7cb6('0x2e')],{})[_0x7cb6('0xd')](respondWithResult(_0x32df41,0xc9))[_0x7cb6('0x2a')](handleError(_0x32df41,null));};exports[_0x7cb6('0x2f')]=function(_0x548e52,_0x577967){if(_0x548e52[_0x7cb6('0x2e')]['id']){delete _0x548e52[_0x7cb6('0x2e')]['id'];}return db['Dynamics365Account'][_0x7cb6('0x30')]({'where':{'id':_0x548e52[_0x7cb6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x577967,null))[_0x7cb6('0xd')](saveUpdates(_0x548e52[_0x7cb6('0x2e')],null))['then'](respondWithResult(_0x577967,null))[_0x7cb6('0x2a')](handleError(_0x577967,null));};exports[_0x7cb6('0xc')]=function(_0x1312d3,_0x444913){return db[_0x7cb6('0x15')][_0x7cb6('0x30')]({'where':{'id':_0x1312d3[_0x7cb6('0x2c')]['id']}})[_0x7cb6('0xd')](handleEntityNotFound(_0x444913,null))['then'](removeEntity(_0x444913,null))[_0x7cb6('0x2a')](handleError(_0x444913,null));};exports['getConfigurations']=function(_0x16b2f6,_0x1fcbe7){var _0x27f843={};var _0x2ddbdf={};var _0x51d857;var _0x142ff7;return db[_0x7cb6('0x15')][_0x7cb6('0x31')]({'where':{'id':_0x16b2f6[_0x7cb6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1fcbe7,null))[_0x7cb6('0xd')](function(_0x21a881){if(_0x21a881){_0x51d857=_0x21a881;_0x2ddbdf['model']=_[_0x7cb6('0x1a')](db[_0x7cb6('0x32')][_0x7cb6('0x2d')]);_0x2ddbdf[_0x7cb6('0x19')]=_[_0x7cb6('0x1a')](_0x16b2f6[_0x7cb6('0x19')]);_0x2ddbdf[_0x7cb6('0x23')]=_[_0x7cb6('0x1c')](_0x2ddbdf[_0x7cb6('0x18')],_0x2ddbdf['query']);_0x27f843[_0x7cb6('0x1b')]=_[_0x7cb6('0x1c')](_0x2ddbdf[_0x7cb6('0x18')],qs[_0x7cb6('0x1d')](_0x16b2f6[_0x7cb6('0x19')][_0x7cb6('0x1d')]));_0x27f843['attributes']=_0x27f843['attributes']['length']?_0x27f843[_0x7cb6('0x1b')]:_0x2ddbdf[_0x7cb6('0x18')];_0x27f843[_0x7cb6('0x20')]=qs[_0x7cb6('0x21')](_0x16b2f6['query'][_0x7cb6('0x21')]);_0x27f843[_0x7cb6('0x22')]=qs[_0x7cb6('0x23')](_['pick'](_0x16b2f6[_0x7cb6('0x19')],_0x2ddbdf[_0x7cb6('0x23')]));if(_0x16b2f6[_0x7cb6('0x19')][_0x7cb6('0x24')]){_0x27f843[_0x7cb6('0x22')]=_[_0x7cb6('0x25')](_0x27f843['where'],{'$or':_[_0x7cb6('0x14')](_0x27f843[_0x7cb6('0x1b')],function(_0x105e6a){var _0x18e0d4={};_0x18e0d4[_0x105e6a]={'$like':'%'+_0x16b2f6['query'][_0x7cb6('0x24')]+'%'};return _0x18e0d4;})});}_0x27f843=_['merge']({},_0x27f843,_0x16b2f6[_0x7cb6('0x26')]);return _0x51d857[_0x7cb6('0x33')](_0x27f843);}})[_0x7cb6('0xd')](function(_0x4e22cf){if(_0x4e22cf){_0x142ff7=_0x4e22cf['length'];if(!_0x16b2f6[_0x7cb6('0x19')][_0x7cb6('0x1e')](_0x7cb6('0x1f'))){_0x27f843[_0x7cb6('0x9')]=qs[_0x7cb6('0x9')](_0x16b2f6[_0x7cb6('0x19')][_0x7cb6('0x9')]);_0x27f843[_0x7cb6('0x6')]=qs[_0x7cb6('0x6')](_0x16b2f6['query']['offset']);}return _0x51d857[_0x7cb6('0x33')](_0x27f843);}})[_0x7cb6('0xd')](function(_0x31da03){if(_0x31da03){return _0x31da03?{'count':_0x142ff7,'rows':_0x31da03}:null;}})[_0x7cb6('0xd')](respondWithResult(_0x1fcbe7,null))['catch'](handleError(_0x1fcbe7,null));};exports[_0x7cb6('0x34')]=function(_0x302d25,_0x3c5426){if(_0x302d25[_0x7cb6('0x2e')]['id']){delete _0x302d25['body']['id'];}return db[_0x7cb6('0x15')][_0x7cb6('0x31')]({'where':{'id':_0x302d25['params']['id']}})[_0x7cb6('0xd')](handleEntityNotFound(_0x3c5426,null))[_0x7cb6('0xd')](function(_0x1f8a39){if(_0x1f8a39){_0x302d25[_0x7cb6('0x2e')][_0x7cb6('0x35')]=_0x1f8a39['id'];_0x302d25[_0x7cb6('0x2e')][_0x7cb6('0x36')]=integrations[_0x7cb6('0x37')](_0x302d25['body'][_0x7cb6('0x38')],_0x302d25['body'][_0x7cb6('0x16')]);_0x302d25[_0x7cb6('0x2e')][_0x7cb6('0x39')]=integrations[_0x7cb6('0x3a')](_0x302d25['body']['channel'],_0x302d25[_0x7cb6('0x2e')]['type']);return db[_0x7cb6('0x32')][_0x7cb6('0x3b')](_0x302d25[_0x7cb6('0x2e')],{'include':[{'model':db[_0x7cb6('0x3c')],'as':_0x7cb6('0x36')},{'model':db[_0x7cb6('0x3c')],'as':'Descriptions'}]});}return null;})[_0x7cb6('0xd')](respondWithResult(_0x3c5426,null))[_0x7cb6('0x2a')](handleError(_0x3c5426,null));};function sanitizeRemoteUri(_0x2864bd){var _0x59a88a=_0x2864bd['slice'](-0x1);if(_0x59a88a==='/')return _0x2864bd[_0x7cb6('0x3d')](0x0,_0x2864bd[_0x7cb6('0x3e')](_0x59a88a));return _0x2864bd;}function getWebApiUrl(_0x354b74){return util[_0x7cb6('0x3f')](_0x7cb6('0x40'),_0x354b74);}exports[_0x7cb6('0x41')]=function(_0x5ef496,_0x21b179){var _0x1776df=_0x5ef496['query'][_0x7cb6('0x42')];var _0x23cf47=_0x1776df==='incident'?_0x7cb6('0x43'):_0x7cb6('0x44');var _0x339e97='';var _0x2df47b='';var _0x76b62='';var _0x3d0457='';var _0x442c43='';var _0x21368f='';var _0x3bc762='';var _0x523b63='';var _0x4e5a50=[_0x7cb6('0x45'),_0x7cb6('0x46'),'customerid',_0x7cb6('0x47'),_0x7cb6('0x48'),_0x7cb6('0x49'),'phonenumber',_0x7cb6('0x4a'),_0x7cb6('0x4b'),'phonecall_activity_parties'];var _0x36201d=[_0x7cb6('0x4c'),'accountidyominame',_0x7cb6('0x4d'),_0x7cb6('0x4e'),_0x7cb6('0x4f'),'contactidyominame','contractdetailidname','contractidname',_0x7cb6('0x50'),_0x7cb6('0x51'),_0x7cb6('0x52'),_0x7cb6('0x53'),_0x7cb6('0x54'),_0x7cb6('0x55'),_0x7cb6('0x56'),_0x7cb6('0x57'),_0x7cb6('0x58'),'customeridyominame',_0x7cb6('0x59'),_0x7cb6('0x5a'),_0x7cb6('0x5b'),_0x7cb6('0x5c'),'escalatedon','exchangerate',_0x7cb6('0x5d'),_0x7cb6('0x5e'),_0x7cb6('0x5f'),'influencescore','kbarticleidname',_0x7cb6('0x60'),_0x7cb6('0x61'),_0x7cb6('0x62'),_0x7cb6('0x63'),'modifiedbyname',_0x7cb6('0x64'),'modifiedon',_0x7cb6('0x65'),'modifiedonbehalfbyyominame',_0x7cb6('0x66'),_0x7cb6('0x67'),_0x7cb6('0x68'),'onholdtime','overriddencreatedon',_0x7cb6('0x69'),'owneridtype',_0x7cb6('0x6a'),'parentcaseidname',_0x7cb6('0x6b'),_0x7cb6('0x6c'),'prioritycodename',_0x7cb6('0x6d'),_0x7cb6('0x6e'),_0x7cb6('0x6f'),_0x7cb6('0x70'),_0x7cb6('0x71'),_0x7cb6('0x72'),_0x7cb6('0x73'),_0x7cb6('0x74'),_0x7cb6('0x75'),_0x7cb6('0x76'),'socialprofileidname','statecode',_0x7cb6('0x77'),_0x7cb6('0x78'),'ticketnumber',_0x7cb6('0x79'),_0x7cb6('0x7a'),_0x7cb6('0x7b'),_0x7cb6('0x7c'),_0x7cb6('0x7d')];var _0x511227=_0x4e5a50[_0x7cb6('0x7e')](_0x36201d);return db[_0x7cb6('0x15')][_0x7cb6('0x31')]({'where':{'id':_0x5ef496[_0x7cb6('0x2c')]['id']},'attributes':['id','username',_0x7cb6('0x7f'),'remoteUri','tenantId',_0x7cb6('0x80'),_0x7cb6('0x81'),_0x7cb6('0x82')],'include':[{'model':db[_0x7cb6('0x83')],'as':_0x7cb6('0x83'),'attributes':['id',_0x7cb6('0x84'),'data7']}]})[_0x7cb6('0xd')](handleEntityNotFound(_0x21b179,null))['then'](function(_0x2d5a9d){if(_0x2d5a9d){if(_0x2d5a9d[_0x7cb6('0x82')]){_0x2d5a9d[_0x7cb6('0x85')]=_0x2d5a9d[_0x7cb6('0x83')][_0x7cb6('0x84')];_0x523b63=sanitizeRemoteUri(_0x2d5a9d['CloudProvider'][_0x7cb6('0x86')]);_0x3bc762=getWebApiUrl(_0x523b63);return _0x2d5a9d;}_0x523b63=sanitizeRemoteUri(_0x2d5a9d[_0x7cb6('0x87')]);_0x3bc762=getWebApiUrl(_0x523b63);var _0xd373e7={'method':'POST','uri':_0x7cb6('0x88')+_0x2d5a9d[_0x7cb6('0x89')]+_0x7cb6('0x8a'),'form':{'client_id':_0x2d5a9d[_0x7cb6('0x80')],'resource':_0x523b63,'username':_0x2d5a9d[_0x7cb6('0x8b')],'password':_0x2d5a9d[_0x7cb6('0x7f')],'grant_type':_0x7cb6('0x7f'),'client_secret':_0x2d5a9d[_0x7cb6('0x81')]},'json':!![]};return rp(_0xd373e7);}})['then'](function(_0x4afef9){_0x21368f=_0x4afef9[_0x7cb6('0x85')];var _0x26f227={'method':_0x7cb6('0x8c'),'uri':encodeURI(_0x3bc762+_0x7cb6('0x8d')+_0x23cf47+'\x27'),'headers':{'Authorization':_0x7cb6('0x8e')+_0x21368f,'If-None-Match':null,'OData-Version':_0x7cb6('0x8f')},'json':!![]};return rp(_0x26f227);})[_0x7cb6('0xd')](function(_0x1b8fd6){var _0x494bc8=_0x1b8fd6[_0x7cb6('0x90')][0x0];var _0x3a0ebb=_0x494bc8[_0x7cb6('0x91')];var _0x21f807={'method':_0x7cb6('0x8c'),'uri':_0x3bc762+_0x7cb6('0x92')+_0x3a0ebb+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x7cb6('0x8e')+_0x21368f,'If-None-Match':null,'OData-Version':_0x7cb6('0x8f')},'json':!![]};return rp(_0x21f807);})['then'](function(_0x1a151d){_0x339e97=_0x1a151d;_0x2df47b=_0x339e97[_0x7cb6('0x93')];_0x2df47b=_[_0x7cb6('0x94')](_0x2df47b,function(_0x413fee){return!_0x511227[_0x7cb6('0x95')](_0x413fee[_0x7cb6('0x96')]);});var _0x4d536c=[];var _0x242c4f=[];_0x2df47b[_0x7cb6('0x97')](function(_0x431ccd){if(_0x431ccd[_0x7cb6('0x98')]){var _0x2f3bbc=_0x431ccd[_0x7cb6('0x98')]['substring'](_0x431ccd[_0x7cb6('0x98')][_0x7cb6('0x3e')]('.')+0x1);if(_0x2f3bbc==='PicklistAttributeMetadata'){_0x4d536c['push'](getSelectList(_0x3bc762,_0x1776df,_0x242c4f,_0x339e97[_0x7cb6('0x91')],_0x431ccd[_0x7cb6('0x91')],_0x21368f));}}});return Promise[_0x7cb6('0x99')](_0x4d536c);})[_0x7cb6('0xd')](function(_0x4b2c40){_0x76b62=_0x4b2c40[0x0];var _0x30e366=[];var _0x686819=[];_0x2df47b['forEach'](function(_0x158aa6){if(!_[_0x7cb6('0x9a')](_0x158aa6[_0x7cb6('0x98')])){var _0x4163b3=_0x158aa6[_0x7cb6('0x98')][_0x7cb6('0x3d')](_0x158aa6[_0x7cb6('0x98')][_0x7cb6('0x3e')]('.')+0x1);if(_0x4163b3==='BooleanAttributeMetadata'){_0x30e366[_0x7cb6('0x9b')](getBooleanList(_0x3bc762,_0x1776df,_0x686819,_0x339e97[_0x7cb6('0x91')],_0x158aa6[_0x7cb6('0x91')],_0x21368f));}}});return Promise['all'](_0x30e366);})[_0x7cb6('0xd')](function(_0xc2ef08){_0x3d0457=_0xc2ef08[0x0];var _0x240d16=[];var _0x22959f=[];_0x2df47b[_0x7cb6('0x97')](function(_0x2bf607){if(_0x2bf607['@odata.type']){var _0x183a6e=_0x2bf607['@odata.type']['substring'](_0x2bf607['@odata.type']['lastIndexOf']('.')+0x1);if(_0x183a6e==='StringAttributeMetadata'||_0x183a6e===_0x7cb6('0x9c')||_0x183a6e===_0x7cb6('0x9d')||_0x183a6e===_0x7cb6('0x9e')||_0x183a6e===_0x7cb6('0x9f')||_0x183a6e===_0x7cb6('0xa0')||_0x183a6e===_0x7cb6('0xa1')||_0x183a6e==='EntityNameAttributeMetadata'||_0x183a6e==='StateAttributeMetadata'||_0x183a6e==='DecimalAttributeMetadata'){_0x240d16[_0x7cb6('0x9b')](getInputList(_0x3bc762,_0x1776df,_0x183a6e,_0x22959f,_0x339e97['MetadataId'],_0x2bf607['MetadataId'],_0x21368f));}}});return Promise['all'](_0x240d16);})[_0x7cb6('0xd')](function(_0x338e55){_0x442c43=_0x338e55[0x0];var _0x2a89da=_0x76b62[_0x7cb6('0x7e')](_0x3d0457)[_0x7cb6('0x7e')](_0x442c43);var _0x2b8f4e={'count':_0x2a89da[_0x7cb6('0xa2')],'rows':_0x2a89da};return _0x2b8f4e;})[_0x7cb6('0xd')](respondWithResult(_0x21b179,null))[_0x7cb6('0x2a')](function(_0x2808f8){var _0xfde867=_0x5ef496[_0x7cb6('0x19')]['test']?0x1f4:_0x2808f8[_0x7cb6('0xa3')]||0x1f4;logger[_0x7cb6('0xf')](_0x2808f8[_0x7cb6('0x10')]);delete _0x2808f8[_0x7cb6('0x11')];if(_0xfde867===0x191){_0xfde867=0x190;}_0x21b179[_0x7cb6('0xa4')](_0xfde867)['send'](_0x5ef496[_0x7cb6('0x19')][_0x7cb6('0xa5')]?{'message':_0x7cb6('0xa6'),'statusCode':_0x2808f8[_0x7cb6('0xa3')]}:_0x2808f8);});};function getSelectList(_0xea0290,_0x65895,_0x3dc978,_0x306bbd,_0x1af2e0,_0x4e4041){var _0x23cfc1={'method':_0x7cb6('0x8c'),'uri':_0xea0290+_0x7cb6('0x92')+_0x306bbd+_0x7cb6('0xa7')+_0x1af2e0+_0x7cb6('0xa8')+_0x7cb6('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x4e4041,'If-None-Match':null,'OData-Version':_0x7cb6('0x8f')},'json':!![]};return rp(_0x23cfc1)[_0x7cb6('0xd')](function(_0x5f4ef5){var _0x130bd2=[];var _0x1ad737=_0x5f4ef5['OptionSet'][_0x7cb6('0xaa')];_0x1ad737[_0x7cb6('0x97')](function(_0x3f6542){_0x130bd2[_0x7cb6('0x9b')]({'name':_0x3f6542[_0x7cb6('0xab')][_0x7cb6('0xac')][_0x7cb6('0xab')],'value':String(_0x3f6542[_0x7cb6('0xad')])});});var _0x1587ea={'id':_0x65895+'_'+_0x5f4ef5[_0x7cb6('0x96')],'name':_0x5f4ef5[_0x7cb6('0xae')][_0x7cb6('0xac')][_0x7cb6('0xab')],'custom':![],'options':_0x130bd2};_0x3dc978[_0x7cb6('0x9b')](_0x1587ea);return _0x3dc978;});}function getBooleanList(_0x563b23,_0x37ce80,_0x29bfa9,_0x59010c,_0x4ba409,_0x12b1db){var _0x1902db={'method':_0x7cb6('0x8c'),'uri':_0x563b23+_0x7cb6('0x92')+_0x59010c+_0x7cb6('0xa7')+_0x4ba409+_0x7cb6('0xaf'),'headers':{'Authorization':_0x7cb6('0x8e')+_0x12b1db,'If-None-Match':null,'OData-Version':_0x7cb6('0x8f')},'json':!![]};return rp(_0x1902db)[_0x7cb6('0xd')](function(_0x3bcbad){var _0xb31040=[];_0xb31040[_0x7cb6('0x9b')]({'name':_0x3bcbad[_0x7cb6('0xb0')][_0x7cb6('0xb1')][_0x7cb6('0xab')][_0x7cb6('0xac')][_0x7cb6('0xab')],'value':_0x7cb6('0xb2')},{'name':_0x3bcbad['OptionSet'][_0x7cb6('0xb3')][_0x7cb6('0xab')]['UserLocalizedLabel'][_0x7cb6('0xab')],'value':'false'});var _0x437c76={'id':_0x37ce80+'_'+_0x3bcbad['LogicalName'],'name':_0x3bcbad[_0x7cb6('0xae')]['UserLocalizedLabel'][_0x7cb6('0xab')],'custom':![],'options':_0xb31040};_0x29bfa9['push'](_0x437c76);return _0x29bfa9;});}function getInputList(_0x2d3176,_0x34fb6c,_0x3cc218,_0x46444f,_0x4a73f5,_0x3b6f86,_0x5bba12){var _0x2bcf73={'method':_0x7cb6('0x8c'),'uri':_0x2d3176+_0x7cb6('0x92')+_0x4a73f5+_0x7cb6('0xa7')+_0x3b6f86+_0x7cb6('0xb4')+_0x3cc218+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x5bba12,'If-None-Match':null,'OData-Version':_0x7cb6('0x8f')},'json':!![]};return rp(_0x2bcf73)['then'](function(_0x1603f8){var _0x283303={'id':_0x34fb6c+'_'+_0x1603f8[_0x7cb6('0x96')],'name':_0x1603f8[_0x7cb6('0xae')][_0x7cb6('0xac')]?_0x1603f8[_0x7cb6('0xae')][_0x7cb6('0xac')][_0x7cb6('0xab')]:_0x1603f8[_0x7cb6('0x96')],'custom':![],'options':[]};_0x46444f['push'](_0x283303);return _0x46444f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 002f5bc..a0d4ac6 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1df972,_0x44f81b){var _0x55448c=function(_0x3fd184){while(--_0x3fd184){_0x1df972['push'](_0x1df972['shift']());}};_0x55448c(++_0x44f81b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('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 20db736..3f6ed51 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 _0x530d=['client','http','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','Dynamics365Account','findAll','raw','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x530d,0x183));var _0xd530=function(_0x583ae5,_0x35837b){_0x583ae5=_0x583ae5-0x0;var _0x35b6f0=_0x530d[_0x583ae5];return _0x35b6f0;};'use strict';var _=require('lodash');var util=require(_0xd530('0x0'));var moment=require(_0xd530('0x1'));var BPromise=require(_0xd530('0x2'));var rs=require(_0xd530('0x3'));var fs=require('fs');var Redis=require(_0xd530('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd530('0x5'));var logger=require(_0xd530('0x6'))('rpc');var config=require(_0xd530('0x7'));var jayson=require(_0xd530('0x8'));var client=jayson[_0xd530('0x9')][_0xd530('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x107868,_0xc1608b,_0x8f3dca){return new BPromise(function(_0x4b3921,_0x29f36a){return client[_0xd530('0xb')](_0x107868,_0x8f3dca)[_0xd530('0xc')](function(_0x212b75){logger['info'](_0xd530('0xd'),_0xc1608b,'request\x20sent');logger[_0xd530('0xe')](_0xd530('0xf'),_0xc1608b,_0xd530('0x10'),JSON[_0xd530('0x11')](_0x212b75));if(_0x212b75[_0xd530('0x12')]){if(_0x212b75['error'][_0xd530('0x13')]===0x1f4){logger['error'](_0xd530('0xd'),_0xc1608b,_0x212b75[_0xd530('0x12')][_0xd530('0x14')]);return _0x29f36a(_0x212b75['error'][_0xd530('0x14')]);}logger['error'](_0xd530('0xd'),_0xc1608b,_0x212b75[_0xd530('0x12')][_0xd530('0x14')]);return _0x4b3921(_0x212b75[_0xd530('0x12')][_0xd530('0x14')]);}else{logger[_0xd530('0x15')](_0xd530('0xd'),_0xc1608b,_0xd530('0x10'));_0x4b3921(_0x212b75['result'][_0xd530('0x14')]);}})[_0xd530('0x16')](function(_0x5026d7){logger[_0xd530('0x12')](_0xd530('0xd'),_0xc1608b,_0x5026d7);_0x29f36a(_0x5026d7);});});}exports['GetDynamics365Account']=function(_0x49fd84){var _0x36a1c5=this;return new Promise(function(_0x5af6c1,_0xfcf27c){return db[_0xd530('0x17')][_0xd530('0x18')]({'raw':_0x49fd84['options']?_0x49fd84['options'][_0xd530('0x19')]===undefined?!![]:![]:!![],'where':_0x49fd84[_0xd530('0x1a')]?_0x49fd84['options'][_0xd530('0x1b')]||null:null,'attributes':_0x49fd84['options']?_0x49fd84[_0xd530('0x1a')][_0xd530('0x1c')]||null:null,'limit':_0x49fd84['options']?_0x49fd84['options'][_0xd530('0x1d')]||null:null,'include':_0x49fd84['options']?_0x49fd84[_0xd530('0x1a')]['include']?_['map'](_0x49fd84[_0xd530('0x1a')][_0xd530('0x1e')],function(_0x4e2a05){return{'model':db[_0x4e2a05['model']],'as':_0x4e2a05['as'],'attributes':_0x4e2a05[_0xd530('0x1c')],'include':_0x4e2a05[_0xd530('0x1e')]?_[_0xd530('0x1f')](_0x4e2a05['include'],function(_0x41109d){return{'model':db[_0x41109d[_0xd530('0x20')]],'as':_0x41109d['as'],'attributes':_0x41109d[_0xd530('0x1c')],'include':_0x41109d['include']?_[_0xd530('0x1f')](_0x41109d[_0xd530('0x1e')],function(_0x2db44e){return{'model':db[_0x2db44e[_0xd530('0x20')]],'as':_0x2db44e['as'],'attributes':_0x2db44e[_0xd530('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd530('0xc')](function(_0x460626){logger[_0xd530('0x15')](_0xd530('0x21'),_0x49fd84);logger[_0xd530('0xe')](_0xd530('0x21'),_0x49fd84,JSON[_0xd530('0x11')](_0x460626));_0x5af6c1(_0x460626);})['catch'](function(_0x2e99bc){logger['error'](_0xd530('0x21'),_0x2e99bc[_0xd530('0x14')],_0x49fd84);_0xfcf27c(_0x36a1c5[_0xd530('0x12')](0x1f4,_0x2e99bc[_0xd530('0x14')]));});});};exports[_0xd530('0x22')]=function(_0x1f36b6){var _0x5eb47b=this;return new Promise(function(_0x1c54e1,_0x2dac0a){return db[_0xd530('0x17')][_0xd530('0x23')]({'raw':_0x1f36b6[_0xd530('0x1a')]?_0x1f36b6['options'][_0xd530('0x19')]===undefined?!![]:![]:!![],'where':_0x1f36b6[_0xd530('0x1a')]?_0x1f36b6[_0xd530('0x1a')]['where']||null:null,'attributes':_0x1f36b6[_0xd530('0x1a')]?_0x1f36b6[_0xd530('0x1a')][_0xd530('0x1c')]||null:null,'include':_0x1f36b6[_0xd530('0x1a')]?_0x1f36b6[_0xd530('0x1a')][_0xd530('0x1e')]?_[_0xd530('0x1f')](_0x1f36b6['options'][_0xd530('0x1e')],function(_0x36185e){return{'model':db[_0x36185e['model']],'as':_0x36185e['as'],'attributes':_0x36185e['attributes'],'include':_0x36185e[_0xd530('0x1e')]?_[_0xd530('0x1f')](_0x36185e[_0xd530('0x1e')],function(_0x28cd15){return{'model':db[_0x28cd15['model']],'as':_0x28cd15['as'],'attributes':_0x28cd15[_0xd530('0x1c')],'include':_0x28cd15[_0xd530('0x1e')]?_[_0xd530('0x1f')](_0x28cd15[_0xd530('0x1e')],function(_0x2b1721){return{'model':db[_0x2b1721[_0xd530('0x20')]],'as':_0x2b1721['as'],'attributes':_0x2b1721['attributes']};}):[]};}):[]};}):[]:[]})[_0xd530('0xc')](function(_0x5cabdf){logger['info'](_0xd530('0x22'),_0x1f36b6);logger['debug']('ShowDynamics365Account',_0x1f36b6,JSON['stringify'](_0x5cabdf));_0x1c54e1(_0x5cabdf);})['catch'](function(_0x31ef1b){logger[_0xd530('0x12')](_0xd530('0x22'),_0x31ef1b[_0xd530('0x14')],_0x1f36b6);_0x2dac0a(_0x5eb47b[_0xd530('0x12')](0x1f4,_0x31ef1b['message']));});});}; \ No newline at end of file +var _0x786a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','Dynamics365Account','findAll','options','raw','attributes','include','map','model','GetDynamics365Account','ShowDynamics365Account','where','moment'];(function(_0x35a16b,_0x520804){var _0x3b72b9=function(_0x253752){while(--_0x253752){_0x35a16b['push'](_0x35a16b['shift']());}};_0x3b72b9(++_0x520804);}(_0x786a,0x1ec));var _0xa786=function(_0x5cc2fd,_0xf2cd4b){_0x5cc2fd=_0x5cc2fd-0x0;var _0x5a3c0a=_0x786a[_0x5cc2fd];return _0x5a3c0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa786('0x0'));var BPromise=require(_0xa786('0x1'));var rs=require(_0xa786('0x2'));var fs=require('fs');var Redis=require(_0xa786('0x3'));var db=require(_0xa786('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa786('0x5'))('rpc');var config=require(_0xa786('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfc981a,_0x133476,_0x3b4630){return new BPromise(function(_0x57d256,_0x1c633e){return client[_0xa786('0x7')](_0xfc981a,_0x3b4630)[_0xa786('0x8')](function(_0x57a378){logger['info'](_0xa786('0x9'),_0x133476,'request\x20sent');logger[_0xa786('0xa')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x133476,_0xa786('0xb'),JSON[_0xa786('0xc')](_0x57a378));if(_0x57a378[_0xa786('0xd')]){if(_0x57a378[_0xa786('0xd')]['code']===0x1f4){logger['error'](_0xa786('0x9'),_0x133476,_0x57a378[_0xa786('0xd')][_0xa786('0xe')]);return _0x1c633e(_0x57a378['error'][_0xa786('0xe')]);}logger['error'](_0xa786('0x9'),_0x133476,_0x57a378[_0xa786('0xd')][_0xa786('0xe')]);return _0x57d256(_0x57a378[_0xa786('0xd')][_0xa786('0xe')]);}else{logger[_0xa786('0xf')](_0xa786('0x9'),_0x133476,_0xa786('0xb'));_0x57d256(_0x57a378[_0xa786('0x10')][_0xa786('0xe')]);}})[_0xa786('0x11')](function(_0x3a7561){logger['error'](_0xa786('0x9'),_0x133476,_0x3a7561);_0x1c633e(_0x3a7561);});});}exports['GetDynamics365Account']=function(_0x4821d0){var _0x4d69a9=this;return new Promise(function(_0x3c0d63,_0x518183){return db[_0xa786('0x12')][_0xa786('0x13')]({'raw':_0x4821d0[_0xa786('0x14')]?_0x4821d0['options'][_0xa786('0x15')]===undefined?!![]:![]:!![],'where':_0x4821d0[_0xa786('0x14')]?_0x4821d0[_0xa786('0x14')]['where']||null:null,'attributes':_0x4821d0['options']?_0x4821d0[_0xa786('0x14')][_0xa786('0x16')]||null:null,'limit':_0x4821d0[_0xa786('0x14')]?_0x4821d0[_0xa786('0x14')]['limit']||null:null,'include':_0x4821d0[_0xa786('0x14')]?_0x4821d0[_0xa786('0x14')][_0xa786('0x17')]?_[_0xa786('0x18')](_0x4821d0['options'][_0xa786('0x17')],function(_0x27fc88){return{'model':db[_0x27fc88['model']],'as':_0x27fc88['as'],'attributes':_0x27fc88['attributes'],'include':_0x27fc88['include']?_['map'](_0x27fc88[_0xa786('0x17')],function(_0x21d30d){return{'model':db[_0x21d30d[_0xa786('0x19')]],'as':_0x21d30d['as'],'attributes':_0x21d30d[_0xa786('0x16')],'include':_0x21d30d['include']?_['map'](_0x21d30d[_0xa786('0x17')],function(_0x4948c2){return{'model':db[_0x4948c2['model']],'as':_0x4948c2['as'],'attributes':_0x4948c2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa786('0x8')](function(_0x36e956){logger[_0xa786('0xf')](_0xa786('0x1a'),_0x4821d0);logger['debug'](_0xa786('0x1a'),_0x4821d0,JSON[_0xa786('0xc')](_0x36e956));_0x3c0d63(_0x36e956);})['catch'](function(_0x3b27f6){logger[_0xa786('0xd')](_0xa786('0x1a'),_0x3b27f6[_0xa786('0xe')],_0x4821d0);_0x518183(_0x4d69a9[_0xa786('0xd')](0x1f4,_0x3b27f6[_0xa786('0xe')]));});});};exports[_0xa786('0x1b')]=function(_0x293790){var _0x3b8880=this;return new Promise(function(_0x3e9544,_0x4abcb8){return db['Dynamics365Account']['find']({'raw':_0x293790[_0xa786('0x14')]?_0x293790[_0xa786('0x14')][_0xa786('0x15')]===undefined?!![]:![]:!![],'where':_0x293790[_0xa786('0x14')]?_0x293790[_0xa786('0x14')][_0xa786('0x1c')]||null:null,'attributes':_0x293790[_0xa786('0x14')]?_0x293790[_0xa786('0x14')][_0xa786('0x16')]||null:null,'include':_0x293790['options']?_0x293790[_0xa786('0x14')]['include']?_[_0xa786('0x18')](_0x293790[_0xa786('0x14')][_0xa786('0x17')],function(_0x153ab4){return{'model':db[_0x153ab4[_0xa786('0x19')]],'as':_0x153ab4['as'],'attributes':_0x153ab4[_0xa786('0x16')],'include':_0x153ab4[_0xa786('0x17')]?_[_0xa786('0x18')](_0x153ab4[_0xa786('0x17')],function(_0x2d0a71){return{'model':db[_0x2d0a71[_0xa786('0x19')]],'as':_0x2d0a71['as'],'attributes':_0x2d0a71[_0xa786('0x16')],'include':_0x2d0a71[_0xa786('0x17')]?_[_0xa786('0x18')](_0x2d0a71[_0xa786('0x17')],function(_0x4cd54c){return{'model':db[_0x4cd54c['model']],'as':_0x4cd54c['as'],'attributes':_0x4cd54c[_0xa786('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa786('0x8')](function(_0x844d02){logger[_0xa786('0xf')](_0xa786('0x1b'),_0x293790);logger['debug'](_0xa786('0x1b'),_0x293790,JSON[_0xa786('0xc')](_0x844d02));_0x3e9544(_0x844d02);})[_0xa786('0x11')](function(_0x29b264){logger[_0xa786('0xd')](_0xa786('0x1b'),_0x29b264['message'],_0x293790);_0x4abcb8(_0x3b8880['error'](0x1f4,_0x29b264[_0xa786('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4b8c8ec..347e096 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 _0x6fae=['/:id/descriptions','getDescriptions','post','create','put','delete','destroy','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x3d598b,_0x431fd7){var _0x29d91f=function(_0x20512f){while(--_0x20512f){_0x3d598b['push'](_0x3d598b['shift']());}};_0x29d91f(++_0x431fd7);}(_0x6fae,0x15b));var _0xe6fa=function(_0x4e3ad6,_0xd64999){_0x4e3ad6=_0x4e3ad6-0x0;var _0x5c9131=_0x6fae[_0x4e3ad6];return _0x5c9131;};'use strict';var multer=require('multer');var util=require(_0xe6fa('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe6fa('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6fa('0x2'));var interaction=require(_0xe6fa('0x3'));var config=require(_0xe6fa('0x4'));var controller=require('./intDynamics365Configuration.controller');router[_0xe6fa('0x5')]('/',auth[_0xe6fa('0x6')](),controller['index']);router[_0xe6fa('0x5')](_0xe6fa('0x7'),auth[_0xe6fa('0x6')](),controller[_0xe6fa('0x8')]);router[_0xe6fa('0x5')](_0xe6fa('0x9'),auth[_0xe6fa('0x6')](),controller[_0xe6fa('0xa')]);router[_0xe6fa('0x5')](_0xe6fa('0xb'),auth['isAuthenticated'](),controller[_0xe6fa('0xc')]);router[_0xe6fa('0x5')](_0xe6fa('0xd'),auth[_0xe6fa('0x6')](),controller[_0xe6fa('0xe')]);router[_0xe6fa('0xf')]('/',auth[_0xe6fa('0x6')](),controller[_0xe6fa('0x10')]);router[_0xe6fa('0x11')]('/:id',auth[_0xe6fa('0x6')](),controller['update']);router[_0xe6fa('0x12')]('/:id',auth[_0xe6fa('0x6')](),controller[_0xe6fa('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa72d=['isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x5134c7,_0x1d2de5){var _0x151312=function(_0x44d3c1){while(--_0x44d3c1){_0x5134c7['push'](_0x5134c7['shift']());}};_0x151312(++_0x1d2de5);}(_0xa72d,0x1bf));var _0xda72=function(_0x352570,_0x349450){_0x352570=_0x352570-0x0;var _0x4a8dd6=_0xa72d[_0x352570];return _0x4a8dd6;};'use strict';var multer=require(_0xda72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda72('0x1'));var express=require(_0xda72('0x2'));var router=express[_0xda72('0x3')]();var fs_extra=require(_0xda72('0x4'));var auth=require(_0xda72('0x5'));var interaction=require(_0xda72('0x6'));var config=require(_0xda72('0x7'));var controller=require(_0xda72('0x8'));router['get']('/',auth[_0xda72('0x9')](),controller[_0xda72('0xa')]);router[_0xda72('0xb')]('/:id',auth[_0xda72('0x9')](),controller[_0xda72('0xc')]);router[_0xda72('0xb')](_0xda72('0xd'),auth[_0xda72('0x9')](),controller[_0xda72('0xe')]);router[_0xda72('0xb')](_0xda72('0xf'),auth[_0xda72('0x9')](),controller['getSubjects']);router['get'](_0xda72('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xda72('0x11')]('/',auth[_0xda72('0x9')](),controller['create']);router[_0xda72('0x12')](_0xda72('0x13'),auth[_0xda72('0x9')](),controller[_0xda72('0x14')]);router[_0xda72('0x15')]('/:id',auth[_0xda72('0x9')](),controller[_0xda72('0x16')]);module[_0xda72('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 87c3ebe..c281e2a 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 _0xd739=['nothing','contact','exports','STRING','ENUM','phonecall'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd739,0xaa));var _0x9d73=function(_0xd9be2b,_0x38a45){_0xd9be2b=_0xd9be2b-0x0;var _0x4d9656=_0xd739[_0xd9be2b];return _0x4d9656;};'use strict';var Sequelize=require('sequelize');module[_0x9d73('0x0')]={'name':{'type':Sequelize[_0x9d73('0x1')]},'description':{'type':Sequelize[_0x9d73('0x1')]},'ticketType':{'type':Sequelize[_0x9d73('0x2')]('incident',_0x9d73('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x9d73('0x2')]('contact',_0x9d73('0x4')),'defaultValue':_0x9d73('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9d73('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6774=['sequelize','STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN'];(function(_0x1867b1,_0x426ad3){var _0x1b62a6=function(_0x2e5144){while(--_0x2e5144){_0x1867b1['push'](_0x1867b1['shift']());}};_0x1b62a6(++_0x426ad3);}(_0x6774,0x1e0));var _0x4677=function(_0x2b6c93,_0x398ada){_0x2b6c93=_0x2b6c93-0x0;var _0x48f27a=_0x6774[_0x2b6c93];return _0x48f27a;};'use strict';var Sequelize=require(_0x4677('0x0'));module['exports']={'name':{'type':Sequelize[_0x4677('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4677('0x2')](_0x4677('0x3'),_0x4677('0x4')),'defaultValue':_0x4677('0x3')},'moduleCreate':{'type':Sequelize[_0x4677('0x2')](_0x4677('0x5'),_0x4677('0x6')),'defaultValue':_0x4677('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x4677('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x4677('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 06b8c14..3456cca 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 _0x3074=['body','getFields','findOne','Dynamics365Field','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','Dynamics365Configuration','findAll','rows','catch','show','params','merge','find','create'];(function(_0x37253c,_0x5a9041){var _0x4f0157=function(_0x2c9344){while(--_0x2c9344){_0x37253c['push'](_0x37253c['shift']());}};_0x4f0157(++_0x5a9041);}(_0x3074,0xa7));var _0x4307=function(_0x4fe711,_0x5125e9){_0x4fe711=_0x4fe711-0x0;var _0x3db623=_0x3074[_0x4fe711];return _0x3db623;};'use strict';var emlformat=require(_0x4307('0x0'));var rimraf=require(_0x4307('0x1'));var zipdir=require(_0x4307('0x2'));var jsonpatch=require(_0x4307('0x3'));var rp=require(_0x4307('0x4'));var moment=require('moment');var BPromise=require(_0x4307('0x5'));var Mustache=require('mustache');var util=require(_0x4307('0x6'));var path=require('path');var sox=require(_0x4307('0x7'));var csv=require(_0x4307('0x8'));var ejs=require(_0x4307('0x9'));var fs=require('fs');var fs_extra=require(_0x4307('0xa'));var _=require('lodash');var squel=require(_0x4307('0xb'));var crypto=require(_0x4307('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4307('0xd'));var toCsv=require(_0x4307('0x8'));var querystring=require(_0x4307('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4307('0xf'));var qs=require(_0x4307('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4307('0x11'));var logger=require(_0x4307('0x12'))('api');var utils=require(_0x4307('0x13'));var config=require(_0x4307('0x14'));var licenseUtil=require(_0x4307('0x15'));var db=require(_0x4307('0x16'))['db'];function respondWithStatusCode(_0x33b472,_0x3ed930){_0x3ed930=_0x3ed930||0xcc;return function(_0x3c07df){if(_0x3c07df){return _0x33b472['sendStatus'](_0x3ed930);}return _0x33b472[_0x4307('0x17')](_0x3ed930)[_0x4307('0x18')]();};}function respondWithResult(_0x37cd98,_0x23ce93){_0x23ce93=_0x23ce93||0xc8;return function(_0x476cc3){if(_0x476cc3){return _0x37cd98[_0x4307('0x17')](_0x23ce93)[_0x4307('0x19')](_0x476cc3);}};}function respondWithFilteredResult(_0x1dbc4c,_0x3d9ce8){return function(_0x337918){if(_0x337918){var _0x5f4439=typeof _0x3d9ce8[_0x4307('0x1a')]===_0x4307('0x1b')&&typeof _0x3d9ce8[_0x4307('0x1c')]===_0x4307('0x1b');var _0x40a2fc=_0x337918[_0x4307('0x1d')];var _0x109a67=_0x5f4439?0x0:_0x3d9ce8[_0x4307('0x1a')];var _0x1ce066=_0x5f4439?_0x337918[_0x4307('0x1d')]:_0x3d9ce8[_0x4307('0x1a')]+_0x3d9ce8[_0x4307('0x1c')];var _0x4597bb;if(_0x1ce066>=_0x40a2fc){_0x1ce066=_0x40a2fc;_0x4597bb=0xc8;}else{_0x4597bb=0xce;}_0x1dbc4c['status'](_0x4597bb);return _0x1dbc4c[_0x4307('0x1e')](_0x4307('0x1f'),_0x109a67+'-'+_0x1ce066+'/'+_0x40a2fc)[_0x4307('0x19')](_0x337918);}return null;};}function patchUpdates(_0x18da2d){return function(_0x543459){try{jsonpatch[_0x4307('0x20')](_0x543459,_0x18da2d,!![]);}catch(_0x13bba9){return BPromise[_0x4307('0x21')](_0x13bba9);}return _0x543459[_0x4307('0x22')]();};}function saveUpdates(_0x220965,_0x342468){return function(_0x212b8e){if(_0x212b8e){return _0x212b8e[_0x4307('0x23')](_0x220965)['then'](function(_0x2e7fe8){return _0x2e7fe8;});}return null;};}function removeEntity(_0x2a169c,_0x1ff65d){return function(_0x162571){if(_0x162571){return _0x162571[_0x4307('0x24')]()[_0x4307('0x25')](function(){_0x2a169c[_0x4307('0x17')](0xcc)[_0x4307('0x18')]();});}};}function handleEntityNotFound(_0x4da2f3,_0x367349){return function(_0x237fdb){if(!_0x237fdb){_0x4da2f3[_0x4307('0x26')](0x194);}return _0x237fdb;};}function handleError(_0x526148,_0x5e39b5){_0x5e39b5=_0x5e39b5||0x1f4;return function(_0x50c0b1){logger['error'](_0x50c0b1[_0x4307('0x27')]);if(_0x50c0b1[_0x4307('0x28')]){delete _0x50c0b1[_0x4307('0x28')];}_0x526148['status'](_0x5e39b5)['send'](_0x50c0b1);};}exports[_0x4307('0x29')]=function(_0x312baa,_0x5d59f1){var _0x3f70c1={},_0x3f3b02={},_0x3d9890={'count':0x0,'rows':[]};var _0x402d65=_['map'](db['Dynamics365Configuration'][_0x4307('0x2a')],function(_0x2f187b){return{'name':_0x2f187b[_0x4307('0x2b')],'type':_0x2f187b[_0x4307('0x2c')]['key']};});_0x3f3b02[_0x4307('0x2d')]=_[_0x4307('0x2e')](_0x402d65,'name');_0x3f3b02[_0x4307('0x2f')]=_[_0x4307('0x30')](_0x312baa[_0x4307('0x2f')]);_0x3f3b02[_0x4307('0x31')]=_[_0x4307('0x32')](_0x3f3b02['model'],_0x3f3b02[_0x4307('0x2f')]);_0x3f70c1[_0x4307('0x33')]=_[_0x4307('0x32')](_0x3f3b02[_0x4307('0x2d')],qs[_0x4307('0x34')](_0x312baa[_0x4307('0x2f')]['fields']));_0x3f70c1[_0x4307('0x33')]=_0x3f70c1[_0x4307('0x33')][_0x4307('0x35')]?_0x3f70c1['attributes']:_0x3f3b02[_0x4307('0x2d')];if(!_0x312baa[_0x4307('0x2f')][_0x4307('0x36')](_0x4307('0x37'))){_0x3f70c1[_0x4307('0x1c')]=qs['limit'](_0x312baa[_0x4307('0x2f')]['limit']);_0x3f70c1[_0x4307('0x1a')]=qs[_0x4307('0x1a')](_0x312baa[_0x4307('0x2f')]['offset']);}_0x3f70c1[_0x4307('0x38')]=qs[_0x4307('0x39')](_0x312baa[_0x4307('0x2f')]['sort']);_0x3f70c1[_0x4307('0x3a')]=qs[_0x4307('0x31')](_['pick'](_0x312baa[_0x4307('0x2f')],_0x3f3b02[_0x4307('0x31')]),_0x402d65);if(_0x312baa[_0x4307('0x2f')][_0x4307('0x3b')]){_0x3f70c1['where']=_['merge'](_0x3f70c1[_0x4307('0x3a')],{'$or':_['map'](_0x402d65,function(_0x51f89e){if(_0x51f89e[_0x4307('0x2c')]!==_0x4307('0x3c')){var _0x2f6116={};_0x2f6116[_0x51f89e[_0x4307('0x28')]]={'$like':'%'+_0x312baa[_0x4307('0x2f')][_0x4307('0x3b')]+'%'};return _0x2f6116;}})});}_0x3f70c1=_['merge']({},_0x3f70c1,_0x312baa[_0x4307('0x3d')]);var _0x6dfef3={'where':_0x3f70c1['where']};return db['Dynamics365Configuration'][_0x4307('0x1d')](_0x6dfef3)[_0x4307('0x25')](function(_0x20a78f){_0x3d9890['count']=_0x20a78f;if(_0x312baa[_0x4307('0x2f')][_0x4307('0x3e')]){_0x3f70c1[_0x4307('0x3f')]=[{'all':!![]}];}return db[_0x4307('0x40')][_0x4307('0x41')](_0x3f70c1);})['then'](function(_0x193cfd){_0x3d9890[_0x4307('0x42')]=_0x193cfd;return _0x3d9890;})[_0x4307('0x25')](respondWithFilteredResult(_0x5d59f1,_0x3f70c1))[_0x4307('0x43')](handleError(_0x5d59f1,null));};exports[_0x4307('0x44')]=function(_0x26c067,_0x39a2e4){var _0x1605d9={'raw':![],'where':{'id':_0x26c067[_0x4307('0x45')]['id']}},_0x185bf0={};_0x185bf0[_0x4307('0x2d')]=_[_0x4307('0x30')](db[_0x4307('0x40')][_0x4307('0x2a')]);_0x185bf0[_0x4307('0x2f')]=_[_0x4307('0x30')](_0x26c067[_0x4307('0x2f')]);_0x185bf0[_0x4307('0x31')]=_[_0x4307('0x32')](_0x185bf0['model'],_0x185bf0['query']);_0x1605d9[_0x4307('0x33')]=_[_0x4307('0x32')](_0x185bf0['model'],qs['fields'](_0x26c067['query']['fields']));_0x1605d9[_0x4307('0x33')]=_0x1605d9[_0x4307('0x33')][_0x4307('0x35')]?_0x1605d9['attributes']:_0x185bf0[_0x4307('0x2d')];if(_0x26c067[_0x4307('0x2f')][_0x4307('0x3e')]){_0x1605d9[_0x4307('0x3f')]=[{'all':!![]}];}_0x1605d9=_[_0x4307('0x46')]({},_0x1605d9,_0x26c067[_0x4307('0x3d')]);return db[_0x4307('0x40')][_0x4307('0x47')](_0x1605d9)[_0x4307('0x25')](handleEntityNotFound(_0x39a2e4,null))['then'](respondWithResult(_0x39a2e4,null))['catch'](handleError(_0x39a2e4,null));};exports[_0x4307('0x48')]=function(_0x1ffd39,_0x433fb2){return db[_0x4307('0x40')][_0x4307('0x48')](_0x1ffd39[_0x4307('0x49')],{})['then'](respondWithResult(_0x433fb2,0xc9))[_0x4307('0x43')](handleError(_0x433fb2,null));};exports[_0x4307('0x23')]=function(_0x36bca9,_0x4542ba){if(_0x36bca9['body']['id']){delete _0x36bca9[_0x4307('0x49')]['id'];}return db[_0x4307('0x40')]['find']({'where':{'id':_0x36bca9[_0x4307('0x45')]['id']}})[_0x4307('0x25')](handleEntityNotFound(_0x4542ba,null))[_0x4307('0x25')](saveUpdates(_0x36bca9[_0x4307('0x49')],null))[_0x4307('0x25')](respondWithResult(_0x4542ba,null))[_0x4307('0x43')](handleError(_0x4542ba,null));};exports[_0x4307('0x24')]=function(_0x44f0df,_0x265116){return db['Dynamics365Configuration'][_0x4307('0x47')]({'where':{'id':_0x44f0df['params']['id']}})['then'](handleEntityNotFound(_0x265116,null))[_0x4307('0x25')](removeEntity(_0x265116,null))[_0x4307('0x43')](handleError(_0x265116,null));};exports[_0x4307('0x4a')]=function(_0x3ceb42,_0x172653,_0x49475b){var _0x450949={};var _0x28d85b={};var _0x3e14f7;var _0x137b10;return db[_0x4307('0x40')][_0x4307('0x4b')]({'where':{'id':_0x3ceb42[_0x4307('0x45')]['id']}})[_0x4307('0x25')](handleEntityNotFound(_0x172653,null))[_0x4307('0x25')](function(_0x7dd022){if(_0x7dd022){_0x3e14f7=_0x7dd022;_0x28d85b[_0x4307('0x2d')]=_[_0x4307('0x30')](db[_0x4307('0x4c')]['rawAttributes']);_0x28d85b[_0x4307('0x2f')]=_[_0x4307('0x30')](_0x3ceb42['query']);_0x28d85b[_0x4307('0x31')]=_[_0x4307('0x32')](_0x28d85b['model'],_0x28d85b[_0x4307('0x2f')]);_0x450949[_0x4307('0x33')]=_[_0x4307('0x32')](_0x28d85b[_0x4307('0x2d')],qs['fields'](_0x3ceb42[_0x4307('0x2f')][_0x4307('0x34')]));_0x450949[_0x4307('0x33')]=_0x450949[_0x4307('0x33')][_0x4307('0x35')]?_0x450949[_0x4307('0x33')]:_0x28d85b[_0x4307('0x2d')];_0x450949[_0x4307('0x38')]=qs[_0x4307('0x39')](_0x3ceb42[_0x4307('0x2f')][_0x4307('0x39')]);_0x450949[_0x4307('0x3a')]=qs['filters'](_['pick'](_0x3ceb42[_0x4307('0x2f')],_0x28d85b['filters']));if(_0x3ceb42[_0x4307('0x2f')][_0x4307('0x3b')]){_0x450949[_0x4307('0x3a')]=_[_0x4307('0x46')](_0x450949[_0x4307('0x3a')],{'$or':_[_0x4307('0x2e')](_0x450949[_0x4307('0x33')],function(_0x4590ad){var _0x5d45c7={};_0x5d45c7[_0x4590ad]={'$like':'%'+_0x3ceb42['query'][_0x4307('0x3b')]+'%'};return _0x5d45c7;})});}_0x450949=_[_0x4307('0x46')]({},_0x450949,_0x3ceb42[_0x4307('0x3d')]);return _0x3e14f7[_0x4307('0x4a')](_0x450949);}})['then'](function(_0x26d2c9){if(_0x26d2c9){_0x137b10=_0x26d2c9['length'];if(!_0x3ceb42[_0x4307('0x2f')][_0x4307('0x36')]('nolimit')){_0x450949[_0x4307('0x1c')]=qs['limit'](_0x3ceb42[_0x4307('0x2f')]['limit']);_0x450949[_0x4307('0x1a')]=qs['offset'](_0x3ceb42[_0x4307('0x2f')][_0x4307('0x1a')]);}return _0x3e14f7[_0x4307('0x4a')](_0x450949);}})[_0x4307('0x25')](function(_0x6f6786){if(_0x6f6786){return _0x6f6786?{'count':_0x137b10,'rows':_0x6f6786}:null;}})[_0x4307('0x25')](respondWithResult(_0x172653,null))[_0x4307('0x43')](handleError(_0x172653,null));};exports[_0x4307('0x4d')]=function(_0x4a594e,_0x2299de,_0x218169){var _0x181094={};var _0x3512ce={};var _0x36f84a;var _0x441776;return db['Dynamics365Configuration'][_0x4307('0x4b')]({'where':{'id':_0x4a594e[_0x4307('0x45')]['id']}})[_0x4307('0x25')](handleEntityNotFound(_0x2299de,null))[_0x4307('0x25')](function(_0x17228a){if(_0x17228a){_0x36f84a=_0x17228a;_0x3512ce[_0x4307('0x2d')]=_[_0x4307('0x30')](db['Dynamics365Field'][_0x4307('0x2a')]);_0x3512ce[_0x4307('0x2f')]=_['keys'](_0x4a594e[_0x4307('0x2f')]);_0x3512ce[_0x4307('0x31')]=_[_0x4307('0x32')](_0x3512ce[_0x4307('0x2d')],_0x3512ce[_0x4307('0x2f')]);_0x181094[_0x4307('0x33')]=_[_0x4307('0x32')](_0x3512ce[_0x4307('0x2d')],qs[_0x4307('0x34')](_0x4a594e[_0x4307('0x2f')][_0x4307('0x34')]));_0x181094[_0x4307('0x33')]=_0x181094[_0x4307('0x33')][_0x4307('0x35')]?_0x181094[_0x4307('0x33')]:_0x3512ce[_0x4307('0x2d')];_0x181094[_0x4307('0x38')]=qs[_0x4307('0x39')](_0x4a594e['query']['sort']);_0x181094[_0x4307('0x3a')]=qs[_0x4307('0x31')](_[_0x4307('0x4e')](_0x4a594e['query'],_0x3512ce[_0x4307('0x31')]));if(_0x4a594e['query'][_0x4307('0x3b')]){_0x181094[_0x4307('0x3a')]=_['merge'](_0x181094[_0x4307('0x3a')],{'$or':_[_0x4307('0x2e')](_0x181094['attributes'],function(_0x30332a){var _0x5e4eb9={};_0x5e4eb9[_0x30332a]={'$like':'%'+_0x4a594e[_0x4307('0x2f')]['filter']+'%'};return _0x5e4eb9;})});}_0x181094=_[_0x4307('0x46')]({},_0x181094,_0x4a594e[_0x4307('0x3d')]);return _0x36f84a[_0x4307('0x4d')](_0x181094);}})['then'](function(_0x162ba0){if(_0x162ba0){_0x441776=_0x162ba0[_0x4307('0x35')];if(!_0x4a594e[_0x4307('0x2f')][_0x4307('0x36')](_0x4307('0x37'))){_0x181094[_0x4307('0x1c')]=qs[_0x4307('0x1c')](_0x4a594e[_0x4307('0x2f')][_0x4307('0x1c')]);_0x181094[_0x4307('0x1a')]=qs[_0x4307('0x1a')](_0x4a594e[_0x4307('0x2f')][_0x4307('0x1a')]);}return _0x36f84a[_0x4307('0x4d')](_0x181094);}})[_0x4307('0x25')](function(_0x4a94e6){if(_0x4a94e6){return _0x4a94e6?{'count':_0x441776,'rows':_0x4a94e6}:null;}})[_0x4307('0x25')](respondWithResult(_0x2299de,null))[_0x4307('0x43')](handleError(_0x2299de,null));};exports[_0x4307('0x4f')]=function(_0x5b9c30,_0x2f65f1,_0x50c034){var _0x1cd79d={};var _0x46cf49={};var _0x1a48a3;var _0x550b7f;return db[_0x4307('0x40')][_0x4307('0x4b')]({'where':{'id':_0x5b9c30['params']['id']}})[_0x4307('0x25')](handleEntityNotFound(_0x2f65f1,null))[_0x4307('0x25')](function(_0x5f3259){if(_0x5f3259){_0x1a48a3=_0x5f3259;_0x46cf49[_0x4307('0x2d')]=_['keys'](db[_0x4307('0x4c')][_0x4307('0x2a')]);_0x46cf49[_0x4307('0x2f')]=_[_0x4307('0x30')](_0x5b9c30[_0x4307('0x2f')]);_0x46cf49[_0x4307('0x31')]=_[_0x4307('0x32')](_0x46cf49[_0x4307('0x2d')],_0x46cf49[_0x4307('0x2f')]);_0x1cd79d[_0x4307('0x33')]=_[_0x4307('0x32')](_0x46cf49['model'],qs[_0x4307('0x34')](_0x5b9c30[_0x4307('0x2f')][_0x4307('0x34')]));_0x1cd79d[_0x4307('0x33')]=_0x1cd79d[_0x4307('0x33')][_0x4307('0x35')]?_0x1cd79d[_0x4307('0x33')]:_0x46cf49['model'];_0x1cd79d[_0x4307('0x38')]=qs[_0x4307('0x39')](_0x5b9c30[_0x4307('0x2f')][_0x4307('0x39')]);_0x1cd79d[_0x4307('0x3a')]=qs[_0x4307('0x31')](_[_0x4307('0x4e')](_0x5b9c30[_0x4307('0x2f')],_0x46cf49[_0x4307('0x31')]));if(_0x5b9c30[_0x4307('0x2f')][_0x4307('0x3b')]){_0x1cd79d[_0x4307('0x3a')]=_[_0x4307('0x46')](_0x1cd79d['where'],{'$or':_[_0x4307('0x2e')](_0x1cd79d[_0x4307('0x33')],function(_0x526dee){var _0x4e1de5={};_0x4e1de5[_0x526dee]={'$like':'%'+_0x5b9c30[_0x4307('0x2f')][_0x4307('0x3b')]+'%'};return _0x4e1de5;})});}_0x1cd79d=_[_0x4307('0x46')]({},_0x1cd79d,_0x5b9c30[_0x4307('0x3d')]);return _0x1a48a3[_0x4307('0x4f')](_0x1cd79d);}})[_0x4307('0x25')](function(_0x2e0be3){if(_0x2e0be3){_0x550b7f=_0x2e0be3['length'];if(!_0x5b9c30[_0x4307('0x2f')][_0x4307('0x36')]('nolimit')){_0x1cd79d['limit']=qs['limit'](_0x5b9c30[_0x4307('0x2f')][_0x4307('0x1c')]);_0x1cd79d['offset']=qs[_0x4307('0x1a')](_0x5b9c30[_0x4307('0x2f')][_0x4307('0x1a')]);}return _0x1a48a3[_0x4307('0x4f')](_0x1cd79d);}})['then'](function(_0x47213d){if(_0x47213d){return _0x47213d?{'count':_0x550b7f,'rows':_0x47213d}:null;}})['then'](respondWithResult(_0x2f65f1,null))[_0x4307('0x43')](handleError(_0x2f65f1,null));}; \ No newline at end of file +var _0x0e51=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','options','includeAll','include','rows','catch','params','rawAttributes','merge','find','create','update','body','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2946f2,_0x3ca115){var _0x510c26=function(_0x399acf){while(--_0x399acf){_0x2946f2['push'](_0x2946f2['shift']());}};_0x510c26(++_0x3ca115);}(_0x0e51,0x8e));var _0x10e5=function(_0x3d08fa,_0x5d4047){_0x3d08fa=_0x3d08fa-0x0;var _0x34fab6=_0x0e51[_0x3d08fa];return _0x34fab6;};'use strict';var emlformat=require(_0x10e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10e5('0x1'));var jsonpatch=require(_0x10e5('0x2'));var rp=require(_0x10e5('0x3'));var moment=require(_0x10e5('0x4'));var BPromise=require(_0x10e5('0x5'));var Mustache=require(_0x10e5('0x6'));var util=require('util');var path=require(_0x10e5('0x7'));var sox=require(_0x10e5('0x8'));var csv=require(_0x10e5('0x9'));var ejs=require(_0x10e5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x10e5('0xb'));var crypto=require(_0x10e5('0xc'));var jsforce=require(_0x10e5('0xd'));var deskjs=require(_0x10e5('0xe'));var toCsv=require(_0x10e5('0x9'));var querystring=require(_0x10e5('0xf'));var Papa=require(_0x10e5('0x10'));var Redis=require(_0x10e5('0x11'));var authService=require(_0x10e5('0x12'));var qs=require(_0x10e5('0x13'));var as=require(_0x10e5('0x14'));var hardwareService=require(_0x10e5('0x15'));var logger=require('../../config/logger')(_0x10e5('0x16'));var utils=require(_0x10e5('0x17'));var config=require(_0x10e5('0x18'));var licenseUtil=require(_0x10e5('0x19'));var db=require(_0x10e5('0x1a'))['db'];function respondWithStatusCode(_0x2d0997,_0x5bfc7c){_0x5bfc7c=_0x5bfc7c||0xcc;return function(_0x3cf23f){if(_0x3cf23f){return _0x2d0997['sendStatus'](_0x5bfc7c);}return _0x2d0997[_0x10e5('0x1b')](_0x5bfc7c)[_0x10e5('0x1c')]();};}function respondWithResult(_0x4c887c,_0x344c70){_0x344c70=_0x344c70||0xc8;return function(_0x10ea47){if(_0x10ea47){return _0x4c887c['status'](_0x344c70)[_0x10e5('0x1d')](_0x10ea47);}};}function respondWithFilteredResult(_0x30f3d2,_0x224708){return function(_0x2bd8e9){if(_0x2bd8e9){var _0x2cd974=typeof _0x224708[_0x10e5('0x1e')]===_0x10e5('0x1f')&&typeof _0x224708[_0x10e5('0x20')]===_0x10e5('0x1f');var _0x295adc=_0x2bd8e9['count'];var _0x5d51d0=_0x2cd974?0x0:_0x224708[_0x10e5('0x1e')];var _0x2b5276=_0x2cd974?_0x2bd8e9[_0x10e5('0x21')]:_0x224708[_0x10e5('0x1e')]+_0x224708['limit'];var _0x21d41d;if(_0x2b5276>=_0x295adc){_0x2b5276=_0x295adc;_0x21d41d=0xc8;}else{_0x21d41d=0xce;}_0x30f3d2['status'](_0x21d41d);return _0x30f3d2[_0x10e5('0x22')]('Content-Range',_0x5d51d0+'-'+_0x2b5276+'/'+_0x295adc)[_0x10e5('0x1d')](_0x2bd8e9);}return null;};}function patchUpdates(_0x2a213f){return function(_0x29e766){try{jsonpatch['apply'](_0x29e766,_0x2a213f,!![]);}catch(_0x243a64){return BPromise[_0x10e5('0x23')](_0x243a64);}return _0x29e766['save']();};}function saveUpdates(_0x1aef7a,_0x3b270d){return function(_0x2136cc){if(_0x2136cc){return _0x2136cc['update'](_0x1aef7a)[_0x10e5('0x24')](function(_0x5ab187){return _0x5ab187;});}return null;};}function removeEntity(_0x2b076a,_0x34ebdc){return function(_0x35948b){if(_0x35948b){return _0x35948b[_0x10e5('0x25')]()['then'](function(){_0x2b076a[_0x10e5('0x1b')](0xcc)[_0x10e5('0x1c')]();});}};}function handleEntityNotFound(_0x4caafc,_0x3cc8c0){return function(_0x5df79b){if(!_0x5df79b){_0x4caafc[_0x10e5('0x26')](0x194);}return _0x5df79b;};}function handleError(_0x4a3d4e,_0x198848){_0x198848=_0x198848||0x1f4;return function(_0xbf3959){logger[_0x10e5('0x27')](_0xbf3959[_0x10e5('0x28')]);if(_0xbf3959['name']){delete _0xbf3959[_0x10e5('0x29')];}_0x4a3d4e['status'](_0x198848)[_0x10e5('0x2a')](_0xbf3959);};}exports[_0x10e5('0x2b')]=function(_0x4bddda,_0xe185cb){var _0x4eab43={},_0x3c80e0={},_0x2b0486={'count':0x0,'rows':[]};var _0x514018=_[_0x10e5('0x2c')](db[_0x10e5('0x2d')]['rawAttributes'],function(_0x17b431){return{'name':_0x17b431['fieldName'],'type':_0x17b431[_0x10e5('0x2e')][_0x10e5('0x2f')]};});_0x3c80e0['model']=_[_0x10e5('0x2c')](_0x514018,'name');_0x3c80e0[_0x10e5('0x30')]=_[_0x10e5('0x31')](_0x4bddda[_0x10e5('0x30')]);_0x3c80e0['filters']=_['intersection'](_0x3c80e0[_0x10e5('0x32')],_0x3c80e0[_0x10e5('0x30')]);_0x4eab43[_0x10e5('0x33')]=_[_0x10e5('0x34')](_0x3c80e0[_0x10e5('0x32')],qs[_0x10e5('0x35')](_0x4bddda[_0x10e5('0x30')][_0x10e5('0x35')]));_0x4eab43['attributes']=_0x4eab43['attributes'][_0x10e5('0x36')]?_0x4eab43[_0x10e5('0x33')]:_0x3c80e0['model'];if(!_0x4bddda[_0x10e5('0x30')][_0x10e5('0x37')](_0x10e5('0x38'))){_0x4eab43['limit']=qs['limit'](_0x4bddda['query']['limit']);_0x4eab43[_0x10e5('0x1e')]=qs[_0x10e5('0x1e')](_0x4bddda[_0x10e5('0x30')][_0x10e5('0x1e')]);}_0x4eab43['order']=qs['sort'](_0x4bddda[_0x10e5('0x30')][_0x10e5('0x39')]);_0x4eab43[_0x10e5('0x3a')]=qs[_0x10e5('0x3b')](_[_0x10e5('0x3c')](_0x4bddda[_0x10e5('0x30')],_0x3c80e0['filters']),_0x514018);if(_0x4bddda[_0x10e5('0x30')][_0x10e5('0x3d')]){_0x4eab43[_0x10e5('0x3a')]=_['merge'](_0x4eab43['where'],{'$or':_[_0x10e5('0x2c')](_0x514018,function(_0x312c67){if(_0x312c67[_0x10e5('0x2e')]!=='VIRTUAL'){var _0x1f44e8={};_0x1f44e8[_0x312c67[_0x10e5('0x29')]]={'$like':'%'+_0x4bddda[_0x10e5('0x30')]['filter']+'%'};return _0x1f44e8;}})});}_0x4eab43=_['merge']({},_0x4eab43,_0x4bddda[_0x10e5('0x3e')]);var _0x593f53={'where':_0x4eab43[_0x10e5('0x3a')]};return db['Dynamics365Configuration'][_0x10e5('0x21')](_0x593f53)[_0x10e5('0x24')](function(_0x3dcad7){_0x2b0486[_0x10e5('0x21')]=_0x3dcad7;if(_0x4bddda[_0x10e5('0x30')][_0x10e5('0x3f')]){_0x4eab43[_0x10e5('0x40')]=[{'all':!![]}];}return db[_0x10e5('0x2d')]['findAll'](_0x4eab43);})[_0x10e5('0x24')](function(_0x38f639){_0x2b0486[_0x10e5('0x41')]=_0x38f639;return _0x2b0486;})[_0x10e5('0x24')](respondWithFilteredResult(_0xe185cb,_0x4eab43))[_0x10e5('0x42')](handleError(_0xe185cb,null));};exports['show']=function(_0x41539e,_0x50185e){var _0x4d3a51={'raw':![],'where':{'id':_0x41539e[_0x10e5('0x43')]['id']}},_0x515297={};_0x515297[_0x10e5('0x32')]=_[_0x10e5('0x31')](db[_0x10e5('0x2d')][_0x10e5('0x44')]);_0x515297[_0x10e5('0x30')]=_['keys'](_0x41539e[_0x10e5('0x30')]);_0x515297['filters']=_[_0x10e5('0x34')](_0x515297['model'],_0x515297['query']);_0x4d3a51[_0x10e5('0x33')]=_[_0x10e5('0x34')](_0x515297['model'],qs[_0x10e5('0x35')](_0x41539e[_0x10e5('0x30')][_0x10e5('0x35')]));_0x4d3a51[_0x10e5('0x33')]=_0x4d3a51['attributes'][_0x10e5('0x36')]?_0x4d3a51[_0x10e5('0x33')]:_0x515297[_0x10e5('0x32')];if(_0x41539e[_0x10e5('0x30')][_0x10e5('0x3f')]){_0x4d3a51[_0x10e5('0x40')]=[{'all':!![]}];}_0x4d3a51=_[_0x10e5('0x45')]({},_0x4d3a51,_0x41539e[_0x10e5('0x3e')]);return db[_0x10e5('0x2d')][_0x10e5('0x46')](_0x4d3a51)[_0x10e5('0x24')](handleEntityNotFound(_0x50185e,null))[_0x10e5('0x24')](respondWithResult(_0x50185e,null))['catch'](handleError(_0x50185e,null));};exports[_0x10e5('0x47')]=function(_0x36d980,_0x16a6a0){return db[_0x10e5('0x2d')]['create'](_0x36d980['body'],{})['then'](respondWithResult(_0x16a6a0,0xc9))[_0x10e5('0x42')](handleError(_0x16a6a0,null));};exports[_0x10e5('0x48')]=function(_0x50f27e,_0x487e75){if(_0x50f27e[_0x10e5('0x49')]['id']){delete _0x50f27e['body']['id'];}return db[_0x10e5('0x2d')][_0x10e5('0x46')]({'where':{'id':_0x50f27e[_0x10e5('0x43')]['id']}})[_0x10e5('0x24')](handleEntityNotFound(_0x487e75,null))['then'](saveUpdates(_0x50f27e['body'],null))['then'](respondWithResult(_0x487e75,null))[_0x10e5('0x42')](handleError(_0x487e75,null));};exports['destroy']=function(_0xcfc181,_0x247aa2){return db[_0x10e5('0x2d')][_0x10e5('0x46')]({'where':{'id':_0xcfc181['params']['id']}})[_0x10e5('0x24')](handleEntityNotFound(_0x247aa2,null))['then'](removeEntity(_0x247aa2,null))[_0x10e5('0x42')](handleError(_0x247aa2,null));};exports[_0x10e5('0x4a')]=function(_0x15e9c5,_0xfa8803,_0x460aea){var _0x498e0a={};var _0x368f54={};var _0x1fcd82;var _0x4776a9;return db[_0x10e5('0x2d')][_0x10e5('0x4b')]({'where':{'id':_0x15e9c5['params']['id']}})['then'](handleEntityNotFound(_0xfa8803,null))['then'](function(_0x4829da){if(_0x4829da){_0x1fcd82=_0x4829da;_0x368f54[_0x10e5('0x32')]=_[_0x10e5('0x31')](db[_0x10e5('0x4c')][_0x10e5('0x44')]);_0x368f54[_0x10e5('0x30')]=_[_0x10e5('0x31')](_0x15e9c5['query']);_0x368f54[_0x10e5('0x3b')]=_['intersection'](_0x368f54[_0x10e5('0x32')],_0x368f54['query']);_0x498e0a[_0x10e5('0x33')]=_['intersection'](_0x368f54[_0x10e5('0x32')],qs[_0x10e5('0x35')](_0x15e9c5['query'][_0x10e5('0x35')]));_0x498e0a[_0x10e5('0x33')]=_0x498e0a[_0x10e5('0x33')][_0x10e5('0x36')]?_0x498e0a[_0x10e5('0x33')]:_0x368f54[_0x10e5('0x32')];_0x498e0a[_0x10e5('0x4d')]=qs[_0x10e5('0x39')](_0x15e9c5['query'][_0x10e5('0x39')]);_0x498e0a[_0x10e5('0x3a')]=qs[_0x10e5('0x3b')](_[_0x10e5('0x3c')](_0x15e9c5[_0x10e5('0x30')],_0x368f54[_0x10e5('0x3b')]));if(_0x15e9c5[_0x10e5('0x30')]['filter']){_0x498e0a['where']=_[_0x10e5('0x45')](_0x498e0a[_0x10e5('0x3a')],{'$or':_[_0x10e5('0x2c')](_0x498e0a[_0x10e5('0x33')],function(_0xcbada){var _0x34f472={};_0x34f472[_0xcbada]={'$like':'%'+_0x15e9c5['query'][_0x10e5('0x3d')]+'%'};return _0x34f472;})});}_0x498e0a=_[_0x10e5('0x45')]({},_0x498e0a,_0x15e9c5[_0x10e5('0x3e')]);return _0x1fcd82[_0x10e5('0x4a')](_0x498e0a);}})[_0x10e5('0x24')](function(_0xe8030f){if(_0xe8030f){_0x4776a9=_0xe8030f[_0x10e5('0x36')];if(!_0x15e9c5[_0x10e5('0x30')]['hasOwnProperty']('nolimit')){_0x498e0a[_0x10e5('0x20')]=qs[_0x10e5('0x20')](_0x15e9c5[_0x10e5('0x30')][_0x10e5('0x20')]);_0x498e0a[_0x10e5('0x1e')]=qs[_0x10e5('0x1e')](_0x15e9c5[_0x10e5('0x30')][_0x10e5('0x1e')]);}return _0x1fcd82[_0x10e5('0x4a')](_0x498e0a);}})[_0x10e5('0x24')](function(_0x13e8cc){if(_0x13e8cc){return _0x13e8cc?{'count':_0x4776a9,'rows':_0x13e8cc}:null;}})[_0x10e5('0x24')](respondWithResult(_0xfa8803,null))[_0x10e5('0x42')](handleError(_0xfa8803,null));};exports[_0x10e5('0x4e')]=function(_0x9354cb,_0x47fa20,_0x2a6179){var _0x4cc019={};var _0x56bf62={};var _0x4ec85d;var _0x28e372;return db['Dynamics365Configuration'][_0x10e5('0x4b')]({'where':{'id':_0x9354cb['params']['id']}})[_0x10e5('0x24')](handleEntityNotFound(_0x47fa20,null))[_0x10e5('0x24')](function(_0x63b754){if(_0x63b754){_0x4ec85d=_0x63b754;_0x56bf62[_0x10e5('0x32')]=_[_0x10e5('0x31')](db['Dynamics365Field'][_0x10e5('0x44')]);_0x56bf62[_0x10e5('0x30')]=_[_0x10e5('0x31')](_0x9354cb[_0x10e5('0x30')]);_0x56bf62[_0x10e5('0x3b')]=_[_0x10e5('0x34')](_0x56bf62['model'],_0x56bf62[_0x10e5('0x30')]);_0x4cc019['attributes']=_['intersection'](_0x56bf62['model'],qs[_0x10e5('0x35')](_0x9354cb[_0x10e5('0x30')][_0x10e5('0x35')]));_0x4cc019[_0x10e5('0x33')]=_0x4cc019[_0x10e5('0x33')]['length']?_0x4cc019[_0x10e5('0x33')]:_0x56bf62[_0x10e5('0x32')];_0x4cc019[_0x10e5('0x4d')]=qs['sort'](_0x9354cb[_0x10e5('0x30')][_0x10e5('0x39')]);_0x4cc019[_0x10e5('0x3a')]=qs[_0x10e5('0x3b')](_[_0x10e5('0x3c')](_0x9354cb[_0x10e5('0x30')],_0x56bf62[_0x10e5('0x3b')]));if(_0x9354cb['query']['filter']){_0x4cc019[_0x10e5('0x3a')]=_[_0x10e5('0x45')](_0x4cc019[_0x10e5('0x3a')],{'$or':_[_0x10e5('0x2c')](_0x4cc019[_0x10e5('0x33')],function(_0x3da55b){var _0x28632a={};_0x28632a[_0x3da55b]={'$like':'%'+_0x9354cb[_0x10e5('0x30')][_0x10e5('0x3d')]+'%'};return _0x28632a;})});}_0x4cc019=_[_0x10e5('0x45')]({},_0x4cc019,_0x9354cb[_0x10e5('0x3e')]);return _0x4ec85d[_0x10e5('0x4e')](_0x4cc019);}})['then'](function(_0x43e64f){if(_0x43e64f){_0x28e372=_0x43e64f[_0x10e5('0x36')];if(!_0x9354cb[_0x10e5('0x30')][_0x10e5('0x37')](_0x10e5('0x38'))){_0x4cc019['limit']=qs[_0x10e5('0x20')](_0x9354cb['query'][_0x10e5('0x20')]);_0x4cc019['offset']=qs[_0x10e5('0x1e')](_0x9354cb[_0x10e5('0x30')][_0x10e5('0x1e')]);}return _0x4ec85d[_0x10e5('0x4e')](_0x4cc019);}})[_0x10e5('0x24')](function(_0x50154b){if(_0x50154b){return _0x50154b?{'count':_0x28e372,'rows':_0x50154b}:null;}})[_0x10e5('0x24')](respondWithResult(_0x47fa20,null))[_0x10e5('0x42')](handleError(_0x47fa20,null));};exports[_0x10e5('0x4f')]=function(_0x5976c7,_0x323437,_0x15ae4b){var _0xd15c74={};var _0x6c0037={};var _0x3150e7;var _0x173c0a;return db[_0x10e5('0x2d')][_0x10e5('0x4b')]({'where':{'id':_0x5976c7['params']['id']}})[_0x10e5('0x24')](handleEntityNotFound(_0x323437,null))[_0x10e5('0x24')](function(_0xe36ebd){if(_0xe36ebd){_0x3150e7=_0xe36ebd;_0x6c0037['model']=_['keys'](db[_0x10e5('0x4c')][_0x10e5('0x44')]);_0x6c0037['query']=_[_0x10e5('0x31')](_0x5976c7[_0x10e5('0x30')]);_0x6c0037['filters']=_['intersection'](_0x6c0037[_0x10e5('0x32')],_0x6c0037[_0x10e5('0x30')]);_0xd15c74[_0x10e5('0x33')]=_['intersection'](_0x6c0037[_0x10e5('0x32')],qs[_0x10e5('0x35')](_0x5976c7[_0x10e5('0x30')][_0x10e5('0x35')]));_0xd15c74[_0x10e5('0x33')]=_0xd15c74[_0x10e5('0x33')][_0x10e5('0x36')]?_0xd15c74[_0x10e5('0x33')]:_0x6c0037['model'];_0xd15c74[_0x10e5('0x4d')]=qs['sort'](_0x5976c7[_0x10e5('0x30')][_0x10e5('0x39')]);_0xd15c74[_0x10e5('0x3a')]=qs['filters'](_[_0x10e5('0x3c')](_0x5976c7[_0x10e5('0x30')],_0x6c0037['filters']));if(_0x5976c7[_0x10e5('0x30')][_0x10e5('0x3d')]){_0xd15c74[_0x10e5('0x3a')]=_[_0x10e5('0x45')](_0xd15c74[_0x10e5('0x3a')],{'$or':_[_0x10e5('0x2c')](_0xd15c74['attributes'],function(_0x189307){var _0x3dc25f={};_0x3dc25f[_0x189307]={'$like':'%'+_0x5976c7[_0x10e5('0x30')][_0x10e5('0x3d')]+'%'};return _0x3dc25f;})});}_0xd15c74=_[_0x10e5('0x45')]({},_0xd15c74,_0x5976c7[_0x10e5('0x3e')]);return _0x3150e7['getDescriptions'](_0xd15c74);}})[_0x10e5('0x24')](function(_0x91ad97){if(_0x91ad97){_0x173c0a=_0x91ad97['length'];if(!_0x5976c7[_0x10e5('0x30')]['hasOwnProperty'](_0x10e5('0x38'))){_0xd15c74[_0x10e5('0x20')]=qs[_0x10e5('0x20')](_0x5976c7[_0x10e5('0x30')][_0x10e5('0x20')]);_0xd15c74[_0x10e5('0x1e')]=qs['offset'](_0x5976c7['query'][_0x10e5('0x1e')]);}return _0x3150e7[_0x10e5('0x4f')](_0xd15c74);}})['then'](function(_0x24fb74){if(_0x24fb74){return _0x24fb74?{'count':_0x173c0a,'rows':_0x24fb74}:null;}})[_0x10e5('0x24')](respondWithResult(_0x323437,null))[_0x10e5('0x42')](handleError(_0x323437,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 7ddb83b..7e59cb8 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 _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5bef0b,_0x17f8ab){var _0x440fc9=function(_0x55ede0){while(--_0x55ede0){_0x5bef0b['push'](_0x5bef0b['shift']());}};_0x440fc9(++_0x17f8ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x214b2b,_0x1986db){var _0xae84ee=function(_0xe6aff0){while(--_0xe6aff0){_0x214b2b['push'](_0x214b2b['shift']());}};_0xae84ee(++_0x1986db);}(_0xa41a,0x6b));var _0xaa41=function(_0x1743eb,_0x36332c){_0x1743eb=_0x1743eb-0x0;var _0x11895d=_0xa41a[_0x1743eb];return _0x11895d;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 09568df..7bf123b 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 _0x216f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x216f,0x11a));var _0xf216=function(_0x2f0841,_0x2b67ec){_0x2f0841=_0x2f0841-0x0;var _0x38531d=_0x216f[_0x2f0841];return _0x38531d;};'use strict';var _=require(_0xf216('0x0'));var util=require('util');var moment=require(_0xf216('0x1'));var BPromise=require(_0xf216('0x2'));var rs=require(_0xf216('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf216('0x4'))['db'];var utils=require(_0xf216('0x5'));var logger=require(_0xf216('0x6'))(_0xf216('0x7'));var config=require(_0xf216('0x8'));var jayson=require(_0xf216('0x9'));var client=jayson[_0xf216('0xa')][_0xf216('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fd083,_0x2fb58e,_0x2463f9){return new BPromise(function(_0x1cd23c,_0x55844b){return client[_0xf216('0xc')](_0x1fd083,_0x2463f9)['then'](function(_0x37a6c0){logger[_0xf216('0xd')](_0xf216('0xe'),_0x2fb58e,'request\x20sent');logger[_0xf216('0xf')](_0xf216('0x10'),_0x2fb58e,_0xf216('0x11'),JSON[_0xf216('0x12')](_0x37a6c0));if(_0x37a6c0[_0xf216('0x13')]){if(_0x37a6c0[_0xf216('0x13')][_0xf216('0x14')]===0x1f4){logger['error'](_0xf216('0xe'),_0x2fb58e,_0x37a6c0[_0xf216('0x13')][_0xf216('0x15')]);return _0x55844b(_0x37a6c0[_0xf216('0x13')][_0xf216('0x15')]);}logger['error'](_0xf216('0xe'),_0x2fb58e,_0x37a6c0[_0xf216('0x13')]['message']);return _0x1cd23c(_0x37a6c0['error']['message']);}else{logger[_0xf216('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2fb58e,_0xf216('0x11'));_0x1cd23c(_0x37a6c0[_0xf216('0x16')]['message']);}})[_0xf216('0x17')](function(_0x269eb6){logger['error'](_0xf216('0xe'),_0x2fb58e,_0x269eb6);_0x55844b(_0x269eb6);});});} \ No newline at end of file +var _0x1022=['info','debug','request\x20sent','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3a8c49,_0x19a5b2){var _0x5cb9eb=function(_0x23c1dd){while(--_0x23c1dd){_0x3a8c49['push'](_0x3a8c49['shift']());}};_0x5cb9eb(++_0x19a5b2);}(_0x1022,0xcf));var _0x2102=function(_0x5d465d,_0x21b8ef){_0x5d465d=_0x5d465d-0x0;var _0x272927=_0x1022[_0x5d465d];return _0x272927;};'use strict';var _=require(_0x2102('0x0'));var util=require('util');var moment=require(_0x2102('0x1'));var BPromise=require(_0x2102('0x2'));var rs=require(_0x2102('0x3'));var fs=require('fs');var Redis=require(_0x2102('0x4'));var db=require(_0x2102('0x5'))['db'];var utils=require(_0x2102('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2102('0x7'));var jayson=require(_0x2102('0x8'));var client=jayson[_0x2102('0x9')][_0x2102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a06,_0x43a84d,_0x302814){return new BPromise(function(_0x1089b7,_0xabbf21){return client[_0x2102('0xb')](_0x227a06,_0x302814)[_0x2102('0xc')](function(_0x13a866){logger[_0x2102('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43a84d,'request\x20sent');logger[_0x2102('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x43a84d,_0x2102('0xf'),JSON[_0x2102('0x10')](_0x13a866));if(_0x13a866[_0x2102('0x11')]){if(_0x13a866[_0x2102('0x11')][_0x2102('0x12')]===0x1f4){logger[_0x2102('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43a84d,_0x13a866[_0x2102('0x11')][_0x2102('0x13')]);return _0xabbf21(_0x13a866['error']['message']);}logger[_0x2102('0x11')](_0x2102('0x14'),_0x43a84d,_0x13a866[_0x2102('0x11')]['message']);return _0x1089b7(_0x13a866[_0x2102('0x11')]['message']);}else{logger['info'](_0x2102('0x14'),_0x43a84d,_0x2102('0xf'));_0x1089b7(_0x13a866['result'][_0x2102('0x13')]);}})[_0x2102('0x15')](function(_0x4ad9d1){logger[_0x2102('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43a84d,_0x4ad9d1);_0xabbf21(_0x4ad9d1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 38b3604..792dfe2 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 _0x2a90=['/:id','isAuthenticated','post','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','index'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x2a90,0x18d));var _0x02a9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2a90[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x02a9('0x0'));var util=require(_0x02a9('0x1'));var path=require(_0x02a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x02a9('0x3'));var router=express[_0x02a9('0x4')]();var fs_extra=require(_0x02a9('0x5'));var auth=require(_0x02a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x02a9('0x7'));var controller=require(_0x02a9('0x8'));router[_0x02a9('0x9')]('/',auth['isAuthenticated'](),controller[_0x02a9('0xa')]);router[_0x02a9('0x9')](_0x02a9('0xb'),auth[_0x02a9('0xc')](),controller['show']);router[_0x02a9('0xd')]('/',auth[_0x02a9('0xc')](),controller['create']);router['put']('/:id',auth[_0x02a9('0xc')](),controller[_0x02a9('0xe')]);router['delete'](_0x02a9('0xb'),auth[_0x02a9('0xc')](),controller[_0x02a9('0xf')]);module[_0x02a9('0x10')]=router; \ No newline at end of file +var _0x8219=['show','isAuthenticated','create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','index','/:id'];(function(_0xb06354,_0x464d11){var _0x44da6c=function(_0x1c900f){while(--_0x1c900f){_0xb06354['push'](_0xb06354['shift']());}};_0x44da6c(++_0x464d11);}(_0x8219,0x149));var _0x9821=function(_0x2929ba,_0x506aa6){_0x2929ba=_0x2929ba-0x0;var _0x365e6e=_0x8219[_0x2929ba];return _0x365e6e;};'use strict';var multer=require(_0x9821('0x0'));var util=require(_0x9821('0x1'));var path=require(_0x9821('0x2'));var timeout=require(_0x9821('0x3'));var express=require(_0x9821('0x4'));var router=express[_0x9821('0x5')]();var fs_extra=require(_0x9821('0x6'));var auth=require(_0x9821('0x7'));var interaction=require(_0x9821('0x8'));var config=require(_0x9821('0x9'));var controller=require(_0x9821('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x9821('0xb')]);router['get'](_0x9821('0xc'),auth['isAuthenticated'](),controller[_0x9821('0xd')]);router['post']('/',auth[_0x9821('0xe')](),controller[_0x9821('0xf')]);router['put']('/:id',auth[_0x9821('0xe')](),controller['update']);router['delete'](_0x9821('0xc'),auth[_0x9821('0xe')](),controller[_0x9821('0x10')]);module[_0x9821('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2970181..dea82f0 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 _0x64cc=['ENUM','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x15ff59,_0x44827e){var _0x291a50=function(_0x42dca9){while(--_0x42dca9){_0x15ff59['push'](_0x15ff59['shift']());}};_0x291a50(++_0x44827e);}(_0x64cc,0xef));var _0xc64c=function(_0x410fb9,_0x3b880b){_0x410fb9=_0x410fb9-0x0;var _0x231475=_0x64cc[_0x410fb9];return _0x231475;};'use strict';var Sequelize=require(_0xc64c('0x0'));module['exports']={'type':{'type':Sequelize[_0xc64c('0x1')]('string',_0xc64c('0x2'),_0xc64c('0x3'),_0xc64c('0x4'),_0xc64c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc64c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc64c('0x1')]('string',_0xc64c('0x2'),_0xc64c('0x3'))},'keyContent':{'type':Sequelize[_0xc64c('0x6')]},'idField':{'type':Sequelize[_0xc64c('0x6')]},'nameField':{'type':Sequelize[_0xc64c('0x6')]},'customField':{'type':Sequelize[_0xc64c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc64c('0x6')]}}; \ No newline at end of file +var _0xec02=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x405600,_0x19dd0c){var _0x168eb4=function(_0x1cf172){while(--_0x1cf172){_0x405600['push'](_0x405600['shift']());}};_0x168eb4(++_0x19dd0c);}(_0xec02,0x171));var _0x2ec0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xec02[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x2ec0('0x0'));module[_0x2ec0('0x1')]={'type':{'type':Sequelize[_0x2ec0('0x2')](_0x2ec0('0x3'),'variable',_0x2ec0('0x4'),_0x2ec0('0x5'),_0x2ec0('0x6')),'defaultValue':_0x2ec0('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2ec0('0x7')]},'keyType':{'type':Sequelize[_0x2ec0('0x2')]('string',_0x2ec0('0x8'),_0x2ec0('0x4'))},'keyContent':{'type':Sequelize[_0x2ec0('0x7')]},'idField':{'type':Sequelize[_0x2ec0('0x7')]},'nameField':{'type':Sequelize[_0x2ec0('0x7')]},'customField':{'type':Sequelize[_0x2ec0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ec0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 95814d3..99e02ea 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 _0xa000=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','error','stack','name','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','keys','options','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1bb517,_0x2f395e){var _0x571f0f=function(_0x4a68dc){while(--_0x4a68dc){_0x1bb517['push'](_0x1bb517['shift']());}};_0x571f0f(++_0x2f395e);}(_0xa000,0x86));var _0x0a00=function(_0x402c9e,_0x18bec3){_0x402c9e=_0x402c9e-0x0;var _0x506904=_0xa000[_0x402c9e];return _0x506904;};'use strict';var emlformat=require(_0x0a00('0x0'));var rimraf=require(_0x0a00('0x1'));var zipdir=require(_0x0a00('0x2'));var jsonpatch=require(_0x0a00('0x3'));var rp=require(_0x0a00('0x4'));var moment=require(_0x0a00('0x5'));var BPromise=require(_0x0a00('0x6'));var Mustache=require(_0x0a00('0x7'));var util=require(_0x0a00('0x8'));var path=require(_0x0a00('0x9'));var sox=require(_0x0a00('0xa'));var csv=require(_0x0a00('0xb'));var ejs=require(_0x0a00('0xc'));var fs=require('fs');var fs_extra=require(_0x0a00('0xd'));var _=require(_0x0a00('0xe'));var squel=require('squel');var crypto=require(_0x0a00('0xf'));var jsforce=require(_0x0a00('0x10'));var deskjs=require(_0x0a00('0x11'));var toCsv=require(_0x0a00('0xb'));var querystring=require(_0x0a00('0x12'));var Papa=require(_0x0a00('0x13'));var Redis=require('ioredis');var authService=require(_0x0a00('0x14'));var qs=require(_0x0a00('0x15'));var as=require(_0x0a00('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a00('0x17'))('api');var utils=require(_0x0a00('0x18'));var config=require(_0x0a00('0x19'));var licenseUtil=require(_0x0a00('0x1a'));var db=require(_0x0a00('0x1b'))['db'];function respondWithStatusCode(_0x9f8684,_0x59fd4e){_0x59fd4e=_0x59fd4e||0xcc;return function(_0x300274){if(_0x300274){return _0x9f8684[_0x0a00('0x1c')](_0x59fd4e);}return _0x9f8684[_0x0a00('0x1d')](_0x59fd4e)[_0x0a00('0x1e')]();};}function respondWithResult(_0x3a7463,_0x2e7fe5){_0x2e7fe5=_0x2e7fe5||0xc8;return function(_0x4a1e75){if(_0x4a1e75){return _0x3a7463[_0x0a00('0x1d')](_0x2e7fe5)[_0x0a00('0x1f')](_0x4a1e75);}};}function respondWithFilteredResult(_0x78bf48,_0x1dfd37){return function(_0x598e36){if(_0x598e36){var _0x43e554=typeof _0x1dfd37['offset']===_0x0a00('0x20')&&typeof _0x1dfd37[_0x0a00('0x21')]===_0x0a00('0x20');var _0x2653d9=_0x598e36[_0x0a00('0x22')];var _0x222c65=_0x43e554?0x0:_0x1dfd37[_0x0a00('0x23')];var _0x3502a5=_0x43e554?_0x598e36[_0x0a00('0x22')]:_0x1dfd37[_0x0a00('0x23')]+_0x1dfd37['limit'];var _0xc2579e;if(_0x3502a5>=_0x2653d9){_0x3502a5=_0x2653d9;_0xc2579e=0xc8;}else{_0xc2579e=0xce;}_0x78bf48[_0x0a00('0x1d')](_0xc2579e);return _0x78bf48[_0x0a00('0x24')](_0x0a00('0x25'),_0x222c65+'-'+_0x3502a5+'/'+_0x2653d9)[_0x0a00('0x1f')](_0x598e36);}return null;};}function patchUpdates(_0x31fef3){return function(_0x156f2b){try{jsonpatch['apply'](_0x156f2b,_0x31fef3,!![]);}catch(_0x36e98d){return BPromise[_0x0a00('0x26')](_0x36e98d);}return _0x156f2b[_0x0a00('0x27')]();};}function saveUpdates(_0x3d82aa,_0x4b1729){return function(_0x3f25e3){if(_0x3f25e3){return _0x3f25e3['update'](_0x3d82aa)['then'](function(_0x36aeda){return _0x36aeda;});}return null;};}function removeEntity(_0xf76b69,_0x33d52e){return function(_0x2c69bc){if(_0x2c69bc){return _0x2c69bc[_0x0a00('0x28')]()[_0x0a00('0x29')](function(){_0xf76b69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e1dc,_0x43c5f){return function(_0x476ff1){if(!_0x476ff1){_0x45e1dc[_0x0a00('0x1c')](0x194);}return _0x476ff1;};}function handleError(_0x5efe03,_0x1e62ad){_0x1e62ad=_0x1e62ad||0x1f4;return function(_0x1dfdca){logger[_0x0a00('0x2a')](_0x1dfdca[_0x0a00('0x2b')]);if(_0x1dfdca['name']){delete _0x1dfdca[_0x0a00('0x2c')];}_0x5efe03[_0x0a00('0x1d')](_0x1e62ad)['send'](_0x1dfdca);};}exports['index']=function(_0x3175c2,_0x5141bc){var _0x16c3bc={},_0x136d30={},_0x3682f1={'count':0x0,'rows':[]};var _0x172057=_['map'](db[_0x0a00('0x2d')][_0x0a00('0x2e')],function(_0x1d1ae1){return{'name':_0x1d1ae1[_0x0a00('0x2f')],'type':_0x1d1ae1[_0x0a00('0x30')][_0x0a00('0x31')]};});_0x136d30[_0x0a00('0x32')]=_[_0x0a00('0x33')](_0x172057,_0x0a00('0x2c'));_0x136d30[_0x0a00('0x34')]=_['keys'](_0x3175c2[_0x0a00('0x34')]);_0x136d30[_0x0a00('0x35')]=_[_0x0a00('0x36')](_0x136d30[_0x0a00('0x32')],_0x136d30[_0x0a00('0x34')]);_0x16c3bc[_0x0a00('0x37')]=_['intersection'](_0x136d30[_0x0a00('0x32')],qs['fields'](_0x3175c2[_0x0a00('0x34')][_0x0a00('0x38')]));_0x16c3bc[_0x0a00('0x37')]=_0x16c3bc['attributes'][_0x0a00('0x39')]?_0x16c3bc['attributes']:_0x136d30[_0x0a00('0x32')];if(!_0x3175c2[_0x0a00('0x34')][_0x0a00('0x3a')](_0x0a00('0x3b'))){_0x16c3bc[_0x0a00('0x21')]=qs[_0x0a00('0x21')](_0x3175c2[_0x0a00('0x34')][_0x0a00('0x21')]);_0x16c3bc[_0x0a00('0x23')]=qs[_0x0a00('0x23')](_0x3175c2['query'][_0x0a00('0x23')]);}_0x16c3bc[_0x0a00('0x3c')]=qs[_0x0a00('0x3d')](_0x3175c2['query']['sort']);_0x16c3bc[_0x0a00('0x3e')]=qs[_0x0a00('0x35')](_[_0x0a00('0x3f')](_0x3175c2['query'],_0x136d30['filters']),_0x172057);if(_0x3175c2['query'][_0x0a00('0x40')]){_0x16c3bc[_0x0a00('0x3e')]=_[_0x0a00('0x41')](_0x16c3bc[_0x0a00('0x3e')],{'$or':_[_0x0a00('0x33')](_0x172057,function(_0x18bc95){if(_0x18bc95[_0x0a00('0x30')]!==_0x0a00('0x42')){var _0x5a4780={};_0x5a4780[_0x18bc95['name']]={'$like':'%'+_0x3175c2[_0x0a00('0x34')][_0x0a00('0x40')]+'%'};return _0x5a4780;}})});}_0x16c3bc=_[_0x0a00('0x41')]({},_0x16c3bc,_0x3175c2['options']);var _0xaa7e3f={'where':_0x16c3bc[_0x0a00('0x3e')]};return db['Dynamics365Field'][_0x0a00('0x22')](_0xaa7e3f)['then'](function(_0x38de18){_0x3682f1[_0x0a00('0x22')]=_0x38de18;if(_0x3175c2[_0x0a00('0x34')][_0x0a00('0x43')]){_0x16c3bc[_0x0a00('0x44')]=[{'all':!![]}];}return db[_0x0a00('0x2d')]['findAll'](_0x16c3bc);})[_0x0a00('0x29')](function(_0x3df488){_0x3682f1[_0x0a00('0x45')]=_0x3df488;return _0x3682f1;})[_0x0a00('0x29')](respondWithFilteredResult(_0x5141bc,_0x16c3bc))[_0x0a00('0x46')](handleError(_0x5141bc,null));};exports['show']=function(_0x1a642a,_0x5154c2){var _0x16f2b0={'raw':!![],'where':{'id':_0x1a642a['params']['id']}},_0x37d50f={};_0x37d50f[_0x0a00('0x32')]=_['keys'](db[_0x0a00('0x2d')][_0x0a00('0x2e')]);_0x37d50f[_0x0a00('0x34')]=_[_0x0a00('0x47')](_0x1a642a[_0x0a00('0x34')]);_0x37d50f[_0x0a00('0x35')]=_[_0x0a00('0x36')](_0x37d50f[_0x0a00('0x32')],_0x37d50f['query']);_0x16f2b0['attributes']=_[_0x0a00('0x36')](_0x37d50f[_0x0a00('0x32')],qs['fields'](_0x1a642a['query'][_0x0a00('0x38')]));_0x16f2b0[_0x0a00('0x37')]=_0x16f2b0[_0x0a00('0x37')][_0x0a00('0x39')]?_0x16f2b0['attributes']:_0x37d50f[_0x0a00('0x32')];if(_0x1a642a[_0x0a00('0x34')][_0x0a00('0x43')]){_0x16f2b0[_0x0a00('0x44')]=[{'all':!![]}];}_0x16f2b0=_[_0x0a00('0x41')]({},_0x16f2b0,_0x1a642a[_0x0a00('0x48')]);return db[_0x0a00('0x2d')]['find'](_0x16f2b0)[_0x0a00('0x29')](handleEntityNotFound(_0x5154c2,null))[_0x0a00('0x29')](respondWithResult(_0x5154c2,null))['catch'](handleError(_0x5154c2,null));};exports[_0x0a00('0x49')]=function(_0x4c91b3,_0x53fc5b){return db[_0x0a00('0x2d')][_0x0a00('0x49')](_0x4c91b3['body'],{})[_0x0a00('0x29')](respondWithResult(_0x53fc5b,0xc9))['catch'](handleError(_0x53fc5b,null));};exports['update']=function(_0x318487,_0x3ead43){if(_0x318487[_0x0a00('0x4a')]['id']){delete _0x318487[_0x0a00('0x4a')]['id'];}return db[_0x0a00('0x2d')]['find']({'where':{'id':_0x318487[_0x0a00('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ead43,null))['then'](saveUpdates(_0x318487[_0x0a00('0x4a')],null))['then'](respondWithResult(_0x3ead43,null))[_0x0a00('0x46')](handleError(_0x3ead43,null));};exports['destroy']=function(_0xe5e43d,_0xa93101){return db[_0x0a00('0x2d')][_0x0a00('0x4c')]({'where':{'id':_0xe5e43d['params']['id']}})[_0x0a00('0x29')](handleEntityNotFound(_0xa93101,null))[_0x0a00('0x29')](removeEntity(_0xa93101,null))[_0x0a00('0x46')](handleError(_0xa93101,null));}; \ No newline at end of file +var _0x1929=['attributes','fields','model','order','where','filters','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','destroy','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/environment','../../config/license/util','sendStatus','status','end','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','keys','query'];(function(_0x5a3051,_0x468e1b){var _0x3d24b7=function(_0x2d8af5){while(--_0x2d8af5){_0x5a3051['push'](_0x5a3051['shift']());}};_0x3d24b7(++_0x468e1b);}(_0x1929,0xed));var _0x9192=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x1929[_0x1d2bbb];return _0x38082b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9192('0x0'));var jsonpatch=require(_0x9192('0x1'));var rp=require(_0x9192('0x2'));var moment=require(_0x9192('0x3'));var BPromise=require(_0x9192('0x4'));var Mustache=require('mustache');var util=require(_0x9192('0x5'));var path=require(_0x9192('0x6'));var sox=require(_0x9192('0x7'));var csv=require(_0x9192('0x8'));var ejs=require(_0x9192('0x9'));var fs=require('fs');var fs_extra=require(_0x9192('0xa'));var _=require(_0x9192('0xb'));var squel=require(_0x9192('0xc'));var crypto=require(_0x9192('0xd'));var jsforce=require(_0x9192('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9192('0x8'));var querystring=require(_0x9192('0xf'));var Papa=require(_0x9192('0x10'));var Redis=require(_0x9192('0x11'));var authService=require(_0x9192('0x12'));var qs=require(_0x9192('0x13'));var as=require(_0x9192('0x14'));var hardwareService=require(_0x9192('0x15'));var logger=require(_0x9192('0x16'))(_0x9192('0x17'));var utils=require('../../config/utils');var config=require(_0x9192('0x18'));var licenseUtil=require(_0x9192('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d2b99,_0x59a6b0){_0x59a6b0=_0x59a6b0||0xcc;return function(_0x422d14){if(_0x422d14){return _0x2d2b99[_0x9192('0x1a')](_0x59a6b0);}return _0x2d2b99[_0x9192('0x1b')](_0x59a6b0)[_0x9192('0x1c')]();};}function respondWithResult(_0x413d13,_0x59aa47){_0x59aa47=_0x59aa47||0xc8;return function(_0xf640c0){if(_0xf640c0){return _0x413d13[_0x9192('0x1b')](_0x59aa47)['json'](_0xf640c0);}};}function respondWithFilteredResult(_0x2031e9,_0x193202){return function(_0x233356){if(_0x233356){var _0x3b1f62=typeof _0x193202['offset']==='undefined'&&typeof _0x193202[_0x9192('0x1d')]==='undefined';var _0x59b01d=_0x233356['count'];var _0x1564d5=_0x3b1f62?0x0:_0x193202[_0x9192('0x1e')];var _0x5c7825=_0x3b1f62?_0x233356[_0x9192('0x1f')]:_0x193202[_0x9192('0x1e')]+_0x193202[_0x9192('0x1d')];var _0x5b6b4e;if(_0x5c7825>=_0x59b01d){_0x5c7825=_0x59b01d;_0x5b6b4e=0xc8;}else{_0x5b6b4e=0xce;}_0x2031e9['status'](_0x5b6b4e);return _0x2031e9[_0x9192('0x20')](_0x9192('0x21'),_0x1564d5+'-'+_0x5c7825+'/'+_0x59b01d)['json'](_0x233356);}return null;};}function patchUpdates(_0x43edee){return function(_0x157810){try{jsonpatch[_0x9192('0x22')](_0x157810,_0x43edee,!![]);}catch(_0x140863){return BPromise[_0x9192('0x23')](_0x140863);}return _0x157810[_0x9192('0x24')]();};}function saveUpdates(_0x4a8956,_0x46dbe1){return function(_0x5cac6b){if(_0x5cac6b){return _0x5cac6b[_0x9192('0x25')](_0x4a8956)[_0x9192('0x26')](function(_0x1b7445){return _0x1b7445;});}return null;};}function removeEntity(_0x237152,_0x3d37ce){return function(_0xd6e9a5){if(_0xd6e9a5){return _0xd6e9a5['destroy']()[_0x9192('0x26')](function(){_0x237152['status'](0xcc)[_0x9192('0x1c')]();});}};}function handleEntityNotFound(_0x2f78cb,_0x8a77df){return function(_0x1e43fd){if(!_0x1e43fd){_0x2f78cb[_0x9192('0x1a')](0x194);}return _0x1e43fd;};}function handleError(_0x562421,_0x15e46b){_0x15e46b=_0x15e46b||0x1f4;return function(_0x5ad57b){logger[_0x9192('0x27')](_0x5ad57b[_0x9192('0x28')]);if(_0x5ad57b['name']){delete _0x5ad57b[_0x9192('0x29')];}_0x562421[_0x9192('0x1b')](_0x15e46b)[_0x9192('0x2a')](_0x5ad57b);};}exports[_0x9192('0x2b')]=function(_0x16d469,_0x4dc81c){var _0x2e611b={},_0x40893d={},_0x23edb4={'count':0x0,'rows':[]};var _0x48703c=_[_0x9192('0x2c')](db[_0x9192('0x2d')][_0x9192('0x2e')],function(_0x271eae){return{'name':_0x271eae[_0x9192('0x2f')],'type':_0x271eae[_0x9192('0x30')]['key']};});_0x40893d['model']=_[_0x9192('0x2c')](_0x48703c,_0x9192('0x29'));_0x40893d['query']=_[_0x9192('0x31')](_0x16d469[_0x9192('0x32')]);_0x40893d['filters']=_['intersection'](_0x40893d['model'],_0x40893d[_0x9192('0x32')]);_0x2e611b[_0x9192('0x33')]=_['intersection'](_0x40893d['model'],qs['fields'](_0x16d469[_0x9192('0x32')][_0x9192('0x34')]));_0x2e611b[_0x9192('0x33')]=_0x2e611b[_0x9192('0x33')]['length']?_0x2e611b[_0x9192('0x33')]:_0x40893d[_0x9192('0x35')];if(!_0x16d469[_0x9192('0x32')]['hasOwnProperty']('nolimit')){_0x2e611b[_0x9192('0x1d')]=qs['limit'](_0x16d469[_0x9192('0x32')][_0x9192('0x1d')]);_0x2e611b['offset']=qs[_0x9192('0x1e')](_0x16d469['query'][_0x9192('0x1e')]);}_0x2e611b[_0x9192('0x36')]=qs['sort'](_0x16d469[_0x9192('0x32')]['sort']);_0x2e611b[_0x9192('0x37')]=qs[_0x9192('0x38')](_['pick'](_0x16d469[_0x9192('0x32')],_0x40893d['filters']),_0x48703c);if(_0x16d469[_0x9192('0x32')]['filter']){_0x2e611b[_0x9192('0x37')]=_[_0x9192('0x39')](_0x2e611b[_0x9192('0x37')],{'$or':_[_0x9192('0x2c')](_0x48703c,function(_0x5c2ba7){if(_0x5c2ba7[_0x9192('0x30')]!==_0x9192('0x3a')){var _0x3886ff={};_0x3886ff[_0x5c2ba7[_0x9192('0x29')]]={'$like':'%'+_0x16d469[_0x9192('0x32')]['filter']+'%'};return _0x3886ff;}})});}_0x2e611b=_[_0x9192('0x39')]({},_0x2e611b,_0x16d469[_0x9192('0x3b')]);var _0x4acf16={'where':_0x2e611b[_0x9192('0x37')]};return db[_0x9192('0x2d')]['count'](_0x4acf16)['then'](function(_0x61114e){_0x23edb4[_0x9192('0x1f')]=_0x61114e;if(_0x16d469['query'][_0x9192('0x3c')]){_0x2e611b[_0x9192('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x2e611b);})['then'](function(_0x3bd000){_0x23edb4[_0x9192('0x3e')]=_0x3bd000;return _0x23edb4;})['then'](respondWithFilteredResult(_0x4dc81c,_0x2e611b))[_0x9192('0x3f')](handleError(_0x4dc81c,null));};exports[_0x9192('0x40')]=function(_0x5fe960,_0x589f3f){var _0x1d6db2={'raw':!![],'where':{'id':_0x5fe960[_0x9192('0x41')]['id']}},_0x12f9b9={};_0x12f9b9[_0x9192('0x35')]=_['keys'](db[_0x9192('0x2d')][_0x9192('0x2e')]);_0x12f9b9[_0x9192('0x32')]=_[_0x9192('0x31')](_0x5fe960[_0x9192('0x32')]);_0x12f9b9[_0x9192('0x38')]=_[_0x9192('0x42')](_0x12f9b9[_0x9192('0x35')],_0x12f9b9[_0x9192('0x32')]);_0x1d6db2[_0x9192('0x33')]=_['intersection'](_0x12f9b9[_0x9192('0x35')],qs['fields'](_0x5fe960[_0x9192('0x32')]['fields']));_0x1d6db2[_0x9192('0x33')]=_0x1d6db2[_0x9192('0x33')][_0x9192('0x43')]?_0x1d6db2[_0x9192('0x33')]:_0x12f9b9[_0x9192('0x35')];if(_0x5fe960['query'][_0x9192('0x3c')]){_0x1d6db2[_0x9192('0x3d')]=[{'all':!![]}];}_0x1d6db2=_[_0x9192('0x39')]({},_0x1d6db2,_0x5fe960[_0x9192('0x3b')]);return db[_0x9192('0x2d')][_0x9192('0x44')](_0x1d6db2)[_0x9192('0x26')](handleEntityNotFound(_0x589f3f,null))[_0x9192('0x26')](respondWithResult(_0x589f3f,null))['catch'](handleError(_0x589f3f,null));};exports[_0x9192('0x45')]=function(_0x408b89,_0x19b7a9){return db[_0x9192('0x2d')][_0x9192('0x45')](_0x408b89[_0x9192('0x46')],{})[_0x9192('0x26')](respondWithResult(_0x19b7a9,0xc9))[_0x9192('0x3f')](handleError(_0x19b7a9,null));};exports[_0x9192('0x25')]=function(_0xdb188e,_0x57df06){if(_0xdb188e['body']['id']){delete _0xdb188e[_0x9192('0x46')]['id'];}return db[_0x9192('0x2d')][_0x9192('0x44')]({'where':{'id':_0xdb188e[_0x9192('0x41')]['id']}})[_0x9192('0x26')](handleEntityNotFound(_0x57df06,null))['then'](saveUpdates(_0xdb188e[_0x9192('0x46')],null))['then'](respondWithResult(_0x57df06,null))[_0x9192('0x3f')](handleError(_0x57df06,null));};exports[_0x9192('0x47')]=function(_0x5e0b0c,_0xb5ed62){return db[_0x9192('0x2d')]['find']({'where':{'id':_0x5e0b0c[_0x9192('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5ed62,null))[_0x9192('0x26')](removeEntity(_0xb5ed62,null))[_0x9192('0x3f')](handleError(_0xb5ed62,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1c1791c..aa5d95b 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 _0xa860=['util','api','moment','bluebird','request-promise','rimraf','exports','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa860,0xf1));var _0x0a86=function(_0x3bb45f,_0x4b66f0){_0x3bb45f=_0x3bb45f-0x0;var _0x2b6ab4=_0xa860[_0x3bb45f];return _0x2b6ab4;};'use strict';var _=require(_0x0a86('0x0'));var util=require(_0x0a86('0x1'));var logger=require('../../config/logger')(_0x0a86('0x2'));var moment=require(_0x0a86('0x3'));var BPromise=require(_0x0a86('0x4'));var rp=require(_0x0a86('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a86('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x0a86('0x7')]=function(_0x525fe6,_0x3d0d12){return _0x525fe6['define']('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0a86('0x8'),'fields':[_0x0a86('0x9'),_0x0a86('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88da=['exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x21c594,_0x49eafe){var _0x5c9c00=function(_0x471d68){while(--_0x471d68){_0x21c594['push'](_0x21c594['shift']());}};_0x5c9c00(++_0x49eafe);}(_0x88da,0x13a));var _0xa88d=function(_0x20fafb,_0x16e9a2){_0x20fafb=_0x20fafb-0x0;var _0x2e0a54=_0x88da[_0x20fafb];return _0x2e0a54;};'use strict';var _=require(_0xa88d('0x0'));var util=require(_0xa88d('0x1'));var logger=require(_0xa88d('0x2'))(_0xa88d('0x3'));var moment=require(_0xa88d('0x4'));var BPromise=require(_0xa88d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa88d('0x6'));var rimraf=require('rimraf');var config=require(_0xa88d('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0xa88d('0x8')]=function(_0x52ffb5,_0x351f94){return _0x52ffb5[_0xa88d('0x9')](_0xa88d('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xa88d('0xb'),'fields':[_0xa88d('0xc'),_0xa88d('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 82fd4f8..bd25bae 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 _0xa1e5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x47d252,_0xe9136b){var _0xed75f1=function(_0x546ea4){while(--_0x546ea4){_0x47d252['push'](_0x47d252['shift']());}};_0xed75f1(++_0xe9136b);}(_0xa1e5,0x81));var _0x5a1e=function(_0x55bf55,_0x37c9e4){_0x55bf55=_0x55bf55-0x0;var _0x21caea=_0xa1e5[_0x55bf55];return _0x21caea;};'use strict';var _=require(_0x5a1e('0x0'));var util=require(_0x5a1e('0x1'));var moment=require('moment');var BPromise=require(_0x5a1e('0x2'));var rs=require(_0x5a1e('0x3'));var fs=require('fs');var Redis=require(_0x5a1e('0x4'));var db=require(_0x5a1e('0x5'))['db'];var utils=require(_0x5a1e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5a1e('0x7'));var jayson=require(_0x5a1e('0x8'));var client=jayson[_0x5a1e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x561fc1,_0x5d0782,_0x564c58){return new BPromise(function(_0x1acebe,_0x556149){return client[_0x5a1e('0xa')](_0x561fc1,_0x564c58)[_0x5a1e('0xb')](function(_0x33c6c3){logger[_0x5a1e('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x5d0782,'request\x20sent');logger[_0x5a1e('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5d0782,_0x5a1e('0xe'),JSON[_0x5a1e('0xf')](_0x33c6c3));if(_0x33c6c3['error']){if(_0x33c6c3[_0x5a1e('0x10')][_0x5a1e('0x11')]===0x1f4){logger[_0x5a1e('0x10')](_0x5a1e('0x12'),_0x5d0782,_0x33c6c3['error'][_0x5a1e('0x13')]);return _0x556149(_0x33c6c3[_0x5a1e('0x10')][_0x5a1e('0x13')]);}logger['error'](_0x5a1e('0x12'),_0x5d0782,_0x33c6c3[_0x5a1e('0x10')][_0x5a1e('0x13')]);return _0x1acebe(_0x33c6c3[_0x5a1e('0x10')][_0x5a1e('0x13')]);}else{logger[_0x5a1e('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x5d0782,_0x5a1e('0xe'));_0x1acebe(_0x33c6c3[_0x5a1e('0x14')][_0x5a1e('0x13')]);}})[_0x5a1e('0x15')](function(_0x23dd12){logger[_0x5a1e('0x10')](_0x5a1e('0x12'),_0x5d0782,_0x23dd12);_0x556149(_0x23dd12);});});} \ No newline at end of file +var _0x1da3=['http','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x292c84,_0x395fa5){var _0x51ad06=function(_0x362850){while(--_0x362850){_0x292c84['push'](_0x292c84['shift']());}};_0x51ad06(++_0x395fa5);}(_0x1da3,0x14d));var _0x31da=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1da3[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x31da('0x0'));var util=require('util');var moment=require(_0x31da('0x1'));var BPromise=require('bluebird');var rs=require(_0x31da('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31da('0x3'))['db'];var utils=require(_0x31da('0x4'));var logger=require(_0x31da('0x5'))('rpc');var config=require(_0x31da('0x6'));var jayson=require(_0x31da('0x7'));var client=jayson[_0x31da('0x8')][_0x31da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x714519,_0x2a2650,_0x408288){return new BPromise(function(_0x583f42,_0xe277ab){return client['request'](_0x714519,_0x408288)[_0x31da('0xa')](function(_0x54bb40){logger[_0x31da('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x2a2650,_0x31da('0xc'));logger['debug'](_0x31da('0xd'),_0x2a2650,_0x31da('0xc'),JSON[_0x31da('0xe')](_0x54bb40));if(_0x54bb40[_0x31da('0xf')]){if(_0x54bb40[_0x31da('0xf')]['code']===0x1f4){logger[_0x31da('0xf')](_0x31da('0x10'),_0x2a2650,_0x54bb40[_0x31da('0xf')]['message']);return _0xe277ab(_0x54bb40[_0x31da('0xf')][_0x31da('0x11')]);}logger[_0x31da('0xf')](_0x31da('0x10'),_0x2a2650,_0x54bb40[_0x31da('0xf')][_0x31da('0x11')]);return _0x583f42(_0x54bb40[_0x31da('0xf')][_0x31da('0x11')]);}else{logger[_0x31da('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x2a2650,'request\x20sent');_0x583f42(_0x54bb40['result'][_0x31da('0x11')]);}})['catch'](function(_0x450de2){logger[_0x31da('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x2a2650,_0x450de2);_0xe277ab(_0x450de2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c027dee..059f05a 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 _0xe2ba=['get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x247282,_0x7a92cf){var _0x5a116e=function(_0x16bbb4){while(--_0x16bbb4){_0x247282['push'](_0x247282['shift']());}};_0x5a116e(++_0x7a92cf);}(_0xe2ba,0xfa));var _0xae2b=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe2ba[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xae2b('0x0'));var util=require(_0xae2b('0x1'));var path=require(_0xae2b('0x2'));var timeout=require(_0xae2b('0x3'));var express=require(_0xae2b('0x4'));var router=express[_0xae2b('0x5')]();var fs_extra=require(_0xae2b('0x6'));var auth=require(_0xae2b('0x7'));var interaction=require(_0xae2b('0x8'));var config=require(_0xae2b('0x9'));var controller=require('./intFreshdeskAccount.controller');router[_0xae2b('0xa')]('/',auth[_0xae2b('0xb')](),controller['index']);router[_0xae2b('0xa')](_0xae2b('0xc'),auth[_0xae2b('0xb')](),controller['show']);router[_0xae2b('0xa')](_0xae2b('0xd'),auth['isAuthenticated'](),controller[_0xae2b('0xe')]);router[_0xae2b('0xa')](_0xae2b('0xf'),auth['isAuthenticated'](),controller[_0xae2b('0x10')]);router[_0xae2b('0x11')]('/',auth[_0xae2b('0xb')](),controller['create']);router[_0xae2b('0x11')](_0xae2b('0xd'),auth[_0xae2b('0xb')](),controller[_0xae2b('0x12')]);router['put'](_0xae2b('0xc'),auth[_0xae2b('0xb')](),controller['update']);router['delete']('/:id',auth[_0xae2b('0xb')](),controller['destroy']);module[_0xae2b('0x13')]=router; \ No newline at end of file +var _0x3eb4=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0x3eb4,0x13a));var _0x43eb=function(_0x1637d9,_0x16e500){_0x1637d9=_0x1637d9-0x0;var _0x2c89e6=_0x3eb4[_0x1637d9];return _0x2c89e6;};'use strict';var multer=require(_0x43eb('0x0'));var util=require(_0x43eb('0x1'));var path=require(_0x43eb('0x2'));var timeout=require(_0x43eb('0x3'));var express=require(_0x43eb('0x4'));var router=express[_0x43eb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x43eb('0x6'));var config=require(_0x43eb('0x7'));var controller=require(_0x43eb('0x8'));router[_0x43eb('0x9')]('/',auth[_0x43eb('0xa')](),controller[_0x43eb('0xb')]);router[_0x43eb('0x9')]('/:id',auth[_0x43eb('0xa')](),controller[_0x43eb('0xc')]);router[_0x43eb('0x9')](_0x43eb('0xd'),auth[_0x43eb('0xa')](),controller[_0x43eb('0xe')]);router[_0x43eb('0x9')](_0x43eb('0xf'),auth[_0x43eb('0xa')](),controller['getFields']);router[_0x43eb('0x10')]('/',auth['isAuthenticated'](),controller[_0x43eb('0x11')]);router[_0x43eb('0x10')](_0x43eb('0xd'),auth[_0x43eb('0xa')](),controller[_0x43eb('0x12')]);router[_0x43eb('0x13')](_0x43eb('0x14'),auth[_0x43eb('0xa')](),controller[_0x43eb('0x15')]);router[_0x43eb('0x16')](_0x43eb('0x14'),auth[_0x43eb('0xa')](),controller[_0x43eb('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index f0089c7..860fdc5 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 _0x1eba=['exports','STRING','remoteUri','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x1eba[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')]},'description':{'type':Sequelize[_0xa1eb('0x2')]},'username':{'type':Sequelize[_0xa1eb('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa1eb('0x2')],'unique':_0xa1eb('0x3')},'serverUrl':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd117=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4c2501,_0x1209d9){var _0x292cdb=function(_0x496712){while(--_0x496712){_0x4c2501['push'](_0x4c2501['shift']());}};_0x292cdb(++_0x1209d9);}(_0xd117,0x182));var _0x7d11=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xd117[_0x277721];return _0x286051;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'name':{'type':Sequelize[_0x7d11('0x2')]},'description':{'type':Sequelize[_0x7d11('0x2')]},'username':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x3')},'apiKey':{'type':Sequelize[_0x7d11('0x2')]},'remoteUri':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x4')},'serverUrl':{'type':Sequelize[_0x7d11('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 667da21..9389d73 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 _0x175e=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','findOne','FreshdeskConfiguration','order','sort','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0x175e,0xe6));var _0xe175=function(_0x23ca4d,_0x10b33a){_0x23ca4d=_0x23ca4d-0x0;var _0x2dd9fb=_0x175e[_0x23ca4d];return _0x2dd9fb;};'use strict';var emlformat=require(_0xe175('0x0'));var rimraf=require(_0xe175('0x1'));var zipdir=require(_0xe175('0x2'));var jsonpatch=require(_0xe175('0x3'));var rp=require(_0xe175('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe175('0x5'));var util=require(_0xe175('0x6'));var path=require(_0xe175('0x7'));var sox=require(_0xe175('0x8'));var csv=require(_0xe175('0x9'));var ejs=require(_0xe175('0xa'));var fs=require('fs');var fs_extra=require(_0xe175('0xb'));var _=require(_0xe175('0xc'));var squel=require(_0xe175('0xd'));var crypto=require(_0xe175('0xe'));var jsforce=require(_0xe175('0xf'));var deskjs=require(_0xe175('0x10'));var toCsv=require(_0xe175('0x9'));var querystring=require(_0xe175('0x11'));var Papa=require(_0xe175('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe175('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe175('0x14'));var logger=require(_0xe175('0x15'))(_0xe175('0x16'));var utils=require(_0xe175('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe175('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4b1b9b,_0x43eeb4){_0x43eeb4=_0x43eeb4||0xcc;return function(_0x336aa1){if(_0x336aa1){return _0x4b1b9b[_0xe175('0x19')](_0x43eeb4);}return _0x4b1b9b[_0xe175('0x1a')](_0x43eeb4)[_0xe175('0x1b')]();};}function respondWithResult(_0x4d2f51,_0x1e5477){_0x1e5477=_0x1e5477||0xc8;return function(_0x29885c){if(_0x29885c){return _0x4d2f51[_0xe175('0x1a')](_0x1e5477)[_0xe175('0x1c')](_0x29885c);}};}function respondWithFilteredResult(_0x3a0677,_0x20660b){return function(_0x20ac70){if(_0x20ac70){var _0x561ee3=typeof _0x20660b[_0xe175('0x1d')]===_0xe175('0x1e')&&typeof _0x20660b[_0xe175('0x1f')]==='undefined';var _0x1b3af5=_0x20ac70[_0xe175('0x20')];var _0xd6398d=_0x561ee3?0x0:_0x20660b[_0xe175('0x1d')];var _0x43e1fa=_0x561ee3?_0x20ac70[_0xe175('0x20')]:_0x20660b['offset']+_0x20660b[_0xe175('0x1f')];var _0xe697af;if(_0x43e1fa>=_0x1b3af5){_0x43e1fa=_0x1b3af5;_0xe697af=0xc8;}else{_0xe697af=0xce;}_0x3a0677[_0xe175('0x1a')](_0xe697af);return _0x3a0677[_0xe175('0x21')]('Content-Range',_0xd6398d+'-'+_0x43e1fa+'/'+_0x1b3af5)[_0xe175('0x1c')](_0x20ac70);}return null;};}function patchUpdates(_0x1d0d6c){return function(_0x242ec4){try{jsonpatch['apply'](_0x242ec4,_0x1d0d6c,!![]);}catch(_0x3c6dc9){return BPromise[_0xe175('0x22')](_0x3c6dc9);}return _0x242ec4['save']();};}function saveUpdates(_0xb10d29,_0x4f6115){return function(_0x3e27c3){if(_0x3e27c3){return _0x3e27c3[_0xe175('0x23')](_0xb10d29)[_0xe175('0x24')](function(_0x20dd39){return _0x20dd39;});}return null;};}function removeEntity(_0x2e02c0,_0x3b2111){return function(_0x15937c){if(_0x15937c){return _0x15937c[_0xe175('0x25')]()[_0xe175('0x24')](function(){_0x2e02c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf7c205,_0x1527fe){return function(_0xe480ba){if(!_0xe480ba){_0xf7c205[_0xe175('0x19')](0x194);}return _0xe480ba;};}function handleError(_0x12340d,_0x336b44){_0x336b44=_0x336b44||0x1f4;return function(_0x274daa){logger[_0xe175('0x26')](_0x274daa[_0xe175('0x27')]);if(_0x274daa[_0xe175('0x28')]){delete _0x274daa[_0xe175('0x28')];}_0x12340d[_0xe175('0x1a')](_0x336b44)[_0xe175('0x29')](_0x274daa);};}exports[_0xe175('0x2a')]=function(_0x5c0ed7,_0x49b7fa){var _0x4f645c={},_0x266b33={},_0x3c0e15={'count':0x0,'rows':[]};var _0x3f5a18=_[_0xe175('0x2b')](db[_0xe175('0x2c')][_0xe175('0x2d')],function(_0x526bbd){return{'name':_0x526bbd[_0xe175('0x2e')],'type':_0x526bbd[_0xe175('0x2f')][_0xe175('0x30')]};});_0x266b33[_0xe175('0x31')]=_[_0xe175('0x2b')](_0x3f5a18,_0xe175('0x28'));_0x266b33[_0xe175('0x32')]=_[_0xe175('0x33')](_0x5c0ed7['query']);_0x266b33[_0xe175('0x34')]=_[_0xe175('0x35')](_0x266b33[_0xe175('0x31')],_0x266b33[_0xe175('0x32')]);_0x4f645c['attributes']=_[_0xe175('0x35')](_0x266b33[_0xe175('0x31')],qs['fields'](_0x5c0ed7['query'][_0xe175('0x36')]));_0x4f645c[_0xe175('0x37')]=_0x4f645c[_0xe175('0x37')]['length']?_0x4f645c[_0xe175('0x37')]:_0x266b33[_0xe175('0x31')];if(!_0x5c0ed7[_0xe175('0x32')][_0xe175('0x38')](_0xe175('0x39'))){_0x4f645c[_0xe175('0x1f')]=qs[_0xe175('0x1f')](_0x5c0ed7[_0xe175('0x32')][_0xe175('0x1f')]);_0x4f645c[_0xe175('0x1d')]=qs[_0xe175('0x1d')](_0x5c0ed7[_0xe175('0x32')][_0xe175('0x1d')]);}_0x4f645c['order']=qs['sort'](_0x5c0ed7[_0xe175('0x32')]['sort']);_0x4f645c[_0xe175('0x3a')]=qs['filters'](_[_0xe175('0x3b')](_0x5c0ed7[_0xe175('0x32')],_0x266b33['filters']),_0x3f5a18);if(_0x5c0ed7[_0xe175('0x32')]['filter']){_0x4f645c[_0xe175('0x3a')]=_[_0xe175('0x3c')](_0x4f645c['where'],{'$or':_[_0xe175('0x2b')](_0x3f5a18,function(_0x488b64){if(_0x488b64[_0xe175('0x2f')]!==_0xe175('0x3d')){var _0x5949e7={};_0x5949e7[_0x488b64['name']]={'$like':'%'+_0x5c0ed7['query']['filter']+'%'};return _0x5949e7;}})});}_0x4f645c=_['merge']({},_0x4f645c,_0x5c0ed7['options']);var _0x4c6c80={'where':_0x4f645c[_0xe175('0x3a')]};return db[_0xe175('0x2c')][_0xe175('0x20')](_0x4c6c80)[_0xe175('0x24')](function(_0x49252f){_0x3c0e15['count']=_0x49252f;if(_0x5c0ed7[_0xe175('0x32')][_0xe175('0x3e')]){_0x4f645c[_0xe175('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xe175('0x40')](_0x4f645c);})[_0xe175('0x24')](function(_0x51528a){_0x3c0e15[_0xe175('0x41')]=_0x51528a;return _0x3c0e15;})['then'](respondWithFilteredResult(_0x49b7fa,_0x4f645c))[_0xe175('0x42')](handleError(_0x49b7fa,null));};exports[_0xe175('0x43')]=function(_0x18aaf8,_0x5c0951){var _0x4464e4={'raw':![],'where':{'id':_0x18aaf8[_0xe175('0x44')]['id']}},_0x21678d={};_0x21678d[_0xe175('0x31')]=_[_0xe175('0x33')](db[_0xe175('0x2c')]['rawAttributes']);_0x21678d[_0xe175('0x32')]=_[_0xe175('0x33')](_0x18aaf8[_0xe175('0x32')]);_0x21678d['filters']=_['intersection'](_0x21678d[_0xe175('0x31')],_0x21678d[_0xe175('0x32')]);_0x4464e4['attributes']=_['intersection'](_0x21678d['model'],qs['fields'](_0x18aaf8[_0xe175('0x32')][_0xe175('0x36')]));_0x4464e4[_0xe175('0x37')]=_0x4464e4[_0xe175('0x37')][_0xe175('0x45')]?_0x4464e4[_0xe175('0x37')]:_0x21678d[_0xe175('0x31')];if(_0x18aaf8[_0xe175('0x32')][_0xe175('0x3e')]){_0x4464e4[_0xe175('0x3f')]=[{'all':!![]}];}_0x4464e4=_['merge']({},_0x4464e4,_0x18aaf8[_0xe175('0x46')]);return db[_0xe175('0x2c')][_0xe175('0x47')](_0x4464e4)['then'](handleEntityNotFound(_0x5c0951,null))[_0xe175('0x24')](respondWithResult(_0x5c0951,null))[_0xe175('0x42')](handleError(_0x5c0951,null));};exports[_0xe175('0x48')]=function(_0x4c5f4a,_0x4d0d9e){return db[_0xe175('0x2c')][_0xe175('0x48')](_0x4c5f4a['body'],{})[_0xe175('0x24')](respondWithResult(_0x4d0d9e,0xc9))[_0xe175('0x42')](handleError(_0x4d0d9e,null));};exports[_0xe175('0x23')]=function(_0x4e8cda,_0x8820e0){if(_0x4e8cda['body']['id']){delete _0x4e8cda[_0xe175('0x49')]['id'];}return db[_0xe175('0x2c')][_0xe175('0x47')]({'where':{'id':_0x4e8cda[_0xe175('0x44')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x8820e0,null))['then'](saveUpdates(_0x4e8cda[_0xe175('0x49')],null))[_0xe175('0x24')](respondWithResult(_0x8820e0,null))[_0xe175('0x42')](handleError(_0x8820e0,null));};exports[_0xe175('0x25')]=function(_0x18d279,_0x47c62c){return db[_0xe175('0x2c')][_0xe175('0x47')]({'where':{'id':_0x18d279[_0xe175('0x44')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x47c62c,null))[_0xe175('0x24')](removeEntity(_0x47c62c,null))[_0xe175('0x42')](handleError(_0x47c62c,null));};exports['getConfigurations']=function(_0x2114c3,_0x2b4d5e,_0x49c584){var _0x2137d2={};var _0x8de30c={};var _0x3532e8;var _0x10c983;return db[_0xe175('0x2c')][_0xe175('0x4a')]({'where':{'id':_0x2114c3[_0xe175('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b4d5e,null))['then'](function(_0x5b541c){if(_0x5b541c){_0x3532e8=_0x5b541c;_0x8de30c[_0xe175('0x31')]=_[_0xe175('0x33')](db[_0xe175('0x4b')][_0xe175('0x2d')]);_0x8de30c[_0xe175('0x32')]=_[_0xe175('0x33')](_0x2114c3[_0xe175('0x32')]);_0x8de30c[_0xe175('0x34')]=_['intersection'](_0x8de30c[_0xe175('0x31')],_0x8de30c[_0xe175('0x32')]);_0x2137d2['attributes']=_[_0xe175('0x35')](_0x8de30c[_0xe175('0x31')],qs[_0xe175('0x36')](_0x2114c3[_0xe175('0x32')][_0xe175('0x36')]));_0x2137d2['attributes']=_0x2137d2['attributes'][_0xe175('0x45')]?_0x2137d2[_0xe175('0x37')]:_0x8de30c[_0xe175('0x31')];_0x2137d2[_0xe175('0x4c')]=qs[_0xe175('0x4d')](_0x2114c3[_0xe175('0x32')][_0xe175('0x4d')]);_0x2137d2[_0xe175('0x3a')]=qs[_0xe175('0x34')](_['pick'](_0x2114c3['query'],_0x8de30c[_0xe175('0x34')]));if(_0x2114c3['query'][_0xe175('0x4e')]){_0x2137d2[_0xe175('0x3a')]=_['merge'](_0x2137d2[_0xe175('0x3a')],{'$or':_[_0xe175('0x2b')](_0x2137d2[_0xe175('0x37')],function(_0x54e91f){var _0x4bc6f5={};_0x4bc6f5[_0x54e91f]={'$like':'%'+_0x2114c3[_0xe175('0x32')][_0xe175('0x4e')]+'%'};return _0x4bc6f5;})});}_0x2137d2=_[_0xe175('0x3c')]({},_0x2137d2,_0x2114c3[_0xe175('0x46')]);return _0x3532e8[_0xe175('0x4f')](_0x2137d2);}})[_0xe175('0x24')](function(_0x11f0c9){if(_0x11f0c9){_0x10c983=_0x11f0c9[_0xe175('0x45')];if(!_0x2114c3[_0xe175('0x32')][_0xe175('0x38')]('nolimit')){_0x2137d2[_0xe175('0x1f')]=qs[_0xe175('0x1f')](_0x2114c3[_0xe175('0x32')][_0xe175('0x1f')]);_0x2137d2[_0xe175('0x1d')]=qs[_0xe175('0x1d')](_0x2114c3[_0xe175('0x32')][_0xe175('0x1d')]);}return _0x3532e8['getConfigurations'](_0x2137d2);}})[_0xe175('0x24')](function(_0x4aea5a){if(_0x4aea5a){return _0x4aea5a?{'count':_0x10c983,'rows':_0x4aea5a}:null;}})[_0xe175('0x24')](respondWithResult(_0x2b4d5e,null))['catch'](handleError(_0x2b4d5e,null));};exports[_0xe175('0x50')]=function(_0x334cc4,_0x330921,_0x4055c4){if(_0x334cc4['body']['id']){delete _0x334cc4[_0xe175('0x49')]['id'];}return db[_0xe175('0x2c')][_0xe175('0x4a')]({'where':{'id':_0x334cc4[_0xe175('0x44')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x330921,null))[_0xe175('0x24')](function(_0x584126){if(_0x584126){_0x334cc4[_0xe175('0x49')][_0xe175('0x51')]=_0x584126['id'];_0x334cc4['body'][_0xe175('0x52')]=integrations[_0xe175('0x53')](_0x334cc4[_0xe175('0x49')][_0xe175('0x54')],_0x334cc4[_0xe175('0x49')][_0xe175('0x2f')]);_0x334cc4[_0xe175('0x49')][_0xe175('0x55')]=integrations['getDescriptions'](_0x334cc4[_0xe175('0x49')][_0xe175('0x54')],_0x334cc4[_0xe175('0x49')][_0xe175('0x2f')]);return db['FreshdeskConfiguration']['create'](_0x334cc4['body'],{'include':[{'model':db[_0xe175('0x56')],'as':'Subjects'},{'model':db[_0xe175('0x56')],'as':_0xe175('0x55')}]});}return null;})['then'](respondWithResult(_0x330921,null))[_0xe175('0x42')](handleError(_0x330921,null));};exports[_0xe175('0x57')]=function(_0x16409b,_0xb33d77,_0x2a9233){var _0x307017='';return db['FreshdeskAccount'][_0xe175('0x4a')]({'where':{'id':_0x16409b[_0xe175('0x44')]['id']},'attributes':['id',_0xe175('0x58'),_0xe175('0x59')]})[_0xe175('0x24')](handleEntityNotFound(_0xb33d77,null))[_0xe175('0x24')](function(_0x3c4375){if(_0x3c4375){_0x307017=_0x3c4375['remoteUri'];var _0x4066b1=_0x307017[_0xe175('0x5a')](-0x1);if(_0x4066b1==='/'){_0x307017=_0x307017[_0xe175('0x5b')](0x0,_0x307017[_0xe175('0x5c')](_0x4066b1));}return rp({'method':_0xe175('0x5d'),'uri':util[_0xe175('0x5e')](_0xe175('0x5f'),_0x307017,_0xe175('0x60')),'headers':{'Authorization':util[_0xe175('0x5e')](_0xe175('0x61'),new Buffer(util['format'](_0xe175('0x62'),_0x3c4375['apiKey']))[_0xe175('0x63')](_0xe175('0x64')))},'json':!![]});}})[_0xe175('0x24')](function(_0x5742f1){if(_0x5742f1){var _0x5c30a3=[_0xe175('0x65'),_0xe175('0x66'),'agent',_0xe175('0x67'),_0xe175('0x1a'),_0xe175('0x68'),_0xe175('0x69'),_0xe175('0x6a'),_0xe175('0x6b'),'group',_0xe175('0x6c')];_['remove'](_0x5742f1,function(_0x396ad7){return _0x5c30a3[_0xe175('0x6d')](_0x396ad7[_0xe175('0x28')])||!_0x396ad7[_0xe175('0x6e')]&&_0x396ad7[_0xe175('0x2f')]!==_0xe175('0x6f')&&_0x396ad7[_0xe175('0x2f')]!==_0xe175('0x70');});return{'count':_0x5742f1[_0xe175('0x45')],'rows':_[_0xe175('0x2b')](_0x5742f1,function(_0x225741){return{'id':_0x225741[_0xe175('0x28')],'name':_0x225741[_0xe175('0x71')],'custom':!_0x225741[_0xe175('0x6e')],'options':_0x225741[_0xe175('0x72')]?_[_0xe175('0x2b')](_0x225741[_0xe175('0x72')],function(_0x32926a){return{'name':_[_0xe175('0x73')](_0x32926a),'value':_0x32926a};}):[]};})};}})[_0xe175('0x24')](respondWithResult(_0xb33d77,null))[_0xe175('0x42')](function(_0x2a9372){var _0x318459=_0x16409b['query']['test']?0x1f4:_0x2a9372[_0xe175('0x74')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe175('0x57'),_0x318459,JSON['stringify'](_0x2a9372));delete _0x2a9372[_0xe175('0x28')];if(_0x318459===0x191){_0x318459=0x190;}_0xb33d77[_0xe175('0x1a')](_0x318459)['send'](_0x16409b['query'][_0xe175('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x2a9372[_0xe175('0x74')]}:_0x2a9372);});}; \ No newline at end of file +var _0x3f59=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','show','params','keys','length','create','body','find','destroy','getConfigurations','findOne','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','apiKey','toString','subject','agent','description','source','group','company','default','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials'];(function(_0x29142d,_0x3bf0fe){var _0x254ba4=function(_0x265c86){while(--_0x265c86){_0x29142d['push'](_0x29142d['shift']());}};_0x254ba4(++_0x3bf0fe);}(_0x3f59,0x1b0));var _0x93f5=function(_0x1853f5,_0x119c11){_0x1853f5=_0x1853f5-0x0;var _0x245b22=_0x3f59[_0x1853f5];return _0x245b22;};'use strict';var emlformat=require(_0x93f5('0x0'));var rimraf=require(_0x93f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93f5('0x2'));var rp=require(_0x93f5('0x3'));var moment=require(_0x93f5('0x4'));var BPromise=require(_0x93f5('0x5'));var Mustache=require(_0x93f5('0x6'));var util=require(_0x93f5('0x7'));var path=require(_0x93f5('0x8'));var sox=require(_0x93f5('0x9'));var csv=require(_0x93f5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93f5('0xb'));var squel=require(_0x93f5('0xc'));var crypto=require(_0x93f5('0xd'));var jsforce=require(_0x93f5('0xe'));var deskjs=require(_0x93f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93f5('0x10'));var qs=require(_0x93f5('0x11'));var as=require(_0x93f5('0x12'));var hardwareService=require(_0x93f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93f5('0x14'));var config=require(_0x93f5('0x15'));var licenseUtil=require(_0x93f5('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x93f5('0x17'));function respondWithStatusCode(_0x4ea7b4,_0x3e7e84){_0x3e7e84=_0x3e7e84||0xcc;return function(_0x107b90){if(_0x107b90){return _0x4ea7b4[_0x93f5('0x18')](_0x3e7e84);}return _0x4ea7b4[_0x93f5('0x19')](_0x3e7e84)[_0x93f5('0x1a')]();};}function respondWithResult(_0x45a275,_0x5d6001){_0x5d6001=_0x5d6001||0xc8;return function(_0x108b11){if(_0x108b11){return _0x45a275[_0x93f5('0x19')](_0x5d6001)[_0x93f5('0x1b')](_0x108b11);}};}function respondWithFilteredResult(_0x2ab5ce,_0x316fb2){return function(_0x22bcd7){if(_0x22bcd7){var _0x36aa85=typeof _0x316fb2[_0x93f5('0x1c')]===_0x93f5('0x1d')&&typeof _0x316fb2[_0x93f5('0x1e')]===_0x93f5('0x1d');var _0x869415=_0x22bcd7['count'];var _0x8d8ffe=_0x36aa85?0x0:_0x316fb2[_0x93f5('0x1c')];var _0x45eac3=_0x36aa85?_0x22bcd7[_0x93f5('0x1f')]:_0x316fb2[_0x93f5('0x1c')]+_0x316fb2['limit'];var _0x34edb9;if(_0x45eac3>=_0x869415){_0x45eac3=_0x869415;_0x34edb9=0xc8;}else{_0x34edb9=0xce;}_0x2ab5ce[_0x93f5('0x19')](_0x34edb9);return _0x2ab5ce[_0x93f5('0x20')](_0x93f5('0x21'),_0x8d8ffe+'-'+_0x45eac3+'/'+_0x869415)[_0x93f5('0x1b')](_0x22bcd7);}return null;};}function patchUpdates(_0xb44720){return function(_0x17e4ef){try{jsonpatch[_0x93f5('0x22')](_0x17e4ef,_0xb44720,!![]);}catch(_0x466ad7){return BPromise[_0x93f5('0x23')](_0x466ad7);}return _0x17e4ef[_0x93f5('0x24')]();};}function saveUpdates(_0xb59065,_0x330869){return function(_0x5b1a1f){if(_0x5b1a1f){return _0x5b1a1f[_0x93f5('0x25')](_0xb59065)[_0x93f5('0x26')](function(_0x34f8ce){return _0x34f8ce;});}return null;};}function removeEntity(_0x3ffe51,_0x365afd){return function(_0x1b4576){if(_0x1b4576){return _0x1b4576['destroy']()[_0x93f5('0x26')](function(){_0x3ffe51[_0x93f5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x107d91,_0x43fad9){return function(_0x57ae09){if(!_0x57ae09){_0x107d91['sendStatus'](0x194);}return _0x57ae09;};}function handleError(_0x403b45,_0x11e86c){_0x11e86c=_0x11e86c||0x1f4;return function(_0x469968){logger[_0x93f5('0x27')](_0x469968['stack']);if(_0x469968[_0x93f5('0x28')]){delete _0x469968['name'];}_0x403b45[_0x93f5('0x19')](_0x11e86c)[_0x93f5('0x29')](_0x469968);};}exports['index']=function(_0x36d579,_0x95e47e){var _0x136dc4={},_0x5e5cb5={},_0x3090a9={'count':0x0,'rows':[]};var _0x4883c6=_[_0x93f5('0x2a')](db['FreshdeskAccount'][_0x93f5('0x2b')],function(_0x2484bc){return{'name':_0x2484bc['fieldName'],'type':_0x2484bc[_0x93f5('0x2c')][_0x93f5('0x2d')]};});_0x5e5cb5[_0x93f5('0x2e')]=_[_0x93f5('0x2a')](_0x4883c6,'name');_0x5e5cb5[_0x93f5('0x2f')]=_['keys'](_0x36d579[_0x93f5('0x2f')]);_0x5e5cb5['filters']=_[_0x93f5('0x30')](_0x5e5cb5[_0x93f5('0x2e')],_0x5e5cb5[_0x93f5('0x2f')]);_0x136dc4[_0x93f5('0x31')]=_['intersection'](_0x5e5cb5[_0x93f5('0x2e')],qs[_0x93f5('0x32')](_0x36d579[_0x93f5('0x2f')][_0x93f5('0x32')]));_0x136dc4['attributes']=_0x136dc4[_0x93f5('0x31')]['length']?_0x136dc4[_0x93f5('0x31')]:_0x5e5cb5[_0x93f5('0x2e')];if(!_0x36d579[_0x93f5('0x2f')][_0x93f5('0x33')]('nolimit')){_0x136dc4[_0x93f5('0x1e')]=qs['limit'](_0x36d579[_0x93f5('0x2f')]['limit']);_0x136dc4['offset']=qs[_0x93f5('0x1c')](_0x36d579[_0x93f5('0x2f')][_0x93f5('0x1c')]);}_0x136dc4['order']=qs[_0x93f5('0x34')](_0x36d579[_0x93f5('0x2f')]['sort']);_0x136dc4[_0x93f5('0x35')]=qs['filters'](_[_0x93f5('0x36')](_0x36d579['query'],_0x5e5cb5[_0x93f5('0x37')]),_0x4883c6);if(_0x36d579[_0x93f5('0x2f')][_0x93f5('0x38')]){_0x136dc4[_0x93f5('0x35')]=_[_0x93f5('0x39')](_0x136dc4['where'],{'$or':_[_0x93f5('0x2a')](_0x4883c6,function(_0x364b5d){if(_0x364b5d[_0x93f5('0x2c')]!==_0x93f5('0x3a')){var _0x5c8687={};_0x5c8687[_0x364b5d[_0x93f5('0x28')]]={'$like':'%'+_0x36d579['query'][_0x93f5('0x38')]+'%'};return _0x5c8687;}})});}_0x136dc4=_[_0x93f5('0x39')]({},_0x136dc4,_0x36d579[_0x93f5('0x3b')]);var _0x1a6e28={'where':_0x136dc4[_0x93f5('0x35')]};return db[_0x93f5('0x3c')]['count'](_0x1a6e28)[_0x93f5('0x26')](function(_0x4f45d8){_0x3090a9[_0x93f5('0x1f')]=_0x4f45d8;if(_0x36d579[_0x93f5('0x2f')]['includeAll']){_0x136dc4[_0x93f5('0x3d')]=[{'all':!![]}];}return db[_0x93f5('0x3c')][_0x93f5('0x3e')](_0x136dc4);})[_0x93f5('0x26')](function(_0x53958b){_0x3090a9[_0x93f5('0x3f')]=_0x53958b;return _0x3090a9;})['then'](respondWithFilteredResult(_0x95e47e,_0x136dc4))[_0x93f5('0x40')](handleError(_0x95e47e,null));};exports[_0x93f5('0x41')]=function(_0x283261,_0x24d2dc){var _0xd4d915={'raw':![],'where':{'id':_0x283261[_0x93f5('0x42')]['id']}},_0x1d4c11={};_0x1d4c11['model']=_[_0x93f5('0x43')](db[_0x93f5('0x3c')][_0x93f5('0x2b')]);_0x1d4c11[_0x93f5('0x2f')]=_[_0x93f5('0x43')](_0x283261[_0x93f5('0x2f')]);_0x1d4c11[_0x93f5('0x37')]=_[_0x93f5('0x30')](_0x1d4c11['model'],_0x1d4c11['query']);_0xd4d915[_0x93f5('0x31')]=_['intersection'](_0x1d4c11[_0x93f5('0x2e')],qs['fields'](_0x283261[_0x93f5('0x2f')][_0x93f5('0x32')]));_0xd4d915['attributes']=_0xd4d915['attributes'][_0x93f5('0x44')]?_0xd4d915['attributes']:_0x1d4c11[_0x93f5('0x2e')];if(_0x283261[_0x93f5('0x2f')]['includeAll']){_0xd4d915[_0x93f5('0x3d')]=[{'all':!![]}];}_0xd4d915=_[_0x93f5('0x39')]({},_0xd4d915,_0x283261[_0x93f5('0x3b')]);return db[_0x93f5('0x3c')]['find'](_0xd4d915)[_0x93f5('0x26')](handleEntityNotFound(_0x24d2dc,null))['then'](respondWithResult(_0x24d2dc,null))[_0x93f5('0x40')](handleError(_0x24d2dc,null));};exports[_0x93f5('0x45')]=function(_0x548ee2,_0x5be105){return db[_0x93f5('0x3c')][_0x93f5('0x45')](_0x548ee2['body'],{})[_0x93f5('0x26')](respondWithResult(_0x5be105,0xc9))[_0x93f5('0x40')](handleError(_0x5be105,null));};exports[_0x93f5('0x25')]=function(_0x576500,_0x544091){if(_0x576500[_0x93f5('0x46')]['id']){delete _0x576500[_0x93f5('0x46')]['id'];}return db['FreshdeskAccount'][_0x93f5('0x47')]({'where':{'id':_0x576500['params']['id']}})[_0x93f5('0x26')](handleEntityNotFound(_0x544091,null))[_0x93f5('0x26')](saveUpdates(_0x576500[_0x93f5('0x46')],null))[_0x93f5('0x26')](respondWithResult(_0x544091,null))[_0x93f5('0x40')](handleError(_0x544091,null));};exports[_0x93f5('0x48')]=function(_0x970bcf,_0x14e053){return db[_0x93f5('0x3c')][_0x93f5('0x47')]({'where':{'id':_0x970bcf[_0x93f5('0x42')]['id']}})[_0x93f5('0x26')](handleEntityNotFound(_0x14e053,null))[_0x93f5('0x26')](removeEntity(_0x14e053,null))[_0x93f5('0x40')](handleError(_0x14e053,null));};exports[_0x93f5('0x49')]=function(_0xd2d30a,_0x178b03,_0x389f31){var _0x2f81c2={};var _0x57cff5={};var _0x26507f;var _0x4c0810;return db['FreshdeskAccount'][_0x93f5('0x4a')]({'where':{'id':_0xd2d30a['params']['id']}})[_0x93f5('0x26')](handleEntityNotFound(_0x178b03,null))['then'](function(_0x4366d7){if(_0x4366d7){_0x26507f=_0x4366d7;_0x57cff5[_0x93f5('0x2e')]=_['keys'](db['FreshdeskConfiguration'][_0x93f5('0x2b')]);_0x57cff5['query']=_[_0x93f5('0x43')](_0xd2d30a[_0x93f5('0x2f')]);_0x57cff5[_0x93f5('0x37')]=_['intersection'](_0x57cff5['model'],_0x57cff5[_0x93f5('0x2f')]);_0x2f81c2['attributes']=_['intersection'](_0x57cff5['model'],qs['fields'](_0xd2d30a[_0x93f5('0x2f')][_0x93f5('0x32')]));_0x2f81c2[_0x93f5('0x31')]=_0x2f81c2[_0x93f5('0x31')]['length']?_0x2f81c2['attributes']:_0x57cff5['model'];_0x2f81c2[_0x93f5('0x4b')]=qs[_0x93f5('0x34')](_0xd2d30a[_0x93f5('0x2f')][_0x93f5('0x34')]);_0x2f81c2[_0x93f5('0x35')]=qs[_0x93f5('0x37')](_['pick'](_0xd2d30a['query'],_0x57cff5['filters']));if(_0xd2d30a[_0x93f5('0x2f')]['filter']){_0x2f81c2[_0x93f5('0x35')]=_['merge'](_0x2f81c2[_0x93f5('0x35')],{'$or':_[_0x93f5('0x2a')](_0x2f81c2[_0x93f5('0x31')],function(_0x204467){var _0x5eb615={};_0x5eb615[_0x204467]={'$like':'%'+_0xd2d30a['query'][_0x93f5('0x38')]+'%'};return _0x5eb615;})});}_0x2f81c2=_[_0x93f5('0x39')]({},_0x2f81c2,_0xd2d30a[_0x93f5('0x3b')]);return _0x26507f[_0x93f5('0x49')](_0x2f81c2);}})[_0x93f5('0x26')](function(_0x246484){if(_0x246484){_0x4c0810=_0x246484[_0x93f5('0x44')];if(!_0xd2d30a[_0x93f5('0x2f')][_0x93f5('0x33')](_0x93f5('0x4c'))){_0x2f81c2[_0x93f5('0x1e')]=qs[_0x93f5('0x1e')](_0xd2d30a[_0x93f5('0x2f')][_0x93f5('0x1e')]);_0x2f81c2[_0x93f5('0x1c')]=qs[_0x93f5('0x1c')](_0xd2d30a[_0x93f5('0x2f')][_0x93f5('0x1c')]);}return _0x26507f[_0x93f5('0x49')](_0x2f81c2);}})[_0x93f5('0x26')](function(_0x5ad360){if(_0x5ad360){return _0x5ad360?{'count':_0x4c0810,'rows':_0x5ad360}:null;}})['then'](respondWithResult(_0x178b03,null))['catch'](handleError(_0x178b03,null));};exports[_0x93f5('0x4d')]=function(_0x1296b0,_0x49e4a1,_0x2882d7){if(_0x1296b0[_0x93f5('0x46')]['id']){delete _0x1296b0[_0x93f5('0x46')]['id'];}return db[_0x93f5('0x3c')][_0x93f5('0x4a')]({'where':{'id':_0x1296b0['params']['id']}})[_0x93f5('0x26')](handleEntityNotFound(_0x49e4a1,null))[_0x93f5('0x26')](function(_0x251f7a){if(_0x251f7a){_0x1296b0[_0x93f5('0x46')][_0x93f5('0x4e')]=_0x251f7a['id'];_0x1296b0[_0x93f5('0x46')][_0x93f5('0x4f')]=integrations[_0x93f5('0x50')](_0x1296b0['body'][_0x93f5('0x51')],_0x1296b0[_0x93f5('0x46')][_0x93f5('0x2c')]);_0x1296b0['body'][_0x93f5('0x52')]=integrations['getDescriptions'](_0x1296b0['body'][_0x93f5('0x51')],_0x1296b0[_0x93f5('0x46')][_0x93f5('0x2c')]);return db['FreshdeskConfiguration'][_0x93f5('0x45')](_0x1296b0[_0x93f5('0x46')],{'include':[{'model':db[_0x93f5('0x53')],'as':'Subjects'},{'model':db[_0x93f5('0x53')],'as':_0x93f5('0x52')}]});}return null;})[_0x93f5('0x26')](respondWithResult(_0x49e4a1,null))['catch'](handleError(_0x49e4a1,null));};exports[_0x93f5('0x54')]=function(_0x1c5fd4,_0x30d670,_0x365520){var _0x28cff8='';return db[_0x93f5('0x3c')]['findOne']({'where':{'id':_0x1c5fd4[_0x93f5('0x42')]['id']},'attributes':['id',_0x93f5('0x55'),'apiKey']})[_0x93f5('0x26')](handleEntityNotFound(_0x30d670,null))[_0x93f5('0x26')](function(_0x1290e4){if(_0x1290e4){_0x28cff8=_0x1290e4[_0x93f5('0x55')];var _0x18f25d=_0x28cff8[_0x93f5('0x56')](-0x1);if(_0x18f25d==='/'){_0x28cff8=_0x28cff8[_0x93f5('0x57')](0x0,_0x28cff8['lastIndexOf'](_0x18f25d));}return rp({'method':_0x93f5('0x58'),'uri':util['format'](_0x93f5('0x59'),_0x28cff8,_0x93f5('0x5a')),'headers':{'Authorization':util[_0x93f5('0x5b')](_0x93f5('0x5c'),new Buffer(util[_0x93f5('0x5b')]('%s:X',_0x1290e4[_0x93f5('0x5d')]))[_0x93f5('0x5e')]('base64'))},'json':!![]});}})[_0x93f5('0x26')](function(_0x2cf8c5){if(_0x2cf8c5){var _0x48b41b=['requester',_0x93f5('0x5f'),_0x93f5('0x60'),_0x93f5('0x61'),_0x93f5('0x19'),'priority','group',_0x93f5('0x62'),'ticket_type',_0x93f5('0x63'),_0x93f5('0x64')];_['remove'](_0x2cf8c5,function(_0x385392){return _0x48b41b['includes'](_0x385392[_0x93f5('0x28')])||!_0x385392[_0x93f5('0x65')]&&_0x385392[_0x93f5('0x2c')]!=='custom_text'&&_0x385392[_0x93f5('0x2c')]!=='custom_dropdown';});return{'count':_0x2cf8c5[_0x93f5('0x44')],'rows':_[_0x93f5('0x2a')](_0x2cf8c5,function(_0x13c1df){return{'id':_0x13c1df[_0x93f5('0x28')],'name':_0x13c1df[_0x93f5('0x66')],'custom':!_0x13c1df[_0x93f5('0x65')],'options':_0x13c1df['choices']?_[_0x93f5('0x2a')](_0x13c1df[_0x93f5('0x67')],function(_0x149fec){return{'name':_['capitalize'](_0x149fec),'value':_0x149fec};}):[]};})};}})[_0x93f5('0x26')](respondWithResult(_0x30d670,null))[_0x93f5('0x40')](function(_0xfaac55){var _0x57e0c4=_0x1c5fd4[_0x93f5('0x2f')][_0x93f5('0x68')]?0x1f4:_0xfaac55[_0x93f5('0x69')]||0x1f4;logger['error'](_0x93f5('0x6a'),_0x93f5('0x54'),_0x57e0c4,JSON['stringify'](_0xfaac55));delete _0xfaac55[_0x93f5('0x28')];if(_0x57e0c4===0x191){_0x57e0c4=0x190;}_0x30d670[_0x93f5('0x19')](_0x57e0c4)[_0x93f5('0x29')](_0x1c5fd4[_0x93f5('0x2f')]['test']?{'message':_0x93f5('0x6b'),'statusCode':_0xfaac55[_0x93f5('0x69')]}:_0xfaac55);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index cc34c19..ca59c8f 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 _0x09c2=['api','moment','request-promise','rimraf','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09c2,0x15f));var _0x209c=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x09c2[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0x209c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x209c('0x1'));var moment=require(_0x209c('0x2'));var BPromise=require('bluebird');var rp=require(_0x209c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x209c('0x4'));var config=require('../../config/environment');var attributes=require(_0x209c('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x209c('0x6')]=function(_0x54b75f,_0x488763){return _0x54b75f['define'](_0x209c('0x7'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfc7=['../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbfc7,0x1b0));var _0x7bfc=function(_0x4866c2,_0x533c69){_0x4866c2=_0x4866c2-0x0;var _0x9595a3=_0xbfc7[_0x4866c2];return _0x9595a3;};'use strict';var _=require(_0x7bfc('0x0'));var util=require(_0x7bfc('0x1'));var logger=require('../../config/logger')(_0x7bfc('0x2'));var moment=require(_0x7bfc('0x3'));var BPromise=require(_0x7bfc('0x4'));var rp=require(_0x7bfc('0x5'));var fs=require('fs');var path=require(_0x7bfc('0x6'));var rimraf=require(_0x7bfc('0x7'));var config=require(_0x7bfc('0x8'));var attributes=require(_0x7bfc('0x9'));var integrations=require(_0x7bfc('0xa'));module['exports']=function(_0x290b40,_0x1bbc7d){return _0x290b40['define'](_0x7bfc('0xb'),attributes,{'tableName':_0x7bfc('0xc'),'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 9f13a74..33d01f2 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 _0xd844=['include','map','model','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','limit'];(function(_0x4fadd1,_0x51f8cb){var _0x16744c=function(_0x2c263e){while(--_0x2c263e){_0x4fadd1['push'](_0x4fadd1['shift']());}};_0x16744c(++_0x51f8cb);}(_0xd844,0xd2));var _0x4d84=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd844[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4d84('0x0'));var util=require(_0x4d84('0x1'));var moment=require(_0x4d84('0x2'));var BPromise=require(_0x4d84('0x3'));var rs=require(_0x4d84('0x4'));var fs=require('fs');var Redis=require(_0x4d84('0x5'));var db=require(_0x4d84('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d84('0x7'))(_0x4d84('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d84('0x9')][_0x4d84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6721de,_0x56732b,_0x3746ba){return new BPromise(function(_0x52f826,_0x5727e2){return client['request'](_0x6721de,_0x3746ba)[_0x4d84('0xb')](function(_0x58ed80){logger[_0x4d84('0xc')](_0x4d84('0xd'),_0x56732b,_0x4d84('0xe'));logger[_0x4d84('0xf')](_0x4d84('0x10'),_0x56732b,_0x4d84('0xe'),JSON[_0x4d84('0x11')](_0x58ed80));if(_0x58ed80[_0x4d84('0x12')]){if(_0x58ed80[_0x4d84('0x12')]['code']===0x1f4){logger[_0x4d84('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x56732b,_0x58ed80['error']['message']);return _0x5727e2(_0x58ed80['error'][_0x4d84('0x13')]);}logger[_0x4d84('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x56732b,_0x58ed80[_0x4d84('0x12')][_0x4d84('0x13')]);return _0x52f826(_0x58ed80[_0x4d84('0x12')]['message']);}else{logger[_0x4d84('0xc')](_0x4d84('0xd'),_0x56732b,_0x4d84('0xe'));_0x52f826(_0x58ed80[_0x4d84('0x14')][_0x4d84('0x13')]);}})[_0x4d84('0x15')](function(_0x59b4ae){logger[_0x4d84('0x12')](_0x4d84('0xd'),_0x56732b,_0x59b4ae);_0x5727e2(_0x59b4ae);});});}exports[_0x4d84('0x16')]=function(_0x3470b6){var _0xebe3e1=this;return new Promise(function(_0x42eb46,_0x293eaf){return db[_0x4d84('0x17')]['findAll']({'raw':_0x3470b6['options']?_0x3470b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3470b6[_0x4d84('0x18')]?_0x3470b6[_0x4d84('0x18')][_0x4d84('0x19')]||null:null,'attributes':_0x3470b6['options']?_0x3470b6[_0x4d84('0x18')][_0x4d84('0x1a')]||null:null,'limit':_0x3470b6[_0x4d84('0x18')]?_0x3470b6[_0x4d84('0x18')][_0x4d84('0x1b')]||null:null,'include':_0x3470b6[_0x4d84('0x18')]?_0x3470b6[_0x4d84('0x18')][_0x4d84('0x1c')]?_[_0x4d84('0x1d')](_0x3470b6['options']['include'],function(_0x470a2e){return{'model':db[_0x470a2e[_0x4d84('0x1e')]],'as':_0x470a2e['as'],'attributes':_0x470a2e[_0x4d84('0x1a')],'include':_0x470a2e['include']?_['map'](_0x470a2e[_0x4d84('0x1c')],function(_0x3ede1a){return{'model':db[_0x3ede1a['model']],'as':_0x3ede1a['as'],'attributes':_0x3ede1a[_0x4d84('0x1a')],'include':_0x3ede1a[_0x4d84('0x1c')]?_[_0x4d84('0x1d')](_0x3ede1a[_0x4d84('0x1c')],function(_0x398984){return{'model':db[_0x398984[_0x4d84('0x1e')]],'as':_0x398984['as'],'attributes':_0x398984[_0x4d84('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4d84('0xb')](function(_0x3d99ef){logger[_0x4d84('0xc')](_0x4d84('0x16'),_0x3470b6);logger[_0x4d84('0xf')](_0x4d84('0x16'),_0x3470b6,JSON[_0x4d84('0x11')](_0x3d99ef));_0x42eb46(_0x3d99ef);})[_0x4d84('0x15')](function(_0x153011){logger[_0x4d84('0x12')](_0x4d84('0x16'),_0x153011[_0x4d84('0x13')],_0x3470b6);_0x293eaf(_0xebe3e1[_0x4d84('0x12')](0x1f4,_0x153011[_0x4d84('0x13')]));});});};exports[_0x4d84('0x1f')]=function(_0x397d8c){var _0x2fda7b=this;return new Promise(function(_0x1c713d,_0x30c6e5){return db['FreshdeskAccount'][_0x4d84('0x20')]({'raw':_0x397d8c[_0x4d84('0x18')]?_0x397d8c[_0x4d84('0x18')][_0x4d84('0x21')]===undefined?!![]:![]:!![],'where':_0x397d8c[_0x4d84('0x18')]?_0x397d8c[_0x4d84('0x18')]['where']||null:null,'attributes':_0x397d8c[_0x4d84('0x18')]?_0x397d8c[_0x4d84('0x18')]['attributes']||null:null,'include':_0x397d8c[_0x4d84('0x18')]?_0x397d8c[_0x4d84('0x18')]['include']?_['map'](_0x397d8c[_0x4d84('0x18')][_0x4d84('0x1c')],function(_0x31e784){return{'model':db[_0x31e784[_0x4d84('0x1e')]],'as':_0x31e784['as'],'attributes':_0x31e784[_0x4d84('0x1a')],'include':_0x31e784[_0x4d84('0x1c')]?_[_0x4d84('0x1d')](_0x31e784[_0x4d84('0x1c')],function(_0x3cd0db){return{'model':db[_0x3cd0db[_0x4d84('0x1e')]],'as':_0x3cd0db['as'],'attributes':_0x3cd0db[_0x4d84('0x1a')],'include':_0x3cd0db[_0x4d84('0x1c')]?_['map'](_0x3cd0db[_0x4d84('0x1c')],function(_0x16cc1b){return{'model':db[_0x16cc1b[_0x4d84('0x1e')]],'as':_0x16cc1b['as'],'attributes':_0x16cc1b[_0x4d84('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1db946){logger[_0x4d84('0xc')](_0x4d84('0x1f'),_0x397d8c);logger[_0x4d84('0xf')]('ShowFreshdeskAccount',_0x397d8c,JSON[_0x4d84('0x11')](_0x1db946));_0x1c713d(_0x1db946);})[_0x4d84('0x15')](function(_0x23b75f){logger[_0x4d84('0x12')](_0x4d84('0x1f'),_0x23b75f[_0x4d84('0x13')],_0x397d8c);_0x30c6e5(_0x2fda7b[_0x4d84('0x12')](0x1f4,_0x23b75f[_0x4d84('0x13')]));});});}; \ No newline at end of file +var _0x296c=['FreshdeskAccount','options','raw','where','limit','include','map','model','attributes','GetFreshdeskAccount','ShowFreshdeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x4aabc1,_0x15e9b0){var _0x302c36=function(_0x5d2280){while(--_0x5d2280){_0x4aabc1['push'](_0x4aabc1['shift']());}};_0x302c36(++_0x15e9b0);}(_0x296c,0x8f));var _0xc296=function(_0x25da30,_0x225537){_0x25da30=_0x25da30-0x0;var _0x57b643=_0x296c[_0x25da30];return _0x57b643;};'use strict';var _=require(_0xc296('0x0'));var util=require(_0xc296('0x1'));var moment=require(_0xc296('0x2'));var BPromise=require('bluebird');var rs=require(_0xc296('0x3'));var fs=require('fs');var Redis=require(_0xc296('0x4'));var db=require(_0xc296('0x5'))['db'];var utils=require(_0xc296('0x6'));var logger=require('../../config/logger')(_0xc296('0x7'));var config=require(_0xc296('0x8'));var jayson=require(_0xc296('0x9'));var client=jayson[_0xc296('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5342e9,_0x3d7db3,_0x1b6c4d){return new BPromise(function(_0x2b5ed4,_0x4f3d2a){return client[_0xc296('0xb')](_0x5342e9,_0x1b6c4d)[_0xc296('0xc')](function(_0x1b5909){logger[_0xc296('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x3d7db3,_0xc296('0xe'));logger[_0xc296('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3d7db3,'request\x20sent',JSON[_0xc296('0x10')](_0x1b5909));if(_0x1b5909['error']){if(_0x1b5909[_0xc296('0x11')]['code']===0x1f4){logger[_0xc296('0x11')](_0xc296('0x12'),_0x3d7db3,_0x1b5909[_0xc296('0x11')][_0xc296('0x13')]);return _0x4f3d2a(_0x1b5909[_0xc296('0x11')][_0xc296('0x13')]);}logger['error'](_0xc296('0x12'),_0x3d7db3,_0x1b5909[_0xc296('0x11')][_0xc296('0x13')]);return _0x2b5ed4(_0x1b5909[_0xc296('0x11')][_0xc296('0x13')]);}else{logger['info'](_0xc296('0x12'),_0x3d7db3,_0xc296('0xe'));_0x2b5ed4(_0x1b5909[_0xc296('0x14')][_0xc296('0x13')]);}})[_0xc296('0x15')](function(_0x1a3048){logger[_0xc296('0x11')](_0xc296('0x12'),_0x3d7db3,_0x1a3048);_0x4f3d2a(_0x1a3048);});});}exports['GetFreshdeskAccount']=function(_0x1a1359){var _0x3b83e7=this;return new Promise(function(_0x92d757,_0x3d0ec7){return db[_0xc296('0x16')]['findAll']({'raw':_0x1a1359[_0xc296('0x17')]?_0x1a1359[_0xc296('0x17')][_0xc296('0x18')]===undefined?!![]:![]:!![],'where':_0x1a1359[_0xc296('0x17')]?_0x1a1359[_0xc296('0x17')][_0xc296('0x19')]||null:null,'attributes':_0x1a1359[_0xc296('0x17')]?_0x1a1359[_0xc296('0x17')]['attributes']||null:null,'limit':_0x1a1359[_0xc296('0x17')]?_0x1a1359[_0xc296('0x17')][_0xc296('0x1a')]||null:null,'include':_0x1a1359[_0xc296('0x17')]?_0x1a1359['options'][_0xc296('0x1b')]?_[_0xc296('0x1c')](_0x1a1359[_0xc296('0x17')]['include'],function(_0x342a39){return{'model':db[_0x342a39[_0xc296('0x1d')]],'as':_0x342a39['as'],'attributes':_0x342a39[_0xc296('0x1e')],'include':_0x342a39[_0xc296('0x1b')]?_[_0xc296('0x1c')](_0x342a39[_0xc296('0x1b')],function(_0x237c72){return{'model':db[_0x237c72['model']],'as':_0x237c72['as'],'attributes':_0x237c72['attributes'],'include':_0x237c72[_0xc296('0x1b')]?_['map'](_0x237c72[_0xc296('0x1b')],function(_0x5e2643){return{'model':db[_0x5e2643['model']],'as':_0x5e2643['as'],'attributes':_0x5e2643['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19e159){logger[_0xc296('0xd')](_0xc296('0x1f'),_0x1a1359);logger[_0xc296('0xf')](_0xc296('0x1f'),_0x1a1359,JSON[_0xc296('0x10')](_0x19e159));_0x92d757(_0x19e159);})[_0xc296('0x15')](function(_0x27a7d1){logger[_0xc296('0x11')](_0xc296('0x1f'),_0x27a7d1[_0xc296('0x13')],_0x1a1359);_0x3d0ec7(_0x3b83e7['error'](0x1f4,_0x27a7d1[_0xc296('0x13')]));});});};exports[_0xc296('0x20')]=function(_0x25b091){var _0x5a43bb=this;return new Promise(function(_0x232c39,_0x39fa97){return db['FreshdeskAccount']['find']({'raw':_0x25b091[_0xc296('0x17')]?_0x25b091['options'][_0xc296('0x18')]===undefined?!![]:![]:!![],'where':_0x25b091[_0xc296('0x17')]?_0x25b091[_0xc296('0x17')][_0xc296('0x19')]||null:null,'attributes':_0x25b091[_0xc296('0x17')]?_0x25b091[_0xc296('0x17')][_0xc296('0x1e')]||null:null,'include':_0x25b091['options']?_0x25b091[_0xc296('0x17')][_0xc296('0x1b')]?_[_0xc296('0x1c')](_0x25b091[_0xc296('0x17')][_0xc296('0x1b')],function(_0x5845ad){return{'model':db[_0x5845ad['model']],'as':_0x5845ad['as'],'attributes':_0x5845ad['attributes'],'include':_0x5845ad[_0xc296('0x1b')]?_['map'](_0x5845ad[_0xc296('0x1b')],function(_0x19b012){return{'model':db[_0x19b012['model']],'as':_0x19b012['as'],'attributes':_0x19b012[_0xc296('0x1e')],'include':_0x19b012['include']?_[_0xc296('0x1c')](_0x19b012[_0xc296('0x1b')],function(_0x151ceb){return{'model':db[_0x151ceb[_0xc296('0x1d')]],'as':_0x151ceb['as'],'attributes':_0x151ceb[_0xc296('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc296('0xc')](function(_0x4ea557){logger[_0xc296('0xd')]('ShowFreshdeskAccount',_0x25b091);logger[_0xc296('0xf')](_0xc296('0x20'),_0x25b091,JSON[_0xc296('0x10')](_0x4ea557));_0x232c39(_0x4ea557);})[_0xc296('0x15')](function(_0x675501){logger[_0xc296('0x11')]('ShowFreshdeskAccount',_0x675501[_0xc296('0x13')],_0x25b091);_0x39fa97(_0x5a43bb['error'](0x1f4,_0x675501[_0xc296('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b586711..9cf9294 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 _0xa1d5=['/:id/fields','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','./intFreshdeskConfiguration.controller','get','/:id','show'];(function(_0x3b7615,_0x55d16f){var _0x3e41b0=function(_0x3ddcea){while(--_0x3ddcea){_0x3b7615['push'](_0x3b7615['shift']());}};_0x3e41b0(++_0x55d16f);}(_0xa1d5,0x1f1));var _0x5a1d=function(_0x402175,_0x46a9aa){_0x402175=_0x402175-0x0;var _0x4991a4=_0xa1d5[_0x402175];return _0x4991a4;};'use strict';var multer=require(_0x5a1d('0x0'));var util=require(_0x5a1d('0x1'));var path=require('path');var timeout=require(_0x5a1d('0x2'));var express=require('express');var router=express[_0x5a1d('0x3')]();var fs_extra=require(_0x5a1d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5a1d('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5a1d('0x6')](_0x5a1d('0x7'),auth['isAuthenticated'](),controller[_0x5a1d('0x8')]);router['get'](_0x5a1d('0x9'),auth[_0x5a1d('0xa')](),controller['getFields']);router[_0x5a1d('0x6')](_0x5a1d('0xb'),auth['isAuthenticated'](),controller[_0x5a1d('0xc')]);router[_0x5a1d('0x6')]('/:id/descriptions',auth[_0x5a1d('0xa')](),controller[_0x5a1d('0xd')]);router['get'](_0x5a1d('0xe'),auth[_0x5a1d('0xa')](),controller[_0x5a1d('0xf')]);router['post']('/',auth[_0x5a1d('0xa')](),controller[_0x5a1d('0x10')]);router[_0x5a1d('0x11')](_0x5a1d('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x5a1d('0x12')](_0x5a1d('0x7'),auth[_0x5a1d('0xa')](),controller[_0x5a1d('0x13')]);router[_0x5a1d('0x14')](_0x5a1d('0x7'),auth[_0x5a1d('0xa')](),controller[_0x5a1d('0x15')]);module[_0x5a1d('0x16')]=router; \ No newline at end of file +var _0x68c4=['fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','/:id/descriptions','/:id/tags','create','post','setTags','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x68c4,0x1a1));var _0x468c=function(_0x59bd2d,_0x307929){_0x59bd2d=_0x59bd2d-0x0;var _0x572487=_0x68c4[_0x59bd2d];return _0x572487;};'use strict';var multer=require(_0x468c('0x0'));var util=require('util');var path=require(_0x468c('0x1'));var timeout=require(_0x468c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x468c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x468c('0x4'));var config=require(_0x468c('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x468c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x468c('0x6')](_0x468c('0x7'),auth['isAuthenticated'](),controller[_0x468c('0x8')]);router['get'](_0x468c('0x9'),auth[_0x468c('0xa')](),controller['getFields']);router[_0x468c('0x6')](_0x468c('0xb'),auth[_0x468c('0xa')](),controller['getSubjects']);router[_0x468c('0x6')](_0x468c('0xc'),auth[_0x468c('0xa')](),controller['getDescriptions']);router[_0x468c('0x6')](_0x468c('0xd'),auth[_0x468c('0xa')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x468c('0xe')]);router[_0x468c('0xf')](_0x468c('0xd'),auth[_0x468c('0xa')](),controller[_0x468c('0x10')]);router[_0x468c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x468c('0x12')]);router[_0x468c('0x13')](_0x468c('0x7'),auth[_0x468c('0xa')](),controller['destroy']);module[_0x468c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 9c47c72..e9db517 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 _0x4f7e=['sequelize','exports','STRING'];(function(_0x1d187b,_0x192b45){var _0x59b741=function(_0x4827d6){while(--_0x4827d6){_0x1d187b['push'](_0x1d187b['shift']());}};_0x59b741(++_0x192b45);}(_0x4f7e,0x1cb));var _0xe4f7=function(_0x444a59,_0x6e3113){_0x444a59=_0x444a59-0x0;var _0x46d96d=_0x4f7e[_0x444a59];return _0x46d96d;};'use strict';var Sequelize=require(_0xe4f7('0x0'));module[_0xe4f7('0x1')]={'name':{'type':Sequelize[_0xe4f7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1ac6=['STRING','exports'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0x1ac6,0x11d));var _0x61ac=function(_0x1193eb,_0x2a1969){_0x1193eb=_0x1193eb-0x0;var _0x5507f2=_0x1ac6[_0x1193eb];return _0x5507f2;};'use strict';var Sequelize=require('sequelize');module[_0x61ac('0x0')]={'name':{'type':Sequelize[_0x61ac('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index c2c262f..221f0c5 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 _0x416b=['findOne','getDescriptions','FreshdeskField','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','create','catch','find','body','getFields','order','getSubjects'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x416b,0x1a6));var _0xb416=function(_0x535596,_0x15c174){_0x535596=_0x535596-0x0;var _0x5751dd=_0x416b[_0x535596];return _0x5751dd;};'use strict';var emlformat=require(_0xb416('0x0'));var rimraf=require(_0xb416('0x1'));var zipdir=require(_0xb416('0x2'));var jsonpatch=require(_0xb416('0x3'));var rp=require(_0xb416('0x4'));var moment=require(_0xb416('0x5'));var BPromise=require(_0xb416('0x6'));var Mustache=require(_0xb416('0x7'));var util=require(_0xb416('0x8'));var path=require(_0xb416('0x9'));var sox=require(_0xb416('0xa'));var csv=require(_0xb416('0xb'));var ejs=require(_0xb416('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb416('0xd'));var crypto=require(_0xb416('0xe'));var jsforce=require(_0xb416('0xf'));var deskjs=require(_0xb416('0x10'));var toCsv=require(_0xb416('0xb'));var querystring=require(_0xb416('0x11'));var Papa=require('papaparse');var Redis=require(_0xb416('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb416('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb416('0x14'))(_0xb416('0x15'));var utils=require('../../config/utils');var config=require(_0xb416('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1849cc,_0x972505){_0x972505=_0x972505||0xcc;return function(_0x26a282){if(_0x26a282){return _0x1849cc[_0xb416('0x17')](_0x972505);}return _0x1849cc[_0xb416('0x18')](_0x972505)[_0xb416('0x19')]();};}function respondWithResult(_0x3cd44d,_0x193f49){_0x193f49=_0x193f49||0xc8;return function(_0x422d3d){if(_0x422d3d){return _0x3cd44d[_0xb416('0x18')](_0x193f49)[_0xb416('0x1a')](_0x422d3d);}};}function respondWithFilteredResult(_0x44482f,_0x165acf){return function(_0x2882e6){if(_0x2882e6){var _0x5b2288=typeof _0x165acf[_0xb416('0x1b')]===_0xb416('0x1c')&&typeof _0x165acf[_0xb416('0x1d')]===_0xb416('0x1c');var _0x44a8b9=_0x2882e6[_0xb416('0x1e')];var _0x2fb512=_0x5b2288?0x0:_0x165acf[_0xb416('0x1b')];var _0x2b4dc9=_0x5b2288?_0x2882e6[_0xb416('0x1e')]:_0x165acf['offset']+_0x165acf['limit'];var _0x443164;if(_0x2b4dc9>=_0x44a8b9){_0x2b4dc9=_0x44a8b9;_0x443164=0xc8;}else{_0x443164=0xce;}_0x44482f[_0xb416('0x18')](_0x443164);return _0x44482f[_0xb416('0x1f')](_0xb416('0x20'),_0x2fb512+'-'+_0x2b4dc9+'/'+_0x44a8b9)[_0xb416('0x1a')](_0x2882e6);}return null;};}function patchUpdates(_0x357b20){return function(_0x833320){try{jsonpatch[_0xb416('0x21')](_0x833320,_0x357b20,!![]);}catch(_0x2f5587){return BPromise[_0xb416('0x22')](_0x2f5587);}return _0x833320[_0xb416('0x23')]();};}function saveUpdates(_0x1a7f6c,_0x4f7c96){return function(_0x163988){if(_0x163988){return _0x163988[_0xb416('0x24')](_0x1a7f6c)['then'](function(_0x52ffbf){return _0x52ffbf;});}return null;};}function removeEntity(_0x45e5c0,_0x92b4c6){return function(_0x9a745){if(_0x9a745){return _0x9a745[_0xb416('0x25')]()[_0xb416('0x26')](function(){_0x45e5c0[_0xb416('0x18')](0xcc)[_0xb416('0x19')]();});}};}function handleEntityNotFound(_0x3cfb7a,_0x8b06a2){return function(_0x5a3015){if(!_0x5a3015){_0x3cfb7a['sendStatus'](0x194);}return _0x5a3015;};}function handleError(_0xf9fcd2,_0xafb4f5){_0xafb4f5=_0xafb4f5||0x1f4;return function(_0x45a788){logger[_0xb416('0x27')](_0x45a788['stack']);if(_0x45a788['name']){delete _0x45a788[_0xb416('0x28')];}_0xf9fcd2['status'](_0xafb4f5)['send'](_0x45a788);};}exports[_0xb416('0x29')]=function(_0x14df6e,_0x21d8ba){var _0x25feda={},_0x4a18c6={},_0x505b9a={'count':0x0,'rows':[]};var _0xdaeb00=_['map'](db[_0xb416('0x2a')][_0xb416('0x2b')],function(_0xc86133){return{'name':_0xc86133[_0xb416('0x2c')],'type':_0xc86133[_0xb416('0x2d')][_0xb416('0x2e')]};});_0x4a18c6[_0xb416('0x2f')]=_[_0xb416('0x30')](_0xdaeb00,_0xb416('0x28'));_0x4a18c6[_0xb416('0x31')]=_[_0xb416('0x32')](_0x14df6e['query']);_0x4a18c6[_0xb416('0x33')]=_[_0xb416('0x34')](_0x4a18c6['model'],_0x4a18c6[_0xb416('0x31')]);_0x25feda[_0xb416('0x35')]=_[_0xb416('0x34')](_0x4a18c6[_0xb416('0x2f')],qs[_0xb416('0x36')](_0x14df6e[_0xb416('0x31')][_0xb416('0x36')]));_0x25feda[_0xb416('0x35')]=_0x25feda['attributes'][_0xb416('0x37')]?_0x25feda[_0xb416('0x35')]:_0x4a18c6[_0xb416('0x2f')];if(!_0x14df6e['query'][_0xb416('0x38')](_0xb416('0x39'))){_0x25feda[_0xb416('0x1d')]=qs[_0xb416('0x1d')](_0x14df6e[_0xb416('0x31')][_0xb416('0x1d')]);_0x25feda['offset']=qs[_0xb416('0x1b')](_0x14df6e['query'][_0xb416('0x1b')]);}_0x25feda['order']=qs[_0xb416('0x3a')](_0x14df6e[_0xb416('0x31')][_0xb416('0x3a')]);_0x25feda[_0xb416('0x3b')]=qs[_0xb416('0x33')](_[_0xb416('0x3c')](_0x14df6e['query'],_0x4a18c6[_0xb416('0x33')]),_0xdaeb00);if(_0x14df6e[_0xb416('0x31')][_0xb416('0x3d')]){_0x25feda[_0xb416('0x3b')]=_[_0xb416('0x3e')](_0x25feda['where'],{'$or':_[_0xb416('0x30')](_0xdaeb00,function(_0x5a95c9){if(_0x5a95c9['type']!=='VIRTUAL'){var _0x391ede={};_0x391ede[_0x5a95c9[_0xb416('0x28')]]={'$like':'%'+_0x14df6e[_0xb416('0x31')]['filter']+'%'};return _0x391ede;}})});}_0x25feda=_['merge']({},_0x25feda,_0x14df6e['options']);var _0x5b3600={'where':_0x25feda['where']};return db[_0xb416('0x2a')][_0xb416('0x1e')](_0x5b3600)[_0xb416('0x26')](function(_0x3a2352){_0x505b9a[_0xb416('0x1e')]=_0x3a2352;if(_0x14df6e[_0xb416('0x31')][_0xb416('0x3f')]){_0x25feda[_0xb416('0x40')]=[{'all':!![]}];}return db[_0xb416('0x2a')][_0xb416('0x41')](_0x25feda);})[_0xb416('0x26')](function(_0x16a201){_0x505b9a['rows']=_0x16a201;return _0x505b9a;})[_0xb416('0x26')](respondWithFilteredResult(_0x21d8ba,_0x25feda))['catch'](handleError(_0x21d8ba,null));};exports[_0xb416('0x42')]=function(_0x32fb9d,_0x52f301){var _0x24ad3f={'raw':![],'where':{'id':_0x32fb9d[_0xb416('0x43')]['id']}},_0x4a1ce2={};_0x4a1ce2[_0xb416('0x2f')]=_[_0xb416('0x32')](db[_0xb416('0x2a')]['rawAttributes']);_0x4a1ce2[_0xb416('0x31')]=_[_0xb416('0x32')](_0x32fb9d[_0xb416('0x31')]);_0x4a1ce2['filters']=_[_0xb416('0x34')](_0x4a1ce2[_0xb416('0x2f')],_0x4a1ce2[_0xb416('0x31')]);_0x24ad3f[_0xb416('0x35')]=_[_0xb416('0x34')](_0x4a1ce2[_0xb416('0x2f')],qs[_0xb416('0x36')](_0x32fb9d[_0xb416('0x31')]['fields']));_0x24ad3f[_0xb416('0x35')]=_0x24ad3f[_0xb416('0x35')]['length']?_0x24ad3f['attributes']:_0x4a1ce2[_0xb416('0x2f')];if(_0x32fb9d[_0xb416('0x31')][_0xb416('0x3f')]){_0x24ad3f['include']=[{'all':!![]}];}_0x24ad3f=_['merge']({},_0x24ad3f,_0x32fb9d[_0xb416('0x44')]);return db[_0xb416('0x2a')]['find'](_0x24ad3f)[_0xb416('0x26')](handleEntityNotFound(_0x52f301,null))[_0xb416('0x26')](respondWithResult(_0x52f301,null))['catch'](handleError(_0x52f301,null));};exports[_0xb416('0x45')]=function(_0x137eb2,_0x38ffd4){return db['FreshdeskConfiguration'][_0xb416('0x45')](_0x137eb2['body'],{})['then'](respondWithResult(_0x38ffd4,0xc9))[_0xb416('0x46')](handleError(_0x38ffd4,null));};exports[_0xb416('0x24')]=function(_0x580315,_0x13c3c8){if(_0x580315['body']['id']){delete _0x580315['body']['id'];}return db[_0xb416('0x2a')][_0xb416('0x47')]({'where':{'id':_0x580315[_0xb416('0x43')]['id']}})['then'](handleEntityNotFound(_0x13c3c8,null))[_0xb416('0x26')](saveUpdates(_0x580315[_0xb416('0x48')],null))[_0xb416('0x26')](respondWithResult(_0x13c3c8,null))[_0xb416('0x46')](handleError(_0x13c3c8,null));};exports[_0xb416('0x25')]=function(_0x594b15,_0x529842){return db[_0xb416('0x2a')][_0xb416('0x47')]({'where':{'id':_0x594b15[_0xb416('0x43')]['id']}})[_0xb416('0x26')](handleEntityNotFound(_0x529842,null))[_0xb416('0x26')](removeEntity(_0x529842,null))[_0xb416('0x46')](handleError(_0x529842,null));};exports[_0xb416('0x49')]=function(_0x4bcae3,_0x287f1e,_0x264459){var _0x581745={};var _0x2b3be9={};var _0xb7703e;var _0xf976c4;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4bcae3[_0xb416('0x43')]['id']}})[_0xb416('0x26')](handleEntityNotFound(_0x287f1e,null))[_0xb416('0x26')](function(_0x58e246){if(_0x58e246){_0xb7703e=_0x58e246;_0x2b3be9[_0xb416('0x2f')]=_[_0xb416('0x32')](db['FreshdeskField']['rawAttributes']);_0x2b3be9[_0xb416('0x31')]=_[_0xb416('0x32')](_0x4bcae3[_0xb416('0x31')]);_0x2b3be9[_0xb416('0x33')]=_[_0xb416('0x34')](_0x2b3be9[_0xb416('0x2f')],_0x2b3be9[_0xb416('0x31')]);_0x581745[_0xb416('0x35')]=_['intersection'](_0x2b3be9[_0xb416('0x2f')],qs[_0xb416('0x36')](_0x4bcae3[_0xb416('0x31')][_0xb416('0x36')]));_0x581745['attributes']=_0x581745[_0xb416('0x35')][_0xb416('0x37')]?_0x581745[_0xb416('0x35')]:_0x2b3be9['model'];_0x581745[_0xb416('0x4a')]=qs['sort'](_0x4bcae3[_0xb416('0x31')]['sort']);_0x581745[_0xb416('0x3b')]=qs[_0xb416('0x33')](_[_0xb416('0x3c')](_0x4bcae3[_0xb416('0x31')],_0x2b3be9[_0xb416('0x33')]));if(_0x4bcae3[_0xb416('0x31')][_0xb416('0x3d')]){_0x581745[_0xb416('0x3b')]=_[_0xb416('0x3e')](_0x581745[_0xb416('0x3b')],{'$or':_[_0xb416('0x30')](_0x581745[_0xb416('0x35')],function(_0x495c90){var _0x6efc8b={};_0x6efc8b[_0x495c90]={'$like':'%'+_0x4bcae3[_0xb416('0x31')]['filter']+'%'};return _0x6efc8b;})});}_0x581745=_[_0xb416('0x3e')]({},_0x581745,_0x4bcae3['options']);return _0xb7703e[_0xb416('0x49')](_0x581745);}})['then'](function(_0x5dd4b5){if(_0x5dd4b5){_0xf976c4=_0x5dd4b5['length'];if(!_0x4bcae3[_0xb416('0x31')][_0xb416('0x38')](_0xb416('0x39'))){_0x581745[_0xb416('0x1d')]=qs['limit'](_0x4bcae3[_0xb416('0x31')][_0xb416('0x1d')]);_0x581745[_0xb416('0x1b')]=qs[_0xb416('0x1b')](_0x4bcae3['query'][_0xb416('0x1b')]);}return _0xb7703e[_0xb416('0x49')](_0x581745);}})[_0xb416('0x26')](function(_0x58b5cd){if(_0x58b5cd){return _0x58b5cd?{'count':_0xf976c4,'rows':_0x58b5cd}:null;}})[_0xb416('0x26')](respondWithResult(_0x287f1e,null))['catch'](handleError(_0x287f1e,null));};exports[_0xb416('0x4b')]=function(_0x2a252b,_0xd89182,_0x4f5f58){var _0x3e5281={};var _0x5081d0={};var _0x4180c5;var _0x252e9f;return db['FreshdeskConfiguration'][_0xb416('0x4c')]({'where':{'id':_0x2a252b[_0xb416('0x43')]['id']}})['then'](handleEntityNotFound(_0xd89182,null))['then'](function(_0x4b8ae4){if(_0x4b8ae4){_0x4180c5=_0x4b8ae4;_0x5081d0[_0xb416('0x2f')]=_[_0xb416('0x32')](db['FreshdeskField'][_0xb416('0x2b')]);_0x5081d0['query']=_['keys'](_0x2a252b[_0xb416('0x31')]);_0x5081d0[_0xb416('0x33')]=_[_0xb416('0x34')](_0x5081d0[_0xb416('0x2f')],_0x5081d0[_0xb416('0x31')]);_0x3e5281['attributes']=_[_0xb416('0x34')](_0x5081d0[_0xb416('0x2f')],qs[_0xb416('0x36')](_0x2a252b[_0xb416('0x31')][_0xb416('0x36')]));_0x3e5281[_0xb416('0x35')]=_0x3e5281[_0xb416('0x35')][_0xb416('0x37')]?_0x3e5281[_0xb416('0x35')]:_0x5081d0['model'];_0x3e5281[_0xb416('0x4a')]=qs[_0xb416('0x3a')](_0x2a252b[_0xb416('0x31')]['sort']);_0x3e5281['where']=qs[_0xb416('0x33')](_['pick'](_0x2a252b['query'],_0x5081d0['filters']));if(_0x2a252b[_0xb416('0x31')][_0xb416('0x3d')]){_0x3e5281[_0xb416('0x3b')]=_[_0xb416('0x3e')](_0x3e5281['where'],{'$or':_[_0xb416('0x30')](_0x3e5281[_0xb416('0x35')],function(_0xa6e334){var _0x1006f3={};_0x1006f3[_0xa6e334]={'$like':'%'+_0x2a252b[_0xb416('0x31')][_0xb416('0x3d')]+'%'};return _0x1006f3;})});}_0x3e5281=_['merge']({},_0x3e5281,_0x2a252b[_0xb416('0x44')]);return _0x4180c5['getSubjects'](_0x3e5281);}})[_0xb416('0x26')](function(_0x23c3c6){if(_0x23c3c6){_0x252e9f=_0x23c3c6[_0xb416('0x37')];if(!_0x2a252b[_0xb416('0x31')][_0xb416('0x38')]('nolimit')){_0x3e5281[_0xb416('0x1d')]=qs[_0xb416('0x1d')](_0x2a252b[_0xb416('0x31')]['limit']);_0x3e5281['offset']=qs['offset'](_0x2a252b['query'][_0xb416('0x1b')]);}return _0x4180c5['getSubjects'](_0x3e5281);}})[_0xb416('0x26')](function(_0x3602d1){if(_0x3602d1){return _0x3602d1?{'count':_0x252e9f,'rows':_0x3602d1}:null;}})[_0xb416('0x26')](respondWithResult(_0xd89182,null))['catch'](handleError(_0xd89182,null));};exports[_0xb416('0x4d')]=function(_0x48dc8f,_0x3eab38,_0x52e692){var _0x57b704={};var _0x248d5d={};var _0x315e87;var _0x538c90;return db[_0xb416('0x2a')][_0xb416('0x4c')]({'where':{'id':_0x48dc8f[_0xb416('0x43')]['id']}})[_0xb416('0x26')](handleEntityNotFound(_0x3eab38,null))[_0xb416('0x26')](function(_0x2fe8b4){if(_0x2fe8b4){_0x315e87=_0x2fe8b4;_0x248d5d[_0xb416('0x2f')]=_[_0xb416('0x32')](db[_0xb416('0x4e')][_0xb416('0x2b')]);_0x248d5d[_0xb416('0x31')]=_[_0xb416('0x32')](_0x48dc8f[_0xb416('0x31')]);_0x248d5d[_0xb416('0x33')]=_[_0xb416('0x34')](_0x248d5d[_0xb416('0x2f')],_0x248d5d['query']);_0x57b704['attributes']=_[_0xb416('0x34')](_0x248d5d['model'],qs[_0xb416('0x36')](_0x48dc8f[_0xb416('0x31')][_0xb416('0x36')]));_0x57b704[_0xb416('0x35')]=_0x57b704[_0xb416('0x35')][_0xb416('0x37')]?_0x57b704[_0xb416('0x35')]:_0x248d5d[_0xb416('0x2f')];_0x57b704['order']=qs[_0xb416('0x3a')](_0x48dc8f['query'][_0xb416('0x3a')]);_0x57b704[_0xb416('0x3b')]=qs[_0xb416('0x33')](_[_0xb416('0x3c')](_0x48dc8f[_0xb416('0x31')],_0x248d5d[_0xb416('0x33')]));if(_0x48dc8f[_0xb416('0x31')]['filter']){_0x57b704[_0xb416('0x3b')]=_[_0xb416('0x3e')](_0x57b704[_0xb416('0x3b')],{'$or':_[_0xb416('0x30')](_0x57b704[_0xb416('0x35')],function(_0x2986db){var _0x25d4bd={};_0x25d4bd[_0x2986db]={'$like':'%'+_0x48dc8f['query'][_0xb416('0x3d')]+'%'};return _0x25d4bd;})});}_0x57b704=_[_0xb416('0x3e')]({},_0x57b704,_0x48dc8f[_0xb416('0x44')]);return _0x315e87[_0xb416('0x4d')](_0x57b704);}})[_0xb416('0x26')](function(_0x3fee07){if(_0x3fee07){_0x538c90=_0x3fee07[_0xb416('0x37')];if(!_0x48dc8f[_0xb416('0x31')][_0xb416('0x38')]('nolimit')){_0x57b704[_0xb416('0x1d')]=qs['limit'](_0x48dc8f[_0xb416('0x31')][_0xb416('0x1d')]);_0x57b704['offset']=qs['offset'](_0x48dc8f['query'][_0xb416('0x1b')]);}return _0x315e87[_0xb416('0x4d')](_0x57b704);}})[_0xb416('0x26')](function(_0x4911d3){if(_0x4911d3){return _0x4911d3?{'count':_0x538c90,'rows':_0x4911d3}:null;}})[_0xb416('0x26')](respondWithResult(_0x3eab38,null))[_0xb416('0x46')](handleError(_0x3eab38,null));};exports[_0xb416('0x4f')]=function(_0x3dae8a,_0xde56d,_0x4f6ed5){var _0x5307fe={};var _0x4f4928={};var _0x51c669;var _0x141ba1;return db[_0xb416('0x2a')][_0xb416('0x4c')]({'where':{'id':_0x3dae8a[_0xb416('0x43')]['id']}})[_0xb416('0x26')](handleEntityNotFound(_0xde56d,null))[_0xb416('0x26')](function(_0x43536c){if(_0x43536c){_0x51c669=_0x43536c;_0x4f4928['model']=_['keys'](db[_0xb416('0x50')][_0xb416('0x2b')]);_0x4f4928['query']=_[_0xb416('0x32')](_0x3dae8a[_0xb416('0x31')]);_0x4f4928[_0xb416('0x33')]=_[_0xb416('0x34')](_0x4f4928[_0xb416('0x2f')],_0x4f4928['query']);_0x5307fe[_0xb416('0x35')]=_[_0xb416('0x34')](_0x4f4928[_0xb416('0x2f')],qs[_0xb416('0x36')](_0x3dae8a[_0xb416('0x31')][_0xb416('0x36')]));_0x5307fe['attributes']=_0x5307fe[_0xb416('0x35')][_0xb416('0x37')]?_0x5307fe[_0xb416('0x35')]:_0x4f4928[_0xb416('0x2f')];_0x5307fe[_0xb416('0x4a')]=qs[_0xb416('0x3a')](_0x3dae8a[_0xb416('0x31')][_0xb416('0x3a')]);_0x5307fe[_0xb416('0x3b')]=qs['filters'](_[_0xb416('0x3c')](_0x3dae8a[_0xb416('0x31')],_0x4f4928[_0xb416('0x33')]));if(_0x3dae8a[_0xb416('0x31')]['filter']){_0x5307fe[_0xb416('0x3b')]=_['merge'](_0x5307fe[_0xb416('0x3b')],{'$or':_['map'](_0x5307fe[_0xb416('0x35')],function(_0x14e557){var _0x394925={};_0x394925[_0x14e557]={'$like':'%'+_0x3dae8a[_0xb416('0x31')][_0xb416('0x3d')]+'%'};return _0x394925;})});}_0x5307fe=_[_0xb416('0x3e')]({},_0x5307fe,_0x3dae8a[_0xb416('0x44')]);return _0x51c669[_0xb416('0x4f')](_0x5307fe);}})[_0xb416('0x26')](function(_0x556c3e){if(_0x556c3e){_0x141ba1=_0x556c3e[_0xb416('0x37')];if(!_0x3dae8a[_0xb416('0x31')][_0xb416('0x38')](_0xb416('0x39'))){_0x5307fe[_0xb416('0x1d')]=qs[_0xb416('0x1d')](_0x3dae8a[_0xb416('0x31')][_0xb416('0x1d')]);_0x5307fe[_0xb416('0x1b')]=qs[_0xb416('0x1b')](_0x3dae8a[_0xb416('0x31')]['offset']);}return _0x51c669['getTags'](_0x5307fe);}})[_0xb416('0x26')](function(_0x159ea8){if(_0x159ea8){return _0x159ea8?{'count':_0x141ba1,'rows':_0x159ea8}:null;}})[_0xb416('0x26')](respondWithResult(_0xde56d,null))[_0xb416('0x46')](handleError(_0xde56d,null));};exports[_0xb416('0x51')]=function(_0x4dd9b1,_0x2089d4,_0x80037e){if(_0x4dd9b1[_0xb416('0x48')]['id']){delete _0x4dd9b1['body']['id'];}return db[_0xb416('0x2a')]['findOne']({'where':{'id':_0x4dd9b1[_0xb416('0x43')]['id']}})[_0xb416('0x26')](handleEntityNotFound(_0x2089d4,null))[_0xb416('0x26')](function(_0xaaf597){if(_0xaaf597){return _0xaaf597['setTags'](_0x4dd9b1['body'][_0xb416('0x52')]||[]);}return null;})[_0xb416('0x26')](respondWithResult(_0x2089d4,null))['catch'](handleError(_0x2089d4,null));}; \ No newline at end of file +var _0x4f90=['map','rawAttributes','fieldName','key','keys','filters','intersection','model','attributes','query','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','FreshdeskConfiguration','includeAll','findAll','rows','params','include','find','create','body','catch','getFields','findOne','FreshdeskField','filter','nolimit','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4f90,0x122));var _0x04f9=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0x4f90[_0xf72786];return _0x113f3e;};'use strict';var emlformat=require(_0x04f9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x04f9('0x1'));var rp=require(_0x04f9('0x2'));var moment=require('moment');var BPromise=require(_0x04f9('0x3'));var Mustache=require(_0x04f9('0x4'));var util=require('util');var path=require('path');var sox=require(_0x04f9('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x04f9('0x6'));var _=require(_0x04f9('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x04f9('0x8'));var deskjs=require(_0x04f9('0x9'));var toCsv=require(_0x04f9('0xa'));var querystring=require('querystring');var Papa=require(_0x04f9('0xb'));var Redis=require(_0x04f9('0xc'));var authService=require(_0x04f9('0xd'));var qs=require(_0x04f9('0xe'));var as=require(_0x04f9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x04f9('0x10'));var utils=require(_0x04f9('0x11'));var config=require(_0x04f9('0x12'));var licenseUtil=require(_0x04f9('0x13'));var db=require(_0x04f9('0x14'))['db'];function respondWithStatusCode(_0x6201b1,_0x2f49fc){_0x2f49fc=_0x2f49fc||0xcc;return function(_0x4491df){if(_0x4491df){return _0x6201b1[_0x04f9('0x15')](_0x2f49fc);}return _0x6201b1[_0x04f9('0x16')](_0x2f49fc)[_0x04f9('0x17')]();};}function respondWithResult(_0x3f8dbc,_0x281788){_0x281788=_0x281788||0xc8;return function(_0x76ad){if(_0x76ad){return _0x3f8dbc[_0x04f9('0x16')](_0x281788)[_0x04f9('0x18')](_0x76ad);}};}function respondWithFilteredResult(_0x4b4c2a,_0x280326){return function(_0x4392ac){if(_0x4392ac){var _0x459216=typeof _0x280326[_0x04f9('0x19')]===_0x04f9('0x1a')&&typeof _0x280326[_0x04f9('0x1b')]===_0x04f9('0x1a');var _0x2e16ff=_0x4392ac[_0x04f9('0x1c')];var _0x5d1d39=_0x459216?0x0:_0x280326['offset'];var _0x5cd1e5=_0x459216?_0x4392ac[_0x04f9('0x1c')]:_0x280326[_0x04f9('0x19')]+_0x280326[_0x04f9('0x1b')];var _0x29b728;if(_0x5cd1e5>=_0x2e16ff){_0x5cd1e5=_0x2e16ff;_0x29b728=0xc8;}else{_0x29b728=0xce;}_0x4b4c2a[_0x04f9('0x16')](_0x29b728);return _0x4b4c2a[_0x04f9('0x1d')](_0x04f9('0x1e'),_0x5d1d39+'-'+_0x5cd1e5+'/'+_0x2e16ff)['json'](_0x4392ac);}return null;};}function patchUpdates(_0x53a0b7){return function(_0x814688){try{jsonpatch[_0x04f9('0x1f')](_0x814688,_0x53a0b7,!![]);}catch(_0x3c588d){return BPromise[_0x04f9('0x20')](_0x3c588d);}return _0x814688[_0x04f9('0x21')]();};}function saveUpdates(_0x33f02a,_0x29f2d3){return function(_0x1d4167){if(_0x1d4167){return _0x1d4167[_0x04f9('0x22')](_0x33f02a)[_0x04f9('0x23')](function(_0xc25186){return _0xc25186;});}return null;};}function removeEntity(_0x354ac6,_0x5ab20e){return function(_0x2c148a){if(_0x2c148a){return _0x2c148a[_0x04f9('0x24')]()['then'](function(){_0x354ac6[_0x04f9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x554a03,_0x3df149){return function(_0x236370){if(!_0x236370){_0x554a03['sendStatus'](0x194);}return _0x236370;};}function handleError(_0x4ae61c,_0x2611cf){_0x2611cf=_0x2611cf||0x1f4;return function(_0x1a43ab){logger[_0x04f9('0x25')](_0x1a43ab[_0x04f9('0x26')]);if(_0x1a43ab[_0x04f9('0x27')]){delete _0x1a43ab[_0x04f9('0x27')];}_0x4ae61c['status'](_0x2611cf)[_0x04f9('0x28')](_0x1a43ab);};}exports[_0x04f9('0x29')]=function(_0x4edcd4,_0x3d1f4b){var _0x58a76a={},_0x4337fd={},_0x30641f={'count':0x0,'rows':[]};var _0x5a8e03=_[_0x04f9('0x2a')](db['FreshdeskConfiguration'][_0x04f9('0x2b')],function(_0x5bb5c3){return{'name':_0x5bb5c3[_0x04f9('0x2c')],'type':_0x5bb5c3['type'][_0x04f9('0x2d')]};});_0x4337fd['model']=_[_0x04f9('0x2a')](_0x5a8e03,_0x04f9('0x27'));_0x4337fd['query']=_[_0x04f9('0x2e')](_0x4edcd4['query']);_0x4337fd[_0x04f9('0x2f')]=_[_0x04f9('0x30')](_0x4337fd[_0x04f9('0x31')],_0x4337fd['query']);_0x58a76a[_0x04f9('0x32')]=_[_0x04f9('0x30')](_0x4337fd['model'],qs['fields'](_0x4edcd4[_0x04f9('0x33')][_0x04f9('0x34')]));_0x58a76a['attributes']=_0x58a76a[_0x04f9('0x32')][_0x04f9('0x35')]?_0x58a76a[_0x04f9('0x32')]:_0x4337fd[_0x04f9('0x31')];if(!_0x4edcd4['query'][_0x04f9('0x36')]('nolimit')){_0x58a76a[_0x04f9('0x1b')]=qs[_0x04f9('0x1b')](_0x4edcd4[_0x04f9('0x33')][_0x04f9('0x1b')]);_0x58a76a[_0x04f9('0x19')]=qs['offset'](_0x4edcd4[_0x04f9('0x33')][_0x04f9('0x19')]);}_0x58a76a[_0x04f9('0x37')]=qs[_0x04f9('0x38')](_0x4edcd4[_0x04f9('0x33')]['sort']);_0x58a76a[_0x04f9('0x39')]=qs[_0x04f9('0x2f')](_[_0x04f9('0x3a')](_0x4edcd4['query'],_0x4337fd[_0x04f9('0x2f')]),_0x5a8e03);if(_0x4edcd4[_0x04f9('0x33')]['filter']){_0x58a76a[_0x04f9('0x39')]=_['merge'](_0x58a76a[_0x04f9('0x39')],{'$or':_[_0x04f9('0x2a')](_0x5a8e03,function(_0x55d02a){if(_0x55d02a[_0x04f9('0x3b')]!==_0x04f9('0x3c')){var _0x4c025d={};_0x4c025d[_0x55d02a[_0x04f9('0x27')]]={'$like':'%'+_0x4edcd4[_0x04f9('0x33')]['filter']+'%'};return _0x4c025d;}})});}_0x58a76a=_[_0x04f9('0x3d')]({},_0x58a76a,_0x4edcd4[_0x04f9('0x3e')]);var _0x3714bb={'where':_0x58a76a['where']};return db[_0x04f9('0x3f')]['count'](_0x3714bb)[_0x04f9('0x23')](function(_0x255977){_0x30641f['count']=_0x255977;if(_0x4edcd4[_0x04f9('0x33')][_0x04f9('0x40')]){_0x58a76a['include']=[{'all':!![]}];}return db[_0x04f9('0x3f')][_0x04f9('0x41')](_0x58a76a);})[_0x04f9('0x23')](function(_0xdd8161){_0x30641f[_0x04f9('0x42')]=_0xdd8161;return _0x30641f;})[_0x04f9('0x23')](respondWithFilteredResult(_0x3d1f4b,_0x58a76a))['catch'](handleError(_0x3d1f4b,null));};exports['show']=function(_0x5f0e34,_0x374e30){var _0x2dadc6={'raw':![],'where':{'id':_0x5f0e34[_0x04f9('0x43')]['id']}},_0x22a48f={};_0x22a48f[_0x04f9('0x31')]=_[_0x04f9('0x2e')](db[_0x04f9('0x3f')][_0x04f9('0x2b')]);_0x22a48f[_0x04f9('0x33')]=_[_0x04f9('0x2e')](_0x5f0e34[_0x04f9('0x33')]);_0x22a48f[_0x04f9('0x2f')]=_[_0x04f9('0x30')](_0x22a48f['model'],_0x22a48f[_0x04f9('0x33')]);_0x2dadc6[_0x04f9('0x32')]=_[_0x04f9('0x30')](_0x22a48f['model'],qs[_0x04f9('0x34')](_0x5f0e34[_0x04f9('0x33')][_0x04f9('0x34')]));_0x2dadc6['attributes']=_0x2dadc6[_0x04f9('0x32')]['length']?_0x2dadc6['attributes']:_0x22a48f[_0x04f9('0x31')];if(_0x5f0e34[_0x04f9('0x33')][_0x04f9('0x40')]){_0x2dadc6[_0x04f9('0x44')]=[{'all':!![]}];}_0x2dadc6=_[_0x04f9('0x3d')]({},_0x2dadc6,_0x5f0e34['options']);return db[_0x04f9('0x3f')][_0x04f9('0x45')](_0x2dadc6)['then'](handleEntityNotFound(_0x374e30,null))[_0x04f9('0x23')](respondWithResult(_0x374e30,null))['catch'](handleError(_0x374e30,null));};exports[_0x04f9('0x46')]=function(_0x449304,_0x57ba96){return db['FreshdeskConfiguration'][_0x04f9('0x46')](_0x449304[_0x04f9('0x47')],{})['then'](respondWithResult(_0x57ba96,0xc9))[_0x04f9('0x48')](handleError(_0x57ba96,null));};exports['update']=function(_0x44cb15,_0x1a0c85){if(_0x44cb15[_0x04f9('0x47')]['id']){delete _0x44cb15[_0x04f9('0x47')]['id'];}return db[_0x04f9('0x3f')][_0x04f9('0x45')]({'where':{'id':_0x44cb15[_0x04f9('0x43')]['id']}})[_0x04f9('0x23')](handleEntityNotFound(_0x1a0c85,null))[_0x04f9('0x23')](saveUpdates(_0x44cb15[_0x04f9('0x47')],null))[_0x04f9('0x23')](respondWithResult(_0x1a0c85,null))['catch'](handleError(_0x1a0c85,null));};exports[_0x04f9('0x24')]=function(_0x4422d7,_0x3b417b){return db[_0x04f9('0x3f')][_0x04f9('0x45')]({'where':{'id':_0x4422d7[_0x04f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b417b,null))[_0x04f9('0x23')](removeEntity(_0x3b417b,null))['catch'](handleError(_0x3b417b,null));};exports[_0x04f9('0x49')]=function(_0x2be7a0,_0x17e094,_0x5d25c5){var _0x2a3b94={};var _0x157611={};var _0x1f6e66;var _0x54be6f;return db[_0x04f9('0x3f')][_0x04f9('0x4a')]({'where':{'id':_0x2be7a0[_0x04f9('0x43')]['id']}})[_0x04f9('0x23')](handleEntityNotFound(_0x17e094,null))['then'](function(_0x37e28b){if(_0x37e28b){_0x1f6e66=_0x37e28b;_0x157611[_0x04f9('0x31')]=_[_0x04f9('0x2e')](db[_0x04f9('0x4b')][_0x04f9('0x2b')]);_0x157611[_0x04f9('0x33')]=_[_0x04f9('0x2e')](_0x2be7a0[_0x04f9('0x33')]);_0x157611[_0x04f9('0x2f')]=_[_0x04f9('0x30')](_0x157611[_0x04f9('0x31')],_0x157611[_0x04f9('0x33')]);_0x2a3b94[_0x04f9('0x32')]=_[_0x04f9('0x30')](_0x157611['model'],qs[_0x04f9('0x34')](_0x2be7a0['query'][_0x04f9('0x34')]));_0x2a3b94[_0x04f9('0x32')]=_0x2a3b94[_0x04f9('0x32')][_0x04f9('0x35')]?_0x2a3b94['attributes']:_0x157611[_0x04f9('0x31')];_0x2a3b94[_0x04f9('0x37')]=qs['sort'](_0x2be7a0['query'][_0x04f9('0x38')]);_0x2a3b94['where']=qs[_0x04f9('0x2f')](_[_0x04f9('0x3a')](_0x2be7a0[_0x04f9('0x33')],_0x157611[_0x04f9('0x2f')]));if(_0x2be7a0['query'][_0x04f9('0x4c')]){_0x2a3b94[_0x04f9('0x39')]=_[_0x04f9('0x3d')](_0x2a3b94[_0x04f9('0x39')],{'$or':_[_0x04f9('0x2a')](_0x2a3b94[_0x04f9('0x32')],function(_0x483695){var _0x3fe432={};_0x3fe432[_0x483695]={'$like':'%'+_0x2be7a0[_0x04f9('0x33')][_0x04f9('0x4c')]+'%'};return _0x3fe432;})});}_0x2a3b94=_[_0x04f9('0x3d')]({},_0x2a3b94,_0x2be7a0[_0x04f9('0x3e')]);return _0x1f6e66['getFields'](_0x2a3b94);}})[_0x04f9('0x23')](function(_0x594186){if(_0x594186){_0x54be6f=_0x594186['length'];if(!_0x2be7a0[_0x04f9('0x33')][_0x04f9('0x36')](_0x04f9('0x4d'))){_0x2a3b94['limit']=qs[_0x04f9('0x1b')](_0x2be7a0[_0x04f9('0x33')][_0x04f9('0x1b')]);_0x2a3b94[_0x04f9('0x19')]=qs[_0x04f9('0x19')](_0x2be7a0[_0x04f9('0x33')]['offset']);}return _0x1f6e66['getFields'](_0x2a3b94);}})[_0x04f9('0x23')](function(_0x57a346){if(_0x57a346){return _0x57a346?{'count':_0x54be6f,'rows':_0x57a346}:null;}})['then'](respondWithResult(_0x17e094,null))['catch'](handleError(_0x17e094,null));};exports[_0x04f9('0x4e')]=function(_0x27abaf,_0x228aa4,_0x37474e){var _0x260c91={};var _0x54501b={};var _0x181210;var _0x42cb32;return db[_0x04f9('0x3f')][_0x04f9('0x4a')]({'where':{'id':_0x27abaf[_0x04f9('0x43')]['id']}})[_0x04f9('0x23')](handleEntityNotFound(_0x228aa4,null))[_0x04f9('0x23')](function(_0x4751d6){if(_0x4751d6){_0x181210=_0x4751d6;_0x54501b[_0x04f9('0x31')]=_[_0x04f9('0x2e')](db[_0x04f9('0x4b')][_0x04f9('0x2b')]);_0x54501b['query']=_[_0x04f9('0x2e')](_0x27abaf[_0x04f9('0x33')]);_0x54501b[_0x04f9('0x2f')]=_[_0x04f9('0x30')](_0x54501b[_0x04f9('0x31')],_0x54501b[_0x04f9('0x33')]);_0x260c91[_0x04f9('0x32')]=_[_0x04f9('0x30')](_0x54501b[_0x04f9('0x31')],qs['fields'](_0x27abaf[_0x04f9('0x33')]['fields']));_0x260c91[_0x04f9('0x32')]=_0x260c91[_0x04f9('0x32')][_0x04f9('0x35')]?_0x260c91['attributes']:_0x54501b[_0x04f9('0x31')];_0x260c91[_0x04f9('0x37')]=qs['sort'](_0x27abaf['query']['sort']);_0x260c91[_0x04f9('0x39')]=qs[_0x04f9('0x2f')](_['pick'](_0x27abaf['query'],_0x54501b[_0x04f9('0x2f')]));if(_0x27abaf[_0x04f9('0x33')][_0x04f9('0x4c')]){_0x260c91[_0x04f9('0x39')]=_[_0x04f9('0x3d')](_0x260c91[_0x04f9('0x39')],{'$or':_['map'](_0x260c91[_0x04f9('0x32')],function(_0x2010d9){var _0x27454f={};_0x27454f[_0x2010d9]={'$like':'%'+_0x27abaf[_0x04f9('0x33')][_0x04f9('0x4c')]+'%'};return _0x27454f;})});}_0x260c91=_['merge']({},_0x260c91,_0x27abaf['options']);return _0x181210[_0x04f9('0x4e')](_0x260c91);}})[_0x04f9('0x23')](function(_0x3c683c){if(_0x3c683c){_0x42cb32=_0x3c683c['length'];if(!_0x27abaf[_0x04f9('0x33')]['hasOwnProperty']('nolimit')){_0x260c91[_0x04f9('0x1b')]=qs[_0x04f9('0x1b')](_0x27abaf[_0x04f9('0x33')][_0x04f9('0x1b')]);_0x260c91[_0x04f9('0x19')]=qs[_0x04f9('0x19')](_0x27abaf[_0x04f9('0x33')]['offset']);}return _0x181210[_0x04f9('0x4e')](_0x260c91);}})[_0x04f9('0x23')](function(_0x44b6f7){if(_0x44b6f7){return _0x44b6f7?{'count':_0x42cb32,'rows':_0x44b6f7}:null;}})[_0x04f9('0x23')](respondWithResult(_0x228aa4,null))[_0x04f9('0x48')](handleError(_0x228aa4,null));};exports[_0x04f9('0x4f')]=function(_0x44c93e,_0x54d4e5,_0x6c4ea){var _0x125850={};var _0x20eac9={};var _0x245751;var _0xadd545;return db[_0x04f9('0x3f')][_0x04f9('0x4a')]({'where':{'id':_0x44c93e[_0x04f9('0x43')]['id']}})[_0x04f9('0x23')](handleEntityNotFound(_0x54d4e5,null))[_0x04f9('0x23')](function(_0x4a9293){if(_0x4a9293){_0x245751=_0x4a9293;_0x20eac9[_0x04f9('0x31')]=_['keys'](db[_0x04f9('0x4b')]['rawAttributes']);_0x20eac9[_0x04f9('0x33')]=_[_0x04f9('0x2e')](_0x44c93e['query']);_0x20eac9[_0x04f9('0x2f')]=_[_0x04f9('0x30')](_0x20eac9[_0x04f9('0x31')],_0x20eac9[_0x04f9('0x33')]);_0x125850[_0x04f9('0x32')]=_[_0x04f9('0x30')](_0x20eac9[_0x04f9('0x31')],qs[_0x04f9('0x34')](_0x44c93e[_0x04f9('0x33')][_0x04f9('0x34')]));_0x125850[_0x04f9('0x32')]=_0x125850[_0x04f9('0x32')][_0x04f9('0x35')]?_0x125850[_0x04f9('0x32')]:_0x20eac9[_0x04f9('0x31')];_0x125850['order']=qs['sort'](_0x44c93e['query']['sort']);_0x125850[_0x04f9('0x39')]=qs[_0x04f9('0x2f')](_[_0x04f9('0x3a')](_0x44c93e[_0x04f9('0x33')],_0x20eac9[_0x04f9('0x2f')]));if(_0x44c93e[_0x04f9('0x33')][_0x04f9('0x4c')]){_0x125850[_0x04f9('0x39')]=_[_0x04f9('0x3d')](_0x125850[_0x04f9('0x39')],{'$or':_[_0x04f9('0x2a')](_0x125850[_0x04f9('0x32')],function(_0x2d2823){var _0x16db1c={};_0x16db1c[_0x2d2823]={'$like':'%'+_0x44c93e[_0x04f9('0x33')]['filter']+'%'};return _0x16db1c;})});}_0x125850=_[_0x04f9('0x3d')]({},_0x125850,_0x44c93e[_0x04f9('0x3e')]);return _0x245751[_0x04f9('0x4f')](_0x125850);}})[_0x04f9('0x23')](function(_0x101e50){if(_0x101e50){_0xadd545=_0x101e50[_0x04f9('0x35')];if(!_0x44c93e[_0x04f9('0x33')]['hasOwnProperty']('nolimit')){_0x125850[_0x04f9('0x1b')]=qs[_0x04f9('0x1b')](_0x44c93e[_0x04f9('0x33')][_0x04f9('0x1b')]);_0x125850['offset']=qs['offset'](_0x44c93e[_0x04f9('0x33')][_0x04f9('0x19')]);}return _0x245751[_0x04f9('0x4f')](_0x125850);}})[_0x04f9('0x23')](function(_0x40c8fc){if(_0x40c8fc){return _0x40c8fc?{'count':_0xadd545,'rows':_0x40c8fc}:null;}})['then'](respondWithResult(_0x54d4e5,null))[_0x04f9('0x48')](handleError(_0x54d4e5,null));};exports[_0x04f9('0x50')]=function(_0x36091e,_0x206b83,_0x5b54aa){var _0xa394e1={};var _0x534385={};var _0x39c587;var _0x243f9d;return db[_0x04f9('0x3f')][_0x04f9('0x4a')]({'where':{'id':_0x36091e[_0x04f9('0x43')]['id']}})[_0x04f9('0x23')](handleEntityNotFound(_0x206b83,null))['then'](function(_0x2974ef){if(_0x2974ef){_0x39c587=_0x2974ef;_0x534385[_0x04f9('0x31')]=_[_0x04f9('0x2e')](db[_0x04f9('0x51')][_0x04f9('0x2b')]);_0x534385[_0x04f9('0x33')]=_[_0x04f9('0x2e')](_0x36091e[_0x04f9('0x33')]);_0x534385[_0x04f9('0x2f')]=_[_0x04f9('0x30')](_0x534385[_0x04f9('0x31')],_0x534385[_0x04f9('0x33')]);_0xa394e1['attributes']=_[_0x04f9('0x30')](_0x534385[_0x04f9('0x31')],qs['fields'](_0x36091e[_0x04f9('0x33')][_0x04f9('0x34')]));_0xa394e1[_0x04f9('0x32')]=_0xa394e1[_0x04f9('0x32')][_0x04f9('0x35')]?_0xa394e1[_0x04f9('0x32')]:_0x534385['model'];_0xa394e1['order']=qs[_0x04f9('0x38')](_0x36091e[_0x04f9('0x33')]['sort']);_0xa394e1['where']=qs['filters'](_[_0x04f9('0x3a')](_0x36091e[_0x04f9('0x33')],_0x534385[_0x04f9('0x2f')]));if(_0x36091e['query'][_0x04f9('0x4c')]){_0xa394e1[_0x04f9('0x39')]=_[_0x04f9('0x3d')](_0xa394e1[_0x04f9('0x39')],{'$or':_[_0x04f9('0x2a')](_0xa394e1[_0x04f9('0x32')],function(_0x21da5f){var _0x4c6e10={};_0x4c6e10[_0x21da5f]={'$like':'%'+_0x36091e[_0x04f9('0x33')][_0x04f9('0x4c')]+'%'};return _0x4c6e10;})});}_0xa394e1=_[_0x04f9('0x3d')]({},_0xa394e1,_0x36091e[_0x04f9('0x3e')]);return _0x39c587[_0x04f9('0x50')](_0xa394e1);}})[_0x04f9('0x23')](function(_0x5efe98){if(_0x5efe98){_0x243f9d=_0x5efe98[_0x04f9('0x35')];if(!_0x36091e[_0x04f9('0x33')][_0x04f9('0x36')]('nolimit')){_0xa394e1[_0x04f9('0x1b')]=qs[_0x04f9('0x1b')](_0x36091e[_0x04f9('0x33')]['limit']);_0xa394e1['offset']=qs[_0x04f9('0x19')](_0x36091e[_0x04f9('0x33')][_0x04f9('0x19')]);}return _0x39c587[_0x04f9('0x50')](_0xa394e1);}})[_0x04f9('0x23')](function(_0xc52290){if(_0xc52290){return _0xc52290?{'count':_0x243f9d,'rows':_0xc52290}:null;}})[_0x04f9('0x23')](respondWithResult(_0x206b83,null))[_0x04f9('0x48')](handleError(_0x206b83,null));};exports['setTags']=function(_0x3a25f9,_0x8f17c5,_0x4a9cc4){if(_0x3a25f9[_0x04f9('0x47')]['id']){delete _0x3a25f9['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3a25f9[_0x04f9('0x43')]['id']}})[_0x04f9('0x23')](handleEntityNotFound(_0x8f17c5,null))[_0x04f9('0x23')](function(_0x14a482){if(_0x14a482){return _0x14a482['setTags'](_0x3a25f9['body'][_0x04f9('0x52')]||[]);}return null;})[_0x04f9('0x23')](respondWithResult(_0x8f17c5,null))[_0x04f9('0x48')](handleError(_0x8f17c5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2dd63c9..ffa65e9 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 _0x16e2=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x2af0d0,_0x46efb2){var _0x588891=function(_0x452b66){while(--_0x452b66){_0x2af0d0['push'](_0x2af0d0['shift']());}};_0x588891(++_0x46efb2);}(_0x16e2,0xdc));var _0x216e=function(_0x25d08f,_0x14feca){_0x25d08f=_0x25d08f-0x0;var _0x39684d=_0x16e2[_0x25d08f];return _0x39684d;};'use strict';var _=require(_0x216e('0x0'));var util=require(_0x216e('0x1'));var logger=require(_0x216e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x216e('0x3'));var rp=require(_0x216e('0x4'));var fs=require('fs');var path=require(_0x216e('0x5'));var rimraf=require('rimraf');var config=require(_0x216e('0x6'));var attributes=require(_0x216e('0x7'));module[_0x216e('0x8')]=function(_0x25df8d,_0xa1484b){return _0x25df8d[_0x216e('0x9')](_0x216e('0xa'),attributes,{'tableName':_0x216e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5fd=['exports','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0xf5fd,0x188));var _0xdf5f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf5fd[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xdf5f('0x0'));var util=require(_0xdf5f('0x1'));var logger=require(_0xdf5f('0x2'))(_0xdf5f('0x3'));var moment=require(_0xdf5f('0x4'));var BPromise=require(_0xdf5f('0x5'));var rp=require(_0xdf5f('0x6'));var fs=require('fs');var path=require(_0xdf5f('0x7'));var rimraf=require(_0xdf5f('0x8'));var config=require(_0xdf5f('0x9'));var attributes=require(_0xdf5f('0xa'));module[_0xdf5f('0xb')]=function(_0x373633,_0x1bbba5){return _0x373633['define']('FreshdeskConfiguration',attributes,{'tableName':_0xdf5f('0xc'),'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 6a5bc7d..1238451 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 _0xb28a=['../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb'];(function(_0x5f2057,_0x59e593){var _0xa0c427=function(_0x3c5fc5){while(--_0x3c5fc5){_0x5f2057['push'](_0x5f2057['shift']());}};_0xa0c427(++_0x59e593);}(_0xb28a,0xc4));var _0xab28=function(_0x29c3ae,_0x1f1183){_0x29c3ae=_0x29c3ae-0x0;var _0x4066ee=_0xb28a[_0x29c3ae];return _0x4066ee;};'use strict';var _=require('lodash');var util=require(_0xab28('0x0'));var moment=require('moment');var BPromise=require(_0xab28('0x1'));var rs=require(_0xab28('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab28('0x3'))['db'];var utils=require(_0xab28('0x4'));var logger=require('../../config/logger')(_0xab28('0x5'));var config=require('../../config/environment');var jayson=require(_0xab28('0x6'));var client=jayson[_0xab28('0x7')][_0xab28('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dbf67,_0x1cc9d1,_0x261af8){return new BPromise(function(_0x35fd39,_0x234081){return client[_0xab28('0x9')](_0x5dbf67,_0x261af8)['then'](function(_0xf1716a){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1cc9d1,_0xab28('0xa'));logger[_0xab28('0xb')](_0xab28('0xc'),_0x1cc9d1,_0xab28('0xa'),JSON[_0xab28('0xd')](_0xf1716a));if(_0xf1716a[_0xab28('0xe')]){if(_0xf1716a['error'][_0xab28('0xf')]===0x1f4){logger[_0xab28('0xe')](_0xab28('0x10'),_0x1cc9d1,_0xf1716a[_0xab28('0xe')][_0xab28('0x11')]);return _0x234081(_0xf1716a[_0xab28('0xe')][_0xab28('0x11')]);}logger[_0xab28('0xe')](_0xab28('0x10'),_0x1cc9d1,_0xf1716a[_0xab28('0xe')]['message']);return _0x35fd39(_0xf1716a['error']['message']);}else{logger['info'](_0xab28('0x10'),_0x1cc9d1,'request\x20sent');_0x35fd39(_0xf1716a[_0xab28('0x12')][_0xab28('0x11')]);}})[_0xab28('0x13')](function(_0x37285c){logger[_0xab28('0xe')](_0xab28('0x10'),_0x1cc9d1,_0x37285c);_0x234081(_0x37285c);});});} \ No newline at end of file +var _0x2f06=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x49a58b,_0x28625d){var _0x3a9645=function(_0x15121d){while(--_0x15121d){_0x49a58b['push'](_0x49a58b['shift']());}};_0x3a9645(++_0x28625d);}(_0x2f06,0x1cd));var _0x62f0=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2f06[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x62f0('0x0'));var util=require(_0x62f0('0x1'));var moment=require(_0x62f0('0x2'));var BPromise=require(_0x62f0('0x3'));var rs=require(_0x62f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62f0('0x5'))['db'];var utils=require(_0x62f0('0x6'));var logger=require(_0x62f0('0x7'))(_0x62f0('0x8'));var config=require(_0x62f0('0x9'));var jayson=require(_0x62f0('0xa'));var client=jayson[_0x62f0('0xb')][_0x62f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41caa4,_0x297a21,_0x46e2f8){return new BPromise(function(_0x8e8838,_0x20cbe1){return client[_0x62f0('0xd')](_0x41caa4,_0x46e2f8)[_0x62f0('0xe')](function(_0x521275){logger[_0x62f0('0xf')](_0x62f0('0x10'),_0x297a21,_0x62f0('0x11'));logger[_0x62f0('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x297a21,'request\x20sent',JSON['stringify'](_0x521275));if(_0x521275[_0x62f0('0x13')]){if(_0x521275[_0x62f0('0x13')]['code']===0x1f4){logger[_0x62f0('0x13')](_0x62f0('0x10'),_0x297a21,_0x521275[_0x62f0('0x13')][_0x62f0('0x14')]);return _0x20cbe1(_0x521275[_0x62f0('0x13')]['message']);}logger[_0x62f0('0x13')](_0x62f0('0x10'),_0x297a21,_0x521275[_0x62f0('0x13')][_0x62f0('0x14')]);return _0x8e8838(_0x521275[_0x62f0('0x13')][_0x62f0('0x14')]);}else{logger['info'](_0x62f0('0x10'),_0x297a21,'request\x20sent');_0x8e8838(_0x521275[_0x62f0('0x15')][_0x62f0('0x14')]);}})[_0x62f0('0x16')](function(_0x530b97){logger[_0x62f0('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x297a21,_0x530b97);_0x20cbe1(_0x530b97);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2f11439..cab0784 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 _0x62be=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x54ccf9,_0x50041a){var _0x4ce26a=function(_0x3e2331){while(--_0x3e2331){_0x54ccf9['push'](_0x54ccf9['shift']());}};_0x4ce26a(++_0x50041a);}(_0x62be,0x10a));var _0xe62b=function(_0x42e478,_0x46b112){_0x42e478=_0x42e478-0x0;var _0x36a5d9=_0x62be[_0x42e478];return _0x36a5d9;};'use strict';var multer=require(_0xe62b('0x0'));var util=require('util');var path=require(_0xe62b('0x1'));var timeout=require(_0xe62b('0x2'));var express=require(_0xe62b('0x3'));var router=express[_0xe62b('0x4')]();var fs_extra=require(_0xe62b('0x5'));var auth=require(_0xe62b('0x6'));var interaction=require(_0xe62b('0x7'));var config=require(_0xe62b('0x8'));var controller=require(_0xe62b('0x9'));router[_0xe62b('0xa')]('/',auth[_0xe62b('0xb')](),controller['index']);router[_0xe62b('0xa')](_0xe62b('0xc'),auth[_0xe62b('0xb')](),controller[_0xe62b('0xd')]);router[_0xe62b('0xe')]('/',auth[_0xe62b('0xb')](),controller[_0xe62b('0xf')]);router[_0xe62b('0x10')](_0xe62b('0xc'),auth['isAuthenticated'](),controller[_0xe62b('0x11')]);router[_0xe62b('0x12')](_0xe62b('0xc'),auth[_0xe62b('0xb')](),controller[_0xe62b('0x13')]);module[_0xe62b('0x14')]=router; \ No newline at end of file +var _0xf772=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer'];(function(_0x47e8e0,_0x3418f1){var _0x3a671f=function(_0x33963d){while(--_0x33963d){_0x47e8e0['push'](_0x47e8e0['shift']());}};_0x3a671f(++_0x3418f1);}(_0xf772,0x168));var _0x2f77=function(_0x30f4f2,_0x5aef0a){_0x30f4f2=_0x30f4f2-0x0;var _0x38c6c0=_0xf772[_0x30f4f2];return _0x38c6c0;};'use strict';var multer=require(_0x2f77('0x0'));var util=require(_0x2f77('0x1'));var path=require(_0x2f77('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f77('0x3'));var router=express['Router']();var fs_extra=require(_0x2f77('0x4'));var auth=require(_0x2f77('0x5'));var interaction=require(_0x2f77('0x6'));var config=require(_0x2f77('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x2f77('0x8')]('/',auth['isAuthenticated'](),controller[_0x2f77('0x9')]);router[_0x2f77('0x8')](_0x2f77('0xa'),auth[_0x2f77('0xb')](),controller[_0x2f77('0xc')]);router[_0x2f77('0xd')]('/',auth[_0x2f77('0xb')](),controller['create']);router[_0x2f77('0xe')](_0x2f77('0xa'),auth[_0x2f77('0xb')](),controller[_0x2f77('0xf')]);router[_0x2f77('0x10')](_0x2f77('0xa'),auth[_0x2f77('0xb')](),controller[_0x2f77('0x11')]);module[_0x2f77('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index acb9ebf..1bdd42d 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 _0xfc37=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x330733,_0x7ebb70){var _0x466dd4=function(_0x416d08){while(--_0x416d08){_0x330733['push'](_0x330733['shift']());}};_0x466dd4(++_0x7ebb70);}(_0xfc37,0x17d));var _0x7fc3=function(_0x10fd02,_0x4215ca){_0x10fd02=_0x10fd02-0x0;var _0x42ccce=_0xfc37[_0x10fd02];return _0x42ccce;};'use strict';var Sequelize=require('sequelize');module[_0x7fc3('0x0')]={'type':{'type':Sequelize[_0x7fc3('0x1')](_0x7fc3('0x2'),_0x7fc3('0x3'),_0x7fc3('0x4'),_0x7fc3('0x5'),_0x7fc3('0x6')),'defaultValue':_0x7fc3('0x2')},'content':{'type':Sequelize[_0x7fc3('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7fc3('0x1')](_0x7fc3('0x2'),_0x7fc3('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7fc3('0x7')]},'idField':{'type':Sequelize[_0x7fc3('0x7')]},'nameField':{'type':Sequelize[_0x7fc3('0x7')]},'customField':{'type':Sequelize[_0x7fc3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcfef=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xcfef,0x164));var _0xfcfe=function(_0x14ac1e,_0x454c12){_0x14ac1e=_0x14ac1e-0x0;var _0x506260=_0xcfef[_0x14ac1e];return _0x506260;};'use strict';var Sequelize=require(_0xfcfe('0x0'));module[_0xfcfe('0x1')]={'type':{'type':Sequelize[_0xfcfe('0x2')](_0xfcfe('0x3'),_0xfcfe('0x4'),_0xfcfe('0x5'),_0xfcfe('0x6'),_0xfcfe('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfcfe('0x8')]},'key':{'type':Sequelize[_0xfcfe('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0xfcfe('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfcfe('0x8')]},'nameField':{'type':Sequelize[_0xfcfe('0x8')]},'customField':{'type':Sequelize[_0xfcfe('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfcfe('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f5bcb54..7108a2d 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 _0x6a24=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x6a24,0xd1));var _0x46a2=function(_0x410c2f,_0x333e3b){_0x410c2f=_0x410c2f-0x0;var _0x132297=_0x6a24[_0x410c2f];return _0x132297;};'use strict';var emlformat=require(_0x46a2('0x0'));var rimraf=require(_0x46a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require(_0x46a2('0x5'));var Mustache=require(_0x46a2('0x6'));var util=require('util');var path=require(_0x46a2('0x7'));var sox=require(_0x46a2('0x8'));var csv=require('to-csv');var ejs=require(_0x46a2('0x9'));var fs=require('fs');var fs_extra=require(_0x46a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46a2('0xb'));var jsforce=require(_0x46a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46a2('0xd'));var querystring=require('querystring');var Papa=require(_0x46a2('0xe'));var Redis=require('ioredis');var authService=require(_0x46a2('0xf'));var qs=require(_0x46a2('0x10'));var as=require(_0x46a2('0x11'));var hardwareService=require(_0x46a2('0x12'));var logger=require(_0x46a2('0x13'))(_0x46a2('0x14'));var utils=require(_0x46a2('0x15'));var config=require(_0x46a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403282,_0x18e584){_0x18e584=_0x18e584||0xcc;return function(_0x5c5d10){if(_0x5c5d10){return _0x403282[_0x46a2('0x17')](_0x18e584);}return _0x403282[_0x46a2('0x18')](_0x18e584)[_0x46a2('0x19')]();};}function respondWithResult(_0x18a038,_0xddc328){_0xddc328=_0xddc328||0xc8;return function(_0x2fd383){if(_0x2fd383){return _0x18a038[_0x46a2('0x18')](_0xddc328)[_0x46a2('0x1a')](_0x2fd383);}};}function respondWithFilteredResult(_0x577591,_0x4a7e7a){return function(_0x3c81e8){if(_0x3c81e8){var _0x2deb20=typeof _0x4a7e7a['offset']===_0x46a2('0x1b')&&typeof _0x4a7e7a[_0x46a2('0x1c')]==='undefined';var _0xa2eb96=_0x3c81e8[_0x46a2('0x1d')];var _0x577f18=_0x2deb20?0x0:_0x4a7e7a[_0x46a2('0x1e')];var _0x24f75f=_0x2deb20?_0x3c81e8['count']:_0x4a7e7a[_0x46a2('0x1e')]+_0x4a7e7a[_0x46a2('0x1c')];var _0x5144c7;if(_0x24f75f>=_0xa2eb96){_0x24f75f=_0xa2eb96;_0x5144c7=0xc8;}else{_0x5144c7=0xce;}_0x577591[_0x46a2('0x18')](_0x5144c7);return _0x577591[_0x46a2('0x1f')](_0x46a2('0x20'),_0x577f18+'-'+_0x24f75f+'/'+_0xa2eb96)[_0x46a2('0x1a')](_0x3c81e8);}return null;};}function patchUpdates(_0x202294){return function(_0x2d65c2){try{jsonpatch[_0x46a2('0x21')](_0x2d65c2,_0x202294,!![]);}catch(_0x473cfb){return BPromise[_0x46a2('0x22')](_0x473cfb);}return _0x2d65c2[_0x46a2('0x23')]();};}function saveUpdates(_0x5c7586,_0xa37d90){return function(_0x504b9e){if(_0x504b9e){return _0x504b9e[_0x46a2('0x24')](_0x5c7586)[_0x46a2('0x25')](function(_0x511ff6){return _0x511ff6;});}return null;};}function removeEntity(_0x43dc69,_0x15e5bb){return function(_0x233c4e){if(_0x233c4e){return _0x233c4e[_0x46a2('0x26')]()['then'](function(){_0x43dc69[_0x46a2('0x18')](0xcc)[_0x46a2('0x19')]();});}};}function handleEntityNotFound(_0x1e48f5,_0x297158){return function(_0x74bb6a){if(!_0x74bb6a){_0x1e48f5[_0x46a2('0x17')](0x194);}return _0x74bb6a;};}function handleError(_0x3e9554,_0xfa9e13){_0xfa9e13=_0xfa9e13||0x1f4;return function(_0x218f1c){logger[_0x46a2('0x27')](_0x218f1c[_0x46a2('0x28')]);if(_0x218f1c['name']){delete _0x218f1c[_0x46a2('0x29')];}_0x3e9554[_0x46a2('0x18')](_0xfa9e13)[_0x46a2('0x2a')](_0x218f1c);};}exports[_0x46a2('0x2b')]=function(_0x435155,_0x33f42a){var _0x577fd2={},_0x185647={},_0x26856f={'count':0x0,'rows':[]};var _0x2166eb=_[_0x46a2('0x2c')](db[_0x46a2('0x2d')][_0x46a2('0x2e')],function(_0x4024be){return{'name':_0x4024be['fieldName'],'type':_0x4024be[_0x46a2('0x2f')][_0x46a2('0x30')]};});_0x185647[_0x46a2('0x31')]=_[_0x46a2('0x2c')](_0x2166eb,_0x46a2('0x29'));_0x185647[_0x46a2('0x32')]=_[_0x46a2('0x33')](_0x435155[_0x46a2('0x32')]);_0x185647[_0x46a2('0x34')]=_['intersection'](_0x185647[_0x46a2('0x31')],_0x185647[_0x46a2('0x32')]);_0x577fd2[_0x46a2('0x35')]=_[_0x46a2('0x36')](_0x185647[_0x46a2('0x31')],qs['fields'](_0x435155['query'][_0x46a2('0x37')]));_0x577fd2[_0x46a2('0x35')]=_0x577fd2[_0x46a2('0x35')][_0x46a2('0x38')]?_0x577fd2[_0x46a2('0x35')]:_0x185647[_0x46a2('0x31')];if(!_0x435155['query']['hasOwnProperty'](_0x46a2('0x39'))){_0x577fd2['limit']=qs[_0x46a2('0x1c')](_0x435155[_0x46a2('0x32')][_0x46a2('0x1c')]);_0x577fd2[_0x46a2('0x1e')]=qs['offset'](_0x435155[_0x46a2('0x32')][_0x46a2('0x1e')]);}_0x577fd2[_0x46a2('0x3a')]=qs[_0x46a2('0x3b')](_0x435155['query'][_0x46a2('0x3b')]);_0x577fd2[_0x46a2('0x3c')]=qs[_0x46a2('0x34')](_[_0x46a2('0x3d')](_0x435155['query'],_0x185647[_0x46a2('0x34')]),_0x2166eb);if(_0x435155['query'][_0x46a2('0x3e')]){_0x577fd2['where']=_[_0x46a2('0x3f')](_0x577fd2[_0x46a2('0x3c')],{'$or':_['map'](_0x2166eb,function(_0x316b3d){if(_0x316b3d['type']!=='VIRTUAL'){var _0x25aa1d={};_0x25aa1d[_0x316b3d[_0x46a2('0x29')]]={'$like':'%'+_0x435155[_0x46a2('0x32')][_0x46a2('0x3e')]+'%'};return _0x25aa1d;}})});}_0x577fd2=_[_0x46a2('0x3f')]({},_0x577fd2,_0x435155[_0x46a2('0x40')]);var _0x482ed8={'where':_0x577fd2[_0x46a2('0x3c')]};return db[_0x46a2('0x2d')][_0x46a2('0x1d')](_0x482ed8)[_0x46a2('0x25')](function(_0x23cfc9){_0x26856f[_0x46a2('0x1d')]=_0x23cfc9;if(_0x435155[_0x46a2('0x32')][_0x46a2('0x41')]){_0x577fd2[_0x46a2('0x42')]=[{'all':!![]}];}return db[_0x46a2('0x2d')]['findAll'](_0x577fd2);})[_0x46a2('0x25')](function(_0x15ec39){_0x26856f[_0x46a2('0x43')]=_0x15ec39;return _0x26856f;})[_0x46a2('0x25')](respondWithFilteredResult(_0x33f42a,_0x577fd2))['catch'](handleError(_0x33f42a,null));};exports[_0x46a2('0x44')]=function(_0x18845e,_0x153305){var _0x3869d4={'raw':!![],'where':{'id':_0x18845e['params']['id']}},_0x1fcc03={};_0x1fcc03[_0x46a2('0x31')]=_['keys'](db[_0x46a2('0x2d')][_0x46a2('0x2e')]);_0x1fcc03['query']=_[_0x46a2('0x33')](_0x18845e[_0x46a2('0x32')]);_0x1fcc03[_0x46a2('0x34')]=_[_0x46a2('0x36')](_0x1fcc03[_0x46a2('0x31')],_0x1fcc03[_0x46a2('0x32')]);_0x3869d4[_0x46a2('0x35')]=_[_0x46a2('0x36')](_0x1fcc03[_0x46a2('0x31')],qs[_0x46a2('0x37')](_0x18845e['query'][_0x46a2('0x37')]));_0x3869d4[_0x46a2('0x35')]=_0x3869d4[_0x46a2('0x35')][_0x46a2('0x38')]?_0x3869d4[_0x46a2('0x35')]:_0x1fcc03['model'];if(_0x18845e[_0x46a2('0x32')][_0x46a2('0x41')]){_0x3869d4[_0x46a2('0x42')]=[{'all':!![]}];}_0x3869d4=_[_0x46a2('0x3f')]({},_0x3869d4,_0x18845e[_0x46a2('0x40')]);return db['FreshdeskField'][_0x46a2('0x45')](_0x3869d4)['then'](handleEntityNotFound(_0x153305,null))[_0x46a2('0x25')](respondWithResult(_0x153305,null))[_0x46a2('0x46')](handleError(_0x153305,null));};exports['create']=function(_0x41b4cd,_0x3f8673){return db[_0x46a2('0x2d')][_0x46a2('0x47')](_0x41b4cd[_0x46a2('0x48')],{})[_0x46a2('0x25')](respondWithResult(_0x3f8673,0xc9))[_0x46a2('0x46')](handleError(_0x3f8673,null));};exports['update']=function(_0x369015,_0x1f8640){if(_0x369015[_0x46a2('0x48')]['id']){delete _0x369015[_0x46a2('0x48')]['id'];}return db['FreshdeskField'][_0x46a2('0x45')]({'where':{'id':_0x369015['params']['id']}})[_0x46a2('0x25')](handleEntityNotFound(_0x1f8640,null))[_0x46a2('0x25')](saveUpdates(_0x369015['body'],null))[_0x46a2('0x25')](respondWithResult(_0x1f8640,null))['catch'](handleError(_0x1f8640,null));};exports[_0x46a2('0x26')]=function(_0x76ccd3,_0x3be2a7){return db[_0x46a2('0x2d')][_0x46a2('0x45')]({'where':{'id':_0x76ccd3[_0x46a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x3be2a7,null))['then'](removeEntity(_0x3be2a7,null))[_0x46a2('0x46')](handleError(_0x3be2a7,null));}; \ No newline at end of file +var _0x9348=['undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','FreshdeskField','count','include','findAll','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x4a2d63,_0x468f30){var _0x502f29=function(_0x2995ff){while(--_0x2995ff){_0x4a2d63['push'](_0x4a2d63['shift']());}};_0x502f29(++_0x468f30);}(_0x9348,0x10d));var _0x8934=function(_0x1a772f,_0x483183){_0x1a772f=_0x1a772f-0x0;var _0x512135=_0x9348[_0x1a772f];return _0x512135;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['FreshdeskField'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['FreshdeskField'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d4bddba..36ca2ae 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 _0xfb58=['util','../../config/logger','api','bluebird','path','../../config/environment','exports','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfb58,0x143));var _0x8fb5=function(_0x293f03,_0x14b01f){_0x293f03=_0x293f03-0x0;var _0x4e8861=_0xfb58[_0x293f03];return _0x4e8861;};'use strict';var _=require(_0x8fb5('0x0'));var util=require(_0x8fb5('0x1'));var logger=require(_0x8fb5('0x2'))(_0x8fb5('0x3'));var moment=require('moment');var BPromise=require(_0x8fb5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fb5('0x5'));var rimraf=require('rimraf');var config=require(_0x8fb5('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x8fb5('0x7')]=function(_0x5a4078,_0x5139f2){return _0x5a4078['define'](_0x8fb5('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x8fb5('0x9'),'fields':[_0x8fb5('0xa'),_0x8fb5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x209f=['freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0x5197e6,_0x3cd1d1){var _0x318101=function(_0x4be36d){while(--_0x4be36d){_0x5197e6['push'](_0x5197e6['shift']());}};_0x318101(++_0x3cd1d1);}(_0x209f,0x199));var _0xf209=function(_0x795791,_0x33a328){_0x795791=_0x795791-0x0;var _0xed46d1=_0x209f[_0x795791];return _0xed46d1;};'use strict';var _=require(_0xf209('0x0'));var util=require('util');var logger=require(_0xf209('0x1'))(_0xf209('0x2'));var moment=require('moment');var BPromise=require(_0xf209('0x3'));var rp=require(_0xf209('0x4'));var fs=require('fs');var path=require(_0xf209('0x5'));var rimraf=require('rimraf');var config=require(_0xf209('0x6'));var attributes=require(_0xf209('0x7'));module[_0xf209('0x8')]=function(_0x24b4e2,_0x46c481){return _0x24b4e2['define'](_0xf209('0x9'),attributes,{'tableName':_0xf209('0xa'),'paranoid':![],'indexes':[{'name':_0xf209('0xb'),'fields':[_0xf209('0xc'),_0xf209('0xd')],'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 4c740fd..6c3d5ef 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 _0x9c86=['debug','stringify','error','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x52b703,_0x3cdc81){var _0x46d88a=function(_0x31f3ce){while(--_0x31f3ce){_0x52b703['push'](_0x52b703['shift']());}};_0x46d88a(++_0x3cdc81);}(_0x9c86,0xe1));var _0x69c8=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9c86[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x69c8('0x0'));var BPromise=require(_0x69c8('0x1'));var rs=require(_0x69c8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69c8('0x3'))['db'];var utils=require(_0x69c8('0x4'));var logger=require(_0x69c8('0x5'))(_0x69c8('0x6'));var config=require(_0x69c8('0x7'));var jayson=require(_0x69c8('0x8'));var client=jayson['client'][_0x69c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9191,_0x5e5d41,_0x1fd80b){return new BPromise(function(_0x57eb45,_0x12e24d){return client[_0x69c8('0xa')](_0x2e9191,_0x1fd80b)[_0x69c8('0xb')](function(_0x27c9a8){logger[_0x69c8('0xc')](_0x69c8('0xd'),_0x5e5d41,_0x69c8('0xe'));logger[_0x69c8('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x5e5d41,_0x69c8('0xe'),JSON[_0x69c8('0x10')](_0x27c9a8));if(_0x27c9a8[_0x69c8('0x11')]){if(_0x27c9a8[_0x69c8('0x11')]['code']===0x1f4){logger['error'](_0x69c8('0xd'),_0x5e5d41,_0x27c9a8[_0x69c8('0x11')][_0x69c8('0x12')]);return _0x12e24d(_0x27c9a8[_0x69c8('0x11')][_0x69c8('0x12')]);}logger[_0x69c8('0x11')](_0x69c8('0xd'),_0x5e5d41,_0x27c9a8[_0x69c8('0x11')][_0x69c8('0x12')]);return _0x57eb45(_0x27c9a8['error'][_0x69c8('0x12')]);}else{logger[_0x69c8('0xc')](_0x69c8('0xd'),_0x5e5d41,'request\x20sent');_0x57eb45(_0x27c9a8['result']['message']);}})[_0x69c8('0x13')](function(_0x5b6582){logger['error'](_0x69c8('0xd'),_0x5e5d41,_0x5b6582);_0x12e24d(_0x5b6582);});});} \ No newline at end of file +var _0xe42a=['request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x189c67,_0x55f88d){var _0x406e91=function(_0x3cb25f){while(--_0x3cb25f){_0x189c67['push'](_0x189c67['shift']());}};_0x406e91(++_0x55f88d);}(_0xe42a,0x1ad));var _0xae42=function(_0x4f7a0f,_0x59d351){_0x4f7a0f=_0x4f7a0f-0x0;var _0x40e483=_0xe42a[_0x4f7a0f];return _0x40e483;};'use strict';var _=require(_0xae42('0x0'));var util=require(_0xae42('0x1'));var moment=require(_0xae42('0x2'));var BPromise=require(_0xae42('0x3'));var rs=require(_0xae42('0x4'));var fs=require('fs');var Redis=require(_0xae42('0x5'));var db=require(_0xae42('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xae42('0x7'))(_0xae42('0x8'));var config=require(_0xae42('0x9'));var jayson=require(_0xae42('0xa'));var client=jayson[_0xae42('0xb')][_0xae42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39a81f,_0x368633,_0x46a0dd){return new BPromise(function(_0x2f578c,_0x520d8c){return client[_0xae42('0xd')](_0x39a81f,_0x46a0dd)[_0xae42('0xe')](function(_0xa52871){logger[_0xae42('0xf')](_0xae42('0x10'),_0x368633,_0xae42('0x11'));logger[_0xae42('0x12')](_0xae42('0x13'),_0x368633,'request\x20sent',JSON[_0xae42('0x14')](_0xa52871));if(_0xa52871[_0xae42('0x15')]){if(_0xa52871[_0xae42('0x15')][_0xae42('0x16')]===0x1f4){logger[_0xae42('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x368633,_0xa52871[_0xae42('0x15')]['message']);return _0x520d8c(_0xa52871[_0xae42('0x15')]['message']);}logger[_0xae42('0x15')](_0xae42('0x10'),_0x368633,_0xa52871['error']['message']);return _0x2f578c(_0xa52871[_0xae42('0x15')][_0xae42('0x17')]);}else{logger[_0xae42('0xf')](_0xae42('0x10'),_0x368633,_0xae42('0x11'));_0x2f578c(_0xa52871[_0xae42('0x18')][_0xae42('0x17')]);}})[_0xae42('0x19')](function(_0x121f0c){logger[_0xae42('0x15')](_0xae42('0x10'),_0x368633,_0x121f0c);_0x520d8c(_0x121f0c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0c43a23..78b6eb1 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 _0x9354=['addConfiguration','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x28aeb2,_0x319b38){var _0x1d33e1=function(_0x651b59){while(--_0x651b59){_0x28aeb2['push'](_0x28aeb2['shift']());}};_0x1d33e1(++_0x319b38);}(_0x9354,0x96));var _0x4935=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x9354[_0x1265ed];return _0x5ac459;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4935('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x15')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0x16')]);module[_0x4935('0x17')]=router; \ No newline at end of file +var _0xe5b5=['index','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x4395cb,_0x32a140){var _0x2833d5=function(_0x575626){while(--_0x575626){_0x4395cb['push'](_0x4395cb['shift']());}};_0x2833d5(++_0x32a140);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0xe5b5[_0x571a17];return _0x3ef337;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/fields',auth[_0x5e5b('0xc')](),controller['getFields']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router[_0x5e5b('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5e5b('0x14')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller['destroy']);module[_0x5e5b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b4edd41..7399308 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 _0x5c3c=['remoteUri','sequelize','exports','STRING','username'];(function(_0x54f4f1,_0x2e603b){var _0x14b71f=function(_0x410ca5){while(--_0x410ca5){_0x54f4f1['push'](_0x54f4f1['shift']());}};_0x14b71f(++_0x2e603b);}(_0x5c3c,0x132));var _0xc5c3=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x5c3c[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'name':{'type':Sequelize[_0xc5c3('0x2')]},'description':{'type':Sequelize[_0xc5c3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc5c3('0x3')},'apiKey':{'type':Sequelize[_0xc5c3('0x2')]},'remoteUri':{'type':Sequelize[_0xc5c3('0x2')],'unique':_0xc5c3('0x4')},'serverUrl':{'type':Sequelize[_0xc5c3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x2c42fa,_0x19563e){var _0x19b5b8=function(_0x3775db){while(--_0x3775db){_0x2c42fa['push'](_0x2c42fa['shift']());}};_0x19b5b8(++_0x19563e);}(_0x7916,0x128));var _0x6791=function(_0x49e3a4,_0x263356){_0x49e3a4=_0x49e3a4-0x0;var _0x1e36a5=_0x7916[_0x49e3a4];return _0x1e36a5;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index dbf0c47..9aec5b1 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 _0x18aa=['stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','type','FreshsalesField','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','count','offset','limit','save','update','then','destroy'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x18aa,0x16d));var _0xa18a=function(_0x5c163c,_0x55da6a){_0x5c163c=_0x5c163c-0x0;var _0x4e2d05=_0x18aa[_0x5c163c];return _0x4e2d05;};'use strict';var emlformat=require(_0xa18a('0x0'));var rimraf=require(_0xa18a('0x1'));var zipdir=require(_0xa18a('0x2'));var jsonpatch=require(_0xa18a('0x3'));var rp=require(_0xa18a('0x4'));var moment=require('moment');var BPromise=require(_0xa18a('0x5'));var Mustache=require(_0xa18a('0x6'));var util=require(_0xa18a('0x7'));var path=require(_0xa18a('0x8'));var sox=require(_0xa18a('0x9'));var csv=require('to-csv');var ejs=require(_0xa18a('0xa'));var fs=require('fs');var fs_extra=require(_0xa18a('0xb'));var _=require(_0xa18a('0xc'));var squel=require('squel');var crypto=require(_0xa18a('0xd'));var jsforce=require(_0xa18a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa18a('0xf'));var querystring=require(_0xa18a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa18a('0x11'));var qs=require(_0xa18a('0x12'));var as=require(_0xa18a('0x13'));var hardwareService=require(_0xa18a('0x14'));var logger=require(_0xa18a('0x15'))(_0xa18a('0x16'));var utils=require(_0xa18a('0x17'));var config=require(_0xa18a('0x18'));var licenseUtil=require(_0xa18a('0x19'));var db=require(_0xa18a('0x1a'))['db'];var integrations=require(_0xa18a('0x1b'));function respondWithStatusCode(_0x5b6e1e,_0x478586){_0x478586=_0x478586||0xcc;return function(_0x272c32){if(_0x272c32){return _0x5b6e1e[_0xa18a('0x1c')](_0x478586);}return _0x5b6e1e['status'](_0x478586)[_0xa18a('0x1d')]();};}function respondWithResult(_0x166dcf,_0x4f4244){_0x4f4244=_0x4f4244||0xc8;return function(_0x5d3a1b){if(_0x5d3a1b){return _0x166dcf[_0xa18a('0x1e')](_0x4f4244)[_0xa18a('0x1f')](_0x5d3a1b);}};}function respondWithFilteredResult(_0x569f45,_0x4ce5c8){return function(_0x213860){if(_0x213860){var _0x4c082e=typeof _0x4ce5c8['offset']==='undefined'&&typeof _0x4ce5c8['limit']==='undefined';var _0x1b07db=_0x213860[_0xa18a('0x20')];var _0x19a9e8=_0x4c082e?0x0:_0x4ce5c8[_0xa18a('0x21')];var _0x528b18=_0x4c082e?_0x213860[_0xa18a('0x20')]:_0x4ce5c8[_0xa18a('0x21')]+_0x4ce5c8[_0xa18a('0x22')];var _0xea19ad;if(_0x528b18>=_0x1b07db){_0x528b18=_0x1b07db;_0xea19ad=0xc8;}else{_0xea19ad=0xce;}_0x569f45[_0xa18a('0x1e')](_0xea19ad);return _0x569f45['set']('Content-Range',_0x19a9e8+'-'+_0x528b18+'/'+_0x1b07db)[_0xa18a('0x1f')](_0x213860);}return null;};}function patchUpdates(_0x764200){return function(_0x9fe8cd){try{jsonpatch['apply'](_0x9fe8cd,_0x764200,!![]);}catch(_0x345b20){return BPromise['reject'](_0x345b20);}return _0x9fe8cd[_0xa18a('0x23')]();};}function saveUpdates(_0x5da693,_0x153c9c){return function(_0x322592){if(_0x322592){return _0x322592[_0xa18a('0x24')](_0x5da693)[_0xa18a('0x25')](function(_0x537aa2){return _0x537aa2;});}return null;};}function removeEntity(_0xfc934a,_0x365345){return function(_0x1e8b7f){if(_0x1e8b7f){return _0x1e8b7f[_0xa18a('0x26')]()[_0xa18a('0x25')](function(){_0xfc934a[_0xa18a('0x1e')](0xcc)[_0xa18a('0x1d')]();});}};}function handleEntityNotFound(_0x1e9b30,_0x21d771){return function(_0x4227c1){if(!_0x4227c1){_0x1e9b30[_0xa18a('0x1c')](0x194);}return _0x4227c1;};}function handleError(_0x195579,_0x453f29){_0x453f29=_0x453f29||0x1f4;return function(_0x1b7227){logger['error'](_0x1b7227[_0xa18a('0x27')]);if(_0x1b7227[_0xa18a('0x28')]){delete _0x1b7227[_0xa18a('0x28')];}_0x195579[_0xa18a('0x1e')](_0x453f29)[_0xa18a('0x29')](_0x1b7227);};}exports['index']=function(_0x44348d,_0x5bda57){var _0x23fe67={},_0x28ef74={},_0x14d5c6={'count':0x0,'rows':[]};var _0x5e1cd7=_[_0xa18a('0x2a')](db[_0xa18a('0x2b')][_0xa18a('0x2c')],function(_0x463144){return{'name':_0x463144[_0xa18a('0x2d')],'type':_0x463144['type'][_0xa18a('0x2e')]};});_0x28ef74[_0xa18a('0x2f')]=_[_0xa18a('0x2a')](_0x5e1cd7,_0xa18a('0x28'));_0x28ef74[_0xa18a('0x30')]=_[_0xa18a('0x31')](_0x44348d[_0xa18a('0x30')]);_0x28ef74[_0xa18a('0x32')]=_[_0xa18a('0x33')](_0x28ef74[_0xa18a('0x2f')],_0x28ef74['query']);_0x23fe67[_0xa18a('0x34')]=_[_0xa18a('0x33')](_0x28ef74[_0xa18a('0x2f')],qs[_0xa18a('0x35')](_0x44348d[_0xa18a('0x30')][_0xa18a('0x35')]));_0x23fe67[_0xa18a('0x34')]=_0x23fe67['attributes'][_0xa18a('0x36')]?_0x23fe67[_0xa18a('0x34')]:_0x28ef74['model'];if(!_0x44348d[_0xa18a('0x30')][_0xa18a('0x37')](_0xa18a('0x38'))){_0x23fe67[_0xa18a('0x22')]=qs['limit'](_0x44348d[_0xa18a('0x30')][_0xa18a('0x22')]);_0x23fe67['offset']=qs['offset'](_0x44348d['query']['offset']);}_0x23fe67[_0xa18a('0x39')]=qs[_0xa18a('0x3a')](_0x44348d['query'][_0xa18a('0x3a')]);_0x23fe67[_0xa18a('0x3b')]=qs['filters'](_[_0xa18a('0x3c')](_0x44348d[_0xa18a('0x30')],_0x28ef74[_0xa18a('0x32')]),_0x5e1cd7);if(_0x44348d['query']['filter']){_0x23fe67[_0xa18a('0x3b')]=_[_0xa18a('0x3d')](_0x23fe67[_0xa18a('0x3b')],{'$or':_[_0xa18a('0x2a')](_0x5e1cd7,function(_0x257a6f){if(_0x257a6f['type']!==_0xa18a('0x3e')){var _0x30c702={};_0x30c702[_0x257a6f[_0xa18a('0x28')]]={'$like':'%'+_0x44348d[_0xa18a('0x30')][_0xa18a('0x3f')]+'%'};return _0x30c702;}})});}_0x23fe67=_['merge']({},_0x23fe67,_0x44348d[_0xa18a('0x40')]);var _0x320a11={'where':_0x23fe67['where']};return db[_0xa18a('0x2b')]['count'](_0x320a11)[_0xa18a('0x25')](function(_0x1a6717){_0x14d5c6[_0xa18a('0x20')]=_0x1a6717;if(_0x44348d[_0xa18a('0x30')][_0xa18a('0x41')]){_0x23fe67[_0xa18a('0x42')]=[{'all':!![]}];}return db[_0xa18a('0x2b')][_0xa18a('0x43')](_0x23fe67);})[_0xa18a('0x25')](function(_0x572001){_0x14d5c6[_0xa18a('0x44')]=_0x572001;return _0x14d5c6;})[_0xa18a('0x25')](respondWithFilteredResult(_0x5bda57,_0x23fe67))['catch'](handleError(_0x5bda57,null));};exports['show']=function(_0x4de1ba,_0xc99b1d){var _0x302b07={'raw':![],'where':{'id':_0x4de1ba[_0xa18a('0x45')]['id']}},_0x41d47d={};_0x41d47d[_0xa18a('0x2f')]=_[_0xa18a('0x31')](db[_0xa18a('0x2b')]['rawAttributes']);_0x41d47d[_0xa18a('0x30')]=_[_0xa18a('0x31')](_0x4de1ba['query']);_0x41d47d[_0xa18a('0x32')]=_['intersection'](_0x41d47d[_0xa18a('0x2f')],_0x41d47d[_0xa18a('0x30')]);_0x302b07['attributes']=_['intersection'](_0x41d47d[_0xa18a('0x2f')],qs[_0xa18a('0x35')](_0x4de1ba[_0xa18a('0x30')][_0xa18a('0x35')]));_0x302b07[_0xa18a('0x34')]=_0x302b07['attributes'][_0xa18a('0x36')]?_0x302b07[_0xa18a('0x34')]:_0x41d47d[_0xa18a('0x2f')];if(_0x4de1ba[_0xa18a('0x30')]['includeAll']){_0x302b07[_0xa18a('0x42')]=[{'all':!![]}];}_0x302b07=_[_0xa18a('0x3d')]({},_0x302b07,_0x4de1ba['options']);return db[_0xa18a('0x2b')][_0xa18a('0x46')](_0x302b07)[_0xa18a('0x25')](handleEntityNotFound(_0xc99b1d,null))[_0xa18a('0x25')](respondWithResult(_0xc99b1d,null))[_0xa18a('0x47')](handleError(_0xc99b1d,null));};exports[_0xa18a('0x48')]=function(_0x1b07af,_0x319a5c){return db[_0xa18a('0x2b')][_0xa18a('0x48')](_0x1b07af[_0xa18a('0x49')],{})[_0xa18a('0x25')](respondWithResult(_0x319a5c,0xc9))[_0xa18a('0x47')](handleError(_0x319a5c,null));};exports[_0xa18a('0x24')]=function(_0x4e64bd,_0x453d53){if(_0x4e64bd[_0xa18a('0x49')]['id']){delete _0x4e64bd[_0xa18a('0x49')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x4e64bd[_0xa18a('0x45')]['id']}})[_0xa18a('0x25')](handleEntityNotFound(_0x453d53,null))[_0xa18a('0x25')](saveUpdates(_0x4e64bd[_0xa18a('0x49')],null))[_0xa18a('0x25')](respondWithResult(_0x453d53,null))[_0xa18a('0x47')](handleError(_0x453d53,null));};exports['destroy']=function(_0x506ade,_0x508c78){return db[_0xa18a('0x2b')][_0xa18a('0x46')]({'where':{'id':_0x506ade[_0xa18a('0x45')]['id']}})['then'](handleEntityNotFound(_0x508c78,null))[_0xa18a('0x25')](removeEntity(_0x508c78,null))[_0xa18a('0x47')](handleError(_0x508c78,null));};exports[_0xa18a('0x4a')]=function(_0x85556b,_0x1d5f44,_0x330df4){var _0x26e616={};var _0x2529da={};var _0x478a5a;var _0x2f057d;return db[_0xa18a('0x2b')][_0xa18a('0x4b')]({'where':{'id':_0x85556b[_0xa18a('0x45')]['id']}})[_0xa18a('0x25')](handleEntityNotFound(_0x1d5f44,null))[_0xa18a('0x25')](function(_0x2a08d7){if(_0x2a08d7){_0x478a5a=_0x2a08d7;_0x2529da[_0xa18a('0x2f')]=_['keys'](db[_0xa18a('0x4c')][_0xa18a('0x2c')]);_0x2529da[_0xa18a('0x30')]=_[_0xa18a('0x31')](_0x85556b[_0xa18a('0x30')]);_0x2529da[_0xa18a('0x32')]=_[_0xa18a('0x33')](_0x2529da['model'],_0x2529da[_0xa18a('0x30')]);_0x26e616[_0xa18a('0x34')]=_[_0xa18a('0x33')](_0x2529da['model'],qs[_0xa18a('0x35')](_0x85556b[_0xa18a('0x30')][_0xa18a('0x35')]));_0x26e616[_0xa18a('0x34')]=_0x26e616[_0xa18a('0x34')][_0xa18a('0x36')]?_0x26e616[_0xa18a('0x34')]:_0x2529da[_0xa18a('0x2f')];_0x26e616[_0xa18a('0x39')]=qs['sort'](_0x85556b[_0xa18a('0x30')]['sort']);_0x26e616[_0xa18a('0x3b')]=qs['filters'](_['pick'](_0x85556b[_0xa18a('0x30')],_0x2529da[_0xa18a('0x32')]));if(_0x85556b[_0xa18a('0x30')]['filter']){_0x26e616[_0xa18a('0x3b')]=_[_0xa18a('0x3d')](_0x26e616[_0xa18a('0x3b')],{'$or':_[_0xa18a('0x2a')](_0x26e616[_0xa18a('0x34')],function(_0x376b76){var _0x1fbb8f={};_0x1fbb8f[_0x376b76]={'$like':'%'+_0x85556b['query'][_0xa18a('0x3f')]+'%'};return _0x1fbb8f;})});}_0x26e616=_[_0xa18a('0x3d')]({},_0x26e616,_0x85556b[_0xa18a('0x40')]);return _0x478a5a[_0xa18a('0x4a')](_0x26e616);}})['then'](function(_0x551870){if(_0x551870){_0x2f057d=_0x551870[_0xa18a('0x36')];if(!_0x85556b['query'][_0xa18a('0x37')](_0xa18a('0x38'))){_0x26e616[_0xa18a('0x22')]=qs[_0xa18a('0x22')](_0x85556b[_0xa18a('0x30')][_0xa18a('0x22')]);_0x26e616[_0xa18a('0x21')]=qs['offset'](_0x85556b[_0xa18a('0x30')][_0xa18a('0x21')]);}return _0x478a5a[_0xa18a('0x4a')](_0x26e616);}})[_0xa18a('0x25')](function(_0x2a16ff){if(_0x2a16ff){return _0x2a16ff?{'count':_0x2f057d,'rows':_0x2a16ff}:null;}})[_0xa18a('0x25')](respondWithResult(_0x1d5f44,null))[_0xa18a('0x47')](handleError(_0x1d5f44,null));};exports['addConfiguration']=function(_0x6f8813,_0x4e8d11,_0x52c50b){if(_0x6f8813[_0xa18a('0x49')]['id']){delete _0x6f8813['body']['id'];}return db[_0xa18a('0x2b')][_0xa18a('0x4b')]({'where':{'id':_0x6f8813[_0xa18a('0x45')]['id']}})[_0xa18a('0x25')](handleEntityNotFound(_0x4e8d11,null))['then'](function(_0x591a80){if(_0x591a80){_0x6f8813[_0xa18a('0x49')]['AccountId']=_0x591a80['id'];_0x6f8813[_0xa18a('0x49')][_0xa18a('0x4d')]=integrations[_0xa18a('0x4e')](_0x6f8813[_0xa18a('0x49')]['channel'],_0x6f8813['body']['type']);_0x6f8813[_0xa18a('0x49')][_0xa18a('0x4f')]=integrations[_0xa18a('0x50')](_0x6f8813['body'][_0xa18a('0x51')],_0x6f8813[_0xa18a('0x49')][_0xa18a('0x52')]);return db['FreshsalesConfiguration']['create'](_0x6f8813[_0xa18a('0x49')],{'include':[{'model':db['FreshsalesField'],'as':_0xa18a('0x4d')},{'model':db[_0xa18a('0x53')],'as':_0xa18a('0x4f')}]});}return null;})[_0xa18a('0x25')](respondWithResult(_0x4e8d11,null))[_0xa18a('0x47')](handleError(_0x4e8d11,null));};exports['getFields']=function(_0x2f1db3,_0x3938ac,_0xea8bc0){var _0x371881='';var _0x101610='';return db[_0xa18a('0x2b')][_0xa18a('0x4b')]({'where':{'id':_0x2f1db3[_0xa18a('0x45')]['id']},'attributes':['id',_0xa18a('0x54'),_0xa18a('0x55'),'apiKey']})[_0xa18a('0x25')](handleEntityNotFound(_0x3938ac,null))[_0xa18a('0x25')](function(_0x151590){if(_0x151590){_0x101610=_0x151590['username'];_0x371881=_0x151590['remoteUri'];var _0x4a5596=_0x151590[_0xa18a('0x55')]['slice'](-0x1);if(_0x4a5596==='/'){_0x371881=_0x371881[_0xa18a('0x56')](0x0,_0x371881[_0xa18a('0x57')](_0x4a5596));}return rp({'method':_0xa18a('0x58'),'uri':util[_0xa18a('0x59')](_0xa18a('0x5a'),_0x371881,_0xa18a('0x5b')),'headers':{'Authorization':_0xa18a('0x5c')+_0x151590[_0xa18a('0x5d')]},'json':!![]});}})['then'](function(_0x321e5d){if(_0x321e5d){var _0x98d220=_0x321e5d[_0xa18a('0x5e')];var _0x2a7bc6=![];var _0x5528c0=null;for(_0x5528c0=0x0;_0x5528c0<_0x98d220[_0xa18a('0x36')];_0x5528c0++){if(_0x98d220[_0x5528c0][_0xa18a('0x5f')]===_0x101610){_0x2a7bc6=!![];}}if(_0x2a7bc6){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa18a('0x60')});}}})[_0xa18a('0x25')](respondWithResult(_0x3938ac,null))['catch'](function(_0x4cc581){var _0x157fa5=_0x2f1db3[_0xa18a('0x30')]['test']?0x1f4:_0x4cc581[_0xa18a('0x61')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x157fa5,JSON[_0xa18a('0x62')](_0x4cc581));delete _0x4cc581[_0xa18a('0x28')];if(_0x157fa5===0x191){_0x157fa5=0x190;}_0x3938ac[_0xa18a('0x1e')](_0x157fa5)[_0xa18a('0x29')](_0x2f1db3[_0xa18a('0x30')][_0xa18a('0x63')]?{'message':_0xa18a('0x64'),'statusCode':_0x4cc581[_0xa18a('0x61')]}:_0x4cc581);});}; \ No newline at end of file +var _0xc413=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','status','index','map','FreshsalesAccount','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','test','statusCode','error','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x3d0b8a,_0x2d35a6){var _0x19289b=function(_0x31d7d3){while(--_0x31d7d3){_0x3d0b8a['push'](_0x3d0b8a['shift']());}};_0x19289b(++_0x2d35a6);}(_0xc413,0x173));var _0x3c41=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc413[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c41('0x0'));var zipdir=require(_0x3c41('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c41('0x2'));var moment=require(_0x3c41('0x3'));var BPromise=require(_0x3c41('0x4'));var Mustache=require(_0x3c41('0x5'));var util=require('util');var path=require(_0x3c41('0x6'));var sox=require(_0x3c41('0x7'));var csv=require(_0x3c41('0x8'));var ejs=require(_0x3c41('0x9'));var fs=require('fs');var fs_extra=require(_0x3c41('0xa'));var _=require(_0x3c41('0xb'));var squel=require(_0x3c41('0xc'));var crypto=require(_0x3c41('0xd'));var jsforce=require(_0x3c41('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c41('0xf'));var Papa=require(_0x3c41('0x10'));var Redis=require(_0x3c41('0x11'));var authService=require(_0x3c41('0x12'));var qs=require(_0x3c41('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c41('0x14'))(_0x3c41('0x15'));var utils=require(_0x3c41('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3c41('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4af4bf,_0x37b135){_0x37b135=_0x37b135||0xcc;return function(_0x1a5da0){if(_0x1a5da0){return _0x4af4bf[_0x3c41('0x18')](_0x37b135);}return _0x4af4bf['status'](_0x37b135)[_0x3c41('0x19')]();};}function respondWithResult(_0xd06aa2,_0x256850){_0x256850=_0x256850||0xc8;return function(_0x35cf3e){if(_0x35cf3e){return _0xd06aa2['status'](_0x256850)[_0x3c41('0x1a')](_0x35cf3e);}};}function respondWithFilteredResult(_0x402c1f,_0x3239a1){return function(_0x3bf421){if(_0x3bf421){var _0x2eef82=typeof _0x3239a1[_0x3c41('0x1b')]===_0x3c41('0x1c')&&typeof _0x3239a1[_0x3c41('0x1d')]===_0x3c41('0x1c');var _0x2c2f23=_0x3bf421['count'];var _0x20f0bc=_0x2eef82?0x0:_0x3239a1[_0x3c41('0x1b')];var _0x45d070=_0x2eef82?_0x3bf421[_0x3c41('0x1e')]:_0x3239a1['offset']+_0x3239a1['limit'];var _0x3eb284;if(_0x45d070>=_0x2c2f23){_0x45d070=_0x2c2f23;_0x3eb284=0xc8;}else{_0x3eb284=0xce;}_0x402c1f['status'](_0x3eb284);return _0x402c1f[_0x3c41('0x1f')](_0x3c41('0x20'),_0x20f0bc+'-'+_0x45d070+'/'+_0x2c2f23)[_0x3c41('0x1a')](_0x3bf421);}return null;};}function patchUpdates(_0xd4eb0f){return function(_0x493ede){try{jsonpatch[_0x3c41('0x21')](_0x493ede,_0xd4eb0f,!![]);}catch(_0xc3af4a){return BPromise[_0x3c41('0x22')](_0xc3af4a);}return _0x493ede[_0x3c41('0x23')]();};}function saveUpdates(_0x228d0c,_0xdabf3){return function(_0x216aa2){if(_0x216aa2){return _0x216aa2['update'](_0x228d0c)[_0x3c41('0x24')](function(_0x234f43){return _0x234f43;});}return null;};}function removeEntity(_0x4312b,_0x1063f3){return function(_0x11a530){if(_0x11a530){return _0x11a530[_0x3c41('0x25')]()[_0x3c41('0x24')](function(){_0x4312b[_0x3c41('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44d24a,_0x1a74e3){return function(_0x4e8bf9){if(!_0x4e8bf9){_0x44d24a[_0x3c41('0x18')](0x194);}return _0x4e8bf9;};}function handleError(_0x2a314e,_0x5b7e75){_0x5b7e75=_0x5b7e75||0x1f4;return function(_0x24164d){logger['error'](_0x24164d['stack']);if(_0x24164d['name']){delete _0x24164d['name'];}_0x2a314e[_0x3c41('0x26')](_0x5b7e75)['send'](_0x24164d);};}exports[_0x3c41('0x27')]=function(_0x10abc6,_0x37a58f){var _0x43f825={},_0x49a87f={},_0x402a2b={'count':0x0,'rows':[]};var _0x5a42bf=_[_0x3c41('0x28')](db[_0x3c41('0x29')]['rawAttributes'],function(_0x19d3fa){return{'name':_0x19d3fa[_0x3c41('0x2a')],'type':_0x19d3fa[_0x3c41('0x2b')][_0x3c41('0x2c')]};});_0x49a87f[_0x3c41('0x2d')]=_['map'](_0x5a42bf,'name');_0x49a87f['query']=_[_0x3c41('0x2e')](_0x10abc6[_0x3c41('0x2f')]);_0x49a87f[_0x3c41('0x30')]=_[_0x3c41('0x31')](_0x49a87f[_0x3c41('0x2d')],_0x49a87f['query']);_0x43f825['attributes']=_['intersection'](_0x49a87f[_0x3c41('0x2d')],qs['fields'](_0x10abc6['query'][_0x3c41('0x32')]));_0x43f825[_0x3c41('0x33')]=_0x43f825[_0x3c41('0x33')][_0x3c41('0x34')]?_0x43f825[_0x3c41('0x33')]:_0x49a87f[_0x3c41('0x2d')];if(!_0x10abc6[_0x3c41('0x2f')]['hasOwnProperty'](_0x3c41('0x35'))){_0x43f825[_0x3c41('0x1d')]=qs[_0x3c41('0x1d')](_0x10abc6['query'][_0x3c41('0x1d')]);_0x43f825[_0x3c41('0x1b')]=qs[_0x3c41('0x1b')](_0x10abc6[_0x3c41('0x2f')]['offset']);}_0x43f825[_0x3c41('0x36')]=qs['sort'](_0x10abc6[_0x3c41('0x2f')][_0x3c41('0x37')]);_0x43f825[_0x3c41('0x38')]=qs[_0x3c41('0x30')](_[_0x3c41('0x39')](_0x10abc6[_0x3c41('0x2f')],_0x49a87f[_0x3c41('0x30')]),_0x5a42bf);if(_0x10abc6[_0x3c41('0x2f')][_0x3c41('0x3a')]){_0x43f825['where']=_['merge'](_0x43f825['where'],{'$or':_[_0x3c41('0x28')](_0x5a42bf,function(_0x42c0cb){if(_0x42c0cb[_0x3c41('0x2b')]!==_0x3c41('0x3b')){var _0x4d51ea={};_0x4d51ea[_0x42c0cb[_0x3c41('0x3c')]]={'$like':'%'+_0x10abc6[_0x3c41('0x2f')][_0x3c41('0x3a')]+'%'};return _0x4d51ea;}})});}_0x43f825=_[_0x3c41('0x3d')]({},_0x43f825,_0x10abc6[_0x3c41('0x3e')]);var _0x3d9319={'where':_0x43f825['where']};return db[_0x3c41('0x29')]['count'](_0x3d9319)[_0x3c41('0x24')](function(_0x1b77f3){_0x402a2b['count']=_0x1b77f3;if(_0x10abc6[_0x3c41('0x2f')]['includeAll']){_0x43f825[_0x3c41('0x3f')]=[{'all':!![]}];}return db[_0x3c41('0x29')][_0x3c41('0x40')](_0x43f825);})[_0x3c41('0x24')](function(_0x5bbed3){_0x402a2b[_0x3c41('0x41')]=_0x5bbed3;return _0x402a2b;})['then'](respondWithFilteredResult(_0x37a58f,_0x43f825))[_0x3c41('0x42')](handleError(_0x37a58f,null));};exports[_0x3c41('0x43')]=function(_0x48209f,_0x19b460){var _0x1dc4cb={'raw':![],'where':{'id':_0x48209f[_0x3c41('0x44')]['id']}},_0x518625={};_0x518625['model']=_['keys'](db[_0x3c41('0x29')]['rawAttributes']);_0x518625[_0x3c41('0x2f')]=_[_0x3c41('0x2e')](_0x48209f[_0x3c41('0x2f')]);_0x518625[_0x3c41('0x30')]=_['intersection'](_0x518625['model'],_0x518625['query']);_0x1dc4cb[_0x3c41('0x33')]=_[_0x3c41('0x31')](_0x518625[_0x3c41('0x2d')],qs[_0x3c41('0x32')](_0x48209f[_0x3c41('0x2f')]['fields']));_0x1dc4cb[_0x3c41('0x33')]=_0x1dc4cb['attributes'][_0x3c41('0x34')]?_0x1dc4cb[_0x3c41('0x33')]:_0x518625[_0x3c41('0x2d')];if(_0x48209f[_0x3c41('0x2f')][_0x3c41('0x45')]){_0x1dc4cb[_0x3c41('0x3f')]=[{'all':!![]}];}_0x1dc4cb=_['merge']({},_0x1dc4cb,_0x48209f['options']);return db['FreshsalesAccount'][_0x3c41('0x46')](_0x1dc4cb)[_0x3c41('0x24')](handleEntityNotFound(_0x19b460,null))[_0x3c41('0x24')](respondWithResult(_0x19b460,null))[_0x3c41('0x42')](handleError(_0x19b460,null));};exports[_0x3c41('0x47')]=function(_0x52a2f1,_0x4752db){return db['FreshsalesAccount'][_0x3c41('0x47')](_0x52a2f1[_0x3c41('0x48')],{})['then'](respondWithResult(_0x4752db,0xc9))[_0x3c41('0x42')](handleError(_0x4752db,null));};exports['update']=function(_0xc8ad9f,_0x4a06bc){if(_0xc8ad9f['body']['id']){delete _0xc8ad9f[_0x3c41('0x48')]['id'];}return db[_0x3c41('0x29')]['find']({'where':{'id':_0xc8ad9f[_0x3c41('0x44')]['id']}})[_0x3c41('0x24')](handleEntityNotFound(_0x4a06bc,null))[_0x3c41('0x24')](saveUpdates(_0xc8ad9f['body'],null))['then'](respondWithResult(_0x4a06bc,null))[_0x3c41('0x42')](handleError(_0x4a06bc,null));};exports['destroy']=function(_0xe9a4ac,_0x19dece){return db[_0x3c41('0x29')]['find']({'where':{'id':_0xe9a4ac[_0x3c41('0x44')]['id']}})['then'](handleEntityNotFound(_0x19dece,null))[_0x3c41('0x24')](removeEntity(_0x19dece,null))[_0x3c41('0x42')](handleError(_0x19dece,null));};exports[_0x3c41('0x49')]=function(_0x13214a,_0x3b1145,_0x32cee2){var _0xcd8b9f={};var _0x40312e={};var _0x2da112;var _0x3361d0;return db[_0x3c41('0x29')][_0x3c41('0x4a')]({'where':{'id':_0x13214a[_0x3c41('0x44')]['id']}})[_0x3c41('0x24')](handleEntityNotFound(_0x3b1145,null))[_0x3c41('0x24')](function(_0x1e15ea){if(_0x1e15ea){_0x2da112=_0x1e15ea;_0x40312e[_0x3c41('0x2d')]=_[_0x3c41('0x2e')](db[_0x3c41('0x4b')][_0x3c41('0x4c')]);_0x40312e[_0x3c41('0x2f')]=_[_0x3c41('0x2e')](_0x13214a[_0x3c41('0x2f')]);_0x40312e[_0x3c41('0x30')]=_[_0x3c41('0x31')](_0x40312e['model'],_0x40312e[_0x3c41('0x2f')]);_0xcd8b9f[_0x3c41('0x33')]=_[_0x3c41('0x31')](_0x40312e[_0x3c41('0x2d')],qs[_0x3c41('0x32')](_0x13214a['query'][_0x3c41('0x32')]));_0xcd8b9f[_0x3c41('0x33')]=_0xcd8b9f[_0x3c41('0x33')]['length']?_0xcd8b9f['attributes']:_0x40312e[_0x3c41('0x2d')];_0xcd8b9f[_0x3c41('0x36')]=qs[_0x3c41('0x37')](_0x13214a[_0x3c41('0x2f')][_0x3c41('0x37')]);_0xcd8b9f[_0x3c41('0x38')]=qs['filters'](_[_0x3c41('0x39')](_0x13214a[_0x3c41('0x2f')],_0x40312e[_0x3c41('0x30')]));if(_0x13214a[_0x3c41('0x2f')][_0x3c41('0x3a')]){_0xcd8b9f[_0x3c41('0x38')]=_[_0x3c41('0x3d')](_0xcd8b9f['where'],{'$or':_[_0x3c41('0x28')](_0xcd8b9f[_0x3c41('0x33')],function(_0x52cd42){var _0x48b816={};_0x48b816[_0x52cd42]={'$like':'%'+_0x13214a[_0x3c41('0x2f')][_0x3c41('0x3a')]+'%'};return _0x48b816;})});}_0xcd8b9f=_[_0x3c41('0x3d')]({},_0xcd8b9f,_0x13214a[_0x3c41('0x3e')]);return _0x2da112['getConfigurations'](_0xcd8b9f);}})['then'](function(_0x222ead){if(_0x222ead){_0x3361d0=_0x222ead[_0x3c41('0x34')];if(!_0x13214a[_0x3c41('0x2f')][_0x3c41('0x4d')]('nolimit')){_0xcd8b9f[_0x3c41('0x1d')]=qs[_0x3c41('0x1d')](_0x13214a['query'][_0x3c41('0x1d')]);_0xcd8b9f['offset']=qs['offset'](_0x13214a[_0x3c41('0x2f')][_0x3c41('0x1b')]);}return _0x2da112[_0x3c41('0x49')](_0xcd8b9f);}})[_0x3c41('0x24')](function(_0x17c179){if(_0x17c179){return _0x17c179?{'count':_0x3361d0,'rows':_0x17c179}:null;}})[_0x3c41('0x24')](respondWithResult(_0x3b1145,null))[_0x3c41('0x42')](handleError(_0x3b1145,null));};exports['addConfiguration']=function(_0x501107,_0x2ee9e9,_0x4b8a99){if(_0x501107[_0x3c41('0x48')]['id']){delete _0x501107['body']['id'];}return db[_0x3c41('0x29')][_0x3c41('0x4a')]({'where':{'id':_0x501107['params']['id']}})[_0x3c41('0x24')](handleEntityNotFound(_0x2ee9e9,null))['then'](function(_0x297e5b){if(_0x297e5b){_0x501107[_0x3c41('0x48')][_0x3c41('0x4e')]=_0x297e5b['id'];_0x501107['body'][_0x3c41('0x4f')]=integrations[_0x3c41('0x50')](_0x501107['body']['channel'],_0x501107[_0x3c41('0x48')][_0x3c41('0x2b')]);_0x501107[_0x3c41('0x48')][_0x3c41('0x51')]=integrations[_0x3c41('0x52')](_0x501107[_0x3c41('0x48')][_0x3c41('0x53')],_0x501107[_0x3c41('0x48')][_0x3c41('0x2b')]);return db[_0x3c41('0x4b')]['create'](_0x501107[_0x3c41('0x48')],{'include':[{'model':db[_0x3c41('0x54')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x3c41('0x51')}]});}return null;})['then'](respondWithResult(_0x2ee9e9,null))[_0x3c41('0x42')](handleError(_0x2ee9e9,null));};exports[_0x3c41('0x55')]=function(_0x22d706,_0x1693c4,_0x240ca4){var _0x1e239d='';var _0x1c8ddd='';return db[_0x3c41('0x29')]['findOne']({'where':{'id':_0x22d706['params']['id']},'attributes':['id',_0x3c41('0x56'),'remoteUri','apiKey']})[_0x3c41('0x24')](handleEntityNotFound(_0x1693c4,null))['then'](function(_0x2bc192){if(_0x2bc192){_0x1c8ddd=_0x2bc192[_0x3c41('0x56')];_0x1e239d=_0x2bc192[_0x3c41('0x57')];var _0x263e72=_0x2bc192[_0x3c41('0x57')]['slice'](-0x1);if(_0x263e72==='/'){_0x1e239d=_0x1e239d['substring'](0x0,_0x1e239d[_0x3c41('0x58')](_0x263e72));}return rp({'method':_0x3c41('0x59'),'uri':util['format'](_0x3c41('0x5a'),_0x1e239d,_0x3c41('0x5b')),'headers':{'Authorization':_0x3c41('0x5c')+_0x2bc192[_0x3c41('0x5d')]},'json':!![]});}})[_0x3c41('0x24')](function(_0x5021fd){if(_0x5021fd){var _0x53ea9a=_0x5021fd['users'];var _0x34f978=![];var _0x593bb0=null;for(_0x593bb0=0x0;_0x593bb0<_0x53ea9a[_0x3c41('0x34')];_0x593bb0++){if(_0x53ea9a[_0x593bb0]['email']===_0x1c8ddd){_0x34f978=!![];}}if(_0x34f978){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x1693c4,null))[_0x3c41('0x42')](function(_0x3ed0eb){var _0x2b3a27=_0x22d706[_0x3c41('0x2f')][_0x3c41('0x5e')]?0x1f4:_0x3ed0eb[_0x3c41('0x5f')]||0x1f4;logger[_0x3c41('0x60')]('getFields,\x20%s,\x20%s,\x20%s',_0x3c41('0x55'),_0x2b3a27,JSON[_0x3c41('0x61')](_0x3ed0eb));delete _0x3ed0eb[_0x3c41('0x3c')];if(_0x2b3a27===0x191){_0x2b3a27=0x190;}_0x1693c4['status'](_0x2b3a27)['send'](_0x22d706[_0x3c41('0x2f')][_0x3c41('0x5e')]?{'message':_0x3c41('0x62'),'statusCode':_0x3ed0eb[_0x3c41('0x5f')]}:_0x3ed0eb);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 51c49eb..17a2bee 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 _0x8ace=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x1b33bc,_0x282af6){_0x1b33bc=_0x1b33bc-0x0;var _0x23b81c=_0x8ace[_0x1b33bc];return _0x23b81c;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));var integrations=require(_0xe8ac('0xb'));module[_0xe8ac('0xc')]=function(_0x2b48ec,_0x4eb087){return _0x2b48ec[_0xe8ac('0xd')](_0xe8ac('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts'];(function(_0x4ecd85,_0x8cdecc){var _0x398c95=function(_0x4d98b5){while(--_0x4d98b5){_0x4ecd85['push'](_0x4ecd85['shift']());}};_0x398c95(++_0x8cdecc);}(_0x1261,0x144));var _0x1126=function(_0x2e4a0f,_0x3a9bb6){_0x2e4a0f=_0x2e4a0f-0x0;var _0x25a3cd=_0x1261[_0x2e4a0f];return _0x25a3cd;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x40ba58,_0x907180){return _0x40ba58['define'](_0x1126('0xa'),attributes,{'tableName':_0x1126('0xb'),'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 13327ba..67eeb59 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 _0x9536=['code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9536,0x179));var _0x6953=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x9536[_0x352e09];return _0x1b7094;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')]({'raw':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1c')]||null:null,'attributes':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1d')]||null:null,'limit':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1e')]||null:null,'include':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')],function(_0x2a7f6a){return{'model':db[_0x2a7f6a['model']],'as':_0x2a7f6a['as'],'attributes':_0x2a7f6a['attributes'],'include':_0x2a7f6a['include']?_[_0x6953('0x20')](_0x2a7f6a[_0x6953('0x1f')],function(_0x550be4){return{'model':db[_0x550be4[_0x6953('0x21')]],'as':_0x550be4['as'],'attributes':_0x550be4['attributes'],'include':_0x550be4[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x550be4[_0x6953('0x1f')],function(_0x2cc01e){return{'model':db[_0x2cc01e[_0x6953('0x21')]],'as':_0x2cc01e['as'],'attributes':_0x2cc01e[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd890){logger[_0x6953('0x15')]('GetFreshsalesAccount',_0x2da771);logger[_0x6953('0xf')]('GetFreshsalesAccount',_0x2da771,JSON[_0x6953('0x11')](_0x3dd890));_0x10858a(_0x3dd890);})[_0x6953('0x16')](function(_0x426c7c){logger['error'](_0x6953('0x17'),_0x426c7c[_0x6953('0x14')],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x426c7c['message']));});});};exports[_0x6953('0x22')]=function(_0x132a71){var _0x481c6a=this;return new Promise(function(_0x4d856d,_0xd80e42){return db[_0x6953('0x18')][_0x6953('0x23')]({'raw':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x132a71[_0x6953('0x1a')]?_0x132a71['options'][_0x6953('0x1c')]||null:null,'attributes':_0x132a71[_0x6953('0x1a')]?_0x132a71['options']['attributes']||null:null,'include':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x132a71[_0x6953('0x1a')]['include'],function(_0x4e95f1){return{'model':db[_0x4e95f1['model']],'as':_0x4e95f1['as'],'attributes':_0x4e95f1['attributes'],'include':_0x4e95f1[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x4e95f1[_0x6953('0x1f')],function(_0x11f316){return{'model':db[_0x11f316[_0x6953('0x21')]],'as':_0x11f316['as'],'attributes':_0x11f316[_0x6953('0x1d')],'include':_0x11f316['include']?_[_0x6953('0x20')](_0x11f316['include'],function(_0x199c67){return{'model':db[_0x199c67['model']],'as':_0x199c67['as'],'attributes':_0x199c67[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6953('0xc')](function(_0xd81149){logger[_0x6953('0x15')]('ShowFreshsalesAccount',_0x132a71);logger[_0x6953('0xf')](_0x6953('0x22'),_0x132a71,JSON[_0x6953('0x11')](_0xd81149));_0x4d856d(_0xd81149);})[_0x6953('0x16')](function(_0x40b6ea){logger[_0x6953('0x12')](_0x6953('0x22'),_0x40b6ea[_0x6953('0x14')],_0x132a71);_0xd80e42(_0x481c6a[_0x6953('0x12')](0x1f4,_0x40b6ea[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0x2272=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','raw','ShowFreshsalesAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')]({'raw':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x531f75[_0x2227('0x1b')]?_0x531f75['options'][_0x2227('0x1c')]||null:null,'attributes':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'limit':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1e')]||null:null,'include':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1f')]?_[_0x2227('0x20')](_0x531f75['options'][_0x2227('0x1f')],function(_0x42d500){return{'model':db[_0x42d500['model']],'as':_0x42d500['as'],'attributes':_0x42d500[_0x2227('0x1d')],'include':_0x42d500[_0x2227('0x1f')]?_['map'](_0x42d500['include'],function(_0x17c7a4){return{'model':db[_0x17c7a4[_0x2227('0x21')]],'as':_0x17c7a4['as'],'attributes':_0x17c7a4[_0x2227('0x1d')],'include':_0x17c7a4[_0x2227('0x1f')]?_['map'](_0x17c7a4[_0x2227('0x1f')],function(_0x301304){return{'model':db[_0x301304[_0x2227('0x21')]],'as':_0x301304['as'],'attributes':_0x301304[_0x2227('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x204def){logger[_0x2227('0xd')](_0x2227('0x18'),_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x204def));_0x620012(_0x204def);})['catch'](function(_0x5d1d56){logger[_0x2227('0x12')]('GetFreshsalesAccount',_0x5d1d56[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0x5d1d56['message']));});});};exports['ShowFreshsalesAccount']=function(_0x1f1ba7){var _0x1818ba=this;return new Promise(function(_0x21838a,_0x4cc1e1){return db[_0x2227('0x19')]['find']({'raw':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x22')]===undefined?!![]:![]:!![],'where':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1c')]||null:null,'attributes':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'include':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')]['include']?_[_0x2227('0x20')](_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1f')],function(_0x6cd5d7){return{'model':db[_0x6cd5d7['model']],'as':_0x6cd5d7['as'],'attributes':_0x6cd5d7[_0x2227('0x1d')],'include':_0x6cd5d7[_0x2227('0x1f')]?_[_0x2227('0x20')](_0x6cd5d7[_0x2227('0x1f')],function(_0x5186a6){return{'model':db[_0x5186a6[_0x2227('0x21')]],'as':_0x5186a6['as'],'attributes':_0x5186a6[_0x2227('0x1d')],'include':_0x5186a6[_0x2227('0x1f')]?_['map'](_0x5186a6['include'],function(_0x35d9f1){return{'model':db[_0x35d9f1[_0x2227('0x21')]],'as':_0x35d9f1['as'],'attributes':_0x35d9f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2227('0xc')](function(_0x9a8cc3){logger['info'](_0x2227('0x23'),_0x1f1ba7);logger['debug'](_0x2227('0x23'),_0x1f1ba7,JSON[_0x2227('0x11')](_0x9a8cc3));_0x21838a(_0x9a8cc3);})[_0x2227('0x17')](function(_0x36db00){logger['error'](_0x2227('0x23'),_0x36db00['message'],_0x1f1ba7);_0x4cc1e1(_0x1818ba[_0x2227('0x12')](0x1f4,_0x36db00[_0x2227('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 58b82f1..2c88109 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 _0x1760=['get','isAuthenticated','getDescriptions','/:id/fields','getFields','post','create','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1760,0xe7));var _0x0176=function(_0x274c70,_0x4aaf48){_0x274c70=_0x274c70-0x0;var _0x23933a=_0x1760[_0x274c70];return _0x23933a;};'use strict';var multer=require(_0x0176('0x0'));var util=require(_0x0176('0x1'));var path=require(_0x0176('0x2'));var timeout=require(_0x0176('0x3'));var express=require(_0x0176('0x4'));var router=express[_0x0176('0x5')]();var fs_extra=require(_0x0176('0x6'));var auth=require(_0x0176('0x7'));var interaction=require(_0x0176('0x8'));var config=require(_0x0176('0x9'));var controller=require(_0x0176('0xa'));router[_0x0176('0xb')]('/',auth[_0x0176('0xc')](),controller['index']);router[_0x0176('0xb')]('/:id',auth[_0x0176('0xc')](),controller['show']);router[_0x0176('0xb')]('/:id/subjects',auth[_0x0176('0xc')](),controller['getSubjects']);router[_0x0176('0xb')]('/:id/descriptions',auth[_0x0176('0xc')](),controller[_0x0176('0xd')]);router[_0x0176('0xb')](_0x0176('0xe'),auth[_0x0176('0xc')](),controller[_0x0176('0xf')]);router[_0x0176('0x10')]('/',auth[_0x0176('0xc')](),controller[_0x0176('0x11')]);router['put']('/:id',auth[_0x0176('0xc')](),controller['update']);router[_0x0176('0x12')](_0x0176('0x13'),auth['isAuthenticated'](),controller[_0x0176('0x14')]);module[_0x0176('0x15')]=router; \ No newline at end of file +var _0x6e84=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','getDescriptions','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x6e84,0x104));var _0x46e8=function(_0x38d291,_0x29789d){_0x38d291=_0x38d291-0x0;var _0x31a421=_0x6e84[_0x38d291];return _0x31a421;};'use strict';var multer=require(_0x46e8('0x0'));var util=require('util');var path=require(_0x46e8('0x1'));var timeout=require(_0x46e8('0x2'));var express=require(_0x46e8('0x3'));var router=express[_0x46e8('0x4')]();var fs_extra=require(_0x46e8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46e8('0x6'));var config=require(_0x46e8('0x7'));var controller=require(_0x46e8('0x8'));router[_0x46e8('0x9')]('/',auth[_0x46e8('0xa')](),controller['index']);router['get'](_0x46e8('0xb'),auth[_0x46e8('0xa')](),controller[_0x46e8('0xc')]);router[_0x46e8('0x9')](_0x46e8('0xd'),auth['isAuthenticated'](),controller[_0x46e8('0xe')]);router[_0x46e8('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x46e8('0xf')]);router[_0x46e8('0x9')]('/:id/fields',auth[_0x46e8('0xa')](),controller[_0x46e8('0x10')]);router[_0x46e8('0x11')]('/',auth[_0x46e8('0xa')](),controller[_0x46e8('0x12')]);router[_0x46e8('0x13')](_0x46e8('0xb'),auth[_0x46e8('0xa')](),controller[_0x46e8('0x14')]);router[_0x46e8('0x15')](_0x46e8('0xb'),auth[_0x46e8('0xa')](),controller[_0x46e8('0x16')]);module[_0x46e8('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 57cc353..811ca79 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 _0xe313=['sequelize','STRING'];(function(_0x4b9b23,_0x4f3ddf){var _0x59b02b=function(_0x533d0f){while(--_0x533d0f){_0x4b9b23['push'](_0x4b9b23['shift']());}};_0x59b02b(++_0x4f3ddf);}(_0xe313,0x168));var _0x3e31=function(_0x49c46b,_0xb0d238){_0x49c46b=_0x49c46b-0x0;var _0x25dedf=_0xe313[_0x49c46b];return _0x25dedf;};'use strict';var Sequelize=require(_0x3e31('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3e31('0x1')]}}; \ No newline at end of file +var _0x41f5=['sequelize','STRING'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x41f5,0x92));var _0x541f=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x41f5[_0x3fd3a3];return _0xa3e4d5;};'use strict';var Sequelize=require(_0x541f('0x0'));module['exports']={'name':{'type':Sequelize[_0x541f('0x1')]},'description':{'type':Sequelize[_0x541f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 294591f..ccbae63 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 _0xe4ad=['then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','FreshsalesConfiguration','include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','getSubjects','FreshsalesField','hasOwnProperty','findOne','getDescriptions','getFields','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','apply','reject','save','update'];(function(_0x66c01b,_0x320486){var _0x4960e3=function(_0x208f19){while(--_0x208f19){_0x66c01b['push'](_0x66c01b['shift']());}};_0x4960e3(++_0x320486);}(_0xe4ad,0x164));var _0xde4a=function(_0x33c0a2,_0x554db0){_0x33c0a2=_0x33c0a2-0x0;var _0x38952c=_0xe4ad[_0x33c0a2];return _0x38952c;};'use strict';var emlformat=require(_0xde4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde4a('0x1'));var moment=require(_0xde4a('0x2'));var BPromise=require(_0xde4a('0x3'));var Mustache=require(_0xde4a('0x4'));var util=require('util');var path=require(_0xde4a('0x5'));var sox=require(_0xde4a('0x6'));var csv=require(_0xde4a('0x7'));var ejs=require(_0xde4a('0x8'));var fs=require('fs');var fs_extra=require(_0xde4a('0x9'));var _=require(_0xde4a('0xa'));var squel=require(_0xde4a('0xb'));var crypto=require(_0xde4a('0xc'));var jsforce=require(_0xde4a('0xd'));var deskjs=require(_0xde4a('0xe'));var toCsv=require(_0xde4a('0x7'));var querystring=require(_0xde4a('0xf'));var Papa=require(_0xde4a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde4a('0x11'));var as=require(_0xde4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde4a('0x13'))(_0xde4a('0x14'));var utils=require(_0xde4a('0x15'));var config=require(_0xde4a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51ac67,_0x39cf72){_0x39cf72=_0x39cf72||0xcc;return function(_0x35e80b){if(_0x35e80b){return _0x51ac67[_0xde4a('0x17')](_0x39cf72);}return _0x51ac67[_0xde4a('0x18')](_0x39cf72)[_0xde4a('0x19')]();};}function respondWithResult(_0x3599be,_0x553d06){_0x553d06=_0x553d06||0xc8;return function(_0x353ba4){if(_0x353ba4){return _0x3599be[_0xde4a('0x18')](_0x553d06)[_0xde4a('0x1a')](_0x353ba4);}};}function respondWithFilteredResult(_0x10e4d4,_0x7f1b1c){return function(_0x7ec284){if(_0x7ec284){var _0x44afe5=typeof _0x7f1b1c['offset']===_0xde4a('0x1b')&&typeof _0x7f1b1c['limit']===_0xde4a('0x1b');var _0x5d4ea9=_0x7ec284[_0xde4a('0x1c')];var _0x23f3d2=_0x44afe5?0x0:_0x7f1b1c[_0xde4a('0x1d')];var _0x4162cb=_0x44afe5?_0x7ec284[_0xde4a('0x1c')]:_0x7f1b1c[_0xde4a('0x1d')]+_0x7f1b1c['limit'];var _0x10313d;if(_0x4162cb>=_0x5d4ea9){_0x4162cb=_0x5d4ea9;_0x10313d=0xc8;}else{_0x10313d=0xce;}_0x10e4d4[_0xde4a('0x18')](_0x10313d);return _0x10e4d4['set']('Content-Range',_0x23f3d2+'-'+_0x4162cb+'/'+_0x5d4ea9)['json'](_0x7ec284);}return null;};}function patchUpdates(_0x26ab10){return function(_0x3ba5a3){try{jsonpatch[_0xde4a('0x1e')](_0x3ba5a3,_0x26ab10,!![]);}catch(_0x5c4797){return BPromise[_0xde4a('0x1f')](_0x5c4797);}return _0x3ba5a3[_0xde4a('0x20')]();};}function saveUpdates(_0x2eb900,_0x41f155){return function(_0x14e734){if(_0x14e734){return _0x14e734[_0xde4a('0x21')](_0x2eb900)[_0xde4a('0x22')](function(_0x558670){return _0x558670;});}return null;};}function removeEntity(_0x6e4ce2,_0x1ef6ee){return function(_0x403408){if(_0x403408){return _0x403408[_0xde4a('0x23')]()[_0xde4a('0x22')](function(){_0x6e4ce2['status'](0xcc)[_0xde4a('0x19')]();});}};}function handleEntityNotFound(_0x5046d9,_0x3f4edf){return function(_0xe51aa6){if(!_0xe51aa6){_0x5046d9[_0xde4a('0x17')](0x194);}return _0xe51aa6;};}function handleError(_0xb6d339,_0x4c9876){_0x4c9876=_0x4c9876||0x1f4;return function(_0x323f57){logger['error'](_0x323f57[_0xde4a('0x24')]);if(_0x323f57[_0xde4a('0x25')]){delete _0x323f57[_0xde4a('0x25')];}_0xb6d339[_0xde4a('0x18')](_0x4c9876)['send'](_0x323f57);};}exports['index']=function(_0x10c734,_0x3aa510){var _0x18a39a={},_0x1fa942={},_0x4ba1c7={'count':0x0,'rows':[]};var _0x30e3dd=_[_0xde4a('0x26')](db['FreshsalesConfiguration'][_0xde4a('0x27')],function(_0x1397ac){return{'name':_0x1397ac[_0xde4a('0x28')],'type':_0x1397ac[_0xde4a('0x29')][_0xde4a('0x2a')]};});_0x1fa942[_0xde4a('0x2b')]=_[_0xde4a('0x26')](_0x30e3dd,'name');_0x1fa942[_0xde4a('0x2c')]=_['keys'](_0x10c734['query']);_0x1fa942['filters']=_[_0xde4a('0x2d')](_0x1fa942['model'],_0x1fa942[_0xde4a('0x2c')]);_0x18a39a[_0xde4a('0x2e')]=_[_0xde4a('0x2d')](_0x1fa942[_0xde4a('0x2b')],qs[_0xde4a('0x2f')](_0x10c734[_0xde4a('0x2c')][_0xde4a('0x2f')]));_0x18a39a[_0xde4a('0x2e')]=_0x18a39a['attributes'][_0xde4a('0x30')]?_0x18a39a['attributes']:_0x1fa942['model'];if(!_0x10c734[_0xde4a('0x2c')]['hasOwnProperty'](_0xde4a('0x31'))){_0x18a39a['limit']=qs[_0xde4a('0x32')](_0x10c734[_0xde4a('0x2c')][_0xde4a('0x32')]);_0x18a39a['offset']=qs[_0xde4a('0x1d')](_0x10c734[_0xde4a('0x2c')][_0xde4a('0x1d')]);}_0x18a39a[_0xde4a('0x33')]=qs['sort'](_0x10c734[_0xde4a('0x2c')][_0xde4a('0x34')]);_0x18a39a[_0xde4a('0x35')]=qs[_0xde4a('0x36')](_[_0xde4a('0x37')](_0x10c734[_0xde4a('0x2c')],_0x1fa942[_0xde4a('0x36')]),_0x30e3dd);if(_0x10c734[_0xde4a('0x2c')]['filter']){_0x18a39a[_0xde4a('0x35')]=_[_0xde4a('0x38')](_0x18a39a[_0xde4a('0x35')],{'$or':_[_0xde4a('0x26')](_0x30e3dd,function(_0xe9e753){if(_0xe9e753[_0xde4a('0x29')]!==_0xde4a('0x39')){var _0x40ff80={};_0x40ff80[_0xe9e753[_0xde4a('0x25')]]={'$like':'%'+_0x10c734['query'][_0xde4a('0x3a')]+'%'};return _0x40ff80;}})});}_0x18a39a=_['merge']({},_0x18a39a,_0x10c734[_0xde4a('0x3b')]);var _0x2793fa={'where':_0x18a39a[_0xde4a('0x35')]};return db[_0xde4a('0x3c')][_0xde4a('0x1c')](_0x2793fa)[_0xde4a('0x22')](function(_0x3a4abd){_0x4ba1c7['count']=_0x3a4abd;if(_0x10c734[_0xde4a('0x2c')]['includeAll']){_0x18a39a[_0xde4a('0x3d')]=[{'all':!![]}];}return db[_0xde4a('0x3c')][_0xde4a('0x3e')](_0x18a39a);})[_0xde4a('0x22')](function(_0x77efe3){_0x4ba1c7[_0xde4a('0x3f')]=_0x77efe3;return _0x4ba1c7;})[_0xde4a('0x22')](respondWithFilteredResult(_0x3aa510,_0x18a39a))['catch'](handleError(_0x3aa510,null));};exports[_0xde4a('0x40')]=function(_0x313bbb,_0x4491f3){var _0x319afe={'raw':![],'where':{'id':_0x313bbb[_0xde4a('0x41')]['id']}},_0x57cb75={};_0x57cb75[_0xde4a('0x2b')]=_[_0xde4a('0x42')](db['FreshsalesConfiguration'][_0xde4a('0x27')]);_0x57cb75[_0xde4a('0x2c')]=_[_0xde4a('0x42')](_0x313bbb['query']);_0x57cb75[_0xde4a('0x36')]=_['intersection'](_0x57cb75['model'],_0x57cb75[_0xde4a('0x2c')]);_0x319afe['attributes']=_[_0xde4a('0x2d')](_0x57cb75[_0xde4a('0x2b')],qs[_0xde4a('0x2f')](_0x313bbb[_0xde4a('0x2c')][_0xde4a('0x2f')]));_0x319afe[_0xde4a('0x2e')]=_0x319afe['attributes'][_0xde4a('0x30')]?_0x319afe[_0xde4a('0x2e')]:_0x57cb75[_0xde4a('0x2b')];if(_0x313bbb[_0xde4a('0x2c')][_0xde4a('0x43')]){_0x319afe[_0xde4a('0x3d')]=[{'all':!![]}];}_0x319afe=_['merge']({},_0x319afe,_0x313bbb[_0xde4a('0x3b')]);return db[_0xde4a('0x3c')]['find'](_0x319afe)[_0xde4a('0x22')](handleEntityNotFound(_0x4491f3,null))[_0xde4a('0x22')](respondWithResult(_0x4491f3,null))[_0xde4a('0x44')](handleError(_0x4491f3,null));};exports['create']=function(_0x4f8001,_0x1b424b){return db[_0xde4a('0x3c')][_0xde4a('0x45')](_0x4f8001[_0xde4a('0x46')],{})[_0xde4a('0x22')](respondWithResult(_0x1b424b,0xc9))['catch'](handleError(_0x1b424b,null));};exports[_0xde4a('0x21')]=function(_0x206ce4,_0xd89f84){if(_0x206ce4[_0xde4a('0x46')]['id']){delete _0x206ce4[_0xde4a('0x46')]['id'];}return db[_0xde4a('0x3c')][_0xde4a('0x47')]({'where':{'id':_0x206ce4['params']['id']}})[_0xde4a('0x22')](handleEntityNotFound(_0xd89f84,null))[_0xde4a('0x22')](saveUpdates(_0x206ce4[_0xde4a('0x46')],null))[_0xde4a('0x22')](respondWithResult(_0xd89f84,null))[_0xde4a('0x44')](handleError(_0xd89f84,null));};exports[_0xde4a('0x23')]=function(_0x89e75f,_0x45c85d){return db[_0xde4a('0x3c')][_0xde4a('0x47')]({'where':{'id':_0x89e75f[_0xde4a('0x41')]['id']}})[_0xde4a('0x22')](handleEntityNotFound(_0x45c85d,null))[_0xde4a('0x22')](removeEntity(_0x45c85d,null))[_0xde4a('0x44')](handleError(_0x45c85d,null));};exports[_0xde4a('0x48')]=function(_0xc84a70,_0x41503b,_0xff9595){var _0x22b1db={};var _0xec25bb={};var _0x2452fe;var _0x121b41;return db[_0xde4a('0x3c')]['findOne']({'where':{'id':_0xc84a70['params']['id']}})['then'](handleEntityNotFound(_0x41503b,null))[_0xde4a('0x22')](function(_0x1b5889){if(_0x1b5889){_0x2452fe=_0x1b5889;_0xec25bb[_0xde4a('0x2b')]=_[_0xde4a('0x42')](db[_0xde4a('0x49')][_0xde4a('0x27')]);_0xec25bb[_0xde4a('0x2c')]=_[_0xde4a('0x42')](_0xc84a70[_0xde4a('0x2c')]);_0xec25bb['filters']=_['intersection'](_0xec25bb[_0xde4a('0x2b')],_0xec25bb[_0xde4a('0x2c')]);_0x22b1db['attributes']=_[_0xde4a('0x2d')](_0xec25bb['model'],qs[_0xde4a('0x2f')](_0xc84a70[_0xde4a('0x2c')][_0xde4a('0x2f')]));_0x22b1db['attributes']=_0x22b1db['attributes'][_0xde4a('0x30')]?_0x22b1db[_0xde4a('0x2e')]:_0xec25bb[_0xde4a('0x2b')];_0x22b1db['order']=qs[_0xde4a('0x34')](_0xc84a70[_0xde4a('0x2c')][_0xde4a('0x34')]);_0x22b1db[_0xde4a('0x35')]=qs['filters'](_['pick'](_0xc84a70[_0xde4a('0x2c')],_0xec25bb[_0xde4a('0x36')]));if(_0xc84a70[_0xde4a('0x2c')][_0xde4a('0x3a')]){_0x22b1db[_0xde4a('0x35')]=_[_0xde4a('0x38')](_0x22b1db['where'],{'$or':_[_0xde4a('0x26')](_0x22b1db['attributes'],function(_0x43ed0a){var _0x4adcd9={};_0x4adcd9[_0x43ed0a]={'$like':'%'+_0xc84a70[_0xde4a('0x2c')][_0xde4a('0x3a')]+'%'};return _0x4adcd9;})});}_0x22b1db=_[_0xde4a('0x38')]({},_0x22b1db,_0xc84a70[_0xde4a('0x3b')]);return _0x2452fe[_0xde4a('0x48')](_0x22b1db);}})[_0xde4a('0x22')](function(_0xe2f44b){if(_0xe2f44b){_0x121b41=_0xe2f44b['length'];if(!_0xc84a70[_0xde4a('0x2c')][_0xde4a('0x4a')]('nolimit')){_0x22b1db[_0xde4a('0x32')]=qs[_0xde4a('0x32')](_0xc84a70['query'][_0xde4a('0x32')]);_0x22b1db[_0xde4a('0x1d')]=qs['offset'](_0xc84a70[_0xde4a('0x2c')]['offset']);}return _0x2452fe[_0xde4a('0x48')](_0x22b1db);}})[_0xde4a('0x22')](function(_0x182208){if(_0x182208){return _0x182208?{'count':_0x121b41,'rows':_0x182208}:null;}})['then'](respondWithResult(_0x41503b,null))[_0xde4a('0x44')](handleError(_0x41503b,null));};exports['getDescriptions']=function(_0x5622f9,_0xa8f329,_0x9adef9){var _0x147c37={};var _0x30cd73={};var _0x1f5804;var _0x1318ad;return db[_0xde4a('0x3c')][_0xde4a('0x4b')]({'where':{'id':_0x5622f9[_0xde4a('0x41')]['id']}})[_0xde4a('0x22')](handleEntityNotFound(_0xa8f329,null))[_0xde4a('0x22')](function(_0x4682e4){if(_0x4682e4){_0x1f5804=_0x4682e4;_0x30cd73[_0xde4a('0x2b')]=_[_0xde4a('0x42')](db['FreshsalesField']['rawAttributes']);_0x30cd73[_0xde4a('0x2c')]=_[_0xde4a('0x42')](_0x5622f9[_0xde4a('0x2c')]);_0x30cd73[_0xde4a('0x36')]=_[_0xde4a('0x2d')](_0x30cd73['model'],_0x30cd73['query']);_0x147c37['attributes']=_[_0xde4a('0x2d')](_0x30cd73[_0xde4a('0x2b')],qs['fields'](_0x5622f9[_0xde4a('0x2c')][_0xde4a('0x2f')]));_0x147c37[_0xde4a('0x2e')]=_0x147c37['attributes'][_0xde4a('0x30')]?_0x147c37['attributes']:_0x30cd73[_0xde4a('0x2b')];_0x147c37[_0xde4a('0x33')]=qs[_0xde4a('0x34')](_0x5622f9[_0xde4a('0x2c')]['sort']);_0x147c37[_0xde4a('0x35')]=qs[_0xde4a('0x36')](_[_0xde4a('0x37')](_0x5622f9['query'],_0x30cd73[_0xde4a('0x36')]));if(_0x5622f9[_0xde4a('0x2c')][_0xde4a('0x3a')]){_0x147c37[_0xde4a('0x35')]=_[_0xde4a('0x38')](_0x147c37[_0xde4a('0x35')],{'$or':_[_0xde4a('0x26')](_0x147c37[_0xde4a('0x2e')],function(_0x36e6dd){var _0x2370c3={};_0x2370c3[_0x36e6dd]={'$like':'%'+_0x5622f9['query']['filter']+'%'};return _0x2370c3;})});}_0x147c37=_[_0xde4a('0x38')]({},_0x147c37,_0x5622f9['options']);return _0x1f5804[_0xde4a('0x4c')](_0x147c37);}})[_0xde4a('0x22')](function(_0xbb1fc){if(_0xbb1fc){_0x1318ad=_0xbb1fc['length'];if(!_0x5622f9[_0xde4a('0x2c')][_0xde4a('0x4a')](_0xde4a('0x31'))){_0x147c37['limit']=qs[_0xde4a('0x32')](_0x5622f9[_0xde4a('0x2c')][_0xde4a('0x32')]);_0x147c37[_0xde4a('0x1d')]=qs[_0xde4a('0x1d')](_0x5622f9['query'][_0xde4a('0x1d')]);}return _0x1f5804['getDescriptions'](_0x147c37);}})[_0xde4a('0x22')](function(_0x1f83e8){if(_0x1f83e8){return _0x1f83e8?{'count':_0x1318ad,'rows':_0x1f83e8}:null;}})['then'](respondWithResult(_0xa8f329,null))[_0xde4a('0x44')](handleError(_0xa8f329,null));};exports[_0xde4a('0x4d')]=function(_0x1c372a,_0x1d6e09,_0x2a2a10){var _0x2d4740={};var _0x146fc8={};var _0x5549dc;var _0x1fb4fd;return db['FreshsalesConfiguration'][_0xde4a('0x4b')]({'where':{'id':_0x1c372a[_0xde4a('0x41')]['id']}})[_0xde4a('0x22')](handleEntityNotFound(_0x1d6e09,null))[_0xde4a('0x22')](function(_0x50a16e){if(_0x50a16e){_0x5549dc=_0x50a16e;_0x146fc8['model']=_[_0xde4a('0x42')](db[_0xde4a('0x49')]['rawAttributes']);_0x146fc8[_0xde4a('0x2c')]=_['keys'](_0x1c372a[_0xde4a('0x2c')]);_0x146fc8[_0xde4a('0x36')]=_[_0xde4a('0x2d')](_0x146fc8[_0xde4a('0x2b')],_0x146fc8[_0xde4a('0x2c')]);_0x2d4740[_0xde4a('0x2e')]=_[_0xde4a('0x2d')](_0x146fc8[_0xde4a('0x2b')],qs['fields'](_0x1c372a[_0xde4a('0x2c')][_0xde4a('0x2f')]));_0x2d4740[_0xde4a('0x2e')]=_0x2d4740[_0xde4a('0x2e')][_0xde4a('0x30')]?_0x2d4740[_0xde4a('0x2e')]:_0x146fc8[_0xde4a('0x2b')];_0x2d4740[_0xde4a('0x33')]=qs[_0xde4a('0x34')](_0x1c372a['query'][_0xde4a('0x34')]);_0x2d4740[_0xde4a('0x35')]=qs['filters'](_['pick'](_0x1c372a[_0xde4a('0x2c')],_0x146fc8[_0xde4a('0x36')]));if(_0x1c372a['query'][_0xde4a('0x3a')]){_0x2d4740['where']=_['merge'](_0x2d4740[_0xde4a('0x35')],{'$or':_[_0xde4a('0x26')](_0x2d4740[_0xde4a('0x2e')],function(_0x3d06a9){var _0x195839={};_0x195839[_0x3d06a9]={'$like':'%'+_0x1c372a[_0xde4a('0x2c')][_0xde4a('0x3a')]+'%'};return _0x195839;})});}_0x2d4740=_[_0xde4a('0x38')]({},_0x2d4740,_0x1c372a[_0xde4a('0x3b')]);return _0x5549dc[_0xde4a('0x4d')](_0x2d4740);}})['then'](function(_0x1252d2){if(_0x1252d2){_0x1fb4fd=_0x1252d2['length'];if(!_0x1c372a[_0xde4a('0x2c')]['hasOwnProperty'](_0xde4a('0x31'))){_0x2d4740[_0xde4a('0x32')]=qs[_0xde4a('0x32')](_0x1c372a[_0xde4a('0x2c')]['limit']);_0x2d4740[_0xde4a('0x1d')]=qs[_0xde4a('0x1d')](_0x1c372a[_0xde4a('0x2c')][_0xde4a('0x1d')]);}return _0x5549dc['getFields'](_0x2d4740);}})['then'](function(_0x7ab5ea){if(_0x7ab5ea){return _0x7ab5ea?{'count':_0x1fb4fd,'rows':_0x7ab5ea}:null;}})[_0xde4a('0x22')](respondWithResult(_0x1d6e09,null))[_0xde4a('0x44')](handleError(_0x1d6e09,null));}; \ No newline at end of file +var _0xd74b=['params','keys','length','find','create','body','update','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','end','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','includeAll','include','findAll','then','rows','catch','show'];(function(_0x29f27e,_0x2169b6){var _0x4b1fef=function(_0x20fb63){while(--_0x20fb63){_0x29f27e['push'](_0x29f27e['shift']());}};_0x4b1fef(++_0x2169b6);}(_0xd74b,0x10b));var _0xbd74=function(_0x5ebffd,_0x3b5822){_0x5ebffd=_0x5ebffd-0x0;var _0x4e10fd=_0xd74b[_0x5ebffd];return _0x4e10fd;};'use strict';var emlformat=require(_0xbd74('0x0'));var rimraf=require(_0xbd74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbd74('0x2'));var moment=require('moment');var BPromise=require(_0xbd74('0x3'));var Mustache=require(_0xbd74('0x4'));var util=require(_0xbd74('0x5'));var path=require(_0xbd74('0x6'));var sox=require(_0xbd74('0x7'));var csv=require(_0xbd74('0x8'));var ejs=require(_0xbd74('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd74('0xa'));var squel=require(_0xbd74('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd74('0xc'));var deskjs=require(_0xbd74('0xd'));var toCsv=require(_0xbd74('0x8'));var querystring=require(_0xbd74('0xe'));var Papa=require(_0xbd74('0xf'));var Redis=require(_0xbd74('0x10'));var authService=require(_0xbd74('0x11'));var qs=require(_0xbd74('0x12'));var as=require(_0xbd74('0x13'));var hardwareService=require(_0xbd74('0x14'));var logger=require(_0xbd74('0x15'))(_0xbd74('0x16'));var utils=require('../../config/utils');var config=require(_0xbd74('0x17'));var licenseUtil=require(_0xbd74('0x18'));var db=require(_0xbd74('0x19'))['db'];function respondWithStatusCode(_0x334395,_0xf93088){_0xf93088=_0xf93088||0xcc;return function(_0x5adc87){if(_0x5adc87){return _0x334395[_0xbd74('0x1a')](_0xf93088);}return _0x334395[_0xbd74('0x1b')](_0xf93088)['end']();};}function respondWithResult(_0x2a29d2,_0x303695){_0x303695=_0x303695||0xc8;return function(_0x2a4ee6){if(_0x2a4ee6){return _0x2a29d2[_0xbd74('0x1b')](_0x303695)['json'](_0x2a4ee6);}};}function respondWithFilteredResult(_0x3ac3aa,_0x3da0fc){return function(_0x47ca7d){if(_0x47ca7d){var _0x2e1abe=typeof _0x3da0fc[_0xbd74('0x1c')]===_0xbd74('0x1d')&&typeof _0x3da0fc[_0xbd74('0x1e')]===_0xbd74('0x1d');var _0x3e282e=_0x47ca7d[_0xbd74('0x1f')];var _0x4b481b=_0x2e1abe?0x0:_0x3da0fc[_0xbd74('0x1c')];var _0x3e30e4=_0x2e1abe?_0x47ca7d[_0xbd74('0x1f')]:_0x3da0fc[_0xbd74('0x1c')]+_0x3da0fc[_0xbd74('0x1e')];var _0x5423b7;if(_0x3e30e4>=_0x3e282e){_0x3e30e4=_0x3e282e;_0x5423b7=0xc8;}else{_0x5423b7=0xce;}_0x3ac3aa[_0xbd74('0x1b')](_0x5423b7);return _0x3ac3aa[_0xbd74('0x20')](_0xbd74('0x21'),_0x4b481b+'-'+_0x3e30e4+'/'+_0x3e282e)[_0xbd74('0x22')](_0x47ca7d);}return null;};}function patchUpdates(_0x48e4c0){return function(_0x220fef){try{jsonpatch[_0xbd74('0x23')](_0x220fef,_0x48e4c0,!![]);}catch(_0x215995){return BPromise[_0xbd74('0x24')](_0x215995);}return _0x220fef[_0xbd74('0x25')]();};}function saveUpdates(_0x31a946,_0x1269a2){return function(_0x35aba){if(_0x35aba){return _0x35aba['update'](_0x31a946)['then'](function(_0x36cd49){return _0x36cd49;});}return null;};}function removeEntity(_0x220b1d,_0x2d7788){return function(_0x550526){if(_0x550526){return _0x550526[_0xbd74('0x26')]()['then'](function(){_0x220b1d[_0xbd74('0x1b')](0xcc)[_0xbd74('0x27')]();});}};}function handleEntityNotFound(_0x45eb0d,_0x444e47){return function(_0x4b2083){if(!_0x4b2083){_0x45eb0d[_0xbd74('0x1a')](0x194);}return _0x4b2083;};}function handleError(_0x33ab19,_0x2fcd23){_0x2fcd23=_0x2fcd23||0x1f4;return function(_0x308df9){logger[_0xbd74('0x28')](_0x308df9[_0xbd74('0x29')]);if(_0x308df9['name']){delete _0x308df9['name'];}_0x33ab19[_0xbd74('0x1b')](_0x2fcd23)[_0xbd74('0x2a')](_0x308df9);};}exports[_0xbd74('0x2b')]=function(_0x23ddf4,_0x2e3969){var _0x333a17={},_0x23a809={},_0x57bbd8={'count':0x0,'rows':[]};var _0x5e1d8c=_[_0xbd74('0x2c')](db['FreshsalesConfiguration'][_0xbd74('0x2d')],function(_0x172b09){return{'name':_0x172b09[_0xbd74('0x2e')],'type':_0x172b09[_0xbd74('0x2f')][_0xbd74('0x30')]};});_0x23a809[_0xbd74('0x31')]=_['map'](_0x5e1d8c,_0xbd74('0x32'));_0x23a809[_0xbd74('0x33')]=_['keys'](_0x23ddf4[_0xbd74('0x33')]);_0x23a809[_0xbd74('0x34')]=_[_0xbd74('0x35')](_0x23a809[_0xbd74('0x31')],_0x23a809[_0xbd74('0x33')]);_0x333a17[_0xbd74('0x36')]=_['intersection'](_0x23a809[_0xbd74('0x31')],qs[_0xbd74('0x37')](_0x23ddf4['query'][_0xbd74('0x37')]));_0x333a17[_0xbd74('0x36')]=_0x333a17[_0xbd74('0x36')]['length']?_0x333a17['attributes']:_0x23a809['model'];if(!_0x23ddf4['query'][_0xbd74('0x38')](_0xbd74('0x39'))){_0x333a17['limit']=qs[_0xbd74('0x1e')](_0x23ddf4[_0xbd74('0x33')]['limit']);_0x333a17[_0xbd74('0x1c')]=qs[_0xbd74('0x1c')](_0x23ddf4['query']['offset']);}_0x333a17[_0xbd74('0x3a')]=qs[_0xbd74('0x3b')](_0x23ddf4[_0xbd74('0x33')]['sort']);_0x333a17[_0xbd74('0x3c')]=qs[_0xbd74('0x34')](_[_0xbd74('0x3d')](_0x23ddf4[_0xbd74('0x33')],_0x23a809[_0xbd74('0x34')]),_0x5e1d8c);if(_0x23ddf4['query'][_0xbd74('0x3e')]){_0x333a17[_0xbd74('0x3c')]=_[_0xbd74('0x3f')](_0x333a17[_0xbd74('0x3c')],{'$or':_[_0xbd74('0x2c')](_0x5e1d8c,function(_0x8c99f3){if(_0x8c99f3['type']!=='VIRTUAL'){var _0x35fb3b={};_0x35fb3b[_0x8c99f3[_0xbd74('0x32')]]={'$like':'%'+_0x23ddf4['query'][_0xbd74('0x3e')]+'%'};return _0x35fb3b;}})});}_0x333a17=_[_0xbd74('0x3f')]({},_0x333a17,_0x23ddf4[_0xbd74('0x40')]);var _0x6753e8={'where':_0x333a17[_0xbd74('0x3c')]};return db[_0xbd74('0x41')][_0xbd74('0x1f')](_0x6753e8)['then'](function(_0xfbab26){_0x57bbd8[_0xbd74('0x1f')]=_0xfbab26;if(_0x23ddf4[_0xbd74('0x33')][_0xbd74('0x42')]){_0x333a17[_0xbd74('0x43')]=[{'all':!![]}];}return db[_0xbd74('0x41')][_0xbd74('0x44')](_0x333a17);})[_0xbd74('0x45')](function(_0x182e79){_0x57bbd8[_0xbd74('0x46')]=_0x182e79;return _0x57bbd8;})[_0xbd74('0x45')](respondWithFilteredResult(_0x2e3969,_0x333a17))[_0xbd74('0x47')](handleError(_0x2e3969,null));};exports[_0xbd74('0x48')]=function(_0x476e20,_0xe31fc6){var _0x337936={'raw':![],'where':{'id':_0x476e20[_0xbd74('0x49')]['id']}},_0x5bf725={};_0x5bf725['model']=_[_0xbd74('0x4a')](db[_0xbd74('0x41')][_0xbd74('0x2d')]);_0x5bf725[_0xbd74('0x33')]=_[_0xbd74('0x4a')](_0x476e20[_0xbd74('0x33')]);_0x5bf725[_0xbd74('0x34')]=_[_0xbd74('0x35')](_0x5bf725[_0xbd74('0x31')],_0x5bf725['query']);_0x337936['attributes']=_[_0xbd74('0x35')](_0x5bf725['model'],qs[_0xbd74('0x37')](_0x476e20[_0xbd74('0x33')]['fields']));_0x337936['attributes']=_0x337936[_0xbd74('0x36')][_0xbd74('0x4b')]?_0x337936['attributes']:_0x5bf725[_0xbd74('0x31')];if(_0x476e20[_0xbd74('0x33')][_0xbd74('0x42')]){_0x337936[_0xbd74('0x43')]=[{'all':!![]}];}_0x337936=_[_0xbd74('0x3f')]({},_0x337936,_0x476e20[_0xbd74('0x40')]);return db[_0xbd74('0x41')][_0xbd74('0x4c')](_0x337936)['then'](handleEntityNotFound(_0xe31fc6,null))[_0xbd74('0x45')](respondWithResult(_0xe31fc6,null))[_0xbd74('0x47')](handleError(_0xe31fc6,null));};exports[_0xbd74('0x4d')]=function(_0x3e1c41,_0x591c1e){return db['FreshsalesConfiguration'][_0xbd74('0x4d')](_0x3e1c41[_0xbd74('0x4e')],{})[_0xbd74('0x45')](respondWithResult(_0x591c1e,0xc9))[_0xbd74('0x47')](handleError(_0x591c1e,null));};exports[_0xbd74('0x4f')]=function(_0x586659,_0x220759){if(_0x586659[_0xbd74('0x4e')]['id']){delete _0x586659[_0xbd74('0x4e')]['id'];}return db[_0xbd74('0x41')][_0xbd74('0x4c')]({'where':{'id':_0x586659[_0xbd74('0x49')]['id']}})[_0xbd74('0x45')](handleEntityNotFound(_0x220759,null))[_0xbd74('0x45')](saveUpdates(_0x586659[_0xbd74('0x4e')],null))[_0xbd74('0x45')](respondWithResult(_0x220759,null))[_0xbd74('0x47')](handleError(_0x220759,null));};exports[_0xbd74('0x26')]=function(_0x8583f8,_0x3924b9){return db[_0xbd74('0x41')][_0xbd74('0x4c')]({'where':{'id':_0x8583f8[_0xbd74('0x49')]['id']}})[_0xbd74('0x45')](handleEntityNotFound(_0x3924b9,null))[_0xbd74('0x45')](removeEntity(_0x3924b9,null))[_0xbd74('0x47')](handleError(_0x3924b9,null));};exports[_0xbd74('0x50')]=function(_0x4989a1,_0x3ea77c,_0x8075b9){var _0x15b964={};var _0x5d69b1={};var _0x28f637;var _0x89984f;return db[_0xbd74('0x41')][_0xbd74('0x51')]({'where':{'id':_0x4989a1[_0xbd74('0x49')]['id']}})[_0xbd74('0x45')](handleEntityNotFound(_0x3ea77c,null))[_0xbd74('0x45')](function(_0x5eeec){if(_0x5eeec){_0x28f637=_0x5eeec;_0x5d69b1['model']=_['keys'](db[_0xbd74('0x52')]['rawAttributes']);_0x5d69b1[_0xbd74('0x33')]=_['keys'](_0x4989a1[_0xbd74('0x33')]);_0x5d69b1[_0xbd74('0x34')]=_[_0xbd74('0x35')](_0x5d69b1[_0xbd74('0x31')],_0x5d69b1[_0xbd74('0x33')]);_0x15b964['attributes']=_['intersection'](_0x5d69b1[_0xbd74('0x31')],qs[_0xbd74('0x37')](_0x4989a1['query'][_0xbd74('0x37')]));_0x15b964[_0xbd74('0x36')]=_0x15b964[_0xbd74('0x36')][_0xbd74('0x4b')]?_0x15b964['attributes']:_0x5d69b1['model'];_0x15b964[_0xbd74('0x3a')]=qs[_0xbd74('0x3b')](_0x4989a1[_0xbd74('0x33')][_0xbd74('0x3b')]);_0x15b964[_0xbd74('0x3c')]=qs[_0xbd74('0x34')](_[_0xbd74('0x3d')](_0x4989a1[_0xbd74('0x33')],_0x5d69b1[_0xbd74('0x34')]));if(_0x4989a1[_0xbd74('0x33')][_0xbd74('0x3e')]){_0x15b964['where']=_['merge'](_0x15b964[_0xbd74('0x3c')],{'$or':_[_0xbd74('0x2c')](_0x15b964[_0xbd74('0x36')],function(_0x16e19e){var _0xe47ea9={};_0xe47ea9[_0x16e19e]={'$like':'%'+_0x4989a1[_0xbd74('0x33')][_0xbd74('0x3e')]+'%'};return _0xe47ea9;})});}_0x15b964=_[_0xbd74('0x3f')]({},_0x15b964,_0x4989a1[_0xbd74('0x40')]);return _0x28f637[_0xbd74('0x50')](_0x15b964);}})[_0xbd74('0x45')](function(_0x4d9d76){if(_0x4d9d76){_0x89984f=_0x4d9d76['length'];if(!_0x4989a1[_0xbd74('0x33')][_0xbd74('0x38')](_0xbd74('0x39'))){_0x15b964[_0xbd74('0x1e')]=qs[_0xbd74('0x1e')](_0x4989a1['query']['limit']);_0x15b964[_0xbd74('0x1c')]=qs['offset'](_0x4989a1[_0xbd74('0x33')][_0xbd74('0x1c')]);}return _0x28f637[_0xbd74('0x50')](_0x15b964);}})[_0xbd74('0x45')](function(_0x228773){if(_0x228773){return _0x228773?{'count':_0x89984f,'rows':_0x228773}:null;}})[_0xbd74('0x45')](respondWithResult(_0x3ea77c,null))['catch'](handleError(_0x3ea77c,null));};exports[_0xbd74('0x53')]=function(_0x5cddfe,_0x5d4492,_0x491097){var _0x289f61={};var _0x1533d8={};var _0x1e65f3;var _0x149bc2;return db['FreshsalesConfiguration'][_0xbd74('0x51')]({'where':{'id':_0x5cddfe[_0xbd74('0x49')]['id']}})[_0xbd74('0x45')](handleEntityNotFound(_0x5d4492,null))[_0xbd74('0x45')](function(_0x516a5b){if(_0x516a5b){_0x1e65f3=_0x516a5b;_0x1533d8[_0xbd74('0x31')]=_[_0xbd74('0x4a')](db[_0xbd74('0x52')][_0xbd74('0x2d')]);_0x1533d8[_0xbd74('0x33')]=_[_0xbd74('0x4a')](_0x5cddfe[_0xbd74('0x33')]);_0x1533d8[_0xbd74('0x34')]=_[_0xbd74('0x35')](_0x1533d8[_0xbd74('0x31')],_0x1533d8[_0xbd74('0x33')]);_0x289f61[_0xbd74('0x36')]=_['intersection'](_0x1533d8[_0xbd74('0x31')],qs[_0xbd74('0x37')](_0x5cddfe[_0xbd74('0x33')][_0xbd74('0x37')]));_0x289f61['attributes']=_0x289f61[_0xbd74('0x36')][_0xbd74('0x4b')]?_0x289f61[_0xbd74('0x36')]:_0x1533d8[_0xbd74('0x31')];_0x289f61[_0xbd74('0x3a')]=qs[_0xbd74('0x3b')](_0x5cddfe[_0xbd74('0x33')][_0xbd74('0x3b')]);_0x289f61[_0xbd74('0x3c')]=qs[_0xbd74('0x34')](_[_0xbd74('0x3d')](_0x5cddfe[_0xbd74('0x33')],_0x1533d8[_0xbd74('0x34')]));if(_0x5cddfe[_0xbd74('0x33')][_0xbd74('0x3e')]){_0x289f61[_0xbd74('0x3c')]=_[_0xbd74('0x3f')](_0x289f61[_0xbd74('0x3c')],{'$or':_[_0xbd74('0x2c')](_0x289f61[_0xbd74('0x36')],function(_0x595b2a){var _0x3311f7={};_0x3311f7[_0x595b2a]={'$like':'%'+_0x5cddfe[_0xbd74('0x33')][_0xbd74('0x3e')]+'%'};return _0x3311f7;})});}_0x289f61=_[_0xbd74('0x3f')]({},_0x289f61,_0x5cddfe[_0xbd74('0x40')]);return _0x1e65f3[_0xbd74('0x53')](_0x289f61);}})[_0xbd74('0x45')](function(_0x4bf592){if(_0x4bf592){_0x149bc2=_0x4bf592['length'];if(!_0x5cddfe[_0xbd74('0x33')]['hasOwnProperty'](_0xbd74('0x39'))){_0x289f61['limit']=qs[_0xbd74('0x1e')](_0x5cddfe[_0xbd74('0x33')][_0xbd74('0x1e')]);_0x289f61[_0xbd74('0x1c')]=qs['offset'](_0x5cddfe[_0xbd74('0x33')]['offset']);}return _0x1e65f3[_0xbd74('0x53')](_0x289f61);}})[_0xbd74('0x45')](function(_0x287146){if(_0x287146){return _0x287146?{'count':_0x149bc2,'rows':_0x287146}:null;}})['then'](respondWithResult(_0x5d4492,null))[_0xbd74('0x47')](handleError(_0x5d4492,null));};exports[_0xbd74('0x54')]=function(_0xb95bbb,_0x38f5c6,_0x58a361){var _0x4793a9={};var _0x11548c={};var _0x7ae217;var _0x13af06;return db['FreshsalesConfiguration'][_0xbd74('0x51')]({'where':{'id':_0xb95bbb[_0xbd74('0x49')]['id']}})[_0xbd74('0x45')](handleEntityNotFound(_0x38f5c6,null))[_0xbd74('0x45')](function(_0x22c4f){if(_0x22c4f){_0x7ae217=_0x22c4f;_0x11548c[_0xbd74('0x31')]=_[_0xbd74('0x4a')](db[_0xbd74('0x52')][_0xbd74('0x2d')]);_0x11548c[_0xbd74('0x33')]=_[_0xbd74('0x4a')](_0xb95bbb['query']);_0x11548c['filters']=_[_0xbd74('0x35')](_0x11548c[_0xbd74('0x31')],_0x11548c[_0xbd74('0x33')]);_0x4793a9['attributes']=_[_0xbd74('0x35')](_0x11548c[_0xbd74('0x31')],qs[_0xbd74('0x37')](_0xb95bbb[_0xbd74('0x33')][_0xbd74('0x37')]));_0x4793a9[_0xbd74('0x36')]=_0x4793a9[_0xbd74('0x36')][_0xbd74('0x4b')]?_0x4793a9[_0xbd74('0x36')]:_0x11548c[_0xbd74('0x31')];_0x4793a9[_0xbd74('0x3a')]=qs['sort'](_0xb95bbb[_0xbd74('0x33')][_0xbd74('0x3b')]);_0x4793a9[_0xbd74('0x3c')]=qs[_0xbd74('0x34')](_[_0xbd74('0x3d')](_0xb95bbb[_0xbd74('0x33')],_0x11548c[_0xbd74('0x34')]));if(_0xb95bbb[_0xbd74('0x33')][_0xbd74('0x3e')]){_0x4793a9[_0xbd74('0x3c')]=_[_0xbd74('0x3f')](_0x4793a9['where'],{'$or':_[_0xbd74('0x2c')](_0x4793a9[_0xbd74('0x36')],function(_0x4d86ab){var _0x32ab71={};_0x32ab71[_0x4d86ab]={'$like':'%'+_0xb95bbb[_0xbd74('0x33')][_0xbd74('0x3e')]+'%'};return _0x32ab71;})});}_0x4793a9=_[_0xbd74('0x3f')]({},_0x4793a9,_0xb95bbb[_0xbd74('0x40')]);return _0x7ae217[_0xbd74('0x54')](_0x4793a9);}})['then'](function(_0x4624fb){if(_0x4624fb){_0x13af06=_0x4624fb[_0xbd74('0x4b')];if(!_0xb95bbb[_0xbd74('0x33')][_0xbd74('0x38')]('nolimit')){_0x4793a9[_0xbd74('0x1e')]=qs[_0xbd74('0x1e')](_0xb95bbb['query']['limit']);_0x4793a9[_0xbd74('0x1c')]=qs[_0xbd74('0x1c')](_0xb95bbb[_0xbd74('0x33')][_0xbd74('0x1c')]);}return _0x7ae217['getFields'](_0x4793a9);}})[_0xbd74('0x45')](function(_0x59f73b){if(_0x59f73b){return _0x59f73b?{'count':_0x13af06,'rows':_0x59f73b}:null;}})['then'](respondWithResult(_0x38f5c6,null))[_0xbd74('0x47')](handleError(_0x38f5c6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9db534b..9a805e9 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 _0xad5f=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','lodash','../../config/logger'];(function(_0x369f62,_0x17a354){var _0x323a6d=function(_0x4fc5cf){while(--_0x4fc5cf){_0x369f62['push'](_0x369f62['shift']());}};_0x323a6d(++_0x17a354);}(_0xad5f,0x127));var _0xfad5=function(_0x503a0c,_0xbc78c5){_0x503a0c=_0x503a0c-0x0;var _0x3b2e83=_0xad5f[_0x503a0c];return _0x3b2e83;};'use strict';var _=require(_0xfad5('0x0'));var util=require('util');var logger=require(_0xfad5('0x1'))(_0xfad5('0x2'));var moment=require(_0xfad5('0x3'));var BPromise=require(_0xfad5('0x4'));var rp=require(_0xfad5('0x5'));var fs=require('fs');var path=require(_0xfad5('0x6'));var rimraf=require('rimraf');var config=require(_0xfad5('0x7'));var attributes=require(_0xfad5('0x8'));module[_0xfad5('0x9')]=function(_0x49afc2,_0x235fa4){return _0x49afc2[_0xfad5('0xa')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c40=['define','FreshsalesConfiguration','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0x7c40,0x14a));var _0x07c4=function(_0xe30f66,_0x201e2c){_0xe30f66=_0xe30f66-0x0;var _0x3b1784=_0x7c40[_0xe30f66];return _0x3b1784;};'use strict';var _=require(_0x07c4('0x0'));var util=require('util');var logger=require(_0x07c4('0x1'))(_0x07c4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x07c4('0x3'));var rimraf=require(_0x07c4('0x4'));var config=require(_0x07c4('0x5'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0xa183ba,_0x203c50){return _0xa183ba[_0x07c4('0x6')](_0x07c4('0x7'),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 2c67694..b280186 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 _0x0b76=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis'];(function(_0xa37a85,_0x5f0e39){var _0x6ff977=function(_0x4c9fa5){while(--_0x4c9fa5){_0xa37a85['push'](_0xa37a85['shift']());}};_0x6ff977(++_0x5f0e39);}(_0x0b76,0x18b));var _0x60b7=function(_0x105b38,_0x3ce5a3){_0x105b38=_0x105b38-0x0;var _0x2942b4=_0x0b76[_0x105b38];return _0x2942b4;};'use strict';var _=require('lodash');var util=require(_0x60b7('0x0'));var moment=require(_0x60b7('0x1'));var BPromise=require('bluebird');var rs=require(_0x60b7('0x2'));var fs=require('fs');var Redis=require(_0x60b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x60b7('0x4'));var logger=require(_0x60b7('0x5'))(_0x60b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x60b7('0x7'));var client=jayson[_0x60b7('0x8')][_0x60b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x353ec8,_0xe42b6b,_0x26d7ba){return new BPromise(function(_0x5a174b,_0x37dc0f){return client[_0x60b7('0xa')](_0x353ec8,_0x26d7ba)['then'](function(_0x4ae400){logger[_0x60b7('0xb')](_0x60b7('0xc'),_0xe42b6b,_0x60b7('0xd'));logger[_0x60b7('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xe42b6b,_0x60b7('0xd'),JSON[_0x60b7('0xf')](_0x4ae400));if(_0x4ae400[_0x60b7('0x10')]){if(_0x4ae400[_0x60b7('0x10')][_0x60b7('0x11')]===0x1f4){logger[_0x60b7('0x10')](_0x60b7('0xc'),_0xe42b6b,_0x4ae400[_0x60b7('0x10')][_0x60b7('0x12')]);return _0x37dc0f(_0x4ae400[_0x60b7('0x10')][_0x60b7('0x12')]);}logger['error'](_0x60b7('0xc'),_0xe42b6b,_0x4ae400[_0x60b7('0x10')]['message']);return _0x5a174b(_0x4ae400[_0x60b7('0x10')]['message']);}else{logger['info'](_0x60b7('0xc'),_0xe42b6b,_0x60b7('0xd'));_0x5a174b(_0x4ae400[_0x60b7('0x13')][_0x60b7('0x12')]);}})[_0x60b7('0x14')](function(_0x1db86f){logger[_0x60b7('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xe42b6b,_0x1db86f);_0x37dc0f(_0x1db86f);});});} \ No newline at end of file +var _0xefe9=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xefe9,0xf0));var _0x9efe=function(_0x251eed,_0x328654){_0x251eed=_0x251eed-0x0;var _0x13db86=_0xefe9[_0x251eed];return _0x13db86;};'use strict';var _=require('lodash');var util=require(_0x9efe('0x0'));var moment=require('moment');var BPromise=require(_0x9efe('0x1'));var rs=require(_0x9efe('0x2'));var fs=require('fs');var Redis=require(_0x9efe('0x3'));var db=require(_0x9efe('0x4'))['db'];var utils=require(_0x9efe('0x5'));var logger=require('../../config/logger')(_0x9efe('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9efe('0x7')][_0x9efe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43a536,_0x268271,_0x3be11f){return new BPromise(function(_0xe5b095,_0x385c28){return client[_0x9efe('0x9')](_0x43a536,_0x3be11f)[_0x9efe('0xa')](function(_0x36064d){logger['info'](_0x9efe('0xb'),_0x268271,_0x9efe('0xc'));logger[_0x9efe('0xd')](_0x9efe('0xe'),_0x268271,'request\x20sent',JSON[_0x9efe('0xf')](_0x36064d));if(_0x36064d['error']){if(_0x36064d['error']['code']===0x1f4){logger[_0x9efe('0x10')](_0x9efe('0xb'),_0x268271,_0x36064d[_0x9efe('0x10')][_0x9efe('0x11')]);return _0x385c28(_0x36064d[_0x9efe('0x10')][_0x9efe('0x11')]);}logger['error'](_0x9efe('0xb'),_0x268271,_0x36064d[_0x9efe('0x10')][_0x9efe('0x11')]);return _0xe5b095(_0x36064d['error']['message']);}else{logger['info'](_0x9efe('0xb'),_0x268271,_0x9efe('0xc'));_0xe5b095(_0x36064d[_0x9efe('0x12')][_0x9efe('0x11')]);}})[_0x9efe('0x13')](function(_0x74dd60){logger[_0x9efe('0x10')](_0x9efe('0xb'),_0x268271,_0x74dd60);_0x385c28(_0x74dd60);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 580872f..8533f8f 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 _0xac7f=['/:id','isAuthenticated','post','create','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0x19180a,_0x44aae7){var _0x1c5392=function(_0x4b62c1){while(--_0x4b62c1){_0x19180a['push'](_0x19180a['shift']());}};_0x1c5392(++_0x44aae7);}(_0xac7f,0x1e2));var _0xfac7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xac7f[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xfac7('0x0'));var util=require('util');var path=require(_0xfac7('0x1'));var timeout=require(_0xfac7('0x2'));var express=require(_0xfac7('0x3'));var router=express['Router']();var fs_extra=require(_0xfac7('0x4'));var auth=require(_0xfac7('0x5'));var interaction=require(_0xfac7('0x6'));var config=require(_0xfac7('0x7'));var controller=require(_0xfac7('0x8'));router[_0xfac7('0x9')]('/',auth['isAuthenticated'](),controller[_0xfac7('0xa')]);router['get'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller['show']);router[_0xfac7('0xd')]('/',auth[_0xfac7('0xc')](),controller[_0xfac7('0xe')]);router['put'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller['update']);router['delete'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller[_0xfac7('0xf')]);module[_0xfac7('0x10')]=router; \ No newline at end of file +var _0xe0b2=['Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0xe0b2,0xec));var _0x2e0b=function(_0x5379a9,_0x234e13){_0x5379a9=_0x5379a9-0x0;var _0x41d877=_0xe0b2[_0x5379a9];return _0x41d877;};'use strict';var multer=require('multer');var util=require(_0x2e0b('0x0'));var path=require(_0x2e0b('0x1'));var timeout=require(_0x2e0b('0x2'));var express=require(_0x2e0b('0x3'));var router=express[_0x2e0b('0x4')]();var fs_extra=require(_0x2e0b('0x5'));var auth=require(_0x2e0b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2e0b('0x7'));var controller=require(_0x2e0b('0x8'));router[_0x2e0b('0x9')]('/',auth[_0x2e0b('0xa')](),controller[_0x2e0b('0xb')]);router[_0x2e0b('0x9')]('/:id',auth[_0x2e0b('0xa')](),controller['show']);router[_0x2e0b('0xc')]('/',auth[_0x2e0b('0xa')](),controller[_0x2e0b('0xd')]);router[_0x2e0b('0xe')](_0x2e0b('0xf'),auth[_0x2e0b('0xa')](),controller[_0x2e0b('0x10')]);router[_0x2e0b('0x11')](_0x2e0b('0xf'),auth['isAuthenticated'](),controller[_0x2e0b('0x12')]);module[_0x2e0b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 82bdbfa..41aee07 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 _0x85b9=['variable','customVariable','BOOLEAN','sequelize','exports','string','keyValue','picklist','STRING','ENUM'];(function(_0x3c5cb5,_0x48a57c){var _0xa2fe61=function(_0x7eaa6){while(--_0x7eaa6){_0x3c5cb5['push'](_0x3c5cb5['shift']());}};_0xa2fe61(++_0x48a57c);}(_0x85b9,0x1e3));var _0x985b=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x85b9[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x985b('0x0'));module[_0x985b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x985b('0x2'),'variable','customVariable',_0x985b('0x3'),_0x985b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x985b('0x5')]},'key':{'type':Sequelize[_0x985b('0x5')]},'keyType':{'type':Sequelize[_0x985b('0x6')](_0x985b('0x2'),_0x985b('0x7'),_0x985b('0x8'))},'keyContent':{'type':Sequelize[_0x985b('0x5')]},'idField':{'type':Sequelize[_0x985b('0x5')]},'nameField':{'type':Sequelize[_0x985b('0x5')]},'customField':{'type':Sequelize[_0x985b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x985b('0x5')]}}; \ No newline at end of file +var _0x13a1=['variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x14915d,_0x46bdd6){var _0x4852d8=function(_0x5c46fc){while(--_0x5c46fc){_0x14915d['push'](_0x14915d['shift']());}};_0x4852d8(++_0x46bdd6);}(_0x13a1,0x1f2));var _0x113a=function(_0xb4f07e,_0x282f5f){_0xb4f07e=_0xb4f07e-0x0;var _0x27238e=_0x13a1[_0xb4f07e];return _0x27238e;};'use strict';var Sequelize=require('sequelize');module[_0x113a('0x0')]={'type':{'type':Sequelize[_0x113a('0x1')](_0x113a('0x2'),'variable',_0x113a('0x3'),_0x113a('0x4'),'picklist'),'defaultValue':_0x113a('0x2')},'content':{'type':Sequelize[_0x113a('0x5')]},'key':{'type':Sequelize[_0x113a('0x5')]},'keyType':{'type':Sequelize[_0x113a('0x1')](_0x113a('0x2'),_0x113a('0x6'),_0x113a('0x3'))},'keyContent':{'type':Sequelize[_0x113a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x113a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x113a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2c0adc2..95e2c52 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 _0x91d9=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash'];(function(_0x2b9c17,_0xc8ac81){var _0x28711d=function(_0x135903){while(--_0x135903){_0x2b9c17['push'](_0x2b9c17['shift']());}};_0x28711d(++_0xc8ac81);}(_0x91d9,0x168));var _0x991d=function(_0x4f0cd8,_0x2d847c){_0x4f0cd8=_0x4f0cd8-0x0;var _0x1e69c3=_0x91d9[_0x4f0cd8];return _0x1e69c3;};'use strict';var emlformat=require(_0x991d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x991d('0x1'));var jsonpatch=require(_0x991d('0x2'));var rp=require('request-promise');var moment=require(_0x991d('0x3'));var BPromise=require(_0x991d('0x4'));var Mustache=require(_0x991d('0x5'));var util=require(_0x991d('0x6'));var path=require('path');var sox=require(_0x991d('0x7'));var csv=require('to-csv');var ejs=require(_0x991d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x991d('0x9'));var squel=require('squel');var crypto=require(_0x991d('0xa'));var jsforce=require(_0x991d('0xb'));var deskjs=require(_0x991d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x991d('0xd'));var Papa=require(_0x991d('0xe'));var Redis=require('ioredis');var authService=require(_0x991d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x991d('0x10'));var hardwareService=require(_0x991d('0x11'));var logger=require(_0x991d('0x12'))(_0x991d('0x13'));var utils=require('../../config/utils');var config=require(_0x991d('0x14'));var licenseUtil=require(_0x991d('0x15'));var db=require(_0x991d('0x16'))['db'];function respondWithStatusCode(_0x14288f,_0x8e847c){_0x8e847c=_0x8e847c||0xcc;return function(_0x26a6c5){if(_0x26a6c5){return _0x14288f[_0x991d('0x17')](_0x8e847c);}return _0x14288f[_0x991d('0x18')](_0x8e847c)[_0x991d('0x19')]();};}function respondWithResult(_0x28a941,_0x1aff33){_0x1aff33=_0x1aff33||0xc8;return function(_0x1331ef){if(_0x1331ef){return _0x28a941[_0x991d('0x18')](_0x1aff33)[_0x991d('0x1a')](_0x1331ef);}};}function respondWithFilteredResult(_0x33c38c,_0x168d7e){return function(_0x26b789){if(_0x26b789){var _0x5797f8=typeof _0x168d7e[_0x991d('0x1b')]===_0x991d('0x1c')&&typeof _0x168d7e[_0x991d('0x1d')]===_0x991d('0x1c');var _0x39a344=_0x26b789[_0x991d('0x1e')];var _0x256565=_0x5797f8?0x0:_0x168d7e[_0x991d('0x1b')];var _0x4b3634=_0x5797f8?_0x26b789[_0x991d('0x1e')]:_0x168d7e[_0x991d('0x1b')]+_0x168d7e[_0x991d('0x1d')];var _0x3cf757;if(_0x4b3634>=_0x39a344){_0x4b3634=_0x39a344;_0x3cf757=0xc8;}else{_0x3cf757=0xce;}_0x33c38c[_0x991d('0x18')](_0x3cf757);return _0x33c38c[_0x991d('0x1f')](_0x991d('0x20'),_0x256565+'-'+_0x4b3634+'/'+_0x39a344)['json'](_0x26b789);}return null;};}function patchUpdates(_0x2414dd){return function(_0x5b5f0b){try{jsonpatch['apply'](_0x5b5f0b,_0x2414dd,!![]);}catch(_0x1f27be){return BPromise[_0x991d('0x21')](_0x1f27be);}return _0x5b5f0b[_0x991d('0x22')]();};}function saveUpdates(_0x206f0b,_0x260cec){return function(_0x332cc9){if(_0x332cc9){return _0x332cc9[_0x991d('0x23')](_0x206f0b)[_0x991d('0x24')](function(_0x193da9){return _0x193da9;});}return null;};}function removeEntity(_0x1adf46,_0x5c3e0a){return function(_0x5585c9){if(_0x5585c9){return _0x5585c9[_0x991d('0x25')]()[_0x991d('0x24')](function(){_0x1adf46[_0x991d('0x18')](0xcc)[_0x991d('0x19')]();});}};}function handleEntityNotFound(_0x58a597,_0x46d598){return function(_0x3f01f6){if(!_0x3f01f6){_0x58a597[_0x991d('0x17')](0x194);}return _0x3f01f6;};}function handleError(_0x45296f,_0x374ec5){_0x374ec5=_0x374ec5||0x1f4;return function(_0x53153d){logger[_0x991d('0x26')](_0x53153d[_0x991d('0x27')]);if(_0x53153d[_0x991d('0x28')]){delete _0x53153d[_0x991d('0x28')];}_0x45296f[_0x991d('0x18')](_0x374ec5)[_0x991d('0x29')](_0x53153d);};}exports[_0x991d('0x2a')]=function(_0x41a1e2,_0x5a0f78){var _0x257bfa={},_0x8fc72d={},_0x4a3ada={'count':0x0,'rows':[]};var _0x417f8b=_[_0x991d('0x2b')](db[_0x991d('0x2c')][_0x991d('0x2d')],function(_0x1fde42){return{'name':_0x1fde42[_0x991d('0x2e')],'type':_0x1fde42[_0x991d('0x2f')][_0x991d('0x30')]};});_0x8fc72d[_0x991d('0x31')]=_[_0x991d('0x2b')](_0x417f8b,_0x991d('0x28'));_0x8fc72d[_0x991d('0x32')]=_[_0x991d('0x33')](_0x41a1e2[_0x991d('0x32')]);_0x8fc72d[_0x991d('0x34')]=_['intersection'](_0x8fc72d['model'],_0x8fc72d['query']);_0x257bfa[_0x991d('0x35')]=_[_0x991d('0x36')](_0x8fc72d[_0x991d('0x31')],qs[_0x991d('0x37')](_0x41a1e2[_0x991d('0x32')][_0x991d('0x37')]));_0x257bfa[_0x991d('0x35')]=_0x257bfa[_0x991d('0x35')][_0x991d('0x38')]?_0x257bfa[_0x991d('0x35')]:_0x8fc72d[_0x991d('0x31')];if(!_0x41a1e2[_0x991d('0x32')][_0x991d('0x39')]('nolimit')){_0x257bfa['limit']=qs[_0x991d('0x1d')](_0x41a1e2[_0x991d('0x32')][_0x991d('0x1d')]);_0x257bfa[_0x991d('0x1b')]=qs['offset'](_0x41a1e2['query']['offset']);}_0x257bfa[_0x991d('0x3a')]=qs[_0x991d('0x3b')](_0x41a1e2[_0x991d('0x32')][_0x991d('0x3b')]);_0x257bfa[_0x991d('0x3c')]=qs[_0x991d('0x34')](_['pick'](_0x41a1e2[_0x991d('0x32')],_0x8fc72d[_0x991d('0x34')]),_0x417f8b);if(_0x41a1e2['query'][_0x991d('0x3d')]){_0x257bfa['where']=_['merge'](_0x257bfa[_0x991d('0x3c')],{'$or':_[_0x991d('0x2b')](_0x417f8b,function(_0x26cdfa){if(_0x26cdfa[_0x991d('0x2f')]!==_0x991d('0x3e')){var _0x482157={};_0x482157[_0x26cdfa['name']]={'$like':'%'+_0x41a1e2['query']['filter']+'%'};return _0x482157;}})});}_0x257bfa=_['merge']({},_0x257bfa,_0x41a1e2[_0x991d('0x3f')]);var _0x14bcb5={'where':_0x257bfa['where']};return db[_0x991d('0x2c')][_0x991d('0x1e')](_0x14bcb5)[_0x991d('0x24')](function(_0x305b71){_0x4a3ada['count']=_0x305b71;if(_0x41a1e2['query'][_0x991d('0x40')]){_0x257bfa['include']=[{'all':!![]}];}return db[_0x991d('0x2c')][_0x991d('0x41')](_0x257bfa);})[_0x991d('0x24')](function(_0xbdabf0){_0x4a3ada[_0x991d('0x42')]=_0xbdabf0;return _0x4a3ada;})[_0x991d('0x24')](respondWithFilteredResult(_0x5a0f78,_0x257bfa))[_0x991d('0x43')](handleError(_0x5a0f78,null));};exports[_0x991d('0x44')]=function(_0x1dbd43,_0x30bbac){var _0x43e9df={'raw':!![],'where':{'id':_0x1dbd43['params']['id']}},_0xfff1fc={};_0xfff1fc['model']=_[_0x991d('0x33')](db[_0x991d('0x2c')]['rawAttributes']);_0xfff1fc['query']=_[_0x991d('0x33')](_0x1dbd43['query']);_0xfff1fc['filters']=_[_0x991d('0x36')](_0xfff1fc[_0x991d('0x31')],_0xfff1fc[_0x991d('0x32')]);_0x43e9df['attributes']=_['intersection'](_0xfff1fc['model'],qs[_0x991d('0x37')](_0x1dbd43['query'][_0x991d('0x37')]));_0x43e9df['attributes']=_0x43e9df[_0x991d('0x35')][_0x991d('0x38')]?_0x43e9df[_0x991d('0x35')]:_0xfff1fc[_0x991d('0x31')];if(_0x1dbd43[_0x991d('0x32')]['includeAll']){_0x43e9df[_0x991d('0x45')]=[{'all':!![]}];}_0x43e9df=_['merge']({},_0x43e9df,_0x1dbd43[_0x991d('0x3f')]);return db[_0x991d('0x2c')]['find'](_0x43e9df)[_0x991d('0x24')](handleEntityNotFound(_0x30bbac,null))[_0x991d('0x24')](respondWithResult(_0x30bbac,null))[_0x991d('0x43')](handleError(_0x30bbac,null));};exports[_0x991d('0x46')]=function(_0x1f5c0d,_0x8119c3){return db[_0x991d('0x2c')]['create'](_0x1f5c0d['body'],{})['then'](respondWithResult(_0x8119c3,0xc9))[_0x991d('0x43')](handleError(_0x8119c3,null));};exports[_0x991d('0x23')]=function(_0x15479e,_0x2ebdcd){if(_0x15479e['body']['id']){delete _0x15479e[_0x991d('0x47')]['id'];}return db[_0x991d('0x2c')][_0x991d('0x48')]({'where':{'id':_0x15479e[_0x991d('0x49')]['id']}})[_0x991d('0x24')](handleEntityNotFound(_0x2ebdcd,null))[_0x991d('0x24')](saveUpdates(_0x15479e[_0x991d('0x47')],null))[_0x991d('0x24')](respondWithResult(_0x2ebdcd,null))[_0x991d('0x43')](handleError(_0x2ebdcd,null));};exports['destroy']=function(_0x2bb536,_0x49b4b5){return db['FreshsalesField'][_0x991d('0x48')]({'where':{'id':_0x2bb536[_0x991d('0x49')]['id']}})[_0x991d('0x24')](handleEntityNotFound(_0x49b4b5,null))[_0x991d('0x24')](removeEntity(_0x49b4b5,null))['catch'](handleError(_0x49b4b5,null));}; \ No newline at end of file +var _0xd540=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x5ccb24,_0x17801a){var _0x109d5a=function(_0x4ec24f){while(--_0x4ec24f){_0x5ccb24['push'](_0x5ccb24['shift']());}};_0x109d5a(++_0x17801a);}(_0xd540,0x1ad));var _0x0d54=function(_0x153507,_0x2f8f3d){_0x153507=_0x153507-0x0;var _0x452180=_0xd540[_0x153507];return _0x452180;};'use strict';var emlformat=require(_0x0d54('0x0'));var rimraf=require(_0x0d54('0x1'));var zipdir=require(_0x0d54('0x2'));var jsonpatch=require(_0x0d54('0x3'));var rp=require(_0x0d54('0x4'));var moment=require(_0x0d54('0x5'));var BPromise=require(_0x0d54('0x6'));var Mustache=require(_0x0d54('0x7'));var util=require(_0x0d54('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0d54('0x9'));var ejs=require(_0x0d54('0xa'));var fs=require('fs');var fs_extra=require(_0x0d54('0xb'));var _=require('lodash');var squel=require(_0x0d54('0xc'));var crypto=require(_0x0d54('0xd'));var jsforce=require(_0x0d54('0xe'));var deskjs=require(_0x0d54('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0d54('0x10'));var Redis=require('ioredis');var authService=require(_0x0d54('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0d54('0x12'));var hardwareService=require(_0x0d54('0x13'));var logger=require('../../config/logger')(_0x0d54('0x14'));var utils=require(_0x0d54('0x15'));var config=require(_0x0d54('0x16'));var licenseUtil=require(_0x0d54('0x17'));var db=require(_0x0d54('0x18'))['db'];function respondWithStatusCode(_0x4855a8,_0x3bdc2b){_0x3bdc2b=_0x3bdc2b||0xcc;return function(_0x498ab9){if(_0x498ab9){return _0x4855a8[_0x0d54('0x19')](_0x3bdc2b);}return _0x4855a8[_0x0d54('0x1a')](_0x3bdc2b)[_0x0d54('0x1b')]();};}function respondWithResult(_0x2dbb75,_0x150395){_0x150395=_0x150395||0xc8;return function(_0x5215b6){if(_0x5215b6){return _0x2dbb75['status'](_0x150395)['json'](_0x5215b6);}};}function respondWithFilteredResult(_0x22db05,_0x5739f6){return function(_0xa8f762){if(_0xa8f762){var _0x1f9077=typeof _0x5739f6[_0x0d54('0x1c')]===_0x0d54('0x1d')&&typeof _0x5739f6[_0x0d54('0x1e')]===_0x0d54('0x1d');var _0x2b60cc=_0xa8f762[_0x0d54('0x1f')];var _0x33c67c=_0x1f9077?0x0:_0x5739f6[_0x0d54('0x1c')];var _0x8f963f=_0x1f9077?_0xa8f762[_0x0d54('0x1f')]:_0x5739f6[_0x0d54('0x1c')]+_0x5739f6[_0x0d54('0x1e')];var _0x56d1c4;if(_0x8f963f>=_0x2b60cc){_0x8f963f=_0x2b60cc;_0x56d1c4=0xc8;}else{_0x56d1c4=0xce;}_0x22db05['status'](_0x56d1c4);return _0x22db05[_0x0d54('0x20')](_0x0d54('0x21'),_0x33c67c+'-'+_0x8f963f+'/'+_0x2b60cc)['json'](_0xa8f762);}return null;};}function patchUpdates(_0xc389c7){return function(_0x51cbf9){try{jsonpatch[_0x0d54('0x22')](_0x51cbf9,_0xc389c7,!![]);}catch(_0x192692){return BPromise[_0x0d54('0x23')](_0x192692);}return _0x51cbf9[_0x0d54('0x24')]();};}function saveUpdates(_0x22f820,_0x17e94){return function(_0x4bb63b){if(_0x4bb63b){return _0x4bb63b[_0x0d54('0x25')](_0x22f820)[_0x0d54('0x26')](function(_0x59d0b5){return _0x59d0b5;});}return null;};}function removeEntity(_0x339762,_0x105a02){return function(_0x5111a1){if(_0x5111a1){return _0x5111a1[_0x0d54('0x27')]()['then'](function(){_0x339762[_0x0d54('0x1a')](0xcc)[_0x0d54('0x1b')]();});}};}function handleEntityNotFound(_0x20bf61,_0x3150b3){return function(_0x502291){if(!_0x502291){_0x20bf61[_0x0d54('0x19')](0x194);}return _0x502291;};}function handleError(_0x4b9591,_0x1e64fb){_0x1e64fb=_0x1e64fb||0x1f4;return function(_0x4690de){logger[_0x0d54('0x28')](_0x4690de[_0x0d54('0x29')]);if(_0x4690de[_0x0d54('0x2a')]){delete _0x4690de[_0x0d54('0x2a')];}_0x4b9591[_0x0d54('0x1a')](_0x1e64fb)[_0x0d54('0x2b')](_0x4690de);};}exports[_0x0d54('0x2c')]=function(_0x5afc27,_0x79342f){var _0x362a62={},_0x5da21b={},_0x523c92={'count':0x0,'rows':[]};var _0x3ae2fe=_[_0x0d54('0x2d')](db[_0x0d54('0x2e')][_0x0d54('0x2f')],function(_0x11b9aa){return{'name':_0x11b9aa[_0x0d54('0x30')],'type':_0x11b9aa[_0x0d54('0x31')]['key']};});_0x5da21b[_0x0d54('0x32')]=_[_0x0d54('0x2d')](_0x3ae2fe,_0x0d54('0x2a'));_0x5da21b[_0x0d54('0x33')]=_['keys'](_0x5afc27['query']);_0x5da21b['filters']=_['intersection'](_0x5da21b['model'],_0x5da21b['query']);_0x362a62['attributes']=_[_0x0d54('0x34')](_0x5da21b[_0x0d54('0x32')],qs[_0x0d54('0x35')](_0x5afc27['query'][_0x0d54('0x35')]));_0x362a62[_0x0d54('0x36')]=_0x362a62[_0x0d54('0x36')][_0x0d54('0x37')]?_0x362a62['attributes']:_0x5da21b[_0x0d54('0x32')];if(!_0x5afc27[_0x0d54('0x33')][_0x0d54('0x38')](_0x0d54('0x39'))){_0x362a62[_0x0d54('0x1e')]=qs[_0x0d54('0x1e')](_0x5afc27[_0x0d54('0x33')][_0x0d54('0x1e')]);_0x362a62[_0x0d54('0x1c')]=qs[_0x0d54('0x1c')](_0x5afc27[_0x0d54('0x33')][_0x0d54('0x1c')]);}_0x362a62[_0x0d54('0x3a')]=qs[_0x0d54('0x3b')](_0x5afc27[_0x0d54('0x33')][_0x0d54('0x3b')]);_0x362a62[_0x0d54('0x3c')]=qs[_0x0d54('0x3d')](_[_0x0d54('0x3e')](_0x5afc27['query'],_0x5da21b[_0x0d54('0x3d')]),_0x3ae2fe);if(_0x5afc27['query'][_0x0d54('0x3f')]){_0x362a62[_0x0d54('0x3c')]=_[_0x0d54('0x40')](_0x362a62[_0x0d54('0x3c')],{'$or':_[_0x0d54('0x2d')](_0x3ae2fe,function(_0x2cd13b){if(_0x2cd13b[_0x0d54('0x31')]!==_0x0d54('0x41')){var _0x141abc={};_0x141abc[_0x2cd13b[_0x0d54('0x2a')]]={'$like':'%'+_0x5afc27['query']['filter']+'%'};return _0x141abc;}})});}_0x362a62=_[_0x0d54('0x40')]({},_0x362a62,_0x5afc27[_0x0d54('0x42')]);var _0x383c36={'where':_0x362a62[_0x0d54('0x3c')]};return db['FreshsalesField']['count'](_0x383c36)[_0x0d54('0x26')](function(_0x285b93){_0x523c92[_0x0d54('0x1f')]=_0x285b93;if(_0x5afc27['query'][_0x0d54('0x43')]){_0x362a62[_0x0d54('0x44')]=[{'all':!![]}];}return db[_0x0d54('0x2e')][_0x0d54('0x45')](_0x362a62);})[_0x0d54('0x26')](function(_0x572634){_0x523c92[_0x0d54('0x46')]=_0x572634;return _0x523c92;})[_0x0d54('0x26')](respondWithFilteredResult(_0x79342f,_0x362a62))[_0x0d54('0x47')](handleError(_0x79342f,null));};exports['show']=function(_0x37979d,_0x48ac05){var _0x321c6d={'raw':!![],'where':{'id':_0x37979d[_0x0d54('0x48')]['id']}},_0x48adcd={};_0x48adcd[_0x0d54('0x32')]=_['keys'](db[_0x0d54('0x2e')][_0x0d54('0x2f')]);_0x48adcd[_0x0d54('0x33')]=_[_0x0d54('0x49')](_0x37979d[_0x0d54('0x33')]);_0x48adcd['filters']=_['intersection'](_0x48adcd[_0x0d54('0x32')],_0x48adcd[_0x0d54('0x33')]);_0x321c6d[_0x0d54('0x36')]=_[_0x0d54('0x34')](_0x48adcd['model'],qs[_0x0d54('0x35')](_0x37979d[_0x0d54('0x33')]['fields']));_0x321c6d[_0x0d54('0x36')]=_0x321c6d[_0x0d54('0x36')][_0x0d54('0x37')]?_0x321c6d[_0x0d54('0x36')]:_0x48adcd[_0x0d54('0x32')];if(_0x37979d[_0x0d54('0x33')][_0x0d54('0x43')]){_0x321c6d[_0x0d54('0x44')]=[{'all':!![]}];}_0x321c6d=_[_0x0d54('0x40')]({},_0x321c6d,_0x37979d[_0x0d54('0x42')]);return db['FreshsalesField']['find'](_0x321c6d)[_0x0d54('0x26')](handleEntityNotFound(_0x48ac05,null))[_0x0d54('0x26')](respondWithResult(_0x48ac05,null))[_0x0d54('0x47')](handleError(_0x48ac05,null));};exports[_0x0d54('0x4a')]=function(_0x4c8582,_0x437f29){return db['FreshsalesField']['create'](_0x4c8582[_0x0d54('0x4b')],{})['then'](respondWithResult(_0x437f29,0xc9))['catch'](handleError(_0x437f29,null));};exports[_0x0d54('0x25')]=function(_0x3250cb,_0x1c76bd){if(_0x3250cb[_0x0d54('0x4b')]['id']){delete _0x3250cb[_0x0d54('0x4b')]['id'];}return db[_0x0d54('0x2e')][_0x0d54('0x4c')]({'where':{'id':_0x3250cb[_0x0d54('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c76bd,null))[_0x0d54('0x26')](saveUpdates(_0x3250cb['body'],null))[_0x0d54('0x26')](respondWithResult(_0x1c76bd,null))['catch'](handleError(_0x1c76bd,null));};exports[_0x0d54('0x27')]=function(_0x521607,_0x200a2a){return db[_0x0d54('0x2e')]['find']({'where':{'id':_0x521607['params']['id']}})[_0x0d54('0x26')](handleEntityNotFound(_0x200a2a,null))[_0x0d54('0x26')](removeEntity(_0x200a2a,null))[_0x0d54('0x47')](handleError(_0x200a2a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4211f8c..fa603e8 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 _0x6f83=['idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x393572,_0x1e7928){var _0x482e23=function(_0x5c8e0c){while(--_0x5c8e0c){_0x393572['push'](_0x393572['shift']());}};_0x482e23(++_0x1e7928);}(_0x6f83,0x72));var _0x36f8=function(_0x4a5a30,_0x55859b){_0x4a5a30=_0x4a5a30-0x0;var _0xb08a8d=_0x6f83[_0x4a5a30];return _0xb08a8d;};'use strict';var _=require('lodash');var util=require(_0x36f8('0x0'));var logger=require(_0x36f8('0x1'))('api');var moment=require(_0x36f8('0x2'));var BPromise=require(_0x36f8('0x3'));var rp=require(_0x36f8('0x4'));var fs=require('fs');var path=require(_0x36f8('0x5'));var rimraf=require(_0x36f8('0x6'));var config=require(_0x36f8('0x7'));var attributes=require(_0x36f8('0x8'));module[_0x36f8('0x9')]=function(_0x31ff95,_0x3b9620){return _0x31ff95[_0x36f8('0xa')](_0x36f8('0xb'),attributes,{'tableName':_0x36f8('0xc'),'paranoid':![],'indexes':[{'name':_0x36f8('0xd'),'fields':[_0x36f8('0xe'),_0x36f8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef0f=['request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','FieldId','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef0f,0x168));var _0xfef0=function(_0x5e3e7c,_0x527a46){_0x5e3e7c=_0x5e3e7c-0x0;var _0x38fe49=_0xef0f[_0x5e3e7c];return _0x38fe49;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xfef0('0xb'),'fields':['idField',_0xfef0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 3fd8ccc..a2443bf 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 _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ee653,_0x174b2c){var _0x4701bf=function(_0x580227){while(--_0x580227){_0x3ee653['push'](_0x3ee653['shift']());}};_0x4701bf(++_0x174b2c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x26fd94,_0xef4e81){_0x26fd94=_0x26fd94-0x0;var _0x5df614=_0xb4c7[_0x26fd94];return _0x5df614;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x4acdd0,_0x4d1f59){var _0x392ba5=function(_0x30cab7){while(--_0x30cab7){_0x4acdd0['push'](_0x4acdd0['shift']());}};_0x392ba5(++_0x4d1f59);}(_0x524e,0x15e));var _0xe524=function(_0x1f36b9,_0x22f1e4){_0x1f36b9=_0x1f36b9-0x0;var _0x5c6f08=_0x524e[_0x1f36b9];return _0x5c6f08;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 355ee64..8f0c7c4 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(_0x2a250e,_0x157fb4){var _0x4d7203=function(_0x12df8d){while(--_0x12df8d){_0x2a250e['push'](_0x2a250e['shift']());}};_0x4d7203(++_0x157fb4);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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(_0x522141,_0x55df23){var _0x238e7e=function(_0x2d6c88){while(--_0x2d6c88){_0x522141['push'](_0x522141['shift']());}};_0x238e7e(++_0x55df23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 271a9d0..0061750 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 _0xb19a=['ENUM','newTab','integrationTab','sequelize','STRING'];(function(_0x14bc96,_0x2e656b){var _0x331eb1=function(_0x15e205){while(--_0x15e205){_0x14bc96['push'](_0x14bc96['shift']());}};_0x331eb1(++_0x2e656b);}(_0xb19a,0xd0));var _0xab19=function(_0x44e2ee,_0x10a4fe){_0x44e2ee=_0x44e2ee-0x0;var _0x460ea1=_0xb19a[_0x44e2ee];return _0x460ea1;};'use strict';var Sequelize=require(_0xab19('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xab19('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xab19('0x1')]},'password':{'type':Sequelize[_0xab19('0x1')]},'clientId':{'type':Sequelize[_0xab19('0x1')]},'clientSecret':{'type':Sequelize[_0xab19('0x1')]},'securityToken':{'type':Sequelize[_0xab19('0x1')]},'serverUrl':{'type':Sequelize[_0xab19('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xab19('0x2')]('integrationTab',_0xab19('0x3')),'defaultValue':_0xab19('0x4')}}; \ No newline at end of file +var _0x4efb=['username','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x3f4b55,_0x598de6){var _0xc7cb1a=function(_0x255f5a){while(--_0x255f5a){_0x3f4b55['push'](_0x3f4b55['shift']());}};_0xc7cb1a(++_0x598de6);}(_0x4efb,0xfa));var _0xb4ef=function(_0x3b7c6d,_0x4c6bd6){_0x3b7c6d=_0x3b7c6d-0x0;var _0x1ace06=_0x4efb[_0x3b7c6d];return _0x1ace06;};'use strict';var Sequelize=require('sequelize');module[_0xb4ef('0x0')]={'name':{'type':Sequelize[_0xb4ef('0x1')]},'description':{'type':Sequelize[_0xb4ef('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xb4ef('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb4ef('0x1')]},'clientId':{'type':Sequelize[_0xb4ef('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xb4ef('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb4ef('0x3')](_0xb4ef('0x4'),_0xb4ef('0x5')),'defaultValue':_0xb4ef('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b95d929..e2a418a 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 _0x89c8=['name','send','index','map','SalesforceAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','catch','params','options','create','body','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','sobject','OwnerId','IsRecurrence','Description','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','error','stack'];(function(_0x3882a4,_0x59c6e5){var _0x3acfcb=function(_0x3c706b){while(--_0x3c706b){_0x3882a4['push'](_0x3882a4['shift']());}};_0x3acfcb(++_0x59c6e5);}(_0x89c8,0x13b));var _0x889c=function(_0xb3922a,_0x3a8f83){_0xb3922a=_0xb3922a-0x0;var _0x41baf8=_0x89c8[_0xb3922a];return _0x41baf8;};'use strict';var emlformat=require(_0x889c('0x0'));var rimraf=require(_0x889c('0x1'));var zipdir=require(_0x889c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x889c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x889c('0x4'));var path=require('path');var sox=require(_0x889c('0x5'));var csv=require(_0x889c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x889c('0x7'));var squel=require('squel');var crypto=require(_0x889c('0x8'));var jsforce=require(_0x889c('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x889c('0x6'));var querystring=require(_0x889c('0xa'));var Papa=require(_0x889c('0xb'));var Redis=require(_0x889c('0xc'));var authService=require(_0x889c('0xd'));var qs=require(_0x889c('0xe'));var as=require(_0x889c('0xf'));var hardwareService=require(_0x889c('0x10'));var logger=require(_0x889c('0x11'))(_0x889c('0x12'));var utils=require(_0x889c('0x13'));var config=require(_0x889c('0x14'));var licenseUtil=require(_0x889c('0x15'));var db=require(_0x889c('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e481c,_0x5baa3b){_0x5baa3b=_0x5baa3b||0xcc;return function(_0x49dc06){if(_0x49dc06){return _0x2e481c[_0x889c('0x17')](_0x5baa3b);}return _0x2e481c[_0x889c('0x18')](_0x5baa3b)[_0x889c('0x19')]();};}function respondWithResult(_0x4b405b,_0xe67aea){_0xe67aea=_0xe67aea||0xc8;return function(_0x527a26){if(_0x527a26){return _0x4b405b[_0x889c('0x18')](_0xe67aea)[_0x889c('0x1a')](_0x527a26);}};}function respondWithFilteredResult(_0x5c0be2,_0x4ad316){return function(_0x5db44b){if(_0x5db44b){var _0x35a50b=typeof _0x4ad316[_0x889c('0x1b')]===_0x889c('0x1c')&&typeof _0x4ad316['limit']===_0x889c('0x1c');var _0x2c4f50=_0x5db44b[_0x889c('0x1d')];var _0x38022f=_0x35a50b?0x0:_0x4ad316[_0x889c('0x1b')];var _0x5d8492=_0x35a50b?_0x5db44b[_0x889c('0x1d')]:_0x4ad316[_0x889c('0x1b')]+_0x4ad316[_0x889c('0x1e')];var _0x5918e3;if(_0x5d8492>=_0x2c4f50){_0x5d8492=_0x2c4f50;_0x5918e3=0xc8;}else{_0x5918e3=0xce;}_0x5c0be2[_0x889c('0x18')](_0x5918e3);return _0x5c0be2[_0x889c('0x1f')](_0x889c('0x20'),_0x38022f+'-'+_0x5d8492+'/'+_0x2c4f50)[_0x889c('0x1a')](_0x5db44b);}return null;};}function patchUpdates(_0x2cadda){return function(_0x2f1d2d){try{jsonpatch[_0x889c('0x21')](_0x2f1d2d,_0x2cadda,!![]);}catch(_0x476447){return BPromise['reject'](_0x476447);}return _0x2f1d2d['save']();};}function saveUpdates(_0x6fef11,_0x4f47b9){return function(_0x562c30){if(_0x562c30){return _0x562c30[_0x889c('0x22')](_0x6fef11)['then'](function(_0x329ae1){return _0x329ae1;});}return null;};}function removeEntity(_0x4b4755,_0x5965af){return function(_0x726728){if(_0x726728){return _0x726728[_0x889c('0x23')]()[_0x889c('0x24')](function(){_0x4b4755[_0x889c('0x18')](0xcc)[_0x889c('0x19')]();});}};}function handleEntityNotFound(_0x3958e6,_0x1927d1){return function(_0x9b52fd){if(!_0x9b52fd){_0x3958e6[_0x889c('0x17')](0x194);}return _0x9b52fd;};}function handleError(_0x5d573a,_0x50001b){_0x50001b=_0x50001b||0x1f4;return function(_0x1b5f82){logger[_0x889c('0x25')](_0x1b5f82[_0x889c('0x26')]);if(_0x1b5f82[_0x889c('0x27')]){delete _0x1b5f82[_0x889c('0x27')];}_0x5d573a[_0x889c('0x18')](_0x50001b)[_0x889c('0x28')](_0x1b5f82);};}exports[_0x889c('0x29')]=function(_0xdbf023,_0x5c0376){var _0x4e4f51={},_0x2fe041={},_0x197711={'count':0x0,'rows':[]};var _0x2f3999=_[_0x889c('0x2a')](db[_0x889c('0x2b')][_0x889c('0x2c')],function(_0x76af2){return{'name':_0x76af2['fieldName'],'type':_0x76af2[_0x889c('0x2d')]['key']};});_0x2fe041[_0x889c('0x2e')]=_['map'](_0x2f3999,_0x889c('0x27'));_0x2fe041[_0x889c('0x2f')]=_[_0x889c('0x30')](_0xdbf023[_0x889c('0x2f')]);_0x2fe041[_0x889c('0x31')]=_[_0x889c('0x32')](_0x2fe041['model'],_0x2fe041[_0x889c('0x2f')]);_0x4e4f51[_0x889c('0x33')]=_[_0x889c('0x32')](_0x2fe041['model'],qs[_0x889c('0x34')](_0xdbf023[_0x889c('0x2f')][_0x889c('0x34')]));_0x4e4f51[_0x889c('0x33')]=_0x4e4f51[_0x889c('0x33')][_0x889c('0x35')]?_0x4e4f51[_0x889c('0x33')]:_0x2fe041[_0x889c('0x2e')];if(!_0xdbf023[_0x889c('0x2f')][_0x889c('0x36')](_0x889c('0x37'))){_0x4e4f51[_0x889c('0x1e')]=qs['limit'](_0xdbf023[_0x889c('0x2f')][_0x889c('0x1e')]);_0x4e4f51[_0x889c('0x1b')]=qs[_0x889c('0x1b')](_0xdbf023[_0x889c('0x2f')]['offset']);}_0x4e4f51[_0x889c('0x38')]=qs[_0x889c('0x39')](_0xdbf023[_0x889c('0x2f')][_0x889c('0x39')]);_0x4e4f51[_0x889c('0x3a')]=qs[_0x889c('0x31')](_[_0x889c('0x3b')](_0xdbf023[_0x889c('0x2f')],_0x2fe041[_0x889c('0x31')]),_0x2f3999);if(_0xdbf023['query']['filter']){_0x4e4f51['where']=_['merge'](_0x4e4f51[_0x889c('0x3a')],{'$or':_[_0x889c('0x2a')](_0x2f3999,function(_0x3e56e8){if(_0x3e56e8[_0x889c('0x2d')]!==_0x889c('0x3c')){var _0x24b0a2={};_0x24b0a2[_0x3e56e8[_0x889c('0x27')]]={'$like':'%'+_0xdbf023[_0x889c('0x2f')][_0x889c('0x3d')]+'%'};return _0x24b0a2;}})});}_0x4e4f51=_[_0x889c('0x3e')]({},_0x4e4f51,_0xdbf023['options']);var _0x16c741={'where':_0x4e4f51[_0x889c('0x3a')]};return db[_0x889c('0x2b')][_0x889c('0x1d')](_0x16c741)[_0x889c('0x24')](function(_0x252d4e){_0x197711[_0x889c('0x1d')]=_0x252d4e;if(_0xdbf023[_0x889c('0x2f')]['includeAll']){_0x4e4f51[_0x889c('0x3f')]=[{'all':!![]}];}return db[_0x889c('0x2b')][_0x889c('0x40')](_0x4e4f51);})[_0x889c('0x24')](function(_0x4211a6){_0x197711[_0x889c('0x41')]=_0x4211a6;return _0x197711;})['then'](respondWithFilteredResult(_0x5c0376,_0x4e4f51))[_0x889c('0x42')](handleError(_0x5c0376,null));};exports['show']=function(_0x2aa523,_0x352a65){var _0x5ddc6e={'raw':![],'where':{'id':_0x2aa523[_0x889c('0x43')]['id']}},_0x402664={};_0x402664[_0x889c('0x2e')]=_[_0x889c('0x30')](db[_0x889c('0x2b')]['rawAttributes']);_0x402664[_0x889c('0x2f')]=_[_0x889c('0x30')](_0x2aa523[_0x889c('0x2f')]);_0x402664['filters']=_[_0x889c('0x32')](_0x402664[_0x889c('0x2e')],_0x402664[_0x889c('0x2f')]);_0x5ddc6e[_0x889c('0x33')]=_[_0x889c('0x32')](_0x402664[_0x889c('0x2e')],qs['fields'](_0x2aa523[_0x889c('0x2f')]['fields']));_0x5ddc6e['attributes']=_0x5ddc6e[_0x889c('0x33')]['length']?_0x5ddc6e['attributes']:_0x402664[_0x889c('0x2e')];if(_0x2aa523[_0x889c('0x2f')]['includeAll']){_0x5ddc6e[_0x889c('0x3f')]=[{'all':!![]}];}_0x5ddc6e=_[_0x889c('0x3e')]({},_0x5ddc6e,_0x2aa523[_0x889c('0x44')]);return db[_0x889c('0x2b')]['find'](_0x5ddc6e)[_0x889c('0x24')](handleEntityNotFound(_0x352a65,null))[_0x889c('0x24')](respondWithResult(_0x352a65,null))['catch'](handleError(_0x352a65,null));};exports[_0x889c('0x45')]=function(_0x3f01a8,_0x12c60f){return db[_0x889c('0x2b')][_0x889c('0x45')](_0x3f01a8['body'],{})[_0x889c('0x24')](respondWithResult(_0x12c60f,0xc9))[_0x889c('0x42')](handleError(_0x12c60f,null));};exports[_0x889c('0x22')]=function(_0x117c39,_0x53b8b5){if(_0x117c39['body']['id']){delete _0x117c39[_0x889c('0x46')]['id'];}return db[_0x889c('0x2b')]['find']({'where':{'id':_0x117c39[_0x889c('0x43')]['id']}})[_0x889c('0x24')](handleEntityNotFound(_0x53b8b5,null))[_0x889c('0x24')](saveUpdates(_0x117c39[_0x889c('0x46')],null))[_0x889c('0x24')](respondWithResult(_0x53b8b5,null))[_0x889c('0x42')](handleError(_0x53b8b5,null));};exports[_0x889c('0x23')]=function(_0xd46403,_0x578088){return db[_0x889c('0x2b')][_0x889c('0x47')]({'where':{'id':_0xd46403[_0x889c('0x43')]['id']}})[_0x889c('0x24')](handleEntityNotFound(_0x578088,null))[_0x889c('0x24')](removeEntity(_0x578088,null))[_0x889c('0x42')](handleError(_0x578088,null));};exports[_0x889c('0x48')]=function(_0x4396a5,_0x663803,_0x5df69f){var _0x48de1c={};var _0x1ef329={};var _0x4bbaa8;var _0x2aa253;return db[_0x889c('0x2b')][_0x889c('0x49')]({'where':{'id':_0x4396a5['params']['id']}})[_0x889c('0x24')](handleEntityNotFound(_0x663803,null))[_0x889c('0x24')](function(_0x383667){if(_0x383667){_0x4bbaa8=_0x383667;_0x1ef329[_0x889c('0x2e')]=_['keys'](db[_0x889c('0x4a')][_0x889c('0x2c')]);_0x1ef329[_0x889c('0x2f')]=_['keys'](_0x4396a5[_0x889c('0x2f')]);_0x1ef329[_0x889c('0x31')]=_[_0x889c('0x32')](_0x1ef329[_0x889c('0x2e')],_0x1ef329['query']);_0x48de1c[_0x889c('0x33')]=_[_0x889c('0x32')](_0x1ef329[_0x889c('0x2e')],qs[_0x889c('0x34')](_0x4396a5[_0x889c('0x2f')][_0x889c('0x34')]));_0x48de1c[_0x889c('0x33')]=_0x48de1c[_0x889c('0x33')][_0x889c('0x35')]?_0x48de1c['attributes']:_0x1ef329[_0x889c('0x2e')];_0x48de1c[_0x889c('0x38')]=qs[_0x889c('0x39')](_0x4396a5[_0x889c('0x2f')]['sort']);_0x48de1c[_0x889c('0x3a')]=qs[_0x889c('0x31')](_[_0x889c('0x3b')](_0x4396a5['query'],_0x1ef329[_0x889c('0x31')]));if(_0x4396a5[_0x889c('0x2f')][_0x889c('0x3d')]){_0x48de1c[_0x889c('0x3a')]=_[_0x889c('0x3e')](_0x48de1c[_0x889c('0x3a')],{'$or':_[_0x889c('0x2a')](_0x48de1c[_0x889c('0x33')],function(_0x2f13ea){var _0x13c7d0={};_0x13c7d0[_0x2f13ea]={'$like':'%'+_0x4396a5[_0x889c('0x2f')]['filter']+'%'};return _0x13c7d0;})});}_0x48de1c=_[_0x889c('0x3e')]({},_0x48de1c,_0x4396a5[_0x889c('0x44')]);return _0x4bbaa8[_0x889c('0x48')](_0x48de1c);}})[_0x889c('0x24')](function(_0x3c3e9f){if(_0x3c3e9f){_0x2aa253=_0x3c3e9f[_0x889c('0x35')];if(!_0x4396a5[_0x889c('0x2f')][_0x889c('0x36')](_0x889c('0x37'))){_0x48de1c['limit']=qs[_0x889c('0x1e')](_0x4396a5[_0x889c('0x2f')][_0x889c('0x1e')]);_0x48de1c[_0x889c('0x1b')]=qs[_0x889c('0x1b')](_0x4396a5[_0x889c('0x2f')]['offset']);}return _0x4bbaa8[_0x889c('0x48')](_0x48de1c);}})['then'](function(_0x23e382){if(_0x23e382){return _0x23e382?{'count':_0x2aa253,'rows':_0x23e382}:null;}})[_0x889c('0x24')](respondWithResult(_0x663803,null))[_0x889c('0x42')](handleError(_0x663803,null));};exports[_0x889c('0x4b')]=function(_0x23d507,_0x33b33f,_0x4a5b3){if(_0x23d507[_0x889c('0x46')]['id']){delete _0x23d507[_0x889c('0x46')]['id'];}return db[_0x889c('0x2b')]['findOne']({'where':{'id':_0x23d507['params']['id']}})[_0x889c('0x24')](handleEntityNotFound(_0x33b33f,null))[_0x889c('0x24')](function(_0x587445){if(_0x587445){_0x23d507[_0x889c('0x46')]['AccountId']=_0x587445['id'];_0x23d507[_0x889c('0x46')]['Subjects']=integrations[_0x889c('0x4c')](_0x23d507[_0x889c('0x46')][_0x889c('0x4d')],_0x23d507[_0x889c('0x46')][_0x889c('0x2d')]);_0x23d507[_0x889c('0x46')][_0x889c('0x4e')]=integrations[_0x889c('0x4f')](_0x23d507['body'][_0x889c('0x4d')],_0x23d507[_0x889c('0x46')]['type']);return db['SalesforceConfiguration'][_0x889c('0x45')](_0x23d507['body'],{'include':[{'model':db['SalesforceField'],'as':_0x889c('0x50')},{'model':db[_0x889c('0x51')],'as':_0x889c('0x4e')}]});}return null;})[_0x889c('0x24')](respondWithResult(_0x33b33f,null))[_0x889c('0x42')](handleError(_0x33b33f,null));};exports[_0x889c('0x52')]=function(_0x5c6e04,_0x1b8cc1,_0x5519d6){var _0x559fbd;var _0x59cc69='';var _0x2374a3=_0x889c('0x53');return db[_0x889c('0x2b')]['findOne']({'where':{'id':_0x5c6e04[_0x889c('0x43')]['id']},'attributes':['id',_0x889c('0x54'),_0x889c('0x55'),_0x889c('0x56'),_0x889c('0x57'),_0x889c('0x58'),_0x889c('0x59')]})[_0x889c('0x24')](handleEntityNotFound(_0x1b8cc1,null))[_0x889c('0x24')](function(_0x33a9e7){if(_0x33a9e7){_0x59cc69=_0x33a9e7[_0x889c('0x54')];var _0x9861ab=_0x59cc69[_0x889c('0x5a')](-0x1);if(_0x9861ab==='/'){_0x59cc69=_0x59cc69[_0x889c('0x5b')](0x0,_0x59cc69[_0x889c('0x5c')](_0x9861ab));}_0x559fbd=new jsforce['Connection']({'oauth2':{'loginUrl':_0x59cc69,'clientId':_0x33a9e7[_0x889c('0x55')],'clientSecret':_0x33a9e7[_0x889c('0x56')]}});return _0x559fbd[_0x889c('0x5d')](_0x33a9e7['username'],_0x33a9e7[_0x889c('0x58')][_0x889c('0x5e')](_0x33a9e7['securityToken']));}})['then'](function(_0x57f228){if(_0x57f228){if(!_[_0x889c('0x5f')](_0x5c6e04['query'][_0x889c('0x60')])){_0x2374a3=_0x5c6e04['query'][_0x889c('0x60')];}return _0x559fbd[_0x889c('0x61')](_0x2374a3)['describe']();}})[_0x889c('0x24')](function(_0x40d05b){var _0x45f2fe=[_0x889c('0x62'),'ActivityDate','IsReminderSet',_0x889c('0x63'),'Subject',_0x889c('0x64')];var _0x52dde5=['string','int',_0x889c('0x65'),_0x889c('0x66'),_0x889c('0x67'),_0x889c('0x68'),_0x889c('0x69')];if(_0x40d05b){_['remove'](_0x40d05b[_0x889c('0x34')],function(_0x34fbb1){return _0x45f2fe[_0x889c('0x6a')](_0x34fbb1[_0x889c('0x27')])||!_0x52dde5[_0x889c('0x6a')](_0x34fbb1[_0x889c('0x2d')]);});return{'count':_0x40d05b[_0x889c('0x34')][_0x889c('0x35')],'rows':_['map'](_0x40d05b['fields'],function(_0x2af10b){return{'id':_0x2af10b['name'],'name':_0x2af10b[_0x889c('0x6b')],'custom':_0x2af10b[_0x889c('0x6c')],'options':_0x2af10b[_0x889c('0x6d')][_0x889c('0x35')]>0x0?_[_0x889c('0x2a')](_0x2af10b[_0x889c('0x6d')],function(_0x2110ed){return{'name':_0x2110ed[_0x889c('0x6b')],'value':_0x2110ed[_0x889c('0x6e')]};}):_0x2af10b[_0x889c('0x2d')]==_0x889c('0x66')?[{'name':'True','value':_0x889c('0x6f')},{'name':_0x889c('0x70'),'value':'false'}]:[]};})};}})[_0x889c('0x24')](respondWithResult(_0x1b8cc1,null))[_0x889c('0x42')](function(_0x5e95a4){var _0xcf97f3=_0x5c6e04[_0x889c('0x2f')][_0x889c('0x71')]?0x1f4:_0x5e95a4[_0x889c('0x72')]||0x1f4;logger[_0x889c('0x25')](_0x889c('0x73'),_0x889c('0x52'),_0xcf97f3,JSON[_0x889c('0x74')](_0x5e95a4));delete _0x5e95a4['name'];if(_0xcf97f3===0x191){_0xcf97f3=0x190;}_0x1b8cc1[_0x889c('0x18')](_0xcf97f3)[_0x889c('0x28')](_0x5c6e04['query']['test']?{'message':_0x889c('0x75'),'statusCode':_0x5e95a4[_0x889c('0x72')]}:_0x5e95a4);});}; \ No newline at end of file +var _0x2812=['catch','params','find','create','body','getConfigurations','order','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x2812,0xb7));var _0x2281=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0x2812[_0x337748];return _0x3bb03f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2281('0x0'));var zipdir=require(_0x2281('0x1'));var jsonpatch=require(_0x2281('0x2'));var rp=require(_0x2281('0x3'));var moment=require(_0x2281('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2281('0x5'));var util=require(_0x2281('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2281('0x7'));var ejs=require(_0x2281('0x8'));var fs=require('fs');var fs_extra=require(_0x2281('0x9'));var _=require(_0x2281('0xa'));var squel=require(_0x2281('0xb'));var crypto=require('crypto');var jsforce=require(_0x2281('0xc'));var deskjs=require(_0x2281('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2281('0xe'));var Redis=require('ioredis');var authService=require(_0x2281('0xf'));var qs=require(_0x2281('0x10'));var as=require(_0x2281('0x11'));var hardwareService=require(_0x2281('0x12'));var logger=require(_0x2281('0x13'))(_0x2281('0x14'));var utils=require('../../config/utils');var config=require(_0x2281('0x15'));var licenseUtil=require(_0x2281('0x16'));var db=require(_0x2281('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x166766,_0x237c46){_0x237c46=_0x237c46||0xcc;return function(_0xf49abd){if(_0xf49abd){return _0x166766['sendStatus'](_0x237c46);}return _0x166766[_0x2281('0x18')](_0x237c46)[_0x2281('0x19')]();};}function respondWithResult(_0x2d3332,_0x297f8a){_0x297f8a=_0x297f8a||0xc8;return function(_0x3f7557){if(_0x3f7557){return _0x2d3332[_0x2281('0x18')](_0x297f8a)[_0x2281('0x1a')](_0x3f7557);}};}function respondWithFilteredResult(_0x41ecda,_0x4eaac5){return function(_0x46eca4){if(_0x46eca4){var _0x1d119b=typeof _0x4eaac5['offset']===_0x2281('0x1b')&&typeof _0x4eaac5['limit']===_0x2281('0x1b');var _0x39c9ee=_0x46eca4[_0x2281('0x1c')];var _0x24ceae=_0x1d119b?0x0:_0x4eaac5[_0x2281('0x1d')];var _0x39c7d1=_0x1d119b?_0x46eca4[_0x2281('0x1c')]:_0x4eaac5['offset']+_0x4eaac5[_0x2281('0x1e')];var _0x32b35f;if(_0x39c7d1>=_0x39c9ee){_0x39c7d1=_0x39c9ee;_0x32b35f=0xc8;}else{_0x32b35f=0xce;}_0x41ecda[_0x2281('0x18')](_0x32b35f);return _0x41ecda['set']('Content-Range',_0x24ceae+'-'+_0x39c7d1+'/'+_0x39c9ee)['json'](_0x46eca4);}return null;};}function patchUpdates(_0x1e4f6d){return function(_0x117e94){try{jsonpatch[_0x2281('0x1f')](_0x117e94,_0x1e4f6d,!![]);}catch(_0x25be24){return BPromise[_0x2281('0x20')](_0x25be24);}return _0x117e94[_0x2281('0x21')]();};}function saveUpdates(_0x25d7d9,_0x4248d4){return function(_0x582e7a){if(_0x582e7a){return _0x582e7a[_0x2281('0x22')](_0x25d7d9)['then'](function(_0x3bedcf){return _0x3bedcf;});}return null;};}function removeEntity(_0x40cf6f,_0x3c92bd){return function(_0x1315f1){if(_0x1315f1){return _0x1315f1[_0x2281('0x23')]()[_0x2281('0x24')](function(){_0x40cf6f[_0x2281('0x18')](0xcc)[_0x2281('0x19')]();});}};}function handleEntityNotFound(_0x22886e,_0x4c41b0){return function(_0x26ba3d){if(!_0x26ba3d){_0x22886e[_0x2281('0x25')](0x194);}return _0x26ba3d;};}function handleError(_0x822f3d,_0xd2f351){_0xd2f351=_0xd2f351||0x1f4;return function(_0x18de72){logger[_0x2281('0x26')](_0x18de72[_0x2281('0x27')]);if(_0x18de72['name']){delete _0x18de72[_0x2281('0x28')];}_0x822f3d[_0x2281('0x18')](_0xd2f351)[_0x2281('0x29')](_0x18de72);};}exports['index']=function(_0x5d5f73,_0x547f4d){var _0xd9b12e={},_0xd568cf={},_0x478edf={'count':0x0,'rows':[]};var _0x215d78=_[_0x2281('0x2a')](db[_0x2281('0x2b')][_0x2281('0x2c')],function(_0x162626){return{'name':_0x162626[_0x2281('0x2d')],'type':_0x162626[_0x2281('0x2e')][_0x2281('0x2f')]};});_0xd568cf[_0x2281('0x30')]=_['map'](_0x215d78,_0x2281('0x28'));_0xd568cf[_0x2281('0x31')]=_[_0x2281('0x32')](_0x5d5f73[_0x2281('0x31')]);_0xd568cf[_0x2281('0x33')]=_[_0x2281('0x34')](_0xd568cf['model'],_0xd568cf[_0x2281('0x31')]);_0xd9b12e['attributes']=_[_0x2281('0x34')](_0xd568cf[_0x2281('0x30')],qs['fields'](_0x5d5f73[_0x2281('0x31')][_0x2281('0x35')]));_0xd9b12e[_0x2281('0x36')]=_0xd9b12e[_0x2281('0x36')][_0x2281('0x37')]?_0xd9b12e[_0x2281('0x36')]:_0xd568cf['model'];if(!_0x5d5f73[_0x2281('0x31')][_0x2281('0x38')](_0x2281('0x39'))){_0xd9b12e[_0x2281('0x1e')]=qs[_0x2281('0x1e')](_0x5d5f73[_0x2281('0x31')]['limit']);_0xd9b12e['offset']=qs[_0x2281('0x1d')](_0x5d5f73['query'][_0x2281('0x1d')]);}_0xd9b12e['order']=qs[_0x2281('0x3a')](_0x5d5f73[_0x2281('0x31')][_0x2281('0x3a')]);_0xd9b12e[_0x2281('0x3b')]=qs['filters'](_[_0x2281('0x3c')](_0x5d5f73['query'],_0xd568cf[_0x2281('0x33')]),_0x215d78);if(_0x5d5f73[_0x2281('0x31')][_0x2281('0x3d')]){_0xd9b12e['where']=_[_0x2281('0x3e')](_0xd9b12e[_0x2281('0x3b')],{'$or':_[_0x2281('0x2a')](_0x215d78,function(_0x116a24){if(_0x116a24[_0x2281('0x2e')]!==_0x2281('0x3f')){var _0x17773d={};_0x17773d[_0x116a24[_0x2281('0x28')]]={'$like':'%'+_0x5d5f73[_0x2281('0x31')]['filter']+'%'};return _0x17773d;}})});}_0xd9b12e=_[_0x2281('0x3e')]({},_0xd9b12e,_0x5d5f73[_0x2281('0x40')]);var _0x12db40={'where':_0xd9b12e['where']};return db[_0x2281('0x2b')][_0x2281('0x1c')](_0x12db40)[_0x2281('0x24')](function(_0x5047cd){_0x478edf['count']=_0x5047cd;if(_0x5d5f73[_0x2281('0x31')][_0x2281('0x41')]){_0xd9b12e[_0x2281('0x42')]=[{'all':!![]}];}return db[_0x2281('0x2b')][_0x2281('0x43')](_0xd9b12e);})['then'](function(_0x293b69){_0x478edf[_0x2281('0x44')]=_0x293b69;return _0x478edf;})['then'](respondWithFilteredResult(_0x547f4d,_0xd9b12e))[_0x2281('0x45')](handleError(_0x547f4d,null));};exports['show']=function(_0x263340,_0x44c2da){var _0x32b3d0={'raw':![],'where':{'id':_0x263340[_0x2281('0x46')]['id']}},_0x1ab6a2={};_0x1ab6a2['model']=_[_0x2281('0x32')](db['SalesforceAccount'][_0x2281('0x2c')]);_0x1ab6a2[_0x2281('0x31')]=_[_0x2281('0x32')](_0x263340[_0x2281('0x31')]);_0x1ab6a2[_0x2281('0x33')]=_[_0x2281('0x34')](_0x1ab6a2[_0x2281('0x30')],_0x1ab6a2[_0x2281('0x31')]);_0x32b3d0[_0x2281('0x36')]=_[_0x2281('0x34')](_0x1ab6a2[_0x2281('0x30')],qs['fields'](_0x263340['query']['fields']));_0x32b3d0[_0x2281('0x36')]=_0x32b3d0['attributes'][_0x2281('0x37')]?_0x32b3d0[_0x2281('0x36')]:_0x1ab6a2['model'];if(_0x263340['query'][_0x2281('0x41')]){_0x32b3d0[_0x2281('0x42')]=[{'all':!![]}];}_0x32b3d0=_['merge']({},_0x32b3d0,_0x263340[_0x2281('0x40')]);return db['SalesforceAccount'][_0x2281('0x47')](_0x32b3d0)['then'](handleEntityNotFound(_0x44c2da,null))[_0x2281('0x24')](respondWithResult(_0x44c2da,null))[_0x2281('0x45')](handleError(_0x44c2da,null));};exports[_0x2281('0x48')]=function(_0x4ae6ca,_0x3c836e){return db[_0x2281('0x2b')][_0x2281('0x48')](_0x4ae6ca[_0x2281('0x49')],{})[_0x2281('0x24')](respondWithResult(_0x3c836e,0xc9))[_0x2281('0x45')](handleError(_0x3c836e,null));};exports['update']=function(_0x2698ba,_0x5d5712){if(_0x2698ba[_0x2281('0x49')]['id']){delete _0x2698ba[_0x2281('0x49')]['id'];}return db[_0x2281('0x2b')][_0x2281('0x47')]({'where':{'id':_0x2698ba[_0x2281('0x46')]['id']}})[_0x2281('0x24')](handleEntityNotFound(_0x5d5712,null))[_0x2281('0x24')](saveUpdates(_0x2698ba[_0x2281('0x49')],null))[_0x2281('0x24')](respondWithResult(_0x5d5712,null))[_0x2281('0x45')](handleError(_0x5d5712,null));};exports[_0x2281('0x23')]=function(_0x19d162,_0x478cc8){return db[_0x2281('0x2b')][_0x2281('0x47')]({'where':{'id':_0x19d162[_0x2281('0x46')]['id']}})[_0x2281('0x24')](handleEntityNotFound(_0x478cc8,null))[_0x2281('0x24')](removeEntity(_0x478cc8,null))[_0x2281('0x45')](handleError(_0x478cc8,null));};exports[_0x2281('0x4a')]=function(_0x216ae8,_0x3899d8,_0x2dd912){var _0x16a473={};var _0x4108b6={};var _0x13d2fd;var _0x2b0678;return db[_0x2281('0x2b')]['findOne']({'where':{'id':_0x216ae8[_0x2281('0x46')]['id']}})[_0x2281('0x24')](handleEntityNotFound(_0x3899d8,null))[_0x2281('0x24')](function(_0x3d2eb5){if(_0x3d2eb5){_0x13d2fd=_0x3d2eb5;_0x4108b6[_0x2281('0x30')]=_['keys'](db['SalesforceConfiguration'][_0x2281('0x2c')]);_0x4108b6['query']=_[_0x2281('0x32')](_0x216ae8[_0x2281('0x31')]);_0x4108b6[_0x2281('0x33')]=_[_0x2281('0x34')](_0x4108b6[_0x2281('0x30')],_0x4108b6[_0x2281('0x31')]);_0x16a473[_0x2281('0x36')]=_[_0x2281('0x34')](_0x4108b6[_0x2281('0x30')],qs['fields'](_0x216ae8[_0x2281('0x31')][_0x2281('0x35')]));_0x16a473['attributes']=_0x16a473[_0x2281('0x36')][_0x2281('0x37')]?_0x16a473[_0x2281('0x36')]:_0x4108b6[_0x2281('0x30')];_0x16a473[_0x2281('0x4b')]=qs[_0x2281('0x3a')](_0x216ae8[_0x2281('0x31')][_0x2281('0x3a')]);_0x16a473['where']=qs['filters'](_['pick'](_0x216ae8[_0x2281('0x31')],_0x4108b6['filters']));if(_0x216ae8[_0x2281('0x31')][_0x2281('0x3d')]){_0x16a473[_0x2281('0x3b')]=_[_0x2281('0x3e')](_0x16a473[_0x2281('0x3b')],{'$or':_[_0x2281('0x2a')](_0x16a473[_0x2281('0x36')],function(_0x117408){var _0x335c7f={};_0x335c7f[_0x117408]={'$like':'%'+_0x216ae8[_0x2281('0x31')][_0x2281('0x3d')]+'%'};return _0x335c7f;})});}_0x16a473=_[_0x2281('0x3e')]({},_0x16a473,_0x216ae8[_0x2281('0x40')]);return _0x13d2fd[_0x2281('0x4a')](_0x16a473);}})[_0x2281('0x24')](function(_0x351815){if(_0x351815){_0x2b0678=_0x351815[_0x2281('0x37')];if(!_0x216ae8['query'][_0x2281('0x38')](_0x2281('0x39'))){_0x16a473[_0x2281('0x1e')]=qs['limit'](_0x216ae8[_0x2281('0x31')]['limit']);_0x16a473[_0x2281('0x1d')]=qs['offset'](_0x216ae8[_0x2281('0x31')]['offset']);}return _0x13d2fd[_0x2281('0x4a')](_0x16a473);}})[_0x2281('0x24')](function(_0x342684){if(_0x342684){return _0x342684?{'count':_0x2b0678,'rows':_0x342684}:null;}})[_0x2281('0x24')](respondWithResult(_0x3899d8,null))[_0x2281('0x45')](handleError(_0x3899d8,null));};exports[_0x2281('0x4c')]=function(_0x81b44e,_0x3a852d,_0x6177de){if(_0x81b44e['body']['id']){delete _0x81b44e['body']['id'];}return db[_0x2281('0x2b')][_0x2281('0x4d')]({'where':{'id':_0x81b44e[_0x2281('0x46')]['id']}})[_0x2281('0x24')](handleEntityNotFound(_0x3a852d,null))[_0x2281('0x24')](function(_0x1ef25c){if(_0x1ef25c){_0x81b44e[_0x2281('0x49')]['AccountId']=_0x1ef25c['id'];_0x81b44e[_0x2281('0x49')][_0x2281('0x4e')]=integrations[_0x2281('0x4f')](_0x81b44e[_0x2281('0x49')][_0x2281('0x50')],_0x81b44e['body']['type']);_0x81b44e[_0x2281('0x49')][_0x2281('0x51')]=integrations[_0x2281('0x52')](_0x81b44e[_0x2281('0x49')]['channel'],_0x81b44e[_0x2281('0x49')][_0x2281('0x2e')]);return db[_0x2281('0x53')][_0x2281('0x48')](_0x81b44e[_0x2281('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0x2281('0x4e')},{'model':db[_0x2281('0x54')],'as':'Descriptions'}]});}return null;})[_0x2281('0x24')](respondWithResult(_0x3a852d,null))[_0x2281('0x45')](handleError(_0x3a852d,null));};exports[_0x2281('0x55')]=function(_0x4662b6,_0x5ddec3,_0x513eb2){var _0x1b17f4;var _0x3c8aeb='';var _0x1f01a5=_0x2281('0x56');return db[_0x2281('0x2b')][_0x2281('0x4d')]({'where':{'id':_0x4662b6['params']['id']},'attributes':['id',_0x2281('0x57'),_0x2281('0x58'),_0x2281('0x59'),_0x2281('0x5a'),_0x2281('0x5b'),_0x2281('0x5c')]})[_0x2281('0x24')](handleEntityNotFound(_0x5ddec3,null))[_0x2281('0x24')](function(_0xa2caba){if(_0xa2caba){_0x3c8aeb=_0xa2caba[_0x2281('0x57')];var _0x25a796=_0x3c8aeb[_0x2281('0x5d')](-0x1);if(_0x25a796==='/'){_0x3c8aeb=_0x3c8aeb[_0x2281('0x5e')](0x0,_0x3c8aeb['lastIndexOf'](_0x25a796));}_0x1b17f4=new jsforce[(_0x2281('0x5f'))]({'oauth2':{'loginUrl':_0x3c8aeb,'clientId':_0xa2caba[_0x2281('0x58')],'clientSecret':_0xa2caba['clientSecret']}});return _0x1b17f4[_0x2281('0x60')](_0xa2caba[_0x2281('0x5a')],_0xa2caba[_0x2281('0x5b')][_0x2281('0x61')](_0xa2caba['securityToken']));}})[_0x2281('0x24')](function(_0x1af99e){if(_0x1af99e){if(!_[_0x2281('0x62')](_0x4662b6['query'][_0x2281('0x63')])){_0x1f01a5=_0x4662b6[_0x2281('0x31')]['ticketType'];}return _0x1b17f4[_0x2281('0x64')](_0x1f01a5)[_0x2281('0x65')]();}})[_0x2281('0x24')](function(_0x4ee059){var _0x1608a6=[_0x2281('0x66'),_0x2281('0x67'),_0x2281('0x68'),_0x2281('0x69'),_0x2281('0x6a'),_0x2281('0x6b')];var _0x24d45c=[_0x2281('0x6c'),'int','picklist',_0x2281('0x6d'),_0x2281('0x6e'),_0x2281('0x6f'),_0x2281('0x70')];if(_0x4ee059){_[_0x2281('0x71')](_0x4ee059[_0x2281('0x35')],function(_0x5d5abf){return _0x1608a6['includes'](_0x5d5abf[_0x2281('0x28')])||!_0x24d45c[_0x2281('0x72')](_0x5d5abf[_0x2281('0x2e')]);});return{'count':_0x4ee059[_0x2281('0x35')][_0x2281('0x37')],'rows':_[_0x2281('0x2a')](_0x4ee059['fields'],function(_0x3ae4b4){return{'id':_0x3ae4b4[_0x2281('0x28')],'name':_0x3ae4b4[_0x2281('0x73')],'custom':_0x3ae4b4[_0x2281('0x74')],'options':_0x3ae4b4['picklistValues'][_0x2281('0x37')]>0x0?_[_0x2281('0x2a')](_0x3ae4b4[_0x2281('0x75')],function(_0x56c028){return{'name':_0x56c028[_0x2281('0x73')],'value':_0x56c028[_0x2281('0x76')]};}):_0x3ae4b4[_0x2281('0x2e')]==_0x2281('0x6d')?[{'name':'True','value':_0x2281('0x77')},{'name':'False','value':_0x2281('0x78')}]:[]};})};}})[_0x2281('0x24')](respondWithResult(_0x5ddec3,null))[_0x2281('0x45')](function(_0x3da9c4){var _0xd84b1a=_0x4662b6[_0x2281('0x31')][_0x2281('0x79')]?0x1f4:_0x3da9c4[_0x2281('0x7a')]||0x1f4;logger[_0x2281('0x26')](_0x2281('0x7b'),_0x2281('0x55'),_0xd84b1a,JSON[_0x2281('0x7c')](_0x3da9c4));delete _0x3da9c4['name'];if(_0xd84b1a===0x191){_0xd84b1a=0x190;}_0x5ddec3[_0x2281('0x18')](_0xd84b1a)['send'](_0x4662b6[_0x2281('0x31')][_0x2281('0x79')]?{'message':_0x2281('0x7d'),'statusCode':_0x3da9c4[_0x2281('0x7a')]}:_0x3da9c4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d921d0a..ae3853e 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 _0x75b5=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x234f7f,_0x1ea380){var _0x430416=function(_0x24cb4c){while(--_0x24cb4c){_0x234f7f['push'](_0x234f7f['shift']());}};_0x430416(++_0x1ea380);}(_0x75b5,0x1c7));var _0x575b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x75b5[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x575b('0x0'));var util=require('util');var logger=require(_0x575b('0x1'))(_0x575b('0x2'));var moment=require('moment');var BPromise=require(_0x575b('0x3'));var rp=require(_0x575b('0x4'));var fs=require('fs');var path=require(_0x575b('0x5'));var rimraf=require(_0x575b('0x6'));var config=require(_0x575b('0x7'));var attributes=require(_0x575b('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x575b('0x9')]=function(_0x2c79d0,_0x4dd1a9){return _0x2c79d0[_0x575b('0xa')](_0x575b('0xb'),attributes,{'tableName':_0x575b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cc3=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','lodash','api'];(function(_0x390e55,_0xd2a8d9){var _0x420578=function(_0x15cdb4){while(--_0x15cdb4){_0x390e55['push'](_0x390e55['shift']());}};_0x420578(++_0xd2a8d9);}(_0x0cc3,0x195));var _0x30cc=function(_0x4f705c,_0x31e403){_0x4f705c=_0x4f705c-0x0;var _0x506455=_0x0cc3[_0x4f705c];return _0x506455;};'use strict';var _=require(_0x30cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30cc('0x1'));var moment=require('moment');var BPromise=require(_0x30cc('0x2'));var rp=require(_0x30cc('0x3'));var fs=require('fs');var path=require(_0x30cc('0x4'));var rimraf=require(_0x30cc('0x5'));var config=require(_0x30cc('0x6'));var attributes=require(_0x30cc('0x7'));var integrations=require(_0x30cc('0x8'));module['exports']=function(_0x255ccf,_0x105406){return _0x255ccf[_0x30cc('0x9')](_0x30cc('0xa'),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 9a44d63..057381f 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 _0x517b=['client','request','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','options','raw','where','map','include','attributes','model','then','GetSalesforceAccount','ShowSalesforceAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x517b,0xff));var _0xb517=function(_0x182227,_0x220533){_0x182227=_0x182227-0x0;var _0x1d0370=_0x517b[_0x182227];return _0x1d0370;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb517('0x0'));var BPromise=require(_0xb517('0x1'));var rs=require(_0xb517('0x2'));var fs=require('fs');var Redis=require(_0xb517('0x3'));var db=require(_0xb517('0x4'))['db'];var utils=require(_0xb517('0x5'));var logger=require(_0xb517('0x6'))(_0xb517('0x7'));var config=require('../../config/environment');var jayson=require(_0xb517('0x8'));var client=jayson[_0xb517('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe41f15,_0x4f55f7,_0x80ef50){return new BPromise(function(_0x3678f9,_0x23f9e8){return client[_0xb517('0xa')](_0xe41f15,_0x80ef50)['then'](function(_0xafd8f7){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4f55f7,_0xb517('0xb'));logger[_0xb517('0xc')](_0xb517('0xd'),_0x4f55f7,_0xb517('0xb'),JSON[_0xb517('0xe')](_0xafd8f7));if(_0xafd8f7[_0xb517('0xf')]){if(_0xafd8f7[_0xb517('0xf')][_0xb517('0x10')]===0x1f4){logger['error'](_0xb517('0x11'),_0x4f55f7,_0xafd8f7[_0xb517('0xf')][_0xb517('0x12')]);return _0x23f9e8(_0xafd8f7[_0xb517('0xf')][_0xb517('0x12')]);}logger[_0xb517('0xf')](_0xb517('0x11'),_0x4f55f7,_0xafd8f7[_0xb517('0xf')][_0xb517('0x12')]);return _0x3678f9(_0xafd8f7[_0xb517('0xf')][_0xb517('0x12')]);}else{logger[_0xb517('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x4f55f7,_0xb517('0xb'));_0x3678f9(_0xafd8f7[_0xb517('0x14')][_0xb517('0x12')]);}})[_0xb517('0x15')](function(_0x7e93db){logger[_0xb517('0xf')](_0xb517('0x11'),_0x4f55f7,_0x7e93db);_0x23f9e8(_0x7e93db);});});}exports['GetSalesforceAccount']=function(_0x229adc){var _0x38de0e=this;return new Promise(function(_0x30e603,_0x3ef0cf){return db['SalesforceAccount']['findAll']({'raw':_0x229adc[_0xb517('0x16')]?_0x229adc['options'][_0xb517('0x17')]===undefined?!![]:![]:!![],'where':_0x229adc[_0xb517('0x16')]?_0x229adc['options'][_0xb517('0x18')]||null:null,'attributes':_0x229adc[_0xb517('0x16')]?_0x229adc[_0xb517('0x16')]['attributes']||null:null,'limit':_0x229adc[_0xb517('0x16')]?_0x229adc[_0xb517('0x16')]['limit']||null:null,'include':_0x229adc[_0xb517('0x16')]?_0x229adc[_0xb517('0x16')]['include']?_[_0xb517('0x19')](_0x229adc['options'][_0xb517('0x1a')],function(_0x8dfcda){return{'model':db[_0x8dfcda['model']],'as':_0x8dfcda['as'],'attributes':_0x8dfcda[_0xb517('0x1b')],'include':_0x8dfcda[_0xb517('0x1a')]?_['map'](_0x8dfcda['include'],function(_0x529cc9){return{'model':db[_0x529cc9[_0xb517('0x1c')]],'as':_0x529cc9['as'],'attributes':_0x529cc9['attributes'],'include':_0x529cc9[_0xb517('0x1a')]?_[_0xb517('0x19')](_0x529cc9[_0xb517('0x1a')],function(_0x4f7f53){return{'model':db[_0x4f7f53['model']],'as':_0x4f7f53['as'],'attributes':_0x4f7f53[_0xb517('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb517('0x1d')](function(_0x57e30a){logger[_0xb517('0x13')](_0xb517('0x1e'),_0x229adc);logger[_0xb517('0xc')](_0xb517('0x1e'),_0x229adc,JSON[_0xb517('0xe')](_0x57e30a));_0x30e603(_0x57e30a);})[_0xb517('0x15')](function(_0xfd2e89){logger[_0xb517('0xf')](_0xb517('0x1e'),_0xfd2e89[_0xb517('0x12')],_0x229adc);_0x3ef0cf(_0x38de0e[_0xb517('0xf')](0x1f4,_0xfd2e89[_0xb517('0x12')]));});});};exports[_0xb517('0x1f')]=function(_0xc467dd){var _0x48777e=this;return new Promise(function(_0x42e78f,_0x2c548e){return db['SalesforceAccount'][_0xb517('0x20')]({'raw':_0xc467dd[_0xb517('0x16')]?_0xc467dd[_0xb517('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc467dd[_0xb517('0x16')]?_0xc467dd[_0xb517('0x16')][_0xb517('0x18')]||null:null,'attributes':_0xc467dd[_0xb517('0x16')]?_0xc467dd[_0xb517('0x16')][_0xb517('0x1b')]||null:null,'include':_0xc467dd[_0xb517('0x16')]?_0xc467dd[_0xb517('0x16')]['include']?_[_0xb517('0x19')](_0xc467dd[_0xb517('0x16')][_0xb517('0x1a')],function(_0x1695b0){return{'model':db[_0x1695b0[_0xb517('0x1c')]],'as':_0x1695b0['as'],'attributes':_0x1695b0[_0xb517('0x1b')],'include':_0x1695b0[_0xb517('0x1a')]?_[_0xb517('0x19')](_0x1695b0[_0xb517('0x1a')],function(_0x3e1d37){return{'model':db[_0x3e1d37[_0xb517('0x1c')]],'as':_0x3e1d37['as'],'attributes':_0x3e1d37[_0xb517('0x1b')],'include':_0x3e1d37['include']?_[_0xb517('0x19')](_0x3e1d37['include'],function(_0x507c82){return{'model':db[_0x507c82[_0xb517('0x1c')]],'as':_0x507c82['as'],'attributes':_0x507c82['attributes']};}):[]};}):[]};}):[]:[]})[_0xb517('0x1d')](function(_0x3222a8){logger[_0xb517('0x13')](_0xb517('0x1f'),_0xc467dd);logger['debug'](_0xb517('0x1f'),_0xc467dd,JSON[_0xb517('0xe')](_0x3222a8));_0x42e78f(_0x3222a8);})[_0xb517('0x15')](function(_0x4a06e5){logger['error'](_0xb517('0x1f'),_0x4a06e5['message'],_0xc467dd);_0x2c548e(_0x48777e[_0xb517('0xf')](0x1f4,_0x4a06e5[_0xb517('0x12')]));});});}; \ No newline at end of file +var _0x0e0f=['rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','map','include','then','ShowSalesforceAccount','find','model','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x0e0f,0x19f));var _0xf0e0=function(_0xa7c51d,_0x208771){_0xa7c51d=_0xa7c51d-0x0;var _0x26febd=_0x0e0f[_0xa7c51d];return _0x26febd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0e0('0x0'));var BPromise=require(_0xf0e0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0e0('0x2'))['db'];var utils=require(_0xf0e0('0x3'));var logger=require(_0xf0e0('0x4'))(_0xf0e0('0x5'));var config=require(_0xf0e0('0x6'));var jayson=require(_0xf0e0('0x7'));var client=jayson[_0xf0e0('0x8')][_0xf0e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42cda2,_0x4450a3,_0x462788){return new BPromise(function(_0x1cfaa2,_0x14b29a){return client[_0xf0e0('0xa')](_0x42cda2,_0x462788)['then'](function(_0x134dba){logger[_0xf0e0('0xb')](_0xf0e0('0xc'),_0x4450a3,_0xf0e0('0xd'));logger[_0xf0e0('0xe')](_0xf0e0('0xf'),_0x4450a3,_0xf0e0('0xd'),JSON[_0xf0e0('0x10')](_0x134dba));if(_0x134dba[_0xf0e0('0x11')]){if(_0x134dba['error'][_0xf0e0('0x12')]===0x1f4){logger[_0xf0e0('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x4450a3,_0x134dba[_0xf0e0('0x11')][_0xf0e0('0x13')]);return _0x14b29a(_0x134dba[_0xf0e0('0x11')][_0xf0e0('0x13')]);}logger['error'](_0xf0e0('0xc'),_0x4450a3,_0x134dba['error'][_0xf0e0('0x13')]);return _0x1cfaa2(_0x134dba[_0xf0e0('0x11')]['message']);}else{logger[_0xf0e0('0xb')](_0xf0e0('0xc'),_0x4450a3,_0xf0e0('0xd'));_0x1cfaa2(_0x134dba[_0xf0e0('0x14')][_0xf0e0('0x13')]);}})[_0xf0e0('0x15')](function(_0x7d4121){logger['error'](_0xf0e0('0xc'),_0x4450a3,_0x7d4121);_0x14b29a(_0x7d4121);});});}exports[_0xf0e0('0x16')]=function(_0x1ed20a){var _0xdc7a47=this;return new Promise(function(_0x32b34a,_0x31428f){return db[_0xf0e0('0x17')][_0xf0e0('0x18')]({'raw':_0x1ed20a[_0xf0e0('0x19')]?_0x1ed20a[_0xf0e0('0x19')][_0xf0e0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ed20a[_0xf0e0('0x19')]?_0x1ed20a[_0xf0e0('0x19')][_0xf0e0('0x1b')]||null:null,'attributes':_0x1ed20a['options']?_0x1ed20a[_0xf0e0('0x19')][_0xf0e0('0x1c')]||null:null,'limit':_0x1ed20a[_0xf0e0('0x19')]?_0x1ed20a[_0xf0e0('0x19')]['limit']||null:null,'include':_0x1ed20a['options']?_0x1ed20a['options']['include']?_[_0xf0e0('0x1d')](_0x1ed20a['options'][_0xf0e0('0x1e')],function(_0x50c3b2){return{'model':db[_0x50c3b2['model']],'as':_0x50c3b2['as'],'attributes':_0x50c3b2[_0xf0e0('0x1c')],'include':_0x50c3b2[_0xf0e0('0x1e')]?_[_0xf0e0('0x1d')](_0x50c3b2[_0xf0e0('0x1e')],function(_0x1657c7){return{'model':db[_0x1657c7['model']],'as':_0x1657c7['as'],'attributes':_0x1657c7[_0xf0e0('0x1c')],'include':_0x1657c7[_0xf0e0('0x1e')]?_['map'](_0x1657c7['include'],function(_0x1a3b20){return{'model':db[_0x1a3b20['model']],'as':_0x1a3b20['as'],'attributes':_0x1a3b20['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0e0('0x1f')](function(_0x1f46d6){logger['info']('GetSalesforceAccount',_0x1ed20a);logger[_0xf0e0('0xe')]('GetSalesforceAccount',_0x1ed20a,JSON[_0xf0e0('0x10')](_0x1f46d6));_0x32b34a(_0x1f46d6);})[_0xf0e0('0x15')](function(_0x303fd5){logger[_0xf0e0('0x11')](_0xf0e0('0x16'),_0x303fd5[_0xf0e0('0x13')],_0x1ed20a);_0x31428f(_0xdc7a47[_0xf0e0('0x11')](0x1f4,_0x303fd5['message']));});});};exports[_0xf0e0('0x20')]=function(_0x2dc593){var _0x54a8c4=this;return new Promise(function(_0x34cca1,_0x3c98d6){return db['SalesforceAccount'][_0xf0e0('0x21')]({'raw':_0x2dc593[_0xf0e0('0x19')]?_0x2dc593['options']['raw']===undefined?!![]:![]:!![],'where':_0x2dc593['options']?_0x2dc593['options']['where']||null:null,'attributes':_0x2dc593[_0xf0e0('0x19')]?_0x2dc593[_0xf0e0('0x19')][_0xf0e0('0x1c')]||null:null,'include':_0x2dc593['options']?_0x2dc593[_0xf0e0('0x19')][_0xf0e0('0x1e')]?_[_0xf0e0('0x1d')](_0x2dc593['options'][_0xf0e0('0x1e')],function(_0x5a6fa1){return{'model':db[_0x5a6fa1[_0xf0e0('0x22')]],'as':_0x5a6fa1['as'],'attributes':_0x5a6fa1[_0xf0e0('0x1c')],'include':_0x5a6fa1[_0xf0e0('0x1e')]?_[_0xf0e0('0x1d')](_0x5a6fa1['include'],function(_0x351a07){return{'model':db[_0x351a07[_0xf0e0('0x22')]],'as':_0x351a07['as'],'attributes':_0x351a07['attributes'],'include':_0x351a07[_0xf0e0('0x1e')]?_['map'](_0x351a07[_0xf0e0('0x1e')],function(_0x2d2f72){return{'model':db[_0x2d2f72['model']],'as':_0x2d2f72['as'],'attributes':_0x2d2f72[_0xf0e0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0e0('0x1f')](function(_0x5cf1b5){logger[_0xf0e0('0xb')](_0xf0e0('0x20'),_0x2dc593);logger[_0xf0e0('0xe')](_0xf0e0('0x20'),_0x2dc593,JSON[_0xf0e0('0x10')](_0x5cf1b5));_0x34cca1(_0x5cf1b5);})[_0xf0e0('0x15')](function(_0x41f5bb){logger[_0xf0e0('0x11')](_0xf0e0('0x20'),_0x41f5bb[_0xf0e0('0x13')],_0x2dc593);_0x3c98d6(_0x54a8c4[_0xf0e0('0x11')](0x1f4,_0x41f5bb[_0xf0e0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 98024d1..3c7b4c0 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(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x0b0e,0x187));var _0xe0b0=function(_0xf7a9cf,_0x2cfa33){_0xf7a9cf=_0xf7a9cf-0x0;var _0x7fdc45=_0x0b0e[_0xf7a9cf];return _0x7fdc45;};'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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5eb48c,_0x3604af){var _0x1e7919=function(_0x22a5bb){while(--_0x22a5bb){_0x5eb48c['push'](_0x5eb48c['shift']());}};_0x1e7919(++_0x3604af);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 58d6f54..f1d564c 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 _0x586b=['nothing','contact','lead','STRING','ENUM','Task','Case','contact_lead','account_contact_lead','account'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x586b,0x1bb));var _0xb586=function(_0x54a646,_0x1d109a){_0x54a646=_0x54a646-0x0;var _0x902e2f=_0x586b[_0x54a646];return _0x902e2f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb586('0x0')]},'description':{'type':Sequelize[_0xb586('0x0')]},'ticketType':{'type':Sequelize[_0xb586('0x1')](_0xb586('0x2'),_0xb586('0x3')),'defaultValue':_0xb586('0x2')},'moduleSearch':{'type':Sequelize[_0xb586('0x1')](_0xb586('0x4'),'contact','lead',_0xb586('0x5'),_0xb586('0x6')),'defaultValue':_0xb586('0x4')},'moduleCreate':{'type':Sequelize[_0xb586('0x1')](_0xb586('0x7'),_0xb586('0x8'),'lead',_0xb586('0x6')),'defaultValue':_0xb586('0x9')},'leadId':{'type':Sequelize[_0xb586('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0xb586('0x0')]},'additionalSearchContact':{'type':Sequelize[_0xb586('0x0')]},'additionalSearchLead':{'type':Sequelize[_0xb586('0x0')]}}; \ No newline at end of file +var _0x9137=['Task','Case','contact_lead','contact','nothing','account','STRING','ENUM'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x9137,0x7e));var _0x7913=function(_0x281820,_0x47572b){_0x281820=_0x281820-0x0;var _0x2d05f6=_0x9137[_0x281820];return _0x2d05f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7913('0x0')]},'description':{'type':Sequelize[_0x7913('0x0')]},'ticketType':{'type':Sequelize[_0x7913('0x1')](_0x7913('0x2'),_0x7913('0x3')),'defaultValue':_0x7913('0x2')},'moduleSearch':{'type':Sequelize[_0x7913('0x1')](_0x7913('0x4'),_0x7913('0x5'),'lead','account_contact_lead','account'),'defaultValue':_0x7913('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x7913('0x6'),_0x7913('0x5'),'lead',_0x7913('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x7913('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x7913('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x7913('0x0')]},'additionalSearchLead':{'type':Sequelize[_0x7913('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4d739bd..403d8ef 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 _0x5d96=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','include','rows','catch','params','rawAttributes','find','create','body','destroy','getFields','findOne','SalesforceField','length','sort','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x5d96,0xdf));var _0x65d9=function(_0xb77d9b,_0x406c11){_0xb77d9b=_0xb77d9b-0x0;var _0x5cc5e1=_0x5d96[_0xb77d9b];return _0x5cc5e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65d9('0x0'));var zipdir=require(_0x65d9('0x1'));var jsonpatch=require(_0x65d9('0x2'));var rp=require(_0x65d9('0x3'));var moment=require('moment');var BPromise=require(_0x65d9('0x4'));var Mustache=require('mustache');var util=require(_0x65d9('0x5'));var path=require('path');var sox=require(_0x65d9('0x6'));var csv=require(_0x65d9('0x7'));var ejs=require(_0x65d9('0x8'));var fs=require('fs');var fs_extra=require(_0x65d9('0x9'));var _=require(_0x65d9('0xa'));var squel=require(_0x65d9('0xb'));var crypto=require(_0x65d9('0xc'));var jsforce=require(_0x65d9('0xd'));var deskjs=require(_0x65d9('0xe'));var toCsv=require(_0x65d9('0x7'));var querystring=require(_0x65d9('0xf'));var Papa=require(_0x65d9('0x10'));var Redis=require(_0x65d9('0x11'));var authService=require(_0x65d9('0x12'));var qs=require(_0x65d9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65d9('0x14'));var logger=require(_0x65d9('0x15'))(_0x65d9('0x16'));var utils=require(_0x65d9('0x17'));var config=require(_0x65d9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x65d9('0x19'))['db'];function respondWithStatusCode(_0xea0622,_0x25c393){_0x25c393=_0x25c393||0xcc;return function(_0x570d44){if(_0x570d44){return _0xea0622[_0x65d9('0x1a')](_0x25c393);}return _0xea0622[_0x65d9('0x1b')](_0x25c393)[_0x65d9('0x1c')]();};}function respondWithResult(_0x3727b3,_0x3cc5a3){_0x3cc5a3=_0x3cc5a3||0xc8;return function(_0x3e6c21){if(_0x3e6c21){return _0x3727b3[_0x65d9('0x1b')](_0x3cc5a3)[_0x65d9('0x1d')](_0x3e6c21);}};}function respondWithFilteredResult(_0x4fc784,_0x3550a9){return function(_0x22315a){if(_0x22315a){var _0x1fad9e=typeof _0x3550a9[_0x65d9('0x1e')]==='undefined'&&typeof _0x3550a9[_0x65d9('0x1f')]===_0x65d9('0x20');var _0x5eac15=_0x22315a[_0x65d9('0x21')];var _0x3350da=_0x1fad9e?0x0:_0x3550a9[_0x65d9('0x1e')];var _0x2c7f83=_0x1fad9e?_0x22315a['count']:_0x3550a9['offset']+_0x3550a9[_0x65d9('0x1f')];var _0x13079b;if(_0x2c7f83>=_0x5eac15){_0x2c7f83=_0x5eac15;_0x13079b=0xc8;}else{_0x13079b=0xce;}_0x4fc784[_0x65d9('0x1b')](_0x13079b);return _0x4fc784[_0x65d9('0x22')]('Content-Range',_0x3350da+'-'+_0x2c7f83+'/'+_0x5eac15)[_0x65d9('0x1d')](_0x22315a);}return null;};}function patchUpdates(_0x376e0d){return function(_0xd6a0eb){try{jsonpatch[_0x65d9('0x23')](_0xd6a0eb,_0x376e0d,!![]);}catch(_0x5ccffb){return BPromise[_0x65d9('0x24')](_0x5ccffb);}return _0xd6a0eb[_0x65d9('0x25')]();};}function saveUpdates(_0xa52563,_0x5db9a3){return function(_0x50c89c){if(_0x50c89c){return _0x50c89c[_0x65d9('0x26')](_0xa52563)[_0x65d9('0x27')](function(_0x8e8b1d){return _0x8e8b1d;});}return null;};}function removeEntity(_0x3c5bb9,_0x4b20cf){return function(_0x12b79f){if(_0x12b79f){return _0x12b79f['destroy']()['then'](function(){_0x3c5bb9[_0x65d9('0x1b')](0xcc)[_0x65d9('0x1c')]();});}};}function handleEntityNotFound(_0x31f930,_0x512568){return function(_0x35f20d){if(!_0x35f20d){_0x31f930[_0x65d9('0x1a')](0x194);}return _0x35f20d;};}function handleError(_0x3e0f41,_0x39467a){_0x39467a=_0x39467a||0x1f4;return function(_0x2a9e2f){logger[_0x65d9('0x28')](_0x2a9e2f['stack']);if(_0x2a9e2f['name']){delete _0x2a9e2f[_0x65d9('0x29')];}_0x3e0f41[_0x65d9('0x1b')](_0x39467a)[_0x65d9('0x2a')](_0x2a9e2f);};}exports[_0x65d9('0x2b')]=function(_0x571682,_0x431fb3){var _0x19b77e={},_0x3df92d={},_0x2eff6d={'count':0x0,'rows':[]};var _0x19e2a9=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x209e04){return{'name':_0x209e04['fieldName'],'type':_0x209e04[_0x65d9('0x2c')][_0x65d9('0x2d')]};});_0x3df92d[_0x65d9('0x2e')]=_[_0x65d9('0x2f')](_0x19e2a9,'name');_0x3df92d[_0x65d9('0x30')]=_[_0x65d9('0x31')](_0x571682[_0x65d9('0x30')]);_0x3df92d[_0x65d9('0x32')]=_[_0x65d9('0x33')](_0x3df92d['model'],_0x3df92d['query']);_0x19b77e[_0x65d9('0x34')]=_[_0x65d9('0x33')](_0x3df92d[_0x65d9('0x2e')],qs[_0x65d9('0x35')](_0x571682['query'][_0x65d9('0x35')]));_0x19b77e[_0x65d9('0x34')]=_0x19b77e[_0x65d9('0x34')]['length']?_0x19b77e[_0x65d9('0x34')]:_0x3df92d[_0x65d9('0x2e')];if(!_0x571682['query'][_0x65d9('0x36')](_0x65d9('0x37'))){_0x19b77e['limit']=qs[_0x65d9('0x1f')](_0x571682[_0x65d9('0x30')][_0x65d9('0x1f')]);_0x19b77e[_0x65d9('0x1e')]=qs[_0x65d9('0x1e')](_0x571682[_0x65d9('0x30')]['offset']);}_0x19b77e[_0x65d9('0x38')]=qs['sort'](_0x571682[_0x65d9('0x30')]['sort']);_0x19b77e['where']=qs[_0x65d9('0x32')](_['pick'](_0x571682[_0x65d9('0x30')],_0x3df92d[_0x65d9('0x32')]),_0x19e2a9);if(_0x571682[_0x65d9('0x30')][_0x65d9('0x39')]){_0x19b77e[_0x65d9('0x3a')]=_[_0x65d9('0x3b')](_0x19b77e[_0x65d9('0x3a')],{'$or':_[_0x65d9('0x2f')](_0x19e2a9,function(_0x434b39){if(_0x434b39['type']!==_0x65d9('0x3c')){var _0x317b40={};_0x317b40[_0x434b39['name']]={'$like':'%'+_0x571682[_0x65d9('0x30')][_0x65d9('0x39')]+'%'};return _0x317b40;}})});}_0x19b77e=_[_0x65d9('0x3b')]({},_0x19b77e,_0x571682[_0x65d9('0x3d')]);var _0x31c8bc={'where':_0x19b77e[_0x65d9('0x3a')]};return db[_0x65d9('0x3e')][_0x65d9('0x21')](_0x31c8bc)['then'](function(_0x3050dd){_0x2eff6d['count']=_0x3050dd;if(_0x571682['query'][_0x65d9('0x3f')]){_0x19b77e[_0x65d9('0x40')]=[{'all':!![]}];}return db[_0x65d9('0x3e')]['findAll'](_0x19b77e);})['then'](function(_0x62f620){_0x2eff6d[_0x65d9('0x41')]=_0x62f620;return _0x2eff6d;})[_0x65d9('0x27')](respondWithFilteredResult(_0x431fb3,_0x19b77e))[_0x65d9('0x42')](handleError(_0x431fb3,null));};exports['show']=function(_0x541ed9,_0x3fb3bd){var _0x3fa1d4={'raw':![],'where':{'id':_0x541ed9[_0x65d9('0x43')]['id']}},_0x312adf={};_0x312adf[_0x65d9('0x2e')]=_[_0x65d9('0x31')](db[_0x65d9('0x3e')][_0x65d9('0x44')]);_0x312adf[_0x65d9('0x30')]=_[_0x65d9('0x31')](_0x541ed9[_0x65d9('0x30')]);_0x312adf[_0x65d9('0x32')]=_[_0x65d9('0x33')](_0x312adf[_0x65d9('0x2e')],_0x312adf[_0x65d9('0x30')]);_0x3fa1d4[_0x65d9('0x34')]=_[_0x65d9('0x33')](_0x312adf[_0x65d9('0x2e')],qs[_0x65d9('0x35')](_0x541ed9['query'][_0x65d9('0x35')]));_0x3fa1d4[_0x65d9('0x34')]=_0x3fa1d4[_0x65d9('0x34')]['length']?_0x3fa1d4[_0x65d9('0x34')]:_0x312adf[_0x65d9('0x2e')];if(_0x541ed9[_0x65d9('0x30')][_0x65d9('0x3f')]){_0x3fa1d4[_0x65d9('0x40')]=[{'all':!![]}];}_0x3fa1d4=_[_0x65d9('0x3b')]({},_0x3fa1d4,_0x541ed9[_0x65d9('0x3d')]);return db[_0x65d9('0x3e')][_0x65d9('0x45')](_0x3fa1d4)[_0x65d9('0x27')](handleEntityNotFound(_0x3fb3bd,null))[_0x65d9('0x27')](respondWithResult(_0x3fb3bd,null))[_0x65d9('0x42')](handleError(_0x3fb3bd,null));};exports[_0x65d9('0x46')]=function(_0x4958cd,_0x60b788){return db[_0x65d9('0x3e')][_0x65d9('0x46')](_0x4958cd[_0x65d9('0x47')],{})['then'](respondWithResult(_0x60b788,0xc9))[_0x65d9('0x42')](handleError(_0x60b788,null));};exports[_0x65d9('0x26')]=function(_0x42e995,_0x48e5de){if(_0x42e995[_0x65d9('0x47')]['id']){delete _0x42e995[_0x65d9('0x47')]['id'];}return db['SalesforceConfiguration'][_0x65d9('0x45')]({'where':{'id':_0x42e995[_0x65d9('0x43')]['id']}})['then'](handleEntityNotFound(_0x48e5de,null))['then'](saveUpdates(_0x42e995[_0x65d9('0x47')],null))[_0x65d9('0x27')](respondWithResult(_0x48e5de,null))[_0x65d9('0x42')](handleError(_0x48e5de,null));};exports[_0x65d9('0x48')]=function(_0x19e942,_0x18b985){return db[_0x65d9('0x3e')][_0x65d9('0x45')]({'where':{'id':_0x19e942['params']['id']}})[_0x65d9('0x27')](handleEntityNotFound(_0x18b985,null))[_0x65d9('0x27')](removeEntity(_0x18b985,null))['catch'](handleError(_0x18b985,null));};exports[_0x65d9('0x49')]=function(_0x29ca5e,_0xbb70e1,_0x2efd3d){var _0x4da545={};var _0x1987c8={};var _0x40f34d;var _0x345cb7;return db[_0x65d9('0x3e')][_0x65d9('0x4a')]({'where':{'id':_0x29ca5e[_0x65d9('0x43')]['id']}})['then'](handleEntityNotFound(_0xbb70e1,null))[_0x65d9('0x27')](function(_0x46a0b3){if(_0x46a0b3){_0x40f34d=_0x46a0b3;_0x1987c8[_0x65d9('0x2e')]=_[_0x65d9('0x31')](db[_0x65d9('0x4b')][_0x65d9('0x44')]);_0x1987c8[_0x65d9('0x30')]=_[_0x65d9('0x31')](_0x29ca5e[_0x65d9('0x30')]);_0x1987c8['filters']=_[_0x65d9('0x33')](_0x1987c8[_0x65d9('0x2e')],_0x1987c8[_0x65d9('0x30')]);_0x4da545[_0x65d9('0x34')]=_[_0x65d9('0x33')](_0x1987c8[_0x65d9('0x2e')],qs[_0x65d9('0x35')](_0x29ca5e[_0x65d9('0x30')][_0x65d9('0x35')]));_0x4da545[_0x65d9('0x34')]=_0x4da545['attributes'][_0x65d9('0x4c')]?_0x4da545[_0x65d9('0x34')]:_0x1987c8[_0x65d9('0x2e')];_0x4da545[_0x65d9('0x38')]=qs['sort'](_0x29ca5e['query'][_0x65d9('0x4d')]);_0x4da545[_0x65d9('0x3a')]=qs[_0x65d9('0x32')](_['pick'](_0x29ca5e[_0x65d9('0x30')],_0x1987c8[_0x65d9('0x32')]));if(_0x29ca5e[_0x65d9('0x30')][_0x65d9('0x39')]){_0x4da545['where']=_[_0x65d9('0x3b')](_0x4da545[_0x65d9('0x3a')],{'$or':_[_0x65d9('0x2f')](_0x4da545['attributes'],function(_0x161745){var _0xcc1aab={};_0xcc1aab[_0x161745]={'$like':'%'+_0x29ca5e[_0x65d9('0x30')]['filter']+'%'};return _0xcc1aab;})});}_0x4da545=_[_0x65d9('0x3b')]({},_0x4da545,_0x29ca5e[_0x65d9('0x3d')]);return _0x40f34d['getFields'](_0x4da545);}})['then'](function(_0x22c093){if(_0x22c093){_0x345cb7=_0x22c093[_0x65d9('0x4c')];if(!_0x29ca5e['query'][_0x65d9('0x36')](_0x65d9('0x37'))){_0x4da545['limit']=qs[_0x65d9('0x1f')](_0x29ca5e[_0x65d9('0x30')][_0x65d9('0x1f')]);_0x4da545['offset']=qs['offset'](_0x29ca5e[_0x65d9('0x30')][_0x65d9('0x1e')]);}return _0x40f34d[_0x65d9('0x49')](_0x4da545);}})[_0x65d9('0x27')](function(_0x25dff4){if(_0x25dff4){return _0x25dff4?{'count':_0x345cb7,'rows':_0x25dff4}:null;}})['then'](respondWithResult(_0xbb70e1,null))[_0x65d9('0x42')](handleError(_0xbb70e1,null));};exports[_0x65d9('0x4e')]=function(_0x3fc53b,_0x49cfe6,_0x47d6c8){var _0x539d59={};var _0x2af9e2={};var _0x34459d;var _0x6f78f0;return db['SalesforceConfiguration'][_0x65d9('0x4a')]({'where':{'id':_0x3fc53b['params']['id']}})[_0x65d9('0x27')](handleEntityNotFound(_0x49cfe6,null))['then'](function(_0x1b4104){if(_0x1b4104){_0x34459d=_0x1b4104;_0x2af9e2[_0x65d9('0x2e')]=_['keys'](db[_0x65d9('0x4b')][_0x65d9('0x44')]);_0x2af9e2[_0x65d9('0x30')]=_['keys'](_0x3fc53b[_0x65d9('0x30')]);_0x2af9e2['filters']=_['intersection'](_0x2af9e2['model'],_0x2af9e2[_0x65d9('0x30')]);_0x539d59[_0x65d9('0x34')]=_[_0x65d9('0x33')](_0x2af9e2[_0x65d9('0x2e')],qs[_0x65d9('0x35')](_0x3fc53b[_0x65d9('0x30')][_0x65d9('0x35')]));_0x539d59[_0x65d9('0x34')]=_0x539d59[_0x65d9('0x34')][_0x65d9('0x4c')]?_0x539d59['attributes']:_0x2af9e2[_0x65d9('0x2e')];_0x539d59[_0x65d9('0x38')]=qs['sort'](_0x3fc53b[_0x65d9('0x30')]['sort']);_0x539d59['where']=qs[_0x65d9('0x32')](_[_0x65d9('0x4f')](_0x3fc53b[_0x65d9('0x30')],_0x2af9e2[_0x65d9('0x32')]));if(_0x3fc53b[_0x65d9('0x30')][_0x65d9('0x39')]){_0x539d59[_0x65d9('0x3a')]=_[_0x65d9('0x3b')](_0x539d59[_0x65d9('0x3a')],{'$or':_[_0x65d9('0x2f')](_0x539d59[_0x65d9('0x34')],function(_0x54cb55){var _0x1e1564={};_0x1e1564[_0x54cb55]={'$like':'%'+_0x3fc53b[_0x65d9('0x30')]['filter']+'%'};return _0x1e1564;})});}_0x539d59=_['merge']({},_0x539d59,_0x3fc53b['options']);return _0x34459d[_0x65d9('0x4e')](_0x539d59);}})['then'](function(_0x231081){if(_0x231081){_0x6f78f0=_0x231081[_0x65d9('0x4c')];if(!_0x3fc53b[_0x65d9('0x30')][_0x65d9('0x36')](_0x65d9('0x37'))){_0x539d59[_0x65d9('0x1f')]=qs[_0x65d9('0x1f')](_0x3fc53b[_0x65d9('0x30')][_0x65d9('0x1f')]);_0x539d59[_0x65d9('0x1e')]=qs[_0x65d9('0x1e')](_0x3fc53b[_0x65d9('0x30')]['offset']);}return _0x34459d[_0x65d9('0x4e')](_0x539d59);}})[_0x65d9('0x27')](function(_0x2029fc){if(_0x2029fc){return _0x2029fc?{'count':_0x6f78f0,'rows':_0x2029fc}:null;}})[_0x65d9('0x27')](respondWithResult(_0x49cfe6,null))['catch'](handleError(_0x49cfe6,null));};exports[_0x65d9('0x50')]=function(_0x5f0e73,_0x277ecf,_0x87d0b0){var _0x547ca2={};var _0x563d3f={};var _0x258ff4;var _0x13a5dc;return db['SalesforceConfiguration'][_0x65d9('0x4a')]({'where':{'id':_0x5f0e73[_0x65d9('0x43')]['id']}})[_0x65d9('0x27')](handleEntityNotFound(_0x277ecf,null))[_0x65d9('0x27')](function(_0x107700){if(_0x107700){_0x258ff4=_0x107700;_0x563d3f[_0x65d9('0x2e')]=_['keys'](db[_0x65d9('0x4b')][_0x65d9('0x44')]);_0x563d3f[_0x65d9('0x30')]=_[_0x65d9('0x31')](_0x5f0e73[_0x65d9('0x30')]);_0x563d3f[_0x65d9('0x32')]=_[_0x65d9('0x33')](_0x563d3f[_0x65d9('0x2e')],_0x563d3f['query']);_0x547ca2['attributes']=_['intersection'](_0x563d3f[_0x65d9('0x2e')],qs[_0x65d9('0x35')](_0x5f0e73[_0x65d9('0x30')][_0x65d9('0x35')]));_0x547ca2[_0x65d9('0x34')]=_0x547ca2[_0x65d9('0x34')][_0x65d9('0x4c')]?_0x547ca2[_0x65d9('0x34')]:_0x563d3f['model'];_0x547ca2[_0x65d9('0x38')]=qs['sort'](_0x5f0e73['query'][_0x65d9('0x4d')]);_0x547ca2['where']=qs[_0x65d9('0x32')](_[_0x65d9('0x4f')](_0x5f0e73[_0x65d9('0x30')],_0x563d3f[_0x65d9('0x32')]));if(_0x5f0e73[_0x65d9('0x30')]['filter']){_0x547ca2[_0x65d9('0x3a')]=_[_0x65d9('0x3b')](_0x547ca2['where'],{'$or':_[_0x65d9('0x2f')](_0x547ca2['attributes'],function(_0x1c6594){var _0x285aee={};_0x285aee[_0x1c6594]={'$like':'%'+_0x5f0e73[_0x65d9('0x30')][_0x65d9('0x39')]+'%'};return _0x285aee;})});}_0x547ca2=_['merge']({},_0x547ca2,_0x5f0e73[_0x65d9('0x3d')]);return _0x258ff4[_0x65d9('0x50')](_0x547ca2);}})[_0x65d9('0x27')](function(_0x43d940){if(_0x43d940){_0x13a5dc=_0x43d940['length'];if(!_0x5f0e73[_0x65d9('0x30')][_0x65d9('0x36')](_0x65d9('0x37'))){_0x547ca2[_0x65d9('0x1f')]=qs[_0x65d9('0x1f')](_0x5f0e73['query'][_0x65d9('0x1f')]);_0x547ca2[_0x65d9('0x1e')]=qs[_0x65d9('0x1e')](_0x5f0e73[_0x65d9('0x30')][_0x65d9('0x1e')]);}return _0x258ff4[_0x65d9('0x50')](_0x547ca2);}})[_0x65d9('0x27')](function(_0xb154a0){if(_0xb154a0){return _0xb154a0?{'count':_0x13a5dc,'rows':_0xb154a0}:null;}})[_0x65d9('0x27')](respondWithResult(_0x277ecf,null))[_0x65d9('0x42')](handleError(_0x277ecf,null));}; \ No newline at end of file +var _0x0441=['end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','findAll','rows','show','params','options','find','create','body','catch','getFields','SalesforceField','merge','findOne','pick','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x298e62,_0x4d42bc){var _0x48ba2b=function(_0x1a5471){while(--_0x1a5471){_0x298e62['push'](_0x298e62['shift']());}};_0x48ba2b(++_0x4d42bc);}(_0x0441,0x8c));var _0x1044=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x0441[_0x1f71d8];return _0x10b045;};'use strict';var emlformat=require(_0x1044('0x0'));var rimraf=require(_0x1044('0x1'));var zipdir=require(_0x1044('0x2'));var jsonpatch=require(_0x1044('0x3'));var rp=require('request-promise');var moment=require(_0x1044('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1044('0x5'));var util=require(_0x1044('0x6'));var path=require(_0x1044('0x7'));var sox=require(_0x1044('0x8'));var csv=require(_0x1044('0x9'));var ejs=require(_0x1044('0xa'));var fs=require('fs');var fs_extra=require(_0x1044('0xb'));var _=require(_0x1044('0xc'));var squel=require(_0x1044('0xd'));var crypto=require(_0x1044('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1044('0xf'));var toCsv=require(_0x1044('0x9'));var querystring=require(_0x1044('0x10'));var Papa=require(_0x1044('0x11'));var Redis=require(_0x1044('0x12'));var authService=require(_0x1044('0x13'));var qs=require(_0x1044('0x14'));var as=require(_0x1044('0x15'));var hardwareService=require(_0x1044('0x16'));var logger=require(_0x1044('0x17'))(_0x1044('0x18'));var utils=require(_0x1044('0x19'));var config=require(_0x1044('0x1a'));var licenseUtil=require(_0x1044('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9c42,_0x14c595){_0x14c595=_0x14c595||0xcc;return function(_0x488155){if(_0x488155){return _0x3d9c42[_0x1044('0x1c')](_0x14c595);}return _0x3d9c42[_0x1044('0x1d')](_0x14c595)[_0x1044('0x1e')]();};}function respondWithResult(_0x400d2b,_0x58971b){_0x58971b=_0x58971b||0xc8;return function(_0x516567){if(_0x516567){return _0x400d2b[_0x1044('0x1d')](_0x58971b)[_0x1044('0x1f')](_0x516567);}};}function respondWithFilteredResult(_0x354850,_0xc5f3d4){return function(_0xefdb07){if(_0xefdb07){var _0x4c6082=typeof _0xc5f3d4['offset']===_0x1044('0x20')&&typeof _0xc5f3d4['limit']===_0x1044('0x20');var _0x34d817=_0xefdb07[_0x1044('0x21')];var _0xa3870d=_0x4c6082?0x0:_0xc5f3d4[_0x1044('0x22')];var _0x8c4a07=_0x4c6082?_0xefdb07[_0x1044('0x21')]:_0xc5f3d4[_0x1044('0x22')]+_0xc5f3d4[_0x1044('0x23')];var _0x36f88a;if(_0x8c4a07>=_0x34d817){_0x8c4a07=_0x34d817;_0x36f88a=0xc8;}else{_0x36f88a=0xce;}_0x354850[_0x1044('0x1d')](_0x36f88a);return _0x354850[_0x1044('0x24')](_0x1044('0x25'),_0xa3870d+'-'+_0x8c4a07+'/'+_0x34d817)[_0x1044('0x1f')](_0xefdb07);}return null;};}function patchUpdates(_0x135a74){return function(_0x262402){try{jsonpatch[_0x1044('0x26')](_0x262402,_0x135a74,!![]);}catch(_0x3e5ba5){return BPromise[_0x1044('0x27')](_0x3e5ba5);}return _0x262402[_0x1044('0x28')]();};}function saveUpdates(_0x1e81c5,_0x1bb5a9){return function(_0x3dfb6d){if(_0x3dfb6d){return _0x3dfb6d[_0x1044('0x29')](_0x1e81c5)[_0x1044('0x2a')](function(_0x489645){return _0x489645;});}return null;};}function removeEntity(_0x41cccc,_0x53b7ee){return function(_0x4294a0){if(_0x4294a0){return _0x4294a0[_0x1044('0x2b')]()['then'](function(){_0x41cccc[_0x1044('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5e3,_0x5d0035){return function(_0x2d7c34){if(!_0x2d7c34){_0x3b5e3['sendStatus'](0x194);}return _0x2d7c34;};}function handleError(_0xba4699,_0xb1c1d3){_0xb1c1d3=_0xb1c1d3||0x1f4;return function(_0x28f90b){logger['error'](_0x28f90b[_0x1044('0x2c')]);if(_0x28f90b['name']){delete _0x28f90b[_0x1044('0x2d')];}_0xba4699[_0x1044('0x1d')](_0xb1c1d3)[_0x1044('0x2e')](_0x28f90b);};}exports[_0x1044('0x2f')]=function(_0x56e754,_0x3949a7){var _0x41b432={},_0x880eb0={},_0x13b9c5={'count':0x0,'rows':[]};var _0x3c3eb3=_['map'](db[_0x1044('0x30')][_0x1044('0x31')],function(_0x368487){return{'name':_0x368487[_0x1044('0x32')],'type':_0x368487['type']['key']};});_0x880eb0['model']=_[_0x1044('0x33')](_0x3c3eb3,_0x1044('0x2d'));_0x880eb0[_0x1044('0x34')]=_[_0x1044('0x35')](_0x56e754[_0x1044('0x34')]);_0x880eb0[_0x1044('0x36')]=_[_0x1044('0x37')](_0x880eb0[_0x1044('0x38')],_0x880eb0[_0x1044('0x34')]);_0x41b432[_0x1044('0x39')]=_[_0x1044('0x37')](_0x880eb0['model'],qs['fields'](_0x56e754[_0x1044('0x34')][_0x1044('0x3a')]));_0x41b432[_0x1044('0x39')]=_0x41b432[_0x1044('0x39')][_0x1044('0x3b')]?_0x41b432[_0x1044('0x39')]:_0x880eb0['model'];if(!_0x56e754[_0x1044('0x34')]['hasOwnProperty'](_0x1044('0x3c'))){_0x41b432[_0x1044('0x23')]=qs[_0x1044('0x23')](_0x56e754[_0x1044('0x34')][_0x1044('0x23')]);_0x41b432[_0x1044('0x22')]=qs['offset'](_0x56e754['query'][_0x1044('0x22')]);}_0x41b432[_0x1044('0x3d')]=qs[_0x1044('0x3e')](_0x56e754[_0x1044('0x34')][_0x1044('0x3e')]);_0x41b432[_0x1044('0x3f')]=qs['filters'](_['pick'](_0x56e754['query'],_0x880eb0[_0x1044('0x36')]),_0x3c3eb3);if(_0x56e754[_0x1044('0x34')][_0x1044('0x40')]){_0x41b432[_0x1044('0x3f')]=_['merge'](_0x41b432[_0x1044('0x3f')],{'$or':_['map'](_0x3c3eb3,function(_0x4be5f1){if(_0x4be5f1[_0x1044('0x41')]!==_0x1044('0x42')){var _0xcca54b={};_0xcca54b[_0x4be5f1[_0x1044('0x2d')]]={'$like':'%'+_0x56e754[_0x1044('0x34')][_0x1044('0x40')]+'%'};return _0xcca54b;}})});}_0x41b432=_['merge']({},_0x41b432,_0x56e754['options']);var _0x131eab={'where':_0x41b432['where']};return db['SalesforceConfiguration']['count'](_0x131eab)[_0x1044('0x2a')](function(_0x1bf974){_0x13b9c5[_0x1044('0x21')]=_0x1bf974;if(_0x56e754[_0x1044('0x34')][_0x1044('0x43')]){_0x41b432['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x1044('0x44')](_0x41b432);})[_0x1044('0x2a')](function(_0x24e6d6){_0x13b9c5[_0x1044('0x45')]=_0x24e6d6;return _0x13b9c5;})[_0x1044('0x2a')](respondWithFilteredResult(_0x3949a7,_0x41b432))['catch'](handleError(_0x3949a7,null));};exports[_0x1044('0x46')]=function(_0x36b98c,_0xf1a0f2){var _0x46d3f3={'raw':![],'where':{'id':_0x36b98c[_0x1044('0x47')]['id']}},_0xa34b64={};_0xa34b64[_0x1044('0x38')]=_[_0x1044('0x35')](db[_0x1044('0x30')][_0x1044('0x31')]);_0xa34b64['query']=_[_0x1044('0x35')](_0x36b98c['query']);_0xa34b64[_0x1044('0x36')]=_[_0x1044('0x37')](_0xa34b64['model'],_0xa34b64[_0x1044('0x34')]);_0x46d3f3[_0x1044('0x39')]=_[_0x1044('0x37')](_0xa34b64['model'],qs['fields'](_0x36b98c[_0x1044('0x34')][_0x1044('0x3a')]));_0x46d3f3['attributes']=_0x46d3f3[_0x1044('0x39')]['length']?_0x46d3f3[_0x1044('0x39')]:_0xa34b64[_0x1044('0x38')];if(_0x36b98c[_0x1044('0x34')][_0x1044('0x43')]){_0x46d3f3['include']=[{'all':!![]}];}_0x46d3f3=_['merge']({},_0x46d3f3,_0x36b98c[_0x1044('0x48')]);return db[_0x1044('0x30')][_0x1044('0x49')](_0x46d3f3)[_0x1044('0x2a')](handleEntityNotFound(_0xf1a0f2,null))[_0x1044('0x2a')](respondWithResult(_0xf1a0f2,null))['catch'](handleError(_0xf1a0f2,null));};exports['create']=function(_0x54a110,_0x2dbb7f){return db['SalesforceConfiguration'][_0x1044('0x4a')](_0x54a110[_0x1044('0x4b')],{})['then'](respondWithResult(_0x2dbb7f,0xc9))[_0x1044('0x4c')](handleError(_0x2dbb7f,null));};exports['update']=function(_0x1bdacb,_0x34672c){if(_0x1bdacb[_0x1044('0x4b')]['id']){delete _0x1bdacb[_0x1044('0x4b')]['id'];}return db[_0x1044('0x30')][_0x1044('0x49')]({'where':{'id':_0x1bdacb[_0x1044('0x47')]['id']}})[_0x1044('0x2a')](handleEntityNotFound(_0x34672c,null))[_0x1044('0x2a')](saveUpdates(_0x1bdacb[_0x1044('0x4b')],null))['then'](respondWithResult(_0x34672c,null))['catch'](handleError(_0x34672c,null));};exports[_0x1044('0x2b')]=function(_0x323c2e,_0x290ce3){return db['SalesforceConfiguration']['find']({'where':{'id':_0x323c2e[_0x1044('0x47')]['id']}})['then'](handleEntityNotFound(_0x290ce3,null))['then'](removeEntity(_0x290ce3,null))[_0x1044('0x4c')](handleError(_0x290ce3,null));};exports[_0x1044('0x4d')]=function(_0x1f5e33,_0x599ccb,_0x3074bb){var _0xbced45={};var _0x88a193={};var _0x21db77;var _0x437b89;return db[_0x1044('0x30')]['findOne']({'where':{'id':_0x1f5e33[_0x1044('0x47')]['id']}})[_0x1044('0x2a')](handleEntityNotFound(_0x599ccb,null))[_0x1044('0x2a')](function(_0x132eb8){if(_0x132eb8){_0x21db77=_0x132eb8;_0x88a193['model']=_[_0x1044('0x35')](db[_0x1044('0x4e')][_0x1044('0x31')]);_0x88a193[_0x1044('0x34')]=_[_0x1044('0x35')](_0x1f5e33['query']);_0x88a193['filters']=_['intersection'](_0x88a193[_0x1044('0x38')],_0x88a193[_0x1044('0x34')]);_0xbced45['attributes']=_[_0x1044('0x37')](_0x88a193[_0x1044('0x38')],qs[_0x1044('0x3a')](_0x1f5e33[_0x1044('0x34')]['fields']));_0xbced45[_0x1044('0x39')]=_0xbced45['attributes'][_0x1044('0x3b')]?_0xbced45[_0x1044('0x39')]:_0x88a193[_0x1044('0x38')];_0xbced45['order']=qs[_0x1044('0x3e')](_0x1f5e33['query']['sort']);_0xbced45[_0x1044('0x3f')]=qs['filters'](_['pick'](_0x1f5e33[_0x1044('0x34')],_0x88a193[_0x1044('0x36')]));if(_0x1f5e33['query']['filter']){_0xbced45[_0x1044('0x3f')]=_[_0x1044('0x4f')](_0xbced45[_0x1044('0x3f')],{'$or':_[_0x1044('0x33')](_0xbced45['attributes'],function(_0x215bf5){var _0x49d303={};_0x49d303[_0x215bf5]={'$like':'%'+_0x1f5e33[_0x1044('0x34')][_0x1044('0x40')]+'%'};return _0x49d303;})});}_0xbced45=_[_0x1044('0x4f')]({},_0xbced45,_0x1f5e33[_0x1044('0x48')]);return _0x21db77[_0x1044('0x4d')](_0xbced45);}})[_0x1044('0x2a')](function(_0x2cb9e4){if(_0x2cb9e4){_0x437b89=_0x2cb9e4[_0x1044('0x3b')];if(!_0x1f5e33[_0x1044('0x34')]['hasOwnProperty'](_0x1044('0x3c'))){_0xbced45[_0x1044('0x23')]=qs[_0x1044('0x23')](_0x1f5e33[_0x1044('0x34')][_0x1044('0x23')]);_0xbced45[_0x1044('0x22')]=qs['offset'](_0x1f5e33[_0x1044('0x34')][_0x1044('0x22')]);}return _0x21db77['getFields'](_0xbced45);}})['then'](function(_0x31b206){if(_0x31b206){return _0x31b206?{'count':_0x437b89,'rows':_0x31b206}:null;}})[_0x1044('0x2a')](respondWithResult(_0x599ccb,null))[_0x1044('0x4c')](handleError(_0x599ccb,null));};exports['getSubjects']=function(_0xaee93b,_0x38eb67,_0x441902){var _0x4c795c={};var _0x7a8def={};var _0x2a5fd0;var _0x107bd0;return db[_0x1044('0x30')][_0x1044('0x50')]({'where':{'id':_0xaee93b[_0x1044('0x47')]['id']}})[_0x1044('0x2a')](handleEntityNotFound(_0x38eb67,null))['then'](function(_0x5b3e3a){if(_0x5b3e3a){_0x2a5fd0=_0x5b3e3a;_0x7a8def['model']=_[_0x1044('0x35')](db[_0x1044('0x4e')][_0x1044('0x31')]);_0x7a8def[_0x1044('0x34')]=_[_0x1044('0x35')](_0xaee93b[_0x1044('0x34')]);_0x7a8def[_0x1044('0x36')]=_[_0x1044('0x37')](_0x7a8def[_0x1044('0x38')],_0x7a8def[_0x1044('0x34')]);_0x4c795c[_0x1044('0x39')]=_[_0x1044('0x37')](_0x7a8def[_0x1044('0x38')],qs[_0x1044('0x3a')](_0xaee93b[_0x1044('0x34')][_0x1044('0x3a')]));_0x4c795c[_0x1044('0x39')]=_0x4c795c[_0x1044('0x39')][_0x1044('0x3b')]?_0x4c795c[_0x1044('0x39')]:_0x7a8def[_0x1044('0x38')];_0x4c795c[_0x1044('0x3d')]=qs[_0x1044('0x3e')](_0xaee93b[_0x1044('0x34')]['sort']);_0x4c795c[_0x1044('0x3f')]=qs[_0x1044('0x36')](_[_0x1044('0x51')](_0xaee93b[_0x1044('0x34')],_0x7a8def[_0x1044('0x36')]));if(_0xaee93b[_0x1044('0x34')][_0x1044('0x40')]){_0x4c795c['where']=_[_0x1044('0x4f')](_0x4c795c['where'],{'$or':_['map'](_0x4c795c[_0x1044('0x39')],function(_0x13375f){var _0x3c7dd5={};_0x3c7dd5[_0x13375f]={'$like':'%'+_0xaee93b[_0x1044('0x34')][_0x1044('0x40')]+'%'};return _0x3c7dd5;})});}_0x4c795c=_[_0x1044('0x4f')]({},_0x4c795c,_0xaee93b[_0x1044('0x48')]);return _0x2a5fd0[_0x1044('0x52')](_0x4c795c);}})['then'](function(_0x11a975){if(_0x11a975){_0x107bd0=_0x11a975[_0x1044('0x3b')];if(!_0xaee93b[_0x1044('0x34')]['hasOwnProperty'](_0x1044('0x3c'))){_0x4c795c[_0x1044('0x23')]=qs[_0x1044('0x23')](_0xaee93b[_0x1044('0x34')]['limit']);_0x4c795c['offset']=qs['offset'](_0xaee93b[_0x1044('0x34')][_0x1044('0x22')]);}return _0x2a5fd0[_0x1044('0x52')](_0x4c795c);}})[_0x1044('0x2a')](function(_0x2dfa61){if(_0x2dfa61){return _0x2dfa61?{'count':_0x107bd0,'rows':_0x2dfa61}:null;}})['then'](respondWithResult(_0x38eb67,null))[_0x1044('0x4c')](handleError(_0x38eb67,null));};exports['getDescriptions']=function(_0x58124b,_0x5db35b,_0x29acdd){var _0x5671bb={};var _0x308943={};var _0x4464fd;var _0x4692a4;return db[_0x1044('0x30')][_0x1044('0x50')]({'where':{'id':_0x58124b[_0x1044('0x47')]['id']}})[_0x1044('0x2a')](handleEntityNotFound(_0x5db35b,null))[_0x1044('0x2a')](function(_0x4adee5){if(_0x4adee5){_0x4464fd=_0x4adee5;_0x308943['model']=_[_0x1044('0x35')](db[_0x1044('0x4e')][_0x1044('0x31')]);_0x308943[_0x1044('0x34')]=_[_0x1044('0x35')](_0x58124b[_0x1044('0x34')]);_0x308943['filters']=_[_0x1044('0x37')](_0x308943[_0x1044('0x38')],_0x308943[_0x1044('0x34')]);_0x5671bb[_0x1044('0x39')]=_['intersection'](_0x308943['model'],qs[_0x1044('0x3a')](_0x58124b[_0x1044('0x34')][_0x1044('0x3a')]));_0x5671bb['attributes']=_0x5671bb[_0x1044('0x39')][_0x1044('0x3b')]?_0x5671bb[_0x1044('0x39')]:_0x308943[_0x1044('0x38')];_0x5671bb[_0x1044('0x3d')]=qs[_0x1044('0x3e')](_0x58124b[_0x1044('0x34')][_0x1044('0x3e')]);_0x5671bb[_0x1044('0x3f')]=qs[_0x1044('0x36')](_[_0x1044('0x51')](_0x58124b['query'],_0x308943[_0x1044('0x36')]));if(_0x58124b[_0x1044('0x34')]['filter']){_0x5671bb['where']=_['merge'](_0x5671bb[_0x1044('0x3f')],{'$or':_[_0x1044('0x33')](_0x5671bb['attributes'],function(_0x3102f3){var _0x5d7223={};_0x5d7223[_0x3102f3]={'$like':'%'+_0x58124b['query']['filter']+'%'};return _0x5d7223;})});}_0x5671bb=_[_0x1044('0x4f')]({},_0x5671bb,_0x58124b[_0x1044('0x48')]);return _0x4464fd[_0x1044('0x53')](_0x5671bb);}})[_0x1044('0x2a')](function(_0x393b87){if(_0x393b87){_0x4692a4=_0x393b87[_0x1044('0x3b')];if(!_0x58124b['query'][_0x1044('0x54')](_0x1044('0x3c'))){_0x5671bb[_0x1044('0x23')]=qs[_0x1044('0x23')](_0x58124b['query'][_0x1044('0x23')]);_0x5671bb['offset']=qs['offset'](_0x58124b[_0x1044('0x34')][_0x1044('0x22')]);}return _0x4464fd[_0x1044('0x53')](_0x5671bb);}})[_0x1044('0x2a')](function(_0x31480b){if(_0x31480b){return _0x31480b?{'count':_0x4692a4,'rows':_0x31480b}:null;}})[_0x1044('0x2a')](respondWithResult(_0x5db35b,null))[_0x1044('0x4c')](handleError(_0x5db35b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f2337ac..60a8059 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 _0x9009=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x159e26,_0x1ddf7b){var _0x57ba6f=function(_0x5d09f6){while(--_0x5d09f6){_0x159e26['push'](_0x159e26['shift']());}};_0x57ba6f(++_0x1ddf7b);}(_0x9009,0x12b));var _0x9900=function(_0x1d7cc7,_0x249d1e){_0x1d7cc7=_0x1d7cc7-0x0;var _0x5219e2=_0x9009[_0x1d7cc7];return _0x5219e2;};'use strict';var _=require(_0x9900('0x0'));var util=require(_0x9900('0x1'));var logger=require(_0x9900('0x2'))(_0x9900('0x3'));var moment=require(_0x9900('0x4'));var BPromise=require(_0x9900('0x5'));var rp=require(_0x9900('0x6'));var fs=require('fs');var path=require(_0x9900('0x7'));var rimraf=require(_0x9900('0x8'));var config=require(_0x9900('0x9'));var attributes=require(_0x9900('0xa'));module[_0x9900('0xb')]=function(_0x4d7d2c,_0x90a112){return _0x4d7d2c[_0x9900('0xc')]('SalesforceConfiguration',attributes,{'tableName':_0x9900('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4481=['SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intSalesforceConfiguration.attributes'];(function(_0x539eba,_0x30a5ee){var _0x437dc9=function(_0x524970){while(--_0x524970){_0x539eba['push'](_0x539eba['shift']());}};_0x437dc9(++_0x30a5ee);}(_0x4481,0x1c4));var _0x1448=function(_0x52d0d7,_0x106cf2){_0x52d0d7=_0x52d0d7-0x0;var _0x4c4b28=_0x4481[_0x52d0d7];return _0x4c4b28;};'use strict';var _=require(_0x1448('0x0'));var util=require(_0x1448('0x1'));var logger=require(_0x1448('0x2'))(_0x1448('0x3'));var moment=require(_0x1448('0x4'));var BPromise=require(_0x1448('0x5'));var rp=require(_0x1448('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1448('0x7'));module['exports']=function(_0x3ca35c,_0x476a25){return _0x3ca35c['define'](_0x1448('0x8'),attributes,{'tableName':_0x1448('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index d54a637..59bad17 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 _0x3431=['jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x259aee,_0x51a415){var _0x191c48=function(_0x3e65b6){while(--_0x3e65b6){_0x259aee['push'](_0x259aee['shift']());}};_0x191c48(++_0x51a415);}(_0x3431,0xc6));var _0x1343=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0x3431[_0x4a96ca];return _0x2aed48;};'use strict';var _=require(_0x1343('0x0'));var util=require('util');var moment=require(_0x1343('0x1'));var BPromise=require(_0x1343('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1343('0x3'));var db=require(_0x1343('0x4'))['db'];var utils=require(_0x1343('0x5'));var logger=require(_0x1343('0x6'))(_0x1343('0x7'));var config=require(_0x1343('0x8'));var jayson=require(_0x1343('0x9'));var client=jayson[_0x1343('0xa')][_0x1343('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a8b3c,_0x5cd609,_0x3546b6){return new BPromise(function(_0x2423a4,_0x3fbe82){return client['request'](_0x3a8b3c,_0x3546b6)[_0x1343('0xc')](function(_0x25af0b){logger[_0x1343('0xd')](_0x1343('0xe'),_0x5cd609,_0x1343('0xf'));logger['debug'](_0x1343('0x10'),_0x5cd609,'request\x20sent',JSON[_0x1343('0x11')](_0x25af0b));if(_0x25af0b[_0x1343('0x12')]){if(_0x25af0b[_0x1343('0x12')][_0x1343('0x13')]===0x1f4){logger[_0x1343('0x12')](_0x1343('0xe'),_0x5cd609,_0x25af0b[_0x1343('0x12')][_0x1343('0x14')]);return _0x3fbe82(_0x25af0b[_0x1343('0x12')][_0x1343('0x14')]);}logger[_0x1343('0x12')](_0x1343('0xe'),_0x5cd609,_0x25af0b[_0x1343('0x12')]['message']);return _0x2423a4(_0x25af0b[_0x1343('0x12')][_0x1343('0x14')]);}else{logger[_0x1343('0xd')](_0x1343('0xe'),_0x5cd609,_0x1343('0xf'));_0x2423a4(_0x25af0b[_0x1343('0x15')]['message']);}})[_0x1343('0x16')](function(_0x53d67e){logger[_0x1343('0x12')](_0x1343('0xe'),_0x5cd609,_0x53d67e);_0x3fbe82(_0x53d67e);});});} \ No newline at end of file +var _0x52b6=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x52b6,0xb2));var _0x652b=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x52b6[_0x385669];return _0x11e2d2;};'use strict';var _=require('lodash');var util=require(_0x652b('0x0'));var moment=require(_0x652b('0x1'));var BPromise=require(_0x652b('0x2'));var rs=require(_0x652b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x652b('0x4'))['db'];var utils=require(_0x652b('0x5'));var logger=require(_0x652b('0x6'))(_0x652b('0x7'));var config=require(_0x652b('0x8'));var jayson=require(_0x652b('0x9'));var client=jayson[_0x652b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15039c,_0x2d0d98,_0x32349f){return new BPromise(function(_0x1c3419,_0x160bb){return client[_0x652b('0xb')](_0x15039c,_0x32349f)[_0x652b('0xc')](function(_0x5af55d){logger[_0x652b('0xd')](_0x652b('0xe'),_0x2d0d98,'request\x20sent');logger[_0x652b('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2d0d98,'request\x20sent',JSON[_0x652b('0x10')](_0x5af55d));if(_0x5af55d['error']){if(_0x5af55d['error'][_0x652b('0x11')]===0x1f4){logger[_0x652b('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2d0d98,_0x5af55d[_0x652b('0x12')][_0x652b('0x13')]);return _0x160bb(_0x5af55d[_0x652b('0x12')][_0x652b('0x13')]);}logger[_0x652b('0x12')](_0x652b('0xe'),_0x2d0d98,_0x5af55d['error'][_0x652b('0x13')]);return _0x1c3419(_0x5af55d[_0x652b('0x12')]['message']);}else{logger[_0x652b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2d0d98,'request\x20sent');_0x1c3419(_0x5af55d[_0x652b('0x14')][_0x652b('0x13')]);}})[_0x652b('0x15')](function(_0x1d8770){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2d0d98,_0x1d8770);_0x160bb(_0x1d8770);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 5f982f2..85feead 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 _0xf517=['index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x1e8c0a,_0x5921af){var _0x275615=function(_0x303e40){while(--_0x303e40){_0x1e8c0a['push'](_0x1e8c0a['shift']());}};_0x275615(++_0x5921af);}(_0xf517,0x9a));var _0x7f51=function(_0x881f55,_0x3a93fb){_0x881f55=_0x881f55-0x0;var _0x390245=_0xf517[_0x881f55];return _0x390245;};'use strict';var multer=require('multer');var util=require(_0x7f51('0x0'));var path=require(_0x7f51('0x1'));var timeout=require(_0x7f51('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7f51('0x3'));var interaction=require(_0x7f51('0x4'));var config=require(_0x7f51('0x5'));var controller=require(_0x7f51('0x6'));router[_0x7f51('0x7')]('/',auth['isAuthenticated'](),controller[_0x7f51('0x8')]);router['get'](_0x7f51('0x9'),auth[_0x7f51('0xa')](),controller[_0x7f51('0xb')]);router[_0x7f51('0xc')]('/',auth[_0x7f51('0xa')](),controller[_0x7f51('0xd')]);router[_0x7f51('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7f51('0xf')](_0x7f51('0x9'),auth['isAuthenticated'](),controller[_0x7f51('0x10')]);module[_0x7f51('0x11')]=router; \ No newline at end of file +var _0x746d=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x24f5b8,_0x554904){var _0x51e6d0=function(_0x3522be){while(--_0x3522be){_0x24f5b8['push'](_0x24f5b8['shift']());}};_0x51e6d0(++_0x554904);}(_0x746d,0xda));var _0xd746=function(_0x5b3c06,_0x1b7e19){_0x5b3c06=_0x5b3c06-0x0;var _0x5a10b3=_0x746d[_0x5b3c06];return _0x5a10b3;};'use strict';var multer=require(_0xd746('0x0'));var util=require(_0xd746('0x1'));var path=require(_0xd746('0x2'));var timeout=require(_0xd746('0x3'));var express=require(_0xd746('0x4'));var router=express['Router']();var fs_extra=require(_0xd746('0x5'));var auth=require(_0xd746('0x6'));var interaction=require(_0xd746('0x7'));var config=require(_0xd746('0x8'));var controller=require('./intSalesforceField.controller');router[_0xd746('0x9')]('/',auth[_0xd746('0xa')](),controller[_0xd746('0xb')]);router[_0xd746('0x9')](_0xd746('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd746('0xd')]('/',auth['isAuthenticated'](),controller[_0xd746('0xe')]);router[_0xd746('0xf')](_0xd746('0xc'),auth[_0xd746('0xa')](),controller[_0xd746('0x10')]);router[_0xd746('0x11')](_0xd746('0xc'),auth[_0xd746('0xa')](),controller[_0xd746('0x12')]);module[_0xd746('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 3bcdb5c..634af2e 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 _0x3ca6=['picklist','string','STRING','customVariable','sequelize','exports','ENUM','keyValue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3ca6,0x84));var _0x63ca=function(_0x3273bf,_0x24c857){_0x3273bf=_0x3273bf-0x0;var _0x5975ab=_0x3ca6[_0x3273bf];return _0x5975ab;};'use strict';var Sequelize=require(_0x63ca('0x0'));module[_0x63ca('0x1')]={'type':{'type':Sequelize[_0x63ca('0x2')]('string','variable','customVariable',_0x63ca('0x3'),_0x63ca('0x4')),'defaultValue':_0x63ca('0x5')},'content':{'type':Sequelize[_0x63ca('0x6')]},'key':{'type':Sequelize[_0x63ca('0x6')]},'keyType':{'type':Sequelize[_0x63ca('0x2')](_0x63ca('0x5'),'variable',_0x63ca('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x63ca('0x6')]},'variableName':{'type':Sequelize[_0x63ca('0x6')]}}; \ No newline at end of file +var _0x38db=['string','variable','keyValue','picklist','STRING','sequelize','ENUM'];(function(_0xd44b3,_0x2cc1ea){var _0x4a7ea3=function(_0x249901){while(--_0x249901){_0xd44b3['push'](_0xd44b3['shift']());}};_0x4a7ea3(++_0x2cc1ea);}(_0x38db,0x186));var _0xb38d=function(_0x268d50,_0x590046){_0x268d50=_0x268d50-0x0;var _0x584a5d=_0x38db[_0x268d50];return _0x584a5d;};'use strict';var Sequelize=require(_0xb38d('0x0'));module['exports']={'type':{'type':Sequelize[_0xb38d('0x1')](_0xb38d('0x2'),_0xb38d('0x3'),'customVariable',_0xb38d('0x4'),_0xb38d('0x5')),'defaultValue':_0xb38d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb38d('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb38d('0x2'),_0xb38d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb38d('0x6')]},'variableName':{'type':Sequelize[_0xb38d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 398edf3..04fa93e 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 _0xe5b5=['name','send','SalesforceField','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack'];(function(_0xbe15ce,_0x4c3f35){var _0x2797bb=function(_0x37f618){while(--_0x37f618){_0xbe15ce['push'](_0xbe15ce['shift']());}};_0x2797bb(++_0x4c3f35);}(_0xe5b5,0x1f1));var _0x5e5b=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0xe5b5[_0x3ae2b2];return _0x1dbf00;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require('moment');var BPromise=require(_0x5e5b('0x5'));var Mustache=require(_0x5e5b('0x6'));var util=require(_0x5e5b('0x7'));var path=require(_0x5e5b('0x8'));var sox=require(_0x5e5b('0x9'));var csv=require(_0x5e5b('0xa'));var ejs=require(_0x5e5b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e5b('0xc'));var squel=require(_0x5e5b('0xd'));var crypto=require(_0x5e5b('0xe'));var jsforce=require(_0x5e5b('0xf'));var deskjs=require(_0x5e5b('0x10'));var toCsv=require(_0x5e5b('0xa'));var querystring=require(_0x5e5b('0x11'));var Papa=require(_0x5e5b('0x12'));var Redis=require(_0x5e5b('0x13'));var authService=require(_0x5e5b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5e5b('0x15'));var hardwareService=require(_0x5e5b('0x16'));var logger=require('../../config/logger')(_0x5e5b('0x17'));var utils=require(_0x5e5b('0x18'));var config=require(_0x5e5b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e5b('0x1a'))['db'];function respondWithStatusCode(_0x41da62,_0x3fda58){_0x3fda58=_0x3fda58||0xcc;return function(_0x5c383d){if(_0x5c383d){return _0x41da62[_0x5e5b('0x1b')](_0x3fda58);}return _0x41da62['status'](_0x3fda58)['end']();};}function respondWithResult(_0x4b5546,_0x31c68e){_0x31c68e=_0x31c68e||0xc8;return function(_0x138e07){if(_0x138e07){return _0x4b5546[_0x5e5b('0x1c')](_0x31c68e)[_0x5e5b('0x1d')](_0x138e07);}};}function respondWithFilteredResult(_0x23d84c,_0x4ce37d){return function(_0xd40185){if(_0xd40185){var _0x4391fd=typeof _0x4ce37d[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x4ce37d[_0x5e5b('0x20')]===_0x5e5b('0x1f');var _0x54e72c=_0xd40185[_0x5e5b('0x21')];var _0x1b319d=_0x4391fd?0x0:_0x4ce37d['offset'];var _0x2473cb=_0x4391fd?_0xd40185[_0x5e5b('0x21')]:_0x4ce37d[_0x5e5b('0x1e')]+_0x4ce37d[_0x5e5b('0x20')];var _0xa5b208;if(_0x2473cb>=_0x54e72c){_0x2473cb=_0x54e72c;_0xa5b208=0xc8;}else{_0xa5b208=0xce;}_0x23d84c[_0x5e5b('0x1c')](_0xa5b208);return _0x23d84c[_0x5e5b('0x22')](_0x5e5b('0x23'),_0x1b319d+'-'+_0x2473cb+'/'+_0x54e72c)['json'](_0xd40185);}return null;};}function patchUpdates(_0x2b4cb4){return function(_0x3f69e2){try{jsonpatch['apply'](_0x3f69e2,_0x2b4cb4,!![]);}catch(_0x36d528){return BPromise['reject'](_0x36d528);}return _0x3f69e2[_0x5e5b('0x24')]();};}function saveUpdates(_0x4fcae9,_0x21e33c){return function(_0x13d461){if(_0x13d461){return _0x13d461[_0x5e5b('0x25')](_0x4fcae9)['then'](function(_0x2cc6f1){return _0x2cc6f1;});}return null;};}function removeEntity(_0x148a44,_0xa6eb5b){return function(_0x464515){if(_0x464515){return _0x464515['destroy']()[_0x5e5b('0x26')](function(){_0x148a44[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x27')]();});}};}function handleEntityNotFound(_0x277ee3,_0x316abe){return function(_0x298e59){if(!_0x298e59){_0x277ee3['sendStatus'](0x194);}return _0x298e59;};}function handleError(_0x427e13,_0x43e77a){_0x43e77a=_0x43e77a||0x1f4;return function(_0x4aec4a){logger[_0x5e5b('0x28')](_0x4aec4a[_0x5e5b('0x29')]);if(_0x4aec4a[_0x5e5b('0x2a')]){delete _0x4aec4a['name'];}_0x427e13[_0x5e5b('0x1c')](_0x43e77a)[_0x5e5b('0x2b')](_0x4aec4a);};}exports['index']=function(_0x4c38ca,_0x75b4ae){var _0x15dce5={},_0x50c9b5={},_0x4cb792={'count':0x0,'rows':[]};var _0x49d368=_['map'](db[_0x5e5b('0x2c')][_0x5e5b('0x2d')],function(_0x4b4ba9){return{'name':_0x4b4ba9[_0x5e5b('0x2e')],'type':_0x4b4ba9[_0x5e5b('0x2f')]['key']};});_0x50c9b5[_0x5e5b('0x30')]=_[_0x5e5b('0x31')](_0x49d368,_0x5e5b('0x2a'));_0x50c9b5[_0x5e5b('0x32')]=_[_0x5e5b('0x33')](_0x4c38ca[_0x5e5b('0x32')]);_0x50c9b5['filters']=_[_0x5e5b('0x34')](_0x50c9b5[_0x5e5b('0x30')],_0x50c9b5[_0x5e5b('0x32')]);_0x15dce5['attributes']=_[_0x5e5b('0x34')](_0x50c9b5[_0x5e5b('0x30')],qs['fields'](_0x4c38ca[_0x5e5b('0x32')][_0x5e5b('0x35')]));_0x15dce5[_0x5e5b('0x36')]=_0x15dce5[_0x5e5b('0x36')]['length']?_0x15dce5['attributes']:_0x50c9b5['model'];if(!_0x4c38ca['query']['hasOwnProperty'](_0x5e5b('0x37'))){_0x15dce5[_0x5e5b('0x20')]=qs['limit'](_0x4c38ca['query'][_0x5e5b('0x20')]);_0x15dce5[_0x5e5b('0x1e')]=qs['offset'](_0x4c38ca[_0x5e5b('0x32')]['offset']);}_0x15dce5[_0x5e5b('0x38')]=qs[_0x5e5b('0x39')](_0x4c38ca['query']['sort']);_0x15dce5[_0x5e5b('0x3a')]=qs[_0x5e5b('0x3b')](_[_0x5e5b('0x3c')](_0x4c38ca[_0x5e5b('0x32')],_0x50c9b5[_0x5e5b('0x3b')]),_0x49d368);if(_0x4c38ca[_0x5e5b('0x32')][_0x5e5b('0x3d')]){_0x15dce5['where']=_['merge'](_0x15dce5[_0x5e5b('0x3a')],{'$or':_['map'](_0x49d368,function(_0xad5eb0){if(_0xad5eb0['type']!==_0x5e5b('0x3e')){var _0x5969f1={};_0x5969f1[_0xad5eb0[_0x5e5b('0x2a')]]={'$like':'%'+_0x4c38ca[_0x5e5b('0x32')][_0x5e5b('0x3d')]+'%'};return _0x5969f1;}})});}_0x15dce5=_[_0x5e5b('0x3f')]({},_0x15dce5,_0x4c38ca[_0x5e5b('0x40')]);var _0x4df918={'where':_0x15dce5[_0x5e5b('0x3a')]};return db['SalesforceField'][_0x5e5b('0x21')](_0x4df918)[_0x5e5b('0x26')](function(_0x4b421d){_0x4cb792[_0x5e5b('0x21')]=_0x4b421d;if(_0x4c38ca[_0x5e5b('0x32')][_0x5e5b('0x41')]){_0x15dce5[_0x5e5b('0x42')]=[{'all':!![]}];}return db[_0x5e5b('0x2c')][_0x5e5b('0x43')](_0x15dce5);})[_0x5e5b('0x26')](function(_0x41dc15){_0x4cb792[_0x5e5b('0x44')]=_0x41dc15;return _0x4cb792;})[_0x5e5b('0x26')](respondWithFilteredResult(_0x75b4ae,_0x15dce5))[_0x5e5b('0x45')](handleError(_0x75b4ae,null));};exports[_0x5e5b('0x46')]=function(_0x5b2dd2,_0x81b32f){var _0x16e496={'raw':!![],'where':{'id':_0x5b2dd2[_0x5e5b('0x47')]['id']}},_0x257fc0={};_0x257fc0[_0x5e5b('0x30')]=_[_0x5e5b('0x33')](db[_0x5e5b('0x2c')][_0x5e5b('0x2d')]);_0x257fc0['query']=_[_0x5e5b('0x33')](_0x5b2dd2[_0x5e5b('0x32')]);_0x257fc0['filters']=_[_0x5e5b('0x34')](_0x257fc0['model'],_0x257fc0[_0x5e5b('0x32')]);_0x16e496[_0x5e5b('0x36')]=_['intersection'](_0x257fc0[_0x5e5b('0x30')],qs[_0x5e5b('0x35')](_0x5b2dd2['query']['fields']));_0x16e496[_0x5e5b('0x36')]=_0x16e496[_0x5e5b('0x36')][_0x5e5b('0x48')]?_0x16e496[_0x5e5b('0x36')]:_0x257fc0[_0x5e5b('0x30')];if(_0x5b2dd2[_0x5e5b('0x32')][_0x5e5b('0x41')]){_0x16e496[_0x5e5b('0x42')]=[{'all':!![]}];}_0x16e496=_[_0x5e5b('0x3f')]({},_0x16e496,_0x5b2dd2[_0x5e5b('0x40')]);return db[_0x5e5b('0x2c')]['find'](_0x16e496)[_0x5e5b('0x26')](handleEntityNotFound(_0x81b32f,null))[_0x5e5b('0x26')](respondWithResult(_0x81b32f,null))[_0x5e5b('0x45')](handleError(_0x81b32f,null));};exports['create']=function(_0x182b4f,_0x3c95be){return db['SalesforceField'][_0x5e5b('0x49')](_0x182b4f[_0x5e5b('0x4a')],{})[_0x5e5b('0x26')](respondWithResult(_0x3c95be,0xc9))[_0x5e5b('0x45')](handleError(_0x3c95be,null));};exports[_0x5e5b('0x25')]=function(_0x32cf58,_0x3d9f14){if(_0x32cf58[_0x5e5b('0x4a')]['id']){delete _0x32cf58[_0x5e5b('0x4a')]['id'];}return db[_0x5e5b('0x2c')]['find']({'where':{'id':_0x32cf58[_0x5e5b('0x47')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x3d9f14,null))[_0x5e5b('0x26')](saveUpdates(_0x32cf58['body'],null))[_0x5e5b('0x26')](respondWithResult(_0x3d9f14,null))[_0x5e5b('0x45')](handleError(_0x3d9f14,null));};exports[_0x5e5b('0x4b')]=function(_0x21e7c1,_0x460d48){return db['SalesforceField'][_0x5e5b('0x4c')]({'where':{'id':_0x21e7c1[_0x5e5b('0x47')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x460d48,null))[_0x5e5b('0x26')](removeEntity(_0x460d48,null))['catch'](handleError(_0x460d48,null));}; \ No newline at end of file +var _0x582a=['destroy','end','error','stack','name','send','index','map','SalesforceField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','count','limit','Content-Range','json','apply','reject','save','update','then'];(function(_0x115303,_0x47d05f){var _0x1e695f=function(_0x2dbdf2){while(--_0x2dbdf2){_0x115303['push'](_0x115303['shift']());}};_0x1e695f(++_0x47d05f);}(_0x582a,0x10a));var _0xa582=function(_0x5885e4,_0x23d7b7){_0x5885e4=_0x5885e4-0x0;var _0x154bab=_0x582a[_0x5885e4];return _0x154bab;};'use strict';var emlformat=require(_0xa582('0x0'));var rimraf=require(_0xa582('0x1'));var zipdir=require(_0xa582('0x2'));var jsonpatch=require(_0xa582('0x3'));var rp=require(_0xa582('0x4'));var moment=require(_0xa582('0x5'));var BPromise=require(_0xa582('0x6'));var Mustache=require(_0xa582('0x7'));var util=require('util');var path=require(_0xa582('0x8'));var sox=require('sox');var csv=require(_0xa582('0x9'));var ejs=require(_0xa582('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa582('0xb'));var squel=require('squel');var crypto=require(_0xa582('0xc'));var jsforce=require(_0xa582('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa582('0xe'));var Papa=require(_0xa582('0xf'));var Redis=require('ioredis');var authService=require(_0xa582('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa582('0x11'));var hardwareService=require(_0xa582('0x12'));var logger=require(_0xa582('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa582('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa582('0x15'))['db'];function respondWithStatusCode(_0x1235cb,_0x106dd3){_0x106dd3=_0x106dd3||0xcc;return function(_0x17b8a7){if(_0x17b8a7){return _0x1235cb[_0xa582('0x16')](_0x106dd3);}return _0x1235cb[_0xa582('0x17')](_0x106dd3)['end']();};}function respondWithResult(_0x96adbb,_0x308817){_0x308817=_0x308817||0xc8;return function(_0x3a1f2d){if(_0x3a1f2d){return _0x96adbb['status'](_0x308817)['json'](_0x3a1f2d);}};}function respondWithFilteredResult(_0x3607d2,_0x29e470){return function(_0x5478da){if(_0x5478da){var _0x35648f=typeof _0x29e470[_0xa582('0x18')]==='undefined'&&typeof _0x29e470['limit']==='undefined';var _0x659b63=_0x5478da[_0xa582('0x19')];var _0x2a0a2b=_0x35648f?0x0:_0x29e470[_0xa582('0x18')];var _0x3ac65d=_0x35648f?_0x5478da[_0xa582('0x19')]:_0x29e470[_0xa582('0x18')]+_0x29e470[_0xa582('0x1a')];var _0x2b8b10;if(_0x3ac65d>=_0x659b63){_0x3ac65d=_0x659b63;_0x2b8b10=0xc8;}else{_0x2b8b10=0xce;}_0x3607d2[_0xa582('0x17')](_0x2b8b10);return _0x3607d2['set'](_0xa582('0x1b'),_0x2a0a2b+'-'+_0x3ac65d+'/'+_0x659b63)[_0xa582('0x1c')](_0x5478da);}return null;};}function patchUpdates(_0x2387f0){return function(_0x1c588f){try{jsonpatch[_0xa582('0x1d')](_0x1c588f,_0x2387f0,!![]);}catch(_0x2e94b2){return BPromise[_0xa582('0x1e')](_0x2e94b2);}return _0x1c588f[_0xa582('0x1f')]();};}function saveUpdates(_0x3695fe,_0x31af38){return function(_0x3ea150){if(_0x3ea150){return _0x3ea150[_0xa582('0x20')](_0x3695fe)[_0xa582('0x21')](function(_0x268852){return _0x268852;});}return null;};}function removeEntity(_0x3a1be1,_0x46c919){return function(_0xb9e95b){if(_0xb9e95b){return _0xb9e95b[_0xa582('0x22')]()['then'](function(){_0x3a1be1[_0xa582('0x17')](0xcc)[_0xa582('0x23')]();});}};}function handleEntityNotFound(_0x42809e,_0x5e785c){return function(_0x487e1b){if(!_0x487e1b){_0x42809e[_0xa582('0x16')](0x194);}return _0x487e1b;};}function handleError(_0x1f3f27,_0x2f06b6){_0x2f06b6=_0x2f06b6||0x1f4;return function(_0x1fbe4f){logger[_0xa582('0x24')](_0x1fbe4f[_0xa582('0x25')]);if(_0x1fbe4f['name']){delete _0x1fbe4f[_0xa582('0x26')];}_0x1f3f27[_0xa582('0x17')](_0x2f06b6)[_0xa582('0x27')](_0x1fbe4f);};}exports[_0xa582('0x28')]=function(_0xd37fcd,_0x204577){var _0x23bdf8={},_0x3087af={},_0x3631ab={'count':0x0,'rows':[]};var _0x328c7c=_[_0xa582('0x29')](db[_0xa582('0x2a')]['rawAttributes'],function(_0x4df3de){return{'name':_0x4df3de[_0xa582('0x2b')],'type':_0x4df3de[_0xa582('0x2c')][_0xa582('0x2d')]};});_0x3087af[_0xa582('0x2e')]=_['map'](_0x328c7c,_0xa582('0x26'));_0x3087af[_0xa582('0x2f')]=_['keys'](_0xd37fcd[_0xa582('0x2f')]);_0x3087af[_0xa582('0x30')]=_[_0xa582('0x31')](_0x3087af[_0xa582('0x2e')],_0x3087af[_0xa582('0x2f')]);_0x23bdf8['attributes']=_[_0xa582('0x31')](_0x3087af[_0xa582('0x2e')],qs[_0xa582('0x32')](_0xd37fcd[_0xa582('0x2f')][_0xa582('0x32')]));_0x23bdf8[_0xa582('0x33')]=_0x23bdf8[_0xa582('0x33')][_0xa582('0x34')]?_0x23bdf8['attributes']:_0x3087af[_0xa582('0x2e')];if(!_0xd37fcd[_0xa582('0x2f')][_0xa582('0x35')](_0xa582('0x36'))){_0x23bdf8[_0xa582('0x1a')]=qs[_0xa582('0x1a')](_0xd37fcd['query'][_0xa582('0x1a')]);_0x23bdf8[_0xa582('0x18')]=qs[_0xa582('0x18')](_0xd37fcd[_0xa582('0x2f')]['offset']);}_0x23bdf8[_0xa582('0x37')]=qs[_0xa582('0x38')](_0xd37fcd['query']['sort']);_0x23bdf8[_0xa582('0x39')]=qs[_0xa582('0x30')](_[_0xa582('0x3a')](_0xd37fcd[_0xa582('0x2f')],_0x3087af[_0xa582('0x30')]),_0x328c7c);if(_0xd37fcd[_0xa582('0x2f')]['filter']){_0x23bdf8[_0xa582('0x39')]=_[_0xa582('0x3b')](_0x23bdf8[_0xa582('0x39')],{'$or':_[_0xa582('0x29')](_0x328c7c,function(_0x5d061c){if(_0x5d061c[_0xa582('0x2c')]!==_0xa582('0x3c')){var _0x29b1e9={};_0x29b1e9[_0x5d061c['name']]={'$like':'%'+_0xd37fcd[_0xa582('0x2f')][_0xa582('0x3d')]+'%'};return _0x29b1e9;}})});}_0x23bdf8=_['merge']({},_0x23bdf8,_0xd37fcd[_0xa582('0x3e')]);var _0x5cfd42={'where':_0x23bdf8[_0xa582('0x39')]};return db['SalesforceField'][_0xa582('0x19')](_0x5cfd42)[_0xa582('0x21')](function(_0x3369a3){_0x3631ab[_0xa582('0x19')]=_0x3369a3;if(_0xd37fcd[_0xa582('0x2f')][_0xa582('0x3f')]){_0x23bdf8[_0xa582('0x40')]=[{'all':!![]}];}return db[_0xa582('0x2a')][_0xa582('0x41')](_0x23bdf8);})[_0xa582('0x21')](function(_0x838751){_0x3631ab[_0xa582('0x42')]=_0x838751;return _0x3631ab;})[_0xa582('0x21')](respondWithFilteredResult(_0x204577,_0x23bdf8))[_0xa582('0x43')](handleError(_0x204577,null));};exports[_0xa582('0x44')]=function(_0x38c4fd,_0x2d0ef6){var _0x58e36c={'raw':!![],'where':{'id':_0x38c4fd[_0xa582('0x45')]['id']}},_0x5af5c1={};_0x5af5c1['model']=_[_0xa582('0x46')](db[_0xa582('0x2a')][_0xa582('0x47')]);_0x5af5c1['query']=_['keys'](_0x38c4fd['query']);_0x5af5c1[_0xa582('0x30')]=_['intersection'](_0x5af5c1[_0xa582('0x2e')],_0x5af5c1[_0xa582('0x2f')]);_0x58e36c[_0xa582('0x33')]=_[_0xa582('0x31')](_0x5af5c1[_0xa582('0x2e')],qs[_0xa582('0x32')](_0x38c4fd[_0xa582('0x2f')][_0xa582('0x32')]));_0x58e36c[_0xa582('0x33')]=_0x58e36c[_0xa582('0x33')][_0xa582('0x34')]?_0x58e36c[_0xa582('0x33')]:_0x5af5c1['model'];if(_0x38c4fd['query'][_0xa582('0x3f')]){_0x58e36c[_0xa582('0x40')]=[{'all':!![]}];}_0x58e36c=_['merge']({},_0x58e36c,_0x38c4fd['options']);return db[_0xa582('0x2a')]['find'](_0x58e36c)[_0xa582('0x21')](handleEntityNotFound(_0x2d0ef6,null))[_0xa582('0x21')](respondWithResult(_0x2d0ef6,null))[_0xa582('0x43')](handleError(_0x2d0ef6,null));};exports[_0xa582('0x48')]=function(_0x58691a,_0x411633){return db[_0xa582('0x2a')]['create'](_0x58691a[_0xa582('0x49')],{})['then'](respondWithResult(_0x411633,0xc9))['catch'](handleError(_0x411633,null));};exports[_0xa582('0x20')]=function(_0x3165cd,_0xb3ad0f){if(_0x3165cd[_0xa582('0x49')]['id']){delete _0x3165cd[_0xa582('0x49')]['id'];}return db['SalesforceField'][_0xa582('0x4a')]({'where':{'id':_0x3165cd[_0xa582('0x45')]['id']}})[_0xa582('0x21')](handleEntityNotFound(_0xb3ad0f,null))[_0xa582('0x21')](saveUpdates(_0x3165cd[_0xa582('0x49')],null))[_0xa582('0x21')](respondWithResult(_0xb3ad0f,null))[_0xa582('0x43')](handleError(_0xb3ad0f,null));};exports[_0xa582('0x22')]=function(_0x170a33,_0x33dc2b){return db[_0xa582('0x2a')][_0xa582('0x4a')]({'where':{'id':_0x170a33['params']['id']}})[_0xa582('0x21')](handleEntityNotFound(_0x33dc2b,null))['then'](removeEntity(_0x33dc2b,null))[_0xa582('0x43')](handleError(_0x33dc2b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index cecbbe8..e06199b 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 _0xb904=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','salesforce_unique_index','idField'];(function(_0x49eae0,_0x4f22b8){var _0x36f47d=function(_0x53398f){while(--_0x53398f){_0x49eae0['push'](_0x49eae0['shift']());}};_0x36f47d(++_0x4f22b8);}(_0xb904,0xe1));var _0x4b90=function(_0x4ef700,_0x1bf10a){_0x4ef700=_0x4ef700-0x0;var _0x2a17c6=_0xb904[_0x4ef700];return _0x2a17c6;};'use strict';var _=require(_0x4b90('0x0'));var util=require(_0x4b90('0x1'));var logger=require(_0x4b90('0x2'))(_0x4b90('0x3'));var moment=require(_0x4b90('0x4'));var BPromise=require('bluebird');var rp=require(_0x4b90('0x5'));var fs=require('fs');var path=require(_0x4b90('0x6'));var rimraf=require(_0x4b90('0x7'));var config=require('../../config/environment');var attributes=require(_0x4b90('0x8'));module[_0x4b90('0x9')]=function(_0x2e6373,_0x329e79){return _0x2e6373[_0x4b90('0xa')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x4b90('0xb'),'fields':[_0x4b90('0xc'),_0x4b90('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c3a=['lodash','util','api','moment','bluebird','request-promise','rimraf','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x3c3a,0x12b));var _0xa3c3=function(_0x3eb1da,_0x2a0c10){_0x3eb1da=_0x3eb1da-0x0;var _0x189f03=_0x3c3a[_0x3eb1da];return _0x189f03;};'use strict';var _=require(_0xa3c3('0x0'));var util=require(_0xa3c3('0x1'));var logger=require('../../config/logger')(_0xa3c3('0x2'));var moment=require(_0xa3c3('0x3'));var BPromise=require(_0xa3c3('0x4'));var rp=require(_0xa3c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3c3('0x6'));var config=require('../../config/environment');var attributes=require(_0xa3c3('0x7'));module['exports']=function(_0x120aec,_0x5b3180){return _0x120aec['define'](_0xa3c3('0x8'),attributes,{'tableName':_0xa3c3('0x9'),'paranoid':![],'indexes':[{'name':_0xa3c3('0xa'),'fields':[_0xa3c3('0xb'),_0xa3c3('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 6158c30..a696713 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 _0x81aa=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x205379,_0x79d618){var _0x1930a4=function(_0x169570){while(--_0x169570){_0x205379['push'](_0x205379['shift']());}};_0x1930a4(++_0x79d618);}(_0x81aa,0xcf));var _0xa81a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x81aa[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa81a('0x0'));var util=require('util');var moment=require(_0xa81a('0x1'));var BPromise=require(_0xa81a('0x2'));var rs=require(_0xa81a('0x3'));var fs=require('fs');var Redis=require(_0xa81a('0x4'));var db=require(_0xa81a('0x5'))['db'];var utils=require(_0xa81a('0x6'));var logger=require('../../config/logger')(_0xa81a('0x7'));var config=require(_0xa81a('0x8'));var jayson=require(_0xa81a('0x9'));var client=jayson['client'][_0xa81a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x210680,_0xf5a22b,_0x725059){return new BPromise(function(_0x1573ad,_0x134606){return client['request'](_0x210680,_0x725059)[_0xa81a('0xb')](function(_0x105beb){logger[_0xa81a('0xc')](_0xa81a('0xd'),_0xf5a22b,'request\x20sent');logger['debug'](_0xa81a('0xe'),_0xf5a22b,_0xa81a('0xf'),JSON[_0xa81a('0x10')](_0x105beb));if(_0x105beb[_0xa81a('0x11')]){if(_0x105beb[_0xa81a('0x11')][_0xa81a('0x12')]===0x1f4){logger[_0xa81a('0x11')](_0xa81a('0xd'),_0xf5a22b,_0x105beb[_0xa81a('0x11')]['message']);return _0x134606(_0x105beb[_0xa81a('0x11')][_0xa81a('0x13')]);}logger['error'](_0xa81a('0xd'),_0xf5a22b,_0x105beb['error'][_0xa81a('0x13')]);return _0x1573ad(_0x105beb['error']['message']);}else{logger[_0xa81a('0xc')](_0xa81a('0xd'),_0xf5a22b,'request\x20sent');_0x1573ad(_0x105beb[_0xa81a('0x14')][_0xa81a('0x13')]);}})['catch'](function(_0x59d42d){logger[_0xa81a('0x11')](_0xa81a('0xd'),_0xf5a22b,_0x59d42d);_0x134606(_0x59d42d);});});} \ No newline at end of file +var _0x3038=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x3038,0x157));var _0x8303=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x3038[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x8303('0x0'));var util=require(_0x8303('0x1'));var moment=require(_0x8303('0x2'));var BPromise=require(_0x8303('0x3'));var rs=require(_0x8303('0x4'));var fs=require('fs');var Redis=require(_0x8303('0x5'));var db=require(_0x8303('0x6'))['db'];var utils=require(_0x8303('0x7'));var logger=require('../../config/logger')(_0x8303('0x8'));var config=require(_0x8303('0x9'));var jayson=require(_0x8303('0xa'));var client=jayson['client'][_0x8303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c2286,_0x1c4409,_0xf0376f){return new BPromise(function(_0x316f8a,_0x17dd66){return client[_0x8303('0xc')](_0x3c2286,_0xf0376f)[_0x8303('0xd')](function(_0x2e53ad){logger[_0x8303('0xe')](_0x8303('0xf'),_0x1c4409,_0x8303('0x10'));logger[_0x8303('0x11')](_0x8303('0x12'),_0x1c4409,_0x8303('0x10'),JSON[_0x8303('0x13')](_0x2e53ad));if(_0x2e53ad['error']){if(_0x2e53ad[_0x8303('0x14')][_0x8303('0x15')]===0x1f4){logger['error'](_0x8303('0xf'),_0x1c4409,_0x2e53ad[_0x8303('0x14')][_0x8303('0x16')]);return _0x17dd66(_0x2e53ad[_0x8303('0x14')][_0x8303('0x16')]);}logger[_0x8303('0x14')](_0x8303('0xf'),_0x1c4409,_0x2e53ad[_0x8303('0x14')][_0x8303('0x16')]);return _0x316f8a(_0x2e53ad[_0x8303('0x14')][_0x8303('0x16')]);}else{logger['info'](_0x8303('0xf'),_0x1c4409,'request\x20sent');_0x316f8a(_0x2e53ad[_0x8303('0x17')][_0x8303('0x16')]);}})[_0x8303('0x18')](function(_0x458018){logger[_0x8303('0x14')]('SalesforceField,\x20%s,\x20%s',_0x1c4409,_0x458018);_0x17dd66(_0x458018);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index d741700..19c1041 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 _0x98b8=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show'];(function(_0x36f6fd,_0x4ac52d){var _0x192ce2=function(_0x43e43e){while(--_0x43e43e){_0x36f6fd['push'](_0x36f6fd['shift']());}};_0x192ce2(++_0x4ac52d);}(_0x98b8,0x93));var _0x898b=function(_0x5cb48f,_0x5c3815){_0x5cb48f=_0x5cb48f-0x0;var _0x3f52a7=_0x98b8[_0x5cb48f];return _0x3f52a7;};'use strict';var multer=require(_0x898b('0x0'));var util=require(_0x898b('0x1'));var path=require(_0x898b('0x2'));var timeout=require(_0x898b('0x3'));var express=require(_0x898b('0x4'));var router=express[_0x898b('0x5')]();var fs_extra=require(_0x898b('0x6'));var auth=require(_0x898b('0x7'));var interaction=require(_0x898b('0x8'));var config=require(_0x898b('0x9'));var controller=require(_0x898b('0xa'));router[_0x898b('0xb')]('/',auth[_0x898b('0xc')](),controller[_0x898b('0xd')]);router[_0x898b('0xb')]('/:id',auth[_0x898b('0xc')](),controller[_0x898b('0xe')]);router[_0x898b('0xb')](_0x898b('0xf'),auth[_0x898b('0xc')](),controller[_0x898b('0x10')]);router[_0x898b('0xb')](_0x898b('0x11'),auth['isAuthenticated'](),controller[_0x898b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x898b('0x13')]);router[_0x898b('0x14')](_0x898b('0xf'),auth[_0x898b('0xc')](),controller[_0x898b('0x15')]);router[_0x898b('0x16')](_0x898b('0x17'),auth[_0x898b('0xc')](),controller[_0x898b('0x18')]);router[_0x898b('0x19')](_0x898b('0x17'),auth[_0x898b('0xc')](),controller['destroy']);module[_0x898b('0x1a')]=router; \ No newline at end of file +var _0xf2a9=['../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','/:id','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf2a9,0x77));var _0x9f2a=function(_0xe59a39,_0x441985){_0xe59a39=_0xe59a39-0x0;var _0x28d5de=_0xf2a9[_0xe59a39];return _0x28d5de;};'use strict';var multer=require('multer');var util=require(_0x9f2a('0x0'));var path=require(_0x9f2a('0x1'));var timeout=require(_0x9f2a('0x2'));var express=require('express');var router=express[_0x9f2a('0x3')]();var fs_extra=require(_0x9f2a('0x4'));var auth=require(_0x9f2a('0x5'));var interaction=require(_0x9f2a('0x6'));var config=require(_0x9f2a('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x9f2a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9f2a('0x8')]('/:id',auth[_0x9f2a('0x9')](),controller[_0x9f2a('0xa')]);router[_0x9f2a('0x8')](_0x9f2a('0xb'),auth[_0x9f2a('0x9')](),controller[_0x9f2a('0xc')]);router['get']('/:id/fields',auth[_0x9f2a('0x9')](),controller[_0x9f2a('0xd')]);router[_0x9f2a('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f2a('0xf')]);router[_0x9f2a('0xe')](_0x9f2a('0xb'),auth[_0x9f2a('0x9')](),controller[_0x9f2a('0x10')]);router['put'](_0x9f2a('0x11'),auth[_0x9f2a('0x9')](),controller[_0x9f2a('0x12')]);router[_0x9f2a('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f2a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 981230b..13a48b5 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 _0x5024=['remoteUri','sequelize','exports','STRING','username'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5024,0x1b4));var _0x4502=function(_0x306a88,_0x4aea61){_0x306a88=_0x306a88-0x0;var _0x26dd5a=_0x5024[_0x306a88];return _0x26dd5a;};'use strict';var Sequelize=require(_0x4502('0x0'));module[_0x4502('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4502('0x2')],'unique':_0x4502('0x3')},'password':{'type':Sequelize[_0x4502('0x2')]},'email':{'type':Sequelize[_0x4502('0x2')]},'remoteUri':{'type':Sequelize[_0x4502('0x2')],'unique':_0x4502('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x477e=['sequelize','STRING','username','remoteUri'];(function(_0x4283b5,_0x507296){var _0x2b6412=function(_0x170067){while(--_0x170067){_0x4283b5['push'](_0x4283b5['shift']());}};_0x2b6412(++_0x507296);}(_0x477e,0xd8));var _0xe477=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x477e[_0x454165];return _0x56db53;};'use strict';var Sequelize=require(_0xe477('0x0'));module['exports']={'name':{'type':Sequelize[_0xe477('0x1')]},'description':{'type':Sequelize[_0xe477('0x1')]},'username':{'type':Sequelize[_0xe477('0x1')],'unique':_0xe477('0x2')},'password':{'type':Sequelize[_0xe477('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe477('0x1')],'unique':_0xe477('0x3')},'serverUrl':{'type':Sequelize[_0xe477('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 9f0ccc2..a36c604 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 _0x2af0=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','filter','merge','ServicenowAccount','includeAll','include','findAll','fields','length','options','find','catch','create','body','params','findOne','ServicenowConfiguration','order','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','label','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','all','concat','ServiceNow\x20error:\x20','statusCode','stack','boolean','True','true','False','false','inactive','value','eml-format','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x38a653,_0x1a5872){var _0x370492=function(_0x33a556){while(--_0x33a556){_0x38a653['push'](_0x38a653['shift']());}};_0x370492(++_0x1a5872);}(_0x2af0,0x157));var _0x02af=function(_0x2d3030,_0x2daea2){_0x2d3030=_0x2d3030-0x0;var _0x247c7e=_0x2af0[_0x2d3030];return _0x247c7e;};'use strict';var emlformat=require(_0x02af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x02af('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x02af('0x2'));var BPromise=require(_0x02af('0x3'));var Mustache=require('mustache');var util=require(_0x02af('0x4'));var path=require(_0x02af('0x5'));var sox=require(_0x02af('0x6'));var csv=require('to-csv');var ejs=require(_0x02af('0x7'));var fs=require('fs');var fs_extra=require(_0x02af('0x8'));var _=require(_0x02af('0x9'));var squel=require(_0x02af('0xa'));var crypto=require(_0x02af('0xb'));var jsforce=require(_0x02af('0xc'));var deskjs=require(_0x02af('0xd'));var toCsv=require('to-csv');var querystring=require(_0x02af('0xe'));var Papa=require(_0x02af('0xf'));var Redis=require(_0x02af('0x10'));var authService=require(_0x02af('0x11'));var qs=require(_0x02af('0x12'));var as=require(_0x02af('0x13'));var hardwareService=require(_0x02af('0x14'));var logger=require('../../config/logger')(_0x02af('0x15'));var utils=require(_0x02af('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x02af('0x17'));var db=require(_0x02af('0x18'))['db'];var integrations=require(_0x02af('0x19'));function respondWithStatusCode(_0x57b718,_0x29d4be){_0x29d4be=_0x29d4be||0xcc;return function(_0x28a4c4){if(_0x28a4c4){return _0x57b718[_0x02af('0x1a')](_0x29d4be);}return _0x57b718[_0x02af('0x1b')](_0x29d4be)[_0x02af('0x1c')]();};}function respondWithResult(_0x50db5a,_0xd1980b){_0xd1980b=_0xd1980b||0xc8;return function(_0x3eebb5){if(_0x3eebb5){return _0x50db5a[_0x02af('0x1b')](_0xd1980b)[_0x02af('0x1d')](_0x3eebb5);}};}function respondWithFilteredResult(_0x42a3c7,_0x10e4c2){return function(_0x57b4e0){if(_0x57b4e0){var _0x10b23e=typeof _0x10e4c2[_0x02af('0x1e')]==='undefined'&&typeof _0x10e4c2[_0x02af('0x1f')]===_0x02af('0x20');var _0x623da2=_0x57b4e0[_0x02af('0x21')];var _0x53c852=_0x10b23e?0x0:_0x10e4c2[_0x02af('0x1e')];var _0xfcef77=_0x10b23e?_0x57b4e0[_0x02af('0x21')]:_0x10e4c2[_0x02af('0x1e')]+_0x10e4c2['limit'];var _0x34b3d7;if(_0xfcef77>=_0x623da2){_0xfcef77=_0x623da2;_0x34b3d7=0xc8;}else{_0x34b3d7=0xce;}_0x42a3c7['status'](_0x34b3d7);return _0x42a3c7['set'](_0x02af('0x22'),_0x53c852+'-'+_0xfcef77+'/'+_0x623da2)[_0x02af('0x1d')](_0x57b4e0);}return null;};}function patchUpdates(_0x161ff7){return function(_0x495ff0){try{jsonpatch['apply'](_0x495ff0,_0x161ff7,!![]);}catch(_0x2dc044){return BPromise[_0x02af('0x23')](_0x2dc044);}return _0x495ff0[_0x02af('0x24')]();};}function saveUpdates(_0xed26d1,_0x5b3a32){return function(_0x1e25e8){if(_0x1e25e8){return _0x1e25e8[_0x02af('0x25')](_0xed26d1)[_0x02af('0x26')](function(_0x163689){return _0x163689;});}return null;};}function removeEntity(_0x19046f,_0x5b2f64){return function(_0x5193d3){if(_0x5193d3){return _0x5193d3[_0x02af('0x27')]()['then'](function(){_0x19046f['status'](0xcc)[_0x02af('0x1c')]();});}};}function handleEntityNotFound(_0x43131a,_0x5f1551){return function(_0x58a2e2){if(!_0x58a2e2){_0x43131a[_0x02af('0x1a')](0x194);}return _0x58a2e2;};}function handleError(_0x5e598d,_0x23c4b8){_0x23c4b8=_0x23c4b8||0x1f4;return function(_0x2ac6a0){logger[_0x02af('0x28')](_0x2ac6a0['stack']);if(_0x2ac6a0[_0x02af('0x29')]){delete _0x2ac6a0[_0x02af('0x29')];}_0x5e598d['status'](_0x23c4b8)['send'](_0x2ac6a0);};}exports[_0x02af('0x2a')]=function(_0x1c18e4,_0x4fe714){var _0x45f99e={},_0x32f399={},_0x1c7ea3={'count':0x0,'rows':[]};var _0xa19452=_[_0x02af('0x2b')](db['ServicenowAccount'][_0x02af('0x2c')],function(_0x54772e){return{'name':_0x54772e[_0x02af('0x2d')],'type':_0x54772e[_0x02af('0x2e')][_0x02af('0x2f')]};});_0x32f399[_0x02af('0x30')]=_[_0x02af('0x2b')](_0xa19452,_0x02af('0x29'));_0x32f399[_0x02af('0x31')]=_[_0x02af('0x32')](_0x1c18e4[_0x02af('0x31')]);_0x32f399[_0x02af('0x33')]=_[_0x02af('0x34')](_0x32f399[_0x02af('0x30')],_0x32f399[_0x02af('0x31')]);_0x45f99e[_0x02af('0x35')]=_[_0x02af('0x34')](_0x32f399[_0x02af('0x30')],qs['fields'](_0x1c18e4['query']['fields']));_0x45f99e[_0x02af('0x35')]=_0x45f99e['attributes']['length']?_0x45f99e['attributes']:_0x32f399[_0x02af('0x30')];if(!_0x1c18e4[_0x02af('0x31')][_0x02af('0x36')]('nolimit')){_0x45f99e['limit']=qs[_0x02af('0x1f')](_0x1c18e4[_0x02af('0x31')][_0x02af('0x1f')]);_0x45f99e['offset']=qs[_0x02af('0x1e')](_0x1c18e4['query'][_0x02af('0x1e')]);}_0x45f99e['order']=qs[_0x02af('0x37')](_0x1c18e4[_0x02af('0x31')][_0x02af('0x37')]);_0x45f99e[_0x02af('0x38')]=qs[_0x02af('0x33')](_['pick'](_0x1c18e4['query'],_0x32f399[_0x02af('0x33')]),_0xa19452);if(_0x1c18e4[_0x02af('0x31')][_0x02af('0x39')]){_0x45f99e['where']=_[_0x02af('0x3a')](_0x45f99e[_0x02af('0x38')],{'$or':_[_0x02af('0x2b')](_0xa19452,function(_0x320b4a){if(_0x320b4a[_0x02af('0x2e')]!=='VIRTUAL'){var _0x523979={};_0x523979[_0x320b4a['name']]={'$like':'%'+_0x1c18e4[_0x02af('0x31')][_0x02af('0x39')]+'%'};return _0x523979;}})});}_0x45f99e=_[_0x02af('0x3a')]({},_0x45f99e,_0x1c18e4['options']);var _0x2131bf={'where':_0x45f99e['where']};return db[_0x02af('0x3b')]['count'](_0x2131bf)[_0x02af('0x26')](function(_0x47b829){_0x1c7ea3[_0x02af('0x21')]=_0x47b829;if(_0x1c18e4['query'][_0x02af('0x3c')]){_0x45f99e[_0x02af('0x3d')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x02af('0x3e')](_0x45f99e);})[_0x02af('0x26')](function(_0x1d1450){_0x1c7ea3['rows']=_0x1d1450;return _0x1c7ea3;})[_0x02af('0x26')](respondWithFilteredResult(_0x4fe714,_0x45f99e))['catch'](handleError(_0x4fe714,null));};exports['show']=function(_0x16302d,_0x881377){var _0x4c6ed0={'raw':![],'where':{'id':_0x16302d['params']['id']}},_0xecdcf4={};_0xecdcf4[_0x02af('0x30')]=_[_0x02af('0x32')](db[_0x02af('0x3b')]['rawAttributes']);_0xecdcf4[_0x02af('0x31')]=_[_0x02af('0x32')](_0x16302d['query']);_0xecdcf4['filters']=_[_0x02af('0x34')](_0xecdcf4[_0x02af('0x30')],_0xecdcf4['query']);_0x4c6ed0['attributes']=_[_0x02af('0x34')](_0xecdcf4[_0x02af('0x30')],qs['fields'](_0x16302d[_0x02af('0x31')][_0x02af('0x3f')]));_0x4c6ed0[_0x02af('0x35')]=_0x4c6ed0['attributes'][_0x02af('0x40')]?_0x4c6ed0['attributes']:_0xecdcf4[_0x02af('0x30')];if(_0x16302d[_0x02af('0x31')][_0x02af('0x3c')]){_0x4c6ed0[_0x02af('0x3d')]=[{'all':!![]}];}_0x4c6ed0=_['merge']({},_0x4c6ed0,_0x16302d[_0x02af('0x41')]);return db[_0x02af('0x3b')][_0x02af('0x42')](_0x4c6ed0)[_0x02af('0x26')](handleEntityNotFound(_0x881377,null))[_0x02af('0x26')](respondWithResult(_0x881377,null))[_0x02af('0x43')](handleError(_0x881377,null));};exports[_0x02af('0x44')]=function(_0x2190c8,_0x4c8bea){return db['ServicenowAccount'][_0x02af('0x44')](_0x2190c8[_0x02af('0x45')],{})[_0x02af('0x26')](respondWithResult(_0x4c8bea,0xc9))[_0x02af('0x43')](handleError(_0x4c8bea,null));};exports[_0x02af('0x25')]=function(_0x2690cf,_0xdca5b3){if(_0x2690cf[_0x02af('0x45')]['id']){delete _0x2690cf[_0x02af('0x45')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x2690cf[_0x02af('0x46')]['id']}})[_0x02af('0x26')](handleEntityNotFound(_0xdca5b3,null))[_0x02af('0x26')](saveUpdates(_0x2690cf[_0x02af('0x45')],null))['then'](respondWithResult(_0xdca5b3,null))[_0x02af('0x43')](handleError(_0xdca5b3,null));};exports[_0x02af('0x27')]=function(_0x55895b,_0x385dba){return db[_0x02af('0x3b')][_0x02af('0x42')]({'where':{'id':_0x55895b['params']['id']}})['then'](handleEntityNotFound(_0x385dba,null))[_0x02af('0x26')](removeEntity(_0x385dba,null))['catch'](handleError(_0x385dba,null));};exports['getConfigurations']=function(_0x49fc93,_0x486413,_0x455b25){var _0x59dacb={};var _0x1d8247={};var _0x4ecc77;var _0x30b234;return db[_0x02af('0x3b')][_0x02af('0x47')]({'where':{'id':_0x49fc93[_0x02af('0x46')]['id']}})[_0x02af('0x26')](handleEntityNotFound(_0x486413,null))['then'](function(_0x5b24a0){if(_0x5b24a0){_0x4ecc77=_0x5b24a0;_0x1d8247[_0x02af('0x30')]=_[_0x02af('0x32')](db[_0x02af('0x48')]['rawAttributes']);_0x1d8247[_0x02af('0x31')]=_[_0x02af('0x32')](_0x49fc93['query']);_0x1d8247[_0x02af('0x33')]=_[_0x02af('0x34')](_0x1d8247[_0x02af('0x30')],_0x1d8247['query']);_0x59dacb[_0x02af('0x35')]=_[_0x02af('0x34')](_0x1d8247['model'],qs[_0x02af('0x3f')](_0x49fc93[_0x02af('0x31')][_0x02af('0x3f')]));_0x59dacb[_0x02af('0x35')]=_0x59dacb[_0x02af('0x35')][_0x02af('0x40')]?_0x59dacb[_0x02af('0x35')]:_0x1d8247[_0x02af('0x30')];_0x59dacb[_0x02af('0x49')]=qs[_0x02af('0x37')](_0x49fc93[_0x02af('0x31')][_0x02af('0x37')]);_0x59dacb[_0x02af('0x38')]=qs[_0x02af('0x33')](_['pick'](_0x49fc93[_0x02af('0x31')],_0x1d8247[_0x02af('0x33')]));if(_0x49fc93[_0x02af('0x31')][_0x02af('0x39')]){_0x59dacb[_0x02af('0x38')]=_[_0x02af('0x3a')](_0x59dacb[_0x02af('0x38')],{'$or':_[_0x02af('0x2b')](_0x59dacb[_0x02af('0x35')],function(_0x1b8484){var _0x328649={};_0x328649[_0x1b8484]={'$like':'%'+_0x49fc93[_0x02af('0x31')][_0x02af('0x39')]+'%'};return _0x328649;})});}_0x59dacb=_['merge']({},_0x59dacb,_0x49fc93[_0x02af('0x41')]);return _0x4ecc77['getConfigurations'](_0x59dacb);}})[_0x02af('0x26')](function(_0x362922){if(_0x362922){_0x30b234=_0x362922['length'];if(!_0x49fc93['query'][_0x02af('0x36')](_0x02af('0x4a'))){_0x59dacb['limit']=qs['limit'](_0x49fc93[_0x02af('0x31')][_0x02af('0x1f')]);_0x59dacb[_0x02af('0x1e')]=qs[_0x02af('0x1e')](_0x49fc93[_0x02af('0x31')]['offset']);}return _0x4ecc77[_0x02af('0x4b')](_0x59dacb);}})[_0x02af('0x26')](function(_0x1d4863){if(_0x1d4863){return _0x1d4863?{'count':_0x30b234,'rows':_0x1d4863}:null;}})[_0x02af('0x26')](respondWithResult(_0x486413,null))[_0x02af('0x43')](handleError(_0x486413,null));};exports[_0x02af('0x4c')]=function(_0x1786e9,_0x11886a,_0x4a2980){if(_0x1786e9[_0x02af('0x45')]['id']){delete _0x1786e9[_0x02af('0x45')]['id'];}return db[_0x02af('0x3b')][_0x02af('0x47')]({'where':{'id':_0x1786e9[_0x02af('0x46')]['id']}})[_0x02af('0x26')](handleEntityNotFound(_0x11886a,null))['then'](function(_0x135873){if(_0x135873){_0x1786e9[_0x02af('0x45')][_0x02af('0x4d')]=_0x135873['id'];_0x1786e9[_0x02af('0x45')][_0x02af('0x4e')]=integrations[_0x02af('0x4f')](_0x1786e9['body'][_0x02af('0x50')],_0x1786e9[_0x02af('0x45')][_0x02af('0x2e')]);_0x1786e9[_0x02af('0x45')][_0x02af('0x51')]=integrations[_0x02af('0x52')](_0x1786e9[_0x02af('0x45')]['channel'],_0x1786e9['body'][_0x02af('0x2e')]);return db[_0x02af('0x48')]['create'](_0x1786e9[_0x02af('0x45')],{'include':[{'model':db[_0x02af('0x53')],'as':_0x02af('0x4e')},{'model':db[_0x02af('0x53')],'as':'Descriptions'}]});}return null;})[_0x02af('0x26')](respondWithResult(_0x11886a,null))['catch'](handleError(_0x11886a,null));};exports[_0x02af('0x54')]=function(_0x359d09,_0x5317ff,_0x8c8a10){var _0x524db4=[_0x02af('0x55'),_0x02af('0x56'),_0x02af('0x57'),_0x02af('0x58'),'close_code',_0x02af('0x59'),_0x02af('0x5a'),_0x02af('0x5b'),_0x02af('0x5c')];var _0x41f909=[_0x02af('0x5d'),_0x02af('0x55'),_0x02af('0x5e'),_0x02af('0x5f'),_0x02af('0x60'),_0x02af('0x61'),'child_incidents','hold_reason','approval_history',_0x02af('0x62'),'resolved_by','sys_updated_by',_0x02af('0x63'),_0x02af('0x64'),'sys_created_on',_0x02af('0x65'),_0x02af('0x66'),_0x02af('0x67'),'knowledge',_0x02af('0x49'),_0x02af('0x68'),_0x02af('0x69'),'cmdb_ci',_0x02af('0x6a'),_0x02af('0x6b'),'active',_0x02af('0x6c'),_0x02af('0x6d'),_0x02af('0x6e'),_0x02af('0x6f'),'rfc','time_worked',_0x02af('0x70'),_0x02af('0x71'),_0x02af('0x72'),_0x02af('0x73'),_0x02af('0x74'),_0x02af('0x75'),_0x02af('0x76'),_0x02af('0x77'),_0x02af('0x78'),'subcategory',_0x02af('0x79'),_0x02af('0x7a'),'close_code',_0x02af('0x7b'),'delivery_task',_0x02af('0x7c'),'assignment_group',_0x02af('0x7d'),_0x02af('0x7e'),_0x02af('0x7f'),_0x02af('0x80'),_0x02af('0x59'),_0x02af('0x81'),_0x02af('0x82'),'closed_by',_0x02af('0x83'),_0x02af('0x84'),_0x02af('0x85'),'contact_type',_0x02af('0x86'),_0x02af('0x5a'),'urgency',_0x02af('0x87'),_0x02af('0x88'),_0x02af('0x89'),_0x02af('0x8a'),_0x02af('0x8b'),_0x02af('0x5b'),_0x02af('0x8c'),'sla_due','approval',_0x02af('0x8d'),_0x02af('0x8e'),'sys_mod_count',_0x02af('0x8f'),_0x02af('0x90'),_0x02af('0x91'),_0x02af('0x92'),_0x02af('0x93'),_0x02af('0x94'),'category'];var _0x1fbae3='';var _0x5076f6='';var _0x248e93=[];var _0x253cc6='';var _0xd34792='';var _0x1fa30b=[];var _0x2110d7='';var _0x119b69='';var _0x190489={};var _0x1ba2a9='';return db[_0x02af('0x3b')][_0x02af('0x47')]({'where':{'id':_0x359d09[_0x02af('0x46')]['id']},'attributes':['id',_0x02af('0x95'),_0x02af('0x96'),_0x02af('0x97'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x5317ff,null))[_0x02af('0x26')](function(_0x4bff4c){if(_0x4bff4c){_0x1ba2a9=_0x4bff4c['remoteUri'];var _0x28c4de=_0x1ba2a9[_0x02af('0x98')](-0x1);if(_0x28c4de==='/'){_0x1ba2a9=_0x1ba2a9[_0x02af('0x99')](0x0,_0x1ba2a9[_0x02af('0x9a')](_0x28c4de));}_0x119b69=util['format'](_0x02af('0x9b'),_0x1ba2a9);_0x2110d7=util[_0x02af('0x9c')]('%s/api/now/table/',_0x1ba2a9);_0x190489={'user':_0x4bff4c['username'],'pass':_0x4bff4c[_0x02af('0x96')]};var _0x3e26d9={'method':_0x02af('0x9d'),'uri':_0x119b69+_0x02af('0x9e'),'auth':_0x190489,'json':!![]};return rp(_0x3e26d9);}})['then'](function(_0x10aad9){if(_0x10aad9[_0x02af('0x9f')][_0x02af('0x40')]>0x0){_0x1fbae3=_0x10aad9[_0x02af('0x9f')];}console[_0x02af('0xa0')](_0x02af('0xa1'),_0x1fbae3);_0x1fa30b=[];_0x5076f6=Object[_0x02af('0xa2')]([],_0x1fbae3);_['remove'](_0x5076f6,function(_0x37f392){return!_0x524db4[_0x02af('0xa3')](_0x37f392[_0x02af('0x29')]);});_0x5076f6[_0x02af('0xa4')](function(_0x168bf4){var _0x526cd0=createFieldObject(_0x2110d7,_0x190489,_0x168bf4['internalType'],_0x168bf4['name'],_0x168bf4[_0x02af('0xa5')],![]);_0x1fa30b['push'](_0x526cd0);});return Promise['all'](_0x1fa30b);})[_0x02af('0x26')](function(_0x22cf6e){_0x248e93=_0x22cf6e;_0x253cc6=Object['assign']([],_0x1fbae3);console[_0x02af('0xa0')](_0x02af('0xa6'),_0x1fbae3);_[_0x02af('0xa7')](_0x253cc6,function(_0x352f5b){return _0x41f909[_0x02af('0xa3')](_0x352f5b[_0x02af('0x29')]);});console[_0x02af('0xa0')](_0x02af('0xa8'),_0x253cc6);_0x1fa30b=[];_0x253cc6[_0x02af('0xa4')](function(_0x3a9094){var _0x2b145a=createFieldObject(_0x2110d7,_0x190489,_0x3a9094[_0x02af('0xa9')],_0x3a9094['name'],_0x3a9094[_0x02af('0xa5')],!![]);_0x1fa30b[_0x02af('0xaa')](_0x2b145a);});return Promise[_0x02af('0xab')](_0x1fa30b);})[_0x02af('0x26')](function(_0x1a6020){_0xd34792=_0x1a6020;var _0x363cc6=_0x248e93[_0x02af('0xac')](_0xd34792);return{'count':_0x363cc6[_0x02af('0x40')],'rows':_0x363cc6};})['then'](respondWithResult(_0x5317ff,null))[_0x02af('0x43')](function(_0x128c4b){console[_0x02af('0xa0')](_0x02af('0xad')+_0x128c4b);var _0x11e378=_0x359d09[_0x02af('0x31')]['test']?0x1f4:_0x128c4b[_0x02af('0xae')]||0x1f4;logger[_0x02af('0x28')](_0x128c4b[_0x02af('0xaf')]);delete _0x128c4b['name'];if(_0x11e378===0x191){_0x11e378=0x190;}_0x5317ff[_0x02af('0x1b')](_0x11e378)['send'](_0x359d09[_0x02af('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x128c4b[_0x02af('0xae')]}:_0x128c4b);});};function createFieldObject(_0x3ed67e,_0x13e8c2,_0x462e74,_0x41d7e4,_0x31e346,_0x159f1c){return new Promise(function(_0x3b8f63,_0x329e8d){var _0x136f7d={'id':_0x41d7e4,'name':_0x31e346,'custom':_0x159f1c};if(_0x462e74===_0x02af('0xb0')){_0x136f7d[_0x02af('0x41')]=[{'name':_0x02af('0xb1'),'value':_0x02af('0xb2')},{'name':_0x02af('0xb3'),'value':_0x02af('0xb4')}];_0x3b8f63(_0x136f7d);}else{var _0x3b7d73={'method':_0x02af('0x9d'),'uri':_0x3ed67e+'sys_choice?sysparm_query=name=incident^element='+_0x41d7e4,'auth':_0x13e8c2,'json':!![]};return rp(_0x3b7d73)[_0x02af('0x26')](function(_0x4d2648){var _0x2c9801=[];if(_0x4d2648['result'][_0x02af('0x40')]>0x0){_0x4d2648['result']['forEach'](function(_0x16b1f4){if(_0x16b1f4[_0x02af('0xb5')]===_0x02af('0xb4')){var _0x2b751c={'name':_0x16b1f4[_0x02af('0xa5')],'value':_0x16b1f4[_0x02af('0xb6')]};_0x2c9801[_0x02af('0xaa')](_0x2b751c);}});}_0x136f7d[_0x02af('0x41')]=_0x2c9801;if(_0x136f7d[_0x02af('0x41')]['length']>0x0){_0x3b8f63(_0x136f7d);}else{if(_0x159f1c==![]){_0x3b8f63();}else{_0x3b8f63(_0x136f7d);}}});}});} \ No newline at end of file +var _0x543e=['parent_incident','sys_id','reopened_by','problem_id','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','category','username','serverUrl','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','assign','includes','forEach','internalType','label','push','all','remove','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','send','Wrong\x20credentials','True','true','False','false','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','end','error','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','parent','made_sla','caused_by','child_incidents','approval_history','resolved_by','opened_by','user_input','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','work_start','assignment_group','business_stc','calendar_duration','notify','sys_class_name','closed_by','follow_up'];(function(_0x34ecbf,_0x210898){var _0x115f8a=function(_0x559567){while(--_0x559567){_0x34ecbf['push'](_0x34ecbf['shift']());}};_0x115f8a(++_0x210898);}(_0x543e,0xe6));var _0xe543=function(_0xbefcf8,_0x35ecee){_0xbefcf8=_0xbefcf8-0x0;var _0x2aece2=_0x543e[_0xbefcf8];return _0x2aece2;};'use strict';var emlformat=require(_0xe543('0x0'));var rimraf=require(_0xe543('0x1'));var zipdir=require(_0xe543('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe543('0x3'));var moment=require(_0xe543('0x4'));var BPromise=require(_0xe543('0x5'));var Mustache=require(_0xe543('0x6'));var util=require(_0xe543('0x7'));var path=require(_0xe543('0x8'));var sox=require('sox');var csv=require(_0xe543('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe543('0xa'));var _=require(_0xe543('0xb'));var squel=require(_0xe543('0xc'));var crypto=require('crypto');var jsforce=require(_0xe543('0xd'));var deskjs=require(_0xe543('0xe'));var toCsv=require(_0xe543('0x9'));var querystring=require('querystring');var Papa=require(_0xe543('0xf'));var Redis=require(_0xe543('0x10'));var authService=require(_0xe543('0x11'));var qs=require(_0xe543('0x12'));var as=require(_0xe543('0x13'));var hardwareService=require(_0xe543('0x14'));var logger=require(_0xe543('0x15'))('api');var utils=require(_0xe543('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe543('0x17'));var db=require(_0xe543('0x18'))['db'];var integrations=require(_0xe543('0x19'));function respondWithStatusCode(_0x1150f0,_0x3c5bc9){_0x3c5bc9=_0x3c5bc9||0xcc;return function(_0x5662){if(_0x5662){return _0x1150f0[_0xe543('0x1a')](_0x3c5bc9);}return _0x1150f0['status'](_0x3c5bc9)['end']();};}function respondWithResult(_0x3997b4,_0x3c13b7){_0x3c13b7=_0x3c13b7||0xc8;return function(_0x404dd0){if(_0x404dd0){return _0x3997b4['status'](_0x3c13b7)[_0xe543('0x1b')](_0x404dd0);}};}function respondWithFilteredResult(_0x12b71f,_0x32a3a2){return function(_0xea70bd){if(_0xea70bd){var _0x583ab2=typeof _0x32a3a2[_0xe543('0x1c')]===_0xe543('0x1d')&&typeof _0x32a3a2[_0xe543('0x1e')]==='undefined';var _0x60959d=_0xea70bd[_0xe543('0x1f')];var _0x5df30e=_0x583ab2?0x0:_0x32a3a2[_0xe543('0x1c')];var _0xd595b0=_0x583ab2?_0xea70bd['count']:_0x32a3a2[_0xe543('0x1c')]+_0x32a3a2[_0xe543('0x1e')];var _0x4f64e3;if(_0xd595b0>=_0x60959d){_0xd595b0=_0x60959d;_0x4f64e3=0xc8;}else{_0x4f64e3=0xce;}_0x12b71f[_0xe543('0x20')](_0x4f64e3);return _0x12b71f[_0xe543('0x21')](_0xe543('0x22'),_0x5df30e+'-'+_0xd595b0+'/'+_0x60959d)[_0xe543('0x1b')](_0xea70bd);}return null;};}function patchUpdates(_0x2ecd1d){return function(_0x14878a){try{jsonpatch[_0xe543('0x23')](_0x14878a,_0x2ecd1d,!![]);}catch(_0x3b3629){return BPromise[_0xe543('0x24')](_0x3b3629);}return _0x14878a['save']();};}function saveUpdates(_0x5f57e3,_0x4e14e7){return function(_0x4692c1){if(_0x4692c1){return _0x4692c1[_0xe543('0x25')](_0x5f57e3)['then'](function(_0x58eadb){return _0x58eadb;});}return null;};}function removeEntity(_0x5dbfab,_0x406a6a){return function(_0x565871){if(_0x565871){return _0x565871['destroy']()['then'](function(){_0x5dbfab[_0xe543('0x20')](0xcc)[_0xe543('0x26')]();});}};}function handleEntityNotFound(_0x5aa192,_0x43c89a){return function(_0x2309a3){if(!_0x2309a3){_0x5aa192[_0xe543('0x1a')](0x194);}return _0x2309a3;};}function handleError(_0x399d85,_0xc22738){_0xc22738=_0xc22738||0x1f4;return function(_0x3b33ce){logger[_0xe543('0x27')](_0x3b33ce['stack']);if(_0x3b33ce[_0xe543('0x28')]){delete _0x3b33ce[_0xe543('0x28')];}_0x399d85[_0xe543('0x20')](_0xc22738)['send'](_0x3b33ce);};}exports[_0xe543('0x29')]=function(_0x39ed98,_0x11900f){var _0x269698={},_0x594c85={},_0x2f7911={'count':0x0,'rows':[]};var _0xf7daf=_[_0xe543('0x2a')](db[_0xe543('0x2b')][_0xe543('0x2c')],function(_0x3cb3d5){return{'name':_0x3cb3d5[_0xe543('0x2d')],'type':_0x3cb3d5[_0xe543('0x2e')][_0xe543('0x2f')]};});_0x594c85[_0xe543('0x30')]=_[_0xe543('0x2a')](_0xf7daf,'name');_0x594c85[_0xe543('0x31')]=_['keys'](_0x39ed98['query']);_0x594c85['filters']=_[_0xe543('0x32')](_0x594c85[_0xe543('0x30')],_0x594c85['query']);_0x269698[_0xe543('0x33')]=_[_0xe543('0x32')](_0x594c85[_0xe543('0x30')],qs[_0xe543('0x34')](_0x39ed98['query'][_0xe543('0x34')]));_0x269698[_0xe543('0x33')]=_0x269698[_0xe543('0x33')][_0xe543('0x35')]?_0x269698['attributes']:_0x594c85[_0xe543('0x30')];if(!_0x39ed98[_0xe543('0x31')][_0xe543('0x36')](_0xe543('0x37'))){_0x269698['limit']=qs[_0xe543('0x1e')](_0x39ed98[_0xe543('0x31')][_0xe543('0x1e')]);_0x269698[_0xe543('0x1c')]=qs[_0xe543('0x1c')](_0x39ed98[_0xe543('0x31')][_0xe543('0x1c')]);}_0x269698[_0xe543('0x38')]=qs[_0xe543('0x39')](_0x39ed98['query']['sort']);_0x269698[_0xe543('0x3a')]=qs[_0xe543('0x3b')](_[_0xe543('0x3c')](_0x39ed98[_0xe543('0x31')],_0x594c85['filters']),_0xf7daf);if(_0x39ed98['query'][_0xe543('0x3d')]){_0x269698[_0xe543('0x3a')]=_[_0xe543('0x3e')](_0x269698[_0xe543('0x3a')],{'$or':_[_0xe543('0x2a')](_0xf7daf,function(_0x5bb2c4){if(_0x5bb2c4[_0xe543('0x2e')]!==_0xe543('0x3f')){var _0x6a8f1b={};_0x6a8f1b[_0x5bb2c4[_0xe543('0x28')]]={'$like':'%'+_0x39ed98[_0xe543('0x31')][_0xe543('0x3d')]+'%'};return _0x6a8f1b;}})});}_0x269698=_['merge']({},_0x269698,_0x39ed98[_0xe543('0x40')]);var _0x10609f={'where':_0x269698[_0xe543('0x3a')]};return db[_0xe543('0x2b')]['count'](_0x10609f)[_0xe543('0x41')](function(_0x30115f){_0x2f7911[_0xe543('0x1f')]=_0x30115f;if(_0x39ed98[_0xe543('0x31')][_0xe543('0x42')]){_0x269698[_0xe543('0x43')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xe543('0x44')](_0x269698);})['then'](function(_0x14b278){_0x2f7911['rows']=_0x14b278;return _0x2f7911;})[_0xe543('0x41')](respondWithFilteredResult(_0x11900f,_0x269698))[_0xe543('0x45')](handleError(_0x11900f,null));};exports[_0xe543('0x46')]=function(_0x20fe4a,_0xeff25c){var _0x41b8e6={'raw':![],'where':{'id':_0x20fe4a[_0xe543('0x47')]['id']}},_0x530b5e={};_0x530b5e[_0xe543('0x30')]=_[_0xe543('0x48')](db[_0xe543('0x2b')][_0xe543('0x2c')]);_0x530b5e[_0xe543('0x31')]=_[_0xe543('0x48')](_0x20fe4a[_0xe543('0x31')]);_0x530b5e[_0xe543('0x3b')]=_[_0xe543('0x32')](_0x530b5e[_0xe543('0x30')],_0x530b5e[_0xe543('0x31')]);_0x41b8e6[_0xe543('0x33')]=_[_0xe543('0x32')](_0x530b5e['model'],qs[_0xe543('0x34')](_0x20fe4a['query'][_0xe543('0x34')]));_0x41b8e6[_0xe543('0x33')]=_0x41b8e6['attributes']['length']?_0x41b8e6['attributes']:_0x530b5e['model'];if(_0x20fe4a[_0xe543('0x31')][_0xe543('0x42')]){_0x41b8e6[_0xe543('0x43')]=[{'all':!![]}];}_0x41b8e6=_[_0xe543('0x3e')]({},_0x41b8e6,_0x20fe4a[_0xe543('0x40')]);return db[_0xe543('0x2b')][_0xe543('0x49')](_0x41b8e6)['then'](handleEntityNotFound(_0xeff25c,null))['then'](respondWithResult(_0xeff25c,null))[_0xe543('0x45')](handleError(_0xeff25c,null));};exports[_0xe543('0x4a')]=function(_0x8aae87,_0x32c43e){return db[_0xe543('0x2b')]['create'](_0x8aae87[_0xe543('0x4b')],{})[_0xe543('0x41')](respondWithResult(_0x32c43e,0xc9))['catch'](handleError(_0x32c43e,null));};exports[_0xe543('0x25')]=function(_0x21d634,_0x3f9080){if(_0x21d634[_0xe543('0x4b')]['id']){delete _0x21d634['body']['id'];}return db[_0xe543('0x2b')]['find']({'where':{'id':_0x21d634['params']['id']}})[_0xe543('0x41')](handleEntityNotFound(_0x3f9080,null))[_0xe543('0x41')](saveUpdates(_0x21d634[_0xe543('0x4b')],null))[_0xe543('0x41')](respondWithResult(_0x3f9080,null))['catch'](handleError(_0x3f9080,null));};exports[_0xe543('0x4c')]=function(_0x315337,_0x30cb9a){return db[_0xe543('0x2b')][_0xe543('0x49')]({'where':{'id':_0x315337['params']['id']}})[_0xe543('0x41')](handleEntityNotFound(_0x30cb9a,null))['then'](removeEntity(_0x30cb9a,null))[_0xe543('0x45')](handleError(_0x30cb9a,null));};exports[_0xe543('0x4d')]=function(_0x366416,_0x1d7baa,_0x26c049){var _0x45a07f={};var _0x4ebd02={};var _0x1cc099;var _0x5c5a1c;return db['ServicenowAccount'][_0xe543('0x4e')]({'where':{'id':_0x366416[_0xe543('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d7baa,null))[_0xe543('0x41')](function(_0x267793){if(_0x267793){_0x1cc099=_0x267793;_0x4ebd02[_0xe543('0x30')]=_[_0xe543('0x48')](db[_0xe543('0x4f')]['rawAttributes']);_0x4ebd02[_0xe543('0x31')]=_['keys'](_0x366416[_0xe543('0x31')]);_0x4ebd02[_0xe543('0x3b')]=_[_0xe543('0x32')](_0x4ebd02[_0xe543('0x30')],_0x4ebd02['query']);_0x45a07f['attributes']=_['intersection'](_0x4ebd02['model'],qs['fields'](_0x366416[_0xe543('0x31')]['fields']));_0x45a07f[_0xe543('0x33')]=_0x45a07f[_0xe543('0x33')][_0xe543('0x35')]?_0x45a07f[_0xe543('0x33')]:_0x4ebd02[_0xe543('0x30')];_0x45a07f[_0xe543('0x38')]=qs['sort'](_0x366416[_0xe543('0x31')][_0xe543('0x39')]);_0x45a07f['where']=qs[_0xe543('0x3b')](_['pick'](_0x366416[_0xe543('0x31')],_0x4ebd02[_0xe543('0x3b')]));if(_0x366416[_0xe543('0x31')][_0xe543('0x3d')]){_0x45a07f[_0xe543('0x3a')]=_['merge'](_0x45a07f[_0xe543('0x3a')],{'$or':_[_0xe543('0x2a')](_0x45a07f['attributes'],function(_0x275e3b){var _0x34c02a={};_0x34c02a[_0x275e3b]={'$like':'%'+_0x366416[_0xe543('0x31')][_0xe543('0x3d')]+'%'};return _0x34c02a;})});}_0x45a07f=_[_0xe543('0x3e')]({},_0x45a07f,_0x366416['options']);return _0x1cc099['getConfigurations'](_0x45a07f);}})['then'](function(_0x1b19c0){if(_0x1b19c0){_0x5c5a1c=_0x1b19c0['length'];if(!_0x366416[_0xe543('0x31')]['hasOwnProperty'](_0xe543('0x37'))){_0x45a07f[_0xe543('0x1e')]=qs[_0xe543('0x1e')](_0x366416[_0xe543('0x31')][_0xe543('0x1e')]);_0x45a07f['offset']=qs[_0xe543('0x1c')](_0x366416[_0xe543('0x31')][_0xe543('0x1c')]);}return _0x1cc099[_0xe543('0x4d')](_0x45a07f);}})[_0xe543('0x41')](function(_0xf882b7){if(_0xf882b7){return _0xf882b7?{'count':_0x5c5a1c,'rows':_0xf882b7}:null;}})['then'](respondWithResult(_0x1d7baa,null))[_0xe543('0x45')](handleError(_0x1d7baa,null));};exports[_0xe543('0x50')]=function(_0x40b422,_0x42ea55,_0x760ca5){if(_0x40b422['body']['id']){delete _0x40b422[_0xe543('0x4b')]['id'];}return db[_0xe543('0x2b')][_0xe543('0x4e')]({'where':{'id':_0x40b422[_0xe543('0x47')]['id']}})[_0xe543('0x41')](handleEntityNotFound(_0x42ea55,null))[_0xe543('0x41')](function(_0x32d30f){if(_0x32d30f){_0x40b422['body'][_0xe543('0x51')]=_0x32d30f['id'];_0x40b422['body'][_0xe543('0x52')]=integrations[_0xe543('0x53')](_0x40b422[_0xe543('0x4b')][_0xe543('0x54')],_0x40b422[_0xe543('0x4b')][_0xe543('0x2e')]);_0x40b422[_0xe543('0x4b')]['Descriptions']=integrations[_0xe543('0x55')](_0x40b422[_0xe543('0x4b')]['channel'],_0x40b422[_0xe543('0x4b')][_0xe543('0x2e')]);return db[_0xe543('0x4f')][_0xe543('0x4a')](_0x40b422[_0xe543('0x4b')],{'include':[{'model':db['ServicenowField'],'as':_0xe543('0x52')},{'model':db['ServicenowField'],'as':_0xe543('0x56')}]});}return null;})['then'](respondWithResult(_0x42ea55,null))[_0xe543('0x45')](handleError(_0x42ea55,null));};exports[_0xe543('0x57')]=function(_0x40da0d,_0x20d3de,_0xcadbdb){var _0x4c4056=['made_sla',_0xe543('0x58'),_0xe543('0x59'),_0xe543('0x5a'),_0xe543('0x5b'),'notify','incident_state','severity','category'];var _0x16c753=[_0xe543('0x5c'),_0xe543('0x5d'),_0xe543('0x5e'),'watch_list','upon_reject','sys_updated_on',_0xe543('0x5f'),_0xe543('0x58'),_0xe543('0x60'),'number',_0xe543('0x61'),'sys_updated_by',_0xe543('0x62'),_0xe543('0x63'),'sys_created_on','sys_domain','state',_0xe543('0x64'),'knowledge',_0xe543('0x38'),_0xe543('0x65'),_0xe543('0x66'),_0xe543('0x67'),_0xe543('0x68'),_0xe543('0x69'),_0xe543('0x6a'),_0xe543('0x6b'),_0xe543('0x6c'),_0xe543('0x6d'),_0xe543('0x6e'),_0xe543('0x6f'),_0xe543('0x70'),_0xe543('0x71'),_0xe543('0x72'),_0xe543('0x73'),_0xe543('0x74'),_0xe543('0x75'),_0xe543('0x76'),_0xe543('0x77'),_0xe543('0x78'),_0xe543('0x79'),_0xe543('0x5a'),_0xe543('0x7a'),'short_description',_0xe543('0x5b'),_0xe543('0x7b'),'delivery_task',_0xe543('0x7c'),_0xe543('0x7d'),_0xe543('0x7e'),'additional_assignee_list','description',_0xe543('0x7f'),_0xe543('0x80'),_0xe543('0x81'),'close_notes',_0xe543('0x82'),_0xe543('0x83'),_0xe543('0x84'),_0xe543('0x85'),'contact_type',_0xe543('0x86'),'incident_state','urgency',_0xe543('0x87'),'company',_0xe543('0x88'),_0xe543('0x89'),_0xe543('0x8a'),_0xe543('0x8b'),_0xe543('0x8c'),_0xe543('0x8d'),_0xe543('0x8e'),_0xe543('0x8f'),_0xe543('0x90'),_0xe543('0x91'),_0xe543('0x92'),_0xe543('0x93'),_0xe543('0x94'),_0xe543('0x95'),'correlation_id',_0xe543('0x96'),_0xe543('0x97')];var _0x483673='';var _0x361b42='';var _0x4ff75f=[];var _0x3984f4='';var _0x12e673='';var _0x247957=[];var _0x445431='';var _0x7a117f='';var _0x5b8750={};var _0x2afd2b='';return db[_0xe543('0x2b')][_0xe543('0x4e')]({'where':{'id':_0x40da0d['params']['id']},'attributes':['id',_0xe543('0x98'),'password','email','remoteUri',_0xe543('0x99')]})[_0xe543('0x41')](handleEntityNotFound(_0x20d3de,null))['then'](function(_0x11c62c){if(_0x11c62c){_0x2afd2b=_0x11c62c[_0xe543('0x9a')];var _0x21c01c=_0x2afd2b['slice'](-0x1);if(_0x21c01c==='/'){_0x2afd2b=_0x2afd2b[_0xe543('0x9b')](0x0,_0x2afd2b[_0xe543('0x9c')](_0x21c01c));}_0x7a117f=util[_0xe543('0x9d')](_0xe543('0x9e'),_0x2afd2b);_0x445431=util['format'](_0xe543('0x9f'),_0x2afd2b);_0x5b8750={'user':_0x11c62c[_0xe543('0x98')],'pass':_0x11c62c['password']};var _0xde1996={'method':_0xe543('0xa0'),'uri':_0x7a117f+_0xe543('0xa1'),'auth':_0x5b8750,'json':!![]};return rp(_0xde1996);}})[_0xe543('0x41')](function(_0x4cc74c){if(_0x4cc74c[_0xe543('0xa2')][_0xe543('0x35')]>0x0){_0x483673=_0x4cc74c[_0xe543('0xa2')];}console['log']('incident\x20table\x20objects',_0x483673);_0x247957=[];_0x361b42=Object[_0xe543('0xa3')]([],_0x483673);_['remove'](_0x361b42,function(_0x309983){return!_0x4c4056[_0xe543('0xa4')](_0x309983[_0xe543('0x28')]);});_0x361b42[_0xe543('0xa5')](function(_0x312e0c){var _0x34649c=createFieldObject(_0x445431,_0x5b8750,_0x312e0c[_0xe543('0xa6')],_0x312e0c['name'],_0x312e0c[_0xe543('0xa7')],![]);_0x247957[_0xe543('0xa8')](_0x34649c);});return Promise[_0xe543('0xa9')](_0x247957);})[_0xe543('0x41')](function(_0x47a564){_0x4ff75f=_0x47a564;_0x3984f4=Object[_0xe543('0xa3')]([],_0x483673);console['log']('TCL:\x20_object',_0x483673);_[_0xe543('0xaa')](_0x3984f4,function(_0x1f5333){return _0x16c753[_0xe543('0xa4')](_0x1f5333[_0xe543('0x28')]);});console[_0xe543('0xab')](_0xe543('0xac'),_0x3984f4);_0x247957=[];_0x3984f4[_0xe543('0xa5')](function(_0x44a8f6){var _0x17f774=createFieldObject(_0x445431,_0x5b8750,_0x44a8f6[_0xe543('0xa6')],_0x44a8f6[_0xe543('0x28')],_0x44a8f6[_0xe543('0xa7')],!![]);_0x247957[_0xe543('0xa8')](_0x17f774);});return Promise[_0xe543('0xa9')](_0x247957);})[_0xe543('0x41')](function(_0x453520){_0x12e673=_0x453520;var _0x26dac9=_0x4ff75f['concat'](_0x12e673);return{'count':_0x26dac9[_0xe543('0x35')],'rows':_0x26dac9};})['then'](respondWithResult(_0x20d3de,null))[_0xe543('0x45')](function(_0x4dffcf){console[_0xe543('0xab')](_0xe543('0xad')+_0x4dffcf);var _0x3a7cbc=_0x40da0d[_0xe543('0x31')][_0xe543('0xae')]?0x1f4:_0x4dffcf['statusCode']||0x1f4;logger[_0xe543('0x27')](_0x4dffcf['stack']);delete _0x4dffcf[_0xe543('0x28')];if(_0x3a7cbc===0x191){_0x3a7cbc=0x190;}_0x20d3de['status'](_0x3a7cbc)[_0xe543('0xaf')](_0x40da0d['query'][_0xe543('0xae')]?{'message':_0xe543('0xb0'),'statusCode':_0x4dffcf['statusCode']}:_0x4dffcf);});};function createFieldObject(_0x28ac31,_0x4bce5b,_0x462da0,_0x48d97f,_0x3158fe,_0xa21570){return new Promise(function(_0x109ce9,_0x304056){var _0x44410e={'id':_0x48d97f,'name':_0x3158fe,'custom':_0xa21570};if(_0x462da0==='boolean'){_0x44410e[_0xe543('0x40')]=[{'name':_0xe543('0xb1'),'value':_0xe543('0xb2')},{'name':_0xe543('0xb3'),'value':_0xe543('0xb4')}];_0x109ce9(_0x44410e);}else{var _0x56eae5={'method':_0xe543('0xa0'),'uri':_0x28ac31+'sys_choice?sysparm_query=name=incident^element='+_0x48d97f,'auth':_0x4bce5b,'json':!![]};return rp(_0x56eae5)[_0xe543('0x41')](function(_0x4d9182){var _0x2eadb1=[];if(_0x4d9182[_0xe543('0xa2')][_0xe543('0x35')]>0x0){_0x4d9182[_0xe543('0xa2')]['forEach'](function(_0x2f7508){if(_0x2f7508['inactive']==='false'){var _0x2a81e4={'name':_0x2f7508[_0xe543('0xa7')],'value':_0x2f7508['value']};_0x2eadb1[_0xe543('0xa8')](_0x2a81e4);}});}_0x44410e['options']=_0x2eadb1;if(_0x44410e[_0xe543('0x40')]['length']>0x0){_0x109ce9(_0x44410e);}else{if(_0xa21570==![]){_0x109ce9();}else{_0x109ce9(_0x44410e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f93e2b6..ba1f18e 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 _0xafc4=['path','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x7cf518,_0x1d5328){var _0x405d63=function(_0x57f025){while(--_0x57f025){_0x7cf518['push'](_0x7cf518['shift']());}};_0x405d63(++_0x1d5328);}(_0xafc4,0x69));var _0x4afc=function(_0x456295,_0x3615b5){_0x456295=_0x456295-0x0;var _0x40e0d7=_0xafc4[_0x456295];return _0x40e0d7;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x4afc('0x6'));module[_0x4afc('0x7')]=function(_0x16953b,_0x1bb281){return _0x16953b[_0x4afc('0x8')](_0x4afc('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x57da40,_0x1a3fe6){var _0x34df4f=function(_0x3e3d90){while(--_0x3e3d90){_0x57da40['push'](_0x57da40['shift']());}};_0x34df4f(++_0x1a3fe6);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x186020,_0x1fc7f9){_0x186020=_0x186020-0x0;var _0x30380a=_0xfdbd[_0x186020];return _0x30380a;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('0xb'),'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 b81d45c..be567c6 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 _0x7702=['message','result','GetServicenowAccount','ServicenowAccount','findAll','options','attributes','limit','include','map','model','info','debug','catch','ShowServicenowAccount','find','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x56d4b9,_0x56b68b){var _0x51d960=function(_0x4992f7){while(--_0x4992f7){_0x56d4b9['push'](_0x56d4b9['shift']());}};_0x51d960(++_0x56b68b);}(_0x7702,0x1b6));var _0x2770=function(_0x19d344,_0x2fd503){_0x19d344=_0x19d344-0x0;var _0x4decef=_0x7702[_0x19d344];return _0x4decef;};'use strict';var _=require('lodash');var util=require(_0x2770('0x0'));var moment=require('moment');var BPromise=require(_0x2770('0x1'));var rs=require(_0x2770('0x2'));var fs=require('fs');var Redis=require(_0x2770('0x3'));var db=require(_0x2770('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2770('0x5'))(_0x2770('0x6'));var config=require(_0x2770('0x7'));var jayson=require(_0x2770('0x8'));var client=jayson['client'][_0x2770('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x471eb6,_0x26bb8d,_0x5abb28){return new BPromise(function(_0x3cce67,_0x3e2e7f){return client[_0x2770('0xa')](_0x471eb6,_0x5abb28)[_0x2770('0xb')](function(_0x1b0d84){logger['info'](_0x2770('0xc'),_0x26bb8d,_0x2770('0xd'));logger['debug'](_0x2770('0xe'),_0x26bb8d,_0x2770('0xd'),JSON[_0x2770('0xf')](_0x1b0d84));if(_0x1b0d84['error']){if(_0x1b0d84['error']['code']===0x1f4){logger['error'](_0x2770('0xc'),_0x26bb8d,_0x1b0d84[_0x2770('0x10')]['message']);return _0x3e2e7f(_0x1b0d84[_0x2770('0x10')][_0x2770('0x11')]);}logger[_0x2770('0x10')](_0x2770('0xc'),_0x26bb8d,_0x1b0d84[_0x2770('0x10')][_0x2770('0x11')]);return _0x3cce67(_0x1b0d84[_0x2770('0x10')][_0x2770('0x11')]);}else{logger['info'](_0x2770('0xc'),_0x26bb8d,_0x2770('0xd'));_0x3cce67(_0x1b0d84[_0x2770('0x12')]['message']);}})['catch'](function(_0x35866a){logger[_0x2770('0x10')](_0x2770('0xc'),_0x26bb8d,_0x35866a);_0x3e2e7f(_0x35866a);});});}exports[_0x2770('0x13')]=function(_0x236e17){var _0x5bece8=this;return new Promise(function(_0x47178a,_0x466252){return db[_0x2770('0x14')][_0x2770('0x15')]({'raw':_0x236e17[_0x2770('0x16')]?_0x236e17[_0x2770('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x236e17['options']?_0x236e17['options']['where']||null:null,'attributes':_0x236e17['options']?_0x236e17[_0x2770('0x16')][_0x2770('0x17')]||null:null,'limit':_0x236e17[_0x2770('0x16')]?_0x236e17[_0x2770('0x16')][_0x2770('0x18')]||null:null,'include':_0x236e17['options']?_0x236e17[_0x2770('0x16')][_0x2770('0x19')]?_[_0x2770('0x1a')](_0x236e17[_0x2770('0x16')][_0x2770('0x19')],function(_0x2e0fa8){return{'model':db[_0x2e0fa8[_0x2770('0x1b')]],'as':_0x2e0fa8['as'],'attributes':_0x2e0fa8[_0x2770('0x17')],'include':_0x2e0fa8[_0x2770('0x19')]?_[_0x2770('0x1a')](_0x2e0fa8[_0x2770('0x19')],function(_0x37d596){return{'model':db[_0x37d596[_0x2770('0x1b')]],'as':_0x37d596['as'],'attributes':_0x37d596[_0x2770('0x17')],'include':_0x37d596[_0x2770('0x19')]?_[_0x2770('0x1a')](_0x37d596[_0x2770('0x19')],function(_0x2cce3f){return{'model':db[_0x2cce3f[_0x2770('0x1b')]],'as':_0x2cce3f['as'],'attributes':_0x2cce3f['attributes']};}):[]};}):[]};}):[]:[]})[_0x2770('0xb')](function(_0x58e485){logger[_0x2770('0x1c')](_0x2770('0x13'),_0x236e17);logger[_0x2770('0x1d')](_0x2770('0x13'),_0x236e17,JSON[_0x2770('0xf')](_0x58e485));_0x47178a(_0x58e485);})[_0x2770('0x1e')](function(_0x3d7f13){logger[_0x2770('0x10')](_0x2770('0x13'),_0x3d7f13[_0x2770('0x11')],_0x236e17);_0x466252(_0x5bece8[_0x2770('0x10')](0x1f4,_0x3d7f13['message']));});});};exports[_0x2770('0x1f')]=function(_0xb3779d){var _0x3ed3cd=this;return new Promise(function(_0x3be128,_0x37a941){return db[_0x2770('0x14')][_0x2770('0x20')]({'raw':_0xb3779d[_0x2770('0x16')]?_0xb3779d['options'][_0x2770('0x21')]===undefined?!![]:![]:!![],'where':_0xb3779d[_0x2770('0x16')]?_0xb3779d[_0x2770('0x16')][_0x2770('0x22')]||null:null,'attributes':_0xb3779d[_0x2770('0x16')]?_0xb3779d[_0x2770('0x16')][_0x2770('0x17')]||null:null,'include':_0xb3779d['options']?_0xb3779d['options'][_0x2770('0x19')]?_[_0x2770('0x1a')](_0xb3779d[_0x2770('0x16')][_0x2770('0x19')],function(_0x1fcf6f){return{'model':db[_0x1fcf6f[_0x2770('0x1b')]],'as':_0x1fcf6f['as'],'attributes':_0x1fcf6f[_0x2770('0x17')],'include':_0x1fcf6f[_0x2770('0x19')]?_[_0x2770('0x1a')](_0x1fcf6f[_0x2770('0x19')],function(_0x181756){return{'model':db[_0x181756[_0x2770('0x1b')]],'as':_0x181756['as'],'attributes':_0x181756[_0x2770('0x17')],'include':_0x181756[_0x2770('0x19')]?_[_0x2770('0x1a')](_0x181756['include'],function(_0x40a10d){return{'model':db[_0x40a10d[_0x2770('0x1b')]],'as':_0x40a10d['as'],'attributes':_0x40a10d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2770('0xb')](function(_0x2613db){logger[_0x2770('0x1c')](_0x2770('0x1f'),_0xb3779d);logger[_0x2770('0x1d')](_0x2770('0x1f'),_0xb3779d,JSON['stringify'](_0x2613db));_0x3be128(_0x2613db);})[_0x2770('0x1e')](function(_0x7f57e3){logger[_0x2770('0x10')](_0x2770('0x1f'),_0x7f57e3['message'],_0xb3779d);_0x37a941(_0x3ed3cd[_0x2770('0x10')](0x1f4,_0x7f57e3[_0x2770('0x11')]));});});}; \ No newline at end of file +var _0xb768=['info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','limit','include','model','attributes','map','ShowServicenowAccount','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0xb768,0x7d));var _0x8b76=function(_0x53aaf8,_0x863bcb){_0x53aaf8=_0x53aaf8-0x0;var _0x1fedb1=_0xb768[_0x53aaf8];return _0x1fedb1;};'use strict';var _=require(_0x8b76('0x0'));var util=require('util');var moment=require(_0x8b76('0x1'));var BPromise=require(_0x8b76('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b76('0x3'));var db=require(_0x8b76('0x4'))['db'];var utils=require(_0x8b76('0x5'));var logger=require(_0x8b76('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b76('0x7'));var client=jayson[_0x8b76('0x8')][_0x8b76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5478c3,_0x1f5d0e,_0x3855ae){return new BPromise(function(_0x24b778,_0x5afae5){return client['request'](_0x5478c3,_0x3855ae)[_0x8b76('0xa')](function(_0x5b1e29){logger[_0x8b76('0xb')](_0x8b76('0xc'),_0x1f5d0e,_0x8b76('0xd'));logger[_0x8b76('0xe')](_0x8b76('0xf'),_0x1f5d0e,_0x8b76('0xd'),JSON[_0x8b76('0x10')](_0x5b1e29));if(_0x5b1e29['error']){if(_0x5b1e29[_0x8b76('0x11')]['code']===0x1f4){logger[_0x8b76('0x11')](_0x8b76('0xc'),_0x1f5d0e,_0x5b1e29[_0x8b76('0x11')][_0x8b76('0x12')]);return _0x5afae5(_0x5b1e29[_0x8b76('0x11')][_0x8b76('0x12')]);}logger[_0x8b76('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1f5d0e,_0x5b1e29[_0x8b76('0x11')]['message']);return _0x24b778(_0x5b1e29['error']['message']);}else{logger[_0x8b76('0xb')](_0x8b76('0xc'),_0x1f5d0e,'request\x20sent');_0x24b778(_0x5b1e29[_0x8b76('0x13')][_0x8b76('0x12')]);}})[_0x8b76('0x14')](function(_0xdb2928){logger[_0x8b76('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1f5d0e,_0xdb2928);_0x5afae5(_0xdb2928);});});}exports[_0x8b76('0x15')]=function(_0x5838ce){var _0x53274=this;return new Promise(function(_0xa00f2,_0x29de95){return db[_0x8b76('0x16')][_0x8b76('0x17')]({'raw':_0x5838ce[_0x8b76('0x18')]?_0x5838ce[_0x8b76('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5838ce[_0x8b76('0x18')]?_0x5838ce[_0x8b76('0x18')][_0x8b76('0x19')]||null:null,'attributes':_0x5838ce[_0x8b76('0x18')]?_0x5838ce['options']['attributes']||null:null,'limit':_0x5838ce[_0x8b76('0x18')]?_0x5838ce[_0x8b76('0x18')][_0x8b76('0x1a')]||null:null,'include':_0x5838ce['options']?_0x5838ce[_0x8b76('0x18')][_0x8b76('0x1b')]?_['map'](_0x5838ce['options'][_0x8b76('0x1b')],function(_0x5aeb99){return{'model':db[_0x5aeb99[_0x8b76('0x1c')]],'as':_0x5aeb99['as'],'attributes':_0x5aeb99[_0x8b76('0x1d')],'include':_0x5aeb99[_0x8b76('0x1b')]?_[_0x8b76('0x1e')](_0x5aeb99[_0x8b76('0x1b')],function(_0x11189d){return{'model':db[_0x11189d['model']],'as':_0x11189d['as'],'attributes':_0x11189d['attributes'],'include':_0x11189d[_0x8b76('0x1b')]?_[_0x8b76('0x1e')](_0x11189d[_0x8b76('0x1b')],function(_0x128668){return{'model':db[_0x128668[_0x8b76('0x1c')]],'as':_0x128668['as'],'attributes':_0x128668['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44f404){logger[_0x8b76('0xb')](_0x8b76('0x15'),_0x5838ce);logger[_0x8b76('0xe')]('GetServicenowAccount',_0x5838ce,JSON['stringify'](_0x44f404));_0xa00f2(_0x44f404);})[_0x8b76('0x14')](function(_0x2e1d76){logger['error']('GetServicenowAccount',_0x2e1d76['message'],_0x5838ce);_0x29de95(_0x53274[_0x8b76('0x11')](0x1f4,_0x2e1d76[_0x8b76('0x12')]));});});};exports[_0x8b76('0x1f')]=function(_0x41d77c){var _0x21abbb=this;return new Promise(function(_0x3dbc31,_0x26f4fc){return db[_0x8b76('0x16')][_0x8b76('0x20')]({'raw':_0x41d77c['options']?_0x41d77c[_0x8b76('0x18')][_0x8b76('0x21')]===undefined?!![]:![]:!![],'where':_0x41d77c[_0x8b76('0x18')]?_0x41d77c['options'][_0x8b76('0x19')]||null:null,'attributes':_0x41d77c[_0x8b76('0x18')]?_0x41d77c['options'][_0x8b76('0x1d')]||null:null,'include':_0x41d77c['options']?_0x41d77c[_0x8b76('0x18')]['include']?_[_0x8b76('0x1e')](_0x41d77c[_0x8b76('0x18')]['include'],function(_0x461924){return{'model':db[_0x461924[_0x8b76('0x1c')]],'as':_0x461924['as'],'attributes':_0x461924['attributes'],'include':_0x461924['include']?_[_0x8b76('0x1e')](_0x461924['include'],function(_0x4236d2){return{'model':db[_0x4236d2['model']],'as':_0x4236d2['as'],'attributes':_0x4236d2['attributes'],'include':_0x4236d2[_0x8b76('0x1b')]?_[_0x8b76('0x1e')](_0x4236d2[_0x8b76('0x1b')],function(_0x5ab669){return{'model':db[_0x5ab669[_0x8b76('0x1c')]],'as':_0x5ab669['as'],'attributes':_0x5ab669[_0x8b76('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8b76('0xa')](function(_0x50c52f){logger['info'](_0x8b76('0x1f'),_0x41d77c);logger[_0x8b76('0xe')]('ShowServicenowAccount',_0x41d77c,JSON[_0x8b76('0x10')](_0x50c52f));_0x3dbc31(_0x50c52f);})['catch'](function(_0x42bb27){logger[_0x8b76('0x11')](_0x8b76('0x1f'),_0x42bb27[_0x8b76('0x12')],_0x41d77c);_0x26f4fc(_0x21abbb[_0x8b76('0x11')](0x1f4,_0x42bb27[_0x8b76('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 6716b15..f592ce7 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 _0xb3a9=['index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated'];(function(_0x26357f,_0x34e768){var _0x50a320=function(_0x3f162f){while(--_0x3f162f){_0x26357f['push'](_0x26357f['shift']());}};_0x50a320(++_0x34e768);}(_0xb3a9,0x73));var _0x9b3a=function(_0x389fcc,_0x1bcd52){_0x389fcc=_0x389fcc-0x0;var _0x20570e=_0xb3a9[_0x389fcc];return _0x20570e;};'use strict';var multer=require(_0x9b3a('0x0'));var util=require(_0x9b3a('0x1'));var path=require(_0x9b3a('0x2'));var timeout=require(_0x9b3a('0x3'));var express=require(_0x9b3a('0x4'));var router=express[_0x9b3a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9b3a('0x6'));var interaction=require(_0x9b3a('0x7'));var config=require('../../config/environment');var controller=require(_0x9b3a('0x8'));router['get']('/',auth[_0x9b3a('0x9')](),controller[_0x9b3a('0xa')]);router[_0x9b3a('0xb')](_0x9b3a('0xc'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0xd')]);router[_0x9b3a('0xb')](_0x9b3a('0xe'),auth['isAuthenticated'](),controller[_0x9b3a('0xf')]);router['get'](_0x9b3a('0x10'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x11')]);router[_0x9b3a('0xb')](_0x9b3a('0x12'),auth['isAuthenticated'](),controller[_0x9b3a('0x13')]);router[_0x9b3a('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9b3a('0xc'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x15')]);router[_0x9b3a('0x16')](_0x9b3a('0xc'),auth[_0x9b3a('0x9')](),controller[_0x9b3a('0x17')]);module[_0x9b3a('0x18')]=router; \ No newline at end of file +var _0xf3e6=['isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x18af92,_0xd3b64){var _0x1e7ff1=function(_0x56620c){while(--_0x56620c){_0x18af92['push'](_0x18af92['shift']());}};_0x1e7ff1(++_0xd3b64);}(_0xf3e6,0xe8));var _0x6f3e=function(_0x225470,_0x3fdb2e){_0x225470=_0x225470-0x0;var _0x1a6d59=_0xf3e6[_0x225470];return _0x1a6d59;};'use strict';var multer=require(_0x6f3e('0x0'));var util=require(_0x6f3e('0x1'));var path=require('path');var timeout=require(_0x6f3e('0x2'));var express=require(_0x6f3e('0x3'));var router=express[_0x6f3e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f3e('0x5'));var controller=require(_0x6f3e('0x6'));router[_0x6f3e('0x7')]('/',auth[_0x6f3e('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6f3e('0x9')]);router[_0x6f3e('0x7')](_0x6f3e('0xa'),auth[_0x6f3e('0x8')](),controller['getFields']);router[_0x6f3e('0x7')](_0x6f3e('0xb'),auth[_0x6f3e('0x8')](),controller[_0x6f3e('0xc')]);router[_0x6f3e('0x7')]('/:id/descriptions',auth[_0x6f3e('0x8')](),controller[_0x6f3e('0xd')]);router[_0x6f3e('0xe')]('/',auth[_0x6f3e('0x8')](),controller[_0x6f3e('0xf')]);router['put'](_0x6f3e('0x10'),auth[_0x6f3e('0x8')](),controller[_0x6f3e('0x11')]);router[_0x6f3e('0x12')](_0x6f3e('0x10'),auth[_0x6f3e('0x8')](),controller['destroy']);module[_0x6f3e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8ebe2fc..d395381 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 _0xdbfd=['STRING'];(function(_0x21dd81,_0x3d7113){var _0x102e8e=function(_0x42b323){while(--_0x42b323){_0x21dd81['push'](_0x21dd81['shift']());}};_0x102e8e(++_0x3d7113);}(_0xdbfd,0x1d8));var _0xddbf=function(_0x5d8467,_0x240e01){_0x5d8467=_0x5d8467-0x0;var _0x326eab=_0xdbfd[_0x5d8467];return _0x326eab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xddbf('0x0')]}}; \ No newline at end of file +var _0x36eb=['STRING','sequelize','exports'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x36eb,0x7c));var _0xb36e=function(_0x17a82c,_0x516120){_0x17a82c=_0x17a82c-0x0;var _0x4ccc98=_0x36eb[_0x17a82c];return _0x4ccc98;};'use strict';var Sequelize=require(_0xb36e('0x0'));module[_0xb36e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb36e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 5ba096e..d5e26cf 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 _0x4b95=['fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b95,0x1d7));var _0x54b9=function(_0x126acb,_0x55ddec){_0x126acb=_0x126acb-0x0;var _0x58853a=_0x4b95[_0x126acb];return _0x58853a;};'use strict';var emlformat=require(_0x54b9('0x0'));var rimraf=require(_0x54b9('0x1'));var zipdir=require(_0x54b9('0x2'));var jsonpatch=require(_0x54b9('0x3'));var rp=require('request-promise');var moment=require(_0x54b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x54b9('0x5'));var util=require(_0x54b9('0x6'));var path=require(_0x54b9('0x7'));var sox=require(_0x54b9('0x8'));var csv=require(_0x54b9('0x9'));var ejs=require(_0x54b9('0xa'));var fs=require('fs');var fs_extra=require(_0x54b9('0xb'));var _=require(_0x54b9('0xc'));var squel=require('squel');var crypto=require(_0x54b9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x54b9('0xe'));var toCsv=require(_0x54b9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x54b9('0xf'));var authService=require(_0x54b9('0x10'));var qs=require(_0x54b9('0x11'));var as=require(_0x54b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54b9('0x13'))(_0x54b9('0x14'));var utils=require(_0x54b9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x54b9('0x16'));var db=require(_0x54b9('0x17'))['db'];function respondWithStatusCode(_0x2c3bbe,_0x3e4879){_0x3e4879=_0x3e4879||0xcc;return function(_0x9536eb){if(_0x9536eb){return _0x2c3bbe[_0x54b9('0x18')](_0x3e4879);}return _0x2c3bbe[_0x54b9('0x19')](_0x3e4879)[_0x54b9('0x1a')]();};}function respondWithResult(_0x296e95,_0x360a37){_0x360a37=_0x360a37||0xc8;return function(_0x4cef34){if(_0x4cef34){return _0x296e95[_0x54b9('0x19')](_0x360a37)['json'](_0x4cef34);}};}function respondWithFilteredResult(_0x1e662a,_0xd99640){return function(_0x2661c8){if(_0x2661c8){var _0x31f170=typeof _0xd99640[_0x54b9('0x1b')]===_0x54b9('0x1c')&&typeof _0xd99640[_0x54b9('0x1d')]==='undefined';var _0x27e18e=_0x2661c8[_0x54b9('0x1e')];var _0x31b9b2=_0x31f170?0x0:_0xd99640['offset'];var _0x1c06de=_0x31f170?_0x2661c8['count']:_0xd99640[_0x54b9('0x1b')]+_0xd99640['limit'];var _0xdca890;if(_0x1c06de>=_0x27e18e){_0x1c06de=_0x27e18e;_0xdca890=0xc8;}else{_0xdca890=0xce;}_0x1e662a[_0x54b9('0x19')](_0xdca890);return _0x1e662a[_0x54b9('0x1f')]('Content-Range',_0x31b9b2+'-'+_0x1c06de+'/'+_0x27e18e)['json'](_0x2661c8);}return null;};}function patchUpdates(_0x8f1415){return function(_0x3c447b){try{jsonpatch[_0x54b9('0x20')](_0x3c447b,_0x8f1415,!![]);}catch(_0xa5d4f0){return BPromise[_0x54b9('0x21')](_0xa5d4f0);}return _0x3c447b['save']();};}function saveUpdates(_0x280526,_0x44792f){return function(_0x65f427){if(_0x65f427){return _0x65f427[_0x54b9('0x22')](_0x280526)[_0x54b9('0x23')](function(_0x9f8746){return _0x9f8746;});}return null;};}function removeEntity(_0x13d8a3,_0x535b6a){return function(_0xac10d7){if(_0xac10d7){return _0xac10d7[_0x54b9('0x24')]()[_0x54b9('0x23')](function(){_0x13d8a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c655,_0x38b160){return function(_0x45aae8){if(!_0x45aae8){_0x31c655[_0x54b9('0x18')](0x194);}return _0x45aae8;};}function handleError(_0x1ae8b8,_0x78fba8){_0x78fba8=_0x78fba8||0x1f4;return function(_0x2138a1){logger[_0x54b9('0x25')](_0x2138a1[_0x54b9('0x26')]);if(_0x2138a1[_0x54b9('0x27')]){delete _0x2138a1[_0x54b9('0x27')];}_0x1ae8b8[_0x54b9('0x19')](_0x78fba8)['send'](_0x2138a1);};}exports[_0x54b9('0x28')]=function(_0x4c8bfd,_0x3bfff6){var _0x27b6f6={},_0x530aa0={},_0x703931={'count':0x0,'rows':[]};var _0x10e48a=_['map'](db[_0x54b9('0x29')][_0x54b9('0x2a')],function(_0x21c41d){return{'name':_0x21c41d[_0x54b9('0x2b')],'type':_0x21c41d[_0x54b9('0x2c')][_0x54b9('0x2d')]};});_0x530aa0[_0x54b9('0x2e')]=_[_0x54b9('0x2f')](_0x10e48a,'name');_0x530aa0['query']=_[_0x54b9('0x30')](_0x4c8bfd[_0x54b9('0x31')]);_0x530aa0[_0x54b9('0x32')]=_[_0x54b9('0x33')](_0x530aa0[_0x54b9('0x2e')],_0x530aa0[_0x54b9('0x31')]);_0x27b6f6['attributes']=_['intersection'](_0x530aa0['model'],qs['fields'](_0x4c8bfd[_0x54b9('0x31')][_0x54b9('0x34')]));_0x27b6f6[_0x54b9('0x35')]=_0x27b6f6['attributes'][_0x54b9('0x36')]?_0x27b6f6[_0x54b9('0x35')]:_0x530aa0[_0x54b9('0x2e')];if(!_0x4c8bfd[_0x54b9('0x31')][_0x54b9('0x37')](_0x54b9('0x38'))){_0x27b6f6[_0x54b9('0x1d')]=qs[_0x54b9('0x1d')](_0x4c8bfd[_0x54b9('0x31')][_0x54b9('0x1d')]);_0x27b6f6['offset']=qs['offset'](_0x4c8bfd['query'][_0x54b9('0x1b')]);}_0x27b6f6[_0x54b9('0x39')]=qs[_0x54b9('0x3a')](_0x4c8bfd['query'][_0x54b9('0x3a')]);_0x27b6f6[_0x54b9('0x3b')]=qs['filters'](_[_0x54b9('0x3c')](_0x4c8bfd[_0x54b9('0x31')],_0x530aa0[_0x54b9('0x32')]),_0x10e48a);if(_0x4c8bfd[_0x54b9('0x31')][_0x54b9('0x3d')]){_0x27b6f6['where']=_[_0x54b9('0x3e')](_0x27b6f6[_0x54b9('0x3b')],{'$or':_['map'](_0x10e48a,function(_0x42cc0a){if(_0x42cc0a[_0x54b9('0x2c')]!==_0x54b9('0x3f')){var _0x2648d3={};_0x2648d3[_0x42cc0a[_0x54b9('0x27')]]={'$like':'%'+_0x4c8bfd['query'][_0x54b9('0x3d')]+'%'};return _0x2648d3;}})});}_0x27b6f6=_[_0x54b9('0x3e')]({},_0x27b6f6,_0x4c8bfd[_0x54b9('0x40')]);var _0x322f40={'where':_0x27b6f6['where']};return db[_0x54b9('0x29')][_0x54b9('0x1e')](_0x322f40)[_0x54b9('0x23')](function(_0x27a73b){_0x703931['count']=_0x27a73b;if(_0x4c8bfd[_0x54b9('0x31')][_0x54b9('0x41')]){_0x27b6f6['include']=[{'all':!![]}];}return db[_0x54b9('0x29')][_0x54b9('0x42')](_0x27b6f6);})['then'](function(_0x35fdb5){_0x703931[_0x54b9('0x43')]=_0x35fdb5;return _0x703931;})[_0x54b9('0x23')](respondWithFilteredResult(_0x3bfff6,_0x27b6f6))[_0x54b9('0x44')](handleError(_0x3bfff6,null));};exports['show']=function(_0x5de9a3,_0x3809f0){var _0x1c6116={'raw':![],'where':{'id':_0x5de9a3[_0x54b9('0x45')]['id']}},_0x2c90de={};_0x2c90de[_0x54b9('0x2e')]=_[_0x54b9('0x30')](db['ServicenowConfiguration'][_0x54b9('0x2a')]);_0x2c90de['query']=_[_0x54b9('0x30')](_0x5de9a3[_0x54b9('0x31')]);_0x2c90de['filters']=_[_0x54b9('0x33')](_0x2c90de[_0x54b9('0x2e')],_0x2c90de[_0x54b9('0x31')]);_0x1c6116[_0x54b9('0x35')]=_[_0x54b9('0x33')](_0x2c90de['model'],qs[_0x54b9('0x34')](_0x5de9a3['query'][_0x54b9('0x34')]));_0x1c6116[_0x54b9('0x35')]=_0x1c6116[_0x54b9('0x35')]['length']?_0x1c6116[_0x54b9('0x35')]:_0x2c90de[_0x54b9('0x2e')];if(_0x5de9a3[_0x54b9('0x31')][_0x54b9('0x41')]){_0x1c6116[_0x54b9('0x46')]=[{'all':!![]}];}_0x1c6116=_[_0x54b9('0x3e')]({},_0x1c6116,_0x5de9a3['options']);return db[_0x54b9('0x29')][_0x54b9('0x47')](_0x1c6116)[_0x54b9('0x23')](handleEntityNotFound(_0x3809f0,null))['then'](respondWithResult(_0x3809f0,null))[_0x54b9('0x44')](handleError(_0x3809f0,null));};exports[_0x54b9('0x48')]=function(_0x123977,_0xef6c9e){return db[_0x54b9('0x29')][_0x54b9('0x48')](_0x123977[_0x54b9('0x49')],{})['then'](respondWithResult(_0xef6c9e,0xc9))[_0x54b9('0x44')](handleError(_0xef6c9e,null));};exports[_0x54b9('0x22')]=function(_0x2d79a0,_0x2c78a1){if(_0x2d79a0[_0x54b9('0x49')]['id']){delete _0x2d79a0['body']['id'];}return db['ServicenowConfiguration'][_0x54b9('0x47')]({'where':{'id':_0x2d79a0[_0x54b9('0x45')]['id']}})[_0x54b9('0x23')](handleEntityNotFound(_0x2c78a1,null))['then'](saveUpdates(_0x2d79a0[_0x54b9('0x49')],null))[_0x54b9('0x23')](respondWithResult(_0x2c78a1,null))[_0x54b9('0x44')](handleError(_0x2c78a1,null));};exports['destroy']=function(_0x1bf730,_0x2b8ada){return db[_0x54b9('0x29')]['find']({'where':{'id':_0x1bf730[_0x54b9('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b8ada,null))[_0x54b9('0x23')](removeEntity(_0x2b8ada,null))[_0x54b9('0x44')](handleError(_0x2b8ada,null));};exports[_0x54b9('0x4a')]=function(_0x2eaa75,_0x19399d,_0x5622e3){var _0x5e491f={};var _0x35a2b8={};var _0x5ae1b0;var _0x156f97;return db[_0x54b9('0x29')][_0x54b9('0x4b')]({'where':{'id':_0x2eaa75[_0x54b9('0x45')]['id']}})[_0x54b9('0x23')](handleEntityNotFound(_0x19399d,null))[_0x54b9('0x23')](function(_0x248d44){if(_0x248d44){_0x5ae1b0=_0x248d44;_0x35a2b8[_0x54b9('0x2e')]=_[_0x54b9('0x30')](db[_0x54b9('0x4c')][_0x54b9('0x2a')]);_0x35a2b8[_0x54b9('0x31')]=_[_0x54b9('0x30')](_0x2eaa75[_0x54b9('0x31')]);_0x35a2b8['filters']=_['intersection'](_0x35a2b8[_0x54b9('0x2e')],_0x35a2b8[_0x54b9('0x31')]);_0x5e491f[_0x54b9('0x35')]=_[_0x54b9('0x33')](_0x35a2b8[_0x54b9('0x2e')],qs[_0x54b9('0x34')](_0x2eaa75[_0x54b9('0x31')][_0x54b9('0x34')]));_0x5e491f['attributes']=_0x5e491f['attributes'][_0x54b9('0x36')]?_0x5e491f[_0x54b9('0x35')]:_0x35a2b8['model'];_0x5e491f[_0x54b9('0x39')]=qs[_0x54b9('0x3a')](_0x2eaa75[_0x54b9('0x31')][_0x54b9('0x3a')]);_0x5e491f[_0x54b9('0x3b')]=qs['filters'](_[_0x54b9('0x3c')](_0x2eaa75[_0x54b9('0x31')],_0x35a2b8[_0x54b9('0x32')]));if(_0x2eaa75['query']['filter']){_0x5e491f['where']=_[_0x54b9('0x3e')](_0x5e491f['where'],{'$or':_[_0x54b9('0x2f')](_0x5e491f['attributes'],function(_0x2332b5){var _0x238f91={};_0x238f91[_0x2332b5]={'$like':'%'+_0x2eaa75[_0x54b9('0x31')][_0x54b9('0x3d')]+'%'};return _0x238f91;})});}_0x5e491f=_[_0x54b9('0x3e')]({},_0x5e491f,_0x2eaa75[_0x54b9('0x40')]);return _0x5ae1b0['getFields'](_0x5e491f);}})[_0x54b9('0x23')](function(_0x570f6a){if(_0x570f6a){_0x156f97=_0x570f6a[_0x54b9('0x36')];if(!_0x2eaa75['query']['hasOwnProperty'](_0x54b9('0x38'))){_0x5e491f[_0x54b9('0x1d')]=qs['limit'](_0x2eaa75[_0x54b9('0x31')][_0x54b9('0x1d')]);_0x5e491f[_0x54b9('0x1b')]=qs[_0x54b9('0x1b')](_0x2eaa75[_0x54b9('0x31')][_0x54b9('0x1b')]);}return _0x5ae1b0[_0x54b9('0x4a')](_0x5e491f);}})[_0x54b9('0x23')](function(_0x4167a0){if(_0x4167a0){return _0x4167a0?{'count':_0x156f97,'rows':_0x4167a0}:null;}})[_0x54b9('0x23')](respondWithResult(_0x19399d,null))[_0x54b9('0x44')](handleError(_0x19399d,null));};exports[_0x54b9('0x4d')]=function(_0x1f208c,_0x27af9d,_0xba85a2){var _0x5501d0={};var _0x1a7631={};var _0x2baaf4;var _0x484b99;return db[_0x54b9('0x29')][_0x54b9('0x4b')]({'where':{'id':_0x1f208c[_0x54b9('0x45')]['id']}})[_0x54b9('0x23')](handleEntityNotFound(_0x27af9d,null))[_0x54b9('0x23')](function(_0x3b8719){if(_0x3b8719){_0x2baaf4=_0x3b8719;_0x1a7631['model']=_['keys'](db[_0x54b9('0x4c')]['rawAttributes']);_0x1a7631[_0x54b9('0x31')]=_[_0x54b9('0x30')](_0x1f208c[_0x54b9('0x31')]);_0x1a7631[_0x54b9('0x32')]=_[_0x54b9('0x33')](_0x1a7631[_0x54b9('0x2e')],_0x1a7631[_0x54b9('0x31')]);_0x5501d0[_0x54b9('0x35')]=_[_0x54b9('0x33')](_0x1a7631['model'],qs['fields'](_0x1f208c[_0x54b9('0x31')][_0x54b9('0x34')]));_0x5501d0['attributes']=_0x5501d0['attributes']['length']?_0x5501d0['attributes']:_0x1a7631[_0x54b9('0x2e')];_0x5501d0[_0x54b9('0x39')]=qs[_0x54b9('0x3a')](_0x1f208c[_0x54b9('0x31')][_0x54b9('0x3a')]);_0x5501d0[_0x54b9('0x3b')]=qs[_0x54b9('0x32')](_['pick'](_0x1f208c[_0x54b9('0x31')],_0x1a7631[_0x54b9('0x32')]));if(_0x1f208c['query'][_0x54b9('0x3d')]){_0x5501d0[_0x54b9('0x3b')]=_[_0x54b9('0x3e')](_0x5501d0[_0x54b9('0x3b')],{'$or':_[_0x54b9('0x2f')](_0x5501d0[_0x54b9('0x35')],function(_0x2c938e){var _0x59b9d4={};_0x59b9d4[_0x2c938e]={'$like':'%'+_0x1f208c['query'][_0x54b9('0x3d')]+'%'};return _0x59b9d4;})});}_0x5501d0=_['merge']({},_0x5501d0,_0x1f208c[_0x54b9('0x40')]);return _0x2baaf4[_0x54b9('0x4d')](_0x5501d0);}})[_0x54b9('0x23')](function(_0x281305){if(_0x281305){_0x484b99=_0x281305['length'];if(!_0x1f208c[_0x54b9('0x31')][_0x54b9('0x37')](_0x54b9('0x38'))){_0x5501d0['limit']=qs[_0x54b9('0x1d')](_0x1f208c[_0x54b9('0x31')][_0x54b9('0x1d')]);_0x5501d0[_0x54b9('0x1b')]=qs['offset'](_0x1f208c[_0x54b9('0x31')][_0x54b9('0x1b')]);}return _0x2baaf4[_0x54b9('0x4d')](_0x5501d0);}})['then'](function(_0x43c2a2){if(_0x43c2a2){return _0x43c2a2?{'count':_0x484b99,'rows':_0x43c2a2}:null;}})[_0x54b9('0x23')](respondWithResult(_0x27af9d,null))[_0x54b9('0x44')](handleError(_0x27af9d,null));};exports[_0x54b9('0x4e')]=function(_0x310877,_0x516386,_0x5b93bd){var _0x4d1c2e={};var _0xc44eff={};var _0x5e75eb;var _0x3635d2;return db['ServicenowConfiguration'][_0x54b9('0x4b')]({'where':{'id':_0x310877[_0x54b9('0x45')]['id']}})[_0x54b9('0x23')](handleEntityNotFound(_0x516386,null))[_0x54b9('0x23')](function(_0x188a0c){if(_0x188a0c){_0x5e75eb=_0x188a0c;_0xc44eff['model']=_[_0x54b9('0x30')](db[_0x54b9('0x4c')][_0x54b9('0x2a')]);_0xc44eff[_0x54b9('0x31')]=_[_0x54b9('0x30')](_0x310877[_0x54b9('0x31')]);_0xc44eff[_0x54b9('0x32')]=_[_0x54b9('0x33')](_0xc44eff['model'],_0xc44eff[_0x54b9('0x31')]);_0x4d1c2e['attributes']=_[_0x54b9('0x33')](_0xc44eff['model'],qs[_0x54b9('0x34')](_0x310877[_0x54b9('0x31')][_0x54b9('0x34')]));_0x4d1c2e['attributes']=_0x4d1c2e[_0x54b9('0x35')][_0x54b9('0x36')]?_0x4d1c2e[_0x54b9('0x35')]:_0xc44eff['model'];_0x4d1c2e[_0x54b9('0x39')]=qs['sort'](_0x310877[_0x54b9('0x31')]['sort']);_0x4d1c2e[_0x54b9('0x3b')]=qs[_0x54b9('0x32')](_[_0x54b9('0x3c')](_0x310877[_0x54b9('0x31')],_0xc44eff[_0x54b9('0x32')]));if(_0x310877[_0x54b9('0x31')]['filter']){_0x4d1c2e[_0x54b9('0x3b')]=_[_0x54b9('0x3e')](_0x4d1c2e[_0x54b9('0x3b')],{'$or':_[_0x54b9('0x2f')](_0x4d1c2e['attributes'],function(_0x2c384f){var _0x4095c1={};_0x4095c1[_0x2c384f]={'$like':'%'+_0x310877[_0x54b9('0x31')][_0x54b9('0x3d')]+'%'};return _0x4095c1;})});}_0x4d1c2e=_[_0x54b9('0x3e')]({},_0x4d1c2e,_0x310877[_0x54b9('0x40')]);return _0x5e75eb[_0x54b9('0x4e')](_0x4d1c2e);}})['then'](function(_0x338791){if(_0x338791){_0x3635d2=_0x338791[_0x54b9('0x36')];if(!_0x310877['query'][_0x54b9('0x37')](_0x54b9('0x38'))){_0x4d1c2e[_0x54b9('0x1d')]=qs['limit'](_0x310877['query'][_0x54b9('0x1d')]);_0x4d1c2e['offset']=qs[_0x54b9('0x1b')](_0x310877[_0x54b9('0x31')][_0x54b9('0x1b')]);}return _0x5e75eb[_0x54b9('0x4e')](_0x4d1c2e);}})[_0x54b9('0x23')](function(_0x40191c){if(_0x40191c){return _0x40191c?{'count':_0x3635d2,'rows':_0x40191c}:null;}})[_0x54b9('0x23')](respondWithResult(_0x516386,null))[_0x54b9('0x44')](handleError(_0x516386,null));}; \ No newline at end of file +var _0x1427=['sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','ServicenowConfiguration','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','ServicenowField','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/utils','../../config/environment','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','key','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','limit','order'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1427,0x1a9));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7142('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7142('0x1'));var rp=require(_0x7142('0x2'));var moment=require(_0x7142('0x3'));var BPromise=require(_0x7142('0x4'));var Mustache=require(_0x7142('0x5'));var util=require(_0x7142('0x6'));var path=require(_0x7142('0x7'));var sox=require('sox');var csv=require(_0x7142('0x8'));var ejs=require(_0x7142('0x9'));var fs=require('fs');var fs_extra=require(_0x7142('0xa'));var _=require(_0x7142('0xb'));var squel=require(_0x7142('0xc'));var crypto=require(_0x7142('0xd'));var jsforce=require(_0x7142('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7142('0x8'));var querystring=require(_0x7142('0xf'));var Papa=require(_0x7142('0x10'));var Redis=require(_0x7142('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7142('0x12'));var as=require(_0x7142('0x13'));var hardwareService=require(_0x7142('0x14'));var logger=require(_0x7142('0x15'))(_0x7142('0x16'));var utils=require(_0x7142('0x17'));var config=require(_0x7142('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58726d,_0x44a7dc){_0x44a7dc=_0x44a7dc||0xcc;return function(_0x489212){if(_0x489212){return _0x58726d['sendStatus'](_0x44a7dc);}return _0x58726d[_0x7142('0x19')](_0x44a7dc)[_0x7142('0x1a')]();};}function respondWithResult(_0x50a1ce,_0x15f625){_0x15f625=_0x15f625||0xc8;return function(_0x2449d5){if(_0x2449d5){return _0x50a1ce[_0x7142('0x19')](_0x15f625)[_0x7142('0x1b')](_0x2449d5);}};}function respondWithFilteredResult(_0x44fa4e,_0x56ae90){return function(_0x5ee049){if(_0x5ee049){var _0x444c78=typeof _0x56ae90[_0x7142('0x1c')]===_0x7142('0x1d')&&typeof _0x56ae90['limit']===_0x7142('0x1d');var _0x10ab83=_0x5ee049[_0x7142('0x1e')];var _0x5aea06=_0x444c78?0x0:_0x56ae90['offset'];var _0x356a86=_0x444c78?_0x5ee049[_0x7142('0x1e')]:_0x56ae90[_0x7142('0x1c')]+_0x56ae90['limit'];var _0x149422;if(_0x356a86>=_0x10ab83){_0x356a86=_0x10ab83;_0x149422=0xc8;}else{_0x149422=0xce;}_0x44fa4e[_0x7142('0x19')](_0x149422);return _0x44fa4e['set'](_0x7142('0x1f'),_0x5aea06+'-'+_0x356a86+'/'+_0x10ab83)[_0x7142('0x1b')](_0x5ee049);}return null;};}function patchUpdates(_0x41c97b){return function(_0x5a79a7){try{jsonpatch[_0x7142('0x20')](_0x5a79a7,_0x41c97b,!![]);}catch(_0x8762ff){return BPromise[_0x7142('0x21')](_0x8762ff);}return _0x5a79a7['save']();};}function saveUpdates(_0x526e7d,_0x2560e6){return function(_0x3ca2ab){if(_0x3ca2ab){return _0x3ca2ab[_0x7142('0x22')](_0x526e7d)[_0x7142('0x23')](function(_0x517a0d){return _0x517a0d;});}return null;};}function removeEntity(_0x4b9e28,_0x3f8125){return function(_0x2fc22e){if(_0x2fc22e){return _0x2fc22e[_0x7142('0x24')]()['then'](function(){_0x4b9e28[_0x7142('0x19')](0xcc)[_0x7142('0x1a')]();});}};}function handleEntityNotFound(_0x219f05,_0x20e190){return function(_0x2955b5){if(!_0x2955b5){_0x219f05['sendStatus'](0x194);}return _0x2955b5;};}function handleError(_0x661c08,_0x302f01){_0x302f01=_0x302f01||0x1f4;return function(_0x566621){logger[_0x7142('0x25')](_0x566621['stack']);if(_0x566621[_0x7142('0x26')]){delete _0x566621[_0x7142('0x26')];}_0x661c08[_0x7142('0x19')](_0x302f01)[_0x7142('0x27')](_0x566621);};}exports[_0x7142('0x28')]=function(_0x241104,_0x3aac26){var _0x545533={},_0x214226={},_0x5c0573={'count':0x0,'rows':[]};var _0x4ee0b5=_[_0x7142('0x29')](db['ServicenowConfiguration']['rawAttributes'],function(_0x17f8c){return{'name':_0x17f8c['fieldName'],'type':_0x17f8c['type'][_0x7142('0x2a')]};});_0x214226['model']=_[_0x7142('0x29')](_0x4ee0b5,_0x7142('0x26'));_0x214226['query']=_[_0x7142('0x2b')](_0x241104[_0x7142('0x2c')]);_0x214226[_0x7142('0x2d')]=_['intersection'](_0x214226['model'],_0x214226['query']);_0x545533['attributes']=_[_0x7142('0x2e')](_0x214226['model'],qs[_0x7142('0x2f')](_0x241104[_0x7142('0x2c')][_0x7142('0x2f')]));_0x545533[_0x7142('0x30')]=_0x545533[_0x7142('0x30')][_0x7142('0x31')]?_0x545533[_0x7142('0x30')]:_0x214226[_0x7142('0x32')];if(!_0x241104['query'][_0x7142('0x33')](_0x7142('0x34'))){_0x545533[_0x7142('0x35')]=qs[_0x7142('0x35')](_0x241104[_0x7142('0x2c')][_0x7142('0x35')]);_0x545533[_0x7142('0x1c')]=qs[_0x7142('0x1c')](_0x241104['query']['offset']);}_0x545533[_0x7142('0x36')]=qs[_0x7142('0x37')](_0x241104['query'][_0x7142('0x37')]);_0x545533[_0x7142('0x38')]=qs[_0x7142('0x2d')](_[_0x7142('0x39')](_0x241104['query'],_0x214226['filters']),_0x4ee0b5);if(_0x241104[_0x7142('0x2c')][_0x7142('0x3a')]){_0x545533[_0x7142('0x38')]=_['merge'](_0x545533['where'],{'$or':_[_0x7142('0x29')](_0x4ee0b5,function(_0x353922){if(_0x353922[_0x7142('0x3b')]!==_0x7142('0x3c')){var _0x5c37c9={};_0x5c37c9[_0x353922['name']]={'$like':'%'+_0x241104[_0x7142('0x2c')][_0x7142('0x3a')]+'%'};return _0x5c37c9;}})});}_0x545533=_[_0x7142('0x3d')]({},_0x545533,_0x241104[_0x7142('0x3e')]);var _0xbc527b={'where':_0x545533[_0x7142('0x38')]};return db['ServicenowConfiguration']['count'](_0xbc527b)[_0x7142('0x23')](function(_0x1b0c9e){_0x5c0573['count']=_0x1b0c9e;if(_0x241104['query'][_0x7142('0x3f')]){_0x545533[_0x7142('0x40')]=[{'all':!![]}];}return db[_0x7142('0x41')][_0x7142('0x42')](_0x545533);})['then'](function(_0x3f10a3){_0x5c0573[_0x7142('0x43')]=_0x3f10a3;return _0x5c0573;})['then'](respondWithFilteredResult(_0x3aac26,_0x545533))[_0x7142('0x44')](handleError(_0x3aac26,null));};exports[_0x7142('0x45')]=function(_0x50b0b8,_0x35619b){var _0x144106={'raw':![],'where':{'id':_0x50b0b8[_0x7142('0x46')]['id']}},_0x4a7737={};_0x4a7737[_0x7142('0x32')]=_[_0x7142('0x2b')](db[_0x7142('0x41')][_0x7142('0x47')]);_0x4a7737['query']=_[_0x7142('0x2b')](_0x50b0b8[_0x7142('0x2c')]);_0x4a7737['filters']=_[_0x7142('0x2e')](_0x4a7737['model'],_0x4a7737[_0x7142('0x2c')]);_0x144106['attributes']=_[_0x7142('0x2e')](_0x4a7737[_0x7142('0x32')],qs[_0x7142('0x2f')](_0x50b0b8[_0x7142('0x2c')][_0x7142('0x2f')]));_0x144106['attributes']=_0x144106[_0x7142('0x30')][_0x7142('0x31')]?_0x144106[_0x7142('0x30')]:_0x4a7737['model'];if(_0x50b0b8[_0x7142('0x2c')][_0x7142('0x3f')]){_0x144106[_0x7142('0x40')]=[{'all':!![]}];}_0x144106=_[_0x7142('0x3d')]({},_0x144106,_0x50b0b8[_0x7142('0x3e')]);return db['ServicenowConfiguration'][_0x7142('0x48')](_0x144106)['then'](handleEntityNotFound(_0x35619b,null))[_0x7142('0x23')](respondWithResult(_0x35619b,null))['catch'](handleError(_0x35619b,null));};exports['create']=function(_0x52f0a5,_0x4966d1){return db['ServicenowConfiguration'][_0x7142('0x49')](_0x52f0a5[_0x7142('0x4a')],{})[_0x7142('0x23')](respondWithResult(_0x4966d1,0xc9))[_0x7142('0x44')](handleError(_0x4966d1,null));};exports[_0x7142('0x22')]=function(_0x4ddd5a,_0x50754f){if(_0x4ddd5a[_0x7142('0x4a')]['id']){delete _0x4ddd5a[_0x7142('0x4a')]['id'];}return db[_0x7142('0x41')][_0x7142('0x48')]({'where':{'id':_0x4ddd5a[_0x7142('0x46')]['id']}})[_0x7142('0x23')](handleEntityNotFound(_0x50754f,null))['then'](saveUpdates(_0x4ddd5a[_0x7142('0x4a')],null))[_0x7142('0x23')](respondWithResult(_0x50754f,null))[_0x7142('0x44')](handleError(_0x50754f,null));};exports['destroy']=function(_0x5f2b9e,_0x247c7c){return db[_0x7142('0x41')][_0x7142('0x48')]({'where':{'id':_0x5f2b9e['params']['id']}})['then'](handleEntityNotFound(_0x247c7c,null))[_0x7142('0x23')](removeEntity(_0x247c7c,null))[_0x7142('0x44')](handleError(_0x247c7c,null));};exports[_0x7142('0x4b')]=function(_0x13f004,_0x375a5c,_0x1ea5d0){var _0x61fffb={};var _0xe94fba={};var _0x53bb30;var _0x33369d;return db[_0x7142('0x41')][_0x7142('0x4c')]({'where':{'id':_0x13f004[_0x7142('0x46')]['id']}})['then'](handleEntityNotFound(_0x375a5c,null))[_0x7142('0x23')](function(_0x255b14){if(_0x255b14){_0x53bb30=_0x255b14;_0xe94fba[_0x7142('0x32')]=_[_0x7142('0x2b')](db['ServicenowField'][_0x7142('0x47')]);_0xe94fba[_0x7142('0x2c')]=_['keys'](_0x13f004[_0x7142('0x2c')]);_0xe94fba[_0x7142('0x2d')]=_[_0x7142('0x2e')](_0xe94fba['model'],_0xe94fba[_0x7142('0x2c')]);_0x61fffb[_0x7142('0x30')]=_[_0x7142('0x2e')](_0xe94fba[_0x7142('0x32')],qs[_0x7142('0x2f')](_0x13f004[_0x7142('0x2c')][_0x7142('0x2f')]));_0x61fffb[_0x7142('0x30')]=_0x61fffb[_0x7142('0x30')][_0x7142('0x31')]?_0x61fffb[_0x7142('0x30')]:_0xe94fba[_0x7142('0x32')];_0x61fffb[_0x7142('0x36')]=qs[_0x7142('0x37')](_0x13f004[_0x7142('0x2c')][_0x7142('0x37')]);_0x61fffb[_0x7142('0x38')]=qs[_0x7142('0x2d')](_['pick'](_0x13f004['query'],_0xe94fba[_0x7142('0x2d')]));if(_0x13f004[_0x7142('0x2c')]['filter']){_0x61fffb[_0x7142('0x38')]=_[_0x7142('0x3d')](_0x61fffb[_0x7142('0x38')],{'$or':_[_0x7142('0x29')](_0x61fffb[_0x7142('0x30')],function(_0x2b8066){var _0x25c44c={};_0x25c44c[_0x2b8066]={'$like':'%'+_0x13f004[_0x7142('0x2c')][_0x7142('0x3a')]+'%'};return _0x25c44c;})});}_0x61fffb=_[_0x7142('0x3d')]({},_0x61fffb,_0x13f004[_0x7142('0x3e')]);return _0x53bb30[_0x7142('0x4b')](_0x61fffb);}})[_0x7142('0x23')](function(_0x292dc1){if(_0x292dc1){_0x33369d=_0x292dc1[_0x7142('0x31')];if(!_0x13f004[_0x7142('0x2c')][_0x7142('0x33')](_0x7142('0x34'))){_0x61fffb[_0x7142('0x35')]=qs[_0x7142('0x35')](_0x13f004[_0x7142('0x2c')][_0x7142('0x35')]);_0x61fffb[_0x7142('0x1c')]=qs['offset'](_0x13f004[_0x7142('0x2c')][_0x7142('0x1c')]);}return _0x53bb30['getFields'](_0x61fffb);}})[_0x7142('0x23')](function(_0x38d928){if(_0x38d928){return _0x38d928?{'count':_0x33369d,'rows':_0x38d928}:null;}})[_0x7142('0x23')](respondWithResult(_0x375a5c,null))['catch'](handleError(_0x375a5c,null));};exports[_0x7142('0x4d')]=function(_0xe45419,_0x11728d,_0x6e58f9){var _0x3ded1b={};var _0x15e6a4={};var _0x112eba;var _0x45e5e4;return db[_0x7142('0x41')]['findOne']({'where':{'id':_0xe45419['params']['id']}})[_0x7142('0x23')](handleEntityNotFound(_0x11728d,null))[_0x7142('0x23')](function(_0x486229){if(_0x486229){_0x112eba=_0x486229;_0x15e6a4[_0x7142('0x32')]=_['keys'](db[_0x7142('0x4e')]['rawAttributes']);_0x15e6a4[_0x7142('0x2c')]=_['keys'](_0xe45419[_0x7142('0x2c')]);_0x15e6a4[_0x7142('0x2d')]=_['intersection'](_0x15e6a4[_0x7142('0x32')],_0x15e6a4[_0x7142('0x2c')]);_0x3ded1b['attributes']=_[_0x7142('0x2e')](_0x15e6a4[_0x7142('0x32')],qs[_0x7142('0x2f')](_0xe45419[_0x7142('0x2c')][_0x7142('0x2f')]));_0x3ded1b['attributes']=_0x3ded1b['attributes'][_0x7142('0x31')]?_0x3ded1b['attributes']:_0x15e6a4[_0x7142('0x32')];_0x3ded1b['order']=qs[_0x7142('0x37')](_0xe45419[_0x7142('0x2c')][_0x7142('0x37')]);_0x3ded1b[_0x7142('0x38')]=qs['filters'](_[_0x7142('0x39')](_0xe45419[_0x7142('0x2c')],_0x15e6a4[_0x7142('0x2d')]));if(_0xe45419[_0x7142('0x2c')][_0x7142('0x3a')]){_0x3ded1b['where']=_[_0x7142('0x3d')](_0x3ded1b[_0x7142('0x38')],{'$or':_['map'](_0x3ded1b['attributes'],function(_0x178409){var _0x43a1ae={};_0x43a1ae[_0x178409]={'$like':'%'+_0xe45419[_0x7142('0x2c')][_0x7142('0x3a')]+'%'};return _0x43a1ae;})});}_0x3ded1b=_[_0x7142('0x3d')]({},_0x3ded1b,_0xe45419[_0x7142('0x3e')]);return _0x112eba[_0x7142('0x4d')](_0x3ded1b);}})['then'](function(_0x167836){if(_0x167836){_0x45e5e4=_0x167836[_0x7142('0x31')];if(!_0xe45419[_0x7142('0x2c')][_0x7142('0x33')](_0x7142('0x34'))){_0x3ded1b['limit']=qs[_0x7142('0x35')](_0xe45419[_0x7142('0x2c')][_0x7142('0x35')]);_0x3ded1b[_0x7142('0x1c')]=qs['offset'](_0xe45419[_0x7142('0x2c')][_0x7142('0x1c')]);}return _0x112eba[_0x7142('0x4d')](_0x3ded1b);}})[_0x7142('0x23')](function(_0x13f5a6){if(_0x13f5a6){return _0x13f5a6?{'count':_0x45e5e4,'rows':_0x13f5a6}:null;}})[_0x7142('0x23')](respondWithResult(_0x11728d,null))[_0x7142('0x44')](handleError(_0x11728d,null));};exports[_0x7142('0x4f')]=function(_0x2618b4,_0x1a2ae0,_0x36b21b){var _0x2eab96={};var _0x4773a7={};var _0x227602;var _0x5c971e;return db[_0x7142('0x41')][_0x7142('0x4c')]({'where':{'id':_0x2618b4[_0x7142('0x46')]['id']}})[_0x7142('0x23')](handleEntityNotFound(_0x1a2ae0,null))[_0x7142('0x23')](function(_0x46b726){if(_0x46b726){_0x227602=_0x46b726;_0x4773a7[_0x7142('0x32')]=_[_0x7142('0x2b')](db[_0x7142('0x4e')][_0x7142('0x47')]);_0x4773a7[_0x7142('0x2c')]=_['keys'](_0x2618b4[_0x7142('0x2c')]);_0x4773a7['filters']=_[_0x7142('0x2e')](_0x4773a7[_0x7142('0x32')],_0x4773a7[_0x7142('0x2c')]);_0x2eab96[_0x7142('0x30')]=_[_0x7142('0x2e')](_0x4773a7[_0x7142('0x32')],qs['fields'](_0x2618b4['query']['fields']));_0x2eab96['attributes']=_0x2eab96[_0x7142('0x30')][_0x7142('0x31')]?_0x2eab96[_0x7142('0x30')]:_0x4773a7[_0x7142('0x32')];_0x2eab96[_0x7142('0x36')]=qs[_0x7142('0x37')](_0x2618b4[_0x7142('0x2c')]['sort']);_0x2eab96[_0x7142('0x38')]=qs[_0x7142('0x2d')](_[_0x7142('0x39')](_0x2618b4[_0x7142('0x2c')],_0x4773a7[_0x7142('0x2d')]));if(_0x2618b4[_0x7142('0x2c')][_0x7142('0x3a')]){_0x2eab96['where']=_[_0x7142('0x3d')](_0x2eab96[_0x7142('0x38')],{'$or':_[_0x7142('0x29')](_0x2eab96[_0x7142('0x30')],function(_0x43ca1b){var _0x16c970={};_0x16c970[_0x43ca1b]={'$like':'%'+_0x2618b4[_0x7142('0x2c')]['filter']+'%'};return _0x16c970;})});}_0x2eab96=_[_0x7142('0x3d')]({},_0x2eab96,_0x2618b4[_0x7142('0x3e')]);return _0x227602[_0x7142('0x4f')](_0x2eab96);}})[_0x7142('0x23')](function(_0x1a23c5){if(_0x1a23c5){_0x5c971e=_0x1a23c5[_0x7142('0x31')];if(!_0x2618b4[_0x7142('0x2c')]['hasOwnProperty'](_0x7142('0x34'))){_0x2eab96['limit']=qs[_0x7142('0x35')](_0x2618b4[_0x7142('0x2c')]['limit']);_0x2eab96[_0x7142('0x1c')]=qs[_0x7142('0x1c')](_0x2618b4[_0x7142('0x2c')][_0x7142('0x1c')]);}return _0x227602[_0x7142('0x4f')](_0x2eab96);}})[_0x7142('0x23')](function(_0x458966){if(_0x458966){return _0x458966?{'count':_0x5c971e,'rows':_0x458966}:null;}})[_0x7142('0x23')](respondWithResult(_0x1a2ae0,null))[_0x7142('0x44')](handleError(_0x1a2ae0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index eaff38f..ce45e07 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 _0xf151=['path','rimraf','../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x563123,_0x353b99){var _0x5e77c2=function(_0x23decb){while(--_0x23decb){_0x563123['push'](_0x563123['shift']());}};_0x5e77c2(++_0x353b99);}(_0xf151,0xab));var _0x1f15=function(_0x190b95,_0x1132e2){_0x190b95=_0x190b95-0x0;var _0x246c2c=_0xf151[_0x190b95];return _0x246c2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f15('0x0'))(_0x1f15('0x1'));var moment=require(_0x1f15('0x2'));var BPromise=require(_0x1f15('0x3'));var rp=require(_0x1f15('0x4'));var fs=require('fs');var path=require(_0x1f15('0x5'));var rimraf=require(_0x1f15('0x6'));var config=require(_0x1f15('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x1f15('0x8')]=function(_0x5548bb,_0x4cfc7b){return _0x5548bb['define'](_0x1f15('0x9'),attributes,{'tableName':_0x1f15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5386=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations'];(function(_0x1e2c91,_0x1f259a){var _0x3e85b0=function(_0x41e7bc){while(--_0x41e7bc){_0x1e2c91['push'](_0x1e2c91['shift']());}};_0x3e85b0(++_0x1f259a);}(_0x5386,0x1e1));var _0x6538=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x5386[_0x3c97e3];return _0x9bb0ed;};'use strict';var _=require(_0x6538('0x0'));var util=require(_0x6538('0x1'));var logger=require(_0x6538('0x2'))(_0x6538('0x3'));var moment=require('moment');var BPromise=require(_0x6538('0x4'));var rp=require(_0x6538('0x5'));var fs=require('fs');var path=require(_0x6538('0x6'));var rimraf=require(_0x6538('0x7'));var config=require(_0x6538('0x8'));var attributes=require(_0x6538('0x9'));module[_0x6538('0xa')]=function(_0x2433c9,_0x4ed3fa){return _0x2433c9[_0x6538('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0x6538('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 77815a2..75d0dc3 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 _0xb835=['debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x492c3f,_0x255ab4){var _0x3d4e2a=function(_0x234140){while(--_0x234140){_0x492c3f['push'](_0x492c3f['shift']());}};_0x3d4e2a(++_0x255ab4);}(_0xb835,0xcd));var _0x5b83=function(_0x59b626,_0x31f800){_0x59b626=_0x59b626-0x0;var _0x209ec8=_0xb835[_0x59b626];return _0x209ec8;};'use strict';var _=require(_0x5b83('0x0'));var util=require(_0x5b83('0x1'));var moment=require(_0x5b83('0x2'));var BPromise=require(_0x5b83('0x3'));var rs=require(_0x5b83('0x4'));var fs=require('fs');var Redis=require(_0x5b83('0x5'));var db=require(_0x5b83('0x6'))['db'];var utils=require(_0x5b83('0x7'));var logger=require(_0x5b83('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5b83('0x9'));var client=jayson[_0x5b83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42119b,_0x16bb29,_0x50ff39){return new BPromise(function(_0x4eaa74,_0xcf842b){return client[_0x5b83('0xb')](_0x42119b,_0x50ff39)[_0x5b83('0xc')](function(_0x333220){logger[_0x5b83('0xd')](_0x5b83('0xe'),_0x16bb29,'request\x20sent');logger[_0x5b83('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x16bb29,_0x5b83('0x10'),JSON[_0x5b83('0x11')](_0x333220));if(_0x333220['error']){if(_0x333220[_0x5b83('0x12')][_0x5b83('0x13')]===0x1f4){logger[_0x5b83('0x12')](_0x5b83('0xe'),_0x16bb29,_0x333220[_0x5b83('0x12')][_0x5b83('0x14')]);return _0xcf842b(_0x333220['error'][_0x5b83('0x14')]);}logger[_0x5b83('0x12')](_0x5b83('0xe'),_0x16bb29,_0x333220[_0x5b83('0x12')][_0x5b83('0x14')]);return _0x4eaa74(_0x333220[_0x5b83('0x12')][_0x5b83('0x14')]);}else{logger[_0x5b83('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x16bb29,_0x5b83('0x10'));_0x4eaa74(_0x333220[_0x5b83('0x15')][_0x5b83('0x14')]);}})['catch'](function(_0x4efbe0){logger[_0x5b83('0x12')](_0x5b83('0xe'),_0x16bb29,_0x4efbe0);_0xcf842b(_0x4efbe0);});});} \ No newline at end of file +var _0x9199=['message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x4562b6,_0x2fd3bf){var _0x751dfa=function(_0x35a4d0){while(--_0x35a4d0){_0x4562b6['push'](_0x4562b6['shift']());}};_0x751dfa(++_0x2fd3bf);}(_0x9199,0x1e9));var _0x9919=function(_0x5b5c45,_0x199467){_0x5b5c45=_0x5b5c45-0x0;var _0x2cd0dd=_0x9199[_0x5b5c45];return _0x2cd0dd;};'use strict';var _=require(_0x9919('0x0'));var util=require(_0x9919('0x1'));var moment=require('moment');var BPromise=require(_0x9919('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9919('0x3'));var db=require(_0x9919('0x4'))['db'];var utils=require(_0x9919('0x5'));var logger=require('../../config/logger')(_0x9919('0x6'));var config=require(_0x9919('0x7'));var jayson=require(_0x9919('0x8'));var client=jayson['client'][_0x9919('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40520a,_0x2ed62b,_0x4ef41b){return new BPromise(function(_0x208e9d,_0x4a76e8){return client[_0x9919('0xa')](_0x40520a,_0x4ef41b)['then'](function(_0x2f6736){logger['info'](_0x9919('0xb'),_0x2ed62b,_0x9919('0xc'));logger['debug'](_0x9919('0xd'),_0x2ed62b,_0x9919('0xc'),JSON['stringify'](_0x2f6736));if(_0x2f6736[_0x9919('0xe')]){if(_0x2f6736[_0x9919('0xe')]['code']===0x1f4){logger[_0x9919('0xe')](_0x9919('0xb'),_0x2ed62b,_0x2f6736['error'][_0x9919('0xf')]);return _0x4a76e8(_0x2f6736[_0x9919('0xe')][_0x9919('0xf')]);}logger[_0x9919('0xe')](_0x9919('0xb'),_0x2ed62b,_0x2f6736[_0x9919('0xe')][_0x9919('0xf')]);return _0x208e9d(_0x2f6736[_0x9919('0xe')][_0x9919('0xf')]);}else{logger[_0x9919('0x10')](_0x9919('0xb'),_0x2ed62b,_0x9919('0xc'));_0x208e9d(_0x2f6736[_0x9919('0x11')][_0x9919('0xf')]);}})['catch'](function(_0x382e8a){logger[_0x9919('0xe')](_0x9919('0xb'),_0x2ed62b,_0x382e8a);_0x4a76e8(_0x382e8a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 75fdb4f..78a0808 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 _0x67cf=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x38efe1,_0x34a883){var _0x44c9fb=function(_0x3cbfea){while(--_0x3cbfea){_0x38efe1['push'](_0x38efe1['shift']());}};_0x44c9fb(++_0x34a883);}(_0x67cf,0x6d));var _0xf67c=function(_0x2d7a4b,_0xa36b04){_0x2d7a4b=_0x2d7a4b-0x0;var _0x603707=_0x67cf[_0x2d7a4b];return _0x603707;};'use strict';var multer=require(_0xf67c('0x0'));var util=require(_0xf67c('0x1'));var path=require(_0xf67c('0x2'));var timeout=require(_0xf67c('0x3'));var express=require(_0xf67c('0x4'));var router=express[_0xf67c('0x5')]();var fs_extra=require(_0xf67c('0x6'));var auth=require(_0xf67c('0x7'));var interaction=require(_0xf67c('0x8'));var config=require(_0xf67c('0x9'));var controller=require(_0xf67c('0xa'));router[_0xf67c('0xb')]('/',auth[_0xf67c('0xc')](),controller[_0xf67c('0xd')]);router[_0xf67c('0xb')](_0xf67c('0xe'),auth[_0xf67c('0xc')](),controller[_0xf67c('0xf')]);router[_0xf67c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf67c('0x11')]('/:id',auth[_0xf67c('0xc')](),controller[_0xf67c('0x12')]);router['delete'](_0xf67c('0xe'),auth[_0xf67c('0xc')](),controller[_0xf67c('0x13')]);module[_0xf67c('0x14')]=router; \ No newline at end of file +var _0x4b46=['get','/:id','show','post','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x4b46,0x1a8));var _0x64b4=function(_0x30b307,_0x42cea0){_0x30b307=_0x30b307-0x0;var _0x15e995=_0x4b46[_0x30b307];return _0x15e995;};'use strict';var multer=require(_0x64b4('0x0'));var util=require('util');var path=require(_0x64b4('0x1'));var timeout=require('connect-timeout');var express=require(_0x64b4('0x2'));var router=express[_0x64b4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x64b4('0x4'));var interaction=require(_0x64b4('0x5'));var config=require('../../config/environment');var controller=require(_0x64b4('0x6'));router['get']('/',auth[_0x64b4('0x7')](),controller['index']);router[_0x64b4('0x8')](_0x64b4('0x9'),auth['isAuthenticated'](),controller[_0x64b4('0xa')]);router[_0x64b4('0xb')]('/',auth[_0x64b4('0x7')](),controller['create']);router['put']('/:id',auth[_0x64b4('0x7')](),controller[_0x64b4('0xc')]);router[_0x64b4('0xd')]('/:id',auth[_0x64b4('0x7')](),controller[_0x64b4('0xe')]);module[_0x64b4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 8d6c214..74854da 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 _0x274a=['variable','sequelize','exports','string','customVariable','keyValue','picklist','STRING'];(function(_0x5d6c60,_0x15d20b){var _0x181b29=function(_0x1360f4){while(--_0x1360f4){_0x5d6c60['push'](_0x5d6c60['shift']());}};_0x181b29(++_0x15d20b);}(_0x274a,0x189));var _0xa274=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x274a[_0x172747];return _0x509692;};'use strict';var Sequelize=require(_0xa274('0x0'));module[_0xa274('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa274('0x2'),'variable',_0xa274('0x3'),_0xa274('0x4'),_0xa274('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa274('0x6')]},'key':{'type':Sequelize[_0xa274('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa274('0x2'),_0xa274('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xa274('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa274('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecc1=['STRING','customVariable','sequelize','ENUM','variable','picklist','string'];(function(_0x20259c,_0xe43fb2){var _0x4d988e=function(_0x2097b9){while(--_0x2097b9){_0x20259c['push'](_0x20259c['shift']());}};_0x4d988e(++_0xe43fb2);}(_0xecc1,0x167));var _0x1ecc=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xecc1[_0x1dbaf7];return _0x593f05;};'use strict';var Sequelize=require(_0x1ecc('0x0'));module['exports']={'type':{'type':Sequelize[_0x1ecc('0x1')]('string',_0x1ecc('0x2'),'customVariable','keyValue',_0x1ecc('0x3')),'defaultValue':_0x1ecc('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1ecc('0x5')]},'keyType':{'type':Sequelize[_0x1ecc('0x1')]('string',_0x1ecc('0x2'),_0x1ecc('0x6'))},'keyContent':{'type':Sequelize[_0x1ecc('0x5')]},'idField':{'type':Sequelize[_0x1ecc('0x5')]},'nameField':{'type':Sequelize[_0x1ecc('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ecc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9a36b91..04057fe 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 _0x9843=['send','map','fieldName','type','key','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','ServicenowField','includeAll','include','rows','catch','rawAttributes','intersection','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name'];(function(_0x13f83f,_0x44e4b6){var _0x5648f5=function(_0x2611bb){while(--_0x2611bb){_0x13f83f['push'](_0x13f83f['shift']());}};_0x5648f5(++_0x44e4b6);}(_0x9843,0x1ca));var _0x3984=function(_0x20fbd5,_0x548e19){_0x20fbd5=_0x20fbd5-0x0;var _0x1bf745=_0x9843[_0x20fbd5];return _0x1bf745;};'use strict';var emlformat=require(_0x3984('0x0'));var rimraf=require(_0x3984('0x1'));var zipdir=require(_0x3984('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3984('0x3'));var moment=require(_0x3984('0x4'));var BPromise=require(_0x3984('0x5'));var Mustache=require('mustache');var util=require(_0x3984('0x6'));var path=require(_0x3984('0x7'));var sox=require('sox');var csv=require(_0x3984('0x8'));var ejs=require(_0x3984('0x9'));var fs=require('fs');var fs_extra=require(_0x3984('0xa'));var _=require(_0x3984('0xb'));var squel=require(_0x3984('0xc'));var crypto=require(_0x3984('0xd'));var jsforce=require(_0x3984('0xe'));var deskjs=require(_0x3984('0xf'));var toCsv=require(_0x3984('0x8'));var querystring=require(_0x3984('0x10'));var Papa=require('papaparse');var Redis=require(_0x3984('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3984('0x12'));var as=require(_0x3984('0x13'));var hardwareService=require(_0x3984('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3984('0x15'));var config=require(_0x3984('0x16'));var licenseUtil=require(_0x3984('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ab8bf,_0x16e6bc){_0x16e6bc=_0x16e6bc||0xcc;return function(_0xe4521f){if(_0xe4521f){return _0x4ab8bf['sendStatus'](_0x16e6bc);}return _0x4ab8bf['status'](_0x16e6bc)[_0x3984('0x18')]();};}function respondWithResult(_0x193849,_0x3d30a9){_0x3d30a9=_0x3d30a9||0xc8;return function(_0x2d6953){if(_0x2d6953){return _0x193849[_0x3984('0x19')](_0x3d30a9)[_0x3984('0x1a')](_0x2d6953);}};}function respondWithFilteredResult(_0x3270f8,_0x2f7fab){return function(_0x3cccce){if(_0x3cccce){var _0x5cf79e=typeof _0x2f7fab[_0x3984('0x1b')]===_0x3984('0x1c')&&typeof _0x2f7fab[_0x3984('0x1d')]==='undefined';var _0x5dd189=_0x3cccce[_0x3984('0x1e')];var _0x48d0a3=_0x5cf79e?0x0:_0x2f7fab[_0x3984('0x1b')];var _0x517c18=_0x5cf79e?_0x3cccce[_0x3984('0x1e')]:_0x2f7fab[_0x3984('0x1b')]+_0x2f7fab[_0x3984('0x1d')];var _0x7eae48;if(_0x517c18>=_0x5dd189){_0x517c18=_0x5dd189;_0x7eae48=0xc8;}else{_0x7eae48=0xce;}_0x3270f8['status'](_0x7eae48);return _0x3270f8[_0x3984('0x1f')](_0x3984('0x20'),_0x48d0a3+'-'+_0x517c18+'/'+_0x5dd189)['json'](_0x3cccce);}return null;};}function patchUpdates(_0x17bde2){return function(_0x53946e){try{jsonpatch['apply'](_0x53946e,_0x17bde2,!![]);}catch(_0x3b30ca){return BPromise[_0x3984('0x21')](_0x3b30ca);}return _0x53946e[_0x3984('0x22')]();};}function saveUpdates(_0x5bf989,_0xe7d7e4){return function(_0x4ee772){if(_0x4ee772){return _0x4ee772[_0x3984('0x23')](_0x5bf989)[_0x3984('0x24')](function(_0x5cce96){return _0x5cce96;});}return null;};}function removeEntity(_0x5090ab,_0x5953aa){return function(_0x132ad3){if(_0x132ad3){return _0x132ad3[_0x3984('0x25')]()[_0x3984('0x24')](function(){_0x5090ab['status'](0xcc)[_0x3984('0x18')]();});}};}function handleEntityNotFound(_0x59be8d,_0x24f88d){return function(_0x135cac){if(!_0x135cac){_0x59be8d['sendStatus'](0x194);}return _0x135cac;};}function handleError(_0x4f4651,_0x3b6419){_0x3b6419=_0x3b6419||0x1f4;return function(_0x1aa214){logger['error'](_0x1aa214['stack']);if(_0x1aa214[_0x3984('0x26')]){delete _0x1aa214['name'];}_0x4f4651[_0x3984('0x19')](_0x3b6419)[_0x3984('0x27')](_0x1aa214);};}exports['index']=function(_0x4ace62,_0x299c61){var _0x2cf87b={},_0x4ad474={},_0x1d9d0d={'count':0x0,'rows':[]};var _0x50e15a=_[_0x3984('0x28')](db['ServicenowField']['rawAttributes'],function(_0x5cc883){return{'name':_0x5cc883[_0x3984('0x29')],'type':_0x5cc883[_0x3984('0x2a')][_0x3984('0x2b')]};});_0x4ad474['model']=_['map'](_0x50e15a,_0x3984('0x26'));_0x4ad474[_0x3984('0x2c')]=_[_0x3984('0x2d')](_0x4ace62['query']);_0x4ad474[_0x3984('0x2e')]=_['intersection'](_0x4ad474['model'],_0x4ad474['query']);_0x2cf87b[_0x3984('0x2f')]=_['intersection'](_0x4ad474['model'],qs[_0x3984('0x30')](_0x4ace62[_0x3984('0x2c')][_0x3984('0x30')]));_0x2cf87b[_0x3984('0x2f')]=_0x2cf87b['attributes'][_0x3984('0x31')]?_0x2cf87b[_0x3984('0x2f')]:_0x4ad474[_0x3984('0x32')];if(!_0x4ace62[_0x3984('0x2c')][_0x3984('0x33')](_0x3984('0x34'))){_0x2cf87b['limit']=qs['limit'](_0x4ace62[_0x3984('0x2c')]['limit']);_0x2cf87b['offset']=qs[_0x3984('0x1b')](_0x4ace62[_0x3984('0x2c')][_0x3984('0x1b')]);}_0x2cf87b[_0x3984('0x35')]=qs[_0x3984('0x36')](_0x4ace62['query'][_0x3984('0x36')]);_0x2cf87b['where']=qs[_0x3984('0x2e')](_[_0x3984('0x37')](_0x4ace62['query'],_0x4ad474['filters']),_0x50e15a);if(_0x4ace62[_0x3984('0x2c')]['filter']){_0x2cf87b[_0x3984('0x38')]=_[_0x3984('0x39')](_0x2cf87b[_0x3984('0x38')],{'$or':_[_0x3984('0x28')](_0x50e15a,function(_0x5b92a5){if(_0x5b92a5[_0x3984('0x2a')]!==_0x3984('0x3a')){var _0x987b47={};_0x987b47[_0x5b92a5['name']]={'$like':'%'+_0x4ace62['query']['filter']+'%'};return _0x987b47;}})});}_0x2cf87b=_[_0x3984('0x39')]({},_0x2cf87b,_0x4ace62[_0x3984('0x3b')]);var _0x10be27={'where':_0x2cf87b[_0x3984('0x38')]};return db[_0x3984('0x3c')][_0x3984('0x1e')](_0x10be27)['then'](function(_0x5240fa){_0x1d9d0d[_0x3984('0x1e')]=_0x5240fa;if(_0x4ace62[_0x3984('0x2c')][_0x3984('0x3d')]){_0x2cf87b[_0x3984('0x3e')]=[{'all':!![]}];}return db[_0x3984('0x3c')]['findAll'](_0x2cf87b);})[_0x3984('0x24')](function(_0x192c01){_0x1d9d0d[_0x3984('0x3f')]=_0x192c01;return _0x1d9d0d;})[_0x3984('0x24')](respondWithFilteredResult(_0x299c61,_0x2cf87b))[_0x3984('0x40')](handleError(_0x299c61,null));};exports['show']=function(_0x268090,_0x1dac1b){var _0x3d8e6d={'raw':!![],'where':{'id':_0x268090['params']['id']}},_0x379c3f={};_0x379c3f[_0x3984('0x32')]=_['keys'](db['ServicenowField'][_0x3984('0x41')]);_0x379c3f[_0x3984('0x2c')]=_[_0x3984('0x2d')](_0x268090[_0x3984('0x2c')]);_0x379c3f[_0x3984('0x2e')]=_[_0x3984('0x42')](_0x379c3f[_0x3984('0x32')],_0x379c3f[_0x3984('0x2c')]);_0x3d8e6d[_0x3984('0x2f')]=_[_0x3984('0x42')](_0x379c3f['model'],qs[_0x3984('0x30')](_0x268090[_0x3984('0x2c')]['fields']));_0x3d8e6d['attributes']=_0x3d8e6d[_0x3984('0x2f')][_0x3984('0x31')]?_0x3d8e6d['attributes']:_0x379c3f['model'];if(_0x268090[_0x3984('0x2c')][_0x3984('0x3d')]){_0x3d8e6d[_0x3984('0x3e')]=[{'all':!![]}];}_0x3d8e6d=_[_0x3984('0x39')]({},_0x3d8e6d,_0x268090[_0x3984('0x3b')]);return db[_0x3984('0x3c')]['find'](_0x3d8e6d)[_0x3984('0x24')](handleEntityNotFound(_0x1dac1b,null))[_0x3984('0x24')](respondWithResult(_0x1dac1b,null))['catch'](handleError(_0x1dac1b,null));};exports[_0x3984('0x43')]=function(_0x13b1ec,_0x5d0285){return db[_0x3984('0x3c')][_0x3984('0x43')](_0x13b1ec[_0x3984('0x44')],{})[_0x3984('0x24')](respondWithResult(_0x5d0285,0xc9))[_0x3984('0x40')](handleError(_0x5d0285,null));};exports['update']=function(_0x1c3522,_0x5a87f0){if(_0x1c3522[_0x3984('0x44')]['id']){delete _0x1c3522[_0x3984('0x44')]['id'];}return db[_0x3984('0x3c')][_0x3984('0x45')]({'where':{'id':_0x1c3522[_0x3984('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a87f0,null))[_0x3984('0x24')](saveUpdates(_0x1c3522[_0x3984('0x44')],null))[_0x3984('0x24')](respondWithResult(_0x5a87f0,null))[_0x3984('0x40')](handleError(_0x5a87f0,null));};exports[_0x3984('0x25')]=function(_0xc691b3,_0x3ea5d8){return db[_0x3984('0x3c')]['find']({'where':{'id':_0xc691b3['params']['id']}})['then'](handleEntityNotFound(_0x3ea5d8,null))['then'](removeEntity(_0x3ea5d8,null))[_0x3984('0x40')](handleError(_0x3ea5d8,null));}; \ No newline at end of file +var _0xd846=['model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','fields','options','find','catch','create','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','query','keys','filters','attributes','intersection'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd846,0xad));var _0x6d84=function(_0x35b214,_0x158bd2){_0x35b214=_0x35b214-0x0;var _0x515407=_0xd846[_0x35b214];return _0x515407;};'use strict';var emlformat=require(_0x6d84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d84('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d84('0x2'));var moment=require(_0x6d84('0x3'));var BPromise=require(_0x6d84('0x4'));var Mustache=require(_0x6d84('0x5'));var util=require(_0x6d84('0x6'));var path=require(_0x6d84('0x7'));var sox=require(_0x6d84('0x8'));var csv=require('to-csv');var ejs=require(_0x6d84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d84('0xa'));var squel=require('squel');var crypto=require(_0x6d84('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6d84('0xc'));var toCsv=require(_0x6d84('0xd'));var querystring=require(_0x6d84('0xe'));var Papa=require(_0x6d84('0xf'));var Redis=require(_0x6d84('0x10'));var authService=require(_0x6d84('0x11'));var qs=require(_0x6d84('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d84('0x13'));var logger=require(_0x6d84('0x14'))(_0x6d84('0x15'));var utils=require(_0x6d84('0x16'));var config=require(_0x6d84('0x17'));var licenseUtil=require(_0x6d84('0x18'));var db=require(_0x6d84('0x19'))['db'];function respondWithStatusCode(_0x484600,_0x21e9b0){_0x21e9b0=_0x21e9b0||0xcc;return function(_0xaa0476){if(_0xaa0476){return _0x484600[_0x6d84('0x1a')](_0x21e9b0);}return _0x484600[_0x6d84('0x1b')](_0x21e9b0)[_0x6d84('0x1c')]();};}function respondWithResult(_0x4a91b0,_0x41f00a){_0x41f00a=_0x41f00a||0xc8;return function(_0x4abb41){if(_0x4abb41){return _0x4a91b0[_0x6d84('0x1b')](_0x41f00a)[_0x6d84('0x1d')](_0x4abb41);}};}function respondWithFilteredResult(_0x494ecd,_0x278bc0){return function(_0x32276e){if(_0x32276e){var _0x51e97b=typeof _0x278bc0[_0x6d84('0x1e')]==='undefined'&&typeof _0x278bc0[_0x6d84('0x1f')]===_0x6d84('0x20');var _0x4a9e9f=_0x32276e[_0x6d84('0x21')];var _0x52ac23=_0x51e97b?0x0:_0x278bc0[_0x6d84('0x1e')];var _0x119077=_0x51e97b?_0x32276e[_0x6d84('0x21')]:_0x278bc0[_0x6d84('0x1e')]+_0x278bc0[_0x6d84('0x1f')];var _0x3abe9e;if(_0x119077>=_0x4a9e9f){_0x119077=_0x4a9e9f;_0x3abe9e=0xc8;}else{_0x3abe9e=0xce;}_0x494ecd[_0x6d84('0x1b')](_0x3abe9e);return _0x494ecd[_0x6d84('0x22')](_0x6d84('0x23'),_0x52ac23+'-'+_0x119077+'/'+_0x4a9e9f)['json'](_0x32276e);}return null;};}function patchUpdates(_0x26289a){return function(_0x55f2b6){try{jsonpatch[_0x6d84('0x24')](_0x55f2b6,_0x26289a,!![]);}catch(_0x777d98){return BPromise['reject'](_0x777d98);}return _0x55f2b6[_0x6d84('0x25')]();};}function saveUpdates(_0x14640d,_0x219095){return function(_0x253ef8){if(_0x253ef8){return _0x253ef8[_0x6d84('0x26')](_0x14640d)[_0x6d84('0x27')](function(_0x5f494f){return _0x5f494f;});}return null;};}function removeEntity(_0x546c6d,_0x5eeaf2){return function(_0x523869){if(_0x523869){return _0x523869['destroy']()[_0x6d84('0x27')](function(){_0x546c6d[_0x6d84('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a3f2,_0x5e67c9){return function(_0x438277){if(!_0x438277){_0x48a3f2[_0x6d84('0x1a')](0x194);}return _0x438277;};}function handleError(_0xc1136f,_0x2e05f0){_0x2e05f0=_0x2e05f0||0x1f4;return function(_0x6ac4fc){logger[_0x6d84('0x28')](_0x6ac4fc[_0x6d84('0x29')]);if(_0x6ac4fc[_0x6d84('0x2a')]){delete _0x6ac4fc[_0x6d84('0x2a')];}_0xc1136f[_0x6d84('0x1b')](_0x2e05f0)[_0x6d84('0x2b')](_0x6ac4fc);};}exports[_0x6d84('0x2c')]=function(_0x41c540,_0x4a8adf){var _0x44c981={},_0x2faa00={},_0x8b6e04={'count':0x0,'rows':[]};var _0x140b60=_[_0x6d84('0x2d')](db[_0x6d84('0x2e')][_0x6d84('0x2f')],function(_0xff1523){return{'name':_0xff1523['fieldName'],'type':_0xff1523[_0x6d84('0x30')][_0x6d84('0x31')]};});_0x2faa00['model']=_[_0x6d84('0x2d')](_0x140b60,_0x6d84('0x2a'));_0x2faa00[_0x6d84('0x32')]=_[_0x6d84('0x33')](_0x41c540[_0x6d84('0x32')]);_0x2faa00[_0x6d84('0x34')]=_['intersection'](_0x2faa00['model'],_0x2faa00['query']);_0x44c981[_0x6d84('0x35')]=_[_0x6d84('0x36')](_0x2faa00[_0x6d84('0x37')],qs['fields'](_0x41c540[_0x6d84('0x32')]['fields']));_0x44c981['attributes']=_0x44c981[_0x6d84('0x35')]['length']?_0x44c981[_0x6d84('0x35')]:_0x2faa00[_0x6d84('0x37')];if(!_0x41c540['query'][_0x6d84('0x38')](_0x6d84('0x39'))){_0x44c981['limit']=qs[_0x6d84('0x1f')](_0x41c540[_0x6d84('0x32')][_0x6d84('0x1f')]);_0x44c981[_0x6d84('0x1e')]=qs[_0x6d84('0x1e')](_0x41c540[_0x6d84('0x32')][_0x6d84('0x1e')]);}_0x44c981[_0x6d84('0x3a')]=qs[_0x6d84('0x3b')](_0x41c540[_0x6d84('0x32')][_0x6d84('0x3b')]);_0x44c981[_0x6d84('0x3c')]=qs['filters'](_[_0x6d84('0x3d')](_0x41c540[_0x6d84('0x32')],_0x2faa00['filters']),_0x140b60);if(_0x41c540[_0x6d84('0x32')][_0x6d84('0x3e')]){_0x44c981[_0x6d84('0x3c')]=_[_0x6d84('0x3f')](_0x44c981[_0x6d84('0x3c')],{'$or':_[_0x6d84('0x2d')](_0x140b60,function(_0x135360){if(_0x135360[_0x6d84('0x30')]!==_0x6d84('0x40')){var _0x2862e2={};_0x2862e2[_0x135360[_0x6d84('0x2a')]]={'$like':'%'+_0x41c540[_0x6d84('0x32')][_0x6d84('0x3e')]+'%'};return _0x2862e2;}})});}_0x44c981=_[_0x6d84('0x3f')]({},_0x44c981,_0x41c540['options']);var _0x2398f2={'where':_0x44c981[_0x6d84('0x3c')]};return db['ServicenowField'][_0x6d84('0x21')](_0x2398f2)[_0x6d84('0x27')](function(_0x2198e5){_0x8b6e04[_0x6d84('0x21')]=_0x2198e5;if(_0x41c540[_0x6d84('0x32')][_0x6d84('0x41')]){_0x44c981['include']=[{'all':!![]}];}return db[_0x6d84('0x2e')][_0x6d84('0x42')](_0x44c981);})[_0x6d84('0x27')](function(_0x2f96d0){_0x8b6e04[_0x6d84('0x43')]=_0x2f96d0;return _0x8b6e04;})[_0x6d84('0x27')](respondWithFilteredResult(_0x4a8adf,_0x44c981))['catch'](handleError(_0x4a8adf,null));};exports['show']=function(_0x25273c,_0x405b3a){var _0x1c1e5a={'raw':!![],'where':{'id':_0x25273c[_0x6d84('0x44')]['id']}},_0x15407a={};_0x15407a[_0x6d84('0x37')]=_['keys'](db[_0x6d84('0x2e')][_0x6d84('0x2f')]);_0x15407a[_0x6d84('0x32')]=_[_0x6d84('0x33')](_0x25273c[_0x6d84('0x32')]);_0x15407a['filters']=_['intersection'](_0x15407a['model'],_0x15407a[_0x6d84('0x32')]);_0x1c1e5a[_0x6d84('0x35')]=_[_0x6d84('0x36')](_0x15407a[_0x6d84('0x37')],qs[_0x6d84('0x45')](_0x25273c[_0x6d84('0x32')][_0x6d84('0x45')]));_0x1c1e5a[_0x6d84('0x35')]=_0x1c1e5a['attributes']['length']?_0x1c1e5a[_0x6d84('0x35')]:_0x15407a['model'];if(_0x25273c[_0x6d84('0x32')][_0x6d84('0x41')]){_0x1c1e5a['include']=[{'all':!![]}];}_0x1c1e5a=_[_0x6d84('0x3f')]({},_0x1c1e5a,_0x25273c[_0x6d84('0x46')]);return db[_0x6d84('0x2e')][_0x6d84('0x47')](_0x1c1e5a)['then'](handleEntityNotFound(_0x405b3a,null))['then'](respondWithResult(_0x405b3a,null))[_0x6d84('0x48')](handleError(_0x405b3a,null));};exports[_0x6d84('0x49')]=function(_0x5ab3dc,_0x43c389){return db[_0x6d84('0x2e')][_0x6d84('0x49')](_0x5ab3dc[_0x6d84('0x4a')],{})[_0x6d84('0x27')](respondWithResult(_0x43c389,0xc9))[_0x6d84('0x48')](handleError(_0x43c389,null));};exports[_0x6d84('0x26')]=function(_0x5e2900,_0x5c8d33){if(_0x5e2900[_0x6d84('0x4a')]['id']){delete _0x5e2900[_0x6d84('0x4a')]['id'];}return db[_0x6d84('0x2e')][_0x6d84('0x47')]({'where':{'id':_0x5e2900[_0x6d84('0x44')]['id']}})[_0x6d84('0x27')](handleEntityNotFound(_0x5c8d33,null))[_0x6d84('0x27')](saveUpdates(_0x5e2900[_0x6d84('0x4a')],null))[_0x6d84('0x27')](respondWithResult(_0x5c8d33,null))['catch'](handleError(_0x5c8d33,null));};exports[_0x6d84('0x4b')]=function(_0x109fe7,_0x3e8703){return db[_0x6d84('0x2e')][_0x6d84('0x47')]({'where':{'id':_0x109fe7[_0x6d84('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e8703,null))[_0x6d84('0x27')](removeEntity(_0x3e8703,null))['catch'](handleError(_0x3e8703,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 397397c..19d1232 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 _0x9d55=['api','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x58e6ac,_0x271bee){var _0x4339af=function(_0x45bc49){while(--_0x45bc49){_0x58e6ac['push'](_0x58e6ac['shift']());}};_0x4339af(++_0x271bee);}(_0x9d55,0x1b9));var _0x59d5=function(_0x151c9e,_0x19707b){_0x151c9e=_0x151c9e-0x0;var _0x502cee=_0x9d55[_0x151c9e];return _0x502cee;};'use strict';var _=require(_0x59d5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x59d5('0x1'));var moment=require(_0x59d5('0x2'));var BPromise=require(_0x59d5('0x3'));var rp=require(_0x59d5('0x4'));var fs=require('fs');var path=require(_0x59d5('0x5'));var rimraf=require(_0x59d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x59d5('0x7'));module[_0x59d5('0x8')]=function(_0x5b58e9,_0x237489){return _0x5b58e9[_0x59d5('0x9')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x59d5('0xa'),'fields':[_0x59d5('0xb'),_0x59d5('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee3e=['api','bluebird','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x586207,_0x297988){var _0x3032a3=function(_0x4ace85){while(--_0x4ace85){_0x586207['push'](_0x586207['shift']());}};_0x3032a3(++_0x297988);}(_0xee3e,0x1aa));var _0xeee3=function(_0x41a097,_0x51dce8){_0x41a097=_0x41a097-0x0;var _0x45486b=_0xee3e[_0x41a097];return _0x45486b;};'use strict';var _=require(_0xeee3('0x0'));var util=require(_0xeee3('0x1'));var logger=require(_0xeee3('0x2'))(_0xeee3('0x3'));var moment=require('moment');var BPromise=require(_0xeee3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeee3('0x5'));var attributes=require(_0xeee3('0x6'));module[_0xeee3('0x7')]=function(_0x3eb011,_0x3487c2){return _0x3eb011[_0xeee3('0x8')](_0xeee3('0x9'),attributes,{'tableName':_0xeee3('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xeee3('0xb'),_0xeee3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 2e5125a..5bead7f 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x234cd4,_0x1ff933){var _0xa9d509=function(_0x58f263){while(--_0x58f263){_0x234cd4['push'](_0x234cd4['shift']());}};_0xa9d509(++_0x1ff933);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4a52ad,_0x2f220e){_0x4a52ad=_0x4a52ad-0x0;var _0x231eb4=_0xb43b[_0x4a52ad];return _0x231eb4;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x382868,_0xb5acfd){_0x382868=_0x382868-0x0;var _0x43e191=_0xbdb7[_0x382868];return _0x43e191;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fa5a74e..4692583 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(_0xfc3391,_0x10c877){var _0x11e7c6=function(_0x4a0e8b){while(--_0x4a0e8b){_0xfc3391['push'](_0xfc3391['shift']());}};_0x11e7c6(++_0x10c877);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x6ca7e6,_0x8d1556){var _0x1b2bd5=function(_0x39472a){while(--_0x39472a){_0x6ca7e6['push'](_0x6ca7e6['shift']());}};_0x1b2bd5(++_0x8d1556);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 6dbda7e..5b13694 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(_0xe8c443,_0x319242){var _0x402d07=function(_0xc0f3d6){while(--_0xc0f3d6){_0xe8c443['push'](_0xe8c443['shift']());}};_0x402d07(++_0x319242);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x115382,_0x4f08c4){var _0x24dea7=function(_0x1e646e){while(--_0x1e646e){_0x115382['push'](_0x115382['shift']());}};_0x24dea7(++_0x4f08c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 ed6ec08..ba236db 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 _0x1a3c=['includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','SugarcrmConfiguration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_name','direction','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options'];(function(_0x41cda7,_0x1b2fab){var _0x120bbf=function(_0x4d38db){while(--_0x4d38db){_0x41cda7['push'](_0x41cda7['shift']());}};_0x120bbf(++_0x1b2fab);}(_0x1a3c,0x1a6));var _0xc1a3=function(_0x4a71c6,_0x204b11){_0x4a71c6=_0x4a71c6-0x0;var _0x23f6d8=_0x1a3c[_0x4a71c6];return _0x23f6d8;};'use strict';var emlformat=require(_0xc1a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1a3('0x2'));var moment=require(_0xc1a3('0x3'));var BPromise=require(_0xc1a3('0x4'));var Mustache=require(_0xc1a3('0x5'));var util=require(_0xc1a3('0x6'));var path=require('path');var sox=require(_0xc1a3('0x7'));var csv=require(_0xc1a3('0x8'));var ejs=require(_0xc1a3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1a3('0xa'));var squel=require(_0xc1a3('0xb'));var crypto=require('crypto');var jsforce=require(_0xc1a3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1a3('0xd'));var Redis=require(_0xc1a3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc1a3('0xf'));var as=require(_0xc1a3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1a3('0x11'))(_0xc1a3('0x12'));var utils=require(_0xc1a3('0x13'));var config=require(_0xc1a3('0x14'));var licenseUtil=require(_0xc1a3('0x15'));var db=require(_0xc1a3('0x16'))['db'];var integrations=require(_0xc1a3('0x17'));function respondWithStatusCode(_0x122c8f,_0x8413fe){_0x8413fe=_0x8413fe||0xcc;return function(_0x40e5de){if(_0x40e5de){return _0x122c8f[_0xc1a3('0x18')](_0x8413fe);}return _0x122c8f[_0xc1a3('0x19')](_0x8413fe)[_0xc1a3('0x1a')]();};}function respondWithResult(_0x4d9dcc,_0x3958b1){_0x3958b1=_0x3958b1||0xc8;return function(_0x3271b6){if(_0x3271b6){return _0x4d9dcc['status'](_0x3958b1)[_0xc1a3('0x1b')](_0x3271b6);}};}function respondWithFilteredResult(_0x488f51,_0xb3a107){return function(_0x44faea){if(_0x44faea){var _0x139fc2=typeof _0xb3a107[_0xc1a3('0x1c')]===_0xc1a3('0x1d')&&typeof _0xb3a107[_0xc1a3('0x1e')]===_0xc1a3('0x1d');var _0x1982c5=_0x44faea[_0xc1a3('0x1f')];var _0x135b25=_0x139fc2?0x0:_0xb3a107[_0xc1a3('0x1c')];var _0x16f680=_0x139fc2?_0x44faea['count']:_0xb3a107['offset']+_0xb3a107['limit'];var _0x3233af;if(_0x16f680>=_0x1982c5){_0x16f680=_0x1982c5;_0x3233af=0xc8;}else{_0x3233af=0xce;}_0x488f51['status'](_0x3233af);return _0x488f51['set'](_0xc1a3('0x20'),_0x135b25+'-'+_0x16f680+'/'+_0x1982c5)[_0xc1a3('0x1b')](_0x44faea);}return null;};}function patchUpdates(_0x20ac11){return function(_0x54e6a2){try{jsonpatch[_0xc1a3('0x21')](_0x54e6a2,_0x20ac11,!![]);}catch(_0x4c31cb){return BPromise['reject'](_0x4c31cb);}return _0x54e6a2['save']();};}function saveUpdates(_0x2d9ac2,_0x13558c){return function(_0x2a8aeb){if(_0x2a8aeb){return _0x2a8aeb[_0xc1a3('0x22')](_0x2d9ac2)[_0xc1a3('0x23')](function(_0x20e306){return _0x20e306;});}return null;};}function removeEntity(_0x13bf2e,_0x3a2887){return function(_0x3a9597){if(_0x3a9597){return _0x3a9597[_0xc1a3('0x24')]()[_0xc1a3('0x23')](function(){_0x13bf2e[_0xc1a3('0x19')](0xcc)[_0xc1a3('0x1a')]();});}};}function handleEntityNotFound(_0x5360da,_0x25ce9f){return function(_0x3c1ff2){if(!_0x3c1ff2){_0x5360da[_0xc1a3('0x18')](0x194);}return _0x3c1ff2;};}function handleError(_0x5a60e4,_0x182be7){_0x182be7=_0x182be7||0x1f4;return function(_0x3527de){logger[_0xc1a3('0x25')](_0x3527de[_0xc1a3('0x26')]);if(_0x3527de[_0xc1a3('0x27')]){delete _0x3527de[_0xc1a3('0x27')];}_0x5a60e4[_0xc1a3('0x19')](_0x182be7)['send'](_0x3527de);};}exports[_0xc1a3('0x28')]=function(_0x1d8a70,_0x27ac47){var _0x46ed04={},_0x55638b={},_0x2f2135={'count':0x0,'rows':[]};var _0x245748=_[_0xc1a3('0x29')](db[_0xc1a3('0x2a')][_0xc1a3('0x2b')],function(_0x53b36a){return{'name':_0x53b36a[_0xc1a3('0x2c')],'type':_0x53b36a[_0xc1a3('0x2d')][_0xc1a3('0x2e')]};});_0x55638b[_0xc1a3('0x2f')]=_['map'](_0x245748,_0xc1a3('0x27'));_0x55638b['query']=_[_0xc1a3('0x30')](_0x1d8a70['query']);_0x55638b[_0xc1a3('0x31')]=_[_0xc1a3('0x32')](_0x55638b[_0xc1a3('0x2f')],_0x55638b[_0xc1a3('0x33')]);_0x46ed04[_0xc1a3('0x34')]=_[_0xc1a3('0x32')](_0x55638b[_0xc1a3('0x2f')],qs['fields'](_0x1d8a70['query'][_0xc1a3('0x35')]));_0x46ed04['attributes']=_0x46ed04[_0xc1a3('0x34')]['length']?_0x46ed04[_0xc1a3('0x34')]:_0x55638b[_0xc1a3('0x2f')];if(!_0x1d8a70['query'][_0xc1a3('0x36')](_0xc1a3('0x37'))){_0x46ed04[_0xc1a3('0x1e')]=qs[_0xc1a3('0x1e')](_0x1d8a70['query'][_0xc1a3('0x1e')]);_0x46ed04['offset']=qs[_0xc1a3('0x1c')](_0x1d8a70['query'][_0xc1a3('0x1c')]);}_0x46ed04['order']=qs[_0xc1a3('0x38')](_0x1d8a70[_0xc1a3('0x33')][_0xc1a3('0x38')]);_0x46ed04[_0xc1a3('0x39')]=qs[_0xc1a3('0x31')](_[_0xc1a3('0x3a')](_0x1d8a70['query'],_0x55638b[_0xc1a3('0x31')]),_0x245748);if(_0x1d8a70[_0xc1a3('0x33')][_0xc1a3('0x3b')]){_0x46ed04['where']=_[_0xc1a3('0x3c')](_0x46ed04[_0xc1a3('0x39')],{'$or':_[_0xc1a3('0x29')](_0x245748,function(_0x34f351){if(_0x34f351['type']!=='VIRTUAL'){var _0x478a5d={};_0x478a5d[_0x34f351[_0xc1a3('0x27')]]={'$like':'%'+_0x1d8a70[_0xc1a3('0x33')][_0xc1a3('0x3b')]+'%'};return _0x478a5d;}})});}_0x46ed04=_[_0xc1a3('0x3c')]({},_0x46ed04,_0x1d8a70[_0xc1a3('0x3d')]);var _0x57f91d={'where':_0x46ed04['where']};return db[_0xc1a3('0x2a')][_0xc1a3('0x1f')](_0x57f91d)['then'](function(_0xd8f796){_0x2f2135['count']=_0xd8f796;if(_0x1d8a70[_0xc1a3('0x33')][_0xc1a3('0x3e')]){_0x46ed04[_0xc1a3('0x3f')]=[{'all':!![]}];}return db[_0xc1a3('0x2a')][_0xc1a3('0x40')](_0x46ed04);})[_0xc1a3('0x23')](function(_0x586435){_0x2f2135[_0xc1a3('0x41')]=_0x586435;return _0x2f2135;})[_0xc1a3('0x23')](respondWithFilteredResult(_0x27ac47,_0x46ed04))[_0xc1a3('0x42')](handleError(_0x27ac47,null));};exports[_0xc1a3('0x43')]=function(_0x1b28f3,_0x5b49c5){var _0x3abfdf={'raw':![],'where':{'id':_0x1b28f3[_0xc1a3('0x44')]['id']}},_0x574334={};_0x574334['model']=_[_0xc1a3('0x30')](db[_0xc1a3('0x2a')]['rawAttributes']);_0x574334[_0xc1a3('0x33')]=_[_0xc1a3('0x30')](_0x1b28f3[_0xc1a3('0x33')]);_0x574334[_0xc1a3('0x31')]=_[_0xc1a3('0x32')](_0x574334[_0xc1a3('0x2f')],_0x574334[_0xc1a3('0x33')]);_0x3abfdf[_0xc1a3('0x34')]=_[_0xc1a3('0x32')](_0x574334[_0xc1a3('0x2f')],qs[_0xc1a3('0x35')](_0x1b28f3['query']['fields']));_0x3abfdf['attributes']=_0x3abfdf['attributes'][_0xc1a3('0x45')]?_0x3abfdf['attributes']:_0x574334[_0xc1a3('0x2f')];if(_0x1b28f3[_0xc1a3('0x33')]['includeAll']){_0x3abfdf[_0xc1a3('0x3f')]=[{'all':!![]}];}_0x3abfdf=_[_0xc1a3('0x3c')]({},_0x3abfdf,_0x1b28f3['options']);return db[_0xc1a3('0x2a')][_0xc1a3('0x46')](_0x3abfdf)[_0xc1a3('0x23')](handleEntityNotFound(_0x5b49c5,null))[_0xc1a3('0x23')](respondWithResult(_0x5b49c5,null))[_0xc1a3('0x42')](handleError(_0x5b49c5,null));};exports[_0xc1a3('0x47')]=function(_0x39956a,_0x54e666){return db[_0xc1a3('0x2a')]['create'](_0x39956a[_0xc1a3('0x48')],{})[_0xc1a3('0x23')](respondWithResult(_0x54e666,0xc9))[_0xc1a3('0x42')](handleError(_0x54e666,null));};exports[_0xc1a3('0x22')]=function(_0xc00834,_0x1ec518){if(_0xc00834['body']['id']){delete _0xc00834[_0xc1a3('0x48')]['id'];}return db[_0xc1a3('0x2a')][_0xc1a3('0x46')]({'where':{'id':_0xc00834[_0xc1a3('0x44')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x1ec518,null))['then'](saveUpdates(_0xc00834[_0xc1a3('0x48')],null))[_0xc1a3('0x23')](respondWithResult(_0x1ec518,null))[_0xc1a3('0x42')](handleError(_0x1ec518,null));};exports[_0xc1a3('0x24')]=function(_0x7ec4ae,_0x147b86){return db['SugarcrmAccount'][_0xc1a3('0x46')]({'where':{'id':_0x7ec4ae[_0xc1a3('0x44')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x147b86,null))['then'](removeEntity(_0x147b86,null))[_0xc1a3('0x42')](handleError(_0x147b86,null));};exports[_0xc1a3('0x49')]=function(_0x41f77b,_0x5bde52,_0x40ffce){var _0x304f9d={};var _0x34d625={};var _0x4436ed;var _0x2a24ff;return db[_0xc1a3('0x2a')]['findOne']({'where':{'id':_0x41f77b['params']['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x5bde52,null))['then'](function(_0x2fbbdb){if(_0x2fbbdb){_0x4436ed=_0x2fbbdb;_0x34d625[_0xc1a3('0x2f')]=_[_0xc1a3('0x30')](db[_0xc1a3('0x4a')][_0xc1a3('0x2b')]);_0x34d625[_0xc1a3('0x33')]=_[_0xc1a3('0x30')](_0x41f77b[_0xc1a3('0x33')]);_0x34d625[_0xc1a3('0x31')]=_['intersection'](_0x34d625[_0xc1a3('0x2f')],_0x34d625[_0xc1a3('0x33')]);_0x304f9d[_0xc1a3('0x34')]=_[_0xc1a3('0x32')](_0x34d625['model'],qs[_0xc1a3('0x35')](_0x41f77b[_0xc1a3('0x33')]['fields']));_0x304f9d['attributes']=_0x304f9d[_0xc1a3('0x34')][_0xc1a3('0x45')]?_0x304f9d['attributes']:_0x34d625[_0xc1a3('0x2f')];_0x304f9d[_0xc1a3('0x4b')]=qs[_0xc1a3('0x38')](_0x41f77b[_0xc1a3('0x33')][_0xc1a3('0x38')]);_0x304f9d['where']=qs[_0xc1a3('0x31')](_[_0xc1a3('0x3a')](_0x41f77b['query'],_0x34d625['filters']));if(_0x41f77b['query']['filter']){_0x304f9d['where']=_[_0xc1a3('0x3c')](_0x304f9d['where'],{'$or':_['map'](_0x304f9d[_0xc1a3('0x34')],function(_0x443954){var _0x678195={};_0x678195[_0x443954]={'$like':'%'+_0x41f77b[_0xc1a3('0x33')][_0xc1a3('0x3b')]+'%'};return _0x678195;})});}_0x304f9d=_['merge']({},_0x304f9d,_0x41f77b['options']);return _0x4436ed[_0xc1a3('0x49')](_0x304f9d);}})[_0xc1a3('0x23')](function(_0x7b69c7){if(_0x7b69c7){_0x2a24ff=_0x7b69c7[_0xc1a3('0x45')];if(!_0x41f77b[_0xc1a3('0x33')][_0xc1a3('0x36')]('nolimit')){_0x304f9d[_0xc1a3('0x1e')]=qs[_0xc1a3('0x1e')](_0x41f77b['query'][_0xc1a3('0x1e')]);_0x304f9d[_0xc1a3('0x1c')]=qs['offset'](_0x41f77b[_0xc1a3('0x33')][_0xc1a3('0x1c')]);}return _0x4436ed[_0xc1a3('0x49')](_0x304f9d);}})[_0xc1a3('0x23')](function(_0x7cf9e6){if(_0x7cf9e6){return _0x7cf9e6?{'count':_0x2a24ff,'rows':_0x7cf9e6}:null;}})['then'](respondWithResult(_0x5bde52,null))['catch'](handleError(_0x5bde52,null));};exports[_0xc1a3('0x4c')]=function(_0x574c57,_0x592bbe,_0x15e158){if(_0x574c57[_0xc1a3('0x48')]['id']){delete _0x574c57[_0xc1a3('0x48')]['id'];}return db[_0xc1a3('0x2a')][_0xc1a3('0x4d')]({'where':{'id':_0x574c57[_0xc1a3('0x44')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x592bbe,null))[_0xc1a3('0x23')](function(_0x35e673){if(_0x35e673){_0x574c57[_0xc1a3('0x48')][_0xc1a3('0x4e')]=_0x35e673['id'];_0x574c57['body'][_0xc1a3('0x4f')]=integrations[_0xc1a3('0x50')](_0x574c57[_0xc1a3('0x48')][_0xc1a3('0x51')],_0x574c57[_0xc1a3('0x48')][_0xc1a3('0x2d')]);_0x574c57[_0xc1a3('0x48')][_0xc1a3('0x52')]=integrations['getDescriptions'](_0x574c57[_0xc1a3('0x48')][_0xc1a3('0x51')],_0x574c57[_0xc1a3('0x48')]['type']);return db[_0xc1a3('0x4a')][_0xc1a3('0x47')](_0x574c57[_0xc1a3('0x48')],{'include':[{'model':db[_0xc1a3('0x53')],'as':_0xc1a3('0x4f')},{'model':db[_0xc1a3('0x53')],'as':_0xc1a3('0x52')}]});}return null;})[_0xc1a3('0x23')](respondWithResult(_0x592bbe,null))[_0xc1a3('0x42')](handleError(_0x592bbe,null));};exports['getFields']=function(_0x42d5d2,_0x252cdb,_0x291361){var _0x16fa0b='';var _0x2a3714=['id',_0xc1a3('0x27'),_0xc1a3('0x54'),_0xc1a3('0x55'),_0xc1a3('0x56'),_0xc1a3('0x57'),'duration_hours',_0xc1a3('0x58'),_0xc1a3('0x59'),'parent_type',_0xc1a3('0x5a'),_0xc1a3('0x5b')];return db[_0xc1a3('0x2a')][_0xc1a3('0x4d')]({'where':{'id':_0x42d5d2[_0xc1a3('0x44')]['id']},'attributes':['id','username',_0xc1a3('0x5c'),_0xc1a3('0x5d')]})[_0xc1a3('0x23')](handleEntityNotFound(_0x252cdb,null))[_0xc1a3('0x23')](function(_0x1995f8){if(_0x1995f8){_0x16fa0b=_0x1995f8[_0xc1a3('0x5d')];var _0x4e9c7b=_0x16fa0b[_0xc1a3('0x5e')](-0x1);if(_0x4e9c7b==='/'){_0x16fa0b=_0x16fa0b[_0xc1a3('0x5f')](0x0,_0x16fa0b['lastIndexOf'](_0x4e9c7b));}return rp({'method':_0xc1a3('0x60'),'uri':util[_0xc1a3('0x61')](_0xc1a3('0x62'),_0x16fa0b,_0xc1a3('0x63')),'json':!![],'form':{'method':'login','input_type':_0xc1a3('0x64'),'response_type':_0xc1a3('0x64'),'rest_data':JSON[_0xc1a3('0x65')]({'user_auth':{'user_name':_0x1995f8[_0xc1a3('0x66')],'password':_0x1995f8[_0xc1a3('0x5c')],'encryption':_0xc1a3('0x67')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xc1a3('0x23')](function(_0x536020){if(_0x536020&&_0x536020[_0xc1a3('0x27')]!==_0xc1a3('0x68')&&_0x536020['name']!==_0xc1a3('0x69')){return rp({'method':'POST','uri':util[_0xc1a3('0x61')]('%s%s',_0x16fa0b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xc1a3('0x6a'),'input_type':_0xc1a3('0x64'),'response_type':'JSON','rest_data':JSON[_0xc1a3('0x65')]({'session':_0x536020['id'],'module_name':_0xc1a3('0x6b')})}})[_0xc1a3('0x23')](function(_0x56a519){if(_0x56a519){var _0x3d3e66=_[_0xc1a3('0x6c')](_0x56a519[_0xc1a3('0x6d')]);_[_0xc1a3('0x6e')](_0x3d3e66,function(_0x16aecc){return _0x2a3714[_0xc1a3('0x6f')](_0x16aecc[_0xc1a3('0x27')]);});return{'count':_0x3d3e66[_0xc1a3('0x45')],'rows':_[_0xc1a3('0x29')](_0x3d3e66,function(_0x1b7be7){return{'id':_0x1b7be7[_0xc1a3('0x27')],'name':_0x1b7be7[_0xc1a3('0x70')],'custom':_[_0xc1a3('0x71')](_0x1b7be7['name'],'_c')?!![]:![],'options':_0x1b7be7[_0xc1a3('0x3d')]?_[_0xc1a3('0x29')](_['values'](_0x1b7be7[_0xc1a3('0x3d')]),function(_0x4f9129){return{'name':_0x4f9129[_0xc1a3('0x72')],'value':_0x4f9129[_0xc1a3('0x27')]};}):[]};})};}})[_0xc1a3('0x23')](respondWithResult(_0x252cdb,null))['catch'](function(_0x368ffb){var _0x49a757=_0x42d5d2[_0xc1a3('0x33')][_0xc1a3('0x73')]?0x1f4:_0x368ffb[_0xc1a3('0x74')]||0x1f4;logger[_0xc1a3('0x25')](_0xc1a3('0x75'),_0xc1a3('0x76'),_0x49a757,JSON[_0xc1a3('0x65')](_0x368ffb));delete _0x368ffb[_0xc1a3('0x27')];if(_0x49a757===0x191){_0x49a757=0x190;}_0x252cdb[_0xc1a3('0x19')](_0x49a757)[_0xc1a3('0x77')](_0x42d5d2[_0xc1a3('0x33')]['test']?{'message':_0xc1a3('0x78'),'statusCode':_0x368ffb[_0xc1a3('0x74')]}:_0x368ffb);});}else{var _0x583b95=0x1f4;_0x252cdb['status'](_0x583b95)[_0xc1a3('0x77')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xdc91=['%s%s','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','stringify','values','module_fields','remove','includes','label','endsWith','value','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','findOne','SugarcrmConfiguration','pick','getConfigurations','AccountId','channel','Descriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','lastIndexOf','POST'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0xdc91,0x183));var _0x1dc9=function(_0x4d8900,_0x2559a1){_0x4d8900=_0x4d8900-0x0;var _0x217e05=_0xdc91[_0x4d8900];return _0x217e05;};'use strict';var emlformat=require(_0x1dc9('0x0'));var rimraf=require(_0x1dc9('0x1'));var zipdir=require(_0x1dc9('0x2'));var jsonpatch=require(_0x1dc9('0x3'));var rp=require(_0x1dc9('0x4'));var moment=require('moment');var BPromise=require(_0x1dc9('0x5'));var Mustache=require(_0x1dc9('0x6'));var util=require(_0x1dc9('0x7'));var path=require('path');var sox=require(_0x1dc9('0x8'));var csv=require('to-csv');var ejs=require(_0x1dc9('0x9'));var fs=require('fs');var fs_extra=require(_0x1dc9('0xa'));var _=require(_0x1dc9('0xb'));var squel=require(_0x1dc9('0xc'));var crypto=require(_0x1dc9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1dc9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1dc9('0xf'));var authService=require(_0x1dc9('0x10'));var qs=require(_0x1dc9('0x11'));var as=require(_0x1dc9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dc9('0x13'))(_0x1dc9('0x14'));var utils=require(_0x1dc9('0x15'));var config=require(_0x1dc9('0x16'));var licenseUtil=require(_0x1dc9('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1dc9('0x18'));function respondWithStatusCode(_0x209472,_0x34b914){_0x34b914=_0x34b914||0xcc;return function(_0x469e31){if(_0x469e31){return _0x209472[_0x1dc9('0x19')](_0x34b914);}return _0x209472['status'](_0x34b914)['end']();};}function respondWithResult(_0x4572b4,_0x5d2478){_0x5d2478=_0x5d2478||0xc8;return function(_0xd6c7a9){if(_0xd6c7a9){return _0x4572b4[_0x1dc9('0x1a')](_0x5d2478)[_0x1dc9('0x1b')](_0xd6c7a9);}};}function respondWithFilteredResult(_0x1abf27,_0x5c346f){return function(_0x3d5833){if(_0x3d5833){var _0x2b14ec=typeof _0x5c346f[_0x1dc9('0x1c')]===_0x1dc9('0x1d')&&typeof _0x5c346f[_0x1dc9('0x1e')]===_0x1dc9('0x1d');var _0x13028e=_0x3d5833[_0x1dc9('0x1f')];var _0x187922=_0x2b14ec?0x0:_0x5c346f[_0x1dc9('0x1c')];var _0x4e3eb7=_0x2b14ec?_0x3d5833['count']:_0x5c346f[_0x1dc9('0x1c')]+_0x5c346f['limit'];var _0x80913f;if(_0x4e3eb7>=_0x13028e){_0x4e3eb7=_0x13028e;_0x80913f=0xc8;}else{_0x80913f=0xce;}_0x1abf27['status'](_0x80913f);return _0x1abf27[_0x1dc9('0x20')](_0x1dc9('0x21'),_0x187922+'-'+_0x4e3eb7+'/'+_0x13028e)['json'](_0x3d5833);}return null;};}function patchUpdates(_0x2a4119){return function(_0x4830ed){try{jsonpatch[_0x1dc9('0x22')](_0x4830ed,_0x2a4119,!![]);}catch(_0x396524){return BPromise[_0x1dc9('0x23')](_0x396524);}return _0x4830ed[_0x1dc9('0x24')]();};}function saveUpdates(_0x237cfc,_0x173fbf){return function(_0x3f2f51){if(_0x3f2f51){return _0x3f2f51[_0x1dc9('0x25')](_0x237cfc)[_0x1dc9('0x26')](function(_0x1d6911){return _0x1d6911;});}return null;};}function removeEntity(_0x3fc0c6,_0x2d94eb){return function(_0x125ae8){if(_0x125ae8){return _0x125ae8[_0x1dc9('0x27')]()[_0x1dc9('0x26')](function(){_0x3fc0c6['status'](0xcc)[_0x1dc9('0x28')]();});}};}function handleEntityNotFound(_0x2aa67a,_0x2ae3b1){return function(_0x59a651){if(!_0x59a651){_0x2aa67a[_0x1dc9('0x19')](0x194);}return _0x59a651;};}function handleError(_0x5e84ae,_0xf13b6f){_0xf13b6f=_0xf13b6f||0x1f4;return function(_0x182281){logger['error'](_0x182281['stack']);if(_0x182281[_0x1dc9('0x29')]){delete _0x182281[_0x1dc9('0x29')];}_0x5e84ae[_0x1dc9('0x1a')](_0xf13b6f)[_0x1dc9('0x2a')](_0x182281);};}exports[_0x1dc9('0x2b')]=function(_0x53c72a,_0xadad88){var _0x47ed2e={},_0x2b712c={},_0x46040a={'count':0x0,'rows':[]};var _0x43ee8f=_[_0x1dc9('0x2c')](db[_0x1dc9('0x2d')][_0x1dc9('0x2e')],function(_0xec2367){return{'name':_0xec2367[_0x1dc9('0x2f')],'type':_0xec2367[_0x1dc9('0x30')]['key']};});_0x2b712c[_0x1dc9('0x31')]=_[_0x1dc9('0x2c')](_0x43ee8f,_0x1dc9('0x29'));_0x2b712c['query']=_[_0x1dc9('0x32')](_0x53c72a['query']);_0x2b712c['filters']=_[_0x1dc9('0x33')](_0x2b712c[_0x1dc9('0x31')],_0x2b712c[_0x1dc9('0x34')]);_0x47ed2e[_0x1dc9('0x35')]=_[_0x1dc9('0x33')](_0x2b712c[_0x1dc9('0x31')],qs[_0x1dc9('0x36')](_0x53c72a['query']['fields']));_0x47ed2e[_0x1dc9('0x35')]=_0x47ed2e[_0x1dc9('0x35')][_0x1dc9('0x37')]?_0x47ed2e[_0x1dc9('0x35')]:_0x2b712c[_0x1dc9('0x31')];if(!_0x53c72a[_0x1dc9('0x34')][_0x1dc9('0x38')](_0x1dc9('0x39'))){_0x47ed2e[_0x1dc9('0x1e')]=qs['limit'](_0x53c72a[_0x1dc9('0x34')]['limit']);_0x47ed2e[_0x1dc9('0x1c')]=qs[_0x1dc9('0x1c')](_0x53c72a[_0x1dc9('0x34')][_0x1dc9('0x1c')]);}_0x47ed2e[_0x1dc9('0x3a')]=qs[_0x1dc9('0x3b')](_0x53c72a['query'][_0x1dc9('0x3b')]);_0x47ed2e[_0x1dc9('0x3c')]=qs[_0x1dc9('0x3d')](_['pick'](_0x53c72a[_0x1dc9('0x34')],_0x2b712c[_0x1dc9('0x3d')]),_0x43ee8f);if(_0x53c72a[_0x1dc9('0x34')][_0x1dc9('0x3e')]){_0x47ed2e['where']=_['merge'](_0x47ed2e[_0x1dc9('0x3c')],{'$or':_[_0x1dc9('0x2c')](_0x43ee8f,function(_0x2804d6){if(_0x2804d6[_0x1dc9('0x30')]!==_0x1dc9('0x3f')){var _0x5adf0b={};_0x5adf0b[_0x2804d6[_0x1dc9('0x29')]]={'$like':'%'+_0x53c72a[_0x1dc9('0x34')][_0x1dc9('0x3e')]+'%'};return _0x5adf0b;}})});}_0x47ed2e=_[_0x1dc9('0x40')]({},_0x47ed2e,_0x53c72a[_0x1dc9('0x41')]);var _0x31d776={'where':_0x47ed2e[_0x1dc9('0x3c')]};return db[_0x1dc9('0x2d')][_0x1dc9('0x1f')](_0x31d776)['then'](function(_0x455e46){_0x46040a['count']=_0x455e46;if(_0x53c72a[_0x1dc9('0x34')][_0x1dc9('0x42')]){_0x47ed2e[_0x1dc9('0x43')]=[{'all':!![]}];}return db[_0x1dc9('0x2d')][_0x1dc9('0x44')](_0x47ed2e);})[_0x1dc9('0x26')](function(_0x3f8327){_0x46040a['rows']=_0x3f8327;return _0x46040a;})[_0x1dc9('0x26')](respondWithFilteredResult(_0xadad88,_0x47ed2e))[_0x1dc9('0x45')](handleError(_0xadad88,null));};exports[_0x1dc9('0x46')]=function(_0x319657,_0x50e669){var _0x20ecf1={'raw':![],'where':{'id':_0x319657[_0x1dc9('0x47')]['id']}},_0x26fca0={};_0x26fca0[_0x1dc9('0x31')]=_[_0x1dc9('0x32')](db['SugarcrmAccount']['rawAttributes']);_0x26fca0['query']=_[_0x1dc9('0x32')](_0x319657[_0x1dc9('0x34')]);_0x26fca0[_0x1dc9('0x3d')]=_[_0x1dc9('0x33')](_0x26fca0[_0x1dc9('0x31')],_0x26fca0[_0x1dc9('0x34')]);_0x20ecf1[_0x1dc9('0x35')]=_[_0x1dc9('0x33')](_0x26fca0[_0x1dc9('0x31')],qs[_0x1dc9('0x36')](_0x319657[_0x1dc9('0x34')][_0x1dc9('0x36')]));_0x20ecf1[_0x1dc9('0x35')]=_0x20ecf1[_0x1dc9('0x35')]['length']?_0x20ecf1[_0x1dc9('0x35')]:_0x26fca0[_0x1dc9('0x31')];if(_0x319657[_0x1dc9('0x34')][_0x1dc9('0x42')]){_0x20ecf1[_0x1dc9('0x43')]=[{'all':!![]}];}_0x20ecf1=_['merge']({},_0x20ecf1,_0x319657[_0x1dc9('0x41')]);return db[_0x1dc9('0x2d')][_0x1dc9('0x48')](_0x20ecf1)[_0x1dc9('0x26')](handleEntityNotFound(_0x50e669,null))['then'](respondWithResult(_0x50e669,null))[_0x1dc9('0x45')](handleError(_0x50e669,null));};exports[_0x1dc9('0x49')]=function(_0x41ce6d,_0x2ca706){return db[_0x1dc9('0x2d')]['create'](_0x41ce6d[_0x1dc9('0x4a')],{})[_0x1dc9('0x26')](respondWithResult(_0x2ca706,0xc9))[_0x1dc9('0x45')](handleError(_0x2ca706,null));};exports[_0x1dc9('0x25')]=function(_0x31c890,_0x13d76a){if(_0x31c890[_0x1dc9('0x4a')]['id']){delete _0x31c890[_0x1dc9('0x4a')]['id'];}return db['SugarcrmAccount'][_0x1dc9('0x48')]({'where':{'id':_0x31c890[_0x1dc9('0x47')]['id']}})['then'](handleEntityNotFound(_0x13d76a,null))[_0x1dc9('0x26')](saveUpdates(_0x31c890[_0x1dc9('0x4a')],null))[_0x1dc9('0x26')](respondWithResult(_0x13d76a,null))['catch'](handleError(_0x13d76a,null));};exports[_0x1dc9('0x27')]=function(_0xd1bd7a,_0x27430c){return db[_0x1dc9('0x2d')]['find']({'where':{'id':_0xd1bd7a[_0x1dc9('0x47')]['id']}})[_0x1dc9('0x26')](handleEntityNotFound(_0x27430c,null))['then'](removeEntity(_0x27430c,null))[_0x1dc9('0x45')](handleError(_0x27430c,null));};exports['getConfigurations']=function(_0x7869af,_0x3be9f3,_0x19d9b3){var _0x1fe8ac={};var _0x436572={};var _0x1d559b;var _0xf809f4;return db[_0x1dc9('0x2d')][_0x1dc9('0x4b')]({'where':{'id':_0x7869af[_0x1dc9('0x47')]['id']}})[_0x1dc9('0x26')](handleEntityNotFound(_0x3be9f3,null))['then'](function(_0x4a59ac){if(_0x4a59ac){_0x1d559b=_0x4a59ac;_0x436572[_0x1dc9('0x31')]=_[_0x1dc9('0x32')](db[_0x1dc9('0x4c')][_0x1dc9('0x2e')]);_0x436572[_0x1dc9('0x34')]=_[_0x1dc9('0x32')](_0x7869af['query']);_0x436572[_0x1dc9('0x3d')]=_[_0x1dc9('0x33')](_0x436572[_0x1dc9('0x31')],_0x436572['query']);_0x1fe8ac[_0x1dc9('0x35')]=_[_0x1dc9('0x33')](_0x436572[_0x1dc9('0x31')],qs['fields'](_0x7869af[_0x1dc9('0x34')][_0x1dc9('0x36')]));_0x1fe8ac[_0x1dc9('0x35')]=_0x1fe8ac['attributes']['length']?_0x1fe8ac[_0x1dc9('0x35')]:_0x436572[_0x1dc9('0x31')];_0x1fe8ac[_0x1dc9('0x3a')]=qs[_0x1dc9('0x3b')](_0x7869af['query']['sort']);_0x1fe8ac[_0x1dc9('0x3c')]=qs['filters'](_[_0x1dc9('0x4d')](_0x7869af['query'],_0x436572[_0x1dc9('0x3d')]));if(_0x7869af[_0x1dc9('0x34')][_0x1dc9('0x3e')]){_0x1fe8ac[_0x1dc9('0x3c')]=_['merge'](_0x1fe8ac[_0x1dc9('0x3c')],{'$or':_[_0x1dc9('0x2c')](_0x1fe8ac[_0x1dc9('0x35')],function(_0x2730c0){var _0x43f8a1={};_0x43f8a1[_0x2730c0]={'$like':'%'+_0x7869af[_0x1dc9('0x34')][_0x1dc9('0x3e')]+'%'};return _0x43f8a1;})});}_0x1fe8ac=_[_0x1dc9('0x40')]({},_0x1fe8ac,_0x7869af[_0x1dc9('0x41')]);return _0x1d559b[_0x1dc9('0x4e')](_0x1fe8ac);}})[_0x1dc9('0x26')](function(_0x530f6d){if(_0x530f6d){_0xf809f4=_0x530f6d[_0x1dc9('0x37')];if(!_0x7869af['query'][_0x1dc9('0x38')]('nolimit')){_0x1fe8ac['limit']=qs[_0x1dc9('0x1e')](_0x7869af[_0x1dc9('0x34')][_0x1dc9('0x1e')]);_0x1fe8ac['offset']=qs[_0x1dc9('0x1c')](_0x7869af[_0x1dc9('0x34')][_0x1dc9('0x1c')]);}return _0x1d559b[_0x1dc9('0x4e')](_0x1fe8ac);}})[_0x1dc9('0x26')](function(_0x172556){if(_0x172556){return _0x172556?{'count':_0xf809f4,'rows':_0x172556}:null;}})[_0x1dc9('0x26')](respondWithResult(_0x3be9f3,null))[_0x1dc9('0x45')](handleError(_0x3be9f3,null));};exports['addConfiguration']=function(_0x1131a6,_0x4d47e6,_0x5e8588){if(_0x1131a6['body']['id']){delete _0x1131a6['body']['id'];}return db['SugarcrmAccount'][_0x1dc9('0x4b')]({'where':{'id':_0x1131a6[_0x1dc9('0x47')]['id']}})[_0x1dc9('0x26')](handleEntityNotFound(_0x4d47e6,null))[_0x1dc9('0x26')](function(_0x15be9c){if(_0x15be9c){_0x1131a6[_0x1dc9('0x4a')][_0x1dc9('0x4f')]=_0x15be9c['id'];_0x1131a6[_0x1dc9('0x4a')]['Subjects']=integrations['getSubjects'](_0x1131a6[_0x1dc9('0x4a')][_0x1dc9('0x50')],_0x1131a6['body'][_0x1dc9('0x30')]);_0x1131a6[_0x1dc9('0x4a')][_0x1dc9('0x51')]=integrations['getDescriptions'](_0x1131a6[_0x1dc9('0x4a')][_0x1dc9('0x50')],_0x1131a6[_0x1dc9('0x4a')][_0x1dc9('0x30')]);return db[_0x1dc9('0x4c')]['create'](_0x1131a6[_0x1dc9('0x4a')],{'include':[{'model':db[_0x1dc9('0x52')],'as':'Subjects'},{'model':db[_0x1dc9('0x52')],'as':_0x1dc9('0x51')}]});}return null;})[_0x1dc9('0x26')](respondWithResult(_0x4d47e6,null))[_0x1dc9('0x45')](handleError(_0x4d47e6,null));};exports['getFields']=function(_0x4acf2a,_0x4f9d96,_0x1a130d){var _0xfa6e03='';var _0x36aed4=['id',_0x1dc9('0x29'),_0x1dc9('0x53'),_0x1dc9('0x54'),_0x1dc9('0x55'),_0x1dc9('0x56'),_0x1dc9('0x57'),_0x1dc9('0x58'),_0x1dc9('0x59'),_0x1dc9('0x5a'),_0x1dc9('0x5b'),'direction'];return db[_0x1dc9('0x2d')][_0x1dc9('0x4b')]({'where':{'id':_0x4acf2a[_0x1dc9('0x47')]['id']},'attributes':['id','username',_0x1dc9('0x5c'),_0x1dc9('0x5d')]})[_0x1dc9('0x26')](handleEntityNotFound(_0x4f9d96,null))['then'](function(_0x3e8aa4){if(_0x3e8aa4){_0xfa6e03=_0x3e8aa4[_0x1dc9('0x5d')];var _0x20a726=_0xfa6e03[_0x1dc9('0x5e')](-0x1);if(_0x20a726==='/'){_0xfa6e03=_0xfa6e03['substring'](0x0,_0xfa6e03[_0x1dc9('0x5f')](_0x20a726));}return rp({'method':_0x1dc9('0x60'),'uri':util['format'](_0x1dc9('0x61'),_0xfa6e03,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x1dc9('0x62'),'response_type':_0x1dc9('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3e8aa4[_0x1dc9('0x63')],'password':_0x3e8aa4[_0x1dc9('0x5c')],'encryption':_0x1dc9('0x64')},'application':_0x1dc9('0x65')})}});}})[_0x1dc9('0x26')](function(_0x358d91){if(_0x358d91&&_0x358d91[_0x1dc9('0x29')]!==_0x1dc9('0x66')&&_0x358d91[_0x1dc9('0x29')]!==_0x1dc9('0x67')){return rp({'method':'POST','uri':util[_0x1dc9('0x68')]('%s%s',_0xfa6e03,_0x1dc9('0x69')),'json':!![],'form':{'method':_0x1dc9('0x6a'),'input_type':'JSON','response_type':_0x1dc9('0x62'),'rest_data':JSON[_0x1dc9('0x6b')]({'session':_0x358d91['id'],'module_name':'Calls'})}})[_0x1dc9('0x26')](function(_0x3a9ccb){if(_0x3a9ccb){var _0x216154=_[_0x1dc9('0x6c')](_0x3a9ccb[_0x1dc9('0x6d')]);_[_0x1dc9('0x6e')](_0x216154,function(_0x354f4a){return _0x36aed4[_0x1dc9('0x6f')](_0x354f4a[_0x1dc9('0x29')]);});return{'count':_0x216154[_0x1dc9('0x37')],'rows':_[_0x1dc9('0x2c')](_0x216154,function(_0x62bb63){return{'id':_0x62bb63[_0x1dc9('0x29')],'name':_0x62bb63[_0x1dc9('0x70')],'custom':_[_0x1dc9('0x71')](_0x62bb63[_0x1dc9('0x29')],'_c')?!![]:![],'options':_0x62bb63[_0x1dc9('0x41')]?_[_0x1dc9('0x2c')](_['values'](_0x62bb63[_0x1dc9('0x41')]),function(_0x481e2a){return{'name':_0x481e2a[_0x1dc9('0x72')],'value':_0x481e2a[_0x1dc9('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x4f9d96,null))['catch'](function(_0x47592e){var _0x27e6b0=_0x4acf2a[_0x1dc9('0x34')]['test']?0x1f4:_0x47592e[_0x1dc9('0x73')]||0x1f4;logger[_0x1dc9('0x74')](_0x1dc9('0x75'),_0x1dc9('0x76'),_0x27e6b0,JSON[_0x1dc9('0x6b')](_0x47592e));delete _0x47592e['name'];if(_0x27e6b0===0x191){_0x27e6b0=0x190;}_0x4f9d96[_0x1dc9('0x1a')](_0x27e6b0)[_0x1dc9('0x2a')](_0x4acf2a['query'][_0x1dc9('0x77')]?{'message':_0x1dc9('0x78'),'statusCode':_0x47592e[_0x1dc9('0x73')]}:_0x47592e);});}else{var _0x4d4752=0x1f4;_0x4f9d96['status'](_0x4d4752)['send']({'message':_0x1dc9('0x78'),'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 9472157..dd4d19b 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 _0xcb2c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x31a188,_0x160a0d){var _0xee44b5=function(_0x49e5ae){while(--_0x49e5ae){_0x31a188['push'](_0x31a188['shift']());}};_0xee44b5(++_0x160a0d);}(_0xcb2c,0x17a));var _0xccb2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xcb2c[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var logger=require(_0xccb2('0x2'))(_0xccb2('0x3'));var moment=require(_0xccb2('0x4'));var BPromise=require('bluebird');var rp=require(_0xccb2('0x5'));var fs=require('fs');var path=require(_0xccb2('0x6'));var rimraf=require(_0xccb2('0x7'));var config=require(_0xccb2('0x8'));var attributes=require(_0xccb2('0x9'));var integrations=require(_0xccb2('0xa'));module['exports']=function(_0x59d154,_0x3e078d){return _0x59d154[_0xccb2('0xb')](_0xccb2('0xc'),attributes,{'tableName':_0xccb2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b7e=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','api','moment'];(function(_0x44da96,_0x1f19d5){var _0x519253=function(_0x3ee327){while(--_0x3ee327){_0x44da96['push'](_0x44da96['shift']());}};_0x519253(++_0x1f19d5);}(_0x2b7e,0xe1));var _0xe2b7=function(_0x2a63f2,_0x2367bb){_0x2a63f2=_0x2a63f2-0x0;var _0x2801ef=_0x2b7e[_0x2a63f2];return _0x2801ef;};'use strict';var _=require('lodash');var util=require(_0xe2b7('0x0'));var logger=require('../../config/logger')(_0xe2b7('0x1'));var moment=require(_0xe2b7('0x2'));var BPromise=require(_0xe2b7('0x3'));var rp=require(_0xe2b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2b7('0x5'));var config=require(_0xe2b7('0x6'));var attributes=require(_0xe2b7('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe2b7('0x8')]=function(_0x45068f,_0x36372b){return _0x45068f[_0xe2b7('0x9')](_0xe2b7('0xa'),attributes,{'tableName':_0xe2b7('0xb'),'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 ead3d6f..5747efb 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 _0xaa28=['find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SugarcrmAccount','findAll','options','where','attributes','include','map','model','GetSugarcrmAccount','stringify','ShowSugarcrmAccount'];(function(_0x345c43,_0x1b6e72){var _0x3cbd1a=function(_0x5e194d){while(--_0x5e194d){_0x345c43['push'](_0x345c43['shift']());}};_0x3cbd1a(++_0x1b6e72);}(_0xaa28,0x160));var _0x8aa2=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0xaa28[_0x172ed7];return _0xfa8f61;};'use strict';var _=require('lodash');var util=require(_0x8aa2('0x0'));var moment=require(_0x8aa2('0x1'));var BPromise=require(_0x8aa2('0x2'));var rs=require(_0x8aa2('0x3'));var fs=require('fs');var Redis=require(_0x8aa2('0x4'));var db=require(_0x8aa2('0x5'))['db'];var utils=require(_0x8aa2('0x6'));var logger=require(_0x8aa2('0x7'))(_0x8aa2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8aa2('0x9'));var client=jayson[_0x8aa2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7cbc98,_0x2c0b08,_0x1646b6){return new BPromise(function(_0x26b42f,_0x2a945c){return client['request'](_0x7cbc98,_0x1646b6)[_0x8aa2('0xb')](function(_0x110bfa){logger[_0x8aa2('0xc')](_0x8aa2('0xd'),_0x2c0b08,_0x8aa2('0xe'));logger[_0x8aa2('0xf')](_0x8aa2('0x10'),_0x2c0b08,_0x8aa2('0xe'),JSON['stringify'](_0x110bfa));if(_0x110bfa[_0x8aa2('0x11')]){if(_0x110bfa[_0x8aa2('0x11')][_0x8aa2('0x12')]===0x1f4){logger[_0x8aa2('0x11')](_0x8aa2('0xd'),_0x2c0b08,_0x110bfa['error']['message']);return _0x2a945c(_0x110bfa['error'][_0x8aa2('0x13')]);}logger[_0x8aa2('0x11')](_0x8aa2('0xd'),_0x2c0b08,_0x110bfa[_0x8aa2('0x11')]['message']);return _0x26b42f(_0x110bfa[_0x8aa2('0x11')][_0x8aa2('0x13')]);}else{logger['info'](_0x8aa2('0xd'),_0x2c0b08,_0x8aa2('0xe'));_0x26b42f(_0x110bfa[_0x8aa2('0x14')]['message']);}})[_0x8aa2('0x15')](function(_0x11f8ff){logger[_0x8aa2('0x11')](_0x8aa2('0xd'),_0x2c0b08,_0x11f8ff);_0x2a945c(_0x11f8ff);});});}exports['GetSugarcrmAccount']=function(_0x1ed7f8){var _0x36ca2d=this;return new Promise(function(_0x5c1a46,_0x53be5d){return db[_0x8aa2('0x16')][_0x8aa2('0x17')]({'raw':_0x1ed7f8[_0x8aa2('0x18')]?_0x1ed7f8[_0x8aa2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1ed7f8[_0x8aa2('0x18')]?_0x1ed7f8[_0x8aa2('0x18')][_0x8aa2('0x19')]||null:null,'attributes':_0x1ed7f8['options']?_0x1ed7f8[_0x8aa2('0x18')][_0x8aa2('0x1a')]||null:null,'limit':_0x1ed7f8['options']?_0x1ed7f8[_0x8aa2('0x18')]['limit']||null:null,'include':_0x1ed7f8[_0x8aa2('0x18')]?_0x1ed7f8[_0x8aa2('0x18')][_0x8aa2('0x1b')]?_[_0x8aa2('0x1c')](_0x1ed7f8[_0x8aa2('0x18')][_0x8aa2('0x1b')],function(_0x5f400f){return{'model':db[_0x5f400f[_0x8aa2('0x1d')]],'as':_0x5f400f['as'],'attributes':_0x5f400f[_0x8aa2('0x1a')],'include':_0x5f400f[_0x8aa2('0x1b')]?_[_0x8aa2('0x1c')](_0x5f400f['include'],function(_0x3856e7){return{'model':db[_0x3856e7['model']],'as':_0x3856e7['as'],'attributes':_0x3856e7['attributes'],'include':_0x3856e7[_0x8aa2('0x1b')]?_[_0x8aa2('0x1c')](_0x3856e7[_0x8aa2('0x1b')],function(_0x3f6548){return{'model':db[_0x3f6548['model']],'as':_0x3f6548['as'],'attributes':_0x3f6548[_0x8aa2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8aa2('0xb')](function(_0xdfb646){logger['info'](_0x8aa2('0x1e'),_0x1ed7f8);logger[_0x8aa2('0xf')](_0x8aa2('0x1e'),_0x1ed7f8,JSON[_0x8aa2('0x1f')](_0xdfb646));_0x5c1a46(_0xdfb646);})[_0x8aa2('0x15')](function(_0x1782b0){logger[_0x8aa2('0x11')](_0x8aa2('0x1e'),_0x1782b0[_0x8aa2('0x13')],_0x1ed7f8);_0x53be5d(_0x36ca2d[_0x8aa2('0x11')](0x1f4,_0x1782b0['message']));});});};exports[_0x8aa2('0x20')]=function(_0x4cb4b0){var _0x67c008=this;return new Promise(function(_0x1c392b,_0x581726){return db[_0x8aa2('0x16')][_0x8aa2('0x21')]({'raw':_0x4cb4b0[_0x8aa2('0x18')]?_0x4cb4b0[_0x8aa2('0x18')][_0x8aa2('0x22')]===undefined?!![]:![]:!![],'where':_0x4cb4b0[_0x8aa2('0x18')]?_0x4cb4b0[_0x8aa2('0x18')][_0x8aa2('0x19')]||null:null,'attributes':_0x4cb4b0[_0x8aa2('0x18')]?_0x4cb4b0['options'][_0x8aa2('0x1a')]||null:null,'include':_0x4cb4b0['options']?_0x4cb4b0[_0x8aa2('0x18')][_0x8aa2('0x1b')]?_[_0x8aa2('0x1c')](_0x4cb4b0['options'][_0x8aa2('0x1b')],function(_0x228044){return{'model':db[_0x228044[_0x8aa2('0x1d')]],'as':_0x228044['as'],'attributes':_0x228044[_0x8aa2('0x1a')],'include':_0x228044[_0x8aa2('0x1b')]?_[_0x8aa2('0x1c')](_0x228044[_0x8aa2('0x1b')],function(_0x1e6ee0){return{'model':db[_0x1e6ee0[_0x8aa2('0x1d')]],'as':_0x1e6ee0['as'],'attributes':_0x1e6ee0[_0x8aa2('0x1a')],'include':_0x1e6ee0[_0x8aa2('0x1b')]?_[_0x8aa2('0x1c')](_0x1e6ee0[_0x8aa2('0x1b')],function(_0x47aa3a){return{'model':db[_0x47aa3a[_0x8aa2('0x1d')]],'as':_0x47aa3a['as'],'attributes':_0x47aa3a[_0x8aa2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8aa2('0xb')](function(_0x1621a3){logger[_0x8aa2('0xc')](_0x8aa2('0x20'),_0x4cb4b0);logger[_0x8aa2('0xf')](_0x8aa2('0x20'),_0x4cb4b0,JSON[_0x8aa2('0x1f')](_0x1621a3));_0x1c392b(_0x1621a3);})['catch'](function(_0x492846){logger['error'](_0x8aa2('0x20'),_0x492846['message'],_0x4cb4b0);_0x581726(_0x67c008[_0x8aa2('0x11')](0x1f4,_0x492846[_0x8aa2('0x13')]));});});}; \ No newline at end of file +var _0x3cdd=['find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount'];(function(_0xfa92ca,_0x3aecda){var _0x39b4c3=function(_0x13e34b){while(--_0x13e34b){_0xfa92ca['push'](_0xfa92ca['shift']());}};_0x39b4c3(++_0x3aecda);}(_0x3cdd,0xb5));var _0xd3cd=function(_0x2bfd12,_0x48f8eb){_0x2bfd12=_0x2bfd12-0x0;var _0x1abe17=_0x3cdd[_0x2bfd12];return _0x1abe17;};'use strict';var _=require(_0xd3cd('0x0'));var util=require(_0xd3cd('0x1'));var moment=require(_0xd3cd('0x2'));var BPromise=require(_0xd3cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3cd('0x4'))['db'];var utils=require(_0xd3cd('0x5'));var logger=require(_0xd3cd('0x6'))(_0xd3cd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3cd('0x8')][_0xd3cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x589326,_0x312a6b,_0x1ca36a){return new BPromise(function(_0x23e219,_0x14cd07){return client[_0xd3cd('0xa')](_0x589326,_0x1ca36a)[_0xd3cd('0xb')](function(_0x14546c){logger[_0xd3cd('0xc')](_0xd3cd('0xd'),_0x312a6b,_0xd3cd('0xe'));logger[_0xd3cd('0xf')](_0xd3cd('0x10'),_0x312a6b,_0xd3cd('0xe'),JSON[_0xd3cd('0x11')](_0x14546c));if(_0x14546c[_0xd3cd('0x12')]){if(_0x14546c[_0xd3cd('0x12')][_0xd3cd('0x13')]===0x1f4){logger[_0xd3cd('0x12')](_0xd3cd('0xd'),_0x312a6b,_0x14546c[_0xd3cd('0x12')]['message']);return _0x14cd07(_0x14546c[_0xd3cd('0x12')][_0xd3cd('0x14')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x312a6b,_0x14546c[_0xd3cd('0x12')][_0xd3cd('0x14')]);return _0x23e219(_0x14546c[_0xd3cd('0x12')][_0xd3cd('0x14')]);}else{logger[_0xd3cd('0xc')](_0xd3cd('0xd'),_0x312a6b,_0xd3cd('0xe'));_0x23e219(_0x14546c[_0xd3cd('0x15')][_0xd3cd('0x14')]);}})[_0xd3cd('0x16')](function(_0x4093da){logger[_0xd3cd('0x12')](_0xd3cd('0xd'),_0x312a6b,_0x4093da);_0x14cd07(_0x4093da);});});}exports['GetSugarcrmAccount']=function(_0x56fdba){var _0x4b6d01=this;return new Promise(function(_0x861d67,_0x9a94c7){return db[_0xd3cd('0x17')][_0xd3cd('0x18')]({'raw':_0x56fdba[_0xd3cd('0x19')]?_0x56fdba[_0xd3cd('0x19')][_0xd3cd('0x1a')]===undefined?!![]:![]:!![],'where':_0x56fdba[_0xd3cd('0x19')]?_0x56fdba[_0xd3cd('0x19')][_0xd3cd('0x1b')]||null:null,'attributes':_0x56fdba[_0xd3cd('0x19')]?_0x56fdba[_0xd3cd('0x19')][_0xd3cd('0x1c')]||null:null,'limit':_0x56fdba[_0xd3cd('0x19')]?_0x56fdba[_0xd3cd('0x19')][_0xd3cd('0x1d')]||null:null,'include':_0x56fdba['options']?_0x56fdba[_0xd3cd('0x19')][_0xd3cd('0x1e')]?_['map'](_0x56fdba[_0xd3cd('0x19')][_0xd3cd('0x1e')],function(_0x511bbb){return{'model':db[_0x511bbb['model']],'as':_0x511bbb['as'],'attributes':_0x511bbb['attributes'],'include':_0x511bbb['include']?_[_0xd3cd('0x1f')](_0x511bbb[_0xd3cd('0x1e')],function(_0x55a3cf){return{'model':db[_0x55a3cf[_0xd3cd('0x20')]],'as':_0x55a3cf['as'],'attributes':_0x55a3cf[_0xd3cd('0x1c')],'include':_0x55a3cf['include']?_[_0xd3cd('0x1f')](_0x55a3cf[_0xd3cd('0x1e')],function(_0x2e183c){return{'model':db[_0x2e183c[_0xd3cd('0x20')]],'as':_0x2e183c['as'],'attributes':_0x2e183c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3cd('0xb')](function(_0xd39b24){logger[_0xd3cd('0xc')]('GetSugarcrmAccount',_0x56fdba);logger[_0xd3cd('0xf')]('GetSugarcrmAccount',_0x56fdba,JSON[_0xd3cd('0x11')](_0xd39b24));_0x861d67(_0xd39b24);})[_0xd3cd('0x16')](function(_0x5dbccf){logger[_0xd3cd('0x12')](_0xd3cd('0x21'),_0x5dbccf['message'],_0x56fdba);_0x9a94c7(_0x4b6d01['error'](0x1f4,_0x5dbccf[_0xd3cd('0x14')]));});});};exports[_0xd3cd('0x22')]=function(_0x4a48b8){var _0x307ae4=this;return new Promise(function(_0x2bb2d8,_0x4f0440){return db[_0xd3cd('0x17')][_0xd3cd('0x23')]({'raw':_0x4a48b8['options']?_0x4a48b8[_0xd3cd('0x19')][_0xd3cd('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a48b8['options']?_0x4a48b8[_0xd3cd('0x19')][_0xd3cd('0x1b')]||null:null,'attributes':_0x4a48b8['options']?_0x4a48b8['options'][_0xd3cd('0x1c')]||null:null,'include':_0x4a48b8['options']?_0x4a48b8[_0xd3cd('0x19')][_0xd3cd('0x1e')]?_[_0xd3cd('0x1f')](_0x4a48b8[_0xd3cd('0x19')][_0xd3cd('0x1e')],function(_0x1a6e23){return{'model':db[_0x1a6e23[_0xd3cd('0x20')]],'as':_0x1a6e23['as'],'attributes':_0x1a6e23[_0xd3cd('0x1c')],'include':_0x1a6e23[_0xd3cd('0x1e')]?_[_0xd3cd('0x1f')](_0x1a6e23[_0xd3cd('0x1e')],function(_0x5c5415){return{'model':db[_0x5c5415['model']],'as':_0x5c5415['as'],'attributes':_0x5c5415[_0xd3cd('0x1c')],'include':_0x5c5415[_0xd3cd('0x1e')]?_[_0xd3cd('0x1f')](_0x5c5415['include'],function(_0xea9e06){return{'model':db[_0xea9e06['model']],'as':_0xea9e06['as'],'attributes':_0xea9e06[_0xd3cd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd3cd('0xb')](function(_0x4fb7a3){logger[_0xd3cd('0xc')]('ShowSugarcrmAccount',_0x4a48b8);logger[_0xd3cd('0xf')](_0xd3cd('0x22'),_0x4a48b8,JSON['stringify'](_0x4fb7a3));_0x2bb2d8(_0x4fb7a3);})[_0xd3cd('0x16')](function(_0x3c3a62){logger[_0xd3cd('0x12')](_0xd3cd('0x22'),_0x3c3a62['message'],_0x4a48b8);_0x4f0440(_0x307ae4[_0xd3cd('0x12')](0x1f4,_0x3c3a62[_0xd3cd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 134fb8e..0dfb9ca 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 _0x4fe6=['put','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/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create'];(function(_0x20031a,_0x57c05a){var _0x3d6902=function(_0x2c90bd){while(--_0x2c90bd){_0x20031a['push'](_0x20031a['shift']());}};_0x3d6902(++_0x57c05a);}(_0x4fe6,0x149));var _0x64fe=function(_0x3270f9,_0x407457){_0x3270f9=_0x3270f9-0x0;var _0x26006d=_0x4fe6[_0x3270f9];return _0x26006d;};'use strict';var multer=require('multer');var util=require(_0x64fe('0x0'));var path=require(_0x64fe('0x1'));var timeout=require(_0x64fe('0x2'));var express=require(_0x64fe('0x3'));var router=express[_0x64fe('0x4')]();var fs_extra=require(_0x64fe('0x5'));var auth=require(_0x64fe('0x6'));var interaction=require(_0x64fe('0x7'));var config=require(_0x64fe('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x64fe('0x9')]('/',auth[_0x64fe('0xa')](),controller[_0x64fe('0xb')]);router[_0x64fe('0x9')](_0x64fe('0xc'),auth[_0x64fe('0xa')](),controller[_0x64fe('0xd')]);router[_0x64fe('0x9')](_0x64fe('0xe'),auth['isAuthenticated'](),controller[_0x64fe('0xf')]);router['get'](_0x64fe('0x10'),auth[_0x64fe('0xa')](),controller[_0x64fe('0x11')]);router['get'](_0x64fe('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x64fe('0x13')]('/',auth[_0x64fe('0xa')](),controller[_0x64fe('0x14')]);router[_0x64fe('0x15')](_0x64fe('0xc'),auth[_0x64fe('0xa')](),controller['update']);router[_0x64fe('0x16')](_0x64fe('0xc'),auth[_0x64fe('0xa')](),controller[_0x64fe('0x17')]);module[_0x64fe('0x18')]=router; \ No newline at end of file +var _0xc429=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','create','put','delete','destroy','exports','multer','util'];(function(_0x115726,_0x3d4a89){var _0x27d130=function(_0xf2afb3){while(--_0xf2afb3){_0x115726['push'](_0x115726['shift']());}};_0x27d130(++_0x3d4a89);}(_0xc429,0xfa));var _0x9c42=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xc429[_0x31a938];return _0x1bf341;};'use strict';var multer=require(_0x9c42('0x0'));var util=require(_0x9c42('0x1'));var path=require('path');var timeout=require(_0x9c42('0x2'));var express=require(_0x9c42('0x3'));var router=express['Router']();var fs_extra=require(_0x9c42('0x4'));var auth=require(_0x9c42('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9c42('0x6'));var controller=require(_0x9c42('0x7'));router[_0x9c42('0x8')]('/',auth['isAuthenticated'](),controller[_0x9c42('0x9')]);router[_0x9c42('0x8')](_0x9c42('0xa'),auth[_0x9c42('0xb')](),controller[_0x9c42('0xc')]);router[_0x9c42('0x8')](_0x9c42('0xd'),auth[_0x9c42('0xb')](),controller['getFields']);router['get'](_0x9c42('0xe'),auth['isAuthenticated'](),controller[_0x9c42('0xf')]);router[_0x9c42('0x8')]('/:id/descriptions',auth[_0x9c42('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0x9c42('0xb')](),controller[_0x9c42('0x10')]);router[_0x9c42('0x11')](_0x9c42('0xa'),auth[_0x9c42('0xb')](),controller['update']);router[_0x9c42('0x12')](_0x9c42('0xa'),auth[_0x9c42('0xb')](),controller[_0x9c42('0x13')]);module[_0x9c42('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 1c1de77..fe2ad44 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 _0xc87b=['exports','STRING','sequelize'];(function(_0x1ae69b,_0x3586e9){var _0x21383d=function(_0x1d4e2b){while(--_0x1d4e2b){_0x1ae69b['push'](_0x1ae69b['shift']());}};_0x21383d(++_0x3586e9);}(_0xc87b,0x161));var _0xbc87=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xc87b[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0xbc87('0x0'));module[_0xbc87('0x1')]={'name':{'type':Sequelize[_0xbc87('0x2')]},'description':{'type':Sequelize[_0xbc87('0x2')]}}; \ No newline at end of file +var _0xb050=['STRING','sequelize','exports'];(function(_0x1602fb,_0x20b6b3){var _0x461831=function(_0x4a19f1){while(--_0x4a19f1){_0x1602fb['push'](_0x1602fb['shift']());}};_0x461831(++_0x20b6b3);}(_0xb050,0x145));var _0x0b05=function(_0x979d28,_0x4811d9){_0x979d28=_0x979d28-0x0;var _0x208b30=_0xb050[_0x979d28];return _0x208b30;};'use strict';var Sequelize=require(_0x0b05('0x0'));module[_0x0b05('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0b05('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index ca96047..07d2410 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 _0x6271=['rows','catch','show','options','find','create','body','params','getFields','SugarcrmField','pick','nolimit','getSubjects','findOne','hasOwnProperty','getDescriptions','eml-format','zip-dir','request-promise','moment','util','sox','ejs','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','count','status','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','limit','order','sort','where','filter','VIRTUAL','merge','SugarcrmConfiguration','includeAll','include'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0x6271,0xf7));var _0x1627=function(_0x2cdae4,_0x29a90f){_0x2cdae4=_0x2cdae4-0x0;var _0x2888f3=_0x6271[_0x2cdae4];return _0x2888f3;};'use strict';var emlformat=require(_0x1627('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1627('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1627('0x2'));var moment=require(_0x1627('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1627('0x4'));var path=require('path');var sox=require(_0x1627('0x5'));var csv=require('to-csv');var ejs=require(_0x1627('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1627('0x7'));var crypto=require('crypto');var jsforce=require(_0x1627('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x1627('0x9'));var querystring=require(_0x1627('0xa'));var Papa=require('papaparse');var Redis=require(_0x1627('0xb'));var authService=require(_0x1627('0xc'));var qs=require(_0x1627('0xd'));var as=require(_0x1627('0xe'));var hardwareService=require(_0x1627('0xf'));var logger=require(_0x1627('0x10'))('api');var utils=require(_0x1627('0x11'));var config=require(_0x1627('0x12'));var licenseUtil=require(_0x1627('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x308c75,_0x3440c7){_0x3440c7=_0x3440c7||0xcc;return function(_0x56f97d){if(_0x56f97d){return _0x308c75[_0x1627('0x14')](_0x3440c7);}return _0x308c75['status'](_0x3440c7)[_0x1627('0x15')]();};}function respondWithResult(_0x4def2c,_0x549a57){_0x549a57=_0x549a57||0xc8;return function(_0x25e29b){if(_0x25e29b){return _0x4def2c['status'](_0x549a57)['json'](_0x25e29b);}};}function respondWithFilteredResult(_0x84eb99,_0x1ae6b8){return function(_0x233e31){if(_0x233e31){var _0xf5629a=typeof _0x1ae6b8[_0x1627('0x16')]===_0x1627('0x17')&&typeof _0x1ae6b8['limit']===_0x1627('0x17');var _0x4d9e7a=_0x233e31['count'];var _0x19d041=_0xf5629a?0x0:_0x1ae6b8[_0x1627('0x16')];var _0x53bfab=_0xf5629a?_0x233e31[_0x1627('0x18')]:_0x1ae6b8['offset']+_0x1ae6b8['limit'];var _0x51b147;if(_0x53bfab>=_0x4d9e7a){_0x53bfab=_0x4d9e7a;_0x51b147=0xc8;}else{_0x51b147=0xce;}_0x84eb99[_0x1627('0x19')](_0x51b147);return _0x84eb99[_0x1627('0x1a')](_0x1627('0x1b'),_0x19d041+'-'+_0x53bfab+'/'+_0x4d9e7a)[_0x1627('0x1c')](_0x233e31);}return null;};}function patchUpdates(_0x3e1989){return function(_0x2a69ad){try{jsonpatch['apply'](_0x2a69ad,_0x3e1989,!![]);}catch(_0x48bd2c){return BPromise[_0x1627('0x1d')](_0x48bd2c);}return _0x2a69ad['save']();};}function saveUpdates(_0x9d3548,_0x4b44cf){return function(_0x62be16){if(_0x62be16){return _0x62be16[_0x1627('0x1e')](_0x9d3548)[_0x1627('0x1f')](function(_0x2ca8eb){return _0x2ca8eb;});}return null;};}function removeEntity(_0x3e55c8,_0x8bc8b2){return function(_0x446e1a){if(_0x446e1a){return _0x446e1a[_0x1627('0x20')]()[_0x1627('0x1f')](function(){_0x3e55c8[_0x1627('0x19')](0xcc)[_0x1627('0x15')]();});}};}function handleEntityNotFound(_0x374f0d,_0x5f3206){return function(_0x121644){if(!_0x121644){_0x374f0d[_0x1627('0x14')](0x194);}return _0x121644;};}function handleError(_0x2644e2,_0x122d85){_0x122d85=_0x122d85||0x1f4;return function(_0xc2f3ab){logger[_0x1627('0x21')](_0xc2f3ab[_0x1627('0x22')]);if(_0xc2f3ab[_0x1627('0x23')]){delete _0xc2f3ab['name'];}_0x2644e2[_0x1627('0x19')](_0x122d85)[_0x1627('0x24')](_0xc2f3ab);};}exports[_0x1627('0x25')]=function(_0x261264,_0x2475b5){var _0x150191={},_0x258808={},_0x5b5fb0={'count':0x0,'rows':[]};var _0x3f8126=_[_0x1627('0x26')](db['SugarcrmConfiguration'][_0x1627('0x27')],function(_0x53c798){return{'name':_0x53c798[_0x1627('0x28')],'type':_0x53c798[_0x1627('0x29')][_0x1627('0x2a')]};});_0x258808['model']=_['map'](_0x3f8126,_0x1627('0x23'));_0x258808['query']=_[_0x1627('0x2b')](_0x261264[_0x1627('0x2c')]);_0x258808[_0x1627('0x2d')]=_['intersection'](_0x258808[_0x1627('0x2e')],_0x258808[_0x1627('0x2c')]);_0x150191[_0x1627('0x2f')]=_[_0x1627('0x30')](_0x258808['model'],qs['fields'](_0x261264[_0x1627('0x2c')][_0x1627('0x31')]));_0x150191[_0x1627('0x2f')]=_0x150191[_0x1627('0x2f')][_0x1627('0x32')]?_0x150191[_0x1627('0x2f')]:_0x258808[_0x1627('0x2e')];if(!_0x261264[_0x1627('0x2c')]['hasOwnProperty']('nolimit')){_0x150191[_0x1627('0x33')]=qs['limit'](_0x261264[_0x1627('0x2c')]['limit']);_0x150191['offset']=qs[_0x1627('0x16')](_0x261264[_0x1627('0x2c')][_0x1627('0x16')]);}_0x150191[_0x1627('0x34')]=qs['sort'](_0x261264[_0x1627('0x2c')][_0x1627('0x35')]);_0x150191[_0x1627('0x36')]=qs[_0x1627('0x2d')](_['pick'](_0x261264['query'],_0x258808[_0x1627('0x2d')]),_0x3f8126);if(_0x261264[_0x1627('0x2c')][_0x1627('0x37')]){_0x150191[_0x1627('0x36')]=_['merge'](_0x150191[_0x1627('0x36')],{'$or':_[_0x1627('0x26')](_0x3f8126,function(_0x311150){if(_0x311150[_0x1627('0x29')]!==_0x1627('0x38')){var _0x520c6e={};_0x520c6e[_0x311150[_0x1627('0x23')]]={'$like':'%'+_0x261264[_0x1627('0x2c')][_0x1627('0x37')]+'%'};return _0x520c6e;}})});}_0x150191=_[_0x1627('0x39')]({},_0x150191,_0x261264['options']);var _0x5cf66b={'where':_0x150191[_0x1627('0x36')]};return db[_0x1627('0x3a')][_0x1627('0x18')](_0x5cf66b)[_0x1627('0x1f')](function(_0x30822d){_0x5b5fb0['count']=_0x30822d;if(_0x261264[_0x1627('0x2c')][_0x1627('0x3b')]){_0x150191[_0x1627('0x3c')]=[{'all':!![]}];}return db[_0x1627('0x3a')]['findAll'](_0x150191);})[_0x1627('0x1f')](function(_0x169bea){_0x5b5fb0[_0x1627('0x3d')]=_0x169bea;return _0x5b5fb0;})[_0x1627('0x1f')](respondWithFilteredResult(_0x2475b5,_0x150191))[_0x1627('0x3e')](handleError(_0x2475b5,null));};exports[_0x1627('0x3f')]=function(_0xa5ba9c,_0x2b603c){var _0x3c99cd={'raw':![],'where':{'id':_0xa5ba9c['params']['id']}},_0x40e8f1={};_0x40e8f1[_0x1627('0x2e')]=_['keys'](db[_0x1627('0x3a')][_0x1627('0x27')]);_0x40e8f1[_0x1627('0x2c')]=_[_0x1627('0x2b')](_0xa5ba9c[_0x1627('0x2c')]);_0x40e8f1[_0x1627('0x2d')]=_[_0x1627('0x30')](_0x40e8f1[_0x1627('0x2e')],_0x40e8f1['query']);_0x3c99cd['attributes']=_[_0x1627('0x30')](_0x40e8f1[_0x1627('0x2e')],qs[_0x1627('0x31')](_0xa5ba9c[_0x1627('0x2c')]['fields']));_0x3c99cd[_0x1627('0x2f')]=_0x3c99cd[_0x1627('0x2f')][_0x1627('0x32')]?_0x3c99cd[_0x1627('0x2f')]:_0x40e8f1['model'];if(_0xa5ba9c[_0x1627('0x2c')][_0x1627('0x3b')]){_0x3c99cd['include']=[{'all':!![]}];}_0x3c99cd=_[_0x1627('0x39')]({},_0x3c99cd,_0xa5ba9c[_0x1627('0x40')]);return db[_0x1627('0x3a')][_0x1627('0x41')](_0x3c99cd)[_0x1627('0x1f')](handleEntityNotFound(_0x2b603c,null))['then'](respondWithResult(_0x2b603c,null))[_0x1627('0x3e')](handleError(_0x2b603c,null));};exports[_0x1627('0x42')]=function(_0x2700a0,_0xc8b668){return db[_0x1627('0x3a')]['create'](_0x2700a0[_0x1627('0x43')],{})[_0x1627('0x1f')](respondWithResult(_0xc8b668,0xc9))[_0x1627('0x3e')](handleError(_0xc8b668,null));};exports['update']=function(_0x28d385,_0x329296){if(_0x28d385[_0x1627('0x43')]['id']){delete _0x28d385[_0x1627('0x43')]['id'];}return db[_0x1627('0x3a')][_0x1627('0x41')]({'where':{'id':_0x28d385[_0x1627('0x44')]['id']}})[_0x1627('0x1f')](handleEntityNotFound(_0x329296,null))[_0x1627('0x1f')](saveUpdates(_0x28d385[_0x1627('0x43')],null))[_0x1627('0x1f')](respondWithResult(_0x329296,null))['catch'](handleError(_0x329296,null));};exports[_0x1627('0x20')]=function(_0x3a3d2d,_0x4da587){return db[_0x1627('0x3a')][_0x1627('0x41')]({'where':{'id':_0x3a3d2d[_0x1627('0x44')]['id']}})[_0x1627('0x1f')](handleEntityNotFound(_0x4da587,null))['then'](removeEntity(_0x4da587,null))[_0x1627('0x3e')](handleError(_0x4da587,null));};exports[_0x1627('0x45')]=function(_0x1ebe43,_0x3bb787,_0x475508){var _0x357de7={};var _0x137021={};var _0x2d4089;var _0x4ac48d;return db[_0x1627('0x3a')]['findOne']({'where':{'id':_0x1ebe43['params']['id']}})[_0x1627('0x1f')](handleEntityNotFound(_0x3bb787,null))[_0x1627('0x1f')](function(_0x34f98a){if(_0x34f98a){_0x2d4089=_0x34f98a;_0x137021['model']=_[_0x1627('0x2b')](db[_0x1627('0x46')]['rawAttributes']);_0x137021[_0x1627('0x2c')]=_[_0x1627('0x2b')](_0x1ebe43[_0x1627('0x2c')]);_0x137021[_0x1627('0x2d')]=_[_0x1627('0x30')](_0x137021[_0x1627('0x2e')],_0x137021[_0x1627('0x2c')]);_0x357de7[_0x1627('0x2f')]=_[_0x1627('0x30')](_0x137021[_0x1627('0x2e')],qs[_0x1627('0x31')](_0x1ebe43['query'][_0x1627('0x31')]));_0x357de7[_0x1627('0x2f')]=_0x357de7['attributes'][_0x1627('0x32')]?_0x357de7['attributes']:_0x137021[_0x1627('0x2e')];_0x357de7[_0x1627('0x34')]=qs['sort'](_0x1ebe43['query'][_0x1627('0x35')]);_0x357de7[_0x1627('0x36')]=qs[_0x1627('0x2d')](_[_0x1627('0x47')](_0x1ebe43[_0x1627('0x2c')],_0x137021[_0x1627('0x2d')]));if(_0x1ebe43['query'][_0x1627('0x37')]){_0x357de7[_0x1627('0x36')]=_[_0x1627('0x39')](_0x357de7['where'],{'$or':_['map'](_0x357de7[_0x1627('0x2f')],function(_0x114729){var _0x2a8518={};_0x2a8518[_0x114729]={'$like':'%'+_0x1ebe43[_0x1627('0x2c')][_0x1627('0x37')]+'%'};return _0x2a8518;})});}_0x357de7=_[_0x1627('0x39')]({},_0x357de7,_0x1ebe43[_0x1627('0x40')]);return _0x2d4089[_0x1627('0x45')](_0x357de7);}})[_0x1627('0x1f')](function(_0x21f8f2){if(_0x21f8f2){_0x4ac48d=_0x21f8f2[_0x1627('0x32')];if(!_0x1ebe43[_0x1627('0x2c')]['hasOwnProperty'](_0x1627('0x48'))){_0x357de7[_0x1627('0x33')]=qs[_0x1627('0x33')](_0x1ebe43['query'][_0x1627('0x33')]);_0x357de7[_0x1627('0x16')]=qs[_0x1627('0x16')](_0x1ebe43[_0x1627('0x2c')][_0x1627('0x16')]);}return _0x2d4089['getFields'](_0x357de7);}})[_0x1627('0x1f')](function(_0x2ad0a6){if(_0x2ad0a6){return _0x2ad0a6?{'count':_0x4ac48d,'rows':_0x2ad0a6}:null;}})[_0x1627('0x1f')](respondWithResult(_0x3bb787,null))[_0x1627('0x3e')](handleError(_0x3bb787,null));};exports[_0x1627('0x49')]=function(_0x5ab937,_0x30ff87,_0x8b1053){var _0x1f270={};var _0x58cbdf={};var _0x15f382;var _0x2fce8d;return db[_0x1627('0x3a')][_0x1627('0x4a')]({'where':{'id':_0x5ab937[_0x1627('0x44')]['id']}})['then'](handleEntityNotFound(_0x30ff87,null))[_0x1627('0x1f')](function(_0x4a5eee){if(_0x4a5eee){_0x15f382=_0x4a5eee;_0x58cbdf[_0x1627('0x2e')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x58cbdf[_0x1627('0x2c')]=_[_0x1627('0x2b')](_0x5ab937[_0x1627('0x2c')]);_0x58cbdf[_0x1627('0x2d')]=_[_0x1627('0x30')](_0x58cbdf[_0x1627('0x2e')],_0x58cbdf[_0x1627('0x2c')]);_0x1f270[_0x1627('0x2f')]=_[_0x1627('0x30')](_0x58cbdf[_0x1627('0x2e')],qs[_0x1627('0x31')](_0x5ab937[_0x1627('0x2c')][_0x1627('0x31')]));_0x1f270[_0x1627('0x2f')]=_0x1f270[_0x1627('0x2f')][_0x1627('0x32')]?_0x1f270[_0x1627('0x2f')]:_0x58cbdf['model'];_0x1f270[_0x1627('0x34')]=qs[_0x1627('0x35')](_0x5ab937[_0x1627('0x2c')][_0x1627('0x35')]);_0x1f270[_0x1627('0x36')]=qs[_0x1627('0x2d')](_[_0x1627('0x47')](_0x5ab937[_0x1627('0x2c')],_0x58cbdf[_0x1627('0x2d')]));if(_0x5ab937[_0x1627('0x2c')][_0x1627('0x37')]){_0x1f270[_0x1627('0x36')]=_[_0x1627('0x39')](_0x1f270[_0x1627('0x36')],{'$or':_[_0x1627('0x26')](_0x1f270[_0x1627('0x2f')],function(_0x782ca8){var _0x1d66eb={};_0x1d66eb[_0x782ca8]={'$like':'%'+_0x5ab937[_0x1627('0x2c')][_0x1627('0x37')]+'%'};return _0x1d66eb;})});}_0x1f270=_[_0x1627('0x39')]({},_0x1f270,_0x5ab937[_0x1627('0x40')]);return _0x15f382[_0x1627('0x49')](_0x1f270);}})['then'](function(_0x1f10d2){if(_0x1f10d2){_0x2fce8d=_0x1f10d2[_0x1627('0x32')];if(!_0x5ab937[_0x1627('0x2c')][_0x1627('0x4b')]('nolimit')){_0x1f270['limit']=qs[_0x1627('0x33')](_0x5ab937[_0x1627('0x2c')][_0x1627('0x33')]);_0x1f270[_0x1627('0x16')]=qs[_0x1627('0x16')](_0x5ab937[_0x1627('0x2c')][_0x1627('0x16')]);}return _0x15f382[_0x1627('0x49')](_0x1f270);}})[_0x1627('0x1f')](function(_0x1458b2){if(_0x1458b2){return _0x1458b2?{'count':_0x2fce8d,'rows':_0x1458b2}:null;}})[_0x1627('0x1f')](respondWithResult(_0x30ff87,null))[_0x1627('0x3e')](handleError(_0x30ff87,null));};exports[_0x1627('0x4c')]=function(_0x306b1b,_0x2e1176,_0x298267){var _0xb733c1={};var _0x36f322={};var _0x3f5ea4;var _0x1576b0;return db[_0x1627('0x3a')][_0x1627('0x4a')]({'where':{'id':_0x306b1b[_0x1627('0x44')]['id']}})[_0x1627('0x1f')](handleEntityNotFound(_0x2e1176,null))['then'](function(_0x1b268f){if(_0x1b268f){_0x3f5ea4=_0x1b268f;_0x36f322[_0x1627('0x2e')]=_[_0x1627('0x2b')](db[_0x1627('0x46')][_0x1627('0x27')]);_0x36f322[_0x1627('0x2c')]=_['keys'](_0x306b1b[_0x1627('0x2c')]);_0x36f322['filters']=_[_0x1627('0x30')](_0x36f322['model'],_0x36f322[_0x1627('0x2c')]);_0xb733c1['attributes']=_[_0x1627('0x30')](_0x36f322['model'],qs[_0x1627('0x31')](_0x306b1b['query'][_0x1627('0x31')]));_0xb733c1[_0x1627('0x2f')]=_0xb733c1[_0x1627('0x2f')][_0x1627('0x32')]?_0xb733c1[_0x1627('0x2f')]:_0x36f322['model'];_0xb733c1[_0x1627('0x34')]=qs[_0x1627('0x35')](_0x306b1b['query']['sort']);_0xb733c1[_0x1627('0x36')]=qs[_0x1627('0x2d')](_[_0x1627('0x47')](_0x306b1b[_0x1627('0x2c')],_0x36f322[_0x1627('0x2d')]));if(_0x306b1b[_0x1627('0x2c')][_0x1627('0x37')]){_0xb733c1[_0x1627('0x36')]=_[_0x1627('0x39')](_0xb733c1[_0x1627('0x36')],{'$or':_[_0x1627('0x26')](_0xb733c1['attributes'],function(_0x3bd402){var _0x70a94a={};_0x70a94a[_0x3bd402]={'$like':'%'+_0x306b1b[_0x1627('0x2c')][_0x1627('0x37')]+'%'};return _0x70a94a;})});}_0xb733c1=_[_0x1627('0x39')]({},_0xb733c1,_0x306b1b[_0x1627('0x40')]);return _0x3f5ea4[_0x1627('0x4c')](_0xb733c1);}})[_0x1627('0x1f')](function(_0x360e90){if(_0x360e90){_0x1576b0=_0x360e90[_0x1627('0x32')];if(!_0x306b1b['query'][_0x1627('0x4b')](_0x1627('0x48'))){_0xb733c1[_0x1627('0x33')]=qs[_0x1627('0x33')](_0x306b1b[_0x1627('0x2c')][_0x1627('0x33')]);_0xb733c1['offset']=qs[_0x1627('0x16')](_0x306b1b[_0x1627('0x2c')][_0x1627('0x16')]);}return _0x3f5ea4[_0x1627('0x4c')](_0xb733c1);}})[_0x1627('0x1f')](function(_0x3c3165){if(_0x3c3165){return _0x3c3165?{'count':_0x1576b0,'rows':_0x3c3165}:null;}})[_0x1627('0x1f')](respondWithResult(_0x2e1176,null))[_0x1627('0x3e')](handleError(_0x2e1176,null));}; \ No newline at end of file +var _0x1eb7=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','sendStatus','error','name','send','SugarcrmConfiguration','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','then','includeAll','include','rows','show','params','rawAttributes','options','find','catch','create','body','destroy','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x509c7d,_0x226ce5){var _0xb8d722=function(_0x6c6129){while(--_0x6c6129){_0x509c7d['push'](_0x509c7d['shift']());}};_0xb8d722(++_0x226ce5);}(_0x1eb7,0x99));var _0x71eb=function(_0x231b1d,_0x144539){_0x231b1d=_0x231b1d-0x0;var _0x4b6cd1=_0x1eb7[_0x231b1d];return _0x4b6cd1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x71eb('0x0'));var jsonpatch=require(_0x71eb('0x1'));var rp=require('request-promise');var moment=require(_0x71eb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x71eb('0x3'));var util=require(_0x71eb('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x71eb('0x5'));var ejs=require(_0x71eb('0x6'));var fs=require('fs');var fs_extra=require(_0x71eb('0x7'));var _=require(_0x71eb('0x8'));var squel=require(_0x71eb('0x9'));var crypto=require(_0x71eb('0xa'));var jsforce=require(_0x71eb('0xb'));var deskjs=require(_0x71eb('0xc'));var toCsv=require(_0x71eb('0x5'));var querystring=require(_0x71eb('0xd'));var Papa=require(_0x71eb('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x71eb('0xf'));var as=require(_0x71eb('0x10'));var hardwareService=require(_0x71eb('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x71eb('0x12'));var config=require(_0x71eb('0x13'));var licenseUtil=require(_0x71eb('0x14'));var db=require(_0x71eb('0x15'))['db'];function respondWithStatusCode(_0x3156a7,_0x3bcf14){_0x3bcf14=_0x3bcf14||0xcc;return function(_0x37e833){if(_0x37e833){return _0x3156a7['sendStatus'](_0x3bcf14);}return _0x3156a7[_0x71eb('0x16')](_0x3bcf14)[_0x71eb('0x17')]();};}function respondWithResult(_0xffac45,_0x3ed87e){_0x3ed87e=_0x3ed87e||0xc8;return function(_0x33113b){if(_0x33113b){return _0xffac45[_0x71eb('0x16')](_0x3ed87e)[_0x71eb('0x18')](_0x33113b);}};}function respondWithFilteredResult(_0x4a6abb,_0x1c8078){return function(_0x558bcb){if(_0x558bcb){var _0x3496e7=typeof _0x1c8078[_0x71eb('0x19')]===_0x71eb('0x1a')&&typeof _0x1c8078['limit']==='undefined';var _0x4ffe61=_0x558bcb['count'];var _0x4670f0=_0x3496e7?0x0:_0x1c8078[_0x71eb('0x19')];var _0x1d5a48=_0x3496e7?_0x558bcb[_0x71eb('0x1b')]:_0x1c8078[_0x71eb('0x19')]+_0x1c8078[_0x71eb('0x1c')];var _0x242c87;if(_0x1d5a48>=_0x4ffe61){_0x1d5a48=_0x4ffe61;_0x242c87=0xc8;}else{_0x242c87=0xce;}_0x4a6abb[_0x71eb('0x16')](_0x242c87);return _0x4a6abb[_0x71eb('0x1d')](_0x71eb('0x1e'),_0x4670f0+'-'+_0x1d5a48+'/'+_0x4ffe61)[_0x71eb('0x18')](_0x558bcb);}return null;};}function patchUpdates(_0x26754e){return function(_0x4d6942){try{jsonpatch[_0x71eb('0x1f')](_0x4d6942,_0x26754e,!![]);}catch(_0x5ade1c){return BPromise[_0x71eb('0x20')](_0x5ade1c);}return _0x4d6942[_0x71eb('0x21')]();};}function saveUpdates(_0x12551e,_0x40fc12){return function(_0x60f576){if(_0x60f576){return _0x60f576[_0x71eb('0x22')](_0x12551e)['then'](function(_0x10b9ab){return _0x10b9ab;});}return null;};}function removeEntity(_0x5ce6f0,_0x1688bc){return function(_0x4cdd71){if(_0x4cdd71){return _0x4cdd71['destroy']()['then'](function(){_0x5ce6f0[_0x71eb('0x16')](0xcc)[_0x71eb('0x17')]();});}};}function handleEntityNotFound(_0x5528d3,_0x558e8d){return function(_0x46e632){if(!_0x46e632){_0x5528d3[_0x71eb('0x23')](0x194);}return _0x46e632;};}function handleError(_0x5d3081,_0x13c5fa){_0x13c5fa=_0x13c5fa||0x1f4;return function(_0x2f2159){logger[_0x71eb('0x24')](_0x2f2159['stack']);if(_0x2f2159[_0x71eb('0x25')]){delete _0x2f2159['name'];}_0x5d3081[_0x71eb('0x16')](_0x13c5fa)[_0x71eb('0x26')](_0x2f2159);};}exports['index']=function(_0x248d1e,_0x5a3393){var _0x4a41ea={},_0x2dc224={},_0x54ffbb={'count':0x0,'rows':[]};var _0x5b08c7=_['map'](db[_0x71eb('0x27')]['rawAttributes'],function(_0x376f84){return{'name':_0x376f84[_0x71eb('0x28')],'type':_0x376f84[_0x71eb('0x29')][_0x71eb('0x2a')]};});_0x2dc224['model']=_[_0x71eb('0x2b')](_0x5b08c7,_0x71eb('0x25'));_0x2dc224[_0x71eb('0x2c')]=_[_0x71eb('0x2d')](_0x248d1e['query']);_0x2dc224['filters']=_[_0x71eb('0x2e')](_0x2dc224[_0x71eb('0x2f')],_0x2dc224[_0x71eb('0x2c')]);_0x4a41ea['attributes']=_[_0x71eb('0x2e')](_0x2dc224[_0x71eb('0x2f')],qs[_0x71eb('0x30')](_0x248d1e['query'][_0x71eb('0x30')]));_0x4a41ea[_0x71eb('0x31')]=_0x4a41ea[_0x71eb('0x31')][_0x71eb('0x32')]?_0x4a41ea[_0x71eb('0x31')]:_0x2dc224[_0x71eb('0x2f')];if(!_0x248d1e[_0x71eb('0x2c')][_0x71eb('0x33')](_0x71eb('0x34'))){_0x4a41ea[_0x71eb('0x1c')]=qs[_0x71eb('0x1c')](_0x248d1e['query']['limit']);_0x4a41ea[_0x71eb('0x19')]=qs['offset'](_0x248d1e[_0x71eb('0x2c')]['offset']);}_0x4a41ea[_0x71eb('0x35')]=qs['sort'](_0x248d1e[_0x71eb('0x2c')][_0x71eb('0x36')]);_0x4a41ea[_0x71eb('0x37')]=qs[_0x71eb('0x38')](_[_0x71eb('0x39')](_0x248d1e[_0x71eb('0x2c')],_0x2dc224['filters']),_0x5b08c7);if(_0x248d1e[_0x71eb('0x2c')][_0x71eb('0x3a')]){_0x4a41ea[_0x71eb('0x37')]=_['merge'](_0x4a41ea[_0x71eb('0x37')],{'$or':_['map'](_0x5b08c7,function(_0x43f971){if(_0x43f971[_0x71eb('0x29')]!==_0x71eb('0x3b')){var _0x1aed98={};_0x1aed98[_0x43f971[_0x71eb('0x25')]]={'$like':'%'+_0x248d1e[_0x71eb('0x2c')][_0x71eb('0x3a')]+'%'};return _0x1aed98;}})});}_0x4a41ea=_[_0x71eb('0x3c')]({},_0x4a41ea,_0x248d1e['options']);var _0x825204={'where':_0x4a41ea[_0x71eb('0x37')]};return db[_0x71eb('0x27')][_0x71eb('0x1b')](_0x825204)[_0x71eb('0x3d')](function(_0x53670a){_0x54ffbb[_0x71eb('0x1b')]=_0x53670a;if(_0x248d1e[_0x71eb('0x2c')][_0x71eb('0x3e')]){_0x4a41ea[_0x71eb('0x3f')]=[{'all':!![]}];}return db[_0x71eb('0x27')]['findAll'](_0x4a41ea);})[_0x71eb('0x3d')](function(_0x454d61){_0x54ffbb[_0x71eb('0x40')]=_0x454d61;return _0x54ffbb;})[_0x71eb('0x3d')](respondWithFilteredResult(_0x5a3393,_0x4a41ea))['catch'](handleError(_0x5a3393,null));};exports[_0x71eb('0x41')]=function(_0x1c1e30,_0x899606){var _0x1b65e0={'raw':![],'where':{'id':_0x1c1e30[_0x71eb('0x42')]['id']}},_0x1d5628={};_0x1d5628[_0x71eb('0x2f')]=_[_0x71eb('0x2d')](db[_0x71eb('0x27')][_0x71eb('0x43')]);_0x1d5628[_0x71eb('0x2c')]=_[_0x71eb('0x2d')](_0x1c1e30[_0x71eb('0x2c')]);_0x1d5628['filters']=_[_0x71eb('0x2e')](_0x1d5628[_0x71eb('0x2f')],_0x1d5628[_0x71eb('0x2c')]);_0x1b65e0[_0x71eb('0x31')]=_[_0x71eb('0x2e')](_0x1d5628[_0x71eb('0x2f')],qs[_0x71eb('0x30')](_0x1c1e30[_0x71eb('0x2c')][_0x71eb('0x30')]));_0x1b65e0[_0x71eb('0x31')]=_0x1b65e0[_0x71eb('0x31')]['length']?_0x1b65e0[_0x71eb('0x31')]:_0x1d5628[_0x71eb('0x2f')];if(_0x1c1e30[_0x71eb('0x2c')][_0x71eb('0x3e')]){_0x1b65e0[_0x71eb('0x3f')]=[{'all':!![]}];}_0x1b65e0=_[_0x71eb('0x3c')]({},_0x1b65e0,_0x1c1e30[_0x71eb('0x44')]);return db[_0x71eb('0x27')][_0x71eb('0x45')](_0x1b65e0)[_0x71eb('0x3d')](handleEntityNotFound(_0x899606,null))[_0x71eb('0x3d')](respondWithResult(_0x899606,null))[_0x71eb('0x46')](handleError(_0x899606,null));};exports[_0x71eb('0x47')]=function(_0x47c97d,_0x34ac30){return db['SugarcrmConfiguration'][_0x71eb('0x47')](_0x47c97d[_0x71eb('0x48')],{})[_0x71eb('0x3d')](respondWithResult(_0x34ac30,0xc9))[_0x71eb('0x46')](handleError(_0x34ac30,null));};exports[_0x71eb('0x22')]=function(_0x5666d2,_0x22826d){if(_0x5666d2[_0x71eb('0x48')]['id']){delete _0x5666d2['body']['id'];}return db[_0x71eb('0x27')][_0x71eb('0x45')]({'where':{'id':_0x5666d2['params']['id']}})[_0x71eb('0x3d')](handleEntityNotFound(_0x22826d,null))[_0x71eb('0x3d')](saveUpdates(_0x5666d2[_0x71eb('0x48')],null))['then'](respondWithResult(_0x22826d,null))[_0x71eb('0x46')](handleError(_0x22826d,null));};exports[_0x71eb('0x49')]=function(_0x38d6d3,_0xd8bcf0){return db['SugarcrmConfiguration'][_0x71eb('0x45')]({'where':{'id':_0x38d6d3[_0x71eb('0x42')]['id']}})[_0x71eb('0x3d')](handleEntityNotFound(_0xd8bcf0,null))[_0x71eb('0x3d')](removeEntity(_0xd8bcf0,null))[_0x71eb('0x46')](handleError(_0xd8bcf0,null));};exports[_0x71eb('0x4a')]=function(_0x3dccdf,_0x2764d6,_0x44c078){var _0x852ccd={};var _0x235938={};var _0x36c38f;var _0x47ff3a;return db[_0x71eb('0x27')]['findOne']({'where':{'id':_0x3dccdf[_0x71eb('0x42')]['id']}})[_0x71eb('0x3d')](handleEntityNotFound(_0x2764d6,null))[_0x71eb('0x3d')](function(_0x549fa6){if(_0x549fa6){_0x36c38f=_0x549fa6;_0x235938[_0x71eb('0x2f')]=_[_0x71eb('0x2d')](db[_0x71eb('0x4b')][_0x71eb('0x43')]);_0x235938[_0x71eb('0x2c')]=_['keys'](_0x3dccdf[_0x71eb('0x2c')]);_0x235938[_0x71eb('0x38')]=_[_0x71eb('0x2e')](_0x235938['model'],_0x235938['query']);_0x852ccd[_0x71eb('0x31')]=_[_0x71eb('0x2e')](_0x235938[_0x71eb('0x2f')],qs[_0x71eb('0x30')](_0x3dccdf[_0x71eb('0x2c')][_0x71eb('0x30')]));_0x852ccd[_0x71eb('0x31')]=_0x852ccd['attributes'][_0x71eb('0x32')]?_0x852ccd[_0x71eb('0x31')]:_0x235938[_0x71eb('0x2f')];_0x852ccd['order']=qs[_0x71eb('0x36')](_0x3dccdf[_0x71eb('0x2c')][_0x71eb('0x36')]);_0x852ccd[_0x71eb('0x37')]=qs[_0x71eb('0x38')](_[_0x71eb('0x39')](_0x3dccdf[_0x71eb('0x2c')],_0x235938[_0x71eb('0x38')]));if(_0x3dccdf[_0x71eb('0x2c')][_0x71eb('0x3a')]){_0x852ccd[_0x71eb('0x37')]=_['merge'](_0x852ccd[_0x71eb('0x37')],{'$or':_[_0x71eb('0x2b')](_0x852ccd[_0x71eb('0x31')],function(_0x5a7010){var _0x3ad792={};_0x3ad792[_0x5a7010]={'$like':'%'+_0x3dccdf[_0x71eb('0x2c')][_0x71eb('0x3a')]+'%'};return _0x3ad792;})});}_0x852ccd=_[_0x71eb('0x3c')]({},_0x852ccd,_0x3dccdf[_0x71eb('0x44')]);return _0x36c38f[_0x71eb('0x4a')](_0x852ccd);}})['then'](function(_0x2f8ce1){if(_0x2f8ce1){_0x47ff3a=_0x2f8ce1['length'];if(!_0x3dccdf[_0x71eb('0x2c')][_0x71eb('0x33')](_0x71eb('0x34'))){_0x852ccd[_0x71eb('0x1c')]=qs['limit'](_0x3dccdf[_0x71eb('0x2c')][_0x71eb('0x1c')]);_0x852ccd[_0x71eb('0x19')]=qs[_0x71eb('0x19')](_0x3dccdf[_0x71eb('0x2c')][_0x71eb('0x19')]);}return _0x36c38f[_0x71eb('0x4a')](_0x852ccd);}})[_0x71eb('0x3d')](function(_0x41112b){if(_0x41112b){return _0x41112b?{'count':_0x47ff3a,'rows':_0x41112b}:null;}})[_0x71eb('0x3d')](respondWithResult(_0x2764d6,null))[_0x71eb('0x46')](handleError(_0x2764d6,null));};exports[_0x71eb('0x4c')]=function(_0x3b2277,_0x27b107,_0x228523){var _0x556ddd={};var _0x4a0b83={};var _0x3cbca6;var _0x1ca4d9;return db['SugarcrmConfiguration'][_0x71eb('0x4d')]({'where':{'id':_0x3b2277['params']['id']}})[_0x71eb('0x3d')](handleEntityNotFound(_0x27b107,null))[_0x71eb('0x3d')](function(_0x54ea47){if(_0x54ea47){_0x3cbca6=_0x54ea47;_0x4a0b83[_0x71eb('0x2f')]=_[_0x71eb('0x2d')](db[_0x71eb('0x4b')][_0x71eb('0x43')]);_0x4a0b83[_0x71eb('0x2c')]=_[_0x71eb('0x2d')](_0x3b2277[_0x71eb('0x2c')]);_0x4a0b83[_0x71eb('0x38')]=_[_0x71eb('0x2e')](_0x4a0b83[_0x71eb('0x2f')],_0x4a0b83[_0x71eb('0x2c')]);_0x556ddd[_0x71eb('0x31')]=_[_0x71eb('0x2e')](_0x4a0b83[_0x71eb('0x2f')],qs[_0x71eb('0x30')](_0x3b2277[_0x71eb('0x2c')][_0x71eb('0x30')]));_0x556ddd['attributes']=_0x556ddd['attributes'][_0x71eb('0x32')]?_0x556ddd[_0x71eb('0x31')]:_0x4a0b83[_0x71eb('0x2f')];_0x556ddd['order']=qs['sort'](_0x3b2277[_0x71eb('0x2c')][_0x71eb('0x36')]);_0x556ddd[_0x71eb('0x37')]=qs[_0x71eb('0x38')](_['pick'](_0x3b2277[_0x71eb('0x2c')],_0x4a0b83['filters']));if(_0x3b2277['query'][_0x71eb('0x3a')]){_0x556ddd['where']=_[_0x71eb('0x3c')](_0x556ddd[_0x71eb('0x37')],{'$or':_[_0x71eb('0x2b')](_0x556ddd[_0x71eb('0x31')],function(_0x325cdd){var _0x5939ae={};_0x5939ae[_0x325cdd]={'$like':'%'+_0x3b2277[_0x71eb('0x2c')][_0x71eb('0x3a')]+'%'};return _0x5939ae;})});}_0x556ddd=_[_0x71eb('0x3c')]({},_0x556ddd,_0x3b2277[_0x71eb('0x44')]);return _0x3cbca6[_0x71eb('0x4c')](_0x556ddd);}})[_0x71eb('0x3d')](function(_0x2fef0a){if(_0x2fef0a){_0x1ca4d9=_0x2fef0a[_0x71eb('0x32')];if(!_0x3b2277[_0x71eb('0x2c')][_0x71eb('0x33')](_0x71eb('0x34'))){_0x556ddd['limit']=qs[_0x71eb('0x1c')](_0x3b2277[_0x71eb('0x2c')][_0x71eb('0x1c')]);_0x556ddd[_0x71eb('0x19')]=qs['offset'](_0x3b2277[_0x71eb('0x2c')][_0x71eb('0x19')]);}return _0x3cbca6[_0x71eb('0x4c')](_0x556ddd);}})[_0x71eb('0x3d')](function(_0x371761){if(_0x371761){return _0x371761?{'count':_0x1ca4d9,'rows':_0x371761}:null;}})[_0x71eb('0x3d')](respondWithResult(_0x27b107,null))['catch'](handleError(_0x27b107,null));};exports[_0x71eb('0x4e')]=function(_0x20acc1,_0xf27add,_0x2e9c17){var _0x685e0e={};var _0x45a67f={};var _0x433887;var _0x5519ee;return db[_0x71eb('0x27')]['findOne']({'where':{'id':_0x20acc1[_0x71eb('0x42')]['id']}})['then'](handleEntityNotFound(_0xf27add,null))[_0x71eb('0x3d')](function(_0x7e24d5){if(_0x7e24d5){_0x433887=_0x7e24d5;_0x45a67f[_0x71eb('0x2f')]=_['keys'](db[_0x71eb('0x4b')]['rawAttributes']);_0x45a67f['query']=_['keys'](_0x20acc1['query']);_0x45a67f[_0x71eb('0x38')]=_['intersection'](_0x45a67f[_0x71eb('0x2f')],_0x45a67f[_0x71eb('0x2c')]);_0x685e0e['attributes']=_['intersection'](_0x45a67f[_0x71eb('0x2f')],qs[_0x71eb('0x30')](_0x20acc1[_0x71eb('0x2c')][_0x71eb('0x30')]));_0x685e0e[_0x71eb('0x31')]=_0x685e0e[_0x71eb('0x31')][_0x71eb('0x32')]?_0x685e0e[_0x71eb('0x31')]:_0x45a67f[_0x71eb('0x2f')];_0x685e0e[_0x71eb('0x35')]=qs['sort'](_0x20acc1['query']['sort']);_0x685e0e[_0x71eb('0x37')]=qs[_0x71eb('0x38')](_['pick'](_0x20acc1[_0x71eb('0x2c')],_0x45a67f[_0x71eb('0x38')]));if(_0x20acc1[_0x71eb('0x2c')][_0x71eb('0x3a')]){_0x685e0e['where']=_['merge'](_0x685e0e[_0x71eb('0x37')],{'$or':_[_0x71eb('0x2b')](_0x685e0e[_0x71eb('0x31')],function(_0x39f440){var _0x1efea4={};_0x1efea4[_0x39f440]={'$like':'%'+_0x20acc1[_0x71eb('0x2c')][_0x71eb('0x3a')]+'%'};return _0x1efea4;})});}_0x685e0e=_['merge']({},_0x685e0e,_0x20acc1[_0x71eb('0x44')]);return _0x433887[_0x71eb('0x4e')](_0x685e0e);}})[_0x71eb('0x3d')](function(_0x45a038){if(_0x45a038){_0x5519ee=_0x45a038[_0x71eb('0x32')];if(!_0x20acc1[_0x71eb('0x2c')][_0x71eb('0x33')](_0x71eb('0x34'))){_0x685e0e[_0x71eb('0x1c')]=qs[_0x71eb('0x1c')](_0x20acc1[_0x71eb('0x2c')][_0x71eb('0x1c')]);_0x685e0e['offset']=qs[_0x71eb('0x19')](_0x20acc1[_0x71eb('0x2c')][_0x71eb('0x19')]);}return _0x433887['getDescriptions'](_0x685e0e);}})['then'](function(_0x218e2b){if(_0x218e2b){return _0x218e2b?{'count':_0x5519ee,'rows':_0x218e2b}:null;}})['then'](respondWithResult(_0xf27add,null))[_0x71eb('0x46')](handleError(_0xf27add,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 42f2781..2c8d0e5 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 _0x3ebb=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x1811b2,_0x49d354){var _0x56bb27=function(_0x527b0c){while(--_0x527b0c){_0x1811b2['push'](_0x1811b2['shift']());}};_0x56bb27(++_0x49d354);}(_0x3ebb,0x150));var _0xb3eb=function(_0x2d6110,_0x40cfee){_0x2d6110=_0x2d6110-0x0;var _0x33e09b=_0x3ebb[_0x2d6110];return _0x33e09b;};'use strict';var _=require(_0xb3eb('0x0'));var util=require('util');var logger=require(_0xb3eb('0x1'))(_0xb3eb('0x2'));var moment=require(_0xb3eb('0x3'));var BPromise=require(_0xb3eb('0x4'));var rp=require(_0xb3eb('0x5'));var fs=require('fs');var path=require(_0xb3eb('0x6'));var rimraf=require(_0xb3eb('0x7'));var config=require(_0xb3eb('0x8'));var attributes=require(_0xb3eb('0x9'));module[_0xb3eb('0xa')]=function(_0x3b7e2a,_0x5579da){return _0x3b7e2a[_0xb3eb('0xb')](_0xb3eb('0xc'),attributes,{'tableName':_0xb3eb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e20=['request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x16216f,_0x57c1ac){var _0x3de213=function(_0x2046fa){while(--_0x2046fa){_0x16216f['push'](_0x16216f['shift']());}};_0x3de213(++_0x57c1ac);}(_0x7e20,0xa3));var _0x07e2=function(_0x572373,_0x10e86f){_0x572373=_0x572373-0x0;var _0x11d070=_0x7e20[_0x572373];return _0x11d070;};'use strict';var _=require(_0x07e2('0x0'));var util=require(_0x07e2('0x1'));var logger=require(_0x07e2('0x2'))(_0x07e2('0x3'));var moment=require(_0x07e2('0x4'));var BPromise=require(_0x07e2('0x5'));var rp=require(_0x07e2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07e2('0x7'));var config=require(_0x07e2('0x8'));var attributes=require(_0x07e2('0x9'));module[_0x07e2('0xa')]=function(_0x52372c,_0x2634da){return _0x52372c['define'](_0x07e2('0xb'),attributes,{'tableName':_0x07e2('0xc'),'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 27a15d7..989b31e 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 _0x5577=['error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x249c76,_0x30fc97){var _0x390387=function(_0xfc2652){while(--_0xfc2652){_0x249c76['push'](_0x249c76['shift']());}};_0x390387(++_0x30fc97);}(_0x5577,0x90));var _0x7557=function(_0x504d97,_0x3c2a6e){_0x504d97=_0x504d97-0x0;var _0x49701b=_0x5577[_0x504d97];return _0x49701b;};'use strict';var _=require(_0x7557('0x0'));var util=require(_0x7557('0x1'));var moment=require(_0x7557('0x2'));var BPromise=require('bluebird');var rs=require(_0x7557('0x3'));var fs=require('fs');var Redis=require(_0x7557('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7557('0x5'));var logger=require(_0x7557('0x6'))(_0x7557('0x7'));var config=require(_0x7557('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7557('0x9')][_0x7557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x72217e,_0xd23415,_0x5e2d52){return new BPromise(function(_0x42930b,_0x243b52){return client[_0x7557('0xb')](_0x72217e,_0x5e2d52)[_0x7557('0xc')](function(_0x1bb3ed){logger[_0x7557('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xd23415,_0x7557('0xe'));logger[_0x7557('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xd23415,_0x7557('0xe'),JSON[_0x7557('0x10')](_0x1bb3ed));if(_0x1bb3ed[_0x7557('0x11')]){if(_0x1bb3ed['error'][_0x7557('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xd23415,_0x1bb3ed['error'][_0x7557('0x13')]);return _0x243b52(_0x1bb3ed[_0x7557('0x11')][_0x7557('0x13')]);}logger[_0x7557('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xd23415,_0x1bb3ed[_0x7557('0x11')][_0x7557('0x13')]);return _0x42930b(_0x1bb3ed[_0x7557('0x11')][_0x7557('0x13')]);}else{logger[_0x7557('0xd')](_0x7557('0x14'),_0xd23415,'request\x20sent');_0x42930b(_0x1bb3ed[_0x7557('0x15')][_0x7557('0x13')]);}})[_0x7557('0x16')](function(_0x323fec){logger['error'](_0x7557('0x14'),_0xd23415,_0x323fec);_0x243b52(_0x323fec);});});} \ No newline at end of file +var _0x894e=['request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x894e,0xbb));var _0xe894=function(_0x584a03,_0x59e0c8){_0x584a03=_0x584a03-0x0;var _0x29d9c9=_0x894e[_0x584a03];return _0x29d9c9;};'use strict';var _=require('lodash');var util=require(_0xe894('0x0'));var moment=require(_0xe894('0x1'));var BPromise=require(_0xe894('0x2'));var rs=require(_0xe894('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe894('0x4'))['db'];var utils=require(_0xe894('0x5'));var logger=require(_0xe894('0x6'))(_0xe894('0x7'));var config=require(_0xe894('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe894('0x9')][_0xe894('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23bf2c,_0x34eda4,_0x431f92){return new BPromise(function(_0x2803d8,_0x76d5dd){return client[_0xe894('0xb')](_0x23bf2c,_0x431f92)[_0xe894('0xc')](function(_0x2d9001){logger['info'](_0xe894('0xd'),_0x34eda4,_0xe894('0xe'));logger[_0xe894('0xf')](_0xe894('0x10'),_0x34eda4,_0xe894('0xe'),JSON['stringify'](_0x2d9001));if(_0x2d9001[_0xe894('0x11')]){if(_0x2d9001[_0xe894('0x11')][_0xe894('0x12')]===0x1f4){logger['error'](_0xe894('0xd'),_0x34eda4,_0x2d9001[_0xe894('0x11')][_0xe894('0x13')]);return _0x76d5dd(_0x2d9001[_0xe894('0x11')][_0xe894('0x13')]);}logger[_0xe894('0x11')](_0xe894('0xd'),_0x34eda4,_0x2d9001[_0xe894('0x11')][_0xe894('0x13')]);return _0x2803d8(_0x2d9001['error']['message']);}else{logger[_0xe894('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x34eda4,'request\x20sent');_0x2803d8(_0x2d9001['result'][_0xe894('0x13')]);}})[_0xe894('0x15')](function(_0x445af3){logger['error'](_0xe894('0xd'),_0x34eda4,_0x445af3);_0x76d5dd(_0x445af3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e9405e3..c3d6265 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 _0x9d71=['../../config/environment','isAuthenticated','get','show','post','create','put','/:id','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa0acdc,_0x16be61){var _0x2f91d3=function(_0x363465){while(--_0x363465){_0xa0acdc['push'](_0xa0acdc['shift']());}};_0x2f91d3(++_0x16be61);}(_0x9d71,0xf5));var _0x19d7=function(_0x5f1f95,_0x1bde3a){_0x5f1f95=_0x5f1f95-0x0;var _0x467bd6=_0x9d71[_0x5f1f95];return _0x467bd6;};'use strict';var multer=require('multer');var util=require(_0x19d7('0x0'));var path=require(_0x19d7('0x1'));var timeout=require('connect-timeout');var express=require(_0x19d7('0x2'));var router=express[_0x19d7('0x3')]();var fs_extra=require(_0x19d7('0x4'));var auth=require(_0x19d7('0x5'));var interaction=require(_0x19d7('0x6'));var config=require(_0x19d7('0x7'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x19d7('0x8')](),controller['index']);router[_0x19d7('0x9')]('/:id',auth[_0x19d7('0x8')](),controller[_0x19d7('0xa')]);router[_0x19d7('0xb')]('/',auth['isAuthenticated'](),controller[_0x19d7('0xc')]);router[_0x19d7('0xd')](_0x19d7('0xe'),auth[_0x19d7('0x8')](),controller['update']);router[_0x19d7('0xf')]('/:id',auth[_0x19d7('0x8')](),controller[_0x19d7('0x10')]);module[_0x19d7('0x11')]=router; \ No newline at end of file +var _0xb55d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x303054,_0xfbb65a){var _0x3a7287=function(_0x3f0a0d){while(--_0x3f0a0d){_0x303054['push'](_0x303054['shift']());}};_0x3a7287(++_0xfbb65a);}(_0xb55d,0xaa));var _0xdb55=function(_0x5322e4,_0x4313f0){_0x5322e4=_0x5322e4-0x0;var _0x118dc0=_0xb55d[_0x5322e4];return _0x118dc0;};'use strict';var multer=require('multer');var util=require(_0xdb55('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdb55('0x1'));var router=express[_0xdb55('0x2')]();var fs_extra=require(_0xdb55('0x3'));var auth=require(_0xdb55('0x4'));var interaction=require(_0xdb55('0x5'));var config=require(_0xdb55('0x6'));var controller=require(_0xdb55('0x7'));router['get']('/',auth[_0xdb55('0x8')](),controller[_0xdb55('0x9')]);router[_0xdb55('0xa')](_0xdb55('0xb'),auth[_0xdb55('0x8')](),controller[_0xdb55('0xc')]);router[_0xdb55('0xd')]('/',auth[_0xdb55('0x8')](),controller[_0xdb55('0xe')]);router[_0xdb55('0xf')](_0xdb55('0xb'),auth['isAuthenticated'](),controller[_0xdb55('0x10')]);router[_0xdb55('0x11')](_0xdb55('0xb'),auth[_0xdb55('0x8')](),controller[_0xdb55('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 2f47a4a..d29e25d 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 _0x6cd5=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cd5,0x1ab));var _0x56cd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6cd5[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x56cd('0x0'));module[_0x56cd('0x1')]={'type':{'type':Sequelize[_0x56cd('0x2')](_0x56cd('0x3'),_0x56cd('0x4'),'customVariable',_0x56cd('0x5'),_0x56cd('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x56cd('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x56cd('0x2')](_0x56cd('0x3'),_0x56cd('0x4'),_0x56cd('0x8'))},'keyContent':{'type':Sequelize[_0x56cd('0x7')]},'idField':{'type':Sequelize[_0x56cd('0x7')]},'nameField':{'type':Sequelize[_0x56cd('0x7')]},'customField':{'type':Sequelize[_0x56cd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b26=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','exports'];(function(_0x104693,_0x5ae6b6){var _0x1bffc5=function(_0x5ac614){while(--_0x5ac614){_0x104693['push'](_0x104693['shift']());}};_0x1bffc5(++_0x5ae6b6);}(_0x3b26,0x87));var _0x63b2=function(_0x59d347,_0x2ce76c){_0x59d347=_0x59d347-0x0;var _0x51940b=_0x3b26[_0x59d347];return _0x51940b;};'use strict';var Sequelize=require('sequelize');module[_0x63b2('0x0')]={'type':{'type':Sequelize[_0x63b2('0x1')](_0x63b2('0x2'),_0x63b2('0x3'),'customVariable',_0x63b2('0x4'),_0x63b2('0x5')),'defaultValue':_0x63b2('0x2')},'content':{'type':Sequelize[_0x63b2('0x6')]},'key':{'type':Sequelize[_0x63b2('0x6')]},'keyType':{'type':Sequelize[_0x63b2('0x1')](_0x63b2('0x2'),_0x63b2('0x3'),_0x63b2('0x7'))},'keyContent':{'type':Sequelize[_0x63b2('0x6')]},'idField':{'type':Sequelize[_0x63b2('0x6')]},'nameField':{'type':Sequelize[_0x63b2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x63b2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8694c85..8c4d720 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 _0x383e=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','SugarcrmField','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','error','name','index','rawAttributes','fieldName','type','key'];(function(_0x52ff77,_0x231567){var _0x578659=function(_0xb8a193){while(--_0xb8a193){_0x52ff77['push'](_0x52ff77['shift']());}};_0x578659(++_0x231567);}(_0x383e,0x68));var _0xe383=function(_0x5079f0,_0x2e0ae4){_0x5079f0=_0x5079f0-0x0;var _0x182bce=_0x383e[_0x5079f0];return _0x182bce;};'use strict';var emlformat=require(_0xe383('0x0'));var rimraf=require(_0xe383('0x1'));var zipdir=require(_0xe383('0x2'));var jsonpatch=require(_0xe383('0x3'));var rp=require(_0xe383('0x4'));var moment=require(_0xe383('0x5'));var BPromise=require(_0xe383('0x6'));var Mustache=require(_0xe383('0x7'));var util=require(_0xe383('0x8'));var path=require('path');var sox=require(_0xe383('0x9'));var csv=require(_0xe383('0xa'));var ejs=require(_0xe383('0xb'));var fs=require('fs');var fs_extra=require(_0xe383('0xc'));var _=require(_0xe383('0xd'));var squel=require('squel');var crypto=require(_0xe383('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe383('0xf'));var toCsv=require(_0xe383('0xa'));var querystring=require(_0xe383('0x10'));var Papa=require(_0xe383('0x11'));var Redis=require(_0xe383('0x12'));var authService=require(_0xe383('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe383('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe383('0x15'))(_0xe383('0x16'));var utils=require(_0xe383('0x17'));var config=require(_0xe383('0x18'));var licenseUtil=require(_0xe383('0x19'));var db=require(_0xe383('0x1a'))['db'];function respondWithStatusCode(_0x51d5d0,_0x1611ee){_0x1611ee=_0x1611ee||0xcc;return function(_0x49edd3){if(_0x49edd3){return _0x51d5d0['sendStatus'](_0x1611ee);}return _0x51d5d0[_0xe383('0x1b')](_0x1611ee)[_0xe383('0x1c')]();};}function respondWithResult(_0x391ee7,_0x3fc278){_0x3fc278=_0x3fc278||0xc8;return function(_0x277e9a){if(_0x277e9a){return _0x391ee7[_0xe383('0x1b')](_0x3fc278)[_0xe383('0x1d')](_0x277e9a);}};}function respondWithFilteredResult(_0x7ca9a7,_0x3ed0d8){return function(_0x388a99){if(_0x388a99){var _0x2bb315=typeof _0x3ed0d8[_0xe383('0x1e')]===_0xe383('0x1f')&&typeof _0x3ed0d8[_0xe383('0x20')]===_0xe383('0x1f');var _0x4d5254=_0x388a99[_0xe383('0x21')];var _0x59de2a=_0x2bb315?0x0:_0x3ed0d8['offset'];var _0x40204a=_0x2bb315?_0x388a99['count']:_0x3ed0d8[_0xe383('0x1e')]+_0x3ed0d8[_0xe383('0x20')];var _0x264887;if(_0x40204a>=_0x4d5254){_0x40204a=_0x4d5254;_0x264887=0xc8;}else{_0x264887=0xce;}_0x7ca9a7[_0xe383('0x1b')](_0x264887);return _0x7ca9a7[_0xe383('0x22')]('Content-Range',_0x59de2a+'-'+_0x40204a+'/'+_0x4d5254)['json'](_0x388a99);}return null;};}function patchUpdates(_0x4d2b4d){return function(_0x936d20){try{jsonpatch['apply'](_0x936d20,_0x4d2b4d,!![]);}catch(_0x47b435){return BPromise[_0xe383('0x23')](_0x47b435);}return _0x936d20[_0xe383('0x24')]();};}function saveUpdates(_0x1e1104,_0x5b3b08){return function(_0x2db58a){if(_0x2db58a){return _0x2db58a[_0xe383('0x25')](_0x1e1104)[_0xe383('0x26')](function(_0x2e8242){return _0x2e8242;});}return null;};}function removeEntity(_0x99c4c0,_0x5dee59){return function(_0x14fe24){if(_0x14fe24){return _0x14fe24[_0xe383('0x27')]()[_0xe383('0x26')](function(){_0x99c4c0[_0xe383('0x1b')](0xcc)[_0xe383('0x1c')]();});}};}function handleEntityNotFound(_0x159ba9,_0x21f2c1){return function(_0x37c258){if(!_0x37c258){_0x159ba9[_0xe383('0x28')](0x194);}return _0x37c258;};}function handleError(_0x3ce25f,_0x4e8577){_0x4e8577=_0x4e8577||0x1f4;return function(_0x21288d){logger[_0xe383('0x29')](_0x21288d['stack']);if(_0x21288d[_0xe383('0x2a')]){delete _0x21288d[_0xe383('0x2a')];}_0x3ce25f['status'](_0x4e8577)['send'](_0x21288d);};}exports[_0xe383('0x2b')]=function(_0x54c4f8,_0x15cbe3){var _0x4e520a={},_0x4c8d52={},_0x54d2d8={'count':0x0,'rows':[]};var _0x16ced4=_['map'](db['SugarcrmField'][_0xe383('0x2c')],function(_0x592a20){return{'name':_0x592a20[_0xe383('0x2d')],'type':_0x592a20[_0xe383('0x2e')][_0xe383('0x2f')]};});_0x4c8d52[_0xe383('0x30')]=_['map'](_0x16ced4,_0xe383('0x2a'));_0x4c8d52[_0xe383('0x31')]=_[_0xe383('0x32')](_0x54c4f8['query']);_0x4c8d52['filters']=_[_0xe383('0x33')](_0x4c8d52[_0xe383('0x30')],_0x4c8d52['query']);_0x4e520a[_0xe383('0x34')]=_[_0xe383('0x33')](_0x4c8d52[_0xe383('0x30')],qs[_0xe383('0x35')](_0x54c4f8[_0xe383('0x31')][_0xe383('0x35')]));_0x4e520a[_0xe383('0x34')]=_0x4e520a['attributes'][_0xe383('0x36')]?_0x4e520a['attributes']:_0x4c8d52[_0xe383('0x30')];if(!_0x54c4f8[_0xe383('0x31')][_0xe383('0x37')](_0xe383('0x38'))){_0x4e520a[_0xe383('0x20')]=qs[_0xe383('0x20')](_0x54c4f8[_0xe383('0x31')][_0xe383('0x20')]);_0x4e520a[_0xe383('0x1e')]=qs[_0xe383('0x1e')](_0x54c4f8['query'][_0xe383('0x1e')]);}_0x4e520a[_0xe383('0x39')]=qs[_0xe383('0x3a')](_0x54c4f8[_0xe383('0x31')][_0xe383('0x3a')]);_0x4e520a[_0xe383('0x3b')]=qs[_0xe383('0x3c')](_[_0xe383('0x3d')](_0x54c4f8[_0xe383('0x31')],_0x4c8d52[_0xe383('0x3c')]),_0x16ced4);if(_0x54c4f8[_0xe383('0x31')][_0xe383('0x3e')]){_0x4e520a['where']=_[_0xe383('0x3f')](_0x4e520a[_0xe383('0x3b')],{'$or':_[_0xe383('0x40')](_0x16ced4,function(_0xc2dbb2){if(_0xc2dbb2[_0xe383('0x2e')]!=='VIRTUAL'){var _0x5d0b27={};_0x5d0b27[_0xc2dbb2[_0xe383('0x2a')]]={'$like':'%'+_0x54c4f8[_0xe383('0x31')][_0xe383('0x3e')]+'%'};return _0x5d0b27;}})});}_0x4e520a=_[_0xe383('0x3f')]({},_0x4e520a,_0x54c4f8[_0xe383('0x41')]);var _0x39eac8={'where':_0x4e520a[_0xe383('0x3b')]};return db[_0xe383('0x42')]['count'](_0x39eac8)[_0xe383('0x26')](function(_0x5f5898){_0x54d2d8[_0xe383('0x21')]=_0x5f5898;if(_0x54c4f8[_0xe383('0x31')][_0xe383('0x43')]){_0x4e520a[_0xe383('0x44')]=[{'all':!![]}];}return db[_0xe383('0x42')][_0xe383('0x45')](_0x4e520a);})['then'](function(_0x5cd568){_0x54d2d8['rows']=_0x5cd568;return _0x54d2d8;})[_0xe383('0x26')](respondWithFilteredResult(_0x15cbe3,_0x4e520a))[_0xe383('0x46')](handleError(_0x15cbe3,null));};exports[_0xe383('0x47')]=function(_0x137484,_0x247814){var _0x5946ce={'raw':!![],'where':{'id':_0x137484[_0xe383('0x48')]['id']}},_0x1fee42={};_0x1fee42['model']=_[_0xe383('0x32')](db[_0xe383('0x42')][_0xe383('0x2c')]);_0x1fee42[_0xe383('0x31')]=_[_0xe383('0x32')](_0x137484[_0xe383('0x31')]);_0x1fee42[_0xe383('0x3c')]=_[_0xe383('0x33')](_0x1fee42['model'],_0x1fee42[_0xe383('0x31')]);_0x5946ce[_0xe383('0x34')]=_[_0xe383('0x33')](_0x1fee42['model'],qs['fields'](_0x137484[_0xe383('0x31')][_0xe383('0x35')]));_0x5946ce[_0xe383('0x34')]=_0x5946ce[_0xe383('0x34')][_0xe383('0x36')]?_0x5946ce[_0xe383('0x34')]:_0x1fee42[_0xe383('0x30')];if(_0x137484[_0xe383('0x31')][_0xe383('0x43')]){_0x5946ce['include']=[{'all':!![]}];}_0x5946ce=_[_0xe383('0x3f')]({},_0x5946ce,_0x137484[_0xe383('0x41')]);return db[_0xe383('0x42')][_0xe383('0x49')](_0x5946ce)[_0xe383('0x26')](handleEntityNotFound(_0x247814,null))[_0xe383('0x26')](respondWithResult(_0x247814,null))['catch'](handleError(_0x247814,null));};exports[_0xe383('0x4a')]=function(_0x36c7e7,_0x1c6765){return db[_0xe383('0x42')][_0xe383('0x4a')](_0x36c7e7[_0xe383('0x4b')],{})[_0xe383('0x26')](respondWithResult(_0x1c6765,0xc9))[_0xe383('0x46')](handleError(_0x1c6765,null));};exports['update']=function(_0xacaa9d,_0x50eafd){if(_0xacaa9d[_0xe383('0x4b')]['id']){delete _0xacaa9d[_0xe383('0x4b')]['id'];}return db[_0xe383('0x42')][_0xe383('0x49')]({'where':{'id':_0xacaa9d[_0xe383('0x48')]['id']}})[_0xe383('0x26')](handleEntityNotFound(_0x50eafd,null))[_0xe383('0x26')](saveUpdates(_0xacaa9d[_0xe383('0x4b')],null))['then'](respondWithResult(_0x50eafd,null))[_0xe383('0x46')](handleError(_0x50eafd,null));};exports[_0xe383('0x27')]=function(_0x3f84e7,_0xd24d5){return db[_0xe383('0x42')][_0xe383('0x49')]({'where':{'id':_0x3f84e7[_0xe383('0x48')]['id']}})[_0xe383('0x26')](handleEntityNotFound(_0xd24d5,null))[_0xe383('0x26')](removeEntity(_0xd24d5,null))[_0xe383('0x46')](handleError(_0xd24d5,null));}; \ No newline at end of file +var _0x56de=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','pick','merge','filter','options','where','include','SugarcrmField','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x56de,0xcc));var _0xe56d=function(_0x46f504,_0x47a51c){_0x46f504=_0x46f504-0x0;var _0x2b92dc=_0x56de[_0x46f504];return _0x2b92dc;};'use strict';var emlformat=require(_0xe56d('0x0'));var rimraf=require(_0xe56d('0x1'));var zipdir=require(_0xe56d('0x2'));var jsonpatch=require(_0xe56d('0x3'));var rp=require(_0xe56d('0x4'));var moment=require(_0xe56d('0x5'));var BPromise=require(_0xe56d('0x6'));var Mustache=require(_0xe56d('0x7'));var util=require('util');var path=require(_0xe56d('0x8'));var sox=require(_0xe56d('0x9'));var csv=require(_0xe56d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe56d('0xb'));var _=require(_0xe56d('0xc'));var squel=require(_0xe56d('0xd'));var crypto=require(_0xe56d('0xe'));var jsforce=require(_0xe56d('0xf'));var deskjs=require(_0xe56d('0x10'));var toCsv=require(_0xe56d('0xa'));var querystring=require(_0xe56d('0x11'));var Papa=require('papaparse');var Redis=require(_0xe56d('0x12'));var authService=require(_0xe56d('0x13'));var qs=require(_0xe56d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe56d('0x15'));var logger=require(_0xe56d('0x16'))(_0xe56d('0x17'));var utils=require('../../config/utils');var config=require(_0xe56d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe56d('0x19'))['db'];function respondWithStatusCode(_0x3473d8,_0x3c2f05){_0x3c2f05=_0x3c2f05||0xcc;return function(_0x49f6a2){if(_0x49f6a2){return _0x3473d8['sendStatus'](_0x3c2f05);}return _0x3473d8[_0xe56d('0x1a')](_0x3c2f05)[_0xe56d('0x1b')]();};}function respondWithResult(_0xbc1caf,_0x4fc302){_0x4fc302=_0x4fc302||0xc8;return function(_0x3d8d97){if(_0x3d8d97){return _0xbc1caf[_0xe56d('0x1a')](_0x4fc302)['json'](_0x3d8d97);}};}function respondWithFilteredResult(_0x53e8c7,_0x384fc1){return function(_0x4cad1d){if(_0x4cad1d){var _0x47ffb8=typeof _0x384fc1[_0xe56d('0x1c')]==='undefined'&&typeof _0x384fc1['limit']===_0xe56d('0x1d');var _0x49079a=_0x4cad1d[_0xe56d('0x1e')];var _0x138260=_0x47ffb8?0x0:_0x384fc1['offset'];var _0x3f126c=_0x47ffb8?_0x4cad1d['count']:_0x384fc1[_0xe56d('0x1c')]+_0x384fc1['limit'];var _0x50d7d1;if(_0x3f126c>=_0x49079a){_0x3f126c=_0x49079a;_0x50d7d1=0xc8;}else{_0x50d7d1=0xce;}_0x53e8c7[_0xe56d('0x1a')](_0x50d7d1);return _0x53e8c7[_0xe56d('0x1f')](_0xe56d('0x20'),_0x138260+'-'+_0x3f126c+'/'+_0x49079a)[_0xe56d('0x21')](_0x4cad1d);}return null;};}function patchUpdates(_0x520329){return function(_0xbbfd20){try{jsonpatch['apply'](_0xbbfd20,_0x520329,!![]);}catch(_0x3d4fa2){return BPromise[_0xe56d('0x22')](_0x3d4fa2);}return _0xbbfd20[_0xe56d('0x23')]();};}function saveUpdates(_0x215937,_0x4f8ac1){return function(_0x5d6d7b){if(_0x5d6d7b){return _0x5d6d7b[_0xe56d('0x24')](_0x215937)[_0xe56d('0x25')](function(_0x4f88b2){return _0x4f88b2;});}return null;};}function removeEntity(_0x2d3997,_0x3c7349){return function(_0x447c2b){if(_0x447c2b){return _0x447c2b[_0xe56d('0x26')]()[_0xe56d('0x25')](function(){_0x2d3997[_0xe56d('0x1a')](0xcc)[_0xe56d('0x1b')]();});}};}function handleEntityNotFound(_0x2eddd4,_0x41920a){return function(_0x8b9ce4){if(!_0x8b9ce4){_0x2eddd4['sendStatus'](0x194);}return _0x8b9ce4;};}function handleError(_0x238791,_0x50671f){_0x50671f=_0x50671f||0x1f4;return function(_0x5a307b){logger[_0xe56d('0x27')](_0x5a307b[_0xe56d('0x28')]);if(_0x5a307b[_0xe56d('0x29')]){delete _0x5a307b['name'];}_0x238791['status'](_0x50671f)['send'](_0x5a307b);};}exports[_0xe56d('0x2a')]=function(_0x4cbc77,_0x4bef33){var _0x32582c={},_0x2264e7={},_0x377181={'count':0x0,'rows':[]};var _0x38fd51=_[_0xe56d('0x2b')](db['SugarcrmField'][_0xe56d('0x2c')],function(_0x3f2d8f){return{'name':_0x3f2d8f[_0xe56d('0x2d')],'type':_0x3f2d8f[_0xe56d('0x2e')]['key']};});_0x2264e7[_0xe56d('0x2f')]=_['map'](_0x38fd51,'name');_0x2264e7[_0xe56d('0x30')]=_['keys'](_0x4cbc77[_0xe56d('0x30')]);_0x2264e7[_0xe56d('0x31')]=_[_0xe56d('0x32')](_0x2264e7[_0xe56d('0x2f')],_0x2264e7[_0xe56d('0x30')]);_0x32582c['attributes']=_[_0xe56d('0x32')](_0x2264e7[_0xe56d('0x2f')],qs[_0xe56d('0x33')](_0x4cbc77[_0xe56d('0x30')][_0xe56d('0x33')]));_0x32582c[_0xe56d('0x34')]=_0x32582c[_0xe56d('0x34')][_0xe56d('0x35')]?_0x32582c[_0xe56d('0x34')]:_0x2264e7[_0xe56d('0x2f')];if(!_0x4cbc77['query'][_0xe56d('0x36')](_0xe56d('0x37'))){_0x32582c[_0xe56d('0x38')]=qs[_0xe56d('0x38')](_0x4cbc77[_0xe56d('0x30')][_0xe56d('0x38')]);_0x32582c['offset']=qs[_0xe56d('0x1c')](_0x4cbc77['query'][_0xe56d('0x1c')]);}_0x32582c['order']=qs['sort'](_0x4cbc77['query']['sort']);_0x32582c['where']=qs[_0xe56d('0x31')](_[_0xe56d('0x39')](_0x4cbc77[_0xe56d('0x30')],_0x2264e7[_0xe56d('0x31')]),_0x38fd51);if(_0x4cbc77[_0xe56d('0x30')]['filter']){_0x32582c['where']=_[_0xe56d('0x3a')](_0x32582c['where'],{'$or':_[_0xe56d('0x2b')](_0x38fd51,function(_0x7bdd0d){if(_0x7bdd0d[_0xe56d('0x2e')]!=='VIRTUAL'){var _0x43b579={};_0x43b579[_0x7bdd0d['name']]={'$like':'%'+_0x4cbc77[_0xe56d('0x30')][_0xe56d('0x3b')]+'%'};return _0x43b579;}})});}_0x32582c=_['merge']({},_0x32582c,_0x4cbc77[_0xe56d('0x3c')]);var _0x37998b={'where':_0x32582c[_0xe56d('0x3d')]};return db['SugarcrmField'][_0xe56d('0x1e')](_0x37998b)['then'](function(_0xcf468c){_0x377181['count']=_0xcf468c;if(_0x4cbc77[_0xe56d('0x30')]['includeAll']){_0x32582c[_0xe56d('0x3e')]=[{'all':!![]}];}return db[_0xe56d('0x3f')][_0xe56d('0x40')](_0x32582c);})[_0xe56d('0x25')](function(_0x2d8357){_0x377181[_0xe56d('0x41')]=_0x2d8357;return _0x377181;})[_0xe56d('0x25')](respondWithFilteredResult(_0x4bef33,_0x32582c))[_0xe56d('0x42')](handleError(_0x4bef33,null));};exports[_0xe56d('0x43')]=function(_0x21e072,_0x261656){var _0x261d48={'raw':!![],'where':{'id':_0x21e072[_0xe56d('0x44')]['id']}},_0x26cf8a={};_0x26cf8a['model']=_[_0xe56d('0x45')](db['SugarcrmField'][_0xe56d('0x2c')]);_0x26cf8a[_0xe56d('0x30')]=_[_0xe56d('0x45')](_0x21e072['query']);_0x26cf8a[_0xe56d('0x31')]=_[_0xe56d('0x32')](_0x26cf8a[_0xe56d('0x2f')],_0x26cf8a['query']);_0x261d48['attributes']=_[_0xe56d('0x32')](_0x26cf8a[_0xe56d('0x2f')],qs['fields'](_0x21e072[_0xe56d('0x30')][_0xe56d('0x33')]));_0x261d48[_0xe56d('0x34')]=_0x261d48[_0xe56d('0x34')]['length']?_0x261d48[_0xe56d('0x34')]:_0x26cf8a[_0xe56d('0x2f')];if(_0x21e072['query'][_0xe56d('0x46')]){_0x261d48[_0xe56d('0x3e')]=[{'all':!![]}];}_0x261d48=_['merge']({},_0x261d48,_0x21e072[_0xe56d('0x3c')]);return db[_0xe56d('0x3f')][_0xe56d('0x47')](_0x261d48)[_0xe56d('0x25')](handleEntityNotFound(_0x261656,null))[_0xe56d('0x25')](respondWithResult(_0x261656,null))[_0xe56d('0x42')](handleError(_0x261656,null));};exports['create']=function(_0x53ddf3,_0x4f0ac3){return db['SugarcrmField'][_0xe56d('0x48')](_0x53ddf3['body'],{})[_0xe56d('0x25')](respondWithResult(_0x4f0ac3,0xc9))[_0xe56d('0x42')](handleError(_0x4f0ac3,null));};exports[_0xe56d('0x24')]=function(_0x2e8aea,_0x4036fa){if(_0x2e8aea['body']['id']){delete _0x2e8aea[_0xe56d('0x49')]['id'];}return db[_0xe56d('0x3f')]['find']({'where':{'id':_0x2e8aea[_0xe56d('0x44')]['id']}})[_0xe56d('0x25')](handleEntityNotFound(_0x4036fa,null))[_0xe56d('0x25')](saveUpdates(_0x2e8aea[_0xe56d('0x49')],null))['then'](respondWithResult(_0x4036fa,null))[_0xe56d('0x42')](handleError(_0x4036fa,null));};exports[_0xe56d('0x26')]=function(_0x27cfe6,_0xf447d3){return db[_0xe56d('0x3f')][_0xe56d('0x47')]({'where':{'id':_0x27cfe6[_0xe56d('0x44')]['id']}})[_0xe56d('0x25')](handleEntityNotFound(_0xf447d3,null))[_0xe56d('0x25')](removeEntity(_0xf447d3,null))['catch'](handleError(_0xf447d3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d567b0b..bcccc78 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 _0x4db7=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId'];(function(_0x51b64e,_0x3b64f4){var _0x49c950=function(_0xd0f798){while(--_0xd0f798){_0x51b64e['push'](_0x51b64e['shift']());}};_0x49c950(++_0x3b64f4);}(_0x4db7,0x126));var _0x74db=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4db7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x74db('0x0'));var logger=require(_0x74db('0x1'))(_0x74db('0x2'));var moment=require(_0x74db('0x3'));var BPromise=require('bluebird');var rp=require(_0x74db('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74db('0x5'));var config=require(_0x74db('0x6'));var attributes=require(_0x74db('0x7'));module[_0x74db('0x8')]=function(_0xc0eb71,_0x51beea){return _0xc0eb71[_0x74db('0x9')](_0x74db('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x74db('0xb'),'fields':[_0x74db('0xc'),_0x74db('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51e2=['SugarcrmField','sugarcrm_unique_index','idField','lodash','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2b32ca,_0x35fb03){var _0x169a94=function(_0x4ef5a4){while(--_0x4ef5a4){_0x2b32ca['push'](_0x2b32ca['shift']());}};_0x169a94(++_0x35fb03);}(_0x51e2,0x19a));var _0x251e=function(_0x1b2938,_0x181306){_0x1b2938=_0x1b2938-0x0;var _0x5a112e=_0x51e2[_0x1b2938];return _0x5a112e;};'use strict';var _=require(_0x251e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x251e('0x1'));var BPromise=require(_0x251e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x251e('0x3'));var rimraf=require(_0x251e('0x4'));var config=require(_0x251e('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x251e('0x6')]=function(_0x3abaff,_0x4d5d24){return _0x3abaff[_0x251e('0x7')](_0x251e('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x251e('0x9'),'fields':[_0x251e('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 6bbd7aa..2b19154 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 _0xf3ce=['error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','request','then','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4ad922,_0x1538f6){var _0x3c0eef=function(_0x18d749){while(--_0x18d749){_0x4ad922['push'](_0x4ad922['shift']());}};_0x3c0eef(++_0x1538f6);}(_0xf3ce,0x141));var _0xef3c=function(_0x22f345,_0x27fa78){_0x22f345=_0x22f345-0x0;var _0x15290c=_0xf3ce[_0x22f345];return _0x15290c;};'use strict';var _=require(_0xef3c('0x0'));var util=require(_0xef3c('0x1'));var moment=require(_0xef3c('0x2'));var BPromise=require(_0xef3c('0x3'));var rs=require(_0xef3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef3c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xef3c('0x7'));var client=jayson[_0xef3c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a88df,_0x2c93f8,_0x2c6b7f){return new BPromise(function(_0x1a53c9,_0x545842){return client[_0xef3c('0x9')](_0x2a88df,_0x2c6b7f)[_0xef3c('0xa')](function(_0x40e632){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2c93f8,'request\x20sent');logger[_0xef3c('0xb')](_0xef3c('0xc'),_0x2c93f8,_0xef3c('0xd'),JSON[_0xef3c('0xe')](_0x40e632));if(_0x40e632[_0xef3c('0xf')]){if(_0x40e632[_0xef3c('0xf')][_0xef3c('0x10')]===0x1f4){logger['error'](_0xef3c('0x11'),_0x2c93f8,_0x40e632['error'][_0xef3c('0x12')]);return _0x545842(_0x40e632['error']['message']);}logger['error'](_0xef3c('0x11'),_0x2c93f8,_0x40e632[_0xef3c('0xf')][_0xef3c('0x12')]);return _0x1a53c9(_0x40e632[_0xef3c('0xf')][_0xef3c('0x12')]);}else{logger['info'](_0xef3c('0x11'),_0x2c93f8,'request\x20sent');_0x1a53c9(_0x40e632[_0xef3c('0x13')][_0xef3c('0x12')]);}})[_0xef3c('0x14')](function(_0x46c5cc){logger[_0xef3c('0xf')](_0xef3c('0x11'),_0x2c93f8,_0x46c5cc);_0x545842(_0x46c5cc);});});} \ No newline at end of file +var _0x9cf7=['info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x9cf7,0xdf));var _0x79cf=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x9cf7[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0x79cf('0x0'));var moment=require('moment');var BPromise=require(_0x79cf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79cf('0x2'));var db=require(_0x79cf('0x3'))['db'];var utils=require(_0x79cf('0x4'));var logger=require(_0x79cf('0x5'))(_0x79cf('0x6'));var config=require('../../config/environment');var jayson=require(_0x79cf('0x7'));var client=jayson[_0x79cf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd18efd,_0x5ccf32,_0x277b97){return new BPromise(function(_0x5ebec8,_0xb5a017){return client['request'](_0xd18efd,_0x277b97)[_0x79cf('0x9')](function(_0x2fbaf2){logger['info'](_0x79cf('0xa'),_0x5ccf32,_0x79cf('0xb'));logger[_0x79cf('0xc')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5ccf32,'request\x20sent',JSON[_0x79cf('0xd')](_0x2fbaf2));if(_0x2fbaf2[_0x79cf('0xe')]){if(_0x2fbaf2[_0x79cf('0xe')][_0x79cf('0xf')]===0x1f4){logger[_0x79cf('0xe')](_0x79cf('0xa'),_0x5ccf32,_0x2fbaf2['error'][_0x79cf('0x10')]);return _0xb5a017(_0x2fbaf2[_0x79cf('0xe')][_0x79cf('0x10')]);}logger[_0x79cf('0xe')](_0x79cf('0xa'),_0x5ccf32,_0x2fbaf2[_0x79cf('0xe')][_0x79cf('0x10')]);return _0x5ebec8(_0x2fbaf2[_0x79cf('0xe')][_0x79cf('0x10')]);}else{logger[_0x79cf('0x11')](_0x79cf('0xa'),_0x5ccf32,_0x79cf('0xb'));_0x5ebec8(_0x2fbaf2[_0x79cf('0x12')][_0x79cf('0x10')]);}})[_0x79cf('0x13')](function(_0x520e7f){logger[_0x79cf('0xe')](_0x79cf('0xa'),_0x5ccf32,_0x520e7f);_0xb5a017(_0x520e7f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7718358..69d4ef3 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 _0x8781=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','destroy'];(function(_0x50726c,_0x4fdec4){var _0x325e0c=function(_0x4ef3cb){while(--_0x4ef3cb){_0x50726c['push'](_0x50726c['shift']());}};_0x325e0c(++_0x4fdec4);}(_0x8781,0x1c8));var _0x1878=function(_0x452089,_0x2eaebb){_0x452089=_0x452089-0x0;var _0x15d5c8=_0x8781[_0x452089];return _0x15d5c8;};'use strict';var multer=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var path=require(_0x1878('0x2'));var timeout=require(_0x1878('0x3'));var express=require(_0x1878('0x4'));var router=express[_0x1878('0x5')]();var fs_extra=require(_0x1878('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1878('0x7'));var config=require(_0x1878('0x8'));var controller=require(_0x1878('0x9'));router[_0x1878('0xa')]('/',auth[_0x1878('0xb')](),controller[_0x1878('0xc')]);router['get'](_0x1878('0xd'),auth[_0x1878('0xb')](),controller[_0x1878('0xe')]);router[_0x1878('0xa')](_0x1878('0xf'),auth[_0x1878('0xb')](),controller[_0x1878('0x10')]);router[_0x1878('0xa')](_0x1878('0x11'),auth[_0x1878('0xb')](),controller[_0x1878('0x12')]);router['post']('/',auth[_0x1878('0xb')](),controller[_0x1878('0x13')]);router[_0x1878('0x14')](_0x1878('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1878('0x15')](_0x1878('0xd'),auth[_0x1878('0xb')](),controller[_0x1878('0x16')]);router['delete']('/:id',auth[_0x1878('0xb')](),controller[_0x1878('0x17')]);module['exports']=router; \ No newline at end of file +var _0x135c=['getConfigurations','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x58e867,_0x48f5e2){var _0x3b25ee=function(_0x49dba5){while(--_0x49dba5){_0x58e867['push'](_0x58e867['shift']());}};_0x3b25ee(++_0x48f5e2);}(_0x135c,0xda));var _0xc135=function(_0x11754e,_0x1fe2f4){_0x11754e=_0x11754e-0x0;var _0x45b1b2=_0x135c[_0x11754e];return _0x45b1b2;};'use strict';var multer=require(_0xc135('0x0'));var util=require(_0xc135('0x1'));var path=require('path');var timeout=require(_0xc135('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc135('0x3'));var auth=require(_0xc135('0x4'));var interaction=require(_0xc135('0x5'));var config=require('../../config/environment');var controller=require(_0xc135('0x6'));router[_0xc135('0x7')]('/',auth[_0xc135('0x8')](),controller[_0xc135('0x9')]);router[_0xc135('0x7')](_0xc135('0xa'),auth[_0xc135('0x8')](),controller[_0xc135('0xb')]);router[_0xc135('0x7')](_0xc135('0xc'),auth['isAuthenticated'](),controller[_0xc135('0xd')]);router[_0xc135('0x7')]('/:id/fields',auth[_0xc135('0x8')](),controller[_0xc135('0xe')]);router[_0xc135('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc135('0xc'),auth[_0xc135('0x8')](),controller[_0xc135('0x10')]);router['put'](_0xc135('0xa'),auth['isAuthenticated'](),controller[_0xc135('0x11')]);router[_0xc135('0x12')](_0xc135('0xa'),auth[_0xc135('0x8')](),controller[_0xc135('0x13')]);module[_0xc135('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 763e8bc..e5473ad 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 _0x92bb=['sequelize','STRING'];(function(_0x412c6e,_0x10a690){var _0x2f9d5f=function(_0x15b807){while(--_0x15b807){_0x412c6e['push'](_0x412c6e['shift']());}};_0x2f9d5f(++_0x10a690);}(_0x92bb,0x1e4));var _0xb92b=function(_0x256684,_0x529c1e){_0x256684=_0x256684-0x0;var _0x37a0c9=_0x92bb[_0x256684];return _0x37a0c9;};'use strict';var Sequelize=require(_0xb92b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb92b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb92b('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7789=['STRING','HelpDesk','sequelize'];(function(_0x28cc9d,_0x18c1a8){var _0x2d746e=function(_0x3ee69b){while(--_0x3ee69b){_0x28cc9d['push'](_0x28cc9d['shift']());}};_0x2d746e(++_0x18c1a8);}(_0x7789,0xdd));var _0x9778=function(_0xe0b0b0,_0x42c647){_0xe0b0b0=_0xe0b0b0-0x0;var _0x2f0dc2=_0x7789[_0xe0b0b0];return _0x2f0dc2;};'use strict';var Sequelize=require(_0x9778('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9778('0x1')]},'username':{'type':Sequelize[_0x9778('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9778('0x1')],'allowNull':![],'defaultValue':_0x9778('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9778('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e7fc5b1..fb18366 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 _0xaf33=['create','body','find','params','getConfigurations','findOne','VtigerConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','result','describe','sessionName','owner','remove','editable','false','label','cf_','picklist','picklistValues','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0xaf33,0x113));var _0x3af3=function(_0x170cbb,_0x9093e){_0x170cbb=_0x170cbb-0x0;var _0x39fae4=_0xaf33[_0x170cbb];return _0x39fae4;};'use strict';var emlformat=require(_0x3af3('0x0'));var rimraf=require(_0x3af3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3af3('0x2'));var rp=require(_0x3af3('0x3'));var moment=require(_0x3af3('0x4'));var BPromise=require(_0x3af3('0x5'));var Mustache=require(_0x3af3('0x6'));var util=require(_0x3af3('0x7'));var path=require(_0x3af3('0x8'));var sox=require('sox');var csv=require(_0x3af3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3af3('0xa'));var _=require(_0x3af3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3af3('0xc'));var deskjs=require(_0x3af3('0xd'));var toCsv=require(_0x3af3('0x9'));var querystring=require(_0x3af3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3af3('0xf'));var as=require(_0x3af3('0x10'));var hardwareService=require(_0x3af3('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3af3('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3af3('0x13'));var db=require(_0x3af3('0x14'))['db'];var integrations=require(_0x3af3('0x15'));function respondWithStatusCode(_0x263071,_0x7a3de5){_0x7a3de5=_0x7a3de5||0xcc;return function(_0x57b8c7){if(_0x57b8c7){return _0x263071['sendStatus'](_0x7a3de5);}return _0x263071[_0x3af3('0x16')](_0x7a3de5)[_0x3af3('0x17')]();};}function respondWithResult(_0x16ee5d,_0x37af07){_0x37af07=_0x37af07||0xc8;return function(_0x4cd37f){if(_0x4cd37f){return _0x16ee5d['status'](_0x37af07)[_0x3af3('0x18')](_0x4cd37f);}};}function respondWithFilteredResult(_0x5c0df0,_0x3b3bc7){return function(_0xa9e848){if(_0xa9e848){var _0x3f3e0f=typeof _0x3b3bc7[_0x3af3('0x19')]===_0x3af3('0x1a')&&typeof _0x3b3bc7[_0x3af3('0x1b')]===_0x3af3('0x1a');var _0x1dd6b2=_0xa9e848[_0x3af3('0x1c')];var _0x4d31f4=_0x3f3e0f?0x0:_0x3b3bc7[_0x3af3('0x19')];var _0x55528a=_0x3f3e0f?_0xa9e848[_0x3af3('0x1c')]:_0x3b3bc7[_0x3af3('0x19')]+_0x3b3bc7[_0x3af3('0x1b')];var _0x5995fd;if(_0x55528a>=_0x1dd6b2){_0x55528a=_0x1dd6b2;_0x5995fd=0xc8;}else{_0x5995fd=0xce;}_0x5c0df0[_0x3af3('0x16')](_0x5995fd);return _0x5c0df0[_0x3af3('0x1d')](_0x3af3('0x1e'),_0x4d31f4+'-'+_0x55528a+'/'+_0x1dd6b2)[_0x3af3('0x18')](_0xa9e848);}return null;};}function patchUpdates(_0x17d804){return function(_0x4ad4c6){try{jsonpatch[_0x3af3('0x1f')](_0x4ad4c6,_0x17d804,!![]);}catch(_0x2805fe){return BPromise[_0x3af3('0x20')](_0x2805fe);}return _0x4ad4c6[_0x3af3('0x21')]();};}function saveUpdates(_0x4bd2b7,_0x5d4091){return function(_0x47087f){if(_0x47087f){return _0x47087f[_0x3af3('0x22')](_0x4bd2b7)[_0x3af3('0x23')](function(_0x4d280a){return _0x4d280a;});}return null;};}function removeEntity(_0x543f59,_0x1ce4b8){return function(_0x894c37){if(_0x894c37){return _0x894c37[_0x3af3('0x24')]()[_0x3af3('0x23')](function(){_0x543f59[_0x3af3('0x16')](0xcc)[_0x3af3('0x17')]();});}};}function handleEntityNotFound(_0x5e8165,_0x1fe2ed){return function(_0x428906){if(!_0x428906){_0x5e8165[_0x3af3('0x25')](0x194);}return _0x428906;};}function handleError(_0x179c99,_0x2cbacf){_0x2cbacf=_0x2cbacf||0x1f4;return function(_0x197bdb){logger[_0x3af3('0x26')](_0x197bdb[_0x3af3('0x27')]);if(_0x197bdb['name']){delete _0x197bdb['name'];}_0x179c99[_0x3af3('0x16')](_0x2cbacf)[_0x3af3('0x28')](_0x197bdb);};}exports[_0x3af3('0x29')]=function(_0x4e3ac2,_0x39eb6d){var _0x33ab5b={},_0x1b12e7={},_0x554012={'count':0x0,'rows':[]};var _0x396c43=_[_0x3af3('0x2a')](db[_0x3af3('0x2b')][_0x3af3('0x2c')],function(_0x561ec8){return{'name':_0x561ec8[_0x3af3('0x2d')],'type':_0x561ec8[_0x3af3('0x2e')][_0x3af3('0x2f')]};});_0x1b12e7[_0x3af3('0x30')]=_[_0x3af3('0x2a')](_0x396c43,_0x3af3('0x31'));_0x1b12e7['query']=_[_0x3af3('0x32')](_0x4e3ac2['query']);_0x1b12e7[_0x3af3('0x33')]=_[_0x3af3('0x34')](_0x1b12e7[_0x3af3('0x30')],_0x1b12e7[_0x3af3('0x35')]);_0x33ab5b[_0x3af3('0x36')]=_[_0x3af3('0x34')](_0x1b12e7[_0x3af3('0x30')],qs[_0x3af3('0x37')](_0x4e3ac2[_0x3af3('0x35')][_0x3af3('0x37')]));_0x33ab5b['attributes']=_0x33ab5b[_0x3af3('0x36')][_0x3af3('0x38')]?_0x33ab5b['attributes']:_0x1b12e7[_0x3af3('0x30')];if(!_0x4e3ac2[_0x3af3('0x35')]['hasOwnProperty'](_0x3af3('0x39'))){_0x33ab5b[_0x3af3('0x1b')]=qs[_0x3af3('0x1b')](_0x4e3ac2['query'][_0x3af3('0x1b')]);_0x33ab5b[_0x3af3('0x19')]=qs[_0x3af3('0x19')](_0x4e3ac2[_0x3af3('0x35')][_0x3af3('0x19')]);}_0x33ab5b[_0x3af3('0x3a')]=qs[_0x3af3('0x3b')](_0x4e3ac2['query'][_0x3af3('0x3b')]);_0x33ab5b[_0x3af3('0x3c')]=qs[_0x3af3('0x33')](_['pick'](_0x4e3ac2[_0x3af3('0x35')],_0x1b12e7[_0x3af3('0x33')]),_0x396c43);if(_0x4e3ac2['query'][_0x3af3('0x3d')]){_0x33ab5b[_0x3af3('0x3c')]=_[_0x3af3('0x3e')](_0x33ab5b[_0x3af3('0x3c')],{'$or':_[_0x3af3('0x2a')](_0x396c43,function(_0x68568){if(_0x68568[_0x3af3('0x2e')]!==_0x3af3('0x3f')){var _0x3deb4c={};_0x3deb4c[_0x68568['name']]={'$like':'%'+_0x4e3ac2[_0x3af3('0x35')]['filter']+'%'};return _0x3deb4c;}})});}_0x33ab5b=_[_0x3af3('0x3e')]({},_0x33ab5b,_0x4e3ac2[_0x3af3('0x40')]);var _0x549e8b={'where':_0x33ab5b[_0x3af3('0x3c')]};return db[_0x3af3('0x2b')][_0x3af3('0x1c')](_0x549e8b)[_0x3af3('0x23')](function(_0x210680){_0x554012[_0x3af3('0x1c')]=_0x210680;if(_0x4e3ac2['query'][_0x3af3('0x41')]){_0x33ab5b[_0x3af3('0x42')]=[{'all':!![]}];}return db['VtigerAccount'][_0x3af3('0x43')](_0x33ab5b);})[_0x3af3('0x23')](function(_0x2c7ba4){_0x554012[_0x3af3('0x44')]=_0x2c7ba4;return _0x554012;})['then'](respondWithFilteredResult(_0x39eb6d,_0x33ab5b))[_0x3af3('0x45')](handleError(_0x39eb6d,null));};exports['show']=function(_0x28b10d,_0x1b5f6a){var _0x1038c1={'raw':![],'where':{'id':_0x28b10d['params']['id']}},_0x5e0bbe={};_0x5e0bbe[_0x3af3('0x30')]=_[_0x3af3('0x32')](db[_0x3af3('0x2b')][_0x3af3('0x2c')]);_0x5e0bbe[_0x3af3('0x35')]=_[_0x3af3('0x32')](_0x28b10d[_0x3af3('0x35')]);_0x5e0bbe['filters']=_[_0x3af3('0x34')](_0x5e0bbe[_0x3af3('0x30')],_0x5e0bbe[_0x3af3('0x35')]);_0x1038c1['attributes']=_[_0x3af3('0x34')](_0x5e0bbe['model'],qs[_0x3af3('0x37')](_0x28b10d[_0x3af3('0x35')]['fields']));_0x1038c1[_0x3af3('0x36')]=_0x1038c1['attributes'][_0x3af3('0x38')]?_0x1038c1[_0x3af3('0x36')]:_0x5e0bbe[_0x3af3('0x30')];if(_0x28b10d[_0x3af3('0x35')][_0x3af3('0x41')]){_0x1038c1[_0x3af3('0x42')]=[{'all':!![]}];}_0x1038c1=_[_0x3af3('0x3e')]({},_0x1038c1,_0x28b10d[_0x3af3('0x40')]);return db[_0x3af3('0x2b')]['find'](_0x1038c1)[_0x3af3('0x23')](handleEntityNotFound(_0x1b5f6a,null))['then'](respondWithResult(_0x1b5f6a,null))[_0x3af3('0x45')](handleError(_0x1b5f6a,null));};exports[_0x3af3('0x46')]=function(_0x3bd530,_0x267ec6){return db[_0x3af3('0x2b')]['create'](_0x3bd530['body'],{})[_0x3af3('0x23')](respondWithResult(_0x267ec6,0xc9))['catch'](handleError(_0x267ec6,null));};exports['update']=function(_0x1ad8c5,_0x2b517a){if(_0x1ad8c5['body']['id']){delete _0x1ad8c5[_0x3af3('0x47')]['id'];}return db['VtigerAccount'][_0x3af3('0x48')]({'where':{'id':_0x1ad8c5['params']['id']}})['then'](handleEntityNotFound(_0x2b517a,null))[_0x3af3('0x23')](saveUpdates(_0x1ad8c5['body'],null))['then'](respondWithResult(_0x2b517a,null))[_0x3af3('0x45')](handleError(_0x2b517a,null));};exports['destroy']=function(_0x13ede9,_0x354d14){return db[_0x3af3('0x2b')][_0x3af3('0x48')]({'where':{'id':_0x13ede9[_0x3af3('0x49')]['id']}})[_0x3af3('0x23')](handleEntityNotFound(_0x354d14,null))['then'](removeEntity(_0x354d14,null))[_0x3af3('0x45')](handleError(_0x354d14,null));};exports[_0x3af3('0x4a')]=function(_0x2cc665,_0x2203b4,_0x330286){var _0x42af2c={};var _0x47e85c={};var _0x26b23e;var _0x4ad53a;return db['VtigerAccount'][_0x3af3('0x4b')]({'where':{'id':_0x2cc665['params']['id']}})[_0x3af3('0x23')](handleEntityNotFound(_0x2203b4,null))[_0x3af3('0x23')](function(_0x12bd7c){if(_0x12bd7c){_0x26b23e=_0x12bd7c;_0x47e85c['model']=_['keys'](db[_0x3af3('0x4c')][_0x3af3('0x2c')]);_0x47e85c[_0x3af3('0x35')]=_[_0x3af3('0x32')](_0x2cc665[_0x3af3('0x35')]);_0x47e85c['filters']=_[_0x3af3('0x34')](_0x47e85c['model'],_0x47e85c[_0x3af3('0x35')]);_0x42af2c[_0x3af3('0x36')]=_[_0x3af3('0x34')](_0x47e85c[_0x3af3('0x30')],qs['fields'](_0x2cc665[_0x3af3('0x35')]['fields']));_0x42af2c[_0x3af3('0x36')]=_0x42af2c[_0x3af3('0x36')][_0x3af3('0x38')]?_0x42af2c['attributes']:_0x47e85c[_0x3af3('0x30')];_0x42af2c[_0x3af3('0x3a')]=qs[_0x3af3('0x3b')](_0x2cc665['query']['sort']);_0x42af2c['where']=qs['filters'](_[_0x3af3('0x4d')](_0x2cc665[_0x3af3('0x35')],_0x47e85c[_0x3af3('0x33')]));if(_0x2cc665[_0x3af3('0x35')]['filter']){_0x42af2c[_0x3af3('0x3c')]=_['merge'](_0x42af2c[_0x3af3('0x3c')],{'$or':_[_0x3af3('0x2a')](_0x42af2c[_0x3af3('0x36')],function(_0x30cd50){var _0x236a69={};_0x236a69[_0x30cd50]={'$like':'%'+_0x2cc665['query'][_0x3af3('0x3d')]+'%'};return _0x236a69;})});}_0x42af2c=_[_0x3af3('0x3e')]({},_0x42af2c,_0x2cc665['options']);return _0x26b23e['getConfigurations'](_0x42af2c);}})[_0x3af3('0x23')](function(_0x14b6aa){if(_0x14b6aa){_0x4ad53a=_0x14b6aa[_0x3af3('0x38')];if(!_0x2cc665[_0x3af3('0x35')][_0x3af3('0x4e')](_0x3af3('0x39'))){_0x42af2c[_0x3af3('0x1b')]=qs[_0x3af3('0x1b')](_0x2cc665[_0x3af3('0x35')][_0x3af3('0x1b')]);_0x42af2c[_0x3af3('0x19')]=qs[_0x3af3('0x19')](_0x2cc665[_0x3af3('0x35')][_0x3af3('0x19')]);}return _0x26b23e[_0x3af3('0x4a')](_0x42af2c);}})[_0x3af3('0x23')](function(_0x47e7cf){if(_0x47e7cf){return _0x47e7cf?{'count':_0x4ad53a,'rows':_0x47e7cf}:null;}})['then'](respondWithResult(_0x2203b4,null))[_0x3af3('0x45')](handleError(_0x2203b4,null));};exports[_0x3af3('0x4f')]=function(_0x42eb6b,_0x39757c,_0x422a8b){if(_0x42eb6b[_0x3af3('0x47')]['id']){delete _0x42eb6b[_0x3af3('0x47')]['id'];}return db[_0x3af3('0x2b')][_0x3af3('0x4b')]({'where':{'id':_0x42eb6b['params']['id']}})[_0x3af3('0x23')](handleEntityNotFound(_0x39757c,null))[_0x3af3('0x23')](function(_0x5bdd19){if(_0x5bdd19){_0x42eb6b['body']['AccountId']=_0x5bdd19['id'];_0x42eb6b[_0x3af3('0x47')][_0x3af3('0x50')]=integrations[_0x3af3('0x51')](_0x42eb6b[_0x3af3('0x47')][_0x3af3('0x52')],_0x42eb6b[_0x3af3('0x47')]['type']);_0x42eb6b[_0x3af3('0x47')][_0x3af3('0x53')]=integrations['getDescriptions'](_0x42eb6b[_0x3af3('0x47')][_0x3af3('0x52')],_0x42eb6b[_0x3af3('0x47')][_0x3af3('0x2e')]);return db['VtigerConfiguration'][_0x3af3('0x46')](_0x42eb6b[_0x3af3('0x47')],{'include':[{'model':db[_0x3af3('0x54')],'as':_0x3af3('0x50')},{'model':db['VtigerField'],'as':_0x3af3('0x53')}]});}return null;})[_0x3af3('0x23')](respondWithResult(_0x39757c,null))[_0x3af3('0x45')](handleError(_0x39757c,null));};var md5=require(_0x3af3('0x55'));exports[_0x3af3('0x56')]=function(_0x575fa7,_0xc11272,_0x81bced){var _0x2e2b06=null;var _0x807f3d=null;var _0x2dc8f5=null;var _0x27ece6=null;var _0x169e27='';return db['VtigerAccount'][_0x3af3('0x4b')]({'where':{'id':_0x575fa7[_0x3af3('0x49')]['id']},'attributes':['id',_0x3af3('0x31'),'username',_0x3af3('0x57'),_0x3af3('0x58'),_0x3af3('0x59'),'serverUrl','accessKey']})['then'](handleEntityNotFound(_0xc11272,null))['then'](function(_0x41e17b){if(_0x41e17b){_0x2e2b06=_0x41e17b[_0x3af3('0x5a')];_0x807f3d=_0x41e17b['accessKey'];_0x2dc8f5=_0x41e17b[_0x3af3('0x58')];_0x169e27=_0x41e17b['remoteUri'];var _0x304433=_0x169e27[_0x3af3('0x5b')](-0x1);if(_0x304433==='/'){_0x169e27=_0x169e27[_0x3af3('0x5c')](0x0,_0x169e27[_0x3af3('0x5d')](_0x304433));}_0x27ece6=util[_0x3af3('0x5e')](_0x3af3('0x5f'),_0x169e27);var _0x21b8fa={'method':_0x3af3('0x60'),'uri':_0x27ece6,'qs':{'operation':_0x3af3('0x61'),'username':_0x41e17b['username']},'json':!![]};return rp(_0x21b8fa);}})[_0x3af3('0x23')](function(_0x2c6d30){if(_0x2c6d30[_0x3af3('0x62')]){var _0xc079c9={'method':'POST','uri':_0x27ece6,'form':{'operation':_0x3af3('0x63'),'username':_0x2e2b06,'accessKey':md5(_0x2c6d30[_0x3af3('0x64')]['token']+_0x807f3d)},'json':!![]};return rp(_0xc079c9);}})[_0x3af3('0x23')](function(_0xdf7be3){if(_0xdf7be3[_0x3af3('0x62')]){var _0x2f00d3={'method':_0x3af3('0x60'),'uri':_0x27ece6,'qs':{'operation':_0x3af3('0x65'),'username':_0x2e2b06,'sessionName':_0xdf7be3['result'][_0x3af3('0x66')],'elementType':_0x2dc8f5},'json':!![]};return rp(_0x2f00d3);}})['then'](function(_0x259d15){if(_0x259d15['success']){var _0x2360e3=['autogenerated','reference',_0x3af3('0x67')];_[_0x3af3('0x68')](_0x259d15['result']['fields'],function(_0x1be20e){return _0x2360e3['includes'](_0x1be20e[_0x3af3('0x2e')]['name']);});_[_0x3af3('0x68')](_0x259d15[_0x3af3('0x64')]['fields'],function(_0x5d1b98){return _0x5d1b98[_0x3af3('0x69')]===_0x3af3('0x6a');});return{'count':_0x259d15[_0x3af3('0x64')][_0x3af3('0x37')]['length'],'rows':_[_0x3af3('0x2a')](_0x259d15[_0x3af3('0x64')]['fields'],function(_0x438bf3){return{'id':_0x438bf3['name'],'name':_0x438bf3[_0x3af3('0x6b')],'custom':_['startsWith'](_0x438bf3[_0x3af3('0x31')],_0x3af3('0x6c'))?!![]:![],'options':_0x438bf3[_0x3af3('0x2e')][_0x3af3('0x31')]===_0x3af3('0x6d')&&_0x438bf3[_0x3af3('0x2e')][_0x3af3('0x6e')][_0x3af3('0x38')]>0x0?_[_0x3af3('0x2a')](_0x438bf3[_0x3af3('0x2e')][_0x3af3('0x6e')],function(_0x1bea06){return{'name':_0x1bea06['label'],'value':_0x1bea06['value']};}):[]};})};}})[_0x3af3('0x23')](respondWithResult(_0xc11272,null))[_0x3af3('0x45')](function(_0x550f65){console['log']('vTiger\x20error:\x20'+_0x550f65);var _0x42b6f5=_0x575fa7[_0x3af3('0x35')][_0x3af3('0x6f')]?0x1f4:_0x550f65[_0x3af3('0x70')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3af3('0x56'),_0x42b6f5,JSON[_0x3af3('0x71')](_0x550f65));delete _0x550f65[_0x3af3('0x31')];if(_0x42b6f5===0x191){_0x42b6f5=0x190;}_0xc11272[_0x3af3('0x16')](_0x42b6f5)['send'](_0x575fa7[_0x3af3('0x35')][_0x3af3('0x6f')]?{'message':_0x3af3('0x72'),'statusCode':_0x550f65['statusCode']}:_0x550f65);});}; \ No newline at end of file +var _0xd572=['sendStatus','status','end','undefined','count','offset','limit','reject','save','update','then','error','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','username','substring','format','GET','getchallenge','POST','login','result','success','describe','sessionName','autogenerated','reference','includes','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x9bd13b,_0x3b6743){var _0x41c5fb=function(_0x3bdcfa){while(--_0x3bdcfa){_0x9bd13b['push'](_0x9bd13b['shift']());}};_0x41c5fb(++_0x3b6743);}(_0xd572,0x14f));var _0x2d57=function(_0x1506f2,_0x22dd8a){_0x1506f2=_0x1506f2-0x0;var _0x59846d=_0xd572[_0x1506f2];return _0x59846d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d57('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d57('0x1'));var rp=require(_0x2d57('0x2'));var moment=require('moment');var BPromise=require(_0x2d57('0x3'));var Mustache=require(_0x2d57('0x4'));var util=require(_0x2d57('0x5'));var path=require('path');var sox=require(_0x2d57('0x6'));var csv=require(_0x2d57('0x7'));var ejs=require(_0x2d57('0x8'));var fs=require('fs');var fs_extra=require(_0x2d57('0x9'));var _=require(_0x2d57('0xa'));var squel=require(_0x2d57('0xb'));var crypto=require(_0x2d57('0xc'));var jsforce=require(_0x2d57('0xd'));var deskjs=require(_0x2d57('0xe'));var toCsv=require(_0x2d57('0x7'));var querystring=require(_0x2d57('0xf'));var Papa=require(_0x2d57('0x10'));var Redis=require(_0x2d57('0x11'));var authService=require(_0x2d57('0x12'));var qs=require(_0x2d57('0x13'));var as=require(_0x2d57('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d57('0x15'))(_0x2d57('0x16'));var utils=require(_0x2d57('0x17'));var config=require(_0x2d57('0x18'));var licenseUtil=require(_0x2d57('0x19'));var db=require(_0x2d57('0x1a'))['db'];var integrations=require(_0x2d57('0x1b'));function respondWithStatusCode(_0x5f525d,_0x52e237){_0x52e237=_0x52e237||0xcc;return function(_0x25e0e2){if(_0x25e0e2){return _0x5f525d[_0x2d57('0x1c')](_0x52e237);}return _0x5f525d[_0x2d57('0x1d')](_0x52e237)[_0x2d57('0x1e')]();};}function respondWithResult(_0x49f484,_0x170aaa){_0x170aaa=_0x170aaa||0xc8;return function(_0x5066ec){if(_0x5066ec){return _0x49f484[_0x2d57('0x1d')](_0x170aaa)['json'](_0x5066ec);}};}function respondWithFilteredResult(_0x50d4e4,_0x265935){return function(_0x205660){if(_0x205660){var _0x490798=typeof _0x265935['offset']==='undefined'&&typeof _0x265935['limit']===_0x2d57('0x1f');var _0x34cc7d=_0x205660[_0x2d57('0x20')];var _0x3e80d7=_0x490798?0x0:_0x265935[_0x2d57('0x21')];var _0x3a2a00=_0x490798?_0x205660[_0x2d57('0x20')]:_0x265935[_0x2d57('0x21')]+_0x265935[_0x2d57('0x22')];var _0x4b28b8;if(_0x3a2a00>=_0x34cc7d){_0x3a2a00=_0x34cc7d;_0x4b28b8=0xc8;}else{_0x4b28b8=0xce;}_0x50d4e4[_0x2d57('0x1d')](_0x4b28b8);return _0x50d4e4['set']('Content-Range',_0x3e80d7+'-'+_0x3a2a00+'/'+_0x34cc7d)['json'](_0x205660);}return null;};}function patchUpdates(_0x22b939){return function(_0x403afb){try{jsonpatch['apply'](_0x403afb,_0x22b939,!![]);}catch(_0x2d3550){return BPromise[_0x2d57('0x23')](_0x2d3550);}return _0x403afb[_0x2d57('0x24')]();};}function saveUpdates(_0x4aa703,_0x3d2a05){return function(_0x1d4139){if(_0x1d4139){return _0x1d4139[_0x2d57('0x25')](_0x4aa703)['then'](function(_0x5b34cf){return _0x5b34cf;});}return null;};}function removeEntity(_0x208606,_0x1ec122){return function(_0x440106){if(_0x440106){return _0x440106['destroy']()[_0x2d57('0x26')](function(){_0x208606['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f09b0,_0x173993){return function(_0x26f20d){if(!_0x26f20d){_0x2f09b0[_0x2d57('0x1c')](0x194);}return _0x26f20d;};}function handleError(_0x163513,_0x3ca7d6){_0x3ca7d6=_0x3ca7d6||0x1f4;return function(_0x307b8a){logger[_0x2d57('0x27')](_0x307b8a[_0x2d57('0x28')]);if(_0x307b8a['name']){delete _0x307b8a[_0x2d57('0x29')];}_0x163513['status'](_0x3ca7d6)[_0x2d57('0x2a')](_0x307b8a);};}exports[_0x2d57('0x2b')]=function(_0x31c0b2,_0x42e406){var _0x33b431={},_0x1c5425={},_0x192aad={'count':0x0,'rows':[]};var _0x3c78ea=_[_0x2d57('0x2c')](db[_0x2d57('0x2d')]['rawAttributes'],function(_0x46beb9){return{'name':_0x46beb9[_0x2d57('0x2e')],'type':_0x46beb9[_0x2d57('0x2f')][_0x2d57('0x30')]};});_0x1c5425[_0x2d57('0x31')]=_[_0x2d57('0x2c')](_0x3c78ea,_0x2d57('0x29'));_0x1c5425[_0x2d57('0x32')]=_[_0x2d57('0x33')](_0x31c0b2[_0x2d57('0x32')]);_0x1c5425[_0x2d57('0x34')]=_[_0x2d57('0x35')](_0x1c5425['model'],_0x1c5425[_0x2d57('0x32')]);_0x33b431['attributes']=_[_0x2d57('0x35')](_0x1c5425[_0x2d57('0x31')],qs['fields'](_0x31c0b2[_0x2d57('0x32')][_0x2d57('0x36')]));_0x33b431[_0x2d57('0x37')]=_0x33b431[_0x2d57('0x37')][_0x2d57('0x38')]?_0x33b431[_0x2d57('0x37')]:_0x1c5425['model'];if(!_0x31c0b2['query'][_0x2d57('0x39')](_0x2d57('0x3a'))){_0x33b431[_0x2d57('0x22')]=qs[_0x2d57('0x22')](_0x31c0b2[_0x2d57('0x32')]['limit']);_0x33b431[_0x2d57('0x21')]=qs[_0x2d57('0x21')](_0x31c0b2[_0x2d57('0x32')][_0x2d57('0x21')]);}_0x33b431[_0x2d57('0x3b')]=qs[_0x2d57('0x3c')](_0x31c0b2[_0x2d57('0x32')]['sort']);_0x33b431[_0x2d57('0x3d')]=qs['filters'](_[_0x2d57('0x3e')](_0x31c0b2[_0x2d57('0x32')],_0x1c5425[_0x2d57('0x34')]),_0x3c78ea);if(_0x31c0b2['query'][_0x2d57('0x3f')]){_0x33b431[_0x2d57('0x3d')]=_[_0x2d57('0x40')](_0x33b431['where'],{'$or':_['map'](_0x3c78ea,function(_0x5631d3){if(_0x5631d3[_0x2d57('0x2f')]!==_0x2d57('0x41')){var _0x1aade0={};_0x1aade0[_0x5631d3[_0x2d57('0x29')]]={'$like':'%'+_0x31c0b2['query'][_0x2d57('0x3f')]+'%'};return _0x1aade0;}})});}_0x33b431=_[_0x2d57('0x40')]({},_0x33b431,_0x31c0b2[_0x2d57('0x42')]);var _0x3ec60f={'where':_0x33b431[_0x2d57('0x3d')]};return db[_0x2d57('0x2d')][_0x2d57('0x20')](_0x3ec60f)[_0x2d57('0x26')](function(_0x809eb0){_0x192aad[_0x2d57('0x20')]=_0x809eb0;if(_0x31c0b2['query'][_0x2d57('0x43')]){_0x33b431[_0x2d57('0x44')]=[{'all':!![]}];}return db['VtigerAccount'][_0x2d57('0x45')](_0x33b431);})[_0x2d57('0x26')](function(_0x362ae4){_0x192aad[_0x2d57('0x46')]=_0x362ae4;return _0x192aad;})[_0x2d57('0x26')](respondWithFilteredResult(_0x42e406,_0x33b431))[_0x2d57('0x47')](handleError(_0x42e406,null));};exports[_0x2d57('0x48')]=function(_0x1f9b1d,_0x335bc3){var _0x11b197={'raw':![],'where':{'id':_0x1f9b1d[_0x2d57('0x49')]['id']}},_0x53554b={};_0x53554b[_0x2d57('0x31')]=_[_0x2d57('0x33')](db[_0x2d57('0x2d')][_0x2d57('0x4a')]);_0x53554b[_0x2d57('0x32')]=_[_0x2d57('0x33')](_0x1f9b1d[_0x2d57('0x32')]);_0x53554b[_0x2d57('0x34')]=_[_0x2d57('0x35')](_0x53554b[_0x2d57('0x31')],_0x53554b[_0x2d57('0x32')]);_0x11b197['attributes']=_[_0x2d57('0x35')](_0x53554b[_0x2d57('0x31')],qs[_0x2d57('0x36')](_0x1f9b1d[_0x2d57('0x32')][_0x2d57('0x36')]));_0x11b197[_0x2d57('0x37')]=_0x11b197[_0x2d57('0x37')][_0x2d57('0x38')]?_0x11b197[_0x2d57('0x37')]:_0x53554b[_0x2d57('0x31')];if(_0x1f9b1d['query'][_0x2d57('0x43')]){_0x11b197[_0x2d57('0x44')]=[{'all':!![]}];}_0x11b197=_[_0x2d57('0x40')]({},_0x11b197,_0x1f9b1d[_0x2d57('0x42')]);return db[_0x2d57('0x2d')][_0x2d57('0x4b')](_0x11b197)['then'](handleEntityNotFound(_0x335bc3,null))[_0x2d57('0x26')](respondWithResult(_0x335bc3,null))[_0x2d57('0x47')](handleError(_0x335bc3,null));};exports['create']=function(_0x536eda,_0x4e7e50){return db[_0x2d57('0x2d')]['create'](_0x536eda[_0x2d57('0x4c')],{})['then'](respondWithResult(_0x4e7e50,0xc9))[_0x2d57('0x47')](handleError(_0x4e7e50,null));};exports[_0x2d57('0x25')]=function(_0x56e854,_0x96e47e){if(_0x56e854['body']['id']){delete _0x56e854[_0x2d57('0x4c')]['id'];}return db[_0x2d57('0x2d')][_0x2d57('0x4b')]({'where':{'id':_0x56e854[_0x2d57('0x49')]['id']}})[_0x2d57('0x26')](handleEntityNotFound(_0x96e47e,null))[_0x2d57('0x26')](saveUpdates(_0x56e854['body'],null))[_0x2d57('0x26')](respondWithResult(_0x96e47e,null))[_0x2d57('0x47')](handleError(_0x96e47e,null));};exports['destroy']=function(_0x277cfb,_0x5a7c82){return db[_0x2d57('0x2d')]['find']({'where':{'id':_0x277cfb[_0x2d57('0x49')]['id']}})[_0x2d57('0x26')](handleEntityNotFound(_0x5a7c82,null))[_0x2d57('0x26')](removeEntity(_0x5a7c82,null))[_0x2d57('0x47')](handleError(_0x5a7c82,null));};exports[_0x2d57('0x4d')]=function(_0x13ca0c,_0x97fe1,_0x1dbbd8){var _0x131cb1={};var _0x3d1d9d={};var _0x455cf0;var _0x4416e6;return db['VtigerAccount'][_0x2d57('0x4e')]({'where':{'id':_0x13ca0c['params']['id']}})[_0x2d57('0x26')](handleEntityNotFound(_0x97fe1,null))['then'](function(_0xe6cf6a){if(_0xe6cf6a){_0x455cf0=_0xe6cf6a;_0x3d1d9d[_0x2d57('0x31')]=_[_0x2d57('0x33')](db[_0x2d57('0x4f')]['rawAttributes']);_0x3d1d9d[_0x2d57('0x32')]=_['keys'](_0x13ca0c['query']);_0x3d1d9d['filters']=_['intersection'](_0x3d1d9d[_0x2d57('0x31')],_0x3d1d9d[_0x2d57('0x32')]);_0x131cb1['attributes']=_[_0x2d57('0x35')](_0x3d1d9d[_0x2d57('0x31')],qs['fields'](_0x13ca0c[_0x2d57('0x32')][_0x2d57('0x36')]));_0x131cb1[_0x2d57('0x37')]=_0x131cb1[_0x2d57('0x37')][_0x2d57('0x38')]?_0x131cb1[_0x2d57('0x37')]:_0x3d1d9d[_0x2d57('0x31')];_0x131cb1['order']=qs['sort'](_0x13ca0c[_0x2d57('0x32')][_0x2d57('0x3c')]);_0x131cb1[_0x2d57('0x3d')]=qs[_0x2d57('0x34')](_[_0x2d57('0x3e')](_0x13ca0c[_0x2d57('0x32')],_0x3d1d9d[_0x2d57('0x34')]));if(_0x13ca0c[_0x2d57('0x32')]['filter']){_0x131cb1['where']=_[_0x2d57('0x40')](_0x131cb1[_0x2d57('0x3d')],{'$or':_[_0x2d57('0x2c')](_0x131cb1[_0x2d57('0x37')],function(_0x20110d){var _0x2b730e={};_0x2b730e[_0x20110d]={'$like':'%'+_0x13ca0c[_0x2d57('0x32')]['filter']+'%'};return _0x2b730e;})});}_0x131cb1=_[_0x2d57('0x40')]({},_0x131cb1,_0x13ca0c[_0x2d57('0x42')]);return _0x455cf0['getConfigurations'](_0x131cb1);}})['then'](function(_0x1953e9){if(_0x1953e9){_0x4416e6=_0x1953e9[_0x2d57('0x38')];if(!_0x13ca0c[_0x2d57('0x32')][_0x2d57('0x39')]('nolimit')){_0x131cb1[_0x2d57('0x22')]=qs[_0x2d57('0x22')](_0x13ca0c[_0x2d57('0x32')][_0x2d57('0x22')]);_0x131cb1[_0x2d57('0x21')]=qs[_0x2d57('0x21')](_0x13ca0c['query'][_0x2d57('0x21')]);}return _0x455cf0[_0x2d57('0x4d')](_0x131cb1);}})[_0x2d57('0x26')](function(_0x3f9e04){if(_0x3f9e04){return _0x3f9e04?{'count':_0x4416e6,'rows':_0x3f9e04}:null;}})[_0x2d57('0x26')](respondWithResult(_0x97fe1,null))[_0x2d57('0x47')](handleError(_0x97fe1,null));};exports[_0x2d57('0x50')]=function(_0x17700e,_0x1bb78a,_0x842c5b){if(_0x17700e[_0x2d57('0x4c')]['id']){delete _0x17700e['body']['id'];}return db[_0x2d57('0x2d')][_0x2d57('0x4e')]({'where':{'id':_0x17700e[_0x2d57('0x49')]['id']}})[_0x2d57('0x26')](handleEntityNotFound(_0x1bb78a,null))[_0x2d57('0x26')](function(_0x45b1bc){if(_0x45b1bc){_0x17700e['body']['AccountId']=_0x45b1bc['id'];_0x17700e[_0x2d57('0x4c')][_0x2d57('0x51')]=integrations[_0x2d57('0x52')](_0x17700e[_0x2d57('0x4c')]['channel'],_0x17700e[_0x2d57('0x4c')][_0x2d57('0x2f')]);_0x17700e[_0x2d57('0x4c')][_0x2d57('0x53')]=integrations[_0x2d57('0x54')](_0x17700e[_0x2d57('0x4c')][_0x2d57('0x55')],_0x17700e[_0x2d57('0x4c')][_0x2d57('0x2f')]);return db['VtigerConfiguration'][_0x2d57('0x56')](_0x17700e[_0x2d57('0x4c')],{'include':[{'model':db[_0x2d57('0x57')],'as':_0x2d57('0x51')},{'model':db[_0x2d57('0x57')],'as':_0x2d57('0x53')}]});}return null;})['then'](respondWithResult(_0x1bb78a,null))['catch'](handleError(_0x1bb78a,null));};var md5=require(_0x2d57('0x58'));exports[_0x2d57('0x59')]=function(_0x4b97c3,_0x25d090,_0x2e0a7f){var _0x36e910=null;var _0xf1775f=null;var _0x374acc=null;var _0x222877=null;var _0x3c540e='';return db[_0x2d57('0x2d')][_0x2d57('0x4e')]({'where':{'id':_0x4b97c3['params']['id']},'attributes':['id','name','username',_0x2d57('0x5a'),_0x2d57('0x5b'),_0x2d57('0x5c'),_0x2d57('0x5d'),'accessKey']})[_0x2d57('0x26')](handleEntityNotFound(_0x25d090,null))[_0x2d57('0x26')](function(_0x5d7bfb){if(_0x5d7bfb){_0x36e910=_0x5d7bfb[_0x2d57('0x5e')];_0xf1775f=_0x5d7bfb['accessKey'];_0x374acc=_0x5d7bfb[_0x2d57('0x5b')];_0x3c540e=_0x5d7bfb[_0x2d57('0x5c')];var _0x397ef6=_0x3c540e['slice'](-0x1);if(_0x397ef6==='/'){_0x3c540e=_0x3c540e[_0x2d57('0x5f')](0x0,_0x3c540e['lastIndexOf'](_0x397ef6));}_0x222877=util[_0x2d57('0x60')]('%s/webservice.php',_0x3c540e);var _0x2ca2af={'method':_0x2d57('0x61'),'uri':_0x222877,'qs':{'operation':_0x2d57('0x62'),'username':_0x5d7bfb[_0x2d57('0x5e')]},'json':!![]};return rp(_0x2ca2af);}})[_0x2d57('0x26')](function(_0x40d6fa){if(_0x40d6fa['success']){var _0x14e9e2={'method':_0x2d57('0x63'),'uri':_0x222877,'form':{'operation':_0x2d57('0x64'),'username':_0x36e910,'accessKey':md5(_0x40d6fa[_0x2d57('0x65')]['token']+_0xf1775f)},'json':!![]};return rp(_0x14e9e2);}})[_0x2d57('0x26')](function(_0x480be3){if(_0x480be3[_0x2d57('0x66')]){var _0x289b15={'method':'GET','uri':_0x222877,'qs':{'operation':_0x2d57('0x67'),'username':_0x36e910,'sessionName':_0x480be3[_0x2d57('0x65')][_0x2d57('0x68')],'elementType':_0x374acc},'json':!![]};return rp(_0x289b15);}})['then'](function(_0x2b5991){if(_0x2b5991[_0x2d57('0x66')]){var _0x118c45=[_0x2d57('0x69'),_0x2d57('0x6a'),'owner'];_['remove'](_0x2b5991[_0x2d57('0x65')][_0x2d57('0x36')],function(_0x3eb95c){return _0x118c45[_0x2d57('0x6b')](_0x3eb95c[_0x2d57('0x2f')][_0x2d57('0x29')]);});_[_0x2d57('0x6c')](_0x2b5991[_0x2d57('0x65')]['fields'],function(_0x290cbf){return _0x290cbf[_0x2d57('0x6d')]==='false';});return{'count':_0x2b5991[_0x2d57('0x65')][_0x2d57('0x36')][_0x2d57('0x38')],'rows':_[_0x2d57('0x2c')](_0x2b5991[_0x2d57('0x65')][_0x2d57('0x36')],function(_0x4c6e87){return{'id':_0x4c6e87[_0x2d57('0x29')],'name':_0x4c6e87[_0x2d57('0x6e')],'custom':_[_0x2d57('0x6f')](_0x4c6e87['name'],_0x2d57('0x70'))?!![]:![],'options':_0x4c6e87['type']['name']===_0x2d57('0x71')&&_0x4c6e87[_0x2d57('0x2f')]['picklistValues']['length']>0x0?_[_0x2d57('0x2c')](_0x4c6e87[_0x2d57('0x2f')][_0x2d57('0x72')],function(_0x55f5a2){return{'name':_0x55f5a2[_0x2d57('0x6e')],'value':_0x55f5a2[_0x2d57('0x73')]};}):[]};})};}})[_0x2d57('0x26')](respondWithResult(_0x25d090,null))[_0x2d57('0x47')](function(_0x4d0eef){console[_0x2d57('0x74')]('vTiger\x20error:\x20'+_0x4d0eef);var _0x1a3c58=_0x4b97c3[_0x2d57('0x32')][_0x2d57('0x75')]?0x1f4:_0x4d0eef['statusCode']||0x1f4;logger['error'](_0x2d57('0x76'),_0x2d57('0x59'),_0x1a3c58,JSON['stringify'](_0x4d0eef));delete _0x4d0eef[_0x2d57('0x29')];if(_0x1a3c58===0x191){_0x1a3c58=0x190;}_0x25d090[_0x2d57('0x1d')](_0x1a3c58)[_0x2d57('0x2a')](_0x4b97c3[_0x2d57('0x32')]['test']?{'message':_0x2d57('0x77'),'statusCode':_0x4d0eef[_0x2d57('0x78')]}:_0x4d0eef);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4eb7b2d..0d23816 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 _0xeccd=['./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x1d2960,_0x4f763c){var _0x2bb982=function(_0x10ec67){while(--_0x10ec67){_0x1d2960['push'](_0x1d2960['shift']());}};_0x2bb982(++_0x4f763c);}(_0xeccd,0xea));var _0xdecc=function(_0x5cc506,_0x2761a0){_0x5cc506=_0x5cc506-0x0;var _0x269462=_0xeccd[_0x5cc506];return _0x269462;};'use strict';var _=require(_0xdecc('0x0'));var util=require(_0xdecc('0x1'));var logger=require('../../config/logger')(_0xdecc('0x2'));var moment=require('moment');var BPromise=require(_0xdecc('0x3'));var rp=require(_0xdecc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdecc('0x5'));var attributes=require(_0xdecc('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xdecc('0x7')]=function(_0x177155,_0x6398a0){return _0x177155['define'](_0xdecc('0x8'),attributes,{'tableName':_0xdecc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11d6=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount'];(function(_0x21816c,_0x880c58){var _0x38c5dd=function(_0x4deee5){while(--_0x4deee5){_0x21816c['push'](_0x21816c['shift']());}};_0x38c5dd(++_0x880c58);}(_0x11d6,0xcc));var _0x611d=function(_0x8b60b8,_0x2b61dd){_0x8b60b8=_0x8b60b8-0x0;var _0x9db4bf=_0x11d6[_0x8b60b8];return _0x9db4bf;};'use strict';var _=require(_0x611d('0x0'));var util=require(_0x611d('0x1'));var logger=require(_0x611d('0x2'))('api');var moment=require(_0x611d('0x3'));var BPromise=require(_0x611d('0x4'));var rp=require(_0x611d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x611d('0x6'));var config=require(_0x611d('0x7'));var attributes=require(_0x611d('0x8'));var integrations=require(_0x611d('0x9'));module[_0x611d('0xa')]=function(_0x2345a4,_0x261e1a){return _0x2345a4['define'](_0x611d('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 2e6b8f3..76c1847 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 _0x593e=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount'];(function(_0x2fdbda,_0x2e4f89){var _0x24896b=function(_0x5e451a){while(--_0x5e451a){_0x2fdbda['push'](_0x2fdbda['shift']());}};_0x24896b(++_0x2e4f89);}(_0x593e,0xcb));var _0xe593=function(_0x4d07da,_0x368872){_0x4d07da=_0x4d07da-0x0;var _0x44cb98=_0x593e[_0x4d07da];return _0x44cb98;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});}exports[_0xe593('0x18')]=function(_0x470d07){var _0x5f57ce=this;return new Promise(function(_0xd1020e,_0x28b5ed){return db['VtigerAccount'][_0xe593('0x19')]({'raw':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1c')]||null:null,'attributes':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1d')]||null:null,'limit':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1e')]||null:null,'include':_0x470d07[_0xe593('0x1a')]?_0x470d07['options'][_0xe593('0x1f')]?_['map'](_0x470d07[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x185cea){return{'model':db[_0x185cea[_0xe593('0x20')]],'as':_0x185cea['as'],'attributes':_0x185cea[_0xe593('0x1d')],'include':_0x185cea[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x185cea[_0xe593('0x1f')],function(_0x4fc483){return{'model':db[_0x4fc483[_0xe593('0x20')]],'as':_0x4fc483['as'],'attributes':_0x4fc483[_0xe593('0x1d')],'include':_0x4fc483['include']?_['map'](_0x4fc483[_0xe593('0x1f')],function(_0x25238f){return{'model':db[_0x25238f[_0xe593('0x20')]],'as':_0x25238f['as'],'attributes':_0x25238f[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x27a3d2){logger['info'](_0xe593('0x18'),_0x470d07);logger['debug'](_0xe593('0x18'),_0x470d07,JSON[_0xe593('0x22')](_0x27a3d2));_0xd1020e(_0x27a3d2);})['catch'](function(_0x337ee0){logger['error'](_0xe593('0x18'),_0x337ee0[_0xe593('0x15')],_0x470d07);_0x28b5ed(_0x5f57ce[_0xe593('0x12')](0x1f4,_0x337ee0['message']));});});};exports[_0xe593('0x23')]=function(_0x13f44){var _0x3066ed=this;return new Promise(function(_0x338222,_0x2588be){return db[_0xe593('0x24')][_0xe593('0x25')]({'raw':_0x13f44['options']?_0x13f44[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x13f44['options']?_0x13f44[_0xe593('0x1a')]['where']||null:null,'attributes':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1d')]||null:null,'include':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')]?_[_0xe593('0x21')](_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x4305de){return{'model':db[_0x4305de['model']],'as':_0x4305de['as'],'attributes':_0x4305de[_0xe593('0x1d')],'include':_0x4305de[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4305de['include'],function(_0x4fefb3){return{'model':db[_0x4fefb3[_0xe593('0x20')]],'as':_0x4fefb3['as'],'attributes':_0x4fefb3['attributes'],'include':_0x4fefb3[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4fefb3[_0xe593('0x1f')],function(_0x30511c){return{'model':db[_0x30511c[_0xe593('0x20')]],'as':_0x30511c['as'],'attributes':_0x30511c[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x4889cc){logger['info'](_0xe593('0x23'),_0x13f44);logger['debug'](_0xe593('0x23'),_0x13f44,JSON['stringify'](_0x4889cc));_0x338222(_0x4889cc);})[_0xe593('0x17')](function(_0x5b9589){logger['error'](_0xe593('0x23'),_0x5b9589[_0xe593('0x15')],_0x13f44);_0x2588be(_0x3066ed[_0xe593('0x12')](0x1f4,_0x5b9589['message']));});});}; \ No newline at end of file +var _0x6324=['message','info','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s'];(function(_0x2f0e20,_0x4e75f2){var _0x2ebd44=function(_0x1e7296){while(--_0x1e7296){_0x2f0e20['push'](_0x2f0e20['shift']());}};_0x2ebd44(++_0x4e75f2);}(_0x6324,0x142));var _0x4632=function(_0x4ae506,_0x5a97ed){_0x4ae506=_0x4ae506-0x0;var _0x18e3a1=_0x6324[_0x4ae506];return _0x18e3a1;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});}exports[_0x4632('0x16')]=function(_0x1a94c0){var _0x5b28b7=this;return new Promise(function(_0x3cddfa,_0x1894bb){return db['VtigerAccount']['findAll']({'raw':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x18')]===undefined?!![]:![]:!![],'where':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x19')]||null:null,'attributes':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1a')]||null:null,'limit':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1b')]||null:null,'include':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x1a94c0[_0x4632('0x17')][_0x4632('0x1c')],function(_0x380a9f){return{'model':db[_0x380a9f[_0x4632('0x1e')]],'as':_0x380a9f['as'],'attributes':_0x380a9f[_0x4632('0x1a')],'include':_0x380a9f[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x380a9f[_0x4632('0x1c')],function(_0xb074d){return{'model':db[_0xb074d[_0x4632('0x1e')]],'as':_0xb074d['as'],'attributes':_0xb074d[_0x4632('0x1a')],'include':_0xb074d[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0xb074d[_0x4632('0x1c')],function(_0x22d0f5){return{'model':db[_0x22d0f5[_0x4632('0x1e')]],'as':_0x22d0f5['as'],'attributes':_0x22d0f5[_0x4632('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57798a){logger[_0x4632('0x13')](_0x4632('0x16'),_0x1a94c0);logger[_0x4632('0xc')](_0x4632('0x16'),_0x1a94c0,JSON[_0x4632('0xe')](_0x57798a));_0x3cddfa(_0x57798a);})[_0x4632('0x15')](function(_0x3570b2){logger['error'](_0x4632('0x16'),_0x3570b2[_0x4632('0x12')],_0x1a94c0);_0x1894bb(_0x5b28b7['error'](0x1f4,_0x3570b2[_0x4632('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x6599ad){var _0x4cb661=this;return new Promise(function(_0x4fda35,_0x1973eb){return db[_0x4632('0x1f')][_0x4632('0x20')]({'raw':_0x6599ad['options']?_0x6599ad['options'][_0x4632('0x18')]===undefined?!![]:![]:!![],'where':_0x6599ad[_0x4632('0x17')]?_0x6599ad['options']['where']||null:null,'attributes':_0x6599ad[_0x4632('0x17')]?_0x6599ad[_0x4632('0x17')]['attributes']||null:null,'include':_0x6599ad[_0x4632('0x17')]?_0x6599ad[_0x4632('0x17')][_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x6599ad[_0x4632('0x17')]['include'],function(_0x5f0382){return{'model':db[_0x5f0382[_0x4632('0x1e')]],'as':_0x5f0382['as'],'attributes':_0x5f0382['attributes'],'include':_0x5f0382['include']?_[_0x4632('0x1d')](_0x5f0382['include'],function(_0x49355c){return{'model':db[_0x49355c[_0x4632('0x1e')]],'as':_0x49355c['as'],'attributes':_0x49355c['attributes'],'include':_0x49355c[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x49355c[_0x4632('0x1c')],function(_0x52dd7f){return{'model':db[_0x52dd7f[_0x4632('0x1e')]],'as':_0x52dd7f['as'],'attributes':_0x52dd7f[_0x4632('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4632('0xa')](function(_0xca07f5){logger[_0x4632('0x13')]('ShowVtigerAccount',_0x6599ad);logger['debug'](_0x4632('0x21'),_0x6599ad,JSON[_0x4632('0xe')](_0xca07f5));_0x4fda35(_0xca07f5);})[_0x4632('0x15')](function(_0x4f40af){logger['error']('ShowVtigerAccount',_0x4f40af[_0x4632('0x12')],_0x6599ad);_0x1973eb(_0x4cb661[_0x4632('0xf')](0x1f4,_0x4f40af['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 78914ca..e489e2f 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 _0xab73=['../../config/environment','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xab73,0x1ae));var _0x3ab7=function(_0x56d1f9,_0x364410){_0x56d1f9=_0x56d1f9-0x0;var _0x1ceed8=_0xab73[_0x56d1f9];return _0x1ceed8;};'use strict';var multer=require('multer');var util=require(_0x3ab7('0x0'));var path=require('path');var timeout=require(_0x3ab7('0x1'));var express=require(_0x3ab7('0x2'));var router=express[_0x3ab7('0x3')]();var fs_extra=require(_0x3ab7('0x4'));var auth=require(_0x3ab7('0x5'));var interaction=require(_0x3ab7('0x6'));var config=require(_0x3ab7('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x3ab7('0x8')](),controller['index']);router[_0x3ab7('0x9')](_0x3ab7('0xa'),auth[_0x3ab7('0x8')](),controller[_0x3ab7('0xb')]);router[_0x3ab7('0x9')](_0x3ab7('0xc'),auth[_0x3ab7('0x8')](),controller[_0x3ab7('0xd')]);router[_0x3ab7('0x9')](_0x3ab7('0xe'),auth['isAuthenticated'](),controller[_0x3ab7('0xf')]);router[_0x3ab7('0x9')](_0x3ab7('0x10'),auth[_0x3ab7('0x8')](),controller[_0x3ab7('0x11')]);router[_0x3ab7('0x12')]('/',auth[_0x3ab7('0x8')](),controller['create']);router[_0x3ab7('0x13')](_0x3ab7('0xa'),auth['isAuthenticated'](),controller[_0x3ab7('0x14')]);router['delete'](_0x3ab7('0xa'),auth[_0x3ab7('0x8')](),controller[_0x3ab7('0x15')]);module[_0x3ab7('0x16')]=router; \ No newline at end of file +var _0x83bf=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy'];(function(_0x2cc37d,_0x5b1496){var _0x1f468b=function(_0x1e2c01){while(--_0x1e2c01){_0x2cc37d['push'](_0x2cc37d['shift']());}};_0x1f468b(++_0x5b1496);}(_0x83bf,0x15a));var _0xf83b=function(_0x340a1a,_0x1ef855){_0x340a1a=_0x340a1a-0x0;var _0x23a45c=_0x83bf[_0x340a1a];return _0x23a45c;};'use strict';var multer=require('multer');var util=require(_0xf83b('0x0'));var path=require(_0xf83b('0x1'));var timeout=require(_0xf83b('0x2'));var express=require('express');var router=express[_0xf83b('0x3')]();var fs_extra=require(_0xf83b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf83b('0x5'));var config=require(_0xf83b('0x6'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xf83b('0x7')](),controller[_0xf83b('0x8')]);router[_0xf83b('0x9')](_0xf83b('0xa'),auth[_0xf83b('0x7')](),controller['show']);router[_0xf83b('0x9')](_0xf83b('0xb'),auth['isAuthenticated'](),controller[_0xf83b('0xc')]);router[_0xf83b('0x9')]('/:id/subjects',auth[_0xf83b('0x7')](),controller[_0xf83b('0xd')]);router[_0xf83b('0x9')](_0xf83b('0xe'),auth[_0xf83b('0x7')](),controller[_0xf83b('0xf')]);router[_0xf83b('0x10')]('/',auth[_0xf83b('0x7')](),controller[_0xf83b('0x11')]);router[_0xf83b('0x12')](_0xf83b('0xa'),auth[_0xf83b('0x7')](),controller[_0xf83b('0x13')]);router[_0xf83b('0x14')]('/:id',auth[_0xf83b('0x7')](),controller[_0xf83b('0x15')]);module[_0xf83b('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 9ebd7a1..c0bcaac 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 _0x9f7e=['exports','STRING'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9f7e,0x1b6));var _0xe9f7=function(_0x1f330f,_0x16450b){_0x1f330f=_0x1f330f-0x0;var _0x1b2583=_0x9f7e[_0x1f330f];return _0x1b2583;};'use strict';var Sequelize=require('sequelize');module[_0xe9f7('0x0')]={'name':{'type':Sequelize[_0xe9f7('0x1')]},'description':{'type':Sequelize[_0xe9f7('0x1')]}}; \ No newline at end of file +var _0x9d59=['sequelize','exports','STRING'];(function(_0x2d2a92,_0x597388){var _0xfa8639=function(_0x29fa65){while(--_0x29fa65){_0x2d2a92['push'](_0x2d2a92['shift']());}};_0xfa8639(++_0x597388);}(_0x9d59,0x141));var _0x99d5=function(_0x1b429f,_0x3ab8d3){_0x1b429f=_0x1b429f-0x0;var _0x1b371e=_0x9d59[_0x1b429f];return _0x1b371e;};'use strict';var Sequelize=require(_0x99d5('0x0'));module[_0x99d5('0x1')]={'name':{'type':Sequelize[_0x99d5('0x2')]},'description':{'type':Sequelize[_0x99d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index dc57f28..492fd1a 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 _0x8f99=['../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VtigerConfiguration','rows','show','params','include','find','catch','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4581e7,_0x2bf000){var _0x584bf2=function(_0x467cd5){while(--_0x467cd5){_0x4581e7['push'](_0x4581e7['shift']());}};_0x584bf2(++_0x2bf000);}(_0x8f99,0x184));var _0x98f9=function(_0x2ddd7a,_0x3ebf3a){_0x2ddd7a=_0x2ddd7a-0x0;var _0x25e166=_0x8f99[_0x2ddd7a];return _0x25e166;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98f9('0x0'));var zipdir=require(_0x98f9('0x1'));var jsonpatch=require(_0x98f9('0x2'));var rp=require(_0x98f9('0x3'));var moment=require(_0x98f9('0x4'));var BPromise=require(_0x98f9('0x5'));var Mustache=require(_0x98f9('0x6'));var util=require(_0x98f9('0x7'));var path=require('path');var sox=require(_0x98f9('0x8'));var csv=require(_0x98f9('0x9'));var ejs=require(_0x98f9('0xa'));var fs=require('fs');var fs_extra=require(_0x98f9('0xb'));var _=require(_0x98f9('0xc'));var squel=require('squel');var crypto=require(_0x98f9('0xd'));var jsforce=require(_0x98f9('0xe'));var deskjs=require(_0x98f9('0xf'));var toCsv=require(_0x98f9('0x9'));var querystring=require(_0x98f9('0x10'));var Papa=require(_0x98f9('0x11'));var Redis=require(_0x98f9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98f9('0x13'));var as=require(_0x98f9('0x14'));var hardwareService=require(_0x98f9('0x15'));var logger=require(_0x98f9('0x16'))(_0x98f9('0x17'));var utils=require(_0x98f9('0x18'));var config=require(_0x98f9('0x19'));var licenseUtil=require(_0x98f9('0x1a'));var db=require(_0x98f9('0x1b'))['db'];function respondWithStatusCode(_0x147cfd,_0x2b68e4){_0x2b68e4=_0x2b68e4||0xcc;return function(_0x278c82){if(_0x278c82){return _0x147cfd[_0x98f9('0x1c')](_0x2b68e4);}return _0x147cfd[_0x98f9('0x1d')](_0x2b68e4)[_0x98f9('0x1e')]();};}function respondWithResult(_0x301971,_0x9673fc){_0x9673fc=_0x9673fc||0xc8;return function(_0x4885bb){if(_0x4885bb){return _0x301971[_0x98f9('0x1d')](_0x9673fc)['json'](_0x4885bb);}};}function respondWithFilteredResult(_0x49acef,_0x175256){return function(_0x464309){if(_0x464309){var _0x39210d=typeof _0x175256[_0x98f9('0x1f')]==='undefined'&&typeof _0x175256[_0x98f9('0x20')]==='undefined';var _0x4cba88=_0x464309[_0x98f9('0x21')];var _0x1864c3=_0x39210d?0x0:_0x175256[_0x98f9('0x1f')];var _0x5d800d=_0x39210d?_0x464309[_0x98f9('0x21')]:_0x175256[_0x98f9('0x1f')]+_0x175256[_0x98f9('0x20')];var _0x426647;if(_0x5d800d>=_0x4cba88){_0x5d800d=_0x4cba88;_0x426647=0xc8;}else{_0x426647=0xce;}_0x49acef[_0x98f9('0x1d')](_0x426647);return _0x49acef[_0x98f9('0x22')](_0x98f9('0x23'),_0x1864c3+'-'+_0x5d800d+'/'+_0x4cba88)[_0x98f9('0x24')](_0x464309);}return null;};}function patchUpdates(_0x53d012){return function(_0xa01430){try{jsonpatch[_0x98f9('0x25')](_0xa01430,_0x53d012,!![]);}catch(_0x286e1c){return BPromise[_0x98f9('0x26')](_0x286e1c);}return _0xa01430['save']();};}function saveUpdates(_0x3ccdd1,_0x128388){return function(_0x387940){if(_0x387940){return _0x387940[_0x98f9('0x27')](_0x3ccdd1)[_0x98f9('0x28')](function(_0x49c8ec){return _0x49c8ec;});}return null;};}function removeEntity(_0x451b9b,_0x56cb9f){return function(_0x5cbcde){if(_0x5cbcde){return _0x5cbcde[_0x98f9('0x29')]()[_0x98f9('0x28')](function(){_0x451b9b[_0x98f9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59fd04,_0x11aac1){return function(_0x13612d){if(!_0x13612d){_0x59fd04['sendStatus'](0x194);}return _0x13612d;};}function handleError(_0x4169dc,_0x34d635){_0x34d635=_0x34d635||0x1f4;return function(_0x816b5d){logger[_0x98f9('0x2a')](_0x816b5d[_0x98f9('0x2b')]);if(_0x816b5d['name']){delete _0x816b5d['name'];}_0x4169dc[_0x98f9('0x1d')](_0x34d635)[_0x98f9('0x2c')](_0x816b5d);};}exports[_0x98f9('0x2d')]=function(_0xc3a856,_0x49e2c4){var _0x19f032={},_0x116d87={},_0x2e9100={'count':0x0,'rows':[]};var _0x1ae976=_[_0x98f9('0x2e')](db['VtigerConfiguration'][_0x98f9('0x2f')],function(_0x58cf55){return{'name':_0x58cf55[_0x98f9('0x30')],'type':_0x58cf55[_0x98f9('0x31')]['key']};});_0x116d87[_0x98f9('0x32')]=_[_0x98f9('0x2e')](_0x1ae976,_0x98f9('0x33'));_0x116d87['query']=_[_0x98f9('0x34')](_0xc3a856[_0x98f9('0x35')]);_0x116d87[_0x98f9('0x36')]=_[_0x98f9('0x37')](_0x116d87['model'],_0x116d87[_0x98f9('0x35')]);_0x19f032[_0x98f9('0x38')]=_[_0x98f9('0x37')](_0x116d87[_0x98f9('0x32')],qs[_0x98f9('0x39')](_0xc3a856[_0x98f9('0x35')][_0x98f9('0x39')]));_0x19f032['attributes']=_0x19f032[_0x98f9('0x38')][_0x98f9('0x3a')]?_0x19f032[_0x98f9('0x38')]:_0x116d87[_0x98f9('0x32')];if(!_0xc3a856[_0x98f9('0x35')][_0x98f9('0x3b')](_0x98f9('0x3c'))){_0x19f032[_0x98f9('0x20')]=qs[_0x98f9('0x20')](_0xc3a856[_0x98f9('0x35')][_0x98f9('0x20')]);_0x19f032[_0x98f9('0x1f')]=qs['offset'](_0xc3a856[_0x98f9('0x35')][_0x98f9('0x1f')]);}_0x19f032[_0x98f9('0x3d')]=qs[_0x98f9('0x3e')](_0xc3a856[_0x98f9('0x35')][_0x98f9('0x3e')]);_0x19f032[_0x98f9('0x3f')]=qs['filters'](_[_0x98f9('0x40')](_0xc3a856[_0x98f9('0x35')],_0x116d87[_0x98f9('0x36')]),_0x1ae976);if(_0xc3a856['query'][_0x98f9('0x41')]){_0x19f032[_0x98f9('0x3f')]=_['merge'](_0x19f032[_0x98f9('0x3f')],{'$or':_[_0x98f9('0x2e')](_0x1ae976,function(_0x530a5e){if(_0x530a5e['type']!==_0x98f9('0x42')){var _0x54af4e={};_0x54af4e[_0x530a5e[_0x98f9('0x33')]]={'$like':'%'+_0xc3a856['query']['filter']+'%'};return _0x54af4e;}})});}_0x19f032=_[_0x98f9('0x43')]({},_0x19f032,_0xc3a856[_0x98f9('0x44')]);var _0x24cee7={'where':_0x19f032[_0x98f9('0x3f')]};return db[_0x98f9('0x45')][_0x98f9('0x21')](_0x24cee7)[_0x98f9('0x28')](function(_0x220584){_0x2e9100[_0x98f9('0x21')]=_0x220584;if(_0xc3a856['query']['includeAll']){_0x19f032['include']=[{'all':!![]}];}return db[_0x98f9('0x45')]['findAll'](_0x19f032);})[_0x98f9('0x28')](function(_0x54cb33){_0x2e9100[_0x98f9('0x46')]=_0x54cb33;return _0x2e9100;})[_0x98f9('0x28')](respondWithFilteredResult(_0x49e2c4,_0x19f032))['catch'](handleError(_0x49e2c4,null));};exports[_0x98f9('0x47')]=function(_0x46954b,_0x597725){var _0x1b8b6e={'raw':![],'where':{'id':_0x46954b[_0x98f9('0x48')]['id']}},_0x48220b={};_0x48220b[_0x98f9('0x32')]=_[_0x98f9('0x34')](db[_0x98f9('0x45')]['rawAttributes']);_0x48220b[_0x98f9('0x35')]=_[_0x98f9('0x34')](_0x46954b[_0x98f9('0x35')]);_0x48220b['filters']=_[_0x98f9('0x37')](_0x48220b[_0x98f9('0x32')],_0x48220b['query']);_0x1b8b6e[_0x98f9('0x38')]=_['intersection'](_0x48220b['model'],qs[_0x98f9('0x39')](_0x46954b[_0x98f9('0x35')][_0x98f9('0x39')]));_0x1b8b6e[_0x98f9('0x38')]=_0x1b8b6e[_0x98f9('0x38')][_0x98f9('0x3a')]?_0x1b8b6e['attributes']:_0x48220b[_0x98f9('0x32')];if(_0x46954b[_0x98f9('0x35')]['includeAll']){_0x1b8b6e[_0x98f9('0x49')]=[{'all':!![]}];}_0x1b8b6e=_[_0x98f9('0x43')]({},_0x1b8b6e,_0x46954b[_0x98f9('0x44')]);return db['VtigerConfiguration'][_0x98f9('0x4a')](_0x1b8b6e)[_0x98f9('0x28')](handleEntityNotFound(_0x597725,null))['then'](respondWithResult(_0x597725,null))[_0x98f9('0x4b')](handleError(_0x597725,null));};exports[_0x98f9('0x4c')]=function(_0xebffac,_0x3a6612){return db[_0x98f9('0x45')]['create'](_0xebffac[_0x98f9('0x4d')],{})['then'](respondWithResult(_0x3a6612,0xc9))[_0x98f9('0x4b')](handleError(_0x3a6612,null));};exports[_0x98f9('0x27')]=function(_0x390750,_0x1a4383){if(_0x390750[_0x98f9('0x4d')]['id']){delete _0x390750[_0x98f9('0x4d')]['id'];}return db[_0x98f9('0x45')][_0x98f9('0x4a')]({'where':{'id':_0x390750['params']['id']}})[_0x98f9('0x28')](handleEntityNotFound(_0x1a4383,null))[_0x98f9('0x28')](saveUpdates(_0x390750[_0x98f9('0x4d')],null))['then'](respondWithResult(_0x1a4383,null))['catch'](handleError(_0x1a4383,null));};exports['destroy']=function(_0x45b946,_0x3dda7a){return db[_0x98f9('0x45')]['find']({'where':{'id':_0x45b946[_0x98f9('0x48')]['id']}})[_0x98f9('0x28')](handleEntityNotFound(_0x3dda7a,null))[_0x98f9('0x28')](removeEntity(_0x3dda7a,null))[_0x98f9('0x4b')](handleError(_0x3dda7a,null));};exports[_0x98f9('0x4e')]=function(_0x5975bf,_0x18d1fe,_0x12ae3c){var _0x3c6e1b={};var _0x2d0a14={};var _0x292ae9;var _0x4d00af;return db['VtigerConfiguration'][_0x98f9('0x4f')]({'where':{'id':_0x5975bf[_0x98f9('0x48')]['id']}})['then'](handleEntityNotFound(_0x18d1fe,null))[_0x98f9('0x28')](function(_0x4e2669){if(_0x4e2669){_0x292ae9=_0x4e2669;_0x2d0a14[_0x98f9('0x32')]=_[_0x98f9('0x34')](db[_0x98f9('0x50')][_0x98f9('0x2f')]);_0x2d0a14[_0x98f9('0x35')]=_[_0x98f9('0x34')](_0x5975bf['query']);_0x2d0a14[_0x98f9('0x36')]=_[_0x98f9('0x37')](_0x2d0a14['model'],_0x2d0a14['query']);_0x3c6e1b[_0x98f9('0x38')]=_[_0x98f9('0x37')](_0x2d0a14[_0x98f9('0x32')],qs[_0x98f9('0x39')](_0x5975bf['query'][_0x98f9('0x39')]));_0x3c6e1b[_0x98f9('0x38')]=_0x3c6e1b[_0x98f9('0x38')][_0x98f9('0x3a')]?_0x3c6e1b[_0x98f9('0x38')]:_0x2d0a14[_0x98f9('0x32')];_0x3c6e1b[_0x98f9('0x3d')]=qs[_0x98f9('0x3e')](_0x5975bf['query'][_0x98f9('0x3e')]);_0x3c6e1b[_0x98f9('0x3f')]=qs['filters'](_[_0x98f9('0x40')](_0x5975bf[_0x98f9('0x35')],_0x2d0a14[_0x98f9('0x36')]));if(_0x5975bf[_0x98f9('0x35')][_0x98f9('0x41')]){_0x3c6e1b[_0x98f9('0x3f')]=_[_0x98f9('0x43')](_0x3c6e1b[_0x98f9('0x3f')],{'$or':_[_0x98f9('0x2e')](_0x3c6e1b[_0x98f9('0x38')],function(_0x5cda0c){var _0x4e1054={};_0x4e1054[_0x5cda0c]={'$like':'%'+_0x5975bf[_0x98f9('0x35')]['filter']+'%'};return _0x4e1054;})});}_0x3c6e1b=_['merge']({},_0x3c6e1b,_0x5975bf[_0x98f9('0x44')]);return _0x292ae9['getFields'](_0x3c6e1b);}})[_0x98f9('0x28')](function(_0x5e49ca){if(_0x5e49ca){_0x4d00af=_0x5e49ca['length'];if(!_0x5975bf[_0x98f9('0x35')][_0x98f9('0x3b')](_0x98f9('0x3c'))){_0x3c6e1b['limit']=qs[_0x98f9('0x20')](_0x5975bf['query'][_0x98f9('0x20')]);_0x3c6e1b[_0x98f9('0x1f')]=qs[_0x98f9('0x1f')](_0x5975bf[_0x98f9('0x35')][_0x98f9('0x1f')]);}return _0x292ae9[_0x98f9('0x4e')](_0x3c6e1b);}})[_0x98f9('0x28')](function(_0x509b4c){if(_0x509b4c){return _0x509b4c?{'count':_0x4d00af,'rows':_0x509b4c}:null;}})[_0x98f9('0x28')](respondWithResult(_0x18d1fe,null))[_0x98f9('0x4b')](handleError(_0x18d1fe,null));};exports[_0x98f9('0x51')]=function(_0x26a2c9,_0x406944,_0x55b286){var _0x32b4b4={};var _0x5ac930={};var _0x19209a;var _0x688139;return db[_0x98f9('0x45')][_0x98f9('0x4f')]({'where':{'id':_0x26a2c9['params']['id']}})['then'](handleEntityNotFound(_0x406944,null))[_0x98f9('0x28')](function(_0x5966f4){if(_0x5966f4){_0x19209a=_0x5966f4;_0x5ac930['model']=_[_0x98f9('0x34')](db['VtigerField'][_0x98f9('0x2f')]);_0x5ac930['query']=_['keys'](_0x26a2c9['query']);_0x5ac930[_0x98f9('0x36')]=_['intersection'](_0x5ac930[_0x98f9('0x32')],_0x5ac930[_0x98f9('0x35')]);_0x32b4b4[_0x98f9('0x38')]=_[_0x98f9('0x37')](_0x5ac930[_0x98f9('0x32')],qs[_0x98f9('0x39')](_0x26a2c9['query'][_0x98f9('0x39')]));_0x32b4b4[_0x98f9('0x38')]=_0x32b4b4[_0x98f9('0x38')][_0x98f9('0x3a')]?_0x32b4b4[_0x98f9('0x38')]:_0x5ac930['model'];_0x32b4b4[_0x98f9('0x3d')]=qs[_0x98f9('0x3e')](_0x26a2c9['query'][_0x98f9('0x3e')]);_0x32b4b4['where']=qs[_0x98f9('0x36')](_[_0x98f9('0x40')](_0x26a2c9[_0x98f9('0x35')],_0x5ac930['filters']));if(_0x26a2c9[_0x98f9('0x35')][_0x98f9('0x41')]){_0x32b4b4['where']=_[_0x98f9('0x43')](_0x32b4b4[_0x98f9('0x3f')],{'$or':_['map'](_0x32b4b4[_0x98f9('0x38')],function(_0x21a0a5){var _0x27f1ae={};_0x27f1ae[_0x21a0a5]={'$like':'%'+_0x26a2c9[_0x98f9('0x35')][_0x98f9('0x41')]+'%'};return _0x27f1ae;})});}_0x32b4b4=_[_0x98f9('0x43')]({},_0x32b4b4,_0x26a2c9[_0x98f9('0x44')]);return _0x19209a[_0x98f9('0x51')](_0x32b4b4);}})[_0x98f9('0x28')](function(_0x31fb5c){if(_0x31fb5c){_0x688139=_0x31fb5c['length'];if(!_0x26a2c9[_0x98f9('0x35')][_0x98f9('0x3b')](_0x98f9('0x3c'))){_0x32b4b4['limit']=qs[_0x98f9('0x20')](_0x26a2c9[_0x98f9('0x35')][_0x98f9('0x20')]);_0x32b4b4[_0x98f9('0x1f')]=qs[_0x98f9('0x1f')](_0x26a2c9[_0x98f9('0x35')][_0x98f9('0x1f')]);}return _0x19209a[_0x98f9('0x51')](_0x32b4b4);}})[_0x98f9('0x28')](function(_0x1ffed9){if(_0x1ffed9){return _0x1ffed9?{'count':_0x688139,'rows':_0x1ffed9}:null;}})[_0x98f9('0x28')](respondWithResult(_0x406944,null))['catch'](handleError(_0x406944,null));};exports[_0x98f9('0x52')]=function(_0x4c6432,_0x4dc203,_0x4ed48b){var _0x337b4a={};var _0x4a8396={};var _0x8d481d;var _0x113928;return db[_0x98f9('0x45')][_0x98f9('0x4f')]({'where':{'id':_0x4c6432[_0x98f9('0x48')]['id']}})[_0x98f9('0x28')](handleEntityNotFound(_0x4dc203,null))[_0x98f9('0x28')](function(_0x16bcfc){if(_0x16bcfc){_0x8d481d=_0x16bcfc;_0x4a8396[_0x98f9('0x32')]=_[_0x98f9('0x34')](db[_0x98f9('0x50')]['rawAttributes']);_0x4a8396['query']=_[_0x98f9('0x34')](_0x4c6432['query']);_0x4a8396[_0x98f9('0x36')]=_[_0x98f9('0x37')](_0x4a8396['model'],_0x4a8396[_0x98f9('0x35')]);_0x337b4a[_0x98f9('0x38')]=_[_0x98f9('0x37')](_0x4a8396[_0x98f9('0x32')],qs[_0x98f9('0x39')](_0x4c6432[_0x98f9('0x35')]['fields']));_0x337b4a['attributes']=_0x337b4a['attributes']['length']?_0x337b4a[_0x98f9('0x38')]:_0x4a8396[_0x98f9('0x32')];_0x337b4a[_0x98f9('0x3d')]=qs[_0x98f9('0x3e')](_0x4c6432[_0x98f9('0x35')][_0x98f9('0x3e')]);_0x337b4a[_0x98f9('0x3f')]=qs['filters'](_['pick'](_0x4c6432[_0x98f9('0x35')],_0x4a8396[_0x98f9('0x36')]));if(_0x4c6432[_0x98f9('0x35')]['filter']){_0x337b4a['where']=_['merge'](_0x337b4a[_0x98f9('0x3f')],{'$or':_['map'](_0x337b4a[_0x98f9('0x38')],function(_0x4f07ac){var _0x3aedf7={};_0x3aedf7[_0x4f07ac]={'$like':'%'+_0x4c6432[_0x98f9('0x35')]['filter']+'%'};return _0x3aedf7;})});}_0x337b4a=_[_0x98f9('0x43')]({},_0x337b4a,_0x4c6432['options']);return _0x8d481d[_0x98f9('0x52')](_0x337b4a);}})[_0x98f9('0x28')](function(_0x4bb027){if(_0x4bb027){_0x113928=_0x4bb027[_0x98f9('0x3a')];if(!_0x4c6432[_0x98f9('0x35')][_0x98f9('0x3b')](_0x98f9('0x3c'))){_0x337b4a[_0x98f9('0x20')]=qs[_0x98f9('0x20')](_0x4c6432[_0x98f9('0x35')][_0x98f9('0x20')]);_0x337b4a[_0x98f9('0x1f')]=qs[_0x98f9('0x1f')](_0x4c6432['query'][_0x98f9('0x1f')]);}return _0x8d481d[_0x98f9('0x52')](_0x337b4a);}})[_0x98f9('0x28')](function(_0x4bf40c){if(_0x4bf40c){return _0x4bf40c?{'count':_0x113928,'rows':_0x4bf40c}:null;}})[_0x98f9('0x28')](respondWithResult(_0x4dc203,null))[_0x98f9('0x4b')](handleError(_0x4dc203,null));}; \ No newline at end of file +var _0xb4c2=['getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../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','apply','reject','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','catch','getFields','findOne','params','VtigerField','nolimit'];(function(_0x4f91e4,_0x11cd4c){var _0xedeb8e=function(_0x354fdd){while(--_0x354fdd){_0x4f91e4['push'](_0x4f91e4['shift']());}};_0xedeb8e(++_0x11cd4c);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x4329f8,_0x13df36){_0x4329f8=_0x4329f8-0x0;var _0x5f496f=_0xb4c2[_0x4329f8];return _0x5f496f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b4c('0x0'));var zipdir=require(_0x2b4c('0x1'));var jsonpatch=require(_0x2b4c('0x2'));var rp=require(_0x2b4c('0x3'));var moment=require(_0x2b4c('0x4'));var BPromise=require(_0x2b4c('0x5'));var Mustache=require(_0x2b4c('0x6'));var util=require(_0x2b4c('0x7'));var path=require(_0x2b4c('0x8'));var sox=require(_0x2b4c('0x9'));var csv=require(_0x2b4c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b4c('0xb'));var _=require('lodash');var squel=require(_0x2b4c('0xc'));var crypto=require('crypto');var jsforce=require(_0x2b4c('0xd'));var deskjs=require(_0x2b4c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b4c('0xf'));var Papa=require(_0x2b4c('0x10'));var Redis=require(_0x2b4c('0x11'));var authService=require(_0x2b4c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2b4c('0x13'));var hardwareService=require(_0x2b4c('0x14'));var logger=require(_0x2b4c('0x15'))(_0x2b4c('0x16'));var utils=require(_0x2b4c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b4c('0x18'));var db=require(_0x2b4c('0x19'))['db'];function respondWithStatusCode(_0x2650d0,_0x12ab59){_0x12ab59=_0x12ab59||0xcc;return function(_0x340de0){if(_0x340de0){return _0x2650d0[_0x2b4c('0x1a')](_0x12ab59);}return _0x2650d0[_0x2b4c('0x1b')](_0x12ab59)[_0x2b4c('0x1c')]();};}function respondWithResult(_0x323ebe,_0x425240){_0x425240=_0x425240||0xc8;return function(_0x52dc26){if(_0x52dc26){return _0x323ebe[_0x2b4c('0x1b')](_0x425240)[_0x2b4c('0x1d')](_0x52dc26);}};}function respondWithFilteredResult(_0x38c517,_0x2f6fd5){return function(_0x1e9508){if(_0x1e9508){var _0x7fcee9=typeof _0x2f6fd5[_0x2b4c('0x1e')]==='undefined'&&typeof _0x2f6fd5[_0x2b4c('0x1f')]===_0x2b4c('0x20');var _0x3fa354=_0x1e9508[_0x2b4c('0x21')];var _0x396824=_0x7fcee9?0x0:_0x2f6fd5[_0x2b4c('0x1e')];var _0x38d460=_0x7fcee9?_0x1e9508[_0x2b4c('0x21')]:_0x2f6fd5[_0x2b4c('0x1e')]+_0x2f6fd5[_0x2b4c('0x1f')];var _0x33fe96;if(_0x38d460>=_0x3fa354){_0x38d460=_0x3fa354;_0x33fe96=0xc8;}else{_0x33fe96=0xce;}_0x38c517[_0x2b4c('0x1b')](_0x33fe96);return _0x38c517[_0x2b4c('0x22')](_0x2b4c('0x23'),_0x396824+'-'+_0x38d460+'/'+_0x3fa354)[_0x2b4c('0x1d')](_0x1e9508);}return null;};}function patchUpdates(_0xb251){return function(_0x17a169){try{jsonpatch[_0x2b4c('0x24')](_0x17a169,_0xb251,!![]);}catch(_0x16bbbc){return BPromise[_0x2b4c('0x25')](_0x16bbbc);}return _0x17a169['save']();};}function saveUpdates(_0x830d7c,_0x3cb67b){return function(_0x2d268d){if(_0x2d268d){return _0x2d268d[_0x2b4c('0x26')](_0x830d7c)['then'](function(_0x2e3a06){return _0x2e3a06;});}return null;};}function removeEntity(_0x417a85,_0x5c437e){return function(_0x3bc9c1){if(_0x3bc9c1){return _0x3bc9c1['destroy']()[_0x2b4c('0x27')](function(){_0x417a85['status'](0xcc)[_0x2b4c('0x1c')]();});}};}function handleEntityNotFound(_0x4e66ce,_0x48aa0a){return function(_0x38d163){if(!_0x38d163){_0x4e66ce['sendStatus'](0x194);}return _0x38d163;};}function handleError(_0x25a7cf,_0x93f24a){_0x93f24a=_0x93f24a||0x1f4;return function(_0x40b940){logger[_0x2b4c('0x28')](_0x40b940[_0x2b4c('0x29')]);if(_0x40b940[_0x2b4c('0x2a')]){delete _0x40b940[_0x2b4c('0x2a')];}_0x25a7cf['status'](_0x93f24a)[_0x2b4c('0x2b')](_0x40b940);};}exports[_0x2b4c('0x2c')]=function(_0xf77b17,_0x189a20){var _0x37f7cb={},_0x1ae3f9={},_0x2fd4b0={'count':0x0,'rows':[]};var _0x28704b=_[_0x2b4c('0x2d')](db[_0x2b4c('0x2e')][_0x2b4c('0x2f')],function(_0x1c9a1b){return{'name':_0x1c9a1b[_0x2b4c('0x30')],'type':_0x1c9a1b[_0x2b4c('0x31')]['key']};});_0x1ae3f9['model']=_[_0x2b4c('0x2d')](_0x28704b,_0x2b4c('0x2a'));_0x1ae3f9['query']=_[_0x2b4c('0x32')](_0xf77b17[_0x2b4c('0x33')]);_0x1ae3f9['filters']=_['intersection'](_0x1ae3f9[_0x2b4c('0x34')],_0x1ae3f9[_0x2b4c('0x33')]);_0x37f7cb[_0x2b4c('0x35')]=_[_0x2b4c('0x36')](_0x1ae3f9['model'],qs[_0x2b4c('0x37')](_0xf77b17[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0x37f7cb[_0x2b4c('0x35')]=_0x37f7cb[_0x2b4c('0x35')][_0x2b4c('0x38')]?_0x37f7cb[_0x2b4c('0x35')]:_0x1ae3f9['model'];if(!_0xf77b17[_0x2b4c('0x33')][_0x2b4c('0x39')]('nolimit')){_0x37f7cb[_0x2b4c('0x1f')]=qs[_0x2b4c('0x1f')](_0xf77b17[_0x2b4c('0x33')]['limit']);_0x37f7cb[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0xf77b17[_0x2b4c('0x33')][_0x2b4c('0x1e')]);}_0x37f7cb[_0x2b4c('0x3a')]=qs[_0x2b4c('0x3b')](_0xf77b17[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x37f7cb[_0x2b4c('0x3c')]=qs[_0x2b4c('0x3d')](_[_0x2b4c('0x3e')](_0xf77b17[_0x2b4c('0x33')],_0x1ae3f9['filters']),_0x28704b);if(_0xf77b17[_0x2b4c('0x33')][_0x2b4c('0x3f')]){_0x37f7cb[_0x2b4c('0x3c')]=_[_0x2b4c('0x40')](_0x37f7cb[_0x2b4c('0x3c')],{'$or':_[_0x2b4c('0x2d')](_0x28704b,function(_0x289afb){if(_0x289afb[_0x2b4c('0x31')]!==_0x2b4c('0x41')){var _0x4ac01d={};_0x4ac01d[_0x289afb['name']]={'$like':'%'+_0xf77b17[_0x2b4c('0x33')][_0x2b4c('0x3f')]+'%'};return _0x4ac01d;}})});}_0x37f7cb=_['merge']({},_0x37f7cb,_0xf77b17[_0x2b4c('0x42')]);var _0x51bb5f={'where':_0x37f7cb[_0x2b4c('0x3c')]};return db[_0x2b4c('0x2e')][_0x2b4c('0x21')](_0x51bb5f)[_0x2b4c('0x27')](function(_0x3f638f){_0x2fd4b0[_0x2b4c('0x21')]=_0x3f638f;if(_0xf77b17['query'][_0x2b4c('0x43')]){_0x37f7cb[_0x2b4c('0x44')]=[{'all':!![]}];}return db[_0x2b4c('0x2e')][_0x2b4c('0x45')](_0x37f7cb);})['then'](function(_0x12d558){_0x2fd4b0[_0x2b4c('0x46')]=_0x12d558;return _0x2fd4b0;})['then'](respondWithFilteredResult(_0x189a20,_0x37f7cb))['catch'](handleError(_0x189a20,null));};exports['show']=function(_0x4dd851,_0x2a3c2e){var _0xbe7f3c={'raw':![],'where':{'id':_0x4dd851['params']['id']}},_0x3cf504={};_0x3cf504[_0x2b4c('0x34')]=_[_0x2b4c('0x32')](db[_0x2b4c('0x2e')]['rawAttributes']);_0x3cf504['query']=_[_0x2b4c('0x32')](_0x4dd851[_0x2b4c('0x33')]);_0x3cf504[_0x2b4c('0x3d')]=_[_0x2b4c('0x36')](_0x3cf504[_0x2b4c('0x34')],_0x3cf504['query']);_0xbe7f3c['attributes']=_[_0x2b4c('0x36')](_0x3cf504[_0x2b4c('0x34')],qs[_0x2b4c('0x37')](_0x4dd851[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0xbe7f3c[_0x2b4c('0x35')]=_0xbe7f3c['attributes'][_0x2b4c('0x38')]?_0xbe7f3c[_0x2b4c('0x35')]:_0x3cf504[_0x2b4c('0x34')];if(_0x4dd851[_0x2b4c('0x33')][_0x2b4c('0x43')]){_0xbe7f3c[_0x2b4c('0x44')]=[{'all':!![]}];}_0xbe7f3c=_[_0x2b4c('0x40')]({},_0xbe7f3c,_0x4dd851[_0x2b4c('0x42')]);return db[_0x2b4c('0x2e')][_0x2b4c('0x47')](_0xbe7f3c)[_0x2b4c('0x27')](handleEntityNotFound(_0x2a3c2e,null))[_0x2b4c('0x27')](respondWithResult(_0x2a3c2e,null))['catch'](handleError(_0x2a3c2e,null));};exports[_0x2b4c('0x48')]=function(_0x4aa4ec,_0x48a4a3){return db[_0x2b4c('0x2e')][_0x2b4c('0x48')](_0x4aa4ec['body'],{})[_0x2b4c('0x27')](respondWithResult(_0x48a4a3,0xc9))['catch'](handleError(_0x48a4a3,null));};exports['update']=function(_0x38f932,_0x3d23a4){if(_0x38f932['body']['id']){delete _0x38f932['body']['id'];}return db['VtigerConfiguration'][_0x2b4c('0x47')]({'where':{'id':_0x38f932['params']['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x3d23a4,null))[_0x2b4c('0x27')](saveUpdates(_0x38f932[_0x2b4c('0x49')],null))['then'](respondWithResult(_0x3d23a4,null))[_0x2b4c('0x4a')](handleError(_0x3d23a4,null));};exports['destroy']=function(_0x400267,_0x30a16b){return db[_0x2b4c('0x2e')]['find']({'where':{'id':_0x400267['params']['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x30a16b,null))[_0x2b4c('0x27')](removeEntity(_0x30a16b,null))['catch'](handleError(_0x30a16b,null));};exports[_0x2b4c('0x4b')]=function(_0x1c951d,_0x44d046,_0x1fee4b){var _0x50c0fd={};var _0x20d62e={};var _0x4a0c8b;var _0x36dfbc;return db['VtigerConfiguration'][_0x2b4c('0x4c')]({'where':{'id':_0x1c951d[_0x2b4c('0x4d')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x44d046,null))['then'](function(_0x25e61e){if(_0x25e61e){_0x4a0c8b=_0x25e61e;_0x20d62e[_0x2b4c('0x34')]=_[_0x2b4c('0x32')](db[_0x2b4c('0x4e')][_0x2b4c('0x2f')]);_0x20d62e['query']=_[_0x2b4c('0x32')](_0x1c951d[_0x2b4c('0x33')]);_0x20d62e['filters']=_[_0x2b4c('0x36')](_0x20d62e[_0x2b4c('0x34')],_0x20d62e[_0x2b4c('0x33')]);_0x50c0fd[_0x2b4c('0x35')]=_['intersection'](_0x20d62e[_0x2b4c('0x34')],qs[_0x2b4c('0x37')](_0x1c951d['query'][_0x2b4c('0x37')]));_0x50c0fd[_0x2b4c('0x35')]=_0x50c0fd[_0x2b4c('0x35')]['length']?_0x50c0fd[_0x2b4c('0x35')]:_0x20d62e[_0x2b4c('0x34')];_0x50c0fd[_0x2b4c('0x3a')]=qs['sort'](_0x1c951d[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x50c0fd[_0x2b4c('0x3c')]=qs[_0x2b4c('0x3d')](_['pick'](_0x1c951d[_0x2b4c('0x33')],_0x20d62e['filters']));if(_0x1c951d['query'][_0x2b4c('0x3f')]){_0x50c0fd['where']=_[_0x2b4c('0x40')](_0x50c0fd[_0x2b4c('0x3c')],{'$or':_[_0x2b4c('0x2d')](_0x50c0fd[_0x2b4c('0x35')],function(_0x2380ee){var _0x91cf95={};_0x91cf95[_0x2380ee]={'$like':'%'+_0x1c951d[_0x2b4c('0x33')][_0x2b4c('0x3f')]+'%'};return _0x91cf95;})});}_0x50c0fd=_['merge']({},_0x50c0fd,_0x1c951d[_0x2b4c('0x42')]);return _0x4a0c8b[_0x2b4c('0x4b')](_0x50c0fd);}})['then'](function(_0x11bc83){if(_0x11bc83){_0x36dfbc=_0x11bc83[_0x2b4c('0x38')];if(!_0x1c951d[_0x2b4c('0x33')][_0x2b4c('0x39')](_0x2b4c('0x4f'))){_0x50c0fd[_0x2b4c('0x1f')]=qs['limit'](_0x1c951d[_0x2b4c('0x33')][_0x2b4c('0x1f')]);_0x50c0fd[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0x1c951d[_0x2b4c('0x33')][_0x2b4c('0x1e')]);}return _0x4a0c8b[_0x2b4c('0x4b')](_0x50c0fd);}})[_0x2b4c('0x27')](function(_0x24e91e){if(_0x24e91e){return _0x24e91e?{'count':_0x36dfbc,'rows':_0x24e91e}:null;}})[_0x2b4c('0x27')](respondWithResult(_0x44d046,null))[_0x2b4c('0x4a')](handleError(_0x44d046,null));};exports[_0x2b4c('0x50')]=function(_0x4ebb5c,_0x56fa22,_0x339599){var _0x583580={};var _0x2578e2={};var _0x5e67e5;var _0x26a65c;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x4ebb5c[_0x2b4c('0x4d')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x56fa22,null))[_0x2b4c('0x27')](function(_0x1df7fa){if(_0x1df7fa){_0x5e67e5=_0x1df7fa;_0x2578e2[_0x2b4c('0x34')]=_['keys'](db[_0x2b4c('0x4e')]['rawAttributes']);_0x2578e2[_0x2b4c('0x33')]=_[_0x2b4c('0x32')](_0x4ebb5c['query']);_0x2578e2['filters']=_[_0x2b4c('0x36')](_0x2578e2['model'],_0x2578e2[_0x2b4c('0x33')]);_0x583580['attributes']=_['intersection'](_0x2578e2[_0x2b4c('0x34')],qs[_0x2b4c('0x37')](_0x4ebb5c[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0x583580[_0x2b4c('0x35')]=_0x583580['attributes'][_0x2b4c('0x38')]?_0x583580[_0x2b4c('0x35')]:_0x2578e2[_0x2b4c('0x34')];_0x583580[_0x2b4c('0x3a')]=qs[_0x2b4c('0x3b')](_0x4ebb5c[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x583580[_0x2b4c('0x3c')]=qs[_0x2b4c('0x3d')](_['pick'](_0x4ebb5c[_0x2b4c('0x33')],_0x2578e2[_0x2b4c('0x3d')]));if(_0x4ebb5c['query'][_0x2b4c('0x3f')]){_0x583580[_0x2b4c('0x3c')]=_[_0x2b4c('0x40')](_0x583580[_0x2b4c('0x3c')],{'$or':_[_0x2b4c('0x2d')](_0x583580[_0x2b4c('0x35')],function(_0x223c4a){var _0x27d637={};_0x27d637[_0x223c4a]={'$like':'%'+_0x4ebb5c[_0x2b4c('0x33')][_0x2b4c('0x3f')]+'%'};return _0x27d637;})});}_0x583580=_[_0x2b4c('0x40')]({},_0x583580,_0x4ebb5c['options']);return _0x5e67e5['getSubjects'](_0x583580);}})[_0x2b4c('0x27')](function(_0x35bffc){if(_0x35bffc){_0x26a65c=_0x35bffc[_0x2b4c('0x38')];if(!_0x4ebb5c[_0x2b4c('0x33')][_0x2b4c('0x39')]('nolimit')){_0x583580[_0x2b4c('0x1f')]=qs[_0x2b4c('0x1f')](_0x4ebb5c[_0x2b4c('0x33')]['limit']);_0x583580[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0x4ebb5c[_0x2b4c('0x33')][_0x2b4c('0x1e')]);}return _0x5e67e5[_0x2b4c('0x50')](_0x583580);}})[_0x2b4c('0x27')](function(_0xbc5450){if(_0xbc5450){return _0xbc5450?{'count':_0x26a65c,'rows':_0xbc5450}:null;}})[_0x2b4c('0x27')](respondWithResult(_0x56fa22,null))['catch'](handleError(_0x56fa22,null));};exports[_0x2b4c('0x51')]=function(_0xb82a8f,_0x104580,_0x361392){var _0x40fa09={};var _0x50fd99={};var _0x194f66;var _0x6e50c3;return db[_0x2b4c('0x2e')]['findOne']({'where':{'id':_0xb82a8f['params']['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x104580,null))['then'](function(_0x1fc3ed){if(_0x1fc3ed){_0x194f66=_0x1fc3ed;_0x50fd99[_0x2b4c('0x34')]=_['keys'](db[_0x2b4c('0x4e')]['rawAttributes']);_0x50fd99[_0x2b4c('0x33')]=_[_0x2b4c('0x32')](_0xb82a8f['query']);_0x50fd99[_0x2b4c('0x3d')]=_['intersection'](_0x50fd99['model'],_0x50fd99[_0x2b4c('0x33')]);_0x40fa09['attributes']=_['intersection'](_0x50fd99[_0x2b4c('0x34')],qs[_0x2b4c('0x37')](_0xb82a8f[_0x2b4c('0x33')]['fields']));_0x40fa09[_0x2b4c('0x35')]=_0x40fa09[_0x2b4c('0x35')][_0x2b4c('0x38')]?_0x40fa09[_0x2b4c('0x35')]:_0x50fd99[_0x2b4c('0x34')];_0x40fa09[_0x2b4c('0x3a')]=qs[_0x2b4c('0x3b')](_0xb82a8f[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x40fa09[_0x2b4c('0x3c')]=qs[_0x2b4c('0x3d')](_[_0x2b4c('0x3e')](_0xb82a8f[_0x2b4c('0x33')],_0x50fd99[_0x2b4c('0x3d')]));if(_0xb82a8f[_0x2b4c('0x33')]['filter']){_0x40fa09['where']=_[_0x2b4c('0x40')](_0x40fa09[_0x2b4c('0x3c')],{'$or':_['map'](_0x40fa09[_0x2b4c('0x35')],function(_0x14da78){var _0x263e67={};_0x263e67[_0x14da78]={'$like':'%'+_0xb82a8f[_0x2b4c('0x33')][_0x2b4c('0x3f')]+'%'};return _0x263e67;})});}_0x40fa09=_[_0x2b4c('0x40')]({},_0x40fa09,_0xb82a8f['options']);return _0x194f66[_0x2b4c('0x51')](_0x40fa09);}})[_0x2b4c('0x27')](function(_0x35a3a3){if(_0x35a3a3){_0x6e50c3=_0x35a3a3[_0x2b4c('0x38')];if(!_0xb82a8f[_0x2b4c('0x33')][_0x2b4c('0x39')]('nolimit')){_0x40fa09[_0x2b4c('0x1f')]=qs[_0x2b4c('0x1f')](_0xb82a8f[_0x2b4c('0x33')]['limit']);_0x40fa09[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0xb82a8f[_0x2b4c('0x33')][_0x2b4c('0x1e')]);}return _0x194f66[_0x2b4c('0x51')](_0x40fa09);}})['then'](function(_0x499177){if(_0x499177){return _0x499177?{'count':_0x6e50c3,'rows':_0x499177}:null;}})[_0x2b4c('0x27')](respondWithResult(_0x104580,null))[_0x2b4c('0x4a')](handleError(_0x104580,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 554294c..a4b7900 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 _0x63ec=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VtigerConfiguration'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x63ec,0x1c8));var _0xc63e=function(_0x4ab38a,_0x45ac90){_0x4ab38a=_0x4ab38a-0x0;var _0x5c8f23=_0x63ec[_0x4ab38a];return _0x5c8f23;};'use strict';var _=require(_0xc63e('0x0'));var util=require(_0xc63e('0x1'));var logger=require(_0xc63e('0x2'))(_0xc63e('0x3'));var moment=require(_0xc63e('0x4'));var BPromise=require(_0xc63e('0x5'));var rp=require(_0xc63e('0x6'));var fs=require('fs');var path=require(_0xc63e('0x7'));var rimraf=require(_0xc63e('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0xc63e('0x9')]=function(_0x358bf7,_0x662564){return _0x358bf7[_0xc63e('0xa')](_0xc63e('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe391=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x175bd3,_0x5c33f9){var _0x4d6e8f=function(_0x4d8a83){while(--_0x4d8a83){_0x175bd3['push'](_0x175bd3['shift']());}};_0x4d6e8f(++_0x5c33f9);}(_0xe391,0x65));var _0x1e39=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xe391[_0x507403];return _0x1327c;};'use strict';var _=require(_0x1e39('0x0'));var util=require(_0x1e39('0x1'));var logger=require(_0x1e39('0x2'))(_0x1e39('0x3'));var moment=require(_0x1e39('0x4'));var BPromise=require(_0x1e39('0x5'));var rp=require(_0x1e39('0x6'));var fs=require('fs');var path=require(_0x1e39('0x7'));var rimraf=require('rimraf');var config=require(_0x1e39('0x8'));var attributes=require(_0x1e39('0x9'));module[_0x1e39('0xa')]=function(_0x3d987e,_0x2d99c7){return _0x3d987e[_0x1e39('0xb')](_0x1e39('0xc'),attributes,{'tableName':_0x1e39('0xd'),'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 1c4f907..37063be 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 _0x2483=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x509083,_0x36dd89){var _0x4f7167=function(_0x13f3d2){while(--_0x13f3d2){_0x509083['push'](_0x509083['shift']());}};_0x4f7167(++_0x36dd89);}(_0x2483,0x131));var _0x3248=function(_0x41974b,_0x2a90b7){_0x41974b=_0x41974b-0x0;var _0x1534e3=_0x2483[_0x41974b];return _0x1534e3;};'use strict';var _=require(_0x3248('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3248('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3248('0x2'));var db=require(_0x3248('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3248('0x4'));var config=require(_0x3248('0x5'));var jayson=require(_0x3248('0x6'));var client=jayson[_0x3248('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e6a24,_0x5c9401,_0x4620f1){return new BPromise(function(_0x4a2b44,_0x1c4ad4){return client[_0x3248('0x8')](_0x2e6a24,_0x4620f1)['then'](function(_0x4423da){logger[_0x3248('0x9')](_0x3248('0xa'),_0x5c9401,_0x3248('0xb'));logger[_0x3248('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5c9401,'request\x20sent',JSON[_0x3248('0xd')](_0x4423da));if(_0x4423da[_0x3248('0xe')]){if(_0x4423da[_0x3248('0xe')][_0x3248('0xf')]===0x1f4){logger['error'](_0x3248('0xa'),_0x5c9401,_0x4423da[_0x3248('0xe')]['message']);return _0x1c4ad4(_0x4423da[_0x3248('0xe')]['message']);}logger['error'](_0x3248('0xa'),_0x5c9401,_0x4423da['error'][_0x3248('0x10')]);return _0x4a2b44(_0x4423da[_0x3248('0xe')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x5c9401,_0x3248('0xb'));_0x4a2b44(_0x4423da['result'][_0x3248('0x10')]);}})[_0x3248('0x11')](function(_0x47fea5){logger[_0x3248('0xe')](_0x3248('0xa'),_0x5c9401,_0x47fea5);_0x1c4ad4(_0x47fea5);});});} \ No newline at end of file +var _0xa057=['error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa057,0x71));var _0x7a05=function(_0x4d78f3,_0x52e922){_0x4d78f3=_0x4d78f3-0x0;var _0x5f3cae=_0xa057[_0x4d78f3];return _0x5f3cae;};'use strict';var _=require(_0x7a05('0x0'));var util=require('util');var moment=require(_0x7a05('0x1'));var BPromise=require(_0x7a05('0x2'));var rs=require(_0x7a05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7a05('0x4'))(_0x7a05('0x5'));var config=require('../../config/environment');var jayson=require(_0x7a05('0x6'));var client=jayson[_0x7a05('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xebf832,_0x929e19,_0x2b3711){return new BPromise(function(_0x5197dc,_0x3eb475){return client[_0x7a05('0x8')](_0xebf832,_0x2b3711)[_0x7a05('0x9')](function(_0x5e3877){logger[_0x7a05('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x929e19,_0x7a05('0xb'));logger[_0x7a05('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x929e19,_0x7a05('0xb'),JSON['stringify'](_0x5e3877));if(_0x5e3877[_0x7a05('0xd')]){if(_0x5e3877[_0x7a05('0xd')][_0x7a05('0xe')]===0x1f4){logger[_0x7a05('0xd')](_0x7a05('0xf'),_0x929e19,_0x5e3877[_0x7a05('0xd')][_0x7a05('0x10')]);return _0x3eb475(_0x5e3877[_0x7a05('0xd')][_0x7a05('0x10')]);}logger[_0x7a05('0xd')](_0x7a05('0xf'),_0x929e19,_0x5e3877[_0x7a05('0xd')]['message']);return _0x5197dc(_0x5e3877[_0x7a05('0xd')][_0x7a05('0x10')]);}else{logger[_0x7a05('0xa')](_0x7a05('0xf'),_0x929e19,_0x7a05('0xb'));_0x5197dc(_0x5e3877['result'][_0x7a05('0x10')]);}})[_0x7a05('0x11')](function(_0x2350ba){logger['error'](_0x7a05('0xf'),_0x929e19,_0x2350ba);_0x3eb475(_0x2350ba);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7f2a5f6..25de4b1 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 _0x6515=['express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','multer','util','path','connect-timeout'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6515,0xa1));var _0x5651=function(_0x362b91,_0x480b94){_0x362b91=_0x362b91-0x0;var _0x2e54fd=_0x6515[_0x362b91];return _0x2e54fd;};'use strict';var multer=require(_0x5651('0x0'));var util=require(_0x5651('0x1'));var path=require(_0x5651('0x2'));var timeout=require(_0x5651('0x3'));var express=require(_0x5651('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5651('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5651('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x5651('0x7')](),controller[_0x5651('0x8')]);router[_0x5651('0x9')](_0x5651('0xa'),auth[_0x5651('0x7')](),controller[_0x5651('0xb')]);router[_0x5651('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5651('0xd')](_0x5651('0xa'),auth['isAuthenticated'](),controller[_0x5651('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfee5=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','update','delete','destroy','exports','path'];(function(_0x230227,_0x59cfc4){var _0x5ce780=function(_0x40e585){while(--_0x40e585){_0x230227['push'](_0x230227['shift']());}};_0x5ce780(++_0x59cfc4);}(_0xfee5,0x10f));var _0x5fee=function(_0x4f3678,_0x4c4bf3){_0x4f3678=_0x4f3678-0x0;var _0x46f59e=_0xfee5[_0x4f3678];return _0x46f59e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5fee('0x0'));var timeout=require(_0x5fee('0x1'));var express=require(_0x5fee('0x2'));var router=express[_0x5fee('0x3')]();var fs_extra=require(_0x5fee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5fee('0x5'));var config=require(_0x5fee('0x6'));var controller=require('./intVtigerField.controller');router[_0x5fee('0x7')]('/',auth['isAuthenticated'](),controller[_0x5fee('0x8')]);router['get'](_0x5fee('0x9'),auth[_0x5fee('0xa')](),controller[_0x5fee('0xb')]);router[_0x5fee('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x5fee('0xa')](),controller[_0x5fee('0xd')]);router[_0x5fee('0xe')]('/:id',auth[_0x5fee('0xa')](),controller[_0x5fee('0xf')]);module[_0x5fee('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 737e961..3f054b6 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 _0x6e2f=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x54a228,_0x3d27f0){var _0x8b8c13=function(_0x4083a8){while(--_0x4083a8){_0x54a228['push'](_0x54a228['shift']());}};_0x8b8c13(++_0x3d27f0);}(_0x6e2f,0x1af));var _0xf6e2=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6e2f[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0xf6e2('0x0'));module[_0xf6e2('0x1')]={'type':{'type':Sequelize[_0xf6e2('0x2')](_0xf6e2('0x3'),_0xf6e2('0x4'),_0xf6e2('0x5'),_0xf6e2('0x6'),_0xf6e2('0x7')),'defaultValue':_0xf6e2('0x3')},'content':{'type':Sequelize[_0xf6e2('0x8')]},'key':{'type':Sequelize[_0xf6e2('0x8')]},'keyType':{'type':Sequelize[_0xf6e2('0x2')](_0xf6e2('0x3'),'variable',_0xf6e2('0x5'))},'keyContent':{'type':Sequelize[_0xf6e2('0x8')]},'idField':{'type':Sequelize[_0xf6e2('0x8')]},'nameField':{'type':Sequelize[_0xf6e2('0x8')]},'customField':{'type':Sequelize[_0xf6e2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6e2('0x8')]}}; \ No newline at end of file +var _0x4a72=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4a72,0x1d1));var _0x24a7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4a72[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x24a7('0x0'));module[_0x24a7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x24a7('0x2'),_0x24a7('0x3'),_0x24a7('0x4'),_0x24a7('0x5'),_0x24a7('0x6')),'defaultValue':_0x24a7('0x2')},'content':{'type':Sequelize[_0x24a7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x24a7('0x8')](_0x24a7('0x2'),_0x24a7('0x3'),_0x24a7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x24a7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x24a7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x24a7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6d2779d..d6574ca 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 _0x28c7=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','end','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','keys','filters','intersection','attributes','fields','query','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','then','include','findAll','rows','catch','show','includeAll','find','create','body','destroy','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x60e21b,_0x5bc9bf){var _0x279a12=function(_0x23c0d0){while(--_0x23c0d0){_0x60e21b['push'](_0x60e21b['shift']());}};_0x279a12(++_0x5bc9bf);}(_0x28c7,0x1d2));var _0x728c=function(_0x31e0a6,_0xd2993c){_0x31e0a6=_0x31e0a6-0x0;var _0x33c0a5=_0x28c7[_0x31e0a6];return _0x33c0a5;};'use strict';var emlformat=require(_0x728c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x728c('0x1'));var rp=require(_0x728c('0x2'));var moment=require(_0x728c('0x3'));var BPromise=require(_0x728c('0x4'));var Mustache=require(_0x728c('0x5'));var util=require('util');var path=require(_0x728c('0x6'));var sox=require(_0x728c('0x7'));var csv=require(_0x728c('0x8'));var ejs=require(_0x728c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x728c('0xa'));var squel=require(_0x728c('0xb'));var crypto=require('crypto');var jsforce=require(_0x728c('0xc'));var deskjs=require(_0x728c('0xd'));var toCsv=require(_0x728c('0x8'));var querystring=require(_0x728c('0xe'));var Papa=require(_0x728c('0xf'));var Redis=require(_0x728c('0x10'));var authService=require(_0x728c('0x11'));var qs=require(_0x728c('0x12'));var as=require(_0x728c('0x13'));var hardwareService=require(_0x728c('0x14'));var logger=require(_0x728c('0x15'))('api');var utils=require(_0x728c('0x16'));var config=require(_0x728c('0x17'));var licenseUtil=require(_0x728c('0x18'));var db=require(_0x728c('0x19'))['db'];function respondWithStatusCode(_0x1e8736,_0x19c026){_0x19c026=_0x19c026||0xcc;return function(_0x59b826){if(_0x59b826){return _0x1e8736[_0x728c('0x1a')](_0x19c026);}return _0x1e8736[_0x728c('0x1b')](_0x19c026)['end']();};}function respondWithResult(_0x5bc4b5,_0x4a70ed){_0x4a70ed=_0x4a70ed||0xc8;return function(_0x3aed79){if(_0x3aed79){return _0x5bc4b5['status'](_0x4a70ed)[_0x728c('0x1c')](_0x3aed79);}};}function respondWithFilteredResult(_0x550743,_0x3f607e){return function(_0x36fd3b){if(_0x36fd3b){var _0x39752c=typeof _0x3f607e['offset']==='undefined'&&typeof _0x3f607e[_0x728c('0x1d')]===_0x728c('0x1e');var _0x5f5c3e=_0x36fd3b['count'];var _0x100eca=_0x39752c?0x0:_0x3f607e[_0x728c('0x1f')];var _0x10e310=_0x39752c?_0x36fd3b['count']:_0x3f607e[_0x728c('0x1f')]+_0x3f607e[_0x728c('0x1d')];var _0x55904d;if(_0x10e310>=_0x5f5c3e){_0x10e310=_0x5f5c3e;_0x55904d=0xc8;}else{_0x55904d=0xce;}_0x550743[_0x728c('0x1b')](_0x55904d);return _0x550743[_0x728c('0x20')](_0x728c('0x21'),_0x100eca+'-'+_0x10e310+'/'+_0x5f5c3e)[_0x728c('0x1c')](_0x36fd3b);}return null;};}function patchUpdates(_0x4d9eb9){return function(_0x46396e){try{jsonpatch[_0x728c('0x22')](_0x46396e,_0x4d9eb9,!![]);}catch(_0x1719e5){return BPromise[_0x728c('0x23')](_0x1719e5);}return _0x46396e[_0x728c('0x24')]();};}function saveUpdates(_0x476f89,_0x9352c9){return function(_0x15d424){if(_0x15d424){return _0x15d424[_0x728c('0x25')](_0x476f89)['then'](function(_0x4a0dc2){return _0x4a0dc2;});}return null;};}function removeEntity(_0x616eb6,_0x4cb2be){return function(_0xfee230){if(_0xfee230){return _0xfee230['destroy']()['then'](function(){_0x616eb6[_0x728c('0x1b')](0xcc)[_0x728c('0x26')]();});}};}function handleEntityNotFound(_0x40f92e,_0x1704cf){return function(_0x89c97b){if(!_0x89c97b){_0x40f92e[_0x728c('0x1a')](0x194);}return _0x89c97b;};}function handleError(_0x42d335,_0x695fe0){_0x695fe0=_0x695fe0||0x1f4;return function(_0x5226b2){logger['error'](_0x5226b2[_0x728c('0x27')]);if(_0x5226b2[_0x728c('0x28')]){delete _0x5226b2[_0x728c('0x28')];}_0x42d335[_0x728c('0x1b')](_0x695fe0)[_0x728c('0x29')](_0x5226b2);};}exports['index']=function(_0x357e3e,_0x1187a3){var _0x5ba1dc={},_0x5a81e2={},_0x201ac5={'count':0x0,'rows':[]};var _0x1c6d1f=_[_0x728c('0x2a')](db[_0x728c('0x2b')][_0x728c('0x2c')],function(_0x1b8f27){return{'name':_0x1b8f27[_0x728c('0x2d')],'type':_0x1b8f27[_0x728c('0x2e')][_0x728c('0x2f')]};});_0x5a81e2['model']=_[_0x728c('0x2a')](_0x1c6d1f,_0x728c('0x28'));_0x5a81e2['query']=_[_0x728c('0x30')](_0x357e3e['query']);_0x5a81e2[_0x728c('0x31')]=_[_0x728c('0x32')](_0x5a81e2['model'],_0x5a81e2['query']);_0x5ba1dc[_0x728c('0x33')]=_[_0x728c('0x32')](_0x5a81e2['model'],qs[_0x728c('0x34')](_0x357e3e[_0x728c('0x35')]['fields']));_0x5ba1dc[_0x728c('0x33')]=_0x5ba1dc['attributes'][_0x728c('0x36')]?_0x5ba1dc[_0x728c('0x33')]:_0x5a81e2[_0x728c('0x37')];if(!_0x357e3e[_0x728c('0x35')][_0x728c('0x38')](_0x728c('0x39'))){_0x5ba1dc[_0x728c('0x1d')]=qs[_0x728c('0x1d')](_0x357e3e[_0x728c('0x35')][_0x728c('0x1d')]);_0x5ba1dc['offset']=qs[_0x728c('0x1f')](_0x357e3e[_0x728c('0x35')][_0x728c('0x1f')]);}_0x5ba1dc[_0x728c('0x3a')]=qs[_0x728c('0x3b')](_0x357e3e[_0x728c('0x35')]['sort']);_0x5ba1dc[_0x728c('0x3c')]=qs[_0x728c('0x31')](_[_0x728c('0x3d')](_0x357e3e[_0x728c('0x35')],_0x5a81e2[_0x728c('0x31')]),_0x1c6d1f);if(_0x357e3e[_0x728c('0x35')][_0x728c('0x3e')]){_0x5ba1dc[_0x728c('0x3c')]=_[_0x728c('0x3f')](_0x5ba1dc['where'],{'$or':_[_0x728c('0x2a')](_0x1c6d1f,function(_0xf8977f){if(_0xf8977f[_0x728c('0x2e')]!==_0x728c('0x40')){var _0x127a88={};_0x127a88[_0xf8977f[_0x728c('0x28')]]={'$like':'%'+_0x357e3e['query'][_0x728c('0x3e')]+'%'};return _0x127a88;}})});}_0x5ba1dc=_[_0x728c('0x3f')]({},_0x5ba1dc,_0x357e3e[_0x728c('0x41')]);var _0x5f0ff4={'where':_0x5ba1dc[_0x728c('0x3c')]};return db[_0x728c('0x2b')][_0x728c('0x42')](_0x5f0ff4)[_0x728c('0x43')](function(_0x5af02a){_0x201ac5[_0x728c('0x42')]=_0x5af02a;if(_0x357e3e[_0x728c('0x35')]['includeAll']){_0x5ba1dc[_0x728c('0x44')]=[{'all':!![]}];}return db[_0x728c('0x2b')][_0x728c('0x45')](_0x5ba1dc);})[_0x728c('0x43')](function(_0x467001){_0x201ac5[_0x728c('0x46')]=_0x467001;return _0x201ac5;})[_0x728c('0x43')](respondWithFilteredResult(_0x1187a3,_0x5ba1dc))[_0x728c('0x47')](handleError(_0x1187a3,null));};exports[_0x728c('0x48')]=function(_0x33fa78,_0x49152e){var _0x509d15={'raw':!![],'where':{'id':_0x33fa78['params']['id']}},_0x5c31d5={};_0x5c31d5[_0x728c('0x37')]=_['keys'](db['VtigerField']['rawAttributes']);_0x5c31d5['query']=_[_0x728c('0x30')](_0x33fa78[_0x728c('0x35')]);_0x5c31d5[_0x728c('0x31')]=_[_0x728c('0x32')](_0x5c31d5[_0x728c('0x37')],_0x5c31d5['query']);_0x509d15[_0x728c('0x33')]=_[_0x728c('0x32')](_0x5c31d5[_0x728c('0x37')],qs[_0x728c('0x34')](_0x33fa78['query']['fields']));_0x509d15[_0x728c('0x33')]=_0x509d15[_0x728c('0x33')][_0x728c('0x36')]?_0x509d15[_0x728c('0x33')]:_0x5c31d5[_0x728c('0x37')];if(_0x33fa78['query'][_0x728c('0x49')]){_0x509d15[_0x728c('0x44')]=[{'all':!![]}];}_0x509d15=_[_0x728c('0x3f')]({},_0x509d15,_0x33fa78[_0x728c('0x41')]);return db[_0x728c('0x2b')][_0x728c('0x4a')](_0x509d15)['then'](handleEntityNotFound(_0x49152e,null))[_0x728c('0x43')](respondWithResult(_0x49152e,null))['catch'](handleError(_0x49152e,null));};exports[_0x728c('0x4b')]=function(_0x16c531,_0x838b89){return db[_0x728c('0x2b')][_0x728c('0x4b')](_0x16c531['body'],{})[_0x728c('0x43')](respondWithResult(_0x838b89,0xc9))[_0x728c('0x47')](handleError(_0x838b89,null));};exports[_0x728c('0x25')]=function(_0x3081bd,_0x54a40c){if(_0x3081bd['body']['id']){delete _0x3081bd[_0x728c('0x4c')]['id'];}return db[_0x728c('0x2b')][_0x728c('0x4a')]({'where':{'id':_0x3081bd['params']['id']}})[_0x728c('0x43')](handleEntityNotFound(_0x54a40c,null))['then'](saveUpdates(_0x3081bd[_0x728c('0x4c')],null))[_0x728c('0x43')](respondWithResult(_0x54a40c,null))[_0x728c('0x47')](handleError(_0x54a40c,null));};exports[_0x728c('0x4d')]=function(_0x37b236,_0x2d52c9){return db[_0x728c('0x2b')][_0x728c('0x4a')]({'where':{'id':_0x37b236[_0x728c('0x4e')]['id']}})[_0x728c('0x43')](handleEntityNotFound(_0x2d52c9,null))['then'](removeEntity(_0x2d52c9,null))[_0x728c('0x47')](handleError(_0x2d52c9,null));}; \ No newline at end of file +var _0x3c8b=['include','rows','catch','params','rawAttributes','fields','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','destroy','end','stack','name','send','index','map','VtigerField','key','model','keys','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x2f5232,_0x58debd){var _0x46a04b=function(_0x298780){while(--_0x298780){_0x2f5232['push'](_0x2f5232['shift']());}};_0x46a04b(++_0x58debd);}(_0x3c8b,0x96));var _0xb3c8=function(_0xff4a41,_0x39cc00){_0xff4a41=_0xff4a41-0x0;var _0x75d316=_0x3c8b[_0xff4a41];return _0x75d316;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c8('0x0'));var zipdir=require(_0xb3c8('0x1'));var jsonpatch=require(_0xb3c8('0x2'));var rp=require(_0xb3c8('0x3'));var moment=require('moment');var BPromise=require(_0xb3c8('0x4'));var Mustache=require(_0xb3c8('0x5'));var util=require('util');var path=require(_0xb3c8('0x6'));var sox=require(_0xb3c8('0x7'));var csv=require('to-csv');var ejs=require(_0xb3c8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3c8('0x9'));var squel=require(_0xb3c8('0xa'));var crypto=require(_0xb3c8('0xb'));var jsforce=require(_0xb3c8('0xc'));var deskjs=require(_0xb3c8('0xd'));var toCsv=require(_0xb3c8('0xe'));var querystring=require(_0xb3c8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3c8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3c8('0x11'));var logger=require(_0xb3c8('0x12'))(_0xb3c8('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb3c8('0x14'));var db=require(_0xb3c8('0x15'))['db'];function respondWithStatusCode(_0x1a9ac7,_0xe2b671){_0xe2b671=_0xe2b671||0xcc;return function(_0x2084ea){if(_0x2084ea){return _0x1a9ac7[_0xb3c8('0x16')](_0xe2b671);}return _0x1a9ac7[_0xb3c8('0x17')](_0xe2b671)['end']();};}function respondWithResult(_0x37cb34,_0x1348ba){_0x1348ba=_0x1348ba||0xc8;return function(_0x13f803){if(_0x13f803){return _0x37cb34[_0xb3c8('0x17')](_0x1348ba)['json'](_0x13f803);}};}function respondWithFilteredResult(_0x345746,_0x3c5522){return function(_0x261c5c){if(_0x261c5c){var _0x4ea64d=typeof _0x3c5522[_0xb3c8('0x18')]==='undefined'&&typeof _0x3c5522[_0xb3c8('0x19')]===_0xb3c8('0x1a');var _0x2e799e=_0x261c5c[_0xb3c8('0x1b')];var _0x176162=_0x4ea64d?0x0:_0x3c5522[_0xb3c8('0x18')];var _0x2242c2=_0x4ea64d?_0x261c5c[_0xb3c8('0x1b')]:_0x3c5522['offset']+_0x3c5522[_0xb3c8('0x19')];var _0x3d2cc5;if(_0x2242c2>=_0x2e799e){_0x2242c2=_0x2e799e;_0x3d2cc5=0xc8;}else{_0x3d2cc5=0xce;}_0x345746['status'](_0x3d2cc5);return _0x345746[_0xb3c8('0x1c')]('Content-Range',_0x176162+'-'+_0x2242c2+'/'+_0x2e799e)[_0xb3c8('0x1d')](_0x261c5c);}return null;};}function patchUpdates(_0xb459da){return function(_0x5dcd8b){try{jsonpatch[_0xb3c8('0x1e')](_0x5dcd8b,_0xb459da,!![]);}catch(_0x3d9f89){return BPromise['reject'](_0x3d9f89);}return _0x5dcd8b[_0xb3c8('0x1f')]();};}function saveUpdates(_0x14c555,_0x32daf0){return function(_0x31c717){if(_0x31c717){return _0x31c717[_0xb3c8('0x20')](_0x14c555)[_0xb3c8('0x21')](function(_0x4f089a){return _0x4f089a;});}return null;};}function removeEntity(_0x585cea,_0x422b6b){return function(_0x351e21){if(_0x351e21){return _0x351e21[_0xb3c8('0x22')]()[_0xb3c8('0x21')](function(){_0x585cea[_0xb3c8('0x17')](0xcc)[_0xb3c8('0x23')]();});}};}function handleEntityNotFound(_0x42e3c0,_0xf002d1){return function(_0x4f4fa3){if(!_0x4f4fa3){_0x42e3c0['sendStatus'](0x194);}return _0x4f4fa3;};}function handleError(_0x1b7f5e,_0x2fbebd){_0x2fbebd=_0x2fbebd||0x1f4;return function(_0x44a692){logger['error'](_0x44a692[_0xb3c8('0x24')]);if(_0x44a692[_0xb3c8('0x25')]){delete _0x44a692[_0xb3c8('0x25')];}_0x1b7f5e['status'](_0x2fbebd)[_0xb3c8('0x26')](_0x44a692);};}exports[_0xb3c8('0x27')]=function(_0x24b05d,_0x262a3e){var _0x217887={},_0x4ed08f={},_0x465219={'count':0x0,'rows':[]};var _0x21ecdf=_[_0xb3c8('0x28')](db[_0xb3c8('0x29')]['rawAttributes'],function(_0x1e07f3){return{'name':_0x1e07f3['fieldName'],'type':_0x1e07f3['type'][_0xb3c8('0x2a')]};});_0x4ed08f[_0xb3c8('0x2b')]=_[_0xb3c8('0x28')](_0x21ecdf,_0xb3c8('0x25'));_0x4ed08f['query']=_[_0xb3c8('0x2c')](_0x24b05d[_0xb3c8('0x2d')]);_0x4ed08f['filters']=_[_0xb3c8('0x2e')](_0x4ed08f[_0xb3c8('0x2b')],_0x4ed08f[_0xb3c8('0x2d')]);_0x217887[_0xb3c8('0x2f')]=_[_0xb3c8('0x2e')](_0x4ed08f[_0xb3c8('0x2b')],qs['fields'](_0x24b05d[_0xb3c8('0x2d')]['fields']));_0x217887[_0xb3c8('0x2f')]=_0x217887[_0xb3c8('0x2f')]['length']?_0x217887[_0xb3c8('0x2f')]:_0x4ed08f[_0xb3c8('0x2b')];if(!_0x24b05d['query'][_0xb3c8('0x30')]('nolimit')){_0x217887[_0xb3c8('0x19')]=qs[_0xb3c8('0x19')](_0x24b05d[_0xb3c8('0x2d')][_0xb3c8('0x19')]);_0x217887[_0xb3c8('0x18')]=qs[_0xb3c8('0x18')](_0x24b05d[_0xb3c8('0x2d')][_0xb3c8('0x18')]);}_0x217887[_0xb3c8('0x31')]=qs['sort'](_0x24b05d[_0xb3c8('0x2d')][_0xb3c8('0x32')]);_0x217887[_0xb3c8('0x33')]=qs[_0xb3c8('0x34')](_[_0xb3c8('0x35')](_0x24b05d[_0xb3c8('0x2d')],_0x4ed08f[_0xb3c8('0x34')]),_0x21ecdf);if(_0x24b05d[_0xb3c8('0x2d')][_0xb3c8('0x36')]){_0x217887['where']=_[_0xb3c8('0x37')](_0x217887[_0xb3c8('0x33')],{'$or':_['map'](_0x21ecdf,function(_0x2bba96){if(_0x2bba96[_0xb3c8('0x38')]!==_0xb3c8('0x39')){var _0x597293={};_0x597293[_0x2bba96[_0xb3c8('0x25')]]={'$like':'%'+_0x24b05d[_0xb3c8('0x2d')][_0xb3c8('0x36')]+'%'};return _0x597293;}})});}_0x217887=_[_0xb3c8('0x37')]({},_0x217887,_0x24b05d[_0xb3c8('0x3a')]);var _0x386964={'where':_0x217887[_0xb3c8('0x33')]};return db['VtigerField'][_0xb3c8('0x1b')](_0x386964)['then'](function(_0x29fc9e){_0x465219['count']=_0x29fc9e;if(_0x24b05d['query'][_0xb3c8('0x3b')]){_0x217887[_0xb3c8('0x3c')]=[{'all':!![]}];}return db[_0xb3c8('0x29')]['findAll'](_0x217887);})['then'](function(_0x48a444){_0x465219[_0xb3c8('0x3d')]=_0x48a444;return _0x465219;})['then'](respondWithFilteredResult(_0x262a3e,_0x217887))[_0xb3c8('0x3e')](handleError(_0x262a3e,null));};exports['show']=function(_0xe2bace,_0x1f74be){var _0x127fc5={'raw':!![],'where':{'id':_0xe2bace[_0xb3c8('0x3f')]['id']}},_0x21e3c2={};_0x21e3c2[_0xb3c8('0x2b')]=_['keys'](db['VtigerField'][_0xb3c8('0x40')]);_0x21e3c2[_0xb3c8('0x2d')]=_['keys'](_0xe2bace[_0xb3c8('0x2d')]);_0x21e3c2['filters']=_[_0xb3c8('0x2e')](_0x21e3c2[_0xb3c8('0x2b')],_0x21e3c2[_0xb3c8('0x2d')]);_0x127fc5[_0xb3c8('0x2f')]=_['intersection'](_0x21e3c2[_0xb3c8('0x2b')],qs[_0xb3c8('0x41')](_0xe2bace[_0xb3c8('0x2d')]['fields']));_0x127fc5[_0xb3c8('0x2f')]=_0x127fc5[_0xb3c8('0x2f')][_0xb3c8('0x42')]?_0x127fc5['attributes']:_0x21e3c2[_0xb3c8('0x2b')];if(_0xe2bace[_0xb3c8('0x2d')]['includeAll']){_0x127fc5['include']=[{'all':!![]}];}_0x127fc5=_[_0xb3c8('0x37')]({},_0x127fc5,_0xe2bace['options']);return db[_0xb3c8('0x29')][_0xb3c8('0x43')](_0x127fc5)[_0xb3c8('0x21')](handleEntityNotFound(_0x1f74be,null))[_0xb3c8('0x21')](respondWithResult(_0x1f74be,null))[_0xb3c8('0x3e')](handleError(_0x1f74be,null));};exports[_0xb3c8('0x44')]=function(_0x405f9e,_0x5f9a54){return db['VtigerField']['create'](_0x405f9e[_0xb3c8('0x45')],{})['then'](respondWithResult(_0x5f9a54,0xc9))[_0xb3c8('0x3e')](handleError(_0x5f9a54,null));};exports[_0xb3c8('0x20')]=function(_0x5ad19e,_0x32247e){if(_0x5ad19e[_0xb3c8('0x45')]['id']){delete _0x5ad19e[_0xb3c8('0x45')]['id'];}return db[_0xb3c8('0x29')][_0xb3c8('0x43')]({'where':{'id':_0x5ad19e['params']['id']}})['then'](handleEntityNotFound(_0x32247e,null))['then'](saveUpdates(_0x5ad19e[_0xb3c8('0x45')],null))[_0xb3c8('0x21')](respondWithResult(_0x32247e,null))[_0xb3c8('0x3e')](handleError(_0x32247e,null));};exports[_0xb3c8('0x22')]=function(_0x30a439,_0x13ee22){return db[_0xb3c8('0x29')][_0xb3c8('0x43')]({'where':{'id':_0x30a439[_0xb3c8('0x3f')]['id']}})[_0xb3c8('0x21')](handleEntityNotFound(_0x13ee22,null))[_0xb3c8('0x21')](removeEntity(_0x13ee22,null))[_0xb3c8('0x3e')](handleError(_0x13ee22,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ff1febf..bcc6c3f 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 _0x1a66=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','idField','FieldId','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x1a66,0x149));var _0x61a6=function(_0x3faeda,_0x482d96){_0x3faeda=_0x3faeda-0x0;var _0x447642=_0x1a66[_0x3faeda];return _0x447642;};'use strict';var _=require('lodash');var util=require(_0x61a6('0x0'));var logger=require('../../config/logger')(_0x61a6('0x1'));var moment=require(_0x61a6('0x2'));var BPromise=require(_0x61a6('0x3'));var rp=require(_0x61a6('0x4'));var fs=require('fs');var path=require(_0x61a6('0x5'));var rimraf=require(_0x61a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x61a6('0x7'));module[_0x61a6('0x8')]=function(_0x3b68fd,_0x19bad4){return _0x3b68fd[_0x61a6('0x9')](_0x61a6('0xa'),attributes,{'tableName':_0x61a6('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x61a6('0xc'),_0x61a6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x076d=['idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','define','VtigerField','vtiger_unique_index'];(function(_0x15f917,_0x26ef6e){var _0x571326=function(_0x101f7c){while(--_0x101f7c){_0x15f917['push'](_0x15f917['shift']());}};_0x571326(++_0x26ef6e);}(_0x076d,0x1d6));var _0xd076=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x076d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd076('0x0'));var util=require('util');var logger=require(_0xd076('0x1'))(_0xd076('0x2'));var moment=require(_0xd076('0x3'));var BPromise=require('bluebird');var rp=require(_0xd076('0x4'));var fs=require('fs');var path=require(_0xd076('0x5'));var rimraf=require(_0xd076('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x2fd5dd,_0xa26631){return _0x2fd5dd[_0xd076('0x7')](_0xd076('0x8'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xd076('0x9'),'fields':[_0xd076('0xa'),_0xd076('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 a6a65bc..ece49cd 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 _0x6ac9=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x53de91,_0x2b530e){var _0x249606=function(_0x20e428){while(--_0x20e428){_0x53de91['push'](_0x53de91['shift']());}};_0x249606(++_0x2b530e);}(_0x6ac9,0x112));var _0x96ac=function(_0x2f3fd1,_0xa4f117){_0x2f3fd1=_0x2f3fd1-0x0;var _0x3fc1c1=_0x6ac9[_0x2f3fd1];return _0x3fc1c1;};'use strict';var _=require(_0x96ac('0x0'));var util=require(_0x96ac('0x1'));var moment=require(_0x96ac('0x2'));var BPromise=require(_0x96ac('0x3'));var rs=require(_0x96ac('0x4'));var fs=require('fs');var Redis=require(_0x96ac('0x5'));var db=require(_0x96ac('0x6'))['db'];var utils=require(_0x96ac('0x7'));var logger=require(_0x96ac('0x8'))(_0x96ac('0x9'));var config=require(_0x96ac('0xa'));var jayson=require(_0x96ac('0xb'));var client=jayson[_0x96ac('0xc')][_0x96ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35a26d,_0x2dbbc6,_0x4d1e3e){return new BPromise(function(_0x41c422,_0x314399){return client[_0x96ac('0xe')](_0x35a26d,_0x4d1e3e)[_0x96ac('0xf')](function(_0x593c23){logger[_0x96ac('0x10')](_0x96ac('0x11'),_0x2dbbc6,'request\x20sent');logger[_0x96ac('0x12')](_0x96ac('0x13'),_0x2dbbc6,_0x96ac('0x14'),JSON[_0x96ac('0x15')](_0x593c23));if(_0x593c23[_0x96ac('0x16')]){if(_0x593c23['error'][_0x96ac('0x17')]===0x1f4){logger[_0x96ac('0x16')](_0x96ac('0x11'),_0x2dbbc6,_0x593c23[_0x96ac('0x16')][_0x96ac('0x18')]);return _0x314399(_0x593c23[_0x96ac('0x16')][_0x96ac('0x18')]);}logger[_0x96ac('0x16')](_0x96ac('0x11'),_0x2dbbc6,_0x593c23['error']['message']);return _0x41c422(_0x593c23[_0x96ac('0x16')]['message']);}else{logger['info'](_0x96ac('0x11'),_0x2dbbc6,_0x96ac('0x14'));_0x41c422(_0x593c23[_0x96ac('0x19')][_0x96ac('0x18')]);}})['catch'](function(_0xb9d083){logger['error']('VtigerField,\x20%s,\x20%s',_0x2dbbc6,_0xb9d083);_0x314399(_0xb9d083);});});} \ No newline at end of file +var _0xabdb=['stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x351a3a,_0x26b064){var _0x523f7a=function(_0x122d70){while(--_0x122d70){_0x351a3a['push'](_0x351a3a['shift']());}};_0x523f7a(++_0x26b064);}(_0xabdb,0xbe));var _0xbabd=function(_0x12f9f7,_0x17aac7){_0x12f9f7=_0x12f9f7-0x0;var _0x22f3bd=_0xabdb[_0x12f9f7];return _0x22f3bd;};'use strict';var _=require('lodash');var util=require(_0xbabd('0x0'));var moment=require(_0xbabd('0x1'));var BPromise=require(_0xbabd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbabd('0x3'));var db=require(_0xbabd('0x4'))['db'];var utils=require(_0xbabd('0x5'));var logger=require(_0xbabd('0x6'))(_0xbabd('0x7'));var config=require('../../config/environment');var jayson=require(_0xbabd('0x8'));var client=jayson[_0xbabd('0x9')][_0xbabd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x127968,_0x2d1fa3,_0x1e1538){return new BPromise(function(_0x345d0d,_0x4d1ec2){return client['request'](_0x127968,_0x1e1538)[_0xbabd('0xb')](function(_0x5136bd){logger[_0xbabd('0xc')](_0xbabd('0xd'),_0x2d1fa3,_0xbabd('0xe'));logger[_0xbabd('0xf')](_0xbabd('0x10'),_0x2d1fa3,'request\x20sent',JSON[_0xbabd('0x11')](_0x5136bd));if(_0x5136bd[_0xbabd('0x12')]){if(_0x5136bd[_0xbabd('0x12')][_0xbabd('0x13')]===0x1f4){logger[_0xbabd('0x12')](_0xbabd('0xd'),_0x2d1fa3,_0x5136bd[_0xbabd('0x12')][_0xbabd('0x14')]);return _0x4d1ec2(_0x5136bd['error'][_0xbabd('0x14')]);}logger['error'](_0xbabd('0xd'),_0x2d1fa3,_0x5136bd[_0xbabd('0x12')][_0xbabd('0x14')]);return _0x345d0d(_0x5136bd[_0xbabd('0x12')]['message']);}else{logger[_0xbabd('0xc')](_0xbabd('0xd'),_0x2d1fa3,_0xbabd('0xe'));_0x345d0d(_0x5136bd[_0xbabd('0x15')][_0xbabd('0x14')]);}})[_0xbabd('0x16')](function(_0x21dfd7){logger['error'](_0xbabd('0xd'),_0x2d1fa3,_0x21dfd7);_0x4d1ec2(_0x21dfd7);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8529424..1ebf618 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 _0x10c9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x19a490,_0x4627d9){var _0x52081c=function(_0x418ba5){while(--_0x418ba5){_0x19a490['push'](_0x19a490['shift']());}};_0x52081c(++_0x4627d9);}(_0x10c9,0xc0));var _0x910c=function(_0x3caca9,_0x38f3fe){_0x3caca9=_0x3caca9-0x0;var _0x2a0468=_0x10c9[_0x3caca9];return _0x2a0468;};'use strict';var multer=require(_0x910c('0x0'));var util=require(_0x910c('0x1'));var path=require(_0x910c('0x2'));var timeout=require(_0x910c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x910c('0x4'));var auth=require(_0x910c('0x5'));var interaction=require(_0x910c('0x6'));var config=require(_0x910c('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x910c('0x8')]('/',auth[_0x910c('0x9')](),controller[_0x910c('0xa')]);router['get'](_0x910c('0xb'),auth['isAuthenticated'](),controller[_0x910c('0xc')]);router[_0x910c('0x8')]('/:id/configurations',auth[_0x910c('0x9')](),controller[_0x910c('0xd')]);router['get']('/:id/fields',auth[_0x910c('0x9')](),controller[_0x910c('0xe')]);router[_0x910c('0xf')]('/',auth['isAuthenticated'](),controller[_0x910c('0x10')]);router[_0x910c('0xf')](_0x910c('0x11'),auth['isAuthenticated'](),controller[_0x910c('0x12')]);router[_0x910c('0x13')](_0x910c('0xb'),auth[_0x910c('0x9')](),controller[_0x910c('0x14')]);router[_0x910c('0x15')]('/:id',auth[_0x910c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xac4b=['/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xac4b,0x145));var _0xbac4=function(_0x4c36ac,_0x342bb5){_0x4c36ac=_0x4c36ac-0x0;var _0x5096ed=_0xac4b[_0x4c36ac];return _0x5096ed;};'use strict';var multer=require(_0xbac4('0x0'));var util=require(_0xbac4('0x1'));var path=require(_0xbac4('0x2'));var timeout=require(_0xbac4('0x3'));var express=require(_0xbac4('0x4'));var router=express[_0xbac4('0x5')]();var fs_extra=require(_0xbac4('0x6'));var auth=require(_0xbac4('0x7'));var interaction=require(_0xbac4('0x8'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xbac4('0x9')]('/',auth[_0xbac4('0xa')](),controller[_0xbac4('0xb')]);router[_0xbac4('0x9')]('/:id',auth[_0xbac4('0xa')](),controller[_0xbac4('0xc')]);router[_0xbac4('0x9')](_0xbac4('0xd'),auth[_0xbac4('0xa')](),controller[_0xbac4('0xe')]);router[_0xbac4('0x9')]('/:id/fields',auth[_0xbac4('0xa')](),controller[_0xbac4('0xf')]);router[_0xbac4('0x10')]('/',auth[_0xbac4('0xa')](),controller[_0xbac4('0x11')]);router['post'](_0xbac4('0xd'),auth[_0xbac4('0xa')](),controller[_0xbac4('0x12')]);router[_0xbac4('0x13')](_0xbac4('0x14'),auth[_0xbac4('0xa')](),controller[_0xbac4('0x15')]);router['delete'](_0xbac4('0x14'),auth[_0xbac4('0xa')](),controller['destroy']);module[_0xbac4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 8e7946d..1ce5072 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 _0x7524=['username','ENUM','password','token','integrationTab','newTab','exports','STRING'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7524,0xce));var _0x4752=function(_0x155c31,_0x15c292){_0x155c31=_0x155c31-0x0;var _0x4f503e=_0x7524[_0x155c31];return _0x4f503e;};'use strict';var Sequelize=require('sequelize');module[_0x4752('0x0')]={'name':{'type':Sequelize[_0x4752('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4752('0x1')],'unique':_0x4752('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4752('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x4752('0x3')](_0x4752('0x4'),_0x4752('0x5')),'defaultValue':_0x4752('0x4')},'serverUrl':{'type':Sequelize[_0x4752('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4752('0x6'),_0x4752('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc0d7=['integrationTab','STRING','username','remoteUri','ENUM','password'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x3859dc,_0x3840f3){_0x3859dc=_0x3859dc-0x0;var _0x2e6935=_0xc0d7[_0x3859dc];return _0x2e6935;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7c0d('0x0')]},'username':{'type':Sequelize[_0x7c0d('0x0')],'unique':_0x7c0d('0x1')},'password':{'type':Sequelize[_0x7c0d('0x0')]},'token':{'type':Sequelize[_0x7c0d('0x0')]},'remoteUri':{'type':Sequelize[_0x7c0d('0x0')],'unique':_0x7c0d('0x2')},'authType':{'type':Sequelize[_0x7c0d('0x3')](_0x7c0d('0x4'),'token'),'defaultValue':_0x7c0d('0x4')},'serverUrl':{'type':Sequelize[_0x7c0d('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x7c0d('0x3')](_0x7c0d('0x5'),'newTab'),'defaultValue':_0x7c0d('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4fcdade..658fb29 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 _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x29fefa,_0x3c9ba0){var _0x530b05=function(_0xc21842){while(--_0xc21842){_0x29fefa['push'](_0x29fefa['shift']());}};_0x530b05(++_0x3c9ba0);}(_0xd87e,0x1bf));var _0xed87=function(_0x4b634f,_0x4c0372){_0x4b634f=_0x4b634f-0x0;var _0x302e3c=_0xd87e[_0x4b634f];return _0x302e3c;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file +var _0x5c00=['getDescriptions','username','token','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','password','%s:%s','toString','headers','format','Basic\x20%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','options','find','catch','create','body','destroy','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','channel'];(function(_0x178f9c,_0x9dc87a){var _0x413f4a=function(_0xfe1042){while(--_0xfe1042){_0x178f9c['push'](_0x178f9c['shift']());}};_0x413f4a(++_0x9dc87a);}(_0x5c00,0x17e));var _0x05c0=function(_0x1dad4f,_0x13b837){_0x1dad4f=_0x1dad4f-0x0;var _0x22468b=_0x5c00[_0x1dad4f];return _0x22468b;};'use strict';var emlformat=require(_0x05c0('0x0'));var rimraf=require(_0x05c0('0x1'));var zipdir=require(_0x05c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c0('0x3'));var moment=require('moment');var BPromise=require(_0x05c0('0x4'));var Mustache=require(_0x05c0('0x5'));var util=require(_0x05c0('0x6'));var path=require(_0x05c0('0x7'));var sox=require('sox');var csv=require(_0x05c0('0x8'));var ejs=require(_0x05c0('0x9'));var fs=require('fs');var fs_extra=require(_0x05c0('0xa'));var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var licenseUtil=require(_0x05c0('0x17'));var db=require(_0x05c0('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e39d4,_0x5eec41){_0x5eec41=_0x5eec41||0xcc;return function(_0x16a290){if(_0x16a290){return _0x4e39d4[_0x05c0('0x19')](_0x5eec41);}return _0x4e39d4[_0x05c0('0x1a')](_0x5eec41)[_0x05c0('0x1b')]();};}function respondWithResult(_0x25764b,_0xe57ed0){_0xe57ed0=_0xe57ed0||0xc8;return function(_0x331799){if(_0x331799){return _0x25764b[_0x05c0('0x1a')](_0xe57ed0)['json'](_0x331799);}};}function respondWithFilteredResult(_0x238e25,_0x161a5f){return function(_0x4bb164){if(_0x4bb164){var _0x29e6b0=typeof _0x161a5f[_0x05c0('0x1c')]===_0x05c0('0x1d')&&typeof _0x161a5f[_0x05c0('0x1e')]===_0x05c0('0x1d');var _0x38f994=_0x4bb164['count'];var _0x422401=_0x29e6b0?0x0:_0x161a5f[_0x05c0('0x1c')];var _0x4613c0=_0x29e6b0?_0x4bb164['count']:_0x161a5f[_0x05c0('0x1c')]+_0x161a5f[_0x05c0('0x1e')];var _0x10685b;if(_0x4613c0>=_0x38f994){_0x4613c0=_0x38f994;_0x10685b=0xc8;}else{_0x10685b=0xce;}_0x238e25[_0x05c0('0x1a')](_0x10685b);return _0x238e25[_0x05c0('0x1f')]('Content-Range',_0x422401+'-'+_0x4613c0+'/'+_0x38f994)[_0x05c0('0x20')](_0x4bb164);}return null;};}function patchUpdates(_0x1014ef){return function(_0x5313b0){try{jsonpatch['apply'](_0x5313b0,_0x1014ef,!![]);}catch(_0x5e4b80){return BPromise[_0x05c0('0x21')](_0x5e4b80);}return _0x5313b0[_0x05c0('0x22')]();};}function saveUpdates(_0x83f29,_0x8e2d4){return function(_0x5b3acb){if(_0x5b3acb){return _0x5b3acb[_0x05c0('0x23')](_0x83f29)[_0x05c0('0x24')](function(_0x5b4eef){return _0x5b4eef;});}return null;};}function removeEntity(_0x9b4930,_0x1abbf3){return function(_0x4ba978){if(_0x4ba978){return _0x4ba978['destroy']()['then'](function(){_0x9b4930['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df135,_0x15b497){return function(_0x48b56f){if(!_0x48b56f){_0x3df135[_0x05c0('0x19')](0x194);}return _0x48b56f;};}function handleError(_0x336e1b,_0x3617dc){_0x3617dc=_0x3617dc||0x1f4;return function(_0x889c75){logger['error'](_0x889c75[_0x05c0('0x25')]);if(_0x889c75[_0x05c0('0x26')]){delete _0x889c75[_0x05c0('0x26')];}_0x336e1b[_0x05c0('0x1a')](_0x3617dc)[_0x05c0('0x27')](_0x889c75);};}exports[_0x05c0('0x28')]=function(_0x57886b,_0x56ba64){var _0x2df109={},_0xbe7d9e={},_0x2053d5={'count':0x0,'rows':[]};var _0xd6574e=_[_0x05c0('0x29')](db[_0x05c0('0x2a')][_0x05c0('0x2b')],function(_0x3c9eb1){return{'name':_0x3c9eb1[_0x05c0('0x2c')],'type':_0x3c9eb1[_0x05c0('0x2d')][_0x05c0('0x2e')]};});_0xbe7d9e[_0x05c0('0x2f')]=_['map'](_0xd6574e,'name');_0xbe7d9e[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x57886b[_0x05c0('0x30')]);_0xbe7d9e['filters']=_[_0x05c0('0x32')](_0xbe7d9e[_0x05c0('0x2f')],_0xbe7d9e['query']);_0x2df109[_0x05c0('0x33')]=_['intersection'](_0xbe7d9e[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x34')]));_0x2df109[_0x05c0('0x33')]=_0x2df109[_0x05c0('0x33')][_0x05c0('0x35')]?_0x2df109[_0x05c0('0x33')]:_0xbe7d9e[_0x05c0('0x2f')];if(!_0x57886b[_0x05c0('0x30')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x2df109[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x2df109[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1c')]);}_0x2df109[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x39')]);_0x2df109[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x57886b[_0x05c0('0x30')],_0xbe7d9e[_0x05c0('0x3b')]),_0xd6574e);if(_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]){_0x2df109[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x2df109['where'],{'$or':_[_0x05c0('0x29')](_0xd6574e,function(_0x249101){if(_0x249101[_0x05c0('0x2d')]!==_0x05c0('0x3f')){var _0x49f829={};_0x49f829[_0x249101['name']]={'$like':'%'+_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x49f829;}})});}_0x2df109=_[_0x05c0('0x3e')]({},_0x2df109,_0x57886b['options']);var _0x29dc87={'where':_0x2df109[_0x05c0('0x3a')]};return db[_0x05c0('0x2a')][_0x05c0('0x40')](_0x29dc87)['then'](function(_0x152c6a){_0x2053d5[_0x05c0('0x40')]=_0x152c6a;if(_0x57886b['query'][_0x05c0('0x41')]){_0x2df109[_0x05c0('0x42')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x43')](_0x2df109);})[_0x05c0('0x24')](function(_0x398a6e){_0x2053d5[_0x05c0('0x44')]=_0x398a6e;return _0x2053d5;})['then'](respondWithFilteredResult(_0x56ba64,_0x2df109))['catch'](handleError(_0x56ba64,null));};exports[_0x05c0('0x45')]=function(_0x1d1d94,_0xaa5d53){var _0x11f079={'raw':![],'where':{'id':_0x1d1d94['params']['id']}},_0x14aba3={};_0x14aba3[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x2a')][_0x05c0('0x2b')]);_0x14aba3[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x1d1d94[_0x05c0('0x30')]);_0x14aba3['filters']=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],_0x14aba3[_0x05c0('0x30')]);_0x11f079[_0x05c0('0x33')]=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x34')]));_0x11f079[_0x05c0('0x33')]=_0x11f079[_0x05c0('0x33')]['length']?_0x11f079['attributes']:_0x14aba3[_0x05c0('0x2f')];if(_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x41')]){_0x11f079[_0x05c0('0x42')]=[{'all':!![]}];}_0x11f079=_[_0x05c0('0x3e')]({},_0x11f079,_0x1d1d94[_0x05c0('0x46')]);return db['ZendeskAccount'][_0x05c0('0x47')](_0x11f079)[_0x05c0('0x24')](handleEntityNotFound(_0xaa5d53,null))[_0x05c0('0x24')](respondWithResult(_0xaa5d53,null))[_0x05c0('0x48')](handleError(_0xaa5d53,null));};exports['create']=function(_0x34e94e,_0x2440e8){return db[_0x05c0('0x2a')][_0x05c0('0x49')](_0x34e94e['body'],{})[_0x05c0('0x24')](respondWithResult(_0x2440e8,0xc9))[_0x05c0('0x48')](handleError(_0x2440e8,null));};exports[_0x05c0('0x23')]=function(_0x9b521b,_0x5ef6cf){if(_0x9b521b[_0x05c0('0x4a')]['id']){delete _0x9b521b[_0x05c0('0x4a')]['id'];}return db['ZendeskAccount'][_0x05c0('0x47')]({'where':{'id':_0x9b521b['params']['id']}})['then'](handleEntityNotFound(_0x5ef6cf,null))[_0x05c0('0x24')](saveUpdates(_0x9b521b['body'],null))[_0x05c0('0x24')](respondWithResult(_0x5ef6cf,null))[_0x05c0('0x48')](handleError(_0x5ef6cf,null));};exports[_0x05c0('0x4b')]=function(_0x371aff,_0x3ccae9){return db[_0x05c0('0x2a')]['find']({'where':{'id':_0x371aff[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ccae9,null))[_0x05c0('0x24')](removeEntity(_0x3ccae9,null))[_0x05c0('0x48')](handleError(_0x3ccae9,null));};exports[_0x05c0('0x4d')]=function(_0x13ad38,_0x1496d4,_0x37ad50){var _0x156087={};var _0x551b7b={};var _0x5215b4;var _0x523153;return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x13ad38['params']['id']}})['then'](handleEntityNotFound(_0x1496d4,null))[_0x05c0('0x24')](function(_0x1a72d6){if(_0x1a72d6){_0x5215b4=_0x1a72d6;_0x551b7b[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x4f')][_0x05c0('0x2b')]);_0x551b7b[_0x05c0('0x30')]=_['keys'](_0x13ad38[_0x05c0('0x30')]);_0x551b7b[_0x05c0('0x3b')]=_[_0x05c0('0x32')](_0x551b7b[_0x05c0('0x2f')],_0x551b7b['query']);_0x156087[_0x05c0('0x33')]=_['intersection'](_0x551b7b[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x13ad38['query'][_0x05c0('0x34')]));_0x156087['attributes']=_0x156087[_0x05c0('0x33')][_0x05c0('0x35')]?_0x156087[_0x05c0('0x33')]:_0x551b7b[_0x05c0('0x2f')];_0x156087[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x13ad38['query'][_0x05c0('0x39')]);_0x156087[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x13ad38[_0x05c0('0x30')],_0x551b7b[_0x05c0('0x3b')]));if(_0x13ad38['query'][_0x05c0('0x3d')]){_0x156087[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x156087[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x156087[_0x05c0('0x33')],function(_0xf5e123){var _0x866523={};_0x866523[_0xf5e123]={'$like':'%'+_0x13ad38[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x866523;})});}_0x156087=_[_0x05c0('0x3e')]({},_0x156087,_0x13ad38[_0x05c0('0x46')]);return _0x5215b4['getConfigurations'](_0x156087);}})['then'](function(_0x5269b4){if(_0x5269b4){_0x523153=_0x5269b4[_0x05c0('0x35')];if(!_0x13ad38[_0x05c0('0x30')][_0x05c0('0x36')]('nolimit')){_0x156087[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x13ad38[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x156087[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x13ad38[_0x05c0('0x30')]['offset']);}return _0x5215b4[_0x05c0('0x4d')](_0x156087);}})[_0x05c0('0x24')](function(_0x355b44){if(_0x355b44){return _0x355b44?{'count':_0x523153,'rows':_0x355b44}:null;}})[_0x05c0('0x24')](respondWithResult(_0x1496d4,null))['catch'](handleError(_0x1496d4,null));};exports['addConfiguration']=function(_0x5e4941,_0x3b74c5,_0x2b8a13){if(_0x5e4941[_0x05c0('0x4a')]['id']){delete _0x5e4941[_0x05c0('0x4a')]['id'];}return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x5e4941[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b74c5,null))[_0x05c0('0x24')](function(_0x225397){if(_0x225397){_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x50')]=_0x225397['id'];_0x5e4941[_0x05c0('0x4a')]['Subjects']=integrations['getSubjects'](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body'][_0x05c0('0x2d')]);_0x5e4941['body']['Descriptions']=integrations[_0x05c0('0x52')](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body']['type']);return db[_0x05c0('0x4f')][_0x05c0('0x49')](_0x5e4941[_0x05c0('0x4a')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3b74c5,null))[_0x05c0('0x48')](handleError(_0x3b74c5,null));};exports['getFields']=function(_0x496acf,_0x5bb9ef,_0xd7a2f3){var _0x1a6dc4='';return db[_0x05c0('0x2a')]['findOne']({'where':{'id':_0x496acf[_0x05c0('0x4c')]['id']},'attributes':['id',_0x05c0('0x53'),'password',_0x05c0('0x54'),_0x05c0('0x55'),_0x05c0('0x56')]})[_0x05c0('0x24')](handleEntityNotFound(_0x5bb9ef,null))['then'](function(_0x35ef76){if(_0x35ef76){_0x1a6dc4=_0x35ef76[_0x05c0('0x56')];var _0xc150e3=_0x1a6dc4[_0x05c0('0x57')](-0x1);if(_0xc150e3==='/'){_0x1a6dc4=_0x1a6dc4[_0x05c0('0x58')](0x0,_0x1a6dc4['lastIndexOf'](_0xc150e3));}var _0x4aee38={'method':_0x05c0('0x59'),'uri':util['format'](_0x05c0('0x5a'),_0x1a6dc4,_0x05c0('0x5b')),'json':!![]};switch(_0x35ef76['authType']){case _0x05c0('0x5c'):_0x4aee38['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x05c0('0x5d'),_0x35ef76[_0x05c0('0x53')],_0x35ef76[_0x05c0('0x5c')]))[_0x05c0('0x5e')]('base64'))};break;case _0x05c0('0x54'):_0x4aee38[_0x05c0('0x5f')]={'Authorization':util[_0x05c0('0x60')](_0x05c0('0x61'),new Buffer(util[_0x05c0('0x60')]('%s/token:%s',_0x35ef76[_0x05c0('0x53')],_0x35ef76['token']))['toString'](_0x05c0('0x62')))};break;default:throw new db[(_0x05c0('0x63'))][(_0x05c0('0x64'))](_0x05c0('0x65'));}return rp(_0x4aee38);}})[_0x05c0('0x24')](function(_0x4577ee){if(_0x4577ee){var _0x4c3c73=['subject',_0x05c0('0x66'),_0x05c0('0x67'),_0x05c0('0x68')];_['remove'](_0x4577ee[_0x05c0('0x5b')],function(_0x7c5ce6){return _0x4c3c73[_0x05c0('0x69')](_0x7c5ce6[_0x05c0('0x2d')]);});return{'count':_0x4577ee[_0x05c0('0x5b')][_0x05c0('0x35')],'rows':_['map'](_0x4577ee[_0x05c0('0x5b')],function(_0x464ae0){return{'id':_0x464ae0['id'],'name':_0x464ae0['position']>0x7?_0x464ae0[_0x05c0('0x6a')]:_0x464ae0[_0x05c0('0x2d')],'custom':_0x464ae0['position']>0x7?!![]:![],'options':_0x464ae0[_0x05c0('0x6b')]?_0x464ae0[_0x05c0('0x6b')]:_0x464ae0[_0x05c0('0x6c')]?_0x464ae0[_0x05c0('0x6c')]:[]};})};}})[_0x05c0('0x24')](respondWithResult(_0x5bb9ef,null))[_0x05c0('0x48')](function(_0x544d6c){var _0x63f20=_0x496acf['query'][_0x05c0('0x6d')]?0x1f4:_0x544d6c[_0x05c0('0x6e')]||0x1f4;logger[_0x05c0('0x6f')](_0x05c0('0x70'),_0x05c0('0x71'),_0x63f20,JSON[_0x05c0('0x72')](_0x544d6c));delete _0x544d6c[_0x05c0('0x26')];if(_0x63f20===0x191){_0x63f20=0x190;}_0x5bb9ef[_0x05c0('0x1a')](_0x63f20)[_0x05c0('0x27')](_0x496acf[_0x05c0('0x30')]['test']?{'message':_0x05c0('0x73'),'statusCode':_0x544d6c['statusCode']}:_0x544d6c);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 60d020b..aa5c957 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 _0xe131=['../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x17468b,_0x4e5cce){var _0x4d0e42=function(_0x5f24c3){while(--_0x5f24c3){_0x17468b['push'](_0x17468b['shift']());}};_0x4d0e42(++_0x4e5cce);}(_0xe131,0xbc));var _0x1e13=function(_0x5387a3,_0x28ea66){_0x5387a3=_0x5387a3-0x0;var _0x3eb246=_0xe131[_0x5387a3];return _0x3eb246;};'use strict';var _=require(_0x1e13('0x0'));var util=require(_0x1e13('0x1'));var logger=require('../../config/logger')(_0x1e13('0x2'));var moment=require(_0x1e13('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e13('0x4'));var fs=require('fs');var path=require(_0x1e13('0x5'));var rimraf=require(_0x1e13('0x6'));var config=require(_0x1e13('0x7'));var attributes=require(_0x1e13('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x1e13('0x9')]=function(_0xbc8055,_0x3cc33e){return _0xbc8055[_0x1e13('0xa')](_0x1e13('0xb'),attributes,{'tableName':_0x1e13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cb5=['ZendeskAccount','int_zendesk_accounts','lodash','api','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2e1b7f,_0x37a3b9){var _0x3a2d38=function(_0x406fe6){while(--_0x406fe6){_0x2e1b7f['push'](_0x2e1b7f['shift']());}};_0x3a2d38(++_0x37a3b9);}(_0x5cb5,0x18e));var _0x55cb=function(_0x33d68b,_0x521331){_0x33d68b=_0x33d68b-0x0;var _0x41ff94=_0x5cb5[_0x33d68b];return _0x41ff94;};'use strict';var _=require(_0x55cb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x55cb('0x1'));var moment=require('moment');var BPromise=require(_0x55cb('0x2'));var rp=require(_0x55cb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x55cb('0x4'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x55cb('0x5'));module[_0x55cb('0x6')]=function(_0x2f971a,_0x4c31ea){return _0x2f971a['define'](_0x55cb('0x7'),attributes,{'tableName':_0x55cb('0x8'),'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 6a2af4b..bfc54da 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 _0xa477=['message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZendeskAccount,\x20%s,\x20%s'];(function(_0x264f21,_0x5e815a){var _0x78896c=function(_0x4f6e88){while(--_0x4f6e88){_0x264f21['push'](_0x264f21['shift']());}};_0x78896c(++_0x5e815a);}(_0xa477,0x9c));var _0x7a47=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa477[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require(_0x7a47('0x2'));var BPromise=require(_0x7a47('0x3'));var rs=require(_0x7a47('0x4'));var fs=require('fs');var Redis=require(_0x7a47('0x5'));var db=require(_0x7a47('0x6'))['db'];var utils=require(_0x7a47('0x7'));var logger=require('../../config/logger')(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fe0a1,_0xe75d1a,_0x5728e5){return new BPromise(function(_0x1940d8,_0x242f63){return client[_0x7a47('0xb')](_0x2fe0a1,_0x5728e5)['then'](function(_0x5b24b4){logger[_0x7a47('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0xe75d1a,'request\x20sent');logger[_0x7a47('0xd')](_0x7a47('0xe'),_0xe75d1a,_0x7a47('0xf'),JSON[_0x7a47('0x10')](_0x5b24b4));if(_0x5b24b4[_0x7a47('0x11')]){if(_0x5b24b4['error']['code']===0x1f4){logger[_0x7a47('0x11')](_0x7a47('0x12'),_0xe75d1a,_0x5b24b4['error']['message']);return _0x242f63(_0x5b24b4['error'][_0x7a47('0x13')]);}logger[_0x7a47('0x11')](_0x7a47('0x12'),_0xe75d1a,_0x5b24b4[_0x7a47('0x11')][_0x7a47('0x13')]);return _0x1940d8(_0x5b24b4[_0x7a47('0x11')]['message']);}else{logger[_0x7a47('0xc')](_0x7a47('0x12'),_0xe75d1a,'request\x20sent');_0x1940d8(_0x5b24b4['result'][_0x7a47('0x13')]);}})[_0x7a47('0x14')](function(_0x3d9671){logger[_0x7a47('0x11')](_0x7a47('0x12'),_0xe75d1a,_0x3d9671);_0x242f63(_0x3d9671);});});}exports[_0x7a47('0x15')]=function(_0x1b9b84){var _0x2c1336=this;return new Promise(function(_0x51880e,_0x315a36){return db[_0x7a47('0x16')][_0x7a47('0x17')]({'raw':_0x1b9b84[_0x7a47('0x18')]?_0x1b9b84[_0x7a47('0x18')][_0x7a47('0x19')]===undefined?!![]:![]:!![],'where':_0x1b9b84[_0x7a47('0x18')]?_0x1b9b84['options'][_0x7a47('0x1a')]||null:null,'attributes':_0x1b9b84[_0x7a47('0x18')]?_0x1b9b84[_0x7a47('0x18')][_0x7a47('0x1b')]||null:null,'limit':_0x1b9b84['options']?_0x1b9b84[_0x7a47('0x18')][_0x7a47('0x1c')]||null:null,'include':_0x1b9b84[_0x7a47('0x18')]?_0x1b9b84[_0x7a47('0x18')][_0x7a47('0x1d')]?_[_0x7a47('0x1e')](_0x1b9b84[_0x7a47('0x18')][_0x7a47('0x1d')],function(_0x4ac746){return{'model':db[_0x4ac746[_0x7a47('0x1f')]],'as':_0x4ac746['as'],'attributes':_0x4ac746[_0x7a47('0x1b')],'include':_0x4ac746[_0x7a47('0x1d')]?_['map'](_0x4ac746[_0x7a47('0x1d')],function(_0x53f777){return{'model':db[_0x53f777[_0x7a47('0x1f')]],'as':_0x53f777['as'],'attributes':_0x53f777['attributes'],'include':_0x53f777[_0x7a47('0x1d')]?_[_0x7a47('0x1e')](_0x53f777[_0x7a47('0x1d')],function(_0x5bc11a){return{'model':db[_0x5bc11a['model']],'as':_0x5bc11a['as'],'attributes':_0x5bc11a[_0x7a47('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7a47('0x20')](function(_0x272499){logger[_0x7a47('0xc')](_0x7a47('0x15'),_0x1b9b84);logger[_0x7a47('0xd')](_0x7a47('0x15'),_0x1b9b84,JSON['stringify'](_0x272499));_0x51880e(_0x272499);})['catch'](function(_0x57480e){logger['error'](_0x7a47('0x15'),_0x57480e[_0x7a47('0x13')],_0x1b9b84);_0x315a36(_0x2c1336[_0x7a47('0x11')](0x1f4,_0x57480e[_0x7a47('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x4d9091){var _0x543351=this;return new Promise(function(_0x3fff9f,_0x2a68a0){return db[_0x7a47('0x16')][_0x7a47('0x21')]({'raw':_0x4d9091[_0x7a47('0x18')]?_0x4d9091[_0x7a47('0x18')][_0x7a47('0x19')]===undefined?!![]:![]:!![],'where':_0x4d9091[_0x7a47('0x18')]?_0x4d9091['options'][_0x7a47('0x1a')]||null:null,'attributes':_0x4d9091[_0x7a47('0x18')]?_0x4d9091[_0x7a47('0x18')][_0x7a47('0x1b')]||null:null,'include':_0x4d9091[_0x7a47('0x18')]?_0x4d9091['options'][_0x7a47('0x1d')]?_[_0x7a47('0x1e')](_0x4d9091['options'][_0x7a47('0x1d')],function(_0x3b0cc5){return{'model':db[_0x3b0cc5[_0x7a47('0x1f')]],'as':_0x3b0cc5['as'],'attributes':_0x3b0cc5[_0x7a47('0x1b')],'include':_0x3b0cc5['include']?_[_0x7a47('0x1e')](_0x3b0cc5[_0x7a47('0x1d')],function(_0x564f4f){return{'model':db[_0x564f4f[_0x7a47('0x1f')]],'as':_0x564f4f['as'],'attributes':_0x564f4f['attributes'],'include':_0x564f4f[_0x7a47('0x1d')]?_[_0x7a47('0x1e')](_0x564f4f[_0x7a47('0x1d')],function(_0x42e357){return{'model':db[_0x42e357['model']],'as':_0x42e357['as'],'attributes':_0x42e357['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a47('0x20')](function(_0x3a9462){logger[_0x7a47('0xc')](_0x7a47('0x22'),_0x4d9091);logger[_0x7a47('0xd')](_0x7a47('0x22'),_0x4d9091,JSON[_0x7a47('0x10')](_0x3a9462));_0x3fff9f(_0x3a9462);})[_0x7a47('0x14')](function(_0x304dd2){logger['error'](_0x7a47('0x22'),_0x304dd2[_0x7a47('0x13')],_0x4d9091);_0x2a68a0(_0x543351[_0x7a47('0x11')](0x1f4,_0x304dd2[_0x7a47('0x13')]));});});}; \ No newline at end of file +var _0x2d1b=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ZendeskAccount','options','raw','attributes','map','include','model','GetZendeskAccount','stringify','find','ShowZendeskAccount','lodash','util','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2d1b,0x1bf));var _0xb2d1=function(_0x356f04,_0x14d24a){_0x356f04=_0x356f04-0x0;var _0x448dc9=_0x2d1b[_0x356f04];return _0x448dc9;};'use strict';var _=require(_0xb2d1('0x0'));var util=require(_0xb2d1('0x1'));var moment=require(_0xb2d1('0x2'));var BPromise=require(_0xb2d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2d1('0x4'))['db'];var utils=require(_0xb2d1('0x5'));var logger=require('../../config/logger')(_0xb2d1('0x6'));var config=require(_0xb2d1('0x7'));var jayson=require(_0xb2d1('0x8'));var client=jayson['client'][_0xb2d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3698b6,_0x449071,_0x536731){return new BPromise(function(_0x394fdb,_0x3401c7){return client['request'](_0x3698b6,_0x536731)[_0xb2d1('0xa')](function(_0x592420){logger[_0xb2d1('0xb')](_0xb2d1('0xc'),_0x449071,'request\x20sent');logger[_0xb2d1('0xd')](_0xb2d1('0xe'),_0x449071,'request\x20sent',JSON['stringify'](_0x592420));if(_0x592420['error']){if(_0x592420[_0xb2d1('0xf')][_0xb2d1('0x10')]===0x1f4){logger[_0xb2d1('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x449071,_0x592420['error']['message']);return _0x3401c7(_0x592420[_0xb2d1('0xf')]['message']);}logger[_0xb2d1('0xf')](_0xb2d1('0xc'),_0x449071,_0x592420[_0xb2d1('0xf')][_0xb2d1('0x11')]);return _0x394fdb(_0x592420[_0xb2d1('0xf')][_0xb2d1('0x11')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x449071,'request\x20sent');_0x394fdb(_0x592420['result'][_0xb2d1('0x11')]);}})[_0xb2d1('0x12')](function(_0x3ef291){logger['error'](_0xb2d1('0xc'),_0x449071,_0x3ef291);_0x3401c7(_0x3ef291);});});}exports['GetZendeskAccount']=function(_0x43c955){var _0x14083b=this;return new Promise(function(_0x1c6e63,_0x248758){return db[_0xb2d1('0x13')]['findAll']({'raw':_0x43c955[_0xb2d1('0x14')]?_0x43c955[_0xb2d1('0x14')][_0xb2d1('0x15')]===undefined?!![]:![]:!![],'where':_0x43c955[_0xb2d1('0x14')]?_0x43c955[_0xb2d1('0x14')]['where']||null:null,'attributes':_0x43c955[_0xb2d1('0x14')]?_0x43c955[_0xb2d1('0x14')][_0xb2d1('0x16')]||null:null,'limit':_0x43c955[_0xb2d1('0x14')]?_0x43c955[_0xb2d1('0x14')]['limit']||null:null,'include':_0x43c955[_0xb2d1('0x14')]?_0x43c955[_0xb2d1('0x14')]['include']?_[_0xb2d1('0x17')](_0x43c955[_0xb2d1('0x14')][_0xb2d1('0x18')],function(_0x5372a4){return{'model':db[_0x5372a4[_0xb2d1('0x19')]],'as':_0x5372a4['as'],'attributes':_0x5372a4[_0xb2d1('0x16')],'include':_0x5372a4[_0xb2d1('0x18')]?_['map'](_0x5372a4[_0xb2d1('0x18')],function(_0x4dd383){return{'model':db[_0x4dd383[_0xb2d1('0x19')]],'as':_0x4dd383['as'],'attributes':_0x4dd383[_0xb2d1('0x16')],'include':_0x4dd383[_0xb2d1('0x18')]?_[_0xb2d1('0x17')](_0x4dd383[_0xb2d1('0x18')],function(_0x1a3aec){return{'model':db[_0x1a3aec[_0xb2d1('0x19')]],'as':_0x1a3aec['as'],'attributes':_0x1a3aec['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2d1('0xa')](function(_0x4828f6){logger['info'](_0xb2d1('0x1a'),_0x43c955);logger[_0xb2d1('0xd')]('GetZendeskAccount',_0x43c955,JSON[_0xb2d1('0x1b')](_0x4828f6));_0x1c6e63(_0x4828f6);})[_0xb2d1('0x12')](function(_0x552d35){logger[_0xb2d1('0xf')](_0xb2d1('0x1a'),_0x552d35['message'],_0x43c955);_0x248758(_0x14083b[_0xb2d1('0xf')](0x1f4,_0x552d35[_0xb2d1('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x19ece3){var _0x316b60=this;return new Promise(function(_0x85b129,_0x17d394){return db['ZendeskAccount'][_0xb2d1('0x1c')]({'raw':_0x19ece3[_0xb2d1('0x14')]?_0x19ece3[_0xb2d1('0x14')][_0xb2d1('0x15')]===undefined?!![]:![]:!![],'where':_0x19ece3[_0xb2d1('0x14')]?_0x19ece3['options']['where']||null:null,'attributes':_0x19ece3[_0xb2d1('0x14')]?_0x19ece3['options']['attributes']||null:null,'include':_0x19ece3['options']?_0x19ece3[_0xb2d1('0x14')][_0xb2d1('0x18')]?_['map'](_0x19ece3[_0xb2d1('0x14')][_0xb2d1('0x18')],function(_0x3a635a){return{'model':db[_0x3a635a['model']],'as':_0x3a635a['as'],'attributes':_0x3a635a['attributes'],'include':_0x3a635a[_0xb2d1('0x18')]?_[_0xb2d1('0x17')](_0x3a635a['include'],function(_0x18db9c){return{'model':db[_0x18db9c[_0xb2d1('0x19')]],'as':_0x18db9c['as'],'attributes':_0x18db9c['attributes'],'include':_0x18db9c['include']?_[_0xb2d1('0x17')](_0x18db9c[_0xb2d1('0x18')],function(_0x15028e){return{'model':db[_0x15028e[_0xb2d1('0x19')]],'as':_0x15028e['as'],'attributes':_0x15028e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2d1('0xa')](function(_0xdee29d){logger[_0xb2d1('0xb')](_0xb2d1('0x1d'),_0x19ece3);logger[_0xb2d1('0xd')](_0xb2d1('0x1d'),_0x19ece3,JSON['stringify'](_0xdee29d));_0x85b129(_0xdee29d);})[_0xb2d1('0x12')](function(_0x46ce84){logger[_0xb2d1('0xf')](_0xb2d1('0x1d'),_0x46ce84[_0xb2d1('0x11')],_0x19ece3);_0x17d394(_0x316b60['error'](0x1f4,_0x46ce84['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index bc3e28d..76fd740 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 _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x5cf4a8,_0x4d4066){var _0x47374d=function(_0x5ce9ee){while(--_0x5ce9ee){_0x5cf4a8['push'](_0x5cf4a8['shift']());}};_0x47374d(++_0x4d4066);}(_0x0bb5,0x148));var _0x50bb=function(_0x1d6e62,_0x56c5cf){_0x1d6e62=_0x1d6e62-0x0;var _0x130000=_0x0bb5[_0x1d6e62];return _0x130000;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file +var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x2ae90f,_0x1d6904){var _0x18ff2a=function(_0x3e75f5){while(--_0x3e75f5){_0x2ae90f['push'](_0x2ae90f['shift']());}};_0x18ff2a(++_0x1d6904);}(_0x5eb8,0xb0));var _0x85eb=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0x5eb8[_0x29d87d];return _0x1fd84b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3190578..c8a4f37 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 _0xa237=['sequelize','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xa237,0xc8));var _0x7a23=function(_0x347fce,_0x5c5c59){_0x347fce=_0x347fce-0x0;var _0x191ed3=_0xa237[_0x347fce];return _0x191ed3;};'use strict';var Sequelize=require(_0x7a23('0x0'));module[_0x7a23('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb818=['exports'];(function(_0x3d3183,_0xb8dde0){var _0xdf094c=function(_0x2c4c47){while(--_0x2c4c47){_0x3d3183['push'](_0x3d3183['shift']());}};_0xdf094c(++_0xb8dde0);}(_0xb818,0x16e));var _0x8b81=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb818[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0x8b81('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 49f9d66..9301406 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 _0xcf11=['status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','ZendeskField','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x312f50,_0x303dce){var _0x4e43b9=function(_0x9ad464){while(--_0x9ad464){_0x312f50['push'](_0x312f50['shift']());}};_0x4e43b9(++_0x303dce);}(_0xcf11,0x1cc));var _0x1cf1=function(_0x596e98,_0xc326c9){_0x596e98=_0x596e98-0x0;var _0x1c09ac=_0xcf11[_0x596e98];return _0x1c09ac;};'use strict';var emlformat=require(_0x1cf1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1cf1('0x1'));var jsonpatch=require(_0x1cf1('0x2'));var rp=require(_0x1cf1('0x3'));var moment=require(_0x1cf1('0x4'));var BPromise=require(_0x1cf1('0x5'));var Mustache=require(_0x1cf1('0x6'));var util=require(_0x1cf1('0x7'));var path=require(_0x1cf1('0x8'));var sox=require(_0x1cf1('0x9'));var csv=require(_0x1cf1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cf1('0xb'));var _=require(_0x1cf1('0xc'));var squel=require(_0x1cf1('0xd'));var crypto=require(_0x1cf1('0xe'));var jsforce=require(_0x1cf1('0xf'));var deskjs=require(_0x1cf1('0x10'));var toCsv=require(_0x1cf1('0xa'));var querystring=require(_0x1cf1('0x11'));var Papa=require('papaparse');var Redis=require(_0x1cf1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1cf1('0x13'));var as=require(_0x1cf1('0x14'));var hardwareService=require(_0x1cf1('0x15'));var logger=require('../../config/logger')(_0x1cf1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1cf1('0x17'));var db=require(_0x1cf1('0x18'))['db'];function respondWithStatusCode(_0x4589b1,_0x533809){_0x533809=_0x533809||0xcc;return function(_0x489387){if(_0x489387){return _0x4589b1[_0x1cf1('0x19')](_0x533809);}return _0x4589b1[_0x1cf1('0x1a')](_0x533809)['end']();};}function respondWithResult(_0x32e96e,_0x5275b3){_0x5275b3=_0x5275b3||0xc8;return function(_0x4446eb){if(_0x4446eb){return _0x32e96e[_0x1cf1('0x1a')](_0x5275b3)[_0x1cf1('0x1b')](_0x4446eb);}};}function respondWithFilteredResult(_0xbfb7d0,_0x3c10b3){return function(_0x2b7e82){if(_0x2b7e82){var _0x372be0=typeof _0x3c10b3[_0x1cf1('0x1c')]===_0x1cf1('0x1d')&&typeof _0x3c10b3[_0x1cf1('0x1e')]===_0x1cf1('0x1d');var _0x5ad519=_0x2b7e82[_0x1cf1('0x1f')];var _0xd557b1=_0x372be0?0x0:_0x3c10b3[_0x1cf1('0x1c')];var _0x3e0dce=_0x372be0?_0x2b7e82['count']:_0x3c10b3['offset']+_0x3c10b3[_0x1cf1('0x1e')];var _0x337f85;if(_0x3e0dce>=_0x5ad519){_0x3e0dce=_0x5ad519;_0x337f85=0xc8;}else{_0x337f85=0xce;}_0xbfb7d0[_0x1cf1('0x1a')](_0x337f85);return _0xbfb7d0[_0x1cf1('0x20')](_0x1cf1('0x21'),_0xd557b1+'-'+_0x3e0dce+'/'+_0x5ad519)[_0x1cf1('0x1b')](_0x2b7e82);}return null;};}function patchUpdates(_0x31e9b3){return function(_0x4170c8){try{jsonpatch['apply'](_0x4170c8,_0x31e9b3,!![]);}catch(_0x4971b2){return BPromise['reject'](_0x4971b2);}return _0x4170c8[_0x1cf1('0x22')]();};}function saveUpdates(_0x4a9054,_0x549c5b){return function(_0x25db83){if(_0x25db83){return _0x25db83['update'](_0x4a9054)['then'](function(_0x2f189c){return _0x2f189c;});}return null;};}function removeEntity(_0x23fe43,_0x38a7c9){return function(_0x131639){if(_0x131639){return _0x131639[_0x1cf1('0x23')]()[_0x1cf1('0x24')](function(){_0x23fe43[_0x1cf1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a14e3,_0x4b6b38){return function(_0x503115){if(!_0x503115){_0x2a14e3[_0x1cf1('0x19')](0x194);}return _0x503115;};}function handleError(_0x5c3c99,_0x2e48a6){_0x2e48a6=_0x2e48a6||0x1f4;return function(_0x57cd0e){logger[_0x1cf1('0x25')](_0x57cd0e[_0x1cf1('0x26')]);if(_0x57cd0e[_0x1cf1('0x27')]){delete _0x57cd0e[_0x1cf1('0x27')];}_0x5c3c99['status'](_0x2e48a6)['send'](_0x57cd0e);};}exports[_0x1cf1('0x28')]=function(_0x435abb,_0x2be7a0){var _0x12306e={},_0x578c84={},_0x27ac5e={'count':0x0,'rows':[]};var _0x447c16=_[_0x1cf1('0x29')](db[_0x1cf1('0x2a')][_0x1cf1('0x2b')],function(_0x406839){return{'name':_0x406839['fieldName'],'type':_0x406839[_0x1cf1('0x2c')][_0x1cf1('0x2d')]};});_0x578c84[_0x1cf1('0x2e')]=_[_0x1cf1('0x29')](_0x447c16,'name');_0x578c84[_0x1cf1('0x2f')]=_[_0x1cf1('0x30')](_0x435abb[_0x1cf1('0x2f')]);_0x578c84['filters']=_[_0x1cf1('0x31')](_0x578c84['model'],_0x578c84['query']);_0x12306e[_0x1cf1('0x32')]=_['intersection'](_0x578c84[_0x1cf1('0x2e')],qs[_0x1cf1('0x33')](_0x435abb[_0x1cf1('0x2f')][_0x1cf1('0x33')]));_0x12306e[_0x1cf1('0x32')]=_0x12306e[_0x1cf1('0x32')][_0x1cf1('0x34')]?_0x12306e[_0x1cf1('0x32')]:_0x578c84[_0x1cf1('0x2e')];if(!_0x435abb[_0x1cf1('0x2f')]['hasOwnProperty']('nolimit')){_0x12306e[_0x1cf1('0x1e')]=qs[_0x1cf1('0x1e')](_0x435abb[_0x1cf1('0x2f')][_0x1cf1('0x1e')]);_0x12306e[_0x1cf1('0x1c')]=qs['offset'](_0x435abb['query'][_0x1cf1('0x1c')]);}_0x12306e[_0x1cf1('0x35')]=qs[_0x1cf1('0x36')](_0x435abb[_0x1cf1('0x2f')][_0x1cf1('0x36')]);_0x12306e[_0x1cf1('0x37')]=qs[_0x1cf1('0x38')](_[_0x1cf1('0x39')](_0x435abb[_0x1cf1('0x2f')],_0x578c84[_0x1cf1('0x38')]),_0x447c16);if(_0x435abb[_0x1cf1('0x2f')][_0x1cf1('0x3a')]){_0x12306e[_0x1cf1('0x37')]=_[_0x1cf1('0x3b')](_0x12306e['where'],{'$or':_['map'](_0x447c16,function(_0x15fc57){if(_0x15fc57[_0x1cf1('0x2c')]!=='VIRTUAL'){var _0x1194cb={};_0x1194cb[_0x15fc57['name']]={'$like':'%'+_0x435abb[_0x1cf1('0x2f')][_0x1cf1('0x3a')]+'%'};return _0x1194cb;}})});}_0x12306e=_[_0x1cf1('0x3b')]({},_0x12306e,_0x435abb[_0x1cf1('0x3c')]);var _0x236484={'where':_0x12306e[_0x1cf1('0x37')]};return db['ZendeskConfiguration'][_0x1cf1('0x1f')](_0x236484)[_0x1cf1('0x24')](function(_0x237381){_0x27ac5e[_0x1cf1('0x1f')]=_0x237381;if(_0x435abb[_0x1cf1('0x2f')][_0x1cf1('0x3d')]){_0x12306e[_0x1cf1('0x3e')]=[{'all':!![]}];}return db[_0x1cf1('0x2a')][_0x1cf1('0x3f')](_0x12306e);})['then'](function(_0x3f75d1){_0x27ac5e[_0x1cf1('0x40')]=_0x3f75d1;return _0x27ac5e;})['then'](respondWithFilteredResult(_0x2be7a0,_0x12306e))[_0x1cf1('0x41')](handleError(_0x2be7a0,null));};exports[_0x1cf1('0x42')]=function(_0x1daf3f,_0x567ffd){var _0x393c28={'raw':![],'where':{'id':_0x1daf3f[_0x1cf1('0x43')]['id']}},_0x518312={};_0x518312['model']=_[_0x1cf1('0x30')](db['ZendeskConfiguration']['rawAttributes']);_0x518312[_0x1cf1('0x2f')]=_[_0x1cf1('0x30')](_0x1daf3f[_0x1cf1('0x2f')]);_0x518312['filters']=_[_0x1cf1('0x31')](_0x518312[_0x1cf1('0x2e')],_0x518312['query']);_0x393c28[_0x1cf1('0x32')]=_[_0x1cf1('0x31')](_0x518312[_0x1cf1('0x2e')],qs[_0x1cf1('0x33')](_0x1daf3f[_0x1cf1('0x2f')][_0x1cf1('0x33')]));_0x393c28[_0x1cf1('0x32')]=_0x393c28[_0x1cf1('0x32')]['length']?_0x393c28[_0x1cf1('0x32')]:_0x518312[_0x1cf1('0x2e')];if(_0x1daf3f[_0x1cf1('0x2f')]['includeAll']){_0x393c28['include']=[{'all':!![]}];}_0x393c28=_['merge']({},_0x393c28,_0x1daf3f[_0x1cf1('0x3c')]);return db[_0x1cf1('0x2a')]['find'](_0x393c28)[_0x1cf1('0x24')](handleEntityNotFound(_0x567ffd,null))[_0x1cf1('0x24')](respondWithResult(_0x567ffd,null))[_0x1cf1('0x41')](handleError(_0x567ffd,null));};exports[_0x1cf1('0x44')]=function(_0xf8b30b,_0x457b84){return db[_0x1cf1('0x2a')]['create'](_0xf8b30b['body'],{})['then'](respondWithResult(_0x457b84,0xc9))[_0x1cf1('0x41')](handleError(_0x457b84,null));};exports['update']=function(_0x57eb7f,_0x5c2685){if(_0x57eb7f[_0x1cf1('0x45')]['id']){delete _0x57eb7f[_0x1cf1('0x45')]['id'];}return db[_0x1cf1('0x2a')]['find']({'where':{'id':_0x57eb7f[_0x1cf1('0x43')]['id']}})[_0x1cf1('0x24')](handleEntityNotFound(_0x5c2685,null))[_0x1cf1('0x24')](saveUpdates(_0x57eb7f[_0x1cf1('0x45')],null))[_0x1cf1('0x24')](respondWithResult(_0x5c2685,null))[_0x1cf1('0x41')](handleError(_0x5c2685,null));};exports[_0x1cf1('0x23')]=function(_0x16c7ab,_0x4e301a){return db[_0x1cf1('0x2a')][_0x1cf1('0x46')]({'where':{'id':_0x16c7ab[_0x1cf1('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e301a,null))[_0x1cf1('0x24')](removeEntity(_0x4e301a,null))[_0x1cf1('0x41')](handleError(_0x4e301a,null));};exports[_0x1cf1('0x47')]=function(_0x184b19,_0x384fea,_0x52dd2b){var _0x533f4f={};var _0x207069={};var _0xb74f58;var _0x12b5d3;return db[_0x1cf1('0x2a')][_0x1cf1('0x48')]({'where':{'id':_0x184b19[_0x1cf1('0x43')]['id']}})[_0x1cf1('0x24')](handleEntityNotFound(_0x384fea,null))[_0x1cf1('0x24')](function(_0x12e26a){if(_0x12e26a){_0xb74f58=_0x12e26a;_0x207069[_0x1cf1('0x2e')]=_[_0x1cf1('0x30')](db[_0x1cf1('0x49')][_0x1cf1('0x2b')]);_0x207069[_0x1cf1('0x2f')]=_['keys'](_0x184b19['query']);_0x207069[_0x1cf1('0x38')]=_[_0x1cf1('0x31')](_0x207069['model'],_0x207069[_0x1cf1('0x2f')]);_0x533f4f[_0x1cf1('0x32')]=_[_0x1cf1('0x31')](_0x207069['model'],qs[_0x1cf1('0x33')](_0x184b19[_0x1cf1('0x2f')][_0x1cf1('0x33')]));_0x533f4f[_0x1cf1('0x32')]=_0x533f4f[_0x1cf1('0x32')][_0x1cf1('0x34')]?_0x533f4f[_0x1cf1('0x32')]:_0x207069[_0x1cf1('0x2e')];_0x533f4f[_0x1cf1('0x35')]=qs[_0x1cf1('0x36')](_0x184b19[_0x1cf1('0x2f')][_0x1cf1('0x36')]);_0x533f4f[_0x1cf1('0x37')]=qs['filters'](_[_0x1cf1('0x39')](_0x184b19[_0x1cf1('0x2f')],_0x207069['filters']));if(_0x184b19['query'][_0x1cf1('0x3a')]){_0x533f4f['where']=_[_0x1cf1('0x3b')](_0x533f4f[_0x1cf1('0x37')],{'$or':_['map'](_0x533f4f[_0x1cf1('0x32')],function(_0x18be9f){var _0x25e1a4={};_0x25e1a4[_0x18be9f]={'$like':'%'+_0x184b19[_0x1cf1('0x2f')]['filter']+'%'};return _0x25e1a4;})});}_0x533f4f=_[_0x1cf1('0x3b')]({},_0x533f4f,_0x184b19[_0x1cf1('0x3c')]);return _0xb74f58[_0x1cf1('0x47')](_0x533f4f);}})[_0x1cf1('0x24')](function(_0x3f1841){if(_0x3f1841){_0x12b5d3=_0x3f1841[_0x1cf1('0x34')];if(!_0x184b19[_0x1cf1('0x2f')][_0x1cf1('0x4a')](_0x1cf1('0x4b'))){_0x533f4f['limit']=qs[_0x1cf1('0x1e')](_0x184b19['query'][_0x1cf1('0x1e')]);_0x533f4f[_0x1cf1('0x1c')]=qs[_0x1cf1('0x1c')](_0x184b19[_0x1cf1('0x2f')][_0x1cf1('0x1c')]);}return _0xb74f58['getFields'](_0x533f4f);}})[_0x1cf1('0x24')](function(_0x5f00b5){if(_0x5f00b5){return _0x5f00b5?{'count':_0x12b5d3,'rows':_0x5f00b5}:null;}})[_0x1cf1('0x24')](respondWithResult(_0x384fea,null))[_0x1cf1('0x41')](handleError(_0x384fea,null));};exports[_0x1cf1('0x4c')]=function(_0x4ff70f,_0xf7742b,_0x25404f){var _0x4e56f3={};var _0x25b2b2={};var _0x31a370;var _0x18bf6b;return db['ZendeskConfiguration'][_0x1cf1('0x48')]({'where':{'id':_0x4ff70f[_0x1cf1('0x43')]['id']}})['then'](handleEntityNotFound(_0xf7742b,null))['then'](function(_0x4c62c9){if(_0x4c62c9){_0x31a370=_0x4c62c9;_0x25b2b2[_0x1cf1('0x2e')]=_[_0x1cf1('0x30')](db[_0x1cf1('0x49')]['rawAttributes']);_0x25b2b2[_0x1cf1('0x2f')]=_['keys'](_0x4ff70f['query']);_0x25b2b2[_0x1cf1('0x38')]=_[_0x1cf1('0x31')](_0x25b2b2['model'],_0x25b2b2[_0x1cf1('0x2f')]);_0x4e56f3[_0x1cf1('0x32')]=_[_0x1cf1('0x31')](_0x25b2b2[_0x1cf1('0x2e')],qs[_0x1cf1('0x33')](_0x4ff70f[_0x1cf1('0x2f')][_0x1cf1('0x33')]));_0x4e56f3['attributes']=_0x4e56f3[_0x1cf1('0x32')][_0x1cf1('0x34')]?_0x4e56f3[_0x1cf1('0x32')]:_0x25b2b2['model'];_0x4e56f3['order']=qs[_0x1cf1('0x36')](_0x4ff70f[_0x1cf1('0x2f')]['sort']);_0x4e56f3[_0x1cf1('0x37')]=qs[_0x1cf1('0x38')](_[_0x1cf1('0x39')](_0x4ff70f['query'],_0x25b2b2[_0x1cf1('0x38')]));if(_0x4ff70f[_0x1cf1('0x2f')][_0x1cf1('0x3a')]){_0x4e56f3[_0x1cf1('0x37')]=_[_0x1cf1('0x3b')](_0x4e56f3[_0x1cf1('0x37')],{'$or':_[_0x1cf1('0x29')](_0x4e56f3[_0x1cf1('0x32')],function(_0x392b21){var _0x480810={};_0x480810[_0x392b21]={'$like':'%'+_0x4ff70f[_0x1cf1('0x2f')]['filter']+'%'};return _0x480810;})});}_0x4e56f3=_[_0x1cf1('0x3b')]({},_0x4e56f3,_0x4ff70f[_0x1cf1('0x3c')]);return _0x31a370[_0x1cf1('0x4c')](_0x4e56f3);}})[_0x1cf1('0x24')](function(_0x6d36f4){if(_0x6d36f4){_0x18bf6b=_0x6d36f4[_0x1cf1('0x34')];if(!_0x4ff70f[_0x1cf1('0x2f')][_0x1cf1('0x4a')](_0x1cf1('0x4b'))){_0x4e56f3[_0x1cf1('0x1e')]=qs['limit'](_0x4ff70f[_0x1cf1('0x2f')][_0x1cf1('0x1e')]);_0x4e56f3[_0x1cf1('0x1c')]=qs[_0x1cf1('0x1c')](_0x4ff70f[_0x1cf1('0x2f')][_0x1cf1('0x1c')]);}return _0x31a370[_0x1cf1('0x4c')](_0x4e56f3);}})['then'](function(_0x1b65bb){if(_0x1b65bb){return _0x1b65bb?{'count':_0x18bf6b,'rows':_0x1b65bb}:null;}})[_0x1cf1('0x24')](respondWithResult(_0xf7742b,null))[_0x1cf1('0x41')](handleError(_0xf7742b,null));};exports[_0x1cf1('0x4d')]=function(_0x53bda6,_0x1657a6,_0x27ffa0){var _0x3df6d2={};var _0x23a58e={};var _0x2ddde5;var _0x31b530;return db[_0x1cf1('0x2a')][_0x1cf1('0x48')]({'where':{'id':_0x53bda6[_0x1cf1('0x43')]['id']}})['then'](handleEntityNotFound(_0x1657a6,null))['then'](function(_0x375319){if(_0x375319){_0x2ddde5=_0x375319;_0x23a58e['model']=_[_0x1cf1('0x30')](db[_0x1cf1('0x49')][_0x1cf1('0x2b')]);_0x23a58e[_0x1cf1('0x2f')]=_[_0x1cf1('0x30')](_0x53bda6[_0x1cf1('0x2f')]);_0x23a58e[_0x1cf1('0x38')]=_[_0x1cf1('0x31')](_0x23a58e['model'],_0x23a58e[_0x1cf1('0x2f')]);_0x3df6d2[_0x1cf1('0x32')]=_[_0x1cf1('0x31')](_0x23a58e[_0x1cf1('0x2e')],qs[_0x1cf1('0x33')](_0x53bda6[_0x1cf1('0x2f')]['fields']));_0x3df6d2[_0x1cf1('0x32')]=_0x3df6d2[_0x1cf1('0x32')][_0x1cf1('0x34')]?_0x3df6d2[_0x1cf1('0x32')]:_0x23a58e['model'];_0x3df6d2[_0x1cf1('0x35')]=qs[_0x1cf1('0x36')](_0x53bda6[_0x1cf1('0x2f')]['sort']);_0x3df6d2[_0x1cf1('0x37')]=qs[_0x1cf1('0x38')](_[_0x1cf1('0x39')](_0x53bda6['query'],_0x23a58e[_0x1cf1('0x38')]));if(_0x53bda6[_0x1cf1('0x2f')][_0x1cf1('0x3a')]){_0x3df6d2['where']=_[_0x1cf1('0x3b')](_0x3df6d2[_0x1cf1('0x37')],{'$or':_['map'](_0x3df6d2[_0x1cf1('0x32')],function(_0x44a60c){var _0x4ba07a={};_0x4ba07a[_0x44a60c]={'$like':'%'+_0x53bda6[_0x1cf1('0x2f')]['filter']+'%'};return _0x4ba07a;})});}_0x3df6d2=_[_0x1cf1('0x3b')]({},_0x3df6d2,_0x53bda6[_0x1cf1('0x3c')]);return _0x2ddde5[_0x1cf1('0x4d')](_0x3df6d2);}})[_0x1cf1('0x24')](function(_0x1f987b){if(_0x1f987b){_0x31b530=_0x1f987b[_0x1cf1('0x34')];if(!_0x53bda6[_0x1cf1('0x2f')][_0x1cf1('0x4a')](_0x1cf1('0x4b'))){_0x3df6d2['limit']=qs[_0x1cf1('0x1e')](_0x53bda6[_0x1cf1('0x2f')][_0x1cf1('0x1e')]);_0x3df6d2[_0x1cf1('0x1c')]=qs['offset'](_0x53bda6[_0x1cf1('0x2f')]['offset']);}return _0x2ddde5['getDescriptions'](_0x3df6d2);}})[_0x1cf1('0x24')](function(_0x2d0000){if(_0x2d0000){return _0x2d0000?{'count':_0x31b530,'rows':_0x2d0000}:null;}})[_0x1cf1('0x24')](respondWithResult(_0x1657a6,null))[_0x1cf1('0x41')](handleError(_0x1657a6,null));};exports[_0x1cf1('0x4e')]=function(_0xfa3a0,_0x3895d4,_0x568ef3){var _0x389cbd={};var _0x25da60={};var _0xc64ec8;var _0x4f9f14;return db[_0x1cf1('0x2a')]['findOne']({'where':{'id':_0xfa3a0['params']['id']}})[_0x1cf1('0x24')](handleEntityNotFound(_0x3895d4,null))[_0x1cf1('0x24')](function(_0x5c651e){if(_0x5c651e){_0xc64ec8=_0x5c651e;_0x25da60[_0x1cf1('0x2e')]=_[_0x1cf1('0x30')](db[_0x1cf1('0x4f')][_0x1cf1('0x2b')]);_0x25da60['query']=_[_0x1cf1('0x30')](_0xfa3a0[_0x1cf1('0x2f')]);_0x25da60[_0x1cf1('0x38')]=_[_0x1cf1('0x31')](_0x25da60[_0x1cf1('0x2e')],_0x25da60[_0x1cf1('0x2f')]);_0x389cbd[_0x1cf1('0x32')]=_['intersection'](_0x25da60['model'],qs['fields'](_0xfa3a0['query'][_0x1cf1('0x33')]));_0x389cbd[_0x1cf1('0x32')]=_0x389cbd[_0x1cf1('0x32')][_0x1cf1('0x34')]?_0x389cbd[_0x1cf1('0x32')]:_0x25da60[_0x1cf1('0x2e')];_0x389cbd[_0x1cf1('0x35')]=qs[_0x1cf1('0x36')](_0xfa3a0[_0x1cf1('0x2f')][_0x1cf1('0x36')]);_0x389cbd[_0x1cf1('0x37')]=qs['filters'](_[_0x1cf1('0x39')](_0xfa3a0[_0x1cf1('0x2f')],_0x25da60[_0x1cf1('0x38')]));if(_0xfa3a0['query'][_0x1cf1('0x3a')]){_0x389cbd[_0x1cf1('0x37')]=_[_0x1cf1('0x3b')](_0x389cbd[_0x1cf1('0x37')],{'$or':_['map'](_0x389cbd[_0x1cf1('0x32')],function(_0x31d23e){var _0x488d48={};_0x488d48[_0x31d23e]={'$like':'%'+_0xfa3a0['query'][_0x1cf1('0x3a')]+'%'};return _0x488d48;})});}_0x389cbd=_['merge']({},_0x389cbd,_0xfa3a0[_0x1cf1('0x3c')]);return _0xc64ec8[_0x1cf1('0x4e')](_0x389cbd);}})['then'](function(_0xb025b1){if(_0xb025b1){_0x4f9f14=_0xb025b1[_0x1cf1('0x34')];if(!_0xfa3a0[_0x1cf1('0x2f')][_0x1cf1('0x4a')](_0x1cf1('0x4b'))){_0x389cbd['limit']=qs['limit'](_0xfa3a0[_0x1cf1('0x2f')][_0x1cf1('0x1e')]);_0x389cbd[_0x1cf1('0x1c')]=qs[_0x1cf1('0x1c')](_0xfa3a0[_0x1cf1('0x2f')][_0x1cf1('0x1c')]);}return _0xc64ec8[_0x1cf1('0x4e')](_0x389cbd);}})[_0x1cf1('0x24')](function(_0x39d2b0){if(_0x39d2b0){return _0x39d2b0?{'count':_0x4f9f14,'rows':_0x39d2b0}:null;}})['then'](respondWithResult(_0x3895d4,null))[_0x1cf1('0x41')](handleError(_0x3895d4,null));};exports['setTags']=function(_0x43cbc5,_0x849554,_0x419f1c){if(_0x43cbc5[_0x1cf1('0x45')]['id']){delete _0x43cbc5[_0x1cf1('0x45')]['id'];}return db[_0x1cf1('0x2a')][_0x1cf1('0x48')]({'where':{'id':_0x43cbc5['params']['id']}})[_0x1cf1('0x24')](handleEntityNotFound(_0x849554,null))[_0x1cf1('0x24')](function(_0x3654f3){if(_0x3654f3){return _0x3654f3[_0x1cf1('0x50')](_0x43cbc5[_0x1cf1('0x45')]['ids']||[]);}return null;})[_0x1cf1('0x24')](respondWithResult(_0x849554,null))['catch'](handleError(_0x849554,null));}; \ No newline at end of file +var _0x2beb=['name','send','index','map','ZendeskConfiguration','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','keys','find','create','body','params','destroy','getFields','findOne','ZendeskField','rawAttributes','length','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','error'];(function(_0x2ced83,_0x53754d){var _0x472ad1=function(_0x2460de){while(--_0x2460de){_0x2ced83['push'](_0x2ced83['shift']());}};_0x472ad1(++_0x53754d);}(_0x2beb,0x7e));var _0xb2be=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2beb[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xb2be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2be('0x1'));var jsonpatch=require(_0xb2be('0x2'));var rp=require('request-promise');var moment=require(_0xb2be('0x3'));var BPromise=require(_0xb2be('0x4'));var Mustache=require(_0xb2be('0x5'));var util=require('util');var path=require(_0xb2be('0x6'));var sox=require(_0xb2be('0x7'));var csv=require('to-csv');var ejs=require(_0xb2be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2be('0x9'));var squel=require(_0xb2be('0xa'));var crypto=require(_0xb2be('0xb'));var jsforce=require(_0xb2be('0xc'));var deskjs=require(_0xb2be('0xd'));var toCsv=require(_0xb2be('0xe'));var querystring=require(_0xb2be('0xf'));var Papa=require(_0xb2be('0x10'));var Redis=require(_0xb2be('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb2be('0x12'));var as=require(_0xb2be('0x13'));var hardwareService=require(_0xb2be('0x14'));var logger=require(_0xb2be('0x15'))(_0xb2be('0x16'));var utils=require(_0xb2be('0x17'));var config=require(_0xb2be('0x18'));var licenseUtil=require(_0xb2be('0x19'));var db=require(_0xb2be('0x1a'))['db'];function respondWithStatusCode(_0xaa8668,_0x37d1ec){_0x37d1ec=_0x37d1ec||0xcc;return function(_0x1d0570){if(_0x1d0570){return _0xaa8668['sendStatus'](_0x37d1ec);}return _0xaa8668[_0xb2be('0x1b')](_0x37d1ec)[_0xb2be('0x1c')]();};}function respondWithResult(_0x1f5167,_0x182b48){_0x182b48=_0x182b48||0xc8;return function(_0xc43fc3){if(_0xc43fc3){return _0x1f5167[_0xb2be('0x1b')](_0x182b48)[_0xb2be('0x1d')](_0xc43fc3);}};}function respondWithFilteredResult(_0x2c2840,_0x2a3f5f){return function(_0x2e5695){if(_0x2e5695){var _0xa5feac=typeof _0x2a3f5f[_0xb2be('0x1e')]===_0xb2be('0x1f')&&typeof _0x2a3f5f[_0xb2be('0x20')]===_0xb2be('0x1f');var _0x2a9372=_0x2e5695['count'];var _0x229d38=_0xa5feac?0x0:_0x2a3f5f[_0xb2be('0x1e')];var _0x440ddb=_0xa5feac?_0x2e5695['count']:_0x2a3f5f[_0xb2be('0x1e')]+_0x2a3f5f['limit'];var _0x195b64;if(_0x440ddb>=_0x2a9372){_0x440ddb=_0x2a9372;_0x195b64=0xc8;}else{_0x195b64=0xce;}_0x2c2840[_0xb2be('0x1b')](_0x195b64);return _0x2c2840[_0xb2be('0x21')](_0xb2be('0x22'),_0x229d38+'-'+_0x440ddb+'/'+_0x2a9372)[_0xb2be('0x1d')](_0x2e5695);}return null;};}function patchUpdates(_0x2a4411){return function(_0x165981){try{jsonpatch[_0xb2be('0x23')](_0x165981,_0x2a4411,!![]);}catch(_0x34f775){return BPromise[_0xb2be('0x24')](_0x34f775);}return _0x165981['save']();};}function saveUpdates(_0x34d761,_0x49486a){return function(_0x22ad40){if(_0x22ad40){return _0x22ad40[_0xb2be('0x25')](_0x34d761)[_0xb2be('0x26')](function(_0x26c495){return _0x26c495;});}return null;};}function removeEntity(_0x6f3cfe,_0x53e599){return function(_0x3d5ca3){if(_0x3d5ca3){return _0x3d5ca3['destroy']()[_0xb2be('0x26')](function(){_0x6f3cfe['status'](0xcc)[_0xb2be('0x1c')]();});}};}function handleEntityNotFound(_0x5b063c,_0x480761){return function(_0x262def){if(!_0x262def){_0x5b063c['sendStatus'](0x194);}return _0x262def;};}function handleError(_0x19f946,_0xe717a4){_0xe717a4=_0xe717a4||0x1f4;return function(_0x148cc0){logger[_0xb2be('0x27')](_0x148cc0['stack']);if(_0x148cc0[_0xb2be('0x28')]){delete _0x148cc0[_0xb2be('0x28')];}_0x19f946[_0xb2be('0x1b')](_0xe717a4)[_0xb2be('0x29')](_0x148cc0);};}exports[_0xb2be('0x2a')]=function(_0x5198ce,_0x30702a){var _0x18bf3b={},_0x3341a0={},_0x17917e={'count':0x0,'rows':[]};var _0x157aae=_[_0xb2be('0x2b')](db[_0xb2be('0x2c')]['rawAttributes'],function(_0x15422e){return{'name':_0x15422e[_0xb2be('0x2d')],'type':_0x15422e[_0xb2be('0x2e')][_0xb2be('0x2f')]};});_0x3341a0['model']=_[_0xb2be('0x2b')](_0x157aae,_0xb2be('0x28'));_0x3341a0[_0xb2be('0x30')]=_['keys'](_0x5198ce[_0xb2be('0x30')]);_0x3341a0[_0xb2be('0x31')]=_[_0xb2be('0x32')](_0x3341a0[_0xb2be('0x33')],_0x3341a0[_0xb2be('0x30')]);_0x18bf3b[_0xb2be('0x34')]=_[_0xb2be('0x32')](_0x3341a0[_0xb2be('0x33')],qs[_0xb2be('0x35')](_0x5198ce[_0xb2be('0x30')][_0xb2be('0x35')]));_0x18bf3b[_0xb2be('0x34')]=_0x18bf3b['attributes']['length']?_0x18bf3b[_0xb2be('0x34')]:_0x3341a0['model'];if(!_0x5198ce[_0xb2be('0x30')][_0xb2be('0x36')](_0xb2be('0x37'))){_0x18bf3b['limit']=qs[_0xb2be('0x20')](_0x5198ce[_0xb2be('0x30')][_0xb2be('0x20')]);_0x18bf3b[_0xb2be('0x1e')]=qs['offset'](_0x5198ce[_0xb2be('0x30')][_0xb2be('0x1e')]);}_0x18bf3b[_0xb2be('0x38')]=qs[_0xb2be('0x39')](_0x5198ce[_0xb2be('0x30')]['sort']);_0x18bf3b[_0xb2be('0x3a')]=qs[_0xb2be('0x31')](_[_0xb2be('0x3b')](_0x5198ce[_0xb2be('0x30')],_0x3341a0[_0xb2be('0x31')]),_0x157aae);if(_0x5198ce[_0xb2be('0x30')][_0xb2be('0x3c')]){_0x18bf3b[_0xb2be('0x3a')]=_['merge'](_0x18bf3b[_0xb2be('0x3a')],{'$or':_[_0xb2be('0x2b')](_0x157aae,function(_0x675c39){if(_0x675c39[_0xb2be('0x2e')]!=='VIRTUAL'){var _0x462cb3={};_0x462cb3[_0x675c39[_0xb2be('0x28')]]={'$like':'%'+_0x5198ce['query'][_0xb2be('0x3c')]+'%'};return _0x462cb3;}})});}_0x18bf3b=_[_0xb2be('0x3d')]({},_0x18bf3b,_0x5198ce[_0xb2be('0x3e')]);var _0x12ef1d={'where':_0x18bf3b[_0xb2be('0x3a')]};return db['ZendeskConfiguration']['count'](_0x12ef1d)[_0xb2be('0x26')](function(_0x5c258e){_0x17917e['count']=_0x5c258e;if(_0x5198ce['query'][_0xb2be('0x3f')]){_0x18bf3b['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x18bf3b);})[_0xb2be('0x26')](function(_0x4cfb8f){_0x17917e[_0xb2be('0x40')]=_0x4cfb8f;return _0x17917e;})['then'](respondWithFilteredResult(_0x30702a,_0x18bf3b))[_0xb2be('0x41')](handleError(_0x30702a,null));};exports[_0xb2be('0x42')]=function(_0x2f0a39,_0x9977e1){var _0x281a5d={'raw':![],'where':{'id':_0x2f0a39['params']['id']}},_0x3b9567={};_0x3b9567[_0xb2be('0x33')]=_[_0xb2be('0x43')](db[_0xb2be('0x2c')]['rawAttributes']);_0x3b9567[_0xb2be('0x30')]=_[_0xb2be('0x43')](_0x2f0a39[_0xb2be('0x30')]);_0x3b9567[_0xb2be('0x31')]=_[_0xb2be('0x32')](_0x3b9567[_0xb2be('0x33')],_0x3b9567['query']);_0x281a5d['attributes']=_['intersection'](_0x3b9567[_0xb2be('0x33')],qs[_0xb2be('0x35')](_0x2f0a39[_0xb2be('0x30')][_0xb2be('0x35')]));_0x281a5d[_0xb2be('0x34')]=_0x281a5d['attributes']['length']?_0x281a5d[_0xb2be('0x34')]:_0x3b9567[_0xb2be('0x33')];if(_0x2f0a39[_0xb2be('0x30')]['includeAll']){_0x281a5d['include']=[{'all':!![]}];}_0x281a5d=_['merge']({},_0x281a5d,_0x2f0a39[_0xb2be('0x3e')]);return db['ZendeskConfiguration'][_0xb2be('0x44')](_0x281a5d)[_0xb2be('0x26')](handleEntityNotFound(_0x9977e1,null))[_0xb2be('0x26')](respondWithResult(_0x9977e1,null))[_0xb2be('0x41')](handleError(_0x9977e1,null));};exports[_0xb2be('0x45')]=function(_0x5eaff8,_0x5c1aff){return db['ZendeskConfiguration']['create'](_0x5eaff8[_0xb2be('0x46')],{})[_0xb2be('0x26')](respondWithResult(_0x5c1aff,0xc9))[_0xb2be('0x41')](handleError(_0x5c1aff,null));};exports[_0xb2be('0x25')]=function(_0x503378,_0x35c225){if(_0x503378[_0xb2be('0x46')]['id']){delete _0x503378[_0xb2be('0x46')]['id'];}return db['ZendeskConfiguration'][_0xb2be('0x44')]({'where':{'id':_0x503378[_0xb2be('0x47')]['id']}})[_0xb2be('0x26')](handleEntityNotFound(_0x35c225,null))[_0xb2be('0x26')](saveUpdates(_0x503378[_0xb2be('0x46')],null))[_0xb2be('0x26')](respondWithResult(_0x35c225,null))[_0xb2be('0x41')](handleError(_0x35c225,null));};exports[_0xb2be('0x48')]=function(_0x3dbdb9,_0x4811e5){return db[_0xb2be('0x2c')][_0xb2be('0x44')]({'where':{'id':_0x3dbdb9[_0xb2be('0x47')]['id']}})[_0xb2be('0x26')](handleEntityNotFound(_0x4811e5,null))[_0xb2be('0x26')](removeEntity(_0x4811e5,null))['catch'](handleError(_0x4811e5,null));};exports[_0xb2be('0x49')]=function(_0x434eb3,_0x56e5bd,_0xc414a9){var _0x55fa4e={};var _0x31ec2c={};var _0x2ce25d;var _0x2471f2;return db[_0xb2be('0x2c')][_0xb2be('0x4a')]({'where':{'id':_0x434eb3[_0xb2be('0x47')]['id']}})[_0xb2be('0x26')](handleEntityNotFound(_0x56e5bd,null))[_0xb2be('0x26')](function(_0x1e1771){if(_0x1e1771){_0x2ce25d=_0x1e1771;_0x31ec2c[_0xb2be('0x33')]=_['keys'](db[_0xb2be('0x4b')][_0xb2be('0x4c')]);_0x31ec2c[_0xb2be('0x30')]=_[_0xb2be('0x43')](_0x434eb3['query']);_0x31ec2c[_0xb2be('0x31')]=_[_0xb2be('0x32')](_0x31ec2c['model'],_0x31ec2c[_0xb2be('0x30')]);_0x55fa4e[_0xb2be('0x34')]=_[_0xb2be('0x32')](_0x31ec2c[_0xb2be('0x33')],qs[_0xb2be('0x35')](_0x434eb3[_0xb2be('0x30')]['fields']));_0x55fa4e['attributes']=_0x55fa4e['attributes'][_0xb2be('0x4d')]?_0x55fa4e[_0xb2be('0x34')]:_0x31ec2c['model'];_0x55fa4e['order']=qs[_0xb2be('0x39')](_0x434eb3[_0xb2be('0x30')][_0xb2be('0x39')]);_0x55fa4e[_0xb2be('0x3a')]=qs[_0xb2be('0x31')](_[_0xb2be('0x3b')](_0x434eb3['query'],_0x31ec2c[_0xb2be('0x31')]));if(_0x434eb3[_0xb2be('0x30')][_0xb2be('0x3c')]){_0x55fa4e['where']=_['merge'](_0x55fa4e['where'],{'$or':_['map'](_0x55fa4e[_0xb2be('0x34')],function(_0x57a941){var _0x2c8b84={};_0x2c8b84[_0x57a941]={'$like':'%'+_0x434eb3[_0xb2be('0x30')][_0xb2be('0x3c')]+'%'};return _0x2c8b84;})});}_0x55fa4e=_['merge']({},_0x55fa4e,_0x434eb3[_0xb2be('0x3e')]);return _0x2ce25d[_0xb2be('0x49')](_0x55fa4e);}})[_0xb2be('0x26')](function(_0x536331){if(_0x536331){_0x2471f2=_0x536331['length'];if(!_0x434eb3[_0xb2be('0x30')][_0xb2be('0x36')](_0xb2be('0x37'))){_0x55fa4e[_0xb2be('0x20')]=qs[_0xb2be('0x20')](_0x434eb3['query'][_0xb2be('0x20')]);_0x55fa4e['offset']=qs[_0xb2be('0x1e')](_0x434eb3[_0xb2be('0x30')]['offset']);}return _0x2ce25d[_0xb2be('0x49')](_0x55fa4e);}})['then'](function(_0x47d2a1){if(_0x47d2a1){return _0x47d2a1?{'count':_0x2471f2,'rows':_0x47d2a1}:null;}})['then'](respondWithResult(_0x56e5bd,null))[_0xb2be('0x41')](handleError(_0x56e5bd,null));};exports[_0xb2be('0x4e')]=function(_0xa477fb,_0x4ac020,_0x5fab1c){var _0x3de5c9={};var _0x1b16ab={};var _0x941c8d;var _0x5aeb42;return db[_0xb2be('0x2c')][_0xb2be('0x4a')]({'where':{'id':_0xa477fb[_0xb2be('0x47')]['id']}})[_0xb2be('0x26')](handleEntityNotFound(_0x4ac020,null))[_0xb2be('0x26')](function(_0x439847){if(_0x439847){_0x941c8d=_0x439847;_0x1b16ab[_0xb2be('0x33')]=_['keys'](db[_0xb2be('0x4b')][_0xb2be('0x4c')]);_0x1b16ab[_0xb2be('0x30')]=_[_0xb2be('0x43')](_0xa477fb[_0xb2be('0x30')]);_0x1b16ab[_0xb2be('0x31')]=_[_0xb2be('0x32')](_0x1b16ab['model'],_0x1b16ab[_0xb2be('0x30')]);_0x3de5c9[_0xb2be('0x34')]=_[_0xb2be('0x32')](_0x1b16ab[_0xb2be('0x33')],qs[_0xb2be('0x35')](_0xa477fb[_0xb2be('0x30')][_0xb2be('0x35')]));_0x3de5c9[_0xb2be('0x34')]=_0x3de5c9[_0xb2be('0x34')][_0xb2be('0x4d')]?_0x3de5c9[_0xb2be('0x34')]:_0x1b16ab['model'];_0x3de5c9[_0xb2be('0x38')]=qs[_0xb2be('0x39')](_0xa477fb[_0xb2be('0x30')][_0xb2be('0x39')]);_0x3de5c9[_0xb2be('0x3a')]=qs['filters'](_[_0xb2be('0x3b')](_0xa477fb[_0xb2be('0x30')],_0x1b16ab['filters']));if(_0xa477fb[_0xb2be('0x30')]['filter']){_0x3de5c9[_0xb2be('0x3a')]=_[_0xb2be('0x3d')](_0x3de5c9[_0xb2be('0x3a')],{'$or':_[_0xb2be('0x2b')](_0x3de5c9['attributes'],function(_0x3c73d6){var _0x5b5b27={};_0x5b5b27[_0x3c73d6]={'$like':'%'+_0xa477fb['query'][_0xb2be('0x3c')]+'%'};return _0x5b5b27;})});}_0x3de5c9=_[_0xb2be('0x3d')]({},_0x3de5c9,_0xa477fb['options']);return _0x941c8d[_0xb2be('0x4e')](_0x3de5c9);}})[_0xb2be('0x26')](function(_0x25f2a4){if(_0x25f2a4){_0x5aeb42=_0x25f2a4[_0xb2be('0x4d')];if(!_0xa477fb[_0xb2be('0x30')][_0xb2be('0x36')]('nolimit')){_0x3de5c9[_0xb2be('0x20')]=qs[_0xb2be('0x20')](_0xa477fb['query'][_0xb2be('0x20')]);_0x3de5c9[_0xb2be('0x1e')]=qs[_0xb2be('0x1e')](_0xa477fb['query'][_0xb2be('0x1e')]);}return _0x941c8d[_0xb2be('0x4e')](_0x3de5c9);}})[_0xb2be('0x26')](function(_0x1ada82){if(_0x1ada82){return _0x1ada82?{'count':_0x5aeb42,'rows':_0x1ada82}:null;}})[_0xb2be('0x26')](respondWithResult(_0x4ac020,null))['catch'](handleError(_0x4ac020,null));};exports[_0xb2be('0x4f')]=function(_0x29905c,_0x49b358,_0x186321){var _0x203548={};var _0xccbb51={};var _0x366c82;var _0xe6fea6;return db[_0xb2be('0x2c')]['findOne']({'where':{'id':_0x29905c[_0xb2be('0x47')]['id']}})['then'](handleEntityNotFound(_0x49b358,null))['then'](function(_0x4ea6ea){if(_0x4ea6ea){_0x366c82=_0x4ea6ea;_0xccbb51[_0xb2be('0x33')]=_[_0xb2be('0x43')](db[_0xb2be('0x4b')][_0xb2be('0x4c')]);_0xccbb51['query']=_['keys'](_0x29905c[_0xb2be('0x30')]);_0xccbb51[_0xb2be('0x31')]=_[_0xb2be('0x32')](_0xccbb51[_0xb2be('0x33')],_0xccbb51[_0xb2be('0x30')]);_0x203548['attributes']=_['intersection'](_0xccbb51[_0xb2be('0x33')],qs[_0xb2be('0x35')](_0x29905c[_0xb2be('0x30')][_0xb2be('0x35')]));_0x203548[_0xb2be('0x34')]=_0x203548[_0xb2be('0x34')]['length']?_0x203548[_0xb2be('0x34')]:_0xccbb51[_0xb2be('0x33')];_0x203548[_0xb2be('0x38')]=qs[_0xb2be('0x39')](_0x29905c[_0xb2be('0x30')][_0xb2be('0x39')]);_0x203548[_0xb2be('0x3a')]=qs[_0xb2be('0x31')](_[_0xb2be('0x3b')](_0x29905c['query'],_0xccbb51[_0xb2be('0x31')]));if(_0x29905c[_0xb2be('0x30')]['filter']){_0x203548[_0xb2be('0x3a')]=_[_0xb2be('0x3d')](_0x203548[_0xb2be('0x3a')],{'$or':_[_0xb2be('0x2b')](_0x203548[_0xb2be('0x34')],function(_0x162d95){var _0x25b742={};_0x25b742[_0x162d95]={'$like':'%'+_0x29905c[_0xb2be('0x30')][_0xb2be('0x3c')]+'%'};return _0x25b742;})});}_0x203548=_[_0xb2be('0x3d')]({},_0x203548,_0x29905c[_0xb2be('0x3e')]);return _0x366c82['getDescriptions'](_0x203548);}})[_0xb2be('0x26')](function(_0x36cc3a){if(_0x36cc3a){_0xe6fea6=_0x36cc3a['length'];if(!_0x29905c[_0xb2be('0x30')][_0xb2be('0x36')](_0xb2be('0x37'))){_0x203548[_0xb2be('0x20')]=qs[_0xb2be('0x20')](_0x29905c[_0xb2be('0x30')][_0xb2be('0x20')]);_0x203548[_0xb2be('0x1e')]=qs[_0xb2be('0x1e')](_0x29905c[_0xb2be('0x30')][_0xb2be('0x1e')]);}return _0x366c82[_0xb2be('0x4f')](_0x203548);}})[_0xb2be('0x26')](function(_0x48ac81){if(_0x48ac81){return _0x48ac81?{'count':_0xe6fea6,'rows':_0x48ac81}:null;}})[_0xb2be('0x26')](respondWithResult(_0x49b358,null))['catch'](handleError(_0x49b358,null));};exports[_0xb2be('0x50')]=function(_0x5b5137,_0x1ef33f,_0x250c6c){var _0x3c100c={};var _0x57ca2a={};var _0x124ed6;var _0x430509;return db[_0xb2be('0x2c')][_0xb2be('0x4a')]({'where':{'id':_0x5b5137[_0xb2be('0x47')]['id']}})[_0xb2be('0x26')](handleEntityNotFound(_0x1ef33f,null))[_0xb2be('0x26')](function(_0x9d5ef3){if(_0x9d5ef3){_0x124ed6=_0x9d5ef3;_0x57ca2a[_0xb2be('0x33')]=_[_0xb2be('0x43')](db['Tag']['rawAttributes']);_0x57ca2a['query']=_[_0xb2be('0x43')](_0x5b5137['query']);_0x57ca2a[_0xb2be('0x31')]=_[_0xb2be('0x32')](_0x57ca2a[_0xb2be('0x33')],_0x57ca2a[_0xb2be('0x30')]);_0x3c100c[_0xb2be('0x34')]=_[_0xb2be('0x32')](_0x57ca2a[_0xb2be('0x33')],qs[_0xb2be('0x35')](_0x5b5137['query'][_0xb2be('0x35')]));_0x3c100c[_0xb2be('0x34')]=_0x3c100c[_0xb2be('0x34')][_0xb2be('0x4d')]?_0x3c100c[_0xb2be('0x34')]:_0x57ca2a[_0xb2be('0x33')];_0x3c100c[_0xb2be('0x38')]=qs[_0xb2be('0x39')](_0x5b5137[_0xb2be('0x30')][_0xb2be('0x39')]);_0x3c100c[_0xb2be('0x3a')]=qs[_0xb2be('0x31')](_[_0xb2be('0x3b')](_0x5b5137[_0xb2be('0x30')],_0x57ca2a[_0xb2be('0x31')]));if(_0x5b5137[_0xb2be('0x30')][_0xb2be('0x3c')]){_0x3c100c[_0xb2be('0x3a')]=_[_0xb2be('0x3d')](_0x3c100c[_0xb2be('0x3a')],{'$or':_[_0xb2be('0x2b')](_0x3c100c[_0xb2be('0x34')],function(_0x4e97a0){var _0x38dcef={};_0x38dcef[_0x4e97a0]={'$like':'%'+_0x5b5137[_0xb2be('0x30')][_0xb2be('0x3c')]+'%'};return _0x38dcef;})});}_0x3c100c=_[_0xb2be('0x3d')]({},_0x3c100c,_0x5b5137[_0xb2be('0x3e')]);return _0x124ed6[_0xb2be('0x50')](_0x3c100c);}})[_0xb2be('0x26')](function(_0x39b6ff){if(_0x39b6ff){_0x430509=_0x39b6ff[_0xb2be('0x4d')];if(!_0x5b5137[_0xb2be('0x30')]['hasOwnProperty'](_0xb2be('0x37'))){_0x3c100c[_0xb2be('0x20')]=qs['limit'](_0x5b5137[_0xb2be('0x30')][_0xb2be('0x20')]);_0x3c100c[_0xb2be('0x1e')]=qs[_0xb2be('0x1e')](_0x5b5137[_0xb2be('0x30')][_0xb2be('0x1e')]);}return _0x124ed6[_0xb2be('0x50')](_0x3c100c);}})[_0xb2be('0x26')](function(_0x3adcea){if(_0x3adcea){return _0x3adcea?{'count':_0x430509,'rows':_0x3adcea}:null;}})[_0xb2be('0x26')](respondWithResult(_0x1ef33f,null))[_0xb2be('0x41')](handleError(_0x1ef33f,null));};exports[_0xb2be('0x51')]=function(_0x375e13,_0x3f37ae,_0x109267){if(_0x375e13[_0xb2be('0x46')]['id']){delete _0x375e13[_0xb2be('0x46')]['id'];}return db[_0xb2be('0x2c')][_0xb2be('0x4a')]({'where':{'id':_0x375e13[_0xb2be('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f37ae,null))[_0xb2be('0x26')](function(_0x11ef21){if(_0x11ef21){return _0x11ef21['setTags'](_0x375e13[_0xb2be('0x46')][_0xb2be('0x52')]||[]);}return null;})[_0xb2be('0x26')](respondWithResult(_0x3f37ae,null))[_0xb2be('0x41')](handleError(_0x3f37ae,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 89e6619..2138201 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 _0x160f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','int_zendesk_configurations'];(function(_0x52109d,_0x368d6c){var _0x14485a=function(_0x5ad7c2){while(--_0x5ad7c2){_0x52109d['push'](_0x52109d['shift']());}};_0x14485a(++_0x368d6c);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var logger=require(_0xf160('0x2'))(_0xf160('0x3'));var moment=require('moment');var BPromise=require(_0xf160('0x4'));var rp=require(_0xf160('0x5'));var fs=require('fs');var path=require(_0xf160('0x6'));var rimraf=require(_0xf160('0x7'));var config=require(_0xf160('0x8'));var attributes=require(_0xf160('0x9'));module['exports']=function(_0x311d63,_0x11902f){return _0x311d63['define']('ZendeskConfiguration',attributes,{'tableName':_0xf160('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e6c=['moment','path','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api'];(function(_0x411cae,_0x2f5e91){var _0x5d1417=function(_0x47f203){while(--_0x47f203){_0x411cae['push'](_0x411cae['shift']());}};_0x5d1417(++_0x2f5e91);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var logger=require('../../config/logger')(_0xc6e6('0x2'));var moment=require(_0xc6e6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6e6('0x4'));var rimraf=require('rimraf');var config=require(_0xc6e6('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xc6e6('0x6')]=function(_0x1182c7,_0x4bf906){return _0x1182c7[_0xc6e6('0x7')](_0xc6e6('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index c6bc8e4..d0fbfea 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 _0x79e5=['lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x103817,_0x17e285){var _0x5998db=function(_0x1a3771){while(--_0x1a3771){_0x103817['push'](_0x103817['shift']());}};_0x5998db(++_0x17e285);}(_0x79e5,0x1a9));var _0x579e=function(_0x210b83,_0x1567a9){_0x210b83=_0x210b83-0x0;var _0x244cec=_0x79e5[_0x210b83];return _0x244cec;};'use strict';var _=require(_0x579e('0x0'));var util=require('util');var moment=require(_0x579e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x579e('0x2'))['db'];var utils=require(_0x579e('0x3'));var logger=require('../../config/logger')(_0x579e('0x4'));var config=require(_0x579e('0x5'));var jayson=require(_0x579e('0x6'));var client=jayson[_0x579e('0x7')][_0x579e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a18ac,_0x3dc630,_0x165c25){return new BPromise(function(_0x4b5851,_0x3ae8cd){return client[_0x579e('0x9')](_0x1a18ac,_0x165c25)['then'](function(_0x3875ad){logger[_0x579e('0xa')](_0x579e('0xb'),_0x3dc630,_0x579e('0xc'));logger[_0x579e('0xd')](_0x579e('0xe'),_0x3dc630,_0x579e('0xc'),JSON['stringify'](_0x3875ad));if(_0x3875ad[_0x579e('0xf')]){if(_0x3875ad[_0x579e('0xf')]['code']===0x1f4){logger[_0x579e('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3dc630,_0x3875ad['error']['message']);return _0x3ae8cd(_0x3875ad[_0x579e('0xf')][_0x579e('0x10')]);}logger['error'](_0x579e('0xb'),_0x3dc630,_0x3875ad[_0x579e('0xf')][_0x579e('0x10')]);return _0x4b5851(_0x3875ad[_0x579e('0xf')][_0x579e('0x10')]);}else{logger['info'](_0x579e('0xb'),_0x3dc630,'request\x20sent');_0x4b5851(_0x3875ad['result'][_0x579e('0x10')]);}})['catch'](function(_0x4c1ff0){logger[_0x579e('0xf')](_0x579e('0xb'),_0x3dc630,_0x4c1ff0);_0x3ae8cd(_0x4c1ff0);});});} \ No newline at end of file +var _0x87d9=['request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87d9,0xe8));var _0x987d=function(_0x29e2ba,_0x1b171f){_0x29e2ba=_0x29e2ba-0x0;var _0x5c5920=_0x87d9[_0x29e2ba];return _0x5c5920;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x987d('0x1'));var rs=require(_0x987d('0x2'));var fs=require('fs');var Redis=require(_0x987d('0x3'));var db=require(_0x987d('0x4'))['db'];var utils=require(_0x987d('0x5'));var logger=require(_0x987d('0x6'))(_0x987d('0x7'));var config=require('../../config/environment');var jayson=require(_0x987d('0x8'));var client=jayson['client'][_0x987d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27def1,_0x2894e7,_0xb123ed){return new BPromise(function(_0x22f689,_0x4ed6c5){return client[_0x987d('0xa')](_0x27def1,_0xb123ed)['then'](function(_0x4a7d08){logger[_0x987d('0xb')](_0x987d('0xc'),_0x2894e7,_0x987d('0xd'));logger[_0x987d('0xe')](_0x987d('0xf'),_0x2894e7,_0x987d('0xd'),JSON[_0x987d('0x10')](_0x4a7d08));if(_0x4a7d08['error']){if(_0x4a7d08[_0x987d('0x11')][_0x987d('0x12')]===0x1f4){logger[_0x987d('0x11')](_0x987d('0xc'),_0x2894e7,_0x4a7d08['error'][_0x987d('0x13')]);return _0x4ed6c5(_0x4a7d08[_0x987d('0x11')][_0x987d('0x13')]);}logger[_0x987d('0x11')](_0x987d('0xc'),_0x2894e7,_0x4a7d08[_0x987d('0x11')][_0x987d('0x13')]);return _0x22f689(_0x4a7d08[_0x987d('0x11')][_0x987d('0x13')]);}else{logger[_0x987d('0xb')](_0x987d('0xc'),_0x2894e7,_0x987d('0xd'));_0x22f689(_0x4a7d08[_0x987d('0x14')]['message']);}})[_0x987d('0x15')](function(_0x5e7756){logger[_0x987d('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2894e7,_0x5e7756);_0x4ed6c5(_0x5e7756);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 95008db..f535b1a 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 _0xde9c=['destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','put','delete'];(function(_0x211e3c,_0x479757){var _0x416214=function(_0x4404b4){while(--_0x4404b4){_0x211e3c['push'](_0x211e3c['shift']());}};_0x416214(++_0x479757);}(_0xde9c,0x188));var _0xcde9=function(_0x35a7fc,_0x332673){_0x35a7fc=_0x35a7fc-0x0;var _0x2c0a59=_0xde9c[_0x35a7fc];return _0x2c0a59;};'use strict';var multer=require(_0xcde9('0x0'));var util=require(_0xcde9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcde9('0x2'));var router=express[_0xcde9('0x3')]();var fs_extra=require(_0xcde9('0x4'));var auth=require(_0xcde9('0x5'));var interaction=require(_0xcde9('0x6'));var config=require(_0xcde9('0x7'));var controller=require(_0xcde9('0x8'));router[_0xcde9('0x9')]('/',auth[_0xcde9('0xa')](),controller[_0xcde9('0xb')]);router[_0xcde9('0x9')](_0xcde9('0xc'),auth['isAuthenticated'](),controller[_0xcde9('0xd')]);router['post']('/',auth[_0xcde9('0xa')](),controller['create']);router[_0xcde9('0xe')]('/:id',auth[_0xcde9('0xa')](),controller['update']);router[_0xcde9('0xf')](_0xcde9('0xc'),auth[_0xcde9('0xa')](),controller[_0xcde9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8285=['isAuthenticated','index','get','/:id','show','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x2a8021,_0x4eb97c){var _0x131b0f=function(_0x2cc7dd){while(--_0x2cc7dd){_0x2a8021['push'](_0x2a8021['shift']());}};_0x131b0f(++_0x4eb97c);}(_0x8285,0x6e));var _0x5828=function(_0x4a0b92,_0x1dbd16){_0x4a0b92=_0x4a0b92-0x0;var _0x857610=_0x8285[_0x4a0b92];return _0x857610;};'use strict';var multer=require(_0x5828('0x0'));var util=require(_0x5828('0x1'));var path=require(_0x5828('0x2'));var timeout=require('connect-timeout');var express=require(_0x5828('0x3'));var router=express[_0x5828('0x4')]();var fs_extra=require(_0x5828('0x5'));var auth=require(_0x5828('0x6'));var interaction=require(_0x5828('0x7'));var config=require(_0x5828('0x8'));var controller=require(_0x5828('0x9'));router['get']('/',auth[_0x5828('0xa')](),controller[_0x5828('0xb')]);router[_0x5828('0xc')](_0x5828('0xd'),auth[_0x5828('0xa')](),controller[_0x5828('0xe')]);router['post']('/',auth[_0x5828('0xa')](),controller['create']);router[_0x5828('0xf')](_0x5828('0xd'),auth['isAuthenticated'](),controller[_0x5828('0x10')]);router[_0x5828('0x11')](_0x5828('0xd'),auth[_0x5828('0xa')](),controller[_0x5828('0x12')]);module[_0x5828('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1b19164..7d5a07e 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 _0x99dc=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x235369,_0x579504){var _0x52be29=function(_0x470762){while(--_0x470762){_0x235369['push'](_0x235369['shift']());}};_0x52be29(++_0x579504);}(_0x99dc,0x6a));var _0xc99d=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0x99dc[_0xfb42e6];return _0x27265b;};'use strict';var Sequelize=require(_0xc99d('0x0'));module[_0xc99d('0x1')]={'type':{'type':Sequelize[_0xc99d('0x2')](_0xc99d('0x3'),_0xc99d('0x4'),_0xc99d('0x5'),_0xc99d('0x6'),_0xc99d('0x7')),'defaultValue':_0xc99d('0x3')},'content':{'type':Sequelize[_0xc99d('0x8')]},'key':{'type':Sequelize[_0xc99d('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xc99d('0x3'),_0xc99d('0x4'),_0xc99d('0x5'))},'keyContent':{'type':Sequelize[_0xc99d('0x8')]},'idField':{'type':Sequelize[_0xc99d('0x8')]},'nameField':{'type':Sequelize[_0xc99d('0x8')]},'customField':{'type':Sequelize[_0xc99d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc99d('0x8')]}}; \ No newline at end of file +var _0x443b=['customVariable','picklist','string','STRING','ENUM','sequelize','exports','variable'];(function(_0xfa260b,_0xd2d0d){var _0x48fb84=function(_0x111f00){while(--_0x111f00){_0xfa260b['push'](_0xfa260b['shift']());}};_0x48fb84(++_0xd2d0d);}(_0x443b,0x155));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb443('0x0'));module[_0xb443('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xb443('0x2'),_0xb443('0x3'),'keyValue',_0xb443('0x4')),'defaultValue':_0xb443('0x5')},'content':{'type':Sequelize[_0xb443('0x6')]},'key':{'type':Sequelize[_0xb443('0x6')]},'keyType':{'type':Sequelize[_0xb443('0x7')](_0xb443('0x5'),_0xb443('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xb443('0x6')]},'idField':{'type':Sequelize[_0xb443('0x6')]},'nameField':{'type':Sequelize[_0xb443('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb443('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b2a5c59..a5786a6 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 _0x4c68=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','ZendeskField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','map','count','includeAll','include','rows','catch','show','keys','rawAttributes','options','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x5e0149,_0x4e9ed1){var _0x32a40a=function(_0x4b8125){while(--_0x4b8125){_0x5e0149['push'](_0x5e0149['shift']());}};_0x32a40a(++_0x4e9ed1);}(_0x4c68,0x198));var _0x84c6=function(_0x4f5e67,_0x163a00){_0x4f5e67=_0x4f5e67-0x0;var _0xa8e9dc=_0x4c68[_0x4f5e67];return _0xa8e9dc;};'use strict';var emlformat=require(_0x84c6('0x0'));var rimraf=require(_0x84c6('0x1'));var zipdir=require(_0x84c6('0x2'));var jsonpatch=require(_0x84c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x84c6('0x4'));var Mustache=require('mustache');var util=require(_0x84c6('0x5'));var path=require(_0x84c6('0x6'));var sox=require(_0x84c6('0x7'));var csv=require('to-csv');var ejs=require(_0x84c6('0x8'));var fs=require('fs');var fs_extra=require(_0x84c6('0x9'));var _=require(_0x84c6('0xa'));var squel=require(_0x84c6('0xb'));var crypto=require(_0x84c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x84c6('0xd'));var toCsv=require(_0x84c6('0xe'));var querystring=require('querystring');var Papa=require(_0x84c6('0xf'));var Redis=require(_0x84c6('0x10'));var authService=require(_0x84c6('0x11'));var qs=require(_0x84c6('0x12'));var as=require(_0x84c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84c6('0x14'))('api');var utils=require(_0x84c6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x84c6('0x16'));var db=require(_0x84c6('0x17'))['db'];function respondWithStatusCode(_0x28aaed,_0x8c99ca){_0x8c99ca=_0x8c99ca||0xcc;return function(_0x46ed73){if(_0x46ed73){return _0x28aaed[_0x84c6('0x18')](_0x8c99ca);}return _0x28aaed['status'](_0x8c99ca)[_0x84c6('0x19')]();};}function respondWithResult(_0x3f9902,_0x3a6b46){_0x3a6b46=_0x3a6b46||0xc8;return function(_0x5ab0ce){if(_0x5ab0ce){return _0x3f9902[_0x84c6('0x1a')](_0x3a6b46)[_0x84c6('0x1b')](_0x5ab0ce);}};}function respondWithFilteredResult(_0x52af32,_0x1b980b){return function(_0x995c7b){if(_0x995c7b){var _0x3dd0a1=typeof _0x1b980b[_0x84c6('0x1c')]===_0x84c6('0x1d')&&typeof _0x1b980b[_0x84c6('0x1e')]==='undefined';var _0x48330a=_0x995c7b['count'];var _0x1a78f6=_0x3dd0a1?0x0:_0x1b980b[_0x84c6('0x1c')];var _0x2592db=_0x3dd0a1?_0x995c7b['count']:_0x1b980b[_0x84c6('0x1c')]+_0x1b980b[_0x84c6('0x1e')];var _0x37362b;if(_0x2592db>=_0x48330a){_0x2592db=_0x48330a;_0x37362b=0xc8;}else{_0x37362b=0xce;}_0x52af32['status'](_0x37362b);return _0x52af32[_0x84c6('0x1f')](_0x84c6('0x20'),_0x1a78f6+'-'+_0x2592db+'/'+_0x48330a)[_0x84c6('0x1b')](_0x995c7b);}return null;};}function patchUpdates(_0x267a6d){return function(_0x418486){try{jsonpatch[_0x84c6('0x21')](_0x418486,_0x267a6d,!![]);}catch(_0x3b6cb8){return BPromise[_0x84c6('0x22')](_0x3b6cb8);}return _0x418486[_0x84c6('0x23')]();};}function saveUpdates(_0x32d12f,_0x425ed6){return function(_0x2715bd){if(_0x2715bd){return _0x2715bd[_0x84c6('0x24')](_0x32d12f)[_0x84c6('0x25')](function(_0x41cf39){return _0x41cf39;});}return null;};}function removeEntity(_0x3090dd,_0x22a4c0){return function(_0xd1139b){if(_0xd1139b){return _0xd1139b[_0x84c6('0x26')]()['then'](function(){_0x3090dd[_0x84c6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x470fcd,_0x1bf39d){return function(_0x5ca3a0){if(!_0x5ca3a0){_0x470fcd[_0x84c6('0x18')](0x194);}return _0x5ca3a0;};}function handleError(_0x2a73d4,_0x2c29b0){_0x2c29b0=_0x2c29b0||0x1f4;return function(_0x126a75){logger[_0x84c6('0x27')](_0x126a75['stack']);if(_0x126a75[_0x84c6('0x28')]){delete _0x126a75[_0x84c6('0x28')];}_0x2a73d4[_0x84c6('0x1a')](_0x2c29b0)['send'](_0x126a75);};}exports[_0x84c6('0x29')]=function(_0x490023,_0x48c90c){var _0x1b155e={},_0x2ade17={},_0x666f77={'count':0x0,'rows':[]};var _0x2a7362=_['map'](db[_0x84c6('0x2a')]['rawAttributes'],function(_0x2601fc){return{'name':_0x2601fc[_0x84c6('0x2b')],'type':_0x2601fc[_0x84c6('0x2c')][_0x84c6('0x2d')]};});_0x2ade17['model']=_['map'](_0x2a7362,_0x84c6('0x28'));_0x2ade17['query']=_['keys'](_0x490023[_0x84c6('0x2e')]);_0x2ade17[_0x84c6('0x2f')]=_[_0x84c6('0x30')](_0x2ade17[_0x84c6('0x31')],_0x2ade17[_0x84c6('0x2e')]);_0x1b155e[_0x84c6('0x32')]=_['intersection'](_0x2ade17['model'],qs[_0x84c6('0x33')](_0x490023[_0x84c6('0x2e')]['fields']));_0x1b155e[_0x84c6('0x32')]=_0x1b155e[_0x84c6('0x32')][_0x84c6('0x34')]?_0x1b155e[_0x84c6('0x32')]:_0x2ade17[_0x84c6('0x31')];if(!_0x490023[_0x84c6('0x2e')][_0x84c6('0x35')]('nolimit')){_0x1b155e[_0x84c6('0x1e')]=qs[_0x84c6('0x1e')](_0x490023[_0x84c6('0x2e')][_0x84c6('0x1e')]);_0x1b155e[_0x84c6('0x1c')]=qs[_0x84c6('0x1c')](_0x490023[_0x84c6('0x2e')][_0x84c6('0x1c')]);}_0x1b155e[_0x84c6('0x36')]=qs[_0x84c6('0x37')](_0x490023[_0x84c6('0x2e')][_0x84c6('0x37')]);_0x1b155e['where']=qs[_0x84c6('0x2f')](_[_0x84c6('0x38')](_0x490023[_0x84c6('0x2e')],_0x2ade17[_0x84c6('0x2f')]),_0x2a7362);if(_0x490023['query'][_0x84c6('0x39')]){_0x1b155e['where']=_[_0x84c6('0x3a')](_0x1b155e[_0x84c6('0x3b')],{'$or':_[_0x84c6('0x3c')](_0x2a7362,function(_0x53b636){if(_0x53b636[_0x84c6('0x2c')]!=='VIRTUAL'){var _0x258a03={};_0x258a03[_0x53b636[_0x84c6('0x28')]]={'$like':'%'+_0x490023[_0x84c6('0x2e')][_0x84c6('0x39')]+'%'};return _0x258a03;}})});}_0x1b155e=_[_0x84c6('0x3a')]({},_0x1b155e,_0x490023['options']);var _0x5e0124={'where':_0x1b155e['where']};return db[_0x84c6('0x2a')][_0x84c6('0x3d')](_0x5e0124)[_0x84c6('0x25')](function(_0x2cc9f2){_0x666f77[_0x84c6('0x3d')]=_0x2cc9f2;if(_0x490023[_0x84c6('0x2e')][_0x84c6('0x3e')]){_0x1b155e[_0x84c6('0x3f')]=[{'all':!![]}];}return db[_0x84c6('0x2a')]['findAll'](_0x1b155e);})[_0x84c6('0x25')](function(_0x117544){_0x666f77[_0x84c6('0x40')]=_0x117544;return _0x666f77;})[_0x84c6('0x25')](respondWithFilteredResult(_0x48c90c,_0x1b155e))[_0x84c6('0x41')](handleError(_0x48c90c,null));};exports[_0x84c6('0x42')]=function(_0x17468f,_0x48809e){var _0x20aa40={'raw':!![],'where':{'id':_0x17468f['params']['id']}},_0x719ef3={};_0x719ef3['model']=_[_0x84c6('0x43')](db[_0x84c6('0x2a')][_0x84c6('0x44')]);_0x719ef3[_0x84c6('0x2e')]=_['keys'](_0x17468f[_0x84c6('0x2e')]);_0x719ef3[_0x84c6('0x2f')]=_[_0x84c6('0x30')](_0x719ef3[_0x84c6('0x31')],_0x719ef3[_0x84c6('0x2e')]);_0x20aa40[_0x84c6('0x32')]=_[_0x84c6('0x30')](_0x719ef3[_0x84c6('0x31')],qs[_0x84c6('0x33')](_0x17468f[_0x84c6('0x2e')][_0x84c6('0x33')]));_0x20aa40['attributes']=_0x20aa40[_0x84c6('0x32')][_0x84c6('0x34')]?_0x20aa40[_0x84c6('0x32')]:_0x719ef3['model'];if(_0x17468f[_0x84c6('0x2e')]['includeAll']){_0x20aa40[_0x84c6('0x3f')]=[{'all':!![]}];}_0x20aa40=_[_0x84c6('0x3a')]({},_0x20aa40,_0x17468f[_0x84c6('0x45')]);return db[_0x84c6('0x2a')][_0x84c6('0x46')](_0x20aa40)['then'](handleEntityNotFound(_0x48809e,null))['then'](respondWithResult(_0x48809e,null))[_0x84c6('0x41')](handleError(_0x48809e,null));};exports['create']=function(_0x143a37,_0x364564){return db[_0x84c6('0x2a')]['create'](_0x143a37[_0x84c6('0x47')],{})[_0x84c6('0x25')](respondWithResult(_0x364564,0xc9))[_0x84c6('0x41')](handleError(_0x364564,null));};exports[_0x84c6('0x24')]=function(_0x8738d3,_0x359295){if(_0x8738d3[_0x84c6('0x47')]['id']){delete _0x8738d3['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x8738d3[_0x84c6('0x48')]['id']}})[_0x84c6('0x25')](handleEntityNotFound(_0x359295,null))[_0x84c6('0x25')](saveUpdates(_0x8738d3[_0x84c6('0x47')],null))[_0x84c6('0x25')](respondWithResult(_0x359295,null))[_0x84c6('0x41')](handleError(_0x359295,null));};exports['destroy']=function(_0x3dd605,_0x299a15){return db[_0x84c6('0x2a')][_0x84c6('0x46')]({'where':{'id':_0x3dd605['params']['id']}})['then'](handleEntityNotFound(_0x299a15,null))[_0x84c6('0x25')](removeEntity(_0x299a15,null))[_0x84c6('0x41')](handleError(_0x299a15,null));}; \ No newline at end of file +var _0xccdd=['apply','reject','update','destroy','then','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count'];(function(_0x444f34,_0x194428){var _0x37128a=function(_0x750654){while(--_0x750654){_0x444f34['push'](_0x444f34['shift']());}};_0x37128a(++_0x194428);}(_0xccdd,0x71));var _0xdccd=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xccdd[_0x54edc9];return _0x2ae7a9;};'use strict';var emlformat=require(_0xdccd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdccd('0x1'));var jsonpatch=require(_0xdccd('0x2'));var rp=require(_0xdccd('0x3'));var moment=require(_0xdccd('0x4'));var BPromise=require(_0xdccd('0x5'));var Mustache=require(_0xdccd('0x6'));var util=require(_0xdccd('0x7'));var path=require(_0xdccd('0x8'));var sox=require(_0xdccd('0x9'));var csv=require(_0xdccd('0xa'));var ejs=require(_0xdccd('0xb'));var fs=require('fs');var fs_extra=require(_0xdccd('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdccd('0xd'));var jsforce=require(_0xdccd('0xe'));var deskjs=require(_0xdccd('0xf'));var toCsv=require(_0xdccd('0xa'));var querystring=require('querystring');var Papa=require(_0xdccd('0x10'));var Redis=require(_0xdccd('0x11'));var authService=require(_0xdccd('0x12'));var qs=require(_0xdccd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdccd('0x14'));var logger=require('../../config/logger')(_0xdccd('0x15'));var utils=require(_0xdccd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdccd('0x17'));var db=require(_0xdccd('0x18'))['db'];function respondWithStatusCode(_0x574ff4,_0x4f4bb1){_0x4f4bb1=_0x4f4bb1||0xcc;return function(_0x27b91b){if(_0x27b91b){return _0x574ff4[_0xdccd('0x19')](_0x4f4bb1);}return _0x574ff4['status'](_0x4f4bb1)[_0xdccd('0x1a')]();};}function respondWithResult(_0x1382c7,_0x3544f3){_0x3544f3=_0x3544f3||0xc8;return function(_0x45034c){if(_0x45034c){return _0x1382c7[_0xdccd('0x1b')](_0x3544f3)[_0xdccd('0x1c')](_0x45034c);}};}function respondWithFilteredResult(_0x18e006,_0x4f5bad){return function(_0x151510){if(_0x151510){var _0x4155d0=typeof _0x4f5bad['offset']===_0xdccd('0x1d')&&typeof _0x4f5bad[_0xdccd('0x1e')]==='undefined';var _0x3a7159=_0x151510['count'];var _0x396428=_0x4155d0?0x0:_0x4f5bad[_0xdccd('0x1f')];var _0x5685b9=_0x4155d0?_0x151510[_0xdccd('0x20')]:_0x4f5bad[_0xdccd('0x1f')]+_0x4f5bad['limit'];var _0x55a327;if(_0x5685b9>=_0x3a7159){_0x5685b9=_0x3a7159;_0x55a327=0xc8;}else{_0x55a327=0xce;}_0x18e006['status'](_0x55a327);return _0x18e006['set']('Content-Range',_0x396428+'-'+_0x5685b9+'/'+_0x3a7159)[_0xdccd('0x1c')](_0x151510);}return null;};}function patchUpdates(_0x108b3b){return function(_0x1fb666){try{jsonpatch[_0xdccd('0x21')](_0x1fb666,_0x108b3b,!![]);}catch(_0x58dc84){return BPromise[_0xdccd('0x22')](_0x58dc84);}return _0x1fb666['save']();};}function saveUpdates(_0x5b151b,_0x1737aa){return function(_0xabb77b){if(_0xabb77b){return _0xabb77b[_0xdccd('0x23')](_0x5b151b)['then'](function(_0x402645){return _0x402645;});}return null;};}function removeEntity(_0x286ce9,_0x2599c3){return function(_0x2dcdaa){if(_0x2dcdaa){return _0x2dcdaa[_0xdccd('0x24')]()[_0xdccd('0x25')](function(){_0x286ce9['status'](0xcc)[_0xdccd('0x1a')]();});}};}function handleEntityNotFound(_0x5a73d8,_0x49220d){return function(_0xe7c9a){if(!_0xe7c9a){_0x5a73d8[_0xdccd('0x19')](0x194);}return _0xe7c9a;};}function handleError(_0x158dac,_0x321a9d){_0x321a9d=_0x321a9d||0x1f4;return function(_0x5152bd){logger['error'](_0x5152bd[_0xdccd('0x26')]);if(_0x5152bd[_0xdccd('0x27')]){delete _0x5152bd['name'];}_0x158dac['status'](_0x321a9d)[_0xdccd('0x28')](_0x5152bd);};}exports['index']=function(_0x50d00f,_0x5aa740){var _0xb66d3={},_0x384d4a={},_0x49d065={'count':0x0,'rows':[]};var _0x2f10f2=_[_0xdccd('0x29')](db[_0xdccd('0x2a')][_0xdccd('0x2b')],function(_0x86ccb1){return{'name':_0x86ccb1[_0xdccd('0x2c')],'type':_0x86ccb1[_0xdccd('0x2d')][_0xdccd('0x2e')]};});_0x384d4a[_0xdccd('0x2f')]=_[_0xdccd('0x29')](_0x2f10f2,_0xdccd('0x27'));_0x384d4a[_0xdccd('0x30')]=_[_0xdccd('0x31')](_0x50d00f[_0xdccd('0x30')]);_0x384d4a['filters']=_[_0xdccd('0x32')](_0x384d4a[_0xdccd('0x2f')],_0x384d4a[_0xdccd('0x30')]);_0xb66d3[_0xdccd('0x33')]=_['intersection'](_0x384d4a[_0xdccd('0x2f')],qs[_0xdccd('0x34')](_0x50d00f[_0xdccd('0x30')][_0xdccd('0x34')]));_0xb66d3[_0xdccd('0x33')]=_0xb66d3[_0xdccd('0x33')][_0xdccd('0x35')]?_0xb66d3[_0xdccd('0x33')]:_0x384d4a[_0xdccd('0x2f')];if(!_0x50d00f[_0xdccd('0x30')][_0xdccd('0x36')](_0xdccd('0x37'))){_0xb66d3[_0xdccd('0x1e')]=qs[_0xdccd('0x1e')](_0x50d00f[_0xdccd('0x30')][_0xdccd('0x1e')]);_0xb66d3[_0xdccd('0x1f')]=qs[_0xdccd('0x1f')](_0x50d00f[_0xdccd('0x30')]['offset']);}_0xb66d3['order']=qs[_0xdccd('0x38')](_0x50d00f['query']['sort']);_0xb66d3[_0xdccd('0x39')]=qs[_0xdccd('0x3a')](_['pick'](_0x50d00f[_0xdccd('0x30')],_0x384d4a[_0xdccd('0x3a')]),_0x2f10f2);if(_0x50d00f[_0xdccd('0x30')][_0xdccd('0x3b')]){_0xb66d3[_0xdccd('0x39')]=_[_0xdccd('0x3c')](_0xb66d3['where'],{'$or':_[_0xdccd('0x29')](_0x2f10f2,function(_0x34001e){if(_0x34001e[_0xdccd('0x2d')]!==_0xdccd('0x3d')){var _0x5c0c0b={};_0x5c0c0b[_0x34001e['name']]={'$like':'%'+_0x50d00f[_0xdccd('0x30')][_0xdccd('0x3b')]+'%'};return _0x5c0c0b;}})});}_0xb66d3=_['merge']({},_0xb66d3,_0x50d00f[_0xdccd('0x3e')]);var _0x5273cb={'where':_0xb66d3[_0xdccd('0x39')]};return db['ZendeskField']['count'](_0x5273cb)['then'](function(_0x93f68d){_0x49d065['count']=_0x93f68d;if(_0x50d00f['query']['includeAll']){_0xb66d3[_0xdccd('0x3f')]=[{'all':!![]}];}return db[_0xdccd('0x2a')][_0xdccd('0x40')](_0xb66d3);})[_0xdccd('0x25')](function(_0x26cfe7){_0x49d065[_0xdccd('0x41')]=_0x26cfe7;return _0x49d065;})[_0xdccd('0x25')](respondWithFilteredResult(_0x5aa740,_0xb66d3))['catch'](handleError(_0x5aa740,null));};exports[_0xdccd('0x42')]=function(_0x23b917,_0x441a35){var _0x2220c2={'raw':!![],'where':{'id':_0x23b917[_0xdccd('0x43')]['id']}},_0x59d429={};_0x59d429[_0xdccd('0x2f')]=_[_0xdccd('0x31')](db[_0xdccd('0x2a')][_0xdccd('0x2b')]);_0x59d429[_0xdccd('0x30')]=_[_0xdccd('0x31')](_0x23b917[_0xdccd('0x30')]);_0x59d429[_0xdccd('0x3a')]=_[_0xdccd('0x32')](_0x59d429[_0xdccd('0x2f')],_0x59d429['query']);_0x2220c2[_0xdccd('0x33')]=_[_0xdccd('0x32')](_0x59d429[_0xdccd('0x2f')],qs[_0xdccd('0x34')](_0x23b917['query'][_0xdccd('0x34')]));_0x2220c2[_0xdccd('0x33')]=_0x2220c2[_0xdccd('0x33')][_0xdccd('0x35')]?_0x2220c2['attributes']:_0x59d429[_0xdccd('0x2f')];if(_0x23b917[_0xdccd('0x30')][_0xdccd('0x44')]){_0x2220c2['include']=[{'all':!![]}];}_0x2220c2=_[_0xdccd('0x3c')]({},_0x2220c2,_0x23b917[_0xdccd('0x3e')]);return db[_0xdccd('0x2a')][_0xdccd('0x45')](_0x2220c2)['then'](handleEntityNotFound(_0x441a35,null))[_0xdccd('0x25')](respondWithResult(_0x441a35,null))[_0xdccd('0x46')](handleError(_0x441a35,null));};exports[_0xdccd('0x47')]=function(_0x440c60,_0x3a85d6){return db[_0xdccd('0x2a')][_0xdccd('0x47')](_0x440c60[_0xdccd('0x48')],{})[_0xdccd('0x25')](respondWithResult(_0x3a85d6,0xc9))[_0xdccd('0x46')](handleError(_0x3a85d6,null));};exports[_0xdccd('0x23')]=function(_0x58e4e9,_0x32ad5a){if(_0x58e4e9[_0xdccd('0x48')]['id']){delete _0x58e4e9['body']['id'];}return db['ZendeskField'][_0xdccd('0x45')]({'where':{'id':_0x58e4e9[_0xdccd('0x43')]['id']}})[_0xdccd('0x25')](handleEntityNotFound(_0x32ad5a,null))[_0xdccd('0x25')](saveUpdates(_0x58e4e9[_0xdccd('0x48')],null))[_0xdccd('0x25')](respondWithResult(_0x32ad5a,null))[_0xdccd('0x46')](handleError(_0x32ad5a,null));};exports[_0xdccd('0x24')]=function(_0x2c39ed,_0x3cb134){return db[_0xdccd('0x2a')]['find']({'where':{'id':_0x2c39ed['params']['id']}})[_0xdccd('0x25')](handleEntityNotFound(_0x3cb134,null))[_0xdccd('0x25')](removeEntity(_0x3cb134,null))[_0xdccd('0x46')](handleError(_0x3cb134,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5f96431..c9d8416 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 _0xb626=['moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x485460,_0x54528e){var _0x4db47a=function(_0x553f03){while(--_0x553f03){_0x485460['push'](_0x485460['shift']());}};_0x4db47a(++_0x54528e);}(_0xb626,0x14d));var _0x6b62=function(_0x32161b,_0x3180c0){_0x32161b=_0x32161b-0x0;var _0x5f7598=_0xb626[_0x32161b];return _0x5f7598;};'use strict';var _=require(_0x6b62('0x0'));var util=require(_0x6b62('0x1'));var logger=require(_0x6b62('0x2'))('api');var moment=require(_0x6b62('0x3'));var BPromise=require(_0x6b62('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b62('0x5'));var rimraf=require(_0x6b62('0x6'));var config=require(_0x6b62('0x7'));var attributes=require(_0x6b62('0x8'));module[_0x6b62('0x9')]=function(_0x4f317b,_0x983955){return _0x4f317b[_0x6b62('0xa')]('ZendeskField',attributes,{'tableName':_0x6b62('0xb'),'paranoid':![],'indexes':[{'name':_0x6b62('0xc'),'fields':['idField',_0x6b62('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc866=['request-promise','path','rimraf','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x40e589,_0x110352){var _0x4da09c=function(_0x323135){while(--_0x323135){_0x40e589['push'](_0x40e589['shift']());}};_0x4da09c(++_0x110352);}(_0xc866,0x9a));var _0x6c86=function(_0x2aacfc,_0x50b93f){_0x2aacfc=_0x2aacfc-0x0;var _0x14a1c1=_0xc866[_0x2aacfc];return _0x14a1c1;};'use strict';var _=require(_0x6c86('0x0'));var util=require(_0x6c86('0x1'));var logger=require(_0x6c86('0x2'))(_0x6c86('0x3'));var moment=require(_0x6c86('0x4'));var BPromise=require(_0x6c86('0x5'));var rp=require(_0x6c86('0x6'));var fs=require('fs');var path=require(_0x6c86('0x7'));var rimraf=require(_0x6c86('0x8'));var config=require('../../config/environment');var attributes=require(_0x6c86('0x9'));module['exports']=function(_0x15839d,_0x1a32ba){return _0x15839d[_0x6c86('0xa')](_0x6c86('0xb'),attributes,{'tableName':_0x6c86('0xc'),'paranoid':![],'indexes':[{'name':_0x6c86('0xd'),'fields':[_0x6c86('0xe'),_0x6c86('0xf')],'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 6f10348..14a6efd 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 _0x602b=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x4c2302,_0x367bbb){var _0x20996d=function(_0x29aa94){while(--_0x29aa94){_0x4c2302['push'](_0x4c2302['shift']());}};_0x20996d(++_0x367bbb);}(_0x602b,0x170));var _0xb602=function(_0x183c46,_0x21ce0b){_0x183c46=_0x183c46-0x0;var _0x2bb36a=_0x602b[_0x183c46];return _0x2bb36a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb602('0x0'));var BPromise=require(_0xb602('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb602('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb602('0x3'));var logger=require(_0xb602('0x4'))('rpc');var config=require(_0xb602('0x5'));var jayson=require(_0xb602('0x6'));var client=jayson[_0xb602('0x7')][_0xb602('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23d2fd,_0x19da66,_0x5c0adb){return new BPromise(function(_0x42f7f1,_0x3905ad){return client['request'](_0x23d2fd,_0x5c0adb)[_0xb602('0x9')](function(_0x4e479a){logger[_0xb602('0xa')](_0xb602('0xb'),_0x19da66,_0xb602('0xc'));logger[_0xb602('0xd')](_0xb602('0xe'),_0x19da66,_0xb602('0xc'),JSON[_0xb602('0xf')](_0x4e479a));if(_0x4e479a['error']){if(_0x4e479a[_0xb602('0x10')][_0xb602('0x11')]===0x1f4){logger[_0xb602('0x10')]('ZendeskField,\x20%s,\x20%s',_0x19da66,_0x4e479a[_0xb602('0x10')]['message']);return _0x3905ad(_0x4e479a[_0xb602('0x10')][_0xb602('0x12')]);}logger[_0xb602('0x10')](_0xb602('0xb'),_0x19da66,_0x4e479a[_0xb602('0x10')][_0xb602('0x12')]);return _0x42f7f1(_0x4e479a[_0xb602('0x10')]['message']);}else{logger[_0xb602('0xa')]('ZendeskField,\x20%s,\x20%s',_0x19da66,'request\x20sent');_0x42f7f1(_0x4e479a['result'][_0xb602('0x12')]);}})[_0xb602('0x13')](function(_0x45f6dd){logger[_0xb602('0x10')](_0xb602('0xb'),_0x19da66,_0x45f6dd);_0x3905ad(_0x45f6dd);});});} \ No newline at end of file +var _0xc193=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5afee9,_0x249af6){var _0x5c57bb=function(_0x4b6719){while(--_0x4b6719){_0x5afee9['push'](_0x5afee9['shift']());}};_0x5c57bb(++_0x249af6);}(_0xc193,0xda));var _0x3c19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc193[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3c19('0x0'));var util=require(_0x3c19('0x1'));var moment=require(_0x3c19('0x2'));var BPromise=require(_0x3c19('0x3'));var rs=require(_0x3c19('0x4'));var fs=require('fs');var Redis=require(_0x3c19('0x5'));var db=require(_0x3c19('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c19('0x7'))(_0x3c19('0x8'));var config=require(_0x3c19('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c19('0xa')][_0x3c19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8fdcc0,_0x5b61f0,_0x34efc8){return new BPromise(function(_0x3933a6,_0x55cc1b){return client[_0x3c19('0xc')](_0x8fdcc0,_0x34efc8)[_0x3c19('0xd')](function(_0x27f57b){logger['info'](_0x3c19('0xe'),_0x5b61f0,_0x3c19('0xf'));logger[_0x3c19('0x10')](_0x3c19('0x11'),_0x5b61f0,_0x3c19('0xf'),JSON[_0x3c19('0x12')](_0x27f57b));if(_0x27f57b[_0x3c19('0x13')]){if(_0x27f57b[_0x3c19('0x13')]['code']===0x1f4){logger['error'](_0x3c19('0xe'),_0x5b61f0,_0x27f57b[_0x3c19('0x13')][_0x3c19('0x14')]);return _0x55cc1b(_0x27f57b[_0x3c19('0x13')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x5b61f0,_0x27f57b[_0x3c19('0x13')][_0x3c19('0x14')]);return _0x3933a6(_0x27f57b['error'][_0x3c19('0x14')]);}else{logger[_0x3c19('0x15')](_0x3c19('0xe'),_0x5b61f0,_0x3c19('0xf'));_0x3933a6(_0x27f57b[_0x3c19('0x16')][_0x3c19('0x14')]);}})[_0x3c19('0x17')](function(_0x99a15){logger[_0x3c19('0x13')]('ZendeskField,\x20%s,\x20%s',_0x5b61f0,_0x99a15);_0x55cc1b(_0x99a15);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f9e5825..10a1305 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 _0xa917=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller'];(function(_0x4c6e97,_0xffe729){var _0x188948=function(_0x36d2bc){while(--_0x36d2bc){_0x4c6e97['push'](_0x4c6e97['shift']());}};_0x188948(++_0xffe729);}(_0xa917,0x168));var _0x7a91=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa917[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x7a91('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7a91('0x1'));var express=require(_0x7a91('0x2'));var router=express[_0x7a91('0x3')]();var fs_extra=require(_0x7a91('0x4'));var auth=require(_0x7a91('0x5'));var interaction=require(_0x7a91('0x6'));var config=require('../../config/environment');var controller=require(_0x7a91('0x7'));router[_0x7a91('0x8')]('/',auth[_0x7a91('0x9')](),controller[_0x7a91('0xa')]);router[_0x7a91('0x8')](_0x7a91('0xb'),auth[_0x7a91('0x9')](),controller[_0x7a91('0xc')]);router[_0x7a91('0x8')](_0x7a91('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7a91('0xe'),auth[_0x7a91('0x9')](),controller['getFields']);router['post']('/',auth[_0x7a91('0x9')](),controller[_0x7a91('0xf')]);router[_0x7a91('0x10')](_0x7a91('0xd'),auth['isAuthenticated'](),controller[_0x7a91('0x11')]);router[_0x7a91('0x12')](_0x7a91('0xb'),auth[_0x7a91('0x9')](),controller[_0x7a91('0x13')]);router[_0x7a91('0x14')](_0x7a91('0xb'),auth[_0x7a91('0x9')](),controller[_0x7a91('0x15')]);module[_0x7a91('0x16')]=router; \ No newline at end of file +var _0x22fc=['../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service'];(function(_0x74aa68,_0x3fd8d2){var _0x544e43=function(_0x13e141){while(--_0x13e141){_0x74aa68['push'](_0x74aa68['shift']());}};_0x544e43(++_0x3fd8d2);}(_0x22fc,0x80));var _0xc22f=function(_0x374351,_0x53d5e5){_0x374351=_0x374351-0x0;var _0x32fbfe=_0x22fc[_0x374351];return _0x32fbfe;};'use strict';var multer=require(_0xc22f('0x0'));var util=require(_0xc22f('0x1'));var path=require(_0xc22f('0x2'));var timeout=require(_0xc22f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc22f('0x4'));var config=require(_0xc22f('0x5'));var controller=require(_0xc22f('0x6'));router[_0xc22f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc22f('0x8'),auth[_0xc22f('0x9')](),controller['show']);router[_0xc22f('0x7')](_0xc22f('0xa'),auth[_0xc22f('0x9')](),controller['getConfigurations']);router['get'](_0xc22f('0xb'),auth[_0xc22f('0x9')](),controller[_0xc22f('0xc')]);router[_0xc22f('0xd')]('/',auth[_0xc22f('0x9')](),controller[_0xc22f('0xe')]);router[_0xc22f('0xd')](_0xc22f('0xa'),auth[_0xc22f('0x9')](),controller['addConfiguration']);router['put'](_0xc22f('0x8'),auth[_0xc22f('0x9')](),controller[_0xc22f('0xf')]);router[_0xc22f('0x10')](_0xc22f('0x8'),auth[_0xc22f('0x9')](),controller[_0xc22f('0x11')]);module[_0xc22f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index d5bd614..d7f8734 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 _0xcb91=['STRING'];(function(_0x574313,_0x2e9363){var _0x36116c=function(_0x43617a){while(--_0x43617a){_0x574313['push'](_0x574313['shift']());}};_0x36116c(++_0x2e9363);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xcb91[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1cb9('0x0')]},'description':{'type':Sequelize[_0x1cb9('0x0')]},'host':{'type':Sequelize[_0x1cb9('0x0')]},'zone':{'type':Sequelize[_0x1cb9('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1cb9('0x0')]},'serverUrl':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x1cb9('0x0')]}}; \ No newline at end of file +var _0x4ea3=['STRING','sequelize','exports'];(function(_0x47a491,_0x45e171){var _0x3b176b=function(_0x8c826){while(--_0x8c826){_0x47a491['push'](_0x47a491['shift']());}};_0x3b176b(++_0x45e171);}(_0x4ea3,0x70));var _0x34ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4ea3[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'name':{'type':Sequelize[_0x34ea('0x2')]},'description':{'type':Sequelize[_0x34ea('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x34ea('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34ea('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x34ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 276369d..eecff5f 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 _0xf88b=['host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','getFields','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','show','rawAttributes','intersection','length','find','catch','create','body','params','findOne','ZohoConfiguration','getConfigurations','hasOwnProperty','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientId','clientSecret','serverUrl','code'];(function(_0x39575f,_0x37b854){var _0x1a2c5c=function(_0x1ad0d6){while(--_0x1ad0d6){_0x39575f['push'](_0x39575f['shift']());}};_0x1a2c5c(++_0x37b854);}(_0xf88b,0x9b));var _0xbf88=function(_0x459734,_0x3e0440){_0x459734=_0x459734-0x0;var _0x328917=_0xf88b[_0x459734];return _0x328917;};'use strict';var emlformat=require(_0xbf88('0x0'));var rimraf=require(_0xbf88('0x1'));var zipdir=require(_0xbf88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf88('0x3'));var BPromise=require(_0xbf88('0x4'));var Mustache=require(_0xbf88('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbf88('0x6'));var csv=require(_0xbf88('0x7'));var ejs=require(_0xbf88('0x8'));var fs=require('fs');var fs_extra=require(_0xbf88('0x9'));var _=require(_0xbf88('0xa'));var squel=require(_0xbf88('0xb'));var crypto=require(_0xbf88('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbf88('0xd'));var toCsv=require(_0xbf88('0x7'));var querystring=require('querystring');var Papa=require(_0xbf88('0xe'));var Redis=require('ioredis');var authService=require(_0xbf88('0xf'));var qs=require(_0xbf88('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf88('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xbf88('0x12'));var config=require(_0xbf88('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xbf88('0x14'));function respondWithStatusCode(_0x230575,_0x42d22e){_0x42d22e=_0x42d22e||0xcc;return function(_0x2f990e){if(_0x2f990e){return _0x230575[_0xbf88('0x15')](_0x42d22e);}return _0x230575[_0xbf88('0x16')](_0x42d22e)[_0xbf88('0x17')]();};}function respondWithResult(_0xd52e2a,_0x1fd01d){_0x1fd01d=_0x1fd01d||0xc8;return function(_0x183172){if(_0x183172){return _0xd52e2a[_0xbf88('0x16')](_0x1fd01d)[_0xbf88('0x18')](_0x183172);}};}function respondWithFilteredResult(_0x37e357,_0x530a5a){return function(_0x4cbc70){if(_0x4cbc70){var _0xc0e7b4=typeof _0x530a5a[_0xbf88('0x19')]==='undefined'&&typeof _0x530a5a[_0xbf88('0x1a')]===_0xbf88('0x1b');var _0x2f33d7=_0x4cbc70[_0xbf88('0x1c')];var _0x27a6b9=_0xc0e7b4?0x0:_0x530a5a['offset'];var _0x1cbc4f=_0xc0e7b4?_0x4cbc70[_0xbf88('0x1c')]:_0x530a5a['offset']+_0x530a5a[_0xbf88('0x1a')];var _0x7bd45e;if(_0x1cbc4f>=_0x2f33d7){_0x1cbc4f=_0x2f33d7;_0x7bd45e=0xc8;}else{_0x7bd45e=0xce;}_0x37e357['status'](_0x7bd45e);return _0x37e357[_0xbf88('0x1d')](_0xbf88('0x1e'),_0x27a6b9+'-'+_0x1cbc4f+'/'+_0x2f33d7)['json'](_0x4cbc70);}return null;};}function patchUpdates(_0x2fb060){return function(_0x19e5cb){try{jsonpatch[_0xbf88('0x1f')](_0x19e5cb,_0x2fb060,!![]);}catch(_0x5c854f){return BPromise['reject'](_0x5c854f);}return _0x19e5cb['save']();};}function saveUpdates(_0x57c9a9,_0x35157){return function(_0x47423c){if(_0x47423c){return _0x47423c[_0xbf88('0x20')](_0x57c9a9)[_0xbf88('0x21')](function(_0x1394dd){return _0x1394dd;});}return null;};}function removeEntity(_0x43a03b,_0x66fc35){return function(_0x33f788){if(_0x33f788){return _0x33f788[_0xbf88('0x22')]()['then'](function(){_0x43a03b[_0xbf88('0x16')](0xcc)[_0xbf88('0x17')]();});}};}function handleEntityNotFound(_0x136d4f,_0x2e3c39){return function(_0x5866dc){if(!_0x5866dc){_0x136d4f['sendStatus'](0x194);}return _0x5866dc;};}function handleError(_0xe29391,_0x56c392){_0x56c392=_0x56c392||0x1f4;return function(_0x4db7b7){logger[_0xbf88('0x23')](_0x4db7b7['stack']);if(_0x4db7b7[_0xbf88('0x24')]){delete _0x4db7b7[_0xbf88('0x24')];}_0xe29391[_0xbf88('0x16')](_0x56c392)[_0xbf88('0x25')](_0x4db7b7);};}exports[_0xbf88('0x26')]=function(_0x14f563,_0x447b74){var _0x131c9a={},_0x42b401={},_0x3d757b={'count':0x0,'rows':[]};var _0x1b9c1d=_[_0xbf88('0x27')](db['ZohoAccount']['rawAttributes'],function(_0x388890){return{'name':_0x388890[_0xbf88('0x28')],'type':_0x388890[_0xbf88('0x29')][_0xbf88('0x2a')]};});_0x42b401[_0xbf88('0x2b')]=_[_0xbf88('0x27')](_0x1b9c1d,_0xbf88('0x24'));_0x42b401['query']=_[_0xbf88('0x2c')](_0x14f563[_0xbf88('0x2d')]);_0x42b401[_0xbf88('0x2e')]=_['intersection'](_0x42b401['model'],_0x42b401[_0xbf88('0x2d')]);_0x131c9a[_0xbf88('0x2f')]=_['intersection'](_0x42b401[_0xbf88('0x2b')],qs[_0xbf88('0x30')](_0x14f563[_0xbf88('0x2d')][_0xbf88('0x30')]));_0x131c9a[_0xbf88('0x2f')]=_0x131c9a[_0xbf88('0x2f')]['length']?_0x131c9a[_0xbf88('0x2f')]:_0x42b401['model'];if(!_0x14f563[_0xbf88('0x2d')]['hasOwnProperty'](_0xbf88('0x31'))){_0x131c9a[_0xbf88('0x1a')]=qs['limit'](_0x14f563[_0xbf88('0x2d')][_0xbf88('0x1a')]);_0x131c9a['offset']=qs['offset'](_0x14f563['query'][_0xbf88('0x19')]);}_0x131c9a[_0xbf88('0x32')]=qs['sort'](_0x14f563['query'][_0xbf88('0x33')]);_0x131c9a[_0xbf88('0x34')]=qs[_0xbf88('0x2e')](_[_0xbf88('0x35')](_0x14f563[_0xbf88('0x2d')],_0x42b401[_0xbf88('0x2e')]),_0x1b9c1d);if(_0x14f563[_0xbf88('0x2d')][_0xbf88('0x36')]){_0x131c9a[_0xbf88('0x34')]=_[_0xbf88('0x37')](_0x131c9a[_0xbf88('0x34')],{'$or':_[_0xbf88('0x27')](_0x1b9c1d,function(_0x1b605d){if(_0x1b605d[_0xbf88('0x29')]!==_0xbf88('0x38')){var _0x4a38e9={};_0x4a38e9[_0x1b605d[_0xbf88('0x24')]]={'$like':'%'+_0x14f563['query'][_0xbf88('0x36')]+'%'};return _0x4a38e9;}})});}_0x131c9a=_[_0xbf88('0x37')]({},_0x131c9a,_0x14f563[_0xbf88('0x39')]);var _0x188865={'where':_0x131c9a['where']};return db[_0xbf88('0x3a')][_0xbf88('0x1c')](_0x188865)['then'](function(_0x50ed7f){_0x3d757b[_0xbf88('0x1c')]=_0x50ed7f;if(_0x14f563[_0xbf88('0x2d')][_0xbf88('0x3b')]){_0x131c9a[_0xbf88('0x3c')]=[{'all':!![]}];}return db[_0xbf88('0x3a')][_0xbf88('0x3d')](_0x131c9a);})[_0xbf88('0x21')](function(_0x2ecb65){_0x3d757b['rows']=_0x2ecb65;return _0x3d757b;})[_0xbf88('0x21')](respondWithFilteredResult(_0x447b74,_0x131c9a))['catch'](handleError(_0x447b74,null));};exports[_0xbf88('0x3e')]=function(_0x4697d1,_0x232d9a){var _0x1be62c={'raw':![],'where':{'id':_0x4697d1['params']['id']}},_0x5afb42={};_0x5afb42[_0xbf88('0x2b')]=_[_0xbf88('0x2c')](db[_0xbf88('0x3a')][_0xbf88('0x3f')]);_0x5afb42[_0xbf88('0x2d')]=_[_0xbf88('0x2c')](_0x4697d1['query']);_0x5afb42[_0xbf88('0x2e')]=_['intersection'](_0x5afb42[_0xbf88('0x2b')],_0x5afb42[_0xbf88('0x2d')]);_0x1be62c[_0xbf88('0x2f')]=_[_0xbf88('0x40')](_0x5afb42[_0xbf88('0x2b')],qs[_0xbf88('0x30')](_0x4697d1[_0xbf88('0x2d')][_0xbf88('0x30')]));_0x1be62c[_0xbf88('0x2f')]=_0x1be62c[_0xbf88('0x2f')][_0xbf88('0x41')]?_0x1be62c[_0xbf88('0x2f')]:_0x5afb42['model'];if(_0x4697d1[_0xbf88('0x2d')]['includeAll']){_0x1be62c[_0xbf88('0x3c')]=[{'all':!![]}];}_0x1be62c=_[_0xbf88('0x37')]({},_0x1be62c,_0x4697d1[_0xbf88('0x39')]);return db[_0xbf88('0x3a')][_0xbf88('0x42')](_0x1be62c)[_0xbf88('0x21')](handleEntityNotFound(_0x232d9a,null))[_0xbf88('0x21')](respondWithResult(_0x232d9a,null))[_0xbf88('0x43')](handleError(_0x232d9a,null));};exports[_0xbf88('0x44')]=function(_0x518b16,_0x1f55a5){return db[_0xbf88('0x3a')][_0xbf88('0x44')](_0x518b16['body'],{})['then'](respondWithResult(_0x1f55a5,0xc9))[_0xbf88('0x43')](handleError(_0x1f55a5,null));};exports[_0xbf88('0x20')]=function(_0x493179,_0x4aedb4){if(_0x493179[_0xbf88('0x45')]['id']){delete _0x493179[_0xbf88('0x45')]['id'];}return db[_0xbf88('0x3a')][_0xbf88('0x42')]({'where':{'id':_0x493179[_0xbf88('0x46')]['id']}})['then'](handleEntityNotFound(_0x4aedb4,null))[_0xbf88('0x21')](saveUpdates(_0x493179['body'],null))[_0xbf88('0x21')](respondWithResult(_0x4aedb4,null))[_0xbf88('0x43')](handleError(_0x4aedb4,null));};exports[_0xbf88('0x22')]=function(_0x2e56e9,_0x4aa582){return db['ZohoAccount'][_0xbf88('0x42')]({'where':{'id':_0x2e56e9[_0xbf88('0x46')]['id']}})['then'](handleEntityNotFound(_0x4aa582,null))['then'](removeEntity(_0x4aa582,null))[_0xbf88('0x43')](handleError(_0x4aa582,null));};exports['getConfigurations']=function(_0x209ca,_0x18cbeb,_0x2616e6){var _0x3295ee={};var _0x4c2f5f={};var _0x36223c;var _0x18aac4;return db[_0xbf88('0x3a')][_0xbf88('0x47')]({'where':{'id':_0x209ca[_0xbf88('0x46')]['id']}})[_0xbf88('0x21')](handleEntityNotFound(_0x18cbeb,null))[_0xbf88('0x21')](function(_0x53670f){if(_0x53670f){_0x36223c=_0x53670f;_0x4c2f5f[_0xbf88('0x2b')]=_['keys'](db[_0xbf88('0x48')][_0xbf88('0x3f')]);_0x4c2f5f[_0xbf88('0x2d')]=_['keys'](_0x209ca[_0xbf88('0x2d')]);_0x4c2f5f[_0xbf88('0x2e')]=_['intersection'](_0x4c2f5f[_0xbf88('0x2b')],_0x4c2f5f[_0xbf88('0x2d')]);_0x3295ee[_0xbf88('0x2f')]=_[_0xbf88('0x40')](_0x4c2f5f['model'],qs['fields'](_0x209ca[_0xbf88('0x2d')][_0xbf88('0x30')]));_0x3295ee[_0xbf88('0x2f')]=_0x3295ee[_0xbf88('0x2f')][_0xbf88('0x41')]?_0x3295ee['attributes']:_0x4c2f5f[_0xbf88('0x2b')];_0x3295ee['order']=qs[_0xbf88('0x33')](_0x209ca[_0xbf88('0x2d')]['sort']);_0x3295ee['where']=qs[_0xbf88('0x2e')](_[_0xbf88('0x35')](_0x209ca[_0xbf88('0x2d')],_0x4c2f5f[_0xbf88('0x2e')]));if(_0x209ca[_0xbf88('0x2d')][_0xbf88('0x36')]){_0x3295ee['where']=_[_0xbf88('0x37')](_0x3295ee[_0xbf88('0x34')],{'$or':_[_0xbf88('0x27')](_0x3295ee[_0xbf88('0x2f')],function(_0x3f4667){var _0x4f4148={};_0x4f4148[_0x3f4667]={'$like':'%'+_0x209ca[_0xbf88('0x2d')][_0xbf88('0x36')]+'%'};return _0x4f4148;})});}_0x3295ee=_[_0xbf88('0x37')]({},_0x3295ee,_0x209ca[_0xbf88('0x39')]);return _0x36223c[_0xbf88('0x49')](_0x3295ee);}})[_0xbf88('0x21')](function(_0x1340b8){if(_0x1340b8){_0x18aac4=_0x1340b8['length'];if(!_0x209ca[_0xbf88('0x2d')][_0xbf88('0x4a')]('nolimit')){_0x3295ee[_0xbf88('0x1a')]=qs[_0xbf88('0x1a')](_0x209ca[_0xbf88('0x2d')][_0xbf88('0x1a')]);_0x3295ee[_0xbf88('0x19')]=qs[_0xbf88('0x19')](_0x209ca[_0xbf88('0x2d')][_0xbf88('0x19')]);}return _0x36223c[_0xbf88('0x49')](_0x3295ee);}})[_0xbf88('0x21')](function(_0x13c8ea){if(_0x13c8ea){return _0x13c8ea?{'count':_0x18aac4,'rows':_0x13c8ea}:null;}})[_0xbf88('0x21')](respondWithResult(_0x18cbeb,null))[_0xbf88('0x43')](handleError(_0x18cbeb,null));};exports['addConfiguration']=function(_0x1401ba,_0x391601,_0x34453d){if(_0x1401ba[_0xbf88('0x45')]['id']){delete _0x1401ba[_0xbf88('0x45')]['id'];}return db[_0xbf88('0x3a')][_0xbf88('0x47')]({'where':{'id':_0x1401ba[_0xbf88('0x46')]['id']}})[_0xbf88('0x21')](handleEntityNotFound(_0x391601,null))[_0xbf88('0x21')](function(_0x4389f8){if(_0x4389f8){_0x1401ba[_0xbf88('0x45')]['AccountId']=_0x4389f8['id'];_0x1401ba['body'][_0xbf88('0x4b')]=integrations['getSubjects'](_0x1401ba[_0xbf88('0x45')][_0xbf88('0x4c')],_0x1401ba['body']['type']);_0x1401ba[_0xbf88('0x45')][_0xbf88('0x4d')]=integrations[_0xbf88('0x4e')](_0x1401ba[_0xbf88('0x45')][_0xbf88('0x4c')],_0x1401ba[_0xbf88('0x45')][_0xbf88('0x29')]);return db[_0xbf88('0x48')][_0xbf88('0x44')](_0x1401ba[_0xbf88('0x45')],{'include':[{'model':db[_0xbf88('0x4f')],'as':'Subjects'},{'model':db[_0xbf88('0x4f')],'as':'Descriptions'}]});}return null;})[_0xbf88('0x21')](respondWithResult(_0x391601,null))['catch'](handleError(_0x391601,null));};function getAccessToken(_0x406dea){return new Promise(function(_0x2a0c3e,_0x5bc1fd){var _0x268d89;switch(_0x406dea[_0xbf88('0x50')]){case'US':_0x268d89=_0xbf88('0x51');break;case'AU':_0x268d89=_0xbf88('0x52');break;case'EU':_0x268d89=_0xbf88('0x53');break;case'IN':_0x268d89='https://accounts.zoho.in';break;case'CN':_0x268d89=_0xbf88('0x54');break;default:_0x268d89=_0xbf88('0x53');break;}var _0x252343={'method':_0xbf88('0x55'),'uri':_0x268d89+_0xbf88('0x56'),'qs':{'refresh_token':_0x406dea[_0xbf88('0x57')],'client_id':_0x406dea['clientId'],'client_secret':_0x406dea['clientSecret'],'grant_type':_0xbf88('0x58')},'json':!![]};return rp(_0x252343)[_0xbf88('0x21')](function(_0x4f7819){if(_0x4f7819['access_token']){_0x2a0c3e(_0x4f7819[_0xbf88('0x59')]);}else{_0x5bc1fd(_0xbf88('0x5a'));}})[_0xbf88('0x43')](function(_0xffca7f){_0x5bc1fd(_0xffca7f);});});}exports['getFields']=function(_0x493ef5,_0x385189,_0x29f64d){var _0x2d1d81,_0x3aa3fa,_0x93044d,_0x5b6336,_0x27e17e;return db[_0xbf88('0x3a')][_0xbf88('0x47')]({'where':{'id':_0x493ef5[_0xbf88('0x46')]['id']},'attributes':['id','host',_0xbf88('0x50'),_0xbf88('0x5b'),_0xbf88('0x5c'),_0xbf88('0x5d'),_0xbf88('0x5e'),_0xbf88('0x57')]})[_0xbf88('0x21')](handleEntityNotFound(_0x385189,null))[_0xbf88('0x21')](function(_0x52aafe){_0x27e17e=_0x52aafe;_0x2d1d81=_0x27e17e[_0xbf88('0x5f')];_0x3aa3fa=_0x2d1d81===_0xbf88('0x60')?'eu':_0xbf88('0x61');_0x93044d=_0x27e17e[_0xbf88('0x5d')];var _0xc4cee0=_0x93044d[_0xbf88('0x62')](-0x1);if(_0xc4cee0==='/'||_0xc4cee0==='\x5c'||_0xc4cee0===':'){_0x93044d=_0x93044d[_0xbf88('0x63')](0x0,_0x93044d[_0xbf88('0x64')](_0xc4cee0));}if(!_0x27e17e[_0xbf88('0x57')]){throw new Error(_0xbf88('0x65'));}return getAccessToken(_0x27e17e);})[_0xbf88('0x21')](function(_0x54a34a){if(_0x54a34a){return rp({'method':_0xbf88('0x66'),'uri':util[_0xbf88('0x67')](_0xbf88('0x68'),_0x3aa3fa),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x54a34a},'json':!![]});}})[_0xbf88('0x21')](function(_0x5472b5){if(_0x5472b5){if(_0x5472b5['response']&&_0x5472b5[_0xbf88('0x69')]['error']){throw new Error(_0x5472b5['response'][_0xbf88('0x23')]['message']);}var _0x114ff2=[];var _0x20e564=[];var _0x12e6c2=[_0xbf88('0x6a'),_0xbf88('0x6b'),_0xbf88('0x6c'),_0xbf88('0x6d'),_0xbf88('0x6e'),'Call_Result',_0xbf88('0x6f'),_0xbf88('0x70')];_0x20e564=_[_0xbf88('0x71')](_0x5472b5[_0xbf88('0x30')],function(_0x3cfbb2){return _0x12e6c2[_0xbf88('0x72')](_0x3cfbb2['api_name']);});for(var _0x4d4143=0x0;_0x4d4143<_0x20e564[_0xbf88('0x41')];_0x4d4143++){if(_0x20e564[_0x4d4143][_0xbf88('0x73')]===![]){_0x114ff2[_0xbf88('0x74')]({'id':_0x20e564[_0x4d4143]['id'],'name':_0x20e564[_0x4d4143][_0xbf88('0x75')],'custom':_0x20e564[_0x4d4143][_0xbf88('0x76')],'options':_0x20e564[_0x4d4143][_0xbf88('0x77')]==='picklist'&&_0x20e564[_0x4d4143][_0xbf88('0x78')][_0xbf88('0x41')]>-0x1?_['map'](_0x20e564[_0x4d4143][_0xbf88('0x78')],function(_0x53bb71){return{'name':_0x53bb71,'value':_0x53bb71};}):[]});}}return{'count':_0x114ff2['length'],'rows':_0x114ff2};}else{return{'count':0x0,'rows':[]};}})[_0xbf88('0x21')](respondWithResult(_0x385189,null))[_0xbf88('0x43')](function(_0x3672f5){var _0x2a6306=_0x493ef5[_0xbf88('0x2d')]['test']?0x1f4:_0x3672f5['statusCode']||0x1f4;logger[_0xbf88('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xbf88('0x79'),_0x2a6306,JSON['stringify'](_0x3672f5));delete _0x3672f5[_0xbf88('0x24')];if(_0x2a6306===0x191){_0x2a6306=0x190;}_0x385189['status'](_0x2a6306)[_0xbf88('0x25')](_0x493ef5[_0xbf88('0x2d')][_0xbf88('0x7a')]?{'message':_0xbf88('0x7b'),'statusCode':_0x3672f5[_0xbf88('0x7c')]}:_0x3672f5);});}; \ No newline at end of file +var _0xfa2b=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','ZohoConfiguration','options','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientId','serverUrl','code','com','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','error','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x330a51,_0x42c33b){var _0x55aa63=function(_0x5ddc09){while(--_0x5ddc09){_0x330a51['push'](_0x330a51['shift']());}};_0x55aa63(++_0x42c33b);}(_0xfa2b,0xf3));var _0xbfa2=function(_0x258f19,_0x5cff7b){_0x258f19=_0x258f19-0x0;var _0x2b3af9=_0xfa2b[_0x258f19];return _0x2b3af9;};'use strict';var emlformat=require(_0xbfa2('0x0'));var rimraf=require(_0xbfa2('0x1'));var zipdir=require(_0xbfa2('0x2'));var jsonpatch=require(_0xbfa2('0x3'));var rp=require(_0xbfa2('0x4'));var moment=require(_0xbfa2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfa2('0x6'));var util=require('util');var path=require(_0xbfa2('0x7'));var sox=require(_0xbfa2('0x8'));var csv=require(_0xbfa2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfa2('0xa'));var _=require(_0xbfa2('0xb'));var squel=require(_0xbfa2('0xc'));var crypto=require('crypto');var jsforce=require(_0xbfa2('0xd'));var deskjs=require(_0xbfa2('0xe'));var toCsv=require(_0xbfa2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbfa2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbfa2('0x10'));var as=require(_0xbfa2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfa2('0x12'))(_0xbfa2('0x13'));var utils=require(_0xbfa2('0x14'));var config=require(_0xbfa2('0x15'));var licenseUtil=require(_0xbfa2('0x16'));var db=require(_0xbfa2('0x17'))['db'];var integrations=require(_0xbfa2('0x18'));function respondWithStatusCode(_0x1b39d8,_0x15be30){_0x15be30=_0x15be30||0xcc;return function(_0xf6c978){if(_0xf6c978){return _0x1b39d8[_0xbfa2('0x19')](_0x15be30);}return _0x1b39d8[_0xbfa2('0x1a')](_0x15be30)[_0xbfa2('0x1b')]();};}function respondWithResult(_0xd4f691,_0x55b05c){_0x55b05c=_0x55b05c||0xc8;return function(_0x2bc0a5){if(_0x2bc0a5){return _0xd4f691['status'](_0x55b05c)[_0xbfa2('0x1c')](_0x2bc0a5);}};}function respondWithFilteredResult(_0x386dd5,_0x259b90){return function(_0x595a2e){if(_0x595a2e){var _0x2eda72=typeof _0x259b90['offset']==='undefined'&&typeof _0x259b90[_0xbfa2('0x1d')]===_0xbfa2('0x1e');var _0x15db28=_0x595a2e[_0xbfa2('0x1f')];var _0x7b41f7=_0x2eda72?0x0:_0x259b90['offset'];var _0x2c0506=_0x2eda72?_0x595a2e[_0xbfa2('0x1f')]:_0x259b90['offset']+_0x259b90[_0xbfa2('0x1d')];var _0x2e4c72;if(_0x2c0506>=_0x15db28){_0x2c0506=_0x15db28;_0x2e4c72=0xc8;}else{_0x2e4c72=0xce;}_0x386dd5[_0xbfa2('0x1a')](_0x2e4c72);return _0x386dd5[_0xbfa2('0x20')](_0xbfa2('0x21'),_0x7b41f7+'-'+_0x2c0506+'/'+_0x15db28)[_0xbfa2('0x1c')](_0x595a2e);}return null;};}function patchUpdates(_0x17dda3){return function(_0x71b7c3){try{jsonpatch[_0xbfa2('0x22')](_0x71b7c3,_0x17dda3,!![]);}catch(_0x10fb13){return BPromise['reject'](_0x10fb13);}return _0x71b7c3[_0xbfa2('0x23')]();};}function saveUpdates(_0x5b124b,_0x1a1fd7){return function(_0x5ef4b3){if(_0x5ef4b3){return _0x5ef4b3[_0xbfa2('0x24')](_0x5b124b)[_0xbfa2('0x25')](function(_0x4031d1){return _0x4031d1;});}return null;};}function removeEntity(_0x2cd1dd,_0x1c0a71){return function(_0x396bbe){if(_0x396bbe){return _0x396bbe[_0xbfa2('0x26')]()[_0xbfa2('0x25')](function(){_0x2cd1dd[_0xbfa2('0x1a')](0xcc)[_0xbfa2('0x1b')]();});}};}function handleEntityNotFound(_0x1e9d2a,_0x54eee2){return function(_0x17c97a){if(!_0x17c97a){_0x1e9d2a[_0xbfa2('0x19')](0x194);}return _0x17c97a;};}function handleError(_0x6ae2d2,_0x5a868c){_0x5a868c=_0x5a868c||0x1f4;return function(_0x191826){logger['error'](_0x191826[_0xbfa2('0x27')]);if(_0x191826[_0xbfa2('0x28')]){delete _0x191826[_0xbfa2('0x28')];}_0x6ae2d2[_0xbfa2('0x1a')](_0x5a868c)[_0xbfa2('0x29')](_0x191826);};}exports['index']=function(_0x788488,_0x54dfb8){var _0x27462a={},_0x26c643={},_0x163c44={'count':0x0,'rows':[]};var _0x20e9a6=_[_0xbfa2('0x2a')](db[_0xbfa2('0x2b')][_0xbfa2('0x2c')],function(_0x54c8a4){return{'name':_0x54c8a4[_0xbfa2('0x2d')],'type':_0x54c8a4[_0xbfa2('0x2e')]['key']};});_0x26c643['model']=_['map'](_0x20e9a6,_0xbfa2('0x28'));_0x26c643[_0xbfa2('0x2f')]=_[_0xbfa2('0x30')](_0x788488['query']);_0x26c643['filters']=_[_0xbfa2('0x31')](_0x26c643[_0xbfa2('0x32')],_0x26c643[_0xbfa2('0x2f')]);_0x27462a['attributes']=_['intersection'](_0x26c643[_0xbfa2('0x32')],qs['fields'](_0x788488[_0xbfa2('0x2f')][_0xbfa2('0x33')]));_0x27462a['attributes']=_0x27462a['attributes']['length']?_0x27462a[_0xbfa2('0x34')]:_0x26c643['model'];if(!_0x788488[_0xbfa2('0x2f')][_0xbfa2('0x35')](_0xbfa2('0x36'))){_0x27462a['limit']=qs[_0xbfa2('0x1d')](_0x788488[_0xbfa2('0x2f')][_0xbfa2('0x1d')]);_0x27462a[_0xbfa2('0x37')]=qs[_0xbfa2('0x37')](_0x788488[_0xbfa2('0x2f')][_0xbfa2('0x37')]);}_0x27462a[_0xbfa2('0x38')]=qs['sort'](_0x788488['query'][_0xbfa2('0x39')]);_0x27462a[_0xbfa2('0x3a')]=qs[_0xbfa2('0x3b')](_[_0xbfa2('0x3c')](_0x788488['query'],_0x26c643[_0xbfa2('0x3b')]),_0x20e9a6);if(_0x788488[_0xbfa2('0x2f')][_0xbfa2('0x3d')]){_0x27462a[_0xbfa2('0x3a')]=_['merge'](_0x27462a['where'],{'$or':_[_0xbfa2('0x2a')](_0x20e9a6,function(_0x2b185f){if(_0x2b185f['type']!==_0xbfa2('0x3e')){var _0x394ec4={};_0x394ec4[_0x2b185f[_0xbfa2('0x28')]]={'$like':'%'+_0x788488[_0xbfa2('0x2f')][_0xbfa2('0x3d')]+'%'};return _0x394ec4;}})});}_0x27462a=_[_0xbfa2('0x3f')]({},_0x27462a,_0x788488['options']);var _0x3f5ec7={'where':_0x27462a[_0xbfa2('0x3a')]};return db['ZohoAccount'][_0xbfa2('0x1f')](_0x3f5ec7)[_0xbfa2('0x25')](function(_0x189a1f){_0x163c44['count']=_0x189a1f;if(_0x788488['query'][_0xbfa2('0x40')]){_0x27462a[_0xbfa2('0x41')]=[{'all':!![]}];}return db[_0xbfa2('0x2b')][_0xbfa2('0x42')](_0x27462a);})[_0xbfa2('0x25')](function(_0x23f905){_0x163c44[_0xbfa2('0x43')]=_0x23f905;return _0x163c44;})[_0xbfa2('0x25')](respondWithFilteredResult(_0x54dfb8,_0x27462a))[_0xbfa2('0x44')](handleError(_0x54dfb8,null));};exports[_0xbfa2('0x45')]=function(_0x1cbf35,_0x317a54){var _0xdb2371={'raw':![],'where':{'id':_0x1cbf35[_0xbfa2('0x46')]['id']}},_0x4be8c3={};_0x4be8c3['model']=_[_0xbfa2('0x30')](db[_0xbfa2('0x2b')][_0xbfa2('0x2c')]);_0x4be8c3['query']=_[_0xbfa2('0x30')](_0x1cbf35[_0xbfa2('0x2f')]);_0x4be8c3[_0xbfa2('0x3b')]=_['intersection'](_0x4be8c3['model'],_0x4be8c3['query']);_0xdb2371['attributes']=_[_0xbfa2('0x31')](_0x4be8c3[_0xbfa2('0x32')],qs[_0xbfa2('0x33')](_0x1cbf35[_0xbfa2('0x2f')][_0xbfa2('0x33')]));_0xdb2371[_0xbfa2('0x34')]=_0xdb2371[_0xbfa2('0x34')][_0xbfa2('0x47')]?_0xdb2371['attributes']:_0x4be8c3[_0xbfa2('0x32')];if(_0x1cbf35[_0xbfa2('0x2f')][_0xbfa2('0x40')]){_0xdb2371[_0xbfa2('0x41')]=[{'all':!![]}];}_0xdb2371=_[_0xbfa2('0x3f')]({},_0xdb2371,_0x1cbf35['options']);return db['ZohoAccount']['find'](_0xdb2371)[_0xbfa2('0x25')](handleEntityNotFound(_0x317a54,null))['then'](respondWithResult(_0x317a54,null))[_0xbfa2('0x44')](handleError(_0x317a54,null));};exports[_0xbfa2('0x48')]=function(_0x3c44f2,_0x404b1e){return db[_0xbfa2('0x2b')][_0xbfa2('0x48')](_0x3c44f2['body'],{})[_0xbfa2('0x25')](respondWithResult(_0x404b1e,0xc9))['catch'](handleError(_0x404b1e,null));};exports['update']=function(_0x5edbbf,_0x3551f0){if(_0x5edbbf[_0xbfa2('0x49')]['id']){delete _0x5edbbf['body']['id'];}return db[_0xbfa2('0x2b')][_0xbfa2('0x4a')]({'where':{'id':_0x5edbbf[_0xbfa2('0x46')]['id']}})[_0xbfa2('0x25')](handleEntityNotFound(_0x3551f0,null))[_0xbfa2('0x25')](saveUpdates(_0x5edbbf['body'],null))[_0xbfa2('0x25')](respondWithResult(_0x3551f0,null))[_0xbfa2('0x44')](handleError(_0x3551f0,null));};exports[_0xbfa2('0x26')]=function(_0x44695e,_0xe25e9c){return db[_0xbfa2('0x2b')][_0xbfa2('0x4a')]({'where':{'id':_0x44695e[_0xbfa2('0x46')]['id']}})[_0xbfa2('0x25')](handleEntityNotFound(_0xe25e9c,null))[_0xbfa2('0x25')](removeEntity(_0xe25e9c,null))[_0xbfa2('0x44')](handleError(_0xe25e9c,null));};exports[_0xbfa2('0x4b')]=function(_0x2bacd1,_0x5e6238,_0x38a8cd){var _0x22481f={};var _0x3c4b31={};var _0x507904;var _0x277285;return db[_0xbfa2('0x2b')][_0xbfa2('0x4c')]({'where':{'id':_0x2bacd1[_0xbfa2('0x46')]['id']}})[_0xbfa2('0x25')](handleEntityNotFound(_0x5e6238,null))[_0xbfa2('0x25')](function(_0x25e761){if(_0x25e761){_0x507904=_0x25e761;_0x3c4b31[_0xbfa2('0x32')]=_[_0xbfa2('0x30')](db[_0xbfa2('0x4d')][_0xbfa2('0x2c')]);_0x3c4b31[_0xbfa2('0x2f')]=_[_0xbfa2('0x30')](_0x2bacd1[_0xbfa2('0x2f')]);_0x3c4b31[_0xbfa2('0x3b')]=_['intersection'](_0x3c4b31[_0xbfa2('0x32')],_0x3c4b31['query']);_0x22481f[_0xbfa2('0x34')]=_[_0xbfa2('0x31')](_0x3c4b31[_0xbfa2('0x32')],qs[_0xbfa2('0x33')](_0x2bacd1['query']['fields']));_0x22481f[_0xbfa2('0x34')]=_0x22481f[_0xbfa2('0x34')][_0xbfa2('0x47')]?_0x22481f[_0xbfa2('0x34')]:_0x3c4b31[_0xbfa2('0x32')];_0x22481f[_0xbfa2('0x38')]=qs[_0xbfa2('0x39')](_0x2bacd1[_0xbfa2('0x2f')]['sort']);_0x22481f[_0xbfa2('0x3a')]=qs['filters'](_[_0xbfa2('0x3c')](_0x2bacd1['query'],_0x3c4b31[_0xbfa2('0x3b')]));if(_0x2bacd1[_0xbfa2('0x2f')]['filter']){_0x22481f[_0xbfa2('0x3a')]=_[_0xbfa2('0x3f')](_0x22481f[_0xbfa2('0x3a')],{'$or':_[_0xbfa2('0x2a')](_0x22481f[_0xbfa2('0x34')],function(_0x1253d4){var _0xffa4ed={};_0xffa4ed[_0x1253d4]={'$like':'%'+_0x2bacd1['query']['filter']+'%'};return _0xffa4ed;})});}_0x22481f=_[_0xbfa2('0x3f')]({},_0x22481f,_0x2bacd1[_0xbfa2('0x4e')]);return _0x507904[_0xbfa2('0x4b')](_0x22481f);}})[_0xbfa2('0x25')](function(_0xdb68f1){if(_0xdb68f1){_0x277285=_0xdb68f1['length'];if(!_0x2bacd1[_0xbfa2('0x2f')][_0xbfa2('0x35')]('nolimit')){_0x22481f[_0xbfa2('0x1d')]=qs[_0xbfa2('0x1d')](_0x2bacd1['query'][_0xbfa2('0x1d')]);_0x22481f[_0xbfa2('0x37')]=qs[_0xbfa2('0x37')](_0x2bacd1['query']['offset']);}return _0x507904['getConfigurations'](_0x22481f);}})['then'](function(_0x1cfac4){if(_0x1cfac4){return _0x1cfac4?{'count':_0x277285,'rows':_0x1cfac4}:null;}})[_0xbfa2('0x25')](respondWithResult(_0x5e6238,null))['catch'](handleError(_0x5e6238,null));};exports[_0xbfa2('0x4f')]=function(_0x3dcc36,_0x351609,_0x5db259){if(_0x3dcc36[_0xbfa2('0x49')]['id']){delete _0x3dcc36[_0xbfa2('0x49')]['id'];}return db[_0xbfa2('0x2b')][_0xbfa2('0x4c')]({'where':{'id':_0x3dcc36[_0xbfa2('0x46')]['id']}})['then'](handleEntityNotFound(_0x351609,null))[_0xbfa2('0x25')](function(_0x31a323){if(_0x31a323){_0x3dcc36['body'][_0xbfa2('0x50')]=_0x31a323['id'];_0x3dcc36[_0xbfa2('0x49')][_0xbfa2('0x51')]=integrations[_0xbfa2('0x52')](_0x3dcc36['body'][_0xbfa2('0x53')],_0x3dcc36[_0xbfa2('0x49')][_0xbfa2('0x2e')]);_0x3dcc36[_0xbfa2('0x49')]['Descriptions']=integrations[_0xbfa2('0x54')](_0x3dcc36[_0xbfa2('0x49')][_0xbfa2('0x53')],_0x3dcc36[_0xbfa2('0x49')][_0xbfa2('0x2e')]);return db[_0xbfa2('0x4d')][_0xbfa2('0x48')](_0x3dcc36[_0xbfa2('0x49')],{'include':[{'model':db[_0xbfa2('0x55')],'as':_0xbfa2('0x51')},{'model':db[_0xbfa2('0x55')],'as':'Descriptions'}]});}return null;})[_0xbfa2('0x25')](respondWithResult(_0x351609,null))[_0xbfa2('0x44')](handleError(_0x351609,null));};function getAccessToken(_0xd23e46){return new Promise(function(_0x4d8563,_0x3cca7a){var _0x2e4e24;switch(_0xd23e46['zone']){case'US':_0x2e4e24=_0xbfa2('0x56');break;case'AU':_0x2e4e24='https://accounts.zoho.com.au';break;case'EU':_0x2e4e24=_0xbfa2('0x57');break;case'IN':_0x2e4e24=_0xbfa2('0x58');break;case'CN':_0x2e4e24=_0xbfa2('0x59');break;default:_0x2e4e24=_0xbfa2('0x57');break;}var _0x3168d6={'method':'POST','uri':_0x2e4e24+_0xbfa2('0x5a'),'qs':{'refresh_token':_0xd23e46[_0xbfa2('0x5b')],'client_id':_0xd23e46['clientId'],'client_secret':_0xd23e46[_0xbfa2('0x5c')],'grant_type':_0xbfa2('0x5d')},'json':!![]};return rp(_0x3168d6)[_0xbfa2('0x25')](function(_0x39349c){if(_0x39349c[_0xbfa2('0x5e')]){_0x4d8563(_0x39349c[_0xbfa2('0x5e')]);}else{_0x3cca7a(_0xbfa2('0x5f'));}})[_0xbfa2('0x44')](function(_0x566568){_0x3cca7a(_0x566568);});});}exports['getFields']=function(_0x2f06ba,_0x8e9d09,_0x14f9ac){var _0x432fbf,_0x46ddf1,_0x1c00df,_0x2ce8e7,_0x55f8fa;return db[_0xbfa2('0x2b')]['findOne']({'where':{'id':_0x2f06ba[_0xbfa2('0x46')]['id']},'attributes':['id',_0xbfa2('0x60'),_0xbfa2('0x61'),_0xbfa2('0x62'),_0xbfa2('0x5c'),_0xbfa2('0x63'),_0xbfa2('0x64'),_0xbfa2('0x5b')]})['then'](handleEntityNotFound(_0x8e9d09,null))[_0xbfa2('0x25')](function(_0xc7de30){_0x55f8fa=_0xc7de30;_0x432fbf=_0x55f8fa['host'];_0x46ddf1=_0x432fbf==='zoho.eu'?'eu':_0xbfa2('0x65');_0x1c00df=_0x55f8fa[_0xbfa2('0x63')];var _0x2a5123=_0x1c00df['slice'](-0x1);if(_0x2a5123==='/'||_0x2a5123==='\x5c'||_0x2a5123===':'){_0x1c00df=_0x1c00df[_0xbfa2('0x66')](0x0,_0x1c00df['lastIndexOf'](_0x2a5123));}if(!_0x55f8fa[_0xbfa2('0x5b')]){throw new Error(_0xbfa2('0x67'));}return getAccessToken(_0x55f8fa);})[_0xbfa2('0x25')](function(_0x11c180){if(_0x11c180){return rp({'method':_0xbfa2('0x68'),'uri':util[_0xbfa2('0x69')](_0xbfa2('0x6a'),_0x46ddf1),'qs':{'module':_0xbfa2('0x6b')},'headers':{'Authorization':_0xbfa2('0x6c')+_0x11c180},'json':!![]});}})[_0xbfa2('0x25')](function(_0x178ff1){if(_0x178ff1){if(_0x178ff1['response']&&_0x178ff1['response'][_0xbfa2('0x6d')]){throw new Error(_0x178ff1[_0xbfa2('0x6e')]['error'][_0xbfa2('0x6f')]);}var _0x1b78e6=[];var _0xc940ea=[];var _0x4ea4f0=['Owner',_0xbfa2('0x70'),_0xbfa2('0x71'),_0xbfa2('0x72'),_0xbfa2('0x73'),_0xbfa2('0x74'),_0xbfa2('0x75'),_0xbfa2('0x76')];_0xc940ea=_[_0xbfa2('0x77')](_0x178ff1['fields'],function(_0x5b5d39){return _0x4ea4f0[_0xbfa2('0x78')](_0x5b5d39[_0xbfa2('0x79')]);});for(var _0x4f17af=0x0;_0x4f17af<_0xc940ea[_0xbfa2('0x47')];_0x4f17af++){if(_0xc940ea[_0x4f17af][_0xbfa2('0x7a')]===![]){_0x1b78e6[_0xbfa2('0x7b')]({'id':_0xc940ea[_0x4f17af]['id'],'name':_0xc940ea[_0x4f17af]['display_label'],'custom':_0xc940ea[_0x4f17af][_0xbfa2('0x7c')],'options':_0xc940ea[_0x4f17af]['data_type']===_0xbfa2('0x7d')&&_0xc940ea[_0x4f17af][_0xbfa2('0x7e')][_0xbfa2('0x47')]>-0x1?_[_0xbfa2('0x2a')](_0xc940ea[_0x4f17af][_0xbfa2('0x7e')],function(_0x221674){return{'name':_0x221674,'value':_0x221674};}):[]});}}return{'count':_0x1b78e6[_0xbfa2('0x47')],'rows':_0x1b78e6};}else{return{'count':0x0,'rows':[]};}})[_0xbfa2('0x25')](respondWithResult(_0x8e9d09,null))[_0xbfa2('0x44')](function(_0x1f8a75){var _0x42b1a2=_0x2f06ba['query']['test']?0x1f4:_0x1f8a75['statusCode']||0x1f4;logger[_0xbfa2('0x6d')](_0xbfa2('0x7f'),_0xbfa2('0x80'),_0x42b1a2,JSON[_0xbfa2('0x81')](_0x1f8a75));delete _0x1f8a75[_0xbfa2('0x28')];if(_0x42b1a2===0x191){_0x42b1a2=0x190;}_0x8e9d09['status'](_0x42b1a2)[_0xbfa2('0x29')](_0x2f06ba[_0xbfa2('0x2f')][_0xbfa2('0x82')]?{'message':_0xbfa2('0x83'),'statusCode':_0x1f8a75[_0xbfa2('0x84')]}:_0x1f8a75);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e8b0557..cb8081a 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 _0x7ca6=['format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','inspect','catch','name','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','refresh_token','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','changed','zone','clientId','clientSecret','code','host','serverUrl','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','info'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x7ca6,0x133));var _0x67ca=function(_0x30fca9,_0x12cfb1){_0x30fca9=_0x30fca9-0x0;var _0x25db2a=_0x7ca6[_0x30fca9];return _0x25db2a;};'use strict';var _=require('lodash');var util=require(_0x67ca('0x0'));var logger=require(_0x67ca('0x1'))('api');var moment=require('moment');var BPromise=require(_0x67ca('0x2'));var rp=require(_0x67ca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67ca('0x4'));var config=require(_0x67ca('0x5'));var attributes=require(_0x67ca('0x6'));var integrations=require(_0x67ca('0x7'));module['exports']=function(_0x1ba93e,_0x12929f){return _0x1ba93e['define']('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b45a9,_0x45b6c7,_0x4638cc){if(_0x2b45a9[_0x67ca('0x8')](_0x67ca('0x9'))||_0x2b45a9[_0x67ca('0x8')]('serverUrl')||_0x2b45a9[_0x67ca('0x8')](_0x67ca('0xa'))||_0x2b45a9[_0x67ca('0x8')](_0x67ca('0xb'))||_0x2b45a9[_0x67ca('0x8')](_0x67ca('0xc'))||_0x2b45a9[_0x67ca('0x8')](_0x67ca('0xd'))){var _0x2ea790,_0x420c72;_0x2ea790=_0x2b45a9[_0x67ca('0xe')];var _0x1e0c9a=_0x2ea790['slice'](-0x1);if(_0x1e0c9a==='/'||_0x1e0c9a==='\x5c'||_0x1e0c9a===':'){_0x2ea790=_0x2ea790[_0x67ca('0xf')](0x0,_0x2ea790['lastIndexOf'](_0x1e0c9a));}switch(_0x2b45a9[_0x67ca('0x9')]){case'US':_0x420c72='https://accounts.zoho.com';break;case'AU':_0x420c72=_0x67ca('0x10');break;case'IN':_0x420c72=_0x67ca('0x11');break;case'CN':_0x420c72='https://accounts.zoho.com.cn';break;default:_0x420c72='https://accounts.zoho.eu';break;}var _0x766b5b={'method':_0x67ca('0x12'),'uri':_0x420c72+_0x67ca('0x13'),'form':{'grant_type':_0x67ca('0x14'),'client_id':_0x2b45a9[_0x67ca('0xa')],'client_secret':_0x2b45a9[_0x67ca('0xb')],'redirect_uri':_0x2b45a9[_0x67ca('0xe')],'code':_0x2b45a9['code']},'headers':{'Content-Type':_0x67ca('0x15')}};return rp(_0x766b5b)[_0x67ca('0x16')](function(_0x440196){var _0x3e4a87=JSON[_0x67ca('0x17')](_0x440196);if(_0x3e4a87['refresh_token']){_0x2b45a9[_0x67ca('0x18')]=_0x3e4a87['refresh_token'];logger[_0x67ca('0x19')](util[_0x67ca('0x1a')](_0x67ca('0x1b'),_0x2b45a9['name'],_0x2b45a9['id']));}else{logger[_0x67ca('0x1c')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2b45a9['name'],_0x2b45a9['id']),util[_0x67ca('0x1d')](_0x3e4a87,{'showHidden':![],'depth':null}));}return _0x4638cc(null,_0x45b6c7);})[_0x67ca('0x1e')](function(_0x214c0b){logger['error'](util[_0x67ca('0x1a')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2b45a9[_0x67ca('0x1f')],_0x2b45a9['id']),util[_0x67ca('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x4638cc(_0x214c0b);});}else{return _0x4638cc(null,_0x45b6c7);}},'beforeUpdate':function(_0x259b95,_0x4ebcbc,_0x232896){if(_0x259b95['changed'](_0x67ca('0x9'))||_0x259b95[_0x67ca('0x8')](_0x67ca('0xe'))||_0x259b95['changed']('clientId')||_0x259b95[_0x67ca('0x8')](_0x67ca('0xb'))||_0x259b95[_0x67ca('0x8')](_0x67ca('0xc'))||_0x259b95['changed']('host')){var _0x18c863,_0x50cd72;_0x18c863=_0x259b95[_0x67ca('0xe')];var _0x336e8f=_0x18c863['slice'](-0x1);if(_0x336e8f==='/'||_0x336e8f==='\x5c'||_0x336e8f===':'){_0x18c863=_0x18c863[_0x67ca('0xf')](0x0,_0x18c863['lastIndexOf'](_0x336e8f));}switch(_0x259b95[_0x67ca('0x9')]){case'US':_0x50cd72=_0x67ca('0x20');break;case'AU':_0x50cd72=_0x67ca('0x10');break;case'IN':_0x50cd72=_0x67ca('0x11');break;case'CN':_0x50cd72=_0x67ca('0x21');break;default:_0x50cd72=_0x67ca('0x22');break;}var _0x712aaa={'method':_0x67ca('0x12'),'uri':_0x50cd72+_0x67ca('0x13'),'form':{'grant_type':_0x67ca('0x14'),'client_id':_0x259b95[_0x67ca('0xa')],'client_secret':_0x259b95['clientSecret'],'redirect_uri':_0x259b95['serverUrl'],'code':_0x259b95[_0x67ca('0xc')]},'headers':{'Content-Type':_0x67ca('0x15')}};return rp(_0x712aaa)[_0x67ca('0x16')](function(_0x33e621){var _0x53bdf1=JSON[_0x67ca('0x17')](_0x33e621);if(_0x53bdf1[_0x67ca('0x23')]){_0x259b95[_0x67ca('0x18')]=_0x53bdf1[_0x67ca('0x23')];logger[_0x67ca('0x19')](util[_0x67ca('0x1a')](_0x67ca('0x1b'),_0x259b95[_0x67ca('0x1f')],_0x259b95['id']));}else{logger[_0x67ca('0x1c')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x259b95[_0x67ca('0x1f')],_0x259b95['id']),util['inspect'](_0x53bdf1,{'showHidden':![],'depth':null}));}return _0x232896(null,_0x4ebcbc);})[_0x67ca('0x1e')](function(_0x51e76c){logger[_0x67ca('0x1c')](util['format'](_0x67ca('0x24'),_0x259b95[_0x67ca('0x1f')],_0x259b95['id']),util[_0x67ca('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x232896(_0x51e76c);});}else{return _0x232896(null,_0x4ebcbc);}}}});}; \ No newline at end of file +var _0xd9bf=['path','../../config/environment','../../components/integrations/configuration','define','zone','changed','serverUrl','clientSecret','code','host','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','clientId','application/x-www-form-urlencoded','parse','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refresh_token','error','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x172df9,_0x239100){var _0x3d8603=function(_0x450a55){while(--_0x450a55){_0x172df9['push'](_0x172df9['shift']());}};_0x3d8603(++_0x239100);}(_0xd9bf,0x162));var _0xfd9b=function(_0x1fa2b3,_0x50ade4){_0x1fa2b3=_0x1fa2b3-0x0;var _0x4ed3c0=_0xd9bf[_0x1fa2b3];return _0x4ed3c0;};'use strict';var _=require(_0xfd9b('0x0'));var util=require(_0xfd9b('0x1'));var logger=require(_0xfd9b('0x2'))(_0xfd9b('0x3'));var moment=require('moment');var BPromise=require(_0xfd9b('0x4'));var rp=require(_0xfd9b('0x5'));var fs=require('fs');var path=require(_0xfd9b('0x6'));var rimraf=require('rimraf');var config=require(_0xfd9b('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xfd9b('0x8'));module['exports']=function(_0x29afe9,_0x2f2519){return _0x29afe9[_0xfd9b('0x9')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x25da82,_0x11925d,_0x1a6dea){if(_0x25da82['changed'](_0xfd9b('0xa'))||_0x25da82[_0xfd9b('0xb')](_0xfd9b('0xc'))||_0x25da82[_0xfd9b('0xb')]('clientId')||_0x25da82['changed'](_0xfd9b('0xd'))||_0x25da82[_0xfd9b('0xb')](_0xfd9b('0xe'))||_0x25da82[_0xfd9b('0xb')](_0xfd9b('0xf'))){var _0x289dfc,_0x26a192;_0x289dfc=_0x25da82[_0xfd9b('0xc')];var _0x4a75e8=_0x289dfc['slice'](-0x1);if(_0x4a75e8==='/'||_0x4a75e8==='\x5c'||_0x4a75e8===':'){_0x289dfc=_0x289dfc[_0xfd9b('0x10')](0x0,_0x289dfc['lastIndexOf'](_0x4a75e8));}switch(_0x25da82[_0xfd9b('0xa')]){case'US':_0x26a192=_0xfd9b('0x11');break;case'AU':_0x26a192='https://accounts.zoho.com.au';break;case'IN':_0x26a192=_0xfd9b('0x12');break;case'CN':_0x26a192=_0xfd9b('0x13');break;default:_0x26a192='https://accounts.zoho.eu';break;}var _0x3f5401={'method':'POST','uri':_0x26a192+'/oauth/v2/token','form':{'grant_type':_0xfd9b('0x14'),'client_id':_0x25da82[_0xfd9b('0x15')],'client_secret':_0x25da82[_0xfd9b('0xd')],'redirect_uri':_0x25da82[_0xfd9b('0xc')],'code':_0x25da82[_0xfd9b('0xe')]},'headers':{'Content-Type':_0xfd9b('0x16')}};return rp(_0x3f5401)['then'](function(_0x44403c){var _0x2ef1a6=JSON[_0xfd9b('0x17')](_0x44403c);if(_0x2ef1a6['refresh_token']){_0x25da82[_0xfd9b('0x18')]=_0x2ef1a6['refresh_token'];logger[_0xfd9b('0x19')](util[_0xfd9b('0x1a')](_0xfd9b('0x1b'),_0x25da82['name'],_0x25da82['id']));}else{logger['error'](util[_0xfd9b('0x1a')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x25da82[_0xfd9b('0x1c')],_0x25da82['id']),util[_0xfd9b('0x1d')](_0x2ef1a6,{'showHidden':![],'depth':null}));}return _0x1a6dea(null,_0x11925d);})[_0xfd9b('0x1e')](function(_0x244c9d){logger['error'](util[_0xfd9b('0x1a')](_0xfd9b('0x1f'),_0x25da82[_0xfd9b('0x1c')],_0x25da82['id']),util[_0xfd9b('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x1a6dea(_0x244c9d);});}else{return _0x1a6dea(null,_0x11925d);}},'beforeUpdate':function(_0x30531a,_0x11e81f,_0x3f34ac){if(_0x30531a[_0xfd9b('0xb')](_0xfd9b('0xa'))||_0x30531a[_0xfd9b('0xb')]('serverUrl')||_0x30531a[_0xfd9b('0xb')](_0xfd9b('0x15'))||_0x30531a['changed'](_0xfd9b('0xd'))||_0x30531a[_0xfd9b('0xb')](_0xfd9b('0xe'))||_0x30531a['changed'](_0xfd9b('0xf'))){var _0x5eda86,_0x56209c;_0x5eda86=_0x30531a[_0xfd9b('0xc')];var _0x3292ab=_0x5eda86[_0xfd9b('0x20')](-0x1);if(_0x3292ab==='/'||_0x3292ab==='\x5c'||_0x3292ab===':'){_0x5eda86=_0x5eda86[_0xfd9b('0x10')](0x0,_0x5eda86[_0xfd9b('0x21')](_0x3292ab));}switch(_0x30531a[_0xfd9b('0xa')]){case'US':_0x56209c=_0xfd9b('0x11');break;case'AU':_0x56209c=_0xfd9b('0x22');break;case'IN':_0x56209c=_0xfd9b('0x12');break;case'CN':_0x56209c=_0xfd9b('0x13');break;default:_0x56209c=_0xfd9b('0x23');break;}var _0x17c356={'method':_0xfd9b('0x24'),'uri':_0x56209c+_0xfd9b('0x25'),'form':{'grant_type':'authorization_code','client_id':_0x30531a[_0xfd9b('0x15')],'client_secret':_0x30531a[_0xfd9b('0xd')],'redirect_uri':_0x30531a['serverUrl'],'code':_0x30531a['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x17c356)['then'](function(_0x2da459){var _0x37171e=JSON[_0xfd9b('0x17')](_0x2da459);if(_0x37171e['refresh_token']){_0x30531a[_0xfd9b('0x18')]=_0x37171e[_0xfd9b('0x26')];logger[_0xfd9b('0x19')](util['format'](_0xfd9b('0x1b'),_0x30531a[_0xfd9b('0x1c')],_0x30531a['id']));}else{logger[_0xfd9b('0x27')](util[_0xfd9b('0x1a')](_0xfd9b('0x1f'),_0x30531a[_0xfd9b('0x1c')],_0x30531a['id']),util[_0xfd9b('0x1d')](_0x37171e,{'showHidden':![],'depth':null}));}return _0x3f34ac(null,_0x11e81f);})[_0xfd9b('0x1e')](function(_0x568ce3){logger[_0xfd9b('0x27')](util[_0xfd9b('0x1a')](_0xfd9b('0x1f'),_0x30531a['name'],_0x30531a['id']),util[_0xfd9b('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f34ac(_0x568ce3);});}else{return _0x3f34ac(null,_0x11e81f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2dcd79a..194a15f 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 _0xda2d=['../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x19cd2a,_0x52bf9e){var _0x41f8b7=function(_0x132d14){while(--_0x132d14){_0x19cd2a['push'](_0x19cd2a['shift']());}};_0x41f8b7(++_0x52bf9e);}(_0xda2d,0x102));var _0xdda2=function(_0x48bc95,_0x2b316b){_0x48bc95=_0x48bc95-0x0;var _0x4b4c38=_0xda2d[_0x48bc95];return _0x4b4c38;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowZohoAccount']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['ZohoAccount'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowZohoAccount',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file +var _0x6d11=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ZohoAccount','findAll','options','attributes','limit','map','include','model','GetZohoAccount','ShowZohoAccount','find','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s'];(function(_0x2a43b9,_0x2aa7ea){var _0x3b6c90=function(_0x5be37f){while(--_0x5be37f){_0x2a43b9['push'](_0x2a43b9['shift']());}};_0x3b6c90(++_0x2aa7ea);}(_0x6d11,0xbf));var _0x16d1=function(_0x48b0c9,_0x3cb775){_0x48b0c9=_0x48b0c9-0x0;var _0x3df2f5=_0x6d11[_0x48b0c9];return _0x3df2f5;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});}exports['GetZohoAccount']=function(_0x46a25e){var _0x4aeff0=this;return new Promise(function(_0x1da1b8,_0x4fe22d){return db[_0x16d1('0x15')][_0x16d1('0x16')]({'raw':_0x46a25e['options']?_0x46a25e['options']['raw']===undefined?!![]:![]:!![],'where':_0x46a25e['options']?_0x46a25e[_0x16d1('0x17')]['where']||null:null,'attributes':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x18')]||null:null,'limit':_0x46a25e[_0x16d1('0x17')]?_0x46a25e['options'][_0x16d1('0x19')]||null:null,'include':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')]['include']?_[_0x16d1('0x1a')](_0x46a25e[_0x16d1('0x17')][_0x16d1('0x1b')],function(_0x47cad4){return{'model':db[_0x47cad4[_0x16d1('0x1c')]],'as':_0x47cad4['as'],'attributes':_0x47cad4[_0x16d1('0x18')],'include':_0x47cad4[_0x16d1('0x1b')]?_[_0x16d1('0x1a')](_0x47cad4[_0x16d1('0x1b')],function(_0x335c24){return{'model':db[_0x335c24[_0x16d1('0x1c')]],'as':_0x335c24['as'],'attributes':_0x335c24[_0x16d1('0x18')],'include':_0x335c24[_0x16d1('0x1b')]?_[_0x16d1('0x1a')](_0x335c24[_0x16d1('0x1b')],function(_0x2b8403){return{'model':db[_0x2b8403['model']],'as':_0x2b8403['as'],'attributes':_0x2b8403[_0x16d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x16d1('0xa')](function(_0x4257f1){logger['info'](_0x16d1('0x1d'),_0x46a25e);logger[_0x16d1('0xd')](_0x16d1('0x1d'),_0x46a25e,JSON[_0x16d1('0x10')](_0x4257f1));_0x1da1b8(_0x4257f1);})[_0x16d1('0x14')](function(_0x462e5b){logger[_0x16d1('0x11')]('GetZohoAccount',_0x462e5b[_0x16d1('0x13')],_0x46a25e);_0x4fe22d(_0x4aeff0[_0x16d1('0x11')](0x1f4,_0x462e5b[_0x16d1('0x13')]));});});};exports[_0x16d1('0x1e')]=function(_0x55c021){var _0x4b27f6=this;return new Promise(function(_0x2f16ee,_0x4ab3d4){return db[_0x16d1('0x15')][_0x16d1('0x1f')]({'raw':_0x55c021[_0x16d1('0x17')]?_0x55c021[_0x16d1('0x17')][_0x16d1('0x20')]===undefined?!![]:![]:!![],'where':_0x55c021[_0x16d1('0x17')]?_0x55c021[_0x16d1('0x17')][_0x16d1('0x21')]||null:null,'attributes':_0x55c021[_0x16d1('0x17')]?_0x55c021[_0x16d1('0x17')][_0x16d1('0x18')]||null:null,'include':_0x55c021[_0x16d1('0x17')]?_0x55c021['options'][_0x16d1('0x1b')]?_['map'](_0x55c021[_0x16d1('0x17')][_0x16d1('0x1b')],function(_0x2b9126){return{'model':db[_0x2b9126[_0x16d1('0x1c')]],'as':_0x2b9126['as'],'attributes':_0x2b9126[_0x16d1('0x18')],'include':_0x2b9126[_0x16d1('0x1b')]?_['map'](_0x2b9126['include'],function(_0x58d72d){return{'model':db[_0x58d72d[_0x16d1('0x1c')]],'as':_0x58d72d['as'],'attributes':_0x58d72d[_0x16d1('0x18')],'include':_0x58d72d[_0x16d1('0x1b')]?_[_0x16d1('0x1a')](_0x58d72d['include'],function(_0x885454){return{'model':db[_0x885454[_0x16d1('0x1c')]],'as':_0x885454['as'],'attributes':_0x885454['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x508ed7){logger[_0x16d1('0xb')](_0x16d1('0x1e'),_0x55c021);logger[_0x16d1('0xd')]('ShowZohoAccount',_0x55c021,JSON[_0x16d1('0x10')](_0x508ed7));_0x2f16ee(_0x508ed7);})[_0x16d1('0x14')](function(_0x2928ad){logger[_0x16d1('0x11')](_0x16d1('0x1e'),_0x2928ad[_0x16d1('0x13')],_0x55c021);_0x4ab3d4(_0x4b27f6[_0x16d1('0x11')](0x1f4,_0x2928ad['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4954b0a..781877f 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 _0xf9a9=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer'];(function(_0x2ad3cb,_0x2f5749){var _0x2d4061=function(_0x450a27){while(--_0x450a27){_0x2ad3cb['push'](_0x2ad3cb['shift']());}};_0x2d4061(++_0x2f5749);}(_0xf9a9,0x153));var _0x9f9a=function(_0x33ba99,_0x400563){_0x33ba99=_0x33ba99-0x0;var _0x3cb623=_0xf9a9[_0x33ba99];return _0x3cb623;};'use strict';var multer=require(_0x9f9a('0x0'));var util=require('util');var path=require(_0x9f9a('0x1'));var timeout=require(_0x9f9a('0x2'));var express=require(_0x9f9a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f9a('0x4'));var interaction=require(_0x9f9a('0x5'));var config=require(_0x9f9a('0x6'));var controller=require(_0x9f9a('0x7'));router[_0x9f9a('0x8')]('/',auth[_0x9f9a('0x9')](),controller['index']);router[_0x9f9a('0x8')](_0x9f9a('0xa'),auth[_0x9f9a('0x9')](),controller[_0x9f9a('0xb')]);router[_0x9f9a('0x8')]('/:id/fields',auth[_0x9f9a('0x9')](),controller[_0x9f9a('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x9f9a('0xd')]);router[_0x9f9a('0x8')](_0x9f9a('0xe'),auth[_0x9f9a('0x9')](),controller[_0x9f9a('0xf')]);router['post']('/',auth[_0x9f9a('0x9')](),controller['create']);router[_0x9f9a('0x10')](_0x9f9a('0xa'),auth['isAuthenticated'](),controller[_0x9f9a('0x11')]);router['delete'](_0x9f9a('0xa'),auth[_0x9f9a('0x9')](),controller[_0x9f9a('0x12')]);module[_0x9f9a('0x13')]=router; \ No newline at end of file +var _0xf37c=['/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','put','delete','multer','path','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index'];(function(_0x2b7074,_0x50bf29){var _0x1fe9ca=function(_0x5b4bde){while(--_0x5b4bde){_0x2b7074['push'](_0x2b7074['shift']());}};_0x1fe9ca(++_0x50bf29);}(_0xf37c,0xdb));var _0xcf37=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xf37c[_0x184759];return _0xf26d5f;};'use strict';var multer=require(_0xcf37('0x0'));var util=require('util');var path=require(_0xcf37('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf37('0x2'));var router=express[_0xcf37('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcf37('0x4'));var config=require(_0xcf37('0x5'));var controller=require(_0xcf37('0x6'));router[_0xcf37('0x7')]('/',auth['isAuthenticated'](),controller[_0xcf37('0x8')]);router[_0xcf37('0x7')](_0xcf37('0x9'),auth[_0xcf37('0xa')](),controller[_0xcf37('0xb')]);router[_0xcf37('0x7')](_0xcf37('0xc'),auth[_0xcf37('0xa')](),controller['getFields']);router['get'](_0xcf37('0xd'),auth[_0xcf37('0xa')](),controller[_0xcf37('0xe')]);router[_0xcf37('0x7')](_0xcf37('0xf'),auth[_0xcf37('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0xcf37('0xa')](),controller[_0xcf37('0x10')]);router[_0xcf37('0x11')]('/:id',auth[_0xcf37('0xa')](),controller['update']);router[_0xcf37('0x12')](_0xcf37('0x9'),auth[_0xcf37('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 70d8eb1..420ccae 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 _0xa0dd=['sequelize','exports','ENUM','lead','contact','contact_lead'];(function(_0x39187b,_0x2a6214){var _0x2cf25f=function(_0x183c3e){while(--_0x183c3e){_0x39187b['push'](_0x39187b['shift']());}};_0x2cf25f(++_0x2a6214);}(_0xa0dd,0xc0));var _0xda0d=function(_0x1a6dbb,_0x18eca3){_0x1a6dbb=_0x1a6dbb-0x0;var _0x1c546e=_0xa0dd[_0x1a6dbb];return _0x1c546e;};'use strict';var Sequelize=require(_0xda0d('0x0'));module[_0xda0d('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xda0d('0x2')](_0xda0d('0x3'),_0xda0d('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xda0d('0x2')](_0xda0d('0x5'),_0xda0d('0x4'),_0xda0d('0x3')),'defaultValue':_0xda0d('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x596e=['nothing','lead','sequelize','exports','STRING','ENUM','contact'];(function(_0x1199fd,_0x567027){var _0x117eab=function(_0x4e46a0){while(--_0x4e46a0){_0x1199fd['push'](_0x1199fd['shift']());}};_0x117eab(++_0x567027);}(_0x596e,0xb1));var _0xe596=function(_0x1f560d,_0x3aa81c){_0x1f560d=_0x1f560d-0x0;var _0x42757a=_0x596e[_0x1f560d];return _0x42757a;};'use strict';var Sequelize=require(_0xe596('0x0'));module[_0xe596('0x1')]={'name':{'type':Sequelize[_0xe596('0x2')]},'moduleCreate':{'type':Sequelize[_0xe596('0x3')]('lead',_0xe596('0x4'),_0xe596('0x5')),'defaultValue':_0xe596('0x6')},'moduleSearch':{'type':Sequelize[_0xe596('0x3')]('contact_lead',_0xe596('0x4'),_0xe596('0x6')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe596('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d1d0089..2b226bb 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 _0x0c28=['undefined','count','set','Content-Range','reject','save','update','then','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','ZohoConfiguration','include','findAll','rows','catch','params','includeAll','find','create','body','findOne','ZohoField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x18ed05,_0x3d7898){var _0x55413f=function(_0x13d97e){while(--_0x13d97e){_0x18ed05['push'](_0x18ed05['shift']());}};_0x55413f(++_0x3d7898);}(_0x0c28,0x7d));var _0x80c2=function(_0x10a14c,_0x4bc3fd){_0x10a14c=_0x10a14c-0x0;var _0x42ec79=_0x0c28[_0x10a14c];return _0x42ec79;};'use strict';var emlformat=require(_0x80c2('0x0'));var rimraf=require(_0x80c2('0x1'));var zipdir=require(_0x80c2('0x2'));var jsonpatch=require(_0x80c2('0x3'));var rp=require(_0x80c2('0x4'));var moment=require(_0x80c2('0x5'));var BPromise=require(_0x80c2('0x6'));var Mustache=require('mustache');var util=require(_0x80c2('0x7'));var path=require('path');var sox=require(_0x80c2('0x8'));var csv=require(_0x80c2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80c2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x80c2('0x9'));var querystring=require(_0x80c2('0xb'));var Papa=require('papaparse');var Redis=require(_0x80c2('0xc'));var authService=require(_0x80c2('0xd'));var qs=require(_0x80c2('0xe'));var as=require(_0x80c2('0xf'));var hardwareService=require(_0x80c2('0x10'));var logger=require(_0x80c2('0x11'))(_0x80c2('0x12'));var utils=require(_0x80c2('0x13'));var config=require(_0x80c2('0x14'));var licenseUtil=require(_0x80c2('0x15'));var db=require(_0x80c2('0x16'))['db'];function respondWithStatusCode(_0x320ca4,_0x577c07){_0x577c07=_0x577c07||0xcc;return function(_0x36fdc7){if(_0x36fdc7){return _0x320ca4[_0x80c2('0x17')](_0x577c07);}return _0x320ca4[_0x80c2('0x18')](_0x577c07)[_0x80c2('0x19')]();};}function respondWithResult(_0x172436,_0x231777){_0x231777=_0x231777||0xc8;return function(_0x4eaadf){if(_0x4eaadf){return _0x172436[_0x80c2('0x18')](_0x231777)[_0x80c2('0x1a')](_0x4eaadf);}};}function respondWithFilteredResult(_0x3f3189,_0x13c7fb){return function(_0x8939d9){if(_0x8939d9){var _0x536f7a=typeof _0x13c7fb[_0x80c2('0x1b')]==='undefined'&&typeof _0x13c7fb[_0x80c2('0x1c')]===_0x80c2('0x1d');var _0x3615c7=_0x8939d9['count'];var _0x2888b1=_0x536f7a?0x0:_0x13c7fb[_0x80c2('0x1b')];var _0x2d35bb=_0x536f7a?_0x8939d9[_0x80c2('0x1e')]:_0x13c7fb[_0x80c2('0x1b')]+_0x13c7fb['limit'];var _0x3d7722;if(_0x2d35bb>=_0x3615c7){_0x2d35bb=_0x3615c7;_0x3d7722=0xc8;}else{_0x3d7722=0xce;}_0x3f3189[_0x80c2('0x18')](_0x3d7722);return _0x3f3189[_0x80c2('0x1f')](_0x80c2('0x20'),_0x2888b1+'-'+_0x2d35bb+'/'+_0x3615c7)[_0x80c2('0x1a')](_0x8939d9);}return null;};}function patchUpdates(_0x1dc1fc){return function(_0x2f97a4){try{jsonpatch['apply'](_0x2f97a4,_0x1dc1fc,!![]);}catch(_0x10455){return BPromise[_0x80c2('0x21')](_0x10455);}return _0x2f97a4[_0x80c2('0x22')]();};}function saveUpdates(_0x47a205,_0x5a3f2a){return function(_0x3af8b4){if(_0x3af8b4){return _0x3af8b4[_0x80c2('0x23')](_0x47a205)[_0x80c2('0x24')](function(_0x74d088){return _0x74d088;});}return null;};}function removeEntity(_0x39c655,_0x3bbf2b){return function(_0x15ecd7){if(_0x15ecd7){return _0x15ecd7['destroy']()[_0x80c2('0x24')](function(){_0x39c655[_0x80c2('0x18')](0xcc)[_0x80c2('0x19')]();});}};}function handleEntityNotFound(_0x224eee,_0x5f1aa4){return function(_0x176db9){if(!_0x176db9){_0x224eee[_0x80c2('0x17')](0x194);}return _0x176db9;};}function handleError(_0x129311,_0x359963){_0x359963=_0x359963||0x1f4;return function(_0x3e479b){logger['error'](_0x3e479b[_0x80c2('0x25')]);if(_0x3e479b[_0x80c2('0x26')]){delete _0x3e479b[_0x80c2('0x26')];}_0x129311['status'](_0x359963)['send'](_0x3e479b);};}exports[_0x80c2('0x27')]=function(_0x48b635,_0x2dd8e9){var _0x3d2b81={},_0x112870={},_0x47deb3={'count':0x0,'rows':[]};var _0x35f8c9=_[_0x80c2('0x28')](db['ZohoConfiguration'][_0x80c2('0x29')],function(_0x5cdd40){return{'name':_0x5cdd40[_0x80c2('0x2a')],'type':_0x5cdd40['type'][_0x80c2('0x2b')]};});_0x112870[_0x80c2('0x2c')]=_[_0x80c2('0x28')](_0x35f8c9,_0x80c2('0x26'));_0x112870['query']=_[_0x80c2('0x2d')](_0x48b635[_0x80c2('0x2e')]);_0x112870['filters']=_[_0x80c2('0x2f')](_0x112870[_0x80c2('0x2c')],_0x112870[_0x80c2('0x2e')]);_0x3d2b81[_0x80c2('0x30')]=_[_0x80c2('0x2f')](_0x112870['model'],qs[_0x80c2('0x31')](_0x48b635[_0x80c2('0x2e')][_0x80c2('0x31')]));_0x3d2b81[_0x80c2('0x30')]=_0x3d2b81[_0x80c2('0x30')][_0x80c2('0x32')]?_0x3d2b81[_0x80c2('0x30')]:_0x112870[_0x80c2('0x2c')];if(!_0x48b635[_0x80c2('0x2e')][_0x80c2('0x33')]('nolimit')){_0x3d2b81[_0x80c2('0x1c')]=qs[_0x80c2('0x1c')](_0x48b635[_0x80c2('0x2e')][_0x80c2('0x1c')]);_0x3d2b81[_0x80c2('0x1b')]=qs['offset'](_0x48b635[_0x80c2('0x2e')]['offset']);}_0x3d2b81[_0x80c2('0x34')]=qs[_0x80c2('0x35')](_0x48b635[_0x80c2('0x2e')][_0x80c2('0x35')]);_0x3d2b81[_0x80c2('0x36')]=qs['filters'](_[_0x80c2('0x37')](_0x48b635[_0x80c2('0x2e')],_0x112870[_0x80c2('0x38')]),_0x35f8c9);if(_0x48b635['query'][_0x80c2('0x39')]){_0x3d2b81[_0x80c2('0x36')]=_[_0x80c2('0x3a')](_0x3d2b81[_0x80c2('0x36')],{'$or':_['map'](_0x35f8c9,function(_0xd635ef){if(_0xd635ef['type']!==_0x80c2('0x3b')){var _0x18f615={};_0x18f615[_0xd635ef[_0x80c2('0x26')]]={'$like':'%'+_0x48b635[_0x80c2('0x2e')]['filter']+'%'};return _0x18f615;}})});}_0x3d2b81=_[_0x80c2('0x3a')]({},_0x3d2b81,_0x48b635[_0x80c2('0x3c')]);var _0x4227a7={'where':_0x3d2b81[_0x80c2('0x36')]};return db[_0x80c2('0x3d')][_0x80c2('0x1e')](_0x4227a7)[_0x80c2('0x24')](function(_0x39c303){_0x47deb3['count']=_0x39c303;if(_0x48b635[_0x80c2('0x2e')]['includeAll']){_0x3d2b81[_0x80c2('0x3e')]=[{'all':!![]}];}return db[_0x80c2('0x3d')][_0x80c2('0x3f')](_0x3d2b81);})[_0x80c2('0x24')](function(_0x19f0f6){_0x47deb3[_0x80c2('0x40')]=_0x19f0f6;return _0x47deb3;})[_0x80c2('0x24')](respondWithFilteredResult(_0x2dd8e9,_0x3d2b81))[_0x80c2('0x41')](handleError(_0x2dd8e9,null));};exports['show']=function(_0x20e83a,_0x199261){var _0x5233bc={'raw':![],'where':{'id':_0x20e83a[_0x80c2('0x42')]['id']}},_0x240739={};_0x240739['model']=_[_0x80c2('0x2d')](db['ZohoConfiguration'][_0x80c2('0x29')]);_0x240739['query']=_[_0x80c2('0x2d')](_0x20e83a[_0x80c2('0x2e')]);_0x240739[_0x80c2('0x38')]=_['intersection'](_0x240739[_0x80c2('0x2c')],_0x240739['query']);_0x5233bc[_0x80c2('0x30')]=_[_0x80c2('0x2f')](_0x240739['model'],qs[_0x80c2('0x31')](_0x20e83a[_0x80c2('0x2e')]['fields']));_0x5233bc[_0x80c2('0x30')]=_0x5233bc[_0x80c2('0x30')][_0x80c2('0x32')]?_0x5233bc[_0x80c2('0x30')]:_0x240739[_0x80c2('0x2c')];if(_0x20e83a['query'][_0x80c2('0x43')]){_0x5233bc[_0x80c2('0x3e')]=[{'all':!![]}];}_0x5233bc=_[_0x80c2('0x3a')]({},_0x5233bc,_0x20e83a[_0x80c2('0x3c')]);return db['ZohoConfiguration'][_0x80c2('0x44')](_0x5233bc)['then'](handleEntityNotFound(_0x199261,null))['then'](respondWithResult(_0x199261,null))[_0x80c2('0x41')](handleError(_0x199261,null));};exports['create']=function(_0x30416e,_0x3140ce){return db['ZohoConfiguration'][_0x80c2('0x45')](_0x30416e[_0x80c2('0x46')],{})[_0x80c2('0x24')](respondWithResult(_0x3140ce,0xc9))[_0x80c2('0x41')](handleError(_0x3140ce,null));};exports[_0x80c2('0x23')]=function(_0x29209a,_0x51ad07){if(_0x29209a[_0x80c2('0x46')]['id']){delete _0x29209a[_0x80c2('0x46')]['id'];}return db[_0x80c2('0x3d')][_0x80c2('0x44')]({'where':{'id':_0x29209a[_0x80c2('0x42')]['id']}})[_0x80c2('0x24')](handleEntityNotFound(_0x51ad07,null))[_0x80c2('0x24')](saveUpdates(_0x29209a[_0x80c2('0x46')],null))[_0x80c2('0x24')](respondWithResult(_0x51ad07,null))[_0x80c2('0x41')](handleError(_0x51ad07,null));};exports['destroy']=function(_0x79340b,_0x254e24){return db['ZohoConfiguration']['find']({'where':{'id':_0x79340b[_0x80c2('0x42')]['id']}})[_0x80c2('0x24')](handleEntityNotFound(_0x254e24,null))[_0x80c2('0x24')](removeEntity(_0x254e24,null))['catch'](handleError(_0x254e24,null));};exports['getFields']=function(_0x516fbd,_0x1e2846,_0x4e01d7){var _0x35bfb6={};var _0x296d0d={};var _0x2f3ced;var _0xe438f6;return db[_0x80c2('0x3d')][_0x80c2('0x47')]({'where':{'id':_0x516fbd['params']['id']}})['then'](handleEntityNotFound(_0x1e2846,null))[_0x80c2('0x24')](function(_0x136877){if(_0x136877){_0x2f3ced=_0x136877;_0x296d0d['model']=_[_0x80c2('0x2d')](db[_0x80c2('0x48')]['rawAttributes']);_0x296d0d[_0x80c2('0x2e')]=_['keys'](_0x516fbd[_0x80c2('0x2e')]);_0x296d0d[_0x80c2('0x38')]=_[_0x80c2('0x2f')](_0x296d0d[_0x80c2('0x2c')],_0x296d0d[_0x80c2('0x2e')]);_0x35bfb6[_0x80c2('0x30')]=_['intersection'](_0x296d0d[_0x80c2('0x2c')],qs['fields'](_0x516fbd['query'][_0x80c2('0x31')]));_0x35bfb6[_0x80c2('0x30')]=_0x35bfb6[_0x80c2('0x30')][_0x80c2('0x32')]?_0x35bfb6['attributes']:_0x296d0d['model'];_0x35bfb6[_0x80c2('0x34')]=qs[_0x80c2('0x35')](_0x516fbd['query'][_0x80c2('0x35')]);_0x35bfb6[_0x80c2('0x36')]=qs[_0x80c2('0x38')](_[_0x80c2('0x37')](_0x516fbd[_0x80c2('0x2e')],_0x296d0d[_0x80c2('0x38')]));if(_0x516fbd['query'][_0x80c2('0x39')]){_0x35bfb6[_0x80c2('0x36')]=_[_0x80c2('0x3a')](_0x35bfb6[_0x80c2('0x36')],{'$or':_[_0x80c2('0x28')](_0x35bfb6['attributes'],function(_0x13d54c){var _0xc6b54f={};_0xc6b54f[_0x13d54c]={'$like':'%'+_0x516fbd[_0x80c2('0x2e')][_0x80c2('0x39')]+'%'};return _0xc6b54f;})});}_0x35bfb6=_[_0x80c2('0x3a')]({},_0x35bfb6,_0x516fbd[_0x80c2('0x3c')]);return _0x2f3ced[_0x80c2('0x49')](_0x35bfb6);}})[_0x80c2('0x24')](function(_0x2deefe){if(_0x2deefe){_0xe438f6=_0x2deefe[_0x80c2('0x32')];if(!_0x516fbd[_0x80c2('0x2e')][_0x80c2('0x33')](_0x80c2('0x4a'))){_0x35bfb6[_0x80c2('0x1c')]=qs[_0x80c2('0x1c')](_0x516fbd[_0x80c2('0x2e')]['limit']);_0x35bfb6[_0x80c2('0x1b')]=qs[_0x80c2('0x1b')](_0x516fbd[_0x80c2('0x2e')][_0x80c2('0x1b')]);}return _0x2f3ced[_0x80c2('0x49')](_0x35bfb6);}})[_0x80c2('0x24')](function(_0x466cf1){if(_0x466cf1){return _0x466cf1?{'count':_0xe438f6,'rows':_0x466cf1}:null;}})[_0x80c2('0x24')](respondWithResult(_0x1e2846,null))['catch'](handleError(_0x1e2846,null));};exports[_0x80c2('0x4b')]=function(_0x22c71a,_0x51475e,_0x316f5c){var _0x1253a9={};var _0x195ba6={};var _0x196142;var _0x4e4a51;return db[_0x80c2('0x3d')][_0x80c2('0x47')]({'where':{'id':_0x22c71a[_0x80c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x51475e,null))[_0x80c2('0x24')](function(_0x12fc56){if(_0x12fc56){_0x196142=_0x12fc56;_0x195ba6[_0x80c2('0x2c')]=_[_0x80c2('0x2d')](db[_0x80c2('0x48')][_0x80c2('0x29')]);_0x195ba6[_0x80c2('0x2e')]=_['keys'](_0x22c71a[_0x80c2('0x2e')]);_0x195ba6['filters']=_['intersection'](_0x195ba6[_0x80c2('0x2c')],_0x195ba6[_0x80c2('0x2e')]);_0x1253a9[_0x80c2('0x30')]=_[_0x80c2('0x2f')](_0x195ba6[_0x80c2('0x2c')],qs[_0x80c2('0x31')](_0x22c71a[_0x80c2('0x2e')][_0x80c2('0x31')]));_0x1253a9['attributes']=_0x1253a9[_0x80c2('0x30')][_0x80c2('0x32')]?_0x1253a9['attributes']:_0x195ba6[_0x80c2('0x2c')];_0x1253a9[_0x80c2('0x34')]=qs['sort'](_0x22c71a['query'][_0x80c2('0x35')]);_0x1253a9[_0x80c2('0x36')]=qs[_0x80c2('0x38')](_[_0x80c2('0x37')](_0x22c71a[_0x80c2('0x2e')],_0x195ba6[_0x80c2('0x38')]));if(_0x22c71a[_0x80c2('0x2e')][_0x80c2('0x39')]){_0x1253a9[_0x80c2('0x36')]=_[_0x80c2('0x3a')](_0x1253a9[_0x80c2('0x36')],{'$or':_[_0x80c2('0x28')](_0x1253a9['attributes'],function(_0x17eb09){var _0x2bcaaa={};_0x2bcaaa[_0x17eb09]={'$like':'%'+_0x22c71a[_0x80c2('0x2e')][_0x80c2('0x39')]+'%'};return _0x2bcaaa;})});}_0x1253a9=_[_0x80c2('0x3a')]({},_0x1253a9,_0x22c71a['options']);return _0x196142[_0x80c2('0x4b')](_0x1253a9);}})[_0x80c2('0x24')](function(_0xac88b7){if(_0xac88b7){_0x4e4a51=_0xac88b7[_0x80c2('0x32')];if(!_0x22c71a[_0x80c2('0x2e')]['hasOwnProperty']('nolimit')){_0x1253a9['limit']=qs[_0x80c2('0x1c')](_0x22c71a[_0x80c2('0x2e')][_0x80c2('0x1c')]);_0x1253a9[_0x80c2('0x1b')]=qs[_0x80c2('0x1b')](_0x22c71a[_0x80c2('0x2e')][_0x80c2('0x1b')]);}return _0x196142[_0x80c2('0x4b')](_0x1253a9);}})[_0x80c2('0x24')](function(_0x71ffd7){if(_0x71ffd7){return _0x71ffd7?{'count':_0x4e4a51,'rows':_0x71ffd7}:null;}})[_0x80c2('0x24')](respondWithResult(_0x51475e,null))[_0x80c2('0x41')](handleError(_0x51475e,null));};exports[_0x80c2('0x4c')]=function(_0x3d9083,_0x5209f6,_0x4428ec){var _0x2fa521={};var _0x5c7838={};var _0x2e567a;var _0x397777;return db[_0x80c2('0x3d')][_0x80c2('0x47')]({'where':{'id':_0x3d9083['params']['id']}})[_0x80c2('0x24')](handleEntityNotFound(_0x5209f6,null))[_0x80c2('0x24')](function(_0x17bfaa){if(_0x17bfaa){_0x2e567a=_0x17bfaa;_0x5c7838[_0x80c2('0x2c')]=_[_0x80c2('0x2d')](db[_0x80c2('0x48')]['rawAttributes']);_0x5c7838[_0x80c2('0x2e')]=_[_0x80c2('0x2d')](_0x3d9083['query']);_0x5c7838[_0x80c2('0x38')]=_[_0x80c2('0x2f')](_0x5c7838['model'],_0x5c7838['query']);_0x2fa521[_0x80c2('0x30')]=_[_0x80c2('0x2f')](_0x5c7838[_0x80c2('0x2c')],qs[_0x80c2('0x31')](_0x3d9083['query']['fields']));_0x2fa521[_0x80c2('0x30')]=_0x2fa521['attributes']['length']?_0x2fa521[_0x80c2('0x30')]:_0x5c7838[_0x80c2('0x2c')];_0x2fa521[_0x80c2('0x34')]=qs[_0x80c2('0x35')](_0x3d9083[_0x80c2('0x2e')][_0x80c2('0x35')]);_0x2fa521[_0x80c2('0x36')]=qs[_0x80c2('0x38')](_['pick'](_0x3d9083[_0x80c2('0x2e')],_0x5c7838['filters']));if(_0x3d9083[_0x80c2('0x2e')][_0x80c2('0x39')]){_0x2fa521[_0x80c2('0x36')]=_[_0x80c2('0x3a')](_0x2fa521[_0x80c2('0x36')],{'$or':_[_0x80c2('0x28')](_0x2fa521[_0x80c2('0x30')],function(_0x15caea){var _0x2552ee={};_0x2552ee[_0x15caea]={'$like':'%'+_0x3d9083[_0x80c2('0x2e')]['filter']+'%'};return _0x2552ee;})});}_0x2fa521=_[_0x80c2('0x3a')]({},_0x2fa521,_0x3d9083[_0x80c2('0x3c')]);return _0x2e567a[_0x80c2('0x4c')](_0x2fa521);}})[_0x80c2('0x24')](function(_0x29b715){if(_0x29b715){_0x397777=_0x29b715[_0x80c2('0x32')];if(!_0x3d9083['query']['hasOwnProperty'](_0x80c2('0x4a'))){_0x2fa521[_0x80c2('0x1c')]=qs[_0x80c2('0x1c')](_0x3d9083[_0x80c2('0x2e')]['limit']);_0x2fa521[_0x80c2('0x1b')]=qs[_0x80c2('0x1b')](_0x3d9083[_0x80c2('0x2e')][_0x80c2('0x1b')]);}return _0x2e567a[_0x80c2('0x4c')](_0x2fa521);}})[_0x80c2('0x24')](function(_0x3bf44a){if(_0x3bf44a){return _0x3bf44a?{'count':_0x397777,'rows':_0x3bf44a}:null;}})[_0x80c2('0x24')](respondWithResult(_0x5209f6,null))[_0x80c2('0x41')](handleError(_0x5209f6,null));}; \ No newline at end of file +var _0xd53c=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','ZohoConfiguration','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','ZohoField','pick','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0xd53c,0x1cb));var _0xcd53=function(_0x248dea,_0x368df2){_0x248dea=_0x248dea-0x0;var _0x37c037=_0xd53c[_0x248dea];return _0x37c037;};'use strict';var emlformat=require(_0xcd53('0x0'));var rimraf=require(_0xcd53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd53('0x2'));var moment=require(_0xcd53('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcd53('0x4'));var util=require(_0xcd53('0x5'));var path=require(_0xcd53('0x6'));var sox=require(_0xcd53('0x7'));var csv=require(_0xcd53('0x8'));var ejs=require(_0xcd53('0x9'));var fs=require('fs');var fs_extra=require(_0xcd53('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd53('0xb'));var jsforce=require(_0xcd53('0xc'));var deskjs=require(_0xcd53('0xd'));var toCsv=require(_0xcd53('0x8'));var querystring=require(_0xcd53('0xe'));var Papa=require(_0xcd53('0xf'));var Redis=require('ioredis');var authService=require(_0xcd53('0x10'));var qs=require(_0xcd53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd53('0x12'))(_0xcd53('0x13'));var utils=require(_0xcd53('0x14'));var config=require(_0xcd53('0x15'));var licenseUtil=require(_0xcd53('0x16'));var db=require(_0xcd53('0x17'))['db'];function respondWithStatusCode(_0x329c3f,_0x5d3649){_0x5d3649=_0x5d3649||0xcc;return function(_0x38e953){if(_0x38e953){return _0x329c3f['sendStatus'](_0x5d3649);}return _0x329c3f[_0xcd53('0x18')](_0x5d3649)[_0xcd53('0x19')]();};}function respondWithResult(_0x3456d6,_0x399b8c){_0x399b8c=_0x399b8c||0xc8;return function(_0x511a20){if(_0x511a20){return _0x3456d6[_0xcd53('0x18')](_0x399b8c)[_0xcd53('0x1a')](_0x511a20);}};}function respondWithFilteredResult(_0x246a7c,_0x30892e){return function(_0x3662e0){if(_0x3662e0){var _0x439a85=typeof _0x30892e[_0xcd53('0x1b')]===_0xcd53('0x1c')&&typeof _0x30892e[_0xcd53('0x1d')]===_0xcd53('0x1c');var _0x1983be=_0x3662e0[_0xcd53('0x1e')];var _0x5e38b8=_0x439a85?0x0:_0x30892e[_0xcd53('0x1b')];var _0x1c2f6c=_0x439a85?_0x3662e0[_0xcd53('0x1e')]:_0x30892e['offset']+_0x30892e['limit'];var _0x129a78;if(_0x1c2f6c>=_0x1983be){_0x1c2f6c=_0x1983be;_0x129a78=0xc8;}else{_0x129a78=0xce;}_0x246a7c[_0xcd53('0x18')](_0x129a78);return _0x246a7c[_0xcd53('0x1f')]('Content-Range',_0x5e38b8+'-'+_0x1c2f6c+'/'+_0x1983be)['json'](_0x3662e0);}return null;};}function patchUpdates(_0x2832ac){return function(_0x54890a){try{jsonpatch[_0xcd53('0x20')](_0x54890a,_0x2832ac,!![]);}catch(_0xc15c87){return BPromise[_0xcd53('0x21')](_0xc15c87);}return _0x54890a['save']();};}function saveUpdates(_0x4f54d2,_0x3ba8cc){return function(_0x472e02){if(_0x472e02){return _0x472e02[_0xcd53('0x22')](_0x4f54d2)[_0xcd53('0x23')](function(_0x371981){return _0x371981;});}return null;};}function removeEntity(_0x407ce5,_0x509471){return function(_0x1bf54c){if(_0x1bf54c){return _0x1bf54c[_0xcd53('0x24')]()[_0xcd53('0x23')](function(){_0x407ce5[_0xcd53('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d31d,_0x2b5ef6){return function(_0x32a1ae){if(!_0x32a1ae){_0x36d31d['sendStatus'](0x194);}return _0x32a1ae;};}function handleError(_0x1e7e90,_0x5178aa){_0x5178aa=_0x5178aa||0x1f4;return function(_0x3834cf){logger[_0xcd53('0x25')](_0x3834cf[_0xcd53('0x26')]);if(_0x3834cf[_0xcd53('0x27')]){delete _0x3834cf[_0xcd53('0x27')];}_0x1e7e90[_0xcd53('0x18')](_0x5178aa)['send'](_0x3834cf);};}exports[_0xcd53('0x28')]=function(_0x21e7bf,_0x58660c){var _0x29e42f={},_0x2efe51={},_0x505e3b={'count':0x0,'rows':[]};var _0x5d3beb=_[_0xcd53('0x29')](db['ZohoConfiguration'][_0xcd53('0x2a')],function(_0x566726){return{'name':_0x566726[_0xcd53('0x2b')],'type':_0x566726['type']['key']};});_0x2efe51[_0xcd53('0x2c')]=_[_0xcd53('0x29')](_0x5d3beb,'name');_0x2efe51['query']=_[_0xcd53('0x2d')](_0x21e7bf[_0xcd53('0x2e')]);_0x2efe51[_0xcd53('0x2f')]=_[_0xcd53('0x30')](_0x2efe51[_0xcd53('0x2c')],_0x2efe51['query']);_0x29e42f[_0xcd53('0x31')]=_[_0xcd53('0x30')](_0x2efe51[_0xcd53('0x2c')],qs[_0xcd53('0x32')](_0x21e7bf[_0xcd53('0x2e')][_0xcd53('0x32')]));_0x29e42f[_0xcd53('0x31')]=_0x29e42f[_0xcd53('0x31')][_0xcd53('0x33')]?_0x29e42f[_0xcd53('0x31')]:_0x2efe51[_0xcd53('0x2c')];if(!_0x21e7bf[_0xcd53('0x2e')]['hasOwnProperty'](_0xcd53('0x34'))){_0x29e42f['limit']=qs[_0xcd53('0x1d')](_0x21e7bf[_0xcd53('0x2e')][_0xcd53('0x1d')]);_0x29e42f[_0xcd53('0x1b')]=qs[_0xcd53('0x1b')](_0x21e7bf[_0xcd53('0x2e')][_0xcd53('0x1b')]);}_0x29e42f['order']=qs[_0xcd53('0x35')](_0x21e7bf[_0xcd53('0x2e')]['sort']);_0x29e42f[_0xcd53('0x36')]=qs[_0xcd53('0x2f')](_['pick'](_0x21e7bf[_0xcd53('0x2e')],_0x2efe51[_0xcd53('0x2f')]),_0x5d3beb);if(_0x21e7bf[_0xcd53('0x2e')][_0xcd53('0x37')]){_0x29e42f['where']=_[_0xcd53('0x38')](_0x29e42f[_0xcd53('0x36')],{'$or':_[_0xcd53('0x29')](_0x5d3beb,function(_0x5a6664){if(_0x5a6664[_0xcd53('0x39')]!==_0xcd53('0x3a')){var _0x5595e1={};_0x5595e1[_0x5a6664[_0xcd53('0x27')]]={'$like':'%'+_0x21e7bf[_0xcd53('0x2e')][_0xcd53('0x37')]+'%'};return _0x5595e1;}})});}_0x29e42f=_[_0xcd53('0x38')]({},_0x29e42f,_0x21e7bf[_0xcd53('0x3b')]);var _0xb6f2c7={'where':_0x29e42f['where']};return db[_0xcd53('0x3c')][_0xcd53('0x1e')](_0xb6f2c7)['then'](function(_0x4efe4c){_0x505e3b[_0xcd53('0x1e')]=_0x4efe4c;if(_0x21e7bf['query']['includeAll']){_0x29e42f[_0xcd53('0x3d')]=[{'all':!![]}];}return db[_0xcd53('0x3c')][_0xcd53('0x3e')](_0x29e42f);})[_0xcd53('0x23')](function(_0x18ac4d){_0x505e3b[_0xcd53('0x3f')]=_0x18ac4d;return _0x505e3b;})['then'](respondWithFilteredResult(_0x58660c,_0x29e42f))[_0xcd53('0x40')](handleError(_0x58660c,null));};exports[_0xcd53('0x41')]=function(_0x152d09,_0x21cd48){var _0xca9341={'raw':![],'where':{'id':_0x152d09[_0xcd53('0x42')]['id']}},_0x3fab86={};_0x3fab86['model']=_[_0xcd53('0x2d')](db['ZohoConfiguration'][_0xcd53('0x2a')]);_0x3fab86[_0xcd53('0x2e')]=_[_0xcd53('0x2d')](_0x152d09['query']);_0x3fab86[_0xcd53('0x2f')]=_['intersection'](_0x3fab86[_0xcd53('0x2c')],_0x3fab86[_0xcd53('0x2e')]);_0xca9341[_0xcd53('0x31')]=_['intersection'](_0x3fab86[_0xcd53('0x2c')],qs[_0xcd53('0x32')](_0x152d09['query'][_0xcd53('0x32')]));_0xca9341['attributes']=_0xca9341['attributes'][_0xcd53('0x33')]?_0xca9341[_0xcd53('0x31')]:_0x3fab86[_0xcd53('0x2c')];if(_0x152d09['query'][_0xcd53('0x43')]){_0xca9341[_0xcd53('0x3d')]=[{'all':!![]}];}_0xca9341=_[_0xcd53('0x38')]({},_0xca9341,_0x152d09['options']);return db[_0xcd53('0x3c')][_0xcd53('0x44')](_0xca9341)['then'](handleEntityNotFound(_0x21cd48,null))['then'](respondWithResult(_0x21cd48,null))['catch'](handleError(_0x21cd48,null));};exports[_0xcd53('0x45')]=function(_0x1368ae,_0x3b03a9){return db['ZohoConfiguration']['create'](_0x1368ae[_0xcd53('0x46')],{})[_0xcd53('0x23')](respondWithResult(_0x3b03a9,0xc9))[_0xcd53('0x40')](handleError(_0x3b03a9,null));};exports['update']=function(_0x400c59,_0x412b7f){if(_0x400c59[_0xcd53('0x46')]['id']){delete _0x400c59[_0xcd53('0x46')]['id'];}return db[_0xcd53('0x3c')][_0xcd53('0x44')]({'where':{'id':_0x400c59['params']['id']}})['then'](handleEntityNotFound(_0x412b7f,null))[_0xcd53('0x23')](saveUpdates(_0x400c59[_0xcd53('0x46')],null))[_0xcd53('0x23')](respondWithResult(_0x412b7f,null))[_0xcd53('0x40')](handleError(_0x412b7f,null));};exports['destroy']=function(_0x350eee,_0x70b502){return db[_0xcd53('0x3c')][_0xcd53('0x44')]({'where':{'id':_0x350eee[_0xcd53('0x42')]['id']}})[_0xcd53('0x23')](handleEntityNotFound(_0x70b502,null))[_0xcd53('0x23')](removeEntity(_0x70b502,null))[_0xcd53('0x40')](handleError(_0x70b502,null));};exports[_0xcd53('0x47')]=function(_0x114528,_0x4a68a7,_0x1c7238){var _0x7530ee={};var _0x5d40e1={};var _0x4bb525;var _0x550168;return db[_0xcd53('0x3c')][_0xcd53('0x48')]({'where':{'id':_0x114528['params']['id']}})[_0xcd53('0x23')](handleEntityNotFound(_0x4a68a7,null))[_0xcd53('0x23')](function(_0x459a1a){if(_0x459a1a){_0x4bb525=_0x459a1a;_0x5d40e1[_0xcd53('0x2c')]=_['keys'](db[_0xcd53('0x49')][_0xcd53('0x2a')]);_0x5d40e1[_0xcd53('0x2e')]=_['keys'](_0x114528['query']);_0x5d40e1[_0xcd53('0x2f')]=_[_0xcd53('0x30')](_0x5d40e1[_0xcd53('0x2c')],_0x5d40e1[_0xcd53('0x2e')]);_0x7530ee[_0xcd53('0x31')]=_[_0xcd53('0x30')](_0x5d40e1[_0xcd53('0x2c')],qs[_0xcd53('0x32')](_0x114528[_0xcd53('0x2e')][_0xcd53('0x32')]));_0x7530ee[_0xcd53('0x31')]=_0x7530ee[_0xcd53('0x31')]['length']?_0x7530ee['attributes']:_0x5d40e1[_0xcd53('0x2c')];_0x7530ee['order']=qs[_0xcd53('0x35')](_0x114528['query'][_0xcd53('0x35')]);_0x7530ee[_0xcd53('0x36')]=qs[_0xcd53('0x2f')](_[_0xcd53('0x4a')](_0x114528[_0xcd53('0x2e')],_0x5d40e1[_0xcd53('0x2f')]));if(_0x114528[_0xcd53('0x2e')][_0xcd53('0x37')]){_0x7530ee[_0xcd53('0x36')]=_[_0xcd53('0x38')](_0x7530ee[_0xcd53('0x36')],{'$or':_['map'](_0x7530ee[_0xcd53('0x31')],function(_0x4372c9){var _0x145457={};_0x145457[_0x4372c9]={'$like':'%'+_0x114528['query'][_0xcd53('0x37')]+'%'};return _0x145457;})});}_0x7530ee=_['merge']({},_0x7530ee,_0x114528[_0xcd53('0x3b')]);return _0x4bb525[_0xcd53('0x47')](_0x7530ee);}})[_0xcd53('0x23')](function(_0x1ae102){if(_0x1ae102){_0x550168=_0x1ae102['length'];if(!_0x114528['query'][_0xcd53('0x4b')]('nolimit')){_0x7530ee[_0xcd53('0x1d')]=qs[_0xcd53('0x1d')](_0x114528[_0xcd53('0x2e')][_0xcd53('0x1d')]);_0x7530ee[_0xcd53('0x1b')]=qs[_0xcd53('0x1b')](_0x114528[_0xcd53('0x2e')]['offset']);}return _0x4bb525['getFields'](_0x7530ee);}})['then'](function(_0x4e7d78){if(_0x4e7d78){return _0x4e7d78?{'count':_0x550168,'rows':_0x4e7d78}:null;}})[_0xcd53('0x23')](respondWithResult(_0x4a68a7,null))['catch'](handleError(_0x4a68a7,null));};exports[_0xcd53('0x4c')]=function(_0x14742d,_0x410472,_0x84c5a9){var _0x16c82f={};var _0x5506f1={};var _0x5f3d20;var _0x5d911d;return db[_0xcd53('0x3c')][_0xcd53('0x48')]({'where':{'id':_0x14742d[_0xcd53('0x42')]['id']}})[_0xcd53('0x23')](handleEntityNotFound(_0x410472,null))['then'](function(_0x5bd846){if(_0x5bd846){_0x5f3d20=_0x5bd846;_0x5506f1[_0xcd53('0x2c')]=_['keys'](db['ZohoField']['rawAttributes']);_0x5506f1[_0xcd53('0x2e')]=_[_0xcd53('0x2d')](_0x14742d[_0xcd53('0x2e')]);_0x5506f1['filters']=_[_0xcd53('0x30')](_0x5506f1[_0xcd53('0x2c')],_0x5506f1[_0xcd53('0x2e')]);_0x16c82f[_0xcd53('0x31')]=_[_0xcd53('0x30')](_0x5506f1['model'],qs[_0xcd53('0x32')](_0x14742d['query']['fields']));_0x16c82f[_0xcd53('0x31')]=_0x16c82f['attributes'][_0xcd53('0x33')]?_0x16c82f[_0xcd53('0x31')]:_0x5506f1[_0xcd53('0x2c')];_0x16c82f[_0xcd53('0x4d')]=qs[_0xcd53('0x35')](_0x14742d[_0xcd53('0x2e')][_0xcd53('0x35')]);_0x16c82f[_0xcd53('0x36')]=qs[_0xcd53('0x2f')](_[_0xcd53('0x4a')](_0x14742d[_0xcd53('0x2e')],_0x5506f1[_0xcd53('0x2f')]));if(_0x14742d[_0xcd53('0x2e')][_0xcd53('0x37')]){_0x16c82f[_0xcd53('0x36')]=_[_0xcd53('0x38')](_0x16c82f[_0xcd53('0x36')],{'$or':_[_0xcd53('0x29')](_0x16c82f['attributes'],function(_0x13c0e4){var _0x418ddb={};_0x418ddb[_0x13c0e4]={'$like':'%'+_0x14742d[_0xcd53('0x2e')][_0xcd53('0x37')]+'%'};return _0x418ddb;})});}_0x16c82f=_['merge']({},_0x16c82f,_0x14742d[_0xcd53('0x3b')]);return _0x5f3d20[_0xcd53('0x4c')](_0x16c82f);}})[_0xcd53('0x23')](function(_0x2a8c61){if(_0x2a8c61){_0x5d911d=_0x2a8c61[_0xcd53('0x33')];if(!_0x14742d['query'][_0xcd53('0x4b')](_0xcd53('0x34'))){_0x16c82f[_0xcd53('0x1d')]=qs[_0xcd53('0x1d')](_0x14742d[_0xcd53('0x2e')][_0xcd53('0x1d')]);_0x16c82f[_0xcd53('0x1b')]=qs[_0xcd53('0x1b')](_0x14742d[_0xcd53('0x2e')]['offset']);}return _0x5f3d20[_0xcd53('0x4c')](_0x16c82f);}})[_0xcd53('0x23')](function(_0x57222b){if(_0x57222b){return _0x57222b?{'count':_0x5d911d,'rows':_0x57222b}:null;}})[_0xcd53('0x23')](respondWithResult(_0x410472,null))[_0xcd53('0x40')](handleError(_0x410472,null));};exports[_0xcd53('0x4e')]=function(_0x62578f,_0x31d5be,_0x94a320){var _0x9545d1={};var _0x110b2d={};var _0x480ef8;var _0x5a292f;return db[_0xcd53('0x3c')]['findOne']({'where':{'id':_0x62578f[_0xcd53('0x42')]['id']}})[_0xcd53('0x23')](handleEntityNotFound(_0x31d5be,null))[_0xcd53('0x23')](function(_0x20268d){if(_0x20268d){_0x480ef8=_0x20268d;_0x110b2d['model']=_[_0xcd53('0x2d')](db[_0xcd53('0x49')][_0xcd53('0x2a')]);_0x110b2d['query']=_[_0xcd53('0x2d')](_0x62578f['query']);_0x110b2d[_0xcd53('0x2f')]=_['intersection'](_0x110b2d[_0xcd53('0x2c')],_0x110b2d[_0xcd53('0x2e')]);_0x9545d1[_0xcd53('0x31')]=_[_0xcd53('0x30')](_0x110b2d[_0xcd53('0x2c')],qs[_0xcd53('0x32')](_0x62578f[_0xcd53('0x2e')][_0xcd53('0x32')]));_0x9545d1['attributes']=_0x9545d1['attributes'][_0xcd53('0x33')]?_0x9545d1[_0xcd53('0x31')]:_0x110b2d[_0xcd53('0x2c')];_0x9545d1['order']=qs[_0xcd53('0x35')](_0x62578f[_0xcd53('0x2e')][_0xcd53('0x35')]);_0x9545d1[_0xcd53('0x36')]=qs[_0xcd53('0x2f')](_[_0xcd53('0x4a')](_0x62578f[_0xcd53('0x2e')],_0x110b2d[_0xcd53('0x2f')]));if(_0x62578f['query'][_0xcd53('0x37')]){_0x9545d1[_0xcd53('0x36')]=_[_0xcd53('0x38')](_0x9545d1['where'],{'$or':_[_0xcd53('0x29')](_0x9545d1[_0xcd53('0x31')],function(_0x44b747){var _0x3eadb9={};_0x3eadb9[_0x44b747]={'$like':'%'+_0x62578f[_0xcd53('0x2e')]['filter']+'%'};return _0x3eadb9;})});}_0x9545d1=_[_0xcd53('0x38')]({},_0x9545d1,_0x62578f[_0xcd53('0x3b')]);return _0x480ef8[_0xcd53('0x4e')](_0x9545d1);}})[_0xcd53('0x23')](function(_0x5febba){if(_0x5febba){_0x5a292f=_0x5febba[_0xcd53('0x33')];if(!_0x62578f[_0xcd53('0x2e')][_0xcd53('0x4b')](_0xcd53('0x34'))){_0x9545d1[_0xcd53('0x1d')]=qs[_0xcd53('0x1d')](_0x62578f['query'][_0xcd53('0x1d')]);_0x9545d1[_0xcd53('0x1b')]=qs['offset'](_0x62578f['query'][_0xcd53('0x1b')]);}return _0x480ef8[_0xcd53('0x4e')](_0x9545d1);}})[_0xcd53('0x23')](function(_0x372639){if(_0x372639){return _0x372639?{'count':_0x5a292f,'rows':_0x372639}:null;}})[_0xcd53('0x23')](respondWithResult(_0x31d5be,null))[_0xcd53('0x40')](handleError(_0x31d5be,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b5ed83a..55084e0 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 _0xe71e=['./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1fda3c,_0xefd4cb){var _0x1a2d1e=function(_0x31a6c3){while(--_0x31a6c3){_0x1fda3c['push'](_0x1fda3c['shift']());}};_0x1a2d1e(++_0xefd4cb);}(_0xe71e,0x100));var _0xee71=function(_0x4e806d,_0x4cc01d){_0x4e806d=_0x4e806d-0x0;var _0x20821f=_0xe71e[_0x4e806d];return _0x20821f;};'use strict';var _=require(_0xee71('0x0'));var util=require(_0xee71('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xee71('0x2'));var BPromise=require(_0xee71('0x3'));var rp=require(_0xee71('0x4'));var fs=require('fs');var path=require(_0xee71('0x5'));var rimraf=require(_0xee71('0x6'));var config=require(_0xee71('0x7'));var attributes=require(_0xee71('0x8'));module['exports']=function(_0x4df6ab,_0x59c46c){return _0x4df6ab[_0xee71('0x9')](_0xee71('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7819=['../../config/environment','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x3bbe3b,_0x45454f){var _0x4f2564=function(_0xb032fc){while(--_0xb032fc){_0x3bbe3b['push'](_0x3bbe3b['shift']());}};_0x4f2564(++_0x45454f);}(_0x7819,0x10c));var _0x9781=function(_0x178c3d,_0x32e94a){_0x178c3d=_0x178c3d-0x0;var _0x105b44=_0x7819[_0x178c3d];return _0x105b44;};'use strict';var _=require(_0x9781('0x0'));var util=require(_0x9781('0x1'));var logger=require('../../config/logger')(_0x9781('0x2'));var moment=require(_0x9781('0x3'));var BPromise=require('bluebird');var rp=require(_0x9781('0x4'));var fs=require('fs');var path=require(_0x9781('0x5'));var rimraf=require(_0x9781('0x6'));var config=require(_0x9781('0x7'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x20df49,_0x12690b){return _0x20df49[_0x9781('0x8')](_0x9781('0x9'),attributes,{'tableName':_0x9781('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index fd27b66..c9be818 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 _0xbf6f=['rpc','jayson/promise','client','request','then','request\x20sent','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2122d4,_0x6d3065){var _0x428992=function(_0x230f18){while(--_0x230f18){_0x2122d4['push'](_0x2122d4['shift']());}};_0x428992(++_0x6d3065);}(_0xbf6f,0x91));var _0xfbf6=function(_0x56a7fb,_0xe80bc2){_0x56a7fb=_0x56a7fb-0x0;var _0x536ada=_0xbf6f[_0x56a7fb];return _0x536ada;};'use strict';var _=require(_0xfbf6('0x0'));var util=require(_0xfbf6('0x1'));var moment=require(_0xfbf6('0x2'));var BPromise=require(_0xfbf6('0x3'));var rs=require(_0xfbf6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbf6('0x5'))['db'];var utils=require(_0xfbf6('0x6'));var logger=require('../../config/logger')(_0xfbf6('0x7'));var config=require('../../config/environment');var jayson=require(_0xfbf6('0x8'));var client=jayson[_0xfbf6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40bd26,_0x3303b4,_0x3ab2c4){return new BPromise(function(_0x217760,_0x6ab1e9){return client[_0xfbf6('0xa')](_0x40bd26,_0x3ab2c4)[_0xfbf6('0xb')](function(_0x5bcaba){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3303b4,_0xfbf6('0xc'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3303b4,'request\x20sent',JSON[_0xfbf6('0xd')](_0x5bcaba));if(_0x5bcaba['error']){if(_0x5bcaba['error']['code']===0x1f4){logger[_0xfbf6('0xe')](_0xfbf6('0xf'),_0x3303b4,_0x5bcaba[_0xfbf6('0xe')][_0xfbf6('0x10')]);return _0x6ab1e9(_0x5bcaba[_0xfbf6('0xe')][_0xfbf6('0x10')]);}logger[_0xfbf6('0xe')](_0xfbf6('0xf'),_0x3303b4,_0x5bcaba['error']['message']);return _0x217760(_0x5bcaba[_0xfbf6('0xe')][_0xfbf6('0x10')]);}else{logger[_0xfbf6('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3303b4,_0xfbf6('0xc'));_0x217760(_0x5bcaba['result']['message']);}})[_0xfbf6('0x12')](function(_0x37dd2e){logger[_0xfbf6('0xe')](_0xfbf6('0xf'),_0x3303b4,_0x37dd2e);_0x6ab1e9(_0x37dd2e);});});} \ No newline at end of file +var _0x0e1a=['../../config/utils','rpc','jayson/promise','http','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x0e1a,0x1c7));var _0xa0e1=function(_0x1e9862,_0x1a184e){_0x1e9862=_0x1e9862-0x0;var _0x5ab95e=_0x0e1a[_0x1e9862];return _0x5ab95e;};'use strict';var _=require(_0xa0e1('0x0'));var util=require(_0xa0e1('0x1'));var moment=require(_0xa0e1('0x2'));var BPromise=require(_0xa0e1('0x3'));var rs=require(_0xa0e1('0x4'));var fs=require('fs');var Redis=require(_0xa0e1('0x5'));var db=require(_0xa0e1('0x6'))['db'];var utils=require(_0xa0e1('0x7'));var logger=require('../../config/logger')(_0xa0e1('0x8'));var config=require('../../config/environment');var jayson=require(_0xa0e1('0x9'));var client=jayson['client'][_0xa0e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2728ce,_0x3d77d9,_0x514c65){return new BPromise(function(_0x4cffd4,_0x1af29b){return client[_0xa0e1('0xb')](_0x2728ce,_0x514c65)['then'](function(_0x274aae){logger[_0xa0e1('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d77d9,_0xa0e1('0xd'));logger[_0xa0e1('0xe')](_0xa0e1('0xf'),_0x3d77d9,'request\x20sent',JSON[_0xa0e1('0x10')](_0x274aae));if(_0x274aae[_0xa0e1('0x11')]){if(_0x274aae[_0xa0e1('0x11')][_0xa0e1('0x12')]===0x1f4){logger[_0xa0e1('0x11')](_0xa0e1('0x13'),_0x3d77d9,_0x274aae['error'][_0xa0e1('0x14')]);return _0x1af29b(_0x274aae[_0xa0e1('0x11')][_0xa0e1('0x14')]);}logger[_0xa0e1('0x11')](_0xa0e1('0x13'),_0x3d77d9,_0x274aae[_0xa0e1('0x11')]['message']);return _0x4cffd4(_0x274aae[_0xa0e1('0x11')][_0xa0e1('0x14')]);}else{logger[_0xa0e1('0xc')](_0xa0e1('0x13'),_0x3d77d9,_0xa0e1('0xd'));_0x4cffd4(_0x274aae[_0xa0e1('0x15')][_0xa0e1('0x14')]);}})['catch'](function(_0x43ac56){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3d77d9,_0x43ac56);_0x1af29b(_0x43ac56);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 59f3e2c..0108bcd 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 _0x7870=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x1872de,_0x2a2c12){var _0x35b800=function(_0x54d4a4){while(--_0x54d4a4){_0x1872de['push'](_0x1872de['shift']());}};_0x35b800(++_0x2a2c12);}(_0x7870,0xde));var _0x0787=function(_0x2983dd,_0x57d354){_0x2983dd=_0x2983dd-0x0;var _0x11d621=_0x7870[_0x2983dd];return _0x11d621;};'use strict';var multer=require(_0x0787('0x0'));var util=require(_0x0787('0x1'));var path=require('path');var timeout=require(_0x0787('0x2'));var express=require(_0x0787('0x3'));var router=express[_0x0787('0x4')]();var fs_extra=require(_0x0787('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0787('0x6'));var config=require(_0x0787('0x7'));var controller=require(_0x0787('0x8'));router[_0x0787('0x9')]('/',auth[_0x0787('0xa')](),controller[_0x0787('0xb')]);router[_0x0787('0x9')](_0x0787('0xc'),auth[_0x0787('0xa')](),controller[_0x0787('0xd')]);router[_0x0787('0xe')]('/',auth[_0x0787('0xa')](),controller[_0x0787('0xf')]);router[_0x0787('0x10')](_0x0787('0xc'),auth[_0x0787('0xa')](),controller[_0x0787('0x11')]);router['delete']('/:id',auth[_0x0787('0xa')](),controller[_0x0787('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1afb=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','post','create','update','delete'];(function(_0x452d35,_0x55ae82){var _0x14c71b=function(_0x56e209){while(--_0x56e209){_0x452d35['push'](_0x452d35['shift']());}};_0x14c71b(++_0x55ae82);}(_0x1afb,0x1e0));var _0xb1af=function(_0x549e0d,_0x23c01c){_0x549e0d=_0x549e0d-0x0;var _0x3c29cf=_0x1afb[_0x549e0d];return _0x3c29cf;};'use strict';var multer=require(_0xb1af('0x0'));var util=require(_0xb1af('0x1'));var path=require(_0xb1af('0x2'));var timeout=require(_0xb1af('0x3'));var express=require(_0xb1af('0x4'));var router=express[_0xb1af('0x5')]();var fs_extra=require(_0xb1af('0x6'));var auth=require(_0xb1af('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb1af('0x8'));var controller=require('./intZohoField.controller');router[_0xb1af('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb1af('0x9')](_0xb1af('0xa'),auth[_0xb1af('0xb')](),controller['show']);router[_0xb1af('0xc')]('/',auth[_0xb1af('0xb')](),controller[_0xb1af('0xd')]);router['put'](_0xb1af('0xa'),auth[_0xb1af('0xb')](),controller[_0xb1af('0xe')]);router[_0xb1af('0xf')](_0xb1af('0xa'),auth[_0xb1af('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index cd7e238..1327d0b 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 _0xb7aa=['STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0xb7aa,0x6b));var _0xab7a=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xb7aa[_0x510c60];return _0x49c4aa;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'type':{'type':Sequelize[_0xab7a('0x2')](_0xab7a('0x3'),_0xab7a('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0xab7a('0x3')},'content':{'type':Sequelize[_0xab7a('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xab7a('0x3'),'variable',_0xab7a('0x6'))},'keyContent':{'type':Sequelize[_0xab7a('0x5')]},'idField':{'type':Sequelize[_0xab7a('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab7a('0x5')]}}; \ No newline at end of file +var _0xe186=['STRING','BOOLEAN','sequelize','variable','customVariable','keyValue','picklist','string','ENUM'];(function(_0x3488cd,_0x4c1399){var _0x5cfa0c=function(_0x27d142){while(--_0x27d142){_0x3488cd['push'](_0x3488cd['shift']());}};_0x5cfa0c(++_0x4c1399);}(_0xe186,0x107));var _0x6e18=function(_0x87a977,_0x3a2d1e){_0x87a977=_0x87a977-0x0;var _0xa806eb=_0xe186[_0x87a977];return _0xa806eb;};'use strict';var Sequelize=require(_0x6e18('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x6e18('0x1'),_0x6e18('0x2'),_0x6e18('0x3'),_0x6e18('0x4')),'defaultValue':_0x6e18('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6e18('0x6')](_0x6e18('0x5'),_0x6e18('0x1'),_0x6e18('0x2'))},'keyContent':{'type':Sequelize[_0x6e18('0x7')]},'idField':{'type':Sequelize[_0x6e18('0x7')]},'nameField':{'type':Sequelize[_0x6e18('0x7')]},'customField':{'type':Sequelize[_0x6e18('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c531a5c..1e21f93 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 _0x5692=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','options','includeAll','include','findAll','rows','catch','show','ZohoField','merge','find','create','body','destroy','params','rimraf','fast-json-patch','bluebird','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5692,0x1b8));var _0x2569=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5692[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2569('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2569('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2569('0x2'));var Mustache=require('mustache');var util=require(_0x2569('0x3'));var path=require(_0x2569('0x4'));var sox=require(_0x2569('0x5'));var csv=require(_0x2569('0x6'));var ejs=require(_0x2569('0x7'));var fs=require('fs');var fs_extra=require(_0x2569('0x8'));var _=require(_0x2569('0x9'));var squel=require('squel');var crypto=require(_0x2569('0xa'));var jsforce=require(_0x2569('0xb'));var deskjs=require(_0x2569('0xc'));var toCsv=require(_0x2569('0x6'));var querystring=require(_0x2569('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2569('0xe'));var as=require(_0x2569('0xf'));var hardwareService=require(_0x2569('0x10'));var logger=require(_0x2569('0x11'))(_0x2569('0x12'));var utils=require(_0x2569('0x13'));var config=require(_0x2569('0x14'));var licenseUtil=require(_0x2569('0x15'));var db=require(_0x2569('0x16'))['db'];function respondWithStatusCode(_0x47f43d,_0x3a3922){_0x3a3922=_0x3a3922||0xcc;return function(_0x5289c9){if(_0x5289c9){return _0x47f43d['sendStatus'](_0x3a3922);}return _0x47f43d[_0x2569('0x17')](_0x3a3922)[_0x2569('0x18')]();};}function respondWithResult(_0x527edb,_0x1997db){_0x1997db=_0x1997db||0xc8;return function(_0x4eaaa3){if(_0x4eaaa3){return _0x527edb[_0x2569('0x17')](_0x1997db)['json'](_0x4eaaa3);}};}function respondWithFilteredResult(_0x3bd91c,_0xad122c){return function(_0x14efbf){if(_0x14efbf){var _0x3f846b=typeof _0xad122c[_0x2569('0x19')]==='undefined'&&typeof _0xad122c[_0x2569('0x1a')]===_0x2569('0x1b');var _0x4da2c0=_0x14efbf[_0x2569('0x1c')];var _0x333316=_0x3f846b?0x0:_0xad122c[_0x2569('0x19')];var _0x1dda98=_0x3f846b?_0x14efbf[_0x2569('0x1c')]:_0xad122c[_0x2569('0x19')]+_0xad122c['limit'];var _0x48d964;if(_0x1dda98>=_0x4da2c0){_0x1dda98=_0x4da2c0;_0x48d964=0xc8;}else{_0x48d964=0xce;}_0x3bd91c[_0x2569('0x17')](_0x48d964);return _0x3bd91c[_0x2569('0x1d')](_0x2569('0x1e'),_0x333316+'-'+_0x1dda98+'/'+_0x4da2c0)[_0x2569('0x1f')](_0x14efbf);}return null;};}function patchUpdates(_0x5e3f3a){return function(_0x26594a){try{jsonpatch[_0x2569('0x20')](_0x26594a,_0x5e3f3a,!![]);}catch(_0x5172b6){return BPromise[_0x2569('0x21')](_0x5172b6);}return _0x26594a['save']();};}function saveUpdates(_0x3c7a39,_0x204c01){return function(_0x5a22e8){if(_0x5a22e8){return _0x5a22e8[_0x2569('0x22')](_0x3c7a39)['then'](function(_0x285be0){return _0x285be0;});}return null;};}function removeEntity(_0x512fbb,_0x4d1a3c){return function(_0x173c39){if(_0x173c39){return _0x173c39['destroy']()[_0x2569('0x23')](function(){_0x512fbb['status'](0xcc)[_0x2569('0x18')]();});}};}function handleEntityNotFound(_0x492e24,_0x3dd3dc){return function(_0x3d5c59){if(!_0x3d5c59){_0x492e24[_0x2569('0x24')](0x194);}return _0x3d5c59;};}function handleError(_0x70c4e8,_0x2849d8){_0x2849d8=_0x2849d8||0x1f4;return function(_0x360b4c){logger[_0x2569('0x25')](_0x360b4c[_0x2569('0x26')]);if(_0x360b4c[_0x2569('0x27')]){delete _0x360b4c[_0x2569('0x27')];}_0x70c4e8[_0x2569('0x17')](_0x2849d8)[_0x2569('0x28')](_0x360b4c);};}exports[_0x2569('0x29')]=function(_0x5ce3f7,_0x43410c){var _0x3689ed={},_0x2e4ffe={},_0x5b8a45={'count':0x0,'rows':[]};var _0x2b7f78=_[_0x2569('0x2a')](db['ZohoField'][_0x2569('0x2b')],function(_0x49bf01){return{'name':_0x49bf01[_0x2569('0x2c')],'type':_0x49bf01[_0x2569('0x2d')][_0x2569('0x2e')]};});_0x2e4ffe['model']=_[_0x2569('0x2a')](_0x2b7f78,_0x2569('0x27'));_0x2e4ffe[_0x2569('0x2f')]=_[_0x2569('0x30')](_0x5ce3f7[_0x2569('0x2f')]);_0x2e4ffe['filters']=_[_0x2569('0x31')](_0x2e4ffe[_0x2569('0x32')],_0x2e4ffe[_0x2569('0x2f')]);_0x3689ed['attributes']=_['intersection'](_0x2e4ffe[_0x2569('0x32')],qs[_0x2569('0x33')](_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x33')]));_0x3689ed[_0x2569('0x34')]=_0x3689ed[_0x2569('0x34')][_0x2569('0x35')]?_0x3689ed[_0x2569('0x34')]:_0x2e4ffe['model'];if(!_0x5ce3f7[_0x2569('0x2f')]['hasOwnProperty'](_0x2569('0x36'))){_0x3689ed['limit']=qs[_0x2569('0x1a')](_0x5ce3f7[_0x2569('0x2f')]['limit']);_0x3689ed[_0x2569('0x19')]=qs['offset'](_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x19')]);}_0x3689ed[_0x2569('0x37')]=qs[_0x2569('0x38')](_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x38')]);_0x3689ed['where']=qs['filters'](_['pick'](_0x5ce3f7[_0x2569('0x2f')],_0x2e4ffe[_0x2569('0x39')]),_0x2b7f78);if(_0x5ce3f7['query'][_0x2569('0x3a')]){_0x3689ed[_0x2569('0x3b')]=_['merge'](_0x3689ed[_0x2569('0x3b')],{'$or':_[_0x2569('0x2a')](_0x2b7f78,function(_0x4fe776){if(_0x4fe776[_0x2569('0x2d')]!=='VIRTUAL'){var _0xf841fb={};_0xf841fb[_0x4fe776[_0x2569('0x27')]]={'$like':'%'+_0x5ce3f7[_0x2569('0x2f')][_0x2569('0x3a')]+'%'};return _0xf841fb;}})});}_0x3689ed=_['merge']({},_0x3689ed,_0x5ce3f7[_0x2569('0x3c')]);var _0x489492={'where':_0x3689ed[_0x2569('0x3b')]};return db['ZohoField']['count'](_0x489492)[_0x2569('0x23')](function(_0x3b25dc){_0x5b8a45[_0x2569('0x1c')]=_0x3b25dc;if(_0x5ce3f7['query'][_0x2569('0x3d')]){_0x3689ed[_0x2569('0x3e')]=[{'all':!![]}];}return db['ZohoField'][_0x2569('0x3f')](_0x3689ed);})[_0x2569('0x23')](function(_0x1e7c5e){_0x5b8a45[_0x2569('0x40')]=_0x1e7c5e;return _0x5b8a45;})[_0x2569('0x23')](respondWithFilteredResult(_0x43410c,_0x3689ed))[_0x2569('0x41')](handleError(_0x43410c,null));};exports[_0x2569('0x42')]=function(_0x352f6f,_0x3819ce){var _0x14f788={'raw':!![],'where':{'id':_0x352f6f['params']['id']}},_0x7232cc={};_0x7232cc[_0x2569('0x32')]=_[_0x2569('0x30')](db[_0x2569('0x43')]['rawAttributes']);_0x7232cc[_0x2569('0x2f')]=_[_0x2569('0x30')](_0x352f6f[_0x2569('0x2f')]);_0x7232cc[_0x2569('0x39')]=_[_0x2569('0x31')](_0x7232cc[_0x2569('0x32')],_0x7232cc[_0x2569('0x2f')]);_0x14f788[_0x2569('0x34')]=_['intersection'](_0x7232cc[_0x2569('0x32')],qs[_0x2569('0x33')](_0x352f6f[_0x2569('0x2f')]['fields']));_0x14f788[_0x2569('0x34')]=_0x14f788['attributes'][_0x2569('0x35')]?_0x14f788['attributes']:_0x7232cc[_0x2569('0x32')];if(_0x352f6f[_0x2569('0x2f')][_0x2569('0x3d')]){_0x14f788['include']=[{'all':!![]}];}_0x14f788=_[_0x2569('0x44')]({},_0x14f788,_0x352f6f[_0x2569('0x3c')]);return db[_0x2569('0x43')][_0x2569('0x45')](_0x14f788)[_0x2569('0x23')](handleEntityNotFound(_0x3819ce,null))['then'](respondWithResult(_0x3819ce,null))[_0x2569('0x41')](handleError(_0x3819ce,null));};exports[_0x2569('0x46')]=function(_0x112258,_0x1cdbd1){return db['ZohoField']['create'](_0x112258[_0x2569('0x47')],{})[_0x2569('0x23')](respondWithResult(_0x1cdbd1,0xc9))['catch'](handleError(_0x1cdbd1,null));};exports['update']=function(_0x224125,_0x22850b){if(_0x224125[_0x2569('0x47')]['id']){delete _0x224125[_0x2569('0x47')]['id'];}return db['ZohoField'][_0x2569('0x45')]({'where':{'id':_0x224125['params']['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x22850b,null))['then'](saveUpdates(_0x224125[_0x2569('0x47')],null))[_0x2569('0x23')](respondWithResult(_0x22850b,null))['catch'](handleError(_0x22850b,null));};exports[_0x2569('0x48')]=function(_0xfcddc6,_0x5c9e47){return db['ZohoField']['find']({'where':{'id':_0xfcddc6[_0x2569('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c9e47,null))['then'](removeEntity(_0x5c9e47,null))['catch'](handleError(_0x5c9e47,null));}; \ No newline at end of file +var _0xee08=['then','error','stack','name','send','index','map','ZohoField','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xee08,0x185));var _0x8ee0=function(_0x5b3e31,_0xf7fc56){_0x5b3e31=_0x5b3e31-0x0;var _0x40b0b6=_0xee08[_0x5b3e31];return _0x40b0b6;};'use strict';var emlformat=require(_0x8ee0('0x0'));var rimraf=require(_0x8ee0('0x1'));var zipdir=require(_0x8ee0('0x2'));var jsonpatch=require(_0x8ee0('0x3'));var rp=require(_0x8ee0('0x4'));var moment=require('moment');var BPromise=require(_0x8ee0('0x5'));var Mustache=require(_0x8ee0('0x6'));var util=require(_0x8ee0('0x7'));var path=require(_0x8ee0('0x8'));var sox=require(_0x8ee0('0x9'));var csv=require('to-csv');var ejs=require(_0x8ee0('0xa'));var fs=require('fs');var fs_extra=require(_0x8ee0('0xb'));var _=require(_0x8ee0('0xc'));var squel=require(_0x8ee0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ee0('0xe'));var Papa=require(_0x8ee0('0xf'));var Redis=require(_0x8ee0('0x10'));var authService=require(_0x8ee0('0x11'));var qs=require(_0x8ee0('0x12'));var as=require(_0x8ee0('0x13'));var hardwareService=require(_0x8ee0('0x14'));var logger=require(_0x8ee0('0x15'))(_0x8ee0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ee0('0x17'))['db'];function respondWithStatusCode(_0x5dce7e,_0xb26cfa){_0xb26cfa=_0xb26cfa||0xcc;return function(_0x438d7c){if(_0x438d7c){return _0x5dce7e[_0x8ee0('0x18')](_0xb26cfa);}return _0x5dce7e[_0x8ee0('0x19')](_0xb26cfa)[_0x8ee0('0x1a')]();};}function respondWithResult(_0x31afc5,_0x5bce0e){_0x5bce0e=_0x5bce0e||0xc8;return function(_0x3d9d5d){if(_0x3d9d5d){return _0x31afc5[_0x8ee0('0x19')](_0x5bce0e)['json'](_0x3d9d5d);}};}function respondWithFilteredResult(_0x3ba5c9,_0x27bc31){return function(_0xfa13c8){if(_0xfa13c8){var _0x669e45=typeof _0x27bc31[_0x8ee0('0x1b')]==='undefined'&&typeof _0x27bc31[_0x8ee0('0x1c')]===_0x8ee0('0x1d');var _0x46ee41=_0xfa13c8[_0x8ee0('0x1e')];var _0x2af438=_0x669e45?0x0:_0x27bc31[_0x8ee0('0x1b')];var _0x213e92=_0x669e45?_0xfa13c8[_0x8ee0('0x1e')]:_0x27bc31[_0x8ee0('0x1b')]+_0x27bc31[_0x8ee0('0x1c')];var _0x5e139d;if(_0x213e92>=_0x46ee41){_0x213e92=_0x46ee41;_0x5e139d=0xc8;}else{_0x5e139d=0xce;}_0x3ba5c9[_0x8ee0('0x19')](_0x5e139d);return _0x3ba5c9[_0x8ee0('0x1f')](_0x8ee0('0x20'),_0x2af438+'-'+_0x213e92+'/'+_0x46ee41)['json'](_0xfa13c8);}return null;};}function patchUpdates(_0x46e21a){return function(_0x2e77a0){try{jsonpatch[_0x8ee0('0x21')](_0x2e77a0,_0x46e21a,!![]);}catch(_0x3f4560){return BPromise[_0x8ee0('0x22')](_0x3f4560);}return _0x2e77a0[_0x8ee0('0x23')]();};}function saveUpdates(_0x5bdabb,_0x212c84){return function(_0x18340e){if(_0x18340e){return _0x18340e[_0x8ee0('0x24')](_0x5bdabb)[_0x8ee0('0x25')](function(_0x4ece4f){return _0x4ece4f;});}return null;};}function removeEntity(_0x4e5644,_0x4ac234){return function(_0x382513){if(_0x382513){return _0x382513['destroy']()['then'](function(){_0x4e5644[_0x8ee0('0x19')](0xcc)[_0x8ee0('0x1a')]();});}};}function handleEntityNotFound(_0x3de0fb,_0x3570b2){return function(_0x3a2926){if(!_0x3a2926){_0x3de0fb['sendStatus'](0x194);}return _0x3a2926;};}function handleError(_0x1bec7a,_0x5b8d5b){_0x5b8d5b=_0x5b8d5b||0x1f4;return function(_0x62875a){logger[_0x8ee0('0x26')](_0x62875a[_0x8ee0('0x27')]);if(_0x62875a['name']){delete _0x62875a[_0x8ee0('0x28')];}_0x1bec7a['status'](_0x5b8d5b)[_0x8ee0('0x29')](_0x62875a);};}exports[_0x8ee0('0x2a')]=function(_0x4d8021,_0x3db629){var _0x34ae92={},_0x34b714={},_0x34b02c={'count':0x0,'rows':[]};var _0x538bd7=_[_0x8ee0('0x2b')](db[_0x8ee0('0x2c')]['rawAttributes'],function(_0x5e6111){return{'name':_0x5e6111['fieldName'],'type':_0x5e6111[_0x8ee0('0x2d')]['key']};});_0x34b714[_0x8ee0('0x2e')]=_[_0x8ee0('0x2b')](_0x538bd7,_0x8ee0('0x28'));_0x34b714[_0x8ee0('0x2f')]=_[_0x8ee0('0x30')](_0x4d8021[_0x8ee0('0x2f')]);_0x34b714[_0x8ee0('0x31')]=_['intersection'](_0x34b714[_0x8ee0('0x2e')],_0x34b714[_0x8ee0('0x2f')]);_0x34ae92[_0x8ee0('0x32')]=_[_0x8ee0('0x33')](_0x34b714['model'],qs['fields'](_0x4d8021[_0x8ee0('0x2f')][_0x8ee0('0x34')]));_0x34ae92[_0x8ee0('0x32')]=_0x34ae92[_0x8ee0('0x32')][_0x8ee0('0x35')]?_0x34ae92[_0x8ee0('0x32')]:_0x34b714[_0x8ee0('0x2e')];if(!_0x4d8021[_0x8ee0('0x2f')][_0x8ee0('0x36')]('nolimit')){_0x34ae92[_0x8ee0('0x1c')]=qs['limit'](_0x4d8021[_0x8ee0('0x2f')][_0x8ee0('0x1c')]);_0x34ae92[_0x8ee0('0x1b')]=qs[_0x8ee0('0x1b')](_0x4d8021['query'][_0x8ee0('0x1b')]);}_0x34ae92['order']=qs[_0x8ee0('0x37')](_0x4d8021['query'][_0x8ee0('0x37')]);_0x34ae92[_0x8ee0('0x38')]=qs[_0x8ee0('0x31')](_['pick'](_0x4d8021[_0x8ee0('0x2f')],_0x34b714[_0x8ee0('0x31')]),_0x538bd7);if(_0x4d8021[_0x8ee0('0x2f')][_0x8ee0('0x39')]){_0x34ae92[_0x8ee0('0x38')]=_[_0x8ee0('0x3a')](_0x34ae92[_0x8ee0('0x38')],{'$or':_['map'](_0x538bd7,function(_0x29701f){if(_0x29701f['type']!==_0x8ee0('0x3b')){var _0x14439b={};_0x14439b[_0x29701f['name']]={'$like':'%'+_0x4d8021[_0x8ee0('0x2f')]['filter']+'%'};return _0x14439b;}})});}_0x34ae92=_['merge']({},_0x34ae92,_0x4d8021[_0x8ee0('0x3c')]);var _0x63323d={'where':_0x34ae92[_0x8ee0('0x38')]};return db[_0x8ee0('0x2c')][_0x8ee0('0x1e')](_0x63323d)['then'](function(_0x4c153c){_0x34b02c[_0x8ee0('0x1e')]=_0x4c153c;if(_0x4d8021['query'][_0x8ee0('0x3d')]){_0x34ae92[_0x8ee0('0x3e')]=[{'all':!![]}];}return db['ZohoField'][_0x8ee0('0x3f')](_0x34ae92);})[_0x8ee0('0x25')](function(_0x5bb2c2){_0x34b02c[_0x8ee0('0x40')]=_0x5bb2c2;return _0x34b02c;})['then'](respondWithFilteredResult(_0x3db629,_0x34ae92))['catch'](handleError(_0x3db629,null));};exports[_0x8ee0('0x41')]=function(_0x973e6a,_0x4dd4e5){var _0x351341={'raw':!![],'where':{'id':_0x973e6a['params']['id']}},_0x1280ed={};_0x1280ed[_0x8ee0('0x2e')]=_[_0x8ee0('0x30')](db[_0x8ee0('0x2c')]['rawAttributes']);_0x1280ed['query']=_['keys'](_0x973e6a[_0x8ee0('0x2f')]);_0x1280ed['filters']=_['intersection'](_0x1280ed[_0x8ee0('0x2e')],_0x1280ed['query']);_0x351341[_0x8ee0('0x32')]=_[_0x8ee0('0x33')](_0x1280ed[_0x8ee0('0x2e')],qs[_0x8ee0('0x34')](_0x973e6a[_0x8ee0('0x2f')][_0x8ee0('0x34')]));_0x351341[_0x8ee0('0x32')]=_0x351341[_0x8ee0('0x32')][_0x8ee0('0x35')]?_0x351341['attributes']:_0x1280ed[_0x8ee0('0x2e')];if(_0x973e6a['query'][_0x8ee0('0x3d')]){_0x351341[_0x8ee0('0x3e')]=[{'all':!![]}];}_0x351341=_[_0x8ee0('0x3a')]({},_0x351341,_0x973e6a[_0x8ee0('0x3c')]);return db[_0x8ee0('0x2c')][_0x8ee0('0x42')](_0x351341)['then'](handleEntityNotFound(_0x4dd4e5,null))['then'](respondWithResult(_0x4dd4e5,null))[_0x8ee0('0x43')](handleError(_0x4dd4e5,null));};exports[_0x8ee0('0x44')]=function(_0x2e0d61,_0x54e509){return db[_0x8ee0('0x2c')][_0x8ee0('0x44')](_0x2e0d61[_0x8ee0('0x45')],{})[_0x8ee0('0x25')](respondWithResult(_0x54e509,0xc9))[_0x8ee0('0x43')](handleError(_0x54e509,null));};exports[_0x8ee0('0x24')]=function(_0x23efcb,_0x3b562e){if(_0x23efcb[_0x8ee0('0x45')]['id']){delete _0x23efcb[_0x8ee0('0x45')]['id'];}return db[_0x8ee0('0x2c')][_0x8ee0('0x42')]({'where':{'id':_0x23efcb['params']['id']}})[_0x8ee0('0x25')](handleEntityNotFound(_0x3b562e,null))[_0x8ee0('0x25')](saveUpdates(_0x23efcb['body'],null))[_0x8ee0('0x25')](respondWithResult(_0x3b562e,null))[_0x8ee0('0x43')](handleError(_0x3b562e,null));};exports[_0x8ee0('0x46')]=function(_0x565a62,_0x4aa5fa){return db['ZohoField'][_0x8ee0('0x42')]({'where':{'id':_0x565a62['params']['id']}})['then'](handleEntityNotFound(_0x4aa5fa,null))['then'](removeEntity(_0x4aa5fa,null))[_0x8ee0('0x43')](handleError(_0x4aa5fa,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 05f70f4..c662c51 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 _0xa456=['./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa456,0x142));var _0x6a45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa456[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var moment=require('moment');var BPromise=require(_0x6a45('0x4'));var rp=require(_0x6a45('0x5'));var fs=require('fs');var path=require(_0x6a45('0x6'));var rimraf=require('rimraf');var config=require(_0x6a45('0x7'));var attributes=require(_0x6a45('0x8'));module[_0x6a45('0x9')]=function(_0x14da6b,_0x4dfbfa){return _0x14da6b[_0x6a45('0xa')](_0x6a45('0xb'),attributes,{'tableName':_0x6a45('0xc'),'paranoid':![],'indexes':[{'name':_0x6a45('0xd'),'fields':[_0x6a45('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0x2542,0x169));var _0x2254=function(_0x23651c,_0x10a918){_0x23651c=_0x23651c-0x0;var _0x2b7bfd=_0x2542[_0x23651c];return _0x2b7bfd;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xe'),_0x2254('0xf')],'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 8f78d68..fdb2180 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 _0x383e=['util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x383e,0x179));var _0xe383=function(_0x2fc7ee,_0x1bb152){_0x2fc7ee=_0x2fc7ee-0x0;var _0x174721=_0x383e[_0x2fc7ee];return _0x174721;};'use strict';var _=require(_0xe383('0x0'));var util=require(_0xe383('0x1'));var moment=require('moment');var BPromise=require(_0xe383('0x2'));var rs=require(_0xe383('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe383('0x4'))['db'];var utils=require(_0xe383('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe383('0x6'));var client=jayson[_0xe383('0x7')][_0xe383('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe16d52,_0xded62,_0x39b513){return new BPromise(function(_0x4ae043,_0x5af014){return client[_0xe383('0x9')](_0xe16d52,_0x39b513)['then'](function(_0x3244e6){logger[_0xe383('0xa')](_0xe383('0xb'),_0xded62,_0xe383('0xc'));logger[_0xe383('0xd')](_0xe383('0xe'),_0xded62,_0xe383('0xc'),JSON[_0xe383('0xf')](_0x3244e6));if(_0x3244e6['error']){if(_0x3244e6[_0xe383('0x10')][_0xe383('0x11')]===0x1f4){logger[_0xe383('0x10')](_0xe383('0xb'),_0xded62,_0x3244e6[_0xe383('0x10')][_0xe383('0x12')]);return _0x5af014(_0x3244e6['error'][_0xe383('0x12')]);}logger[_0xe383('0x10')](_0xe383('0xb'),_0xded62,_0x3244e6[_0xe383('0x10')][_0xe383('0x12')]);return _0x4ae043(_0x3244e6[_0xe383('0x10')][_0xe383('0x12')]);}else{logger[_0xe383('0xa')](_0xe383('0xb'),_0xded62,_0xe383('0xc'));_0x4ae043(_0x3244e6[_0xe383('0x13')][_0xe383('0x12')]);}})[_0xe383('0x14')](function(_0x389583){logger[_0xe383('0x10')]('ZohoField,\x20%s,\x20%s',_0xded62,_0x389583);_0x5af014(_0x389583);});});} \ No newline at end of file +var _0x2b06=['request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2b06,0xc8));var _0x62b0=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0x2b06[_0x21a2b3];return _0x4651a7;};'use strict';var _=require(_0x62b0('0x0'));var util=require(_0x62b0('0x1'));var moment=require(_0x62b0('0x2'));var BPromise=require(_0x62b0('0x3'));var rs=require(_0x62b0('0x4'));var fs=require('fs');var Redis=require(_0x62b0('0x5'));var db=require(_0x62b0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x62b0('0x7'))('rpc');var config=require(_0x62b0('0x8'));var jayson=require(_0x62b0('0x9'));var client=jayson[_0x62b0('0xa')][_0x62b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ee48b,_0x471b02,_0x4ac54b){return new BPromise(function(_0x82a00a,_0x473ac0){return client[_0x62b0('0xc')](_0x5ee48b,_0x4ac54b)[_0x62b0('0xd')](function(_0x2c70cc){logger[_0x62b0('0xe')](_0x62b0('0xf'),_0x471b02,_0x62b0('0x10'));logger['debug'](_0x62b0('0x11'),_0x471b02,'request\x20sent',JSON[_0x62b0('0x12')](_0x2c70cc));if(_0x2c70cc[_0x62b0('0x13')]){if(_0x2c70cc[_0x62b0('0x13')][_0x62b0('0x14')]===0x1f4){logger[_0x62b0('0x13')]('ZohoField,\x20%s,\x20%s',_0x471b02,_0x2c70cc[_0x62b0('0x13')][_0x62b0('0x15')]);return _0x473ac0(_0x2c70cc['error'][_0x62b0('0x15')]);}logger[_0x62b0('0x13')](_0x62b0('0xf'),_0x471b02,_0x2c70cc[_0x62b0('0x13')][_0x62b0('0x15')]);return _0x82a00a(_0x2c70cc[_0x62b0('0x13')][_0x62b0('0x15')]);}else{logger[_0x62b0('0xe')]('ZohoField,\x20%s,\x20%s',_0x471b02,_0x62b0('0x10'));_0x82a00a(_0x2c70cc[_0x62b0('0x16')]['message']);}})[_0x62b0('0x17')](function(_0x481cbd){logger['error']('ZohoField,\x20%s,\x20%s',_0x471b02,_0x481cbd);_0x473ac0(_0x481cbd);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2264de7..cc24229 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x34b052,_0x351bc0){var _0x1517e0=function(_0x8c7285){while(--_0x8c7285){_0x34b052['push'](_0x34b052['shift']());}};_0x1517e0(++_0x351bc0);}(_0x70e0,0x17b));var _0x070e=function(_0x1df078,_0x1db734){_0x1df078=_0x1df078-0x0;var _0x263a11=_0x70e0[_0x1df078];return _0x263a11;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 80d1c6f..7dbb772 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 _0x0f61=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x1c136d,_0x2e043f){var _0x211115=function(_0x568341){while(--_0x568341){_0x1c136d['push'](_0x1c136d['shift']());}};_0x211115(++_0x2e043f);}(_0x0f61,0xa6));var _0x10f6=function(_0x19d3ae,_0x28de77){_0x19d3ae=_0x19d3ae-0x0;var _0x3f9ac2=_0x0f61[_0x19d3ae];return _0x3f9ac2;};'use strict';var Sequelize=require('sequelize');module[_0x10f6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x10f6('0x1')],'allowNull':![],'unique':_0x10f6('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x10f6('0x3')},'filename':{'type':Sequelize[_0x10f6('0x1')]},'path':{'type':Sequelize[_0x10f6('0x1')]},'type':{'type':Sequelize[_0x10f6('0x1')]},'size':{'type':Sequelize[_0x10f6('0x4')]},'active':{'type':Sequelize[_0x10f6('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x10f6('0x1')]},'logo':{'type':Sequelize[_0x10f6('0x1')]},'state':{'type':Sequelize[_0x10f6('0x1')],'unique':_0x10f6('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x10f6('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x10f6('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9400=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x5d79bf,_0x54ce0b){var _0x4d1060=function(_0x147bc1){while(--_0x147bc1){_0x5d79bf['push'](_0x5d79bf['shift']());}};_0x4d1060(++_0x54ce0b);}(_0x9400,0x12a));var _0x0940=function(_0x4ae6e3,_0x56882b){_0x4ae6e3=_0x4ae6e3-0x0;var _0xf8ab75=_0x9400[_0x4ae6e3];return _0xf8ab75;};'use strict';var Sequelize=require(_0x0940('0x0'));module[_0x0940('0x1')]={'name':{'type':Sequelize[_0x0940('0x2')],'allowNull':![],'unique':_0x0940('0x3')},'version':{'type':Sequelize[_0x0940('0x2')],'allowNull':![],'unique':_0x0940('0x3')},'main':{'type':Sequelize[_0x0940('0x2')],'defaultValue':_0x0940('0x4')},'filename':{'type':Sequelize[_0x0940('0x2')]},'path':{'type':Sequelize[_0x0940('0x2')]},'type':{'type':Sequelize[_0x0940('0x2')]},'size':{'type':Sequelize[_0x0940('0x5')]},'active':{'type':Sequelize[_0x0940('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x0940('0x2')]},'state':{'type':Sequelize[_0x0940('0x2')],'unique':_0x0940('0x7')},'description':{'type':Sequelize[_0x0940('0x2')]},'title':{'type':Sequelize[_0x0940('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0940('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0c6e4d1..0eba440 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Integration','fieldName','type','key'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xadb5,0xad));var _0x5adb=function(_0x220405,_0x2b9051){_0x220405=_0x220405-0x0;var _0x10fc74=_0xadb5[_0x220405];return _0x10fc74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['Integration']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0xe3da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x2a2808,_0x351560){var _0x2d2b2f=function(_0xc589bf){while(--_0xc589bf){_0x2a2808['push'](_0x2a2808['shift']());}};_0x2d2b2f(++_0x351560);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f7b419f..c2562d3 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 _0x904f=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./integration.attributes','define','Integration','integrations'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x904f,0x16b));var _0xf904=function(_0x352027,_0xab2d70){_0x352027=_0x352027-0x0;var _0x512181=_0x904f[_0x352027];return _0x512181;};'use strict';var _=require(_0xf904('0x0'));var util=require(_0xf904('0x1'));var logger=require(_0xf904('0x2'))(_0xf904('0x3'));var moment=require('moment');var BPromise=require(_0xf904('0x4'));var rp=require(_0xf904('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf904('0x6'));var attributes=require(_0xf904('0x7'));module['exports']=function(_0x560deb,_0x242812){return _0x560deb[_0xf904('0x8')](_0xf904('0x9'),attributes,{'tableName':_0xf904('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54d7=['../../config/environment','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x54d7,0x179));var _0x754d=function(_0x33bc7f,_0x4c8387){_0x33bc7f=_0x33bc7f-0x0;var _0x3edf6e=_0x54d7[_0x33bc7f];return _0x3edf6e;};'use strict';var _=require(_0x754d('0x0'));var util=require(_0x754d('0x1'));var logger=require(_0x754d('0x2'))('api');var moment=require(_0x754d('0x3'));var BPromise=require('bluebird');var rp=require(_0x754d('0x4'));var fs=require('fs');var path=require(_0x754d('0x5'));var rimraf=require(_0x754d('0x6'));var config=require(_0x754d('0x7'));var attributes=require(_0x754d('0x8'));module[_0x754d('0x9')]=function(_0x63e553,_0x292e0b){return _0x63e553[_0x754d('0xa')](_0x754d('0xb'),attributes,{'tableName':'integrations','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 3ef1349..a356f33 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0x524e,0x15e));var _0xe524=function(_0x522e68,_0x73fcb6){_0x522e68=_0x522e68-0x0;var _0x5adc77=_0x524e[_0x522e68];return _0x5adc77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0xc54fb,_0x4a79f3){var _0x1773c0=function(_0x3e0560){while(--_0x3e0560){_0xc54fb['push'](_0xc54fb['shift']());}};_0x1773c0(++_0x4a79f3);}(_0x1a85,0x178));var _0x51a8=function(_0x17cded,_0xa51b6b){_0x17cded=_0x17cded-0x0;var _0x41b11f=_0x1a85[_0x17cded];return _0x41b11f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1423042..5db492e 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d499a,_0x5b418d){_0x2d499a=_0x2d499a-0x0;var _0xd40101=_0x5f2f[_0x2d499a];return _0xd40101;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +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(_0x240ae3,_0x5c5c47){var _0x1d7590=function(_0x421298){while(--_0x421298){_0x240ae3['push'](_0x240ae3['shift']());}};_0x1d7590(++_0x5c5c47);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2d049b,_0x418b80){_0x2d049b=_0x2d049b-0x0;var _0x395e0b=_0xc2c7[_0x2d049b];return _0x395e0b;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 59acc76..49f3400 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 _0x390a=['SENT','SENDING','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x4b162f,_0x343248){var _0x504534=function(_0x222287){while(--_0x222287){_0x4b162f['push'](_0x4b162f['shift']());}};_0x504534(++_0x343248);}(_0x390a,0xbe));var _0xa390=function(_0x2992c9,_0x19341e){_0x2992c9=_0x2992c9-0x0;var _0x262cc6=_0x390a[_0x2992c9];return _0x262cc6;};'use strict';var Sequelize=require(_0xa390('0x0'));module[_0xa390('0x1')]={'integration':{'type':Sequelize[_0xa390('0x2')]},'eventChannel':{'type':Sequelize[_0xa390('0x2')]},'exitStatus':{'type':Sequelize[_0xa390('0x2')]},'ticketId':{'type':Sequelize[_0xa390('0x2')]},'integrationId':{'type':Sequelize[_0xa390('0x3')]},'contacts':{'type':Sequelize[_0xa390('0x2')]},'uniqueid':{'type':Sequelize[_0xa390('0x2')]},'calleridnum':{'type':Sequelize[_0xa390('0x2')]},'calleridname':{'type':Sequelize[_0xa390('0x2')]},'queue':{'type':Sequelize[_0xa390('0x2')]},'interface':{'type':Sequelize[_0xa390('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xa390('0x4')]},'agentconnectAt':{'type':Sequelize[_0xa390('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa390('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa390('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa390('0x3')]},'reason':{'type':Sequelize[_0xa390('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa390('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa390('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa390('0x4')]},'lastevent':{'type':Sequelize[_0xa390('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xa390('0x3')]},'channelstatedesc':{'type':Sequelize[_0xa390('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa390('0x2')]},'connectedlinename':{'type':Sequelize[_0xa390('0x2')]},'language':{'type':Sequelize[_0xa390('0x2')]},'accountcode':{'type':Sequelize[_0xa390('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa390('0x2')]},'priority':{'type':Sequelize[_0xa390('0x2')]},'destchannel':{'type':Sequelize[_0xa390('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa390('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa390('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa390('0x2')]},'destlanguage':{'type':Sequelize[_0xa390('0x2')]},'destaccountcode':{'type':Sequelize[_0xa390('0x2')]},'destcontext':{'type':Sequelize[_0xa390('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xa390('0x2')]},'inReplyTo':{'type':Sequelize[_0xa390('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xa390('0x2')]},'to':{'type':Sequelize[_0xa390('0x2')]},'cc':{'type':Sequelize[_0xa390('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xa390('0x6')]},'text':{'type':Sequelize[_0xa390('0x6')]},'status':{'type':Sequelize[_0xa390('0x7')](_0xa390('0x8'),_0xa390('0x9'),_0xa390('0xa'),'FAILED')},'url':{'type':Sequelize[_0xa390('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xa390('0x2')]},'projectId':{'type':Sequelize[_0xa390('0x3')]}}; \ No newline at end of file +var _0x6392=['RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x6392,0x85));var _0x2639=function(_0x59ef3d,_0x5c7aee){_0x59ef3d=_0x59ef3d-0x0;var _0x585558=_0x6392[_0x59ef3d];return _0x585558;};'use strict';var Sequelize=require(_0x2639('0x0'));module[_0x2639('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x2639('0x2')]},'exitStatus':{'type':Sequelize[_0x2639('0x2')]},'ticketId':{'type':Sequelize[_0x2639('0x2')]},'integrationId':{'type':Sequelize[_0x2639('0x3')]},'contacts':{'type':Sequelize[_0x2639('0x2')]},'uniqueid':{'type':Sequelize[_0x2639('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2639('0x2')]},'queue':{'type':Sequelize[_0x2639('0x2')]},'interface':{'type':Sequelize[_0x2639('0x2')]},'membername':{'type':Sequelize[_0x2639('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2639('0x4')]},'agentconnectAt':{'type':Sequelize[_0x2639('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2639('0x4')]},'talktime':{'type':Sequelize[_0x2639('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2639('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x2639('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2639('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2639('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2639('0x2')]},'channelstate':{'type':Sequelize[_0x2639('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2639('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2639('0x2')]},'connectedlinename':{'type':Sequelize[_0x2639('0x2')]},'language':{'type':Sequelize[_0x2639('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2639('0x2')]},'exten':{'type':Sequelize[_0x2639('0x2')]},'priority':{'type':Sequelize[_0x2639('0x2')]},'destchannel':{'type':Sequelize[_0x2639('0x2')]},'destchannelstate':{'type':Sequelize[_0x2639('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2639('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2639('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2639('0x2')]},'destlanguage':{'type':Sequelize[_0x2639('0x2')]},'destaccountcode':{'type':Sequelize[_0x2639('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2639('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2639('0x2')]},'messageId':{'type':Sequelize[_0x2639('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x2639('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2639('0x2')]},'cc':{'type':Sequelize[_0x2639('0x2')]},'attachment':{'type':Sequelize[_0x2639('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x2639('0x7')](_0x2639('0x8'),_0x2639('0x9'),_0x2639('0xa'),'FAILED')},'url':{'type':Sequelize[_0x2639('0x2')]},'app':{'type':Sequelize[_0x2639('0x2')]},'appdata':{'type':Sequelize[_0x2639('0x2')]},'projectId':{'type':Sequelize[_0x2639('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9eec7e7..e2f897b 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 _0xfda7=['map','keys','filters','model','attributes','intersection','query','fields','length','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','IntegrationReport','type','key'];(function(_0x23b727,_0x143870){var _0x127e4b=function(_0x5ee1a7){while(--_0x5ee1a7){_0x23b727['push'](_0x23b727['shift']());}};_0x127e4b(++_0x143870);}(_0xfda7,0x13d));var _0x7fda=function(_0x33f105,_0xd34aa6){_0x33f105=_0x33f105-0x0;var _0x1c24b0=_0xfda7[_0x33f105];return _0x1c24b0;};'use strict';var emlformat=require(_0x7fda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fda('0x1'));var jsonpatch=require(_0x7fda('0x2'));var rp=require('request-promise');var moment=require(_0x7fda('0x3'));var BPromise=require(_0x7fda('0x4'));var Mustache=require(_0x7fda('0x5'));var util=require(_0x7fda('0x6'));var path=require(_0x7fda('0x7'));var sox=require(_0x7fda('0x8'));var csv=require(_0x7fda('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fda('0xa'));var _=require(_0x7fda('0xb'));var squel=require(_0x7fda('0xc'));var crypto=require(_0x7fda('0xd'));var jsforce=require(_0x7fda('0xe'));var deskjs=require(_0x7fda('0xf'));var toCsv=require(_0x7fda('0x9'));var querystring=require(_0x7fda('0x10'));var Papa=require(_0x7fda('0x11'));var Redis=require(_0x7fda('0x12'));var authService=require(_0x7fda('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7fda('0x14'));var hardwareService=require(_0x7fda('0x15'));var logger=require('../../config/logger')(_0x7fda('0x16'));var utils=require(_0x7fda('0x17'));var config=require(_0x7fda('0x18'));var licenseUtil=require(_0x7fda('0x19'));var db=require(_0x7fda('0x1a'))['db'];function respondWithStatusCode(_0x1a909d,_0x48d484){_0x48d484=_0x48d484||0xcc;return function(_0x3c7662){if(_0x3c7662){return _0x1a909d[_0x7fda('0x1b')](_0x48d484);}return _0x1a909d[_0x7fda('0x1c')](_0x48d484)[_0x7fda('0x1d')]();};}function respondWithResult(_0x40ebd8,_0x31d442){_0x31d442=_0x31d442||0xc8;return function(_0x283796){if(_0x283796){return _0x40ebd8[_0x7fda('0x1c')](_0x31d442)[_0x7fda('0x1e')](_0x283796);}};}function respondWithFilteredResult(_0xd150ea,_0x50d112){return function(_0x2faa16){if(_0x2faa16){var _0x4ec81d=typeof _0x50d112[_0x7fda('0x1f')]==='undefined'&&typeof _0x50d112[_0x7fda('0x20')]===_0x7fda('0x21');var _0xa39355=_0x2faa16[_0x7fda('0x22')];var _0x1e69a4=_0x4ec81d?0x0:_0x50d112[_0x7fda('0x1f')];var _0x1513c0=_0x4ec81d?_0x2faa16['count']:_0x50d112[_0x7fda('0x1f')]+_0x50d112[_0x7fda('0x20')];var _0x2b9eb3;if(_0x1513c0>=_0xa39355){_0x1513c0=_0xa39355;_0x2b9eb3=0xc8;}else{_0x2b9eb3=0xce;}_0xd150ea[_0x7fda('0x1c')](_0x2b9eb3);return _0xd150ea[_0x7fda('0x23')](_0x7fda('0x24'),_0x1e69a4+'-'+_0x1513c0+'/'+_0xa39355)['json'](_0x2faa16);}return null;};}function patchUpdates(_0x363b38){return function(_0x1f4fa2){try{jsonpatch[_0x7fda('0x25')](_0x1f4fa2,_0x363b38,!![]);}catch(_0x2a1aae){return BPromise[_0x7fda('0x26')](_0x2a1aae);}return _0x1f4fa2['save']();};}function saveUpdates(_0xb399c4,_0x24599e){return function(_0xfa00c6){if(_0xfa00c6){return _0xfa00c6[_0x7fda('0x27')](_0xb399c4)[_0x7fda('0x28')](function(_0x4a70d1){return _0x4a70d1;});}return null;};}function removeEntity(_0x55de40,_0x3b2c4e){return function(_0x5cf472){if(_0x5cf472){return _0x5cf472[_0x7fda('0x29')]()[_0x7fda('0x28')](function(){_0x55de40['status'](0xcc)[_0x7fda('0x1d')]();});}};}function handleEntityNotFound(_0x2fc295,_0x5be3ea){return function(_0xca9fc){if(!_0xca9fc){_0x2fc295[_0x7fda('0x1b')](0x194);}return _0xca9fc;};}function handleError(_0x3ae7d1,_0x527a0f){_0x527a0f=_0x527a0f||0x1f4;return function(_0x21b8bc){logger[_0x7fda('0x2a')](_0x21b8bc['stack']);if(_0x21b8bc[_0x7fda('0x2b')]){delete _0x21b8bc[_0x7fda('0x2b')];}_0x3ae7d1['status'](_0x527a0f)[_0x7fda('0x2c')](_0x21b8bc);};}exports['index']=function(_0x20d629,_0x5991bc){var _0x2ddbcf={},_0x5214b5={},_0x457981={'count':0x0,'rows':[]};var _0x2f2025=_['map'](db[_0x7fda('0x2d')]['rawAttributes'],function(_0x2ba8c7){return{'name':_0x2ba8c7['fieldName'],'type':_0x2ba8c7[_0x7fda('0x2e')][_0x7fda('0x2f')]};});_0x5214b5['model']=_[_0x7fda('0x30')](_0x2f2025,'name');_0x5214b5['query']=_[_0x7fda('0x31')](_0x20d629['query']);_0x5214b5[_0x7fda('0x32')]=_['intersection'](_0x5214b5[_0x7fda('0x33')],_0x5214b5['query']);_0x2ddbcf[_0x7fda('0x34')]=_[_0x7fda('0x35')](_0x5214b5[_0x7fda('0x33')],qs['fields'](_0x20d629[_0x7fda('0x36')][_0x7fda('0x37')]));_0x2ddbcf[_0x7fda('0x34')]=_0x2ddbcf['attributes'][_0x7fda('0x38')]?_0x2ddbcf[_0x7fda('0x34')]:_0x5214b5[_0x7fda('0x33')];if(!_0x20d629['query']['hasOwnProperty'](_0x7fda('0x39'))){_0x2ddbcf[_0x7fda('0x20')]=qs[_0x7fda('0x20')](_0x20d629[_0x7fda('0x36')][_0x7fda('0x20')]);_0x2ddbcf[_0x7fda('0x1f')]=qs['offset'](_0x20d629[_0x7fda('0x36')][_0x7fda('0x1f')]);}_0x2ddbcf['order']=qs[_0x7fda('0x3a')](_0x20d629[_0x7fda('0x36')][_0x7fda('0x3a')]);_0x2ddbcf[_0x7fda('0x3b')]=qs[_0x7fda('0x32')](_['pick'](_0x20d629[_0x7fda('0x36')],_0x5214b5[_0x7fda('0x32')]),_0x2f2025);if(_0x20d629[_0x7fda('0x36')][_0x7fda('0x3c')]){_0x2ddbcf['where']=_[_0x7fda('0x3d')](_0x2ddbcf[_0x7fda('0x3b')],{'$or':_[_0x7fda('0x30')](_0x2f2025,function(_0x1b9fdf){if(_0x1b9fdf[_0x7fda('0x2e')]!=='VIRTUAL'){var _0x49e38a={};_0x49e38a[_0x1b9fdf[_0x7fda('0x2b')]]={'$like':'%'+_0x20d629[_0x7fda('0x36')]['filter']+'%'};return _0x49e38a;}})});}_0x2ddbcf=_[_0x7fda('0x3d')]({},_0x2ddbcf,_0x20d629[_0x7fda('0x3e')]);var _0x5689a9={'where':_0x2ddbcf[_0x7fda('0x3b')]};return db[_0x7fda('0x2d')][_0x7fda('0x22')](_0x5689a9)[_0x7fda('0x28')](function(_0x2897f8){_0x457981[_0x7fda('0x22')]=_0x2897f8;if(_0x20d629[_0x7fda('0x36')]['includeAll']){_0x2ddbcf[_0x7fda('0x3f')]=[{'all':!![]}];}return db[_0x7fda('0x2d')][_0x7fda('0x40')](_0x2ddbcf);})[_0x7fda('0x28')](function(_0x48eed3){_0x457981[_0x7fda('0x41')]=_0x48eed3;return _0x457981;})[_0x7fda('0x28')](respondWithFilteredResult(_0x5991bc,_0x2ddbcf))['catch'](handleError(_0x5991bc,null));};exports[_0x7fda('0x42')]=function(_0x1b0967,_0x383a56){var _0x33fb97={'raw':![],'where':{'id':_0x1b0967[_0x7fda('0x43')]['id']}},_0x369a48={};_0x369a48[_0x7fda('0x33')]=_[_0x7fda('0x31')](db[_0x7fda('0x2d')]['rawAttributes']);_0x369a48['query']=_[_0x7fda('0x31')](_0x1b0967[_0x7fda('0x36')]);_0x369a48[_0x7fda('0x32')]=_[_0x7fda('0x35')](_0x369a48[_0x7fda('0x33')],_0x369a48['query']);_0x33fb97[_0x7fda('0x34')]=_['intersection'](_0x369a48['model'],qs['fields'](_0x1b0967['query'][_0x7fda('0x37')]));_0x33fb97[_0x7fda('0x34')]=_0x33fb97[_0x7fda('0x34')][_0x7fda('0x38')]?_0x33fb97[_0x7fda('0x34')]:_0x369a48[_0x7fda('0x33')];if(_0x1b0967[_0x7fda('0x36')]['includeAll']){_0x33fb97['include']=[{'all':!![]}];}_0x33fb97=_[_0x7fda('0x3d')]({},_0x33fb97,_0x1b0967[_0x7fda('0x3e')]);return db[_0x7fda('0x2d')][_0x7fda('0x44')](_0x33fb97)[_0x7fda('0x28')](handleEntityNotFound(_0x383a56,null))[_0x7fda('0x28')](respondWithResult(_0x383a56,null))[_0x7fda('0x45')](handleError(_0x383a56,null));};exports[_0x7fda('0x46')]=function(_0x5b5a0a,_0x12cb3a){return db[_0x7fda('0x2d')]['create'](_0x5b5a0a[_0x7fda('0x47')],{})['then'](respondWithResult(_0x12cb3a,0xc9))['catch'](handleError(_0x12cb3a,null));};exports['update']=function(_0xd92a8a,_0x225ffc){if(_0xd92a8a[_0x7fda('0x47')]['id']){delete _0xd92a8a[_0x7fda('0x47')]['id'];}return db[_0x7fda('0x2d')][_0x7fda('0x44')]({'where':{'id':_0xd92a8a[_0x7fda('0x43')]['id']}})[_0x7fda('0x28')](handleEntityNotFound(_0x225ffc,null))['then'](saveUpdates(_0xd92a8a['body'],null))[_0x7fda('0x28')](respondWithResult(_0x225ffc,null))[_0x7fda('0x45')](handleError(_0x225ffc,null));};exports['destroy']=function(_0x4b362a,_0x272c26){return db[_0x7fda('0x2d')][_0x7fda('0x44')]({'where':{'id':_0x4b362a[_0x7fda('0x43')]['id']}})[_0x7fda('0x28')](handleEntityNotFound(_0x272c26,null))[_0x7fda('0x28')](removeEntity(_0x272c26,null))['catch'](handleError(_0x272c26,null));};exports[_0x7fda('0x48')]=function(_0x570ab1,_0x195ed1){return db[_0x7fda('0x2d')][_0x7fda('0x48')]()['then'](respondWithResult(_0x195ed1,null))['catch'](handleError(_0x195ed1,null));}; \ No newline at end of file +var _0xf3ed=['offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf3ed,0x1e2));var _0xdf3e=function(_0x2fd51d,_0x36e978){_0x2fd51d=_0x2fd51d-0x0;var _0x1f41d8=_0xf3ed[_0x2fd51d];return _0x1f41d8;};'use strict';var emlformat=require(_0xdf3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf3e('0x2'));var moment=require(_0xdf3e('0x3'));var BPromise=require(_0xdf3e('0x4'));var Mustache=require(_0xdf3e('0x5'));var util=require('util');var path=require(_0xdf3e('0x6'));var sox=require(_0xdf3e('0x7'));var csv=require(_0xdf3e('0x8'));var ejs=require(_0xdf3e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf3e('0xa'));var squel=require('squel');var crypto=require(_0xdf3e('0xb'));var jsforce=require(_0xdf3e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdf3e('0xd'));var Papa=require(_0xdf3e('0xe'));var Redis=require(_0xdf3e('0xf'));var authService=require(_0xdf3e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdf3e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf3e('0x12'));var utils=require(_0xdf3e('0x13'));var config=require(_0xdf3e('0x14'));var licenseUtil=require(_0xdf3e('0x15'));var db=require(_0xdf3e('0x16'))['db'];function respondWithStatusCode(_0x1ac300,_0x41a8d9){_0x41a8d9=_0x41a8d9||0xcc;return function(_0xc6854f){if(_0xc6854f){return _0x1ac300['sendStatus'](_0x41a8d9);}return _0x1ac300[_0xdf3e('0x17')](_0x41a8d9)[_0xdf3e('0x18')]();};}function respondWithResult(_0x1a5369,_0x13df5c){_0x13df5c=_0x13df5c||0xc8;return function(_0x57c860){if(_0x57c860){return _0x1a5369['status'](_0x13df5c)[_0xdf3e('0x19')](_0x57c860);}};}function respondWithFilteredResult(_0x270a74,_0x7a31a5){return function(_0x1bb54b){if(_0x1bb54b){var _0xfdf676=typeof _0x7a31a5['offset']===_0xdf3e('0x1a')&&typeof _0x7a31a5[_0xdf3e('0x1b')]===_0xdf3e('0x1a');var _0x19c49c=_0x1bb54b[_0xdf3e('0x1c')];var _0x5549de=_0xfdf676?0x0:_0x7a31a5[_0xdf3e('0x1d')];var _0x16e24a=_0xfdf676?_0x1bb54b['count']:_0x7a31a5['offset']+_0x7a31a5['limit'];var _0x1bf274;if(_0x16e24a>=_0x19c49c){_0x16e24a=_0x19c49c;_0x1bf274=0xc8;}else{_0x1bf274=0xce;}_0x270a74[_0xdf3e('0x17')](_0x1bf274);return _0x270a74[_0xdf3e('0x1e')](_0xdf3e('0x1f'),_0x5549de+'-'+_0x16e24a+'/'+_0x19c49c)['json'](_0x1bb54b);}return null;};}function patchUpdates(_0x1f2fd5){return function(_0x5d5554){try{jsonpatch[_0xdf3e('0x20')](_0x5d5554,_0x1f2fd5,!![]);}catch(_0x567d2b){return BPromise[_0xdf3e('0x21')](_0x567d2b);}return _0x5d5554[_0xdf3e('0x22')]();};}function saveUpdates(_0x53b1cd,_0x29f7ef){return function(_0x377258){if(_0x377258){return _0x377258[_0xdf3e('0x23')](_0x53b1cd)['then'](function(_0x4d1318){return _0x4d1318;});}return null;};}function removeEntity(_0x3a19ee,_0x2eb05a){return function(_0x1ea8fa){if(_0x1ea8fa){return _0x1ea8fa[_0xdf3e('0x24')]()[_0xdf3e('0x25')](function(){_0x3a19ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2414e8,_0x5d3bd0){return function(_0x40fd41){if(!_0x40fd41){_0x2414e8[_0xdf3e('0x26')](0x194);}return _0x40fd41;};}function handleError(_0x5bb68e,_0x2d7604){_0x2d7604=_0x2d7604||0x1f4;return function(_0x57d2eb){logger[_0xdf3e('0x27')](_0x57d2eb[_0xdf3e('0x28')]);if(_0x57d2eb['name']){delete _0x57d2eb['name'];}_0x5bb68e[_0xdf3e('0x17')](_0x2d7604)['send'](_0x57d2eb);};}exports['index']=function(_0x11de75,_0x7cb70d){var _0x267656={},_0x1c5291={},_0x4cb254={'count':0x0,'rows':[]};var _0x15d309=_['map'](db[_0xdf3e('0x29')][_0xdf3e('0x2a')],function(_0x540361){return{'name':_0x540361[_0xdf3e('0x2b')],'type':_0x540361[_0xdf3e('0x2c')][_0xdf3e('0x2d')]};});_0x1c5291[_0xdf3e('0x2e')]=_['map'](_0x15d309,_0xdf3e('0x2f'));_0x1c5291[_0xdf3e('0x30')]=_[_0xdf3e('0x31')](_0x11de75[_0xdf3e('0x30')]);_0x1c5291['filters']=_[_0xdf3e('0x32')](_0x1c5291[_0xdf3e('0x2e')],_0x1c5291['query']);_0x267656[_0xdf3e('0x33')]=_[_0xdf3e('0x32')](_0x1c5291[_0xdf3e('0x2e')],qs[_0xdf3e('0x34')](_0x11de75[_0xdf3e('0x30')][_0xdf3e('0x34')]));_0x267656[_0xdf3e('0x33')]=_0x267656[_0xdf3e('0x33')]['length']?_0x267656[_0xdf3e('0x33')]:_0x1c5291[_0xdf3e('0x2e')];if(!_0x11de75[_0xdf3e('0x30')]['hasOwnProperty'](_0xdf3e('0x35'))){_0x267656[_0xdf3e('0x1b')]=qs['limit'](_0x11de75['query'][_0xdf3e('0x1b')]);_0x267656[_0xdf3e('0x1d')]=qs[_0xdf3e('0x1d')](_0x11de75[_0xdf3e('0x30')]['offset']);}_0x267656[_0xdf3e('0x36')]=qs[_0xdf3e('0x37')](_0x11de75[_0xdf3e('0x30')][_0xdf3e('0x37')]);_0x267656[_0xdf3e('0x38')]=qs[_0xdf3e('0x39')](_[_0xdf3e('0x3a')](_0x11de75[_0xdf3e('0x30')],_0x1c5291['filters']),_0x15d309);if(_0x11de75['query'][_0xdf3e('0x3b')]){_0x267656[_0xdf3e('0x38')]=_[_0xdf3e('0x3c')](_0x267656['where'],{'$or':_['map'](_0x15d309,function(_0x5d6903){if(_0x5d6903[_0xdf3e('0x2c')]!==_0xdf3e('0x3d')){var _0xcb4c6={};_0xcb4c6[_0x5d6903[_0xdf3e('0x2f')]]={'$like':'%'+_0x11de75[_0xdf3e('0x30')]['filter']+'%'};return _0xcb4c6;}})});}_0x267656=_[_0xdf3e('0x3c')]({},_0x267656,_0x11de75[_0xdf3e('0x3e')]);var _0x47f95a={'where':_0x267656[_0xdf3e('0x38')]};return db[_0xdf3e('0x29')]['count'](_0x47f95a)[_0xdf3e('0x25')](function(_0x3893d9){_0x4cb254[_0xdf3e('0x1c')]=_0x3893d9;if(_0x11de75[_0xdf3e('0x30')][_0xdf3e('0x3f')]){_0x267656['include']=[{'all':!![]}];}return db[_0xdf3e('0x29')][_0xdf3e('0x40')](_0x267656);})[_0xdf3e('0x25')](function(_0x4c5643){_0x4cb254[_0xdf3e('0x41')]=_0x4c5643;return _0x4cb254;})[_0xdf3e('0x25')](respondWithFilteredResult(_0x7cb70d,_0x267656))[_0xdf3e('0x42')](handleError(_0x7cb70d,null));};exports[_0xdf3e('0x43')]=function(_0x14a1ae,_0x268fb7){var _0x36da06={'raw':![],'where':{'id':_0x14a1ae[_0xdf3e('0x44')]['id']}},_0x3eeb1d={};_0x3eeb1d[_0xdf3e('0x2e')]=_['keys'](db[_0xdf3e('0x29')][_0xdf3e('0x2a')]);_0x3eeb1d[_0xdf3e('0x30')]=_[_0xdf3e('0x31')](_0x14a1ae[_0xdf3e('0x30')]);_0x3eeb1d[_0xdf3e('0x39')]=_[_0xdf3e('0x32')](_0x3eeb1d[_0xdf3e('0x2e')],_0x3eeb1d[_0xdf3e('0x30')]);_0x36da06[_0xdf3e('0x33')]=_['intersection'](_0x3eeb1d[_0xdf3e('0x2e')],qs[_0xdf3e('0x34')](_0x14a1ae[_0xdf3e('0x30')][_0xdf3e('0x34')]));_0x36da06['attributes']=_0x36da06[_0xdf3e('0x33')]['length']?_0x36da06[_0xdf3e('0x33')]:_0x3eeb1d[_0xdf3e('0x2e')];if(_0x14a1ae[_0xdf3e('0x30')][_0xdf3e('0x3f')]){_0x36da06['include']=[{'all':!![]}];}_0x36da06=_[_0xdf3e('0x3c')]({},_0x36da06,_0x14a1ae['options']);return db['IntegrationReport'][_0xdf3e('0x45')](_0x36da06)[_0xdf3e('0x25')](handleEntityNotFound(_0x268fb7,null))['then'](respondWithResult(_0x268fb7,null))[_0xdf3e('0x42')](handleError(_0x268fb7,null));};exports[_0xdf3e('0x46')]=function(_0x56d11b,_0x125c90){return db['IntegrationReport']['create'](_0x56d11b[_0xdf3e('0x47')],{})[_0xdf3e('0x25')](respondWithResult(_0x125c90,0xc9))['catch'](handleError(_0x125c90,null));};exports[_0xdf3e('0x23')]=function(_0x1d4372,_0x42b44b){if(_0x1d4372[_0xdf3e('0x47')]['id']){delete _0x1d4372[_0xdf3e('0x47')]['id'];}return db[_0xdf3e('0x29')][_0xdf3e('0x45')]({'where':{'id':_0x1d4372['params']['id']}})[_0xdf3e('0x25')](handleEntityNotFound(_0x42b44b,null))[_0xdf3e('0x25')](saveUpdates(_0x1d4372[_0xdf3e('0x47')],null))[_0xdf3e('0x25')](respondWithResult(_0x42b44b,null))['catch'](handleError(_0x42b44b,null));};exports[_0xdf3e('0x24')]=function(_0x4ee59b,_0x2c35d7){return db[_0xdf3e('0x29')][_0xdf3e('0x45')]({'where':{'id':_0x4ee59b[_0xdf3e('0x44')]['id']}})[_0xdf3e('0x25')](handleEntityNotFound(_0x2c35d7,null))[_0xdf3e('0x25')](removeEntity(_0x2c35d7,null))[_0xdf3e('0x42')](handleError(_0x2c35d7,null));};exports[_0xdf3e('0x48')]=function(_0x14bffc,_0x107c58){return db[_0xdf3e('0x29')][_0xdf3e('0x48')]()[_0xdf3e('0x25')](respondWithResult(_0x107c58,null))[_0xdf3e('0x42')](handleError(_0x107c58,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index e72d73a..e177663 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 _0x45c8=['./integrationReport.attributes','exports','IntegrationReport','report_integration','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x27a426,_0x5a90a8){var _0x5e05cc=function(_0x732295){while(--_0x732295){_0x27a426['push'](_0x27a426['shift']());}};_0x5e05cc(++_0x5a90a8);}(_0x45c8,0xe5));var _0x845c=function(_0x545d90,_0x110599){_0x545d90=_0x545d90-0x0;var _0x4fee09=_0x45c8[_0x545d90];return _0x4fee09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x845c('0x0'))(_0x845c('0x1'));var moment=require(_0x845c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x845c('0x3'));var config=require(_0x845c('0x4'));var attributes=require(_0x845c('0x5'));module[_0x845c('0x6')]=function(_0x4587d7,_0x2f95ef){return _0x4587d7['define'](_0x845c('0x7'),attributes,{'tableName':_0x845c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd2=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3fa3ed,_0x3b81eb){var _0x4f538b=function(_0x47f66c){while(--_0x47f66c){_0x3fa3ed['push'](_0x3fa3ed['shift']());}};_0x4f538b(++_0x3b81eb);}(_0x1dd2,0x6d));var _0x21dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21dd('0x0'));var util=require(_0x21dd('0x1'));var logger=require(_0x21dd('0x2'))('api');var moment=require(_0x21dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x21dd('0x4'));var fs=require('fs');var path=require(_0x21dd('0x5'));var rimraf=require(_0x21dd('0x6'));var config=require(_0x21dd('0x7'));var attributes=require(_0x21dd('0x8'));module[_0x21dd('0x9')]=function(_0x3149ba,_0x329050){return _0x3149ba[_0x21dd('0xa')](_0x21dd('0xb'),attributes,{'tableName':_0x21dd('0xc'),'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 5c7f9fa..63ff4d1 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24b375,_0x1b45e6){var _0x3c9add=function(_0x58ea1b){while(--_0x58ea1b){_0x24b375['push'](_0x24b375['shift']());}};_0x3c9add(++_0x1b45e6);}(_0xda19,0xd5));var _0x9da1=function(_0x1819fe,_0x400990){_0x1819fe=_0x1819fe-0x0;var _0x57ce5b=_0xda19[_0x1819fe];return _0x57ce5b;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1ab3cc,_0x523ad7){_0x1ab3cc=_0x1ab3cc-0x0;var _0x3bc639=_0xc2c7[_0x1ab3cc];return _0x3bc639;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a7fa7ab..f0a9120 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 _0x960c=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2bbfda,_0x20229b){var _0x599c3a=function(_0x78e4eb){while(--_0x78e4eb){_0x2bbfda['push'](_0x2bbfda['shift']());}};_0x599c3a(++_0x20229b);}(_0x960c,0x113));var _0xc960=function(_0x55c845,_0xfe1405){_0x55c845=_0x55c845-0x0;var _0x5dff7c=_0x960c[_0x55c845];return _0x5dff7c;};'use strict';var multer=require(_0xc960('0x0'));var util=require('util');var path=require(_0xc960('0x1'));var timeout=require('connect-timeout');var express=require(_0xc960('0x2'));var router=express[_0xc960('0x3')]();var fs_extra=require(_0xc960('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc960('0x5'));var config=require(_0xc960('0x6'));var controller=require('./interval.controller');router['get']('/',auth[_0xc960('0x7')](),controller[_0xc960('0x8')]);router[_0xc960('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc960('0xa')]);router[_0xc960('0x9')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xc960('0xb')]);router[_0xc960('0xc')]('/',auth[_0xc960('0x7')](),controller[_0xc960('0xd')]);router[_0xc960('0xc')]('/:id/sub_intervals',auth[_0xc960('0x7')](),controller[_0xc960('0xe')]);router[_0xc960('0xc')](_0xc960('0xf'),auth[_0xc960('0x7')](),controller[_0xc960('0x10')]);router[_0xc960('0x11')](_0xc960('0x12'),auth[_0xc960('0x7')](),controller[_0xc960('0x13')]);router[_0xc960('0x14')]('/:id',auth[_0xc960('0x7')](),controller[_0xc960('0x15')]);module[_0xc960('0x16')]=router; \ No newline at end of file +var _0x3f1c=['get','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated'];(function(_0x9ff51,_0x4c951f){var _0x31959b=function(_0x350371){while(--_0x350371){_0x9ff51['push'](_0x9ff51['shift']());}};_0x31959b(++_0x4c951f);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x532a08,_0x1079ab){_0x532a08=_0x532a08-0x0;var _0xd9c5ee=_0x3f1c[_0x532a08];return _0xd9c5ee;};'use strict';var multer=require(_0xc3f1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc3f1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc3f1('0x2'));var auth=require(_0xc3f1('0x3'));var interaction=require(_0xc3f1('0x4'));var config=require(_0xc3f1('0x5'));var controller=require(_0xc3f1('0x6'));router['get']('/',auth[_0xc3f1('0x7')](),controller['index']);router[_0xc3f1('0x8')](_0xc3f1('0x9'),auth[_0xc3f1('0x7')](),controller['show']);router['get'](_0xc3f1('0xa'),auth['isAuthenticated'](),controller[_0xc3f1('0xb')]);router[_0xc3f1('0xc')]('/',auth[_0xc3f1('0x7')](),controller[_0xc3f1('0xd')]);router['post'](_0xc3f1('0xa'),auth['isAuthenticated'](),controller[_0xc3f1('0xe')]);router['post'](_0xc3f1('0xf'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xc3f1('0x10')](_0xc3f1('0x9'),auth[_0xc3f1('0x7')](),controller[_0xc3f1('0x11')]);router[_0xc3f1('0x12')](_0xc3f1('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xc3f1('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 4824992..d72686a 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 _0x9da8=['STRING','sequelize'];(function(_0x561457,_0xe737e9){var _0x2f6342=function(_0x56dd19){while(--_0x56dd19){_0x561457['push'](_0x561457['shift']());}};_0x2f6342(++_0xe737e9);}(_0x9da8,0x83));var _0x89da=function(_0x562d0d,_0x17705c){_0x562d0d=_0x562d0d-0x0;var _0x237f8e=_0x9da8[_0x562d0d];return _0x237f8e;};'use strict';var Sequelize=require(_0x89da('0x0'));module['exports']={'name':{'type':Sequelize[_0x89da('0x1')]},'description':{'type':Sequelize[_0x89da('0x1')]},'interval':{'type':Sequelize[_0x89da('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x40e1=['exports','STRING'];(function(_0x13fde9,_0x4b685d){var _0xbefcdc=function(_0x1a9bd4){while(--_0x1a9bd4){_0x13fde9['push'](_0x13fde9['shift']());}};_0xbefcdc(++_0x4b685d);}(_0x40e1,0x1b4));var _0x140e=function(_0x571edb,_0x5a648d){_0x571edb=_0x571edb-0x0;var _0x2a682e=_0x40e1[_0x571edb];return _0x2a682e;};'use strict';var Sequelize=require('sequelize');module[_0x140e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x140e('0x1')]},'interval':{'type':Sequelize[_0x140e('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 4188bc6..257bc0f 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 _0x9467=['IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','then','destroy','get','UserProfileResource','error','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Interval','includeAll','include','findAll','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Intervals','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body'];(function(_0x4da319,_0x3e7cfe){var _0x144e4e=function(_0x2716ae){while(--_0x2716ae){_0x4da319['push'](_0x4da319['shift']());}};_0x144e4e(++_0x3e7cfe);}(_0x9467,0xb7));var _0x7946=function(_0x8bd603,_0xf0161b){_0x8bd603=_0x8bd603-0x0;var _0x3bea9d=_0x9467[_0x8bd603];return _0x3bea9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7946('0x0'));var zipdir=require(_0x7946('0x1'));var jsonpatch=require(_0x7946('0x2'));var rp=require(_0x7946('0x3'));var moment=require(_0x7946('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7946('0x5'));var sox=require(_0x7946('0x6'));var csv=require(_0x7946('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7946('0x8'));var _=require(_0x7946('0x9'));var squel=require(_0x7946('0xa'));var crypto=require(_0x7946('0xb'));var jsforce=require(_0x7946('0xc'));var deskjs=require(_0x7946('0xd'));var toCsv=require(_0x7946('0x7'));var querystring=require('querystring');var Papa=require(_0x7946('0xe'));var Redis=require(_0x7946('0xf'));var authService=require(_0x7946('0x10'));var qs=require(_0x7946('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7946('0x12'));var logger=require(_0x7946('0x13'))(_0x7946('0x14'));var utils=require('../../config/utils');var config=require(_0x7946('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7946('0x16'))['db'];var extensions=require(_0x7946('0x17'));function respondWithStatusCode(_0x518775,_0x4da187){_0x4da187=_0x4da187||0xcc;return function(_0x112ccd){if(_0x112ccd){return _0x518775[_0x7946('0x18')](_0x4da187);}return _0x518775['status'](_0x4da187)[_0x7946('0x19')]();};}function respondWithResult(_0x410c6e,_0x1e827f){_0x1e827f=_0x1e827f||0xc8;return function(_0x520c39){if(_0x520c39){return _0x410c6e[_0x7946('0x1a')](_0x1e827f)[_0x7946('0x1b')](_0x520c39);}};}function respondWithFilteredResult(_0x56be6b,_0x1266cb){return function(_0x540d27){if(_0x540d27){var _0x42433b=typeof _0x1266cb['offset']===_0x7946('0x1c')&&typeof _0x1266cb[_0x7946('0x1d')]===_0x7946('0x1c');var _0x531fd9=_0x540d27['count'];var _0x499bee=_0x42433b?0x0:_0x1266cb[_0x7946('0x1e')];var _0x445084=_0x42433b?_0x540d27[_0x7946('0x1f')]:_0x1266cb[_0x7946('0x1e')]+_0x1266cb[_0x7946('0x1d')];var _0x5d8c53;if(_0x445084>=_0x531fd9){_0x445084=_0x531fd9;_0x5d8c53=0xc8;}else{_0x5d8c53=0xce;}_0x56be6b[_0x7946('0x1a')](_0x5d8c53);return _0x56be6b[_0x7946('0x20')](_0x7946('0x21'),_0x499bee+'-'+_0x445084+'/'+_0x531fd9)['json'](_0x540d27);}return null;};}function patchUpdates(_0x4a4528){return function(_0x448fb9){try{jsonpatch['apply'](_0x448fb9,_0x4a4528,!![]);}catch(_0x42cee9){return BPromise['reject'](_0x42cee9);}return _0x448fb9['save']();};}function saveUpdates(_0x2637da,_0x5f2632){return function(_0x592f9b){if(_0x592f9b){return _0x592f9b['update'](_0x2637da)[_0x7946('0x22')](function(_0x346c48){return _0x346c48;});}return null;};}function removeEntity(_0x10dec9,_0x4e0a07){return function(_0x2104e1){if(_0x2104e1){return _0x2104e1[_0x7946('0x23')]()[_0x7946('0x22')](function(){var _0x107499=_0x2104e1[_0x7946('0x24')]({'plain':!![]});var _0x2e2433='Intervals';return db[_0x7946('0x25')][_0x7946('0x23')]({'where':{'type':_0x2e2433,'resourceId':_0x107499['id']}})[_0x7946('0x22')](function(){return _0x2104e1;});})[_0x7946('0x22')](function(){_0x10dec9[_0x7946('0x1a')](0xcc)[_0x7946('0x19')]();});}};}function handleEntityNotFound(_0x12ef0d,_0x29963c){return function(_0x438730){if(!_0x438730){_0x12ef0d['sendStatus'](0x194);}return _0x438730;};}function handleError(_0x4586b2,_0x43ffab){_0x43ffab=_0x43ffab||0x1f4;return function(_0x289ded){logger[_0x7946('0x26')](_0x289ded['stack']);if(_0x289ded[_0x7946('0x27')]){delete _0x289ded[_0x7946('0x27')];}_0x4586b2[_0x7946('0x1a')](_0x43ffab)['send'](_0x289ded);};}exports[_0x7946('0x28')]=function(_0x5ec4bc,_0x44dc69){var _0xb7e5c0={},_0x2bfb53={},_0x2c9e3a={'count':0x0,'rows':[]};var _0x2e01bd=_['map'](db['Interval'][_0x7946('0x29')],function(_0x205c70){return{'name':_0x205c70[_0x7946('0x2a')],'type':_0x205c70[_0x7946('0x2b')][_0x7946('0x2c')]};});_0x2bfb53[_0x7946('0x2d')]=_[_0x7946('0x2e')](_0x2e01bd,_0x7946('0x27'));_0x2bfb53['query']=_[_0x7946('0x2f')](_0x5ec4bc[_0x7946('0x30')]);_0x2bfb53[_0x7946('0x31')]=_[_0x7946('0x32')](_0x2bfb53[_0x7946('0x2d')],_0x2bfb53[_0x7946('0x30')]);_0xb7e5c0['attributes']=_[_0x7946('0x32')](_0x2bfb53[_0x7946('0x2d')],qs[_0x7946('0x33')](_0x5ec4bc['query'][_0x7946('0x33')]));_0xb7e5c0[_0x7946('0x34')]=_0xb7e5c0['attributes'][_0x7946('0x35')]?_0xb7e5c0[_0x7946('0x34')]:_0x2bfb53[_0x7946('0x2d')];if(!_0x5ec4bc[_0x7946('0x30')][_0x7946('0x36')](_0x7946('0x37'))){_0xb7e5c0['limit']=qs['limit'](_0x5ec4bc[_0x7946('0x30')][_0x7946('0x1d')]);_0xb7e5c0[_0x7946('0x1e')]=qs[_0x7946('0x1e')](_0x5ec4bc[_0x7946('0x30')]['offset']);}_0xb7e5c0[_0x7946('0x38')]=qs['sort'](_0x5ec4bc[_0x7946('0x30')][_0x7946('0x39')]);_0xb7e5c0[_0x7946('0x3a')]=qs[_0x7946('0x31')](_[_0x7946('0x3b')](_0x5ec4bc[_0x7946('0x30')],_0x2bfb53[_0x7946('0x31')]),_0x2e01bd);if(_0x5ec4bc['query'][_0x7946('0x3c')]){_0xb7e5c0[_0x7946('0x3a')]=_[_0x7946('0x3d')](_0xb7e5c0[_0x7946('0x3a')],{'$or':_['map'](_0x2e01bd,function(_0x535bd2){if(_0x535bd2[_0x7946('0x2b')]!==_0x7946('0x3e')){var _0x243b0b={};_0x243b0b[_0x535bd2[_0x7946('0x27')]]={'$like':'%'+_0x5ec4bc[_0x7946('0x30')][_0x7946('0x3c')]+'%'};return _0x243b0b;}})});}_0xb7e5c0=_[_0x7946('0x3d')]({},_0xb7e5c0,_0x5ec4bc[_0x7946('0x3f')]);var _0x5d31aa={'where':_0xb7e5c0[_0x7946('0x3a')]};return db[_0x7946('0x40')][_0x7946('0x1f')](_0x5d31aa)[_0x7946('0x22')](function(_0x28ade8){_0x2c9e3a['count']=_0x28ade8;if(_0x5ec4bc[_0x7946('0x30')][_0x7946('0x41')]){_0xb7e5c0[_0x7946('0x42')]=[{'all':!![]}];}return db[_0x7946('0x40')][_0x7946('0x43')](_0xb7e5c0);})[_0x7946('0x22')](function(_0x336c51){_0x2c9e3a['rows']=_0x336c51;return _0x2c9e3a;})['then'](respondWithFilteredResult(_0x44dc69,_0xb7e5c0))['catch'](handleError(_0x44dc69,null));};exports[_0x7946('0x44')]=function(_0x1ffca2,_0x580a44){var _0x11dbeb={'raw':!![],'where':{'id':_0x1ffca2[_0x7946('0x45')]['id']}},_0xf4aa74={};_0xf4aa74[_0x7946('0x2d')]=_[_0x7946('0x2f')](db[_0x7946('0x40')][_0x7946('0x29')]);_0xf4aa74[_0x7946('0x30')]=_[_0x7946('0x2f')](_0x1ffca2[_0x7946('0x30')]);_0xf4aa74['filters']=_['intersection'](_0xf4aa74[_0x7946('0x2d')],_0xf4aa74[_0x7946('0x30')]);_0x11dbeb[_0x7946('0x34')]=_[_0x7946('0x32')](_0xf4aa74[_0x7946('0x2d')],qs[_0x7946('0x33')](_0x1ffca2['query']['fields']));_0x11dbeb[_0x7946('0x34')]=_0x11dbeb[_0x7946('0x34')][_0x7946('0x35')]?_0x11dbeb['attributes']:_0xf4aa74[_0x7946('0x2d')];if(_0x1ffca2['query']['includeAll']){_0x11dbeb[_0x7946('0x42')]=[{'all':!![]}];}_0x11dbeb=_[_0x7946('0x3d')]({},_0x11dbeb,_0x1ffca2['options']);return db[_0x7946('0x40')][_0x7946('0x46')](_0x11dbeb)[_0x7946('0x22')](handleEntityNotFound(_0x580a44,null))[_0x7946('0x22')](respondWithResult(_0x580a44,null))['catch'](handleError(_0x580a44,null));};exports['create']=function(_0x287526,_0x5eed7c){return db['Interval'][_0x7946('0x47')](_0x287526['body'],{})[_0x7946('0x22')](function(_0x15be66){var _0xa7a491=_0x287526['user']['get']({'plain':!![]});if(!_0xa7a491)throw new Error(_0x7946('0x48'));if(_0xa7a491['role']===_0x7946('0x49')){var _0x55fc44=_0x15be66[_0x7946('0x24')]({'plain':!![]});var _0x1bd3b5=_0x7946('0x4a');return db[_0x7946('0x4b')][_0x7946('0x46')]({'where':{'name':_0x1bd3b5,'userProfileId':_0xa7a491[_0x7946('0x4c')]},'raw':!![]})[_0x7946('0x22')](function(_0x9e9711){if(_0x9e9711&&_0x9e9711['autoAssociation']===0x0){return db[_0x7946('0x25')][_0x7946('0x47')]({'name':_0x55fc44[_0x7946('0x27')],'resourceId':_0x55fc44['id'],'type':_0x9e9711['name'],'sectionId':_0x9e9711['id']},{})[_0x7946('0x22')](function(){return _0x15be66;});}else{return _0x15be66;}})[_0x7946('0x4d')](function(_0x401266){logger['error'](_0x7946('0x4e'),_0x401266);throw _0x401266;});}return _0x15be66;})[_0x7946('0x22')](respondWithResult(_0x5eed7c,0xc9))['catch'](handleError(_0x5eed7c,null));};exports[_0x7946('0x4f')]=function(_0x5c8287,_0xaec39e){if(_0x5c8287[_0x7946('0x50')]['id']){delete _0x5c8287[_0x7946('0x50')]['id'];}return db['Interval'][_0x7946('0x46')]({'where':{'id':_0x5c8287['params']['id']}})[_0x7946('0x22')](handleEntityNotFound(_0xaec39e,null))[_0x7946('0x22')](saveUpdates(_0x5c8287['body'],null))[_0x7946('0x22')](respondWithResult(_0xaec39e,null))[_0x7946('0x4d')](handleError(_0xaec39e,null));};exports[_0x7946('0x23')]=function(_0x158732,_0x138903){return db['Interval'][_0x7946('0x46')]({'where':{'id':_0x158732[_0x7946('0x45')]['id']}})[_0x7946('0x22')](handleEntityNotFound(_0x138903,null))[_0x7946('0x22')](removeEntity(_0x138903,null))[_0x7946('0x4d')](handleError(_0x138903,null));};exports['addInterval']=function(_0x28b64a,_0x2854d6,_0x756726){if(_0x28b64a[_0x7946('0x50')]['id']){delete _0x28b64a[_0x7946('0x50')]['id'];}return db[_0x7946('0x40')]['find']({'where':{'id':_0x28b64a[_0x7946('0x45')]['id']}})[_0x7946('0x22')](handleEntityNotFound(_0x2854d6,null))['then'](function(_0x3085fe){if(_0x3085fe){_0x28b64a['body'][_0x7946('0x51')]=_0x3085fe['id'];return db[_0x7946('0x40')][_0x7946('0x47')](_0x28b64a[_0x7946('0x50')]);}})[_0x7946('0x22')](respondWithResult(_0x2854d6,null))[_0x7946('0x4d')](handleError(_0x2854d6,null));};exports[_0x7946('0x52')]=function(_0x328311,_0x194dd4,_0xeb6316){var _0x8accf6={};var _0x1ddef1={};var _0x45c9e6;var _0x5d1d78;return db[_0x7946('0x40')]['findOne']({'where':{'id':_0x328311[_0x7946('0x45')]['id']}})['then'](handleEntityNotFound(_0x194dd4,null))['then'](function(_0x476bb4){if(_0x476bb4){_0x45c9e6=_0x476bb4;_0x1ddef1[_0x7946('0x2d')]=_[_0x7946('0x2f')](db[_0x7946('0x40')][_0x7946('0x29')]);_0x1ddef1[_0x7946('0x30')]=_['keys'](_0x328311[_0x7946('0x30')]);_0x1ddef1[_0x7946('0x31')]=_[_0x7946('0x32')](_0x1ddef1[_0x7946('0x2d')],_0x1ddef1[_0x7946('0x30')]);_0x8accf6[_0x7946('0x34')]=_['intersection'](_0x1ddef1['model'],qs['fields'](_0x328311[_0x7946('0x30')][_0x7946('0x33')]));_0x8accf6[_0x7946('0x34')]=_0x8accf6[_0x7946('0x34')][_0x7946('0x35')]?_0x8accf6[_0x7946('0x34')]:_0x1ddef1['model'];_0x8accf6[_0x7946('0x38')]=qs['sort'](_0x328311[_0x7946('0x30')]['sort']);_0x8accf6[_0x7946('0x3a')]=qs[_0x7946('0x31')](_[_0x7946('0x3b')](_0x328311[_0x7946('0x30')],_0x1ddef1[_0x7946('0x31')]));if(_0x328311[_0x7946('0x30')]['filter']){_0x8accf6[_0x7946('0x3a')]=_[_0x7946('0x3d')](_0x8accf6[_0x7946('0x3a')],{'$or':_['map'](_0x8accf6[_0x7946('0x34')],function(_0x5da525){var _0x11cac4={};_0x11cac4[_0x5da525]={'$like':'%'+_0x328311[_0x7946('0x30')][_0x7946('0x3c')]+'%'};return _0x11cac4;})});}_0x8accf6=_['merge']({},_0x8accf6,_0x328311[_0x7946('0x3f')]);return _0x45c9e6[_0x7946('0x52')](_0x8accf6);}})[_0x7946('0x22')](function(_0x29a9fa){if(_0x29a9fa){_0x5d1d78=_0x29a9fa['length'];if(!_0x328311['query'][_0x7946('0x36')]('nolimit')){_0x8accf6[_0x7946('0x1d')]=qs[_0x7946('0x1d')](_0x328311[_0x7946('0x30')][_0x7946('0x1d')]);_0x8accf6['offset']=qs[_0x7946('0x1e')](_0x328311[_0x7946('0x30')][_0x7946('0x1e')]);}return _0x45c9e6[_0x7946('0x52')](_0x8accf6);}})['then'](function(_0x1380f4){if(_0x1380f4){return _0x1380f4?{'count':_0x5d1d78,'rows':_0x1380f4}:null;}})[_0x7946('0x22')](respondWithResult(_0x194dd4,null))[_0x7946('0x4d')](handleError(_0x194dd4,null));};exports[_0x7946('0x53')]=function(_0x514cbb,_0x2b687c,_0x160105){return db[_0x7946('0x40')][_0x7946('0x54')]({'where':{'id':_0x514cbb[_0x7946('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b687c,null))[_0x7946('0x22')](function(_0x241e4f){if(_0x241e4f){return db[_0x7946('0x55')][_0x7946('0x56')](function(_0x424c67){return db[_0x7946('0x40')]['destroy']({'where':{'IntervalId':_0x514cbb[_0x7946('0x45')]['id']},'transaction':_0x424c67})['then'](function(_0x1e2139){var _0x484abc=_[_0x7946('0x2e')](_0x514cbb[_0x7946('0x50')],function(_0x1de83b){delete _0x1de83b['id'];_0x1de83b[_0x7946('0x51')]=_0x514cbb[_0x7946('0x45')]['id'];return _0x1de83b;});return db[_0x7946('0x40')][_0x7946('0x57')](_0x484abc,{'transaction':_0x424c67});});})['then'](function(){return db[_0x7946('0x40')][_0x7946('0x43')]({'where':{'IntervalId':_0x514cbb[_0x7946('0x45')]['id']}});});}})['then'](respondWithResult(_0x2b687c,null))[_0x7946('0x4d')](handleError(_0x2b687c,null));}; \ No newline at end of file +var _0xf2db=['params','length','create','body','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0xf2db,0x128));var _0xbf2d=function(_0x170f0c,_0x12a10e){_0x170f0c=_0x170f0c-0x0;var _0x52eba8=_0xf2db[_0x170f0c];return _0x52eba8;};'use strict';var emlformat=require(_0xbf2d('0x0'));var rimraf=require(_0xbf2d('0x1'));var zipdir=require(_0xbf2d('0x2'));var jsonpatch=require(_0xbf2d('0x3'));var rp=require(_0xbf2d('0x4'));var moment=require(_0xbf2d('0x5'));var BPromise=require(_0xbf2d('0x6'));var Mustache=require(_0xbf2d('0x7'));var util=require(_0xbf2d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbf2d('0x9'));var ejs=require(_0xbf2d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf2d('0xb'));var squel=require(_0xbf2d('0xc'));var crypto=require(_0xbf2d('0xd'));var jsforce=require(_0xbf2d('0xe'));var deskjs=require(_0xbf2d('0xf'));var toCsv=require(_0xbf2d('0x9'));var querystring=require(_0xbf2d('0x10'));var Papa=require(_0xbf2d('0x11'));var Redis=require('ioredis');var authService=require(_0xbf2d('0x12'));var qs=require(_0xbf2d('0x13'));var as=require(_0xbf2d('0x14'));var hardwareService=require(_0xbf2d('0x15'));var logger=require(_0xbf2d('0x16'))(_0xbf2d('0x17'));var utils=require(_0xbf2d('0x18'));var config=require(_0xbf2d('0x19'));var licenseUtil=require(_0xbf2d('0x1a'));var db=require(_0xbf2d('0x1b'))['db'];var extensions=require(_0xbf2d('0x1c'));function respondWithStatusCode(_0x2a08a7,_0x497203){_0x497203=_0x497203||0xcc;return function(_0x3f806d){if(_0x3f806d){return _0x2a08a7[_0xbf2d('0x1d')](_0x497203);}return _0x2a08a7[_0xbf2d('0x1e')](_0x497203)[_0xbf2d('0x1f')]();};}function respondWithResult(_0x37da26,_0x2471c5){_0x2471c5=_0x2471c5||0xc8;return function(_0x1e2fb5){if(_0x1e2fb5){return _0x37da26[_0xbf2d('0x1e')](_0x2471c5)[_0xbf2d('0x20')](_0x1e2fb5);}};}function respondWithFilteredResult(_0xeb7cf2,_0x5bfd18){return function(_0x493d67){if(_0x493d67){var _0x4b7d64=typeof _0x5bfd18[_0xbf2d('0x21')]==='undefined'&&typeof _0x5bfd18['limit']===_0xbf2d('0x22');var _0x1ec67a=_0x493d67[_0xbf2d('0x23')];var _0x3adbf5=_0x4b7d64?0x0:_0x5bfd18[_0xbf2d('0x21')];var _0x3c6f10=_0x4b7d64?_0x493d67['count']:_0x5bfd18['offset']+_0x5bfd18[_0xbf2d('0x24')];var _0x17233a;if(_0x3c6f10>=_0x1ec67a){_0x3c6f10=_0x1ec67a;_0x17233a=0xc8;}else{_0x17233a=0xce;}_0xeb7cf2[_0xbf2d('0x1e')](_0x17233a);return _0xeb7cf2[_0xbf2d('0x25')]('Content-Range',_0x3adbf5+'-'+_0x3c6f10+'/'+_0x1ec67a)[_0xbf2d('0x20')](_0x493d67);}return null;};}function patchUpdates(_0x122709){return function(_0x59a863){try{jsonpatch[_0xbf2d('0x26')](_0x59a863,_0x122709,!![]);}catch(_0xf22f06){return BPromise['reject'](_0xf22f06);}return _0x59a863['save']();};}function saveUpdates(_0x386639,_0x56ade6){return function(_0x568070){if(_0x568070){return _0x568070[_0xbf2d('0x27')](_0x386639)['then'](function(_0x26e4e0){return _0x26e4e0;});}return null;};}function removeEntity(_0x16a275,_0x3211e1){return function(_0x1df1de){if(_0x1df1de){return _0x1df1de['destroy']()[_0xbf2d('0x28')](function(){var _0x53dad6=_0x1df1de[_0xbf2d('0x29')]({'plain':!![]});var _0x20be8f=_0xbf2d('0x2a');return db[_0xbf2d('0x2b')][_0xbf2d('0x2c')]({'where':{'type':_0x20be8f,'resourceId':_0x53dad6['id']}})['then'](function(){return _0x1df1de;});})[_0xbf2d('0x28')](function(){_0x16a275[_0xbf2d('0x1e')](0xcc)[_0xbf2d('0x1f')]();});}};}function handleEntityNotFound(_0x85d871,_0x5aaa1f){return function(_0x1535b2){if(!_0x1535b2){_0x85d871['sendStatus'](0x194);}return _0x1535b2;};}function handleError(_0x180f35,_0x23efea){_0x23efea=_0x23efea||0x1f4;return function(_0x1d30af){logger[_0xbf2d('0x2d')](_0x1d30af[_0xbf2d('0x2e')]);if(_0x1d30af[_0xbf2d('0x2f')]){delete _0x1d30af[_0xbf2d('0x2f')];}_0x180f35[_0xbf2d('0x1e')](_0x23efea)[_0xbf2d('0x30')](_0x1d30af);};}exports[_0xbf2d('0x31')]=function(_0x8d17b6,_0x51324e){var _0x44e16e={},_0x203f11={},_0x3ec09f={'count':0x0,'rows':[]};var _0x28d3f6=_[_0xbf2d('0x32')](db[_0xbf2d('0x33')][_0xbf2d('0x34')],function(_0x3d5d48){return{'name':_0x3d5d48[_0xbf2d('0x35')],'type':_0x3d5d48['type'][_0xbf2d('0x36')]};});_0x203f11[_0xbf2d('0x37')]=_[_0xbf2d('0x32')](_0x28d3f6,'name');_0x203f11[_0xbf2d('0x38')]=_[_0xbf2d('0x39')](_0x8d17b6[_0xbf2d('0x38')]);_0x203f11[_0xbf2d('0x3a')]=_[_0xbf2d('0x3b')](_0x203f11[_0xbf2d('0x37')],_0x203f11[_0xbf2d('0x38')]);_0x44e16e[_0xbf2d('0x3c')]=_[_0xbf2d('0x3b')](_0x203f11['model'],qs[_0xbf2d('0x3d')](_0x8d17b6[_0xbf2d('0x38')][_0xbf2d('0x3d')]));_0x44e16e[_0xbf2d('0x3c')]=_0x44e16e[_0xbf2d('0x3c')]['length']?_0x44e16e[_0xbf2d('0x3c')]:_0x203f11[_0xbf2d('0x37')];if(!_0x8d17b6[_0xbf2d('0x38')]['hasOwnProperty'](_0xbf2d('0x3e'))){_0x44e16e[_0xbf2d('0x24')]=qs[_0xbf2d('0x24')](_0x8d17b6[_0xbf2d('0x38')][_0xbf2d('0x24')]);_0x44e16e[_0xbf2d('0x21')]=qs[_0xbf2d('0x21')](_0x8d17b6[_0xbf2d('0x38')][_0xbf2d('0x21')]);}_0x44e16e[_0xbf2d('0x3f')]=qs[_0xbf2d('0x40')](_0x8d17b6[_0xbf2d('0x38')][_0xbf2d('0x40')]);_0x44e16e[_0xbf2d('0x41')]=qs[_0xbf2d('0x3a')](_['pick'](_0x8d17b6['query'],_0x203f11['filters']),_0x28d3f6);if(_0x8d17b6['query'][_0xbf2d('0x42')]){_0x44e16e[_0xbf2d('0x41')]=_[_0xbf2d('0x43')](_0x44e16e['where'],{'$or':_[_0xbf2d('0x32')](_0x28d3f6,function(_0x586b9d){if(_0x586b9d[_0xbf2d('0x44')]!==_0xbf2d('0x45')){var _0xb34d91={};_0xb34d91[_0x586b9d['name']]={'$like':'%'+_0x8d17b6[_0xbf2d('0x38')][_0xbf2d('0x42')]+'%'};return _0xb34d91;}})});}_0x44e16e=_[_0xbf2d('0x43')]({},_0x44e16e,_0x8d17b6[_0xbf2d('0x46')]);var _0x41a2fc={'where':_0x44e16e[_0xbf2d('0x41')]};return db[_0xbf2d('0x33')]['count'](_0x41a2fc)[_0xbf2d('0x28')](function(_0x2cb365){_0x3ec09f[_0xbf2d('0x23')]=_0x2cb365;if(_0x8d17b6['query'][_0xbf2d('0x47')]){_0x44e16e[_0xbf2d('0x48')]=[{'all':!![]}];}return db[_0xbf2d('0x33')]['findAll'](_0x44e16e);})[_0xbf2d('0x28')](function(_0x41e7e7){_0x3ec09f[_0xbf2d('0x49')]=_0x41e7e7;return _0x3ec09f;})[_0xbf2d('0x28')](respondWithFilteredResult(_0x51324e,_0x44e16e))[_0xbf2d('0x4a')](handleError(_0x51324e,null));};exports[_0xbf2d('0x4b')]=function(_0xa2b5dd,_0x3dc0ea){var _0x4dc01c={'raw':!![],'where':{'id':_0xa2b5dd[_0xbf2d('0x4c')]['id']}},_0x98269={};_0x98269[_0xbf2d('0x37')]=_[_0xbf2d('0x39')](db[_0xbf2d('0x33')][_0xbf2d('0x34')]);_0x98269[_0xbf2d('0x38')]=_[_0xbf2d('0x39')](_0xa2b5dd['query']);_0x98269[_0xbf2d('0x3a')]=_[_0xbf2d('0x3b')](_0x98269[_0xbf2d('0x37')],_0x98269[_0xbf2d('0x38')]);_0x4dc01c[_0xbf2d('0x3c')]=_[_0xbf2d('0x3b')](_0x98269[_0xbf2d('0x37')],qs[_0xbf2d('0x3d')](_0xa2b5dd[_0xbf2d('0x38')][_0xbf2d('0x3d')]));_0x4dc01c[_0xbf2d('0x3c')]=_0x4dc01c['attributes'][_0xbf2d('0x4d')]?_0x4dc01c[_0xbf2d('0x3c')]:_0x98269[_0xbf2d('0x37')];if(_0xa2b5dd[_0xbf2d('0x38')][_0xbf2d('0x47')]){_0x4dc01c['include']=[{'all':!![]}];}_0x4dc01c=_[_0xbf2d('0x43')]({},_0x4dc01c,_0xa2b5dd[_0xbf2d('0x46')]);return db[_0xbf2d('0x33')]['find'](_0x4dc01c)[_0xbf2d('0x28')](handleEntityNotFound(_0x3dc0ea,null))[_0xbf2d('0x28')](respondWithResult(_0x3dc0ea,null))[_0xbf2d('0x4a')](handleError(_0x3dc0ea,null));};exports['create']=function(_0x31ba68,_0x2ad275){return db[_0xbf2d('0x33')][_0xbf2d('0x4e')](_0x31ba68[_0xbf2d('0x4f')],{})['then'](function(_0x3dff51){var _0xaeb983=_0x31ba68['user'][_0xbf2d('0x29')]({'plain':!![]});if(!_0xaeb983)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaeb983['role']===_0xbf2d('0x50')){var _0x1bc31e=_0x3dff51[_0xbf2d('0x29')]({'plain':!![]});var _0x45df06='Intervals';return db[_0xbf2d('0x51')][_0xbf2d('0x52')]({'where':{'name':_0x45df06,'userProfileId':_0xaeb983['userProfileId']},'raw':!![]})[_0xbf2d('0x28')](function(_0xfb7437){if(_0xfb7437&&_0xfb7437['autoAssociation']===0x0){return db[_0xbf2d('0x2b')][_0xbf2d('0x4e')]({'name':_0x1bc31e[_0xbf2d('0x2f')],'resourceId':_0x1bc31e['id'],'type':_0xfb7437[_0xbf2d('0x2f')],'sectionId':_0xfb7437['id']},{})[_0xbf2d('0x28')](function(){return _0x3dff51;});}else{return _0x3dff51;}})[_0xbf2d('0x4a')](function(_0x350ff0){logger[_0xbf2d('0x2d')](_0xbf2d('0x53'),_0x350ff0);throw _0x350ff0;});}return _0x3dff51;})['then'](respondWithResult(_0x2ad275,0xc9))[_0xbf2d('0x4a')](handleError(_0x2ad275,null));};exports['update']=function(_0xb8e90c,_0x3747eb){if(_0xb8e90c['body']['id']){delete _0xb8e90c[_0xbf2d('0x4f')]['id'];}return db['Interval'][_0xbf2d('0x52')]({'where':{'id':_0xb8e90c[_0xbf2d('0x4c')]['id']}})[_0xbf2d('0x28')](handleEntityNotFound(_0x3747eb,null))[_0xbf2d('0x28')](saveUpdates(_0xb8e90c[_0xbf2d('0x4f')],null))['then'](respondWithResult(_0x3747eb,null))[_0xbf2d('0x4a')](handleError(_0x3747eb,null));};exports[_0xbf2d('0x2c')]=function(_0x11b073,_0x4191e4){return db[_0xbf2d('0x33')][_0xbf2d('0x52')]({'where':{'id':_0x11b073['params']['id']}})[_0xbf2d('0x28')](handleEntityNotFound(_0x4191e4,null))['then'](removeEntity(_0x4191e4,null))['catch'](handleError(_0x4191e4,null));};exports[_0xbf2d('0x54')]=function(_0x47c184,_0x57297c,_0x195211){if(_0x47c184[_0xbf2d('0x4f')]['id']){delete _0x47c184['body']['id'];}return db['Interval'][_0xbf2d('0x52')]({'where':{'id':_0x47c184['params']['id']}})[_0xbf2d('0x28')](handleEntityNotFound(_0x57297c,null))[_0xbf2d('0x28')](function(_0x1049d8){if(_0x1049d8){_0x47c184[_0xbf2d('0x4f')][_0xbf2d('0x55')]=_0x1049d8['id'];return db[_0xbf2d('0x33')][_0xbf2d('0x4e')](_0x47c184[_0xbf2d('0x4f')]);}})[_0xbf2d('0x28')](respondWithResult(_0x57297c,null))[_0xbf2d('0x4a')](handleError(_0x57297c,null));};exports[_0xbf2d('0x56')]=function(_0x15c2d7,_0x28a03b,_0x1a3935){var _0x32c6be={};var _0x5a0769={};var _0x4f051b;var _0xeadaf0;return db[_0xbf2d('0x33')][_0xbf2d('0x57')]({'where':{'id':_0x15c2d7[_0xbf2d('0x4c')]['id']}})[_0xbf2d('0x28')](handleEntityNotFound(_0x28a03b,null))[_0xbf2d('0x28')](function(_0x23b160){if(_0x23b160){_0x4f051b=_0x23b160;_0x5a0769[_0xbf2d('0x37')]=_[_0xbf2d('0x39')](db[_0xbf2d('0x33')][_0xbf2d('0x34')]);_0x5a0769[_0xbf2d('0x38')]=_[_0xbf2d('0x39')](_0x15c2d7['query']);_0x5a0769[_0xbf2d('0x3a')]=_['intersection'](_0x5a0769[_0xbf2d('0x37')],_0x5a0769[_0xbf2d('0x38')]);_0x32c6be['attributes']=_[_0xbf2d('0x3b')](_0x5a0769['model'],qs['fields'](_0x15c2d7[_0xbf2d('0x38')][_0xbf2d('0x3d')]));_0x32c6be[_0xbf2d('0x3c')]=_0x32c6be[_0xbf2d('0x3c')]['length']?_0x32c6be[_0xbf2d('0x3c')]:_0x5a0769[_0xbf2d('0x37')];_0x32c6be['order']=qs[_0xbf2d('0x40')](_0x15c2d7[_0xbf2d('0x38')][_0xbf2d('0x40')]);_0x32c6be['where']=qs[_0xbf2d('0x3a')](_['pick'](_0x15c2d7[_0xbf2d('0x38')],_0x5a0769[_0xbf2d('0x3a')]));if(_0x15c2d7[_0xbf2d('0x38')][_0xbf2d('0x42')]){_0x32c6be[_0xbf2d('0x41')]=_[_0xbf2d('0x43')](_0x32c6be['where'],{'$or':_[_0xbf2d('0x32')](_0x32c6be[_0xbf2d('0x3c')],function(_0x1cf7d5){var _0x3c8d6e={};_0x3c8d6e[_0x1cf7d5]={'$like':'%'+_0x15c2d7[_0xbf2d('0x38')][_0xbf2d('0x42')]+'%'};return _0x3c8d6e;})});}_0x32c6be=_['merge']({},_0x32c6be,_0x15c2d7[_0xbf2d('0x46')]);return _0x4f051b[_0xbf2d('0x56')](_0x32c6be);}})[_0xbf2d('0x28')](function(_0xf6f26d){if(_0xf6f26d){_0xeadaf0=_0xf6f26d[_0xbf2d('0x4d')];if(!_0x15c2d7[_0xbf2d('0x38')]['hasOwnProperty'](_0xbf2d('0x3e'))){_0x32c6be[_0xbf2d('0x24')]=qs[_0xbf2d('0x24')](_0x15c2d7[_0xbf2d('0x38')][_0xbf2d('0x24')]);_0x32c6be[_0xbf2d('0x21')]=qs['offset'](_0x15c2d7[_0xbf2d('0x38')][_0xbf2d('0x21')]);}return _0x4f051b[_0xbf2d('0x56')](_0x32c6be);}})[_0xbf2d('0x28')](function(_0x404f78){if(_0x404f78){return _0x404f78?{'count':_0xeadaf0,'rows':_0x404f78}:null;}})['then'](respondWithResult(_0x28a03b,null))[_0xbf2d('0x4a')](handleError(_0x28a03b,null));};exports[_0xbf2d('0x58')]=function(_0x8adec,_0x5833cb,_0x1fca77){return db[_0xbf2d('0x33')]['findOne']({'where':{'id':_0x8adec[_0xbf2d('0x4c')]['id']}})[_0xbf2d('0x28')](handleEntityNotFound(_0x5833cb,null))[_0xbf2d('0x28')](function(_0x5efc83){if(_0x5efc83){return db[_0xbf2d('0x59')][_0xbf2d('0x5a')](function(_0x335ab3){return db['Interval'][_0xbf2d('0x2c')]({'where':{'IntervalId':_0x8adec[_0xbf2d('0x4c')]['id']},'transaction':_0x335ab3})[_0xbf2d('0x28')](function(_0x124d5e){var _0x499f65=_[_0xbf2d('0x32')](_0x8adec['body'],function(_0x149d33){delete _0x149d33['id'];_0x149d33[_0xbf2d('0x55')]=_0x8adec[_0xbf2d('0x4c')]['id'];return _0x149d33;});return db[_0xbf2d('0x33')][_0xbf2d('0x5b')](_0x499f65,{'transaction':_0x335ab3});});})[_0xbf2d('0x28')](function(){return db[_0xbf2d('0x33')][_0xbf2d('0x5c')]({'where':{'IntervalId':_0x8adec[_0xbf2d('0x4c')]['id']}});});}})[_0xbf2d('0x28')](respondWithResult(_0x5833cb,null))[_0xbf2d('0x4a')](handleError(_0x5833cb,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bff79bb..f799e22 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 _0x1aa1=['then','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','define','Interval','tools_intervals','rewrite','interval','string','getIntervals'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0x1aa1,0x90));var _0x11aa=function(_0x33e05,_0x488982){_0x33e05=_0x33e05-0x0;var _0x4956d4=_0x1aa1[_0x33e05];return _0x4956d4;};'use strict';var attributes=require(_0x11aa('0x0'));var extensions=require(_0x11aa('0x1'));var iftime=require(_0x11aa('0x2'))['iftime'];module['exports']=function(_0x5d8d1a){return _0x5d8d1a[_0x11aa('0x3')](_0x11aa('0x4'),attributes,{'tableName':_0x11aa('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x538143){extensions[_0x11aa('0x6')](_0x5d8d1a,_0x538143);},'afterBulkCreate':function(_0x209e41,_0x11adde,_0x22375c){_0x22375c();extensions[_0x11aa('0x6')](_0x5d8d1a,_0x209e41[0x0]);},'afterUpdate':function(_0x4e5c2d){extensions[_0x11aa('0x6')](_0x5d8d1a,_0x4e5c2d);},'afterDestroy':function(_0x163aec){extensions[_0x11aa('0x6')](_0x5d8d1a,_0x163aec);}},'instanceMethods':{'ifTime':function(_0x27cf0a=undefined,_0x21f137=new Date()){if(typeof this[_0x11aa('0x7')]===_0x11aa('0x8')){return iftime(this[_0x11aa('0x7')],_0x27cf0a,_0x21f137);}else{return this[_0x11aa('0x9')]()[_0x11aa('0xa')](function(_0x3c9be9){return Promise['all'](_0x3c9be9[_0x11aa('0xb')](function(_0x1cb59c){return _0x1cb59c[_0x11aa('0xc')](_0x27cf0a,_0x21f137);}));})[_0x11aa('0xa')](function(_0x295021){return _0x295021[_0x11aa('0xd')](function(_0xc8c7da,_0x52ef12){return _0xc8c7da||_0x52ef12;},![]);});}}}});}; \ No newline at end of file +var _0xf46a=['string','getIntervals','all','map','ifTime','then','reduce','./interval.attributes','../../utils/iftime','exports','define','rewrite','interval'];(function(_0xa1e9a4,_0x30d157){var _0x3a7070=function(_0x52156f){while(--_0x52156f){_0xa1e9a4['push'](_0xa1e9a4['shift']());}};_0x3a7070(++_0x30d157);}(_0xf46a,0xfe));var _0xaf46=function(_0x1c086a,_0x454ce9){_0x1c086a=_0x1c086a-0x0;var _0x82a639=_0xf46a[_0x1c086a];return _0x82a639;};'use strict';var attributes=require(_0xaf46('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xaf46('0x1'))['iftime'];module[_0xaf46('0x2')]=function(_0x5778a7){return _0x5778a7[_0xaf46('0x3')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f3277){extensions[_0xaf46('0x4')](_0x5778a7,_0x4f3277);},'afterBulkCreate':function(_0x591535,_0x48d885,_0x3dda84){_0x3dda84();extensions[_0xaf46('0x4')](_0x5778a7,_0x591535[0x0]);},'afterUpdate':function(_0x34b567){extensions['rewrite'](_0x5778a7,_0x34b567);},'afterDestroy':function(_0xce334e){extensions['rewrite'](_0x5778a7,_0xce334e);}},'instanceMethods':{'ifTime':function(_0x20251b=undefined,_0x5bff78=new Date()){if(typeof this[_0xaf46('0x5')]===_0xaf46('0x6')){return iftime(this[_0xaf46('0x5')],_0x20251b,_0x5bff78);}else{return this[_0xaf46('0x7')]()['then'](function(_0x44b5a3){return Promise[_0xaf46('0x8')](_0x44b5a3[_0xaf46('0x9')](function(_0x220b13){return _0x220b13[_0xaf46('0xa')](_0x20251b,_0x5bff78);}));})[_0xaf46('0xb')](function(_0x5ca538){return _0x5ca538[_0xaf46('0xc')](function(_0x395040,_0x46440e){return _0x395040||_0x46440e;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c6b5037..5e46a3b 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 _0xdae0=['Iftime','resolve','isArray','IntervalIftime','util','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','error','message','ShowInterval','find','catch','all','ifTime','reduce','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','intervals','string','timezone','format'];(function(_0x24f151,_0x337581){var _0x25464c=function(_0x250df3){while(--_0x250df3){_0x24f151['push'](_0x24f151['shift']());}};_0x25464c(++_0x337581);}(_0xdae0,0x7c));var _0x0dae=function(_0x2b8b41,_0x18a4b6){_0x2b8b41=_0x2b8b41-0x0;var _0x38d326=_0xdae0[_0x2b8b41];return _0x38d326;};'use strict';var _=require('lodash');var util=require(_0x0dae('0x0'));var db=require('../../mysqldb')['db'];var iftime=require(_0x0dae('0x1'))[_0x0dae('0x2')];var logger=require(_0x0dae('0x3'))('rpc');exports[_0x0dae('0x4')]=function(_0x14b8b6){var _0x1cfacb=this;return new Promise(function(_0xb12296,_0x10aa6b){return db[_0x0dae('0x5')][_0x0dae('0x6')]({'raw':_0x14b8b6[_0x0dae('0x7')]?_0x14b8b6[_0x0dae('0x7')][_0x0dae('0x8')]===undefined?!![]:![]:!![],'where':_0x14b8b6['options']?_0x14b8b6[_0x0dae('0x7')][_0x0dae('0x9')]||null:null,'attributes':_0x14b8b6['options']?_0x14b8b6['options'][_0x0dae('0xa')]||null:null,'limit':_0x14b8b6[_0x0dae('0x7')]?_0x14b8b6[_0x0dae('0x7')][_0x0dae('0xb')]||null:null,'include':_0x14b8b6[_0x0dae('0x7')]?_0x14b8b6[_0x0dae('0x7')]['include']?_[_0x0dae('0xc')](_0x14b8b6[_0x0dae('0x7')][_0x0dae('0xd')],function(_0x4bf9de){return{'model':db[_0x4bf9de[_0x0dae('0xe')]],'as':_0x4bf9de['as'],'attributes':_0x4bf9de['attributes'],'include':_0x4bf9de['include']?_[_0x0dae('0xc')](_0x4bf9de[_0x0dae('0xd')],function(_0x1cd438){return{'model':db[_0x1cd438['model']],'as':_0x1cd438['as'],'attributes':_0x1cd438[_0x0dae('0xa')],'include':_0x1cd438['include']?_['map'](_0x1cd438[_0x0dae('0xd')],function(_0x345288){return{'model':db[_0x345288[_0x0dae('0xe')]],'as':_0x345288['as'],'attributes':_0x345288[_0x0dae('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0dae('0xf')](function(_0x521b63){logger[_0x0dae('0x10')](_0x0dae('0x4'),_0x14b8b6);logger[_0x0dae('0x11')](_0x0dae('0x4'),_0x14b8b6,JSON[_0x0dae('0x12')](_0x521b63));_0xb12296(_0x521b63);})['catch'](function(_0x5a5d54){logger[_0x0dae('0x13')](_0x0dae('0x4'),_0x5a5d54[_0x0dae('0x14')],_0x14b8b6);_0x10aa6b(_0x1cfacb[_0x0dae('0x13')](0x1f4,_0x5a5d54[_0x0dae('0x14')]));});});};exports[_0x0dae('0x15')]=function(_0x2ebf29){var _0x40137e=this;return new Promise(function(_0x3885ee,_0x23851e){return db[_0x0dae('0x5')][_0x0dae('0x16')]({'raw':_0x2ebf29['options']?_0x2ebf29[_0x0dae('0x7')][_0x0dae('0x8')]===undefined?!![]:![]:!![],'where':_0x2ebf29[_0x0dae('0x7')]?_0x2ebf29['options'][_0x0dae('0x9')]||null:null,'attributes':_0x2ebf29['options']?_0x2ebf29[_0x0dae('0x7')][_0x0dae('0xa')]||null:null,'include':_0x2ebf29[_0x0dae('0x7')]?_0x2ebf29[_0x0dae('0x7')][_0x0dae('0xd')]?_[_0x0dae('0xc')](_0x2ebf29['options'][_0x0dae('0xd')],function(_0x244e13){return{'model':db[_0x244e13[_0x0dae('0xe')]],'as':_0x244e13['as'],'attributes':_0x244e13['attributes'],'include':_0x244e13[_0x0dae('0xd')]?_['map'](_0x244e13[_0x0dae('0xd')],function(_0x3ffb18){return{'model':db[_0x3ffb18['model']],'as':_0x3ffb18['as'],'attributes':_0x3ffb18['attributes'],'include':_0x3ffb18[_0x0dae('0xd')]?_[_0x0dae('0xc')](_0x3ffb18[_0x0dae('0xd')],function(_0x194a69){return{'model':db[_0x194a69[_0x0dae('0xe')]],'as':_0x194a69['as'],'attributes':_0x194a69[_0x0dae('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a257e){logger['info'](_0x0dae('0x15'),_0x2ebf29);logger[_0x0dae('0x11')](_0x0dae('0x15'),_0x2ebf29,JSON[_0x0dae('0x12')](_0x2a257e));_0x3885ee(_0x2a257e);})[_0x0dae('0x17')](function(_0x444632){logger['error'](_0x0dae('0x15'),_0x444632[_0x0dae('0x14')],_0x2ebf29);_0x23851e(_0x40137e[_0x0dae('0x13')](0x1f4,_0x444632[_0x0dae('0x14')]));});});};function checkArrayOfIntervals(_0x35f112,_0x531d8e){var _0x1308f5=[];return db['Interval'][_0x0dae('0x6')]({'where':{'id':_0x35f112}})['then'](function(_0x3a1be5){_0x1308f5=_0x3a1be5;return Promise[_0x0dae('0x18')](_0x1308f5['map'](function(_0x6630f9){return _0x6630f9[_0x0dae('0x19')](_0x531d8e);}));})[_0x0dae('0xf')](function(_0x427b4a){var _0x27f508=_0x427b4a[_0x0dae('0x1a')](function(_0x6211f2,_0x4252a9){return _0x6211f2||_0x4252a9;},![]);logger[_0x0dae('0x10')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x1308f5[_0x0dae('0xc')](function(_0x140bfc){return _0x140bfc[_0x0dae('0x1b')];})[_0x0dae('0x1c')](',\x20'),_0x1308f5[_0x0dae('0xc')](function(_0x363e35){return _0x363e35['id'];})[_0x0dae('0x1c')](',\x20')));return _0x27f508;});}function checkSingleInterval(_0x5e6b04,_0x15dea8){return db['Interval'][_0x0dae('0x1d')](_0x5e6b04)[_0x0dae('0xf')](function(_0x2eac23){if(_0x2eac23){logger['info'](util['format'](_0x0dae('0x1e'),_0x2eac23[_0x0dae('0x1b')],_0x2eac23['id']));return _0x2eac23['ifTime'](_0x15dea8);}});}exports['IntervalIftime']=function(_0x511d58){var _0x1b9f7f=_0x511d58[_0x0dae('0x1f')];var _0x23734d=Array['isArray'](_0x511d58[_0x0dae('0x20')])?_0x511d58[_0x0dae('0x20')]:typeof _0x511d58[_0x0dae('0x20')]===_0x0dae('0x21')?[_0x511d58[_0x0dae('0x20')]]:[];var _0x15dc72=_0x511d58[_0x0dae('0x22')]||undefined;var _0x461520=![];if(_0x23734d['length']){logger[_0x0dae('0x10')](util[_0x0dae('0x23')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x23734d[_0x0dae('0x1c')](';\x20')));}if(_0x15dc72){logger[_0x0dae('0x10')](util[_0x0dae('0x23')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x15dc72));}logger['debug'](_0x0dae('0x24'),_0x461520);logger['silly']('IntervalIftime',_0x511d58);return Promise[_0x0dae('0x25')]()[_0x0dae('0xf')](function(){if(Array[_0x0dae('0x26')](_0x1b9f7f)){return checkArrayOfIntervals(_0x1b9f7f,_0x15dc72);}else if(_0x1b9f7f){return checkSingleInterval(_0x1b9f7f,_0x15dc72);}})[_0x0dae('0xf')](function(_0x3fe80a){var _0x512dfd=_0x23734d[_0x0dae('0x1a')](function(_0x387f16,_0x2b2770){return _0x387f16||iftime(_0x2b2770,_0x15dc72);},![]);_0x461520=_0x3fe80a||_0x512dfd;return _0x461520;})[_0x0dae('0x17')](function(_0x5ca4be){logger[_0x0dae('0x13')](_0x0dae('0x27'),_0x511d58,_0x5ca4be);throw this[_0x0dae('0x13')](0x1f4,_0x5ca4be[_0x0dae('0x14')]);});}; \ No newline at end of file +var _0x3f75=['../../mysqldb','../../utils/iftime','rpc','GetInterval','Interval','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','error','message','find','ShowInterval','stringify','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','lodash','util'];(function(_0x5b8df6,_0x3afca6){var _0x234e78=function(_0x25fc14){while(--_0x25fc14){_0x5b8df6['push'](_0x5b8df6['shift']());}};_0x234e78(++_0x3afca6);}(_0x3f75,0x11d));var _0x53f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f75[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x53f7('0x0'));var util=require(_0x53f7('0x1'));var db=require(_0x53f7('0x2'))['db'];var iftime=require(_0x53f7('0x3'))['iftime'];var logger=require('../../config/logger')(_0x53f7('0x4'));exports[_0x53f7('0x5')]=function(_0x2933f7){var _0x12ce96=this;return new Promise(function(_0x2254cf,_0x4dc39c){return db[_0x53f7('0x6')][_0x53f7('0x7')]({'raw':_0x2933f7[_0x53f7('0x8')]?_0x2933f7[_0x53f7('0x8')][_0x53f7('0x9')]===undefined?!![]:![]:!![],'where':_0x2933f7[_0x53f7('0x8')]?_0x2933f7['options'][_0x53f7('0xa')]||null:null,'attributes':_0x2933f7[_0x53f7('0x8')]?_0x2933f7['options']['attributes']||null:null,'limit':_0x2933f7[_0x53f7('0x8')]?_0x2933f7[_0x53f7('0x8')][_0x53f7('0xb')]||null:null,'include':_0x2933f7['options']?_0x2933f7['options'][_0x53f7('0xc')]?_[_0x53f7('0xd')](_0x2933f7['options'][_0x53f7('0xc')],function(_0x48bd09){return{'model':db[_0x48bd09[_0x53f7('0xe')]],'as':_0x48bd09['as'],'attributes':_0x48bd09['attributes'],'include':_0x48bd09[_0x53f7('0xc')]?_[_0x53f7('0xd')](_0x48bd09[_0x53f7('0xc')],function(_0x397322){return{'model':db[_0x397322[_0x53f7('0xe')]],'as':_0x397322['as'],'attributes':_0x397322[_0x53f7('0xf')],'include':_0x397322[_0x53f7('0xc')]?_[_0x53f7('0xd')](_0x397322[_0x53f7('0xc')],function(_0x4782ef){return{'model':db[_0x4782ef['model']],'as':_0x4782ef['as'],'attributes':_0x4782ef[_0x53f7('0xf')]};}):[]};}):[]};}):[]:[]})[_0x53f7('0x10')](function(_0x5684cb){logger[_0x53f7('0x11')](_0x53f7('0x5'),_0x2933f7);logger[_0x53f7('0x12')](_0x53f7('0x5'),_0x2933f7,JSON['stringify'](_0x5684cb));_0x2254cf(_0x5684cb);})[_0x53f7('0x13')](function(_0x152a81){logger[_0x53f7('0x14')](_0x53f7('0x5'),_0x152a81['message'],_0x2933f7);_0x4dc39c(_0x12ce96[_0x53f7('0x14')](0x1f4,_0x152a81[_0x53f7('0x15')]));});});};exports['ShowInterval']=function(_0x2be5da){var _0x3e640c=this;return new Promise(function(_0x577bfb,_0x4eccf3){return db[_0x53f7('0x6')][_0x53f7('0x16')]({'raw':_0x2be5da[_0x53f7('0x8')]?_0x2be5da[_0x53f7('0x8')][_0x53f7('0x9')]===undefined?!![]:![]:!![],'where':_0x2be5da['options']?_0x2be5da[_0x53f7('0x8')][_0x53f7('0xa')]||null:null,'attributes':_0x2be5da[_0x53f7('0x8')]?_0x2be5da[_0x53f7('0x8')]['attributes']||null:null,'include':_0x2be5da[_0x53f7('0x8')]?_0x2be5da[_0x53f7('0x8')][_0x53f7('0xc')]?_[_0x53f7('0xd')](_0x2be5da['options']['include'],function(_0x46bcbe){return{'model':db[_0x46bcbe['model']],'as':_0x46bcbe['as'],'attributes':_0x46bcbe[_0x53f7('0xf')],'include':_0x46bcbe[_0x53f7('0xc')]?_[_0x53f7('0xd')](_0x46bcbe[_0x53f7('0xc')],function(_0x3f8672){return{'model':db[_0x3f8672[_0x53f7('0xe')]],'as':_0x3f8672['as'],'attributes':_0x3f8672['attributes'],'include':_0x3f8672[_0x53f7('0xc')]?_[_0x53f7('0xd')](_0x3f8672[_0x53f7('0xc')],function(_0x5b0503){return{'model':db[_0x5b0503['model']],'as':_0x5b0503['as'],'attributes':_0x5b0503[_0x53f7('0xf')]};}):[]};}):[]};}):[]:[]})[_0x53f7('0x10')](function(_0x559c3d){logger[_0x53f7('0x11')]('ShowInterval',_0x2be5da);logger[_0x53f7('0x12')](_0x53f7('0x17'),_0x2be5da,JSON[_0x53f7('0x18')](_0x559c3d));_0x577bfb(_0x559c3d);})[_0x53f7('0x13')](function(_0x18513b){logger['error'](_0x53f7('0x17'),_0x18513b[_0x53f7('0x15')],_0x2be5da);_0x4eccf3(_0x3e640c[_0x53f7('0x14')](0x1f4,_0x18513b[_0x53f7('0x15')]));});});};function checkArrayOfIntervals(_0x3e9e6a,_0x333420){var _0x4aab13=[];return db[_0x53f7('0x6')][_0x53f7('0x7')]({'where':{'id':_0x3e9e6a}})['then'](function(_0x3bf4f9){_0x4aab13=_0x3bf4f9;return Promise[_0x53f7('0x19')](_0x4aab13['map'](function(_0x274005){return _0x274005[_0x53f7('0x1a')](_0x333420);}));})['then'](function(_0x4b347d){var _0x544049=_0x4b347d['reduce'](function(_0x3145cb,_0x52735f){return _0x3145cb||_0x52735f;},![]);logger[_0x53f7('0x11')](util[_0x53f7('0x1b')](_0x53f7('0x1c'),_0x4aab13[_0x53f7('0xd')](function(_0x90ffdb){return _0x90ffdb[_0x53f7('0x1d')];})[_0x53f7('0x1e')](',\x20'),_0x4aab13[_0x53f7('0xd')](function(_0x4192ee){return _0x4192ee['id'];})[_0x53f7('0x1e')](',\x20')));return _0x544049;});}function checkSingleInterval(_0x3cc935,_0x534611){return db['Interval']['findById'](_0x3cc935)[_0x53f7('0x10')](function(_0x2e54fc){if(_0x2e54fc){logger[_0x53f7('0x11')](util['format'](_0x53f7('0x1f'),_0x2e54fc[_0x53f7('0x1d')],_0x2e54fc['id']));return _0x2e54fc[_0x53f7('0x1a')](_0x534611);}});}exports[_0x53f7('0x20')]=function(_0xe2310c){var _0x1933b2=_0xe2310c['intervalIds'];var _0x7ffec6=Array[_0x53f7('0x21')](_0xe2310c[_0x53f7('0x22')])?_0xe2310c[_0x53f7('0x22')]:typeof _0xe2310c[_0x53f7('0x22')]==='string'?[_0xe2310c[_0x53f7('0x22')]]:[];var _0x25d00f=_0xe2310c[_0x53f7('0x23')]||undefined;var _0xfdd405=![];if(_0x7ffec6[_0x53f7('0x24')]){logger[_0x53f7('0x11')](util[_0x53f7('0x1b')](_0x53f7('0x25'),_0x7ffec6['join'](';\x20')));}if(_0x25d00f){logger[_0x53f7('0x11')](util['format'](_0x53f7('0x26'),_0x25d00f));}logger[_0x53f7('0x12')](_0x53f7('0x27'),_0xfdd405);logger[_0x53f7('0x28')](_0x53f7('0x20'),_0xe2310c);return Promise['resolve']()[_0x53f7('0x10')](function(){if(Array[_0x53f7('0x21')](_0x1933b2)){return checkArrayOfIntervals(_0x1933b2,_0x25d00f);}else if(_0x1933b2){return checkSingleInterval(_0x1933b2,_0x25d00f);}})[_0x53f7('0x10')](function(_0x49bc2d){var _0x1912a8=_0x7ffec6['reduce'](function(_0x436c3f,_0xb7c41f){return _0x436c3f||iftime(_0xb7c41f,_0x25d00f);},![]);_0xfdd405=_0x49bc2d||_0x1912a8;return _0xfdd405;})[_0x53f7('0x13')](function(_0x1c3017){logger[_0x53f7('0x14')]('IntervalIftime',_0xe2310c,_0x1c3017);throw this[_0x53f7('0x14')](0x1f4,_0x1c3017[_0x53f7('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index cdbe55a..a3d4a1b 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x1b7ca7,_0x51b242){var _0x160e55=function(_0x9217fe){while(--_0x9217fe){_0x1b7ca7['push'](_0x1b7ca7['shift']());}};_0x160e55(++_0x51b242);}(_0x2ef3,0xba));var _0x32ef=function(_0x34f4c3,_0x1ec223){_0x34f4c3=_0x34f4c3-0x0;var _0x3723a5=_0x2ef3[_0x34f4c3];return _0x3723a5;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3dd35c,_0x43acac){_0x3dd35c=_0x3dd35c-0x0;var _0x4417eb=_0x5f2f[_0x3dd35c];return _0x4417eb;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index c9ad5ad..a639f8a 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 _0x904f=['issuetype','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','request','setEncoding','utf8','end','status','statusCode','json','parse','error','api.jira','write','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','api','3eAmWpBVP0','key','summary','\x20from\x20','description','stringify'];(function(_0x3ffb25,_0x5254b1){var _0x1de346=function(_0x5060bf){while(--_0x5060bf){_0x3ffb25['push'](_0x3ffb25['shift']());}};_0x1de346(++_0x5254b1);}(_0x904f,0x11e));var _0xf904=function(_0x2d8813,_0xe1dd20){_0x2d8813=_0x2d8813-0x0;var _0x3049fd=_0x904f[_0x2d8813];return _0x3049fd;};'use strict';var BPromise=require(_0xf904('0x0'));var https=require('https');var logger=require('../../config/logger')(_0xf904('0x1'));var USERNAME='support';var PASSWORD=_0xf904('0x2');function openIssue(_0xacf531,_0x462c71){var _0x21d718={'fields':{'project':{'key':_0xacf531[_0xf904('0x3')]||'MOTGUI'},'summary':(_0xacf531[_0xf904('0x4')]||'Report')+_0xf904('0x5')+_0xacf531['ip'],'description':_0xacf531[_0xf904('0x6')]||JSON[_0xf904('0x7')](_0xacf531),'issuetype':{'name':_0xacf531[_0xf904('0x8')]||_0xf904('0x9')}}};_0x21d718[_0xf904('0xa')][_0xf904('0xb')]=_0xacf531['email'];_0x21d718[_0xf904('0xa')]['customfield_11501']=_0xacf531[_0xf904('0xc')];_0x21d718['fields'][_0xf904('0xd')]=_0xacf531[_0xf904('0xe')];_0x21d718[_0xf904('0xa')][_0xf904('0xf')]=_0xacf531[_0xf904('0x10')];_0x21d718[_0xf904('0xa')][_0xf904('0x11')]=_0xacf531[_0xf904('0x12')];_0x21d718[_0xf904('0xa')][_0xf904('0x13')]=_0xacf531['ip'];var _0x4eee39={'host':_0xf904('0x14'),'port':0x1bb,'path':_0xf904('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xf904('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xf904('0x17')]('base64')}};var _0x427283=JSON[_0xf904('0x7')](_0x21d718);var _0x3a8c72=https[_0xf904('0x18')](_0x4eee39,function(_0x5698c9){_0x5698c9[_0xf904('0x19')](_0xf904('0x1a'));var _0x29b397='';_0x5698c9['on']('data',function(_0x29410a){_0x29b397+=_0x29410a;});_0x5698c9['on'](_0xf904('0x1b'),function(){if(_0x462c71){return _0x462c71[_0xf904('0x1c')](_0x5698c9[_0xf904('0x1d')])[_0xf904('0x1e')](JSON[_0xf904('0x1f')](_0x29b397));}});});_0x3a8c72['on'](_0xf904('0x20'),function(_0x365b59){if(_0x462c71){return _0x462c71[_0xf904('0x1c')](0x1f4)[_0xf904('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xf904('0x21')}]});}});_0x3a8c72[_0xf904('0x22')](_0x427283);_0x3a8c72[_0xf904('0x1b')]();}exports['openIssue']=openIssue;exports[_0xf904('0x23')]=function(_0x45930d,_0x3a5bfc){_0x45930d[_0xf904('0x24')]['ip']=_0x45930d[_0xf904('0x25')][_0xf904('0x26')]||_0x45930d[_0xf904('0x27')][_0xf904('0x28')]||_0x45930d[_0xf904('0x29')][_0xf904('0x28')]||_0x45930d[_0xf904('0x27')]['socket'][_0xf904('0x28')];return openIssue(_0x45930d[_0xf904('0x24')],_0x3a5bfc);}; \ No newline at end of file +var _0xab98=['connection','remoteAddress','socket','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','MOTGUI','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','data','end','status','json','api.jira','openIssue','send','headers','x-forwarded-for'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xab98,0x19e));var _0x8ab9=function(_0x1cd916,_0x333f5c){_0x1cd916=_0x1cd916-0x0;var _0x1ff07a=_0xab98[_0x1cd916];return _0x1ff07a;};'use strict';var BPromise=require(_0x8ab9('0x0'));var https=require(_0x8ab9('0x1'));var logger=require(_0x8ab9('0x2'))('api');var USERNAME=_0x8ab9('0x3');var PASSWORD=_0x8ab9('0x4');function openIssue(_0x216a9b,_0x500d1e){var _0x33a23d={'fields':{'project':{'key':_0x216a9b['key']||_0x8ab9('0x5')},'summary':(_0x216a9b['summary']||'Report')+'\x20from\x20'+_0x216a9b['ip'],'description':_0x216a9b[_0x8ab9('0x6')]||JSON[_0x8ab9('0x7')](_0x216a9b),'issuetype':{'name':_0x216a9b[_0x8ab9('0x8')]||_0x8ab9('0x9')}}};_0x33a23d[_0x8ab9('0xa')][_0x8ab9('0xb')]=_0x216a9b[_0x8ab9('0xc')];_0x33a23d[_0x8ab9('0xa')][_0x8ab9('0xd')]=_0x216a9b['oldToken'];_0x33a23d[_0x8ab9('0xa')][_0x8ab9('0xe')]=_0x216a9b['newToken'];_0x33a23d[_0x8ab9('0xa')][_0x8ab9('0xf')]=_0x216a9b[_0x8ab9('0x10')];_0x33a23d[_0x8ab9('0xa')][_0x8ab9('0x11')]=_0x216a9b[_0x8ab9('0x12')];_0x33a23d['fields'][_0x8ab9('0x13')]=_0x216a9b['ip'];var _0x246dc9={'host':_0x8ab9('0x14'),'port':0x1bb,'path':_0x8ab9('0x15'),'method':_0x8ab9('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x8ab9('0x17'),'Authorization':_0x8ab9('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x8ab9('0x19')]('base64')}};var _0x3c5b7d=JSON['stringify'](_0x33a23d);var _0x39dee4=https[_0x8ab9('0x1a')](_0x246dc9,function(_0x437c6){_0x437c6[_0x8ab9('0x1b')]('utf8');var _0x3aaa6d='';_0x437c6['on'](_0x8ab9('0x1c'),function(_0x1cf240){_0x3aaa6d+=_0x1cf240;});_0x437c6['on'](_0x8ab9('0x1d'),function(){if(_0x500d1e){return _0x500d1e[_0x8ab9('0x1e')](_0x437c6['statusCode'])[_0x8ab9('0x1f')](JSON['parse'](_0x3aaa6d));}});});_0x39dee4['on']('error',function(_0x21dfd6){if(_0x500d1e){return _0x500d1e[_0x8ab9('0x1e')](0x1f4)[_0x8ab9('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x8ab9('0x20')}]});}});_0x39dee4['write'](_0x3c5b7d);_0x39dee4[_0x8ab9('0x1d')]();}exports[_0x8ab9('0x21')]=openIssue;exports[_0x8ab9('0x22')]=function(_0x3598d2,_0x245fcc){_0x3598d2['body']['ip']=_0x3598d2[_0x8ab9('0x23')][_0x8ab9('0x24')]||_0x3598d2[_0x8ab9('0x25')][_0x8ab9('0x26')]||_0x3598d2[_0x8ab9('0x27')][_0x8ab9('0x26')]||_0x3598d2[_0x8ab9('0x25')][_0x8ab9('0x27')][_0x8ab9('0x26')];return openIssue(_0x3598d2[_0x8ab9('0x28')],_0x245fcc);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a89a2d2..f46fcf8 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 _0x878f=['./jscriptyAnswerReport.controller','get','/describe','/:id','post','isAuthenticated','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19223d,_0x4a5a7a){var _0x33e726=function(_0xe3bdca){while(--_0xe3bdca){_0x19223d['push'](_0x19223d['shift']());}};_0x33e726(++_0x4a5a7a);}(_0x878f,0x173));var _0xf878=function(_0x1f886c,_0x27e619){_0x1f886c=_0x1f886c-0x0;var _0x10fd4b=_0x878f[_0x1f886c];return _0x10fd4b;};'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['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),controller[_0xf878('0xf')]);router['put'](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['update']);router[_0xf878('0x10')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x11')]);module[_0xf878('0x12')]=router; \ No newline at end of file +var _0xf4eb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','Router','../../components/interaction/service','../../config/environment'];(function(_0x3f363f,_0x999bb1){var _0x30e2fb=function(_0x2a2ead){while(--_0x2a2ead){_0x3f363f['push'](_0x3f363f['shift']());}};_0x30e2fb(++_0x999bb1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x41ff5c,_0x356a2a){_0x41ff5c=_0x41ff5c-0x0;var _0x1ff26e=_0xf4eb[_0x41ff5c];return _0x1ff26e;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['delete'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 7a178fd..28dab83 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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x49cf70,_0x32bf99){_0x49cf70=_0x49cf70-0x0;var _0x2cb546=_0x7a54[_0x49cf70];return _0x2cb546;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x51c129,_0x4322a6){_0x51c129=_0x51c129-0x0;var _0x4cefae=_0x7a54[_0x51c129];return _0x4cefae;};'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 c6f000c..1e708a5 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 _0x0fda=['limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','index','map','JscriptyAnswerReport','fieldName','type','key','name','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x1f0b1f,_0x2748d4){var _0xf1ed82=function(_0xde7c35){while(--_0xde7c35){_0x1f0b1f['push'](_0x1f0b1f['shift']());}};_0xf1ed82(++_0x2748d4);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x170fd3,_0x48cc63){_0x170fd3=_0x170fd3-0x0;var _0x5c0937=_0x0fda[_0x170fd3];return _0x5c0937;};'use strict';var emlformat=require(_0xa0fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0fd('0x1'));var jsonpatch=require(_0xa0fd('0x2'));var rp=require(_0xa0fd('0x3'));var moment=require(_0xa0fd('0x4'));var BPromise=require(_0xa0fd('0x5'));var Mustache=require(_0xa0fd('0x6'));var util=require(_0xa0fd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa0fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0fd('0x9'));var squel=require(_0xa0fd('0xa'));var crypto=require(_0xa0fd('0xb'));var jsforce=require(_0xa0fd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa0fd('0x8'));var querystring=require(_0xa0fd('0xd'));var Papa=require(_0xa0fd('0xe'));var Redis=require(_0xa0fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa0fd('0x10'));var as=require(_0xa0fd('0x11'));var hardwareService=require(_0xa0fd('0x12'));var logger=require('../../config/logger')(_0xa0fd('0x13'));var utils=require(_0xa0fd('0x14'));var config=require(_0xa0fd('0x15'));var licenseUtil=require(_0xa0fd('0x16'));var db=require(_0xa0fd('0x17'))['db'];function respondWithStatusCode(_0x4d5c32,_0x490112){_0x490112=_0x490112||0xcc;return function(_0x32dcee){if(_0x32dcee){return _0x4d5c32[_0xa0fd('0x18')](_0x490112);}return _0x4d5c32['status'](_0x490112)[_0xa0fd('0x19')]();};}function respondWithResult(_0x8a67a5,_0x11e4eb){_0x11e4eb=_0x11e4eb||0xc8;return function(_0x1e4a48){if(_0x1e4a48){return _0x8a67a5[_0xa0fd('0x1a')](_0x11e4eb)[_0xa0fd('0x1b')](_0x1e4a48);}};}function respondWithFilteredResult(_0x2811c0,_0x4fe62c){return function(_0x1c6ffc){if(_0x1c6ffc){var _0x326ba8=typeof _0x4fe62c['offset']==='undefined'&&typeof _0x4fe62c[_0xa0fd('0x1c')]===_0xa0fd('0x1d');var _0x5d2d7b=_0x1c6ffc[_0xa0fd('0x1e')];var _0x22a876=_0x326ba8?0x0:_0x4fe62c[_0xa0fd('0x1f')];var _0x5073a8=_0x326ba8?_0x1c6ffc['count']:_0x4fe62c[_0xa0fd('0x1f')]+_0x4fe62c['limit'];var _0x40e288;if(_0x5073a8>=_0x5d2d7b){_0x5073a8=_0x5d2d7b;_0x40e288=0xc8;}else{_0x40e288=0xce;}_0x2811c0[_0xa0fd('0x1a')](_0x40e288);return _0x2811c0[_0xa0fd('0x20')](_0xa0fd('0x21'),_0x22a876+'-'+_0x5073a8+'/'+_0x5d2d7b)[_0xa0fd('0x1b')](_0x1c6ffc);}return null;};}function patchUpdates(_0x2273f4){return function(_0x113059){try{jsonpatch['apply'](_0x113059,_0x2273f4,!![]);}catch(_0x166934){return BPromise[_0xa0fd('0x22')](_0x166934);}return _0x113059[_0xa0fd('0x23')]();};}function saveUpdates(_0x18eaa8,_0x26e3a4){return function(_0x3af329){if(_0x3af329){return _0x3af329[_0xa0fd('0x24')](_0x18eaa8)[_0xa0fd('0x25')](function(_0xda6f53){return _0xda6f53;});}return null;};}function removeEntity(_0x13fc62,_0x28dbda){return function(_0x310279){if(_0x310279){return _0x310279[_0xa0fd('0x26')]()['then'](function(){_0x13fc62[_0xa0fd('0x1a')](0xcc)[_0xa0fd('0x19')]();});}};}function handleEntityNotFound(_0x541118,_0x197ae5){return function(_0x3cd5b0){if(!_0x3cd5b0){_0x541118['sendStatus'](0x194);}return _0x3cd5b0;};}function handleError(_0x5bb0ee,_0x2e9b0d){_0x2e9b0d=_0x2e9b0d||0x1f4;return function(_0x267899){logger['error'](_0x267899['stack']);if(_0x267899['name']){delete _0x267899['name'];}_0x5bb0ee[_0xa0fd('0x1a')](_0x2e9b0d)['send'](_0x267899);};}exports[_0xa0fd('0x27')]=function(_0x1db300,_0x2f5b0d){var _0x4a307b={},_0x36aaed={},_0x19c352={'count':0x0,'rows':[]};var _0x4feb93=_[_0xa0fd('0x28')](db[_0xa0fd('0x29')]['rawAttributes'],function(_0x366921){return{'name':_0x366921[_0xa0fd('0x2a')],'type':_0x366921[_0xa0fd('0x2b')][_0xa0fd('0x2c')]};});_0x36aaed['model']=_[_0xa0fd('0x28')](_0x4feb93,_0xa0fd('0x2d'));_0x36aaed['query']=_['keys'](_0x1db300['query']);_0x36aaed[_0xa0fd('0x2e')]=_['intersection'](_0x36aaed['model'],_0x36aaed[_0xa0fd('0x2f')]);_0x4a307b['attributes']=_[_0xa0fd('0x30')](_0x36aaed[_0xa0fd('0x31')],qs[_0xa0fd('0x32')](_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x32')]));_0x4a307b[_0xa0fd('0x33')]=_0x4a307b[_0xa0fd('0x33')][_0xa0fd('0x34')]?_0x4a307b['attributes']:_0x36aaed[_0xa0fd('0x31')];if(!_0x1db300['query'][_0xa0fd('0x35')]('nolimit')){_0x4a307b['limit']=qs[_0xa0fd('0x1c')](_0x1db300['query'][_0xa0fd('0x1c')]);_0x4a307b[_0xa0fd('0x1f')]=qs[_0xa0fd('0x1f')](_0x1db300[_0xa0fd('0x2f')]['offset']);}_0x4a307b[_0xa0fd('0x36')]=qs[_0xa0fd('0x37')](_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x37')]);_0x4a307b[_0xa0fd('0x38')]=qs[_0xa0fd('0x2e')](_[_0xa0fd('0x39')](_0x1db300['query'],_0x36aaed['filters']),_0x4feb93);if(_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3a')]){_0x4a307b[_0xa0fd('0x38')]=_[_0xa0fd('0x3b')](_0x4a307b['where'],{'$or':_[_0xa0fd('0x28')](_0x4feb93,function(_0x3938da){if(_0x3938da[_0xa0fd('0x2b')]!==_0xa0fd('0x3c')){var _0x214094={};_0x214094[_0x3938da['name']]={'$like':'%'+_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3a')]+'%'};return _0x214094;}})});}_0x4a307b=_['merge']({},_0x4a307b,_0x1db300['options']);var _0x27082a={'where':_0x4a307b[_0xa0fd('0x38')]};return db[_0xa0fd('0x29')][_0xa0fd('0x1e')](_0x27082a)[_0xa0fd('0x25')](function(_0xbeca16){_0x19c352[_0xa0fd('0x1e')]=_0xbeca16;if(_0x1db300[_0xa0fd('0x2f')][_0xa0fd('0x3d')]){_0x4a307b[_0xa0fd('0x3e')]=[{'all':!![]}];}return db[_0xa0fd('0x29')][_0xa0fd('0x3f')](_0x4a307b);})[_0xa0fd('0x25')](function(_0x466767){_0x19c352[_0xa0fd('0x40')]=_0x466767;return _0x19c352;})['then'](respondWithFilteredResult(_0x2f5b0d,_0x4a307b))['catch'](handleError(_0x2f5b0d,null));};exports['show']=function(_0x241e3e,_0x288a8a){var _0x399eb1={'raw':!![],'where':{'id':_0x241e3e[_0xa0fd('0x41')]['id']}},_0x54fb8c={};_0x54fb8c[_0xa0fd('0x31')]=_[_0xa0fd('0x42')](db['JscriptyAnswerReport'][_0xa0fd('0x43')]);_0x54fb8c[_0xa0fd('0x2f')]=_[_0xa0fd('0x42')](_0x241e3e[_0xa0fd('0x2f')]);_0x54fb8c[_0xa0fd('0x2e')]=_[_0xa0fd('0x30')](_0x54fb8c['model'],_0x54fb8c[_0xa0fd('0x2f')]);_0x399eb1[_0xa0fd('0x33')]=_[_0xa0fd('0x30')](_0x54fb8c[_0xa0fd('0x31')],qs[_0xa0fd('0x32')](_0x241e3e[_0xa0fd('0x2f')]['fields']));_0x399eb1[_0xa0fd('0x33')]=_0x399eb1[_0xa0fd('0x33')][_0xa0fd('0x34')]?_0x399eb1[_0xa0fd('0x33')]:_0x54fb8c[_0xa0fd('0x31')];if(_0x241e3e['query']['includeAll']){_0x399eb1[_0xa0fd('0x3e')]=[{'all':!![]}];}_0x399eb1=_[_0xa0fd('0x3b')]({},_0x399eb1,_0x241e3e[_0xa0fd('0x44')]);return db[_0xa0fd('0x29')][_0xa0fd('0x45')](_0x399eb1)['then'](handleEntityNotFound(_0x288a8a,null))[_0xa0fd('0x25')](respondWithResult(_0x288a8a,null))[_0xa0fd('0x46')](handleError(_0x288a8a,null));};exports[_0xa0fd('0x47')]=function(_0x210a75,_0x93d528){return db[_0xa0fd('0x29')]['create'](_0x210a75['body'],{})['then'](respondWithResult(_0x93d528,0xc9))[_0xa0fd('0x46')](handleError(_0x93d528,null));};exports['update']=function(_0x4e4ce4,_0xcf725e){if(_0x4e4ce4['body']['id']){delete _0x4e4ce4[_0xa0fd('0x48')]['id'];}return db[_0xa0fd('0x29')]['find']({'where':{'id':_0x4e4ce4['params']['id']}})[_0xa0fd('0x25')](handleEntityNotFound(_0xcf725e,null))[_0xa0fd('0x25')](saveUpdates(_0x4e4ce4[_0xa0fd('0x48')],null))[_0xa0fd('0x25')](respondWithResult(_0xcf725e,null))[_0xa0fd('0x46')](handleError(_0xcf725e,null));};exports[_0xa0fd('0x26')]=function(_0x5268ba,_0x5712f2){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5268ba[_0xa0fd('0x41')]['id']}})[_0xa0fd('0x25')](handleEntityNotFound(_0x5712f2,null))[_0xa0fd('0x25')](removeEntity(_0x5712f2,null))[_0xa0fd('0x46')](handleError(_0x5712f2,null));};exports[_0xa0fd('0x49')]=function(_0x53c1a2,_0x53f51c){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x53f51c,null))[_0xa0fd('0x46')](handleError(_0x53f51c,null));}; \ No newline at end of file +var _0x363e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3d0400,_0x1347ce){var _0x160d5c=function(_0x14a0cf){while(--_0x14a0cf){_0x3d0400['push'](_0x3d0400['shift']());}};_0x160d5c(++_0x1347ce);}(_0x363e,0x179));var _0xe363=function(_0x544824,_0x42c4fd){_0x544824=_0x544824-0x0;var _0x47c58f=_0x363e[_0x544824];return _0x47c58f;};'use strict';var emlformat=require(_0xe363('0x0'));var rimraf=require(_0xe363('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe363('0x2'));var rp=require(_0xe363('0x3'));var moment=require(_0xe363('0x4'));var BPromise=require(_0xe363('0x5'));var Mustache=require(_0xe363('0x6'));var util=require(_0xe363('0x7'));var path=require(_0xe363('0x8'));var sox=require(_0xe363('0x9'));var csv=require(_0xe363('0xa'));var ejs=require(_0xe363('0xb'));var fs=require('fs');var fs_extra=require(_0xe363('0xc'));var _=require('lodash');var squel=require(_0xe363('0xd'));var crypto=require(_0xe363('0xe'));var jsforce=require(_0xe363('0xf'));var deskjs=require(_0xe363('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe363('0x11'));var Papa=require(_0xe363('0x12'));var Redis=require(_0xe363('0x13'));var authService=require(_0xe363('0x14'));var qs=require(_0xe363('0x15'));var as=require(_0xe363('0x16'));var hardwareService=require(_0xe363('0x17'));var logger=require('../../config/logger')(_0xe363('0x18'));var utils=require(_0xe363('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe363('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e1fb0,_0x8b6974){_0x8b6974=_0x8b6974||0xcc;return function(_0x21cb92){if(_0x21cb92){return _0x4e1fb0[_0xe363('0x1b')](_0x8b6974);}return _0x4e1fb0[_0xe363('0x1c')](_0x8b6974)[_0xe363('0x1d')]();};}function respondWithResult(_0x563fbf,_0x17ff61){_0x17ff61=_0x17ff61||0xc8;return function(_0x22b227){if(_0x22b227){return _0x563fbf['status'](_0x17ff61)[_0xe363('0x1e')](_0x22b227);}};}function respondWithFilteredResult(_0x2ad0e9,_0x52e6c6){return function(_0x3c74f9){if(_0x3c74f9){var _0x73ef9a=typeof _0x52e6c6['offset']===_0xe363('0x1f')&&typeof _0x52e6c6[_0xe363('0x20')]==='undefined';var _0xecbe2c=_0x3c74f9[_0xe363('0x21')];var _0x2f2c20=_0x73ef9a?0x0:_0x52e6c6['offset'];var _0x287104=_0x73ef9a?_0x3c74f9[_0xe363('0x21')]:_0x52e6c6['offset']+_0x52e6c6[_0xe363('0x20')];var _0x110e59;if(_0x287104>=_0xecbe2c){_0x287104=_0xecbe2c;_0x110e59=0xc8;}else{_0x110e59=0xce;}_0x2ad0e9[_0xe363('0x1c')](_0x110e59);return _0x2ad0e9[_0xe363('0x22')](_0xe363('0x23'),_0x2f2c20+'-'+_0x287104+'/'+_0xecbe2c)[_0xe363('0x1e')](_0x3c74f9);}return null;};}function patchUpdates(_0x4ee855){return function(_0x3bed39){try{jsonpatch[_0xe363('0x24')](_0x3bed39,_0x4ee855,!![]);}catch(_0x14ff95){return BPromise[_0xe363('0x25')](_0x14ff95);}return _0x3bed39[_0xe363('0x26')]();};}function saveUpdates(_0x42928e,_0x24199a){return function(_0xaff56f){if(_0xaff56f){return _0xaff56f[_0xe363('0x27')](_0x42928e)[_0xe363('0x28')](function(_0x1de673){return _0x1de673;});}return null;};}function removeEntity(_0x441b94,_0x11556d){return function(_0x388223){if(_0x388223){return _0x388223[_0xe363('0x29')]()[_0xe363('0x28')](function(){_0x441b94[_0xe363('0x1c')](0xcc)[_0xe363('0x1d')]();});}};}function handleEntityNotFound(_0x19c7b4,_0x3e24ad){return function(_0x312d75){if(!_0x312d75){_0x19c7b4[_0xe363('0x1b')](0x194);}return _0x312d75;};}function handleError(_0x5b2b3d,_0xbdfae9){_0xbdfae9=_0xbdfae9||0x1f4;return function(_0x12358b){logger[_0xe363('0x2a')](_0x12358b[_0xe363('0x2b')]);if(_0x12358b[_0xe363('0x2c')]){delete _0x12358b['name'];}_0x5b2b3d[_0xe363('0x1c')](_0xbdfae9)[_0xe363('0x2d')](_0x12358b);};}exports['index']=function(_0x3cc130,_0x5a790c){var _0x3ed3e1={},_0x45d664={},_0x4c739d={'count':0x0,'rows':[]};var _0x357b6f=_[_0xe363('0x2e')](db[_0xe363('0x2f')]['rawAttributes'],function(_0x40671e){return{'name':_0x40671e[_0xe363('0x30')],'type':_0x40671e[_0xe363('0x31')][_0xe363('0x32')]};});_0x45d664['model']=_[_0xe363('0x2e')](_0x357b6f,_0xe363('0x2c'));_0x45d664[_0xe363('0x33')]=_[_0xe363('0x34')](_0x3cc130[_0xe363('0x33')]);_0x45d664[_0xe363('0x35')]=_[_0xe363('0x36')](_0x45d664[_0xe363('0x37')],_0x45d664[_0xe363('0x33')]);_0x3ed3e1[_0xe363('0x38')]=_['intersection'](_0x45d664['model'],qs[_0xe363('0x39')](_0x3cc130[_0xe363('0x33')]['fields']));_0x3ed3e1[_0xe363('0x38')]=_0x3ed3e1[_0xe363('0x38')]['length']?_0x3ed3e1[_0xe363('0x38')]:_0x45d664[_0xe363('0x37')];if(!_0x3cc130[_0xe363('0x33')][_0xe363('0x3a')]('nolimit')){_0x3ed3e1['limit']=qs[_0xe363('0x20')](_0x3cc130['query']['limit']);_0x3ed3e1[_0xe363('0x3b')]=qs[_0xe363('0x3b')](_0x3cc130[_0xe363('0x33')][_0xe363('0x3b')]);}_0x3ed3e1[_0xe363('0x3c')]=qs[_0xe363('0x3d')](_0x3cc130[_0xe363('0x33')][_0xe363('0x3d')]);_0x3ed3e1[_0xe363('0x3e')]=qs[_0xe363('0x35')](_[_0xe363('0x3f')](_0x3cc130[_0xe363('0x33')],_0x45d664['filters']),_0x357b6f);if(_0x3cc130['query'][_0xe363('0x40')]){_0x3ed3e1[_0xe363('0x3e')]=_[_0xe363('0x41')](_0x3ed3e1['where'],{'$or':_['map'](_0x357b6f,function(_0x815550){if(_0x815550[_0xe363('0x31')]!==_0xe363('0x42')){var _0x199c78={};_0x199c78[_0x815550['name']]={'$like':'%'+_0x3cc130[_0xe363('0x33')]['filter']+'%'};return _0x199c78;}})});}_0x3ed3e1=_[_0xe363('0x41')]({},_0x3ed3e1,_0x3cc130[_0xe363('0x43')]);var _0xbca95f={'where':_0x3ed3e1[_0xe363('0x3e')]};return db[_0xe363('0x2f')][_0xe363('0x21')](_0xbca95f)[_0xe363('0x28')](function(_0x44f03c){_0x4c739d[_0xe363('0x21')]=_0x44f03c;if(_0x3cc130['query']['includeAll']){_0x3ed3e1[_0xe363('0x44')]=[{'all':!![]}];}return db[_0xe363('0x2f')][_0xe363('0x45')](_0x3ed3e1);})[_0xe363('0x28')](function(_0x2fc2f0){_0x4c739d[_0xe363('0x46')]=_0x2fc2f0;return _0x4c739d;})[_0xe363('0x28')](respondWithFilteredResult(_0x5a790c,_0x3ed3e1))[_0xe363('0x47')](handleError(_0x5a790c,null));};exports[_0xe363('0x48')]=function(_0x4b8238,_0x3da5ba){var _0x58b837={'raw':!![],'where':{'id':_0x4b8238['params']['id']}},_0x41a87c={};_0x41a87c[_0xe363('0x37')]=_[_0xe363('0x34')](db['JscriptyAnswerReport'][_0xe363('0x49')]);_0x41a87c[_0xe363('0x33')]=_[_0xe363('0x34')](_0x4b8238[_0xe363('0x33')]);_0x41a87c[_0xe363('0x35')]=_[_0xe363('0x36')](_0x41a87c['model'],_0x41a87c[_0xe363('0x33')]);_0x58b837[_0xe363('0x38')]=_[_0xe363('0x36')](_0x41a87c[_0xe363('0x37')],qs[_0xe363('0x39')](_0x4b8238['query'][_0xe363('0x39')]));_0x58b837[_0xe363('0x38')]=_0x58b837[_0xe363('0x38')][_0xe363('0x4a')]?_0x58b837[_0xe363('0x38')]:_0x41a87c[_0xe363('0x37')];if(_0x4b8238[_0xe363('0x33')]['includeAll']){_0x58b837['include']=[{'all':!![]}];}_0x58b837=_[_0xe363('0x41')]({},_0x58b837,_0x4b8238[_0xe363('0x43')]);return db[_0xe363('0x2f')]['find'](_0x58b837)[_0xe363('0x28')](handleEntityNotFound(_0x3da5ba,null))[_0xe363('0x28')](respondWithResult(_0x3da5ba,null))['catch'](handleError(_0x3da5ba,null));};exports['create']=function(_0x2a7b42,_0x34e08b){return db[_0xe363('0x2f')][_0xe363('0x4b')](_0x2a7b42['body'],{})[_0xe363('0x28')](respondWithResult(_0x34e08b,0xc9))[_0xe363('0x47')](handleError(_0x34e08b,null));};exports['update']=function(_0x4fbdbb,_0x306afd){if(_0x4fbdbb[_0xe363('0x4c')]['id']){delete _0x4fbdbb['body']['id'];}return db[_0xe363('0x2f')]['find']({'where':{'id':_0x4fbdbb[_0xe363('0x4d')]['id']}})[_0xe363('0x28')](handleEntityNotFound(_0x306afd,null))['then'](saveUpdates(_0x4fbdbb[_0xe363('0x4c')],null))[_0xe363('0x28')](respondWithResult(_0x306afd,null))['catch'](handleError(_0x306afd,null));};exports[_0xe363('0x29')]=function(_0x43ee23,_0x55f0e6){return db[_0xe363('0x2f')]['find']({'where':{'id':_0x43ee23[_0xe363('0x4d')]['id']}})[_0xe363('0x28')](handleEntityNotFound(_0x55f0e6,null))[_0xe363('0x28')](removeEntity(_0x55f0e6,null))[_0xe363('0x47')](handleError(_0x55f0e6,null));};exports['describe']=function(_0x2ff064,_0x225a43){return db[_0xe363('0x2f')]['describe']()[_0xe363('0x28')](respondWithResult(_0x225a43,null))[_0xe363('0x47')](handleError(_0x225a43,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e1fbcc4..4bcb944 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 _0xa878=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird'];(function(_0x3e0074,_0x4e3476){var _0x88ab2f=function(_0x595955){while(--_0x595955){_0x3e0074['push'](_0x3e0074['shift']());}};_0x88ab2f(++_0x4e3476);}(_0xa878,0x79));var _0x8a87=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa878[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x8a87('0x0'));var logger=require(_0x8a87('0x1'))(_0x8a87('0x2'));var moment=require(_0x8a87('0x3'));var BPromise=require(_0x8a87('0x4'));var rp=require(_0x8a87('0x5'));var fs=require('fs');var path=require(_0x8a87('0x6'));var rimraf=require(_0x8a87('0x7'));var config=require(_0x8a87('0x8'));var attributes=require(_0x8a87('0x9'));module[_0x8a87('0xa')]=function(_0x47ec2,_0x4c4b38){return _0x47ec2[_0x8a87('0xb')](_0x8a87('0xc'),attributes,{'tableName':_0x8a87('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd04e=['util','api','moment','bluebird','request-promise','rimraf','exports','define','JscriptyAnswerReport','lodash'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0xd04e,0x1f3));var _0xed04=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd04e[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xed04('0x0'));var util=require(_0xed04('0x1'));var logger=require('../../config/logger')(_0xed04('0x2'));var moment=require(_0xed04('0x3'));var BPromise=require(_0xed04('0x4'));var rp=require(_0xed04('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed04('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xed04('0x7')]=function(_0x290efa,_0x451d54){return _0x290efa[_0xed04('0x8')](_0xed04('0x9'),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 3075984..ec16a5d 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 _0x670d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3de87a,_0x3be11d){var _0x288ce3=function(_0x52114b){while(--_0x52114b){_0x3de87a['push'](_0x3de87a['shift']());}};_0x288ce3(++_0x3be11d);}(_0x670d,0x166));var _0xd670=function(_0x48f06c,_0x43536d){_0x48f06c=_0x48f06c-0x0;var _0x1baa84=_0x670d[_0x48f06c];return _0x1baa84;};'use strict';var _=require(_0xd670('0x0'));var util=require(_0xd670('0x1'));var moment=require(_0xd670('0x2'));var BPromise=require(_0xd670('0x3'));var rs=require(_0xd670('0x4'));var fs=require('fs');var Redis=require(_0xd670('0x5'));var db=require(_0xd670('0x6'))['db'];var utils=require(_0xd670('0x7'));var logger=require(_0xd670('0x8'))(_0xd670('0x9'));var config=require(_0xd670('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd670('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8b16,_0x579705,_0x3a3dce){return new BPromise(function(_0x5e10f8,_0x44f970){return client[_0xd670('0xc')](_0x3a8b16,_0x3a3dce)[_0xd670('0xd')](function(_0x39d99a){logger[_0xd670('0xe')](_0xd670('0xf'),_0x579705,_0xd670('0x10'));logger[_0xd670('0x11')](_0xd670('0x12'),_0x579705,_0xd670('0x10'),JSON[_0xd670('0x13')](_0x39d99a));if(_0x39d99a[_0xd670('0x14')]){if(_0x39d99a[_0xd670('0x14')]['code']===0x1f4){logger[_0xd670('0x14')](_0xd670('0xf'),_0x579705,_0x39d99a['error']['message']);return _0x44f970(_0x39d99a['error']['message']);}logger[_0xd670('0x14')](_0xd670('0xf'),_0x579705,_0x39d99a[_0xd670('0x14')][_0xd670('0x15')]);return _0x5e10f8(_0x39d99a[_0xd670('0x14')][_0xd670('0x15')]);}else{logger['info'](_0xd670('0xf'),_0x579705,_0xd670('0x10'));_0x5e10f8(_0x39d99a[_0xd670('0x16')][_0xd670('0x15')]);}})[_0xd670('0x17')](function(_0x367bf6){logger[_0xd670('0x14')](_0xd670('0xf'),_0x579705,_0x367bf6);_0x44f970(_0x367bf6);});});} \ No newline at end of file +var _0x049c=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x96ab8f,_0x549a90){var _0x123b8a=function(_0x381f3f){while(--_0x381f3f){_0x96ab8f['push'](_0x96ab8f['shift']());}};_0x123b8a(++_0x549a90);}(_0x049c,0x7f));var _0xc049=function(_0x3c694f,_0x57c1f9){_0x3c694f=_0x3c694f-0x0;var _0x3fd06e=_0x049c[_0x3c694f];return _0x3fd06e;};'use strict';var _=require(_0xc049('0x0'));var util=require(_0xc049('0x1'));var moment=require('moment');var BPromise=require(_0xc049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc049('0x3'));var db=require(_0xc049('0x4'))['db'];var utils=require(_0xc049('0x5'));var logger=require(_0xc049('0x6'))(_0xc049('0x7'));var config=require(_0xc049('0x8'));var jayson=require(_0xc049('0x9'));var client=jayson['client'][_0xc049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xffa094,_0x59fa79,_0xe3d581){return new BPromise(function(_0x5799ad,_0x226e5b){return client[_0xc049('0xb')](_0xffa094,_0xe3d581)[_0xc049('0xc')](function(_0x5f33cb){logger[_0xc049('0xd')](_0xc049('0xe'),_0x59fa79,_0xc049('0xf'));logger['debug'](_0xc049('0x10'),_0x59fa79,_0xc049('0xf'),JSON['stringify'](_0x5f33cb));if(_0x5f33cb[_0xc049('0x11')]){if(_0x5f33cb[_0xc049('0x11')][_0xc049('0x12')]===0x1f4){logger[_0xc049('0x11')](_0xc049('0xe'),_0x59fa79,_0x5f33cb[_0xc049('0x11')][_0xc049('0x13')]);return _0x226e5b(_0x5f33cb[_0xc049('0x11')][_0xc049('0x13')]);}logger['error'](_0xc049('0xe'),_0x59fa79,_0x5f33cb[_0xc049('0x11')][_0xc049('0x13')]);return _0x5799ad(_0x5f33cb[_0xc049('0x11')][_0xc049('0x13')]);}else{logger[_0xc049('0xd')](_0xc049('0xe'),_0x59fa79,_0xc049('0xf'));_0x5799ad(_0x5f33cb[_0xc049('0x14')]['message']);}})['catch'](function(_0x4b5e39){logger['error'](_0xc049('0xe'),_0x59fa79,_0x4b5e39);_0x226e5b(_0x4b5e39);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d249b7f..10a984b 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 _0x9e0f=['show','/:id/sessions','getSessions','/:id/answers','getAnswers','post','create','/:id/clone','clone','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x4eaf54,_0x5dca5b){var _0x24d2a7=function(_0x2637c9){while(--_0x2637c9){_0x4eaf54['push'](_0x4eaf54['shift']());}};_0x24d2a7(++_0x5dca5b);}(_0x9e0f,0x84));var _0xf9e0=function(_0x210775,_0x29d4fe){_0x210775=_0x210775-0x0;var _0xbbffde=_0x9e0f[_0x210775];return _0xbbffde;};'use strict';var multer=require('multer');var util=require(_0xf9e0('0x0'));var path=require(_0xf9e0('0x1'));var timeout=require(_0xf9e0('0x2'));var express=require(_0xf9e0('0x3'));var router=express[_0xf9e0('0x4')]();var fs_extra=require(_0xf9e0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf9e0('0x6'));var config=require('../../config/environment');var controller=require(_0xf9e0('0x7'));router[_0xf9e0('0x8')]('/',auth[_0xf9e0('0x9')](),controller[_0xf9e0('0xa')]);router[_0xf9e0('0x8')](_0xf9e0('0xb'),auth[_0xf9e0('0x9')](),controller[_0xf9e0('0xc')]);router[_0xf9e0('0x8')](_0xf9e0('0xd'),auth[_0xf9e0('0x9')](),controller[_0xf9e0('0xe')]);router[_0xf9e0('0x8')](_0xf9e0('0xf'),auth[_0xf9e0('0x9')](),controller[_0xf9e0('0x10')]);router[_0xf9e0('0x8')]('/:id/summary',auth[_0xf9e0('0x9')](),timeout('30s'),controller['getSummary']);router[_0xf9e0('0x11')]('/',auth[_0xf9e0('0x9')](),controller[_0xf9e0('0x12')]);router[_0xf9e0('0x11')](_0xf9e0('0x13'),auth[_0xf9e0('0x9')](),controller[_0xf9e0('0x14')]);router['put'](_0xf9e0('0xb'),auth[_0xf9e0('0x9')](),controller['update']);router[_0xf9e0('0x15')](_0xf9e0('0xb'),auth[_0xf9e0('0x9')](),controller[_0xf9e0('0x16')]);module[_0xf9e0('0x17')]=router; \ No newline at end of file +var _0xe83c=['./jscriptyProject.controller','isAuthenticated','index','get','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','clone','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2b877e,_0x5927c0){var _0x346651=function(_0x5bc87){while(--_0x5bc87){_0x2b877e['push'](_0x2b877e['shift']());}};_0x346651(++_0x5927c0);}(_0xe83c,0xaa));var _0xce83=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0xe83c[_0x2b9e8a];return _0x520e67;};'use strict';var multer=require(_0xce83('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xce83('0x1'));var express=require(_0xce83('0x2'));var router=express[_0xce83('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xce83('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce83('0x5'));var controller=require(_0xce83('0x6'));router['get']('/',auth[_0xce83('0x7')](),controller[_0xce83('0x8')]);router[_0xce83('0x9')](_0xce83('0xa'),auth[_0xce83('0x7')](),controller['show']);router['get'](_0xce83('0xb'),auth[_0xce83('0x7')](),controller[_0xce83('0xc')]);router[_0xce83('0x9')](_0xce83('0xd'),auth[_0xce83('0x7')](),controller[_0xce83('0xe')]);router[_0xce83('0x9')]('/:id/summary',auth[_0xce83('0x7')](),timeout(_0xce83('0xf')),controller[_0xce83('0x10')]);router[_0xce83('0x11')]('/',auth[_0xce83('0x7')](),controller['create']);router[_0xce83('0x11')]('/:id/clone',auth[_0xce83('0x7')](),controller[_0xce83('0x12')]);router['put'](_0xce83('0xa'),auth[_0xce83('0x7')](),controller[_0xce83('0x13')]);router['delete'](_0xce83('0xa'),auth[_0xce83('0x7')](),controller[_0xce83('0x14')]);module[_0xce83('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 412c5c5..e9857ae 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 _0x272a=['BOOLEAN','lodash','util','STRING','name','TEXT','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x272a,0x7f));var _0xa272=function(_0x54c51e,_0x2a7547){_0x54c51e=_0x54c51e-0x0;var _0x527506=_0x272a[_0x54c51e];return _0x527506;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa272('0x0'));var util=require(_0xa272('0x1'));module['exports']={'name':{'type':Sequelize[_0xa272('0x2')],'unique':_0xa272('0x3')},'description':{'type':Sequelize[_0xa272('0x2')]},'formData':{'type':Sequelize[_0xa272('0x4')]('long'),'set':function(_0x55a29b){if(_['isObjectLike'](_0x55a29b)){this['setDataValue'](_0xa272('0x5'),JSON[_0xa272('0x6')](_0x55a29b));}else if(_[_0xa272('0x7')](_0x55a29b)){this[_0xa272('0x8')](_0xa272('0x5'),_0x55a29b);}else{this[_0xa272('0x8')](_0xa272('0x5'),util[_0xa272('0x9')](_0xa272('0xa'),this[_0xa272('0xb')](_0xa272('0x3'))||'',this[_0xa272('0xb')](_0xa272('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa272('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa272('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x64e0=['formData','description','BOOLEAN','lodash','util','exports','name','long','isObjectLike','setDataValue','stringify','isString'];(function(_0x19e38e,_0xb15cc7){var _0x14bec3=function(_0xd38dd3){while(--_0xd38dd3){_0x19e38e['push'](_0x19e38e['shift']());}};_0x14bec3(++_0xb15cc7);}(_0x64e0,0xff));var _0x064e=function(_0x189eab,_0x2d1178){_0x189eab=_0x189eab-0x0;var _0x4513dc=_0x64e0[_0x189eab];return _0x4513dc;};'use strict';var Sequelize=require('sequelize');var _=require(_0x064e('0x0'));var util=require(_0x064e('0x1'));module[_0x064e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x064e('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x064e('0x4')),'set':function(_0x4df519){if(_[_0x064e('0x5')](_0x4df519)){this[_0x064e('0x6')]('formData',JSON[_0x064e('0x7')](_0x4df519));}else if(_[_0x064e('0x8')](_0x4df519)){this['setDataValue']('formData',_0x4df519);}else{this[_0x064e('0x6')](_0x064e('0x9'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x064e('0x3'))||'',this['getDataValue'](_0x064e('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x064e('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x064e('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1f3cbdd..c292f5b 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 _0xd61e=['json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','JscriptyProject','findAll','catch','show','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','length','omit','createdAt','updatedAt','userProfileId','UserProfileResource','update','getSessions','findOne','JscriptySessionReport','rawAttributes','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','sendStatus','end','status'];(function(_0x95008f,_0x3eb101){var _0x514c6b=function(_0x5deef8){while(--_0x5deef8){_0x95008f['push'](_0x95008f['shift']());}};_0x514c6b(++_0x3eb101);}(_0xd61e,0x13d));var _0xed61=function(_0xfd26d0,_0xc3b15c){_0xfd26d0=_0xfd26d0-0x0;var _0x2f03c1=_0xd61e[_0xfd26d0];return _0x2f03c1;};'use strict';var emlformat=require(_0xed61('0x0'));var rimraf=require(_0xed61('0x1'));var zipdir=require(_0xed61('0x2'));var jsonpatch=require(_0xed61('0x3'));var rp=require(_0xed61('0x4'));var moment=require(_0xed61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed61('0x6'));var util=require(_0xed61('0x7'));var path=require(_0xed61('0x8'));var sox=require(_0xed61('0x9'));var csv=require(_0xed61('0xa'));var ejs=require(_0xed61('0xb'));var fs=require('fs');var fs_extra=require(_0xed61('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed61('0xa'));var querystring=require(_0xed61('0xd'));var Papa=require(_0xed61('0xe'));var Redis=require(_0xed61('0xf'));var authService=require(_0xed61('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed61('0x11'))(_0xed61('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeedb63,_0x21511d){_0x21511d=_0x21511d||0xcc;return function(_0x19c74c){if(_0x19c74c){return _0xeedb63[_0xed61('0x13')](_0x21511d);}return _0xeedb63['status'](_0x21511d)[_0xed61('0x14')]();};}function respondWithResult(_0x28f4cb,_0xe08d33){_0xe08d33=_0xe08d33||0xc8;return function(_0x4ac6e2){if(_0x4ac6e2){return _0x28f4cb[_0xed61('0x15')](_0xe08d33)[_0xed61('0x16')](_0x4ac6e2);}};}function respondWithFilteredResult(_0x16fa20,_0x2ad52a){return function(_0x4d3930){if(_0x4d3930){var _0x15198a=typeof _0x2ad52a[_0xed61('0x17')]===_0xed61('0x18')&&typeof _0x2ad52a[_0xed61('0x19')]==='undefined';var _0x39b1d1=_0x4d3930[_0xed61('0x1a')];var _0x4bd841=_0x15198a?0x0:_0x2ad52a[_0xed61('0x17')];var _0x11a277=_0x15198a?_0x4d3930[_0xed61('0x1a')]:_0x2ad52a['offset']+_0x2ad52a[_0xed61('0x19')];var _0xb7879f;if(_0x11a277>=_0x39b1d1){_0x11a277=_0x39b1d1;_0xb7879f=0xc8;}else{_0xb7879f=0xce;}_0x16fa20[_0xed61('0x15')](_0xb7879f);return _0x16fa20['set'](_0xed61('0x1b'),_0x4bd841+'-'+_0x11a277+'/'+_0x39b1d1)[_0xed61('0x16')](_0x4d3930);}return null;};}function patchUpdates(_0xce408c){return function(_0x5ee0b9){try{jsonpatch[_0xed61('0x1c')](_0x5ee0b9,_0xce408c,!![]);}catch(_0x16d63a){return BPromise['reject'](_0x16d63a);}return _0x5ee0b9[_0xed61('0x1d')]();};}function saveUpdates(_0x315020,_0x864dfa){return function(_0x5f3d0f){if(_0x5f3d0f){return _0x5f3d0f['update'](_0x315020)[_0xed61('0x1e')](function(_0x544d49){return _0x544d49;});}return null;};}function removeEntity(_0xa17a06,_0x217e93){return function(_0x2722d0){if(_0x2722d0){return _0x2722d0[_0xed61('0x1f')]()[_0xed61('0x1e')](function(){var _0x5a71f0=_0x2722d0['get']({'plain':!![]});var _0x4a3e02='Projects';return db['UserProfileResource'][_0xed61('0x1f')]({'where':{'type':_0x4a3e02,'resourceId':_0x5a71f0['id']}})['then'](function(){return _0x2722d0;});})[_0xed61('0x1e')](function(){_0xa17a06[_0xed61('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x503bc7,_0x14d140){return function(_0xca7c0c){if(!_0xca7c0c){_0x503bc7[_0xed61('0x13')](0x194);}return _0xca7c0c;};}function handleError(_0x5b83b2,_0x20de9b){_0x20de9b=_0x20de9b||0x1f4;return function(_0xd809ce){logger[_0xed61('0x20')](_0xd809ce['stack']);if(_0xd809ce[_0xed61('0x21')]){delete _0xd809ce['name'];}_0x5b83b2[_0xed61('0x15')](_0x20de9b)[_0xed61('0x22')](_0xd809ce);};}exports[_0xed61('0x23')]=function(_0x50b19d,_0x260ac4){var _0xa5a8aa={},_0x2f23d5={},_0x690795={'count':0x0,'rows':[]};var _0x4b1294=_[_0xed61('0x24')](db['JscriptyProject']['rawAttributes'],function(_0x2df5b6){return{'name':_0x2df5b6[_0xed61('0x25')],'type':_0x2df5b6[_0xed61('0x26')][_0xed61('0x27')]};});_0x2f23d5['model']=_['map'](_0x4b1294,_0xed61('0x21'));_0x2f23d5[_0xed61('0x28')]=_[_0xed61('0x29')](_0x50b19d[_0xed61('0x28')]);_0x2f23d5[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x2f23d5[_0xed61('0x2c')],_0x2f23d5['query']);_0xa5a8aa['attributes']=_[_0xed61('0x2b')](_0x2f23d5['model'],qs[_0xed61('0x2d')](_0x50b19d['query']['fields']));_0xa5a8aa['attributes']=_0xa5a8aa['attributes']['length']?_0xa5a8aa[_0xed61('0x2e')]:_0x2f23d5[_0xed61('0x2c')];if(!_0x50b19d[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0xa5a8aa[_0xed61('0x19')]=qs[_0xed61('0x19')](_0x50b19d[_0xed61('0x28')]['limit']);_0xa5a8aa['offset']=qs[_0xed61('0x17')](_0x50b19d[_0xed61('0x28')][_0xed61('0x17')]);}_0xa5a8aa[_0xed61('0x31')]=qs['sort'](_0x50b19d[_0xed61('0x28')][_0xed61('0x32')]);_0xa5a8aa['where']=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x50b19d[_0xed61('0x28')],_0x2f23d5[_0xed61('0x2a')]),_0x4b1294);if(_0x50b19d['query'][_0xed61('0x34')]){_0xa5a8aa[_0xed61('0x35')]=_[_0xed61('0x36')](_0xa5a8aa[_0xed61('0x35')],{'$or':_[_0xed61('0x24')](_0x4b1294,function(_0x23d66d){if(_0x23d66d[_0xed61('0x26')]!=='VIRTUAL'){var _0x3abfa6={};_0x3abfa6[_0x23d66d[_0xed61('0x21')]]={'$like':'%'+_0x50b19d[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x3abfa6;}})});}_0xa5a8aa=_[_0xed61('0x36')]({},_0xa5a8aa,_0x50b19d[_0xed61('0x37')]);var _0x35ad22={'where':_0xa5a8aa[_0xed61('0x35')]};return db[_0xed61('0x38')][_0xed61('0x1a')](_0x35ad22)[_0xed61('0x1e')](function(_0x16720e){_0x690795[_0xed61('0x1a')]=_0x16720e;if(_0x50b19d[_0xed61('0x28')]['includeAll']){_0xa5a8aa['include']=[{'all':!![]}];}return db[_0xed61('0x38')][_0xed61('0x39')](_0xa5a8aa);})['then'](function(_0x5b9bef){_0x690795['rows']=_0x5b9bef;return _0x690795;})['then'](respondWithFilteredResult(_0x260ac4,_0xa5a8aa))[_0xed61('0x3a')](handleError(_0x260ac4,null));};exports[_0xed61('0x3b')]=function(_0xd92795,_0x16ac3f){var _0x434384={'raw':![],'where':{'id':_0xd92795['params']['id']}},_0x41e094={};_0x41e094[_0xed61('0x2c')]=_[_0xed61('0x29')](db[_0xed61('0x38')]['rawAttributes']);_0x41e094[_0xed61('0x28')]=_[_0xed61('0x29')](_0xd92795[_0xed61('0x28')]);_0x41e094[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x41e094['model'],_0x41e094['query']);_0x434384[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x41e094[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0xd92795['query'][_0xed61('0x2d')]));_0x434384[_0xed61('0x2e')]=_0x434384[_0xed61('0x2e')]['length']?_0x434384[_0xed61('0x2e')]:_0x41e094[_0xed61('0x2c')];if(_0xd92795['query'][_0xed61('0x3c')]){_0x434384[_0xed61('0x3d')]=[{'all':!![]}];}_0x434384=_[_0xed61('0x36')]({},_0x434384,_0xd92795[_0xed61('0x37')]);return db[_0xed61('0x38')][_0xed61('0x3e')](_0x434384)[_0xed61('0x1e')](handleEntityNotFound(_0x16ac3f,null))[_0xed61('0x1e')](respondWithResult(_0x16ac3f,null))[_0xed61('0x3a')](handleError(_0x16ac3f,null));};exports[_0xed61('0x3f')]=function(_0x2bf758,_0x3a6693){return db[_0xed61('0x38')][_0xed61('0x3f')](_0x2bf758[_0xed61('0x40')],{})[_0xed61('0x1e')](function(_0x38059f){var _0x43031b=_0x2bf758[_0xed61('0x41')][_0xed61('0x42')]({'plain':!![]});if(!_0x43031b)throw new Error(_0xed61('0x43'));if(_0x43031b[_0xed61('0x44')]===_0xed61('0x41')){var _0x4908f3=_0x38059f['get']({'plain':!![]});var _0x28950f=_0xed61('0x45');return db[_0xed61('0x46')][_0xed61('0x3e')]({'where':{'name':_0x28950f,'userProfileId':_0x43031b['userProfileId']},'raw':!![]})[_0xed61('0x1e')](function(_0x3ec791){if(_0x3ec791&&_0x3ec791[_0xed61('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x4908f3['name'],'resourceId':_0x4908f3['id'],'type':_0x3ec791[_0xed61('0x21')],'sectionId':_0x3ec791['id']},{})[_0xed61('0x1e')](function(){return _0x38059f;});}else{return _0x38059f;}})[_0xed61('0x3a')](function(_0x1d3b9d){logger[_0xed61('0x20')](_0xed61('0x48'),_0x1d3b9d);throw _0x1d3b9d;});}return _0x38059f;})[_0xed61('0x1e')](respondWithResult(_0x3a6693,0xc9))[_0xed61('0x3a')](handleError(_0x3a6693,null));};exports['clone']=function(_0x2bb9b9,_0x258a40){var _0x4c1762={'where':{'id':_0x2bb9b9[_0xed61('0x49')]['id']}},_0x116eea={};_0x116eea[_0xed61('0x2c')]=_['keys'](db[_0xed61('0x38')]['rawAttributes']);_0x4c1762[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x116eea[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0x2bb9b9[_0xed61('0x28')][_0xed61('0x2d')]));_0x4c1762[_0xed61('0x2e')]=_0x4c1762['attributes'][_0xed61('0x4a')]?_0x4c1762[_0xed61('0x2e')]:_0x116eea[_0xed61('0x2c')];if(_0x2bb9b9[_0xed61('0x28')][_0xed61('0x3c')]){_0x4c1762[_0xed61('0x3d')]=[{'all':!![]}];}_0x4c1762=_['merge']({},_0x4c1762,_0x2bb9b9[_0xed61('0x37')]);return db['JscriptyProject'][_0xed61('0x3e')](_0x4c1762)['then'](handleEntityNotFound(_0x258a40,null))[_0xed61('0x1e')](function(_0x44588a){if(_0x44588a){var _0x591909=_0x44588a[_0xed61('0x42')]({'plain':!![]});_0x591909=qs[_0xed61('0x4b')](_0x591909,['id',_0xed61('0x4c'),_0xed61('0x4d')]);_0x2bb9b9[_0xed61('0x40')]=_['omit'](_0x2bb9b9[_0xed61('0x40')],['id',_0xed61('0x4c'),_0xed61('0x4d')]);return db[_0xed61('0x38')][_0xed61('0x3f')](_[_0xed61('0x36')](_0x591909,_0x2bb9b9[_0xed61('0x40')]),{'include':_0x2bb9b9['query']['includeAll']?[{'all':!![]}]:undefined})[_0xed61('0x1e')](function(_0x4729f3){var _0xcd868e=_0x2bb9b9[_0xed61('0x41')][_0xed61('0x42')]({'plain':!![]});if(!_0xcd868e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcd868e[_0xed61('0x44')]===_0xed61('0x41')){var _0x4efb8f=_0x4729f3['get']({'plain':!![]});var _0x22f3d1=_0xed61('0x45');return db[_0xed61('0x46')][_0xed61('0x3e')]({'where':{'name':_0x22f3d1,'userProfileId':_0xcd868e[_0xed61('0x4e')]},'raw':!![]})['then'](function(_0x55ef0b){if(_0x55ef0b&&_0x55ef0b[_0xed61('0x47')]===0x0){return db[_0xed61('0x4f')][_0xed61('0x3f')]({'name':_0x4efb8f[_0xed61('0x21')],'resourceId':_0x4efb8f['id'],'type':_0x55ef0b[_0xed61('0x21')],'sectionId':_0x55ef0b['id']},{})[_0xed61('0x1e')](function(){return _0x4729f3;});}else{return _0x4729f3;}})[_0xed61('0x3a')](function(_0x2882a0){logger[_0xed61('0x20')](_0xed61('0x48'),_0x2882a0);throw _0x2882a0;});}return _0x4729f3;});}})['then'](respondWithResult(_0x258a40,0xc9))[_0xed61('0x3a')](handleError(_0x258a40,null));};exports[_0xed61('0x50')]=function(_0x5aeffd,_0x298a12){if(_0x5aeffd[_0xed61('0x40')]['id']){delete _0x5aeffd[_0xed61('0x40')]['id'];}return db[_0xed61('0x38')][_0xed61('0x3e')]({'where':{'id':_0x5aeffd['params']['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x298a12,null))['then'](saveUpdates(_0x5aeffd['body'],null))[_0xed61('0x1e')](respondWithResult(_0x298a12,null))[_0xed61('0x3a')](handleError(_0x298a12,null));};exports[_0xed61('0x1f')]=function(_0x5e862d,_0x1dc280){return db[_0xed61('0x38')][_0xed61('0x3e')]({'where':{'id':_0x5e862d[_0xed61('0x49')]['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x1dc280,null))['then'](removeEntity(_0x1dc280,null))['catch'](handleError(_0x1dc280,null));};exports[_0xed61('0x51')]=function(_0x32f435,_0xb952c,_0x21ab9c){var _0x32db02={'raw':!![],'where':{}};var _0x5d5d15={};var _0xe89a4={'count':0x0,'rows':[]};return db[_0xed61('0x38')][_0xed61('0x52')]({'where':{'id':_0x32f435[_0xed61('0x49')]['id']}})['then'](handleEntityNotFound(_0xb952c,null))[_0xed61('0x1e')](function(_0x2efa4a){if(_0x2efa4a){_0x5d5d15['model']=_[_0xed61('0x29')](db[_0xed61('0x53')][_0xed61('0x54')]);_0x5d5d15[_0xed61('0x28')]=_[_0xed61('0x29')](_0x32f435[_0xed61('0x28')]);_0x5d5d15[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x5d5d15[_0xed61('0x2c')],_0x5d5d15[_0xed61('0x28')]);_0x32db02['attributes']=_['intersection'](_0x5d5d15[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0x32f435[_0xed61('0x28')]['fields']));_0x32db02['attributes']=_0x32db02[_0xed61('0x2e')][_0xed61('0x4a')]?_0x32db02[_0xed61('0x2e')]:_0x5d5d15[_0xed61('0x2c')];if(!_0x32f435[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0x32db02[_0xed61('0x19')]=qs[_0xed61('0x19')](_0x32f435['query'][_0xed61('0x19')]);_0x32db02[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x32f435[_0xed61('0x28')][_0xed61('0x17')]);}_0x32db02[_0xed61('0x31')]=qs[_0xed61('0x32')](_0x32f435[_0xed61('0x28')]['sort']);_0x32db02[_0xed61('0x35')]=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x32f435[_0xed61('0x28')],_0x5d5d15[_0xed61('0x2a')]));_0x32db02[_0xed61('0x35')][_0xed61('0x55')]=_0x2efa4a['id'];if(_0x32f435[_0xed61('0x28')][_0xed61('0x34')]){_0x32db02[_0xed61('0x35')]=_[_0xed61('0x36')](_0x32db02[_0xed61('0x35')],{'$or':_[_0xed61('0x24')](_0x32db02[_0xed61('0x2e')],function(_0x11af28){var _0x56d2c2={};_0x56d2c2[_0x11af28]={'$like':'%'+_0x32f435[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x56d2c2;})});}_0x32db02=_[_0xed61('0x36')]({},_0x32db02,_0x32f435[_0xed61('0x37')]);return db[_0xed61('0x53')][_0xed61('0x1a')]({'where':_0x32db02['where']})[_0xed61('0x1e')](function(_0x2cfcad){_0xe89a4[_0xed61('0x1a')]=_0x2cfcad;if(_0x32f435[_0xed61('0x28')][_0xed61('0x3c')]){_0x32db02[_0xed61('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xed61('0x39')](_0x32db02);})['then'](function(_0x2a67f3){_0xe89a4[_0xed61('0x56')]=_0x2a67f3;return _0xe89a4;});}})[_0xed61('0x1e')](respondWithFilteredResult(_0xb952c,_0x32db02))['catch'](handleError(_0xb952c,null));};exports[_0xed61('0x57')]=function(_0x5f1c64,_0x4fe78d,_0x1b1140){var _0x1dc2a5={'raw':!![],'where':{}};var _0x2d2037={};var _0x3dfa42={'count':0x0,'rows':[]};return db[_0xed61('0x38')][_0xed61('0x52')]({'where':{'id':_0x5f1c64[_0xed61('0x49')]['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x4fe78d,null))[_0xed61('0x1e')](function(_0x23d06d){if(_0x23d06d){_0x2d2037[_0xed61('0x2c')]=_[_0xed61('0x29')](db[_0xed61('0x58')][_0xed61('0x54')]);_0x2d2037[_0xed61('0x28')]=_[_0xed61('0x29')](_0x5f1c64[_0xed61('0x28')]);_0x2d2037[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x2d2037[_0xed61('0x2c')],_0x2d2037[_0xed61('0x28')]);_0x1dc2a5[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x2d2037['model'],qs['fields'](_0x5f1c64['query'][_0xed61('0x2d')]));_0x1dc2a5[_0xed61('0x2e')]=_0x1dc2a5['attributes'][_0xed61('0x4a')]?_0x1dc2a5[_0xed61('0x2e')]:_0x2d2037[_0xed61('0x2c')];if(!_0x5f1c64[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0x1dc2a5[_0xed61('0x19')]=qs['limit'](_0x5f1c64[_0xed61('0x28')][_0xed61('0x19')]);_0x1dc2a5[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x5f1c64[_0xed61('0x28')][_0xed61('0x17')]);}_0x1dc2a5[_0xed61('0x31')]=qs[_0xed61('0x32')](_0x5f1c64[_0xed61('0x28')]['sort']);_0x1dc2a5[_0xed61('0x35')]=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x5f1c64[_0xed61('0x28')],_0x2d2037[_0xed61('0x2a')]));_0x1dc2a5[_0xed61('0x35')]['ProjectId']=_0x23d06d['id'];if(_0x5f1c64['query']['filter']){_0x1dc2a5[_0xed61('0x35')]=_['merge'](_0x1dc2a5['where'],{'$or':_[_0xed61('0x24')](_0x1dc2a5['attributes'],function(_0x16ebc7){var _0x1cbabc={};_0x1cbabc[_0x16ebc7]={'$like':'%'+_0x5f1c64[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x1cbabc;})});}_0x1dc2a5=_[_0xed61('0x36')]({},_0x1dc2a5,_0x5f1c64[_0xed61('0x37')]);return db[_0xed61('0x58')]['count']({'where':_0x1dc2a5[_0xed61('0x35')]})[_0xed61('0x1e')](function(_0xe42f6){_0x3dfa42['count']=_0xe42f6;if(_0x5f1c64[_0xed61('0x28')][_0xed61('0x3c')]){_0x1dc2a5[_0xed61('0x3d')]=[{'all':!![]}];}return db[_0xed61('0x58')][_0xed61('0x39')](_0x1dc2a5);})[_0xed61('0x1e')](function(_0x320285){_0x3dfa42[_0xed61('0x56')]=_0x320285;return _0x3dfa42;});}})[_0xed61('0x1e')](respondWithFilteredResult(_0x4fe78d,_0x1dc2a5))[_0xed61('0x3a')](handleError(_0x4fe78d,null));};function char(_0xe8e904){return _0xed61('0x59')===typeof _0xe8e904?String[_0xed61('0x5a')][_0xed61('0x1c')](null,arguments):_0xe8e904;}function needsEncapsulation(_0x1a7f79){return!!_0x1a7f79&&(_0x1a7f79[_0xed61('0x5b')]()['indexOf'](char(0xd))>=0x0||_0x1a7f79[_0xed61('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x1a7f79[_0xed61('0x5b')]()[_0xed61('0x5c')](char(0x2c))>=0x0||_0x1a7f79[_0xed61('0x5b')]()[_0xed61('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x22a64a){var _0x5a74c5=char(0x22),_0x20aec3='\x5c'+char(0x22),_0x5eef48=_0x22a64a[_0xed61('0x5b')]()[_0xed61('0x5d')](new RegExp(_0x5a74c5,'g'),_0x20aec3);return _0x5a74c5+_0x5eef48+_0x5a74c5;}exports[_0xed61('0x5e')]=function(_0xe460f9,_0x32a763,_0x1cf2d9){var _0x351241,_0x508ed0;var _0x3c600a={'where':{'ProjectId':_0xe460f9[_0xed61('0x49')]['id']}};if(_0xe460f9[_0xed61('0x28')][_0xed61('0x5f')]){_0x3c600a['where']['starttime']=JSON['parse'](_0xe460f9[_0xed61('0x28')][_0xed61('0x5f')]);}return db['JscriptySessionReport']['findAll'](_0x3c600a)[_0xed61('0x1e')](handleEntityNotFound(_0x32a763,null))[_0xed61('0x1e')](function(_0x4313de){if(_0x4313de){_0x351241=_0x4313de;return db[_0xed61('0x60')][_0xed61('0x39')]({'where':{'SessionId':{'$in':_[_0xed61('0x24')](_0x351241,'id')},'ProjectId':_0xe460f9[_0xed61('0x49')]['id']},'order':_0xed61('0x61')});}})['then'](handleEntityNotFound(_0x32a763,null))[_0xed61('0x1e')](function(_0x4313d2){if(_0x4313d2){_0x508ed0=_0x4313d2;var _0x3f7eb1={};for(var _0x416931=0x0,_0x399f30=_0x508ed0['length'];_0x416931<_0x399f30;_0x416931++){if(!_0x3f7eb1['hasOwnProperty'](_0x508ed0[_0x416931]['questionId'])){_0x3f7eb1[_0x508ed0[_0x416931][_0xed61('0x62')]]=needsEncapsulation(_0x508ed0[_0x416931][_0xed61('0x63')])?encapsulate(_0x508ed0[_0x416931][_0xed61('0x63')]):_0x508ed0[_0x416931]['question'];}}var _0x499015=[],_0x10860e={};for(var _0x14a0e5=0x0,_0x1f07fd=_0x351241[_0xed61('0x4a')];_0x14a0e5<_0x1f07fd;_0x14a0e5++){_0x10860e={'ProjectId':_0xe460f9[_0xed61('0x49')]['id'],'SessionId':_0x351241[_0x14a0e5]['id'],'StartTime':moment(_0x351241[_0x14a0e5][_0xed61('0x64')])[_0xed61('0x65')](_0xed61('0x66'))};for(var _0x4f66e6=0x0,_0x47483f=_0x508ed0[_0xed61('0x4a')];_0x4f66e6<_0x47483f;_0x4f66e6++){if(_0x508ed0[_0x4f66e6][_0xed61('0x67')]==_0x351241[_0x14a0e5]['id']&&_0x3f7eb1[_0xed61('0x2f')](_0x508ed0[_0x4f66e6]['questionId'])){_0x10860e[_0x3f7eb1[_0x508ed0[_0x4f66e6][_0xed61('0x62')]]]=_0x508ed0[_0x4f66e6][_0xed61('0x68')];}}for(var _0x5a065c in _0x3f7eb1){if(!_0x10860e[_0xed61('0x2f')](_0x3f7eb1[_0x5a065c])){_0x10860e[_0x3f7eb1[_0x5a065c]]=null;}}_0x499015[_0xed61('0x69')](_0x10860e);}return _0x499015;}})[_0xed61('0x1e')](function(_0x1cd9b9){if(!_[_0xed61('0x6a')](_0x1cd9b9)){var _0x7c4425=toCsv(_0x1cd9b9);var _0xd7ae25=Date[_0xed61('0x6b')]();fs[_0xed61('0x6c')](util[_0xed61('0x65')](_0xed61('0x6d'),_0xe460f9[_0xed61('0x49')]['id'],_0xd7ae25),_0x7c4425);_0x32a763[_0xed61('0x6e')](_0xed61('0x6f'),_0xed61('0x70')+util[_0xed61('0x65')]('Jscripty_Project_%d_Summary_%s.csv',_0xe460f9['params']['id'],_0xd7ae25));_0x32a763[_0xed61('0x6e')]('Content-type','text/csv');return _0x32a763['download'](util[_0xed61('0x65')](_0xed61('0x6d'),_0xe460f9[_0xed61('0x49')]['id'],_0xd7ae25));}else{return _0x32a763[_0xed61('0x13')](0xcc);}})[_0xed61('0x3a')](handleError(_0x32a763,null));}; \ No newline at end of file +var _0xcf2f=['params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','omit','createdAt','updatedAt','autoAssociation','getSessions','findOne','nolimit','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','Projects','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','JscriptyProject','includeAll','rows','catch','show'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x50a516,_0x25788a){_0x50a516=_0x50a516-0x0;var _0x13b7db=_0xcf2f[_0x50a516];return _0x13b7db;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x1ba610,_0x175ac9){_0x175ac9=_0x175ac9||0xcc;return function(_0x1be8cc){if(_0x1be8cc){return _0x1ba610['sendStatus'](_0x175ac9);}return _0x1ba610[_0xfcf2('0x19')](_0x175ac9)['end']();};}function respondWithResult(_0x5b414a,_0x5dc04b){_0x5dc04b=_0x5dc04b||0xc8;return function(_0xc87ff4){if(_0xc87ff4){return _0x5b414a['status'](_0x5dc04b)[_0xfcf2('0x1a')](_0xc87ff4);}};}function respondWithFilteredResult(_0x1febf8,_0x245f9a){return function(_0x21f7d1){if(_0x21f7d1){var _0x315b2f=typeof _0x245f9a[_0xfcf2('0x1b')]===_0xfcf2('0x1c')&&typeof _0x245f9a['limit']===_0xfcf2('0x1c');var _0x213125=_0x21f7d1[_0xfcf2('0x1d')];var _0x581d78=_0x315b2f?0x0:_0x245f9a[_0xfcf2('0x1b')];var _0x1b3c89=_0x315b2f?_0x21f7d1[_0xfcf2('0x1d')]:_0x245f9a[_0xfcf2('0x1b')]+_0x245f9a[_0xfcf2('0x1e')];var _0x53c406;if(_0x1b3c89>=_0x213125){_0x1b3c89=_0x213125;_0x53c406=0xc8;}else{_0x53c406=0xce;}_0x1febf8[_0xfcf2('0x19')](_0x53c406);return _0x1febf8[_0xfcf2('0x1f')]('Content-Range',_0x581d78+'-'+_0x1b3c89+'/'+_0x213125)[_0xfcf2('0x1a')](_0x21f7d1);}return null;};}function patchUpdates(_0x23c079){return function(_0x206738){try{jsonpatch[_0xfcf2('0x20')](_0x206738,_0x23c079,!![]);}catch(_0x51e0b7){return BPromise[_0xfcf2('0x21')](_0x51e0b7);}return _0x206738[_0xfcf2('0x22')]();};}function saveUpdates(_0x422c5a,_0x1eeebd){return function(_0x5afab5){if(_0x5afab5){return _0x5afab5[_0xfcf2('0x23')](_0x422c5a)[_0xfcf2('0x24')](function(_0x232f6f){return _0x232f6f;});}return null;};}function removeEntity(_0x584e76,_0x26641a){return function(_0x151aa8){if(_0x151aa8){return _0x151aa8['destroy']()[_0xfcf2('0x24')](function(){var _0xbc8722=_0x151aa8['get']({'plain':!![]});var _0x1e6f14=_0xfcf2('0x25');return db[_0xfcf2('0x26')][_0xfcf2('0x27')]({'where':{'type':_0x1e6f14,'resourceId':_0xbc8722['id']}})['then'](function(){return _0x151aa8;});})[_0xfcf2('0x24')](function(){_0x584e76[_0xfcf2('0x19')](0xcc)[_0xfcf2('0x28')]();});}};}function handleEntityNotFound(_0x3779ee,_0x17c994){return function(_0x2b1d60){if(!_0x2b1d60){_0x3779ee[_0xfcf2('0x29')](0x194);}return _0x2b1d60;};}function handleError(_0x1c8f38,_0x23c09c){_0x23c09c=_0x23c09c||0x1f4;return function(_0x56f839){logger['error'](_0x56f839[_0xfcf2('0x2a')]);if(_0x56f839[_0xfcf2('0x2b')]){delete _0x56f839[_0xfcf2('0x2b')];}_0x1c8f38['status'](_0x23c09c)[_0xfcf2('0x2c')](_0x56f839);};}exports['index']=function(_0x3ce9f8,_0x26651e){var _0x40c1ae={},_0x1a4485={},_0x313884={'count':0x0,'rows':[]};var _0x3760ad=_[_0xfcf2('0x2d')](db['JscriptyProject']['rawAttributes'],function(_0xfc3b86){return{'name':_0xfc3b86[_0xfcf2('0x2e')],'type':_0xfc3b86[_0xfcf2('0x2f')][_0xfcf2('0x30')]};});_0x1a4485['model']=_['map'](_0x3760ad,_0xfcf2('0x2b'));_0x1a4485['query']=_[_0xfcf2('0x31')](_0x3ce9f8[_0xfcf2('0x32')]);_0x1a4485['filters']=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],_0x1a4485[_0xfcf2('0x32')]);_0x40c1ae[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x3ce9f8['query'][_0xfcf2('0x36')]));_0x40c1ae[_0xfcf2('0x35')]=_0x40c1ae['attributes'][_0xfcf2('0x37')]?_0x40c1ae[_0xfcf2('0x35')]:_0x1a4485['model'];if(!_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x40c1ae[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x40c1ae['offset']=qs[_0xfcf2('0x1b')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1b')]);}_0x40c1ae[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x3ce9f8['query'][_0xfcf2('0x3a')]);_0x40c1ae[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x3ce9f8[_0xfcf2('0x32')],_0x1a4485['filters']),_0x3760ad);if(_0x3ce9f8[_0xfcf2('0x32')]['filter']){_0x40c1ae[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x40c1ae[_0xfcf2('0x3b')],{'$or':_[_0xfcf2('0x2d')](_0x3760ad,function(_0x2fd2ef){if(_0x2fd2ef['type']!==_0xfcf2('0x3f')){var _0x341505={};_0x341505[_0x2fd2ef[_0xfcf2('0x2b')]]={'$like':'%'+_0x3ce9f8['query'][_0xfcf2('0x40')]+'%'};return _0x341505;}})});}_0x40c1ae=_[_0xfcf2('0x3e')]({},_0x40c1ae,_0x3ce9f8[_0xfcf2('0x41')]);var _0x320c19={'where':_0x40c1ae[_0xfcf2('0x3b')]};return db[_0xfcf2('0x42')]['count'](_0x320c19)['then'](function(_0x526c42){_0x313884[_0xfcf2('0x1d')]=_0x526c42;if(_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x40c1ae['include']=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x40c1ae);})[_0xfcf2('0x24')](function(_0xab0747){_0x313884[_0xfcf2('0x44')]=_0xab0747;return _0x313884;})[_0xfcf2('0x24')](respondWithFilteredResult(_0x26651e,_0x40c1ae))[_0xfcf2('0x45')](handleError(_0x26651e,null));};exports[_0xfcf2('0x46')]=function(_0x2c8ba2,_0x16cc21){var _0x2b790b={'raw':![],'where':{'id':_0x2c8ba2[_0xfcf2('0x47')]['id']}},_0x467ecd={};_0x467ecd['model']=_['keys'](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x467ecd[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2c8ba2[_0xfcf2('0x32')]);_0x467ecd[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],_0x467ecd[_0xfcf2('0x32')]);_0x2b790b[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x2c8ba2[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x2b790b[_0xfcf2('0x35')]=_0x2b790b[_0xfcf2('0x35')]['length']?_0x2b790b[_0xfcf2('0x35')]:_0x467ecd[_0xfcf2('0x34')];if(_0x2c8ba2['query'][_0xfcf2('0x43')]){_0x2b790b['include']=[{'all':!![]}];}_0x2b790b=_[_0xfcf2('0x3e')]({},_0x2b790b,_0x2c8ba2[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x2b790b)['then'](handleEntityNotFound(_0x16cc21,null))['then'](respondWithResult(_0x16cc21,null))['catch'](handleError(_0x16cc21,null));};exports[_0xfcf2('0x4a')]=function(_0x37d4bb,_0x20fcab){return db[_0xfcf2('0x42')]['create'](_0x37d4bb[_0xfcf2('0x4b')],{})[_0xfcf2('0x24')](function(_0x3b981c){var _0x548c6c=_0x37d4bb[_0xfcf2('0x4c')][_0xfcf2('0x4d')]({'plain':!![]});if(!_0x548c6c)throw new Error(_0xfcf2('0x4e'));if(_0x548c6c[_0xfcf2('0x4f')]===_0xfcf2('0x4c')){var _0x4af270=_0x3b981c[_0xfcf2('0x4d')]({'plain':!![]});var _0x1260a4=_0xfcf2('0x25');return db[_0xfcf2('0x50')][_0xfcf2('0x49')]({'where':{'name':_0x1260a4,'userProfileId':_0x548c6c[_0xfcf2('0x51')]},'raw':!![]})['then'](function(_0x5d162d){if(_0x5d162d&&_0x5d162d['autoAssociation']===0x0){return db[_0xfcf2('0x26')][_0xfcf2('0x4a')]({'name':_0x4af270['name'],'resourceId':_0x4af270['id'],'type':_0x5d162d['name'],'sectionId':_0x5d162d['id']},{})[_0xfcf2('0x24')](function(){return _0x3b981c;});}else{return _0x3b981c;}})[_0xfcf2('0x45')](function(_0x137a47){logger['error'](_0xfcf2('0x52'),_0x137a47);throw _0x137a47;});}return _0x3b981c;})[_0xfcf2('0x24')](respondWithResult(_0x20fcab,0xc9))['catch'](handleError(_0x20fcab,null));};exports['clone']=function(_0xfc4b7b,_0x51f636){var _0x222354={'where':{'id':_0xfc4b7b['params']['id']}},_0x418807={};_0x418807[_0xfcf2('0x34')]=_['keys'](db[_0xfcf2('0x42')]['rawAttributes']);_0x222354[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x418807[_0xfcf2('0x34')],qs['fields'](_0xfc4b7b[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x222354[_0xfcf2('0x35')]=_0x222354[_0xfcf2('0x35')][_0xfcf2('0x37')]?_0x222354[_0xfcf2('0x35')]:_0x418807[_0xfcf2('0x34')];if(_0xfc4b7b['query'][_0xfcf2('0x43')]){_0x222354[_0xfcf2('0x53')]=[{'all':!![]}];}_0x222354=_['merge']({},_0x222354,_0xfc4b7b[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x222354)[_0xfcf2('0x24')](handleEntityNotFound(_0x51f636,null))['then'](function(_0x157be7){if(_0x157be7){var _0x51dd1b=_0x157be7[_0xfcf2('0x4d')]({'plain':!![]});_0x51dd1b=qs[_0xfcf2('0x54')](_0x51dd1b,['id',_0xfcf2('0x55'),_0xfcf2('0x56')]);_0xfc4b7b[_0xfcf2('0x4b')]=_[_0xfcf2('0x54')](_0xfc4b7b[_0xfcf2('0x4b')],['id','createdAt',_0xfcf2('0x56')]);return db[_0xfcf2('0x42')]['create'](_[_0xfcf2('0x3e')](_0x51dd1b,_0xfc4b7b['body']),{'include':_0xfc4b7b['query'][_0xfcf2('0x43')]?[{'all':!![]}]:undefined})[_0xfcf2('0x24')](function(_0x98be70){var _0xfef0e9=_0xfc4b7b[_0xfcf2('0x4c')]['get']({'plain':!![]});if(!_0xfef0e9)throw new Error(_0xfcf2('0x4e'));if(_0xfef0e9[_0xfcf2('0x4f')]==='user'){var _0x10d8a4=_0x98be70[_0xfcf2('0x4d')]({'plain':!![]});var _0x5aa1f0=_0xfcf2('0x25');return db[_0xfcf2('0x50')][_0xfcf2('0x49')]({'where':{'name':_0x5aa1f0,'userProfileId':_0xfef0e9[_0xfcf2('0x51')]},'raw':!![]})[_0xfcf2('0x24')](function(_0x302852){if(_0x302852&&_0x302852[_0xfcf2('0x57')]===0x0){return db['UserProfileResource'][_0xfcf2('0x4a')]({'name':_0x10d8a4[_0xfcf2('0x2b')],'resourceId':_0x10d8a4['id'],'type':_0x302852['name'],'sectionId':_0x302852['id']},{})['then'](function(){return _0x98be70;});}else{return _0x98be70;}})['catch'](function(_0x25acf7){logger['error'](_0xfcf2('0x52'),_0x25acf7);throw _0x25acf7;});}return _0x98be70;});}})['then'](respondWithResult(_0x51f636,0xc9))[_0xfcf2('0x45')](handleError(_0x51f636,null));};exports[_0xfcf2('0x23')]=function(_0x48f654,_0x51891d){if(_0x48f654[_0xfcf2('0x4b')]['id']){delete _0x48f654[_0xfcf2('0x4b')]['id'];}return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x48f654['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x51891d,null))[_0xfcf2('0x24')](saveUpdates(_0x48f654[_0xfcf2('0x4b')],null))[_0xfcf2('0x24')](respondWithResult(_0x51891d,null))['catch'](handleError(_0x51891d,null));};exports['destroy']=function(_0x48a661,_0x4caaed){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x48a661['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x4caaed,null))[_0xfcf2('0x24')](removeEntity(_0x4caaed,null))['catch'](handleError(_0x4caaed,null));};exports[_0xfcf2('0x58')]=function(_0x4a648d,_0x51e8bd,_0x325ccd){var _0x1af6a8={'raw':!![],'where':{}};var _0x419b47={};var _0x5c450c={'count':0x0,'rows':[]};return db[_0xfcf2('0x42')][_0xfcf2('0x59')]({'where':{'id':_0x4a648d['params']['id']}})['then'](handleEntityNotFound(_0x51e8bd,null))['then'](function(_0xfb83e7){if(_0xfb83e7){_0x419b47[_0xfcf2('0x34')]=_[_0xfcf2('0x31')](db['JscriptySessionReport'][_0xfcf2('0x48')]);_0x419b47[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x4a648d[_0xfcf2('0x32')]);_0x419b47[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x419b47[_0xfcf2('0x34')],_0x419b47['query']);_0x1af6a8['attributes']=_['intersection'](_0x419b47['model'],qs[_0xfcf2('0x36')](_0x4a648d[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x1af6a8['attributes']=_0x1af6a8[_0xfcf2('0x35')][_0xfcf2('0x37')]?_0x1af6a8['attributes']:_0x419b47[_0xfcf2('0x34')];if(!_0x4a648d[_0xfcf2('0x32')][_0xfcf2('0x38')](_0xfcf2('0x5a'))){_0x1af6a8[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x4a648d['query']['limit']);_0x1af6a8[_0xfcf2('0x1b')]=qs[_0xfcf2('0x1b')](_0x4a648d[_0xfcf2('0x32')]['offset']);}_0x1af6a8['order']=qs['sort'](_0x4a648d[_0xfcf2('0x32')][_0xfcf2('0x3a')]);_0x1af6a8['where']=qs['filters'](_[_0xfcf2('0x3d')](_0x4a648d[_0xfcf2('0x32')],_0x419b47['filters']));_0x1af6a8[_0xfcf2('0x3b')][_0xfcf2('0x5b')]=_0xfb83e7['id'];if(_0x4a648d['query'][_0xfcf2('0x40')]){_0x1af6a8[_0xfcf2('0x3b')]=_['merge'](_0x1af6a8['where'],{'$or':_[_0xfcf2('0x2d')](_0x1af6a8['attributes'],function(_0x33ec43){var _0x1d0a3b={};_0x1d0a3b[_0x33ec43]={'$like':'%'+_0x4a648d[_0xfcf2('0x32')][_0xfcf2('0x40')]+'%'};return _0x1d0a3b;})});}_0x1af6a8=_[_0xfcf2('0x3e')]({},_0x1af6a8,_0x4a648d[_0xfcf2('0x41')]);return db['JscriptySessionReport'][_0xfcf2('0x1d')]({'where':_0x1af6a8[_0xfcf2('0x3b')]})[_0xfcf2('0x24')](function(_0x298196){_0x5c450c[_0xfcf2('0x1d')]=_0x298196;if(_0x4a648d[_0xfcf2('0x32')]['includeAll']){_0x1af6a8[_0xfcf2('0x53')]=[{'all':!![]}];}return db[_0xfcf2('0x5c')][_0xfcf2('0x5d')](_0x1af6a8);})[_0xfcf2('0x24')](function(_0x5d9f97){_0x5c450c['rows']=_0x5d9f97;return _0x5c450c;});}})[_0xfcf2('0x24')](respondWithFilteredResult(_0x51e8bd,_0x1af6a8))[_0xfcf2('0x45')](handleError(_0x51e8bd,null));};exports[_0xfcf2('0x5e')]=function(_0x2b5908,_0x4eea62,_0x43211a){var _0x4e314a={'raw':!![],'where':{}};var _0x1ea2a6={};var _0x105198={'count':0x0,'rows':[]};return db[_0xfcf2('0x42')]['findOne']({'where':{'id':_0x2b5908['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x4eea62,null))[_0xfcf2('0x24')](function(_0x26f450){if(_0x26f450){_0x1ea2a6[_0xfcf2('0x34')]=_['keys'](db[_0xfcf2('0x5f')]['rawAttributes']);_0x1ea2a6[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2b5908[_0xfcf2('0x32')]);_0x1ea2a6['filters']=_['intersection'](_0x1ea2a6['model'],_0x1ea2a6['query']);_0x4e314a[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1ea2a6['model'],qs['fields'](_0x2b5908[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x4e314a['attributes']=_0x4e314a[_0xfcf2('0x35')][_0xfcf2('0x37')]?_0x4e314a['attributes']:_0x1ea2a6[_0xfcf2('0x34')];if(!_0x2b5908[_0xfcf2('0x32')][_0xfcf2('0x38')](_0xfcf2('0x5a'))){_0x4e314a[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x2b5908[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x4e314a[_0xfcf2('0x1b')]=qs[_0xfcf2('0x1b')](_0x2b5908[_0xfcf2('0x32')][_0xfcf2('0x1b')]);}_0x4e314a[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x2b5908['query'][_0xfcf2('0x3a')]);_0x4e314a[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x2b5908[_0xfcf2('0x32')],_0x1ea2a6[_0xfcf2('0x3c')]));_0x4e314a[_0xfcf2('0x3b')][_0xfcf2('0x5b')]=_0x26f450['id'];if(_0x2b5908[_0xfcf2('0x32')][_0xfcf2('0x40')]){_0x4e314a[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x4e314a[_0xfcf2('0x3b')],{'$or':_['map'](_0x4e314a[_0xfcf2('0x35')],function(_0x4f640c){var _0x2a93fb={};_0x2a93fb[_0x4f640c]={'$like':'%'+_0x2b5908[_0xfcf2('0x32')][_0xfcf2('0x40')]+'%'};return _0x2a93fb;})});}_0x4e314a=_[_0xfcf2('0x3e')]({},_0x4e314a,_0x2b5908[_0xfcf2('0x41')]);return db[_0xfcf2('0x5f')][_0xfcf2('0x1d')]({'where':_0x4e314a[_0xfcf2('0x3b')]})[_0xfcf2('0x24')](function(_0x382470){_0x105198[_0xfcf2('0x1d')]=_0x382470;if(_0x2b5908[_0xfcf2('0x32')]['includeAll']){_0x4e314a[_0xfcf2('0x53')]=[{'all':!![]}];}return db[_0xfcf2('0x5f')][_0xfcf2('0x5d')](_0x4e314a);})[_0xfcf2('0x24')](function(_0x2b2bbf){_0x105198[_0xfcf2('0x44')]=_0x2b2bbf;return _0x105198;});}})[_0xfcf2('0x24')](respondWithFilteredResult(_0x4eea62,_0x4e314a))['catch'](handleError(_0x4eea62,null));};function char(_0x192d7b){return _0xfcf2('0x60')===typeof _0x192d7b?String[_0xfcf2('0x61')][_0xfcf2('0x20')](null,arguments):_0x192d7b;}function needsEncapsulation(_0x3664b0){return!!_0x3664b0&&(_0x3664b0[_0xfcf2('0x62')]()[_0xfcf2('0x63')](char(0xd))>=0x0||_0x3664b0['toString']()[_0xfcf2('0x63')](char(0xa))>=0x0||_0x3664b0[_0xfcf2('0x62')]()[_0xfcf2('0x63')](char(0x2c))>=0x0||_0x3664b0[_0xfcf2('0x62')]()[_0xfcf2('0x63')](char(0x22))>=0x0);}function encapsulate(_0x2104e3){var _0x35a3f2=char(0x22),_0x48a3cb='\x5c'+char(0x22),_0x1061a7=_0x2104e3[_0xfcf2('0x62')]()[_0xfcf2('0x64')](new RegExp(_0x35a3f2,'g'),_0x48a3cb);return _0x35a3f2+_0x1061a7+_0x35a3f2;}exports['getSummary']=function(_0x1be3e0,_0x51a81d,_0x7c1bd1){var _0x2f5c59,_0x5195df;var _0x2dac3e={'where':{'ProjectId':_0x1be3e0[_0xfcf2('0x47')]['id']}};if(_0x1be3e0[_0xfcf2('0x32')][_0xfcf2('0x65')]){_0x2dac3e[_0xfcf2('0x3b')]['starttime']=JSON[_0xfcf2('0x66')](_0x1be3e0[_0xfcf2('0x32')]['startTime']);}return db[_0xfcf2('0x5c')][_0xfcf2('0x5d')](_0x2dac3e)[_0xfcf2('0x24')](handleEntityNotFound(_0x51a81d,null))['then'](function(_0x55b788){if(_0x55b788){_0x2f5c59=_0x55b788;return db[_0xfcf2('0x67')][_0xfcf2('0x5d')]({'where':{'SessionId':{'$in':_[_0xfcf2('0x2d')](_0x2f5c59,'id')},'ProjectId':_0x1be3e0[_0xfcf2('0x47')]['id']},'order':_0xfcf2('0x68')});}})['then'](handleEntityNotFound(_0x51a81d,null))['then'](function(_0x236356){if(_0x236356){_0x5195df=_0x236356;var _0x2e1b14={};for(var _0x253c55=0x0,_0x328a51=_0x5195df['length'];_0x253c55<_0x328a51;_0x253c55++){if(!_0x2e1b14[_0xfcf2('0x38')](_0x5195df[_0x253c55]['questionId'])){_0x2e1b14[_0x5195df[_0x253c55][_0xfcf2('0x69')]]=needsEncapsulation(_0x5195df[_0x253c55]['question'])?encapsulate(_0x5195df[_0x253c55][_0xfcf2('0x6a')]):_0x5195df[_0x253c55]['question'];}}var _0x4333ec=[],_0x4e22ed={};for(var _0xf0efbb=0x0,_0x9aeea5=_0x2f5c59['length'];_0xf0efbb<_0x9aeea5;_0xf0efbb++){_0x4e22ed={'ProjectId':_0x1be3e0[_0xfcf2('0x47')]['id'],'SessionId':_0x2f5c59[_0xf0efbb]['id'],'StartTime':moment(_0x2f5c59[_0xf0efbb][_0xfcf2('0x6b')])[_0xfcf2('0x6c')](_0xfcf2('0x6d'))};for(var _0x7e7358=0x0,_0x5eef78=_0x5195df['length'];_0x7e7358<_0x5eef78;_0x7e7358++){if(_0x5195df[_0x7e7358]['SessionId']==_0x2f5c59[_0xf0efbb]['id']&&_0x2e1b14[_0xfcf2('0x38')](_0x5195df[_0x7e7358][_0xfcf2('0x69')])){_0x4e22ed[_0x2e1b14[_0x5195df[_0x7e7358]['questionId']]]=_0x5195df[_0x7e7358][_0xfcf2('0x6e')];}}for(var _0x549c40 in _0x2e1b14){if(!_0x4e22ed['hasOwnProperty'](_0x2e1b14[_0x549c40])){_0x4e22ed[_0x2e1b14[_0x549c40]]=null;}}_0x4333ec['push'](_0x4e22ed);}return _0x4333ec;}})[_0xfcf2('0x24')](function(_0x23e7f4){if(!_[_0xfcf2('0x6f')](_0x23e7f4)){var _0x180e5d=toCsv(_0x23e7f4);var _0x205e86=Date[_0xfcf2('0x70')]();fs[_0xfcf2('0x71')](util[_0xfcf2('0x6c')](_0xfcf2('0x72'),_0x1be3e0[_0xfcf2('0x47')]['id'],_0x205e86),_0x180e5d);_0x51a81d[_0xfcf2('0x73')](_0xfcf2('0x74'),'attachment;\x20filename='+util[_0xfcf2('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x1be3e0[_0xfcf2('0x47')]['id'],_0x205e86));_0x51a81d[_0xfcf2('0x73')](_0xfcf2('0x75'),_0xfcf2('0x76'));return _0x51a81d['download'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1be3e0[_0xfcf2('0x47')]['id'],_0x205e86));}else{return _0x51a81d[_0xfcf2('0x29')](0xcc);}})['catch'](handleError(_0x51a81d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index bb5b12c..2a649d0 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 _0x37c5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','jscripty_projects','util'];(function(_0xd3a4cb,_0x36f7ed){var _0x2496bb=function(_0x164d1f){while(--_0x164d1f){_0xd3a4cb['push'](_0xd3a4cb['shift']());}};_0x2496bb(++_0x36f7ed);}(_0x37c5,0xa7));var _0x537c=function(_0x5cd34f,_0x52a955){_0x5cd34f=_0x5cd34f-0x0;var _0xbe3a55=_0x37c5[_0x5cd34f];return _0xbe3a55;};'use strict';var _=require('lodash');var util=require(_0x537c('0x0'));var logger=require(_0x537c('0x1'))(_0x537c('0x2'));var moment=require(_0x537c('0x3'));var BPromise=require(_0x537c('0x4'));var rp=require(_0x537c('0x5'));var fs=require('fs');var path=require(_0x537c('0x6'));var rimraf=require(_0x537c('0x7'));var config=require(_0x537c('0x8'));var attributes=require(_0x537c('0x9'));module['exports']=function(_0x42c86a,_0x1156f4){return _0x42c86a[_0x537c('0xa')]('JscriptyProject',attributes,{'tableName':_0x537c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30bc=['./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x11395c,_0x1ad157){var _0x444483=function(_0x3131ca){while(--_0x3131ca){_0x11395c['push'](_0x11395c['shift']());}};_0x444483(++_0x1ad157);}(_0x30bc,0x149));var _0xc30b=function(_0x3b2c8e,_0x53910b){_0x3b2c8e=_0x3b2c8e-0x0;var _0x3ebe3d=_0x30bc[_0x3b2c8e];return _0x3ebe3d;};'use strict';var _=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var logger=require(_0xc30b('0x2'))('api');var moment=require(_0xc30b('0x3'));var BPromise=require(_0xc30b('0x4'));var rp=require(_0xc30b('0x5'));var fs=require('fs');var path=require(_0xc30b('0x6'));var rimraf=require(_0xc30b('0x7'));var config=require(_0xc30b('0x8'));var attributes=require(_0xc30b('0x9'));module[_0xc30b('0xa')]=function(_0x45f736,_0x3bce32){return _0x45f736['define'](_0xc30b('0xb'),attributes,{'tableName':_0xc30b('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 ea757e9..3a39038 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 _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x582965,_0x58da5a){_0x582965=_0x582965-0x0;var _0x361185=_0xbdb7[_0x582965];return _0x361185;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0xbdb7[_0x5fa520];return _0x1bf6c4;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4984be2..f28e3a9 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 _0x97d5=['isAuthenticated','index','/describe','describe','show','post','put','update','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x28d18e,_0x46a650){var _0x1eef33=function(_0x347409){while(--_0x347409){_0x28d18e['push'](_0x28d18e['shift']());}};_0x1eef33(++_0x46a650);}(_0x97d5,0x83));var _0x597d=function(_0x2abfac,_0x3fc645){_0x2abfac=_0x2abfac-0x0;var _0x18c079=_0x97d5[_0x2abfac];return _0x18c079;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x597d('0x0'));var timeout=require(_0x597d('0x1'));var express=require(_0x597d('0x2'));var router=express[_0x597d('0x3')]();var fs_extra=require(_0x597d('0x4'));var auth=require(_0x597d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x597d('0x6'));var controller=require(_0x597d('0x7'));router[_0x597d('0x8')]('/',auth[_0x597d('0x9')](),controller[_0x597d('0xa')]);router['get'](_0x597d('0xb'),auth[_0x597d('0x9')](),controller[_0x597d('0xc')]);router[_0x597d('0x8')]('/:id',auth[_0x597d('0x9')](),controller[_0x597d('0xd')]);router[_0x597d('0xe')]('/',auth[_0x597d('0x9')](),controller['create']);router[_0x597d('0xf')]('/:id',auth[_0x597d('0x9')](),controller[_0x597d('0x10')]);router['delete'](_0x597d('0x11'),auth[_0x597d('0x9')](),controller[_0x597d('0x12')]);module[_0x597d('0x13')]=router; \ No newline at end of file +var _0x10d0=['/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','show','post','create'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x10d0,0xfb));var _0x010d=function(_0x6cee37,_0xe8d08c){_0x6cee37=_0x6cee37-0x0;var _0x249e69=_0x10d0[_0x6cee37];return _0x249e69;};'use strict';var multer=require(_0x010d('0x0'));var util=require(_0x010d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x010d('0x2')]();var fs_extra=require(_0x010d('0x3'));var auth=require(_0x010d('0x4'));var interaction=require(_0x010d('0x5'));var config=require(_0x010d('0x6'));var controller=require(_0x010d('0x7'));router[_0x010d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x010d('0x8')](_0x010d('0x9'),auth[_0x010d('0xa')](),controller[_0x010d('0xb')]);router[_0x010d('0x8')]('/:id',auth[_0x010d('0xa')](),controller[_0x010d('0xc')]);router[_0x010d('0xd')]('/',auth[_0x010d('0xa')](),controller[_0x010d('0xe')]);router['put'](_0x010d('0xf'),auth[_0x010d('0xa')](),controller[_0x010d('0x10')]);router['delete'](_0x010d('0xf'),auth[_0x010d('0xa')](),controller[_0x010d('0x11')]);module[_0x010d('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 25eae8e..ddab298 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0x230880,_0x265040){_0x230880=_0x230880-0x0;var _0x37d710=_0x7a54[_0x230880];return _0x37d710;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0xd11d96,_0x29f3d7){_0xd11d96=_0xd11d96-0x0;var _0xfc4007=_0x7a54[_0xd11d96];return _0xfc4007;};'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 28a16a2..1531516 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 _0xaab2=['mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise'];(function(_0x10fa9e,_0x2231eb){var _0x7c0482=function(_0x487115){while(--_0x487115){_0x10fa9e['push'](_0x10fa9e['shift']());}};_0x7c0482(++_0x2231eb);}(_0xaab2,0x15a));var _0x2aab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xaab2[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x2aab('0x0'));var rimraf=require(_0x2aab('0x1'));var zipdir=require(_0x2aab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2aab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2aab('0x4'));var util=require('util');var path=require(_0x2aab('0x5'));var sox=require(_0x2aab('0x6'));var csv=require(_0x2aab('0x7'));var ejs=require(_0x2aab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2aab('0x9'));var squel=require(_0x2aab('0xa'));var crypto=require(_0x2aab('0xb'));var jsforce=require(_0x2aab('0xc'));var deskjs=require(_0x2aab('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2aab('0xe'));var Redis=require(_0x2aab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2aab('0x10'));var as=require(_0x2aab('0x11'));var hardwareService=require(_0x2aab('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2aab('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aab('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226bcc,_0x135f3c){_0x135f3c=_0x135f3c||0xcc;return function(_0x424735){if(_0x424735){return _0x226bcc[_0x2aab('0x15')](_0x135f3c);}return _0x226bcc[_0x2aab('0x16')](_0x135f3c)[_0x2aab('0x17')]();};}function respondWithResult(_0x5de97b,_0xd73323){_0xd73323=_0xd73323||0xc8;return function(_0x45fb2e){if(_0x45fb2e){return _0x5de97b[_0x2aab('0x16')](_0xd73323)['json'](_0x45fb2e);}};}function respondWithFilteredResult(_0x38ebe6,_0x158c12){return function(_0x39d908){if(_0x39d908){var _0x24aa93=typeof _0x158c12[_0x2aab('0x18')]==='undefined'&&typeof _0x158c12[_0x2aab('0x19')]===_0x2aab('0x1a');var _0x31faea=_0x39d908[_0x2aab('0x1b')];var _0x3a0eb2=_0x24aa93?0x0:_0x158c12[_0x2aab('0x18')];var _0xf77100=_0x24aa93?_0x39d908[_0x2aab('0x1b')]:_0x158c12[_0x2aab('0x18')]+_0x158c12[_0x2aab('0x19')];var _0x5db353;if(_0xf77100>=_0x31faea){_0xf77100=_0x31faea;_0x5db353=0xc8;}else{_0x5db353=0xce;}_0x38ebe6['status'](_0x5db353);return _0x38ebe6['set']('Content-Range',_0x3a0eb2+'-'+_0xf77100+'/'+_0x31faea)['json'](_0x39d908);}return null;};}function patchUpdates(_0x147123){return function(_0x3acb88){try{jsonpatch[_0x2aab('0x1c')](_0x3acb88,_0x147123,!![]);}catch(_0x590c47){return BPromise[_0x2aab('0x1d')](_0x590c47);}return _0x3acb88[_0x2aab('0x1e')]();};}function saveUpdates(_0x37c868,_0x5f5b3c){return function(_0x482789){if(_0x482789){return _0x482789[_0x2aab('0x1f')](_0x37c868)['then'](function(_0x107ee8){return _0x107ee8;});}return null;};}function removeEntity(_0x26c485,_0x1a9a20){return function(_0x52ed10){if(_0x52ed10){return _0x52ed10['destroy']()[_0x2aab('0x20')](function(){_0x26c485['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a65b,_0x31d7c9){return function(_0x3e0429){if(!_0x3e0429){_0x27a65b[_0x2aab('0x15')](0x194);}return _0x3e0429;};}function handleError(_0x1e43b4,_0x403a89){_0x403a89=_0x403a89||0x1f4;return function(_0x2b08f5){logger[_0x2aab('0x21')](_0x2b08f5[_0x2aab('0x22')]);if(_0x2b08f5['name']){delete _0x2b08f5[_0x2aab('0x23')];}_0x1e43b4[_0x2aab('0x16')](_0x403a89)[_0x2aab('0x24')](_0x2b08f5);};}exports[_0x2aab('0x25')]=function(_0x598336,_0x4114a3){var _0x26bd49={},_0x13feb2={},_0x33029e={'count':0x0,'rows':[]};var _0x70a1ad=_[_0x2aab('0x26')](db[_0x2aab('0x27')][_0x2aab('0x28')],function(_0x44fdba){return{'name':_0x44fdba[_0x2aab('0x29')],'type':_0x44fdba['type']['key']};});_0x13feb2[_0x2aab('0x2a')]=_[_0x2aab('0x26')](_0x70a1ad,'name');_0x13feb2['query']=_[_0x2aab('0x2b')](_0x598336[_0x2aab('0x2c')]);_0x13feb2[_0x2aab('0x2d')]=_[_0x2aab('0x2e')](_0x13feb2[_0x2aab('0x2a')],_0x13feb2[_0x2aab('0x2c')]);_0x26bd49[_0x2aab('0x2f')]=_[_0x2aab('0x2e')](_0x13feb2[_0x2aab('0x2a')],qs['fields'](_0x598336[_0x2aab('0x2c')][_0x2aab('0x30')]));_0x26bd49[_0x2aab('0x2f')]=_0x26bd49[_0x2aab('0x2f')][_0x2aab('0x31')]?_0x26bd49[_0x2aab('0x2f')]:_0x13feb2[_0x2aab('0x2a')];if(!_0x598336['query'][_0x2aab('0x32')](_0x2aab('0x33'))){_0x26bd49[_0x2aab('0x19')]=qs[_0x2aab('0x19')](_0x598336['query'][_0x2aab('0x19')]);_0x26bd49[_0x2aab('0x18')]=qs[_0x2aab('0x18')](_0x598336['query'][_0x2aab('0x18')]);}_0x26bd49['order']=qs[_0x2aab('0x34')](_0x598336[_0x2aab('0x2c')][_0x2aab('0x34')]);_0x26bd49[_0x2aab('0x35')]=qs[_0x2aab('0x2d')](_[_0x2aab('0x36')](_0x598336['query'],_0x13feb2[_0x2aab('0x2d')]),_0x70a1ad);if(_0x598336[_0x2aab('0x2c')]['filter']){_0x26bd49['where']=_['merge'](_0x26bd49[_0x2aab('0x35')],{'$or':_[_0x2aab('0x26')](_0x70a1ad,function(_0x21b615){if(_0x21b615[_0x2aab('0x37')]!==_0x2aab('0x38')){var _0x28dbba={};_0x28dbba[_0x21b615[_0x2aab('0x23')]]={'$like':'%'+_0x598336[_0x2aab('0x2c')]['filter']+'%'};return _0x28dbba;}})});}_0x26bd49=_[_0x2aab('0x39')]({},_0x26bd49,_0x598336[_0x2aab('0x3a')]);var _0x2fc612={'where':_0x26bd49['where']};return db[_0x2aab('0x27')][_0x2aab('0x1b')](_0x2fc612)[_0x2aab('0x20')](function(_0x2587c5){_0x33029e[_0x2aab('0x1b')]=_0x2587c5;if(_0x598336[_0x2aab('0x2c')]['includeAll']){_0x26bd49[_0x2aab('0x3b')]=[{'all':!![]}];}return db[_0x2aab('0x27')][_0x2aab('0x3c')](_0x26bd49);})[_0x2aab('0x20')](function(_0x4e7ffd){_0x33029e[_0x2aab('0x3d')]=_0x4e7ffd;return _0x33029e;})[_0x2aab('0x20')](respondWithFilteredResult(_0x4114a3,_0x26bd49))[_0x2aab('0x3e')](handleError(_0x4114a3,null));};exports[_0x2aab('0x3f')]=function(_0x66cf44,_0x225c09){var _0x5bc7b9={'raw':!![],'where':{'id':_0x66cf44[_0x2aab('0x40')]['id']}},_0x481f7f={};_0x481f7f[_0x2aab('0x2a')]=_[_0x2aab('0x2b')](db[_0x2aab('0x27')]['rawAttributes']);_0x481f7f[_0x2aab('0x2c')]=_[_0x2aab('0x2b')](_0x66cf44[_0x2aab('0x2c')]);_0x481f7f[_0x2aab('0x2d')]=_[_0x2aab('0x2e')](_0x481f7f[_0x2aab('0x2a')],_0x481f7f[_0x2aab('0x2c')]);_0x5bc7b9[_0x2aab('0x2f')]=_['intersection'](_0x481f7f[_0x2aab('0x2a')],qs[_0x2aab('0x30')](_0x66cf44[_0x2aab('0x2c')][_0x2aab('0x30')]));_0x5bc7b9[_0x2aab('0x2f')]=_0x5bc7b9[_0x2aab('0x2f')][_0x2aab('0x31')]?_0x5bc7b9[_0x2aab('0x2f')]:_0x481f7f[_0x2aab('0x2a')];if(_0x66cf44[_0x2aab('0x2c')][_0x2aab('0x41')]){_0x5bc7b9[_0x2aab('0x3b')]=[{'all':!![]}];}_0x5bc7b9=_[_0x2aab('0x39')]({},_0x5bc7b9,_0x66cf44['options']);return db['JscriptyQuestionReport'][_0x2aab('0x42')](_0x5bc7b9)[_0x2aab('0x20')](handleEntityNotFound(_0x225c09,null))[_0x2aab('0x20')](respondWithResult(_0x225c09,null))[_0x2aab('0x3e')](handleError(_0x225c09,null));};exports[_0x2aab('0x43')]=function(_0x10c69e,_0x2b1b0b){return db[_0x2aab('0x27')][_0x2aab('0x43')](_0x10c69e[_0x2aab('0x44')],{})[_0x2aab('0x20')](respondWithResult(_0x2b1b0b,0xc9))[_0x2aab('0x3e')](handleError(_0x2b1b0b,null));};exports[_0x2aab('0x1f')]=function(_0x2a9312,_0x355b9e){if(_0x2a9312[_0x2aab('0x44')]['id']){delete _0x2a9312[_0x2aab('0x44')]['id'];}return db['JscriptyQuestionReport'][_0x2aab('0x42')]({'where':{'id':_0x2a9312[_0x2aab('0x40')]['id']}})[_0x2aab('0x20')](handleEntityNotFound(_0x355b9e,null))[_0x2aab('0x20')](saveUpdates(_0x2a9312['body'],null))['then'](respondWithResult(_0x355b9e,null))[_0x2aab('0x3e')](handleError(_0x355b9e,null));};exports['destroy']=function(_0x5d03b3,_0x3c6b5e){return db[_0x2aab('0x27')]['find']({'where':{'id':_0x5d03b3[_0x2aab('0x40')]['id']}})[_0x2aab('0x20')](handleEntityNotFound(_0x3c6b5e,null))[_0x2aab('0x20')](removeEntity(_0x3c6b5e,null))[_0x2aab('0x3e')](handleError(_0x3c6b5e,null));};exports[_0x2aab('0x45')]=function(_0x8bcb18,_0x499370){return db[_0x2aab('0x27')][_0x2aab('0x45')]()[_0x2aab('0x20')](respondWithResult(_0x499370,null))['catch'](handleError(_0x499370,null));}; \ No newline at end of file +var _0xe52f=['nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe52f,0x197));var _0xfe52=function(_0x5e6bc3,_0x1daeff){_0x5e6bc3=_0x5e6bc3-0x0;var _0x462142=_0xe52f[_0x5e6bc3];return _0x462142;};'use strict';var emlformat=require(_0xfe52('0x0'));var rimraf=require(_0xfe52('0x1'));var zipdir=require(_0xfe52('0x2'));var jsonpatch=require(_0xfe52('0x3'));var rp=require('request-promise');var moment=require(_0xfe52('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfe52('0x5'));var sox=require(_0xfe52('0x6'));var csv=require(_0xfe52('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe52('0x8'));var _=require(_0xfe52('0x9'));var squel=require('squel');var crypto=require(_0xfe52('0xa'));var jsforce=require(_0xfe52('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfe52('0xc'));var Papa=require(_0xfe52('0xd'));var Redis=require('ioredis');var authService=require(_0xfe52('0xe'));var qs=require(_0xfe52('0xf'));var as=require(_0xfe52('0x10'));var hardwareService=require(_0xfe52('0x11'));var logger=require(_0xfe52('0x12'))(_0xfe52('0x13'));var utils=require(_0xfe52('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfe52('0x15'));var db=require(_0xfe52('0x16'))['db'];function respondWithStatusCode(_0x36b1b1,_0x146379){_0x146379=_0x146379||0xcc;return function(_0x24d694){if(_0x24d694){return _0x36b1b1[_0xfe52('0x17')](_0x146379);}return _0x36b1b1[_0xfe52('0x18')](_0x146379)[_0xfe52('0x19')]();};}function respondWithResult(_0x3da944,_0x348e14){_0x348e14=_0x348e14||0xc8;return function(_0x2e09c4){if(_0x2e09c4){return _0x3da944['status'](_0x348e14)[_0xfe52('0x1a')](_0x2e09c4);}};}function respondWithFilteredResult(_0x1af6c8,_0xfb505b){return function(_0x1cf278){if(_0x1cf278){var _0x172a45=typeof _0xfb505b[_0xfe52('0x1b')]===_0xfe52('0x1c')&&typeof _0xfb505b[_0xfe52('0x1d')]===_0xfe52('0x1c');var _0x13dfcf=_0x1cf278[_0xfe52('0x1e')];var _0x444de4=_0x172a45?0x0:_0xfb505b[_0xfe52('0x1b')];var _0x18fffa=_0x172a45?_0x1cf278[_0xfe52('0x1e')]:_0xfb505b['offset']+_0xfb505b['limit'];var _0x17eb24;if(_0x18fffa>=_0x13dfcf){_0x18fffa=_0x13dfcf;_0x17eb24=0xc8;}else{_0x17eb24=0xce;}_0x1af6c8[_0xfe52('0x18')](_0x17eb24);return _0x1af6c8[_0xfe52('0x1f')]('Content-Range',_0x444de4+'-'+_0x18fffa+'/'+_0x13dfcf)[_0xfe52('0x1a')](_0x1cf278);}return null;};}function patchUpdates(_0x5b383e){return function(_0x4db03e){try{jsonpatch[_0xfe52('0x20')](_0x4db03e,_0x5b383e,!![]);}catch(_0x2fc4f3){return BPromise['reject'](_0x2fc4f3);}return _0x4db03e[_0xfe52('0x21')]();};}function saveUpdates(_0x2f180f,_0x29d1fd){return function(_0x1d45df){if(_0x1d45df){return _0x1d45df['update'](_0x2f180f)[_0xfe52('0x22')](function(_0x13735d){return _0x13735d;});}return null;};}function removeEntity(_0x356bfb,_0x59be39){return function(_0x2901b5){if(_0x2901b5){return _0x2901b5[_0xfe52('0x23')]()[_0xfe52('0x22')](function(){_0x356bfb[_0xfe52('0x18')](0xcc)[_0xfe52('0x19')]();});}};}function handleEntityNotFound(_0xeb561d,_0x463515){return function(_0x22aaed){if(!_0x22aaed){_0xeb561d[_0xfe52('0x17')](0x194);}return _0x22aaed;};}function handleError(_0x311d7f,_0x40ba39){_0x40ba39=_0x40ba39||0x1f4;return function(_0x6c8131){logger[_0xfe52('0x24')](_0x6c8131[_0xfe52('0x25')]);if(_0x6c8131[_0xfe52('0x26')]){delete _0x6c8131['name'];}_0x311d7f[_0xfe52('0x18')](_0x40ba39)[_0xfe52('0x27')](_0x6c8131);};}exports[_0xfe52('0x28')]=function(_0x57a50e,_0xe12ab5){var _0x40f4e0={},_0x4fc3d4={},_0x444707={'count':0x0,'rows':[]};var _0x52b554=_[_0xfe52('0x29')](db[_0xfe52('0x2a')][_0xfe52('0x2b')],function(_0x109770){return{'name':_0x109770[_0xfe52('0x2c')],'type':_0x109770['type'][_0xfe52('0x2d')]};});_0x4fc3d4[_0xfe52('0x2e')]=_[_0xfe52('0x29')](_0x52b554,'name');_0x4fc3d4['query']=_[_0xfe52('0x2f')](_0x57a50e[_0xfe52('0x30')]);_0x4fc3d4[_0xfe52('0x31')]=_[_0xfe52('0x32')](_0x4fc3d4[_0xfe52('0x2e')],_0x4fc3d4['query']);_0x40f4e0[_0xfe52('0x33')]=_['intersection'](_0x4fc3d4[_0xfe52('0x2e')],qs[_0xfe52('0x34')](_0x57a50e['query'][_0xfe52('0x34')]));_0x40f4e0[_0xfe52('0x33')]=_0x40f4e0['attributes'][_0xfe52('0x35')]?_0x40f4e0[_0xfe52('0x33')]:_0x4fc3d4[_0xfe52('0x2e')];if(!_0x57a50e['query'][_0xfe52('0x36')](_0xfe52('0x37'))){_0x40f4e0[_0xfe52('0x1d')]=qs[_0xfe52('0x1d')](_0x57a50e['query'][_0xfe52('0x1d')]);_0x40f4e0['offset']=qs[_0xfe52('0x1b')](_0x57a50e[_0xfe52('0x30')][_0xfe52('0x1b')]);}_0x40f4e0[_0xfe52('0x38')]=qs[_0xfe52('0x39')](_0x57a50e['query']['sort']);_0x40f4e0[_0xfe52('0x3a')]=qs[_0xfe52('0x31')](_[_0xfe52('0x3b')](_0x57a50e[_0xfe52('0x30')],_0x4fc3d4[_0xfe52('0x31')]),_0x52b554);if(_0x57a50e[_0xfe52('0x30')][_0xfe52('0x3c')]){_0x40f4e0[_0xfe52('0x3a')]=_['merge'](_0x40f4e0[_0xfe52('0x3a')],{'$or':_[_0xfe52('0x29')](_0x52b554,function(_0x1c87fd){if(_0x1c87fd[_0xfe52('0x3d')]!==_0xfe52('0x3e')){var _0x4a9024={};_0x4a9024[_0x1c87fd[_0xfe52('0x26')]]={'$like':'%'+_0x57a50e[_0xfe52('0x30')]['filter']+'%'};return _0x4a9024;}})});}_0x40f4e0=_[_0xfe52('0x3f')]({},_0x40f4e0,_0x57a50e[_0xfe52('0x40')]);var _0x5b8a96={'where':_0x40f4e0['where']};return db[_0xfe52('0x2a')][_0xfe52('0x1e')](_0x5b8a96)[_0xfe52('0x22')](function(_0x403954){_0x444707[_0xfe52('0x1e')]=_0x403954;if(_0x57a50e['query'][_0xfe52('0x41')]){_0x40f4e0[_0xfe52('0x42')]=[{'all':!![]}];}return db[_0xfe52('0x2a')][_0xfe52('0x43')](_0x40f4e0);})[_0xfe52('0x22')](function(_0x557cb4){_0x444707[_0xfe52('0x44')]=_0x557cb4;return _0x444707;})['then'](respondWithFilteredResult(_0xe12ab5,_0x40f4e0))['catch'](handleError(_0xe12ab5,null));};exports[_0xfe52('0x45')]=function(_0xdbd288,_0x45232c){var _0x3589c7={'raw':!![],'where':{'id':_0xdbd288['params']['id']}},_0x2ad985={};_0x2ad985[_0xfe52('0x2e')]=_[_0xfe52('0x2f')](db[_0xfe52('0x2a')][_0xfe52('0x2b')]);_0x2ad985[_0xfe52('0x30')]=_[_0xfe52('0x2f')](_0xdbd288[_0xfe52('0x30')]);_0x2ad985[_0xfe52('0x31')]=_[_0xfe52('0x32')](_0x2ad985['model'],_0x2ad985[_0xfe52('0x30')]);_0x3589c7[_0xfe52('0x33')]=_['intersection'](_0x2ad985[_0xfe52('0x2e')],qs[_0xfe52('0x34')](_0xdbd288[_0xfe52('0x30')][_0xfe52('0x34')]));_0x3589c7[_0xfe52('0x33')]=_0x3589c7[_0xfe52('0x33')][_0xfe52('0x35')]?_0x3589c7[_0xfe52('0x33')]:_0x2ad985[_0xfe52('0x2e')];if(_0xdbd288['query'][_0xfe52('0x41')]){_0x3589c7[_0xfe52('0x42')]=[{'all':!![]}];}_0x3589c7=_[_0xfe52('0x3f')]({},_0x3589c7,_0xdbd288[_0xfe52('0x40')]);return db[_0xfe52('0x2a')][_0xfe52('0x46')](_0x3589c7)[_0xfe52('0x22')](handleEntityNotFound(_0x45232c,null))['then'](respondWithResult(_0x45232c,null))['catch'](handleError(_0x45232c,null));};exports[_0xfe52('0x47')]=function(_0xb0ffec,_0x25c8e0){return db[_0xfe52('0x2a')][_0xfe52('0x47')](_0xb0ffec[_0xfe52('0x48')],{})[_0xfe52('0x22')](respondWithResult(_0x25c8e0,0xc9))[_0xfe52('0x49')](handleError(_0x25c8e0,null));};exports[_0xfe52('0x4a')]=function(_0x394970,_0x48ff60){if(_0x394970[_0xfe52('0x48')]['id']){delete _0x394970[_0xfe52('0x48')]['id'];}return db[_0xfe52('0x2a')][_0xfe52('0x46')]({'where':{'id':_0x394970[_0xfe52('0x4b')]['id']}})[_0xfe52('0x22')](handleEntityNotFound(_0x48ff60,null))[_0xfe52('0x22')](saveUpdates(_0x394970['body'],null))[_0xfe52('0x22')](respondWithResult(_0x48ff60,null))[_0xfe52('0x49')](handleError(_0x48ff60,null));};exports['destroy']=function(_0x2b9f55,_0x2249a2){return db[_0xfe52('0x2a')]['find']({'where':{'id':_0x2b9f55['params']['id']}})[_0xfe52('0x22')](handleEntityNotFound(_0x2249a2,null))['then'](removeEntity(_0x2249a2,null))[_0xfe52('0x49')](handleError(_0x2249a2,null));};exports[_0xfe52('0x4c')]=function(_0x2a76f7,_0x11db98){return db[_0xfe52('0x2a')][_0xfe52('0x4c')]()[_0xfe52('0x22')](respondWithResult(_0x11db98,null))[_0xfe52('0x49')](handleError(_0x11db98,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 03686ac..a6bb258 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 _0xdf1f=['api','bluebird','path','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','util','../../config/logger'];(function(_0x208cf0,_0x486665){var _0x372d0d=function(_0x293e01){while(--_0x293e01){_0x208cf0['push'](_0x208cf0['shift']());}};_0x372d0d(++_0x486665);}(_0xdf1f,0xf9));var _0xfdf1=function(_0x3b0966,_0x3fc4ca){_0x3b0966=_0x3b0966-0x0;var _0x18e6b0=_0xdf1f[_0x3b0966];return _0x18e6b0;};'use strict';var _=require(_0xfdf1('0x0'));var util=require(_0xfdf1('0x1'));var logger=require(_0xfdf1('0x2'))(_0xfdf1('0x3'));var moment=require('moment');var BPromise=require(_0xfdf1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdf1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfdf1('0x6'));module[_0xfdf1('0x7')]=function(_0x55c7cf,_0x29b715){return _0x55c7cf['define'](_0xfdf1('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d90=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','JscriptyQuestionReport'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6d90,0x10f));var _0x06d9=function(_0xa3ec8e,_0x35f872){_0xa3ec8e=_0xa3ec8e-0x0;var _0x388a9c=_0x6d90[_0xa3ec8e];return _0x388a9c;};'use strict';var _=require(_0x06d9('0x0'));var util=require(_0x06d9('0x1'));var logger=require(_0x06d9('0x2'))(_0x06d9('0x3'));var moment=require(_0x06d9('0x4'));var BPromise=require(_0x06d9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x06d9('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x06d9('0x7')]=function(_0x36e341,_0x29c3dc){return _0x36e341['define'](_0x06d9('0x8'),attributes,{'tableName':_0x06d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index c1671ef..c375af8 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 _0x970b=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x42f82e,_0x221880){var _0x2d0edd=function(_0x48189f){while(--_0x48189f){_0x42f82e['push'](_0x42f82e['shift']());}};_0x2d0edd(++_0x221880);}(_0x970b,0x146));var _0xb970=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x970b[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0xb970('0x0'));var util=require('util');var moment=require(_0xb970('0x1'));var BPromise=require(_0xb970('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb970('0x3'))['db'];var utils=require(_0xb970('0x4'));var logger=require(_0xb970('0x5'))(_0xb970('0x6'));var config=require(_0xb970('0x7'));var jayson=require(_0xb970('0x8'));var client=jayson['client'][_0xb970('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a7411,_0x222dfa,_0x2e9e9f){return new BPromise(function(_0x4b53ad,_0x561db2){return client[_0xb970('0xa')](_0x4a7411,_0x2e9e9f)[_0xb970('0xb')](function(_0x35564f){logger[_0xb970('0xc')](_0xb970('0xd'),_0x222dfa,'request\x20sent');logger[_0xb970('0xe')](_0xb970('0xf'),_0x222dfa,_0xb970('0x10'),JSON[_0xb970('0x11')](_0x35564f));if(_0x35564f['error']){if(_0x35564f[_0xb970('0x12')][_0xb970('0x13')]===0x1f4){logger['error'](_0xb970('0xd'),_0x222dfa,_0x35564f['error'][_0xb970('0x14')]);return _0x561db2(_0x35564f[_0xb970('0x12')][_0xb970('0x14')]);}logger[_0xb970('0x12')](_0xb970('0xd'),_0x222dfa,_0x35564f[_0xb970('0x12')][_0xb970('0x14')]);return _0x4b53ad(_0x35564f[_0xb970('0x12')]['message']);}else{logger[_0xb970('0xc')](_0xb970('0xd'),_0x222dfa,_0xb970('0x10'));_0x4b53ad(_0x35564f['result'][_0xb970('0x14')]);}})['catch'](function(_0xac64e2){logger[_0xb970('0x12')](_0xb970('0xd'),_0x222dfa,_0xac64e2);_0x561db2(_0xac64e2);});});} \ No newline at end of file +var _0x8328=['stringify','error','code','message','info','result','lodash','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0x8328,0x1da));var _0x8832=function(_0x13fd15,_0x554955){_0x13fd15=_0x13fd15-0x0;var _0x4f5554=_0x8328[_0x13fd15];return _0x4f5554;};'use strict';var _=require(_0x8832('0x0'));var util=require('util');var moment=require(_0x8832('0x1'));var BPromise=require(_0x8832('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8832('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x8832('0x4'));var jayson=require(_0x8832('0x5'));var client=jayson[_0x8832('0x6')][_0x8832('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa43461,_0x47f6ab,_0x2114f6){return new BPromise(function(_0x281c29,_0x1127ef){return client[_0x8832('0x8')](_0xa43461,_0x2114f6)[_0x8832('0x9')](function(_0x396d4e){logger['info'](_0x8832('0xa'),_0x47f6ab,'request\x20sent');logger[_0x8832('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x47f6ab,'request\x20sent',JSON[_0x8832('0xc')](_0x396d4e));if(_0x396d4e[_0x8832('0xd')]){if(_0x396d4e[_0x8832('0xd')][_0x8832('0xe')]===0x1f4){logger['error'](_0x8832('0xa'),_0x47f6ab,_0x396d4e[_0x8832('0xd')][_0x8832('0xf')]);return _0x1127ef(_0x396d4e[_0x8832('0xd')]['message']);}logger[_0x8832('0xd')](_0x8832('0xa'),_0x47f6ab,_0x396d4e[_0x8832('0xd')][_0x8832('0xf')]);return _0x281c29(_0x396d4e['error']['message']);}else{logger[_0x8832('0x10')](_0x8832('0xa'),_0x47f6ab,'request\x20sent');_0x281c29(_0x396d4e[_0x8832('0x11')][_0x8832('0xf')]);}})['catch'](function(_0x57b2da){logger[_0x8832('0xd')](_0x8832('0xa'),_0x47f6ab,_0x57b2da);_0x1127ef(_0x57b2da);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1e4c028..a8faecb 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 _0x37b6=['multer','util','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5b5cfa,_0x1869b3){var _0x214758=function(_0x14688c){while(--_0x14688c){_0x5b5cfa['push'](_0x5b5cfa['shift']());}};_0x214758(++_0x1869b3);}(_0x37b6,0x17c));var _0x637b=function(_0x20afff,_0x5c995e){_0x20afff=_0x20afff-0x0;var _0x304c23=_0x37b6[_0x20afff];return _0x304c23;};'use strict';var multer=require(_0x637b('0x0'));var util=require(_0x637b('0x1'));var path=require('path');var timeout=require(_0x637b('0x2'));var express=require('express');var router=express[_0x637b('0x3')]();var fs_extra=require(_0x637b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x637b('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0x637b('0x6')]('/',auth[_0x637b('0x7')](),controller[_0x637b('0x8')]);router[_0x637b('0x6')](_0x637b('0x9'),auth[_0x637b('0x7')](),controller[_0x637b('0xa')]);router['get'](_0x637b('0xb'),auth[_0x637b('0x7')](),controller[_0x637b('0xc')]);router[_0x637b('0x6')]('/:id/questions',auth['isAuthenticated'](),controller['getQuestions']);router[_0x637b('0xd')]('/',auth['isAuthenticated'](),controller[_0x637b('0xe')]);router[_0x637b('0xf')](_0x637b('0xb'),auth[_0x637b('0x7')](),controller[_0x637b('0x10')]);router[_0x637b('0x11')](_0x637b('0xb'),auth[_0x637b('0x7')](),controller[_0x637b('0x12')]);module[_0x637b('0x13')]=router; \ No newline at end of file +var _0xe7b4=['getQuestions','post','create','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xe7b4,0xec));var _0x4e7b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe7b4[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x4e7b('0x0'));var util=require(_0x4e7b('0x1'));var path=require(_0x4e7b('0x2'));var timeout=require(_0x4e7b('0x3'));var express=require(_0x4e7b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4e7b('0x5'));var interaction=require(_0x4e7b('0x6'));var config=require(_0x4e7b('0x7'));var controller=require(_0x4e7b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e7b('0x9')]);router[_0x4e7b('0xa')](_0x4e7b('0xb'),auth[_0x4e7b('0xc')](),controller[_0x4e7b('0xd')]);router[_0x4e7b('0xa')](_0x4e7b('0xe'),auth[_0x4e7b('0xc')](),controller[_0x4e7b('0xf')]);router['get'](_0x4e7b('0x10'),auth[_0x4e7b('0xc')](),controller[_0x4e7b('0x11')]);router[_0x4e7b('0x12')]('/',auth[_0x4e7b('0xc')](),controller[_0x4e7b('0x13')]);router[_0x4e7b('0x14')](_0x4e7b('0xe'),auth[_0x4e7b('0xc')](),controller[_0x4e7b('0x15')]);router[_0x4e7b('0x16')](_0x4e7b('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 46b16a4..d8e5260 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 _0x2daa=['STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','format'];(function(_0x3ab652,_0x1b3ad2){var _0x2b2fa6=function(_0x21957d){while(--_0x21957d){_0x3ab652['push'](_0x3ab652['shift']());}};_0x2b2fa6(++_0x1b3ad2);}(_0x2daa,0x167));var _0xa2da=function(_0xdf3db6,_0x2a1952){_0xdf3db6=_0xdf3db6-0x0;var _0x4b7a65=_0x2daa[_0xdf3db6];return _0x4b7a65;};'use strict';var moment=require('moment');var Sequelize=require(_0xa2da('0x0'));module[_0xa2da('0x1')]={'starttime':{'type':Sequelize[_0xa2da('0x2')],'set':function(_0x202c3e){this[_0xa2da('0x3')]('starttime',_0x202c3e);this[_0xa2da('0x3')]('endtime',moment()[_0xa2da('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xa2da('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xa2da('0x5')]},'queue':{'type':Sequelize[_0xa2da('0x5')]},'uniqueid':{'type':Sequelize[_0xa2da('0x5')]},'calleridname':{'type':Sequelize[_0xa2da('0x5')]},'calleridnum':{'type':Sequelize[_0xa2da('0x5')]},'completed':{'type':Sequelize[_0xa2da('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xf0de=['STRING','BOOLEAN','moment','DATE','starttime','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x28a471,_0x80beab){var _0x59c413=function(_0x10426e){while(--_0x10426e){_0x28a471['push'](_0x28a471['shift']());}};_0x59c413(++_0x80beab);}(_0xf0de,0x7a));var _0xef0d=function(_0x1ba9ba,_0x5dbde0){_0x1ba9ba=_0x1ba9ba-0x0;var _0x5e363f=_0xf0de[_0x1ba9ba];return _0x5e363f;};'use strict';var moment=require(_0xef0d('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xef0d('0x1')],'set':function(_0x3c88fd){this['setDataValue'](_0xef0d('0x2'),_0x3c88fd);this[_0xef0d('0x3')](_0xef0d('0x4'),moment()['format'](_0xef0d('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xef0d('0x6')]},'projectname':{'type':Sequelize[_0xef0d('0x6')]},'queue':{'type':Sequelize[_0xef0d('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xef0d('0x6')]},'calleridnum':{'type':Sequelize[_0xef0d('0x6')]},'completed':{'type':Sequelize[_0xef0d('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b0c3cb8..17a8f3e 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 _0x0047=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','merge','where','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','length','include','find','catch','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x116c01,_0x334818){var _0x3f4c54=function(_0x20aaad){while(--_0x20aaad){_0x116c01['push'](_0x116c01['shift']());}};_0x3f4c54(++_0x334818);}(_0x0047,0x18b));var _0x7004=function(_0x1ed46f,_0x7691d7){_0x1ed46f=_0x1ed46f-0x0;var _0x43b931=_0x0047[_0x1ed46f];return _0x43b931;};'use strict';var emlformat=require(_0x7004('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7004('0x1'));var jsonpatch=require(_0x7004('0x2'));var rp=require(_0x7004('0x3'));var moment=require(_0x7004('0x4'));var BPromise=require(_0x7004('0x5'));var Mustache=require(_0x7004('0x6'));var util=require('util');var path=require(_0x7004('0x7'));var sox=require(_0x7004('0x8'));var csv=require(_0x7004('0x9'));var ejs=require(_0x7004('0xa'));var fs=require('fs');var fs_extra=require(_0x7004('0xb'));var _=require(_0x7004('0xc'));var squel=require('squel');var crypto=require(_0x7004('0xd'));var jsforce=require(_0x7004('0xe'));var deskjs=require(_0x7004('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7004('0x10'));var Papa=require('papaparse');var Redis=require(_0x7004('0x11'));var authService=require(_0x7004('0x12'));var qs=require(_0x7004('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7004('0x14'));var logger=require(_0x7004('0x15'))(_0x7004('0x16'));var utils=require(_0x7004('0x17'));var config=require(_0x7004('0x18'));var licenseUtil=require(_0x7004('0x19'));var db=require(_0x7004('0x1a'))['db'];function respondWithStatusCode(_0xda0b0c,_0x3d1440){_0x3d1440=_0x3d1440||0xcc;return function(_0x1afe87){if(_0x1afe87){return _0xda0b0c[_0x7004('0x1b')](_0x3d1440);}return _0xda0b0c[_0x7004('0x1c')](_0x3d1440)[_0x7004('0x1d')]();};}function respondWithResult(_0x4b455c,_0x484d07){_0x484d07=_0x484d07||0xc8;return function(_0xd17fa4){if(_0xd17fa4){return _0x4b455c['status'](_0x484d07)[_0x7004('0x1e')](_0xd17fa4);}};}function respondWithFilteredResult(_0x404a32,_0x2fdf7c){return function(_0x3d4f0e){if(_0x3d4f0e){var _0x187dc8=typeof _0x2fdf7c[_0x7004('0x1f')]===_0x7004('0x20')&&typeof _0x2fdf7c[_0x7004('0x21')]===_0x7004('0x20');var _0x4986d2=_0x3d4f0e[_0x7004('0x22')];var _0x215e01=_0x187dc8?0x0:_0x2fdf7c[_0x7004('0x1f')];var _0x28737e=_0x187dc8?_0x3d4f0e['count']:_0x2fdf7c['offset']+_0x2fdf7c[_0x7004('0x21')];var _0x5e3791;if(_0x28737e>=_0x4986d2){_0x28737e=_0x4986d2;_0x5e3791=0xc8;}else{_0x5e3791=0xce;}_0x404a32[_0x7004('0x1c')](_0x5e3791);return _0x404a32[_0x7004('0x23')](_0x7004('0x24'),_0x215e01+'-'+_0x28737e+'/'+_0x4986d2)[_0x7004('0x1e')](_0x3d4f0e);}return null;};}function patchUpdates(_0x4b884a){return function(_0x3d903e){try{jsonpatch['apply'](_0x3d903e,_0x4b884a,!![]);}catch(_0x35e2b9){return BPromise[_0x7004('0x25')](_0x35e2b9);}return _0x3d903e[_0x7004('0x26')]();};}function saveUpdates(_0x4f9954,_0x1f5f9e){return function(_0x3d7fe9){if(_0x3d7fe9){return _0x3d7fe9[_0x7004('0x27')](_0x4f9954)[_0x7004('0x28')](function(_0x545a13){return _0x545a13;});}return null;};}function removeEntity(_0x17673e,_0xe95f09){return function(_0x2f1b26){if(_0x2f1b26){return _0x2f1b26[_0x7004('0x29')]()[_0x7004('0x28')](function(){_0x17673e[_0x7004('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cffb,_0x14b68f){return function(_0x4da1a7){if(!_0x4da1a7){_0x46cffb[_0x7004('0x1b')](0x194);}return _0x4da1a7;};}function handleError(_0x4d947b,_0x5b77db){_0x5b77db=_0x5b77db||0x1f4;return function(_0x5948d2){logger[_0x7004('0x2a')](_0x5948d2[_0x7004('0x2b')]);if(_0x5948d2[_0x7004('0x2c')]){delete _0x5948d2[_0x7004('0x2c')];}_0x4d947b[_0x7004('0x1c')](_0x5b77db)['send'](_0x5948d2);};}exports[_0x7004('0x2d')]=function(_0x4e7849,_0x537fbc){var _0x50468d={},_0x46f3ec={},_0x3b0eb0={'count':0x0,'rows':[]};var _0x3c6997=_[_0x7004('0x2e')](db[_0x7004('0x2f')][_0x7004('0x30')],function(_0x77cd73){return{'name':_0x77cd73['fieldName'],'type':_0x77cd73['type'][_0x7004('0x31')]};});_0x46f3ec['model']=_['map'](_0x3c6997,'name');_0x46f3ec[_0x7004('0x32')]=_[_0x7004('0x33')](_0x4e7849[_0x7004('0x32')]);_0x46f3ec[_0x7004('0x34')]=_[_0x7004('0x35')](_0x46f3ec[_0x7004('0x36')],_0x46f3ec['query']);_0x50468d[_0x7004('0x37')]=_[_0x7004('0x35')](_0x46f3ec[_0x7004('0x36')],qs[_0x7004('0x38')](_0x4e7849[_0x7004('0x32')][_0x7004('0x38')]));_0x50468d[_0x7004('0x37')]=_0x50468d[_0x7004('0x37')]['length']?_0x50468d[_0x7004('0x37')]:_0x46f3ec[_0x7004('0x36')];if(!_0x4e7849[_0x7004('0x32')][_0x7004('0x39')]('nolimit')){_0x50468d[_0x7004('0x21')]=qs[_0x7004('0x21')](_0x4e7849[_0x7004('0x32')][_0x7004('0x21')]);_0x50468d[_0x7004('0x1f')]=qs['offset'](_0x4e7849[_0x7004('0x32')][_0x7004('0x1f')]);}_0x50468d[_0x7004('0x3a')]=qs[_0x7004('0x3b')](_0x4e7849[_0x7004('0x32')][_0x7004('0x3b')]);_0x50468d['where']=qs['filters'](_['pick'](_0x4e7849[_0x7004('0x32')],_0x46f3ec[_0x7004('0x34')]),_0x3c6997);if(_0x4e7849['query']['filter']){_0x50468d['where']=_[_0x7004('0x3c')](_0x50468d[_0x7004('0x3d')],{'$or':_[_0x7004('0x2e')](_0x3c6997,function(_0xbabdbb){if(_0xbabdbb[_0x7004('0x3e')]!==_0x7004('0x3f')){var _0x336e81={};_0x336e81[_0xbabdbb['name']]={'$like':'%'+_0x4e7849[_0x7004('0x32')][_0x7004('0x40')]+'%'};return _0x336e81;}})});}_0x50468d=_['merge']({},_0x50468d,_0x4e7849[_0x7004('0x41')]);var _0x8e33d7={'where':_0x50468d[_0x7004('0x3d')]};return db[_0x7004('0x2f')][_0x7004('0x22')](_0x8e33d7)[_0x7004('0x28')](function(_0x874798){_0x3b0eb0['count']=_0x874798;if(_0x4e7849['query'][_0x7004('0x42')]){_0x50468d['include']=[{'all':!![]}];}return db[_0x7004('0x2f')][_0x7004('0x43')](_0x50468d);})['then'](function(_0x1bd24a){_0x3b0eb0[_0x7004('0x44')]=_0x1bd24a;return _0x3b0eb0;})[_0x7004('0x28')](respondWithFilteredResult(_0x537fbc,_0x50468d))['catch'](handleError(_0x537fbc,null));};exports[_0x7004('0x45')]=function(_0x27bbf5,_0x51eb2d){var _0x551107={'raw':!![],'where':{'id':_0x27bbf5['params']['id']}},_0x2a9c75={};_0x2a9c75[_0x7004('0x36')]=_[_0x7004('0x33')](db['JscriptySessionReport'][_0x7004('0x30')]);_0x2a9c75[_0x7004('0x32')]=_['keys'](_0x27bbf5[_0x7004('0x32')]);_0x2a9c75[_0x7004('0x34')]=_['intersection'](_0x2a9c75[_0x7004('0x36')],_0x2a9c75[_0x7004('0x32')]);_0x551107[_0x7004('0x37')]=_[_0x7004('0x35')](_0x2a9c75['model'],qs[_0x7004('0x38')](_0x27bbf5['query']['fields']));_0x551107['attributes']=_0x551107[_0x7004('0x37')][_0x7004('0x46')]?_0x551107[_0x7004('0x37')]:_0x2a9c75['model'];if(_0x27bbf5[_0x7004('0x32')]['includeAll']){_0x551107[_0x7004('0x47')]=[{'all':!![]}];}_0x551107=_['merge']({},_0x551107,_0x27bbf5['options']);return db[_0x7004('0x2f')][_0x7004('0x48')](_0x551107)[_0x7004('0x28')](handleEntityNotFound(_0x51eb2d,null))[_0x7004('0x28')](respondWithResult(_0x51eb2d,null))[_0x7004('0x49')](handleError(_0x51eb2d,null));};exports[_0x7004('0x4a')]=function(_0x32bf30,_0x1d41db){return db[_0x7004('0x2f')]['create'](_0x32bf30[_0x7004('0x4b')],{})[_0x7004('0x28')](respondWithResult(_0x1d41db,0xc9))[_0x7004('0x49')](handleError(_0x1d41db,null));};exports['update']=function(_0x367a7f,_0x518ea3){if(_0x367a7f[_0x7004('0x4b')]['id']){delete _0x367a7f[_0x7004('0x4b')]['id'];}return db[_0x7004('0x2f')][_0x7004('0x48')]({'where':{'id':_0x367a7f[_0x7004('0x4c')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x518ea3,null))[_0x7004('0x28')](saveUpdates(_0x367a7f[_0x7004('0x4b')],null))[_0x7004('0x28')](respondWithResult(_0x518ea3,null))['catch'](handleError(_0x518ea3,null));};exports['destroy']=function(_0x432268,_0x1d6606){return db[_0x7004('0x2f')][_0x7004('0x48')]({'where':{'id':_0x432268[_0x7004('0x4c')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x1d6606,null))[_0x7004('0x28')](removeEntity(_0x1d6606,null))['catch'](handleError(_0x1d6606,null));};exports['describe']=function(_0x2c5eb9,_0x3ddd4e){return db[_0x7004('0x2f')][_0x7004('0x4d')]()[_0x7004('0x28')](respondWithResult(_0x3ddd4e,null))['catch'](handleError(_0x3ddd4e,null));};exports[_0x7004('0x4e')]=function(_0x4242ca,_0x413abe,_0x3188f6){var _0x5d7d4f={'raw':!![],'where':{}};var _0x325312={};var _0x37a20a={'count':0x0,'rows':[]};return db[_0x7004('0x2f')][_0x7004('0x4f')]({'where':{'id':_0x4242ca['params']['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x413abe,null))['then'](function(_0x3c6f0d){if(_0x3c6f0d){_0x325312[_0x7004('0x36')]=_[_0x7004('0x33')](db[_0x7004('0x50')]['rawAttributes']);_0x325312[_0x7004('0x32')]=_[_0x7004('0x33')](_0x4242ca['query']);_0x325312[_0x7004('0x34')]=_['intersection'](_0x325312[_0x7004('0x36')],_0x325312[_0x7004('0x32')]);_0x5d7d4f['attributes']=_[_0x7004('0x35')](_0x325312[_0x7004('0x36')],qs[_0x7004('0x38')](_0x4242ca[_0x7004('0x32')][_0x7004('0x38')]));_0x5d7d4f[_0x7004('0x37')]=_0x5d7d4f[_0x7004('0x37')]['length']?_0x5d7d4f[_0x7004('0x37')]:_0x325312['model'];if(!_0x4242ca[_0x7004('0x32')][_0x7004('0x39')](_0x7004('0x51'))){_0x5d7d4f[_0x7004('0x21')]=qs[_0x7004('0x21')](_0x4242ca[_0x7004('0x32')][_0x7004('0x21')]);_0x5d7d4f['offset']=qs['offset'](_0x4242ca[_0x7004('0x32')][_0x7004('0x1f')]);}_0x5d7d4f[_0x7004('0x3a')]=qs[_0x7004('0x3b')](_0x4242ca[_0x7004('0x32')][_0x7004('0x3b')]);_0x5d7d4f[_0x7004('0x3d')]=qs[_0x7004('0x34')](_['pick'](_0x4242ca[_0x7004('0x32')],_0x325312['filters']));_0x5d7d4f[_0x7004('0x3d')][_0x7004('0x52')]=_0x3c6f0d['id'];if(_0x4242ca[_0x7004('0x32')][_0x7004('0x40')]){_0x5d7d4f[_0x7004('0x3d')]=_[_0x7004('0x3c')](_0x5d7d4f['where'],{'$or':_[_0x7004('0x2e')](_0x5d7d4f['attributes'],function(_0x39415c){var _0x46311b={};_0x46311b[_0x39415c]={'$like':'%'+_0x4242ca[_0x7004('0x32')]['filter']+'%'};return _0x46311b;})});}_0x5d7d4f=_[_0x7004('0x3c')]({},_0x5d7d4f,_0x4242ca['options']);return db[_0x7004('0x50')][_0x7004('0x22')]({'where':_0x5d7d4f[_0x7004('0x3d')]})['then'](function(_0x3106cd){_0x37a20a['count']=_0x3106cd;if(_0x4242ca[_0x7004('0x32')]['includeAll']){_0x5d7d4f[_0x7004('0x47')]=[{'all':!![]}];}return db[_0x7004('0x50')]['findAll'](_0x5d7d4f);})[_0x7004('0x28')](function(_0x468a47){_0x37a20a['rows']=_0x468a47;return _0x37a20a;});}})[_0x7004('0x28')](respondWithFilteredResult(_0x413abe,_0x5d7d4f))['catch'](handleError(_0x413abe,null));}; \ No newline at end of file +var _0xf07b=['destroy','end','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','find','catch','body','params','describe','getQuestions','findOne','nolimit','pick','includeAll','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf07b,0x113));var _0xbf07=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf07b[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xbf07('0x0'));var rimraf=require(_0xbf07('0x1'));var zipdir=require(_0xbf07('0x2'));var jsonpatch=require(_0xbf07('0x3'));var rp=require(_0xbf07('0x4'));var moment=require(_0xbf07('0x5'));var BPromise=require(_0xbf07('0x6'));var Mustache=require(_0xbf07('0x7'));var util=require(_0xbf07('0x8'));var path=require(_0xbf07('0x9'));var sox=require(_0xbf07('0xa'));var csv=require(_0xbf07('0xb'));var ejs=require(_0xbf07('0xc'));var fs=require('fs');var fs_extra=require(_0xbf07('0xd'));var _=require('lodash');var squel=require(_0xbf07('0xe'));var crypto=require(_0xbf07('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf07('0xb'));var querystring=require(_0xbf07('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbf07('0x11'));var qs=require(_0xbf07('0x12'));var as=require(_0xbf07('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf07('0x14'));var utils=require(_0xbf07('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf07('0x16'))['db'];function respondWithStatusCode(_0x59a5a1,_0x351d22){_0x351d22=_0x351d22||0xcc;return function(_0x2bd914){if(_0x2bd914){return _0x59a5a1[_0xbf07('0x17')](_0x351d22);}return _0x59a5a1[_0xbf07('0x18')](_0x351d22)['end']();};}function respondWithResult(_0x26c8eb,_0x5678ec){_0x5678ec=_0x5678ec||0xc8;return function(_0x29951c){if(_0x29951c){return _0x26c8eb[_0xbf07('0x18')](_0x5678ec)[_0xbf07('0x19')](_0x29951c);}};}function respondWithFilteredResult(_0xe07a80,_0x364ea4){return function(_0x447990){if(_0x447990){var _0x1ce9fb=typeof _0x364ea4[_0xbf07('0x1a')]===_0xbf07('0x1b')&&typeof _0x364ea4['limit']===_0xbf07('0x1b');var _0x9f3377=_0x447990[_0xbf07('0x1c')];var _0x32388f=_0x1ce9fb?0x0:_0x364ea4['offset'];var _0x1ac644=_0x1ce9fb?_0x447990['count']:_0x364ea4['offset']+_0x364ea4[_0xbf07('0x1d')];var _0x3ccabb;if(_0x1ac644>=_0x9f3377){_0x1ac644=_0x9f3377;_0x3ccabb=0xc8;}else{_0x3ccabb=0xce;}_0xe07a80['status'](_0x3ccabb);return _0xe07a80[_0xbf07('0x1e')](_0xbf07('0x1f'),_0x32388f+'-'+_0x1ac644+'/'+_0x9f3377)[_0xbf07('0x19')](_0x447990);}return null;};}function patchUpdates(_0x2fd5ca){return function(_0x386970){try{jsonpatch[_0xbf07('0x20')](_0x386970,_0x2fd5ca,!![]);}catch(_0x324882){return BPromise[_0xbf07('0x21')](_0x324882);}return _0x386970[_0xbf07('0x22')]();};}function saveUpdates(_0x1705e7,_0x23520e){return function(_0x43cdcf){if(_0x43cdcf){return _0x43cdcf[_0xbf07('0x23')](_0x1705e7)[_0xbf07('0x24')](function(_0x5880c9){return _0x5880c9;});}return null;};}function removeEntity(_0x3feb42,_0x24c3ee){return function(_0x35d9f8){if(_0x35d9f8){return _0x35d9f8[_0xbf07('0x25')]()[_0xbf07('0x24')](function(){_0x3feb42[_0xbf07('0x18')](0xcc)[_0xbf07('0x26')]();});}};}function handleEntityNotFound(_0xc90268,_0x21a92b){return function(_0x2a4206){if(!_0x2a4206){_0xc90268['sendStatus'](0x194);}return _0x2a4206;};}function handleError(_0x4c561e,_0x28eced){_0x28eced=_0x28eced||0x1f4;return function(_0x18f9d0){logger['error'](_0x18f9d0[_0xbf07('0x27')]);if(_0x18f9d0[_0xbf07('0x28')]){delete _0x18f9d0[_0xbf07('0x28')];}_0x4c561e[_0xbf07('0x18')](_0x28eced)[_0xbf07('0x29')](_0x18f9d0);};}exports[_0xbf07('0x2a')]=function(_0x29c3ec,_0x17d4b1){var _0x2d0b86={},_0x203782={},_0x2fea97={'count':0x0,'rows':[]};var _0x10aef3=_[_0xbf07('0x2b')](db[_0xbf07('0x2c')][_0xbf07('0x2d')],function(_0x2036d5){return{'name':_0x2036d5[_0xbf07('0x2e')],'type':_0x2036d5['type'][_0xbf07('0x2f')]};});_0x203782['model']=_[_0xbf07('0x2b')](_0x10aef3,_0xbf07('0x28'));_0x203782[_0xbf07('0x30')]=_[_0xbf07('0x31')](_0x29c3ec[_0xbf07('0x30')]);_0x203782[_0xbf07('0x32')]=_[_0xbf07('0x33')](_0x203782[_0xbf07('0x34')],_0x203782[_0xbf07('0x30')]);_0x2d0b86['attributes']=_[_0xbf07('0x33')](_0x203782[_0xbf07('0x34')],qs[_0xbf07('0x35')](_0x29c3ec[_0xbf07('0x30')]['fields']));_0x2d0b86[_0xbf07('0x36')]=_0x2d0b86[_0xbf07('0x36')][_0xbf07('0x37')]?_0x2d0b86['attributes']:_0x203782[_0xbf07('0x34')];if(!_0x29c3ec[_0xbf07('0x30')][_0xbf07('0x38')]('nolimit')){_0x2d0b86[_0xbf07('0x1d')]=qs[_0xbf07('0x1d')](_0x29c3ec['query'][_0xbf07('0x1d')]);_0x2d0b86[_0xbf07('0x1a')]=qs[_0xbf07('0x1a')](_0x29c3ec['query'][_0xbf07('0x1a')]);}_0x2d0b86[_0xbf07('0x39')]=qs[_0xbf07('0x3a')](_0x29c3ec['query']['sort']);_0x2d0b86[_0xbf07('0x3b')]=qs[_0xbf07('0x32')](_['pick'](_0x29c3ec[_0xbf07('0x30')],_0x203782[_0xbf07('0x32')]),_0x10aef3);if(_0x29c3ec[_0xbf07('0x30')][_0xbf07('0x3c')]){_0x2d0b86[_0xbf07('0x3b')]=_[_0xbf07('0x3d')](_0x2d0b86[_0xbf07('0x3b')],{'$or':_[_0xbf07('0x2b')](_0x10aef3,function(_0xfd60bf){if(_0xfd60bf['type']!==_0xbf07('0x3e')){var _0xfc2757={};_0xfc2757[_0xfd60bf[_0xbf07('0x28')]]={'$like':'%'+_0x29c3ec[_0xbf07('0x30')][_0xbf07('0x3c')]+'%'};return _0xfc2757;}})});}_0x2d0b86=_[_0xbf07('0x3d')]({},_0x2d0b86,_0x29c3ec[_0xbf07('0x3f')]);var _0x11138c={'where':_0x2d0b86['where']};return db['JscriptySessionReport'][_0xbf07('0x1c')](_0x11138c)[_0xbf07('0x24')](function(_0x2739bc){_0x2fea97[_0xbf07('0x1c')]=_0x2739bc;if(_0x29c3ec[_0xbf07('0x30')]['includeAll']){_0x2d0b86[_0xbf07('0x40')]=[{'all':!![]}];}return db[_0xbf07('0x2c')][_0xbf07('0x41')](_0x2d0b86);})['then'](function(_0x11a899){_0x2fea97[_0xbf07('0x42')]=_0x11a899;return _0x2fea97;})[_0xbf07('0x24')](respondWithFilteredResult(_0x17d4b1,_0x2d0b86))['catch'](handleError(_0x17d4b1,null));};exports['show']=function(_0x22eddf,_0x334718){var _0x3a99fc={'raw':!![],'where':{'id':_0x22eddf['params']['id']}},_0x175c30={};_0x175c30[_0xbf07('0x34')]=_[_0xbf07('0x31')](db['JscriptySessionReport'][_0xbf07('0x2d')]);_0x175c30['query']=_[_0xbf07('0x31')](_0x22eddf[_0xbf07('0x30')]);_0x175c30[_0xbf07('0x32')]=_[_0xbf07('0x33')](_0x175c30[_0xbf07('0x34')],_0x175c30[_0xbf07('0x30')]);_0x3a99fc['attributes']=_[_0xbf07('0x33')](_0x175c30[_0xbf07('0x34')],qs[_0xbf07('0x35')](_0x22eddf[_0xbf07('0x30')][_0xbf07('0x35')]));_0x3a99fc[_0xbf07('0x36')]=_0x3a99fc[_0xbf07('0x36')][_0xbf07('0x37')]?_0x3a99fc[_0xbf07('0x36')]:_0x175c30[_0xbf07('0x34')];if(_0x22eddf[_0xbf07('0x30')]['includeAll']){_0x3a99fc[_0xbf07('0x40')]=[{'all':!![]}];}_0x3a99fc=_['merge']({},_0x3a99fc,_0x22eddf[_0xbf07('0x3f')]);return db[_0xbf07('0x2c')][_0xbf07('0x43')](_0x3a99fc)[_0xbf07('0x24')](handleEntityNotFound(_0x334718,null))[_0xbf07('0x24')](respondWithResult(_0x334718,null))[_0xbf07('0x44')](handleError(_0x334718,null));};exports['create']=function(_0x26e038,_0x2fdcbe){return db[_0xbf07('0x2c')]['create'](_0x26e038['body'],{})[_0xbf07('0x24')](respondWithResult(_0x2fdcbe,0xc9))[_0xbf07('0x44')](handleError(_0x2fdcbe,null));};exports['update']=function(_0x2a2ab5,_0x4d65e3){if(_0x2a2ab5[_0xbf07('0x45')]['id']){delete _0x2a2ab5[_0xbf07('0x45')]['id'];}return db[_0xbf07('0x2c')][_0xbf07('0x43')]({'where':{'id':_0x2a2ab5['params']['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x4d65e3,null))[_0xbf07('0x24')](saveUpdates(_0x2a2ab5[_0xbf07('0x45')],null))[_0xbf07('0x24')](respondWithResult(_0x4d65e3,null))[_0xbf07('0x44')](handleError(_0x4d65e3,null));};exports[_0xbf07('0x25')]=function(_0x214c0c,_0x2e9725){return db['JscriptySessionReport']['find']({'where':{'id':_0x214c0c[_0xbf07('0x46')]['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x2e9725,null))[_0xbf07('0x24')](removeEntity(_0x2e9725,null))[_0xbf07('0x44')](handleError(_0x2e9725,null));};exports['describe']=function(_0x133226,_0x5003d1){return db['JscriptySessionReport'][_0xbf07('0x47')]()[_0xbf07('0x24')](respondWithResult(_0x5003d1,null))[_0xbf07('0x44')](handleError(_0x5003d1,null));};exports[_0xbf07('0x48')]=function(_0x4a1b51,_0x3bdb61,_0x34a85c){var _0x301a5e={'raw':!![],'where':{}};var _0x1e5982={};var _0x456c97={'count':0x0,'rows':[]};return db[_0xbf07('0x2c')][_0xbf07('0x49')]({'where':{'id':_0x4a1b51[_0xbf07('0x46')]['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x3bdb61,null))['then'](function(_0x3c05a2){if(_0x3c05a2){_0x1e5982['model']=_['keys'](db['JscriptyQuestionReport'][_0xbf07('0x2d')]);_0x1e5982[_0xbf07('0x30')]=_[_0xbf07('0x31')](_0x4a1b51[_0xbf07('0x30')]);_0x1e5982[_0xbf07('0x32')]=_[_0xbf07('0x33')](_0x1e5982['model'],_0x1e5982[_0xbf07('0x30')]);_0x301a5e['attributes']=_[_0xbf07('0x33')](_0x1e5982[_0xbf07('0x34')],qs[_0xbf07('0x35')](_0x4a1b51[_0xbf07('0x30')]['fields']));_0x301a5e['attributes']=_0x301a5e[_0xbf07('0x36')]['length']?_0x301a5e[_0xbf07('0x36')]:_0x1e5982[_0xbf07('0x34')];if(!_0x4a1b51['query']['hasOwnProperty'](_0xbf07('0x4a'))){_0x301a5e[_0xbf07('0x1d')]=qs[_0xbf07('0x1d')](_0x4a1b51['query'][_0xbf07('0x1d')]);_0x301a5e[_0xbf07('0x1a')]=qs['offset'](_0x4a1b51[_0xbf07('0x30')][_0xbf07('0x1a')]);}_0x301a5e[_0xbf07('0x39')]=qs[_0xbf07('0x3a')](_0x4a1b51[_0xbf07('0x30')][_0xbf07('0x3a')]);_0x301a5e[_0xbf07('0x3b')]=qs['filters'](_[_0xbf07('0x4b')](_0x4a1b51[_0xbf07('0x30')],_0x1e5982[_0xbf07('0x32')]));_0x301a5e[_0xbf07('0x3b')]['SessionId']=_0x3c05a2['id'];if(_0x4a1b51[_0xbf07('0x30')][_0xbf07('0x3c')]){_0x301a5e[_0xbf07('0x3b')]=_[_0xbf07('0x3d')](_0x301a5e[_0xbf07('0x3b')],{'$or':_[_0xbf07('0x2b')](_0x301a5e['attributes'],function(_0x183601){var _0x1a569e={};_0x1a569e[_0x183601]={'$like':'%'+_0x4a1b51[_0xbf07('0x30')][_0xbf07('0x3c')]+'%'};return _0x1a569e;})});}_0x301a5e=_[_0xbf07('0x3d')]({},_0x301a5e,_0x4a1b51['options']);return db['JscriptyQuestionReport'][_0xbf07('0x1c')]({'where':_0x301a5e[_0xbf07('0x3b')]})['then'](function(_0x2ade12){_0x456c97['count']=_0x2ade12;if(_0x4a1b51[_0xbf07('0x30')][_0xbf07('0x4c')]){_0x301a5e[_0xbf07('0x40')]=[{'all':!![]}];}return db[_0xbf07('0x4d')]['findAll'](_0x301a5e);})[_0xbf07('0x24')](function(_0x45cdeb){_0x456c97[_0xbf07('0x42')]=_0x45cdeb;return _0x456c97;});}})['then'](respondWithFilteredResult(_0x3bdb61,_0x301a5e))[_0xbf07('0x44')](handleError(_0x3bdb61,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 24536f1..566679d 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 _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x885a,0x180));var _0xa885=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x885a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x9a5a,0x194));var _0xa9a5=function(_0x21ce09,_0x3c3d50){_0x21ce09=_0x21ce09-0x0;var _0x3ef848=_0x9a5a[_0x21ce09];return _0x3ef848;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'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 1c51c84..7206a2c 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 _0x81c6=['stringify','code','error','message','info','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x81c6,0x1d5));var _0x681c=function(_0x297d6f,_0x12c8be){_0x297d6f=_0x297d6f-0x0;var _0x4e0852=_0x81c6[_0x297d6f];return _0x4e0852;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});} \ No newline at end of file +var _0x6343=['message','result','catch','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4e2d9a,_0x46cc34){var _0x11540c=function(_0x11a401){while(--_0x11a401){_0x4e2d9a['push'](_0x4e2d9a['shift']());}};_0x11540c(++_0x46cc34);}(_0x6343,0x168));var _0x3634=function(_0x133dc8,_0x3a65fc){_0x133dc8=_0x133dc8-0x0;var _0x521ebe=_0x6343[_0x133dc8];return _0x521ebe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));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(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('JscriptySessionReport,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f884502..361f6ac 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 _0xf74a=['update','get','/download_log_file','downloadLogFile','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','isAuthenticated'];(function(_0x2e9a8f,_0x3b09ac){var _0x439855=function(_0x394eae){while(--_0x394eae){_0x2e9a8f['push'](_0x2e9a8f['shift']());}};_0x439855(++_0x3b09ac);}(_0xf74a,0x1ae));var _0xaf74=function(_0x162bb6,_0x1eb9c2){_0x162bb6=_0x162bb6-0x0;var _0x5618e8=_0xf74a[_0x162bb6];return _0x5618e8;};'use strict';var multer=require(_0xaf74('0x0'));var util=require(_0xaf74('0x1'));var path=require('path');var timeout=require(_0xaf74('0x2'));var express=require(_0xaf74('0x3'));var router=express['Router']();var fs_extra=require(_0xaf74('0x4'));var auth=require(_0xaf74('0x5'));var interaction=require(_0xaf74('0x6'));var config=require(_0xaf74('0x7'));var controller=require(_0xaf74('0x8'));router['get']('/',controller['index']);router[_0xaf74('0x9')](_0xaf74('0xa'),auth[_0xaf74('0xb')](),controller[_0xaf74('0xc')]);router[_0xaf74('0xd')](_0xaf74('0xe'),auth[_0xaf74('0xb')](),controller[_0xaf74('0xf')]);module[_0xaf74('0x10')]=router; \ No newline at end of file +var _0xefc9=['isAuthenticated','update','/download_log_file','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','put'];(function(_0x100d21,_0x4f4d91){var _0x2db7a9=function(_0x12827d){while(--_0x12827d){_0x100d21['push'](_0x100d21['shift']());}};_0x2db7a9(++_0x4f4d91);}(_0xefc9,0x170));var _0x9efc=function(_0x586de5,_0x4a8cbc){_0x586de5=_0x586de5-0x0;var _0x3ed297=_0xefc9[_0x586de5];return _0x3ed297;};'use strict';var multer=require(_0x9efc('0x0'));var util=require(_0x9efc('0x1'));var path=require(_0x9efc('0x2'));var timeout=require(_0x9efc('0x3'));var express=require(_0x9efc('0x4'));var router=express[_0x9efc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9efc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0x9efc('0x7')]('/',controller['index']);router[_0x9efc('0x8')]('/:id',auth[_0x9efc('0x9')](),controller[_0x9efc('0xa')]);router[_0x9efc('0x7')](_0x9efc('0xb'),auth[_0x9efc('0x9')](),controller['downloadLogFile']);module[_0x9efc('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0c348c6..4352656 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 _0x1ed8=['STRING','INTEGER','exports','TEXT'];(function(_0x15299d,_0x16548f){var _0x969422=function(_0x287c0a){while(--_0x287c0a){_0x15299d['push'](_0x15299d['shift']());}};_0x969422(++_0x16548f);}(_0x1ed8,0x112));var _0x81ed=function(_0x212f18,_0xcb14b0){_0x212f18=_0x212f18-0x0;var _0x429484=_0x1ed8[_0x212f18];return _0x429484;};'use strict';var Sequelize=require('sequelize');module[_0x81ed('0x0')]={'license':{'type':Sequelize[_0x81ed('0x1')]},'data1':{'type':Sequelize[_0x81ed('0x2')]},'data2':{'type':Sequelize[_0x81ed('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x81ed('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2127=['sequelize','exports','TEXT','STRING'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x2127,0x14c));var _0x7212=function(_0x5b9fe4,_0xa8770d){_0x5b9fe4=_0x5b9fe4-0x0;var _0x259492=_0x2127[_0x5b9fe4];return _0x259492;};'use strict';var Sequelize=require(_0x7212('0x0'));module[_0x7212('0x1')]={'license':{'type':Sequelize[_0x7212('0x2')]},'data1':{'type':Sequelize[_0x7212('0x3')]},'data2':{'type':Sequelize[_0x7212('0x3')]},'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 7ef0c63..afb930c 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 _0x9f34=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','model','merge','catch','find','params','get','checkLicense','body','key','demo','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x17bc8f,_0x4f5c9e){var _0x2ee48e=function(_0x500ae6){while(--_0x500ae6){_0x17bc8f['push'](_0x17bc8f['shift']());}};_0x2ee48e(++_0x4f5c9e);}(_0x9f34,0x193));var _0x49f3=function(_0x380b08,_0x1df63a){_0x380b08=_0x380b08-0x0;var _0x22f65d=_0x9f34[_0x380b08];return _0x22f65d;};'use strict';var emlformat=require(_0x49f3('0x0'));var rimraf=require(_0x49f3('0x1'));var zipdir=require(_0x49f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49f3('0x3'));var moment=require('moment');var BPromise=require(_0x49f3('0x4'));var Mustache=require(_0x49f3('0x5'));var util=require(_0x49f3('0x6'));var path=require(_0x49f3('0x7'));var sox=require(_0x49f3('0x8'));var csv=require(_0x49f3('0x9'));var ejs=require(_0x49f3('0xa'));var fs=require('fs');var fs_extra=require(_0x49f3('0xb'));var _=require(_0x49f3('0xc'));var squel=require('squel');var crypto=require(_0x49f3('0xd'));var jsforce=require(_0x49f3('0xe'));var deskjs=require(_0x49f3('0xf'));var toCsv=require(_0x49f3('0x9'));var querystring=require(_0x49f3('0x10'));var Papa=require(_0x49f3('0x11'));var Redis=require(_0x49f3('0x12'));var authService=require(_0x49f3('0x13'));var qs=require(_0x49f3('0x14'));var as=require(_0x49f3('0x15'));var hardwareService=require(_0x49f3('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x49f3('0x17'));var licenseUtil=require(_0x49f3('0x18'));var db=require(_0x49f3('0x19'))['db'];function respondWithStatusCode(_0x5c31e9,_0x4caebf){_0x4caebf=_0x4caebf||0xcc;return function(_0x3634a5){if(_0x3634a5){return _0x5c31e9[_0x49f3('0x1a')](_0x4caebf);}return _0x5c31e9[_0x49f3('0x1b')](_0x4caebf)[_0x49f3('0x1c')]();};}function respondWithResult(_0x92b177,_0xa11a2a){_0xa11a2a=_0xa11a2a||0xc8;return function(_0xa5f443){if(_0xa5f443){return _0x92b177[_0x49f3('0x1b')](_0xa11a2a)['json'](_0xa5f443);}};}function respondWithFilteredResult(_0x4fecb7,_0x4d203e){return function(_0x286366){if(_0x286366){var _0x4d352b=typeof _0x4d203e[_0x49f3('0x1d')]==='undefined'&&typeof _0x4d203e[_0x49f3('0x1e')]==='undefined';var _0x202297=_0x286366[_0x49f3('0x1f')];var _0x2e4838=_0x4d352b?0x0:_0x4d203e[_0x49f3('0x1d')];var _0xf239c3=_0x4d352b?_0x286366[_0x49f3('0x1f')]:_0x4d203e[_0x49f3('0x1d')]+_0x4d203e['limit'];var _0x601892;if(_0xf239c3>=_0x202297){_0xf239c3=_0x202297;_0x601892=0xc8;}else{_0x601892=0xce;}_0x4fecb7[_0x49f3('0x1b')](_0x601892);return _0x4fecb7[_0x49f3('0x20')](_0x49f3('0x21'),_0x2e4838+'-'+_0xf239c3+'/'+_0x202297)['json'](_0x286366);}return null;};}function patchUpdates(_0x102b03){return function(_0x1d9459){try{jsonpatch[_0x49f3('0x22')](_0x1d9459,_0x102b03,!![]);}catch(_0x1a3282){return BPromise[_0x49f3('0x23')](_0x1a3282);}return _0x1d9459['save']();};}function saveUpdates(_0x303707,_0x4bbc3f){return function(_0x208f2f){if(_0x208f2f){return _0x208f2f[_0x49f3('0x24')](_0x303707)[_0x49f3('0x25')](function(_0x54bd2b){return _0x54bd2b;});}return null;};}function removeEntity(_0x3585dc,_0x1ac95a){return function(_0x26109f){if(_0x26109f){return _0x26109f[_0x49f3('0x26')]()[_0x49f3('0x25')](function(){_0x3585dc['status'](0xcc)[_0x49f3('0x1c')]();});}};}function handleEntityNotFound(_0x1c0e19,_0x16cf67){return function(_0x78e716){if(!_0x78e716){_0x1c0e19[_0x49f3('0x1a')](0x194);}return _0x78e716;};}function handleError(_0xb14fb,_0x4142f0){_0x4142f0=_0x4142f0||0x1f4;return function(_0x4d7f74){logger[_0x49f3('0x27')](_0x4d7f74[_0x49f3('0x28')]);if(_0x4d7f74['name']){delete _0x4d7f74[_0x49f3('0x29')];}_0xb14fb[_0x49f3('0x1b')](_0x4142f0)['send'](_0x4d7f74);};}var utilLicense=require(_0x49f3('0x18'));exports['index']=function(_0x66f5da,_0x94e4cb){var _0x48f6ef={'raw':!![],'where':{'id':0x1}},_0x1c6a9e={};_0x1c6a9e['model']=_[_0x49f3('0x2a')](db[_0x49f3('0x2b')][_0x49f3('0x2c')]);_0x1c6a9e[_0x49f3('0x2d')]=_['keys'](_0x66f5da[_0x49f3('0x2d')]);_0x1c6a9e[_0x49f3('0x2e')]=_[_0x49f3('0x2f')](_0x1c6a9e['model'],_0x1c6a9e[_0x49f3('0x2d')]);_0x48f6ef['attributes']=_[_0x49f3('0x2f')](_0x1c6a9e['model'],qs['fields'](_0x66f5da[_0x49f3('0x2d')][_0x49f3('0x30')]));_0x48f6ef[_0x49f3('0x31')]=_0x48f6ef[_0x49f3('0x31')][_0x49f3('0x32')]?_0x48f6ef[_0x49f3('0x31')]:_0x1c6a9e[_0x49f3('0x33')];_0x48f6ef=_[_0x49f3('0x34')]({},_0x48f6ef,_0x66f5da['options']);return utilLicense['getLicense'](_0x48f6ef)[_0x49f3('0x25')](respondWithResult(_0x94e4cb,null))[_0x49f3('0x35')](handleError(_0x94e4cb,null));};exports['update']=function(_0x1b0f12,_0x12c661){if(_0x1b0f12['body']['id']){delete _0x1b0f12['body']['id'];}return db[_0x49f3('0x2b')][_0x49f3('0x36')]({'where':{'id':_0x1b0f12[_0x49f3('0x37')]['id']}})[_0x49f3('0x25')](handleEntityNotFound(_0x12c661,null))[_0x49f3('0x25')](function(_0x12e67e){var _0x5b602b=_0x12e67e[_0x49f3('0x38')]({'plain':!![]});return utilLicense[_0x49f3('0x39')](_0x5b602b,_0x1b0f12[_0x49f3('0x3a')][_0x49f3('0x3b')]);})[_0x49f3('0x25')](function(_0x237b58){if(!_0x237b58[_0x49f3('0x3c')]){return saveUpdates(_0x1b0f12['body'],null);}return _0x237b58;})[_0x49f3('0x25')](respondWithResult(_0x12c661,null))['catch'](handleError(_0x12c661,null));};exports['downloadLogFile']=function(_0x40cab1,_0x56f4c1){var _0x42add1='license-info.log';var _0x548062=path[_0x49f3('0x3d')](_0x49f3('0x3e'),_0x49f3('0x3f'),_0x49f3('0x40'),_0x42add1);_0x56f4c1['setHeader'](_0x49f3('0x41'),_0x49f3('0x42')+_0x42add1);_0x56f4c1[_0x49f3('0x20')](_0x49f3('0x43'),_0x49f3('0x44'));_0x56f4c1[_0x49f3('0x45')](_0x548062);}; \ No newline at end of file +var _0x120f=['send','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','merge','getLicense','catch','body','find','params','get','checkLicense','key','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','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','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','name'];(function(_0x57abf7,_0x11bb02){var _0x1c7779=function(_0x387b0a){while(--_0x387b0a){_0x57abf7['push'](_0x57abf7['shift']());}};_0x1c7779(++_0x11bb02);}(_0x120f,0xac));var _0xf120=function(_0xa132f9,_0x32f20d){_0xa132f9=_0xa132f9-0x0;var _0x342190=_0x120f[_0xa132f9];return _0x342190;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf120('0x0'));var zipdir=require(_0xf120('0x1'));var jsonpatch=require(_0xf120('0x2'));var rp=require('request-promise');var moment=require(_0xf120('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf120('0x4'));var util=require(_0xf120('0x5'));var path=require(_0xf120('0x6'));var sox=require(_0xf120('0x7'));var csv=require(_0xf120('0x8'));var ejs=require(_0xf120('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf120('0xa'));var squel=require(_0xf120('0xb'));var crypto=require(_0xf120('0xc'));var jsforce=require(_0xf120('0xd'));var deskjs=require(_0xf120('0xe'));var toCsv=require(_0xf120('0x8'));var querystring=require(_0xf120('0xf'));var Papa=require(_0xf120('0x10'));var Redis=require(_0xf120('0x11'));var authService=require(_0xf120('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf120('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf120('0x14'))(_0xf120('0x15'));var utils=require('../../config/utils');var config=require(_0xf120('0x16'));var licenseUtil=require(_0xf120('0x17'));var db=require(_0xf120('0x18'))['db'];function respondWithStatusCode(_0xf1e2e6,_0xf11dbf){_0xf11dbf=_0xf11dbf||0xcc;return function(_0x1bb3c2){if(_0x1bb3c2){return _0xf1e2e6[_0xf120('0x19')](_0xf11dbf);}return _0xf1e2e6[_0xf120('0x1a')](_0xf11dbf)[_0xf120('0x1b')]();};}function respondWithResult(_0x7c3eda,_0x25bc87){_0x25bc87=_0x25bc87||0xc8;return function(_0x4f2508){if(_0x4f2508){return _0x7c3eda[_0xf120('0x1a')](_0x25bc87)[_0xf120('0x1c')](_0x4f2508);}};}function respondWithFilteredResult(_0xbd6f18,_0x351423){return function(_0x4fadfe){if(_0x4fadfe){var _0x223e67=typeof _0x351423[_0xf120('0x1d')]==='undefined'&&typeof _0x351423['limit']===_0xf120('0x1e');var _0x367360=_0x4fadfe['count'];var _0x2ef254=_0x223e67?0x0:_0x351423['offset'];var _0x3c9d1a=_0x223e67?_0x4fadfe[_0xf120('0x1f')]:_0x351423[_0xf120('0x1d')]+_0x351423[_0xf120('0x20')];var _0x966ae1;if(_0x3c9d1a>=_0x367360){_0x3c9d1a=_0x367360;_0x966ae1=0xc8;}else{_0x966ae1=0xce;}_0xbd6f18[_0xf120('0x1a')](_0x966ae1);return _0xbd6f18[_0xf120('0x21')](_0xf120('0x22'),_0x2ef254+'-'+_0x3c9d1a+'/'+_0x367360)[_0xf120('0x1c')](_0x4fadfe);}return null;};}function patchUpdates(_0x533ba0){return function(_0x2d2c9a){try{jsonpatch[_0xf120('0x23')](_0x2d2c9a,_0x533ba0,!![]);}catch(_0x4e49de){return BPromise['reject'](_0x4e49de);}return _0x2d2c9a[_0xf120('0x24')]();};}function saveUpdates(_0x5b1019,_0x38b4fa){return function(_0x539c39){if(_0x539c39){return _0x539c39[_0xf120('0x25')](_0x5b1019)[_0xf120('0x26')](function(_0x45dcc0){return _0x45dcc0;});}return null;};}function removeEntity(_0x557f9c,_0x4b1e07){return function(_0x4bced5){if(_0x4bced5){return _0x4bced5['destroy']()[_0xf120('0x26')](function(){_0x557f9c[_0xf120('0x1a')](0xcc)[_0xf120('0x1b')]();});}};}function handleEntityNotFound(_0x42cc4b,_0x2e31c7){return function(_0x85cea9){if(!_0x85cea9){_0x42cc4b[_0xf120('0x19')](0x194);}return _0x85cea9;};}function handleError(_0x14a0fd,_0x40cd99){_0x40cd99=_0x40cd99||0x1f4;return function(_0x176747){logger[_0xf120('0x27')](_0x176747['stack']);if(_0x176747[_0xf120('0x28')]){delete _0x176747[_0xf120('0x28')];}_0x14a0fd[_0xf120('0x1a')](_0x40cd99)[_0xf120('0x29')](_0x176747);};}var utilLicense=require(_0xf120('0x17'));exports['index']=function(_0x1c3dce,_0x2fab17){var _0x25e1de={'raw':!![],'where':{'id':0x1}},_0xf4abac={};_0xf4abac['model']=_['keys'](db['License'][_0xf120('0x2a')]);_0xf4abac[_0xf120('0x2b')]=_[_0xf120('0x2c')](_0x1c3dce['query']);_0xf4abac[_0xf120('0x2d')]=_[_0xf120('0x2e')](_0xf4abac[_0xf120('0x2f')],_0xf4abac['query']);_0x25e1de['attributes']=_[_0xf120('0x2e')](_0xf4abac[_0xf120('0x2f')],qs[_0xf120('0x30')](_0x1c3dce[_0xf120('0x2b')]['fields']));_0x25e1de[_0xf120('0x31')]=_0x25e1de[_0xf120('0x31')][_0xf120('0x32')]?_0x25e1de[_0xf120('0x31')]:_0xf4abac['model'];_0x25e1de=_[_0xf120('0x33')]({},_0x25e1de,_0x1c3dce['options']);return utilLicense[_0xf120('0x34')](_0x25e1de)[_0xf120('0x26')](respondWithResult(_0x2fab17,null))[_0xf120('0x35')](handleError(_0x2fab17,null));};exports[_0xf120('0x25')]=function(_0x4db992,_0x2af609){if(_0x4db992[_0xf120('0x36')]['id']){delete _0x4db992[_0xf120('0x36')]['id'];}return db['License'][_0xf120('0x37')]({'where':{'id':_0x4db992[_0xf120('0x38')]['id']}})['then'](handleEntityNotFound(_0x2af609,null))[_0xf120('0x26')](function(_0x28f428){var _0x4c3a3d=_0x28f428[_0xf120('0x39')]({'plain':!![]});return utilLicense[_0xf120('0x3a')](_0x4c3a3d,_0x4db992[_0xf120('0x36')][_0xf120('0x3b')]);})['then'](function(_0x10e4ee){if(!_0x10e4ee['demo']){return saveUpdates(_0x4db992[_0xf120('0x36')],null);}return _0x10e4ee;})[_0xf120('0x26')](respondWithResult(_0x2af609,null))[_0xf120('0x35')](handleError(_0x2af609,null));};exports['downloadLogFile']=function(_0x5868c4,_0x32dda5){var _0x5d6e5e=_0xf120('0x3c');var _0x2ec1e8=path[_0xf120('0x3d')](_0xf120('0x3e'),_0xf120('0x3f'),_0xf120('0x40'),_0x5d6e5e);_0x32dda5[_0xf120('0x41')](_0xf120('0x42'),_0xf120('0x43')+_0x5d6e5e);_0x32dda5[_0xf120('0x21')](_0xf120('0x44'),_0xf120('0x45'));_0x32dda5[_0xf120('0x46')](_0x2ec1e8);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 48b5b8e..2abc1d8 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 _0x74c8=['request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4bdf64,_0x27c4c2){var _0x12b580=function(_0x3df42a){while(--_0x3df42a){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x12b580(++_0x27c4c2);}(_0x74c8,0x126));var _0x874c=function(_0x2a8167,_0x2ce9d0){_0x2a8167=_0x2a8167-0x0;var _0x483e55=_0x74c8[_0x2a8167];return _0x483e55;};'use strict';var _=require(_0x874c('0x0'));var util=require(_0x874c('0x1'));var logger=require(_0x874c('0x2'))(_0x874c('0x3'));var moment=require(_0x874c('0x4'));var BPromise=require(_0x874c('0x5'));var rp=require(_0x874c('0x6'));var fs=require('fs');var path=require(_0x874c('0x7'));var rimraf=require(_0x874c('0x8'));var config=require(_0x874c('0x9'));var attributes=require(_0x874c('0xa'));module[_0x874c('0xb')]=function(_0x56c567,_0x5da609){return _0x56c567[_0x874c('0xc')](_0x874c('0xd'),attributes,{'tableName':_0x874c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bf9=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','License','license','lodash'];(function(_0xb9e2bc,_0x1bb304){var _0x5cddae=function(_0x6a282e){while(--_0x6a282e){_0xb9e2bc['push'](_0xb9e2bc['shift']());}};_0x5cddae(++_0x1bb304);}(_0x0bf9,0xcb));var _0x90bf=function(_0x5dee1c,_0x1a1a19){_0x5dee1c=_0x5dee1c-0x0;var _0x3d7c37=_0x0bf9[_0x5dee1c];return _0x3d7c37;};'use strict';var _=require(_0x90bf('0x0'));var util=require(_0x90bf('0x1'));var logger=require(_0x90bf('0x2'))(_0x90bf('0x3'));var moment=require(_0x90bf('0x4'));var BPromise=require('bluebird');var rp=require(_0x90bf('0x5'));var fs=require('fs');var path=require(_0x90bf('0x6'));var rimraf=require('rimraf');var config=require(_0x90bf('0x7'));var attributes=require('./license.attributes');module[_0x90bf('0x8')]=function(_0xefea01,_0x3a5b5f){return _0xefea01[_0x90bf('0x9')](_0x90bf('0xa'),attributes,{'tableName':_0x90bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index eb34959..ab3d9f9 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 _0x20f2=['../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','License,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x423ed1,_0x57e512){var _0x4aa3a4=function(_0x3e04a3){while(--_0x3e04a3){_0x423ed1['push'](_0x423ed1['shift']());}};_0x4aa3a4(++_0x57e512);}(_0x20f2,0xd5));var _0x220f=function(_0x158eb1,_0x4edd1b){_0x158eb1=_0x158eb1-0x0;var _0x29bb95=_0x20f2[_0x158eb1];return _0x29bb95;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x220f('0x0'));var BPromise=require(_0x220f('0x1'));var rs=require(_0x220f('0x2'));var fs=require('fs');var Redis=require(_0x220f('0x3'));var db=require(_0x220f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x220f('0x5'))(_0x220f('0x6'));var config=require(_0x220f('0x7'));var jayson=require(_0x220f('0x8'));var client=jayson[_0x220f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x163a3b,_0x13497c,_0x356d67){return new BPromise(function(_0x3dbbe5,_0x28e876){return client['request'](_0x163a3b,_0x356d67)[_0x220f('0xa')](function(_0xc8dd54){logger[_0x220f('0xb')]('License,\x20%s,\x20%s',_0x13497c,_0x220f('0xc'));logger[_0x220f('0xd')](_0x220f('0xe'),_0x13497c,_0x220f('0xc'),JSON['stringify'](_0xc8dd54));if(_0xc8dd54['error']){if(_0xc8dd54[_0x220f('0xf')][_0x220f('0x10')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x13497c,_0xc8dd54['error'][_0x220f('0x11')]);return _0x28e876(_0xc8dd54['error'][_0x220f('0x11')]);}logger[_0x220f('0xf')](_0x220f('0x12'),_0x13497c,_0xc8dd54['error'][_0x220f('0x11')]);return _0x3dbbe5(_0xc8dd54[_0x220f('0xf')][_0x220f('0x11')]);}else{logger[_0x220f('0xb')]('License,\x20%s,\x20%s',_0x13497c,_0x220f('0xc'));_0x3dbbe5(_0xc8dd54[_0x220f('0x13')][_0x220f('0x11')]);}})['catch'](function(_0x56d7d0){logger[_0x220f('0xf')]('License,\x20%s,\x20%s',_0x13497c,_0x56d7d0);_0x28e876(_0x56d7d0);});});} \ No newline at end of file +var _0xd105=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','License,\x20%s,\x20%s','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd105,0x1e5));var _0x5d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd105[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d10('0x0'));var util=require('util');var moment=require(_0x5d10('0x1'));var BPromise=require(_0x5d10('0x2'));var rs=require(_0x5d10('0x3'));var fs=require('fs');var Redis=require(_0x5d10('0x4'));var db=require(_0x5d10('0x5'))['db'];var utils=require(_0x5d10('0x6'));var logger=require(_0x5d10('0x7'))(_0x5d10('0x8'));var config=require(_0x5d10('0x9'));var jayson=require(_0x5d10('0xa'));var client=jayson[_0x5d10('0xb')][_0x5d10('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x465a0a,_0x23d1ca,_0x30bf03){return new BPromise(function(_0x1294b5,_0x3de55b){return client['request'](_0x465a0a,_0x30bf03)[_0x5d10('0xd')](function(_0x3d9dde){logger['info']('License,\x20%s,\x20%s',_0x23d1ca,'request\x20sent');logger['debug'](_0x5d10('0xe'),_0x23d1ca,_0x5d10('0xf'),JSON[_0x5d10('0x10')](_0x3d9dde));if(_0x3d9dde[_0x5d10('0x11')]){if(_0x3d9dde[_0x5d10('0x11')]['code']===0x1f4){logger[_0x5d10('0x11')]('License,\x20%s,\x20%s',_0x23d1ca,_0x3d9dde[_0x5d10('0x11')][_0x5d10('0x12')]);return _0x3de55b(_0x3d9dde[_0x5d10('0x11')]['message']);}logger[_0x5d10('0x11')](_0x5d10('0x13'),_0x23d1ca,_0x3d9dde[_0x5d10('0x11')][_0x5d10('0x12')]);return _0x1294b5(_0x3d9dde['error']['message']);}else{logger[_0x5d10('0x14')](_0x5d10('0x13'),_0x23d1ca,_0x5d10('0xf'));_0x1294b5(_0x3d9dde[_0x5d10('0x15')][_0x5d10('0x12')]);}})[_0x5d10('0x16')](function(_0x435970){logger[_0x5d10('0x11')]('License,\x20%s,\x20%s',_0x23d1ca,_0x435970);_0x3de55b(_0x435970);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index da1d80a..a5c5a06 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 _0x107a=['getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','post','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','/:id/canned_answers','removeSmtp','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/in_servers'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x107a,0x1a7));var _0xa107=function(_0x46d2a6,_0x43a3b2){_0x46d2a6=_0x46d2a6-0x0;var _0x17752a=_0x107a[_0x46d2a6];return _0x17752a;};'use strict';var multer=require(_0xa107('0x0'));var util=require(_0xa107('0x1'));var path=require(_0xa107('0x2'));var timeout=require(_0xa107('0x3'));var express=require('express');var router=express[_0xa107('0x4')]();var fs_extra=require(_0xa107('0x5'));var auth=require(_0xa107('0x6'));var interaction=require(_0xa107('0x7'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa107('0x8')]);router[_0xa107('0x9')](_0xa107('0xa'),auth[_0xa107('0xb')](),controller[_0xa107('0xc')]);router['get'](_0xa107('0xd'),auth['isAuthenticated'](),controller[_0xa107('0xe')]);router[_0xa107('0x9')](_0xa107('0xf'),auth[_0xa107('0xb')](),controller['getDispositions']);router[_0xa107('0x9')]('/:id/canned_answers',auth[_0xa107('0xb')](),controller['getAnswers']);router['get'](_0xa107('0x10'),auth[_0xa107('0xb')](),controller[_0xa107('0x11')]);router[_0xa107('0x9')](_0xa107('0x12'),auth['isAuthenticated'](),controller[_0xa107('0x13')]);router['get'](_0xa107('0x14'),auth[_0xa107('0xb')](),controller[_0xa107('0x15')]);router[_0xa107('0x9')](_0xa107('0x16'),auth[_0xa107('0xb')](),controller[_0xa107('0x17')]);router[_0xa107('0x9')](_0xa107('0x18'),auth[_0xa107('0xb')](),controller['getMessages']);router['get'](_0xa107('0x19'),auth[_0xa107('0xb')](),controller['verifySmtp']);router[_0xa107('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xa107('0x1a')](_0xa107('0xf'),auth[_0xa107('0xb')](),controller['addDisposition']);router[_0xa107('0x1a')]('/:id/canned_answers',auth[_0xa107('0xb')](),controller['addAnswer']);router[_0xa107('0x1a')]('/',auth[_0xa107('0xb')](),controller['create']);router[_0xa107('0x1a')]('/:id/in_servers',auth[_0xa107('0xb')](),controller[_0xa107('0x1b')]);router[_0xa107('0x1a')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xa107('0x1c')]);router[_0xa107('0x1a')](_0xa107('0x14'),auth[_0xa107('0xb')](),controller[_0xa107('0x1d')]);router[_0xa107('0x1a')](_0xa107('0x16'),auth['isAuthenticated'](),controller[_0xa107('0x1e')]);router[_0xa107('0x1a')](_0xa107('0x1f'),auth[_0xa107('0xb')](),controller[_0xa107('0x20')]);router['post'](_0xa107('0x21'),auth[_0xa107('0xb')](),controller[_0xa107('0x22')]);router['put'](_0xa107('0xd'),auth[_0xa107('0xb')](),controller[_0xa107('0x23')]);router[_0xa107('0x24')](_0xa107('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xa107('0x24')](_0xa107('0x25'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete']('/:id/in_servers',auth[_0xa107('0xb')](),controller['removeImap']);router[_0xa107('0x24')](_0xa107('0x12'),auth['isAuthenticated'](),controller[_0xa107('0x26')]);router[_0xa107('0x24')](_0xa107('0xd'),auth[_0xa107('0xb')](),controller['destroy']);router[_0xa107('0x24')](_0xa107('0x21'),auth[_0xa107('0xb')](),controller[_0xa107('0x27')]);module['exports']=router; \ No newline at end of file +var _0x74e4=['getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','/:id/canned_answers','addAnswer','post','create','/:id/in_servers','addImap','addSmtp','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions'];(function(_0x53051a,_0x872ffd){var _0x21e39d=function(_0x62e11a){while(--_0x62e11a){_0x53051a['push'](_0x53051a['shift']());}};_0x21e39d(++_0x872ffd);}(_0x74e4,0x19e));var _0x474e=function(_0x9e839a,_0x4e213b){_0x9e839a=_0x9e839a-0x0;var _0x5174f2=_0x74e4[_0x9e839a];return _0x5174f2;};'use strict';var multer=require(_0x474e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x474e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x474e('0x2'));var interaction=require(_0x474e('0x3'));var config=require(_0x474e('0x4'));var controller=require('./mailAccount.controller');router[_0x474e('0x5')]('/',auth[_0x474e('0x6')](),controller['index']);router[_0x474e('0x5')](_0x474e('0x7'),auth['isAuthenticated'](),controller[_0x474e('0x8')]);router[_0x474e('0x5')]('/:id',auth[_0x474e('0x6')](),controller[_0x474e('0x9')]);router[_0x474e('0x5')](_0x474e('0xa'),auth[_0x474e('0x6')](),controller['getDispositions']);router[_0x474e('0x5')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x474e('0xb')]);router[_0x474e('0x5')]('/:id/in_servers',auth[_0x474e('0x6')](),controller[_0x474e('0xc')]);router[_0x474e('0x5')](_0x474e('0xd'),auth[_0x474e('0x6')](),controller[_0x474e('0xe')]);router[_0x474e('0x5')](_0x474e('0xf'),auth[_0x474e('0x6')](),controller[_0x474e('0x10')]);router[_0x474e('0x5')](_0x474e('0x11'),auth[_0x474e('0x6')](),controller[_0x474e('0x12')]);router['get'](_0x474e('0x13'),auth[_0x474e('0x6')](),controller['getMessages']);router['get'](_0x474e('0x14'),auth[_0x474e('0x6')](),controller[_0x474e('0x15')]);router[_0x474e('0x5')](_0x474e('0x16'),auth[_0x474e('0x6')](),controller['getAgents']);router['post']('/:id/dispositions',auth[_0x474e('0x6')](),controller['addDisposition']);router['post'](_0x474e('0x17'),auth[_0x474e('0x6')](),controller[_0x474e('0x18')]);router[_0x474e('0x19')]('/',auth[_0x474e('0x6')](),controller[_0x474e('0x1a')]);router[_0x474e('0x19')](_0x474e('0x1b'),auth[_0x474e('0x6')](),controller[_0x474e('0x1c')]);router['post'](_0x474e('0xd'),auth[_0x474e('0x6')](),controller[_0x474e('0x1d')]);router[_0x474e('0x19')](_0x474e('0xf'),auth[_0x474e('0x6')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x474e('0x6')](),controller[_0x474e('0x1e')]);router[_0x474e('0x19')](_0x474e('0x1f'),auth[_0x474e('0x6')](),controller[_0x474e('0x20')]);router[_0x474e('0x19')](_0x474e('0x16'),auth['isAuthenticated'](),controller[_0x474e('0x21')]);router[_0x474e('0x22')](_0x474e('0x23'),auth['isAuthenticated'](),controller[_0x474e('0x24')]);router[_0x474e('0x25')](_0x474e('0xa'),auth[_0x474e('0x6')](),controller[_0x474e('0x26')]);router[_0x474e('0x25')](_0x474e('0x17'),auth[_0x474e('0x6')](),controller[_0x474e('0x27')]);router[_0x474e('0x25')](_0x474e('0x1b'),auth['isAuthenticated'](),controller['removeImap']);router[_0x474e('0x25')](_0x474e('0xd'),auth[_0x474e('0x6')](),controller[_0x474e('0x28')]);router[_0x474e('0x25')]('/:id',auth['isAuthenticated'](),controller[_0x474e('0x29')]);router['delete'](_0x474e('0x16'),auth['isAuthenticated'](),controller[_0x474e('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6103990..81b96da 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 _0xf03f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf03f,0x64));var _0xff03=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0xf03f[_0x1a12c8];return _0x305109;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xff03('0x0')]},'name':{'type':Sequelize[_0xff03('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0xff03('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xff03('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xff03('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0xff03('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xff03('0x0')],'allowNull':![],'defaultValue':_0xff03('0x3')},'fontSize':{'type':Sequelize[_0xff03('0x4')](0x2)[_0xff03('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xff03('0x2')],'defaultValue':function(){return _0xff03('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xff03('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xff03('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xff03('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xff03('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xff03('0x1')],'defaultValue':![],'comment':_0xff03('0x8'),'set':function(_0x2b84af){if(!_0x2b84af)this[_0xff03('0x9')](_0xff03('0xa'),null);this[_0xff03('0x9')]('mandatoryDisposition',_0x2b84af);}},'provider':{'type':Sequelize[_0xff03('0xb')](_0xff03('0xc'),_0xff03('0xd'),_0xff03('0xe'),'outlook365'),'defaultValue':null,'get':function(){var _0x113293=this[_0xff03('0xf')](_0xff03('0x10'));return _0x113293||_0xff03('0x11');},'set':function(_0x1bd259){if(_0x1bd259==='custom'){_0x1bd259=null;}return this['setDataValue']('provider',_0x1bd259);}}}; \ No newline at end of file +var _0xb582=['gmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x5c8f03,_0xc20bcc){var _0xea2df4=function(_0x357c4c){while(--_0x357c4c){_0x5c8f03['push'](_0x5c8f03['shift']());}};_0xea2df4(++_0xc20bcc);}(_0xb582,0x8b));var _0x2b58=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb582[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');module[_0x2b58('0x0')]={'description':{'type':Sequelize[_0x2b58('0x1')]},'name':{'type':Sequelize[_0x2b58('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x2b58('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2b58('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2b58('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2b58('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x2b58('0x3')]},'markAsUnread':{'type':Sequelize[_0x2b58('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2b58('0x4')},'fontSize':{'type':Sequelize[_0x2b58('0x5')](0x2)[_0x2b58('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2b58('0x3')],'defaultValue':function(){return _0x2b58('0x7');}},'notificationSound':{'type':Sequelize[_0x2b58('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2b58('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2b58('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2b58('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2b58('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2b58('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2b58('0x2')],'defaultValue':![],'comment':_0x2b58('0x8'),'set':function(_0x332869){if(!_0x332869)this[_0x2b58('0x9')](_0x2b58('0xa'),null);this[_0x2b58('0x9')](_0x2b58('0xb'),_0x332869);}},'provider':{'type':Sequelize[_0x2b58('0xc')](_0x2b58('0xd'),'hotmail',_0x2b58('0xe'),_0x2b58('0xf')),'defaultValue':null,'get':function(){var _0x1a3269=this[_0x2b58('0x10')](_0x2b58('0x11'));return _0x1a3269||'custom';},'set':function(_0x4b83d3){if(_0x4b83d3===_0x2b58('0x12')){_0x4b83d3=null;}return this['setDataValue'](_0x2b58('0x11'),_0x4b83d3);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5bec86c..350a1ef 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 _0x2c83=['inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','CmContact','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','status','end','json','offset','limit','undefined','count','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','nolimit','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','findAll','params','MailAccount','length','options','find','catch','body','provider','custom','secure','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','key','ListId','isNil','active','description','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f2745,_0x3bfe1e){var _0x275035=function(_0x2de9d3){while(--_0x2de9d3){_0x2f2745['push'](_0x2f2745['shift']());}};_0x275035(++_0x3bfe1e);}(_0x2c83,0xed));var _0x32c8=function(_0x2ef691,_0x1af14d){_0x2ef691=_0x2ef691-0x0;var _0x399d1a=_0x2c83[_0x2ef691];return _0x399d1a;};'use strict';var moment=require(_0x32c8('0x0'));var BPromise=require('bluebird');var util=require(_0x32c8('0x1'));var path=require(_0x32c8('0x2'));var _=require(_0x32c8('0x3'));var juice=require('juice');var Redis=require(_0x32c8('0x4'));var qs=require(_0x32c8('0x5'));var logger=require(_0x32c8('0x6'))(_0x32c8('0x7'));var config=require(_0x32c8('0x8'));var db=require(_0x32c8('0x9'))['db'];config[_0x32c8('0xa')]=_[_0x32c8('0xb')](config[_0x32c8('0xa')],{'host':_0x32c8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32c8('0xa')]));require(_0x32c8('0xd'))[_0x32c8('0xe')](socket);var jayson=require(_0x32c8('0xf'));var client=jayson[_0x32c8('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x2602b8,_0x4e32dd,_0x3d832f,_0x214134){return new BPromise(function(_0x4b37e2,_0x687d75){var _0x1e3278=_0x214134||client;return _0x1e3278[_0x32c8('0x11')](_0x2602b8,_0x3d832f)[_0x32c8('0x12')](function(_0x1e8e40){logger['info'](_0x32c8('0x13'),_0x4e32dd,_0x32c8('0x14'));logger[_0x32c8('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4e32dd,'request\x20sent',JSON[_0x32c8('0x16')](_0x1e8e40));if(_0x1e8e40[_0x32c8('0x17')]){if(_0x1e8e40['error']['code']===0x1f4){logger[_0x32c8('0x17')](_0x32c8('0x13'),_0x4e32dd,_0x1e8e40[_0x32c8('0x17')]['message']);return _0x687d75(_0x1e8e40[_0x32c8('0x17')][_0x32c8('0x18')]);}logger[_0x32c8('0x17')]('MailAccount,\x20%s,\x20%s',_0x4e32dd,_0x1e8e40[_0x32c8('0x17')][_0x32c8('0x18')]);return _0x4b37e2(_0x1e8e40[_0x32c8('0x17')][_0x32c8('0x18')]);}else{logger[_0x32c8('0x19')](_0x32c8('0x13'),_0x4e32dd,_0x32c8('0x14'));_0x4b37e2(_0x1e8e40[_0x32c8('0x1a')][_0x32c8('0x18')]);}})['catch'](function(_0x440159){logger[_0x32c8('0x17')]('MailAccount,\x20%s,\x20%s',_0x4e32dd,_0x440159);_0x687d75(_0x440159);});});}function respondWithStatusCode(_0x2a1ce8,_0x3f5c67){_0x3f5c67=_0x3f5c67||0xcc;return function(_0x583c39){if(_0x583c39){return _0x2a1ce8['sendStatus'](_0x3f5c67);}return _0x2a1ce8[_0x32c8('0x1b')](_0x3f5c67)[_0x32c8('0x1c')]();};}function respondWithResult(_0x456941,_0x2cdea6){_0x2cdea6=_0x2cdea6||0xc8;return function(_0x4b842e){if(_0x4b842e){return _0x456941[_0x32c8('0x1b')](_0x2cdea6)[_0x32c8('0x1d')](_0x4b842e);}};}function respondWithFilteredResult(_0x1562c4,_0x5d9b23){return function(_0x4b5ced){if(_0x4b5ced){var _0x47ed8d=typeof _0x5d9b23[_0x32c8('0x1e')]==='undefined'&&typeof _0x5d9b23[_0x32c8('0x1f')]===_0x32c8('0x20');var _0x1546ac=_0x4b5ced[_0x32c8('0x21')];var _0x208682=_0x47ed8d?0x0:_0x5d9b23[_0x32c8('0x1e')];var _0x1db03c=_0x47ed8d?_0x4b5ced['count']:_0x5d9b23[_0x32c8('0x1e')]+_0x5d9b23['limit'];var _0x4e950c;if(_0x1db03c>=_0x1546ac){_0x1db03c=_0x1546ac;_0x4e950c=0xc8;}else{_0x4e950c=0xce;}_0x1562c4[_0x32c8('0x1b')](_0x4e950c);return _0x1562c4['set']('Content-Range',_0x208682+'-'+_0x1db03c+'/'+_0x1546ac)[_0x32c8('0x1d')](_0x4b5ced);}return null;};}function saveUpdates(_0x5aa9d3){return function(_0x1b5419){if(_0x1b5419){return _0x1b5419[_0x32c8('0x22')](_0x5aa9d3)[_0x32c8('0x12')](function(_0x2b3b54){return _0x2b3b54;});}return null;};}function removeEntity(_0x3fbeac){return function(_0x227b10){if(_0x227b10){return _0x227b10[_0x32c8('0x23')]()[_0x32c8('0x12')](function(){var _0x5b822a=_0x227b10[_0x32c8('0x24')]({'plain':!![]});var _0x3ff6b2=_0x32c8('0x25');return db[_0x32c8('0x26')][_0x32c8('0x23')]({'where':{'type':_0x3ff6b2,'resourceId':_0x5b822a['id']}})['then'](function(){return _0x227b10;});})[_0x32c8('0x12')](function(){_0x3fbeac[_0x32c8('0x1b')](0xcc)[_0x32c8('0x1c')]();});}};}function handleEntityNotFound(_0x37630d){return function(_0x34a365){if(!_0x34a365){_0x37630d[_0x32c8('0x27')](0x194);}return _0x34a365;};}function handleError(_0x3dda66,_0x39526a){_0x39526a=_0x39526a||0x1f4;return function(_0x55c7b4){logger['error'](_0x55c7b4[_0x32c8('0x28')]);if(_0x55c7b4[_0x32c8('0x29')]){delete _0x55c7b4[_0x32c8('0x29')];}_0x3dda66[_0x32c8('0x1b')](_0x39526a)[_0x32c8('0x2a')](_0x55c7b4);};}function getImapHost(_0x4714ba){switch(_0x4714ba){case _0x32c8('0x2b'):return _0x32c8('0x2c');case'yahoo':return'imap.mail.yahoo.com';case _0x32c8('0x2d'):return _0x32c8('0x2e');case _0x32c8('0x2f'):return _0x32c8('0x30');}throw new Error(_0x32c8('0x31'),_0x4714ba);}function getSmtpHost(_0x5c7642){switch(_0x5c7642){case'gmail':return _0x32c8('0x32');case'yahoo':return'smtp.mail.yahoo.com';case _0x32c8('0x2d'):return _0x32c8('0x33');case _0x32c8('0x2f'):return _0x32c8('0x34');}throw new Error(_0x32c8('0x31'),_0x5c7642);}function getAuthenticationOptions(_0x284389,_0x4693b8){var _0x556550={};var _0x231800={};if(_0x284389){_0x556550[_0x32c8('0x35')]=_0x231800[_0x32c8('0x35')]=_0x4693b8[_0x32c8('0x36')];_0x556550[_0x32c8('0x37')]=_0x231800[_0x32c8('0x38')]=_0x4693b8['password'];if(_0x4693b8[_0x32c8('0x39')]){_0x556550[_0x32c8('0x39')]=_0x231800[_0x32c8('0x39')]=!![];_0x556550[_0x32c8('0x3a')]=_0x231800['CloudProviderId']=_0x4693b8[_0x32c8('0x3a')];_0x556550[_0x32c8('0x37')]=_0x231800[_0x32c8('0x38')]=null;}else{_0x556550[_0x32c8('0x3a')]=_0x231800[_0x32c8('0x3a')]=null;}_0x556550[_0x32c8('0x3b')]=getImapHost(_0x284389);_0x556550[_0x32c8('0x3c')]=0x3e1;_0x231800[_0x32c8('0x3b')]=getSmtpHost(_0x284389);_0x231800[_0x32c8('0x3c')]=0x24b;_0x231800['secure']=![];_0x556550[_0x32c8('0x3d')]=_0x231800[_0x32c8('0x3d')]=null;}else{if(_0x4693b8[_0x32c8('0x3e')]){_0x556550[_0x32c8('0x35')]=_0x231800[_0x32c8('0x35')]=_0x4693b8['username'];_0x556550['password']=_0x231800[_0x32c8('0x38')]=_0x4693b8[_0x32c8('0x37')];}else{_0x556550[_0x32c8('0x3e')]=_0x231800[_0x32c8('0x3e')]=![];_0x556550[_0x32c8('0x35')]=_0x231800[_0x32c8('0x35')]=null;_0x556550[_0x32c8('0x37')]=_0x231800[_0x32c8('0x38')]=null;}_0x556550[_0x32c8('0x3b')]=_0x4693b8[_0x32c8('0x3f')][_0x32c8('0x3b')];_0x556550[_0x32c8('0x3c')]=_0x4693b8['Imap'][_0x32c8('0x3c')];_0x231800['host']=_0x4693b8['Smtp']['host'];_0x231800[_0x32c8('0x3c')]=_0x4693b8[_0x32c8('0x40')][_0x32c8('0x3c')];}return{'Imap':_0x556550,'Smtp':_0x231800};}exports[_0x32c8('0x41')]=function(_0xa9a7c8,_0x93d2e4){var _0x364082={'include':[{'model':db[_0x32c8('0x42')],'as':_0x32c8('0x3f')},{'model':db[_0x32c8('0x43')],'as':_0x32c8('0x40')},{'model':db[_0x32c8('0x44')],'as':_0x32c8('0x45')}]},_0x3c24cf={},_0x1e948b={'count':0x0,'rows':[]};var _0x519feb=_['map'](db['MailAccount'][_0x32c8('0x46')],function(_0xcd40){return{'name':_0xcd40[_0x32c8('0x47')],'type':_0xcd40[_0x32c8('0x48')]['key']};});_0x3c24cf[_0x32c8('0x49')]=_[_0x32c8('0x4a')](_0x519feb,_0x32c8('0x29'));_0x3c24cf[_0x32c8('0x4b')]=_[_0x32c8('0x4c')](_0xa9a7c8[_0x32c8('0x4b')]);_0x3c24cf['filters']=_[_0x32c8('0x4d')](_0x3c24cf['model'],_0x3c24cf[_0x32c8('0x4b')]);_0x364082[_0x32c8('0x4e')]=_[_0x32c8('0x4d')](_0x3c24cf[_0x32c8('0x49')],qs[_0x32c8('0x4f')](_0xa9a7c8[_0x32c8('0x4b')]['fields']));_0x364082[_0x32c8('0x4e')]=_0x364082[_0x32c8('0x4e')]['length']?_0x364082[_0x32c8('0x4e')]:_0x3c24cf[_0x32c8('0x49')];if(!_0xa9a7c8[_0x32c8('0x4b')]['hasOwnProperty'](_0x32c8('0x50'))){_0x364082['limit']=qs[_0x32c8('0x1f')](_0xa9a7c8[_0x32c8('0x4b')][_0x32c8('0x1f')]);_0x364082['offset']=qs[_0x32c8('0x1e')](_0xa9a7c8['query']['offset']);}_0x364082['order']=qs[_0x32c8('0x51')](_0xa9a7c8[_0x32c8('0x4b')][_0x32c8('0x51')]);_0x364082['where']=qs[_0x32c8('0x52')](_['pick'](_0xa9a7c8[_0x32c8('0x4b')],_0x3c24cf[_0x32c8('0x52')]),_0x519feb);if(_0xa9a7c8['query'][_0x32c8('0x53')]){_0x364082['where']=_[_0x32c8('0x54')](_0x364082[_0x32c8('0x55')],{'$or':_[_0x32c8('0x4a')](_0x519feb,function(_0x162d40){if(_0x162d40[_0x32c8('0x48')]!==_0x32c8('0x56')){var _0x4ef655={};_0x4ef655[_0x162d40[_0x32c8('0x29')]]={'$like':'%'+_0xa9a7c8['query'][_0x32c8('0x53')]+'%'};return _0x4ef655;}})});}_0x364082=_['merge']({},_0x364082,_0xa9a7c8['options']);var _0x19d24c={'where':_0x364082[_0x32c8('0x55')]};return db['MailAccount'][_0x32c8('0x21')](_0x19d24c)[_0x32c8('0x12')](function(_0x2f6b4e){_0x1e948b['count']=_0x2f6b4e;if(_0xa9a7c8[_0x32c8('0x4b')][_0x32c8('0x57')]){_0x364082[_0x32c8('0x58')]=[{'all':!![]}];}return db['MailAccount'][_0x32c8('0x59')](_0x364082);})['then'](function(_0x4d01ba){_0x1e948b['rows']=_0x4d01ba;return _0x1e948b;})[_0x32c8('0x12')](respondWithFilteredResult(_0x93d2e4,_0x364082))['catch'](handleError(_0x93d2e4,null));};exports['show']=function(_0xdd3732,_0x370ada){var _0x3bec08={'raw':![],'where':{'id':_0xdd3732[_0x32c8('0x5a')]['id']},'include':[{'model':db[_0x32c8('0x42')],'as':_0x32c8('0x3f')},{'model':db['MailServerOut'],'as':_0x32c8('0x40')},{'model':db[_0x32c8('0x44')],'as':_0x32c8('0x45')}]},_0x16d2fb={};_0x16d2fb[_0x32c8('0x49')]=_[_0x32c8('0x4c')](db[_0x32c8('0x5b')][_0x32c8('0x46')]);_0x16d2fb[_0x32c8('0x4b')]=_[_0x32c8('0x4c')](_0xdd3732[_0x32c8('0x4b')]);_0x16d2fb[_0x32c8('0x52')]=_[_0x32c8('0x4d')](_0x16d2fb[_0x32c8('0x49')],_0x16d2fb[_0x32c8('0x4b')]);_0x3bec08[_0x32c8('0x4e')]=_[_0x32c8('0x4d')](_0x16d2fb[_0x32c8('0x49')],qs[_0x32c8('0x4f')](_0xdd3732[_0x32c8('0x4b')]['fields']));_0x3bec08[_0x32c8('0x4e')]=_0x3bec08[_0x32c8('0x4e')][_0x32c8('0x5c')]?_0x3bec08[_0x32c8('0x4e')]:_0x16d2fb[_0x32c8('0x49')];if(_0xdd3732[_0x32c8('0x4b')]['includeAll']){_0x3bec08[_0x32c8('0x58')]=[{'all':!![]}];}_0x3bec08=_[_0x32c8('0x54')]({},_0x3bec08,_0xdd3732[_0x32c8('0x5d')]);return db[_0x32c8('0x5b')][_0x32c8('0x5e')](_0x3bec08)['then'](handleEntityNotFound(_0x370ada,null))[_0x32c8('0x12')](respondWithResult(_0x370ada,null))[_0x32c8('0x5f')](handleError(_0x370ada,null));};exports[_0x32c8('0x22')]=function(_0x1438fa,_0x5b0f4a){if(_0x1438fa[_0x32c8('0x60')]['id']){delete _0x1438fa['body']['id'];}var _0xd46aa5=_0x1438fa[_0x32c8('0x60')][_0x32c8('0x61')]===_0x32c8('0x62')?null:_0x1438fa[_0x32c8('0x60')]['provider'];var _0x4bebb8=_0x1438fa[_0x32c8('0x60')][_0x32c8('0x3f')]||{};var _0x21a003=_0x1438fa['body'][_0x32c8('0x40')]||{};if(_0xd46aa5){_0x4bebb8['host']=getImapHost(_0xd46aa5);_0x4bebb8[_0x32c8('0x3c')]=0x3e1;_0x21a003[_0x32c8('0x3b')]=getSmtpHost(_0xd46aa5);_0x21a003[_0x32c8('0x3c')]=0x24b;_0x21a003[_0x32c8('0x63')]=![];}if(_0x21a003[_0x32c8('0x39')]){_0x21a003[_0x32c8('0x63')]=![];}else{_0x21a003['CloudProviderId']=null;}if(!_0x4bebb8[_0x32c8('0x39')])_0x4bebb8[_0x32c8('0x3a')]=null;_0x1438fa[_0x32c8('0x60')]['Imap']=_0x4bebb8;_0x1438fa[_0x32c8('0x60')][_0x32c8('0x40')]=_0x21a003;return db[_0x32c8('0x5b')]['find']({'where':{'id':_0x1438fa[_0x32c8('0x5a')]['id']},'include':[{'model':db[_0x32c8('0x42')],'as':_0x32c8('0x3f')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x32c8('0x45')}]})['then'](handleEntityNotFound(_0x5b0f4a,null))[_0x32c8('0x12')](function(_0x239b6f){if(!_0x239b6f)throw new Error('Mail\x20Account\x20not\x20found');if(_0x239b6f['service'])delete _0x1438fa['body'][_0x32c8('0x3f')];return _0x239b6f;})[_0x32c8('0x12')](saveUpdates(_0x1438fa[_0x32c8('0x60')],null))['then'](function(_0x229555){if(!_0x1438fa['body'][_0x32c8('0x3f')])return _0x229555;return db['MailServerIn']['update'](_0x1438fa['body'][_0x32c8('0x3f')],{'where':{'MailAccountId':_0x229555['id']}})['then'](function(){return _0x229555;});})['then'](function(_0x41c4c7){if(!_0x1438fa[_0x32c8('0x60')][_0x32c8('0x40')])return _0x41c4c7;return db['MailServerOut'][_0x32c8('0x22')](_0x1438fa[_0x32c8('0x60')][_0x32c8('0x40')],{'where':{'MailAccountId':_0x41c4c7['id']}})[_0x32c8('0x12')](function(){return _0x41c4c7;});})[_0x32c8('0x12')](respondWithResult(_0x5b0f4a,null))[_0x32c8('0x5f')](handleError(_0x5b0f4a,null));};exports['describe']=function(_0x2400bc,_0xf84235){return db[_0x32c8('0x5b')]['describe']()[_0x32c8('0x12')](respondWithResult(_0xf84235,null))[_0x32c8('0x5f')](handleError(_0xf84235,null));};exports[_0x32c8('0x64')]=function(_0x4ed8bd,_0x476606){if(_0x4ed8bd[_0x32c8('0x60')]['id']){delete _0x4ed8bd[_0x32c8('0x60')]['id'];}return db[_0x32c8('0x5b')][_0x32c8('0x5e')]({'where':{'id':_0x4ed8bd[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x476606,null))[_0x32c8('0x12')](function(_0xf6d69){if(_0xf6d69){_0x4ed8bd[_0x32c8('0x60')][_0x32c8('0x65')]=_0xf6d69['id'];return db[_0x32c8('0x66')][_0x32c8('0x67')](_0x4ed8bd[_0x32c8('0x60')]);}})['then'](respondWithResult(_0x476606,null))[_0x32c8('0x5f')](handleError(_0x476606,null));};exports[_0x32c8('0x68')]=function(_0x24ab1c,_0x138ba7){var _0xdc42cf={'raw':![],'where':{}};var _0x459435={};var _0x1a16ec={'count':0x0,'rows':[]};return db[_0x32c8('0x5b')][_0x32c8('0x69')]({'where':{'id':_0x24ab1c['params']['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x138ba7,null))['then'](function(_0x3857a0){if(_0x3857a0){_0x459435[_0x32c8('0x49')]=_[_0x32c8('0x4c')](db[_0x32c8('0x66')]['rawAttributes']);_0x459435[_0x32c8('0x4b')]=_[_0x32c8('0x4c')](_0x24ab1c['query']);_0x459435['filters']=_['intersection'](_0x459435[_0x32c8('0x49')],_0x459435[_0x32c8('0x4b')]);_0xdc42cf['attributes']=_['intersection'](_0x459435[_0x32c8('0x49')],qs[_0x32c8('0x4f')](_0x24ab1c[_0x32c8('0x4b')][_0x32c8('0x4f')]));_0xdc42cf['attributes']=_0xdc42cf[_0x32c8('0x4e')]['length']?_0xdc42cf[_0x32c8('0x4e')]:_0x459435[_0x32c8('0x49')];if(!_0x24ab1c[_0x32c8('0x4b')][_0x32c8('0x6a')]('nolimit')){_0xdc42cf[_0x32c8('0x1f')]=qs[_0x32c8('0x1f')](_0x24ab1c[_0x32c8('0x4b')][_0x32c8('0x1f')]);_0xdc42cf[_0x32c8('0x1e')]=qs['offset'](_0x24ab1c['query'][_0x32c8('0x1e')]);}_0xdc42cf['order']=qs['sort'](_0x24ab1c[_0x32c8('0x4b')][_0x32c8('0x51')]);_0xdc42cf[_0x32c8('0x55')]=qs[_0x32c8('0x52')](_[_0x32c8('0x6b')](_0x24ab1c[_0x32c8('0x4b')],_0x459435['filters']));_0xdc42cf[_0x32c8('0x55')][_0x32c8('0x65')]=_0x3857a0['id'];if(_0x24ab1c[_0x32c8('0x4b')]['filter']){_0xdc42cf[_0x32c8('0x55')]=_[_0x32c8('0x54')](_0xdc42cf[_0x32c8('0x55')],{'$or':_[_0x32c8('0x4a')](_0xdc42cf[_0x32c8('0x4e')],function(_0x1e2154){var _0x557c65={};_0x557c65[_0x1e2154]={'$like':'%'+_0x24ab1c[_0x32c8('0x4b')][_0x32c8('0x53')]+'%'};return _0x557c65;})});}_0xdc42cf=_[_0x32c8('0x54')]({},_0xdc42cf,_0x24ab1c[_0x32c8('0x5d')]);return db[_0x32c8('0x66')][_0x32c8('0x21')]({'where':_0xdc42cf[_0x32c8('0x55')]})[_0x32c8('0x12')](function(_0x4519aa){_0x1a16ec[_0x32c8('0x21')]=_0x4519aa;if(_0x24ab1c[_0x32c8('0x4b')]['includeAll']){_0xdc42cf[_0x32c8('0x58')]=[{'all':!![]}];}return db[_0x32c8('0x66')][_0x32c8('0x59')](_0xdc42cf);})[_0x32c8('0x12')](function(_0x5287ae){_0x1a16ec[_0x32c8('0x6c')]=_0x5287ae;return _0x1a16ec;});}})[_0x32c8('0x12')](respondWithFilteredResult(_0x138ba7,_0xdc42cf))[_0x32c8('0x5f')](handleError(_0x138ba7,null));};exports[_0x32c8('0x6d')]=function(_0x4fbabd,_0x38a520){return db[_0x32c8('0x5b')][_0x32c8('0x5e')]({'where':{'id':_0x4fbabd['params']['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x38a520,null))[_0x32c8('0x12')](function(_0x491be2){if(_0x491be2){return _0x491be2[_0x32c8('0x6d')](_0x4fbabd[_0x32c8('0x4b')][_0x32c8('0x6e')]);}})[_0x32c8('0x12')](respondWithStatusCode(_0x38a520,null))[_0x32c8('0x5f')](handleError(_0x38a520,null));};exports[_0x32c8('0x6f')]=function(_0x559790,_0x30314a){if(_0x559790[_0x32c8('0x60')]['id']){delete _0x559790[_0x32c8('0x60')]['id'];}return db[_0x32c8('0x5b')]['find']({'where':{'id':_0x559790[_0x32c8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x30314a,null))[_0x32c8('0x12')](function(_0x27fea3){if(_0x27fea3){_0x559790[_0x32c8('0x60')]['MailAccountId']=_0x27fea3['id'];return db[_0x32c8('0x70')][_0x32c8('0x67')](_0x559790[_0x32c8('0x60')]);}})['then'](respondWithResult(_0x30314a,null))['catch'](handleError(_0x30314a,null));};exports[_0x32c8('0x71')]=function(_0xcc6f6b,_0x1a4ec6){var _0x3ac190={'raw':![],'where':{}};var _0x54bf63={};var _0x4764b3={'count':0x0,'rows':[]};return db[_0x32c8('0x5b')][_0x32c8('0x69')]({'where':{'id':_0xcc6f6b[_0x32c8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1a4ec6,null))[_0x32c8('0x12')](function(_0x11e599){if(_0x11e599){_0x54bf63[_0x32c8('0x49')]=_['keys'](db[_0x32c8('0x70')][_0x32c8('0x46')]);_0x54bf63[_0x32c8('0x4b')]=_[_0x32c8('0x4c')](_0xcc6f6b[_0x32c8('0x4b')]);_0x54bf63[_0x32c8('0x52')]=_[_0x32c8('0x4d')](_0x54bf63[_0x32c8('0x49')],_0x54bf63[_0x32c8('0x4b')]);_0x3ac190['attributes']=_['intersection'](_0x54bf63[_0x32c8('0x49')],qs[_0x32c8('0x4f')](_0xcc6f6b[_0x32c8('0x4b')][_0x32c8('0x4f')]));_0x3ac190[_0x32c8('0x4e')]=_0x3ac190['attributes'][_0x32c8('0x5c')]?_0x3ac190[_0x32c8('0x4e')]:_0x54bf63['model'];if(!_0xcc6f6b[_0x32c8('0x4b')][_0x32c8('0x6a')](_0x32c8('0x50'))){_0x3ac190[_0x32c8('0x1f')]=qs[_0x32c8('0x1f')](_0xcc6f6b[_0x32c8('0x4b')][_0x32c8('0x1f')]);_0x3ac190['offset']=qs['offset'](_0xcc6f6b[_0x32c8('0x4b')]['offset']);}_0x3ac190[_0x32c8('0x72')]=qs[_0x32c8('0x51')](_0xcc6f6b['query']['sort']);_0x3ac190[_0x32c8('0x55')]=qs[_0x32c8('0x52')](_[_0x32c8('0x6b')](_0xcc6f6b[_0x32c8('0x4b')],_0x54bf63['filters']));_0x3ac190['where']['MailAccountId']=_0x11e599['id'];if(_0xcc6f6b[_0x32c8('0x4b')][_0x32c8('0x53')]){_0x3ac190[_0x32c8('0x55')]=_[_0x32c8('0x54')](_0x3ac190[_0x32c8('0x55')],{'$or':_[_0x32c8('0x4a')](_0x3ac190[_0x32c8('0x4e')],function(_0x40ffe4){var _0x74b250={};_0x74b250[_0x40ffe4]={'$like':'%'+_0xcc6f6b[_0x32c8('0x4b')][_0x32c8('0x53')]+'%'};return _0x74b250;})});}_0x3ac190=_[_0x32c8('0x54')]({},_0x3ac190,_0xcc6f6b[_0x32c8('0x5d')]);return db['CannedAnswer']['count']({'where':_0x3ac190['where']})['then'](function(_0xf52da){_0x4764b3['count']=_0xf52da;if(_0xcc6f6b[_0x32c8('0x4b')][_0x32c8('0x57')]){_0x3ac190[_0x32c8('0x58')]=[{'all':!![]}];}return db[_0x32c8('0x70')]['findAll'](_0x3ac190);})[_0x32c8('0x12')](function(_0x2f39d6){_0x4764b3[_0x32c8('0x6c')]=_0x2f39d6;return _0x4764b3;});}})[_0x32c8('0x12')](respondWithFilteredResult(_0x1a4ec6,_0x3ac190))[_0x32c8('0x5f')](handleError(_0x1a4ec6,null));};exports[_0x32c8('0x73')]=function(_0x5ee55c,_0x98853b){return db[_0x32c8('0x5b')][_0x32c8('0x5e')]({'where':{'id':_0x5ee55c[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x98853b,null))[_0x32c8('0x12')](function(_0x2f370a){if(_0x2f370a){return _0x2f370a[_0x32c8('0x73')](_0x5ee55c['query'][_0x32c8('0x6e')]);}})[_0x32c8('0x12')](respondWithStatusCode(_0x98853b,null))['catch'](handleError(_0x98853b,null));};exports['create']=function(_0x5ead58,_0x3a88ec){var _0x3a2ecc={'name':_0x5ead58[_0x32c8('0x60')][_0x32c8('0x29')],'key':_0x5ead58[_0x32c8('0x60')][_0x32c8('0x74')],'provider':_0x5ead58[_0x32c8('0x60')][_0x32c8('0x61')]===_0x32c8('0x62')?null:_0x5ead58[_0x32c8('0x60')][_0x32c8('0x61')],'email':_0x5ead58[_0x32c8('0x60')]['email'],'ListId':_0x5ead58[_0x32c8('0x60')][_0x32c8('0x75')],'active':!_[_0x32c8('0x76')](_0x5ead58[_0x32c8('0x60')][_0x32c8('0x77')])?_0x5ead58[_0x32c8('0x60')]['active']:!![],'description':_0x5ead58[_0x32c8('0x60')][_0x32c8('0x78')]||null};var _0x388e12=getAuthenticationOptions(_0x3a2ecc['provider'],_0x5ead58[_0x32c8('0x60')]);_0x3a2ecc[_0x32c8('0x3f')]=_0x388e12[_0x32c8('0x3f')];_0x3a2ecc[_0x32c8('0x40')]=_0x388e12[_0x32c8('0x40')];return db[_0x32c8('0x5b')][_0x32c8('0x67')](_0x3a2ecc,{'include':[{'model':db[_0x32c8('0x43')],'as':_0x32c8('0x40')},{'model':db[_0x32c8('0x42')],'as':_0x32c8('0x3f')}]})[_0x32c8('0x12')](function(_0x3d8820){var _0x421da6=_0x5ead58[_0x32c8('0x35')][_0x32c8('0x24')]({'plain':!![]});if(!_0x421da6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x421da6[_0x32c8('0x79')]===_0x32c8('0x35')){var _0x247324=_0x3d8820[_0x32c8('0x24')]({'plain':!![]});return db[_0x32c8('0x7a')][_0x32c8('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x421da6[_0x32c8('0x7b')]},'raw':!![]})[_0x32c8('0x12')](function(_0x25ec81){if(_0x25ec81&&_0x25ec81['autoAssociation']===0x0){return db[_0x32c8('0x26')]['create']({'name':_0x247324['name'],'resourceId':_0x247324['id'],'type':_0x25ec81[_0x32c8('0x29')],'sectionId':_0x25ec81['id']},{})[_0x32c8('0x12')](function(){return _0x3d8820;});}else{return _0x3d8820;}})['catch'](function(_0x21a22b){logger[_0x32c8('0x17')](_0x32c8('0x7c'),_0x21a22b);throw _0x21a22b;});}return _0x3d8820;})[_0x32c8('0x12')](respondWithResult(_0x3a88ec,0xc9))[_0x32c8('0x5f')](handleError(_0x3a88ec,null));};exports[_0x32c8('0x7d')]=function(_0x17d4b2,_0x2defa0){return db[_0x32c8('0x5b')][_0x32c8('0x69')]({'where':{'id':_0x17d4b2['params']['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x2defa0,null))[_0x32c8('0x12')](function(_0x545460){if(_0x545460){return _0x545460[_0x32c8('0x7d')]();}return null;})['then'](respondWithResult(_0x2defa0,null))['catch'](handleError(_0x2defa0,null));};exports[_0x32c8('0x7e')]=function(_0x3320f7,_0x4eda93){if(_0x3320f7[_0x32c8('0x60')]['id']){delete _0x3320f7[_0x32c8('0x60')]['id'];}return db['MailAccount'][_0x32c8('0x5e')]({'where':{'id':_0x3320f7[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x4eda93,null))[_0x32c8('0x12')](function(_0x463aac){if(_0x463aac){_0x3320f7['body'][_0x32c8('0x65')]=_0x463aac['id'];return db[_0x32c8('0x42')][_0x32c8('0x67')](_0x3320f7['body']);}})[_0x32c8('0x12')](respondWithResult(_0x4eda93,null))[_0x32c8('0x5f')](handleError(_0x4eda93,null));};exports[_0x32c8('0x7f')]=function(_0xaf348,_0x25ae60){return db['MailAccount'][_0x32c8('0x69')]({'where':{'id':_0xaf348[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x25ae60,null))[_0x32c8('0x12')](function(_0x5c67b0){if(_0x5c67b0){return _0x5c67b0[_0x32c8('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x25ae60,null))['catch'](handleError(_0x25ae60,null));};exports[_0x32c8('0x81')]=function(_0x5238d0,_0x2547b7){return db[_0x32c8('0x5b')][_0x32c8('0x69')]({'where':{'id':_0x5238d0['params']['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x2547b7,null))['then'](function(_0x2b92bd){if(_0x2b92bd){return _0x2b92bd[_0x32c8('0x81')]();}return null;})[_0x32c8('0x12')](respondWithResult(_0x2547b7,null))['catch'](handleError(_0x2547b7,null));};exports[_0x32c8('0x82')]=function(_0x3155c3,_0x447502){if(_0x3155c3['body']['id']){delete _0x3155c3[_0x32c8('0x60')]['id'];}return db['MailAccount'][_0x32c8('0x5e')]({'where':{'id':_0x3155c3['params']['id']}})['then'](handleEntityNotFound(_0x447502,null))[_0x32c8('0x12')](function(_0x2f6ab){if(_0x2f6ab){_0x3155c3[_0x32c8('0x60')][_0x32c8('0x65')]=_0x2f6ab['id'];return db[_0x32c8('0x43')][_0x32c8('0x67')](_0x3155c3[_0x32c8('0x60')]);}})[_0x32c8('0x12')](respondWithResult(_0x447502,null))[_0x32c8('0x5f')](handleError(_0x447502,null));};exports[_0x32c8('0x83')]=function(_0x1ef48f,_0x256b45){return db['MailAccount'][_0x32c8('0x69')]({'where':{'id':_0x1ef48f['params']['id']}})['then'](handleEntityNotFound(_0x256b45,null))[_0x32c8('0x12')](function(_0x504f95){if(_0x504f95){return _0x504f95['setSmtp'](null);}return null;})[_0x32c8('0x12')](respondWithStatusCode(_0x256b45,null))[_0x32c8('0x5f')](handleError(_0x256b45,null));};exports[_0x32c8('0x84')]=function(_0x51b24d,_0x2a49c5){return db[_0x32c8('0x85')][_0x32c8('0x5e')]({'where':{'id':_0x51b24d['params']['id']}})['then'](handleEntityNotFound(_0x2a49c5,null))['then'](function(_0x23df82){if(_0x23df82){return _0x23df82[_0x32c8('0x84')](_0x51b24d[_0x32c8('0x60')][_0x32c8('0x6e')],_['omit'](_0x51b24d[_0x32c8('0x60')],[_0x32c8('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x2a49c5,null))[_0x32c8('0x5f')](handleError(_0x2a49c5,null));};exports[_0x32c8('0x86')]=function(_0x1e2188,_0x3edb75){var _0xc445fa={'raw':![],'where':{}};var _0x5a4e97={};var _0x490073={'count':0x0,'rows':[]};return db[_0x32c8('0x5b')]['findOne']({'where':{'id':_0x1e2188[_0x32c8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3edb75,null))[_0x32c8('0x12')](function(_0x1e3349){if(_0x1e3349){_0x5a4e97['model']=_[_0x32c8('0x4c')](db['MailInteraction'][_0x32c8('0x46')]);_0x5a4e97['query']=_[_0x32c8('0x4c')](_0x1e2188[_0x32c8('0x4b')]);_0x5a4e97[_0x32c8('0x52')]=_[_0x32c8('0x4d')](_0x5a4e97[_0x32c8('0x49')],_0x5a4e97[_0x32c8('0x4b')]);_0xc445fa['attributes']=_[_0x32c8('0x4d')](_0x5a4e97[_0x32c8('0x49')],qs[_0x32c8('0x4f')](_0x1e2188[_0x32c8('0x4b')][_0x32c8('0x4f')]));_0xc445fa[_0x32c8('0x4e')]=_0xc445fa[_0x32c8('0x4e')]['length']?_0xc445fa[_0x32c8('0x4e')]:_0x5a4e97['model'];if(!_0x1e2188[_0x32c8('0x4b')]['hasOwnProperty']('nolimit')){_0xc445fa['limit']=qs[_0x32c8('0x1f')](_0x1e2188[_0x32c8('0x4b')][_0x32c8('0x1f')]);_0xc445fa[_0x32c8('0x1e')]=qs[_0x32c8('0x1e')](_0x1e2188[_0x32c8('0x4b')][_0x32c8('0x1e')]);}_0xc445fa[_0x32c8('0x72')]=qs[_0x32c8('0x51')](_0x1e2188[_0x32c8('0x4b')]['sort']);_0xc445fa[_0x32c8('0x55')]=qs['filters'](_[_0x32c8('0x6b')](_0x1e2188['query'],_0x5a4e97['filters']));_0xc445fa[_0x32c8('0x55')]['MailAccountId']=_0x1e3349['id'];if(_0x1e2188[_0x32c8('0x4b')][_0x32c8('0x53')]){_0xc445fa[_0x32c8('0x55')]=_[_0x32c8('0x54')](_0xc445fa[_0x32c8('0x55')],{'$or':_[_0x32c8('0x4a')](_0xc445fa['attributes'],function(_0x2f2061){var _0x153b3b={};_0x153b3b[_0x2f2061]={'$like':'%'+_0x1e2188[_0x32c8('0x4b')][_0x32c8('0x53')]+'%'};return _0x153b3b;})});}_0xc445fa=_[_0x32c8('0x54')]({},_0xc445fa,_0x1e2188[_0x32c8('0x5d')]);return db[_0x32c8('0x85')][_0x32c8('0x21')]({'where':_0xc445fa[_0x32c8('0x55')]})[_0x32c8('0x12')](function(_0x424fa9){_0x490073['count']=_0x424fa9;if(_0x1e2188['query'][_0x32c8('0x57')]){_0xc445fa[_0x32c8('0x58')]=[{'model':db['CmContact'],'as':_0x32c8('0x87'),'required':![]},{'model':db['User'],'as':_0x32c8('0x88'),'attributes':['name',_0x32c8('0x89'),_0x32c8('0x8a')],'required':![]},{'model':db[_0x32c8('0x8b')],'as':_0x32c8('0x8c'),'attributes':['id',_0x32c8('0x29'),'color'],'where':_0x1e2188[_0x32c8('0x4b')][_0x32c8('0x8d')]?{'id':_0x1e2188['query'][_0x32c8('0x8d')]}:undefined,'required':_0x1e2188['query'][_0x32c8('0x8d')]?!![]:![]}];}return db[_0x32c8('0x85')][_0x32c8('0x59')](_0xc445fa);})[_0x32c8('0x12')](function(_0x3ac248){_0x490073[_0x32c8('0x6c')]=_0x3ac248;return _0x490073;});}})[_0x32c8('0x12')](respondWithFilteredResult(_0x3edb75,_0xc445fa))[_0x32c8('0x5f')](handleError(_0x3edb75,null));};exports[_0x32c8('0x8e')]=function addApplications(_0x539398,_0x223ccf){var _0x50f837=_0x539398[_0x32c8('0x5a')]['id'];var _0x20b482=_0x539398['body'];var _0x589d17=0xc8;var _0x167631=null;return db[_0x32c8('0x8f')][_0x32c8('0x90')]({'isolationLevel':db['sequelize']['Transaction'][_0x32c8('0x91')][_0x32c8('0x92')]},function(_0x31244d){return db['MailAccount']['findOne']({'where':{'id':_0x50f837},'transaction':_0x31244d})[_0x32c8('0x12')](function(_0x5be410){if(_0x5be410){return db['MailApplication'][_0x32c8('0x23')]({'where':{'MailAccountId':_0x50f837},'transaction':_0x31244d})[_0x32c8('0x12')](function(){var _0x3fc731=_['map'](_0x20b482,function(_0x3ba00f){_0x3ba00f[_0x32c8('0x65')]=_0x50f837;return _0x3ba00f;});return db[_0x32c8('0x93')]['bulkCreate'](_0x3fc731,{'transaction':_0x31244d});});}else{_0x589d17=0x194;_0x167631=[];}});})[_0x32c8('0x12')](function(){if(_0x589d17!==0x194){return db[_0x32c8('0x93')][_0x32c8('0x94')]({'where':{'MailAccountId':_0x50f837},'order':_0x32c8('0x95')})[_0x32c8('0x12')](function(_0x1c46e6){_0x167631=_0x1c46e6;});}})[_0x32c8('0x5f')](function(_0x23ff5d){_0x589d17=0x1f4;logger[_0x32c8('0x17')](_0x23ff5d[_0x32c8('0x28')]);if(_0x23ff5d['name']){delete _0x23ff5d['name'];}_0x167631=_0x23ff5d;})[_0x32c8('0x96')](function(){if(_0x167631===null){_0x223ccf['sendStatus'](_0x589d17);}else{if(_0x589d17===0x1f4){_0x223ccf[_0x32c8('0x1b')](_0x589d17)[_0x32c8('0x2a')](_0x167631);}else{_0x223ccf[_0x32c8('0x1b')](_0x589d17)[_0x32c8('0x1d')](_0x167631);}}});};exports[_0x32c8('0x97')]=function(_0x3a7292,_0x1a31f6){var _0x12add2={};var _0x31b8a1={};var _0x2ef495;var _0x5c5ffa;return db[_0x32c8('0x5b')]['findOne']({'where':{'id':_0x3a7292[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x1a31f6,null))[_0x32c8('0x12')](function(_0x1cc539){if(_0x1cc539){_0x2ef495=_0x1cc539;_0x31b8a1[_0x32c8('0x49')]=_[_0x32c8('0x4c')](db[_0x32c8('0x93')][_0x32c8('0x46')]);_0x31b8a1[_0x32c8('0x4b')]=_[_0x32c8('0x4c')](_0x3a7292[_0x32c8('0x4b')]);_0x31b8a1[_0x32c8('0x52')]=_[_0x32c8('0x4d')](_0x31b8a1['model'],_0x31b8a1['query']);_0x12add2['attributes']=_[_0x32c8('0x4d')](_0x31b8a1['model'],qs[_0x32c8('0x4f')](_0x3a7292[_0x32c8('0x4b')]['fields']));_0x12add2[_0x32c8('0x4e')]=_0x12add2[_0x32c8('0x4e')][_0x32c8('0x5c')]?_0x12add2[_0x32c8('0x4e')]:_0x31b8a1['model'];_0x12add2[_0x32c8('0x72')]=qs['sort'](_0x3a7292[_0x32c8('0x4b')][_0x32c8('0x51')]);_0x12add2['where']=qs['filters'](_[_0x32c8('0x6b')](_0x3a7292['query'],_0x31b8a1['filters']));if(_0x3a7292[_0x32c8('0x4b')]['filter']){_0x12add2[_0x32c8('0x55')]=_['merge'](_0x12add2[_0x32c8('0x55')],{'$or':_['map'](_0x12add2[_0x32c8('0x4e')],function(_0x13aedc){var _0x18faba={};_0x18faba[_0x13aedc]={'$like':'%'+_0x3a7292[_0x32c8('0x4b')][_0x32c8('0x53')]+'%'};return _0x18faba;})});}_0x12add2=_['merge']({},_0x12add2,_0x3a7292['options']);return _0x2ef495['getApplications'](_0x12add2);}})[_0x32c8('0x12')](function(_0x1a0712){if(_0x1a0712){_0x5c5ffa=_0x1a0712[_0x32c8('0x5c')];if(!_0x3a7292['query'][_0x32c8('0x6a')](_0x32c8('0x50'))){_0x12add2[_0x32c8('0x1f')]=qs[_0x32c8('0x1f')](_0x3a7292[_0x32c8('0x4b')][_0x32c8('0x1f')]);_0x12add2[_0x32c8('0x1e')]=qs[_0x32c8('0x1e')](_0x3a7292['query']['offset']);}return _0x2ef495[_0x32c8('0x97')](_0x12add2);}})[_0x32c8('0x12')](function(_0x4ef88a){if(_0x4ef88a){return _0x4ef88a?{'count':_0x5c5ffa,'rows':_0x4ef88a}:null;}})[_0x32c8('0x12')](respondWithResult(_0x1a31f6,null))['catch'](handleError(_0x1a31f6,null));};exports[_0x32c8('0x98')]=function(_0x6aa29f,_0x3cded6){var _0x382f46={'raw':!![],'where':{}};var _0x137128={};var _0x5c8e50={'count':0x0,'rows':[]};return db[_0x32c8('0x5b')][_0x32c8('0x69')]({'where':{'id':_0x6aa29f[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x3cded6,null))[_0x32c8('0x12')](function(_0x371bb6){if(_0x371bb6){_0x137128[_0x32c8('0x49')]=_['keys'](db[_0x32c8('0x99')][_0x32c8('0x46')]);_0x137128['query']=_[_0x32c8('0x4c')](_0x6aa29f['query']);_0x137128[_0x32c8('0x52')]=_[_0x32c8('0x4d')](_0x137128[_0x32c8('0x49')],_0x137128[_0x32c8('0x4b')]);_0x382f46[_0x32c8('0x4e')]=_[_0x32c8('0x4d')](_0x137128[_0x32c8('0x49')],qs['fields'](_0x6aa29f[_0x32c8('0x4b')][_0x32c8('0x4f')]));_0x382f46[_0x32c8('0x4e')]=_0x382f46[_0x32c8('0x4e')][_0x32c8('0x5c')]?_0x382f46['attributes']:_0x137128[_0x32c8('0x49')];if(!_0x6aa29f[_0x32c8('0x4b')][_0x32c8('0x6a')](_0x32c8('0x50'))){_0x382f46['limit']=qs['limit'](_0x6aa29f['query'][_0x32c8('0x1f')]);_0x382f46['offset']=qs['offset'](_0x6aa29f['query'][_0x32c8('0x1e')]);}_0x382f46[_0x32c8('0x72')]=qs[_0x32c8('0x51')](_0x6aa29f['query'][_0x32c8('0x51')]);_0x382f46['where']=qs['filters'](_[_0x32c8('0x6b')](_0x6aa29f[_0x32c8('0x4b')],_0x137128[_0x32c8('0x52')]));_0x382f46[_0x32c8('0x55')][_0x32c8('0x65')]=_0x371bb6['id'];if(_0x6aa29f[_0x32c8('0x4b')][_0x32c8('0x53')]){_0x382f46[_0x32c8('0x55')]=_[_0x32c8('0x54')](_0x382f46[_0x32c8('0x55')],{'$or':_[_0x32c8('0x4a')](_0x382f46[_0x32c8('0x4e')],function(_0x3d3b58){var _0x548819={};_0x548819[_0x3d3b58]={'$like':'%'+_0x6aa29f[_0x32c8('0x4b')]['filter']+'%'};return _0x548819;})});}if(_0x6aa29f[_0x32c8('0x4b')][_0x32c8('0x9a')]){var _0x22a38c=_0x6aa29f[_0x32c8('0x4b')]['$gte'][_0x32c8('0x9b')](',');var _0x199fa2={};_0x199fa2[_0x22a38c[0x0]]={'$gte':moment(_0x22a38c[0x1])['format'](_0x32c8('0x9c'))};_0x382f46[_0x32c8('0x55')]=_[_0x32c8('0x54')](_0x382f46[_0x32c8('0x55')],_0x199fa2);}_0x382f46=_[_0x32c8('0x54')]({},_0x382f46,_0x6aa29f[_0x32c8('0x5d')]);return db[_0x32c8('0x99')][_0x32c8('0x21')]({'where':_0x382f46[_0x32c8('0x55')]})[_0x32c8('0x12')](function(_0x2b9ff7){_0x5c8e50[_0x32c8('0x21')]=_0x2b9ff7;if(_0x6aa29f[_0x32c8('0x4b')][_0x32c8('0x57')]){_0x382f46['include']=[{'all':!![]}];}return db[_0x32c8('0x99')][_0x32c8('0x59')](_0x382f46);})[_0x32c8('0x12')](function(_0x282dcf){if(_0x6aa29f[_0x32c8('0x4b')][_0x32c8('0x9d')]===_0x32c8('0x9e')){for(var _0x34ea17=0x0;_0x34ea17<_0x282dcf['length'];_0x34ea17++){_0x282dcf[_0x34ea17][_0x32c8('0x60')]=juice(_0x282dcf[_0x34ea17][_0x32c8('0x60')]);}}_0x5c8e50[_0x32c8('0x6c')]=_0x282dcf;return _0x5c8e50;});}})[_0x32c8('0x12')](respondWithFilteredResult(_0x3cded6,_0x382f46))[_0x32c8('0x5f')](handleError(_0x3cded6,null));};exports['send']=function(_0x50beb6,_0x290cf0){var _0x3a6b42,_0x12d53c={},_0x1a995d;if(_0x50beb6[_0x32c8('0x60')]['to']){_0x1a995d=_0x50beb6['body']['to'][_0x32c8('0x9b')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x50beb6[_0x32c8('0x5a')]['id']},'include':[{'model':db[_0x32c8('0x9f')],'as':_0x32c8('0xa0'),'include':[{'model':db['CmContact'],'as':_0x32c8('0xa1'),'where':{'email':_0x1a995d},'limit':0x1,'order':[[_0x32c8('0xa2'),_0x32c8('0xa3')]]}]},{'model':db[_0x32c8('0x43')],'as':_0x32c8('0x40'),'raw':!![],'include':[{'model':db[_0x32c8('0xa4')],'as':'CloudProvider','raw':!![]}]}]})[_0x32c8('0x12')](handleEntityNotFound(_0x290cf0,null))[_0x32c8('0x12')](function(_0x6bd37e){if(!_0x6bd37e)return;_0x3a6b42=_0x6bd37e;if(!_0x6bd37e[_0x32c8('0x40')])throw new Error(_0x32c8('0xa5'));if(_['isNil'](_0x50beb6[_0x32c8('0x60')][_0x32c8('0xa6')])){_0x50beb6['body'][_0x32c8('0xa6')]=util[_0x32c8('0xa7')]('%s\x20<%s>',_0x6bd37e['name'],_0x6bd37e[_0x32c8('0xa8')]||_0x6bd37e['Smtp'][_0x32c8('0x35')]);}if(_0x50beb6['body'][_0x32c8('0xa9')]&&_0x50beb6['body'][_0x32c8('0xa9')][_0x32c8('0x5c')]){for(var _0x1899ee=0x0;_0x1899ee<_0x50beb6[_0x32c8('0x60')][_0x32c8('0xa9')]['length'];_0x1899ee+=0x1){_0x50beb6[_0x32c8('0x60')]['attachments'][_0x1899ee]={'filename':_0x50beb6['body'][_0x32c8('0xa9')][_0x1899ee][_0x32c8('0x29')],'path':path[_0x32c8('0xaa')](config[_0x32c8('0xab')],_0x32c8('0xac'),_0x50beb6[_0x32c8('0x60')][_0x32c8('0xa9')][_0x1899ee][_0x32c8('0xad')])};}}var _0xbe5103=_0x6bd37e[_0x32c8('0xae')]();return respondWithRpcPromise('SendMail',_0x32c8('0xaf'),{'account':_0xbe5103,'message':_0x50beb6[_0x32c8('0x60')]});})[_0x32c8('0x12')](function(_0xd8f5db){if(!_0xd8f5db)return;_0x12d53c=_0xd8f5db;if(!_0x3a6b42['List'])throw new Error(_0x32c8('0xb0'));if(_0x3a6b42['List']['Contacts'][_0x32c8('0x5c')])return _0x3a6b42[_0x32c8('0xa0')][_0x32c8('0xa1')][0x0];return db[_0x32c8('0xb1')][_0x32c8('0x67')](_[_0x32c8('0xb')](_0x50beb6[_0x32c8('0x60')],{'firstName':_0x50beb6[_0x32c8('0x60')]['to'],'email':_0x50beb6[_0x32c8('0x60')]['to'],'phone':_0x50beb6['body']['to'],'ListId':_0x3a6b42['ListId']}));})[_0x32c8('0x12')](function(_0x5e7fc3){if(!_0x5e7fc3)return;var _0x553506={'UserId':_0x50beb6[_0x32c8('0x35')]['id'],'ContactId':_0x5e7fc3['id'],'MailAccountId':_0x3a6b42['id'],'inReplyTo':_0x12d53c[_0x32c8('0xb2')],'to':_0x50beb6['body']['from'],'cc':_0x50beb6[_0x32c8('0x60')]['cc'],'subject':_0x50beb6[_0x32c8('0x60')]['subject'],'attach':_0x50beb6['body'][_0x32c8('0xb3')],'firstMsgDirection':_0x32c8('0xb4'),'lastMsgAt':moment()[_0x32c8('0xa7')](_0x32c8('0x9c')),'lastMsgDirection':_0x32c8('0xb4'),'Messages':[_[_0x32c8('0x54')](_0x50beb6['body'],{'messageId':_0x12d53c[_0x32c8('0xb2')],'sentAt':moment()[_0x32c8('0xa7')](_0x32c8('0x9c')),'read':!![],'MailAccountId':_0x3a6b42['id'],'UserId':_0x50beb6[_0x32c8('0x35')]['id'],'ContactId':_0x5e7fc3['id']})]};if(_0x50beb6[_0x32c8('0x60')][_0x32c8('0xb5')]){_0x553506=_[_0x32c8('0x54')](_0x553506,_0x50beb6[_0x32c8('0x60')][_0x32c8('0xb5')]);}return db[_0x32c8('0x85')][_0x32c8('0x67')](_0x553506,{'include':[{'model':db[_0x32c8('0x99')],'as':_0x32c8('0xb6')}]});})[_0x32c8('0x12')](respondWithResult(_0x290cf0,null))[_0x32c8('0x5f')](handleError(_0x290cf0,null));};exports[_0x32c8('0xb7')]=function(_0x2d0253,_0x35e645){return db[_0x32c8('0x5b')][_0x32c8('0x5e')]({'where':{'id':_0x2d0253[_0x32c8('0x5a')]['id']},'include':[{'model':db[_0x32c8('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x32c8('0xa4')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x35e645,null))[_0x32c8('0x12')](function(_0x108780){if(!_0x108780['Smtp'])return;var _0xa5acf4=_0x108780[_0x32c8('0xae')]();return respondWithRpcPromise(_0x32c8('0xb8'),'verifySmtp',{'account':_0xa5acf4});})[_0x32c8('0x12')](respondWithResult(_0x35e645,null))['catch'](handleError(_0x35e645,null));};exports[_0x32c8('0x23')]=function(_0x1174d2,_0x1a6373){return db[_0x32c8('0x5b')][_0x32c8('0x5e')]({'where':{'id':_0x1174d2[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x1a6373,null))[_0x32c8('0x12')](function(_0x2b9108){if(_0x2b9108&&_0x2b9108[_0x32c8('0x3d')]){throw new db[(_0x32c8('0xb9'))][(_0x32c8('0xba'))](_0x32c8('0xbb'));}return _0x2b9108;})['then'](removeEntity(_0x1a6373,null))[_0x32c8('0x5f')](handleError(_0x1a6373,null));};exports['addAgents']=function(_0x5856b7,_0x3c7605){return db[_0x32c8('0x5b')]['find']({'where':{'id':_0x5856b7[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x3c7605,null))[_0x32c8('0x12')](function(_0x1529a2){if(_0x1529a2){return _0x1529a2['addAgents'](_0x5856b7[_0x32c8('0x60')][_0x32c8('0x6e')],_[_0x32c8('0xbc')](_0x5856b7[_0x32c8('0x60')],[_0x32c8('0x6e'),'id'])||{})[_0x32c8('0xbd')](function(_0x52be45){for(var _0x5ca186=0x0;_0x5ca186<_0x5856b7[_0x32c8('0x60')][_0x32c8('0x6e')][_0x32c8('0x5c')];_0x5ca186+=0x1){socket[_0x32c8('0xbe')](_0x32c8('0xbf'),{'UserId':Number(_0x5856b7[_0x32c8('0x60')][_0x32c8('0x6e')][_0x5ca186]),'MailAccountId':Number(_0x5856b7[_0x32c8('0x5a')]['id'])});}return _0x52be45;});}})[_0x32c8('0x12')](respondWithResult(_0x3c7605,null))[_0x32c8('0x5f')](handleError(_0x3c7605,null));};exports['removeAgents']=function(_0x4ae7d1,_0x1269b0){return db['MailAccount'][_0x32c8('0x5e')]({'where':{'id':_0x4ae7d1[_0x32c8('0x5a')]['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x1269b0,null))[_0x32c8('0x12')](function(_0x4ab307){if(_0x4ab307){return _0x4ab307[_0x32c8('0xc0')](_0x4ae7d1[_0x32c8('0x4b')][_0x32c8('0x6e')])[_0x32c8('0x12')](function(){if(_[_0x32c8('0xc1')](_0x4ae7d1[_0x32c8('0x4b')]['ids'])){for(var _0x340bf5=0x0;_0x340bf5<_0x4ae7d1[_0x32c8('0x4b')][_0x32c8('0x6e')]['length'];_0x340bf5+=0x1){socket[_0x32c8('0xbe')](_0x32c8('0xc2'),{'UserId':Number(_0x4ae7d1[_0x32c8('0x4b')][_0x32c8('0x6e')][_0x340bf5]),'MailAccountId':Number(_0x4ae7d1[_0x32c8('0x5a')]['id'])});}}else{socket['emit'](_0x32c8('0xc2'),{'UserId':Number(_0x4ae7d1[_0x32c8('0x4b')]['ids']),'MailAccountId':Number(_0x4ae7d1[_0x32c8('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1269b0,null))[_0x32c8('0x5f')](handleError(_0x1269b0,null));};exports[_0x32c8('0xc3')]=function(_0x817ce5,_0x25f1c7){var _0x39b717={};var _0x176288={};var _0x281933;var _0x36daed;return db[_0x32c8('0x5b')][_0x32c8('0x69')]({'where':{'id':_0x817ce5['params']['id']}})[_0x32c8('0x12')](handleEntityNotFound(_0x25f1c7,null))[_0x32c8('0x12')](function(_0x418240){if(_0x418240){_0x281933=_0x418240;_0x176288[_0x32c8('0x49')]=_[_0x32c8('0x4c')](db[_0x32c8('0xc4')][_0x32c8('0x46')]);_0x176288[_0x32c8('0x4b')]=_['keys'](_0x817ce5[_0x32c8('0x4b')]);_0x176288['filters']=_[_0x32c8('0x4d')](_0x176288['model'],_0x176288[_0x32c8('0x4b')]);_0x39b717[_0x32c8('0x4e')]=_[_0x32c8('0x4d')](_0x176288[_0x32c8('0x49')],qs['fields'](_0x817ce5[_0x32c8('0x4b')][_0x32c8('0x4f')]));_0x39b717[_0x32c8('0x4e')]=_0x39b717[_0x32c8('0x4e')][_0x32c8('0x5c')]?_0x39b717[_0x32c8('0x4e')]:_0x176288[_0x32c8('0x49')];_0x39b717[_0x32c8('0x72')]=qs[_0x32c8('0x51')](_0x817ce5[_0x32c8('0x4b')][_0x32c8('0x51')]);_0x39b717[_0x32c8('0x55')]=qs[_0x32c8('0x52')](_[_0x32c8('0x6b')](_0x817ce5[_0x32c8('0x4b')],_0x176288[_0x32c8('0x52')]));if(_0x817ce5[_0x32c8('0x4b')]['filter']){_0x39b717[_0x32c8('0x55')]=_[_0x32c8('0x54')](_0x39b717[_0x32c8('0x55')],{'$or':_['map'](_0x39b717[_0x32c8('0x4e')],function(_0x2914de){var _0x4b25ab={};_0x4b25ab[_0x2914de]={'$like':'%'+_0x817ce5[_0x32c8('0x4b')][_0x32c8('0x53')]+'%'};return _0x4b25ab;})});}_0x39b717=_[_0x32c8('0x54')]({},_0x39b717,_0x817ce5[_0x32c8('0x5d')]);return _0x281933[_0x32c8('0xc3')](_0x39b717);}})[_0x32c8('0x12')](function(_0x546f50){if(_0x546f50){_0x36daed=_0x546f50[_0x32c8('0x5c')];if(!_0x817ce5[_0x32c8('0x4b')][_0x32c8('0x6a')](_0x32c8('0x50'))){_0x39b717[_0x32c8('0x1f')]=qs[_0x32c8('0x1f')](_0x817ce5[_0x32c8('0x4b')][_0x32c8('0x1f')]);_0x39b717[_0x32c8('0x1e')]=qs[_0x32c8('0x1e')](_0x817ce5[_0x32c8('0x4b')]['offset']);}return _0x281933[_0x32c8('0xc3')](_0x39b717);}})[_0x32c8('0x12')](function(_0x333570){if(_0x333570){return _0x333570?{'count':_0x36daed,'rows':_0x333570}:null;}})[_0x32c8('0x12')](respondWithResult(_0x25f1c7,null))['catch'](handleError(_0x25f1c7,null));}; \ No newline at end of file +var _0x4611=['../../config/logger','../../config/environment','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','destroy','get','MailAccounts','UserProfileResource','then','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','MailServerIn','length','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','rawAttributes','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Contact','User','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','CmContact','Contacts','updatedAt','CloudProvider','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','attach','out','messageId','Interaction','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','userMailAccount:remove','emit','getAgents','moment','path','lodash','juice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4611,0x17c));var _0x1461=function(_0xb4a4c2,_0x1632d6){_0xb4a4c2=_0xb4a4c2-0x0;var _0x1e2d40=_0x4611[_0xb4a4c2];return _0x1e2d40;};'use strict';var moment=require(_0x1461('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x1461('0x1'));var _=require(_0x1461('0x2'));var juice=require(_0x1461('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1461('0x4'))('api');var config=require(_0x1461('0x5'));var db=require('../../mysqldb')['db'];config[_0x1461('0x6')]=_[_0x1461('0x7')](config[_0x1461('0x6')],{'host':_0x1461('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1461('0x6')]));require(_0x1461('0x9'))['register'](socket);var jayson=require(_0x1461('0xa'));var client=jayson[_0x1461('0xb')][_0x1461('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x561f57,_0x2efe42,_0x1fadf4,_0x4acbdd){return new BPromise(function(_0x3bcbf6,_0x2976e6){var _0x12151d=_0x4acbdd||client;return _0x12151d[_0x1461('0xd')](_0x561f57,_0x1fadf4)['then'](function(_0x3b5563){logger['info'](_0x1461('0xe'),_0x2efe42,_0x1461('0xf'));logger[_0x1461('0x10')](_0x1461('0x11'),_0x2efe42,_0x1461('0xf'),JSON['stringify'](_0x3b5563));if(_0x3b5563[_0x1461('0x12')]){if(_0x3b5563['error']['code']===0x1f4){logger[_0x1461('0x12')](_0x1461('0xe'),_0x2efe42,_0x3b5563['error'][_0x1461('0x13')]);return _0x2976e6(_0x3b5563[_0x1461('0x12')][_0x1461('0x13')]);}logger[_0x1461('0x12')](_0x1461('0xe'),_0x2efe42,_0x3b5563['error'][_0x1461('0x13')]);return _0x3bcbf6(_0x3b5563[_0x1461('0x12')][_0x1461('0x13')]);}else{logger['info'](_0x1461('0xe'),_0x2efe42,'request\x20sent');_0x3bcbf6(_0x3b5563[_0x1461('0x14')][_0x1461('0x13')]);}})['catch'](function(_0x144f24){logger[_0x1461('0x12')](_0x1461('0xe'),_0x2efe42,_0x144f24);_0x2976e6(_0x144f24);});});}function respondWithStatusCode(_0x4384af,_0x167585){_0x167585=_0x167585||0xcc;return function(_0x23cc2e){if(_0x23cc2e){return _0x4384af[_0x1461('0x15')](_0x167585);}return _0x4384af[_0x1461('0x16')](_0x167585)[_0x1461('0x17')]();};}function respondWithResult(_0x586b1b,_0x15b017){_0x15b017=_0x15b017||0xc8;return function(_0x41e65f){if(_0x41e65f){return _0x586b1b[_0x1461('0x16')](_0x15b017)['json'](_0x41e65f);}};}function respondWithFilteredResult(_0xae0f3b,_0x5ed140){return function(_0x52e038){if(_0x52e038){var _0x5050f6=typeof _0x5ed140[_0x1461('0x18')]==='undefined'&&typeof _0x5ed140['limit']===_0x1461('0x19');var _0xaa846d=_0x52e038[_0x1461('0x1a')];var _0x264087=_0x5050f6?0x0:_0x5ed140['offset'];var _0x3400f4=_0x5050f6?_0x52e038['count']:_0x5ed140[_0x1461('0x18')]+_0x5ed140[_0x1461('0x1b')];var _0x2be5c8;if(_0x3400f4>=_0xaa846d){_0x3400f4=_0xaa846d;_0x2be5c8=0xc8;}else{_0x2be5c8=0xce;}_0xae0f3b[_0x1461('0x16')](_0x2be5c8);return _0xae0f3b[_0x1461('0x1c')](_0x1461('0x1d'),_0x264087+'-'+_0x3400f4+'/'+_0xaa846d)[_0x1461('0x1e')](_0x52e038);}return null;};}function saveUpdates(_0x1e8dd8){return function(_0x4752c2){if(_0x4752c2){return _0x4752c2[_0x1461('0x1f')](_0x1e8dd8)['then'](function(_0xf850c2){return _0xf850c2;});}return null;};}function removeEntity(_0x3ad8ee){return function(_0x2328c6){if(_0x2328c6){return _0x2328c6[_0x1461('0x20')]()['then'](function(){var _0x33c285=_0x2328c6[_0x1461('0x21')]({'plain':!![]});var _0x47c544=_0x1461('0x22');return db[_0x1461('0x23')]['destroy']({'where':{'type':_0x47c544,'resourceId':_0x33c285['id']}})['then'](function(){return _0x2328c6;});})[_0x1461('0x24')](function(){_0x3ad8ee['status'](0xcc)[_0x1461('0x17')]();});}};}function handleEntityNotFound(_0x559121){return function(_0xbb003e){if(!_0xbb003e){_0x559121[_0x1461('0x15')](0x194);}return _0xbb003e;};}function handleError(_0x2b35f8,_0x5c8430){_0x5c8430=_0x5c8430||0x1f4;return function(_0x51dd9c){logger[_0x1461('0x12')](_0x51dd9c[_0x1461('0x25')]);if(_0x51dd9c[_0x1461('0x26')]){delete _0x51dd9c[_0x1461('0x26')];}_0x2b35f8[_0x1461('0x16')](_0x5c8430)['send'](_0x51dd9c);};}function getImapHost(_0x32064f){switch(_0x32064f){case _0x1461('0x27'):return _0x1461('0x28');case _0x1461('0x29'):return _0x1461('0x2a');case _0x1461('0x2b'):return _0x1461('0x2c');case _0x1461('0x2d'):return _0x1461('0x2e');}throw new Error(_0x1461('0x2f'),_0x32064f);}function getSmtpHost(_0x1ac3d9){switch(_0x1ac3d9){case _0x1461('0x27'):return _0x1461('0x30');case _0x1461('0x29'):return _0x1461('0x31');case _0x1461('0x2b'):return _0x1461('0x32');case _0x1461('0x2d'):return _0x1461('0x33');}throw new Error(_0x1461('0x2f'),_0x1ac3d9);}function getAuthenticationOptions(_0x5b5249,_0x34636f){var _0x39a248={};var _0x434934={};if(_0x5b5249){_0x39a248[_0x1461('0x34')]=_0x434934[_0x1461('0x34')]=_0x34636f[_0x1461('0x35')];_0x39a248[_0x1461('0x36')]=_0x434934['pass']=_0x34636f['password'];if(_0x34636f[_0x1461('0x37')]){_0x39a248[_0x1461('0x37')]=_0x434934[_0x1461('0x37')]=!![];_0x39a248[_0x1461('0x38')]=_0x434934['CloudProviderId']=_0x34636f[_0x1461('0x38')];_0x39a248[_0x1461('0x36')]=_0x434934[_0x1461('0x39')]=null;}else{_0x39a248['CloudProviderId']=_0x434934[_0x1461('0x38')]=null;}_0x39a248['host']=getImapHost(_0x5b5249);_0x39a248[_0x1461('0x3a')]=0x3e1;_0x434934[_0x1461('0x3b')]=getSmtpHost(_0x5b5249);_0x434934[_0x1461('0x3a')]=0x24b;_0x434934[_0x1461('0x3c')]=![];_0x39a248[_0x1461('0x3d')]=_0x434934[_0x1461('0x3d')]=null;}else{if(_0x34636f['authentication']){_0x39a248[_0x1461('0x34')]=_0x434934[_0x1461('0x34')]=_0x34636f[_0x1461('0x35')];_0x39a248[_0x1461('0x36')]=_0x434934[_0x1461('0x39')]=_0x34636f[_0x1461('0x36')];}else{_0x39a248['authentication']=_0x434934['authentication']=![];_0x39a248[_0x1461('0x34')]=_0x434934[_0x1461('0x34')]=null;_0x39a248['password']=_0x434934['pass']=null;}_0x39a248[_0x1461('0x3b')]=_0x34636f[_0x1461('0x3e')][_0x1461('0x3b')];_0x39a248['port']=_0x34636f['Imap'][_0x1461('0x3a')];_0x434934[_0x1461('0x3b')]=_0x34636f[_0x1461('0x3f')][_0x1461('0x3b')];_0x434934['port']=_0x34636f[_0x1461('0x3f')]['port'];}return{'Imap':_0x39a248,'Smtp':_0x434934};}exports[_0x1461('0x40')]=function(_0x5126cc,_0x350079){var _0x230fca={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x1461('0x41')],'as':_0x1461('0x3f')},{'model':db[_0x1461('0x42')],'as':_0x1461('0x43')}]},_0xf12933={},_0x220e26={'count':0x0,'rows':[]};var _0x5a932f=_[_0x1461('0x44')](db[_0x1461('0x45')]['rawAttributes'],function(_0x54a70f){return{'name':_0x54a70f[_0x1461('0x46')],'type':_0x54a70f[_0x1461('0x47')][_0x1461('0x48')]};});_0xf12933[_0x1461('0x49')]=_[_0x1461('0x44')](_0x5a932f,_0x1461('0x26'));_0xf12933[_0x1461('0x4a')]=_[_0x1461('0x4b')](_0x5126cc[_0x1461('0x4a')]);_0xf12933[_0x1461('0x4c')]=_[_0x1461('0x4d')](_0xf12933[_0x1461('0x49')],_0xf12933[_0x1461('0x4a')]);_0x230fca[_0x1461('0x4e')]=_['intersection'](_0xf12933[_0x1461('0x49')],qs[_0x1461('0x4f')](_0x5126cc[_0x1461('0x4a')][_0x1461('0x4f')]));_0x230fca['attributes']=_0x230fca[_0x1461('0x4e')]['length']?_0x230fca[_0x1461('0x4e')]:_0xf12933[_0x1461('0x49')];if(!_0x5126cc[_0x1461('0x4a')][_0x1461('0x50')](_0x1461('0x51'))){_0x230fca[_0x1461('0x1b')]=qs[_0x1461('0x1b')](_0x5126cc[_0x1461('0x4a')]['limit']);_0x230fca[_0x1461('0x18')]=qs[_0x1461('0x18')](_0x5126cc[_0x1461('0x4a')][_0x1461('0x18')]);}_0x230fca[_0x1461('0x52')]=qs[_0x1461('0x53')](_0x5126cc[_0x1461('0x4a')][_0x1461('0x53')]);_0x230fca[_0x1461('0x54')]=qs['filters'](_[_0x1461('0x55')](_0x5126cc[_0x1461('0x4a')],_0xf12933[_0x1461('0x4c')]),_0x5a932f);if(_0x5126cc[_0x1461('0x4a')][_0x1461('0x56')]){_0x230fca[_0x1461('0x54')]=_[_0x1461('0x57')](_0x230fca[_0x1461('0x54')],{'$or':_[_0x1461('0x44')](_0x5a932f,function(_0x4ea186){if(_0x4ea186[_0x1461('0x47')]!=='VIRTUAL'){var _0x9d134={};_0x9d134[_0x4ea186[_0x1461('0x26')]]={'$like':'%'+_0x5126cc[_0x1461('0x4a')][_0x1461('0x56')]+'%'};return _0x9d134;}})});}_0x230fca=_[_0x1461('0x57')]({},_0x230fca,_0x5126cc[_0x1461('0x58')]);var _0x5a1149={'where':_0x230fca['where']};return db['MailAccount'][_0x1461('0x1a')](_0x5a1149)['then'](function(_0xcee579){_0x220e26[_0x1461('0x1a')]=_0xcee579;if(_0x5126cc['query'][_0x1461('0x59')]){_0x230fca[_0x1461('0x5a')]=[{'all':!![]}];}return db[_0x1461('0x45')][_0x1461('0x5b')](_0x230fca);})[_0x1461('0x24')](function(_0x3a6cf5){_0x220e26[_0x1461('0x5c')]=_0x3a6cf5;return _0x220e26;})[_0x1461('0x24')](respondWithFilteredResult(_0x350079,_0x230fca))[_0x1461('0x5d')](handleError(_0x350079,null));};exports[_0x1461('0x5e')]=function(_0x42f96e,_0xb24e22){var _0x26cca2={'raw':![],'where':{'id':_0x42f96e['params']['id']},'include':[{'model':db[_0x1461('0x5f')],'as':_0x1461('0x3e')},{'model':db['MailServerOut'],'as':_0x1461('0x3f')},{'model':db['Pause'],'as':_0x1461('0x43')}]},_0x5dee9d={};_0x5dee9d[_0x1461('0x49')]=_['keys'](db[_0x1461('0x45')]['rawAttributes']);_0x5dee9d[_0x1461('0x4a')]=_[_0x1461('0x4b')](_0x42f96e[_0x1461('0x4a')]);_0x5dee9d['filters']=_[_0x1461('0x4d')](_0x5dee9d[_0x1461('0x49')],_0x5dee9d[_0x1461('0x4a')]);_0x26cca2[_0x1461('0x4e')]=_[_0x1461('0x4d')](_0x5dee9d['model'],qs['fields'](_0x42f96e['query'][_0x1461('0x4f')]));_0x26cca2[_0x1461('0x4e')]=_0x26cca2[_0x1461('0x4e')][_0x1461('0x60')]?_0x26cca2['attributes']:_0x5dee9d[_0x1461('0x49')];if(_0x42f96e[_0x1461('0x4a')][_0x1461('0x59')]){_0x26cca2[_0x1461('0x5a')]=[{'all':!![]}];}_0x26cca2=_[_0x1461('0x57')]({},_0x26cca2,_0x42f96e[_0x1461('0x58')]);return db['MailAccount'][_0x1461('0x61')](_0x26cca2)[_0x1461('0x24')](handleEntityNotFound(_0xb24e22,null))[_0x1461('0x24')](respondWithResult(_0xb24e22,null))['catch'](handleError(_0xb24e22,null));};exports[_0x1461('0x1f')]=function(_0x42a635,_0x2fcab0){if(_0x42a635[_0x1461('0x62')]['id']){delete _0x42a635[_0x1461('0x62')]['id'];}var _0x30b603=_0x42a635[_0x1461('0x62')][_0x1461('0x63')]===_0x1461('0x64')?null:_0x42a635[_0x1461('0x62')][_0x1461('0x63')];var _0xa2055e=_0x42a635[_0x1461('0x62')][_0x1461('0x3e')]||{};var _0x2089b4=_0x42a635['body'][_0x1461('0x3f')]||{};if(_0x30b603){_0xa2055e['host']=getImapHost(_0x30b603);_0xa2055e['port']=0x3e1;_0x2089b4[_0x1461('0x3b')]=getSmtpHost(_0x30b603);_0x2089b4['port']=0x24b;_0x2089b4['secure']=![];}if(_0x2089b4[_0x1461('0x37')]){_0x2089b4['secure']=![];}else{_0x2089b4[_0x1461('0x38')]=null;}if(!_0xa2055e[_0x1461('0x37')])_0xa2055e[_0x1461('0x38')]=null;_0x42a635[_0x1461('0x62')]['Imap']=_0xa2055e;_0x42a635[_0x1461('0x62')]['Smtp']=_0x2089b4;return db['MailAccount']['find']({'where':{'id':_0x42a635[_0x1461('0x65')]['id']},'include':[{'model':db[_0x1461('0x5f')],'as':_0x1461('0x3e')},{'model':db[_0x1461('0x41')],'as':_0x1461('0x3f')},{'model':db['Pause'],'as':_0x1461('0x43')}]})[_0x1461('0x24')](handleEntityNotFound(_0x2fcab0,null))['then'](function(_0xbf0785){if(!_0xbf0785)throw new Error(_0x1461('0x66'));if(_0xbf0785[_0x1461('0x3d')])delete _0x42a635[_0x1461('0x62')]['Imap'];return _0xbf0785;})[_0x1461('0x24')](saveUpdates(_0x42a635[_0x1461('0x62')],null))[_0x1461('0x24')](function(_0x541c43){if(!_0x42a635['body'][_0x1461('0x3e')])return _0x541c43;return db['MailServerIn'][_0x1461('0x1f')](_0x42a635[_0x1461('0x62')]['Imap'],{'where':{'MailAccountId':_0x541c43['id']}})[_0x1461('0x24')](function(){return _0x541c43;});})[_0x1461('0x24')](function(_0x2f8c6b){if(!_0x42a635[_0x1461('0x62')][_0x1461('0x3f')])return _0x2f8c6b;return db[_0x1461('0x41')]['update'](_0x42a635[_0x1461('0x62')][_0x1461('0x3f')],{'where':{'MailAccountId':_0x2f8c6b['id']}})['then'](function(){return _0x2f8c6b;});})['then'](respondWithResult(_0x2fcab0,null))[_0x1461('0x5d')](handleError(_0x2fcab0,null));};exports[_0x1461('0x67')]=function(_0x54188e,_0x5c274b){return db[_0x1461('0x45')][_0x1461('0x67')]()[_0x1461('0x24')](respondWithResult(_0x5c274b,null))['catch'](handleError(_0x5c274b,null));};exports[_0x1461('0x68')]=function(_0x522016,_0xa12771){if(_0x522016[_0x1461('0x62')]['id']){delete _0x522016['body']['id'];}return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x522016['params']['id']}})[_0x1461('0x24')](handleEntityNotFound(_0xa12771,null))['then'](function(_0x54c684){if(_0x54c684){_0x522016['body']['MailAccountId']=_0x54c684['id'];return db[_0x1461('0x69')][_0x1461('0x6a')](_0x522016[_0x1461('0x62')]);}})[_0x1461('0x24')](respondWithResult(_0xa12771,null))[_0x1461('0x5d')](handleError(_0xa12771,null));};exports[_0x1461('0x6b')]=function(_0x460f9e,_0x4b4f58){var _0x470034={'raw':![],'where':{}};var _0x52613={};var _0x246d56={'count':0x0,'rows':[]};return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0x460f9e[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x4b4f58,null))[_0x1461('0x24')](function(_0x59bdd1){if(_0x59bdd1){_0x52613[_0x1461('0x49')]=_['keys'](db['Disposition'][_0x1461('0x6d')]);_0x52613[_0x1461('0x4a')]=_[_0x1461('0x4b')](_0x460f9e[_0x1461('0x4a')]);_0x52613[_0x1461('0x4c')]=_[_0x1461('0x4d')](_0x52613['model'],_0x52613[_0x1461('0x4a')]);_0x470034[_0x1461('0x4e')]=_[_0x1461('0x4d')](_0x52613[_0x1461('0x49')],qs[_0x1461('0x4f')](_0x460f9e[_0x1461('0x4a')][_0x1461('0x4f')]));_0x470034[_0x1461('0x4e')]=_0x470034[_0x1461('0x4e')][_0x1461('0x60')]?_0x470034[_0x1461('0x4e')]:_0x52613[_0x1461('0x49')];if(!_0x460f9e['query'][_0x1461('0x50')]('nolimit')){_0x470034[_0x1461('0x1b')]=qs[_0x1461('0x1b')](_0x460f9e[_0x1461('0x4a')][_0x1461('0x1b')]);_0x470034['offset']=qs[_0x1461('0x18')](_0x460f9e[_0x1461('0x4a')]['offset']);}_0x470034[_0x1461('0x52')]=qs[_0x1461('0x53')](_0x460f9e[_0x1461('0x4a')][_0x1461('0x53')]);_0x470034[_0x1461('0x54')]=qs[_0x1461('0x4c')](_[_0x1461('0x55')](_0x460f9e[_0x1461('0x4a')],_0x52613[_0x1461('0x4c')]));_0x470034[_0x1461('0x54')][_0x1461('0x6e')]=_0x59bdd1['id'];if(_0x460f9e[_0x1461('0x4a')][_0x1461('0x56')]){_0x470034[_0x1461('0x54')]=_[_0x1461('0x57')](_0x470034[_0x1461('0x54')],{'$or':_[_0x1461('0x44')](_0x470034[_0x1461('0x4e')],function(_0x2ec1a4){var _0x224824={};_0x224824[_0x2ec1a4]={'$like':'%'+_0x460f9e[_0x1461('0x4a')][_0x1461('0x56')]+'%'};return _0x224824;})});}_0x470034=_[_0x1461('0x57')]({},_0x470034,_0x460f9e['options']);return db[_0x1461('0x69')][_0x1461('0x1a')]({'where':_0x470034[_0x1461('0x54')]})[_0x1461('0x24')](function(_0x108d84){_0x246d56[_0x1461('0x1a')]=_0x108d84;if(_0x460f9e[_0x1461('0x4a')][_0x1461('0x59')]){_0x470034[_0x1461('0x5a')]=[{'all':!![]}];}return db[_0x1461('0x69')][_0x1461('0x5b')](_0x470034);})[_0x1461('0x24')](function(_0x16f9de){_0x246d56[_0x1461('0x5c')]=_0x16f9de;return _0x246d56;});}})[_0x1461('0x24')](respondWithFilteredResult(_0x4b4f58,_0x470034))[_0x1461('0x5d')](handleError(_0x4b4f58,null));};exports[_0x1461('0x6f')]=function(_0x44c364,_0x1054d7){return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x44c364[_0x1461('0x65')]['id']}})['then'](handleEntityNotFound(_0x1054d7,null))[_0x1461('0x24')](function(_0x53e0d9){if(_0x53e0d9){return _0x53e0d9[_0x1461('0x6f')](_0x44c364[_0x1461('0x4a')][_0x1461('0x70')]);}})[_0x1461('0x24')](respondWithStatusCode(_0x1054d7,null))[_0x1461('0x5d')](handleError(_0x1054d7,null));};exports[_0x1461('0x71')]=function(_0x373e03,_0x5e2223){if(_0x373e03[_0x1461('0x62')]['id']){delete _0x373e03['body']['id'];}return db['MailAccount'][_0x1461('0x61')]({'where':{'id':_0x373e03[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x5e2223,null))['then'](function(_0x34e70d){if(_0x34e70d){_0x373e03[_0x1461('0x62')][_0x1461('0x6e')]=_0x34e70d['id'];return db[_0x1461('0x72')][_0x1461('0x6a')](_0x373e03[_0x1461('0x62')]);}})[_0x1461('0x24')](respondWithResult(_0x5e2223,null))['catch'](handleError(_0x5e2223,null));};exports[_0x1461('0x73')]=function(_0xe28a45,_0x3d098f){var _0x2a4b8a={'raw':![],'where':{}};var _0x1acc4d={};var _0x385d65={'count':0x0,'rows':[]};return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0xe28a45[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x3d098f,null))[_0x1461('0x24')](function(_0x1a9013){if(_0x1a9013){_0x1acc4d[_0x1461('0x49')]=_[_0x1461('0x4b')](db[_0x1461('0x72')][_0x1461('0x6d')]);_0x1acc4d['query']=_[_0x1461('0x4b')](_0xe28a45[_0x1461('0x4a')]);_0x1acc4d['filters']=_['intersection'](_0x1acc4d[_0x1461('0x49')],_0x1acc4d['query']);_0x2a4b8a['attributes']=_[_0x1461('0x4d')](_0x1acc4d[_0x1461('0x49')],qs['fields'](_0xe28a45[_0x1461('0x4a')][_0x1461('0x4f')]));_0x2a4b8a[_0x1461('0x4e')]=_0x2a4b8a[_0x1461('0x4e')]['length']?_0x2a4b8a[_0x1461('0x4e')]:_0x1acc4d[_0x1461('0x49')];if(!_0xe28a45[_0x1461('0x4a')][_0x1461('0x50')](_0x1461('0x51'))){_0x2a4b8a[_0x1461('0x1b')]=qs[_0x1461('0x1b')](_0xe28a45[_0x1461('0x4a')]['limit']);_0x2a4b8a[_0x1461('0x18')]=qs[_0x1461('0x18')](_0xe28a45[_0x1461('0x4a')][_0x1461('0x18')]);}_0x2a4b8a[_0x1461('0x52')]=qs[_0x1461('0x53')](_0xe28a45[_0x1461('0x4a')][_0x1461('0x53')]);_0x2a4b8a['where']=qs[_0x1461('0x4c')](_[_0x1461('0x55')](_0xe28a45[_0x1461('0x4a')],_0x1acc4d[_0x1461('0x4c')]));_0x2a4b8a[_0x1461('0x54')][_0x1461('0x6e')]=_0x1a9013['id'];if(_0xe28a45['query'][_0x1461('0x56')]){_0x2a4b8a[_0x1461('0x54')]=_[_0x1461('0x57')](_0x2a4b8a[_0x1461('0x54')],{'$or':_[_0x1461('0x44')](_0x2a4b8a[_0x1461('0x4e')],function(_0xff28b9){var _0xc1c7f0={};_0xc1c7f0[_0xff28b9]={'$like':'%'+_0xe28a45[_0x1461('0x4a')][_0x1461('0x56')]+'%'};return _0xc1c7f0;})});}_0x2a4b8a=_[_0x1461('0x57')]({},_0x2a4b8a,_0xe28a45[_0x1461('0x58')]);return db['CannedAnswer'][_0x1461('0x1a')]({'where':_0x2a4b8a['where']})['then'](function(_0x108fa5){_0x385d65['count']=_0x108fa5;if(_0xe28a45[_0x1461('0x4a')][_0x1461('0x59')]){_0x2a4b8a['include']=[{'all':!![]}];}return db[_0x1461('0x72')][_0x1461('0x5b')](_0x2a4b8a);})['then'](function(_0xe0e619){_0x385d65[_0x1461('0x5c')]=_0xe0e619;return _0x385d65;});}})['then'](respondWithFilteredResult(_0x3d098f,_0x2a4b8a))[_0x1461('0x5d')](handleError(_0x3d098f,null));};exports[_0x1461('0x74')]=function(_0x1efd4e,_0x2989c1){return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x1efd4e[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x2989c1,null))[_0x1461('0x24')](function(_0x2503db){if(_0x2503db){return _0x2503db[_0x1461('0x74')](_0x1efd4e[_0x1461('0x4a')][_0x1461('0x70')]);}})['then'](respondWithStatusCode(_0x2989c1,null))[_0x1461('0x5d')](handleError(_0x2989c1,null));};exports[_0x1461('0x6a')]=function(_0x2d5ce4,_0x310c74){var _0x2ebf3f={'name':_0x2d5ce4[_0x1461('0x62')]['name'],'key':_0x2d5ce4[_0x1461('0x62')][_0x1461('0x48')],'provider':_0x2d5ce4['body'][_0x1461('0x63')]===_0x1461('0x64')?null:_0x2d5ce4[_0x1461('0x62')][_0x1461('0x63')],'email':_0x2d5ce4[_0x1461('0x62')]['email'],'ListId':_0x2d5ce4[_0x1461('0x62')][_0x1461('0x75')],'active':!_[_0x1461('0x76')](_0x2d5ce4[_0x1461('0x62')][_0x1461('0x77')])?_0x2d5ce4[_0x1461('0x62')][_0x1461('0x77')]:!![],'description':_0x2d5ce4['body'][_0x1461('0x78')]||null};var _0x3fc215=getAuthenticationOptions(_0x2ebf3f[_0x1461('0x63')],_0x2d5ce4['body']);_0x2ebf3f[_0x1461('0x3e')]=_0x3fc215[_0x1461('0x3e')];_0x2ebf3f[_0x1461('0x3f')]=_0x3fc215[_0x1461('0x3f')];return db[_0x1461('0x45')][_0x1461('0x6a')](_0x2ebf3f,{'include':[{'model':db[_0x1461('0x41')],'as':_0x1461('0x3f')},{'model':db[_0x1461('0x5f')],'as':_0x1461('0x3e')}]})[_0x1461('0x24')](function(_0x4c38f1){var _0x2aef1e=_0x2d5ce4['user'][_0x1461('0x21')]({'plain':!![]});if(!_0x2aef1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2aef1e[_0x1461('0x79')]==='user'){var _0xa0bcd8=_0x4c38f1[_0x1461('0x21')]({'plain':!![]});return db[_0x1461('0x7a')][_0x1461('0x61')]({'where':{'name':_0x1461('0x22'),'userProfileId':_0x2aef1e[_0x1461('0x7b')]},'raw':!![]})[_0x1461('0x24')](function(_0x1e7378){if(_0x1e7378&&_0x1e7378[_0x1461('0x7c')]===0x0){return db[_0x1461('0x23')]['create']({'name':_0xa0bcd8[_0x1461('0x26')],'resourceId':_0xa0bcd8['id'],'type':_0x1e7378['name'],'sectionId':_0x1e7378['id']},{})[_0x1461('0x24')](function(){return _0x4c38f1;});}else{return _0x4c38f1;}})['catch'](function(_0x43cd48){logger['error'](_0x1461('0x7d'),_0x43cd48);throw _0x43cd48;});}return _0x4c38f1;})[_0x1461('0x24')](respondWithResult(_0x310c74,0xc9))[_0x1461('0x5d')](handleError(_0x310c74,null));};exports['getImap']=function(_0x11bffc,_0x575dfa){return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0x11bffc['params']['id']}})['then'](handleEntityNotFound(_0x575dfa,null))['then'](function(_0x566cc9){if(_0x566cc9){return _0x566cc9[_0x1461('0x7e')]();}return null;})[_0x1461('0x24')](respondWithResult(_0x575dfa,null))[_0x1461('0x5d')](handleError(_0x575dfa,null));};exports[_0x1461('0x7f')]=function(_0x6d408b,_0x4b9fc6){if(_0x6d408b[_0x1461('0x62')]['id']){delete _0x6d408b[_0x1461('0x62')]['id'];}return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x6d408b[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x4b9fc6,null))[_0x1461('0x24')](function(_0x59e394){if(_0x59e394){_0x6d408b[_0x1461('0x62')][_0x1461('0x6e')]=_0x59e394['id'];return db[_0x1461('0x5f')][_0x1461('0x6a')](_0x6d408b[_0x1461('0x62')]);}})[_0x1461('0x24')](respondWithResult(_0x4b9fc6,null))['catch'](handleError(_0x4b9fc6,null));};exports[_0x1461('0x80')]=function(_0x26eedd,_0x46ff51){return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0x26eedd[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x46ff51,null))[_0x1461('0x24')](function(_0x1f2b25){if(_0x1f2b25){return _0x1f2b25['setImap'](null);}return null;})[_0x1461('0x24')](respondWithStatusCode(_0x46ff51,null))[_0x1461('0x5d')](handleError(_0x46ff51,null));};exports[_0x1461('0x81')]=function(_0x24fc0e,_0x3a9a55){return db[_0x1461('0x45')]['findOne']({'where':{'id':_0x24fc0e[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x3a9a55,null))['then'](function(_0x230350){if(_0x230350){return _0x230350['getSmtp']();}return null;})[_0x1461('0x24')](respondWithResult(_0x3a9a55,null))['catch'](handleError(_0x3a9a55,null));};exports[_0x1461('0x82')]=function(_0x6bdf2f,_0x204a9e){if(_0x6bdf2f[_0x1461('0x62')]['id']){delete _0x6bdf2f[_0x1461('0x62')]['id'];}return db['MailAccount'][_0x1461('0x61')]({'where':{'id':_0x6bdf2f['params']['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x204a9e,null))[_0x1461('0x24')](function(_0x2ffe3d){if(_0x2ffe3d){_0x6bdf2f['body'][_0x1461('0x6e')]=_0x2ffe3d['id'];return db[_0x1461('0x41')][_0x1461('0x6a')](_0x6bdf2f[_0x1461('0x62')]);}})['then'](respondWithResult(_0x204a9e,null))['catch'](handleError(_0x204a9e,null));};exports['removeSmtp']=function(_0x176479,_0x2cbb53){return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0x176479[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x2cbb53,null))[_0x1461('0x24')](function(_0x5f012b){if(_0x5f012b){return _0x5f012b[_0x1461('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x2cbb53,null))['catch'](handleError(_0x2cbb53,null));};exports[_0x1461('0x84')]=function(_0x59e356,_0x396553){return db[_0x1461('0x85')][_0x1461('0x61')]({'where':{'id':_0x59e356[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x396553,null))[_0x1461('0x24')](function(_0x121058){if(_0x121058){return _0x121058[_0x1461('0x84')](_0x59e356[_0x1461('0x62')][_0x1461('0x70')],_['omit'](_0x59e356[_0x1461('0x62')],[_0x1461('0x70'),'id'])||{});}})[_0x1461('0x24')](respondWithResult(_0x396553,null))[_0x1461('0x5d')](handleError(_0x396553,null));};exports[_0x1461('0x86')]=function(_0xb9f2ac,_0x1801c6){var _0x1b1809={'raw':![],'where':{}};var _0x3444c6={};var _0x2ff257={'count':0x0,'rows':[]};return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0xb9f2ac['params']['id']}})['then'](handleEntityNotFound(_0x1801c6,null))[_0x1461('0x24')](function(_0x49a6df){if(_0x49a6df){_0x3444c6['model']=_[_0x1461('0x4b')](db[_0x1461('0x85')][_0x1461('0x6d')]);_0x3444c6['query']=_[_0x1461('0x4b')](_0xb9f2ac[_0x1461('0x4a')]);_0x3444c6[_0x1461('0x4c')]=_[_0x1461('0x4d')](_0x3444c6['model'],_0x3444c6[_0x1461('0x4a')]);_0x1b1809[_0x1461('0x4e')]=_[_0x1461('0x4d')](_0x3444c6[_0x1461('0x49')],qs[_0x1461('0x4f')](_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x4f')]));_0x1b1809[_0x1461('0x4e')]=_0x1b1809['attributes'][_0x1461('0x60')]?_0x1b1809[_0x1461('0x4e')]:_0x3444c6[_0x1461('0x49')];if(!_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x50')]('nolimit')){_0x1b1809[_0x1461('0x1b')]=qs[_0x1461('0x1b')](_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x1b')]);_0x1b1809['offset']=qs[_0x1461('0x18')](_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x18')]);}_0x1b1809[_0x1461('0x52')]=qs['sort'](_0xb9f2ac['query'][_0x1461('0x53')]);_0x1b1809['where']=qs[_0x1461('0x4c')](_[_0x1461('0x55')](_0xb9f2ac[_0x1461('0x4a')],_0x3444c6[_0x1461('0x4c')]));_0x1b1809[_0x1461('0x54')]['MailAccountId']=_0x49a6df['id'];if(_0xb9f2ac['query']['filter']){_0x1b1809[_0x1461('0x54')]=_['merge'](_0x1b1809['where'],{'$or':_[_0x1461('0x44')](_0x1b1809[_0x1461('0x4e')],function(_0x3a9ad3){var _0x508b05={};_0x508b05[_0x3a9ad3]={'$like':'%'+_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x56')]+'%'};return _0x508b05;})});}_0x1b1809=_[_0x1461('0x57')]({},_0x1b1809,_0xb9f2ac[_0x1461('0x58')]);return db[_0x1461('0x85')][_0x1461('0x1a')]({'where':_0x1b1809[_0x1461('0x54')]})[_0x1461('0x24')](function(_0xb290ca){_0x2ff257[_0x1461('0x1a')]=_0xb290ca;if(_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x59')]){_0x1b1809['include']=[{'model':db['CmContact'],'as':_0x1461('0x87'),'required':![]},{'model':db[_0x1461('0x88')],'as':'Owner','attributes':[_0x1461('0x26'),_0x1461('0x89'),_0x1461('0x8a')],'required':![]},{'model':db['Tag'],'as':_0x1461('0x8b'),'attributes':['id','name',_0x1461('0x8c')],'where':_0xb9f2ac['query'][_0x1461('0x8d')]?{'id':_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x8d')]}:undefined,'required':_0xb9f2ac[_0x1461('0x4a')][_0x1461('0x8d')]?!![]:![]}];}return db[_0x1461('0x85')][_0x1461('0x5b')](_0x1b1809);})[_0x1461('0x24')](function(_0x315729){_0x2ff257[_0x1461('0x5c')]=_0x315729;return _0x2ff257;});}})[_0x1461('0x24')](respondWithFilteredResult(_0x1801c6,_0x1b1809))[_0x1461('0x5d')](handleError(_0x1801c6,null));};exports[_0x1461('0x8e')]=function addApplications(_0x4e96f9,_0x4a0846){var _0x188be8=_0x4e96f9[_0x1461('0x65')]['id'];var _0x1c06e9=_0x4e96f9[_0x1461('0x62')];var _0x312079=0xc8;var _0x149ead=null;return db[_0x1461('0x8f')][_0x1461('0x90')]({'isolationLevel':db[_0x1461('0x8f')]['Transaction'][_0x1461('0x91')]['READ_COMMITTED']},function(_0x3e2a1d){return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0x188be8},'transaction':_0x3e2a1d})['then'](function(_0x424187){if(_0x424187){return db[_0x1461('0x92')]['destroy']({'where':{'MailAccountId':_0x188be8},'transaction':_0x3e2a1d})[_0x1461('0x24')](function(){var _0xd63032=_['map'](_0x1c06e9,function(_0x41b2f5){_0x41b2f5['MailAccountId']=_0x188be8;return _0x41b2f5;});return db[_0x1461('0x92')][_0x1461('0x93')](_0xd63032,{'transaction':_0x3e2a1d});});}else{_0x312079=0x194;_0x149ead=[];}});})[_0x1461('0x24')](function(){if(_0x312079!==0x194){return db[_0x1461('0x92')][_0x1461('0x94')]({'where':{'MailAccountId':_0x188be8},'order':_0x1461('0x95')})[_0x1461('0x24')](function(_0x61140e){_0x149ead=_0x61140e;});}})[_0x1461('0x5d')](function(_0x103455){_0x312079=0x1f4;logger['error'](_0x103455[_0x1461('0x25')]);if(_0x103455['name']){delete _0x103455[_0x1461('0x26')];}_0x149ead=_0x103455;})[_0x1461('0x96')](function(){if(_0x149ead===null){_0x4a0846['sendStatus'](_0x312079);}else{if(_0x312079===0x1f4){_0x4a0846['status'](_0x312079)[_0x1461('0x97')](_0x149ead);}else{_0x4a0846['status'](_0x312079)[_0x1461('0x1e')](_0x149ead);}}});};exports[_0x1461('0x98')]=function(_0x16279d,_0x41be42){var _0x2efd7d={};var _0x51fd1a={};var _0x2b32cf;var _0x2e0470;return db[_0x1461('0x45')][_0x1461('0x6c')]({'where':{'id':_0x16279d[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x41be42,null))[_0x1461('0x24')](function(_0x4e8c19){if(_0x4e8c19){_0x2b32cf=_0x4e8c19;_0x51fd1a[_0x1461('0x49')]=_[_0x1461('0x4b')](db[_0x1461('0x92')][_0x1461('0x6d')]);_0x51fd1a[_0x1461('0x4a')]=_['keys'](_0x16279d[_0x1461('0x4a')]);_0x51fd1a[_0x1461('0x4c')]=_['intersection'](_0x51fd1a[_0x1461('0x49')],_0x51fd1a[_0x1461('0x4a')]);_0x2efd7d['attributes']=_[_0x1461('0x4d')](_0x51fd1a[_0x1461('0x49')],qs[_0x1461('0x4f')](_0x16279d[_0x1461('0x4a')][_0x1461('0x4f')]));_0x2efd7d[_0x1461('0x4e')]=_0x2efd7d[_0x1461('0x4e')][_0x1461('0x60')]?_0x2efd7d['attributes']:_0x51fd1a['model'];_0x2efd7d[_0x1461('0x52')]=qs[_0x1461('0x53')](_0x16279d['query'][_0x1461('0x53')]);_0x2efd7d[_0x1461('0x54')]=qs[_0x1461('0x4c')](_[_0x1461('0x55')](_0x16279d[_0x1461('0x4a')],_0x51fd1a['filters']));if(_0x16279d[_0x1461('0x4a')][_0x1461('0x56')]){_0x2efd7d['where']=_[_0x1461('0x57')](_0x2efd7d['where'],{'$or':_[_0x1461('0x44')](_0x2efd7d[_0x1461('0x4e')],function(_0x3985a4){var _0x42a495={};_0x42a495[_0x3985a4]={'$like':'%'+_0x16279d[_0x1461('0x4a')]['filter']+'%'};return _0x42a495;})});}_0x2efd7d=_[_0x1461('0x57')]({},_0x2efd7d,_0x16279d[_0x1461('0x58')]);return _0x2b32cf[_0x1461('0x98')](_0x2efd7d);}})['then'](function(_0x4d2cb0){if(_0x4d2cb0){_0x2e0470=_0x4d2cb0[_0x1461('0x60')];if(!_0x16279d[_0x1461('0x4a')][_0x1461('0x50')](_0x1461('0x51'))){_0x2efd7d['limit']=qs[_0x1461('0x1b')](_0x16279d['query']['limit']);_0x2efd7d[_0x1461('0x18')]=qs['offset'](_0x16279d['query'][_0x1461('0x18')]);}return _0x2b32cf['getApplications'](_0x2efd7d);}})[_0x1461('0x24')](function(_0x1e4f2f){if(_0x1e4f2f){return _0x1e4f2f?{'count':_0x2e0470,'rows':_0x1e4f2f}:null;}})['then'](respondWithResult(_0x41be42,null))[_0x1461('0x5d')](handleError(_0x41be42,null));};exports['getMessages']=function(_0x406ec3,_0x27d05e){var _0x5f5850={'raw':!![],'where':{}};var _0x487df1={};var _0x52a9d3={'count':0x0,'rows':[]};return db['MailAccount'][_0x1461('0x6c')]({'where':{'id':_0x406ec3[_0x1461('0x65')]['id']}})['then'](handleEntityNotFound(_0x27d05e,null))[_0x1461('0x24')](function(_0x1bbbea){if(_0x1bbbea){_0x487df1[_0x1461('0x49')]=_['keys'](db[_0x1461('0x99')][_0x1461('0x6d')]);_0x487df1[_0x1461('0x4a')]=_[_0x1461('0x4b')](_0x406ec3['query']);_0x487df1[_0x1461('0x4c')]=_[_0x1461('0x4d')](_0x487df1[_0x1461('0x49')],_0x487df1[_0x1461('0x4a')]);_0x5f5850['attributes']=_['intersection'](_0x487df1[_0x1461('0x49')],qs[_0x1461('0x4f')](_0x406ec3[_0x1461('0x4a')][_0x1461('0x4f')]));_0x5f5850[_0x1461('0x4e')]=_0x5f5850[_0x1461('0x4e')][_0x1461('0x60')]?_0x5f5850['attributes']:_0x487df1[_0x1461('0x49')];if(!_0x406ec3[_0x1461('0x4a')][_0x1461('0x50')]('nolimit')){_0x5f5850[_0x1461('0x1b')]=qs['limit'](_0x406ec3[_0x1461('0x4a')][_0x1461('0x1b')]);_0x5f5850[_0x1461('0x18')]=qs[_0x1461('0x18')](_0x406ec3[_0x1461('0x4a')][_0x1461('0x18')]);}_0x5f5850[_0x1461('0x52')]=qs[_0x1461('0x53')](_0x406ec3['query'][_0x1461('0x53')]);_0x5f5850['where']=qs[_0x1461('0x4c')](_[_0x1461('0x55')](_0x406ec3[_0x1461('0x4a')],_0x487df1['filters']));_0x5f5850[_0x1461('0x54')]['MailAccountId']=_0x1bbbea['id'];if(_0x406ec3['query'][_0x1461('0x56')]){_0x5f5850[_0x1461('0x54')]=_[_0x1461('0x57')](_0x5f5850['where'],{'$or':_['map'](_0x5f5850[_0x1461('0x4e')],function(_0x2e0d15){var _0x54b310={};_0x54b310[_0x2e0d15]={'$like':'%'+_0x406ec3[_0x1461('0x4a')][_0x1461('0x56')]+'%'};return _0x54b310;})});}if(_0x406ec3[_0x1461('0x4a')][_0x1461('0x9a')]){var _0x458b90=_0x406ec3['query'][_0x1461('0x9a')][_0x1461('0x9b')](',');var _0x8425c5={};_0x8425c5[_0x458b90[0x0]]={'$gte':moment(_0x458b90[0x1])[_0x1461('0x9c')](_0x1461('0x9d'))};_0x5f5850[_0x1461('0x54')]=_[_0x1461('0x57')](_0x5f5850['where'],_0x8425c5);}_0x5f5850=_[_0x1461('0x57')]({},_0x5f5850,_0x406ec3[_0x1461('0x58')]);return db[_0x1461('0x99')][_0x1461('0x1a')]({'where':_0x5f5850[_0x1461('0x54')]})['then'](function(_0x15e7d5){_0x52a9d3[_0x1461('0x1a')]=_0x15e7d5;if(_0x406ec3[_0x1461('0x4a')][_0x1461('0x59')]){_0x5f5850[_0x1461('0x5a')]=[{'all':!![]}];}return db[_0x1461('0x99')][_0x1461('0x5b')](_0x5f5850);})['then'](function(_0x5e17a4){if(_0x406ec3[_0x1461('0x4a')][_0x1461('0x9e')]===_0x1461('0x9f')){for(var _0xe9302d=0x0;_0xe9302d<_0x5e17a4['length'];_0xe9302d++){_0x5e17a4[_0xe9302d][_0x1461('0x62')]=juice(_0x5e17a4[_0xe9302d]['body']);}}_0x52a9d3[_0x1461('0x5c')]=_0x5e17a4;return _0x52a9d3;});}})[_0x1461('0x24')](respondWithFilteredResult(_0x27d05e,_0x5f5850))[_0x1461('0x5d')](handleError(_0x27d05e,null));};exports['send']=function(_0x26f971,_0x282944){var _0x4ca8ed,_0x26b71e={},_0x2bae4;if(_0x26f971['body']['to']){_0x2bae4=_0x26f971[_0x1461('0x62')]['to'][_0x1461('0x9b')](',')[0x0];}return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x26f971[_0x1461('0x65')]['id']},'include':[{'model':db[_0x1461('0xa0')],'as':'List','include':[{'model':db[_0x1461('0xa1')],'as':_0x1461('0xa2'),'where':{'email':_0x2bae4},'limit':0x1,'order':[[_0x1461('0xa3'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1461('0xa4'),'raw':!![]}]}]})[_0x1461('0x24')](handleEntityNotFound(_0x282944,null))[_0x1461('0x24')](function(_0x23c6b9){if(!_0x23c6b9)return;_0x4ca8ed=_0x23c6b9;if(!_0x23c6b9[_0x1461('0x3f')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x1461('0x76')](_0x26f971[_0x1461('0x62')][_0x1461('0xa5')])){_0x26f971[_0x1461('0x62')]['from']=util['format'](_0x1461('0xa6'),_0x23c6b9[_0x1461('0x26')],_0x23c6b9[_0x1461('0xa7')]||_0x23c6b9[_0x1461('0x3f')][_0x1461('0x34')]);}if(_0x26f971[_0x1461('0x62')][_0x1461('0xa8')]&&_0x26f971[_0x1461('0x62')]['attachments']['length']){for(var _0x54b424=0x0;_0x54b424<_0x26f971[_0x1461('0x62')][_0x1461('0xa8')][_0x1461('0x60')];_0x54b424+=0x1){_0x26f971[_0x1461('0x62')]['attachments'][_0x54b424]={'filename':_0x26f971[_0x1461('0x62')]['attachments'][_0x54b424][_0x1461('0x26')],'path':path[_0x1461('0xa9')](config[_0x1461('0xaa')],_0x1461('0xab'),_0x26f971[_0x1461('0x62')][_0x1461('0xa8')][_0x54b424]['basename'])};}}var _0x1ef280=_0x23c6b9[_0x1461('0xac')]();return respondWithRpcPromise(_0x1461('0xad'),_0x1461('0xae'),{'account':_0x1ef280,'message':_0x26f971[_0x1461('0x62')]});})['then'](function(_0x44a5f0){if(!_0x44a5f0)return;_0x26b71e=_0x44a5f0;if(!_0x4ca8ed[_0x1461('0xaf')])throw new Error(_0x1461('0xb0'));if(_0x4ca8ed['List'][_0x1461('0xa2')][_0x1461('0x60')])return _0x4ca8ed['List'][_0x1461('0xa2')][0x0];return db[_0x1461('0xa1')][_0x1461('0x6a')](_[_0x1461('0x7')](_0x26f971[_0x1461('0x62')],{'firstName':_0x26f971[_0x1461('0x62')]['to'],'email':_0x26f971[_0x1461('0x62')]['to'],'phone':_0x26f971[_0x1461('0x62')]['to'],'ListId':_0x4ca8ed[_0x1461('0x75')]}));})[_0x1461('0x24')](function(_0x5c1b75){if(!_0x5c1b75)return;var _0x246e91={'UserId':_0x26f971[_0x1461('0x34')]['id'],'ContactId':_0x5c1b75['id'],'MailAccountId':_0x4ca8ed['id'],'inReplyTo':_0x26b71e['messageId'],'to':_0x26f971[_0x1461('0x62')][_0x1461('0xa5')],'cc':_0x26f971[_0x1461('0x62')]['cc'],'subject':_0x26f971[_0x1461('0x62')]['subject'],'attach':_0x26f971[_0x1461('0x62')][_0x1461('0xb1')],'firstMsgDirection':_0x1461('0xb2'),'lastMsgAt':moment()[_0x1461('0x9c')](_0x1461('0x9d')),'lastMsgDirection':'out','Messages':[_[_0x1461('0x57')](_0x26f971[_0x1461('0x62')],{'messageId':_0x26b71e[_0x1461('0xb3')],'sentAt':moment()[_0x1461('0x9c')](_0x1461('0x9d')),'read':!![],'MailAccountId':_0x4ca8ed['id'],'UserId':_0x26f971['user']['id'],'ContactId':_0x5c1b75['id']})]};if(_0x26f971['body'][_0x1461('0xb4')]){_0x246e91=_[_0x1461('0x57')](_0x246e91,_0x26f971[_0x1461('0x62')][_0x1461('0xb4')]);}return db[_0x1461('0x85')][_0x1461('0x6a')](_0x246e91,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x1461('0x24')](respondWithResult(_0x282944,null))['catch'](handleError(_0x282944,null));};exports[_0x1461('0xb5')]=function(_0x23e04d,_0xa4e012){return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x23e04d[_0x1461('0x65')]['id']},'include':[{'model':db[_0x1461('0x41')],'as':_0x1461('0x3f'),'raw':!![],'include':[{'model':db[_0x1461('0xa4')],'as':_0x1461('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xa4e012,null))[_0x1461('0x24')](function(_0x49f24e){if(!_0x49f24e[_0x1461('0x3f')])return;var _0x4c1b29=_0x49f24e[_0x1461('0xac')]();return respondWithRpcPromise('VerifySmtp',_0x1461('0xb5'),{'account':_0x4c1b29});})[_0x1461('0x24')](respondWithResult(_0xa4e012,null))[_0x1461('0x5d')](handleError(_0xa4e012,null));};exports[_0x1461('0x20')]=function(_0x28d30b,_0xfee687){return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x28d30b[_0x1461('0x65')]['id']}})['then'](handleEntityNotFound(_0xfee687,null))[_0x1461('0x24')](function(_0x445cdb){if(_0x445cdb&&_0x445cdb[_0x1461('0x3d')]){throw new db[(_0x1461('0xb6'))]['ValidationError'](_0x1461('0xb7'));}return _0x445cdb;})['then'](removeEntity(_0xfee687,null))['catch'](handleError(_0xfee687,null));};exports[_0x1461('0xb8')]=function(_0x16587b,_0x44bc50){return db['MailAccount'][_0x1461('0x61')]({'where':{'id':_0x16587b[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x44bc50,null))[_0x1461('0x24')](function(_0x576cc9){if(_0x576cc9){return _0x576cc9['addAgents'](_0x16587b['body'][_0x1461('0x70')],_[_0x1461('0xb9')](_0x16587b[_0x1461('0x62')],[_0x1461('0x70'),'id'])||{})[_0x1461('0xba')](function(_0xeb84fc){for(var _0x3ffd47=0x0;_0x3ffd47<_0x16587b['body'][_0x1461('0x70')][_0x1461('0x60')];_0x3ffd47+=0x1){socket['emit'](_0x1461('0xbb'),{'UserId':Number(_0x16587b[_0x1461('0x62')][_0x1461('0x70')][_0x3ffd47]),'MailAccountId':Number(_0x16587b['params']['id'])});}return _0xeb84fc;});}})[_0x1461('0x24')](respondWithResult(_0x44bc50,null))[_0x1461('0x5d')](handleError(_0x44bc50,null));};exports['removeAgents']=function(_0x27d3e9,_0x45459d){return db[_0x1461('0x45')][_0x1461('0x61')]({'where':{'id':_0x27d3e9[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0x45459d,null))[_0x1461('0x24')](function(_0x43c75e){if(_0x43c75e){return _0x43c75e[_0x1461('0xbc')](_0x27d3e9[_0x1461('0x4a')][_0x1461('0x70')])[_0x1461('0x24')](function(){if(_['isArray'](_0x27d3e9['query'][_0x1461('0x70')])){for(var _0x579112=0x0;_0x579112<_0x27d3e9[_0x1461('0x4a')][_0x1461('0x70')][_0x1461('0x60')];_0x579112+=0x1){socket['emit'](_0x1461('0xbd'),{'UserId':Number(_0x27d3e9[_0x1461('0x4a')][_0x1461('0x70')][_0x579112]),'MailAccountId':Number(_0x27d3e9[_0x1461('0x65')]['id'])});}}else{socket[_0x1461('0xbe')](_0x1461('0xbd'),{'UserId':Number(_0x27d3e9['query'][_0x1461('0x70')]),'MailAccountId':Number(_0x27d3e9[_0x1461('0x65')]['id'])});}});}})[_0x1461('0x24')](respondWithStatusCode(_0x45459d,null))['catch'](handleError(_0x45459d,null));};exports[_0x1461('0xbf')]=function(_0x121939,_0xc6e5ef){var _0x442ad5={};var _0x2806c6={};var _0x127700;var _0x3aa274;return db['MailAccount']['findOne']({'where':{'id':_0x121939[_0x1461('0x65')]['id']}})[_0x1461('0x24')](handleEntityNotFound(_0xc6e5ef,null))[_0x1461('0x24')](function(_0x99b5c3){if(_0x99b5c3){_0x127700=_0x99b5c3;_0x2806c6[_0x1461('0x49')]=_[_0x1461('0x4b')](db[_0x1461('0x88')][_0x1461('0x6d')]);_0x2806c6[_0x1461('0x4a')]=_[_0x1461('0x4b')](_0x121939[_0x1461('0x4a')]);_0x2806c6[_0x1461('0x4c')]=_[_0x1461('0x4d')](_0x2806c6[_0x1461('0x49')],_0x2806c6['query']);_0x442ad5[_0x1461('0x4e')]=_[_0x1461('0x4d')](_0x2806c6[_0x1461('0x49')],qs[_0x1461('0x4f')](_0x121939[_0x1461('0x4a')][_0x1461('0x4f')]));_0x442ad5[_0x1461('0x4e')]=_0x442ad5[_0x1461('0x4e')][_0x1461('0x60')]?_0x442ad5[_0x1461('0x4e')]:_0x2806c6[_0x1461('0x49')];_0x442ad5[_0x1461('0x52')]=qs['sort'](_0x121939[_0x1461('0x4a')][_0x1461('0x53')]);_0x442ad5['where']=qs[_0x1461('0x4c')](_[_0x1461('0x55')](_0x121939['query'],_0x2806c6['filters']));if(_0x121939[_0x1461('0x4a')][_0x1461('0x56')]){_0x442ad5[_0x1461('0x54')]=_[_0x1461('0x57')](_0x442ad5[_0x1461('0x54')],{'$or':_[_0x1461('0x44')](_0x442ad5['attributes'],function(_0x54dfce){var _0x57a224={};_0x57a224[_0x54dfce]={'$like':'%'+_0x121939[_0x1461('0x4a')][_0x1461('0x56')]+'%'};return _0x57a224;})});}_0x442ad5=_[_0x1461('0x57')]({},_0x442ad5,_0x121939[_0x1461('0x58')]);return _0x127700[_0x1461('0xbf')](_0x442ad5);}})[_0x1461('0x24')](function(_0x41f15a){if(_0x41f15a){_0x3aa274=_0x41f15a['length'];if(!_0x121939[_0x1461('0x4a')][_0x1461('0x50')](_0x1461('0x51'))){_0x442ad5[_0x1461('0x1b')]=qs[_0x1461('0x1b')](_0x121939[_0x1461('0x4a')][_0x1461('0x1b')]);_0x442ad5[_0x1461('0x18')]=qs[_0x1461('0x18')](_0x121939['query'][_0x1461('0x18')]);}return _0x127700['getAgents'](_0x442ad5);}})[_0x1461('0x24')](function(_0x44df1b){if(_0x44df1b){return _0x44df1b?{'count':_0x3aa274,'rows':_0x44df1b}:null;}})[_0x1461('0x24')](respondWithResult(_0xc6e5ef,null))[_0x1461('0x5d')](handleError(_0xc6e5ef,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9da816d..85eb2fd 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 _0xa8f3=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x162048,_0x411f1b){var _0x2339bf=function(_0x4101a2){while(--_0x4101a2){_0x162048['push'](_0x162048['shift']());}};_0x2339bf(++_0x411f1b);}(_0xa8f3,0xc1));var _0x3a8f=function(_0x5de4db,_0x538ff7){_0x5de4db=_0x5de4db-0x0;var _0x55dfc1=_0xa8f3[_0x5de4db];return _0x55dfc1;};'use strict';var EventEmitter=require(_0x3a8f('0x0'));var MailAccount=require(_0x3a8f('0x1'))['db'][_0x3a8f('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3a8f('0x3')](0x0);var events={'afterCreate':_0x3a8f('0x4'),'afterUpdate':_0x3a8f('0x5'),'afterDestroy':_0x3a8f('0x6')};function emitEvent(_0x16c044){return function(_0x14bd62,_0x341a8f,_0x714540){MailAccountEvents[_0x3a8f('0x7')](_0x16c044+':'+_0x14bd62['id'],_0x14bd62);MailAccountEvents[_0x3a8f('0x7')](_0x16c044,_0x14bd62);_0x714540(null);};}for(var e in events){if(events[_0x3a8f('0x8')](e)){var event=events[e];MailAccount[_0x3a8f('0x9')](e,emitEvent(event));}}module[_0x3a8f('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x444f=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x1986a0,_0x432db8){var _0x604b6c=function(_0x591622){while(--_0x591622){_0x1986a0['push'](_0x1986a0['shift']());}};_0x604b6c(++_0x432db8);}(_0x444f,0xb5));var _0xf444=function(_0x20be7e,_0x56db99){_0x20be7e=_0x20be7e-0x0;var _0x43728c=_0x444f[_0x20be7e];return _0x43728c;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xf444('0x0'))['db'][_0xf444('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf444('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf444('0x3')};function emitEvent(_0x3d14bc){return function(_0x1d62ab,_0x3ba0d1,_0xb376b0){MailAccountEvents[_0xf444('0x4')](_0x3d14bc+':'+_0x1d62ab['id'],_0x1d62ab);MailAccountEvents['emit'](_0x3d14bc,_0x1d62ab);_0xb376b0(null);};}for(var e in events){if(events[_0xf444('0x5')](e)){var event=events[e];MailAccount[_0xf444('0x6')](e,emitEvent(event));}}module[_0xf444('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2209cdb..52063ee 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 _0x2cba=['CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','define','MailAccount','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cba,0x79));var _0xa2cb=function(_0x452757,_0x176162){_0x452757=_0x452757-0x0;var _0xb1fbfa=_0x2cba[_0x452757];return _0xb1fbfa;};'use strict';var attributes=require(_0xa2cb('0x0'));module['exports']=function(_0x430576){return _0x430576[_0xa2cb('0x1')](_0xa2cb('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x293b21=this;var _0x26cca9={'id':_0x293b21['id'],'tls':{'rejectUnauthorized':![]}};if(_0x293b21[_0xa2cb('0x3')]!==_0xa2cb('0x4')){_0x26cca9[_0xa2cb('0x5')]=_0x293b21[_0xa2cb('0x3')];}else{_0x26cca9[_0xa2cb('0x6')]=_0x293b21[_0xa2cb('0x7')][_0xa2cb('0x6')];_0x26cca9['port']=_0x293b21[_0xa2cb('0x7')][_0xa2cb('0x8')];_0x26cca9[_0xa2cb('0x9')]=_0x293b21['Smtp'][_0xa2cb('0x9')];}if(_0x293b21[_0xa2cb('0x7')][_0xa2cb('0xa')]){if(_0x293b21[_0xa2cb('0x7')][_0xa2cb('0xb')]){if(!_0x293b21['Smtp'][_0xa2cb('0xc')])throw new Error(_0xa2cb('0xd'));_0x26cca9[_0xa2cb('0xe')]={'type':_0xa2cb('0xf'),'user':_0x293b21['Smtp'][_0xa2cb('0x10')],'accessToken':_0x293b21[_0xa2cb('0x7')][_0xa2cb('0xc')][_0xa2cb('0x11')]};}else{_0x26cca9[_0xa2cb('0xe')]={'user':_0x293b21[_0xa2cb('0x7')][_0xa2cb('0x10')],'pass':_0x293b21[_0xa2cb('0x7')][_0xa2cb('0x12')]};}}return _0x26cca9;}}});}; \ No newline at end of file +var _0xd2dc=['secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','pass','exports','define','MailAccount','provider','host','Smtp','port'];(function(_0x2888cf,_0x2489b5){var _0x34b76d=function(_0x86e5d5){while(--_0x86e5d5){_0x2888cf['push'](_0x2888cf['shift']());}};_0x34b76d(++_0x2489b5);}(_0xd2dc,0x116));var _0xcd2d=function(_0x3342,_0x27f679){_0x3342=_0x3342-0x0;var _0x1832b8=_0xd2dc[_0x3342];return _0x1832b8;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xcd2d('0x0')]=function(_0x348938){return _0x348938[_0xcd2d('0x1')](_0xcd2d('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x252534=this;var _0x129545={'id':_0x252534['id'],'tls':{'rejectUnauthorized':![]}};if(_0x252534[_0xcd2d('0x3')]!=='custom'){_0x129545['service']=_0x252534['provider'];}else{_0x129545[_0xcd2d('0x4')]=_0x252534[_0xcd2d('0x5')]['host'];_0x129545[_0xcd2d('0x6')]=_0x252534[_0xcd2d('0x5')][_0xcd2d('0x6')];_0x129545[_0xcd2d('0x7')]=_0x252534[_0xcd2d('0x5')][_0xcd2d('0x7')];}if(_0x252534[_0xcd2d('0x5')][_0xcd2d('0x8')]){if(_0x252534[_0xcd2d('0x5')][_0xcd2d('0x9')]){if(!_0x252534[_0xcd2d('0x5')][_0xcd2d('0xa')])throw new Error(_0xcd2d('0xb'));_0x129545[_0xcd2d('0xc')]={'type':'OAuth2','user':_0x252534[_0xcd2d('0x5')][_0xcd2d('0xd')],'accessToken':_0x252534['Smtp'][_0xcd2d('0xa')]['data5']};}else{_0x129545['auth']={'user':_0x252534[_0xcd2d('0x5')][_0xcd2d('0xd')],'pass':_0x252534['Smtp'][_0xcd2d('0xe')]};}}return _0x129545;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 2f9ef9b..677d7e5 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 _0x23f4=['create','contact','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','name','unshift','agent','*,*,*,*','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','List','applications','list','priority','asc','account','autoclose','push','close','length','defaults','ListId','List\x20not\x20found','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','Contact\x20not\x20found','spread','update','format','interaction','created','MailMessage'];(function(_0x4333f6,_0x153433){var _0x41f795=function(_0x4a8993){while(--_0x4a8993){_0x4333f6['push'](_0x4333f6['shift']());}};_0x41f795(++_0x153433);}(_0x23f4,0x1ee));var _0x423f=function(_0x4795e1,_0x2e0a02){_0x4795e1=_0x4795e1-0x0;var _0x570754=_0x23f4[_0x4795e1];return _0x570754;};'use strict';var _=require('lodash');var moment=require(_0x423f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x423f('0x1'));var db=require(_0x423f('0x2'))['db'];var logger=require(_0x423f('0x3'))(_0x423f('0x4'));var config=require(_0x423f('0x5'));var jayson=require(_0x423f('0x6'));var client=jayson[_0x423f('0x7')][_0x423f('0x8')]({'port':0x232c});config[_0x423f('0x9')]=_['defaults'](config[_0x423f('0x9')],{'host':_0x423f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x423f('0x9')]));require(_0x423f('0xb'))[_0x423f('0xc')](socket);function respondWithRpcPromise(_0x50301a,_0x5b5ee6,_0x4b8a90){return new BPromise(function(_0x4143a0,_0x481c41){return client[_0x423f('0xd')](_0x50301a,_0x4b8a90)[_0x423f('0xe')](function(_0x3ea013){logger[_0x423f('0xf')]('MailAccount,\x20%s,\x20%s',_0x5b5ee6,_0x423f('0x10'));logger[_0x423f('0x11')](_0x423f('0x12'),_0x5b5ee6,_0x423f('0x10'),JSON[_0x423f('0x13')](_0x3ea013));if(_0x3ea013['error']){if(_0x3ea013[_0x423f('0x14')][_0x423f('0x15')]===0x1f4){logger[_0x423f('0x14')](_0x423f('0x16'),_0x5b5ee6,_0x3ea013[_0x423f('0x14')][_0x423f('0x17')]);return _0x481c41(_0x3ea013[_0x423f('0x14')][_0x423f('0x17')]);}logger[_0x423f('0x14')](_0x423f('0x16'),_0x5b5ee6,_0x3ea013[_0x423f('0x14')][_0x423f('0x17')]);return _0x4143a0(_0x3ea013[_0x423f('0x14')][_0x423f('0x17')]);}else{logger[_0x423f('0xf')](_0x423f('0x16'),_0x5b5ee6,_0x423f('0x10'));_0x4143a0(_0x3ea013[_0x423f('0x18')][_0x423f('0x17')]);}})['catch'](function(_0x99435f){logger['error']('MailAccount,\x20%s,\x20%s',_0x5b5ee6,_0x99435f);_0x481c41(_0x99435f);});});}exports[_0x423f('0x19')]=function(_0x4956e0){var _0x181ff7=this;return new Promise(function(_0xd7b80e,_0x4f6960){return db[_0x423f('0x1a')][_0x423f('0x1b')]({'raw':_0x4956e0['options']?_0x4956e0[_0x423f('0x1c')][_0x423f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4956e0['options']?_0x4956e0[_0x423f('0x1c')][_0x423f('0x1e')]||null:null,'attributes':_0x4956e0['options']?_0x4956e0[_0x423f('0x1c')]['attributes']||null:null,'limit':_0x4956e0[_0x423f('0x1c')]?_0x4956e0[_0x423f('0x1c')][_0x423f('0x1f')]||null:null,'include':_0x4956e0[_0x423f('0x1c')]?_0x4956e0[_0x423f('0x1c')][_0x423f('0x20')]?_[_0x423f('0x21')](_0x4956e0[_0x423f('0x1c')][_0x423f('0x20')],function(_0x36f57f){return{'model':db[_0x36f57f[_0x423f('0x22')]],'as':_0x36f57f['as'],'attributes':_0x36f57f[_0x423f('0x23')],'include':_0x36f57f[_0x423f('0x20')]?_[_0x423f('0x21')](_0x36f57f['include'],function(_0x3308dd){return{'model':db[_0x3308dd[_0x423f('0x22')]],'as':_0x3308dd['as'],'attributes':_0x3308dd[_0x423f('0x23')],'include':_0x3308dd['include']?_['map'](_0x3308dd[_0x423f('0x20')],function(_0x496c25){return{'model':db[_0x496c25[_0x423f('0x22')]],'as':_0x496c25['as'],'attributes':_0x496c25['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ca28d){logger[_0x423f('0xf')]('GetMailAccount',_0x4956e0);logger[_0x423f('0x11')](_0x423f('0x19'),_0x4956e0,JSON[_0x423f('0x13')](_0x3ca28d));_0xd7b80e(_0x3ca28d);})[_0x423f('0x24')](function(_0x518c1e){logger[_0x423f('0x14')](_0x423f('0x19'),_0x518c1e[_0x423f('0x17')],_0x4956e0);_0x4f6960(_0x181ff7[_0x423f('0x14')](0x1f4,_0x518c1e['message']));});});};exports[_0x423f('0x25')]=function(_0x150846){var _0x200cfa=this;return new Promise(function(_0x8e7bcb,_0x341728){return db[_0x423f('0x1a')][_0x423f('0x26')]({'raw':_0x150846[_0x423f('0x1c')]?_0x150846[_0x423f('0x1c')][_0x423f('0x1d')]===undefined?!![]:![]:!![],'where':_0x150846['options']?_0x150846[_0x423f('0x1c')][_0x423f('0x1e')]||null:null,'attributes':_0x150846[_0x423f('0x1c')]?_0x150846['options'][_0x423f('0x23')]||null:null,'include':_0x150846['options']?_0x150846[_0x423f('0x1c')][_0x423f('0x20')]?_[_0x423f('0x21')](_0x150846[_0x423f('0x1c')][_0x423f('0x20')],function(_0x4a5134){return{'model':db[_0x4a5134['model']],'as':_0x4a5134['as'],'attributes':_0x4a5134[_0x423f('0x23')],'include':_0x4a5134[_0x423f('0x20')]?_[_0x423f('0x21')](_0x4a5134[_0x423f('0x20')],function(_0x3e4c9f){return{'model':db[_0x3e4c9f[_0x423f('0x22')]],'as':_0x3e4c9f['as'],'attributes':_0x3e4c9f[_0x423f('0x23')],'include':_0x3e4c9f[_0x423f('0x20')]?_[_0x423f('0x21')](_0x3e4c9f[_0x423f('0x20')],function(_0x3aeb17){return{'model':db[_0x3aeb17[_0x423f('0x22')]],'as':_0x3aeb17['as'],'attributes':_0x3aeb17[_0x423f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bd9b2){if(_0x150846[_0x423f('0x1c')][_0x423f('0x27')]===!![])_0x5bd9b2[_0x423f('0x28')](_0x423f('0x29'),_0x5bd9b2[_0x423f('0x2a')]());logger['info'](_0x423f('0x25'),_0x150846);logger[_0x423f('0x11')](_0x423f('0x25'),_0x150846,JSON[_0x423f('0x13')](_0x5bd9b2));_0x8e7bcb(_0x5bd9b2);})[_0x423f('0x24')](function(_0x24628e){logger[_0x423f('0x14')](_0x423f('0x25'),_0x24628e[_0x423f('0x17')],_0x150846);_0x341728(_0x200cfa[_0x423f('0x14')](0x1f4,_0x24628e['message']));});});};exports['NotifyMailAccount']=function(_0xb19847){var _0xd42ce9=this;return new Promise(function(_0x81bd62,_0x390a8f){var _0x2316e8={'body':_0xb19847[_0x423f('0x2b')],'channel':'mail'};var _0x36ad04=_[_0x423f('0x2c')](_[_0x423f('0x2d')](db[_0x423f('0x2e')][_0x423f('0x2f')]),[_0x423f('0x30'),_0x423f('0x31'),_0x423f('0x32'),'ListId']);var _0x4165e0=![];if(_0xb19847[_0x423f('0x2b')]['id']){delete _0xb19847[_0x423f('0x2b')]['id'];}if(_[_0x423f('0x33')](_0xb19847[_0x423f('0x2b')][_0x423f('0x34')])){return _0x390a8f(_0xd42ce9[_0x423f('0x14')](0x1f4,_0x423f('0x35')));}if(_[_0x423f('0x33')](_0xb19847['body'][_0x423f('0x2b')])||_0xb19847['body'][_0x423f('0x2b')]===''){return _0x390a8f(_0xd42ce9[_0x423f('0x14')](0x1f4,_0x423f('0x36')));}if(_[_0x423f('0x33')](_0xb19847[_0x423f('0x2b')][_0x423f('0x37')])){return _0x390a8f(_0xd42ce9[_0x423f('0x14')](0x1f4,_0x423f('0x38')+_0x36ad04));}if(!_[_0x423f('0x39')](_0x36ad04,_0xb19847[_0x423f('0x2b')][_0x423f('0x37')])){return _0x390a8f(_0xd42ce9[_0x423f('0x14')](0x1f4,_0x423f('0x3a')+_0x36ad04));}var _0x350e11={};_0x350e11[_0xb19847[_0x423f('0x2b')][_0x423f('0x37')]]=_0xb19847[_0x423f('0x2b')][_0x423f('0x34')];return db[_0x423f('0x1a')][_0x423f('0x26')]({'where':{'id':_0xb19847['account']['id']},'include':[{'model':db[_0x423f('0x3b')],'as':'List','include':[{'model':db[_0x423f('0x2e')],'as':_0x423f('0x3c'),'where':_0x350e11,'limit':0x1,'order':[[_0x423f('0x31'),_0x423f('0x3d')]]}]},{'model':db[_0x423f('0x3e')],'as':_0x423f('0x3f')},{'model':db[_0x423f('0x40')],'as':_0x423f('0x41'),'include':[{'model':db[_0x423f('0x42')],'as':_0x423f('0x42')}]}]})[_0x423f('0xe')](function(_0x2dcbec){if(_0x2dcbec&&_0x2dcbec['List']){var _0x1e2b9f=_0x2dcbec[_0x423f('0x43')]({'plain':!![]});_0x2316e8['account']=_[_0x423f('0x44')](_0x1e2b9f,['Applications',_0x423f('0x45')]);_0x2316e8['account']['smtpOptions']=_0x2dcbec[_0x423f('0x2a')]();_0x2316e8[_0x423f('0x46')]=_0x1e2b9f[_0x423f('0x3f')];_0x2316e8[_0x423f('0x47')]=_0x1e2b9f['List'];_0x2316e8[_0x423f('0x46')]=_['orderBy'](_0x2316e8[_0x423f('0x46')],[_0x423f('0x48')],[_0x423f('0x49')]);if(_0x2316e8[_0x423f('0x4a')]&&_0x2316e8[_0x423f('0x4a')][_0x423f('0x4b')]){_0x2316e8[_0x423f('0x46')][_0x423f('0x4c')]({'id':0x0,'priority':_0x2316e8[_0x423f('0x46')]['length']+0x1,'app':_0x423f('0x4d'),'appdata':_0x423f('0x4b'),'interval':'*,*,*,*'});}if(_0x2316e8[_0x423f('0x4a')]['Applications']){delete _0x2316e8[_0x423f('0x4a')][_0x423f('0x3f')];}if(_0x2316e8[_0x423f('0x4a')][_0x423f('0x45')]){delete _0x2316e8[_0x423f('0x4a')][_0x423f('0x45')];}if(_0x1e2b9f['List']['Contacts'][_0x423f('0x4e')]){return _0x1e2b9f[_0x423f('0x45')][_0x423f('0x3c')][0x0];}var _0x3959ce=_[_0x423f('0x4f')](_0xb19847[_0x423f('0x2b')],{'firstName':_0xb19847[_0x423f('0x2b')][_0x423f('0x34')],'ListId':_0x1e2b9f[_0x423f('0x50')]});_0x3959ce[_0xb19847['body'][_0x423f('0x37')]]=_0xb19847[_0x423f('0x2b')]['from'];return db[_0x423f('0x2e')]['create'](_0x3959ce);}else{throw new Error(_0x423f('0x51'));}})[_0x423f('0xe')](function(_0x5affd5){_0x2316e8['contact']=_0x5affd5;if(_0x5affd5){if(!_0xb19847['body'][_0x423f('0x17')][_0x423f('0x52')]){_0xb19847[_0x423f('0x2b')]['message'][_0x423f('0x52')]=rs[_0x423f('0x53')]()+'\x20'+_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x34')];}var _0x3ffe6f={'ContactId':_0x5affd5['id'],'MailAccountId':_0xb19847[_0x423f('0x4a')]['id'],'inReplyTo':_0xb19847['body'][_0x423f('0x17')]['messageId'],'to':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x34')],'cc':_0xb19847[_0x423f('0x2b')]['message']['cc'],'subject':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x54')],'attach':_0xb19847['body'][_0x423f('0x17')][_0x423f('0x55')],'lastMsgAt':moment()['format'](_0x423f('0x56')),'lastMsgDirection':'in'};return db[_0x423f('0x57')]['find']({'where':{'closed':![],'MailAccountId':_0xb19847['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x423f('0x58'),'attributes':[_0x423f('0x52')],'where':{'messageId':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')]['inReplyTo']}}]})['then'](function(_0x124afa){if(_0x124afa){return[_0x124afa,![]];}return db[_0x423f('0x57')]['create'](_0x3ffe6f)[_0x423f('0xe')](function(_0x13ed0b){return[_0x13ed0b,!![]];});});}else{throw new Error(_0x423f('0x59'));}})[_0x423f('0x5a')](function(_0x18b549,_0xb67c1d){if(_0x18b549){_0x4165e0=_0xb67c1d;if(!_0xb67c1d){return _0x18b549[_0x423f('0x5b')]({'inReplyTo':_0xb19847['body'][_0x423f('0x17')][_0x423f('0x52')],'to':_0xb19847['body'][_0x423f('0x17')][_0x423f('0x34')],'cc':_0xb19847[_0x423f('0x2b')]['message']['cc'],'subject':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x54')],'attach':_0x18b549[_0x423f('0x55')]?_0x18b549[_0x423f('0x55')]:_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x55')],'substatus':null,'substatusAt':moment()[_0x423f('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x423f('0x5c')](_0x423f('0x56')),'lastMsgDirection':'in'});}else{return _0x18b549;}}})[_0x423f('0xe')](function(_0x4633f0){_0x2316e8['interaction']=_0x4633f0[_0x423f('0x43')]({'plain':!![]});_0x2316e8[_0x423f('0x5d')][_0x423f('0x5e')]=_0x4165e0;return db[_0x423f('0x5f')][_0x423f('0x60')]({'body':_0xb19847[_0x423f('0x2b')][_0x423f('0x2b')],'MailAccountId':_0xb19847['account']['id'],'MailInteractionId':_0x4633f0['id'],'direction':'in','ContactId':_0x2316e8[_0x423f('0x61')]['id'],'messageId':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x52')],'from':_0xb19847['body'][_0x423f('0x17')][_0x423f('0x34')],'to':_0xb19847['body']['message']['to'],'cc':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')]['cc'],'subject':_0xb19847[_0x423f('0x2b')]['message'][_0x423f('0x54')],'attach':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')]['attach'],'Attachments':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x62')],'originTo':_0xb19847['body'][_0x423f('0x17')]['originTo'],'originCc':_0xb19847['body'][_0x423f('0x17')][_0x423f('0x63')],'bcc':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x64')],'ChatWebsiteId':_0xb19847['body'][_0x423f('0x17')][_0x423f('0x65')]||null,'originChannel':_0xb19847[_0x423f('0x2b')][_0x423f('0x17')][_0x423f('0x66')]||_0x423f('0x67'),'ChatOfflineMessageId':_0xb19847[_0x423f('0x2b')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x423f('0x68')],'as':_0x423f('0x69')}]});})[_0x423f('0xe')](function(_0x2789e4){_0x2316e8[_0x423f('0x17')]=_0x2789e4;if(!_0x2316e8['interaction'][_0x423f('0x6a')]){return;}return db[_0x423f('0x6b')][_0x423f('0x26')]({'attributes':['id',_0x423f('0x6c')],'where':{'id':_0x2316e8[_0x423f('0x5d')][_0x423f('0x6a')]}});})[_0x423f('0xe')](function(_0x1db383){if(_0x1db383){_0x2316e8[_0x423f('0x46')][_0x423f('0x6d')]({'id':0x0,'priority':0x0,'app':_0x423f('0x6e'),'appdata':_0x1db383[_0x423f('0x6c')]+','+(_0x2316e8[_0x423f('0x4a')]['waitForTheAssignedAgent']||0xa),'interval':_0x423f('0x6f')});}if(!_0x2316e8[_0x423f('0x5d')][_0x423f('0x70')]){return;}return db[_0x423f('0x71')][_0x423f('0x26')]({'attributes':['id','name'],'where':{'id':_0x2316e8[_0x423f('0x5d')][_0x423f('0x70')]}});})[_0x423f('0xe')](function(_0x2310e3){if(_0x2310e3){_0x2316e8['applications'][_0x423f('0x6d')]({'id':0x0,'priority':0x1,'app':_0x423f('0x72'),'appdata':_0x2310e3[_0x423f('0x6c')]+','+(_0x2316e8[_0x423f('0x4a')][_0x423f('0x73')]||0x12c),'interval':_0x423f('0x6f')});}return respondWithRpcPromise(_0x423f('0x74'),_0x423f('0x75'),_0x2316e8);})[_0x423f('0xe')](function(_0x22f2af){_0x81bd62(_0x22f2af);})[_0x423f('0x24')](function(_0xdbe8c3){_0x390a8f(_0xd42ce9[_0x423f('0x14')](0x1f4,_0xdbe8c3[_0x423f('0x17')]));});});}; \ No newline at end of file +var _0x9505=['list','orderBy','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','attach','interaction','attachments','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift','agent','name','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','MailAccount','findAll','options','where','limit','include','map','model','attributes','GetMailAccount','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','getSmtpOptions','body','mail','difference','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications'];(function(_0x215ea3,_0x24d78){var _0x542d1d=function(_0x35d6b3){while(--_0x35d6b3){_0x215ea3['push'](_0x215ea3['shift']());}};_0x542d1d(++_0x24d78);}(_0x9505,0x1e5));var _0x5950=function(_0x55a9ca,_0x46fa7a){_0x55a9ca=_0x55a9ca-0x0;var _0x388218=_0x9505[_0x55a9ca];return _0x388218;};'use strict';var _=require(_0x5950('0x0'));var moment=require(_0x5950('0x1'));var BPromise=require('bluebird');var rs=require(_0x5950('0x2'));var Redis=require(_0x5950('0x3'));var db=require(_0x5950('0x4'))['db'];var logger=require(_0x5950('0x5'))(_0x5950('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5950('0x7')][_0x5950('0x8')]({'port':0x232c});config[_0x5950('0x9')]=_[_0x5950('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5950('0xb'))(new Redis(config[_0x5950('0x9')]));require(_0x5950('0xc'))[_0x5950('0xd')](socket);function respondWithRpcPromise(_0x34c877,_0x1df039,_0x1148ef){return new BPromise(function(_0x213e3b,_0x1c8f39){return client['request'](_0x34c877,_0x1148ef)[_0x5950('0xe')](function(_0x477739){logger['info']('MailAccount,\x20%s,\x20%s',_0x1df039,_0x5950('0xf'));logger[_0x5950('0x10')](_0x5950('0x11'),_0x1df039,_0x5950('0xf'),JSON[_0x5950('0x12')](_0x477739));if(_0x477739[_0x5950('0x13')]){if(_0x477739[_0x5950('0x13')][_0x5950('0x14')]===0x1f4){logger[_0x5950('0x13')](_0x5950('0x15'),_0x1df039,_0x477739[_0x5950('0x13')][_0x5950('0x16')]);return _0x1c8f39(_0x477739[_0x5950('0x13')][_0x5950('0x16')]);}logger[_0x5950('0x13')](_0x5950('0x15'),_0x1df039,_0x477739[_0x5950('0x13')][_0x5950('0x16')]);return _0x213e3b(_0x477739[_0x5950('0x13')][_0x5950('0x16')]);}else{logger[_0x5950('0x17')]('MailAccount,\x20%s,\x20%s',_0x1df039,'request\x20sent');_0x213e3b(_0x477739[_0x5950('0x18')][_0x5950('0x16')]);}})[_0x5950('0x19')](function(_0x5a9530){logger[_0x5950('0x13')]('MailAccount,\x20%s,\x20%s',_0x1df039,_0x5a9530);_0x1c8f39(_0x5a9530);});});}exports['GetMailAccount']=function(_0x119f1f){var _0x2ada72=this;return new Promise(function(_0x1ad343,_0x5bd90e){return db[_0x5950('0x1a')][_0x5950('0x1b')]({'raw':_0x119f1f['options']?_0x119f1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x119f1f['options']?_0x119f1f[_0x5950('0x1c')][_0x5950('0x1d')]||null:null,'attributes':_0x119f1f[_0x5950('0x1c')]?_0x119f1f[_0x5950('0x1c')]['attributes']||null:null,'limit':_0x119f1f[_0x5950('0x1c')]?_0x119f1f[_0x5950('0x1c')][_0x5950('0x1e')]||null:null,'include':_0x119f1f[_0x5950('0x1c')]?_0x119f1f[_0x5950('0x1c')][_0x5950('0x1f')]?_[_0x5950('0x20')](_0x119f1f['options']['include'],function(_0x1b2265){return{'model':db[_0x1b2265[_0x5950('0x21')]],'as':_0x1b2265['as'],'attributes':_0x1b2265[_0x5950('0x22')],'include':_0x1b2265[_0x5950('0x1f')]?_[_0x5950('0x20')](_0x1b2265['include'],function(_0x4a7b22){return{'model':db[_0x4a7b22['model']],'as':_0x4a7b22['as'],'attributes':_0x4a7b22[_0x5950('0x22')],'include':_0x4a7b22[_0x5950('0x1f')]?_[_0x5950('0x20')](_0x4a7b22[_0x5950('0x1f')],function(_0x3923dd){return{'model':db[_0x3923dd[_0x5950('0x21')]],'as':_0x3923dd['as'],'attributes':_0x3923dd[_0x5950('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5950('0xe')](function(_0x179b24){logger[_0x5950('0x17')](_0x5950('0x23'),_0x119f1f);logger[_0x5950('0x10')](_0x5950('0x23'),_0x119f1f,JSON[_0x5950('0x12')](_0x179b24));_0x1ad343(_0x179b24);})[_0x5950('0x19')](function(_0x24fd58){logger[_0x5950('0x13')](_0x5950('0x23'),_0x24fd58[_0x5950('0x16')],_0x119f1f);_0x5bd90e(_0x2ada72[_0x5950('0x13')](0x1f4,_0x24fd58[_0x5950('0x16')]));});});};exports[_0x5950('0x24')]=function(_0x32cbb1){var _0x3304ec=this;return new Promise(function(_0x26fafc,_0x46ba0c){return db[_0x5950('0x1a')][_0x5950('0x25')]({'raw':_0x32cbb1['options']?_0x32cbb1[_0x5950('0x1c')][_0x5950('0x26')]===undefined?!![]:![]:!![],'where':_0x32cbb1[_0x5950('0x1c')]?_0x32cbb1[_0x5950('0x1c')][_0x5950('0x1d')]||null:null,'attributes':_0x32cbb1['options']?_0x32cbb1['options'][_0x5950('0x22')]||null:null,'include':_0x32cbb1[_0x5950('0x1c')]?_0x32cbb1['options'][_0x5950('0x1f')]?_['map'](_0x32cbb1[_0x5950('0x1c')][_0x5950('0x1f')],function(_0x376d9f){return{'model':db[_0x376d9f['model']],'as':_0x376d9f['as'],'attributes':_0x376d9f[_0x5950('0x22')],'include':_0x376d9f['include']?_[_0x5950('0x20')](_0x376d9f[_0x5950('0x1f')],function(_0x858e48){return{'model':db[_0x858e48[_0x5950('0x21')]],'as':_0x858e48['as'],'attributes':_0x858e48['attributes'],'include':_0x858e48[_0x5950('0x1f')]?_[_0x5950('0x20')](_0x858e48[_0x5950('0x1f')],function(_0x4ad1e0){return{'model':db[_0x4ad1e0[_0x5950('0x21')]],'as':_0x4ad1e0['as'],'attributes':_0x4ad1e0[_0x5950('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55d1c7){if(_0x32cbb1['options'][_0x5950('0x27')]===!![])_0x55d1c7[_0x5950('0x28')](_0x5950('0x29'),_0x55d1c7[_0x5950('0x2a')]());logger[_0x5950('0x17')]('ShowMailAccount',_0x32cbb1);logger['debug']('ShowMailAccount',_0x32cbb1,JSON['stringify'](_0x55d1c7));_0x26fafc(_0x55d1c7);})[_0x5950('0x19')](function(_0x3f7185){logger[_0x5950('0x13')](_0x5950('0x24'),_0x3f7185['message'],_0x32cbb1);_0x46ba0c(_0x3304ec[_0x5950('0x13')](0x1f4,_0x3f7185[_0x5950('0x16')]));});});};exports['NotifyMailAccount']=function(_0x2e6f8a){var _0x2231bb=this;return new Promise(function(_0x537141,_0x2c4bf3){var _0x479a9={'body':_0x2e6f8a[_0x5950('0x2b')],'channel':_0x5950('0x2c')};var _0x48eba5=_[_0x5950('0x2d')](_['keys'](db[_0x5950('0x2e')][_0x5950('0x2f')]),['createdAt',_0x5950('0x30'),_0x5950('0x31'),_0x5950('0x32')]);var _0x2e9950=![];if(_0x2e6f8a['body']['id']){delete _0x2e6f8a[_0x5950('0x2b')]['id'];}if(_[_0x5950('0x33')](_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x34')])){return _0x2c4bf3(_0x2231bb['error'](0x1f4,_0x5950('0x35')));}if(_[_0x5950('0x33')](_0x2e6f8a[_0x5950('0x2b')]['body'])||_0x2e6f8a[_0x5950('0x2b')]['body']===''){return _0x2c4bf3(_0x2231bb[_0x5950('0x13')](0x1f4,_0x5950('0x36')));}if(_[_0x5950('0x33')](_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x37')])){return _0x2c4bf3(_0x2231bb[_0x5950('0x13')](0x1f4,_0x5950('0x38')+_0x48eba5));}if(!_['includes'](_0x48eba5,_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x37')])){return _0x2c4bf3(_0x2231bb[_0x5950('0x13')](0x1f4,_0x5950('0x39')+_0x48eba5));}var _0x32375={};_0x32375[_0x2e6f8a['body']['mapKey']]=_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x34')];return db[_0x5950('0x1a')]['find']({'where':{'id':_0x2e6f8a[_0x5950('0x3a')]['id']},'include':[{'model':db[_0x5950('0x3b')],'as':_0x5950('0x3c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x32375,'limit':0x1,'order':[['updatedAt',_0x5950('0x3d')]]}]},{'model':db[_0x5950('0x3e')],'as':_0x5950('0x3f')},{'model':db[_0x5950('0x40')],'as':_0x5950('0x41'),'include':[{'model':db[_0x5950('0x42')],'as':_0x5950('0x42')}]}]})[_0x5950('0xe')](function(_0x25d749){if(_0x25d749&&_0x25d749['List']){var _0x16737d=_0x25d749[_0x5950('0x43')]({'plain':!![]});_0x479a9[_0x5950('0x3a')]=_[_0x5950('0x44')](_0x16737d,[_0x5950('0x3f'),_0x5950('0x3c')]);_0x479a9[_0x5950('0x3a')][_0x5950('0x29')]=_0x25d749[_0x5950('0x2a')]();_0x479a9[_0x5950('0x45')]=_0x16737d['Applications'];_0x479a9[_0x5950('0x46')]=_0x16737d[_0x5950('0x3c')];_0x479a9[_0x5950('0x45')]=_[_0x5950('0x47')](_0x479a9['applications'],['priority'],[_0x5950('0x48')]);if(_0x479a9[_0x5950('0x3a')]&&_0x479a9['account'][_0x5950('0x49')]){_0x479a9[_0x5950('0x45')][_0x5950('0x4a')]({'id':0x0,'priority':_0x479a9[_0x5950('0x45')][_0x5950('0x4b')]+0x1,'app':_0x5950('0x4c'),'appdata':'autoclose','interval':_0x5950('0x4d')});}if(_0x479a9[_0x5950('0x3a')]['Applications']){delete _0x479a9[_0x5950('0x3a')][_0x5950('0x3f')];}if(_0x479a9[_0x5950('0x3a')]['List']){delete _0x479a9[_0x5950('0x3a')][_0x5950('0x3c')];}if(_0x16737d[_0x5950('0x3c')][_0x5950('0x4e')][_0x5950('0x4b')]){return _0x16737d[_0x5950('0x3c')][_0x5950('0x4e')][0x0];}var _0x2f824e=_[_0x5950('0xa')](_0x2e6f8a['body'],{'firstName':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x34')],'ListId':_0x16737d[_0x5950('0x32')]});_0x2f824e[_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x37')]]=_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x34')];return db['CmContact'][_0x5950('0x4f')](_0x2f824e);}else{throw new Error('List\x20not\x20found');}})[_0x5950('0xe')](function(_0x489f8c){_0x479a9[_0x5950('0x50')]=_0x489f8c;if(_0x489f8c){if(!_0x2e6f8a[_0x5950('0x2b')]['message'][_0x5950('0x51')]){_0x2e6f8a['body'][_0x5950('0x16')][_0x5950('0x51')]=rs['generate']()+'\x20'+_0x2e6f8a['body'][_0x5950('0x16')][_0x5950('0x34')];}var _0x13d10d={'ContactId':_0x489f8c['id'],'MailAccountId':_0x2e6f8a[_0x5950('0x3a')]['id'],'inReplyTo':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x51')],'to':_0x2e6f8a[_0x5950('0x2b')]['message']['from'],'cc':_0x2e6f8a[_0x5950('0x2b')]['message']['cc'],'subject':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x52')],'attach':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')]['attach'],'lastMsgAt':moment()[_0x5950('0x53')](_0x5950('0x54')),'lastMsgDirection':'in'};return db[_0x5950('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x2e6f8a['account']['id']},'include':[{'model':db[_0x5950('0x56')],'as':'Messages','attributes':[_0x5950('0x51')],'where':{'messageId':_0x2e6f8a[_0x5950('0x2b')]['message'][_0x5950('0x57')]}}]})[_0x5950('0xe')](function(_0x40d20d){if(_0x40d20d){return[_0x40d20d,![]];}return db[_0x5950('0x55')][_0x5950('0x4f')](_0x13d10d)[_0x5950('0xe')](function(_0x570003){return[_0x570003,!![]];});});}else{throw new Error(_0x5950('0x58'));}})[_0x5950('0x59')](function(_0x84770e,_0x4cddfb){if(_0x84770e){_0x2e9950=_0x4cddfb;if(!_0x4cddfb){return _0x84770e['update']({'inReplyTo':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x51')],'to':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x34')],'cc':_0x2e6f8a['body'][_0x5950('0x16')]['cc'],'subject':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x52')],'attach':_0x84770e['attach']?_0x84770e[_0x5950('0x5a')]:_0x2e6f8a[_0x5950('0x2b')]['message'][_0x5950('0x5a')],'substatus':null,'substatusAt':moment()['format'](_0x5950('0x54')),'lastMsgAt':moment()['format'](_0x5950('0x54')),'lastMsgDirection':'in'});}else{return _0x84770e;}}})[_0x5950('0xe')](function(_0x4d3edd){_0x479a9[_0x5950('0x5b')]=_0x4d3edd[_0x5950('0x43')]({'plain':!![]});_0x479a9[_0x5950('0x5b')]['created']=_0x2e9950;return db[_0x5950('0x56')][_0x5950('0x4f')]({'body':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x2b')],'MailAccountId':_0x2e6f8a[_0x5950('0x3a')]['id'],'MailInteractionId':_0x4d3edd['id'],'direction':'in','ContactId':_0x479a9[_0x5950('0x50')]['id'],'messageId':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')]['messageId'],'from':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x34')],'to':_0x2e6f8a[_0x5950('0x2b')]['message']['to'],'cc':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')]['cc'],'subject':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')]['subject'],'attach':_0x2e6f8a['body'][_0x5950('0x16')]['attach'],'Attachments':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x5c')],'originTo':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')]['originTo'],'originCc':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')]['originCc'],'bcc':_0x2e6f8a['body'][_0x5950('0x16')][_0x5950('0x5d')],'ChatWebsiteId':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x5e')]||null,'originChannel':_0x2e6f8a['body'][_0x5950('0x16')][_0x5950('0x5f')]||_0x5950('0x60'),'ChatOfflineMessageId':_0x2e6f8a[_0x5950('0x2b')][_0x5950('0x16')][_0x5950('0x61')]||null},{'include':[{'model':db[_0x5950('0x62')],'as':_0x5950('0x63')}]});})['then'](function(_0x4c60f7){_0x479a9[_0x5950('0x16')]=_0x4c60f7;if(!_0x479a9[_0x5950('0x5b')][_0x5950('0x64')]){return;}return db[_0x5950('0x65')][_0x5950('0x25')]({'attributes':['id','name'],'where':{'id':_0x479a9['interaction'][_0x5950('0x64')]}});})[_0x5950('0xe')](function(_0x59f9da){if(_0x59f9da){_0x479a9[_0x5950('0x45')][_0x5950('0x66')]({'id':0x0,'priority':0x0,'app':_0x5950('0x67'),'appdata':_0x59f9da[_0x5950('0x68')]+','+(_0x479a9[_0x5950('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x5950('0x4d')});}if(!_0x479a9['interaction']['queueId']){return;}return db[_0x5950('0x69')][_0x5950('0x25')]({'attributes':['id',_0x5950('0x68')],'where':{'id':_0x479a9['interaction'][_0x5950('0x6a')]}});})[_0x5950('0xe')](function(_0x2663ab){if(_0x2663ab){_0x479a9['applications'][_0x5950('0x66')]({'id':0x0,'priority':0x1,'app':_0x5950('0x6b'),'appdata':_0x2663ab[_0x5950('0x68')]+','+(_0x479a9[_0x5950('0x3a')][_0x5950('0x6c')]||0x12c),'interval':_0x5950('0x4d')});}return respondWithRpcPromise(_0x5950('0x6d'),_0x5950('0x6e'),_0x479a9);})['then'](function(_0x3f3189){_0x537141(_0x3f3189);})['catch'](function(_0x406c04){_0x2c4bf3(_0x2231bb[_0x5950('0x13')](0x1f4,_0x406c04[_0x5950('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e97fa41..7626961 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 _0xded4=['mailAccount:','remove','update','emit','removeListener','register'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xded4,0x1bd));var _0x4ded=function(_0x68513f,_0x108e8d){_0x68513f=_0x68513f-0x0;var _0x554665=_0xded4[_0x68513f];return _0x554665;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x4ded('0x0'),_0x4ded('0x1')];function createListener(_0x18bf91,_0x2cae27){return function(_0x577049){_0x2cae27[_0x4ded('0x2')](_0x18bf91,_0x577049);};}function removeListener(_0x4c8a12,_0xf5f598){return function(){MailAccountEvents[_0x4ded('0x3')](_0x4c8a12,_0xf5f598);};}exports[_0x4ded('0x4')]=function(_0x17491a){for(var _0x23cc0f=0x0,_0x6a0d15=events['length'];_0x23cc0f<_0x6a0d15;_0x23cc0f++){var _0x51ea60=events[_0x23cc0f];var _0x1a2eeb=createListener(_0x4ded('0x5')+_0x51ea60,_0x17491a);MailAccountEvents['on'](_0x51ea60,_0x1a2eeb);}}; \ No newline at end of file +var _0x43d4=['register','length','mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x5ba74f,_0x200bf4){var _0x534d79=function(_0x50521a){while(--_0x50521a){_0x5ba74f['push'](_0x5ba74f['shift']());}};_0x534d79(++_0x200bf4);}(_0x43d4,0x173));var _0x443d=function(_0x5a034b,_0x8676e5){_0x5a034b=_0x5a034b-0x0;var _0x36093f=_0x43d4[_0x5a034b];return _0x36093f;};'use strict';var MailAccountEvents=require(_0x443d('0x0'));var events=[_0x443d('0x1'),_0x443d('0x2'),_0x443d('0x3')];function createListener(_0x3c3d5e,_0x5e9167){return function(_0x54e7f3){_0x5e9167['emit'](_0x3c3d5e,_0x54e7f3);};}function removeListener(_0x2e508e,_0x3269e1){return function(){MailAccountEvents[_0x443d('0x4')](_0x2e508e,_0x3269e1);};}exports[_0x443d('0x5')]=function(_0x4b3123){for(var _0x5df9e0=0x0,_0x244281=events[_0x443d('0x6')];_0x5df9e0<_0x244281;_0x5df9e0++){var _0x5aaba1=events[_0x5df9e0];var _0x5af238=createListener(_0x443d('0x7')+_0x5aaba1,_0x4b3123);MailAccountEvents['on'](_0x5aaba1,_0x5af238);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0346851..475e0cf 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 _0x8c69=['../../components/interaction/service','./mailApplication.controller','get','/:id','show','put','destroy','exports','multer','connect-timeout','express','../../components/auth/service'];(function(_0x3f105a,_0x459d89){var _0x41a968=function(_0x18eb8a){while(--_0x18eb8a){_0x3f105a['push'](_0x3f105a['shift']());}};_0x41a968(++_0x459d89);}(_0x8c69,0x1a0));var _0x98c6=function(_0x314788,_0x3b0a25){_0x314788=_0x314788-0x0;var _0x373c3f=_0x8c69[_0x314788];return _0x373c3f;};'use strict';var multer=require(_0x98c6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x98c6('0x1'));var express=require(_0x98c6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98c6('0x3'));var interaction=require(_0x98c6('0x4'));var config=require('../../config/environment');var controller=require(_0x98c6('0x5'));router[_0x98c6('0x6')](_0x98c6('0x7'),auth['isAuthenticated'](),controller[_0x98c6('0x8')]);router[_0x98c6('0x9')](_0x98c6('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x98c6('0x7'),auth['isAuthenticated'](),controller[_0x98c6('0xa')]);module[_0x98c6('0xb')]=router; \ No newline at end of file +var _0x22a4=['show','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x4c5f8a,_0x4375ec){var _0x26794c=function(_0xb2c09c){while(--_0xb2c09c){_0x4c5f8a['push'](_0x4c5f8a['shift']());}};_0x26794c(++_0x4375ec);}(_0x22a4,0xaa));var _0x422a=function(_0x6470a2,_0x3b5f44){_0x6470a2=_0x6470a2-0x0;var _0x24ac61=_0x22a4[_0x6470a2];return _0x24ac61;};'use strict';var multer=require('multer');var util=require(_0x422a('0x0'));var path=require(_0x422a('0x1'));var timeout=require('connect-timeout');var express=require(_0x422a('0x2'));var router=express[_0x422a('0x3')]();var fs_extra=require(_0x422a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x422a('0x5'));var controller=require(_0x422a('0x6'));router[_0x422a('0x7')](_0x422a('0x8'),auth[_0x422a('0x9')](),controller[_0x422a('0xa')]);router[_0x422a('0xb')](_0x422a('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x422a('0xc')](_0x422a('0x8'),auth[_0x422a('0x9')](),controller[_0x422a('0xd')]);module[_0x422a('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f79a4f5..289cfe8 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 _0x4a5b=['INTEGER','STRING','*,*,*,*','exports'];(function(_0x66acd9,_0x1c172f){var _0xb3d35b=function(_0x4ea05a){while(--_0x4ea05a){_0x66acd9['push'](_0x66acd9['shift']());}};_0xb3d35b(++_0x1c172f);}(_0x4a5b,0x67));var _0xb4a5=function(_0x1f6dde,_0x4de47f){_0x1f6dde=_0x1f6dde-0x0;var _0x19b827=_0x4a5b[_0x1f6dde];return _0x19b827;};'use strict';var Sequelize=require('sequelize');module[_0xb4a5('0x0')]={'priority':{'type':Sequelize[_0xb4a5('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb4a5('0x2')]},'interval':{'type':Sequelize[_0xb4a5('0x2')],'defaultValue':_0xb4a5('0x3')}}; \ No newline at end of file +var _0x7481=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x57d45b,_0x4651d5){var _0x4ceefb=function(_0x1cb65f){while(--_0x1cb65f){_0x57d45b['push'](_0x57d45b['shift']());}};_0x4ceefb(++_0x4651d5);}(_0x7481,0x155));var _0x1748=function(_0x5686a4,_0x137a28){_0x5686a4=_0x5686a4-0x0;var _0x9aa8c6=_0x7481[_0x5686a4];return _0x9aa8c6;};'use strict';var Sequelize=require(_0x1748('0x0'));module[_0x1748('0x1')]={'priority':{'type':Sequelize[_0x1748('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1748('0x3')],'allowNull':![],'defaultValue':_0x1748('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1748('0x3')]},'interval':{'type':Sequelize[_0x1748('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 3cb4335..c9202d8 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 _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(_0x40570e,_0x53df30){var _0x16336a=function(_0x227e0b){while(--_0x227e0b){_0x40570e['push'](_0x40570e['shift']());}};_0x16336a(++_0x53df30);}(_0xe706,0xa3));var _0x6e70=function(_0x329dd0,_0x47e04f){_0x329dd0=_0x329dd0-0x0;var _0x4f5b90=_0xe706[_0x329dd0];return _0x4f5b90;};'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 +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x416afb,_0x17bd86){var _0x152cf6=function(_0x34fb4b){while(--_0x34fb4b){_0x416afb['push'](_0x416afb['shift']());}};_0x152cf6(++_0x17bd86);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ca1771a..ca4cab0 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 _0x360b=['define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x42be97,_0x28f818){var _0x48176b=function(_0x2215a0){while(--_0x2215a0){_0x42be97['push'](_0x42be97['shift']());}};_0x48176b(++_0x28f818);}(_0x360b,0x73));var _0xb360=function(_0x510e62,_0x558120){_0x510e62=_0x510e62-0x0;var _0x47e3d1=_0x360b[_0x510e62];return _0x47e3d1;};'use strict';var _=require('lodash');var util=require(_0xb360('0x0'));var logger=require(_0xb360('0x1'))(_0xb360('0x2'));var moment=require(_0xb360('0x3'));var BPromise=require(_0xb360('0x4'));var rp=require(_0xb360('0x5'));var fs=require('fs');var path=require(_0xb360('0x6'));var rimraf=require(_0xb360('0x7'));var config=require(_0xb360('0x8'));var attributes=require(_0xb360('0x9'));module[_0xb360('0xa')]=function(_0x1bdb96,_0x42419d){return _0x1bdb96[_0xb360('0xb')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb360('0xc'),'collate':_0xb360('0xd')});}; \ No newline at end of file +var _0xe98d=['define','MailApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3394a1,_0xbb2dcf){var _0x360342=function(_0x4e0f6c){while(--_0x4e0f6c){_0x3394a1['push'](_0x3394a1['shift']());}};_0x360342(++_0xbb2dcf);}(_0xe98d,0x121));var _0xde98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xde98('0x0'));var logger=require(_0xde98('0x1'))(_0xde98('0x2'));var moment=require(_0xde98('0x3'));var BPromise=require(_0xde98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde98('0x5'));var rimraf=require(_0xde98('0x6'));var config=require(_0xde98('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x335ff1,_0xaddfd){return _0x335ff1[_0xde98('0x8')](_0xde98('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xde98('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8272912..8e8e9b3 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 _0xf630=['info','catch','UpdateMailApplication','MailApplication','update','body','options','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf630,0xf0));var _0x0f63=function(_0x238281,_0x2e4cd0){_0x238281=_0x238281-0x0;var _0x22c358=_0xf630[_0x238281];return _0x22c358;};'use strict';var _=require(_0x0f63('0x0'));var util=require(_0x0f63('0x1'));var moment=require(_0x0f63('0x2'));var BPromise=require(_0x0f63('0x3'));var rs=require(_0x0f63('0x4'));var fs=require('fs');var Redis=require(_0x0f63('0x5'));var db=require(_0x0f63('0x6'))['db'];var utils=require(_0x0f63('0x7'));var logger=require(_0x0f63('0x8'))(_0x0f63('0x9'));var config=require(_0x0f63('0xa'));var jayson=require(_0x0f63('0xb'));var client=jayson[_0x0f63('0xc')][_0x0f63('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x39e858,_0x56f48f,_0x59deb6){return new BPromise(function(_0x3e4b52,_0x3f1981){return client[_0x0f63('0xe')](_0x39e858,_0x59deb6)[_0x0f63('0xf')](function(_0x16713d){logger['info'](_0x0f63('0x10'),_0x56f48f,_0x0f63('0x11'));logger[_0x0f63('0x12')](_0x0f63('0x13'),_0x56f48f,_0x0f63('0x11'),JSON[_0x0f63('0x14')](_0x16713d));if(_0x16713d[_0x0f63('0x15')]){if(_0x16713d[_0x0f63('0x15')][_0x0f63('0x16')]===0x1f4){logger[_0x0f63('0x15')]('MailApplication,\x20%s,\x20%s',_0x56f48f,_0x16713d['error'][_0x0f63('0x17')]);return _0x3f1981(_0x16713d['error'][_0x0f63('0x17')]);}logger['error'](_0x0f63('0x10'),_0x56f48f,_0x16713d[_0x0f63('0x15')][_0x0f63('0x17')]);return _0x3e4b52(_0x16713d[_0x0f63('0x15')][_0x0f63('0x17')]);}else{logger[_0x0f63('0x18')]('MailApplication,\x20%s,\x20%s',_0x56f48f,_0x0f63('0x11'));_0x3e4b52(_0x16713d['result'][_0x0f63('0x17')]);}})[_0x0f63('0x19')](function(_0x35f4a7){logger[_0x0f63('0x15')](_0x0f63('0x10'),_0x56f48f,_0x35f4a7);_0x3f1981(_0x35f4a7);});});}exports[_0x0f63('0x1a')]=function(_0x42d363){var _0x39caef=this;return new Promise(function(_0x4470b2,_0x1495b8){return db[_0x0f63('0x1b')][_0x0f63('0x1c')](_0x42d363[_0x0f63('0x1d')],{'raw':_0x42d363[_0x0f63('0x1e')]?_0x42d363[_0x0f63('0x1e')][_0x0f63('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d363[_0x0f63('0x1e')]?_0x42d363[_0x0f63('0x1e')]['where']||null:null,'attributes':_0x42d363[_0x0f63('0x1e')]?_0x42d363['options']['attributes']||null:null,'limit':_0x42d363[_0x0f63('0x1e')]?_0x42d363[_0x0f63('0x1e')][_0x0f63('0x20')]||null:null})[_0x0f63('0xf')](function(_0x365f73){logger[_0x0f63('0x18')](_0x0f63('0x1a'),_0x42d363);logger[_0x0f63('0x12')]('UpdateMailApplication',_0x42d363,JSON['stringify'](_0x365f73));_0x4470b2(_0x365f73);})['catch'](function(_0x23f754){logger[_0x0f63('0x15')]('UpdateMailApplication',_0x23f754[_0x0f63('0x17')],_0x42d363);_0x1495b8(_0x39caef[_0x0f63('0x15')](0x1f4,_0x23f754[_0x0f63('0x17')]));});});}; \ No newline at end of file +var _0xbfeb=['MailApplication','options','raw','where','limit','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailApplication'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xbfeb,0x1aa));var _0xbbfe=function(_0x4f8087,_0x5d110f){_0x4f8087=_0x4f8087-0x0;var _0x285a86=_0xbfeb[_0x4f8087];return _0x285a86;};'use strict';var _=require(_0xbbfe('0x0'));var util=require(_0xbbfe('0x1'));var moment=require(_0xbbfe('0x2'));var BPromise=require(_0xbbfe('0x3'));var rs=require(_0xbbfe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbfe('0x5'))['db'];var utils=require(_0xbbfe('0x6'));var logger=require('../../config/logger')(_0xbbfe('0x7'));var config=require(_0xbbfe('0x8'));var jayson=require(_0xbbfe('0x9'));var client=jayson['client'][_0xbbfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c9893,_0x48327d,_0x5da322){return new BPromise(function(_0x511eb8,_0x54dfdc){return client[_0xbbfe('0xb')](_0x7c9893,_0x5da322)['then'](function(_0x2a5cc8){logger[_0xbbfe('0xc')](_0xbbfe('0xd'),_0x48327d,_0xbbfe('0xe'));logger[_0xbbfe('0xf')](_0xbbfe('0x10'),_0x48327d,_0xbbfe('0xe'),JSON[_0xbbfe('0x11')](_0x2a5cc8));if(_0x2a5cc8[_0xbbfe('0x12')]){if(_0x2a5cc8['error'][_0xbbfe('0x13')]===0x1f4){logger[_0xbbfe('0x12')]('MailApplication,\x20%s,\x20%s',_0x48327d,_0x2a5cc8[_0xbbfe('0x12')]['message']);return _0x54dfdc(_0x2a5cc8['error'][_0xbbfe('0x14')]);}logger[_0xbbfe('0x12')](_0xbbfe('0xd'),_0x48327d,_0x2a5cc8[_0xbbfe('0x12')][_0xbbfe('0x14')]);return _0x511eb8(_0x2a5cc8[_0xbbfe('0x12')][_0xbbfe('0x14')]);}else{logger[_0xbbfe('0xc')](_0xbbfe('0xd'),_0x48327d,_0xbbfe('0xe'));_0x511eb8(_0x2a5cc8['result']['message']);}})['catch'](function(_0x3f5f42){logger[_0xbbfe('0x12')]('MailApplication,\x20%s,\x20%s',_0x48327d,_0x3f5f42);_0x54dfdc(_0x3f5f42);});});}exports[_0xbbfe('0x15')]=function(_0x4b282f){var _0x47be7f=this;return new Promise(function(_0x5ad4bf,_0x544e8b){return db[_0xbbfe('0x16')]['update'](_0x4b282f['body'],{'raw':_0x4b282f['options']?_0x4b282f[_0xbbfe('0x17')][_0xbbfe('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b282f[_0xbbfe('0x17')]?_0x4b282f['options'][_0xbbfe('0x19')]||null:null,'attributes':_0x4b282f[_0xbbfe('0x17')]?_0x4b282f['options']['attributes']||null:null,'limit':_0x4b282f[_0xbbfe('0x17')]?_0x4b282f[_0xbbfe('0x17')][_0xbbfe('0x1a')]||null:null})['then'](function(_0x4ddff4){logger[_0xbbfe('0xc')]('UpdateMailApplication',_0x4b282f);logger[_0xbbfe('0xf')](_0xbbfe('0x15'),_0x4b282f,JSON['stringify'](_0x4ddff4));_0x5ad4bf(_0x4ddff4);})[_0xbbfe('0x1b')](function(_0x117ba2){logger['error']('UpdateMailApplication',_0x117ba2[_0xbbfe('0x14')],_0x4b282f);_0x544e8b(_0x47be7f[_0xbbfe('0x12')](0x1f4,_0x117ba2[_0xbbfe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 93f8466..947e6c9 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 _0x457f=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/interaction/service','./mailInteraction.controller','get'];(function(_0x1b1bd5,_0xf50a3){var _0x12bf17=function(_0x5a1a9f){while(--_0x5a1a9f){_0x1b1bd5['push'](_0x1b1bd5['shift']());}};_0x12bf17(++_0xf50a3);}(_0x457f,0x6b));var _0xf457=function(_0x2fc10f,_0x5ca4c0){_0x2fc10f=_0x2fc10f-0x0;var _0x280dfe=_0x457f[_0x2fc10f];return _0x280dfe;};'use strict';var express=require(_0xf457('0x0'));var router=express[_0xf457('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xf457('0x2'));var controller=require(_0xf457('0x3'));router[_0xf457('0x4')]('/',auth[_0xf457('0x5')](),controller[_0xf457('0x6')]);router[_0xf457('0x4')](_0xf457('0x7'),auth['isAuthenticated'](),controller[_0xf457('0x8')]);router[_0xf457('0x4')](_0xf457('0x9'),auth[_0xf457('0x5')](),controller[_0xf457('0xa')]);router[_0xf457('0x4')](_0xf457('0xb'),auth[_0xf457('0x5')](),controller[_0xf457('0xc')]);router[_0xf457('0x4')](_0xf457('0xd'),auth[_0xf457('0x5')](),controller[_0xf457('0xe')]);router[_0xf457('0xf')]('/',auth[_0xf457('0x5')](),controller[_0xf457('0x10')]);router[_0xf457('0xf')](_0xf457('0xb'),auth[_0xf457('0x5')](),controller[_0xf457('0x11')]);router[_0xf457('0xf')](_0xf457('0x12'),auth['isAuthenticated'](),interaction[_0xf457('0x13')](_0xf457('0x14'),_0xf457('0x15')),controller[_0xf457('0x16')]);router[_0xf457('0x17')](_0xf457('0x9'),auth[_0xf457('0x5')](),interaction['tracked'](_0xf457('0x14'),'mailinteraction:update'),controller['update']);router[_0xf457('0x18')]('/:id',auth[_0xf457('0x5')](),interaction[_0xf457('0x13')](_0xf457('0x14'),_0xf457('0x19')),controller[_0xf457('0x1a')]);router['delete'](_0xf457('0x12'),auth[_0xf457('0x5')](),controller[_0xf457('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x3bab=['/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','/:id/tags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe'];(function(_0x5a052b,_0x2758f0){var _0x3a3bdb=function(_0x4170ba){while(--_0x4170ba){_0x5a052b['push'](_0x5a052b['shift']());}};_0x3a3bdb(++_0x2758f0);}(_0x3bab,0x1c4));var _0xb3ba=function(_0x1abc7a,_0x5d83c9){_0x1abc7a=_0x1abc7a-0x0;var _0x498347=_0x3bab[_0x1abc7a];return _0x498347;};'use strict';var express=require(_0xb3ba('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb3ba('0x1'));var controller=require(_0xb3ba('0x2'));router[_0xb3ba('0x3')]('/',auth['isAuthenticated'](),controller[_0xb3ba('0x4')]);router['get'](_0xb3ba('0x5'),auth['isAuthenticated'](),controller[_0xb3ba('0x6')]);router['get'](_0xb3ba('0x7'),auth[_0xb3ba('0x8')](),controller[_0xb3ba('0x9')]);router[_0xb3ba('0x3')](_0xb3ba('0xa'),auth[_0xb3ba('0x8')](),controller[_0xb3ba('0xb')]);router[_0xb3ba('0x3')](_0xb3ba('0xc'),auth[_0xb3ba('0x8')](),controller[_0xb3ba('0xd')]);router[_0xb3ba('0xe')]('/',auth[_0xb3ba('0x8')](),controller[_0xb3ba('0xf')]);router[_0xb3ba('0xe')]('/:id/messages',auth[_0xb3ba('0x8')](),controller[_0xb3ba('0x10')]);router[_0xb3ba('0xe')]('/:id/tags',auth[_0xb3ba('0x8')](),interaction[_0xb3ba('0x11')](_0xb3ba('0x12'),'mailinteraction:addtags'),controller[_0xb3ba('0x13')]);router[_0xb3ba('0x14')](_0xb3ba('0x7'),auth[_0xb3ba('0x8')](),interaction[_0xb3ba('0x11')]('mail',_0xb3ba('0x15')),controller[_0xb3ba('0x16')]);router[_0xb3ba('0x17')](_0xb3ba('0x7'),auth['isAuthenticated'](),interaction['tracked'](_0xb3ba('0x12'),_0xb3ba('0x18')),controller['destroy']);router[_0xb3ba('0x17')](_0xb3ba('0x19'),auth['isAuthenticated'](),controller['removeTags']);module[_0xb3ba('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index fd44716..a923640 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 _0x42b8=['out','INTEGER','iconv','exports','BOOLEAN','STRING','long','DATE','ENUM'];(function(_0x357cbe,_0x36bace){var _0x1b4edd=function(_0x3e3be3){while(--_0x3e3be3){_0x357cbe['push'](_0x357cbe['shift']());}};_0x1b4edd(++_0x36bace);}(_0x42b8,0x173));var _0x842b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x42b8[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x842b('0x0'));module[_0x842b('0x1')]={'closed':{'type':Sequelize[_0x842b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x842b('0x3')]},'note':{'type':Sequelize[_0x842b('0x3')]},'inReplyTo':{'type':Sequelize[_0x842b('0x3')](0x1fe)},'to':{'type':Sequelize[_0x842b('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x842b('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x842b('0x5')]},'substatus':{'type':Sequelize[_0x842b('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x842b('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x842b('0x6')]('in',_0x842b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x842b('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x842b('0x8')]}}; \ No newline at end of file +var _0xb1f9=['out','INTEGER','sequelize','exports','BOOLEAN','STRING','TEXT','DATE','ENUM'];(function(_0x1f929d,_0x4fddf2){var _0x33ff30=function(_0x1f0ab5){while(--_0x1f0ab5){_0x1f929d['push'](_0x1f929d['shift']());}};_0x33ff30(++_0x4fddf2);}(_0xb1f9,0x158));var _0x9b1f=function(_0x90dc63,_0x54cfa9){_0x90dc63=_0x90dc63-0x0;var _0xf839e3=_0xb1f9[_0x90dc63];return _0xf839e3;};'use strict';var Sequelize=require(_0x9b1f('0x0'));var iconv=require('iconv');module[_0x9b1f('0x1')]={'closed':{'type':Sequelize[_0x9b1f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9b1f('0x3')]},'secondDisposition':{'type':Sequelize[_0x9b1f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9b1f('0x3')]},'inReplyTo':{'type':Sequelize[_0x9b1f('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9b1f('0x3')]},'cc':{'type':Sequelize[_0x9b1f('0x4')]('long')},'subject':{'type':Sequelize[_0x9b1f('0x4')]()},'attach':{'type':Sequelize[_0x9b1f('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9b1f('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x9b1f('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x9b1f('0x6')]('in',_0x9b1f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9b1f('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x9b1f('0x6')]('in',_0x9b1f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9b1f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9b1f('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4b77913..378681c 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 _0x637a=['mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','Content-Range','update','error','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','then','catch','params','model','keys','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','filters','hasOwnProperty','sort','where','pick','filter','$gte','split','format','true','length','rows','spread','Tag','findAll'];(function(_0x121b1f,_0x514e81){var _0x33652a=function(_0x1555ac){while(--_0x1555ac){_0x121b1f['push'](_0x121b1f['shift']());}};_0x33652a(++_0x514e81);}(_0x637a,0x8a));var _0xa637=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x637a[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xa637('0x0'));var rimraf=require(_0xa637('0x1'));var zipdir=require(_0xa637('0x2'));var moment=require('moment');var BPromise=require(_0xa637('0x3'));var util=require(_0xa637('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xa637('0x5'));var juice=require(_0xa637('0x6'));var Redis=require(_0xa637('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xa637('0x8'))(_0xa637('0x9'));var config=require(_0xa637('0xa'));var db=require(_0xa637('0xb'))['db'];var htmlEntities=require(_0xa637('0xc'));config[_0xa637('0xd')]=_[_0xa637('0xe')](config[_0xa637('0xd')],{'host':_0xa637('0xf'),'port':0x18eb});var socket=require(_0xa637('0x10'))(new Redis(config[_0xa637('0xd')]));require(_0xa637('0x11'))[_0xa637('0x12')](socket);function respondWithStatusCode(_0x18e497,_0xcd7344){_0xcd7344=_0xcd7344||0xcc;return function(_0x152a98){if(_0x152a98){return _0x18e497[_0xa637('0x13')](_0xcd7344);}return _0x18e497[_0xa637('0x14')](_0xcd7344)[_0xa637('0x15')]();};}function respondWithResult(_0x3074a5,_0x196c47){_0x196c47=_0x196c47||0xc8;return function(_0x52207f){if(_0x52207f){return _0x3074a5[_0xa637('0x14')](_0x196c47)[_0xa637('0x16')](_0x52207f);}};}function respondWithFilteredResult(_0x2c1bb3,_0xb1c23f){return function(_0x557db3){if(_0x557db3){var _0x2228cd=typeof _0xb1c23f[_0xa637('0x17')]==='undefined'&&typeof _0xb1c23f[_0xa637('0x18')]==='undefined';var _0x3ebc06=_0x557db3[_0xa637('0x19')];var _0xd229a5=_0x2228cd?0x0:_0xb1c23f[_0xa637('0x17')];var _0x3a4e65=_0x2228cd?_0x557db3[_0xa637('0x19')]:_0xb1c23f[_0xa637('0x17')]+_0xb1c23f[_0xa637('0x18')];var _0x5c8c1c;if(_0x3a4e65>=_0x3ebc06){_0x3a4e65=_0x3ebc06;_0x5c8c1c=0xc8;}else{_0x5c8c1c=0xce;}_0x2c1bb3[_0xa637('0x14')](_0x5c8c1c);return _0x2c1bb3['set'](_0xa637('0x1a'),_0xd229a5+'-'+_0x3a4e65+'/'+_0x3ebc06)[_0xa637('0x16')](_0x557db3);}return null;};}function saveUpdates(_0x4af45b){return function(_0x5aa58e){if(_0x5aa58e){return _0x5aa58e[_0xa637('0x1b')](_0x4af45b)['then'](function(_0x3270c4){return _0x3270c4;});}return null;};}function removeEntity(_0x1bf9a0){return function(_0x2c3f19){if(_0x2c3f19){return _0x2c3f19['destroy']()['then'](function(){_0x1bf9a0['status'](0xcc)[_0xa637('0x15')]();});}};}function handleEntityNotFound(_0x294105){return function(_0x3260ac){if(!_0x3260ac){_0x294105[_0xa637('0x13')](0x194);}return _0x3260ac;};}function handleError(_0x1ad675,_0x2c3d19){_0x2c3d19=_0x2c3d19||0x1f4;return function(_0xa68b3d){logger[_0xa637('0x1c')](_0xa68b3d['stack']);if(_0xa68b3d[_0xa637('0x1d')]){delete _0xa68b3d['name'];}_0x1ad675['status'](_0x2c3d19)['send'](_0xa68b3d);};}exports[_0xa637('0x1e')]=function(_0x512a52,_0x27534d){var _0x5b64a6={};var _0x467d9e=_[_0xa637('0x1f')](db[_0xa637('0x20')][_0xa637('0x21')],function(_0x1d9044){return{'name':_0x1d9044[_0xa637('0x22')],'type':_0x1d9044[_0xa637('0x23')][_0xa637('0x24')]};});_0x5b64a6=qs[_0xa637('0x25')](_0x467d9e,_0x512a52);return interaction['findAll']('mail',_0x512a52[_0xa637('0x26')],_0x512a52[_0xa637('0x27')],_0x5b64a6,_0x467d9e)[_0xa637('0x28')](respondWithFilteredResult(_0x27534d,_0x5b64a6))[_0xa637('0x29')](handleError(_0x27534d,null));};exports['show']=function(_0x22a1fc,_0x10e550){var _0x24cd6d={'raw':![],'where':{'id':_0x22a1fc[_0xa637('0x2a')]['id']}},_0x48aaaa={};_0x48aaaa[_0xa637('0x2b')]=_[_0xa637('0x2c')](db[_0xa637('0x20')][_0xa637('0x21')]);_0x48aaaa[_0xa637('0x26')]=_[_0xa637('0x2c')](_0x22a1fc['query']);_0x48aaaa['filters']=_[_0xa637('0x2d')](_0x48aaaa[_0xa637('0x2b')],_0x48aaaa[_0xa637('0x26')]);_0x24cd6d[_0xa637('0x2e')]=_['intersection'](_0x48aaaa['model'],qs[_0xa637('0x2f')](_0x22a1fc['query'][_0xa637('0x2f')]));_0x24cd6d['attributes']=_0x24cd6d[_0xa637('0x2e')]['length']?_0x24cd6d[_0xa637('0x2e')]:_0x48aaaa[_0xa637('0x2b')];if(_0x22a1fc[_0xa637('0x26')][_0xa637('0x30')]){_0x24cd6d[_0xa637('0x31')]=[{'all':!![]}];}_0x24cd6d=_[_0xa637('0x32')]({},_0x24cd6d,_0x22a1fc[_0xa637('0x33')]);return db[_0xa637('0x20')][_0xa637('0x34')](_0x24cd6d)[_0xa637('0x28')](handleEntityNotFound(_0x10e550,null))['then'](respondWithResult(_0x10e550,null))[_0xa637('0x29')](handleError(_0x10e550,null));};exports[_0xa637('0x35')]=function(_0x21f13d,_0x33c544){return db[_0xa637('0x20')][_0xa637('0x35')](_0x21f13d[_0xa637('0x36')],{})[_0xa637('0x28')](respondWithResult(_0x33c544,0xc9))['catch'](handleError(_0x33c544,null));};exports[_0xa637('0x1b')]=function(_0x1c94c7,_0x5a3855){if(_0x1c94c7[_0xa637('0x36')]['id']){delete _0x1c94c7[_0xa637('0x36')]['id'];}return db[_0xa637('0x20')][_0xa637('0x34')]({'where':{'id':_0x1c94c7[_0xa637('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5a3855,null))['then'](saveUpdates(_0x1c94c7[_0xa637('0x36')],null))[_0xa637('0x28')](respondWithResult(_0x5a3855,null))[_0xa637('0x29')](handleError(_0x5a3855,null));};exports[_0xa637('0x37')]=function(_0x42e44d,_0x12ec22){return db[_0xa637('0x20')]['find']({'where':{'id':_0x42e44d[_0xa637('0x2a')]['id']}})[_0xa637('0x28')](handleEntityNotFound(_0x12ec22,null))['then'](removeEntity(_0x12ec22,null))[_0xa637('0x29')](handleError(_0x12ec22,null));};exports[_0xa637('0x38')]=function(_0x4f1dce,_0x2ec755){return db[_0xa637('0x20')][_0xa637('0x38')]()[_0xa637('0x28')](respondWithResult(_0x2ec755,null))[_0xa637('0x29')](handleError(_0x2ec755,null));};exports[_0xa637('0x39')]=function(_0x39087f,_0x4df12f){return db['MailMessage'][_0xa637('0x34')]({'where':{'id':_0x39087f[_0xa637('0x2a')]['id']}})[_0xa637('0x28')](handleEntityNotFound(_0x4df12f,null))['then'](function(_0x1e2271){if(_0x1e2271){return _0x1e2271[_0xa637('0x39')](_0x39087f[_0xa637('0x36')][_0xa637('0x3a')],_[_0xa637('0x3b')](_0x39087f['body'],[_0xa637('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x4df12f,null))[_0xa637('0x29')](handleError(_0x4df12f,null));};exports[_0xa637('0x3c')]=function(_0xce4429,_0x13a128){var _0x24be77={'raw':![],'where':{}};var _0x43d84e={};var _0x4330b3={'count':0x0,'rows':[]};return db[_0xa637('0x20')][_0xa637('0x3d')]({'where':{'id':_0xce4429['params']['id']}})[_0xa637('0x28')](handleEntityNotFound(_0x13a128,null))[_0xa637('0x28')](function(_0xc16640){if(_0xc16640){_0x43d84e[_0xa637('0x2b')]=_[_0xa637('0x2c')](db[_0xa637('0x3e')]['rawAttributes']);_0x43d84e[_0xa637('0x26')]=_[_0xa637('0x2c')](_0xce4429[_0xa637('0x26')]);_0x43d84e[_0xa637('0x3f')]=_[_0xa637('0x2d')](_0x43d84e['model'],_0x43d84e[_0xa637('0x26')]);_0x24be77[_0xa637('0x2e')]=_[_0xa637('0x2d')](_0x43d84e['model'],qs[_0xa637('0x2f')](_0xce4429[_0xa637('0x26')][_0xa637('0x2f')]));_0x24be77[_0xa637('0x2e')]=_0x24be77[_0xa637('0x2e')]['length']?_0x24be77['attributes']:_0x43d84e[_0xa637('0x2b')];if(!_0xce4429[_0xa637('0x26')][_0xa637('0x40')]('nolimit')){_0x24be77['limit']=qs[_0xa637('0x18')](_0xce4429['query'][_0xa637('0x18')]);_0x24be77['offset']=qs[_0xa637('0x17')](_0xce4429[_0xa637('0x26')]['offset']);}_0x24be77['order']=qs[_0xa637('0x41')](_0xce4429[_0xa637('0x26')][_0xa637('0x41')]);_0x24be77[_0xa637('0x42')]=qs['filters'](_[_0xa637('0x43')](_0xce4429['query'],_0x43d84e[_0xa637('0x3f')]));_0x24be77['where']['MailInteractionId']=_0xc16640['id'];if(_0xce4429[_0xa637('0x26')][_0xa637('0x44')]){_0x24be77['where']=_[_0xa637('0x32')](_0x24be77['where'],{'$or':_[_0xa637('0x1f')](_0x24be77[_0xa637('0x2e')],function(_0x3de4b1){var _0x3c904d={};_0x3c904d[_0x3de4b1]={'$like':'%'+_0xce4429['query']['filter']+'%'};return _0x3c904d;})});}if(_0xce4429[_0xa637('0x26')][_0xa637('0x45')]){var _0x267c0c=_0xce4429['query'][_0xa637('0x45')][_0xa637('0x46')](',');var _0x28edb5={};_0x28edb5[_0x267c0c[0x0]]={'$gte':moment(_0x267c0c[0x1])[_0xa637('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x24be77[_0xa637('0x42')]=_[_0xa637('0x32')](_0x24be77[_0xa637('0x42')],_0x28edb5);}_0x24be77=_[_0xa637('0x32')]({},_0x24be77,_0xce4429['options']);return db[_0xa637('0x3e')][_0xa637('0x19')]({'where':_0x24be77[_0xa637('0x42')]})[_0xa637('0x28')](function(_0x1d3e7f){_0x4330b3[_0xa637('0x19')]=_0x1d3e7f;if(_0xce4429['query'][_0xa637('0x30')]){_0x24be77['include']=[{'all':!![]}];}return db[_0xa637('0x3e')]['findAll'](_0x24be77);})['then'](function(_0x1416f0){if(_0xce4429[_0xa637('0x26')]['inlineCss']===_0xa637('0x48')){for(var _0x28e4ca=0x0;_0x28e4ca<_0x1416f0[_0xa637('0x49')];_0x28e4ca++){_0x1416f0[_0x28e4ca][_0xa637('0x36')]=juice(_0x1416f0[_0x28e4ca][_0xa637('0x36')]);}}_0x4330b3[_0xa637('0x4a')]=_0x1416f0;return _0x4330b3;});}})['then'](respondWithFilteredResult(_0x13a128,_0x24be77))[_0xa637('0x29')](handleError(_0x13a128,null));};exports['addTags']=function(_0x9e6020,_0x53eeb4){return db['MailInteraction'][_0xa637('0x34')]({'where':{'id':_0x9e6020[_0xa637('0x2a')]['id']}})[_0xa637('0x28')](handleEntityNotFound(_0x53eeb4,null))[_0xa637('0x28')](function(_0x54a7b3){if(_0x54a7b3){return _0x54a7b3['setTags'](_0x9e6020['body']['ids'],_['omit'](_0x9e6020['body'],[_0xa637('0x3a'),'id'])||{})[_0xa637('0x4b')](function(){return db[_0xa637('0x4c')][_0xa637('0x4d')]({'attributes':['id',_0xa637('0x1d'),'color'],'where':{'id':_0x9e6020['body']['ids']}});})[_0xa637('0x28')](function(_0x1555b4){socket['emit'](_0xa637('0x4e'),{'id':Number(_0x9e6020[_0xa637('0x2a')]['id']),'tags':_0x1555b4||[]});return{'id':Number(_0x9e6020[_0xa637('0x2a')]['id']),'tags':_0x1555b4||[]};});}})[_0xa637('0x28')](respondWithResult(_0x53eeb4,null))[_0xa637('0x29')](handleError(_0x53eeb4,null));};exports[_0xa637('0x4f')]=function(_0x5e6884,_0x1a002a){return db[_0xa637('0x20')][_0xa637('0x34')]({'where':{'id':_0x5e6884['params']['id']}})[_0xa637('0x28')](handleEntityNotFound(_0x1a002a,null))['then'](function(_0x446724){if(_0x446724){return _0x446724[_0xa637('0x4f')](_0x5e6884['query'][_0xa637('0x3a')]);}})[_0xa637('0x28')](respondWithStatusCode(_0x1a002a,null))[_0xa637('0x29')](handleError(_0x1a002a,null));};exports[_0xa637('0x50')]=function(_0x4db631,_0x195482){var _0x4f83e7=moment()[_0xa637('0x51')]()[_0xa637('0x52')]();var _0x2e7e90=path[_0xa637('0x53')](config[_0xa637('0x54')],'server',_0xa637('0x55'),'tmp');var _0x5a7a47=path['join'](config[_0xa637('0x54')],'server','files',_0xa637('0x56'));var _0x500a74=path[_0xa637('0x53')](_0x2e7e90,_0x4f83e7);var _0xc8ec35=util['format'](_0xa637('0x57'),_0x4db631[_0xa637('0x2a')]['id'],_0x4f83e7);var _0x1f01f5=path[_0xa637('0x53')](_0x2e7e90,_0xc8ec35);var _0x242b59=[];if(_0x4db631[_0xa637('0x26')][_0xa637('0x56')]){_0x242b59[_0xa637('0x58')]({'model':db[_0xa637('0x59')],'as':_0xa637('0x5a'),'raw':!![]});}var _0x1c62a7=[{'model':db[_0xa637('0x3e')],'as':_0xa637('0x5b'),'attributes':['id',_0xa637('0x36'),_0xa637('0x5c'),'to','cc',_0xa637('0x5d'),_0xa637('0x5e'),'createdAt'],'where':{'secret':![]},'order':qs[_0xa637('0x41')]('id'),'include':_0x242b59}];return db[_0xa637('0x20')][_0xa637('0x34')]({'where':{'id':_0x4db631[_0xa637('0x2a')]['id']},'include':_0x1c62a7})['then'](handleEntityNotFound(_0x195482,null))[_0xa637('0x28')](function(_0x2c8336){if(_0x2c8336&&_0x2c8336[_0xa637('0x5b')]){var _0x145f92=_0x2c8336[_0xa637('0x5f')]({'plain':!![]});fs[_0xa637('0x60')](_0x500a74);return BPromise[_0xa637('0x61')](_0x145f92[_0xa637('0x5b')],function(_0x2d3b9e,_0x2ed93e){var _0xb05d3d={'from':_0x2d3b9e['from'],'to':_0x2d3b9e['to']||_0xa637('0x62'),'subject':_0x2d3b9e[_0xa637('0x5e')],'html':htmlEntities['decode'](_0x2d3b9e[_0xa637('0x36')]),'headers':{'Date':moment(_0x2d3b9e['createdAt'])['format'](_0xa637('0x63'))},'attachments':[]};if(_0x2d3b9e['cc']){_0xb05d3d[_0xa637('0x64')]['Cc']=_0x2d3b9e['cc'];}if(_0x2d3b9e[_0xa637('0x5d')]){_0xb05d3d['headers'][_0xa637('0x65')]=_0x2d3b9e[_0xa637('0x5d')];}return new BPromise(function(_0x8e6c19,_0x5e1264){if(_0x2d3b9e['Attachments']){for(var _0x37c00f=0x0;_0x37c00f<_0x2d3b9e['Attachments'][_0xa637('0x49')];_0x37c00f++){var _0xd1e4e=_0x2d3b9e[_0xa637('0x5a')][_0x37c00f];var _0x23e372=path[_0xa637('0x53')](_0x5a7a47,_0xd1e4e[_0xa637('0x66')]);if(fs[_0xa637('0x67')](_0x23e372)){_0xb05d3d[_0xa637('0x56')]['push']({'name':_0xd1e4e[_0xa637('0x1d')],'contentType':_0xd1e4e[_0xa637('0x23')],'data':fs[_0xa637('0x68')](_0x23e372)});}}}emlformat[_0xa637('0x69')](_0xb05d3d,function(_0x26af88,_0x565f3c){if(_0x26af88)return _0x5e1264(_0x26af88);fs['writeFileSync'](path['join'](_0x500a74,util[_0xa637('0x47')](_0xa637('0x6a'),_0x2ed93e)),_0x565f3c);return _0x8e6c19(_0x565f3c);});});})[_0xa637('0x28')](function(){return new BPromise(function(_0x144d72,_0x5d2438){zipdir(_0x500a74,{'saveTo':_0x1f01f5},function(_0x1d37b7,_0x3e25a0){if(_0x1d37b7)return _0x5d2438(_0x1d37b7);return _0x144d72(_0x3e25a0);});})[_0xa637('0x28')](function(){return new BPromise(function(_0x15558b,_0x51845d){rimraf(_0x500a74,function(_0x41d94a){if(_0x41d94a)_0x51845d(_0x41d94a);return _0x15558b();});});})[_0xa637('0x28')](function(){return _0x195482[_0xa637('0x50')](_0x1f01f5,_0xc8ec35,function(_0x297fbb){if(!_0x297fbb)fs[_0xa637('0x6b')](_0x1f01f5);});});});}else{return _0x195482[_0xa637('0x13')](0xc8);}})[_0xa637('0x29')](handleError(_0x195482,null));}; \ No newline at end of file +var _0x8e3b=['lodash','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','getOptions','findAll','mail','query','user','catch','show','params','keys','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','MailInteraction','body','describe','MailMessage','addMessage','omit','ids','filters','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','setTags','color','emit','removeTags','unix','toString','root','server','files','tmp','attachments','join','push','Attachment','Attachments','Messages','from','subject','get','mkdirSync','each','missing.recipient@your.company.com','decode','createdAt','bcc','headers','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path'];(function(_0x2577d9,_0x8f2f28){var _0x36fe58=function(_0xbba849){while(--_0xbba849){_0x2577d9['push'](_0x2577d9['shift']());}};_0x36fe58(++_0x8f2f28);}(_0x8e3b,0xdc));var _0xb8e3=function(_0x2f7892,_0x1c26c5){_0x2f7892=_0x2f7892-0x0;var _0x2f9e9c=_0x8e3b[_0x2f7892];return _0x2f9e9c;};'use strict';var emlformat=require(_0xb8e3('0x0'));var rimraf=require(_0xb8e3('0x1'));var zipdir=require(_0xb8e3('0x2'));var moment=require('moment');var BPromise=require(_0xb8e3('0x3'));var util=require(_0xb8e3('0x4'));var path=require(_0xb8e3('0x5'));var fs=require('fs');var _=require(_0xb8e3('0x6'));var juice=require(_0xb8e3('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xb8e3('0x8'));var logger=require(_0xb8e3('0x9'))(_0xb8e3('0xa'));var config=require('../../config/environment');var db=require(_0xb8e3('0xb'))['db'];var htmlEntities=require(_0xb8e3('0xc'));config[_0xb8e3('0xd')]=_['defaults'](config[_0xb8e3('0xd')],{'host':_0xb8e3('0xe'),'port':0x18eb});var socket=require(_0xb8e3('0xf'))(new Redis(config['redis']));require(_0xb8e3('0x10'))[_0xb8e3('0x11')](socket);function respondWithStatusCode(_0x32dda1,_0x119272){_0x119272=_0x119272||0xcc;return function(_0x4bb6d6){if(_0x4bb6d6){return _0x32dda1[_0xb8e3('0x12')](_0x119272);}return _0x32dda1[_0xb8e3('0x13')](_0x119272)[_0xb8e3('0x14')]();};}function respondWithResult(_0x228e65,_0xdc19a2){_0xdc19a2=_0xdc19a2||0xc8;return function(_0x1c0ef7){if(_0x1c0ef7){return _0x228e65[_0xb8e3('0x13')](_0xdc19a2)['json'](_0x1c0ef7);}};}function respondWithFilteredResult(_0x27e7f4,_0x121d03){return function(_0xa5211e){if(_0xa5211e){var _0x47d435=typeof _0x121d03['offset']===_0xb8e3('0x15')&&typeof _0x121d03[_0xb8e3('0x16')]===_0xb8e3('0x15');var _0x392c82=_0xa5211e[_0xb8e3('0x17')];var _0x165a17=_0x47d435?0x0:_0x121d03[_0xb8e3('0x18')];var _0x4886e9=_0x47d435?_0xa5211e[_0xb8e3('0x17')]:_0x121d03['offset']+_0x121d03['limit'];var _0x4f584b;if(_0x4886e9>=_0x392c82){_0x4886e9=_0x392c82;_0x4f584b=0xc8;}else{_0x4f584b=0xce;}_0x27e7f4[_0xb8e3('0x13')](_0x4f584b);return _0x27e7f4[_0xb8e3('0x19')](_0xb8e3('0x1a'),_0x165a17+'-'+_0x4886e9+'/'+_0x392c82)[_0xb8e3('0x1b')](_0xa5211e);}return null;};}function saveUpdates(_0x29bd85){return function(_0x47100c){if(_0x47100c){return _0x47100c[_0xb8e3('0x1c')](_0x29bd85)[_0xb8e3('0x1d')](function(_0x4cc7c0){return _0x4cc7c0;});}return null;};}function removeEntity(_0x5559c3){return function(_0x5527d7){if(_0x5527d7){return _0x5527d7[_0xb8e3('0x1e')]()[_0xb8e3('0x1d')](function(){_0x5559c3[_0xb8e3('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x417f57){return function(_0x4d227d){if(!_0x4d227d){_0x417f57[_0xb8e3('0x12')](0x194);}return _0x4d227d;};}function handleError(_0x3c1092,_0x484723){_0x484723=_0x484723||0x1f4;return function(_0x4bccd8){logger[_0xb8e3('0x1f')](_0x4bccd8[_0xb8e3('0x20')]);if(_0x4bccd8['name']){delete _0x4bccd8[_0xb8e3('0x21')];}_0x3c1092[_0xb8e3('0x13')](_0x484723)['send'](_0x4bccd8);};}exports[_0xb8e3('0x22')]=function(_0x4a13fb,_0x43bbe0){var _0x18ccfd={};var _0x4afeb9=_[_0xb8e3('0x23')](db['MailInteraction'][_0xb8e3('0x24')],function(_0xe4b0c6){return{'name':_0xe4b0c6[_0xb8e3('0x25')],'type':_0xe4b0c6[_0xb8e3('0x26')]['key']};});_0x18ccfd=qs[_0xb8e3('0x27')](_0x4afeb9,_0x4a13fb);return interaction[_0xb8e3('0x28')](_0xb8e3('0x29'),_0x4a13fb[_0xb8e3('0x2a')],_0x4a13fb[_0xb8e3('0x2b')],_0x18ccfd,_0x4afeb9)[_0xb8e3('0x1d')](respondWithFilteredResult(_0x43bbe0,_0x18ccfd))[_0xb8e3('0x2c')](handleError(_0x43bbe0,null));};exports[_0xb8e3('0x2d')]=function(_0x158548,_0x244631){var _0x35cd7a={'raw':![],'where':{'id':_0x158548[_0xb8e3('0x2e')]['id']}},_0x5c986a={};_0x5c986a['model']=_['keys'](db['MailInteraction'][_0xb8e3('0x24')]);_0x5c986a[_0xb8e3('0x2a')]=_[_0xb8e3('0x2f')](_0x158548['query']);_0x5c986a['filters']=_[_0xb8e3('0x30')](_0x5c986a[_0xb8e3('0x31')],_0x5c986a[_0xb8e3('0x2a')]);_0x35cd7a[_0xb8e3('0x32')]=_[_0xb8e3('0x30')](_0x5c986a[_0xb8e3('0x31')],qs[_0xb8e3('0x33')](_0x158548[_0xb8e3('0x2a')][_0xb8e3('0x33')]));_0x35cd7a[_0xb8e3('0x32')]=_0x35cd7a[_0xb8e3('0x32')][_0xb8e3('0x34')]?_0x35cd7a[_0xb8e3('0x32')]:_0x5c986a[_0xb8e3('0x31')];if(_0x158548[_0xb8e3('0x2a')][_0xb8e3('0x35')]){_0x35cd7a[_0xb8e3('0x36')]=[{'all':!![]}];}_0x35cd7a=_[_0xb8e3('0x37')]({},_0x35cd7a,_0x158548[_0xb8e3('0x38')]);return db['MailInteraction'][_0xb8e3('0x39')](_0x35cd7a)[_0xb8e3('0x1d')](handleEntityNotFound(_0x244631,null))['then'](respondWithResult(_0x244631,null))['catch'](handleError(_0x244631,null));};exports[_0xb8e3('0x3a')]=function(_0x39aa75,_0x1c7c02){return db[_0xb8e3('0x3b')][_0xb8e3('0x3a')](_0x39aa75[_0xb8e3('0x3c')],{})[_0xb8e3('0x1d')](respondWithResult(_0x1c7c02,0xc9))[_0xb8e3('0x2c')](handleError(_0x1c7c02,null));};exports[_0xb8e3('0x1c')]=function(_0x452882,_0x105296){if(_0x452882[_0xb8e3('0x3c')]['id']){delete _0x452882[_0xb8e3('0x3c')]['id'];}return db[_0xb8e3('0x3b')][_0xb8e3('0x39')]({'where':{'id':_0x452882[_0xb8e3('0x2e')]['id']}})[_0xb8e3('0x1d')](handleEntityNotFound(_0x105296,null))[_0xb8e3('0x1d')](saveUpdates(_0x452882[_0xb8e3('0x3c')],null))[_0xb8e3('0x1d')](respondWithResult(_0x105296,null))[_0xb8e3('0x2c')](handleError(_0x105296,null));};exports[_0xb8e3('0x1e')]=function(_0x1f45f5,_0x1e09d2){return db[_0xb8e3('0x3b')][_0xb8e3('0x39')]({'where':{'id':_0x1f45f5['params']['id']}})[_0xb8e3('0x1d')](handleEntityNotFound(_0x1e09d2,null))['then'](removeEntity(_0x1e09d2,null))[_0xb8e3('0x2c')](handleError(_0x1e09d2,null));};exports['describe']=function(_0xce1c0f,_0x96012d){return db['MailInteraction'][_0xb8e3('0x3d')]()[_0xb8e3('0x1d')](respondWithResult(_0x96012d,null))[_0xb8e3('0x2c')](handleError(_0x96012d,null));};exports['addMessage']=function(_0x2b5d8d,_0x507c87){return db[_0xb8e3('0x3e')][_0xb8e3('0x39')]({'where':{'id':_0x2b5d8d[_0xb8e3('0x2e')]['id']}})[_0xb8e3('0x1d')](handleEntityNotFound(_0x507c87,null))[_0xb8e3('0x1d')](function(_0x349610){if(_0x349610){return _0x349610[_0xb8e3('0x3f')](_0x2b5d8d[_0xb8e3('0x3c')]['ids'],_[_0xb8e3('0x40')](_0x2b5d8d['body'],[_0xb8e3('0x41'),'id'])||{});}})[_0xb8e3('0x1d')](respondWithResult(_0x507c87,null))[_0xb8e3('0x2c')](handleError(_0x507c87,null));};exports['getMessages']=function(_0x2f50d7,_0x3aab39){var _0x43d8d6={'raw':![],'where':{}};var _0xbdf0={};var _0x4078f1={'count':0x0,'rows':[]};return db[_0xb8e3('0x3b')]['findOne']({'where':{'id':_0x2f50d7[_0xb8e3('0x2e')]['id']}})[_0xb8e3('0x1d')](handleEntityNotFound(_0x3aab39,null))[_0xb8e3('0x1d')](function(_0x103155){if(_0x103155){_0xbdf0[_0xb8e3('0x31')]=_[_0xb8e3('0x2f')](db[_0xb8e3('0x3e')][_0xb8e3('0x24')]);_0xbdf0[_0xb8e3('0x2a')]=_[_0xb8e3('0x2f')](_0x2f50d7[_0xb8e3('0x2a')]);_0xbdf0[_0xb8e3('0x42')]=_[_0xb8e3('0x30')](_0xbdf0[_0xb8e3('0x31')],_0xbdf0[_0xb8e3('0x2a')]);_0x43d8d6[_0xb8e3('0x32')]=_[_0xb8e3('0x30')](_0xbdf0[_0xb8e3('0x31')],qs[_0xb8e3('0x33')](_0x2f50d7['query'][_0xb8e3('0x33')]));_0x43d8d6[_0xb8e3('0x32')]=_0x43d8d6[_0xb8e3('0x32')][_0xb8e3('0x34')]?_0x43d8d6[_0xb8e3('0x32')]:_0xbdf0['model'];if(!_0x2f50d7[_0xb8e3('0x2a')][_0xb8e3('0x43')](_0xb8e3('0x44'))){_0x43d8d6[_0xb8e3('0x16')]=qs['limit'](_0x2f50d7['query'][_0xb8e3('0x16')]);_0x43d8d6[_0xb8e3('0x18')]=qs[_0xb8e3('0x18')](_0x2f50d7['query'][_0xb8e3('0x18')]);}_0x43d8d6[_0xb8e3('0x45')]=qs[_0xb8e3('0x46')](_0x2f50d7[_0xb8e3('0x2a')]['sort']);_0x43d8d6[_0xb8e3('0x47')]=qs[_0xb8e3('0x42')](_[_0xb8e3('0x48')](_0x2f50d7[_0xb8e3('0x2a')],_0xbdf0[_0xb8e3('0x42')]));_0x43d8d6['where'][_0xb8e3('0x49')]=_0x103155['id'];if(_0x2f50d7[_0xb8e3('0x2a')][_0xb8e3('0x4a')]){_0x43d8d6[_0xb8e3('0x47')]=_['merge'](_0x43d8d6['where'],{'$or':_[_0xb8e3('0x23')](_0x43d8d6['attributes'],function(_0x1ba7a3){var _0x131b57={};_0x131b57[_0x1ba7a3]={'$like':'%'+_0x2f50d7[_0xb8e3('0x2a')][_0xb8e3('0x4a')]+'%'};return _0x131b57;})});}if(_0x2f50d7[_0xb8e3('0x2a')][_0xb8e3('0x4b')]){var _0x1ea325=_0x2f50d7[_0xb8e3('0x2a')][_0xb8e3('0x4b')][_0xb8e3('0x4c')](',');var _0x3d344e={};_0x3d344e[_0x1ea325[0x0]]={'$gte':moment(_0x1ea325[0x1])[_0xb8e3('0x4d')](_0xb8e3('0x4e'))};_0x43d8d6['where']=_[_0xb8e3('0x37')](_0x43d8d6[_0xb8e3('0x47')],_0x3d344e);}_0x43d8d6=_[_0xb8e3('0x37')]({},_0x43d8d6,_0x2f50d7['options']);return db[_0xb8e3('0x3e')]['count']({'where':_0x43d8d6[_0xb8e3('0x47')]})['then'](function(_0x42d02f){_0x4078f1[_0xb8e3('0x17')]=_0x42d02f;if(_0x2f50d7[_0xb8e3('0x2a')][_0xb8e3('0x35')]){_0x43d8d6['include']=[{'all':!![]}];}return db[_0xb8e3('0x3e')][_0xb8e3('0x28')](_0x43d8d6);})[_0xb8e3('0x1d')](function(_0x1c1bd0){if(_0x2f50d7[_0xb8e3('0x2a')][_0xb8e3('0x4f')]==='true'){for(var _0x2acf3d=0x0;_0x2acf3d<_0x1c1bd0[_0xb8e3('0x34')];_0x2acf3d++){_0x1c1bd0[_0x2acf3d]['body']=juice(_0x1c1bd0[_0x2acf3d]['body']);}}_0x4078f1[_0xb8e3('0x50')]=_0x1c1bd0;return _0x4078f1;});}})['then'](respondWithFilteredResult(_0x3aab39,_0x43d8d6))[_0xb8e3('0x2c')](handleError(_0x3aab39,null));};exports['addTags']=function(_0x2bc890,_0x4ee9af){return db[_0xb8e3('0x3b')]['find']({'where':{'id':_0x2bc890[_0xb8e3('0x2e')]['id']}})[_0xb8e3('0x1d')](handleEntityNotFound(_0x4ee9af,null))[_0xb8e3('0x1d')](function(_0x34612e){if(_0x34612e){return _0x34612e[_0xb8e3('0x51')](_0x2bc890['body'][_0xb8e3('0x41')],_['omit'](_0x2bc890[_0xb8e3('0x3c')],[_0xb8e3('0x41'),'id'])||{})['spread'](function(){return db['Tag'][_0xb8e3('0x28')]({'attributes':['id',_0xb8e3('0x21'),_0xb8e3('0x52')],'where':{'id':_0x2bc890[_0xb8e3('0x3c')][_0xb8e3('0x41')]}});})[_0xb8e3('0x1d')](function(_0x3a8106){socket[_0xb8e3('0x53')]('mailInteractionTags:save',{'id':Number(_0x2bc890[_0xb8e3('0x2e')]['id']),'tags':_0x3a8106||[]});return{'id':Number(_0x2bc890[_0xb8e3('0x2e')]['id']),'tags':_0x3a8106||[]};});}})['then'](respondWithResult(_0x4ee9af,null))[_0xb8e3('0x2c')](handleError(_0x4ee9af,null));};exports[_0xb8e3('0x54')]=function(_0x43b498,_0xe4d9fd){return db[_0xb8e3('0x3b')]['find']({'where':{'id':_0x43b498[_0xb8e3('0x2e')]['id']}})[_0xb8e3('0x1d')](handleEntityNotFound(_0xe4d9fd,null))['then'](function(_0x4735e4){if(_0x4735e4){return _0x4735e4[_0xb8e3('0x54')](_0x43b498[_0xb8e3('0x2a')][_0xb8e3('0x41')]);}})[_0xb8e3('0x1d')](respondWithStatusCode(_0xe4d9fd,null))[_0xb8e3('0x2c')](handleError(_0xe4d9fd,null));};exports['download']=function(_0x14f6c8,_0x473f11){var _0x216ac0=moment()[_0xb8e3('0x55')]()[_0xb8e3('0x56')]();var _0x172663=path['join'](config[_0xb8e3('0x57')],_0xb8e3('0x58'),_0xb8e3('0x59'),_0xb8e3('0x5a'));var _0x262b12=path['join'](config['root'],_0xb8e3('0x58'),'files',_0xb8e3('0x5b'));var _0x326e4c=path[_0xb8e3('0x5c')](_0x172663,_0x216ac0);var _0x1ecfbf=util[_0xb8e3('0x4d')]('transcript-%d-%s.zip',_0x14f6c8['params']['id'],_0x216ac0);var _0x107630=path[_0xb8e3('0x5c')](_0x172663,_0x1ecfbf);var _0x4e27cb=[];if(_0x14f6c8['query'][_0xb8e3('0x5b')]){_0x4e27cb[_0xb8e3('0x5d')]({'model':db[_0xb8e3('0x5e')],'as':_0xb8e3('0x5f'),'raw':!![]});}var _0x57dfb3=[{'model':db[_0xb8e3('0x3e')],'as':_0xb8e3('0x60'),'attributes':['id',_0xb8e3('0x3c'),_0xb8e3('0x61'),'to','cc','bcc',_0xb8e3('0x62'),'createdAt'],'where':{'secret':![]},'order':qs[_0xb8e3('0x46')]('id'),'include':_0x4e27cb}];return db[_0xb8e3('0x3b')][_0xb8e3('0x39')]({'where':{'id':_0x14f6c8['params']['id']},'include':_0x57dfb3})[_0xb8e3('0x1d')](handleEntityNotFound(_0x473f11,null))['then'](function(_0x1f0686){if(_0x1f0686&&_0x1f0686[_0xb8e3('0x60')]){var _0x2760ea=_0x1f0686[_0xb8e3('0x63')]({'plain':!![]});fs[_0xb8e3('0x64')](_0x326e4c);return BPromise[_0xb8e3('0x65')](_0x2760ea[_0xb8e3('0x60')],function(_0x579ec3,_0x257e95){var _0x3be85a={'from':_0x579ec3[_0xb8e3('0x61')],'to':_0x579ec3['to']||_0xb8e3('0x66'),'subject':_0x579ec3['subject'],'html':htmlEntities[_0xb8e3('0x67')](_0x579ec3[_0xb8e3('0x3c')]),'headers':{'Date':moment(_0x579ec3[_0xb8e3('0x68')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x579ec3['cc']){_0x3be85a['headers']['Cc']=_0x579ec3['cc'];}if(_0x579ec3[_0xb8e3('0x69')]){_0x3be85a[_0xb8e3('0x6a')][_0xb8e3('0x6b')]=_0x579ec3[_0xb8e3('0x69')];}return new BPromise(function(_0x5488b7,_0x438312){if(_0x579ec3[_0xb8e3('0x5f')]){for(var _0x4642c4=0x0;_0x4642c4<_0x579ec3[_0xb8e3('0x5f')][_0xb8e3('0x34')];_0x4642c4++){var _0x305037=_0x579ec3[_0xb8e3('0x5f')][_0x4642c4];var _0xf1f4b5=path[_0xb8e3('0x5c')](_0x262b12,_0x305037[_0xb8e3('0x6c')]);if(fs[_0xb8e3('0x6d')](_0xf1f4b5)){_0x3be85a['attachments'][_0xb8e3('0x5d')]({'name':_0x305037['name'],'contentType':_0x305037[_0xb8e3('0x26')],'data':fs['readFileSync'](_0xf1f4b5)});}}}emlformat[_0xb8e3('0x6e')](_0x3be85a,function(_0x1f10d1,_0x473994){if(_0x1f10d1)return _0x438312(_0x1f10d1);fs['writeFileSync'](path[_0xb8e3('0x5c')](_0x326e4c,util[_0xb8e3('0x4d')](_0xb8e3('0x6f'),_0x257e95)),_0x473994);return _0x5488b7(_0x473994);});});})[_0xb8e3('0x1d')](function(){return new BPromise(function(_0x1c8b89,_0x1b2898){zipdir(_0x326e4c,{'saveTo':_0x107630},function(_0x2565f7,_0x1fb459){if(_0x2565f7)return _0x1b2898(_0x2565f7);return _0x1c8b89(_0x1fb459);});})[_0xb8e3('0x1d')](function(){return new BPromise(function(_0x5962a4,_0xc415c){rimraf(_0x326e4c,function(_0x5eb67b){if(_0x5eb67b)_0xc415c(_0x5eb67b);return _0x5962a4();});});})['then'](function(){return _0x473f11['download'](_0x107630,_0x1ecfbf,function(_0x4bcba3){if(!_0x4bcba3)fs[_0xb8e3('0x70')](_0x107630);});});});}else{return _0x473f11[_0xb8e3('0x12')](0xc8);}})['catch'](handleError(_0x473f11,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d6db8be..8a40e0a 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 _0xd648=['events','../../mysqldb','MailInteraction','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','exports'];(function(_0x1a0cda,_0x302fe1){var _0x4d2dca=function(_0x193849){while(--_0x193849){_0x1a0cda['push'](_0x1a0cda['shift']());}};_0x4d2dca(++_0x302fe1);}(_0xd648,0x9a));var _0x8d64=function(_0x5d9caf,_0x467f88){_0x5d9caf=_0x5d9caf-0x0;var _0x36a9db=_0xd648[_0x5d9caf];return _0x36a9db;};'use strict';var EventEmitter=require(_0x8d64('0x0'));var MailInteraction=require(_0x8d64('0x1'))['db'][_0x8d64('0x2')];var MailMessage=require(_0x8d64('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x425a14){return function(_0x30ac39,_0x20e236,_0xd3cdc8){_0x30ac39[_0x8d64('0x3')]({'attributes':['id'],'raw':!![]})[_0x8d64('0x4')](function(_0x7abbc3){_0x30ac39[_0x8d64('0x5')](_0x8d64('0x6'),_0x7abbc3[_0x8d64('0x7')](function(_0x2b3c52){return{'id':_0x2b3c52['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x30ac39['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3b9f96){_0x30ac39['setDataValue'](_0x8d64('0x8'),_0x3b9f96[_0x8d64('0x9')]);MailInteractionEvents[_0x8d64('0xa')](_0x425a14+':'+_0x30ac39['id'],_0x30ac39);MailInteractionEvents[_0x8d64('0xa')](_0x425a14,_0x30ac39);_0xd3cdc8(null);})[_0x8d64('0xb')](_0xd3cdc8(null));};}for(var e in events){if(events[_0x8d64('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x8d64('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0x57bd=['../../mysqldb','MailInteraction','MailMessage','update','getUsers','then','setDataValue','Users','findAll','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x542549,_0xe44fb1){var _0x66d6df=function(_0x533e7e){while(--_0x533e7e){_0x542549['push'](_0x542549['shift']());}};_0x66d6df(++_0xe44fb1);}(_0x57bd,0x185));var _0xd57b=function(_0x504314,_0x45fd2a){_0x504314=_0x504314-0x0;var _0xf9f9c0=_0x57bd[_0x504314];return _0xf9f9c0;};'use strict';var EventEmitter=require(_0xd57b('0x0'));var MailInteraction=require(_0xd57b('0x1'))['db'][_0xd57b('0x2')];var MailMessage=require(_0xd57b('0x1'))['db'][_0xd57b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd57b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4593e0){return function(_0x233b4a,_0x46a309,_0xf92d25){_0x233b4a[_0xd57b('0x5')]({'attributes':['id'],'raw':!![]})[_0xd57b('0x6')](function(_0x5b7c8c){_0x233b4a[_0xd57b('0x7')](_0xd57b('0x8'),_0x5b7c8c['map'](function(_0x213bb5){return{'id':_0x213bb5['id']};}));return MailMessage[_0xd57b('0x9')]({'where':{'MailInteractionId':_0x233b4a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd57b('0x6')](function(_0x13335d){_0x233b4a['setDataValue']('unreadMessages',_0x13335d['length']);MailInteractionEvents[_0xd57b('0xa')](_0x4593e0+':'+_0x233b4a['id'],_0x233b4a);MailInteractionEvents[_0xd57b('0xa')](_0x4593e0,_0x233b4a);_0xf92d25(null);})[_0xd57b('0xb')](_0xf92d25(null));};}for(var e in events){if(events[_0xd57b('0xc')](e)){var event=events[e];MailInteraction[_0xd57b('0xd')](e,emitEvent(event));}}module[_0xd57b('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a11a31c..1890edb 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 _0x1911=['then','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','get','MailMessage'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1911,0x12c));var _0x1191=function(_0x21ac06,_0x40dd86){_0x21ac06=_0x21ac06-0x0;var _0x327865=_0x1911[_0x21ac06];return _0x327865;};'use strict';var _=require(_0x1191('0x0'));var util=require(_0x1191('0x1'));var logger=require(_0x1191('0x2'))(_0x1191('0x3'));var moment=require(_0x1191('0x4'));var BPromise=require(_0x1191('0x5'));var rp=require(_0x1191('0x6'));var fs=require('fs');var path=require(_0x1191('0x7'));var rimraf=require(_0x1191('0x8'));var config=require(_0x1191('0x9'));var attributes=require(_0x1191('0xa'));module['exports']=function(_0x11d4ae,_0x587d12){return _0x11d4ae[_0x1191('0xb')](_0x1191('0xc'),attributes,{'tableName':_0x1191('0xd'),'paranoid':![],'indexes':[{'name':_0x1191('0xe'),'fields':['subject','to'],'type':_0x1191('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4cfc80,_0x190ef9,_0x3e05d1){if(_0x4cfc80[_0x1191('0x10')]){_0x4cfc80[_0x1191('0x11')]=moment()[_0x1191('0x12')](_0x1191('0x13'));}if(_0x4cfc80[_0x1191('0x14')]){_0x4cfc80[_0x1191('0x15')]=moment()[_0x1191('0x12')](_0x1191('0x13'));}_0x3e05d1(null,_0x190ef9);},'beforeUpdate':function(_0x5c991d,_0x594a74,_0x42e82e){if(_0x5c991d['changed'](_0x1191('0x10'))){_0x5c991d['substatusAt']=_0x5c991d[_0x1191('0x10')]?moment()[_0x1191('0x12')](_0x1191('0x13')):null;}if(_0x5c991d['changed'](_0x1191('0x14'))){_0x5c991d[_0x1191('0x15')]=moment()[_0x1191('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c991d[_0x1191('0x10')]=null;_0x5c991d[_0x1191('0x11')]=null;}_0x42e82e(null,_0x5c991d);},'afterUpdate':function(_0x28ce26,_0x392b39,_0x1770f5){var _0x56a95b=_0x11d4ae['models'];var _0x188d4c=_0x28ce26[_0x1191('0x16')]({'plain':!![]});if(_0x188d4c[_0x1191('0x14')]){return _0x56a95b[_0x1191('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x188d4c['id']}})[_0x1191('0x18')](function(){_0x1770f5();})[_0x1191('0x19')](function(_0x314b03){_0x1770f5(_0x314b03);});}else{_0x1770f5();}}},'charset':_0x1191('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8abe=['YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','models','get','MailMessage','update','catch','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','format','closed'];(function(_0x265da3,_0x51c58c){var _0x43842f=function(_0x47ada9){while(--_0x47ada9){_0x265da3['push'](_0x265da3['shift']());}};_0x43842f(++_0x51c58c);}(_0x8abe,0x80));var _0xe8ab=function(_0xbd0ebe,_0x2c0cc3){_0xbd0ebe=_0xbd0ebe-0x0;var _0x32342c=_0x8abe[_0xbd0ebe];return _0x32342c;};'use strict';var _=require('lodash');var util=require(_0xe8ab('0x0'));var logger=require('../../config/logger')(_0xe8ab('0x1'));var moment=require(_0xe8ab('0x2'));var BPromise=require(_0xe8ab('0x3'));var rp=require(_0xe8ab('0x4'));var fs=require('fs');var path=require(_0xe8ab('0x5'));var rimraf=require('rimraf');var config=require(_0xe8ab('0x6'));var attributes=require('./mailInteraction.attributes');module[_0xe8ab('0x7')]=function(_0x3bf3f6,_0x54a572){return _0x3bf3f6[_0xe8ab('0x8')](_0xe8ab('0x9'),attributes,{'tableName':_0xe8ab('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0xe8ab('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x549a2e,_0x4371e1,_0x5df535){if(_0x549a2e[_0xe8ab('0xc')]){_0x549a2e[_0xe8ab('0xd')]=moment()[_0xe8ab('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x549a2e[_0xe8ab('0xf')]){_0x549a2e['closedAt']=moment()[_0xe8ab('0xe')](_0xe8ab('0x10'));}_0x5df535(null,_0x4371e1);},'beforeUpdate':function(_0x4360da,_0xa73d6d,_0x424db6){if(_0x4360da[_0xe8ab('0x11')](_0xe8ab('0xc'))){_0x4360da['substatusAt']=_0x4360da[_0xe8ab('0xc')]?moment()[_0xe8ab('0xe')](_0xe8ab('0x10')):null;}if(_0x4360da['changed']('closed')){_0x4360da[_0xe8ab('0x12')]=moment()[_0xe8ab('0xe')](_0xe8ab('0x10'));_0x4360da[_0xe8ab('0xc')]=null;_0x4360da['substatusAt']=null;}_0x424db6(null,_0x4360da);},'afterUpdate':function(_0x9a01c5,_0xf638ec,_0x3491cc){var _0x4665cb=_0x3bf3f6[_0xe8ab('0x13')];var _0x3ffba9=_0x9a01c5[_0xe8ab('0x14')]({'plain':!![]});if(_0x3ffba9[_0xe8ab('0xf')]){return _0x4665cb[_0xe8ab('0x15')][_0xe8ab('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x3ffba9['id']}})['then'](function(){_0x3491cc();})[_0xe8ab('0x17')](function(_0x2ab9c1){_0x3491cc(_0x2ab9c1);});}else{_0x3491cc();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index df4e59d..45bd355 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 _0x3c21=['result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','body','omit','ids','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5cbdeb,_0x54a8fd){var _0x5bbbb1=function(_0x5a099d){while(--_0x5a099d){_0x5cbdeb['push'](_0x5cbdeb['shift']());}};_0x5bbbb1(++_0x54a8fd);}(_0x3c21,0x19e));var _0x13c2=function(_0x2a23e6,_0x1781f3){_0x2a23e6=_0x2a23e6-0x0;var _0x13abb2=_0x3c21[_0x2a23e6];return _0x13abb2;};'use strict';var _=require('lodash');var util=require(_0x13c2('0x0'));var moment=require('moment');var BPromise=require(_0x13c2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c2('0x2'));var db=require(_0x13c2('0x3'))['db'];var utils=require(_0x13c2('0x4'));var logger=require(_0x13c2('0x5'))('rpc');var config=require(_0x13c2('0x6'));var jayson=require(_0x13c2('0x7'));var client=jayson[_0x13c2('0x8')][_0x13c2('0x9')]({'port':0x232a});config[_0x13c2('0xa')]=_[_0x13c2('0xb')](config[_0x13c2('0xa')],{'host':_0x13c2('0xc'),'port':0x18eb});var socket=require(_0x13c2('0xd'))(new Redis(config[_0x13c2('0xa')]));require(_0x13c2('0xe'))[_0x13c2('0xf')](socket);function respondWithRpcPromise(_0x2798fd,_0x56d82b,_0x5de0f9){return new BPromise(function(_0x48969a,_0x520710){return client[_0x13c2('0x10')](_0x2798fd,_0x5de0f9)['then'](function(_0x3b7e96){logger[_0x13c2('0x11')](_0x13c2('0x12'),_0x56d82b,_0x13c2('0x13'));logger[_0x13c2('0x14')](_0x13c2('0x15'),_0x56d82b,_0x13c2('0x13'),JSON[_0x13c2('0x16')](_0x3b7e96));if(_0x3b7e96[_0x13c2('0x17')]){if(_0x3b7e96[_0x13c2('0x17')][_0x13c2('0x18')]===0x1f4){logger['error'](_0x13c2('0x12'),_0x56d82b,_0x3b7e96['error'][_0x13c2('0x19')]);return _0x520710(_0x3b7e96[_0x13c2('0x17')]['message']);}logger[_0x13c2('0x17')](_0x13c2('0x12'),_0x56d82b,_0x3b7e96['error'][_0x13c2('0x19')]);return _0x48969a(_0x3b7e96['error'][_0x13c2('0x19')]);}else{logger[_0x13c2('0x11')](_0x13c2('0x12'),_0x56d82b,_0x13c2('0x13'));_0x48969a(_0x3b7e96[_0x13c2('0x1a')][_0x13c2('0x19')]);}})[_0x13c2('0x1b')](function(_0x26a756){logger[_0x13c2('0x17')]('MailInteraction,\x20%s,\x20%s',_0x56d82b,_0x26a756);_0x520710(_0x26a756);});});}exports[_0x13c2('0x1c')]=function(_0x31ed09){var _0x53baff=this;return new Promise(function(_0x2bef69,_0x5aa153){return db[_0x13c2('0x1d')][_0x13c2('0x1e')](_0x31ed09['body'],{'raw':_0x31ed09[_0x13c2('0x1f')]?_0x31ed09[_0x13c2('0x1f')][_0x13c2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31ed09['options']?_0x31ed09[_0x13c2('0x1f')][_0x13c2('0x21')]||null:null,'attributes':_0x31ed09[_0x13c2('0x1f')]?_0x31ed09[_0x13c2('0x1f')][_0x13c2('0x22')]||null:null,'limit':_0x31ed09['options']?_0x31ed09['options'][_0x13c2('0x23')]||null:null})['then'](function(_0x4294f2){logger[_0x13c2('0x11')]('UpdateMailInteraction',_0x31ed09);logger[_0x13c2('0x14')](_0x13c2('0x1c'),_0x31ed09,JSON[_0x13c2('0x16')](_0x4294f2));_0x2bef69(_0x4294f2);})[_0x13c2('0x1b')](function(_0x2ac497){logger[_0x13c2('0x17')](_0x13c2('0x1c'),_0x2ac497[_0x13c2('0x19')],_0x31ed09);_0x5aa153(_0x53baff[_0x13c2('0x17')](0x1f4,_0x2ac497[_0x13c2('0x19')]));});});};exports[_0x13c2('0x24')]=function(_0x1ac1d6){return new Promise(function(_0x35b788,_0x432d82){return db[_0x13c2('0x1d')][_0x13c2('0x25')]({'where':_0x1ac1d6['options']?_0x1ac1d6[_0x13c2('0x1f')][_0x13c2('0x21')]||null:null})['then'](function(_0xbe8d97){if(_0xbe8d97){return _0xbe8d97[_0x13c2('0x26')](_0x1ac1d6[_0x13c2('0x27')]['ids'],_[_0x13c2('0x28')](_0x1ac1d6['body'],[_0x13c2('0x29'),'id'])||{});}})[_0x13c2('0x2a')](function(_0x58279d){logger[_0x13c2('0x11')](_0x13c2('0x2b'),_0x1ac1d6);logger[_0x13c2('0x14')](_0x13c2('0x2b'),_0x1ac1d6,JSON['stringify'](_0x58279d));_0x35b788(_0x58279d);})[_0x13c2('0x1b')](function(_0x31685c){logger[_0x13c2('0x17')](_0x13c2('0x2b'),_0x31685c[_0x13c2('0x19')],_0x1ac1d6);_0x432d82(_this[_0x13c2('0x17')](0x1f4,_0x31685c[_0x13c2('0x19')]));});});}; \ No newline at end of file +var _0x1203=['UpdateMailInteraction','find','addTags','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailInteraction','body','options','raw','where','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1203,0x8c));var _0x3120=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});config[_0x3120('0xe')]=_[_0x3120('0xf')](config['redis'],{'host':_0x3120('0x10'),'port':0x18eb});var socket=require(_0x3120('0x11'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x6ee01b,_0x39f834,_0x5b2ae3){return new BPromise(function(_0x1493fd,_0x5d0ba8){return client[_0x3120('0x12')](_0x6ee01b,_0x5b2ae3)[_0x3120('0x13')](function(_0x492cda){logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,'request\x20sent');logger['debug'](_0x3120('0x16'),_0x39f834,_0x3120('0x17'),JSON[_0x3120('0x18')](_0x492cda));if(_0x492cda[_0x3120('0x19')]){if(_0x492cda[_0x3120('0x19')][_0x3120('0x1a')]===0x1f4){logger[_0x3120('0x19')]('MailInteraction,\x20%s,\x20%s',_0x39f834,_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);return _0x5d0ba8(_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);}logger[_0x3120('0x19')](_0x3120('0x15'),_0x39f834,_0x492cda[_0x3120('0x19')]['message']);return _0x1493fd(_0x492cda[_0x3120('0x19')]['message']);}else{logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,_0x3120('0x17'));_0x1493fd(_0x492cda[_0x3120('0x1c')][_0x3120('0x1b')]);}})[_0x3120('0x1d')](function(_0x50429){logger['error'](_0x3120('0x15'),_0x39f834,_0x50429);_0x5d0ba8(_0x50429);});});}exports['UpdateMailInteraction']=function(_0x3b7e31){var _0x41d73f=this;return new Promise(function(_0x3bc524,_0x5bfd37){return db[_0x3120('0x1e')]['update'](_0x3b7e31[_0x3120('0x1f')],{'raw':_0x3b7e31[_0x3120('0x20')]?_0x3b7e31['options'][_0x3120('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b7e31[_0x3120('0x20')]?_0x3b7e31[_0x3120('0x20')][_0x3120('0x22')]||null:null,'attributes':_0x3b7e31['options']?_0x3b7e31[_0x3120('0x20')]['attributes']||null:null,'limit':_0x3b7e31[_0x3120('0x20')]?_0x3b7e31[_0x3120('0x20')][_0x3120('0x23')]||null:null})['then'](function(_0x5454f2){logger[_0x3120('0x14')](_0x3120('0x24'),_0x3b7e31);logger['debug'](_0x3120('0x24'),_0x3b7e31,JSON[_0x3120('0x18')](_0x5454f2));_0x3bc524(_0x5454f2);})[_0x3120('0x1d')](function(_0x4bc011){logger[_0x3120('0x19')](_0x3120('0x24'),_0x4bc011[_0x3120('0x1b')],_0x3b7e31);_0x5bfd37(_0x41d73f[_0x3120('0x19')](0x1f4,_0x4bc011['message']));});});};exports['AddTagsToMailInteraction']=function(_0x5b3050){return new Promise(function(_0x17c138,_0x5444ec){return db[_0x3120('0x1e')][_0x3120('0x25')]({'where':_0x5b3050[_0x3120('0x20')]?_0x5b3050[_0x3120('0x20')][_0x3120('0x22')]||null:null})[_0x3120('0x13')](function(_0x4f2bc6){if(_0x4f2bc6){return _0x4f2bc6[_0x3120('0x26')](_0x5b3050[_0x3120('0x1f')][_0x3120('0x27')],_[_0x3120('0x28')](_0x5b3050[_0x3120('0x1f')],[_0x3120('0x27'),'id'])||{});}})[_0x3120('0x29')](function(_0x19ade0){logger['info']('AddTags',_0x5b3050);logger[_0x3120('0x2a')](_0x3120('0x2b'),_0x5b3050,JSON[_0x3120('0x18')](_0x19ade0));_0x17c138(_0x19ade0);})[_0x3120('0x1d')](function(_0x41ba6f){logger[_0x3120('0x19')]('AddTags',_0x41ba6f[_0x3120('0x1b')],_0x5b3050);_0x5444ec(_this[_0x3120('0x19')](0x1f4,_0x41ba6f[_0x3120('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 3394c6f..1aa498b 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 _0x4a96=['removeListener','register','length','mailInteraction:','./mailInteraction.events','remove','emit'];(function(_0x99e2f0,_0x509fbd){var _0x1ca7c1=function(_0x1a5fb9){while(--_0x1a5fb9){_0x99e2f0['push'](_0x99e2f0['shift']());}};_0x1ca7c1(++_0x509fbd);}(_0x4a96,0x10e));var _0x64a9=function(_0x5089bb,_0x314042){_0x5089bb=_0x5089bb-0x0;var _0x2b519e=_0x4a96[_0x5089bb];return _0x2b519e;};'use strict';var MailInteractionEvents=require(_0x64a9('0x0'));var events=['save',_0x64a9('0x1'),'update'];function createListener(_0xf18a4b,_0x1849bd){return function(_0x490f85){_0x1849bd[_0x64a9('0x2')](_0xf18a4b,_0x490f85);};}function removeListener(_0x5358d3,_0x40b7f0){return function(){MailInteractionEvents[_0x64a9('0x3')](_0x5358d3,_0x40b7f0);};}exports[_0x64a9('0x4')]=function(_0x11a273){for(var _0x1e38f5=0x0,_0x37e2bf=events[_0x64a9('0x5')];_0x1e38f5<_0x37e2bf;_0x1e38f5++){var _0x44b995=events[_0x1e38f5];var _0x425eb6=createListener(_0x64a9('0x6')+_0x44b995,_0x11a273);MailInteractionEvents['on'](_0x44b995,_0x425eb6);}}; \ No newline at end of file +var _0x41b3=['mailInteraction:','./mailInteraction.events','remove','update','emit','removeListener','register'];(function(_0xaeb17a,_0x176827){var _0x205ada=function(_0x2e62fb){while(--_0x2e62fb){_0xaeb17a['push'](_0xaeb17a['shift']());}};_0x205ada(++_0x176827);}(_0x41b3,0x120));var _0x341b=function(_0x53a10e,_0x3bf42a){_0x53a10e=_0x53a10e-0x0;var _0x43626a=_0x41b3[_0x53a10e];return _0x43626a;};'use strict';var MailInteractionEvents=require(_0x341b('0x0'));var events=['save',_0x341b('0x1'),_0x341b('0x2')];function createListener(_0x3a9e3b,_0x4f0616){return function(_0x5dc072){_0x4f0616[_0x341b('0x3')](_0x3a9e3b,_0x5dc072);};}function removeListener(_0x4f17cc,_0x343d8a){return function(){MailInteractionEvents[_0x341b('0x4')](_0x4f17cc,_0x343d8a);};}exports[_0x341b('0x5')]=function(_0x3d221e){for(var _0x461f33=0x0,_0x1118c2=events['length'];_0x461f33<_0x1118c2;_0x461f33++){var _0x4a886b=events[_0x461f33];var _0x527596=createListener(_0x341b('0x6')+_0x4a886b,_0x3d221e);MailInteractionEvents['on'](_0x4a886b,_0x527596);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index c482a25..d196f8d 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f36=['/describe','isAuthenticated','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x5017c0,_0x1a6afd){var _0x58962d=function(_0x328195){while(--_0x328195){_0x5017c0['push'](_0x5017c0['shift']());}};_0x58962d(++_0x1a6afd);}(_0x0f36,0x8b));var _0x60f3=function(_0x461c9e,_0x9a67cd){_0x461c9e=_0x461c9e-0x0;var _0x144e35=_0x0f36[_0x461c9e];return _0x144e35;};'use strict';var express=require(_0x60f3('0x0'));var router=express[_0x60f3('0x1')]();var auth=require(_0x60f3('0x2'));var controller=require(_0x60f3('0x3'));router[_0x60f3('0x4')](_0x60f3('0x5'),auth[_0x60f3('0x6')](),controller[_0x60f3('0x7')]);module[_0x60f3('0x8')]=router; \ No newline at end of file +var _0x6363=['describe','exports','express','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','isAuthenticated'];(function(_0x23ef1f,_0x127dd2){var _0x234192=function(_0x2d83da){while(--_0x2d83da){_0x23ef1f['push'](_0x23ef1f['shift']());}};_0x234192(++_0x127dd2);}(_0x6363,0x13a));var _0x3636=function(_0x18bb47,_0x5b04db){_0x18bb47=_0x18bb47-0x0;var _0x3a5548=_0x6363[_0x18bb47];return _0x3a5548;};'use strict';var express=require(_0x3636('0x0'));var router=express['Router']();var auth=require(_0x3636('0x1'));var controller=require(_0x3636('0x2'));router[_0x3636('0x3')](_0x3636('0x4'),auth[_0x3636('0x5')](),controller[_0x3636('0x6')]);module[_0x3636('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index f3877be..bb2b130 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1ddf0f,_0x133ead){var _0xd388ae=function(_0x17b4d7){while(--_0x17b4d7){_0x1ddf0f['push'](_0x1ddf0f['shift']());}};_0xd388ae(++_0x133ead);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1b9f85,_0x3226bd){var _0x1b4e77=function(_0x115594){while(--_0x115594){_0x1b9f85['push'](_0x1b9f85['shift']());}};_0x1b4e77(++_0x3226bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 12590de..2791c89 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x453c=['sequelize','exports','INTEGER'];(function(_0x9a3bf5,_0x3d28fa){var _0x3f5959=function(_0x2a05b9){while(--_0x2a05b9){_0x9a3bf5['push'](_0x9a3bf5['shift']());}};_0x3f5959(++_0x3d28fa);}(_0x453c,0x10b));var _0xc453=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x453c[_0x5d07ff];return _0x5226ad;};'use strict';var Sequelize=require(_0xc453('0x0'));module[_0xc453('0x1')]={'MailInteractionId':{'type':Sequelize[_0xc453('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xc453('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x0f42=['exports','INTEGER','sequelize'];(function(_0x260b48,_0x117977){var _0x3f730b=function(_0x7a1e53){while(--_0x7a1e53){_0x260b48['push'](_0x260b48['shift']());}};_0x3f730b(++_0x117977);}(_0x0f42,0x1e5));var _0x20f4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0f42[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x20f4('0x0'));module[_0x20f4('0x1')]={'MailInteractionId':{'type':Sequelize[_0x20f4('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x20f4('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 0d1fcb7..8748538 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd39=['define','mail_interaction_has_tags','exports'];(function(_0x5d25de,_0x417686){var _0x3e7a19=function(_0x2e73b2){while(--_0x2e73b2){_0x5d25de['push'](_0x5d25de['shift']());}};_0x3e7a19(++_0x417686);}(_0xbd39,0xf5));var _0x9bd3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xbd39[_0x1d1779];return _0x2377e9;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x9bd3('0x0')]=function(_0x3a050c){return _0x3a050c[_0x9bd3('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0x9bd3('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac14=['./mailInteractionHasTag','define','mail_interaction_has_tags'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xac14,0x1f2));var _0x4ac1=function(_0x5f3225,_0x5c2fae){_0x5f3225=_0x5f3225-0x0;var _0x17d2a7=_0xac14[_0x5f3225];return _0x17d2a7;};'use strict';var attributes=require(_0x4ac1('0x0'));module['exports']=function(_0x1ef26c){return _0x1ef26c[_0x4ac1('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0x4ac1('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7893b68..0fce719 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 _0x5df3=['/:id/download','download','tracked','mail','mailmessage:create','create','update','put','/:id/accept','accept','reject','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x221a0f,_0x3970f6){var _0x30309e=function(_0x2a6cf4){while(--_0x2a6cf4){_0x221a0f['push'](_0x221a0f['shift']());}};_0x30309e(++_0x3970f6);}(_0x5df3,0x15f));var _0x35df=function(_0x2215d2,_0x563782){_0x2215d2=_0x2215d2-0x0;var _0x2bb13a=_0x5df3[_0x2215d2];return _0x2bb13a;};'use strict';var multer=require(_0x35df('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x35df('0x1'));var express=require(_0x35df('0x2'));var router=express[_0x35df('0x3')]();var fs_extra=require(_0x35df('0x4'));var auth=require(_0x35df('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x35df('0x6'));router[_0x35df('0x7')]('/',auth[_0x35df('0x8')](),controller['index']);router[_0x35df('0x7')](_0x35df('0x9'),auth[_0x35df('0x8')](),controller[_0x35df('0xa')]);router[_0x35df('0x7')](_0x35df('0xb'),auth[_0x35df('0x8')](),controller[_0x35df('0xc')]);router[_0x35df('0x7')](_0x35df('0xd'),auth[_0x35df('0x8')](),controller[_0x35df('0xe')]);router['post']('/',auth[_0x35df('0x8')](),interaction[_0x35df('0xf')](_0x35df('0x10'),_0x35df('0x11')),controller[_0x35df('0x12')]);router['put'](_0x35df('0xb'),auth[_0x35df('0x8')](),controller[_0x35df('0x13')]);router[_0x35df('0x14')](_0x35df('0x15'),auth[_0x35df('0x8')](),controller[_0x35df('0x16')]);router[_0x35df('0x14')]('/:id/reject',auth[_0x35df('0x8')](),controller[_0x35df('0x17')]);router[_0x35df('0x18')](_0x35df('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x35df('0x19')]=router; \ No newline at end of file +var _0x19ea=['/:id/reject','reject','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','tracked','mail','create','put','update','/:id/accept','accept'];(function(_0x4719a8,_0x10052c){var _0x12f2e1=function(_0x484124){while(--_0x484124){_0x4719a8['push'](_0x4719a8['shift']());}};_0x12f2e1(++_0x10052c);}(_0x19ea,0xfe));var _0xa19e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x19ea[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xa19e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa19e('0x1'));var express=require('express');var router=express[_0xa19e('0x2')]();var fs_extra=require(_0xa19e('0x3'));var auth=require(_0xa19e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa19e('0x5'));router[_0xa19e('0x6')]('/',auth[_0xa19e('0x7')](),controller[_0xa19e('0x8')]);router[_0xa19e('0x6')](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xa')]);router[_0xa19e('0x6')](_0xa19e('0xb'),auth[_0xa19e('0x7')](),controller['show']);router[_0xa19e('0x6')](_0xa19e('0xc'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xd')]);router['post']('/',auth[_0xa19e('0x7')](),interaction[_0xa19e('0xe')](_0xa19e('0xf'),'mailmessage:create'),controller[_0xa19e('0x10')]);router[_0xa19e('0x11')](_0xa19e('0xb'),auth[_0xa19e('0x7')](),controller[_0xa19e('0x12')]);router['put'](_0xa19e('0x13'),auth[_0xa19e('0x7')](),controller[_0xa19e('0x14')]);router[_0xa19e('0x11')](_0xa19e('0x15'),auth[_0xa19e('0x7')](),controller[_0xa19e('0x16')]);router[_0xa19e('0x17')](_0xa19e('0xb'),auth[_0xa19e('0x7')](),controller[_0xa19e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 5aec468..50c065a 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 _0x972d=['out','STRING','long','DATE','Chat','lodash','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3c715a,_0x632b85){var _0x5737a3=function(_0x24496c){while(--_0x24496c){_0x3c715a['push'](_0x3c715a['shift']());}};_0x5737a3(++_0x632b85);}(_0x972d,0x1a7));var _0xd972=function(_0x2041a7,_0x5a8d5c){_0x2041a7=_0x2041a7-0x0;var _0x141669=_0x972d[_0x2041a7];return _0x141669;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd972('0x0'));module[_0xd972('0x1')]={'body':{'type':Sequelize[_0xd972('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd972('0x2')](_0xd972('0x3'))},'read':{'type':Sequelize[_0xd972('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd972('0x5')]('in',_0xd972('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd972('0x7')](0x1fe)},'from':{'type':Sequelize[_0xd972('0x7')]},'to':{'type':Sequelize['TEXT'](_0xd972('0x8'))},'cc':{'type':Sequelize[_0xd972('0x2')](_0xd972('0x8'))},'bcc':{'type':Sequelize[_0xd972('0x2')](_0xd972('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd972('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd972('0x9')]},'originTo':{'type':Sequelize[_0xd972('0x2')]('long')},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0xd972('0x5')]('Email',_0xd972('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x8e6f=['lodash','exports','TEXT','medium','BOOLEAN','STRING','long','INTEGER','Email','Chat'];(function(_0x31b520,_0x94c392){var _0xac3109=function(_0x2f7976){while(--_0x2f7976){_0x31b520['push'](_0x31b520['shift']());}};_0xac3109(++_0x94c392);}(_0x8e6f,0x1cc));var _0xf8e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf8e6('0x0'));module[_0xf8e6('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf8e6('0x2')](_0xf8e6('0x3'))},'read':{'type':Sequelize[_0xf8e6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf8e6('0x5')](0x1fe)},'from':{'type':Sequelize[_0xf8e6('0x5')]},'to':{'type':Sequelize[_0xf8e6('0x2')](_0xf8e6('0x6'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xf8e6('0x2')](_0xf8e6('0x6'))},'subject':{'type':Sequelize[_0xf8e6('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xf8e6('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf8e6('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xf8e6('0x2')](_0xf8e6('0x6'))},'originCc':{'type':Sequelize[_0xf8e6('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0xf8e6('0x8'),_0xf8e6('0x9')),'defaultValue':_0xf8e6('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 8d18056..33c4d99 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 _0xa67e=['event','rejectmessage','download','unix','server','files','tmp','root','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','info','request\x20sent','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','count','status','set','update','then','destroy','end','sendStatus','name','send','index','MailMessage','fieldName','type','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','includeAll','include','show','params','keys','rawAttributes','length','body','find','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','basename','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','User'];(function(_0x2c4ddc,_0x588329){var _0x479593=function(_0x3d66be){while(--_0x3d66be){_0x2c4ddc['push'](_0x2c4ddc['shift']());}};_0x479593(++_0x588329);}(_0xa67e,0x150));var _0xea67=function(_0xbfda63,_0x2bd321){_0xbfda63=_0xbfda63-0x0;var _0x25cf03=_0xa67e[_0xbfda63];return _0x25cf03;};'use strict';var emlformat=require('eml-format');var moment=require(_0xea67('0x0'));var BPromise=require(_0xea67('0x1'));var util=require('util');var path=require(_0xea67('0x2'));var fs=require('fs');var _=require(_0xea67('0x3'));var Redis=require(_0xea67('0x4'));var htmlToText=require(_0xea67('0x5'));var qs=require(_0xea67('0x6'));var logger=require(_0xea67('0x7'))('api');var interaction_log=require(_0xea67('0x7'))(_0xea67('0x8'));var config=require('../../config/environment');var db=require(_0xea67('0x9'))['db'];config[_0xea67('0xa')]=_[_0xea67('0xb')](config[_0xea67('0xa')],{'host':_0xea67('0xc'),'port':0x18eb});var socket=require(_0xea67('0xd'))(new Redis(config[_0xea67('0xa')]));var htmlEntities=require(_0xea67('0xe'));require(_0xea67('0xf'))['register'](socket);var jayson=require(_0xea67('0x10'));var client=jayson[_0xea67('0x11')]['http']({'port':0x232c});var client9003=jayson[_0xea67('0x11')]['http']({'port':0x232b});var client9002=jayson[_0xea67('0x11')][_0xea67('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2e0981,_0x46c84f,_0x15bd43,_0xf2d345){return new BPromise(function(_0x1a9083,_0x34a891){var _0x125c84=_0xf2d345||client;return _0x125c84[_0xea67('0x13')](_0x2e0981,_0x15bd43)['then'](function(_0x55422b){logger[_0xea67('0x14')]('MailMessage,\x20%s,\x20%s',_0x46c84f,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x46c84f,_0xea67('0x15'),JSON['stringify'](_0x55422b));if(_0x55422b[_0xea67('0x16')]){if(_0x55422b['error'][_0xea67('0x17')]===0x1f4){logger[_0xea67('0x16')](_0xea67('0x18'),_0x46c84f,_0x55422b['error']['message']);return _0x34a891(_0x55422b[_0xea67('0x16')]['message']);}logger['error'](_0xea67('0x18'),_0x46c84f,_0x55422b[_0xea67('0x16')]['message']);return _0x1a9083(_0x55422b[_0xea67('0x16')][_0xea67('0x19')]);}else{logger[_0xea67('0x14')](_0xea67('0x18'),_0x46c84f,_0xea67('0x15'));_0x1a9083(_0x55422b[_0xea67('0x1a')][_0xea67('0x19')]);}})[_0xea67('0x1b')](function(_0x280083){logger[_0xea67('0x16')](_0xea67('0x18'),_0x46c84f,_0x280083);_0x34a891(_0x280083);});});}function respondWithResult(_0x54cae6,_0x24be4e){_0x24be4e=_0x24be4e||0xc8;return function(_0x49ee9e){if(_0x49ee9e){return _0x54cae6['status'](_0x24be4e)[_0xea67('0x1c')](_0x49ee9e);}};}function respondWithFilteredResult(_0x4e96e2,_0x40b8dc){return function(_0x5a1299){if(_0x5a1299){var _0xa869c5=typeof _0x40b8dc[_0xea67('0x1d')]===_0xea67('0x1e')&&typeof _0x40b8dc[_0xea67('0x1f')]===_0xea67('0x1e');var _0x5e7d32=_0x5a1299[_0xea67('0x20')];var _0x13ec2c=_0xa869c5?0x0:_0x40b8dc[_0xea67('0x1d')];var _0x1afd6d=_0xa869c5?_0x5a1299[_0xea67('0x20')]:_0x40b8dc['offset']+_0x40b8dc['limit'];var _0xb4d727;if(_0x1afd6d>=_0x5e7d32){_0x1afd6d=_0x5e7d32;_0xb4d727=0xc8;}else{_0xb4d727=0xce;}_0x4e96e2[_0xea67('0x21')](_0xb4d727);return _0x4e96e2[_0xea67('0x22')]('Content-Range',_0x13ec2c+'-'+_0x1afd6d+'/'+_0x5e7d32)[_0xea67('0x1c')](_0x5a1299);}return null;};}function saveUpdates(_0x3507d4){return function(_0x33ede7){if(_0x33ede7){return _0x33ede7[_0xea67('0x23')](_0x3507d4)[_0xea67('0x24')](function(_0x31bac9){return _0x31bac9;});}return null;};}function removeEntity(_0x3df622){return function(_0xbd0085){if(_0xbd0085){return _0xbd0085[_0xea67('0x25')]()[_0xea67('0x24')](function(){_0x3df622['status'](0xcc)[_0xea67('0x26')]();});}};}function handleEntityNotFound(_0x41c221){return function(_0x3186a2){if(!_0x3186a2){_0x41c221[_0xea67('0x27')](0x194);}return _0x3186a2;};}function handleError(_0x50ca76,_0x37177e){_0x37177e=_0x37177e||0x1f4;return function(_0xc84795){logger[_0xea67('0x16')](_0xc84795['stack']);if(_0xc84795['name']){delete _0xc84795[_0xea67('0x28')];}_0x50ca76['status'](_0x37177e)[_0xea67('0x29')](_0xc84795);};}exports[_0xea67('0x2a')]=function(_0x404fc7,_0x1f68bf){var _0x55403d={},_0xdd86ee={},_0x375913={'count':0x0,'rows':[]};var _0x8a1e17=_['map'](db[_0xea67('0x2b')]['rawAttributes'],function(_0x5bab49){return{'name':_0x5bab49[_0xea67('0x2c')],'type':_0x5bab49[_0xea67('0x2d')]['key']};});_0xdd86ee['model']=_['map'](_0x8a1e17,_0xea67('0x28'));_0xdd86ee[_0xea67('0x2e')]=_['keys'](_0x404fc7[_0xea67('0x2e')]);_0xdd86ee['filters']=_['intersection'](_0xdd86ee[_0xea67('0x2f')],_0xdd86ee[_0xea67('0x2e')]);_0x55403d['attributes']=_[_0xea67('0x30')](_0xdd86ee['model'],qs['fields'](_0x404fc7[_0xea67('0x2e')][_0xea67('0x31')]));_0x55403d[_0xea67('0x32')]=_0x55403d[_0xea67('0x32')]['length']?_0x55403d[_0xea67('0x32')]:_0xdd86ee['model'];if(!_0x404fc7['query'][_0xea67('0x33')](_0xea67('0x34'))){_0x55403d[_0xea67('0x1f')]=qs[_0xea67('0x1f')](_0x404fc7[_0xea67('0x2e')][_0xea67('0x1f')]);_0x55403d[_0xea67('0x1d')]=qs[_0xea67('0x1d')](_0x404fc7[_0xea67('0x2e')][_0xea67('0x1d')]);}_0x55403d[_0xea67('0x35')]=qs[_0xea67('0x36')](_0x404fc7['query']['sort']);_0x55403d[_0xea67('0x37')]=qs[_0xea67('0x38')](_['pick'](_0x404fc7['query'],_0xdd86ee[_0xea67('0x38')]),_0x8a1e17);if(_0x404fc7[_0xea67('0x2e')][_0xea67('0x39')]){_0x55403d['where']=_[_0xea67('0x3a')](_0x55403d[_0xea67('0x37')],{'$or':_[_0xea67('0x3b')](_0x8a1e17,function(_0x46404e){if(_0x46404e[_0xea67('0x2d')]!=='VIRTUAL'){var _0x55516a={};_0x55516a[_0x46404e[_0xea67('0x28')]]={'$like':'%'+_0x404fc7[_0xea67('0x2e')][_0xea67('0x39')]+'%'};return _0x55516a;}})});}_0x55403d=_[_0xea67('0x3a')]({},_0x55403d,_0x404fc7[_0xea67('0x3c')]);var _0x58223f={'where':_0x55403d[_0xea67('0x37')]};return db[_0xea67('0x2b')][_0xea67('0x20')](_0x58223f)[_0xea67('0x24')](function(_0x4c35df){_0x375913[_0xea67('0x20')]=_0x4c35df;if(_0x404fc7[_0xea67('0x2e')][_0xea67('0x3d')]){_0x55403d[_0xea67('0x3e')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x55403d);})[_0xea67('0x24')](function(_0x294c9b){_0x375913['rows']=_0x294c9b;return _0x375913;})[_0xea67('0x24')](respondWithFilteredResult(_0x1f68bf,_0x55403d))[_0xea67('0x1b')](handleError(_0x1f68bf,null));};exports[_0xea67('0x3f')]=function(_0x4cd3d0,_0x3a461c){var _0x4b0d94={'raw':!![],'where':{'id':_0x4cd3d0[_0xea67('0x40')]['id']}},_0x40869a={};_0x40869a[_0xea67('0x2f')]=_[_0xea67('0x41')](db[_0xea67('0x2b')][_0xea67('0x42')]);_0x40869a[_0xea67('0x2e')]=_[_0xea67('0x41')](_0x4cd3d0[_0xea67('0x2e')]);_0x40869a[_0xea67('0x38')]=_[_0xea67('0x30')](_0x40869a[_0xea67('0x2f')],_0x40869a['query']);_0x4b0d94[_0xea67('0x32')]=_[_0xea67('0x30')](_0x40869a[_0xea67('0x2f')],qs[_0xea67('0x31')](_0x4cd3d0['query'][_0xea67('0x31')]));_0x4b0d94['attributes']=_0x4b0d94[_0xea67('0x32')][_0xea67('0x43')]?_0x4b0d94[_0xea67('0x32')]:_0x40869a['model'];if(_0x4cd3d0[_0xea67('0x2e')][_0xea67('0x3d')]){_0x4b0d94[_0xea67('0x3e')]=[{'all':!![]}];}_0x4b0d94=_['merge']({},_0x4b0d94,_0x4cd3d0[_0xea67('0x3c')]);return db[_0xea67('0x2b')]['find'](_0x4b0d94)[_0xea67('0x24')](handleEntityNotFound(_0x3a461c,null))['then'](respondWithResult(_0x3a461c,null))['catch'](handleError(_0x3a461c,null));};exports[_0xea67('0x23')]=function(_0x3714df,_0x1123e3){if(_0x3714df[_0xea67('0x44')]['id']){delete _0x3714df[_0xea67('0x44')]['id'];}return db['MailMessage'][_0xea67('0x45')]({'where':{'id':_0x3714df[_0xea67('0x40')]['id']}})[_0xea67('0x24')](handleEntityNotFound(_0x1123e3,null))[_0xea67('0x24')](saveUpdates(_0x3714df['body'],null))[_0xea67('0x24')](respondWithResult(_0x1123e3,null))[_0xea67('0x1b')](handleError(_0x1123e3,null));};exports[_0xea67('0x25')]=function(_0x32628d,_0x301c57){return db['MailMessage'][_0xea67('0x45')]({'where':{'id':_0x32628d[_0xea67('0x40')]['id']}})['then'](handleEntityNotFound(_0x301c57,null))[_0xea67('0x24')](removeEntity(_0x301c57,null))[_0xea67('0x1b')](handleError(_0x301c57,null));};exports[_0xea67('0x46')]=function(_0x405419,_0x178875){return db['MailMessage']['describe']()['then'](respondWithResult(_0x178875,null))[_0xea67('0x1b')](handleError(_0x178875,null));};exports[_0xea67('0x47')]=function(_0x247f32,_0x21c835){return db[_0xea67('0x2b')][_0xea67('0x47')](_0x247f32['body'])[_0xea67('0x24')](function(_0x2069b4){if(_0x2069b4){if(_0x2069b4[_0xea67('0x48')]===_0xea67('0x49')&&!_0x2069b4[_0xea67('0x4a')]){var _0x3744b5,_0x23160f,_0x37bc45;if(_0x247f32[_0xea67('0x44')]['to']){_0x23160f=_0x247f32[_0xea67('0x44')]['to']['split'](',')[0x0];}return db[_0xea67('0x4b')][_0xea67('0x4c')]({'where':{'id':_0x2069b4[_0xea67('0x4d')]},'include':[{'model':db[_0xea67('0x4e')],'as':_0xea67('0x4f'),'include':[{'model':db[_0xea67('0x50')],'as':_0xea67('0x51'),'where':{'email':_0x23160f},'limit':0x1,'order':[[_0xea67('0x52'),_0xea67('0x53')]]}]},{'model':db[_0xea67('0x54')],'as':_0xea67('0x55'),'raw':!![],'include':[{'model':db[_0xea67('0x56')],'as':_0xea67('0x56'),'raw':!![]}]}]})[_0xea67('0x24')](function(_0x2f1b5d){_0x3744b5=_0x2f1b5d;if(!_0x3744b5||!_0x3744b5['Smtp'])return;var _0xf959a2=_0x3744b5['getSmtpOptions']();if(_0x247f32[_0xea67('0x44')]['attachments']&&_0x247f32[_0xea67('0x44')]['attachments'][_0xea67('0x43')]){for(var _0x36cc7d=0x0;_0x36cc7d<_0x247f32[_0xea67('0x44')][_0xea67('0x57')][_0xea67('0x43')];_0x36cc7d+=0x1){_0x247f32[_0xea67('0x44')][_0xea67('0x57')][_0x36cc7d]={'filename':_0x247f32[_0xea67('0x44')][_0xea67('0x57')][_0x36cc7d][_0xea67('0x28')],'path':path[_0xea67('0x58')](config['root'],'server/files/attachments',_0x247f32[_0xea67('0x44')][_0xea67('0x57')][_0x36cc7d][_0xea67('0x59')])};}}_0x37bc45={'account':_0xf959a2,'message':_0x247f32[_0xea67('0x44')]};return;})[_0xea67('0x24')](function(){if(_0x3744b5[_0xea67('0x4f')]){if(_0x3744b5[_0xea67('0x4f')][_0xea67('0x51')][_0xea67('0x43')]){return _0x3744b5[_0xea67('0x4f')]['Contacts'][0x0];}else{return db[_0xea67('0x50')][_0xea67('0x47')](_['defaults'](_0x247f32[_0xea67('0x44')],{'firstName':_0x247f32[_0xea67('0x44')]['to'],'email':_0x247f32[_0xea67('0x44')]['to'],'phone':_0x247f32[_0xea67('0x44')]['to'],'ListId':_0x3744b5['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0xea67('0x24')](function(){if(_0x37bc45){return respondWithRpcPromise(_0xea67('0x5a'),'sendMail',_0x37bc45,client9003)[_0xea67('0x24')](function(_0x49f0b7){return _0x2069b4[_0xea67('0x23')]({'read':!![],'messageId':_0x49f0b7[_0xea67('0x5b')],'sentAt':moment()[_0xea67('0x5c')](_0xea67('0x5d'))});})['catch'](function(_0x11ed2d){logger['error']('%s',JSON['stringify'](_0x11ed2d));return _0x2069b4;});}return _0x2069b4;});}return _0x2069b4;}})['then'](respondWithResult(_0x21c835,0xc9))[_0xea67('0x1b')](handleError(_0x21c835,null));};exports[_0xea67('0x5e')]=function(_0x4bacb6,_0x274cdd){var _0x1bd374={'agent':{},'channel':'mail'};if(_0x4bacb6[_0xea67('0x44')]['id']){delete _0x4bacb6[_0xea67('0x44')]['id'];}_0x4bacb6[_0xea67('0x44')][_0xea67('0x5f')]=!![];_0x4bacb6[_0xea67('0x44')][_0xea67('0x60')]=moment()[_0xea67('0x5c')](_0xea67('0x5d'));_0x4bacb6[_0xea67('0x44')][_0xea67('0x61')]=_0x4bacb6['body'][_0xea67('0x61')]||_0x4bacb6[_0xea67('0x62')]['id'];_0x1bd374[_0xea67('0x63')]['id']=_0x4bacb6[_0xea67('0x44')][_0xea67('0x61')];return db['MailMessage'][_0xea67('0x45')]({'where':{'id':_0x4bacb6['params']['id'],'UserId':null}})[_0xea67('0x24')](handleEntityNotFound(_0x274cdd,null))[_0xea67('0x24')](saveUpdates(_0x4bacb6[_0xea67('0x44')],null))[_0xea67('0x24')](function(_0xaf9191){if(_0xaf9191){_0x1bd374[_0xea67('0x19')]=_0xaf9191['get']({'plain':!![]});return db[_0xea67('0x64')][_0xea67('0x45')]({'where':{'id':_0xaf9191[_0xea67('0x65')]}});}return null;})[_0xea67('0x24')](handleEntityNotFound(_0x274cdd,null))['then'](function(_0x3f30fc){if(_0x3f30fc){return _0x3f30fc['update']({'UserId':_0x4bacb6['body'][_0xea67('0x61')],'read1stAt':_[_0xea67('0x66')](_0x3f30fc[_0xea67('0x67')])?moment()['format'](_0xea67('0x5d')):undefined});}return null;})['then'](function(_0x4190c2){if(_0x4190c2){_0x1bd374['interaction']=_0x4190c2[_0xea67('0x68')]({'plain':!![]});interaction_log[_0xea67('0x14')](_0xea67('0x69'),_0x4bacb6[_0xea67('0x62')]['id'],_0x4bacb6['user'][_0xea67('0x28')],_0x4bacb6[_0xea67('0x62')]['role'],_0x1bd374['interaction']['id'],_0x4bacb6[_0xea67('0x44')]?JSON[_0xea67('0x6a')](_0x4bacb6[_0xea67('0x44')]):'null');return respondWithRpcPromise('AcceptMessage',_0xea67('0x6b'),_0x1bd374);}return null;})['then'](function(_0x12c7f8){var _0x3af049=_0xea67('0x6c')+_0x12c7f8[_0xea67('0x19')][_0xea67('0x6d')];return db[_0xea67('0x6e')][_0xea67('0x2e')](_0x3af049,{'type':db[_0xea67('0x6f')][_0xea67('0x70')][_0xea67('0x71')],'raw':!![]})[_0xea67('0x24')](function(_0x479436){return _0x479436;});})[_0xea67('0x24')](function(_0x27ba75){if(_0x27ba75){_0x1bd374[_0xea67('0x19')][_0xea67('0x72')]=_0x27ba75[0x0];if(!_0x4bacb6[_0xea67('0x44')]['UserId'])return;return db['User'][_0xea67('0x45')]({'where':{'id':_0x4bacb6[_0xea67('0x44')][_0xea67('0x61')],'role':_0xea67('0x63')},'attributes':['id',_0xea67('0x28'),_0xea67('0x73'),_0xea67('0x74'),_0xea67('0x75')],'raw':!![]});}return null;})['then'](function(_0x265f67){if(!_0x265f67)return null;_0x1bd374[_0xea67('0x19')][_0xea67('0x63')]=_0x265f67;return _0x1bd374;})['then'](function(_0x365f03){if(_0x365f03){if(_0x4bacb6['body']['manual']){_0x1bd374['message']['interface']=util['format'](_0xea67('0x76'),_0x4bacb6[_0xea67('0x62')]['name']);_0x1bd374[_0xea67('0x19')][_0xea67('0x77')]=_0x1bd374[_0xea67('0x77')];_0x1bd374['message'][_0xea67('0x78')]=_0x1bd374['channel'];_0x1bd374[_0xea67('0x19')]['event']=_0xea67('0x5e');_0x1bd374[_0xea67('0x19')][_0xea67('0x44')]=htmlToText[_0xea67('0x79')](_0x1bd374[_0xea67('0x19')][_0xea67('0x44')]);return respondWithRpcPromise('EventManager',_0xea67('0x7a'),{'event':_0xea67('0x7b'),'message':_0x1bd374['message']},client9002)['then'](function(){return _0x1bd374;});}return _0x1bd374;}return null;})[_0xea67('0x24')](respondWithResult(_0x274cdd,null))[_0xea67('0x1b')](handleError(_0x274cdd,null));};exports[_0xea67('0x7c')]=function(_0x532120,_0x19ff74){var _0x15f224={'agent':{},'channel':_0xea67('0x7d')};if(_0x532120[_0xea67('0x44')]['id']){delete _0x532120[_0xea67('0x44')]['id'];}_0x532120[_0xea67('0x44')][_0xea67('0x61')]=_0x532120[_0xea67('0x44')]['UserId']||_0x532120[_0xea67('0x62')]['id'];_0x15f224[_0xea67('0x63')]['id']=_0x532120[_0xea67('0x44')][_0xea67('0x61')];return db[_0xea67('0x2b')][_0xea67('0x45')]({'where':{'id':_0x532120[_0xea67('0x40')]['id'],'UserId':null}})[_0xea67('0x24')](handleEntityNotFound(_0x19ff74,null))['then'](function(_0x34bcad){if(_0x34bcad){_0x15f224['message']=_0x34bcad[_0xea67('0x68')]({'plain':!![]});return db[_0xea67('0x64')][_0xea67('0x45')]({'where':{'id':_0x34bcad[_0xea67('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x19ff74,null))['then'](function(_0x224705){if(_0x224705){_0x15f224['interaction']=_0x224705[_0xea67('0x68')]({'plain':!![]});interaction_log['info'](_0xea67('0x7e'),_0x532120[_0xea67('0x62')]['id'],_0x532120[_0xea67('0x62')][_0xea67('0x28')],_0x532120[_0xea67('0x62')][_0xea67('0x7f')],_0x15f224['interaction']['id'],_0x532120[_0xea67('0x44')]?JSON[_0xea67('0x6a')](_0x532120[_0xea67('0x44')]):_0xea67('0x80'));return respondWithRpcPromise(_0xea67('0x81'),_0xea67('0x82'),_0x15f224);}return null;})[_0xea67('0x24')](function(_0x3e7707){var _0x17740d=_0xea67('0x6c')+_0x3e7707[_0xea67('0x19')][_0xea67('0x6d')];return db[_0xea67('0x6e')][_0xea67('0x2e')](_0x17740d,{'type':db[_0xea67('0x6f')][_0xea67('0x70')][_0xea67('0x71')],'raw':!![]})[_0xea67('0x24')](function(_0x4ebec0){return _0x4ebec0;});})[_0xea67('0x24')](function(_0x5edd4c){if(_0x5edd4c){_0x15f224[_0xea67('0x19')][_0xea67('0x72')]=_0x5edd4c[0x0];if(!_0x532120[_0xea67('0x44')]['UserId'])return;return db[_0xea67('0x83')][_0xea67('0x45')]({'where':{'id':_0x532120[_0xea67('0x44')][_0xea67('0x61')],'role':_0xea67('0x63')},'attributes':['id',_0xea67('0x28'),_0xea67('0x73'),_0xea67('0x74'),_0xea67('0x75')],'raw':!![]});}return null;})['then'](function(_0x61ffb4){if(!_0x61ffb4)return null;_0x15f224[_0xea67('0x19')][_0xea67('0x63')]=_0x61ffb4;return _0x15f224;})['then'](function(_0x2e3d64){if(_0x2e3d64){_0x2e3d64[_0xea67('0x19')]['interface']=util[_0xea67('0x5c')]('SIP/%s',_0x532120[_0xea67('0x62')][_0xea67('0x28')]);_0x2e3d64['message'][_0xea67('0x77')]=_0x15f224[_0xea67('0x77')];_0x2e3d64[_0xea67('0x19')][_0xea67('0x78')]=_0x15f224[_0xea67('0x77')];_0x2e3d64[_0xea67('0x19')][_0xea67('0x84')]=_0xea67('0x7c');_0x2e3d64['message'][_0xea67('0x44')]=htmlToText[_0xea67('0x79')](_0x15f224[_0xea67('0x19')]['body']);respondWithRpcPromise(_0xea67('0x7a'),'EventManager',{'event':_0xea67('0x85'),'message':_0x2e3d64[_0xea67('0x19')]},client9002);return _0x15f224;}return null;})[_0xea67('0x24')](respondWithResult(_0x19ff74,null))['catch'](handleError(_0x19ff74,null));};exports[_0xea67('0x86')]=function(_0x2c3452,_0x3012cf){var _0x51cc4f=moment()[_0xea67('0x87')]()['toString']();var _0x1a94ee=path[_0xea67('0x58')](config['root'],_0xea67('0x88'),_0xea67('0x89'),_0xea67('0x8a'));var _0x21034d=path[_0xea67('0x58')](config[_0xea67('0x8b')],_0xea67('0x88'),_0xea67('0x89'),_0xea67('0x57'));var _0x4fb39f=util[_0xea67('0x5c')](_0xea67('0x8c'),_0x51cc4f);return db['MailMessage'][_0xea67('0x45')]({'where':{'id':_0x2c3452[_0xea67('0x40')]['id']},'attributes':['id',_0xea67('0x44'),_0xea67('0x8d'),'to','cc',_0xea67('0x8e'),'subject',_0xea67('0x8f')],'include':_0x2c3452[_0xea67('0x2e')]['attachments']?[{'model':db[_0xea67('0x90')],'as':_0xea67('0x91')}]:undefined})['then'](handleEntityNotFound(_0x3012cf,null))[_0xea67('0x24')](function(_0x4ca47b){if(_0x4ca47b){var _0x5f2fdb=_0x4ca47b;var _0x5525aa={'from':_0x5f2fdb[_0xea67('0x8d')],'to':_0x5f2fdb['to'],'subject':_0x5f2fdb[_0xea67('0x92')],'html':htmlEntities['decode'](_0x5f2fdb[_0xea67('0x44')]),'headers':{'Date':moment(_0x5f2fdb[_0xea67('0x8f')])['format'](_0xea67('0x93'))},'attachments':[]};if(_0x4ca47b['cc']){_0x5525aa[_0xea67('0x94')]['Cc']=_0x4ca47b['cc'];}if(_0x4ca47b[_0xea67('0x8e')]){_0x5525aa[_0xea67('0x94')][_0xea67('0x95')]=_0x4ca47b[_0xea67('0x8e')];}return new BPromise(function(_0x3d4953,_0xb38c17){if(_0x4ca47b[_0xea67('0x91')]){for(var _0x43bc4f=0x0;_0x43bc4f<_0x4ca47b[_0xea67('0x91')]['length'];_0x43bc4f++){var _0x213f93=_0x4ca47b[_0xea67('0x91')][_0x43bc4f];var _0x2971cf=path['join'](_0x21034d,_0x213f93[_0xea67('0x59')]);if(fs[_0xea67('0x96')](_0x2971cf)){_0x5525aa[_0xea67('0x57')][_0xea67('0x97')]({'name':_0x213f93[_0xea67('0x28')],'contentType':_0x213f93[_0xea67('0x2d')],'data':fs[_0xea67('0x98')](_0x2971cf)});}}}emlformat[_0xea67('0x99')](_0x5525aa,function(_0x2d0e29,_0x2d1805){if(_0x2d0e29)return _0xb38c17(_0x2d0e29);fs[_0xea67('0x9a')](path[_0xea67('0x58')](_0x1a94ee,_0x4fb39f),_0x2d1805);return _0x3d4953(_0x2d1805);});});}})[_0xea67('0x24')](function(_0x239cf4){if(_0x239cf4){return _0x3012cf['download'](path[_0xea67('0x58')](_0x1a94ee,_0x4fb39f),_0x4fb39f,function(_0x187a5e){if(!_0x187a5e)fs[_0xea67('0x9b')](path[_0xea67('0x58')](_0x1a94ee,_0x4fb39f));});}})['catch'](handleError(_0x3012cf,null));}; \ No newline at end of file +var _0x6011=['model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','show','params','fields','update','body','find','describe','create','direction','out','split','MailAccount','MailAccountId','List','CmContact','Contacts','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','fromString','download','unix','toString','server','files','from','createdAt','Attachment','Attachments','subject','decode','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','redis','defaults','localhost','html-entities','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key'];(function(_0x522937,_0x220b6a){var _0x28e136=function(_0x277202){while(--_0x277202){_0x522937['push'](_0x522937['shift']());}};_0x28e136(++_0x220b6a);}(_0x6011,0x100));var _0x1601=function(_0x165117,_0x50288a){_0x165117=_0x165117-0x0;var _0x3fe394=_0x6011[_0x165117];return _0x3fe394;};'use strict';var emlformat=require(_0x1601('0x0'));var moment=require(_0x1601('0x1'));var BPromise=require('bluebird');var util=require(_0x1601('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x1601('0x3'));var Redis=require(_0x1601('0x4'));var htmlToText=require(_0x1601('0x5'));var qs=require(_0x1601('0x6'));var logger=require(_0x1601('0x7'))('api');var interaction_log=require(_0x1601('0x7'))(_0x1601('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1601('0x9')]=_[_0x1601('0xa')](config[_0x1601('0x9')],{'host':_0x1601('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1601('0x9')]));var htmlEntities=require(_0x1601('0xc'));require('./mailMessage.socket')[_0x1601('0xd')](socket);var jayson=require(_0x1601('0xe'));var client=jayson[_0x1601('0xf')][_0x1601('0x10')]({'port':0x232c});var client9003=jayson[_0x1601('0xf')][_0x1601('0x10')]({'port':0x232b});var client9002=jayson[_0x1601('0xf')][_0x1601('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x15d074,_0x58a4bf,_0x517755,_0x12727e){return new BPromise(function(_0x108cd2,_0x3dd619){var _0x25a782=_0x12727e||client;return _0x25a782[_0x1601('0x11')](_0x15d074,_0x517755)[_0x1601('0x12')](function(_0x552dfa){logger[_0x1601('0x13')](_0x1601('0x14'),_0x58a4bf,_0x1601('0x15'));logger[_0x1601('0x16')](_0x1601('0x17'),_0x58a4bf,_0x1601('0x15'),JSON[_0x1601('0x18')](_0x552dfa));if(_0x552dfa[_0x1601('0x19')]){if(_0x552dfa[_0x1601('0x19')][_0x1601('0x1a')]===0x1f4){logger[_0x1601('0x19')](_0x1601('0x14'),_0x58a4bf,_0x552dfa[_0x1601('0x19')][_0x1601('0x1b')]);return _0x3dd619(_0x552dfa[_0x1601('0x19')]['message']);}logger[_0x1601('0x19')](_0x1601('0x14'),_0x58a4bf,_0x552dfa[_0x1601('0x19')]['message']);return _0x108cd2(_0x552dfa[_0x1601('0x19')][_0x1601('0x1b')]);}else{logger[_0x1601('0x13')]('MailMessage,\x20%s,\x20%s',_0x58a4bf,_0x1601('0x15'));_0x108cd2(_0x552dfa[_0x1601('0x1c')][_0x1601('0x1b')]);}})[_0x1601('0x1d')](function(_0x2fc150){logger[_0x1601('0x19')]('MailMessage,\x20%s,\x20%s',_0x58a4bf,_0x2fc150);_0x3dd619(_0x2fc150);});});}function respondWithResult(_0x22d540,_0x37bed5){_0x37bed5=_0x37bed5||0xc8;return function(_0x47c67f){if(_0x47c67f){return _0x22d540[_0x1601('0x1e')](_0x37bed5)[_0x1601('0x1f')](_0x47c67f);}};}function respondWithFilteredResult(_0x58e7f0,_0x4f09bb){return function(_0x5c8dfd){if(_0x5c8dfd){var _0x1a1c38=typeof _0x4f09bb['offset']===_0x1601('0x20')&&typeof _0x4f09bb[_0x1601('0x21')]===_0x1601('0x20');var _0x352920=_0x5c8dfd[_0x1601('0x22')];var _0x2d8648=_0x1a1c38?0x0:_0x4f09bb['offset'];var _0xdc7085=_0x1a1c38?_0x5c8dfd[_0x1601('0x22')]:_0x4f09bb[_0x1601('0x23')]+_0x4f09bb['limit'];var _0x24d548;if(_0xdc7085>=_0x352920){_0xdc7085=_0x352920;_0x24d548=0xc8;}else{_0x24d548=0xce;}_0x58e7f0[_0x1601('0x1e')](_0x24d548);return _0x58e7f0[_0x1601('0x24')](_0x1601('0x25'),_0x2d8648+'-'+_0xdc7085+'/'+_0x352920)['json'](_0x5c8dfd);}return null;};}function saveUpdates(_0x445070){return function(_0x39a774){if(_0x39a774){return _0x39a774['update'](_0x445070)[_0x1601('0x12')](function(_0xa3995c){return _0xa3995c;});}return null;};}function removeEntity(_0x179984){return function(_0x5f783){if(_0x5f783){return _0x5f783['destroy']()[_0x1601('0x12')](function(){_0x179984[_0x1601('0x1e')](0xcc)[_0x1601('0x26')]();});}};}function handleEntityNotFound(_0x351837){return function(_0x516bc5){if(!_0x516bc5){_0x351837[_0x1601('0x27')](0x194);}return _0x516bc5;};}function handleError(_0x89b2f4,_0x49f8ab){_0x49f8ab=_0x49f8ab||0x1f4;return function(_0x1d7ab3){logger['error'](_0x1d7ab3[_0x1601('0x28')]);if(_0x1d7ab3[_0x1601('0x29')]){delete _0x1d7ab3['name'];}_0x89b2f4[_0x1601('0x1e')](_0x49f8ab)[_0x1601('0x2a')](_0x1d7ab3);};}exports[_0x1601('0x2b')]=function(_0x1d1e9e,_0x136566){var _0x138893={},_0x4ac5ca={},_0x425fc3={'count':0x0,'rows':[]};var _0x2836ed=_[_0x1601('0x2c')](db[_0x1601('0x2d')][_0x1601('0x2e')],function(_0x5147b1){return{'name':_0x5147b1[_0x1601('0x2f')],'type':_0x5147b1[_0x1601('0x30')][_0x1601('0x31')]};});_0x4ac5ca[_0x1601('0x32')]=_['map'](_0x2836ed,'name');_0x4ac5ca[_0x1601('0x33')]=_[_0x1601('0x34')](_0x1d1e9e[_0x1601('0x33')]);_0x4ac5ca[_0x1601('0x35')]=_[_0x1601('0x36')](_0x4ac5ca['model'],_0x4ac5ca[_0x1601('0x33')]);_0x138893[_0x1601('0x37')]=_[_0x1601('0x36')](_0x4ac5ca[_0x1601('0x32')],qs['fields'](_0x1d1e9e[_0x1601('0x33')]['fields']));_0x138893[_0x1601('0x37')]=_0x138893['attributes'][_0x1601('0x38')]?_0x138893[_0x1601('0x37')]:_0x4ac5ca[_0x1601('0x32')];if(!_0x1d1e9e[_0x1601('0x33')][_0x1601('0x39')](_0x1601('0x3a'))){_0x138893[_0x1601('0x21')]=qs[_0x1601('0x21')](_0x1d1e9e['query'][_0x1601('0x21')]);_0x138893[_0x1601('0x23')]=qs['offset'](_0x1d1e9e[_0x1601('0x33')][_0x1601('0x23')]);}_0x138893[_0x1601('0x3b')]=qs[_0x1601('0x3c')](_0x1d1e9e[_0x1601('0x33')]['sort']);_0x138893['where']=qs['filters'](_['pick'](_0x1d1e9e[_0x1601('0x33')],_0x4ac5ca[_0x1601('0x35')]),_0x2836ed);if(_0x1d1e9e['query'][_0x1601('0x3d')]){_0x138893['where']=_[_0x1601('0x3e')](_0x138893['where'],{'$or':_[_0x1601('0x2c')](_0x2836ed,function(_0x4bc9a0){if(_0x4bc9a0['type']!==_0x1601('0x3f')){var _0x412b7a={};_0x412b7a[_0x4bc9a0[_0x1601('0x29')]]={'$like':'%'+_0x1d1e9e[_0x1601('0x33')]['filter']+'%'};return _0x412b7a;}})});}_0x138893=_['merge']({},_0x138893,_0x1d1e9e[_0x1601('0x40')]);var _0x319008={'where':_0x138893[_0x1601('0x41')]};return db['MailMessage'][_0x1601('0x22')](_0x319008)[_0x1601('0x12')](function(_0x1b3920){_0x425fc3[_0x1601('0x22')]=_0x1b3920;if(_0x1d1e9e['query'][_0x1601('0x42')]){_0x138893[_0x1601('0x43')]=[{'all':!![]}];}return db[_0x1601('0x2d')][_0x1601('0x44')](_0x138893);})[_0x1601('0x12')](function(_0x5e0966){_0x425fc3['rows']=_0x5e0966;return _0x425fc3;})[_0x1601('0x12')](respondWithFilteredResult(_0x136566,_0x138893))['catch'](handleError(_0x136566,null));};exports[_0x1601('0x45')]=function(_0x403653,_0x4b8925){var _0x102518={'raw':!![],'where':{'id':_0x403653[_0x1601('0x46')]['id']}},_0x555132={};_0x555132[_0x1601('0x32')]=_[_0x1601('0x34')](db[_0x1601('0x2d')][_0x1601('0x2e')]);_0x555132['query']=_['keys'](_0x403653[_0x1601('0x33')]);_0x555132[_0x1601('0x35')]=_['intersection'](_0x555132['model'],_0x555132['query']);_0x102518['attributes']=_[_0x1601('0x36')](_0x555132[_0x1601('0x32')],qs[_0x1601('0x47')](_0x403653['query'][_0x1601('0x47')]));_0x102518[_0x1601('0x37')]=_0x102518[_0x1601('0x37')][_0x1601('0x38')]?_0x102518[_0x1601('0x37')]:_0x555132[_0x1601('0x32')];if(_0x403653['query'][_0x1601('0x42')]){_0x102518[_0x1601('0x43')]=[{'all':!![]}];}_0x102518=_[_0x1601('0x3e')]({},_0x102518,_0x403653[_0x1601('0x40')]);return db['MailMessage']['find'](_0x102518)[_0x1601('0x12')](handleEntityNotFound(_0x4b8925,null))[_0x1601('0x12')](respondWithResult(_0x4b8925,null))[_0x1601('0x1d')](handleError(_0x4b8925,null));};exports[_0x1601('0x48')]=function(_0x152926,_0x236576){if(_0x152926[_0x1601('0x49')]['id']){delete _0x152926[_0x1601('0x49')]['id'];}return db[_0x1601('0x2d')][_0x1601('0x4a')]({'where':{'id':_0x152926[_0x1601('0x46')]['id']}})[_0x1601('0x12')](handleEntityNotFound(_0x236576,null))['then'](saveUpdates(_0x152926['body'],null))[_0x1601('0x12')](respondWithResult(_0x236576,null))[_0x1601('0x1d')](handleError(_0x236576,null));};exports['destroy']=function(_0x356103,_0x2ab269){return db[_0x1601('0x2d')][_0x1601('0x4a')]({'where':{'id':_0x356103[_0x1601('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ab269,null))[_0x1601('0x12')](removeEntity(_0x2ab269,null))[_0x1601('0x1d')](handleError(_0x2ab269,null));};exports[_0x1601('0x4b')]=function(_0x26c771,_0x2e2dc7){return db[_0x1601('0x2d')][_0x1601('0x4b')]()['then'](respondWithResult(_0x2e2dc7,null))['catch'](handleError(_0x2e2dc7,null));};exports[_0x1601('0x4c')]=function(_0x359bc6,_0x2205a1){return db[_0x1601('0x2d')]['create'](_0x359bc6[_0x1601('0x49')])['then'](function(_0x10a3c2){if(_0x10a3c2){if(_0x10a3c2[_0x1601('0x4d')]===_0x1601('0x4e')&&!_0x10a3c2['secret']){var _0x5ba4a4,_0x5a28ca,_0x5f279f;if(_0x359bc6[_0x1601('0x49')]['to']){_0x5a28ca=_0x359bc6['body']['to'][_0x1601('0x4f')](',')[0x0];}return db[_0x1601('0x50')]['findOne']({'where':{'id':_0x10a3c2[_0x1601('0x51')]},'include':[{'model':db['CmList'],'as':_0x1601('0x52'),'include':[{'model':db[_0x1601('0x53')],'as':_0x1601('0x54'),'where':{'email':_0x5a28ca},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1601('0x55')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1601('0x56')],'as':'CloudProvider','raw':!![]}]}]})[_0x1601('0x12')](function(_0x10c22f){_0x5ba4a4=_0x10c22f;if(!_0x5ba4a4||!_0x5ba4a4[_0x1601('0x57')])return;var _0x286c84=_0x5ba4a4[_0x1601('0x58')]();if(_0x359bc6['body'][_0x1601('0x59')]&&_0x359bc6[_0x1601('0x49')][_0x1601('0x59')][_0x1601('0x38')]){for(var _0x5cee46=0x0;_0x5cee46<_0x359bc6[_0x1601('0x49')][_0x1601('0x59')][_0x1601('0x38')];_0x5cee46+=0x1){_0x359bc6['body'][_0x1601('0x59')][_0x5cee46]={'filename':_0x359bc6[_0x1601('0x49')]['attachments'][_0x5cee46][_0x1601('0x29')],'path':path[_0x1601('0x5a')](config[_0x1601('0x5b')],_0x1601('0x5c'),_0x359bc6[_0x1601('0x49')][_0x1601('0x59')][_0x5cee46][_0x1601('0x5d')])};}}_0x5f279f={'account':_0x286c84,'message':_0x359bc6['body']};return;})[_0x1601('0x12')](function(){if(_0x5ba4a4[_0x1601('0x52')]){if(_0x5ba4a4['List'][_0x1601('0x54')]['length']){return _0x5ba4a4['List'][_0x1601('0x54')][0x0];}else{return db['CmContact']['create'](_[_0x1601('0xa')](_0x359bc6[_0x1601('0x49')],{'firstName':_0x359bc6['body']['to'],'email':_0x359bc6[_0x1601('0x49')]['to'],'phone':_0x359bc6[_0x1601('0x49')]['to'],'ListId':_0x5ba4a4[_0x1601('0x5e')]}));}}else{throw new Error(_0x1601('0x5f'));}})['then'](function(){if(_0x5f279f){return respondWithRpcPromise(_0x1601('0x60'),_0x1601('0x61'),_0x5f279f,client9003)['then'](function(_0x34c2bb){return _0x10a3c2[_0x1601('0x48')]({'read':!![],'messageId':_0x34c2bb[_0x1601('0x62')],'sentAt':moment()['format'](_0x1601('0x63'))});})[_0x1601('0x1d')](function(_0x5235ca){logger[_0x1601('0x19')]('%s',JSON[_0x1601('0x18')](_0x5235ca));return _0x10a3c2;});}return _0x10a3c2;});}return _0x10a3c2;}})['then'](respondWithResult(_0x2205a1,0xc9))[_0x1601('0x1d')](handleError(_0x2205a1,null));};exports['accept']=function(_0x3aac21,_0x5f4b1a){var _0x4bd413={'agent':{},'channel':_0x1601('0x64')};if(_0x3aac21[_0x1601('0x49')]['id']){delete _0x3aac21[_0x1601('0x49')]['id'];}_0x3aac21[_0x1601('0x49')][_0x1601('0x65')]=!![];_0x3aac21['body'][_0x1601('0x66')]=moment()[_0x1601('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x3aac21[_0x1601('0x49')][_0x1601('0x68')]=_0x3aac21[_0x1601('0x49')]['UserId']||_0x3aac21[_0x1601('0x69')]['id'];_0x4bd413[_0x1601('0x6a')]['id']=_0x3aac21['body'][_0x1601('0x68')];return db['MailMessage']['find']({'where':{'id':_0x3aac21[_0x1601('0x46')]['id'],'UserId':null}})[_0x1601('0x12')](handleEntityNotFound(_0x5f4b1a,null))[_0x1601('0x12')](saveUpdates(_0x3aac21['body'],null))[_0x1601('0x12')](function(_0x2c889e){if(_0x2c889e){_0x4bd413[_0x1601('0x1b')]=_0x2c889e[_0x1601('0x6b')]({'plain':!![]});return db[_0x1601('0x6c')][_0x1601('0x4a')]({'where':{'id':_0x2c889e[_0x1601('0x6d')]}});}return null;})[_0x1601('0x12')](handleEntityNotFound(_0x5f4b1a,null))[_0x1601('0x12')](function(_0x23671a){if(_0x23671a){return _0x23671a[_0x1601('0x48')]({'UserId':_0x3aac21[_0x1601('0x49')][_0x1601('0x68')],'read1stAt':_['isNil'](_0x23671a[_0x1601('0x6e')])?moment()[_0x1601('0x67')](_0x1601('0x63')):undefined});}return null;})[_0x1601('0x12')](function(_0x5ee1ba){if(_0x5ee1ba){_0x4bd413[_0x1601('0x6f')]=_0x5ee1ba[_0x1601('0x6b')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3aac21[_0x1601('0x69')]['id'],_0x3aac21[_0x1601('0x69')]['name'],_0x3aac21[_0x1601('0x69')][_0x1601('0x70')],_0x4bd413[_0x1601('0x6f')]['id'],_0x3aac21['body']?JSON[_0x1601('0x18')](_0x3aac21[_0x1601('0x49')]):_0x1601('0x71'));return respondWithRpcPromise(_0x1601('0x72'),_0x1601('0x73'),_0x4bd413);}return null;})[_0x1601('0x12')](function(_0x4b88f4){var _0x276aca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b88f4[_0x1601('0x1b')]['ContactId'];return db[_0x1601('0x74')][_0x1601('0x33')](_0x276aca,{'type':db[_0x1601('0x75')]['QueryTypes'][_0x1601('0x76')],'raw':!![]})[_0x1601('0x12')](function(_0x281017){return _0x281017;});})[_0x1601('0x12')](function(_0x5b3f9e){if(_0x5b3f9e){_0x4bd413[_0x1601('0x1b')]['contact']=_0x5b3f9e[0x0];if(!_0x3aac21[_0x1601('0x49')][_0x1601('0x68')])return;return db[_0x1601('0x77')][_0x1601('0x4a')]({'where':{'id':_0x3aac21['body'][_0x1601('0x68')],'role':_0x1601('0x6a')},'attributes':['id',_0x1601('0x29'),_0x1601('0x78'),_0x1601('0x79'),_0x1601('0x7a')],'raw':!![]});}return null;})['then'](function(_0x320a6a){if(!_0x320a6a)return null;_0x4bd413[_0x1601('0x1b')][_0x1601('0x6a')]=_0x320a6a;return _0x4bd413;})['then'](function(_0x5512e5){if(_0x5512e5){if(_0x3aac21[_0x1601('0x49')]['manual']){_0x4bd413[_0x1601('0x1b')][_0x1601('0x7b')]=util[_0x1601('0x67')](_0x1601('0x7c'),_0x3aac21[_0x1601('0x69')][_0x1601('0x29')]);_0x4bd413['message'][_0x1601('0x7d')]=_0x4bd413[_0x1601('0x7d')];_0x4bd413[_0x1601('0x1b')][_0x1601('0x7e')]=_0x4bd413['channel'];_0x4bd413['message'][_0x1601('0x7f')]=_0x1601('0x80');_0x4bd413['message']['body']=htmlToText['fromString'](_0x4bd413[_0x1601('0x1b')][_0x1601('0x49')]);return respondWithRpcPromise(_0x1601('0x81'),_0x1601('0x81'),{'event':'acceptmessage','message':_0x4bd413['message']},client9002)['then'](function(){return _0x4bd413;});}return _0x4bd413;}return null;})['then'](respondWithResult(_0x5f4b1a,null))[_0x1601('0x1d')](handleError(_0x5f4b1a,null));};exports[_0x1601('0x82')]=function(_0x27fd22,_0x599916){var _0x49ac90={'agent':{},'channel':_0x1601('0x64')};if(_0x27fd22['body']['id']){delete _0x27fd22['body']['id'];}_0x27fd22[_0x1601('0x49')]['UserId']=_0x27fd22[_0x1601('0x49')][_0x1601('0x68')]||_0x27fd22[_0x1601('0x69')]['id'];_0x49ac90[_0x1601('0x6a')]['id']=_0x27fd22[_0x1601('0x49')][_0x1601('0x68')];return db[_0x1601('0x2d')]['find']({'where':{'id':_0x27fd22['params']['id'],'UserId':null}})[_0x1601('0x12')](handleEntityNotFound(_0x599916,null))[_0x1601('0x12')](function(_0x33bf15){if(_0x33bf15){_0x49ac90['message']=_0x33bf15['get']({'plain':!![]});return db[_0x1601('0x6c')][_0x1601('0x4a')]({'where':{'id':_0x33bf15['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x599916,null))[_0x1601('0x12')](function(_0x37db03){if(_0x37db03){_0x49ac90[_0x1601('0x6f')]=_0x37db03[_0x1601('0x6b')]({'plain':!![]});interaction_log[_0x1601('0x13')](_0x1601('0x83'),_0x27fd22['user']['id'],_0x27fd22[_0x1601('0x69')]['name'],_0x27fd22[_0x1601('0x69')]['role'],_0x49ac90['interaction']['id'],_0x27fd22[_0x1601('0x49')]?JSON[_0x1601('0x18')](_0x27fd22['body']):_0x1601('0x71'));return respondWithRpcPromise(_0x1601('0x84'),'rejectMessage',_0x49ac90);}return null;})['then'](function(_0x5123d6){var _0x154ff1=_0x1601('0x85')+_0x5123d6['message']['ContactId'];return db[_0x1601('0x74')][_0x1601('0x33')](_0x154ff1,{'type':db['Sequelize'][_0x1601('0x86')][_0x1601('0x76')],'raw':!![]})[_0x1601('0x12')](function(_0x39b072){return _0x39b072;});})[_0x1601('0x12')](function(_0x3f877e){if(_0x3f877e){_0x49ac90['message']['contact']=_0x3f877e[0x0];if(!_0x27fd22['body']['UserId'])return;return db[_0x1601('0x77')][_0x1601('0x4a')]({'where':{'id':_0x27fd22[_0x1601('0x49')][_0x1601('0x68')],'role':_0x1601('0x6a')},'attributes':['id',_0x1601('0x29'),_0x1601('0x78'),'email',_0x1601('0x7a')],'raw':!![]});}return null;})[_0x1601('0x12')](function(_0x5888e3){if(!_0x5888e3)return null;_0x49ac90[_0x1601('0x1b')][_0x1601('0x6a')]=_0x5888e3;return _0x49ac90;})[_0x1601('0x12')](function(_0x5cb4c0){if(_0x5cb4c0){_0x5cb4c0['message']['interface']=util[_0x1601('0x67')](_0x1601('0x7c'),_0x27fd22[_0x1601('0x69')][_0x1601('0x29')]);_0x5cb4c0['message'][_0x1601('0x7d')]=_0x49ac90[_0x1601('0x7d')];_0x5cb4c0[_0x1601('0x1b')][_0x1601('0x7e')]=_0x49ac90[_0x1601('0x7d')];_0x5cb4c0[_0x1601('0x1b')][_0x1601('0x7f')]='reject';_0x5cb4c0[_0x1601('0x1b')][_0x1601('0x49')]=htmlToText[_0x1601('0x87')](_0x49ac90[_0x1601('0x1b')][_0x1601('0x49')]);respondWithRpcPromise(_0x1601('0x81'),_0x1601('0x81'),{'event':'rejectmessage','message':_0x5cb4c0[_0x1601('0x1b')]},client9002);return _0x49ac90;}return null;})[_0x1601('0x12')](respondWithResult(_0x599916,null))[_0x1601('0x1d')](handleError(_0x599916,null));};exports[_0x1601('0x88')]=function(_0x22890a,_0x5e1914){var _0x2b36d3=moment()[_0x1601('0x89')]()[_0x1601('0x8a')]();var _0x35040a=path[_0x1601('0x5a')](config[_0x1601('0x5b')],'server','files','tmp');var _0x427d9a=path[_0x1601('0x5a')](config[_0x1601('0x5b')],_0x1601('0x8b'),_0x1601('0x8c'),_0x1601('0x59'));var _0x3c8b37=util['format']('message-%s.eml',_0x2b36d3);return db[_0x1601('0x2d')][_0x1601('0x4a')]({'where':{'id':_0x22890a[_0x1601('0x46')]['id']},'attributes':['id',_0x1601('0x49'),_0x1601('0x8d'),'to','cc','bcc','subject',_0x1601('0x8e')],'include':_0x22890a[_0x1601('0x33')]['attachments']?[{'model':db[_0x1601('0x8f')],'as':_0x1601('0x90')}]:undefined})[_0x1601('0x12')](handleEntityNotFound(_0x5e1914,null))[_0x1601('0x12')](function(_0x32643e){if(_0x32643e){var _0xca1b97=_0x32643e;var _0x5e08ce={'from':_0xca1b97['from'],'to':_0xca1b97['to'],'subject':_0xca1b97[_0x1601('0x91')],'html':htmlEntities[_0x1601('0x92')](_0xca1b97['body']),'headers':{'Date':moment(_0xca1b97[_0x1601('0x8e')])[_0x1601('0x67')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x32643e['cc']){_0x5e08ce['headers']['Cc']=_0x32643e['cc'];}if(_0x32643e['bcc']){_0x5e08ce['headers'][_0x1601('0x93')]=_0x32643e['bcc'];}return new BPromise(function(_0x2de30d,_0x49cfbe){if(_0x32643e[_0x1601('0x90')]){for(var _0x36aeff=0x0;_0x36aeff<_0x32643e[_0x1601('0x90')][_0x1601('0x38')];_0x36aeff++){var _0x5137d4=_0x32643e[_0x1601('0x90')][_0x36aeff];var _0x29b705=path[_0x1601('0x5a')](_0x427d9a,_0x5137d4[_0x1601('0x5d')]);if(fs['existsSync'](_0x29b705)){_0x5e08ce[_0x1601('0x59')][_0x1601('0x94')]({'name':_0x5137d4['name'],'contentType':_0x5137d4['type'],'data':fs[_0x1601('0x95')](_0x29b705)});}}}emlformat[_0x1601('0x96')](_0x5e08ce,function(_0x220241,_0x4e379f){if(_0x220241)return _0x49cfbe(_0x220241);fs[_0x1601('0x97')](path[_0x1601('0x5a')](_0x35040a,_0x3c8b37),_0x4e379f);return _0x2de30d(_0x4e379f);});});}})['then'](function(_0x5e42ea){if(_0x5e42ea){return _0x5e1914[_0x1601('0x88')](path[_0x1601('0x5a')](_0x35040a,_0x3c8b37),_0x3c8b37,function(_0xb92387){if(!_0xb92387)fs[_0x1601('0x98')](path[_0x1601('0x5a')](_0x35040a,_0x3c8b37));});}})[_0x1601('0x1d')](handleError(_0x5e1914,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a9e9490..478a96d 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 _0x1823=['../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0x1823,0x194));var _0x3182=function(_0x36e19f,_0x3c7511){_0x36e19f=_0x36e19f-0x0;var _0x2a1f77=_0x1823[_0x36e19f];return _0x2a1f77;};'use strict';var EventEmitter=require(_0x3182('0x0'));var MailMessage=require(_0x3182('0x1'))['db'][_0x3182('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3182('0x3')](0x0);var events={'afterCreate':_0x3182('0x4'),'afterUpdate':'update','afterDestroy':_0x3182('0x5')};function emitEvent(_0x3106b4){return function(_0x4cc31d,_0x2fabd8,_0x1fb843){MailMessageEvents[_0x3182('0x6')](_0x3106b4+':'+_0x4cc31d['id'],_0x4cc31d);MailMessageEvents[_0x3182('0x6')](_0x3106b4,_0x4cc31d);_0x1fb843(null);};}for(var e in events){if(events[_0x3182('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x3182('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xb087=['setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0x48b76e,_0x462a62){var _0x14c94e=function(_0xc44ae5){while(--_0xc44ae5){_0x48b76e['push'](_0x48b76e['shift']());}};_0x14c94e(++_0x462a62);}(_0xb087,0x156));var _0x7b08=function(_0x299697,_0x4731bd){_0x299697=_0x299697-0x0;var _0x52a1fa=_0xb087[_0x299697];return _0x52a1fa;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x7b08('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7b08('0x1')](0x0);var events={'afterCreate':_0x7b08('0x2'),'afterUpdate':_0x7b08('0x3'),'afterDestroy':'remove'};function emitEvent(_0x43844e){return function(_0x2bdb52,_0x1e21e7,_0x5656d1){MailMessageEvents[_0x7b08('0x4')](_0x43844e+':'+_0x2bdb52['id'],_0x2bdb52);MailMessageEvents[_0x7b08('0x4')](_0x43844e,_0x2bdb52);_0x5656d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x7b08('0x5')](e,emitEvent(event));}}module[_0x7b08('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a315296..d100c47 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 _0xe9cc=['body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xe9cc,0x139));var _0xce9c=function(_0x5fd7e5,_0x1ff905){_0x5fd7e5=_0x5fd7e5-0x0;var _0x19c265=_0xe9cc[_0x5fd7e5];return _0x19c265;};'use strict';var _=require(_0xce9c('0x0'));var util=require('util');var logger=require(_0xce9c('0x1'))(_0xce9c('0x2'));var moment=require(_0xce9c('0x3'));var BPromise=require(_0xce9c('0x4'));var rp=require(_0xce9c('0x5'));var htmlToText=require(_0xce9c('0x6'));var fs=require('fs');var path=require(_0xce9c('0x7'));var rimraf=require(_0xce9c('0x8'));var config=require(_0xce9c('0x9'));var attributes=require(_0xce9c('0xa'));module[_0xce9c('0xb')]=function(_0x4a8959,_0x140c73){return _0x4a8959[_0xce9c('0xc')](_0xce9c('0xd'),attributes,{'tableName':_0xce9c('0xe'),'paranoid':![],'indexes':[{'name':_0xce9c('0xf'),'fields':[_0xce9c('0xf')]},{'name':_0xce9c('0x10'),'fields':[_0xce9c('0x11'),_0xce9c('0x12')],'type':_0xce9c('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d9554,_0x1ab233,_0x371be4){if(_0x3d9554[_0xce9c('0x14')]){_0x3d9554['plainBody']=htmlToText[_0xce9c('0x15')](_0x3d9554[_0xce9c('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x371be4(null,_0x1ab233);},'afterCreate':function(_0x493901,_0x2fc547,_0x1271da){var _0x49ab9e=_0x4a8959[_0xce9c('0x16')];var _0x447a4a=_0x493901[_0xce9c('0x17')]({'plain':!![]});if(_0x447a4a[_0xce9c('0x18')][_0xce9c('0x19')]()==='in'||_0x447a4a[_0xce9c('0x18')][_0xce9c('0x19')]()===_0xce9c('0x1a')&&!_0x447a4a[_0xce9c('0x1b')]&&!_[_0xce9c('0x1c')](_0x447a4a[_0xce9c('0x1d')])){_0x49ab9e[_0xce9c('0x1e')][_0xce9c('0x1f')]({'where':{'id':_0x447a4a[_0xce9c('0x20')]}})[_0xce9c('0x21')](function(_0x4dde12){if(_0x4dde12){_0x4dde12[_0xce9c('0x22')]({'lastMsgAt':_0x447a4a['createdAt'],'lastMsgDirection':_0x447a4a[_0xce9c('0x18')][_0xce9c('0x19')]()});}})[_0xce9c('0x23')](function(_0x1c24f0){console['error'](_0x1c24f0);});}_0x1271da();}},'charset':'utf8mb4','collate':_0xce9c('0x24')});}; \ No newline at end of file +var _0xa27e=['util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','plainBody','subject','FULLTEXT','body','fromString','direction','toLowerCase','out','secret','isNil','MailInteraction','MailInteractionId','error','utf8mb4','lodash'];(function(_0x2e58da,_0x1ec89e){var _0x3eb7e1=function(_0x3e786b){while(--_0x3e786b){_0x2e58da['push'](_0x2e58da['shift']());}};_0x3eb7e1(++_0x1ec89e);}(_0xa27e,0x1cf));var _0xea27=function(_0x5441e9,_0x372a79){_0x5441e9=_0x5441e9-0x0;var _0x3f15b5=_0xa27e[_0x5441e9];return _0x3f15b5;};'use strict';var _=require(_0xea27('0x0'));var util=require(_0xea27('0x1'));var logger=require(_0xea27('0x2'))(_0xea27('0x3'));var moment=require(_0xea27('0x4'));var BPromise=require(_0xea27('0x5'));var rp=require(_0xea27('0x6'));var htmlToText=require(_0xea27('0x7'));var fs=require('fs');var path=require(_0xea27('0x8'));var rimraf=require(_0xea27('0x9'));var config=require(_0xea27('0xa'));var attributes=require(_0xea27('0xb'));module[_0xea27('0xc')]=function(_0x118197,_0x4d8371){return _0x118197['define'](_0xea27('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xea27('0xe'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0xea27('0xf'),_0xea27('0x10')],'type':_0xea27('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x16b6d1,_0x3227ae,_0x229b61){if(_0x16b6d1[_0xea27('0x12')]){_0x16b6d1['plainBody']=htmlToText[_0xea27('0x13')](_0x16b6d1[_0xea27('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x229b61(null,_0x3227ae);},'afterCreate':function(_0x1b13f2,_0x2ad190,_0x13782b){var _0x289a34=_0x118197['models'];var _0x2bd711=_0x1b13f2['get']({'plain':!![]});if(_0x2bd711[_0xea27('0x14')]['toLowerCase']()==='in'||_0x2bd711['direction'][_0xea27('0x15')]()===_0xea27('0x16')&&!_0x2bd711[_0xea27('0x17')]&&!_[_0xea27('0x18')](_0x2bd711['UserId'])){_0x289a34[_0xea27('0x19')]['findOne']({'where':{'id':_0x2bd711[_0xea27('0x1a')]}})['then'](function(_0x259e43){if(_0x259e43){_0x259e43['update']({'lastMsgAt':_0x2bd711['createdAt'],'lastMsgDirection':_0x2bd711[_0xea27('0x14')]['toLowerCase']()});}})['catch'](function(_0x54fefb){console[_0xea27('0x1b')](_0x54fefb);});}_0x13782b();}},'charset':_0xea27('0x1c'),'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 e40e05a..d25c978 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 _0xb44a=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x4a1303,_0x4660ed){var _0x493775=function(_0x3b9881){while(--_0x3b9881){_0x4a1303['push'](_0x4a1303['shift']());}};_0x493775(++_0x4660ed);}(_0xb44a,0x1c2));var _0xab44=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xb44a[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});config[_0xab44('0x8')]=_[_0xab44('0x9')](config[_0xab44('0x8')],{'host':_0xab44('0xa'),'port':0x18eb});var socket=require(_0xab44('0xb'))(new Redis(config[_0xab44('0x8')]));require(_0xab44('0xc'))[_0xab44('0xd')](socket);function respondWithRpcPromise(_0x55c7d2,_0x2a670e,_0x500a9f){return new BPromise(function(_0x15e64e,_0x5168fa){return client['request'](_0x55c7d2,_0x500a9f)[_0xab44('0xe')](function(_0x6746cc){logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));logger[_0xab44('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2a670e,'request\x20sent',JSON[_0xab44('0x13')](_0x6746cc));if(_0x6746cc['error']){if(_0x6746cc[_0xab44('0x14')]['code']===0x1f4){logger[_0xab44('0x14')](_0xab44('0x10'),_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x5168fa(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x15e64e(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}else{logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));_0x15e64e(_0x6746cc[_0xab44('0x16')][_0xab44('0x15')]);}})[_0xab44('0x17')](function(_0x27fc7f){logger['error'](_0xab44('0x10'),_0x2a670e,_0x27fc7f);_0x5168fa(_0x27fc7f);});});}exports[_0xab44('0x18')]=function(_0x101a1b){var _0x2902ca=this;return new Promise(function(_0x29bb73,_0x5123b1){return db[_0xab44('0x19')]['create'](_0x101a1b[_0xab44('0x1a')],{'raw':_0x101a1b[_0xab44('0x1b')]?_0x101a1b[_0xab44('0x1b')][_0xab44('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3a2b1d){logger[_0xab44('0xf')](_0xab44('0x18'),_0x101a1b);logger[_0xab44('0x12')](_0xab44('0x18'),_0x101a1b,JSON[_0xab44('0x13')](_0x3a2b1d));_0x29bb73(_0x3a2b1d);})[_0xab44('0x17')](function(_0x554955){logger['error'](_0xab44('0x18'),_0x554955['message'],_0x101a1b);_0x5123b1(_0x2902ca[_0xab44('0x14')](0x1f4,_0x554955['message']));});});}; \ No newline at end of file +var _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateMailMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x33aaf2,_0x4c396d){var _0x4bcf51=function(_0x1c2cea){while(--_0x1c2cea){_0x33aaf2['push'](_0x33aaf2['shift']());}};_0x4bcf51(++_0x4c396d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3b2be5,_0x9c01ae){_0x3b2be5=_0x3b2be5-0x0;var _0x14cd8=_0x5eb8[_0x3b2be5];return _0x14cd8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./mailMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('MailMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('MailMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateMailMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['MailMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateMailMessage',_0x24cf28);logger['debug']('CreateMailMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2bae94a..8a5e6ee 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 _0x11f7=['emit','removeListener','mailMessage:','save','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x11f7,0xda));var _0x711f=function(_0x137e24,_0x3a0b1c){_0x137e24=_0x137e24-0x0;var _0x2bb1e7=_0x11f7[_0x137e24];return _0x2bb1e7;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x711f('0x0'),'remove',_0x711f('0x1')];function createListener(_0xd7c148,_0xbc5be8){return function(_0x5827de){_0xbc5be8[_0x711f('0x2')](_0xd7c148,_0x5827de);};}function removeListener(_0x5bf289,_0x59a5ae){return function(){MailMessageEvents[_0x711f('0x3')](_0x5bf289,_0x59a5ae);};}exports['register']=function(_0x4d8a3c){for(var _0x3e2520=0x0,_0x2bea7c=events['length'];_0x3e2520<_0x2bea7c;_0x3e2520++){var _0x374458=events[_0x3e2520];var _0x26b15d=createListener(_0x711f('0x4')+_0x374458,_0x4d8a3c);MailMessageEvents['on'](_0x374458,_0x26b15d);}}; \ No newline at end of file +var _0x0751=['update','emit','removeListener','register','./mailMessage.events','save','remove'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0751,0xd6));var _0x1075=function(_0x283006,_0x54f88d){_0x283006=_0x283006-0x0;var _0x162518=_0x0751[_0x283006];return _0x162518;};'use strict';var MailMessageEvents=require(_0x1075('0x0'));var events=[_0x1075('0x1'),_0x1075('0x2'),_0x1075('0x3')];function createListener(_0x5ba0ae,_0x42781e){return function(_0xd4a405){_0x42781e[_0x1075('0x4')](_0x5ba0ae,_0xd4a405);};}function removeListener(_0x63e36b,_0x5d57f3){return function(){MailMessageEvents[_0x1075('0x5')](_0x63e36b,_0x5d57f3);};}exports[_0x1075('0x6')]=function(_0x326346){for(var _0x57e76a=0x0,_0x2c5597=events['length'];_0x57e76a<_0x2c5597;_0x57e76a++){var _0x1a0733=events[_0x57e76a];var _0xd4f952=createListener('mailMessage:'+_0x1a0733,_0x326346);MailMessageEvents['on'](_0x1a0733,_0xd4f952);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 78cbf23..bff8334 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 _0xaefd=['isAuthenticated','index','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xaefd,0xa3));var _0xdaef=function(_0x5d6d7b,_0x5268bb){_0x5d6d7b=_0x5d6d7b-0x0;var _0x1691fe=_0xaefd[_0x5d6d7b];return _0x1691fe;};'use strict';var multer=require(_0xdaef('0x0'));var util=require(_0xdaef('0x1'));var path=require(_0xdaef('0x2'));var timeout=require('connect-timeout');var express=require(_0xdaef('0x3'));var router=express[_0xdaef('0x4')]();var fs_extra=require(_0xdaef('0x5'));var auth=require(_0xdaef('0x6'));var interaction=require(_0xdaef('0x7'));var config=require(_0xdaef('0x8'));var controller=require(_0xdaef('0x9'));router[_0xdaef('0xa')]('/',auth[_0xdaef('0xb')](),controller[_0xdaef('0xc')]);router[_0xdaef('0xa')]('/describe',auth[_0xdaef('0xb')](),controller['describe']);router[_0xdaef('0xa')](_0xdaef('0xd'),auth[_0xdaef('0xb')](),controller[_0xdaef('0xe')]);router[_0xdaef('0xa')](_0xdaef('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xdaef('0x10'),auth[_0xdaef('0xb')](),controller['getTeams']);router['get'](_0xdaef('0x11'),auth['isAuthenticated'](),controller[_0xdaef('0x12')]);router[_0xdaef('0x13')]('/',auth['isAuthenticated'](),controller[_0xdaef('0x14')]);router['post'](_0xdaef('0x10'),auth[_0xdaef('0xb')](),controller[_0xdaef('0x15')]);router[_0xdaef('0x13')](_0xdaef('0x11'),auth[_0xdaef('0xb')](),controller[_0xdaef('0x16')]);router['put'](_0xdaef('0xd'),auth[_0xdaef('0xb')](),controller[_0xdaef('0x17')]);router[_0xdaef('0x18')](_0xdaef('0xd'),auth[_0xdaef('0xb')](),controller[_0xdaef('0x19')]);router[_0xdaef('0x18')](_0xdaef('0x10'),auth[_0xdaef('0xb')](),controller[_0xdaef('0x1a')]);router[_0xdaef('0x18')](_0xdaef('0x11'),auth[_0xdaef('0xb')](),controller[_0xdaef('0x1b')]);module[_0xdaef('0x1c')]=router; \ No newline at end of file +var _0x2eaa=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','isAuthenticated','describe','show','/:id/members','getTeams','/:id/users','create','/:id/teams','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents'];(function(_0x3d990d,_0x5312ac){var _0xd94d77=function(_0x2717e4){while(--_0x2717e4){_0x3d990d['push'](_0x3d990d['shift']());}};_0xd94d77(++_0x5312ac);}(_0x2eaa,0x151));var _0xa2ea=function(_0x4c30cd,_0x212d21){_0x4c30cd=_0x4c30cd-0x0;var _0x4574e5=_0x2eaa[_0x4c30cd];return _0x4574e5;};'use strict';var multer=require(_0xa2ea('0x0'));var util=require(_0xa2ea('0x1'));var path=require(_0xa2ea('0x2'));var timeout=require('connect-timeout');var express=require(_0xa2ea('0x3'));var router=express['Router']();var fs_extra=require(_0xa2ea('0x4'));var auth=require(_0xa2ea('0x5'));var interaction=require(_0xa2ea('0x6'));var config=require(_0xa2ea('0x7'));var controller=require(_0xa2ea('0x8'));router[_0xa2ea('0x9')]('/',auth['isAuthenticated'](),controller[_0xa2ea('0xa')]);router[_0xa2ea('0x9')]('/describe',auth[_0xa2ea('0xb')](),controller[_0xa2ea('0xc')]);router[_0xa2ea('0x9')]('/:id',auth[_0xa2ea('0xb')](),controller[_0xa2ea('0xd')]);router['get'](_0xa2ea('0xe'),auth[_0xa2ea('0xb')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xa2ea('0xb')](),controller[_0xa2ea('0xf')]);router['get'](_0xa2ea('0x10'),auth[_0xa2ea('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xa2ea('0x11')]);router['post'](_0xa2ea('0x12'),auth[_0xa2ea('0xb')](),controller[_0xa2ea('0x13')]);router['post'](_0xa2ea('0x10'),auth[_0xa2ea('0xb')](),controller[_0xa2ea('0x14')]);router['put'](_0xa2ea('0x15'),auth[_0xa2ea('0xb')](),controller[_0xa2ea('0x16')]);router[_0xa2ea('0x17')](_0xa2ea('0x15'),auth[_0xa2ea('0xb')](),controller[_0xa2ea('0x18')]);router[_0xa2ea('0x17')](_0xa2ea('0x12'),auth[_0xa2ea('0xb')](),controller[_0xa2ea('0x19')]);router[_0xa2ea('0x17')](_0xa2ea('0x10'),auth[_0xa2ea('0xb')](),controller[_0xa2ea('0x1a')]);module[_0xa2ea('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6d3d58f..16cef2e 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 _0x16b2=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0x2a4dda,_0x394a1b){var _0xe725e=function(_0x5c005c){while(--_0x5c005c){_0x2a4dda['push'](_0x2a4dda['shift']());}};_0xe725e(++_0x394a1b);}(_0x16b2,0x89));var _0x216b=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x16b2[_0x5c6022];return _0x4ab5af;};'use strict';var Sequelize=require(_0x216b('0x0'));module[_0x216b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x216b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x216b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x216b('0x4')](_0x216b('0x5'),_0x216b('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xb276=['STRING','name','INTEGER','ENUM'];(function(_0x3cd2c0,_0x26bfff){var _0x50f5d6=function(_0x50f3f1){while(--_0x50f3f1){_0x3cd2c0['push'](_0x3cd2c0['shift']());}};_0x50f5d6(++_0x26bfff);}(_0xb276,0x1cc));var _0x6b27=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0xb276[_0x5bfa44];return _0x43815f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6b27('0x0')],'unique':_0x6b27('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6b27('0x0')]},'timeout':{'type':Sequelize[_0x6b27('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6b27('0x3')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4713e9f..8768d23 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 _0xd2c8=['catch','show','keys','filters','intersection','model','fields','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','nolimit','order','sort','MailQueueId','filter','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','mailPause','getTeams','pick','addTeams','ids','Team','Agents','voicePause','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','all','union','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','hasOwnProperty','util','squel','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','update','destroy','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0xd2c8,0x1b7));var _0x8d2c=function(_0x11b64a,_0x2d722d){_0x11b64a=_0x11b64a-0x0;var _0x5d6a33=_0xd2c8[_0x11b64a];return _0x5d6a33;};'use strict';var BPromise=require('bluebird');var util=require(_0x8d2c('0x0'));var _=require('lodash');var squel=require(_0x8d2c('0x1'));var Redis=require(_0x8d2c('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8d2c('0x3'));var config=require(_0x8d2c('0x4'));var db=require(_0x8d2c('0x5'))['db'];config[_0x8d2c('0x6')]=_['defaults'](config['redis'],{'host':_0x8d2c('0x7'),'port':0x18eb});var socket=require(_0x8d2c('0x8'))(new Redis(config['redis']));require(_0x8d2c('0x9'))['register'](socket);function respondWithStatusCode(_0x1ac0f2,_0x32f72e){_0x32f72e=_0x32f72e||0xcc;return function(_0x5a614a){if(_0x5a614a){return _0x1ac0f2[_0x8d2c('0xa')](_0x32f72e);}return _0x1ac0f2[_0x8d2c('0xb')](_0x32f72e)[_0x8d2c('0xc')]();};}function respondWithResult(_0x3d41e1,_0x103455){_0x103455=_0x103455||0xc8;return function(_0xbaee83){if(_0xbaee83){return _0x3d41e1[_0x8d2c('0xb')](_0x103455)[_0x8d2c('0xd')](_0xbaee83);}};}function respondWithFilteredResult(_0x547e43,_0x4f92f2){return function(_0x5e170f){if(_0x5e170f){var _0x10aa20=typeof _0x4f92f2[_0x8d2c('0xe')]===_0x8d2c('0xf')&&typeof _0x4f92f2['limit']==='undefined';var _0x27d9a0=_0x5e170f[_0x8d2c('0x10')];var _0x595a01=_0x10aa20?0x0:_0x4f92f2['offset'];var _0x94f461=_0x10aa20?_0x5e170f[_0x8d2c('0x10')]:_0x4f92f2['offset']+_0x4f92f2[_0x8d2c('0x11')];var _0x550cdd;if(_0x94f461>=_0x27d9a0){_0x94f461=_0x27d9a0;_0x550cdd=0xc8;}else{_0x550cdd=0xce;}_0x547e43['status'](_0x550cdd);return _0x547e43[_0x8d2c('0x12')]('Content-Range',_0x595a01+'-'+_0x94f461+'/'+_0x27d9a0)['json'](_0x5e170f);}return null;};}function saveUpdates(_0x3153f1){return function(_0xa3b0e8){if(_0xa3b0e8){return _0xa3b0e8[_0x8d2c('0x13')](_0x3153f1)['then'](function(_0x34b914){return _0x34b914;});}return null;};}function removeEntity(_0xefd7e0){return function(_0x5b4f9a){if(_0x5b4f9a){return _0x5b4f9a[_0x8d2c('0x14')]()[_0x8d2c('0x15')](function(){var _0x9c8e34=_0x5b4f9a[_0x8d2c('0x16')]({'plain':!![]});var _0x55afba=_0x8d2c('0x17');return db[_0x8d2c('0x18')][_0x8d2c('0x14')]({'where':{'type':_0x55afba,'resourceId':_0x9c8e34['id']}})[_0x8d2c('0x15')](function(){return _0x5b4f9a;});})[_0x8d2c('0x15')](function(){_0xefd7e0[_0x8d2c('0xb')](0xcc)[_0x8d2c('0xc')]();});}};}function handleEntityNotFound(_0x10e81e){return function(_0x31a109){if(!_0x31a109){_0x10e81e['sendStatus'](0x194);}return _0x31a109;};}function handleError(_0x450bc5,_0x27de3a){_0x27de3a=_0x27de3a||0x1f4;return function(_0x959de6){logger[_0x8d2c('0x19')](_0x959de6[_0x8d2c('0x1a')]);if(_0x959de6[_0x8d2c('0x1b')]){delete _0x959de6[_0x8d2c('0x1b')];}_0x450bc5[_0x8d2c('0xb')](_0x27de3a)[_0x8d2c('0x1c')](_0x959de6);};}exports[_0x8d2c('0x1d')]=function(_0x466478,_0x4b02d5){var _0x3fb93e={};var _0x376d2a={'count':0x0,'rows':[]};var _0x24bbe0=_[_0x8d2c('0x1e')](db[_0x8d2c('0x1f')][_0x8d2c('0x20')],function(_0x2ce8b3){return{'name':_0x2ce8b3[_0x8d2c('0x21')],'type':_0x2ce8b3['type'][_0x8d2c('0x22')]};});_0x3fb93e=qs[_0x8d2c('0x23')](_0x24bbe0,_0x466478);var _0xd606ae={'where':_0x3fb93e[_0x8d2c('0x24')]};return db[_0x8d2c('0x1f')]['count'](_0xd606ae)[_0x8d2c('0x15')](function(_0x110f24){_0x376d2a['count']=_0x110f24;_0x3fb93e[_0x8d2c('0x25')]=qs[_0x8d2c('0x25')](_0x466478[_0x8d2c('0x26')]);return db['MailQueue'][_0x8d2c('0x27')](_0x3fb93e);})[_0x8d2c('0x15')](function(_0x4e5c85){_0x376d2a[_0x8d2c('0x28')]=_0x4e5c85;return _0x376d2a;})['then'](respondWithFilteredResult(_0x4b02d5,_0x3fb93e))[_0x8d2c('0x29')](handleError(_0x4b02d5,null));};exports[_0x8d2c('0x2a')]=function(_0x129eb2,_0x148a3b){var _0x22dc31={'raw':!![],'where':{'id':_0x129eb2['params']['id']}},_0x20c66a={};_0x20c66a['model']=_['keys'](db[_0x8d2c('0x1f')]['rawAttributes']);_0x20c66a[_0x8d2c('0x26')]=_[_0x8d2c('0x2b')](_0x129eb2[_0x8d2c('0x26')]);_0x20c66a[_0x8d2c('0x2c')]=_[_0x8d2c('0x2d')](_0x20c66a[_0x8d2c('0x2e')],_0x20c66a[_0x8d2c('0x26')]);_0x22dc31['attributes']=_[_0x8d2c('0x2d')](_0x20c66a[_0x8d2c('0x2e')],qs[_0x8d2c('0x2f')](_0x129eb2[_0x8d2c('0x26')]['fields']));_0x22dc31[_0x8d2c('0x30')]=_0x22dc31[_0x8d2c('0x30')][_0x8d2c('0x31')]?_0x22dc31['attributes']:_0x20c66a['model'];if(_0x129eb2[_0x8d2c('0x26')][_0x8d2c('0x32')]){_0x22dc31[_0x8d2c('0x25')]=[{'all':!![]}];}_0x22dc31=_[_0x8d2c('0x33')]({},_0x22dc31,_0x129eb2[_0x8d2c('0x34')]);return db[_0x8d2c('0x1f')]['find'](_0x22dc31)[_0x8d2c('0x15')](handleEntityNotFound(_0x148a3b,null))[_0x8d2c('0x15')](respondWithResult(_0x148a3b,null))[_0x8d2c('0x29')](handleError(_0x148a3b,null));};exports[_0x8d2c('0x35')]=function(_0x39b044,_0xa45150){return db[_0x8d2c('0x1f')][_0x8d2c('0x35')](_0x39b044[_0x8d2c('0x36')],{})['then'](function(_0x62de10){var _0x519539=_0x39b044[_0x8d2c('0x37')][_0x8d2c('0x16')]({'plain':!![]});if(!_0x519539)throw new Error(_0x8d2c('0x38'));if(_0x519539[_0x8d2c('0x39')]===_0x8d2c('0x37')){var _0x3e37fe=_0x62de10['get']({'plain':!![]});var _0x332fce=_0x8d2c('0x17');return db[_0x8d2c('0x3a')][_0x8d2c('0x3b')]({'where':{'name':_0x332fce,'userProfileId':_0x519539[_0x8d2c('0x3c')]},'raw':!![]})[_0x8d2c('0x15')](function(_0x50a147){if(_0x50a147&&_0x50a147[_0x8d2c('0x3d')]===0x0){return db[_0x8d2c('0x18')][_0x8d2c('0x35')]({'name':_0x3e37fe[_0x8d2c('0x1b')],'resourceId':_0x3e37fe['id'],'type':_0x50a147[_0x8d2c('0x1b')],'sectionId':_0x50a147['id']},{})[_0x8d2c('0x15')](function(){return _0x62de10;});}else{return _0x62de10;}})[_0x8d2c('0x29')](function(_0x200e33){logger[_0x8d2c('0x19')](_0x8d2c('0x3e'),_0x200e33);throw _0x200e33;});}return _0x62de10;})[_0x8d2c('0x15')](respondWithResult(_0xa45150,0xc9))['catch'](handleError(_0xa45150,null));};exports['update']=function(_0x5ce4e7,_0x3c6f39){if(_0x5ce4e7[_0x8d2c('0x36')]['id']){delete _0x5ce4e7[_0x8d2c('0x36')]['id'];}return db[_0x8d2c('0x1f')][_0x8d2c('0x3b')]({'where':{'id':_0x5ce4e7[_0x8d2c('0x3f')]['id']}})[_0x8d2c('0x15')](handleEntityNotFound(_0x3c6f39,null))[_0x8d2c('0x15')](saveUpdates(_0x5ce4e7[_0x8d2c('0x36')],null))[_0x8d2c('0x15')](respondWithResult(_0x3c6f39,null))[_0x8d2c('0x29')](handleError(_0x3c6f39,null));};exports[_0x8d2c('0x14')]=function(_0x507448,_0x5c0c5c){return db[_0x8d2c('0x1f')][_0x8d2c('0x3b')]({'where':{'id':_0x507448[_0x8d2c('0x3f')]['id']}})[_0x8d2c('0x15')](handleEntityNotFound(_0x5c0c5c,null))['then'](removeEntity(_0x5c0c5c,null))[_0x8d2c('0x29')](handleError(_0x5c0c5c,null));};exports['describe']=function(_0x266437,_0x10e765){return db[_0x8d2c('0x1f')][_0x8d2c('0x40')]()['then'](respondWithResult(_0x10e765,null))[_0x8d2c('0x29')](handleError(_0x10e765,null));};exports[_0x8d2c('0x41')]=function(_0xad904e,_0x5d0378){var _0x553cd1={'raw':!![],'where':{}},_0x5bad93={},_0xe7220c;return db[_0x8d2c('0x1f')][_0x8d2c('0x42')]({'where':{'id':_0xad904e[_0x8d2c('0x3f')]['id']}})[_0x8d2c('0x15')](handleEntityNotFound(_0x5d0378,null))[_0x8d2c('0x15')](function(_0x84885a){if(_0x84885a){_0xe7220c=_0x84885a['get']({'plain':!![]});_0x5bad93['model']=_[_0x8d2c('0x2b')](db[_0x8d2c('0x43')][_0x8d2c('0x20')]);_0x5bad93[_0x8d2c('0x26')]=_[_0x8d2c('0x2b')](_0xad904e[_0x8d2c('0x26')]);_0x5bad93[_0x8d2c('0x2c')]=_[_0x8d2c('0x2d')](_0x5bad93['model'],_0x5bad93[_0x8d2c('0x26')]);_0x553cd1[_0x8d2c('0x30')]=_[_0x8d2c('0x2d')](_0x5bad93[_0x8d2c('0x2e')],qs['fields'](_0xad904e[_0x8d2c('0x26')]['fields']));_0x553cd1['attributes']=_0x553cd1[_0x8d2c('0x30')][_0x8d2c('0x31')]?_0x553cd1[_0x8d2c('0x30')]:_0x5bad93['model'];if(!_0xad904e[_0x8d2c('0x26')]['hasOwnProperty'](_0x8d2c('0x44'))){_0x553cd1[_0x8d2c('0x11')]=qs['limit'](_0xad904e[_0x8d2c('0x26')]['limit']);_0x553cd1[_0x8d2c('0xe')]=qs[_0x8d2c('0xe')](_0xad904e[_0x8d2c('0x26')]['offset']);}_0x553cd1[_0x8d2c('0x45')]=qs[_0x8d2c('0x46')](_0xad904e[_0x8d2c('0x26')][_0x8d2c('0x46')]);_0x553cd1[_0x8d2c('0x24')]=qs[_0x8d2c('0x2c')](_['pick'](_0xad904e[_0x8d2c('0x26')],_0x5bad93[_0x8d2c('0x2c')]));_0x553cd1[_0x8d2c('0x24')][_0x8d2c('0x47')]=_0x84885a['id'];if(_0xad904e[_0x8d2c('0x26')][_0x8d2c('0x48')]){_0x553cd1[_0x8d2c('0x24')]=_[_0x8d2c('0x33')](_0x553cd1[_0x8d2c('0x24')],{'$or':_[_0x8d2c('0x1e')](_0x553cd1[_0x8d2c('0x30')],function(_0x27ffab){var _0x4b9219={};_0x4b9219[_0x27ffab]={'$like':'%'+_0xad904e[_0x8d2c('0x26')]['filter']+'%'};return _0x4b9219;})});}_0x553cd1=_[_0x8d2c('0x33')]({},_0x553cd1,_0xad904e['options']);return db['UserMailQueue']['findAll'](_0x553cd1);}})[_0x8d2c('0x15')](function(_0x569c85){if(_0x569c85){return db['User'][_0x8d2c('0x49')]({'where':{'id':_[_0x8d2c('0x1e')](_0x569c85,_0x8d2c('0x4a')),'role':_0x8d2c('0x4b')},'attributes':['id','name','mailPause',_0x8d2c('0x4c'),_0x8d2c('0x4d')]});}})[_0x8d2c('0x15')](function(_0x300e26){if(_0x300e26){return{'count':_0x300e26[_0x8d2c('0x10')],'rows':_[_0x8d2c('0x1e')](_0x300e26[_0x8d2c('0x28')],function(_0x1940f7){return{'membername':_0x1940f7['name'],'UserId':_0x1940f7['id'],'queue_name':_0xe7220c[_0x8d2c('0x1b')],'MailQueueId':_0xe7220c['id'],'interface':util[_0x8d2c('0x4e')](_0x8d2c('0x4f'),'SIP',_0x1940f7[_0x8d2c('0x1b')]),'penalty':0x0,'paused':_0x1940f7[_0x8d2c('0x50')],'createdAt':_0x1940f7['createdAt'],'updatedAt':_0x1940f7[_0x8d2c('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d2c('0x15')](respondWithFilteredResult(_0x5d0378,_0x553cd1))[_0x8d2c('0x29')](handleError(_0x5d0378,null));};exports[_0x8d2c('0x51')]=function(_0x3fd832,_0x53cce8){var _0x1da148={};var _0x4c796f={};var _0x2f02d7;var _0xae0799;return db[_0x8d2c('0x1f')][_0x8d2c('0x42')]({'where':{'id':_0x3fd832['params']['id']}})[_0x8d2c('0x15')](handleEntityNotFound(_0x53cce8,null))[_0x8d2c('0x15')](function(_0x2040c6){if(_0x2040c6){_0x2f02d7=_0x2040c6;_0x4c796f[_0x8d2c('0x2e')]=_[_0x8d2c('0x2b')](db['Team']['rawAttributes']);_0x4c796f[_0x8d2c('0x26')]=_['keys'](_0x3fd832[_0x8d2c('0x26')]);_0x4c796f[_0x8d2c('0x2c')]=_[_0x8d2c('0x2d')](_0x4c796f['model'],_0x4c796f['query']);_0x1da148[_0x8d2c('0x30')]=_[_0x8d2c('0x2d')](_0x4c796f[_0x8d2c('0x2e')],qs['fields'](_0x3fd832[_0x8d2c('0x26')][_0x8d2c('0x2f')]));_0x1da148['attributes']=_0x1da148[_0x8d2c('0x30')][_0x8d2c('0x31')]?_0x1da148[_0x8d2c('0x30')]:_0x4c796f['model'];_0x1da148[_0x8d2c('0x45')]=qs[_0x8d2c('0x46')](_0x3fd832['query'][_0x8d2c('0x46')]);_0x1da148[_0x8d2c('0x24')]=qs[_0x8d2c('0x2c')](_[_0x8d2c('0x52')](_0x3fd832[_0x8d2c('0x26')],_0x4c796f[_0x8d2c('0x2c')]));if(_0x3fd832[_0x8d2c('0x26')][_0x8d2c('0x48')]){_0x1da148[_0x8d2c('0x24')]=_[_0x8d2c('0x33')](_0x1da148[_0x8d2c('0x24')],{'$or':_[_0x8d2c('0x1e')](_0x1da148['attributes'],function(_0x1cfc66){var _0x44da42={};_0x44da42[_0x1cfc66]={'$like':'%'+_0x3fd832[_0x8d2c('0x26')][_0x8d2c('0x48')]+'%'};return _0x44da42;})});}_0x1da148=_[_0x8d2c('0x33')]({},_0x1da148,_0x3fd832[_0x8d2c('0x34')]);return _0x2f02d7[_0x8d2c('0x51')](_0x1da148);}})['then'](function(_0x30d9ec){if(_0x30d9ec){_0xae0799=_0x30d9ec[_0x8d2c('0x31')];if(!_0x3fd832['query']['hasOwnProperty'](_0x8d2c('0x44'))){_0x1da148[_0x8d2c('0x11')]=qs[_0x8d2c('0x11')](_0x3fd832['query'][_0x8d2c('0x11')]);_0x1da148[_0x8d2c('0xe')]=qs['offset'](_0x3fd832['query'][_0x8d2c('0xe')]);}return _0x2f02d7[_0x8d2c('0x51')](_0x1da148);}})[_0x8d2c('0x15')](function(_0x194184){if(_0x194184){return _0x194184?{'count':_0xae0799,'rows':_0x194184}:null;}})[_0x8d2c('0x15')](respondWithResult(_0x53cce8,null))['catch'](handleError(_0x53cce8,null));};exports[_0x8d2c('0x53')]=function(_0x47e09e,_0xf894f){var _0xa3cda7=_0x47e09e['body'][_0x8d2c('0x54')];return db[_0x8d2c('0x55')]['findAll']({'where':{'id':_0xa3cda7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8d2c('0x56'),'attributes':['id',_0x8d2c('0x1b'),'online',_0x8d2c('0x57'),'interface'],'raw':!![]}]})[_0x8d2c('0x15')](function(_0x441db8){if(_0x441db8){var _0x19ebfb=_['flatMap'](_0x441db8,function(_0x3599a8){var _0x3d3755=_0x3599a8['get']({'plain':!![]});return _0x3d3755[_0x8d2c('0x56')];});return db[_0x8d2c('0x1f')][_0x8d2c('0x3b')]({'where':{'id':_0x47e09e[_0x8d2c('0x3f')]['id']}})[_0x8d2c('0x15')](function(_0x3f3843){return db[_0x8d2c('0x58')][_0x8d2c('0x59')](function(_0x4e05d8){return _0x3f3843[_0x8d2c('0x53')](_0xa3cda7,{'transaction':_0x4e05d8})[_0x8d2c('0x15')](function(){return BPromise[_0x8d2c('0x5a')](_0x19ebfb,function(_0xc9b386){return db[_0x8d2c('0x43')][_0x8d2c('0x5b')]({'where':{'UserId':_0xc9b386['id'],'MailQueueId':_0x47e09e[_0x8d2c('0x3f')]['id']},'transaction':_0x4e05d8});});})['then'](function(){_0x19ebfb[_0x8d2c('0x5c')](function(_0x56bebb){socket['emit']('userMailQueue:save',{'UserId':_0x56bebb['id'],'MailQueueId':_0x3f3843['id']});});});});});}})[_0x8d2c('0x15')](respondWithStatusCode(_0xf894f,null))[_0x8d2c('0x29')](handleError(_0xf894f,null));};exports[_0x8d2c('0x5d')]=function(_0x48dd81,_0x54a72d){return db[_0x8d2c('0x55')][_0x8d2c('0x27')]({'where':{'id':_0x48dd81[_0x8d2c('0x26')][_0x8d2c('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8d2c('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8d2c('0x15')](handleEntityNotFound(_0x54a72d,null))[_0x8d2c('0x15')](function(_0x12e746){var _0x119503=_[_0x8d2c('0x1e')](_0x12e746,'id');var _0x1a8b9a=[];var _0x4704e7=[];var _0x41986a=squel[_0x8d2c('0x5e')]();_0x41986a[_0x8d2c('0x5f')](_0x8d2c('0x60'))[_0x8d2c('0x61')]('team_has_mail_queues','tq')[_0x8d2c('0x62')](_0x8d2c('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8d2c('0x24')](_0x8d2c('0x64'),_0x48dd81['params']['id']);for(var _0x4b07d3=0x0;_0x4b07d3<_0x12e746[_0x8d2c('0x31')];_0x4b07d3+=0x1){let _0x476ca9=_0x12e746[_0x4b07d3];for(var _0x3fd413=0x0;_0x3fd413<_0x476ca9[_0x8d2c('0x56')][_0x8d2c('0x31')];_0x3fd413+=0x1){let _0x450f2e=_0x476ca9[_0x8d2c('0x56')][_0x3fd413];var _0x5a33e2=_0x41986a[_0x8d2c('0x65')]();_0x5a33e2[_0x8d2c('0x24')]('ut.UserId\x20=\x20?',_0x450f2e['id']);_0x4704e7[_0x8d2c('0x66')](db['sequelize'][_0x8d2c('0x26')](_0x5a33e2[_0x8d2c('0x67')](),{'type':db[_0x8d2c('0x58')][_0x8d2c('0x68')][_0x8d2c('0x69')]})['then'](function(_0x138186){if(_0x138186[_0x8d2c('0x31')]===0x1){return _0x450f2e['id'];}else{var _0x58ece0=_[_0x8d2c('0x6a')](_[_0x8d2c('0x1e')](_0x138186,'TeamId'),function(_0x5a239d){return _['includes'](_0x119503,_0x5a239d);});if(_0x58ece0){return _0x450f2e['id'];}}}));}}return BPromise[_0x8d2c('0x6b')](_0x4704e7)[_0x8d2c('0x15')](function(_0x14fe27){_0x1a8b9a=_(_0x1a8b9a)[_0x8d2c('0x6c')](_0x14fe27)['compact']()['value']();return db['MailQueue'][_0x8d2c('0x3b')]({'where':{'id':_0x48dd81[_0x8d2c('0x3f')]['id']}})[_0x8d2c('0x15')](function(_0x3f1895){return db[_0x8d2c('0x58')][_0x8d2c('0x59')](function(_0xf3652a){return _0x3f1895['removeTeams'](_0x48dd81[_0x8d2c('0x26')]['ids'],{'transaction':_0xf3652a})[_0x8d2c('0x15')](function(){if(!_[_0x8d2c('0x6d')](_0x1a8b9a)){return _0x3f1895[_0x8d2c('0x6e')](_0x1a8b9a,{'transaction':_0xf3652a});}})[_0x8d2c('0x15')](function(){_0x1a8b9a[_0x8d2c('0x5c')](function(_0x59937f){socket[_0x8d2c('0x6f')](_0x8d2c('0x70'),{'UserId':_0x59937f,'MailQueueId':_0x3f1895['id']});});});});});});})['then'](respondWithStatusCode(_0x54a72d,null))['catch'](handleError(_0x54a72d,null));};exports[_0x8d2c('0x71')]=function(_0x51e0fe,_0x3494f3){return db[_0x8d2c('0x1f')][_0x8d2c('0x3b')]({'where':{'id':_0x51e0fe[_0x8d2c('0x3f')]['id']}})[_0x8d2c('0x15')](handleEntityNotFound(_0x3494f3,null))[_0x8d2c('0x15')](function(_0x1d6408){if(_0x1d6408){return _0x1d6408[_0x8d2c('0x71')](_0x51e0fe['body'][_0x8d2c('0x54')],_[_0x8d2c('0x72')](_0x51e0fe[_0x8d2c('0x36')],[_0x8d2c('0x54'),'id'])||{})[_0x8d2c('0x73')](function(_0x5cef2a){for(var _0x20534b=0x0;_0x20534b<_0x51e0fe['body']['ids'][_0x8d2c('0x31')];_0x20534b+=0x1){socket[_0x8d2c('0x6f')](_0x8d2c('0x74'),{'UserId':Number(_0x51e0fe[_0x8d2c('0x36')][_0x8d2c('0x54')][_0x20534b]),'MailQueueId':Number(_0x51e0fe[_0x8d2c('0x3f')]['id'])});}return _0x5cef2a;});}})[_0x8d2c('0x15')](respondWithResult(_0x3494f3,null))[_0x8d2c('0x29')](handleError(_0x3494f3,null));};exports[_0x8d2c('0x6e')]=function(_0x4cae4c,_0x590dca){return db['MailQueue'][_0x8d2c('0x3b')]({'where':{'id':_0x4cae4c[_0x8d2c('0x3f')]['id']}})[_0x8d2c('0x15')](handleEntityNotFound(_0x590dca,null))[_0x8d2c('0x15')](function(_0x16b05d){if(_0x16b05d){return _0x16b05d[_0x8d2c('0x6e')](_0x4cae4c[_0x8d2c('0x26')][_0x8d2c('0x54')])['then'](function(){if(_[_0x8d2c('0x75')](_0x4cae4c[_0x8d2c('0x26')][_0x8d2c('0x54')])){for(var _0x11f7bb=0x0;_0x11f7bb<_0x4cae4c['query']['ids']['length'];_0x11f7bb+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4cae4c[_0x8d2c('0x26')][_0x8d2c('0x54')][_0x11f7bb]),'MailQueueId':Number(_0x4cae4c[_0x8d2c('0x3f')]['id'])});}}else{socket[_0x8d2c('0x6f')](_0x8d2c('0x70'),{'UserId':Number(_0x4cae4c[_0x8d2c('0x26')]['ids']),'MailQueueId':Number(_0x4cae4c[_0x8d2c('0x3f')]['id'])});}});}})[_0x8d2c('0x15')](respondWithStatusCode(_0x590dca,null))[_0x8d2c('0x29')](handleError(_0x590dca,null));};exports[_0x8d2c('0x76')]=function(_0x136f70,_0x5b4690){var _0x18f2d1={};var _0x139f9a={};var _0x298de3;var _0x46b6df;return db['MailQueue'][_0x8d2c('0x42')]({'where':{'id':_0x136f70['params']['id']}})[_0x8d2c('0x15')](handleEntityNotFound(_0x5b4690,null))[_0x8d2c('0x15')](function(_0x3ca381){if(_0x3ca381){_0x298de3=_0x3ca381;_0x139f9a[_0x8d2c('0x2e')]=_['keys'](db['User'][_0x8d2c('0x20')]);_0x139f9a[_0x8d2c('0x26')]=_[_0x8d2c('0x2b')](_0x136f70['query']);_0x139f9a[_0x8d2c('0x2c')]=_[_0x8d2c('0x2d')](_0x139f9a[_0x8d2c('0x2e')],_0x139f9a[_0x8d2c('0x26')]);_0x18f2d1['attributes']=_[_0x8d2c('0x2d')](_0x139f9a[_0x8d2c('0x2e')],qs[_0x8d2c('0x2f')](_0x136f70[_0x8d2c('0x26')][_0x8d2c('0x2f')]));_0x18f2d1[_0x8d2c('0x30')]=_0x18f2d1[_0x8d2c('0x30')][_0x8d2c('0x31')]?_0x18f2d1[_0x8d2c('0x30')]:_0x139f9a[_0x8d2c('0x2e')];_0x18f2d1[_0x8d2c('0x45')]=qs[_0x8d2c('0x46')](_0x136f70[_0x8d2c('0x26')][_0x8d2c('0x46')]);_0x18f2d1[_0x8d2c('0x24')]=qs[_0x8d2c('0x2c')](_[_0x8d2c('0x52')](_0x136f70[_0x8d2c('0x26')],_0x139f9a[_0x8d2c('0x2c')]));if(_0x136f70[_0x8d2c('0x26')][_0x8d2c('0x48')]){_0x18f2d1[_0x8d2c('0x24')]=_[_0x8d2c('0x33')](_0x18f2d1[_0x8d2c('0x24')],{'$or':_['map'](_0x18f2d1['attributes'],function(_0x5a499d){var _0x4423aa={};_0x4423aa[_0x5a499d]={'$like':'%'+_0x136f70[_0x8d2c('0x26')][_0x8d2c('0x48')]+'%'};return _0x4423aa;})});}_0x18f2d1=_[_0x8d2c('0x33')]({},_0x18f2d1,_0x136f70[_0x8d2c('0x34')]);return _0x298de3[_0x8d2c('0x76')](_0x18f2d1);}})[_0x8d2c('0x15')](function(_0x2d94e7){if(_0x2d94e7){_0x46b6df=_0x2d94e7[_0x8d2c('0x31')];if(!_0x136f70[_0x8d2c('0x26')][_0x8d2c('0x77')](_0x8d2c('0x44'))){_0x18f2d1[_0x8d2c('0x11')]=qs[_0x8d2c('0x11')](_0x136f70[_0x8d2c('0x26')]['limit']);_0x18f2d1[_0x8d2c('0xe')]=qs[_0x8d2c('0xe')](_0x136f70[_0x8d2c('0x26')][_0x8d2c('0xe')]);}return _0x298de3['getAgents'](_0x18f2d1);}})[_0x8d2c('0x15')](function(_0x59fc3c){if(_0x59fc3c){return _0x59fc3c?{'count':_0x46b6df,'rows':_0x59fc3c}:null;}})['then'](respondWithResult(_0x5b4690,null))[_0x8d2c('0x29')](handleError(_0x5b4690,null));}; \ No newline at end of file +var _0xa914=['getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','MailQueues','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','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','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','mailPause','getTeams','Team','addTeams','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray'];(function(_0xf62e6c,_0x160938){var _0x14234f=function(_0x16fe1d){while(--_0x16fe1d){_0xf62e6c['push'](_0xf62e6c['shift']());}};_0x14234f(++_0x160938);}(_0xa914,0x184));var _0x4a91=function(_0x323fff,_0x38f93e){_0x323fff=_0x323fff-0x0;var _0x326de5=_0xa914[_0x323fff];return _0x326de5;};'use strict';var BPromise=require(_0x4a91('0x0'));var util=require(_0x4a91('0x1'));var _=require(_0x4a91('0x2'));var squel=require(_0x4a91('0x3'));var Redis=require(_0x4a91('0x4'));var qs=require(_0x4a91('0x5'));var logger=require(_0x4a91('0x6'))(_0x4a91('0x7'));var config=require(_0x4a91('0x8'));var db=require(_0x4a91('0x9'))['db'];config[_0x4a91('0xa')]=_[_0x4a91('0xb')](config[_0x4a91('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a91('0xa')]));require(_0x4a91('0xc'))[_0x4a91('0xd')](socket);function respondWithStatusCode(_0x606c79,_0x2c1222){_0x2c1222=_0x2c1222||0xcc;return function(_0x40f3a8){if(_0x40f3a8){return _0x606c79[_0x4a91('0xe')](_0x2c1222);}return _0x606c79[_0x4a91('0xf')](_0x2c1222)[_0x4a91('0x10')]();};}function respondWithResult(_0x542685,_0x37f216){_0x37f216=_0x37f216||0xc8;return function(_0x2550c7){if(_0x2550c7){return _0x542685[_0x4a91('0xf')](_0x37f216)[_0x4a91('0x11')](_0x2550c7);}};}function respondWithFilteredResult(_0x2e63f8,_0x2fa771){return function(_0x18ea44){if(_0x18ea44){var _0x575405=typeof _0x2fa771['offset']===_0x4a91('0x12')&&typeof _0x2fa771[_0x4a91('0x13')]===_0x4a91('0x12');var _0x3ad98d=_0x18ea44[_0x4a91('0x14')];var _0x1c2c57=_0x575405?0x0:_0x2fa771['offset'];var _0x1c86ce=_0x575405?_0x18ea44[_0x4a91('0x14')]:_0x2fa771[_0x4a91('0x15')]+_0x2fa771[_0x4a91('0x13')];var _0x2d2b0f;if(_0x1c86ce>=_0x3ad98d){_0x1c86ce=_0x3ad98d;_0x2d2b0f=0xc8;}else{_0x2d2b0f=0xce;}_0x2e63f8['status'](_0x2d2b0f);return _0x2e63f8[_0x4a91('0x16')](_0x4a91('0x17'),_0x1c2c57+'-'+_0x1c86ce+'/'+_0x3ad98d)[_0x4a91('0x11')](_0x18ea44);}return null;};}function saveUpdates(_0x2bc9ca){return function(_0x5da8d9){if(_0x5da8d9){return _0x5da8d9[_0x4a91('0x18')](_0x2bc9ca)[_0x4a91('0x19')](function(_0x4d6360){return _0x4d6360;});}return null;};}function removeEntity(_0x33a467){return function(_0x4b1acf){if(_0x4b1acf){return _0x4b1acf['destroy']()[_0x4a91('0x19')](function(){var _0x573183=_0x4b1acf['get']({'plain':!![]});var _0x32d3e5=_0x4a91('0x1a');return db['UserProfileResource'][_0x4a91('0x1b')]({'where':{'type':_0x32d3e5,'resourceId':_0x573183['id']}})[_0x4a91('0x19')](function(){return _0x4b1acf;});})['then'](function(){_0x33a467[_0x4a91('0xf')](0xcc)[_0x4a91('0x10')]();});}};}function handleEntityNotFound(_0x19b9d6){return function(_0x4cbc46){if(!_0x4cbc46){_0x19b9d6[_0x4a91('0xe')](0x194);}return _0x4cbc46;};}function handleError(_0x62f1ab,_0x431da5){_0x431da5=_0x431da5||0x1f4;return function(_0x45efc0){logger[_0x4a91('0x1c')](_0x45efc0[_0x4a91('0x1d')]);if(_0x45efc0[_0x4a91('0x1e')]){delete _0x45efc0[_0x4a91('0x1e')];}_0x62f1ab[_0x4a91('0xf')](_0x431da5)[_0x4a91('0x1f')](_0x45efc0);};}exports[_0x4a91('0x20')]=function(_0x5054a1,_0x2151dc){var _0xb1d2c7={};var _0x1509b5={'count':0x0,'rows':[]};var _0xdbe7ae=_[_0x4a91('0x21')](db[_0x4a91('0x22')][_0x4a91('0x23')],function(_0x5628bb){return{'name':_0x5628bb[_0x4a91('0x24')],'type':_0x5628bb[_0x4a91('0x25')][_0x4a91('0x26')]};});_0xb1d2c7=qs[_0x4a91('0x27')](_0xdbe7ae,_0x5054a1);var _0x59f49d={'where':_0xb1d2c7[_0x4a91('0x28')]};return db[_0x4a91('0x22')][_0x4a91('0x14')](_0x59f49d)['then'](function(_0x4722b3){_0x1509b5['count']=_0x4722b3;_0xb1d2c7[_0x4a91('0x29')]=qs[_0x4a91('0x29')](_0x5054a1[_0x4a91('0x2a')]);return db[_0x4a91('0x22')][_0x4a91('0x2b')](_0xb1d2c7);})[_0x4a91('0x19')](function(_0x560a25){_0x1509b5[_0x4a91('0x2c')]=_0x560a25;return _0x1509b5;})[_0x4a91('0x19')](respondWithFilteredResult(_0x2151dc,_0xb1d2c7))['catch'](handleError(_0x2151dc,null));};exports[_0x4a91('0x2d')]=function(_0x437ab1,_0x17af88){var _0x2e9a6={'raw':!![],'where':{'id':_0x437ab1['params']['id']}},_0x8f26d9={};_0x8f26d9[_0x4a91('0x2e')]=_[_0x4a91('0x2f')](db[_0x4a91('0x22')][_0x4a91('0x23')]);_0x8f26d9[_0x4a91('0x2a')]=_['keys'](_0x437ab1['query']);_0x8f26d9[_0x4a91('0x30')]=_[_0x4a91('0x31')](_0x8f26d9[_0x4a91('0x2e')],_0x8f26d9[_0x4a91('0x2a')]);_0x2e9a6['attributes']=_[_0x4a91('0x31')](_0x8f26d9['model'],qs['fields'](_0x437ab1[_0x4a91('0x2a')][_0x4a91('0x32')]));_0x2e9a6[_0x4a91('0x33')]=_0x2e9a6[_0x4a91('0x33')][_0x4a91('0x34')]?_0x2e9a6['attributes']:_0x8f26d9[_0x4a91('0x2e')];if(_0x437ab1['query'][_0x4a91('0x35')]){_0x2e9a6[_0x4a91('0x29')]=[{'all':!![]}];}_0x2e9a6=_[_0x4a91('0x36')]({},_0x2e9a6,_0x437ab1[_0x4a91('0x37')]);return db[_0x4a91('0x22')][_0x4a91('0x38')](_0x2e9a6)[_0x4a91('0x19')](handleEntityNotFound(_0x17af88,null))[_0x4a91('0x19')](respondWithResult(_0x17af88,null))[_0x4a91('0x39')](handleError(_0x17af88,null));};exports[_0x4a91('0x3a')]=function(_0x52d832,_0x1596e8){return db['MailQueue'][_0x4a91('0x3a')](_0x52d832['body'],{})[_0x4a91('0x19')](function(_0x554f4c){var _0x2b2254=_0x52d832[_0x4a91('0x3b')][_0x4a91('0x3c')]({'plain':!![]});if(!_0x2b2254)throw new Error(_0x4a91('0x3d'));if(_0x2b2254[_0x4a91('0x3e')]===_0x4a91('0x3b')){var _0x1e6dd2=_0x554f4c[_0x4a91('0x3c')]({'plain':!![]});var _0x364739='MailQueues';return db[_0x4a91('0x3f')][_0x4a91('0x38')]({'where':{'name':_0x364739,'userProfileId':_0x2b2254[_0x4a91('0x40')]},'raw':!![]})[_0x4a91('0x19')](function(_0x3c74ce){if(_0x3c74ce&&_0x3c74ce[_0x4a91('0x41')]===0x0){return db['UserProfileResource'][_0x4a91('0x3a')]({'name':_0x1e6dd2['name'],'resourceId':_0x1e6dd2['id'],'type':_0x3c74ce[_0x4a91('0x1e')],'sectionId':_0x3c74ce['id']},{})['then'](function(){return _0x554f4c;});}else{return _0x554f4c;}})['catch'](function(_0x514ee4){logger[_0x4a91('0x1c')](_0x4a91('0x42'),_0x514ee4);throw _0x514ee4;});}return _0x554f4c;})['then'](respondWithResult(_0x1596e8,0xc9))[_0x4a91('0x39')](handleError(_0x1596e8,null));};exports[_0x4a91('0x18')]=function(_0x53be28,_0x4f8d4e){if(_0x53be28[_0x4a91('0x43')]['id']){delete _0x53be28[_0x4a91('0x43')]['id'];}return db[_0x4a91('0x22')][_0x4a91('0x38')]({'where':{'id':_0x53be28[_0x4a91('0x44')]['id']}})[_0x4a91('0x19')](handleEntityNotFound(_0x4f8d4e,null))[_0x4a91('0x19')](saveUpdates(_0x53be28[_0x4a91('0x43')],null))['then'](respondWithResult(_0x4f8d4e,null))[_0x4a91('0x39')](handleError(_0x4f8d4e,null));};exports[_0x4a91('0x1b')]=function(_0x26416b,_0xae7290){return db[_0x4a91('0x22')][_0x4a91('0x38')]({'where':{'id':_0x26416b[_0x4a91('0x44')]['id']}})['then'](handleEntityNotFound(_0xae7290,null))[_0x4a91('0x19')](removeEntity(_0xae7290,null))[_0x4a91('0x39')](handleError(_0xae7290,null));};exports['describe']=function(_0x128518,_0x577091){return db[_0x4a91('0x22')][_0x4a91('0x45')]()['then'](respondWithResult(_0x577091,null))[_0x4a91('0x39')](handleError(_0x577091,null));};exports[_0x4a91('0x46')]=function(_0x4db3cb,_0x388787){var _0x5d2750={'raw':!![],'where':{}},_0x3e6d22={},_0x29ea6d;return db[_0x4a91('0x22')][_0x4a91('0x47')]({'where':{'id':_0x4db3cb[_0x4a91('0x44')]['id']}})[_0x4a91('0x19')](handleEntityNotFound(_0x388787,null))[_0x4a91('0x19')](function(_0x468a78){if(_0x468a78){_0x29ea6d=_0x468a78['get']({'plain':!![]});_0x3e6d22[_0x4a91('0x2e')]=_[_0x4a91('0x2f')](db[_0x4a91('0x48')][_0x4a91('0x23')]);_0x3e6d22['query']=_[_0x4a91('0x2f')](_0x4db3cb[_0x4a91('0x2a')]);_0x3e6d22[_0x4a91('0x30')]=_[_0x4a91('0x31')](_0x3e6d22[_0x4a91('0x2e')],_0x3e6d22[_0x4a91('0x2a')]);_0x5d2750[_0x4a91('0x33')]=_[_0x4a91('0x31')](_0x3e6d22[_0x4a91('0x2e')],qs[_0x4a91('0x32')](_0x4db3cb[_0x4a91('0x2a')][_0x4a91('0x32')]));_0x5d2750[_0x4a91('0x33')]=_0x5d2750[_0x4a91('0x33')][_0x4a91('0x34')]?_0x5d2750[_0x4a91('0x33')]:_0x3e6d22[_0x4a91('0x2e')];if(!_0x4db3cb[_0x4a91('0x2a')][_0x4a91('0x49')](_0x4a91('0x4a'))){_0x5d2750[_0x4a91('0x13')]=qs[_0x4a91('0x13')](_0x4db3cb['query'][_0x4a91('0x13')]);_0x5d2750[_0x4a91('0x15')]=qs[_0x4a91('0x15')](_0x4db3cb['query']['offset']);}_0x5d2750[_0x4a91('0x4b')]=qs['sort'](_0x4db3cb[_0x4a91('0x2a')][_0x4a91('0x4c')]);_0x5d2750[_0x4a91('0x28')]=qs[_0x4a91('0x30')](_[_0x4a91('0x4d')](_0x4db3cb[_0x4a91('0x2a')],_0x3e6d22['filters']));_0x5d2750['where'][_0x4a91('0x4e')]=_0x468a78['id'];if(_0x4db3cb[_0x4a91('0x2a')][_0x4a91('0x4f')]){_0x5d2750[_0x4a91('0x28')]=_[_0x4a91('0x36')](_0x5d2750['where'],{'$or':_[_0x4a91('0x21')](_0x5d2750['attributes'],function(_0x29f681){var _0x51c6e2={};_0x51c6e2[_0x29f681]={'$like':'%'+_0x4db3cb[_0x4a91('0x2a')][_0x4a91('0x4f')]+'%'};return _0x51c6e2;})});}_0x5d2750=_[_0x4a91('0x36')]({},_0x5d2750,_0x4db3cb[_0x4a91('0x37')]);return db[_0x4a91('0x48')]['findAll'](_0x5d2750);}})[_0x4a91('0x19')](function(_0xf3345c){if(_0xf3345c){return db[_0x4a91('0x50')][_0x4a91('0x51')]({'where':{'id':_[_0x4a91('0x21')](_0xf3345c,_0x4a91('0x52')),'role':_0x4a91('0x53')},'attributes':['id',_0x4a91('0x1e'),'mailPause',_0x4a91('0x54'),_0x4a91('0x55')]});}})[_0x4a91('0x19')](function(_0x33a506){if(_0x33a506){return{'count':_0x33a506[_0x4a91('0x14')],'rows':_[_0x4a91('0x21')](_0x33a506[_0x4a91('0x2c')],function(_0x4c6c50){return{'membername':_0x4c6c50['name'],'UserId':_0x4c6c50['id'],'queue_name':_0x29ea6d[_0x4a91('0x1e')],'MailQueueId':_0x29ea6d['id'],'interface':util[_0x4a91('0x56')]('%s/%s',_0x4a91('0x57'),_0x4c6c50[_0x4a91('0x1e')]),'penalty':0x0,'paused':_0x4c6c50[_0x4a91('0x58')],'createdAt':_0x4c6c50[_0x4a91('0x55')],'updatedAt':_0x4c6c50[_0x4a91('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4a91('0x19')](respondWithFilteredResult(_0x388787,_0x5d2750))['catch'](handleError(_0x388787,null));};exports[_0x4a91('0x59')]=function(_0x2a099c,_0x1f1380){var _0x2a97e6={};var _0x4806b9={};var _0x410d1d;var _0x2d7eb0;return db['MailQueue'][_0x4a91('0x47')]({'where':{'id':_0x2a099c['params']['id']}})[_0x4a91('0x19')](handleEntityNotFound(_0x1f1380,null))['then'](function(_0x1fe6f1){if(_0x1fe6f1){_0x410d1d=_0x1fe6f1;_0x4806b9[_0x4a91('0x2e')]=_[_0x4a91('0x2f')](db[_0x4a91('0x5a')]['rawAttributes']);_0x4806b9[_0x4a91('0x2a')]=_[_0x4a91('0x2f')](_0x2a099c[_0x4a91('0x2a')]);_0x4806b9['filters']=_['intersection'](_0x4806b9['model'],_0x4806b9[_0x4a91('0x2a')]);_0x2a97e6['attributes']=_[_0x4a91('0x31')](_0x4806b9['model'],qs['fields'](_0x2a099c[_0x4a91('0x2a')][_0x4a91('0x32')]));_0x2a97e6[_0x4a91('0x33')]=_0x2a97e6[_0x4a91('0x33')]['length']?_0x2a97e6['attributes']:_0x4806b9[_0x4a91('0x2e')];_0x2a97e6['order']=qs[_0x4a91('0x4c')](_0x2a099c[_0x4a91('0x2a')]['sort']);_0x2a97e6[_0x4a91('0x28')]=qs[_0x4a91('0x30')](_['pick'](_0x2a099c['query'],_0x4806b9['filters']));if(_0x2a099c[_0x4a91('0x2a')][_0x4a91('0x4f')]){_0x2a97e6[_0x4a91('0x28')]=_[_0x4a91('0x36')](_0x2a97e6[_0x4a91('0x28')],{'$or':_[_0x4a91('0x21')](_0x2a97e6['attributes'],function(_0x4b00bf){var _0x378c2d={};_0x378c2d[_0x4b00bf]={'$like':'%'+_0x2a099c[_0x4a91('0x2a')][_0x4a91('0x4f')]+'%'};return _0x378c2d;})});}_0x2a97e6=_[_0x4a91('0x36')]({},_0x2a97e6,_0x2a099c[_0x4a91('0x37')]);return _0x410d1d[_0x4a91('0x59')](_0x2a97e6);}})['then'](function(_0x4b8e02){if(_0x4b8e02){_0x2d7eb0=_0x4b8e02[_0x4a91('0x34')];if(!_0x2a099c['query']['hasOwnProperty'](_0x4a91('0x4a'))){_0x2a97e6[_0x4a91('0x13')]=qs[_0x4a91('0x13')](_0x2a099c[_0x4a91('0x2a')][_0x4a91('0x13')]);_0x2a97e6['offset']=qs['offset'](_0x2a099c['query'][_0x4a91('0x15')]);}return _0x410d1d[_0x4a91('0x59')](_0x2a97e6);}})[_0x4a91('0x19')](function(_0xaab249){if(_0xaab249){return _0xaab249?{'count':_0x2d7eb0,'rows':_0xaab249}:null;}})[_0x4a91('0x19')](respondWithResult(_0x1f1380,null))[_0x4a91('0x39')](handleError(_0x1f1380,null));};exports[_0x4a91('0x5b')]=function(_0x3519d4,_0x46a37c){var _0x1113dd=_0x3519d4[_0x4a91('0x43')][_0x4a91('0x5c')];return db['Team'][_0x4a91('0x2b')]({'where':{'id':_0x1113dd},'attributes':['id'],'include':[{'model':db[_0x4a91('0x50')],'as':_0x4a91('0x5d'),'attributes':['id',_0x4a91('0x1e'),'online',_0x4a91('0x5e'),_0x4a91('0x5f')],'raw':!![]}]})[_0x4a91('0x19')](function(_0x5ac702){if(_0x5ac702){var _0x5122f6=_['flatMap'](_0x5ac702,function(_0x74b436){var _0x20ee8d=_0x74b436[_0x4a91('0x3c')]({'plain':!![]});return _0x20ee8d[_0x4a91('0x5d')];});return db['MailQueue']['find']({'where':{'id':_0x3519d4[_0x4a91('0x44')]['id']}})[_0x4a91('0x19')](function(_0x33a39e){return db[_0x4a91('0x60')]['transaction'](function(_0x2301fb){return _0x33a39e[_0x4a91('0x5b')](_0x1113dd,{'transaction':_0x2301fb})['then'](function(){return BPromise[_0x4a91('0x61')](_0x5122f6,function(_0x1ee542){return db['UserMailQueue'][_0x4a91('0x62')]({'where':{'UserId':_0x1ee542['id'],'MailQueueId':_0x3519d4[_0x4a91('0x44')]['id']},'transaction':_0x2301fb});});})[_0x4a91('0x19')](function(){_0x5122f6[_0x4a91('0x63')](function(_0x2910df){socket['emit']('userMailQueue:save',{'UserId':_0x2910df['id'],'MailQueueId':_0x33a39e['id']});});});});});}})['then'](respondWithStatusCode(_0x46a37c,null))[_0x4a91('0x39')](handleError(_0x46a37c,null));};exports[_0x4a91('0x64')]=function(_0x5b2072,_0x16c07d){return db['Team'][_0x4a91('0x2b')]({'where':{'id':_0x5b2072[_0x4a91('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4a91('0x50')],'as':_0x4a91('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x4a91('0x19')](handleEntityNotFound(_0x16c07d,null))[_0x4a91('0x19')](function(_0x6b91a0){var _0x3a7be1=_[_0x4a91('0x21')](_0x6b91a0,'id');var _0x11150e=[];var _0x620098=[];var _0x31bf9e=squel[_0x4a91('0x65')]();_0x31bf9e[_0x4a91('0x66')](_0x4a91('0x67'))['from'](_0x4a91('0x68'),'tq')[_0x4a91('0x69')]('user_has_teams','ut',_0x4a91('0x6a'))[_0x4a91('0x28')](_0x4a91('0x6b'),_0x5b2072['params']['id']);for(var _0x1a47bd=0x0;_0x1a47bd<_0x6b91a0[_0x4a91('0x34')];_0x1a47bd+=0x1){let _0x56bf5f=_0x6b91a0[_0x1a47bd];for(var _0x153869=0x0;_0x153869<_0x56bf5f[_0x4a91('0x5d')]['length'];_0x153869+=0x1){let _0x3667c7=_0x56bf5f[_0x4a91('0x5d')][_0x153869];var _0x3f4f27=_0x31bf9e[_0x4a91('0x6c')]();_0x3f4f27[_0x4a91('0x28')](_0x4a91('0x6d'),_0x3667c7['id']);_0x620098[_0x4a91('0x6e')](db['sequelize'][_0x4a91('0x2a')](_0x3f4f27[_0x4a91('0x6f')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x4a91('0x19')](function(_0x255fcb){if(_0x255fcb[_0x4a91('0x34')]===0x1){return _0x3667c7['id'];}else{var _0x301bde=_[_0x4a91('0x70')](_[_0x4a91('0x21')](_0x255fcb,_0x4a91('0x71')),function(_0x257bdd){return _['includes'](_0x3a7be1,_0x257bdd);});if(_0x301bde){return _0x3667c7['id'];}}}));}}return BPromise[_0x4a91('0x72')](_0x620098)[_0x4a91('0x19')](function(_0x3653ff){_0x11150e=_(_0x11150e)[_0x4a91('0x73')](_0x3653ff)[_0x4a91('0x74')]()[_0x4a91('0x75')]();return db[_0x4a91('0x22')][_0x4a91('0x38')]({'where':{'id':_0x5b2072[_0x4a91('0x44')]['id']}})[_0x4a91('0x19')](function(_0x5a0ef0){return db[_0x4a91('0x60')][_0x4a91('0x76')](function(_0x528327){return _0x5a0ef0['removeTeams'](_0x5b2072[_0x4a91('0x2a')]['ids'],{'transaction':_0x528327})[_0x4a91('0x19')](function(){if(!_[_0x4a91('0x77')](_0x11150e)){return _0x5a0ef0[_0x4a91('0x78')](_0x11150e,{'transaction':_0x528327});}})['then'](function(){_0x11150e[_0x4a91('0x63')](function(_0x56a3c5){socket[_0x4a91('0x79')](_0x4a91('0x7a'),{'UserId':_0x56a3c5,'MailQueueId':_0x5a0ef0['id']});});});});});});})[_0x4a91('0x19')](respondWithStatusCode(_0x16c07d,null))[_0x4a91('0x39')](handleError(_0x16c07d,null));};exports[_0x4a91('0x7b')]=function(_0x92ec78,_0x583315){return db[_0x4a91('0x22')][_0x4a91('0x38')]({'where':{'id':_0x92ec78[_0x4a91('0x44')]['id']}})[_0x4a91('0x19')](handleEntityNotFound(_0x583315,null))[_0x4a91('0x19')](function(_0xa64322){if(_0xa64322){return _0xa64322[_0x4a91('0x7b')](_0x92ec78[_0x4a91('0x43')]['ids'],_[_0x4a91('0x7c')](_0x92ec78[_0x4a91('0x43')],[_0x4a91('0x5c'),'id'])||{})[_0x4a91('0x7d')](function(_0x5a0a03){for(var _0x5ecded=0x0;_0x5ecded<_0x92ec78[_0x4a91('0x43')][_0x4a91('0x5c')][_0x4a91('0x34')];_0x5ecded+=0x1){socket['emit'](_0x4a91('0x7e'),{'UserId':Number(_0x92ec78[_0x4a91('0x43')][_0x4a91('0x5c')][_0x5ecded]),'MailQueueId':Number(_0x92ec78[_0x4a91('0x44')]['id'])});}return _0x5a0a03;});}})[_0x4a91('0x19')](respondWithResult(_0x583315,null))[_0x4a91('0x39')](handleError(_0x583315,null));};exports[_0x4a91('0x78')]=function(_0x526d24,_0x5b08b4){return db[_0x4a91('0x22')][_0x4a91('0x38')]({'where':{'id':_0x526d24[_0x4a91('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b08b4,null))[_0x4a91('0x19')](function(_0x46c287){if(_0x46c287){return _0x46c287[_0x4a91('0x78')](_0x526d24[_0x4a91('0x2a')][_0x4a91('0x5c')])[_0x4a91('0x19')](function(){if(_[_0x4a91('0x7f')](_0x526d24[_0x4a91('0x2a')][_0x4a91('0x5c')])){for(var _0x3e1403=0x0;_0x3e1403<_0x526d24[_0x4a91('0x2a')]['ids'][_0x4a91('0x34')];_0x3e1403+=0x1){socket['emit'](_0x4a91('0x7a'),{'UserId':Number(_0x526d24[_0x4a91('0x2a')]['ids'][_0x3e1403]),'MailQueueId':Number(_0x526d24[_0x4a91('0x44')]['id'])});}}else{socket[_0x4a91('0x79')](_0x4a91('0x7a'),{'UserId':Number(_0x526d24[_0x4a91('0x2a')][_0x4a91('0x5c')]),'MailQueueId':Number(_0x526d24[_0x4a91('0x44')]['id'])});}});}})[_0x4a91('0x19')](respondWithStatusCode(_0x5b08b4,null))[_0x4a91('0x39')](handleError(_0x5b08b4,null));};exports[_0x4a91('0x80')]=function(_0x37c2e8,_0x46859c){var _0x247b56={};var _0xd7d1c7={};var _0x109d38;var _0x493791;return db['MailQueue'][_0x4a91('0x47')]({'where':{'id':_0x37c2e8[_0x4a91('0x44')]['id']}})[_0x4a91('0x19')](handleEntityNotFound(_0x46859c,null))[_0x4a91('0x19')](function(_0x20bd4a){if(_0x20bd4a){_0x109d38=_0x20bd4a;_0xd7d1c7[_0x4a91('0x2e')]=_['keys'](db[_0x4a91('0x50')][_0x4a91('0x23')]);_0xd7d1c7[_0x4a91('0x2a')]=_['keys'](_0x37c2e8[_0x4a91('0x2a')]);_0xd7d1c7[_0x4a91('0x30')]=_[_0x4a91('0x31')](_0xd7d1c7[_0x4a91('0x2e')],_0xd7d1c7['query']);_0x247b56['attributes']=_[_0x4a91('0x31')](_0xd7d1c7['model'],qs[_0x4a91('0x32')](_0x37c2e8['query'][_0x4a91('0x32')]));_0x247b56['attributes']=_0x247b56['attributes']['length']?_0x247b56[_0x4a91('0x33')]:_0xd7d1c7[_0x4a91('0x2e')];_0x247b56['order']=qs[_0x4a91('0x4c')](_0x37c2e8['query']['sort']);_0x247b56[_0x4a91('0x28')]=qs[_0x4a91('0x30')](_[_0x4a91('0x4d')](_0x37c2e8[_0x4a91('0x2a')],_0xd7d1c7[_0x4a91('0x30')]));if(_0x37c2e8[_0x4a91('0x2a')][_0x4a91('0x4f')]){_0x247b56[_0x4a91('0x28')]=_[_0x4a91('0x36')](_0x247b56['where'],{'$or':_['map'](_0x247b56[_0x4a91('0x33')],function(_0x357ca9){var _0x21f40c={};_0x21f40c[_0x357ca9]={'$like':'%'+_0x37c2e8[_0x4a91('0x2a')][_0x4a91('0x4f')]+'%'};return _0x21f40c;})});}_0x247b56=_[_0x4a91('0x36')]({},_0x247b56,_0x37c2e8[_0x4a91('0x37')]);return _0x109d38[_0x4a91('0x80')](_0x247b56);}})[_0x4a91('0x19')](function(_0x496df3){if(_0x496df3){_0x493791=_0x496df3[_0x4a91('0x34')];if(!_0x37c2e8[_0x4a91('0x2a')][_0x4a91('0x49')]('nolimit')){_0x247b56['limit']=qs[_0x4a91('0x13')](_0x37c2e8[_0x4a91('0x2a')]['limit']);_0x247b56[_0x4a91('0x15')]=qs[_0x4a91('0x15')](_0x37c2e8[_0x4a91('0x2a')][_0x4a91('0x15')]);}return _0x109d38[_0x4a91('0x80')](_0x247b56);}})[_0x4a91('0x19')](function(_0xdb420a){if(_0xdb420a){return _0xdb420a?{'count':_0x493791,'rows':_0xdb420a}:null;}})[_0x4a91('0x19')](respondWithResult(_0x46859c,null))['catch'](handleError(_0x46859c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c3df746..14bb815 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 _0x8f67=['../../mysqldb','MailQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x120eba,_0x358742){var _0x11a9bf=function(_0xdf2112){while(--_0xdf2112){_0x120eba['push'](_0x120eba['shift']());}};_0x11a9bf(++_0x358742);}(_0x8f67,0x10d));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x78f6('0x0'));var MailQueue=require(_0x78f6('0x1'))['db'][_0x78f6('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x78f6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x78f6('0x4'),'afterDestroy':_0x78f6('0x5')};function emitEvent(_0x2952f8){return function(_0x1dc23d,_0x14bfd9,_0x2b0a57){MailQueueEvents[_0x78f6('0x6')](_0x2952f8+':'+_0x1dc23d['id'],_0x1dc23d);MailQueueEvents['emit'](_0x2952f8,_0x1dc23d);_0x2b0a57(null);};}for(var e in events){if(events[_0x78f6('0x7')](e)){var event=events[e];MailQueue[_0x78f6('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xca5c=['events','../../mysqldb','MailQueue','setMaxListeners','update','emit','exports'];(function(_0x1d4907,_0x1533a8){var _0x5661c3=function(_0x3a4f2d){while(--_0x3a4f2d){_0x1d4907['push'](_0x1d4907['shift']());}};_0x5661c3(++_0x1533a8);}(_0xca5c,0xa1));var _0xcca5=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xca5c[_0x4b12ae];return _0x16957b;};'use strict';var EventEmitter=require(_0xcca5('0x0'));var MailQueue=require(_0xcca5('0x1'))['db'][_0xcca5('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcca5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcca5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3fef92){return function(_0xf9b05f,_0x23586b,_0x168ada){MailQueueEvents['emit'](_0x3fef92+':'+_0xf9b05f['id'],_0xf9b05f);MailQueueEvents[_0xcca5('0x5')](_0x3fef92,_0xf9b05f);_0x168ada(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xcca5('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e114790..7d6954e 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 _0x1ce2=['define','MailQueue','mail_queues','api','moment','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1ce2,0x18f));var _0x21ce=function(_0x361ad3,_0x3dfa81){_0x361ad3=_0x361ad3-0x0;var _0x4e54c1=_0x1ce2[_0x361ad3];return _0x4e54c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x21ce('0x0'));var moment=require(_0x21ce('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x21ce('0x2'));var config=require(_0x21ce('0x3'));var attributes=require(_0x21ce('0x4'));module[_0x21ce('0x5')]=function(_0x19bb5f,_0x1bf6cd){return _0x19bb5f[_0x21ce('0x6')](_0x21ce('0x7'),attributes,{'tableName':_0x21ce('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf3d=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x2e6889,_0x3a5db6){var _0x52abdb=function(_0x5b4d03){while(--_0x5b4d03){_0x2e6889['push'](_0x2e6889['shift']());}};_0x52abdb(++_0x3a5db6);}(_0xaf3d,0x17a));var _0xdaf3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf3d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdaf3('0x0'));var util=require(_0xdaf3('0x1'));var logger=require(_0xdaf3('0x2'))('api');var moment=require(_0xdaf3('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaf3('0x4'));var fs=require('fs');var path=require(_0xdaf3('0x5'));var rimraf=require('rimraf');var config=require(_0xdaf3('0x6'));var attributes=require('./mailQueue.attributes');module[_0xdaf3('0x7')]=function(_0xae7597,_0x4d1891){return _0xae7597[_0xdaf3('0x8')](_0xdaf3('0x9'),attributes,{'tableName':_0xdaf3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 246844a..7f1c6c7 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 _0xd60b=['debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','include','map','attributes','model','then','stringify','find','where','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd60b,0x6f));var _0xbd60=function(_0x577832,_0x34ed82){_0x577832=_0x577832-0x0;var _0x376511=_0xd60b[_0x577832];return _0x376511;};'use strict';var _=require(_0xbd60('0x0'));var util=require(_0xbd60('0x1'));var moment=require(_0xbd60('0x2'));var BPromise=require(_0xbd60('0x3'));var rs=require(_0xbd60('0x4'));var fs=require('fs');var Redis=require(_0xbd60('0x5'));var db=require(_0xbd60('0x6'))['db'];var utils=require(_0xbd60('0x7'));var logger=require(_0xbd60('0x8'))(_0xbd60('0x9'));var config=require(_0xbd60('0xa'));var jayson=require(_0xbd60('0xb'));var client=jayson[_0xbd60('0xc')][_0xbd60('0xd')]({'port':0x232a});config[_0xbd60('0xe')]=_[_0xbd60('0xf')](config[_0xbd60('0xe')],{'host':_0xbd60('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd60('0xe')]));require(_0xbd60('0x11'))['register'](socket);function respondWithRpcPromise(_0x293f97,_0x2e8eb9,_0x3f907a){return new BPromise(function(_0x5e8bfc,_0x4841a8){return client[_0xbd60('0x12')](_0x293f97,_0x3f907a)['then'](function(_0xd08de1){logger[_0xbd60('0x13')](_0xbd60('0x14'),_0x2e8eb9,'request\x20sent');logger[_0xbd60('0x15')](_0xbd60('0x16'),_0x2e8eb9,_0xbd60('0x17'),JSON['stringify'](_0xd08de1));if(_0xd08de1[_0xbd60('0x18')]){if(_0xd08de1[_0xbd60('0x18')][_0xbd60('0x19')]===0x1f4){logger[_0xbd60('0x18')](_0xbd60('0x14'),_0x2e8eb9,_0xd08de1['error'][_0xbd60('0x1a')]);return _0x4841a8(_0xd08de1[_0xbd60('0x18')][_0xbd60('0x1a')]);}logger[_0xbd60('0x18')](_0xbd60('0x14'),_0x2e8eb9,_0xd08de1[_0xbd60('0x18')][_0xbd60('0x1a')]);return _0x5e8bfc(_0xd08de1[_0xbd60('0x18')][_0xbd60('0x1a')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x2e8eb9,_0xbd60('0x17'));_0x5e8bfc(_0xd08de1[_0xbd60('0x1b')][_0xbd60('0x1a')]);}})[_0xbd60('0x1c')](function(_0x50d2eb){logger['error']('MailQueue,\x20%s,\x20%s',_0x2e8eb9,_0x50d2eb);_0x4841a8(_0x50d2eb);});});}exports[_0xbd60('0x1d')]=function(_0x578505){var _0x439a31=this;return new Promise(function(_0x2f545f,_0x499396){return db[_0xbd60('0x1e')][_0xbd60('0x1f')]({'raw':_0x578505[_0xbd60('0x20')]?_0x578505[_0xbd60('0x20')][_0xbd60('0x21')]===undefined?!![]:![]:!![],'where':_0x578505[_0xbd60('0x20')]?_0x578505[_0xbd60('0x20')]['where']||null:null,'attributes':_0x578505['options']?_0x578505[_0xbd60('0x20')]['attributes']||null:null,'limit':_0x578505['options']?_0x578505[_0xbd60('0x20')][_0xbd60('0x22')]||null:null,'include':_0x578505['options']?_0x578505[_0xbd60('0x20')][_0xbd60('0x23')]?_[_0xbd60('0x24')](_0x578505[_0xbd60('0x20')]['include'],function(_0x1d4be7){return{'model':db[_0x1d4be7['model']],'as':_0x1d4be7['as'],'attributes':_0x1d4be7[_0xbd60('0x25')],'include':_0x1d4be7['include']?_[_0xbd60('0x24')](_0x1d4be7[_0xbd60('0x23')],function(_0x3b4800){return{'model':db[_0x3b4800[_0xbd60('0x26')]],'as':_0x3b4800['as'],'attributes':_0x3b4800[_0xbd60('0x25')],'include':_0x3b4800[_0xbd60('0x23')]?_['map'](_0x3b4800[_0xbd60('0x23')],function(_0x31a485){return{'model':db[_0x31a485['model']],'as':_0x31a485['as'],'attributes':_0x31a485[_0xbd60('0x25')]};}):[]};}):[]};}):[]:[]})[_0xbd60('0x27')](function(_0x50c4b4){logger['info']('GetMailQueue',_0x578505);logger['debug'](_0xbd60('0x1d'),_0x578505,JSON[_0xbd60('0x28')](_0x50c4b4));_0x2f545f(_0x50c4b4);})['catch'](function(_0x4a207d){logger[_0xbd60('0x18')](_0xbd60('0x1d'),_0x4a207d[_0xbd60('0x1a')],_0x578505);_0x499396(_0x439a31[_0xbd60('0x18')](0x1f4,_0x4a207d[_0xbd60('0x1a')]));});});};exports['ShowMailQueue']=function(_0x35529a){var _0xcbeeb4=this;return new Promise(function(_0xd0d32b,_0x519088){return db[_0xbd60('0x1e')][_0xbd60('0x29')]({'raw':_0x35529a[_0xbd60('0x20')]?_0x35529a[_0xbd60('0x20')][_0xbd60('0x21')]===undefined?!![]:![]:!![],'where':_0x35529a[_0xbd60('0x20')]?_0x35529a[_0xbd60('0x20')][_0xbd60('0x2a')]||null:null,'attributes':_0x35529a[_0xbd60('0x20')]?_0x35529a[_0xbd60('0x20')][_0xbd60('0x25')]||null:null,'include':_0x35529a[_0xbd60('0x20')]?_0x35529a[_0xbd60('0x20')]['include']?_[_0xbd60('0x24')](_0x35529a[_0xbd60('0x20')][_0xbd60('0x23')],function(_0x2e4b5d){return{'model':db[_0x2e4b5d['model']],'as':_0x2e4b5d['as'],'attributes':_0x2e4b5d[_0xbd60('0x25')],'include':_0x2e4b5d[_0xbd60('0x23')]?_[_0xbd60('0x24')](_0x2e4b5d[_0xbd60('0x23')],function(_0x5be308){return{'model':db[_0x5be308[_0xbd60('0x26')]],'as':_0x5be308['as'],'attributes':_0x5be308[_0xbd60('0x25')],'include':_0x5be308[_0xbd60('0x23')]?_[_0xbd60('0x24')](_0x5be308[_0xbd60('0x23')],function(_0x2ce33e){return{'model':db[_0x2ce33e[_0xbd60('0x26')]],'as':_0x2ce33e['as'],'attributes':_0x2ce33e[_0xbd60('0x25')]};}):[]};}):[]};}):[]:[]})[_0xbd60('0x27')](function(_0xe2f6fb){logger[_0xbd60('0x13')]('ShowMailQueue',_0x35529a);logger[_0xbd60('0x15')](_0xbd60('0x2b'),_0x35529a,JSON['stringify'](_0xe2f6fb));_0xd0d32b(_0xe2f6fb);})[_0xbd60('0x1c')](function(_0x18eff1){logger[_0xbd60('0x18')]('ShowMailQueue',_0x18eff1['message'],_0x35529a);_0x519088(_0xcbeeb4[_0xbd60('0x18')](0x1f4,_0x18eff1[_0xbd60('0x1a')]));});});}; \ No newline at end of file +var _0x9063=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','register','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','map','model','attributes','debug','stringify','find','raw','info','ShowMailQueue','lodash','util'];(function(_0x1dc69e,_0x23200c){var _0x111aa5=function(_0xee4cd4){while(--_0xee4cd4){_0x1dc69e['push'](_0x1dc69e['shift']());}};_0x111aa5(++_0x23200c);}(_0x9063,0x1a2));var _0x3906=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x9063[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var moment=require(_0x3906('0x2'));var BPromise=require(_0x3906('0x3'));var rs=require(_0x3906('0x4'));var fs=require('fs');var Redis=require(_0x3906('0x5'));var db=require(_0x3906('0x6'))['db'];var utils=require(_0x3906('0x7'));var logger=require('../../config/logger')(_0x3906('0x8'));var config=require(_0x3906('0x9'));var jayson=require(_0x3906('0xa'));var client=jayson[_0x3906('0xb')][_0x3906('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3906('0xd'),'port':0x18eb});var socket=require(_0x3906('0xe'))(new Redis(config[_0x3906('0xf')]));require('./mailQueue.socket')[_0x3906('0x10')](socket);function respondWithRpcPromise(_0x469456,_0x4f4b46,_0x3c8f45){return new BPromise(function(_0x3218bb,_0x347610){return client['request'](_0x469456,_0x3c8f45)[_0x3906('0x11')](function(_0x3c956c){logger['info'](_0x3906('0x12'),_0x4f4b46,'request\x20sent');logger['debug'](_0x3906('0x13'),_0x4f4b46,_0x3906('0x14'),JSON['stringify'](_0x3c956c));if(_0x3c956c['error']){if(_0x3c956c[_0x3906('0x15')][_0x3906('0x16')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x4f4b46,_0x3c956c[_0x3906('0x15')][_0x3906('0x17')]);return _0x347610(_0x3c956c[_0x3906('0x15')][_0x3906('0x17')]);}logger[_0x3906('0x15')](_0x3906('0x12'),_0x4f4b46,_0x3c956c[_0x3906('0x15')][_0x3906('0x17')]);return _0x3218bb(_0x3c956c[_0x3906('0x15')][_0x3906('0x17')]);}else{logger['info'](_0x3906('0x12'),_0x4f4b46,'request\x20sent');_0x3218bb(_0x3c956c[_0x3906('0x18')][_0x3906('0x17')]);}})[_0x3906('0x19')](function(_0x32f655){logger['error'](_0x3906('0x12'),_0x4f4b46,_0x32f655);_0x347610(_0x32f655);});});}exports[_0x3906('0x1a')]=function(_0x2f9d5a){var _0x2160df=this;return new Promise(function(_0x29d6d9,_0x553333){return db[_0x3906('0x1b')][_0x3906('0x1c')]({'raw':_0x2f9d5a[_0x3906('0x1d')]?_0x2f9d5a[_0x3906('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2f9d5a[_0x3906('0x1d')]?_0x2f9d5a[_0x3906('0x1d')][_0x3906('0x1e')]||null:null,'attributes':_0x2f9d5a[_0x3906('0x1d')]?_0x2f9d5a['options']['attributes']||null:null,'limit':_0x2f9d5a[_0x3906('0x1d')]?_0x2f9d5a[_0x3906('0x1d')][_0x3906('0x1f')]||null:null,'include':_0x2f9d5a[_0x3906('0x1d')]?_0x2f9d5a['options'][_0x3906('0x20')]?_[_0x3906('0x21')](_0x2f9d5a['options']['include'],function(_0x229b3e){return{'model':db[_0x229b3e[_0x3906('0x22')]],'as':_0x229b3e['as'],'attributes':_0x229b3e[_0x3906('0x23')],'include':_0x229b3e['include']?_[_0x3906('0x21')](_0x229b3e[_0x3906('0x20')],function(_0x118827){return{'model':db[_0x118827[_0x3906('0x22')]],'as':_0x118827['as'],'attributes':_0x118827['attributes'],'include':_0x118827[_0x3906('0x20')]?_['map'](_0x118827[_0x3906('0x20')],function(_0x59d276){return{'model':db[_0x59d276['model']],'as':_0x59d276['as'],'attributes':_0x59d276[_0x3906('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3906('0x11')](function(_0x129ead){logger['info']('GetMailQueue',_0x2f9d5a);logger[_0x3906('0x24')](_0x3906('0x1a'),_0x2f9d5a,JSON[_0x3906('0x25')](_0x129ead));_0x29d6d9(_0x129ead);})[_0x3906('0x19')](function(_0x2e266a){logger[_0x3906('0x15')]('GetMailQueue',_0x2e266a[_0x3906('0x17')],_0x2f9d5a);_0x553333(_0x2160df[_0x3906('0x15')](0x1f4,_0x2e266a['message']));});});};exports['ShowMailQueue']=function(_0x191e30){var _0x566f1d=this;return new Promise(function(_0x409e21,_0x66b9f3){return db['MailQueue'][_0x3906('0x26')]({'raw':_0x191e30[_0x3906('0x1d')]?_0x191e30[_0x3906('0x1d')][_0x3906('0x27')]===undefined?!![]:![]:!![],'where':_0x191e30[_0x3906('0x1d')]?_0x191e30[_0x3906('0x1d')][_0x3906('0x1e')]||null:null,'attributes':_0x191e30[_0x3906('0x1d')]?_0x191e30[_0x3906('0x1d')][_0x3906('0x23')]||null:null,'include':_0x191e30['options']?_0x191e30[_0x3906('0x1d')][_0x3906('0x20')]?_[_0x3906('0x21')](_0x191e30[_0x3906('0x1d')]['include'],function(_0x20f157){return{'model':db[_0x20f157[_0x3906('0x22')]],'as':_0x20f157['as'],'attributes':_0x20f157[_0x3906('0x23')],'include':_0x20f157[_0x3906('0x20')]?_[_0x3906('0x21')](_0x20f157[_0x3906('0x20')],function(_0x17fc05){return{'model':db[_0x17fc05[_0x3906('0x22')]],'as':_0x17fc05['as'],'attributes':_0x17fc05[_0x3906('0x23')],'include':_0x17fc05[_0x3906('0x20')]?_[_0x3906('0x21')](_0x17fc05[_0x3906('0x20')],function(_0x2889e0){return{'model':db[_0x2889e0[_0x3906('0x22')]],'as':_0x2889e0['as'],'attributes':_0x2889e0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x15f028){logger[_0x3906('0x28')]('ShowMailQueue',_0x191e30);logger[_0x3906('0x24')](_0x3906('0x29'),_0x191e30,JSON['stringify'](_0x15f028));_0x409e21(_0x15f028);})[_0x3906('0x19')](function(_0x18ea42){logger[_0x3906('0x15')]('ShowMailQueue',_0x18ea42[_0x3906('0x17')],_0x191e30);_0x66b9f3(_0x566f1d['error'](0x1f4,_0x18ea42[_0x3906('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c0d8a94..8550960 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 _0x97a8=['removeListener','length','mailQueue:','save','remove','update','emit'];(function(_0x2e85fd,_0x1ce95a){var _0x4615c2=function(_0x1c351f){while(--_0x1c351f){_0x2e85fd['push'](_0x2e85fd['shift']());}};_0x4615c2(++_0x1ce95a);}(_0x97a8,0xe3));var _0x897a=function(_0x3d86fb,_0x51313f){_0x3d86fb=_0x3d86fb-0x0;var _0x3b2019=_0x97a8[_0x3d86fb];return _0x3b2019;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x897a('0x0'),_0x897a('0x1'),_0x897a('0x2')];function createListener(_0x329208,_0x3d8ec0){return function(_0x1b50b0){_0x3d8ec0[_0x897a('0x3')](_0x329208,_0x1b50b0);};}function removeListener(_0x48203b,_0x2131d0){return function(){MailQueueEvents[_0x897a('0x4')](_0x48203b,_0x2131d0);};}exports['register']=function(_0x5adcfd){for(var _0x55e647=0x0,_0x59b9f1=events[_0x897a('0x5')];_0x55e647<_0x59b9f1;_0x55e647++){var _0x128644=events[_0x55e647];var _0x3cd748=createListener(_0x897a('0x6')+_0x128644,_0x5adcfd);MailQueueEvents['on'](_0x128644,_0x3cd748);}}; \ No newline at end of file +var _0xda16=['mailQueue:','./mailQueue.events','save','remove','update','emit','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda16,0x1cf));var _0x6da1=function(_0x10acb2,_0x3ca870){_0x10acb2=_0x10acb2-0x0;var _0x186379=_0xda16[_0x10acb2];return _0x186379;};'use strict';var MailQueueEvents=require(_0x6da1('0x0'));var events=[_0x6da1('0x1'),_0x6da1('0x2'),_0x6da1('0x3')];function createListener(_0x57ebf1,_0x57b998){return function(_0x598230){_0x57b998[_0x6da1('0x4')](_0x57ebf1,_0x598230);};}function removeListener(_0x191b77,_0xbff301){return function(){MailQueueEvents['removeListener'](_0x191b77,_0xbff301);};}exports[_0x6da1('0x5')]=function(_0xf0ed70){for(var _0x41561a=0x0,_0x41de73=events['length'];_0x41561a<_0x41de73;_0x41561a++){var _0x33067b=events[_0x41561a];var _0x56e12a=createListener(_0x6da1('0x6')+_0x33067b,_0xf0ed70);MailQueueEvents['on'](_0x33067b,_0x56e12a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6ea6b5c..a4dc541 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 _0x407c=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','update','delete','destroy','exports'];(function(_0x312e81,_0x1cf1ad){var _0x248437=function(_0x12277e){while(--_0x12277e){_0x312e81['push'](_0x312e81['shift']());}};_0x248437(++_0x1cf1ad);}(_0x407c,0xc0));var _0xc407=function(_0x9cb7df,_0x32a897){_0x9cb7df=_0x9cb7df-0x0;var _0x356666=_0x407c[_0x9cb7df];return _0x356666;};'use strict';var multer=require('multer');var util=require(_0xc407('0x0'));var path=require(_0xc407('0x1'));var timeout=require(_0xc407('0x2'));var express=require('express');var router=express[_0xc407('0x3')]();var fs_extra=require(_0xc407('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc407('0x5'));var config=require('../../config/environment');var controller=require(_0xc407('0x6'));router[_0xc407('0x7')]('/',auth[_0xc407('0x8')](),controller['index']);router[_0xc407('0x7')]('/describe',auth[_0xc407('0x8')](),controller[_0xc407('0x9')]);router[_0xc407('0x7')](_0xc407('0xa'),auth[_0xc407('0x8')](),controller[_0xc407('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc407('0xa'),auth[_0xc407('0x8')](),controller[_0xc407('0xc')]);router[_0xc407('0xd')]('/:id',auth[_0xc407('0x8')](),controller[_0xc407('0xe')]);module[_0xc407('0xf')]=router; \ No newline at end of file +var _0x3410=['/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueueReport.controller','get','index'];(function(_0x530a58,_0x141d0a){var _0x46efd4=function(_0x5b699a){while(--_0x5b699a){_0x530a58['push'](_0x530a58['shift']());}};_0x46efd4(++_0x141d0a);}(_0x3410,0x170));var _0x0341=function(_0xaec913,_0x57e156){_0xaec913=_0xaec913-0x0;var _0x3e5c96=_0x3410[_0xaec913];return _0x3e5c96;};'use strict';var multer=require(_0x0341('0x0'));var util=require(_0x0341('0x1'));var path=require('path');var timeout=require(_0x0341('0x2'));var express=require(_0x0341('0x3'));var router=express[_0x0341('0x4')]();var fs_extra=require(_0x0341('0x5'));var auth=require(_0x0341('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0341('0x7'));router[_0x0341('0x8')]('/',auth['isAuthenticated'](),controller[_0x0341('0x9')]);router[_0x0341('0x8')](_0x0341('0xa'),auth[_0x0341('0xb')](),controller[_0x0341('0xc')]);router[_0x0341('0x8')](_0x0341('0xd'),auth['isAuthenticated'](),controller[_0x0341('0xe')]);router[_0x0341('0xf')]('/',auth[_0x0341('0xb')](),controller['create']);router[_0x0341('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0341('0x11')]);router[_0x0341('0x12')](_0x0341('0xd'),auth[_0x0341('0xb')](),controller[_0x0341('0x13')]);module[_0x0341('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 9f5d693..9effdf9 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 _0x959e=['DATE','sequelize','STRING'];(function(_0x3626ce,_0x33effa){var _0x455327=function(_0x4eee88){while(--_0x4eee88){_0x3626ce['push'](_0x3626ce['shift']());}};_0x455327(++_0x33effa);}(_0x959e,0x18a));var _0xe959=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x959e[_0x7d62cb];return _0x3a6266;};'use strict';var moment=require('moment');var Sequelize=require(_0xe959('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe959('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe959('0x1')]},'joinAt':{'type':Sequelize[_0xe959('0x2')]},'leaveAt':{'type':Sequelize[_0xe959('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe959('0x2')]},'reason':{'type':Sequelize[_0xe959('0x1')]}}; \ No newline at end of file +var _0x435a=['DATE'];(function(_0x2bab5e,_0x2a99e9){var _0x4bd5e1=function(_0x4ffa13){while(--_0x4ffa13){_0x2bab5e['push'](_0x2bab5e['shift']());}};_0x4bd5e1(++_0x2a99e9);}(_0x435a,0x13b));var _0xa435=function(_0x148202,_0x132b6a){_0x148202=_0x148202-0x0;var _0x1b15ad=_0x435a[_0x148202];return _0x1b15ad;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa435('0x0')]},'leaveAt':{'type':Sequelize[_0xa435('0x0')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7780d5f..344c3c6 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 _0xa456=['where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xa456,0x142));var _0x6a45=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa456[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0x6a45('0x0'));var rimraf=require(_0x6a45('0x1'));var zipdir=require(_0x6a45('0x2'));var jsonpatch=require(_0x6a45('0x3'));var rp=require('request-promise');var moment=require(_0x6a45('0x4'));var BPromise=require(_0x6a45('0x5'));var Mustache=require(_0x6a45('0x6'));var util=require('util');var path=require(_0x6a45('0x7'));var sox=require(_0x6a45('0x8'));var csv=require(_0x6a45('0x9'));var ejs=require(_0x6a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=typeof _0x171176['offset']==='undefined'&&typeof _0x171176['limit']===_0x6a45('0x1b');var _0x391f81=_0x3fab82[_0x6a45('0x1c')];var _0x52a055=_0x13adc0?0x0:_0x171176[_0x6a45('0x1d')];var _0x102981=_0x13adc0?_0x3fab82[_0x6a45('0x1c')]:_0x171176['offset']+_0x171176['limit'];var _0x573453;if(_0x102981>=_0x391f81){_0x102981=_0x391f81;_0x573453=0xc8;}else{_0x573453=0xce;}_0x2c20db[_0x6a45('0x19')](_0x573453);return _0x2c20db[_0x6a45('0x1e')]('Content-Range',_0x52a055+'-'+_0x102981+'/'+_0x391f81)[_0x6a45('0x1f')](_0x3fab82);}return null;};}function patchUpdates(_0x1be485){return function(_0x4f7000){try{jsonpatch[_0x6a45('0x20')](_0x4f7000,_0x1be485,!![]);}catch(_0xdf10c6){return BPromise[_0x6a45('0x21')](_0xdf10c6);}return _0x4f7000[_0x6a45('0x22')]();};}function saveUpdates(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')](_0x15ad0e)[_0x6a45('0x24')](function(_0x11290c){return _0x11290c;});}return null;};}function removeEntity(_0x22373c,_0x25a380){return function(_0x3ad898){if(_0x3ad898){return _0x3ad898[_0x6a45('0x25')]()[_0x6a45('0x24')](function(){_0x22373c[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x1310d7,_0x46587a){return function(_0x5cd761){if(!_0x5cd761){_0x1310d7[_0x6a45('0x18')](0x194);}return _0x5cd761;};}function handleError(_0x5a0389,_0x1b83fa){_0x1b83fa=_0x1b83fa||0x1f4;return function(_0x25467d){logger[_0x6a45('0x26')](_0x25467d[_0x6a45('0x27')]);if(_0x25467d[_0x6a45('0x28')]){delete _0x25467d['name'];}_0x5a0389[_0x6a45('0x19')](_0x1b83fa)[_0x6a45('0x29')](_0x25467d);};}exports[_0x6a45('0x2a')]=function(_0x1ccff0,_0x8265d9){var _0x227b6f={},_0x3fac9b={},_0x313c13={'count':0x0,'rows':[]};var _0x54286d=_[_0x6a45('0x2b')](db[_0x6a45('0x2c')][_0x6a45('0x2d')],function(_0x201369){return{'name':_0x201369[_0x6a45('0x2e')],'type':_0x201369['type'][_0x6a45('0x2f')]};});_0x3fac9b[_0x6a45('0x30')]=_[_0x6a45('0x2b')](_0x54286d,_0x6a45('0x28'));_0x3fac9b['query']=_['keys'](_0x1ccff0[_0x6a45('0x31')]);_0x3fac9b['filters']=_[_0x6a45('0x32')](_0x3fac9b['model'],_0x3fac9b[_0x6a45('0x31')]);_0x227b6f[_0x6a45('0x33')]=_[_0x6a45('0x32')](_0x3fac9b[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x34')]));_0x227b6f[_0x6a45('0x33')]=_0x227b6f[_0x6a45('0x33')][_0x6a45('0x35')]?_0x227b6f[_0x6a45('0x33')]:_0x3fac9b[_0x6a45('0x30')];if(!_0x1ccff0[_0x6a45('0x31')]['hasOwnProperty'](_0x6a45('0x36'))){_0x227b6f['limit']=qs[_0x6a45('0x37')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x37')]);_0x227b6f[_0x6a45('0x1d')]=qs[_0x6a45('0x1d')](_0x1ccff0[_0x6a45('0x31')]['offset']);}_0x227b6f[_0x6a45('0x38')]=qs[_0x6a45('0x39')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x39')]);_0x227b6f[_0x6a45('0x3a')]=qs[_0x6a45('0x3b')](_['pick'](_0x1ccff0[_0x6a45('0x31')],_0x3fac9b[_0x6a45('0x3b')]),_0x54286d);if(_0x1ccff0['query'][_0x6a45('0x3c')]){_0x227b6f[_0x6a45('0x3a')]=_[_0x6a45('0x3d')](_0x227b6f[_0x6a45('0x3a')],{'$or':_[_0x6a45('0x2b')](_0x54286d,function(_0x50ebe0){if(_0x50ebe0[_0x6a45('0x3e')]!==_0x6a45('0x3f')){var _0x205afd={};_0x205afd[_0x50ebe0[_0x6a45('0x28')]]={'$like':'%'+_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x3c')]+'%'};return _0x205afd;}})});}_0x227b6f=_[_0x6a45('0x3d')]({},_0x227b6f,_0x1ccff0['options']);var _0x1c941a={'where':_0x227b6f['where']};return db[_0x6a45('0x2c')][_0x6a45('0x1c')](_0x1c941a)[_0x6a45('0x24')](function(_0x2715dc){_0x313c13['count']=_0x2715dc;if(_0x1ccff0['query'][_0x6a45('0x40')]){_0x227b6f[_0x6a45('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6a45('0x42')](_0x227b6f);})[_0x6a45('0x24')](function(_0x3bd926){_0x313c13[_0x6a45('0x43')]=_0x3bd926;return _0x313c13;})['then'](respondWithFilteredResult(_0x8265d9,_0x227b6f))['catch'](handleError(_0x8265d9,null));};exports['show']=function(_0x5b9798,_0xe90201){var _0xb5d191={'raw':!![],'where':{'id':_0x5b9798[_0x6a45('0x44')]['id']}},_0x328d9f={};_0x328d9f[_0x6a45('0x30')]=_[_0x6a45('0x45')](db[_0x6a45('0x2c')][_0x6a45('0x2d')]);_0x328d9f['query']=_[_0x6a45('0x45')](_0x5b9798['query']);_0x328d9f['filters']=_[_0x6a45('0x32')](_0x328d9f[_0x6a45('0x30')],_0x328d9f['query']);_0xb5d191[_0x6a45('0x33')]=_['intersection'](_0x328d9f[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x5b9798[_0x6a45('0x31')][_0x6a45('0x34')]));_0xb5d191['attributes']=_0xb5d191[_0x6a45('0x33')][_0x6a45('0x35')]?_0xb5d191[_0x6a45('0x33')]:_0x328d9f[_0x6a45('0x30')];if(_0x5b9798[_0x6a45('0x31')]['includeAll']){_0xb5d191[_0x6a45('0x41')]=[{'all':!![]}];}_0xb5d191=_['merge']({},_0xb5d191,_0x5b9798[_0x6a45('0x46')]);return db[_0x6a45('0x2c')]['find'](_0xb5d191)[_0x6a45('0x24')](handleEntityNotFound(_0xe90201,null))[_0x6a45('0x24')](respondWithResult(_0xe90201,null))[_0x6a45('0x47')](handleError(_0xe90201,null));};exports[_0x6a45('0x48')]=function(_0x524296,_0x34bbb7){return db['MailQueueReport'][_0x6a45('0x48')](_0x524296['body'],{})[_0x6a45('0x24')](respondWithResult(_0x34bbb7,0xc9))[_0x6a45('0x47')](handleError(_0x34bbb7,null));};exports[_0x6a45('0x23')]=function(_0x2bf8d3,_0x5d9f52){if(_0x2bf8d3[_0x6a45('0x49')]['id']){delete _0x2bf8d3[_0x6a45('0x49')]['id'];}return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x2bf8d3[_0x6a45('0x44')]['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x5d9f52,null))[_0x6a45('0x24')](saveUpdates(_0x2bf8d3[_0x6a45('0x49')],null))[_0x6a45('0x24')](respondWithResult(_0x5d9f52,null))[_0x6a45('0x47')](handleError(_0x5d9f52,null));};exports['destroy']=function(_0x3ea4a7,_0x8877c7){return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x3ea4a7['params']['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x8877c7,null))[_0x6a45('0x24')](removeEntity(_0x8877c7,null))[_0x6a45('0x47')](handleError(_0x8877c7,null));};exports['describe']=function(_0x4e7967,_0x5a17b8){return db[_0x6a45('0x2c')][_0x6a45('0x4b')]()[_0x6a45('0x24')](respondWithResult(_0x5a17b8,null))[_0x6a45('0x47')](handleError(_0x5a17b8,null));}; \ No newline at end of file +var _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','MailQueueReport','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x354ee7,_0x2bb5d0){var _0x30d882=function(_0x11b2d3){while(--_0x11b2d3){_0x354ee7['push'](_0x354ee7['shift']());}};_0x30d882(++_0x2bb5d0);}(_0xd117,0x182));var _0x7d11=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xd117[_0x11a220];return _0x20d8fe;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['MailQueueReport'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index bcc4d97..a2c1f18 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 _0xcdcb=['bluebird','path','rimraf','exports','define','MailQueueReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x440b8c,_0x49c31a){var _0x40b249=function(_0x62fbe7){while(--_0x62fbe7){_0x440b8c['push'](_0x440b8c['shift']());}};_0x40b249(++_0x49c31a);}(_0xcdcb,0x75));var _0xbcdc=function(_0xe69aed,_0x295338){_0xe69aed=_0xe69aed-0x0;var _0x101cab=_0xcdcb[_0xe69aed];return _0x101cab;};'use strict';var _=require('lodash');var util=require(_0xbcdc('0x0'));var logger=require(_0xbcdc('0x1'))(_0xbcdc('0x2'));var moment=require(_0xbcdc('0x3'));var BPromise=require(_0xbcdc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcdc('0x5'));var rimraf=require(_0xbcdc('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xbcdc('0x7')]=function(_0x5b5143,_0x48a0ab){return _0x5b5143[_0xbcdc('0x8')](_0xbcdc('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xbcdc('0xa'),'fields':[_0xbcdc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8431=['path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8431,0x1a7));var _0x1843=function(_0x20c0ba,_0x1342b9){_0x20c0ba=_0x20c0ba-0x0;var _0x128eee=_0x8431[_0x20c0ba];return _0x128eee;};'use strict';var _=require(_0x1843('0x0'));var util=require(_0x1843('0x1'));var logger=require(_0x1843('0x2'))(_0x1843('0x3'));var moment=require(_0x1843('0x4'));var BPromise=require(_0x1843('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1843('0x6'));var rimraf=require(_0x1843('0x7'));var config=require('../../config/environment');var attributes=require(_0x1843('0x8'));module[_0x1843('0x9')]=function(_0x23da12,_0x55be2d){return _0x23da12[_0x1843('0xa')](_0x1843('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x1843('0xc'),'fields':[_0x1843('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a5bc8e2..c796dbb 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15bce3,_0x313900){var _0x5db551=function(_0x5c33a8){while(--_0x5c33a8){_0x15bce3['push'](_0x15bce3['shift']());}};_0x5db551(++_0x313900);}(_0x326f,0xd1));var _0xf326=function(_0x4aacf3,_0x36404e){_0x4aacf3=_0x4aacf3-0x0;var _0x125f06=_0x326f[_0x4aacf3];return _0x125f06;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x583001,_0x22ea15){var _0x2ec632=function(_0x1009c6){while(--_0x1009c6){_0x583001['push'](_0x583001['shift']());}};_0x2ec632(++_0x22ea15);}(_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')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index ec6aa51..540c2f0 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(_0x538484,_0x373398){var _0x1f5f6f=function(_0x4c10c5){while(--_0x4c10c5){_0x538484['push'](_0x538484['shift']());}};_0x1f5f6f(++_0x373398);}(_0x70e0,0x17b));var _0x070e=function(_0x4bfa7d,_0x4c0552){_0x4bfa7d=_0x4bfa7d-0x0;var _0x46cefd=_0x70e0[_0x4bfa7d];return _0x46cefd;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1c7f4f,_0x3607fb){var _0x43d09c=function(_0x3f63fd){while(--_0x3f63fd){_0x1c7f4f['push'](_0x1c7f4f['shift']());}};_0x43d09c(++_0x3607fb);}(_0x70e0,0x17b));var _0x070e=function(_0x294481,_0x16bfd8){_0x294481=_0x294481-0x0;var _0x167ecd=_0x70e0[_0x294481];return _0x167ecd;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b987950..0c8998a 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 _0x1a0a=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x21b232,_0x1b9b77){var _0x54a541=function(_0x466d43){while(--_0x466d43){_0x21b232['push'](_0x21b232['shift']());}};_0x54a541(++_0x1b9b77);}(_0x1a0a,0xcd));var _0xa1a0=function(_0x3f47bd,_0xa1b88c){_0x3f47bd=_0x3f47bd-0x0;var _0x133064=_0x1a0a[_0x3f47bd];return _0x133064;};'use strict';var Sequelize=require(_0xa1a0('0x0'));module[_0xa1a0('0x1')]={'description':{'type':Sequelize[_0xa1a0('0x2')]},'host':{'type':Sequelize[_0xa1a0('0x2')]},'authentication':{'type':Sequelize[_0xa1a0('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa1a0('0x2')]},'password':{'type':Sequelize[_0xa1a0('0x2')]},'port':{'type':Sequelize[_0xa1a0('0x4')]},'tls':{'type':Sequelize[_0xa1a0('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa1a0('0x2')],'defaultValue':_0xa1a0('0x5')},'connTimeout':{'type':Sequelize[_0xa1a0('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa1a0('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa1a0('0x2')]},'modernAuthentication':{'type':Sequelize[_0xa1a0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xad59=['INTEGER','exports','BOOLEAN','STRING','INBOX'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xad59,0x178));var _0x9ad5=function(_0x2425fc,_0x1a7fcf){_0x2425fc=_0x2425fc-0x0;var _0x3635d6=_0xad59[_0x2425fc];return _0x3635d6;};'use strict';var Sequelize=require('sequelize');module[_0x9ad5('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x9ad5('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9ad5('0x2')]},'password':{'type':Sequelize[_0x9ad5('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x9ad5('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':_0x9ad5('0x3')},'connTimeout':{'type':Sequelize[_0x9ad5('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9ad5('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9ad5('0x2')]},'modernAuthentication':{'type':Sequelize[_0x9ad5('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index d29761a..5a758cb 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 _0xbbc6=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','MailServerIn','lodash','util'];(function(_0x453d39,_0x3f30a8){var _0x180696=function(_0x2f549b){while(--_0x2f549b){_0x453d39['push'](_0x453d39['shift']());}};_0x180696(++_0x3f30a8);}(_0xbbc6,0x8d));var _0x6bbc=function(_0x570d8d,_0x583e9a){_0x570d8d=_0x570d8d-0x0;var _0x3cdb8d=_0xbbc6[_0x570d8d];return _0x3cdb8d;};'use strict';var _=require(_0x6bbc('0x0'));var util=require(_0x6bbc('0x1'));var logger=require(_0x6bbc('0x2'))(_0x6bbc('0x3'));var moment=require(_0x6bbc('0x4'));var BPromise=require(_0x6bbc('0x5'));var rp=require(_0x6bbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bbc('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x6bbc('0x8')]=function(_0x927219,_0x25c269){return _0x927219[_0x6bbc('0x9')](_0x6bbc('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1782=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5c25e4,_0x16d106){var _0x1796ba=function(_0x2d69ba){while(--_0x2d69ba){_0x5c25e4['push'](_0x5c25e4['shift']());}};_0x1796ba(++_0x16d106);}(_0x1782,0x13a));var _0x2178=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x1782[_0x3fb9dd];return _0x20136a;};'use strict';var _=require(_0x2178('0x0'));var util=require(_0x2178('0x1'));var logger=require(_0x2178('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2178('0x3'));var rp=require(_0x2178('0x4'));var fs=require('fs');var path=require(_0x2178('0x5'));var rimraf=require(_0x2178('0x6'));var config=require(_0x2178('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x2178('0x8')]=function(_0x548164,_0x53471d){return _0x548164[_0x2178('0x9')](_0x2178('0xa'),attributes,{'tableName':_0x2178('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index cf67a1b..ce2a9e9 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 _0xf9ec=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','options','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','MailServerIn,\x20%s,\x20%s'];(function(_0x234d60,_0x5de6ee){var _0x5e8d45=function(_0x57d6a4){while(--_0x57d6a4){_0x234d60['push'](_0x234d60['shift']());}};_0x5e8d45(++_0x5de6ee);}(_0xf9ec,0x128));var _0xcf9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9ec[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcf9e('0x0'));var util=require(_0xcf9e('0x1'));var moment=require(_0xcf9e('0x2'));var BPromise=require(_0xcf9e('0x3'));var rs=require(_0xcf9e('0x4'));var fs=require('fs');var Redis=require(_0xcf9e('0x5'));var db=require(_0xcf9e('0x6'))['db'];var utils=require(_0xcf9e('0x7'));var logger=require('../../config/logger')(_0xcf9e('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf9e('0x9'));var client=jayson['client'][_0xcf9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15f596,_0x2abc78,_0x18a02a){return new BPromise(function(_0x28be63,_0x5d4b23){return client[_0xcf9e('0xb')](_0x15f596,_0x18a02a)['then'](function(_0x4b2935){logger[_0xcf9e('0xc')](_0xcf9e('0xd'),_0x2abc78,'request\x20sent');logger[_0xcf9e('0xe')](_0xcf9e('0xf'),_0x2abc78,_0xcf9e('0x10'),JSON[_0xcf9e('0x11')](_0x4b2935));if(_0x4b2935[_0xcf9e('0x12')]){if(_0x4b2935[_0xcf9e('0x12')][_0xcf9e('0x13')]===0x1f4){logger[_0xcf9e('0x12')](_0xcf9e('0xd'),_0x2abc78,_0x4b2935[_0xcf9e('0x12')][_0xcf9e('0x14')]);return _0x5d4b23(_0x4b2935[_0xcf9e('0x12')][_0xcf9e('0x14')]);}logger[_0xcf9e('0x12')](_0xcf9e('0xd'),_0x2abc78,_0x4b2935[_0xcf9e('0x12')][_0xcf9e('0x14')]);return _0x28be63(_0x4b2935[_0xcf9e('0x12')]['message']);}else{logger['info'](_0xcf9e('0xd'),_0x2abc78,'request\x20sent');_0x28be63(_0x4b2935['result'][_0xcf9e('0x14')]);}})[_0xcf9e('0x15')](function(_0x4d307a){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2abc78,_0x4d307a);_0x5d4b23(_0x4d307a);});});}exports[_0xcf9e('0x16')]=function(_0x3a9e24){var _0x5e9cc7=this;return new Promise(function(_0x1c3852,_0x9e46ce){return db[_0xcf9e('0x17')]['findAll']({'raw':_0x3a9e24[_0xcf9e('0x18')]?_0x3a9e24[_0xcf9e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3a9e24[_0xcf9e('0x18')]?_0x3a9e24['options']['where']||null:null,'attributes':_0x3a9e24[_0xcf9e('0x18')]?_0x3a9e24['options'][_0xcf9e('0x19')]||null:null,'limit':_0x3a9e24[_0xcf9e('0x18')]?_0x3a9e24[_0xcf9e('0x18')][_0xcf9e('0x1a')]||null:null,'include':_0x3a9e24[_0xcf9e('0x18')]?_0x3a9e24[_0xcf9e('0x18')][_0xcf9e('0x1b')]?_[_0xcf9e('0x1c')](_0x3a9e24[_0xcf9e('0x18')][_0xcf9e('0x1b')],function(_0x161aca){return{'model':db[_0x161aca['model']],'as':_0x161aca['as'],'attributes':_0x161aca[_0xcf9e('0x19')],'include':_0x161aca[_0xcf9e('0x1b')]?_[_0xcf9e('0x1c')](_0x161aca[_0xcf9e('0x1b')],function(_0x42e2fc){return{'model':db[_0x42e2fc[_0xcf9e('0x1d')]],'as':_0x42e2fc['as'],'attributes':_0x42e2fc[_0xcf9e('0x19')],'include':_0x42e2fc[_0xcf9e('0x1b')]?_['map'](_0x42e2fc[_0xcf9e('0x1b')],function(_0x340e4f){return{'model':db[_0x340e4f[_0xcf9e('0x1d')]],'as':_0x340e4f['as'],'attributes':_0x340e4f[_0xcf9e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcf9e('0x1e')](function(_0x36c188){logger['info'](_0xcf9e('0x16'),_0x3a9e24);logger[_0xcf9e('0xe')]('GetMailServerIn',_0x3a9e24,JSON[_0xcf9e('0x11')](_0x36c188));_0x1c3852(_0x36c188);})[_0xcf9e('0x15')](function(_0xf1f32b){logger[_0xcf9e('0x12')](_0xcf9e('0x16'),_0xf1f32b[_0xcf9e('0x14')],_0x3a9e24);_0x9e46ce(_0x5e9cc7['error'](0x1f4,_0xf1f32b[_0xcf9e('0x14')]));});});}; \ No newline at end of file +var _0x8e99=['findAll','options','attributes','limit','map','include','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn'];(function(_0x24bfa8,_0x12a681){var _0x54507d=function(_0x1dc4ee){while(--_0x1dc4ee){_0x24bfa8['push'](_0x24bfa8['shift']());}};_0x54507d(++_0x12a681);}(_0x8e99,0x167));var _0x98e9=function(_0x4ced95,_0x344d6c){_0x4ced95=_0x4ced95-0x0;var _0x2f6ffd=_0x8e99[_0x4ced95];return _0x2f6ffd;};'use strict';var _=require(_0x98e9('0x0'));var util=require(_0x98e9('0x1'));var moment=require(_0x98e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x98e9('0x3'));var fs=require('fs');var Redis=require(_0x98e9('0x4'));var db=require(_0x98e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x98e9('0x6'))(_0x98e9('0x7'));var config=require(_0x98e9('0x8'));var jayson=require(_0x98e9('0x9'));var client=jayson[_0x98e9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa9cc92,_0x5b470f,_0x36e8a5){return new BPromise(function(_0x3ae944,_0x4da16d){return client[_0x98e9('0xb')](_0xa9cc92,_0x36e8a5)[_0x98e9('0xc')](function(_0x17ad1c){logger[_0x98e9('0xd')](_0x98e9('0xe'),_0x5b470f,_0x98e9('0xf'));logger[_0x98e9('0x10')](_0x98e9('0x11'),_0x5b470f,'request\x20sent',JSON[_0x98e9('0x12')](_0x17ad1c));if(_0x17ad1c['error']){if(_0x17ad1c[_0x98e9('0x13')][_0x98e9('0x14')]===0x1f4){logger[_0x98e9('0x13')](_0x98e9('0xe'),_0x5b470f,_0x17ad1c['error']['message']);return _0x4da16d(_0x17ad1c[_0x98e9('0x13')][_0x98e9('0x15')]);}logger[_0x98e9('0x13')](_0x98e9('0xe'),_0x5b470f,_0x17ad1c[_0x98e9('0x13')]['message']);return _0x3ae944(_0x17ad1c['error'][_0x98e9('0x15')]);}else{logger['info'](_0x98e9('0xe'),_0x5b470f,'request\x20sent');_0x3ae944(_0x17ad1c[_0x98e9('0x16')][_0x98e9('0x15')]);}})[_0x98e9('0x17')](function(_0x5a5f2b){logger[_0x98e9('0x13')](_0x98e9('0xe'),_0x5b470f,_0x5a5f2b);_0x4da16d(_0x5a5f2b);});});}exports[_0x98e9('0x18')]=function(_0x388edb){var _0x10fcc0=this;return new Promise(function(_0xafe490,_0x2feaac){return db['MailServerIn'][_0x98e9('0x19')]({'raw':_0x388edb[_0x98e9('0x1a')]?_0x388edb[_0x98e9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x388edb[_0x98e9('0x1a')]?_0x388edb[_0x98e9('0x1a')]['where']||null:null,'attributes':_0x388edb[_0x98e9('0x1a')]?_0x388edb[_0x98e9('0x1a')][_0x98e9('0x1b')]||null:null,'limit':_0x388edb[_0x98e9('0x1a')]?_0x388edb[_0x98e9('0x1a')][_0x98e9('0x1c')]||null:null,'include':_0x388edb[_0x98e9('0x1a')]?_0x388edb['options']['include']?_[_0x98e9('0x1d')](_0x388edb[_0x98e9('0x1a')][_0x98e9('0x1e')],function(_0x13f1e0){return{'model':db[_0x13f1e0[_0x98e9('0x1f')]],'as':_0x13f1e0['as'],'attributes':_0x13f1e0['attributes'],'include':_0x13f1e0[_0x98e9('0x1e')]?_[_0x98e9('0x1d')](_0x13f1e0['include'],function(_0xa170d3){return{'model':db[_0xa170d3[_0x98e9('0x1f')]],'as':_0xa170d3['as'],'attributes':_0xa170d3['attributes'],'include':_0xa170d3[_0x98e9('0x1e')]?_[_0x98e9('0x1d')](_0xa170d3[_0x98e9('0x1e')],function(_0x4df381){return{'model':db[_0x4df381[_0x98e9('0x1f')]],'as':_0x4df381['as'],'attributes':_0x4df381[_0x98e9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x98e9('0xc')](function(_0x16a77e){logger[_0x98e9('0xd')](_0x98e9('0x18'),_0x388edb);logger[_0x98e9('0x10')](_0x98e9('0x18'),_0x388edb,JSON['stringify'](_0x16a77e));_0xafe490(_0x16a77e);})[_0x98e9('0x17')](function(_0xd787f2){logger['error']('GetMailServerIn',_0xd787f2[_0x98e9('0x15')],_0x388edb);_0x2feaac(_0x10fcc0[_0x98e9('0x13')](0x1f4,_0xd787f2[_0x98e9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0988932..80d7085 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(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7a54,0x106));var _0x47a5=function(_0x2f563c,_0x55f4df){_0x2f563c=_0x2f563c-0x0;var _0x4d7d1f=_0x7a54[_0x2f563c];return _0x4d7d1f;};'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(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7a54,0x106));var _0x47a5=function(_0x551e94,_0x453eac){_0x551e94=_0x551e94-0x0;var _0x5882b3=_0x7a54[_0x551e94];return _0x5882b3;};'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 5b5f43e..5deebe4 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 _0xe820=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe820,0xd2));var _0x0e82=function(_0x2c6175,_0x3c50a6){_0x2c6175=_0x2c6175-0x0;var _0x5148d0=_0xe820[_0x2c6175];return _0x5148d0;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'description':{'type':Sequelize[_0x0e82('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x0e82('0x1')]},'port':{'type':Sequelize[_0x0e82('0x2')]},'secure':{'type':Sequelize[_0x0e82('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0e82('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3de3=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x45d4b9,_0x1594d2){var _0xbd805a=function(_0x22cf77){while(--_0x22cf77){_0x45d4b9['push'](_0x45d4b9['shift']());}};_0xbd805a(++_0x1594d2);}(_0x3de3,0x1ce));var _0x33de=function(_0x29e458,_0x321bd6){_0x29e458=_0x29e458-0x0;var _0x1a4a9d=_0x3de3[_0x29e458];return _0x1a4a9d;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'description':{'type':Sequelize[_0x33de('0x1')]},'host':{'type':Sequelize[_0x33de('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x33de('0x1')]},'port':{'type':Sequelize[_0x33de('0x2')]},'secure':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x33de('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x33de('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 d203eca..9cebd30 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 _0xf95e=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','rows','catch','show','include','options','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x405f28,_0x3ea99f){var _0x1a6075=function(_0x1d8d30){while(--_0x1d8d30){_0x405f28['push'](_0x405f28['shift']());}};_0x1a6075(++_0x3ea99f);}(_0xf95e,0x106));var _0xef95=function(_0x5e4d4c,_0x329d62){_0x5e4d4c=_0x5e4d4c-0x0;var _0x431016=_0xf95e[_0x5e4d4c];return _0x431016;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef95('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef95('0x1'));var rp=require(_0xef95('0x2'));var moment=require(_0xef95('0x3'));var BPromise=require(_0xef95('0x4'));var Mustache=require(_0xef95('0x5'));var util=require('util');var path=require(_0xef95('0x6'));var sox=require(_0xef95('0x7'));var csv=require(_0xef95('0x8'));var ejs=require(_0xef95('0x9'));var fs=require('fs');var fs_extra=require(_0xef95('0xa'));var _=require('lodash');var squel=require(_0xef95('0xb'));var crypto=require(_0xef95('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef95('0xd'));var Papa=require(_0xef95('0xe'));var Redis=require(_0xef95('0xf'));var authService=require(_0xef95('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xef95('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef95('0x12'))(_0xef95('0x13'));var utils=require(_0xef95('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xef95('0x15'));var db=require(_0xef95('0x16'))['db'];function respondWithStatusCode(_0x4b7185,_0x4a557b){_0x4a557b=_0x4a557b||0xcc;return function(_0x55b73b){if(_0x55b73b){return _0x4b7185[_0xef95('0x17')](_0x4a557b);}return _0x4b7185[_0xef95('0x18')](_0x4a557b)['end']();};}function respondWithResult(_0x14a2e1,_0x223a0c){_0x223a0c=_0x223a0c||0xc8;return function(_0x296aae){if(_0x296aae){return _0x14a2e1[_0xef95('0x18')](_0x223a0c)[_0xef95('0x19')](_0x296aae);}};}function respondWithFilteredResult(_0x21c87e,_0x41144f){return function(_0x1d7ae5){if(_0x1d7ae5){var _0x3086c9=typeof _0x41144f[_0xef95('0x1a')]===_0xef95('0x1b')&&typeof _0x41144f[_0xef95('0x1c')]==='undefined';var _0x4d2302=_0x1d7ae5['count'];var _0x571482=_0x3086c9?0x0:_0x41144f[_0xef95('0x1a')];var _0xd21790=_0x3086c9?_0x1d7ae5[_0xef95('0x1d')]:_0x41144f['offset']+_0x41144f[_0xef95('0x1c')];var _0x1af518;if(_0xd21790>=_0x4d2302){_0xd21790=_0x4d2302;_0x1af518=0xc8;}else{_0x1af518=0xce;}_0x21c87e[_0xef95('0x18')](_0x1af518);return _0x21c87e[_0xef95('0x1e')](_0xef95('0x1f'),_0x571482+'-'+_0xd21790+'/'+_0x4d2302)[_0xef95('0x19')](_0x1d7ae5);}return null;};}function patchUpdates(_0x8bb33f){return function(_0x442460){try{jsonpatch[_0xef95('0x20')](_0x442460,_0x8bb33f,!![]);}catch(_0x4fa710){return BPromise[_0xef95('0x21')](_0x4fa710);}return _0x442460['save']();};}function saveUpdates(_0x2dca59,_0x391e7f){return function(_0x1383ac){if(_0x1383ac){return _0x1383ac[_0xef95('0x22')](_0x2dca59)[_0xef95('0x23')](function(_0x5387f9){return _0x5387f9;});}return null;};}function removeEntity(_0x79f3d2,_0x57d6f4){return function(_0x32e2f5){if(_0x32e2f5){return _0x32e2f5[_0xef95('0x24')]()[_0xef95('0x23')](function(){_0x79f3d2[_0xef95('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e755,_0x1de27c){return function(_0x3cd240){if(!_0x3cd240){_0x25e755[_0xef95('0x17')](0x194);}return _0x3cd240;};}function handleError(_0xa71ae,_0x982021){_0x982021=_0x982021||0x1f4;return function(_0x5096d0){logger[_0xef95('0x25')](_0x5096d0[_0xef95('0x26')]);if(_0x5096d0[_0xef95('0x27')]){delete _0x5096d0['name'];}_0xa71ae[_0xef95('0x18')](_0x982021)[_0xef95('0x28')](_0x5096d0);};}exports[_0xef95('0x29')]=function(_0x18846e,_0x57d32e){var _0x1d7c43={},_0x49c37c={},_0x2e3d8f={'count':0x0,'rows':[]};var _0x1ea19f=_[_0xef95('0x2a')](db[_0xef95('0x2b')][_0xef95('0x2c')],function(_0x4ead5c){return{'name':_0x4ead5c[_0xef95('0x2d')],'type':_0x4ead5c[_0xef95('0x2e')][_0xef95('0x2f')]};});_0x49c37c[_0xef95('0x30')]=_[_0xef95('0x2a')](_0x1ea19f,_0xef95('0x27'));_0x49c37c[_0xef95('0x31')]=_[_0xef95('0x32')](_0x18846e[_0xef95('0x31')]);_0x49c37c[_0xef95('0x33')]=_[_0xef95('0x34')](_0x49c37c[_0xef95('0x30')],_0x49c37c[_0xef95('0x31')]);_0x1d7c43['attributes']=_[_0xef95('0x34')](_0x49c37c[_0xef95('0x30')],qs[_0xef95('0x35')](_0x18846e[_0xef95('0x31')][_0xef95('0x35')]));_0x1d7c43[_0xef95('0x36')]=_0x1d7c43['attributes'][_0xef95('0x37')]?_0x1d7c43['attributes']:_0x49c37c[_0xef95('0x30')];if(!_0x18846e['query'][_0xef95('0x38')]('nolimit')){_0x1d7c43[_0xef95('0x1c')]=qs[_0xef95('0x1c')](_0x18846e['query'][_0xef95('0x1c')]);_0x1d7c43[_0xef95('0x1a')]=qs['offset'](_0x18846e[_0xef95('0x31')][_0xef95('0x1a')]);}_0x1d7c43['order']=qs[_0xef95('0x39')](_0x18846e[_0xef95('0x31')]['sort']);_0x1d7c43[_0xef95('0x3a')]=qs[_0xef95('0x33')](_[_0xef95('0x3b')](_0x18846e['query'],_0x49c37c[_0xef95('0x33')]),_0x1ea19f);if(_0x18846e['query'][_0xef95('0x3c')]){_0x1d7c43['where']=_[_0xef95('0x3d')](_0x1d7c43[_0xef95('0x3a')],{'$or':_[_0xef95('0x2a')](_0x1ea19f,function(_0x429fe0){if(_0x429fe0[_0xef95('0x2e')]!=='VIRTUAL'){var _0x280c73={};_0x280c73[_0x429fe0['name']]={'$like':'%'+_0x18846e[_0xef95('0x31')][_0xef95('0x3c')]+'%'};return _0x280c73;}})});}_0x1d7c43=_['merge']({},_0x1d7c43,_0x18846e['options']);var _0x49ea99={'where':_0x1d7c43[_0xef95('0x3a')]};return db[_0xef95('0x2b')][_0xef95('0x1d')](_0x49ea99)[_0xef95('0x23')](function(_0x3a9ceb){_0x2e3d8f['count']=_0x3a9ceb;if(_0x18846e[_0xef95('0x31')][_0xef95('0x3e')]){_0x1d7c43['include']=[{'all':!![]}];}return db[_0xef95('0x2b')]['findAll'](_0x1d7c43);})[_0xef95('0x23')](function(_0x4d9b5d){_0x2e3d8f[_0xef95('0x3f')]=_0x4d9b5d;return _0x2e3d8f;})[_0xef95('0x23')](respondWithFilteredResult(_0x57d32e,_0x1d7c43))[_0xef95('0x40')](handleError(_0x57d32e,null));};exports[_0xef95('0x41')]=function(_0x22043b,_0x59869c){var _0x552d80={'raw':!![],'where':{'id':_0x22043b['params']['id']}},_0x52cf28={};_0x52cf28[_0xef95('0x30')]=_[_0xef95('0x32')](db[_0xef95('0x2b')][_0xef95('0x2c')]);_0x52cf28['query']=_[_0xef95('0x32')](_0x22043b[_0xef95('0x31')]);_0x52cf28[_0xef95('0x33')]=_['intersection'](_0x52cf28[_0xef95('0x30')],_0x52cf28[_0xef95('0x31')]);_0x552d80[_0xef95('0x36')]=_['intersection'](_0x52cf28[_0xef95('0x30')],qs['fields'](_0x22043b[_0xef95('0x31')][_0xef95('0x35')]));_0x552d80[_0xef95('0x36')]=_0x552d80[_0xef95('0x36')][_0xef95('0x37')]?_0x552d80[_0xef95('0x36')]:_0x52cf28['model'];if(_0x22043b[_0xef95('0x31')]['includeAll']){_0x552d80[_0xef95('0x42')]=[{'all':!![]}];}_0x552d80=_[_0xef95('0x3d')]({},_0x552d80,_0x22043b[_0xef95('0x43')]);return db[_0xef95('0x2b')][_0xef95('0x44')](_0x552d80)[_0xef95('0x23')](handleEntityNotFound(_0x59869c,null))[_0xef95('0x23')](respondWithResult(_0x59869c,null))['catch'](handleError(_0x59869c,null));};exports[_0xef95('0x45')]=function(_0x522324,_0x314384){return db[_0xef95('0x2b')]['create'](_0x522324[_0xef95('0x46')],{})[_0xef95('0x23')](respondWithResult(_0x314384,0xc9))[_0xef95('0x40')](handleError(_0x314384,null));};exports[_0xef95('0x22')]=function(_0x1f4edd,_0xe85078){if(_0x1f4edd[_0xef95('0x46')]['id']){delete _0x1f4edd[_0xef95('0x46')]['id'];}return db[_0xef95('0x2b')][_0xef95('0x44')]({'where':{'id':_0x1f4edd[_0xef95('0x47')]['id']}})[_0xef95('0x23')](handleEntityNotFound(_0xe85078,null))[_0xef95('0x23')](saveUpdates(_0x1f4edd['body'],null))[_0xef95('0x23')](respondWithResult(_0xe85078,null))['catch'](handleError(_0xe85078,null));};exports['destroy']=function(_0x1a64d0,_0x4d5d30){return db[_0xef95('0x2b')][_0xef95('0x44')]({'where':{'id':_0x1a64d0[_0xef95('0x47')]['id']}})[_0xef95('0x23')](handleEntityNotFound(_0x4d5d30,null))[_0xef95('0x23')](removeEntity(_0x4d5d30,null))['catch'](handleError(_0x4d5d30,null));}; \ No newline at end of file +var _0xadf6=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','MailServerOut','includeAll','findAll','rows','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xadf6,0x17b));var _0x6adf=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xadf6[_0x4b7b62];return _0x2280df;};'use strict';var emlformat=require(_0x6adf('0x0'));var rimraf=require(_0x6adf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6adf('0x2'));var rp=require(_0x6adf('0x3'));var moment=require('moment');var BPromise=require(_0x6adf('0x4'));var Mustache=require(_0x6adf('0x5'));var util=require(_0x6adf('0x6'));var path=require(_0x6adf('0x7'));var sox=require('sox');var csv=require(_0x6adf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6adf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6adf('0xa'));var deskjs=require(_0x6adf('0xb'));var toCsv=require(_0x6adf('0x8'));var querystring=require(_0x6adf('0xc'));var Papa=require(_0x6adf('0xd'));var Redis=require('ioredis');var authService=require(_0x6adf('0xe'));var qs=require(_0x6adf('0xf'));var as=require(_0x6adf('0x10'));var hardwareService=require(_0x6adf('0x11'));var logger=require(_0x6adf('0x12'))('api');var utils=require(_0x6adf('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6adf('0x14'))['db'];function respondWithStatusCode(_0xd77d14,_0x454a28){_0x454a28=_0x454a28||0xcc;return function(_0x354469){if(_0x354469){return _0xd77d14[_0x6adf('0x15')](_0x454a28);}return _0xd77d14[_0x6adf('0x16')](_0x454a28)[_0x6adf('0x17')]();};}function respondWithResult(_0x2f20b9,_0x2dfe36){_0x2dfe36=_0x2dfe36||0xc8;return function(_0x2e907c){if(_0x2e907c){return _0x2f20b9[_0x6adf('0x16')](_0x2dfe36)[_0x6adf('0x18')](_0x2e907c);}};}function respondWithFilteredResult(_0x3a0c5c,_0x47f902){return function(_0x50ab72){if(_0x50ab72){var _0x4adec9=typeof _0x47f902[_0x6adf('0x19')]===_0x6adf('0x1a')&&typeof _0x47f902['limit']===_0x6adf('0x1a');var _0x53877d=_0x50ab72[_0x6adf('0x1b')];var _0xf4c888=_0x4adec9?0x0:_0x47f902[_0x6adf('0x19')];var _0x3ff54b=_0x4adec9?_0x50ab72[_0x6adf('0x1b')]:_0x47f902[_0x6adf('0x19')]+_0x47f902[_0x6adf('0x1c')];var _0x329f72;if(_0x3ff54b>=_0x53877d){_0x3ff54b=_0x53877d;_0x329f72=0xc8;}else{_0x329f72=0xce;}_0x3a0c5c[_0x6adf('0x16')](_0x329f72);return _0x3a0c5c[_0x6adf('0x1d')](_0x6adf('0x1e'),_0xf4c888+'-'+_0x3ff54b+'/'+_0x53877d)[_0x6adf('0x18')](_0x50ab72);}return null;};}function patchUpdates(_0x3d5797){return function(_0x29aa2e){try{jsonpatch['apply'](_0x29aa2e,_0x3d5797,!![]);}catch(_0x7f9533){return BPromise[_0x6adf('0x1f')](_0x7f9533);}return _0x29aa2e[_0x6adf('0x20')]();};}function saveUpdates(_0x18b3eb,_0x10f270){return function(_0x568012){if(_0x568012){return _0x568012[_0x6adf('0x21')](_0x18b3eb)[_0x6adf('0x22')](function(_0x13483c){return _0x13483c;});}return null;};}function removeEntity(_0x35c4cf,_0x402778){return function(_0x1020f7){if(_0x1020f7){return _0x1020f7[_0x6adf('0x23')]()[_0x6adf('0x22')](function(){_0x35c4cf[_0x6adf('0x16')](0xcc)[_0x6adf('0x17')]();});}};}function handleEntityNotFound(_0x38403e,_0x32ffd2){return function(_0x3731c5){if(!_0x3731c5){_0x38403e['sendStatus'](0x194);}return _0x3731c5;};}function handleError(_0x51e6e5,_0x189fa8){_0x189fa8=_0x189fa8||0x1f4;return function(_0x132428){logger[_0x6adf('0x24')](_0x132428[_0x6adf('0x25')]);if(_0x132428[_0x6adf('0x26')]){delete _0x132428[_0x6adf('0x26')];}_0x51e6e5[_0x6adf('0x16')](_0x189fa8)['send'](_0x132428);};}exports[_0x6adf('0x27')]=function(_0x461242,_0x2f2cfa){var _0x251b55={},_0x3cb697={},_0x2ee795={'count':0x0,'rows':[]};var _0x29bc6b=_[_0x6adf('0x28')](db['MailServerOut'][_0x6adf('0x29')],function(_0x57f7f6){return{'name':_0x57f7f6[_0x6adf('0x2a')],'type':_0x57f7f6[_0x6adf('0x2b')]['key']};});_0x3cb697[_0x6adf('0x2c')]=_[_0x6adf('0x28')](_0x29bc6b,_0x6adf('0x26'));_0x3cb697[_0x6adf('0x2d')]=_['keys'](_0x461242['query']);_0x3cb697[_0x6adf('0x2e')]=_[_0x6adf('0x2f')](_0x3cb697[_0x6adf('0x2c')],_0x3cb697[_0x6adf('0x2d')]);_0x251b55[_0x6adf('0x30')]=_['intersection'](_0x3cb697['model'],qs[_0x6adf('0x31')](_0x461242[_0x6adf('0x2d')]['fields']));_0x251b55['attributes']=_0x251b55['attributes'][_0x6adf('0x32')]?_0x251b55[_0x6adf('0x30')]:_0x3cb697['model'];if(!_0x461242[_0x6adf('0x2d')][_0x6adf('0x33')](_0x6adf('0x34'))){_0x251b55['limit']=qs['limit'](_0x461242[_0x6adf('0x2d')][_0x6adf('0x1c')]);_0x251b55[_0x6adf('0x19')]=qs['offset'](_0x461242[_0x6adf('0x2d')][_0x6adf('0x19')]);}_0x251b55['order']=qs[_0x6adf('0x35')](_0x461242[_0x6adf('0x2d')][_0x6adf('0x35')]);_0x251b55['where']=qs[_0x6adf('0x2e')](_[_0x6adf('0x36')](_0x461242[_0x6adf('0x2d')],_0x3cb697[_0x6adf('0x2e')]),_0x29bc6b);if(_0x461242[_0x6adf('0x2d')][_0x6adf('0x37')]){_0x251b55[_0x6adf('0x38')]=_['merge'](_0x251b55['where'],{'$or':_[_0x6adf('0x28')](_0x29bc6b,function(_0x260904){if(_0x260904[_0x6adf('0x2b')]!=='VIRTUAL'){var _0x3a6ad5={};_0x3a6ad5[_0x260904[_0x6adf('0x26')]]={'$like':'%'+_0x461242['query']['filter']+'%'};return _0x3a6ad5;}})});}_0x251b55=_[_0x6adf('0x39')]({},_0x251b55,_0x461242[_0x6adf('0x3a')]);var _0x2cd29c={'where':_0x251b55[_0x6adf('0x38')]};return db[_0x6adf('0x3b')][_0x6adf('0x1b')](_0x2cd29c)[_0x6adf('0x22')](function(_0x182570){_0x2ee795[_0x6adf('0x1b')]=_0x182570;if(_0x461242['query'][_0x6adf('0x3c')]){_0x251b55['include']=[{'all':!![]}];}return db[_0x6adf('0x3b')][_0x6adf('0x3d')](_0x251b55);})['then'](function(_0x50b7f0){_0x2ee795[_0x6adf('0x3e')]=_0x50b7f0;return _0x2ee795;})[_0x6adf('0x22')](respondWithFilteredResult(_0x2f2cfa,_0x251b55))['catch'](handleError(_0x2f2cfa,null));};exports['show']=function(_0x4cd733,_0x2405ce){var _0x4cb005={'raw':!![],'where':{'id':_0x4cd733[_0x6adf('0x3f')]['id']}},_0x403ae7={};_0x403ae7[_0x6adf('0x2c')]=_['keys'](db[_0x6adf('0x3b')]['rawAttributes']);_0x403ae7[_0x6adf('0x2d')]=_['keys'](_0x4cd733['query']);_0x403ae7[_0x6adf('0x2e')]=_['intersection'](_0x403ae7[_0x6adf('0x2c')],_0x403ae7[_0x6adf('0x2d')]);_0x4cb005[_0x6adf('0x30')]=_[_0x6adf('0x2f')](_0x403ae7['model'],qs[_0x6adf('0x31')](_0x4cd733[_0x6adf('0x2d')][_0x6adf('0x31')]));_0x4cb005[_0x6adf('0x30')]=_0x4cb005[_0x6adf('0x30')]['length']?_0x4cb005['attributes']:_0x403ae7['model'];if(_0x4cd733[_0x6adf('0x2d')]['includeAll']){_0x4cb005[_0x6adf('0x40')]=[{'all':!![]}];}_0x4cb005=_[_0x6adf('0x39')]({},_0x4cb005,_0x4cd733[_0x6adf('0x3a')]);return db[_0x6adf('0x3b')][_0x6adf('0x41')](_0x4cb005)[_0x6adf('0x22')](handleEntityNotFound(_0x2405ce,null))['then'](respondWithResult(_0x2405ce,null))['catch'](handleError(_0x2405ce,null));};exports[_0x6adf('0x42')]=function(_0x24fc2f,_0x4005b5){return db['MailServerOut'][_0x6adf('0x42')](_0x24fc2f[_0x6adf('0x43')],{})[_0x6adf('0x22')](respondWithResult(_0x4005b5,0xc9))['catch'](handleError(_0x4005b5,null));};exports['update']=function(_0xb42f30,_0x536800){if(_0xb42f30[_0x6adf('0x43')]['id']){delete _0xb42f30[_0x6adf('0x43')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0xb42f30[_0x6adf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x536800,null))['then'](saveUpdates(_0xb42f30[_0x6adf('0x43')],null))['then'](respondWithResult(_0x536800,null))['catch'](handleError(_0x536800,null));};exports['destroy']=function(_0x5895f2,_0x45b1d6){return db[_0x6adf('0x3b')][_0x6adf('0x41')]({'where':{'id':_0x5895f2[_0x6adf('0x3f')]['id']}})[_0x6adf('0x22')](handleEntityNotFound(_0x45b1d6,null))[_0x6adf('0x22')](removeEntity(_0x45b1d6,null))['catch'](handleError(_0x45b1d6,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1631c53..1fdadaf 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 _0xb45c=['lodash','api','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out'];(function(_0x290cdc,_0x24138b){var _0x516668=function(_0x3e04ae){while(--_0x3e04ae){_0x290cdc['push'](_0x290cdc['shift']());}};_0x516668(++_0x24138b);}(_0xb45c,0x140));var _0xcb45=function(_0x5da2d6,_0x28ab1a){_0x5da2d6=_0x5da2d6-0x0;var _0x390b81=_0xb45c[_0x5da2d6];return _0x390b81;};'use strict';var _=require(_0xcb45('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcb45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb45('0x2'));var fs=require('fs');var path=require(_0xcb45('0x3'));var rimraf=require(_0xcb45('0x4'));var config=require(_0xcb45('0x5'));var attributes=require(_0xcb45('0x6'));module['exports']=function(_0x5092dd,_0x139f44){return _0x5092dd[_0xcb45('0x7')](_0xcb45('0x8'),attributes,{'tableName':_0xcb45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d94=['mail_servers_out','lodash','moment','request-promise','path','../../config/environment','exports'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0x9d94,0x16d));var _0x49d9=function(_0xba4285,_0x359800){_0xba4285=_0xba4285-0x0;var _0x42513f=_0x9d94[_0xba4285];return _0x42513f;};'use strict';var _=require(_0x49d9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x49d9('0x1'));var BPromise=require('bluebird');var rp=require(_0x49d9('0x2'));var fs=require('fs');var path=require(_0x49d9('0x3'));var rimraf=require('rimraf');var config=require(_0x49d9('0x4'));var attributes=require('./mailServerOut.attributes');module[_0x49d9('0x5')]=function(_0xf9d07,_0x1fd76a){return _0xf9d07['define']('MailServerOut',attributes,{'tableName':_0x49d9('0x6'),'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 9e9bae4..9cbaa2c 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x35505b,_0x1cf27c){var _0x3bff78=function(_0x2158bf){while(--_0x2158bf){_0x35505b['push'](_0x35505b['shift']());}};_0x3bff78(++_0x1cf27c);}(_0x1261,0x144));var _0x1126=function(_0x1e4177,_0x26a73a){_0x1e4177=_0x1e4177-0x0;var _0xa6e76c=_0x1261[_0x1e4177];return _0xa6e76c;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3fd9d8,_0x9a1892){var _0x181131=function(_0x5a0d16){while(--_0x5a0d16){_0x3fd9d8['push'](_0x3fd9d8['shift']());}};_0x181131(++_0x9a1892);}(_0x2ef3,0xba));var _0x32ef=function(_0x49d457,_0xcb129){_0x49d457=_0x49d457-0x0;var _0x4ef765=_0x2ef3[_0x49d457];return _0x4ef765;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c7f25f4..e1bab20 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 _0xec7e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete'];(function(_0x4ba380,_0x259bee){var _0x4b111b=function(_0x2bf227){while(--_0x2bf227){_0x4ba380['push'](_0x4ba380['shift']());}};_0x4b111b(++_0x259bee);}(_0xec7e,0x144));var _0xeec7=function(_0x4d2d79,_0x4c0494){_0x4d2d79=_0x4d2d79-0x0;var _0x176ed6=_0xec7e[_0x4d2d79];return _0x176ed6;};'use strict';var multer=require(_0xeec7('0x0'));var util=require(_0xeec7('0x1'));var path=require(_0xeec7('0x2'));var timeout=require(_0xeec7('0x3'));var express=require(_0xeec7('0x4'));var router=express[_0xeec7('0x5')]();var fs_extra=require(_0xeec7('0x6'));var auth=require(_0xeec7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xeec7('0x8'));var controller=require(_0xeec7('0x9'));router[_0xeec7('0xa')]('/',auth['isAuthenticated'](),controller[_0xeec7('0xb')]);router[_0xeec7('0xa')](_0xeec7('0xc'),auth[_0xeec7('0xd')](),controller[_0xeec7('0xe')]);router['get'](_0xeec7('0xf'),auth['isAuthenticated'](),controller[_0xeec7('0x10')]);router['post']('/',auth[_0xeec7('0xd')](),controller[_0xeec7('0x11')]);router[_0xeec7('0x12')](_0xeec7('0xf'),auth['isAuthenticated'](),controller[_0xeec7('0x13')]);router[_0xeec7('0x14')](_0xeec7('0xf'),auth['isAuthenticated'](),controller[_0xeec7('0x15')]);module[_0xeec7('0x16')]=router; \ No newline at end of file +var _0xf315=['post','create','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf315,0x1b9));var _0x5f31=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf315[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5f31('0x0'));var util=require(_0x5f31('0x1'));var path=require(_0x5f31('0x2'));var timeout=require(_0x5f31('0x3'));var express=require(_0x5f31('0x4'));var router=express['Router']();var fs_extra=require(_0x5f31('0x5'));var auth=require(_0x5f31('0x6'));var interaction=require(_0x5f31('0x7'));var config=require(_0x5f31('0x8'));var controller=require('./mailSubstatus.controller');router[_0x5f31('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5f31('0x9')](_0x5f31('0xa'),auth['isAuthenticated'](),controller[_0x5f31('0xb')]);router[_0x5f31('0x9')](_0x5f31('0xc'),auth[_0x5f31('0xd')](),controller[_0x5f31('0xe')]);router[_0x5f31('0xf')]('/',auth[_0x5f31('0xd')](),controller[_0x5f31('0x10')]);router['put'](_0x5f31('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5f31('0xc'),auth[_0x5f31('0xd')](),controller[_0x5f31('0x11')]);module[_0x5f31('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 79081a0..7cd716c 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 _0xe2bc=['sequelize','STRING'];(function(_0x20cff7,_0x47a279){var _0x593346=function(_0x11913b){while(--_0x11913b){_0x20cff7['push'](_0x20cff7['shift']());}};_0x593346(++_0x47a279);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe2bc[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xce2b('0x0'));module['exports']={'name':{'type':Sequelize[_0xce2b('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xce2b('0x1')]}}; \ No newline at end of file +var _0xcf98=['exports','STRING','name'];(function(_0x5a097c,_0x28506f){var _0x51b539=function(_0xd64448){while(--_0xd64448){_0x5a097c['push'](_0x5a097c['shift']());}};_0x51b539(++_0x28506f);}(_0xcf98,0x8d));var _0x8cf9=function(_0x13f4d3,_0x64f7f6){_0x13f4d3=_0x13f4d3-0x0;var _0x19729a=_0xcf98[_0x13f4d3];return _0x19729a;};'use strict';var Sequelize=require('sequelize');module[_0x8cf9('0x0')]={'name':{'type':Sequelize[_0x8cf9('0x1')],'unique':_0x8cf9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8cf9('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9829ee1..55c4e9a 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 _0x1141=['path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','index','map','MailSubstatus','fieldName','type','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','merge','name','filter','findAll','rows','catch','params','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0x1141,0x15a));var _0x1114=function(_0x39fba9,_0x245311){_0x39fba9=_0x39fba9-0x0;var _0x3078c5=_0x1141[_0x39fba9];return _0x3078c5;};'use strict';var emlformat=require(_0x1114('0x0'));var rimraf=require(_0x1114('0x1'));var zipdir=require(_0x1114('0x2'));var jsonpatch=require(_0x1114('0x3'));var rp=require(_0x1114('0x4'));var moment=require(_0x1114('0x5'));var BPromise=require(_0x1114('0x6'));var Mustache=require(_0x1114('0x7'));var util=require(_0x1114('0x8'));var path=require(_0x1114('0x9'));var sox=require('sox');var csv=require(_0x1114('0xa'));var ejs=require(_0x1114('0xb'));var fs=require('fs');var fs_extra=require(_0x1114('0xc'));var _=require(_0x1114('0xd'));var squel=require('squel');var crypto=require(_0x1114('0xe'));var jsforce=require(_0x1114('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1114('0x10'));var Papa=require('papaparse');var Redis=require(_0x1114('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1114('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1114('0x13'));var logger=require(_0x1114('0x14'))(_0x1114('0x15'));var utils=require(_0x1114('0x16'));var config=require(_0x1114('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1114('0x18'))['db'];function respondWithStatusCode(_0x4c4be1,_0x491cc0){_0x491cc0=_0x491cc0||0xcc;return function(_0x26ada7){if(_0x26ada7){return _0x4c4be1[_0x1114('0x19')](_0x491cc0);}return _0x4c4be1[_0x1114('0x1a')](_0x491cc0)['end']();};}function respondWithResult(_0x4898e1,_0x33fdbc){_0x33fdbc=_0x33fdbc||0xc8;return function(_0x4f6ddf){if(_0x4f6ddf){return _0x4898e1[_0x1114('0x1a')](_0x33fdbc)['json'](_0x4f6ddf);}};}function respondWithFilteredResult(_0x9e09f5,_0x1d6d4c){return function(_0x4f8c32){if(_0x4f8c32){var _0x4a4022=typeof _0x1d6d4c[_0x1114('0x1b')]===_0x1114('0x1c')&&typeof _0x1d6d4c[_0x1114('0x1d')]==='undefined';var _0x26e522=_0x4f8c32[_0x1114('0x1e')];var _0x560159=_0x4a4022?0x0:_0x1d6d4c[_0x1114('0x1b')];var _0x23ba11=_0x4a4022?_0x4f8c32[_0x1114('0x1e')]:_0x1d6d4c[_0x1114('0x1b')]+_0x1d6d4c[_0x1114('0x1d')];var _0x1cb91e;if(_0x23ba11>=_0x26e522){_0x23ba11=_0x26e522;_0x1cb91e=0xc8;}else{_0x1cb91e=0xce;}_0x9e09f5[_0x1114('0x1a')](_0x1cb91e);return _0x9e09f5[_0x1114('0x1f')](_0x1114('0x20'),_0x560159+'-'+_0x23ba11+'/'+_0x26e522)[_0x1114('0x21')](_0x4f8c32);}return null;};}function patchUpdates(_0x559fb2){return function(_0xfab9e4){try{jsonpatch[_0x1114('0x22')](_0xfab9e4,_0x559fb2,!![]);}catch(_0x5f4535){return BPromise['reject'](_0x5f4535);}return _0xfab9e4[_0x1114('0x23')]();};}function saveUpdates(_0x5975cf,_0x412aee){return function(_0x34948f){if(_0x34948f){return _0x34948f[_0x1114('0x24')](_0x5975cf)[_0x1114('0x25')](function(_0x158c73){return _0x158c73;});}return null;};}function removeEntity(_0x499ec4,_0x235499){return function(_0x4dbd92){if(_0x4dbd92){return _0x4dbd92[_0x1114('0x26')]()[_0x1114('0x25')](function(){_0x499ec4[_0x1114('0x1a')](0xcc)[_0x1114('0x27')]();});}};}function handleEntityNotFound(_0x4d762f,_0x279e32){return function(_0x2a0a73){if(!_0x2a0a73){_0x4d762f[_0x1114('0x19')](0x194);}return _0x2a0a73;};}function handleError(_0x53b9e4,_0x21846c){_0x21846c=_0x21846c||0x1f4;return function(_0xbd68b3){logger[_0x1114('0x28')](_0xbd68b3[_0x1114('0x29')]);if(_0xbd68b3['name']){delete _0xbd68b3['name'];}_0x53b9e4[_0x1114('0x1a')](_0x21846c)['send'](_0xbd68b3);};}exports[_0x1114('0x2a')]=function(_0x1235bf,_0x4f4503){var _0x569901={},_0x29a438={},_0x5a9c1c={'count':0x0,'rows':[]};var _0x38908a=_[_0x1114('0x2b')](db[_0x1114('0x2c')]['rawAttributes'],function(_0x47d9fa){return{'name':_0x47d9fa[_0x1114('0x2d')],'type':_0x47d9fa[_0x1114('0x2e')]['key']};});_0x29a438[_0x1114('0x2f')]=_[_0x1114('0x2b')](_0x38908a,'name');_0x29a438[_0x1114('0x30')]=_[_0x1114('0x31')](_0x1235bf[_0x1114('0x30')]);_0x29a438['filters']=_['intersection'](_0x29a438[_0x1114('0x2f')],_0x29a438[_0x1114('0x30')]);_0x569901[_0x1114('0x32')]=_[_0x1114('0x33')](_0x29a438[_0x1114('0x2f')],qs[_0x1114('0x34')](_0x1235bf['query'][_0x1114('0x34')]));_0x569901[_0x1114('0x32')]=_0x569901[_0x1114('0x32')]['length']?_0x569901[_0x1114('0x32')]:_0x29a438[_0x1114('0x2f')];if(!_0x1235bf[_0x1114('0x30')]['hasOwnProperty'](_0x1114('0x35'))){_0x569901[_0x1114('0x1d')]=qs[_0x1114('0x1d')](_0x1235bf['query'][_0x1114('0x1d')]);_0x569901['offset']=qs['offset'](_0x1235bf['query'][_0x1114('0x1b')]);}_0x569901['order']=qs[_0x1114('0x36')](_0x1235bf[_0x1114('0x30')][_0x1114('0x36')]);_0x569901[_0x1114('0x37')]=qs[_0x1114('0x38')](_['pick'](_0x1235bf[_0x1114('0x30')],_0x29a438[_0x1114('0x38')]),_0x38908a);if(_0x1235bf[_0x1114('0x30')]['filter']){_0x569901[_0x1114('0x37')]=_[_0x1114('0x39')](_0x569901[_0x1114('0x37')],{'$or':_[_0x1114('0x2b')](_0x38908a,function(_0x56a7a0){if(_0x56a7a0[_0x1114('0x2e')]!=='VIRTUAL'){var _0x5b00ed={};_0x5b00ed[_0x56a7a0[_0x1114('0x3a')]]={'$like':'%'+_0x1235bf[_0x1114('0x30')][_0x1114('0x3b')]+'%'};return _0x5b00ed;}})});}_0x569901=_[_0x1114('0x39')]({},_0x569901,_0x1235bf['options']);var _0x3b28ab={'where':_0x569901[_0x1114('0x37')]};return db[_0x1114('0x2c')][_0x1114('0x1e')](_0x3b28ab)[_0x1114('0x25')](function(_0x36a514){_0x5a9c1c[_0x1114('0x1e')]=_0x36a514;if(_0x1235bf[_0x1114('0x30')]['includeAll']){_0x569901['include']=[{'all':!![]}];}return db[_0x1114('0x2c')][_0x1114('0x3c')](_0x569901);})[_0x1114('0x25')](function(_0x515785){_0x5a9c1c[_0x1114('0x3d')]=_0x515785;return _0x5a9c1c;})[_0x1114('0x25')](respondWithFilteredResult(_0x4f4503,_0x569901))[_0x1114('0x3e')](handleError(_0x4f4503,null));};exports['show']=function(_0x480cf7,_0x411817){var _0x374a6c={'raw':!![],'where':{'id':_0x480cf7[_0x1114('0x3f')]['id']}},_0x119042={};_0x119042[_0x1114('0x2f')]=_[_0x1114('0x31')](db['MailSubstatus'][_0x1114('0x40')]);_0x119042[_0x1114('0x30')]=_[_0x1114('0x31')](_0x480cf7['query']);_0x119042[_0x1114('0x38')]=_[_0x1114('0x33')](_0x119042[_0x1114('0x2f')],_0x119042[_0x1114('0x30')]);_0x374a6c[_0x1114('0x32')]=_[_0x1114('0x33')](_0x119042[_0x1114('0x2f')],qs[_0x1114('0x34')](_0x480cf7['query']['fields']));_0x374a6c[_0x1114('0x32')]=_0x374a6c[_0x1114('0x32')][_0x1114('0x41')]?_0x374a6c['attributes']:_0x119042['model'];if(_0x480cf7[_0x1114('0x30')][_0x1114('0x42')]){_0x374a6c['include']=[{'all':!![]}];}_0x374a6c=_[_0x1114('0x39')]({},_0x374a6c,_0x480cf7['options']);return db[_0x1114('0x2c')][_0x1114('0x43')](_0x374a6c)[_0x1114('0x25')](handleEntityNotFound(_0x411817,null))['then'](respondWithResult(_0x411817,null))[_0x1114('0x3e')](handleError(_0x411817,null));};exports[_0x1114('0x44')]=function(_0xfb5d8c,_0x1c625c){return db['MailSubstatus'][_0x1114('0x44')](_0xfb5d8c[_0x1114('0x45')],{})[_0x1114('0x25')](respondWithResult(_0x1c625c,0xc9))[_0x1114('0x3e')](handleError(_0x1c625c,null));};exports[_0x1114('0x24')]=function(_0x6965aa,_0x4d76a7){if(_0x6965aa['body']['id']){delete _0x6965aa[_0x1114('0x45')]['id'];}return db[_0x1114('0x2c')]['find']({'where':{'id':_0x6965aa[_0x1114('0x3f')]['id']}})[_0x1114('0x25')](handleEntityNotFound(_0x4d76a7,null))[_0x1114('0x25')](saveUpdates(_0x6965aa[_0x1114('0x45')],null))[_0x1114('0x25')](respondWithResult(_0x4d76a7,null))[_0x1114('0x3e')](handleError(_0x4d76a7,null));};exports[_0x1114('0x26')]=function(_0x463bf6,_0x5cbc0c){return db[_0x1114('0x2c')]['find']({'where':{'id':_0x463bf6[_0x1114('0x3f')]['id']}})[_0x1114('0x25')](handleEntityNotFound(_0x5cbc0c,null))['then'](removeEntity(_0x5cbc0c,null))[_0x1114('0x3e')](handleError(_0x5cbc0c,null));};exports[_0x1114('0x46')]=function(_0x5b75cf,_0x43ab77){return db[_0x1114('0x2c')][_0x1114('0x46')]()[_0x1114('0x25')](respondWithResult(_0x43ab77,null))[_0x1114('0x3e')](handleError(_0x43ab77,null));}; \ No newline at end of file +var _0xb70d=['include','findAll','catch','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','json','undefined','count','limit','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll'];(function(_0x56a3e2,_0x202071){var _0x29b3d6=function(_0xb0c933){while(--_0xb0c933){_0x56a3e2['push'](_0x56a3e2['shift']());}};_0x29b3d6(++_0x202071);}(_0xb70d,0x176));var _0xdb70=function(_0x506198,_0x262c2e){_0x506198=_0x506198-0x0;var _0x3af787=_0xb70d[_0x506198];return _0x3af787;};'use strict';var emlformat=require(_0xdb70('0x0'));var rimraf=require(_0xdb70('0x1'));var zipdir=require(_0xdb70('0x2'));var jsonpatch=require(_0xdb70('0x3'));var rp=require(_0xdb70('0x4'));var moment=require(_0xdb70('0x5'));var BPromise=require(_0xdb70('0x6'));var Mustache=require('mustache');var util=require(_0xdb70('0x7'));var path=require('path');var sox=require(_0xdb70('0x8'));var csv=require(_0xdb70('0x9'));var ejs=require(_0xdb70('0xa'));var fs=require('fs');var fs_extra=require(_0xdb70('0xb'));var _=require(_0xdb70('0xc'));var squel=require(_0xdb70('0xd'));var crypto=require(_0xdb70('0xe'));var jsforce=require(_0xdb70('0xf'));var deskjs=require(_0xdb70('0x10'));var toCsv=require(_0xdb70('0x9'));var querystring=require(_0xdb70('0x11'));var Papa=require('papaparse');var Redis=require(_0xdb70('0x12'));var authService=require(_0xdb70('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdb70('0x14'));var hardwareService=require(_0xdb70('0x15'));var logger=require(_0xdb70('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdb70('0x17'))['db'];function respondWithStatusCode(_0x4f01e2,_0x5c234b){_0x5c234b=_0x5c234b||0xcc;return function(_0x66c977){if(_0x66c977){return _0x4f01e2['sendStatus'](_0x5c234b);}return _0x4f01e2[_0xdb70('0x18')](_0x5c234b)['end']();};}function respondWithResult(_0x255ba9,_0x398519){_0x398519=_0x398519||0xc8;return function(_0x1eb8f0){if(_0x1eb8f0){return _0x255ba9[_0xdb70('0x18')](_0x398519)[_0xdb70('0x19')](_0x1eb8f0);}};}function respondWithFilteredResult(_0x26980c,_0x94c7a1){return function(_0x3997ee){if(_0x3997ee){var _0x1090f9=typeof _0x94c7a1['offset']==='undefined'&&typeof _0x94c7a1['limit']===_0xdb70('0x1a');var _0x49bd24=_0x3997ee[_0xdb70('0x1b')];var _0x728233=_0x1090f9?0x0:_0x94c7a1['offset'];var _0x5a433e=_0x1090f9?_0x3997ee[_0xdb70('0x1b')]:_0x94c7a1['offset']+_0x94c7a1[_0xdb70('0x1c')];var _0x408bbc;if(_0x5a433e>=_0x49bd24){_0x5a433e=_0x49bd24;_0x408bbc=0xc8;}else{_0x408bbc=0xce;}_0x26980c['status'](_0x408bbc);return _0x26980c[_0xdb70('0x1d')](_0xdb70('0x1e'),_0x728233+'-'+_0x5a433e+'/'+_0x49bd24)['json'](_0x3997ee);}return null;};}function patchUpdates(_0x1f3af1){return function(_0x4a6ac9){try{jsonpatch['apply'](_0x4a6ac9,_0x1f3af1,!![]);}catch(_0x4833ca){return BPromise[_0xdb70('0x1f')](_0x4833ca);}return _0x4a6ac9[_0xdb70('0x20')]();};}function saveUpdates(_0x3dd816,_0xbd800c){return function(_0xee722){if(_0xee722){return _0xee722[_0xdb70('0x21')](_0x3dd816)[_0xdb70('0x22')](function(_0x39eb83){return _0x39eb83;});}return null;};}function removeEntity(_0x5ba922,_0x3d5cc3){return function(_0x91f58){if(_0x91f58){return _0x91f58['destroy']()['then'](function(){_0x5ba922[_0xdb70('0x18')](0xcc)[_0xdb70('0x23')]();});}};}function handleEntityNotFound(_0x423853,_0x4fa567){return function(_0x5d107e){if(!_0x5d107e){_0x423853[_0xdb70('0x24')](0x194);}return _0x5d107e;};}function handleError(_0x3fa32c,_0x30350e){_0x30350e=_0x30350e||0x1f4;return function(_0xa1a837){logger[_0xdb70('0x25')](_0xa1a837[_0xdb70('0x26')]);if(_0xa1a837['name']){delete _0xa1a837[_0xdb70('0x27')];}_0x3fa32c[_0xdb70('0x18')](_0x30350e)[_0xdb70('0x28')](_0xa1a837);};}exports['index']=function(_0x24d480,_0xa4eca1){var _0x4f49af={},_0x4a4011={},_0x3bc2c5={'count':0x0,'rows':[]};var _0x627c75=_[_0xdb70('0x29')](db[_0xdb70('0x2a')][_0xdb70('0x2b')],function(_0x33790f){return{'name':_0x33790f['fieldName'],'type':_0x33790f[_0xdb70('0x2c')][_0xdb70('0x2d')]};});_0x4a4011[_0xdb70('0x2e')]=_[_0xdb70('0x29')](_0x627c75,'name');_0x4a4011[_0xdb70('0x2f')]=_[_0xdb70('0x30')](_0x24d480[_0xdb70('0x2f')]);_0x4a4011[_0xdb70('0x31')]=_[_0xdb70('0x32')](_0x4a4011['model'],_0x4a4011['query']);_0x4f49af[_0xdb70('0x33')]=_[_0xdb70('0x32')](_0x4a4011['model'],qs[_0xdb70('0x34')](_0x24d480['query'][_0xdb70('0x34')]));_0x4f49af['attributes']=_0x4f49af[_0xdb70('0x33')][_0xdb70('0x35')]?_0x4f49af[_0xdb70('0x33')]:_0x4a4011['model'];if(!_0x24d480[_0xdb70('0x2f')]['hasOwnProperty'](_0xdb70('0x36'))){_0x4f49af[_0xdb70('0x1c')]=qs[_0xdb70('0x1c')](_0x24d480[_0xdb70('0x2f')][_0xdb70('0x1c')]);_0x4f49af[_0xdb70('0x37')]=qs[_0xdb70('0x37')](_0x24d480[_0xdb70('0x2f')][_0xdb70('0x37')]);}_0x4f49af[_0xdb70('0x38')]=qs[_0xdb70('0x39')](_0x24d480[_0xdb70('0x2f')]['sort']);_0x4f49af[_0xdb70('0x3a')]=qs['filters'](_['pick'](_0x24d480['query'],_0x4a4011[_0xdb70('0x31')]),_0x627c75);if(_0x24d480[_0xdb70('0x2f')][_0xdb70('0x3b')]){_0x4f49af[_0xdb70('0x3a')]=_[_0xdb70('0x3c')](_0x4f49af[_0xdb70('0x3a')],{'$or':_['map'](_0x627c75,function(_0x4abb6f){if(_0x4abb6f[_0xdb70('0x2c')]!==_0xdb70('0x3d')){var _0x4de937={};_0x4de937[_0x4abb6f[_0xdb70('0x27')]]={'$like':'%'+_0x24d480[_0xdb70('0x2f')]['filter']+'%'};return _0x4de937;}})});}_0x4f49af=_['merge']({},_0x4f49af,_0x24d480[_0xdb70('0x3e')]);var _0x442e13={'where':_0x4f49af[_0xdb70('0x3a')]};return db[_0xdb70('0x2a')][_0xdb70('0x1b')](_0x442e13)[_0xdb70('0x22')](function(_0x50d106){_0x3bc2c5[_0xdb70('0x1b')]=_0x50d106;if(_0x24d480['query'][_0xdb70('0x3f')]){_0x4f49af[_0xdb70('0x40')]=[{'all':!![]}];}return db[_0xdb70('0x2a')][_0xdb70('0x41')](_0x4f49af);})[_0xdb70('0x22')](function(_0x344fe4){_0x3bc2c5['rows']=_0x344fe4;return _0x3bc2c5;})[_0xdb70('0x22')](respondWithFilteredResult(_0xa4eca1,_0x4f49af))[_0xdb70('0x42')](handleError(_0xa4eca1,null));};exports['show']=function(_0x19f4b0,_0x5f3ab7){var _0x391786={'raw':!![],'where':{'id':_0x19f4b0['params']['id']}},_0x568624={};_0x568624[_0xdb70('0x2e')]=_[_0xdb70('0x30')](db[_0xdb70('0x2a')][_0xdb70('0x2b')]);_0x568624[_0xdb70('0x2f')]=_['keys'](_0x19f4b0[_0xdb70('0x2f')]);_0x568624[_0xdb70('0x31')]=_[_0xdb70('0x32')](_0x568624[_0xdb70('0x2e')],_0x568624['query']);_0x391786[_0xdb70('0x33')]=_[_0xdb70('0x32')](_0x568624[_0xdb70('0x2e')],qs[_0xdb70('0x34')](_0x19f4b0[_0xdb70('0x2f')][_0xdb70('0x34')]));_0x391786[_0xdb70('0x33')]=_0x391786[_0xdb70('0x33')][_0xdb70('0x35')]?_0x391786[_0xdb70('0x33')]:_0x568624['model'];if(_0x19f4b0[_0xdb70('0x2f')][_0xdb70('0x3f')]){_0x391786[_0xdb70('0x40')]=[{'all':!![]}];}_0x391786=_[_0xdb70('0x3c')]({},_0x391786,_0x19f4b0['options']);return db['MailSubstatus'][_0xdb70('0x43')](_0x391786)[_0xdb70('0x22')](handleEntityNotFound(_0x5f3ab7,null))['then'](respondWithResult(_0x5f3ab7,null))[_0xdb70('0x42')](handleError(_0x5f3ab7,null));};exports[_0xdb70('0x44')]=function(_0x9b5344,_0x595887){return db[_0xdb70('0x2a')][_0xdb70('0x44')](_0x9b5344['body'],{})[_0xdb70('0x22')](respondWithResult(_0x595887,0xc9))['catch'](handleError(_0x595887,null));};exports[_0xdb70('0x21')]=function(_0x3fcaa2,_0x24143f){if(_0x3fcaa2[_0xdb70('0x45')]['id']){delete _0x3fcaa2['body']['id'];}return db[_0xdb70('0x2a')][_0xdb70('0x43')]({'where':{'id':_0x3fcaa2[_0xdb70('0x46')]['id']}})['then'](handleEntityNotFound(_0x24143f,null))[_0xdb70('0x22')](saveUpdates(_0x3fcaa2[_0xdb70('0x45')],null))[_0xdb70('0x22')](respondWithResult(_0x24143f,null))[_0xdb70('0x42')](handleError(_0x24143f,null));};exports[_0xdb70('0x47')]=function(_0x41f092,_0x2871a7){return db[_0xdb70('0x2a')][_0xdb70('0x43')]({'where':{'id':_0x41f092[_0xdb70('0x46')]['id']}})[_0xdb70('0x22')](handleEntityNotFound(_0x2871a7,null))['then'](removeEntity(_0x2871a7,null))['catch'](handleError(_0x2871a7,null));};exports[_0xdb70('0x48')]=function(_0x594686,_0x66b14c){return db['MailSubstatus'][_0xdb70('0x48')]()[_0xdb70('0x22')](respondWithResult(_0x66b14c,null))[_0xdb70('0x42')](handleError(_0x66b14c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6abaf82..3455e88 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 _0x386a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x386a,0x187));var _0xa386=function(_0x496fd5,_0x454006){_0x496fd5=_0x496fd5-0x0;var _0x3545ce=_0x386a[_0x496fd5];return _0x3545ce;};'use strict';var EventEmitter=require(_0xa386('0x0'));var MailSubstatus=require(_0xa386('0x1'))['db'][_0xa386('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa386('0x3')](0x0);var events={'afterUpdate':_0xa386('0x4')};function emitEvent(_0x58399a){return function(_0x18e100,_0xf2192f,_0x20cdf2){MailSubstatusEvents[_0xa386('0x5')](_0x58399a+':'+_0x18e100['id'],_0x18e100);MailSubstatusEvents[_0xa386('0x5')](_0x58399a,_0x18e100);_0x20cdf2(null);};}for(var e in events){if(events[_0xa386('0x6')](e)){var event=events[e];MailSubstatus[_0xa386('0x7')](e,emitEvent(event));}}module[_0xa386('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x2ad9=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0x2ad9,0x108));var _0x92ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ad9[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x92ad('0x0'));var MailSubstatus=require(_0x92ad('0x1'))['db'][_0x92ad('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x92ad('0x3')](0x0);var events={'afterUpdate':_0x92ad('0x4')};function emitEvent(_0x5aba9a){return function(_0x13c7de,_0x4391c2,_0x3c83a1){MailSubstatusEvents[_0x92ad('0x5')](_0x5aba9a+':'+_0x13c7de['id'],_0x13c7de);MailSubstatusEvents['emit'](_0x5aba9a,_0x13c7de);_0x3c83a1(null);};}for(var e in events){if(events[_0x92ad('0x6')](e)){var event=events[e];MailSubstatus[_0x92ad('0x7')](e,emitEvent(event));}}module[_0x92ad('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 55d597c..dcde41c 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 _0xb9ca=['define','MailSubstatus','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x515be2,_0x51b3ff){var _0x514679=function(_0x562c51){while(--_0x562c51){_0x515be2['push'](_0x515be2['shift']());}};_0x514679(++_0x51b3ff);}(_0xb9ca,0x11d));var _0xab9c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xb9ca[_0x47b58b];return _0x46bebe;};'use strict';var attributes=require(_0xab9c('0x0'));module[_0xab9c('0x1')]=function(_0x3679a0){var _0x1d3ef5=_0x3679a0[_0xab9c('0x2')];return _0x3679a0[_0xab9c('0x3')](_0xab9c('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1cb040,_0x4d7d3a,_0x327fbc){return _0x1d3ef5[_0xab9c('0x5')][_0xab9c('0x6')]({'value':_0x1cb040[_0xab9c('0x7')]},{'where':{'field':_0xab9c('0x8'),'value':_0x1cb040[_0xab9c('0x9')]['name']}})[_0xab9c('0xa')](function(){_0x327fbc();})[_0xab9c('0xb')](function(_0x4511ef){_0x327fbc(_0x4511ef);});}}});}; \ No newline at end of file +var _0x07a6=['catch','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','name'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x07a6,0xbf));var _0x607a=function(_0x88804a,_0x1f5f63){_0x88804a=_0x88804a-0x0;var _0x49ac73=_0x07a6[_0x88804a];return _0x49ac73;};'use strict';var attributes=require(_0x607a('0x0'));module[_0x607a('0x1')]=function(_0x16692c){var _0x47f529=_0x16692c['models'];return _0x16692c[_0x607a('0x2')](_0x607a('0x3'),attributes,{'tableName':_0x607a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x53cfeb,_0x26523e,_0x4987a2){return _0x47f529[_0x607a('0x5')][_0x607a('0x6')]({'value':_0x53cfeb['name']},{'where':{'field':_0x607a('0x7'),'value':_0x53cfeb['_previousDataValues'][_0x607a('0x8')]}})['then'](function(){_0x4987a2();})[_0x607a('0x9')](function(_0x3d46fd){_0x4987a2(_0x3d46fd);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index b2e505d..3c79f24 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 _0x6f8f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x469eac,_0x5ea831){var _0x36dd7d=function(_0x225c90){while(--_0x225c90){_0x469eac['push'](_0x469eac['shift']());}};_0x36dd7d(++_0x5ea831);}(_0x6f8f,0x192));var _0xf6f8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f8f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6f8('0x0'));var util=require(_0xf6f8('0x1'));var moment=require(_0xf6f8('0x2'));var BPromise=require(_0xf6f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6f8('0x4'))['db'];var utils=require(_0xf6f8('0x5'));var logger=require(_0xf6f8('0x6'))(_0xf6f8('0x7'));var config=require(_0xf6f8('0x8'));var jayson=require(_0xf6f8('0x9'));var client=jayson[_0xf6f8('0xa')][_0xf6f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc53535,_0x25882c,_0x3c29a1){return new BPromise(function(_0x5a441b,_0x35d497){return client[_0xf6f8('0xc')](_0xc53535,_0x3c29a1)[_0xf6f8('0xd')](function(_0x3e98cb){logger[_0xf6f8('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x25882c,_0xf6f8('0xf'));logger[_0xf6f8('0x10')](_0xf6f8('0x11'),_0x25882c,_0xf6f8('0xf'),JSON[_0xf6f8('0x12')](_0x3e98cb));if(_0x3e98cb[_0xf6f8('0x13')]){if(_0x3e98cb['error'][_0xf6f8('0x14')]===0x1f4){logger[_0xf6f8('0x13')](_0xf6f8('0x15'),_0x25882c,_0x3e98cb[_0xf6f8('0x13')][_0xf6f8('0x16')]);return _0x35d497(_0x3e98cb[_0xf6f8('0x13')][_0xf6f8('0x16')]);}logger[_0xf6f8('0x13')](_0xf6f8('0x15'),_0x25882c,_0x3e98cb[_0xf6f8('0x13')][_0xf6f8('0x16')]);return _0x5a441b(_0x3e98cb[_0xf6f8('0x13')]['message']);}else{logger['info'](_0xf6f8('0x15'),_0x25882c,_0xf6f8('0xf'));_0x5a441b(_0x3e98cb['result'][_0xf6f8('0x16')]);}})[_0xf6f8('0x17')](function(_0x4871d7){logger[_0xf6f8('0x13')](_0xf6f8('0x15'),_0x25882c,_0x4871d7);_0x35d497(_0x4871d7);});});} \ No newline at end of file +var _0xa5f4=['result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','code','error','MailSubstatus,\x20%s,\x20%s','message'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa5f4,0xd4));var _0x4a5f=function(_0x198799,_0x5e65e9){_0x198799=_0x198799-0x0;var _0x54ba3e=_0xa5f4[_0x198799];return _0x54ba3e;};'use strict';var _=require(_0x4a5f('0x0'));var util=require('util');var moment=require(_0x4a5f('0x1'));var BPromise=require(_0x4a5f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a5f('0x3'))['db'];var utils=require(_0x4a5f('0x4'));var logger=require(_0x4a5f('0x5'))(_0x4a5f('0x6'));var config=require(_0x4a5f('0x7'));var jayson=require(_0x4a5f('0x8'));var client=jayson[_0x4a5f('0x9')][_0x4a5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53554c,_0x23e2e3,_0x4c1816){return new BPromise(function(_0x35ab74,_0x5c6bbb){return client[_0x4a5f('0xb')](_0x53554c,_0x4c1816)['then'](function(_0x30b9c5){logger[_0x4a5f('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x23e2e3,'request\x20sent');logger[_0x4a5f('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x23e2e3,_0x4a5f('0xe'),JSON['stringify'](_0x30b9c5));if(_0x30b9c5['error']){if(_0x30b9c5['error'][_0x4a5f('0xf')]===0x1f4){logger[_0x4a5f('0x10')](_0x4a5f('0x11'),_0x23e2e3,_0x30b9c5[_0x4a5f('0x10')]['message']);return _0x5c6bbb(_0x30b9c5[_0x4a5f('0x10')][_0x4a5f('0x12')]);}logger[_0x4a5f('0x10')](_0x4a5f('0x11'),_0x23e2e3,_0x30b9c5[_0x4a5f('0x10')][_0x4a5f('0x12')]);return _0x35ab74(_0x30b9c5[_0x4a5f('0x10')][_0x4a5f('0x12')]);}else{logger['info'](_0x4a5f('0x11'),_0x23e2e3,_0x4a5f('0xe'));_0x35ab74(_0x30b9c5[_0x4a5f('0x13')][_0x4a5f('0x12')]);}})[_0x4a5f('0x14')](function(_0x57a65e){logger[_0x4a5f('0x10')](_0x4a5f('0x11'),_0x23e2e3,_0x57a65e);_0x5c6bbb(_0x57a65e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6f775c9..9f26f5c 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 _0xc39d=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','exports','multer'];(function(_0xb3ed0b,_0x4d238a){var _0x5b6013=function(_0x2bcf1c){while(--_0x2bcf1c){_0xb3ed0b['push'](_0xb3ed0b['shift']());}};_0x5b6013(++_0x4d238a);}(_0xc39d,0xef));var _0xdc39=function(_0x335136,_0x131d00){_0x335136=_0x335136-0x0;var _0x234b60=_0xc39d[_0x335136];return _0x234b60;};'use strict';var multer=require(_0xdc39('0x0'));var util=require(_0xdc39('0x1'));var path=require(_0xdc39('0x2'));var timeout=require(_0xdc39('0x3'));var express=require(_0xdc39('0x4'));var router=express[_0xdc39('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdc39('0x6'));var config=require(_0xdc39('0x7'));var controller=require(_0xdc39('0x8'));router['get']('/',auth[_0xdc39('0x9')](),controller[_0xdc39('0xa')]);router[_0xdc39('0xb')](_0xdc39('0xc'),auth['isAuthenticated'](),controller[_0xdc39('0xd')]);router[_0xdc39('0xb')](_0xdc39('0xe'),auth[_0xdc39('0x9')](),controller[_0xdc39('0xf')]);router[_0xdc39('0x10')]('/',auth[_0xdc39('0x9')](),controller['create']);router['put']('/:id',auth[_0xdc39('0x9')](),controller[_0xdc39('0x11')]);router[_0xdc39('0x12')](_0xdc39('0xe'),auth[_0xdc39('0x9')](),controller['destroy']);module[_0xdc39('0x13')]=router; \ No newline at end of file +var _0x0110=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get','/:id','show','create','delete','destroy','exports','multer','util','path'];(function(_0xe7082a,_0xd0d68f){var _0x92f6a8=function(_0x214ad7){while(--_0x214ad7){_0xe7082a['push'](_0xe7082a['shift']());}};_0x92f6a8(++_0xd0d68f);}(_0x0110,0x9f));var _0x0011=function(_0x236d39,_0x2fd1db){_0x236d39=_0x236d39-0x0;var _0x302fb4=_0x0110[_0x236d39];return _0x302fb4;};'use strict';var multer=require(_0x0011('0x0'));var util=require(_0x0011('0x1'));var path=require(_0x0011('0x2'));var timeout=require(_0x0011('0x3'));var express=require(_0x0011('0x4'));var router=express['Router']();var fs_extra=require(_0x0011('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0011('0x6'));var config=require(_0x0011('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0011('0x8')]);router['get']('/describe',auth[_0x0011('0x9')](),controller[_0x0011('0xa')]);router[_0x0011('0xb')](_0x0011('0xc'),auth[_0x0011('0x9')](),controller[_0x0011('0xd')]);router['post']('/',auth[_0x0011('0x9')](),controller[_0x0011('0xe')]);router['put'](_0x0011('0xc'),auth[_0x0011('0x9')](),controller['update']);router[_0x0011('0xf')](_0x0011('0xc'),auth['isAuthenticated'](),controller[_0x0011('0x10')]);module[_0x0011('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c8f397d..9f0a1d0 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3e665d,_0xef863d){var _0x24a155=function(_0x1343e7){while(--_0x1343e7){_0x3e665d['push'](_0x3e665d['shift']());}};_0x24a155(++_0xef863d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1b126a,_0x354ce0){var _0x1da353=function(_0xc5b173){while(--_0xc5b173){_0x1b126a['push'](_0x1b126a['shift']());}};_0x1da353(++_0x354ce0);}(_0x54ef,0x112));var _0xf54e=function(_0x47c197,_0x2c478f){_0x47c197=_0x47c197-0x0;var _0x490148=_0x54ef[_0x47c197];return _0x490148;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index a17ad86..67f65d9 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 _0x062d=['limit','count','set','Content-Range','apply','update','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','map','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','then','includeAll','include','catch','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x062d,0x143));var _0xd062=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x062d[_0x26b80e];return _0x84a8a8;};'use strict';var emlformat=require(_0xd062('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd062('0x1'));var jsonpatch=require(_0xd062('0x2'));var rp=require('request-promise');var moment=require(_0xd062('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd062('0x4'));var util=require('util');var path=require(_0xd062('0x5'));var sox=require(_0xd062('0x6'));var csv=require('to-csv');var ejs=require(_0xd062('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd062('0x8'));var crypto=require(_0xd062('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd062('0xa'));var querystring=require(_0xd062('0xb'));var Papa=require('papaparse');var Redis=require(_0xd062('0xc'));var authService=require(_0xd062('0xd'));var qs=require(_0xd062('0xe'));var as=require(_0xd062('0xf'));var hardwareService=require(_0xd062('0x10'));var logger=require('../../config/logger')(_0xd062('0x11'));var utils=require(_0xd062('0x12'));var config=require(_0xd062('0x13'));var licenseUtil=require(_0xd062('0x14'));var db=require(_0xd062('0x15'))['db'];function respondWithStatusCode(_0x506848,_0xf28327){_0xf28327=_0xf28327||0xcc;return function(_0x3d5dea){if(_0x3d5dea){return _0x506848[_0xd062('0x16')](_0xf28327);}return _0x506848[_0xd062('0x17')](_0xf28327)[_0xd062('0x18')]();};}function respondWithResult(_0x1467ce,_0x5d31d2){_0x5d31d2=_0x5d31d2||0xc8;return function(_0x14404d){if(_0x14404d){return _0x1467ce['status'](_0x5d31d2)['json'](_0x14404d);}};}function respondWithFilteredResult(_0x8bce41,_0x19fd75){return function(_0x2b6446){if(_0x2b6446){var _0x683e3=typeof _0x19fd75[_0xd062('0x19')]===_0xd062('0x1a')&&typeof _0x19fd75[_0xd062('0x1b')]==='undefined';var _0x334e97=_0x2b6446[_0xd062('0x1c')];var _0x5cb17d=_0x683e3?0x0:_0x19fd75['offset'];var _0x18a576=_0x683e3?_0x2b6446[_0xd062('0x1c')]:_0x19fd75['offset']+_0x19fd75[_0xd062('0x1b')];var _0x28905b;if(_0x18a576>=_0x334e97){_0x18a576=_0x334e97;_0x28905b=0xc8;}else{_0x28905b=0xce;}_0x8bce41[_0xd062('0x17')](_0x28905b);return _0x8bce41[_0xd062('0x1d')](_0xd062('0x1e'),_0x5cb17d+'-'+_0x18a576+'/'+_0x334e97)['json'](_0x2b6446);}return null;};}function patchUpdates(_0x1e5302){return function(_0x1b2d2b){try{jsonpatch[_0xd062('0x1f')](_0x1b2d2b,_0x1e5302,!![]);}catch(_0x4395ed){return BPromise['reject'](_0x4395ed);}return _0x1b2d2b['save']();};}function saveUpdates(_0x211a75,_0x5102ea){return function(_0x566958){if(_0x566958){return _0x566958[_0xd062('0x20')](_0x211a75)['then'](function(_0x1b1b1a){return _0x1b1b1a;});}return null;};}function removeEntity(_0x45f273,_0x3a4cd6){return function(_0x36a816){if(_0x36a816){return _0x36a816[_0xd062('0x21')]()['then'](function(){_0x45f273['status'](0xcc)[_0xd062('0x18')]();});}};}function handleEntityNotFound(_0xb1dccb,_0x231835){return function(_0x27c7f9){if(!_0x27c7f9){_0xb1dccb['sendStatus'](0x194);}return _0x27c7f9;};}function handleError(_0x2945a7,_0x2593a8){_0x2593a8=_0x2593a8||0x1f4;return function(_0x2da3eb){logger[_0xd062('0x22')](_0x2da3eb[_0xd062('0x23')]);if(_0x2da3eb[_0xd062('0x24')]){delete _0x2da3eb[_0xd062('0x24')];}_0x2945a7['status'](_0x2593a8)[_0xd062('0x25')](_0x2da3eb);};}exports[_0xd062('0x26')]=function(_0x2e48e6,_0x14b82f){var _0x4ad3e1={},_0x466dd6={},_0x4eb384={'count':0x0,'rows':[]};var _0x160b5c=_['map'](db[_0xd062('0x27')][_0xd062('0x28')],function(_0x3ee5e6){return{'name':_0x3ee5e6[_0xd062('0x29')],'type':_0x3ee5e6[_0xd062('0x2a')]['key']};});_0x466dd6['model']=_[_0xd062('0x2b')](_0x160b5c,_0xd062('0x24'));_0x466dd6['query']=_[_0xd062('0x2c')](_0x2e48e6['query']);_0x466dd6[_0xd062('0x2d')]=_[_0xd062('0x2e')](_0x466dd6[_0xd062('0x2f')],_0x466dd6['query']);_0x4ad3e1[_0xd062('0x30')]=_[_0xd062('0x2e')](_0x466dd6[_0xd062('0x2f')],qs[_0xd062('0x31')](_0x2e48e6[_0xd062('0x32')][_0xd062('0x31')]));_0x4ad3e1[_0xd062('0x30')]=_0x4ad3e1[_0xd062('0x30')][_0xd062('0x33')]?_0x4ad3e1[_0xd062('0x30')]:_0x466dd6[_0xd062('0x2f')];if(!_0x2e48e6[_0xd062('0x32')][_0xd062('0x34')](_0xd062('0x35'))){_0x4ad3e1[_0xd062('0x1b')]=qs['limit'](_0x2e48e6[_0xd062('0x32')][_0xd062('0x1b')]);_0x4ad3e1[_0xd062('0x19')]=qs[_0xd062('0x19')](_0x2e48e6['query']['offset']);}_0x4ad3e1['order']=qs[_0xd062('0x36')](_0x2e48e6[_0xd062('0x32')][_0xd062('0x36')]);_0x4ad3e1[_0xd062('0x37')]=qs[_0xd062('0x2d')](_[_0xd062('0x38')](_0x2e48e6['query'],_0x466dd6['filters']),_0x160b5c);if(_0x2e48e6[_0xd062('0x32')][_0xd062('0x39')]){_0x4ad3e1[_0xd062('0x37')]=_['merge'](_0x4ad3e1['where'],{'$or':_[_0xd062('0x2b')](_0x160b5c,function(_0x193232){if(_0x193232['type']!==_0xd062('0x3a')){var _0x300540={};_0x300540[_0x193232['name']]={'$like':'%'+_0x2e48e6[_0xd062('0x32')][_0xd062('0x39')]+'%'};return _0x300540;}})});}_0x4ad3e1=_[_0xd062('0x3b')]({},_0x4ad3e1,_0x2e48e6['options']);var _0x2b8ce8={'where':_0x4ad3e1[_0xd062('0x37')]};return db[_0xd062('0x27')]['count'](_0x2b8ce8)[_0xd062('0x3c')](function(_0x1402bd){_0x4eb384[_0xd062('0x1c')]=_0x1402bd;if(_0x2e48e6['query'][_0xd062('0x3d')]){_0x4ad3e1[_0xd062('0x3e')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x4ad3e1);})['then'](function(_0x4e2726){_0x4eb384['rows']=_0x4e2726;return _0x4eb384;})[_0xd062('0x3c')](respondWithFilteredResult(_0x14b82f,_0x4ad3e1))[_0xd062('0x3f')](handleError(_0x14b82f,null));};exports['show']=function(_0x142ee2,_0x5f41c8){var _0x8d4782={'raw':!![],'where':{'id':_0x142ee2[_0xd062('0x40')]['id']}},_0x24119c={};_0x24119c[_0xd062('0x2f')]=_[_0xd062('0x2c')](db[_0xd062('0x27')][_0xd062('0x28')]);_0x24119c[_0xd062('0x32')]=_['keys'](_0x142ee2[_0xd062('0x32')]);_0x24119c[_0xd062('0x2d')]=_[_0xd062('0x2e')](_0x24119c[_0xd062('0x2f')],_0x24119c['query']);_0x8d4782['attributes']=_[_0xd062('0x2e')](_0x24119c[_0xd062('0x2f')],qs[_0xd062('0x31')](_0x142ee2[_0xd062('0x32')]['fields']));_0x8d4782['attributes']=_0x8d4782['attributes']['length']?_0x8d4782[_0xd062('0x30')]:_0x24119c[_0xd062('0x2f')];if(_0x142ee2[_0xd062('0x32')][_0xd062('0x3d')]){_0x8d4782[_0xd062('0x3e')]=[{'all':!![]}];}_0x8d4782=_['merge']({},_0x8d4782,_0x142ee2[_0xd062('0x41')]);return db[_0xd062('0x27')][_0xd062('0x42')](_0x8d4782)['then'](handleEntityNotFound(_0x5f41c8,null))[_0xd062('0x3c')](respondWithResult(_0x5f41c8,null))[_0xd062('0x3f')](handleError(_0x5f41c8,null));};exports[_0xd062('0x43')]=function(_0x2c15a5,_0x5f5ce5){return db['MailTransferReport'][_0xd062('0x43')](_0x2c15a5[_0xd062('0x44')],{})['then'](respondWithResult(_0x5f5ce5,0xc9))['catch'](handleError(_0x5f5ce5,null));};exports[_0xd062('0x20')]=function(_0x371db1,_0x238226){if(_0x371db1['body']['id']){delete _0x371db1[_0xd062('0x44')]['id'];}return db[_0xd062('0x27')][_0xd062('0x42')]({'where':{'id':_0x371db1[_0xd062('0x40')]['id']}})['then'](handleEntityNotFound(_0x238226,null))[_0xd062('0x3c')](saveUpdates(_0x371db1['body'],null))[_0xd062('0x3c')](respondWithResult(_0x238226,null))[_0xd062('0x3f')](handleError(_0x238226,null));};exports['destroy']=function(_0x3016e4,_0x1aeba3){return db[_0xd062('0x27')]['find']({'where':{'id':_0x3016e4[_0xd062('0x40')]['id']}})['then'](handleEntityNotFound(_0x1aeba3,null))[_0xd062('0x3c')](removeEntity(_0x1aeba3,null))[_0xd062('0x3f')](handleError(_0x1aeba3,null));};exports[_0xd062('0x45')]=function(_0xca71e1,_0x5465b7){return db[_0xd062('0x27')][_0xd062('0x45')]()[_0xd062('0x3c')](respondWithResult(_0x5465b7,null))['catch'](handleError(_0x5465b7,null));}; \ No newline at end of file +var _0x5731=['end','json','offset','undefined','count','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','update','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5731,0x153));var _0x1573=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5731[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x1573('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1573('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1573('0x2'));var moment=require(_0x1573('0x3'));var BPromise=require(_0x1573('0x4'));var Mustache=require(_0x1573('0x5'));var util=require(_0x1573('0x6'));var path=require(_0x1573('0x7'));var sox=require(_0x1573('0x8'));var csv=require(_0x1573('0x9'));var ejs=require(_0x1573('0xa'));var fs=require('fs');var fs_extra=require(_0x1573('0xb'));var _=require(_0x1573('0xc'));var squel=require(_0x1573('0xd'));var crypto=require(_0x1573('0xe'));var jsforce=require(_0x1573('0xf'));var deskjs=require(_0x1573('0x10'));var toCsv=require(_0x1573('0x9'));var querystring=require('querystring');var Papa=require(_0x1573('0x11'));var Redis=require(_0x1573('0x12'));var authService=require(_0x1573('0x13'));var qs=require(_0x1573('0x14'));var as=require(_0x1573('0x15'));var hardwareService=require(_0x1573('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1573('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5905a0,_0x10e24e){_0x10e24e=_0x10e24e||0xcc;return function(_0x32f956){if(_0x32f956){return _0x5905a0[_0x1573('0x18')](_0x10e24e);}return _0x5905a0[_0x1573('0x19')](_0x10e24e)[_0x1573('0x1a')]();};}function respondWithResult(_0x56eff9,_0x5246a6){_0x5246a6=_0x5246a6||0xc8;return function(_0x47834a){if(_0x47834a){return _0x56eff9[_0x1573('0x19')](_0x5246a6)[_0x1573('0x1b')](_0x47834a);}};}function respondWithFilteredResult(_0x4e99ec,_0x5d8aa5){return function(_0x105dc2){if(_0x105dc2){var _0x21b2bc=typeof _0x5d8aa5[_0x1573('0x1c')]===_0x1573('0x1d')&&typeof _0x5d8aa5['limit']===_0x1573('0x1d');var _0x864b0b=_0x105dc2[_0x1573('0x1e')];var _0x2d5738=_0x21b2bc?0x0:_0x5d8aa5['offset'];var _0x59a5b8=_0x21b2bc?_0x105dc2[_0x1573('0x1e')]:_0x5d8aa5['offset']+_0x5d8aa5['limit'];var _0x56d7b1;if(_0x59a5b8>=_0x864b0b){_0x59a5b8=_0x864b0b;_0x56d7b1=0xc8;}else{_0x56d7b1=0xce;}_0x4e99ec[_0x1573('0x19')](_0x56d7b1);return _0x4e99ec['set'](_0x1573('0x1f'),_0x2d5738+'-'+_0x59a5b8+'/'+_0x864b0b)[_0x1573('0x1b')](_0x105dc2);}return null;};}function patchUpdates(_0x13e1fb){return function(_0x2b0097){try{jsonpatch[_0x1573('0x20')](_0x2b0097,_0x13e1fb,!![]);}catch(_0x388ecb){return BPromise[_0x1573('0x21')](_0x388ecb);}return _0x2b0097[_0x1573('0x22')]();};}function saveUpdates(_0x2ed76a,_0x1356c9){return function(_0xbce0eb){if(_0xbce0eb){return _0xbce0eb['update'](_0x2ed76a)['then'](function(_0x286e3e){return _0x286e3e;});}return null;};}function removeEntity(_0x2d55da,_0x2c1f7d){return function(_0x504a3f){if(_0x504a3f){return _0x504a3f[_0x1573('0x23')]()[_0x1573('0x24')](function(){_0x2d55da['status'](0xcc)[_0x1573('0x1a')]();});}};}function handleEntityNotFound(_0x377487,_0x4b8fd9){return function(_0x53767a){if(!_0x53767a){_0x377487[_0x1573('0x18')](0x194);}return _0x53767a;};}function handleError(_0x508aa4,_0x153a9f){_0x153a9f=_0x153a9f||0x1f4;return function(_0x4d496e){logger['error'](_0x4d496e[_0x1573('0x25')]);if(_0x4d496e[_0x1573('0x26')]){delete _0x4d496e[_0x1573('0x26')];}_0x508aa4['status'](_0x153a9f)['send'](_0x4d496e);};}exports[_0x1573('0x27')]=function(_0x5d8ec1,_0x1c6767){var _0x38ec6c={},_0xc91012={},_0x27035a={'count':0x0,'rows':[]};var _0x1f4832=_[_0x1573('0x28')](db[_0x1573('0x29')][_0x1573('0x2a')],function(_0xab6a0){return{'name':_0xab6a0[_0x1573('0x2b')],'type':_0xab6a0[_0x1573('0x2c')][_0x1573('0x2d')]};});_0xc91012[_0x1573('0x2e')]=_[_0x1573('0x28')](_0x1f4832,_0x1573('0x26'));_0xc91012['query']=_['keys'](_0x5d8ec1[_0x1573('0x2f')]);_0xc91012['filters']=_[_0x1573('0x30')](_0xc91012['model'],_0xc91012[_0x1573('0x2f')]);_0x38ec6c[_0x1573('0x31')]=_['intersection'](_0xc91012[_0x1573('0x2e')],qs['fields'](_0x5d8ec1[_0x1573('0x2f')][_0x1573('0x32')]));_0x38ec6c[_0x1573('0x31')]=_0x38ec6c[_0x1573('0x31')]['length']?_0x38ec6c[_0x1573('0x31')]:_0xc91012[_0x1573('0x2e')];if(!_0x5d8ec1[_0x1573('0x2f')]['hasOwnProperty'](_0x1573('0x33'))){_0x38ec6c[_0x1573('0x34')]=qs[_0x1573('0x34')](_0x5d8ec1[_0x1573('0x2f')][_0x1573('0x34')]);_0x38ec6c[_0x1573('0x1c')]=qs[_0x1573('0x1c')](_0x5d8ec1[_0x1573('0x2f')][_0x1573('0x1c')]);}_0x38ec6c[_0x1573('0x35')]=qs[_0x1573('0x36')](_0x5d8ec1[_0x1573('0x2f')]['sort']);_0x38ec6c[_0x1573('0x37')]=qs[_0x1573('0x38')](_['pick'](_0x5d8ec1[_0x1573('0x2f')],_0xc91012[_0x1573('0x38')]),_0x1f4832);if(_0x5d8ec1[_0x1573('0x2f')][_0x1573('0x39')]){_0x38ec6c[_0x1573('0x37')]=_[_0x1573('0x3a')](_0x38ec6c['where'],{'$or':_[_0x1573('0x28')](_0x1f4832,function(_0xe54a01){if(_0xe54a01['type']!=='VIRTUAL'){var _0x16f47f={};_0x16f47f[_0xe54a01[_0x1573('0x26')]]={'$like':'%'+_0x5d8ec1[_0x1573('0x2f')][_0x1573('0x39')]+'%'};return _0x16f47f;}})});}_0x38ec6c=_['merge']({},_0x38ec6c,_0x5d8ec1[_0x1573('0x3b')]);var _0x23d9de={'where':_0x38ec6c[_0x1573('0x37')]};return db[_0x1573('0x29')][_0x1573('0x1e')](_0x23d9de)[_0x1573('0x24')](function(_0x5f0885){_0x27035a[_0x1573('0x1e')]=_0x5f0885;if(_0x5d8ec1[_0x1573('0x2f')]['includeAll']){_0x38ec6c[_0x1573('0x3c')]=[{'all':!![]}];}return db[_0x1573('0x29')][_0x1573('0x3d')](_0x38ec6c);})[_0x1573('0x24')](function(_0x192bae){_0x27035a[_0x1573('0x3e')]=_0x192bae;return _0x27035a;})[_0x1573('0x24')](respondWithFilteredResult(_0x1c6767,_0x38ec6c))[_0x1573('0x3f')](handleError(_0x1c6767,null));};exports[_0x1573('0x40')]=function(_0x36ff02,_0x2ff8c2){var _0x48f75d={'raw':!![],'where':{'id':_0x36ff02['params']['id']}},_0x5698c3={};_0x5698c3[_0x1573('0x2e')]=_[_0x1573('0x41')](db['MailTransferReport']['rawAttributes']);_0x5698c3[_0x1573('0x2f')]=_[_0x1573('0x41')](_0x36ff02[_0x1573('0x2f')]);_0x5698c3[_0x1573('0x38')]=_[_0x1573('0x30')](_0x5698c3[_0x1573('0x2e')],_0x5698c3[_0x1573('0x2f')]);_0x48f75d[_0x1573('0x31')]=_[_0x1573('0x30')](_0x5698c3[_0x1573('0x2e')],qs[_0x1573('0x32')](_0x36ff02[_0x1573('0x2f')][_0x1573('0x32')]));_0x48f75d[_0x1573('0x31')]=_0x48f75d[_0x1573('0x31')][_0x1573('0x42')]?_0x48f75d[_0x1573('0x31')]:_0x5698c3[_0x1573('0x2e')];if(_0x36ff02[_0x1573('0x2f')][_0x1573('0x43')]){_0x48f75d[_0x1573('0x3c')]=[{'all':!![]}];}_0x48f75d=_[_0x1573('0x3a')]({},_0x48f75d,_0x36ff02['options']);return db[_0x1573('0x29')][_0x1573('0x44')](_0x48f75d)[_0x1573('0x24')](handleEntityNotFound(_0x2ff8c2,null))['then'](respondWithResult(_0x2ff8c2,null))[_0x1573('0x3f')](handleError(_0x2ff8c2,null));};exports[_0x1573('0x45')]=function(_0x80cee3,_0x6ae70){return db['MailTransferReport'][_0x1573('0x45')](_0x80cee3[_0x1573('0x46')],{})[_0x1573('0x24')](respondWithResult(_0x6ae70,0xc9))[_0x1573('0x3f')](handleError(_0x6ae70,null));};exports[_0x1573('0x47')]=function(_0x2591b7,_0x53b04f){if(_0x2591b7[_0x1573('0x46')]['id']){delete _0x2591b7[_0x1573('0x46')]['id'];}return db['MailTransferReport'][_0x1573('0x44')]({'where':{'id':_0x2591b7['params']['id']}})[_0x1573('0x24')](handleEntityNotFound(_0x53b04f,null))[_0x1573('0x24')](saveUpdates(_0x2591b7['body'],null))[_0x1573('0x24')](respondWithResult(_0x53b04f,null))[_0x1573('0x3f')](handleError(_0x53b04f,null));};exports[_0x1573('0x23')]=function(_0x4cb08b,_0xb356a7){return db[_0x1573('0x29')][_0x1573('0x44')]({'where':{'id':_0x4cb08b[_0x1573('0x48')]['id']}})[_0x1573('0x24')](handleEntityNotFound(_0xb356a7,null))[_0x1573('0x24')](removeEntity(_0xb356a7,null))[_0x1573('0x3f')](handleError(_0xb356a7,null));};exports['describe']=function(_0x42c886,_0x321974){return db[_0x1573('0x29')]['describe']()[_0x1573('0x24')](respondWithResult(_0x321974,null))[_0x1573('0x3f')](handleError(_0x321974,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8c6a0d3..a7125c5 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 _0xcee8=['api','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x47d5c3,_0x2b43f){var _0x4d15fa=function(_0x25dd89){while(--_0x25dd89){_0x47d5c3['push'](_0x47d5c3['shift']());}};_0x4d15fa(++_0x2b43f);}(_0xcee8,0xb1));var _0x8cee=function(_0x43ac30,_0x451a5a){_0x43ac30=_0x43ac30-0x0;var _0xd805ed=_0xcee8[_0x43ac30];return _0xd805ed;};'use strict';var _=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var logger=require(_0x8cee('0x2'))(_0x8cee('0x3'));var moment=require(_0x8cee('0x4'));var BPromise=require(_0x8cee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cee('0x6'));var rimraf=require(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var attributes=require(_0x8cee('0x9'));module['exports']=function(_0x295471,_0xfea4e3){return _0x295471['define']('MailTransferReport',attributes,{'tableName':_0x8cee('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8cee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6753=['../../config/environment','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x6753,0xa1));var _0x3675=function(_0x2485b2,_0x550a58){_0x2485b2=_0x2485b2-0x0;var _0x50b36f=_0x6753[_0x2485b2];return _0x50b36f;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var logger=require(_0x3675('0x2'))(_0x3675('0x3'));var moment=require('moment');var BPromise=require(_0x3675('0x4'));var rp=require(_0x3675('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x4e4e73,_0x396a35){return _0x4e4e73[_0x3675('0x8')](_0x3675('0x9'),attributes,{'tableName':_0x3675('0xa'),'paranoid':![],'indexes':[{'name':_0x3675('0xb'),'fields':[_0x3675('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0da6e26..a4f4125 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 _0xc767=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x1cb84c,_0x576b00){var _0x1ff4ed=function(_0x27e6b4){while(--_0x27e6b4){_0x1cb84c['push'](_0x1cb84c['shift']());}};_0x1ff4ed(++_0x576b00);}(_0xc767,0x108));var _0x7c76=function(_0x2a0e45,_0x370c5d){_0x2a0e45=_0x2a0e45-0x0;var _0x3595b8=_0xc767[_0x2a0e45];return _0x3595b8;};'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')]('MailTransferReport,\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 +var _0xa102=['rpc','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a1448,_0x6e5dc2){var _0xea7f1b=function(_0x4d16a7){while(--_0x4d16a7){_0x3a1448['push'](_0x3a1448['shift']());}};_0xea7f1b(++_0x6e5dc2);}(_0xa102,0x130));var _0x2a10=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xa102[_0xd511d];return _0x3f148e;};'use strict';var _=require(_0x2a10('0x0'));var util=require(_0x2a10('0x1'));var moment=require('moment');var BPromise=require(_0x2a10('0x2'));var rs=require(_0x2a10('0x3'));var fs=require('fs');var Redis=require(_0x2a10('0x4'));var db=require(_0x2a10('0x5'))['db'];var utils=require(_0x2a10('0x6'));var logger=require(_0x2a10('0x7'))(_0x2a10('0x8'));var config=require(_0x2a10('0x9'));var jayson=require(_0x2a10('0xa'));var client=jayson[_0x2a10('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x523874,_0x39aaa2,_0x493b6b){return new BPromise(function(_0x3d0ba2,_0x499ec9){return client[_0x2a10('0xc')](_0x523874,_0x493b6b)[_0x2a10('0xd')](function(_0x3ada2f){logger[_0x2a10('0xe')](_0x2a10('0xf'),_0x39aaa2,_0x2a10('0x10'));logger[_0x2a10('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x39aaa2,_0x2a10('0x10'),JSON[_0x2a10('0x12')](_0x3ada2f));if(_0x3ada2f[_0x2a10('0x13')]){if(_0x3ada2f[_0x2a10('0x13')][_0x2a10('0x14')]===0x1f4){logger[_0x2a10('0x13')](_0x2a10('0xf'),_0x39aaa2,_0x3ada2f[_0x2a10('0x13')]['message']);return _0x499ec9(_0x3ada2f[_0x2a10('0x13')][_0x2a10('0x15')]);}logger[_0x2a10('0x13')](_0x2a10('0xf'),_0x39aaa2,_0x3ada2f['error'][_0x2a10('0x15')]);return _0x3d0ba2(_0x3ada2f[_0x2a10('0x13')][_0x2a10('0x15')]);}else{logger[_0x2a10('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x39aaa2,_0x2a10('0x10'));_0x3d0ba2(_0x3ada2f[_0x2a10('0x16')][_0x2a10('0x15')]);}})[_0x2a10('0x17')](function(_0x59b20b){logger[_0x2a10('0x13')](_0x2a10('0xf'),_0x39aaa2,_0x59b20b);_0x499ec9(_0x59b20b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 4c9b8cd..b50920e 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 _0x6333=['/:id','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x543341,_0x25271a){var _0x59362b=function(_0x29a265){while(--_0x29a265){_0x543341['push'](_0x543341['shift']());}};_0x59362b(++_0x25271a);}(_0x6333,0x1df));var _0x3633=function(_0x508a8e,_0x14eec6){_0x508a8e=_0x508a8e-0x0;var _0x3840b3=_0x6333[_0x508a8e];return _0x3840b3;};'use strict';var multer=require(_0x3633('0x0'));var util=require(_0x3633('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3633('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3633('0x3'));var interaction=require(_0x3633('0x4'));var config=require(_0x3633('0x5'));var controller=require(_0x3633('0x6'));router[_0x3633('0x7')]('/',auth[_0x3633('0x8')](),controller[_0x3633('0x9')]);router[_0x3633('0x7')](_0x3633('0xa'),auth['isAuthenticated'](),controller[_0x3633('0xb')]);router[_0x3633('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3633('0xc')]);router[_0x3633('0xd')]('/',auth[_0x3633('0x8')](),controller[_0x3633('0xe')]);router['put'](_0x3633('0xf'),auth[_0x3633('0x8')](),controller['update']);router[_0x3633('0x10')](_0x3633('0xf'),auth[_0x3633('0x8')](),controller[_0x3633('0x11')]);module[_0x3633('0x12')]=router; \ No newline at end of file +var _0x3d9a=['show','post','create','put','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d9a,0x182));var _0xa3d9=function(_0x31ea9d,_0xfef49f){_0x31ea9d=_0x31ea9d-0x0;var _0x149fa5=_0x3d9a[_0x31ea9d];return _0x149fa5;};'use strict';var multer=require(_0xa3d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa3d9('0x1'));var express=require(_0xa3d9('0x2'));var router=express[_0xa3d9('0x3')]();var fs_extra=require(_0xa3d9('0x4'));var auth=require(_0xa3d9('0x5'));var interaction=require(_0xa3d9('0x6'));var config=require(_0xa3d9('0x7'));var controller=require(_0xa3d9('0x8'));router[_0xa3d9('0x9')]('/',auth['isAuthenticated'](),controller[_0xa3d9('0xa')]);router[_0xa3d9('0x9')]('/describe',auth[_0xa3d9('0xb')](),controller[_0xa3d9('0xc')]);router[_0xa3d9('0x9')](_0xa3d9('0xd'),auth[_0xa3d9('0xb')](),controller[_0xa3d9('0xe')]);router[_0xa3d9('0xf')]('/',auth[_0xa3d9('0xb')](),controller[_0xa3d9('0x10')]);router[_0xa3d9('0x11')](_0xa3d9('0xd'),auth[_0xa3d9('0xb')](),controller[_0xa3d9('0x12')]);router[_0xa3d9('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 33959de..f854d14 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 _0x110c=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x48b6ef,_0x55bc21){var _0x4838cd=function(_0x1c4636){while(--_0x1c4636){_0x48b6ef['push'](_0x48b6ef['shift']());}};_0x4838cd(++_0x55bc21);}(_0x110c,0x10b));var _0xc110=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x110c[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xc110('0x0'));var moment=require(_0xc110('0x1'));module[_0xc110('0x2')]={'channel':{'type':Sequelize[_0xc110('0x3')]},'membername':{'type':Sequelize[_0xc110('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xc110('0x4'),'comment':_0xc110('0x5')},'duration':{'type':Sequelize[_0xc110('0x6')]},'enterAt':{'type':Sequelize[_0xc110('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1dbc90){var _0x52b043=moment(_0x1dbc90);var _0xa653c7=moment(this['getDataValue'](_0xc110('0x8')));var _0x204b06=_0x52b043[_0xc110('0x9')](_0xa653c7,_0xc110('0xa'));this[_0xc110('0xb')](_0xc110('0xc'),_0x1dbc90);this[_0xc110('0xb')](_0xc110('0xd'),_0x204b06>=0x0?_0x204b06:null);}},'data1':{'type':Sequelize[_0xc110('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xc110('0x3')],'comment':_0xc110('0xe')},'data3':{'type':Sequelize[_0xc110('0x3')],'comment':_0xc110('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0xc110('0x10')},'data5':{'type':Sequelize[_0xc110('0x3')],'comment':_0xc110('0x11')},'role':{'type':Sequelize[_0xc110('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x70c8=['talk:[queue]','exports','STRING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70c8,0xa9));var _0x870c=function(_0x39b11e,_0x5f515d){_0x39b11e=_0x39b11e-0x0;var _0x565d50=_0x70c8[_0x39b11e];return _0x565d50;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x870c('0x0')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x870c('0x1')]},'interface':{'type':Sequelize[_0x870c('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x870c('0x2')]},'enterAt':{'type':Sequelize[_0x870c('0x3')]},'exitAt':{'type':Sequelize[_0x870c('0x3')],'set':function(_0x3e27fa){var _0x18c445=moment(_0x3e27fa);var _0x47752e=moment(this[_0x870c('0x4')](_0x870c('0x5')));var _0x1df099=_0x18c445[_0x870c('0x6')](_0x47752e,_0x870c('0x7'));this[_0x870c('0x8')]('exitAt',_0x3e27fa);this[_0x870c('0x8')](_0x870c('0x9'),_0x1df099>=0x0?_0x1df099:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x870c('0xa')},'data2':{'type':Sequelize[_0x870c('0x1')],'comment':_0x870c('0xb')},'data3':{'type':Sequelize[_0x870c('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x870c('0x1')],'comment':_0x870c('0xc')},'data5':{'type':Sequelize[_0x870c('0x1')],'comment':_0x870c('0xd')},'role':{'type':Sequelize[_0x870c('0x1')]},'internal':{'type':Sequelize[_0x870c('0x2')]},'uniqueid':{'type':Sequelize[_0x870c('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c6abb50..f592ff5 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x1f00df,_0x28f546){var _0x2b7a64=function(_0x246ab7){while(--_0x246ab7){_0x1f00df['push'](_0x1f00df['shift']());}};_0x2b7a64(++_0x28f546);}(_0x008c,0x188));var _0xc008=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x008c[_0x3f4891];return _0x54f2d8;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,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(_0x13cab7,_0x541a78){var _0x2ad137=function(_0x4a7e6b){while(--_0x4a7e6b){_0x13cab7['push'](_0x13cab7['shift']());}};_0x2ad137(++_0x541a78);}(_0x3e74,0x175));var _0x43e7=function(_0x5b064a,_0x130128){_0x5b064a=_0x5b064a-0x0;var _0x461042=_0x3e74[_0x5b064a];return _0x461042;};'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 fb7afe3..dd6ab52 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 _0x9075=['membername','interface','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','MemberReport','membername_interface'];(function(_0x39554a,_0x33a4a0){var _0xd2a67a=function(_0x1ee86a){while(--_0x1ee86a){_0x39554a['push'](_0x39554a['shift']());}};_0xd2a67a(++_0x33a4a0);}(_0x9075,0x7a));var _0x5907=function(_0x1a697e,_0x130466){_0x1a697e=_0x1a697e-0x0;var _0x40e871=_0x9075[_0x1a697e];return _0x40e871;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5907('0x0'))(_0x5907('0x1'));var moment=require(_0x5907('0x2'));var BPromise=require(_0x5907('0x3'));var rp=require(_0x5907('0x4'));var fs=require('fs');var path=require(_0x5907('0x5'));var rimraf=require(_0x5907('0x6'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x5907('0x7')]=function(_0x1354f3,_0x5bc440){return _0x1354f3['define'](_0x5907('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x5907('0x9'),'fields':[_0x5907('0xa'),_0x5907('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e06=['exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path','./memberReport.attributes'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x1e06,0x1c9));var _0x61e0=function(_0x22a86a,_0x1a6a3c){_0x22a86a=_0x22a86a-0x0;var _0x29ab2c=_0x1e06[_0x22a86a];return _0x29ab2c;};'use strict';var _=require(_0x61e0('0x0'));var util=require(_0x61e0('0x1'));var logger=require(_0x61e0('0x2'))(_0x61e0('0x3'));var moment=require(_0x61e0('0x4'));var BPromise=require('bluebird');var rp=require(_0x61e0('0x5'));var fs=require('fs');var path=require(_0x61e0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61e0('0x7'));module[_0x61e0('0x8')]=function(_0x5c27d4,_0x491ee5){return _0x5c27d4[_0x61e0('0x9')](_0x61e0('0xa'),attributes,{'tableName':_0x61e0('0xb'),'paranoid':![],'indexes':[{'name':_0x61e0('0xc'),'fields':[_0x61e0('0xd'),_0x61e0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4350512..416d429 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 _0x6808=['create','body','MemberReport','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','debug','GetMemberReport','CreateMemberReport'];(function(_0x5d7a5e,_0x1f5d31){var _0x3aa67c=function(_0x4e557e){while(--_0x4e557e){_0x5d7a5e['push'](_0x5d7a5e['shift']());}};_0x3aa67c(++_0x1f5d31);}(_0x6808,0xd1));var _0x8680=function(_0x174d53,_0x3abb7e){_0x174d53=_0x174d53-0x0;var _0x14363b=_0x6808[_0x174d53];return _0x14363b;};'use strict';var _=require(_0x8680('0x0'));var util=require(_0x8680('0x1'));var moment=require(_0x8680('0x2'));var BPromise=require(_0x8680('0x3'));var rs=require(_0x8680('0x4'));var fs=require('fs');var Redis=require(_0x8680('0x5'));var db=require(_0x8680('0x6'))['db'];var utils=require(_0x8680('0x7'));var logger=require('../../config/logger')(_0x8680('0x8'));var config=require(_0x8680('0x9'));var jayson=require(_0x8680('0xa'));var client=jayson[_0x8680('0xb')][_0x8680('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ea2c7,_0xb588b7,_0x1b8e2c){return new BPromise(function(_0x4d7b13,_0x4d1c84){return client[_0x8680('0xd')](_0x5ea2c7,_0x1b8e2c)[_0x8680('0xe')](function(_0x5c49c9){logger[_0x8680('0xf')]('MemberReport,\x20%s,\x20%s',_0xb588b7,'request\x20sent');logger['debug'](_0x8680('0x10'),_0xb588b7,_0x8680('0x11'),JSON[_0x8680('0x12')](_0x5c49c9));if(_0x5c49c9[_0x8680('0x13')]){if(_0x5c49c9[_0x8680('0x13')][_0x8680('0x14')]===0x1f4){logger[_0x8680('0x13')]('MemberReport,\x20%s,\x20%s',_0xb588b7,_0x5c49c9['error'][_0x8680('0x15')]);return _0x4d1c84(_0x5c49c9[_0x8680('0x13')][_0x8680('0x15')]);}logger['error'](_0x8680('0x16'),_0xb588b7,_0x5c49c9[_0x8680('0x13')][_0x8680('0x15')]);return _0x4d7b13(_0x5c49c9[_0x8680('0x13')][_0x8680('0x15')]);}else{logger[_0x8680('0xf')](_0x8680('0x16'),_0xb588b7,'request\x20sent');_0x4d7b13(_0x5c49c9[_0x8680('0x17')]['message']);}})[_0x8680('0x18')](function(_0x5b9ad3){logger[_0x8680('0x13')](_0x8680('0x16'),_0xb588b7,_0x5b9ad3);_0x4d1c84(_0x5b9ad3);});});}exports['GetMemberReport']=function(_0x2b1d1f){var _0x90fbd7=this;return new Promise(function(_0x2345ee,_0x580491){return db['MemberReport'][_0x8680('0x19')]({'raw':_0x2b1d1f[_0x8680('0x1a')]?_0x2b1d1f[_0x8680('0x1a')][_0x8680('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b1d1f[_0x8680('0x1a')]?_0x2b1d1f[_0x8680('0x1a')][_0x8680('0x1c')]||null:null,'attributes':_0x2b1d1f[_0x8680('0x1a')]?_0x2b1d1f['options'][_0x8680('0x1d')]||null:null,'limit':_0x2b1d1f['options']?_0x2b1d1f[_0x8680('0x1a')][_0x8680('0x1e')]||null:null,'include':_0x2b1d1f[_0x8680('0x1a')]?_0x2b1d1f['options'][_0x8680('0x1f')]?_[_0x8680('0x20')](_0x2b1d1f[_0x8680('0x1a')][_0x8680('0x1f')],function(_0x235099){return{'model':db[_0x235099[_0x8680('0x21')]],'as':_0x235099['as'],'attributes':_0x235099[_0x8680('0x1d')],'include':_0x235099[_0x8680('0x1f')]?_[_0x8680('0x20')](_0x235099[_0x8680('0x1f')],function(_0xd6b559){return{'model':db[_0xd6b559[_0x8680('0x21')]],'as':_0xd6b559['as'],'attributes':_0xd6b559[_0x8680('0x1d')],'include':_0xd6b559[_0x8680('0x1f')]?_['map'](_0xd6b559[_0x8680('0x1f')],function(_0x5cb33c){return{'model':db[_0x5cb33c[_0x8680('0x21')]],'as':_0x5cb33c['as'],'attributes':_0x5cb33c[_0x8680('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8680('0xe')](function(_0xbc82ac){logger[_0x8680('0xf')]('GetMemberReport',_0x2b1d1f);logger[_0x8680('0x22')]('GetMemberReport',_0x2b1d1f,JSON[_0x8680('0x12')](_0xbc82ac));_0x2345ee(_0xbc82ac);})['catch'](function(_0x295bce){logger[_0x8680('0x13')](_0x8680('0x23'),_0x295bce[_0x8680('0x15')],_0x2b1d1f);_0x580491(_0x90fbd7[_0x8680('0x13')](0x1f4,_0x295bce[_0x8680('0x15')]));});});};exports[_0x8680('0x24')]=function(_0x1c98f3){var _0x11cbb7=this;return new Promise(function(_0xe8064e,_0x26dbf1){return db['MemberReport'][_0x8680('0x25')](_0x1c98f3[_0x8680('0x26')],{'raw':_0x1c98f3[_0x8680('0x1a')]?_0x1c98f3[_0x8680('0x1a')][_0x8680('0x1b')]===undefined?!![]:![]:!![]})[_0x8680('0xe')](function(_0x3bd116){logger['info']('CreateMemberReport',_0x1c98f3);logger[_0x8680('0x22')](_0x8680('0x24'),_0x1c98f3,JSON[_0x8680('0x12')](_0x3bd116));_0xe8064e(_0x3bd116);})[_0x8680('0x18')](function(_0x2db6bb){logger[_0x8680('0x13')](_0x8680('0x24'),_0x2db6bb[_0x8680('0x15')],_0x1c98f3);_0x26dbf1(_0x11cbb7[_0x8680('0x13')](0x1f4,_0x2db6bb[_0x8680('0x15')]));});});};exports['UpdateMemberReport']=function(_0x25cd62){var _0x4dc990=this;return new Promise(function(_0x22c92d,_0x1087b9){return db[_0x8680('0x27')]['update'](_0x25cd62['body'],{'raw':_0x25cd62[_0x8680('0x1a')]?_0x25cd62[_0x8680('0x1a')][_0x8680('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25cd62[_0x8680('0x1a')]?_0x25cd62[_0x8680('0x1a')][_0x8680('0x1c')]||null:null,'attributes':_0x25cd62[_0x8680('0x1a')]?_0x25cd62['options'][_0x8680('0x1d')]||null:null,'limit':_0x25cd62[_0x8680('0x1a')]?_0x25cd62['options']['limit']||null:null})[_0x8680('0xe')](function(_0x3f300a){logger[_0x8680('0xf')](_0x8680('0x28'),_0x25cd62);logger[_0x8680('0x22')](_0x8680('0x28'),_0x25cd62,JSON[_0x8680('0x12')](_0x3f300a));_0x22c92d(_0x3f300a);})[_0x8680('0x18')](function(_0xaa1647){logger['error']('UpdateMemberReport',_0xaa1647['message'],_0x25cd62);_0x1087b9(_0x4dc990[_0x8680('0x13')](0x1f4,_0xaa1647['message']));});});}; \ No newline at end of file +var _0x5e17=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','../../mysqldb'];(function(_0xb4e111,_0x2f0c81){var _0xb661a8=function(_0x599dcb){while(--_0x599dcb){_0xb4e111['push'](_0xb4e111['shift']());}};_0xb661a8(++_0x2f0c81);}(_0x5e17,0x17a));var _0x75e1=function(_0x231cc5,_0x5bc97e){_0x231cc5=_0x231cc5-0x0;var _0x2c3702=_0x5e17[_0x231cc5];return _0x2c3702;};'use strict';var _=require(_0x75e1('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(_0x75e1('0x1'))['db'];var utils=require(_0x75e1('0x2'));var logger=require(_0x75e1('0x3'))(_0x75e1('0x4'));var config=require(_0x75e1('0x5'));var jayson=require(_0x75e1('0x6'));var client=jayson[_0x75e1('0x7')][_0x75e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb1af59,_0x36e724,_0x689ac3){return new BPromise(function(_0x1eecde,_0x23fab8){return client[_0x75e1('0x9')](_0xb1af59,_0x689ac3)[_0x75e1('0xa')](function(_0x57e230){logger[_0x75e1('0xb')]('MemberReport,\x20%s,\x20%s',_0x36e724,'request\x20sent');logger[_0x75e1('0xc')](_0x75e1('0xd'),_0x36e724,_0x75e1('0xe'),JSON[_0x75e1('0xf')](_0x57e230));if(_0x57e230[_0x75e1('0x10')]){if(_0x57e230[_0x75e1('0x10')][_0x75e1('0x11')]===0x1f4){logger[_0x75e1('0x10')]('MemberReport,\x20%s,\x20%s',_0x36e724,_0x57e230[_0x75e1('0x10')][_0x75e1('0x12')]);return _0x23fab8(_0x57e230[_0x75e1('0x10')]['message']);}logger[_0x75e1('0x10')](_0x75e1('0x13'),_0x36e724,_0x57e230[_0x75e1('0x10')][_0x75e1('0x12')]);return _0x1eecde(_0x57e230['error'][_0x75e1('0x12')]);}else{logger[_0x75e1('0xb')](_0x75e1('0x13'),_0x36e724,_0x75e1('0xe'));_0x1eecde(_0x57e230[_0x75e1('0x14')][_0x75e1('0x12')]);}})[_0x75e1('0x15')](function(_0x56c741){logger[_0x75e1('0x10')](_0x75e1('0x13'),_0x36e724,_0x56c741);_0x23fab8(_0x56c741);});});}exports[_0x75e1('0x16')]=function(_0x5ac788){var _0x12a4d9=this;return new Promise(function(_0x1168e0,_0x499a75){return db[_0x75e1('0x17')][_0x75e1('0x18')]({'raw':_0x5ac788[_0x75e1('0x19')]?_0x5ac788['options'][_0x75e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ac788[_0x75e1('0x19')]?_0x5ac788[_0x75e1('0x19')][_0x75e1('0x1b')]||null:null,'attributes':_0x5ac788[_0x75e1('0x19')]?_0x5ac788['options'][_0x75e1('0x1c')]||null:null,'limit':_0x5ac788['options']?_0x5ac788[_0x75e1('0x19')][_0x75e1('0x1d')]||null:null,'include':_0x5ac788[_0x75e1('0x19')]?_0x5ac788['options']['include']?_[_0x75e1('0x1e')](_0x5ac788[_0x75e1('0x19')][_0x75e1('0x1f')],function(_0x2a6547){return{'model':db[_0x2a6547[_0x75e1('0x20')]],'as':_0x2a6547['as'],'attributes':_0x2a6547[_0x75e1('0x1c')],'include':_0x2a6547[_0x75e1('0x1f')]?_['map'](_0x2a6547[_0x75e1('0x1f')],function(_0x23c9d0){return{'model':db[_0x23c9d0[_0x75e1('0x20')]],'as':_0x23c9d0['as'],'attributes':_0x23c9d0[_0x75e1('0x1c')],'include':_0x23c9d0[_0x75e1('0x1f')]?_[_0x75e1('0x1e')](_0x23c9d0[_0x75e1('0x1f')],function(_0x471624){return{'model':db[_0x471624[_0x75e1('0x20')]],'as':_0x471624['as'],'attributes':_0x471624['attributes']};}):[]};}):[]};}):[]:[]})[_0x75e1('0xa')](function(_0x262a55){logger[_0x75e1('0xb')]('GetMemberReport',_0x5ac788);logger[_0x75e1('0xc')]('GetMemberReport',_0x5ac788,JSON['stringify'](_0x262a55));_0x1168e0(_0x262a55);})[_0x75e1('0x15')](function(_0x39064b){logger[_0x75e1('0x10')](_0x75e1('0x16'),_0x39064b[_0x75e1('0x12')],_0x5ac788);_0x499a75(_0x12a4d9['error'](0x1f4,_0x39064b[_0x75e1('0x12')]));});});};exports[_0x75e1('0x21')]=function(_0x142530){var _0x5e30f1=this;return new Promise(function(_0x257a91,_0x4055f9){return db['MemberReport'][_0x75e1('0x22')](_0x142530[_0x75e1('0x23')],{'raw':_0x142530[_0x75e1('0x19')]?_0x142530[_0x75e1('0x19')][_0x75e1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x44bb90){logger[_0x75e1('0xb')]('CreateMemberReport',_0x142530);logger[_0x75e1('0xc')](_0x75e1('0x21'),_0x142530,JSON[_0x75e1('0xf')](_0x44bb90));_0x257a91(_0x44bb90);})[_0x75e1('0x15')](function(_0x340307){logger[_0x75e1('0x10')]('CreateMemberReport',_0x340307[_0x75e1('0x12')],_0x142530);_0x4055f9(_0x5e30f1['error'](0x1f4,_0x340307['message']));});});};exports[_0x75e1('0x24')]=function(_0x2eff8a){var _0xb5b393=this;return new Promise(function(_0x33229d,_0x3682e5){return db[_0x75e1('0x17')][_0x75e1('0x25')](_0x2eff8a[_0x75e1('0x23')],{'raw':_0x2eff8a[_0x75e1('0x19')]?_0x2eff8a[_0x75e1('0x19')][_0x75e1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eff8a[_0x75e1('0x19')]?_0x2eff8a[_0x75e1('0x19')]['where']||null:null,'attributes':_0x2eff8a[_0x75e1('0x19')]?_0x2eff8a[_0x75e1('0x19')][_0x75e1('0x1c')]||null:null,'limit':_0x2eff8a[_0x75e1('0x19')]?_0x2eff8a[_0x75e1('0x19')][_0x75e1('0x1d')]||null:null})['then'](function(_0x2cbdf1){logger[_0x75e1('0xb')](_0x75e1('0x24'),_0x2eff8a);logger[_0x75e1('0xc')](_0x75e1('0x24'),_0x2eff8a,JSON[_0x75e1('0xf')](_0x2cbdf1));_0x33229d(_0x2cbdf1);})['catch'](function(_0xd47d99){logger[_0x75e1('0x10')]('UpdateMemberReport',_0xd47d99[_0x75e1('0x12')],_0x2eff8a);_0x3682e5(_0xb5b393[_0x75e1('0x10')](0x1f4,_0xd47d99['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5d7600c..a6cd93e 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 _0xc556=['get','index','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x23d21a,_0x4507d5){var _0x3c0fbb=function(_0x29923c){while(--_0x29923c){_0x23d21a['push'](_0x23d21a['shift']());}};_0x3c0fbb(++_0x4507d5);}(_0xc556,0xc3));var _0x6c55=function(_0x35c2fc,_0xabea37){_0x35c2fc=_0x35c2fc-0x0;var _0x4727fd=_0xc556[_0x35c2fc];return _0x4727fd;};'use strict';var multer=require(_0x6c55('0x0'));var util=require('util');var path=require(_0x6c55('0x1'));var timeout=require(_0x6c55('0x2'));var express=require(_0x6c55('0x3'));var router=express['Router']();var fs_extra=require(_0x6c55('0x4'));var auth=require(_0x6c55('0x5'));var interaction=require(_0x6c55('0x6'));var config=require(_0x6c55('0x7'));var controller=require(_0x6c55('0x8'));router[_0x6c55('0x9')]('/',controller[_0x6c55('0xa')]);module[_0x6c55('0xb')]=router; \ No newline at end of file +var _0x7553=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x7553,0x1c3));var _0x3755=function(_0x33eca6,_0x891651){_0x33eca6=_0x33eca6-0x0;var _0x1ada39=_0x7553[_0x33eca6];return _0x1ada39;};'use strict';var multer=require(_0x3755('0x0'));var util=require(_0x3755('0x1'));var path=require('path');var timeout=require(_0x3755('0x2'));var express=require(_0x3755('0x3'));var router=express[_0x3755('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3755('0x5'));var interaction=require(_0x3755('0x6'));var config=require(_0x3755('0x7'));var controller=require(_0x3755('0x8'));router[_0x3755('0x9')]('/',controller['index']);module[_0x3755('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index b7aa123..461f3ff 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 _0x6351=['exports','sequelize'];(function(_0x4e7cc3,_0x47ff4){var _0x42e46d=function(_0x43bd6e){while(--_0x43bd6e){_0x4e7cc3['push'](_0x4e7cc3['shift']());}};_0x42e46d(++_0x47ff4);}(_0x6351,0x1b7));var _0x1635=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x6351[_0x1bbc08];return _0x5d825b;};'use strict';var Sequelize=require(_0x1635('0x0'));module[_0x1635('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x517d=['sequelize','exports'];(function(_0x197fe4,_0x31e2bc){var _0x4e68a1=function(_0xae0b9e){while(--_0xae0b9e){_0x197fe4['push'](_0x197fe4['shift']());}};_0x4e68a1(++_0x31e2bc);}(_0x517d,0x196));var _0xd517=function(_0x4b6990,_0x383876){_0x4b6990=_0x4b6990-0x0;var _0x2765c3=_0x517d[_0x4b6990];return _0x2765c3;};'use strict';var Sequelize=require(_0xd517('0x0'));module[_0xd517('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index eb8f029..4be4cb9 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 _0xd910=['name','send','map','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x2c8350,_0x3bb4a6){var _0x5a41fb=function(_0x343b55){while(--_0x343b55){_0x2c8350['push'](_0x2c8350['shift']());}};_0x5a41fb(++_0x3bb4a6);}(_0xd910,0xf2));var _0x0d91=function(_0x4f765e,_0x4b3f01){_0x4f765e=_0x4f765e-0x0;var _0x234457=_0xd910[_0x4f765e];return _0x234457;};'use strict';var emlformat=require(_0x0d91('0x0'));var rimraf=require(_0x0d91('0x1'));var zipdir=require(_0x0d91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d91('0x3'));var moment=require(_0x0d91('0x4'));var BPromise=require(_0x0d91('0x5'));var Mustache=require(_0x0d91('0x6'));var util=require(_0x0d91('0x7'));var path=require(_0x0d91('0x8'));var sox=require(_0x0d91('0x9'));var csv=require(_0x0d91('0xa'));var ejs=require(_0x0d91('0xb'));var fs=require('fs');var fs_extra=require(_0x0d91('0xc'));var _=require(_0x0d91('0xd'));var squel=require(_0x0d91('0xe'));var crypto=require(_0x0d91('0xf'));var jsforce=require(_0x0d91('0x10'));var deskjs=require(_0x0d91('0x11'));var toCsv=require(_0x0d91('0xa'));var querystring=require(_0x0d91('0x12'));var Papa=require('papaparse');var Redis=require(_0x0d91('0x13'));var authService=require(_0x0d91('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0d91('0x15'));var hardwareService=require(_0x0d91('0x16'));var logger=require(_0x0d91('0x17'))(_0x0d91('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0d91('0x19'))['db'];function respondWithStatusCode(_0x3c611c,_0x86bbe0){_0x86bbe0=_0x86bbe0||0xcc;return function(_0x46606c){if(_0x46606c){return _0x3c611c[_0x0d91('0x1a')](_0x86bbe0);}return _0x3c611c[_0x0d91('0x1b')](_0x86bbe0)[_0x0d91('0x1c')]();};}function respondWithResult(_0x3475f0,_0x507f95){_0x507f95=_0x507f95||0xc8;return function(_0x19d23e){if(_0x19d23e){return _0x3475f0[_0x0d91('0x1b')](_0x507f95)[_0x0d91('0x1d')](_0x19d23e);}};}function respondWithFilteredResult(_0x33d6a5,_0x1d800b){return function(_0x44bfd4){if(_0x44bfd4){var _0x3f9732=typeof _0x1d800b['offset']===_0x0d91('0x1e')&&typeof _0x1d800b[_0x0d91('0x1f')]===_0x0d91('0x1e');var _0x2e4e96=_0x44bfd4[_0x0d91('0x20')];var _0x525d6c=_0x3f9732?0x0:_0x1d800b[_0x0d91('0x21')];var _0x26d3b9=_0x3f9732?_0x44bfd4[_0x0d91('0x20')]:_0x1d800b['offset']+_0x1d800b[_0x0d91('0x1f')];var _0x5d38c9;if(_0x26d3b9>=_0x2e4e96){_0x26d3b9=_0x2e4e96;_0x5d38c9=0xc8;}else{_0x5d38c9=0xce;}_0x33d6a5[_0x0d91('0x1b')](_0x5d38c9);return _0x33d6a5[_0x0d91('0x22')](_0x0d91('0x23'),_0x525d6c+'-'+_0x26d3b9+'/'+_0x2e4e96)[_0x0d91('0x1d')](_0x44bfd4);}return null;};}function patchUpdates(_0x5914a7){return function(_0x38a108){try{jsonpatch[_0x0d91('0x24')](_0x38a108,_0x5914a7,!![]);}catch(_0x4c761a){return BPromise[_0x0d91('0x25')](_0x4c761a);}return _0x38a108[_0x0d91('0x26')]();};}function saveUpdates(_0x46ce3e,_0x2c59af){return function(_0x1b2690){if(_0x1b2690){return _0x1b2690['update'](_0x46ce3e)[_0x0d91('0x27')](function(_0x10d14f){return _0x10d14f;});}return null;};}function removeEntity(_0x250c79,_0x50a86b){return function(_0xb95dcc){if(_0xb95dcc){return _0xb95dcc[_0x0d91('0x28')]()[_0x0d91('0x27')](function(){_0x250c79[_0x0d91('0x1b')](0xcc)[_0x0d91('0x1c')]();});}};}function handleEntityNotFound(_0x3a0598,_0x3637b4){return function(_0x28d98c){if(!_0x28d98c){_0x3a0598[_0x0d91('0x1a')](0x194);}return _0x28d98c;};}function handleError(_0x1e44bc,_0x426a4e){_0x426a4e=_0x426a4e||0x1f4;return function(_0x5239b7){logger[_0x0d91('0x29')](_0x5239b7['stack']);if(_0x5239b7[_0x0d91('0x2a')]){delete _0x5239b7['name'];}_0x1e44bc['status'](_0x426a4e)[_0x0d91('0x2b')](_0x5239b7);};}exports['index']=function(_0x274009,_0x3eadda){var _0x382f18={},_0x5299f3={},_0x448901={'count':0x0,'rows':[]};var _0x725be8=_[_0x0d91('0x2c')](db[_0x0d91('0x2d')][_0x0d91('0x2e')],function(_0x14fcea){return{'name':_0x14fcea['fieldName'],'type':_0x14fcea[_0x0d91('0x2f')][_0x0d91('0x30')]};});_0x5299f3[_0x0d91('0x31')]=_[_0x0d91('0x2c')](_0x725be8,_0x0d91('0x2a'));_0x5299f3[_0x0d91('0x32')]=_[_0x0d91('0x33')](_0x274009[_0x0d91('0x32')]);_0x5299f3[_0x0d91('0x34')]=_[_0x0d91('0x35')](_0x5299f3['model'],_0x5299f3[_0x0d91('0x32')]);_0x382f18[_0x0d91('0x36')]=_[_0x0d91('0x35')](_0x5299f3[_0x0d91('0x31')],qs[_0x0d91('0x37')](_0x274009['query'][_0x0d91('0x37')]));_0x382f18['attributes']=_0x382f18[_0x0d91('0x36')][_0x0d91('0x38')]?_0x382f18['attributes']:_0x5299f3[_0x0d91('0x31')];if(!_0x274009[_0x0d91('0x32')]['hasOwnProperty'](_0x0d91('0x39'))){_0x382f18[_0x0d91('0x1f')]=qs[_0x0d91('0x1f')](_0x274009[_0x0d91('0x32')][_0x0d91('0x1f')]);_0x382f18[_0x0d91('0x21')]=qs['offset'](_0x274009['query'][_0x0d91('0x21')]);}_0x382f18[_0x0d91('0x3a')]=qs[_0x0d91('0x3b')](_0x274009[_0x0d91('0x32')]['sort']);_0x382f18[_0x0d91('0x3c')]=qs[_0x0d91('0x34')](_[_0x0d91('0x3d')](_0x274009[_0x0d91('0x32')],_0x5299f3[_0x0d91('0x34')]),_0x725be8);if(_0x274009[_0x0d91('0x32')][_0x0d91('0x3e')]){_0x382f18[_0x0d91('0x3c')]=_[_0x0d91('0x3f')](_0x382f18[_0x0d91('0x3c')],{'$or':_['map'](_0x725be8,function(_0x4b9bb0){if(_0x4b9bb0[_0x0d91('0x2f')]!==_0x0d91('0x40')){var _0x21efc8={};_0x21efc8[_0x4b9bb0[_0x0d91('0x2a')]]={'$like':'%'+_0x274009[_0x0d91('0x32')]['filter']+'%'};return _0x21efc8;}})});}_0x382f18=_['merge']({},_0x382f18,_0x274009[_0x0d91('0x41')]);var _0x492ab4={'where':_0x382f18[_0x0d91('0x3c')]};return db[_0x0d91('0x2d')]['count'](_0x492ab4)[_0x0d91('0x27')](function(_0x120af2){_0x448901[_0x0d91('0x20')]=_0x120af2;if(_0x274009[_0x0d91('0x32')][_0x0d91('0x42')]){_0x382f18[_0x0d91('0x43')]=[{'all':!![]}];}return db[_0x0d91('0x2d')][_0x0d91('0x44')](_0x382f18);})[_0x0d91('0x27')](function(_0x5abc1d){_0x448901[_0x0d91('0x45')]=_0x5abc1d;return _0x448901;})[_0x0d91('0x27')](respondWithFilteredResult(_0x3eadda,_0x382f18))[_0x0d91('0x46')](handleError(_0x3eadda,null));}; \ No newline at end of file +var _0x1156=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','sendStatus','error','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Migration','includeAll','include','findAll','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1156,0x181));var _0x6115=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1156[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x6115('0x0'));var rimraf=require(_0x6115('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6115('0x2'));var rp=require('request-promise');var moment=require(_0x6115('0x3'));var BPromise=require(_0x6115('0x4'));var Mustache=require('mustache');var util=require(_0x6115('0x5'));var path=require('path');var sox=require(_0x6115('0x6'));var csv=require(_0x6115('0x7'));var ejs=require(_0x6115('0x8'));var fs=require('fs');var fs_extra=require(_0x6115('0x9'));var _=require(_0x6115('0xa'));var squel=require(_0x6115('0xb'));var crypto=require(_0x6115('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6115('0xd'));var toCsv=require(_0x6115('0x7'));var querystring=require(_0x6115('0xe'));var Papa=require(_0x6115('0xf'));var Redis=require(_0x6115('0x10'));var authService=require(_0x6115('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6115('0x12'));var hardwareService=require(_0x6115('0x13'));var logger=require('../../config/logger')(_0x6115('0x14'));var utils=require(_0x6115('0x15'));var config=require(_0x6115('0x16'));var licenseUtil=require(_0x6115('0x17'));var db=require(_0x6115('0x18'))['db'];function respondWithStatusCode(_0x2a1034,_0xf274e7){_0xf274e7=_0xf274e7||0xcc;return function(_0x2ac742){if(_0x2ac742){return _0x2a1034['sendStatus'](_0xf274e7);}return _0x2a1034['status'](_0xf274e7)[_0x6115('0x19')]();};}function respondWithResult(_0x5e95af,_0x4b98db){_0x4b98db=_0x4b98db||0xc8;return function(_0x4abb46){if(_0x4abb46){return _0x5e95af[_0x6115('0x1a')](_0x4b98db)[_0x6115('0x1b')](_0x4abb46);}};}function respondWithFilteredResult(_0x9b9b01,_0x585edc){return function(_0x26b237){if(_0x26b237){var _0x878f6=typeof _0x585edc[_0x6115('0x1c')]===_0x6115('0x1d')&&typeof _0x585edc[_0x6115('0x1e')]==='undefined';var _0x5e4400=_0x26b237[_0x6115('0x1f')];var _0x50d768=_0x878f6?0x0:_0x585edc[_0x6115('0x1c')];var _0x4624b6=_0x878f6?_0x26b237['count']:_0x585edc[_0x6115('0x1c')]+_0x585edc[_0x6115('0x1e')];var _0x1581cd;if(_0x4624b6>=_0x5e4400){_0x4624b6=_0x5e4400;_0x1581cd=0xc8;}else{_0x1581cd=0xce;}_0x9b9b01[_0x6115('0x1a')](_0x1581cd);return _0x9b9b01[_0x6115('0x20')](_0x6115('0x21'),_0x50d768+'-'+_0x4624b6+'/'+_0x5e4400)[_0x6115('0x1b')](_0x26b237);}return null;};}function patchUpdates(_0x1e8869){return function(_0x4b1fa4){try{jsonpatch[_0x6115('0x22')](_0x4b1fa4,_0x1e8869,!![]);}catch(_0x2e9c15){return BPromise['reject'](_0x2e9c15);}return _0x4b1fa4['save']();};}function saveUpdates(_0x44e968,_0x4a654f){return function(_0x129db5){if(_0x129db5){return _0x129db5[_0x6115('0x23')](_0x44e968)[_0x6115('0x24')](function(_0x35da55){return _0x35da55;});}return null;};}function removeEntity(_0x34beed,_0x8080f){return function(_0xccecba){if(_0xccecba){return _0xccecba['destroy']()[_0x6115('0x24')](function(){_0x34beed[_0x6115('0x1a')](0xcc)[_0x6115('0x19')]();});}};}function handleEntityNotFound(_0x44658e,_0x36f681){return function(_0x506ec3){if(!_0x506ec3){_0x44658e[_0x6115('0x25')](0x194);}return _0x506ec3;};}function handleError(_0x348a55,_0x3f361b){_0x3f361b=_0x3f361b||0x1f4;return function(_0x4a9c29){logger[_0x6115('0x26')](_0x4a9c29['stack']);if(_0x4a9c29[_0x6115('0x27')]){delete _0x4a9c29[_0x6115('0x27')];}_0x348a55[_0x6115('0x1a')](_0x3f361b)['send'](_0x4a9c29);};}exports[_0x6115('0x28')]=function(_0x31611c,_0x1b95c3){var _0x498464={},_0x3670b9={},_0x3e825f={'count':0x0,'rows':[]};var _0x14422d=_[_0x6115('0x29')](db['Migration']['rawAttributes'],function(_0x1ad1cf){return{'name':_0x1ad1cf[_0x6115('0x2a')],'type':_0x1ad1cf[_0x6115('0x2b')][_0x6115('0x2c')]};});_0x3670b9[_0x6115('0x2d')]=_[_0x6115('0x29')](_0x14422d,_0x6115('0x27'));_0x3670b9[_0x6115('0x2e')]=_[_0x6115('0x2f')](_0x31611c['query']);_0x3670b9[_0x6115('0x30')]=_[_0x6115('0x31')](_0x3670b9['model'],_0x3670b9[_0x6115('0x2e')]);_0x498464[_0x6115('0x32')]=_[_0x6115('0x31')](_0x3670b9[_0x6115('0x2d')],qs[_0x6115('0x33')](_0x31611c[_0x6115('0x2e')][_0x6115('0x33')]));_0x498464['attributes']=_0x498464[_0x6115('0x32')]['length']?_0x498464[_0x6115('0x32')]:_0x3670b9[_0x6115('0x2d')];if(!_0x31611c[_0x6115('0x2e')]['hasOwnProperty'](_0x6115('0x34'))){_0x498464[_0x6115('0x1e')]=qs[_0x6115('0x1e')](_0x31611c[_0x6115('0x2e')][_0x6115('0x1e')]);_0x498464[_0x6115('0x1c')]=qs['offset'](_0x31611c['query']['offset']);}_0x498464[_0x6115('0x35')]=qs[_0x6115('0x36')](_0x31611c['query'][_0x6115('0x36')]);_0x498464['where']=qs[_0x6115('0x30')](_[_0x6115('0x37')](_0x31611c['query'],_0x3670b9[_0x6115('0x30')]),_0x14422d);if(_0x31611c[_0x6115('0x2e')][_0x6115('0x38')]){_0x498464[_0x6115('0x39')]=_[_0x6115('0x3a')](_0x498464[_0x6115('0x39')],{'$or':_[_0x6115('0x29')](_0x14422d,function(_0xc5bed){if(_0xc5bed[_0x6115('0x2b')]!==_0x6115('0x3b')){var _0x296d76={};_0x296d76[_0xc5bed[_0x6115('0x27')]]={'$like':'%'+_0x31611c[_0x6115('0x2e')][_0x6115('0x38')]+'%'};return _0x296d76;}})});}_0x498464=_['merge']({},_0x498464,_0x31611c[_0x6115('0x3c')]);var _0x2412ab={'where':_0x498464[_0x6115('0x39')]};return db[_0x6115('0x3d')]['count'](_0x2412ab)['then'](function(_0xb3b242){_0x3e825f[_0x6115('0x1f')]=_0xb3b242;if(_0x31611c[_0x6115('0x2e')][_0x6115('0x3e')]){_0x498464[_0x6115('0x3f')]=[{'all':!![]}];}return db[_0x6115('0x3d')][_0x6115('0x40')](_0x498464);})[_0x6115('0x24')](function(_0x269625){_0x3e825f['rows']=_0x269625;return _0x3e825f;})[_0x6115('0x24')](respondWithFilteredResult(_0x1b95c3,_0x498464))[_0x6115('0x41')](handleError(_0x1b95c3,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f0660c7..ce926b7 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 _0xdc78=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash','util','../../config/logger'];(function(_0x111c17,_0x275184){var _0x5ff50a=function(_0x4ebc34){while(--_0x4ebc34){_0x111c17['push'](_0x111c17['shift']());}};_0x5ff50a(++_0x275184);}(_0xdc78,0x142));var _0x8dc7=function(_0x288efd,_0x86ff6b){_0x288efd=_0x288efd-0x0;var _0x7466bb=_0xdc78[_0x288efd];return _0x7466bb;};'use strict';var _=require(_0x8dc7('0x0'));var util=require(_0x8dc7('0x1'));var logger=require(_0x8dc7('0x2'))('api');var moment=require(_0x8dc7('0x3'));var BPromise=require(_0x8dc7('0x4'));var rp=require(_0x8dc7('0x5'));var fs=require('fs');var path=require(_0x8dc7('0x6'));var rimraf=require(_0x8dc7('0x7'));var config=require(_0x8dc7('0x8'));var attributes=require('./migration.attributes');module[_0x8dc7('0x9')]=function(_0x4593d4,_0xa965ed){return _0x4593d4[_0x8dc7('0xa')](_0x8dc7('0xb'),attributes,{'tableName':_0x8dc7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23b1=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','define','migrations'];(function(_0x5030d7,_0x2c5905){var _0x55e693=function(_0x422a59){while(--_0x422a59){_0x5030d7['push'](_0x5030d7['shift']());}};_0x55e693(++_0x2c5905);}(_0x23b1,0x7e));var _0x123b=function(_0x5cbba0,_0x4f455b){_0x5cbba0=_0x5cbba0-0x0;var _0xa3a9d5=_0x23b1[_0x5cbba0];return _0xa3a9d5;};'use strict';var _=require(_0x123b('0x0'));var util=require(_0x123b('0x1'));var logger=require(_0x123b('0x2'))(_0x123b('0x3'));var moment=require(_0x123b('0x4'));var BPromise=require(_0x123b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x123b('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module['exports']=function(_0x35c223,_0x4dd34c){return _0x35c223[_0x123b('0x7')]('Migration',attributes,{'tableName':_0x123b('0x8'),'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 95bfc0c..1aee054 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 _0x7d5a=['request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2ba9b7,_0x171d3a){var _0x2adc3b=function(_0x893c53){while(--_0x893c53){_0x2ba9b7['push'](_0x2ba9b7['shift']());}};_0x2adc3b(++_0x171d3a);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x1b76b5,_0x13416e){_0x1b76b5=_0x1b76b5-0x0;var _0x214e01=_0x7d5a[_0x1b76b5];return _0x214e01;};'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')]('Migration,\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 +var _0x502a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x502a,0xd8));var _0xa502=function(_0x162591,_0x512866){_0x162591=_0x162591-0x0;var _0x540d7f=_0x502a[_0x162591];return _0x540d7f;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var moment=require('moment');var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa502('0x4'));var logger=require('../../config/logger')(_0xa502('0x5'));var config=require(_0xa502('0x6'));var jayson=require(_0xa502('0x7'));var client=jayson[_0xa502('0x8')][_0xa502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489407,_0x329022,_0x29fb03){return new BPromise(function(_0x4d30f2,_0x4e4e5d){return client[_0xa502('0xa')](_0x489407,_0x29fb03)[_0xa502('0xb')](function(_0x5251fa){logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));logger['debug'](_0xa502('0xf'),_0x329022,_0xa502('0xe'),JSON[_0xa502('0x10')](_0x5251fa));if(_0x5251fa['error']){if(_0x5251fa[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error'](_0xa502('0xd'),_0x329022,_0x5251fa[_0xa502('0x11')]['message']);return _0x4e4e5d(_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')]('Migration,\x20%s,\x20%s',_0x329022,_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);return _0x4d30f2(_0x5251fa[_0xa502('0x11')]['message']);}else{logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));_0x4d30f2(_0x5251fa[_0xa502('0x14')][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x3107a0){logger[_0xa502('0x11')](_0xa502('0xd'),_0x329022,_0x3107a0);_0x4e4e5d(_0x3107a0);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 48135dc..a0427b5 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 _0x9fe7=['put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9fe7,0x1df));var _0x79fe=function(_0x202939,_0x4a1063){_0x202939=_0x202939-0x0;var _0x243aec=_0x9fe7[_0x202939];return _0x243aec;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0xc')]('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router[_0x79fe('0xf')]('/:id',auth[_0x79fe('0xd')](),controller[_0x79fe('0x10')]);router['delete'](_0x79fe('0xa'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x11')]);module[_0x79fe('0x12')]=router; \ No newline at end of file +var _0x161c=['../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0x161c,0xb7));var _0xc161=function(_0x37eca2,_0x5e5fc8){_0x37eca2=_0x37eca2-0x0;var _0x2e79f7=_0x161c[_0x37eca2];return _0x2e79f7;};'use strict';var multer=require('multer');var util=require(_0xc161('0x0'));var path=require('path');var timeout=require(_0xc161('0x1'));var express=require('express');var router=express[_0xc161('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc161('0x3'));var interaction=require(_0xc161('0x4'));var config=require(_0xc161('0x5'));var controller=require(_0xc161('0x6'));router[_0xc161('0x7')]('/',auth[_0xc161('0x8')](),controller[_0xc161('0x9')]);router[_0xc161('0x7')](_0xc161('0xa'),auth[_0xc161('0x8')](),controller[_0xc161('0xb')]);router[_0xc161('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc161('0xd')](_0xc161('0xa'),auth[_0xc161('0x8')](),controller['update']);router[_0xc161('0xe')](_0xc161('0xa'),auth['isAuthenticated'](),controller[_0xc161('0xf')]);module[_0xc161('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d5779d0..317f479 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 _0xcecb=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcecb,0xda));var _0xbcec=function(_0x355251,_0x2e0b1f){_0x355251=_0x355251-0x0;var _0x3b6bb9=_0xcecb[_0x355251];return _0x3b6bb9;};'use strict';var Sequelize=require(_0xbcec('0x0'));module[_0xbcec('0x1')]={'type':{'type':Sequelize[_0xbcec('0x2')](_0xbcec('0x3'),_0xbcec('0x4'),_0xbcec('0x5'),_0xbcec('0x6'))},'value':{'type':Sequelize[_0xbcec('0x7')]},'username':{'type':Sequelize[_0xbcec('0x7')]},'password':{'type':Sequelize[_0xbcec('0x7')]}}; \ No newline at end of file +var _0xa779=['exports','ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x35d7c5,_0x5e5e22){var _0x9cabb5=function(_0x43311f){while(--_0x43311f){_0x35d7c5['push'](_0x35d7c5['shift']());}};_0x9cabb5(++_0x5e5e22);}(_0xa779,0x117));var _0x9a77=function(_0x3def2f,_0x23a8c3){_0x3def2f=_0x3def2f-0x0;var _0x738987=_0xa779[_0x3def2f];return _0x738987;};'use strict';var Sequelize=require(_0x9a77('0x0'));module[_0x9a77('0x1')]={'type':{'type':Sequelize[_0x9a77('0x2')](_0x9a77('0x3'),_0x9a77('0x4'),_0x9a77('0x5'),'turn')},'value':{'type':Sequelize[_0x9a77('0x6')]},'username':{'type':Sequelize[_0x9a77('0x6')]},'password':{'type':Sequelize[_0x9a77('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b08119c..67f92c6 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 _0x6624=['limit','sort','where','pick','filter','merge','VIRTUAL','options','Network','include','rows','params','includeAll','find','create','body','toUpperCase','readFileSync','join','root','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','/etc/asterisk/turn_xcally.conf','format','toLowerCase','TURN','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','offset','undefined','count','status','set','Content-Range','json','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x6624,0xcd));var _0x4662=function(_0x260ed9,_0x18152f){_0x260ed9=_0x260ed9-0x0;var _0x47b0b0=_0x6624[_0x260ed9];return _0x47b0b0;};'use strict';var util=require(_0x4662('0x0'));var path=require(_0x4662('0x1'));var ejs=require(_0x4662('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x4662('0x3'));var logger=require(_0x4662('0x4'))(_0x4662('0x5'));var config=require(_0x4662('0x6'));var db=require(_0x4662('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4662('0x8')][_0x4662('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bdfeb,_0x257aaf,_0x58ace7,_0x378002){return new Promise(function(_0x2020c4,_0x52f37f){var _0x1db79e=_0x378002||client;return _0x1db79e['request'](_0x3bdfeb,_0x58ace7)['then'](function(_0x46ac55){logger[_0x4662('0xa')](_0x4662('0xb'),_0x257aaf,'request\x20sent');logger[_0x4662('0xc')](_0x4662('0xd'),_0x257aaf,_0x4662('0xe'),JSON[_0x4662('0xf')](_0x46ac55));if(_0x46ac55['error']){if(_0x46ac55[_0x4662('0x10')][_0x4662('0x11')]===0x1f4){logger[_0x4662('0x10')](_0x4662('0xb'),_0x257aaf,_0x46ac55[_0x4662('0x10')][_0x4662('0x12')]);return _0x52f37f(_0x46ac55[_0x4662('0x10')][_0x4662('0x12')]);}logger[_0x4662('0x10')](_0x4662('0xb'),_0x257aaf,_0x46ac55[_0x4662('0x10')]['message']);return _0x2020c4(_0x46ac55[_0x4662('0x10')]['message']);}else{logger[_0x4662('0xa')](_0x4662('0xb'),_0x257aaf,_0x4662('0xe'));_0x2020c4(_0x46ac55[_0x4662('0x13')][_0x4662('0x12')]);}})[_0x4662('0x14')](function(_0xd861b1){logger[_0x4662('0x10')]('Network,\x20%s,\x20%s',_0x257aaf,_0xd861b1);_0x52f37f(_0xd861b1);});});}function respondWithResult(_0x3ba172,_0x371946){_0x371946=_0x371946||0xc8;return function(_0x207b3d){if(_0x207b3d){return _0x3ba172['status'](_0x371946)['json'](_0x207b3d);}};}function respondWithFilteredResult(_0xb107d,_0x3aa30a){return function(_0x57d49c){if(_0x57d49c){var _0x3a7e76=typeof _0x3aa30a[_0x4662('0x15')]===_0x4662('0x16')&&typeof _0x3aa30a['limit']===_0x4662('0x16');var _0x7e8743=_0x57d49c[_0x4662('0x17')];var _0x28692d=_0x3a7e76?0x0:_0x3aa30a[_0x4662('0x15')];var _0x304824=_0x3a7e76?_0x57d49c[_0x4662('0x17')]:_0x3aa30a['offset']+_0x3aa30a['limit'];var _0x384869;if(_0x304824>=_0x7e8743){_0x304824=_0x7e8743;_0x384869=0xc8;}else{_0x384869=0xce;}_0xb107d[_0x4662('0x18')](_0x384869);return _0xb107d[_0x4662('0x19')](_0x4662('0x1a'),_0x28692d+'-'+_0x304824+'/'+_0x7e8743)[_0x4662('0x1b')](_0x57d49c);}return null;};}function saveUpdates(_0x36de99){return function(_0x38da25){if(_0x38da25){return _0x38da25[_0x4662('0x1c')](_0x36de99)[_0x4662('0x1d')](function(_0x518f4e){return _0x518f4e;});}return null;};}function removeEntity(_0x310fbc){return function(_0x3bd75c){if(_0x3bd75c){return _0x3bd75c[_0x4662('0x1e')]()[_0x4662('0x1d')](function(){_0x310fbc[_0x4662('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c6cf){return function(_0xfb73b1){if(!_0xfb73b1){_0x53c6cf['sendStatus'](0x194);}return _0xfb73b1;};}function handleError(_0x341f1c,_0x4f19d3){_0x4f19d3=_0x4f19d3||0x1f4;return function(_0x203d2c){logger[_0x4662('0x10')](_0x203d2c[_0x4662('0x1f')]);if(_0x203d2c[_0x4662('0x20')]){delete _0x203d2c['name'];}_0x341f1c[_0x4662('0x18')](_0x4f19d3)[_0x4662('0x21')](_0x203d2c);};}exports[_0x4662('0x22')]=function(_0x427dc0,_0x5b88f4){var _0x468ffc={},_0x4af663={},_0x4e3c4a={'count':0x0,'rows':[]};var _0x5bad13=_[_0x4662('0x23')](db['Network'][_0x4662('0x24')],function(_0x24ee41){return{'name':_0x24ee41[_0x4662('0x25')],'type':_0x24ee41[_0x4662('0x26')][_0x4662('0x27')]};});_0x4af663['model']=_[_0x4662('0x23')](_0x5bad13,_0x4662('0x20'));_0x4af663[_0x4662('0x28')]=_[_0x4662('0x29')](_0x427dc0[_0x4662('0x28')]);_0x4af663[_0x4662('0x2a')]=_[_0x4662('0x2b')](_0x4af663['model'],_0x4af663[_0x4662('0x28')]);_0x468ffc['attributes']=_[_0x4662('0x2b')](_0x4af663[_0x4662('0x2c')],qs[_0x4662('0x2d')](_0x427dc0[_0x4662('0x28')]['fields']));_0x468ffc[_0x4662('0x2e')]=_0x468ffc[_0x4662('0x2e')][_0x4662('0x2f')]?_0x468ffc[_0x4662('0x2e')]:_0x4af663[_0x4662('0x2c')];if(!_0x427dc0[_0x4662('0x28')][_0x4662('0x30')](_0x4662('0x31'))){_0x468ffc[_0x4662('0x32')]=qs[_0x4662('0x32')](_0x427dc0[_0x4662('0x28')]['limit']);_0x468ffc[_0x4662('0x15')]=qs[_0x4662('0x15')](_0x427dc0[_0x4662('0x28')][_0x4662('0x15')]);}_0x468ffc['order']=qs[_0x4662('0x33')](_0x427dc0[_0x4662('0x28')]['sort']);_0x468ffc[_0x4662('0x34')]=qs['filters'](_[_0x4662('0x35')](_0x427dc0[_0x4662('0x28')],_0x4af663[_0x4662('0x2a')]),_0x5bad13);if(_0x427dc0['query'][_0x4662('0x36')]){_0x468ffc['where']=_[_0x4662('0x37')](_0x468ffc[_0x4662('0x34')],{'$or':_['map'](_0x5bad13,function(_0x4b6040){if(_0x4b6040[_0x4662('0x26')]!==_0x4662('0x38')){var _0x29e34f={};_0x29e34f[_0x4b6040[_0x4662('0x20')]]={'$like':'%'+_0x427dc0[_0x4662('0x28')]['filter']+'%'};return _0x29e34f;}})});}_0x468ffc=_[_0x4662('0x37')]({},_0x468ffc,_0x427dc0[_0x4662('0x39')]);var _0xc53510={'where':_0x468ffc['where']};return db[_0x4662('0x3a')][_0x4662('0x17')](_0xc53510)['then'](function(_0x470d59){_0x4e3c4a['count']=_0x470d59;if(_0x427dc0[_0x4662('0x28')]['includeAll']){_0x468ffc[_0x4662('0x3b')]=[{'all':!![]}];}return db['Network']['findAll'](_0x468ffc);})[_0x4662('0x1d')](function(_0x2ffd45){_0x4e3c4a[_0x4662('0x3c')]=_0x2ffd45;return _0x4e3c4a;})['then'](respondWithFilteredResult(_0x5b88f4,_0x468ffc))['catch'](handleError(_0x5b88f4,null));};exports['show']=function(_0x145b18,_0x4c1933){var _0x20a849={'raw':!![],'where':{'id':_0x145b18[_0x4662('0x3d')]['id']}},_0x3fb5ed={};_0x3fb5ed['model']=_[_0x4662('0x29')](db[_0x4662('0x3a')][_0x4662('0x24')]);_0x3fb5ed[_0x4662('0x28')]=_['keys'](_0x145b18['query']);_0x3fb5ed[_0x4662('0x2a')]=_[_0x4662('0x2b')](_0x3fb5ed[_0x4662('0x2c')],_0x3fb5ed['query']);_0x20a849[_0x4662('0x2e')]=_['intersection'](_0x3fb5ed['model'],qs['fields'](_0x145b18[_0x4662('0x28')]['fields']));_0x20a849[_0x4662('0x2e')]=_0x20a849['attributes'][_0x4662('0x2f')]?_0x20a849[_0x4662('0x2e')]:_0x3fb5ed[_0x4662('0x2c')];if(_0x145b18[_0x4662('0x28')][_0x4662('0x3e')]){_0x20a849[_0x4662('0x3b')]=[{'all':!![]}];}_0x20a849=_[_0x4662('0x37')]({},_0x20a849,_0x145b18['options']);return db['Network'][_0x4662('0x3f')](_0x20a849)[_0x4662('0x1d')](handleEntityNotFound(_0x4c1933,null))[_0x4662('0x1d')](respondWithResult(_0x4c1933,null))['catch'](handleError(_0x4c1933,null));};exports['create']=function(_0x4c13ed,_0x151e79){var _0x27fb40;return db['Network'][_0x4662('0x40')](_0x4c13ed[_0x4662('0x41')],{'raw':!![]})[_0x4662('0x1d')](function(_0xe179c1){_0x27fb40=_0xe179c1;return db['Network']['findAll']({'where':{'type':_0x4c13ed[_0x4662('0x41')]['type']},'raw':!![]});})['then'](function(_0x5ecb8b){if(_0x27fb40[_0x4662('0x26')][_0x4662('0x42')]()=='STUN'){var _0x522e5f=fs[_0x4662('0x43')](path[_0x4662('0x44')](config[_0x4662('0x45')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x19d992=ejs[_0x4662('0x46')](_0x522e5f,{'networks':_0x5ecb8b||[]});fs['writeFileSync'](_0x4662('0x47'),_0x19d992);return respondWithRpcPromise(_0x4662('0x48'),_0x4662('0x40'),{'module':_0x4662('0x49')});}else if(_0x27fb40[_0x4662('0x26')]['toUpperCase']()=='TURN'){var _0x1d78d7=fs[_0x4662('0x43')](path[_0x4662('0x44')](config['root'],_0x4662('0x4a')),_0x4662('0x4b'));var _0x81cfc8=ejs[_0x4662('0x46')](_0x1d78d7,{'networks':_0x5ecb8b||[]});fs[_0x4662('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x81cfc8);return respondWithRpcPromise('Reload','create',{'module':_0x4662('0x49')});}else{var _0x46a54e=fs[_0x4662('0x43')](path['join'](config[_0x4662('0x45')],_0x4662('0x4d')),_0x4662('0x4b'));var _0x27944a=ejs['render'](_0x46a54e,{'networks':_0x5ecb8b||[]});fs['writeFileSync'](util['format'](_0x4662('0x4e'),_0x4c13ed[_0x4662('0x41')][_0x4662('0x26')]['toLowerCase']()),_0x27944a);return respondWithRpcPromise(_0x4662('0x48'),_0x4662('0x40'),{'module':_0x4662('0x4f')});}})[_0x4662('0x1d')](function(){return _0x27fb40;})[_0x4662('0x1d')](respondWithResult(_0x151e79,0xc9))[_0x4662('0x14')](handleError(_0x151e79,null));};exports[_0x4662('0x1c')]=function(_0x4e3aeb,_0x317ef0){var _0x2e7bb9;return db[_0x4662('0x3a')][_0x4662('0x3f')]({'where':{'id':_0x4e3aeb[_0x4662('0x3d')]['id']}})[_0x4662('0x1d')](handleEntityNotFound(_0x317ef0,null))[_0x4662('0x1d')](saveUpdates(_0x4e3aeb['body'],null))[_0x4662('0x1d')](function(_0x5b4f79){if(_0x5b4f79){_0x2e7bb9=_0x5b4f79;return db['Network']['findAll']({'where':{'type':_0x2e7bb9['type']},'raw':!![]});}return null;})[_0x4662('0x1d')](function(_0x56120d){if(_0x2e7bb9[_0x4662('0x26')][_0x4662('0x42')]()==_0x4662('0x50')){var _0x595841=fs[_0x4662('0x43')](path[_0x4662('0x44')](config[_0x4662('0x45')],'server/files/templates/stun_multiple.ejs'),_0x4662('0x4b'));var _0x1a35bf=ejs[_0x4662('0x46')](_0x595841,{'networks':_0x56120d||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1a35bf);return respondWithRpcPromise(_0x4662('0x48'),_0x4662('0x1c'),{'module':_0x4662('0x49')});}else if(_0x2e7bb9['type'][_0x4662('0x42')]()=='TURN'){var _0x2405a2=fs[_0x4662('0x43')](path[_0x4662('0x44')](config[_0x4662('0x45')],_0x4662('0x4a')),_0x4662('0x4b'));var _0x5dc2f5=ejs[_0x4662('0x46')](_0x2405a2,{'networks':_0x56120d||[]});fs[_0x4662('0x4c')](_0x4662('0x51'),_0x5dc2f5);return respondWithRpcPromise(_0x4662('0x48'),_0x4662('0x1c'),{'module':_0x4662('0x49')});}else{var _0x32dd77=fs[_0x4662('0x43')](path['join'](config[_0x4662('0x45')],'server/files/templates/network.ejs'),'utf8');var _0xab92dc=ejs[_0x4662('0x46')](_0x32dd77,{'networks':_0x56120d||[]});fs[_0x4662('0x4c')](util[_0x4662('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x4e3aeb['body']['type'][_0x4662('0x53')]()),_0xab92dc);return respondWithRpcPromise(_0x4662('0x48'),_0x4662('0x1c'),{'module':_0x4662('0x4f')});}})[_0x4662('0x1d')](function(_0x421564){if(_0x421564){return _0x2e7bb9;}return null;})[_0x4662('0x1d')](respondWithResult(_0x317ef0,null))[_0x4662('0x14')](handleError(_0x317ef0,null));};exports[_0x4662('0x1e')]=function(_0x2fcac7,_0xe1ead5){var _0x5c5280;return db[_0x4662('0x3a')][_0x4662('0x3f')]({'where':{'id':_0x2fcac7[_0x4662('0x3d')]['id']}})[_0x4662('0x1d')](function(_0x34eddd){_0x5c5280=_0x34eddd;return _0x34eddd;})[_0x4662('0x1d')](handleEntityNotFound(_0xe1ead5,null))[_0x4662('0x1d')](removeEntity(_0xe1ead5,null))[_0x4662('0x1d')](function(){if(_0x5c5280){return db[_0x4662('0x3a')]['findAll']({'where':{'type':_0x5c5280[_0x4662('0x26')]},'raw':!![]});}})['then'](function(_0x2f81d2){if(_0x5c5280['type']['toUpperCase']()==_0x4662('0x50')){var _0x21e024=fs[_0x4662('0x43')](path[_0x4662('0x44')](config[_0x4662('0x45')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x2be63e=ejs['render'](_0x21e024,{'networks':_0x2f81d2||[]});fs[_0x4662('0x4c')](_0x4662('0x47'),_0x2be63e);return respondWithRpcPromise('Reload',_0x4662('0x1e'),{'module':_0x4662('0x49')});}else if(_0x5c5280[_0x4662('0x26')]['toUpperCase']()==_0x4662('0x54')){var _0x158dcb=fs[_0x4662('0x43')](path['join'](config[_0x4662('0x45')],_0x4662('0x4a')),_0x4662('0x4b'));var _0x4c78dd=ejs[_0x4662('0x46')](_0x158dcb,{'networks':_0x2f81d2||[]});fs[_0x4662('0x4c')](_0x4662('0x51'),_0x4c78dd);return respondWithRpcPromise(_0x4662('0x48'),_0x4662('0x1e'),{'module':'res_stun_monitor.so'});}else{var _0x5ea21c=fs['readFileSync'](path[_0x4662('0x44')](config[_0x4662('0x45')],'server/files/templates/network.ejs'),_0x4662('0x4b'));var _0x44ace3=ejs['render'](_0x5ea21c,{'networks':_0x2f81d2||[]});fs[_0x4662('0x4c')](util[_0x4662('0x52')](_0x4662('0x4e'),_0x5c5280['type'][_0x4662('0x53')]()),_0x44ace3);return respondWithRpcPromise(_0x4662('0x48'),_0x4662('0x1e'),{'module':_0x4662('0x4f')});}})[_0x4662('0x14')](handleError(_0xe1ead5,null));}; \ No newline at end of file +var _0xc58d=['set','json','update','destroy','then','end','sendStatus','name','send','map','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','Network','include','catch','show','keys','length','find','body','findAll','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','create','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','chan_sip.so','path','lodash','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','code','error','message','offset','undefined','limit','count','status'];(function(_0x5addfd,_0x1f3e0a){var _0x2d6c02=function(_0x7a746b){while(--_0x7a746b){_0x5addfd['push'](_0x5addfd['shift']());}};_0x2d6c02(++_0x1f3e0a);}(_0xc58d,0x11f));var _0xdc58=function(_0x1acd4b,_0x430aa5){_0x1acd4b=_0x1acd4b-0x0;var _0x1f609d=_0xc58d[_0x1acd4b];return _0x1f609d;};'use strict';var util=require('util');var path=require(_0xdc58('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc58('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xdc58('0x2')][_0xdc58('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x580e01,_0x300dab,_0x3ba91e,_0x1b6100){return new Promise(function(_0x7ea4e0,_0x13a769){var _0x59b3b3=_0x1b6100||client;return _0x59b3b3[_0xdc58('0x4')](_0x580e01,_0x3ba91e)['then'](function(_0x368570){logger[_0xdc58('0x5')](_0xdc58('0x6'),_0x300dab,_0xdc58('0x7'));logger[_0xdc58('0x8')]('Network,\x20%s,\x20%s,\x20%s',_0x300dab,_0xdc58('0x7'),JSON['stringify'](_0x368570));if(_0x368570['error']){if(_0x368570['error'][_0xdc58('0x9')]===0x1f4){logger[_0xdc58('0xa')]('Network,\x20%s,\x20%s',_0x300dab,_0x368570[_0xdc58('0xa')][_0xdc58('0xb')]);return _0x13a769(_0x368570[_0xdc58('0xa')]['message']);}logger['error'](_0xdc58('0x6'),_0x300dab,_0x368570['error'][_0xdc58('0xb')]);return _0x7ea4e0(_0x368570[_0xdc58('0xa')][_0xdc58('0xb')]);}else{logger[_0xdc58('0x5')](_0xdc58('0x6'),_0x300dab,_0xdc58('0x7'));_0x7ea4e0(_0x368570['result'][_0xdc58('0xb')]);}})['catch'](function(_0x2c19d7){logger['error'](_0xdc58('0x6'),_0x300dab,_0x2c19d7);_0x13a769(_0x2c19d7);});});}function respondWithResult(_0x318003,_0x26b31d){_0x26b31d=_0x26b31d||0xc8;return function(_0x434078){if(_0x434078){return _0x318003['status'](_0x26b31d)['json'](_0x434078);}};}function respondWithFilteredResult(_0x94aeff,_0x145a09){return function(_0x3fe76b){if(_0x3fe76b){var _0xbda388=typeof _0x145a09[_0xdc58('0xc')]===_0xdc58('0xd')&&typeof _0x145a09[_0xdc58('0xe')]===_0xdc58('0xd');var _0x394c78=_0x3fe76b[_0xdc58('0xf')];var _0x4a9b2d=_0xbda388?0x0:_0x145a09['offset'];var _0x563345=_0xbda388?_0x3fe76b[_0xdc58('0xf')]:_0x145a09[_0xdc58('0xc')]+_0x145a09[_0xdc58('0xe')];var _0x4c30de;if(_0x563345>=_0x394c78){_0x563345=_0x394c78;_0x4c30de=0xc8;}else{_0x4c30de=0xce;}_0x94aeff[_0xdc58('0x10')](_0x4c30de);return _0x94aeff[_0xdc58('0x11')]('Content-Range',_0x4a9b2d+'-'+_0x563345+'/'+_0x394c78)[_0xdc58('0x12')](_0x3fe76b);}return null;};}function saveUpdates(_0x683d7c){return function(_0x3ae9c4){if(_0x3ae9c4){return _0x3ae9c4[_0xdc58('0x13')](_0x683d7c)['then'](function(_0x14a0c2){return _0x14a0c2;});}return null;};}function removeEntity(_0x218a94){return function(_0x117fc7){if(_0x117fc7){return _0x117fc7[_0xdc58('0x14')]()[_0xdc58('0x15')](function(){_0x218a94[_0xdc58('0x10')](0xcc)[_0xdc58('0x16')]();});}};}function handleEntityNotFound(_0x19cc52){return function(_0x433d3e){if(!_0x433d3e){_0x19cc52[_0xdc58('0x17')](0x194);}return _0x433d3e;};}function handleError(_0x464cb9,_0x5137c8){_0x5137c8=_0x5137c8||0x1f4;return function(_0x7ae326){logger['error'](_0x7ae326['stack']);if(_0x7ae326[_0xdc58('0x18')]){delete _0x7ae326[_0xdc58('0x18')];}_0x464cb9[_0xdc58('0x10')](_0x5137c8)[_0xdc58('0x19')](_0x7ae326);};}exports['index']=function(_0x2417e6,_0x1638bf){var _0x27ccb0={},_0x348591={},_0x3895fe={'count':0x0,'rows':[]};var _0x39a0c1=_[_0xdc58('0x1a')](db['Network']['rawAttributes'],function(_0x4691a9){return{'name':_0x4691a9[_0xdc58('0x1b')],'type':_0x4691a9['type'][_0xdc58('0x1c')]};});_0x348591[_0xdc58('0x1d')]=_['map'](_0x39a0c1,_0xdc58('0x18'));_0x348591['query']=_['keys'](_0x2417e6[_0xdc58('0x1e')]);_0x348591[_0xdc58('0x1f')]=_['intersection'](_0x348591[_0xdc58('0x1d')],_0x348591[_0xdc58('0x1e')]);_0x27ccb0[_0xdc58('0x20')]=_[_0xdc58('0x21')](_0x348591['model'],qs['fields'](_0x2417e6[_0xdc58('0x1e')][_0xdc58('0x22')]));_0x27ccb0[_0xdc58('0x20')]=_0x27ccb0[_0xdc58('0x20')]['length']?_0x27ccb0['attributes']:_0x348591[_0xdc58('0x1d')];if(!_0x2417e6[_0xdc58('0x1e')][_0xdc58('0x23')](_0xdc58('0x24'))){_0x27ccb0[_0xdc58('0xe')]=qs[_0xdc58('0xe')](_0x2417e6['query'][_0xdc58('0xe')]);_0x27ccb0['offset']=qs[_0xdc58('0xc')](_0x2417e6[_0xdc58('0x1e')]['offset']);}_0x27ccb0[_0xdc58('0x25')]=qs['sort'](_0x2417e6[_0xdc58('0x1e')]['sort']);_0x27ccb0[_0xdc58('0x26')]=qs['filters'](_[_0xdc58('0x27')](_0x2417e6[_0xdc58('0x1e')],_0x348591[_0xdc58('0x1f')]),_0x39a0c1);if(_0x2417e6[_0xdc58('0x1e')]['filter']){_0x27ccb0[_0xdc58('0x26')]=_[_0xdc58('0x28')](_0x27ccb0['where'],{'$or':_[_0xdc58('0x1a')](_0x39a0c1,function(_0x14abfa){if(_0x14abfa[_0xdc58('0x29')]!==_0xdc58('0x2a')){var _0x2ff841={};_0x2ff841[_0x14abfa[_0xdc58('0x18')]]={'$like':'%'+_0x2417e6['query'][_0xdc58('0x2b')]+'%'};return _0x2ff841;}})});}_0x27ccb0=_[_0xdc58('0x28')]({},_0x27ccb0,_0x2417e6[_0xdc58('0x2c')]);var _0x3e6c63={'where':_0x27ccb0[_0xdc58('0x26')]};return db[_0xdc58('0x2d')][_0xdc58('0xf')](_0x3e6c63)['then'](function(_0x562190){_0x3895fe[_0xdc58('0xf')]=_0x562190;if(_0x2417e6[_0xdc58('0x1e')]['includeAll']){_0x27ccb0[_0xdc58('0x2e')]=[{'all':!![]}];}return db[_0xdc58('0x2d')]['findAll'](_0x27ccb0);})[_0xdc58('0x15')](function(_0x2ae70b){_0x3895fe['rows']=_0x2ae70b;return _0x3895fe;})[_0xdc58('0x15')](respondWithFilteredResult(_0x1638bf,_0x27ccb0))[_0xdc58('0x2f')](handleError(_0x1638bf,null));};exports[_0xdc58('0x30')]=function(_0x58f978,_0x4c5de3){var _0x3d8ad3={'raw':!![],'where':{'id':_0x58f978['params']['id']}},_0x4d3658={};_0x4d3658[_0xdc58('0x1d')]=_[_0xdc58('0x31')](db['Network']['rawAttributes']);_0x4d3658[_0xdc58('0x1e')]=_[_0xdc58('0x31')](_0x58f978['query']);_0x4d3658['filters']=_[_0xdc58('0x21')](_0x4d3658[_0xdc58('0x1d')],_0x4d3658['query']);_0x3d8ad3[_0xdc58('0x20')]=_[_0xdc58('0x21')](_0x4d3658['model'],qs[_0xdc58('0x22')](_0x58f978['query'][_0xdc58('0x22')]));_0x3d8ad3[_0xdc58('0x20')]=_0x3d8ad3[_0xdc58('0x20')][_0xdc58('0x32')]?_0x3d8ad3[_0xdc58('0x20')]:_0x4d3658[_0xdc58('0x1d')];if(_0x58f978[_0xdc58('0x1e')]['includeAll']){_0x3d8ad3[_0xdc58('0x2e')]=[{'all':!![]}];}_0x3d8ad3=_['merge']({},_0x3d8ad3,_0x58f978[_0xdc58('0x2c')]);return db['Network'][_0xdc58('0x33')](_0x3d8ad3)[_0xdc58('0x15')](handleEntityNotFound(_0x4c5de3,null))[_0xdc58('0x15')](respondWithResult(_0x4c5de3,null))[_0xdc58('0x2f')](handleError(_0x4c5de3,null));};exports['create']=function(_0x46d119,_0x493539){var _0x57d17c;return db['Network']['create'](_0x46d119[_0xdc58('0x34')],{'raw':!![]})[_0xdc58('0x15')](function(_0x3f1ac2){_0x57d17c=_0x3f1ac2;return db[_0xdc58('0x2d')][_0xdc58('0x35')]({'where':{'type':_0x46d119[_0xdc58('0x34')][_0xdc58('0x29')]},'raw':!![]});})[_0xdc58('0x15')](function(_0xc1c866){if(_0x57d17c[_0xdc58('0x29')][_0xdc58('0x36')]()==_0xdc58('0x37')){var _0x51e095=fs[_0xdc58('0x38')](path['join'](config[_0xdc58('0x39')],_0xdc58('0x3a')),_0xdc58('0x3b'));var _0x127edc=ejs['render'](_0x51e095,{'networks':_0xc1c866||[]});fs[_0xdc58('0x3c')](_0xdc58('0x3d'),_0x127edc);return respondWithRpcPromise(_0xdc58('0x3e'),_0xdc58('0x3f'),{'module':_0xdc58('0x40')});}else if(_0x57d17c[_0xdc58('0x29')]['toUpperCase']()==_0xdc58('0x41')){var _0x4202a3=fs[_0xdc58('0x38')](path[_0xdc58('0x42')](config[_0xdc58('0x39')],_0xdc58('0x43')),_0xdc58('0x3b'));var _0x353a78=ejs[_0xdc58('0x44')](_0x4202a3,{'networks':_0xc1c866||[]});fs['writeFileSync'](_0xdc58('0x45'),_0x353a78);return respondWithRpcPromise(_0xdc58('0x3e'),_0xdc58('0x3f'),{'module':_0xdc58('0x40')});}else{var _0x2375bc=fs[_0xdc58('0x38')](path[_0xdc58('0x42')](config[_0xdc58('0x39')],_0xdc58('0x46')),_0xdc58('0x3b'));var _0x12f26a=ejs[_0xdc58('0x44')](_0x2375bc,{'networks':_0xc1c866||[]});fs['writeFileSync'](util[_0xdc58('0x47')](_0xdc58('0x48'),_0x46d119['body']['type'][_0xdc58('0x49')]()),_0x12f26a);return respondWithRpcPromise(_0xdc58('0x3e'),_0xdc58('0x3f'),{'module':'chan_sip.so'});}})[_0xdc58('0x15')](function(){return _0x57d17c;})['then'](respondWithResult(_0x493539,0xc9))[_0xdc58('0x2f')](handleError(_0x493539,null));};exports[_0xdc58('0x13')]=function(_0x1a9a14,_0x37dddd){var _0x2c28fe;return db[_0xdc58('0x2d')][_0xdc58('0x33')]({'where':{'id':_0x1a9a14[_0xdc58('0x4a')]['id']}})[_0xdc58('0x15')](handleEntityNotFound(_0x37dddd,null))[_0xdc58('0x15')](saveUpdates(_0x1a9a14['body'],null))[_0xdc58('0x15')](function(_0x19c304){if(_0x19c304){_0x2c28fe=_0x19c304;return db[_0xdc58('0x2d')][_0xdc58('0x35')]({'where':{'type':_0x2c28fe[_0xdc58('0x29')]},'raw':!![]});}return null;})['then'](function(_0x2397af){if(_0x2c28fe['type']['toUpperCase']()==_0xdc58('0x37')){var _0x5ee4a1=fs['readFileSync'](path[_0xdc58('0x42')](config[_0xdc58('0x39')],'server/files/templates/stun_multiple.ejs'),_0xdc58('0x3b'));var _0x44f14c=ejs[_0xdc58('0x44')](_0x5ee4a1,{'networks':_0x2397af||[]});fs[_0xdc58('0x3c')](_0xdc58('0x3d'),_0x44f14c);return respondWithRpcPromise('Reload',_0xdc58('0x13'),{'module':_0xdc58('0x40')});}else if(_0x2c28fe[_0xdc58('0x29')][_0xdc58('0x36')]()==_0xdc58('0x41')){var _0xec499c=fs[_0xdc58('0x38')](path[_0xdc58('0x42')](config[_0xdc58('0x39')],_0xdc58('0x43')),_0xdc58('0x3b'));var _0x15445b=ejs[_0xdc58('0x44')](_0xec499c,{'networks':_0x2397af||[]});fs[_0xdc58('0x3c')](_0xdc58('0x45'),_0x15445b);return respondWithRpcPromise(_0xdc58('0x3e'),_0xdc58('0x13'),{'module':_0xdc58('0x40')});}else{var _0x60c104=fs['readFileSync'](path[_0xdc58('0x42')](config['root'],_0xdc58('0x46')),'utf8');var _0x272564=ejs['render'](_0x60c104,{'networks':_0x2397af||[]});fs[_0xdc58('0x3c')](util['format'](_0xdc58('0x48'),_0x1a9a14['body'][_0xdc58('0x29')][_0xdc58('0x49')]()),_0x272564);return respondWithRpcPromise(_0xdc58('0x3e'),'update',{'module':_0xdc58('0x4b')});}})[_0xdc58('0x15')](function(_0x903c78){if(_0x903c78){return _0x2c28fe;}return null;})[_0xdc58('0x15')](respondWithResult(_0x37dddd,null))[_0xdc58('0x2f')](handleError(_0x37dddd,null));};exports['destroy']=function(_0x262e9f,_0x31cb0a){var _0x1b9a99;return db[_0xdc58('0x2d')][_0xdc58('0x33')]({'where':{'id':_0x262e9f['params']['id']}})['then'](function(_0x23fff2){_0x1b9a99=_0x23fff2;return _0x23fff2;})[_0xdc58('0x15')](handleEntityNotFound(_0x31cb0a,null))[_0xdc58('0x15')](removeEntity(_0x31cb0a,null))[_0xdc58('0x15')](function(){if(_0x1b9a99){return db[_0xdc58('0x2d')]['findAll']({'where':{'type':_0x1b9a99[_0xdc58('0x29')]},'raw':!![]});}})[_0xdc58('0x15')](function(_0x3c4f62){if(_0x1b9a99[_0xdc58('0x29')][_0xdc58('0x36')]()==_0xdc58('0x37')){var _0x58bb47=fs[_0xdc58('0x38')](path[_0xdc58('0x42')](config[_0xdc58('0x39')],_0xdc58('0x3a')),_0xdc58('0x3b'));var _0x41fb35=ejs[_0xdc58('0x44')](_0x58bb47,{'networks':_0x3c4f62||[]});fs['writeFileSync'](_0xdc58('0x3d'),_0x41fb35);return respondWithRpcPromise(_0xdc58('0x3e'),_0xdc58('0x14'),{'module':_0xdc58('0x40')});}else if(_0x1b9a99[_0xdc58('0x29')][_0xdc58('0x36')]()==_0xdc58('0x41')){var _0x21f6ac=fs['readFileSync'](path[_0xdc58('0x42')](config[_0xdc58('0x39')],_0xdc58('0x43')),'utf8');var _0x46cc45=ejs[_0xdc58('0x44')](_0x21f6ac,{'networks':_0x3c4f62||[]});fs[_0xdc58('0x3c')]('/etc/asterisk/turn_xcally.conf',_0x46cc45);return respondWithRpcPromise(_0xdc58('0x3e'),'destroy',{'module':_0xdc58('0x40')});}else{var _0x232d87=fs[_0xdc58('0x38')](path['join'](config['root'],_0xdc58('0x46')),_0xdc58('0x3b'));var _0x212436=ejs[_0xdc58('0x44')](_0x232d87,{'networks':_0x3c4f62||[]});fs[_0xdc58('0x3c')](util['format'](_0xdc58('0x48'),_0x1b9a99[_0xdc58('0x29')][_0xdc58('0x49')]()),_0x212436);return respondWithRpcPromise(_0xdc58('0x3e'),_0xdc58('0x14'),{'module':_0xdc58('0x4b')});}})[_0xdc58('0x2f')](handleError(_0x31cb0a,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f3c7249..0b7fcd9 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 _0x6953=['../../config/environment','exports','define','Network','network','lodash','util','bluebird','path','rimraf'];(function(_0x25c506,_0x190e68){var _0xef74dd=function(_0x355a5e){while(--_0x355a5e){_0x25c506['push'](_0x25c506['shift']());}};_0xef74dd(++_0x190e68);}(_0x6953,0x91));var _0x3695=function(_0x2d1018,_0x2f6a78){_0x2d1018=_0x2d1018-0x0;var _0x553d19=_0x6953[_0x2d1018];return _0x553d19;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./network.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2547=['rimraf','./network.attributes','exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4d52c8,_0x510e8b){var _0x44e6df=function(_0x28763f){while(--_0x28763f){_0x4d52c8['push'](_0x4d52c8['shift']());}};_0x44e6df(++_0x510e8b);}(_0x2547,0x1cd));var _0x7254=function(_0x3554b1,_0x4a2e0f){_0x3554b1=_0x3554b1-0x0;var _0x2711f9=_0x2547[_0x3554b1];return _0x2711f9;};'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 diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index c277da9..98be25b 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x12450f,_0x3d6a49){_0x12450f=_0x12450f-0x0;var _0xd32aa=_0x7a54[_0x12450f];return _0xd32aa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x36b3ba,_0x3d6619){_0x36b3ba=_0x36b3ba-0x0;var _0x421c17=_0x7a54[_0x36b3ba];return _0x421c17;};'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 d0a0bf9..8369c87 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 _0x2a07=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x265191,_0x479156){var _0x3f8436=function(_0x49a46f){while(--_0x49a46f){_0x265191['push'](_0x265191['shift']());}};_0x3f8436(++_0x479156);}(_0x2a07,0x74));var _0x72a0=function(_0x3ed4d7,_0x3783e0){_0x3ed4d7=_0x3ed4d7-0x0;var _0x2be1a4=_0x2a07[_0x3ed4d7];return _0x2be1a4;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getDispositions']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/applications',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0xa')](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x72a0('0x17')]);router[_0x72a0('0x18')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x19')]);router[_0x72a0('0x18')](_0x72a0('0x11'),auth['isAuthenticated'](),controller[_0x72a0('0x1a')]);router[_0x72a0('0x18')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1b')]);router['post'](_0x72a0('0x1c'),controller[_0x72a0('0x1d')]);router[_0x72a0('0x18')]('/:id/applications',auth[_0x72a0('0xb')](),controller[_0x72a0('0x1e')]);router[_0x72a0('0x18')](_0x72a0('0x1f'),auth['isAuthenticated'](),controller[_0x72a0('0x20')]);router['post'](_0x72a0('0x21'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x22')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x23')]);router[_0x72a0('0x24')]('/:id',auth[_0x72a0('0xb')](),controller[_0x72a0('0x25')]);router[_0x72a0('0x24')](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x26')]);router['delete']('/:id/canned_answers',auth[_0x72a0('0xb')](),controller[_0x72a0('0x27')]);router[_0x72a0('0x24')](_0x72a0('0x1f'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x28')]);module[_0x72a0('0x29')]=router; \ No newline at end of file +var _0x3a6d=['getInteractions','/:id/users','post','create','addDisposition','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','update','removeDispositions','removeAnswers','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x3a6d,0x143));var _0xd3a6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3a6d[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/describe',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0x9')](_0xd3a6('0xf'),auth[_0xd3a6('0xa')](),controller['getDispositions']);router[_0xd3a6('0x9')](_0xd3a6('0x10'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xd3a6('0x9')](_0xd3a6('0x12'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x13')]);router[_0xd3a6('0x9')](_0xd3a6('0x14'),auth[_0xd3a6('0xa')](),controller['getAgents']);router[_0xd3a6('0x15')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x16')]);router['post'](_0xd3a6('0xf'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x17')]);router['post'](_0xd3a6('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xd3a6('0x15')](_0xd3a6('0x18'),controller[_0xd3a6('0x19')]);router[_0xd3a6('0x15')](_0xd3a6('0x1a'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x1b')]);router['post'](_0xd3a6('0x14'),auth['isAuthenticated'](),controller[_0xd3a6('0x1c')]);router[_0xd3a6('0x15')](_0xd3a6('0x1d'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x1e')]);router[_0xd3a6('0x1f')]('/:id',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xd3a6('0xf'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x21')]);router['delete'](_0xd3a6('0x10'),auth['isAuthenticated'](),controller[_0xd3a6('0x22')]);router[_0xd3a6('0x23')](_0xd3a6('0x14'),auth['isAuthenticated'](),controller[_0xd3a6('0x24')]);module[_0xd3a6('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 368b28a..305fcdc 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 _0x896d=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x214434,_0x3facc0){var _0x309f3b=function(_0x139657){while(--_0x139657){_0x214434['push'](_0x214434['shift']());}};_0x309f3b(++_0x3facc0);}(_0x896d,0x1d9));var _0xd896=function(_0x345f71,_0x3ecc55){_0x345f71=_0x345f71-0x0;var _0x268ce5=_0x896d[_0x345f71];return _0x268ce5;};'use strict';var Sequelize=require(_0xd896('0x0'));var rs=require(_0xd896('0x1'));module[_0xd896('0x2')]={'name':{'type':Sequelize[_0xd896('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xd896('0x3')],'defaultValue':function(){return rs[_0xd896('0x4')]();}},'replyUri':{'type':Sequelize[_0xd896('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd896('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd896('0x5')],'defaultValue':function(){return _0xd896('0x6');}},'notificationSound':{'type':Sequelize[_0xd896('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd896('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd896('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd896('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd896('0x3')]},'queueTransfer':{'type':Sequelize[_0xd896('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd896('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd896('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd896('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xd896('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd896('0xa'),'set':function(_0x4fea10){if(!_0x4fea10)this['setDataValue'](_0xd896('0xb'),null);this['setDataValue'](_0xd896('0xc'),_0x4fea10);}}}; \ No newline at end of file +var _0x4b72=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x220a90,_0x453891){var _0x28bf8d=function(_0xd1b677){while(--_0xd1b677){_0x220a90['push'](_0x220a90['shift']());}};_0x28bf8d(++_0x453891);}(_0x4b72,0xbc));var _0x24b7=function(_0x33f63e,_0x1c059d){_0x33f63e=_0x33f63e-0x0;var _0x539bcd=_0x4b72[_0x33f63e];return _0x539bcd;};'use strict';var Sequelize=require(_0x24b7('0x0'));var rs=require(_0x24b7('0x1'));module['exports']={'name':{'type':Sequelize[_0x24b7('0x2')],'unique':_0x24b7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x24b7('0x2')]},'token':{'type':Sequelize[_0x24b7('0x2')],'defaultValue':function(){return rs[_0x24b7('0x4')]();}},'replyUri':{'type':Sequelize[_0x24b7('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x24b7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x24b7('0x5')],'defaultValue':function(){return _0x24b7('0x6');}},'notificationSound':{'type':Sequelize[_0x24b7('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x24b7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x24b7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x24b7('0x2')]},'queueTransfer':{'type':Sequelize[_0x24b7('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x24b7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x24b7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x24b7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x24b7('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x24b7('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x24b7('0x7')],'defaultValue':![],'comment':_0x24b7('0xa'),'set':function(_0x65300e){if(!_0x65300e)this[_0x24b7('0xb')]('mandatoryDispositionPauseId',null);this[_0x24b7('0xb')](_0x24b7('0xc'),_0x65300e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0b85005..8693e9c 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 _0xbe2a=['CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','account','applications','Applications','List','orderBy','priority','asc','from','contact','firstName','lastName','OpenchannelInteraction','externalUrl','spread','threadId','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','defaults','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','destroy','OpenchannelAccounts','UserProfileResource','stack','send','mandatoryDispositionPause','rawAttributes','type','key','model','map','name','filters','attributes','intersection','query','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','OpenchannelAccount','count','includeAll','findAll','show','params','Pause','keys','length','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','nolimit','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel'];(function(_0x2ed634,_0x474eb2){var _0x23a7bf=function(_0x55901c){while(--_0x55901c){_0x2ed634['push'](_0x2ed634['shift']());}};_0x23a7bf(++_0x474eb2);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x48b840,_0x2513dd){_0x48b840=_0x48b840-0x0;var _0x556044=_0xbe2a[_0x48b840];return _0x556044;};'use strict';var emlformat=require(_0xabe2('0x0'));var rimraf=require(_0xabe2('0x1'));var zipdir=require(_0xabe2('0x2'));var jsonpatch=require(_0xabe2('0x3'));var rp=require(_0xabe2('0x4'));var moment=require(_0xabe2('0x5'));var BPromise=require(_0xabe2('0x6'));var Mustache=require('mustache');var util=require(_0xabe2('0x7'));var path=require('path');var sox=require(_0xabe2('0x8'));var csv=require(_0xabe2('0x9'));var ejs=require(_0xabe2('0xa'));var fs=require('fs');var fs_extra=require(_0xabe2('0xb'));var _=require(_0xabe2('0xc'));var squel=require(_0xabe2('0xd'));var crypto=require('crypto');var jsforce=require(_0xabe2('0xe'));var deskjs=require(_0xabe2('0xf'));var toCsv=require(_0xabe2('0x9'));var querystring=require(_0xabe2('0x10'));var Papa=require(_0xabe2('0x11'));var Redis=require(_0xabe2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xabe2('0x13'));var as=require(_0xabe2('0x14'));var hardwareService=require(_0xabe2('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xabe2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xabe2('0x17'))['db'];config[_0xabe2('0x18')]=_['defaults'](config['redis'],{'host':_0xabe2('0x19'),'port':0x18eb});var socket=require(_0xabe2('0x1a'))(new Redis(config[_0xabe2('0x18')]));require(_0xabe2('0x1b'))[_0xabe2('0x1c')](socket);var jayson=require(_0xabe2('0x1d'));var client=jayson[_0xabe2('0x1e')][_0xabe2('0x1f')]({'port':0x232c});var client9002=jayson[_0xabe2('0x1e')][_0xabe2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5320d9,_0x3dd6d9,_0x3ba203,_0x3eb2b2){return new BPromise(function(_0x50f335,_0x333f33){var _0x59d667=_0x3eb2b2||client;return _0x59d667[_0xabe2('0x20')](_0x5320d9,_0x3ba203)[_0xabe2('0x21')](function(_0x49c4c3){logger[_0xabe2('0x22')](_0xabe2('0x23'),_0x3dd6d9,'request\x20sent');logger[_0xabe2('0x24')](_0xabe2('0x25'),_0x3dd6d9,'request\x20sent',JSON[_0xabe2('0x26')](_0x49c4c3));if(_0x49c4c3[_0xabe2('0x27')]){if(_0x49c4c3[_0xabe2('0x27')]['code']===0x1f4){logger[_0xabe2('0x27')](_0xabe2('0x23'),_0x3dd6d9,_0x49c4c3[_0xabe2('0x27')][_0xabe2('0x28')]);return _0x333f33(_0x49c4c3[_0xabe2('0x27')][_0xabe2('0x28')]);}logger['error'](_0xabe2('0x23'),_0x3dd6d9,_0x49c4c3[_0xabe2('0x27')]['message']);return _0x50f335(_0x49c4c3['error'][_0xabe2('0x28')]);}else{logger[_0xabe2('0x22')](_0xabe2('0x23'),_0x3dd6d9,_0xabe2('0x29'));_0x50f335(_0x49c4c3['result'][_0xabe2('0x28')]);}})[_0xabe2('0x2a')](function(_0x2c0c92){logger['error'](_0xabe2('0x23'),_0x3dd6d9,_0x2c0c92);_0x333f33(_0x2c0c92);});});}function respondWithStatusCode(_0x467365,_0x4904d9){_0x4904d9=_0x4904d9||0xcc;return function(_0x7b1d){if(_0x7b1d){return _0x467365[_0xabe2('0x2b')](_0x4904d9);}return _0x467365['status'](_0x4904d9)[_0xabe2('0x2c')]();};}function respondWithResult(_0x519805,_0x402c91){_0x402c91=_0x402c91||0xc8;return function(_0x18f7b3){if(_0x18f7b3){return _0x519805[_0xabe2('0x2d')](_0x402c91)[_0xabe2('0x2e')](_0x18f7b3);}};}function respondWithFilteredResult(_0x302919,_0x2b2535){return function(_0x293e3e){if(_0x293e3e){var _0x4a8738=typeof _0x2b2535[_0xabe2('0x2f')]===_0xabe2('0x30')&&typeof _0x2b2535[_0xabe2('0x31')]===_0xabe2('0x30');var _0x29ef25=_0x293e3e['count'];var _0x2824a2=_0x4a8738?0x0:_0x2b2535[_0xabe2('0x2f')];var _0x464a01=_0x4a8738?_0x293e3e['count']:_0x2b2535[_0xabe2('0x2f')]+_0x2b2535[_0xabe2('0x31')];var _0x3d8d04;if(_0x464a01>=_0x29ef25){_0x464a01=_0x29ef25;_0x3d8d04=0xc8;}else{_0x3d8d04=0xce;}_0x302919[_0xabe2('0x2d')](_0x3d8d04);return _0x302919[_0xabe2('0x32')](_0xabe2('0x33'),_0x2824a2+'-'+_0x464a01+'/'+_0x29ef25)['json'](_0x293e3e);}return null;};}function patchUpdates(_0x573d7a){return function(_0x4c7782){try{jsonpatch['apply'](_0x4c7782,_0x573d7a,!![]);}catch(_0x667d0b){return BPromise[_0xabe2('0x34')](_0x667d0b);}return _0x4c7782['save']();};}function saveUpdates(_0x18451a,_0x550740){return function(_0x95beda){if(_0x95beda){return _0x95beda['update'](_0x18451a)['then'](function(_0x264e25){return _0x264e25;});}return null;};}function removeEntity(_0xffa094,_0x2c0c9f){return function(_0x343329){if(_0x343329){return _0x343329[_0xabe2('0x35')]()[_0xabe2('0x21')](function(){var _0x4dcdcb=_0x343329['get']({'plain':!![]});var _0x58bd72=_0xabe2('0x36');return db[_0xabe2('0x37')]['destroy']({'where':{'type':_0x58bd72,'resourceId':_0x4dcdcb['id']}})[_0xabe2('0x21')](function(){return _0x343329;});})['then'](function(){_0xffa094['status'](0xcc)[_0xabe2('0x2c')]();});}};}function handleEntityNotFound(_0x4fd7c2,_0x25f4c6){return function(_0x97363a){if(!_0x97363a){_0x4fd7c2[_0xabe2('0x2b')](0x194);}return _0x97363a;};}function handleError(_0x123275,_0x40a1a0){_0x40a1a0=_0x40a1a0||0x1f4;return function(_0x170940){logger[_0xabe2('0x27')](_0x170940[_0xabe2('0x38')]);if(_0x170940['name']){delete _0x170940['name'];}_0x123275[_0xabe2('0x2d')](_0x40a1a0)[_0xabe2('0x39')](_0x170940);};}exports['index']=function(_0x43b6eb,_0x38b31f){var _0x300b3b={'include':[{'model':db['Pause'],'as':_0xabe2('0x3a')}]},_0x7f4e70={},_0x2aac84={'count':0x0,'rows':[]};var _0x1c38e3=_['map'](db['OpenchannelAccount'][_0xabe2('0x3b')],function(_0x498289){return{'name':_0x498289['fieldName'],'type':_0x498289[_0xabe2('0x3c')][_0xabe2('0x3d')]};});_0x7f4e70[_0xabe2('0x3e')]=_[_0xabe2('0x3f')](_0x1c38e3,_0xabe2('0x40'));_0x7f4e70['query']=_['keys'](_0x43b6eb['query']);_0x7f4e70[_0xabe2('0x41')]=_['intersection'](_0x7f4e70[_0xabe2('0x3e')],_0x7f4e70['query']);_0x300b3b[_0xabe2('0x42')]=_[_0xabe2('0x43')](_0x7f4e70['model'],qs['fields'](_0x43b6eb[_0xabe2('0x44')][_0xabe2('0x45')]));_0x300b3b[_0xabe2('0x42')]=_0x300b3b[_0xabe2('0x42')]['length']?_0x300b3b[_0xabe2('0x42')]:_0x7f4e70[_0xabe2('0x3e')];if(!_0x43b6eb[_0xabe2('0x44')][_0xabe2('0x46')]('nolimit')){_0x300b3b[_0xabe2('0x31')]=qs[_0xabe2('0x31')](_0x43b6eb[_0xabe2('0x44')]['limit']);_0x300b3b[_0xabe2('0x2f')]=qs[_0xabe2('0x2f')](_0x43b6eb[_0xabe2('0x44')][_0xabe2('0x2f')]);}_0x300b3b[_0xabe2('0x47')]=qs[_0xabe2('0x48')](_0x43b6eb['query'][_0xabe2('0x48')]);_0x300b3b[_0xabe2('0x49')]=qs[_0xabe2('0x41')](_['pick'](_0x43b6eb['query'],_0x7f4e70[_0xabe2('0x41')]),_0x1c38e3);if(_0x43b6eb['query'][_0xabe2('0x4a')]){_0x300b3b[_0xabe2('0x49')]=_['merge'](_0x300b3b['where'],{'$or':_[_0xabe2('0x3f')](_0x1c38e3,function(_0x28927c){if(_0x28927c['type']!==_0xabe2('0x4b')){var _0x45aa10={};_0x45aa10[_0x28927c['name']]={'$like':'%'+_0x43b6eb['query']['filter']+'%'};return _0x45aa10;}})});}_0x300b3b=_[_0xabe2('0x4c')]({},_0x300b3b,_0x43b6eb[_0xabe2('0x4d')]);var _0x1fa5fd={'where':_0x300b3b['where']};return db[_0xabe2('0x4e')][_0xabe2('0x4f')](_0x1fa5fd)[_0xabe2('0x21')](function(_0x3f8293){_0x2aac84[_0xabe2('0x4f')]=_0x3f8293;if(_0x43b6eb[_0xabe2('0x44')][_0xabe2('0x50')]){_0x300b3b['include']=[{'all':!![]}];}return db[_0xabe2('0x4e')][_0xabe2('0x51')](_0x300b3b);})[_0xabe2('0x21')](function(_0x5c124f){_0x2aac84['rows']=_0x5c124f;return _0x2aac84;})[_0xabe2('0x21')](respondWithFilteredResult(_0x38b31f,_0x300b3b))[_0xabe2('0x2a')](handleError(_0x38b31f,null));};exports[_0xabe2('0x52')]=function(_0x14ce62,_0x22af6e){var _0x48031a={'raw':![],'where':{'id':_0x14ce62[_0xabe2('0x53')]['id']},'include':[{'model':db[_0xabe2('0x54')],'as':_0xabe2('0x3a')}]},_0x91f7df={};_0x91f7df[_0xabe2('0x3e')]=_[_0xabe2('0x55')](db['OpenchannelAccount'][_0xabe2('0x3b')]);_0x91f7df[_0xabe2('0x44')]=_['keys'](_0x14ce62[_0xabe2('0x44')]);_0x91f7df['filters']=_['intersection'](_0x91f7df['model'],_0x91f7df[_0xabe2('0x44')]);_0x48031a[_0xabe2('0x42')]=_[_0xabe2('0x43')](_0x91f7df[_0xabe2('0x3e')],qs['fields'](_0x14ce62[_0xabe2('0x44')][_0xabe2('0x45')]));_0x48031a[_0xabe2('0x42')]=_0x48031a['attributes'][_0xabe2('0x56')]?_0x48031a[_0xabe2('0x42')]:_0x91f7df[_0xabe2('0x3e')];if(_0x14ce62[_0xabe2('0x44')][_0xabe2('0x50')]){_0x48031a[_0xabe2('0x57')]=[{'all':!![]}];}_0x48031a=_[_0xabe2('0x4c')]({},_0x48031a,_0x14ce62[_0xabe2('0x4d')]);return db[_0xabe2('0x4e')][_0xabe2('0x58')](_0x48031a)[_0xabe2('0x21')](handleEntityNotFound(_0x22af6e,null))['then'](respondWithResult(_0x22af6e,null))[_0xabe2('0x2a')](handleError(_0x22af6e,null));};exports['create']=function(_0x201fa6,_0x6ad87a){return db[_0xabe2('0x4e')][_0xabe2('0x59')](_0x201fa6[_0xabe2('0x5a')],{})[_0xabe2('0x21')](function(_0x1d8652){var _0xab6dfb=_0x201fa6['user']['get']({'plain':!![]});if(!_0xab6dfb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xab6dfb[_0xabe2('0x5b')]===_0xabe2('0x5c')){var _0x5cd31e=_0x1d8652['get']({'plain':!![]});var _0x288d6e=_0xabe2('0x36');return db[_0xabe2('0x5d')][_0xabe2('0x58')]({'where':{'name':_0x288d6e,'userProfileId':_0xab6dfb[_0xabe2('0x5e')]},'raw':!![]})['then'](function(_0x237cb9){if(_0x237cb9&&_0x237cb9[_0xabe2('0x5f')]===0x0){return db['UserProfileResource'][_0xabe2('0x59')]({'name':_0x5cd31e['name'],'resourceId':_0x5cd31e['id'],'type':_0x237cb9[_0xabe2('0x40')],'sectionId':_0x237cb9['id']},{})[_0xabe2('0x21')](function(){return _0x1d8652;});}else{return _0x1d8652;}})[_0xabe2('0x2a')](function(_0x3c40ad){logger[_0xabe2('0x27')](_0xabe2('0x60'),_0x3c40ad);throw _0x3c40ad;});}return _0x1d8652;})[_0xabe2('0x21')](respondWithResult(_0x6ad87a,0xc9))[_0xabe2('0x2a')](handleError(_0x6ad87a,null));};exports[_0xabe2('0x61')]=function(_0x450032,_0x6eacb6){if(_0x450032[_0xabe2('0x5a')]['id']){delete _0x450032[_0xabe2('0x5a')]['id'];}return db['OpenchannelAccount'][_0xabe2('0x58')]({'where':{'id':_0x450032[_0xabe2('0x53')]['id']},'include':[{'model':db[_0xabe2('0x54')],'as':_0xabe2('0x3a')}]})[_0xabe2('0x21')](handleEntityNotFound(_0x6eacb6,null))[_0xabe2('0x21')](saveUpdates(_0x450032[_0xabe2('0x5a')],null))[_0xabe2('0x21')](respondWithResult(_0x6eacb6,null))[_0xabe2('0x2a')](handleError(_0x6eacb6,null));};exports[_0xabe2('0x35')]=function(_0x3d306d,_0xa6a5db){return db['OpenchannelAccount'][_0xabe2('0x58')]({'where':{'id':_0x3d306d['params']['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0xa6a5db,null))['then'](removeEntity(_0xa6a5db,null))['catch'](handleError(_0xa6a5db,null));};exports[_0xabe2('0x62')]=function(_0x2ba6d0,_0x3c7798){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x3c7798,null))[_0xabe2('0x2a')](handleError(_0x3c7798,null));};exports[_0xabe2('0x63')]=function(_0x417f2a,_0x835f69,_0x33b89f){if(_0x417f2a[_0xabe2('0x5a')]['id']){delete _0x417f2a['body']['id'];}return db[_0xabe2('0x4e')][_0xabe2('0x58')]({'where':{'id':_0x417f2a[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x835f69,null))[_0xabe2('0x21')](function(_0x59b3a2){if(_0x59b3a2){_0x417f2a['body'][_0xabe2('0x64')]=_0x59b3a2['id'];return db[_0xabe2('0x65')]['create'](_0x417f2a[_0xabe2('0x5a')]);}})[_0xabe2('0x21')](respondWithResult(_0x835f69,null))[_0xabe2('0x2a')](handleError(_0x835f69,null));};exports[_0xabe2('0x66')]=function(_0x23750a,_0x536bf2,_0x1a6909){var _0xcb2573={'raw':![],'where':{}};var _0x29d85d={};var _0x1ea1b5={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x23750a[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x536bf2,null))[_0xabe2('0x21')](function(_0x3229f3){if(_0x3229f3){_0x29d85d[_0xabe2('0x3e')]=_[_0xabe2('0x55')](db['Disposition'][_0xabe2('0x3b')]);_0x29d85d[_0xabe2('0x44')]=_[_0xabe2('0x55')](_0x23750a[_0xabe2('0x44')]);_0x29d85d[_0xabe2('0x41')]=_[_0xabe2('0x43')](_0x29d85d['model'],_0x29d85d[_0xabe2('0x44')]);_0xcb2573[_0xabe2('0x42')]=_[_0xabe2('0x43')](_0x29d85d[_0xabe2('0x3e')],qs[_0xabe2('0x45')](_0x23750a['query'][_0xabe2('0x45')]));_0xcb2573[_0xabe2('0x42')]=_0xcb2573['attributes'][_0xabe2('0x56')]?_0xcb2573[_0xabe2('0x42')]:_0x29d85d[_0xabe2('0x3e')];if(!_0x23750a[_0xabe2('0x44')]['hasOwnProperty'](_0xabe2('0x67'))){_0xcb2573[_0xabe2('0x31')]=qs[_0xabe2('0x31')](_0x23750a[_0xabe2('0x44')][_0xabe2('0x31')]);_0xcb2573['offset']=qs[_0xabe2('0x2f')](_0x23750a[_0xabe2('0x44')]['offset']);}_0xcb2573[_0xabe2('0x47')]=qs[_0xabe2('0x48')](_0x23750a[_0xabe2('0x44')][_0xabe2('0x48')]);_0xcb2573[_0xabe2('0x49')]=qs[_0xabe2('0x41')](_[_0xabe2('0x68')](_0x23750a[_0xabe2('0x44')],_0x29d85d[_0xabe2('0x41')]));_0xcb2573['where'][_0xabe2('0x64')]=_0x3229f3['id'];if(_0x23750a['query']['filter']){_0xcb2573[_0xabe2('0x49')]=_['merge'](_0xcb2573[_0xabe2('0x49')],{'$or':_[_0xabe2('0x3f')](_0xcb2573[_0xabe2('0x42')],function(_0x1769ed){var _0x23ea89={};_0x23ea89[_0x1769ed]={'$like':'%'+_0x23750a[_0xabe2('0x44')][_0xabe2('0x4a')]+'%'};return _0x23ea89;})});}_0xcb2573=_[_0xabe2('0x4c')]({},_0xcb2573,_0x23750a[_0xabe2('0x4d')]);return db[_0xabe2('0x65')]['count']({'where':_0xcb2573[_0xabe2('0x49')]})[_0xabe2('0x21')](function(_0x176c02){_0x1ea1b5[_0xabe2('0x4f')]=_0x176c02;if(_0x23750a['query'][_0xabe2('0x50')]){_0xcb2573[_0xabe2('0x57')]=[{'all':!![]}];}return db[_0xabe2('0x65')][_0xabe2('0x51')](_0xcb2573);})[_0xabe2('0x21')](function(_0x1c0b82){_0x1ea1b5[_0xabe2('0x69')]=_0x1c0b82;return _0x1ea1b5;});}})['then'](respondWithFilteredResult(_0x536bf2,_0xcb2573))[_0xabe2('0x2a')](handleError(_0x536bf2,null));};exports[_0xabe2('0x6a')]=function(_0x3e7427,_0x4ca071,_0x346331){return db[_0xabe2('0x4e')][_0xabe2('0x58')]({'where':{'id':_0x3e7427[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x4ca071,null))[_0xabe2('0x21')](function(_0xbb36f8){if(_0xbb36f8){return _0xbb36f8[_0xabe2('0x6a')](_0x3e7427[_0xabe2('0x44')][_0xabe2('0x6b')]);}})[_0xabe2('0x21')](respondWithStatusCode(_0x4ca071,null))[_0xabe2('0x2a')](handleError(_0x4ca071,null));};exports[_0xabe2('0x6c')]=function(_0x574158,_0x14707b,_0x24f855){if(_0x574158[_0xabe2('0x5a')]['id']){delete _0x574158[_0xabe2('0x5a')]['id'];}return db['OpenchannelAccount'][_0xabe2('0x58')]({'where':{'id':_0x574158[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x14707b,null))[_0xabe2('0x21')](function(_0x5afb9e){if(_0x5afb9e){_0x574158[_0xabe2('0x5a')][_0xabe2('0x64')]=_0x5afb9e['id'];return db[_0xabe2('0x6d')][_0xabe2('0x59')](_0x574158[_0xabe2('0x5a')]);}})[_0xabe2('0x21')](respondWithResult(_0x14707b,null))[_0xabe2('0x2a')](handleError(_0x14707b,null));};exports[_0xabe2('0x6e')]=function(_0x259a4c,_0x4825ff,_0x3133e5){var _0x12e5ef={'raw':![],'where':{}};var _0x31c6dc={};var _0x15a318={'count':0x0,'rows':[]};return db[_0xabe2('0x4e')][_0xabe2('0x6f')]({'where':{'id':_0x259a4c[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x4825ff,null))[_0xabe2('0x21')](function(_0xd9346f){if(_0xd9346f){_0x31c6dc[_0xabe2('0x3e')]=_[_0xabe2('0x55')](db[_0xabe2('0x6d')][_0xabe2('0x3b')]);_0x31c6dc[_0xabe2('0x44')]=_[_0xabe2('0x55')](_0x259a4c[_0xabe2('0x44')]);_0x31c6dc[_0xabe2('0x41')]=_[_0xabe2('0x43')](_0x31c6dc['model'],_0x31c6dc[_0xabe2('0x44')]);_0x12e5ef[_0xabe2('0x42')]=_[_0xabe2('0x43')](_0x31c6dc['model'],qs[_0xabe2('0x45')](_0x259a4c[_0xabe2('0x44')][_0xabe2('0x45')]));_0x12e5ef['attributes']=_0x12e5ef['attributes'][_0xabe2('0x56')]?_0x12e5ef[_0xabe2('0x42')]:_0x31c6dc['model'];if(!_0x259a4c['query'][_0xabe2('0x46')](_0xabe2('0x67'))){_0x12e5ef[_0xabe2('0x31')]=qs['limit'](_0x259a4c[_0xabe2('0x44')][_0xabe2('0x31')]);_0x12e5ef[_0xabe2('0x2f')]=qs['offset'](_0x259a4c[_0xabe2('0x44')][_0xabe2('0x2f')]);}_0x12e5ef[_0xabe2('0x47')]=qs[_0xabe2('0x48')](_0x259a4c['query'][_0xabe2('0x48')]);_0x12e5ef[_0xabe2('0x49')]=qs[_0xabe2('0x41')](_['pick'](_0x259a4c[_0xabe2('0x44')],_0x31c6dc[_0xabe2('0x41')]));_0x12e5ef['where'][_0xabe2('0x64')]=_0xd9346f['id'];if(_0x259a4c[_0xabe2('0x44')][_0xabe2('0x4a')]){_0x12e5ef['where']=_[_0xabe2('0x4c')](_0x12e5ef[_0xabe2('0x49')],{'$or':_[_0xabe2('0x3f')](_0x12e5ef[_0xabe2('0x42')],function(_0xdaffe6){var _0x553f63={};_0x553f63[_0xdaffe6]={'$like':'%'+_0x259a4c['query'][_0xabe2('0x4a')]+'%'};return _0x553f63;})});}_0x12e5ef=_[_0xabe2('0x4c')]({},_0x12e5ef,_0x259a4c['options']);return db[_0xabe2('0x6d')][_0xabe2('0x4f')]({'where':_0x12e5ef[_0xabe2('0x49')]})[_0xabe2('0x21')](function(_0x257d5e){_0x15a318['count']=_0x257d5e;if(_0x259a4c[_0xabe2('0x44')][_0xabe2('0x50')]){_0x12e5ef['include']=[{'all':!![]}];}return db[_0xabe2('0x6d')][_0xabe2('0x51')](_0x12e5ef);})[_0xabe2('0x21')](function(_0x5f1d69){_0x15a318[_0xabe2('0x69')]=_0x5f1d69;return _0x15a318;});}})[_0xabe2('0x21')](respondWithFilteredResult(_0x4825ff,_0x12e5ef))[_0xabe2('0x2a')](handleError(_0x4825ff,null));};exports[_0xabe2('0x70')]=function(_0x29a516,_0x5adb0f,_0x39b92c){return db[_0xabe2('0x4e')][_0xabe2('0x58')]({'where':{'id':_0x29a516[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x5adb0f,null))[_0xabe2('0x21')](function(_0x3dee19){if(_0x3dee19){return _0x3dee19[_0xabe2('0x70')](_0x29a516[_0xabe2('0x44')][_0xabe2('0x6b')]);}})[_0xabe2('0x21')](respondWithStatusCode(_0x5adb0f,null))[_0xabe2('0x2a')](handleError(_0x5adb0f,null));};exports[_0xabe2('0x71')]=function(_0x19cd5f,_0xf1f5c0,_0x52f779){var _0x44fb09={'body':_0x19cd5f[_0xabe2('0x5a')],'channel':_0xabe2('0x72')};var _0x45d31b=[];var _0x3d7513=[];var _0x3374d7={};var _0x2b4a86=![];return db[_0xabe2('0x73')][_0xabe2('0x62')]()[_0xabe2('0x21')](function(_0x3946c8){if(!_0x3946c8){throw new db[(_0xabe2('0x74'))]['ValidationError'](_0xabe2('0x75'));}_0x45d31b=_[_0xabe2('0x76')](_['keys'](_0x3946c8),[_0xabe2('0x77'),_0xabe2('0x78')]);_0x3d7513=_['difference'](_[_0xabe2('0x55')](_0x3946c8),[_0xabe2('0x77'),_0xabe2('0x78'),_0xabe2('0x79'),_0xabe2('0x7a')]);if(_0x19cd5f[_0xabe2('0x5a')]['id']){delete _0x19cd5f[_0xabe2('0x5a')]['id'];}if(_[_0xabe2('0x7b')](_0x19cd5f[_0xabe2('0x5a')]['from'])){throw new db['Sequelize'][(_0xabe2('0x7c'))](_0xabe2('0x7d'));}if(_[_0xabe2('0x7b')](_0x19cd5f['body']['body'])||_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x5a')]===''){throw new db['Sequelize'][(_0xabe2('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xabe2('0x7b')](_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x7e')])){throw new db[(_0xabe2('0x74'))][(_0xabe2('0x7c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d7513);}if(!_['includes'](_0x3d7513,_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x7e')])){throw new db[(_0xabe2('0x74'))]['ValidationError'](_0xabe2('0x7f')+_0x3d7513);}_0x3374d7[_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x7e')]]=_0x19cd5f[_0xabe2('0x5a')]['from'];})[_0xabe2('0x21')](function(){return db[_0xabe2('0x4e')][_0xabe2('0x58')]({'where':{'id':_0x19cd5f[_0xabe2('0x53')]['id']},'include':[{'model':db[_0xabe2('0x80')],'as':'List','include':[{'model':db[_0xabe2('0x73')],'as':_0xabe2('0x81'),'where':_0x3374d7,'limit':0x1,'order':[[_0xabe2('0x78'),'DESC']]}]},{'model':db[_0xabe2('0x82')],'as':'Applications'}]});})[_0xabe2('0x21')](handleEntityNotFound(_0xf1f5c0,null))[_0xabe2('0x21')](function(_0x50ab19){if(_0x50ab19&&_0x50ab19['List']){_0x44fb09[_0xabe2('0x83')]=_0x50ab19;_0x44fb09[_0xabe2('0x84')]=_0x50ab19[_0xabe2('0x85')];_0x44fb09['list']=_0x50ab19[_0xabe2('0x86')];_0x44fb09[_0xabe2('0x84')]=_[_0xabe2('0x87')](_0x44fb09['applications'],[_0xabe2('0x88')],[_0xabe2('0x89')]);if(_0x44fb09['account'][_0xabe2('0x85')]){delete _0x44fb09['account']['Applications'];}if(_0x44fb09[_0xabe2('0x83')]['List']&&_0x44fb09[_0xabe2('0x83')][_0xabe2('0x86')][_0xabe2('0x81')]['length']){return _0x44fb09[_0xabe2('0x83')][_0xabe2('0x86')][_0xabe2('0x81')][0x0];}var _0x314fc2=_['defaults'](_0x19cd5f[_0xabe2('0x5a')],{'firstName':_0x19cd5f[_0xabe2('0x5a')]['from'],'ListId':_0x50ab19[_0xabe2('0x7a')]});_0x314fc2[_0x19cd5f[_0xabe2('0x5a')]['mapKey']]=_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x8a')];return db['CmContact'][_0xabe2('0x59')](_0x314fc2,{'fields':_0x45d31b,'raw':!![]});}})[_0xabe2('0x21')](handleEntityNotFound(_0xf1f5c0,null))[_0xabe2('0x21')](function(_0x420691){_0x44fb09[_0xabe2('0x8b')]=_0x420691;if(_0x420691){var _0x1600b1={'ContactId':_0x420691['id'],'OpenchannelAccountId':_0x19cd5f[_0xabe2('0x53')]['id'],'from':(_0x420691[_0xabe2('0x8c')]||'')+'\x20'+(_0x420691[_0xabe2('0x8d')]||'')};var _0x16baa3={'OpenchannelAccountId':_0x19cd5f[_0xabe2('0x53')]['id'],'closed':![]};if(_0x19cd5f[_0xabe2('0x5a')]['threadId']){_0x16baa3['threadId']=_0x19cd5f['body']['threadId'];return db[_0xabe2('0x8e')][_0xabe2('0x58')]({'where':_0x16baa3})[_0xabe2('0x21')](function(_0x2c387d){if(_0x2c387d){return[_0x2c387d,![]];}_0x1600b1['threadId']=_0x19cd5f[_0xabe2('0x5a')]['threadId'];_0x1600b1['externalUrl']=_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x8f')];return db[_0xabe2('0x8e')][_0xabe2('0x59')](_0x1600b1)[_0xabe2('0x21')](function(_0x1dae15){return[_0x1dae15,!![]];});});}else{_0x16baa3['threadId']=null;}_0x16baa3['ContactId']=_0x420691['id'];return db[_0xabe2('0x8e')][_0xabe2('0x58')]({'where':_0x16baa3})['then'](function(_0x13d180){if(_0x13d180){return[_0x13d180,![]];}return db[_0xabe2('0x8e')][_0xabe2('0x59')](_0x1600b1)['then'](function(_0x4ae7fc){return[_0x4ae7fc,!![]];});});}})[_0xabe2('0x90')](function(_0x595c52,_0x9eaabc){if(_0x595c52){_0x2b4a86=_0x9eaabc;if(!_0x9eaabc){var _0xc4c457={'from':(_0x44fb09[_0xabe2('0x8b')][_0xabe2('0x8c')]||'')+'\x20'+(_0x44fb09[_0xabe2('0x8b')][_0xabe2('0x8d')]||'')};if(_0x19cd5f['body'][_0xabe2('0x91')]&&_0x19cd5f['body']['messageId']&&_0x19cd5f['body'][_0xabe2('0x91')]!=_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x92')]){_0xc4c457[_0xabe2('0x91')]=_0x19cd5f['body'][_0xabe2('0x92')];}return _0x595c52[_0xabe2('0x61')](_0xc4c457);}else{return _0x595c52;}}})[_0xabe2('0x21')](function(_0x490873){_0x44fb09[_0xabe2('0x93')]=_0x490873['get']({'plain':!![]});_0x44fb09['interaction'][_0xabe2('0x94')]=_0x2b4a86;if(_0x44fb09['interaction']['created']){if(_0x44fb09[_0xabe2('0x83')][_0xabe2('0x95')]){_0x44fb09[_0xabe2('0x84')][_0xabe2('0x96')]({'id':0x0,'priority':_0x44fb09[_0xabe2('0x84')]['length']+0x1,'app':'close','appdata':_0xabe2('0x97'),'interval':_0xabe2('0x98')});}}return db[_0xabe2('0x99')][_0xabe2('0x59')]({'body':_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x5a')],'OpenchannelAccountId':_0x19cd5f[_0xabe2('0x53')]['id'],'OpenchannelInteractionId':_0x490873['id'],'direction':'in','ContactId':_0x44fb09['contact']['id'],'AttachmentId':_0x19cd5f[_0xabe2('0x5a')][_0xabe2('0x9a')]});})[_0xabe2('0x21')](function(_0x333f4a){_0x44fb09[_0xabe2('0x28')]=_0x333f4a;if(!_0x44fb09[_0xabe2('0x93')][_0xabe2('0x9b')])return;return db[_0xabe2('0x9c')][_0xabe2('0x58')]({'attributes':['id',_0xabe2('0x40')],'where':{'id':_0x44fb09[_0xabe2('0x93')][_0xabe2('0x9b')]}});})[_0xabe2('0x21')](function(_0x246e10){if(_0x246e10){_0x44fb09['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xabe2('0x9d'),'appdata':_0x246e10[_0xabe2('0x40')]+','+(_0x44fb09[_0xabe2('0x83')][_0xabe2('0x9e')]||0xa),'interval':'*,*,*,*'});}if(!_0x44fb09[_0xabe2('0x93')][_0xabe2('0x9f')])return;return db[_0xabe2('0xa0')][_0xabe2('0x58')]({'attributes':['id',_0xabe2('0x40')],'where':{'id':_0x44fb09[_0xabe2('0x93')][_0xabe2('0x9f')]}});})[_0xabe2('0x21')](function(_0x32ae87){if(_0x32ae87){_0x44fb09[_0xabe2('0x84')][_0xabe2('0xa1')]({'id':0x0,'priority':0x1,'app':_0xabe2('0xa2'),'appdata':_0x32ae87['name']+','+(_0x44fb09[_0xabe2('0x83')][_0xabe2('0xa3')]||0x12c),'interval':_0xabe2('0x98')});}return respondWithRpcPromise(_0xabe2('0xa4'),_0xabe2('0xa5'),_0x44fb09);})[_0xabe2('0x21')](function(_0x3c116d){respondWithRpcPromise(_0xabe2('0xa6'),_0xabe2('0xa6'),{'event':_0xabe2('0x71'),'message':_0x3c116d},client9002);return _0x3c116d;})['then'](respondWithResult(_0xf1f5c0,null))['catch'](handleError(_0xf1f5c0,null));};exports[_0xabe2('0xa7')]=function(_0x5c3cb6,_0x5de15c){var _0x4727f3=_0x5c3cb6['params']['id'];var _0x571b18=_0x5c3cb6[_0xabe2('0x5a')];var _0xb0fdf2=0xc8;var _0x33d5da=null;return db[_0xabe2('0xa8')][_0xabe2('0xa9')]({'isolationLevel':db[_0xabe2('0xa8')][_0xabe2('0xaa')][_0xabe2('0xab')][_0xabe2('0xac')]},function(_0x6007d0){return db[_0xabe2('0x4e')][_0xabe2('0x6f')]({'where':{'id':_0x4727f3},'transaction':_0x6007d0})[_0xabe2('0x21')](function(_0x44a492){if(_0x44a492){return db[_0xabe2('0x82')][_0xabe2('0x35')]({'where':{'OpenchannelAccountId':_0x4727f3},'transaction':_0x6007d0})[_0xabe2('0x21')](function(){var _0x4f5097=_[_0xabe2('0x3f')](_0x571b18,function(_0x30c253){_0x30c253[_0xabe2('0x64')]=_0x4727f3;return _0x30c253;});return db[_0xabe2('0x82')][_0xabe2('0xad')](_0x4f5097,{'transaction':_0x6007d0});});}else{_0xb0fdf2=0x194;_0x33d5da=[];}});})['then'](function(){if(_0xb0fdf2!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4727f3},'order':'priority'})[_0xabe2('0x21')](function(_0x2a79b2){_0x33d5da=_0x2a79b2;});}})[_0xabe2('0x2a')](function(_0x5d9f1a){_0xb0fdf2=0x1f4;logger[_0xabe2('0x27')](_0x5d9f1a['stack']);if(_0x5d9f1a[_0xabe2('0x40')]){delete _0x5d9f1a[_0xabe2('0x40')];}_0x33d5da=_0x5d9f1a;})[_0xabe2('0xae')](function(){if(_0x33d5da===null){_0x5de15c[_0xabe2('0x2b')](_0xb0fdf2);}else{if(_0xb0fdf2===0x1f4){_0x5de15c['status'](_0xb0fdf2)[_0xabe2('0x39')](_0x33d5da);}else{_0x5de15c[_0xabe2('0x2d')](_0xb0fdf2)['json'](_0x33d5da);}}});};exports['getApplications']=function(_0x4d523a,_0x4692a6,_0x28d7aa){var _0x18bd82={};var _0x3424ad={};var _0x4cd7d8;var _0x45bd47;return db[_0xabe2('0x4e')][_0xabe2('0x6f')]({'where':{'id':_0x4d523a[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x4692a6,null))[_0xabe2('0x21')](function(_0x59f400){if(_0x59f400){_0x4cd7d8=_0x59f400;_0x3424ad[_0xabe2('0x3e')]=_[_0xabe2('0x55')](db[_0xabe2('0x82')][_0xabe2('0x3b')]);_0x3424ad['query']=_[_0xabe2('0x55')](_0x4d523a[_0xabe2('0x44')]);_0x3424ad['filters']=_[_0xabe2('0x43')](_0x3424ad[_0xabe2('0x3e')],_0x3424ad[_0xabe2('0x44')]);_0x18bd82[_0xabe2('0x42')]=_[_0xabe2('0x43')](_0x3424ad[_0xabe2('0x3e')],qs[_0xabe2('0x45')](_0x4d523a[_0xabe2('0x44')]['fields']));_0x18bd82[_0xabe2('0x42')]=_0x18bd82['attributes'][_0xabe2('0x56')]?_0x18bd82[_0xabe2('0x42')]:_0x3424ad[_0xabe2('0x3e')];_0x18bd82['order']=qs[_0xabe2('0x48')](_0x4d523a[_0xabe2('0x44')][_0xabe2('0x48')]);_0x18bd82['where']=qs[_0xabe2('0x41')](_[_0xabe2('0x68')](_0x4d523a[_0xabe2('0x44')],_0x3424ad[_0xabe2('0x41')]));if(_0x4d523a[_0xabe2('0x44')][_0xabe2('0x4a')]){_0x18bd82[_0xabe2('0x49')]=_[_0xabe2('0x4c')](_0x18bd82['where'],{'$or':_[_0xabe2('0x3f')](_0x18bd82[_0xabe2('0x42')],function(_0x4e5685){var _0x36a4bc={};_0x36a4bc[_0x4e5685]={'$like':'%'+_0x4d523a[_0xabe2('0x44')]['filter']+'%'};return _0x36a4bc;})});}_0x18bd82=_[_0xabe2('0x4c')]({},_0x18bd82,_0x4d523a['options']);return _0x4cd7d8[_0xabe2('0xaf')](_0x18bd82);}})[_0xabe2('0x21')](function(_0x30e517){if(_0x30e517){_0x45bd47=_0x30e517[_0xabe2('0x56')];if(!_0x4d523a['query'][_0xabe2('0x46')](_0xabe2('0x67'))){_0x18bd82[_0xabe2('0x31')]=qs[_0xabe2('0x31')](_0x4d523a[_0xabe2('0x44')]['limit']);_0x18bd82[_0xabe2('0x2f')]=qs[_0xabe2('0x2f')](_0x4d523a[_0xabe2('0x44')][_0xabe2('0x2f')]);}return _0x4cd7d8[_0xabe2('0xaf')](_0x18bd82);}})[_0xabe2('0x21')](function(_0x1356ff){if(_0x1356ff){return _0x1356ff?{'count':_0x45bd47,'rows':_0x1356ff}:null;}})[_0xabe2('0x21')](respondWithResult(_0x4692a6,null))[_0xabe2('0x2a')](handleError(_0x4692a6,null));};exports[_0xabe2('0xb0')]=function(_0x418fbb,_0x1c1c8f,_0x1ecbf6){var _0x4faff5={'raw':![],'where':{}};var _0x3a69a7={};var _0x54cbec={'count':0x0,'rows':[]};return db[_0xabe2('0x4e')][_0xabe2('0x6f')]({'where':{'id':_0x418fbb[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x1c1c8f,null))['then'](function(_0x4e5af2){if(_0x4e5af2){_0x3a69a7['model']=_[_0xabe2('0x55')](db[_0xabe2('0x8e')][_0xabe2('0x3b')]);_0x3a69a7['query']=_[_0xabe2('0x55')](_0x418fbb[_0xabe2('0x44')]);_0x3a69a7['filters']=_[_0xabe2('0x43')](_0x3a69a7[_0xabe2('0x3e')],_0x3a69a7[_0xabe2('0x44')]);_0x4faff5['attributes']=_[_0xabe2('0x43')](_0x3a69a7[_0xabe2('0x3e')],qs[_0xabe2('0x45')](_0x418fbb[_0xabe2('0x44')]['fields']));_0x4faff5[_0xabe2('0x42')]=_0x4faff5[_0xabe2('0x42')][_0xabe2('0x56')]?_0x4faff5[_0xabe2('0x42')]:_0x3a69a7[_0xabe2('0x3e')];if(!_0x418fbb[_0xabe2('0x44')]['hasOwnProperty'](_0xabe2('0x67'))){_0x4faff5[_0xabe2('0x31')]=qs[_0xabe2('0x31')](_0x418fbb[_0xabe2('0x44')][_0xabe2('0x31')]);_0x4faff5[_0xabe2('0x2f')]=qs[_0xabe2('0x2f')](_0x418fbb[_0xabe2('0x44')][_0xabe2('0x2f')]);}_0x4faff5[_0xabe2('0x47')]=qs[_0xabe2('0x48')](_0x418fbb[_0xabe2('0x44')][_0xabe2('0x48')]);_0x4faff5[_0xabe2('0x49')]=qs[_0xabe2('0x41')](_[_0xabe2('0x68')](_0x418fbb[_0xabe2('0x44')],_0x3a69a7['filters']));_0x4faff5['where'][_0xabe2('0x64')]=_0x4e5af2['id'];if(_0x418fbb['query'][_0xabe2('0x4a')]){_0x4faff5['where']=_['merge'](_0x4faff5[_0xabe2('0x49')],{'$or':_[_0xabe2('0x3f')](_0x4faff5[_0xabe2('0x42')],function(_0x3238ba){var _0x187505={};_0x187505[_0x3238ba]={'$like':'%'+_0x418fbb['query'][_0xabe2('0x4a')]+'%'};return _0x187505;})});}_0x4faff5=_[_0xabe2('0x4c')]({},_0x4faff5,_0x418fbb['options']);return db[_0xabe2('0x8e')][_0xabe2('0x4f')]({'where':_0x4faff5[_0xabe2('0x49')]})[_0xabe2('0x21')](function(_0x54a778){_0x54cbec['count']=_0x54a778;if(_0x418fbb[_0xabe2('0x44')]['includeAll']){_0x4faff5[_0xabe2('0x57')]=[{'model':db[_0xabe2('0x73')],'as':_0xabe2('0xb1'),'required':![]},{'model':db[_0xabe2('0x9c')],'as':_0xabe2('0xb2'),'attributes':[_0xabe2('0x40'),_0xabe2('0xb3'),_0xabe2('0xb4')],'required':![]},{'model':db[_0xabe2('0xb5')],'as':_0xabe2('0xb6'),'attributes':['id',_0xabe2('0x40'),'color'],'where':_0x418fbb['query'][_0xabe2('0xb7')]?{'id':_0x418fbb['query'][_0xabe2('0xb7')]}:undefined,'required':_0x418fbb['query'][_0xabe2('0xb7')]?!![]:![]}];}return db[_0xabe2('0x8e')][_0xabe2('0x51')](_0x4faff5);})[_0xabe2('0x21')](function(_0x4cafd9){_0x54cbec['rows']=_0x4cafd9;return _0x54cbec;});}})[_0xabe2('0x21')](respondWithFilteredResult(_0x1c1c8f,_0x4faff5))[_0xabe2('0x2a')](handleError(_0x1c1c8f,null));};exports['addAgents']=function(_0x2ddff7,_0x3e297e,_0x1473a5){return db['OpenchannelAccount']['find']({'where':{'id':_0x2ddff7[_0xabe2('0x53')]['id']}})['then'](handleEntityNotFound(_0x3e297e,null))['then'](function(_0x2e4935){if(_0x2e4935){return _0x2e4935[_0xabe2('0xb8')](_0x2ddff7[_0xabe2('0x5a')]['ids'],_['omit'](_0x2ddff7[_0xabe2('0x5a')],['ids','id'])||{})[_0xabe2('0x90')](function(_0x55e2a3){for(var _0x252d61=0x0;_0x252d61<_0x2ddff7[_0xabe2('0x5a')][_0xabe2('0x6b')]['length'];_0x252d61+=0x1){socket[_0xabe2('0xb9')](_0xabe2('0xba'),{'UserId':Number(_0x2ddff7['body'][_0xabe2('0x6b')][_0x252d61]),'OpenchannelAccountId':Number(_0x2ddff7['params']['id'])});}return _0x55e2a3;});}})['then'](respondWithResult(_0x3e297e,null))[_0xabe2('0x2a')](handleError(_0x3e297e,null));};exports[_0xabe2('0xbb')]=function(_0x35b1c9,_0x34be43,_0x4ee51a){return db['OpenchannelAccount'][_0xabe2('0x58')]({'where':{'id':_0x35b1c9[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x34be43,null))[_0xabe2('0x21')](function(_0x4dae66){if(_0x4dae66){return _0x4dae66[_0xabe2('0xbb')](_0x35b1c9[_0xabe2('0x44')][_0xabe2('0x6b')])['then'](function(){if(_[_0xabe2('0xbc')](_0x35b1c9['query'][_0xabe2('0x6b')])){for(var _0x1aad0b=0x0;_0x1aad0b<_0x35b1c9[_0xabe2('0x44')][_0xabe2('0x6b')][_0xabe2('0x56')];_0x1aad0b+=0x1){socket[_0xabe2('0xb9')](_0xabe2('0xbd'),{'UserId':Number(_0x35b1c9[_0xabe2('0x44')][_0xabe2('0x6b')][_0x1aad0b]),'OpenchannelAccountId':Number(_0x35b1c9[_0xabe2('0x53')]['id'])});}}else{socket['emit'](_0xabe2('0xbd'),{'UserId':Number(_0x35b1c9[_0xabe2('0x44')][_0xabe2('0x6b')]),'OpenchannelAccountId':Number(_0x35b1c9[_0xabe2('0x53')]['id'])});}});}})[_0xabe2('0x21')](respondWithStatusCode(_0x34be43,null))[_0xabe2('0x2a')](handleError(_0x34be43,null));};exports['getAgents']=function(_0x6e5811,_0x16ec26,_0x24abd6){var _0x4f3324={};var _0x18b7bf={};var _0x422b17;var _0x2743c6;return db[_0xabe2('0x4e')][_0xabe2('0x6f')]({'where':{'id':_0x6e5811['params']['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x16ec26,null))[_0xabe2('0x21')](function(_0x36cba7){if(_0x36cba7){_0x422b17=_0x36cba7;_0x18b7bf[_0xabe2('0x3e')]=_[_0xabe2('0x55')](db[_0xabe2('0x9c')][_0xabe2('0x3b')]);_0x18b7bf[_0xabe2('0x44')]=_['keys'](_0x6e5811[_0xabe2('0x44')]);_0x18b7bf[_0xabe2('0x41')]=_[_0xabe2('0x43')](_0x18b7bf[_0xabe2('0x3e')],_0x18b7bf['query']);_0x4f3324[_0xabe2('0x42')]=_['intersection'](_0x18b7bf[_0xabe2('0x3e')],qs[_0xabe2('0x45')](_0x6e5811[_0xabe2('0x44')][_0xabe2('0x45')]));_0x4f3324[_0xabe2('0x42')]=_0x4f3324['attributes'][_0xabe2('0x56')]?_0x4f3324['attributes']:_0x18b7bf[_0xabe2('0x3e')];_0x4f3324['order']=qs[_0xabe2('0x48')](_0x6e5811[_0xabe2('0x44')]['sort']);_0x4f3324[_0xabe2('0x49')]=qs[_0xabe2('0x41')](_[_0xabe2('0x68')](_0x6e5811[_0xabe2('0x44')],_0x18b7bf[_0xabe2('0x41')]));if(_0x6e5811[_0xabe2('0x44')]['filter']){_0x4f3324['where']=_[_0xabe2('0x4c')](_0x4f3324[_0xabe2('0x49')],{'$or':_[_0xabe2('0x3f')](_0x4f3324[_0xabe2('0x42')],function(_0x3fc519){var _0xd6b29={};_0xd6b29[_0x3fc519]={'$like':'%'+_0x6e5811[_0xabe2('0x44')]['filter']+'%'};return _0xd6b29;})});}_0x4f3324=_['merge']({},_0x4f3324,_0x6e5811[_0xabe2('0x4d')]);return _0x422b17[_0xabe2('0xbe')](_0x4f3324);}})['then'](function(_0x572795){if(_0x572795){_0x2743c6=_0x572795['length'];if(!_0x6e5811[_0xabe2('0x44')][_0xabe2('0x46')]('nolimit')){_0x4f3324[_0xabe2('0x31')]=qs[_0xabe2('0x31')](_0x6e5811[_0xabe2('0x44')][_0xabe2('0x31')]);_0x4f3324['offset']=qs[_0xabe2('0x2f')](_0x6e5811['query'][_0xabe2('0x2f')]);}return _0x422b17[_0xabe2('0xbe')](_0x4f3324);}})[_0xabe2('0x21')](function(_0x214698){if(_0x214698){return _0x214698?{'count':_0x2743c6,'rows':_0x214698}:null;}})[_0xabe2('0x21')](respondWithResult(_0x16ec26,null))[_0xabe2('0x2a')](handleError(_0x16ec26,null));};exports[_0xabe2('0x39')]=function(_0xb0511f,_0x806225,_0x22d5ee){var _0xd134f9,_0xb25626,_0x3ead3f;if(_[_0xabe2('0x7b')](_0xb0511f['body'][_0xabe2('0x5a')])||_0xb0511f[_0xabe2('0x5a')][_0xabe2('0x5a')]===''){throw new db[(_0xabe2('0x74'))][(_0xabe2('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xabe2('0x7b')](_0xb0511f[_0xabe2('0x5a')]['to'])){}_0xd134f9=_0xb0511f['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0xb0511f[_0xabe2('0x53')]['id']}})[_0xabe2('0x21')](handleEntityNotFound(_0x806225,null))[_0xabe2('0x21')](function(_0xcb1e1d){if(_0xcb1e1d){return db['OpenchannelAccount'][_0xabe2('0x58')]({'where':{'id':_0xcb1e1d['id']},'include':[{'model':db[_0xabe2('0x80')],'as':_0xabe2('0x86'),'include':[{'model':db['CmContact'],'as':_0xabe2('0x81'),'where':{[_0xcb1e1d[_0xabe2('0x7e')]]:_0xd134f9},'limit':0x1,'order':[[_0xabe2('0x78'),_0xabe2('0xbf')]]}]}]})[_0xabe2('0x21')](handleEntityNotFound(_0x806225,null))[_0xabe2('0x21')](function(_0x112cb5){if(_0x112cb5&&_0x112cb5[_0xabe2('0x86')]){_0xb25626=_0x112cb5['get']({'plain':!![]});if(_0xb25626[_0xabe2('0x86')]&&_0xb25626[_0xabe2('0x86')]['Contacts'][_0xabe2('0x56')]){return _0xb25626[_0xabe2('0x86')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xabe2('0xc0')](_0xb0511f[_0xabe2('0x5a')],{'firstName':_0xd134f9,[_0x112cb5[_0xabe2('0x7e')]]:_0xd134f9,'phone':_0xd134f9,'ListId':_0xb25626[_0xabe2('0x7a')]}));}})[_0xabe2('0x21')](handleEntityNotFound(_0x806225,null))['then'](function(_0x11f53a){if(_0x11f53a){_0x3ead3f=_0x11f53a;return db[_0xabe2('0x8e')][_0xabe2('0x58')]({'where':{'ContactId':_0x3ead3f['id'],'closed':![],'OpenchannelAccountId':_0xb25626['id']}})[_0xabe2('0x21')](function(_0x37c45b){if(_0x37c45b){return[_0x37c45b,![]];}return db[_0xabe2('0x8e')][_0xabe2('0x59')]({'UserId':_0xb0511f[_0xabe2('0x5c')]['id'],'ContactId':_0x3ead3f['id'],'OpenchannelAccountId':_0xb25626['id'],'lastMsgDirection':_0xabe2('0xc1'),'firstMsgDirection':_0xabe2('0xc1'),'Messages':[_[_0xabe2('0x4c')](_0xb0511f['body'],{'read':![],'body':_0xb0511f[_0xabe2('0x5a')]['body'],'OpenchannelAccountId':_0xb25626['id'],'UserId':_0xb0511f[_0xabe2('0x5c')]['id'],'ContactId':_0x3ead3f['id']})]},{'include':[{'model':db[_0xabe2('0x99')],'as':_0xabe2('0xc2')}]})['then'](function(_0x306fdd){return[_0x306fdd,!![]];});});}})['spread'](function(_0x2c03c8,_0x55dd02){if(_0x55dd02){return _0x2c03c8;}return db[_0xabe2('0x99')][_0xabe2('0x59')](_[_0xabe2('0x4c')](_0xb0511f[_0xabe2('0x5a')],{'read':![],'body':_0xb0511f['body'][_0xabe2('0x5a')],'OpenchannelAccountId':_0xb25626['id'],'OpenchannelInteractionId':_0x2c03c8['id'],'UserId':_0xb0511f[_0xabe2('0x5c')]['id'],'ContactId':_0x3ead3f['id']}))['then'](function(_0xe4fd94){_0x2c03c8[_0xabe2('0xc3')][_0xabe2('0xc2')]=[];_0x2c03c8[_0xabe2('0xc3')][_0xabe2('0xc2')][_0xabe2('0x96')](_0xe4fd94[_0xabe2('0xc3')]);return _0x2c03c8;});});}})[_0xabe2('0x21')](respondWithResult(_0x806225,null))[_0xabe2('0x2a')](handleError(_0x806225,null));}; \ No newline at end of file +var _0x2f74=['intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','filters','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','body','find','params','describe','OpenchannelAccountId','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','account','applications','list','priority','asc','Applications','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','push','close','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','send','Contacts','user','out','dataValues','Messages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','destroy','OpenchannelAccounts','stack','name','Pause','OpenchannelAccount','rawAttributes','type','model','map','keys','query'];(function(_0x9a9d33,_0x3db629){var _0x1996fd=function(_0x448b53){while(--_0x448b53){_0x9a9d33['push'](_0x9a9d33['shift']());}};_0x1996fd(++_0x3db629);}(_0x2f74,0x7b));var _0x42f7=function(_0xb93836,_0x2e7941){_0xb93836=_0xb93836-0x0;var _0x2b3e5b=_0x2f74[_0xb93836];return _0x2b3e5b;};'use strict';var emlformat=require(_0x42f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42f7('0x1'));var jsonpatch=require(_0x42f7('0x2'));var rp=require(_0x42f7('0x3'));var moment=require(_0x42f7('0x4'));var BPromise=require(_0x42f7('0x5'));var Mustache=require(_0x42f7('0x6'));var util=require(_0x42f7('0x7'));var path=require(_0x42f7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42f7('0x9'));var _=require(_0x42f7('0xa'));var squel=require(_0x42f7('0xb'));var crypto=require(_0x42f7('0xc'));var jsforce=require(_0x42f7('0xd'));var deskjs=require(_0x42f7('0xe'));var toCsv=require(_0x42f7('0xf'));var querystring=require(_0x42f7('0x10'));var Papa=require('papaparse');var Redis=require(_0x42f7('0x11'));var authService=require(_0x42f7('0x12'));var qs=require(_0x42f7('0x13'));var as=require(_0x42f7('0x14'));var hardwareService=require(_0x42f7('0x15'));var logger=require(_0x42f7('0x16'))('api');var utils=require(_0x42f7('0x17'));var config=require(_0x42f7('0x18'));var licenseUtil=require(_0x42f7('0x19'));var db=require(_0x42f7('0x1a'))['db'];config[_0x42f7('0x1b')]=_[_0x42f7('0x1c')](config[_0x42f7('0x1b')],{'host':_0x42f7('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x42f7('0x1e'))[_0x42f7('0x1f')](socket);var jayson=require(_0x42f7('0x20'));var client=jayson[_0x42f7('0x21')][_0x42f7('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x42f7('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4d7944,_0x3e7fd8,_0x225a6b,_0x16d842){return new BPromise(function(_0x19eff3,_0x423876){var _0xa1bb54=_0x16d842||client;return _0xa1bb54[_0x42f7('0x23')](_0x4d7944,_0x225a6b)['then'](function(_0x3fc38d){logger[_0x42f7('0x24')](_0x42f7('0x25'),_0x3e7fd8,_0x42f7('0x26'));logger[_0x42f7('0x27')](_0x42f7('0x28'),_0x3e7fd8,'request\x20sent',JSON[_0x42f7('0x29')](_0x3fc38d));if(_0x3fc38d['error']){if(_0x3fc38d[_0x42f7('0x2a')]['code']===0x1f4){logger[_0x42f7('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e7fd8,_0x3fc38d['error']['message']);return _0x423876(_0x3fc38d[_0x42f7('0x2a')][_0x42f7('0x2b')]);}logger[_0x42f7('0x2a')](_0x42f7('0x25'),_0x3e7fd8,_0x3fc38d[_0x42f7('0x2a')][_0x42f7('0x2b')]);return _0x19eff3(_0x3fc38d[_0x42f7('0x2a')][_0x42f7('0x2b')]);}else{logger[_0x42f7('0x24')](_0x42f7('0x25'),_0x3e7fd8,_0x42f7('0x26'));_0x19eff3(_0x3fc38d[_0x42f7('0x2c')][_0x42f7('0x2b')]);}})[_0x42f7('0x2d')](function(_0x553531){logger['error'](_0x42f7('0x25'),_0x3e7fd8,_0x553531);_0x423876(_0x553531);});});}function respondWithStatusCode(_0x35f941,_0x445e03){_0x445e03=_0x445e03||0xcc;return function(_0x3bb6bc){if(_0x3bb6bc){return _0x35f941[_0x42f7('0x2e')](_0x445e03);}return _0x35f941[_0x42f7('0x2f')](_0x445e03)[_0x42f7('0x30')]();};}function respondWithResult(_0x64859,_0xe53027){_0xe53027=_0xe53027||0xc8;return function(_0x1118ab){if(_0x1118ab){return _0x64859['status'](_0xe53027)['json'](_0x1118ab);}};}function respondWithFilteredResult(_0x4022dd,_0x1b0977){return function(_0x1c4dc9){if(_0x1c4dc9){var _0x4d7137=typeof _0x1b0977[_0x42f7('0x31')]===_0x42f7('0x32')&&typeof _0x1b0977['limit']==='undefined';var _0x36e6d4=_0x1c4dc9[_0x42f7('0x33')];var _0x210054=_0x4d7137?0x0:_0x1b0977[_0x42f7('0x31')];var _0x1e245c=_0x4d7137?_0x1c4dc9[_0x42f7('0x33')]:_0x1b0977[_0x42f7('0x31')]+_0x1b0977[_0x42f7('0x34')];var _0x3322d2;if(_0x1e245c>=_0x36e6d4){_0x1e245c=_0x36e6d4;_0x3322d2=0xc8;}else{_0x3322d2=0xce;}_0x4022dd['status'](_0x3322d2);return _0x4022dd[_0x42f7('0x35')](_0x42f7('0x36'),_0x210054+'-'+_0x1e245c+'/'+_0x36e6d4)[_0x42f7('0x37')](_0x1c4dc9);}return null;};}function patchUpdates(_0xd26ccf){return function(_0x1ac7e0){try{jsonpatch['apply'](_0x1ac7e0,_0xd26ccf,!![]);}catch(_0x27db26){return BPromise[_0x42f7('0x38')](_0x27db26);}return _0x1ac7e0[_0x42f7('0x39')]();};}function saveUpdates(_0x310872,_0x505310){return function(_0x3ef7a8){if(_0x3ef7a8){return _0x3ef7a8['update'](_0x310872)[_0x42f7('0x3a')](function(_0x2bb14b){return _0x2bb14b;});}return null;};}function removeEntity(_0xec377d,_0x27518d){return function(_0x14cae3){if(_0x14cae3){return _0x14cae3[_0x42f7('0x3b')]()[_0x42f7('0x3a')](function(){var _0x4e506f=_0x14cae3['get']({'plain':!![]});var _0x2ce93f=_0x42f7('0x3c');return db['UserProfileResource'][_0x42f7('0x3b')]({'where':{'type':_0x2ce93f,'resourceId':_0x4e506f['id']}})['then'](function(){return _0x14cae3;});})[_0x42f7('0x3a')](function(){_0xec377d[_0x42f7('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb1cf,_0x48b79e){return function(_0x43a108){if(!_0x43a108){_0x4bb1cf['sendStatus'](0x194);}return _0x43a108;};}function handleError(_0xc3a6a1,_0x19d067){_0x19d067=_0x19d067||0x1f4;return function(_0x44ec4b){logger[_0x42f7('0x2a')](_0x44ec4b[_0x42f7('0x3d')]);if(_0x44ec4b['name']){delete _0x44ec4b[_0x42f7('0x3e')];}_0xc3a6a1[_0x42f7('0x2f')](_0x19d067)['send'](_0x44ec4b);};}exports['index']=function(_0x151c80,_0x164553){var _0x33bf56={'include':[{'model':db[_0x42f7('0x3f')],'as':'mandatoryDispositionPause'}]},_0x2204a1={},_0xaa39b4={'count':0x0,'rows':[]};var _0x3037f8=_['map'](db[_0x42f7('0x40')][_0x42f7('0x41')],function(_0x21bca2){return{'name':_0x21bca2['fieldName'],'type':_0x21bca2[_0x42f7('0x42')]['key']};});_0x2204a1[_0x42f7('0x43')]=_[_0x42f7('0x44')](_0x3037f8,_0x42f7('0x3e'));_0x2204a1['query']=_[_0x42f7('0x45')](_0x151c80[_0x42f7('0x46')]);_0x2204a1['filters']=_[_0x42f7('0x47')](_0x2204a1['model'],_0x2204a1[_0x42f7('0x46')]);_0x33bf56['attributes']=_[_0x42f7('0x47')](_0x2204a1[_0x42f7('0x43')],qs['fields'](_0x151c80[_0x42f7('0x46')][_0x42f7('0x48')]));_0x33bf56['attributes']=_0x33bf56[_0x42f7('0x49')][_0x42f7('0x4a')]?_0x33bf56[_0x42f7('0x49')]:_0x2204a1[_0x42f7('0x43')];if(!_0x151c80[_0x42f7('0x46')]['hasOwnProperty'](_0x42f7('0x4b'))){_0x33bf56['limit']=qs[_0x42f7('0x34')](_0x151c80[_0x42f7('0x46')][_0x42f7('0x34')]);_0x33bf56[_0x42f7('0x31')]=qs['offset'](_0x151c80[_0x42f7('0x46')][_0x42f7('0x31')]);}_0x33bf56[_0x42f7('0x4c')]=qs[_0x42f7('0x4d')](_0x151c80[_0x42f7('0x46')][_0x42f7('0x4d')]);_0x33bf56['where']=qs['filters'](_[_0x42f7('0x4e')](_0x151c80[_0x42f7('0x46')],_0x2204a1['filters']),_0x3037f8);if(_0x151c80[_0x42f7('0x46')][_0x42f7('0x4f')]){_0x33bf56[_0x42f7('0x50')]=_[_0x42f7('0x51')](_0x33bf56[_0x42f7('0x50')],{'$or':_[_0x42f7('0x44')](_0x3037f8,function(_0x30e81f){if(_0x30e81f[_0x42f7('0x42')]!==_0x42f7('0x52')){var _0x5334fe={};_0x5334fe[_0x30e81f[_0x42f7('0x3e')]]={'$like':'%'+_0x151c80[_0x42f7('0x46')][_0x42f7('0x4f')]+'%'};return _0x5334fe;}})});}_0x33bf56=_[_0x42f7('0x51')]({},_0x33bf56,_0x151c80[_0x42f7('0x53')]);var _0x211cba={'where':_0x33bf56[_0x42f7('0x50')]};return db[_0x42f7('0x40')]['count'](_0x211cba)[_0x42f7('0x3a')](function(_0x20da5f){_0xaa39b4[_0x42f7('0x33')]=_0x20da5f;if(_0x151c80[_0x42f7('0x46')][_0x42f7('0x54')]){_0x33bf56[_0x42f7('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x42f7('0x56')](_0x33bf56);})[_0x42f7('0x3a')](function(_0x4e61a9){_0xaa39b4[_0x42f7('0x57')]=_0x4e61a9;return _0xaa39b4;})['then'](respondWithFilteredResult(_0x164553,_0x33bf56))[_0x42f7('0x2d')](handleError(_0x164553,null));};exports[_0x42f7('0x58')]=function(_0x1a3e1f,_0x5df782){var _0x27f709={'raw':![],'where':{'id':_0x1a3e1f['params']['id']},'include':[{'model':db[_0x42f7('0x3f')],'as':_0x42f7('0x59')}]},_0x291605={};_0x291605[_0x42f7('0x43')]=_[_0x42f7('0x45')](db[_0x42f7('0x40')][_0x42f7('0x41')]);_0x291605[_0x42f7('0x46')]=_[_0x42f7('0x45')](_0x1a3e1f[_0x42f7('0x46')]);_0x291605[_0x42f7('0x5a')]=_[_0x42f7('0x47')](_0x291605[_0x42f7('0x43')],_0x291605[_0x42f7('0x46')]);_0x27f709['attributes']=_[_0x42f7('0x47')](_0x291605['model'],qs[_0x42f7('0x48')](_0x1a3e1f[_0x42f7('0x46')][_0x42f7('0x48')]));_0x27f709[_0x42f7('0x49')]=_0x27f709[_0x42f7('0x49')][_0x42f7('0x4a')]?_0x27f709[_0x42f7('0x49')]:_0x291605[_0x42f7('0x43')];if(_0x1a3e1f['query'][_0x42f7('0x54')]){_0x27f709[_0x42f7('0x55')]=[{'all':!![]}];}_0x27f709=_['merge']({},_0x27f709,_0x1a3e1f['options']);return db[_0x42f7('0x40')]['find'](_0x27f709)['then'](handleEntityNotFound(_0x5df782,null))[_0x42f7('0x3a')](respondWithResult(_0x5df782,null))[_0x42f7('0x2d')](handleError(_0x5df782,null));};exports['create']=function(_0x4c7a0e,_0x3c9828){return db['OpenchannelAccount'][_0x42f7('0x5b')](_0x4c7a0e['body'],{})['then'](function(_0x460c69){var _0x3230e9=_0x4c7a0e['user']['get']({'plain':!![]});if(!_0x3230e9)throw new Error(_0x42f7('0x5c'));if(_0x3230e9[_0x42f7('0x5d')]==='user'){var _0x475ab0=_0x460c69[_0x42f7('0x5e')]({'plain':!![]});var _0x329152=_0x42f7('0x3c');return db[_0x42f7('0x5f')]['find']({'where':{'name':_0x329152,'userProfileId':_0x3230e9[_0x42f7('0x60')]},'raw':!![]})['then'](function(_0x3b28d5){if(_0x3b28d5&&_0x3b28d5[_0x42f7('0x61')]===0x0){return db[_0x42f7('0x62')][_0x42f7('0x5b')]({'name':_0x475ab0[_0x42f7('0x3e')],'resourceId':_0x475ab0['id'],'type':_0x3b28d5[_0x42f7('0x3e')],'sectionId':_0x3b28d5['id']},{})[_0x42f7('0x3a')](function(){return _0x460c69;});}else{return _0x460c69;}})['catch'](function(_0x419be3){logger[_0x42f7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x419be3);throw _0x419be3;});}return _0x460c69;})[_0x42f7('0x3a')](respondWithResult(_0x3c9828,0xc9))[_0x42f7('0x2d')](handleError(_0x3c9828,null));};exports[_0x42f7('0x63')]=function(_0x264a49,_0x49e9b3){if(_0x264a49[_0x42f7('0x64')]['id']){delete _0x264a49['body']['id'];}return db[_0x42f7('0x40')][_0x42f7('0x65')]({'where':{'id':_0x264a49['params']['id']},'include':[{'model':db[_0x42f7('0x3f')],'as':_0x42f7('0x59')}]})[_0x42f7('0x3a')](handleEntityNotFound(_0x49e9b3,null))[_0x42f7('0x3a')](saveUpdates(_0x264a49[_0x42f7('0x64')],null))[_0x42f7('0x3a')](respondWithResult(_0x49e9b3,null))[_0x42f7('0x2d')](handleError(_0x49e9b3,null));};exports['destroy']=function(_0x13d5be,_0x998bb2){return db[_0x42f7('0x40')]['find']({'where':{'id':_0x13d5be[_0x42f7('0x66')]['id']}})['then'](handleEntityNotFound(_0x998bb2,null))[_0x42f7('0x3a')](removeEntity(_0x998bb2,null))['catch'](handleError(_0x998bb2,null));};exports['describe']=function(_0x4a9786,_0x2fd4bd){return db['OpenchannelAccount'][_0x42f7('0x67')]()[_0x42f7('0x3a')](respondWithResult(_0x2fd4bd,null))['catch'](handleError(_0x2fd4bd,null));};exports['addDisposition']=function(_0x1baaba,_0x53d9fd,_0x114c8b){if(_0x1baaba['body']['id']){delete _0x1baaba[_0x42f7('0x64')]['id'];}return db['OpenchannelAccount'][_0x42f7('0x65')]({'where':{'id':_0x1baaba[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x53d9fd,null))[_0x42f7('0x3a')](function(_0x406720){if(_0x406720){_0x1baaba[_0x42f7('0x64')][_0x42f7('0x68')]=_0x406720['id'];return db['Disposition'][_0x42f7('0x5b')](_0x1baaba[_0x42f7('0x64')]);}})[_0x42f7('0x3a')](respondWithResult(_0x53d9fd,null))[_0x42f7('0x2d')](handleError(_0x53d9fd,null));};exports['getDispositions']=function(_0x2ac4b8,_0xc2ca02,_0x3c98a3){var _0x5dadd6={'raw':![],'where':{}};var _0x285fa8={};var _0x328033={'count':0x0,'rows':[]};return db[_0x42f7('0x40')]['findOne']({'where':{'id':_0x2ac4b8[_0x42f7('0x66')]['id']}})['then'](handleEntityNotFound(_0xc2ca02,null))[_0x42f7('0x3a')](function(_0x390f27){if(_0x390f27){_0x285fa8[_0x42f7('0x43')]=_[_0x42f7('0x45')](db[_0x42f7('0x69')][_0x42f7('0x41')]);_0x285fa8[_0x42f7('0x46')]=_[_0x42f7('0x45')](_0x2ac4b8[_0x42f7('0x46')]);_0x285fa8['filters']=_['intersection'](_0x285fa8[_0x42f7('0x43')],_0x285fa8[_0x42f7('0x46')]);_0x5dadd6['attributes']=_[_0x42f7('0x47')](_0x285fa8['model'],qs[_0x42f7('0x48')](_0x2ac4b8['query'][_0x42f7('0x48')]));_0x5dadd6[_0x42f7('0x49')]=_0x5dadd6['attributes']['length']?_0x5dadd6['attributes']:_0x285fa8[_0x42f7('0x43')];if(!_0x2ac4b8['query'][_0x42f7('0x6a')](_0x42f7('0x4b'))){_0x5dadd6[_0x42f7('0x34')]=qs[_0x42f7('0x34')](_0x2ac4b8[_0x42f7('0x46')][_0x42f7('0x34')]);_0x5dadd6[_0x42f7('0x31')]=qs[_0x42f7('0x31')](_0x2ac4b8['query'][_0x42f7('0x31')]);}_0x5dadd6[_0x42f7('0x4c')]=qs[_0x42f7('0x4d')](_0x2ac4b8[_0x42f7('0x46')]['sort']);_0x5dadd6[_0x42f7('0x50')]=qs[_0x42f7('0x5a')](_['pick'](_0x2ac4b8[_0x42f7('0x46')],_0x285fa8[_0x42f7('0x5a')]));_0x5dadd6[_0x42f7('0x50')]['OpenchannelAccountId']=_0x390f27['id'];if(_0x2ac4b8[_0x42f7('0x46')][_0x42f7('0x4f')]){_0x5dadd6[_0x42f7('0x50')]=_[_0x42f7('0x51')](_0x5dadd6[_0x42f7('0x50')],{'$or':_[_0x42f7('0x44')](_0x5dadd6[_0x42f7('0x49')],function(_0x3e3b1e){var _0x28c543={};_0x28c543[_0x3e3b1e]={'$like':'%'+_0x2ac4b8['query'][_0x42f7('0x4f')]+'%'};return _0x28c543;})});}_0x5dadd6=_['merge']({},_0x5dadd6,_0x2ac4b8[_0x42f7('0x53')]);return db[_0x42f7('0x69')][_0x42f7('0x33')]({'where':_0x5dadd6[_0x42f7('0x50')]})[_0x42f7('0x3a')](function(_0x17c556){_0x328033[_0x42f7('0x33')]=_0x17c556;if(_0x2ac4b8[_0x42f7('0x46')][_0x42f7('0x54')]){_0x5dadd6['include']=[{'all':!![]}];}return db[_0x42f7('0x69')][_0x42f7('0x56')](_0x5dadd6);})[_0x42f7('0x3a')](function(_0x3b43f7){_0x328033[_0x42f7('0x57')]=_0x3b43f7;return _0x328033;});}})['then'](respondWithFilteredResult(_0xc2ca02,_0x5dadd6))[_0x42f7('0x2d')](handleError(_0xc2ca02,null));};exports[_0x42f7('0x6b')]=function(_0x2f0beb,_0x786c4c,_0x5c81d6){return db[_0x42f7('0x40')][_0x42f7('0x65')]({'where':{'id':_0x2f0beb[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x786c4c,null))[_0x42f7('0x3a')](function(_0x57b632){if(_0x57b632){return _0x57b632[_0x42f7('0x6b')](_0x2f0beb[_0x42f7('0x46')][_0x42f7('0x6c')]);}})[_0x42f7('0x3a')](respondWithStatusCode(_0x786c4c,null))[_0x42f7('0x2d')](handleError(_0x786c4c,null));};exports[_0x42f7('0x6d')]=function(_0x2566a7,_0x2ad980,_0x697c8a){if(_0x2566a7['body']['id']){delete _0x2566a7[_0x42f7('0x64')]['id'];}return db['OpenchannelAccount'][_0x42f7('0x65')]({'where':{'id':_0x2566a7[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x2ad980,null))[_0x42f7('0x3a')](function(_0x163925){if(_0x163925){_0x2566a7[_0x42f7('0x64')][_0x42f7('0x68')]=_0x163925['id'];return db[_0x42f7('0x6e')][_0x42f7('0x5b')](_0x2566a7[_0x42f7('0x64')]);}})[_0x42f7('0x3a')](respondWithResult(_0x2ad980,null))[_0x42f7('0x2d')](handleError(_0x2ad980,null));};exports[_0x42f7('0x6f')]=function(_0x3d0676,_0x170e25,_0x3f30f8){var _0x548834={'raw':![],'where':{}};var _0x4e8408={};var _0x115903={'count':0x0,'rows':[]};return db[_0x42f7('0x40')][_0x42f7('0x70')]({'where':{'id':_0x3d0676[_0x42f7('0x66')]['id']}})['then'](handleEntityNotFound(_0x170e25,null))['then'](function(_0x2264d5){if(_0x2264d5){_0x4e8408[_0x42f7('0x43')]=_[_0x42f7('0x45')](db[_0x42f7('0x6e')]['rawAttributes']);_0x4e8408[_0x42f7('0x46')]=_[_0x42f7('0x45')](_0x3d0676[_0x42f7('0x46')]);_0x4e8408['filters']=_['intersection'](_0x4e8408[_0x42f7('0x43')],_0x4e8408[_0x42f7('0x46')]);_0x548834[_0x42f7('0x49')]=_['intersection'](_0x4e8408[_0x42f7('0x43')],qs['fields'](_0x3d0676['query'][_0x42f7('0x48')]));_0x548834[_0x42f7('0x49')]=_0x548834['attributes']['length']?_0x548834['attributes']:_0x4e8408['model'];if(!_0x3d0676[_0x42f7('0x46')][_0x42f7('0x6a')](_0x42f7('0x4b'))){_0x548834['limit']=qs[_0x42f7('0x34')](_0x3d0676[_0x42f7('0x46')]['limit']);_0x548834[_0x42f7('0x31')]=qs[_0x42f7('0x31')](_0x3d0676[_0x42f7('0x46')][_0x42f7('0x31')]);}_0x548834['order']=qs[_0x42f7('0x4d')](_0x3d0676[_0x42f7('0x46')]['sort']);_0x548834[_0x42f7('0x50')]=qs[_0x42f7('0x5a')](_[_0x42f7('0x4e')](_0x3d0676[_0x42f7('0x46')],_0x4e8408['filters']));_0x548834['where'][_0x42f7('0x68')]=_0x2264d5['id'];if(_0x3d0676[_0x42f7('0x46')][_0x42f7('0x4f')]){_0x548834[_0x42f7('0x50')]=_['merge'](_0x548834[_0x42f7('0x50')],{'$or':_[_0x42f7('0x44')](_0x548834[_0x42f7('0x49')],function(_0x4ab205){var _0x594f4f={};_0x594f4f[_0x4ab205]={'$like':'%'+_0x3d0676[_0x42f7('0x46')][_0x42f7('0x4f')]+'%'};return _0x594f4f;})});}_0x548834=_['merge']({},_0x548834,_0x3d0676[_0x42f7('0x53')]);return db['CannedAnswer'][_0x42f7('0x33')]({'where':_0x548834[_0x42f7('0x50')]})['then'](function(_0x2cf17d){_0x115903[_0x42f7('0x33')]=_0x2cf17d;if(_0x3d0676[_0x42f7('0x46')]['includeAll']){_0x548834[_0x42f7('0x55')]=[{'all':!![]}];}return db[_0x42f7('0x6e')][_0x42f7('0x56')](_0x548834);})[_0x42f7('0x3a')](function(_0x27d8a1){_0x115903['rows']=_0x27d8a1;return _0x115903;});}})[_0x42f7('0x3a')](respondWithFilteredResult(_0x170e25,_0x548834))[_0x42f7('0x2d')](handleError(_0x170e25,null));};exports['removeAnswers']=function(_0xf5758d,_0x4e3ac8,_0x3e4c88){return db[_0x42f7('0x40')][_0x42f7('0x65')]({'where':{'id':_0xf5758d[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x4e3ac8,null))[_0x42f7('0x3a')](function(_0xeed92a){if(_0xeed92a){return _0xeed92a['removeAnswers'](_0xf5758d[_0x42f7('0x46')][_0x42f7('0x6c')]);}})[_0x42f7('0x3a')](respondWithStatusCode(_0x4e3ac8,null))[_0x42f7('0x2d')](handleError(_0x4e3ac8,null));};exports[_0x42f7('0x71')]=function(_0x2b8ea2,_0x3a3144,_0x407421){var _0x1475e9={'body':_0x2b8ea2['body'],'channel':_0x42f7('0x72')};var _0x59546e=[];var _0x56c1c5=[];var _0x518ab8={};var _0x197947=![];return db[_0x42f7('0x73')][_0x42f7('0x67')]()['then'](function(_0x206367){if(!_0x206367){throw new db[(_0x42f7('0x74'))]['ValidationError'](_0x42f7('0x75'));}_0x59546e=_['difference'](_['keys'](_0x206367),[_0x42f7('0x76'),'updatedAt']);_0x56c1c5=_[_0x42f7('0x77')](_[_0x42f7('0x45')](_0x206367),[_0x42f7('0x76'),_0x42f7('0x78'),_0x42f7('0x79'),_0x42f7('0x7a')]);if(_0x2b8ea2['body']['id']){delete _0x2b8ea2['body']['id'];}if(_[_0x42f7('0x7b')](_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x7c')])){throw new db['Sequelize'][(_0x42f7('0x7d'))]('from\x20is\x20mandatory');}if(_[_0x42f7('0x7b')](_0x2b8ea2['body'][_0x42f7('0x64')])||_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x64')]===''){throw new db['Sequelize'][(_0x42f7('0x7d'))](_0x42f7('0x7e'));}if(_[_0x42f7('0x7b')](_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x7f')])){throw new db[(_0x42f7('0x74'))][(_0x42f7('0x7d'))](_0x42f7('0x80')+_0x56c1c5);}if(!_[_0x42f7('0x81')](_0x56c1c5,_0x2b8ea2['body'][_0x42f7('0x7f')])){throw new db[(_0x42f7('0x74'))][(_0x42f7('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x56c1c5);}_0x518ab8[_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x7f')]]=_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x7c')];})[_0x42f7('0x3a')](function(){return db[_0x42f7('0x40')][_0x42f7('0x65')]({'where':{'id':_0x2b8ea2[_0x42f7('0x66')]['id']},'include':[{'model':db[_0x42f7('0x82')],'as':_0x42f7('0x83'),'include':[{'model':db[_0x42f7('0x73')],'as':'Contacts','where':_0x518ab8,'limit':0x1,'order':[[_0x42f7('0x78'),_0x42f7('0x84')]]}]},{'model':db[_0x42f7('0x85')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x3a3144,null))[_0x42f7('0x3a')](function(_0x4426e1){if(_0x4426e1&&_0x4426e1[_0x42f7('0x83')]){_0x1475e9[_0x42f7('0x86')]=_0x4426e1;_0x1475e9[_0x42f7('0x87')]=_0x4426e1['Applications'];_0x1475e9[_0x42f7('0x88')]=_0x4426e1[_0x42f7('0x83')];_0x1475e9[_0x42f7('0x87')]=_['orderBy'](_0x1475e9[_0x42f7('0x87')],[_0x42f7('0x89')],[_0x42f7('0x8a')]);if(_0x1475e9[_0x42f7('0x86')][_0x42f7('0x8b')]){delete _0x1475e9[_0x42f7('0x86')][_0x42f7('0x8b')];}if(_0x1475e9['account'][_0x42f7('0x83')]&&_0x1475e9[_0x42f7('0x86')][_0x42f7('0x83')]['Contacts'][_0x42f7('0x4a')]){return _0x1475e9[_0x42f7('0x86')]['List']['Contacts'][0x0];}var _0x534dcd=_[_0x42f7('0x1c')](_0x2b8ea2['body'],{'firstName':_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x7c')],'ListId':_0x4426e1[_0x42f7('0x7a')]});_0x534dcd[_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x7f')]]=_0x2b8ea2['body']['from'];return db[_0x42f7('0x73')][_0x42f7('0x5b')](_0x534dcd,{'fields':_0x59546e,'raw':!![]});}})[_0x42f7('0x3a')](handleEntityNotFound(_0x3a3144,null))['then'](function(_0x4b8360){_0x1475e9['contact']=_0x4b8360;if(_0x4b8360){var _0x1fd945={'ContactId':_0x4b8360['id'],'OpenchannelAccountId':_0x2b8ea2[_0x42f7('0x66')]['id'],'from':(_0x4b8360[_0x42f7('0x8c')]||'')+'\x20'+(_0x4b8360[_0x42f7('0x8d')]||'')};var _0x4339fc={'OpenchannelAccountId':_0x2b8ea2['params']['id'],'closed':![]};if(_0x2b8ea2[_0x42f7('0x64')]['threadId']){_0x4339fc[_0x42f7('0x8e')]=_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x8e')];return db['OpenchannelInteraction'][_0x42f7('0x65')]({'where':_0x4339fc})[_0x42f7('0x3a')](function(_0x202980){if(_0x202980){return[_0x202980,![]];}_0x1fd945[_0x42f7('0x8e')]=_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x8e')];_0x1fd945[_0x42f7('0x8f')]=_0x2b8ea2[_0x42f7('0x64')]['externalUrl'];return db[_0x42f7('0x90')]['create'](_0x1fd945)[_0x42f7('0x3a')](function(_0x1500d3){return[_0x1500d3,!![]];});});}else{_0x4339fc[_0x42f7('0x8e')]=null;}_0x4339fc[_0x42f7('0x91')]=_0x4b8360['id'];return db['OpenchannelInteraction']['find']({'where':_0x4339fc})[_0x42f7('0x3a')](function(_0xa13d6b){if(_0xa13d6b){return[_0xa13d6b,![]];}return db[_0x42f7('0x90')][_0x42f7('0x5b')](_0x1fd945)[_0x42f7('0x3a')](function(_0x3b3ca7){return[_0x3b3ca7,!![]];});});}})[_0x42f7('0x92')](function(_0xf033eb,_0x53c0f9){if(_0xf033eb){_0x197947=_0x53c0f9;if(!_0x53c0f9){var _0x2a5d2c={'from':(_0x1475e9[_0x42f7('0x93')][_0x42f7('0x8c')]||'')+'\x20'+(_0x1475e9['contact']['lastName']||'')};if(_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x8e')]&&_0x2b8ea2['body'][_0x42f7('0x94')]&&_0x2b8ea2[_0x42f7('0x64')]['threadId']!=_0x2b8ea2['body'][_0x42f7('0x94')]){_0x2a5d2c[_0x42f7('0x8e')]=_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x94')];}return _0xf033eb[_0x42f7('0x63')](_0x2a5d2c);}else{return _0xf033eb;}}})[_0x42f7('0x3a')](function(_0x41ab2f){_0x1475e9[_0x42f7('0x95')]=_0x41ab2f[_0x42f7('0x5e')]({'plain':!![]});_0x1475e9[_0x42f7('0x95')][_0x42f7('0x96')]=_0x197947;if(_0x1475e9[_0x42f7('0x95')][_0x42f7('0x96')]){if(_0x1475e9['account']['autoclose']){_0x1475e9[_0x42f7('0x87')][_0x42f7('0x97')]({'id':0x0,'priority':_0x1475e9[_0x42f7('0x87')]['length']+0x1,'app':_0x42f7('0x98'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x42f7('0x99')][_0x42f7('0x5b')]({'body':_0x2b8ea2[_0x42f7('0x64')]['body'],'OpenchannelAccountId':_0x2b8ea2[_0x42f7('0x66')]['id'],'OpenchannelInteractionId':_0x41ab2f['id'],'direction':'in','ContactId':_0x1475e9[_0x42f7('0x93')]['id'],'AttachmentId':_0x2b8ea2[_0x42f7('0x64')][_0x42f7('0x9a')]});})[_0x42f7('0x3a')](function(_0x2e8fa1){_0x1475e9[_0x42f7('0x2b')]=_0x2e8fa1;if(!_0x1475e9[_0x42f7('0x95')][_0x42f7('0x9b')])return;return db[_0x42f7('0x9c')][_0x42f7('0x65')]({'attributes':['id',_0x42f7('0x3e')],'where':{'id':_0x1475e9[_0x42f7('0x95')][_0x42f7('0x9b')]}});})[_0x42f7('0x3a')](function(_0x3332ef){if(_0x3332ef){_0x1475e9[_0x42f7('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0x42f7('0x9d'),'appdata':_0x3332ef[_0x42f7('0x3e')]+','+(_0x1475e9[_0x42f7('0x86')][_0x42f7('0x9e')]||0xa),'interval':'*,*,*,*'});}if(!_0x1475e9['interaction']['queueId'])return;return db[_0x42f7('0x9f')][_0x42f7('0x65')]({'attributes':['id','name'],'where':{'id':_0x1475e9[_0x42f7('0x95')][_0x42f7('0xa0')]}});})[_0x42f7('0x3a')](function(_0x2c3c7c){if(_0x2c3c7c){_0x1475e9[_0x42f7('0x87')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2c3c7c[_0x42f7('0x3e')]+','+(_0x1475e9['account'][_0x42f7('0xa1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x42f7('0xa2'),_0x42f7('0xa3'),_0x1475e9);})[_0x42f7('0x3a')](function(_0x171de4){respondWithRpcPromise('EventManager',_0x42f7('0xa4'),{'event':_0x42f7('0x71'),'message':_0x171de4},client9002);return _0x171de4;})[_0x42f7('0x3a')](respondWithResult(_0x3a3144,null))[_0x42f7('0x2d')](handleError(_0x3a3144,null));};exports[_0x42f7('0xa5')]=function(_0x56f5cd,_0x3cb9bc){var _0x32c99d=_0x56f5cd[_0x42f7('0x66')]['id'];var _0x5eeeb4=_0x56f5cd['body'];var _0x5498be=0xc8;var _0x5b31c4=null;return db[_0x42f7('0xa6')][_0x42f7('0xa7')]({'isolationLevel':db[_0x42f7('0xa6')][_0x42f7('0xa8')][_0x42f7('0xa9')][_0x42f7('0xaa')]},function(_0x16ec39){return db[_0x42f7('0x40')]['findOne']({'where':{'id':_0x32c99d},'transaction':_0x16ec39})[_0x42f7('0x3a')](function(_0x1d35c1){if(_0x1d35c1){return db[_0x42f7('0x85')][_0x42f7('0x3b')]({'where':{'OpenchannelAccountId':_0x32c99d},'transaction':_0x16ec39})['then'](function(){var _0x22037c=_['map'](_0x5eeeb4,function(_0x25490b){_0x25490b[_0x42f7('0x68')]=_0x32c99d;return _0x25490b;});return db['OpenchannelApplication'][_0x42f7('0xab')](_0x22037c,{'transaction':_0x16ec39});});}else{_0x5498be=0x194;_0x5b31c4=[];}});})[_0x42f7('0x3a')](function(){if(_0x5498be!==0x194){return db[_0x42f7('0x85')][_0x42f7('0xac')]({'where':{'OpenchannelAccountId':_0x32c99d},'order':_0x42f7('0x89')})[_0x42f7('0x3a')](function(_0x559155){_0x5b31c4=_0x559155;});}})[_0x42f7('0x2d')](function(_0x3eb494){_0x5498be=0x1f4;logger[_0x42f7('0x2a')](_0x3eb494['stack']);if(_0x3eb494[_0x42f7('0x3e')]){delete _0x3eb494[_0x42f7('0x3e')];}_0x5b31c4=_0x3eb494;})['finally'](function(){if(_0x5b31c4===null){_0x3cb9bc[_0x42f7('0x2e')](_0x5498be);}else{if(_0x5498be===0x1f4){_0x3cb9bc['status'](_0x5498be)['send'](_0x5b31c4);}else{_0x3cb9bc['status'](_0x5498be)[_0x42f7('0x37')](_0x5b31c4);}}});};exports['getApplications']=function(_0x309431,_0x54e689,_0x1d2d7d){var _0x58451a={};var _0x474053={};var _0x2a1b51;var _0x4858a6;return db[_0x42f7('0x40')][_0x42f7('0x70')]({'where':{'id':_0x309431[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x54e689,null))[_0x42f7('0x3a')](function(_0x57fd76){if(_0x57fd76){_0x2a1b51=_0x57fd76;_0x474053[_0x42f7('0x43')]=_[_0x42f7('0x45')](db['OpenchannelApplication'][_0x42f7('0x41')]);_0x474053['query']=_[_0x42f7('0x45')](_0x309431['query']);_0x474053[_0x42f7('0x5a')]=_[_0x42f7('0x47')](_0x474053[_0x42f7('0x43')],_0x474053['query']);_0x58451a[_0x42f7('0x49')]=_[_0x42f7('0x47')](_0x474053[_0x42f7('0x43')],qs['fields'](_0x309431['query'][_0x42f7('0x48')]));_0x58451a['attributes']=_0x58451a[_0x42f7('0x49')][_0x42f7('0x4a')]?_0x58451a[_0x42f7('0x49')]:_0x474053[_0x42f7('0x43')];_0x58451a['order']=qs['sort'](_0x309431['query'][_0x42f7('0x4d')]);_0x58451a[_0x42f7('0x50')]=qs[_0x42f7('0x5a')](_[_0x42f7('0x4e')](_0x309431[_0x42f7('0x46')],_0x474053[_0x42f7('0x5a')]));if(_0x309431[_0x42f7('0x46')][_0x42f7('0x4f')]){_0x58451a[_0x42f7('0x50')]=_['merge'](_0x58451a['where'],{'$or':_[_0x42f7('0x44')](_0x58451a['attributes'],function(_0x3eb636){var _0x37bad3={};_0x37bad3[_0x3eb636]={'$like':'%'+_0x309431[_0x42f7('0x46')]['filter']+'%'};return _0x37bad3;})});}_0x58451a=_[_0x42f7('0x51')]({},_0x58451a,_0x309431[_0x42f7('0x53')]);return _0x2a1b51[_0x42f7('0xad')](_0x58451a);}})[_0x42f7('0x3a')](function(_0x5bd44d){if(_0x5bd44d){_0x4858a6=_0x5bd44d[_0x42f7('0x4a')];if(!_0x309431[_0x42f7('0x46')][_0x42f7('0x6a')](_0x42f7('0x4b'))){_0x58451a[_0x42f7('0x34')]=qs[_0x42f7('0x34')](_0x309431[_0x42f7('0x46')][_0x42f7('0x34')]);_0x58451a[_0x42f7('0x31')]=qs['offset'](_0x309431[_0x42f7('0x46')]['offset']);}return _0x2a1b51[_0x42f7('0xad')](_0x58451a);}})[_0x42f7('0x3a')](function(_0x4dd19b){if(_0x4dd19b){return _0x4dd19b?{'count':_0x4858a6,'rows':_0x4dd19b}:null;}})[_0x42f7('0x3a')](respondWithResult(_0x54e689,null))[_0x42f7('0x2d')](handleError(_0x54e689,null));};exports[_0x42f7('0xae')]=function(_0x579c46,_0x357183,_0xed6746){var _0xfdf09c={'raw':![],'where':{}};var _0x175d1c={};var _0x4f0c5c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x42f7('0x70')]({'where':{'id':_0x579c46[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x357183,null))[_0x42f7('0x3a')](function(_0x3c203d){if(_0x3c203d){_0x175d1c[_0x42f7('0x43')]=_[_0x42f7('0x45')](db[_0x42f7('0x90')][_0x42f7('0x41')]);_0x175d1c[_0x42f7('0x46')]=_['keys'](_0x579c46[_0x42f7('0x46')]);_0x175d1c[_0x42f7('0x5a')]=_[_0x42f7('0x47')](_0x175d1c[_0x42f7('0x43')],_0x175d1c[_0x42f7('0x46')]);_0xfdf09c[_0x42f7('0x49')]=_[_0x42f7('0x47')](_0x175d1c[_0x42f7('0x43')],qs[_0x42f7('0x48')](_0x579c46[_0x42f7('0x46')][_0x42f7('0x48')]));_0xfdf09c[_0x42f7('0x49')]=_0xfdf09c[_0x42f7('0x49')][_0x42f7('0x4a')]?_0xfdf09c[_0x42f7('0x49')]:_0x175d1c[_0x42f7('0x43')];if(!_0x579c46[_0x42f7('0x46')][_0x42f7('0x6a')](_0x42f7('0x4b'))){_0xfdf09c['limit']=qs[_0x42f7('0x34')](_0x579c46[_0x42f7('0x46')][_0x42f7('0x34')]);_0xfdf09c[_0x42f7('0x31')]=qs[_0x42f7('0x31')](_0x579c46[_0x42f7('0x46')][_0x42f7('0x31')]);}_0xfdf09c['order']=qs[_0x42f7('0x4d')](_0x579c46[_0x42f7('0x46')]['sort']);_0xfdf09c['where']=qs[_0x42f7('0x5a')](_['pick'](_0x579c46[_0x42f7('0x46')],_0x175d1c['filters']));_0xfdf09c[_0x42f7('0x50')][_0x42f7('0x68')]=_0x3c203d['id'];if(_0x579c46[_0x42f7('0x46')][_0x42f7('0x4f')]){_0xfdf09c[_0x42f7('0x50')]=_[_0x42f7('0x51')](_0xfdf09c[_0x42f7('0x50')],{'$or':_['map'](_0xfdf09c['attributes'],function(_0x117ee4){var _0x2198a2={};_0x2198a2[_0x117ee4]={'$like':'%'+_0x579c46[_0x42f7('0x46')][_0x42f7('0x4f')]+'%'};return _0x2198a2;})});}_0xfdf09c=_['merge']({},_0xfdf09c,_0x579c46[_0x42f7('0x53')]);return db[_0x42f7('0x90')]['count']({'where':_0xfdf09c[_0x42f7('0x50')]})[_0x42f7('0x3a')](function(_0x43c310){_0x4f0c5c[_0x42f7('0x33')]=_0x43c310;if(_0x579c46[_0x42f7('0x46')][_0x42f7('0x54')]){_0xfdf09c[_0x42f7('0x55')]=[{'model':db['CmContact'],'as':_0x42f7('0xaf'),'required':![]},{'model':db[_0x42f7('0x9c')],'as':_0x42f7('0xb0'),'attributes':[_0x42f7('0x3e'),_0x42f7('0xb1'),_0x42f7('0xb2')],'required':![]},{'model':db[_0x42f7('0xb3')],'as':_0x42f7('0xb4'),'attributes':['id',_0x42f7('0x3e'),_0x42f7('0xb5')],'where':_0x579c46[_0x42f7('0x46')]['tag']?{'id':_0x579c46[_0x42f7('0x46')][_0x42f7('0xb6')]}:undefined,'required':_0x579c46[_0x42f7('0x46')][_0x42f7('0xb6')]?!![]:![]}];}return db[_0x42f7('0x90')]['findAll'](_0xfdf09c);})[_0x42f7('0x3a')](function(_0x85c766){_0x4f0c5c[_0x42f7('0x57')]=_0x85c766;return _0x4f0c5c;});}})[_0x42f7('0x3a')](respondWithFilteredResult(_0x357183,_0xfdf09c))[_0x42f7('0x2d')](handleError(_0x357183,null));};exports['addAgents']=function(_0x4de73c,_0x4e919d,_0x4c5f76){return db['OpenchannelAccount']['find']({'where':{'id':_0x4de73c[_0x42f7('0x66')]['id']}})['then'](handleEntityNotFound(_0x4e919d,null))[_0x42f7('0x3a')](function(_0x2f3d0c){if(_0x2f3d0c){return _0x2f3d0c['addAgents'](_0x4de73c[_0x42f7('0x64')][_0x42f7('0x6c')],_[_0x42f7('0xb7')](_0x4de73c[_0x42f7('0x64')],[_0x42f7('0x6c'),'id'])||{})[_0x42f7('0x92')](function(_0x1b7063){for(var _0x526b64=0x0;_0x526b64<_0x4de73c['body'][_0x42f7('0x6c')][_0x42f7('0x4a')];_0x526b64+=0x1){socket[_0x42f7('0xb8')]('userOpenchannelAccount:save',{'UserId':Number(_0x4de73c[_0x42f7('0x64')][_0x42f7('0x6c')][_0x526b64]),'OpenchannelAccountId':Number(_0x4de73c['params']['id'])});}return _0x1b7063;});}})[_0x42f7('0x3a')](respondWithResult(_0x4e919d,null))[_0x42f7('0x2d')](handleError(_0x4e919d,null));};exports[_0x42f7('0xb9')]=function(_0x4426da,_0x2880eb,_0x22d8e9){return db['OpenchannelAccount']['find']({'where':{'id':_0x4426da[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x2880eb,null))[_0x42f7('0x3a')](function(_0x2c5605){if(_0x2c5605){return _0x2c5605[_0x42f7('0xb9')](_0x4426da[_0x42f7('0x46')][_0x42f7('0x6c')])['then'](function(){if(_[_0x42f7('0xba')](_0x4426da[_0x42f7('0x46')][_0x42f7('0x6c')])){for(var _0x4964e5=0x0;_0x4964e5<_0x4426da[_0x42f7('0x46')][_0x42f7('0x6c')][_0x42f7('0x4a')];_0x4964e5+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x4426da['query'][_0x42f7('0x6c')][_0x4964e5]),'OpenchannelAccountId':Number(_0x4426da[_0x42f7('0x66')]['id'])});}}else{socket['emit'](_0x42f7('0xbb'),{'UserId':Number(_0x4426da[_0x42f7('0x46')][_0x42f7('0x6c')]),'OpenchannelAccountId':Number(_0x4426da[_0x42f7('0x66')]['id'])});}});}})[_0x42f7('0x3a')](respondWithStatusCode(_0x2880eb,null))[_0x42f7('0x2d')](handleError(_0x2880eb,null));};exports['getAgents']=function(_0x407f27,_0x42ebf1,_0xfb9ee1){var _0x29ca7c={};var _0x464292={};var _0x42bb71;var _0x183813;return db[_0x42f7('0x40')][_0x42f7('0x70')]({'where':{'id':_0x407f27[_0x42f7('0x66')]['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x42ebf1,null))[_0x42f7('0x3a')](function(_0x39baab){if(_0x39baab){_0x42bb71=_0x39baab;_0x464292[_0x42f7('0x43')]=_[_0x42f7('0x45')](db[_0x42f7('0x9c')]['rawAttributes']);_0x464292[_0x42f7('0x46')]=_[_0x42f7('0x45')](_0x407f27[_0x42f7('0x46')]);_0x464292[_0x42f7('0x5a')]=_[_0x42f7('0x47')](_0x464292[_0x42f7('0x43')],_0x464292[_0x42f7('0x46')]);_0x29ca7c['attributes']=_[_0x42f7('0x47')](_0x464292[_0x42f7('0x43')],qs['fields'](_0x407f27[_0x42f7('0x46')][_0x42f7('0x48')]));_0x29ca7c[_0x42f7('0x49')]=_0x29ca7c[_0x42f7('0x49')][_0x42f7('0x4a')]?_0x29ca7c[_0x42f7('0x49')]:_0x464292['model'];_0x29ca7c[_0x42f7('0x4c')]=qs[_0x42f7('0x4d')](_0x407f27[_0x42f7('0x46')][_0x42f7('0x4d')]);_0x29ca7c[_0x42f7('0x50')]=qs['filters'](_[_0x42f7('0x4e')](_0x407f27['query'],_0x464292[_0x42f7('0x5a')]));if(_0x407f27[_0x42f7('0x46')]['filter']){_0x29ca7c[_0x42f7('0x50')]=_[_0x42f7('0x51')](_0x29ca7c[_0x42f7('0x50')],{'$or':_[_0x42f7('0x44')](_0x29ca7c[_0x42f7('0x49')],function(_0x5ba5bd){var _0x5316c6={};_0x5316c6[_0x5ba5bd]={'$like':'%'+_0x407f27[_0x42f7('0x46')]['filter']+'%'};return _0x5316c6;})});}_0x29ca7c=_[_0x42f7('0x51')]({},_0x29ca7c,_0x407f27[_0x42f7('0x53')]);return _0x42bb71['getAgents'](_0x29ca7c);}})['then'](function(_0x24949f){if(_0x24949f){_0x183813=_0x24949f['length'];if(!_0x407f27['query'][_0x42f7('0x6a')](_0x42f7('0x4b'))){_0x29ca7c[_0x42f7('0x34')]=qs[_0x42f7('0x34')](_0x407f27['query']['limit']);_0x29ca7c[_0x42f7('0x31')]=qs[_0x42f7('0x31')](_0x407f27['query'][_0x42f7('0x31')]);}return _0x42bb71['getAgents'](_0x29ca7c);}})['then'](function(_0x540ccc){if(_0x540ccc){return _0x540ccc?{'count':_0x183813,'rows':_0x540ccc}:null;}})[_0x42f7('0x3a')](respondWithResult(_0x42ebf1,null))[_0x42f7('0x2d')](handleError(_0x42ebf1,null));};exports[_0x42f7('0xbc')]=function(_0x3a7a99,_0x1a7e0c,_0x1a4a4c){var _0x5c24df,_0x3a316a,_0x280989;if(_['isNil'](_0x3a7a99[_0x42f7('0x64')][_0x42f7('0x64')])||_0x3a7a99['body']['body']===''){throw new db['Sequelize'][(_0x42f7('0x7d'))](_0x42f7('0x7e'));}if(_['isNil'](_0x3a7a99['body']['to'])){}_0x5c24df=_0x3a7a99[_0x42f7('0x64')]['to'];return db['OpenchannelAccount'][_0x42f7('0x70')]({'where':{'id':_0x3a7a99['params']['id']}})[_0x42f7('0x3a')](handleEntityNotFound(_0x1a7e0c,null))[_0x42f7('0x3a')](function(_0xf9a55e){if(_0xf9a55e){return db[_0x42f7('0x40')]['find']({'where':{'id':_0xf9a55e['id']},'include':[{'model':db[_0x42f7('0x82')],'as':_0x42f7('0x83'),'include':[{'model':db[_0x42f7('0x73')],'as':_0x42f7('0xbd'),'where':{[_0xf9a55e['mapKey']]:_0x5c24df},'limit':0x1,'order':[[_0x42f7('0x78'),_0x42f7('0x84')]]}]}]})['then'](handleEntityNotFound(_0x1a7e0c,null))['then'](function(_0x1d80d4){if(_0x1d80d4&&_0x1d80d4[_0x42f7('0x83')]){_0x3a316a=_0x1d80d4[_0x42f7('0x5e')]({'plain':!![]});if(_0x3a316a[_0x42f7('0x83')]&&_0x3a316a[_0x42f7('0x83')][_0x42f7('0xbd')][_0x42f7('0x4a')]){return _0x3a316a[_0x42f7('0x83')][_0x42f7('0xbd')][0x0];}return db[_0x42f7('0x73')][_0x42f7('0x5b')](_['defaults'](_0x3a7a99[_0x42f7('0x64')],{'firstName':_0x5c24df,[_0x1d80d4[_0x42f7('0x7f')]]:_0x5c24df,'phone':_0x5c24df,'ListId':_0x3a316a['ListId']}));}})[_0x42f7('0x3a')](handleEntityNotFound(_0x1a7e0c,null))[_0x42f7('0x3a')](function(_0x763032){if(_0x763032){_0x280989=_0x763032;return db[_0x42f7('0x90')][_0x42f7('0x65')]({'where':{'ContactId':_0x280989['id'],'closed':![],'OpenchannelAccountId':_0x3a316a['id']}})[_0x42f7('0x3a')](function(_0x2ded65){if(_0x2ded65){return[_0x2ded65,![]];}return db[_0x42f7('0x90')][_0x42f7('0x5b')]({'UserId':_0x3a7a99[_0x42f7('0xbe')]['id'],'ContactId':_0x280989['id'],'OpenchannelAccountId':_0x3a316a['id'],'lastMsgDirection':_0x42f7('0xbf'),'firstMsgDirection':_0x42f7('0xbf'),'Messages':[_[_0x42f7('0x51')](_0x3a7a99[_0x42f7('0x64')],{'read':![],'body':_0x3a7a99['body']['body'],'OpenchannelAccountId':_0x3a316a['id'],'UserId':_0x3a7a99[_0x42f7('0xbe')]['id'],'ContactId':_0x280989['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x13aac2){return[_0x13aac2,!![]];});});}})[_0x42f7('0x92')](function(_0x183b4d,_0x12923f){if(_0x12923f){return _0x183b4d;}return db[_0x42f7('0x99')][_0x42f7('0x5b')](_[_0x42f7('0x51')](_0x3a7a99[_0x42f7('0x64')],{'read':![],'body':_0x3a7a99['body'][_0x42f7('0x64')],'OpenchannelAccountId':_0x3a316a['id'],'OpenchannelInteractionId':_0x183b4d['id'],'UserId':_0x3a7a99['user']['id'],'ContactId':_0x280989['id']}))[_0x42f7('0x3a')](function(_0x3f3405){_0x183b4d[_0x42f7('0xc0')][_0x42f7('0xc1')]=[];_0x183b4d[_0x42f7('0xc0')][_0x42f7('0xc1')][_0x42f7('0x97')](_0x3f3405[_0x42f7('0xc0')]);return _0x183b4d;});});}})['then'](respondWithResult(_0x1a7e0c,null))[_0x42f7('0x2d')](handleError(_0x1a7e0c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8b17e4d..c483dc1 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 _0x5b02=['exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','remove','emit','hook'];(function(_0x2c86c8,_0x22ad0d){var _0x1cca4f=function(_0x298d77){while(--_0x298d77){_0x2c86c8['push'](_0x2c86c8['shift']());}};_0x1cca4f(++_0x22ad0d);}(_0x5b02,0xe9));var _0x25b0=function(_0x10fff4,_0x32783b){_0x10fff4=_0x10fff4-0x0;var _0x4d7dda=_0x5b02[_0x10fff4];return _0x4d7dda;};'use strict';var EventEmitter=require(_0x25b0('0x0'));var OpenchannelAccount=require(_0x25b0('0x1'))['db'][_0x25b0('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x25b0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x25b0('0x4')};function emitEvent(_0x53493e){return function(_0x3e1d20,_0x31c9c2,_0x38dc14){OpenchannelAccountEvents[_0x25b0('0x5')](_0x53493e+':'+_0x3e1d20['id'],_0x3e1d20);OpenchannelAccountEvents[_0x25b0('0x5')](_0x53493e,_0x3e1d20);_0x38dc14(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x25b0('0x6')](e,emitEvent(event));}}module[_0x25b0('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0x0bb5,0x148));var _0x50bb=function(_0x36a0e4,_0xf4701e){_0x36a0e4=_0x36a0e4-0x0;var _0x592b63=_0x0bb5[_0x36a0e4];return _0x592b63;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4560488..36e027e 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(_0x3ee789,_0x540fd2){var _0x5d94d9=function(_0x3a98e3){while(--_0x3a98e3){_0x3ee789['push'](_0x3ee789['shift']());}};_0x5d94d9(++_0x540fd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x133a41,_0x24b082){var _0x2f9691=function(_0x1a78a2){while(--_0x1a78a2){_0x133a41['push'](_0x133a41['shift']());}};_0x2f9691(++_0x24b082);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 e01a68e..3ebf5cd 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 _0x0102=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2a03d5,_0x318ac3){var _0x4204e5=function(_0x53a977){while(--_0x53a977){_0x2a03d5['push'](_0x2a03d5['shift']());}};_0x4204e5(++_0x318ac3);}(_0x0102,0x186));var _0x2010=function(_0x49c69f,_0x1e0f6a){_0x49c69f=_0x49c69f-0x0;var _0x1b2a78=_0x0102[_0x49c69f];return _0x1b2a78;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});config['redis']=_[_0x2010('0x8')](config['redis'],{'host':_0x2010('0x9'),'port':0x18eb});var socket=require(_0x2010('0xa'))(new Redis(config['redis']));require(_0x2010('0xb'))[_0x2010('0xc')](socket);function respondWithRpcPromise(_0x3d34d4,_0x3acdbb,_0x1aedbb){return new BPromise(function(_0x2a27b0,_0x289ad4){return client[_0x2010('0xd')](_0x3d34d4,_0x1aedbb)[_0x2010('0xe')](function(_0x39a821){logger[_0x2010('0xf')](_0x2010('0x10'),_0x3acdbb,_0x2010('0x11'));logger[_0x2010('0x12')](_0x2010('0x13'),_0x3acdbb,_0x2010('0x11'),JSON['stringify'](_0x39a821));if(_0x39a821['error']){if(_0x39a821[_0x2010('0x14')][_0x2010('0x15')]===0x1f4){logger[_0x2010('0x14')](_0x2010('0x10'),_0x3acdbb,_0x39a821[_0x2010('0x14')][_0x2010('0x16')]);return _0x289ad4(_0x39a821['error'][_0x2010('0x16')]);}logger[_0x2010('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x3acdbb,_0x39a821[_0x2010('0x14')][_0x2010('0x16')]);return _0x2a27b0(_0x39a821[_0x2010('0x14')][_0x2010('0x16')]);}else{logger[_0x2010('0xf')](_0x2010('0x10'),_0x3acdbb,_0x2010('0x11'));_0x2a27b0(_0x39a821[_0x2010('0x17')][_0x2010('0x16')]);}})['catch'](function(_0x559ed6){logger[_0x2010('0x14')](_0x2010('0x10'),_0x3acdbb,_0x559ed6);_0x289ad4(_0x559ed6);});});} \ No newline at end of file +var _0x235a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x235a,0x1ef));var _0xa235=function(_0x3ba6fa,_0x1a017c){_0x3ba6fa=_0x3ba6fa-0x0;var _0x286c65=_0x235a[_0x3ba6fa];return _0x286c65;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});config['redis']=_[_0xa235('0xc')](config[_0xa235('0xd')],{'host':_0xa235('0xe'),'port':0x18eb});var socket=require(_0xa235('0xf'))(new Redis(config['redis']));require(_0xa235('0x10'))['register'](socket);function respondWithRpcPromise(_0x560eb1,_0x10bb4f,_0x504b60){return new BPromise(function(_0xbde1c7,_0x535bb9){return client['request'](_0x560eb1,_0x504b60)['then'](function(_0x464a85){logger[_0xa235('0x11')](_0xa235('0x12'),_0x10bb4f,_0xa235('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x10bb4f,'request\x20sent',JSON[_0xa235('0x14')](_0x464a85));if(_0x464a85[_0xa235('0x15')]){if(_0x464a85[_0xa235('0x15')][_0xa235('0x16')]===0x1f4){logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);return _0x535bb9(_0x464a85[_0xa235('0x15')]['message']);}logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);return _0xbde1c7(_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x10bb4f,_0xa235('0x13'));_0xbde1c7(_0x464a85[_0xa235('0x18')][_0xa235('0x17')]);}})['catch'](function(_0x40b4a9){logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x40b4a9);_0x535bb9(_0x40b4a9);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 16d9621..18cccb5 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 _0x1cc7=['remove','emit','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x46aceb,_0x18a842){var _0x2b2230=function(_0x3e3ab0){while(--_0x3e3ab0){_0x46aceb['push'](_0x46aceb['shift']());}};_0x2b2230(++_0x18a842);}(_0x1cc7,0x15a));var _0x71cc=function(_0x59a0cf,_0x5623d3){_0x59a0cf=_0x59a0cf-0x0;var _0x56177e=_0x1cc7[_0x59a0cf];return _0x56177e;};'use strict';var OpenchannelAccountEvents=require(_0x71cc('0x0'));var events=[_0x71cc('0x1'),_0x71cc('0x2'),'update'];function createListener(_0x4db9cd,_0x547fe6){return function(_0xe5d54e){_0x547fe6[_0x71cc('0x3')](_0x4db9cd,_0xe5d54e);};}function removeListener(_0x402191,_0x5431e1){return function(){OpenchannelAccountEvents['removeListener'](_0x402191,_0x5431e1);};}exports['register']=function(_0x27a175){for(var _0x4ecf81=0x0,_0xc0444e=events[_0x71cc('0x4')];_0x4ecf81<_0xc0444e;_0x4ecf81++){var _0x4039ce=events[_0x4ecf81];var _0x2e70f0=createListener(_0x71cc('0x5')+_0x4039ce,_0x27a175);OpenchannelAccountEvents['on'](_0x4039ce,_0x2e70f0);}}; \ No newline at end of file +var _0xb469=['./openchannelAccount.events','save','remove','update','register'];(function(_0xcfbfc5,_0x286d8e){var _0xfe7d0a=function(_0x134568){while(--_0x134568){_0xcfbfc5['push'](_0xcfbfc5['shift']());}};_0xfe7d0a(++_0x286d8e);}(_0xb469,0x13b));var _0x9b46=function(_0x41ca16,_0x49a057){_0x41ca16=_0x41ca16-0x0;var _0x205138=_0xb469[_0x41ca16];return _0x205138;};'use strict';var OpenchannelAccountEvents=require(_0x9b46('0x0'));var events=[_0x9b46('0x1'),_0x9b46('0x2'),_0x9b46('0x3')];function createListener(_0x1a41e8,_0x895347){return function(_0x9212ae){_0x895347['emit'](_0x1a41e8,_0x9212ae);};}function removeListener(_0x31f853,_0x45322f){return function(){OpenchannelAccountEvents['removeListener'](_0x31f853,_0x45322f);};}exports[_0x9b46('0x4')]=function(_0x405d1c){for(var _0x50b49e=0x0,_0x1b2dd3=events['length'];_0x50b49e<_0x1b2dd3;_0x50b49e++){var _0x4c1ed9=events[_0x50b49e];var _0x34c0de=createListener('openchannelAccount:'+_0x4c1ed9,_0x405d1c);OpenchannelAccountEvents['on'](_0x4c1ed9,_0x34c0de);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1731a8f..e008202 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 _0x06af=['exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x1b9b98,_0x480eec){var _0x2b6c46=function(_0x2b14a9){while(--_0x2b14a9){_0x1b9b98['push'](_0x1b9b98['shift']());}};_0x2b6c46(++_0x480eec);}(_0x06af,0x10b));var _0xf06a=function(_0x167e28,_0x88d4d3){_0x167e28=_0x167e28-0x0;var _0x3c7329=_0x06af[_0x167e28];return _0x3c7329;};'use strict';var multer=require(_0xf06a('0x0'));var util=require(_0xf06a('0x1'));var path=require(_0xf06a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf06a('0x3')]();var fs_extra=require(_0xf06a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf06a('0x5'));var config=require(_0xf06a('0x6'));var controller=require(_0xf06a('0x7'));router[_0xf06a('0x8')]('/',auth[_0xf06a('0x9')](),controller[_0xf06a('0xa')]);router['get'](_0xf06a('0xb'),auth[_0xf06a('0x9')](),controller[_0xf06a('0xc')]);router[_0xf06a('0xd')]('/',auth[_0xf06a('0x9')](),controller[_0xf06a('0xe')]);router[_0xf06a('0xf')]('/:id',auth[_0xf06a('0x9')](),controller[_0xf06a('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf06a('0x11')]);module[_0xf06a('0x12')]=router; \ No newline at end of file +var _0x94a5=['show','post','create','put','destroy','exports','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x94a5,0x166));var _0x594a=function(_0x3ddba3,_0x11bb39){_0x3ddba3=_0x3ddba3-0x0;var _0x4adb62=_0x94a5[_0x3ddba3];return _0x4adb62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x594a('0x0'));var timeout=require('connect-timeout');var express=require(_0x594a('0x1'));var router=express['Router']();var fs_extra=require(_0x594a('0x2'));var auth=require(_0x594a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x594a('0x4'));var controller=require(_0x594a('0x5'));router[_0x594a('0x6')]('/',auth[_0x594a('0x7')](),controller[_0x594a('0x8')]);router[_0x594a('0x6')](_0x594a('0x9'),auth[_0x594a('0x7')](),controller[_0x594a('0xa')]);router[_0x594a('0xb')]('/',auth[_0x594a('0x7')](),controller[_0x594a('0xc')]);router[_0x594a('0xd')](_0x594a('0x9'),auth[_0x594a('0x7')](),controller['update']);router['delete']('/:id',auth[_0x594a('0x7')](),controller[_0x594a('0xe')]);module[_0x594a('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a8026dc..389f99a 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 _0x6af7=['STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x415a9e,_0xf52f2f){var _0x33d04c=function(_0x5ee153){while(--_0x5ee153){_0x415a9e['push'](_0x415a9e['shift']());}};_0x33d04c(++_0xf52f2f);}(_0x6af7,0x19e));var _0x76af=function(_0x174295,_0x58f38c){_0x174295=_0x174295-0x0;var _0x5eb7a2=_0x6af7[_0x174295];return _0x5eb7a2;};'use strict';var Sequelize=require(_0x76af('0x0'));module['exports']={'priority':{'type':Sequelize[_0x76af('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x76af('0x2')],'defaultValue':_0x76af('0x3')}}; \ No newline at end of file +var _0x11ac=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x3bbca7,_0xfd6f0){var _0xf16da4=function(_0x2de0a2){while(--_0x2de0a2){_0x3bbca7['push'](_0x3bbca7['shift']());}};_0xf16da4(++_0xfd6f0);}(_0x11ac,0x6a));var _0xc11a=function(_0xa5729b,_0x3fc571){_0xa5729b=_0xa5729b-0x0;var _0x2e1135=_0x11ac[_0xa5729b];return _0x2e1135;};'use strict';var Sequelize=require(_0xc11a('0x0'));module[_0xc11a('0x1')]={'priority':{'type':Sequelize[_0xc11a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc11a('0x3')],'allowNull':![],'defaultValue':_0xc11a('0x4')},'appdata':{'type':Sequelize[_0xc11a('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6a9df1c..359d673 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 _0x4024=['findAll','rows','catch','show','params','length','include','find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','set','Content-Range','json','reject','save','then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','count'];(function(_0x2cbc6d,_0x2f5826){var _0x1527f0=function(_0x577a0c){while(--_0x577a0c){_0x2cbc6d['push'](_0x2cbc6d['shift']());}};_0x1527f0(++_0x2f5826);}(_0x4024,0xec));var _0x4402=function(_0x321815,_0x5a3407){_0x321815=_0x321815-0x0;var _0x31ebcd=_0x4024[_0x321815];return _0x31ebcd;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4402('0x1'));var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require(_0x4402('0x4'));var BPromise=require(_0x4402('0x5'));var Mustache=require(_0x4402('0x6'));var util=require(_0x4402('0x7'));var path=require('path');var sox=require(_0x4402('0x8'));var csv=require(_0x4402('0x9'));var ejs=require(_0x4402('0xa'));var fs=require('fs');var fs_extra=require(_0x4402('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4402('0xc'));var jsforce=require(_0x4402('0xd'));var deskjs=require(_0x4402('0xe'));var toCsv=require(_0x4402('0x9'));var querystring=require(_0x4402('0xf'));var Papa=require(_0x4402('0x10'));var Redis=require(_0x4402('0x11'));var authService=require(_0x4402('0x12'));var qs=require(_0x4402('0x13'));var as=require(_0x4402('0x14'));var hardwareService=require(_0x4402('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4402('0x16'));var licenseUtil=require(_0x4402('0x17'));var db=require(_0x4402('0x18'))['db'];function respondWithStatusCode(_0x14be5b,_0x23081c){_0x23081c=_0x23081c||0xcc;return function(_0x39db85){if(_0x39db85){return _0x14be5b[_0x4402('0x19')](_0x23081c);}return _0x14be5b[_0x4402('0x1a')](_0x23081c)[_0x4402('0x1b')]();};}function respondWithResult(_0x2c1da2,_0x1b9ddc){_0x1b9ddc=_0x1b9ddc||0xc8;return function(_0x50ca28){if(_0x50ca28){return _0x2c1da2['status'](_0x1b9ddc)['json'](_0x50ca28);}};}function respondWithFilteredResult(_0x387a54,_0x86a723){return function(_0x58c249){if(_0x58c249){var _0x4cc11a=typeof _0x86a723['offset']===_0x4402('0x1c')&&typeof _0x86a723[_0x4402('0x1d')]===_0x4402('0x1c');var _0x2ac13b=_0x58c249['count'];var _0x2b768a=_0x4cc11a?0x0:_0x86a723['offset'];var _0x5d0b3c=_0x4cc11a?_0x58c249['count']:_0x86a723['offset']+_0x86a723[_0x4402('0x1d')];var _0x46d55d;if(_0x5d0b3c>=_0x2ac13b){_0x5d0b3c=_0x2ac13b;_0x46d55d=0xc8;}else{_0x46d55d=0xce;}_0x387a54[_0x4402('0x1a')](_0x46d55d);return _0x387a54[_0x4402('0x1e')](_0x4402('0x1f'),_0x2b768a+'-'+_0x5d0b3c+'/'+_0x2ac13b)[_0x4402('0x20')](_0x58c249);}return null;};}function patchUpdates(_0x1b0a77){return function(_0x13268e){try{jsonpatch['apply'](_0x13268e,_0x1b0a77,!![]);}catch(_0x18fce7){return BPromise[_0x4402('0x21')](_0x18fce7);}return _0x13268e[_0x4402('0x22')]();};}function saveUpdates(_0x594385,_0x54f269){return function(_0x475c5b){if(_0x475c5b){return _0x475c5b['update'](_0x594385)[_0x4402('0x23')](function(_0x219460){return _0x219460;});}return null;};}function removeEntity(_0x128a23,_0x1df16a){return function(_0x4eea06){if(_0x4eea06){return _0x4eea06[_0x4402('0x24')]()[_0x4402('0x23')](function(){_0x128a23[_0x4402('0x1a')](0xcc)[_0x4402('0x1b')]();});}};}function handleEntityNotFound(_0x15b7a1,_0x1139e9){return function(_0x211006){if(!_0x211006){_0x15b7a1[_0x4402('0x19')](0x194);}return _0x211006;};}function handleError(_0x5eaa35,_0x4f1af8){_0x4f1af8=_0x4f1af8||0x1f4;return function(_0x16c66a){logger['error'](_0x16c66a[_0x4402('0x25')]);if(_0x16c66a[_0x4402('0x26')]){delete _0x16c66a[_0x4402('0x26')];}_0x5eaa35[_0x4402('0x1a')](_0x4f1af8)[_0x4402('0x27')](_0x16c66a);};}exports[_0x4402('0x28')]=function(_0x54060e,_0x1e94b6){var _0x18e597={},_0x2933d4={},_0x4efe5c={'count':0x0,'rows':[]};var _0x5dd54e=_[_0x4402('0x29')](db[_0x4402('0x2a')][_0x4402('0x2b')],function(_0x253fa5){return{'name':_0x253fa5['fieldName'],'type':_0x253fa5[_0x4402('0x2c')]['key']};});_0x2933d4['model']=_['map'](_0x5dd54e,_0x4402('0x26'));_0x2933d4[_0x4402('0x2d')]=_[_0x4402('0x2e')](_0x54060e[_0x4402('0x2d')]);_0x2933d4[_0x4402('0x2f')]=_[_0x4402('0x30')](_0x2933d4[_0x4402('0x31')],_0x2933d4[_0x4402('0x2d')]);_0x18e597[_0x4402('0x32')]=_['intersection'](_0x2933d4['model'],qs[_0x4402('0x33')](_0x54060e['query'][_0x4402('0x33')]));_0x18e597[_0x4402('0x32')]=_0x18e597[_0x4402('0x32')]['length']?_0x18e597[_0x4402('0x32')]:_0x2933d4['model'];if(!_0x54060e[_0x4402('0x2d')][_0x4402('0x34')](_0x4402('0x35'))){_0x18e597[_0x4402('0x1d')]=qs['limit'](_0x54060e['query'][_0x4402('0x1d')]);_0x18e597[_0x4402('0x36')]=qs['offset'](_0x54060e['query']['offset']);}_0x18e597[_0x4402('0x37')]=qs[_0x4402('0x38')](_0x54060e[_0x4402('0x2d')][_0x4402('0x38')]);_0x18e597['where']=qs['filters'](_[_0x4402('0x39')](_0x54060e[_0x4402('0x2d')],_0x2933d4[_0x4402('0x2f')]),_0x5dd54e);if(_0x54060e['query'][_0x4402('0x3a')]){_0x18e597[_0x4402('0x3b')]=_[_0x4402('0x3c')](_0x18e597[_0x4402('0x3b')],{'$or':_[_0x4402('0x29')](_0x5dd54e,function(_0x7e660a){if(_0x7e660a[_0x4402('0x2c')]!==_0x4402('0x3d')){var _0xb0d100={};_0xb0d100[_0x7e660a['name']]={'$like':'%'+_0x54060e[_0x4402('0x2d')][_0x4402('0x3a')]+'%'};return _0xb0d100;}})});}_0x18e597=_['merge']({},_0x18e597,_0x54060e[_0x4402('0x3e')]);var _0x5787af={'where':_0x18e597[_0x4402('0x3b')]};return db[_0x4402('0x2a')][_0x4402('0x3f')](_0x5787af)[_0x4402('0x23')](function(_0x1de4f2){_0x4efe5c[_0x4402('0x3f')]=_0x1de4f2;if(_0x54060e[_0x4402('0x2d')]['includeAll']){_0x18e597['include']=[{'all':!![]}];}return db[_0x4402('0x2a')][_0x4402('0x40')](_0x18e597);})['then'](function(_0x54cb75){_0x4efe5c[_0x4402('0x41')]=_0x54cb75;return _0x4efe5c;})['then'](respondWithFilteredResult(_0x1e94b6,_0x18e597))[_0x4402('0x42')](handleError(_0x1e94b6,null));};exports[_0x4402('0x43')]=function(_0x100d9f,_0x2ad458){var _0x5a0f3f={'raw':!![],'where':{'id':_0x100d9f[_0x4402('0x44')]['id']}},_0x37ff3f={};_0x37ff3f['model']=_['keys'](db[_0x4402('0x2a')][_0x4402('0x2b')]);_0x37ff3f[_0x4402('0x2d')]=_[_0x4402('0x2e')](_0x100d9f[_0x4402('0x2d')]);_0x37ff3f[_0x4402('0x2f')]=_[_0x4402('0x30')](_0x37ff3f[_0x4402('0x31')],_0x37ff3f[_0x4402('0x2d')]);_0x5a0f3f[_0x4402('0x32')]=_['intersection'](_0x37ff3f[_0x4402('0x31')],qs[_0x4402('0x33')](_0x100d9f[_0x4402('0x2d')][_0x4402('0x33')]));_0x5a0f3f[_0x4402('0x32')]=_0x5a0f3f[_0x4402('0x32')][_0x4402('0x45')]?_0x5a0f3f['attributes']:_0x37ff3f[_0x4402('0x31')];if(_0x100d9f[_0x4402('0x2d')]['includeAll']){_0x5a0f3f[_0x4402('0x46')]=[{'all':!![]}];}_0x5a0f3f=_[_0x4402('0x3c')]({},_0x5a0f3f,_0x100d9f[_0x4402('0x3e')]);return db[_0x4402('0x2a')][_0x4402('0x47')](_0x5a0f3f)[_0x4402('0x23')](handleEntityNotFound(_0x2ad458,null))[_0x4402('0x23')](respondWithResult(_0x2ad458,null))[_0x4402('0x42')](handleError(_0x2ad458,null));};exports[_0x4402('0x48')]=function(_0x2822cd,_0x39e55d){return db[_0x4402('0x2a')]['create'](_0x2822cd['body'],{})[_0x4402('0x23')](respondWithResult(_0x39e55d,0xc9))[_0x4402('0x42')](handleError(_0x39e55d,null));};exports[_0x4402('0x49')]=function(_0x5d5244,_0x50a526){if(_0x5d5244[_0x4402('0x4a')]['id']){delete _0x5d5244[_0x4402('0x4a')]['id'];}return db[_0x4402('0x2a')]['find']({'where':{'id':_0x5d5244[_0x4402('0x44')]['id']}})[_0x4402('0x23')](handleEntityNotFound(_0x50a526,null))[_0x4402('0x23')](saveUpdates(_0x5d5244[_0x4402('0x4a')],null))[_0x4402('0x23')](respondWithResult(_0x50a526,null))['catch'](handleError(_0x50a526,null));};exports[_0x4402('0x24')]=function(_0x2e0d63,_0x382cf5){return db[_0x4402('0x2a')][_0x4402('0x47')]({'where':{'id':_0x2e0d63[_0x4402('0x44')]['id']}})[_0x4402('0x23')](handleEntityNotFound(_0x382cf5,null))[_0x4402('0x23')](removeEntity(_0x382cf5,null))[_0x4402('0x42')](handleError(_0x382cf5,null));}; \ No newline at end of file +var _0x4518=['stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error'];(function(_0x4f2a73,_0x1da17d){var _0x4f1466=function(_0x21f84b){while(--_0x21f84b){_0x4f2a73['push'](_0x4f2a73['shift']());}};_0x4f1466(++_0x1da17d);}(_0x4518,0x6b));var _0x8451=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x4518[_0x2074db];return _0x27324c;};'use strict';var emlformat=require(_0x8451('0x0'));var rimraf=require(_0x8451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8451('0x2'));var rp=require(_0x8451('0x3'));var moment=require(_0x8451('0x4'));var BPromise=require(_0x8451('0x5'));var Mustache=require(_0x8451('0x6'));var util=require('util');var path=require(_0x8451('0x7'));var sox=require('sox');var csv=require(_0x8451('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8451('0x9'));var crypto=require('crypto');var jsforce=require(_0x8451('0xa'));var deskjs=require(_0x8451('0xb'));var toCsv=require(_0x8451('0x8'));var querystring=require(_0x8451('0xc'));var Papa=require(_0x8451('0xd'));var Redis=require(_0x8451('0xe'));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(_0x8451('0xf'))(_0x8451('0x10'));var utils=require(_0x8451('0x11'));var config=require(_0x8451('0x12'));var licenseUtil=require(_0x8451('0x13'));var db=require(_0x8451('0x14'))['db'];function respondWithStatusCode(_0x3a2048,_0x30ca95){_0x30ca95=_0x30ca95||0xcc;return function(_0x49b959){if(_0x49b959){return _0x3a2048['sendStatus'](_0x30ca95);}return _0x3a2048[_0x8451('0x15')](_0x30ca95)[_0x8451('0x16')]();};}function respondWithResult(_0x23bb44,_0x4508ef){_0x4508ef=_0x4508ef||0xc8;return function(_0x1109db){if(_0x1109db){return _0x23bb44[_0x8451('0x15')](_0x4508ef)[_0x8451('0x17')](_0x1109db);}};}function respondWithFilteredResult(_0x4dbe8e,_0x184cb5){return function(_0x5451f5){if(_0x5451f5){var _0x59eb66=typeof _0x184cb5['offset']===_0x8451('0x18')&&typeof _0x184cb5[_0x8451('0x19')]===_0x8451('0x18');var _0x234923=_0x5451f5['count'];var _0x1c6811=_0x59eb66?0x0:_0x184cb5['offset'];var _0x17ce14=_0x59eb66?_0x5451f5['count']:_0x184cb5['offset']+_0x184cb5[_0x8451('0x19')];var _0x422ac8;if(_0x17ce14>=_0x234923){_0x17ce14=_0x234923;_0x422ac8=0xc8;}else{_0x422ac8=0xce;}_0x4dbe8e['status'](_0x422ac8);return _0x4dbe8e[_0x8451('0x1a')](_0x8451('0x1b'),_0x1c6811+'-'+_0x17ce14+'/'+_0x234923)['json'](_0x5451f5);}return null;};}function patchUpdates(_0x1f4758){return function(_0x597105){try{jsonpatch[_0x8451('0x1c')](_0x597105,_0x1f4758,!![]);}catch(_0x220ba6){return BPromise[_0x8451('0x1d')](_0x220ba6);}return _0x597105['save']();};}function saveUpdates(_0x4ac30f,_0x4cbbd0){return function(_0x166099){if(_0x166099){return _0x166099[_0x8451('0x1e')](_0x4ac30f)[_0x8451('0x1f')](function(_0xba4449){return _0xba4449;});}return null;};}function removeEntity(_0x386c82,_0x573f23){return function(_0x2b3516){if(_0x2b3516){return _0x2b3516[_0x8451('0x20')]()[_0x8451('0x1f')](function(){_0x386c82[_0x8451('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a366,_0x139a39){return function(_0xe20706){if(!_0xe20706){_0x39a366[_0x8451('0x21')](0x194);}return _0xe20706;};}function handleError(_0x12a8f4,_0x5ec030){_0x5ec030=_0x5ec030||0x1f4;return function(_0x22836f){logger[_0x8451('0x22')](_0x22836f[_0x8451('0x23')]);if(_0x22836f[_0x8451('0x24')]){delete _0x22836f[_0x8451('0x24')];}_0x12a8f4[_0x8451('0x15')](_0x5ec030)[_0x8451('0x25')](_0x22836f);};}exports[_0x8451('0x26')]=function(_0x44671e,_0x28e79f){var _0x459897={},_0x5cce03={},_0x503cbd={'count':0x0,'rows':[]};var _0x58fdd0=_[_0x8451('0x27')](db[_0x8451('0x28')][_0x8451('0x29')],function(_0x2c786e){return{'name':_0x2c786e[_0x8451('0x2a')],'type':_0x2c786e[_0x8451('0x2b')]['key']};});_0x5cce03[_0x8451('0x2c')]=_['map'](_0x58fdd0,'name');_0x5cce03[_0x8451('0x2d')]=_[_0x8451('0x2e')](_0x44671e['query']);_0x5cce03[_0x8451('0x2f')]=_[_0x8451('0x30')](_0x5cce03['model'],_0x5cce03['query']);_0x459897[_0x8451('0x31')]=_[_0x8451('0x30')](_0x5cce03[_0x8451('0x2c')],qs['fields'](_0x44671e['query'][_0x8451('0x32')]));_0x459897[_0x8451('0x31')]=_0x459897['attributes']['length']?_0x459897['attributes']:_0x5cce03[_0x8451('0x2c')];if(!_0x44671e['query'][_0x8451('0x33')](_0x8451('0x34'))){_0x459897['limit']=qs[_0x8451('0x19')](_0x44671e[_0x8451('0x2d')][_0x8451('0x19')]);_0x459897['offset']=qs[_0x8451('0x35')](_0x44671e[_0x8451('0x2d')][_0x8451('0x35')]);}_0x459897[_0x8451('0x36')]=qs[_0x8451('0x37')](_0x44671e['query'][_0x8451('0x37')]);_0x459897[_0x8451('0x38')]=qs[_0x8451('0x2f')](_[_0x8451('0x39')](_0x44671e['query'],_0x5cce03[_0x8451('0x2f')]),_0x58fdd0);if(_0x44671e[_0x8451('0x2d')][_0x8451('0x3a')]){_0x459897['where']=_[_0x8451('0x3b')](_0x459897['where'],{'$or':_[_0x8451('0x27')](_0x58fdd0,function(_0x2991d1){if(_0x2991d1[_0x8451('0x2b')]!=='VIRTUAL'){var _0x3aed1c={};_0x3aed1c[_0x2991d1[_0x8451('0x24')]]={'$like':'%'+_0x44671e[_0x8451('0x2d')][_0x8451('0x3a')]+'%'};return _0x3aed1c;}})});}_0x459897=_['merge']({},_0x459897,_0x44671e[_0x8451('0x3c')]);var _0x20f23b={'where':_0x459897['where']};return db[_0x8451('0x28')]['count'](_0x20f23b)['then'](function(_0x31c677){_0x503cbd[_0x8451('0x3d')]=_0x31c677;if(_0x44671e[_0x8451('0x2d')]['includeAll']){_0x459897[_0x8451('0x3e')]=[{'all':!![]}];}return db[_0x8451('0x28')][_0x8451('0x3f')](_0x459897);})[_0x8451('0x1f')](function(_0x2b3b11){_0x503cbd[_0x8451('0x40')]=_0x2b3b11;return _0x503cbd;})['then'](respondWithFilteredResult(_0x28e79f,_0x459897))[_0x8451('0x41')](handleError(_0x28e79f,null));};exports['show']=function(_0x45af2b,_0x28d8e6){var _0x19af0f={'raw':!![],'where':{'id':_0x45af2b[_0x8451('0x42')]['id']}},_0x303b95={};_0x303b95['model']=_['keys'](db[_0x8451('0x28')][_0x8451('0x29')]);_0x303b95[_0x8451('0x2d')]=_[_0x8451('0x2e')](_0x45af2b[_0x8451('0x2d')]);_0x303b95[_0x8451('0x2f')]=_[_0x8451('0x30')](_0x303b95[_0x8451('0x2c')],_0x303b95[_0x8451('0x2d')]);_0x19af0f[_0x8451('0x31')]=_[_0x8451('0x30')](_0x303b95[_0x8451('0x2c')],qs[_0x8451('0x32')](_0x45af2b[_0x8451('0x2d')]['fields']));_0x19af0f['attributes']=_0x19af0f[_0x8451('0x31')][_0x8451('0x43')]?_0x19af0f[_0x8451('0x31')]:_0x303b95[_0x8451('0x2c')];if(_0x45af2b[_0x8451('0x2d')]['includeAll']){_0x19af0f[_0x8451('0x3e')]=[{'all':!![]}];}_0x19af0f=_['merge']({},_0x19af0f,_0x45af2b[_0x8451('0x3c')]);return db[_0x8451('0x28')][_0x8451('0x44')](_0x19af0f)[_0x8451('0x1f')](handleEntityNotFound(_0x28d8e6,null))[_0x8451('0x1f')](respondWithResult(_0x28d8e6,null))['catch'](handleError(_0x28d8e6,null));};exports[_0x8451('0x45')]=function(_0x100fbe,_0x2629e7){return db[_0x8451('0x28')][_0x8451('0x45')](_0x100fbe[_0x8451('0x46')],{})[_0x8451('0x1f')](respondWithResult(_0x2629e7,0xc9))[_0x8451('0x41')](handleError(_0x2629e7,null));};exports[_0x8451('0x1e')]=function(_0x38c5f5,_0x41c56a){if(_0x38c5f5[_0x8451('0x46')]['id']){delete _0x38c5f5[_0x8451('0x46')]['id'];}return db[_0x8451('0x28')][_0x8451('0x44')]({'where':{'id':_0x38c5f5[_0x8451('0x42')]['id']}})[_0x8451('0x1f')](handleEntityNotFound(_0x41c56a,null))[_0x8451('0x1f')](saveUpdates(_0x38c5f5[_0x8451('0x46')],null))[_0x8451('0x1f')](respondWithResult(_0x41c56a,null))[_0x8451('0x41')](handleError(_0x41c56a,null));};exports[_0x8451('0x20')]=function(_0x54838d,_0x2ead74){return db[_0x8451('0x28')]['find']({'where':{'id':_0x54838d[_0x8451('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ead74,null))[_0x8451('0x1f')](removeEntity(_0x2ead74,null))[_0x8451('0x41')](handleError(_0x2ead74,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1f53757..e42f5d3 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 _0x5aeb=['lodash','../../config/logger','api','bluebird','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x522233,_0x164305){var _0x119914=function(_0x4ad447){while(--_0x4ad447){_0x522233['push'](_0x522233['shift']());}};_0x119914(++_0x164305);}(_0x5aeb,0x198));var _0xb5ae=function(_0xf2c0e7,_0x3ff74e){_0xf2c0e7=_0xf2c0e7-0x0;var _0x3add48=_0x5aeb[_0xf2c0e7];return _0x3add48;};'use strict';var _=require(_0xb5ae('0x0'));var util=require('util');var logger=require(_0xb5ae('0x1'))(_0xb5ae('0x2'));var moment=require('moment');var BPromise=require(_0xb5ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5ae('0x4'));var rimraf=require(_0xb5ae('0x5'));var config=require('../../config/environment');var attributes=require(_0xb5ae('0x6'));module[_0xb5ae('0x7')]=function(_0x1706eb,_0x4d18b7){return _0x1706eb[_0xb5ae('0x8')](_0xb5ae('0x9'),attributes,{'tableName':_0xb5ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb5ae('0xb')});}; \ No newline at end of file +var _0xd0c9=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0xc0b152,_0x23f202){var _0x4f0053=function(_0x1681b1){while(--_0x1681b1){_0xc0b152['push'](_0xc0b152['shift']());}};_0x4f0053(++_0x23f202);}(_0xd0c9,0xaf));var _0x9d0c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd0c9[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x9d0c('0x0'));var logger=require('../../config/logger')(_0x9d0c('0x1'));var moment=require(_0x9d0c('0x2'));var BPromise=require(_0x9d0c('0x3'));var rp=require(_0x9d0c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9d0c('0x5'));var attributes=require(_0x9d0c('0x6'));module[_0x9d0c('0x7')]=function(_0x2a6953,_0x39aa1d){return _0x2a6953[_0x9d0c('0x8')](_0x9d0c('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d0c('0xa'),'collate':_0x9d0c('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b2070c0..d2a7f06 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 _0x272d=['error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x561794,_0xe1a33e){var _0x1ccaaf=function(_0x1eb185){while(--_0x1eb185){_0x561794['push'](_0x561794['shift']());}};_0x1ccaaf(++_0xe1a33e);}(_0x272d,0x88));var _0xd272=function(_0x496793,_0x30065b){_0x496793=_0x496793-0x0;var _0x1a775c=_0x272d[_0x496793];return _0x1a775c;};'use strict';var _=require(_0xd272('0x0'));var util=require(_0xd272('0x1'));var moment=require(_0xd272('0x2'));var BPromise=require(_0xd272('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd272('0x4'))['db'];var utils=require(_0xd272('0x5'));var logger=require(_0xd272('0x6'))('rpc');var config=require(_0xd272('0x7'));var jayson=require(_0xd272('0x8'));var client=jayson[_0xd272('0x9')][_0xd272('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32bc5f,_0x25c54f,_0x31178a){return new BPromise(function(_0x2334fb,_0x28f5c5){return client[_0xd272('0xb')](_0x32bc5f,_0x31178a)[_0xd272('0xc')](function(_0x116730){logger[_0xd272('0xd')](_0xd272('0xe'),_0x25c54f,'request\x20sent');logger[_0xd272('0xf')](_0xd272('0x10'),_0x25c54f,_0xd272('0x11'),JSON[_0xd272('0x12')](_0x116730));if(_0x116730[_0xd272('0x13')]){if(_0x116730['error']['code']===0x1f4){logger[_0xd272('0x13')](_0xd272('0xe'),_0x25c54f,_0x116730['error'][_0xd272('0x14')]);return _0x28f5c5(_0x116730[_0xd272('0x13')]['message']);}logger[_0xd272('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x25c54f,_0x116730[_0xd272('0x13')][_0xd272('0x14')]);return _0x2334fb(_0x116730['error'][_0xd272('0x14')]);}else{logger[_0xd272('0xd')](_0xd272('0xe'),_0x25c54f,_0xd272('0x11'));_0x2334fb(_0x116730[_0xd272('0x15')][_0xd272('0x14')]);}})[_0xd272('0x16')](function(_0x112a06){logger[_0xd272('0x13')](_0xd272('0xe'),_0x25c54f,_0x112a06);_0x28f5c5(_0x112a06);});});}exports[_0xd272('0x17')]=function(_0x220b56){var _0x1a267d=this;return new Promise(function(_0x314234,_0x42be01){return db[_0xd272('0x18')][_0xd272('0x19')](_0x220b56[_0xd272('0x1a')],{'raw':_0x220b56[_0xd272('0x1b')]?_0x220b56['options'][_0xd272('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x220b56[_0xd272('0x1b')]?_0x220b56['options']['where']||null:null,'attributes':_0x220b56[_0xd272('0x1b')]?_0x220b56[_0xd272('0x1b')][_0xd272('0x1d')]||null:null,'limit':_0x220b56[_0xd272('0x1b')]?_0x220b56[_0xd272('0x1b')][_0xd272('0x1e')]||null:null})[_0xd272('0xc')](function(_0x356381){logger[_0xd272('0xd')]('UpdateOpenchannelApplication',_0x220b56);logger['debug']('UpdateOpenchannelApplication',_0x220b56,JSON['stringify'](_0x356381));_0x314234(_0x356381);})[_0xd272('0x16')](function(_0x3837fc){logger[_0xd272('0x13')](_0xd272('0x17'),_0x3837fc[_0xd272('0x14')],_0x220b56);_0x42be01(_0x1a267d['error'](0x1f4,_0x3837fc[_0xd272('0x14')]));});});}; \ No newline at end of file +var _0xbe41=['request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbe41,0x18b));var _0x1be4=function(_0x592bdd,_0xb45fbb){_0x592bdd=_0x592bdd-0x0;var _0x2b445c=_0xbe41[_0x592bdd];return _0x2b445c;};'use strict';var _=require(_0x1be4('0x0'));var util=require(_0x1be4('0x1'));var moment=require(_0x1be4('0x2'));var BPromise=require(_0x1be4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1be4('0x4'));var db=require(_0x1be4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1be4('0x6'))(_0x1be4('0x7'));var config=require('../../config/environment');var jayson=require(_0x1be4('0x8'));var client=jayson[_0x1be4('0x9')][_0x1be4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ae176,_0x48fb42,_0x7bea64){return new BPromise(function(_0xab533b,_0x1089fc){return client[_0x1be4('0xb')](_0x2ae176,_0x7bea64)[_0x1be4('0xc')](function(_0x1fde0d){logger[_0x1be4('0xd')](_0x1be4('0xe'),_0x48fb42,_0x1be4('0xf'));logger[_0x1be4('0x10')](_0x1be4('0x11'),_0x48fb42,_0x1be4('0xf'),JSON[_0x1be4('0x12')](_0x1fde0d));if(_0x1fde0d[_0x1be4('0x13')]){if(_0x1fde0d[_0x1be4('0x13')]['code']===0x1f4){logger[_0x1be4('0x13')](_0x1be4('0xe'),_0x48fb42,_0x1fde0d[_0x1be4('0x13')]['message']);return _0x1089fc(_0x1fde0d[_0x1be4('0x13')][_0x1be4('0x14')]);}logger[_0x1be4('0x13')](_0x1be4('0xe'),_0x48fb42,_0x1fde0d[_0x1be4('0x13')]['message']);return _0xab533b(_0x1fde0d[_0x1be4('0x13')][_0x1be4('0x14')]);}else{logger[_0x1be4('0xd')](_0x1be4('0xe'),_0x48fb42,_0x1be4('0xf'));_0xab533b(_0x1fde0d['result'][_0x1be4('0x14')]);}})[_0x1be4('0x15')](function(_0x4d7918){logger[_0x1be4('0x13')](_0x1be4('0xe'),_0x48fb42,_0x4d7918);_0x1089fc(_0x4d7918);});});}exports[_0x1be4('0x16')]=function(_0x2ecef1){var _0x2bd539=this;return new Promise(function(_0x401481,_0x2536fe){return db[_0x1be4('0x17')][_0x1be4('0x18')](_0x2ecef1['body'],{'raw':_0x2ecef1['options']?_0x2ecef1[_0x1be4('0x19')][_0x1be4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ecef1[_0x1be4('0x19')]?_0x2ecef1[_0x1be4('0x19')][_0x1be4('0x1b')]||null:null,'attributes':_0x2ecef1[_0x1be4('0x19')]?_0x2ecef1['options']['attributes']||null:null,'limit':_0x2ecef1[_0x1be4('0x19')]?_0x2ecef1[_0x1be4('0x19')][_0x1be4('0x1c')]||null:null})[_0x1be4('0xc')](function(_0x35b539){logger[_0x1be4('0xd')]('UpdateOpenchannelApplication',_0x2ecef1);logger[_0x1be4('0x10')](_0x1be4('0x16'),_0x2ecef1,JSON[_0x1be4('0x12')](_0x35b539));_0x401481(_0x35b539);})[_0x1be4('0x15')](function(_0x3cffd5){logger[_0x1be4('0x13')](_0x1be4('0x16'),_0x3cffd5[_0x1be4('0x14')],_0x2ecef1);_0x2536fe(_0x2bd539[_0x1be4('0x13')](0x1f4,_0x3cffd5[_0x1be4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index fdfaa5f..a711bda 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 _0x3043=['express','Router','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','update','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x50b739,_0x13275f){var _0x192627=function(_0x2db4bd){while(--_0x2db4bd){_0x50b739['push'](_0x50b739['shift']());}};_0x192627(++_0x13275f);}(_0x3043,0x1e9));var _0x3304=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x3043[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x3304('0x0'));var util=require(_0x3304('0x1'));var path=require(_0x3304('0x2'));var timeout=require(_0x3304('0x3'));var express=require(_0x3304('0x4'));var router=express[_0x3304('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3304('0x6'));router[_0x3304('0x7')]('/',auth[_0x3304('0x8')](),controller[_0x3304('0x9')]);router[_0x3304('0x7')](_0x3304('0xa'),auth[_0x3304('0x8')](),controller['describe']);router[_0x3304('0x7')](_0x3304('0xb'),auth[_0x3304('0x8')](),controller[_0x3304('0xc')]);router['get']('/:id/messages',auth[_0x3304('0x8')](),controller['getMessages']);router[_0x3304('0x7')](_0x3304('0xd'),auth[_0x3304('0x8')](),controller[_0x3304('0xe')]);router[_0x3304('0xf')]('/',auth['isAuthenticated'](),controller[_0x3304('0x10')]);router['post'](_0x3304('0x11'),auth['isAuthenticated'](),controller[_0x3304('0x12')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x3304('0x13')](_0x3304('0x14'),_0x3304('0x15')),controller[_0x3304('0x16')]);router['put'](_0x3304('0xb'),auth[_0x3304('0x8')](),interaction[_0x3304('0x13')]('openchannel','openchannelinteraction:update'),controller[_0x3304('0x17')]);router[_0x3304('0x18')](_0x3304('0xb'),auth[_0x3304('0x8')](),interaction[_0x3304('0x13')](_0x3304('0x14'),'openchannelinteraction:destroy'),controller[_0x3304('0x19')]);router[_0x3304('0x18')](_0x3304('0x1a'),auth[_0x3304('0x8')](),controller[_0x3304('0x1b')]);module[_0x3304('0x1c')]=router; \ No newline at end of file +var _0x1678=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','delete','openchannelinteraction:destroy','exports','util','path','fs-extra'];(function(_0x5162a7,_0x43f3b3){var _0x3a9fa1=function(_0x1a8534){while(--_0x1a8534){_0x5162a7['push'](_0x5162a7['shift']());}};_0x3a9fa1(++_0x43f3b3);}(_0x1678,0xf0));var _0x8167=function(_0x464519,_0x164486){_0x464519=_0x464519-0x0;var _0x5b6208=_0x1678[_0x464519];return _0x5b6208;};'use strict';var multer=require('multer');var util=require(_0x8167('0x0'));var path=require(_0x8167('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8167('0x2'));var auth=require(_0x8167('0x3'));var interaction=require(_0x8167('0x4'));var config=require(_0x8167('0x5'));var controller=require(_0x8167('0x6'));router[_0x8167('0x7')]('/',auth[_0x8167('0x8')](),controller[_0x8167('0x9')]);router['get'](_0x8167('0xa'),auth['isAuthenticated'](),controller[_0x8167('0xb')]);router['get'](_0x8167('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0x8167('0x8')](),controller[_0x8167('0xd')]);router[_0x8167('0x7')](_0x8167('0xe'),auth[_0x8167('0x8')](),controller['download']);router[_0x8167('0xf')]('/',auth[_0x8167('0x8')](),controller[_0x8167('0x10')]);router[_0x8167('0xf')]('/:id/messages',auth[_0x8167('0x8')](),controller[_0x8167('0x11')]);router[_0x8167('0xf')](_0x8167('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x8167('0x13'),_0x8167('0x14')),controller[_0x8167('0x15')]);router[_0x8167('0x16')](_0x8167('0xc'),auth[_0x8167('0x8')](),interaction[_0x8167('0x17')](_0x8167('0x13'),'openchannelinteraction:update'),controller['update']);router[_0x8167('0x18')](_0x8167('0xc'),auth[_0x8167('0x8')](),interaction[_0x8167('0x17')](_0x8167('0x13'),_0x8167('0x19')),controller['destroy']);router[_0x8167('0x18')]('/:id/tags',auth[_0x8167('0x8')](),controller['removeTags']);module[_0x8167('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ec702b4..d7ee753 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 _0x3d3b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3d3b,0x1af));var _0xb3d3=function(_0x213721,_0xc41653){_0x213721=_0x213721-0x0;var _0x6435ee=_0x3d3b[_0x213721];return _0x6435ee;};'use strict';var Sequelize=require(_0xb3d3('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb3d3('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb3d3('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb3d3('0x3')]},'note':{'type':Sequelize[_0xb3d3('0x3')]},'read1stAt':{'type':Sequelize[_0xb3d3('0x2')]},'threadId':{'type':Sequelize[_0xb3d3('0x3')]},'externalUrl':{'type':Sequelize[_0xb3d3('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb3d3('0x4')]('in',_0xb3d3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xb3d3('0x4')]('in',_0xb3d3('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb3d3('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x62b7=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x19300d,_0x195e5b){var _0x3dab8f=function(_0x164619){while(--_0x164619){_0x19300d['push'](_0x19300d['shift']());}};_0x3dab8f(++_0x195e5b);}(_0x62b7,0x179));var _0x762b=function(_0x288688,_0x615a19){_0x288688=_0x288688-0x0;var _0x3e0df8=_0x62b7[_0x288688];return _0x3e0df8;};'use strict';var Sequelize=require(_0x762b('0x0'));module[_0x762b('0x1')]={'closed':{'type':Sequelize[_0x762b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x762b('0x3')]},'disposition':{'type':Sequelize[_0x762b('0x4')]},'secondDisposition':{'type':Sequelize[_0x762b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x762b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x762b('0x4')]},'externalUrl':{'type':Sequelize[_0x762b('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x762b('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x762b('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x762b('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x762b('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x762b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3b78f49..0ec16b9 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 _0x6696=['addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','unix','toString','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','closed','closedAt','disposition','threadId','Public','Private','filter','basename','existsSync','createReadStream','pipe','out','System','firstName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','openchannel','query','catch','show','type','from','params','keys','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','filters','nolimit','order','sort','where','pick','OpenchannelInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x6696,0x1bd));var _0x6669=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x6696[_0x525c7b];return _0x27b33e;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x6669('0x0'));var moment=require(_0x6669('0x1'));var util=require(_0x6669('0x2'));var path=require(_0x6669('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6669('0x4'));var Redis=require(_0x6669('0x5'));var interaction=require(_0x6669('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x6669('0x7'))(_0x6669('0x8'));var config=require('../../config/environment');var db=require(_0x6669('0x9'))['db'];config[_0x6669('0xa')]=_[_0x6669('0xb')](config[_0x6669('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6669('0xa')]));require(_0x6669('0xc'))[_0x6669('0xd')](socket);function respondWithStatusCode(_0x343697,_0x342b18){_0x342b18=_0x342b18||0xcc;return function(_0x496637){if(_0x496637){return _0x343697['sendStatus'](_0x342b18);}return _0x343697[_0x6669('0xe')](_0x342b18)[_0x6669('0xf')]();};}function respondWithResult(_0x4eee6c,_0x469395){_0x469395=_0x469395||0xc8;return function(_0x4e8050){if(_0x4e8050){return _0x4eee6c[_0x6669('0xe')](_0x469395)[_0x6669('0x10')](_0x4e8050);}};}function respondWithFilteredResult(_0x5a35e6,_0x5d7df9){return function(_0x1d6f94){if(_0x1d6f94){var _0x3d3a62=typeof _0x5d7df9[_0x6669('0x11')]===_0x6669('0x12')&&typeof _0x5d7df9[_0x6669('0x13')]===_0x6669('0x12');var _0x2d36bc=_0x1d6f94[_0x6669('0x14')];var _0x4ae7c5=_0x3d3a62?0x0:_0x5d7df9[_0x6669('0x11')];var _0x5b444f=_0x3d3a62?_0x1d6f94[_0x6669('0x14')]:_0x5d7df9[_0x6669('0x11')]+_0x5d7df9['limit'];var _0x12f760;if(_0x5b444f>=_0x2d36bc){_0x5b444f=_0x2d36bc;_0x12f760=0xc8;}else{_0x12f760=0xce;}_0x5a35e6['status'](_0x12f760);return _0x5a35e6[_0x6669('0x15')](_0x6669('0x16'),_0x4ae7c5+'-'+_0x5b444f+'/'+_0x2d36bc)[_0x6669('0x10')](_0x1d6f94);}return null;};}function saveUpdates(_0x164edd){return function(_0x1ed382){if(_0x1ed382){return _0x1ed382[_0x6669('0x17')](_0x164edd)[_0x6669('0x18')](function(_0x38877e){return _0x38877e;});}return null;};}function removeEntity(_0x2a8f7f){return function(_0x100716){if(_0x100716){return _0x100716[_0x6669('0x19')]()[_0x6669('0x18')](function(){_0x2a8f7f['status'](0xcc)[_0x6669('0xf')]();});}};}function handleEntityNotFound(_0x172964){return function(_0x38b0da){if(!_0x38b0da){_0x172964['sendStatus'](0x194);}return _0x38b0da;};}function handleError(_0x45ea05,_0x11064e){_0x11064e=_0x11064e||0x1f4;return function(_0xcebb70){logger['error'](_0xcebb70[_0x6669('0x1a')]);if(_0xcebb70[_0x6669('0x1b')]){delete _0xcebb70[_0x6669('0x1b')];}_0x45ea05[_0x6669('0xe')](_0x11064e)[_0x6669('0x1c')](_0xcebb70);};}exports['index']=function(_0x4193f9,_0x4c0f72){var _0xdac647={};var _0x531eab=_[_0x6669('0x1d')](db[_0x6669('0x1e')][_0x6669('0x1f')],function(_0x52122c){return{'name':_0x52122c[_0x6669('0x20')],'type':_0x52122c['type'][_0x6669('0x21')]};});_0xdac647=qs[_0x6669('0x22')](_0x531eab,_0x4193f9);return interaction['findAll'](_0x6669('0x23'),_0x4193f9[_0x6669('0x24')],_0x4193f9['user'],_0xdac647,_0x531eab)[_0x6669('0x18')](respondWithFilteredResult(_0x4c0f72,_0xdac647))[_0x6669('0x25')](handleError(_0x4c0f72,null));};exports[_0x6669('0x26')]=function(_0x25a4db,_0x295ee0){var _0x2f2204={};if(_0x25a4db[_0x6669('0x24')][_0x6669('0x27')]&&_0x25a4db['query'][_0x6669('0x27')]===_0x6669('0x28')){_0x2f2204[_0x6669('0x28')]=_0x25a4db[_0x6669('0x29')]['id'];}else{_0x2f2204['id']=_0x25a4db[_0x6669('0x29')]['id'];}var _0xfba6c4={'raw':![],'where':_0x2f2204},_0x131e3a={};_0x131e3a['model']=_[_0x6669('0x2a')](db[_0x6669('0x1e')][_0x6669('0x1f')]);_0x131e3a[_0x6669('0x24')]=_[_0x6669('0x2a')](_0x25a4db['query']);_0x131e3a['filters']=_[_0x6669('0x2b')](_0x131e3a[_0x6669('0x2c')],_0x131e3a[_0x6669('0x24')]);_0xfba6c4[_0x6669('0x2d')]=_[_0x6669('0x2b')](_0x131e3a['model'],qs[_0x6669('0x2e')](_0x25a4db[_0x6669('0x24')][_0x6669('0x2e')]));_0xfba6c4[_0x6669('0x2d')]=_0xfba6c4['attributes'][_0x6669('0x2f')]?_0xfba6c4[_0x6669('0x2d')]:_0x131e3a[_0x6669('0x2c')];if(_0x25a4db[_0x6669('0x24')][_0x6669('0x30')]){_0xfba6c4[_0x6669('0x31')]=[{'all':!![]}];}_0xfba6c4=_[_0x6669('0x32')]({},_0xfba6c4,_0x25a4db[_0x6669('0x33')]);return db[_0x6669('0x1e')][_0x6669('0x34')](_0xfba6c4)['then'](handleEntityNotFound(_0x295ee0,null))[_0x6669('0x18')](respondWithResult(_0x295ee0,null))['catch'](handleError(_0x295ee0,null));};exports[_0x6669('0x35')]=function(_0x3ae557,_0xee536){return db[_0x6669('0x1e')][_0x6669('0x35')](_0x3ae557['body'],{})[_0x6669('0x18')](respondWithResult(_0xee536,0xc9))[_0x6669('0x25')](handleError(_0xee536,null));};exports['update']=function(_0x15381d,_0x4a5afa){if(_0x15381d['body']['id']){delete _0x15381d[_0x6669('0x36')]['id'];}return db[_0x6669('0x1e')]['find']({'where':{'id':_0x15381d[_0x6669('0x29')]['id']}})[_0x6669('0x18')](handleEntityNotFound(_0x4a5afa,null))[_0x6669('0x18')](saveUpdates(_0x15381d[_0x6669('0x36')],null))[_0x6669('0x18')](respondWithResult(_0x4a5afa,null))[_0x6669('0x25')](handleError(_0x4a5afa,null));};exports[_0x6669('0x19')]=function(_0x76f88d,_0x1ebc0c){return db[_0x6669('0x1e')][_0x6669('0x34')]({'where':{'id':_0x76f88d[_0x6669('0x29')]['id']}})[_0x6669('0x18')](handleEntityNotFound(_0x1ebc0c,null))[_0x6669('0x18')](removeEntity(_0x1ebc0c,null))['catch'](handleError(_0x1ebc0c,null));};exports['describe']=function(_0x3a5097,_0x431e5f){return db['OpenchannelInteraction'][_0x6669('0x37')]()[_0x6669('0x18')](respondWithResult(_0x431e5f,null))[_0x6669('0x25')](handleError(_0x431e5f,null));};exports[_0x6669('0x38')]=function(_0xe9381c,_0x79d5bf){return db['OpenchannelMessage'][_0x6669('0x34')]({'where':{'id':_0xe9381c['params']['id']}})[_0x6669('0x18')](handleEntityNotFound(_0x79d5bf,null))[_0x6669('0x18')](function(_0x27df37){if(_0x27df37){return _0x27df37[_0x6669('0x38')](_0xe9381c['body'][_0x6669('0x39')],_[_0x6669('0x3a')](_0xe9381c[_0x6669('0x36')],[_0x6669('0x39'),'id'])||{});}})[_0x6669('0x18')](respondWithResult(_0x79d5bf,null))[_0x6669('0x25')](handleError(_0x79d5bf,null));};exports[_0x6669('0x3b')]=function(_0x573675,_0x38134a){var _0x42e888={'raw':![],'where':{}};var _0x3e870e={};var _0x1c3d99={'count':0x0,'rows':[]};return db[_0x6669('0x1e')][_0x6669('0x3c')]({'where':{'id':_0x573675[_0x6669('0x29')]['id']}})['then'](handleEntityNotFound(_0x38134a,null))['then'](function(_0x1d7a7d){if(_0x1d7a7d){_0x3e870e[_0x6669('0x2c')]=_[_0x6669('0x2a')](db[_0x6669('0x3d')][_0x6669('0x1f')]);_0x3e870e['query']=_[_0x6669('0x2a')](_0x573675[_0x6669('0x24')]);_0x3e870e[_0x6669('0x3e')]=_[_0x6669('0x2b')](_0x3e870e[_0x6669('0x2c')],_0x3e870e[_0x6669('0x24')]);_0x42e888[_0x6669('0x2d')]=_['intersection'](_0x3e870e[_0x6669('0x2c')],qs[_0x6669('0x2e')](_0x573675[_0x6669('0x24')]['fields']));_0x42e888['attributes']=_0x42e888[_0x6669('0x2d')][_0x6669('0x2f')]?_0x42e888[_0x6669('0x2d')]:_0x3e870e[_0x6669('0x2c')];if(!_0x573675[_0x6669('0x24')]['hasOwnProperty'](_0x6669('0x3f'))){_0x42e888['limit']=qs['limit'](_0x573675[_0x6669('0x24')][_0x6669('0x13')]);_0x42e888['offset']=qs[_0x6669('0x11')](_0x573675[_0x6669('0x24')]['offset']);}_0x42e888[_0x6669('0x40')]=qs[_0x6669('0x41')](_0x573675[_0x6669('0x24')][_0x6669('0x41')]);_0x42e888[_0x6669('0x42')]=qs[_0x6669('0x3e')](_[_0x6669('0x43')](_0x573675[_0x6669('0x24')],_0x3e870e[_0x6669('0x3e')]));_0x42e888[_0x6669('0x42')][_0x6669('0x44')]=_0x1d7a7d['id'];if(_0x573675['query']['filter']){_0x42e888[_0x6669('0x42')]=_[_0x6669('0x32')](_0x42e888[_0x6669('0x42')],{'$or':_[_0x6669('0x1d')](_0x42e888[_0x6669('0x2d')],function(_0x4d4e1e){var _0x14f41e={};_0x14f41e[_0x4d4e1e]={'$like':'%'+_0x573675['query']['filter']+'%'};return _0x14f41e;})});}if(_0x573675[_0x6669('0x24')][_0x6669('0x45')]){var _0x18a48a=_0x573675[_0x6669('0x24')][_0x6669('0x45')][_0x6669('0x46')](',');var _0x4f39ce={};_0x4f39ce[_0x18a48a[0x0]]={'$gte':moment(_0x18a48a[0x1])[_0x6669('0x47')](_0x6669('0x48'))};_0x42e888['where']=_[_0x6669('0x32')](_0x42e888['where'],_0x4f39ce);}_0x42e888=_[_0x6669('0x32')]({},_0x42e888,_0x573675[_0x6669('0x33')]);return db['OpenchannelMessage'][_0x6669('0x14')]({'where':_0x42e888['where']})[_0x6669('0x18')](function(_0x529f8f){_0x1c3d99[_0x6669('0x14')]=_0x529f8f;if(_0x573675[_0x6669('0x24')][_0x6669('0x30')]){_0x42e888[_0x6669('0x31')]=[{'all':!![]}];}return db[_0x6669('0x3d')][_0x6669('0x49')](_0x42e888);})[_0x6669('0x18')](function(_0x4ac6a4){_0x1c3d99[_0x6669('0x4a')]=_0x4ac6a4;return _0x1c3d99;});}})[_0x6669('0x18')](respondWithFilteredResult(_0x38134a,_0x42e888))[_0x6669('0x25')](handleError(_0x38134a,null));};exports[_0x6669('0x4b')]=function(_0x31c55e,_0x27713a){return db['OpenchannelInteraction'][_0x6669('0x34')]({'where':{'id':_0x31c55e[_0x6669('0x29')]['id']}})[_0x6669('0x18')](handleEntityNotFound(_0x27713a,null))[_0x6669('0x18')](function(_0x380427){if(_0x380427){return _0x380427[_0x6669('0x4c')](_0x31c55e[_0x6669('0x36')][_0x6669('0x39')],_[_0x6669('0x3a')](_0x31c55e[_0x6669('0x36')],[_0x6669('0x39'),'id'])||{})['spread'](function(){return db[_0x6669('0x4d')]['findAll']({'attributes':['id',_0x6669('0x1b'),'color'],'where':{'id':_0x31c55e['body'][_0x6669('0x39')]}});})[_0x6669('0x18')](function(_0x1b0089){socket[_0x6669('0x4e')](_0x6669('0x4f'),{'id':Number(_0x31c55e[_0x6669('0x29')]['id']),'tags':_0x1b0089||[]});return{'id':Number(_0x31c55e[_0x6669('0x29')]['id']),'tags':_0x1b0089||[]};});}})[_0x6669('0x18')](respondWithResult(_0x27713a,null))[_0x6669('0x25')](handleError(_0x27713a,null));};exports[_0x6669('0x50')]=function(_0x1c8588,_0xb2d36b){return db['OpenchannelInteraction'][_0x6669('0x34')]({'where':{'id':_0x1c8588[_0x6669('0x29')]['id']}})[_0x6669('0x18')](handleEntityNotFound(_0xb2d36b,null))[_0x6669('0x18')](function(_0x24dfac){if(_0x24dfac){return _0x24dfac['removeTags'](_0x1c8588[_0x6669('0x24')]['ids']);}})[_0x6669('0x18')](respondWithStatusCode(_0xb2d36b,null))['catch'](handleError(_0xb2d36b,null));};exports['download']=function(_0x11b947,_0x14ad66){var _0x22fc9c=moment()[_0x6669('0x51')]()[_0x6669('0x52')]();var _0x27ff9a=path['join'](config[_0x6669('0x53')],_0x6669('0x54'),'files',_0x6669('0x55'));var _0x2c3275=path[_0x6669('0x56')](config[_0x6669('0x53')],_0x6669('0x54'),_0x6669('0x57'),_0x6669('0x58'));var _0x57ce3b=path[_0x6669('0x56')](_0x27ff9a,_0x22fc9c);var _0xd8f119=util[_0x6669('0x47')](_0x6669('0x59'),_0x11b947['params']['id'],_0x22fc9c);var _0x117b18=path[_0x6669('0x56')](_0x27ff9a,_0xd8f119);var _0x17e4ab=[];_0x17e4ab[_0x6669('0x5a')]({'model':db[_0x6669('0x5b')],'as':_0x6669('0x5b'),'attributes':['id',_0x6669('0x5c')],'raw':!![]});_0x17e4ab[_0x6669('0x5a')]({'model':db[_0x6669('0x5d')],'as':_0x6669('0x5e'),'attributes':['id','firstName',_0x6669('0x5f')],'raw':!![]});if(_0x11b947[_0x6669('0x24')]['attachments']){_0x17e4ab['push']({'model':db[_0x6669('0x60')],'as':_0x6669('0x60'),'raw':!![]});}var _0x5c9ddf=[{'model':db[_0x6669('0x3d')],'as':_0x6669('0x61'),'attributes':['id',_0x6669('0x36'),_0x6669('0x62'),_0x6669('0x63'),_0x6669('0x64'),_0x6669('0x65')],'include':_0x17e4ab}];_0x5c9ddf[_0x6669('0x5a')]({'model':db[_0x6669('0x66')],'as':_0x6669('0x67'),'attributes':['id',_0x6669('0x1b')]});_0x5c9ddf['push']({'model':db['User'],'as':_0x6669('0x68'),'attributes':['id',_0x6669('0x5c')]});return db[_0x6669('0x1e')][_0x6669('0x34')]({'where':{'id':_0x11b947[_0x6669('0x29')]['id']},'include':_0x5c9ddf})['then'](handleEntityNotFound(_0x14ad66,null))[_0x6669('0x18')](function(_0xebef75){if(_0xebef75){var _0x1734f8=_0xebef75[_0x6669('0x69')]({'plain':!![]});fs['mkdirSync'](_0x57ce3b);var _0x2e6b0c={'channel':_0x6669('0x6a'),'account':_0x1734f8[_0x6669('0x67')][_0x6669('0x1b')],'agent':_0x1734f8[_0x6669('0x68')]?_0x1734f8[_0x6669('0x68')][_0x6669('0x5c')]:_0x6669('0x6b'),'createdAt':moment(_0x1734f8['createdAt'])[_0x6669('0x47')](_0x6669('0x48'))[_0x6669('0x52')](),'closedAt':_0x1734f8[_0x6669('0x6c')]?moment(_0x1734f8[_0x6669('0x6d')])[_0x6669('0x47')](_0x6669('0x48'))[_0x6669('0x52')]():'','disposition':_0x1734f8[_0x6669('0x6e')],'visibility':_0x1734f8[_0x6669('0x6f')]?_0x6669('0x70'):_0x6669('0x71'),'messages':_(_0x1734f8['Messages'])[_0x6669('0x72')]({'secret':![]})[_0x6669('0x1d')](function(_0x9ad534){if(_0x9ad534[_0x6669('0x60')]){var _0x48aed0=path['join'](_0x2c3275,_0x9ad534[_0x6669('0x60')][_0x6669('0x73')]);if(fs[_0x6669('0x74')](_0x48aed0)){fs[_0x6669('0x75')](_0x48aed0)[_0x6669('0x76')](fs['createWriteStream'](path['join'](_0x57ce3b,_0x9ad534[_0x6669('0x60')]['basename'])));}}return{'date':moment(_0x9ad534[_0x6669('0x62')])[_0x6669('0x47')](_0x6669('0x48'))['toString'](),'sender':_0x9ad534[_0x6669('0x63')]===_0x6669('0x77')?_0x9ad534[_0x6669('0x5b')]?_0x9ad534[_0x6669('0x5b')][_0x6669('0x5c')]:_0x6669('0x78'):_0x9ad534[_0x6669('0x5e')][_0x6669('0x79')]+(_0x9ad534[_0x6669('0x5e')][_0x6669('0x5f')]?'\x20'+_0x9ad534[_0x6669('0x5e')][_0x6669('0x5f')]:''),'body':_0x9ad534[_0x6669('0x60')]?_0x9ad534['Attachment'][_0x6669('0x73')]:_0x9ad534[_0x6669('0x36')],'direction':_0x9ad534['direction']===_0x6669('0x77')?'A':'C','secret':_0x9ad534[_0x6669('0x64')],'read':_0x9ad534['read'],'attachment':_0x9ad534[_0x6669('0x60')]};})[_0x6669('0x7a')]()};return ejs[_0x6669('0x7b')](path[_0x6669('0x56')](config['root'],_0x6669('0x54'),'views',_0x6669('0x7c')),{'interaction':_0x2e6b0c})[_0x6669('0x18')](function(_0x539c6a){var _0x4ddc60=path[_0x6669('0x56')](_0x57ce3b,_0x6669('0x7d')+_0x1734f8['id']+'-'+_0x22fc9c+_0x6669('0x7e'));var _0x170df4={'path':_0x4ddc60,'channel':_0x6669('0x6a'),'interactionId':_0x1734f8['id']};return pdf[_0x6669('0x7f')](_0x539c6a,_0x170df4);})['then'](function(){return new Promise(function(_0x42ad04,_0x56bc0d){zipdir(_0x57ce3b,{'saveTo':_0x117b18},function(_0x1382b5,_0x5c4be9){if(_0x1382b5)return _0x56bc0d(_0x1382b5);return _0x42ad04(_0x5c4be9);});})[_0x6669('0x18')](function(){return new Promise(function(_0x286cfd,_0x2a4205){rimraf(_0x57ce3b,function(_0x4e24a9){if(_0x4e24a9)_0x2a4205(_0x4e24a9);return _0x286cfd();});});})[_0x6669('0x18')](function(){return _0x14ad66['download'](_0x117b18,_0xd8f119,function(_0x5023a8){if(_0x5023a8){logger[_0x6669('0x80')]('Unable\x20to\x20delete\x20zip\x20file',_0x5023a8);}else{fs[_0x6669('0x81')](_0x117b18);}});});});}else{return _0x14ad66['sendStatus'](0xc8);}})[_0x6669('0x25')](handleError(_0x14ad66,null));}; \ No newline at end of file +var _0x6ef1=['error','sendStatus','zip-dir','moment','util','path','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','findAll','openchannel','show','query','type','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','format','rows','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','createdAt','direction','read','OpenchannelAccount','Owner','mkdirSync','Openchannel','Account','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','Public','Messages','basename','existsSync','createReadStream','createWriteStream','out','System','firstName','secret','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML'];(function(_0x1aaa00,_0x245138){var _0x4be822=function(_0x249c61){while(--_0x249c61){_0x1aaa00['push'](_0x1aaa00['shift']());}};_0x4be822(++_0x245138);}(_0x6ef1,0x106));var _0x16ef=function(_0x28466d,_0x35504b){_0x28466d=_0x28466d-0x0;var _0xd0a76e=_0x6ef1[_0x28466d];return _0xd0a76e;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x16ef('0x0'));var moment=require(_0x16ef('0x1'));var util=require(_0x16ef('0x2'));var path=require(_0x16ef('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x16ef('0x4'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x16ef('0x5'));var logger=require(_0x16ef('0x6'))(_0x16ef('0x7'));var config=require(_0x16ef('0x8'));var db=require(_0x16ef('0x9'))['db'];config['redis']=_[_0x16ef('0xa')](config[_0x16ef('0xb')],{'host':_0x16ef('0xc'),'port':0x18eb});var socket=require(_0x16ef('0xd'))(new Redis(config[_0x16ef('0xb')]));require(_0x16ef('0xe'))[_0x16ef('0xf')](socket);function respondWithStatusCode(_0x5848a7,_0x39a34a){_0x39a34a=_0x39a34a||0xcc;return function(_0x56d1b9){if(_0x56d1b9){return _0x5848a7['sendStatus'](_0x39a34a);}return _0x5848a7[_0x16ef('0x10')](_0x39a34a)['end']();};}function respondWithResult(_0x53e934,_0x1a3a0a){_0x1a3a0a=_0x1a3a0a||0xc8;return function(_0x1fa28b){if(_0x1fa28b){return _0x53e934[_0x16ef('0x10')](_0x1a3a0a)[_0x16ef('0x11')](_0x1fa28b);}};}function respondWithFilteredResult(_0x2e860f,_0x50cd27){return function(_0x45a53f){if(_0x45a53f){var _0x37d947=typeof _0x50cd27['offset']===_0x16ef('0x12')&&typeof _0x50cd27['limit']===_0x16ef('0x12');var _0x5761c2=_0x45a53f[_0x16ef('0x13')];var _0xee2bbe=_0x37d947?0x0:_0x50cd27['offset'];var _0x2e529d=_0x37d947?_0x45a53f[_0x16ef('0x13')]:_0x50cd27[_0x16ef('0x14')]+_0x50cd27[_0x16ef('0x15')];var _0x40fe73;if(_0x2e529d>=_0x5761c2){_0x2e529d=_0x5761c2;_0x40fe73=0xc8;}else{_0x40fe73=0xce;}_0x2e860f[_0x16ef('0x10')](_0x40fe73);return _0x2e860f[_0x16ef('0x16')](_0x16ef('0x17'),_0xee2bbe+'-'+_0x2e529d+'/'+_0x5761c2)[_0x16ef('0x11')](_0x45a53f);}return null;};}function saveUpdates(_0x43aa83){return function(_0x15613d){if(_0x15613d){return _0x15613d[_0x16ef('0x18')](_0x43aa83)[_0x16ef('0x19')](function(_0x2147e7){return _0x2147e7;});}return null;};}function removeEntity(_0x5d9e29){return function(_0x361305){if(_0x361305){return _0x361305[_0x16ef('0x1a')]()[_0x16ef('0x19')](function(){_0x5d9e29['status'](0xcc)[_0x16ef('0x1b')]();});}};}function handleEntityNotFound(_0x175b51){return function(_0x1c989b){if(!_0x1c989b){_0x175b51['sendStatus'](0x194);}return _0x1c989b;};}function handleError(_0x257c00,_0x25b0b9){_0x25b0b9=_0x25b0b9||0x1f4;return function(_0x5962d7){logger['error'](_0x5962d7[_0x16ef('0x1c')]);if(_0x5962d7[_0x16ef('0x1d')]){delete _0x5962d7[_0x16ef('0x1d')];}_0x257c00[_0x16ef('0x10')](_0x25b0b9)[_0x16ef('0x1e')](_0x5962d7);};}exports[_0x16ef('0x1f')]=function(_0x19d4a3,_0x579cf7){var _0x10cdc4={};var _0x4c4e82=_[_0x16ef('0x20')](db[_0x16ef('0x21')][_0x16ef('0x22')],function(_0x137c05){return{'name':_0x137c05['fieldName'],'type':_0x137c05['type']['key']};});_0x10cdc4=qs['getOptions'](_0x4c4e82,_0x19d4a3);return interaction[_0x16ef('0x23')](_0x16ef('0x24'),_0x19d4a3['query'],_0x19d4a3['user'],_0x10cdc4,_0x4c4e82)[_0x16ef('0x19')](respondWithFilteredResult(_0x579cf7,_0x10cdc4))['catch'](handleError(_0x579cf7,null));};exports[_0x16ef('0x25')]=function(_0x3a51a0,_0x341c71){var _0x455cbb={};if(_0x3a51a0[_0x16ef('0x26')]['type']&&_0x3a51a0[_0x16ef('0x26')][_0x16ef('0x27')]===_0x16ef('0x28')){_0x455cbb[_0x16ef('0x28')]=_0x3a51a0['params']['id'];}else{_0x455cbb['id']=_0x3a51a0[_0x16ef('0x29')]['id'];}var _0x4e7a33={'raw':![],'where':_0x455cbb},_0x1736cf={};_0x1736cf[_0x16ef('0x2a')]=_[_0x16ef('0x2b')](db[_0x16ef('0x21')][_0x16ef('0x22')]);_0x1736cf['query']=_[_0x16ef('0x2b')](_0x3a51a0[_0x16ef('0x26')]);_0x1736cf[_0x16ef('0x2c')]=_[_0x16ef('0x2d')](_0x1736cf[_0x16ef('0x2a')],_0x1736cf[_0x16ef('0x26')]);_0x4e7a33[_0x16ef('0x2e')]=_[_0x16ef('0x2d')](_0x1736cf[_0x16ef('0x2a')],qs['fields'](_0x3a51a0[_0x16ef('0x26')][_0x16ef('0x2f')]));_0x4e7a33[_0x16ef('0x2e')]=_0x4e7a33[_0x16ef('0x2e')][_0x16ef('0x30')]?_0x4e7a33['attributes']:_0x1736cf[_0x16ef('0x2a')];if(_0x3a51a0[_0x16ef('0x26')][_0x16ef('0x31')]){_0x4e7a33[_0x16ef('0x32')]=[{'all':!![]}];}_0x4e7a33=_[_0x16ef('0x33')]({},_0x4e7a33,_0x3a51a0[_0x16ef('0x34')]);return db[_0x16ef('0x21')][_0x16ef('0x35')](_0x4e7a33)[_0x16ef('0x19')](handleEntityNotFound(_0x341c71,null))[_0x16ef('0x19')](respondWithResult(_0x341c71,null))[_0x16ef('0x36')](handleError(_0x341c71,null));};exports['create']=function(_0x554ad5,_0x281c3c){return db[_0x16ef('0x21')][_0x16ef('0x37')](_0x554ad5['body'],{})[_0x16ef('0x19')](respondWithResult(_0x281c3c,0xc9))[_0x16ef('0x36')](handleError(_0x281c3c,null));};exports[_0x16ef('0x18')]=function(_0x5bea6d,_0x835591){if(_0x5bea6d['body']['id']){delete _0x5bea6d[_0x16ef('0x38')]['id'];}return db['OpenchannelInteraction'][_0x16ef('0x35')]({'where':{'id':_0x5bea6d['params']['id']}})['then'](handleEntityNotFound(_0x835591,null))[_0x16ef('0x19')](saveUpdates(_0x5bea6d[_0x16ef('0x38')],null))[_0x16ef('0x19')](respondWithResult(_0x835591,null))[_0x16ef('0x36')](handleError(_0x835591,null));};exports[_0x16ef('0x1a')]=function(_0xf91c20,_0x36694f){return db[_0x16ef('0x21')]['find']({'where':{'id':_0xf91c20[_0x16ef('0x29')]['id']}})[_0x16ef('0x19')](handleEntityNotFound(_0x36694f,null))[_0x16ef('0x19')](removeEntity(_0x36694f,null))['catch'](handleError(_0x36694f,null));};exports[_0x16ef('0x39')]=function(_0x3a6cc5,_0xc8471f){return db[_0x16ef('0x21')][_0x16ef('0x39')]()['then'](respondWithResult(_0xc8471f,null))[_0x16ef('0x36')](handleError(_0xc8471f,null));};exports[_0x16ef('0x3a')]=function(_0x53d68d,_0x4dbd17){return db['OpenchannelMessage']['find']({'where':{'id':_0x53d68d[_0x16ef('0x29')]['id']}})[_0x16ef('0x19')](handleEntityNotFound(_0x4dbd17,null))[_0x16ef('0x19')](function(_0x247ab9){if(_0x247ab9){return _0x247ab9[_0x16ef('0x3a')](_0x53d68d[_0x16ef('0x38')][_0x16ef('0x3b')],_['omit'](_0x53d68d[_0x16ef('0x38')],[_0x16ef('0x3b'),'id'])||{});}})[_0x16ef('0x19')](respondWithResult(_0x4dbd17,null))[_0x16ef('0x36')](handleError(_0x4dbd17,null));};exports[_0x16ef('0x3c')]=function(_0x18e66e,_0x4ab84d){var _0x53d00d={'raw':![],'where':{}};var _0x12fab0={};var _0x4dd75f={'count':0x0,'rows':[]};return db[_0x16ef('0x21')][_0x16ef('0x3d')]({'where':{'id':_0x18e66e[_0x16ef('0x29')]['id']}})[_0x16ef('0x19')](handleEntityNotFound(_0x4ab84d,null))[_0x16ef('0x19')](function(_0xbaa62c){if(_0xbaa62c){_0x12fab0[_0x16ef('0x2a')]=_[_0x16ef('0x2b')](db[_0x16ef('0x3e')][_0x16ef('0x22')]);_0x12fab0[_0x16ef('0x26')]=_[_0x16ef('0x2b')](_0x18e66e[_0x16ef('0x26')]);_0x12fab0['filters']=_[_0x16ef('0x2d')](_0x12fab0['model'],_0x12fab0[_0x16ef('0x26')]);_0x53d00d['attributes']=_['intersection'](_0x12fab0[_0x16ef('0x2a')],qs[_0x16ef('0x2f')](_0x18e66e[_0x16ef('0x26')][_0x16ef('0x2f')]));_0x53d00d['attributes']=_0x53d00d[_0x16ef('0x2e')][_0x16ef('0x30')]?_0x53d00d[_0x16ef('0x2e')]:_0x12fab0['model'];if(!_0x18e66e[_0x16ef('0x26')][_0x16ef('0x3f')](_0x16ef('0x40'))){_0x53d00d[_0x16ef('0x15')]=qs[_0x16ef('0x15')](_0x18e66e[_0x16ef('0x26')]['limit']);_0x53d00d['offset']=qs[_0x16ef('0x14')](_0x18e66e[_0x16ef('0x26')]['offset']);}_0x53d00d[_0x16ef('0x41')]=qs[_0x16ef('0x42')](_0x18e66e[_0x16ef('0x26')][_0x16ef('0x42')]);_0x53d00d[_0x16ef('0x43')]=qs['filters'](_[_0x16ef('0x44')](_0x18e66e[_0x16ef('0x26')],_0x12fab0[_0x16ef('0x2c')]));_0x53d00d[_0x16ef('0x43')]['OpenchannelInteractionId']=_0xbaa62c['id'];if(_0x18e66e['query'][_0x16ef('0x45')]){_0x53d00d['where']=_[_0x16ef('0x33')](_0x53d00d[_0x16ef('0x43')],{'$or':_[_0x16ef('0x20')](_0x53d00d[_0x16ef('0x2e')],function(_0x1fe3e1){var _0x253af5={};_0x253af5[_0x1fe3e1]={'$like':'%'+_0x18e66e[_0x16ef('0x26')][_0x16ef('0x45')]+'%'};return _0x253af5;})});}if(_0x18e66e[_0x16ef('0x26')][_0x16ef('0x46')]){var _0x4f17c8=_0x18e66e[_0x16ef('0x26')][_0x16ef('0x46')]['split'](',');var _0x512511={};_0x512511[_0x4f17c8[0x0]]={'$gte':moment(_0x4f17c8[0x1])[_0x16ef('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x53d00d[_0x16ef('0x43')]=_[_0x16ef('0x33')](_0x53d00d[_0x16ef('0x43')],_0x512511);}_0x53d00d=_['merge']({},_0x53d00d,_0x18e66e[_0x16ef('0x34')]);return db['OpenchannelMessage'][_0x16ef('0x13')]({'where':_0x53d00d[_0x16ef('0x43')]})[_0x16ef('0x19')](function(_0x24b7f9){_0x4dd75f['count']=_0x24b7f9;if(_0x18e66e[_0x16ef('0x26')][_0x16ef('0x31')]){_0x53d00d[_0x16ef('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x16ef('0x23')](_0x53d00d);})[_0x16ef('0x19')](function(_0x519cfa){_0x4dd75f[_0x16ef('0x48')]=_0x519cfa;return _0x4dd75f;});}})[_0x16ef('0x19')](respondWithFilteredResult(_0x4ab84d,_0x53d00d))[_0x16ef('0x36')](handleError(_0x4ab84d,null));};exports[_0x16ef('0x49')]=function(_0x5678a3,_0x4fb5a4){return db[_0x16ef('0x21')][_0x16ef('0x35')]({'where':{'id':_0x5678a3[_0x16ef('0x29')]['id']}})[_0x16ef('0x19')](handleEntityNotFound(_0x4fb5a4,null))[_0x16ef('0x19')](function(_0x1799fd){if(_0x1799fd){return _0x1799fd[_0x16ef('0x4a')](_0x5678a3[_0x16ef('0x38')][_0x16ef('0x3b')],_[_0x16ef('0x4b')](_0x5678a3[_0x16ef('0x38')],[_0x16ef('0x3b'),'id'])||{})[_0x16ef('0x4c')](function(){return db[_0x16ef('0x4d')][_0x16ef('0x23')]({'attributes':['id','name',_0x16ef('0x4e')],'where':{'id':_0x5678a3['body'][_0x16ef('0x3b')]}});})[_0x16ef('0x19')](function(_0x250949){socket[_0x16ef('0x4f')](_0x16ef('0x50'),{'id':Number(_0x5678a3[_0x16ef('0x29')]['id']),'tags':_0x250949||[]});return{'id':Number(_0x5678a3[_0x16ef('0x29')]['id']),'tags':_0x250949||[]};});}})[_0x16ef('0x19')](respondWithResult(_0x4fb5a4,null))[_0x16ef('0x36')](handleError(_0x4fb5a4,null));};exports[_0x16ef('0x51')]=function(_0x12b10a,_0x5a5824){return db[_0x16ef('0x21')][_0x16ef('0x35')]({'where':{'id':_0x12b10a[_0x16ef('0x29')]['id']}})['then'](handleEntityNotFound(_0x5a5824,null))[_0x16ef('0x19')](function(_0x2ca976){if(_0x2ca976){return _0x2ca976['removeTags'](_0x12b10a[_0x16ef('0x26')][_0x16ef('0x3b')]);}})['then'](respondWithStatusCode(_0x5a5824,null))[_0x16ef('0x36')](handleError(_0x5a5824,null));};exports[_0x16ef('0x52')]=function(_0x15524e,_0x52c67a){var _0x4a231d=moment()[_0x16ef('0x53')]()[_0x16ef('0x54')]();var _0x36c2ac=path['join'](config[_0x16ef('0x55')],'server',_0x16ef('0x56'),_0x16ef('0x57'));var _0x1a7125=path[_0x16ef('0x58')](config[_0x16ef('0x55')],_0x16ef('0x59'),'files',_0x16ef('0x5a'));var _0x1483c7=path[_0x16ef('0x58')](_0x36c2ac,_0x4a231d);var _0x1cb396=util[_0x16ef('0x47')](_0x16ef('0x5b'),_0x15524e[_0x16ef('0x29')]['id'],_0x4a231d);var _0x45e6c6=path[_0x16ef('0x58')](_0x36c2ac,_0x1cb396);var _0x5c75a6=[];_0x5c75a6[_0x16ef('0x5c')]({'model':db[_0x16ef('0x5d')],'as':_0x16ef('0x5d'),'attributes':['id',_0x16ef('0x5e')],'raw':!![]});_0x5c75a6[_0x16ef('0x5c')]({'model':db[_0x16ef('0x5f')],'as':_0x16ef('0x60'),'attributes':['id','firstName',_0x16ef('0x61')],'raw':!![]});if(_0x15524e['query'][_0x16ef('0x5a')]){_0x5c75a6[_0x16ef('0x5c')]({'model':db[_0x16ef('0x62')],'as':'Attachment','raw':!![]});}var _0xf6bdba=[{'model':db[_0x16ef('0x3e')],'as':'Messages','attributes':['id','body',_0x16ef('0x63'),_0x16ef('0x64'),'secret',_0x16ef('0x65')],'include':_0x5c75a6}];_0xf6bdba['push']({'model':db[_0x16ef('0x66')],'as':'Account','attributes':['id',_0x16ef('0x1d')]});_0xf6bdba[_0x16ef('0x5c')]({'model':db[_0x16ef('0x5d')],'as':_0x16ef('0x67'),'attributes':['id',_0x16ef('0x5e')]});return db[_0x16ef('0x21')][_0x16ef('0x35')]({'where':{'id':_0x15524e['params']['id']},'include':_0xf6bdba})['then'](handleEntityNotFound(_0x52c67a,null))[_0x16ef('0x19')](function(_0x37bddc){if(_0x37bddc){var _0x41f57a=_0x37bddc['get']({'plain':!![]});fs[_0x16ef('0x68')](_0x1483c7);var _0x23c4d4={'channel':_0x16ef('0x69'),'account':_0x41f57a[_0x16ef('0x6a')][_0x16ef('0x1d')],'agent':_0x41f57a[_0x16ef('0x67')]?_0x41f57a[_0x16ef('0x67')][_0x16ef('0x5e')]:_0x16ef('0x6b'),'createdAt':moment(_0x41f57a['createdAt'])[_0x16ef('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x16ef('0x54')](),'closedAt':_0x41f57a[_0x16ef('0x6c')]?moment(_0x41f57a[_0x16ef('0x6d')])[_0x16ef('0x47')](_0x16ef('0x6e'))[_0x16ef('0x54')]():'','disposition':_0x41f57a[_0x16ef('0x6f')],'visibility':_0x41f57a['threadId']?_0x16ef('0x70'):'Private','messages':_(_0x41f57a[_0x16ef('0x71')])[_0x16ef('0x45')]({'secret':![]})[_0x16ef('0x20')](function(_0x538544){if(_0x538544[_0x16ef('0x62')]){var _0x5032ee=path[_0x16ef('0x58')](_0x1a7125,_0x538544[_0x16ef('0x62')][_0x16ef('0x72')]);if(fs[_0x16ef('0x73')](_0x5032ee)){fs[_0x16ef('0x74')](_0x5032ee)['pipe'](fs[_0x16ef('0x75')](path[_0x16ef('0x58')](_0x1483c7,_0x538544[_0x16ef('0x62')][_0x16ef('0x72')])));}}return{'date':moment(_0x538544['createdAt'])['format'](_0x16ef('0x6e'))[_0x16ef('0x54')](),'sender':_0x538544['direction']===_0x16ef('0x76')?_0x538544[_0x16ef('0x5d')]?_0x538544[_0x16ef('0x5d')][_0x16ef('0x5e')]:_0x16ef('0x77'):_0x538544[_0x16ef('0x60')][_0x16ef('0x78')]+(_0x538544[_0x16ef('0x60')][_0x16ef('0x61')]?'\x20'+_0x538544[_0x16ef('0x60')]['lastName']:''),'body':_0x538544[_0x16ef('0x62')]?_0x538544['Attachment'][_0x16ef('0x72')]:_0x538544[_0x16ef('0x38')],'direction':_0x538544[_0x16ef('0x64')]===_0x16ef('0x76')?'A':'C','secret':_0x538544[_0x16ef('0x79')],'read':_0x538544[_0x16ef('0x65')],'attachment':_0x538544[_0x16ef('0x62')]};})[_0x16ef('0x7a')]()};return ejs[_0x16ef('0x7b')](path[_0x16ef('0x58')](config[_0x16ef('0x55')],_0x16ef('0x59'),'views',_0x16ef('0x7c')),{'interaction':_0x23c4d4})[_0x16ef('0x19')](function(_0x5bf026){var _0x1d195b=path['join'](_0x1483c7,_0x16ef('0x7d')+_0x41f57a['id']+'-'+_0x4a231d+_0x16ef('0x7e'));var _0x16f902={'path':_0x1d195b,'channel':_0x16ef('0x69'),'interactionId':_0x41f57a['id']};return pdf[_0x16ef('0x7f')](_0x5bf026,_0x16f902);})[_0x16ef('0x19')](function(){return new Promise(function(_0x2cc002,_0x43514f){zipdir(_0x1483c7,{'saveTo':_0x45e6c6},function(_0x3bd844,_0x360302){if(_0x3bd844)return _0x43514f(_0x3bd844);return _0x2cc002(_0x360302);});})['then'](function(){return new Promise(function(_0x2b5889,_0x32598f){rimraf(_0x1483c7,function(_0x59fd58){if(_0x59fd58)_0x32598f(_0x59fd58);return _0x2b5889();});});})[_0x16ef('0x19')](function(){return _0x52c67a[_0x16ef('0x52')](_0x45e6c6,_0x1cb396,function(_0x3a596f){if(_0x3a596f){logger[_0x16ef('0x80')]('Unable\x20to\x20delete\x20zip\x20file',_0x3a596f);}else{fs['unlinkSync'](_0x45e6c6);}});});});}else{return _0x52c67a[_0x16ef('0x81')](0xc8);}})[_0x16ef('0x36')](handleError(_0x52c67a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 991c22a..2490dad 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 _0x0fd7=['hook','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','then','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x1079d7,_0x39dfab){var _0x3c1c8b=function(_0x32c1d6){while(--_0x32c1d6){_0x1079d7['push'](_0x1079d7['shift']());}};_0x3c1c8b(++_0x39dfab);}(_0x0fd7,0x162));var _0x70fd=function(_0x20d4d2,_0x187b32){_0x20d4d2=_0x20d4d2-0x0;var _0x186d54=_0x0fd7[_0x20d4d2];return _0x186d54;};'use strict';var EventEmitter=require(_0x70fd('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x70fd('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x70fd('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x70fd('0x3')](0x0);var events={'afterCreate':_0x70fd('0x4'),'afterUpdate':_0x70fd('0x5'),'afterDestroy':_0x70fd('0x6')};function emitEvent(_0x3e8f04){return function(_0x5e6e34,_0x59b8a5,_0x4c8fd4){_0x5e6e34[_0x70fd('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2b629e){_0x5e6e34[_0x70fd('0x8')]('Users',_0x2b629e['map'](function(_0x50f0e1){return{'id':_0x50f0e1['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5e6e34['id'],'direction':'in','read':![]},'raw':!![]});})[_0x70fd('0x9')](function(_0x4c607d){_0x5e6e34[_0x70fd('0x8')](_0x70fd('0xa'),_0x4c607d['length']);OpenchannelInteractionEvents['emit'](_0x3e8f04+':'+_0x5e6e34['id'],_0x5e6e34);OpenchannelInteractionEvents[_0x70fd('0xb')](_0x3e8f04,_0x5e6e34);_0x4c8fd4(null);})[_0x70fd('0xc')](_0x4c8fd4(null));};}for(var e in events){if(events[_0x70fd('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x70fd('0xe')](e,emitEvent(event));}}module[_0x70fd('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc5a2=['map','findAll','unreadMessages','emit','hook','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x1c4f25,_0x4f7d64){var _0x5b559f=function(_0x338203){while(--_0x338203){_0x1c4f25['push'](_0x1c4f25['shift']());}};_0x5b559f(++_0x4f7d64);}(_0xc5a2,0x195));var _0x2c5a=function(_0x5df6a5,_0x3b610e){_0x5df6a5=_0x5df6a5-0x0;var _0x13c870=_0xc5a2[_0x5df6a5];return _0x13c870;};'use strict';var EventEmitter=require(_0x2c5a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x2c5a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x2c5a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2c5a('0x3')](0x0);var events={'afterCreate':_0x2c5a('0x4'),'afterUpdate':_0x2c5a('0x5'),'afterDestroy':_0x2c5a('0x6')};function emitEvent(_0x205602){return function(_0x50cfbd,_0x3a45cd,_0x5a5e13){_0x50cfbd[_0x2c5a('0x7')]({'attributes':['id'],'raw':!![]})[_0x2c5a('0x8')](function(_0x3a6724){_0x50cfbd[_0x2c5a('0x9')](_0x2c5a('0xa'),_0x3a6724[_0x2c5a('0xb')](function(_0x27cd0e){return{'id':_0x27cd0e['id']};}));return OpenchannelMessage[_0x2c5a('0xc')]({'where':{'OpenchannelInteractionId':_0x50cfbd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2c5a('0x8')](function(_0x2ba50d){_0x50cfbd[_0x2c5a('0x9')](_0x2c5a('0xd'),_0x2ba50d['length']);OpenchannelInteractionEvents[_0x2c5a('0xe')](_0x205602+':'+_0x50cfbd['id'],_0x50cfbd);OpenchannelInteractionEvents['emit'](_0x205602,_0x50cfbd);_0x5a5e13(null);})['catch'](_0x5a5e13(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x2c5a('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 44b251d..00cdf1a 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 _0x3177=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x2cc6b2,_0x59b23e){var _0x1e24eb=function(_0x40aba9){while(--_0x40aba9){_0x2cc6b2['push'](_0x2cc6b2['shift']());}};_0x1e24eb(++_0x59b23e);}(_0x3177,0x149));var _0x7317=function(_0x21eb10,_0x4837ee){_0x21eb10=_0x21eb10-0x0;var _0x2be61d=_0x3177[_0x21eb10];return _0x2be61d;};'use strict';var _=require('lodash');var util=require(_0x7317('0x0'));var logger=require(_0x7317('0x1'))(_0x7317('0x2'));var moment=require('moment');var BPromise=require(_0x7317('0x3'));var rp=require(_0x7317('0x4'));var fs=require('fs');var path=require(_0x7317('0x5'));var rimraf=require('rimraf');var config=require(_0x7317('0x6'));var attributes=require(_0x7317('0x7'));module['exports']=function(_0x5877a7,_0x152366){return _0x5877a7[_0x7317('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0x7317('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7317('0xa'),'collate':_0x7317('0xb'),'hooks':{'beforeUpdate':function(_0x48acd9,_0x584974,_0x293234){if(_0x48acd9['changed']('closed')){_0x48acd9[_0x7317('0xc')]=moment()[_0x7317('0xd')](_0x7317('0xe'));}_0x293234(null,_0x48acd9);}}});}; \ No newline at end of file +var _0x079c=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x079c,0x1e4));var _0xc079=function(_0x4a0d77,_0x29bbc6){_0x4a0d77=_0x4a0d77-0x0;var _0x3f3f94=_0x079c[_0x4a0d77];return _0x3f3f94;};'use strict';var _=require(_0xc079('0x0'));var util=require('util');var logger=require(_0xc079('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc079('0x2'));var fs=require('fs');var path=require(_0xc079('0x3'));var rimraf=require(_0xc079('0x4'));var config=require(_0xc079('0x5'));var attributes=require(_0xc079('0x6'));module[_0xc079('0x7')]=function(_0x1ef8aa,_0x352656){return _0x1ef8aa[_0xc079('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0xc079('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc079('0xa'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x24cfe2,_0x13fc5e,_0x2c658a){if(_0x24cfe2[_0xc079('0xb')](_0xc079('0xc'))){_0x24cfe2[_0xc079('0xd')]=moment()['format'](_0xc079('0xe'));}_0x2c658a(null,_0x24cfe2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index beb4ccd..5e64a9b 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 _0x5b97=['raw','where','limit','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','OpenchannelInteraction','update','body','options'];(function(_0xc70602,_0x531f15){var _0x338b62=function(_0x47bec1){while(--_0x47bec1){_0xc70602['push'](_0xc70602['shift']());}};_0x338b62(++_0x531f15);}(_0x5b97,0xe3));var _0x75b9=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x5b97[_0x2300c7];return _0x23f720;};'use strict';var _=require('lodash');var util=require(_0x75b9('0x0'));var moment=require('moment');var BPromise=require(_0x75b9('0x1'));var rs=require(_0x75b9('0x2'));var fs=require('fs');var Redis=require(_0x75b9('0x3'));var db=require(_0x75b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x75b9('0x5'));var config=require(_0x75b9('0x6'));var jayson=require(_0x75b9('0x7'));var client=jayson[_0x75b9('0x8')][_0x75b9('0x9')]({'port':0x232a});config['redis']=_[_0x75b9('0xa')](config[_0x75b9('0xb')],{'host':_0x75b9('0xc'),'port':0x18eb});var socket=require(_0x75b9('0xd'))(new Redis(config['redis']));require(_0x75b9('0xe'))[_0x75b9('0xf')](socket);function respondWithRpcPromise(_0x53e3f9,_0x3f2844,_0x52183a){return new BPromise(function(_0x1fa64f,_0x22e0bf){return client[_0x75b9('0x10')](_0x53e3f9,_0x52183a)[_0x75b9('0x11')](function(_0x2e2907){logger[_0x75b9('0x12')](_0x75b9('0x13'),_0x3f2844,'request\x20sent');logger[_0x75b9('0x14')](_0x75b9('0x15'),_0x3f2844,_0x75b9('0x16'),JSON['stringify'](_0x2e2907));if(_0x2e2907[_0x75b9('0x17')]){if(_0x2e2907[_0x75b9('0x17')][_0x75b9('0x18')]===0x1f4){logger[_0x75b9('0x17')](_0x75b9('0x13'),_0x3f2844,_0x2e2907[_0x75b9('0x17')][_0x75b9('0x19')]);return _0x22e0bf(_0x2e2907['error'][_0x75b9('0x19')]);}logger[_0x75b9('0x17')](_0x75b9('0x13'),_0x3f2844,_0x2e2907[_0x75b9('0x17')][_0x75b9('0x19')]);return _0x1fa64f(_0x2e2907['error'][_0x75b9('0x19')]);}else{logger['info'](_0x75b9('0x13'),_0x3f2844,_0x75b9('0x16'));_0x1fa64f(_0x2e2907['result'][_0x75b9('0x19')]);}})[_0x75b9('0x1a')](function(_0x3664c2){logger[_0x75b9('0x17')](_0x75b9('0x13'),_0x3f2844,_0x3664c2);_0x22e0bf(_0x3664c2);});});}exports['UpdateOpenchannelInteraction']=function(_0x2542e3){var _0x3af3df=this;return new Promise(function(_0x21929c,_0x3393be){return db[_0x75b9('0x1b')][_0x75b9('0x1c')](_0x2542e3[_0x75b9('0x1d')],{'raw':_0x2542e3[_0x75b9('0x1e')]?_0x2542e3['options'][_0x75b9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2542e3[_0x75b9('0x1e')]?_0x2542e3[_0x75b9('0x1e')][_0x75b9('0x20')]||null:null,'attributes':_0x2542e3[_0x75b9('0x1e')]?_0x2542e3[_0x75b9('0x1e')]['attributes']||null:null,'limit':_0x2542e3[_0x75b9('0x1e')]?_0x2542e3[_0x75b9('0x1e')][_0x75b9('0x21')]||null:null})[_0x75b9('0x11')](function(_0x5c1538){logger[_0x75b9('0x12')](_0x75b9('0x22'),_0x2542e3);logger['debug']('UpdateOpenchannelInteraction',_0x2542e3,JSON[_0x75b9('0x23')](_0x5c1538));_0x21929c(_0x5c1538);})[_0x75b9('0x1a')](function(_0x13ae39){logger[_0x75b9('0x17')](_0x75b9('0x22'),_0x13ae39['message'],_0x2542e3);_0x3393be(_0x3af3df[_0x75b9('0x17')](0x1f4,_0x13ae39[_0x75b9('0x19')]));});});};exports[_0x75b9('0x24')]=function(_0x199d29){return new Promise(function(_0x426fae,_0x2df16c){return db[_0x75b9('0x1b')][_0x75b9('0x25')]({'where':_0x199d29[_0x75b9('0x1e')]?_0x199d29[_0x75b9('0x1e')][_0x75b9('0x20')]||null:null})[_0x75b9('0x11')](function(_0x9152f4){if(_0x9152f4){return _0x9152f4[_0x75b9('0x26')](_0x199d29[_0x75b9('0x1d')]['ids'],_[_0x75b9('0x27')](_0x199d29[_0x75b9('0x1d')],[_0x75b9('0x28'),'id'])||{});}})[_0x75b9('0x29')](function(_0x27d593){logger['info'](_0x75b9('0x2a'),_0x199d29);logger['debug'](_0x75b9('0x2a'),_0x199d29,JSON[_0x75b9('0x23')](_0x27d593));_0x426fae(_0x27d593);})[_0x75b9('0x1a')](function(_0x5752cd){logger['error'](_0x75b9('0x2a'),_0x5752cd[_0x75b9('0x19')],_0x199d29);_0x2df16c(_this[_0x75b9('0x17')](0x1f4,_0x5752cd[_0x75b9('0x19')]));});});}; \ No newline at end of file +var _0x47e6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','catch','lodash','util'];(function(_0x11fd35,_0x259295){var _0x3792de=function(_0x5c099c){while(--_0x5c099c){_0x11fd35['push'](_0x11fd35['shift']());}};_0x3792de(++_0x259295);}(_0x47e6,0x12b));var _0x647e=function(_0x3065f4,_0x34fd37){_0x3065f4=_0x3065f4-0x0;var _0x37c638=_0x47e6[_0x3065f4];return _0x37c638;};'use strict';var _=require(_0x647e('0x0'));var util=require(_0x647e('0x1'));var moment=require('moment');var BPromise=require(_0x647e('0x2'));var rs=require(_0x647e('0x3'));var fs=require('fs');var Redis=require(_0x647e('0x4'));var db=require(_0x647e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x647e('0x6'))(_0x647e('0x7'));var config=require('../../config/environment');var jayson=require(_0x647e('0x8'));var client=jayson[_0x647e('0x9')][_0x647e('0xa')]({'port':0x232a});config[_0x647e('0xb')]=_[_0x647e('0xc')](config[_0x647e('0xb')],{'host':_0x647e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x647e('0xb')]));require(_0x647e('0xe'))[_0x647e('0xf')](socket);function respondWithRpcPromise(_0x28fa07,_0xa1e331,_0x8a23c9){return new BPromise(function(_0x301f7d,_0x39890f){return client[_0x647e('0x10')](_0x28fa07,_0x8a23c9)[_0x647e('0x11')](function(_0x2e4da1){logger[_0x647e('0x12')](_0x647e('0x13'),_0xa1e331,_0x647e('0x14'));logger[_0x647e('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xa1e331,_0x647e('0x14'),JSON[_0x647e('0x16')](_0x2e4da1));if(_0x2e4da1['error']){if(_0x2e4da1[_0x647e('0x17')][_0x647e('0x18')]===0x1f4){logger[_0x647e('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0xa1e331,_0x2e4da1['error'][_0x647e('0x19')]);return _0x39890f(_0x2e4da1['error'][_0x647e('0x19')]);}logger[_0x647e('0x17')](_0x647e('0x13'),_0xa1e331,_0x2e4da1[_0x647e('0x17')][_0x647e('0x19')]);return _0x301f7d(_0x2e4da1[_0x647e('0x17')][_0x647e('0x19')]);}else{logger[_0x647e('0x12')](_0x647e('0x13'),_0xa1e331,_0x647e('0x14'));_0x301f7d(_0x2e4da1[_0x647e('0x1a')][_0x647e('0x19')]);}})['catch'](function(_0x147701){logger[_0x647e('0x17')](_0x647e('0x13'),_0xa1e331,_0x147701);_0x39890f(_0x147701);});});}exports[_0x647e('0x1b')]=function(_0x4a2a07){var _0x5226d6=this;return new Promise(function(_0x4058c6,_0xed462d){return db[_0x647e('0x1c')][_0x647e('0x1d')](_0x4a2a07[_0x647e('0x1e')],{'raw':_0x4a2a07[_0x647e('0x1f')]?_0x4a2a07[_0x647e('0x1f')][_0x647e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2a07[_0x647e('0x1f')]?_0x4a2a07[_0x647e('0x1f')][_0x647e('0x21')]||null:null,'attributes':_0x4a2a07['options']?_0x4a2a07['options'][_0x647e('0x22')]||null:null,'limit':_0x4a2a07[_0x647e('0x1f')]?_0x4a2a07[_0x647e('0x1f')][_0x647e('0x23')]||null:null})[_0x647e('0x11')](function(_0x1ecce3){logger[_0x647e('0x12')](_0x647e('0x1b'),_0x4a2a07);logger[_0x647e('0x15')]('UpdateOpenchannelInteraction',_0x4a2a07,JSON[_0x647e('0x16')](_0x1ecce3));_0x4058c6(_0x1ecce3);})['catch'](function(_0x54c7b6){logger[_0x647e('0x17')](_0x647e('0x1b'),_0x54c7b6[_0x647e('0x19')],_0x4a2a07);_0xed462d(_0x5226d6[_0x647e('0x17')](0x1f4,_0x54c7b6[_0x647e('0x19')]));});});};exports[_0x647e('0x24')]=function(_0xd89192){return new Promise(function(_0x55dee3,_0x5f5174){return db[_0x647e('0x1c')][_0x647e('0x25')]({'where':_0xd89192['options']?_0xd89192[_0x647e('0x1f')][_0x647e('0x21')]||null:null})[_0x647e('0x11')](function(_0x276189){if(_0x276189){return _0x276189['addTags'](_0xd89192[_0x647e('0x1e')][_0x647e('0x26')],_[_0x647e('0x27')](_0xd89192['body'],[_0x647e('0x26'),'id'])||{});}})[_0x647e('0x28')](function(_0x5022b6){logger['info'](_0x647e('0x29'),_0xd89192);logger[_0x647e('0x15')](_0x647e('0x29'),_0xd89192,JSON[_0x647e('0x16')](_0x5022b6));_0x55dee3(_0x5022b6);})[_0x647e('0x2a')](function(_0x55aa17){logger['error'](_0x647e('0x29'),_0x55aa17[_0x647e('0x19')],_0xd89192);_0x5f5174(_this[_0x647e('0x17')](0x1f4,_0x55aa17[_0x647e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 688ce93..e054408 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 _0x0106=['remove','update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x3622ca,_0x40568f){var _0x5e7e67=function(_0x3848bb){while(--_0x3848bb){_0x3622ca['push'](_0x3622ca['shift']());}};_0x5e7e67(++_0x40568f);}(_0x0106,0x1be));var _0x6010=function(_0x152c78,_0x53d665){_0x152c78=_0x152c78-0x0;var _0x42e82e=_0x0106[_0x152c78];return _0x42e82e;};'use strict';var OpenchannelInteractionEvents=require(_0x6010('0x0'));var events=[_0x6010('0x1'),_0x6010('0x2'),_0x6010('0x3')];function createListener(_0x425b90,_0x319b78){return function(_0x50cb40){_0x319b78[_0x6010('0x4')](_0x425b90,_0x50cb40);};}function removeListener(_0x2fb196,_0x2660eb){return function(){OpenchannelInteractionEvents['removeListener'](_0x2fb196,_0x2660eb);};}exports[_0x6010('0x5')]=function(_0x5bf498){for(var _0x1a8b6a=0x0,_0x2552bc=events[_0x6010('0x6')];_0x1a8b6a<_0x2552bc;_0x1a8b6a++){var _0x48fc58=events[_0x1a8b6a];var _0x57b237=createListener(_0x6010('0x7')+_0x48fc58,_0x5bf498);OpenchannelInteractionEvents['on'](_0x48fc58,_0x57b237);}}; \ No newline at end of file +var _0x1a7c=['./openchannelInteraction.events','save','update','emit','removeListener','register'];(function(_0x271633,_0x1ac2b3){var _0x5ab434=function(_0x53e541){while(--_0x53e541){_0x271633['push'](_0x271633['shift']());}};_0x5ab434(++_0x1ac2b3);}(_0x1a7c,0x16e));var _0xc1a7=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0x1a7c[_0x131585];return _0x1fcca2;};'use strict';var OpenchannelInteractionEvents=require(_0xc1a7('0x0'));var events=[_0xc1a7('0x1'),'remove',_0xc1a7('0x2')];function createListener(_0x5df51e,_0x50545b){return function(_0xd36b27){_0x50545b[_0xc1a7('0x3')](_0x5df51e,_0xd36b27);};}function removeListener(_0x2bd28f,_0x5310e3){return function(){OpenchannelInteractionEvents[_0xc1a7('0x4')](_0x2bd28f,_0x5310e3);};}exports[_0xc1a7('0x5')]=function(_0x463316){for(var _0xcd5714=0x0,_0x15c574=events['length'];_0xcd5714<_0x15c574;_0xcd5714++){var _0x13f4e7=events[_0xcd5714];var _0x4b7983=createListener('openchannelInteraction:'+_0x13f4e7,_0x463316);OpenchannelInteractionEvents['on'](_0x13f4e7,_0x4b7983);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 06c4ca7..48c227c 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x57970b,_0x45c7c7){_0x57970b=_0x57970b-0x0;var _0x328a3c=_0x70e0[_0x57970b];return _0x328a3c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x163b81,_0x4abb60){var _0x4c206e=function(_0x26a795){while(--_0x26a795){_0x163b81['push'](_0x163b81['shift']());}};_0x4c206e(++_0x4abb60);}(_0xe706,0xa3));var _0x6e70=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xe706[_0x1cc961];return _0x471d86;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 06a45bb..5948db3 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 _0x38c9=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x3492c8,_0x5a40aa){var _0xf3e965=function(_0x4f7ee9){while(--_0x4f7ee9){_0x3492c8['push'](_0x3492c8['shift']());}};_0xf3e965(++_0x5a40aa);}(_0x38c9,0x199));var _0x938c=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x38c9[_0x393d69];return _0x3cee37;};'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 +var _0x17a7=['STRING','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x17a7,0xc2));var _0x717a=function(_0x567654,_0x301b0c){_0x567654=_0x567654-0x0;var _0x58fef5=_0x17a7[_0x567654];return _0x58fef5;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x717a('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x717a('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x717a('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x717a('0x2')]('in','out'),'defaultValue':_0x717a('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x717a('0x4')]},'providerResponse':{'type':Sequelize[_0x717a('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e1c5651..7c677a6 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 _0xfb90=['motionChannel','event','rejectmessage','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','destroy','status','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','find','create','body','update','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','EventManager','acceptmessage','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','internal'];(function(_0x4e2379,_0x4167ef){var _0x432580=function(_0x50fcef){while(--_0x50fcef){_0x4e2379['push'](_0x4e2379['shift']());}};_0x432580(++_0x4167ef);}(_0xfb90,0x18f));var _0x0fb9=function(_0xac3027,_0x59d1d9){_0xac3027=_0xac3027-0x0;var _0x4cc775=_0xfb90[_0xac3027];return _0x4cc775;};'use strict';var emlformat=require(_0x0fb9('0x0'));var rimraf=require(_0x0fb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fb9('0x2'));var rp=require('request-promise');var moment=require(_0x0fb9('0x3'));var BPromise=require(_0x0fb9('0x4'));var Mustache=require(_0x0fb9('0x5'));var util=require(_0x0fb9('0x6'));var path=require('path');var sox=require(_0x0fb9('0x7'));var csv=require(_0x0fb9('0x8'));var ejs=require(_0x0fb9('0x9'));var fs=require('fs');var fs_extra=require(_0x0fb9('0xa'));var _=require(_0x0fb9('0xb'));var squel=require('squel');var crypto=require(_0x0fb9('0xc'));var jsforce=require(_0x0fb9('0xd'));var deskjs=require(_0x0fb9('0xe'));var toCsv=require(_0x0fb9('0x8'));var querystring=require(_0x0fb9('0xf'));var Papa=require('papaparse');var Redis=require(_0x0fb9('0x10'));var authService=require(_0x0fb9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0fb9('0x12'));var hardwareService=require(_0x0fb9('0x13'));var logger=require(_0x0fb9('0x14'))(_0x0fb9('0x15'));var utils=require(_0x0fb9('0x16'));var config=require(_0x0fb9('0x17'));var licenseUtil=require(_0x0fb9('0x18'));var db=require('../../mysqldb')['db'];config[_0x0fb9('0x19')]=_[_0x0fb9('0x1a')](config['redis'],{'host':_0x0fb9('0x1b'),'port':0x18eb});var socket=require(_0x0fb9('0x1c'))(new Redis(config[_0x0fb9('0x19')]));require(_0x0fb9('0x1d'))[_0x0fb9('0x1e')](socket);var jayson=require(_0x0fb9('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x0fb9('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae91f,_0x5d616e,_0x481801,_0x42b870){return new BPromise(function(_0x1025c7,_0xcc5c20){var _0x5002bb=_0x42b870||client;return _0x5002bb[_0x0fb9('0x21')](_0x3ae91f,_0x481801)[_0x0fb9('0x22')](function(_0x4132e7){logger[_0x0fb9('0x23')](_0x0fb9('0x24'),_0x5d616e,'request\x20sent');logger[_0x0fb9('0x25')](_0x0fb9('0x26'),_0x5d616e,_0x0fb9('0x27'),JSON[_0x0fb9('0x28')](_0x4132e7));if(_0x4132e7['error']){if(_0x4132e7[_0x0fb9('0x29')]['code']===0x1f4){logger[_0x0fb9('0x29')](_0x0fb9('0x24'),_0x5d616e,_0x4132e7['error']['message']);return _0xcc5c20(_0x4132e7[_0x0fb9('0x29')][_0x0fb9('0x2a')]);}logger[_0x0fb9('0x29')](_0x0fb9('0x24'),_0x5d616e,_0x4132e7[_0x0fb9('0x29')][_0x0fb9('0x2a')]);return _0x1025c7(_0x4132e7[_0x0fb9('0x29')]['message']);}else{logger[_0x0fb9('0x23')](_0x0fb9('0x24'),_0x5d616e,_0x0fb9('0x27'));_0x1025c7(_0x4132e7[_0x0fb9('0x2b')][_0x0fb9('0x2a')]);}})[_0x0fb9('0x2c')](function(_0x4fbdf0){logger[_0x0fb9('0x29')](_0x0fb9('0x24'),_0x5d616e,_0x4fbdf0);_0xcc5c20(_0x4fbdf0);});});}function respondWithStatusCode(_0x583d9c,_0x54bccf){_0x54bccf=_0x54bccf||0xcc;return function(_0x473bf3){if(_0x473bf3){return _0x583d9c['sendStatus'](_0x54bccf);}return _0x583d9c['status'](_0x54bccf)[_0x0fb9('0x2d')]();};}function respondWithResult(_0x1ed1bb,_0xa354f6){_0xa354f6=_0xa354f6||0xc8;return function(_0x32cc26){if(_0x32cc26){return _0x1ed1bb['status'](_0xa354f6)[_0x0fb9('0x2e')](_0x32cc26);}};}function respondWithFilteredResult(_0x52aa24,_0x4a7af6){return function(_0x508d12){if(_0x508d12){var _0x35928d=typeof _0x4a7af6['offset']==='undefined'&&typeof _0x4a7af6['limit']===_0x0fb9('0x2f');var _0x23c781=_0x508d12[_0x0fb9('0x30')];var _0x397ef2=_0x35928d?0x0:_0x4a7af6['offset'];var _0x50b158=_0x35928d?_0x508d12[_0x0fb9('0x30')]:_0x4a7af6[_0x0fb9('0x31')]+_0x4a7af6[_0x0fb9('0x32')];var _0xead15c;if(_0x50b158>=_0x23c781){_0x50b158=_0x23c781;_0xead15c=0xc8;}else{_0xead15c=0xce;}_0x52aa24['status'](_0xead15c);return _0x52aa24[_0x0fb9('0x33')](_0x0fb9('0x34'),_0x397ef2+'-'+_0x50b158+'/'+_0x23c781)[_0x0fb9('0x2e')](_0x508d12);}return null;};}function patchUpdates(_0x409465){return function(_0x3a0245){try{jsonpatch[_0x0fb9('0x35')](_0x3a0245,_0x409465,!![]);}catch(_0x5f38be){return BPromise[_0x0fb9('0x36')](_0x5f38be);}return _0x3a0245['save']();};}function saveUpdates(_0x30cf43,_0x826a1){return function(_0x484084){if(_0x484084){return _0x484084['update'](_0x30cf43)[_0x0fb9('0x22')](function(_0x374085){return _0x374085;});}return null;};}function removeEntity(_0x5e82bf,_0x2df607){return function(_0x49ccd1){if(_0x49ccd1){return _0x49ccd1[_0x0fb9('0x37')]()['then'](function(){_0x5e82bf[_0x0fb9('0x38')](0xcc)[_0x0fb9('0x2d')]();});}};}function handleEntityNotFound(_0x4296d0,_0x45e9ac){return function(_0x448842){if(!_0x448842){_0x4296d0['sendStatus'](0x194);}return _0x448842;};}function handleError(_0x4dd908,_0x1ee32b){_0x1ee32b=_0x1ee32b||0x1f4;return function(_0x157c56){logger[_0x0fb9('0x29')](_0x157c56[_0x0fb9('0x39')]);if(_0x157c56[_0x0fb9('0x3a')]){delete _0x157c56[_0x0fb9('0x3a')];}_0x4dd908['status'](_0x1ee32b)[_0x0fb9('0x3b')](_0x157c56);};}exports[_0x0fb9('0x3c')]=function(_0x349ed8,_0x5ab0eb){var _0x32e4c4={},_0x35b64b={},_0x41afe1={'count':0x0,'rows':[]};var _0x158b00=_[_0x0fb9('0x3d')](db[_0x0fb9('0x3e')]['rawAttributes'],function(_0x3fb900){return{'name':_0x3fb900[_0x0fb9('0x3f')],'type':_0x3fb900[_0x0fb9('0x40')][_0x0fb9('0x41')]};});_0x35b64b[_0x0fb9('0x42')]=_[_0x0fb9('0x3d')](_0x158b00,_0x0fb9('0x3a'));_0x35b64b['query']=_[_0x0fb9('0x43')](_0x349ed8[_0x0fb9('0x44')]);_0x35b64b['filters']=_[_0x0fb9('0x45')](_0x35b64b[_0x0fb9('0x42')],_0x35b64b[_0x0fb9('0x44')]);_0x32e4c4[_0x0fb9('0x46')]=_[_0x0fb9('0x45')](_0x35b64b[_0x0fb9('0x42')],qs['fields'](_0x349ed8[_0x0fb9('0x44')][_0x0fb9('0x47')]));_0x32e4c4['attributes']=_0x32e4c4[_0x0fb9('0x46')][_0x0fb9('0x48')]?_0x32e4c4['attributes']:_0x35b64b[_0x0fb9('0x42')];if(!_0x349ed8[_0x0fb9('0x44')][_0x0fb9('0x49')]('nolimit')){_0x32e4c4['limit']=qs[_0x0fb9('0x32')](_0x349ed8[_0x0fb9('0x44')][_0x0fb9('0x32')]);_0x32e4c4['offset']=qs[_0x0fb9('0x31')](_0x349ed8[_0x0fb9('0x44')]['offset']);}_0x32e4c4[_0x0fb9('0x4a')]=qs['sort'](_0x349ed8[_0x0fb9('0x44')][_0x0fb9('0x4b')]);_0x32e4c4[_0x0fb9('0x4c')]=qs[_0x0fb9('0x4d')](_[_0x0fb9('0x4e')](_0x349ed8[_0x0fb9('0x44')],_0x35b64b['filters']),_0x158b00);if(_0x349ed8[_0x0fb9('0x44')][_0x0fb9('0x4f')]){_0x32e4c4[_0x0fb9('0x4c')]=_[_0x0fb9('0x50')](_0x32e4c4[_0x0fb9('0x4c')],{'$or':_[_0x0fb9('0x3d')](_0x158b00,function(_0x1db7c4){if(_0x1db7c4[_0x0fb9('0x40')]!==_0x0fb9('0x51')){var _0xc22daa={};_0xc22daa[_0x1db7c4[_0x0fb9('0x3a')]]={'$like':'%'+_0x349ed8['query'][_0x0fb9('0x4f')]+'%'};return _0xc22daa;}})});}_0x32e4c4=_[_0x0fb9('0x50')]({},_0x32e4c4,_0x349ed8[_0x0fb9('0x52')]);var _0x265b60={'where':_0x32e4c4[_0x0fb9('0x4c')]};return db[_0x0fb9('0x3e')]['count'](_0x265b60)['then'](function(_0x212270){_0x41afe1['count']=_0x212270;if(_0x349ed8['query'][_0x0fb9('0x53')]){_0x32e4c4[_0x0fb9('0x54')]=[{'all':!![]}];}return db[_0x0fb9('0x3e')]['findAll'](_0x32e4c4);})[_0x0fb9('0x22')](function(_0x284b90){_0x41afe1[_0x0fb9('0x55')]=_0x284b90;return _0x41afe1;})[_0x0fb9('0x22')](respondWithFilteredResult(_0x5ab0eb,_0x32e4c4))[_0x0fb9('0x2c')](handleError(_0x5ab0eb,null));};exports['show']=function(_0x2bc3eb,_0x1ffe05){var _0x2350a0={'raw':!![],'where':{'id':_0x2bc3eb[_0x0fb9('0x56')]['id']}},_0x40a0e3={};_0x40a0e3['model']=_[_0x0fb9('0x43')](db['OpenchannelMessage'][_0x0fb9('0x57')]);_0x40a0e3['query']=_['keys'](_0x2bc3eb[_0x0fb9('0x44')]);_0x40a0e3[_0x0fb9('0x4d')]=_[_0x0fb9('0x45')](_0x40a0e3['model'],_0x40a0e3[_0x0fb9('0x44')]);_0x2350a0[_0x0fb9('0x46')]=_[_0x0fb9('0x45')](_0x40a0e3[_0x0fb9('0x42')],qs['fields'](_0x2bc3eb[_0x0fb9('0x44')]['fields']));_0x2350a0[_0x0fb9('0x46')]=_0x2350a0[_0x0fb9('0x46')]['length']?_0x2350a0[_0x0fb9('0x46')]:_0x40a0e3['model'];if(_0x2bc3eb['query']['includeAll']){_0x2350a0[_0x0fb9('0x54')]=[{'all':!![]}];}_0x2350a0=_[_0x0fb9('0x50')]({},_0x2350a0,_0x2bc3eb[_0x0fb9('0x52')]);return db[_0x0fb9('0x3e')][_0x0fb9('0x58')](_0x2350a0)['then'](handleEntityNotFound(_0x1ffe05,null))[_0x0fb9('0x22')](respondWithResult(_0x1ffe05,null))[_0x0fb9('0x2c')](handleError(_0x1ffe05,null));};exports[_0x0fb9('0x59')]=function(_0x5f46a6,_0x2a2097){return db[_0x0fb9('0x3e')][_0x0fb9('0x59')](_0x5f46a6[_0x0fb9('0x5a')],{})[_0x0fb9('0x22')](respondWithResult(_0x2a2097,0xc9))['catch'](handleError(_0x2a2097,null));};exports[_0x0fb9('0x5b')]=function(_0x56d30e,_0x3c5d4e){if(_0x56d30e['body']['id']){delete _0x56d30e[_0x0fb9('0x5a')]['id'];}return db[_0x0fb9('0x3e')][_0x0fb9('0x58')]({'where':{'id':_0x56d30e['params']['id']}})[_0x0fb9('0x22')](handleEntityNotFound(_0x3c5d4e,null))['then'](saveUpdates(_0x56d30e['body'],null))[_0x0fb9('0x22')](respondWithResult(_0x3c5d4e,null))[_0x0fb9('0x2c')](handleError(_0x3c5d4e,null));};exports[_0x0fb9('0x37')]=function(_0xa5a8ea,_0x54f663){return db[_0x0fb9('0x3e')][_0x0fb9('0x58')]({'where':{'id':_0xa5a8ea['params']['id']}})['then'](handleEntityNotFound(_0x54f663,null))[_0x0fb9('0x22')](removeEntity(_0x54f663,null))[_0x0fb9('0x2c')](handleError(_0x54f663,null));};exports[_0x0fb9('0x5c')]=function(_0x80fffa,_0x59698f){return db[_0x0fb9('0x3e')][_0x0fb9('0x5c')]()[_0x0fb9('0x22')](respondWithResult(_0x59698f,null))[_0x0fb9('0x2c')](handleError(_0x59698f,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x0fb9('0x5d')]=function(_0x7aff55,_0x1cee88,_0x3ab581){var _0xb23119={'agent':{},'channel':'openchannel'};if(_0x7aff55[_0x0fb9('0x5a')]['id']){delete _0x7aff55[_0x0fb9('0x5a')]['id'];}_0x7aff55[_0x0fb9('0x5a')][_0x0fb9('0x5e')]=!![];_0x7aff55['body']['readAt']=moment()[_0x0fb9('0x5f')](_0x0fb9('0x60'));_0x7aff55[_0x0fb9('0x5a')]['UserId']=_0x7aff55[_0x0fb9('0x5a')][_0x0fb9('0x61')]||_0x7aff55[_0x0fb9('0x62')]['id'];_0xb23119[_0x0fb9('0x63')]['id']=_0x7aff55[_0x0fb9('0x5a')][_0x0fb9('0x61')];return db[_0x0fb9('0x3e')][_0x0fb9('0x58')]({'where':{'id':_0x7aff55[_0x0fb9('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1cee88,null))['then'](saveUpdates(_0x7aff55[_0x0fb9('0x5a')],null))[_0x0fb9('0x22')](function(_0x722fd0){if(_0x722fd0){_0xb23119[_0x0fb9('0x2a')]=_0x722fd0[_0x0fb9('0x64')]({'plain':!![]});return db[_0x0fb9('0x65')][_0x0fb9('0x58')]({'where':{'id':_0x722fd0[_0x0fb9('0x66')]}});}return null;})[_0x0fb9('0x22')](handleEntityNotFound(_0x1cee88,null))[_0x0fb9('0x22')](function(_0x282a36){if(_0x282a36){return _0x282a36[_0x0fb9('0x5b')]({'UserId':_0x7aff55[_0x0fb9('0x5a')][_0x0fb9('0x61')],'read1stAt':_[_0x0fb9('0x67')](_0x282a36[_0x0fb9('0x68')])?moment()[_0x0fb9('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0fb9('0x22')](function(_0xcbc617){if(_0xcbc617){_0xb23119[_0x0fb9('0x69')]=_0xcbc617[_0x0fb9('0x64')]({'plain':!![]});interaction_log[_0x0fb9('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7aff55[_0x0fb9('0x62')]['id'],_0x7aff55[_0x0fb9('0x62')][_0x0fb9('0x3a')],_0x7aff55[_0x0fb9('0x62')][_0x0fb9('0x6a')],_0xb23119[_0x0fb9('0x69')]['id'],_0x7aff55['body']?JSON['stringify'](_0x7aff55[_0x0fb9('0x5a')]):'null');return respondWithRpcPromise(_0x0fb9('0x6b'),_0x0fb9('0x6c'),_0xb23119);}return null;})['then'](function(_0x325ee2){var _0x5121e4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x325ee2[_0x0fb9('0x2a')]['ContactId'];return db[_0x0fb9('0x6d')][_0x0fb9('0x44')](_0x5121e4,{'type':db[_0x0fb9('0x6e')][_0x0fb9('0x6f')][_0x0fb9('0x70')],'raw':!![]})[_0x0fb9('0x22')](function(_0x2c75a3){return _0x2c75a3;});})['then'](function(_0x43d0e7){if(_0x43d0e7){_0xb23119[_0x0fb9('0x2a')][_0x0fb9('0x71')]=_0x43d0e7[0x0];if(!_0x7aff55['body'][_0x0fb9('0x61')])return;return db[_0x0fb9('0x72')][_0x0fb9('0x58')]({'where':{'id':_0x7aff55['body'][_0x0fb9('0x61')],'role':_0x0fb9('0x63')},'attributes':['id','name',_0x0fb9('0x73'),_0x0fb9('0x74'),'internal'],'raw':!![]});}return null;})[_0x0fb9('0x22')](function(_0xe2e11){if(!_0xe2e11)return null;_0xb23119[_0x0fb9('0x2a')][_0x0fb9('0x63')]=_0xe2e11;return _0xb23119;})[_0x0fb9('0x22')](function(_0x58e099){if(_0x58e099){if(_0x7aff55[_0x0fb9('0x5a')][_0x0fb9('0x75')]){_0xb23119[_0x0fb9('0x2a')][_0x0fb9('0x76')]=util[_0x0fb9('0x5f')]('SIP/%s',_0x7aff55[_0x0fb9('0x62')][_0x0fb9('0x3a')]);_0xb23119[_0x0fb9('0x2a')][_0x0fb9('0x77')]=_0xb23119[_0x0fb9('0x77')];_0xb23119['message']['motionChannel']=_0xb23119[_0x0fb9('0x77')];_0xb23119[_0x0fb9('0x2a')]['event']='accept';return respondWithRpcPromise('EventManager',_0x0fb9('0x78'),{'event':_0x0fb9('0x79'),'message':_0xb23119[_0x0fb9('0x2a')]},client9002)[_0x0fb9('0x22')](function(){return _0xb23119;});}return _0xb23119;}return null;})[_0x0fb9('0x22')](respondWithResult(_0x1cee88,null))[_0x0fb9('0x2c')](handleError(_0x1cee88,null));};var interaction_log=require('../../config/logger')(_0x0fb9('0x7a'));exports[_0x0fb9('0x36')]=function(_0x2703b0,_0x4c8e8f,_0x5b35ef){var _0x5efd9c={'agent':{},'channel':_0x0fb9('0x7b')};if(_0x2703b0[_0x0fb9('0x5a')]['id']){delete _0x2703b0[_0x0fb9('0x5a')]['id'];}_0x2703b0[_0x0fb9('0x5a')][_0x0fb9('0x61')]=_0x2703b0['body']['UserId']||_0x2703b0[_0x0fb9('0x62')]['id'];_0x5efd9c[_0x0fb9('0x63')]['id']=_0x2703b0[_0x0fb9('0x5a')][_0x0fb9('0x61')];return db[_0x0fb9('0x3e')]['find']({'where':{'id':_0x2703b0[_0x0fb9('0x56')]['id'],'UserId':null}})[_0x0fb9('0x22')](handleEntityNotFound(_0x4c8e8f,null))[_0x0fb9('0x22')](function(_0x25c5ea){if(_0x25c5ea){_0x5efd9c[_0x0fb9('0x2a')]=_0x25c5ea[_0x0fb9('0x64')]({'plain':!![]});return db[_0x0fb9('0x65')]['find']({'where':{'id':_0x25c5ea['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4c8e8f,null))[_0x0fb9('0x22')](function(_0x22f79d){if(_0x22f79d){_0x5efd9c[_0x0fb9('0x69')]=_0x22f79d['get']({'plain':!![]});interaction_log['info'](_0x0fb9('0x7c'),_0x2703b0['user']['id'],_0x2703b0[_0x0fb9('0x62')][_0x0fb9('0x3a')],_0x2703b0['user'][_0x0fb9('0x6a')],_0x5efd9c[_0x0fb9('0x69')]['id'],_0x2703b0[_0x0fb9('0x5a')]?JSON['stringify'](_0x2703b0['body']):_0x0fb9('0x7d'));return respondWithRpcPromise(_0x0fb9('0x7e'),'rejectMessage',_0x5efd9c);}return null;})[_0x0fb9('0x22')](function(_0x24d4a4){var _0x243f35='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x24d4a4['message'][_0x0fb9('0x7f')];return db[_0x0fb9('0x6d')][_0x0fb9('0x44')](_0x243f35,{'type':db[_0x0fb9('0x6e')]['QueryTypes'][_0x0fb9('0x70')],'raw':!![]})['then'](function(_0x123794){return _0x123794;});})[_0x0fb9('0x22')](function(_0x3a5b5a){if(_0x3a5b5a){_0x5efd9c[_0x0fb9('0x2a')][_0x0fb9('0x71')]=_0x3a5b5a[0x0];if(!_0x2703b0[_0x0fb9('0x5a')][_0x0fb9('0x61')])return;return db[_0x0fb9('0x72')][_0x0fb9('0x58')]({'where':{'id':_0x2703b0[_0x0fb9('0x5a')]['UserId'],'role':_0x0fb9('0x63')},'attributes':['id',_0x0fb9('0x3a'),_0x0fb9('0x73'),'email',_0x0fb9('0x80')],'raw':!![]});}return null;})[_0x0fb9('0x22')](function(_0x554e5e){if(!_0x554e5e)return null;_0x5efd9c['message'][_0x0fb9('0x63')]=_0x554e5e;return _0x5efd9c;})[_0x0fb9('0x22')](function(_0x27b263){if(_0x27b263){_0x27b263['message']['interface']=util[_0x0fb9('0x5f')]('SIP/%s',_0x2703b0[_0x0fb9('0x62')][_0x0fb9('0x3a')]);_0x27b263[_0x0fb9('0x2a')][_0x0fb9('0x77')]=_0x5efd9c[_0x0fb9('0x77')];_0x27b263[_0x0fb9('0x2a')][_0x0fb9('0x81')]=_0x5efd9c[_0x0fb9('0x77')];_0x27b263[_0x0fb9('0x2a')][_0x0fb9('0x82')]=_0x0fb9('0x36');respondWithRpcPromise(_0x0fb9('0x78'),_0x0fb9('0x78'),{'event':_0x0fb9('0x83'),'message':_0x27b263[_0x0fb9('0x2a')]},client9002);return _0x5efd9c;}return null;})['then'](respondWithResult(_0x4c8e8f,null))['catch'](handleError(_0x4c8e8f,null));}; \ No newline at end of file +var _0x6f69=['email','EventManager','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','params','includeAll','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','get','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','internal','SIP/%s','channel','motionChannel','event','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x6f69,0x8d));var _0x96f6=function(_0x65d83e,_0x2609e0){_0x65d83e=_0x65d83e-0x0;var _0x1a2e19=_0x6f69[_0x65d83e];return _0x1a2e19;};'use strict';var emlformat=require(_0x96f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96f6('0x1'));var jsonpatch=require(_0x96f6('0x2'));var rp=require(_0x96f6('0x3'));var moment=require(_0x96f6('0x4'));var BPromise=require(_0x96f6('0x5'));var Mustache=require(_0x96f6('0x6'));var util=require(_0x96f6('0x7'));var path=require(_0x96f6('0x8'));var sox=require(_0x96f6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96f6('0xa'));var _=require(_0x96f6('0xb'));var squel=require('squel');var crypto=require(_0x96f6('0xc'));var jsforce=require(_0x96f6('0xd'));var deskjs=require(_0x96f6('0xe'));var toCsv=require(_0x96f6('0xf'));var querystring=require(_0x96f6('0x10'));var Papa=require(_0x96f6('0x11'));var Redis=require(_0x96f6('0x12'));var authService=require(_0x96f6('0x13'));var qs=require(_0x96f6('0x14'));var as=require(_0x96f6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96f6('0x16'))('api');var utils=require(_0x96f6('0x17'));var config=require(_0x96f6('0x18'));var licenseUtil=require(_0x96f6('0x19'));var db=require(_0x96f6('0x1a'))['db'];config[_0x96f6('0x1b')]=_[_0x96f6('0x1c')](config[_0x96f6('0x1b')],{'host':_0x96f6('0x1d'),'port':0x18eb});var socket=require(_0x96f6('0x1e'))(new Redis(config['redis']));require(_0x96f6('0x1f'))[_0x96f6('0x20')](socket);var jayson=require(_0x96f6('0x21'));var client=jayson[_0x96f6('0x22')]['http']({'port':0x232c});var client9002=jayson['client'][_0x96f6('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1bc3cd,_0x14e542,_0x35bda2,_0x1c6b8a){return new BPromise(function(_0x546b1c,_0x4d5ad7){var _0x49ce30=_0x1c6b8a||client;return _0x49ce30[_0x96f6('0x24')](_0x1bc3cd,_0x35bda2)[_0x96f6('0x25')](function(_0x383507){logger['info'](_0x96f6('0x26'),_0x14e542,_0x96f6('0x27'));logger[_0x96f6('0x28')](_0x96f6('0x29'),_0x14e542,_0x96f6('0x27'),JSON[_0x96f6('0x2a')](_0x383507));if(_0x383507['error']){if(_0x383507['error'][_0x96f6('0x2b')]===0x1f4){logger[_0x96f6('0x2c')](_0x96f6('0x26'),_0x14e542,_0x383507[_0x96f6('0x2c')][_0x96f6('0x2d')]);return _0x4d5ad7(_0x383507['error'][_0x96f6('0x2d')]);}logger[_0x96f6('0x2c')](_0x96f6('0x26'),_0x14e542,_0x383507[_0x96f6('0x2c')][_0x96f6('0x2d')]);return _0x546b1c(_0x383507[_0x96f6('0x2c')][_0x96f6('0x2d')]);}else{logger['info'](_0x96f6('0x26'),_0x14e542,'request\x20sent');_0x546b1c(_0x383507[_0x96f6('0x2e')][_0x96f6('0x2d')]);}})[_0x96f6('0x2f')](function(_0x52cc66){logger['error'](_0x96f6('0x26'),_0x14e542,_0x52cc66);_0x4d5ad7(_0x52cc66);});});}function respondWithStatusCode(_0x40a146,_0x48afbb){_0x48afbb=_0x48afbb||0xcc;return function(_0x42f930){if(_0x42f930){return _0x40a146['sendStatus'](_0x48afbb);}return _0x40a146[_0x96f6('0x30')](_0x48afbb)[_0x96f6('0x31')]();};}function respondWithResult(_0x2a48ac,_0x53c03c){_0x53c03c=_0x53c03c||0xc8;return function(_0x3c9c91){if(_0x3c9c91){return _0x2a48ac[_0x96f6('0x30')](_0x53c03c)[_0x96f6('0x32')](_0x3c9c91);}};}function respondWithFilteredResult(_0x3bb8d3,_0x42fef2){return function(_0x475da1){if(_0x475da1){var _0x2b780b=typeof _0x42fef2[_0x96f6('0x33')]===_0x96f6('0x34')&&typeof _0x42fef2['limit']==='undefined';var _0x3f87b1=_0x475da1['count'];var _0x51d3b4=_0x2b780b?0x0:_0x42fef2['offset'];var _0x2da4cf=_0x2b780b?_0x475da1[_0x96f6('0x35')]:_0x42fef2[_0x96f6('0x33')]+_0x42fef2['limit'];var _0x135ce2;if(_0x2da4cf>=_0x3f87b1){_0x2da4cf=_0x3f87b1;_0x135ce2=0xc8;}else{_0x135ce2=0xce;}_0x3bb8d3[_0x96f6('0x30')](_0x135ce2);return _0x3bb8d3[_0x96f6('0x36')](_0x96f6('0x37'),_0x51d3b4+'-'+_0x2da4cf+'/'+_0x3f87b1)[_0x96f6('0x32')](_0x475da1);}return null;};}function patchUpdates(_0x5579a1){return function(_0x72e291){try{jsonpatch[_0x96f6('0x38')](_0x72e291,_0x5579a1,!![]);}catch(_0x345fd1){return BPromise[_0x96f6('0x39')](_0x345fd1);}return _0x72e291[_0x96f6('0x3a')]();};}function saveUpdates(_0x4b602b,_0x906a2b){return function(_0x5d05ff){if(_0x5d05ff){return _0x5d05ff[_0x96f6('0x3b')](_0x4b602b)[_0x96f6('0x25')](function(_0x2c064f){return _0x2c064f;});}return null;};}function removeEntity(_0x346ede,_0x45c7b6){return function(_0x597d87){if(_0x597d87){return _0x597d87['destroy']()[_0x96f6('0x25')](function(){_0x346ede[_0x96f6('0x30')](0xcc)[_0x96f6('0x31')]();});}};}function handleEntityNotFound(_0x13a5c0,_0x2e70fe){return function(_0x4af55c){if(!_0x4af55c){_0x13a5c0[_0x96f6('0x3c')](0x194);}return _0x4af55c;};}function handleError(_0x9c92d2,_0x203471){_0x203471=_0x203471||0x1f4;return function(_0x5a8dc0){logger['error'](_0x5a8dc0[_0x96f6('0x3d')]);if(_0x5a8dc0[_0x96f6('0x3e')]){delete _0x5a8dc0['name'];}_0x9c92d2[_0x96f6('0x30')](_0x203471)[_0x96f6('0x3f')](_0x5a8dc0);};}exports[_0x96f6('0x40')]=function(_0x47cd6b,_0x2c8377){var _0x4fa761={},_0x3b7fb6={},_0x2af6c3={'count':0x0,'rows':[]};var _0x3b78cc=_[_0x96f6('0x41')](db[_0x96f6('0x42')][_0x96f6('0x43')],function(_0xd091df){return{'name':_0xd091df[_0x96f6('0x44')],'type':_0xd091df['type'][_0x96f6('0x45')]};});_0x3b7fb6[_0x96f6('0x46')]=_[_0x96f6('0x41')](_0x3b78cc,_0x96f6('0x3e'));_0x3b7fb6[_0x96f6('0x47')]=_[_0x96f6('0x48')](_0x47cd6b[_0x96f6('0x47')]);_0x3b7fb6[_0x96f6('0x49')]=_[_0x96f6('0x4a')](_0x3b7fb6[_0x96f6('0x46')],_0x3b7fb6['query']);_0x4fa761[_0x96f6('0x4b')]=_[_0x96f6('0x4a')](_0x3b7fb6['model'],qs['fields'](_0x47cd6b[_0x96f6('0x47')][_0x96f6('0x4c')]));_0x4fa761[_0x96f6('0x4b')]=_0x4fa761[_0x96f6('0x4b')][_0x96f6('0x4d')]?_0x4fa761['attributes']:_0x3b7fb6[_0x96f6('0x46')];if(!_0x47cd6b[_0x96f6('0x47')][_0x96f6('0x4e')]('nolimit')){_0x4fa761[_0x96f6('0x4f')]=qs['limit'](_0x47cd6b['query'][_0x96f6('0x4f')]);_0x4fa761[_0x96f6('0x33')]=qs['offset'](_0x47cd6b['query'][_0x96f6('0x33')]);}_0x4fa761['order']=qs[_0x96f6('0x50')](_0x47cd6b[_0x96f6('0x47')][_0x96f6('0x50')]);_0x4fa761[_0x96f6('0x51')]=qs['filters'](_[_0x96f6('0x52')](_0x47cd6b[_0x96f6('0x47')],_0x3b7fb6[_0x96f6('0x49')]),_0x3b78cc);if(_0x47cd6b[_0x96f6('0x47')][_0x96f6('0x53')]){_0x4fa761[_0x96f6('0x51')]=_[_0x96f6('0x54')](_0x4fa761[_0x96f6('0x51')],{'$or':_[_0x96f6('0x41')](_0x3b78cc,function(_0x1ec060){if(_0x1ec060[_0x96f6('0x55')]!=='VIRTUAL'){var _0x16871a={};_0x16871a[_0x1ec060['name']]={'$like':'%'+_0x47cd6b[_0x96f6('0x47')][_0x96f6('0x53')]+'%'};return _0x16871a;}})});}_0x4fa761=_[_0x96f6('0x54')]({},_0x4fa761,_0x47cd6b[_0x96f6('0x56')]);var _0x151261={'where':_0x4fa761['where']};return db[_0x96f6('0x42')]['count'](_0x151261)['then'](function(_0x568d64){_0x2af6c3['count']=_0x568d64;if(_0x47cd6b['query']['includeAll']){_0x4fa761[_0x96f6('0x57')]=[{'all':!![]}];}return db[_0x96f6('0x42')][_0x96f6('0x58')](_0x4fa761);})[_0x96f6('0x25')](function(_0x7f0326){_0x2af6c3[_0x96f6('0x59')]=_0x7f0326;return _0x2af6c3;})[_0x96f6('0x25')](respondWithFilteredResult(_0x2c8377,_0x4fa761))[_0x96f6('0x2f')](handleError(_0x2c8377,null));};exports[_0x96f6('0x5a')]=function(_0xcf9c26,_0x617cb2){var _0x31fddd={'raw':!![],'where':{'id':_0xcf9c26[_0x96f6('0x5b')]['id']}},_0x36433d={};_0x36433d[_0x96f6('0x46')]=_[_0x96f6('0x48')](db[_0x96f6('0x42')]['rawAttributes']);_0x36433d[_0x96f6('0x47')]=_['keys'](_0xcf9c26[_0x96f6('0x47')]);_0x36433d[_0x96f6('0x49')]=_['intersection'](_0x36433d[_0x96f6('0x46')],_0x36433d[_0x96f6('0x47')]);_0x31fddd['attributes']=_[_0x96f6('0x4a')](_0x36433d[_0x96f6('0x46')],qs[_0x96f6('0x4c')](_0xcf9c26[_0x96f6('0x47')]['fields']));_0x31fddd['attributes']=_0x31fddd[_0x96f6('0x4b')][_0x96f6('0x4d')]?_0x31fddd['attributes']:_0x36433d[_0x96f6('0x46')];if(_0xcf9c26[_0x96f6('0x47')][_0x96f6('0x5c')]){_0x31fddd[_0x96f6('0x57')]=[{'all':!![]}];}_0x31fddd=_[_0x96f6('0x54')]({},_0x31fddd,_0xcf9c26[_0x96f6('0x56')]);return db['OpenchannelMessage'][_0x96f6('0x5d')](_0x31fddd)['then'](handleEntityNotFound(_0x617cb2,null))[_0x96f6('0x25')](respondWithResult(_0x617cb2,null))[_0x96f6('0x2f')](handleError(_0x617cb2,null));};exports[_0x96f6('0x5e')]=function(_0x2b1b27,_0x30be18){return db[_0x96f6('0x42')]['create'](_0x2b1b27[_0x96f6('0x5f')],{})[_0x96f6('0x25')](respondWithResult(_0x30be18,0xc9))[_0x96f6('0x2f')](handleError(_0x30be18,null));};exports[_0x96f6('0x3b')]=function(_0x36c02c,_0x3fc198){if(_0x36c02c[_0x96f6('0x5f')]['id']){delete _0x36c02c['body']['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x36c02c['params']['id']}})[_0x96f6('0x25')](handleEntityNotFound(_0x3fc198,null))[_0x96f6('0x25')](saveUpdates(_0x36c02c[_0x96f6('0x5f')],null))[_0x96f6('0x25')](respondWithResult(_0x3fc198,null))[_0x96f6('0x2f')](handleError(_0x3fc198,null));};exports[_0x96f6('0x60')]=function(_0xae500e,_0x4ff67e){return db[_0x96f6('0x42')]['find']({'where':{'id':_0xae500e[_0x96f6('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ff67e,null))[_0x96f6('0x25')](removeEntity(_0x4ff67e,null))['catch'](handleError(_0x4ff67e,null));};exports[_0x96f6('0x61')]=function(_0x26f06e,_0x25d412){return db['OpenchannelMessage'][_0x96f6('0x61')]()[_0x96f6('0x25')](respondWithResult(_0x25d412,null))[_0x96f6('0x2f')](handleError(_0x25d412,null));};var interaction_log=require(_0x96f6('0x16'))(_0x96f6('0x62'));exports[_0x96f6('0x63')]=function(_0x40c162,_0x3a3a76,_0x6f2a92){var _0x15b9a6={'agent':{},'channel':_0x96f6('0x64')};if(_0x40c162['body']['id']){delete _0x40c162[_0x96f6('0x5f')]['id'];}_0x40c162[_0x96f6('0x5f')][_0x96f6('0x65')]=!![];_0x40c162[_0x96f6('0x5f')][_0x96f6('0x66')]=moment()[_0x96f6('0x67')](_0x96f6('0x68'));_0x40c162[_0x96f6('0x5f')][_0x96f6('0x69')]=_0x40c162[_0x96f6('0x5f')][_0x96f6('0x69')]||_0x40c162[_0x96f6('0x6a')]['id'];_0x15b9a6[_0x96f6('0x6b')]['id']=_0x40c162[_0x96f6('0x5f')]['UserId'];return db[_0x96f6('0x42')]['find']({'where':{'id':_0x40c162[_0x96f6('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a3a76,null))['then'](saveUpdates(_0x40c162['body'],null))['then'](function(_0x210eeb){if(_0x210eeb){_0x15b9a6[_0x96f6('0x2d')]=_0x210eeb['get']({'plain':!![]});return db[_0x96f6('0x6c')][_0x96f6('0x5d')]({'where':{'id':_0x210eeb[_0x96f6('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x3a3a76,null))[_0x96f6('0x25')](function(_0x27cf4b){if(_0x27cf4b){return _0x27cf4b[_0x96f6('0x3b')]({'UserId':_0x40c162[_0x96f6('0x5f')][_0x96f6('0x69')],'read1stAt':_['isNil'](_0x27cf4b[_0x96f6('0x6e')])?moment()[_0x96f6('0x67')](_0x96f6('0x68')):undefined});}return null;})['then'](function(_0x3917a0){if(_0x3917a0){_0x15b9a6[_0x96f6('0x6f')]=_0x3917a0[_0x96f6('0x70')]({'plain':!![]});interaction_log[_0x96f6('0x71')](_0x96f6('0x72'),_0x40c162[_0x96f6('0x6a')]['id'],_0x40c162[_0x96f6('0x6a')][_0x96f6('0x3e')],_0x40c162['user'][_0x96f6('0x73')],_0x15b9a6[_0x96f6('0x6f')]['id'],_0x40c162[_0x96f6('0x5f')]?JSON[_0x96f6('0x2a')](_0x40c162[_0x96f6('0x5f')]):_0x96f6('0x74'));return respondWithRpcPromise(_0x96f6('0x75'),'acceptMessage',_0x15b9a6);}return null;})[_0x96f6('0x25')](function(_0x4548db){var _0x5d9fa7=_0x96f6('0x76')+_0x4548db[_0x96f6('0x2d')][_0x96f6('0x77')];return db['sequelize']['query'](_0x5d9fa7,{'type':db[_0x96f6('0x78')]['QueryTypes'][_0x96f6('0x79')],'raw':!![]})['then'](function(_0x1af7cd){return _0x1af7cd;});})[_0x96f6('0x25')](function(_0x5a38d1){if(_0x5a38d1){_0x15b9a6[_0x96f6('0x2d')][_0x96f6('0x7a')]=_0x5a38d1[0x0];if(!_0x40c162[_0x96f6('0x5f')][_0x96f6('0x69')])return;return db[_0x96f6('0x7b')]['find']({'where':{'id':_0x40c162[_0x96f6('0x5f')]['UserId'],'role':'agent'},'attributes':['id','name',_0x96f6('0x7c'),'email',_0x96f6('0x7d')],'raw':!![]});}return null;})['then'](function(_0x46fefe){if(!_0x46fefe)return null;_0x15b9a6[_0x96f6('0x2d')][_0x96f6('0x6b')]=_0x46fefe;return _0x15b9a6;})['then'](function(_0x268e2a){if(_0x268e2a){if(_0x40c162[_0x96f6('0x5f')]['manual']){_0x15b9a6['message']['interface']=util[_0x96f6('0x67')](_0x96f6('0x7e'),_0x40c162['user']['name']);_0x15b9a6[_0x96f6('0x2d')][_0x96f6('0x7f')]=_0x15b9a6['channel'];_0x15b9a6['message'][_0x96f6('0x80')]=_0x15b9a6[_0x96f6('0x7f')];_0x15b9a6[_0x96f6('0x2d')][_0x96f6('0x81')]=_0x96f6('0x63');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x96f6('0x82'),'message':_0x15b9a6[_0x96f6('0x2d')]},client9002)['then'](function(){return _0x15b9a6;});}return _0x15b9a6;}return null;})[_0x96f6('0x25')](respondWithResult(_0x3a3a76,null))[_0x96f6('0x2f')](handleError(_0x3a3a76,null));};var interaction_log=require('../../config/logger')(_0x96f6('0x62'));exports[_0x96f6('0x39')]=function(_0xf19ca3,_0x2f48ff,_0x32411e){var _0x1f37cd={'agent':{},'channel':_0x96f6('0x64')};if(_0xf19ca3[_0x96f6('0x5f')]['id']){delete _0xf19ca3['body']['id'];}_0xf19ca3['body']['UserId']=_0xf19ca3[_0x96f6('0x5f')][_0x96f6('0x69')]||_0xf19ca3['user']['id'];_0x1f37cd[_0x96f6('0x6b')]['id']=_0xf19ca3[_0x96f6('0x5f')]['UserId'];return db['OpenchannelMessage'][_0x96f6('0x5d')]({'where':{'id':_0xf19ca3[_0x96f6('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2f48ff,null))[_0x96f6('0x25')](function(_0x3371be){if(_0x3371be){_0x1f37cd['message']=_0x3371be['get']({'plain':!![]});return db[_0x96f6('0x6c')][_0x96f6('0x5d')]({'where':{'id':_0x3371be[_0x96f6('0x6d')]}});}return null;})[_0x96f6('0x25')](handleEntityNotFound(_0x2f48ff,null))['then'](function(_0x57a565){if(_0x57a565){_0x1f37cd['interaction']=_0x57a565[_0x96f6('0x70')]({'plain':!![]});interaction_log['info'](_0x96f6('0x83'),_0xf19ca3[_0x96f6('0x6a')]['id'],_0xf19ca3['user']['name'],_0xf19ca3[_0x96f6('0x6a')][_0x96f6('0x73')],_0x1f37cd['interaction']['id'],_0xf19ca3[_0x96f6('0x5f')]?JSON[_0x96f6('0x2a')](_0xf19ca3[_0x96f6('0x5f')]):_0x96f6('0x74'));return respondWithRpcPromise(_0x96f6('0x84'),_0x96f6('0x85'),_0x1f37cd);}return null;})[_0x96f6('0x25')](function(_0x37e61e){var _0x5a100c=_0x96f6('0x76')+_0x37e61e[_0x96f6('0x2d')][_0x96f6('0x77')];return db['sequelize'][_0x96f6('0x47')](_0x5a100c,{'type':db['Sequelize'][_0x96f6('0x86')][_0x96f6('0x79')],'raw':!![]})['then'](function(_0x42b552){return _0x42b552;});})[_0x96f6('0x25')](function(_0x3f9fb2){if(_0x3f9fb2){_0x1f37cd[_0x96f6('0x2d')][_0x96f6('0x7a')]=_0x3f9fb2[0x0];if(!_0xf19ca3[_0x96f6('0x5f')][_0x96f6('0x69')])return;return db[_0x96f6('0x7b')]['find']({'where':{'id':_0xf19ca3[_0x96f6('0x5f')]['UserId'],'role':_0x96f6('0x6b')},'attributes':['id',_0x96f6('0x3e'),_0x96f6('0x7c'),_0x96f6('0x87'),_0x96f6('0x7d')],'raw':!![]});}return null;})[_0x96f6('0x25')](function(_0x1b76e8){if(!_0x1b76e8)return null;_0x1f37cd[_0x96f6('0x2d')][_0x96f6('0x6b')]=_0x1b76e8;return _0x1f37cd;})[_0x96f6('0x25')](function(_0xaade2b){if(_0xaade2b){_0xaade2b[_0x96f6('0x2d')]['interface']=util[_0x96f6('0x67')](_0x96f6('0x7e'),_0xf19ca3['user'][_0x96f6('0x3e')]);_0xaade2b['message'][_0x96f6('0x7f')]=_0x1f37cd['channel'];_0xaade2b[_0x96f6('0x2d')][_0x96f6('0x80')]=_0x1f37cd['channel'];_0xaade2b['message'][_0x96f6('0x81')]='reject';respondWithRpcPromise(_0x96f6('0x88'),'EventManager',{'event':_0x96f6('0x89'),'message':_0xaade2b[_0x96f6('0x2d')]},client9002);return _0x1f37cd;}return null;})[_0x96f6('0x25')](respondWithResult(_0x2f48ff,null))[_0x96f6('0x2f')](handleError(_0x2f48ff,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 13a82b1..94594ec 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 _0xb266=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x5941f9,_0x1261f1){var _0xbdc9f9=function(_0xcc6abe){while(--_0xcc6abe){_0x5941f9['push'](_0x5941f9['shift']());}};_0xbdc9f9(++_0x1261f1);}(_0xb266,0x18c));var _0x6b26=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb266[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x6b26('0x0'));var OpenchannelMessage=require(_0x6b26('0x1'))['db'][_0x6b26('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6b26('0x3')](0x0);var events={'afterCreate':_0x6b26('0x4'),'afterUpdate':_0x6b26('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57a235){return function(_0x48a723,_0x256482,_0xac7bd0){OpenchannelMessageEvents[_0x6b26('0x6')](_0x57a235+':'+_0x48a723['id'],_0x48a723);OpenchannelMessageEvents['emit'](_0x57a235,_0x48a723);_0xac7bd0(null);};}for(var e in events){if(events[_0x6b26('0x7')](e)){var event=events[e];OpenchannelMessage[_0x6b26('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x80db=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xefe90,_0x5a0c90){var _0x3ee871=function(_0x2b38d0){while(--_0x2b38d0){_0xefe90['push'](_0xefe90['shift']());}};_0x3ee871(++_0x5a0c90);}(_0x80db,0x1a2));var _0xb80d=function(_0x4e2991,_0x31a663){_0x4e2991=_0x4e2991-0x0;var _0xc08156=_0x80db[_0x4e2991];return _0xc08156;};'use strict';var EventEmitter=require(_0xb80d('0x0'));var OpenchannelMessage=require(_0xb80d('0x1'))['db'][_0xb80d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb80d('0x3')](0x0);var events={'afterCreate':_0xb80d('0x4'),'afterUpdate':_0xb80d('0x5'),'afterDestroy':_0xb80d('0x6')};function emitEvent(_0x4339ff){return function(_0x467b87,_0x1bc407,_0x2ee6bf){OpenchannelMessageEvents[_0xb80d('0x7')](_0x4339ff+':'+_0x467b87['id'],_0x467b87);OpenchannelMessageEvents[_0xb80d('0x7')](_0x4339ff,_0x467b87);_0x2ee6bf(null);};}for(var e in events){if(events[_0xb80d('0x8')](e)){var event=events[e];OpenchannelMessage[_0xb80d('0x9')](e,emitEvent(event));}}module[_0xb80d('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e54b591..b1d46bb 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 _0x840e=['isNil','UserId','findOne','OpenchannelInteractionId','createdAt','catch','secret','CmContact','describe','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','replyUri','GET','body','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','toLowerCase','direction','out'];(function(_0x2a14fb,_0x6f1e5d){var _0x2a9180=function(_0x5b21b2){while(--_0x5b21b2){_0x2a14fb['push'](_0x2a14fb['shift']());}};_0x2a9180(++_0x6f1e5d);}(_0x840e,0xba));var _0xe840=function(_0x3a331e,_0x7db48b){_0x3a331e=_0x3a331e-0x0;var _0x2684a6=_0x840e[_0x3a331e];return _0x2684a6;};'use strict';var _=require('lodash');var util=require(_0xe840('0x0'));var logger=require('../../config/logger')(_0xe840('0x1'));var moment=require(_0xe840('0x2'));var BPromise=require(_0xe840('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe840('0x4'));var rimraf=require(_0xe840('0x5'));var config=require(_0xe840('0x6'));var attributes=require(_0xe840('0x7'));module[_0xe840('0x8')]=function(_0x5f9777,_0x14f9a4){return _0x5f9777[_0xe840('0x9')]('OpenchannelMessage',attributes,{'tableName':_0xe840('0xa'),'paranoid':![],'indexes':[{'name':_0xe840('0xb'),'fields':['body'],'type':_0xe840('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x372192,_0x4cc36d,_0x4219e2){var _0x4be5a0=_0x5f9777[_0xe840('0xd')];var _0x3a6200=_0x372192[_0xe840('0xe')]({'plain':!![]});if(_0x3a6200['direction'][_0xe840('0xf')]()==='in'||_0x3a6200[_0xe840('0x10')]['toLowerCase']()===_0xe840('0x11')&&!_0x3a6200['secret']&&!_[_0xe840('0x12')](_0x3a6200[_0xe840('0x13')])){_0x4be5a0['OpenchannelInteraction'][_0xe840('0x14')]({'where':{'id':_0x3a6200[_0xe840('0x15')]}})['then'](function(_0x4955a2){if(_0x4955a2){_0x4955a2['update']({'lastMsgAt':_0x3a6200[_0xe840('0x16')],'lastMsgDirection':_0x3a6200[_0xe840('0x10')]['toLowerCase']()});}})[_0xe840('0x17')](function(_0x6fb269){console['error'](_0x6fb269);});}if(_0x3a6200[_0xe840('0x10')]===_0xe840('0x11')&&!_0x3a6200[_0xe840('0x18')]){var _0x204b82;_0x4be5a0[_0xe840('0x19')][_0xe840('0x1a')]()[_0xe840('0x1b')](function(_0x339fe6){return _0x4be5a0[_0xe840('0x1c')]['find']({'where':{'id':_0x3a6200[_0xe840('0x1d')]},'include':[{'model':_0x4be5a0[_0xe840('0x1e')],'as':_0xe840('0x1f'),'where':{'id':_0x3a6200[_0xe840('0x15')]},'limit':0x1,'include':[{'model':_0x4be5a0[_0xe840('0x19')],'as':'Contact','attributes':_[_0xe840('0x20')](_0x339fe6)}]}]});})[_0xe840('0x1b')](function(_0xc91ad2){_0x204b82=_0xc91ad2[_0xe840('0xe')]({'plain':!![]});if(_0x204b82&&_0x204b82['replyUri']){logger[_0xe840('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0xe840('0x22'),util[_0xe840('0x23')](_0xe840('0x24'),_0x3a6200['id'],_0x204b82['replyUri']));if(_0x204b82['Interactions']&&_0x204b82['Interactions'][_0xe840('0x25')]){_0x3a6200[_0xe840('0x26')]=_[_0xe840('0x27')](_0x204b82[_0xe840('0x1f')][0x0],_0xe840('0x28'));_0x3a6200['Contact']=_0x204b82[_0xe840('0x1f')][0x0]['Contact'];}var _0x4cc36d={'method':'POST','uri':encodeURI(_0x204b82[_0xe840('0x29')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4cc36d['method']){case _0xe840('0x2a'):_0x4cc36d['qs']=_0x3a6200;break;case'POST':_0x4cc36d[_0xe840('0x2b')]=_0x3a6200;break;}return rp(_0x4cc36d)[_0xe840('0x1b')](function(_0xbbe6d1){logger[_0xe840('0x21')](_0xe840('0x2c'),_0xe840('0x22'),util[_0xe840('0x23')](_0xe840('0x2d'),_0x3a6200['id'],_0x204b82['replyUri']));if(_0xbbe6d1[_0xe840('0x2b')][_0xe840('0x2e')]&&_0xbbe6d1[_0xe840('0x2b')][_0xe840('0x2e')]!=_0x3a6200['Interaction'][_0xe840('0x2e')]){return _0x4be5a0[_0xe840('0x1e')][_0xe840('0x2f')]({'threadId':_0xbbe6d1[_0xe840('0x2b')][_0xe840('0x2e')]},{'where':{'id':_0x3a6200['Interaction']['id']}});}else{return;}})[_0xe840('0x1b')](function(){return _0x372192[_0xe840('0x2f')]({'read':!![]});})[_0xe840('0x17')](function(_0x28790c){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xe840('0x22'),util[_0xe840('0x30')](_0x28790c,{'showHidden':![],'depth':null}));_0x4219e2();});}else{_0x4219e2();}})['finally'](function(){_0x4219e2();});}else{_0x4219e2();}}},'charset':_0xe840('0x31'),'collate':_0xe840('0x32')});}; \ No newline at end of file +var _0x1bf2=['api','moment','request-promise','rimraf','../../config/environment','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','lodash','util','../../config/logger'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1bf2,0xfc));var _0x21bf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1bf2[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x21bf('0x0'));var util=require(_0x21bf('0x1'));var logger=require(_0x21bf('0x2'))(_0x21bf('0x3'));var moment=require(_0x21bf('0x4'));var BPromise=require('bluebird');var rp=require(_0x21bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21bf('0x6'));var config=require(_0x21bf('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x21bf('0x8')]=function(_0x29f85f,_0x1da115){return _0x29f85f['define'](_0x21bf('0x9'),attributes,{'tableName':_0x21bf('0xa'),'paranoid':![],'indexes':[{'name':_0x21bf('0xb'),'fields':[_0x21bf('0xc')],'type':_0x21bf('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x546fbb,_0x3d6790,_0x39b498){var _0x1fec34=_0x29f85f[_0x21bf('0xe')];var _0x1eb5bd=_0x546fbb[_0x21bf('0xf')]({'plain':!![]});if(_0x1eb5bd[_0x21bf('0x10')][_0x21bf('0x11')]()==='in'||_0x1eb5bd[_0x21bf('0x10')][_0x21bf('0x11')]()===_0x21bf('0x12')&&!_0x1eb5bd[_0x21bf('0x13')]&&!_[_0x21bf('0x14')](_0x1eb5bd[_0x21bf('0x15')])){_0x1fec34[_0x21bf('0x16')][_0x21bf('0x17')]({'where':{'id':_0x1eb5bd['OpenchannelInteractionId']}})[_0x21bf('0x18')](function(_0x349c61){if(_0x349c61){_0x349c61[_0x21bf('0x19')]({'lastMsgAt':_0x1eb5bd[_0x21bf('0x1a')],'lastMsgDirection':_0x1eb5bd['direction']['toLowerCase']()});}})[_0x21bf('0x1b')](function(_0x5e86dd){console[_0x21bf('0x1c')](_0x5e86dd);});}if(_0x1eb5bd[_0x21bf('0x10')]===_0x21bf('0x12')&&!_0x1eb5bd['secret']){var _0x13cda8;_0x1fec34[_0x21bf('0x1d')][_0x21bf('0x1e')]()[_0x21bf('0x18')](function(_0x3c5485){return _0x1fec34['OpenchannelAccount'][_0x21bf('0x1f')]({'where':{'id':_0x1eb5bd[_0x21bf('0x20')]},'include':[{'model':_0x1fec34[_0x21bf('0x16')],'as':_0x21bf('0x21'),'where':{'id':_0x1eb5bd[_0x21bf('0x22')]},'limit':0x1,'include':[{'model':_0x1fec34[_0x21bf('0x1d')],'as':_0x21bf('0x23'),'attributes':_[_0x21bf('0x24')](_0x3c5485)}]}]});})['then'](function(_0x28ca7f){_0x13cda8=_0x28ca7f[_0x21bf('0xf')]({'plain':!![]});if(_0x13cda8&&_0x13cda8[_0x21bf('0x25')]){logger[_0x21bf('0x26')](_0x21bf('0x27'),_0x21bf('0x28'),util[_0x21bf('0x29')](_0x21bf('0x2a'),_0x1eb5bd['id'],_0x13cda8[_0x21bf('0x25')]));if(_0x13cda8[_0x21bf('0x21')]&&_0x13cda8[_0x21bf('0x21')]['length']){_0x1eb5bd['Interaction']=_[_0x21bf('0x2b')](_0x13cda8['Interactions'][0x0],'Contact');_0x1eb5bd[_0x21bf('0x23')]=_0x13cda8['Interactions'][0x0]['Contact'];}var _0x3d6790={'method':_0x21bf('0x2c'),'uri':encodeURI(_0x13cda8[_0x21bf('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3d6790['method']){case'GET':_0x3d6790['qs']=_0x1eb5bd;break;case'POST':_0x3d6790['body']=_0x1eb5bd;break;}return rp(_0x3d6790)[_0x21bf('0x18')](function(_0x55eb3e){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x21bf('0x28'),util['format'](_0x21bf('0x2d'),_0x1eb5bd['id'],_0x13cda8[_0x21bf('0x25')]));if(_0x55eb3e[_0x21bf('0xc')][_0x21bf('0x2e')]&&_0x55eb3e['body']['threadId']!=_0x1eb5bd[_0x21bf('0x2f')][_0x21bf('0x2e')]){return _0x1fec34[_0x21bf('0x16')]['update']({'threadId':_0x55eb3e[_0x21bf('0xc')]['threadId']},{'where':{'id':_0x1eb5bd['Interaction']['id']}});}else{return;}})[_0x21bf('0x18')](function(){return _0x546fbb[_0x21bf('0x19')]({'read':!![]});})[_0x21bf('0x1b')](function(_0x13f462){logger[_0x21bf('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x21bf('0x28'),util[_0x21bf('0x30')](_0x13f462,{'showHidden':![],'depth':null}));_0x39b498();});}else{_0x39b498();}})[_0x21bf('0x31')](function(){_0x39b498();});}else{_0x39b498();}}},'charset':_0x21bf('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f68ef60..95a2e89 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18d373,_0x187a94){var _0xdbbab8=function(_0x16205f){while(--_0x16205f){_0x18d373['push'](_0x18d373['shift']());}};_0xdbbab8(++_0x187a94);}(_0x1261,0x144));var _0x1126=function(_0x1e1f97,_0x2f6925){_0x1e1f97=_0x1e1f97-0x0;var _0x1e45fb=_0x1261[_0x1e1f97];return _0x1e45fb;};'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});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ 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(_0x452399,_0x8f3198){var _0x24c705=function(_0x20636e){while(--_0x20636e){_0x452399['push'](_0x452399['shift']());}};_0x24c705(++_0x8f3198);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'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 9c9f21f..44a4c3c 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 _0x7d9f=['./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x1d7da9,_0x36a4b1){var _0x390e07=function(_0x237760){while(--_0x237760){_0x1d7da9['push'](_0x1d7da9['shift']());}};_0x390e07(++_0x36a4b1);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x7d9f[_0x42ca15];return _0x1c6ded;};'use strict';var OpenchannelMessageEvents=require(_0xf7d9('0x0'));var events=[_0xf7d9('0x1'),_0xf7d9('0x2'),_0xf7d9('0x3')];function createListener(_0x265b56,_0x538e69){return function(_0x15a23b){_0x538e69[_0xf7d9('0x4')](_0x265b56,_0x15a23b);};}function removeListener(_0xd43b74,_0x159e95){return function(){OpenchannelMessageEvents[_0xf7d9('0x5')](_0xd43b74,_0x159e95);};}exports['register']=function(_0x4b50c7){for(var _0x2eb0f1=0x0,_0x250675=events['length'];_0x2eb0f1<_0x250675;_0x2eb0f1++){var _0x21c654=events[_0x2eb0f1];var _0x1685a6=createListener('openchannelMessage:'+_0x21c654,_0x4b50c7);OpenchannelMessageEvents['on'](_0x21c654,_0x1685a6);}}; \ No newline at end of file +var _0xc1ea=['register','openchannelMessage:','./openchannelMessage.events','save','remove','update','removeListener'];(function(_0x37fcd0,_0x141d80){var _0x3869d4=function(_0x52c5a3){while(--_0x52c5a3){_0x37fcd0['push'](_0x37fcd0['shift']());}};_0x3869d4(++_0x141d80);}(_0xc1ea,0x13d));var _0xac1e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc1ea[_0x40a045];return _0x1a687c;};'use strict';var OpenchannelMessageEvents=require(_0xac1e('0x0'));var events=[_0xac1e('0x1'),_0xac1e('0x2'),_0xac1e('0x3')];function createListener(_0x467e12,_0x599698){return function(_0x49f8b5){_0x599698['emit'](_0x467e12,_0x49f8b5);};}function removeListener(_0xeaeb64,_0x275ff2){return function(){OpenchannelMessageEvents[_0xac1e('0x4')](_0xeaeb64,_0x275ff2);};}exports[_0xac1e('0x5')]=function(_0x482abe){for(var _0x244ed6=0x0,_0x46a341=events['length'];_0x244ed6<_0x46a341;_0x244ed6++){var _0x333e11=events[_0x244ed6];var _0x31f1dc=createListener(_0xac1e('0x6')+_0x333e11,_0x482abe);OpenchannelMessageEvents['on'](_0x333e11,_0x31f1dc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 1f194d9..30bc87b 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 _0xe98d=['/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe'];(function(_0xb90e9d,_0x513011){var _0x301e10=function(_0x3d8855){while(--_0x3d8855){_0xb90e9d['push'](_0xb90e9d['shift']());}};_0x301e10(++_0x513011);}(_0xe98d,0x1e2));var _0xde98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xde98('0x0'));var util=require(_0xde98('0x1'));var path=require('path');var timeout=require(_0xde98('0x2'));var express=require('express');var router=express[_0xde98('0x3')]();var fs_extra=require(_0xde98('0x4'));var auth=require(_0xde98('0x5'));var interaction=require(_0xde98('0x6'));var config=require(_0xde98('0x7'));var controller=require('./openchannelQueue.controller');router[_0xde98('0x8')]('/',auth['isAuthenticated'](),controller[_0xde98('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xde98('0xa')]);router[_0xde98('0x8')](_0xde98('0xb'),auth[_0xde98('0xc')](),controller[_0xde98('0xd')]);router[_0xde98('0x8')](_0xde98('0xe'),auth['isAuthenticated'](),controller[_0xde98('0xf')]);router[_0xde98('0x8')](_0xde98('0x10'),auth[_0xde98('0xc')](),controller['getTeams']);router[_0xde98('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xde98('0x11')]);router[_0xde98('0x12')]('/',auth[_0xde98('0xc')](),controller[_0xde98('0x13')]);router[_0xde98('0x12')](_0xde98('0x10'),auth[_0xde98('0xc')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xde98('0x14')]);router[_0xde98('0x15')](_0xde98('0xb'),auth['isAuthenticated'](),controller[_0xde98('0x16')]);router[_0xde98('0x17')](_0xde98('0xb'),auth[_0xde98('0xc')](),controller[_0xde98('0x18')]);router[_0xde98('0x17')](_0xde98('0x10'),auth['isAuthenticated'](),controller[_0xde98('0x19')]);router[_0xde98('0x17')](_0xde98('0x1a'),auth['isAuthenticated'](),controller[_0xde98('0x1b')]);module[_0xde98('0x1c')]=router; \ No newline at end of file +var _0xfd5c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','create','post','addTeams','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','express','fs-extra'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0xfd5c,0x1ac));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcfd5('0x0'));var util=require('util');var path=require(_0xcfd5('0x1'));var timeout=require('connect-timeout');var express=require(_0xcfd5('0x2'));var router=express['Router']();var fs_extra=require(_0xcfd5('0x3'));var auth=require(_0xcfd5('0x4'));var interaction=require(_0xcfd5('0x5'));var config=require(_0xcfd5('0x6'));var controller=require('./openchannelQueue.controller');router[_0xcfd5('0x7')]('/',auth[_0xcfd5('0x8')](),controller[_0xcfd5('0x9')]);router[_0xcfd5('0x7')](_0xcfd5('0xa'),auth[_0xcfd5('0x8')](),controller[_0xcfd5('0xb')]);router[_0xcfd5('0x7')](_0xcfd5('0xc'),auth['isAuthenticated'](),controller[_0xcfd5('0xd')]);router[_0xcfd5('0x7')](_0xcfd5('0xe'),auth[_0xcfd5('0x8')](),controller['getMembers']);router['get'](_0xcfd5('0xf'),auth[_0xcfd5('0x8')](),controller['getTeams']);router['get'](_0xcfd5('0x10'),auth[_0xcfd5('0x8')](),controller[_0xcfd5('0x11')]);router['post']('/',auth[_0xcfd5('0x8')](),controller[_0xcfd5('0x12')]);router[_0xcfd5('0x13')](_0xcfd5('0xf'),auth[_0xcfd5('0x8')](),controller[_0xcfd5('0x14')]);router['post'](_0xcfd5('0x10'),auth[_0xcfd5('0x8')](),controller['addAgents']);router['put'](_0xcfd5('0xc'),auth[_0xcfd5('0x8')](),controller[_0xcfd5('0x15')]);router['delete'](_0xcfd5('0xc'),auth['isAuthenticated'](),controller[_0xcfd5('0x16')]);router[_0xcfd5('0x17')](_0xcfd5('0xf'),auth[_0xcfd5('0x8')](),controller[_0xcfd5('0x18')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xcfd5('0x19')]);module[_0xcfd5('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 895e6f3..d8a7745 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 _0x7e0a=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x3f3759,_0x57f880){var _0x6540d5=function(_0xa64f8f){while(--_0xa64f8f){_0x3f3759['push'](_0x3f3759['shift']());}};_0x6540d5(++_0x57f880);}(_0x7e0a,0x1c8));var _0xa7e0=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x7e0a[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0xa7e0('0x0'));module[_0xa7e0('0x1')]={'name':{'type':Sequelize[_0xa7e0('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa7e0('0x2')]},'timeout':{'type':Sequelize[_0xa7e0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa7e0('0x4'),_0xa7e0('0x5'),_0xa7e0('0x6'))}}; \ No newline at end of file +var _0x6f59=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x6f59,0xe1));var _0x96f5=function(_0x200dd4,_0x42fc56){_0x200dd4=_0x200dd4-0x0;var _0x3a771f=_0x6f59[_0x200dd4];return _0x3a771f;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'name':{'type':Sequelize[_0x96f5('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x96f5('0x2')]},'timeout':{'type':Sequelize[_0x96f5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x96f5('0x4')](_0x96f5('0x5'),'beepall',_0x96f5('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a3f025b..fbf4e7f 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 _0x00e7=['online','voicePause','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Agents','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','all','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','bluebird','util','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','get','OpenchannelQueues','destroy','then','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','pick','filter','merge','map','options','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','sort','ids'];(function(_0x51cf64,_0x303dab){var _0x2c982b=function(_0x471301){while(--_0x471301){_0x51cf64['push'](_0x51cf64['shift']());}};_0x2c982b(++_0x303dab);}(_0x00e7,0x111));var _0x700e=function(_0x4adfa4,_0x121c5a){_0x4adfa4=_0x4adfa4-0x0;var _0x14cec1=_0x00e7[_0x4adfa4];return _0x14cec1;};'use strict';var BPromise=require(_0x700e('0x0'));var util=require(_0x700e('0x1'));var _=require('lodash');var squel=require(_0x700e('0x2'));var Redis=require(_0x700e('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x700e('0x4'))(_0x700e('0x5'));var config=require('../../config/environment');var db=require(_0x700e('0x6'))['db'];config[_0x700e('0x7')]=_[_0x700e('0x8')](config[_0x700e('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x700e('0x9'))(new Redis(config[_0x700e('0x7')]));require(_0x700e('0xa'))[_0x700e('0xb')](socket);function respondWithStatusCode(_0x31ad5c,_0x4e0cc3){_0x4e0cc3=_0x4e0cc3||0xcc;return function(_0x392d0d){if(_0x392d0d){return _0x31ad5c[_0x700e('0xc')](_0x4e0cc3);}return _0x31ad5c[_0x700e('0xd')](_0x4e0cc3)[_0x700e('0xe')]();};}function respondWithResult(_0x3ed838,_0x10155e){_0x10155e=_0x10155e||0xc8;return function(_0x287d1d){if(_0x287d1d){return _0x3ed838[_0x700e('0xd')](_0x10155e)[_0x700e('0xf')](_0x287d1d);}};}function respondWithFilteredResult(_0x528594,_0x5be951){return function(_0x649b0c){if(_0x649b0c){var _0x23eb3d=typeof _0x5be951['offset']==='undefined'&&typeof _0x5be951[_0x700e('0x10')]==='undefined';var _0x50b988=_0x649b0c[_0x700e('0x11')];var _0xa33a1a=_0x23eb3d?0x0:_0x5be951[_0x700e('0x12')];var _0x3158eb=_0x23eb3d?_0x649b0c['count']:_0x5be951[_0x700e('0x12')]+_0x5be951['limit'];var _0x4517f5;if(_0x3158eb>=_0x50b988){_0x3158eb=_0x50b988;_0x4517f5=0xc8;}else{_0x4517f5=0xce;}_0x528594[_0x700e('0xd')](_0x4517f5);return _0x528594[_0x700e('0x13')](_0x700e('0x14'),_0xa33a1a+'-'+_0x3158eb+'/'+_0x50b988)[_0x700e('0xf')](_0x649b0c);}return null;};}function saveUpdates(_0x19c24f){return function(_0x7a7142){if(_0x7a7142){return _0x7a7142[_0x700e('0x15')](_0x19c24f)['then'](function(_0x269055){return _0x269055;});}return null;};}function removeEntity(_0x4b7466){return function(_0x2b9afe){if(_0x2b9afe){return _0x2b9afe['destroy']()['then'](function(){var _0xc43edb=_0x2b9afe[_0x700e('0x16')]({'plain':!![]});var _0x129a75=_0x700e('0x17');return db['UserProfileResource'][_0x700e('0x18')]({'where':{'type':_0x129a75,'resourceId':_0xc43edb['id']}})[_0x700e('0x19')](function(){return _0x2b9afe;});})[_0x700e('0x19')](function(){_0x4b7466[_0x700e('0xd')](0xcc)[_0x700e('0xe')]();});}};}function handleEntityNotFound(_0x351323){return function(_0x1794ba){if(!_0x1794ba){_0x351323[_0x700e('0xc')](0x194);}return _0x1794ba;};}function handleError(_0xe244ee,_0x5589bc){_0x5589bc=_0x5589bc||0x1f4;return function(_0x2bf833){logger[_0x700e('0x1a')](_0x2bf833[_0x700e('0x1b')]);if(_0x2bf833[_0x700e('0x1c')]){delete _0x2bf833[_0x700e('0x1c')];}_0xe244ee[_0x700e('0xd')](_0x5589bc)[_0x700e('0x1d')](_0x2bf833);};}exports[_0x700e('0x1e')]=function(_0xd2cae4,_0xa31ba1){var _0x4d2d5b={};var _0x1fd920={'count':0x0,'rows':[]};var _0x360d24=_['map'](db[_0x700e('0x1f')][_0x700e('0x20')],function(_0x1f1de3){return{'name':_0x1f1de3[_0x700e('0x21')],'type':_0x1f1de3['type'][_0x700e('0x22')]};});_0x4d2d5b=qs[_0x700e('0x23')](_0x360d24,_0xd2cae4);var _0x373f65={'where':_0x4d2d5b[_0x700e('0x24')]};return db[_0x700e('0x1f')][_0x700e('0x11')](_0x373f65)[_0x700e('0x19')](function(_0x4f3099){_0x1fd920[_0x700e('0x11')]=_0x4f3099;_0x4d2d5b[_0x700e('0x25')]=qs[_0x700e('0x25')](_0xd2cae4[_0x700e('0x26')]);return db[_0x700e('0x1f')][_0x700e('0x27')](_0x4d2d5b);})[_0x700e('0x19')](function(_0x4f665d){_0x1fd920[_0x700e('0x28')]=_0x4f665d;return _0x1fd920;})[_0x700e('0x19')](respondWithFilteredResult(_0xa31ba1,_0x4d2d5b))[_0x700e('0x29')](handleError(_0xa31ba1,null));};exports[_0x700e('0x2a')]=function(_0x4cd5c7,_0x341143){var _0x2de0a4={'raw':!![],'where':{'id':_0x4cd5c7[_0x700e('0x2b')]['id']}},_0x15fe87={};_0x15fe87[_0x700e('0x2c')]=_[_0x700e('0x2d')](db[_0x700e('0x1f')]['rawAttributes']);_0x15fe87[_0x700e('0x26')]=_[_0x700e('0x2d')](_0x4cd5c7[_0x700e('0x26')]);_0x15fe87[_0x700e('0x2e')]=_[_0x700e('0x2f')](_0x15fe87[_0x700e('0x2c')],_0x15fe87[_0x700e('0x26')]);_0x2de0a4['attributes']=_['intersection'](_0x15fe87[_0x700e('0x2c')],qs[_0x700e('0x30')](_0x4cd5c7['query'][_0x700e('0x30')]));_0x2de0a4[_0x700e('0x31')]=_0x2de0a4[_0x700e('0x31')]['length']?_0x2de0a4[_0x700e('0x31')]:_0x15fe87[_0x700e('0x2c')];if(_0x4cd5c7[_0x700e('0x26')][_0x700e('0x32')]){_0x2de0a4[_0x700e('0x25')]=[{'all':!![]}];}_0x2de0a4=_['merge']({},_0x2de0a4,_0x4cd5c7['options']);return db[_0x700e('0x1f')][_0x700e('0x33')](_0x2de0a4)[_0x700e('0x19')](handleEntityNotFound(_0x341143,null))[_0x700e('0x19')](respondWithResult(_0x341143,null))[_0x700e('0x29')](handleError(_0x341143,null));};exports[_0x700e('0x34')]=function(_0x201ee9,_0x582dcf){return db['OpenchannelQueue'][_0x700e('0x34')](_0x201ee9[_0x700e('0x35')],{})[_0x700e('0x19')](function(_0x553534){var _0x46eefe=_0x201ee9[_0x700e('0x36')][_0x700e('0x16')]({'plain':!![]});if(!_0x46eefe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46eefe[_0x700e('0x37')]===_0x700e('0x36')){var _0x706ec2=_0x553534['get']({'plain':!![]});var _0x20cd45=_0x700e('0x17');return db[_0x700e('0x38')][_0x700e('0x33')]({'where':{'name':_0x20cd45,'userProfileId':_0x46eefe[_0x700e('0x39')]},'raw':!![]})[_0x700e('0x19')](function(_0x543247){if(_0x543247&&_0x543247[_0x700e('0x3a')]===0x0){return db[_0x700e('0x3b')][_0x700e('0x34')]({'name':_0x706ec2[_0x700e('0x1c')],'resourceId':_0x706ec2['id'],'type':_0x543247[_0x700e('0x1c')],'sectionId':_0x543247['id']},{})[_0x700e('0x19')](function(){return _0x553534;});}else{return _0x553534;}})[_0x700e('0x29')](function(_0x13cd7b){logger[_0x700e('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13cd7b);throw _0x13cd7b;});}return _0x553534;})[_0x700e('0x19')](respondWithResult(_0x582dcf,0xc9))['catch'](handleError(_0x582dcf,null));};exports[_0x700e('0x15')]=function(_0x3ddb7d,_0x4e22a1){if(_0x3ddb7d[_0x700e('0x35')]['id']){delete _0x3ddb7d['body']['id'];}return db[_0x700e('0x1f')][_0x700e('0x33')]({'where':{'id':_0x3ddb7d['params']['id']}})[_0x700e('0x19')](handleEntityNotFound(_0x4e22a1,null))[_0x700e('0x19')](saveUpdates(_0x3ddb7d[_0x700e('0x35')],null))[_0x700e('0x19')](respondWithResult(_0x4e22a1,null))['catch'](handleError(_0x4e22a1,null));};exports[_0x700e('0x18')]=function(_0x1cdce6,_0x37502f){return db['OpenchannelQueue']['find']({'where':{'id':_0x1cdce6['params']['id']}})[_0x700e('0x19')](handleEntityNotFound(_0x37502f,null))[_0x700e('0x19')](removeEntity(_0x37502f,null))[_0x700e('0x29')](handleError(_0x37502f,null));};exports[_0x700e('0x3c')]=function(_0x5ab6ab,_0x11c0b1){return db[_0x700e('0x1f')][_0x700e('0x3c')]()[_0x700e('0x19')](respondWithResult(_0x11c0b1,null))[_0x700e('0x29')](handleError(_0x11c0b1,null));};exports[_0x700e('0x3d')]=function(_0xf1c832,_0x5db35b){var _0x2f29d6={'raw':!![],'where':{}},_0x569e0f={},_0x462a63;return db[_0x700e('0x1f')][_0x700e('0x3e')]({'where':{'id':_0xf1c832[_0x700e('0x2b')]['id']}})[_0x700e('0x19')](handleEntityNotFound(_0x5db35b,null))[_0x700e('0x19')](function(_0xba24a6){if(_0xba24a6){_0x462a63=_0xba24a6[_0x700e('0x16')]({'plain':!![]});_0x569e0f[_0x700e('0x2c')]=_[_0x700e('0x2d')](db[_0x700e('0x3f')][_0x700e('0x20')]);_0x569e0f['query']=_['keys'](_0xf1c832[_0x700e('0x26')]);_0x569e0f[_0x700e('0x2e')]=_[_0x700e('0x2f')](_0x569e0f[_0x700e('0x2c')],_0x569e0f['query']);_0x2f29d6['attributes']=_[_0x700e('0x2f')](_0x569e0f['model'],qs[_0x700e('0x30')](_0xf1c832[_0x700e('0x26')][_0x700e('0x30')]));_0x2f29d6[_0x700e('0x31')]=_0x2f29d6[_0x700e('0x31')][_0x700e('0x40')]?_0x2f29d6[_0x700e('0x31')]:_0x569e0f[_0x700e('0x2c')];if(!_0xf1c832[_0x700e('0x26')][_0x700e('0x41')](_0x700e('0x42'))){_0x2f29d6[_0x700e('0x10')]=qs[_0x700e('0x10')](_0xf1c832[_0x700e('0x26')][_0x700e('0x10')]);_0x2f29d6[_0x700e('0x12')]=qs[_0x700e('0x12')](_0xf1c832[_0x700e('0x26')][_0x700e('0x12')]);}_0x2f29d6[_0x700e('0x43')]=qs['sort'](_0xf1c832[_0x700e('0x26')]['sort']);_0x2f29d6['where']=qs[_0x700e('0x2e')](_[_0x700e('0x44')](_0xf1c832['query'],_0x569e0f[_0x700e('0x2e')]));_0x2f29d6['where']['OpenchannelQueueId']=_0xba24a6['id'];if(_0xf1c832[_0x700e('0x26')][_0x700e('0x45')]){_0x2f29d6['where']=_[_0x700e('0x46')](_0x2f29d6['where'],{'$or':_[_0x700e('0x47')](_0x2f29d6['attributes'],function(_0x2e25b9){var _0x1f4374={};_0x1f4374[_0x2e25b9]={'$like':'%'+_0xf1c832['query'][_0x700e('0x45')]+'%'};return _0x1f4374;})});}_0x2f29d6=_[_0x700e('0x46')]({},_0x2f29d6,_0xf1c832[_0x700e('0x48')]);return db[_0x700e('0x3f')]['findAll'](_0x2f29d6);}})['then'](function(_0x2352e3){if(_0x2352e3){return db[_0x700e('0x49')][_0x700e('0x4a')]({'where':{'id':_[_0x700e('0x47')](_0x2352e3,_0x700e('0x4b')),'role':_0x700e('0x4c')},'attributes':['id','name',_0x700e('0x4d'),_0x700e('0x4e'),_0x700e('0x4f')]});}})[_0x700e('0x19')](function(_0x342270){if(_0x342270){return{'count':_0x342270[_0x700e('0x11')],'rows':_[_0x700e('0x47')](_0x342270['rows'],function(_0x3e6cc5){return{'membername':_0x3e6cc5['name'],'UserId':_0x3e6cc5['id'],'queue_name':_0x462a63[_0x700e('0x1c')],'OpenchannelQueueId':_0x462a63['id'],'interface':util[_0x700e('0x50')](_0x700e('0x51'),_0x700e('0x52'),_0x3e6cc5[_0x700e('0x1c')]),'penalty':0x0,'paused':_0x3e6cc5[_0x700e('0x4d')],'createdAt':_0x3e6cc5['createdAt'],'updatedAt':_0x3e6cc5[_0x700e('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5db35b,_0x2f29d6))['catch'](handleError(_0x5db35b,null));};exports[_0x700e('0x53')]=function(_0x34608f,_0x3114c4){var _0x18bccc={};var _0x2dd97f={};var _0xb425e9;var _0x4e3089;return db['OpenchannelQueue'][_0x700e('0x3e')]({'where':{'id':_0x34608f['params']['id']}})[_0x700e('0x19')](handleEntityNotFound(_0x3114c4,null))['then'](function(_0x3b35d8){if(_0x3b35d8){_0xb425e9=_0x3b35d8;_0x2dd97f[_0x700e('0x2c')]=_['keys'](db[_0x700e('0x54')][_0x700e('0x20')]);_0x2dd97f[_0x700e('0x26')]=_['keys'](_0x34608f['query']);_0x2dd97f['filters']=_[_0x700e('0x2f')](_0x2dd97f[_0x700e('0x2c')],_0x2dd97f['query']);_0x18bccc[_0x700e('0x31')]=_[_0x700e('0x2f')](_0x2dd97f[_0x700e('0x2c')],qs[_0x700e('0x30')](_0x34608f[_0x700e('0x26')][_0x700e('0x30')]));_0x18bccc[_0x700e('0x31')]=_0x18bccc[_0x700e('0x31')][_0x700e('0x40')]?_0x18bccc[_0x700e('0x31')]:_0x2dd97f[_0x700e('0x2c')];_0x18bccc[_0x700e('0x43')]=qs[_0x700e('0x55')](_0x34608f['query'][_0x700e('0x55')]);_0x18bccc[_0x700e('0x24')]=qs[_0x700e('0x2e')](_[_0x700e('0x44')](_0x34608f[_0x700e('0x26')],_0x2dd97f['filters']));if(_0x34608f[_0x700e('0x26')][_0x700e('0x45')]){_0x18bccc['where']=_[_0x700e('0x46')](_0x18bccc['where'],{'$or':_[_0x700e('0x47')](_0x18bccc[_0x700e('0x31')],function(_0x45c12a){var _0x3c42e8={};_0x3c42e8[_0x45c12a]={'$like':'%'+_0x34608f[_0x700e('0x26')]['filter']+'%'};return _0x3c42e8;})});}_0x18bccc=_['merge']({},_0x18bccc,_0x34608f[_0x700e('0x48')]);return _0xb425e9[_0x700e('0x53')](_0x18bccc);}})[_0x700e('0x19')](function(_0x569c12){if(_0x569c12){_0x4e3089=_0x569c12[_0x700e('0x40')];if(!_0x34608f[_0x700e('0x26')][_0x700e('0x41')]('nolimit')){_0x18bccc['limit']=qs[_0x700e('0x10')](_0x34608f[_0x700e('0x26')][_0x700e('0x10')]);_0x18bccc[_0x700e('0x12')]=qs[_0x700e('0x12')](_0x34608f[_0x700e('0x26')][_0x700e('0x12')]);}return _0xb425e9[_0x700e('0x53')](_0x18bccc);}})[_0x700e('0x19')](function(_0x5965d4){if(_0x5965d4){return _0x5965d4?{'count':_0x4e3089,'rows':_0x5965d4}:null;}})['then'](respondWithResult(_0x3114c4,null))[_0x700e('0x29')](handleError(_0x3114c4,null));};exports['addTeams']=function(_0x1ef56e,_0x1b62ac){var _0x14b1a0=_0x1ef56e[_0x700e('0x35')][_0x700e('0x56')];return db['Team'][_0x700e('0x27')]({'where':{'id':_0x14b1a0},'attributes':['id'],'include':[{'model':db[_0x700e('0x49')],'as':'Agents','attributes':['id',_0x700e('0x1c'),_0x700e('0x57'),_0x700e('0x58'),_0x700e('0x59')],'raw':!![]}]})[_0x700e('0x19')](function(_0x5ab4d8){if(_0x5ab4d8){var _0x6186c5=_['flatMap'](_0x5ab4d8,function(_0xde47ed){var _0x3f4d0c=_0xde47ed['get']({'plain':!![]});return _0x3f4d0c['Agents'];});return db['OpenchannelQueue'][_0x700e('0x33')]({'where':{'id':_0x1ef56e[_0x700e('0x2b')]['id']}})[_0x700e('0x19')](function(_0x39e511){return db[_0x700e('0x5a')]['transaction'](function(_0x3de24b){return _0x39e511[_0x700e('0x5b')](_0x14b1a0,{'transaction':_0x3de24b})[_0x700e('0x19')](function(){return BPromise[_0x700e('0x5c')](_0x6186c5,function(_0x4e2091){return db['UserOpenchannelQueue'][_0x700e('0x5d')]({'where':{'UserId':_0x4e2091['id'],'OpenchannelQueueId':_0x1ef56e[_0x700e('0x2b')]['id']},'transaction':_0x3de24b});});})[_0x700e('0x19')](function(){_0x6186c5[_0x700e('0x5e')](function(_0x2647ab){socket[_0x700e('0x5f')](_0x700e('0x60'),{'UserId':_0x2647ab['id'],'OpenchannelQueueId':_0x39e511['id']});});});});});}})[_0x700e('0x19')](respondWithStatusCode(_0x1b62ac,null))[_0x700e('0x29')](handleError(_0x1b62ac,null));};exports[_0x700e('0x61')]=function(_0x5bdf50,_0x2e1390){return db[_0x700e('0x54')][_0x700e('0x27')]({'where':{'id':_0x5bdf50[_0x700e('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0x700e('0x49')],'as':_0x700e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x700e('0x19')](handleEntityNotFound(_0x2e1390,null))[_0x700e('0x19')](function(_0x2d0e9d){var _0x42708a=_[_0x700e('0x47')](_0x2d0e9d,'id');var _0xbb8fe6=[];var _0x886bff=[];var _0xa21bfa=squel[_0x700e('0x63')]();_0xa21bfa['field']('tq.TeamId')[_0x700e('0x64')](_0x700e('0x65'),'tq')[_0x700e('0x66')](_0x700e('0x67'),'ut',_0x700e('0x68'))[_0x700e('0x24')](_0x700e('0x69'),_0x5bdf50[_0x700e('0x2b')]['id']);for(var _0x27952e=0x0;_0x27952e<_0x2d0e9d[_0x700e('0x40')];_0x27952e+=0x1){let _0x2d99ef=_0x2d0e9d[_0x27952e];for(var _0x5c683a=0x0;_0x5c683a<_0x2d99ef[_0x700e('0x62')]['length'];_0x5c683a+=0x1){let _0x583d78=_0x2d99ef['Agents'][_0x5c683a];var _0x5eebda=_0xa21bfa['clone']();_0x5eebda[_0x700e('0x24')](_0x700e('0x6a'),_0x583d78['id']);_0x886bff[_0x700e('0x6b')](db['sequelize'][_0x700e('0x26')](_0x5eebda[_0x700e('0x6c')](),{'type':db[_0x700e('0x5a')]['QueryTypes'][_0x700e('0x6d')]})[_0x700e('0x19')](function(_0x287a9d){if(_0x287a9d['length']===0x1){return _0x583d78['id'];}else{var _0x4a0d93=_['every'](_[_0x700e('0x47')](_0x287a9d,'TeamId'),function(_0x58cae2){return _['includes'](_0x42708a,_0x58cae2);});if(_0x4a0d93){return _0x583d78['id'];}}}));}}return BPromise[_0x700e('0x6e')](_0x886bff)[_0x700e('0x19')](function(_0xc8d493){_0xbb8fe6=_(_0xbb8fe6)['union'](_0xc8d493)[_0x700e('0x6f')]()[_0x700e('0x70')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x5bdf50['params']['id']}})[_0x700e('0x19')](function(_0x203048){return db['sequelize']['transaction'](function(_0x2a3707){return _0x203048[_0x700e('0x61')](_0x5bdf50[_0x700e('0x26')][_0x700e('0x56')],{'transaction':_0x2a3707})[_0x700e('0x19')](function(){if(!_[_0x700e('0x71')](_0xbb8fe6)){return _0x203048['removeAgents'](_0xbb8fe6,{'transaction':_0x2a3707});}})[_0x700e('0x19')](function(){_0xbb8fe6['forEach'](function(_0x3ec95c){socket[_0x700e('0x5f')](_0x700e('0x72'),{'UserId':_0x3ec95c,'OpenchannelQueueId':_0x203048['id']});});});});});});})[_0x700e('0x19')](respondWithStatusCode(_0x2e1390,null))[_0x700e('0x29')](handleError(_0x2e1390,null));};exports[_0x700e('0x73')]=function(_0x18593c,_0x5aa540){return db['OpenchannelQueue'][_0x700e('0x33')]({'where':{'id':_0x18593c[_0x700e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5aa540,null))[_0x700e('0x19')](function(_0xc2b624){if(_0xc2b624){return _0xc2b624[_0x700e('0x73')](_0x18593c[_0x700e('0x35')][_0x700e('0x56')],_['omit'](_0x18593c['body'],[_0x700e('0x56'),'id'])||{})[_0x700e('0x74')](function(_0x398bc0){for(var _0x4e5b5d=0x0;_0x4e5b5d<_0x18593c[_0x700e('0x35')][_0x700e('0x56')][_0x700e('0x40')];_0x4e5b5d+=0x1){socket[_0x700e('0x5f')](_0x700e('0x60'),{'UserId':Number(_0x18593c[_0x700e('0x35')][_0x700e('0x56')][_0x4e5b5d]),'OpenchannelQueueId':Number(_0x18593c[_0x700e('0x2b')]['id'])});}return _0x398bc0;});}})[_0x700e('0x19')](respondWithResult(_0x5aa540,null))['catch'](handleError(_0x5aa540,null));};exports[_0x700e('0x75')]=function(_0x1a0952,_0x59402d){return db[_0x700e('0x1f')][_0x700e('0x33')]({'where':{'id':_0x1a0952[_0x700e('0x2b')]['id']}})[_0x700e('0x19')](handleEntityNotFound(_0x59402d,null))[_0x700e('0x19')](function(_0x2edade){if(_0x2edade){return _0x2edade['removeAgents'](_0x1a0952[_0x700e('0x26')][_0x700e('0x56')])[_0x700e('0x19')](function(){if(_[_0x700e('0x76')](_0x1a0952['query'][_0x700e('0x56')])){for(var _0x22b608=0x0;_0x22b608<_0x1a0952[_0x700e('0x26')][_0x700e('0x56')]['length'];_0x22b608+=0x1){socket[_0x700e('0x5f')](_0x700e('0x72'),{'UserId':Number(_0x1a0952[_0x700e('0x26')][_0x700e('0x56')][_0x22b608]),'OpenchannelQueueId':Number(_0x1a0952['params']['id'])});}}else{socket[_0x700e('0x5f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1a0952[_0x700e('0x26')]['ids']),'OpenchannelQueueId':Number(_0x1a0952[_0x700e('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x59402d,null))[_0x700e('0x29')](handleError(_0x59402d,null));};exports[_0x700e('0x77')]=function(_0x50f719,_0xe5ffa4){var _0x4d1386={};var _0x42b2f6={};var _0xe60fc9;var _0x33967d;return db[_0x700e('0x1f')]['findOne']({'where':{'id':_0x50f719[_0x700e('0x2b')]['id']}})[_0x700e('0x19')](handleEntityNotFound(_0xe5ffa4,null))['then'](function(_0x54613b){if(_0x54613b){_0xe60fc9=_0x54613b;_0x42b2f6[_0x700e('0x2c')]=_['keys'](db[_0x700e('0x49')]['rawAttributes']);_0x42b2f6[_0x700e('0x26')]=_['keys'](_0x50f719[_0x700e('0x26')]);_0x42b2f6[_0x700e('0x2e')]=_[_0x700e('0x2f')](_0x42b2f6[_0x700e('0x2c')],_0x42b2f6[_0x700e('0x26')]);_0x4d1386['attributes']=_[_0x700e('0x2f')](_0x42b2f6[_0x700e('0x2c')],qs[_0x700e('0x30')](_0x50f719[_0x700e('0x26')][_0x700e('0x30')]));_0x4d1386[_0x700e('0x31')]=_0x4d1386['attributes'][_0x700e('0x40')]?_0x4d1386[_0x700e('0x31')]:_0x42b2f6['model'];_0x4d1386[_0x700e('0x43')]=qs['sort'](_0x50f719[_0x700e('0x26')][_0x700e('0x55')]);_0x4d1386[_0x700e('0x24')]=qs[_0x700e('0x2e')](_[_0x700e('0x44')](_0x50f719['query'],_0x42b2f6[_0x700e('0x2e')]));if(_0x50f719[_0x700e('0x26')][_0x700e('0x45')]){_0x4d1386[_0x700e('0x24')]=_[_0x700e('0x46')](_0x4d1386[_0x700e('0x24')],{'$or':_[_0x700e('0x47')](_0x4d1386[_0x700e('0x31')],function(_0x3df3b2){var _0x1fb327={};_0x1fb327[_0x3df3b2]={'$like':'%'+_0x50f719[_0x700e('0x26')]['filter']+'%'};return _0x1fb327;})});}_0x4d1386=_[_0x700e('0x46')]({},_0x4d1386,_0x50f719[_0x700e('0x48')]);return _0xe60fc9[_0x700e('0x77')](_0x4d1386);}})[_0x700e('0x19')](function(_0x1c4b57){if(_0x1c4b57){_0x33967d=_0x1c4b57[_0x700e('0x40')];if(!_0x50f719['query'][_0x700e('0x41')](_0x700e('0x42'))){_0x4d1386[_0x700e('0x10')]=qs[_0x700e('0x10')](_0x50f719['query'][_0x700e('0x10')]);_0x4d1386[_0x700e('0x12')]=qs[_0x700e('0x12')](_0x50f719[_0x700e('0x26')][_0x700e('0x12')]);}return _0xe60fc9['getAgents'](_0x4d1386);}})[_0x700e('0x19')](function(_0x22ed0d){if(_0x22ed0d){return _0x22ed0d?{'count':_0x33967d,'rows':_0x22ed0d}:null;}})[_0x700e('0x19')](respondWithResult(_0xe5ffa4,null))[_0x700e('0x29')](handleError(_0xe5ffa4,null));}; \ No newline at end of file +var _0x1465=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','map','OpenchannelQueue','key','getOptions','include','query','rows','params','model','rawAttributes','keys','filters','intersection','fields','attributes','includeAll','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','where','pick','OpenchannelQueueId','filter','merge','findAll','UserId','openchannelPause','createdAt','format','SIP','updatedAt','getTeams','Team','sort','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userOpenchannelQueue:save','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join'];(function(_0x1d275b,_0x22d108){var _0x1cc50a=function(_0x19000f){while(--_0x19000f){_0x1d275b['push'](_0x1d275b['shift']());}};_0x1cc50a(++_0x22d108);}(_0x1465,0x178));var _0x5146=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0x1465[_0x344adc];return _0x4014b2;};'use strict';var BPromise=require(_0x5146('0x0'));var util=require(_0x5146('0x1'));var _=require(_0x5146('0x2'));var squel=require(_0x5146('0x3'));var Redis=require(_0x5146('0x4'));var qs=require(_0x5146('0x5'));var logger=require(_0x5146('0x6'))(_0x5146('0x7'));var config=require(_0x5146('0x8'));var db=require(_0x5146('0x9'))['db'];config[_0x5146('0xa')]=_['defaults'](config[_0x5146('0xa')],{'host':_0x5146('0xb'),'port':0x18eb});var socket=require(_0x5146('0xc'))(new Redis(config[_0x5146('0xa')]));require(_0x5146('0xd'))[_0x5146('0xe')](socket);function respondWithStatusCode(_0x415877,_0x25a120){_0x25a120=_0x25a120||0xcc;return function(_0x2fbbaa){if(_0x2fbbaa){return _0x415877[_0x5146('0xf')](_0x25a120);}return _0x415877[_0x5146('0x10')](_0x25a120)[_0x5146('0x11')]();};}function respondWithResult(_0x1820a8,_0x5b1f49){_0x5b1f49=_0x5b1f49||0xc8;return function(_0x1cfe0e){if(_0x1cfe0e){return _0x1820a8[_0x5146('0x10')](_0x5b1f49)[_0x5146('0x12')](_0x1cfe0e);}};}function respondWithFilteredResult(_0xf550a1,_0x5f4deb){return function(_0x4a4870){if(_0x4a4870){var _0x2c6d80=typeof _0x5f4deb['offset']===_0x5146('0x13')&&typeof _0x5f4deb['limit']===_0x5146('0x13');var _0x165fef=_0x4a4870[_0x5146('0x14')];var _0x2680b2=_0x2c6d80?0x0:_0x5f4deb[_0x5146('0x15')];var _0x3e2677=_0x2c6d80?_0x4a4870['count']:_0x5f4deb[_0x5146('0x15')]+_0x5f4deb[_0x5146('0x16')];var _0x13ec7d;if(_0x3e2677>=_0x165fef){_0x3e2677=_0x165fef;_0x13ec7d=0xc8;}else{_0x13ec7d=0xce;}_0xf550a1[_0x5146('0x10')](_0x13ec7d);return _0xf550a1[_0x5146('0x17')](_0x5146('0x18'),_0x2680b2+'-'+_0x3e2677+'/'+_0x165fef)[_0x5146('0x12')](_0x4a4870);}return null;};}function saveUpdates(_0x290370){return function(_0x1f20f2){if(_0x1f20f2){return _0x1f20f2['update'](_0x290370)[_0x5146('0x19')](function(_0x5ba581){return _0x5ba581;});}return null;};}function removeEntity(_0x514d07){return function(_0x4abb43){if(_0x4abb43){return _0x4abb43[_0x5146('0x1a')]()['then'](function(){var _0x575a79=_0x4abb43[_0x5146('0x1b')]({'plain':!![]});var _0x523df2=_0x5146('0x1c');return db[_0x5146('0x1d')][_0x5146('0x1a')]({'where':{'type':_0x523df2,'resourceId':_0x575a79['id']}})['then'](function(){return _0x4abb43;});})['then'](function(){_0x514d07[_0x5146('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c093){return function(_0x5ecb6b){if(!_0x5ecb6b){_0x49c093[_0x5146('0xf')](0x194);}return _0x5ecb6b;};}function handleError(_0x2c60b1,_0x280238){_0x280238=_0x280238||0x1f4;return function(_0x5dc073){logger[_0x5146('0x1e')](_0x5dc073['stack']);if(_0x5dc073['name']){delete _0x5dc073[_0x5146('0x1f')];}_0x2c60b1[_0x5146('0x10')](_0x280238)['send'](_0x5dc073);};}exports['index']=function(_0xc0329a,_0x6a2749){var _0x2d3c33={};var _0x3c4e00={'count':0x0,'rows':[]};var _0x1f3c4e=_[_0x5146('0x20')](db[_0x5146('0x21')]['rawAttributes'],function(_0x3ab6e4){return{'name':_0x3ab6e4['fieldName'],'type':_0x3ab6e4['type'][_0x5146('0x22')]};});_0x2d3c33=qs[_0x5146('0x23')](_0x1f3c4e,_0xc0329a);var _0x441072={'where':_0x2d3c33['where']};return db[_0x5146('0x21')][_0x5146('0x14')](_0x441072)[_0x5146('0x19')](function(_0x1739b9){_0x3c4e00[_0x5146('0x14')]=_0x1739b9;_0x2d3c33[_0x5146('0x24')]=qs[_0x5146('0x24')](_0xc0329a[_0x5146('0x25')]);return db[_0x5146('0x21')]['findAll'](_0x2d3c33);})[_0x5146('0x19')](function(_0x2fa4da){_0x3c4e00[_0x5146('0x26')]=_0x2fa4da;return _0x3c4e00;})[_0x5146('0x19')](respondWithFilteredResult(_0x6a2749,_0x2d3c33))['catch'](handleError(_0x6a2749,null));};exports['show']=function(_0x5c5d9e,_0x5c617f){var _0x99a977={'raw':!![],'where':{'id':_0x5c5d9e[_0x5146('0x27')]['id']}},_0x3f59d7={};_0x3f59d7[_0x5146('0x28')]=_['keys'](db[_0x5146('0x21')][_0x5146('0x29')]);_0x3f59d7[_0x5146('0x25')]=_[_0x5146('0x2a')](_0x5c5d9e[_0x5146('0x25')]);_0x3f59d7[_0x5146('0x2b')]=_['intersection'](_0x3f59d7[_0x5146('0x28')],_0x3f59d7[_0x5146('0x25')]);_0x99a977['attributes']=_[_0x5146('0x2c')](_0x3f59d7[_0x5146('0x28')],qs[_0x5146('0x2d')](_0x5c5d9e[_0x5146('0x25')]['fields']));_0x99a977[_0x5146('0x2e')]=_0x99a977['attributes']['length']?_0x99a977['attributes']:_0x3f59d7[_0x5146('0x28')];if(_0x5c5d9e[_0x5146('0x25')][_0x5146('0x2f')]){_0x99a977[_0x5146('0x24')]=[{'all':!![]}];}_0x99a977=_['merge']({},_0x99a977,_0x5c5d9e[_0x5146('0x30')]);return db[_0x5146('0x21')][_0x5146('0x31')](_0x99a977)[_0x5146('0x19')](handleEntityNotFound(_0x5c617f,null))[_0x5146('0x19')](respondWithResult(_0x5c617f,null))[_0x5146('0x32')](handleError(_0x5c617f,null));};exports[_0x5146('0x33')]=function(_0x3653a9,_0x486178){return db['OpenchannelQueue'][_0x5146('0x33')](_0x3653a9['body'],{})[_0x5146('0x19')](function(_0x35dfb5){var _0x53e0aa=_0x3653a9[_0x5146('0x34')][_0x5146('0x1b')]({'plain':!![]});if(!_0x53e0aa)throw new Error(_0x5146('0x35'));if(_0x53e0aa['role']===_0x5146('0x34')){var _0x9c086f=_0x35dfb5[_0x5146('0x1b')]({'plain':!![]});var _0x29bcc7=_0x5146('0x1c');return db[_0x5146('0x36')][_0x5146('0x31')]({'where':{'name':_0x29bcc7,'userProfileId':_0x53e0aa[_0x5146('0x37')]},'raw':!![]})[_0x5146('0x19')](function(_0x3e25ce){if(_0x3e25ce&&_0x3e25ce[_0x5146('0x38')]===0x0){return db['UserProfileResource']['create']({'name':_0x9c086f[_0x5146('0x1f')],'resourceId':_0x9c086f['id'],'type':_0x3e25ce['name'],'sectionId':_0x3e25ce['id']},{})[_0x5146('0x19')](function(){return _0x35dfb5;});}else{return _0x35dfb5;}})[_0x5146('0x32')](function(_0x805f84){logger[_0x5146('0x1e')](_0x5146('0x39'),_0x805f84);throw _0x805f84;});}return _0x35dfb5;})[_0x5146('0x19')](respondWithResult(_0x486178,0xc9))[_0x5146('0x32')](handleError(_0x486178,null));};exports['update']=function(_0x3b20cd,_0x2bb9e5){if(_0x3b20cd[_0x5146('0x3a')]['id']){delete _0x3b20cd['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x3b20cd[_0x5146('0x27')]['id']}})[_0x5146('0x19')](handleEntityNotFound(_0x2bb9e5,null))[_0x5146('0x19')](saveUpdates(_0x3b20cd['body'],null))[_0x5146('0x19')](respondWithResult(_0x2bb9e5,null))[_0x5146('0x32')](handleError(_0x2bb9e5,null));};exports['destroy']=function(_0xc1f6b6,_0x41df59){return db[_0x5146('0x21')][_0x5146('0x31')]({'where':{'id':_0xc1f6b6['params']['id']}})[_0x5146('0x19')](handleEntityNotFound(_0x41df59,null))[_0x5146('0x19')](removeEntity(_0x41df59,null))[_0x5146('0x32')](handleError(_0x41df59,null));};exports[_0x5146('0x3b')]=function(_0x308941,_0x379093){return db['OpenchannelQueue'][_0x5146('0x3b')]()[_0x5146('0x19')](respondWithResult(_0x379093,null))[_0x5146('0x32')](handleError(_0x379093,null));};exports[_0x5146('0x3c')]=function(_0x4b5b6a,_0x2944c7){var _0x3ba303={'raw':!![],'where':{}},_0x583499={},_0x36ee0f;return db['OpenchannelQueue'][_0x5146('0x3d')]({'where':{'id':_0x4b5b6a[_0x5146('0x27')]['id']}})['then'](handleEntityNotFound(_0x2944c7,null))[_0x5146('0x19')](function(_0x8e09b2){if(_0x8e09b2){_0x36ee0f=_0x8e09b2[_0x5146('0x1b')]({'plain':!![]});_0x583499[_0x5146('0x28')]=_[_0x5146('0x2a')](db[_0x5146('0x3e')][_0x5146('0x29')]);_0x583499[_0x5146('0x25')]=_['keys'](_0x4b5b6a[_0x5146('0x25')]);_0x583499['filters']=_[_0x5146('0x2c')](_0x583499[_0x5146('0x28')],_0x583499['query']);_0x3ba303['attributes']=_[_0x5146('0x2c')](_0x583499[_0x5146('0x28')],qs[_0x5146('0x2d')](_0x4b5b6a[_0x5146('0x25')][_0x5146('0x2d')]));_0x3ba303['attributes']=_0x3ba303[_0x5146('0x2e')][_0x5146('0x3f')]?_0x3ba303['attributes']:_0x583499[_0x5146('0x28')];if(!_0x4b5b6a[_0x5146('0x25')][_0x5146('0x40')](_0x5146('0x41'))){_0x3ba303[_0x5146('0x16')]=qs[_0x5146('0x16')](_0x4b5b6a[_0x5146('0x25')][_0x5146('0x16')]);_0x3ba303[_0x5146('0x15')]=qs[_0x5146('0x15')](_0x4b5b6a['query'][_0x5146('0x15')]);}_0x3ba303[_0x5146('0x42')]=qs['sort'](_0x4b5b6a[_0x5146('0x25')]['sort']);_0x3ba303[_0x5146('0x43')]=qs[_0x5146('0x2b')](_[_0x5146('0x44')](_0x4b5b6a[_0x5146('0x25')],_0x583499[_0x5146('0x2b')]));_0x3ba303[_0x5146('0x43')][_0x5146('0x45')]=_0x8e09b2['id'];if(_0x4b5b6a['query'][_0x5146('0x46')]){_0x3ba303['where']=_[_0x5146('0x47')](_0x3ba303['where'],{'$or':_['map'](_0x3ba303[_0x5146('0x2e')],function(_0x1ab9f2){var _0x191993={};_0x191993[_0x1ab9f2]={'$like':'%'+_0x4b5b6a[_0x5146('0x25')]['filter']+'%'};return _0x191993;})});}_0x3ba303=_['merge']({},_0x3ba303,_0x4b5b6a[_0x5146('0x30')]);return db['UserOpenchannelQueue'][_0x5146('0x48')](_0x3ba303);}})[_0x5146('0x19')](function(_0x991914){if(_0x991914){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x991914,_0x5146('0x49')),'role':'agent'},'attributes':['id',_0x5146('0x1f'),_0x5146('0x4a'),'updatedAt',_0x5146('0x4b')]});}})[_0x5146('0x19')](function(_0x7b83b5){if(_0x7b83b5){return{'count':_0x7b83b5[_0x5146('0x14')],'rows':_[_0x5146('0x20')](_0x7b83b5['rows'],function(_0x3b70e9){return{'membername':_0x3b70e9['name'],'UserId':_0x3b70e9['id'],'queue_name':_0x36ee0f['name'],'OpenchannelQueueId':_0x36ee0f['id'],'interface':util[_0x5146('0x4c')]('%s/%s',_0x5146('0x4d'),_0x3b70e9[_0x5146('0x1f')]),'penalty':0x0,'paused':_0x3b70e9['openchannelPause'],'createdAt':_0x3b70e9[_0x5146('0x4b')],'updatedAt':_0x3b70e9[_0x5146('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5146('0x19')](respondWithFilteredResult(_0x2944c7,_0x3ba303))['catch'](handleError(_0x2944c7,null));};exports[_0x5146('0x4f')]=function(_0x20a86c,_0x4e3d52){var _0x35e4ff={};var _0x450189={};var _0x290645;var _0x17b485;return db[_0x5146('0x21')][_0x5146('0x3d')]({'where':{'id':_0x20a86c[_0x5146('0x27')]['id']}})['then'](handleEntityNotFound(_0x4e3d52,null))['then'](function(_0x1e6ff8){if(_0x1e6ff8){_0x290645=_0x1e6ff8;_0x450189['model']=_[_0x5146('0x2a')](db[_0x5146('0x50')][_0x5146('0x29')]);_0x450189[_0x5146('0x25')]=_['keys'](_0x20a86c[_0x5146('0x25')]);_0x450189[_0x5146('0x2b')]=_['intersection'](_0x450189[_0x5146('0x28')],_0x450189[_0x5146('0x25')]);_0x35e4ff[_0x5146('0x2e')]=_[_0x5146('0x2c')](_0x450189['model'],qs[_0x5146('0x2d')](_0x20a86c[_0x5146('0x25')][_0x5146('0x2d')]));_0x35e4ff[_0x5146('0x2e')]=_0x35e4ff[_0x5146('0x2e')][_0x5146('0x3f')]?_0x35e4ff[_0x5146('0x2e')]:_0x450189[_0x5146('0x28')];_0x35e4ff[_0x5146('0x42')]=qs[_0x5146('0x51')](_0x20a86c[_0x5146('0x25')][_0x5146('0x51')]);_0x35e4ff[_0x5146('0x43')]=qs[_0x5146('0x2b')](_[_0x5146('0x44')](_0x20a86c[_0x5146('0x25')],_0x450189['filters']));if(_0x20a86c['query'][_0x5146('0x46')]){_0x35e4ff[_0x5146('0x43')]=_['merge'](_0x35e4ff['where'],{'$or':_[_0x5146('0x20')](_0x35e4ff[_0x5146('0x2e')],function(_0x487cbf){var _0x36d6e8={};_0x36d6e8[_0x487cbf]={'$like':'%'+_0x20a86c[_0x5146('0x25')][_0x5146('0x46')]+'%'};return _0x36d6e8;})});}_0x35e4ff=_['merge']({},_0x35e4ff,_0x20a86c[_0x5146('0x30')]);return _0x290645['getTeams'](_0x35e4ff);}})[_0x5146('0x19')](function(_0x240b72){if(_0x240b72){_0x17b485=_0x240b72[_0x5146('0x3f')];if(!_0x20a86c['query'][_0x5146('0x40')](_0x5146('0x41'))){_0x35e4ff[_0x5146('0x16')]=qs[_0x5146('0x16')](_0x20a86c[_0x5146('0x25')][_0x5146('0x16')]);_0x35e4ff[_0x5146('0x15')]=qs[_0x5146('0x15')](_0x20a86c[_0x5146('0x25')][_0x5146('0x15')]);}return _0x290645['getTeams'](_0x35e4ff);}})[_0x5146('0x19')](function(_0x28bd45){if(_0x28bd45){return _0x28bd45?{'count':_0x17b485,'rows':_0x28bd45}:null;}})[_0x5146('0x19')](respondWithResult(_0x4e3d52,null))[_0x5146('0x32')](handleError(_0x4e3d52,null));};exports[_0x5146('0x52')]=function(_0x24ea37,_0x265f2f){var _0x3f3588=_0x24ea37[_0x5146('0x3a')]['ids'];return db[_0x5146('0x50')][_0x5146('0x48')]({'where':{'id':_0x3f3588},'attributes':['id'],'include':[{'model':db[_0x5146('0x53')],'as':_0x5146('0x54'),'attributes':['id','name','online',_0x5146('0x55'),_0x5146('0x56')],'raw':!![]}]})['then'](function(_0x4ae18e){if(_0x4ae18e){var _0x350025=_[_0x5146('0x57')](_0x4ae18e,function(_0x159364){var _0x6054b9=_0x159364[_0x5146('0x1b')]({'plain':!![]});return _0x6054b9[_0x5146('0x54')];});return db[_0x5146('0x21')][_0x5146('0x31')]({'where':{'id':_0x24ea37[_0x5146('0x27')]['id']}})[_0x5146('0x19')](function(_0x5269e1){return db[_0x5146('0x58')][_0x5146('0x59')](function(_0x2e3dc4){return _0x5269e1['addTeams'](_0x3f3588,{'transaction':_0x2e3dc4})[_0x5146('0x19')](function(){return BPromise[_0x5146('0x5a')](_0x350025,function(_0x233a97){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x233a97['id'],'OpenchannelQueueId':_0x24ea37[_0x5146('0x27')]['id']},'transaction':_0x2e3dc4});});})[_0x5146('0x19')](function(){_0x350025[_0x5146('0x5b')](function(_0x324c56){socket['emit'](_0x5146('0x5c'),{'UserId':_0x324c56['id'],'OpenchannelQueueId':_0x5269e1['id']});});});});});}})[_0x5146('0x19')](respondWithStatusCode(_0x265f2f,null))[_0x5146('0x32')](handleError(_0x265f2f,null));};exports['removeTeams']=function(_0x137b47,_0x32cbb6){return db['Team']['findAll']({'where':{'id':_0x137b47[_0x5146('0x25')][_0x5146('0x5d')]},'attributes':['id'],'include':[{'model':db[_0x5146('0x53')],'as':_0x5146('0x54'),'attributes':['id'],'raw':!![]}]})[_0x5146('0x19')](handleEntityNotFound(_0x32cbb6,null))[_0x5146('0x19')](function(_0x365b08){var _0x117a89=_[_0x5146('0x20')](_0x365b08,'id');var _0x42f560=[];var _0x9a6d84=[];var _0x1cc3ee=squel[_0x5146('0x5e')]();_0x1cc3ee[_0x5146('0x5f')](_0x5146('0x60'))[_0x5146('0x61')](_0x5146('0x62'),'tq')[_0x5146('0x63')](_0x5146('0x64'),'ut',_0x5146('0x65'))['where'](_0x5146('0x66'),_0x137b47[_0x5146('0x27')]['id']);for(var _0x4ba0b7=0x0;_0x4ba0b7<_0x365b08['length'];_0x4ba0b7+=0x1){let _0x185efc=_0x365b08[_0x4ba0b7];for(var _0x17f610=0x0;_0x17f610<_0x185efc['Agents'][_0x5146('0x3f')];_0x17f610+=0x1){let _0x4b58d3=_0x185efc[_0x5146('0x54')][_0x17f610];var _0x3334b7=_0x1cc3ee[_0x5146('0x67')]();_0x3334b7[_0x5146('0x43')]('ut.UserId\x20=\x20?',_0x4b58d3['id']);_0x9a6d84['push'](db[_0x5146('0x58')][_0x5146('0x25')](_0x3334b7[_0x5146('0x68')](),{'type':db[_0x5146('0x58')][_0x5146('0x69')][_0x5146('0x6a')]})[_0x5146('0x19')](function(_0x44312d){if(_0x44312d['length']===0x1){return _0x4b58d3['id'];}else{var _0x463441=_['every'](_['map'](_0x44312d,_0x5146('0x6b')),function(_0x450566){return _['includes'](_0x117a89,_0x450566);});if(_0x463441){return _0x4b58d3['id'];}}}));}}return BPromise[_0x5146('0x6c')](_0x9a6d84)[_0x5146('0x19')](function(_0x3fffa1){_0x42f560=_(_0x42f560)['union'](_0x3fffa1)[_0x5146('0x6d')]()[_0x5146('0x6e')]();return db['OpenchannelQueue'][_0x5146('0x31')]({'where':{'id':_0x137b47[_0x5146('0x27')]['id']}})['then'](function(_0x43e20f){return db[_0x5146('0x58')][_0x5146('0x59')](function(_0x2dd24d){return _0x43e20f['removeTeams'](_0x137b47[_0x5146('0x25')][_0x5146('0x5d')],{'transaction':_0x2dd24d})[_0x5146('0x19')](function(){if(!_[_0x5146('0x6f')](_0x42f560)){return _0x43e20f[_0x5146('0x70')](_0x42f560,{'transaction':_0x2dd24d});}})[_0x5146('0x19')](function(){_0x42f560[_0x5146('0x5b')](function(_0x586a94){socket[_0x5146('0x71')](_0x5146('0x72'),{'UserId':_0x586a94,'OpenchannelQueueId':_0x43e20f['id']});});});});});});})[_0x5146('0x19')](respondWithStatusCode(_0x32cbb6,null))['catch'](handleError(_0x32cbb6,null));};exports[_0x5146('0x73')]=function(_0x5ea12f,_0x340fec){return db[_0x5146('0x21')][_0x5146('0x31')]({'where':{'id':_0x5ea12f[_0x5146('0x27')]['id']}})[_0x5146('0x19')](handleEntityNotFound(_0x340fec,null))['then'](function(_0x42ce66){if(_0x42ce66){return _0x42ce66[_0x5146('0x73')](_0x5ea12f[_0x5146('0x3a')][_0x5146('0x5d')],_[_0x5146('0x74')](_0x5ea12f[_0x5146('0x3a')],['ids','id'])||{})['spread'](function(_0x68f2d1){for(var _0x4b60ca=0x0;_0x4b60ca<_0x5ea12f[_0x5146('0x3a')][_0x5146('0x5d')][_0x5146('0x3f')];_0x4b60ca+=0x1){socket[_0x5146('0x71')]('userOpenchannelQueue:save',{'UserId':Number(_0x5ea12f[_0x5146('0x3a')]['ids'][_0x4b60ca]),'OpenchannelQueueId':Number(_0x5ea12f['params']['id'])});}return _0x68f2d1;});}})[_0x5146('0x19')](respondWithResult(_0x340fec,null))[_0x5146('0x32')](handleError(_0x340fec,null));};exports[_0x5146('0x70')]=function(_0x112622,_0x7371c3){return db[_0x5146('0x21')][_0x5146('0x31')]({'where':{'id':_0x112622[_0x5146('0x27')]['id']}})[_0x5146('0x19')](handleEntityNotFound(_0x7371c3,null))['then'](function(_0x2c15dc){if(_0x2c15dc){return _0x2c15dc[_0x5146('0x70')](_0x112622[_0x5146('0x25')][_0x5146('0x5d')])[_0x5146('0x19')](function(){if(_[_0x5146('0x75')](_0x112622[_0x5146('0x25')][_0x5146('0x5d')])){for(var _0x6d124b=0x0;_0x6d124b<_0x112622['query'][_0x5146('0x5d')]['length'];_0x6d124b+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x112622[_0x5146('0x25')]['ids'][_0x6d124b]),'OpenchannelQueueId':Number(_0x112622[_0x5146('0x27')]['id'])});}}else{socket[_0x5146('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x112622[_0x5146('0x25')]['ids']),'OpenchannelQueueId':Number(_0x112622[_0x5146('0x27')]['id'])});}});}})[_0x5146('0x19')](respondWithStatusCode(_0x7371c3,null))['catch'](handleError(_0x7371c3,null));};exports[_0x5146('0x76')]=function(_0x27951d,_0xbf2b){var _0x463983={};var _0x2453d7={};var _0x46ee73;var _0x249db8;return db[_0x5146('0x21')][_0x5146('0x3d')]({'where':{'id':_0x27951d['params']['id']}})[_0x5146('0x19')](handleEntityNotFound(_0xbf2b,null))[_0x5146('0x19')](function(_0x781d9a){if(_0x781d9a){_0x46ee73=_0x781d9a;_0x2453d7['model']=_[_0x5146('0x2a')](db[_0x5146('0x53')][_0x5146('0x29')]);_0x2453d7['query']=_[_0x5146('0x2a')](_0x27951d[_0x5146('0x25')]);_0x2453d7[_0x5146('0x2b')]=_[_0x5146('0x2c')](_0x2453d7[_0x5146('0x28')],_0x2453d7[_0x5146('0x25')]);_0x463983[_0x5146('0x2e')]=_[_0x5146('0x2c')](_0x2453d7[_0x5146('0x28')],qs[_0x5146('0x2d')](_0x27951d['query'][_0x5146('0x2d')]));_0x463983['attributes']=_0x463983['attributes'][_0x5146('0x3f')]?_0x463983[_0x5146('0x2e')]:_0x2453d7[_0x5146('0x28')];_0x463983['order']=qs[_0x5146('0x51')](_0x27951d[_0x5146('0x25')][_0x5146('0x51')]);_0x463983['where']=qs[_0x5146('0x2b')](_[_0x5146('0x44')](_0x27951d['query'],_0x2453d7[_0x5146('0x2b')]));if(_0x27951d[_0x5146('0x25')][_0x5146('0x46')]){_0x463983[_0x5146('0x43')]=_[_0x5146('0x47')](_0x463983[_0x5146('0x43')],{'$or':_[_0x5146('0x20')](_0x463983[_0x5146('0x2e')],function(_0x3374f0){var _0x21ac87={};_0x21ac87[_0x3374f0]={'$like':'%'+_0x27951d['query'][_0x5146('0x46')]+'%'};return _0x21ac87;})});}_0x463983=_[_0x5146('0x47')]({},_0x463983,_0x27951d[_0x5146('0x30')]);return _0x46ee73[_0x5146('0x76')](_0x463983);}})[_0x5146('0x19')](function(_0x4ab93a){if(_0x4ab93a){_0x249db8=_0x4ab93a[_0x5146('0x3f')];if(!_0x27951d[_0x5146('0x25')][_0x5146('0x40')](_0x5146('0x41'))){_0x463983[_0x5146('0x16')]=qs[_0x5146('0x16')](_0x27951d[_0x5146('0x25')][_0x5146('0x16')]);_0x463983[_0x5146('0x15')]=qs[_0x5146('0x15')](_0x27951d[_0x5146('0x25')]['offset']);}return _0x46ee73[_0x5146('0x76')](_0x463983);}})['then'](function(_0x448363){if(_0x448363){return _0x448363?{'count':_0x249db8,'rows':_0x448363}:null;}})[_0x5146('0x19')](respondWithResult(_0xbf2b,null))['catch'](handleError(_0xbf2b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 7607a2e..b3c1659 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 _0xc8d8=['exports','../../mysqldb','remove','emit','hasOwnProperty','hook'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xc8d8,0xe5));var _0x8c8d=function(_0x4ae8d9,_0x4894f1){_0x4ae8d9=_0x4ae8d9-0x0;var _0x261051=_0xc8d8[_0x4ae8d9];return _0x261051;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x8c8d('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8c8d('0x1')};function emitEvent(_0x144df8){return function(_0x2642ab,_0x12c5b3,_0x493fa3){OpenchannelQueueEvents[_0x8c8d('0x2')](_0x144df8+':'+_0x2642ab['id'],_0x2642ab);OpenchannelQueueEvents[_0x8c8d('0x2')](_0x144df8,_0x2642ab);_0x493fa3(null);};}for(var e in events){if(events[_0x8c8d('0x3')](e)){var event=events[e];OpenchannelQueue[_0x8c8d('0x4')](e,emitEvent(event));}}module[_0x8c8d('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3ce9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x3ce9,0x195));var _0x93ce=function(_0x25ff33,_0x52f855){_0x25ff33=_0x25ff33-0x0;var _0x28344b=_0x3ce9[_0x25ff33];return _0x28344b;};'use strict';var EventEmitter=require(_0x93ce('0x0'));var OpenchannelQueue=require(_0x93ce('0x1'))['db'][_0x93ce('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x93ce('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x93ce('0x4'),'afterDestroy':_0x93ce('0x5')};function emitEvent(_0x5c30bf){return function(_0x295e8c,_0x36b524,_0x51da69){OpenchannelQueueEvents[_0x93ce('0x6')](_0x5c30bf+':'+_0x295e8c['id'],_0x295e8c);OpenchannelQueueEvents[_0x93ce('0x6')](_0x5c30bf,_0x295e8c);_0x51da69(null);};}for(var e in events){if(events[_0x93ce('0x7')](e)){var event=events[e];OpenchannelQueue[_0x93ce('0x8')](e,emitEvent(event));}}module[_0x93ce('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 5807eab..7258460 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 _0x8a9e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues'];(function(_0x4d0b72,_0x3f162a){var _0x2f4925=function(_0x134822){while(--_0x134822){_0x4d0b72['push'](_0x4d0b72['shift']());}};_0x2f4925(++_0x3f162a);}(_0x8a9e,0x18c));var _0xe8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8a9('0x0'));var util=require(_0xe8a9('0x1'));var logger=require(_0xe8a9('0x2'))(_0xe8a9('0x3'));var moment=require(_0xe8a9('0x4'));var BPromise=require(_0xe8a9('0x5'));var rp=require(_0xe8a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe8a9('0x7'));var attributes=require(_0xe8a9('0x8'));module[_0xe8a9('0x9')]=function(_0x1e652d,_0x25c447){return _0x1e652d['define'](_0xe8a9('0xa'),attributes,{'tableName':_0xe8a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39fd=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39fd,0x6a));var _0xd39f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39fd[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd39f('0x0'));var util=require(_0xd39f('0x1'));var logger=require(_0xd39f('0x2'))('api');var moment=require(_0xd39f('0x3'));var BPromise=require(_0xd39f('0x4'));var rp=require(_0xd39f('0x5'));var fs=require('fs');var path=require(_0xd39f('0x6'));var rimraf=require(_0xd39f('0x7'));var config=require(_0xd39f('0x8'));var attributes=require(_0xd39f('0x9'));module[_0xd39f('0xa')]=function(_0x20f951,_0x379dca){return _0x20f951[_0xd39f('0xb')](_0xd39f('0xc'),attributes,{'tableName':_0xd39f('0xd'),'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 117b957..d855044 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 _0x64e7=['info','result','catch','findAll','options','raw','where','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue','find','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','./openchannelQueue.socket','request','request\x20sent','debug','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x2812c6,_0x1654a7){var _0x1367af=function(_0x29c819){while(--_0x29c819){_0x2812c6['push'](_0x2812c6['shift']());}};_0x1367af(++_0x1654a7);}(_0x64e7,0xce));var _0x764e=function(_0x180816,_0x5a7ced){_0x180816=_0x180816-0x0;var _0x57c6d6=_0x64e7[_0x180816];return _0x57c6d6;};'use strict';var _=require(_0x764e('0x0'));var util=require('util');var moment=require(_0x764e('0x1'));var BPromise=require(_0x764e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x764e('0x3'));var db=require(_0x764e('0x4'))['db'];var utils=require(_0x764e('0x5'));var logger=require('../../config/logger')(_0x764e('0x6'));var config=require('../../config/environment');var jayson=require(_0x764e('0x7'));var client=jayson[_0x764e('0x8')][_0x764e('0x9')]({'port':0x232a});config['redis']=_[_0x764e('0xa')](config[_0x764e('0xb')],{'host':_0x764e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x764e('0xb')]));require(_0x764e('0xd'))['register'](socket);function respondWithRpcPromise(_0x239e46,_0x468409,_0x3f8a6d){return new BPromise(function(_0x2e5863,_0xc5d5c2){return client[_0x764e('0xe')](_0x239e46,_0x3f8a6d)['then'](function(_0x3e9d47){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x468409,_0x764e('0xf'));logger[_0x764e('0x10')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x468409,_0x764e('0xf'),JSON[_0x764e('0x11')](_0x3e9d47));if(_0x3e9d47[_0x764e('0x12')]){if(_0x3e9d47['error'][_0x764e('0x13')]===0x1f4){logger[_0x764e('0x12')](_0x764e('0x14'),_0x468409,_0x3e9d47[_0x764e('0x12')][_0x764e('0x15')]);return _0xc5d5c2(_0x3e9d47['error']['message']);}logger[_0x764e('0x12')](_0x764e('0x14'),_0x468409,_0x3e9d47[_0x764e('0x12')][_0x764e('0x15')]);return _0x2e5863(_0x3e9d47[_0x764e('0x12')]['message']);}else{logger[_0x764e('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x468409,_0x764e('0xf'));_0x2e5863(_0x3e9d47[_0x764e('0x17')][_0x764e('0x15')]);}})[_0x764e('0x18')](function(_0x46ef77){logger['error'](_0x764e('0x14'),_0x468409,_0x46ef77);_0xc5d5c2(_0x46ef77);});});}exports['GetOpenchannelQueue']=function(_0x55bcdc){var _0x17b57b=this;return new Promise(function(_0x151c74,_0xd862a6){return db['OpenchannelQueue'][_0x764e('0x19')]({'raw':_0x55bcdc[_0x764e('0x1a')]?_0x55bcdc['options'][_0x764e('0x1b')]===undefined?!![]:![]:!![],'where':_0x55bcdc['options']?_0x55bcdc[_0x764e('0x1a')][_0x764e('0x1c')]||null:null,'attributes':_0x55bcdc['options']?_0x55bcdc[_0x764e('0x1a')][_0x764e('0x1d')]||null:null,'limit':_0x55bcdc[_0x764e('0x1a')]?_0x55bcdc[_0x764e('0x1a')]['limit']||null:null,'include':_0x55bcdc[_0x764e('0x1a')]?_0x55bcdc['options'][_0x764e('0x1e')]?_[_0x764e('0x1f')](_0x55bcdc['options'][_0x764e('0x1e')],function(_0x41a9b2){return{'model':db[_0x41a9b2['model']],'as':_0x41a9b2['as'],'attributes':_0x41a9b2[_0x764e('0x1d')],'include':_0x41a9b2[_0x764e('0x1e')]?_[_0x764e('0x1f')](_0x41a9b2[_0x764e('0x1e')],function(_0x3e901d){return{'model':db[_0x3e901d[_0x764e('0x20')]],'as':_0x3e901d['as'],'attributes':_0x3e901d[_0x764e('0x1d')],'include':_0x3e901d[_0x764e('0x1e')]?_[_0x764e('0x1f')](_0x3e901d['include'],function(_0x80f2eb){return{'model':db[_0x80f2eb[_0x764e('0x20')]],'as':_0x80f2eb['as'],'attributes':_0x80f2eb[_0x764e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x513740){logger[_0x764e('0x16')]('GetOpenchannelQueue',_0x55bcdc);logger['debug'](_0x764e('0x21'),_0x55bcdc,JSON[_0x764e('0x11')](_0x513740));_0x151c74(_0x513740);})[_0x764e('0x18')](function(_0x55cdb0){logger[_0x764e('0x12')](_0x764e('0x21'),_0x55cdb0[_0x764e('0x15')],_0x55bcdc);_0xd862a6(_0x17b57b[_0x764e('0x12')](0x1f4,_0x55cdb0[_0x764e('0x15')]));});});};exports[_0x764e('0x22')]=function(_0x84958e){var _0x275e42=this;return new Promise(function(_0xfee78d,_0x399749){return db[_0x764e('0x23')][_0x764e('0x24')]({'raw':_0x84958e[_0x764e('0x1a')]?_0x84958e[_0x764e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x84958e[_0x764e('0x1a')]?_0x84958e[_0x764e('0x1a')][_0x764e('0x1c')]||null:null,'attributes':_0x84958e[_0x764e('0x1a')]?_0x84958e[_0x764e('0x1a')][_0x764e('0x1d')]||null:null,'include':_0x84958e[_0x764e('0x1a')]?_0x84958e[_0x764e('0x1a')][_0x764e('0x1e')]?_[_0x764e('0x1f')](_0x84958e[_0x764e('0x1a')]['include'],function(_0x200891){return{'model':db[_0x200891['model']],'as':_0x200891['as'],'attributes':_0x200891['attributes'],'include':_0x200891[_0x764e('0x1e')]?_[_0x764e('0x1f')](_0x200891['include'],function(_0x13caa4){return{'model':db[_0x13caa4[_0x764e('0x20')]],'as':_0x13caa4['as'],'attributes':_0x13caa4['attributes'],'include':_0x13caa4[_0x764e('0x1e')]?_[_0x764e('0x1f')](_0x13caa4['include'],function(_0x51cc32){return{'model':db[_0x51cc32['model']],'as':_0x51cc32['as'],'attributes':_0x51cc32['attributes']};}):[]};}):[]};}):[]:[]})[_0x764e('0x25')](function(_0x994ef0){logger[_0x764e('0x16')]('ShowOpenchannelQueue',_0x84958e);logger['debug'](_0x764e('0x22'),_0x84958e,JSON[_0x764e('0x11')](_0x994ef0));_0xfee78d(_0x994ef0);})[_0x764e('0x18')](function(_0x44dafd){logger[_0x764e('0x12')](_0x764e('0x22'),_0x44dafd['message'],_0x84958e);_0x399749(_0x275e42['error'](0x1f4,_0x44dafd[_0x764e('0x15')]));});});}; \ No newline at end of file +var _0xdf1b=['result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','find','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x133a43,_0x57f306){var _0x154673=function(_0x3ba1e4){while(--_0x3ba1e4){_0x133a43['push'](_0x133a43['shift']());}};_0x154673(++_0x57f306);}(_0xdf1b,0xdc));var _0xbdf1=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xdf1b[_0x2dbce7];return _0x3a3ed0;};'use strict';var _=require('lodash');var util=require(_0xbdf1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbdf1('0x1'));var fs=require('fs');var Redis=require(_0xbdf1('0x2'));var db=require(_0xbdf1('0x3'))['db'];var utils=require(_0xbdf1('0x4'));var logger=require(_0xbdf1('0x5'))(_0xbdf1('0x6'));var config=require(_0xbdf1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbdf1('0x8')][_0xbdf1('0x9')]({'port':0x232a});config[_0xbdf1('0xa')]=_[_0xbdf1('0xb')](config[_0xbdf1('0xa')],{'host':_0xbdf1('0xc'),'port':0x18eb});var socket=require(_0xbdf1('0xd'))(new Redis(config[_0xbdf1('0xa')]));require(_0xbdf1('0xe'))[_0xbdf1('0xf')](socket);function respondWithRpcPromise(_0x3d60e1,_0x2081d6,_0x599d48){return new BPromise(function(_0x25b5a8,_0x55b9a6){return client[_0xbdf1('0x10')](_0x3d60e1,_0x599d48)[_0xbdf1('0x11')](function(_0x3f9428){logger[_0xbdf1('0x12')](_0xbdf1('0x13'),_0x2081d6,_0xbdf1('0x14'));logger[_0xbdf1('0x15')](_0xbdf1('0x16'),_0x2081d6,'request\x20sent',JSON[_0xbdf1('0x17')](_0x3f9428));if(_0x3f9428[_0xbdf1('0x18')]){if(_0x3f9428[_0xbdf1('0x18')]['code']===0x1f4){logger[_0xbdf1('0x18')](_0xbdf1('0x13'),_0x2081d6,_0x3f9428[_0xbdf1('0x18')][_0xbdf1('0x19')]);return _0x55b9a6(_0x3f9428[_0xbdf1('0x18')][_0xbdf1('0x19')]);}logger[_0xbdf1('0x18')](_0xbdf1('0x13'),_0x2081d6,_0x3f9428['error'][_0xbdf1('0x19')]);return _0x25b5a8(_0x3f9428[_0xbdf1('0x18')][_0xbdf1('0x19')]);}else{logger[_0xbdf1('0x12')](_0xbdf1('0x13'),_0x2081d6,_0xbdf1('0x14'));_0x25b5a8(_0x3f9428[_0xbdf1('0x1a')][_0xbdf1('0x19')]);}})[_0xbdf1('0x1b')](function(_0x3f0ed2){logger[_0xbdf1('0x18')](_0xbdf1('0x13'),_0x2081d6,_0x3f0ed2);_0x55b9a6(_0x3f0ed2);});});}exports[_0xbdf1('0x1c')]=function(_0x27524c){var _0x436da4=this;return new Promise(function(_0xb9f14b,_0x5a3f76){return db['OpenchannelQueue'][_0xbdf1('0x1d')]({'raw':_0x27524c['options']?_0x27524c[_0xbdf1('0x1e')][_0xbdf1('0x1f')]===undefined?!![]:![]:!![],'where':_0x27524c[_0xbdf1('0x1e')]?_0x27524c['options'][_0xbdf1('0x20')]||null:null,'attributes':_0x27524c['options']?_0x27524c['options'][_0xbdf1('0x21')]||null:null,'limit':_0x27524c['options']?_0x27524c[_0xbdf1('0x1e')][_0xbdf1('0x22')]||null:null,'include':_0x27524c[_0xbdf1('0x1e')]?_0x27524c[_0xbdf1('0x1e')][_0xbdf1('0x23')]?_[_0xbdf1('0x24')](_0x27524c[_0xbdf1('0x1e')][_0xbdf1('0x23')],function(_0x1a1808){return{'model':db[_0x1a1808[_0xbdf1('0x25')]],'as':_0x1a1808['as'],'attributes':_0x1a1808[_0xbdf1('0x21')],'include':_0x1a1808[_0xbdf1('0x23')]?_[_0xbdf1('0x24')](_0x1a1808[_0xbdf1('0x23')],function(_0x4aa032){return{'model':db[_0x4aa032[_0xbdf1('0x25')]],'as':_0x4aa032['as'],'attributes':_0x4aa032[_0xbdf1('0x21')],'include':_0x4aa032[_0xbdf1('0x23')]?_[_0xbdf1('0x24')](_0x4aa032[_0xbdf1('0x23')],function(_0x54946a){return{'model':db[_0x54946a['model']],'as':_0x54946a['as'],'attributes':_0x54946a[_0xbdf1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbdf1('0x11')](function(_0x4d6c78){logger[_0xbdf1('0x12')]('GetOpenchannelQueue',_0x27524c);logger[_0xbdf1('0x15')]('GetOpenchannelQueue',_0x27524c,JSON[_0xbdf1('0x17')](_0x4d6c78));_0xb9f14b(_0x4d6c78);})[_0xbdf1('0x1b')](function(_0x2aeb97){logger[_0xbdf1('0x18')](_0xbdf1('0x1c'),_0x2aeb97[_0xbdf1('0x19')],_0x27524c);_0x5a3f76(_0x436da4[_0xbdf1('0x18')](0x1f4,_0x2aeb97[_0xbdf1('0x19')]));});});};exports[_0xbdf1('0x26')]=function(_0x4e3abb){var _0x4ea5e5=this;return new Promise(function(_0x3eac32,_0x27dac7){return db[_0xbdf1('0x27')][_0xbdf1('0x28')]({'raw':_0x4e3abb[_0xbdf1('0x1e')]?_0x4e3abb[_0xbdf1('0x1e')][_0xbdf1('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e3abb['options']?_0x4e3abb[_0xbdf1('0x1e')]['where']||null:null,'attributes':_0x4e3abb[_0xbdf1('0x1e')]?_0x4e3abb['options'][_0xbdf1('0x21')]||null:null,'include':_0x4e3abb['options']?_0x4e3abb['options']['include']?_['map'](_0x4e3abb['options'][_0xbdf1('0x23')],function(_0x16f0c5){return{'model':db[_0x16f0c5[_0xbdf1('0x25')]],'as':_0x16f0c5['as'],'attributes':_0x16f0c5[_0xbdf1('0x21')],'include':_0x16f0c5[_0xbdf1('0x23')]?_[_0xbdf1('0x24')](_0x16f0c5[_0xbdf1('0x23')],function(_0x24a112){return{'model':db[_0x24a112[_0xbdf1('0x25')]],'as':_0x24a112['as'],'attributes':_0x24a112['attributes'],'include':_0x24a112[_0xbdf1('0x23')]?_[_0xbdf1('0x24')](_0x24a112['include'],function(_0x330337){return{'model':db[_0x330337[_0xbdf1('0x25')]],'as':_0x330337['as'],'attributes':_0x330337['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdf1('0x11')](function(_0x236070){logger['info'](_0xbdf1('0x26'),_0x4e3abb);logger['debug'](_0xbdf1('0x26'),_0x4e3abb,JSON['stringify'](_0x236070));_0x3eac32(_0x236070);})[_0xbdf1('0x1b')](function(_0x3a27dd){logger[_0xbdf1('0x18')]('ShowOpenchannelQueue',_0x3a27dd['message'],_0x4e3abb);_0x27dac7(_0x4ea5e5['error'](0x1f4,_0x3a27dd[_0xbdf1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 09d10e8..4432823 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 _0x464d=['openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x26b819,_0x5beabd){var _0x8c1ba8=function(_0xd18c88){while(--_0xd18c88){_0x26b819['push'](_0x26b819['shift']());}};_0x8c1ba8(++_0x5beabd);}(_0x464d,0x1c9));var _0xd464=function(_0x3f524e,_0x2cba9c){_0x3f524e=_0x3f524e-0x0;var _0x313c07=_0x464d[_0x3f524e];return _0x313c07;};'use strict';var OpenchannelQueueEvents=require(_0xd464('0x0'));var events=[_0xd464('0x1'),_0xd464('0x2'),_0xd464('0x3')];function createListener(_0x393704,_0x5d3c3){return function(_0x512c8f){_0x5d3c3[_0xd464('0x4')](_0x393704,_0x512c8f);};}function removeListener(_0x3d7e54,_0x3cc50d){return function(){OpenchannelQueueEvents[_0xd464('0x5')](_0x3d7e54,_0x3cc50d);};}exports[_0xd464('0x6')]=function(_0x35af57){for(var _0x5860d8=0x0,_0x9ebb7b=events['length'];_0x5860d8<_0x9ebb7b;_0x5860d8++){var _0x3d99c0=events[_0x5860d8];var _0x3abe85=createListener(_0xd464('0x7')+_0x3d99c0,_0x35af57);OpenchannelQueueEvents['on'](_0x3d99c0,_0x3abe85);}}; \ No newline at end of file +var _0x0c8b=['save','remove','emit','removeListener','./openchannelQueue.events'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x0c8b,0x17b));var _0xb0c8=function(_0x4744b1,_0x1f53ed){_0x4744b1=_0x4744b1-0x0;var _0xa1e07=_0x0c8b[_0x4744b1];return _0xa1e07;};'use strict';var OpenchannelQueueEvents=require(_0xb0c8('0x0'));var events=[_0xb0c8('0x1'),_0xb0c8('0x2'),'update'];function createListener(_0x1c7d93,_0x355620){return function(_0x256415){_0x355620[_0xb0c8('0x3')](_0x1c7d93,_0x256415);};}function removeListener(_0x31edba,_0x398b0d){return function(){OpenchannelQueueEvents[_0xb0c8('0x4')](_0x31edba,_0x398b0d);};}exports['register']=function(_0x4226cf){for(var _0x4b9c43=0x0,_0x1eee38=events['length'];_0x4b9c43<_0x1eee38;_0x4b9c43++){var _0x26314e=events[_0x4b9c43];var _0x45bbc4=createListener('openchannelQueue:'+_0x26314e,_0x4226cf);OpenchannelQueueEvents['on'](_0x26314e,_0x45bbc4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 81cee97..4f2a5bc 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 _0xc294=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x4e2dbc,_0x304207){var _0x56b25f=function(_0x529e8b){while(--_0x529e8b){_0x4e2dbc['push'](_0x4e2dbc['shift']());}};_0x56b25f(++_0x304207);}(_0xc294,0xac));var _0x4c29=function(_0x151762,_0x17691f){_0x151762=_0x151762-0x0;var _0x27f596=_0xc294[_0x151762];return _0x27f596;};'use strict';var multer=require('multer');var util=require(_0x4c29('0x0'));var path=require(_0x4c29('0x1'));var timeout=require(_0x4c29('0x2'));var express=require(_0x4c29('0x3'));var router=express['Router']();var fs_extra=require(_0x4c29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4c29('0x5'));var config=require(_0x4c29('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x4c29('0x7')](),controller[_0x4c29('0x8')]);router['get'](_0x4c29('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4c29('0xa'),auth['isAuthenticated'](),controller[_0x4c29('0xb')]);router[_0x4c29('0xc')]('/',auth[_0x4c29('0x7')](),controller[_0x4c29('0xd')]);router[_0x4c29('0xe')](_0x4c29('0xa'),auth[_0x4c29('0x7')](),controller[_0x4c29('0xf')]);router[_0x4c29('0x10')](_0x4c29('0xa'),auth[_0x4c29('0x7')](),controller[_0x4c29('0x11')]);module[_0x4c29('0x12')]=router; \ No newline at end of file +var _0xaf61=['./openchannelQueueReport.controller','isAuthenticated','index','/describe','/:id','show','create','put','update','multer','path','connect-timeout','Router','../../config/environment'];(function(_0x4d2157,_0x201cf1){var _0x172f80=function(_0x587167){while(--_0x587167){_0x4d2157['push'](_0x4d2157['shift']());}};_0x172f80(++_0x201cf1);}(_0xaf61,0x191));var _0x1af6=function(_0x2daca9,_0x22819e){_0x2daca9=_0x2daca9-0x0;var _0x1b1a1f=_0xaf61[_0x2daca9];return _0x1b1a1f;};'use strict';var multer=require(_0x1af6('0x0'));var util=require('util');var path=require(_0x1af6('0x1'));var timeout=require(_0x1af6('0x2'));var express=require('express');var router=express[_0x1af6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1af6('0x4'));var controller=require(_0x1af6('0x5'));router['get']('/',auth[_0x1af6('0x6')](),controller[_0x1af6('0x7')]);router['get'](_0x1af6('0x8'),auth[_0x1af6('0x6')](),controller['describe']);router['get'](_0x1af6('0x9'),auth[_0x1af6('0x6')](),controller[_0x1af6('0xa')]);router['post']('/',auth[_0x1af6('0x6')](),controller[_0x1af6('0xb')]);router[_0x1af6('0xc')](_0x1af6('0x9'),auth[_0x1af6('0x6')](),controller[_0x1af6('0xd')]);router['delete'](_0x1af6('0x9'),auth[_0x1af6('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 01b041e..dd5e886 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 _0xc665=['sequelize','exports','STRING','DATE'];(function(_0x364fb5,_0x543103){var _0x3e36c4=function(_0x231577){while(--_0x231577){_0x364fb5['push'](_0x364fb5['shift']());}};_0x3e36c4(++_0x543103);}(_0xc665,0x1ac));var _0x5c66=function(_0x4e270f,_0x33b13a){_0x4e270f=_0x4e270f-0x0;var _0x420e75=_0xc665[_0x4e270f];return _0x420e75;};'use strict';var moment=require('moment');var Sequelize=require(_0x5c66('0x0'));module[_0x5c66('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5c66('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5c66('0x3')]},'exitAt':{'type':Sequelize[_0x5c66('0x3')]},'reason':{'type':Sequelize[_0x5c66('0x2')]}}; \ No newline at end of file +var _0x28cf=['moment','sequelize','exports','STRING','DATE'];(function(_0xbaa0c3,_0x475ac1){var _0x5c3a05=function(_0xbb3aa1){while(--_0xbb3aa1){_0xbaa0c3['push'](_0xbaa0c3['shift']());}};_0x5c3a05(++_0x475ac1);}(_0x28cf,0x113));var _0xf28c=function(_0x5ecc4d,_0x192051){_0x5ecc4d=_0x5ecc4d-0x0;var _0x5412f3=_0x28cf[_0x5ecc4d];return _0x5412f3;};'use strict';var moment=require(_0xf28c('0x0'));var Sequelize=require(_0xf28c('0x1'));module[_0xf28c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf28c('0x3')]},'joinAt':{'type':Sequelize[_0xf28c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf28c('0x4')]},'reason':{'type':Sequelize[_0xf28c('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index c057867..86ae13c 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 _0x5211=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','stack','send','index','OpenchannelQueueReport','fieldName','key','map','name','query','keys','filters','model','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','rawAttributes','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x30bd2a,_0x401cb){var _0x17c7af=function(_0x49ccba){while(--_0x49ccba){_0x30bd2a['push'](_0x30bd2a['shift']());}};_0x17c7af(++_0x401cb);}(_0x5211,0x17c));var _0x1521=function(_0x34776e,_0x125458){_0x34776e=_0x34776e-0x0;var _0x1862db=_0x5211[_0x34776e];return _0x1862db;};'use strict';var emlformat=require(_0x1521('0x0'));var rimraf=require(_0x1521('0x1'));var zipdir=require(_0x1521('0x2'));var jsonpatch=require(_0x1521('0x3'));var rp=require(_0x1521('0x4'));var moment=require(_0x1521('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1521('0x6'));var util=require(_0x1521('0x7'));var path=require(_0x1521('0x8'));var sox=require(_0x1521('0x9'));var csv=require(_0x1521('0xa'));var ejs=require(_0x1521('0xb'));var fs=require('fs');var fs_extra=require(_0x1521('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1521('0xd'));var jsforce=require(_0x1521('0xe'));var deskjs=require(_0x1521('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1521('0x10'));var Papa=require(_0x1521('0x11'));var Redis=require(_0x1521('0x12'));var authService=require(_0x1521('0x13'));var qs=require(_0x1521('0x14'));var as=require(_0x1521('0x15'));var hardwareService=require(_0x1521('0x16'));var logger=require('../../config/logger')(_0x1521('0x17'));var utils=require(_0x1521('0x18'));var config=require(_0x1521('0x19'));var licenseUtil=require(_0x1521('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122c78,_0x496d7d){_0x496d7d=_0x496d7d||0xcc;return function(_0x7243e4){if(_0x7243e4){return _0x122c78[_0x1521('0x1b')](_0x496d7d);}return _0x122c78[_0x1521('0x1c')](_0x496d7d)[_0x1521('0x1d')]();};}function respondWithResult(_0x86ef8e,_0x3f51e5){_0x3f51e5=_0x3f51e5||0xc8;return function(_0x3e6b12){if(_0x3e6b12){return _0x86ef8e['status'](_0x3f51e5)[_0x1521('0x1e')](_0x3e6b12);}};}function respondWithFilteredResult(_0x543d9a,_0x4181c2){return function(_0x1ddcb7){if(_0x1ddcb7){var _0x2ef525=typeof _0x4181c2[_0x1521('0x1f')]==='undefined'&&typeof _0x4181c2['limit']===_0x1521('0x20');var _0xbf0f08=_0x1ddcb7[_0x1521('0x21')];var _0x1d4265=_0x2ef525?0x0:_0x4181c2[_0x1521('0x1f')];var _0x56939b=_0x2ef525?_0x1ddcb7[_0x1521('0x21')]:_0x4181c2[_0x1521('0x1f')]+_0x4181c2['limit'];var _0x1a9ede;if(_0x56939b>=_0xbf0f08){_0x56939b=_0xbf0f08;_0x1a9ede=0xc8;}else{_0x1a9ede=0xce;}_0x543d9a[_0x1521('0x1c')](_0x1a9ede);return _0x543d9a[_0x1521('0x22')](_0x1521('0x23'),_0x1d4265+'-'+_0x56939b+'/'+_0xbf0f08)['json'](_0x1ddcb7);}return null;};}function patchUpdates(_0x25dd50){return function(_0x473512){try{jsonpatch['apply'](_0x473512,_0x25dd50,!![]);}catch(_0x1378f0){return BPromise[_0x1521('0x24')](_0x1378f0);}return _0x473512[_0x1521('0x25')]();};}function saveUpdates(_0x3994aa,_0x5c2e29){return function(_0x2b14f7){if(_0x2b14f7){return _0x2b14f7[_0x1521('0x26')](_0x3994aa)[_0x1521('0x27')](function(_0x4c7320){return _0x4c7320;});}return null;};}function removeEntity(_0x84707a,_0x410d3e){return function(_0x59d406){if(_0x59d406){return _0x59d406['destroy']()[_0x1521('0x27')](function(){_0x84707a[_0x1521('0x1c')](0xcc)[_0x1521('0x1d')]();});}};}function handleEntityNotFound(_0x4edd24,_0x438fd4){return function(_0x403eb9){if(!_0x403eb9){_0x4edd24[_0x1521('0x1b')](0x194);}return _0x403eb9;};}function handleError(_0x2e8535,_0x4d5695){_0x4d5695=_0x4d5695||0x1f4;return function(_0x2f2162){logger['error'](_0x2f2162[_0x1521('0x28')]);if(_0x2f2162['name']){delete _0x2f2162['name'];}_0x2e8535[_0x1521('0x1c')](_0x4d5695)[_0x1521('0x29')](_0x2f2162);};}exports[_0x1521('0x2a')]=function(_0x1e94ab,_0x2835f5){var _0x5cfedb={},_0x31b9de={},_0x1a561e={'count':0x0,'rows':[]};var _0x5e12c9=_['map'](db[_0x1521('0x2b')]['rawAttributes'],function(_0x5a33ed){return{'name':_0x5a33ed[_0x1521('0x2c')],'type':_0x5a33ed['type'][_0x1521('0x2d')]};});_0x31b9de['model']=_[_0x1521('0x2e')](_0x5e12c9,_0x1521('0x2f'));_0x31b9de[_0x1521('0x30')]=_[_0x1521('0x31')](_0x1e94ab[_0x1521('0x30')]);_0x31b9de[_0x1521('0x32')]=_['intersection'](_0x31b9de[_0x1521('0x33')],_0x31b9de[_0x1521('0x30')]);_0x5cfedb['attributes']=_[_0x1521('0x34')](_0x31b9de[_0x1521('0x33')],qs[_0x1521('0x35')](_0x1e94ab[_0x1521('0x30')]['fields']));_0x5cfedb['attributes']=_0x5cfedb[_0x1521('0x36')]['length']?_0x5cfedb['attributes']:_0x31b9de[_0x1521('0x33')];if(!_0x1e94ab[_0x1521('0x30')]['hasOwnProperty'](_0x1521('0x37'))){_0x5cfedb['limit']=qs[_0x1521('0x38')](_0x1e94ab[_0x1521('0x30')][_0x1521('0x38')]);_0x5cfedb[_0x1521('0x1f')]=qs[_0x1521('0x1f')](_0x1e94ab[_0x1521('0x30')][_0x1521('0x1f')]);}_0x5cfedb[_0x1521('0x39')]=qs[_0x1521('0x3a')](_0x1e94ab['query'][_0x1521('0x3a')]);_0x5cfedb[_0x1521('0x3b')]=qs[_0x1521('0x32')](_[_0x1521('0x3c')](_0x1e94ab['query'],_0x31b9de['filters']),_0x5e12c9);if(_0x1e94ab[_0x1521('0x30')][_0x1521('0x3d')]){_0x5cfedb[_0x1521('0x3b')]=_[_0x1521('0x3e')](_0x5cfedb[_0x1521('0x3b')],{'$or':_[_0x1521('0x2e')](_0x5e12c9,function(_0x177c2d){if(_0x177c2d[_0x1521('0x3f')]!==_0x1521('0x40')){var _0x50db27={};_0x50db27[_0x177c2d[_0x1521('0x2f')]]={'$like':'%'+_0x1e94ab[_0x1521('0x30')][_0x1521('0x3d')]+'%'};return _0x50db27;}})});}_0x5cfedb=_['merge']({},_0x5cfedb,_0x1e94ab['options']);var _0x301d12={'where':_0x5cfedb['where']};return db[_0x1521('0x2b')][_0x1521('0x21')](_0x301d12)[_0x1521('0x27')](function(_0x5b3224){_0x1a561e[_0x1521('0x21')]=_0x5b3224;if(_0x1e94ab[_0x1521('0x30')][_0x1521('0x41')]){_0x5cfedb[_0x1521('0x42')]=[{'all':!![]}];}return db[_0x1521('0x2b')]['findAll'](_0x5cfedb);})[_0x1521('0x27')](function(_0x73f8ec){_0x1a561e[_0x1521('0x43')]=_0x73f8ec;return _0x1a561e;})[_0x1521('0x27')](respondWithFilteredResult(_0x2835f5,_0x5cfedb))[_0x1521('0x44')](handleError(_0x2835f5,null));};exports[_0x1521('0x45')]=function(_0x55a063,_0x54b9b4){var _0x55366d={'raw':!![],'where':{'id':_0x55a063['params']['id']}},_0x421ba6={};_0x421ba6[_0x1521('0x33')]=_[_0x1521('0x31')](db[_0x1521('0x2b')][_0x1521('0x46')]);_0x421ba6['query']=_[_0x1521('0x31')](_0x55a063['query']);_0x421ba6[_0x1521('0x32')]=_[_0x1521('0x34')](_0x421ba6['model'],_0x421ba6[_0x1521('0x30')]);_0x55366d[_0x1521('0x36')]=_[_0x1521('0x34')](_0x421ba6[_0x1521('0x33')],qs[_0x1521('0x35')](_0x55a063['query'][_0x1521('0x35')]));_0x55366d['attributes']=_0x55366d[_0x1521('0x36')][_0x1521('0x47')]?_0x55366d[_0x1521('0x36')]:_0x421ba6['model'];if(_0x55a063['query']['includeAll']){_0x55366d[_0x1521('0x42')]=[{'all':!![]}];}_0x55366d=_[_0x1521('0x3e')]({},_0x55366d,_0x55a063['options']);return db['OpenchannelQueueReport'][_0x1521('0x48')](_0x55366d)[_0x1521('0x27')](handleEntityNotFound(_0x54b9b4,null))['then'](respondWithResult(_0x54b9b4,null))[_0x1521('0x44')](handleError(_0x54b9b4,null));};exports['create']=function(_0x335289,_0x390184){return db[_0x1521('0x2b')][_0x1521('0x49')](_0x335289[_0x1521('0x4a')],{})['then'](respondWithResult(_0x390184,0xc9))[_0x1521('0x44')](handleError(_0x390184,null));};exports[_0x1521('0x26')]=function(_0x18d07b,_0x211665){if(_0x18d07b[_0x1521('0x4a')]['id']){delete _0x18d07b[_0x1521('0x4a')]['id'];}return db['OpenchannelQueueReport'][_0x1521('0x48')]({'where':{'id':_0x18d07b[_0x1521('0x4b')]['id']}})['then'](handleEntityNotFound(_0x211665,null))['then'](saveUpdates(_0x18d07b['body'],null))[_0x1521('0x27')](respondWithResult(_0x211665,null))[_0x1521('0x44')](handleError(_0x211665,null));};exports['destroy']=function(_0x3788d,_0x42c2ea){return db[_0x1521('0x2b')][_0x1521('0x48')]({'where':{'id':_0x3788d[_0x1521('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42c2ea,null))[_0x1521('0x27')](removeEntity(_0x42c2ea,null))[_0x1521('0x44')](handleError(_0x42c2ea,null));};exports[_0x1521('0x4c')]=function(_0x17eed8,_0x24a048){return db[_0x1521('0x2b')][_0x1521('0x4c')]()[_0x1521('0x27')](respondWithResult(_0x24a048,null))[_0x1521('0x44')](handleError(_0x24a048,null));}; \ No newline at end of file +var _0x11a8=['send','OpenchannelQueueReport','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','findAll','rows','catch','show','params','keys','length','includeAll','include','options','find','create','body','destroy','describe','eml-format','rimraf','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','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','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','stack','name'];(function(_0x5af81e,_0x3a0d0b){var _0x198f7c=function(_0x39269c){while(--_0x39269c){_0x5af81e['push'](_0x5af81e['shift']());}};_0x198f7c(++_0x3a0d0b);}(_0x11a8,0x18f));var _0x811a=function(_0x31c71c,_0x463e90){_0x31c71c=_0x31c71c-0x0;var _0xbfe6d5=_0x11a8[_0x31c71c];return _0xbfe6d5;};'use strict';var emlformat=require(_0x811a('0x0'));var rimraf=require(_0x811a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x811a('0x2'));var BPromise=require(_0x811a('0x3'));var Mustache=require('mustache');var util=require(_0x811a('0x4'));var path=require('path');var sox=require(_0x811a('0x5'));var csv=require(_0x811a('0x6'));var ejs=require(_0x811a('0x7'));var fs=require('fs');var fs_extra=require(_0x811a('0x8'));var _=require(_0x811a('0x9'));var squel=require(_0x811a('0xa'));var crypto=require(_0x811a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x811a('0xc'));var toCsv=require(_0x811a('0x6'));var querystring=require('querystring');var Papa=require(_0x811a('0xd'));var Redis=require(_0x811a('0xe'));var authService=require(_0x811a('0xf'));var qs=require(_0x811a('0x10'));var as=require(_0x811a('0x11'));var hardwareService=require(_0x811a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x811a('0x13'));var config=require(_0x811a('0x14'));var licenseUtil=require(_0x811a('0x15'));var db=require(_0x811a('0x16'))['db'];function respondWithStatusCode(_0x1308c8,_0x2d7e66){_0x2d7e66=_0x2d7e66||0xcc;return function(_0x5e912b){if(_0x5e912b){return _0x1308c8[_0x811a('0x17')](_0x2d7e66);}return _0x1308c8[_0x811a('0x18')](_0x2d7e66)[_0x811a('0x19')]();};}function respondWithResult(_0x90d53d,_0x42cc7c){_0x42cc7c=_0x42cc7c||0xc8;return function(_0x4a4557){if(_0x4a4557){return _0x90d53d[_0x811a('0x18')](_0x42cc7c)[_0x811a('0x1a')](_0x4a4557);}};}function respondWithFilteredResult(_0x591e88,_0x1226e7){return function(_0x342ccf){if(_0x342ccf){var _0x1db930=typeof _0x1226e7['offset']===_0x811a('0x1b')&&typeof _0x1226e7[_0x811a('0x1c')]==='undefined';var _0x3647fd=_0x342ccf[_0x811a('0x1d')];var _0x18ab32=_0x1db930?0x0:_0x1226e7[_0x811a('0x1e')];var _0x5a9410=_0x1db930?_0x342ccf[_0x811a('0x1d')]:_0x1226e7[_0x811a('0x1e')]+_0x1226e7[_0x811a('0x1c')];var _0x5c5b19;if(_0x5a9410>=_0x3647fd){_0x5a9410=_0x3647fd;_0x5c5b19=0xc8;}else{_0x5c5b19=0xce;}_0x591e88[_0x811a('0x18')](_0x5c5b19);return _0x591e88[_0x811a('0x1f')](_0x811a('0x20'),_0x18ab32+'-'+_0x5a9410+'/'+_0x3647fd)[_0x811a('0x1a')](_0x342ccf);}return null;};}function patchUpdates(_0x226717){return function(_0x351d45){try{jsonpatch[_0x811a('0x21')](_0x351d45,_0x226717,!![]);}catch(_0x260140){return BPromise[_0x811a('0x22')](_0x260140);}return _0x351d45['save']();};}function saveUpdates(_0x5e55da,_0x4543e9){return function(_0x19667d){if(_0x19667d){return _0x19667d[_0x811a('0x23')](_0x5e55da)[_0x811a('0x24')](function(_0x462578){return _0x462578;});}return null;};}function removeEntity(_0x8bd099,_0x8349d6){return function(_0x3b1796){if(_0x3b1796){return _0x3b1796['destroy']()[_0x811a('0x24')](function(){_0x8bd099['status'](0xcc)[_0x811a('0x19')]();});}};}function handleEntityNotFound(_0x6d917,_0x589f18){return function(_0xb4dc6b){if(!_0xb4dc6b){_0x6d917['sendStatus'](0x194);}return _0xb4dc6b;};}function handleError(_0xcd60fb,_0x336f68){_0x336f68=_0x336f68||0x1f4;return function(_0x2cc64b){logger['error'](_0x2cc64b[_0x811a('0x25')]);if(_0x2cc64b[_0x811a('0x26')]){delete _0x2cc64b[_0x811a('0x26')];}_0xcd60fb['status'](_0x336f68)[_0x811a('0x27')](_0x2cc64b);};}exports['index']=function(_0x5bb742,_0x37ae39){var _0x4f599b={},_0x3995c7={},_0x455754={'count':0x0,'rows':[]};var _0x5d95f8=_['map'](db[_0x811a('0x28')][_0x811a('0x29')],function(_0x313589){return{'name':_0x313589['fieldName'],'type':_0x313589['type'][_0x811a('0x2a')]};});_0x3995c7[_0x811a('0x2b')]=_[_0x811a('0x2c')](_0x5d95f8,_0x811a('0x26'));_0x3995c7[_0x811a('0x2d')]=_['keys'](_0x5bb742['query']);_0x3995c7[_0x811a('0x2e')]=_[_0x811a('0x2f')](_0x3995c7[_0x811a('0x2b')],_0x3995c7[_0x811a('0x2d')]);_0x4f599b[_0x811a('0x30')]=_[_0x811a('0x2f')](_0x3995c7[_0x811a('0x2b')],qs[_0x811a('0x31')](_0x5bb742[_0x811a('0x2d')][_0x811a('0x31')]));_0x4f599b[_0x811a('0x30')]=_0x4f599b[_0x811a('0x30')]['length']?_0x4f599b[_0x811a('0x30')]:_0x3995c7[_0x811a('0x2b')];if(!_0x5bb742[_0x811a('0x2d')]['hasOwnProperty'](_0x811a('0x32'))){_0x4f599b['limit']=qs[_0x811a('0x1c')](_0x5bb742[_0x811a('0x2d')][_0x811a('0x1c')]);_0x4f599b[_0x811a('0x1e')]=qs[_0x811a('0x1e')](_0x5bb742[_0x811a('0x2d')]['offset']);}_0x4f599b[_0x811a('0x33')]=qs[_0x811a('0x34')](_0x5bb742[_0x811a('0x2d')][_0x811a('0x34')]);_0x4f599b['where']=qs[_0x811a('0x2e')](_[_0x811a('0x35')](_0x5bb742[_0x811a('0x2d')],_0x3995c7[_0x811a('0x2e')]),_0x5d95f8);if(_0x5bb742[_0x811a('0x2d')][_0x811a('0x36')]){_0x4f599b[_0x811a('0x37')]=_[_0x811a('0x38')](_0x4f599b['where'],{'$or':_[_0x811a('0x2c')](_0x5d95f8,function(_0x567517){if(_0x567517[_0x811a('0x39')]!=='VIRTUAL'){var _0x54b4fb={};_0x54b4fb[_0x567517[_0x811a('0x26')]]={'$like':'%'+_0x5bb742[_0x811a('0x2d')]['filter']+'%'};return _0x54b4fb;}})});}_0x4f599b=_['merge']({},_0x4f599b,_0x5bb742['options']);var _0x36dfe6={'where':_0x4f599b[_0x811a('0x37')]};return db['OpenchannelQueueReport'][_0x811a('0x1d')](_0x36dfe6)[_0x811a('0x24')](function(_0x1045ae){_0x455754[_0x811a('0x1d')]=_0x1045ae;if(_0x5bb742[_0x811a('0x2d')]['includeAll']){_0x4f599b['include']=[{'all':!![]}];}return db[_0x811a('0x28')][_0x811a('0x3a')](_0x4f599b);})[_0x811a('0x24')](function(_0x579b5){_0x455754[_0x811a('0x3b')]=_0x579b5;return _0x455754;})['then'](respondWithFilteredResult(_0x37ae39,_0x4f599b))[_0x811a('0x3c')](handleError(_0x37ae39,null));};exports[_0x811a('0x3d')]=function(_0x415daf,_0x405233){var _0x2d6373={'raw':!![],'where':{'id':_0x415daf[_0x811a('0x3e')]['id']}},_0x25603e={};_0x25603e[_0x811a('0x2b')]=_[_0x811a('0x3f')](db[_0x811a('0x28')][_0x811a('0x29')]);_0x25603e[_0x811a('0x2d')]=_[_0x811a('0x3f')](_0x415daf[_0x811a('0x2d')]);_0x25603e[_0x811a('0x2e')]=_[_0x811a('0x2f')](_0x25603e[_0x811a('0x2b')],_0x25603e[_0x811a('0x2d')]);_0x2d6373[_0x811a('0x30')]=_[_0x811a('0x2f')](_0x25603e[_0x811a('0x2b')],qs[_0x811a('0x31')](_0x415daf[_0x811a('0x2d')]['fields']));_0x2d6373[_0x811a('0x30')]=_0x2d6373[_0x811a('0x30')][_0x811a('0x40')]?_0x2d6373[_0x811a('0x30')]:_0x25603e['model'];if(_0x415daf[_0x811a('0x2d')][_0x811a('0x41')]){_0x2d6373[_0x811a('0x42')]=[{'all':!![]}];}_0x2d6373=_['merge']({},_0x2d6373,_0x415daf[_0x811a('0x43')]);return db[_0x811a('0x28')][_0x811a('0x44')](_0x2d6373)[_0x811a('0x24')](handleEntityNotFound(_0x405233,null))[_0x811a('0x24')](respondWithResult(_0x405233,null))['catch'](handleError(_0x405233,null));};exports[_0x811a('0x45')]=function(_0x3f53ae,_0x26561c){return db[_0x811a('0x28')][_0x811a('0x45')](_0x3f53ae[_0x811a('0x46')],{})[_0x811a('0x24')](respondWithResult(_0x26561c,0xc9))[_0x811a('0x3c')](handleError(_0x26561c,null));};exports['update']=function(_0x117cd5,_0x401492){if(_0x117cd5[_0x811a('0x46')]['id']){delete _0x117cd5['body']['id'];}return db[_0x811a('0x28')]['find']({'where':{'id':_0x117cd5[_0x811a('0x3e')]['id']}})[_0x811a('0x24')](handleEntityNotFound(_0x401492,null))[_0x811a('0x24')](saveUpdates(_0x117cd5[_0x811a('0x46')],null))[_0x811a('0x24')](respondWithResult(_0x401492,null))[_0x811a('0x3c')](handleError(_0x401492,null));};exports[_0x811a('0x47')]=function(_0x20fe48,_0x52a8ef){return db[_0x811a('0x28')][_0x811a('0x44')]({'where':{'id':_0x20fe48[_0x811a('0x3e')]['id']}})[_0x811a('0x24')](handleEntityNotFound(_0x52a8ef,null))['then'](removeEntity(_0x52a8ef,null))[_0x811a('0x3c')](handleError(_0x52a8ef,null));};exports[_0x811a('0x48')]=function(_0x5974ba,_0x381f4f){return db[_0x811a('0x28')]['describe']()[_0x811a('0x24')](respondWithResult(_0x381f4f,null))[_0x811a('0x3c')](handleError(_0x381f4f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7582ffa..12c9104 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x56b1f3,_0x38305f){var _0xb433d0=function(_0x62143a){while(--_0x62143a){_0x56b1f3['push'](_0x56b1f3['shift']());}};_0xb433d0(++_0x38305f);}(_0x326f,0xd1));var _0xf326=function(_0x57714d,_0x163976){_0x57714d=_0x57714d-0x0;var _0x310f2e=_0x326f[_0x57714d];return _0x310f2e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x13421a,_0x45211){var _0x280fad=function(_0x29808e){while(--_0x29808e){_0x13421a['push'](_0x13421a['shift']());}};_0x280fad(++_0x45211);}(_0x1261,0x144));var _0x1126=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0x1261[_0x1be3b3];return _0x4f8b2d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ad03cdb..b9e1c06 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93e9=['UpdateOpenchannelQueueReport','update','where','attributes','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw'];(function(_0x5c4dc9,_0x407570){var _0x24b517=function(_0x25915e){while(--_0x25915e){_0x5c4dc9['push'](_0x5c4dc9['shift']());}};_0x24b517(++_0x407570);}(_0x93e9,0xcc));var _0x993e=function(_0x11ba21,_0x44fd71){_0x11ba21=_0x11ba21-0x0;var _0x53e8a6=_0x93e9[_0x11ba21];return _0x53e8a6;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});}exports[_0x993e('0x16')]=function(_0x1acd21){var _0x3cc2b9=this;return new Promise(function(_0x3d6109,_0xfc2cbb){return db[_0x993e('0x17')]['create'](_0x1acd21[_0x993e('0x18')],{'raw':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1a')]===undefined?!![]:![]:!![]})[_0x993e('0xd')](function(_0x425ab4){logger[_0x993e('0xe')](_0x993e('0x16'),_0x1acd21);logger['debug'](_0x993e('0x16'),_0x1acd21,JSON['stringify'](_0x425ab4));_0x3d6109(_0x425ab4);})[_0x993e('0x15')](function(_0x37ff57){logger[_0x993e('0x12')]('CreateOpenchannelQueueReport',_0x37ff57[_0x993e('0x13')],_0x1acd21);_0xfc2cbb(_0x3cc2b9[_0x993e('0x12')](0x1f4,_0x37ff57[_0x993e('0x13')]));});});};exports[_0x993e('0x1b')]=function(_0x3b45ef){var _0x328d22=this;return new Promise(function(_0xa1c83e,_0x3ad96f){return db[_0x993e('0x17')][_0x993e('0x1c')](_0x3b45ef[_0x993e('0x18')],{'raw':_0x3b45ef[_0x993e('0x19')]?_0x3b45ef['options'][_0x993e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b45ef[_0x993e('0x19')]?_0x3b45ef['options'][_0x993e('0x1d')]||null:null,'attributes':_0x3b45ef['options']?_0x3b45ef[_0x993e('0x19')][_0x993e('0x1e')]||null:null,'limit':_0x3b45ef[_0x993e('0x19')]?_0x3b45ef[_0x993e('0x19')]['limit']||null:null})['then'](function(_0x32e332){logger[_0x993e('0xe')]('UpdateOpenchannelQueueReport',_0x3b45ef);logger[_0x993e('0x1f')](_0x993e('0x1b'),_0x3b45ef,JSON[_0x993e('0x20')](_0x32e332));_0xa1c83e(_0x32e332);})['catch'](function(_0x2495b7){logger[_0x993e('0x12')](_0x993e('0x1b'),_0x2495b7[_0x993e('0x13')],_0x3b45ef);_0x3ad96f(_0x328d22[_0x993e('0x12')](0x1f4,_0x2495b7['message']));});});}; \ No newline at end of file +var _0xaebd=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelQueueReport,\x20%s,\x20%s','catch','CreateOpenchannelQueueReport','create','options','raw','debug','OpenchannelQueueReport','update','body','limit','UpdateOpenchannelQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x39c4c9,_0x520f1f){var _0x2f846a=function(_0x31da04){while(--_0x31da04){_0x39c4c9['push'](_0x39c4c9['shift']());}};_0x2f846a(++_0x520f1f);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3be0ac,_0x2c598d){_0x3be0ac=_0x3be0ac-0x0;var _0x1aed8c=_0xaebd[_0x3be0ac];return _0x1aed8c;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['OpenchannelQueueReport'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e97e0){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x19')](_0xdaeb('0x15'),_0x1b5243,JSON[_0xdaeb('0x10')](_0x4e97e0));_0x2d8f11(_0x4e97e0);})['catch'](function(_0x597bb7){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x597bb7[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x597bb7[_0xdaeb('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x254c3b){var _0x4dc25f=this;return new Promise(function(_0x130c35,_0x398616){return db[_0xdaeb('0x1a')][_0xdaeb('0x1b')](_0x254c3b[_0xdaeb('0x1c')],{'raw':_0x254c3b['options']?_0x254c3b[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b['options']['where']||null:null,'attributes':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b['options']['attributes']||null:null,'limit':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b[_0xdaeb('0x17')][_0xdaeb('0x1d')]||null:null})['then'](function(_0x5e6f97){logger[_0xdaeb('0xd')](_0xdaeb('0x1e'),_0x254c3b);logger[_0xdaeb('0x19')]('UpdateOpenchannelQueueReport',_0x254c3b,JSON[_0xdaeb('0x10')](_0x5e6f97));_0x130c35(_0x5e6f97);})['catch'](function(_0x4da82d){logger[_0xdaeb('0x11')](_0xdaeb('0x1e'),_0x4da82d[_0xdaeb('0x12')],_0x254c3b);_0x398616(_0x4dc25f[_0xdaeb('0x11')](0x1f4,_0x4da82d[_0xdaeb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f1898fe..58e103b 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 _0xd044=['index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd044,0x65));var _0x4d04=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xd044[_0x18a436];return _0x5c2cf8;};'use strict';var multer=require('multer');var util=require(_0x4d04('0x0'));var path=require(_0x4d04('0x1'));var timeout=require(_0x4d04('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4d04('0x3'));var interaction=require(_0x4d04('0x4'));var config=require('../../config/environment');var controller=require(_0x4d04('0x5'));router[_0x4d04('0x6')]('/',auth['isAuthenticated'](),controller[_0x4d04('0x7')]);router[_0x4d04('0x6')](_0x4d04('0x8'),auth[_0x4d04('0x9')](),controller[_0x4d04('0xa')]);router[_0x4d04('0x6')](_0x4d04('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4d04('0xc')]('/',auth[_0x4d04('0x9')](),controller[_0x4d04('0xd')]);router['put'](_0x4d04('0xb'),auth[_0x4d04('0x9')](),controller[_0x4d04('0xe')]);router[_0x4d04('0xf')](_0x4d04('0xb'),auth[_0x4d04('0x9')](),controller[_0x4d04('0x10')]);module[_0x4d04('0x11')]=router; \ No newline at end of file +var _0xb6a6=['../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','post','create','put','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3f59f5,_0x395302){var _0x4a2343=function(_0x44a6f7){while(--_0x44a6f7){_0x3f59f5['push'](_0x3f59f5['shift']());}};_0x4a2343(++_0x395302);}(_0xb6a6,0x1db));var _0x6b6a=function(_0x5710fd,_0x232ba9){_0x5710fd=_0x5710fd-0x0;var _0x8355f=_0xb6a6[_0x5710fd];return _0x8355f;};'use strict';var multer=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var path=require(_0x6b6a('0x2'));var timeout=require(_0x6b6a('0x3'));var express=require(_0x6b6a('0x4'));var router=express[_0x6b6a('0x5')]();var fs_extra=require(_0x6b6a('0x6'));var auth=require(_0x6b6a('0x7'));var interaction=require(_0x6b6a('0x8'));var config=require(_0x6b6a('0x9'));var controller=require(_0x6b6a('0xa'));router[_0x6b6a('0xb')]('/',auth[_0x6b6a('0xc')](),controller[_0x6b6a('0xd')]);router[_0x6b6a('0xb')](_0x6b6a('0xe'),auth[_0x6b6a('0xc')](),controller['describe']);router['get']('/:id',auth[_0x6b6a('0xc')](),controller['show']);router[_0x6b6a('0xf')]('/',auth[_0x6b6a('0xc')](),controller[_0x6b6a('0x10')]);router[_0x6b6a('0x11')]('/:id',auth[_0x6b6a('0xc')](),controller['update']);router[_0x6b6a('0x12')](_0x6b6a('0x13'),auth['isAuthenticated'](),controller[_0x6b6a('0x14')]);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 8095e79..73d6406 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x54ef,0x112));var _0xf54e=function(_0x37b8e3,_0x672e8e){_0x37b8e3=_0x37b8e3-0x0;var _0x47a5e1=_0x54ef[_0x37b8e3];return _0x47a5e1;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xd50b7f,_0x53c16c){var _0x380972=function(_0x4865d8){while(--_0x4865d8){_0xd50b7f['push'](_0xd50b7f['shift']());}};_0x380972(++_0x53c16c);}(_0x008c,0x188));var _0xc008=function(_0x3235a7,_0x24cb3b){_0x3235a7=_0x3235a7-0x0;var _0x56d0b5=_0x008c[_0x3235a7];return _0x56d0b5;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4ab41d8..b8ac3d7 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 _0xf0c7=['query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0xf0c7,0x6b));var _0x7f0c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf0c7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x7f0c('0x0'));var rimraf=require(_0x7f0c('0x1'));var zipdir=require(_0x7f0c('0x2'));var jsonpatch=require(_0x7f0c('0x3'));var rp=require(_0x7f0c('0x4'));var moment=require('moment');var BPromise=require(_0x7f0c('0x5'));var Mustache=require(_0x7f0c('0x6'));var util=require(_0x7f0c('0x7'));var path=require('path');var sox=require(_0x7f0c('0x8'));var csv=require(_0x7f0c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f0c('0xa'));var _=require(_0x7f0c('0xb'));var squel=require(_0x7f0c('0xc'));var crypto=require(_0x7f0c('0xd'));var jsforce=require(_0x7f0c('0xe'));var deskjs=require(_0x7f0c('0xf'));var toCsv=require(_0x7f0c('0x9'));var querystring=require(_0x7f0c('0x10'));var Papa=require(_0x7f0c('0x11'));var Redis=require(_0x7f0c('0x12'));var authService=require(_0x7f0c('0x13'));var qs=require(_0x7f0c('0x14'));var as=require(_0x7f0c('0x15'));var hardwareService=require(_0x7f0c('0x16'));var logger=require(_0x7f0c('0x17'))(_0x7f0c('0x18'));var utils=require(_0x7f0c('0x19'));var config=require(_0x7f0c('0x1a'));var licenseUtil=require(_0x7f0c('0x1b'));var db=require(_0x7f0c('0x1c'))['db'];function respondWithStatusCode(_0x574868,_0x22c27e){_0x22c27e=_0x22c27e||0xcc;return function(_0x392f9e){if(_0x392f9e){return _0x574868[_0x7f0c('0x1d')](_0x22c27e);}return _0x574868['status'](_0x22c27e)[_0x7f0c('0x1e')]();};}function respondWithResult(_0x34f8fb,_0x4492a6){_0x4492a6=_0x4492a6||0xc8;return function(_0x1bb806){if(_0x1bb806){return _0x34f8fb[_0x7f0c('0x1f')](_0x4492a6)[_0x7f0c('0x20')](_0x1bb806);}};}function respondWithFilteredResult(_0x432c7e,_0x33f0d6){return function(_0x30d2c2){if(_0x30d2c2){var _0x447272=typeof _0x33f0d6[_0x7f0c('0x21')]==='undefined'&&typeof _0x33f0d6['limit']===_0x7f0c('0x22');var _0x1ca46a=_0x30d2c2[_0x7f0c('0x23')];var _0x4394c8=_0x447272?0x0:_0x33f0d6['offset'];var _0x1c3479=_0x447272?_0x30d2c2[_0x7f0c('0x23')]:_0x33f0d6[_0x7f0c('0x21')]+_0x33f0d6['limit'];var _0x58954d;if(_0x1c3479>=_0x1ca46a){_0x1c3479=_0x1ca46a;_0x58954d=0xc8;}else{_0x58954d=0xce;}_0x432c7e[_0x7f0c('0x1f')](_0x58954d);return _0x432c7e['set'](_0x7f0c('0x24'),_0x4394c8+'-'+_0x1c3479+'/'+_0x1ca46a)['json'](_0x30d2c2);}return null;};}function patchUpdates(_0x56d7c5){return function(_0x3004bb){try{jsonpatch[_0x7f0c('0x25')](_0x3004bb,_0x56d7c5,!![]);}catch(_0x2fa77e){return BPromise['reject'](_0x2fa77e);}return _0x3004bb[_0x7f0c('0x26')]();};}function saveUpdates(_0x4bec7c,_0x46a9c5){return function(_0xddf8e4){if(_0xddf8e4){return _0xddf8e4[_0x7f0c('0x27')](_0x4bec7c)[_0x7f0c('0x28')](function(_0x53ac88){return _0x53ac88;});}return null;};}function removeEntity(_0x5ee101,_0xc0164d){return function(_0x1fe785){if(_0x1fe785){return _0x1fe785[_0x7f0c('0x29')]()[_0x7f0c('0x28')](function(){_0x5ee101[_0x7f0c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f125,_0x2ce3bc){return function(_0x19d294){if(!_0x19d294){_0x39f125['sendStatus'](0x194);}return _0x19d294;};}function handleError(_0x263508,_0x539332){_0x539332=_0x539332||0x1f4;return function(_0x5883a8){logger[_0x7f0c('0x2a')](_0x5883a8[_0x7f0c('0x2b')]);if(_0x5883a8[_0x7f0c('0x2c')]){delete _0x5883a8[_0x7f0c('0x2c')];}_0x263508[_0x7f0c('0x1f')](_0x539332)[_0x7f0c('0x2d')](_0x5883a8);};}exports[_0x7f0c('0x2e')]=function(_0x5d7e84,_0x2a04ad){var _0x450440={},_0x5e18ae={},_0x50eab8={'count':0x0,'rows':[]};var _0x55eec9=_[_0x7f0c('0x2f')](db[_0x7f0c('0x30')][_0x7f0c('0x31')],function(_0x23c00a){return{'name':_0x23c00a[_0x7f0c('0x32')],'type':_0x23c00a[_0x7f0c('0x33')][_0x7f0c('0x34')]};});_0x5e18ae['model']=_['map'](_0x55eec9,_0x7f0c('0x2c'));_0x5e18ae['query']=_['keys'](_0x5d7e84[_0x7f0c('0x35')]);_0x5e18ae['filters']=_[_0x7f0c('0x36')](_0x5e18ae[_0x7f0c('0x37')],_0x5e18ae[_0x7f0c('0x35')]);_0x450440[_0x7f0c('0x38')]=_[_0x7f0c('0x36')](_0x5e18ae['model'],qs[_0x7f0c('0x39')](_0x5d7e84['query'][_0x7f0c('0x39')]));_0x450440[_0x7f0c('0x38')]=_0x450440[_0x7f0c('0x38')][_0x7f0c('0x3a')]?_0x450440[_0x7f0c('0x38')]:_0x5e18ae['model'];if(!_0x5d7e84[_0x7f0c('0x35')][_0x7f0c('0x3b')](_0x7f0c('0x3c'))){_0x450440['limit']=qs[_0x7f0c('0x3d')](_0x5d7e84[_0x7f0c('0x35')][_0x7f0c('0x3d')]);_0x450440[_0x7f0c('0x21')]=qs[_0x7f0c('0x21')](_0x5d7e84[_0x7f0c('0x35')][_0x7f0c('0x21')]);}_0x450440['order']=qs[_0x7f0c('0x3e')](_0x5d7e84['query'][_0x7f0c('0x3e')]);_0x450440[_0x7f0c('0x3f')]=qs[_0x7f0c('0x40')](_[_0x7f0c('0x41')](_0x5d7e84[_0x7f0c('0x35')],_0x5e18ae[_0x7f0c('0x40')]),_0x55eec9);if(_0x5d7e84['query'][_0x7f0c('0x42')]){_0x450440['where']=_['merge'](_0x450440['where'],{'$or':_[_0x7f0c('0x2f')](_0x55eec9,function(_0x34a066){if(_0x34a066[_0x7f0c('0x33')]!==_0x7f0c('0x43')){var _0x192fb9={};_0x192fb9[_0x34a066['name']]={'$like':'%'+_0x5d7e84['query']['filter']+'%'};return _0x192fb9;}})});}_0x450440=_[_0x7f0c('0x44')]({},_0x450440,_0x5d7e84[_0x7f0c('0x45')]);var _0x20a3cd={'where':_0x450440[_0x7f0c('0x3f')]};return db[_0x7f0c('0x30')][_0x7f0c('0x23')](_0x20a3cd)[_0x7f0c('0x28')](function(_0x2b6759){_0x50eab8[_0x7f0c('0x23')]=_0x2b6759;if(_0x5d7e84[_0x7f0c('0x35')][_0x7f0c('0x46')]){_0x450440['include']=[{'all':!![]}];}return db[_0x7f0c('0x30')][_0x7f0c('0x47')](_0x450440);})['then'](function(_0x3d6767){_0x50eab8['rows']=_0x3d6767;return _0x50eab8;})[_0x7f0c('0x28')](respondWithFilteredResult(_0x2a04ad,_0x450440))['catch'](handleError(_0x2a04ad,null));};exports[_0x7f0c('0x48')]=function(_0x11f482,_0x27e038){var _0x3595a1={'raw':!![],'where':{'id':_0x11f482[_0x7f0c('0x49')]['id']}},_0x525b29={};_0x525b29[_0x7f0c('0x37')]=_['keys'](db['OpenchannelTransferReport'][_0x7f0c('0x31')]);_0x525b29[_0x7f0c('0x35')]=_[_0x7f0c('0x4a')](_0x11f482[_0x7f0c('0x35')]);_0x525b29['filters']=_[_0x7f0c('0x36')](_0x525b29[_0x7f0c('0x37')],_0x525b29['query']);_0x3595a1[_0x7f0c('0x38')]=_[_0x7f0c('0x36')](_0x525b29['model'],qs[_0x7f0c('0x39')](_0x11f482[_0x7f0c('0x35')][_0x7f0c('0x39')]));_0x3595a1[_0x7f0c('0x38')]=_0x3595a1[_0x7f0c('0x38')][_0x7f0c('0x3a')]?_0x3595a1['attributes']:_0x525b29[_0x7f0c('0x37')];if(_0x11f482[_0x7f0c('0x35')][_0x7f0c('0x46')]){_0x3595a1['include']=[{'all':!![]}];}_0x3595a1=_[_0x7f0c('0x44')]({},_0x3595a1,_0x11f482[_0x7f0c('0x45')]);return db[_0x7f0c('0x30')][_0x7f0c('0x4b')](_0x3595a1)['then'](handleEntityNotFound(_0x27e038,null))[_0x7f0c('0x28')](respondWithResult(_0x27e038,null))[_0x7f0c('0x4c')](handleError(_0x27e038,null));};exports[_0x7f0c('0x4d')]=function(_0x5481d1,_0x75a32b){return db[_0x7f0c('0x30')][_0x7f0c('0x4d')](_0x5481d1[_0x7f0c('0x4e')],{})['then'](respondWithResult(_0x75a32b,0xc9))[_0x7f0c('0x4c')](handleError(_0x75a32b,null));};exports[_0x7f0c('0x27')]=function(_0x3dad77,_0x235d07){if(_0x3dad77[_0x7f0c('0x4e')]['id']){delete _0x3dad77['body']['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3dad77['params']['id']}})['then'](handleEntityNotFound(_0x235d07,null))[_0x7f0c('0x28')](saveUpdates(_0x3dad77[_0x7f0c('0x4e')],null))[_0x7f0c('0x28')](respondWithResult(_0x235d07,null))[_0x7f0c('0x4c')](handleError(_0x235d07,null));};exports[_0x7f0c('0x29')]=function(_0x2afc16,_0x201dc7){return db[_0x7f0c('0x30')][_0x7f0c('0x4b')]({'where':{'id':_0x2afc16[_0x7f0c('0x49')]['id']}})[_0x7f0c('0x28')](handleEntityNotFound(_0x201dc7,null))[_0x7f0c('0x28')](removeEntity(_0x201dc7,null))[_0x7f0c('0x4c')](handleError(_0x201dc7,null));};exports['describe']=function(_0x21ecfb,_0xe06e48){return db[_0x7f0c('0x30')][_0x7f0c('0x4f')]()['then'](respondWithResult(_0xe06e48,null))[_0x7f0c('0x4c')](handleError(_0xe06e48,null));}; \ No newline at end of file +var _0xf9f5=['save','error','name','send','map','OpenchannelTransferReport','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','count','set','json','apply','reject'];(function(_0x3790b4,_0x3752e4){var _0x3b5084=function(_0x46873a){while(--_0x46873a){_0x3790b4['push'](_0x3790b4['shift']());}};_0x3b5084(++_0x3752e4);}(_0xf9f5,0x173));var _0x5f9f=function(_0x34e192,_0x36bff6){_0x34e192=_0x34e192-0x0;var _0x4f52e4=_0xf9f5[_0x34e192];return _0x4f52e4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5f9f('0x0'));var jsonpatch=require(_0x5f9f('0x1'));var rp=require(_0x5f9f('0x2'));var moment=require(_0x5f9f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5f9f('0x4'));var util=require(_0x5f9f('0x5'));var path=require(_0x5f9f('0x6'));var sox=require(_0x5f9f('0x7'));var csv=require(_0x5f9f('0x8'));var ejs=require(_0x5f9f('0x9'));var fs=require('fs');var fs_extra=require(_0x5f9f('0xa'));var _=require('lodash');var squel=require(_0x5f9f('0xb'));var crypto=require(_0x5f9f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5f9f('0x8'));var querystring=require(_0x5f9f('0xd'));var Papa=require(_0x5f9f('0xe'));var Redis=require(_0x5f9f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f9f('0x10'));var hardwareService=require(_0x5f9f('0x11'));var logger=require(_0x5f9f('0x12'))('api');var utils=require(_0x5f9f('0x13'));var config=require(_0x5f9f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9f('0x15'))['db'];function respondWithStatusCode(_0x3125bb,_0x5e7cb7){_0x5e7cb7=_0x5e7cb7||0xcc;return function(_0x264b28){if(_0x264b28){return _0x3125bb['sendStatus'](_0x5e7cb7);}return _0x3125bb[_0x5f9f('0x16')](_0x5e7cb7)[_0x5f9f('0x17')]();};}function respondWithResult(_0x3662eb,_0x17878a){_0x17878a=_0x17878a||0xc8;return function(_0x25b577){if(_0x25b577){return _0x3662eb[_0x5f9f('0x16')](_0x17878a)['json'](_0x25b577);}};}function respondWithFilteredResult(_0x29e134,_0x1dbe9d){return function(_0x371372){if(_0x371372){var _0x170259=typeof _0x1dbe9d[_0x5f9f('0x18')]==='undefined'&&typeof _0x1dbe9d[_0x5f9f('0x19')]==='undefined';var _0x375301=_0x371372[_0x5f9f('0x1a')];var _0x429f19=_0x170259?0x0:_0x1dbe9d['offset'];var _0x564013=_0x170259?_0x371372[_0x5f9f('0x1a')]:_0x1dbe9d[_0x5f9f('0x18')]+_0x1dbe9d[_0x5f9f('0x19')];var _0x4dad03;if(_0x564013>=_0x375301){_0x564013=_0x375301;_0x4dad03=0xc8;}else{_0x4dad03=0xce;}_0x29e134['status'](_0x4dad03);return _0x29e134[_0x5f9f('0x1b')]('Content-Range',_0x429f19+'-'+_0x564013+'/'+_0x375301)[_0x5f9f('0x1c')](_0x371372);}return null;};}function patchUpdates(_0x534011){return function(_0x44e9b6){try{jsonpatch[_0x5f9f('0x1d')](_0x44e9b6,_0x534011,!![]);}catch(_0x338f63){return BPromise[_0x5f9f('0x1e')](_0x338f63);}return _0x44e9b6[_0x5f9f('0x1f')]();};}function saveUpdates(_0x348782,_0x47d5ce){return function(_0x2628f1){if(_0x2628f1){return _0x2628f1['update'](_0x348782)['then'](function(_0x1e546c){return _0x1e546c;});}return null;};}function removeEntity(_0x1f8750,_0x3b9c5d){return function(_0xc4c5c){if(_0xc4c5c){return _0xc4c5c['destroy']()['then'](function(){_0x1f8750[_0x5f9f('0x16')](0xcc)[_0x5f9f('0x17')]();});}};}function handleEntityNotFound(_0x13d33c,_0x93420c){return function(_0xc1e449){if(!_0xc1e449){_0x13d33c['sendStatus'](0x194);}return _0xc1e449;};}function handleError(_0x3f35d7,_0x99283d){_0x99283d=_0x99283d||0x1f4;return function(_0x482807){logger[_0x5f9f('0x20')](_0x482807['stack']);if(_0x482807[_0x5f9f('0x21')]){delete _0x482807[_0x5f9f('0x21')];}_0x3f35d7[_0x5f9f('0x16')](_0x99283d)[_0x5f9f('0x22')](_0x482807);};}exports['index']=function(_0x36d249,_0xb0d97a){var _0x55f5a6={},_0x1bf4d9={},_0x2ec5ba={'count':0x0,'rows':[]};var _0x320add=_[_0x5f9f('0x23')](db[_0x5f9f('0x24')]['rawAttributes'],function(_0x413259){return{'name':_0x413259[_0x5f9f('0x25')],'type':_0x413259['type']['key']};});_0x1bf4d9['model']=_[_0x5f9f('0x23')](_0x320add,_0x5f9f('0x21'));_0x1bf4d9['query']=_[_0x5f9f('0x26')](_0x36d249[_0x5f9f('0x27')]);_0x1bf4d9[_0x5f9f('0x28')]=_[_0x5f9f('0x29')](_0x1bf4d9[_0x5f9f('0x2a')],_0x1bf4d9[_0x5f9f('0x27')]);_0x55f5a6[_0x5f9f('0x2b')]=_[_0x5f9f('0x29')](_0x1bf4d9[_0x5f9f('0x2a')],qs[_0x5f9f('0x2c')](_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x2c')]));_0x55f5a6[_0x5f9f('0x2b')]=_0x55f5a6[_0x5f9f('0x2b')][_0x5f9f('0x2d')]?_0x55f5a6[_0x5f9f('0x2b')]:_0x1bf4d9[_0x5f9f('0x2a')];if(!_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x2e')]('nolimit')){_0x55f5a6[_0x5f9f('0x19')]=qs[_0x5f9f('0x19')](_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x19')]);_0x55f5a6[_0x5f9f('0x18')]=qs[_0x5f9f('0x18')](_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x18')]);}_0x55f5a6['order']=qs[_0x5f9f('0x2f')](_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x2f')]);_0x55f5a6[_0x5f9f('0x30')]=qs[_0x5f9f('0x28')](_['pick'](_0x36d249[_0x5f9f('0x27')],_0x1bf4d9[_0x5f9f('0x28')]),_0x320add);if(_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x31')]){_0x55f5a6['where']=_[_0x5f9f('0x32')](_0x55f5a6[_0x5f9f('0x30')],{'$or':_[_0x5f9f('0x23')](_0x320add,function(_0x4992e4){if(_0x4992e4[_0x5f9f('0x33')]!=='VIRTUAL'){var _0x31006a={};_0x31006a[_0x4992e4[_0x5f9f('0x21')]]={'$like':'%'+_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x31')]+'%'};return _0x31006a;}})});}_0x55f5a6=_[_0x5f9f('0x32')]({},_0x55f5a6,_0x36d249[_0x5f9f('0x34')]);var _0x2ba142={'where':_0x55f5a6[_0x5f9f('0x30')]};return db[_0x5f9f('0x24')]['count'](_0x2ba142)[_0x5f9f('0x35')](function(_0x3cb18e){_0x2ec5ba[_0x5f9f('0x1a')]=_0x3cb18e;if(_0x36d249[_0x5f9f('0x27')][_0x5f9f('0x36')]){_0x55f5a6[_0x5f9f('0x37')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x5f9f('0x38')](_0x55f5a6);})[_0x5f9f('0x35')](function(_0x130c84){_0x2ec5ba[_0x5f9f('0x39')]=_0x130c84;return _0x2ec5ba;})[_0x5f9f('0x35')](respondWithFilteredResult(_0xb0d97a,_0x55f5a6))[_0x5f9f('0x3a')](handleError(_0xb0d97a,null));};exports[_0x5f9f('0x3b')]=function(_0x56c7de,_0x191f32){var _0x4d03a2={'raw':!![],'where':{'id':_0x56c7de[_0x5f9f('0x3c')]['id']}},_0x6c892e={};_0x6c892e[_0x5f9f('0x2a')]=_[_0x5f9f('0x26')](db['OpenchannelTransferReport'][_0x5f9f('0x3d')]);_0x6c892e['query']=_[_0x5f9f('0x26')](_0x56c7de[_0x5f9f('0x27')]);_0x6c892e[_0x5f9f('0x28')]=_[_0x5f9f('0x29')](_0x6c892e['model'],_0x6c892e[_0x5f9f('0x27')]);_0x4d03a2[_0x5f9f('0x2b')]=_[_0x5f9f('0x29')](_0x6c892e['model'],qs['fields'](_0x56c7de['query'][_0x5f9f('0x2c')]));_0x4d03a2[_0x5f9f('0x2b')]=_0x4d03a2['attributes']['length']?_0x4d03a2[_0x5f9f('0x2b')]:_0x6c892e[_0x5f9f('0x2a')];if(_0x56c7de['query'][_0x5f9f('0x36')]){_0x4d03a2[_0x5f9f('0x37')]=[{'all':!![]}];}_0x4d03a2=_['merge']({},_0x4d03a2,_0x56c7de[_0x5f9f('0x34')]);return db[_0x5f9f('0x24')]['find'](_0x4d03a2)[_0x5f9f('0x35')](handleEntityNotFound(_0x191f32,null))[_0x5f9f('0x35')](respondWithResult(_0x191f32,null))[_0x5f9f('0x3a')](handleError(_0x191f32,null));};exports[_0x5f9f('0x3e')]=function(_0x251146,_0x8d29d7){return db[_0x5f9f('0x24')][_0x5f9f('0x3e')](_0x251146[_0x5f9f('0x3f')],{})[_0x5f9f('0x35')](respondWithResult(_0x8d29d7,0xc9))[_0x5f9f('0x3a')](handleError(_0x8d29d7,null));};exports[_0x5f9f('0x40')]=function(_0x3cfd1d,_0x1a2989){if(_0x3cfd1d['body']['id']){delete _0x3cfd1d[_0x5f9f('0x3f')]['id'];}return db[_0x5f9f('0x24')][_0x5f9f('0x41')]({'where':{'id':_0x3cfd1d[_0x5f9f('0x3c')]['id']}})[_0x5f9f('0x35')](handleEntityNotFound(_0x1a2989,null))['then'](saveUpdates(_0x3cfd1d[_0x5f9f('0x3f')],null))[_0x5f9f('0x35')](respondWithResult(_0x1a2989,null))[_0x5f9f('0x3a')](handleError(_0x1a2989,null));};exports['destroy']=function(_0x167641,_0x568783){return db['OpenchannelTransferReport'][_0x5f9f('0x41')]({'where':{'id':_0x167641['params']['id']}})['then'](handleEntityNotFound(_0x568783,null))['then'](removeEntity(_0x568783,null))[_0x5f9f('0x3a')](handleError(_0x568783,null));};exports[_0x5f9f('0x42')]=function(_0x445d58,_0x3c8af5){return db[_0x5f9f('0x24')]['describe']()[_0x5f9f('0x35')](respondWithResult(_0x3c8af5,null))['catch'](handleError(_0x3c8af5,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 011ce69..cef919b 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 _0x9bbd=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','define'];(function(_0x48d45c,_0x31de4c){var _0x3e4185=function(_0x4de002){while(--_0x4de002){_0x48d45c['push'](_0x48d45c['shift']());}};_0x3e4185(++_0x31de4c);}(_0x9bbd,0x13a));var _0xd9bb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9bbd[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd9bb('0x0'));var util=require(_0xd9bb('0x1'));var logger=require(_0xd9bb('0x2'))(_0xd9bb('0x3'));var moment=require(_0xd9bb('0x4'));var BPromise=require(_0xd9bb('0x5'));var rp=require(_0xd9bb('0x6'));var fs=require('fs');var path=require(_0xd9bb('0x7'));var rimraf=require(_0xd9bb('0x8'));var config=require('../../config/environment');var attributes=require(_0xd9bb('0x9'));module['exports']=function(_0x4476ea,_0x451550){return _0x4476ea[_0xd9bb('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0xd9bb('0xb'),'paranoid':![],'indexes':[{'name':_0xd9bb('0xc'),'fields':[_0xd9bb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8de3=['request-promise','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x1a216d,_0x4be127){var _0x1854a6=function(_0x323414){while(--_0x323414){_0x1a216d['push'](_0x1a216d['shift']());}};_0x1854a6(++_0x4be127);}(_0x8de3,0x8b));var _0x38de=function(_0x5a427c,_0x1c7b6f){_0x5a427c=_0x5a427c-0x0;var _0xc17e0d=_0x8de3[_0x5a427c];return _0xc17e0d;};'use strict';var _=require(_0x38de('0x0'));var util=require(_0x38de('0x1'));var logger=require('../../config/logger')(_0x38de('0x2'));var moment=require(_0x38de('0x3'));var BPromise=require(_0x38de('0x4'));var rp=require(_0x38de('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x38de('0x6'));var attributes=require(_0x38de('0x7'));module['exports']=function(_0x2b7d9d,_0x2f27f9){return _0x2b7d9d[_0x38de('0x8')](_0x38de('0x9'),attributes,{'tableName':_0x38de('0xa'),'paranoid':![],'indexes':[{'name':_0x38de('0xb'),'fields':[_0x38de('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 843ef08..eedb970 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 _0x68f5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0x68f5,0x11a));var _0x568f=function(_0x19ddd9,_0x4351de){_0x19ddd9=_0x19ddd9-0x0;var _0x13ab97=_0x68f5[_0x19ddd9];return _0x13ab97;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var moment=require(_0x568f('0x2'));var BPromise=require('bluebird');var rs=require(_0x568f('0x3'));var fs=require('fs');var Redis=require(_0x568f('0x4'));var db=require(_0x568f('0x5'))['db'];var utils=require(_0x568f('0x6'));var logger=require(_0x568f('0x7'))('rpc');var config=require(_0x568f('0x8'));var jayson=require(_0x568f('0x9'));var client=jayson[_0x568f('0xa')][_0x568f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ca62c,_0x541fd2,_0x953f02){return new BPromise(function(_0x3568a0,_0x2492fc){return client['request'](_0x4ca62c,_0x953f02)[_0x568f('0xc')](function(_0x48fe85){logger[_0x568f('0xd')](_0x568f('0xe'),_0x541fd2,'request\x20sent');logger[_0x568f('0xf')](_0x568f('0x10'),_0x541fd2,_0x568f('0x11'),JSON[_0x568f('0x12')](_0x48fe85));if(_0x48fe85[_0x568f('0x13')]){if(_0x48fe85[_0x568f('0x13')][_0x568f('0x14')]===0x1f4){logger[_0x568f('0x13')](_0x568f('0xe'),_0x541fd2,_0x48fe85['error'][_0x568f('0x15')]);return _0x2492fc(_0x48fe85[_0x568f('0x13')][_0x568f('0x15')]);}logger[_0x568f('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x541fd2,_0x48fe85[_0x568f('0x13')]['message']);return _0x3568a0(_0x48fe85['error'][_0x568f('0x15')]);}else{logger[_0x568f('0xd')](_0x568f('0xe'),_0x541fd2,_0x568f('0x11'));_0x3568a0(_0x48fe85[_0x568f('0x16')][_0x568f('0x15')]);}})[_0x568f('0x17')](function(_0x1060cb){logger[_0x568f('0x13')](_0x568f('0xe'),_0x541fd2,_0x1060cb);_0x2492fc(_0x1060cb);});});} \ No newline at end of file +var _0xfd7b=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xfd7b[_0x365be9];return _0x185c12;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1535bed..bd99c10 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 _0x6345=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5794af,_0xd27f04){var _0x5ae2d0=function(_0x482e17){while(--_0x482e17){_0x5794af['push'](_0x5794af['shift']());}};_0x5ae2d0(++_0xd27f04);}(_0x6345,0xa4));var _0x5634=function(_0x1018b2,_0x3dd5e4){_0x1018b2=_0x1018b2-0x0;var _0x45bbad=_0x6345[_0x1018b2];return _0x45bbad;};'use strict';var multer=require(_0x5634('0x0'));var util=require('util');var path=require(_0x5634('0x1'));var timeout=require('connect-timeout');var express=require(_0x5634('0x2'));var router=express[_0x5634('0x3')]();var fs_extra=require(_0x5634('0x4'));var auth=require(_0x5634('0x5'));var interaction=require(_0x5634('0x6'));var config=require(_0x5634('0x7'));var controller=require(_0x5634('0x8'));router[_0x5634('0x9')]('/',auth[_0x5634('0xa')](),controller[_0x5634('0xb')]);router['get'](_0x5634('0xc'),auth[_0x5634('0xa')](),controller[_0x5634('0xd')]);router['post']('/',auth[_0x5634('0xa')](),controller[_0x5634('0xe')]);router['put'](_0x5634('0xc'),auth[_0x5634('0xa')](),controller[_0x5634('0xf')]);router[_0x5634('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5634('0x11')]);module[_0x5634('0x12')]=router; \ No newline at end of file +var _0x646d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','post','create','put','/:id','multer','util','connect-timeout','express'];(function(_0x97385e,_0x17e853){var _0x5d337e=function(_0x356c96){while(--_0x356c96){_0x97385e['push'](_0x97385e['shift']());}};_0x5d337e(++_0x17e853);}(_0x646d,0x173));var _0xd646=function(_0x58cff5,_0x2e49ed){_0x58cff5=_0x58cff5-0x0;var _0x38f532=_0x646d[_0x58cff5];return _0x38f532;};'use strict';var multer=require(_0xd646('0x0'));var util=require(_0xd646('0x1'));var path=require('path');var timeout=require(_0xd646('0x2'));var express=require(_0xd646('0x3'));var router=express[_0xd646('0x4')]();var fs_extra=require(_0xd646('0x5'));var auth=require(_0xd646('0x6'));var interaction=require(_0xd646('0x7'));var config=require('../../config/environment');var controller=require(_0xd646('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd646('0x9')]('/:id',auth[_0xd646('0xa')](),controller['show']);router[_0xd646('0xb')]('/',auth[_0xd646('0xa')](),controller[_0xd646('0xc')]);router[_0xd646('0xd')]('/:id',auth[_0xd646('0xa')](),controller['update']);router['delete'](_0xd646('0xe'),auth[_0xd646('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index bd5cde8..df8231e 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 _0xadd3=['sequelize','exports','STRING','name'];(function(_0x574dea,_0x4cf209){var _0x3ed444=function(_0x3423a2){while(--_0x3423a2){_0x574dea['push'](_0x574dea['shift']());}};_0x3ed444(++_0x4cf209);}(_0xadd3,0xa8));var _0x3add=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xadd3[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x3add('0x0'));module[_0x3add('0x1')]={'name':{'type':Sequelize[_0x3add('0x2')],'unique':_0x3add('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3add('0x2')]}}; \ No newline at end of file +var _0x021d=['STRING','exports','name'];(function(_0x3629d,_0x45e728){var _0x1c8b66=function(_0x145002){while(--_0x145002){_0x3629d['push'](_0x3629d['shift']());}};_0x1c8b66(++_0x45e728);}(_0x021d,0x1e1));var _0xd021=function(_0x1fd5f5,_0x36b4ec){_0x1fd5f5=_0x1fd5f5-0x0;var _0x3f2e69=_0x021d[_0x1fd5f5];return _0x3f2e69;};'use strict';var Sequelize=require('sequelize');module[_0xd021('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd021('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xd021('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f4a9034..42764bb 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 _0x63b2=['UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','send','index','map','Pause','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3de167,_0x1ef0fd){var _0x1ea3d=function(_0x3b3eee){while(--_0x3b3eee){_0x3de167['push'](_0x3de167['shift']());}};_0x1ea3d(++_0x1ef0fd);}(_0x63b2,0x157));var _0x263b=function(_0x4c40e6,_0x5adfe8){_0x4c40e6=_0x4c40e6-0x0;var _0x55528b=_0x63b2[_0x4c40e6];return _0x55528b;};'use strict';var emlformat=require(_0x263b('0x0'));var rimraf=require(_0x263b('0x1'));var zipdir=require(_0x263b('0x2'));var jsonpatch=require(_0x263b('0x3'));var rp=require(_0x263b('0x4'));var moment=require('moment');var BPromise=require(_0x263b('0x5'));var Mustache=require(_0x263b('0x6'));var util=require(_0x263b('0x7'));var path=require('path');var sox=require(_0x263b('0x8'));var csv=require(_0x263b('0x9'));var ejs=require(_0x263b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x263b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x263b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x263b('0xd'));var Papa=require('papaparse');var Redis=require(_0x263b('0xe'));var authService=require(_0x263b('0xf'));var qs=require(_0x263b('0x10'));var as=require(_0x263b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x263b('0x12'))(_0x263b('0x13'));var utils=require(_0x263b('0x14'));var config=require(_0x263b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x263b('0x16'))['db'];function respondWithStatusCode(_0x5a9a8e,_0x3f37c0){_0x3f37c0=_0x3f37c0||0xcc;return function(_0x49f6c5){if(_0x49f6c5){return _0x5a9a8e[_0x263b('0x17')](_0x3f37c0);}return _0x5a9a8e['status'](_0x3f37c0)[_0x263b('0x18')]();};}function respondWithResult(_0x5b6df3,_0x2b1fbd){_0x2b1fbd=_0x2b1fbd||0xc8;return function(_0x1f7f5e){if(_0x1f7f5e){return _0x5b6df3['status'](_0x2b1fbd)[_0x263b('0x19')](_0x1f7f5e);}};}function respondWithFilteredResult(_0x4956b5,_0x5ae208){return function(_0x171793){if(_0x171793){var _0x3afee4=typeof _0x5ae208[_0x263b('0x1a')]===_0x263b('0x1b')&&typeof _0x5ae208[_0x263b('0x1c')]===_0x263b('0x1b');var _0x149d9=_0x171793[_0x263b('0x1d')];var _0x21fc6c=_0x3afee4?0x0:_0x5ae208[_0x263b('0x1a')];var _0xe8d0fe=_0x3afee4?_0x171793[_0x263b('0x1d')]:_0x5ae208[_0x263b('0x1a')]+_0x5ae208['limit'];var _0x16712e;if(_0xe8d0fe>=_0x149d9){_0xe8d0fe=_0x149d9;_0x16712e=0xc8;}else{_0x16712e=0xce;}_0x4956b5[_0x263b('0x1e')](_0x16712e);return _0x4956b5[_0x263b('0x1f')](_0x263b('0x20'),_0x21fc6c+'-'+_0xe8d0fe+'/'+_0x149d9)[_0x263b('0x19')](_0x171793);}return null;};}function patchUpdates(_0x443e27){return function(_0x16f2cc){try{jsonpatch[_0x263b('0x21')](_0x16f2cc,_0x443e27,!![]);}catch(_0x36495c){return BPromise[_0x263b('0x22')](_0x36495c);}return _0x16f2cc[_0x263b('0x23')]();};}function saveUpdates(_0x12518a,_0x5a160e){return function(_0x80a7ff){if(_0x80a7ff){return _0x80a7ff[_0x263b('0x24')](_0x12518a)[_0x263b('0x25')](function(_0x5a4033){return _0x5a4033;});}return null;};}function removeEntity(_0xf9af14,_0x4d2e6f){return function(_0x4d68bf){if(_0x4d68bf){return _0x4d68bf[_0x263b('0x26')]()['then'](function(){var _0x5b461e=_0x4d68bf['get']({'plain':!![]});var _0x3163a2=_0x263b('0x27');return db['UserProfileResource'][_0x263b('0x26')]({'where':{'type':_0x3163a2,'resourceId':_0x5b461e['id']}})[_0x263b('0x25')](function(){return _0x4d68bf;});})['then'](function(){_0xf9af14[_0x263b('0x1e')](0xcc)[_0x263b('0x18')]();});}};}function handleEntityNotFound(_0x587e96,_0x49ebbc){return function(_0x24d33b){if(!_0x24d33b){_0x587e96[_0x263b('0x17')](0x194);}return _0x24d33b;};}function handleError(_0x34bfcb,_0x1defcf){_0x1defcf=_0x1defcf||0x1f4;return function(_0x502d49){logger['error'](_0x502d49['stack']);if(_0x502d49['name']){delete _0x502d49['name'];}_0x34bfcb[_0x263b('0x1e')](_0x1defcf)[_0x263b('0x28')](_0x502d49);};}exports[_0x263b('0x29')]=function(_0x28bd0b,_0x59d6e1){var _0x48e639={},_0x129214={},_0x549dcf={'count':0x0,'rows':[]};var _0xca71b8=_[_0x263b('0x2a')](db[_0x263b('0x2b')][_0x263b('0x2c')],function(_0x3bd7ea){return{'name':_0x3bd7ea[_0x263b('0x2d')],'type':_0x3bd7ea[_0x263b('0x2e')][_0x263b('0x2f')]};});_0x129214['model']=_[_0x263b('0x2a')](_0xca71b8,_0x263b('0x30'));_0x129214[_0x263b('0x31')]=_[_0x263b('0x32')](_0x28bd0b[_0x263b('0x31')]);_0x129214['filters']=_[_0x263b('0x33')](_0x129214[_0x263b('0x34')],_0x129214[_0x263b('0x31')]);_0x48e639['attributes']=_[_0x263b('0x33')](_0x129214['model'],qs[_0x263b('0x35')](_0x28bd0b[_0x263b('0x31')][_0x263b('0x35')]));_0x48e639[_0x263b('0x36')]=_0x48e639[_0x263b('0x36')][_0x263b('0x37')]?_0x48e639['attributes']:_0x129214[_0x263b('0x34')];if(!_0x28bd0b[_0x263b('0x31')][_0x263b('0x38')](_0x263b('0x39'))){_0x48e639[_0x263b('0x1c')]=qs[_0x263b('0x1c')](_0x28bd0b[_0x263b('0x31')][_0x263b('0x1c')]);_0x48e639[_0x263b('0x1a')]=qs[_0x263b('0x1a')](_0x28bd0b[_0x263b('0x31')][_0x263b('0x1a')]);}_0x48e639[_0x263b('0x3a')]=qs[_0x263b('0x3b')](_0x28bd0b['query'][_0x263b('0x3b')]);_0x48e639[_0x263b('0x3c')]=qs['filters'](_[_0x263b('0x3d')](_0x28bd0b[_0x263b('0x31')],_0x129214[_0x263b('0x3e')]),_0xca71b8);if(_0x28bd0b[_0x263b('0x31')][_0x263b('0x3f')]){_0x48e639['where']=_[_0x263b('0x40')](_0x48e639[_0x263b('0x3c')],{'$or':_['map'](_0xca71b8,function(_0x42783b){if(_0x42783b[_0x263b('0x2e')]!==_0x263b('0x41')){var _0x2d71f5={};_0x2d71f5[_0x42783b[_0x263b('0x30')]]={'$like':'%'+_0x28bd0b[_0x263b('0x31')][_0x263b('0x3f')]+'%'};return _0x2d71f5;}})});}_0x48e639=_[_0x263b('0x40')]({},_0x48e639,_0x28bd0b[_0x263b('0x42')]);var _0x3daf31={'where':_0x48e639[_0x263b('0x3c')]};return db['Pause'][_0x263b('0x1d')](_0x3daf31)['then'](function(_0x12e8e8){_0x549dcf['count']=_0x12e8e8;if(_0x28bd0b[_0x263b('0x31')]['includeAll']){_0x48e639[_0x263b('0x43')]=[{'all':!![]}];}return db[_0x263b('0x2b')][_0x263b('0x44')](_0x48e639);})[_0x263b('0x25')](function(_0x30027e){_0x549dcf['rows']=_0x30027e;return _0x549dcf;})[_0x263b('0x25')](respondWithFilteredResult(_0x59d6e1,_0x48e639))[_0x263b('0x45')](handleError(_0x59d6e1,null));};exports[_0x263b('0x46')]=function(_0x341eeb,_0x2c9a95){var _0x42e475={'raw':!![],'where':{'id':_0x341eeb[_0x263b('0x47')]['id']}},_0x4c84ee={};_0x4c84ee[_0x263b('0x34')]=_[_0x263b('0x32')](db[_0x263b('0x2b')][_0x263b('0x2c')]);_0x4c84ee[_0x263b('0x31')]=_['keys'](_0x341eeb[_0x263b('0x31')]);_0x4c84ee[_0x263b('0x3e')]=_['intersection'](_0x4c84ee[_0x263b('0x34')],_0x4c84ee[_0x263b('0x31')]);_0x42e475[_0x263b('0x36')]=_[_0x263b('0x33')](_0x4c84ee[_0x263b('0x34')],qs[_0x263b('0x35')](_0x341eeb[_0x263b('0x31')][_0x263b('0x35')]));_0x42e475[_0x263b('0x36')]=_0x42e475['attributes'][_0x263b('0x37')]?_0x42e475[_0x263b('0x36')]:_0x4c84ee[_0x263b('0x34')];if(_0x341eeb[_0x263b('0x31')][_0x263b('0x48')]){_0x42e475[_0x263b('0x43')]=[{'all':!![]}];}_0x42e475=_[_0x263b('0x40')]({},_0x42e475,_0x341eeb[_0x263b('0x42')]);return db[_0x263b('0x2b')][_0x263b('0x49')](_0x42e475)[_0x263b('0x25')](handleEntityNotFound(_0x2c9a95,null))['then'](respondWithResult(_0x2c9a95,null))['catch'](handleError(_0x2c9a95,null));};exports[_0x263b('0x4a')]=function(_0x581429,_0x3120c6){return db[_0x263b('0x2b')][_0x263b('0x4a')](_0x581429[_0x263b('0x4b')],{})[_0x263b('0x25')](function(_0x3597c1){var _0x1bf3a=_0x581429['user']['get']({'plain':!![]});if(!_0x1bf3a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bf3a[_0x263b('0x4c')]===_0x263b('0x4d')){var _0xfe13df=_0x3597c1[_0x263b('0x4e')]({'plain':!![]});var _0x5c7ed0=_0x263b('0x27');return db[_0x263b('0x4f')][_0x263b('0x49')]({'where':{'name':_0x5c7ed0,'userProfileId':_0x1bf3a[_0x263b('0x50')]},'raw':!![]})[_0x263b('0x25')](function(_0x32d7e5){if(_0x32d7e5&&_0x32d7e5[_0x263b('0x51')]===0x0){return db[_0x263b('0x52')][_0x263b('0x4a')]({'name':_0xfe13df['name'],'resourceId':_0xfe13df['id'],'type':_0x32d7e5[_0x263b('0x30')],'sectionId':_0x32d7e5['id']},{})['then'](function(){return _0x3597c1;});}else{return _0x3597c1;}})[_0x263b('0x45')](function(_0x5094d3){logger[_0x263b('0x53')](_0x263b('0x54'),_0x5094d3);throw _0x5094d3;});}return _0x3597c1;})[_0x263b('0x25')](respondWithResult(_0x3120c6,0xc9))[_0x263b('0x45')](handleError(_0x3120c6,null));};exports['update']=function(_0x24efd7,_0x30dd52){if(_0x24efd7['body']['id']){delete _0x24efd7[_0x263b('0x4b')]['id'];}return db[_0x263b('0x2b')][_0x263b('0x49')]({'where':{'id':_0x24efd7['params']['id']}})[_0x263b('0x25')](handleEntityNotFound(_0x30dd52,null))[_0x263b('0x25')](saveUpdates(_0x24efd7[_0x263b('0x4b')],null))[_0x263b('0x25')](respondWithResult(_0x30dd52,null))[_0x263b('0x45')](handleError(_0x30dd52,null));};exports['destroy']=function(_0x47add8,_0x22c99d){return db[_0x263b('0x2b')][_0x263b('0x49')]({'where':{'id':_0x47add8[_0x263b('0x47')]['id']}})[_0x263b('0x25')](handleEntityNotFound(_0x22c99d,null))['then'](removeEntity(_0x22c99d,null))[_0x263b('0x45')](handleError(_0x22c99d,null));}; \ No newline at end of file +var _0x6885=['autoAssociation','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId'];(function(_0x2db5a9,_0x3cbefa){var _0x3e2e77=function(_0x34dcf2){while(--_0x34dcf2){_0x2db5a9['push'](_0x2db5a9['shift']());}};_0x3e2e77(++_0x3cbefa);}(_0x6885,0xf6));var _0x5688=function(_0x37003f,_0x3d51b3){_0x37003f=_0x37003f-0x0;var _0x4945ca=_0x6885[_0x37003f];return _0x4945ca;};'use strict';var emlformat=require(_0x5688('0x0'));var rimraf=require(_0x5688('0x1'));var zipdir=require(_0x5688('0x2'));var jsonpatch=require(_0x5688('0x3'));var rp=require('request-promise');var moment=require(_0x5688('0x4'));var BPromise=require(_0x5688('0x5'));var Mustache=require(_0x5688('0x6'));var util=require(_0x5688('0x7'));var path=require('path');var sox=require(_0x5688('0x8'));var csv=require(_0x5688('0x9'));var ejs=require(_0x5688('0xa'));var fs=require('fs');var fs_extra=require(_0x5688('0xb'));var _=require(_0x5688('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5688('0xd'));var toCsv=require(_0x5688('0x9'));var querystring=require(_0x5688('0xe'));var Papa=require(_0x5688('0xf'));var Redis=require(_0x5688('0x10'));var authService=require(_0x5688('0x11'));var qs=require(_0x5688('0x12'));var as=require(_0x5688('0x13'));var hardwareService=require(_0x5688('0x14'));var logger=require(_0x5688('0x15'))(_0x5688('0x16'));var utils=require('../../config/utils');var config=require(_0x5688('0x17'));var licenseUtil=require(_0x5688('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x134dbe,_0x1a3198){_0x1a3198=_0x1a3198||0xcc;return function(_0x3a917e){if(_0x3a917e){return _0x134dbe[_0x5688('0x19')](_0x1a3198);}return _0x134dbe[_0x5688('0x1a')](_0x1a3198)[_0x5688('0x1b')]();};}function respondWithResult(_0x5ca59f,_0x6fcaea){_0x6fcaea=_0x6fcaea||0xc8;return function(_0x2cbb14){if(_0x2cbb14){return _0x5ca59f[_0x5688('0x1a')](_0x6fcaea)['json'](_0x2cbb14);}};}function respondWithFilteredResult(_0x323a5f,_0x430fad){return function(_0x31e738){if(_0x31e738){var _0x5416b4=typeof _0x430fad[_0x5688('0x1c')]===_0x5688('0x1d')&&typeof _0x430fad[_0x5688('0x1e')]===_0x5688('0x1d');var _0x5b8702=_0x31e738[_0x5688('0x1f')];var _0x165c00=_0x5416b4?0x0:_0x430fad['offset'];var _0x154329=_0x5416b4?_0x31e738['count']:_0x430fad[_0x5688('0x1c')]+_0x430fad['limit'];var _0x4fe8a6;if(_0x154329>=_0x5b8702){_0x154329=_0x5b8702;_0x4fe8a6=0xc8;}else{_0x4fe8a6=0xce;}_0x323a5f[_0x5688('0x1a')](_0x4fe8a6);return _0x323a5f['set']('Content-Range',_0x165c00+'-'+_0x154329+'/'+_0x5b8702)[_0x5688('0x20')](_0x31e738);}return null;};}function patchUpdates(_0x5331a2){return function(_0x107e2b){try{jsonpatch[_0x5688('0x21')](_0x107e2b,_0x5331a2,!![]);}catch(_0x4957d8){return BPromise[_0x5688('0x22')](_0x4957d8);}return _0x107e2b[_0x5688('0x23')]();};}function saveUpdates(_0x347b55,_0x4bb871){return function(_0x276f45){if(_0x276f45){return _0x276f45['update'](_0x347b55)[_0x5688('0x24')](function(_0x31b068){return _0x31b068;});}return null;};}function removeEntity(_0x293e37,_0x55a80d){return function(_0x2ca313){if(_0x2ca313){return _0x2ca313['destroy']()[_0x5688('0x24')](function(){var _0x6426d=_0x2ca313[_0x5688('0x25')]({'plain':!![]});var _0x3ffc53='Pauses';return db[_0x5688('0x26')][_0x5688('0x27')]({'where':{'type':_0x3ffc53,'resourceId':_0x6426d['id']}})[_0x5688('0x24')](function(){return _0x2ca313;});})['then'](function(){_0x293e37['status'](0xcc)[_0x5688('0x1b')]();});}};}function handleEntityNotFound(_0x4ed219,_0x42e90e){return function(_0x52bed3){if(!_0x52bed3){_0x4ed219[_0x5688('0x19')](0x194);}return _0x52bed3;};}function handleError(_0x38690b,_0x12144c){_0x12144c=_0x12144c||0x1f4;return function(_0x1597dc){logger[_0x5688('0x28')](_0x1597dc[_0x5688('0x29')]);if(_0x1597dc[_0x5688('0x2a')]){delete _0x1597dc[_0x5688('0x2a')];}_0x38690b[_0x5688('0x1a')](_0x12144c)['send'](_0x1597dc);};}exports[_0x5688('0x2b')]=function(_0x59b390,_0x4eff51){var _0xad6f1c={},_0x10fb1a={},_0x4dfe81={'count':0x0,'rows':[]};var _0x27e389=_[_0x5688('0x2c')](db[_0x5688('0x2d')][_0x5688('0x2e')],function(_0x184493){return{'name':_0x184493[_0x5688('0x2f')],'type':_0x184493[_0x5688('0x30')]['key']};});_0x10fb1a[_0x5688('0x31')]=_[_0x5688('0x2c')](_0x27e389,_0x5688('0x2a'));_0x10fb1a[_0x5688('0x32')]=_['keys'](_0x59b390[_0x5688('0x32')]);_0x10fb1a[_0x5688('0x33')]=_[_0x5688('0x34')](_0x10fb1a[_0x5688('0x31')],_0x10fb1a[_0x5688('0x32')]);_0xad6f1c[_0x5688('0x35')]=_['intersection'](_0x10fb1a['model'],qs[_0x5688('0x36')](_0x59b390['query'][_0x5688('0x36')]));_0xad6f1c[_0x5688('0x35')]=_0xad6f1c['attributes'][_0x5688('0x37')]?_0xad6f1c['attributes']:_0x10fb1a[_0x5688('0x31')];if(!_0x59b390[_0x5688('0x32')][_0x5688('0x38')](_0x5688('0x39'))){_0xad6f1c[_0x5688('0x1e')]=qs['limit'](_0x59b390[_0x5688('0x32')]['limit']);_0xad6f1c[_0x5688('0x1c')]=qs[_0x5688('0x1c')](_0x59b390['query'][_0x5688('0x1c')]);}_0xad6f1c['order']=qs[_0x5688('0x3a')](_0x59b390[_0x5688('0x32')]['sort']);_0xad6f1c[_0x5688('0x3b')]=qs[_0x5688('0x33')](_[_0x5688('0x3c')](_0x59b390[_0x5688('0x32')],_0x10fb1a[_0x5688('0x33')]),_0x27e389);if(_0x59b390[_0x5688('0x32')][_0x5688('0x3d')]){_0xad6f1c[_0x5688('0x3b')]=_[_0x5688('0x3e')](_0xad6f1c[_0x5688('0x3b')],{'$or':_['map'](_0x27e389,function(_0x273261){if(_0x273261[_0x5688('0x30')]!=='VIRTUAL'){var _0x41e549={};_0x41e549[_0x273261[_0x5688('0x2a')]]={'$like':'%'+_0x59b390[_0x5688('0x32')][_0x5688('0x3d')]+'%'};return _0x41e549;}})});}_0xad6f1c=_[_0x5688('0x3e')]({},_0xad6f1c,_0x59b390[_0x5688('0x3f')]);var _0x5acce9={'where':_0xad6f1c[_0x5688('0x3b')]};return db[_0x5688('0x2d')]['count'](_0x5acce9)[_0x5688('0x24')](function(_0x59e40e){_0x4dfe81['count']=_0x59e40e;if(_0x59b390[_0x5688('0x32')][_0x5688('0x40')]){_0xad6f1c[_0x5688('0x41')]=[{'all':!![]}];}return db[_0x5688('0x2d')][_0x5688('0x42')](_0xad6f1c);})[_0x5688('0x24')](function(_0x300000){_0x4dfe81[_0x5688('0x43')]=_0x300000;return _0x4dfe81;})[_0x5688('0x24')](respondWithFilteredResult(_0x4eff51,_0xad6f1c))['catch'](handleError(_0x4eff51,null));};exports[_0x5688('0x44')]=function(_0xf2924f,_0x11b44c){var _0x4c5234={'raw':!![],'where':{'id':_0xf2924f['params']['id']}},_0x3be3a6={};_0x3be3a6[_0x5688('0x31')]=_[_0x5688('0x45')](db[_0x5688('0x2d')][_0x5688('0x2e')]);_0x3be3a6['query']=_[_0x5688('0x45')](_0xf2924f[_0x5688('0x32')]);_0x3be3a6['filters']=_['intersection'](_0x3be3a6['model'],_0x3be3a6[_0x5688('0x32')]);_0x4c5234[_0x5688('0x35')]=_['intersection'](_0x3be3a6[_0x5688('0x31')],qs['fields'](_0xf2924f[_0x5688('0x32')][_0x5688('0x36')]));_0x4c5234[_0x5688('0x35')]=_0x4c5234[_0x5688('0x35')][_0x5688('0x37')]?_0x4c5234['attributes']:_0x3be3a6[_0x5688('0x31')];if(_0xf2924f[_0x5688('0x32')][_0x5688('0x40')]){_0x4c5234['include']=[{'all':!![]}];}_0x4c5234=_[_0x5688('0x3e')]({},_0x4c5234,_0xf2924f[_0x5688('0x3f')]);return db[_0x5688('0x2d')][_0x5688('0x46')](_0x4c5234)['then'](handleEntityNotFound(_0x11b44c,null))[_0x5688('0x24')](respondWithResult(_0x11b44c,null))['catch'](handleError(_0x11b44c,null));};exports[_0x5688('0x47')]=function(_0x4f8d31,_0x9d2e19){return db[_0x5688('0x2d')]['create'](_0x4f8d31[_0x5688('0x48')],{})[_0x5688('0x24')](function(_0x3df192){var _0xe072c7=_0x4f8d31[_0x5688('0x49')][_0x5688('0x25')]({'plain':!![]});if(!_0xe072c7)throw new Error(_0x5688('0x4a'));if(_0xe072c7[_0x5688('0x4b')]===_0x5688('0x49')){var _0x21bdc7=_0x3df192['get']({'plain':!![]});var _0x12242b=_0x5688('0x4c');return db['UserProfileSection'][_0x5688('0x46')]({'where':{'name':_0x12242b,'userProfileId':_0xe072c7[_0x5688('0x4d')]},'raw':!![]})[_0x5688('0x24')](function(_0xda43eb){if(_0xda43eb&&_0xda43eb[_0x5688('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x21bdc7[_0x5688('0x2a')],'resourceId':_0x21bdc7['id'],'type':_0xda43eb[_0x5688('0x2a')],'sectionId':_0xda43eb['id']},{})[_0x5688('0x24')](function(){return _0x3df192;});}else{return _0x3df192;}})[_0x5688('0x4f')](function(_0x9dd14e){logger[_0x5688('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9dd14e);throw _0x9dd14e;});}return _0x3df192;})[_0x5688('0x24')](respondWithResult(_0x9d2e19,0xc9))[_0x5688('0x4f')](handleError(_0x9d2e19,null));};exports[_0x5688('0x50')]=function(_0x4fb199,_0x360850){if(_0x4fb199[_0x5688('0x48')]['id']){delete _0x4fb199[_0x5688('0x48')]['id'];}return db['Pause'][_0x5688('0x46')]({'where':{'id':_0x4fb199['params']['id']}})['then'](handleEntityNotFound(_0x360850,null))[_0x5688('0x24')](saveUpdates(_0x4fb199[_0x5688('0x48')],null))[_0x5688('0x24')](respondWithResult(_0x360850,null))[_0x5688('0x4f')](handleError(_0x360850,null));};exports[_0x5688('0x27')]=function(_0x7dfd15,_0x1dd2a7){return db['Pause'][_0x5688('0x46')]({'where':{'id':_0x7dfd15['params']['id']}})[_0x5688('0x24')](handleEntityNotFound(_0x1dd2a7,null))[_0x5688('0x24')](removeEntity(_0x1dd2a7,null))[_0x5688('0x4f')](handleError(_0x1dd2a7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 91af928..16e7fa7 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x55ca,0x126));var _0xa55c=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0x55ca[_0x13e724];return _0x334a44;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Pause',attributes,{'tableName':_0xa55c('0x9'),'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 0ddfe42..2247a6e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1d015f,_0xfab938){var _0x1e34e4=function(_0x531da7){while(--_0x531da7){_0x1d015f['push'](_0x1d015f['shift']());}};_0x1e34e4(++_0xfab938);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f4ec0,_0x1092e7){_0x5f4ec0=_0x5f4ec0-0x0;var _0xa57cc6=_0xb10b[_0x5f4ec0];return _0xa57cc6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x568bd4,_0x17cfd8){var _0x3def0e=function(_0x3b76b9){while(--_0x3b76b9){_0x568bd4['push'](_0x568bd4['shift']());}};_0x3def0e(++_0x17cfd8);}(_0xb10b,0x12a));var _0xbb10=function(_0x561195,_0x1f9dec){_0x561195=_0x561195-0x0;var _0x5c87c3=_0xb10b[_0x561195];return _0x5c87c3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e2718ff..f18e8ba 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 _0x579c=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','extname','file','upload','post','/webhook','webhookPost','put','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x20777b,_0x5f30df){var _0x43a237=function(_0x15d149){while(--_0x15d149){_0x20777b['push'](_0x20777b['shift']());}};_0x43a237(++_0x5f30df);}(_0x579c,0xda));var _0xc579=function(_0x1debb4,_0x5d05d4){_0x1debb4=_0x1debb4-0x0;var _0x419b76=_0x579c[_0x1debb4];return _0x419b76;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/webhook',controller[_0xc579('0xc')]);router[_0xc579('0x9')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0x9')](_0xc579('0xf'),auth[_0xc579('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xc579('0x10')]({'destination':function(_0x2048bc,_0x17e37f,_0x3684b7){_0x3684b7(null,path[_0xc579('0x11')](config[_0xc579('0x12')],_0xc579('0x13')));},'filename':function(_0x1905b7,_0x421812,_0x441028){_0x421812[_0xc579('0x14')]=_0x421812['originalname'][_0xc579('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x441028(null,util['format'](_0xc579('0x16'),path['basename'](_0x421812[_0xc579('0x14')],path['extname'](_0x421812[_0xc579('0x14')])),Date['now'](),path[_0xc579('0x17')](_0x421812[_0xc579('0x14')])));}})});router['post']('/',upload['single'](_0xc579('0x18')),controller[_0xc579('0x19')]);router[_0xc579('0x1a')](_0xc579('0x1b'),controller[_0xc579('0x1c')]);router[_0xc579('0x1d')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0x1e')]);router[_0xc579('0x1f')]('/:id',auth[_0xc579('0xa')](),controller[_0xc579('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x4b84=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/webhook','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','now','extname','upload','webhookPost','/:id','isAuthenticated','delete'];(function(_0x818500,_0xe7620c){var _0x342023=function(_0x17c939){while(--_0x17c939){_0x818500['push'](_0x818500['shift']());}};_0x342023(++_0xe7620c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0x4b84[_0x3a3b9e];return _0x148103;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),controller['webhookGet']);router[_0x44b8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0x8')](_0x44b8('0xa'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);var upload=multer({'storage':multer[_0x44b8('0xc')]({'destination':function(_0x4315f6,_0x9b6048,_0x24dd10){_0x24dd10(null,path[_0x44b8('0xd')](config[_0x44b8('0xe')],'server/files/plugins'));},'filename':function(_0x147529,_0x4301a6,_0x4bcc43){_0x4301a6[_0x44b8('0xf')]=_0x4301a6['originalname'][_0x44b8('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bcc43(null,util[_0x44b8('0x11')]('%s-%s%s',path[_0x44b8('0x12')](_0x4301a6['originalname'],path['extname'](_0x4301a6[_0x44b8('0xf')])),Date[_0x44b8('0x13')](),path[_0x44b8('0x14')](_0x4301a6[_0x44b8('0xf')])));}})});router['post']('/',upload['single']('file'),controller[_0x44b8('0x15')]);router['post'](_0x44b8('0x7'),controller[_0x44b8('0x16')]);router['put'](_0x44b8('0x17'),auth[_0x44b8('0x18')](),controller['update']);router[_0x44b8('0x19')](_0x44b8('0x17'),auth['isAuthenticated'](),controller[_0x44b8('0x19')]);module[_0x44b8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e09c167..3b418f0 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 _0x9663=['TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html','script'];(function(_0x492b4b,_0x13b430){var _0x512ce6=function(_0x3aa87){while(--_0x3aa87){_0x492b4b['push'](_0x492b4b['shift']());}};_0x512ce6(++_0x13b430);}(_0x9663,0x1dc));var _0x3966=function(_0x4259d1,_0x4ba69d){_0x4259d1=_0x4259d1-0x0;var _0x232e99=_0x9663[_0x4259d1];return _0x232e99;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3966('0x0')]},'type':{'type':Sequelize[_0x3966('0x1')](_0x3966('0x2'),_0x3966('0x3'))},'description':{'type':Sequelize[_0x3966('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x3966('0x0')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x3966('0x5')],'defaultValue':0x0,'comment':_0x3966('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x3966('0x7'),_0x3966('0x8'),_0x3966('0x9'),_0x3966('0xa')),'defaultValue':'always','comment':_0x3966('0xb')},'icon':{'type':Sequelize[_0x3966('0x0')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x3966('0x0')]},'scriptName':{'type':Sequelize[_0x3966('0x0')]},'scriptPath':{'type':Sequelize[_0x3966('0x0')]}}; \ No newline at end of file +var _0x7fb4=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','script','TEXT'];(function(_0x4d2092,_0x6b0ecb){var _0x1a1ff9=function(_0x2c546a){while(--_0x2c546a){_0x4d2092['push'](_0x4d2092['shift']());}};_0x1a1ff9(++_0x6b0ecb);}(_0x7fb4,0x1aa));var _0x47fb=function(_0x5264f0,_0x1781e5){_0x5264f0=_0x5264f0-0x0;var _0x148d2d=_0x7fb4[_0x5264f0];return _0x148d2d;};'use strict';var Sequelize=require(_0x47fb('0x0'));module['exports']={'name':{'type':Sequelize[_0x47fb('0x1')]},'type':{'type':Sequelize['ENUM']('html',_0x47fb('0x2'))},'description':{'type':Sequelize[_0x47fb('0x3')]},'version':{'type':Sequelize[_0x47fb('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0x47fb('0x4')},'active':{'type':Sequelize[_0x47fb('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x47fb('0x6')]('adminOnly','agentOnly',_0x47fb('0x7'),_0x47fb('0x8')),'defaultValue':_0x47fb('0x7'),'comment':_0x47fb('0x9')},'icon':{'type':Sequelize[_0x47fb('0x1')]},'adminUrl':{'type':Sequelize[_0x47fb('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x47fb('0x1')]},'scriptPath':{'type':Sequelize[_0x47fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 032b9f6..88a1cd8 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 _0x808b=['statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','set','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','Plugins','error','stack','name','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','include','find','params','join','root','format','%s.zip','basename','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','server/files/plugins','dirname','attachments/**/*','existsSync','Plugin\x20not\x20found','download','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','readdirSync','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','plugins','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type'];(function(_0x31f8aa,_0x1d1aa1){var _0x5ef007=function(_0x517d11){while(--_0x517d11){_0x31f8aa['push'](_0x31f8aa['shift']());}};_0x5ef007(++_0x1d1aa1);}(_0x808b,0x140));var _0xb808=function(_0x48f69a,_0x113c85){_0x48f69a=_0x48f69a-0x0;var _0x1e216b=_0x808b[_0x48f69a];return _0x1e216b;};'use strict';var emlformat=require(_0xb808('0x0'));var rimraf=require(_0xb808('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb808('0x2'));var BPromise=require(_0xb808('0x3'));var Mustache=require(_0xb808('0x4'));var util=require('util');var path=require(_0xb808('0x5'));var sox=require(_0xb808('0x6'));var csv=require(_0xb808('0x7'));var ejs=require(_0xb808('0x8'));var fs=require('fs');var fs_extra=require(_0xb808('0x9'));var _=require(_0xb808('0xa'));var squel=require(_0xb808('0xb'));var crypto=require(_0xb808('0xc'));var jsforce=require(_0xb808('0xd'));var deskjs=require(_0xb808('0xe'));var toCsv=require(_0xb808('0x7'));var querystring=require(_0xb808('0xf'));var Papa=require(_0xb808('0x10'));var extract=require(_0xb808('0x11'));var rimraf=require(_0xb808('0x1'));var archiver=require('archiver');var Redis=require(_0xb808('0x12'));var authService=require(_0xb808('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb808('0x14'));var logger=require(_0xb808('0x15'))(_0xb808('0x16'));var utils=require('../../config/utils');var config=require(_0xb808('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb808('0x18'))['db'];config[_0xb808('0x19')]=_['defaults'](config['redis'],{'host':_0xb808('0x1a'),'port':0x18eb});var socket=require(_0xb808('0x1b'))(new Redis(config['redis']));require(_0xb808('0x1c'))[_0xb808('0x1d')](socket);function respondWithStatusCode(_0x30dc8c,_0x35e601){_0x35e601=_0x35e601||0xcc;return function(_0xff28f5){if(_0xff28f5){return _0x30dc8c[_0xb808('0x1e')](_0x35e601);}return _0x30dc8c['status'](_0x35e601)[_0xb808('0x1f')]();};}function respondWithResult(_0x479cd3,_0x10ffb1){_0x10ffb1=_0x10ffb1||0xc8;return function(_0x228e32){if(_0x228e32){return _0x479cd3[_0xb808('0x20')](_0x10ffb1)[_0xb808('0x21')](_0x228e32);}};}function respondWithFilteredResult(_0x4d77fa,_0x3bb4d9){return function(_0xdb35de){if(_0xdb35de){var _0x5771e8=typeof _0x3bb4d9[_0xb808('0x22')]==='undefined'&&typeof _0x3bb4d9[_0xb808('0x23')]===_0xb808('0x24');var _0x59ff67=_0xdb35de[_0xb808('0x25')];var _0x535799=_0x5771e8?0x0:_0x3bb4d9[_0xb808('0x22')];var _0x219599=_0x5771e8?_0xdb35de[_0xb808('0x25')]:_0x3bb4d9[_0xb808('0x22')]+_0x3bb4d9[_0xb808('0x23')];var _0x5f46fd;if(_0x219599>=_0x59ff67){_0x219599=_0x59ff67;_0x5f46fd=0xc8;}else{_0x5f46fd=0xce;}_0x4d77fa[_0xb808('0x20')](_0x5f46fd);return _0x4d77fa['set'](_0xb808('0x26'),_0x535799+'-'+_0x219599+'/'+_0x59ff67)[_0xb808('0x21')](_0xdb35de);}return null;};}function patchUpdates(_0x21068f){return function(_0x477055){try{jsonpatch[_0xb808('0x27')](_0x477055,_0x21068f,!![]);}catch(_0x315ed7){return BPromise['reject'](_0x315ed7);}return _0x477055[_0xb808('0x28')]();};}function saveUpdates(_0x336dac,_0x415af6){return function(_0x5b8464){if(_0x5b8464){return _0x5b8464[_0xb808('0x29')](_0x336dac)[_0xb808('0x2a')](function(_0x518373){return _0x518373;});}return null;};}function removeEntity(_0x52fa47,_0xd63eb7){return function(_0x17152b){if(_0x17152b){return _0x17152b[_0xb808('0x2b')]()['then'](function(){var _0x353894=_0x17152b['get']({'plain':!![]});var _0x45087c=_0xb808('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x45087c,'resourceId':_0x353894['id']}})['then'](function(){return _0x17152b;});})[_0xb808('0x2a')](function(){_0x52fa47[_0xb808('0x20')](0xcc)[_0xb808('0x1f')]();});}};}function handleEntityNotFound(_0x548d5f,_0x2fd4ab){return function(_0x7ebf9f){if(!_0x7ebf9f){_0x548d5f[_0xb808('0x1e')](0x194);}return _0x7ebf9f;};}function handleError(_0x1dbb44,_0x3f2c85){_0x3f2c85=_0x3f2c85||0x1f4;return function(_0x14cb1c){logger[_0xb808('0x2d')](_0x14cb1c[_0xb808('0x2e')]);if(_0x14cb1c['name']){delete _0x14cb1c[_0xb808('0x2f')];}_0x1dbb44['status'](_0x3f2c85)['send'](_0x14cb1c);};}exports['index']=function(_0x35ac33,_0x5ab75d){var _0x1aaff7={},_0x3486a6={},_0x998867={'count':0x0,'rows':[]};var _0xb8769=_[_0xb808('0x30')](db[_0xb808('0x31')][_0xb808('0x32')],function(_0x116c56){return{'name':_0x116c56[_0xb808('0x33')],'type':_0x116c56[_0xb808('0x34')]['key']};});_0x3486a6[_0xb808('0x35')]=_[_0xb808('0x30')](_0xb8769,_0xb808('0x2f'));_0x3486a6[_0xb808('0x36')]=_[_0xb808('0x37')](_0x35ac33[_0xb808('0x36')]);_0x3486a6[_0xb808('0x38')]=_[_0xb808('0x39')](_0x3486a6['model'],_0x3486a6[_0xb808('0x36')]);_0x1aaff7['attributes']=_[_0xb808('0x39')](_0x3486a6[_0xb808('0x35')],qs[_0xb808('0x3a')](_0x35ac33[_0xb808('0x36')][_0xb808('0x3a')]));_0x1aaff7[_0xb808('0x3b')]=_0x1aaff7[_0xb808('0x3b')][_0xb808('0x3c')]?_0x1aaff7['attributes']:_0x3486a6[_0xb808('0x35')];if(!_0x35ac33[_0xb808('0x36')][_0xb808('0x3d')](_0xb808('0x3e'))){_0x1aaff7[_0xb808('0x23')]=qs[_0xb808('0x23')](_0x35ac33[_0xb808('0x36')][_0xb808('0x23')]);_0x1aaff7[_0xb808('0x22')]=qs[_0xb808('0x22')](_0x35ac33[_0xb808('0x36')][_0xb808('0x22')]);}_0x1aaff7[_0xb808('0x3f')]=qs['sort'](_0x35ac33[_0xb808('0x36')][_0xb808('0x40')]);_0x1aaff7['where']=qs[_0xb808('0x38')](_['pick'](_0x35ac33[_0xb808('0x36')],_0x3486a6[_0xb808('0x38')]),_0xb8769);if(_0x35ac33['query'][_0xb808('0x41')]){_0x1aaff7['where']=_[_0xb808('0x42')](_0x1aaff7[_0xb808('0x43')],{'$or':_['map'](_0xb8769,function(_0xfe2c25){if(_0xfe2c25[_0xb808('0x34')]!==_0xb808('0x44')){var _0x11b0e9={};_0x11b0e9[_0xfe2c25['name']]={'$like':'%'+_0x35ac33['query'][_0xb808('0x41')]+'%'};return _0x11b0e9;}})});}_0x1aaff7=_['merge']({},_0x1aaff7,_0x35ac33[_0xb808('0x45')]);var _0x1b3c94={'where':_0x1aaff7[_0xb808('0x43')]};return db[_0xb808('0x31')][_0xb808('0x25')](_0x1b3c94)['then'](function(_0x5e2c27){_0x998867[_0xb808('0x25')]=_0x5e2c27;if(_0x35ac33[_0xb808('0x36')][_0xb808('0x46')]){_0x1aaff7['include']=[{'all':!![]}];}return db[_0xb808('0x31')]['findAll'](_0x1aaff7);})[_0xb808('0x2a')](function(_0x1808ca){_0x998867[_0xb808('0x47')]=_0x1808ca;return _0x998867;})['then'](respondWithFilteredResult(_0x5ab75d,_0x1aaff7))[_0xb808('0x48')](handleError(_0x5ab75d,null));};exports[_0xb808('0x49')]=function(_0x403b83,_0x4dd181){var _0x197590={'raw':!![],'where':{'id':_0x403b83['params']['id']}},_0x1e8463={};_0x1e8463[_0xb808('0x35')]=_['keys'](db['Plugin'][_0xb808('0x32')]);_0x1e8463[_0xb808('0x36')]=_[_0xb808('0x37')](_0x403b83[_0xb808('0x36')]);_0x1e8463[_0xb808('0x38')]=_['intersection'](_0x1e8463[_0xb808('0x35')],_0x1e8463[_0xb808('0x36')]);_0x197590['attributes']=_[_0xb808('0x39')](_0x1e8463[_0xb808('0x35')],qs['fields'](_0x403b83[_0xb808('0x36')]['fields']));_0x197590[_0xb808('0x3b')]=_0x197590[_0xb808('0x3b')][_0xb808('0x3c')]?_0x197590[_0xb808('0x3b')]:_0x1e8463[_0xb808('0x35')];if(_0x403b83[_0xb808('0x36')]['includeAll']){_0x197590[_0xb808('0x4a')]=[{'all':!![]}];}_0x197590=_[_0xb808('0x42')]({},_0x197590,_0x403b83[_0xb808('0x45')]);return db['Plugin'][_0xb808('0x4b')](_0x197590)[_0xb808('0x2a')](handleEntityNotFound(_0x4dd181,null))[_0xb808('0x2a')](respondWithResult(_0x4dd181,null))[_0xb808('0x48')](handleError(_0x4dd181,null));};exports['download']=function(_0x3df877,_0x1573b9,_0x164b52){return db[_0xb808('0x31')]['find']({'where':{'id':_0x3df877[_0xb808('0x4c')]['id']},'attributes':[_0xb808('0x2f'),'path'],'raw':!![]})[_0xb808('0x2a')](handleEntityNotFound(_0x1573b9,null))[_0xb808('0x2a')](function(_0x2dea0f){if(_0x2dea0f){var _0x677d7e=path[_0xb808('0x4d')](config[_0xb808('0x4e')],'server/files/plugins',util[_0xb808('0x4f')](_0xb808('0x50'),path[_0xb808('0x51')](_0x2dea0f[_0xb808('0x5')])));var _0x1c7ebd=fs['createWriteStream'](_0x677d7e);var _0x4b0a31=archiver(_0xb808('0x52'),{'zlib':{'level':0x9}});_0x4b0a31['on']('warning',function(_0x267b57){if(_0x267b57[_0xb808('0x53')]==='ENOENT'){logger['error'](_0x267b57);}else{throw new db[(_0xb808('0x54'))][(_0xb808('0x55'))](_0xb808('0x56'));}});_0x4b0a31['on'](_0xb808('0x2d'),function(_0x1de38c){throw new db[(_0xb808('0x54'))][(_0xb808('0x55'))](_0xb808('0x56'));});_0x4b0a31['pipe'](_0x1c7ebd);_0x4b0a31[_0xb808('0x57')]('**/*',{'cwd':path['join'](config['root'],_0xb808('0x58'),path[_0xb808('0x59')](_0x2dea0f[_0xb808('0x5')])),'ignore':[path['join'](path[_0xb808('0x51')](_0x2dea0f[_0xb808('0x5')]),'node_modules/**/*'),path['join'](path[_0xb808('0x51')](_0x2dea0f[_0xb808('0x5')]),_0xb808('0x5a'))],'nodir':!![]})['finalize']();_0x1c7ebd['on']('close',function(){if(!fs[_0xb808('0x5b')](_0x677d7e)){throw new db[(_0xb808('0x54'))][(_0xb808('0x55'))](_0xb808('0x5c'));}return _0x1573b9[_0xb808('0x5d')](_0x677d7e,util[_0xb808('0x4f')](_0xb808('0x50'),path['basename'](_0x2dea0f['path'])),function(_0x57aa1d){if(_0x57aa1d){throw new db['Sequelize'][(_0xb808('0x55'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb808('0x5e')](_0x677d7e);logger[_0xb808('0x5f')]('Download\x20completed');logger[_0xb808('0x5f')](_0xb808('0x60'));});});}return null;})['catch'](handleError(_0x1573b9,null));};exports['upload']=function(_0xf620e2,_0xd4166c,_0x427d96){var _0x179a96=path[_0xb808('0x51')](_0xf620e2[_0xb808('0x61')][_0xb808('0x62')],path[_0xb808('0x63')](_0xf620e2[_0xb808('0x61')][_0xb808('0x62')]));var _0x5609ca=path[_0xb808('0x4d')](config['root'],_0xb808('0x58'),_0xf620e2[_0xb808('0x61')][_0xb808('0x62')]);var _0x5e05e6=path[_0xb808('0x4d')](config[_0xb808('0x4e')],_0xb808('0x58'),_0x179a96);logger[_0xb808('0x5f')](_0xb808('0x64'),_0x5609ca);logger[_0xb808('0x5f')](_0xb808('0x65'),_0x5e05e6);try{fs[_0xb808('0x66')](_0x5609ca,parseInt('0777',0x8));extract(_0x5609ca,{'dir':_0x5e05e6},function(_0x1e8cec){if(_0x1e8cec){logger[_0xb808('0x2d')](_0x1e8cec);handleError(_0x1e8cec,!![]);};var _0x7a80c7=fs['readdirSync'](_0x5e05e6);if(_0x7a80c7[_0xb808('0x3c')]>0x1){removeReferences(_0x5609ca,_0x5e05e6);logger[_0xb808('0x2d')](_0xb808('0x67'));return _0x427d96(new Error(_0xb808('0x67')));}var _0x266abb=fs[_0xb808('0x68')](path[_0xb808('0x4d')](_0x5e05e6,_0x7a80c7[0x0]));if(_0x266abb['isFile']()){removeReferences(_0x5609ca,_0x5e05e6);logger[_0xb808('0x2d')](_0xb808('0x67'));return _0x427d96(new Error(_0xb808('0x67')));}if(_0x266abb['isDirectory']()){var _0x2a00e7=fs[_0xb808('0x69')](path[_0xb808('0x4d')](_0x5e05e6,_0x7a80c7[0x0]));if(_0x2a00e7[_0xb808('0x3c')]===0x0){removeReferences(_0x5609ca,_0x5e05e6);logger[_0xb808('0x2d')](_0xb808('0x67'));return _0x427d96(new Error('Invalid\x20plugin\x20structure'));}var _0x2a3c83=_0x2a00e7[_0xb808('0x6a')](function(_0x4e8a82){return _0x4e8a82===_0xb808('0x6b');});if(!_0x2a3c83){return _0x427d96(new Error('Plugin\x20manifest\x20missing'));}var _0x990425=fs[_0xb808('0x6c')](path[_0xb808('0x4d')](_0x5e05e6,_0x7a80c7[0x0],_0xb808('0x6b')));var _0x1d29d7=JSON[_0xb808('0x6d')](_0x990425);if(_0xb808('0x24')==typeof _0x1d29d7['name']){return _0x427d96(new Error(_0xb808('0x6e')));}if(_0xb808('0x24')==typeof _0x1d29d7[_0xb808('0x34')]){return _0x427d96(new Error(_0xb808('0x6f')));}if(_0xb808('0x24')==typeof _0x1d29d7[_0xb808('0x70')]){return _0x427d96(new Error(_0xb808('0x71')));}if('undefined'==typeof _0x1d29d7[_0xb808('0x72')]){return _0x427d96(new Error(_0xb808('0x73')));}if(_0x1d29d7['type']===_0xb808('0x74')){if(_0xb808('0x24')==typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x75')]){return _0x427d96(new Error(_0xb808('0x76')));}if(_0xb808('0x24')==typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x75')][_0xb808('0x77')]&&_0xb808('0x24')==typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x75')][_0xb808('0x78')]){return _0x427d96(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1d29d7[_0xb808('0x34')]===_0xb808('0x79')){if('undefined'==typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x7a')]){return _0x427d96(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb808('0x24')==typeof _0x1d29d7['parameters']['scriptPath']){return _0x427d96(new Error(_0xb808('0x7b')));}}else{return _0x427d96(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2e582d=_0x1d29d7[_0xb808('0x2f')];var _0x4867bd=_0x1d29d7[_0xb808('0x7c')];var _0x2d822a=_0x1d29d7['type'];var _0x13e552=_0x1d29d7[_0xb808('0x7d')]?_0x1d29d7[_0xb808('0x7d')]:_0xb808('0x7e');var _0x1f2c2a=_0x1d29d7[_0xb808('0x7f')]?_0x1d29d7['icon']:'icon-apps';var _0x1036ed='';var _0x1f36d4='';var _0x186f21='';var _0x164964='';var _0x5520e4=_0x1d29d7[_0xb808('0x70')];if(_0x2d822a==='html'){if(_0xb808('0x24')!=typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x75')][_0xb808('0x77')]){var _0x2b10fa=_0x1d29d7[_0xb808('0x72')][_0xb808('0x75')][_0xb808('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xb808('0x80')](_0x2b10fa)){_0x1036ed=path[_0xb808('0x4d')]('plugins',_0x179a96,_0x7a80c7[0x0],_0x2b10fa);}else{_0x1036ed=_0x2b10fa;}}else{logger[_0xb808('0x5f')](_0xb808('0x81'));}if(_0xb808('0x24')!=typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x75')]['agent']){var _0x47ca04=_0x1d29d7[_0xb808('0x72')][_0xb808('0x75')][_0xb808('0x78')];if(!/^(f|ht)tps?:\/\//i['test'](_0x47ca04)){_0x1f36d4=path[_0xb808('0x4d')]('plugins',_0x179a96,_0x7a80c7[0x0],_0x47ca04);}else{_0x1f36d4=_0x47ca04;}}else{logger[_0xb808('0x5f')](_0xb808('0x82'));}}else if(_0x2d822a==='script'){_0x186f21=_0x1d29d7[_0xb808('0x72')]['scriptName'];_0x164964=_0x1d29d7[_0xb808('0x72')][_0xb808('0x83')];if('undefined'!=typeof _0x1d29d7['parameters'][_0xb808('0x75')]){if(_0xb808('0x24')!=typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x75')][_0xb808('0x77')]){var _0x2b10fa=_0x1d29d7['parameters']['views'][_0xb808('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xb808('0x80')](_0x2b10fa)){_0x1036ed=path[_0xb808('0x4d')](_0xb808('0x84'),_0x179a96,_0x7a80c7[0x0],_0x2b10fa);}else{_0x1036ed=_0x2b10fa;}}if('undefined'!=typeof _0x1d29d7[_0xb808('0x72')][_0xb808('0x75')]['agent']){var _0x47ca04=_0x1d29d7[_0xb808('0x72')][_0xb808('0x75')][_0xb808('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xb808('0x80')](_0x47ca04)){_0x1f36d4=path['join'](_0xb808('0x84'),_0x179a96,_0x7a80c7[0x0],_0x47ca04);}else{_0x1f36d4=_0x47ca04;}}}}var _0x35b7e1={'name':_0x2e582d,'description':_0x4867bd,'path':path[_0xb808('0x4d')](_0x179a96,_0x7a80c7[0x0]),'type':_0x2d822a,'sidebar':_0x13e552,'icon':_0x1f2c2a,'adminUrl':_0x1036ed,'agentUrl':_0x1f36d4,'scriptName':_0x186f21,'scriptPath':_0x164964,'version':_0x5520e4};removeReferences(_0x5609ca,null);return db[_0xb808('0x31')]['create'](_0x35b7e1)[_0xb808('0x2a')](function(_0x78cf3f){var _0x3caf0d={'role':_0xf620e2['body'][_0xb808('0x85')],'userProfileId':_0xf620e2[_0xb808('0x86')][_0xb808('0x87')]};if(!_0x3caf0d)throw new Error(_0xb808('0x88'));if(_0x3caf0d['role']==='user'){var _0x34ce0a=_0x78cf3f['get']({'plain':!![]});return db['UserProfileSection'][_0xb808('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x3caf0d[_0xb808('0x87')]},'raw':!![]})['then'](function(_0x3331d6){if(_0x3331d6&&_0x3331d6[_0xb808('0x89')]===0x0){return db['UserProfileResource'][_0xb808('0x8a')]({'name':_0x34ce0a[_0xb808('0x2f')],'resourceId':_0x34ce0a['id'],'type':_0x3331d6[_0xb808('0x2f')],'sectionId':_0x3331d6['id']},{})['then'](function(){return _0x78cf3f;});}else{return _0x78cf3f;}})[_0xb808('0x48')](function(_0xe9deb8){logger[_0xb808('0x2d')](_0xb808('0x8b'),_0xe9deb8);throw _0xe9deb8;});}return _0x78cf3f;})[_0xb808('0x2a')](respondWithResult(_0xd4166c,null))[_0xb808('0x48')](handleError(_0xd4166c,null));}});}catch(_0x14f2ee){_0xd4166c[_0xb808('0x20')](0x1f4)[_0xb808('0x8c')](_0x14f2ee);}};function removeReferences(_0xa660e4,_0x52ff49){try{if(_0xa660e4){fs[_0xb808('0x5e')](_0xa660e4);logger[_0xb808('0x5f')]('Zip\x20archive\x20removed');}if(_0x52ff49){rimraf(_0x52ff49,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x3f5cd3){logger['error'](_0x3f5cd3);}}exports[_0xb808('0x29')]=function(_0x335bef,_0xc4c20b,_0x4a5f90){return db[_0xb808('0x31')][_0xb808('0x4b')]({'where':{'id':_0x335bef['params']['id']}})[_0xb808('0x2a')](handleEntityNotFound(_0xc4c20b,null))[_0xb808('0x2a')](saveUpdates(_0x335bef[_0xb808('0x86')],null))['then'](respondWithResult(_0xc4c20b,null))[_0xb808('0x48')](handleError(_0xc4c20b,null));};exports[_0xb808('0x8d')]=function(_0x25cbc0,_0x4f7da8,_0xb146b){return db['Plugin'][_0xb808('0x4b')]({'where':{'id':_0x25cbc0[_0xb808('0x4c')]['id']}})[_0xb808('0x2a')](function(_0x5165b3){if(_0x5165b3){return _0x5165b3[_0xb808('0x2b')]();}})['then'](function(_0xd744d3){rimraf(path['join'](config[_0xb808('0x4e')],'server/files/plugins',path[_0xb808('0x59')](_0xd744d3[_0xb808('0x5')])),function(){});return _0xd744d3;})[_0xb808('0x2a')](handleEntityNotFound(_0x4f7da8,null))['then'](respondWithStatusCode(_0x4f7da8,null))['catch'](handleError(_0x4f7da8,null));};exports[_0xb808('0x8e')]=function(_0x248d90,_0x136851,_0x3b8af9){return BPromise[_0xb808('0x8f')]()['then'](function(){if(!_0x248d90['query'][_0xb808('0x5')]){throw new Error(_0xb808('0x90'));}if(!_0x248d90[_0xb808('0x36')][_0xb808('0x91')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x230f8f=_0x248d90[_0xb808('0x36')][_0xb808('0x92')]?_0x248d90[_0xb808('0x36')][_0xb808('0x92')]+':'+_0x248d90[_0xb808('0x36')][_0xb808('0x91')]:_0xb808('0x93')+_0x248d90[_0xb808('0x36')]['port'];var _0x55b9fc=_0x248d90[_0xb808('0x36')][_0xb808('0x21')]?_0x248d90[_0xb808('0x36')][_0xb808('0x21')]:!![];var _0x1a9d83=_0x248d90[_0xb808('0x36')][_0xb808('0x94')]?_0x248d90[_0xb808('0x36')][_0xb808('0x94')]:null;var _0x537901={'method':_0x248d90[_0xb808('0x95')],'uri':util['format'](_0xb808('0x96'),_0x230f8f,_0x248d90[_0xb808('0x36')][_0xb808('0x5')]),'json':_0x55b9fc,'resolveWithFullResponse':!![],'encoding':_0x1a9d83,'qs':_0x248d90['query']};if(_0x248d90['headers']){_0x537901[_0xb808('0x97')]=_0x248d90['headers'];if(_0x537901[_0xb808('0x97')]['content-length']){delete _0x537901[_0xb808('0x97')][_0xb808('0x98')];}}if(_0x537901[_0xb808('0x97')][_0xb808('0x99')]){delete _0x537901[_0xb808('0x97')][_0xb808('0x99')];}return rp(_0x537901);})[_0xb808('0x2a')](function(_0xf90c3f){if(_0xf90c3f){_0x136851['set'](_0xf90c3f[_0xb808('0x97')]);logger['info'](_0xf90c3f[_0xb808('0x86')]);if(_['endsWith'](_0x248d90[_0xb808('0x36')][_0xb808('0x5')],'download')&&_0xf90c3f[_0xb808('0x9a')]==0x1f4){return _0x136851[_0xb808('0x1e')](_0xf90c3f[_0xb808('0x9a')]);}else{return _0x136851[_0xb808('0x20')](_0xf90c3f[_0xb808('0x9a')])[_0xb808('0x8c')](_0xf90c3f[_0xb808('0x86')]);}}else{return _0x136851[_0xb808('0x1e')](0xc8);}})[_0xb808('0x48')](handleError(_0x136851,null));};exports[_0xb808('0x9b')]=function(_0x2ef43e,_0x3e9f42,_0x26bed4){return BPromise[_0xb808('0x8f')]()[_0xb808('0x2a')](function(){if(!_0x2ef43e[_0xb808('0x36')][_0xb808('0x5')]){throw new Error(_0xb808('0x90'));}if(!_0x2ef43e[_0xb808('0x36')][_0xb808('0x91')]){throw new Error(_0xb808('0x9c'));}var _0x5ed058=_0x2ef43e[_0xb808('0x36')]['hostname']?_0x2ef43e['query'][_0xb808('0x92')]+':'+_0x2ef43e[_0xb808('0x36')][_0xb808('0x91')]:_0xb808('0x93')+_0x2ef43e[_0xb808('0x36')][_0xb808('0x91')];var _0x5b772a=_0x2ef43e['query']['json']?_0x2ef43e['query'][_0xb808('0x21')]:!![];var _0x1978d9=_0x2ef43e[_0xb808('0x36')][_0xb808('0x94')]?_0x2ef43e[_0xb808('0x36')][_0xb808('0x94')]:null;var _0x465df6={'method':_0x2ef43e[_0xb808('0x95')],'uri':util[_0xb808('0x4f')](_0xb808('0x96'),_0x5ed058,_0x2ef43e[_0xb808('0x36')][_0xb808('0x5')]),'json':_0x5b772a,'resolveWithFullResponse':!![],'encoding':_0x1978d9,'body':_0x2ef43e[_0xb808('0x86')]};if(_0x2ef43e[_0xb808('0x97')]){_0x465df6[_0xb808('0x97')]=_0x2ef43e[_0xb808('0x97')];if(_0x465df6[_0xb808('0x97')]['content-length']){delete _0x465df6['headers'][_0xb808('0x98')];}}if(_0x465df6['headers']['content-type']){delete _0x465df6[_0xb808('0x97')][_0xb808('0x99')];}return rp(_0x465df6);})[_0xb808('0x2a')](function(_0x3a3a79){if(_0x3a3a79){_0x3e9f42[_0xb808('0x9d')](_0x3a3a79[_0xb808('0x97')]);logger[_0xb808('0x5f')](_0x3a3a79['body']);return _0x3e9f42['status'](_0x3a3a79['statusCode'])['send'](_0x3a3a79['body']);}else{return _0x3e9f42[_0xb808('0x1e')](0xc8);}})[_0xb808('0x48')](handleError(_0x3e9f42,null));}; \ No newline at end of file +var _0x1f8c=['options','include','findAll','rows','catch','params','download','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x1f8c,0x10f));var _0xc1f8=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x1f8c[_0x45313f];return _0x402910;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1f8('0x0'));var zipdir=require(_0xc1f8('0x1'));var jsonpatch=require(_0xc1f8('0x2'));var rp=require(_0xc1f8('0x3'));var moment=require(_0xc1f8('0x4'));var BPromise=require(_0xc1f8('0x5'));var Mustache=require(_0xc1f8('0x6'));var util=require(_0xc1f8('0x7'));var path=require(_0xc1f8('0x8'));var sox=require(_0xc1f8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1f8('0xa'));var _=require(_0xc1f8('0xb'));var squel=require('squel');var crypto=require(_0xc1f8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc1f8('0xd'));var toCsv=require(_0xc1f8('0xe'));var querystring=require(_0xc1f8('0xf'));var Papa=require(_0xc1f8('0x10'));var extract=require(_0xc1f8('0x11'));var rimraf=require(_0xc1f8('0x0'));var archiver=require(_0xc1f8('0x12'));var Redis=require(_0xc1f8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc1f8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1f8('0x15'));var logger=require(_0xc1f8('0x16'))(_0xc1f8('0x17'));var utils=require(_0xc1f8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc1f8('0x19'));var db=require(_0xc1f8('0x1a'))['db'];config[_0xc1f8('0x1b')]=_[_0xc1f8('0x1c')](config[_0xc1f8('0x1b')],{'host':_0xc1f8('0x1d'),'port':0x18eb});var socket=require(_0xc1f8('0x1e'))(new Redis(config[_0xc1f8('0x1b')]));require('./plugin.socket')[_0xc1f8('0x1f')](socket);function respondWithStatusCode(_0x3907a1,_0x29905){_0x29905=_0x29905||0xcc;return function(_0x3ceada){if(_0x3ceada){return _0x3907a1[_0xc1f8('0x20')](_0x29905);}return _0x3907a1[_0xc1f8('0x21')](_0x29905)[_0xc1f8('0x22')]();};}function respondWithResult(_0x3f4f43,_0xaabaa8){_0xaabaa8=_0xaabaa8||0xc8;return function(_0x41a232){if(_0x41a232){return _0x3f4f43['status'](_0xaabaa8)['json'](_0x41a232);}};}function respondWithFilteredResult(_0x5d1c5d,_0x30b896){return function(_0x46c095){if(_0x46c095){var _0x114fa5=typeof _0x30b896[_0xc1f8('0x23')]==='undefined'&&typeof _0x30b896['limit']===_0xc1f8('0x24');var _0x189237=_0x46c095[_0xc1f8('0x25')];var _0x53e1fb=_0x114fa5?0x0:_0x30b896[_0xc1f8('0x23')];var _0x1968c3=_0x114fa5?_0x46c095['count']:_0x30b896['offset']+_0x30b896['limit'];var _0x4b67dc;if(_0x1968c3>=_0x189237){_0x1968c3=_0x189237;_0x4b67dc=0xc8;}else{_0x4b67dc=0xce;}_0x5d1c5d[_0xc1f8('0x21')](_0x4b67dc);return _0x5d1c5d[_0xc1f8('0x26')](_0xc1f8('0x27'),_0x53e1fb+'-'+_0x1968c3+'/'+_0x189237)[_0xc1f8('0x28')](_0x46c095);}return null;};}function patchUpdates(_0x533612){return function(_0x520e06){try{jsonpatch[_0xc1f8('0x29')](_0x520e06,_0x533612,!![]);}catch(_0x2cd3b3){return BPromise[_0xc1f8('0x2a')](_0x2cd3b3);}return _0x520e06[_0xc1f8('0x2b')]();};}function saveUpdates(_0x74365f,_0x29e6cc){return function(_0x4001dc){if(_0x4001dc){return _0x4001dc[_0xc1f8('0x2c')](_0x74365f)[_0xc1f8('0x2d')](function(_0x43548e){return _0x43548e;});}return null;};}function removeEntity(_0x257557,_0xbdc081){return function(_0x2b9d77){if(_0x2b9d77){return _0x2b9d77[_0xc1f8('0x2e')]()[_0xc1f8('0x2d')](function(){var _0x4cbf14=_0x2b9d77[_0xc1f8('0x2f')]({'plain':!![]});var _0x182081=_0xc1f8('0x30');return db[_0xc1f8('0x31')][_0xc1f8('0x2e')]({'where':{'type':_0x182081,'resourceId':_0x4cbf14['id']}})[_0xc1f8('0x2d')](function(){return _0x2b9d77;});})[_0xc1f8('0x2d')](function(){_0x257557[_0xc1f8('0x21')](0xcc)[_0xc1f8('0x22')]();});}};}function handleEntityNotFound(_0x449191,_0x324c6f){return function(_0x59c9fc){if(!_0x59c9fc){_0x449191['sendStatus'](0x194);}return _0x59c9fc;};}function handleError(_0x12c729,_0x2c0114){_0x2c0114=_0x2c0114||0x1f4;return function(_0x13f121){logger['error'](_0x13f121['stack']);if(_0x13f121[_0xc1f8('0x32')]){delete _0x13f121[_0xc1f8('0x32')];}_0x12c729[_0xc1f8('0x21')](_0x2c0114)['send'](_0x13f121);};}exports[_0xc1f8('0x33')]=function(_0x575433,_0x9d68c0){var _0x343130={},_0x1e74a5={},_0x5a4f32={'count':0x0,'rows':[]};var _0x171caf=_[_0xc1f8('0x34')](db[_0xc1f8('0x35')][_0xc1f8('0x36')],function(_0x135558){return{'name':_0x135558[_0xc1f8('0x37')],'type':_0x135558[_0xc1f8('0x38')][_0xc1f8('0x39')]};});_0x1e74a5[_0xc1f8('0x3a')]=_['map'](_0x171caf,_0xc1f8('0x32'));_0x1e74a5['query']=_[_0xc1f8('0x3b')](_0x575433[_0xc1f8('0x3c')]);_0x1e74a5[_0xc1f8('0x3d')]=_[_0xc1f8('0x3e')](_0x1e74a5['model'],_0x1e74a5[_0xc1f8('0x3c')]);_0x343130[_0xc1f8('0x3f')]=_[_0xc1f8('0x3e')](_0x1e74a5[_0xc1f8('0x3a')],qs[_0xc1f8('0x40')](_0x575433['query'][_0xc1f8('0x40')]));_0x343130[_0xc1f8('0x3f')]=_0x343130[_0xc1f8('0x3f')][_0xc1f8('0x41')]?_0x343130[_0xc1f8('0x3f')]:_0x1e74a5[_0xc1f8('0x3a')];if(!_0x575433['query'][_0xc1f8('0x42')](_0xc1f8('0x43'))){_0x343130[_0xc1f8('0x44')]=qs[_0xc1f8('0x44')](_0x575433[_0xc1f8('0x3c')][_0xc1f8('0x44')]);_0x343130[_0xc1f8('0x23')]=qs['offset'](_0x575433[_0xc1f8('0x3c')][_0xc1f8('0x23')]);}_0x343130['order']=qs[_0xc1f8('0x45')](_0x575433[_0xc1f8('0x3c')]['sort']);_0x343130[_0xc1f8('0x46')]=qs['filters'](_[_0xc1f8('0x47')](_0x575433[_0xc1f8('0x3c')],_0x1e74a5['filters']),_0x171caf);if(_0x575433[_0xc1f8('0x3c')][_0xc1f8('0x48')]){_0x343130[_0xc1f8('0x46')]=_[_0xc1f8('0x49')](_0x343130[_0xc1f8('0x46')],{'$or':_[_0xc1f8('0x34')](_0x171caf,function(_0x388153){if(_0x388153[_0xc1f8('0x38')]!==_0xc1f8('0x4a')){var _0x141318={};_0x141318[_0x388153[_0xc1f8('0x32')]]={'$like':'%'+_0x575433['query'][_0xc1f8('0x48')]+'%'};return _0x141318;}})});}_0x343130=_[_0xc1f8('0x49')]({},_0x343130,_0x575433[_0xc1f8('0x4b')]);var _0x96b6cd={'where':_0x343130[_0xc1f8('0x46')]};return db[_0xc1f8('0x35')]['count'](_0x96b6cd)[_0xc1f8('0x2d')](function(_0x556299){_0x5a4f32[_0xc1f8('0x25')]=_0x556299;if(_0x575433[_0xc1f8('0x3c')]['includeAll']){_0x343130[_0xc1f8('0x4c')]=[{'all':!![]}];}return db[_0xc1f8('0x35')][_0xc1f8('0x4d')](_0x343130);})['then'](function(_0x41f37e){_0x5a4f32[_0xc1f8('0x4e')]=_0x41f37e;return _0x5a4f32;})['then'](respondWithFilteredResult(_0x9d68c0,_0x343130))[_0xc1f8('0x4f')](handleError(_0x9d68c0,null));};exports['show']=function(_0x537dfc,_0x305e43){var _0x150c14={'raw':!![],'where':{'id':_0x537dfc[_0xc1f8('0x50')]['id']}},_0x1474e5={};_0x1474e5[_0xc1f8('0x3a')]=_['keys'](db['Plugin'][_0xc1f8('0x36')]);_0x1474e5[_0xc1f8('0x3c')]=_[_0xc1f8('0x3b')](_0x537dfc[_0xc1f8('0x3c')]);_0x1474e5[_0xc1f8('0x3d')]=_[_0xc1f8('0x3e')](_0x1474e5['model'],_0x1474e5['query']);_0x150c14[_0xc1f8('0x3f')]=_[_0xc1f8('0x3e')](_0x1474e5[_0xc1f8('0x3a')],qs[_0xc1f8('0x40')](_0x537dfc[_0xc1f8('0x3c')]['fields']));_0x150c14[_0xc1f8('0x3f')]=_0x150c14[_0xc1f8('0x3f')][_0xc1f8('0x41')]?_0x150c14['attributes']:_0x1474e5[_0xc1f8('0x3a')];if(_0x537dfc[_0xc1f8('0x3c')]['includeAll']){_0x150c14[_0xc1f8('0x4c')]=[{'all':!![]}];}_0x150c14=_[_0xc1f8('0x49')]({},_0x150c14,_0x537dfc[_0xc1f8('0x4b')]);return db[_0xc1f8('0x35')]['find'](_0x150c14)[_0xc1f8('0x2d')](handleEntityNotFound(_0x305e43,null))[_0xc1f8('0x2d')](respondWithResult(_0x305e43,null))[_0xc1f8('0x4f')](handleError(_0x305e43,null));};exports[_0xc1f8('0x51')]=function(_0x40163a,_0x4dde79,_0x34f87f){return db[_0xc1f8('0x35')][_0xc1f8('0x52')]({'where':{'id':_0x40163a[_0xc1f8('0x50')]['id']},'attributes':['name',_0xc1f8('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x4dde79,null))[_0xc1f8('0x2d')](function(_0x3471e3){if(_0x3471e3){var _0x43c96a=path[_0xc1f8('0x53')](config['root'],_0xc1f8('0x54'),util[_0xc1f8('0x55')](_0xc1f8('0x56'),path[_0xc1f8('0x57')](_0x3471e3[_0xc1f8('0x8')])));var _0x5d8a5e=fs[_0xc1f8('0x58')](_0x43c96a);var _0x42e6ee=archiver(_0xc1f8('0x59'),{'zlib':{'level':0x9}});_0x42e6ee['on'](_0xc1f8('0x5a'),function(_0x2ef036){if(_0x2ef036[_0xc1f8('0x5b')]===_0xc1f8('0x5c')){logger[_0xc1f8('0x5d')](_0x2ef036);}else{throw new db[(_0xc1f8('0x5e'))]['Error'](_0xc1f8('0x5f'));}});_0x42e6ee['on'](_0xc1f8('0x5d'),function(_0x3a456a){throw new db['Sequelize'][(_0xc1f8('0x60'))](_0xc1f8('0x5f'));});_0x42e6ee['pipe'](_0x5d8a5e);_0x42e6ee[_0xc1f8('0x61')](_0xc1f8('0x62'),{'cwd':path[_0xc1f8('0x53')](config['root'],_0xc1f8('0x54'),path['dirname'](_0x3471e3[_0xc1f8('0x8')])),'ignore':[path[_0xc1f8('0x53')](path[_0xc1f8('0x57')](_0x3471e3[_0xc1f8('0x8')]),'node_modules/**/*'),path[_0xc1f8('0x53')](path['basename'](_0x3471e3[_0xc1f8('0x8')]),'attachments/**/*')],'nodir':!![]})[_0xc1f8('0x63')]();_0x5d8a5e['on'](_0xc1f8('0x64'),function(){if(!fs['existsSync'](_0x43c96a)){throw new db[(_0xc1f8('0x5e'))]['Error'](_0xc1f8('0x65'));}return _0x4dde79['download'](_0x43c96a,util['format'](_0xc1f8('0x56'),path['basename'](_0x3471e3[_0xc1f8('0x8')])),function(_0x47a4db){if(_0x47a4db){throw new db[(_0xc1f8('0x5e'))][(_0xc1f8('0x60'))](_0xc1f8('0x66'));}fs[_0xc1f8('0x67')](_0x43c96a);logger[_0xc1f8('0x68')](_0xc1f8('0x69'));logger[_0xc1f8('0x68')](_0xc1f8('0x6a'));});});}return null;})[_0xc1f8('0x4f')](handleError(_0x4dde79,null));};exports[_0xc1f8('0x6b')]=function(_0x1d8a11,_0x470036,_0x1915ca){var _0x1fa3f2=path[_0xc1f8('0x57')](_0x1d8a11[_0xc1f8('0x6c')][_0xc1f8('0x6d')],path[_0xc1f8('0x6e')](_0x1d8a11[_0xc1f8('0x6c')][_0xc1f8('0x6d')]));var _0x528766=path[_0xc1f8('0x53')](config[_0xc1f8('0x6f')],_0xc1f8('0x54'),_0x1d8a11['file'][_0xc1f8('0x6d')]);var _0x27e7eb=path[_0xc1f8('0x53')](config[_0xc1f8('0x6f')],'server/files/plugins',_0x1fa3f2);logger[_0xc1f8('0x68')](_0xc1f8('0x70'),_0x528766);logger[_0xc1f8('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x27e7eb);try{fs[_0xc1f8('0x71')](_0x528766,parseInt(_0xc1f8('0x72'),0x8));extract(_0x528766,{'dir':_0x27e7eb},function(_0x42fff4){if(_0x42fff4){logger[_0xc1f8('0x5d')](_0x42fff4);handleError(_0x42fff4,!![]);};var _0x4cd8b7=fs[_0xc1f8('0x73')](_0x27e7eb);if(_0x4cd8b7['length']>0x1){removeReferences(_0x528766,_0x27e7eb);logger[_0xc1f8('0x5d')](_0xc1f8('0x74'));return _0x1915ca(new Error('Invalid\x20plugin\x20structure'));}var _0x12ff07=fs[_0xc1f8('0x75')](path['join'](_0x27e7eb,_0x4cd8b7[0x0]));if(_0x12ff07['isFile']()){removeReferences(_0x528766,_0x27e7eb);logger['error'](_0xc1f8('0x74'));return _0x1915ca(new Error(_0xc1f8('0x74')));}if(_0x12ff07[_0xc1f8('0x76')]()){var _0x1f2003=fs[_0xc1f8('0x73')](path[_0xc1f8('0x53')](_0x27e7eb,_0x4cd8b7[0x0]));if(_0x1f2003['length']===0x0){removeReferences(_0x528766,_0x27e7eb);logger[_0xc1f8('0x5d')](_0xc1f8('0x74'));return _0x1915ca(new Error(_0xc1f8('0x74')));}var _0x5e5061=_0x1f2003[_0xc1f8('0x77')](function(_0x3670af){return _0x3670af===_0xc1f8('0x78');});if(!_0x5e5061){return _0x1915ca(new Error(_0xc1f8('0x79')));}var _0xdd6a05=fs[_0xc1f8('0x7a')](path[_0xc1f8('0x53')](_0x27e7eb,_0x4cd8b7[0x0],_0xc1f8('0x78')));var _0x32e62f=JSON[_0xc1f8('0x7b')](_0xdd6a05);if('undefined'==typeof _0x32e62f[_0xc1f8('0x32')]){return _0x1915ca(new Error(_0xc1f8('0x7c')));}if(_0xc1f8('0x24')==typeof _0x32e62f[_0xc1f8('0x38')]){return _0x1915ca(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x32e62f[_0xc1f8('0x7d')]){return _0x1915ca(new Error(_0xc1f8('0x7e')));}if('undefined'==typeof _0x32e62f[_0xc1f8('0x7f')]){return _0x1915ca(new Error(_0xc1f8('0x80')));}if(_0x32e62f[_0xc1f8('0x38')]===_0xc1f8('0x81')){if('undefined'==typeof _0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x82')]){return _0x1915ca(new Error(_0xc1f8('0x83')));}if(_0xc1f8('0x24')==typeof _0x32e62f[_0xc1f8('0x7f')]['views']['admin']&&_0xc1f8('0x24')==typeof _0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x82')][_0xc1f8('0x84')]){return _0x1915ca(new Error(_0xc1f8('0x85')));}}else if(_0x32e62f['type']===_0xc1f8('0x86')){if(_0xc1f8('0x24')==typeof _0x32e62f['parameters'][_0xc1f8('0x87')]){return _0x1915ca(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xc1f8('0x24')==typeof _0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x88')]){return _0x1915ca(new Error(_0xc1f8('0x89')));}}else{return _0x1915ca(new Error(_0xc1f8('0x8a')));}var _0x105bd7=_0x32e62f[_0xc1f8('0x32')];var _0x1780f7=_0x32e62f[_0xc1f8('0x8b')];var _0x12fa7e=_0x32e62f['type'];var _0x2224f4=_0x32e62f[_0xc1f8('0x8c')]?_0x32e62f[_0xc1f8('0x8c')]:_0xc1f8('0x8d');var _0x479443=_0x32e62f[_0xc1f8('0x8e')]?_0x32e62f[_0xc1f8('0x8e')]:_0xc1f8('0x8f');var _0x1b5597='';var _0x1600e3='';var _0x5b056d='';var _0x47694c='';var _0x6babd9=_0x32e62f[_0xc1f8('0x7d')];if(_0x12fa7e===_0xc1f8('0x81')){if(_0xc1f8('0x24')!=typeof _0x32e62f['parameters'][_0xc1f8('0x82')][_0xc1f8('0x90')]){var _0x3669c7=_0x32e62f['parameters'][_0xc1f8('0x82')][_0xc1f8('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3669c7)){_0x1b5597=path[_0xc1f8('0x53')](_0xc1f8('0x91'),_0x1fa3f2,_0x4cd8b7[0x0],_0x3669c7);}else{_0x1b5597=_0x3669c7;}}else{logger[_0xc1f8('0x68')](_0xc1f8('0x92'));}if(_0xc1f8('0x24')!=typeof _0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x82')][_0xc1f8('0x84')]){var _0x3f9c24=_0x32e62f[_0xc1f8('0x7f')]['views'][_0xc1f8('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xc1f8('0x93')](_0x3f9c24)){_0x1600e3=path[_0xc1f8('0x53')](_0xc1f8('0x91'),_0x1fa3f2,_0x4cd8b7[0x0],_0x3f9c24);}else{_0x1600e3=_0x3f9c24;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x12fa7e===_0xc1f8('0x86')){_0x5b056d=_0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x87')];_0x47694c=_0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x88')];if(_0xc1f8('0x24')!=typeof _0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x82')]){if(_0xc1f8('0x24')!=typeof _0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x82')][_0xc1f8('0x90')]){var _0x3669c7=_0x32e62f[_0xc1f8('0x7f')]['views'][_0xc1f8('0x90')];if(!/^(f|ht)tps?:\/\//i[_0xc1f8('0x93')](_0x3669c7)){_0x1b5597=path[_0xc1f8('0x53')](_0xc1f8('0x91'),_0x1fa3f2,_0x4cd8b7[0x0],_0x3669c7);}else{_0x1b5597=_0x3669c7;}}if('undefined'!=typeof _0x32e62f[_0xc1f8('0x7f')]['views'][_0xc1f8('0x84')]){var _0x3f9c24=_0x32e62f[_0xc1f8('0x7f')][_0xc1f8('0x82')][_0xc1f8('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xc1f8('0x93')](_0x3f9c24)){_0x1600e3=path[_0xc1f8('0x53')](_0xc1f8('0x91'),_0x1fa3f2,_0x4cd8b7[0x0],_0x3f9c24);}else{_0x1600e3=_0x3f9c24;}}}}var _0x56fd13={'name':_0x105bd7,'description':_0x1780f7,'path':path[_0xc1f8('0x53')](_0x1fa3f2,_0x4cd8b7[0x0]),'type':_0x12fa7e,'sidebar':_0x2224f4,'icon':_0x479443,'adminUrl':_0x1b5597,'agentUrl':_0x1600e3,'scriptName':_0x5b056d,'scriptPath':_0x47694c,'version':_0x6babd9};removeReferences(_0x528766,null);return db['Plugin']['create'](_0x56fd13)[_0xc1f8('0x2d')](function(_0x139f01){var _0x27823c={'role':_0x1d8a11[_0xc1f8('0x94')][_0xc1f8('0x95')],'userProfileId':_0x1d8a11['body'][_0xc1f8('0x96')]};if(!_0x27823c)throw new Error(_0xc1f8('0x97'));if(_0x27823c['role']==='user'){var _0x5988ed=_0x139f01[_0xc1f8('0x2f')]({'plain':!![]});return db[_0xc1f8('0x98')][_0xc1f8('0x52')]({'where':{'name':_0xc1f8('0x30'),'userProfileId':_0x27823c[_0xc1f8('0x96')]},'raw':!![]})[_0xc1f8('0x2d')](function(_0x574b0b){if(_0x574b0b&&_0x574b0b[_0xc1f8('0x99')]===0x0){return db[_0xc1f8('0x31')][_0xc1f8('0x9a')]({'name':_0x5988ed[_0xc1f8('0x32')],'resourceId':_0x5988ed['id'],'type':_0x574b0b[_0xc1f8('0x32')],'sectionId':_0x574b0b['id']},{})[_0xc1f8('0x2d')](function(){return _0x139f01;});}else{return _0x139f01;}})['catch'](function(_0x217ac8){logger[_0xc1f8('0x5d')](_0xc1f8('0x9b'),_0x217ac8);throw _0x217ac8;});}return _0x139f01;})[_0xc1f8('0x2d')](respondWithResult(_0x470036,null))[_0xc1f8('0x4f')](handleError(_0x470036,null));}});}catch(_0x4443fc){_0x470036[_0xc1f8('0x21')](0x1f4)['send'](_0x4443fc);}};function removeReferences(_0x2a9506,_0x227a9c){try{if(_0x2a9506){fs[_0xc1f8('0x67')](_0x2a9506);logger[_0xc1f8('0x68')](_0xc1f8('0x9c'));}if(_0x227a9c){rimraf(_0x227a9c,function(){});logger[_0xc1f8('0x68')](_0xc1f8('0x9d'));}}catch(_0x20592d){logger[_0xc1f8('0x5d')](_0x20592d);}}exports[_0xc1f8('0x2c')]=function(_0x4d1676,_0x265951,_0x4db0ff){return db[_0xc1f8('0x35')][_0xc1f8('0x52')]({'where':{'id':_0x4d1676[_0xc1f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x265951,null))[_0xc1f8('0x2d')](saveUpdates(_0x4d1676['body'],null))[_0xc1f8('0x2d')](respondWithResult(_0x265951,null))[_0xc1f8('0x4f')](handleError(_0x265951,null));};exports['delete']=function(_0x48f834,_0x478cdf,_0x299f84){return db['Plugin'][_0xc1f8('0x52')]({'where':{'id':_0x48f834[_0xc1f8('0x50')]['id']}})[_0xc1f8('0x2d')](function(_0xa8a203){if(_0xa8a203){return _0xa8a203[_0xc1f8('0x2e')]();}})['then'](function(_0x1ccd58){rimraf(path[_0xc1f8('0x53')](config[_0xc1f8('0x6f')],_0xc1f8('0x54'),path[_0xc1f8('0x9e')](_0x1ccd58['path'])),function(){});return _0x1ccd58;})['then'](handleEntityNotFound(_0x478cdf,null))[_0xc1f8('0x2d')](respondWithStatusCode(_0x478cdf,null))['catch'](handleError(_0x478cdf,null));};exports['webhookGet']=function(_0xa26132,_0x4b0c40,_0xb91637){return BPromise[_0xc1f8('0x9f')]()[_0xc1f8('0x2d')](function(){if(!_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0x8')]){throw new Error(_0xc1f8('0xa0'));}if(!_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x42fa2a=_0xa26132[_0xc1f8('0x3c')]['hostname']?_0xa26132['query'][_0xc1f8('0xa2')]+':'+_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0xa1')]:_0xc1f8('0xa3')+_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0xa1')];var _0x12bafd=_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0x28')]?_0xa26132['query'][_0xc1f8('0x28')]:!![];var _0x45a407=_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0xa4')]?_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0xa4')]:null;var _0x2e8740={'method':_0xa26132[_0xc1f8('0xa5')],'uri':util[_0xc1f8('0x55')](_0xc1f8('0xa6'),_0x42fa2a,_0xa26132['query'][_0xc1f8('0x8')]),'json':_0x12bafd,'resolveWithFullResponse':!![],'encoding':_0x45a407,'qs':_0xa26132['query']};if(_0xa26132[_0xc1f8('0xa7')]){_0x2e8740[_0xc1f8('0xa7')]=_0xa26132[_0xc1f8('0xa7')];if(_0x2e8740[_0xc1f8('0xa7')][_0xc1f8('0xa8')]){delete _0x2e8740[_0xc1f8('0xa7')][_0xc1f8('0xa8')];}}if(_0x2e8740[_0xc1f8('0xa7')][_0xc1f8('0xa9')]){delete _0x2e8740[_0xc1f8('0xa7')]['content-type'];}return rp(_0x2e8740);})[_0xc1f8('0x2d')](function(_0x559a92){if(_0x559a92){_0x4b0c40['set'](_0x559a92['headers']);logger[_0xc1f8('0x68')](_0x559a92[_0xc1f8('0x94')]);if(_[_0xc1f8('0xaa')](_0xa26132[_0xc1f8('0x3c')][_0xc1f8('0x8')],'download')&&_0x559a92[_0xc1f8('0xab')]==0x1f4){return _0x4b0c40[_0xc1f8('0x20')](_0x559a92[_0xc1f8('0xab')]);}else{return _0x4b0c40['status'](_0x559a92[_0xc1f8('0xab')])[_0xc1f8('0xac')](_0x559a92[_0xc1f8('0x94')]);}}else{return _0x4b0c40[_0xc1f8('0x20')](0xc8);}})[_0xc1f8('0x4f')](handleError(_0x4b0c40,null));};exports['webhookPost']=function(_0x793fec,_0x4f8565,_0x4a932e){return BPromise['resolve']()[_0xc1f8('0x2d')](function(){if(!_0x793fec['query'][_0xc1f8('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x793fec[_0xc1f8('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x326c55=_0x793fec['query'][_0xc1f8('0xa2')]?_0x793fec['query'][_0xc1f8('0xa2')]+':'+_0x793fec['query'][_0xc1f8('0xa1')]:'http://localhost:'+_0x793fec[_0xc1f8('0x3c')][_0xc1f8('0xa1')];var _0xc10222=_0x793fec['query'][_0xc1f8('0x28')]?_0x793fec[_0xc1f8('0x3c')]['json']:!![];var _0x20edbb=_0x793fec[_0xc1f8('0x3c')][_0xc1f8('0xa4')]?_0x793fec[_0xc1f8('0x3c')]['encoding']:null;var _0x55ce5b={'method':_0x793fec[_0xc1f8('0xa5')],'uri':util['format']('%s%s',_0x326c55,_0x793fec[_0xc1f8('0x3c')]['path']),'json':_0xc10222,'resolveWithFullResponse':!![],'encoding':_0x20edbb,'body':_0x793fec[_0xc1f8('0x94')]};if(_0x793fec[_0xc1f8('0xa7')]){_0x55ce5b['headers']=_0x793fec[_0xc1f8('0xa7')];if(_0x55ce5b['headers'][_0xc1f8('0xa8')]){delete _0x55ce5b[_0xc1f8('0xa7')][_0xc1f8('0xa8')];}}if(_0x55ce5b['headers']['content-type']){delete _0x55ce5b[_0xc1f8('0xa7')]['content-type'];}return rp(_0x55ce5b);})[_0xc1f8('0x2d')](function(_0xd87957){if(_0xd87957){_0x4f8565['set'](_0xd87957[_0xc1f8('0xa7')]);logger[_0xc1f8('0x68')](_0xd87957[_0xc1f8('0x94')]);return _0x4f8565[_0xc1f8('0x21')](_0xd87957[_0xc1f8('0xab')])[_0xc1f8('0xac')](_0xd87957[_0xc1f8('0x94')]);}else{return _0x4f8565[_0xc1f8('0x20')](0xc8);}})[_0xc1f8('0x4f')](handleError(_0x4f8565,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index efb6431..a8cc289 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 _0x6455=['exports','events','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1e1937,_0x594a86){var _0x55a29f=function(_0x9c9307){while(--_0x9c9307){_0x1e1937['push'](_0x1e1937['shift']());}};_0x55a29f(++_0x594a86);}(_0x6455,0x97));var _0x5645=function(_0x152508,_0x51e42a){_0x152508=_0x152508-0x0;var _0x49ab27=_0x6455[_0x152508];return _0x49ab27;};'use strict';var EventEmitter=require(_0x5645('0x0'));var Plugin=require('../../mysqldb')['db'][_0x5645('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x5645('0x2')](0x0);var events={'afterCreate':_0x5645('0x3'),'afterUpdate':_0x5645('0x4'),'afterDestroy':_0x5645('0x5')};function emitEvent(_0x35c21e){return function(_0x5388ff,_0x233875,_0x29cefe){PluginEvents[_0x5645('0x6')](_0x35c21e+':'+_0x5388ff['id'],_0x5388ff);PluginEvents[_0x5645('0x6')](_0x35c21e,_0x5388ff);_0x29cefe(null);};}for(var e in events){if(events[_0x5645('0x7')](e)){var event=events[e];Plugin[_0x5645('0x8')](e,emitEvent(event));}}module[_0x5645('0x9')]=PluginEvents; \ No newline at end of file +var _0x64f5=['remove','emit','hasOwnProperty','exports','events','save'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x64f5,0x17e));var _0x564f=function(_0x36747d,_0x476bd5){_0x36747d=_0x36747d-0x0;var _0x2c38ef=_0x64f5[_0x36747d];return _0x2c38ef;};'use strict';var EventEmitter=require(_0x564f('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x564f('0x1'),'afterUpdate':'update','afterDestroy':_0x564f('0x2')};function emitEvent(_0x1594b5){return function(_0x59c424,_0x2607d6,_0x23328d){PluginEvents[_0x564f('0x3')](_0x1594b5+':'+_0x59c424['id'],_0x59c424);PluginEvents[_0x564f('0x3')](_0x1594b5,_0x59c424);_0x23328d(null);};}for(var e in events){if(events[_0x564f('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x564f('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index cd7aa60..8aa3492 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 _0x45fd=['exports','define','Plugin','plugins','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x45fd,0xa4));var _0xd45f=function(_0x4e14ea,_0x596bdf){_0x4e14ea=_0x4e14ea-0x0;var _0x468a6c=_0x45fd[_0x4e14ea];return _0x468a6c;};'use strict';var _=require('lodash');var util=require(_0xd45f('0x0'));var logger=require(_0xd45f('0x1'))('api');var moment=require(_0xd45f('0x2'));var BPromise=require('bluebird');var rp=require(_0xd45f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd45f('0x4'));var config=require(_0xd45f('0x5'));var attributes=require('./plugin.attributes');module[_0xd45f('0x6')]=function(_0x2e762a,_0x474cdb){return _0x2e762a[_0xd45f('0x7')](_0xd45f('0x8'),attributes,{'tableName':_0xd45f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2538=['request-promise','path','rimraf','../../config/environment','define','Plugin','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x285484,_0x93cd92){var _0xa29d5b=function(_0x362512){while(--_0x362512){_0x285484['push'](_0x285484['shift']());}};_0xa29d5b(++_0x93cd92);}(_0x2538,0x19e));var _0x8253=function(_0x38e5ee,_0x3cd0cb){_0x38e5ee=_0x38e5ee-0x0;var _0x85812d=_0x2538[_0x38e5ee];return _0x85812d;};'use strict';var _=require(_0x8253('0x0'));var util=require(_0x8253('0x1'));var logger=require(_0x8253('0x2'))(_0x8253('0x3'));var moment=require(_0x8253('0x4'));var BPromise=require(_0x8253('0x5'));var rp=require(_0x8253('0x6'));var fs=require('fs');var path=require(_0x8253('0x7'));var rimraf=require(_0x8253('0x8'));var config=require(_0x8253('0x9'));var attributes=require('./plugin.attributes');module['exports']=function(_0x3f92d9,_0x5e4ff8){return _0x3f92d9[_0x8253('0xa')](_0x8253('0xb'),attributes,{'tableName':'plugins','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 ddfeb68..86ecbfc 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 _0x22d7=['debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0x22d7,0x158));var _0x722d=function(_0x43c223,_0x2d61d9){_0x43c223=_0x43c223-0x0;var _0x2299a7=_0x22d7[_0x43c223];return _0x2299a7;};'use strict';var _=require(_0x722d('0x0'));var util=require('util');var moment=require(_0x722d('0x1'));var BPromise=require(_0x722d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x722d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x722d('0x4'));var config=require(_0x722d('0x5'));var jayson=require(_0x722d('0x6'));var client=jayson[_0x722d('0x7')][_0x722d('0x8')]({'port':0x232a});config[_0x722d('0x9')]=_[_0x722d('0xa')](config[_0x722d('0x9')],{'host':_0x722d('0xb'),'port':0x18eb});var socket=require(_0x722d('0xc'))(new Redis(config[_0x722d('0x9')]));require('./plugin.socket')[_0x722d('0xd')](socket);function respondWithRpcPromise(_0x1dec24,_0x5c9de6,_0x25fe7f){return new BPromise(function(_0x4757f3,_0x307a16){return client[_0x722d('0xe')](_0x1dec24,_0x25fe7f)[_0x722d('0xf')](function(_0x63fcdc){logger[_0x722d('0x10')](_0x722d('0x11'),_0x5c9de6,_0x722d('0x12'));logger[_0x722d('0x13')](_0x722d('0x14'),_0x5c9de6,'request\x20sent',JSON['stringify'](_0x63fcdc));if(_0x63fcdc[_0x722d('0x15')]){if(_0x63fcdc[_0x722d('0x15')][_0x722d('0x16')]===0x1f4){logger['error'](_0x722d('0x11'),_0x5c9de6,_0x63fcdc[_0x722d('0x15')][_0x722d('0x17')]);return _0x307a16(_0x63fcdc[_0x722d('0x15')][_0x722d('0x17')]);}logger[_0x722d('0x15')]('Plugin,\x20%s,\x20%s',_0x5c9de6,_0x63fcdc[_0x722d('0x15')][_0x722d('0x17')]);return _0x4757f3(_0x63fcdc['error'][_0x722d('0x17')]);}else{logger[_0x722d('0x10')](_0x722d('0x11'),_0x5c9de6,'request\x20sent');_0x4757f3(_0x63fcdc[_0x722d('0x18')][_0x722d('0x17')]);}})[_0x722d('0x19')](function(_0x3544d0){logger[_0x722d('0x15')](_0x722d('0x11'),_0x5c9de6,_0x3544d0);_0x307a16(_0x3544d0);});});}exports[_0x722d('0x1a')]=function(_0x38912f){var _0x23524e=this;return new Promise(function(_0x37d318,_0x1b51a2){return db[_0x722d('0x1b')][_0x722d('0x1c')](_0x38912f[_0x722d('0x1d')],{'raw':_0x38912f[_0x722d('0x1e')]?_0x38912f[_0x722d('0x1e')][_0x722d('0x1f')]===undefined?!![]:![]:!![]})[_0x722d('0xf')](function(_0x59a8ac){logger[_0x722d('0x10')](_0x722d('0x1a'),_0x38912f);logger['debug'](_0x722d('0x1a'),_0x38912f,JSON[_0x722d('0x20')](_0x59a8ac));_0x37d318(_0x59a8ac);})[_0x722d('0x19')](function(_0x509bac){logger[_0x722d('0x15')](_0x722d('0x1a'),_0x509bac[_0x722d('0x17')],_0x38912f);_0x1b51a2(_0x23524e['error'](0x1f4,_0x509bac[_0x722d('0x17')]));});});}; \ No newline at end of file +var _0x8054=['Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x8054,0x141));var _0x4805=function(_0x31e1c0,_0x480224){_0x31e1c0=_0x31e1c0-0x0;var _0x3aece6=_0x8054[_0x31e1c0];return _0x3aece6;};'use strict';var _=require(_0x4805('0x0'));var util=require(_0x4805('0x1'));var moment=require(_0x4805('0x2'));var BPromise=require(_0x4805('0x3'));var rs=require(_0x4805('0x4'));var fs=require('fs');var Redis=require(_0x4805('0x5'));var db=require(_0x4805('0x6'))['db'];var utils=require(_0x4805('0x7'));var logger=require(_0x4805('0x8'))(_0x4805('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4805('0xa')]({'port':0x232a});config[_0x4805('0xb')]=_['defaults'](config['redis'],{'host':_0x4805('0xc'),'port':0x18eb});var socket=require(_0x4805('0xd'))(new Redis(config[_0x4805('0xb')]));require(_0x4805('0xe'))[_0x4805('0xf')](socket);function respondWithRpcPromise(_0x22c392,_0x58c5a4,_0x12d00f){return new BPromise(function(_0x1ef36f,_0x7d9332){return client[_0x4805('0x10')](_0x22c392,_0x12d00f)[_0x4805('0x11')](function(_0x5c475b){logger[_0x4805('0x12')](_0x4805('0x13'),_0x58c5a4,_0x4805('0x14'));logger[_0x4805('0x15')](_0x4805('0x16'),_0x58c5a4,_0x4805('0x14'),JSON[_0x4805('0x17')](_0x5c475b));if(_0x5c475b['error']){if(_0x5c475b[_0x4805('0x18')][_0x4805('0x19')]===0x1f4){logger['error'](_0x4805('0x13'),_0x58c5a4,_0x5c475b['error']['message']);return _0x7d9332(_0x5c475b[_0x4805('0x18')]['message']);}logger['error'](_0x4805('0x13'),_0x58c5a4,_0x5c475b[_0x4805('0x18')]['message']);return _0x1ef36f(_0x5c475b[_0x4805('0x18')][_0x4805('0x1a')]);}else{logger[_0x4805('0x12')](_0x4805('0x13'),_0x58c5a4,_0x4805('0x14'));_0x1ef36f(_0x5c475b[_0x4805('0x1b')]['message']);}})[_0x4805('0x1c')](function(_0x260daf){logger[_0x4805('0x18')]('Plugin,\x20%s,\x20%s',_0x58c5a4,_0x260daf);_0x7d9332(_0x260daf);});});}exports[_0x4805('0x1d')]=function(_0x903fb){var _0x16571a=this;return new Promise(function(_0x4309e5,_0x33709b){return db[_0x4805('0x1e')][_0x4805('0x1f')](_0x903fb['body'],{'raw':_0x903fb['options']?_0x903fb[_0x4805('0x20')][_0x4805('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x39220b){logger['info']('CreatePlugin',_0x903fb);logger[_0x4805('0x15')](_0x4805('0x1d'),_0x903fb,JSON[_0x4805('0x17')](_0x39220b));_0x4309e5(_0x39220b);})['catch'](function(_0x52de54){logger[_0x4805('0x18')](_0x4805('0x1d'),_0x52de54[_0x4805('0x1a')],_0x903fb);_0x33709b(_0x16571a['error'](0x1f4,_0x52de54[_0x4805('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2e8bb6f..3fa9bb3 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 _0xa0e0=['update','emit','removeListener','length','plugin:','./plugin.events','save','remove'];(function(_0x2c30dc,_0x4800ce){var _0x47ce7d=function(_0x21ecca){while(--_0x21ecca){_0x2c30dc['push'](_0x2c30dc['shift']());}};_0x47ce7d(++_0x4800ce);}(_0xa0e0,0x1d5));var _0x0a0e=function(_0x2b3ddc,_0x24cd5b){_0x2b3ddc=_0x2b3ddc-0x0;var _0x55f672=_0xa0e0[_0x2b3ddc];return _0x55f672;};'use strict';var PluginEvents=require(_0x0a0e('0x0'));var events=[_0x0a0e('0x1'),_0x0a0e('0x2'),_0x0a0e('0x3')];function createListener(_0x4533e0,_0x54e863){return function(_0xfb27e7){_0x54e863[_0x0a0e('0x4')](_0x4533e0,_0xfb27e7);};}function removeListener(_0x518af4,_0x5f4742){return function(){PluginEvents[_0x0a0e('0x5')](_0x518af4,_0x5f4742);};}exports['register']=function(_0x12c5e4){for(var _0x457158=0x0,_0x3dd4ce=events[_0x0a0e('0x6')];_0x457158<_0x3dd4ce;_0x457158++){var _0x3086e2=events[_0x457158];var _0x46cbd5=createListener(_0x0a0e('0x7')+_0x3086e2,_0x12c5e4);PluginEvents['on'](_0x3086e2,_0x46cbd5);}}; \ No newline at end of file +var _0xa581=['removeListener','register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x1d14f4,_0x3cb1bf){var _0x2f1d49=function(_0x5d7ab8){while(--_0x5d7ab8){_0x1d14f4['push'](_0x1d14f4['shift']());}};_0x2f1d49(++_0x3cb1bf);}(_0xa581,0x9b));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require(_0x1a58('0x0'));var events=[_0x1a58('0x1'),_0x1a58('0x2'),_0x1a58('0x3')];function createListener(_0x57f7f3,_0x1387eb){return function(_0x2ca560){_0x1387eb[_0x1a58('0x4')](_0x57f7f3,_0x2ca560);};}function removeListener(_0x54dc57,_0xfaa125){return function(){PluginEvents[_0x1a58('0x5')](_0x54dc57,_0xfaa125);};}exports[_0x1a58('0x6')]=function(_0x5add8d){for(var _0x28cfe9=0x0,_0xc9b9=events['length'];_0x28cfe9<_0xc9b9;_0x28cfe9++){var _0x5bb462=events[_0x28cfe9];var _0x245e9d=createListener(_0x1a58('0x7')+_0x5bb462,_0x5add8d);PluginEvents['on'](_0x5bb462,_0x245e9d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index cac07b0..d26441b 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(_0x827cc1,_0x2bb68b){var _0x22d273=function(_0x2b93c3){while(--_0x2b93c3){_0x827cc1['push'](_0x827cc1['shift']());}};_0x22d273(++_0x2bb68b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x379e8f,_0x308f31){var _0x187241=function(_0x293539){while(--_0x293539){_0x379e8f['push'](_0x379e8f['shift']());}};_0x187241(++_0x308f31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 4ffdafc..7cb0268 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 _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x3ede90,_0xbb015f){var _0x3a34ef=function(_0x2025b0){while(--_0x2025b0){_0x3ede90['push'](_0x3ede90['shift']());}};_0x3a34ef(++_0xbb015f);}(_0x2750,0x13b));var _0x0275=function(_0x472dfd,_0x207c94){_0x472dfd=_0x472dfd-0x0;var _0x7f80a8=_0x2750[_0x472dfd];return _0x7f80a8;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xd2ea=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x5210f9,_0x3f5281){var _0x4d4154=function(_0x1c5619){while(--_0x1c5619){_0x5210f9['push'](_0x5210f9['shift']());}};_0x4d4154(++_0x3f5281);}(_0xd2ea,0x15f));var _0xad2e=function(_0x4ada64,_0x30cda){_0x4ada64=_0x4ada64-0x0;var _0x4ae6d3=_0xd2ea[_0x4ada64];return _0x4ae6d3;};'use strict';var _=require(_0xad2e('0x0'));var pm2=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var path=require(_0xad2e('0x4'));var exec=require('child_process')[_0xad2e('0x5')];var BPromise=require(_0xad2e('0x6'));function handleEntityNotFound(_0xcba7cb,_0x3e0741){return function(_0x2afdc4){if(!_0x2afdc4){_0xcba7cb[_0xad2e('0x7')](0x194);;}return _0x2afdc4;};}function respondWithResult(_0x29e97f,_0x592e8b){_0x592e8b=_0x592e8b||0xc8;return function(_0x3b5170){if(_0x3b5170){return _0x29e97f[_0xad2e('0x8')](_0x592e8b)[_0xad2e('0x9')](_0x3b5170);}return null;};}function handleError(_0x5710ac,_0x1e0e9e){_0x1e0e9e=_0x1e0e9e||0x1f4;return function(_0x19bb0d){logger['error'](_0x19bb0d[_0xad2e('0xa')]);if(_0x19bb0d['name']){delete _0x19bb0d[_0xad2e('0xb')];}_0x5710ac[_0xad2e('0x8')](_0x1e0e9e)[_0xad2e('0xc')](_0x19bb0d);};}function execChildProcess(){return new BPromise(function(_0x24c5da,_0x489f25){exec(_0xad2e('0xd'),function(_0x5707a5,_0x42d2ac,_0x347559){logger[_0xad2e('0xe')](_0x42d2ac);logger[_0xad2e('0xe')](_0x347559);if(_0x5707a5){logger['error'](_0x5707a5);return _0x489f25(_0x5707a5);}return _0x24c5da(_0x42d2ac);});});}exports[_0xad2e('0xf')]=function(_0x59201f,_0x1a91ce){return pm2['list']()['then'](function(_0x4a812b){if(_0x4a812b){var _0x5c96a7=_[_0xad2e('0x10')](_0x4a812b,function(_0x282780){return _0x282780[_0xad2e('0xb')]===_0xad2e('0x11')||_0x282780[_0xad2e('0xb')]===_0xad2e('0x12');});return{'rows':_0x5c96a7,'count':_0x5c96a7[_0xad2e('0x13')]};}return null;})[_0xad2e('0x14')](respondWithResult(_0x1a91ce,null))[_0xad2e('0x15')](handleError(_0x1a91ce,null));};exports[_0xad2e('0x16')]=function(_0x2af208,_0x39c5e4){return pm2[_0xad2e('0x17')](_0x2af208[_0xad2e('0x18')]['id'])[_0xad2e('0x14')](respondWithResult(_0x39c5e4,null))['then'](handleEntityNotFound(_0x39c5e4,null))[_0xad2e('0x15')](handleError(_0x39c5e4,null));};exports[_0xad2e('0x19')]=function(_0x489585,_0x50eb1a){if(_0x489585['body']['name']&&_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]){var _0x5549db=path[_0xad2e('0x1c')](__dirname,_0xad2e('0x1d'),_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]);var _0x23c0b6=process[_0xad2e('0x1e')]();process[_0xad2e('0x1f')](path[_0xad2e('0x20')](_0x5549db));return execChildProcess()[_0xad2e('0x14')](function(_0xd907a9){process[_0xad2e('0x1f')](_0x23c0b6);return pm2[_0xad2e('0x21')]({'name':_0x489585[_0xad2e('0x1a')]['name'],'script':_0x5549db});})[_0xad2e('0x14')](function(_0x2e8887){pm2[_0xad2e('0x22')]();return _0x2e8887[0x0];})[_0xad2e('0x14')](respondWithResult(_0x50eb1a,0xc9))[_0xad2e('0x15')](handleError(_0x50eb1a,null));}else{return _0x50eb1a[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x23')});}};exports[_0xad2e('0x24')]=function(_0x50d446,_0x356a19){if(_0x50d446['body']['id']){delete _0x50d446[_0xad2e('0x1a')]['id'];}var _0x28ef72={'online':_0xad2e('0x25'),'stopped':_0xad2e('0x26')};if(_0x28ef72[_0xad2e('0x27')](_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')])){return pm2[_0x28ef72[_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')]]](_0x50d446[_0xad2e('0x18')]['id'])['then'](respondWithResult(_0x356a19,0xc8))[_0xad2e('0x15')](handleError(_0x356a19,null));}else{return _0x356a19[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x28')});}};exports[_0xad2e('0x29')]=function(_0x9b4a23,_0x409f58){if(_0x9b4a23[_0xad2e('0x1a')]['id']){delete _0x9b4a23[_0xad2e('0x1a')]['id'];}if(_0x9b4a23[_0xad2e('0x18')]['id']){return pm2[_0xad2e('0x2a')](_0x9b4a23['params']['id'])[_0xad2e('0x14')](function(_0x55e1dc){pm2[_0xad2e('0x22')]();return _0x55e1dc[0x0];})[_0xad2e('0x14')](respondWithResult(_0x409f58,null))[_0xad2e('0x15')](handleError(_0x409f58,null));}else{return _0x409f58[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e00e053..89a18b0 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 _0x8a0c=['Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','getQueues','exports','express'];(function(_0x2d4f4b,_0x4cb227){var _0x48c35d=function(_0x43e6ab){while(--_0x43e6ab){_0x2d4f4b['push'](_0x2d4f4b['shift']());}};_0x48c35d(++_0x4cb227);}(_0x8a0c,0x1ac));var _0xc8a0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8a0c[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0xc8a0('0x0'));var router=express[_0xc8a0('0x1')]();var auth=require(_0xc8a0('0x2'));var controller=require(_0xc8a0('0x3'));router[_0xc8a0('0x4')](_0xc8a0('0x5'),auth['isAuthenticated'](),controller[_0xc8a0('0x6')]);router[_0xc8a0('0x4')](_0xc8a0('0x7'),auth[_0xc8a0('0x8')](),controller[_0xc8a0('0x9')]);module[_0xc8a0('0xa')]=router; \ No newline at end of file +var _0x6332=['isAuthenticated','getAgents','get','/queues','getQueues','exports','express','Router','/agents'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x6332,0x10b));var _0x2633=function(_0x13d43f,_0x29533b){_0x13d43f=_0x13d43f-0x0;var _0x776929=_0x6332[_0x13d43f];return _0x776929;};'use strict';var express=require(_0x2633('0x0'));var router=express[_0x2633('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router['get'](_0x2633('0x2'),auth[_0x2633('0x3')](),controller[_0x2633('0x4')]);router[_0x2633('0x5')](_0x2633('0x6'),auth[_0x2633('0x3')](),controller[_0x2633('0x7')]);module[_0x2633('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 9423719..7d6390b 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 _0xc66f=['isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','type','agent','push','literal','FIELD(id,','forEach','Pause','where','merge','user','role','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','pick','catch','getQueues','toLowerCase','startCase','Queue','key','name','outbound','dialActive','dialMethod','getOptions','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then'];(function(_0x5ee81a,_0xa9594){var _0x45fc94=function(_0x58ce35){while(--_0x58ce35){_0x5ee81a['push'](_0x5ee81a['shift']());}};_0x45fc94(++_0xa9594);}(_0xc66f,0x96));var _0xfc66=function(_0x75a7d,_0x4f22ac){_0x75a7d=_0x75a7d-0x0;var _0xd209cf=_0xc66f[_0x75a7d];return _0xd209cf;};'use strict';var _=require('lodash');var util=require(_0xfc66('0x0'));var rta=require(_0xfc66('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0xfc66('0x2'));var utils=require(_0xfc66('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xfc66('0x4'))[_0xfc66('0x5')];var APIHandleError=require(_0xfc66('0x4'))[_0xfc66('0x6')];function respondWithFilteredResult(_0x283931,_0x3aedc7){return function(_0x4045d3){if(_0x4045d3){var _0x48a52a=typeof _0x3aedc7[_0xfc66('0x7')]===_0xfc66('0x8')&&typeof _0x3aedc7['limit']===_0xfc66('0x8');var _0x2dc7e4=_0x4045d3['count'];var _0x4d4341=_0x48a52a?0x0:_0x3aedc7[_0xfc66('0x7')];var _0x3cb5d4=_0x48a52a?_0x4045d3[_0xfc66('0x9')]:_0x3aedc7[_0xfc66('0x7')]+_0x3aedc7[_0xfc66('0xa')];var _0x97b2bf;if(_0x3cb5d4>=_0x2dc7e4){_0x3cb5d4=_0x2dc7e4;_0x97b2bf=0xc8;}else{_0x97b2bf=0xce;}_0x283931[_0xfc66('0xb')](_0x97b2bf);return _0x283931[_0xfc66('0xc')](_0xfc66('0xd'),_0x4d4341+'-'+_0x3cb5d4+'/'+_0x2dc7e4)[_0xfc66('0xe')](_0x4045d3);}return null;};}exports[_0xfc66('0xf')]=function(_0x169487,_0x33d7bc){var _0x4796a7={'count':0x0,'rows':[]};var _0x2329d2={};var _0x21f2bc;var _0x5ab1bf=utils['getChannels']();var _0x28616d;var _0x18f0c3;var _0x210105=_0x169487[_0xfc66('0x10')][_0xfc66('0x11')];var _0xd40e7a=_0x169487[_0xfc66('0x10')][_0xfc66('0x12')];var _0x555af8=_0x169487[_0xfc66('0x10')][_0xfc66('0x13')];var _0x314726=_0xd40e7a===_0xfc66('0x14')||_0xd40e7a===_0xfc66('0x15')?!![]:![];var _0x529db8=[];var _0x29b45a;var _0x337191;Promise[_0xfc66('0x16')]()[_0xfc66('0x17')](function(){if(_0x169487[_0xfc66('0x10')]['channel']){if(!utils[_0xfc66('0x18')](_0x169487['query']['channel'])){throw new APIBadRequestError(util['format'](_0xfc66('0x19'),_0x169487['query'][_0xfc66('0x1a')]));}_0x21f2bc=_0x169487[_0xfc66('0x10')][_0xfc66('0x1a')]['toLowerCase']();}if(!_0x169487['query']['sort']||!_0x169487[_0xfc66('0x10')][_0xfc66('0x1b')][_0xfc66('0x1c')](_0xfc66('0x1d'))){_0x169487[_0xfc66('0x10')]['sort']=rta[_0xfc66('0x1e')](_0x169487['query'][_0xfc66('0x1b')]);return;}var _0x5dc15a=rta[_0xfc66('0x1f')](_0x169487[_0xfc66('0x10')][_0xfc66('0x1b')]);_0x169487[_0xfc66('0x10')][_0xfc66('0x1b')]=_0x5dc15a[_0xfc66('0x20')][_0xfc66('0x21')](',');_0x29b45a=_0x5dc15a[_0xfc66('0x22')];})['then'](function(){if(!_0x210105){return[];}return rta[_0xfc66('0x23')](_0x210105,_0x21f2bc);})[_0xfc66('0x17')](function(_0x4757bb){_0x529db8=_0x4757bb;return rta[_0xfc66('0x24')]();})['then'](function(_0x139d09){_0x18f0c3=_0x139d09[_0xfc66('0x25')];if((!_0xd40e7a||_0x314726)&&!_0x29b45a){return _0x529db8;}if(_0x29b45a&&!_0xd40e7a){return rta[_0xfc66('0x26')](_0x18f0c3,_0x529db8,_0x29b45a);}else{return rta[_0xfc66('0x27')](_0x18f0c3,_0x529db8,_0xd40e7a);}})[_0xfc66('0x17')](function(_0x47c911){_0x529db8=_0x47c911;var _0x3fbe9d=![];if(_0x529db8[_0xfc66('0x28')]===0x0){if(_0x210105||_0xd40e7a){_0x3fbe9d=!![];}if(_0x314726){_0x3fbe9d=![];}}if(_0x3fbe9d){return _0x4796a7;}var _0x5bae50=_[_0xfc66('0x29')](db['User'][_0xfc66('0x2a')],function(_0x4ad792){return{'name':_0x4ad792[_0xfc66('0x2b')],'type':_0x4ad792[_0xfc66('0x2c')]['key']};});_0x169487[_0xfc66('0x10')]['role']=_0xfc66('0x2d');_0x2329d2=qs['getOptions'](_0x5bae50,_0x169487);_0x2329d2['raw']=!![];var _0x712db5=[];if(_0x529db8['length']>0x0){_0x712db5[_0xfc66('0x2e')]({'id':{'$in':_0x529db8}});if(_0x29b45a&&!_0xd40e7a){_0x337191=[db['sequelize'][_0xfc66('0x2f')](_0xfc66('0x30')+_0x529db8+')')];_0x2329d2[_0xfc66('0x22')]=_0x337191;}}if(_0x314726){_0x5ab1bf[_0xfc66('0x31')](function(_0x2d2863){var _0x46c8cf=!![];if(_0xd40e7a===_0xfc66('0x15')&&_0x21f2bc!==_0x2d2863){_0x46c8cf=![];}_0x712db5['push']({[_0x2d2863+_0xfc66('0x32')]:_0x46c8cf});});if(_0x555af8){_0x712db5[_0xfc66('0x2e')]({'pauseType':_0x555af8});}}else if(_0xd40e7a){_0x5ab1bf[_0xfc66('0x31')](function(_0x33aab7){_0x712db5[_0xfc66('0x2e')]({[_0x33aab7+'Pause']:![]});});}_0x2329d2[_0xfc66('0x33')]=_[_0xfc66('0x34')](_0x2329d2['where'],{'$and':_0x712db5});if(_0x169487[_0xfc66('0x35')][_0xfc66('0x36')]===_0xfc66('0x35')){var _0x42e6af={'params':{'id':_0x169487[_0xfc66('0x35')][_0xfc66('0x37')]},'query':{'section':_0xfc66('0x38'),'role':'agent','raw':!![],'ids':_0x529db8,'customSorting':_0x337191}};if(_0x169487[_0xfc66('0x10')]['online']){_0x42e6af['query'][_0xfc66('0x39')]=!![];}if(_0x314726){_0x42e6af[_0xfc66('0x10')][_0xfc66('0x3a')]=_0x712db5;}_0x42e6af[_0xfc66('0x10')]=Object[_0xfc66('0x3b')](_0x42e6af[_0xfc66('0x10')],_0x169487['query']);return db[_0xfc66('0x3c')][_0xfc66('0x3d')](_0x42e6af);}return db['User']['findAndCountAll'](_0x2329d2);})[_0xfc66('0x17')](function(_0x78408f){_0x4796a7['count']=_0x78408f['count'];_0x28616d=_0x78408f[_0xfc66('0x25')];return _0x28616d[_0xfc66('0x29')](function(_0x31b3a6){var _0x5e7620=_[_0xfc66('0x3e')](_0x18f0c3,['id',_0x31b3a6['id']]);if(_0x5e7620){var _0x58504b=rta[_0xfc66('0x3f')](_0x5e7620);_[_0xfc66('0x34')](_0x31b3a6,_0x58504b);}_0x31b3a6[_0xfc66('0x1d')]=rta[_0xfc66('0x40')](_0x31b3a6);if(_0x31b3a6[_0xfc66('0x1d')][_0xfc66('0x1c')]('pause')){_0x5ab1bf[_0xfc66('0x31')](function(_0xacf6cd){if(_0x31b3a6[_0xacf6cd+'Pause']){if(_0xacf6cd===_0xfc66('0x41')){if(_0x31b3a6[_0xfc66('0x42')]!==_0xfc66('0x43')){_0x31b3a6[_0xfc66('0x42')]=_0xfc66('0x14');}}else{_0x31b3a6[_0xacf6cd+_0xfc66('0x44')]=_0xfc66('0x14');}}});}return _0x31b3a6;});})[_0xfc66('0x17')](function(_0x55be17){if(!_0x29b45a||_0x337191){return _0x55be17;}return rta['sortAgentsByStatus'](_0x55be17,_0x29b45a);})[_0xfc66('0x17')](function(_0x19b51a){var _0x446cae=rta[_0xfc66('0x45')]();_0x4796a7['rows']=_0x19b51a['map'](function(_0x1ec15a){return _[_0xfc66('0x46')](_0x1ec15a,_0x446cae);});return _0x4796a7;})['then'](respondWithFilteredResult(_0x33d7bc,_0x2329d2))[_0xfc66('0x47')](APIHandleError(_0x33d7bc));};exports[_0xfc66('0x48')]=function(_0x3ad6f0,_0x28c70b){var _0x26ec00={'count':0x0,'rows':[]};var _0x3c454e={};var _0x10308c;var _0xb76aa5;var _0xf9a602;Promise[_0xfc66('0x16')]()['then'](function(){if(_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x1a')]){if(!utils[_0xfc66('0x18')](_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x1a')])){throw new APIBadRequestError(util['format'](_0xfc66('0x19'),_0x3ad6f0[_0xfc66('0x10')]['channel']));}_0x10308c=_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x1a')][_0xfc66('0x49')]();}var _0x27db34=_[_0xfc66('0x4a')](_0x10308c)+_0xfc66('0x4b');var _0x17b41e=_['map'](db[_0x27db34][_0xfc66('0x2a')],function(_0x37ab66){return{'name':_0x37ab66[_0xfc66('0x2b')],'type':_0x37ab66[_0xfc66('0x2c')][_0xfc66('0x4c')]};});if(!_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x20')]){var _0x57b06a=['id',_0xfc66('0x4d')];if(_0x10308c===_0xfc66('0x41')){_0x57b06a[_0xfc66('0x2e')](_0xfc66('0x2c'));if(_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x2c')]===_0xfc66('0x4e')){_0x57b06a[_0xfc66('0x2e')]([_0xfc66('0x4f'),_0xfc66('0x50')]);}}_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x20')]=_0x57b06a[_0xfc66('0x21')](',');}_0x3c454e=qs[_0xfc66('0x51')](_0x17b41e,_0x3ad6f0);if(_0x3ad6f0['user']['role']===_0xfc66('0x35')){var _0x5a4f22={'params':{'id':_0x3ad6f0[_0xfc66('0x35')][_0xfc66('0x37')]},'query':{'section':_0x10308c==='voice'&&_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x2c')]===_0xfc66('0x4e')?_0xfc66('0x52'):_[_0xfc66('0x4a')](_0x10308c)+_0xfc66('0x53'),'type':_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x2c')],'nolimit':!![],'sort':_0xfc66('0x4d'),'filter':_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x54')]}};_0x5a4f22[_0xfc66('0x10')]=Object['assign'](_0x5a4f22[_0xfc66('0x10')],_0x3ad6f0[_0xfc66('0x10')]);delete _0x5a4f22[_0xfc66('0x10')]['id'];return db[_0xfc66('0x3c')][_0xfc66('0x3d')](_0x5a4f22);}return db[_0x27db34]['findAndCountAll'](_0x3c454e);})[_0xfc66('0x17')](function(_0x5b7281){_0x26ec00[_0xfc66('0x9')]=_0x5b7281['count'];_0xb76aa5=_0x5b7281['rows'];return rtq[_0xfc66('0x55')](_0x3ad6f0,_0x10308c);})[_0xfc66('0x17')](function(_0x41d21c){_0xf9a602=_0x41d21c[_0xfc66('0x25')];return rtq[_0xfc66('0x56')](_0xb76aa5,_0xf9a602,_0x10308c,_0x3ad6f0[_0xfc66('0x10')][_0xfc66('0x2c')]);})[_0xfc66('0x17')](function(_0x378ffb){_0x26ec00[_0xfc66('0x25')]=_0x378ffb;return _0x26ec00;})[_0xfc66('0x17')](respondWithFilteredResult(_0x28c70b,_0x3c454e))[_0xfc66('0x47')](APIHandleError(_0x28c70b));}; \ No newline at end of file +var _0xf77b=['userProfileId','online','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','rows','map','find','getAgentStatus','voice','voiceStatus','talking','Status','pause','pick','catch','getQueues','resolve','startCase','Queue','name','outbound','dialMethod','getOptions','QueueCampaigns','Queues','filter','assign','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','rawAttributes','fieldName','type','role','push','sequelize','literal','forEach','Pause','where','user'];(function(_0x623028,_0x5c3eb7){var _0x5ca7c6=function(_0x3f36cb){while(--_0x3f36cb){_0x623028['push'](_0x623028['shift']());}};_0x5ca7c6(++_0x5c3eb7);}(_0xf77b,0x174));var _0xbf77=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xf77b[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xbf77('0x0'));var util=require(_0xbf77('0x1'));var rta=require(_0xbf77('0x2'));var rtq=require(_0xbf77('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0xbf77('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xbf77('0x5'))[_0xbf77('0x6')];var APIHandleError=require('../../errors/api')[_0xbf77('0x7')];function respondWithFilteredResult(_0x3202b3,_0x10fe64){return function(_0x508def){if(_0x508def){var _0x52e4e0=typeof _0x10fe64[_0xbf77('0x8')]===_0xbf77('0x9')&&typeof _0x10fe64[_0xbf77('0xa')]===_0xbf77('0x9');var _0x45114d=_0x508def[_0xbf77('0xb')];var _0x37852f=_0x52e4e0?0x0:_0x10fe64[_0xbf77('0x8')];var _0x5b6d77=_0x52e4e0?_0x508def['count']:_0x10fe64[_0xbf77('0x8')]+_0x10fe64[_0xbf77('0xa')];var _0x16890f;if(_0x5b6d77>=_0x45114d){_0x5b6d77=_0x45114d;_0x16890f=0xc8;}else{_0x16890f=0xce;}_0x3202b3[_0xbf77('0xc')](_0x16890f);return _0x3202b3[_0xbf77('0xd')](_0xbf77('0xe'),_0x37852f+'-'+_0x5b6d77+'/'+_0x45114d)[_0xbf77('0xf')](_0x508def);}return null;};}exports[_0xbf77('0x10')]=function(_0x5db5ba,_0x304a1a){var _0x4f0662={'count':0x0,'rows':[]};var _0x30f3d3={};var _0xd2c4a3;var _0x5a328f=utils[_0xbf77('0x11')]();var _0x183ce0;var _0x17bf40;var _0x35f6f3=_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x13')];var _0x2b418c=_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x14')];var _0x2ff344=_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x15')];var _0x18d08f=_0x2b418c==='pause'||_0x2b418c===_0xbf77('0x16')?!![]:![];var _0x26c336=[];var _0x3bfcc0;var _0x4a9ad7;Promise['resolve']()[_0xbf77('0x17')](function(){if(_0x5db5ba[_0xbf77('0x12')]['channel']){if(!utils[_0xbf77('0x18')](_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x19')])){throw new APIBadRequestError(util[_0xbf77('0x1a')](_0xbf77('0x1b'),_0x5db5ba['query']['channel']));}_0xd2c4a3=_0x5db5ba[_0xbf77('0x12')]['channel'][_0xbf77('0x1c')]();}if(!_0x5db5ba[_0xbf77('0x12')]['sort']||!_0x5db5ba['query'][_0xbf77('0x1d')][_0xbf77('0x1e')](_0xbf77('0x1f'))){_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x1d')]=rta[_0xbf77('0x20')](_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x1d')]);return;}var _0x23f101=rta[_0xbf77('0x21')](_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x1d')]);_0x5db5ba['query'][_0xbf77('0x1d')]=_0x23f101[_0xbf77('0x22')][_0xbf77('0x23')](',');_0x3bfcc0=_0x23f101[_0xbf77('0x24')];})[_0xbf77('0x17')](function(){if(!_0x35f6f3){return[];}return rta[_0xbf77('0x25')](_0x35f6f3,_0xd2c4a3);})[_0xbf77('0x17')](function(_0x1f0dd2){_0x26c336=_0x1f0dd2;return rta[_0xbf77('0x26')]();})['then'](function(_0x34733d){_0x17bf40=_0x34733d['rows'];if((!_0x2b418c||_0x18d08f)&&!_0x3bfcc0){return _0x26c336;}if(_0x3bfcc0&&!_0x2b418c){return rta[_0xbf77('0x27')](_0x17bf40,_0x26c336,_0x3bfcc0);}else{return rta[_0xbf77('0x28')](_0x17bf40,_0x26c336,_0x2b418c);}})[_0xbf77('0x17')](function(_0x2df0b5){_0x26c336=_0x2df0b5;var _0x408a6b=![];if(_0x26c336[_0xbf77('0x29')]===0x0){if(_0x35f6f3||_0x2b418c){_0x408a6b=!![];}if(_0x18d08f){_0x408a6b=![];}}if(_0x408a6b){return _0x4f0662;}var _0x4d1203=_['map'](db['User'][_0xbf77('0x2a')],function(_0x3404a3){return{'name':_0x3404a3[_0xbf77('0x2b')],'type':_0x3404a3[_0xbf77('0x2c')]['key']};});_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x2d')]='agent';_0x30f3d3=qs['getOptions'](_0x4d1203,_0x5db5ba);_0x30f3d3['raw']=!![];var _0x365555=[];if(_0x26c336[_0xbf77('0x29')]>0x0){_0x365555[_0xbf77('0x2e')]({'id':{'$in':_0x26c336}});if(_0x3bfcc0&&!_0x2b418c){_0x4a9ad7=[db[_0xbf77('0x2f')][_0xbf77('0x30')]('FIELD(id,'+_0x26c336+')')];_0x30f3d3[_0xbf77('0x24')]=_0x4a9ad7;}}if(_0x18d08f){_0x5a328f[_0xbf77('0x31')](function(_0x551dc0){var _0x80fc5a=!![];if(_0x2b418c===_0xbf77('0x16')&&_0xd2c4a3!==_0x551dc0){_0x80fc5a=![];}_0x365555[_0xbf77('0x2e')]({[_0x551dc0+_0xbf77('0x32')]:_0x80fc5a});});if(_0x2ff344){_0x365555['push']({'pauseType':_0x2ff344});}}else if(_0x2b418c){_0x5a328f['forEach'](function(_0x15e3b8){_0x365555[_0xbf77('0x2e')]({[_0x15e3b8+'Pause']:![]});});}_0x30f3d3[_0xbf77('0x33')]=_['merge'](_0x30f3d3[_0xbf77('0x33')],{'$and':_0x365555});if(_0x5db5ba[_0xbf77('0x34')][_0xbf77('0x2d')]===_0xbf77('0x34')){var _0x149d75={'params':{'id':_0x5db5ba[_0xbf77('0x34')][_0xbf77('0x35')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x26c336,'customSorting':_0x4a9ad7}};if(_0x5db5ba[_0xbf77('0x12')][_0xbf77('0x36')]){_0x149d75[_0xbf77('0x12')]['online']=!![];}if(_0x18d08f){_0x149d75[_0xbf77('0x12')][_0xbf77('0x37')]=_0x365555;}_0x149d75['query']=Object['assign'](_0x149d75[_0xbf77('0x12')],_0x5db5ba['query']);return db[_0xbf77('0x38')][_0xbf77('0x39')](_0x149d75);}return db[_0xbf77('0x3a')][_0xbf77('0x3b')](_0x30f3d3);})['then'](function(_0x24313c){_0x4f0662[_0xbf77('0xb')]=_0x24313c['count'];_0x183ce0=_0x24313c[_0xbf77('0x3c')];return _0x183ce0[_0xbf77('0x3d')](function(_0x29af4e){var _0x5ee344=_[_0xbf77('0x3e')](_0x17bf40,['id',_0x29af4e['id']]);if(_0x5ee344){var _0x5a872c=rta['filterAgentAttributes'](_0x5ee344);_['merge'](_0x29af4e,_0x5a872c);}_0x29af4e[_0xbf77('0x1f')]=rta[_0xbf77('0x3f')](_0x29af4e);if(_0x29af4e[_0xbf77('0x1f')][_0xbf77('0x1e')]('pause')){_0x5a328f[_0xbf77('0x31')](function(_0x224aef){if(_0x29af4e[_0x224aef+_0xbf77('0x32')]){if(_0x224aef===_0xbf77('0x40')){if(_0x29af4e[_0xbf77('0x41')]!==_0xbf77('0x42')){_0x29af4e[_0xbf77('0x41')]='pause';}}else{_0x29af4e[_0x224aef+_0xbf77('0x43')]=_0xbf77('0x44');}}});}return _0x29af4e;});})[_0xbf77('0x17')](function(_0x4d5087){if(!_0x3bfcc0||_0x4a9ad7){return _0x4d5087;}return rta['sortAgentsByStatus'](_0x4d5087,_0x3bfcc0);})['then'](function(_0x575f10){var _0x4d1c1f=rta['getRealtimeAgentsQueryFields']();_0x4f0662[_0xbf77('0x3c')]=_0x575f10['map'](function(_0xe1df79){return _[_0xbf77('0x45')](_0xe1df79,_0x4d1c1f);});return _0x4f0662;})[_0xbf77('0x17')](respondWithFilteredResult(_0x304a1a,_0x30f3d3))[_0xbf77('0x46')](APIHandleError(_0x304a1a));};exports[_0xbf77('0x47')]=function(_0x4ce7d4,_0x41d1a4){var _0x80925={'count':0x0,'rows':[]};var _0x1d3327={};var _0x37ce98;var _0x77a439;var _0x22dc4c;Promise[_0xbf77('0x48')]()[_0xbf77('0x17')](function(){if(_0x4ce7d4[_0xbf77('0x12')][_0xbf77('0x19')]){if(!utils[_0xbf77('0x18')](_0x4ce7d4['query'][_0xbf77('0x19')])){throw new APIBadRequestError(util[_0xbf77('0x1a')](_0xbf77('0x1b'),_0x4ce7d4['query'][_0xbf77('0x19')]));}_0x37ce98=_0x4ce7d4[_0xbf77('0x12')][_0xbf77('0x19')]['toLowerCase']();}var _0x2edacd=_[_0xbf77('0x49')](_0x37ce98)+_0xbf77('0x4a');var _0x1bbbc0=_[_0xbf77('0x3d')](db[_0x2edacd][_0xbf77('0x2a')],function(_0x25e868){return{'name':_0x25e868['fieldName'],'type':_0x25e868[_0xbf77('0x2c')]['key']};});if(!_0x4ce7d4[_0xbf77('0x12')][_0xbf77('0x22')]){var _0x1a091e=['id',_0xbf77('0x4b')];if(_0x37ce98===_0xbf77('0x40')){_0x1a091e[_0xbf77('0x2e')]('type');if(_0x4ce7d4[_0xbf77('0x12')][_0xbf77('0x2c')]===_0xbf77('0x4c')){_0x1a091e[_0xbf77('0x2e')](['dialActive',_0xbf77('0x4d')]);}}_0x4ce7d4[_0xbf77('0x12')][_0xbf77('0x22')]=_0x1a091e['join'](',');}_0x1d3327=qs[_0xbf77('0x4e')](_0x1bbbc0,_0x4ce7d4);if(_0x4ce7d4[_0xbf77('0x34')][_0xbf77('0x2d')]===_0xbf77('0x34')){var _0x477431={'params':{'id':_0x4ce7d4[_0xbf77('0x34')][_0xbf77('0x35')]},'query':{'section':_0x37ce98==='voice'&&_0x4ce7d4[_0xbf77('0x12')]['type']===_0xbf77('0x4c')?_0xbf77('0x4f'):_[_0xbf77('0x49')](_0x37ce98)+_0xbf77('0x50'),'type':_0x4ce7d4[_0xbf77('0x12')][_0xbf77('0x2c')],'nolimit':!![],'sort':_0xbf77('0x4b'),'filter':_0x4ce7d4[_0xbf77('0x12')][_0xbf77('0x51')]}};_0x477431[_0xbf77('0x12')]=Object[_0xbf77('0x52')](_0x477431[_0xbf77('0x12')],_0x4ce7d4['query']);delete _0x477431[_0xbf77('0x12')]['id'];return db[_0xbf77('0x38')][_0xbf77('0x39')](_0x477431);}return db[_0x2edacd][_0xbf77('0x3b')](_0x1d3327);})['then'](function(_0x1fb05e){_0x80925[_0xbf77('0xb')]=_0x1fb05e[_0xbf77('0xb')];_0x77a439=_0x1fb05e[_0xbf77('0x3c')];return rtq[_0xbf77('0x53')](_0x4ce7d4,_0x37ce98);})[_0xbf77('0x17')](function(_0x5373bf){_0x22dc4c=_0x5373bf['rows'];return rtq[_0xbf77('0x54')](_0x77a439,_0x22dc4c,_0x37ce98,_0x4ce7d4['query'][_0xbf77('0x2c')]);})['then'](function(_0x16f6a8){_0x80925[_0xbf77('0x3c')]=_0x16f6a8;return _0x80925;})[_0xbf77('0x17')](respondWithFilteredResult(_0x41d1a4,_0x1d3327))[_0xbf77('0x46')](APIHandleError(_0x41d1a4));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7f6b2cf..c675975 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x45739c,_0x2c1b21){var _0x3f6299=function(_0x62edfb){while(--_0x62edfb){_0x45739c['push'](_0x45739c['shift']());}};_0x3f6299(++_0x2c1b21);}(_0x70e0,0x17b));var _0x070e=function(_0x1da28d,_0x387f05){_0x1da28d=_0x1da28d-0x0;var _0x39b9fd=_0x70e0[_0x1da28d];return _0x39b9fd;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x524e23,_0x1e2aa7){var _0x231413=function(_0x22ac35){while(--_0x22ac35){_0x524e23['push'](_0x524e23['shift']());}};_0x231413(++_0x1e2aa7);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a1769ff..0c66eed 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 _0x71ad=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x5014df,_0x45f897){var _0x13e73e=function(_0x398368){while(--_0x398368){_0x5014df['push'](_0x5014df['shift']());}};_0x13e73e(++_0x45f897);}(_0x71ad,0xee));var _0xd71a=function(_0x471a11,_0x42d1c5){_0x471a11=_0x471a11-0x0;var _0x223d60=_0x71ad[_0x471a11];return _0x223d60;};'use strict';var Sequelize=require(_0xd71a('0x0'));module[_0xd71a('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd71a('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xd71a('0x2')]},'starttime':{'type':Sequelize[_0xd71a('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd71a('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd71a('0x2')]}}; \ No newline at end of file +var _0xafb9=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x89ef7c,_0xce0be5){var _0x3f7ba7=function(_0x341475){while(--_0x341475){_0x89ef7c['push'](_0x89ef7c['shift']());}};_0x3f7ba7(++_0xce0be5);}(_0xafb9,0x68));var _0x9afb=function(_0x91379f,_0x538118){_0x91379f=_0x91379f-0x0;var _0x4c70b0=_0xafb9[_0x91379f];return _0x4c70b0;};'use strict';var Sequelize=require(_0x9afb('0x0'));module[_0x9afb('0x1')]={'state':{'type':Sequelize[_0x9afb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9afb('0x3')]},'scheduledat':{'type':Sequelize[_0x9afb('0x4')]},'uniqueid':{'type':Sequelize[_0x9afb('0x3')]},'starttime':{'type':Sequelize[_0x9afb('0x4')]},'responsetime':{'type':Sequelize[_0x9afb('0x4')]},'ringtime':{'type':Sequelize[_0x9afb('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9afb('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3e307d5..bd0dc0c 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 _0x188f=['../../config/logger','moment','bluebird','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util'];(function(_0x354bd6,_0x4a7c74){var _0x39bf52=function(_0x585791){while(--_0x585791){_0x354bd6['push'](_0x354bd6['shift']());}};_0x39bf52(++_0x4a7c74);}(_0x188f,0x81));var _0xf188=function(_0x30b613,_0x519322){_0x30b613=_0x30b613-0x0;var _0x5a5282=_0x188f[_0x30b613];return _0x5a5282;};'use strict';var _=require('lodash');var util=require(_0xf188('0x0'));var logger=require(_0xf188('0x1'))('api');var moment=require(_0xf188('0x2'));var BPromise=require(_0xf188('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf188('0x4'));var attributes=require(_0xf188('0x5'));module[_0xf188('0x6')]=function(_0x463b05,_0x1804f3){return _0x463b05[_0xf188('0x7')](_0xf188('0x8'),attributes,{'tableName':_0xf188('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3c9=['exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0xb3c9,0x1f1));var _0x9b3c=function(_0x49ce6a,_0x5f3fe3){_0x49ce6a=_0x49ce6a-0x0;var _0x340949=_0xb3c9[_0x49ce6a];return _0x340949;};'use strict';var _=require(_0x9b3c('0x0'));var util=require(_0x9b3c('0x1'));var logger=require(_0x9b3c('0x2'))(_0x9b3c('0x3'));var moment=require('moment');var BPromise=require(_0x9b3c('0x4'));var rp=require(_0x9b3c('0x5'));var fs=require('fs');var path=require(_0x9b3c('0x6'));var rimraf=require(_0x9b3c('0x7'));var config=require(_0x9b3c('0x8'));var attributes=require(_0x9b3c('0x9'));module[_0x9b3c('0xa')]=function(_0x37c678,_0x41787b){return _0x37c678['define'](_0x9b3c('0xb'),attributes,{'tableName':_0x9b3c('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 4f42d04..17264f2 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 _0x24ba=['code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53914,_0x30eb24){var _0x4b3463=function(_0x413678){while(--_0x413678){_0x53914['push'](_0x53914['shift']());}};_0x4b3463(++_0x30eb24);}(_0x24ba,0xf2));var _0xa24b=function(_0x41ed4f,_0x4a76db){_0x41ed4f=_0x41ed4f-0x0;var _0x1585d4=_0x24ba[_0x41ed4f];return _0x1585d4;};'use strict';var _=require(_0xa24b('0x0'));var util=require('util');var moment=require(_0xa24b('0x1'));var BPromise=require('bluebird');var rs=require(_0xa24b('0x2'));var fs=require('fs');var Redis=require(_0xa24b('0x3'));var db=require(_0xa24b('0x4'))['db'];var utils=require(_0xa24b('0x5'));var logger=require(_0xa24b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa24b('0x7'));var client=jayson[_0xa24b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x527b57,_0xb331bd,_0x4a2e5f){return new BPromise(function(_0x5ed953,_0x4e255f){return client[_0xa24b('0x9')](_0x527b57,_0x4a2e5f)[_0xa24b('0xa')](function(_0x5df61f){logger[_0xa24b('0xb')](_0xa24b('0xc'),_0xb331bd,_0xa24b('0xd'));logger[_0xa24b('0xe')](_0xa24b('0xf'),_0xb331bd,_0xa24b('0xd'),JSON[_0xa24b('0x10')](_0x5df61f));if(_0x5df61f[_0xa24b('0x11')]){if(_0x5df61f[_0xa24b('0x11')][_0xa24b('0x12')]===0x1f4){logger['error'](_0xa24b('0xc'),_0xb331bd,_0x5df61f[_0xa24b('0x11')][_0xa24b('0x13')]);return _0x4e255f(_0x5df61f[_0xa24b('0x11')][_0xa24b('0x13')]);}logger[_0xa24b('0x11')](_0xa24b('0xc'),_0xb331bd,_0x5df61f[_0xa24b('0x11')][_0xa24b('0x13')]);return _0x5ed953(_0x5df61f[_0xa24b('0x11')]['message']);}else{logger[_0xa24b('0xb')](_0xa24b('0xc'),_0xb331bd,_0xa24b('0xd'));_0x5ed953(_0x5df61f['result'][_0xa24b('0x13')]);}})[_0xa24b('0x14')](function(_0x27726f){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xb331bd,_0x27726f);_0x4e255f(_0x27726f);});});}exports[_0xa24b('0x15')]=function(_0x56ecd0){var _0x2f4bbd=this;return new Promise(function(_0x4fe40b,_0x5c11ca){return db[_0xa24b('0x16')][_0xa24b('0x17')](_0x56ecd0['body'],{'raw':_0x56ecd0[_0xa24b('0x18')]?_0x56ecd0[_0xa24b('0x18')][_0xa24b('0x19')]===undefined?!![]:![]:!![]})[_0xa24b('0xa')](function(_0x5bfbbc){logger[_0xa24b('0xb')](_0xa24b('0x15'),_0x56ecd0);logger['debug'](_0xa24b('0x15'),_0x56ecd0,JSON[_0xa24b('0x10')](_0x5bfbbc));_0x4fe40b(_0x5bfbbc);})[_0xa24b('0x14')](function(_0x58b6f2){logger['error'](_0xa24b('0x15'),_0x58b6f2['message'],_0x56ecd0);_0x5c11ca(_0x2f4bbd['error'](0x1f4,_0x58b6f2[_0xa24b('0x13')]));});});}; \ No newline at end of file +var _0x7421=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x418082,_0x22f950){var _0x3a57b5=function(_0x508822){while(--_0x508822){_0x418082['push'](_0x418082['shift']());}};_0x3a57b5(++_0x22f950);}(_0x7421,0x8c));var _0x1742=function(_0x52a188,_0x56b9c5){_0x52a188=_0x52a188-0x0;var _0x265843=_0x7421[_0x52a188];return _0x265843;};'use strict';var _=require(_0x1742('0x0'));var util=require(_0x1742('0x1'));var moment=require(_0x1742('0x2'));var BPromise=require(_0x1742('0x3'));var rs=require(_0x1742('0x4'));var fs=require('fs');var Redis=require(_0x1742('0x5'));var db=require(_0x1742('0x6'))['db'];var utils=require(_0x1742('0x7'));var logger=require(_0x1742('0x8'))(_0x1742('0x9'));var config=require(_0x1742('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1742('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5998b0,_0x2b4293,_0x3453d0){return new BPromise(function(_0x2208fe,_0x5a8439){return client[_0x1742('0xc')](_0x5998b0,_0x3453d0)['then'](function(_0x2dd55e){logger['info'](_0x1742('0xd'),_0x2b4293,_0x1742('0xe'));logger[_0x1742('0xf')](_0x1742('0x10'),_0x2b4293,'request\x20sent',JSON['stringify'](_0x2dd55e));if(_0x2dd55e[_0x1742('0x11')]){if(_0x2dd55e[_0x1742('0x11')][_0x1742('0x12')]===0x1f4){logger[_0x1742('0x11')](_0x1742('0xd'),_0x2b4293,_0x2dd55e[_0x1742('0x11')][_0x1742('0x13')]);return _0x5a8439(_0x2dd55e[_0x1742('0x11')][_0x1742('0x13')]);}logger[_0x1742('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2b4293,_0x2dd55e['error'][_0x1742('0x13')]);return _0x2208fe(_0x2dd55e[_0x1742('0x11')][_0x1742('0x13')]);}else{logger[_0x1742('0x14')](_0x1742('0xd'),_0x2b4293,_0x1742('0xe'));_0x2208fe(_0x2dd55e[_0x1742('0x15')]['message']);}})[_0x1742('0x16')](function(_0x27483a){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2b4293,_0x27483a);_0x5a8439(_0x27483a);});});}exports[_0x1742('0x17')]=function(_0x49bbdb){var _0x42830c=this;return new Promise(function(_0x4b5716,_0x208aab){return db[_0x1742('0x18')][_0x1742('0x19')](_0x49bbdb['body'],{'raw':_0x49bbdb[_0x1742('0x1a')]?_0x49bbdb[_0x1742('0x1a')][_0x1742('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x12e771){logger[_0x1742('0x14')](_0x1742('0x17'),_0x49bbdb);logger[_0x1742('0xf')](_0x1742('0x17'),_0x49bbdb,JSON[_0x1742('0x1c')](_0x12e771));_0x4b5716(_0x12e771);})[_0x1742('0x16')](function(_0x386f7b){logger['error'](_0x1742('0x17'),_0x386f7b['message'],_0x49bbdb);_0x208aab(_0x42830c['error'](0x1f4,_0x386f7b['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7d0b3a0..81e1502 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 _0xecaf=['voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','outboundChannels','agents','put','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','chat','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xecaf,0x127));var _0xfeca=function(_0x1093a5,_0x2a7d40){_0x1093a5=_0x1093a5-0x0;var _0x230985=_0xecaf[_0x1093a5];return _0x230985;};'use strict';var multer=require('multer');var util=require(_0xfeca('0x0'));var path=require(_0xfeca('0x1'));var express=require(_0xfeca('0x2'));var router=express['Router']();var auth=require(_0xfeca('0x3'));var controller=require(_0xfeca('0x4'));router[_0xfeca('0x5')](_0xfeca('0x6'),auth['isAuthenticated'](),controller[_0xfeca('0x7')]);router[_0xfeca('0x5')](_0xfeca('0x8'),auth[_0xfeca('0x9')](),controller[_0xfeca('0xa')]);router[_0xfeca('0x5')](_0xfeca('0xb'),auth[_0xfeca('0x9')](),controller[_0xfeca('0xc')]);router[_0xfeca('0x5')]('/voice/queues',auth[_0xfeca('0x9')](),controller[_0xfeca('0xd')]);router[_0xfeca('0x5')]('/chat/queues',auth[_0xfeca('0x9')](),controller[_0xfeca('0xe')]);router[_0xfeca('0x5')](_0xfeca('0xf'),auth['isAuthenticated'](),controller[_0xfeca('0x10')]);router[_0xfeca('0x5')](_0xfeca('0x11'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x12')]);router['get'](_0xfeca('0x13'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x14')]);router[_0xfeca('0x5')]('/sms/queues',auth[_0xfeca('0x9')](),controller['smsQueues']);router['get'](_0xfeca('0x15'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x16')]);router[_0xfeca('0x5')](_0xfeca('0x17'),auth[_0xfeca('0x9')](),controller['faxQueues']);router[_0xfeca('0x5')](_0xfeca('0x18'),auth[_0xfeca('0x9')](),controller['voiceQueuesPreview']);router['get'](_0xfeca('0x19'),auth['isAuthenticated'](),controller[_0xfeca('0x1a')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xfeca('0x9')](),controller[_0xfeca('0x1b')]);router['get'](_0xfeca('0x1c'),auth['isAuthenticated'](),controller[_0xfeca('0x1d')]);router[_0xfeca('0x5')](_0xfeca('0x1e'),auth['isAuthenticated'](),controller[_0xfeca('0x1f')]);router['get'](_0xfeca('0x20'),auth['isAuthenticated'](),controller[_0xfeca('0x21')]);router['put'](_0xfeca('0x20'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x22')]);router[_0xfeca('0x5')]('/outbound',auth[_0xfeca('0x9')](),controller[_0xfeca('0x23')]);router[_0xfeca('0x5')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xfeca('0x24')]);router[_0xfeca('0x5')]('/agents',auth['isAuthenticated'](),controller[_0xfeca('0x25')]);router[_0xfeca('0x26')]('/agents/:id/capacity',auth[_0xfeca('0x9')](),controller[_0xfeca('0x27')]);router[_0xfeca('0x5')](_0xfeca('0x28'),auth[_0xfeca('0x9')](),controller['telephones']);router[_0xfeca('0x5')](_0xfeca('0x29'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x2a')]);router[_0xfeca('0x5')](_0xfeca('0x2b'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x2c')]);router[_0xfeca('0x5')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth[_0xfeca('0x9')](),controller[_0xfeca('0x2d')]);router[_0xfeca('0x5')](_0xfeca('0x2e'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x2f')]);router[_0xfeca('0x5')](_0xfeca('0x30'),auth['isAuthenticated'](),controller[_0xfeca('0x31')]);router[_0xfeca('0x5')](_0xfeca('0x32'),auth[_0xfeca('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xfeca('0x5')](_0xfeca('0x33'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0xfeca('0x5')](_0xfeca('0x34'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x35')]);router[_0xfeca('0x5')](_0xfeca('0x36'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x37')]);router[_0xfeca('0x38')](_0xfeca('0x39'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x3a')](_0xfeca('0x3b')));router[_0xfeca('0x5')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0xfeca('0x3c')]);router[_0xfeca('0x38')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0xfeca('0x3a')](_0xfeca('0x3d')));router[_0xfeca('0x5')]('/chat/queues/:id',auth[_0xfeca('0x9')](),controller[_0xfeca('0x3e')]);router[_0xfeca('0x38')](_0xfeca('0x3f'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x3a')](_0xfeca('0x40')));router[_0xfeca('0x5')]('/fax/queues/:id',auth[_0xfeca('0x9')](),controller['showFaxQueues']);router['post'](_0xfeca('0x41'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x3a')](_0xfeca('0x42')));router[_0xfeca('0x5')](_0xfeca('0x43'),auth[_0xfeca('0x9')](),controller['showOpenchannelQueues']);router[_0xfeca('0x38')]('/sms/queues/:id/notify',auth[_0xfeca('0x9')](),controller[_0xfeca('0x3a')](_0xfeca('0x44')));router[_0xfeca('0x38')]('/whatsapp/queues/:id/notify',auth[_0xfeca('0x9')](),controller['queueNotify'](_0xfeca('0x45')));router[_0xfeca('0x5')](_0xfeca('0x46'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x47')]);router[_0xfeca('0x5')](_0xfeca('0x48'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x49')]);router[_0xfeca('0x38')](_0xfeca('0x4a'),auth[_0xfeca('0x9')](),controller[_0xfeca('0x4b')]);module[_0xfeca('0x4c')]=router; \ No newline at end of file +var _0x7a14=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','chat','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','express','Router','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel'];(function(_0x3ae99a,_0x1209a9){var _0x12b5f6=function(_0x43c9d1){while(--_0x43c9d1){_0x3ae99a['push'](_0x3ae99a['shift']());}};_0x12b5f6(++_0x1209a9);}(_0x7a14,0x18e));var _0x47a1=function(_0x32fcf2,_0x446129){_0x32fcf2=_0x32fcf2-0x0;var _0x53d767=_0x7a14[_0x32fcf2];return _0x53d767;};'use strict';var multer=require(_0x47a1('0x0'));var util=require('util');var path=require('path');var express=require(_0x47a1('0x1'));var router=express[_0x47a1('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0x47a1('0x3'));router[_0x47a1('0x4')]('/voice/channels',auth[_0x47a1('0x5')](),controller['voiceChannels']);router[_0x47a1('0x4')](_0x47a1('0x6'),auth['isAuthenticated'](),controller[_0x47a1('0x7')]);router[_0x47a1('0x4')](_0x47a1('0x8'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x9')]);router[_0x47a1('0x4')](_0x47a1('0xa'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0x47a1('0xb'),auth[_0x47a1('0x5')](),controller[_0x47a1('0xc')]);router[_0x47a1('0x4')](_0x47a1('0xd'),auth['isAuthenticated'](),controller[_0x47a1('0xe')]);router[_0x47a1('0x4')](_0x47a1('0xf'),auth[_0x47a1('0x5')](),controller['mailAccounts']);router['get'](_0x47a1('0x10'),auth[_0x47a1('0x5')](),controller['openchannelQueues']);router['get'](_0x47a1('0x11'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x12')]);router[_0x47a1('0x4')](_0x47a1('0x13'),auth[_0x47a1('0x5')](),controller['whatsappQueues']);router[_0x47a1('0x4')](_0x47a1('0x14'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x15')]);router[_0x47a1('0x4')](_0x47a1('0x16'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x17')]);router[_0x47a1('0x4')](_0x47a1('0x18'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x19')]);router[_0x47a1('0x4')](_0x47a1('0x1a'),auth['isAuthenticated'](),controller[_0x47a1('0x1b')]);router[_0x47a1('0x4')](_0x47a1('0x1c'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x1d')]);router[_0x47a1('0x4')](_0x47a1('0x1e'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x1f')]);router[_0x47a1('0x4')]('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router['put'](_0x47a1('0x20'),auth['isAuthenticated'](),controller[_0x47a1('0x21')]);router[_0x47a1('0x4')]('/outbound',auth[_0x47a1('0x5')](),controller['outbound']);router['get'](_0x47a1('0x22'),auth[_0x47a1('0x5')](),controller['outboundChannels']);router[_0x47a1('0x4')](_0x47a1('0x23'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x24')]);router['put'](_0x47a1('0x25'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x47a1('0x4')](_0x47a1('0x26'),auth[_0x47a1('0x5')](),controller['telephones']);router[_0x47a1('0x4')](_0x47a1('0x27'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x28')]);router[_0x47a1('0x4')](_0x47a1('0x29'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x2a')]);router[_0x47a1('0x4')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x47a1('0x2b')]);router[_0x47a1('0x4')](_0x47a1('0x2c'),auth[_0x47a1('0x5')](),controller['chatQueuesWaitingInteractions']);router[_0x47a1('0x4')](_0x47a1('0x2d'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x2e')]);router[_0x47a1('0x4')](_0x47a1('0x2f'),auth[_0x47a1('0x5')](),controller['openchannelQueuesWaitingInteractions']);router[_0x47a1('0x4')](_0x47a1('0x30'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x31')]);router[_0x47a1('0x4')]('/sms/queues/waitinginteractions',auth[_0x47a1('0x5')](),controller[_0x47a1('0x32')]);router['get'](_0x47a1('0x33'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x34')]);router[_0x47a1('0x4')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x47a1('0x35')]);router[_0x47a1('0x36')](_0x47a1('0x37'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x38')]('mail'));router[_0x47a1('0x4')]('/mail/queues/:id',auth[_0x47a1('0x5')](),controller['showMailQueues']);router[_0x47a1('0x36')]('/chat/queues/:id/notify',auth[_0x47a1('0x5')](),controller[_0x47a1('0x38')](_0x47a1('0x39')));router[_0x47a1('0x4')]('/chat/queues/:id',auth[_0x47a1('0x5')](),controller['showChatQueues']);router[_0x47a1('0x36')](_0x47a1('0x3a'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x38')](_0x47a1('0x3b')));router[_0x47a1('0x4')]('/fax/queues/:id',auth[_0x47a1('0x5')](),controller['showFaxQueues']);router[_0x47a1('0x36')](_0x47a1('0x3c'),auth['isAuthenticated'](),controller[_0x47a1('0x38')](_0x47a1('0x3d')));router[_0x47a1('0x4')]('/openchannel/queues/:id',auth[_0x47a1('0x5')](),controller[_0x47a1('0x3e')]);router[_0x47a1('0x36')](_0x47a1('0x3f'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x38')](_0x47a1('0x40')));router[_0x47a1('0x36')](_0x47a1('0x41'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x38')]('whatsapp'));router[_0x47a1('0x4')](_0x47a1('0x42'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x43')]);router[_0x47a1('0x4')](_0x47a1('0x44'),auth[_0x47a1('0x5')](),controller[_0x47a1('0x45')]);router['post'](_0x47a1('0x46'),auth['isAuthenticated'](),controller['agentNotify']);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 4942b43..e97d76c 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x477e4b,_0x37dc1a){var _0x4c736c=function(_0x4c26b8){while(--_0x4c26b8){_0x477e4b['push'](_0x477e4b['shift']());}};_0x4c736c(++_0x37dc1a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x29853b,_0x3274d6){var _0xc53e58=function(_0x2673c2){while(--_0x2673c2){_0x29853b['push'](_0x29853b['shift']());}};_0xc53e58(++_0x3274d6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 7066e43..b7e51ef 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 _0x1399=['show','/:id/run','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0x1702dc,_0x11ca50){var _0x98513c=function(_0x38c927){while(--_0x38c927){_0x1702dc['push'](_0x1702dc['shift']());}};_0x98513c(++_0x11ca50);}(_0x1399,0xe5));var _0x9139=function(_0x11d486,_0x275600){_0x11d486=_0x11d486-0x0;var _0x24695b=_0x1399[_0x11d486];return _0x24695b;};'use strict';var multer=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var path=require(_0x9139('0x2'));var timeout=require('connect-timeout');var express=require(_0x9139('0x3'));var router=express[_0x9139('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9139('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9139('0x6'));var controller=require(_0x9139('0x7'));router[_0x9139('0x8')]('/',auth[_0x9139('0x9')](),controller[_0x9139('0xa')]);router[_0x9139('0x8')]('/:id',auth[_0x9139('0x9')](),controller[_0x9139('0xb')]);router[_0x9139('0x8')](_0x9139('0xc'),auth['isAuthenticated'](),controller['run']);router[_0x9139('0xd')]('/',auth[_0x9139('0x9')](),controller[_0x9139('0xe')]);router[_0x9139('0xf')](_0x9139('0x10'),auth[_0x9139('0x9')](),controller[_0x9139('0x11')]);router[_0x9139('0x12')](_0x9139('0x10'),auth[_0x9139('0x9')](),controller[_0x9139('0x13')]);module['exports']=router; \ No newline at end of file +var _0x96a2=['show','create','exports','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id'];(function(_0x28528a,_0x46e834){var _0x44a930=function(_0x59bfab){while(--_0x59bfab){_0x28528a['push'](_0x28528a['shift']());}};_0x44a930(++_0x46e834);}(_0x96a2,0x19b));var _0x296a=function(_0x5f2027,_0x4ecd50){_0x5f2027=_0x5f2027-0x0;var _0x2e0c21=_0x96a2[_0x5f2027];return _0x2e0c21;};'use strict';var multer=require('multer');var util=require(_0x296a('0x0'));var path=require(_0x296a('0x1'));var timeout=require(_0x296a('0x2'));var express=require(_0x296a('0x3'));var router=express[_0x296a('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('./schedule.controller');router[_0x296a('0x5')]('/',auth[_0x296a('0x6')](),controller[_0x296a('0x7')]);router['get'](_0x296a('0x8'),auth[_0x296a('0x6')](),controller[_0x296a('0x9')]);router[_0x296a('0x5')]('/:id/run',auth[_0x296a('0x6')](),controller['run']);router['post']('/',auth[_0x296a('0x6')](),controller[_0x296a('0xa')]);router['put'](_0x296a('0x8'),auth[_0x296a('0x6')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x296a('0xb')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0d1c29b..047d337 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 _0x4069=['BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','pdf','xlsx','csv','custom','TEXT','sequelize','exports','STRING'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x4069,0xbb));var _0x9406=function(_0x1cf3ae,_0x575e5d){_0x1cf3ae=_0x1cf3ae-0x0;var _0x5dbeb6=_0x4069[_0x1cf3ae];return _0x5dbeb6;};'use strict';var Sequelize=require(_0x9406('0x0'));module[_0x9406('0x1')]={'name':{'type':Sequelize[_0x9406('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9406('0x2')]},'active':{'type':Sequelize[_0x9406('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9406('0x2')],'allowNull':![],'defaultValue':_0x9406('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9406('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9406('0x6')](_0x9406('0x7'),_0x9406('0x8'),_0x9406('0x9'),_0x9406('0xa'),_0x9406('0xb'),_0x9406('0xc'),_0x9406('0xd')),'allowNull':![],'defaultValue':_0x9406('0xb')},'output':{'type':Sequelize['ENUM']('csv',_0x9406('0xe'),_0x9406('0xf')),'allowNull':![],'defaultValue':_0x9406('0x10')},'type':{'type':Sequelize[_0x9406('0x6')]('custom','default'),'allowNull':![],'defaultValue':_0x9406('0x11')},'sendMail':{'type':Sequelize[_0x9406('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9406('0x2')]},'cc':{'type':Sequelize[_0x9406('0x12')]},'bcc':{'type':Sequelize[_0x9406('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xc352=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','days','hours','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x3a564c,_0x10c090){var _0x5387b9=function(_0x56a3f5){while(--_0x56a3f5){_0x3a564c['push'](_0x3a564c['shift']());}};_0x5387b9(++_0x10c090);}(_0xc352,0xad));var _0x2c35=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xc352[_0x4c9380];return _0x49a523;};'use strict';var Sequelize=require(_0x2c35('0x0'));module[_0x2c35('0x1')]={'name':{'type':Sequelize[_0x2c35('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2c35('0x2')]},'active':{'type':Sequelize[_0x2c35('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2c35('0x2')],'allowNull':![],'defaultValue':_0x2c35('0x4')},'startAt':{'type':Sequelize[_0x2c35('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2c35('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2c35('0x6')]('years',_0x2c35('0x7'),'months','weeks',_0x2c35('0x8'),_0x2c35('0x9'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0x2c35('0xa'),_0x2c35('0xb')),'allowNull':![],'defaultValue':_0x2c35('0xc')},'type':{'type':Sequelize[_0x2c35('0x6')](_0x2c35('0xd'),_0x2c35('0xe')),'allowNull':![],'defaultValue':_0x2c35('0xd')},'sendMail':{'type':Sequelize[_0x2c35('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2c35('0xf')]},'bcc':{'type':Sequelize[_0x2c35('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x2c35('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d8529e8..016c1c2 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 _0xd94d=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include','Schedule','findAll','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','catch','run','../../config/schedule','eml-format','rimraf'];(function(_0x34dc67,_0x441d43){var _0xda21a1=function(_0x141eb6){while(--_0x141eb6){_0x34dc67['push'](_0x34dc67['shift']());}};_0xda21a1(++_0x441d43);}(_0xd94d,0x156));var _0xdd94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd94d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdd94('0x0'));var rimraf=require(_0xdd94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd94('0x2'));var rp=require(_0xdd94('0x3'));var moment=require(_0xdd94('0x4'));var BPromise=require(_0xdd94('0x5'));var Mustache=require(_0xdd94('0x6'));var util=require('util');var path=require(_0xdd94('0x7'));var sox=require(_0xdd94('0x8'));var csv=require('to-csv');var ejs=require(_0xdd94('0x9'));var fs=require('fs');var fs_extra=require(_0xdd94('0xa'));var _=require(_0xdd94('0xb'));var squel=require('squel');var crypto=require(_0xdd94('0xc'));var jsforce=require(_0xdd94('0xd'));var deskjs=require(_0xdd94('0xe'));var toCsv=require(_0xdd94('0xf'));var querystring=require(_0xdd94('0x10'));var Papa=require(_0xdd94('0x11'));var Redis=require(_0xdd94('0x12'));var authService=require(_0xdd94('0x13'));var qs=require(_0xdd94('0x14'));var as=require(_0xdd94('0x15'));var hardwareService=require(_0xdd94('0x16'));var logger=require('../../config/logger')(_0xdd94('0x17'));var utils=require(_0xdd94('0x18'));var config=require(_0xdd94('0x19'));var licenseUtil=require(_0xdd94('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x316cc5,_0x4abbc8){_0x4abbc8=_0x4abbc8||0xcc;return function(_0x1a231a){if(_0x1a231a){return _0x316cc5['sendStatus'](_0x4abbc8);}return _0x316cc5[_0xdd94('0x1b')](_0x4abbc8)[_0xdd94('0x1c')]();};}function respondWithResult(_0x285fb3,_0x5f5ce8){_0x5f5ce8=_0x5f5ce8||0xc8;return function(_0x20c5af){if(_0x20c5af){return _0x285fb3['status'](_0x5f5ce8)['json'](_0x20c5af);}};}function respondWithFilteredResult(_0x5ddd38,_0x2c4504){return function(_0xb344da){if(_0xb344da){var _0x275dda=typeof _0x2c4504[_0xdd94('0x1d')]===_0xdd94('0x1e')&&typeof _0x2c4504['limit']==='undefined';var _0x1950b5=_0xb344da[_0xdd94('0x1f')];var _0x45af19=_0x275dda?0x0:_0x2c4504[_0xdd94('0x1d')];var _0x5d11df=_0x275dda?_0xb344da['count']:_0x2c4504[_0xdd94('0x1d')]+_0x2c4504[_0xdd94('0x20')];var _0x4c3242;if(_0x5d11df>=_0x1950b5){_0x5d11df=_0x1950b5;_0x4c3242=0xc8;}else{_0x4c3242=0xce;}_0x5ddd38[_0xdd94('0x1b')](_0x4c3242);return _0x5ddd38[_0xdd94('0x21')](_0xdd94('0x22'),_0x45af19+'-'+_0x5d11df+'/'+_0x1950b5)['json'](_0xb344da);}return null;};}function patchUpdates(_0x5f4d02){return function(_0x48ba87){try{jsonpatch[_0xdd94('0x23')](_0x48ba87,_0x5f4d02,!![]);}catch(_0x1e2f7f){return BPromise['reject'](_0x1e2f7f);}return _0x48ba87[_0xdd94('0x24')]();};}function saveUpdates(_0x4abc13,_0x31270e){return function(_0x1b304d){if(_0x1b304d){return _0x1b304d[_0xdd94('0x25')](_0x4abc13)[_0xdd94('0x26')](function(_0x1c99a6){return _0x1c99a6;});}return null;};}function removeEntity(_0xf022ee,_0x5ba362){return function(_0x18271a){if(_0x18271a){return _0x18271a[_0xdd94('0x27')]()[_0xdd94('0x26')](function(){var _0x4011d5=_0x18271a[_0xdd94('0x28')]({'plain':!![]});var _0x316e4e='Scheduler';return db[_0xdd94('0x29')][_0xdd94('0x27')]({'where':{'type':_0x316e4e,'resourceId':_0x4011d5['id']}})[_0xdd94('0x26')](function(){return _0x18271a;});})['then'](function(){_0xf022ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b105,_0x333860){return function(_0x4bf0d7){if(!_0x4bf0d7){_0x20b105[_0xdd94('0x2a')](0x194);}return _0x4bf0d7;};}function handleError(_0x114e1e,_0x20abe6){_0x20abe6=_0x20abe6||0x1f4;return function(_0x2ba1e3){logger[_0xdd94('0x2b')](_0x2ba1e3[_0xdd94('0x2c')]);if(_0x2ba1e3[_0xdd94('0x2d')]){delete _0x2ba1e3['name'];}_0x114e1e[_0xdd94('0x1b')](_0x20abe6)['send'](_0x2ba1e3);};}exports[_0xdd94('0x2e')]=function(_0x27ff2e,_0x3bf2f0){var _0x11f1ba={},_0x41a0c5={},_0xcb76ad={'count':0x0,'rows':[]};var _0x4205dc=_[_0xdd94('0x2f')](db['Schedule'][_0xdd94('0x30')],function(_0xe5e10c){return{'name':_0xe5e10c[_0xdd94('0x31')],'type':_0xe5e10c[_0xdd94('0x32')][_0xdd94('0x33')]};});_0x41a0c5[_0xdd94('0x34')]=_[_0xdd94('0x2f')](_0x4205dc,'name');_0x41a0c5[_0xdd94('0x35')]=_['keys'](_0x27ff2e[_0xdd94('0x35')]);_0x41a0c5['filters']=_[_0xdd94('0x36')](_0x41a0c5[_0xdd94('0x34')],_0x41a0c5[_0xdd94('0x35')]);_0x11f1ba[_0xdd94('0x37')]=_['intersection'](_0x41a0c5[_0xdd94('0x34')],qs[_0xdd94('0x38')](_0x27ff2e['query'][_0xdd94('0x38')]));_0x11f1ba['attributes']=_0x11f1ba[_0xdd94('0x37')][_0xdd94('0x39')]?_0x11f1ba[_0xdd94('0x37')]:_0x41a0c5[_0xdd94('0x34')];if(!_0x27ff2e[_0xdd94('0x35')][_0xdd94('0x3a')](_0xdd94('0x3b'))){_0x11f1ba[_0xdd94('0x20')]=qs[_0xdd94('0x20')](_0x27ff2e['query'][_0xdd94('0x20')]);_0x11f1ba[_0xdd94('0x1d')]=qs['offset'](_0x27ff2e[_0xdd94('0x35')][_0xdd94('0x1d')]);}_0x11f1ba['order']=qs[_0xdd94('0x3c')](_0x27ff2e[_0xdd94('0x35')][_0xdd94('0x3c')]);_0x11f1ba['where']=qs[_0xdd94('0x3d')](_[_0xdd94('0x3e')](_0x27ff2e['query'],_0x41a0c5[_0xdd94('0x3d')]),_0x4205dc);if(_0x27ff2e[_0xdd94('0x35')][_0xdd94('0x3f')]){_0x11f1ba[_0xdd94('0x40')]=_[_0xdd94('0x41')](_0x11f1ba['where'],{'$or':_[_0xdd94('0x2f')](_0x4205dc,function(_0x482ffd){if(_0x482ffd[_0xdd94('0x32')]!=='VIRTUAL'){var _0x274197={};_0x274197[_0x482ffd[_0xdd94('0x2d')]]={'$like':'%'+_0x27ff2e[_0xdd94('0x35')][_0xdd94('0x3f')]+'%'};return _0x274197;}})});}_0x11f1ba=_[_0xdd94('0x41')]({},_0x11f1ba,_0x27ff2e[_0xdd94('0x42')]);var _0x2a3445={'where':_0x11f1ba[_0xdd94('0x40')]};return db['Schedule'][_0xdd94('0x1f')](_0x2a3445)['then'](function(_0x3d61ee){_0xcb76ad[_0xdd94('0x1f')]=_0x3d61ee;if(_0x27ff2e[_0xdd94('0x35')][_0xdd94('0x43')]){_0x11f1ba[_0xdd94('0x44')]=[{'all':!![]}];}return db[_0xdd94('0x45')][_0xdd94('0x46')](_0x11f1ba);})[_0xdd94('0x26')](function(_0x5cb21b){_0xcb76ad['rows']=_0x5cb21b;return _0xcb76ad;})['then'](respondWithFilteredResult(_0x3bf2f0,_0x11f1ba))['catch'](handleError(_0x3bf2f0,null));};exports[_0xdd94('0x47')]=function(_0x18ef02,_0x3a82bf){var _0x249820={'raw':![],'where':{'id':_0x18ef02['params']['id']}},_0xd4104f={};_0xd4104f[_0xdd94('0x34')]=_[_0xdd94('0x48')](db[_0xdd94('0x45')]['rawAttributes']);_0xd4104f[_0xdd94('0x35')]=_[_0xdd94('0x48')](_0x18ef02[_0xdd94('0x35')]);_0xd4104f[_0xdd94('0x3d')]=_['intersection'](_0xd4104f[_0xdd94('0x34')],_0xd4104f['query']);_0x249820[_0xdd94('0x37')]=_[_0xdd94('0x36')](_0xd4104f['model'],qs[_0xdd94('0x38')](_0x18ef02['query'][_0xdd94('0x38')]));_0x249820['attributes']=_0x249820[_0xdd94('0x37')][_0xdd94('0x39')]?_0x249820[_0xdd94('0x37')]:_0xd4104f[_0xdd94('0x34')];if(_0x18ef02[_0xdd94('0x35')][_0xdd94('0x43')]){_0x249820['include']=[{'all':!![]}];}_0x249820=_[_0xdd94('0x41')]({},_0x249820,_0x18ef02[_0xdd94('0x42')]);return db[_0xdd94('0x45')][_0xdd94('0x49')](_0x249820)['then'](handleEntityNotFound(_0x3a82bf,null))[_0xdd94('0x26')](respondWithResult(_0x3a82bf,null))['catch'](handleError(_0x3a82bf,null));};exports[_0xdd94('0x4a')]=function(_0x2b3ddd,_0x2f36a2){return db['Schedule']['create'](_0x2b3ddd['body'],{})[_0xdd94('0x26')](function(_0x30eea3){var _0x11be3a=_0x2b3ddd[_0xdd94('0x4b')][_0xdd94('0x28')]({'plain':!![]});if(!_0x11be3a)throw new Error(_0xdd94('0x4c'));if(_0x11be3a[_0xdd94('0x4d')]===_0xdd94('0x4b')){var _0x3f7019=_0x30eea3[_0xdd94('0x28')]({'plain':!![]});var _0x51a4b4=_0xdd94('0x4e');return db['UserProfileSection'][_0xdd94('0x49')]({'where':{'name':_0x51a4b4,'userProfileId':_0x11be3a['userProfileId']},'raw':!![]})[_0xdd94('0x26')](function(_0x3f8db0){if(_0x3f8db0&&_0x3f8db0[_0xdd94('0x4f')]===0x0){return db['UserProfileResource'][_0xdd94('0x4a')]({'name':_0x3f7019[_0xdd94('0x2d')],'resourceId':_0x3f7019['id'],'type':_0x3f8db0[_0xdd94('0x2d')],'sectionId':_0x3f8db0['id']},{})[_0xdd94('0x26')](function(){return _0x30eea3;});}else{return _0x30eea3;}})['catch'](function(_0x5b9e4c){logger[_0xdd94('0x2b')](_0xdd94('0x50'),_0x5b9e4c);throw _0x5b9e4c;});}return _0x30eea3;})[_0xdd94('0x26')](respondWithResult(_0x2f36a2,0xc9))['catch'](handleError(_0x2f36a2,null));};exports[_0xdd94('0x25')]=function(_0x510ff4,_0x5a17f2){if(_0x510ff4[_0xdd94('0x51')]['id']){delete _0x510ff4[_0xdd94('0x51')]['id'];}return db['Schedule'][_0xdd94('0x49')]({'where':{'id':_0x510ff4[_0xdd94('0x52')]['id']}})[_0xdd94('0x26')](handleEntityNotFound(_0x5a17f2,null))[_0xdd94('0x26')](saveUpdates(_0x510ff4[_0xdd94('0x51')],null))[_0xdd94('0x26')](respondWithResult(_0x5a17f2,null))[_0xdd94('0x53')](handleError(_0x5a17f2,null));};exports[_0xdd94('0x27')]=function(_0x411960,_0x303b42){return db[_0xdd94('0x45')]['find']({'where':{'id':_0x411960[_0xdd94('0x52')]['id']}})[_0xdd94('0x26')](handleEntityNotFound(_0x303b42,null))['then'](removeEntity(_0x303b42,null))['catch'](handleError(_0x303b42,null));};exports[_0xdd94('0x54')]=function(_0x3e543a,_0x1c9120,_0x54089c){var _0x5a1f89=require(_0xdd94('0x55'));return db['Schedule'][_0xdd94('0x49')]({'where':{'id':_0x3e543a['params']['id']},'raw':!![]})[_0xdd94('0x26')](handleEntityNotFound(_0x1c9120,null))[_0xdd94('0x26')](function(){_0x5a1f89['run'](_0x3e543a[_0xdd94('0x52')]['id']);})['then'](respondWithStatusCode(_0x1c9120,null))[_0xdd94('0x53')](handleError(_0x1c9120,null));}; \ No newline at end of file +var _0xa13e=['util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','create','name','error','../../config/schedule','run','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x2f91b8,_0x86a258){var _0x2a7dd3=function(_0x263627){while(--_0x263627){_0x2f91b8['push'](_0x2f91b8['shift']());}};_0x2a7dd3(++_0x86a258);}(_0xa13e,0x14e));var _0xea13=function(_0x61f1b5,_0x9e6041){_0x61f1b5=_0x61f1b5-0x0;var _0xb34b33=_0xa13e[_0x61f1b5];return _0xb34b33;};'use strict';var emlformat=require(_0xea13('0x0'));var rimraf=require(_0xea13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea13('0x2'));var rp=require(_0xea13('0x3'));var moment=require(_0xea13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea13('0x5'));var util=require(_0xea13('0x6'));var path=require('path');var sox=require(_0xea13('0x7'));var csv=require(_0xea13('0x8'));var ejs=require(_0xea13('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xea13('0xa'));var crypto=require(_0xea13('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xea13('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xea13('0xd'));var Redis=require('ioredis');var authService=require(_0xea13('0xe'));var qs=require(_0xea13('0xf'));var as=require(_0xea13('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea13('0x11'))(_0xea13('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea13('0x13'))['db'];function respondWithStatusCode(_0x132cfc,_0xb7cd5){_0xb7cd5=_0xb7cd5||0xcc;return function(_0x31a3aa){if(_0x31a3aa){return _0x132cfc[_0xea13('0x14')](_0xb7cd5);}return _0x132cfc['status'](_0xb7cd5)[_0xea13('0x15')]();};}function respondWithResult(_0xe81402,_0x4363bd){_0x4363bd=_0x4363bd||0xc8;return function(_0x145720){if(_0x145720){return _0xe81402[_0xea13('0x16')](_0x4363bd)[_0xea13('0x17')](_0x145720);}};}function respondWithFilteredResult(_0x13e786,_0x4da6c7){return function(_0x1c519f){if(_0x1c519f){var _0x1b1add=typeof _0x4da6c7[_0xea13('0x18')]===_0xea13('0x19')&&typeof _0x4da6c7[_0xea13('0x1a')]===_0xea13('0x19');var _0x48b1cb=_0x1c519f['count'];var _0x42a0c5=_0x1b1add?0x0:_0x4da6c7['offset'];var _0x337fd7=_0x1b1add?_0x1c519f[_0xea13('0x1b')]:_0x4da6c7[_0xea13('0x18')]+_0x4da6c7[_0xea13('0x1a')];var _0x1ee8ba;if(_0x337fd7>=_0x48b1cb){_0x337fd7=_0x48b1cb;_0x1ee8ba=0xc8;}else{_0x1ee8ba=0xce;}_0x13e786[_0xea13('0x16')](_0x1ee8ba);return _0x13e786[_0xea13('0x1c')](_0xea13('0x1d'),_0x42a0c5+'-'+_0x337fd7+'/'+_0x48b1cb)['json'](_0x1c519f);}return null;};}function patchUpdates(_0x249c05){return function(_0x4cb241){try{jsonpatch[_0xea13('0x1e')](_0x4cb241,_0x249c05,!![]);}catch(_0x2ab713){return BPromise[_0xea13('0x1f')](_0x2ab713);}return _0x4cb241[_0xea13('0x20')]();};}function saveUpdates(_0xa22780,_0x533e88){return function(_0x4fbc7e){if(_0x4fbc7e){return _0x4fbc7e[_0xea13('0x21')](_0xa22780)[_0xea13('0x22')](function(_0x2bad90){return _0x2bad90;});}return null;};}function removeEntity(_0x481922,_0x243e3f){return function(_0x464daa){if(_0x464daa){return _0x464daa[_0xea13('0x23')]()[_0xea13('0x22')](function(){var _0x155a0e=_0x464daa[_0xea13('0x24')]({'plain':!![]});var _0x2213b9='Scheduler';return db[_0xea13('0x25')]['destroy']({'where':{'type':_0x2213b9,'resourceId':_0x155a0e['id']}})[_0xea13('0x22')](function(){return _0x464daa;});})[_0xea13('0x22')](function(){_0x481922[_0xea13('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462af7,_0x53ec01){return function(_0x1301aa){if(!_0x1301aa){_0x462af7[_0xea13('0x14')](0x194);}return _0x1301aa;};}function handleError(_0x19bd85,_0x2da78f){_0x2da78f=_0x2da78f||0x1f4;return function(_0x520d05){logger['error'](_0x520d05[_0xea13('0x26')]);if(_0x520d05['name']){delete _0x520d05['name'];}_0x19bd85[_0xea13('0x16')](_0x2da78f)[_0xea13('0x27')](_0x520d05);};}exports[_0xea13('0x28')]=function(_0xf3e2b2,_0x222eb1){var _0x1367e9={},_0x11b792={},_0x3430ec={'count':0x0,'rows':[]};var _0xae22fa=_[_0xea13('0x29')](db[_0xea13('0x2a')][_0xea13('0x2b')],function(_0x5a230f){return{'name':_0x5a230f[_0xea13('0x2c')],'type':_0x5a230f[_0xea13('0x2d')][_0xea13('0x2e')]};});_0x11b792[_0xea13('0x2f')]=_[_0xea13('0x29')](_0xae22fa,'name');_0x11b792[_0xea13('0x30')]=_['keys'](_0xf3e2b2[_0xea13('0x30')]);_0x11b792[_0xea13('0x31')]=_[_0xea13('0x32')](_0x11b792[_0xea13('0x2f')],_0x11b792[_0xea13('0x30')]);_0x1367e9['attributes']=_[_0xea13('0x32')](_0x11b792[_0xea13('0x2f')],qs[_0xea13('0x33')](_0xf3e2b2[_0xea13('0x30')][_0xea13('0x33')]));_0x1367e9[_0xea13('0x34')]=_0x1367e9['attributes'][_0xea13('0x35')]?_0x1367e9['attributes']:_0x11b792[_0xea13('0x2f')];if(!_0xf3e2b2[_0xea13('0x30')][_0xea13('0x36')](_0xea13('0x37'))){_0x1367e9[_0xea13('0x1a')]=qs[_0xea13('0x1a')](_0xf3e2b2[_0xea13('0x30')][_0xea13('0x1a')]);_0x1367e9[_0xea13('0x18')]=qs[_0xea13('0x18')](_0xf3e2b2[_0xea13('0x30')][_0xea13('0x18')]);}_0x1367e9[_0xea13('0x38')]=qs['sort'](_0xf3e2b2[_0xea13('0x30')][_0xea13('0x39')]);_0x1367e9[_0xea13('0x3a')]=qs[_0xea13('0x31')](_[_0xea13('0x3b')](_0xf3e2b2['query'],_0x11b792[_0xea13('0x31')]),_0xae22fa);if(_0xf3e2b2['query'][_0xea13('0x3c')]){_0x1367e9[_0xea13('0x3a')]=_[_0xea13('0x3d')](_0x1367e9[_0xea13('0x3a')],{'$or':_['map'](_0xae22fa,function(_0x3fb072){if(_0x3fb072['type']!==_0xea13('0x3e')){var _0x4b2294={};_0x4b2294[_0x3fb072['name']]={'$like':'%'+_0xf3e2b2[_0xea13('0x30')][_0xea13('0x3c')]+'%'};return _0x4b2294;}})});}_0x1367e9=_[_0xea13('0x3d')]({},_0x1367e9,_0xf3e2b2[_0xea13('0x3f')]);var _0x4440af={'where':_0x1367e9[_0xea13('0x3a')]};return db[_0xea13('0x2a')][_0xea13('0x1b')](_0x4440af)[_0xea13('0x22')](function(_0x591d43){_0x3430ec[_0xea13('0x1b')]=_0x591d43;if(_0xf3e2b2[_0xea13('0x30')][_0xea13('0x40')]){_0x1367e9[_0xea13('0x41')]=[{'all':!![]}];}return db[_0xea13('0x2a')][_0xea13('0x42')](_0x1367e9);})[_0xea13('0x22')](function(_0x59ebfb){_0x3430ec[_0xea13('0x43')]=_0x59ebfb;return _0x3430ec;})[_0xea13('0x22')](respondWithFilteredResult(_0x222eb1,_0x1367e9))[_0xea13('0x44')](handleError(_0x222eb1,null));};exports['show']=function(_0xf60171,_0x2007ac){var _0x5038ff={'raw':![],'where':{'id':_0xf60171[_0xea13('0x45')]['id']}},_0x254fc0={};_0x254fc0['model']=_[_0xea13('0x46')](db[_0xea13('0x2a')][_0xea13('0x2b')]);_0x254fc0[_0xea13('0x30')]=_['keys'](_0xf60171[_0xea13('0x30')]);_0x254fc0[_0xea13('0x31')]=_[_0xea13('0x32')](_0x254fc0[_0xea13('0x2f')],_0x254fc0[_0xea13('0x30')]);_0x5038ff['attributes']=_['intersection'](_0x254fc0[_0xea13('0x2f')],qs[_0xea13('0x33')](_0xf60171[_0xea13('0x30')][_0xea13('0x33')]));_0x5038ff[_0xea13('0x34')]=_0x5038ff[_0xea13('0x34')]['length']?_0x5038ff[_0xea13('0x34')]:_0x254fc0['model'];if(_0xf60171['query'][_0xea13('0x40')]){_0x5038ff[_0xea13('0x41')]=[{'all':!![]}];}_0x5038ff=_[_0xea13('0x3d')]({},_0x5038ff,_0xf60171[_0xea13('0x3f')]);return db[_0xea13('0x2a')][_0xea13('0x47')](_0x5038ff)[_0xea13('0x22')](handleEntityNotFound(_0x2007ac,null))[_0xea13('0x22')](respondWithResult(_0x2007ac,null))['catch'](handleError(_0x2007ac,null));};exports['create']=function(_0x3ca675,_0x4165b1){return db['Schedule']['create'](_0x3ca675[_0xea13('0x48')],{})[_0xea13('0x22')](function(_0xd9bd61){var _0x6c85af=_0x3ca675[_0xea13('0x49')][_0xea13('0x24')]({'plain':!![]});if(!_0x6c85af)throw new Error(_0xea13('0x4a'));if(_0x6c85af[_0xea13('0x4b')]===_0xea13('0x49')){var _0x1dbef5=_0xd9bd61[_0xea13('0x24')]({'plain':!![]});var _0x440e23=_0xea13('0x4c');return db[_0xea13('0x4d')][_0xea13('0x47')]({'where':{'name':_0x440e23,'userProfileId':_0x6c85af[_0xea13('0x4e')]},'raw':!![]})[_0xea13('0x22')](function(_0x35d013){if(_0x35d013&&_0x35d013[_0xea13('0x4f')]===0x0){return db[_0xea13('0x25')][_0xea13('0x50')]({'name':_0x1dbef5[_0xea13('0x51')],'resourceId':_0x1dbef5['id'],'type':_0x35d013[_0xea13('0x51')],'sectionId':_0x35d013['id']},{})['then'](function(){return _0xd9bd61;});}else{return _0xd9bd61;}})[_0xea13('0x44')](function(_0x2d7ba9){logger[_0xea13('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d7ba9);throw _0x2d7ba9;});}return _0xd9bd61;})[_0xea13('0x22')](respondWithResult(_0x4165b1,0xc9))[_0xea13('0x44')](handleError(_0x4165b1,null));};exports[_0xea13('0x21')]=function(_0x4cca98,_0x287628){if(_0x4cca98[_0xea13('0x48')]['id']){delete _0x4cca98[_0xea13('0x48')]['id'];}return db[_0xea13('0x2a')][_0xea13('0x47')]({'where':{'id':_0x4cca98[_0xea13('0x45')]['id']}})[_0xea13('0x22')](handleEntityNotFound(_0x287628,null))[_0xea13('0x22')](saveUpdates(_0x4cca98[_0xea13('0x48')],null))[_0xea13('0x22')](respondWithResult(_0x287628,null))[_0xea13('0x44')](handleError(_0x287628,null));};exports[_0xea13('0x23')]=function(_0x269140,_0xa5f304){return db[_0xea13('0x2a')][_0xea13('0x47')]({'where':{'id':_0x269140[_0xea13('0x45')]['id']}})[_0xea13('0x22')](handleEntityNotFound(_0xa5f304,null))[_0xea13('0x22')](removeEntity(_0xa5f304,null))[_0xea13('0x44')](handleError(_0xa5f304,null));};exports['run']=function(_0x106154,_0x228501,_0xf0c62e){var _0x22c02a=require(_0xea13('0x53'));return db[_0xea13('0x2a')][_0xea13('0x47')]({'where':{'id':_0x106154[_0xea13('0x45')]['id']},'raw':!![]})[_0xea13('0x22')](handleEntityNotFound(_0x228501,null))[_0xea13('0x22')](function(){_0x22c02a[_0xea13('0x54')](_0x106154[_0xea13('0x45')]['id']);})['then'](respondWithStatusCode(_0x228501,null))[_0xea13('0x44')](handleError(_0x228501,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index e3e2b2b..59eb04d 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 _0xac92=['bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x1ebae9,_0x38f134){var _0xb9fc5f=function(_0x1a85ca){while(--_0x1a85ca){_0x1ebae9['push'](_0x1ebae9['shift']());}};_0xb9fc5f(++_0x38f134);}(_0xac92,0x1dd));var _0x2ac9=function(_0xe09751,_0xe960e8){_0xe09751=_0xe09751-0x0;var _0xd33a4b=_0xac92[_0xe09751];return _0xd33a4b;};'use strict';var _=require(_0x2ac9('0x0'));var util=require(_0x2ac9('0x1'));var logger=require(_0x2ac9('0x2'))(_0x2ac9('0x3'));var moment=require('moment');var BPromise=require(_0x2ac9('0x4'));var rp=require(_0x2ac9('0x5'));var fs=require('fs');var path=require(_0x2ac9('0x6'));var rimraf=require('rimraf');var config=require(_0x2ac9('0x7'));var attributes=require(_0x2ac9('0x8'));module[_0x2ac9('0x9')]=function(_0x2311ed,_0x50a0fe){return _0x2311ed[_0x2ac9('0xa')](_0x2ac9('0xb'),attributes,{'tableName':_0x2ac9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e23=['../../config/environment','exports','define','Schedule','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x5e23,0x122));var _0x35e2=function(_0x262b9a,_0x32e45e){_0x262b9a=_0x262b9a-0x0;var _0x192352=_0x5e23[_0x262b9a];return _0x192352;};'use strict';var _=require(_0x35e2('0x0'));var util=require('util');var logger=require(_0x35e2('0x1'))('api');var moment=require(_0x35e2('0x2'));var BPromise=require(_0x35e2('0x3'));var rp=require(_0x35e2('0x4'));var fs=require('fs');var path=require(_0x35e2('0x5'));var rimraf=require(_0x35e2('0x6'));var config=require(_0x35e2('0x7'));var attributes=require('./schedule.attributes');module[_0x35e2('0x8')]=function(_0x3a2449,_0x119571){return _0x3a2449[_0x35e2('0x9')](_0x35e2('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 18ee3cf..7c67cbd 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 _0xee8c=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s','message','info','catch','lodash'];(function(_0x396bae,_0x2b5bb0){var _0x481bda=function(_0x1dd156){while(--_0x1dd156){_0x396bae['push'](_0x396bae['shift']());}};_0x481bda(++_0x2b5bb0);}(_0xee8c,0x1a1));var _0xcee8=function(_0x16068b,_0x3c2737){_0x16068b=_0x16068b-0x0;var _0x55fa62=_0xee8c[_0x16068b];return _0x55fa62;};'use strict';var _=require(_0xcee8('0x0'));var util=require(_0xcee8('0x1'));var moment=require(_0xcee8('0x2'));var BPromise=require('bluebird');var rs=require(_0xcee8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcee8('0x4'))['db'];var utils=require(_0xcee8('0x5'));var logger=require(_0xcee8('0x6'))('rpc');var config=require(_0xcee8('0x7'));var jayson=require(_0xcee8('0x8'));var client=jayson[_0xcee8('0x9')][_0xcee8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c5079,_0x2bc384,_0x58a1ce){return new BPromise(function(_0xb0eff6,_0x276678){return client[_0xcee8('0xb')](_0x3c5079,_0x58a1ce)[_0xcee8('0xc')](function(_0x4d0863){logger['info']('Schedule,\x20%s,\x20%s',_0x2bc384,_0xcee8('0xd'));logger[_0xcee8('0xe')](_0xcee8('0xf'),_0x2bc384,_0xcee8('0xd'),JSON['stringify'](_0x4d0863));if(_0x4d0863[_0xcee8('0x10')]){if(_0x4d0863[_0xcee8('0x10')][_0xcee8('0x11')]===0x1f4){logger[_0xcee8('0x10')](_0xcee8('0x12'),_0x2bc384,_0x4d0863['error'][_0xcee8('0x13')]);return _0x276678(_0x4d0863[_0xcee8('0x10')][_0xcee8('0x13')]);}logger[_0xcee8('0x10')]('Schedule,\x20%s,\x20%s',_0x2bc384,_0x4d0863[_0xcee8('0x10')]['message']);return _0xb0eff6(_0x4d0863[_0xcee8('0x10')][_0xcee8('0x13')]);}else{logger[_0xcee8('0x14')](_0xcee8('0x12'),_0x2bc384,_0xcee8('0xd'));_0xb0eff6(_0x4d0863['result'][_0xcee8('0x13')]);}})[_0xcee8('0x15')](function(_0xae7def){logger[_0xcee8('0x10')](_0xcee8('0x12'),_0x2bc384,_0xae7def);_0x276678(_0xae7def);});});} \ No newline at end of file +var _0xe9ec=['error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1c7692,_0x2c8c7f){var _0x4572df=function(_0xb61b72){while(--_0xb61b72){_0x1c7692['push'](_0x1c7692['shift']());}};_0x4572df(++_0x2c8c7f);}(_0xe9ec,0xbd));var _0xce9e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe9ec[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xce9e('0x0'));var moment=require(_0xce9e('0x1'));var BPromise=require(_0xce9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce9e('0x3'))['db'];var utils=require(_0xce9e('0x4'));var logger=require(_0xce9e('0x5'))(_0xce9e('0x6'));var config=require(_0xce9e('0x7'));var jayson=require(_0xce9e('0x8'));var client=jayson[_0xce9e('0x9')][_0xce9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c810,_0x251751,_0x31f6fe){return new BPromise(function(_0x22e9a8,_0x256f51){return client[_0xce9e('0xb')](_0x39c810,_0x31f6fe)[_0xce9e('0xc')](function(_0x1a7a1b){logger[_0xce9e('0xd')](_0xce9e('0xe'),_0x251751,_0xce9e('0xf'));logger['debug'](_0xce9e('0x10'),_0x251751,_0xce9e('0xf'),JSON[_0xce9e('0x11')](_0x1a7a1b));if(_0x1a7a1b[_0xce9e('0x12')]){if(_0x1a7a1b[_0xce9e('0x12')][_0xce9e('0x13')]===0x1f4){logger[_0xce9e('0x12')](_0xce9e('0xe'),_0x251751,_0x1a7a1b[_0xce9e('0x12')]['message']);return _0x256f51(_0x1a7a1b[_0xce9e('0x12')]['message']);}logger[_0xce9e('0x12')](_0xce9e('0xe'),_0x251751,_0x1a7a1b['error'][_0xce9e('0x14')]);return _0x22e9a8(_0x1a7a1b[_0xce9e('0x12')][_0xce9e('0x14')]);}else{logger[_0xce9e('0xd')]('Schedule,\x20%s,\x20%s',_0x251751,_0xce9e('0xf'));_0x22e9a8(_0x1a7a1b[_0xce9e('0x15')][_0xce9e('0x14')]);}})[_0xce9e('0x16')](function(_0xbdb866){logger['error']('Schedule,\x20%s,\x20%s',_0x251751,_0xbdb866);_0x256f51(_0xbdb866);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b2c62ee..f43dd29 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 _0xf144=['/describe','describe','/:id','isAuthenticated','show','download','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','index','get'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0xf144,0x192));var _0x4f14=function(_0x13c7a7,_0x4cb89b){_0x13c7a7=_0x13c7a7-0x0;var _0x71f76f=_0xf144[_0x13c7a7];return _0x71f76f;};'use strict';var multer=require(_0x4f14('0x0'));var util=require(_0x4f14('0x1'));var path=require(_0x4f14('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f14('0x3'));var router=express[_0x4f14('0x4')]();var fs_extra=require(_0x4f14('0x5'));var auth=require(_0x4f14('0x6'));var interaction=require(_0x4f14('0x7'));var config=require(_0x4f14('0x8'));var controller=require(_0x4f14('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4f14('0xa')]);router[_0x4f14('0xb')](_0x4f14('0xc'),auth['isAuthenticated'](),controller[_0x4f14('0xd')]);router['get'](_0x4f14('0xe'),auth[_0x4f14('0xf')](),controller[_0x4f14('0x10')]);router[_0x4f14('0xb')]('/:id/download',auth[_0x4f14('0xf')](),controller[_0x4f14('0x11')]);router['post']('/',auth[_0x4f14('0xf')](),controller[_0x4f14('0x12')]);router[_0x4f14('0x13')](_0x4f14('0xe'),auth['isAuthenticated'](),controller[_0x4f14('0x14')]);router[_0x4f14('0x15')](_0x4f14('0xe'),auth[_0x4f14('0xf')](),controller[_0x4f14('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0261=['/describe','describe','/:id','get','/:id/download','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated'];(function(_0x56b878,_0x4be9aa){var _0x32b9ec=function(_0x1511ea){while(--_0x1511ea){_0x56b878['push'](_0x56b878['shift']());}};_0x32b9ec(++_0x4be9aa);}(_0x0261,0xd1));var _0x1026=function(_0xb77dfe,_0x39c4c7){_0xb77dfe=_0xb77dfe-0x0;var _0x5e4f5d=_0x0261[_0xb77dfe];return _0x5e4f5d;};'use strict';var multer=require(_0x1026('0x0'));var util=require(_0x1026('0x1'));var path=require('path');var timeout=require(_0x1026('0x2'));var express=require(_0x1026('0x3'));var router=express[_0x1026('0x4')]();var fs_extra=require(_0x1026('0x5'));var auth=require(_0x1026('0x6'));var interaction=require(_0x1026('0x7'));var config=require(_0x1026('0x8'));var controller=require(_0x1026('0x9'));router['get']('/',auth[_0x1026('0xa')](),controller['index']);router['get'](_0x1026('0xb'),auth[_0x1026('0xa')](),controller[_0x1026('0xc')]);router['get'](_0x1026('0xd'),auth[_0x1026('0xa')](),controller['show']);router[_0x1026('0xe')](_0x1026('0xf'),auth[_0x1026('0xa')](),controller['download']);router[_0x1026('0x10')]('/',auth[_0x1026('0xa')](),controller['create']);router[_0x1026('0x11')](_0x1026('0xd'),auth[_0x1026('0xa')](),controller[_0x1026('0x12')]);router[_0x1026('0x13')](_0x1026('0xd'),auth[_0x1026('0xa')](),controller[_0x1026('0x14')]);module[_0x1026('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 712fe13..b293e14 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 _0xaf6e=['subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','INTEGER','setDataValue','startedAt'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x528f77,_0x5138fe){_0x528f77=_0x528f77-0x0;var _0x21cd3b=_0xaf6e[_0x528f77];return _0x21cd3b;};'use strict';var Sequelize=require(_0xeaf6('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xeaf6('0x1'));module[_0xeaf6('0x2')]={'format':{'type':Sequelize[_0xeaf6('0x3')],'get':function(){return this[_0xeaf6('0x4')]('value')?path[_0xeaf6('0x5')](this[_0xeaf6('0x4')](_0xeaf6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xeaf6('0x7')]},'channel':{'type':Sequelize[_0xeaf6('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x595fc8){var _0x4f82d1=_0x595fc8[_0xeaf6('0x8')](/\\/g,'/');this['setDataValue'](_0xeaf6('0x6'),_0x4f82d1);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xeaf6('0x9')],'set':function(_0x3d5ac7){this[_0xeaf6('0xa')](_0xeaf6('0xb'),moment()[_0xeaf6('0xc')](_0x3d5ac7,'ms'));this[_0xeaf6('0xa')](_0xeaf6('0xd'),moment());this[_0xeaf6('0xa')](_0xeaf6('0xe'),_0x3d5ac7);}},'startedAt':{'type':Sequelize[_0xeaf6('0xf')],'get':function(){return moment(this[_0xeaf6('0x4')]('startedAt'))[_0xeaf6('0x10')](_0xeaf6('0x11'))[_0xeaf6('0x12')]();}},'closedAt':{'type':Sequelize[_0xeaf6('0xf')],'get':function(){return moment(this[_0xeaf6('0x4')](_0xeaf6('0xd')))[_0xeaf6('0x10')](_0xeaf6('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xeaf6('0x4')](_0xeaf6('0x13')))[_0xeaf6('0x10')](_0xeaf6('0x11'))[_0xeaf6('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xeaf6('0x4')](_0xeaf6('0x14')))[_0xeaf6('0x10')](_0xeaf6('0x11'))[_0xeaf6('0x12')]();}}}; \ No newline at end of file +var _0xbbdd=['DATE','getDataValue','closedAt','format','updatedAt','moment','../../config/environment','exports','extname','STRING','replace','setDataValue','value','INTEGER','startedAt','subtract','duration','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x44249e,_0x5a0e0c){var _0x333e30=function(_0x248dd7){while(--_0x248dd7){_0x44249e['push'](_0x44249e['shift']());}};_0x333e30(++_0x5a0e0c);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xbbdd[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdbbd('0x0'));var path=require('path');var config=require(_0xdbbd('0x1'));module[_0xdbbd('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0xdbbd('0x3')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xdbbd('0x4')]},'channel':{'type':Sequelize[_0xdbbd('0x4')]},'value':{'type':Sequelize[_0xdbbd('0x4')],'set':function(_0x44beae){var _0x59b866=_0x44beae[_0xdbbd('0x5')](/\\/g,'/');this[_0xdbbd('0x6')](_0xdbbd('0x7'),_0x59b866);}},'rating':{'type':Sequelize[_0xdbbd('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdbbd('0x8')],'set':function(_0x38198c){this[_0xdbbd('0x6')](_0xdbbd('0x9'),moment()[_0xdbbd('0xa')](_0x38198c,'ms'));this[_0xdbbd('0x6')]('closedAt',moment());this[_0xdbbd('0x6')](_0xdbbd('0xb'),_0x38198c);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('startedAt'))['format'](_0xdbbd('0xc'))[_0xdbbd('0xd')]();}},'closedAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this[_0xdbbd('0xf')](_0xdbbd('0x10')))[_0xdbbd('0x11')](_0xdbbd('0xc'))['toString']();}},'createdAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this[_0xdbbd('0xf')]('createdAt'))[_0xdbbd('0x11')](_0xdbbd('0xc'))[_0xdbbd('0xd')]();}},'updatedAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this['getDataValue'](_0xdbbd('0x12')))[_0xdbbd('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xdbbd('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1836012..55cbf43 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 _0x7dfd=['../../components/encryptor','uniqueid','join','%s.cypher','existsSync','decryptFile','secrets','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index','ScreenRecording','fieldName','key','model','map','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','duration','createdAt','closedAt','value','find','describe','download'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7df('0x0'));var rimraf=require(_0xd7df('0x1'));var zipdir=require(_0xd7df('0x2'));var jsonpatch=require(_0xd7df('0x3'));var rp=require(_0xd7df('0x4'));var moment=require(_0xd7df('0x5'));var BPromise=require(_0xd7df('0x6'));var Mustache=require(_0xd7df('0x7'));var util=require(_0xd7df('0x8'));var path=require(_0xd7df('0x9'));var sox=require(_0xd7df('0xa'));var csv=require(_0xd7df('0xb'));var ejs=require(_0xd7df('0xc'));var fs=require('fs');var fs_extra=require(_0xd7df('0xd'));var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xb'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=typeof _0x4c5cf[_0xd7df('0x20')]===_0xd7df('0x21')&&typeof _0x4c5cf['limit']===_0xd7df('0x21');var _0x30ee65=_0x23cdbc[_0xd7df('0x22')];var _0x5210e5=_0x513b13?0x0:_0x4c5cf[_0xd7df('0x20')];var _0x471621=_0x513b13?_0x23cdbc[_0xd7df('0x22')]:_0x4c5cf['offset']+_0x4c5cf[_0xd7df('0x23')];var _0x20dc3e;if(_0x471621>=_0x30ee65){_0x471621=_0x30ee65;_0x20dc3e=0xc8;}else{_0x20dc3e=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x20dc3e);return _0x57b8be['set'](_0xd7df('0x24'),_0x5210e5+'-'+_0x471621+'/'+_0x30ee65)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x225e33){return function(_0x5ab737){try{jsonpatch[_0xd7df('0x25')](_0x5ab737,_0x225e33,!![]);}catch(_0x342b54){return BPromise[_0xd7df('0x26')](_0x342b54);}return _0x5ab737['save']();};}function saveUpdates(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x27')](_0xc50077)[_0xd7df('0x28')](function(_0x29f354){return _0x29f354;});}return null;};}function removeEntity(_0x1c774b,_0xa80cbf){return function(_0x1e3bf3){if(_0x1e3bf3){return _0x1e3bf3['destroy']()['then'](function(){_0x1c774b[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0x26047f,_0x459f11){return function(_0x13f190){if(!_0x13f190){_0x26047f[_0xd7df('0x1c')](0x194);}return _0x13f190;};}function handleError(_0x373359,_0x2b6fde){_0x2b6fde=_0x2b6fde||0x1f4;return function(_0x163904){logger['error'](_0x163904[_0xd7df('0x29')]);if(_0x163904[_0xd7df('0x2a')]){delete _0x163904[_0xd7df('0x2a')];}_0x373359[_0xd7df('0x1d')](_0x2b6fde)[_0xd7df('0x2b')](_0x163904);};}exports[_0xd7df('0x2c')]=function(_0x3f78fa,_0x36de76){var _0x5195cf={},_0x4ba779={},_0x52b56a={'count':0x0,'rows':[]};var _0x58584d=_['map'](db[_0xd7df('0x2d')]['rawAttributes'],function(_0xd366b){return{'name':_0xd366b[_0xd7df('0x2e')],'type':_0xd366b['type'][_0xd7df('0x2f')]};});_0x4ba779[_0xd7df('0x30')]=_['differenceBy'](_[_0xd7df('0x31')](_0x58584d,_0xd7df('0x2a')),[_0xd7df('0x32')]);_0x4ba779[_0xd7df('0x33')]=_[_0xd7df('0x34')](_0x3f78fa[_0xd7df('0x33')]);_0x4ba779['filters']=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],_0x4ba779[_0xd7df('0x33')]);_0x5195cf[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5195cf[_0xd7df('0x36')]=_0x5195cf[_0xd7df('0x36')]['length']?_0x5195cf['attributes']:_0x4ba779[_0xd7df('0x30')];if(!_0x3f78fa['query'][_0xd7df('0x38')](_0xd7df('0x39'))){_0x5195cf[_0xd7df('0x23')]=qs[_0xd7df('0x23')](_0x3f78fa['query']['limit']);_0x5195cf['offset']=qs[_0xd7df('0x20')](_0x3f78fa[_0xd7df('0x33')]['offset']);}_0x5195cf[_0xd7df('0x3a')]=qs[_0xd7df('0x3b')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3b')]);_0x5195cf['where']=qs[_0xd7df('0x3c')](_[_0xd7df('0x3d')](_0x3f78fa['query'],_0x4ba779[_0xd7df('0x3c')]),_0x58584d);if(_0x3f78fa['query'][_0xd7df('0x3e')]){_0x5195cf[_0xd7df('0x3f')]=_[_0xd7df('0x40')](_0x5195cf['where'],{'$or':_[_0xd7df('0x31')](_0x58584d,function(_0x2a7252){if(_0x2a7252[_0xd7df('0x41')]!==_0xd7df('0x42')){var _0x54ea42={};_0x54ea42[_0x2a7252[_0xd7df('0x2a')]]={'$like':'%'+_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3e')]+'%'};return _0x54ea42;}})});}_0x5195cf=_['merge']({},_0x5195cf,_0x3f78fa[_0xd7df('0x43')]);var _0x207852={'where':_0x5195cf[_0xd7df('0x3f')]};return db['ScreenRecording'][_0xd7df('0x22')](_0x207852)[_0xd7df('0x28')](function(_0x4910cb){_0x52b56a['count']=_0x4910cb;if(_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5195cf[_0xd7df('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x5195cf);})[_0xd7df('0x28')](function(_0x4ebdbe){_0x52b56a[_0xd7df('0x46')]=_0x4ebdbe;return _0x52b56a;})['then'](respondWithFilteredResult(_0x36de76,_0x5195cf))['catch'](handleError(_0x36de76,null));};exports[_0xd7df('0x47')]=function(_0x579d0f,_0x18ef10){var _0x5302f4={'raw':![],'where':{'id':_0x579d0f[_0xd7df('0x48')]['id']}},_0xad2d69={};_0xad2d69[_0xd7df('0x30')]=_[_0xd7df('0x34')](db[_0xd7df('0x2d')][_0xd7df('0x49')]);_0xad2d69[_0xd7df('0x33')]=_['keys'](_0x579d0f[_0xd7df('0x33')]);_0xad2d69['filters']=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],_0xad2d69[_0xd7df('0x33')]);_0x5302f4[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x579d0f[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5302f4['attributes']=_0x5302f4[_0xd7df('0x36')][_0xd7df('0x4a')]?_0x5302f4['attributes']:_0xad2d69['model'];if(_0x579d0f[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5302f4[_0xd7df('0x45')]=[{'all':!![]}];}_0x5302f4=_['merge']({},_0x5302f4,_0x579d0f['options']);return db[_0xd7df('0x2d')]['find'](_0x5302f4)[_0xd7df('0x28')](handleEntityNotFound(_0x18ef10,null))[_0xd7df('0x28')](respondWithResult(_0x18ef10,null))[_0xd7df('0x4b')](handleError(_0x18ef10,null));};exports[_0xd7df('0x4c')]=function(_0x1838aa,_0x28c13f){return db[_0xd7df('0x2d')][_0xd7df('0x4c')](_0x1838aa[_0xd7df('0x4d')],{})[_0xd7df('0x28')](respondWithResult(_0x28c13f,0xc9))[_0xd7df('0x4b')](handleError(_0x28c13f,null));};exports[_0xd7df('0x27')]=function(_0x54222c,_0x1f2f99){if(_0x54222c[_0xd7df('0x4d')]['id']){delete _0x54222c[_0xd7df('0x4d')]['id'];}delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x4e')];delete _0x54222c['body'][_0xd7df('0x4f')];delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x50')];delete _0x54222c['body'][_0xd7df('0x51')];return db['ScreenRecording'][_0xd7df('0x52')]({'where':{'id':_0x54222c[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x1f2f99,null))[_0xd7df('0x28')](saveUpdates(_0x54222c[_0xd7df('0x4d')],null))['then'](respondWithResult(_0x1f2f99,null))['catch'](handleError(_0x1f2f99,null));};exports['describe']=function(_0xe4b221,_0x4a6cf5){return db[_0xd7df('0x2d')][_0xd7df('0x53')]()[_0xd7df('0x28')](respondWithResult(_0x4a6cf5,null))[_0xd7df('0x4b')](handleError(_0x4a6cf5,null));};exports[_0xd7df('0x54')]=function(_0x418da,_0xf72803,_0xb054d7){var _0x453876=require(_0xd7df('0x55'));var _0x382d11=![];var _0x327365={};if(_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]&&_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]==='uniqueid'){_0x327365[_0xd7df('0x56')]=_0x418da[_0xd7df('0x48')]['id'];}else{_0x327365['id']=_0x418da['params']['id'];}return db['ScreenRecording'][_0xd7df('0x52')]({'where':_0x327365,'attributes':['id','value'],'raw':!![]})[_0xd7df('0x28')](handleEntityNotFound(_0xf72803,null))['then'](function(_0x1f34c2){if(_0x1f34c2){var _0x28151a=path[_0xd7df('0x57')](config['root'],'server/files/screen_recordings',_0x1f34c2['value']);var _0x3666ba=util[_0xd7df('0x32')](_0xd7df('0x58'),_0x28151a);if(fs[_0xd7df('0x59')](_0x3666ba)){_0x382d11=!![];return _0x453876[_0xd7df('0x5a')](_0x3666ba,_0x28151a,config[_0xd7df('0x5b')]['recording'])[_0xd7df('0x28')](function(){return _0x1f34c2;});}return _0x1f34c2;}})[_0xd7df('0x28')](function(_0x35204f){if(_0x35204f){var _0x25d187=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x35204f[_0xd7df('0x51')]);if(!fs[_0xd7df('0x59')](_0x25d187)){throw new db[(_0xd7df('0x5e'))][(_0xd7df('0x5f'))](_0xd7df('0x60'));}if(_0x35204f[_0xd7df('0x61')]){return _0xf72803[_0xd7df('0x54')](_0x25d187,_0x35204f[_0xd7df('0x61')]+path[_0xd7df('0x62')](_0x25d187),function(){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}else{return _0xf72803[_0xd7df('0x54')](_0x25d187,function(_0x3f2775){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}}})[_0xd7df('0x4b')](function(_0x393a3a){if(_0x393a3a[_0xd7df('0x64')]===_0xd7df('0x60')){_0xf72803[_0xd7df('0x1d')](0x194)[_0xd7df('0x2b')]('Not\x20found');}else{return handleError(_0xf72803,null);}});};exports['destroy']=function(_0x327402,_0x28f550){return db[_0xd7df('0x2d')]['find']({'where':{'id':_0x327402[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](function(_0x1e87aa){if(_[_0xd7df('0x65')](_0x1e87aa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1e87aa;})[_0xd7df('0x28')](function(_0x20ad50){var _0xb06a56=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x20ad50[_0xd7df('0x51')]);logger[_0xd7df('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0xb06a56);if(!_[_0xd7df('0x65')](_0x20ad50[_0xd7df('0x51')])&&fs['existsSync'](_0xb06a56)){logger['info']('File:\x20\x22'+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}_0xb06a56=_0xb06a56+_0xd7df('0x69');if(!_[_0xd7df('0x65')](_0x20ad50['value'])&&fs[_0xd7df('0x59')](_0xb06a56)){logger[_0xd7df('0x66')](_0xd7df('0x6a')+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}return _0x20ad50;})[_0xd7df('0x28')](function(_0x4124b8){if(!_0x4124b8)throw new InternalError();return _0x4124b8['destroy']();})['then'](function(){_0x28f550[_0xd7df('0x1d')](0xcc)['end']();})[_0xd7df('0x4b')](handleError(_0x28f550,null));}; \ No newline at end of file +var _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x9fd9a,_0x4f4b1e){var _0x1d66f2=function(_0x10fa7c){while(--_0x10fa7c){_0x9fd9a['push'](_0x9fd9a['shift']());}};_0x1d66f2(++_0x4f4b1e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x311c42,_0x12b97b){_0x311c42=_0x311c42-0x0;var _0x38eda0=_0xe5b3[_0x311c42];return _0x38eda0;};'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(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b965207..d2cf969 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 _0x3fda=['define','ScreenRecording','screen_recordings','interactionid','util','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x2f5592,_0x3e145){var _0x57bbba=function(_0x4c2b7d){while(--_0x4c2b7d){_0x2f5592['push'](_0x2f5592['shift']());}};_0x57bbba(++_0x3e145);}(_0x3fda,0xd0));var _0xa3fd=function(_0x372882,_0x2695a6){_0x372882=_0x372882-0x0;var _0x395600=_0x3fda[_0x372882];return _0x395600;};'use strict';var _=require('lodash');var util=require(_0xa3fd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa3fd('0x1'));var BPromise=require(_0xa3fd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3fd('0x3'));var rimraf=require(_0xa3fd('0x4'));var config=require(_0xa3fd('0x5'));var attributes=require(_0xa3fd('0x6'));module[_0xa3fd('0x7')]=function(_0x25ca57,_0x52a8b9){return _0x25ca57[_0xa3fd('0x8')](_0xa3fd('0x9'),attributes,{'tableName':_0xa3fd('0xa'),'paranoid':![],'indexes':[{'name':_0xa3fd('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x90ca=['../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','rimraf'];(function(_0x5ec7f0,_0x311b7d){var _0x3619f1=function(_0x201ddd){while(--_0x201ddd){_0x5ec7f0['push'](_0x5ec7f0['shift']());}};_0x3619f1(++_0x311b7d);}(_0x90ca,0x1f2));var _0xa90c=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x90ca[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xa90c('0x0'));var util=require(_0xa90c('0x1'));var logger=require('../../config/logger')(_0xa90c('0x2'));var moment=require(_0xa90c('0x3'));var BPromise=require(_0xa90c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa90c('0x5'));var config=require(_0xa90c('0x6'));var attributes=require(_0xa90c('0x7'));module[_0xa90c('0x8')]=function(_0x188491,_0x52c03d){return _0x188491['define'](_0xa90c('0x9'),attributes,{'tableName':_0xa90c('0xa'),'paranoid':![],'indexes':[{'name':_0xa90c('0xb'),'fields':[_0xa90c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 5e6578a..75bf83e 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 _0x015a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util'];(function(_0x2a2938,_0x2dea11){var _0x144585=function(_0x582ab6){while(--_0x582ab6){_0x2a2938['push'](_0x2a2938['shift']());}};_0x144585(++_0x2dea11);}(_0x015a,0x1cc));var _0xa015=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x015a[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xa015('0x0'));var util=require(_0xa015('0x1'));var moment=require(_0xa015('0x2'));var BPromise=require(_0xa015('0x3'));var rs=require(_0xa015('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa015('0x5'))['db'];var utils=require(_0xa015('0x6'));var logger=require(_0xa015('0x7'))(_0xa015('0x8'));var config=require('../../config/environment');var jayson=require(_0xa015('0x9'));var client=jayson[_0xa015('0xa')][_0xa015('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37c9d6,_0x207d31,_0x520686){return new BPromise(function(_0x170e48,_0x43edee){return client[_0xa015('0xc')](_0x37c9d6,_0x520686)[_0xa015('0xd')](function(_0x3db85d){logger['info'](_0xa015('0xe'),_0x207d31,_0xa015('0xf'));logger[_0xa015('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x207d31,_0xa015('0xf'),JSON[_0xa015('0x11')](_0x3db85d));if(_0x3db85d[_0xa015('0x12')]){if(_0x3db85d[_0xa015('0x12')][_0xa015('0x13')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x207d31,_0x3db85d['error']['message']);return _0x43edee(_0x3db85d['error'][_0xa015('0x14')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x207d31,_0x3db85d[_0xa015('0x12')][_0xa015('0x14')]);return _0x170e48(_0x3db85d[_0xa015('0x12')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x207d31,_0xa015('0xf'));_0x170e48(_0x3db85d['result']['message']);}})[_0xa015('0x15')](function(_0x47745a){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x207d31,_0x47745a);_0x43edee(_0x47745a);});});} \ No newline at end of file +var _0x0ea7=['rpc','../../config/environment','client','request','then','info','request\x20sent','debug','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x0ea7,0x173));var _0x70ea=function(_0x83d5a9,_0x400d42){_0x83d5a9=_0x83d5a9-0x0;var _0x508e7d=_0x0ea7[_0x83d5a9];return _0x508e7d;};'use strict';var _=require(_0x70ea('0x0'));var util=require(_0x70ea('0x1'));var moment=require(_0x70ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x70ea('0x3'));var fs=require('fs');var Redis=require(_0x70ea('0x4'));var db=require(_0x70ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x70ea('0x6'))(_0x70ea('0x7'));var config=require(_0x70ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23d382,_0x1d3b23,_0x7fcee0){return new BPromise(function(_0x455639,_0x586a84){return client[_0x70ea('0xa')](_0x23d382,_0x7fcee0)[_0x70ea('0xb')](function(_0xdbdac1){logger[_0x70ea('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x1d3b23,_0x70ea('0xd'));logger[_0x70ea('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1d3b23,_0x70ea('0xd'),JSON['stringify'](_0xdbdac1));if(_0xdbdac1['error']){if(_0xdbdac1[_0x70ea('0xf')][_0x70ea('0x10')]===0x1f4){logger[_0x70ea('0xf')](_0x70ea('0x11'),_0x1d3b23,_0xdbdac1[_0x70ea('0xf')][_0x70ea('0x12')]);return _0x586a84(_0xdbdac1[_0x70ea('0xf')][_0x70ea('0x12')]);}logger[_0x70ea('0xf')](_0x70ea('0x11'),_0x1d3b23,_0xdbdac1['error'][_0x70ea('0x12')]);return _0x455639(_0xdbdac1[_0x70ea('0xf')][_0x70ea('0x12')]);}else{logger[_0x70ea('0xc')](_0x70ea('0x11'),_0x1d3b23,_0x70ea('0xd'));_0x455639(_0xdbdac1[_0x70ea('0x13')][_0x70ea('0x12')]);}})[_0x70ea('0x14')](function(_0x45620b){logger[_0x70ea('0xf')](_0x70ea('0x11'),_0x1d3b23,_0x45620b);_0x586a84(_0x45620b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7bfd549..58be895 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 _0xc0bf=['isAuthenticated','index','/now','getDate','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','single','file','logologin','addPreferred','addFavicon','put','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get'];(function(_0x30f3c3,_0x2db7b1){var _0x3327ab=function(_0x1bc7ad){while(--_0x1bc7ad){_0x30f3c3['push'](_0x30f3c3['shift']());}};_0x3327ab(++_0x2db7b1);}(_0xc0bf,0xc4));var _0xfc0b=function(_0x566587,_0x1be561){_0x566587=_0x566587-0x0;var _0x27d817=_0xc0bf[_0x566587];return _0x27d817;};'use strict';var multer=require('multer');var util=require(_0xfc0b('0x0'));var path=require(_0xfc0b('0x1'));var timeout=require(_0xfc0b('0x2'));var express=require('express');var router=express[_0xfc0b('0x3')]();var fs_extra=require(_0xfc0b('0x4'));var auth=require(_0xfc0b('0x5'));var interaction=require(_0xfc0b('0x6'));var config=require('../../config/environment');var controller=require(_0xfc0b('0x7'));router[_0xfc0b('0x8')]('/',auth[_0xfc0b('0x9')](),controller[_0xfc0b('0xa')]);router[_0xfc0b('0x8')](_0xfc0b('0xb'),controller[_0xfc0b('0xc')]);router[_0xfc0b('0x8')](_0xfc0b('0xd'),controller[_0xfc0b('0xe')]);router[_0xfc0b('0x8')]('/:id/logo',controller['getLogo']);router[_0xfc0b('0x8')](_0xfc0b('0xf'),controller[_0xfc0b('0x10')]);router[_0xfc0b('0x8')](_0xfc0b('0x11'),controller[_0xfc0b('0x12')]);router['get'](_0xfc0b('0x13'),controller[_0xfc0b('0x14')]);router[_0xfc0b('0x8')](_0xfc0b('0x15'),controller[_0xfc0b('0x16')]);var upload=multer({'storage':multer[_0xfc0b('0x17')]({'destination':function(_0x3f69a1,_0x792f46,_0x34ecab){_0x34ecab(null,path[_0xfc0b('0x18')](config[_0xfc0b('0x19')],_0xfc0b('0x1a')));},'filename':function(_0x2bb957,_0xd3d899,_0x5641a9){_0x5641a9(null,util[_0xfc0b('0x1b')](_0xfc0b('0x1c'),_0xfc0b('0x1d'),path[_0xfc0b('0x1e')](_0xd3d899[_0xfc0b('0x1f')])));}})});router[_0xfc0b('0x20')](_0xfc0b('0x21'),upload[_0xfc0b('0x22')](_0xfc0b('0x23')),controller['addLogo']);var upload=multer({'storage':multer[_0xfc0b('0x17')]({'destination':function(_0x23807f,_0x29a7b2,_0x5ed212){_0x5ed212(null,path[_0xfc0b('0x18')](config[_0xfc0b('0x19')],_0xfc0b('0x1a')));},'filename':function(_0x18ebf7,_0x32af29,_0x4e0415){_0x4e0415(null,util[_0xfc0b('0x1b')]('%s%s',_0xfc0b('0x24'),path['extname'](_0x32af29[_0xfc0b('0x1f')])));}})});router[_0xfc0b('0x20')](_0xfc0b('0xf'),upload['single'](_0xfc0b('0x23')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xfc0b('0x17')]({'destination':function(_0x1fdd96,_0x370650,_0x543947){_0x543947(null,path[_0xfc0b('0x18')](config[_0xfc0b('0x19')],_0xfc0b('0x1a')));},'filename':function(_0x4fe970,_0x1cc849,_0x8eed7a){_0x8eed7a(null,util['format']('%s%s','preferred',path[_0xfc0b('0x1e')](_0x1cc849[_0xfc0b('0x1f')])));}})});router[_0xfc0b('0x20')](_0xfc0b('0x13'),upload[_0xfc0b('0x22')](_0xfc0b('0x23')),controller[_0xfc0b('0x25')]);var upload=multer({'storage':multer[_0xfc0b('0x17')]({'destination':function(_0x487f96,_0x20abe0,_0x382401){_0x382401(null,path[_0xfc0b('0x18')](config[_0xfc0b('0x19')],'server/files/images/logos/'));},'filename':function(_0x54013f,_0x2f698c,_0xdde56b){_0xdde56b(null,util[_0xfc0b('0x1b')]('%s%s','favicon',path['extname'](_0x2f698c[_0xfc0b('0x1f')])));}})});router[_0xfc0b('0x20')](_0xfc0b('0x15'),upload[_0xfc0b('0x22')](_0xfc0b('0x23')),controller[_0xfc0b('0x26')]);router[_0xfc0b('0x27')]('/:id',auth[_0xfc0b('0x9')](),controller['update']);module[_0xfc0b('0x28')]=router; \ No newline at end of file +var _0x5f38=['logo','extname','originalname','post','single','file','addLogo','root','logologin','/:id/logo_login','addLogoLogin','preferred','/:id/preferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x5f38,0x1cb));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85f3('0x0'));var util=require('util');var path=require(_0x85f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x85f3('0x2'));var router=express[_0x85f3('0x3')]();var fs_extra=require(_0x85f3('0x4'));var auth=require(_0x85f3('0x5'));var interaction=require(_0x85f3('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x85f3('0x7')]('/',auth[_0x85f3('0x8')](),controller[_0x85f3('0x9')]);router[_0x85f3('0x7')](_0x85f3('0xa'),controller[_0x85f3('0xb')]);router[_0x85f3('0x7')](_0x85f3('0xc'),controller[_0x85f3('0xd')]);router[_0x85f3('0x7')](_0x85f3('0xe'),controller[_0x85f3('0xf')]);router['get']('/:id/logo_login',controller[_0x85f3('0x10')]);router[_0x85f3('0x7')](_0x85f3('0x11'),controller[_0x85f3('0x12')]);router['get']('/:id/preferred',controller['getPreferred']);router[_0x85f3('0x7')]('/:id/favicon',controller[_0x85f3('0x13')]);var upload=multer({'storage':multer[_0x85f3('0x14')]({'destination':function(_0x5dd6bf,_0x4897d6,_0x5f5330){_0x5f5330(null,path[_0x85f3('0x15')](config['root'],_0x85f3('0x16')));},'filename':function(_0xd8393d,_0x4d8302,_0x2f7b71){_0x2f7b71(null,util[_0x85f3('0x17')](_0x85f3('0x18'),_0x85f3('0x19'),path[_0x85f3('0x1a')](_0x4d8302[_0x85f3('0x1b')])));}})});router[_0x85f3('0x1c')]('/:id/logo',upload[_0x85f3('0x1d')](_0x85f3('0x1e')),controller[_0x85f3('0x1f')]);var upload=multer({'storage':multer[_0x85f3('0x14')]({'destination':function(_0x624838,_0x1f6062,_0x1523e6){_0x1523e6(null,path[_0x85f3('0x15')](config[_0x85f3('0x20')],'server/files/images/logos/'));},'filename':function(_0x39af17,_0x5e5cfe,_0x59b2dc){_0x59b2dc(null,util[_0x85f3('0x17')](_0x85f3('0x18'),_0x85f3('0x21'),path[_0x85f3('0x1a')](_0x5e5cfe[_0x85f3('0x1b')])));}})});router[_0x85f3('0x1c')](_0x85f3('0x22'),upload[_0x85f3('0x1d')](_0x85f3('0x1e')),controller[_0x85f3('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x423c9d,_0x297d11,_0x34b00e){_0x34b00e(null,path[_0x85f3('0x15')](config[_0x85f3('0x20')],'server/files/images/logos/'));},'filename':function(_0x311c20,_0x432903,_0x422be0){_0x422be0(null,util[_0x85f3('0x17')]('%s%s',_0x85f3('0x24'),path['extname'](_0x432903[_0x85f3('0x1b')])));}})});router[_0x85f3('0x1c')](_0x85f3('0x25'),upload[_0x85f3('0x1d')](_0x85f3('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0x85f3('0x14')]({'destination':function(_0x2fc196,_0x2794aa,_0x2455b0){_0x2455b0(null,path[_0x85f3('0x15')](config[_0x85f3('0x20')],_0x85f3('0x16')));},'filename':function(_0x1b0aa2,_0x270576,_0x5b0c1d){_0x5b0c1d(null,util[_0x85f3('0x17')](_0x85f3('0x18'),_0x85f3('0x26'),path[_0x85f3('0x1a')](_0x270576[_0x85f3('0x1b')])));}})});router[_0x85f3('0x1c')](_0x85f3('0x27'),upload['single'](_0x85f3('0x1e')),controller[_0x85f3('0x28')]);router[_0x85f3('0x29')](_0x85f3('0xc'),auth[_0x85f3('0x8')](),controller[_0x85f3('0x2a')]);module[_0x85f3('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 afe3728..45ed878 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 _0xd131=['UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0xd131,0x1b9));var _0x1d13=function(_0x30f1e2,_0x3814c3){_0x30f1e2=_0x30f1e2-0x0;var _0x141b56=_0xd131[_0x30f1e2];return _0x141b56;};'use strict';var Sequelize=require(_0x1d13('0x0'));module[_0x1d13('0x1')]={'min_internal':{'type':Sequelize[_0x1d13('0x2')](0xb),'unique':_0x1d13('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x1d13('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1d13('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x1d13('0x5')},'logo':{'type':Sequelize[_0x1d13('0x6')]},'defaultLogo':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1d13('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1d13('0x6')]},'turnaddr':{'type':Sequelize[_0x1d13('0x6')]},'turnusername':{'type':Sequelize[_0x1d13('0x6')]},'turnpassword':{'type':Sequelize[_0x1d13('0x6')]},'pageTitle':{'type':Sequelize[_0x1d13('0x6')]},'defaultPageTitle':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1d13('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x1d13('0x8')},'enableEmailPreview':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1d13('0x6')],'defaultValue':_0x1d13('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1d13('0x6')]},'defaultPreferred':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1d13('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1d13('0x6')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1d13('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1d13('0x2')]},'sentimentRegion':{'type':Sequelize[_0x1d13('0x6')]},'language':{'type':Sequelize[_0x1d13('0x6')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x1d13('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x1d13('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1d13('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x1d13('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1d13('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1d13('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb654=['sequelize','exports','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x5f515d,_0x405531){var _0x3751de=function(_0xd85c55){while(--_0xd85c55){_0x5f515d['push'](_0x5f515d['shift']());}};_0x3751de(++_0x405531);}(_0xb654,0xab));var _0x4b65=function(_0x1e7fb8,_0x5d4001){_0x1e7fb8=_0x1e7fb8-0x0;var _0xc8e860=_0xb654[_0x1e7fb8];return _0xc8e860;};'use strict';var Sequelize=require(_0x4b65('0x0'));module[_0x4b65('0x1')]={'min_internal':{'type':Sequelize[_0x4b65('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4b65('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4b65('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4b65('0x3')],'defaultValue':_0x4b65('0x4')},'logo':{'type':Sequelize[_0x4b65('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4b65('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x4b65('0x3')]},'turnusername':{'type':Sequelize[_0x4b65('0x3')]},'turnpassword':{'type':Sequelize[_0x4b65('0x3')]},'pageTitle':{'type':Sequelize[_0x4b65('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4b65('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x4b65('0x6')},'enableEmailPreview':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4b65('0x3')],'defaultValue':_0x4b65('0x7')},'chatTimeout':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4b65('0x3')]},'defaultPreferred':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4b65('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4b65('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4b65('0x2')]},'transcribeRegion':{'type':Sequelize[_0x4b65('0x3')]},'sentiment':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4b65('0x2')]},'sentimentRegion':{'type':Sequelize[_0x4b65('0x3')]},'language':{'type':Sequelize[_0x4b65('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4b65('0x2')](0x2)[_0x4b65('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4b65('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x4b65('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x4b65('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x4b65('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index e2966c1..de84ea8 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 _0xd2ba=['getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','sendStatus','stack','name','index','map','Setting','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','options','find','body','params','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xd2ba,0x108));var _0xad2b=function(_0x4523db,_0x3dcac5){_0x4523db=_0x4523db-0x0;var _0x481dd7=_0xd2ba[_0x4523db];return _0x481dd7;};'use strict';var emlformat=require(_0xad2b('0x0'));var rimraf=require(_0xad2b('0x1'));var zipdir=require(_0xad2b('0x2'));var jsonpatch=require(_0xad2b('0x3'));var rp=require('request-promise');var moment=require(_0xad2b('0x4'));var BPromise=require(_0xad2b('0x5'));var Mustache=require(_0xad2b('0x6'));var util=require(_0xad2b('0x7'));var path=require(_0xad2b('0x8'));var sox=require('sox');var csv=require(_0xad2b('0x9'));var ejs=require(_0xad2b('0xa'));var fs=require('fs');var fs_extra=require(_0xad2b('0xb'));var _=require(_0xad2b('0xc'));var squel=require(_0xad2b('0xd'));var crypto=require(_0xad2b('0xe'));var jsforce=require(_0xad2b('0xf'));var deskjs=require(_0xad2b('0x10'));var toCsv=require(_0xad2b('0x9'));var querystring=require(_0xad2b('0x11'));var Papa=require('papaparse');var Redis=require(_0xad2b('0x12'));var authService=require(_0xad2b('0x13'));var qs=require(_0xad2b('0x14'));var as=require(_0xad2b('0x15'));var hardwareService=require(_0xad2b('0x16'));var logger=require(_0xad2b('0x17'))(_0xad2b('0x18'));var utils=require(_0xad2b('0x19'));var config=require(_0xad2b('0x1a'));var licenseUtil=require(_0xad2b('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0xad2b('0x1c'));var client=jayson[_0xad2b('0x1d')][_0xad2b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xfaaca6,_0x14511a,_0x6d430f,_0x2fcfd3){return new BPromise(function(_0x476041,_0x514f6e){var _0x58f3f3=_0x2fcfd3||client;return _0x58f3f3[_0xad2b('0x1f')](_0xfaaca6,_0x6d430f)[_0xad2b('0x20')](function(_0x443d79){logger['info'](_0xad2b('0x21'),_0x14511a,_0xad2b('0x22'));logger['debug'](_0xad2b('0x23'),_0x14511a,_0xad2b('0x22'),JSON['stringify'](_0x443d79));if(_0x443d79[_0xad2b('0x24')]){if(_0x443d79[_0xad2b('0x24')][_0xad2b('0x25')]===0x1f4){logger[_0xad2b('0x24')](_0xad2b('0x21'),_0x14511a,_0x443d79[_0xad2b('0x24')]['message']);return _0x514f6e(_0x443d79['error'][_0xad2b('0x26')]);}logger['error'](_0xad2b('0x21'),_0x14511a,_0x443d79[_0xad2b('0x24')]['message']);return _0x476041(_0x443d79[_0xad2b('0x24')][_0xad2b('0x26')]);}else{logger[_0xad2b('0x27')]('Setting,\x20%s,\x20%s',_0x14511a,_0xad2b('0x22'));_0x476041(_0x443d79[_0xad2b('0x28')][_0xad2b('0x26')]);}})[_0xad2b('0x29')](function(_0x1a15dc){logger[_0xad2b('0x24')]('Setting,\x20%s,\x20%s',_0x14511a,_0x1a15dc);_0x514f6e(_0x1a15dc);});});}function respondWithStatusCode(_0x120412,_0x2f140a){_0x2f140a=_0x2f140a||0xcc;return function(_0x2b46d){if(_0x2b46d){return _0x120412['sendStatus'](_0x2f140a);}return _0x120412[_0xad2b('0x2a')](_0x2f140a)[_0xad2b('0x2b')]();};}function respondWithResult(_0x1e973a,_0x5b2165){_0x5b2165=_0x5b2165||0xc8;return function(_0x85c7fd){if(_0x85c7fd){return _0x1e973a[_0xad2b('0x2a')](_0x5b2165)['json'](_0x85c7fd);}};}function respondWithFilteredResult(_0x4a778e,_0x3f00ad){return function(_0x559be5){if(_0x559be5){var _0x328147=typeof _0x3f00ad['offset']===_0xad2b('0x2c')&&typeof _0x3f00ad[_0xad2b('0x2d')]===_0xad2b('0x2c');var _0x1652e6=_0x559be5[_0xad2b('0x2e')];var _0x3fd9dd=_0x328147?0x0:_0x3f00ad[_0xad2b('0x2f')];var _0x396b06=_0x328147?_0x559be5['count']:_0x3f00ad['offset']+_0x3f00ad[_0xad2b('0x2d')];var _0x492385;if(_0x396b06>=_0x1652e6){_0x396b06=_0x1652e6;_0x492385=0xc8;}else{_0x492385=0xce;}_0x4a778e[_0xad2b('0x2a')](_0x492385);return _0x4a778e['set'](_0xad2b('0x30'),_0x3fd9dd+'-'+_0x396b06+'/'+_0x1652e6)['json'](_0x559be5);}return null;};}function patchUpdates(_0x21a3ee){return function(_0x132dc9){try{jsonpatch['apply'](_0x132dc9,_0x21a3ee,!![]);}catch(_0x5a6d5b){return BPromise[_0xad2b('0x31')](_0x5a6d5b);}return _0x132dc9[_0xad2b('0x32')]();};}function saveUpdates(_0x4844fb,_0x4d7e4d){return function(_0x3e334b){if(_0x3e334b){return _0x3e334b[_0xad2b('0x33')](_0x4844fb)[_0xad2b('0x20')](function(_0x4a2405){return _0x4a2405;});}return null;};}function removeEntity(_0x1b50a0,_0x4549b3){return function(_0x1f6f51){if(_0x1f6f51){return _0x1f6f51[_0xad2b('0x34')]()[_0xad2b('0x20')](function(){_0x1b50a0[_0xad2b('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1ea1,_0x3ebed9){return function(_0x173085){if(!_0x173085){_0x1f1ea1[_0xad2b('0x35')](0x194);}return _0x173085;};}function handleError(_0x336bb0,_0x3a91a7){_0x3a91a7=_0x3a91a7||0x1f4;return function(_0x475d6e){logger[_0xad2b('0x24')](_0x475d6e[_0xad2b('0x36')]);if(_0x475d6e[_0xad2b('0x37')]){delete _0x475d6e['name'];}_0x336bb0[_0xad2b('0x2a')](_0x3a91a7)['send'](_0x475d6e);};}exports[_0xad2b('0x38')]=function(_0x54f1bb,_0xe03a35){var _0x48848a={},_0x5dd4b3={},_0x23cb38={'count':0x0,'rows':[]};var _0x4a604e=_[_0xad2b('0x39')](db[_0xad2b('0x3a')]['rawAttributes'],function(_0x3705e9){return{'name':_0x3705e9['fieldName'],'type':_0x3705e9[_0xad2b('0x3b')][_0xad2b('0x3c')]};});_0x5dd4b3[_0xad2b('0x3d')]=_['map'](_0x4a604e,'name');_0x5dd4b3['query']=_[_0xad2b('0x3e')](_0x54f1bb[_0xad2b('0x3f')]);_0x5dd4b3[_0xad2b('0x40')]=_[_0xad2b('0x41')](_0x5dd4b3['model'],_0x5dd4b3[_0xad2b('0x3f')]);_0x48848a[_0xad2b('0x42')]=_['intersection'](_0x5dd4b3[_0xad2b('0x3d')],qs[_0xad2b('0x43')](_0x54f1bb[_0xad2b('0x3f')][_0xad2b('0x43')]));_0x48848a[_0xad2b('0x42')]=_0x48848a[_0xad2b('0x42')][_0xad2b('0x44')]?_0x48848a['attributes']:_0x5dd4b3[_0xad2b('0x3d')];if(!_0x54f1bb[_0xad2b('0x3f')]['hasOwnProperty']('nolimit')){_0x48848a[_0xad2b('0x2d')]=qs['limit'](_0x54f1bb['query'][_0xad2b('0x2d')]);_0x48848a[_0xad2b('0x2f')]=qs[_0xad2b('0x2f')](_0x54f1bb[_0xad2b('0x3f')][_0xad2b('0x2f')]);}_0x48848a[_0xad2b('0x45')]=qs[_0xad2b('0x46')](_0x54f1bb[_0xad2b('0x3f')][_0xad2b('0x46')]);_0x48848a[_0xad2b('0x47')]=qs['filters'](_[_0xad2b('0x48')](_0x54f1bb[_0xad2b('0x3f')],_0x5dd4b3[_0xad2b('0x40')]),_0x4a604e);if(_0x54f1bb[_0xad2b('0x3f')][_0xad2b('0x49')]){_0x48848a['where']=_[_0xad2b('0x4a')](_0x48848a[_0xad2b('0x47')],{'$or':_['map'](_0x4a604e,function(_0x36d7ad){if(_0x36d7ad['type']!==_0xad2b('0x4b')){var _0x127042={};_0x127042[_0x36d7ad[_0xad2b('0x37')]]={'$like':'%'+_0x54f1bb[_0xad2b('0x3f')][_0xad2b('0x49')]+'%'};return _0x127042;}})});}_0x48848a=_[_0xad2b('0x4a')]({},_0x48848a,_0x54f1bb['options']);var _0x467128={'where':_0x48848a['where']};return db[_0xad2b('0x3a')][_0xad2b('0x2e')](_0x467128)[_0xad2b('0x20')](function(_0x771a4e){_0x23cb38[_0xad2b('0x2e')]=_0x771a4e;if(_0x54f1bb['query'][_0xad2b('0x4c')]){_0x48848a[_0xad2b('0x4d')]=[{'all':!![]}];}return db[_0xad2b('0x3a')][_0xad2b('0x4e')](_0x48848a);})[_0xad2b('0x20')](function(_0x3d507e){_0x23cb38[_0xad2b('0x4f')]=_0x3d507e;return _0x23cb38;})[_0xad2b('0x20')](respondWithFilteredResult(_0xe03a35,_0x48848a))[_0xad2b('0x29')](handleError(_0xe03a35,null));};exports[_0xad2b('0x50')]=function(_0x2ded34,_0x1477ef){var _0x42bac9={'raw':![],'where':{'id':_0x2ded34['params']['id']}},_0x53b64e={};_0x53b64e['model']=_[_0xad2b('0x3e')](db['Setting'][_0xad2b('0x51')]);_0x53b64e[_0xad2b('0x3f')]=_[_0xad2b('0x3e')](_0x2ded34[_0xad2b('0x3f')]);_0x53b64e[_0xad2b('0x40')]=_[_0xad2b('0x41')](_0x53b64e[_0xad2b('0x3d')],_0x53b64e[_0xad2b('0x3f')]);_0x42bac9[_0xad2b('0x42')]=_['intersection'](_0x53b64e['model'],qs[_0xad2b('0x43')](_0x2ded34[_0xad2b('0x3f')][_0xad2b('0x43')]));_0x42bac9[_0xad2b('0x42')]=_0x42bac9[_0xad2b('0x42')][_0xad2b('0x44')]?_0x42bac9[_0xad2b('0x42')]:_0x53b64e[_0xad2b('0x3d')];if(_0x2ded34[_0xad2b('0x3f')]['includeAll']){_0x42bac9[_0xad2b('0x4d')]=[{'all':!![]}];}_0x42bac9=_[_0xad2b('0x4a')]({},_0x42bac9,_0x2ded34[_0xad2b('0x52')]);return db[_0xad2b('0x3a')][_0xad2b('0x53')](_0x42bac9)[_0xad2b('0x20')](handleEntityNotFound(_0x1477ef,null))['then'](respondWithResult(_0x1477ef,null))[_0xad2b('0x29')](handleError(_0x1477ef,null));};exports[_0xad2b('0x33')]=function(_0x3e2771,_0x8a4fac){if(_0x3e2771[_0xad2b('0x54')]['id']){delete _0x3e2771[_0xad2b('0x54')]['id'];}return db[_0xad2b('0x3a')][_0xad2b('0x53')]({'where':{'id':_0x3e2771[_0xad2b('0x55')]['id']}})['then'](handleEntityNotFound(_0x8a4fac,null))[_0xad2b('0x20')](saveUpdates(_0x3e2771[_0xad2b('0x54')],null))[_0xad2b('0x20')](respondWithResult(_0x8a4fac,null))['catch'](handleError(_0x8a4fac,null));};exports[_0xad2b('0x56')]=function(_0xe4eead,_0x4f0e04,_0x1a3c52){if(_0xe4eead[_0xad2b('0x57')]&&_0xe4eead['file'][_0xad2b('0x58')]){_0xe4eead[_0xad2b('0x54')][_0xad2b('0x59')]=_0xe4eead[_0xad2b('0x57')][_0xad2b('0x58')];}return db[_0xad2b('0x3a')][_0xad2b('0x53')]({'where':{'id':_0xe4eead[_0xad2b('0x55')]['id']}})[_0xad2b('0x20')](handleEntityNotFound(_0x4f0e04,null))[_0xad2b('0x20')](saveUpdates(_0xe4eead[_0xad2b('0x54')],null))[_0xad2b('0x20')](respondWithResult(_0x4f0e04,null))['catch'](handleError(_0x4f0e04,null));};exports[_0xad2b('0x5a')]=function(_0x308867,_0x327906,_0x35f6be){if(_0x308867[_0xad2b('0x57')]&&_0x308867[_0xad2b('0x57')][_0xad2b('0x58')]){_0x308867[_0xad2b('0x54')]['loginLogo']=_0x308867[_0xad2b('0x57')][_0xad2b('0x58')];}return db[_0xad2b('0x3a')][_0xad2b('0x53')]({'where':{'id':_0x308867[_0xad2b('0x55')]['id']}})[_0xad2b('0x20')](handleEntityNotFound(_0x327906,null))[_0xad2b('0x20')](saveUpdates(_0x308867[_0xad2b('0x54')],null))['then'](respondWithResult(_0x327906,null))[_0xad2b('0x29')](handleError(_0x327906,null));};var utilLicense=require(_0xad2b('0x1b'));exports[_0xad2b('0x5b')]=function(_0x49e70f,_0x1a6260,_0x475510){var _0x13f50a=_0xad2b('0x5c');var _0x3dedcd={'custom':![]};return utilLicense['getLicense']()[_0xad2b('0x20')](function(_0x386630){if(_0x386630){_0x3dedcd=_0x386630;}return db['Setting'][_0xad2b('0x53')]({'where':{'id':_0x49e70f[_0xad2b('0x55')]['id']},'attributes':['logo',_0xad2b('0x5d'),_0xad2b('0x5e'),_0xad2b('0x5f'),_0xad2b('0x60'),_0xad2b('0x61'),_0xad2b('0x62'),'defaultFavicon'],'raw':!![]});})[_0xad2b('0x20')](handleEntityNotFound(_0x1a6260,null))['then'](function(_0x1dd718){if(_0x1dd718){var _0x27719d=_0x1dd718['logo']&&fs[_0xad2b('0x63')](path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x13f50a,_[_0xad2b('0x66')](_0x1dd718[_0xad2b('0x59')])))?path['join'](config[_0xad2b('0x65')],_0x13f50a,_[_0xad2b('0x66')](_0x1dd718[_0xad2b('0x59')])):path[_0xad2b('0x64')](config['root'],_0x13f50a,_[_0xad2b('0x66')](_0xad2b('0x67')));var _0x49aa51=_0xad2b('0x68')+_[_0xad2b('0x69')]('logo');if(_0x1dd718[_0x49aa51]||!_0x3dedcd[_0xad2b('0x6a')]){_0x27719d=path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x13f50a,_['toLower'](_0xad2b('0x67')));}if(!fs[_0xad2b('0x63')](_0x27719d)){throw new db[(_0xad2b('0x6b'))][(_0xad2b('0x6c'))](_[_0xad2b('0x69')](_0xad2b('0x59'))+_0xad2b('0x6d'));}return _0x1a6260[_0xad2b('0x6e')](_0x27719d);}})[_0xad2b('0x29')](handleError(_0x1a6260,null));};var utilLicense=require('../../config/license/util');exports[_0xad2b('0x6f')]=function(_0x591f54,_0x556e58,_0x1ce12e){var _0x5d8080='server/files/images/logos';var _0xfe36bb={'custom':![]};return utilLicense[_0xad2b('0x70')]()[_0xad2b('0x20')](function(_0x145d6f){if(_0x145d6f){_0xfe36bb=_0x145d6f;}return db['Setting'][_0xad2b('0x53')]({'where':{'id':_0x591f54['params']['id']},'attributes':[_0xad2b('0x59'),_0xad2b('0x5d'),_0xad2b('0x5e'),_0xad2b('0x5f'),_0xad2b('0x60'),'defaultLoginLogo',_0xad2b('0x62'),_0xad2b('0x71')],'raw':!![]});})[_0xad2b('0x20')](handleEntityNotFound(_0x556e58,null))[_0xad2b('0x20')](function(_0x5c1c2b){if(_0x5c1c2b){var _0x2ca29c=_0x5c1c2b[_0xad2b('0x5d')]&&fs['existsSync'](path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x5d8080,_[_0xad2b('0x66')](_0x5c1c2b[_0xad2b('0x5d')])))?path['join'](config[_0xad2b('0x65')],_0x5d8080,_[_0xad2b('0x66')](_0x5c1c2b['loginLogo'])):path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x5d8080,_['toLower'](_0xad2b('0x72')));var _0x2d3d5c=_0xad2b('0x68')+_[_0xad2b('0x69')]('loginLogo');if(_0x5c1c2b[_0x2d3d5c]||!_0xfe36bb[_0xad2b('0x6a')]){_0x2ca29c=path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x5d8080,_[_0xad2b('0x66')]('default_loginLogo.svg'));}if(!fs[_0xad2b('0x63')](_0x2ca29c)){throw new db['Sequelize'][(_0xad2b('0x6c'))](_['upperFirst'](_0xad2b('0x5d'))+_0xad2b('0x6d'));}return _0x556e58[_0xad2b('0x6e')](_0x2ca29c);}})[_0xad2b('0x29')](handleError(_0x556e58,null));};exports[_0xad2b('0x73')]=function(_0x2daaa8,_0x5c3385){return db[_0xad2b('0x3a')]['find']({'where':{'id':_0x2daaa8[_0xad2b('0x55')]['id']},'attributes':[_0xad2b('0x74')]})[_0xad2b('0x20')](respondWithResult(_0x5c3385,null))[_0xad2b('0x29')](handleError(_0x5c3385,null));};exports[_0xad2b('0x75')]=function(_0x12baa8,_0x509f7d,_0x45a291){if(_0x12baa8[_0xad2b('0x57')]&&_0x12baa8[_0xad2b('0x57')][_0xad2b('0x58')]){_0x12baa8[_0xad2b('0x54')][_0xad2b('0x5e')]=_0x12baa8['file'][_0xad2b('0x58')];}return db[_0xad2b('0x3a')][_0xad2b('0x53')]({'where':{'id':_0x12baa8['params']['id']}})[_0xad2b('0x20')](handleEntityNotFound(_0x509f7d,null))[_0xad2b('0x20')](saveUpdates(_0x12baa8[_0xad2b('0x54')],null))[_0xad2b('0x20')](respondWithResult(_0x509f7d,null))[_0xad2b('0x29')](handleError(_0x509f7d,null));};var utilLicense=require(_0xad2b('0x1b'));exports[_0xad2b('0x76')]=function(_0x4d9bad,_0x8f2e3f,_0x3e5c4c){var _0x2c9011=_0xad2b('0x5c');var _0x1059cf={'custom':![]};return utilLicense[_0xad2b('0x70')]()[_0xad2b('0x20')](function(_0x5a1f6c){if(_0x5a1f6c){_0x1059cf=_0x5a1f6c;}return db[_0xad2b('0x3a')][_0xad2b('0x53')]({'where':{'id':_0x4d9bad[_0xad2b('0x55')]['id']},'attributes':[_0xad2b('0x59'),'loginLogo',_0xad2b('0x5e'),_0xad2b('0x5f'),_0xad2b('0x60'),_0xad2b('0x61'),'defaultPreferred',_0xad2b('0x71')],'raw':!![]});})['then'](handleEntityNotFound(_0x8f2e3f,null))['then'](function(_0x1e9336){if(_0x1e9336){var _0x2f5d6d=_0x1e9336[_0xad2b('0x5e')]&&fs[_0xad2b('0x63')](path[_0xad2b('0x64')](config['root'],_0x2c9011,_[_0xad2b('0x66')](_0x1e9336['preferred'])))?path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x2c9011,_[_0xad2b('0x66')](_0x1e9336[_0xad2b('0x5e')])):path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x2c9011,_[_0xad2b('0x66')](_0xad2b('0x77')));var _0x1eefea=_0xad2b('0x68')+_[_0xad2b('0x69')](_0xad2b('0x5e'));if(_0x1e9336[_0x1eefea]||!_0x1059cf[_0xad2b('0x6a')]||!_0x1059cf[_0xad2b('0x5e')]){_0x2f5d6d=path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x2c9011,_[_0xad2b('0x66')](_0xad2b('0x77')));}if(!fs[_0xad2b('0x63')](_0x2f5d6d)){throw new db[(_0xad2b('0x6b'))][(_0xad2b('0x6c'))](_[_0xad2b('0x69')]('preferred')+_0xad2b('0x6d'));}return _0x8f2e3f['download'](_0x2f5d6d);}})['catch'](handleError(_0x8f2e3f,null));};exports['addFavicon']=function(_0x113ccf,_0x488f6c,_0x58516b){if(_0x113ccf['file']&&_0x113ccf[_0xad2b('0x57')][_0xad2b('0x58')]){_0x113ccf[_0xad2b('0x54')]['favicon']=_0x113ccf[_0xad2b('0x57')]['filename'];}return db[_0xad2b('0x3a')][_0xad2b('0x53')]({'where':{'id':_0x113ccf[_0xad2b('0x55')]['id']}})[_0xad2b('0x20')](handleEntityNotFound(_0x488f6c,null))[_0xad2b('0x20')](saveUpdates(_0x113ccf[_0xad2b('0x54')],null))[_0xad2b('0x20')](respondWithResult(_0x488f6c,null))[_0xad2b('0x29')](handleError(_0x488f6c,null));};var utilLicense=require('../../config/license/util');exports[_0xad2b('0x78')]=function(_0x383baf,_0x2575d9,_0x474a72){var _0x27c008=_0xad2b('0x5c');var _0x24768d={'custom':![]};return utilLicense[_0xad2b('0x70')]()[_0xad2b('0x20')](function(_0x167f41){if(_0x167f41){_0x24768d=_0x167f41;}return db['Setting'][_0xad2b('0x53')]({'where':{'id':_0x383baf[_0xad2b('0x55')]['id']},'attributes':[_0xad2b('0x59'),'loginLogo','preferred',_0xad2b('0x5f'),_0xad2b('0x60'),_0xad2b('0x61'),_0xad2b('0x62'),_0xad2b('0x71')],'raw':!![]});})[_0xad2b('0x20')](handleEntityNotFound(_0x2575d9,null))[_0xad2b('0x20')](function(_0x5a4614){if(_0x5a4614){var _0x59a486=_0x5a4614['favicon']&&fs['existsSync'](path[_0xad2b('0x64')](config['root'],_0x27c008,_[_0xad2b('0x66')](_0x5a4614[_0xad2b('0x5f')])))?path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x27c008,_[_0xad2b('0x66')](_0x5a4614[_0xad2b('0x5f')])):path['join'](config['root'],_0x27c008,_[_0xad2b('0x66')]('default_favicon.ico'));var _0x118382='default'+_[_0xad2b('0x69')](_0xad2b('0x5f'));if(_0x5a4614[_0x118382]||!_0x24768d[_0xad2b('0x6a')]){_0x59a486=path[_0xad2b('0x64')](config[_0xad2b('0x65')],_0x27c008,_['toLower'](_0xad2b('0x79')));}if(!fs[_0xad2b('0x63')](_0x59a486)){throw new db[(_0xad2b('0x6b'))][(_0xad2b('0x6c'))](_[_0xad2b('0x69')]('favicon')+_0xad2b('0x6d'));}return _0x2575d9[_0xad2b('0x6e')](_0x59a486);}})[_0xad2b('0x29')](handleError(_0x2575d9,null));};exports[_0xad2b('0x7a')]=function(_0x3da34a,_0x487301){var _0x113aa7={'offset':moment()[_0xad2b('0x7b')]()};_0x113aa7[_0xad2b('0x7c')]=moment()[_0xad2b('0x7b')](_0x113aa7[_0xad2b('0x2f')])[_0xad2b('0x7d')](_0xad2b('0x7e'));return _0x487301[_0xad2b('0x2a')](0xc8)[_0xad2b('0x7f')](_0x113aa7);}; \ No newline at end of file +var _0xc827=['apply','reject','save','update','destroy','index','fieldName','key','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','Setting','findAll','rows','params','rawAttributes','find','body','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','logo','preferred','defaultLogo','defaultLoginLogo','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','download','server/files/images/logos','favicon','defaultPreferred','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','send','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Setting,\x20%s,\x20%s','info','result','catch','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range'];(function(_0x7816ac,_0x372d82){var _0x531068=function(_0x18525a){while(--_0x18525a){_0x7816ac['push'](_0x7816ac['shift']());}};_0x531068(++_0x372d82);}(_0xc827,0x149));var _0x7c82=function(_0x494e31,_0x299915){_0x494e31=_0x494e31-0x0;var _0x4dd0bd=_0xc827[_0x494e31];return _0x4dd0bd;};'use strict';var emlformat=require(_0x7c82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c82('0x2'));var moment=require('moment');var BPromise=require(_0x7c82('0x3'));var Mustache=require(_0x7c82('0x4'));var util=require(_0x7c82('0x5'));var path=require(_0x7c82('0x6'));var sox=require(_0x7c82('0x7'));var csv=require(_0x7c82('0x8'));var ejs=require(_0x7c82('0x9'));var fs=require('fs');var fs_extra=require(_0x7c82('0xa'));var _=require(_0x7c82('0xb'));var squel=require(_0x7c82('0xc'));var crypto=require(_0x7c82('0xd'));var jsforce=require(_0x7c82('0xe'));var deskjs=require(_0x7c82('0xf'));var toCsv=require(_0x7c82('0x8'));var querystring=require(_0x7c82('0x10'));var Papa=require(_0x7c82('0x11'));var Redis=require(_0x7c82('0x12'));var authService=require(_0x7c82('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7c82('0x14'));var hardwareService=require(_0x7c82('0x15'));var logger=require('../../config/logger')(_0x7c82('0x16'));var utils=require(_0x7c82('0x17'));var config=require(_0x7c82('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c82('0x19'))['db'];var jayson=require(_0x7c82('0x1a'));var client=jayson[_0x7c82('0x1b')][_0x7c82('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x64e681,_0x3ec0d3,_0x1416aa,_0x3247e9){return new BPromise(function(_0x296a6e,_0x21bd3a){var _0x402955=_0x3247e9||client;return _0x402955[_0x7c82('0x1d')](_0x64e681,_0x1416aa)[_0x7c82('0x1e')](function(_0x15f75c){logger['info']('Setting,\x20%s,\x20%s',_0x3ec0d3,'request\x20sent');logger[_0x7c82('0x1f')](_0x7c82('0x20'),_0x3ec0d3,_0x7c82('0x21'),JSON[_0x7c82('0x22')](_0x15f75c));if(_0x15f75c[_0x7c82('0x23')]){if(_0x15f75c['error'][_0x7c82('0x24')]===0x1f4){logger[_0x7c82('0x23')]('Setting,\x20%s,\x20%s',_0x3ec0d3,_0x15f75c[_0x7c82('0x23')][_0x7c82('0x25')]);return _0x21bd3a(_0x15f75c['error']['message']);}logger[_0x7c82('0x23')](_0x7c82('0x26'),_0x3ec0d3,_0x15f75c[_0x7c82('0x23')][_0x7c82('0x25')]);return _0x296a6e(_0x15f75c[_0x7c82('0x23')]['message']);}else{logger[_0x7c82('0x27')](_0x7c82('0x26'),_0x3ec0d3,_0x7c82('0x21'));_0x296a6e(_0x15f75c[_0x7c82('0x28')][_0x7c82('0x25')]);}})[_0x7c82('0x29')](function(_0x4c1ad9){logger[_0x7c82('0x23')](_0x7c82('0x26'),_0x3ec0d3,_0x4c1ad9);_0x21bd3a(_0x4c1ad9);});});}function respondWithStatusCode(_0x936172,_0x45d07e){_0x45d07e=_0x45d07e||0xcc;return function(_0x7e99fd){if(_0x7e99fd){return _0x936172[_0x7c82('0x2a')](_0x45d07e);}return _0x936172['status'](_0x45d07e)[_0x7c82('0x2b')]();};}function respondWithResult(_0x18b25a,_0xeae995){_0xeae995=_0xeae995||0xc8;return function(_0x53452a){if(_0x53452a){return _0x18b25a[_0x7c82('0x2c')](_0xeae995)[_0x7c82('0x2d')](_0x53452a);}};}function respondWithFilteredResult(_0x477693,_0x411226){return function(_0x30aae9){if(_0x30aae9){var _0x3bb1f6=typeof _0x411226['offset']===_0x7c82('0x2e')&&typeof _0x411226[_0x7c82('0x2f')]===_0x7c82('0x2e');var _0x11606f=_0x30aae9['count'];var _0x311c22=_0x3bb1f6?0x0:_0x411226[_0x7c82('0x30')];var _0x1d0838=_0x3bb1f6?_0x30aae9[_0x7c82('0x31')]:_0x411226[_0x7c82('0x30')]+_0x411226[_0x7c82('0x2f')];var _0x45c8b9;if(_0x1d0838>=_0x11606f){_0x1d0838=_0x11606f;_0x45c8b9=0xc8;}else{_0x45c8b9=0xce;}_0x477693[_0x7c82('0x2c')](_0x45c8b9);return _0x477693[_0x7c82('0x32')](_0x7c82('0x33'),_0x311c22+'-'+_0x1d0838+'/'+_0x11606f)[_0x7c82('0x2d')](_0x30aae9);}return null;};}function patchUpdates(_0x4303d5){return function(_0x2a7da0){try{jsonpatch[_0x7c82('0x34')](_0x2a7da0,_0x4303d5,!![]);}catch(_0xb53e38){return BPromise[_0x7c82('0x35')](_0xb53e38);}return _0x2a7da0[_0x7c82('0x36')]();};}function saveUpdates(_0x3b0593,_0x194dae){return function(_0x4b8489){if(_0x4b8489){return _0x4b8489[_0x7c82('0x37')](_0x3b0593)[_0x7c82('0x1e')](function(_0xe56376){return _0xe56376;});}return null;};}function removeEntity(_0x3bef43,_0x3e8d16){return function(_0x11de31){if(_0x11de31){return _0x11de31[_0x7c82('0x38')]()[_0x7c82('0x1e')](function(){_0x3bef43['status'](0xcc)[_0x7c82('0x2b')]();});}};}function handleEntityNotFound(_0x9ded3a,_0x5be05d){return function(_0x172ee7){if(!_0x172ee7){_0x9ded3a[_0x7c82('0x2a')](0x194);}return _0x172ee7;};}function handleError(_0x16bdcd,_0x287553){_0x287553=_0x287553||0x1f4;return function(_0x148a62){logger['error'](_0x148a62['stack']);if(_0x148a62['name']){delete _0x148a62['name'];}_0x16bdcd[_0x7c82('0x2c')](_0x287553)['send'](_0x148a62);};}exports[_0x7c82('0x39')]=function(_0x56bb4a,_0x5c96e0){var _0x84874a={},_0x559e9d={},_0x3c1a26={'count':0x0,'rows':[]};var _0x291239=_['map'](db['Setting']['rawAttributes'],function(_0x2626ac){return{'name':_0x2626ac[_0x7c82('0x3a')],'type':_0x2626ac['type'][_0x7c82('0x3b')]};});_0x559e9d[_0x7c82('0x3c')]=_[_0x7c82('0x3d')](_0x291239,_0x7c82('0x3e'));_0x559e9d['query']=_[_0x7c82('0x3f')](_0x56bb4a[_0x7c82('0x40')]);_0x559e9d['filters']=_[_0x7c82('0x41')](_0x559e9d[_0x7c82('0x3c')],_0x559e9d[_0x7c82('0x40')]);_0x84874a[_0x7c82('0x42')]=_[_0x7c82('0x41')](_0x559e9d[_0x7c82('0x3c')],qs[_0x7c82('0x43')](_0x56bb4a[_0x7c82('0x40')][_0x7c82('0x43')]));_0x84874a[_0x7c82('0x42')]=_0x84874a[_0x7c82('0x42')][_0x7c82('0x44')]?_0x84874a['attributes']:_0x559e9d[_0x7c82('0x3c')];if(!_0x56bb4a['query'][_0x7c82('0x45')]('nolimit')){_0x84874a['limit']=qs[_0x7c82('0x2f')](_0x56bb4a[_0x7c82('0x40')][_0x7c82('0x2f')]);_0x84874a['offset']=qs[_0x7c82('0x30')](_0x56bb4a[_0x7c82('0x40')][_0x7c82('0x30')]);}_0x84874a[_0x7c82('0x46')]=qs[_0x7c82('0x47')](_0x56bb4a['query'][_0x7c82('0x47')]);_0x84874a[_0x7c82('0x48')]=qs[_0x7c82('0x49')](_[_0x7c82('0x4a')](_0x56bb4a[_0x7c82('0x40')],_0x559e9d[_0x7c82('0x49')]),_0x291239);if(_0x56bb4a[_0x7c82('0x40')][_0x7c82('0x4b')]){_0x84874a[_0x7c82('0x48')]=_['merge'](_0x84874a[_0x7c82('0x48')],{'$or':_[_0x7c82('0x3d')](_0x291239,function(_0x32835d){if(_0x32835d[_0x7c82('0x4c')]!==_0x7c82('0x4d')){var _0x1de969={};_0x1de969[_0x32835d[_0x7c82('0x3e')]]={'$like':'%'+_0x56bb4a[_0x7c82('0x40')]['filter']+'%'};return _0x1de969;}})});}_0x84874a=_[_0x7c82('0x4e')]({},_0x84874a,_0x56bb4a[_0x7c82('0x4f')]);var _0x353ba4={'where':_0x84874a[_0x7c82('0x48')]};return db['Setting'][_0x7c82('0x31')](_0x353ba4)[_0x7c82('0x1e')](function(_0x4c11a5){_0x3c1a26[_0x7c82('0x31')]=_0x4c11a5;if(_0x56bb4a[_0x7c82('0x40')]['includeAll']){_0x84874a[_0x7c82('0x50')]=[{'all':!![]}];}return db[_0x7c82('0x51')][_0x7c82('0x52')](_0x84874a);})['then'](function(_0x3afa05){_0x3c1a26[_0x7c82('0x53')]=_0x3afa05;return _0x3c1a26;})[_0x7c82('0x1e')](respondWithFilteredResult(_0x5c96e0,_0x84874a))[_0x7c82('0x29')](handleError(_0x5c96e0,null));};exports['show']=function(_0x4e6d8c,_0x49d9a1){var _0x2aa703={'raw':![],'where':{'id':_0x4e6d8c[_0x7c82('0x54')]['id']}},_0x72a484={};_0x72a484[_0x7c82('0x3c')]=_[_0x7c82('0x3f')](db[_0x7c82('0x51')][_0x7c82('0x55')]);_0x72a484[_0x7c82('0x40')]=_[_0x7c82('0x3f')](_0x4e6d8c['query']);_0x72a484[_0x7c82('0x49')]=_[_0x7c82('0x41')](_0x72a484['model'],_0x72a484[_0x7c82('0x40')]);_0x2aa703[_0x7c82('0x42')]=_[_0x7c82('0x41')](_0x72a484[_0x7c82('0x3c')],qs['fields'](_0x4e6d8c[_0x7c82('0x40')][_0x7c82('0x43')]));_0x2aa703[_0x7c82('0x42')]=_0x2aa703[_0x7c82('0x42')][_0x7c82('0x44')]?_0x2aa703[_0x7c82('0x42')]:_0x72a484['model'];if(_0x4e6d8c[_0x7c82('0x40')]['includeAll']){_0x2aa703[_0x7c82('0x50')]=[{'all':!![]}];}_0x2aa703=_[_0x7c82('0x4e')]({},_0x2aa703,_0x4e6d8c[_0x7c82('0x4f')]);return db[_0x7c82('0x51')][_0x7c82('0x56')](_0x2aa703)['then'](handleEntityNotFound(_0x49d9a1,null))[_0x7c82('0x1e')](respondWithResult(_0x49d9a1,null))['catch'](handleError(_0x49d9a1,null));};exports[_0x7c82('0x37')]=function(_0x4fbdf8,_0xadc885){if(_0x4fbdf8[_0x7c82('0x57')]['id']){delete _0x4fbdf8[_0x7c82('0x57')]['id'];}return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0x4fbdf8[_0x7c82('0x54')]['id']}})[_0x7c82('0x1e')](handleEntityNotFound(_0xadc885,null))['then'](saveUpdates(_0x4fbdf8[_0x7c82('0x57')],null))[_0x7c82('0x1e')](respondWithResult(_0xadc885,null))['catch'](handleError(_0xadc885,null));};exports[_0x7c82('0x58')]=function(_0x934986,_0x2a0138,_0x5ea1eb){if(_0x934986['file']&&_0x934986[_0x7c82('0x59')][_0x7c82('0x5a')]){_0x934986[_0x7c82('0x57')]['logo']=_0x934986['file'][_0x7c82('0x5a')];}return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0x934986[_0x7c82('0x54')]['id']}})[_0x7c82('0x1e')](handleEntityNotFound(_0x2a0138,null))[_0x7c82('0x1e')](saveUpdates(_0x934986['body'],null))[_0x7c82('0x1e')](respondWithResult(_0x2a0138,null))['catch'](handleError(_0x2a0138,null));};exports['addLogoLogin']=function(_0x266a12,_0x25be8c,_0x4a429e){if(_0x266a12[_0x7c82('0x59')]&&_0x266a12[_0x7c82('0x59')][_0x7c82('0x5a')]){_0x266a12[_0x7c82('0x57')][_0x7c82('0x5b')]=_0x266a12['file'][_0x7c82('0x5a')];}return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0x266a12[_0x7c82('0x54')]['id']}})[_0x7c82('0x1e')](handleEntityNotFound(_0x25be8c,null))[_0x7c82('0x1e')](saveUpdates(_0x266a12[_0x7c82('0x57')],null))['then'](respondWithResult(_0x25be8c,null))[_0x7c82('0x29')](handleError(_0x25be8c,null));};var utilLicense=require(_0x7c82('0x5c'));exports[_0x7c82('0x5d')]=function(_0x54eeca,_0x101c33,_0x381f05){var _0x13297a='server/files/images/logos';var _0x253ee6={'custom':![]};return utilLicense['getLicense']()[_0x7c82('0x1e')](function(_0x2cb403){if(_0x2cb403){_0x253ee6=_0x2cb403;}return db['Setting']['find']({'where':{'id':_0x54eeca['params']['id']},'attributes':[_0x7c82('0x5e'),_0x7c82('0x5b'),_0x7c82('0x5f'),'favicon',_0x7c82('0x60'),_0x7c82('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7c82('0x1e')](handleEntityNotFound(_0x101c33,null))[_0x7c82('0x1e')](function(_0x21a337){if(_0x21a337){var _0x47c23=_0x21a337[_0x7c82('0x5e')]&&fs['existsSync'](path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x13297a,_[_0x7c82('0x64')](_0x21a337[_0x7c82('0x5e')])))?path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x13297a,_[_0x7c82('0x64')](_0x21a337[_0x7c82('0x5e')])):path['join'](config[_0x7c82('0x63')],_0x13297a,_['toLower'](_0x7c82('0x65')));var _0x5acb2d=_0x7c82('0x66')+_[_0x7c82('0x67')]('logo');if(_0x21a337[_0x5acb2d]||!_0x253ee6[_0x7c82('0x68')]){_0x47c23=path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x13297a,_[_0x7c82('0x64')]('default_logo.svg'));}if(!fs[_0x7c82('0x69')](_0x47c23)){throw new db[(_0x7c82('0x6a'))][(_0x7c82('0x6b'))](_['upperFirst'](_0x7c82('0x5e'))+'\x20not\x20found');}return _0x101c33[_0x7c82('0x6c')](_0x47c23);}})[_0x7c82('0x29')](handleError(_0x101c33,null));};var utilLicense=require(_0x7c82('0x5c'));exports['getLogoLogin']=function(_0xd434e,_0x36901e,_0x4b19fc){var _0x4df34f=_0x7c82('0x6d');var _0x2c2cb6={'custom':![]};return utilLicense['getLicense']()[_0x7c82('0x1e')](function(_0x6ff712){if(_0x6ff712){_0x2c2cb6=_0x6ff712;}return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0xd434e[_0x7c82('0x54')]['id']},'attributes':[_0x7c82('0x5e'),'loginLogo',_0x7c82('0x5f'),_0x7c82('0x6e'),_0x7c82('0x60'),_0x7c82('0x61'),_0x7c82('0x6f'),_0x7c82('0x70')],'raw':!![]});})[_0x7c82('0x1e')](handleEntityNotFound(_0x36901e,null))[_0x7c82('0x1e')](function(_0x59068c){if(_0x59068c){var _0xb0eda4=_0x59068c['loginLogo']&&fs[_0x7c82('0x69')](path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x4df34f,_['toLower'](_0x59068c[_0x7c82('0x5b')])))?path[_0x7c82('0x62')](config['root'],_0x4df34f,_['toLower'](_0x59068c[_0x7c82('0x5b')])):path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x4df34f,_[_0x7c82('0x64')](_0x7c82('0x71')));var _0x25e0bb='default'+_[_0x7c82('0x67')](_0x7c82('0x5b'));if(_0x59068c[_0x25e0bb]||!_0x2c2cb6[_0x7c82('0x68')]){_0xb0eda4=path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x4df34f,_['toLower'](_0x7c82('0x71')));}if(!fs[_0x7c82('0x69')](_0xb0eda4)){throw new db[(_0x7c82('0x6a'))]['ValidationError'](_['upperFirst'](_0x7c82('0x5b'))+'\x20not\x20found');}return _0x36901e['download'](_0xb0eda4);}})['catch'](handleError(_0x36901e,null));};exports[_0x7c82('0x72')]=function(_0x12317d,_0x33bc62){return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0x12317d[_0x7c82('0x54')]['id']},'attributes':[_0x7c82('0x73')]})[_0x7c82('0x1e')](respondWithResult(_0x33bc62,null))[_0x7c82('0x29')](handleError(_0x33bc62,null));};exports[_0x7c82('0x74')]=function(_0x3e0f75,_0x32b77b,_0x1684d9){if(_0x3e0f75[_0x7c82('0x59')]&&_0x3e0f75[_0x7c82('0x59')][_0x7c82('0x5a')]){_0x3e0f75[_0x7c82('0x57')][_0x7c82('0x5f')]=_0x3e0f75[_0x7c82('0x59')]['filename'];}return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0x3e0f75[_0x7c82('0x54')]['id']}})[_0x7c82('0x1e')](handleEntityNotFound(_0x32b77b,null))[_0x7c82('0x1e')](saveUpdates(_0x3e0f75[_0x7c82('0x57')],null))[_0x7c82('0x1e')](respondWithResult(_0x32b77b,null))[_0x7c82('0x29')](handleError(_0x32b77b,null));};var utilLicense=require(_0x7c82('0x5c'));exports[_0x7c82('0x75')]=function(_0x263ce7,_0x2d822e,_0x111a66){var _0x20f2e7=_0x7c82('0x6d');var _0x2b821e={'custom':![]};return utilLicense[_0x7c82('0x76')]()[_0x7c82('0x1e')](function(_0x5e320b){if(_0x5e320b){_0x2b821e=_0x5e320b;}return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0x263ce7[_0x7c82('0x54')]['id']},'attributes':['logo',_0x7c82('0x5b'),_0x7c82('0x5f'),_0x7c82('0x6e'),_0x7c82('0x60'),_0x7c82('0x61'),'defaultPreferred',_0x7c82('0x70')],'raw':!![]});})[_0x7c82('0x1e')](handleEntityNotFound(_0x2d822e,null))[_0x7c82('0x1e')](function(_0x111701){if(_0x111701){var _0x541805=_0x111701[_0x7c82('0x5f')]&&fs[_0x7c82('0x69')](path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x20f2e7,_[_0x7c82('0x64')](_0x111701[_0x7c82('0x5f')])))?path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x20f2e7,_[_0x7c82('0x64')](_0x111701[_0x7c82('0x5f')])):path['join'](config['root'],_0x20f2e7,_['toLower']('default_preferred.png'));var _0x229bc3='default'+_[_0x7c82('0x67')](_0x7c82('0x5f'));if(_0x111701[_0x229bc3]||!_0x2b821e[_0x7c82('0x68')]||!_0x2b821e[_0x7c82('0x5f')]){_0x541805=path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x20f2e7,_[_0x7c82('0x64')]('default_preferred.png'));}if(!fs[_0x7c82('0x69')](_0x541805)){throw new db[(_0x7c82('0x6a'))][(_0x7c82('0x6b'))](_['upperFirst'](_0x7c82('0x5f'))+_0x7c82('0x77'));}return _0x2d822e[_0x7c82('0x6c')](_0x541805);}})[_0x7c82('0x29')](handleError(_0x2d822e,null));};exports[_0x7c82('0x78')]=function(_0x1840ec,_0x4bfa93,_0x1f57b9){if(_0x1840ec['file']&&_0x1840ec['file'][_0x7c82('0x5a')]){_0x1840ec['body'][_0x7c82('0x6e')]=_0x1840ec['file'][_0x7c82('0x5a')];}return db['Setting'][_0x7c82('0x56')]({'where':{'id':_0x1840ec[_0x7c82('0x54')]['id']}})[_0x7c82('0x1e')](handleEntityNotFound(_0x4bfa93,null))[_0x7c82('0x1e')](saveUpdates(_0x1840ec[_0x7c82('0x57')],null))[_0x7c82('0x1e')](respondWithResult(_0x4bfa93,null))['catch'](handleError(_0x4bfa93,null));};var utilLicense=require(_0x7c82('0x5c'));exports[_0x7c82('0x79')]=function(_0x1b80e3,_0x3c2f45,_0x26faee){var _0x2a939f=_0x7c82('0x6d');var _0xd43593={'custom':![]};return utilLicense[_0x7c82('0x76')]()['then'](function(_0x3d003a){if(_0x3d003a){_0xd43593=_0x3d003a;}return db[_0x7c82('0x51')][_0x7c82('0x56')]({'where':{'id':_0x1b80e3['params']['id']},'attributes':[_0x7c82('0x5e'),_0x7c82('0x5b'),'preferred',_0x7c82('0x6e'),_0x7c82('0x60'),_0x7c82('0x61'),_0x7c82('0x6f'),_0x7c82('0x70')],'raw':!![]});})[_0x7c82('0x1e')](handleEntityNotFound(_0x3c2f45,null))[_0x7c82('0x1e')](function(_0xc6059){if(_0xc6059){var _0x82bc15=_0xc6059[_0x7c82('0x6e')]&&fs[_0x7c82('0x69')](path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x2a939f,_[_0x7c82('0x64')](_0xc6059['favicon'])))?path['join'](config[_0x7c82('0x63')],_0x2a939f,_[_0x7c82('0x64')](_0xc6059[_0x7c82('0x6e')])):path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x2a939f,_[_0x7c82('0x64')](_0x7c82('0x7a')));var _0x4edac9=_0x7c82('0x66')+_[_0x7c82('0x67')](_0x7c82('0x6e'));if(_0xc6059[_0x4edac9]||!_0xd43593['custom']){_0x82bc15=path[_0x7c82('0x62')](config[_0x7c82('0x63')],_0x2a939f,_[_0x7c82('0x64')](_0x7c82('0x7a')));}if(!fs[_0x7c82('0x69')](_0x82bc15)){throw new db[(_0x7c82('0x6a'))]['ValidationError'](_[_0x7c82('0x67')](_0x7c82('0x6e'))+_0x7c82('0x77'));}return _0x3c2f45['download'](_0x82bc15);}})[_0x7c82('0x29')](handleError(_0x3c2f45,null));};exports['getDate']=function(_0x3cd409,_0x6bbf30){var _0x473450={'offset':moment()[_0x7c82('0x7b')]()};_0x473450[_0x7c82('0x7c')]=moment()[_0x7c82('0x7b')](_0x473450[_0x7c82('0x30')])[_0x7c82('0x7d')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x6bbf30[_0x7c82('0x2c')](0xc8)[_0x7c82('0x7e')](_0x473450);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 92e9c45..494a1fa 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(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x21ab6f,_0x1cee2b){var _0x2ffdbc=function(_0x18a4d1){while(--_0x18a4d1){_0x21ab6f['push'](_0x21ab6f['shift']());}};_0x2ffdbc(++_0x1cee2b);}(_0x34e8,0x12c));var _0x834e=function(_0x3c3f9e,_0x392128){_0x3c3f9e=_0x3c3f9e-0x0;var _0x3c6949=_0x34e8[_0x3c3f9e];return _0x3c6949;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'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 e22e158..eba798b 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 _0x7c44=['Setting','find','options','raw','where','include','map','attributes','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting'];(function(_0x328e46,_0x22dc8e){var _0x43a5cc=function(_0x1b6b76){while(--_0x1b6b76){_0x328e46['push'](_0x328e46['shift']());}};_0x43a5cc(++_0x22dc8e);}(_0x7c44,0x1e6));var _0x47c4=function(_0x57f323,_0x1d9114){_0x57f323=_0x57f323-0x0;var _0x51b83e=_0x7c44[_0x57f323];return _0x51b83e;};'use strict';var _=require(_0x47c4('0x0'));var util=require(_0x47c4('0x1'));var moment=require(_0x47c4('0x2'));var BPromise=require(_0x47c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47c4('0x4'));var db=require(_0x47c4('0x5'))['db'];var utils=require(_0x47c4('0x6'));var logger=require('../../config/logger')(_0x47c4('0x7'));var config=require(_0x47c4('0x8'));var jayson=require(_0x47c4('0x9'));var client=jayson[_0x47c4('0xa')][_0x47c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5371d3,_0x40755f,_0x3aed73){return new BPromise(function(_0x2dec24,_0x365ca1){return client[_0x47c4('0xc')](_0x5371d3,_0x3aed73)['then'](function(_0x3560b6){logger[_0x47c4('0xd')](_0x47c4('0xe'),_0x40755f,_0x47c4('0xf'));logger[_0x47c4('0x10')](_0x47c4('0x11'),_0x40755f,_0x47c4('0xf'),JSON[_0x47c4('0x12')](_0x3560b6));if(_0x3560b6['error']){if(_0x3560b6[_0x47c4('0x13')][_0x47c4('0x14')]===0x1f4){logger[_0x47c4('0x13')](_0x47c4('0xe'),_0x40755f,_0x3560b6['error'][_0x47c4('0x15')]);return _0x365ca1(_0x3560b6[_0x47c4('0x13')]['message']);}logger[_0x47c4('0x13')](_0x47c4('0xe'),_0x40755f,_0x3560b6[_0x47c4('0x13')][_0x47c4('0x15')]);return _0x2dec24(_0x3560b6[_0x47c4('0x13')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x40755f,_0x47c4('0xf'));_0x2dec24(_0x3560b6['result'][_0x47c4('0x15')]);}})[_0x47c4('0x16')](function(_0x56205e){logger[_0x47c4('0x13')](_0x47c4('0xe'),_0x40755f,_0x56205e);_0x365ca1(_0x56205e);});});}exports[_0x47c4('0x17')]=function(_0x9c3545){var _0x1186d1=this;return new Promise(function(_0x4bbbf9,_0x571a96){return db[_0x47c4('0x18')][_0x47c4('0x19')]({'raw':_0x9c3545[_0x47c4('0x1a')]?_0x9c3545['options'][_0x47c4('0x1b')]===undefined?!![]:![]:!![],'where':_0x9c3545[_0x47c4('0x1a')]?_0x9c3545['options'][_0x47c4('0x1c')]||null:null,'attributes':_0x9c3545[_0x47c4('0x1a')]?_0x9c3545['options']['attributes']||null:null,'include':_0x9c3545['options']?_0x9c3545['options'][_0x47c4('0x1d')]?_[_0x47c4('0x1e')](_0x9c3545['options'][_0x47c4('0x1d')],function(_0x46a8c2){return{'model':db[_0x46a8c2['model']],'as':_0x46a8c2['as'],'attributes':_0x46a8c2[_0x47c4('0x1f')],'include':_0x46a8c2[_0x47c4('0x1d')]?_[_0x47c4('0x1e')](_0x46a8c2[_0x47c4('0x1d')],function(_0x2e8df7){return{'model':db[_0x2e8df7[_0x47c4('0x20')]],'as':_0x2e8df7['as'],'attributes':_0x2e8df7[_0x47c4('0x1f')],'include':_0x2e8df7[_0x47c4('0x1d')]?_[_0x47c4('0x1e')](_0x2e8df7[_0x47c4('0x1d')],function(_0x8d779a){return{'model':db[_0x8d779a[_0x47c4('0x20')]],'as':_0x8d779a['as'],'attributes':_0x8d779a['attributes']};}):[]};}):[]};}):[]:[]})[_0x47c4('0x21')](function(_0x290b96){logger[_0x47c4('0xd')](_0x47c4('0x17'),_0x9c3545);logger['debug'](_0x47c4('0x17'),_0x9c3545,JSON[_0x47c4('0x12')](_0x290b96));_0x4bbbf9(_0x290b96);})[_0x47c4('0x16')](function(_0x5b7dd1){logger[_0x47c4('0x13')]('ShowSetting',_0x5b7dd1[_0x47c4('0x15')],_0x9c3545);_0x571a96(_0x1186d1[_0x47c4('0x13')](0x1f4,_0x5b7dd1[_0x47c4('0x15')]));});});}; \ No newline at end of file +var _0x4843=['attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','info','Setting,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','ShowSetting','Setting','find','options','raw','where'];(function(_0x379c8f,_0x227ad5){var _0x21689a=function(_0x4d3724){while(--_0x4d3724){_0x379c8f['push'](_0x379c8f['shift']());}};_0x21689a(++_0x227ad5);}(_0x4843,0xd6));var _0x3484=function(_0x5fd00b,_0x136f04){_0x5fd00b=_0x5fd00b-0x0;var _0x141f3c=_0x4843[_0x5fd00b];return _0x141f3c;};'use strict';var _=require(_0x3484('0x0'));var util=require(_0x3484('0x1'));var moment=require(_0x3484('0x2'));var BPromise=require(_0x3484('0x3'));var rs=require(_0x3484('0x4'));var fs=require('fs');var Redis=require(_0x3484('0x5'));var db=require(_0x3484('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3484('0x7'))(_0x3484('0x8'));var config=require('../../config/environment');var jayson=require(_0x3484('0x9'));var client=jayson[_0x3484('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5868bd,_0x5e714e,_0x2d4a61){return new BPromise(function(_0x3561fc,_0x194643){return client['request'](_0x5868bd,_0x2d4a61)['then'](function(_0x454eb3){logger[_0x3484('0xb')](_0x3484('0xc'),_0x5e714e,'request\x20sent');logger[_0x3484('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x5e714e,'request\x20sent',JSON[_0x3484('0xe')](_0x454eb3));if(_0x454eb3[_0x3484('0xf')]){if(_0x454eb3[_0x3484('0xf')]['code']===0x1f4){logger[_0x3484('0xf')](_0x3484('0xc'),_0x5e714e,_0x454eb3[_0x3484('0xf')]['message']);return _0x194643(_0x454eb3[_0x3484('0xf')][_0x3484('0x10')]);}logger[_0x3484('0xf')](_0x3484('0xc'),_0x5e714e,_0x454eb3['error'][_0x3484('0x10')]);return _0x3561fc(_0x454eb3['error'][_0x3484('0x10')]);}else{logger[_0x3484('0xb')]('Setting,\x20%s,\x20%s',_0x5e714e,_0x3484('0x11'));_0x3561fc(_0x454eb3[_0x3484('0x12')][_0x3484('0x10')]);}})[_0x3484('0x13')](function(_0x2e4751){logger[_0x3484('0xf')](_0x3484('0xc'),_0x5e714e,_0x2e4751);_0x194643(_0x2e4751);});});}exports[_0x3484('0x14')]=function(_0x3e2040){var _0x1a25c6=this;return new Promise(function(_0x1a6441,_0x4100b7){return db[_0x3484('0x15')][_0x3484('0x16')]({'raw':_0x3e2040[_0x3484('0x17')]?_0x3e2040['options'][_0x3484('0x18')]===undefined?!![]:![]:!![],'where':_0x3e2040[_0x3484('0x17')]?_0x3e2040[_0x3484('0x17')][_0x3484('0x19')]||null:null,'attributes':_0x3e2040[_0x3484('0x17')]?_0x3e2040[_0x3484('0x17')][_0x3484('0x1a')]||null:null,'include':_0x3e2040[_0x3484('0x17')]?_0x3e2040[_0x3484('0x17')][_0x3484('0x1b')]?_[_0x3484('0x1c')](_0x3e2040[_0x3484('0x17')][_0x3484('0x1b')],function(_0x697dde){return{'model':db[_0x697dde[_0x3484('0x1d')]],'as':_0x697dde['as'],'attributes':_0x697dde[_0x3484('0x1a')],'include':_0x697dde[_0x3484('0x1b')]?_['map'](_0x697dde[_0x3484('0x1b')],function(_0x447ffd){return{'model':db[_0x447ffd[_0x3484('0x1d')]],'as':_0x447ffd['as'],'attributes':_0x447ffd[_0x3484('0x1a')],'include':_0x447ffd[_0x3484('0x1b')]?_[_0x3484('0x1c')](_0x447ffd[_0x3484('0x1b')],function(_0x2112c8){return{'model':db[_0x2112c8[_0x3484('0x1d')]],'as':_0x2112c8['as'],'attributes':_0x2112c8[_0x3484('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cb42a){logger[_0x3484('0xb')](_0x3484('0x14'),_0x3e2040);logger[_0x3484('0xd')](_0x3484('0x14'),_0x3e2040,JSON['stringify'](_0x4cb42a));_0x1a6441(_0x4cb42a);})[_0x3484('0x13')](function(_0x48df4b){logger[_0x3484('0xf')](_0x3484('0x14'),_0x48df4b['message'],_0x3e2040);_0x4100b7(_0x1a25c6[_0x3484('0xf')](0x1f4,_0x48df4b[_0x3484('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 2742ce7..536aa34 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x3dfbc3,_0x41a601){var _0x53fc9e=function(_0xaeae50){while(--_0xaeae50){_0x3dfbc3['push'](_0x3dfbc3['shift']());}};_0x53fc9e(++_0x41a601);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x53dfbe,_0x38ac78){var _0x4f7d2b=function(_0x110708){while(--_0x110708){_0x53dfbe['push'](_0x53dfbe['shift']());}};_0x4f7d2b(++_0x38ac78);}(_0x7a54,0x106));var _0x47a5=function(_0x4009b3,_0xad2794){_0x4009b3=_0x4009b3-0x0;var _0x86f878=_0x7a54[_0x4009b3];return _0x86f878;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 474d594..68a6cfb 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 _0xbce1=['twilio','connectel','clicksend','plivo','bandwidth','infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x2ddafd,_0x1a89ac){var _0xa98df2=function(_0x2e2f59){while(--_0x2e2f59){_0x2ddafd['push'](_0x2ddafd['shift']());}};_0xa98df2(++_0x1a89ac);}(_0xbce1,0x112));var _0x1bce=function(_0x489d29,_0x57bb79){_0x489d29=_0x489d29-0x0;var _0x2cb1ca=_0xbce1[_0x489d29];return _0x2cb1ca;};'use strict';var Sequelize=require(_0x1bce('0x0'));var rs=require(_0x1bce('0x1'));module[_0x1bce('0x2')]={'name':{'type':Sequelize[_0x1bce('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1bce('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1bce('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1bce('0x4')]();}},'phone':{'type':Sequelize[_0x1bce('0x3')]},'type':{'type':Sequelize[_0x1bce('0x5')](_0x1bce('0x6'),'skebby',_0x1bce('0x7'),_0x1bce('0x8'),_0x1bce('0x9'),'clickatell',_0x1bce('0xa'),'csc',_0x1bce('0xb'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x1bce('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1bce('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x1bce('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x1bce('0x3')]},'deliveryReport':{'type':Sequelize[_0x1bce('0xc')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1bce('0xd');}},'notificationSound':{'type':Sequelize[_0x1bce('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1bce('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1bce('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1bce('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1bce('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1bce('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1bce('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1bce('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1bce('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x1bce('0xc')],'defaultValue':![],'comment':_0x1bce('0x10'),'set':function(_0x2d634b){if(!_0x2d634b)this[_0x1bce('0x11')](_0x1bce('0x12'),null);this[_0x1bce('0x11')](_0x1bce('0x13'),_0x2d634b);}}}; \ No newline at end of file +var _0x2d54=['TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','csc','intelepeer','BOOLEAN'];(function(_0x58319a,_0x145060){var _0x4cf654=function(_0x314238){while(--_0x314238){_0x58319a['push'](_0x58319a['shift']());}};_0x4cf654(++_0x145060);}(_0x2d54,0x133));var _0x42d5=function(_0x585276,_0x553f5a){_0x585276=_0x585276-0x0;var _0x4a7181=_0x2d54[_0x585276];return _0x4a7181;};'use strict';var Sequelize=require(_0x42d5('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x42d5('0x1')],'unique':_0x42d5('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x42d5('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x42d5('0x1')],'defaultValue':function(){return rs[_0x42d5('0x3')]();}},'phone':{'type':Sequelize[_0x42d5('0x1')]},'type':{'type':Sequelize[_0x42d5('0x4')](_0x42d5('0x5'),_0x42d5('0x6'),_0x42d5('0x7'),_0x42d5('0x8'),'plivo',_0x42d5('0x9'),'bandwidth',_0x42d5('0xa'),'infobip',_0x42d5('0xb'))},'accountSid':{'type':Sequelize[_0x42d5('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x42d5('0x1')]},'smsMethod':{'type':Sequelize[_0x42d5('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x42d5('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x42d5('0x1')]},'applicationId':{'type':Sequelize[_0x42d5('0x1')]},'accountId':{'type':Sequelize[_0x42d5('0x1')]},'senderString':{'type':Sequelize[_0x42d5('0x1')]},'deliveryReport':{'type':Sequelize[_0x42d5('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x42d5('0x1')]},'notificationTemplate':{'type':Sequelize[_0x42d5('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x42d5('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x42d5('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x42d5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x42d5('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x42d5('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x42d5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x42d5('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x42d5('0xe')],'comment':_0x42d5('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x42d5('0xc')],'defaultValue':![],'comment':_0x42d5('0x10'),'set':function(_0x632ea7){if(!_0x632ea7)this[_0x42d5('0x11')](_0x42d5('0x12'),null);this[_0x42d5('0x11')](_0x42d5('0x13'),_0x632ea7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9b0ae73..3561113 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 _0xfd39=['addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','sort','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','sms','SmsApplication','Applications','account','priority','asc','CmContact','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','sender','text','connectel','clicksend','message_id','plivo','From','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','omit','Contacts','defaults','contact','SmsInteraction','interaction','autoclose','applications','push','close','*,*,*,*','created','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','queue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','groupName','DELIVERED','bandwidth','intelepeer','redif','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id'];(function(_0x102d14,_0x1fc703){var _0x461d97=function(_0x126ebd){while(--_0x126ebd){_0x102d14['push'](_0x102d14['shift']());}};_0x461d97(++_0x1fc703);}(_0xfd39,0x1d3));var _0x9fd3=function(_0x22c098,_0x268c6a){_0x22c098=_0x22c098-0x0;var _0x259541=_0xfd39[_0x22c098];return _0x259541;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9fd3('0x0'));var rp=require(_0x9fd3('0x1'));var moment=require(_0x9fd3('0x2'));var BPromise=require(_0x9fd3('0x3'));var Mustache=require(_0x9fd3('0x4'));var util=require(_0x9fd3('0x5'));var path=require('path');var sox=require(_0x9fd3('0x6'));var csv=require('to-csv');var ejs=require(_0x9fd3('0x7'));var fs=require('fs');var fs_extra=require(_0x9fd3('0x8'));var _=require(_0x9fd3('0x9'));var squel=require('squel');var crypto=require(_0x9fd3('0xa'));var jsforce=require(_0x9fd3('0xb'));var deskjs=require(_0x9fd3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9fd3('0xd'));var Papa=require(_0x9fd3('0xe'));var Redis=require(_0x9fd3('0xf'));var authService=require(_0x9fd3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9fd3('0x11'));var hardwareService=require(_0x9fd3('0x12'));var logger=require(_0x9fd3('0x13'))('api');var utils=require(_0x9fd3('0x14'));var config=require(_0x9fd3('0x15'));var licenseUtil=require(_0x9fd3('0x16'));var db=require('../../mysqldb')['db'];config[_0x9fd3('0x17')]=_['defaults'](config['redis'],{'host':_0x9fd3('0x18'),'port':0x18eb});var socket=require(_0x9fd3('0x19'))(new Redis(config[_0x9fd3('0x17')]));require(_0x9fd3('0x1a'))[_0x9fd3('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9fd3('0x1c')][_0x9fd3('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x12bc27,_0x15cd29,_0x2e8b55,_0xf74513){return new BPromise(function(_0x3e6b12,_0x92d38f){var _0x467199=_0xf74513||client;return _0x467199[_0x9fd3('0x1e')](_0x12bc27,_0x2e8b55)[_0x9fd3('0x1f')](function(_0xffca7d){logger[_0x9fd3('0x20')]('SmsAccount,\x20%s,\x20%s',_0x15cd29,_0x9fd3('0x21'));logger[_0x9fd3('0x22')](_0x9fd3('0x23'),_0x15cd29,'request\x20sent',JSON[_0x9fd3('0x24')](_0xffca7d));if(_0xffca7d[_0x9fd3('0x25')]){if(_0xffca7d[_0x9fd3('0x25')][_0x9fd3('0x26')]===0x1f4){logger[_0x9fd3('0x25')]('SmsAccount,\x20%s,\x20%s',_0x15cd29,_0xffca7d[_0x9fd3('0x25')]['message']);return _0x92d38f(_0xffca7d[_0x9fd3('0x25')][_0x9fd3('0x27')]);}logger[_0x9fd3('0x25')](_0x9fd3('0x28'),_0x15cd29,_0xffca7d['error'][_0x9fd3('0x27')]);return _0x3e6b12(_0xffca7d[_0x9fd3('0x25')][_0x9fd3('0x27')]);}else{logger[_0x9fd3('0x20')](_0x9fd3('0x28'),_0x15cd29,_0x9fd3('0x21'));_0x3e6b12(_0xffca7d[_0x9fd3('0x29')][_0x9fd3('0x27')]);}})[_0x9fd3('0x2a')](function(_0x233a4b){logger['error'](_0x9fd3('0x28'),_0x15cd29,_0x233a4b);_0x92d38f(_0x233a4b);});});}function respondWithStatusCode(_0x3e2a55,_0x419f36){_0x419f36=_0x419f36||0xcc;return function(_0x2a3adb){if(_0x2a3adb){return _0x3e2a55[_0x9fd3('0x2b')](_0x419f36);}return _0x3e2a55['status'](_0x419f36)[_0x9fd3('0x2c')]();};}function respondWithResult(_0x18a985,_0x1715da){_0x1715da=_0x1715da||0xc8;return function(_0x2db45c){if(_0x2db45c){return _0x18a985['status'](_0x1715da)[_0x9fd3('0x2d')](_0x2db45c);}};}function respondWithFilteredResult(_0x2a920f,_0x5c85a5){return function(_0x27ca16){if(_0x27ca16){var _0xe43c27=typeof _0x5c85a5[_0x9fd3('0x2e')]===_0x9fd3('0x2f')&&typeof _0x5c85a5[_0x9fd3('0x30')]===_0x9fd3('0x2f');var _0x3782f8=_0x27ca16['count'];var _0x323fdb=_0xe43c27?0x0:_0x5c85a5['offset'];var _0x131772=_0xe43c27?_0x27ca16[_0x9fd3('0x31')]:_0x5c85a5[_0x9fd3('0x2e')]+_0x5c85a5[_0x9fd3('0x30')];var _0x536312;if(_0x131772>=_0x3782f8){_0x131772=_0x3782f8;_0x536312=0xc8;}else{_0x536312=0xce;}_0x2a920f[_0x9fd3('0x32')](_0x536312);return _0x2a920f[_0x9fd3('0x33')](_0x9fd3('0x34'),_0x323fdb+'-'+_0x131772+'/'+_0x3782f8)[_0x9fd3('0x2d')](_0x27ca16);}return null;};}function patchUpdates(_0x1df2f9){return function(_0x11c342){try{jsonpatch['apply'](_0x11c342,_0x1df2f9,!![]);}catch(_0x57046f){return BPromise[_0x9fd3('0x35')](_0x57046f);}return _0x11c342[_0x9fd3('0x36')]();};}function saveUpdates(_0x197b45,_0x33cbcb){return function(_0x1801f9){if(_0x1801f9){return _0x1801f9[_0x9fd3('0x37')](_0x197b45)['then'](function(_0x2e9c50){return _0x2e9c50;});}return null;};}function removeEntity(_0x5e6770,_0x681c2c){return function(_0x205ce3){if(_0x205ce3){return _0x205ce3[_0x9fd3('0x38')]()[_0x9fd3('0x1f')](function(){var _0x343a50=_0x205ce3['get']({'plain':!![]});var _0xec9d3e=_0x9fd3('0x39');return db['UserProfileResource'][_0x9fd3('0x38')]({'where':{'type':_0xec9d3e,'resourceId':_0x343a50['id']}})[_0x9fd3('0x1f')](function(){return _0x205ce3;});})['then'](function(){_0x5e6770[_0x9fd3('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5787c7,_0x417d06){return function(_0x4d4342){if(!_0x4d4342){_0x5787c7['sendStatus'](0x194);}return _0x4d4342;};}function handleError(_0x21aa64,_0x2128cc){_0x2128cc=_0x2128cc||0x1f4;return function(_0x415fc1){logger['error'](_0x415fc1[_0x9fd3('0x3a')]);if(_0x415fc1[_0x9fd3('0x3b')]){delete _0x415fc1['name'];}_0x21aa64['status'](_0x2128cc)[_0x9fd3('0x3c')](_0x415fc1);};}exports[_0x9fd3('0x3d')]=function(_0x4630c7,_0x17093c){var _0xfa41b5={'include':[{'model':db[_0x9fd3('0x3e')],'as':_0x9fd3('0x3f')}]},_0x1b8df1={},_0x59696b={'count':0x0,'rows':[]};var _0x29fea8=_[_0x9fd3('0x40')](db[_0x9fd3('0x41')][_0x9fd3('0x42')],function(_0x443c71){return{'name':_0x443c71['fieldName'],'type':_0x443c71[_0x9fd3('0x43')][_0x9fd3('0x44')]};});_0x1b8df1[_0x9fd3('0x45')]=_[_0x9fd3('0x40')](_0x29fea8,_0x9fd3('0x3b'));_0x1b8df1['query']=_[_0x9fd3('0x46')](_0x4630c7['query']);_0x1b8df1[_0x9fd3('0x47')]=_[_0x9fd3('0x48')](_0x1b8df1['model'],_0x1b8df1[_0x9fd3('0x49')]);_0xfa41b5['attributes']=_[_0x9fd3('0x48')](_0x1b8df1['model'],qs[_0x9fd3('0x4a')](_0x4630c7[_0x9fd3('0x49')][_0x9fd3('0x4a')]));_0xfa41b5[_0x9fd3('0x4b')]=_0xfa41b5[_0x9fd3('0x4b')][_0x9fd3('0x4c')]?_0xfa41b5[_0x9fd3('0x4b')]:_0x1b8df1['model'];if(!_0x4630c7[_0x9fd3('0x49')][_0x9fd3('0x4d')](_0x9fd3('0x4e'))){_0xfa41b5['limit']=qs[_0x9fd3('0x30')](_0x4630c7[_0x9fd3('0x49')][_0x9fd3('0x30')]);_0xfa41b5[_0x9fd3('0x2e')]=qs[_0x9fd3('0x2e')](_0x4630c7[_0x9fd3('0x49')][_0x9fd3('0x2e')]);}_0xfa41b5[_0x9fd3('0x4f')]=qs['sort'](_0x4630c7['query']['sort']);_0xfa41b5['where']=qs['filters'](_[_0x9fd3('0x50')](_0x4630c7[_0x9fd3('0x49')],_0x1b8df1[_0x9fd3('0x47')]),_0x29fea8);if(_0x4630c7[_0x9fd3('0x49')][_0x9fd3('0x51')]){_0xfa41b5['where']=_[_0x9fd3('0x52')](_0xfa41b5[_0x9fd3('0x53')],{'$or':_[_0x9fd3('0x40')](_0x29fea8,function(_0x10a3ec){if(_0x10a3ec['type']!==_0x9fd3('0x54')){var _0x51f01e={};_0x51f01e[_0x10a3ec[_0x9fd3('0x3b')]]={'$like':'%'+_0x4630c7['query'][_0x9fd3('0x51')]+'%'};return _0x51f01e;}})});}_0xfa41b5=_[_0x9fd3('0x52')]({},_0xfa41b5,_0x4630c7[_0x9fd3('0x55')]);var _0x1f3135={'where':_0xfa41b5['where']};return db['SmsAccount'][_0x9fd3('0x31')](_0x1f3135)[_0x9fd3('0x1f')](function(_0x449a5e){_0x59696b[_0x9fd3('0x31')]=_0x449a5e;if(_0x4630c7[_0x9fd3('0x49')][_0x9fd3('0x56')]){_0xfa41b5[_0x9fd3('0x57')]=[{'all':!![]}];}return db[_0x9fd3('0x41')][_0x9fd3('0x58')](_0xfa41b5);})[_0x9fd3('0x1f')](function(_0x3c0f1c){_0x59696b[_0x9fd3('0x59')]=_0x3c0f1c;return _0x59696b;})[_0x9fd3('0x1f')](respondWithFilteredResult(_0x17093c,_0xfa41b5))[_0x9fd3('0x2a')](handleError(_0x17093c,null));};exports['show']=function(_0x59a53d,_0x40d400){var _0x1a3703={'raw':![],'where':{'id':_0x59a53d[_0x9fd3('0x5a')]['id']},'include':[{'model':db[_0x9fd3('0x3e')],'as':_0x9fd3('0x3f')}]},_0x20be03={};_0x20be03[_0x9fd3('0x45')]=_[_0x9fd3('0x46')](db['SmsAccount'][_0x9fd3('0x42')]);_0x20be03[_0x9fd3('0x49')]=_[_0x9fd3('0x46')](_0x59a53d[_0x9fd3('0x49')]);_0x20be03[_0x9fd3('0x47')]=_[_0x9fd3('0x48')](_0x20be03[_0x9fd3('0x45')],_0x20be03[_0x9fd3('0x49')]);_0x1a3703[_0x9fd3('0x4b')]=_[_0x9fd3('0x48')](_0x20be03['model'],qs['fields'](_0x59a53d[_0x9fd3('0x49')][_0x9fd3('0x4a')]));_0x1a3703[_0x9fd3('0x4b')]=_0x1a3703[_0x9fd3('0x4b')]['length']?_0x1a3703[_0x9fd3('0x4b')]:_0x20be03[_0x9fd3('0x45')];if(_0x59a53d[_0x9fd3('0x49')]['includeAll']){_0x1a3703[_0x9fd3('0x57')]=[{'all':!![]}];}_0x1a3703=_[_0x9fd3('0x52')]({},_0x1a3703,_0x59a53d[_0x9fd3('0x55')]);return db[_0x9fd3('0x41')][_0x9fd3('0x5b')](_0x1a3703)[_0x9fd3('0x1f')](handleEntityNotFound(_0x40d400,null))[_0x9fd3('0x1f')](respondWithResult(_0x40d400,null))['catch'](handleError(_0x40d400,null));};exports['create']=function(_0xccf863,_0x5d4e16){return db[_0x9fd3('0x41')][_0x9fd3('0x5c')](_0xccf863[_0x9fd3('0x5d')],{})['then'](function(_0x2d6bb1){var _0x2044f8=_0xccf863['user'][_0x9fd3('0x5e')]({'plain':!![]});if(!_0x2044f8)throw new Error(_0x9fd3('0x5f'));if(_0x2044f8[_0x9fd3('0x60')]===_0x9fd3('0x61')){var _0x122143=_0x2d6bb1[_0x9fd3('0x5e')]({'plain':!![]});var _0x292a20=_0x9fd3('0x39');return db[_0x9fd3('0x62')][_0x9fd3('0x5b')]({'where':{'name':_0x292a20,'userProfileId':_0x2044f8[_0x9fd3('0x63')]},'raw':!![]})[_0x9fd3('0x1f')](function(_0x14831e){if(_0x14831e&&_0x14831e[_0x9fd3('0x64')]===0x0){return db[_0x9fd3('0x65')]['create']({'name':_0x122143[_0x9fd3('0x3b')],'resourceId':_0x122143['id'],'type':_0x14831e[_0x9fd3('0x3b')],'sectionId':_0x14831e['id']},{})[_0x9fd3('0x1f')](function(){return _0x2d6bb1;});}else{return _0x2d6bb1;}})[_0x9fd3('0x2a')](function(_0x306baa){logger[_0x9fd3('0x25')](_0x9fd3('0x66'),_0x306baa);throw _0x306baa;});}return _0x2d6bb1;})[_0x9fd3('0x1f')](respondWithResult(_0x5d4e16,0xc9))['catch'](handleError(_0x5d4e16,null));};exports[_0x9fd3('0x37')]=function(_0x27034c,_0xdb881d){if(_0x27034c[_0x9fd3('0x5d')]['id']){delete _0x27034c['body']['id'];}return db['SmsAccount'][_0x9fd3('0x5b')]({'where':{'id':_0x27034c[_0x9fd3('0x5a')]['id']},'include':[{'model':db[_0x9fd3('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x9fd3('0x1f')](handleEntityNotFound(_0xdb881d,null))['then'](saveUpdates(_0x27034c[_0x9fd3('0x5d')],null))['then'](respondWithResult(_0xdb881d,null))[_0x9fd3('0x2a')](handleError(_0xdb881d,null));};exports[_0x9fd3('0x38')]=function(_0x10610a,_0x4e47be){return db[_0x9fd3('0x41')]['find']({'where':{'id':_0x10610a['params']['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x4e47be,null))[_0x9fd3('0x1f')](removeEntity(_0x4e47be,null))[_0x9fd3('0x2a')](handleError(_0x4e47be,null));};exports[_0x9fd3('0x67')]=function(_0x1ec334,_0x504bb5){return db['SmsAccount']['describe']()[_0x9fd3('0x1f')](respondWithResult(_0x504bb5,null))['catch'](handleError(_0x504bb5,null));};exports[_0x9fd3('0x68')]=function(_0x2e3e2f,_0x54f472,_0x1b2cd1){if(_0x2e3e2f['body']['id']){delete _0x2e3e2f[_0x9fd3('0x5d')]['id'];}return db[_0x9fd3('0x41')]['find']({'where':{'id':_0x2e3e2f[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x54f472,null))['then'](function(_0x40dd91){if(_0x40dd91){_0x2e3e2f[_0x9fd3('0x5d')]['SmsAccountId']=_0x40dd91['id'];return db[_0x9fd3('0x69')][_0x9fd3('0x5c')](_0x2e3e2f['body']);}})[_0x9fd3('0x1f')](respondWithResult(_0x54f472,null))[_0x9fd3('0x2a')](handleError(_0x54f472,null));};exports['getDispositions']=function(_0x53c9a9,_0x2b8359,_0x4db538){var _0x48216f={'raw':![],'where':{}};var _0x2d799e={};var _0x2346b5={'count':0x0,'rows':[]};return db[_0x9fd3('0x41')][_0x9fd3('0x6a')]({'where':{'id':_0x53c9a9[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x2b8359,null))[_0x9fd3('0x1f')](function(_0x14fb14){if(_0x14fb14){_0x2d799e[_0x9fd3('0x45')]=_[_0x9fd3('0x46')](db[_0x9fd3('0x69')][_0x9fd3('0x42')]);_0x2d799e[_0x9fd3('0x49')]=_[_0x9fd3('0x46')](_0x53c9a9[_0x9fd3('0x49')]);_0x2d799e[_0x9fd3('0x47')]=_[_0x9fd3('0x48')](_0x2d799e['model'],_0x2d799e[_0x9fd3('0x49')]);_0x48216f[_0x9fd3('0x4b')]=_[_0x9fd3('0x48')](_0x2d799e[_0x9fd3('0x45')],qs['fields'](_0x53c9a9['query']['fields']));_0x48216f[_0x9fd3('0x4b')]=_0x48216f[_0x9fd3('0x4b')]['length']?_0x48216f[_0x9fd3('0x4b')]:_0x2d799e[_0x9fd3('0x45')];if(!_0x53c9a9[_0x9fd3('0x49')]['hasOwnProperty'](_0x9fd3('0x4e'))){_0x48216f['limit']=qs['limit'](_0x53c9a9[_0x9fd3('0x49')][_0x9fd3('0x30')]);_0x48216f[_0x9fd3('0x2e')]=qs['offset'](_0x53c9a9['query'][_0x9fd3('0x2e')]);}_0x48216f['order']=qs['sort'](_0x53c9a9[_0x9fd3('0x49')][_0x9fd3('0x6b')]);_0x48216f['where']=qs['filters'](_[_0x9fd3('0x50')](_0x53c9a9[_0x9fd3('0x49')],_0x2d799e[_0x9fd3('0x47')]));_0x48216f[_0x9fd3('0x53')][_0x9fd3('0x6c')]=_0x14fb14['id'];if(_0x53c9a9['query'][_0x9fd3('0x51')]){_0x48216f[_0x9fd3('0x53')]=_['merge'](_0x48216f['where'],{'$or':_['map'](_0x48216f[_0x9fd3('0x4b')],function(_0x248c6c){var _0x21c815={};_0x21c815[_0x248c6c]={'$like':'%'+_0x53c9a9[_0x9fd3('0x49')][_0x9fd3('0x51')]+'%'};return _0x21c815;})});}_0x48216f=_['merge']({},_0x48216f,_0x53c9a9[_0x9fd3('0x55')]);return db['Disposition'][_0x9fd3('0x31')]({'where':_0x48216f[_0x9fd3('0x53')]})[_0x9fd3('0x1f')](function(_0x5ab996){_0x2346b5[_0x9fd3('0x31')]=_0x5ab996;if(_0x53c9a9[_0x9fd3('0x49')]['includeAll']){_0x48216f['include']=[{'all':!![]}];}return db[_0x9fd3('0x69')][_0x9fd3('0x58')](_0x48216f);})[_0x9fd3('0x1f')](function(_0x116a0b){_0x2346b5[_0x9fd3('0x59')]=_0x116a0b;return _0x2346b5;});}})[_0x9fd3('0x1f')](respondWithFilteredResult(_0x2b8359,_0x48216f))[_0x9fd3('0x2a')](handleError(_0x2b8359,null));};exports[_0x9fd3('0x6d')]=function(_0x17c1f2,_0x25009a,_0x1e80f8){return db[_0x9fd3('0x41')]['find']({'where':{'id':_0x17c1f2[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x25009a,null))['then'](function(_0x3c9cf4){if(_0x3c9cf4){return _0x3c9cf4['removeDispositions'](_0x17c1f2[_0x9fd3('0x49')][_0x9fd3('0x6e')]);}})[_0x9fd3('0x1f')](respondWithStatusCode(_0x25009a,null))[_0x9fd3('0x2a')](handleError(_0x25009a,null));};exports[_0x9fd3('0x6f')]=function(_0x5f18fc,_0x210caa,_0x3cbab9){if(_0x5f18fc[_0x9fd3('0x5d')]['id']){delete _0x5f18fc[_0x9fd3('0x5d')]['id'];}return db['SmsAccount'][_0x9fd3('0x5b')]({'where':{'id':_0x5f18fc['params']['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x210caa,null))[_0x9fd3('0x1f')](function(_0x22736b){if(_0x22736b){_0x5f18fc[_0x9fd3('0x5d')][_0x9fd3('0x6c')]=_0x22736b['id'];return db[_0x9fd3('0x70')][_0x9fd3('0x5c')](_0x5f18fc[_0x9fd3('0x5d')]);}})[_0x9fd3('0x1f')](respondWithResult(_0x210caa,null))['catch'](handleError(_0x210caa,null));};exports[_0x9fd3('0x71')]=function(_0x5165a7,_0x2cdb36,_0x476d22){var _0x1e2afb={'raw':![],'where':{}};var _0x13fed0={};var _0x2204f3={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x5165a7[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x2cdb36,null))[_0x9fd3('0x1f')](function(_0x2f97e4){if(_0x2f97e4){_0x13fed0[_0x9fd3('0x45')]=_[_0x9fd3('0x46')](db[_0x9fd3('0x70')][_0x9fd3('0x42')]);_0x13fed0[_0x9fd3('0x49')]=_[_0x9fd3('0x46')](_0x5165a7[_0x9fd3('0x49')]);_0x13fed0[_0x9fd3('0x47')]=_['intersection'](_0x13fed0[_0x9fd3('0x45')],_0x13fed0['query']);_0x1e2afb[_0x9fd3('0x4b')]=_[_0x9fd3('0x48')](_0x13fed0['model'],qs[_0x9fd3('0x4a')](_0x5165a7[_0x9fd3('0x49')][_0x9fd3('0x4a')]));_0x1e2afb[_0x9fd3('0x4b')]=_0x1e2afb[_0x9fd3('0x4b')]['length']?_0x1e2afb[_0x9fd3('0x4b')]:_0x13fed0[_0x9fd3('0x45')];if(!_0x5165a7[_0x9fd3('0x49')]['hasOwnProperty'](_0x9fd3('0x4e'))){_0x1e2afb[_0x9fd3('0x30')]=qs[_0x9fd3('0x30')](_0x5165a7['query']['limit']);_0x1e2afb['offset']=qs['offset'](_0x5165a7[_0x9fd3('0x49')][_0x9fd3('0x2e')]);}_0x1e2afb[_0x9fd3('0x4f')]=qs['sort'](_0x5165a7[_0x9fd3('0x49')]['sort']);_0x1e2afb[_0x9fd3('0x53')]=qs[_0x9fd3('0x47')](_[_0x9fd3('0x50')](_0x5165a7[_0x9fd3('0x49')],_0x13fed0[_0x9fd3('0x47')]));_0x1e2afb[_0x9fd3('0x53')][_0x9fd3('0x6c')]=_0x2f97e4['id'];if(_0x5165a7[_0x9fd3('0x49')][_0x9fd3('0x51')]){_0x1e2afb[_0x9fd3('0x53')]=_[_0x9fd3('0x52')](_0x1e2afb['where'],{'$or':_[_0x9fd3('0x40')](_0x1e2afb[_0x9fd3('0x4b')],function(_0x561e1e){var _0x2f0027={};_0x2f0027[_0x561e1e]={'$like':'%'+_0x5165a7['query']['filter']+'%'};return _0x2f0027;})});}_0x1e2afb=_[_0x9fd3('0x52')]({},_0x1e2afb,_0x5165a7['options']);return db[_0x9fd3('0x70')][_0x9fd3('0x31')]({'where':_0x1e2afb[_0x9fd3('0x53')]})[_0x9fd3('0x1f')](function(_0x1010e8){_0x2204f3[_0x9fd3('0x31')]=_0x1010e8;if(_0x5165a7[_0x9fd3('0x49')][_0x9fd3('0x56')]){_0x1e2afb[_0x9fd3('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9fd3('0x58')](_0x1e2afb);})[_0x9fd3('0x1f')](function(_0x1d938b){_0x2204f3[_0x9fd3('0x59')]=_0x1d938b;return _0x2204f3;});}})['then'](respondWithFilteredResult(_0x2cdb36,_0x1e2afb))['catch'](handleError(_0x2cdb36,null));};exports['removeAnswers']=function(_0x17fa20,_0x5111d9,_0x5bba6c){return db[_0x9fd3('0x41')]['find']({'where':{'id':_0x17fa20[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x5111d9,null))[_0x9fd3('0x1f')](function(_0x1957f2){if(_0x1957f2){return _0x1957f2['removeAnswers'](_0x17fa20[_0x9fd3('0x49')]['ids']);}})[_0x9fd3('0x1f')](respondWithStatusCode(_0x5111d9,null))['catch'](handleError(_0x5111d9,null));};exports[_0x9fd3('0x72')]=function(_0x5bf31e,_0x3ae71c,_0x101681){var _0x3a1ab4={'channel':_0x9fd3('0x73')};var _0xe0d144=[];var _0x18c39f=[];var _0x3c6d0c={};return db['SmsAccount']['find']({'where':{'id':_0x5bf31e[_0x9fd3('0x5a')]['id']},'include':[{'model':db[_0x9fd3('0x74')],'as':_0x9fd3('0x75')}]})[_0x9fd3('0x1f')](handleEntityNotFound(_0x3ae71c,null))[_0x9fd3('0x1f')](function(_0x151b2d){_0x3a1ab4[_0x9fd3('0x76')]=_0x151b2d;_0x3a1ab4['applications']=_['orderBy'](_0x151b2d[_0x9fd3('0x75')],[_0x9fd3('0x77')],[_0x9fd3('0x78')]);if(_0x3a1ab4[_0x9fd3('0x76')][_0x9fd3('0x75')]){delete _0x3a1ab4[_0x9fd3('0x76')][_0x9fd3('0x75')];}return db[_0x9fd3('0x79')][_0x9fd3('0x67')]();})['then'](function(_0x5017b8){if(!_0x5017b8){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0xe0d144=_['difference'](_['keys'](_0x5017b8),['createdAt',_0x9fd3('0x7a')]);_0x18c39f=_['difference'](_['keys'](_0x5017b8),['createdAt',_0x9fd3('0x7a'),_0x9fd3('0x7b'),_0x9fd3('0x7c')]);_0x3a1ab4[_0x9fd3('0x5d')]={'mapKey':_0x9fd3('0x7d')};if(_0x3a1ab4['account'][_0x9fd3('0x43')]){switch(_0x3a1ab4[_0x9fd3('0x76')][_0x9fd3('0x43')]){case _0x9fd3('0x7e'):_0x3a1ab4['body'][_0x9fd3('0x7f')]=_0x5bf31e[_0x9fd3('0x5d')]['From'];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x5d')]=_0x5bf31e['body'][_0x9fd3('0x80')];_0x3a1ab4['body'][_0x9fd3('0x81')]=_0x5bf31e[_0x9fd3('0x5d')]['MessageSid'];break;case'skebby':_0x3a1ab4['body']['from']='+'+_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x82')];_0x3a1ab4['body'][_0x9fd3('0x5d')]=_0x5bf31e['body'][_0x9fd3('0x83')];break;case _0x9fd3('0x84'):_0x3a1ab4['body']['from']=_0x5bf31e[_0x9fd3('0x5d')]['from'];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x5d')]=_0x5bf31e[_0x9fd3('0x5d')]['message'];break;case _0x9fd3('0x85'):_0x3a1ab4[_0x9fd3('0x5d')]['from']=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x7f')];_0x3a1ab4['body'][_0x9fd3('0x5d')]=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x5d')];_0x3a1ab4['body'][_0x9fd3('0x81')]=_0x5bf31e['body'][_0x9fd3('0x86')];break;case _0x9fd3('0x87'):_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x7f')]=_0x5bf31e['body'][_0x9fd3('0x88')];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x5d')]=_0x5bf31e[_0x9fd3('0x5d')]['Text'];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x81')]=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x89')];break;case _0x9fd3('0x8a'):_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x7f')]='+'+_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x8b')][0x0]['from'];_0x3a1ab4[_0x9fd3('0x5d')]['body']=_0x5bf31e['body'][_0x9fd3('0x8b')][0x0][_0x9fd3('0x83')];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x81')]=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x8b')][0x0]['messageId'];break;case _0x9fd3('0x8c'):_0x3a1ab4['body'][_0x9fd3('0x7f')]=_0x5bf31e['body'][_0x9fd3('0x8d')];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x5d')]=_0x5bf31e[_0x9fd3('0x5d')]['segmentedMessage'][_0x9fd3('0x27')];break;case _0x9fd3('0x8e'):_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x7f')]=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x8f')];_0x3a1ab4[_0x9fd3('0x5d')]['body']=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x83')];_0x3a1ab4['body'][_0x9fd3('0x81')]=_0x5bf31e[_0x9fd3('0x5d')]['replyMessageId'];break;case'bandwidth':_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x81')]=_0x5bf31e[_0x9fd3('0x5d')][0x0][_0x9fd3('0x27')]['id'];_0x3a1ab4[_0x9fd3('0x5d')]['from']=_0x5bf31e['body'][0x0][_0x9fd3('0x27')][_0x9fd3('0x7f')];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x5d')]=_0x5bf31e['body'][0x0]['message']['text'];break;case'intelepeer':_0x3a1ab4['body'][_0x9fd3('0x7f')]=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x7f')];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x5d')]=_0x5bf31e[_0x9fd3('0x5d')][_0x9fd3('0x27')];_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x81')]=_0x5bf31e[_0x9fd3('0x5d')]['refid'];break;}}if(_0x3a1ab4[_0x9fd3('0x5d')]['id']){delete _0x3a1ab4[_0x9fd3('0x5d')]['id'];}if(_[_0x9fd3('0x90')](_0x3a1ab4[_0x9fd3('0x5d')]['from'])){throw new db[(_0x9fd3('0x91'))][(_0x9fd3('0x92'))](_0x9fd3('0x93'));}if(_['isNil'](_0x3a1ab4['body']['body'])||_0x3a1ab4['body'][_0x9fd3('0x5d')]===''){throw new db['Sequelize'][(_0x9fd3('0x92'))](_0x9fd3('0x94'));}if(_[_0x9fd3('0x90')](_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x95')])){throw new db[(_0x9fd3('0x91'))][(_0x9fd3('0x92'))](_0x9fd3('0x96')+_0x18c39f);}if(!_[_0x9fd3('0x97')](_0x18c39f,_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x95')])){throw new db['Sequelize'][(_0x9fd3('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18c39f);}_0x3c6d0c[_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x95')]]=_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x7f')];return db[_0x9fd3('0x98')]['find']({'where':{'id':_0x3a1ab4[_0x9fd3('0x76')][_0x9fd3('0x7c')]},'include':[{'model':db[_0x9fd3('0x79')],'as':'Contacts','where':_0x3c6d0c,'limit':0x1,'order':[[_0x9fd3('0x7a'),_0x9fd3('0x99')]]}]});})[_0x9fd3('0x1f')](handleEntityNotFound(_0x3ae71c,null))['then'](function(_0x2b3790){if(_0x2b3790){_0x3a1ab4['list']=_[_0x9fd3('0x9a')](_0x2b3790,[_0x9fd3('0x9b')]);if(_0x2b3790[_0x9fd3('0x9b')][_0x9fd3('0x4c')]){return _0x2b3790[_0x9fd3('0x9b')][0x0];}var _0x4435e4=_[_0x9fd3('0x9c')](_0x3a1ab4['body'],{'firstName':_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x7f')],'ListId':_0x2b3790['id']});_0x4435e4[_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x95')]]=_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x7f')];return db[_0x9fd3('0x79')][_0x9fd3('0x5c')](_0x4435e4,{'fields':_0xe0d144,'raw':!![]});}})['then'](handleEntityNotFound(_0x3ae71c,null))[_0x9fd3('0x1f')](function(_0x5f0e31){if(_0x5f0e31){_0x3a1ab4[_0x9fd3('0x9d')]=_0x5f0e31;var _0x222f78={'ContactId':_0x5f0e31['id'],'phone':_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x7f')],'SmsAccountId':_0x5bf31e[_0x9fd3('0x5a')]['id']};var _0x4559c0={'ContactId':_0x5f0e31['id'],'SmsAccountId':_0x5bf31e[_0x9fd3('0x5a')]['id'],'closed':![]};return db[_0x9fd3('0x9e')][_0x9fd3('0x5b')]({'where':_0x4559c0})[_0x9fd3('0x1f')](function(_0x3e9303){if(_0x3e9303){return[_0x3e9303,![]];}return db[_0x9fd3('0x9e')][_0x9fd3('0x5c')](_0x222f78)[_0x9fd3('0x1f')](function(_0x19e550){return[_0x19e550,!![]];});});}})['spread'](function(_0x20e494,_0x3d2aa5){_0x3a1ab4[_0x9fd3('0x9f')]=_0x20e494[_0x9fd3('0x5e')]({'plain':!![]});_0x3a1ab4['interaction']['created']=![];if(_0x3d2aa5){if(_0x3a1ab4[_0x9fd3('0x76')][_0x9fd3('0xa0')]){_0x3a1ab4[_0x9fd3('0xa1')][_0x9fd3('0xa2')]({'id':0x0,'priority':_0x3a1ab4[_0x9fd3('0xa1')][_0x9fd3('0x4c')]+0x1,'app':_0x9fd3('0xa3'),'appdata':'unmanaged','interval':_0x9fd3('0xa4')});}_0x3a1ab4[_0x9fd3('0x9f')][_0x9fd3('0xa5')]=!![];}return db['SmsMessage'][_0x9fd3('0x5c')]({'phone':_0x3a1ab4[_0x9fd3('0x5d')]['from'],'messageId':_0x3a1ab4[_0x9fd3('0x5d')]['messageId'],'body':_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0x5d')],'SmsAccountId':_0x5bf31e[_0x9fd3('0x5a')]['id'],'SmsInteractionId':_0x20e494['id'],'direction':'in','ContactId':_0x20e494['ContactId'],'AttachmentId':_0x3a1ab4[_0x9fd3('0x5d')][_0x9fd3('0xa6')]});})[_0x9fd3('0x1f')](function(_0x4baf20){_0x3a1ab4['message']=_0x4baf20;if(!_0x3a1ab4[_0x9fd3('0x9f')][_0x9fd3('0xa7')])return;return db[_0x9fd3('0xa8')][_0x9fd3('0x5b')]({'attributes':['id',_0x9fd3('0x3b')],'where':{'id':_0x3a1ab4[_0x9fd3('0x9f')][_0x9fd3('0xa7')]}});})['then'](function(_0x52e0db){if(_0x52e0db){_0x3a1ab4['applications'][_0x9fd3('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x52e0db[_0x9fd3('0x3b')]+','+(_0x3a1ab4[_0x9fd3('0x76')][_0x9fd3('0xaa')]||0xa),'interval':_0x9fd3('0xa4')});}if(!_0x3a1ab4[_0x9fd3('0x9f')][_0x9fd3('0xab')])return;return db[_0x9fd3('0xac')][_0x9fd3('0x5b')]({'attributes':['id','name'],'where':{'id':_0x3a1ab4['interaction'][_0x9fd3('0xab')]}});})[_0x9fd3('0x1f')](function(_0x7dff72){if(_0x7dff72){_0x3a1ab4['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x9fd3('0xad'),'appdata':_0x7dff72['name']+','+(_0x3a1ab4[_0x9fd3('0x76')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9fd3('0xa4')});}return respondWithRpcPromise(_0x9fd3('0xae'),_0x9fd3('0xaf'),_0x3a1ab4);})['then'](function(_0xcff043){if(_0xcff043){var _0x50d357=0xc8;var _0x41fd16=_0x9fd3('0xb0');logger[_0x9fd3('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x41fd16,_0x50d357,_0x9fd3('0xb1'));logger[_0x9fd3('0x22')](_0x9fd3('0xb2'),_0x41fd16,_0x50d357,_0x9fd3('0xb1'),JSON[_0x9fd3('0x24')](_0xcff043));if(_0x3a1ab4[_0x9fd3('0x76')]['type']===_0x9fd3('0x7e')){return _0x3ae71c['status'](_0x50d357)[_0x9fd3('0x33')](_0x9fd3('0xb3'),'text/xml')['send'](_0x9fd3('0xb4'));}else{return _0x3ae71c['status'](_0x50d357)[_0x9fd3('0x2d')](_0xcff043);}}})[_0x9fd3('0x2a')](handleError(_0x3ae71c,null));};exports[_0x9fd3('0xb5')]=function(_0x1c35bd,_0x25ed74){var _0x4ab13f=_0x1c35bd['params']['id'];var _0x3c954c=_0x1c35bd['body'];var _0x1bb174=0xc8;var _0x2406ef=null;return db[_0x9fd3('0xb6')][_0x9fd3('0xb7')]({'isolationLevel':db[_0x9fd3('0xb6')][_0x9fd3('0xb8')][_0x9fd3('0xb9')][_0x9fd3('0xba')]},function(_0x5846ef){return db['SmsAccount'][_0x9fd3('0x6a')]({'where':{'id':_0x4ab13f},'transaction':_0x5846ef})['then'](function(_0x115c3a){if(_0x115c3a){return db[_0x9fd3('0x74')][_0x9fd3('0x38')]({'where':{'SmsAccountId':_0x4ab13f},'transaction':_0x5846ef})[_0x9fd3('0x1f')](function(){var _0x29b02b=_[_0x9fd3('0x40')](_0x3c954c,function(_0x5c33e1){_0x5c33e1[_0x9fd3('0x6c')]=_0x4ab13f;return _0x5c33e1;});return db[_0x9fd3('0x74')]['bulkCreate'](_0x29b02b,{'transaction':_0x5846ef});});}else{_0x1bb174=0x194;_0x2406ef=[];}});})[_0x9fd3('0x1f')](function(){if(_0x1bb174!==0x194){return db[_0x9fd3('0x74')][_0x9fd3('0xbb')]({'where':{'SmsAccountId':_0x4ab13f},'order':'priority'})['then'](function(_0x426347){_0x2406ef=_0x426347;});}})[_0x9fd3('0x2a')](function(_0x5f3daf){_0x1bb174=0x1f4;logger[_0x9fd3('0x25')](_0x5f3daf[_0x9fd3('0x3a')]);if(_0x5f3daf[_0x9fd3('0x3b')]){delete _0x5f3daf[_0x9fd3('0x3b')];}_0x2406ef=_0x5f3daf;})[_0x9fd3('0xbc')](function(){if(_0x2406ef===null){_0x25ed74['sendStatus'](_0x1bb174);}else{if(_0x1bb174===0x1f4){_0x25ed74[_0x9fd3('0x32')](_0x1bb174)[_0x9fd3('0x3c')](_0x2406ef);}else{_0x25ed74['status'](_0x1bb174)[_0x9fd3('0x2d')](_0x2406ef);}}});};exports[_0x9fd3('0xbd')]=function(_0x5dcd3f,_0x521c8d,_0x3dde83){var _0x425cec={};var _0x3b6acb={};var _0x485ef9;var _0x1c4a03;return db['SmsAccount'][_0x9fd3('0x6a')]({'where':{'id':_0x5dcd3f[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x521c8d,null))[_0x9fd3('0x1f')](function(_0x3e27ac){if(_0x3e27ac){_0x485ef9=_0x3e27ac;_0x3b6acb[_0x9fd3('0x45')]=_['keys'](db[_0x9fd3('0x74')]['rawAttributes']);_0x3b6acb['query']=_[_0x9fd3('0x46')](_0x5dcd3f[_0x9fd3('0x49')]);_0x3b6acb[_0x9fd3('0x47')]=_[_0x9fd3('0x48')](_0x3b6acb[_0x9fd3('0x45')],_0x3b6acb[_0x9fd3('0x49')]);_0x425cec[_0x9fd3('0x4b')]=_[_0x9fd3('0x48')](_0x3b6acb[_0x9fd3('0x45')],qs[_0x9fd3('0x4a')](_0x5dcd3f['query'][_0x9fd3('0x4a')]));_0x425cec[_0x9fd3('0x4b')]=_0x425cec[_0x9fd3('0x4b')][_0x9fd3('0x4c')]?_0x425cec[_0x9fd3('0x4b')]:_0x3b6acb[_0x9fd3('0x45')];_0x425cec[_0x9fd3('0x4f')]=qs[_0x9fd3('0x6b')](_0x5dcd3f['query'][_0x9fd3('0x6b')]);_0x425cec[_0x9fd3('0x53')]=qs['filters'](_[_0x9fd3('0x50')](_0x5dcd3f[_0x9fd3('0x49')],_0x3b6acb[_0x9fd3('0x47')]));if(_0x5dcd3f['query']['filter']){_0x425cec[_0x9fd3('0x53')]=_[_0x9fd3('0x52')](_0x425cec[_0x9fd3('0x53')],{'$or':_[_0x9fd3('0x40')](_0x425cec[_0x9fd3('0x4b')],function(_0x5636df){var _0x4dd329={};_0x4dd329[_0x5636df]={'$like':'%'+_0x5dcd3f[_0x9fd3('0x49')]['filter']+'%'};return _0x4dd329;})});}_0x425cec=_['merge']({},_0x425cec,_0x5dcd3f[_0x9fd3('0x55')]);return _0x485ef9[_0x9fd3('0xbd')](_0x425cec);}})['then'](function(_0x31a1d3){if(_0x31a1d3){_0x1c4a03=_0x31a1d3[_0x9fd3('0x4c')];if(!_0x5dcd3f[_0x9fd3('0x49')][_0x9fd3('0x4d')](_0x9fd3('0x4e'))){_0x425cec[_0x9fd3('0x30')]=qs[_0x9fd3('0x30')](_0x5dcd3f[_0x9fd3('0x49')][_0x9fd3('0x30')]);_0x425cec[_0x9fd3('0x2e')]=qs[_0x9fd3('0x2e')](_0x5dcd3f[_0x9fd3('0x49')]['offset']);}return _0x485ef9[_0x9fd3('0xbd')](_0x425cec);}})[_0x9fd3('0x1f')](function(_0xb60f00){if(_0xb60f00){return _0xb60f00?{'count':_0x1c4a03,'rows':_0xb60f00}:null;}})[_0x9fd3('0x1f')](respondWithResult(_0x521c8d,null))['catch'](handleError(_0x521c8d,null));};exports[_0x9fd3('0xbe')]=function(_0x39eea9,_0x805159,_0x447e3d){var _0x3aaf48={'raw':![],'where':{}};var _0x2931b7={};var _0x276994={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9fd3('0x6a')]({'where':{'id':_0x39eea9[_0x9fd3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x805159,null))['then'](function(_0x533ad7){if(_0x533ad7){_0x2931b7['model']=_[_0x9fd3('0x46')](db[_0x9fd3('0x9e')][_0x9fd3('0x42')]);_0x2931b7[_0x9fd3('0x49')]=_[_0x9fd3('0x46')](_0x39eea9[_0x9fd3('0x49')]);_0x2931b7[_0x9fd3('0x47')]=_['intersection'](_0x2931b7[_0x9fd3('0x45')],_0x2931b7[_0x9fd3('0x49')]);_0x3aaf48[_0x9fd3('0x4b')]=_[_0x9fd3('0x48')](_0x2931b7['model'],qs[_0x9fd3('0x4a')](_0x39eea9[_0x9fd3('0x49')][_0x9fd3('0x4a')]));_0x3aaf48['attributes']=_0x3aaf48[_0x9fd3('0x4b')][_0x9fd3('0x4c')]?_0x3aaf48[_0x9fd3('0x4b')]:_0x2931b7[_0x9fd3('0x45')];if(!_0x39eea9[_0x9fd3('0x49')][_0x9fd3('0x4d')](_0x9fd3('0x4e'))){_0x3aaf48[_0x9fd3('0x30')]=qs['limit'](_0x39eea9['query']['limit']);_0x3aaf48[_0x9fd3('0x2e')]=qs[_0x9fd3('0x2e')](_0x39eea9[_0x9fd3('0x49')]['offset']);}_0x3aaf48[_0x9fd3('0x4f')]=qs[_0x9fd3('0x6b')](_0x39eea9[_0x9fd3('0x49')][_0x9fd3('0x6b')]);_0x3aaf48['where']=qs['filters'](_[_0x9fd3('0x50')](_0x39eea9[_0x9fd3('0x49')],_0x2931b7[_0x9fd3('0x47')]));_0x3aaf48[_0x9fd3('0x53')][_0x9fd3('0x6c')]=_0x533ad7['id'];if(_0x39eea9[_0x9fd3('0x49')][_0x9fd3('0x51')]){_0x3aaf48[_0x9fd3('0x53')]=_['merge'](_0x3aaf48[_0x9fd3('0x53')],{'$or':_[_0x9fd3('0x40')](_0x3aaf48[_0x9fd3('0x4b')],function(_0x683bfb){var _0x1393f6={};_0x1393f6[_0x683bfb]={'$like':'%'+_0x39eea9[_0x9fd3('0x49')][_0x9fd3('0x51')]+'%'};return _0x1393f6;})});}_0x3aaf48=_[_0x9fd3('0x52')]({},_0x3aaf48,_0x39eea9[_0x9fd3('0x55')]);return db['SmsInteraction'][_0x9fd3('0x31')]({'where':_0x3aaf48[_0x9fd3('0x53')]})[_0x9fd3('0x1f')](function(_0x395706){_0x276994[_0x9fd3('0x31')]=_0x395706;if(_0x39eea9[_0x9fd3('0x49')][_0x9fd3('0x56')]){_0x3aaf48[_0x9fd3('0x57')]=[{'model':db[_0x9fd3('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9fd3('0x3b'),'fullname',_0x9fd3('0xbf')],'required':![]},{'model':db[_0x9fd3('0xc0')],'as':_0x9fd3('0xc1'),'attributes':['id',_0x9fd3('0x3b'),_0x9fd3('0xc2')],'where':_0x39eea9[_0x9fd3('0x49')]['tag']?{'id':_0x39eea9['query'][_0x9fd3('0xc3')]}:undefined,'required':_0x39eea9[_0x9fd3('0x49')]['tag']?!![]:![]}];}return db[_0x9fd3('0x9e')][_0x9fd3('0x58')](_0x3aaf48);})[_0x9fd3('0x1f')](function(_0x13817a){_0x276994[_0x9fd3('0x59')]=_0x13817a;return _0x276994;});}})['then'](respondWithFilteredResult(_0x805159,_0x3aaf48))[_0x9fd3('0x2a')](handleError(_0x805159,null));};exports[_0x9fd3('0x3c')]=function(_0xf17caa,_0x553fc7,_0x11ced7){var _0x2de45d,_0x4a8dd1,_0x29dfd0;if(_[_0x9fd3('0x90')](_0xf17caa[_0x9fd3('0x5d')]['body'])||_0xf17caa['body'][_0x9fd3('0x5d')]===''){throw new db['Sequelize'][(_0x9fd3('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9fd3('0x90')](_0xf17caa[_0x9fd3('0x5d')]['to'])){throw new db['Sequelize'][(_0x9fd3('0x92'))](_0x9fd3('0xc4'));}_0x2de45d=_0xf17caa[_0x9fd3('0x5d')]['to'];return db[_0x9fd3('0x41')][_0x9fd3('0x5b')]({'where':{'id':_0xf17caa[_0x9fd3('0x5a')]['id']},'include':[{'model':db[_0x9fd3('0x98')],'as':_0x9fd3('0xc5'),'include':[{'model':db[_0x9fd3('0x79')],'as':_0x9fd3('0x9b'),'where':{'mobile':_0x2de45d},'limit':0x1,'order':[['updatedAt',_0x9fd3('0x99')]]}]}]})[_0x9fd3('0x1f')](handleEntityNotFound(_0x553fc7,null))['then'](function(_0x4060a6){if(_0x4060a6&&_0x4060a6['List']){_0x4a8dd1=_0x4060a6[_0x9fd3('0x5e')]({'plain':!![]});if(_0x4a8dd1[_0x9fd3('0xc5')]&&_0x4a8dd1[_0x9fd3('0xc5')][_0x9fd3('0x9b')][_0x9fd3('0x4c')]){return _0x4a8dd1['List']['Contacts'][0x0];}return db[_0x9fd3('0x79')][_0x9fd3('0x5c')](_[_0x9fd3('0x9c')](_0xf17caa[_0x9fd3('0x5d')],{'firstName':_0x2de45d,'mobile':_0x2de45d,'phone':_0x2de45d,'ListId':_0x4a8dd1[_0x9fd3('0x7c')]}));}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x553fc7,null))[_0x9fd3('0x1f')](function(_0x2fa48f){if(_0x2fa48f){_0x29dfd0=_0x2fa48f;return db['SmsInteraction'][_0x9fd3('0x5b')]({'where':{'ContactId':_0x29dfd0['id'],'closed':![],'SmsAccountId':_0x4a8dd1['id']}})[_0x9fd3('0x1f')](function(_0x20c678){if(_0x20c678){return[_0x20c678,![]];}return db[_0x9fd3('0x9e')][_0x9fd3('0x5c')]({'UserId':_0xf17caa[_0x9fd3('0x61')]['id'],'ContactId':_0x29dfd0['id'],'SmsAccountId':_0x4a8dd1['id'],'phone':_0x2de45d,'firstMsgDirection':_0x9fd3('0xc6'),'Messages':[_[_0x9fd3('0x52')](_0xf17caa[_0x9fd3('0x5d')],{'read':![],'body':_0xf17caa['body'][_0x9fd3('0x5d')],'phone':_0x2de45d,'SmsAccountId':_0x4a8dd1['id'],'UserId':_0xf17caa[_0x9fd3('0x61')]['id'],'ContactId':_0x29dfd0['id']})]},{'include':[{'model':db[_0x9fd3('0xc7')],'as':_0x9fd3('0xc8')}]})[_0x9fd3('0x1f')](function(_0x294166){return[_0x294166,!![]];});});}})[_0x9fd3('0xc9')](function(_0x3fe93d,_0x1c8862){if(_0x1c8862){return _0x3fe93d;}return db[_0x9fd3('0xc7')][_0x9fd3('0x5c')](_[_0x9fd3('0x52')](_0xf17caa[_0x9fd3('0x5d')],{'read':![],'body':_0xf17caa['body']['body'],'phone':_0x2de45d,'SmsAccountId':_0x4a8dd1['id'],'SmsInteractionId':_0x3fe93d['id'],'UserId':_0xf17caa[_0x9fd3('0x61')]['id'],'ContactId':_0x29dfd0['id']}))['then'](function(_0x19ac86){_0x3fe93d[_0x9fd3('0xca')]['Messages']=[];_0x3fe93d[_0x9fd3('0xca')][_0x9fd3('0xc8')][_0x9fd3('0xa2')](_0x19ac86[_0x9fd3('0xca')]);return _0x3fe93d;});})[_0x9fd3('0x1f')](respondWithResult(_0x553fc7,null))[_0x9fd3('0x2a')](handleError(_0x553fc7,null));};exports[_0x9fd3('0x32')]=function(_0x5913c4,_0x120adc,_0x2f15ae){if(_0x5913c4[_0x9fd3('0x5d')]['id']){delete _0x5913c4[_0x9fd3('0x5d')]['id'];}var _0x50c300,_0x56c5b8,_0x2017c5;return db[_0x9fd3('0x41')][_0x9fd3('0x5b')]({'where':{'id':_0x5913c4[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x120adc,null))['then'](function(_0x4b7089){if(_0x4b7089){_0x2017c5=_0x4b7089;logger[_0x9fd3('0x22')](_0x9fd3('0x23'),_0x9fd3('0x32'),_0x9fd3('0xcb'),_0x4b7089[_0x9fd3('0x43')],util[_0x9fd3('0xcc')](_0x5913c4[_0x9fd3('0x5d')],{'showHidden':![],'depth':null}));switch(_0x4b7089[_0x9fd3('0x43')]){case'skebby':if(_0x5913c4['body'][_0x9fd3('0xcd')]&&_0x5913c4['body']['status']){_0x56c5b8=_0x5913c4['body']['status'];return db[_0x9fd3('0xc7')][_0x9fd3('0x5b')]({'where':{'messageId':_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0xcd')]}});}break;case'connectel':if(_0x5913c4[_0x9fd3('0x5d')]['requestid']&&_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0xce')]){_0x56c5b8=_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0xce')];return db[_0x9fd3('0xc7')][_0x9fd3('0x5b')]({'where':{'messageId':_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0xcf')]}});}break;case'clicksend':if(_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0x86')]&&_0x5913c4['body']['status_code']){_0x56c5b8=_0x5913c4[_0x9fd3('0x5d')]['status_code'];return db['SmsMessage'][_0x9fd3('0x5b')]({'where':{'messageId':_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0x86')]}});}break;case _0x9fd3('0x8a'):var _0x24e946=_0x5913c4['body'][_0x9fd3('0x8b')][0x0];if(_0x24e946[_0x9fd3('0x81')]&&_0x24e946['status'][_0x9fd3('0xd0')]===_0x9fd3('0xd1')){_0x56c5b8=_0x24e946[_0x9fd3('0x32')][_0x9fd3('0xd0')];return db[_0x9fd3('0xc7')][_0x9fd3('0x5b')]({'where':{'messageId':_0x24e946['messageId']}});}break;case _0x9fd3('0x8e'):if(_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0x81')]&&_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0x32')]){_0x56c5b8=_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0x32')];return db[_0x9fd3('0xc7')][_0x9fd3('0x5b')]({'where':{'messageId':_0x5913c4[_0x9fd3('0x5d')]['messageId']}});}break;case _0x9fd3('0xd2'):if(_0x5913c4[_0x9fd3('0x5d')][0x0][_0x9fd3('0x27')]['id']){_0x56c5b8=_0x5913c4['body'][0x0][_0x9fd3('0x43')];return db['SmsMessage'][_0x9fd3('0x5b')]({'where':{'messageId':_0x5913c4[_0x9fd3('0x5d')][0x0][_0x9fd3('0x27')]['id']}});}break;case _0x9fd3('0xd3'):if(_0x5913c4['body'][_0x9fd3('0xd4')]&&_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0x32')]){_0x56c5b8=_0x5913c4[_0x9fd3('0x5d')]['status'];return db[_0x9fd3('0xc7')][_0x9fd3('0x5b')]({'where':{'messageId':_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0xd4')]}});}break;}}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x120adc,null))[_0x9fd3('0x1f')](function(_0x5537d1){if(_0x5537d1){_0x50c300=_0x5537d1;switch(_0x2017c5[_0x9fd3('0x43')]){case _0x9fd3('0xd5'):if(_0x56c5b8==='DELIVERED'){return _0x50c300[_0x9fd3('0x37')]({'read':!![]});}else{logger[_0x9fd3('0x25')](_0x9fd3('0x23'),_0x9fd3('0x32'),_0x9fd3('0xd5'),util[_0x9fd3('0xcc')](_0x5913c4[_0x9fd3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9fd3('0x84'):if(_0x56c5b8==='1'){return _0x50c300[_0x9fd3('0x37')]({'read':!![]});}else{logger[_0x9fd3('0x25')](_0x9fd3('0x23'),_0x9fd3('0x32'),_0x9fd3('0xd5'),util[_0x9fd3('0xcc')](_0x5913c4[_0x9fd3('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5913c4[_0x9fd3('0x5d')][_0x9fd3('0xd6')]&&_0x56c5b8>=0xc8&&_0x56c5b8<=0xce){return _0x50c300[_0x9fd3('0x37')]({'read':!![]});}else{logger[_0x9fd3('0x25')](_0x9fd3('0x23'),'status',_0x9fd3('0x85'),util[_0x9fd3('0xcc')](_0x5913c4['body'],{'showHidden':![],'depth':null}));}break;case _0x9fd3('0x8a'):var _0x5e8b95=_0x5913c4['body'][_0x9fd3('0x8b')][0x0];if(_0x5e8b95[_0x9fd3('0x32')][_0x9fd3('0xd0')]===_0x9fd3('0xd1')){return _0x50c300[_0x9fd3('0x37')]({'read':!![]});}else{logger['error'](_0x9fd3('0x23'),'status',_0x9fd3('0x8a'),util['inspect'](_0x5913c4['body'],{'showHidden':![],'depth':null}));}break;case _0x9fd3('0x8e'):if(_0x56c5b8==_0x9fd3('0xd7')||_0x56c5b8==_0x9fd3('0xd8')){return _0x50c300['update']({'read':!![]});}else{logger[_0x9fd3('0x25')](_0x9fd3('0x23'),'status','clickatell',util['inspect'](_0x5913c4[_0x9fd3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9fd3('0xd2'):if(_0x56c5b8==_0x9fd3('0xd9')){return _0x50c300[_0x9fd3('0x37')]({'read':!![]});}else{logger[_0x9fd3('0x25')](_0x9fd3('0x23'),_0x9fd3('0x32'),_0x9fd3('0xd2'),util[_0x9fd3('0xcc')](_0x5913c4[_0x9fd3('0x5d')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x56c5b8===_0x9fd3('0xda')||_0x56c5b8===_0x9fd3('0xdb')){return _0x50c300['update']({'read':!![]});}else{logger[_0x9fd3('0x25')](_0x9fd3('0x23'),_0x9fd3('0x32'),_0x9fd3('0xd3'),util[_0x9fd3('0xcc')](_0x5913c4[_0x9fd3('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x50c300;}})[_0x9fd3('0x1f')](respondWithResult(_0x120adc,null))[_0x9fd3('0x2a')](handleError(_0x120adc,null));};exports[_0x9fd3('0xdc')]=function(_0x5a553f,_0x2e2e1a,_0x41cf1a){var _0x375378,_0x18353d,_0x208675;return db[_0x9fd3('0x41')]['find']({'where':{'id':_0x5a553f[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x2e2e1a,null))[_0x9fd3('0x1f')](function(_0xee59de){if(_0xee59de){_0x208675=_0xee59de;logger[_0x9fd3('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9fd3('0x32'),_0x9fd3('0xcb'),_0xee59de[_0x9fd3('0x43')],util[_0x9fd3('0xcc')](_0x5a553f[_0x9fd3('0x49')],{'showHidden':![],'depth':null}));switch(_0xee59de[_0x9fd3('0x43')]){case'csc':if(_0x5a553f[_0x9fd3('0x49')]['message-id']&&_0x5a553f[_0x9fd3('0x49')]['state']){_0x18353d=_0x5a553f[_0x9fd3('0x49')][_0x9fd3('0xdd')];return db[_0x9fd3('0xc7')][_0x9fd3('0x5b')]({'where':{'messageId':_0x5a553f[_0x9fd3('0x49')][_0x9fd3('0xde')]}});}break;}}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x2e2e1a,null))['then'](function(_0x2bcd57){if(_0x2bcd57){_0x375378=_0x2bcd57;switch(_0x208675[_0x9fd3('0x43')]){case _0x9fd3('0x8c'):if(_0x18353d==='2'||_0x18353d==='6'){return _0x375378[_0x9fd3('0x37')]({'read':!![]});}else{logger[_0x9fd3('0x25')](_0x9fd3('0x23'),_0x9fd3('0x32'),'csc',util[_0x9fd3('0xcc')](_0x5a553f[_0x9fd3('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x375378;}})['then'](respondWithResult(_0x2e2e1a,null))['catch'](handleError(_0x2e2e1a,null));};exports[_0x9fd3('0xdf')]=function(_0x40767f,_0x5f20f7,_0x1117cd){return db[_0x9fd3('0x41')]['find']({'where':{'id':_0x40767f[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x5f20f7,null))[_0x9fd3('0x1f')](function(_0xa6e87){if(_0xa6e87){return _0xa6e87[_0x9fd3('0xdf')](_0x40767f['body'][_0x9fd3('0x6e')],_['omit'](_0x40767f[_0x9fd3('0x5d')],[_0x9fd3('0x6e'),'id'])||{})[_0x9fd3('0xc9')](function(_0xcd9d61){for(var _0x4a8a58=0x0;_0x4a8a58<_0x40767f[_0x9fd3('0x5d')][_0x9fd3('0x6e')][_0x9fd3('0x4c')];_0x4a8a58+=0x1){socket[_0x9fd3('0xe0')](_0x9fd3('0xe1'),{'UserId':Number(_0x40767f[_0x9fd3('0x5d')]['ids'][_0x4a8a58]),'SmsAccountId':Number(_0x40767f[_0x9fd3('0x5a')]['id'])});}return _0xcd9d61;});}})[_0x9fd3('0x1f')](respondWithResult(_0x5f20f7,null))['catch'](handleError(_0x5f20f7,null));};exports[_0x9fd3('0xe2')]=function(_0x556cd5,_0x187f4c,_0x43ea51){return db['SmsAccount'][_0x9fd3('0x5b')]({'where':{'id':_0x556cd5[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x187f4c,null))['then'](function(_0x392f2b){if(_0x392f2b){return _0x392f2b[_0x9fd3('0xe2')](_0x556cd5[_0x9fd3('0x49')][_0x9fd3('0x6e')])[_0x9fd3('0x1f')](function(){if(_[_0x9fd3('0xe3')](_0x556cd5[_0x9fd3('0x49')][_0x9fd3('0x6e')])){for(var _0x4583b9=0x0;_0x4583b9<_0x556cd5[_0x9fd3('0x49')]['ids'][_0x9fd3('0x4c')];_0x4583b9+=0x1){socket['emit'](_0x9fd3('0xe4'),{'UserId':Number(_0x556cd5[_0x9fd3('0x49')]['ids'][_0x4583b9]),'SmsAccountId':Number(_0x556cd5['params']['id'])});}}else{socket[_0x9fd3('0xe0')](_0x9fd3('0xe4'),{'UserId':Number(_0x556cd5[_0x9fd3('0x49')][_0x9fd3('0x6e')]),'SmsAccountId':Number(_0x556cd5[_0x9fd3('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x187f4c,null))['catch'](handleError(_0x187f4c,null));};exports[_0x9fd3('0xe5')]=function(_0x224430,_0x5e352a,_0x4f0b9b){var _0x16424f={};var _0x436dc5={};var _0x5905b4;var _0x585ff0;return db[_0x9fd3('0x41')][_0x9fd3('0x6a')]({'where':{'id':_0x224430[_0x9fd3('0x5a')]['id']}})[_0x9fd3('0x1f')](handleEntityNotFound(_0x5e352a,null))[_0x9fd3('0x1f')](function(_0x5c7ec9){if(_0x5c7ec9){_0x5905b4=_0x5c7ec9;_0x436dc5[_0x9fd3('0x45')]=_[_0x9fd3('0x46')](db[_0x9fd3('0xa8')]['rawAttributes']);_0x436dc5[_0x9fd3('0x49')]=_[_0x9fd3('0x46')](_0x224430[_0x9fd3('0x49')]);_0x436dc5[_0x9fd3('0x47')]=_[_0x9fd3('0x48')](_0x436dc5['model'],_0x436dc5[_0x9fd3('0x49')]);_0x16424f[_0x9fd3('0x4b')]=_[_0x9fd3('0x48')](_0x436dc5[_0x9fd3('0x45')],qs[_0x9fd3('0x4a')](_0x224430[_0x9fd3('0x49')]['fields']));_0x16424f[_0x9fd3('0x4b')]=_0x16424f[_0x9fd3('0x4b')]['length']?_0x16424f[_0x9fd3('0x4b')]:_0x436dc5[_0x9fd3('0x45')];_0x16424f[_0x9fd3('0x4f')]=qs[_0x9fd3('0x6b')](_0x224430[_0x9fd3('0x49')][_0x9fd3('0x6b')]);_0x16424f['where']=qs[_0x9fd3('0x47')](_['pick'](_0x224430['query'],_0x436dc5['filters']));if(_0x224430[_0x9fd3('0x49')][_0x9fd3('0x51')]){_0x16424f[_0x9fd3('0x53')]=_[_0x9fd3('0x52')](_0x16424f[_0x9fd3('0x53')],{'$or':_['map'](_0x16424f['attributes'],function(_0x4badfe){var _0xe40f82={};_0xe40f82[_0x4badfe]={'$like':'%'+_0x224430[_0x9fd3('0x49')][_0x9fd3('0x51')]+'%'};return _0xe40f82;})});}_0x16424f=_['merge']({},_0x16424f,_0x224430[_0x9fd3('0x55')]);return _0x5905b4[_0x9fd3('0xe5')](_0x16424f);}})[_0x9fd3('0x1f')](function(_0x3d311f){if(_0x3d311f){_0x585ff0=_0x3d311f[_0x9fd3('0x4c')];if(!_0x224430[_0x9fd3('0x49')][_0x9fd3('0x4d')]('nolimit')){_0x16424f['limit']=qs[_0x9fd3('0x30')](_0x224430['query']['limit']);_0x16424f[_0x9fd3('0x2e')]=qs[_0x9fd3('0x2e')](_0x224430[_0x9fd3('0x49')][_0x9fd3('0x2e')]);}return _0x5905b4[_0x9fd3('0xe5')](_0x16424f);}})[_0x9fd3('0x1f')](function(_0x3273ee){if(_0x3273ee){return _0x3273ee?{'count':_0x585ff0,'rows':_0x3273ee}:null;}})[_0x9fd3('0x1f')](respondWithResult(_0x5e352a,null))[_0x9fd3('0x2a')](handleError(_0x5e352a,null));}; \ No newline at end of file +var _0x301a=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','SmsAccount','count','include','findAll','rows','show','params','Pause','rawAttributes','includeAll','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','pick','ids','CannedAnswer','getAnswers','nolimit','notify','sms','SmsApplication','Applications','account','orderBy','asc','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','from','Body','messageId','MessageSid','sender','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','send','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','Contact','User','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','update','error_code','DELIVERED_TO_GATEWAY','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x32a326,_0x56585f){var _0x53d06f=function(_0x1ae9f1){while(--_0x1ae9f1){_0x32a326['push'](_0x32a326['shift']());}};_0x53d06f(++_0x56585f);}(_0x301a,0xe4));var _0xa301=function(_0x5d9973,_0x4494ac){_0x5d9973=_0x5d9973-0x0;var _0x322484=_0x301a[_0x5d9973];return _0x322484;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa301('0x0'));var zipdir=require(_0xa301('0x1'));var jsonpatch=require(_0xa301('0x2'));var rp=require(_0xa301('0x3'));var moment=require(_0xa301('0x4'));var BPromise=require(_0xa301('0x5'));var Mustache=require('mustache');var util=require(_0xa301('0x6'));var path=require(_0xa301('0x7'));var sox=require(_0xa301('0x8'));var csv=require('to-csv');var ejs=require(_0xa301('0x9'));var fs=require('fs');var fs_extra=require(_0xa301('0xa'));var _=require(_0xa301('0xb'));var squel=require(_0xa301('0xc'));var crypto=require(_0xa301('0xd'));var jsforce=require(_0xa301('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa301('0xf'));var querystring=require('querystring');var Papa=require(_0xa301('0x10'));var Redis=require(_0xa301('0x11'));var authService=require(_0xa301('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa301('0x13'));var logger=require('../../config/logger')(_0xa301('0x14'));var utils=require('../../config/utils');var config=require(_0xa301('0x15'));var licenseUtil=require(_0xa301('0x16'));var db=require(_0xa301('0x17'))['db'];config['redis']=_[_0xa301('0x18')](config['redis'],{'host':_0xa301('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0xa301('0x1a')](socket);var jayson=require(_0xa301('0x1b'));var client=jayson['client'][_0xa301('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5de748,_0x39a818,_0x4db200,_0x3565e8){return new BPromise(function(_0x73b4bf,_0x1b5d99){var _0x594dd1=_0x3565e8||client;return _0x594dd1[_0xa301('0x1d')](_0x5de748,_0x4db200)[_0xa301('0x1e')](function(_0x10283c){logger[_0xa301('0x1f')](_0xa301('0x20'),_0x39a818,_0xa301('0x21'));logger[_0xa301('0x22')](_0xa301('0x23'),_0x39a818,_0xa301('0x21'),JSON[_0xa301('0x24')](_0x10283c));if(_0x10283c[_0xa301('0x25')]){if(_0x10283c['error'][_0xa301('0x26')]===0x1f4){logger['error'](_0xa301('0x20'),_0x39a818,_0x10283c[_0xa301('0x25')][_0xa301('0x27')]);return _0x1b5d99(_0x10283c['error'][_0xa301('0x27')]);}logger[_0xa301('0x25')](_0xa301('0x20'),_0x39a818,_0x10283c['error']['message']);return _0x73b4bf(_0x10283c[_0xa301('0x25')][_0xa301('0x27')]);}else{logger[_0xa301('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x39a818,_0xa301('0x21'));_0x73b4bf(_0x10283c[_0xa301('0x28')][_0xa301('0x27')]);}})[_0xa301('0x29')](function(_0x4764ad){logger[_0xa301('0x25')](_0xa301('0x20'),_0x39a818,_0x4764ad);_0x1b5d99(_0x4764ad);});});}function respondWithStatusCode(_0x42241d,_0x59d25f){_0x59d25f=_0x59d25f||0xcc;return function(_0x5ea84f){if(_0x5ea84f){return _0x42241d[_0xa301('0x2a')](_0x59d25f);}return _0x42241d[_0xa301('0x2b')](_0x59d25f)[_0xa301('0x2c')]();};}function respondWithResult(_0x483c8c,_0x40ff0d){_0x40ff0d=_0x40ff0d||0xc8;return function(_0x523b5b){if(_0x523b5b){return _0x483c8c[_0xa301('0x2b')](_0x40ff0d)[_0xa301('0x2d')](_0x523b5b);}};}function respondWithFilteredResult(_0x16d6ec,_0x1d8685){return function(_0x51f2bb){if(_0x51f2bb){var _0x1430fb=typeof _0x1d8685[_0xa301('0x2e')]===_0xa301('0x2f')&&typeof _0x1d8685[_0xa301('0x30')]===_0xa301('0x2f');var _0x54e15c=_0x51f2bb['count'];var _0x493b7e=_0x1430fb?0x0:_0x1d8685[_0xa301('0x2e')];var _0x19f920=_0x1430fb?_0x51f2bb['count']:_0x1d8685['offset']+_0x1d8685[_0xa301('0x30')];var _0x1ef0cb;if(_0x19f920>=_0x54e15c){_0x19f920=_0x54e15c;_0x1ef0cb=0xc8;}else{_0x1ef0cb=0xce;}_0x16d6ec[_0xa301('0x2b')](_0x1ef0cb);return _0x16d6ec['set']('Content-Range',_0x493b7e+'-'+_0x19f920+'/'+_0x54e15c)[_0xa301('0x2d')](_0x51f2bb);}return null;};}function patchUpdates(_0x264be7){return function(_0x49f9ce){try{jsonpatch[_0xa301('0x31')](_0x49f9ce,_0x264be7,!![]);}catch(_0x310d77){return BPromise[_0xa301('0x32')](_0x310d77);}return _0x49f9ce[_0xa301('0x33')]();};}function saveUpdates(_0x3b4ece,_0x4f857c){return function(_0x50e73c){if(_0x50e73c){return _0x50e73c['update'](_0x3b4ece)[_0xa301('0x1e')](function(_0x54144a){return _0x54144a;});}return null;};}function removeEntity(_0x1e453b,_0x188cd1){return function(_0x5b5fb7){if(_0x5b5fb7){return _0x5b5fb7[_0xa301('0x34')]()['then'](function(){var _0x2dd951=_0x5b5fb7[_0xa301('0x35')]({'plain':!![]});var _0x96a16f=_0xa301('0x36');return db[_0xa301('0x37')][_0xa301('0x34')]({'where':{'type':_0x96a16f,'resourceId':_0x2dd951['id']}})[_0xa301('0x1e')](function(){return _0x5b5fb7;});})[_0xa301('0x1e')](function(){_0x1e453b['status'](0xcc)[_0xa301('0x2c')]();});}};}function handleEntityNotFound(_0x1bc4ec,_0x4b25fb){return function(_0x46d901){if(!_0x46d901){_0x1bc4ec[_0xa301('0x2a')](0x194);}return _0x46d901;};}function handleError(_0x43d40b,_0xc2114c){_0xc2114c=_0xc2114c||0x1f4;return function(_0x16f1d3){logger[_0xa301('0x25')](_0x16f1d3[_0xa301('0x38')]);if(_0x16f1d3[_0xa301('0x39')]){delete _0x16f1d3['name'];}_0x43d40b[_0xa301('0x2b')](_0xc2114c)['send'](_0x16f1d3);};}exports[_0xa301('0x3a')]=function(_0x1ff6cb,_0x5b0b68){var _0x8cd220={'include':[{'model':db['Pause'],'as':_0xa301('0x3b')}]},_0x26bbcd={},_0x24c52f={'count':0x0,'rows':[]};var _0x29d870=_[_0xa301('0x3c')](db['SmsAccount']['rawAttributes'],function(_0x32fa93){return{'name':_0x32fa93[_0xa301('0x3d')],'type':_0x32fa93[_0xa301('0x3e')][_0xa301('0x3f')]};});_0x26bbcd[_0xa301('0x40')]=_[_0xa301('0x3c')](_0x29d870,_0xa301('0x39'));_0x26bbcd[_0xa301('0x41')]=_[_0xa301('0x42')](_0x1ff6cb[_0xa301('0x41')]);_0x26bbcd[_0xa301('0x43')]=_[_0xa301('0x44')](_0x26bbcd['model'],_0x26bbcd[_0xa301('0x41')]);_0x8cd220[_0xa301('0x45')]=_['intersection'](_0x26bbcd[_0xa301('0x40')],qs[_0xa301('0x46')](_0x1ff6cb['query']['fields']));_0x8cd220[_0xa301('0x45')]=_0x8cd220[_0xa301('0x45')][_0xa301('0x47')]?_0x8cd220[_0xa301('0x45')]:_0x26bbcd[_0xa301('0x40')];if(!_0x1ff6cb[_0xa301('0x41')][_0xa301('0x48')]('nolimit')){_0x8cd220[_0xa301('0x30')]=qs[_0xa301('0x30')](_0x1ff6cb[_0xa301('0x41')]['limit']);_0x8cd220[_0xa301('0x2e')]=qs['offset'](_0x1ff6cb[_0xa301('0x41')][_0xa301('0x2e')]);}_0x8cd220['order']=qs[_0xa301('0x49')](_0x1ff6cb['query'][_0xa301('0x49')]);_0x8cd220[_0xa301('0x4a')]=qs[_0xa301('0x43')](_['pick'](_0x1ff6cb[_0xa301('0x41')],_0x26bbcd[_0xa301('0x43')]),_0x29d870);if(_0x1ff6cb[_0xa301('0x41')][_0xa301('0x4b')]){_0x8cd220[_0xa301('0x4a')]=_[_0xa301('0x4c')](_0x8cd220[_0xa301('0x4a')],{'$or':_[_0xa301('0x3c')](_0x29d870,function(_0x20689e){if(_0x20689e[_0xa301('0x3e')]!=='VIRTUAL'){var _0x3e0b16={};_0x3e0b16[_0x20689e['name']]={'$like':'%'+_0x1ff6cb[_0xa301('0x41')]['filter']+'%'};return _0x3e0b16;}})});}_0x8cd220=_[_0xa301('0x4c')]({},_0x8cd220,_0x1ff6cb[_0xa301('0x4d')]);var _0x3adc01={'where':_0x8cd220[_0xa301('0x4a')]};return db[_0xa301('0x4e')][_0xa301('0x4f')](_0x3adc01)[_0xa301('0x1e')](function(_0x1e7471){_0x24c52f[_0xa301('0x4f')]=_0x1e7471;if(_0x1ff6cb['query']['includeAll']){_0x8cd220[_0xa301('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0xa301('0x51')](_0x8cd220);})[_0xa301('0x1e')](function(_0x3e4b51){_0x24c52f[_0xa301('0x52')]=_0x3e4b51;return _0x24c52f;})[_0xa301('0x1e')](respondWithFilteredResult(_0x5b0b68,_0x8cd220))['catch'](handleError(_0x5b0b68,null));};exports[_0xa301('0x53')]=function(_0x306fd4,_0x56765e){var _0x2faf9d={'raw':![],'where':{'id':_0x306fd4[_0xa301('0x54')]['id']},'include':[{'model':db[_0xa301('0x55')],'as':_0xa301('0x3b')}]},_0x492182={};_0x492182[_0xa301('0x40')]=_[_0xa301('0x42')](db[_0xa301('0x4e')][_0xa301('0x56')]);_0x492182[_0xa301('0x41')]=_[_0xa301('0x42')](_0x306fd4[_0xa301('0x41')]);_0x492182[_0xa301('0x43')]=_[_0xa301('0x44')](_0x492182[_0xa301('0x40')],_0x492182['query']);_0x2faf9d['attributes']=_[_0xa301('0x44')](_0x492182[_0xa301('0x40')],qs[_0xa301('0x46')](_0x306fd4['query']['fields']));_0x2faf9d[_0xa301('0x45')]=_0x2faf9d[_0xa301('0x45')][_0xa301('0x47')]?_0x2faf9d['attributes']:_0x492182[_0xa301('0x40')];if(_0x306fd4['query'][_0xa301('0x57')]){_0x2faf9d[_0xa301('0x50')]=[{'all':!![]}];}_0x2faf9d=_['merge']({},_0x2faf9d,_0x306fd4[_0xa301('0x4d')]);return db[_0xa301('0x4e')][_0xa301('0x58')](_0x2faf9d)['then'](handleEntityNotFound(_0x56765e,null))[_0xa301('0x1e')](respondWithResult(_0x56765e,null))['catch'](handleError(_0x56765e,null));};exports[_0xa301('0x59')]=function(_0x2d82e1,_0x22b863){return db[_0xa301('0x4e')][_0xa301('0x59')](_0x2d82e1[_0xa301('0x5a')],{})[_0xa301('0x1e')](function(_0x2658ce){var _0x2bc00d=_0x2d82e1[_0xa301('0x5b')][_0xa301('0x35')]({'plain':!![]});if(!_0x2bc00d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bc00d[_0xa301('0x5c')]==='user'){var _0x473800=_0x2658ce['get']({'plain':!![]});var _0x42c448='SmsAccounts';return db['UserProfileSection'][_0xa301('0x58')]({'where':{'name':_0x42c448,'userProfileId':_0x2bc00d[_0xa301('0x5d')]},'raw':!![]})['then'](function(_0x298422){if(_0x298422&&_0x298422[_0xa301('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x473800['name'],'resourceId':_0x473800['id'],'type':_0x298422[_0xa301('0x39')],'sectionId':_0x298422['id']},{})[_0xa301('0x1e')](function(){return _0x2658ce;});}else{return _0x2658ce;}})[_0xa301('0x29')](function(_0x1d1510){logger['error'](_0xa301('0x5f'),_0x1d1510);throw _0x1d1510;});}return _0x2658ce;})[_0xa301('0x1e')](respondWithResult(_0x22b863,0xc9))[_0xa301('0x29')](handleError(_0x22b863,null));};exports['update']=function(_0x511b48,_0x466d5d){if(_0x511b48[_0xa301('0x5a')]['id']){delete _0x511b48[_0xa301('0x5a')]['id'];}return db['SmsAccount'][_0xa301('0x58')]({'where':{'id':_0x511b48[_0xa301('0x54')]['id']},'include':[{'model':db[_0xa301('0x55')],'as':_0xa301('0x3b')}]})['then'](handleEntityNotFound(_0x466d5d,null))[_0xa301('0x1e')](saveUpdates(_0x511b48[_0xa301('0x5a')],null))[_0xa301('0x1e')](respondWithResult(_0x466d5d,null))[_0xa301('0x29')](handleError(_0x466d5d,null));};exports['destroy']=function(_0x5b2069,_0x1ada97){return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x5b2069[_0xa301('0x54')]['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x1ada97,null))['then'](removeEntity(_0x1ada97,null))[_0xa301('0x29')](handleError(_0x1ada97,null));};exports['describe']=function(_0x2e8ed5,_0x54900a){return db[_0xa301('0x4e')]['describe']()[_0xa301('0x1e')](respondWithResult(_0x54900a,null))[_0xa301('0x29')](handleError(_0x54900a,null));};exports[_0xa301('0x60')]=function(_0x4bccad,_0x4e0a8e,_0x3acba4){if(_0x4bccad[_0xa301('0x5a')]['id']){delete _0x4bccad[_0xa301('0x5a')]['id'];}return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x4bccad[_0xa301('0x54')]['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x4e0a8e,null))[_0xa301('0x1e')](function(_0x538083){if(_0x538083){_0x4bccad[_0xa301('0x5a')][_0xa301('0x61')]=_0x538083['id'];return db[_0xa301('0x62')][_0xa301('0x59')](_0x4bccad['body']);}})[_0xa301('0x1e')](respondWithResult(_0x4e0a8e,null))[_0xa301('0x29')](handleError(_0x4e0a8e,null));};exports[_0xa301('0x63')]=function(_0x13abf6,_0x5b569a,_0x531a1b){var _0x29cc7b={'raw':![],'where':{}};var _0x4c8fa5={};var _0x27b398={'count':0x0,'rows':[]};return db[_0xa301('0x4e')][_0xa301('0x64')]({'where':{'id':_0x13abf6[_0xa301('0x54')]['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x5b569a,null))[_0xa301('0x1e')](function(_0x8978fc){if(_0x8978fc){_0x4c8fa5[_0xa301('0x40')]=_[_0xa301('0x42')](db[_0xa301('0x62')]['rawAttributes']);_0x4c8fa5[_0xa301('0x41')]=_[_0xa301('0x42')](_0x13abf6['query']);_0x4c8fa5[_0xa301('0x43')]=_[_0xa301('0x44')](_0x4c8fa5['model'],_0x4c8fa5[_0xa301('0x41')]);_0x29cc7b[_0xa301('0x45')]=_['intersection'](_0x4c8fa5[_0xa301('0x40')],qs['fields'](_0x13abf6['query'][_0xa301('0x46')]));_0x29cc7b['attributes']=_0x29cc7b[_0xa301('0x45')][_0xa301('0x47')]?_0x29cc7b[_0xa301('0x45')]:_0x4c8fa5[_0xa301('0x40')];if(!_0x13abf6['query']['hasOwnProperty']('nolimit')){_0x29cc7b['limit']=qs[_0xa301('0x30')](_0x13abf6['query'][_0xa301('0x30')]);_0x29cc7b[_0xa301('0x2e')]=qs[_0xa301('0x2e')](_0x13abf6[_0xa301('0x41')][_0xa301('0x2e')]);}_0x29cc7b[_0xa301('0x65')]=qs['sort'](_0x13abf6[_0xa301('0x41')][_0xa301('0x49')]);_0x29cc7b[_0xa301('0x4a')]=qs[_0xa301('0x43')](_[_0xa301('0x66')](_0x13abf6[_0xa301('0x41')],_0x4c8fa5[_0xa301('0x43')]));_0x29cc7b[_0xa301('0x4a')]['SmsAccountId']=_0x8978fc['id'];if(_0x13abf6[_0xa301('0x41')]['filter']){_0x29cc7b[_0xa301('0x4a')]=_[_0xa301('0x4c')](_0x29cc7b['where'],{'$or':_[_0xa301('0x3c')](_0x29cc7b[_0xa301('0x45')],function(_0xc51c9c){var _0x231133={};_0x231133[_0xc51c9c]={'$like':'%'+_0x13abf6[_0xa301('0x41')][_0xa301('0x4b')]+'%'};return _0x231133;})});}_0x29cc7b=_[_0xa301('0x4c')]({},_0x29cc7b,_0x13abf6['options']);return db['Disposition']['count']({'where':_0x29cc7b['where']})[_0xa301('0x1e')](function(_0x5a34b6){_0x27b398[_0xa301('0x4f')]=_0x5a34b6;if(_0x13abf6['query'][_0xa301('0x57')]){_0x29cc7b[_0xa301('0x50')]=[{'all':!![]}];}return db[_0xa301('0x62')][_0xa301('0x51')](_0x29cc7b);})[_0xa301('0x1e')](function(_0x250d73){_0x27b398['rows']=_0x250d73;return _0x27b398;});}})[_0xa301('0x1e')](respondWithFilteredResult(_0x5b569a,_0x29cc7b))['catch'](handleError(_0x5b569a,null));};exports['removeDispositions']=function(_0x4d0da1,_0x599eb0,_0x2ccc21){return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x4d0da1['params']['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x599eb0,null))[_0xa301('0x1e')](function(_0x381339){if(_0x381339){return _0x381339['removeDispositions'](_0x4d0da1['query'][_0xa301('0x67')]);}})['then'](respondWithStatusCode(_0x599eb0,null))[_0xa301('0x29')](handleError(_0x599eb0,null));};exports['addAnswer']=function(_0x5727d8,_0x70aeaa,_0x384452){if(_0x5727d8[_0xa301('0x5a')]['id']){delete _0x5727d8['body']['id'];}return db[_0xa301('0x4e')]['find']({'where':{'id':_0x5727d8[_0xa301('0x54')]['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x70aeaa,null))[_0xa301('0x1e')](function(_0x544a31){if(_0x544a31){_0x5727d8[_0xa301('0x5a')][_0xa301('0x61')]=_0x544a31['id'];return db[_0xa301('0x68')][_0xa301('0x59')](_0x5727d8[_0xa301('0x5a')]);}})['then'](respondWithResult(_0x70aeaa,null))['catch'](handleError(_0x70aeaa,null));};exports[_0xa301('0x69')]=function(_0x1654c8,_0x2d7512,_0x288fac){var _0xccafbb={'raw':![],'where':{}};var _0x3c6446={};var _0x2433b0={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa301('0x64')]({'where':{'id':_0x1654c8[_0xa301('0x54')]['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x2d7512,null))['then'](function(_0x3a7b2e){if(_0x3a7b2e){_0x3c6446['model']=_['keys'](db[_0xa301('0x68')][_0xa301('0x56')]);_0x3c6446[_0xa301('0x41')]=_[_0xa301('0x42')](_0x1654c8['query']);_0x3c6446['filters']=_['intersection'](_0x3c6446[_0xa301('0x40')],_0x3c6446[_0xa301('0x41')]);_0xccafbb[_0xa301('0x45')]=_[_0xa301('0x44')](_0x3c6446[_0xa301('0x40')],qs['fields'](_0x1654c8[_0xa301('0x41')][_0xa301('0x46')]));_0xccafbb['attributes']=_0xccafbb['attributes']['length']?_0xccafbb[_0xa301('0x45')]:_0x3c6446['model'];if(!_0x1654c8[_0xa301('0x41')][_0xa301('0x48')](_0xa301('0x6a'))){_0xccafbb['limit']=qs[_0xa301('0x30')](_0x1654c8[_0xa301('0x41')]['limit']);_0xccafbb[_0xa301('0x2e')]=qs[_0xa301('0x2e')](_0x1654c8['query']['offset']);}_0xccafbb['order']=qs[_0xa301('0x49')](_0x1654c8[_0xa301('0x41')]['sort']);_0xccafbb['where']=qs[_0xa301('0x43')](_['pick'](_0x1654c8[_0xa301('0x41')],_0x3c6446[_0xa301('0x43')]));_0xccafbb['where'][_0xa301('0x61')]=_0x3a7b2e['id'];if(_0x1654c8[_0xa301('0x41')][_0xa301('0x4b')]){_0xccafbb[_0xa301('0x4a')]=_[_0xa301('0x4c')](_0xccafbb['where'],{'$or':_[_0xa301('0x3c')](_0xccafbb[_0xa301('0x45')],function(_0x52ba1c){var _0x2b48ea={};_0x2b48ea[_0x52ba1c]={'$like':'%'+_0x1654c8['query'][_0xa301('0x4b')]+'%'};return _0x2b48ea;})});}_0xccafbb=_[_0xa301('0x4c')]({},_0xccafbb,_0x1654c8['options']);return db[_0xa301('0x68')][_0xa301('0x4f')]({'where':_0xccafbb[_0xa301('0x4a')]})[_0xa301('0x1e')](function(_0x11ad67){_0x2433b0['count']=_0x11ad67;if(_0x1654c8[_0xa301('0x41')][_0xa301('0x57')]){_0xccafbb[_0xa301('0x50')]=[{'all':!![]}];}return db[_0xa301('0x68')][_0xa301('0x51')](_0xccafbb);})[_0xa301('0x1e')](function(_0x2337b4){_0x2433b0[_0xa301('0x52')]=_0x2337b4;return _0x2433b0;});}})[_0xa301('0x1e')](respondWithFilteredResult(_0x2d7512,_0xccafbb))[_0xa301('0x29')](handleError(_0x2d7512,null));};exports['removeAnswers']=function(_0x3eed40,_0x1d2c02,_0x26ab17){return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x3eed40['params']['id']}})['then'](handleEntityNotFound(_0x1d2c02,null))['then'](function(_0x163ce5){if(_0x163ce5){return _0x163ce5['removeAnswers'](_0x3eed40[_0xa301('0x41')][_0xa301('0x67')]);}})[_0xa301('0x1e')](respondWithStatusCode(_0x1d2c02,null))['catch'](handleError(_0x1d2c02,null));};exports[_0xa301('0x6b')]=function(_0x5e5163,_0x2b5160,_0xbc8b1d){var _0x2c41bb={'channel':_0xa301('0x6c')};var _0x5e9bf7=[];var _0x21e240=[];var _0x5b73e1={};return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x5e5163[_0xa301('0x54')]['id']},'include':[{'model':db[_0xa301('0x6d')],'as':_0xa301('0x6e')}]})['then'](handleEntityNotFound(_0x2b5160,null))[_0xa301('0x1e')](function(_0x3c0357){_0x2c41bb[_0xa301('0x6f')]=_0x3c0357;_0x2c41bb['applications']=_[_0xa301('0x70')](_0x3c0357[_0xa301('0x6e')],['priority'],[_0xa301('0x71')]);if(_0x2c41bb[_0xa301('0x6f')][_0xa301('0x6e')]){delete _0x2c41bb[_0xa301('0x6f')]['Applications'];}return db[_0xa301('0x72')][_0xa301('0x73')]();})[_0xa301('0x1e')](function(_0x55d147){if(!_0x55d147){throw new db[(_0xa301('0x74'))]['ValidationError'](_0xa301('0x75'));}_0x5e9bf7=_[_0xa301('0x76')](_[_0xa301('0x42')](_0x55d147),['createdAt',_0xa301('0x77')]);_0x21e240=_[_0xa301('0x76')](_['keys'](_0x55d147),[_0xa301('0x78'),_0xa301('0x77'),_0xa301('0x79'),_0xa301('0x7a')]);_0x2c41bb[_0xa301('0x5a')]={'mapKey':'mobile'};if(_0x2c41bb[_0xa301('0x6f')][_0xa301('0x3e')]){switch(_0x2c41bb[_0xa301('0x6f')][_0xa301('0x3e')]){case _0xa301('0x7b'):_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]=_0x5e5163[_0xa301('0x5a')]['From'];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x7d')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7e')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x7f')];break;case'skebby':_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]='+'+_0x5e5163['body'][_0xa301('0x80')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')]['text'];break;case _0xa301('0x81'):_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x7c')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')]['message'];break;case _0xa301('0x82'):_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x7c')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x5a')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7e')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x83')];break;case _0xa301('0x84'):_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]=_0x5e5163['body'][_0xa301('0x85')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x5a')]=_0x5e5163['body'][_0xa301('0x86')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7e')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x87')];break;case _0xa301('0x88'):_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]='+'+_0x5e5163['body'][_0xa301('0x89')][0x0]['from'];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x89')][0x0][_0xa301('0x8a')];_0x2c41bb['body']['messageId']=_0x5e5163['body']['results'][0x0][_0xa301('0x7e')];break;case _0xa301('0x8b'):_0x2c41bb[_0xa301('0x5a')]['from']=_0x5e5163[_0xa301('0x5a')][_0xa301('0x8c')];_0x2c41bb[_0xa301('0x5a')]['body']=_0x5e5163['body'][_0xa301('0x8d')]['message'];break;case _0xa301('0x8e'):_0x2c41bb['body'][_0xa301('0x7c')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x8f')];_0x2c41bb['body'][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x8a')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7e')]=_0x5e5163['body'][_0xa301('0x90')];break;case _0xa301('0x91'):_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7e')]=_0x5e5163[_0xa301('0x5a')][0x0][_0xa301('0x27')]['id'];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]=_0x5e5163[_0xa301('0x5a')][0x0]['message']['from'];_0x2c41bb['body'][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')][0x0]['message']['text'];break;case _0xa301('0x92'):_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')]=_0x5e5163[_0xa301('0x5a')]['from'];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x5a')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x27')];_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7e')]=_0x5e5163[_0xa301('0x5a')][_0xa301('0x93')];break;}}if(_0x2c41bb[_0xa301('0x5a')]['id']){delete _0x2c41bb[_0xa301('0x5a')]['id'];}if(_['isNil'](_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')])){throw new db[(_0xa301('0x74'))][(_0xa301('0x94'))]('from\x20is\x20mandatory');}if(_[_0xa301('0x95')](_0x2c41bb[_0xa301('0x5a')]['body'])||_0x2c41bb[_0xa301('0x5a')]['body']===''){throw new db[(_0xa301('0x74'))]['ValidationError'](_0xa301('0x96'));}if(_[_0xa301('0x95')](_0x2c41bb[_0xa301('0x5a')][_0xa301('0x97')])){throw new db['Sequelize'][(_0xa301('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21e240);}if(!_[_0xa301('0x98')](_0x21e240,_0x2c41bb[_0xa301('0x5a')][_0xa301('0x97')])){throw new db[(_0xa301('0x74'))]['ValidationError'](_0xa301('0x99')+_0x21e240);}_0x5b73e1[_0x2c41bb['body'][_0xa301('0x97')]]=_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')];return db[_0xa301('0x9a')][_0xa301('0x58')]({'where':{'id':_0x2c41bb['account']['ListId']},'include':[{'model':db[_0xa301('0x72')],'as':'Contacts','where':_0x5b73e1,'limit':0x1,'order':[[_0xa301('0x77'),_0xa301('0x9b')]]}]});})[_0xa301('0x1e')](handleEntityNotFound(_0x2b5160,null))[_0xa301('0x1e')](function(_0x21a2be){if(_0x21a2be){_0x2c41bb[_0xa301('0x9c')]=_[_0xa301('0x9d')](_0x21a2be,[_0xa301('0x9e')]);if(_0x21a2be['Contacts'][_0xa301('0x47')]){return _0x21a2be[_0xa301('0x9e')][0x0];}var _0x445304=_['defaults'](_0x2c41bb[_0xa301('0x5a')],{'firstName':_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')],'ListId':_0x21a2be['id']});_0x445304[_0x2c41bb[_0xa301('0x5a')]['mapKey']]=_0x2c41bb[_0xa301('0x5a')][_0xa301('0x7c')];return db[_0xa301('0x72')][_0xa301('0x59')](_0x445304,{'fields':_0x5e9bf7,'raw':!![]});}})[_0xa301('0x1e')](handleEntityNotFound(_0x2b5160,null))['then'](function(_0x2bb7fa){if(_0x2bb7fa){_0x2c41bb[_0xa301('0x9f')]=_0x2bb7fa;var _0xa4f711={'ContactId':_0x2bb7fa['id'],'phone':_0x2c41bb[_0xa301('0x5a')]['from'],'SmsAccountId':_0x5e5163[_0xa301('0x54')]['id']};var _0x3a6d9b={'ContactId':_0x2bb7fa['id'],'SmsAccountId':_0x5e5163[_0xa301('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0xa301('0x58')]({'where':_0x3a6d9b})[_0xa301('0x1e')](function(_0x33b806){if(_0x33b806){return[_0x33b806,![]];}return db[_0xa301('0xa0')][_0xa301('0x59')](_0xa4f711)[_0xa301('0x1e')](function(_0x16b7f5){return[_0x16b7f5,!![]];});});}})[_0xa301('0xa1')](function(_0x54fceb,_0x5044ec){_0x2c41bb['interaction']=_0x54fceb['get']({'plain':!![]});_0x2c41bb[_0xa301('0xa2')][_0xa301('0xa3')]=![];if(_0x5044ec){if(_0x2c41bb['account'][_0xa301('0xa4')]){_0x2c41bb[_0xa301('0xa5')]['push']({'id':0x0,'priority':_0x2c41bb[_0xa301('0xa5')]['length']+0x1,'app':_0xa301('0xa6'),'appdata':_0xa301('0xa7'),'interval':'*,*,*,*'});}_0x2c41bb[_0xa301('0xa2')]['created']=!![];}return db[_0xa301('0xa8')]['create']({'phone':_0x2c41bb[_0xa301('0x5a')]['from'],'messageId':_0x2c41bb[_0xa301('0x5a')]['messageId'],'body':_0x2c41bb['body'][_0xa301('0x5a')],'SmsAccountId':_0x5e5163['params']['id'],'SmsInteractionId':_0x54fceb['id'],'direction':'in','ContactId':_0x54fceb[_0xa301('0xa9')],'AttachmentId':_0x2c41bb[_0xa301('0x5a')][_0xa301('0xaa')]});})[_0xa301('0x1e')](function(_0x1c5ec6){_0x2c41bb[_0xa301('0x27')]=_0x1c5ec6;if(!_0x2c41bb[_0xa301('0xa2')]['UserId'])return;return db['User'][_0xa301('0x58')]({'attributes':['id',_0xa301('0x39')],'where':{'id':_0x2c41bb[_0xa301('0xa2')]['UserId']}});})[_0xa301('0x1e')](function(_0xfca7c3){if(_0xfca7c3){_0x2c41bb[_0xa301('0xa5')][_0xa301('0xab')]({'id':0x0,'priority':0x0,'app':_0xa301('0xac'),'appdata':_0xfca7c3[_0xa301('0x39')]+','+(_0x2c41bb[_0xa301('0x6f')][_0xa301('0xad')]||0xa),'interval':'*,*,*,*'});}if(!_0x2c41bb[_0xa301('0xa2')][_0xa301('0xae')])return;return db[_0xa301('0xaf')][_0xa301('0x58')]({'attributes':['id',_0xa301('0x39')],'where':{'id':_0x2c41bb['interaction'][_0xa301('0xae')]}});})['then'](function(_0x2c0b00){if(_0x2c0b00){_0x2c41bb['applications'][_0xa301('0xab')]({'id':0x0,'priority':0x1,'app':_0xa301('0xb0'),'appdata':_0x2c0b00[_0xa301('0x39')]+','+(_0x2c41bb[_0xa301('0x6f')][_0xa301('0xb1')]||0x12c),'interval':_0xa301('0xb2')});}return respondWithRpcPromise(_0xa301('0xb3'),_0xa301('0xb4'),_0x2c41bb);})[_0xa301('0x1e')](function(_0x53b9e2){if(_0x53b9e2){var _0x27fd7b=0xc8;var _0x190929=_0xa301('0xb5');logger[_0xa301('0x1f')](_0xa301('0x23'),_0x190929,_0x27fd7b,_0xa301('0xb6'));logger['debug'](_0xa301('0xb7'),_0x190929,_0x27fd7b,_0xa301('0xb6'),JSON[_0xa301('0x24')](_0x53b9e2));if(_0x2c41bb[_0xa301('0x6f')]['type']==='twilio'){return _0x2b5160[_0xa301('0x2b')](_0x27fd7b)[_0xa301('0xb8')](_0xa301('0xb9'),'text/xml')[_0xa301('0xba')](_0xa301('0xbb'));}else{return _0x2b5160[_0xa301('0x2b')](_0x27fd7b)[_0xa301('0x2d')](_0x53b9e2);}}})[_0xa301('0x29')](handleError(_0x2b5160,null));};exports[_0xa301('0xbc')]=function(_0x2d6035,_0x271676){var _0x21e688=_0x2d6035[_0xa301('0x54')]['id'];var _0x2b37bd=_0x2d6035[_0xa301('0x5a')];var _0x50db4f=0xc8;var _0x4e7121=null;return db['sequelize'][_0xa301('0xbd')]({'isolationLevel':db[_0xa301('0xbe')][_0xa301('0xbf')][_0xa301('0xc0')]['READ_COMMITTED']},function(_0x4dbe87){return db[_0xa301('0x4e')]['findOne']({'where':{'id':_0x21e688},'transaction':_0x4dbe87})[_0xa301('0x1e')](function(_0xa01848){if(_0xa01848){return db[_0xa301('0x6d')][_0xa301('0x34')]({'where':{'SmsAccountId':_0x21e688},'transaction':_0x4dbe87})[_0xa301('0x1e')](function(){var _0x579426=_['map'](_0x2b37bd,function(_0x2c81f7){_0x2c81f7[_0xa301('0x61')]=_0x21e688;return _0x2c81f7;});return db[_0xa301('0x6d')][_0xa301('0xc1')](_0x579426,{'transaction':_0x4dbe87});});}else{_0x50db4f=0x194;_0x4e7121=[];}});})[_0xa301('0x1e')](function(){if(_0x50db4f!==0x194){return db[_0xa301('0x6d')][_0xa301('0xc2')]({'where':{'SmsAccountId':_0x21e688},'order':'priority'})[_0xa301('0x1e')](function(_0x52256d){_0x4e7121=_0x52256d;});}})[_0xa301('0x29')](function(_0x2fd50a){_0x50db4f=0x1f4;logger['error'](_0x2fd50a[_0xa301('0x38')]);if(_0x2fd50a['name']){delete _0x2fd50a[_0xa301('0x39')];}_0x4e7121=_0x2fd50a;})[_0xa301('0xc3')](function(){if(_0x4e7121===null){_0x271676[_0xa301('0x2a')](_0x50db4f);}else{if(_0x50db4f===0x1f4){_0x271676[_0xa301('0x2b')](_0x50db4f)['send'](_0x4e7121);}else{_0x271676['status'](_0x50db4f)[_0xa301('0x2d')](_0x4e7121);}}});};exports[_0xa301('0xc4')]=function(_0x2cdc9a,_0x55bef6,_0x1dfe1a){var _0x3590a5={};var _0x55ea5f={};var _0x230dfc;var _0x52596f;return db['SmsAccount']['findOne']({'where':{'id':_0x2cdc9a[_0xa301('0x54')]['id']}})['then'](handleEntityNotFound(_0x55bef6,null))[_0xa301('0x1e')](function(_0x4784cc){if(_0x4784cc){_0x230dfc=_0x4784cc;_0x55ea5f[_0xa301('0x40')]=_[_0xa301('0x42')](db[_0xa301('0x6d')][_0xa301('0x56')]);_0x55ea5f[_0xa301('0x41')]=_['keys'](_0x2cdc9a[_0xa301('0x41')]);_0x55ea5f[_0xa301('0x43')]=_[_0xa301('0x44')](_0x55ea5f[_0xa301('0x40')],_0x55ea5f['query']);_0x3590a5[_0xa301('0x45')]=_['intersection'](_0x55ea5f[_0xa301('0x40')],qs['fields'](_0x2cdc9a[_0xa301('0x41')][_0xa301('0x46')]));_0x3590a5[_0xa301('0x45')]=_0x3590a5[_0xa301('0x45')][_0xa301('0x47')]?_0x3590a5['attributes']:_0x55ea5f[_0xa301('0x40')];_0x3590a5['order']=qs[_0xa301('0x49')](_0x2cdc9a[_0xa301('0x41')][_0xa301('0x49')]);_0x3590a5[_0xa301('0x4a')]=qs['filters'](_[_0xa301('0x66')](_0x2cdc9a['query'],_0x55ea5f[_0xa301('0x43')]));if(_0x2cdc9a[_0xa301('0x41')]['filter']){_0x3590a5[_0xa301('0x4a')]=_[_0xa301('0x4c')](_0x3590a5[_0xa301('0x4a')],{'$or':_[_0xa301('0x3c')](_0x3590a5[_0xa301('0x45')],function(_0x2c42b4){var _0x4f0f65={};_0x4f0f65[_0x2c42b4]={'$like':'%'+_0x2cdc9a[_0xa301('0x41')]['filter']+'%'};return _0x4f0f65;})});}_0x3590a5=_[_0xa301('0x4c')]({},_0x3590a5,_0x2cdc9a[_0xa301('0x4d')]);return _0x230dfc[_0xa301('0xc4')](_0x3590a5);}})[_0xa301('0x1e')](function(_0x57e0f3){if(_0x57e0f3){_0x52596f=_0x57e0f3['length'];if(!_0x2cdc9a[_0xa301('0x41')][_0xa301('0x48')](_0xa301('0x6a'))){_0x3590a5[_0xa301('0x30')]=qs[_0xa301('0x30')](_0x2cdc9a[_0xa301('0x41')][_0xa301('0x30')]);_0x3590a5[_0xa301('0x2e')]=qs[_0xa301('0x2e')](_0x2cdc9a[_0xa301('0x41')][_0xa301('0x2e')]);}return _0x230dfc[_0xa301('0xc4')](_0x3590a5);}})[_0xa301('0x1e')](function(_0x203e6b){if(_0x203e6b){return _0x203e6b?{'count':_0x52596f,'rows':_0x203e6b}:null;}})[_0xa301('0x1e')](respondWithResult(_0x55bef6,null))['catch'](handleError(_0x55bef6,null));};exports['getInteractions']=function(_0x275808,_0x40d5e0,_0xf4c15c){var _0x3597ff={'raw':![],'where':{}};var _0x213abc={};var _0x5a266b={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x275808[_0xa301('0x54')]['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x40d5e0,null))[_0xa301('0x1e')](function(_0x5ebfb3){if(_0x5ebfb3){_0x213abc[_0xa301('0x40')]=_[_0xa301('0x42')](db['SmsInteraction']['rawAttributes']);_0x213abc['query']=_['keys'](_0x275808[_0xa301('0x41')]);_0x213abc[_0xa301('0x43')]=_[_0xa301('0x44')](_0x213abc[_0xa301('0x40')],_0x213abc[_0xa301('0x41')]);_0x3597ff[_0xa301('0x45')]=_['intersection'](_0x213abc[_0xa301('0x40')],qs[_0xa301('0x46')](_0x275808['query'][_0xa301('0x46')]));_0x3597ff[_0xa301('0x45')]=_0x3597ff['attributes'][_0xa301('0x47')]?_0x3597ff[_0xa301('0x45')]:_0x213abc['model'];if(!_0x275808[_0xa301('0x41')]['hasOwnProperty']('nolimit')){_0x3597ff[_0xa301('0x30')]=qs[_0xa301('0x30')](_0x275808['query']['limit']);_0x3597ff[_0xa301('0x2e')]=qs[_0xa301('0x2e')](_0x275808[_0xa301('0x41')]['offset']);}_0x3597ff[_0xa301('0x65')]=qs[_0xa301('0x49')](_0x275808[_0xa301('0x41')][_0xa301('0x49')]);_0x3597ff[_0xa301('0x4a')]=qs[_0xa301('0x43')](_[_0xa301('0x66')](_0x275808[_0xa301('0x41')],_0x213abc[_0xa301('0x43')]));_0x3597ff[_0xa301('0x4a')][_0xa301('0x61')]=_0x5ebfb3['id'];if(_0x275808['query'][_0xa301('0x4b')]){_0x3597ff['where']=_['merge'](_0x3597ff['where'],{'$or':_['map'](_0x3597ff[_0xa301('0x45')],function(_0x3443f9){var _0x26d719={};_0x26d719[_0x3443f9]={'$like':'%'+_0x275808[_0xa301('0x41')][_0xa301('0x4b')]+'%'};return _0x26d719;})});}_0x3597ff=_[_0xa301('0x4c')]({},_0x3597ff,_0x275808['options']);return db['SmsInteraction'][_0xa301('0x4f')]({'where':_0x3597ff['where']})[_0xa301('0x1e')](function(_0x23908e){_0x5a266b['count']=_0x23908e;if(_0x275808['query'][_0xa301('0x57')]){_0x3597ff[_0xa301('0x50')]=[{'model':db[_0xa301('0x72')],'as':_0xa301('0xc5'),'required':![]},{'model':db[_0xa301('0xc6')],'as':_0xa301('0xc7'),'attributes':[_0xa301('0x39'),'fullname',_0xa301('0xc8')],'required':![]},{'model':db[_0xa301('0xc9')],'as':'Tags','attributes':['id',_0xa301('0x39'),_0xa301('0xca')],'where':_0x275808[_0xa301('0x41')][_0xa301('0xcb')]?{'id':_0x275808[_0xa301('0x41')][_0xa301('0xcb')]}:undefined,'required':_0x275808[_0xa301('0x41')][_0xa301('0xcb')]?!![]:![]}];}return db[_0xa301('0xa0')]['findAll'](_0x3597ff);})[_0xa301('0x1e')](function(_0x4d6253){_0x5a266b[_0xa301('0x52')]=_0x4d6253;return _0x5a266b;});}})[_0xa301('0x1e')](respondWithFilteredResult(_0x40d5e0,_0x3597ff))[_0xa301('0x29')](handleError(_0x40d5e0,null));};exports[_0xa301('0xba')]=function(_0x516f36,_0x3cecea,_0x2f41a7){var _0x444968,_0x369ab7,_0x29a664;if(_[_0xa301('0x95')](_0x516f36[_0xa301('0x5a')][_0xa301('0x5a')])||_0x516f36[_0xa301('0x5a')]['body']===''){throw new db[(_0xa301('0x74'))][(_0xa301('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x516f36[_0xa301('0x5a')]['to'])){throw new db[(_0xa301('0x74'))][(_0xa301('0x94'))](_0xa301('0xcc'));}_0x444968=_0x516f36[_0xa301('0x5a')]['to'];return db[_0xa301('0x4e')]['find']({'where':{'id':_0x516f36[_0xa301('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xa301('0xcd'),'include':[{'model':db[_0xa301('0x72')],'as':'Contacts','where':{'mobile':_0x444968},'limit':0x1,'order':[['updatedAt',_0xa301('0x9b')]]}]}]})[_0xa301('0x1e')](handleEntityNotFound(_0x3cecea,null))[_0xa301('0x1e')](function(_0x25d780){if(_0x25d780&&_0x25d780['List']){_0x369ab7=_0x25d780[_0xa301('0x35')]({'plain':!![]});if(_0x369ab7[_0xa301('0xcd')]&&_0x369ab7[_0xa301('0xcd')][_0xa301('0x9e')][_0xa301('0x47')]){return _0x369ab7[_0xa301('0xcd')][_0xa301('0x9e')][0x0];}return db[_0xa301('0x72')][_0xa301('0x59')](_[_0xa301('0x18')](_0x516f36[_0xa301('0x5a')],{'firstName':_0x444968,'mobile':_0x444968,'phone':_0x444968,'ListId':_0x369ab7[_0xa301('0x7a')]}));}})[_0xa301('0x1e')](handleEntityNotFound(_0x3cecea,null))['then'](function(_0x4b30df){if(_0x4b30df){_0x29a664=_0x4b30df;return db[_0xa301('0xa0')][_0xa301('0x58')]({'where':{'ContactId':_0x29a664['id'],'closed':![],'SmsAccountId':_0x369ab7['id']}})['then'](function(_0x41e74e){if(_0x41e74e){return[_0x41e74e,![]];}return db[_0xa301('0xa0')][_0xa301('0x59')]({'UserId':_0x516f36[_0xa301('0x5b')]['id'],'ContactId':_0x29a664['id'],'SmsAccountId':_0x369ab7['id'],'phone':_0x444968,'firstMsgDirection':_0xa301('0xce'),'Messages':[_[_0xa301('0x4c')](_0x516f36[_0xa301('0x5a')],{'read':![],'body':_0x516f36[_0xa301('0x5a')]['body'],'phone':_0x444968,'SmsAccountId':_0x369ab7['id'],'UserId':_0x516f36[_0xa301('0x5b')]['id'],'ContactId':_0x29a664['id']})]},{'include':[{'model':db[_0xa301('0xa8')],'as':_0xa301('0xcf')}]})[_0xa301('0x1e')](function(_0x5f8ae2){return[_0x5f8ae2,!![]];});});}})[_0xa301('0xa1')](function(_0x23aef3,_0x2237ff){if(_0x2237ff){return _0x23aef3;}return db['SmsMessage'][_0xa301('0x59')](_['merge'](_0x516f36[_0xa301('0x5a')],{'read':![],'body':_0x516f36[_0xa301('0x5a')][_0xa301('0x5a')],'phone':_0x444968,'SmsAccountId':_0x369ab7['id'],'SmsInteractionId':_0x23aef3['id'],'UserId':_0x516f36[_0xa301('0x5b')]['id'],'ContactId':_0x29a664['id']}))[_0xa301('0x1e')](function(_0x2dd2a2){_0x23aef3[_0xa301('0xd0')][_0xa301('0xcf')]=[];_0x23aef3[_0xa301('0xd0')][_0xa301('0xcf')][_0xa301('0xd1')](_0x2dd2a2['dataValues']);return _0x23aef3;});})[_0xa301('0x1e')](respondWithResult(_0x3cecea,null))[_0xa301('0x29')](handleError(_0x3cecea,null));};exports[_0xa301('0x2b')]=function(_0x2092e5,_0x32582e,_0x4dc2cc){if(_0x2092e5['body']['id']){delete _0x2092e5[_0xa301('0x5a')]['id'];}var _0x1edb6b,_0x374343,_0x446ae1;return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x2092e5[_0xa301('0x54')]['id']}})['then'](handleEntityNotFound(_0x32582e,null))[_0xa301('0x1e')](function(_0x1dcca1){if(_0x1dcca1){_0x446ae1=_0x1dcca1;logger[_0xa301('0x22')](_0xa301('0x23'),_0xa301('0x2b'),_0xa301('0xd2'),_0x1dcca1['type'],util[_0xa301('0xd3')](_0x2092e5['body'],{'showHidden':![],'depth':null}));switch(_0x1dcca1[_0xa301('0x3e')]){case _0xa301('0xd4'):if(_0x2092e5['body'][_0xa301('0xd5')]&&_0x2092e5[_0xa301('0x5a')][_0xa301('0x2b')]){_0x374343=_0x2092e5[_0xa301('0x5a')][_0xa301('0x2b')];return db['SmsMessage'][_0xa301('0x58')]({'where':{'messageId':_0x2092e5[_0xa301('0x5a')][_0xa301('0xd5')]}});}break;case _0xa301('0x81'):if(_0x2092e5['body'][_0xa301('0xd6')]&&_0x2092e5['body'][_0xa301('0xd7')]){_0x374343=_0x2092e5[_0xa301('0x5a')][_0xa301('0xd7')];return db[_0xa301('0xa8')][_0xa301('0x58')]({'where':{'messageId':_0x2092e5[_0xa301('0x5a')][_0xa301('0xd6')]}});}break;case _0xa301('0x82'):if(_0x2092e5['body'][_0xa301('0x83')]&&_0x2092e5[_0xa301('0x5a')][_0xa301('0xd8')]){_0x374343=_0x2092e5[_0xa301('0x5a')][_0xa301('0xd8')];return db[_0xa301('0xa8')][_0xa301('0x58')]({'where':{'messageId':_0x2092e5[_0xa301('0x5a')]['message_id']}});}break;case _0xa301('0x88'):var _0x382096=_0x2092e5[_0xa301('0x5a')][_0xa301('0x89')][0x0];if(_0x382096['messageId']&&_0x382096[_0xa301('0x2b')][_0xa301('0xd9')]===_0xa301('0xda')){_0x374343=_0x382096[_0xa301('0x2b')][_0xa301('0xd9')];return db[_0xa301('0xa8')]['find']({'where':{'messageId':_0x382096['messageId']}});}break;case _0xa301('0x8e'):if(_0x2092e5[_0xa301('0x5a')][_0xa301('0x7e')]&&_0x2092e5[_0xa301('0x5a')][_0xa301('0x2b')]){_0x374343=_0x2092e5[_0xa301('0x5a')][_0xa301('0x2b')];return db[_0xa301('0xa8')][_0xa301('0x58')]({'where':{'messageId':_0x2092e5[_0xa301('0x5a')][_0xa301('0x7e')]}});}break;case _0xa301('0x91'):if(_0x2092e5['body'][0x0][_0xa301('0x27')]['id']){_0x374343=_0x2092e5[_0xa301('0x5a')][0x0][_0xa301('0x3e')];return db[_0xa301('0xa8')][_0xa301('0x58')]({'where':{'messageId':_0x2092e5[_0xa301('0x5a')][0x0][_0xa301('0x27')]['id']}});}break;case _0xa301('0x92'):if(_0x2092e5['body'][_0xa301('0xdb')]&&_0x2092e5[_0xa301('0x5a')][_0xa301('0x2b')]){_0x374343=_0x2092e5[_0xa301('0x5a')][_0xa301('0x2b')];return db['SmsMessage'][_0xa301('0x58')]({'where':{'messageId':_0x2092e5['body'][_0xa301('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x32582e,null))[_0xa301('0x1e')](function(_0x55b55f){if(_0x55b55f){_0x1edb6b=_0x55b55f;switch(_0x446ae1[_0xa301('0x3e')]){case _0xa301('0xd4'):if(_0x374343===_0xa301('0xda')){return _0x1edb6b[_0xa301('0xdc')]({'read':!![]});}else{logger[_0xa301('0x25')](_0xa301('0x23'),'status','skebby',util[_0xa301('0xd3')](_0x2092e5[_0xa301('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x374343==='1'){return _0x1edb6b[_0xa301('0xdc')]({'read':!![]});}else{logger[_0xa301('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa301('0xd4'),util[_0xa301('0xd3')](_0x2092e5[_0xa301('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa301('0x82'):if(!_0x2092e5['body'][_0xa301('0xdd')]&&_0x374343>=0xc8&&_0x374343<=0xce){return _0x1edb6b['update']({'read':!![]});}else{logger[_0xa301('0x25')](_0xa301('0x23'),'status',_0xa301('0x82'),util[_0xa301('0xd3')](_0x2092e5[_0xa301('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa301('0x88'):var _0x3af8a6=_0x2092e5['body']['results'][0x0];if(_0x3af8a6[_0xa301('0x2b')]['groupName']===_0xa301('0xda')){return _0x1edb6b[_0xa301('0xdc')]({'read':!![]});}else{logger[_0xa301('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa301('0x88'),util['inspect'](_0x2092e5[_0xa301('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa301('0x8e'):if(_0x374343==_0xa301('0xde')||_0x374343=='RECEIVED_BY_RECIPIENT'){return _0x1edb6b[_0xa301('0xdc')]({'read':!![]});}else{logger[_0xa301('0x25')](_0xa301('0x23'),_0xa301('0x2b'),_0xa301('0x8e'),util['inspect'](_0x2092e5['body'],{'showHidden':![],'depth':null}));}break;case _0xa301('0x91'):if(_0x374343==_0xa301('0xdf')){return _0x1edb6b[_0xa301('0xdc')]({'read':!![]});}else{logger[_0xa301('0x25')](_0xa301('0x23'),_0xa301('0x2b'),'bandwidth',util[_0xa301('0xd3')](_0x2092e5[_0xa301('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa301('0x92'):if(_0x374343==='DELIVRD'||_0x374343===_0xa301('0xe0')){return _0x1edb6b['update']({'read':!![]});}else{logger['error'](_0xa301('0x23'),'status','intelepeer',util['inspect'](_0x2092e5[_0xa301('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x1edb6b;}})[_0xa301('0x1e')](respondWithResult(_0x32582e,null))[_0xa301('0x29')](handleError(_0x32582e,null));};exports[_0xa301('0xe1')]=function(_0x1cc2b0,_0xbda4c1,_0x371006){var _0x10a743,_0x403e80,_0x4731c3;return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x1cc2b0[_0xa301('0x54')]['id']}})['then'](handleEntityNotFound(_0xbda4c1,null))[_0xa301('0x1e')](function(_0x1973a6){if(_0x1973a6){_0x4731c3=_0x1973a6;logger[_0xa301('0x22')](_0xa301('0x23'),_0xa301('0x2b'),_0xa301('0xd2'),_0x1973a6[_0xa301('0x3e')],util[_0xa301('0xd3')](_0x1cc2b0[_0xa301('0x41')],{'showHidden':![],'depth':null}));switch(_0x1973a6[_0xa301('0x3e')]){case _0xa301('0x8b'):if(_0x1cc2b0['query'][_0xa301('0xe2')]&&_0x1cc2b0[_0xa301('0x41')][_0xa301('0xe3')]){_0x403e80=_0x1cc2b0[_0xa301('0x41')][_0xa301('0xe3')];return db['SmsMessage'][_0xa301('0x58')]({'where':{'messageId':_0x1cc2b0[_0xa301('0x41')][_0xa301('0xe2')]}});}break;}}})['then'](handleEntityNotFound(_0xbda4c1,null))[_0xa301('0x1e')](function(_0x31caae){if(_0x31caae){_0x10a743=_0x31caae;switch(_0x4731c3[_0xa301('0x3e')]){case _0xa301('0x8b'):if(_0x403e80==='2'||_0x403e80==='6'){return _0x10a743[_0xa301('0xdc')]({'read':!![]});}else{logger[_0xa301('0x25')](_0xa301('0x23'),_0xa301('0x2b'),_0xa301('0x8b'),util[_0xa301('0xd3')](_0x1cc2b0[_0xa301('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x10a743;}})[_0xa301('0x1e')](respondWithResult(_0xbda4c1,null))[_0xa301('0x29')](handleError(_0xbda4c1,null));};exports[_0xa301('0xe4')]=function(_0x143346,_0x47e918,_0x208416){return db['SmsAccount'][_0xa301('0x58')]({'where':{'id':_0x143346[_0xa301('0x54')]['id']}})['then'](handleEntityNotFound(_0x47e918,null))[_0xa301('0x1e')](function(_0x5776ae){if(_0x5776ae){return _0x5776ae[_0xa301('0xe4')](_0x143346[_0xa301('0x5a')][_0xa301('0x67')],_[_0xa301('0x9d')](_0x143346[_0xa301('0x5a')],[_0xa301('0x67'),'id'])||{})['spread'](function(_0x30b0c0){for(var _0x32857a=0x0;_0x32857a<_0x143346[_0xa301('0x5a')][_0xa301('0x67')][_0xa301('0x47')];_0x32857a+=0x1){socket[_0xa301('0xe5')](_0xa301('0xe6'),{'UserId':Number(_0x143346[_0xa301('0x5a')][_0xa301('0x67')][_0x32857a]),'SmsAccountId':Number(_0x143346[_0xa301('0x54')]['id'])});}return _0x30b0c0;});}})[_0xa301('0x1e')](respondWithResult(_0x47e918,null))[_0xa301('0x29')](handleError(_0x47e918,null));};exports[_0xa301('0xe7')]=function(_0x3fd7e5,_0x5800cf,_0x4ac0cd){return db[_0xa301('0x4e')][_0xa301('0x58')]({'where':{'id':_0x3fd7e5[_0xa301('0x54')]['id']}})[_0xa301('0x1e')](handleEntityNotFound(_0x5800cf,null))['then'](function(_0x3737fd){if(_0x3737fd){return _0x3737fd[_0xa301('0xe7')](_0x3fd7e5[_0xa301('0x41')][_0xa301('0x67')])['then'](function(){if(_[_0xa301('0xe8')](_0x3fd7e5[_0xa301('0x41')]['ids'])){for(var _0x5301b2=0x0;_0x5301b2<_0x3fd7e5[_0xa301('0x41')][_0xa301('0x67')][_0xa301('0x47')];_0x5301b2+=0x1){socket[_0xa301('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x3fd7e5[_0xa301('0x41')]['ids'][_0x5301b2]),'SmsAccountId':Number(_0x3fd7e5[_0xa301('0x54')]['id'])});}}else{socket[_0xa301('0xe5')](_0xa301('0xe9'),{'UserId':Number(_0x3fd7e5[_0xa301('0x41')][_0xa301('0x67')]),'SmsAccountId':Number(_0x3fd7e5['params']['id'])});}});}})[_0xa301('0x1e')](respondWithStatusCode(_0x5800cf,null))[_0xa301('0x29')](handleError(_0x5800cf,null));};exports[_0xa301('0xea')]=function(_0x2c199d,_0xb7d824,_0x12eef5){var _0x818d44={};var _0x29d94b={};var _0x217b6b;var _0x51b8ca;return db[_0xa301('0x4e')][_0xa301('0x64')]({'where':{'id':_0x2c199d['params']['id']}})['then'](handleEntityNotFound(_0xb7d824,null))['then'](function(_0x2f71ab){if(_0x2f71ab){_0x217b6b=_0x2f71ab;_0x29d94b[_0xa301('0x40')]=_[_0xa301('0x42')](db[_0xa301('0xc6')][_0xa301('0x56')]);_0x29d94b[_0xa301('0x41')]=_[_0xa301('0x42')](_0x2c199d[_0xa301('0x41')]);_0x29d94b[_0xa301('0x43')]=_[_0xa301('0x44')](_0x29d94b['model'],_0x29d94b[_0xa301('0x41')]);_0x818d44['attributes']=_[_0xa301('0x44')](_0x29d94b[_0xa301('0x40')],qs[_0xa301('0x46')](_0x2c199d[_0xa301('0x41')][_0xa301('0x46')]));_0x818d44['attributes']=_0x818d44[_0xa301('0x45')][_0xa301('0x47')]?_0x818d44[_0xa301('0x45')]:_0x29d94b['model'];_0x818d44[_0xa301('0x65')]=qs[_0xa301('0x49')](_0x2c199d[_0xa301('0x41')]['sort']);_0x818d44[_0xa301('0x4a')]=qs[_0xa301('0x43')](_['pick'](_0x2c199d[_0xa301('0x41')],_0x29d94b['filters']));if(_0x2c199d[_0xa301('0x41')]['filter']){_0x818d44[_0xa301('0x4a')]=_['merge'](_0x818d44[_0xa301('0x4a')],{'$or':_[_0xa301('0x3c')](_0x818d44[_0xa301('0x45')],function(_0x579a4f){var _0x10dbc9={};_0x10dbc9[_0x579a4f]={'$like':'%'+_0x2c199d[_0xa301('0x41')]['filter']+'%'};return _0x10dbc9;})});}_0x818d44=_[_0xa301('0x4c')]({},_0x818d44,_0x2c199d['options']);return _0x217b6b['getAgents'](_0x818d44);}})['then'](function(_0x4668ef){if(_0x4668ef){_0x51b8ca=_0x4668ef[_0xa301('0x47')];if(!_0x2c199d[_0xa301('0x41')]['hasOwnProperty']('nolimit')){_0x818d44[_0xa301('0x30')]=qs[_0xa301('0x30')](_0x2c199d['query'][_0xa301('0x30')]);_0x818d44['offset']=qs[_0xa301('0x2e')](_0x2c199d[_0xa301('0x41')][_0xa301('0x2e')]);}return _0x217b6b[_0xa301('0xea')](_0x818d44);}})[_0xa301('0x1e')](function(_0x2bec2a){if(_0x2bec2a){return _0x2bec2a?{'count':_0x51b8ca,'rows':_0x2bec2a}:null;}})[_0xa301('0x1e')](respondWithResult(_0xb7d824,null))[_0xa301('0x29')](handleError(_0xb7d824,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b776c7c..ba68682 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 _0x56de=['events','SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x56de,0x1b8));var _0xe56d=function(_0x95413e,_0x2dc48f){_0x95413e=_0x95413e-0x0;var _0x4976c1=_0x56de[_0x95413e];return _0x4976c1;};'use strict';var EventEmitter=require(_0xe56d('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xe56d('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe56d('0x2')](0x0);var events={'afterCreate':_0xe56d('0x3'),'afterUpdate':'update','afterDestroy':_0xe56d('0x4')};function emitEvent(_0x3de2ed){return function(_0x23f205,_0x3a7d44,_0x5865bf){SmsAccountEvents[_0xe56d('0x5')](_0x3de2ed+':'+_0x23f205['id'],_0x23f205);SmsAccountEvents[_0xe56d('0x5')](_0x3de2ed,_0x23f205);_0x5865bf(null);};}for(var e in events){if(events[_0xe56d('0x6')](e)){var event=events[e];SmsAccount[_0xe56d('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xe306=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x5a8315,_0x156a41){var _0x42952d=function(_0x3da8ae){while(--_0x3da8ae){_0x5a8315['push'](_0x5a8315['shift']());}};_0x42952d(++_0x156a41);}(_0xe306,0x169));var _0x6e30=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xe306[_0x34bc30];return _0x5706de;};'use strict';var EventEmitter=require(_0x6e30('0x0'));var SmsAccount=require(_0x6e30('0x1'))['db'][_0x6e30('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6e30('0x3')](0x0);var events={'afterCreate':_0x6e30('0x4'),'afterUpdate':_0x6e30('0x5'),'afterDestroy':_0x6e30('0x6')};function emitEvent(_0x9a0c8d){return function(_0x531c68,_0x2380fc,_0x5554cf){SmsAccountEvents['emit'](_0x9a0c8d+':'+_0x531c68['id'],_0x531c68);SmsAccountEvents['emit'](_0x9a0c8d,_0x531c68);_0x5554cf(null);};}for(var e in events){if(events[_0x6e30('0x7')](e)){var event=events[e];SmsAccount[_0x6e30('0x8')](e,emitEvent(event));}}module[_0x6e30('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 60074fc..9a5da4a 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 _0x7ca1=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash','util'];(function(_0x40a775,_0x2f986b){var _0x5950c5=function(_0xeb32a3){while(--_0xeb32a3){_0x40a775['push'](_0x40a775['shift']());}};_0x5950c5(++_0x2f986b);}(_0x7ca1,0xda));var _0x17ca=function(_0x5a5a93,_0x35f60a){_0x5a5a93=_0x5a5a93-0x0;var _0x4393be=_0x7ca1[_0x5a5a93];return _0x4393be;};'use strict';var _=require(_0x17ca('0x0'));var util=require(_0x17ca('0x1'));var logger=require(_0x17ca('0x2'))('api');var moment=require(_0x17ca('0x3'));var BPromise=require(_0x17ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x17ca('0x5'));var config=require(_0x17ca('0x6'));var attributes=require(_0x17ca('0x7'));module[_0x17ca('0x8')]=function(_0x22d11f,_0x60a2ed){return _0x22d11f['define'](_0x17ca('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94e6=['moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','lodash','../../config/logger','api'];(function(_0x458f49,_0x1a1af1){var _0x36e8c9=function(_0x1273cb){while(--_0x1273cb){_0x458f49['push'](_0x458f49['shift']());}};_0x36e8c9(++_0x1a1af1);}(_0x94e6,0x194));var _0x694e=function(_0x3a0687,_0x58591a){_0x3a0687=_0x3a0687-0x0;var _0x3a1f2c=_0x94e6[_0x3a0687];return _0x3a1f2c;};'use strict';var _=require(_0x694e('0x0'));var util=require('util');var logger=require(_0x694e('0x1'))(_0x694e('0x2'));var moment=require(_0x694e('0x3'));var BPromise=require(_0x694e('0x4'));var rp=require(_0x694e('0x5'));var fs=require('fs');var path=require(_0x694e('0x6'));var rimraf=require('rimraf');var config=require(_0x694e('0x7'));var attributes=require(_0x694e('0x8'));module['exports']=function(_0x59abaf,_0x43238f){return _0x59abaf[_0x694e('0x9')](_0x694e('0xa'),attributes,{'tableName':'sms_accounts','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 cf157ed..9071c28 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 _0xd070=['./smsAccount.socket','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','find','options','raw','where','attributes','map','model','include','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost'];(function(_0xcd1036,_0x300dde){var _0x4d4ad8=function(_0x254f7d){while(--_0x254f7d){_0xcd1036['push'](_0xcd1036['shift']());}};_0x4d4ad8(++_0x300dde);}(_0xd070,0xab));var _0x0d07=function(_0x5a8e7c,_0x57f990){_0x5a8e7c=_0x5a8e7c-0x0;var _0x4474ac=_0xd070[_0x5a8e7c];return _0x4474ac;};'use strict';var _=require(_0x0d07('0x0'));var util=require(_0x0d07('0x1'));var moment=require(_0x0d07('0x2'));var BPromise=require(_0x0d07('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require('../../config/logger')(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d07('0x9')][_0x0d07('0xa')]({'port':0x232a});config['redis']=_[_0x0d07('0xb')](config[_0x0d07('0xc')],{'host':_0x0d07('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d07('0xe'))[_0x0d07('0xf')](socket);function respondWithRpcPromise(_0x19415e,_0x3b001,_0x529a92){return new BPromise(function(_0x3b4d70,_0x184cba){return client[_0x0d07('0x10')](_0x19415e,_0x529a92)[_0x0d07('0x11')](function(_0x62d914){logger[_0x0d07('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3b001,_0x0d07('0x13'));logger[_0x0d07('0x14')](_0x0d07('0x15'),_0x3b001,'request\x20sent',JSON['stringify'](_0x62d914));if(_0x62d914[_0x0d07('0x16')]){if(_0x62d914[_0x0d07('0x16')][_0x0d07('0x17')]===0x1f4){logger[_0x0d07('0x16')]('SmsAccount,\x20%s,\x20%s',_0x3b001,_0x62d914[_0x0d07('0x16')]['message']);return _0x184cba(_0x62d914['error'][_0x0d07('0x18')]);}logger[_0x0d07('0x16')](_0x0d07('0x19'),_0x3b001,_0x62d914[_0x0d07('0x16')][_0x0d07('0x18')]);return _0x3b4d70(_0x62d914[_0x0d07('0x16')]['message']);}else{logger[_0x0d07('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3b001,'request\x20sent');_0x3b4d70(_0x62d914[_0x0d07('0x1a')][_0x0d07('0x18')]);}})[_0x0d07('0x1b')](function(_0xa7748d){logger[_0x0d07('0x16')](_0x0d07('0x19'),_0x3b001,_0xa7748d);_0x184cba(_0xa7748d);});});}exports[_0x0d07('0x1c')]=function(_0x453ac1){var _0x3344c4=this;return new Promise(function(_0xc0f8ca,_0x4b6af6){return db['SmsAccount'][_0x0d07('0x1d')]({'raw':_0x453ac1[_0x0d07('0x1e')]?_0x453ac1[_0x0d07('0x1e')][_0x0d07('0x1f')]===undefined?!![]:![]:!![],'where':_0x453ac1[_0x0d07('0x1e')]?_0x453ac1['options'][_0x0d07('0x20')]||null:null,'attributes':_0x453ac1[_0x0d07('0x1e')]?_0x453ac1[_0x0d07('0x1e')][_0x0d07('0x21')]||null:null,'include':_0x453ac1[_0x0d07('0x1e')]?_0x453ac1['options']['include']?_[_0x0d07('0x22')](_0x453ac1['options']['include'],function(_0x2052aa){return{'model':db[_0x2052aa[_0x0d07('0x23')]],'as':_0x2052aa['as'],'attributes':_0x2052aa['attributes'],'include':_0x2052aa[_0x0d07('0x24')]?_['map'](_0x2052aa[_0x0d07('0x24')],function(_0x37e1aa){return{'model':db[_0x37e1aa['model']],'as':_0x37e1aa['as'],'attributes':_0x37e1aa['attributes'],'include':_0x37e1aa[_0x0d07('0x24')]?_[_0x0d07('0x22')](_0x37e1aa[_0x0d07('0x24')],function(_0x1c033f){return{'model':db[_0x1c033f[_0x0d07('0x23')]],'as':_0x1c033f['as'],'attributes':_0x1c033f[_0x0d07('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a1b81){logger[_0x0d07('0x12')](_0x0d07('0x1c'),_0x453ac1);logger['debug'](_0x0d07('0x1c'),_0x453ac1,JSON['stringify'](_0x4a1b81));_0xc0f8ca(_0x4a1b81);})[_0x0d07('0x1b')](function(_0x13b589){logger['error'](_0x0d07('0x1c'),_0x13b589[_0x0d07('0x18')],_0x453ac1);_0x4b6af6(_0x3344c4[_0x0d07('0x16')](0x1f4,_0x13b589[_0x0d07('0x18')]));});});}; \ No newline at end of file +var _0x3414=['attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','info','request\x20sent','result','message','catch','ShowSmsAccount','find','options','where'];(function(_0xa8f16,_0x39c95c){var _0x2ac96b=function(_0xe25313){while(--_0xe25313){_0xa8f16['push'](_0xa8f16['shift']());}};_0x2ac96b(++_0x39c95c);}(_0x3414,0x13f));var _0x4341=function(_0x4951db,_0x392e26){_0x4951db=_0x4951db-0x0;var _0x2ade73=_0x3414[_0x4951db];return _0x2ade73;};'use strict';var _=require(_0x4341('0x0'));var util=require(_0x4341('0x1'));var moment=require('moment');var BPromise=require(_0x4341('0x2'));var rs=require(_0x4341('0x3'));var fs=require('fs');var Redis=require(_0x4341('0x4'));var db=require(_0x4341('0x5'))['db'];var utils=require(_0x4341('0x6'));var logger=require(_0x4341('0x7'))('rpc');var config=require(_0x4341('0x8'));var jayson=require(_0x4341('0x9'));var client=jayson[_0x4341('0xa')][_0x4341('0xb')]({'port':0x232a});config[_0x4341('0xc')]=_[_0x4341('0xd')](config['redis'],{'host':_0x4341('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4341('0xc')]));require(_0x4341('0xf'))[_0x4341('0x10')](socket);function respondWithRpcPromise(_0x1c27ac,_0x179fb2,_0x3b253a){return new BPromise(function(_0x2deadc,_0x429f4d){return client[_0x4341('0x11')](_0x1c27ac,_0x3b253a)['then'](function(_0x4393fa){logger['info'](_0x4341('0x12'),_0x179fb2,'request\x20sent');logger['debug'](_0x4341('0x13'),_0x179fb2,'request\x20sent',JSON[_0x4341('0x14')](_0x4393fa));if(_0x4393fa[_0x4341('0x15')]){if(_0x4393fa[_0x4341('0x15')]['code']===0x1f4){logger['error'](_0x4341('0x12'),_0x179fb2,_0x4393fa[_0x4341('0x15')]['message']);return _0x429f4d(_0x4393fa[_0x4341('0x15')]['message']);}logger[_0x4341('0x15')]('SmsAccount,\x20%s,\x20%s',_0x179fb2,_0x4393fa[_0x4341('0x15')]['message']);return _0x2deadc(_0x4393fa[_0x4341('0x15')]['message']);}else{logger[_0x4341('0x16')](_0x4341('0x12'),_0x179fb2,_0x4341('0x17'));_0x2deadc(_0x4393fa[_0x4341('0x18')][_0x4341('0x19')]);}})[_0x4341('0x1a')](function(_0x4d886c){logger[_0x4341('0x15')](_0x4341('0x12'),_0x179fb2,_0x4d886c);_0x429f4d(_0x4d886c);});});}exports[_0x4341('0x1b')]=function(_0x42e7f5){var _0x3dd15c=this;return new Promise(function(_0x1e30fb,_0x410a3a){return db['SmsAccount'][_0x4341('0x1c')]({'raw':_0x42e7f5[_0x4341('0x1d')]?_0x42e7f5[_0x4341('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x42e7f5[_0x4341('0x1d')]?_0x42e7f5['options'][_0x4341('0x1e')]||null:null,'attributes':_0x42e7f5[_0x4341('0x1d')]?_0x42e7f5[_0x4341('0x1d')][_0x4341('0x1f')]||null:null,'include':_0x42e7f5[_0x4341('0x1d')]?_0x42e7f5[_0x4341('0x1d')]['include']?_['map'](_0x42e7f5[_0x4341('0x1d')][_0x4341('0x20')],function(_0x131587){return{'model':db[_0x131587['model']],'as':_0x131587['as'],'attributes':_0x131587[_0x4341('0x1f')],'include':_0x131587['include']?_[_0x4341('0x21')](_0x131587[_0x4341('0x20')],function(_0x5e8a7d){return{'model':db[_0x5e8a7d[_0x4341('0x22')]],'as':_0x5e8a7d['as'],'attributes':_0x5e8a7d['attributes'],'include':_0x5e8a7d['include']?_[_0x4341('0x21')](_0x5e8a7d[_0x4341('0x20')],function(_0x3afdf8){return{'model':db[_0x3afdf8[_0x4341('0x22')]],'as':_0x3afdf8['as'],'attributes':_0x3afdf8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x26fd3c){logger['info']('ShowSmsAccount',_0x42e7f5);logger['debug'](_0x4341('0x1b'),_0x42e7f5,JSON[_0x4341('0x14')](_0x26fd3c));_0x1e30fb(_0x26fd3c);})[_0x4341('0x1a')](function(_0x15f41d){logger[_0x4341('0x15')](_0x4341('0x1b'),_0x15f41d[_0x4341('0x19')],_0x42e7f5);_0x410a3a(_0x3dd15c['error'](0x1f4,_0x15f41d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7a38af4..6251421 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(_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 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 843218e..de84349 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5a3bb9,_0xe19115){var _0x4afe4d=function(_0x2e6ca4){while(--_0x2e6ca4){_0x5a3bb9['push'](_0x5a3bb9['shift']());}};_0x4afe4d(++_0xe19115);}(_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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0x3e74,0x175));var _0x43e7=function(_0x2f4750,_0x1d81fc){_0x2f4750=_0x2f4750-0x0;var _0x31ce12=_0x3e74[_0x2f4750];return _0x31ce12;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 384f7b5..1d1ac36 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 _0xfa43=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x21080b,_0x4e267e){var _0x59de05=function(_0x3983ac){while(--_0x3983ac){_0x21080b['push'](_0x21080b['shift']());}};_0x59de05(++_0x4e267e);}(_0xfa43,0x19c));var _0x3fa4=function(_0xb0c64,_0x490a3e){_0xb0c64=_0xb0c64-0x0;var _0x501be8=_0xfa43[_0xb0c64];return _0x501be8;};'use strict';var Sequelize=require(_0x3fa4('0x0'));module[_0x3fa4('0x1')]={'priority':{'type':Sequelize[_0x3fa4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3fa4('0x3')],'allowNull':![],'defaultValue':_0x3fa4('0x4')},'appdata':{'type':Sequelize[_0x3fa4('0x5')]()},'description':{'type':Sequelize[_0x3fa4('0x3')]},'interval':{'type':Sequelize[_0x3fa4('0x3')],'defaultValue':_0x3fa4('0x6')}}; \ No newline at end of file +var _0x6179=['sequelize','exports','STRING','TEXT','*,*,*,*'];(function(_0x2d9581,_0x305541){var _0x5ed42f=function(_0x5ae878){while(--_0x5ae878){_0x2d9581['push'](_0x2d9581['shift']());}};_0x5ed42f(++_0x305541);}(_0x6179,0x154));var _0x9617=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x6179[_0x264545];return _0x114d10;};'use strict';var Sequelize=require(_0x9617('0x0'));module[_0x9617('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9617('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9617('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9617('0x2')],'defaultValue':_0x9617('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 21e2bf2..1b6a530 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 _0x6040=['mustache','path','sox','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','SmsApplication','includeAll','findAll','rows','catch','show','params','keys','length','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6040,0x170));var _0x0604=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x6040[_0x13ce0c];return _0x4388fb;};'use strict';var emlformat=require(_0x0604('0x0'));var rimraf=require(_0x0604('0x1'));var zipdir=require(_0x0604('0x2'));var jsonpatch=require(_0x0604('0x3'));var rp=require(_0x0604('0x4'));var moment=require(_0x0604('0x5'));var BPromise=require(_0x0604('0x6'));var Mustache=require(_0x0604('0x7'));var util=require('util');var path=require(_0x0604('0x8'));var sox=require(_0x0604('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0604('0xa'));var squel=require(_0x0604('0xb'));var crypto=require('crypto');var jsforce=require(_0x0604('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0604('0xd'));var querystring=require('querystring');var Papa=require(_0x0604('0xe'));var Redis=require(_0x0604('0xf'));var authService=require(_0x0604('0x10'));var qs=require(_0x0604('0x11'));var as=require(_0x0604('0x12'));var hardwareService=require(_0x0604('0x13'));var logger=require(_0x0604('0x14'))(_0x0604('0x15'));var utils=require(_0x0604('0x16'));var config=require(_0x0604('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0604('0x18'))['db'];function respondWithStatusCode(_0x2071bc,_0x462132){_0x462132=_0x462132||0xcc;return function(_0x4e7bd2){if(_0x4e7bd2){return _0x2071bc[_0x0604('0x19')](_0x462132);}return _0x2071bc['status'](_0x462132)[_0x0604('0x1a')]();};}function respondWithResult(_0x39e16d,_0x511c55){_0x511c55=_0x511c55||0xc8;return function(_0x51eb3b){if(_0x51eb3b){return _0x39e16d[_0x0604('0x1b')](_0x511c55)['json'](_0x51eb3b);}};}function respondWithFilteredResult(_0x39791d,_0x2656ff){return function(_0x451f36){if(_0x451f36){var _0x992899=typeof _0x2656ff[_0x0604('0x1c')]===_0x0604('0x1d')&&typeof _0x2656ff['limit']===_0x0604('0x1d');var _0x32f60e=_0x451f36[_0x0604('0x1e')];var _0x21f2d0=_0x992899?0x0:_0x2656ff['offset'];var _0x5cb162=_0x992899?_0x451f36['count']:_0x2656ff[_0x0604('0x1c')]+_0x2656ff[_0x0604('0x1f')];var _0x11b770;if(_0x5cb162>=_0x32f60e){_0x5cb162=_0x32f60e;_0x11b770=0xc8;}else{_0x11b770=0xce;}_0x39791d['status'](_0x11b770);return _0x39791d[_0x0604('0x20')]('Content-Range',_0x21f2d0+'-'+_0x5cb162+'/'+_0x32f60e)[_0x0604('0x21')](_0x451f36);}return null;};}function patchUpdates(_0x4bc4c2){return function(_0x1b5ad5){try{jsonpatch[_0x0604('0x22')](_0x1b5ad5,_0x4bc4c2,!![]);}catch(_0x511a1e){return BPromise[_0x0604('0x23')](_0x511a1e);}return _0x1b5ad5[_0x0604('0x24')]();};}function saveUpdates(_0x5d125a,_0x83d0f6){return function(_0x1a8e3f){if(_0x1a8e3f){return _0x1a8e3f[_0x0604('0x25')](_0x5d125a)[_0x0604('0x26')](function(_0x49b226){return _0x49b226;});}return null;};}function removeEntity(_0x509d25,_0x564857){return function(_0x15ec8e){if(_0x15ec8e){return _0x15ec8e['destroy']()[_0x0604('0x26')](function(){_0x509d25[_0x0604('0x1b')](0xcc)[_0x0604('0x1a')]();});}};}function handleEntityNotFound(_0x2977f5,_0x5dd835){return function(_0x1ead09){if(!_0x1ead09){_0x2977f5['sendStatus'](0x194);}return _0x1ead09;};}function handleError(_0x2debed,_0x609f2e){_0x609f2e=_0x609f2e||0x1f4;return function(_0x252a3e){logger[_0x0604('0x27')](_0x252a3e[_0x0604('0x28')]);if(_0x252a3e['name']){delete _0x252a3e[_0x0604('0x29')];}_0x2debed[_0x0604('0x1b')](_0x609f2e)[_0x0604('0x2a')](_0x252a3e);};}exports[_0x0604('0x2b')]=function(_0x5875d7,_0x471558){var _0x1cb5df={},_0x2bfab7={},_0x509688={'count':0x0,'rows':[]};var _0x5a3a73=_[_0x0604('0x2c')](db['SmsApplication'][_0x0604('0x2d')],function(_0x80f1c9){return{'name':_0x80f1c9[_0x0604('0x2e')],'type':_0x80f1c9[_0x0604('0x2f')]['key']};});_0x2bfab7[_0x0604('0x30')]=_[_0x0604('0x2c')](_0x5a3a73,_0x0604('0x29'));_0x2bfab7[_0x0604('0x31')]=_['keys'](_0x5875d7['query']);_0x2bfab7[_0x0604('0x32')]=_['intersection'](_0x2bfab7[_0x0604('0x30')],_0x2bfab7[_0x0604('0x31')]);_0x1cb5df[_0x0604('0x33')]=_[_0x0604('0x34')](_0x2bfab7[_0x0604('0x30')],qs['fields'](_0x5875d7[_0x0604('0x31')][_0x0604('0x35')]));_0x1cb5df[_0x0604('0x33')]=_0x1cb5df[_0x0604('0x33')]['length']?_0x1cb5df[_0x0604('0x33')]:_0x2bfab7[_0x0604('0x30')];if(!_0x5875d7['query'][_0x0604('0x36')](_0x0604('0x37'))){_0x1cb5df[_0x0604('0x1f')]=qs[_0x0604('0x1f')](_0x5875d7[_0x0604('0x31')][_0x0604('0x1f')]);_0x1cb5df['offset']=qs['offset'](_0x5875d7[_0x0604('0x31')][_0x0604('0x1c')]);}_0x1cb5df[_0x0604('0x38')]=qs[_0x0604('0x39')](_0x5875d7[_0x0604('0x31')][_0x0604('0x39')]);_0x1cb5df['where']=qs[_0x0604('0x32')](_['pick'](_0x5875d7['query'],_0x2bfab7[_0x0604('0x32')]),_0x5a3a73);if(_0x5875d7[_0x0604('0x31')][_0x0604('0x3a')]){_0x1cb5df[_0x0604('0x3b')]=_[_0x0604('0x3c')](_0x1cb5df[_0x0604('0x3b')],{'$or':_['map'](_0x5a3a73,function(_0x1a26e4){if(_0x1a26e4[_0x0604('0x2f')]!=='VIRTUAL'){var _0x1a57e3={};_0x1a57e3[_0x1a26e4[_0x0604('0x29')]]={'$like':'%'+_0x5875d7[_0x0604('0x31')][_0x0604('0x3a')]+'%'};return _0x1a57e3;}})});}_0x1cb5df=_['merge']({},_0x1cb5df,_0x5875d7['options']);var _0xdd2264={'where':_0x1cb5df[_0x0604('0x3b')]};return db[_0x0604('0x3d')][_0x0604('0x1e')](_0xdd2264)[_0x0604('0x26')](function(_0x43131b){_0x509688[_0x0604('0x1e')]=_0x43131b;if(_0x5875d7[_0x0604('0x31')][_0x0604('0x3e')]){_0x1cb5df['include']=[{'all':!![]}];}return db[_0x0604('0x3d')][_0x0604('0x3f')](_0x1cb5df);})[_0x0604('0x26')](function(_0x220fd3){_0x509688[_0x0604('0x40')]=_0x220fd3;return _0x509688;})[_0x0604('0x26')](respondWithFilteredResult(_0x471558,_0x1cb5df))[_0x0604('0x41')](handleError(_0x471558,null));};exports[_0x0604('0x42')]=function(_0x4476d2,_0x462231){var _0x3871e2={'raw':!![],'where':{'id':_0x4476d2[_0x0604('0x43')]['id']}},_0x173944={};_0x173944['model']=_[_0x0604('0x44')](db['SmsApplication'][_0x0604('0x2d')]);_0x173944['query']=_[_0x0604('0x44')](_0x4476d2[_0x0604('0x31')]);_0x173944[_0x0604('0x32')]=_[_0x0604('0x34')](_0x173944['model'],_0x173944[_0x0604('0x31')]);_0x3871e2[_0x0604('0x33')]=_['intersection'](_0x173944[_0x0604('0x30')],qs[_0x0604('0x35')](_0x4476d2['query'][_0x0604('0x35')]));_0x3871e2[_0x0604('0x33')]=_0x3871e2[_0x0604('0x33')][_0x0604('0x45')]?_0x3871e2[_0x0604('0x33')]:_0x173944[_0x0604('0x30')];if(_0x4476d2[_0x0604('0x31')]['includeAll']){_0x3871e2['include']=[{'all':!![]}];}_0x3871e2=_[_0x0604('0x3c')]({},_0x3871e2,_0x4476d2[_0x0604('0x46')]);return db['SmsApplication'][_0x0604('0x47')](_0x3871e2)[_0x0604('0x26')](handleEntityNotFound(_0x462231,null))[_0x0604('0x26')](respondWithResult(_0x462231,null))[_0x0604('0x41')](handleError(_0x462231,null));};exports[_0x0604('0x48')]=function(_0x4e6503,_0x57b2c3){return db['SmsApplication']['create'](_0x4e6503[_0x0604('0x49')],{})[_0x0604('0x26')](respondWithResult(_0x57b2c3,0xc9))['catch'](handleError(_0x57b2c3,null));};exports[_0x0604('0x25')]=function(_0x247b92,_0x43fbbc){if(_0x247b92[_0x0604('0x49')]['id']){delete _0x247b92[_0x0604('0x49')]['id'];}return db[_0x0604('0x3d')][_0x0604('0x47')]({'where':{'id':_0x247b92[_0x0604('0x43')]['id']}})[_0x0604('0x26')](handleEntityNotFound(_0x43fbbc,null))[_0x0604('0x26')](saveUpdates(_0x247b92[_0x0604('0x49')],null))[_0x0604('0x26')](respondWithResult(_0x43fbbc,null))[_0x0604('0x41')](handleError(_0x43fbbc,null));};exports[_0x0604('0x4a')]=function(_0x4da7a3,_0x3385e6){return db[_0x0604('0x3d')][_0x0604('0x47')]({'where':{'id':_0x4da7a3[_0x0604('0x43')]['id']}})[_0x0604('0x26')](handleEntityNotFound(_0x3385e6,null))['then'](removeEntity(_0x3385e6,null))[_0x0604('0x41')](handleError(_0x3385e6,null));}; \ No newline at end of file +var _0xdc7f=['catch','find','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','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','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','save','update','then','destroy','sendStatus','stack','name','send','index','SmsApplication','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','filters','create','body'];(function(_0x3a3d20,_0x244316){var _0x33bc94=function(_0x215ba9){while(--_0x215ba9){_0x3a3d20['push'](_0x3a3d20['shift']());}};_0x33bc94(++_0x244316);}(_0xdc7f,0x122));var _0xfdc7=function(_0x170b20,_0x49fc52){_0x170b20=_0x170b20-0x0;var _0xbe0395=_0xdc7f[_0x170b20];return _0xbe0395;};'use strict';var emlformat=require(_0xfdc7('0x0'));var rimraf=require(_0xfdc7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdc7('0x2'));var rp=require(_0xfdc7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfdc7('0x4'));var path=require('path');var sox=require(_0xfdc7('0x5'));var csv=require(_0xfdc7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfdc7('0x7'));var _=require(_0xfdc7('0x8'));var squel=require('squel');var crypto=require(_0xfdc7('0x9'));var jsforce=require(_0xfdc7('0xa'));var deskjs=require(_0xfdc7('0xb'));var toCsv=require(_0xfdc7('0x6'));var querystring=require(_0xfdc7('0xc'));var Papa=require(_0xfdc7('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfdc7('0xe'));var as=require(_0xfdc7('0xf'));var hardwareService=require(_0xfdc7('0x10'));var logger=require(_0xfdc7('0x11'))(_0xfdc7('0x12'));var utils=require(_0xfdc7('0x13'));var config=require(_0xfdc7('0x14'));var licenseUtil=require(_0xfdc7('0x15'));var db=require(_0xfdc7('0x16'))['db'];function respondWithStatusCode(_0x2d7c08,_0x2a2042){_0x2a2042=_0x2a2042||0xcc;return function(_0x5a0b89){if(_0x5a0b89){return _0x2d7c08['sendStatus'](_0x2a2042);}return _0x2d7c08[_0xfdc7('0x17')](_0x2a2042)[_0xfdc7('0x18')]();};}function respondWithResult(_0x1f7c90,_0x47ca2f){_0x47ca2f=_0x47ca2f||0xc8;return function(_0x23fff3){if(_0x23fff3){return _0x1f7c90[_0xfdc7('0x17')](_0x47ca2f)[_0xfdc7('0x19')](_0x23fff3);}};}function respondWithFilteredResult(_0x42522f,_0x2ee352){return function(_0x2aaeb4){if(_0x2aaeb4){var _0x5dea86=typeof _0x2ee352[_0xfdc7('0x1a')]===_0xfdc7('0x1b')&&typeof _0x2ee352[_0xfdc7('0x1c')]===_0xfdc7('0x1b');var _0x5ae286=_0x2aaeb4['count'];var _0x59641b=_0x5dea86?0x0:_0x2ee352[_0xfdc7('0x1a')];var _0x2c8ad7=_0x5dea86?_0x2aaeb4['count']:_0x2ee352[_0xfdc7('0x1a')]+_0x2ee352[_0xfdc7('0x1c')];var _0x583572;if(_0x2c8ad7>=_0x5ae286){_0x2c8ad7=_0x5ae286;_0x583572=0xc8;}else{_0x583572=0xce;}_0x42522f['status'](_0x583572);return _0x42522f[_0xfdc7('0x1d')]('Content-Range',_0x59641b+'-'+_0x2c8ad7+'/'+_0x5ae286)['json'](_0x2aaeb4);}return null;};}function patchUpdates(_0x1a8caa){return function(_0x538e35){try{jsonpatch[_0xfdc7('0x1e')](_0x538e35,_0x1a8caa,!![]);}catch(_0x151f81){return BPromise['reject'](_0x151f81);}return _0x538e35[_0xfdc7('0x1f')]();};}function saveUpdates(_0x495c26,_0x47a9e3){return function(_0x3f772c){if(_0x3f772c){return _0x3f772c[_0xfdc7('0x20')](_0x495c26)[_0xfdc7('0x21')](function(_0x4e5b88){return _0x4e5b88;});}return null;};}function removeEntity(_0x5f0ba1,_0x49cf96){return function(_0x5cb7e4){if(_0x5cb7e4){return _0x5cb7e4[_0xfdc7('0x22')]()[_0xfdc7('0x21')](function(){_0x5f0ba1['status'](0xcc)[_0xfdc7('0x18')]();});}};}function handleEntityNotFound(_0x214d33,_0x540e99){return function(_0x18c5bf){if(!_0x18c5bf){_0x214d33[_0xfdc7('0x23')](0x194);}return _0x18c5bf;};}function handleError(_0x20ba96,_0x828dbe){_0x828dbe=_0x828dbe||0x1f4;return function(_0x262131){logger['error'](_0x262131[_0xfdc7('0x24')]);if(_0x262131[_0xfdc7('0x25')]){delete _0x262131[_0xfdc7('0x25')];}_0x20ba96['status'](_0x828dbe)[_0xfdc7('0x26')](_0x262131);};}exports[_0xfdc7('0x27')]=function(_0x5976cc,_0x2b0563){var _0x29a28d={},_0x2c102f={},_0x33131d={'count':0x0,'rows':[]};var _0xbaa26a=_['map'](db[_0xfdc7('0x28')][_0xfdc7('0x29')],function(_0x3b2497){return{'name':_0x3b2497[_0xfdc7('0x2a')],'type':_0x3b2497['type'][_0xfdc7('0x2b')]};});_0x2c102f[_0xfdc7('0x2c')]=_[_0xfdc7('0x2d')](_0xbaa26a,'name');_0x2c102f[_0xfdc7('0x2e')]=_[_0xfdc7('0x2f')](_0x5976cc['query']);_0x2c102f['filters']=_[_0xfdc7('0x30')](_0x2c102f[_0xfdc7('0x2c')],_0x2c102f[_0xfdc7('0x2e')]);_0x29a28d[_0xfdc7('0x31')]=_[_0xfdc7('0x30')](_0x2c102f[_0xfdc7('0x2c')],qs[_0xfdc7('0x32')](_0x5976cc[_0xfdc7('0x2e')][_0xfdc7('0x32')]));_0x29a28d[_0xfdc7('0x31')]=_0x29a28d[_0xfdc7('0x31')][_0xfdc7('0x33')]?_0x29a28d[_0xfdc7('0x31')]:_0x2c102f[_0xfdc7('0x2c')];if(!_0x5976cc['query'][_0xfdc7('0x34')](_0xfdc7('0x35'))){_0x29a28d[_0xfdc7('0x1c')]=qs['limit'](_0x5976cc[_0xfdc7('0x2e')][_0xfdc7('0x1c')]);_0x29a28d['offset']=qs[_0xfdc7('0x1a')](_0x5976cc[_0xfdc7('0x2e')]['offset']);}_0x29a28d[_0xfdc7('0x36')]=qs['sort'](_0x5976cc[_0xfdc7('0x2e')][_0xfdc7('0x37')]);_0x29a28d[_0xfdc7('0x38')]=qs['filters'](_[_0xfdc7('0x39')](_0x5976cc[_0xfdc7('0x2e')],_0x2c102f['filters']),_0xbaa26a);if(_0x5976cc['query']['filter']){_0x29a28d[_0xfdc7('0x38')]=_[_0xfdc7('0x3a')](_0x29a28d[_0xfdc7('0x38')],{'$or':_[_0xfdc7('0x2d')](_0xbaa26a,function(_0x289e06){if(_0x289e06['type']!==_0xfdc7('0x3b')){var _0x186671={};_0x186671[_0x289e06[_0xfdc7('0x25')]]={'$like':'%'+_0x5976cc[_0xfdc7('0x2e')]['filter']+'%'};return _0x186671;}})});}_0x29a28d=_[_0xfdc7('0x3a')]({},_0x29a28d,_0x5976cc[_0xfdc7('0x3c')]);var _0x2077c5={'where':_0x29a28d[_0xfdc7('0x38')]};return db[_0xfdc7('0x28')][_0xfdc7('0x3d')](_0x2077c5)[_0xfdc7('0x21')](function(_0x22530a){_0x33131d[_0xfdc7('0x3d')]=_0x22530a;if(_0x5976cc[_0xfdc7('0x2e')][_0xfdc7('0x3e')]){_0x29a28d[_0xfdc7('0x3f')]=[{'all':!![]}];}return db[_0xfdc7('0x28')][_0xfdc7('0x40')](_0x29a28d);})[_0xfdc7('0x21')](function(_0x214486){_0x33131d['rows']=_0x214486;return _0x33131d;})[_0xfdc7('0x21')](respondWithFilteredResult(_0x2b0563,_0x29a28d))['catch'](handleError(_0x2b0563,null));};exports[_0xfdc7('0x41')]=function(_0x501859,_0x283440){var _0x5cde9e={'raw':!![],'where':{'id':_0x501859[_0xfdc7('0x42')]['id']}},_0x2f6188={};_0x2f6188[_0xfdc7('0x2c')]=_['keys'](db['SmsApplication'][_0xfdc7('0x29')]);_0x2f6188[_0xfdc7('0x2e')]=_[_0xfdc7('0x2f')](_0x501859['query']);_0x2f6188[_0xfdc7('0x43')]=_[_0xfdc7('0x30')](_0x2f6188[_0xfdc7('0x2c')],_0x2f6188['query']);_0x5cde9e['attributes']=_[_0xfdc7('0x30')](_0x2f6188['model'],qs[_0xfdc7('0x32')](_0x501859[_0xfdc7('0x2e')][_0xfdc7('0x32')]));_0x5cde9e[_0xfdc7('0x31')]=_0x5cde9e[_0xfdc7('0x31')][_0xfdc7('0x33')]?_0x5cde9e['attributes']:_0x2f6188[_0xfdc7('0x2c')];if(_0x501859[_0xfdc7('0x2e')][_0xfdc7('0x3e')]){_0x5cde9e[_0xfdc7('0x3f')]=[{'all':!![]}];}_0x5cde9e=_[_0xfdc7('0x3a')]({},_0x5cde9e,_0x501859[_0xfdc7('0x3c')]);return db['SmsApplication']['find'](_0x5cde9e)['then'](handleEntityNotFound(_0x283440,null))[_0xfdc7('0x21')](respondWithResult(_0x283440,null))['catch'](handleError(_0x283440,null));};exports['create']=function(_0x18aa91,_0x1b8e87){return db[_0xfdc7('0x28')][_0xfdc7('0x44')](_0x18aa91[_0xfdc7('0x45')],{})['then'](respondWithResult(_0x1b8e87,0xc9))[_0xfdc7('0x46')](handleError(_0x1b8e87,null));};exports[_0xfdc7('0x20')]=function(_0x2d30b4,_0x15a569){if(_0x2d30b4[_0xfdc7('0x45')]['id']){delete _0x2d30b4[_0xfdc7('0x45')]['id'];}return db[_0xfdc7('0x28')][_0xfdc7('0x47')]({'where':{'id':_0x2d30b4[_0xfdc7('0x42')]['id']}})['then'](handleEntityNotFound(_0x15a569,null))[_0xfdc7('0x21')](saveUpdates(_0x2d30b4['body'],null))[_0xfdc7('0x21')](respondWithResult(_0x15a569,null))['catch'](handleError(_0x15a569,null));};exports[_0xfdc7('0x22')]=function(_0x8b1303,_0x947916){return db[_0xfdc7('0x28')][_0xfdc7('0x47')]({'where':{'id':_0x8b1303[_0xfdc7('0x42')]['id']}})[_0xfdc7('0x21')](handleEntityNotFound(_0x947916,null))['then'](removeEntity(_0x947916,null))[_0xfdc7('0x46')](handleError(_0x947916,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b9b8620..65d0a31 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 _0x32c2=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x477873,_0x56864d){var _0x40cb30=function(_0x3302d2){while(--_0x3302d2){_0x477873['push'](_0x477873['shift']());}};_0x40cb30(++_0x56864d);}(_0x32c2,0x90));var _0x232c=function(_0x54420e,_0x19d678){_0x54420e=_0x54420e-0x0;var _0x54c4ef=_0x32c2[_0x54420e];return _0x54c4ef;};'use strict';var _=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var logger=require(_0x232c('0x2'))(_0x232c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x232c('0x4'));var rimraf=require('rimraf');var config=require(_0x232c('0x5'));var attributes=require(_0x232c('0x6'));module[_0x232c('0x7')]=function(_0xa72963,_0x15375d){return _0xa72963[_0x232c('0x8')](_0x232c('0x9'),attributes,{'tableName':_0x232c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x232c('0xb'),'collate':_0x232c('0xc')});}; \ No newline at end of file +var _0x18fe=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash'];(function(_0x310daf,_0x5a8b0b){var _0x557df5=function(_0x30fa99){while(--_0x30fa99){_0x310daf['push'](_0x310daf['shift']());}};_0x557df5(++_0x5a8b0b);}(_0x18fe,0x13a));var _0xe18f=function(_0xb7da3a,_0x457c8a){_0xb7da3a=_0xb7da3a-0x0;var _0xbe5362=_0x18fe[_0xb7da3a];return _0xbe5362;};'use strict';var _=require(_0xe18f('0x0'));var util=require(_0xe18f('0x1'));var logger=require(_0xe18f('0x2'))(_0xe18f('0x3'));var moment=require(_0xe18f('0x4'));var BPromise=require(_0xe18f('0x5'));var rp=require(_0xe18f('0x6'));var fs=require('fs');var path=require(_0xe18f('0x7'));var rimraf=require(_0xe18f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe18f('0x9'));module[_0xe18f('0xa')]=function(_0x5ba26c,_0x227062){return _0x5ba26c[_0xe18f('0xb')](_0xe18f('0xc'),attributes,{'tableName':_0xe18f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe18f('0xe'),'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 319b679..8762e7b 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 _0x5bc1=['jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x24a822,_0x1bc633){var _0x43a04b=function(_0x751190){while(--_0x751190){_0x24a822['push'](_0x24a822['shift']());}};_0x43a04b(++_0x1bc633);}(_0x5bc1,0xb5));var _0x15bc=function(_0x137fdc,_0x350ef5){_0x137fdc=_0x137fdc-0x0;var _0x4594b8=_0x5bc1[_0x137fdc];return _0x4594b8;};'use strict';var _=require('lodash');var util=require(_0x15bc('0x0'));var moment=require(_0x15bc('0x1'));var BPromise=require(_0x15bc('0x2'));var rs=require(_0x15bc('0x3'));var fs=require('fs');var Redis=require(_0x15bc('0x4'));var db=require(_0x15bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x15bc('0x6'));var config=require(_0x15bc('0x7'));var jayson=require(_0x15bc('0x8'));var client=jayson['client'][_0x15bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x483c6d,_0x344121,_0x3eff99){return new BPromise(function(_0x44f66d,_0x382bd9){return client[_0x15bc('0xa')](_0x483c6d,_0x3eff99)[_0x15bc('0xb')](function(_0x2bc60a){logger[_0x15bc('0xc')](_0x15bc('0xd'),_0x344121,_0x15bc('0xe'));logger['debug'](_0x15bc('0xf'),_0x344121,_0x15bc('0xe'),JSON[_0x15bc('0x10')](_0x2bc60a));if(_0x2bc60a['error']){if(_0x2bc60a[_0x15bc('0x11')][_0x15bc('0x12')]===0x1f4){logger[_0x15bc('0x11')](_0x15bc('0xd'),_0x344121,_0x2bc60a['error'][_0x15bc('0x13')]);return _0x382bd9(_0x2bc60a[_0x15bc('0x11')][_0x15bc('0x13')]);}logger[_0x15bc('0x11')](_0x15bc('0xd'),_0x344121,_0x2bc60a[_0x15bc('0x11')][_0x15bc('0x13')]);return _0x44f66d(_0x2bc60a[_0x15bc('0x11')][_0x15bc('0x13')]);}else{logger[_0x15bc('0xc')](_0x15bc('0xd'),_0x344121,_0x15bc('0xe'));_0x44f66d(_0x2bc60a[_0x15bc('0x14')][_0x15bc('0x13')]);}})['catch'](function(_0x2a9b3b){logger[_0x15bc('0x11')](_0x15bc('0xd'),_0x344121,_0x2a9b3b);_0x382bd9(_0x2a9b3b);});});} \ No newline at end of file +var _0x8952=['SmsApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x12bc0d,_0x1e40ca){var _0x18cf40=function(_0x7517e4){while(--_0x7517e4){_0x12bc0d['push'](_0x12bc0d['shift']());}};_0x18cf40(++_0x1e40ca);}(_0x8952,0x17e));var _0x2895=function(_0x5e2110,_0x289e7e){_0x5e2110=_0x5e2110-0x0;var _0x396efd=_0x8952[_0x5e2110];return _0x396efd;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('SmsApplication,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index e8ae6a4..fd04ee8 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 _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x54c238,_0x126f3a){var _0x2edef5=function(_0x2f2f82){while(--_0x2f2f82){_0x54c238['push'](_0x54c238['shift']());}};_0x2edef5(++_0x126f3a);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file +var _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x237637,_0x44f4e2){var _0x331127=function(_0x33c23d){while(--_0x33c23d){_0x237637['push'](_0x237637['shift']());}};_0x331127(++_0x44f4e2);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 4635929..925b7a5 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 _0x45d8=['DATE','STRING','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x461613,_0x357dd2){var _0x1338d6=function(_0x46c881){while(--_0x46c881){_0x461613['push'](_0x461613['shift']());}};_0x1338d6(++_0x357dd2);}(_0x45d8,0x174));var _0x845d=function(_0x5857a7,_0x3f8601){_0x5857a7=_0x5857a7-0x0;var _0x2c35e4=_0x45d8[_0x5857a7];return _0x2c35e4;};'use strict';var Sequelize=require(_0x845d('0x0'));var moment=require(_0x845d('0x1'));module[_0x845d('0x2')]={'closed':{'type':Sequelize[_0x845d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x845d('0x4')]},'disposition':{'type':Sequelize[_0x845d('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x845d('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x845d('0x5')]},'read1stAt':{'type':Sequelize[_0x845d('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x845d('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x845d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x845d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x845d('0x7')]}}; \ No newline at end of file +var _0x419f=['DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0xb6332d,_0x11c531){var _0x799da9=function(_0x1e5308){while(--_0x1e5308){_0xb6332d['push'](_0xb6332d['shift']());}};_0x799da9(++_0x11c531);}(_0x419f,0x176));var _0xf419=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x419f[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xf419('0x0'));var moment=require(_0xf419('0x1'));module[_0xf419('0x2')]={'closed':{'type':Sequelize[_0xf419('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf419('0x4')]},'disposition':{'type':Sequelize[_0xf419('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf419('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf419('0x5')]},'read1stAt':{'type':Sequelize[_0xf419('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf419('0x6')]('in',_0xf419('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf419('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf419('0x6')]('in',_0xf419('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf419('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf419('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b4a9215..dfc35b0 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 _0x10f3=['SmsMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','where','count','rows','addTags','setTags','spread','Tag','color','removeTags','download','unix','toString','root','files','tmp','join','User','fullname','firstName','lastName','Messages','direction','secret','read','SmsAccount','Account','push','Owner','get','Sms','N.A.','createdAt','closedAt','disposition','System','Contact','out','value','renderFile','server','views','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','Content-Range','then','error','name','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','user','catch','show','params','keys','query','filters','model','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','update','destroy','describe'];(function(_0x3b86df,_0x4111f1){var _0x21a1c5=function(_0x592dc5){while(--_0x592dc5){_0x3b86df['push'](_0x3b86df['shift']());}};_0x21a1c5(++_0x4111f1);}(_0x10f3,0xb1));var _0x310f=function(_0x433fed,_0x33e872){_0x433fed=_0x433fed-0x0;var _0x435cab=_0x10f3[_0x433fed];return _0x435cab;};'use strict';var rimraf=require(_0x310f('0x0'));var zipdir=require(_0x310f('0x1'));var moment=require(_0x310f('0x2'));var BPromise=require(_0x310f('0x3'));var util=require(_0x310f('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x310f('0x5'));var Redis=require('ioredis');var interaction=require(_0x310f('0x6'));var qs=require(_0x310f('0x7'));var pdf=require(_0x310f('0x8'));var logger=require(_0x310f('0x9'))('api');var config=require(_0x310f('0xa'));var db=require(_0x310f('0xb'))['db'];config['redis']=_[_0x310f('0xc')](config[_0x310f('0xd')],{'host':_0x310f('0xe'),'port':0x18eb});var socket=require(_0x310f('0xf'))(new Redis(config['redis']));require(_0x310f('0x10'))[_0x310f('0x11')](socket);function respondWithStatusCode(_0x4f3f14,_0x1235f1){_0x1235f1=_0x1235f1||0xcc;return function(_0x20b162){if(_0x20b162){return _0x4f3f14[_0x310f('0x12')](_0x1235f1);}return _0x4f3f14[_0x310f('0x13')](_0x1235f1)[_0x310f('0x14')]();};}function respondWithResult(_0x47fd2d,_0x1582d9){_0x1582d9=_0x1582d9||0xc8;return function(_0x2c328c){if(_0x2c328c){return _0x47fd2d[_0x310f('0x13')](_0x1582d9)[_0x310f('0x15')](_0x2c328c);}};}function respondWithFilteredResult(_0x4701e5,_0x554d42){return function(_0x1b4d2f){if(_0x1b4d2f){var _0x15291e=typeof _0x554d42['offset']===_0x310f('0x16')&&typeof _0x554d42[_0x310f('0x17')]==='undefined';var _0x2ba381=_0x1b4d2f['count'];var _0x51a4a2=_0x15291e?0x0:_0x554d42['offset'];var _0x145011=_0x15291e?_0x1b4d2f['count']:_0x554d42[_0x310f('0x18')]+_0x554d42['limit'];var _0x2927cf;if(_0x145011>=_0x2ba381){_0x145011=_0x2ba381;_0x2927cf=0xc8;}else{_0x2927cf=0xce;}_0x4701e5[_0x310f('0x13')](_0x2927cf);return _0x4701e5['set'](_0x310f('0x19'),_0x51a4a2+'-'+_0x145011+'/'+_0x2ba381)[_0x310f('0x15')](_0x1b4d2f);}return null;};}function saveUpdates(_0xdeabb5){return function(_0x44f395){if(_0x44f395){return _0x44f395['update'](_0xdeabb5)['then'](function(_0x4dbb9b){return _0x4dbb9b;});}return null;};}function removeEntity(_0x24f655){return function(_0x4491db){if(_0x4491db){return _0x4491db['destroy']()[_0x310f('0x1a')](function(){_0x24f655[_0x310f('0x13')](0xcc)[_0x310f('0x14')]();});}};}function handleEntityNotFound(_0xe7cf4a){return function(_0x52db69){if(!_0x52db69){_0xe7cf4a[_0x310f('0x12')](0x194);}return _0x52db69;};}function handleError(_0x240149,_0x10fadd){_0x10fadd=_0x10fadd||0x1f4;return function(_0x1170e5){logger[_0x310f('0x1b')](_0x1170e5['stack']);if(_0x1170e5[_0x310f('0x1c')]){delete _0x1170e5['name'];}_0x240149['status'](_0x10fadd)['send'](_0x1170e5);};}exports[_0x310f('0x1d')]=function(_0x224131,_0x6b5168){var _0x4ee1e7={};var _0x21c232=_[_0x310f('0x1e')](db[_0x310f('0x1f')][_0x310f('0x20')],function(_0xd721a4){return{'name':_0xd721a4[_0x310f('0x21')],'type':_0xd721a4[_0x310f('0x22')]['key']};});_0x4ee1e7=qs[_0x310f('0x23')](_0x21c232,_0x224131);return interaction[_0x310f('0x24')](_0x310f('0x25'),_0x224131['query'],_0x224131[_0x310f('0x26')],_0x4ee1e7,_0x21c232)['then'](respondWithFilteredResult(_0x6b5168,_0x4ee1e7))[_0x310f('0x27')](handleError(_0x6b5168,null));};exports[_0x310f('0x28')]=function(_0x864b1d,_0x1e2dc1){var _0x2a6d50={'raw':![],'where':{'id':_0x864b1d[_0x310f('0x29')]['id']}},_0x1fc920={};_0x1fc920['model']=_[_0x310f('0x2a')](db[_0x310f('0x1f')][_0x310f('0x20')]);_0x1fc920[_0x310f('0x2b')]=_['keys'](_0x864b1d['query']);_0x1fc920[_0x310f('0x2c')]=_['intersection'](_0x1fc920[_0x310f('0x2d')],_0x1fc920['query']);_0x2a6d50[_0x310f('0x2e')]=_[_0x310f('0x2f')](_0x1fc920[_0x310f('0x2d')],qs['fields'](_0x864b1d[_0x310f('0x2b')][_0x310f('0x30')]));_0x2a6d50[_0x310f('0x2e')]=_0x2a6d50[_0x310f('0x2e')][_0x310f('0x31')]?_0x2a6d50[_0x310f('0x2e')]:_0x1fc920[_0x310f('0x2d')];if(_0x864b1d['query'][_0x310f('0x32')]){_0x2a6d50['include']=[{'all':!![]}];}_0x2a6d50=_[_0x310f('0x33')]({},_0x2a6d50,_0x864b1d[_0x310f('0x34')]);return db[_0x310f('0x1f')][_0x310f('0x35')](_0x2a6d50)[_0x310f('0x1a')](handleEntityNotFound(_0x1e2dc1,null))['then'](respondWithResult(_0x1e2dc1,null))[_0x310f('0x27')](handleError(_0x1e2dc1,null));};exports[_0x310f('0x36')]=function(_0x48b9c7,_0x1d5509){return db[_0x310f('0x1f')][_0x310f('0x36')](_0x48b9c7[_0x310f('0x37')],{})[_0x310f('0x1a')](respondWithResult(_0x1d5509,0xc9))[_0x310f('0x27')](handleError(_0x1d5509,null));};exports[_0x310f('0x38')]=function(_0x7beb80,_0x40f3d7){if(_0x7beb80[_0x310f('0x37')]['id']){delete _0x7beb80[_0x310f('0x37')]['id'];}return db[_0x310f('0x1f')][_0x310f('0x35')]({'where':{'id':_0x7beb80['params']['id']}})[_0x310f('0x1a')](handleEntityNotFound(_0x40f3d7,null))[_0x310f('0x1a')](saveUpdates(_0x7beb80[_0x310f('0x37')],null))[_0x310f('0x1a')](respondWithResult(_0x40f3d7,null))[_0x310f('0x27')](handleError(_0x40f3d7,null));};exports[_0x310f('0x39')]=function(_0x45688c,_0x45b1c1){return db[_0x310f('0x1f')]['find']({'where':{'id':_0x45688c['params']['id']}})['then'](handleEntityNotFound(_0x45b1c1,null))[_0x310f('0x1a')](removeEntity(_0x45b1c1,null))['catch'](handleError(_0x45b1c1,null));};exports[_0x310f('0x3a')]=function(_0x506c0d,_0x4d11a0){return db[_0x310f('0x1f')][_0x310f('0x3a')]()['then'](respondWithResult(_0x4d11a0,null))[_0x310f('0x27')](handleError(_0x4d11a0,null));};exports['addMessage']=function(_0x2ed3af,_0x2d772d){return db[_0x310f('0x3b')][_0x310f('0x35')]({'where':{'id':_0x2ed3af[_0x310f('0x29')]['id']}})['then'](handleEntityNotFound(_0x2d772d,null))['then'](function(_0x43867c){if(_0x43867c){return _0x43867c[_0x310f('0x3c')](_0x2ed3af[_0x310f('0x37')][_0x310f('0x3d')],_[_0x310f('0x3e')](_0x2ed3af['body'],['ids','id'])||{});}})[_0x310f('0x1a')](respondWithResult(_0x2d772d,null))['catch'](handleError(_0x2d772d,null));};exports[_0x310f('0x3f')]=function(_0x184b10,_0x5979f5){var _0x53200b={'raw':![],'where':{}};var _0x2ac2ff={};var _0x599fe3={'count':0x0,'rows':[]};return db[_0x310f('0x1f')][_0x310f('0x40')]({'where':{'id':_0x184b10[_0x310f('0x29')]['id']}})[_0x310f('0x1a')](handleEntityNotFound(_0x5979f5,null))[_0x310f('0x1a')](function(_0x548c5d){if(_0x548c5d){_0x2ac2ff['model']=_['keys'](db['SmsMessage'][_0x310f('0x20')]);_0x2ac2ff[_0x310f('0x2b')]=_[_0x310f('0x2a')](_0x184b10[_0x310f('0x2b')]);_0x2ac2ff[_0x310f('0x2c')]=_[_0x310f('0x2f')](_0x2ac2ff['model'],_0x2ac2ff[_0x310f('0x2b')]);_0x53200b[_0x310f('0x2e')]=_[_0x310f('0x2f')](_0x2ac2ff['model'],qs[_0x310f('0x30')](_0x184b10[_0x310f('0x2b')][_0x310f('0x30')]));_0x53200b[_0x310f('0x2e')]=_0x53200b[_0x310f('0x2e')]['length']?_0x53200b[_0x310f('0x2e')]:_0x2ac2ff[_0x310f('0x2d')];if(!_0x184b10[_0x310f('0x2b')][_0x310f('0x41')](_0x310f('0x42'))){_0x53200b['limit']=qs[_0x310f('0x17')](_0x184b10[_0x310f('0x2b')][_0x310f('0x17')]);_0x53200b[_0x310f('0x18')]=qs[_0x310f('0x18')](_0x184b10[_0x310f('0x2b')][_0x310f('0x18')]);}_0x53200b[_0x310f('0x43')]=qs['sort'](_0x184b10[_0x310f('0x2b')][_0x310f('0x44')]);_0x53200b['where']=qs[_0x310f('0x2c')](_['pick'](_0x184b10['query'],_0x2ac2ff['filters']));_0x53200b['where']['SmsInteractionId']=_0x548c5d['id'];if(_0x184b10[_0x310f('0x2b')][_0x310f('0x45')]){_0x53200b['where']=_[_0x310f('0x33')](_0x53200b['where'],{'$or':_[_0x310f('0x1e')](_0x53200b[_0x310f('0x2e')],function(_0x8daaef){var _0x3502e9={};_0x3502e9[_0x8daaef]={'$like':'%'+_0x184b10[_0x310f('0x2b')][_0x310f('0x45')]+'%'};return _0x3502e9;})});}if(_0x184b10[_0x310f('0x2b')]['$gte']){var _0x5d1ac7=_0x184b10['query'][_0x310f('0x46')]['split'](',');var _0x1f996e={};_0x1f996e[_0x5d1ac7[0x0]]={'$gte':moment(_0x5d1ac7[0x1])[_0x310f('0x47')](_0x310f('0x48'))};_0x53200b['where']=_[_0x310f('0x33')](_0x53200b[_0x310f('0x49')],_0x1f996e);}_0x53200b=_[_0x310f('0x33')]({},_0x53200b,_0x184b10['options']);return db[_0x310f('0x3b')][_0x310f('0x4a')]({'where':_0x53200b['where']})[_0x310f('0x1a')](function(_0x53fc0b){_0x599fe3[_0x310f('0x4a')]=_0x53fc0b;if(_0x184b10['query']['includeAll']){_0x53200b['include']=[{'all':!![]}];}return db[_0x310f('0x3b')]['findAll'](_0x53200b);})[_0x310f('0x1a')](function(_0x2d50ab){_0x599fe3[_0x310f('0x4b')]=_0x2d50ab;return _0x599fe3;});}})[_0x310f('0x1a')](respondWithFilteredResult(_0x5979f5,_0x53200b))[_0x310f('0x27')](handleError(_0x5979f5,null));};exports[_0x310f('0x4c')]=function(_0x5a1280,_0x3226b9){return db['SmsInteraction'][_0x310f('0x35')]({'where':{'id':_0x5a1280['params']['id']}})[_0x310f('0x1a')](handleEntityNotFound(_0x3226b9,null))['then'](function(_0x578512){if(_0x578512){return _0x578512[_0x310f('0x4d')](_0x5a1280[_0x310f('0x37')][_0x310f('0x3d')],_['omit'](_0x5a1280[_0x310f('0x37')],[_0x310f('0x3d'),'id'])||{})[_0x310f('0x4e')](function(){return db[_0x310f('0x4f')][_0x310f('0x24')]({'attributes':['id',_0x310f('0x1c'),_0x310f('0x50')],'where':{'id':_0x5a1280[_0x310f('0x37')][_0x310f('0x3d')]}});})[_0x310f('0x1a')](function(_0x3b55db){socket['emit']('smsInteractionTags:save',{'id':Number(_0x5a1280[_0x310f('0x29')]['id']),'tags':_0x3b55db||[]});return{'id':Number(_0x5a1280[_0x310f('0x29')]['id']),'tags':_0x3b55db||[]};});}})[_0x310f('0x1a')](respondWithResult(_0x3226b9,null))[_0x310f('0x27')](handleError(_0x3226b9,null));};exports['removeTags']=function(_0x57d6e6,_0x52490b){return db['SmsInteraction'][_0x310f('0x35')]({'where':{'id':_0x57d6e6[_0x310f('0x29')]['id']}})['then'](handleEntityNotFound(_0x52490b,null))[_0x310f('0x1a')](function(_0x4f21da){if(_0x4f21da){return _0x4f21da[_0x310f('0x51')](_0x57d6e6[_0x310f('0x2b')][_0x310f('0x3d')]);}})[_0x310f('0x1a')](respondWithStatusCode(_0x52490b,null))[_0x310f('0x27')](handleError(_0x52490b,null));};exports[_0x310f('0x52')]=function(_0x376cf3,_0x1c2dc9){var _0x1ea025=moment()[_0x310f('0x53')]()[_0x310f('0x54')]();var _0x1c01a0=path['join'](config[_0x310f('0x55')],'server',_0x310f('0x56'),_0x310f('0x57'));var _0x4feccc=path['join'](_0x1c01a0,_0x1ea025);var _0x5d5c40=util[_0x310f('0x47')]('transcript-%d-%s.zip',_0x376cf3[_0x310f('0x29')]['id'],_0x1ea025);var _0x265599=path[_0x310f('0x58')](_0x1c01a0,_0x5d5c40);var _0x1db4b8=[];_0x1db4b8['push']({'model':db['User'],'as':_0x310f('0x59'),'attributes':['id',_0x310f('0x5a')],'raw':!![]});_0x1db4b8['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x310f('0x5b'),_0x310f('0x5c')],'raw':!![]});var _0xa4eba=[{'model':db[_0x310f('0x3b')],'as':_0x310f('0x5d'),'attributes':['id',_0x310f('0x37'),'createdAt',_0x310f('0x5e'),_0x310f('0x5f'),_0x310f('0x60')],'include':_0x1db4b8}];_0xa4eba['push']({'model':db[_0x310f('0x61')],'as':_0x310f('0x62'),'attributes':['id',_0x310f('0x1c')]});_0xa4eba[_0x310f('0x63')]({'model':db[_0x310f('0x59')],'as':_0x310f('0x64'),'attributes':['id','fullname']});return db[_0x310f('0x1f')][_0x310f('0x35')]({'where':{'id':_0x376cf3['params']['id']},'include':_0xa4eba})[_0x310f('0x1a')](handleEntityNotFound(_0x1c2dc9,null))[_0x310f('0x1a')](function(_0x4ad0c9){if(_0x4ad0c9){var _0x54725b=_0x4ad0c9[_0x310f('0x65')]({'plain':!![]});fs['mkdirSync'](_0x4feccc);var _0x5ddd3f={'channel':_0x310f('0x66'),'account':_0x54725b[_0x310f('0x62')][_0x310f('0x1c')],'agent':_0x54725b['Owner']?_0x54725b[_0x310f('0x64')]['fullname']:_0x310f('0x67'),'createdAt':moment(_0x54725b[_0x310f('0x68')])['format'](_0x310f('0x48'))[_0x310f('0x54')](),'closedAt':_0x54725b['closed']?moment(_0x54725b[_0x310f('0x69')])['format'](_0x310f('0x48'))[_0x310f('0x54')]():'','disposition':_0x54725b[_0x310f('0x6a')],'messages':_(_0x54725b[_0x310f('0x5d')])['filter']({'secret':![]})['map'](function(_0x311d1d){return{'date':moment(_0x311d1d['createdAt'])[_0x310f('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x310f('0x54')](),'sender':_0x311d1d['direction']==='out'?_0x311d1d[_0x310f('0x59')]?_0x311d1d[_0x310f('0x59')][_0x310f('0x5a')]:_0x310f('0x6b'):_0x311d1d['Contact'][_0x310f('0x5b')]+(_0x311d1d[_0x310f('0x6c')][_0x310f('0x5c')]?'\x20'+_0x311d1d['Contact'][_0x310f('0x5c')]:''),'body':_0x311d1d[_0x310f('0x37')],'direction':_0x311d1d[_0x310f('0x5e')]===_0x310f('0x6d')?'A':'C','secret':_0x311d1d[_0x310f('0x5f')],'read':_0x311d1d[_0x310f('0x60')]};})[_0x310f('0x6e')]()};return ejs[_0x310f('0x6f')](path[_0x310f('0x58')](config[_0x310f('0x55')],_0x310f('0x70'),_0x310f('0x71'),'downloadInteraction.ejs'),{'interaction':_0x5ddd3f})[_0x310f('0x1a')](function(_0x29cece){var _0x557cb7=path['join'](_0x4feccc,_0x310f('0x72')+_0x54725b['id']+'-'+_0x1ea025+_0x310f('0x73'));var _0x544c7e={'path':_0x557cb7,'channel':_0x310f('0x66'),'interactionId':_0x54725b['id']};return pdf['createPdfFromHTML'](_0x29cece,_0x544c7e);})['then'](function(){return new BPromise(function(_0x215d83,_0x419d84){zipdir(_0x4feccc,{'saveTo':_0x265599},function(_0x4b989e,_0x204243){if(_0x4b989e)return _0x419d84(_0x4b989e);return _0x215d83(_0x204243);});})['then'](function(){return new BPromise(function(_0x487f1b,_0x43c4fe){rimraf(_0x4feccc,function(_0x4903b0){if(_0x4903b0)_0x43c4fe(_0x4903b0);return _0x487f1b();});});})[_0x310f('0x1a')](function(){return _0x1c2dc9[_0x310f('0x52')](_0x265599,_0x5d5c40,function(_0x24b79b){if(_0x24b79b){console['log'](_0x310f('0x74'),_0x24b79b);}else{fs[_0x310f('0x75')](_0x265599);}});});});}else{return _0x1c2dc9[_0x310f('0x12')](0xc8);}})['catch'](handleError(_0x1c2dc9,null));}; \ No newline at end of file +var _0xc384=['../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','name','send','index','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','attributes','intersection','fields','length','include','merge','options','find','create','body','describe','ids','getMessages','findOne','SmsMessage','hasOwnProperty','order','sort','where','pick','SmsInteractionId','map','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','omit','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','toString','join','server','files','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','fullname','closed','closedAt','disposition','Messages','out','System','value','renderFile','root','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf'];(function(_0x225f1d,_0xc911b0){var _0x59828d=function(_0x1b515d){while(--_0x1b515d){_0x225f1d['push'](_0x225f1d['shift']());}};_0x59828d(++_0xc911b0);}(_0xc384,0x6f));var _0x4c38=function(_0x533676,_0x2be01c){_0x533676=_0x533676-0x0;var _0x32f7bd=_0xc384[_0x533676];return _0x32f7bd;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x4c38('0x0'));var moment=require(_0x4c38('0x1'));var BPromise=require(_0x4c38('0x2'));var util=require(_0x4c38('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c38('0x4'));var Redis=require(_0x4c38('0x5'));var interaction=require(_0x4c38('0x6'));var qs=require(_0x4c38('0x7'));var pdf=require(_0x4c38('0x8'));var logger=require(_0x4c38('0x9'))(_0x4c38('0xa'));var config=require(_0x4c38('0xb'));var db=require(_0x4c38('0xc'))['db'];config['redis']=_[_0x4c38('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4c38('0xe'))(new Redis(config[_0x4c38('0xf')]));require('./smsInteraction.socket')[_0x4c38('0x10')](socket);function respondWithStatusCode(_0x17bbfb,_0x3c1546){_0x3c1546=_0x3c1546||0xcc;return function(_0x4ace0a){if(_0x4ace0a){return _0x17bbfb[_0x4c38('0x11')](_0x3c1546);}return _0x17bbfb['status'](_0x3c1546)[_0x4c38('0x12')]();};}function respondWithResult(_0x5699fa,_0x580c0b){_0x580c0b=_0x580c0b||0xc8;return function(_0x1ac231){if(_0x1ac231){return _0x5699fa[_0x4c38('0x13')](_0x580c0b)[_0x4c38('0x14')](_0x1ac231);}};}function respondWithFilteredResult(_0x490859,_0x5488ad){return function(_0x7c2a44){if(_0x7c2a44){var _0x4d3943=typeof _0x5488ad[_0x4c38('0x15')]===_0x4c38('0x16')&&typeof _0x5488ad[_0x4c38('0x17')]===_0x4c38('0x16');var _0x573c02=_0x7c2a44[_0x4c38('0x18')];var _0x1c76a1=_0x4d3943?0x0:_0x5488ad[_0x4c38('0x15')];var _0x354a36=_0x4d3943?_0x7c2a44[_0x4c38('0x18')]:_0x5488ad[_0x4c38('0x15')]+_0x5488ad[_0x4c38('0x17')];var _0x24dfc1;if(_0x354a36>=_0x573c02){_0x354a36=_0x573c02;_0x24dfc1=0xc8;}else{_0x24dfc1=0xce;}_0x490859[_0x4c38('0x13')](_0x24dfc1);return _0x490859['set'](_0x4c38('0x19'),_0x1c76a1+'-'+_0x354a36+'/'+_0x573c02)['json'](_0x7c2a44);}return null;};}function saveUpdates(_0x332e93){return function(_0x3b0830){if(_0x3b0830){return _0x3b0830[_0x4c38('0x1a')](_0x332e93)['then'](function(_0x318f6d){return _0x318f6d;});}return null;};}function removeEntity(_0x21874d){return function(_0x57dfad){if(_0x57dfad){return _0x57dfad[_0x4c38('0x1b')]()[_0x4c38('0x1c')](function(){_0x21874d[_0x4c38('0x13')](0xcc)[_0x4c38('0x12')]();});}};}function handleEntityNotFound(_0x3d41c5){return function(_0x4300df){if(!_0x4300df){_0x3d41c5['sendStatus'](0x194);}return _0x4300df;};}function handleError(_0x271cc6,_0x1f4954){_0x1f4954=_0x1f4954||0x1f4;return function(_0x59fc84){logger['error'](_0x59fc84['stack']);if(_0x59fc84[_0x4c38('0x1d')]){delete _0x59fc84[_0x4c38('0x1d')];}_0x271cc6[_0x4c38('0x13')](_0x1f4954)[_0x4c38('0x1e')](_0x59fc84);};}exports[_0x4c38('0x1f')]=function(_0x12eae3,_0x2a91a8){var _0x307083={};var _0x14caef=_['map'](db[_0x4c38('0x20')]['rawAttributes'],function(_0x477f4a){return{'name':_0x477f4a[_0x4c38('0x21')],'type':_0x477f4a[_0x4c38('0x22')][_0x4c38('0x23')]};});_0x307083=qs[_0x4c38('0x24')](_0x14caef,_0x12eae3);return interaction[_0x4c38('0x25')](_0x4c38('0x26'),_0x12eae3[_0x4c38('0x27')],_0x12eae3[_0x4c38('0x28')],_0x307083,_0x14caef)[_0x4c38('0x1c')](respondWithFilteredResult(_0x2a91a8,_0x307083))[_0x4c38('0x29')](handleError(_0x2a91a8,null));};exports[_0x4c38('0x2a')]=function(_0xf4a5cc,_0x496f9a){var _0x5a5162={'raw':![],'where':{'id':_0xf4a5cc[_0x4c38('0x2b')]['id']}},_0x3492bc={};_0x3492bc[_0x4c38('0x2c')]=_[_0x4c38('0x2d')](db['SmsInteraction']['rawAttributes']);_0x3492bc[_0x4c38('0x27')]=_[_0x4c38('0x2d')](_0xf4a5cc[_0x4c38('0x27')]);_0x3492bc[_0x4c38('0x2e')]=_['intersection'](_0x3492bc[_0x4c38('0x2c')],_0x3492bc[_0x4c38('0x27')]);_0x5a5162[_0x4c38('0x2f')]=_[_0x4c38('0x30')](_0x3492bc['model'],qs['fields'](_0xf4a5cc[_0x4c38('0x27')][_0x4c38('0x31')]));_0x5a5162[_0x4c38('0x2f')]=_0x5a5162[_0x4c38('0x2f')][_0x4c38('0x32')]?_0x5a5162['attributes']:_0x3492bc[_0x4c38('0x2c')];if(_0xf4a5cc[_0x4c38('0x27')]['includeAll']){_0x5a5162[_0x4c38('0x33')]=[{'all':!![]}];}_0x5a5162=_[_0x4c38('0x34')]({},_0x5a5162,_0xf4a5cc[_0x4c38('0x35')]);return db[_0x4c38('0x20')][_0x4c38('0x36')](_0x5a5162)[_0x4c38('0x1c')](handleEntityNotFound(_0x496f9a,null))[_0x4c38('0x1c')](respondWithResult(_0x496f9a,null))[_0x4c38('0x29')](handleError(_0x496f9a,null));};exports[_0x4c38('0x37')]=function(_0x1d7dc3,_0x49ad42){return db['SmsInteraction']['create'](_0x1d7dc3['body'],{})['then'](respondWithResult(_0x49ad42,0xc9))[_0x4c38('0x29')](handleError(_0x49ad42,null));};exports[_0x4c38('0x1a')]=function(_0x3290c0,_0x160273){if(_0x3290c0['body']['id']){delete _0x3290c0[_0x4c38('0x38')]['id'];}return db[_0x4c38('0x20')][_0x4c38('0x36')]({'where':{'id':_0x3290c0[_0x4c38('0x2b')]['id']}})[_0x4c38('0x1c')](handleEntityNotFound(_0x160273,null))[_0x4c38('0x1c')](saveUpdates(_0x3290c0[_0x4c38('0x38')],null))[_0x4c38('0x1c')](respondWithResult(_0x160273,null))[_0x4c38('0x29')](handleError(_0x160273,null));};exports[_0x4c38('0x1b')]=function(_0x4086aa,_0x5b7ad6){return db[_0x4c38('0x20')]['find']({'where':{'id':_0x4086aa[_0x4c38('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5b7ad6,null))[_0x4c38('0x1c')](removeEntity(_0x5b7ad6,null))['catch'](handleError(_0x5b7ad6,null));};exports[_0x4c38('0x39')]=function(_0x26eeeb,_0x2ef43b){return db[_0x4c38('0x20')][_0x4c38('0x39')]()[_0x4c38('0x1c')](respondWithResult(_0x2ef43b,null))['catch'](handleError(_0x2ef43b,null));};exports['addMessage']=function(_0xbce40a,_0x1a9ab9){return db['SmsMessage']['find']({'where':{'id':_0xbce40a[_0x4c38('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1a9ab9,null))[_0x4c38('0x1c')](function(_0x2d76d5){if(_0x2d76d5){return _0x2d76d5['addMessage'](_0xbce40a[_0x4c38('0x38')]['ids'],_['omit'](_0xbce40a[_0x4c38('0x38')],[_0x4c38('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x1a9ab9,null))[_0x4c38('0x29')](handleError(_0x1a9ab9,null));};exports[_0x4c38('0x3b')]=function(_0x22de5b,_0x24a5d7){var _0x3cf498={'raw':![],'where':{}};var _0xca5418={};var _0x3d9d85={'count':0x0,'rows':[]};return db[_0x4c38('0x20')][_0x4c38('0x3c')]({'where':{'id':_0x22de5b[_0x4c38('0x2b')]['id']}})[_0x4c38('0x1c')](handleEntityNotFound(_0x24a5d7,null))[_0x4c38('0x1c')](function(_0x4fa940){if(_0x4fa940){_0xca5418[_0x4c38('0x2c')]=_[_0x4c38('0x2d')](db[_0x4c38('0x3d')]['rawAttributes']);_0xca5418['query']=_['keys'](_0x22de5b[_0x4c38('0x27')]);_0xca5418[_0x4c38('0x2e')]=_[_0x4c38('0x30')](_0xca5418['model'],_0xca5418[_0x4c38('0x27')]);_0x3cf498['attributes']=_[_0x4c38('0x30')](_0xca5418[_0x4c38('0x2c')],qs[_0x4c38('0x31')](_0x22de5b[_0x4c38('0x27')][_0x4c38('0x31')]));_0x3cf498[_0x4c38('0x2f')]=_0x3cf498[_0x4c38('0x2f')][_0x4c38('0x32')]?_0x3cf498[_0x4c38('0x2f')]:_0xca5418[_0x4c38('0x2c')];if(!_0x22de5b[_0x4c38('0x27')][_0x4c38('0x3e')]('nolimit')){_0x3cf498[_0x4c38('0x17')]=qs[_0x4c38('0x17')](_0x22de5b[_0x4c38('0x27')][_0x4c38('0x17')]);_0x3cf498[_0x4c38('0x15')]=qs[_0x4c38('0x15')](_0x22de5b[_0x4c38('0x27')]['offset']);}_0x3cf498[_0x4c38('0x3f')]=qs[_0x4c38('0x40')](_0x22de5b[_0x4c38('0x27')][_0x4c38('0x40')]);_0x3cf498[_0x4c38('0x41')]=qs[_0x4c38('0x2e')](_[_0x4c38('0x42')](_0x22de5b[_0x4c38('0x27')],_0xca5418[_0x4c38('0x2e')]));_0x3cf498[_0x4c38('0x41')][_0x4c38('0x43')]=_0x4fa940['id'];if(_0x22de5b[_0x4c38('0x27')]['filter']){_0x3cf498[_0x4c38('0x41')]=_[_0x4c38('0x34')](_0x3cf498[_0x4c38('0x41')],{'$or':_[_0x4c38('0x44')](_0x3cf498[_0x4c38('0x2f')],function(_0x5b711d){var _0x17459e={};_0x17459e[_0x5b711d]={'$like':'%'+_0x22de5b[_0x4c38('0x27')][_0x4c38('0x45')]+'%'};return _0x17459e;})});}if(_0x22de5b[_0x4c38('0x27')]['$gte']){var _0x2a9c29=_0x22de5b[_0x4c38('0x27')][_0x4c38('0x46')]['split'](',');var _0x544056={};_0x544056[_0x2a9c29[0x0]]={'$gte':moment(_0x2a9c29[0x1])['format'](_0x4c38('0x47'))};_0x3cf498[_0x4c38('0x41')]=_[_0x4c38('0x34')](_0x3cf498[_0x4c38('0x41')],_0x544056);}_0x3cf498=_[_0x4c38('0x34')]({},_0x3cf498,_0x22de5b[_0x4c38('0x35')]);return db[_0x4c38('0x3d')][_0x4c38('0x18')]({'where':_0x3cf498[_0x4c38('0x41')]})[_0x4c38('0x1c')](function(_0x266eb6){_0x3d9d85[_0x4c38('0x18')]=_0x266eb6;if(_0x22de5b['query'][_0x4c38('0x48')]){_0x3cf498['include']=[{'all':!![]}];}return db['SmsMessage'][_0x4c38('0x25')](_0x3cf498);})[_0x4c38('0x1c')](function(_0x31902b){_0x3d9d85[_0x4c38('0x49')]=_0x31902b;return _0x3d9d85;});}})[_0x4c38('0x1c')](respondWithFilteredResult(_0x24a5d7,_0x3cf498))[_0x4c38('0x29')](handleError(_0x24a5d7,null));};exports[_0x4c38('0x4a')]=function(_0x41e0dc,_0xbc7fbc){return db['SmsInteraction'][_0x4c38('0x36')]({'where':{'id':_0x41e0dc[_0x4c38('0x2b')]['id']}})[_0x4c38('0x1c')](handleEntityNotFound(_0xbc7fbc,null))['then'](function(_0x42a6a1){if(_0x42a6a1){return _0x42a6a1['setTags'](_0x41e0dc[_0x4c38('0x38')][_0x4c38('0x3a')],_[_0x4c38('0x4b')](_0x41e0dc['body'],[_0x4c38('0x3a'),'id'])||{})[_0x4c38('0x4c')](function(){return db[_0x4c38('0x4d')][_0x4c38('0x25')]({'attributes':['id',_0x4c38('0x1d'),_0x4c38('0x4e')],'where':{'id':_0x41e0dc[_0x4c38('0x38')]['ids']}});})[_0x4c38('0x1c')](function(_0x4a7955){socket[_0x4c38('0x4f')](_0x4c38('0x50'),{'id':Number(_0x41e0dc['params']['id']),'tags':_0x4a7955||[]});return{'id':Number(_0x41e0dc['params']['id']),'tags':_0x4a7955||[]};});}})[_0x4c38('0x1c')](respondWithResult(_0xbc7fbc,null))[_0x4c38('0x29')](handleError(_0xbc7fbc,null));};exports[_0x4c38('0x51')]=function(_0x3d524d,_0x5d539c){return db[_0x4c38('0x20')][_0x4c38('0x36')]({'where':{'id':_0x3d524d['params']['id']}})[_0x4c38('0x1c')](handleEntityNotFound(_0x5d539c,null))[_0x4c38('0x1c')](function(_0x2df5c2){if(_0x2df5c2){return _0x2df5c2['removeTags'](_0x3d524d['query'][_0x4c38('0x3a')]);}})[_0x4c38('0x1c')](respondWithStatusCode(_0x5d539c,null))[_0x4c38('0x29')](handleError(_0x5d539c,null));};exports[_0x4c38('0x52')]=function(_0xe9890c,_0x59d66f){var _0x399aa6=moment()['unix']()[_0x4c38('0x53')]();var _0x55aea7=path[_0x4c38('0x54')](config['root'],_0x4c38('0x55'),_0x4c38('0x56'),'tmp');var _0x19968a=path['join'](_0x55aea7,_0x399aa6);var _0x40f355=util[_0x4c38('0x57')](_0x4c38('0x58'),_0xe9890c[_0x4c38('0x2b')]['id'],_0x399aa6);var _0xe32460=path['join'](_0x55aea7,_0x40f355);var _0x5b848a=[];_0x5b848a[_0x4c38('0x59')]({'model':db[_0x4c38('0x5a')],'as':_0x4c38('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x5b848a[_0x4c38('0x59')]({'model':db[_0x4c38('0x5b')],'as':_0x4c38('0x5c'),'attributes':['id',_0x4c38('0x5d'),_0x4c38('0x5e')],'raw':!![]});var _0x55b8d6=[{'model':db[_0x4c38('0x3d')],'as':'Messages','attributes':['id',_0x4c38('0x38'),_0x4c38('0x5f'),_0x4c38('0x60'),_0x4c38('0x61'),_0x4c38('0x62')],'include':_0x5b848a}];_0x55b8d6[_0x4c38('0x59')]({'model':db[_0x4c38('0x63')],'as':_0x4c38('0x64'),'attributes':['id',_0x4c38('0x1d')]});_0x55b8d6[_0x4c38('0x59')]({'model':db['User'],'as':_0x4c38('0x65'),'attributes':['id','fullname']});return db['SmsInteraction']['find']({'where':{'id':_0xe9890c[_0x4c38('0x2b')]['id']},'include':_0x55b8d6})[_0x4c38('0x1c')](handleEntityNotFound(_0x59d66f,null))[_0x4c38('0x1c')](function(_0xce124){if(_0xce124){var _0x964bd5=_0xce124[_0x4c38('0x66')]({'plain':!![]});fs[_0x4c38('0x67')](_0x19968a);var _0x123d28={'channel':'Sms','account':_0x964bd5[_0x4c38('0x64')][_0x4c38('0x1d')],'agent':_0x964bd5[_0x4c38('0x65')]?_0x964bd5[_0x4c38('0x65')][_0x4c38('0x68')]:'N.A.','createdAt':moment(_0x964bd5['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4c38('0x53')](),'closedAt':_0x964bd5[_0x4c38('0x69')]?moment(_0x964bd5[_0x4c38('0x6a')])[_0x4c38('0x57')](_0x4c38('0x47'))['toString']():'','disposition':_0x964bd5[_0x4c38('0x6b')],'messages':_(_0x964bd5[_0x4c38('0x6c')])[_0x4c38('0x45')]({'secret':![]})[_0x4c38('0x44')](function(_0x4d132a){return{'date':moment(_0x4d132a[_0x4c38('0x5f')])[_0x4c38('0x57')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4c38('0x53')](),'sender':_0x4d132a[_0x4c38('0x60')]===_0x4c38('0x6d')?_0x4d132a[_0x4c38('0x5a')]?_0x4d132a[_0x4c38('0x5a')][_0x4c38('0x68')]:_0x4c38('0x6e'):_0x4d132a['Contact'][_0x4c38('0x5d')]+(_0x4d132a[_0x4c38('0x5c')][_0x4c38('0x5e')]?'\x20'+_0x4d132a[_0x4c38('0x5c')][_0x4c38('0x5e')]:''),'body':_0x4d132a[_0x4c38('0x38')],'direction':_0x4d132a[_0x4c38('0x60')]===_0x4c38('0x6d')?'A':'C','secret':_0x4d132a[_0x4c38('0x61')],'read':_0x4d132a['read']};})[_0x4c38('0x6f')]()};return ejs[_0x4c38('0x70')](path[_0x4c38('0x54')](config[_0x4c38('0x71')],_0x4c38('0x55'),'views',_0x4c38('0x72')),{'interaction':_0x123d28})[_0x4c38('0x1c')](function(_0x534736){var _0x2e6493=path[_0x4c38('0x54')](_0x19968a,_0x4c38('0x73')+_0x964bd5['id']+'-'+_0x399aa6+_0x4c38('0x74'));var _0x5de887={'path':_0x2e6493,'channel':'Sms','interactionId':_0x964bd5['id']};return pdf[_0x4c38('0x75')](_0x534736,_0x5de887);})[_0x4c38('0x1c')](function(){return new BPromise(function(_0x4e4e37,_0xb70d0){zipdir(_0x19968a,{'saveTo':_0xe32460},function(_0x45a47f,_0x13a634){if(_0x45a47f)return _0xb70d0(_0x45a47f);return _0x4e4e37(_0x13a634);});})[_0x4c38('0x1c')](function(){return new BPromise(function(_0x44ebae,_0x12b4d4){rimraf(_0x19968a,function(_0x2b3366){if(_0x2b3366)_0x12b4d4(_0x2b3366);return _0x44ebae();});});})[_0x4c38('0x1c')](function(){return _0x59d66f[_0x4c38('0x52')](_0xe32460,_0x40f355,function(_0x5dd39d){if(_0x5dd39d){console['log'](_0x4c38('0x76'),_0x5dd39d);}else{fs[_0x4c38('0x77')](_0xe32460);}});});});}else{return _0x59d66f[_0x4c38('0x11')](0xc8);}})['catch'](handleError(_0x59d66f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 72d94bd..5fa9877 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0xcb8666,_0x49d6e9){var _0x56db39=function(_0x24620c){while(--_0x24620c){_0xcb8666['push'](_0xcb8666['shift']());}};_0x56db39(++_0x49d6e9);}(_0xadb5,0xad));var _0x5adb=function(_0x47c6de,_0x176a43){_0x47c6de=_0x47c6de-0x0;var _0x405b93=_0xadb5[_0x47c6de];return _0x405b93;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x3266=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0xf147af,_0x495f47){var _0x528f10=function(_0x20167b){while(--_0x20167b){_0xf147af['push'](_0xf147af['shift']());}};_0x528f10(++_0x495f47);}(_0x3266,0x6a));var _0x6326=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x3266[_0x2d34d6];return _0x1d3d12;};'use strict';var EventEmitter=require(_0x6326('0x0'));var SmsInteraction=require(_0x6326('0x1'))['db'][_0x6326('0x2')];var SmsMessage=require(_0x6326('0x1'))['db'][_0x6326('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6326('0x4')](0x0);var events={'afterCreate':_0x6326('0x5'),'afterUpdate':_0x6326('0x6'),'afterDestroy':_0x6326('0x7')};function emitEvent(_0x5a6b4d){return function(_0x30b22e,_0x5f38a3,_0x25ecd8){_0x30b22e[_0x6326('0x8')]({'attributes':['id'],'raw':!![]})[_0x6326('0x9')](function(_0x5402e5){_0x30b22e[_0x6326('0xa')]('Users',_0x5402e5[_0x6326('0xb')](function(_0x90c0f){return{'id':_0x90c0f['id']};}));return SmsMessage[_0x6326('0xc')]({'where':{'SmsInteractionId':_0x30b22e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6326('0x9')](function(_0x37a23d){_0x30b22e['setDataValue'](_0x6326('0xd'),_0x37a23d[_0x6326('0xe')]);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d+':'+_0x30b22e['id'],_0x30b22e);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d,_0x30b22e);_0x25ecd8(null);})[_0x6326('0x10')](_0x25ecd8(null));};}for(var e in events){if(events[_0x6326('0x11')](e)){var event=events[e];SmsInteraction[_0x6326('0x12')](e,emitEvent(event));}}module[_0x6326('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c62bb27..2c3b5be 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 _0x8769=['define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsInteraction.attributes','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8769,0x104));var _0x9876=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x8769[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x9876('0x0'));var util=require(_0x9876('0x1'));var logger=require(_0x9876('0x2'))(_0x9876('0x3'));var moment=require(_0x9876('0x4'));var BPromise=require(_0x9876('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9876('0x6'));var rimraf=require(_0x9876('0x7'));var config=require('../../config/environment');var attributes=require(_0x9876('0x8'));module[_0x9876('0x9')]=function(_0xfa30a1,_0x3f98e0){return _0xfa30a1[_0x9876('0xa')](_0x9876('0xb'),attributes,{'tableName':_0x9876('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24aebf,_0x2c6fea,_0x5de092){if(_0x24aebf[_0x9876('0xd')](_0x9876('0xe'))){_0x24aebf[_0x9876('0xf')]=moment()[_0x9876('0x10')](_0x9876('0x11'));}_0x5de092(null,_0x24aebf);}}});}; \ No newline at end of file +var _0x5afb=['define','sms_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0xe3f9c3,_0x12473b){var _0x5aa9ac=function(_0x208fc0){while(--_0x208fc0){_0xe3f9c3['push'](_0xe3f9c3['shift']());}};_0x5aa9ac(++_0x12473b);}(_0x5afb,0x65));var _0xb5af=function(_0x3890f8,_0x1b39df){_0x3890f8=_0x3890f8-0x0;var _0x40713e=_0x5afb[_0x3890f8];return _0x40713e;};'use strict';var _=require(_0xb5af('0x0'));var util=require(_0xb5af('0x1'));var logger=require(_0xb5af('0x2'))(_0xb5af('0x3'));var moment=require(_0xb5af('0x4'));var BPromise=require(_0xb5af('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5af('0x6'));var rimraf=require(_0xb5af('0x7'));var config=require(_0xb5af('0x8'));var attributes=require(_0xb5af('0x9'));module[_0xb5af('0xa')]=function(_0x43bb3e,_0x3d6bae){return _0x43bb3e[_0xb5af('0xb')]('SmsInteraction',attributes,{'tableName':_0xb5af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x403322,_0x263198,_0xe37d55){if(_0x403322[_0xb5af('0xd')]('closed')){_0x403322['closedAt']=moment()[_0xb5af('0xe')](_0xb5af('0xf'));}_0xe37d55(null,_0x403322);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 32e9b20..3899d24 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 _0x7132=['omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','then','addTags','ids'];(function(_0x10345e,_0x4f4ff4){var _0x19e40a=function(_0x23b7b1){while(--_0x23b7b1){_0x10345e['push'](_0x10345e['shift']());}};_0x19e40a(++_0x4f4ff4);}(_0x7132,0xc6));var _0x2713=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x7132[_0x3cea78];return _0x33b66b;};'use strict';var _=require('lodash');var util=require(_0x2713('0x0'));var moment=require('moment');var BPromise=require(_0x2713('0x1'));var rs=require(_0x2713('0x2'));var fs=require('fs');var Redis=require(_0x2713('0x3'));var db=require(_0x2713('0x4'))['db'];var utils=require(_0x2713('0x5'));var logger=require(_0x2713('0x6'))('rpc');var config=require(_0x2713('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2713('0x8')][_0x2713('0x9')]({'port':0x232a});config[_0x2713('0xa')]=_[_0x2713('0xb')](config[_0x2713('0xa')],{'host':_0x2713('0xc'),'port':0x18eb});var socket=require(_0x2713('0xd'))(new Redis(config[_0x2713('0xa')]));require('./smsInteraction.socket')[_0x2713('0xe')](socket);function respondWithRpcPromise(_0x1e3caf,_0x382d26,_0x1a88b8){return new BPromise(function(_0x46fca5,_0x358e9b){return client[_0x2713('0xf')](_0x1e3caf,_0x1a88b8)['then'](function(_0x4599db){logger['info'](_0x2713('0x10'),_0x382d26,_0x2713('0x11'));logger[_0x2713('0x12')](_0x2713('0x13'),_0x382d26,_0x2713('0x11'),JSON[_0x2713('0x14')](_0x4599db));if(_0x4599db[_0x2713('0x15')]){if(_0x4599db[_0x2713('0x15')][_0x2713('0x16')]===0x1f4){logger['error'](_0x2713('0x10'),_0x382d26,_0x4599db[_0x2713('0x15')][_0x2713('0x17')]);return _0x358e9b(_0x4599db[_0x2713('0x15')][_0x2713('0x17')]);}logger[_0x2713('0x15')](_0x2713('0x10'),_0x382d26,_0x4599db[_0x2713('0x15')][_0x2713('0x17')]);return _0x46fca5(_0x4599db[_0x2713('0x15')]['message']);}else{logger[_0x2713('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x382d26,'request\x20sent');_0x46fca5(_0x4599db[_0x2713('0x19')][_0x2713('0x17')]);}})[_0x2713('0x1a')](function(_0x9729b6){logger['error'](_0x2713('0x10'),_0x382d26,_0x9729b6);_0x358e9b(_0x9729b6);});});}exports[_0x2713('0x1b')]=function(_0x45619a){var _0x5b0a01=this;return new Promise(function(_0xebb05b,_0x333089){return db[_0x2713('0x1c')][_0x2713('0x1d')](_0x45619a[_0x2713('0x1e')],{'raw':_0x45619a[_0x2713('0x1f')]?_0x45619a[_0x2713('0x1f')][_0x2713('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45619a['options']?_0x45619a['options']['where']||null:null,'attributes':_0x45619a[_0x2713('0x1f')]?_0x45619a[_0x2713('0x1f')]['attributes']||null:null,'limit':_0x45619a[_0x2713('0x1f')]?_0x45619a['options']['limit']||null:null})[_0x2713('0x21')](function(_0x4c11b0){logger[_0x2713('0x18')](_0x2713('0x1b'),_0x45619a);logger[_0x2713('0x12')]('UpdateSmsInteraction',_0x45619a,JSON[_0x2713('0x14')](_0x4c11b0));_0xebb05b(_0x4c11b0);})['catch'](function(_0x4db178){logger[_0x2713('0x15')](_0x2713('0x1b'),_0x4db178[_0x2713('0x17')],_0x45619a);_0x333089(_0x5b0a01[_0x2713('0x15')](0x1f4,_0x4db178[_0x2713('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x5359f7){return new Promise(function(_0x3e409d,_0x1e37a2){return db[_0x2713('0x1c')]['find']({'where':_0x5359f7['options']?_0x5359f7[_0x2713('0x1f')]['where']||null:null})[_0x2713('0x21')](function(_0x3b9191){if(_0x3b9191){return _0x3b9191[_0x2713('0x22')](_0x5359f7[_0x2713('0x1e')][_0x2713('0x23')],_[_0x2713('0x24')](_0x5359f7[_0x2713('0x1e')],['ids','id'])||{});}})[_0x2713('0x25')](function(_0x35671a){logger[_0x2713('0x18')](_0x2713('0x26'),_0x5359f7);logger[_0x2713('0x12')](_0x2713('0x26'),_0x5359f7,JSON[_0x2713('0x14')](_0x35671a));_0x3e409d(_0x35671a);})[_0x2713('0x1a')](function(_0x21c1f5){logger[_0x2713('0x15')](_0x2713('0x26'),_0x21c1f5[_0x2713('0x17')],_0x5359f7);_0x1e37a2(_this[_0x2713('0x15')](0x1f4,_0x21c1f5[_0x2713('0x17')]));});});}; \ No newline at end of file +var _0x5f63=['catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','then','debug','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5f63,0x16e));var _0x35f6=function(_0x29eb84,_0x19e031){_0x29eb84=_0x29eb84-0x0;var _0x84067f=_0x5f63[_0x29eb84];return _0x84067f;};'use strict';var _=require('lodash');var util=require(_0x35f6('0x0'));var moment=require('moment');var BPromise=require(_0x35f6('0x1'));var rs=require(_0x35f6('0x2'));var fs=require('fs');var Redis=require(_0x35f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35f6('0x4'))(_0x35f6('0x5'));var config=require(_0x35f6('0x6'));var jayson=require(_0x35f6('0x7'));var client=jayson[_0x35f6('0x8')]['http']({'port':0x232a});config[_0x35f6('0x9')]=_[_0x35f6('0xa')](config['redis'],{'host':_0x35f6('0xb'),'port':0x18eb});var socket=require(_0x35f6('0xc'))(new Redis(config[_0x35f6('0x9')]));require(_0x35f6('0xd'))[_0x35f6('0xe')](socket);function respondWithRpcPromise(_0x357424,_0x1f01cf,_0x3bbe54){return new BPromise(function(_0x2f91bb,_0x5f5224){return client[_0x35f6('0xf')](_0x357424,_0x3bbe54)['then'](function(_0x2f01b1){logger[_0x35f6('0x10')](_0x35f6('0x11'),_0x1f01cf,'request\x20sent');logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x1f01cf,_0x35f6('0x12'),JSON[_0x35f6('0x13')](_0x2f01b1));if(_0x2f01b1[_0x35f6('0x14')]){if(_0x2f01b1[_0x35f6('0x14')][_0x35f6('0x15')]===0x1f4){logger[_0x35f6('0x14')](_0x35f6('0x11'),_0x1f01cf,_0x2f01b1[_0x35f6('0x14')][_0x35f6('0x16')]);return _0x5f5224(_0x2f01b1[_0x35f6('0x14')][_0x35f6('0x16')]);}logger[_0x35f6('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x1f01cf,_0x2f01b1['error'][_0x35f6('0x16')]);return _0x2f91bb(_0x2f01b1[_0x35f6('0x14')][_0x35f6('0x16')]);}else{logger[_0x35f6('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x1f01cf,'request\x20sent');_0x2f91bb(_0x2f01b1[_0x35f6('0x17')][_0x35f6('0x16')]);}})[_0x35f6('0x18')](function(_0x50283b){logger[_0x35f6('0x14')](_0x35f6('0x11'),_0x1f01cf,_0x50283b);_0x5f5224(_0x50283b);});});}exports[_0x35f6('0x19')]=function(_0x383f16){var _0x2f4278=this;return new Promise(function(_0x4712fc,_0x5a7e35){return db[_0x35f6('0x1a')]['update'](_0x383f16[_0x35f6('0x1b')],{'raw':_0x383f16[_0x35f6('0x1c')]?_0x383f16[_0x35f6('0x1c')][_0x35f6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x383f16['options']?_0x383f16[_0x35f6('0x1c')]['where']||null:null,'attributes':_0x383f16[_0x35f6('0x1c')]?_0x383f16[_0x35f6('0x1c')][_0x35f6('0x1e')]||null:null,'limit':_0x383f16[_0x35f6('0x1c')]?_0x383f16[_0x35f6('0x1c')]['limit']||null:null})[_0x35f6('0x1f')](function(_0xb97875){logger['info'](_0x35f6('0x19'),_0x383f16);logger[_0x35f6('0x20')](_0x35f6('0x19'),_0x383f16,JSON['stringify'](_0xb97875));_0x4712fc(_0xb97875);})[_0x35f6('0x18')](function(_0x413f4d){logger[_0x35f6('0x14')]('UpdateSmsInteraction',_0x413f4d[_0x35f6('0x16')],_0x383f16);_0x5a7e35(_0x2f4278[_0x35f6('0x14')](0x1f4,_0x413f4d['message']));});});};exports[_0x35f6('0x21')]=function(_0x29da0c){return new Promise(function(_0x786c1d,_0x38efd7){return db['SmsInteraction'][_0x35f6('0x22')]({'where':_0x29da0c[_0x35f6('0x1c')]?_0x29da0c[_0x35f6('0x1c')]['where']||null:null})['then'](function(_0x13f358){if(_0x13f358){return _0x13f358['addTags'](_0x29da0c[_0x35f6('0x1b')][_0x35f6('0x23')],_[_0x35f6('0x24')](_0x29da0c[_0x35f6('0x1b')],[_0x35f6('0x23'),'id'])||{});}})[_0x35f6('0x25')](function(_0x5c3394){logger[_0x35f6('0x10')](_0x35f6('0x26'),_0x29da0c);logger[_0x35f6('0x20')](_0x35f6('0x26'),_0x29da0c,JSON[_0x35f6('0x13')](_0x5c3394));_0x786c1d(_0x5c3394);})[_0x35f6('0x18')](function(_0x11d14d){logger[_0x35f6('0x14')](_0x35f6('0x26'),_0x11d14d[_0x35f6('0x16')],_0x29da0c);_0x38efd7(_this[_0x35f6('0x14')](0x1f4,_0x11d14d[_0x35f6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 055bde4..d9e79ce 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 _0xe4bf=['save','remove','update','emit','register','length','smsInteraction:'];(function(_0x23c196,_0x5242ac){var _0x768c56=function(_0x1c258b){while(--_0x1c258b){_0x23c196['push'](_0x23c196['shift']());}};_0x768c56(++_0x5242ac);}(_0xe4bf,0x1dc));var _0xfe4b=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xe4bf[_0x1406ae];return _0x23a076;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xfe4b('0x0'),_0xfe4b('0x1'),_0xfe4b('0x2')];function createListener(_0x3f30d4,_0x1adb0d){return function(_0x2a4481){_0x1adb0d[_0xfe4b('0x3')](_0x3f30d4,_0x2a4481);};}function removeListener(_0x3978d5,_0x4a05e8){return function(){SmsInteractionEvents['removeListener'](_0x3978d5,_0x4a05e8);};}exports[_0xfe4b('0x4')]=function(_0x2525dd){for(var _0x7e812=0x0,_0x250cf1=events[_0xfe4b('0x5')];_0x7e812<_0x250cf1;_0x7e812++){var _0x4dddb4=events[_0x7e812];var _0x26fbd0=createListener(_0xfe4b('0x6')+_0x4dddb4,_0x2525dd);SmsInteractionEvents['on'](_0x4dddb4,_0x26fbd0);}}; \ No newline at end of file +var _0x3abf=['length','remove','emit','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3abf,0x169));var _0xf3ab=function(_0x53a259,_0x5407df){_0x53a259=_0x53a259-0x0;var _0x22d804=_0x3abf[_0x53a259];return _0x22d804;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xf3ab('0x0'),'update'];function createListener(_0x380e18,_0x411648){return function(_0xf2991d){_0x411648[_0xf3ab('0x1')](_0x380e18,_0xf2991d);};}function removeListener(_0x3fea26,_0x532e74){return function(){SmsInteractionEvents['removeListener'](_0x3fea26,_0x532e74);};}exports[_0xf3ab('0x2')]=function(_0x5d790b){for(var _0x1018ee=0x0,_0x551ca0=events[_0xf3ab('0x3')];_0x1018ee<_0x551ca0;_0x1018ee++){var _0x20f84d=events[_0x1018ee];var _0x490a70=createListener('smsInteraction:'+_0x20f84d,_0x5d790b);SmsInteractionEvents['on'](_0x20f84d,_0x490a70);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a3c9fbe..a175126 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 _0x0f6c=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','show','post','tracked','smsmessage:create','status','put','/:id','update','accept','delete','destroy'];(function(_0x3f41da,_0x2b2a3d){var _0x3a7dee=function(_0x127528){while(--_0x127528){_0x3f41da['push'](_0x3f41da['shift']());}};_0x3a7dee(++_0x2b2a3d);}(_0x0f6c,0xe1));var _0xc0f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0f6c[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xc0f6('0x0'));var util=require('util');var path=require(_0xc0f6('0x1'));var timeout=require(_0xc0f6('0x2'));var express=require(_0xc0f6('0x3'));var router=express[_0xc0f6('0x4')]();var fs_extra=require(_0xc0f6('0x5'));var auth=require(_0xc0f6('0x6'));var interaction=require(_0xc0f6('0x7'));var config=require(_0xc0f6('0x8'));var controller=require(_0xc0f6('0x9'));router[_0xc0f6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc0f6('0xb')]);router[_0xc0f6('0xa')]('/describe',auth[_0xc0f6('0xc')](),controller[_0xc0f6('0xd')]);router[_0xc0f6('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc0f6('0xe')]);router[_0xc0f6('0xf')]('/',auth[_0xc0f6('0xc')](),interaction[_0xc0f6('0x10')]('sms',_0xc0f6('0x11')),controller['create']);router[_0xc0f6('0xf')]('/:id/status',controller[_0xc0f6('0x12')]);router[_0xc0f6('0x13')](_0xc0f6('0x14'),auth[_0xc0f6('0xc')](),controller[_0xc0f6('0x15')]);router[_0xc0f6('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc0f6('0x16')]);router[_0xc0f6('0x13')]('/:id/reject',auth[_0xc0f6('0xc')](),controller['reject']);router[_0xc0f6('0x17')](_0xc0f6('0x14'),auth[_0xc0f6('0xc')](),controller[_0xc0f6('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd795=['tracked','smsmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated','/describe','get','/:id','show','post'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0xd795,0x155));var _0x5d79=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xd795[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require(_0x5d79('0x0'));var path=require(_0x5d79('0x1'));var timeout=require(_0x5d79('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d79('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5d79('0x4'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth[_0x5d79('0x5')](),controller['index']);router['get'](_0x5d79('0x6'),auth[_0x5d79('0x5')](),controller['describe']);router[_0x5d79('0x7')](_0x5d79('0x8'),auth['isAuthenticated'](),controller[_0x5d79('0x9')]);router[_0x5d79('0xa')]('/',auth[_0x5d79('0x5')](),interaction[_0x5d79('0xb')]('sms',_0x5d79('0xc')),controller[_0x5d79('0xd')]);router['post']('/:id/status',controller[_0x5d79('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5d79('0xf')](_0x5d79('0x10'),auth[_0x5d79('0x5')](),controller[_0x5d79('0x11')]);router[_0x5d79('0xf')](_0x5d79('0x12'),auth[_0x5d79('0x5')](),controller[_0x5d79('0x13')]);router[_0x5d79('0x14')](_0x5d79('0x8'),auth[_0x5d79('0x5')](),controller[_0x5d79('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 49053b7..b293661 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 _0xc213=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc213,0x19b));var _0x3c21=function(_0x4088f8,_0x104a54){_0x4088f8=_0x4088f8-0x0;var _0x159ef6=_0xc213[_0x4088f8];return _0x159ef6;};'use strict';var Sequelize=require(_0x3c21('0x0'));module[_0x3c21('0x1')]={'body':{'type':Sequelize[_0x3c21('0x2')](_0x3c21('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3c21('0x5')]('in',_0x3c21('0x6')),'defaultValue':_0x3c21('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3c21('0x7')](0xbe)},'phone':{'type':Sequelize[_0x3c21('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3c21('0x7')]},'providerResponse':{'type':Sequelize[_0x3c21('0x2')]}}; \ No newline at end of file +var _0xac4f=['STRING','DATE','sequelize','TEXT','BOOLEAN','out'];(function(_0x395461,_0x7f289d){var _0x1c9b70=function(_0x453459){while(--_0x453459){_0x395461['push'](_0x395461['shift']());}};_0x1c9b70(++_0x7f289d);}(_0xac4f,0x122));var _0xfac4=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0xac4f[_0x483d8b];return _0x6500f1;};'use strict';var Sequelize=require(_0xfac4('0x0'));module['exports']={'body':{'type':Sequelize[_0xfac4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfac4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xfac4('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfac4('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xfac4('0x5')]},'secret':{'type':Sequelize[_0xfac4('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfac4('0x4')]},'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 068de12..8e8fd3e 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 _0x1867=['fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','contact','email','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','results','groupName','DELIVERED','inspect','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','name','index','SmsMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','find','body','params','destroy','describe','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','get','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User'];(function(_0x585310,_0x536d07){var _0xa454d3=function(_0x2624f1){while(--_0x2624f1){_0x585310['push'](_0x585310['shift']());}};_0xa454d3(++_0x536d07);}(_0x1867,0xb5));var _0x7186=function(_0x485a5b,_0x1a03a5){_0x485a5b=_0x485a5b-0x0;var _0x3d99c4=_0x1867[_0x485a5b];return _0x3d99c4;};'use strict';var emlformat=require(_0x7186('0x0'));var rimraf=require(_0x7186('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7186('0x2'));var rp=require('request-promise');var moment=require(_0x7186('0x3'));var BPromise=require(_0x7186('0x4'));var Mustache=require(_0x7186('0x5'));var util=require(_0x7186('0x6'));var path=require(_0x7186('0x7'));var sox=require(_0x7186('0x8'));var csv=require(_0x7186('0x9'));var ejs=require(_0x7186('0xa'));var fs=require('fs');var fs_extra=require(_0x7186('0xb'));var _=require('lodash');var squel=require(_0x7186('0xc'));var crypto=require(_0x7186('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7186('0xe'));var toCsv=require(_0x7186('0x9'));var querystring=require(_0x7186('0xf'));var Papa=require(_0x7186('0x10'));var Redis=require('ioredis');var authService=require(_0x7186('0x11'));var qs=require(_0x7186('0x12'));var as=require(_0x7186('0x13'));var hardwareService=require(_0x7186('0x14'));var logger=require(_0x7186('0x15'))('api');var utils=require(_0x7186('0x16'));var config=require(_0x7186('0x17'));var licenseUtil=require(_0x7186('0x18'));var db=require(_0x7186('0x19'))['db'];config['redis']=_[_0x7186('0x1a')](config[_0x7186('0x1b')],{'host':_0x7186('0x1c'),'port':0x18eb});var socket=require(_0x7186('0x1d'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x7186('0x1e'));var client=jayson[_0x7186('0x1f')][_0x7186('0x20')]({'port':0x232c});var client9002=jayson[_0x7186('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8de4,_0x1cc347,_0x915126,_0x396e13){return new BPromise(function(_0x6508f5,_0x332bfd){var _0x38524d=_0x396e13||client;return _0x38524d[_0x7186('0x21')](_0x2a8de4,_0x915126)['then'](function(_0x24a877){logger[_0x7186('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1cc347,_0x7186('0x23'));logger[_0x7186('0x24')](_0x7186('0x25'),_0x1cc347,'request\x20sent',JSON['stringify'](_0x24a877));if(_0x24a877[_0x7186('0x26')]){if(_0x24a877['error'][_0x7186('0x27')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1cc347,_0x24a877['error'][_0x7186('0x28')]);return _0x332bfd(_0x24a877[_0x7186('0x26')]['message']);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1cc347,_0x24a877['error'][_0x7186('0x28')]);return _0x6508f5(_0x24a877[_0x7186('0x26')][_0x7186('0x28')]);}else{logger['info'](_0x7186('0x29'),_0x1cc347,_0x7186('0x23'));_0x6508f5(_0x24a877[_0x7186('0x2a')][_0x7186('0x28')]);}})[_0x7186('0x2b')](function(_0x52aecc){logger[_0x7186('0x26')](_0x7186('0x29'),_0x1cc347,_0x52aecc);_0x332bfd(_0x52aecc);});});}function respondWithStatusCode(_0x4782ca,_0x142bde){_0x142bde=_0x142bde||0xcc;return function(_0x321bec){if(_0x321bec){return _0x4782ca[_0x7186('0x2c')](_0x142bde);}return _0x4782ca[_0x7186('0x2d')](_0x142bde)[_0x7186('0x2e')]();};}function respondWithResult(_0x53c3fe,_0x29d231){_0x29d231=_0x29d231||0xc8;return function(_0x463f1e){if(_0x463f1e){return _0x53c3fe['status'](_0x29d231)[_0x7186('0x2f')](_0x463f1e);}};}function respondWithFilteredResult(_0x4e61c6,_0x19b109){return function(_0xa909b0){if(_0xa909b0){var _0x3eae35=typeof _0x19b109[_0x7186('0x30')]===_0x7186('0x31')&&typeof _0x19b109['limit']===_0x7186('0x31');var _0x2b6003=_0xa909b0[_0x7186('0x32')];var _0xd709e=_0x3eae35?0x0:_0x19b109[_0x7186('0x30')];var _0x59eba3=_0x3eae35?_0xa909b0[_0x7186('0x32')]:_0x19b109[_0x7186('0x30')]+_0x19b109[_0x7186('0x33')];var _0x4f0b44;if(_0x59eba3>=_0x2b6003){_0x59eba3=_0x2b6003;_0x4f0b44=0xc8;}else{_0x4f0b44=0xce;}_0x4e61c6[_0x7186('0x2d')](_0x4f0b44);return _0x4e61c6[_0x7186('0x34')](_0x7186('0x35'),_0xd709e+'-'+_0x59eba3+'/'+_0x2b6003)[_0x7186('0x2f')](_0xa909b0);}return null;};}function patchUpdates(_0x25a75a){return function(_0x4da477){try{jsonpatch['apply'](_0x4da477,_0x25a75a,!![]);}catch(_0x443dd6){return BPromise['reject'](_0x443dd6);}return _0x4da477[_0x7186('0x36')]();};}function saveUpdates(_0x850b87,_0x3f7927){return function(_0x49a6c2){if(_0x49a6c2){return _0x49a6c2[_0x7186('0x37')](_0x850b87)[_0x7186('0x38')](function(_0x1de2e1){return _0x1de2e1;});}return null;};}function removeEntity(_0x24d64c,_0x572083){return function(_0x4ff69b){if(_0x4ff69b){return _0x4ff69b['destroy']()[_0x7186('0x38')](function(){_0x24d64c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57039a,_0xe4807d){return function(_0x390f82){if(!_0x390f82){_0x57039a[_0x7186('0x2c')](0x194);}return _0x390f82;};}function handleError(_0x2df1b9,_0x1a1e41){_0x1a1e41=_0x1a1e41||0x1f4;return function(_0x3a120d){logger[_0x7186('0x26')](_0x3a120d['stack']);if(_0x3a120d['name']){delete _0x3a120d[_0x7186('0x39')];}_0x2df1b9[_0x7186('0x2d')](_0x1a1e41)['send'](_0x3a120d);};}exports[_0x7186('0x3a')]=function(_0x347748,_0x2a834e){var _0x1e32b5={},_0x50255c={},_0x6c0109={'count':0x0,'rows':[]};var _0x5563d9=_['map'](db[_0x7186('0x3b')][_0x7186('0x3c')],function(_0x43b57d){return{'name':_0x43b57d[_0x7186('0x3d')],'type':_0x43b57d['type'][_0x7186('0x3e')]};});_0x50255c[_0x7186('0x3f')]=_[_0x7186('0x40')](_0x5563d9,'name');_0x50255c[_0x7186('0x41')]=_[_0x7186('0x42')](_0x347748['query']);_0x50255c[_0x7186('0x43')]=_[_0x7186('0x44')](_0x50255c['model'],_0x50255c[_0x7186('0x41')]);_0x1e32b5[_0x7186('0x45')]=_[_0x7186('0x44')](_0x50255c[_0x7186('0x3f')],qs[_0x7186('0x46')](_0x347748[_0x7186('0x41')][_0x7186('0x46')]));_0x1e32b5[_0x7186('0x45')]=_0x1e32b5[_0x7186('0x45')][_0x7186('0x47')]?_0x1e32b5['attributes']:_0x50255c[_0x7186('0x3f')];if(!_0x347748[_0x7186('0x41')]['hasOwnProperty'](_0x7186('0x48'))){_0x1e32b5[_0x7186('0x33')]=qs['limit'](_0x347748[_0x7186('0x41')][_0x7186('0x33')]);_0x1e32b5[_0x7186('0x30')]=qs[_0x7186('0x30')](_0x347748['query'][_0x7186('0x30')]);}_0x1e32b5[_0x7186('0x49')]=qs[_0x7186('0x4a')](_0x347748[_0x7186('0x41')][_0x7186('0x4a')]);_0x1e32b5[_0x7186('0x4b')]=qs[_0x7186('0x43')](_[_0x7186('0x4c')](_0x347748[_0x7186('0x41')],_0x50255c[_0x7186('0x43')]),_0x5563d9);if(_0x347748[_0x7186('0x41')][_0x7186('0x4d')]){_0x1e32b5[_0x7186('0x4b')]=_[_0x7186('0x4e')](_0x1e32b5['where'],{'$or':_['map'](_0x5563d9,function(_0x1f7a56){if(_0x1f7a56[_0x7186('0x4f')]!=='VIRTUAL'){var _0x2a5f6b={};_0x2a5f6b[_0x1f7a56['name']]={'$like':'%'+_0x347748[_0x7186('0x41')][_0x7186('0x4d')]+'%'};return _0x2a5f6b;}})});}_0x1e32b5=_['merge']({},_0x1e32b5,_0x347748[_0x7186('0x50')]);var _0x4debc3={'where':_0x1e32b5['where']};return db[_0x7186('0x3b')][_0x7186('0x32')](_0x4debc3)['then'](function(_0x38d776){_0x6c0109[_0x7186('0x32')]=_0x38d776;if(_0x347748[_0x7186('0x41')][_0x7186('0x51')]){_0x1e32b5[_0x7186('0x52')]=[{'all':!![]}];}return db[_0x7186('0x3b')]['findAll'](_0x1e32b5);})[_0x7186('0x38')](function(_0x3ed72a){_0x6c0109[_0x7186('0x53')]=_0x3ed72a;return _0x6c0109;})[_0x7186('0x38')](respondWithFilteredResult(_0x2a834e,_0x1e32b5))[_0x7186('0x2b')](handleError(_0x2a834e,null));};exports['show']=function(_0x1125b5,_0x3a90bf){var _0x4dafb0={'raw':!![],'where':{'id':_0x1125b5['params']['id']}},_0x2fe86f={};_0x2fe86f[_0x7186('0x3f')]=_[_0x7186('0x42')](db[_0x7186('0x3b')][_0x7186('0x3c')]);_0x2fe86f[_0x7186('0x41')]=_['keys'](_0x1125b5[_0x7186('0x41')]);_0x2fe86f[_0x7186('0x43')]=_[_0x7186('0x44')](_0x2fe86f[_0x7186('0x3f')],_0x2fe86f['query']);_0x4dafb0['attributes']=_[_0x7186('0x44')](_0x2fe86f[_0x7186('0x3f')],qs['fields'](_0x1125b5[_0x7186('0x41')][_0x7186('0x46')]));_0x4dafb0['attributes']=_0x4dafb0['attributes']['length']?_0x4dafb0[_0x7186('0x45')]:_0x2fe86f[_0x7186('0x3f')];if(_0x1125b5['query']['includeAll']){_0x4dafb0[_0x7186('0x52')]=[{'all':!![]}];}_0x4dafb0=_[_0x7186('0x4e')]({},_0x4dafb0,_0x1125b5['options']);return db['SmsMessage'][_0x7186('0x54')](_0x4dafb0)['then'](handleEntityNotFound(_0x3a90bf,null))['then'](respondWithResult(_0x3a90bf,null))[_0x7186('0x2b')](handleError(_0x3a90bf,null));};exports['create']=function(_0x1bfe25,_0x5f1c28){return db[_0x7186('0x3b')]['create'](_0x1bfe25['body'],{})[_0x7186('0x38')](respondWithResult(_0x5f1c28,0xc9))['catch'](handleError(_0x5f1c28,null));};exports['update']=function(_0x4dd5fb,_0x2304f1){if(_0x4dd5fb[_0x7186('0x55')]['id']){delete _0x4dd5fb['body']['id'];}return db[_0x7186('0x3b')][_0x7186('0x54')]({'where':{'id':_0x4dd5fb[_0x7186('0x56')]['id']}})[_0x7186('0x38')](handleEntityNotFound(_0x2304f1,null))[_0x7186('0x38')](saveUpdates(_0x4dd5fb['body'],null))[_0x7186('0x38')](respondWithResult(_0x2304f1,null))['catch'](handleError(_0x2304f1,null));};exports[_0x7186('0x57')]=function(_0x2e3b7c,_0x55d212){return db[_0x7186('0x3b')][_0x7186('0x54')]({'where':{'id':_0x2e3b7c[_0x7186('0x56')]['id']}})['then'](handleEntityNotFound(_0x55d212,null))['then'](removeEntity(_0x55d212,null))[_0x7186('0x2b')](handleError(_0x55d212,null));};exports[_0x7186('0x58')]=function(_0x33598c,_0x306cad){return db['SmsMessage'][_0x7186('0x58')]()[_0x7186('0x38')](respondWithResult(_0x306cad,null))['catch'](handleError(_0x306cad,null));};var interaction_log=require(_0x7186('0x15'))('sms-interactions');exports[_0x7186('0x59')]=function(_0x156592,_0x3ca471,_0x57adc1){var _0x1573e7={'agent':{},'channel':_0x7186('0x5a')};if(_0x156592[_0x7186('0x55')]['id']){delete _0x156592[_0x7186('0x55')]['id'];}_0x156592['body']['read']=!![];_0x156592[_0x7186('0x55')][_0x7186('0x5b')]=moment()[_0x7186('0x5c')](_0x7186('0x5d'));_0x156592[_0x7186('0x55')]['UserId']=_0x156592[_0x7186('0x55')][_0x7186('0x5e')]||_0x156592[_0x7186('0x5f')]['id'];_0x1573e7[_0x7186('0x60')]['id']=_0x156592[_0x7186('0x55')][_0x7186('0x5e')];return db[_0x7186('0x3b')][_0x7186('0x54')]({'where':{'id':_0x156592[_0x7186('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ca471,null))[_0x7186('0x38')](saveUpdates(_0x156592[_0x7186('0x55')],null))[_0x7186('0x38')](function(_0x41bbb6){if(_0x41bbb6){_0x1573e7[_0x7186('0x28')]=_0x41bbb6['get']({'plain':!![]});return db[_0x7186('0x61')][_0x7186('0x54')]({'where':{'id':_0x41bbb6[_0x7186('0x62')]}});}return null;})[_0x7186('0x38')](handleEntityNotFound(_0x3ca471,null))[_0x7186('0x38')](function(_0xba99a7){if(_0xba99a7){return _0xba99a7['update']({'UserId':_0x156592['body'][_0x7186('0x5e')],'read1stAt':_[_0x7186('0x63')](_0xba99a7[_0x7186('0x64')])?moment()['format'](_0x7186('0x5d')):undefined});}return null;})[_0x7186('0x38')](function(_0x5a857f){if(_0x5a857f){_0x1573e7['interaction']=_0x5a857f[_0x7186('0x65')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x156592[_0x7186('0x5f')]['id'],_0x156592['user'][_0x7186('0x39')],_0x156592[_0x7186('0x5f')][_0x7186('0x66')],_0x1573e7[_0x7186('0x67')]['id'],_0x156592[_0x7186('0x55')]?JSON[_0x7186('0x68')](_0x156592[_0x7186('0x55')]):'null');return respondWithRpcPromise(_0x7186('0x69'),_0x7186('0x6a'),_0x1573e7);}return null;})['then'](function(_0x22c62f){var _0x7b3bcc=_0x7186('0x6b')+_0x22c62f[_0x7186('0x28')][_0x7186('0x6c')];return db[_0x7186('0x6d')][_0x7186('0x41')](_0x7b3bcc,{'type':db['Sequelize'][_0x7186('0x6e')][_0x7186('0x6f')],'raw':!![]})[_0x7186('0x38')](function(_0x5422e2){return _0x5422e2;});})[_0x7186('0x38')](function(_0x4c1578){if(_0x4c1578){_0x1573e7['message']['contact']=_0x4c1578[0x0];if(!_0x156592['body'][_0x7186('0x5e')])return;return db[_0x7186('0x70')][_0x7186('0x54')]({'where':{'id':_0x156592['body'][_0x7186('0x5e')],'role':_0x7186('0x60')},'attributes':['id','name',_0x7186('0x71'),'email',_0x7186('0x72')],'raw':!![]});}return null;})[_0x7186('0x38')](function(_0x37f523){if(!_0x37f523)return null;_0x1573e7[_0x7186('0x28')][_0x7186('0x60')]=_0x37f523;return _0x1573e7;})[_0x7186('0x38')](function(_0x3ce353){if(_0x3ce353){if(_0x156592['body'][_0x7186('0x73')]){_0x1573e7[_0x7186('0x28')][_0x7186('0x74')]=util[_0x7186('0x5c')](_0x7186('0x75'),_0x156592[_0x7186('0x5f')][_0x7186('0x39')]);_0x1573e7[_0x7186('0x28')][_0x7186('0x76')]=_0x1573e7[_0x7186('0x76')];_0x1573e7['message'][_0x7186('0x77')]=_0x1573e7[_0x7186('0x76')];_0x1573e7[_0x7186('0x28')][_0x7186('0x78')]=_0x7186('0x59');return respondWithRpcPromise(_0x7186('0x79'),_0x7186('0x79'),{'event':'acceptmessage','message':_0x1573e7['message']},client9002)[_0x7186('0x38')](function(){return _0x1573e7;});}return _0x1573e7;}return null;})[_0x7186('0x38')](respondWithResult(_0x3ca471,null))[_0x7186('0x2b')](handleError(_0x3ca471,null));};var interaction_log=require('../../config/logger')(_0x7186('0x7a'));exports[_0x7186('0x7b')]=function(_0x325b17,_0xc436ed,_0x5e2738){var _0x32d433={'agent':{},'channel':'sms'};if(_0x325b17[_0x7186('0x55')]['id']){delete _0x325b17[_0x7186('0x55')]['id'];}_0x325b17[_0x7186('0x55')][_0x7186('0x5e')]=_0x325b17[_0x7186('0x55')]['UserId']||_0x325b17[_0x7186('0x5f')]['id'];_0x32d433[_0x7186('0x60')]['id']=_0x325b17['body'][_0x7186('0x5e')];return db[_0x7186('0x3b')][_0x7186('0x54')]({'where':{'id':_0x325b17[_0x7186('0x56')]['id'],'UserId':null}})[_0x7186('0x38')](handleEntityNotFound(_0xc436ed,null))[_0x7186('0x38')](function(_0x19c203){if(_0x19c203){_0x32d433[_0x7186('0x28')]=_0x19c203[_0x7186('0x65')]({'plain':!![]});return db[_0x7186('0x61')][_0x7186('0x54')]({'where':{'id':_0x19c203[_0x7186('0x62')]}});}return null;})[_0x7186('0x38')](handleEntityNotFound(_0xc436ed,null))[_0x7186('0x38')](function(_0x5b5585){if(_0x5b5585){_0x32d433[_0x7186('0x67')]=_0x5b5585[_0x7186('0x65')]({'plain':!![]});interaction_log[_0x7186('0x22')](_0x7186('0x7c'),_0x325b17[_0x7186('0x5f')]['id'],_0x325b17[_0x7186('0x5f')][_0x7186('0x39')],_0x325b17[_0x7186('0x5f')][_0x7186('0x66')],_0x32d433[_0x7186('0x67')]['id'],_0x325b17[_0x7186('0x55')]?JSON['stringify'](_0x325b17[_0x7186('0x55')]):'null');return respondWithRpcPromise(_0x7186('0x7d'),'rejectMessage',_0x32d433);}return null;})[_0x7186('0x38')](function(_0x9dafa2){var _0x218480=_0x7186('0x6b')+_0x9dafa2[_0x7186('0x28')][_0x7186('0x6c')];return db[_0x7186('0x6d')][_0x7186('0x41')](_0x218480,{'type':db[_0x7186('0x7e')][_0x7186('0x6e')][_0x7186('0x6f')],'raw':!![]})['then'](function(_0x224a6e){return _0x224a6e;});})[_0x7186('0x38')](function(_0x161135){if(_0x161135){_0x32d433['message'][_0x7186('0x7f')]=_0x161135[0x0];if(!_0x325b17['body']['UserId'])return;return db[_0x7186('0x70')][_0x7186('0x54')]({'where':{'id':_0x325b17[_0x7186('0x55')]['UserId'],'role':_0x7186('0x60')},'attributes':['id',_0x7186('0x39'),_0x7186('0x71'),_0x7186('0x80'),_0x7186('0x72')],'raw':!![]});}return null;})['then'](function(_0x3154e4){if(!_0x3154e4)return null;_0x32d433[_0x7186('0x28')]['agent']=_0x3154e4;return _0x32d433;})[_0x7186('0x38')](function(_0x2312c4){if(_0x2312c4){_0x2312c4[_0x7186('0x28')]['interface']=util[_0x7186('0x5c')]('SIP/%s',_0x325b17[_0x7186('0x5f')][_0x7186('0x39')]);_0x2312c4[_0x7186('0x28')][_0x7186('0x76')]=_0x32d433[_0x7186('0x76')];_0x2312c4[_0x7186('0x28')][_0x7186('0x77')]=_0x32d433[_0x7186('0x76')];_0x2312c4[_0x7186('0x28')][_0x7186('0x78')]=_0x7186('0x7b');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x2312c4['message']},client9002);return _0x32d433;}return null;})['then'](respondWithResult(_0xc436ed,null))[_0x7186('0x2b')](handleError(_0xc436ed,null));};exports[_0x7186('0x2d')]=function(_0x43e675,_0x20bca1,_0x2fc641){if(_0x43e675[_0x7186('0x55')]['id']){delete _0x43e675[_0x7186('0x55')]['id'];}var _0x4b9172;return db[_0x7186('0x3b')][_0x7186('0x54')]({'where':{'id':_0x43e675[_0x7186('0x56')]['id']}})[_0x7186('0x38')](handleEntityNotFound(_0x20bca1,null))[_0x7186('0x38')](function(_0x3cd857){if(_0x3cd857){_0x4b9172=_0x3cd857;return db[_0x7186('0x81')]['find']({'where':{'id':_0x3cd857[_0x7186('0x82')]}});}})[_0x7186('0x38')](handleEntityNotFound(_0x20bca1,null))[_0x7186('0x38')](function(_0x1f8cf3){if(_0x1f8cf3){logger[_0x7186('0x24')](_0x7186('0x25'),'status',_0x7186('0x83'),_0x1f8cf3[_0x7186('0x4f')],util['inspect'](_0x43e675[_0x7186('0x55')],{'showHidden':![],'depth':null}));switch(_0x1f8cf3['type']){case _0x7186('0x84'):if(_0x43e675[_0x7186('0x55')]['MessageSid']&&_0x43e675[_0x7186('0x55')][_0x7186('0x85')]===_0x4b9172[_0x7186('0x86')]){return _0x4b9172[_0x7186('0x37')]({'read':!![]});}else{logger[_0x7186('0x26')](_0x7186('0x87'),'status','twilio',util['inspect'](_0x43e675[_0x7186('0x55')],{'showHidden':![],'depth':null}));}break;case _0x7186('0x88'):if(_0x43e675[_0x7186('0x55')][_0x7186('0x89')]&&_0x43e675[_0x7186('0x55')][_0x7186('0x89')]===_0x4b9172['messageId']&&_[_0x7186('0x8a')](['sent',_0x7186('0x8b')],_0x43e675[_0x7186('0x55')][_0x7186('0x8c')])>=0x0){return _0x4b9172[_0x7186('0x37')]({'read':!![]});}else{logger[_0x7186('0x26')](_0x7186('0x87'),_0x7186('0x2d'),_0x7186('0x8d'),util['inspect'](_0x43e675['body'],{'showHidden':![],'depth':null}));}break;case _0x7186('0x8e'):var _0x2dc2d0=_0x43e675[_0x7186('0x55')][_0x7186('0x8f')][0x0];if(_0x2dc2d0['status'][_0x7186('0x90')]===_0x7186('0x91')){return _0x4b9172['update']({'read':!![]});}else{logger[_0x7186('0x26')](_0x7186('0x87'),_0x7186('0x2d'),_0x7186('0x8e'),util[_0x7186('0x92')](_0x43e675[_0x7186('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x4b9172;}})[_0x7186('0x38')](respondWithResult(_0x20bca1,null))[_0x7186('0x2b')](handleError(_0x20bca1,null));}; \ No newline at end of file +var _0x66fa=['delivered','results','infobip','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','client','http','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','stack','name','index','map','SmsMessage','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteractionId','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','email','reject','rejectmessage','SmsAccount','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0x66fa,0x117));var _0xa66f=function(_0x499036,_0x2e2822){_0x499036=_0x499036-0x0;var _0x1b18f4=_0x66fa[_0x499036];return _0x1b18f4;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];config[_0xa66f('0x15')]=_[_0xa66f('0x16')](config[_0xa66f('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa66f('0x15')]));require('./smsMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x17')][_0xa66f('0x18')]({'port':0x232c});var client9002=jayson[_0xa66f('0x17')][_0xa66f('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xd348f9,_0x567d4f,_0x5510dc,_0x19b5ac){return new BPromise(function(_0x32d338,_0x295acf){var _0x403f4d=_0x19b5ac||client;return _0x403f4d['request'](_0xd348f9,_0x5510dc)[_0xa66f('0x19')](function(_0x55b59d){logger['info'](_0xa66f('0x1a'),_0x567d4f,_0xa66f('0x1b'));logger[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x567d4f,_0xa66f('0x1b'),JSON[_0xa66f('0x1e')](_0x55b59d));if(_0x55b59d[_0xa66f('0x1f')]){if(_0x55b59d[_0xa66f('0x1f')][_0xa66f('0x20')]===0x1f4){logger[_0xa66f('0x1f')](_0xa66f('0x1a'),_0x567d4f,_0x55b59d[_0xa66f('0x1f')][_0xa66f('0x21')]);return _0x295acf(_0x55b59d[_0xa66f('0x1f')][_0xa66f('0x21')]);}logger['error'](_0xa66f('0x1a'),_0x567d4f,_0x55b59d[_0xa66f('0x1f')][_0xa66f('0x21')]);return _0x32d338(_0x55b59d[_0xa66f('0x1f')]['message']);}else{logger[_0xa66f('0x22')](_0xa66f('0x1a'),_0x567d4f,_0xa66f('0x1b'));_0x32d338(_0x55b59d[_0xa66f('0x23')]['message']);}})['catch'](function(_0xed98b9){logger['error'](_0xa66f('0x1a'),_0x567d4f,_0xed98b9);_0x295acf(_0xed98b9);});});}function respondWithStatusCode(_0xc661f2,_0x384164){_0x384164=_0x384164||0xcc;return function(_0x57da7f){if(_0x57da7f){return _0xc661f2[_0xa66f('0x24')](_0x384164);}return _0xc661f2[_0xa66f('0x25')](_0x384164)[_0xa66f('0x26')]();};}function respondWithResult(_0x238eb2,_0x17c103){_0x17c103=_0x17c103||0xc8;return function(_0x236046){if(_0x236046){return _0x238eb2[_0xa66f('0x25')](_0x17c103)[_0xa66f('0x27')](_0x236046);}};}function respondWithFilteredResult(_0x20ee67,_0x117d03){return function(_0x45f71c){if(_0x45f71c){var _0x63650b=typeof _0x117d03[_0xa66f('0x28')]===_0xa66f('0x29')&&typeof _0x117d03['limit']==='undefined';var _0x38daac=_0x45f71c[_0xa66f('0x2a')];var _0x55f309=_0x63650b?0x0:_0x117d03[_0xa66f('0x28')];var _0x2de5f3=_0x63650b?_0x45f71c['count']:_0x117d03[_0xa66f('0x28')]+_0x117d03[_0xa66f('0x2b')];var _0x9d78d5;if(_0x2de5f3>=_0x38daac){_0x2de5f3=_0x38daac;_0x9d78d5=0xc8;}else{_0x9d78d5=0xce;}_0x20ee67[_0xa66f('0x25')](_0x9d78d5);return _0x20ee67[_0xa66f('0x2c')]('Content-Range',_0x55f309+'-'+_0x2de5f3+'/'+_0x38daac)[_0xa66f('0x27')](_0x45f71c);}return null;};}function patchUpdates(_0x4fcdc1){return function(_0x306b35){try{jsonpatch[_0xa66f('0x2d')](_0x306b35,_0x4fcdc1,!![]);}catch(_0x2e4dc8){return BPromise['reject'](_0x2e4dc8);}return _0x306b35[_0xa66f('0x2e')]();};}function saveUpdates(_0xadc17d,_0x4f1668){return function(_0x1a5d4a){if(_0x1a5d4a){return _0x1a5d4a[_0xa66f('0x2f')](_0xadc17d)[_0xa66f('0x19')](function(_0x3e7ac5){return _0x3e7ac5;});}return null;};}function removeEntity(_0x10a782,_0x2452d2){return function(_0x25c74c){if(_0x25c74c){return _0x25c74c[_0xa66f('0x30')]()[_0xa66f('0x19')](function(){_0x10a782[_0xa66f('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17984d,_0x5bf736){return function(_0x1c7eda){if(!_0x1c7eda){_0x17984d[_0xa66f('0x24')](0x194);}return _0x1c7eda;};}function handleError(_0x9c7756,_0x3b9261){_0x3b9261=_0x3b9261||0x1f4;return function(_0x3722d3){logger[_0xa66f('0x1f')](_0x3722d3[_0xa66f('0x31')]);if(_0x3722d3[_0xa66f('0x32')]){delete _0x3722d3['name'];}_0x9c7756[_0xa66f('0x25')](_0x3b9261)['send'](_0x3722d3);};}exports[_0xa66f('0x33')]=function(_0x45eeb8,_0x2ed1fb){var _0x47b21a={},_0x4d60f9={},_0x1b9174={'count':0x0,'rows':[]};var _0x4214db=_[_0xa66f('0x34')](db[_0xa66f('0x35')][_0xa66f('0x36')],function(_0x581dca){return{'name':_0x581dca['fieldName'],'type':_0x581dca['type'][_0xa66f('0x37')]};});_0x4d60f9['model']=_['map'](_0x4214db,'name');_0x4d60f9[_0xa66f('0x38')]=_['keys'](_0x45eeb8[_0xa66f('0x38')]);_0x4d60f9[_0xa66f('0x39')]=_[_0xa66f('0x3a')](_0x4d60f9[_0xa66f('0x3b')],_0x4d60f9[_0xa66f('0x38')]);_0x47b21a[_0xa66f('0x3c')]=_[_0xa66f('0x3a')](_0x4d60f9[_0xa66f('0x3b')],qs[_0xa66f('0x3d')](_0x45eeb8[_0xa66f('0x38')][_0xa66f('0x3d')]));_0x47b21a[_0xa66f('0x3c')]=_0x47b21a[_0xa66f('0x3c')][_0xa66f('0x3e')]?_0x47b21a['attributes']:_0x4d60f9[_0xa66f('0x3b')];if(!_0x45eeb8[_0xa66f('0x38')]['hasOwnProperty'](_0xa66f('0x3f'))){_0x47b21a['limit']=qs[_0xa66f('0x2b')](_0x45eeb8[_0xa66f('0x38')]['limit']);_0x47b21a[_0xa66f('0x28')]=qs[_0xa66f('0x28')](_0x45eeb8[_0xa66f('0x38')]['offset']);}_0x47b21a[_0xa66f('0x40')]=qs['sort'](_0x45eeb8[_0xa66f('0x38')][_0xa66f('0x41')]);_0x47b21a[_0xa66f('0x42')]=qs[_0xa66f('0x39')](_[_0xa66f('0x43')](_0x45eeb8[_0xa66f('0x38')],_0x4d60f9[_0xa66f('0x39')]),_0x4214db);if(_0x45eeb8['query'][_0xa66f('0x44')]){_0x47b21a[_0xa66f('0x42')]=_[_0xa66f('0x45')](_0x47b21a[_0xa66f('0x42')],{'$or':_[_0xa66f('0x34')](_0x4214db,function(_0x50a5ac){if(_0x50a5ac['type']!==_0xa66f('0x46')){var _0x356b7c={};_0x356b7c[_0x50a5ac[_0xa66f('0x32')]]={'$like':'%'+_0x45eeb8[_0xa66f('0x38')][_0xa66f('0x44')]+'%'};return _0x356b7c;}})});}_0x47b21a=_[_0xa66f('0x45')]({},_0x47b21a,_0x45eeb8['options']);var _0x18f1b5={'where':_0x47b21a[_0xa66f('0x42')]};return db[_0xa66f('0x35')]['count'](_0x18f1b5)['then'](function(_0x4568f7){_0x1b9174[_0xa66f('0x2a')]=_0x4568f7;if(_0x45eeb8[_0xa66f('0x38')]['includeAll']){_0x47b21a['include']=[{'all':!![]}];}return db['SmsMessage'][_0xa66f('0x47')](_0x47b21a);})[_0xa66f('0x19')](function(_0x40d3b6){_0x1b9174[_0xa66f('0x48')]=_0x40d3b6;return _0x1b9174;})[_0xa66f('0x19')](respondWithFilteredResult(_0x2ed1fb,_0x47b21a))[_0xa66f('0x49')](handleError(_0x2ed1fb,null));};exports[_0xa66f('0x4a')]=function(_0x15de06,_0x56758a){var _0x1a299c={'raw':!![],'where':{'id':_0x15de06[_0xa66f('0x4b')]['id']}},_0x962415={};_0x962415[_0xa66f('0x3b')]=_[_0xa66f('0x4c')](db[_0xa66f('0x35')]['rawAttributes']);_0x962415[_0xa66f('0x38')]=_[_0xa66f('0x4c')](_0x15de06[_0xa66f('0x38')]);_0x962415[_0xa66f('0x39')]=_[_0xa66f('0x3a')](_0x962415['model'],_0x962415[_0xa66f('0x38')]);_0x1a299c['attributes']=_[_0xa66f('0x3a')](_0x962415['model'],qs['fields'](_0x15de06[_0xa66f('0x38')][_0xa66f('0x3d')]));_0x1a299c[_0xa66f('0x3c')]=_0x1a299c[_0xa66f('0x3c')][_0xa66f('0x3e')]?_0x1a299c[_0xa66f('0x3c')]:_0x962415['model'];if(_0x15de06[_0xa66f('0x38')][_0xa66f('0x4d')]){_0x1a299c[_0xa66f('0x4e')]=[{'all':!![]}];}_0x1a299c=_[_0xa66f('0x45')]({},_0x1a299c,_0x15de06['options']);return db[_0xa66f('0x35')]['find'](_0x1a299c)[_0xa66f('0x19')](handleEntityNotFound(_0x56758a,null))[_0xa66f('0x19')](respondWithResult(_0x56758a,null))[_0xa66f('0x49')](handleError(_0x56758a,null));};exports[_0xa66f('0x4f')]=function(_0x167015,_0x3a201f){return db[_0xa66f('0x35')]['create'](_0x167015[_0xa66f('0x50')],{})[_0xa66f('0x19')](respondWithResult(_0x3a201f,0xc9))[_0xa66f('0x49')](handleError(_0x3a201f,null));};exports[_0xa66f('0x2f')]=function(_0x38decb,_0x45989a){if(_0x38decb[_0xa66f('0x50')]['id']){delete _0x38decb[_0xa66f('0x50')]['id'];}return db[_0xa66f('0x35')]['find']({'where':{'id':_0x38decb['params']['id']}})[_0xa66f('0x19')](handleEntityNotFound(_0x45989a,null))[_0xa66f('0x19')](saveUpdates(_0x38decb[_0xa66f('0x50')],null))[_0xa66f('0x19')](respondWithResult(_0x45989a,null))[_0xa66f('0x49')](handleError(_0x45989a,null));};exports[_0xa66f('0x30')]=function(_0x8bea2b,_0x4b10cf){return db[_0xa66f('0x35')][_0xa66f('0x51')]({'where':{'id':_0x8bea2b[_0xa66f('0x4b')]['id']}})[_0xa66f('0x19')](handleEntityNotFound(_0x4b10cf,null))['then'](removeEntity(_0x4b10cf,null))[_0xa66f('0x49')](handleError(_0x4b10cf,null));};exports[_0xa66f('0x52')]=function(_0x19ff30,_0x3bf85a){return db[_0xa66f('0x35')][_0xa66f('0x52')]()['then'](respondWithResult(_0x3bf85a,null))['catch'](handleError(_0x3bf85a,null));};var interaction_log=require(_0xa66f('0x12'))(_0xa66f('0x53'));exports[_0xa66f('0x54')]=function(_0x52edb3,_0x442dd1,_0x39fb04){var _0x310d87={'agent':{},'channel':_0xa66f('0x55')};if(_0x52edb3[_0xa66f('0x50')]['id']){delete _0x52edb3[_0xa66f('0x50')]['id'];}_0x52edb3[_0xa66f('0x50')][_0xa66f('0x56')]=!![];_0x52edb3[_0xa66f('0x50')]['readAt']=moment()[_0xa66f('0x57')](_0xa66f('0x58'));_0x52edb3[_0xa66f('0x50')][_0xa66f('0x59')]=_0x52edb3[_0xa66f('0x50')][_0xa66f('0x59')]||_0x52edb3[_0xa66f('0x5a')]['id'];_0x310d87[_0xa66f('0x5b')]['id']=_0x52edb3['body']['UserId'];return db[_0xa66f('0x35')][_0xa66f('0x51')]({'where':{'id':_0x52edb3[_0xa66f('0x4b')]['id'],'UserId':null}})[_0xa66f('0x19')](handleEntityNotFound(_0x442dd1,null))[_0xa66f('0x19')](saveUpdates(_0x52edb3['body'],null))[_0xa66f('0x19')](function(_0x4c2b68){if(_0x4c2b68){_0x310d87[_0xa66f('0x21')]=_0x4c2b68[_0xa66f('0x5c')]({'plain':!![]});return db[_0xa66f('0x5d')][_0xa66f('0x51')]({'where':{'id':_0x4c2b68['SmsInteractionId']}});}return null;})[_0xa66f('0x19')](handleEntityNotFound(_0x442dd1,null))[_0xa66f('0x19')](function(_0x31c11b){if(_0x31c11b){return _0x31c11b[_0xa66f('0x2f')]({'UserId':_0x52edb3[_0xa66f('0x50')][_0xa66f('0x59')],'read1stAt':_[_0xa66f('0x5e')](_0x31c11b[_0xa66f('0x5f')])?moment()[_0xa66f('0x57')](_0xa66f('0x58')):undefined});}return null;})[_0xa66f('0x19')](function(_0x3eb1f5){if(_0x3eb1f5){_0x310d87['interaction']=_0x3eb1f5[_0xa66f('0x5c')]({'plain':!![]});interaction_log[_0xa66f('0x22')](_0xa66f('0x60'),_0x52edb3[_0xa66f('0x5a')]['id'],_0x52edb3[_0xa66f('0x5a')][_0xa66f('0x32')],_0x52edb3[_0xa66f('0x5a')][_0xa66f('0x61')],_0x310d87['interaction']['id'],_0x52edb3[_0xa66f('0x50')]?JSON[_0xa66f('0x1e')](_0x52edb3[_0xa66f('0x50')]):_0xa66f('0x62'));return respondWithRpcPromise(_0xa66f('0x63'),_0xa66f('0x64'),_0x310d87);}return null;})[_0xa66f('0x19')](function(_0x1f14d1){var _0x4b5785='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1f14d1[_0xa66f('0x21')][_0xa66f('0x65')];return db[_0xa66f('0x66')]['query'](_0x4b5785,{'type':db['Sequelize'][_0xa66f('0x67')][_0xa66f('0x68')],'raw':!![]})[_0xa66f('0x19')](function(_0x340dba){return _0x340dba;});})['then'](function(_0x43be19){if(_0x43be19){_0x310d87[_0xa66f('0x21')][_0xa66f('0x69')]=_0x43be19[0x0];if(!_0x52edb3[_0xa66f('0x50')][_0xa66f('0x59')])return;return db[_0xa66f('0x6a')][_0xa66f('0x51')]({'where':{'id':_0x52edb3[_0xa66f('0x50')]['UserId'],'role':_0xa66f('0x5b')},'attributes':['id',_0xa66f('0x32'),'fullname','email',_0xa66f('0x6b')],'raw':!![]});}return null;})[_0xa66f('0x19')](function(_0x4ee8e7){if(!_0x4ee8e7)return null;_0x310d87[_0xa66f('0x21')]['agent']=_0x4ee8e7;return _0x310d87;})[_0xa66f('0x19')](function(_0x558380){if(_0x558380){if(_0x52edb3['body']['manual']){_0x310d87[_0xa66f('0x21')][_0xa66f('0x6c')]=util[_0xa66f('0x57')](_0xa66f('0x6d'),_0x52edb3[_0xa66f('0x5a')][_0xa66f('0x32')]);_0x310d87[_0xa66f('0x21')][_0xa66f('0x6e')]=_0x310d87[_0xa66f('0x6e')];_0x310d87[_0xa66f('0x21')][_0xa66f('0x6f')]=_0x310d87[_0xa66f('0x6e')];_0x310d87[_0xa66f('0x21')][_0xa66f('0x70')]=_0xa66f('0x54');return respondWithRpcPromise(_0xa66f('0x71'),'EventManager',{'event':_0xa66f('0x72'),'message':_0x310d87['message']},client9002)[_0xa66f('0x19')](function(){return _0x310d87;});}return _0x310d87;}return null;})['then'](respondWithResult(_0x442dd1,null))[_0xa66f('0x49')](handleError(_0x442dd1,null));};var interaction_log=require(_0xa66f('0x12'))(_0xa66f('0x53'));exports['reject']=function(_0x4ea501,_0x1a1d63,_0x30bbee){var _0x38b869={'agent':{},'channel':_0xa66f('0x55')};if(_0x4ea501[_0xa66f('0x50')]['id']){delete _0x4ea501[_0xa66f('0x50')]['id'];}_0x4ea501[_0xa66f('0x50')]['UserId']=_0x4ea501[_0xa66f('0x50')][_0xa66f('0x59')]||_0x4ea501[_0xa66f('0x5a')]['id'];_0x38b869[_0xa66f('0x5b')]['id']=_0x4ea501[_0xa66f('0x50')][_0xa66f('0x59')];return db[_0xa66f('0x35')][_0xa66f('0x51')]({'where':{'id':_0x4ea501[_0xa66f('0x4b')]['id'],'UserId':null}})[_0xa66f('0x19')](handleEntityNotFound(_0x1a1d63,null))[_0xa66f('0x19')](function(_0x9c7e02){if(_0x9c7e02){_0x38b869[_0xa66f('0x21')]=_0x9c7e02['get']({'plain':!![]});return db[_0xa66f('0x5d')][_0xa66f('0x51')]({'where':{'id':_0x9c7e02[_0xa66f('0x73')]}});}return null;})[_0xa66f('0x19')](handleEntityNotFound(_0x1a1d63,null))[_0xa66f('0x19')](function(_0x31db5c){if(_0x31db5c){_0x38b869[_0xa66f('0x74')]=_0x31db5c[_0xa66f('0x5c')]({'plain':!![]});interaction_log[_0xa66f('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ea501[_0xa66f('0x5a')]['id'],_0x4ea501['user'][_0xa66f('0x32')],_0x4ea501['user'][_0xa66f('0x61')],_0x38b869['interaction']['id'],_0x4ea501[_0xa66f('0x50')]?JSON['stringify'](_0x4ea501[_0xa66f('0x50')]):_0xa66f('0x62'));return respondWithRpcPromise(_0xa66f('0x75'),_0xa66f('0x76'),_0x38b869);}return null;})[_0xa66f('0x19')](function(_0x4539ab){var _0x4d7bae=_0xa66f('0x77')+_0x4539ab[_0xa66f('0x21')][_0xa66f('0x65')];return db['sequelize'][_0xa66f('0x38')](_0x4d7bae,{'type':db[_0xa66f('0x78')]['QueryTypes'][_0xa66f('0x68')],'raw':!![]})[_0xa66f('0x19')](function(_0x5ee6d5){return _0x5ee6d5;});})['then'](function(_0x125bf4){if(_0x125bf4){_0x38b869[_0xa66f('0x21')][_0xa66f('0x69')]=_0x125bf4[0x0];if(!_0x4ea501[_0xa66f('0x50')][_0xa66f('0x59')])return;return db['User'][_0xa66f('0x51')]({'where':{'id':_0x4ea501[_0xa66f('0x50')]['UserId'],'role':_0xa66f('0x5b')},'attributes':['id',_0xa66f('0x32'),'fullname',_0xa66f('0x79'),_0xa66f('0x6b')],'raw':!![]});}return null;})[_0xa66f('0x19')](function(_0x3a30ba){if(!_0x3a30ba)return null;_0x38b869[_0xa66f('0x21')]['agent']=_0x3a30ba;return _0x38b869;})[_0xa66f('0x19')](function(_0x247b26){if(_0x247b26){_0x247b26[_0xa66f('0x21')][_0xa66f('0x6c')]=util[_0xa66f('0x57')](_0xa66f('0x6d'),_0x4ea501['user'][_0xa66f('0x32')]);_0x247b26[_0xa66f('0x21')][_0xa66f('0x6e')]=_0x38b869[_0xa66f('0x6e')];_0x247b26[_0xa66f('0x21')][_0xa66f('0x6f')]=_0x38b869[_0xa66f('0x6e')];_0x247b26['message']['event']=_0xa66f('0x7a');respondWithRpcPromise('EventManager',_0xa66f('0x71'),{'event':_0xa66f('0x7b'),'message':_0x247b26['message']},client9002);return _0x38b869;}return null;})[_0xa66f('0x19')](respondWithResult(_0x1a1d63,null))[_0xa66f('0x49')](handleError(_0x1a1d63,null));};exports[_0xa66f('0x25')]=function(_0x598586,_0x4a2409,_0xfe65cc){if(_0x598586['body']['id']){delete _0x598586[_0xa66f('0x50')]['id'];}var _0x275957;return db[_0xa66f('0x35')]['find']({'where':{'id':_0x598586[_0xa66f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a2409,null))[_0xa66f('0x19')](function(_0xfdb067){if(_0xfdb067){_0x275957=_0xfdb067;return db[_0xa66f('0x7c')][_0xa66f('0x51')]({'where':{'id':_0xfdb067['SmsAccountId']}});}})[_0xa66f('0x19')](handleEntityNotFound(_0x4a2409,null))[_0xa66f('0x19')](function(_0x30e351){if(_0x30e351){logger[_0xa66f('0x1c')](_0xa66f('0x1d'),_0xa66f('0x25'),'received\x20delivery\x20report\x20from',_0x30e351[_0xa66f('0x7d')],util[_0xa66f('0x7e')](_0x598586[_0xa66f('0x50')],{'showHidden':![],'depth':null}));switch(_0x30e351[_0xa66f('0x7d')]){case _0xa66f('0x7f'):if(_0x598586['body']['MessageSid']&&_0x598586[_0xa66f('0x50')][_0xa66f('0x80')]===_0x275957[_0xa66f('0x81')]){return _0x275957[_0xa66f('0x2f')]({'read':!![]});}else{logger[_0xa66f('0x1f')](_0xa66f('0x82'),_0xa66f('0x25'),_0xa66f('0x7f'),util[_0xa66f('0x7e')](_0x598586[_0xa66f('0x50')],{'showHidden':![],'depth':null}));}break;case _0xa66f('0x83'):if(_0x598586[_0xa66f('0x50')]['MessageUUID']&&_0x598586[_0xa66f('0x50')][_0xa66f('0x84')]===_0x275957['messageId']&&_[_0xa66f('0x85')]([_0xa66f('0x86'),_0xa66f('0x87')],_0x598586['body']['Status'])>=0x0){return _0x275957[_0xa66f('0x2f')]({'read':!![]});}else{logger['error'](_0xa66f('0x82'),_0xa66f('0x25'),'plivio',util[_0xa66f('0x7e')](_0x598586[_0xa66f('0x50')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xa568ed=_0x598586[_0xa66f('0x50')][_0xa66f('0x88')][0x0];if(_0xa568ed[_0xa66f('0x25')]['groupName']==='DELIVERED'){return _0x275957[_0xa66f('0x2f')]({'read':!![]});}else{logger[_0xa66f('0x1f')](_0xa66f('0x82'),_0xa66f('0x25'),_0xa66f('0x89'),util[_0xa66f('0x7e')](_0x598586[_0xa66f('0x50')],{'showHidden':![],'depth':null}));}break;}return _0x275957;}})[_0xa66f('0x19')](respondWithResult(_0x4a2409,null))[_0xa66f('0x49')](handleError(_0x4a2409,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index fc88888..dabdd22 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 _0xa7c2=['save','update','remove','emit','hook','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x3110d7,_0x1a9b39){var _0x21c07a=function(_0x59d4f6){while(--_0x59d4f6){_0x3110d7['push'](_0x3110d7['shift']());}};_0x21c07a(++_0x1a9b39);}(_0xa7c2,0x17f));var _0x2a7c=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xa7c2[_0x243b2f];return _0xcb3c2d;};'use strict';var EventEmitter=require(_0x2a7c('0x0'));var SmsMessage=require(_0x2a7c('0x1'))['db'][_0x2a7c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2a7c('0x3')](0x0);var events={'afterCreate':_0x2a7c('0x4'),'afterUpdate':_0x2a7c('0x5'),'afterDestroy':_0x2a7c('0x6')};function emitEvent(_0x1ec875){return function(_0x501f66,_0x5bbee,_0x1feec0){SmsMessageEvents[_0x2a7c('0x7')](_0x1ec875+':'+_0x501f66['id'],_0x501f66);SmsMessageEvents[_0x2a7c('0x7')](_0x1ec875,_0x501f66);_0x1feec0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2a7c('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xbb3a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove'];(function(_0x3a570f,_0x3c6617){var _0x2134d8=function(_0x3d4ee5){while(--_0x3d4ee5){_0x3a570f['push'](_0x3a570f['shift']());}};_0x2134d8(++_0x3c6617);}(_0xbb3a,0xd6));var _0xabb3=function(_0x2a4b69,_0x1af3a9){_0x2a4b69=_0x2a4b69-0x0;var _0x177c03=_0xbb3a[_0x2a4b69];return _0x177c03;};'use strict';var EventEmitter=require(_0xabb3('0x0'));var SmsMessage=require(_0xabb3('0x1'))['db'][_0xabb3('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xabb3('0x3')](0x0);var events={'afterCreate':_0xabb3('0x4'),'afterUpdate':'update','afterDestroy':_0xabb3('0x5')};function emitEvent(_0x59ef0f){return function(_0x19bd19,_0xdcd09e,_0xfe3488){SmsMessageEvents[_0xabb3('0x6')](_0x59ef0f+':'+_0x19bd19['id'],_0x19bd19);SmsMessageEvents[_0xabb3('0x6')](_0x59ef0f,_0x19bd19);_0xfe3488(null);};}for(var e in events){if(events[_0xabb3('0x7')](e)){var event=events[e];SmsMessage[_0xabb3('0x8')](e,emitEvent(event));}}module[_0xabb3('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 e8db114..777ca20 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 _0x1d53=['afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','queued_count','head','clickSend','plivo','format','https://api.plivo.com/v1/Account/%s/Message/','authId','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','/messages','applicationId','Basic\x20%s','intelepeer','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','fti_sms_messages','body','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','createdAt','catch','error','out','find','type','twilio','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','update'];(function(_0x1cb7d7,_0x24a966){var _0x4904b9=function(_0x104213){while(--_0x104213){_0x1cb7d7['push'](_0x1cb7d7['shift']());}};_0x4904b9(++_0x24a966);}(_0x1d53,0x140));var _0x31d5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1d53[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x31d5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31d5('0x1'));var moment=require(_0x31d5('0x2'));var BPromise=require(_0x31d5('0x3'));var rp=require(_0x31d5('0x4'));var fs=require('fs');var path=require(_0x31d5('0x5'));var rimraf=require(_0x31d5('0x6'));var config=require(_0x31d5('0x7'));var attributes=require('./smsMessage.attributes');module[_0x31d5('0x8')]=function(_0x3768a6,_0x284a2e){return _0x3768a6[_0x31d5('0x9')](_0x31d5('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x31d5('0xb'),'fields':[_0x31d5('0xb')]},{'name':_0x31d5('0xc'),'fields':[_0x31d5('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf3d60e,_0x1896e6,_0x55ba93){var _0x5400ff=_0x3768a6['models'];var _0x3de821=_0xf3d60e[_0x31d5('0xe')]({'plain':!![]});if(_0x3de821[_0x31d5('0xf')]['toLowerCase']()==='in'||_0x3de821['direction'][_0x31d5('0x10')]()==='out'&&!_0x3de821[_0x31d5('0x11')]&&!_[_0x31d5('0x12')](_0x3de821[_0x31d5('0x13')])&&!_[_0x31d5('0x12')](_0x3de821[_0x31d5('0x14')])){_0x5400ff[_0x31d5('0x15')]['findOne']({'where':{'id':_0x3de821['SmsInteractionId']}})[_0x31d5('0x16')](function(_0xa024d3){if(_0xa024d3){_0xa024d3['update']({'lastMsgAt':_0x3de821[_0x31d5('0x17')],'lastMsgDirection':_0x3de821[_0x31d5('0xf')][_0x31d5('0x10')]()});}})[_0x31d5('0x18')](function(_0x5ecca4){console[_0x31d5('0x19')](_0x5ecca4);});}if(_0x3de821[_0x31d5('0xf')]===_0x31d5('0x1a')&&!_0x3de821['secret']){var _0x3f309e;_0x5400ff['SmsAccount'][_0x31d5('0x1b')]({'where':{'id':_0x3de821['SmsAccountId']},'raw':!![]})['then'](function(_0x77b7b9){_0x3f309e=_0x77b7b9;if(_0x3f309e&&_0x3f309e[_0x31d5('0x1c')]){switch(_0x3f309e['type']){case _0x31d5('0x1d'):var _0x3f0fbb=require('twilio');if(_0x3f309e['accountSid']&&_0x3f309e[_0x31d5('0x1e')]&&_0x3f309e['phone']){var _0x1fa7e2=new _0x3f0fbb(_0x3f309e['accountSid'],_0x3f309e[_0x31d5('0x1e')]);_0x1fa7e2[_0x31d5('0x1f')][_0x31d5('0x20')]({'body':_0x3de821[_0x31d5('0xd')],'to':_0x3de821[_0x31d5('0x21')],'from':_0x3f309e[_0x31d5('0x21')],'statusCallback':_0x3f309e[_0x31d5('0x22')]+_0x31d5('0x23')+_0x3de821['id']+_0x31d5('0x24')+_0x3f309e[_0x31d5('0x25')]})['then'](function(_0x1ec541){if(_0x1ec541[_0x31d5('0x26')]){return _0xf3d60e[_0x31d5('0x27')]({'messageId':_0x1ec541[_0x31d5('0x26')]});}})[_0x31d5('0x18')](function(_0x5633b7){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),'twilio',util[_0x31d5('0x29')](_0x5633b7,{'showHidden':![],'depth':null}));});}else{logger[_0x31d5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x31d5('0x2a'):var _0x237289=_0x31d5('0x2b');if(_0x3f309e[_0x31d5('0x2c')]&&_0x3f309e[_0x31d5('0x2d')]){var _0x5a0c7f={'recipient':[_0x3de821['phone']],'message':_0x3de821[_0x31d5('0xd')],'message_type':_0x3f309e['smsMethod']};if(_0x3f309e[_0x31d5('0x2e')]&&_0x3f309e[_0x31d5('0x2e')]!=='SI'){_0x5a0c7f[_0x31d5('0x2f')]=_0x3f309e['phone'];}var _0x125306={'url':_0x237289+_0x31d5('0x30')+_0x3f309e['username']+_0x31d5('0x31')+_0x3f309e[_0x31d5('0x2d')],'method':_0x31d5('0x32')};rp(_0x125306)['then'](function(_0x4bf853){var _0x1dda14=_0x4bf853[_0x31d5('0x33')](';');var _0x1d1ed4={'user_key':_0x1dda14[0x0],'session_key':_0x1dda14[0x1]};_0x125306={'url':_0x237289+_0x31d5('0x34'),'method':_0x31d5('0x35'),'headers':{'user_key':_0x1d1ed4[_0x31d5('0x36')],'Session_key':_0x1d1ed4['session_key']},'json':!![],'body':_0x5a0c7f};return rp(_0x125306);})['then'](function(_0x1a1e55){if(_0x1a1e55[_0x31d5('0x37')]>=0x1){var _0x17b0e7={'messageId':_0x1a1e55[_0x31d5('0x38')]};if(_0x3f309e[_0x31d5('0x2e')]!=='GP'||!_0x3f309e[_0x31d5('0x39')]){_0x17b0e7['read']=!![];}return _0xf3d60e['update'](_0x17b0e7);}else{return logger[_0x31d5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),_0x31d5('0x2a'),util[_0x31d5('0x29')](_0x1a1e55,{'showHidden':![],'depth':null}));}})[_0x31d5('0x18')](function(_0x4dd0fc){return logger[_0x31d5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),_0x31d5('0x2a'),util[_0x31d5('0x29')](_0x4dd0fc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x31d5('0x3a'),_0x31d5('0x28'),'skebby',_0x31d5('0x3b'));}break;case _0x31d5('0x3c'):if(_0x3f309e[_0x31d5('0x1e')]){var _0x437dc5={'recipient':_0x3de821[_0x31d5('0x21')],'message':_0x3de821[_0x31d5('0xd')],'sender':_0x3f309e['senderString']||_0x3f309e['phone'],'authorization':_0x3f309e['authToken']};var _0x1896e6={'method':_0x31d5('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x437dc5,'json':!![]};rp(_0x1896e6)[_0x31d5('0x16')](function(_0x9ae0d1){var _0x3251b9={'messageId':_0x9ae0d1[_0x31d5('0x3d')]};if(!_0x3f309e[_0x31d5('0x39')]){_0x3251b9[_0x31d5('0x3e')]=!![];}return _0xf3d60e[_0x31d5('0x27')](_0x3251b9);})[_0x31d5('0x18')](function(_0x418b4c){logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x3c'),util[_0x31d5('0x29')](_0x418b4c,{'showHidden':![],'depth':null}));});}else{logger[_0x31d5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),'connectel',_0x31d5('0x3f'));}break;case _0x31d5('0x40'):if(_0x3f309e['username']&&_0x3f309e[_0x31d5('0x2d')]){var _0x437dc5={'messages':[{'source':_0x31d5('0x41'),'to':_0x3de821['phone'],'body':_0x3de821[_0x31d5('0xd')],'from':_0x3f309e[_0x31d5('0x42')]||_0x3f309e[_0x31d5('0x21')]}]};var _0x397b3e=util['format'](_0x31d5('0x43'),_0x3f309e[_0x31d5('0x2c')],_0x3f309e[_0x31d5('0x2d')]);var _0x1896e6={'method':_0x31d5('0x35'),'uri':_0x31d5('0x44'),'body':_0x437dc5,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x397b3e)['toString']('base64'))},'json':!![]};rp(_0x1896e6)[_0x31d5('0x16')](function(_0x59d7b2){if(_0x59d7b2[_0x31d5('0x45')]>=0xc8&&_0x59d7b2[_0x31d5('0x45')]<=0xce){if(_0x59d7b2[_0x31d5('0x46')]&&_0x59d7b2['data'][_0x31d5('0x47')]>0x0){var _0x2b6dda=_[_0x31d5('0x48')](_0x59d7b2[_0x31d5('0x46')][_0x31d5('0x1f')]);var _0xc1de84={'messageId':_0x2b6dda['message_id']};if(!_0x3f309e['deliveryReport']){_0xc1de84[_0x31d5('0x3e')]=!![];}return _0xf3d60e[_0x31d5('0x27')](_0xc1de84);}else{logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x49'),util[_0x31d5('0x29')](_0x59d7b2,{'showHidden':![],'depth':null}));}}else{logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),'clickSend',util[_0x31d5('0x29')](_0x59d7b2,{'showHidden':![],'depth':null}));}})[_0x31d5('0x18')](function(_0x2cdb15){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),_0x31d5('0x49'),util[_0x31d5('0x29')](_0x2cdb15,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),_0x31d5('0x49'),_0x31d5('0x3b'));}break;case _0x31d5('0x4a'):if(_0x3f309e['authId']&&_0x3f309e[_0x31d5('0x1e')]){var _0x437dc5={'dst':_0x3de821[_0x31d5('0x21')],'text':_0x3de821[_0x31d5('0xd')],'src':_0x3f309e[_0x31d5('0x42')]||_0x3f309e[_0x31d5('0x21')],'url':_0x3f309e[_0x31d5('0x22')]+_0x31d5('0x23')+_0x3de821['id']+_0x31d5('0x24')+_0x3f309e[_0x31d5('0x25')]};var _0x397b3e=util['format'](_0x31d5('0x43'),_0x3f309e['authId'],_0x3f309e[_0x31d5('0x1e')]);var _0x1896e6={'method':'POST','uri':util[_0x31d5('0x4b')](_0x31d5('0x4c'),_0x3f309e[_0x31d5('0x4d')]),'body':_0x437dc5,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x397b3e)[_0x31d5('0x4e')](_0x31d5('0x4f')))},'json':!![]};rp(_0x1896e6)['then'](function(_0x27eb9f){var _0xf84af={'messageId':_0x27eb9f[_0x31d5('0x50')][0x0]};return _0xf3d60e[_0x31d5('0x27')](_0xf84af);})[_0x31d5('0x18')](function(_0xb9c191){logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x4a'),util['inspect'](_0xb9c191,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x4a'),_0x31d5('0x51'));}break;case _0x31d5('0x52'):if(_0x3f309e[_0x31d5('0x2c')]&&_0x3f309e[_0x31d5('0x2d')]){if(_0x3f309e[_0x31d5('0x53')]){var _0x18fcc7={'method':'POST','uri':_0x3f309e[_0x31d5('0x53')]+_0x31d5('0x54'),'body':{'username':_0x3f309e['username'],'password':_0x3f309e['password']},'json':!![]};return rp(_0x18fcc7)[_0x31d5('0x16')](function(_0x32e816){var _0x48038e={'method':_0x31d5('0x35'),'uri':_0x3f309e[_0x31d5('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3f309e[_0x31d5('0x21')],'destinations':[{'to':_0x3de821[_0x31d5('0x21')]}],'text':_0x3de821[_0x31d5('0xd')],'notifyUrl':_0x3f309e[_0x31d5('0x22')]+_0x31d5('0x23')+_0x3de821['id']+'/status?token='+_0x3f309e['token'],'notifyContentType':_0x31d5('0x55'),'callbackData':_0x3f309e[_0x31d5('0x21')]+';'+_0x3de821[_0x31d5('0xd')]}]},'headers':{'Authorization':_0x31d5('0x56')+_0x32e816[_0x31d5('0x25')]},'json':!![]};return rp(_0x48038e)[_0x31d5('0x16')](function(_0x34357b){if(_0x34357b[_0x31d5('0x1f')]){var _0x3309e8={'messageId':_0x34357b[_0x31d5('0x1f')][0x0][_0x31d5('0xb')]};if(!_0x3f309e[_0x31d5('0x39')]){_0x3309e8[_0x31d5('0x3e')]=!![];}return _0xf3d60e[_0x31d5('0x27')](_0x3309e8);}else{return logger[_0x31d5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31d5('0x28'),'infobip',util[_0x31d5('0x29')](_0x34357b,{'showHidden':![],'depth':null}));}});})[_0x31d5('0x18')](function(_0x19226c){return logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x52'),util[_0x31d5('0x29')](_0x19226c,{'showHidden':![],'depth':null}));});}else{logger[_0x31d5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x31d5('0x57'));}}else{logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x52'),_0x31d5('0x3b'));}break;case _0x31d5('0x58'):var _0x3fcc01=require(_0x31d5('0x59'));if(_0x3f309e[_0x31d5('0x5a')]){var _0x7a89d4={};_0x7a89d4[_0x31d5('0x5b')]=_0x3f309e[_0x31d5('0x2c')];_0x7a89d4[_0x31d5('0x21')]=_0x3de821[_0x31d5('0x21')];_0x7a89d4[_0x31d5('0x2f')]=_0x3f309e[_0x31d5('0x21')];_0x7a89d4[_0x31d5('0x5c')]=_0x3de821[_0x31d5('0xd')];_0x7a89d4[_0x31d5('0x5d')]=+new Date();var _0x5f35d0='';var _0x2761c9='';var _0x47ee1b=Object[_0x31d5('0x5e')](_0x7a89d4);_0x47ee1b['sort']();for(var _0x27f31b=0x0;_0x27f31b<_0x47ee1b[_0x31d5('0x5f')];_0x27f31b++){if(_0x5f35d0!=''){_0x5f35d0+='&';}_0x5f35d0+=_0x47ee1b[_0x27f31b]+'='+encodeURIComponent(_0x7a89d4[_0x47ee1b[_0x27f31b]]);_0x2761c9+=_0x7a89d4[_0x47ee1b[_0x27f31b]];}_0x2761c9+=_0x3f309e[_0x31d5('0x5a')];_0x2761c9=_0x3fcc01[_0x31d5('0x60')](_0x31d5('0x61'))[_0x31d5('0x27')](_0x2761c9)['digest']('hex');if(_0x5f35d0!==''){_0x5f35d0+='&';}_0x5f35d0+='signature='+_0x2761c9;var _0x125306={'method':'GET','uri':_0x3f309e[_0x31d5('0x53')]+_0x31d5('0x62')+_0x5f35d0,'json':!![]};return rp(_0x125306)[_0x31d5('0x16')](function(_0x492383){var _0x490478=Object[_0x31d5('0x5e')](_0x492383);if(_0x492383[_0x490478[0x0]][_0x31d5('0x19')]&&parseInt(_0x492383[_0x490478[0x0]]['error'])===0x0){var _0x104284={'messageId':_0x492383[_0x490478[0x0]][_0x31d5('0x63')]};if(!_0x3f309e[_0x31d5('0x39')]){_0x104284[_0x31d5('0x3e')]=!![];}return _0xf3d60e[_0x31d5('0x27')](_0x104284);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x31d5('0x29')](_0x492383[_0x31d5('0x19')],{'showHidden':![],'depth':null}));}})[_0x31d5('0x18')](function(_0x1f0744){return logger[_0x31d5('0x19')](_0x31d5('0x3a'),'afterCreate','csc',util[_0x31d5('0x29')](_0x1f0744,{'showHidden':![],'depth':null}));});}else{logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x58'),'Missing\x20parameters:\x20apiKey');}break;case _0x31d5('0x64'):if(_0x3f309e[_0x31d5('0x5a')]){var _0x120dd4={'method':_0x31d5('0x35'),'uri':_0x31d5('0x65'),'headers':{'Authorization':_0x3f309e[_0x31d5('0x5a')]},'body':{'content':_0x3de821[_0x31d5('0xd')],'to':[_0x3de821['phone']],'from':_0x3f309e['phone'],'binary':![],'clientMessageId':_0x31d5('0x66'),'charset':_0x31d5('0x67')},'json':!![]};rp(_0x120dd4)[_0x31d5('0x16')](function(_0x3ba050){if(!_0x3ba050['error']){var _0x261ae4={'messageId':_0x3ba050[_0x31d5('0x1f')][0x0][_0x31d5('0x68')]};if(!_0x3f309e[_0x31d5('0x39')]){_0x261ae4[_0x31d5('0x3e')]=!![];}return _0xf3d60e[_0x31d5('0x27')](_0x261ae4);}else{return logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x64'),util[_0x31d5('0x29')](_0x3ba050[_0x31d5('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x556c7b){return logger['error'](_0x31d5('0x3a'),_0x31d5('0x28'),'clickatell',util[_0x31d5('0x29')](_0x556c7b,{'showHidden':![],'depth':null}));});}else{logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x64'),_0x31d5('0x69'));}break;case _0x31d5('0x6a'):if(_0x3f309e[_0x31d5('0x2c')]&&_0x3f309e[_0x31d5('0x2d')]){var _0x397b3e=util[_0x31d5('0x4b')](_0x31d5('0x43'),_0x3f309e[_0x31d5('0x2c')],_0x3f309e[_0x31d5('0x2d')]);var _0x1896e6={'method':_0x31d5('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3f309e['accountId']+_0x31d5('0x6b'),'body':{'to':[_0x3de821[_0x31d5('0x21')]],'text':_0x3de821['body'],'from':_0x3f309e[_0x31d5('0x21')],'applicationId':_0x3f309e[_0x31d5('0x6c')]},'headers':{'Authorization':util[_0x31d5('0x4b')](_0x31d5('0x6d'),new Buffer(_0x397b3e)[_0x31d5('0x4e')]('base64'))},'json':!![]};rp(_0x1896e6)[_0x31d5('0x16')](function(_0x135af6){if(_0x135af6['id']){var _0x4278c0={'messageId':_0x135af6['id']};return _0xf3d60e['update'](_0x4278c0);}else{logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x6a'),util[_0x31d5('0x29')](_0x135af6,{'showHidden':![],'depth':null}));}})[_0x31d5('0x18')](function(_0xdb80c2){logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),'bandwidth',util[_0x31d5('0x29')](_0xdb80c2,{'showHidden':![],'depth':null}));});}else{logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x31d5('0x6e'):if(_0x3f309e[_0x31d5('0x5a')]){var _0x4431a2={};var _0x125306={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x3f309e[_0x31d5('0x5a')],'Content-Type':_0x31d5('0x55')},'body':{'from':_0x3f309e[_0x31d5('0x21')],'to':_0x3de821[_0x31d5('0x21')],'text':_0x3de821[_0x31d5('0xd')]},'json':!![]};return rp(_0x125306)[_0x31d5('0x16')](function(_0x18d555){if(_0x18d555[_0x31d5('0x6f')]==0xca){_0x4431a2['message']=_0x18d555;var _0x4aeae7={'method':_0x31d5('0x35'),'uri':_0x31d5('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x3f309e[_0x31d5('0x5a')],'Content-Type':_0x31d5('0x55')},'body':{'refid':_0x4431a2['message'][_0x31d5('0x71')]},'json':!![]};return rp(_0x4aeae7)[_0x31d5('0x16')](function(_0x73c4f5){_0x4431a2[_0x31d5('0x72')]=_0x73c4f5;var _0x34733c={'messageId':_0x4431a2[_0x31d5('0x73')][_0x31d5('0x71')],'read':!![]};return _0xf3d60e['update'](_0x34733c);});}else{return logger['error'](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x6e'),util[_0x31d5('0x29')](_0x18d555,{'showHidden':![],'depth':null}));}})[_0x31d5('0x18')](function(_0x2c8f81){return logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),_0x31d5('0x6e'),util[_0x31d5('0x29')](_0x2c8f81,{'showHidden':![],'depth':null}));});}else{return logger[_0x31d5('0x19')](_0x31d5('0x3a'),_0x31d5('0x28'),'intelepeer',_0x31d5('0x74'));}break;}}})[_0x31d5('0x75')](function(){_0x55ba93();});}else{_0x55ba93();}}},'charset':_0x31d5('0x76'),'collate':_0x31d5('0x77')});}; \ No newline at end of file +var _0x245c=['smsMethod','login?username=','password','split','sms','POST','internal_order_id','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json','refid','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x245c,0x142));var _0xc245=function(_0x425ca7,_0x2ebd94){_0x425ca7=_0x425ca7-0x0;var _0x541d92=_0x245c[_0x425ca7];return _0x541d92;};'use strict';var _=require(_0xc245('0x0'));var util=require('util');var logger=require(_0xc245('0x1'))(_0xc245('0x2'));var moment=require(_0xc245('0x3'));var BPromise=require(_0xc245('0x4'));var rp=require(_0xc245('0x5'));var fs=require('fs');var path=require(_0xc245('0x6'));var rimraf=require(_0xc245('0x7'));var config=require(_0xc245('0x8'));var attributes=require(_0xc245('0x9'));module[_0xc245('0xa')]=function(_0x39309b,_0x405bae){return _0x39309b[_0xc245('0xb')]('SmsMessage',attributes,{'tableName':_0xc245('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc245('0xd')]},{'name':_0xc245('0xe'),'fields':[_0xc245('0xf')],'type':_0xc245('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3703ee,_0x55e229,_0x127edb){var _0x444bf6=_0x39309b[_0xc245('0x11')];var _0x45e80f=_0x3703ee[_0xc245('0x12')]({'plain':!![]});if(_0x45e80f['direction'][_0xc245('0x13')]()==='in'||_0x45e80f[_0xc245('0x14')][_0xc245('0x13')]()===_0xc245('0x15')&&!_0x45e80f[_0xc245('0x16')]&&!_[_0xc245('0x17')](_0x45e80f[_0xc245('0x18')])&&!_[_0xc245('0x17')](_0x45e80f[_0xc245('0x19')])){_0x444bf6[_0xc245('0x1a')][_0xc245('0x1b')]({'where':{'id':_0x45e80f[_0xc245('0x19')]}})['then'](function(_0x3b8cdb){if(_0x3b8cdb){_0x3b8cdb[_0xc245('0x1c')]({'lastMsgAt':_0x45e80f[_0xc245('0x1d')],'lastMsgDirection':_0x45e80f[_0xc245('0x14')]['toLowerCase']()});}})[_0xc245('0x1e')](function(_0x47eb70){console[_0xc245('0x1f')](_0x47eb70);});}if(_0x45e80f[_0xc245('0x14')]==='out'&&!_0x45e80f[_0xc245('0x16')]){var _0xc3e66b;_0x444bf6[_0xc245('0x20')][_0xc245('0x21')]({'where':{'id':_0x45e80f[_0xc245('0x22')]},'raw':!![]})[_0xc245('0x23')](function(_0x1d0786){_0xc3e66b=_0x1d0786;if(_0xc3e66b&&_0xc3e66b['type']){switch(_0xc3e66b['type']){case _0xc245('0x24'):var _0x7c2776=require('twilio');if(_0xc3e66b[_0xc245('0x25')]&&_0xc3e66b[_0xc245('0x26')]&&_0xc3e66b[_0xc245('0x27')]){var _0xb7e0ac=new _0x7c2776(_0xc3e66b[_0xc245('0x25')],_0xc3e66b[_0xc245('0x26')]);_0xb7e0ac[_0xc245('0x28')][_0xc245('0x29')]({'body':_0x45e80f[_0xc245('0xf')],'to':_0x45e80f[_0xc245('0x27')],'from':_0xc3e66b[_0xc245('0x27')],'statusCallback':_0xc3e66b[_0xc245('0x2a')]+_0xc245('0x2b')+_0x45e80f['id']+_0xc245('0x2c')+_0xc3e66b[_0xc245('0x2d')]})[_0xc245('0x23')](function(_0x3e9f1e){if(_0x3e9f1e[_0xc245('0x2e')]){return _0x3703ee['update']({'messageId':_0x3e9f1e['sid']});}})[_0xc245('0x1e')](function(_0x41bbbb){logger[_0xc245('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc245('0x2f'),_0xc245('0x24'),util[_0xc245('0x30')](_0x41bbbb,{'showHidden':![],'depth':null}));});}else{logger[_0xc245('0x1f')](_0xc245('0x31'),'afterCreate',_0xc245('0x24'),_0xc245('0x32'));}break;case _0xc245('0x33'):var _0x59c70f='https://api.skebby.it/API/v1.0/REST/';if(_0xc3e66b[_0xc245('0x34')]&&_0xc3e66b['password']){var _0x13a5f1={'recipient':[_0x45e80f['phone']],'message':_0x45e80f[_0xc245('0xf')],'message_type':_0xc3e66b['smsMethod']};if(_0xc3e66b[_0xc245('0x35')]&&_0xc3e66b[_0xc245('0x35')]!=='SI'){_0x13a5f1['sender']=_0xc3e66b[_0xc245('0x27')];}var _0x208f8c={'url':_0x59c70f+_0xc245('0x36')+_0xc3e66b[_0xc245('0x34')]+'&password='+_0xc3e66b[_0xc245('0x37')],'method':'GET'};rp(_0x208f8c)[_0xc245('0x23')](function(_0x29d8e1){var _0x42f06a=_0x29d8e1[_0xc245('0x38')](';');var _0x4782d7={'user_key':_0x42f06a[0x0],'session_key':_0x42f06a[0x1]};_0x208f8c={'url':_0x59c70f+_0xc245('0x39'),'method':_0xc245('0x3a'),'headers':{'user_key':_0x4782d7['user_key'],'Session_key':_0x4782d7['session_key']},'json':!![],'body':_0x13a5f1};return rp(_0x208f8c);})[_0xc245('0x23')](function(_0x6c6055){if(_0x6c6055['total_sent']>=0x1){var _0xcd10a0={'messageId':_0x6c6055[_0xc245('0x3b')]};if(_0xc3e66b['smsMethod']!=='GP'||!_0xc3e66b[_0xc245('0x3c')]){_0xcd10a0[_0xc245('0x3d')]=!![];}return _0x3703ee[_0xc245('0x1c')](_0xcd10a0);}else{return logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),'skebby',util[_0xc245('0x30')](_0x6c6055,{'showHidden':![],'depth':null}));}})[_0xc245('0x1e')](function(_0x1aa9ac){return logger['error'](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x33'),util[_0xc245('0x30')](_0x1aa9ac,{'showHidden':![],'depth':null}));});}else{logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xc245('0x3e'):if(_0xc3e66b[_0xc245('0x26')]){var _0x58290a={'recipient':_0x45e80f[_0xc245('0x27')],'message':_0x45e80f['body'],'sender':_0xc3e66b[_0xc245('0x3f')]||_0xc3e66b[_0xc245('0x27')],'authorization':_0xc3e66b[_0xc245('0x26')]};var _0x55e229={'method':_0xc245('0x3a'),'uri':_0xc245('0x40'),'body':_0x58290a,'json':!![]};rp(_0x55e229)[_0xc245('0x23')](function(_0x20e38e){var _0x443851={'messageId':_0x20e38e[_0xc245('0x41')]};if(!_0xc3e66b[_0xc245('0x3c')]){_0x443851[_0xc245('0x3d')]=!![];}return _0x3703ee[_0xc245('0x1c')](_0x443851);})[_0xc245('0x1e')](function(_0x439886){logger[_0xc245('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc245('0x2f'),_0xc245('0x3e'),util[_0xc245('0x30')](_0x439886,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc245('0x31'),_0xc245('0x2f'),'connectel',_0xc245('0x42'));}break;case _0xc245('0x43'):if(_0xc3e66b[_0xc245('0x34')]&&_0xc3e66b[_0xc245('0x37')]){var _0x58290a={'messages':[{'source':_0xc245('0x44'),'to':_0x45e80f[_0xc245('0x27')],'body':_0x45e80f['body'],'from':_0xc3e66b[_0xc245('0x3f')]||_0xc3e66b['phone']}]};var _0x2f6c07=util[_0xc245('0x45')](_0xc245('0x46'),_0xc3e66b[_0xc245('0x34')],_0xc3e66b['password']);var _0x55e229={'method':_0xc245('0x3a'),'uri':_0xc245('0x47'),'body':_0x58290a,'headers':{'Authorization':util['format'](_0xc245('0x48'),new Buffer(_0x2f6c07)['toString'](_0xc245('0x49')))},'json':!![]};rp(_0x55e229)[_0xc245('0x23')](function(_0x35179e){if(_0x35179e[_0xc245('0x4a')]>=0xc8&&_0x35179e['http_code']<=0xce){if(_0x35179e[_0xc245('0x4b')]&&_0x35179e[_0xc245('0x4b')][_0xc245('0x4c')]>0x0){var _0x1457ea=_[_0xc245('0x4d')](_0x35179e[_0xc245('0x4b')][_0xc245('0x28')]);var _0xd332ac={'messageId':_0x1457ea[_0xc245('0x4e')]};if(!_0xc3e66b[_0xc245('0x3c')]){_0xd332ac[_0xc245('0x3d')]=!![];}return _0x3703ee[_0xc245('0x1c')](_0xd332ac);}else{logger[_0xc245('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc245('0x2f'),'clickSend',util[_0xc245('0x30')](_0x35179e,{'showHidden':![],'depth':null}));}}else{logger[_0xc245('0x1f')](_0xc245('0x31'),'afterCreate',_0xc245('0x4f'),util[_0xc245('0x30')](_0x35179e,{'showHidden':![],'depth':null}));}})[_0xc245('0x1e')](function(_0x6320a3){logger['error'](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x4f'),util['inspect'](_0x6320a3,{'showHidden':![],'depth':null}));});}else{logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x4f'),_0xc245('0x50'));}break;case _0xc245('0x51'):if(_0xc3e66b[_0xc245('0x52')]&&_0xc3e66b[_0xc245('0x26')]){var _0x58290a={'dst':_0x45e80f[_0xc245('0x27')],'text':_0x45e80f[_0xc245('0xf')],'src':_0xc3e66b[_0xc245('0x3f')]||_0xc3e66b[_0xc245('0x27')],'url':_0xc3e66b[_0xc245('0x2a')]+'/api/sms/messages/'+_0x45e80f['id']+_0xc245('0x2c')+_0xc3e66b[_0xc245('0x2d')]};var _0x2f6c07=util['format'](_0xc245('0x46'),_0xc3e66b[_0xc245('0x52')],_0xc3e66b[_0xc245('0x26')]);var _0x55e229={'method':_0xc245('0x3a'),'uri':util[_0xc245('0x45')](_0xc245('0x53'),_0xc3e66b[_0xc245('0x52')]),'body':_0x58290a,'headers':{'Authorization':util[_0xc245('0x45')]('Basic\x20%s',new Buffer(_0x2f6c07)['toString'](_0xc245('0x49')))},'json':!![]};rp(_0x55e229)[_0xc245('0x23')](function(_0x4e732d){var _0x23bca5={'messageId':_0x4e732d['message_uuid'][0x0]};return _0x3703ee['update'](_0x23bca5);})['catch'](function(_0x54ec42){logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x51'),util[_0xc245('0x30')](_0x54ec42,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc245('0x2f'),_0xc245('0x51'),_0xc245('0x54'));}break;case _0xc245('0x55'):if(_0xc3e66b[_0xc245('0x34')]&&_0xc3e66b['password']){if(_0xc3e66b['baseUrl']){var _0x406f91={'method':'POST','uri':_0xc3e66b[_0xc245('0x56')]+_0xc245('0x57'),'body':{'username':_0xc3e66b[_0xc245('0x34')],'password':_0xc3e66b[_0xc245('0x37')]},'json':!![]};return rp(_0x406f91)[_0xc245('0x23')](function(_0x257897){var _0x56aea4={'method':'POST','uri':_0xc3e66b[_0xc245('0x56')]+_0xc245('0x58'),'body':{'messages':[{'from':_0xc3e66b['phone'],'destinations':[{'to':_0x45e80f['phone']}],'text':_0x45e80f['body'],'notifyUrl':_0xc3e66b[_0xc245('0x2a')]+_0xc245('0x2b')+_0x45e80f['id']+_0xc245('0x2c')+_0xc3e66b['token'],'notifyContentType':'application/json','callbackData':_0xc3e66b[_0xc245('0x27')]+';'+_0x45e80f[_0xc245('0xf')]}]},'headers':{'Authorization':_0xc245('0x59')+_0x257897[_0xc245('0x2d')]},'json':!![]};return rp(_0x56aea4)['then'](function(_0x5aff90){if(_0x5aff90[_0xc245('0x28')]){var _0x27586c={'messageId':_0x5aff90[_0xc245('0x28')][0x0][_0xc245('0xd')]};if(!_0xc3e66b[_0xc245('0x3c')]){_0x27586c[_0xc245('0x3d')]=!![];}return _0x3703ee[_0xc245('0x1c')](_0x27586c);}else{return logger['error'](_0xc245('0x31'),'afterCreate',_0xc245('0x55'),util[_0xc245('0x30')](_0x5aff90,{'showHidden':![],'depth':null}));}});})[_0xc245('0x1e')](function(_0x3ecb2a){return logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x55'),util[_0xc245('0x30')](_0x3ecb2a,{'showHidden':![],'depth':null}));});}else{logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),'infobip',_0xc245('0x5a'));}}else{logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x55'),_0xc245('0x50'));}break;case _0xc245('0x5b'):var _0x16a604=require(_0xc245('0x5c'));if(_0xc3e66b[_0xc245('0x5d')]){var _0xb5e323={};_0xb5e323[_0xc245('0x5e')]=_0xc3e66b[_0xc245('0x34')];_0xb5e323[_0xc245('0x27')]=_0x45e80f[_0xc245('0x27')];_0xb5e323['sender']=_0xc3e66b[_0xc245('0x27')];_0xb5e323[_0xc245('0x5f')]=_0x45e80f['body'];_0xb5e323[_0xc245('0x60')]=+new Date();var _0x3b4f17='';var _0x43f000='';var _0x453e5f=Object['keys'](_0xb5e323);_0x453e5f[_0xc245('0x61')]();for(var _0x17d295=0x0;_0x17d295<_0x453e5f[_0xc245('0x62')];_0x17d295++){if(_0x3b4f17!=''){_0x3b4f17+='&';}_0x3b4f17+=_0x453e5f[_0x17d295]+'='+encodeURIComponent(_0xb5e323[_0x453e5f[_0x17d295]]);_0x43f000+=_0xb5e323[_0x453e5f[_0x17d295]];}_0x43f000+=_0xc3e66b[_0xc245('0x5d')];_0x43f000=_0x16a604[_0xc245('0x63')](_0xc245('0x64'))[_0xc245('0x1c')](_0x43f000)[_0xc245('0x65')](_0xc245('0x66'));if(_0x3b4f17!==''){_0x3b4f17+='&';}_0x3b4f17+='signature='+_0x43f000;var _0x208f8c={'method':'GET','uri':_0xc3e66b['baseUrl']+_0xc245('0x67')+_0x3b4f17,'json':!![]};return rp(_0x208f8c)[_0xc245('0x23')](function(_0x3e3e14){var _0x358620=Object['keys'](_0x3e3e14);if(_0x3e3e14[_0x358620[0x0]][_0xc245('0x1f')]&&parseInt(_0x3e3e14[_0x358620[0x0]][_0xc245('0x1f')])===0x0){var _0x4d9a2b={'messageId':_0x3e3e14[_0x358620[0x0]][_0xc245('0x68')]};if(!_0xc3e66b[_0xc245('0x3c')]){_0x4d9a2b[_0xc245('0x3d')]=!![];}return _0x3703ee[_0xc245('0x1c')](_0x4d9a2b);}else{return logger[_0xc245('0x1f')](_0xc245('0x31'),'afterCreate',_0xc245('0x5b'),util[_0xc245('0x30')](_0x3e3e14['error'],{'showHidden':![],'depth':null}));}})[_0xc245('0x1e')](function(_0x17cfff){return logger[_0xc245('0x1f')](_0xc245('0x31'),'afterCreate',_0xc245('0x5b'),util[_0xc245('0x30')](_0x17cfff,{'showHidden':![],'depth':null}));});}else{logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x5b'),_0xc245('0x69'));}break;case _0xc245('0x6a'):if(_0xc3e66b['apiKey']){var _0x5432d1={'method':_0xc245('0x3a'),'uri':_0xc245('0x6b'),'headers':{'Authorization':_0xc3e66b[_0xc245('0x5d')]},'body':{'content':_0x45e80f['body'],'to':[_0x45e80f['phone']],'from':_0xc3e66b[_0xc245('0x27')],'binary':![],'clientMessageId':_0xc245('0x6c'),'charset':_0xc245('0x6d')},'json':!![]};rp(_0x5432d1)[_0xc245('0x23')](function(_0x177dac){if(!_0x177dac[_0xc245('0x1f')]){var _0x2b95d0={'messageId':_0x177dac[_0xc245('0x28')][0x0][_0xc245('0x6e')]};if(!_0xc3e66b[_0xc245('0x3c')]){_0x2b95d0[_0xc245('0x3d')]=!![];}return _0x3703ee[_0xc245('0x1c')](_0x2b95d0);}else{return logger[_0xc245('0x1f')](_0xc245('0x31'),'afterCreate',_0xc245('0x6a'),util['inspect'](_0x177dac['error'],{'showHidden':![],'depth':null}));}})[_0xc245('0x1e')](function(_0x6ded20){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc245('0x2f'),_0xc245('0x6a'),util['inspect'](_0x6ded20,{'showHidden':![],'depth':null}));});}else{logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x6a'),_0xc245('0x69'));}break;case'bandwidth':if(_0xc3e66b[_0xc245('0x34')]&&_0xc3e66b[_0xc245('0x37')]){var _0x2f6c07=util[_0xc245('0x45')]('%s:%s',_0xc3e66b[_0xc245('0x34')],_0xc3e66b[_0xc245('0x37')]);var _0x55e229={'method':_0xc245('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xc3e66b['accountId']+_0xc245('0x6f'),'body':{'to':[_0x45e80f['phone']],'text':_0x45e80f['body'],'from':_0xc3e66b[_0xc245('0x27')],'applicationId':_0xc3e66b[_0xc245('0x70')]},'headers':{'Authorization':util[_0xc245('0x45')]('Basic\x20%s',new Buffer(_0x2f6c07)['toString'](_0xc245('0x49')))},'json':!![]};rp(_0x55e229)[_0xc245('0x23')](function(_0x2269bb){if(_0x2269bb['id']){var _0x498814={'messageId':_0x2269bb['id']};return _0x3703ee[_0xc245('0x1c')](_0x498814);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc245('0x71'),util['inspect'](_0x2269bb,{'showHidden':![],'depth':null}));}})[_0xc245('0x1e')](function(_0x3c9f62){logger['error'](_0xc245('0x31'),'afterCreate',_0xc245('0x71'),util['inspect'](_0x3c9f62,{'showHidden':![],'depth':null}));});}else{logger[_0xc245('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc245('0x2f'),_0xc245('0x71'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xc245('0x72'):if(_0xc3e66b['apiKey']){var _0x48dcb5={};var _0x208f8c={'method':_0xc245('0x3a'),'uri':_0xc245('0x73'),'headers':{'Authorization':_0xc245('0x74')+_0xc3e66b[_0xc245('0x5d')],'Content-Type':'application/json'},'body':{'from':_0xc3e66b[_0xc245('0x27')],'to':_0x45e80f['phone'],'text':_0x45e80f['body']},'json':!![]};return rp(_0x208f8c)['then'](function(_0x34574c){if(_0x34574c[_0xc245('0x75')]==0xca){_0x48dcb5[_0xc245('0x76')]=_0x34574c;var _0x2293cd={'method':_0xc245('0x3a'),'uri':_0xc245('0x77'),'headers':{'Authorization':'Bearer\x20'+_0xc3e66b['apiKey'],'Content-Type':_0xc245('0x78')},'body':{'refid':_0x48dcb5[_0xc245('0x76')][_0xc245('0x79')]},'json':!![]};return rp(_0x2293cd)[_0xc245('0x23')](function(_0x2c94cc){_0x48dcb5['status']=_0x2c94cc;var _0xf2c409={'messageId':_0x48dcb5[_0xc245('0x76')]['refid'],'read':!![]};return _0x3703ee[_0xc245('0x1c')](_0xf2c409);});}else{return logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x72'),util[_0xc245('0x30')](_0x34574c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x19d9bb){return logger['error'](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x72'),util[_0xc245('0x30')](_0x19d9bb,{'showHidden':![],'depth':null}));});}else{return logger[_0xc245('0x1f')](_0xc245('0x31'),_0xc245('0x2f'),_0xc245('0x72'),_0xc245('0x7a'));}break;}}})[_0xc245('0x7b')](function(){_0x127edb();});}else{_0x127edb();}}},'charset':_0xc245('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4e1b46a..12ba401 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 _0xf114=['http','redis','defaults','localhost','socket.io-emitter','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','CreateSmsMessage','SmsMessage','body','options','raw','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ea571,_0x524bc2){var _0x122eba=function(_0x2b82be){while(--_0x2b82be){_0x4ea571['push'](_0x4ea571['shift']());}};_0x122eba(++_0x524bc2);}(_0xf114,0x1e5));var _0x4f11=function(_0x16838d,_0x44ba72){_0x16838d=_0x16838d-0x0;var _0x2fa9fe=_0xf114[_0x16838d];return _0x2fa9fe;};'use strict';var _=require(_0x4f11('0x0'));var util=require(_0x4f11('0x1'));var moment=require(_0x4f11('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f11('0x3'));var fs=require('fs');var Redis=require(_0x4f11('0x4'));var db=require(_0x4f11('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f11('0x6'))(_0x4f11('0x7'));var config=require(_0x4f11('0x8'));var jayson=require(_0x4f11('0x9'));var client=jayson[_0x4f11('0xa')][_0x4f11('0xb')]({'port':0x232a});config[_0x4f11('0xc')]=_[_0x4f11('0xd')](config['redis'],{'host':_0x4f11('0xe'),'port':0x18eb});var socket=require(_0x4f11('0xf'))(new Redis(config[_0x4f11('0xc')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x44d686,_0x5b7c7b,_0x2bb045){return new BPromise(function(_0x2c4bb8,_0x23746d){return client['request'](_0x44d686,_0x2bb045)[_0x4f11('0x10')](function(_0x2f0f56){logger[_0x4f11('0x11')](_0x4f11('0x12'),_0x5b7c7b,'request\x20sent');logger[_0x4f11('0x13')](_0x4f11('0x14'),_0x5b7c7b,'request\x20sent',JSON['stringify'](_0x2f0f56));if(_0x2f0f56[_0x4f11('0x15')]){if(_0x2f0f56['error']['code']===0x1f4){logger[_0x4f11('0x15')]('SmsMessage,\x20%s,\x20%s',_0x5b7c7b,_0x2f0f56['error'][_0x4f11('0x16')]);return _0x23746d(_0x2f0f56[_0x4f11('0x15')][_0x4f11('0x16')]);}logger[_0x4f11('0x15')](_0x4f11('0x12'),_0x5b7c7b,_0x2f0f56[_0x4f11('0x15')][_0x4f11('0x16')]);return _0x2c4bb8(_0x2f0f56[_0x4f11('0x15')][_0x4f11('0x16')]);}else{logger[_0x4f11('0x11')]('SmsMessage,\x20%s,\x20%s',_0x5b7c7b,_0x4f11('0x17'));_0x2c4bb8(_0x2f0f56['result'][_0x4f11('0x16')]);}})['catch'](function(_0x2cdbe0){logger['error'](_0x4f11('0x12'),_0x5b7c7b,_0x2cdbe0);_0x23746d(_0x2cdbe0);});});}exports[_0x4f11('0x18')]=function(_0x4c0d9){var _0xc8224e=this;return new Promise(function(_0x21c269,_0x5ad311){return db[_0x4f11('0x19')]['create'](_0x4c0d9[_0x4f11('0x1a')],{'raw':_0x4c0d9[_0x4f11('0x1b')]?_0x4c0d9[_0x4f11('0x1b')][_0x4f11('0x1c')]===undefined?!![]:![]:!![]})[_0x4f11('0x10')](function(_0x32c1c9){logger[_0x4f11('0x11')](_0x4f11('0x18'),_0x4c0d9);logger[_0x4f11('0x13')](_0x4f11('0x18'),_0x4c0d9,JSON[_0x4f11('0x1d')](_0x32c1c9));_0x21c269(_0x32c1c9);})[_0x4f11('0x1e')](function(_0x31e954){logger['error'](_0x4f11('0x18'),_0x31e954[_0x4f11('0x16')],_0x4c0d9);_0x5ad311(_0xc8224e[_0x4f11('0x15')](0x1f4,_0x31e954[_0x4f11('0x16')]));});});}; \ No newline at end of file +var _0x05cd=['error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4a5261,_0x4aa41c){var _0x13b4fb=function(_0x1c8897){while(--_0x1c8897){_0x4a5261['push'](_0x4a5261['shift']());}};_0x13b4fb(++_0x4aa41c);}(_0x05cd,0x133));var _0xd05c=function(_0x27b7a3,_0x5d6585){_0x27b7a3=_0x27b7a3-0x0;var _0x4a0578=_0x05cd[_0x27b7a3];return _0x4a0578;};'use strict';var _=require('lodash');var util=require(_0xd05c('0x0'));var moment=require(_0xd05c('0x1'));var BPromise=require(_0xd05c('0x2'));var rs=require(_0xd05c('0x3'));var fs=require('fs');var Redis=require(_0xd05c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd05c('0x5'));var logger=require(_0xd05c('0x6'))(_0xd05c('0x7'));var config=require(_0xd05c('0x8'));var jayson=require(_0xd05c('0x9'));var client=jayson[_0xd05c('0xa')][_0xd05c('0xb')]({'port':0x232a});config['redis']=_[_0xd05c('0xc')](config['redis'],{'host':_0xd05c('0xd'),'port':0x18eb});var socket=require(_0xd05c('0xe'))(new Redis(config[_0xd05c('0xf')]));require(_0xd05c('0x10'))[_0xd05c('0x11')](socket);function respondWithRpcPromise(_0x1ee970,_0x441f6b,_0x40cfd){return new BPromise(function(_0x29f079,_0x55dabb){return client[_0xd05c('0x12')](_0x1ee970,_0x40cfd)[_0xd05c('0x13')](function(_0x1b0c9a){logger[_0xd05c('0x14')](_0xd05c('0x15'),_0x441f6b,_0xd05c('0x16'));logger[_0xd05c('0x17')](_0xd05c('0x18'),_0x441f6b,_0xd05c('0x16'),JSON[_0xd05c('0x19')](_0x1b0c9a));if(_0x1b0c9a[_0xd05c('0x1a')]){if(_0x1b0c9a[_0xd05c('0x1a')][_0xd05c('0x1b')]===0x1f4){logger[_0xd05c('0x1a')](_0xd05c('0x15'),_0x441f6b,_0x1b0c9a['error'][_0xd05c('0x1c')]);return _0x55dabb(_0x1b0c9a[_0xd05c('0x1a')][_0xd05c('0x1c')]);}logger[_0xd05c('0x1a')](_0xd05c('0x15'),_0x441f6b,_0x1b0c9a[_0xd05c('0x1a')][_0xd05c('0x1c')]);return _0x29f079(_0x1b0c9a[_0xd05c('0x1a')][_0xd05c('0x1c')]);}else{logger[_0xd05c('0x14')](_0xd05c('0x15'),_0x441f6b,_0xd05c('0x16'));_0x29f079(_0x1b0c9a[_0xd05c('0x1d')][_0xd05c('0x1c')]);}})[_0xd05c('0x1e')](function(_0x3c91ab){logger[_0xd05c('0x1a')](_0xd05c('0x15'),_0x441f6b,_0x3c91ab);_0x55dabb(_0x3c91ab);});});}exports['CreateSmsMessage']=function(_0x53d26e){var _0x5c152e=this;return new Promise(function(_0x42119b,_0x1fc899){return db[_0xd05c('0x1f')][_0xd05c('0x20')](_0x53d26e[_0xd05c('0x21')],{'raw':_0x53d26e['options']?_0x53d26e[_0xd05c('0x22')][_0xd05c('0x23')]===undefined?!![]:![]:!![]})[_0xd05c('0x13')](function(_0x2263c4){logger[_0xd05c('0x14')](_0xd05c('0x24'),_0x53d26e);logger['debug'](_0xd05c('0x24'),_0x53d26e,JSON[_0xd05c('0x19')](_0x2263c4));_0x42119b(_0x2263c4);})['catch'](function(_0xe29a89){logger[_0xd05c('0x1a')](_0xd05c('0x24'),_0xe29a89['message'],_0x53d26e);_0x1fc899(_0x5c152e['error'](0x1f4,_0xe29a89['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d296cdc..789fc27 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 _0xd97a=['remove','update','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x2f0162,_0x561c38){var _0x4becec=function(_0xea2491){while(--_0xea2491){_0x2f0162['push'](_0x2f0162['shift']());}};_0x4becec(++_0x561c38);}(_0xd97a,0x164));var _0xad97=function(_0x4516c8,_0x6bada6){_0x4516c8=_0x4516c8-0x0;var _0x24954e=_0xd97a[_0x4516c8];return _0x24954e;};'use strict';var SmsMessageEvents=require(_0xad97('0x0'));var events=['save',_0xad97('0x1'),_0xad97('0x2')];function createListener(_0x24b0d0,_0x48bdd3){return function(_0x4ccd79){_0x48bdd3[_0xad97('0x3')](_0x24b0d0,_0x4ccd79);};}function removeListener(_0x240fad,_0x4bd4a5){return function(){SmsMessageEvents[_0xad97('0x4')](_0x240fad,_0x4bd4a5);};}exports['register']=function(_0x55a8bd){for(var _0x4c2e10=0x0,_0x40d9cb=events[_0xad97('0x5')];_0x4c2e10<_0x40d9cb;_0x4c2e10++){var _0x258cb9=events[_0x4c2e10];var _0x819874=createListener(_0xad97('0x6')+_0x258cb9,_0x55a8bd);SmsMessageEvents['on'](_0x258cb9,_0x819874);}}; \ No newline at end of file +var _0x3552=['update','emit','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x3552,0x17e));var _0x2355=function(_0x50c177,_0x464fcf){_0x50c177=_0x50c177-0x0;var _0x35f483=_0x3552[_0x50c177];return _0x35f483;};'use strict';var SmsMessageEvents=require(_0x2355('0x0'));var events=[_0x2355('0x1'),_0x2355('0x2'),_0x2355('0x3')];function createListener(_0x29f476,_0x2a017b){return function(_0x1cecd3){_0x2a017b[_0x2355('0x4')](_0x29f476,_0x1cecd3);};}function removeListener(_0x5f00b1,_0x454bc8){return function(){SmsMessageEvents['removeListener'](_0x5f00b1,_0x454bc8);};}exports['register']=function(_0x18aca5){for(var _0x2be3a5=0x0,_0x40b840=events[_0x2355('0x5')];_0x2be3a5<_0x40b840;_0x2be3a5++){var _0x49e60e=events[_0x2be3a5];var _0x51f7b7=createListener(_0x2355('0x6')+_0x49e60e,_0x18aca5);SmsMessageEvents['on'](_0x49e60e,_0x51f7b7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 78ece47..2436326 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 _0xf969=['addAgents','put','destroy','delete','/:id/users','removeAgents','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','/:id/teams','getAgents','create','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf969,0x1a5));var _0x9f96=function(_0x27391f,_0x2752df){_0x27391f=_0x27391f-0x0;var _0x910922=_0xf969[_0x27391f];return _0x910922;};'use strict';var multer=require(_0x9f96('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9f96('0x1'));var express=require(_0x9f96('0x2'));var router=express['Router']();var fs_extra=require(_0x9f96('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9f96('0x4'));var config=require('../../config/environment');var controller=require(_0x9f96('0x5'));router[_0x9f96('0x6')]('/',auth[_0x9f96('0x7')](),controller[_0x9f96('0x8')]);router[_0x9f96('0x6')]('/describe',auth[_0x9f96('0x7')](),controller['describe']);router['get'](_0x9f96('0x9'),auth[_0x9f96('0x7')](),controller[_0x9f96('0xa')]);router[_0x9f96('0x6')](_0x9f96('0xb'),auth[_0x9f96('0x7')](),controller['getMembers']);router[_0x9f96('0x6')](_0x9f96('0xc'),auth[_0x9f96('0x7')](),controller['getTeams']);router[_0x9f96('0x6')]('/:id/users',auth[_0x9f96('0x7')](),controller[_0x9f96('0xd')]);router['post']('/',auth[_0x9f96('0x7')](),controller[_0x9f96('0xe')]);router[_0x9f96('0xf')]('/:id/teams',auth[_0x9f96('0x7')](),controller['addTeams']);router[_0x9f96('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x9f96('0x10')]);router[_0x9f96('0x11')]('/:id',auth[_0x9f96('0x7')](),controller['update']);router['delete']('/:id',auth[_0x9f96('0x7')](),controller[_0x9f96('0x12')]);router[_0x9f96('0x13')]('/:id/teams',auth[_0x9f96('0x7')](),controller['removeTeams']);router[_0x9f96('0x13')](_0x9f96('0x14'),auth[_0x9f96('0x7')](),controller[_0x9f96('0x15')]);module[_0x9f96('0x16')]=router; \ No newline at end of file +var _0xee68=['../../components/interaction/service','./smsQueue.controller','isAuthenticated','get','/:id/members','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x185454,_0x3ea3eb){var _0x247434=function(_0x323e9d){while(--_0x323e9d){_0x185454['push'](_0x185454['shift']());}};_0x247434(++_0x3ea3eb);}(_0xee68,0x13c));var _0x8ee6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xee68[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x8ee6('0x0'));var util=require(_0x8ee6('0x1'));var path=require(_0x8ee6('0x2'));var timeout=require(_0x8ee6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ee6('0x4'));var auth=require(_0x8ee6('0x5'));var interaction=require(_0x8ee6('0x6'));var config=require('../../config/environment');var controller=require(_0x8ee6('0x7'));router['get']('/',auth[_0x8ee6('0x8')](),controller['index']);router[_0x8ee6('0x9')]('/describe',auth[_0x8ee6('0x8')](),controller['describe']);router[_0x8ee6('0x9')]('/:id',auth[_0x8ee6('0x8')](),controller['show']);router[_0x8ee6('0x9')](_0x8ee6('0xa'),auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/teams',auth[_0x8ee6('0x8')](),controller['getTeams']);router[_0x8ee6('0x9')](_0x8ee6('0xb'),auth[_0x8ee6('0x8')](),controller[_0x8ee6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8ee6('0xd')]);router[_0x8ee6('0xe')](_0x8ee6('0xf'),auth[_0x8ee6('0x8')](),controller[_0x8ee6('0x10')]);router['post'](_0x8ee6('0xb'),auth[_0x8ee6('0x8')](),controller[_0x8ee6('0x11')]);router[_0x8ee6('0x12')]('/:id',auth[_0x8ee6('0x8')](),controller[_0x8ee6('0x13')]);router[_0x8ee6('0x14')]('/:id',auth[_0x8ee6('0x8')](),controller['destroy']);router[_0x8ee6('0x14')](_0x8ee6('0xf'),auth[_0x8ee6('0x8')](),controller[_0x8ee6('0x15')]);router[_0x8ee6('0x14')]('/:id/users',auth[_0x8ee6('0x8')](),controller[_0x8ee6('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e036b4b..7c5f72e 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 _0x3889=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x25bca9,_0x13d2bf){var _0x319615=function(_0x2d95c4){while(--_0x2d95c4){_0x25bca9['push'](_0x25bca9['shift']());}};_0x319615(++_0x13d2bf);}(_0x3889,0x11c));var _0x9388=function(_0xb16d3d,_0x2be85e){_0xb16d3d=_0xb16d3d-0x0;var _0xf2fbf=_0x3889[_0xb16d3d];return _0xf2fbf;};'use strict';var Sequelize=require(_0x9388('0x0'));module[_0x9388('0x1')]={'name':{'type':Sequelize[_0x9388('0x2')],'unique':_0x9388('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9388('0x2')]},'timeout':{'type':Sequelize[_0x9388('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9388('0x5')](_0x9388('0x6'),'beepall',_0x9388('0x7'))}}; \ No newline at end of file +var _0xcd06=['sequelize','STRING','name','INTEGER','beepall','roundrobin'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xcd06,0x126));var _0x6cd0=function(_0x1f1e6e,_0x275dee){_0x1f1e6e=_0x1f1e6e-0x0;var _0xcd45ff=_0xcd06[_0x1f1e6e];return _0xcd45ff;};'use strict';var Sequelize=require(_0x6cd0('0x0'));module['exports']={'name':{'type':Sequelize[_0x6cd0('0x1')],'unique':_0x6cd0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6cd0('0x1')]},'timeout':{'type':Sequelize[_0x6cd0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x6cd0('0x4'),_0x6cd0('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3700b5a..1a16538 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x10770a,_0x177f6b){var _0x3431de=function(_0x4d845e){while(--_0x4d845e){_0x10770a['push'](_0x10770a['shift']());}};_0x3431de(++_0x177f6b);}(_0x7a54,0x106));var _0x47a5=function(_0x94e2d1,_0x2e9525){_0x94e2d1=_0x94e2d1-0x0;var _0x2046d2=_0x7a54[_0x94e2d1];return _0x2046d2;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x443521,_0x257810){var _0x3cc731=function(_0xfa7847){while(--_0xfa7847){_0x443521['push'](_0x443521['shift']());}};_0x3cc731(++_0x257810);}(_0xdb28,0x106));var _0x8db2=function(_0x18e635,_0x3b3746){_0x18e635=_0x18e635-0x0;var _0x5af5d0=_0xdb28[_0x18e635];return _0x5af5d0;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 0493f1d..cfafe78 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 _0xb278=['hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit'];(function(_0x9e2e0e,_0xd249fd){var _0x10df60=function(_0x13c659){while(--_0x13c659){_0x9e2e0e['push'](_0x9e2e0e['shift']());}};_0x10df60(++_0xd249fd);}(_0xb278,0x1e9));var _0x8b27=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb278[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x8b27('0x0'))['db'][_0x8b27('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8b27('0x2')](0x0);var events={'afterCreate':_0x8b27('0x3'),'afterUpdate':_0x8b27('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4b69dd){return function(_0x32706f,_0x21f618,_0x158304){SmsQueueEvents['emit'](_0x4b69dd+':'+_0x32706f['id'],_0x32706f);SmsQueueEvents[_0x8b27('0x5')](_0x4b69dd,_0x32706f);_0x158304(null);};}for(var e in events){if(events[_0x8b27('0x6')](e)){var event=events[e];SmsQueue[_0x8b27('0x7')](e,emitEvent(event));}}module[_0x8b27('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x72bc=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','../../mysqldb','SmsQueue'];(function(_0xbc7cc1,_0x485627){var _0x39e910=function(_0x4eb23b){while(--_0x4eb23b){_0xbc7cc1['push'](_0xbc7cc1['shift']());}};_0x39e910(++_0x485627);}(_0x72bc,0x1d6));var _0xc72b=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x72bc[_0x4fde08];return _0x12e725;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xc72b('0x0'))['db'][_0xc72b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc72b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc72b('0x3'),'afterDestroy':_0xc72b('0x4')};function emitEvent(_0x20165a){return function(_0x15e2bf,_0x33003a,_0x942ea6){SmsQueueEvents['emit'](_0x20165a+':'+_0x15e2bf['id'],_0x15e2bf);SmsQueueEvents[_0xc72b('0x5')](_0x20165a,_0x15e2bf);_0x942ea6(null);};}for(var e in events){if(events[_0xc72b('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xc72b('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 5d80e4d..9e2202e 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 _0x3e4a=['SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports'];(function(_0x1afb78,_0xcc1e7d){var _0x2dcbf8=function(_0x2f702b){while(--_0x2f702b){_0x1afb78['push'](_0x1afb78['shift']());}};_0x2dcbf8(++_0xcc1e7d);}(_0x3e4a,0x182));var _0xa3e4=function(_0x27fadc,_0x594112){_0x27fadc=_0x27fadc-0x0;var _0x2cc531=_0x3e4a[_0x27fadc];return _0x2cc531;};'use strict';var _=require(_0xa3e4('0x0'));var util=require(_0xa3e4('0x1'));var logger=require('../../config/logger')(_0xa3e4('0x2'));var moment=require(_0xa3e4('0x3'));var BPromise=require(_0xa3e4('0x4'));var rp=require(_0xa3e4('0x5'));var fs=require('fs');var path=require(_0xa3e4('0x6'));var rimraf=require(_0xa3e4('0x7'));var config=require('../../config/environment');var attributes=require(_0xa3e4('0x8'));module[_0xa3e4('0x9')]=function(_0xac76e5,_0xda103){return _0xac76e5['define'](_0xa3e4('0xa'),attributes,{'tableName':_0xa3e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0396=['moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','api'];(function(_0x511d80,_0x1eb60e){var _0x1b9019=function(_0x2e3009){while(--_0x2e3009){_0x511d80['push'](_0x511d80['shift']());}};_0x1b9019(++_0x1eb60e);}(_0x0396,0x141));var _0x6039=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x0396[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x6039('0x0'));var util=require(_0x6039('0x1'));var logger=require('../../config/logger')(_0x6039('0x2'));var moment=require(_0x6039('0x3'));var BPromise=require(_0x6039('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6039('0x5'));var rimraf=require(_0x6039('0x6'));var config=require(_0x6039('0x7'));var attributes=require(_0x6039('0x8'));module[_0x6039('0x9')]=function(_0x1ada02,_0x5e3cb7){return _0x1ada02[_0x6039('0xa')](_0x6039('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 13b150a..281c9c2 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 _0xca19=['jayson/promise','client','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','include','model','where','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x491ae4,_0x1b356c){var _0xd8ab05=function(_0xd1c165){while(--_0xd1c165){_0x491ae4['push'](_0x491ae4['shift']());}};_0xd8ab05(++_0x1b356c);}(_0xca19,0x1c0));var _0x9ca1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca19[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x9ca1('0x0'));var util=require('util');var moment=require(_0x9ca1('0x1'));var BPromise=require(_0x9ca1('0x2'));var rs=require(_0x9ca1('0x3'));var fs=require('fs');var Redis=require(_0x9ca1('0x4'));var db=require(_0x9ca1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ca1('0x6'))('rpc');var config=require(_0x9ca1('0x7'));var jayson=require(_0x9ca1('0x8'));var client=jayson[_0x9ca1('0x9')]['http']({'port':0x232a});config[_0x9ca1('0xa')]=_[_0x9ca1('0xb')](config[_0x9ca1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ca1('0xc'))(new Redis(config[_0x9ca1('0xa')]));require(_0x9ca1('0xd'))[_0x9ca1('0xe')](socket);function respondWithRpcPromise(_0x8559d6,_0x4af523,_0x3f684f){return new BPromise(function(_0x2f5889,_0x2fc8f9){return client[_0x9ca1('0xf')](_0x8559d6,_0x3f684f)['then'](function(_0x47b417){logger[_0x9ca1('0x10')](_0x9ca1('0x11'),_0x4af523,_0x9ca1('0x12'));logger[_0x9ca1('0x13')](_0x9ca1('0x14'),_0x4af523,_0x9ca1('0x12'),JSON[_0x9ca1('0x15')](_0x47b417));if(_0x47b417['error']){if(_0x47b417[_0x9ca1('0x16')][_0x9ca1('0x17')]===0x1f4){logger[_0x9ca1('0x16')](_0x9ca1('0x11'),_0x4af523,_0x47b417[_0x9ca1('0x16')][_0x9ca1('0x18')]);return _0x2fc8f9(_0x47b417[_0x9ca1('0x16')]['message']);}logger[_0x9ca1('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4af523,_0x47b417[_0x9ca1('0x16')][_0x9ca1('0x18')]);return _0x2f5889(_0x47b417['error'][_0x9ca1('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x4af523,_0x9ca1('0x12'));_0x2f5889(_0x47b417['result'][_0x9ca1('0x18')]);}})[_0x9ca1('0x19')](function(_0x2d86b0){logger['error'](_0x9ca1('0x11'),_0x4af523,_0x2d86b0);_0x2fc8f9(_0x2d86b0);});});}exports[_0x9ca1('0x1a')]=function(_0x586b7b){var _0x38791d=this;return new Promise(function(_0x5e1b00,_0x84a69f){return db[_0x9ca1('0x1b')][_0x9ca1('0x1c')]({'raw':_0x586b7b[_0x9ca1('0x1d')]?_0x586b7b[_0x9ca1('0x1d')][_0x9ca1('0x1e')]===undefined?!![]:![]:!![],'where':_0x586b7b[_0x9ca1('0x1d')]?_0x586b7b[_0x9ca1('0x1d')]['where']||null:null,'attributes':_0x586b7b[_0x9ca1('0x1d')]?_0x586b7b['options'][_0x9ca1('0x1f')]||null:null,'limit':_0x586b7b[_0x9ca1('0x1d')]?_0x586b7b[_0x9ca1('0x1d')][_0x9ca1('0x20')]||null:null,'include':_0x586b7b[_0x9ca1('0x1d')]?_0x586b7b['options']['include']?_[_0x9ca1('0x21')](_0x586b7b[_0x9ca1('0x1d')][_0x9ca1('0x22')],function(_0x54da6f){return{'model':db[_0x54da6f[_0x9ca1('0x23')]],'as':_0x54da6f['as'],'attributes':_0x54da6f['attributes'],'include':_0x54da6f[_0x9ca1('0x22')]?_[_0x9ca1('0x21')](_0x54da6f['include'],function(_0x3980b2){return{'model':db[_0x3980b2[_0x9ca1('0x23')]],'as':_0x3980b2['as'],'attributes':_0x3980b2['attributes'],'include':_0x3980b2[_0x9ca1('0x22')]?_[_0x9ca1('0x21')](_0x3980b2[_0x9ca1('0x22')],function(_0x35b755){return{'model':db[_0x35b755[_0x9ca1('0x23')]],'as':_0x35b755['as'],'attributes':_0x35b755[_0x9ca1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4759e3){logger[_0x9ca1('0x10')](_0x9ca1('0x1a'),_0x586b7b);logger['debug'](_0x9ca1('0x1a'),_0x586b7b,JSON[_0x9ca1('0x15')](_0x4759e3));_0x5e1b00(_0x4759e3);})[_0x9ca1('0x19')](function(_0x14d553){logger[_0x9ca1('0x16')](_0x9ca1('0x1a'),_0x14d553[_0x9ca1('0x18')],_0x586b7b);_0x84a69f(_0x38791d[_0x9ca1('0x16')](0x1f4,_0x14d553[_0x9ca1('0x18')]));});});};exports['ShowSmsQueue']=function(_0x3591c1){var _0x278eda=this;return new Promise(function(_0x45e239,_0x54f31a){return db[_0x9ca1('0x1b')]['find']({'raw':_0x3591c1[_0x9ca1('0x1d')]?_0x3591c1['options'][_0x9ca1('0x1e')]===undefined?!![]:![]:!![],'where':_0x3591c1[_0x9ca1('0x1d')]?_0x3591c1[_0x9ca1('0x1d')][_0x9ca1('0x24')]||null:null,'attributes':_0x3591c1[_0x9ca1('0x1d')]?_0x3591c1['options']['attributes']||null:null,'include':_0x3591c1[_0x9ca1('0x1d')]?_0x3591c1[_0x9ca1('0x1d')][_0x9ca1('0x22')]?_[_0x9ca1('0x21')](_0x3591c1[_0x9ca1('0x1d')]['include'],function(_0x130dea){return{'model':db[_0x130dea[_0x9ca1('0x23')]],'as':_0x130dea['as'],'attributes':_0x130dea[_0x9ca1('0x1f')],'include':_0x130dea[_0x9ca1('0x22')]?_[_0x9ca1('0x21')](_0x130dea['include'],function(_0x851ba7){return{'model':db[_0x851ba7[_0x9ca1('0x23')]],'as':_0x851ba7['as'],'attributes':_0x851ba7['attributes'],'include':_0x851ba7[_0x9ca1('0x22')]?_[_0x9ca1('0x21')](_0x851ba7[_0x9ca1('0x22')],function(_0xd45581){return{'model':db[_0xd45581[_0x9ca1('0x23')]],'as':_0xd45581['as'],'attributes':_0xd45581['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f229d){logger['info']('ShowSmsQueue',_0x3591c1);logger[_0x9ca1('0x13')]('ShowSmsQueue',_0x3591c1,JSON[_0x9ca1('0x15')](_0x5f229d));_0x45e239(_0x5f229d);})[_0x9ca1('0x19')](function(_0x517b48){logger[_0x9ca1('0x16')](_0x9ca1('0x25'),_0x517b48['message'],_0x3591c1);_0x54f31a(_0x278eda[_0x9ca1('0x16')](0x1f4,_0x517b48[_0x9ca1('0x18')]));});});}; \ No newline at end of file +var _0xf7fe=['SmsQueue','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','then','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetSmsQueue','findAll','options','raw','limit','map','include','attributes','model','ShowSmsQueue'];(function(_0x479131,_0x2828f4){var _0x28e996=function(_0xc3890d){while(--_0xc3890d){_0x479131['push'](_0x479131['shift']());}};_0x28e996(++_0x2828f4);}(_0xf7fe,0xa2));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef7f('0x0'));var util=require(_0xef7f('0x1'));var moment=require(_0xef7f('0x2'));var BPromise=require('bluebird');var rs=require(_0xef7f('0x3'));var fs=require('fs');var Redis=require(_0xef7f('0x4'));var db=require(_0xef7f('0x5'))['db'];var utils=require(_0xef7f('0x6'));var logger=require('../../config/logger')(_0xef7f('0x7'));var config=require(_0xef7f('0x8'));var jayson=require(_0xef7f('0x9'));var client=jayson[_0xef7f('0xa')][_0xef7f('0xb')]({'port':0x232a});config['redis']=_[_0xef7f('0xc')](config[_0xef7f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xef7f('0xe'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xef7f('0xf')](socket);function respondWithRpcPromise(_0xf93476,_0x25464f,_0x395dea){return new BPromise(function(_0xe548b4,_0x5f1e88){return client['request'](_0xf93476,_0x395dea)[_0xef7f('0x10')](function(_0x1c2a98){logger['info'](_0xef7f('0x11'),_0x25464f,'request\x20sent');logger[_0xef7f('0x12')](_0xef7f('0x13'),_0x25464f,_0xef7f('0x14'),JSON[_0xef7f('0x15')](_0x1c2a98));if(_0x1c2a98[_0xef7f('0x16')]){if(_0x1c2a98[_0xef7f('0x16')][_0xef7f('0x17')]===0x1f4){logger[_0xef7f('0x16')](_0xef7f('0x11'),_0x25464f,_0x1c2a98['error'][_0xef7f('0x18')]);return _0x5f1e88(_0x1c2a98[_0xef7f('0x16')][_0xef7f('0x18')]);}logger[_0xef7f('0x16')]('SmsQueue,\x20%s,\x20%s',_0x25464f,_0x1c2a98[_0xef7f('0x16')][_0xef7f('0x18')]);return _0xe548b4(_0x1c2a98['error'][_0xef7f('0x18')]);}else{logger[_0xef7f('0x19')](_0xef7f('0x11'),_0x25464f,_0xef7f('0x14'));_0xe548b4(_0x1c2a98[_0xef7f('0x1a')]['message']);}})[_0xef7f('0x1b')](function(_0x138cce){logger['error'](_0xef7f('0x11'),_0x25464f,_0x138cce);_0x5f1e88(_0x138cce);});});}exports[_0xef7f('0x1c')]=function(_0x51cca8){var _0x367681=this;return new Promise(function(_0x4765b5,_0xff68c){return db['SmsQueue'][_0xef7f('0x1d')]({'raw':_0x51cca8[_0xef7f('0x1e')]?_0x51cca8['options'][_0xef7f('0x1f')]===undefined?!![]:![]:!![],'where':_0x51cca8[_0xef7f('0x1e')]?_0x51cca8['options']['where']||null:null,'attributes':_0x51cca8[_0xef7f('0x1e')]?_0x51cca8[_0xef7f('0x1e')]['attributes']||null:null,'limit':_0x51cca8['options']?_0x51cca8[_0xef7f('0x1e')][_0xef7f('0x20')]||null:null,'include':_0x51cca8[_0xef7f('0x1e')]?_0x51cca8['options']['include']?_[_0xef7f('0x21')](_0x51cca8['options'][_0xef7f('0x22')],function(_0x5aa10a){return{'model':db[_0x5aa10a['model']],'as':_0x5aa10a['as'],'attributes':_0x5aa10a[_0xef7f('0x23')],'include':_0x5aa10a[_0xef7f('0x22')]?_['map'](_0x5aa10a[_0xef7f('0x22')],function(_0x809313){return{'model':db[_0x809313['model']],'as':_0x809313['as'],'attributes':_0x809313['attributes'],'include':_0x809313['include']?_[_0xef7f('0x21')](_0x809313[_0xef7f('0x22')],function(_0xd785cd){return{'model':db[_0xd785cd[_0xef7f('0x24')]],'as':_0xd785cd['as'],'attributes':_0xd785cd[_0xef7f('0x23')]};}):[]};}):[]};}):[]:[]})[_0xef7f('0x10')](function(_0x56680d){logger['info'](_0xef7f('0x1c'),_0x51cca8);logger['debug'](_0xef7f('0x1c'),_0x51cca8,JSON[_0xef7f('0x15')](_0x56680d));_0x4765b5(_0x56680d);})[_0xef7f('0x1b')](function(_0x943cda){logger['error'](_0xef7f('0x1c'),_0x943cda['message'],_0x51cca8);_0xff68c(_0x367681[_0xef7f('0x16')](0x1f4,_0x943cda[_0xef7f('0x18')]));});});};exports[_0xef7f('0x25')]=function(_0x47577f){var _0x20ec0f=this;return new Promise(function(_0x5953da,_0x54b058){return db[_0xef7f('0x26')]['find']({'raw':_0x47577f[_0xef7f('0x1e')]?_0x47577f[_0xef7f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x47577f['options']?_0x47577f[_0xef7f('0x1e')][_0xef7f('0x27')]||null:null,'attributes':_0x47577f['options']?_0x47577f[_0xef7f('0x1e')][_0xef7f('0x23')]||null:null,'include':_0x47577f[_0xef7f('0x1e')]?_0x47577f['options'][_0xef7f('0x22')]?_[_0xef7f('0x21')](_0x47577f[_0xef7f('0x1e')]['include'],function(_0x180a24){return{'model':db[_0x180a24['model']],'as':_0x180a24['as'],'attributes':_0x180a24[_0xef7f('0x23')],'include':_0x180a24[_0xef7f('0x22')]?_[_0xef7f('0x21')](_0x180a24[_0xef7f('0x22')],function(_0x227965){return{'model':db[_0x227965[_0xef7f('0x24')]],'as':_0x227965['as'],'attributes':_0x227965[_0xef7f('0x23')],'include':_0x227965[_0xef7f('0x22')]?_[_0xef7f('0x21')](_0x227965[_0xef7f('0x22')],function(_0x3a3063){return{'model':db[_0x3a3063[_0xef7f('0x24')]],'as':_0x3a3063['as'],'attributes':_0x3a3063[_0xef7f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a9943){logger[_0xef7f('0x19')](_0xef7f('0x25'),_0x47577f);logger['debug'](_0xef7f('0x25'),_0x47577f,JSON['stringify'](_0x4a9943));_0x5953da(_0x4a9943);})[_0xef7f('0x1b')](function(_0x39f8ea){logger[_0xef7f('0x16')]('ShowSmsQueue',_0x39f8ea[_0xef7f('0x18')],_0x47577f);_0x54b058(_0x20ec0f[_0xef7f('0x16')](0x1f4,_0x39f8ea['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2bb44e0..5723144 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 _0x5b2e=['remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x5a4c10,_0x1db485){var _0x214f0b=function(_0x4e0f5e){while(--_0x4e0f5e){_0x5a4c10['push'](_0x5a4c10['shift']());}};_0x214f0b(++_0x1db485);}(_0x5b2e,0x157));var _0xe5b2=function(_0x53c753,_0x2efd82){_0x53c753=_0x53c753-0x0;var _0xa4b6cd=_0x5b2e[_0x53c753];return _0xa4b6cd;};'use strict';var SmsQueueEvents=require(_0xe5b2('0x0'));var events=['save',_0xe5b2('0x1'),_0xe5b2('0x2')];function createListener(_0xeaa397,_0x253deb){return function(_0x5b80ff){_0x253deb[_0xe5b2('0x3')](_0xeaa397,_0x5b80ff);};}function removeListener(_0x3f2f17,_0xbfa5d2){return function(){SmsQueueEvents[_0xe5b2('0x4')](_0x3f2f17,_0xbfa5d2);};}exports[_0xe5b2('0x5')]=function(_0x30076d){for(var _0x46ac48=0x0,_0x259b87=events[_0xe5b2('0x6')];_0x46ac48<_0x259b87;_0x46ac48++){var _0x52239e=events[_0x46ac48];var _0x552951=createListener(_0xe5b2('0x7')+_0x52239e,_0x30076d);SmsQueueEvents['on'](_0x52239e,_0x552951);}}; \ No newline at end of file +var _0x3f28=['./smsQueue.events','save','emit','register'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x3f28,0x1a0));var _0x83f2=function(_0x2aaf0c,_0x120301){_0x2aaf0c=_0x2aaf0c-0x0;var _0x2ccbed=_0x3f28[_0x2aaf0c];return _0x2ccbed;};'use strict';var SmsQueueEvents=require(_0x83f2('0x0'));var events=[_0x83f2('0x1'),'remove','update'];function createListener(_0x54d3eb,_0x4a4c36){return function(_0x2f22d9){_0x4a4c36[_0x83f2('0x2')](_0x54d3eb,_0x2f22d9);};}function removeListener(_0x2c98ba,_0x18bff9){return function(){SmsQueueEvents['removeListener'](_0x2c98ba,_0x18bff9);};}exports[_0x83f2('0x3')]=function(_0x3b55a3){for(var _0x4bec54=0x0,_0x2db4c5=events['length'];_0x4bec54<_0x2db4c5;_0x4bec54++){var _0x2c883f=events[_0x4bec54];var _0x52acf2=createListener('smsQueue:'+_0x2c883f,_0x3b55a3);SmsQueueEvents['on'](_0x2c883f,_0x52acf2);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9244c34..f93e5b2 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 _0xe300=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x3ae6aa,_0x53ad57){var _0xf24a3d=function(_0x43e3d9){while(--_0x43e3d9){_0x3ae6aa['push'](_0x3ae6aa['shift']());}};_0xf24a3d(++_0x53ad57);}(_0xe300,0xa4));var _0x0e30=function(_0x491efe,_0x2b9d7d){_0x491efe=_0x491efe-0x0;var _0x3998f8=_0xe300[_0x491efe];return _0x3998f8;};'use strict';var multer=require(_0x0e30('0x0'));var util=require(_0x0e30('0x1'));var path=require('path');var timeout=require(_0x0e30('0x2'));var express=require(_0x0e30('0x3'));var router=express[_0x0e30('0x4')]();var fs_extra=require(_0x0e30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e30('0x6'));var config=require(_0x0e30('0x7'));var controller=require(_0x0e30('0x8'));router[_0x0e30('0x9')]('/',auth[_0x0e30('0xa')](),controller[_0x0e30('0xb')]);router['get'](_0x0e30('0xc'),auth[_0x0e30('0xa')](),controller[_0x0e30('0xd')]);router[_0x0e30('0x9')](_0x0e30('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0e30('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e30('0x10')](_0x0e30('0xe'),auth[_0x0e30('0xa')](),controller[_0x0e30('0x11')]);router[_0x0e30('0x12')]('/:id',auth[_0x0e30('0xa')](),controller['destroy']);module[_0x0e30('0x13')]=router; \ No newline at end of file +var _0x5ce1=['update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','/:id','isAuthenticated','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ce1,0xd4));var _0x15ce=function(_0x326038,_0x7bdb1b){_0x326038=_0x326038-0x0;var _0x4b744a=_0x5ce1[_0x326038];return _0x4b744a;};'use strict';var multer=require('multer');var util=require(_0x15ce('0x0'));var path=require(_0x15ce('0x1'));var timeout=require(_0x15ce('0x2'));var express=require('express');var router=express[_0x15ce('0x3')]();var fs_extra=require(_0x15ce('0x4'));var auth=require(_0x15ce('0x5'));var interaction=require(_0x15ce('0x6'));var config=require(_0x15ce('0x7'));var controller=require(_0x15ce('0x8'));router[_0x15ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x15ce('0xa')]);router[_0x15ce('0x9')](_0x15ce('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x15ce('0x9')](_0x15ce('0xc'),auth[_0x15ce('0xd')](),controller['show']);router[_0x15ce('0xe')]('/',auth[_0x15ce('0xd')](),controller[_0x15ce('0xf')]);router['put'](_0x15ce('0xc'),auth['isAuthenticated'](),controller[_0x15ce('0x10')]);router[_0x15ce('0x11')](_0x15ce('0xc'),auth[_0x15ce('0xd')](),controller['destroy']);module[_0x15ce('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5334fb3..53ba372 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 _0x50e9=['STRING','DATE','sequelize'];(function(_0x3e3c83,_0x37e92f){var _0x2b602c=function(_0x3e5955){while(--_0x3e5955){_0x3e3c83['push'](_0x3e3c83['shift']());}};_0x2b602c(++_0x37e92f);}(_0x50e9,0x89));var _0x950e=function(_0x80ba9d,_0x476f63){_0x80ba9d=_0x80ba9d-0x0;var _0x58ddb5=_0x50e9[_0x80ba9d];return _0x58ddb5;};'use strict';var moment=require('moment');var Sequelize=require(_0x950e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x950e('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x950e('0x2')]},'exitAt':{'type':Sequelize[_0x950e('0x2')]},'reason':{'type':Sequelize[_0x950e('0x1')]}}; \ No newline at end of file +var _0x9843=['STRING','DATE','moment'];(function(_0x4e6ceb,_0x5498e8){var _0xcc0679=function(_0x4c7799){while(--_0x4c7799){_0x4e6ceb['push'](_0x4e6ceb['shift']());}};_0xcc0679(++_0x5498e8);}(_0x9843,0xaa));var _0x3984=function(_0x3db1f7,_0x2beb9b){_0x3db1f7=_0x3db1f7-0x0;var _0x5016ed=_0x9843[_0x3db1f7];return _0x5016ed;};'use strict';var moment=require(_0x3984('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3984('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3984('0x2')]},'acceptAt':{'type':Sequelize[_0x3984('0x2')]},'exitAt':{'type':Sequelize[_0x3984('0x2')]},'reason':{'type':Sequelize[_0x3984('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2089616..b29caff 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 _0x86af=['error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','show','include','find','create','body','catch','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then'];(function(_0x32a5f,_0x32de4a){var _0xf4608=function(_0x37589f){while(--_0x37589f){_0x32a5f['push'](_0x32a5f['shift']());}};_0xf4608(++_0x32de4a);}(_0x86af,0x149));var _0xf86a=function(_0x2dcbdf,_0x2a134f){_0x2dcbdf=_0x2dcbdf-0x0;var _0x3fe4f1=_0x86af[_0x2dcbdf];return _0x3fe4f1;};'use strict';var emlformat=require(_0xf86a('0x0'));var rimraf=require(_0xf86a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf86a('0x2'));var rp=require(_0xf86a('0x3'));var moment=require('moment');var BPromise=require(_0xf86a('0x4'));var Mustache=require(_0xf86a('0x5'));var util=require(_0xf86a('0x6'));var path=require('path');var sox=require(_0xf86a('0x7'));var csv=require(_0xf86a('0x8'));var ejs=require(_0xf86a('0x9'));var fs=require('fs');var fs_extra=require(_0xf86a('0xa'));var _=require(_0xf86a('0xb'));var squel=require(_0xf86a('0xc'));var crypto=require(_0xf86a('0xd'));var jsforce=require(_0xf86a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf86a('0xf'));var Papa=require(_0xf86a('0x10'));var Redis=require(_0xf86a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf86a('0x12'));var as=require(_0xf86a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf86a('0x14'))(_0xf86a('0x15'));var utils=require('../../config/utils');var config=require(_0xf86a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49ca20,_0xa51aab){_0xa51aab=_0xa51aab||0xcc;return function(_0x2a3605){if(_0x2a3605){return _0x49ca20[_0xf86a('0x17')](_0xa51aab);}return _0x49ca20[_0xf86a('0x18')](_0xa51aab)[_0xf86a('0x19')]();};}function respondWithResult(_0x266b87,_0x5739c2){_0x5739c2=_0x5739c2||0xc8;return function(_0x159397){if(_0x159397){return _0x266b87[_0xf86a('0x18')](_0x5739c2)[_0xf86a('0x1a')](_0x159397);}};}function respondWithFilteredResult(_0x4f9c7d,_0x1f9372){return function(_0x743f9f){if(_0x743f9f){var _0x385cee=typeof _0x1f9372[_0xf86a('0x1b')]===_0xf86a('0x1c')&&typeof _0x1f9372[_0xf86a('0x1d')]===_0xf86a('0x1c');var _0x2732b6=_0x743f9f[_0xf86a('0x1e')];var _0x21f1fa=_0x385cee?0x0:_0x1f9372[_0xf86a('0x1b')];var _0x2fbbfe=_0x385cee?_0x743f9f[_0xf86a('0x1e')]:_0x1f9372['offset']+_0x1f9372[_0xf86a('0x1d')];var _0x20e433;if(_0x2fbbfe>=_0x2732b6){_0x2fbbfe=_0x2732b6;_0x20e433=0xc8;}else{_0x20e433=0xce;}_0x4f9c7d[_0xf86a('0x18')](_0x20e433);return _0x4f9c7d['set'](_0xf86a('0x1f'),_0x21f1fa+'-'+_0x2fbbfe+'/'+_0x2732b6)[_0xf86a('0x1a')](_0x743f9f);}return null;};}function patchUpdates(_0x36151e){return function(_0x2fed5c){try{jsonpatch['apply'](_0x2fed5c,_0x36151e,!![]);}catch(_0x183fed){return BPromise[_0xf86a('0x20')](_0x183fed);}return _0x2fed5c['save']();};}function saveUpdates(_0x3214ec,_0x274e8b){return function(_0x34ed23){if(_0x34ed23){return _0x34ed23[_0xf86a('0x21')](_0x3214ec)['then'](function(_0x45e9dc){return _0x45e9dc;});}return null;};}function removeEntity(_0x31b987,_0x51df40){return function(_0x83418a){if(_0x83418a){return _0x83418a[_0xf86a('0x22')]()[_0xf86a('0x23')](function(){_0x31b987[_0xf86a('0x18')](0xcc)[_0xf86a('0x19')]();});}};}function handleEntityNotFound(_0x4bd6f9,_0xd5db7b){return function(_0x38d3aa){if(!_0x38d3aa){_0x4bd6f9[_0xf86a('0x17')](0x194);}return _0x38d3aa;};}function handleError(_0x5e4c3a,_0x2522e6){_0x2522e6=_0x2522e6||0x1f4;return function(_0x56f7d4){logger[_0xf86a('0x24')](_0x56f7d4[_0xf86a('0x25')]);if(_0x56f7d4['name']){delete _0x56f7d4[_0xf86a('0x26')];}_0x5e4c3a[_0xf86a('0x18')](_0x2522e6)[_0xf86a('0x27')](_0x56f7d4);};}exports[_0xf86a('0x28')]=function(_0xdc9f7,_0x5c4d20){var _0x14bed9={},_0x8bfdea={},_0x477090={'count':0x0,'rows':[]};var _0x16b845=_[_0xf86a('0x29')](db[_0xf86a('0x2a')][_0xf86a('0x2b')],function(_0x1be754){return{'name':_0x1be754['fieldName'],'type':_0x1be754[_0xf86a('0x2c')]['key']};});_0x8bfdea['model']=_[_0xf86a('0x29')](_0x16b845,_0xf86a('0x26'));_0x8bfdea[_0xf86a('0x2d')]=_[_0xf86a('0x2e')](_0xdc9f7['query']);_0x8bfdea[_0xf86a('0x2f')]=_[_0xf86a('0x30')](_0x8bfdea[_0xf86a('0x31')],_0x8bfdea['query']);_0x14bed9[_0xf86a('0x32')]=_['intersection'](_0x8bfdea['model'],qs['fields'](_0xdc9f7[_0xf86a('0x2d')][_0xf86a('0x33')]));_0x14bed9[_0xf86a('0x32')]=_0x14bed9['attributes'][_0xf86a('0x34')]?_0x14bed9[_0xf86a('0x32')]:_0x8bfdea[_0xf86a('0x31')];if(!_0xdc9f7['query'][_0xf86a('0x35')](_0xf86a('0x36'))){_0x14bed9[_0xf86a('0x1d')]=qs[_0xf86a('0x1d')](_0xdc9f7[_0xf86a('0x2d')][_0xf86a('0x1d')]);_0x14bed9[_0xf86a('0x1b')]=qs[_0xf86a('0x1b')](_0xdc9f7[_0xf86a('0x2d')][_0xf86a('0x1b')]);}_0x14bed9[_0xf86a('0x37')]=qs[_0xf86a('0x38')](_0xdc9f7[_0xf86a('0x2d')][_0xf86a('0x38')]);_0x14bed9[_0xf86a('0x39')]=qs['filters'](_[_0xf86a('0x3a')](_0xdc9f7[_0xf86a('0x2d')],_0x8bfdea[_0xf86a('0x2f')]),_0x16b845);if(_0xdc9f7[_0xf86a('0x2d')]['filter']){_0x14bed9[_0xf86a('0x39')]=_[_0xf86a('0x3b')](_0x14bed9[_0xf86a('0x39')],{'$or':_[_0xf86a('0x29')](_0x16b845,function(_0x21bced){if(_0x21bced[_0xf86a('0x2c')]!==_0xf86a('0x3c')){var _0x45e287={};_0x45e287[_0x21bced[_0xf86a('0x26')]]={'$like':'%'+_0xdc9f7[_0xf86a('0x2d')][_0xf86a('0x3d')]+'%'};return _0x45e287;}})});}_0x14bed9=_[_0xf86a('0x3b')]({},_0x14bed9,_0xdc9f7[_0xf86a('0x3e')]);var _0x3f1cca={'where':_0x14bed9[_0xf86a('0x39')]};return db[_0xf86a('0x2a')][_0xf86a('0x1e')](_0x3f1cca)[_0xf86a('0x23')](function(_0x3682f9){_0x477090[_0xf86a('0x1e')]=_0x3682f9;if(_0xdc9f7[_0xf86a('0x2d')]['includeAll']){_0x14bed9['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0xf86a('0x3f')](_0x14bed9);})[_0xf86a('0x23')](function(_0x6bcfed){_0x477090[_0xf86a('0x40')]=_0x6bcfed;return _0x477090;})['then'](respondWithFilteredResult(_0x5c4d20,_0x14bed9))['catch'](handleError(_0x5c4d20,null));};exports[_0xf86a('0x41')]=function(_0x4b54d2,_0x53c043){var _0x3f14a7={'raw':!![],'where':{'id':_0x4b54d2['params']['id']}},_0x3915e7={};_0x3915e7[_0xf86a('0x31')]=_[_0xf86a('0x2e')](db[_0xf86a('0x2a')][_0xf86a('0x2b')]);_0x3915e7[_0xf86a('0x2d')]=_[_0xf86a('0x2e')](_0x4b54d2['query']);_0x3915e7[_0xf86a('0x2f')]=_['intersection'](_0x3915e7[_0xf86a('0x31')],_0x3915e7[_0xf86a('0x2d')]);_0x3f14a7[_0xf86a('0x32')]=_[_0xf86a('0x30')](_0x3915e7[_0xf86a('0x31')],qs[_0xf86a('0x33')](_0x4b54d2[_0xf86a('0x2d')][_0xf86a('0x33')]));_0x3f14a7[_0xf86a('0x32')]=_0x3f14a7['attributes']['length']?_0x3f14a7[_0xf86a('0x32')]:_0x3915e7['model'];if(_0x4b54d2['query']['includeAll']){_0x3f14a7[_0xf86a('0x42')]=[{'all':!![]}];}_0x3f14a7=_[_0xf86a('0x3b')]({},_0x3f14a7,_0x4b54d2[_0xf86a('0x3e')]);return db[_0xf86a('0x2a')][_0xf86a('0x43')](_0x3f14a7)[_0xf86a('0x23')](handleEntityNotFound(_0x53c043,null))[_0xf86a('0x23')](respondWithResult(_0x53c043,null))['catch'](handleError(_0x53c043,null));};exports[_0xf86a('0x44')]=function(_0x2042a1,_0x5c9002){return db[_0xf86a('0x2a')]['create'](_0x2042a1[_0xf86a('0x45')],{})[_0xf86a('0x23')](respondWithResult(_0x5c9002,0xc9))[_0xf86a('0x46')](handleError(_0x5c9002,null));};exports[_0xf86a('0x21')]=function(_0x467b5e,_0x449435){if(_0x467b5e[_0xf86a('0x45')]['id']){delete _0x467b5e[_0xf86a('0x45')]['id'];}return db[_0xf86a('0x2a')][_0xf86a('0x43')]({'where':{'id':_0x467b5e['params']['id']}})[_0xf86a('0x23')](handleEntityNotFound(_0x449435,null))[_0xf86a('0x23')](saveUpdates(_0x467b5e['body'],null))[_0xf86a('0x23')](respondWithResult(_0x449435,null))[_0xf86a('0x46')](handleError(_0x449435,null));};exports['destroy']=function(_0x85a574,_0x46752f){return db[_0xf86a('0x2a')][_0xf86a('0x43')]({'where':{'id':_0x85a574[_0xf86a('0x47')]['id']}})[_0xf86a('0x23')](handleEntityNotFound(_0x46752f,null))[_0xf86a('0x23')](removeEntity(_0x46752f,null))['catch'](handleError(_0x46752f,null));};exports[_0xf86a('0x48')]=function(_0x170763,_0x2bad0a){return db[_0xf86a('0x2a')][_0xf86a('0x48')]()['then'](respondWithResult(_0x2bad0a,null))[_0xf86a('0x46')](handleError(_0x2bad0a,null));}; \ No newline at end of file +var _0x786d=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','SmsQueueReport','includeAll','include','rows','catch','options','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','send','index','map','rawAttributes'];(function(_0x242c29,_0x168f0a){var _0x3f4d1c=function(_0x87d119){while(--_0x87d119){_0x242c29['push'](_0x242c29['shift']());}};_0x3f4d1c(++_0x168f0a);}(_0x786d,0x147));var _0xd786=function(_0x50adca,_0x44f675){_0x50adca=_0x50adca-0x0;var _0x5643d3=_0x786d[_0x50adca];return _0x5643d3;};'use strict';var emlformat=require(_0xd786('0x0'));var rimraf=require(_0xd786('0x1'));var zipdir=require(_0xd786('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd786('0x3'));var moment=require('moment');var BPromise=require(_0xd786('0x4'));var Mustache=require('mustache');var util=require(_0xd786('0x5'));var path=require(_0xd786('0x6'));var sox=require(_0xd786('0x7'));var csv=require(_0xd786('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd786('0x9'));var _=require(_0xd786('0xa'));var squel=require(_0xd786('0xb'));var crypto=require(_0xd786('0xc'));var jsforce=require(_0xd786('0xd'));var deskjs=require(_0xd786('0xe'));var toCsv=require(_0xd786('0x8'));var querystring=require(_0xd786('0xf'));var Papa=require(_0xd786('0x10'));var Redis=require('ioredis');var authService=require(_0xd786('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd786('0x12'));var hardwareService=require(_0xd786('0x13'));var logger=require(_0xd786('0x14'))(_0xd786('0x15'));var utils=require('../../config/utils');var config=require(_0xd786('0x16'));var licenseUtil=require(_0xd786('0x17'));var db=require(_0xd786('0x18'))['db'];function respondWithStatusCode(_0x40ea9c,_0x5b8b56){_0x5b8b56=_0x5b8b56||0xcc;return function(_0x3a6365){if(_0x3a6365){return _0x40ea9c[_0xd786('0x19')](_0x5b8b56);}return _0x40ea9c[_0xd786('0x1a')](_0x5b8b56)['end']();};}function respondWithResult(_0x1d7f91,_0x224afc){_0x224afc=_0x224afc||0xc8;return function(_0x5703c6){if(_0x5703c6){return _0x1d7f91['status'](_0x224afc)[_0xd786('0x1b')](_0x5703c6);}};}function respondWithFilteredResult(_0x21f756,_0x2543c0){return function(_0x2c46ac){if(_0x2c46ac){var _0x444aa8=typeof _0x2543c0[_0xd786('0x1c')]===_0xd786('0x1d')&&typeof _0x2543c0[_0xd786('0x1e')]===_0xd786('0x1d');var _0x444bec=_0x2c46ac[_0xd786('0x1f')];var _0x5f3b30=_0x444aa8?0x0:_0x2543c0['offset'];var _0x4e24a1=_0x444aa8?_0x2c46ac[_0xd786('0x1f')]:_0x2543c0[_0xd786('0x1c')]+_0x2543c0[_0xd786('0x1e')];var _0x2bce36;if(_0x4e24a1>=_0x444bec){_0x4e24a1=_0x444bec;_0x2bce36=0xc8;}else{_0x2bce36=0xce;}_0x21f756[_0xd786('0x1a')](_0x2bce36);return _0x21f756[_0xd786('0x20')](_0xd786('0x21'),_0x5f3b30+'-'+_0x4e24a1+'/'+_0x444bec)[_0xd786('0x1b')](_0x2c46ac);}return null;};}function patchUpdates(_0x5e18fb){return function(_0x195ad3){try{jsonpatch['apply'](_0x195ad3,_0x5e18fb,!![]);}catch(_0x202282){return BPromise['reject'](_0x202282);}return _0x195ad3['save']();};}function saveUpdates(_0x366901,_0x3ddb21){return function(_0x8276f9){if(_0x8276f9){return _0x8276f9[_0xd786('0x22')](_0x366901)[_0xd786('0x23')](function(_0x568abb){return _0x568abb;});}return null;};}function removeEntity(_0x5bde4d,_0x15d179){return function(_0x4f704b){if(_0x4f704b){return _0x4f704b['destroy']()[_0xd786('0x23')](function(){_0x5bde4d['status'](0xcc)[_0xd786('0x24')]();});}};}function handleEntityNotFound(_0x17b553,_0x54cd94){return function(_0x593dae){if(!_0x593dae){_0x17b553[_0xd786('0x19')](0x194);}return _0x593dae;};}function handleError(_0x196b6f,_0x2e1c1e){_0x2e1c1e=_0x2e1c1e||0x1f4;return function(_0x1c1bdc){logger['error'](_0x1c1bdc[_0xd786('0x25')]);if(_0x1c1bdc[_0xd786('0x26')]){delete _0x1c1bdc['name'];}_0x196b6f[_0xd786('0x1a')](_0x2e1c1e)[_0xd786('0x27')](_0x1c1bdc);};}exports[_0xd786('0x28')]=function(_0x2bd3be,_0x1945c3){var _0xf9cba5={},_0x8809ee={},_0x45c383={'count':0x0,'rows':[]};var _0x4e6657=_[_0xd786('0x29')](db['SmsQueueReport'][_0xd786('0x2a')],function(_0x55586a){return{'name':_0x55586a[_0xd786('0x2b')],'type':_0x55586a['type'][_0xd786('0x2c')]};});_0x8809ee[_0xd786('0x2d')]=_[_0xd786('0x29')](_0x4e6657,_0xd786('0x26'));_0x8809ee[_0xd786('0x2e')]=_[_0xd786('0x2f')](_0x2bd3be['query']);_0x8809ee[_0xd786('0x30')]=_[_0xd786('0x31')](_0x8809ee['model'],_0x8809ee[_0xd786('0x2e')]);_0xf9cba5[_0xd786('0x32')]=_[_0xd786('0x31')](_0x8809ee['model'],qs[_0xd786('0x33')](_0x2bd3be[_0xd786('0x2e')]['fields']));_0xf9cba5[_0xd786('0x32')]=_0xf9cba5[_0xd786('0x32')][_0xd786('0x34')]?_0xf9cba5[_0xd786('0x32')]:_0x8809ee[_0xd786('0x2d')];if(!_0x2bd3be[_0xd786('0x2e')][_0xd786('0x35')](_0xd786('0x36'))){_0xf9cba5[_0xd786('0x1e')]=qs[_0xd786('0x1e')](_0x2bd3be[_0xd786('0x2e')][_0xd786('0x1e')]);_0xf9cba5[_0xd786('0x1c')]=qs[_0xd786('0x1c')](_0x2bd3be[_0xd786('0x2e')][_0xd786('0x1c')]);}_0xf9cba5[_0xd786('0x37')]=qs[_0xd786('0x38')](_0x2bd3be[_0xd786('0x2e')][_0xd786('0x38')]);_0xf9cba5[_0xd786('0x39')]=qs[_0xd786('0x30')](_[_0xd786('0x3a')](_0x2bd3be[_0xd786('0x2e')],_0x8809ee[_0xd786('0x30')]),_0x4e6657);if(_0x2bd3be[_0xd786('0x2e')][_0xd786('0x3b')]){_0xf9cba5[_0xd786('0x39')]=_[_0xd786('0x3c')](_0xf9cba5[_0xd786('0x39')],{'$or':_[_0xd786('0x29')](_0x4e6657,function(_0x130c01){if(_0x130c01[_0xd786('0x3d')]!=='VIRTUAL'){var _0x5a1c6a={};_0x5a1c6a[_0x130c01[_0xd786('0x26')]]={'$like':'%'+_0x2bd3be[_0xd786('0x2e')][_0xd786('0x3b')]+'%'};return _0x5a1c6a;}})});}_0xf9cba5=_['merge']({},_0xf9cba5,_0x2bd3be['options']);var _0x3cfc5d={'where':_0xf9cba5[_0xd786('0x39')]};return db[_0xd786('0x3e')]['count'](_0x3cfc5d)[_0xd786('0x23')](function(_0x53774d){_0x45c383['count']=_0x53774d;if(_0x2bd3be[_0xd786('0x2e')][_0xd786('0x3f')]){_0xf9cba5[_0xd786('0x40')]=[{'all':!![]}];}return db[_0xd786('0x3e')]['findAll'](_0xf9cba5);})[_0xd786('0x23')](function(_0x2c800c){_0x45c383[_0xd786('0x41')]=_0x2c800c;return _0x45c383;})[_0xd786('0x23')](respondWithFilteredResult(_0x1945c3,_0xf9cba5))[_0xd786('0x42')](handleError(_0x1945c3,null));};exports['show']=function(_0x301cac,_0x9fa911){var _0x2f1692={'raw':!![],'where':{'id':_0x301cac['params']['id']}},_0x4bb291={};_0x4bb291['model']=_['keys'](db[_0xd786('0x3e')][_0xd786('0x2a')]);_0x4bb291[_0xd786('0x2e')]=_[_0xd786('0x2f')](_0x301cac[_0xd786('0x2e')]);_0x4bb291['filters']=_['intersection'](_0x4bb291[_0xd786('0x2d')],_0x4bb291[_0xd786('0x2e')]);_0x2f1692[_0xd786('0x32')]=_[_0xd786('0x31')](_0x4bb291['model'],qs[_0xd786('0x33')](_0x301cac[_0xd786('0x2e')]['fields']));_0x2f1692['attributes']=_0x2f1692['attributes']['length']?_0x2f1692[_0xd786('0x32')]:_0x4bb291[_0xd786('0x2d')];if(_0x301cac['query'][_0xd786('0x3f')]){_0x2f1692['include']=[{'all':!![]}];}_0x2f1692=_[_0xd786('0x3c')]({},_0x2f1692,_0x301cac[_0xd786('0x43')]);return db[_0xd786('0x3e')][_0xd786('0x44')](_0x2f1692)[_0xd786('0x23')](handleEntityNotFound(_0x9fa911,null))['then'](respondWithResult(_0x9fa911,null))[_0xd786('0x42')](handleError(_0x9fa911,null));};exports['create']=function(_0xb549a9,_0x925e64){return db[_0xd786('0x3e')][_0xd786('0x45')](_0xb549a9[_0xd786('0x46')],{})['then'](respondWithResult(_0x925e64,0xc9))['catch'](handleError(_0x925e64,null));};exports['update']=function(_0xa73c0,_0x4fe5a6){if(_0xa73c0[_0xd786('0x46')]['id']){delete _0xa73c0[_0xd786('0x46')]['id'];}return db[_0xd786('0x3e')][_0xd786('0x44')]({'where':{'id':_0xa73c0[_0xd786('0x47')]['id']}})[_0xd786('0x23')](handleEntityNotFound(_0x4fe5a6,null))[_0xd786('0x23')](saveUpdates(_0xa73c0['body'],null))[_0xd786('0x23')](respondWithResult(_0x4fe5a6,null))[_0xd786('0x42')](handleError(_0x4fe5a6,null));};exports[_0xd786('0x48')]=function(_0x21111f,_0x242ebe){return db['SmsQueueReport'][_0xd786('0x44')]({'where':{'id':_0x21111f[_0xd786('0x47')]['id']}})[_0xd786('0x23')](handleEntityNotFound(_0x242ebe,null))[_0xd786('0x23')](removeEntity(_0x242ebe,null))['catch'](handleError(_0x242ebe,null));};exports[_0xd786('0x49')]=function(_0x4c0dce,_0x1c5be3){return db[_0xd786('0x3e')]['describe']()[_0xd786('0x23')](respondWithResult(_0x1c5be3,null))['catch'](handleError(_0x1c5be3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4a3777b..97d085c 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x1caf4f,_0xd0b32d){var _0x11b9e2=function(_0xabd605){while(--_0xabd605){_0x1caf4f['push'](_0x1caf4f['shift']());}};_0x11b9e2(++_0xd0b32d);}(_0xe706,0xa3));var _0x6e70=function(_0x10cc81,_0x172700){_0x10cc81=_0x10cc81-0x0;var _0x3bbe1e=_0xe706[_0x10cc81];return _0x3bbe1e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2034a7,_0x48c070){var _0x161a42=function(_0x540a0d){while(--_0x540a0d){_0x2034a7['push'](_0x2034a7['shift']());}};_0x161a42(++_0x48c070);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 cf61ebe..91100e7 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 _0xbc97=['SmsQueueReport','create','body','options','raw','info','stringify','UpdateSmsQueueReport','update','where','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport'];(function(_0x4ecce9,_0x25ce57){var _0x95d9fc=function(_0x5c5c55){while(--_0x5c5c55){_0x4ecce9['push'](_0x4ecce9['shift']());}};_0x95d9fc(++_0x25ce57);}(_0xbc97,0x1ba));var _0x7bc9=function(_0x2eaa4e,_0x503369){_0x2eaa4e=_0x2eaa4e-0x0;var _0x57eb41=_0xbc97[_0x2eaa4e];return _0x57eb41;};'use strict';var _=require(_0x7bc9('0x0'));var util=require('util');var moment=require(_0x7bc9('0x1'));var BPromise=require(_0x7bc9('0x2'));var rs=require(_0x7bc9('0x3'));var fs=require('fs');var Redis=require(_0x7bc9('0x4'));var db=require(_0x7bc9('0x5'))['db'];var utils=require(_0x7bc9('0x6'));var logger=require(_0x7bc9('0x7'))(_0x7bc9('0x8'));var config=require(_0x7bc9('0x9'));var jayson=require(_0x7bc9('0xa'));var client=jayson['client'][_0x7bc9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8d5b63,_0x55559b,_0x5f1a8a){return new BPromise(function(_0x464e98,_0x3d0f38){return client['request'](_0x8d5b63,_0x5f1a8a)['then'](function(_0x18d8be){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x55559b,_0x7bc9('0xc'));logger[_0x7bc9('0xd')](_0x7bc9('0xe'),_0x55559b,_0x7bc9('0xc'),JSON['stringify'](_0x18d8be));if(_0x18d8be[_0x7bc9('0xf')]){if(_0x18d8be[_0x7bc9('0xf')]['code']===0x1f4){logger[_0x7bc9('0xf')](_0x7bc9('0x10'),_0x55559b,_0x18d8be[_0x7bc9('0xf')]['message']);return _0x3d0f38(_0x18d8be[_0x7bc9('0xf')][_0x7bc9('0x11')]);}logger['error'](_0x7bc9('0x10'),_0x55559b,_0x18d8be['error'][_0x7bc9('0x11')]);return _0x464e98(_0x18d8be['error'][_0x7bc9('0x11')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x55559b,_0x7bc9('0xc'));_0x464e98(_0x18d8be['result'][_0x7bc9('0x11')]);}})[_0x7bc9('0x12')](function(_0x3084be){logger[_0x7bc9('0xf')](_0x7bc9('0x10'),_0x55559b,_0x3084be);_0x3d0f38(_0x3084be);});});}exports[_0x7bc9('0x13')]=function(_0x16e678){var _0x1b8b5d=this;return new Promise(function(_0x1e5192,_0x144015){return db[_0x7bc9('0x14')][_0x7bc9('0x15')](_0x16e678[_0x7bc9('0x16')],{'raw':_0x16e678[_0x7bc9('0x17')]?_0x16e678[_0x7bc9('0x17')][_0x7bc9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x468374){logger[_0x7bc9('0x19')](_0x7bc9('0x13'),_0x16e678);logger['debug']('CreateSmsQueueReport',_0x16e678,JSON[_0x7bc9('0x1a')](_0x468374));_0x1e5192(_0x468374);})[_0x7bc9('0x12')](function(_0x352d02){logger[_0x7bc9('0xf')]('CreateSmsQueueReport',_0x352d02['message'],_0x16e678);_0x144015(_0x1b8b5d[_0x7bc9('0xf')](0x1f4,_0x352d02[_0x7bc9('0x11')]));});});};exports[_0x7bc9('0x1b')]=function(_0x382782){var _0x512d75=this;return new Promise(function(_0x14b1ec,_0x4649b5){return db['SmsQueueReport'][_0x7bc9('0x1c')](_0x382782[_0x7bc9('0x16')],{'raw':_0x382782[_0x7bc9('0x17')]?_0x382782['options'][_0x7bc9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x382782[_0x7bc9('0x17')]?_0x382782[_0x7bc9('0x17')][_0x7bc9('0x1d')]||null:null,'attributes':_0x382782[_0x7bc9('0x17')]?_0x382782['options'][_0x7bc9('0x1e')]||null:null,'limit':_0x382782['options']?_0x382782[_0x7bc9('0x17')][_0x7bc9('0x1f')]||null:null})[_0x7bc9('0x20')](function(_0x1cd20a){logger[_0x7bc9('0x19')](_0x7bc9('0x1b'),_0x382782);logger[_0x7bc9('0xd')](_0x7bc9('0x1b'),_0x382782,JSON['stringify'](_0x1cd20a));_0x14b1ec(_0x1cd20a);})['catch'](function(_0x25d52a){logger['error'](_0x7bc9('0x1b'),_0x25d52a[_0x7bc9('0x11')],_0x382782);_0x4649b5(_0x512d75['error'](0x1f4,_0x25d52a[_0x7bc9('0x11')]));});});}; \ No newline at end of file +var _0xbc8b=['rpc','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','update','where','attributes','limit','UpdateSmsQueueReport','moment','bluebird','ioredis','../../config/logger'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0xbc8b,0x146));var _0xbbc8=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xbc8b[_0x3e6b2f];return _0x323215;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbc8('0x0'));var BPromise=require(_0xbbc8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbc8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbc8('0x3'))(_0xbbc8('0x4'));var config=require('../../config/environment');var jayson=require(_0xbbc8('0x5'));var client=jayson[_0xbbc8('0x6')][_0xbbc8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x234936,_0x21a4c0,_0x568cf4){return new BPromise(function(_0x1a1684,_0x4be163){return client['request'](_0x234936,_0x568cf4)[_0xbbc8('0x8')](function(_0x890736){logger[_0xbbc8('0x9')](_0xbbc8('0xa'),_0x21a4c0,'request\x20sent');logger[_0xbbc8('0xb')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x21a4c0,_0xbbc8('0xc'),JSON[_0xbbc8('0xd')](_0x890736));if(_0x890736[_0xbbc8('0xe')]){if(_0x890736[_0xbbc8('0xe')][_0xbbc8('0xf')]===0x1f4){logger[_0xbbc8('0xe')](_0xbbc8('0xa'),_0x21a4c0,_0x890736[_0xbbc8('0xe')][_0xbbc8('0x10')]);return _0x4be163(_0x890736[_0xbbc8('0xe')]['message']);}logger[_0xbbc8('0xe')](_0xbbc8('0xa'),_0x21a4c0,_0x890736[_0xbbc8('0xe')][_0xbbc8('0x10')]);return _0x1a1684(_0x890736[_0xbbc8('0xe')][_0xbbc8('0x10')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x21a4c0,_0xbbc8('0xc'));_0x1a1684(_0x890736[_0xbbc8('0x11')][_0xbbc8('0x10')]);}})['catch'](function(_0x109be6){logger[_0xbbc8('0xe')](_0xbbc8('0xa'),_0x21a4c0,_0x109be6);_0x4be163(_0x109be6);});});}exports[_0xbbc8('0x12')]=function(_0x2e0981){var _0x5c9756=this;return new Promise(function(_0x49613f,_0x292f5e){return db[_0xbbc8('0x13')][_0xbbc8('0x14')](_0x2e0981[_0xbbc8('0x15')],{'raw':_0x2e0981[_0xbbc8('0x16')]?_0x2e0981['options'][_0xbbc8('0x17')]===undefined?!![]:![]:!![]})[_0xbbc8('0x8')](function(_0x43329a){logger[_0xbbc8('0x9')]('CreateSmsQueueReport',_0x2e0981);logger[_0xbbc8('0xb')](_0xbbc8('0x12'),_0x2e0981,JSON['stringify'](_0x43329a));_0x49613f(_0x43329a);})[_0xbbc8('0x18')](function(_0xf01312){logger[_0xbbc8('0xe')]('CreateSmsQueueReport',_0xf01312['message'],_0x2e0981);_0x292f5e(_0x5c9756['error'](0x1f4,_0xf01312[_0xbbc8('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x308e8a){var _0x32498a=this;return new Promise(function(_0x18198a,_0x1cd1d8){return db[_0xbbc8('0x13')][_0xbbc8('0x19')](_0x308e8a[_0xbbc8('0x15')],{'raw':_0x308e8a[_0xbbc8('0x16')]?_0x308e8a[_0xbbc8('0x16')][_0xbbc8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308e8a[_0xbbc8('0x16')]?_0x308e8a[_0xbbc8('0x16')][_0xbbc8('0x1a')]||null:null,'attributes':_0x308e8a[_0xbbc8('0x16')]?_0x308e8a[_0xbbc8('0x16')][_0xbbc8('0x1b')]||null:null,'limit':_0x308e8a['options']?_0x308e8a['options'][_0xbbc8('0x1c')]||null:null})[_0xbbc8('0x8')](function(_0x3648ae){logger[_0xbbc8('0x9')](_0xbbc8('0x1d'),_0x308e8a);logger[_0xbbc8('0xb')](_0xbbc8('0x1d'),_0x308e8a,JSON['stringify'](_0x3648ae));_0x18198a(_0x3648ae);})['catch'](function(_0x503808){logger[_0xbbc8('0xe')](_0xbbc8('0x1d'),_0x503808['message'],_0x308e8a);_0x1cd1d8(_0x32498a[_0xbbc8('0xe')](0x1f4,_0x503808[_0xbbc8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3b38c87..c9b9010 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 _0x9f5a=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','put'];(function(_0x27a63d,_0x4db1e0){var _0x3326d8=function(_0x75e8be){while(--_0x75e8be){_0x27a63d['push'](_0x27a63d['shift']());}};_0x3326d8(++_0x4db1e0);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x150784,_0x5ce791){_0x150784=_0x150784-0x0;var _0x4ac35b=_0x9f5a[_0x150784];return _0x4ac35b;};'use strict';var multer=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var path=require(_0xa9f5('0x2'));var timeout=require(_0xa9f5('0x3'));var express=require('express');var router=express[_0xa9f5('0x4')]();var fs_extra=require(_0xa9f5('0x5'));var auth=require(_0xa9f5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9f5('0x7'));var controller=require('./smsTransferReport.controller');router[_0xa9f5('0x8')]('/',auth[_0xa9f5('0x9')](),controller['index']);router[_0xa9f5('0x8')](_0xa9f5('0xa'),auth[_0xa9f5('0x9')](),controller[_0xa9f5('0xb')]);router[_0xa9f5('0x8')](_0xa9f5('0xc'),auth[_0xa9f5('0x9')](),controller['show']);router[_0xa9f5('0xd')]('/',auth[_0xa9f5('0x9')](),controller['create']);router[_0xa9f5('0xe')](_0xa9f5('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa9f5('0xf')](_0xa9f5('0xc'),auth[_0xa9f5('0x9')](),controller[_0xa9f5('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6c7b=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x29acef,_0x3fa99b){_0x29acef=_0x29acef-0x0;var _0x66385d=_0x6c7b[_0x29acef];return _0x66385d;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0xc')]('/',auth[_0xb6c7('0x7')](),controller['create']);router['put'](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xe')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f058760..6433669 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x528aab,_0x32ba87){_0x528aab=_0x528aab-0x0;var _0x3ef16a=_0x9bde[_0x528aab];return _0x3ef16a;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3c201b,_0x477025){var _0x556eab=function(_0xd855c3){while(--_0xd855c3){_0x3c201b['push'](_0x3c201b['shift']());}};_0x556eab(++_0x477025);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 167100e..b405e81 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 _0x0cf0=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SmsTransferReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x198244,_0x3b3e4e){var _0x379ba5=function(_0x3eef96){while(--_0x3eef96){_0x198244['push'](_0x198244['shift']());}};_0x379ba5(++_0x3b3e4e);}(_0x0cf0,0x117));var _0x00cf=function(_0x274d73,_0x5cdcc7){_0x274d73=_0x274d73-0x0;var _0x6c21d5=_0x0cf0[_0x274d73];return _0x6c21d5;};'use strict';var emlformat=require(_0x00cf('0x0'));var rimraf=require(_0x00cf('0x1'));var zipdir=require(_0x00cf('0x2'));var jsonpatch=require(_0x00cf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00cf('0x4'));var Mustache=require(_0x00cf('0x5'));var util=require(_0x00cf('0x6'));var path=require(_0x00cf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x00cf('0x8'));var fs=require('fs');var fs_extra=require(_0x00cf('0x9'));var _=require(_0x00cf('0xa'));var squel=require(_0x00cf('0xb'));var crypto=require(_0x00cf('0xc'));var jsforce=require(_0x00cf('0xd'));var deskjs=require(_0x00cf('0xe'));var toCsv=require(_0x00cf('0xf'));var querystring=require(_0x00cf('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x00cf('0x11'));var qs=require(_0x00cf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00cf('0x13'));var logger=require(_0x00cf('0x14'))(_0x00cf('0x15'));var utils=require(_0x00cf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x00cf('0x17'));var db=require(_0x00cf('0x18'))['db'];function respondWithStatusCode(_0x373852,_0x3f0e34){_0x3f0e34=_0x3f0e34||0xcc;return function(_0x290e79){if(_0x290e79){return _0x373852[_0x00cf('0x19')](_0x3f0e34);}return _0x373852['status'](_0x3f0e34)['end']();};}function respondWithResult(_0x380c6f,_0x2c5b03){_0x2c5b03=_0x2c5b03||0xc8;return function(_0x3bc516){if(_0x3bc516){return _0x380c6f[_0x00cf('0x1a')](_0x2c5b03)[_0x00cf('0x1b')](_0x3bc516);}};}function respondWithFilteredResult(_0x3f867a,_0x22164b){return function(_0x353799){if(_0x353799){var _0x256363=typeof _0x22164b[_0x00cf('0x1c')]===_0x00cf('0x1d')&&typeof _0x22164b['limit']==='undefined';var _0x4e8c2f=_0x353799[_0x00cf('0x1e')];var _0xb6aa2=_0x256363?0x0:_0x22164b[_0x00cf('0x1c')];var _0x237fb5=_0x256363?_0x353799['count']:_0x22164b[_0x00cf('0x1c')]+_0x22164b[_0x00cf('0x1f')];var _0x5f4457;if(_0x237fb5>=_0x4e8c2f){_0x237fb5=_0x4e8c2f;_0x5f4457=0xc8;}else{_0x5f4457=0xce;}_0x3f867a[_0x00cf('0x1a')](_0x5f4457);return _0x3f867a['set'](_0x00cf('0x20'),_0xb6aa2+'-'+_0x237fb5+'/'+_0x4e8c2f)[_0x00cf('0x1b')](_0x353799);}return null;};}function patchUpdates(_0x54bdce){return function(_0x19acb2){try{jsonpatch[_0x00cf('0x21')](_0x19acb2,_0x54bdce,!![]);}catch(_0x21b7d1){return BPromise[_0x00cf('0x22')](_0x21b7d1);}return _0x19acb2[_0x00cf('0x23')]();};}function saveUpdates(_0x31776f,_0x4c68b4){return function(_0x5a856f){if(_0x5a856f){return _0x5a856f[_0x00cf('0x24')](_0x31776f)[_0x00cf('0x25')](function(_0x19fc11){return _0x19fc11;});}return null;};}function removeEntity(_0x181677,_0x4c81d3){return function(_0x554e91){if(_0x554e91){return _0x554e91[_0x00cf('0x26')]()['then'](function(){_0x181677[_0x00cf('0x1a')](0xcc)[_0x00cf('0x27')]();});}};}function handleEntityNotFound(_0x347882,_0x25efff){return function(_0x2b3d73){if(!_0x2b3d73){_0x347882[_0x00cf('0x19')](0x194);}return _0x2b3d73;};}function handleError(_0x2d3139,_0x10ed0c){_0x10ed0c=_0x10ed0c||0x1f4;return function(_0x47e94f){logger[_0x00cf('0x28')](_0x47e94f[_0x00cf('0x29')]);if(_0x47e94f[_0x00cf('0x2a')]){delete _0x47e94f[_0x00cf('0x2a')];}_0x2d3139[_0x00cf('0x1a')](_0x10ed0c)['send'](_0x47e94f);};}exports[_0x00cf('0x2b')]=function(_0xedaac6,_0x423669){var _0x6c24fa={},_0x208457={},_0x1df08b={'count':0x0,'rows':[]};var _0x2d76e6=_[_0x00cf('0x2c')](db[_0x00cf('0x2d')]['rawAttributes'],function(_0x2fb9be){return{'name':_0x2fb9be[_0x00cf('0x2e')],'type':_0x2fb9be[_0x00cf('0x2f')][_0x00cf('0x30')]};});_0x208457['model']=_[_0x00cf('0x2c')](_0x2d76e6,'name');_0x208457[_0x00cf('0x31')]=_[_0x00cf('0x32')](_0xedaac6[_0x00cf('0x31')]);_0x208457[_0x00cf('0x33')]=_[_0x00cf('0x34')](_0x208457[_0x00cf('0x35')],_0x208457[_0x00cf('0x31')]);_0x6c24fa[_0x00cf('0x36')]=_['intersection'](_0x208457[_0x00cf('0x35')],qs[_0x00cf('0x37')](_0xedaac6[_0x00cf('0x31')][_0x00cf('0x37')]));_0x6c24fa[_0x00cf('0x36')]=_0x6c24fa[_0x00cf('0x36')][_0x00cf('0x38')]?_0x6c24fa['attributes']:_0x208457['model'];if(!_0xedaac6[_0x00cf('0x31')][_0x00cf('0x39')](_0x00cf('0x3a'))){_0x6c24fa['limit']=qs[_0x00cf('0x1f')](_0xedaac6['query'][_0x00cf('0x1f')]);_0x6c24fa[_0x00cf('0x1c')]=qs[_0x00cf('0x1c')](_0xedaac6['query'][_0x00cf('0x1c')]);}_0x6c24fa['order']=qs[_0x00cf('0x3b')](_0xedaac6[_0x00cf('0x31')][_0x00cf('0x3b')]);_0x6c24fa[_0x00cf('0x3c')]=qs[_0x00cf('0x33')](_['pick'](_0xedaac6[_0x00cf('0x31')],_0x208457[_0x00cf('0x33')]),_0x2d76e6);if(_0xedaac6[_0x00cf('0x31')]['filter']){_0x6c24fa['where']=_[_0x00cf('0x3d')](_0x6c24fa[_0x00cf('0x3c')],{'$or':_[_0x00cf('0x2c')](_0x2d76e6,function(_0xb7ceb9){if(_0xb7ceb9[_0x00cf('0x2f')]!==_0x00cf('0x3e')){var _0x4492ac={};_0x4492ac[_0xb7ceb9[_0x00cf('0x2a')]]={'$like':'%'+_0xedaac6[_0x00cf('0x31')][_0x00cf('0x3f')]+'%'};return _0x4492ac;}})});}_0x6c24fa=_[_0x00cf('0x3d')]({},_0x6c24fa,_0xedaac6['options']);var _0x48ccbe={'where':_0x6c24fa[_0x00cf('0x3c')]};return db[_0x00cf('0x2d')][_0x00cf('0x1e')](_0x48ccbe)[_0x00cf('0x25')](function(_0x4a6879){_0x1df08b[_0x00cf('0x1e')]=_0x4a6879;if(_0xedaac6[_0x00cf('0x31')][_0x00cf('0x40')]){_0x6c24fa[_0x00cf('0x41')]=[{'all':!![]}];}return db[_0x00cf('0x2d')][_0x00cf('0x42')](_0x6c24fa);})[_0x00cf('0x25')](function(_0x268628){_0x1df08b[_0x00cf('0x43')]=_0x268628;return _0x1df08b;})[_0x00cf('0x25')](respondWithFilteredResult(_0x423669,_0x6c24fa))[_0x00cf('0x44')](handleError(_0x423669,null));};exports['show']=function(_0x30f140,_0x53da8){var _0x529fd4={'raw':!![],'where':{'id':_0x30f140[_0x00cf('0x45')]['id']}},_0x57eb3d={};_0x57eb3d[_0x00cf('0x35')]=_[_0x00cf('0x32')](db['SmsTransferReport']['rawAttributes']);_0x57eb3d[_0x00cf('0x31')]=_['keys'](_0x30f140[_0x00cf('0x31')]);_0x57eb3d[_0x00cf('0x33')]=_['intersection'](_0x57eb3d[_0x00cf('0x35')],_0x57eb3d[_0x00cf('0x31')]);_0x529fd4[_0x00cf('0x36')]=_['intersection'](_0x57eb3d['model'],qs[_0x00cf('0x37')](_0x30f140[_0x00cf('0x31')][_0x00cf('0x37')]));_0x529fd4[_0x00cf('0x36')]=_0x529fd4[_0x00cf('0x36')][_0x00cf('0x38')]?_0x529fd4[_0x00cf('0x36')]:_0x57eb3d[_0x00cf('0x35')];if(_0x30f140[_0x00cf('0x31')]['includeAll']){_0x529fd4[_0x00cf('0x41')]=[{'all':!![]}];}_0x529fd4=_[_0x00cf('0x3d')]({},_0x529fd4,_0x30f140['options']);return db[_0x00cf('0x2d')][_0x00cf('0x46')](_0x529fd4)[_0x00cf('0x25')](handleEntityNotFound(_0x53da8,null))['then'](respondWithResult(_0x53da8,null))[_0x00cf('0x44')](handleError(_0x53da8,null));};exports[_0x00cf('0x47')]=function(_0x204d5f,_0x3baffc){return db[_0x00cf('0x2d')][_0x00cf('0x47')](_0x204d5f['body'],{})['then'](respondWithResult(_0x3baffc,0xc9))[_0x00cf('0x44')](handleError(_0x3baffc,null));};exports[_0x00cf('0x24')]=function(_0x5e7ca8,_0x3a4911){if(_0x5e7ca8['body']['id']){delete _0x5e7ca8[_0x00cf('0x48')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x5e7ca8[_0x00cf('0x45')]['id']}})[_0x00cf('0x25')](handleEntityNotFound(_0x3a4911,null))[_0x00cf('0x25')](saveUpdates(_0x5e7ca8[_0x00cf('0x48')],null))[_0x00cf('0x25')](respondWithResult(_0x3a4911,null))[_0x00cf('0x44')](handleError(_0x3a4911,null));};exports[_0x00cf('0x26')]=function(_0x1882d6,_0x35ae2f){return db[_0x00cf('0x2d')][_0x00cf('0x46')]({'where':{'id':_0x1882d6['params']['id']}})[_0x00cf('0x25')](handleEntityNotFound(_0x35ae2f,null))[_0x00cf('0x25')](removeEntity(_0x35ae2f,null))[_0x00cf('0x44')](handleError(_0x35ae2f,null));};exports[_0x00cf('0x49')]=function(_0x580f03,_0x2fb7ad){return db['SmsTransferReport'][_0x00cf('0x49')]()[_0x00cf('0x25')](respondWithResult(_0x2fb7ad,null))[_0x00cf('0x44')](handleError(_0x2fb7ad,null));}; \ No newline at end of file +var _0xf6e0=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes'];(function(_0x296307,_0x2df893){var _0x399df8=function(_0x12830a){while(--_0x12830a){_0x296307['push'](_0x296307['shift']());}};_0x399df8(++_0x2df893);}(_0xf6e0,0x152));var _0x0f6e=function(_0x2fdf4b,_0x2de9f3){_0x2fdf4b=_0x2fdf4b-0x0;var _0x3bbc5c=_0xf6e0[_0x2fdf4b];return _0x3bbc5c;};'use strict';var emlformat=require(_0x0f6e('0x0'));var rimraf=require(_0x0f6e('0x1'));var zipdir=require(_0x0f6e('0x2'));var jsonpatch=require(_0x0f6e('0x3'));var rp=require('request-promise');var moment=require(_0x0f6e('0x4'));var BPromise=require(_0x0f6e('0x5'));var Mustache=require(_0x0f6e('0x6'));var util=require(_0x0f6e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0f6e('0x8'));var fs=require('fs');var fs_extra=require(_0x0f6e('0x9'));var _=require(_0x0f6e('0xa'));var squel=require(_0x0f6e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f6e('0xc'));var toCsv=require(_0x0f6e('0xd'));var querystring=require(_0x0f6e('0xe'));var Papa=require(_0x0f6e('0xf'));var Redis=require(_0x0f6e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0f6e('0x11'));var as=require(_0x0f6e('0x12'));var hardwareService=require(_0x0f6e('0x13'));var logger=require(_0x0f6e('0x14'))(_0x0f6e('0x15'));var utils=require('../../config/utils');var config=require(_0x0f6e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f6e('0x17'))['db'];function respondWithStatusCode(_0x14a3c0,_0x358469){_0x358469=_0x358469||0xcc;return function(_0x10a41a){if(_0x10a41a){return _0x14a3c0['sendStatus'](_0x358469);}return _0x14a3c0[_0x0f6e('0x18')](_0x358469)[_0x0f6e('0x19')]();};}function respondWithResult(_0x2b8373,_0x1163ff){_0x1163ff=_0x1163ff||0xc8;return function(_0x58b175){if(_0x58b175){return _0x2b8373[_0x0f6e('0x18')](_0x1163ff)[_0x0f6e('0x1a')](_0x58b175);}};}function respondWithFilteredResult(_0x3f90a0,_0x414155){return function(_0x6d3c8a){if(_0x6d3c8a){var _0x2ad22b=typeof _0x414155[_0x0f6e('0x1b')]===_0x0f6e('0x1c')&&typeof _0x414155[_0x0f6e('0x1d')]===_0x0f6e('0x1c');var _0x3d8ae7=_0x6d3c8a['count'];var _0x3bf6dc=_0x2ad22b?0x0:_0x414155[_0x0f6e('0x1b')];var _0x342ef4=_0x2ad22b?_0x6d3c8a[_0x0f6e('0x1e')]:_0x414155['offset']+_0x414155['limit'];var _0x509fda;if(_0x342ef4>=_0x3d8ae7){_0x342ef4=_0x3d8ae7;_0x509fda=0xc8;}else{_0x509fda=0xce;}_0x3f90a0[_0x0f6e('0x18')](_0x509fda);return _0x3f90a0[_0x0f6e('0x1f')](_0x0f6e('0x20'),_0x3bf6dc+'-'+_0x342ef4+'/'+_0x3d8ae7)['json'](_0x6d3c8a);}return null;};}function patchUpdates(_0x51e4cc){return function(_0x10d72f){try{jsonpatch[_0x0f6e('0x21')](_0x10d72f,_0x51e4cc,!![]);}catch(_0x43f19f){return BPromise[_0x0f6e('0x22')](_0x43f19f);}return _0x10d72f[_0x0f6e('0x23')]();};}function saveUpdates(_0x15bc6d,_0x51666c){return function(_0x5a8b2f){if(_0x5a8b2f){return _0x5a8b2f[_0x0f6e('0x24')](_0x15bc6d)['then'](function(_0x2b19cd){return _0x2b19cd;});}return null;};}function removeEntity(_0x437f29,_0x35d222){return function(_0x45c988){if(_0x45c988){return _0x45c988['destroy']()[_0x0f6e('0x25')](function(){_0x437f29[_0x0f6e('0x18')](0xcc)[_0x0f6e('0x19')]();});}};}function handleEntityNotFound(_0x1a038f,_0x2b5f7d){return function(_0x5dd4f5){if(!_0x5dd4f5){_0x1a038f[_0x0f6e('0x26')](0x194);}return _0x5dd4f5;};}function handleError(_0x4fa4f7,_0x113cd9){_0x113cd9=_0x113cd9||0x1f4;return function(_0x36ec0f){logger[_0x0f6e('0x27')](_0x36ec0f[_0x0f6e('0x28')]);if(_0x36ec0f[_0x0f6e('0x29')]){delete _0x36ec0f[_0x0f6e('0x29')];}_0x4fa4f7['status'](_0x113cd9)[_0x0f6e('0x2a')](_0x36ec0f);};}exports[_0x0f6e('0x2b')]=function(_0x2a8fb6,_0x3a4a5f){var _0x2f043a={},_0x453b84={},_0x3776bf={'count':0x0,'rows':[]};var _0x24d8c5=_[_0x0f6e('0x2c')](db[_0x0f6e('0x2d')][_0x0f6e('0x2e')],function(_0x26799c){return{'name':_0x26799c[_0x0f6e('0x2f')],'type':_0x26799c[_0x0f6e('0x30')][_0x0f6e('0x31')]};});_0x453b84[_0x0f6e('0x32')]=_[_0x0f6e('0x2c')](_0x24d8c5,_0x0f6e('0x29'));_0x453b84[_0x0f6e('0x33')]=_[_0x0f6e('0x34')](_0x2a8fb6[_0x0f6e('0x33')]);_0x453b84[_0x0f6e('0x35')]=_['intersection'](_0x453b84['model'],_0x453b84[_0x0f6e('0x33')]);_0x2f043a['attributes']=_[_0x0f6e('0x36')](_0x453b84[_0x0f6e('0x32')],qs['fields'](_0x2a8fb6['query'][_0x0f6e('0x37')]));_0x2f043a['attributes']=_0x2f043a[_0x0f6e('0x38')][_0x0f6e('0x39')]?_0x2f043a[_0x0f6e('0x38')]:_0x453b84[_0x0f6e('0x32')];if(!_0x2a8fb6[_0x0f6e('0x33')]['hasOwnProperty']('nolimit')){_0x2f043a[_0x0f6e('0x1d')]=qs[_0x0f6e('0x1d')](_0x2a8fb6['query'][_0x0f6e('0x1d')]);_0x2f043a[_0x0f6e('0x1b')]=qs[_0x0f6e('0x1b')](_0x2a8fb6['query'][_0x0f6e('0x1b')]);}_0x2f043a['order']=qs[_0x0f6e('0x3a')](_0x2a8fb6[_0x0f6e('0x33')][_0x0f6e('0x3a')]);_0x2f043a['where']=qs['filters'](_[_0x0f6e('0x3b')](_0x2a8fb6[_0x0f6e('0x33')],_0x453b84[_0x0f6e('0x35')]),_0x24d8c5);if(_0x2a8fb6[_0x0f6e('0x33')][_0x0f6e('0x3c')]){_0x2f043a[_0x0f6e('0x3d')]=_[_0x0f6e('0x3e')](_0x2f043a[_0x0f6e('0x3d')],{'$or':_['map'](_0x24d8c5,function(_0x181a5f){if(_0x181a5f[_0x0f6e('0x30')]!==_0x0f6e('0x3f')){var _0x2acd54={};_0x2acd54[_0x181a5f[_0x0f6e('0x29')]]={'$like':'%'+_0x2a8fb6[_0x0f6e('0x33')][_0x0f6e('0x3c')]+'%'};return _0x2acd54;}})});}_0x2f043a=_[_0x0f6e('0x3e')]({},_0x2f043a,_0x2a8fb6[_0x0f6e('0x40')]);var _0x445b29={'where':_0x2f043a[_0x0f6e('0x3d')]};return db[_0x0f6e('0x2d')]['count'](_0x445b29)['then'](function(_0x414725){_0x3776bf[_0x0f6e('0x1e')]=_0x414725;if(_0x2a8fb6[_0x0f6e('0x33')][_0x0f6e('0x41')]){_0x2f043a['include']=[{'all':!![]}];}return db[_0x0f6e('0x2d')][_0x0f6e('0x42')](_0x2f043a);})[_0x0f6e('0x25')](function(_0x39723b){_0x3776bf[_0x0f6e('0x43')]=_0x39723b;return _0x3776bf;})[_0x0f6e('0x25')](respondWithFilteredResult(_0x3a4a5f,_0x2f043a))[_0x0f6e('0x44')](handleError(_0x3a4a5f,null));};exports[_0x0f6e('0x45')]=function(_0x45ff03,_0xb543cf){var _0x520aae={'raw':!![],'where':{'id':_0x45ff03[_0x0f6e('0x46')]['id']}},_0x1d809a={};_0x1d809a[_0x0f6e('0x32')]=_['keys'](db['SmsTransferReport'][_0x0f6e('0x2e')]);_0x1d809a['query']=_['keys'](_0x45ff03[_0x0f6e('0x33')]);_0x1d809a[_0x0f6e('0x35')]=_[_0x0f6e('0x36')](_0x1d809a[_0x0f6e('0x32')],_0x1d809a[_0x0f6e('0x33')]);_0x520aae['attributes']=_['intersection'](_0x1d809a[_0x0f6e('0x32')],qs[_0x0f6e('0x37')](_0x45ff03[_0x0f6e('0x33')]['fields']));_0x520aae['attributes']=_0x520aae[_0x0f6e('0x38')]['length']?_0x520aae[_0x0f6e('0x38')]:_0x1d809a[_0x0f6e('0x32')];if(_0x45ff03[_0x0f6e('0x33')][_0x0f6e('0x41')]){_0x520aae[_0x0f6e('0x47')]=[{'all':!![]}];}_0x520aae=_[_0x0f6e('0x3e')]({},_0x520aae,_0x45ff03['options']);return db[_0x0f6e('0x2d')][_0x0f6e('0x48')](_0x520aae)[_0x0f6e('0x25')](handleEntityNotFound(_0xb543cf,null))[_0x0f6e('0x25')](respondWithResult(_0xb543cf,null))[_0x0f6e('0x44')](handleError(_0xb543cf,null));};exports[_0x0f6e('0x49')]=function(_0x205073,_0x15b7b6){return db[_0x0f6e('0x2d')][_0x0f6e('0x49')](_0x205073[_0x0f6e('0x4a')],{})[_0x0f6e('0x25')](respondWithResult(_0x15b7b6,0xc9))[_0x0f6e('0x44')](handleError(_0x15b7b6,null));};exports[_0x0f6e('0x24')]=function(_0x541da7,_0x585469){if(_0x541da7['body']['id']){delete _0x541da7[_0x0f6e('0x4a')]['id'];}return db[_0x0f6e('0x2d')][_0x0f6e('0x48')]({'where':{'id':_0x541da7[_0x0f6e('0x46')]['id']}})[_0x0f6e('0x25')](handleEntityNotFound(_0x585469,null))[_0x0f6e('0x25')](saveUpdates(_0x541da7['body'],null))[_0x0f6e('0x25')](respondWithResult(_0x585469,null))[_0x0f6e('0x44')](handleError(_0x585469,null));};exports[_0x0f6e('0x4b')]=function(_0x5295aa,_0x18c6a9){return db[_0x0f6e('0x2d')]['find']({'where':{'id':_0x5295aa[_0x0f6e('0x46')]['id']}})[_0x0f6e('0x25')](handleEntityNotFound(_0x18c6a9,null))[_0x0f6e('0x25')](removeEntity(_0x18c6a9,null))[_0x0f6e('0x44')](handleError(_0x18c6a9,null));};exports['describe']=function(_0x9f12e3,_0x47e176){return db[_0x0f6e('0x2d')][_0x0f6e('0x4c')]()[_0x0f6e('0x25')](respondWithResult(_0x47e176,null))['catch'](handleError(_0x47e176,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 525a156..9155618 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 _0xad7c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid'];(function(_0x5825ca,_0x383bad){var _0x3daa4e=function(_0x1c9d00){while(--_0x1c9d00){_0x5825ca['push'](_0x5825ca['shift']());}};_0x3daa4e(++_0x383bad);}(_0xad7c,0x8c));var _0xcad7=function(_0x43cb6c,_0x47508a){_0x43cb6c=_0x43cb6c-0x0;var _0x4716e1=_0xad7c[_0x43cb6c];return _0x4716e1;};'use strict';var _=require(_0xcad7('0x0'));var util=require(_0xcad7('0x1'));var logger=require(_0xcad7('0x2'))(_0xcad7('0x3'));var moment=require(_0xcad7('0x4'));var BPromise=require('bluebird');var rp=require(_0xcad7('0x5'));var fs=require('fs');var path=require(_0xcad7('0x6'));var rimraf=require(_0xcad7('0x7'));var config=require(_0xcad7('0x8'));var attributes=require(_0xcad7('0x9'));module[_0xcad7('0xa')]=function(_0x4249be,_0x5a546c){return _0x4249be[_0xcad7('0xb')](_0xcad7('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xcad7('0xd'),'fields':[_0xcad7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c74=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x0c74,0x1cd));var _0x40c7=function(_0x511c1f,_0x4cf980){_0x511c1f=_0x511c1f-0x0;var _0x28a239=_0x0c74[_0x511c1f];return _0x28a239;};'use strict';var _=require('lodash');var util=require(_0x40c7('0x0'));var logger=require(_0x40c7('0x1'))(_0x40c7('0x2'));var moment=require(_0x40c7('0x3'));var BPromise=require(_0x40c7('0x4'));var rp=require(_0x40c7('0x5'));var fs=require('fs');var path=require(_0x40c7('0x6'));var rimraf=require('rimraf');var config=require(_0x40c7('0x7'));var attributes=require(_0x40c7('0x8'));module[_0x40c7('0x9')]=function(_0x435ca0,_0x4d7ffb){return _0x435ca0[_0x40c7('0xa')](_0x40c7('0xb'),attributes,{'tableName':_0x40c7('0xc'),'paranoid':![],'indexes':[{'name':_0x40c7('0xd'),'fields':[_0x40c7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index cd66a26..56df17b 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 _0x7b83=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsTransferReport,\x20%s,\x20%s','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x7b83,0xa1));var _0x37b8=function(_0x3ef526,_0x2cb29d){_0x3ef526=_0x3ef526-0x0;var _0x257f66=_0x7b83[_0x3ef526];return _0x257f66;};'use strict';var _=require(_0x37b8('0x0'));var util=require(_0x37b8('0x1'));var moment=require(_0x37b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37b8('0x3'));var db=require(_0x37b8('0x4'))['db'];var utils=require(_0x37b8('0x5'));var logger=require('../../config/logger')(_0x37b8('0x6'));var config=require(_0x37b8('0x7'));var jayson=require(_0x37b8('0x8'));var client=jayson[_0x37b8('0x9')][_0x37b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x220cd2,_0x5eb540,_0x45e094){return new BPromise(function(_0xc3ab5b,_0x50f729){return client[_0x37b8('0xb')](_0x220cd2,_0x45e094)['then'](function(_0x548dfd){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x37b8('0xc'));logger[_0x37b8('0xd')](_0x37b8('0xe'),_0x5eb540,_0x37b8('0xc'),JSON[_0x37b8('0xf')](_0x548dfd));if(_0x548dfd['error']){if(_0x548dfd[_0x37b8('0x10')]['code']===0x1f4){logger[_0x37b8('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);return _0x50f729(_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);}logger[_0x37b8('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x548dfd['error'][_0x37b8('0x11')]);return _0xc3ab5b(_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x5eb540,_0x37b8('0xc'));_0xc3ab5b(_0x548dfd[_0x37b8('0x12')][_0x37b8('0x11')]);}})[_0x37b8('0x13')](function(_0x290068){logger[_0x37b8('0x10')](_0x37b8('0x14'),_0x5eb540,_0x290068);_0x50f729(_0x290068);});});} \ No newline at end of file +var _0x27bf=['rpc','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x27bf,0x117));var _0xf27b=function(_0x2ddc3e,_0x54abc9){_0x2ddc3e=_0x2ddc3e-0x0;var _0xbeb360=_0x27bf[_0x2ddc3e];return _0xbeb360;};'use strict';var _=require(_0xf27b('0x0'));var util=require(_0xf27b('0x1'));var moment=require(_0xf27b('0x2'));var BPromise=require(_0xf27b('0x3'));var rs=require(_0xf27b('0x4'));var fs=require('fs');var Redis=require(_0xf27b('0x5'));var db=require(_0xf27b('0x6'))['db'];var utils=require(_0xf27b('0x7'));var logger=require(_0xf27b('0x8'))(_0xf27b('0x9'));var config=require(_0xf27b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf27b('0xb')][_0xf27b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2476ab,_0x32391c,_0x1fdc28){return new BPromise(function(_0x36d178,_0x4df7c0){return client[_0xf27b('0xd')](_0x2476ab,_0x1fdc28)[_0xf27b('0xe')](function(_0x969a6f){logger[_0xf27b('0xf')](_0xf27b('0x10'),_0x32391c,_0xf27b('0x11'));logger[_0xf27b('0x12')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x32391c,'request\x20sent',JSON['stringify'](_0x969a6f));if(_0x969a6f[_0xf27b('0x13')]){if(_0x969a6f['error'][_0xf27b('0x14')]===0x1f4){logger[_0xf27b('0x13')](_0xf27b('0x10'),_0x32391c,_0x969a6f[_0xf27b('0x13')]['message']);return _0x4df7c0(_0x969a6f[_0xf27b('0x13')][_0xf27b('0x15')]);}logger[_0xf27b('0x13')](_0xf27b('0x10'),_0x32391c,_0x969a6f['error'][_0xf27b('0x15')]);return _0x36d178(_0x969a6f[_0xf27b('0x13')]['message']);}else{logger['info'](_0xf27b('0x10'),_0x32391c,'request\x20sent');_0x36d178(_0x969a6f[_0xf27b('0x16')][_0xf27b('0x15')]);}})[_0xf27b('0x17')](function(_0x5305d9){logger[_0xf27b('0x13')](_0xf27b('0x10'),_0x32391c,_0x5305d9);_0x4df7c0(_0x5305d9);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 92dd2f7..15248c4 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 _0xef34=['isAuthenticated','index','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','basename','extname','now','post','single','create','update','delete','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x5f49bc,_0x548555){var _0x44bbb9=function(_0x5e2caf){while(--_0x5e2caf){_0x5f49bc['push'](_0x5f49bc['shift']());}};_0x44bbb9(++_0x548555);}(_0xef34,0x88));var _0x4ef3=function(_0x30ff8d,_0x5307af){_0x30ff8d=_0x30ff8d-0x0;var _0x5d5df6=_0xef34[_0x30ff8d];return _0x5d5df6;};'use strict';var multer=require(_0x4ef3('0x0'));var util=require('util');var path=require(_0x4ef3('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ef3('0x2'));var router=express[_0x4ef3('0x3')]();var fs_extra=require(_0x4ef3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4ef3('0x5'));var config=require(_0x4ef3('0x6'));var controller=require(_0x4ef3('0x7'));router[_0x4ef3('0x8')]('/',auth[_0x4ef3('0x9')](),controller[_0x4ef3('0xa')]);router[_0x4ef3('0x8')](_0x4ef3('0xb'),auth[_0x4ef3('0x9')](),controller[_0x4ef3('0xc')]);router[_0x4ef3('0x8')]('/:id/download',auth[_0x4ef3('0x9')](),controller[_0x4ef3('0xd')]);var upload=multer({'storage':multer[_0x4ef3('0xe')]({'destination':function(_0x4bdc8d,_0x5109b6,_0x550066){_0x550066(null,path[_0x4ef3('0xf')](config[_0x4ef3('0x10')],_0x4ef3('0x11')));},'filename':function(_0xb63f96,_0x586bfd,_0x22f5b6){_0x586bfd[_0x4ef3('0x12')]=_0x586bfd[_0x4ef3('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x22f5b6(null,util[_0x4ef3('0x13')]('%s-%s%s',path[_0x4ef3('0x14')](_0x586bfd[_0x4ef3('0x12')],path[_0x4ef3('0x15')](_0x586bfd[_0x4ef3('0x12')])),Date[_0x4ef3('0x16')](),path[_0x4ef3('0x15')](_0x586bfd['originalname'])));}})});router[_0x4ef3('0x17')]('/',upload[_0x4ef3('0x18')]('file'),controller[_0x4ef3('0x19')]);router['put'](_0x4ef3('0xb'),auth[_0x4ef3('0x9')](),controller[_0x4ef3('0x1a')]);router['delete'](_0x4ef3('0xb'),auth[_0x4ef3('0x9')](),controller[_0x4ef3('0x1b')]);module[_0x4ef3('0x1c')]=router; \ No newline at end of file +var _0x76e2=['format','extname','now','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace'];(function(_0x559348,_0xfb672){var _0x50d030=function(_0x37d8cd){while(--_0x37d8cd){_0x559348['push'](_0x559348['shift']());}};_0x50d030(++_0xfb672);}(_0x76e2,0x66));var _0x276e=function(_0x148661,_0x257a45){_0x148661=_0x148661-0x0;var _0x247538=_0x76e2[_0x148661];return _0x247538;};'use strict';var multer=require(_0x276e('0x0'));var util=require(_0x276e('0x1'));var path=require(_0x276e('0x2'));var timeout=require(_0x276e('0x3'));var express=require(_0x276e('0x4'));var router=express[_0x276e('0x5')]();var fs_extra=require(_0x276e('0x6'));var auth=require(_0x276e('0x7'));var interaction=require(_0x276e('0x8'));var config=require(_0x276e('0x9'));var controller=require('./sound.controller');router[_0x276e('0xa')]('/',auth[_0x276e('0xb')](),controller[_0x276e('0xc')]);router['get'](_0x276e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x276e('0xa')](_0x276e('0xe'),auth['isAuthenticated'](),controller[_0x276e('0xf')]);var upload=multer({'storage':multer[_0x276e('0x10')]({'destination':function(_0x3c91cd,_0x347955,_0x29303d){_0x29303d(null,path[_0x276e('0x11')](config[_0x276e('0x12')],_0x276e('0x13')));},'filename':function(_0x143f49,_0x52501f,_0x2653ef){_0x52501f[_0x276e('0x14')]=_0x52501f[_0x276e('0x14')][_0x276e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2653ef(null,util[_0x276e('0x16')]('%s-%s%s',path['basename'](_0x52501f['originalname'],path[_0x276e('0x17')](_0x52501f[_0x276e('0x14')])),Date[_0x276e('0x18')](),path['extname'](_0x52501f[_0x276e('0x14')])));}})});router['post']('/',upload['single'](_0x276e('0x19')),controller[_0x276e('0x1a')]);router[_0x276e('0x1b')](_0x276e('0xd'),auth[_0x276e('0xb')](),controller[_0x276e('0x1c')]);router[_0x276e('0x1d')](_0x276e('0xd'),auth[_0x276e('0xb')](),controller['delete']);module[_0x276e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3c6d8dd..958fd3a 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 _0x568a=['BIGINT','INTEGER','sequelize','STRING','FLOAT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x568a,0x1c9));var _0xa568=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x568a[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xa568('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xa568('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xa568('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa568('0x2')]},'original_sampleCount':{'type':Sequelize[_0xa568('0x3')]},'original_channelCount':{'type':Sequelize[_0xa568('0x4')]},'original_bitRate':{'type':Sequelize[_0xa568('0x3')]},'original_sampleRate':{'type':Sequelize[_0xa568('0x4')]},'converted_format':{'type':Sequelize[_0xa568('0x1')]},'converted_duration':{'type':Sequelize[_0xa568('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa568('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xa568('0x4')]}}; \ No newline at end of file +var _0x46ba=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x408a5e,_0x715fad){var _0x38ff17=function(_0x9d194){while(--_0x9d194){_0x408a5e['push'](_0x408a5e['shift']());}};_0x38ff17(++_0x715fad);}(_0x46ba,0x12d));var _0xa46b=function(_0x3416ff,_0x2ce5c0){_0x3416ff=_0x3416ff-0x0;var _0x2689ba=_0x46ba[_0x3416ff];return _0x2689ba;};'use strict';var Sequelize=require('sequelize');module[_0xa46b('0x0')]={'name':{'type':Sequelize[_0xa46b('0x1')],'unique':_0xa46b('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa46b('0x1')]},'display_name':{'type':Sequelize[_0xa46b('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xa46b('0x1')]},'original_format':{'type':Sequelize[_0xa46b('0x1')]},'original_duration':{'type':Sequelize[_0xa46b('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa46b('0x4')]},'original_channelCount':{'type':Sequelize[_0xa46b('0x5')]},'original_bitRate':{'type':Sequelize[_0xa46b('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa46b('0x5')]},'converted_format':{'type':Sequelize[_0xa46b('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa46b('0x5')]},'converted_bitRate':{'type':Sequelize[_0xa46b('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa46b('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1ac9992..602fb77 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 _0x5401=['rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','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','Sequelize','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_sampleRate','create','body','userProfileId','role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','destroy','then','Sounds','error','stack','name','send','Sound'];(function(_0x356771,_0x3f33dc){var _0x1aa5bd=function(_0x5eaf5f){while(--_0x5eaf5f){_0x356771['push'](_0x356771['shift']());}};_0x1aa5bd(++_0x3f33dc);}(_0x5401,0x140));var _0x1540=function(_0x81fe53,_0x5b8f05){_0x81fe53=_0x81fe53-0x0;var _0x56f7a7=_0x5401[_0x81fe53];return _0x56f7a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1540('0x0'));var zipdir=require(_0x1540('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1540('0x2'));var BPromise=require(_0x1540('0x3'));var Mustache=require(_0x1540('0x4'));var util=require('util');var path=require(_0x1540('0x5'));var sox=require('sox');var csv=require(_0x1540('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1540('0x7'));var _=require('lodash');var squel=require(_0x1540('0x8'));var crypto=require(_0x1540('0x9'));var jsforce=require(_0x1540('0xa'));var deskjs=require(_0x1540('0xb'));var toCsv=require(_0x1540('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1540('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1540('0xd'));var hardwareService=require(_0x1540('0xe'));var logger=require('../../config/logger')(_0x1540('0xf'));var utils=require(_0x1540('0x10'));var config=require(_0x1540('0x11'));var licenseUtil=require(_0x1540('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff076,_0x17789e){_0x17789e=_0x17789e||0xcc;return function(_0x2ac21e){if(_0x2ac21e){return _0x4ff076[_0x1540('0x13')](_0x17789e);}return _0x4ff076['status'](_0x17789e)[_0x1540('0x14')]();};}function respondWithResult(_0x16b31f,_0x1e41cc){_0x1e41cc=_0x1e41cc||0xc8;return function(_0x4042d1){if(_0x4042d1){return _0x16b31f['status'](_0x1e41cc)[_0x1540('0x15')](_0x4042d1);}};}function respondWithFilteredResult(_0x223c82,_0x4af0ea){return function(_0x170ec8){if(_0x170ec8){var _0xedf322=typeof _0x4af0ea[_0x1540('0x16')]==='undefined'&&typeof _0x4af0ea['limit']===_0x1540('0x17');var _0x3ba0d4=_0x170ec8[_0x1540('0x18')];var _0x200191=_0xedf322?0x0:_0x4af0ea[_0x1540('0x16')];var _0x4baef9=_0xedf322?_0x170ec8['count']:_0x4af0ea[_0x1540('0x16')]+_0x4af0ea[_0x1540('0x19')];var _0x1deb1e;if(_0x4baef9>=_0x3ba0d4){_0x4baef9=_0x3ba0d4;_0x1deb1e=0xc8;}else{_0x1deb1e=0xce;}_0x223c82[_0x1540('0x1a')](_0x1deb1e);return _0x223c82[_0x1540('0x1b')](_0x1540('0x1c'),_0x200191+'-'+_0x4baef9+'/'+_0x3ba0d4)[_0x1540('0x15')](_0x170ec8);}return null;};}function patchUpdates(_0x450449){return function(_0x509dad){try{jsonpatch[_0x1540('0x1d')](_0x509dad,_0x450449,!![]);}catch(_0x5a62c4){return BPromise[_0x1540('0x1e')](_0x5a62c4);}return _0x509dad['save']();};}function saveUpdates(_0x6899ae,_0x55eaaf){return function(_0x11b60d){if(_0x11b60d){return _0x11b60d[_0x1540('0x1f')](_0x6899ae)['then'](function(_0x4fd5ce){return _0x4fd5ce;});}return null;};}function removeEntity(_0x47d02b,_0x1bbac1){return function(_0x7fa1a7){if(_0x7fa1a7){return _0x7fa1a7[_0x1540('0x20')]()[_0x1540('0x21')](function(){var _0x494c8f=_0x7fa1a7['get']({'plain':!![]});var _0x21ca23=_0x1540('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x21ca23,'resourceId':_0x494c8f['id']}})[_0x1540('0x21')](function(){return _0x7fa1a7;});})['then'](function(){_0x47d02b[_0x1540('0x1a')](0xcc)[_0x1540('0x14')]();});}};}function handleEntityNotFound(_0x326cce,_0x1c68ef){return function(_0x4df3c1){if(!_0x4df3c1){_0x326cce[_0x1540('0x13')](0x194);}return _0x4df3c1;};}function handleError(_0x899361,_0x40cca8){_0x40cca8=_0x40cca8||0x1f4;return function(_0x1d9521){logger[_0x1540('0x23')](_0x1d9521[_0x1540('0x24')]);if(_0x1d9521['name']){delete _0x1d9521[_0x1540('0x25')];}_0x899361['status'](_0x40cca8)[_0x1540('0x26')](_0x1d9521);};}exports['index']=function(_0x2f8738,_0x55331f){var _0x125c6d={},_0x4ac96f={},_0xcb89e5={'count':0x0,'rows':[]};var _0x61ef2f=_['map'](db[_0x1540('0x27')][_0x1540('0x28')],function(_0x53c2f2){return{'name':_0x53c2f2[_0x1540('0x29')],'type':_0x53c2f2[_0x1540('0x2a')][_0x1540('0x2b')]};});_0x4ac96f[_0x1540('0x2c')]=_[_0x1540('0x2d')](_0x61ef2f,_0x1540('0x25'));_0x4ac96f['query']=_['keys'](_0x2f8738[_0x1540('0x2e')]);_0x4ac96f[_0x1540('0x2f')]=_[_0x1540('0x30')](_0x4ac96f[_0x1540('0x2c')],_0x4ac96f[_0x1540('0x2e')]);_0x125c6d[_0x1540('0x31')]=_[_0x1540('0x30')](_0x4ac96f[_0x1540('0x2c')],qs[_0x1540('0x32')](_0x2f8738[_0x1540('0x2e')][_0x1540('0x32')]));_0x125c6d[_0x1540('0x31')]=_0x125c6d[_0x1540('0x31')][_0x1540('0x33')]?_0x125c6d['attributes']:_0x4ac96f[_0x1540('0x2c')];if(!_0x2f8738[_0x1540('0x2e')]['hasOwnProperty'](_0x1540('0x34'))){_0x125c6d['limit']=qs['limit'](_0x2f8738['query'][_0x1540('0x19')]);_0x125c6d[_0x1540('0x16')]=qs[_0x1540('0x16')](_0x2f8738[_0x1540('0x2e')]['offset']);}_0x125c6d[_0x1540('0x35')]=qs[_0x1540('0x36')](_0x2f8738['query'][_0x1540('0x36')]);_0x125c6d[_0x1540('0x37')]=qs[_0x1540('0x2f')](_[_0x1540('0x38')](_0x2f8738[_0x1540('0x2e')],_0x4ac96f[_0x1540('0x2f')]),_0x61ef2f);if(_0x2f8738['query'][_0x1540('0x39')]){_0x125c6d[_0x1540('0x37')]=_[_0x1540('0x3a')](_0x125c6d['where'],{'$or':_[_0x1540('0x2d')](_0x61ef2f,function(_0x38de29){if(_0x38de29['type']!=='VIRTUAL'){var _0x271c13={};_0x271c13[_0x38de29[_0x1540('0x25')]]={'$like':'%'+_0x2f8738[_0x1540('0x2e')][_0x1540('0x39')]+'%'};return _0x271c13;}})});}_0x125c6d=_[_0x1540('0x3a')]({},_0x125c6d,_0x2f8738[_0x1540('0x3b')]);var _0x3f9869={'where':_0x125c6d['where']};return db[_0x1540('0x27')][_0x1540('0x18')](_0x3f9869)[_0x1540('0x21')](function(_0x17d115){_0xcb89e5[_0x1540('0x18')]=_0x17d115;if(_0x2f8738[_0x1540('0x2e')][_0x1540('0x3c')]){_0x125c6d['include']=[{'all':!![]}];}return db[_0x1540('0x27')][_0x1540('0x3d')](_0x125c6d);})[_0x1540('0x21')](function(_0x842ded){_0xcb89e5[_0x1540('0x3e')]=_0x842ded;return _0xcb89e5;})[_0x1540('0x21')](respondWithFilteredResult(_0x55331f,_0x125c6d))[_0x1540('0x3f')](handleError(_0x55331f,null));};exports[_0x1540('0x40')]=function(_0x439ef2,_0x434394){var _0x5c7eb4={'raw':!![],'where':{'id':_0x439ef2[_0x1540('0x41')]['id']}},_0x120d0e={};_0x120d0e[_0x1540('0x2c')]=_[_0x1540('0x42')](db[_0x1540('0x27')][_0x1540('0x28')]);_0x120d0e['query']=_[_0x1540('0x42')](_0x439ef2[_0x1540('0x2e')]);_0x120d0e[_0x1540('0x2f')]=_[_0x1540('0x30')](_0x120d0e['model'],_0x120d0e[_0x1540('0x2e')]);_0x5c7eb4[_0x1540('0x31')]=_['intersection'](_0x120d0e[_0x1540('0x2c')],qs[_0x1540('0x32')](_0x439ef2['query']['fields']));_0x5c7eb4[_0x1540('0x31')]=_0x5c7eb4[_0x1540('0x31')]['length']?_0x5c7eb4[_0x1540('0x31')]:_0x120d0e[_0x1540('0x2c')];if(_0x439ef2[_0x1540('0x2e')]['includeAll']){_0x5c7eb4[_0x1540('0x43')]=[{'all':!![]}];}_0x5c7eb4=_[_0x1540('0x3a')]({},_0x5c7eb4,_0x439ef2[_0x1540('0x3b')]);return db['Sound'][_0x1540('0x44')](_0x5c7eb4)[_0x1540('0x21')](handleEntityNotFound(_0x434394,null))[_0x1540('0x21')](respondWithResult(_0x434394,null))[_0x1540('0x3f')](handleError(_0x434394,null));};exports[_0x1540('0x45')]=function(_0x266ba2,_0x95c1f1,_0x1ca634){return db[_0x1540('0x27')]['find']({'where':{'id':_0x266ba2[_0x1540('0x41')]['id']},'attributes':[_0x1540('0x25'),_0x1540('0x46'),_0x1540('0x47')],'raw':!![]})[_0x1540('0x21')](handleEntityNotFound(_0x95c1f1,null))[_0x1540('0x21')](function(_0x3762ee){if(_0x3762ee){if(!fs[_0x1540('0x48')](path[_0x1540('0x49')](config[_0x1540('0x4a')],_0x1540('0x4b'),_0x3762ee[_0x1540('0x46')]+'.'+_0x3762ee[_0x1540('0x47')]))){throw new db[(_0x1540('0x4c'))]['ValidationError'](_0x1540('0x4d'));}return _0x95c1f1['download'](path[_0x1540('0x49')](config[_0x1540('0x4a')],_0x1540('0x4b'),util[_0x1540('0x4e')]('%s.%s',_0x3762ee[_0x1540('0x46')],_0x3762ee[_0x1540('0x47')])),util[_0x1540('0x4e')](_0x1540('0x4f'),_0x3762ee[_0x1540('0x25')],_0x3762ee[_0x1540('0x47')]));}return null;})[_0x1540('0x3f')](handleError(_0x95c1f1,null));};exports['create']=function(_0x34c988,_0x1017b1,_0x5b4bfd){var _0x4a16da={'name':path[_0x1540('0x50')](_0x34c988[_0x1540('0x51')][_0x1540('0x52')],path[_0x1540('0x53')](_0x34c988['file'][_0x1540('0x52')])),'save_name':path[_0x1540('0x50')](_0x34c988[_0x1540('0x51')]['filename'],path['extname'](_0x34c988[_0x1540('0x51')][_0x1540('0x54')])),'original_format':path[_0x1540('0x53')](_0x34c988[_0x1540('0x51')][_0x1540('0x52')])[_0x1540('0x55')](0x1),'converted_format':_0x1540('0x56')};var _0x326d02=path[_0x1540('0x49')](config['root'],_0x1540('0x57'),_0x34c988[_0x1540('0x51')]['filename']);var _0x24504d=path['join'](config[_0x1540('0x4a')],'server/files/sounds/converted',util[_0x1540('0x4e')](_0x1540('0x4f'),path[_0x1540('0x50')](_0x34c988['file'][_0x1540('0x54')],path[_0x1540('0x53')](_0x34c988[_0x1540('0x51')][_0x1540('0x54')])),_0x4a16da['converted_format']));logger['info'](_0x1540('0x58'),_0x326d02);logger[_0x1540('0x59')](_0x1540('0x5a'),_0x24504d);try{fs[_0x1540('0x5b')](_0x326d02,parseInt(_0x1540('0x5c'),0x8));var _0x25101f=sox[_0x1540('0x5d')](_0x326d02,_0x24504d,{'sampleRate':0x1f40,'format':_0x1540('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x25101f['on']('error',function(_0x30532f){fs[_0x1540('0x5e')](_0x326d02);_0x1017b1['status'](0x1f4)['send'](_0x30532f);});_0x25101f['on'](_0x1540('0x5f'),function(_0x4fa4b1){_0x4a16da['original_duration']=isNaN(_0x4fa4b1['duration'])?null:_0x4fa4b1[_0x1540('0x60')]*0x3e8;_0x4a16da['original_sampleCount']=isNaN(_0x4fa4b1['sampleCount'])?null:_0x4fa4b1[_0x1540('0x61')];_0x4a16da[_0x1540('0x62')]=isNaN(_0x4fa4b1[_0x1540('0x63')])?null:_0x4fa4b1[_0x1540('0x63')];_0x4a16da[_0x1540('0x64')]=isNaN(_0x4fa4b1[_0x1540('0x65')])?null:_0x4fa4b1[_0x1540('0x65')];_0x4a16da[_0x1540('0x66')]=isNaN(_0x4fa4b1[_0x1540('0x67')])?null:_0x4fa4b1[_0x1540('0x67')];});_0x25101f['on'](_0x1540('0x68'),function(_0x3a9b45){_0x4a16da[_0x1540('0x69')]=isNaN(_0x3a9b45['duration'])?null:_0x3a9b45[_0x1540('0x60')]*0x3e8;_0x4a16da[_0x1540('0x6a')]=isNaN(_0x3a9b45[_0x1540('0x61')])?null:_0x3a9b45['sampleCount'];_0x4a16da['converted_channelCount']=isNaN(_0x3a9b45[_0x1540('0x63')])?null:_0x3a9b45[_0x1540('0x63')];_0x4a16da['converted_bitRate']=isNaN(_0x3a9b45[_0x1540('0x65')])?null:_0x3a9b45[_0x1540('0x65')];_0x4a16da[_0x1540('0x6b')]=isNaN(_0x3a9b45[_0x1540('0x67')])?null:_0x3a9b45[_0x1540('0x67')];});_0x25101f['on']('end',function(){fs[_0x1540('0x5b')](_0x24504d,parseInt(_0x1540('0x5c'),0x8));return db[_0x1540('0x27')][_0x1540('0x6c')](_0x4a16da)[_0x1540('0x21')](function(_0x368c50){var _0x4755e1={'role':_0x34c988[_0x1540('0x6d')]['role'],'userProfileId':_0x34c988[_0x1540('0x6d')][_0x1540('0x6e')]};if(!_0x4755e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4755e1[_0x1540('0x6f')]===_0x1540('0x70')){var _0xf1f68f=_0x368c50[_0x1540('0x71')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x1540('0x22'),'userProfileId':_0x4755e1[_0x1540('0x6e')]},'raw':!![]})[_0x1540('0x21')](function(_0x3e333d){if(_0x3e333d&&_0x3e333d[_0x1540('0x72')]===0x0){return db['UserProfileResource'][_0x1540('0x6c')]({'name':_0xf1f68f[_0x1540('0x25')],'resourceId':_0xf1f68f['id'],'type':_0x3e333d['name'],'sectionId':_0x3e333d['id']},{})[_0x1540('0x21')](function(){return _0x368c50;});}else{return _0x368c50;}})['catch'](function(_0x384f02){logger['error'](_0x1540('0x73'),_0x384f02);throw _0x384f02;});}return _0x368c50;})[_0x1540('0x21')](respondWithResult(_0x1017b1,null))['catch'](handleError(_0x1017b1,null));});_0x25101f[_0x1540('0x74')]();}catch(_0x73aaef){_0x1017b1['status'](0x1f4)[_0x1540('0x26')](_0x73aaef);}};exports[_0x1540('0x1f')]=function(_0x21732c,_0x2b891a,_0x5bebc5){return db['Sound'][_0x1540('0x44')]({'where':{'id':_0x21732c[_0x1540('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b891a,null))[_0x1540('0x21')](saveUpdates(_[_0x1540('0x38')](_0x21732c[_0x1540('0x6d')],[_0x1540('0x25'),_0x1540('0x75')]),null))[_0x1540('0x21')](respondWithResult(_0x2b891a,null))[_0x1540('0x3f')](handleError(_0x2b891a,null));};exports[_0x1540('0x76')]=function(_0x264cd8,_0xc102f2,_0x349d28){return db[_0x1540('0x27')][_0x1540('0x44')]({'where':{'id':_0x264cd8[_0x1540('0x41')]['id']}})[_0x1540('0x21')](function(_0xf06de8){if(_0xf06de8){return _0xf06de8['destroy']();}})[_0x1540('0x21')](function(_0x62927c){var _0x1776da=path[_0x1540('0x49')](config[_0x1540('0x4a')],_0x1540('0x57'),util[_0x1540('0x4e')](_0x1540('0x4f'),_0x62927c[_0x1540('0x46')],_0x62927c[_0x1540('0x77')]));var _0xf1d426=path['join'](config[_0x1540('0x4a')],_0x1540('0x4b'),util[_0x1540('0x4e')](_0x1540('0x4f'),_0x62927c['save_name'],_0x62927c['converted_format']));fs['unlinkSync'](_0x1776da);fs[_0x1540('0x5e')](_0xf1d426);return _0x62927c;})[_0x1540('0x21')](function(_0x208344){if(_0x208344){return _0xc102f2[_0x1540('0x1a')](0xcc)[_0x1540('0x14')]();}})[_0x1540('0x21')](handleEntityNotFound(_0xc102f2,null))[_0x1540('0x3f')](handleError(_0xc102f2,null));}; \ No newline at end of file +var _0xbf31=['map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','params','rawAttributes','options','find','catch','download','save_name','converted_format','existsSync','root','ValidationError','Sound\x20not\x20found','join','server/files/sounds/converted','format','%s.%s','file','originalname','extname','basename','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','user','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','destroy','Sounds','then','error','stack','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbf31,0x1c7));var _0x1bf3=function(_0x4d9c38,_0x3aca87){_0x4d9c38=_0x4d9c38-0x0;var _0x5b2978=_0xbf31[_0x4d9c38];return _0x5b2978;};'use strict';var emlformat=require(_0x1bf3('0x0'));var rimraf=require(_0x1bf3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bf3('0x2'));var rp=require(_0x1bf3('0x3'));var moment=require('moment');var BPromise=require(_0x1bf3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1bf3('0x5'));var sox=require(_0x1bf3('0x6'));var csv=require(_0x1bf3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bf3('0x8'));var _=require('lodash');var squel=require(_0x1bf3('0x9'));var crypto=require(_0x1bf3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1bf3('0xb'));var toCsv=require(_0x1bf3('0x7'));var querystring=require(_0x1bf3('0xc'));var Papa=require(_0x1bf3('0xd'));var Redis=require(_0x1bf3('0xe'));var authService=require(_0x1bf3('0xf'));var qs=require(_0x1bf3('0x10'));var as=require(_0x1bf3('0x11'));var hardwareService=require(_0x1bf3('0x12'));var logger=require(_0x1bf3('0x13'))('api');var utils=require(_0x1bf3('0x14'));var config=require(_0x1bf3('0x15'));var licenseUtil=require(_0x1bf3('0x16'));var db=require(_0x1bf3('0x17'))['db'];function respondWithStatusCode(_0x1eeecf,_0x37916a){_0x37916a=_0x37916a||0xcc;return function(_0x1e4f98){if(_0x1e4f98){return _0x1eeecf[_0x1bf3('0x18')](_0x37916a);}return _0x1eeecf[_0x1bf3('0x19')](_0x37916a)[_0x1bf3('0x1a')]();};}function respondWithResult(_0x5bb2f5,_0x3f87fd){_0x3f87fd=_0x3f87fd||0xc8;return function(_0x297aa7){if(_0x297aa7){return _0x5bb2f5[_0x1bf3('0x19')](_0x3f87fd)[_0x1bf3('0x1b')](_0x297aa7);}};}function respondWithFilteredResult(_0x4786f8,_0x3d6484){return function(_0x3a14bd){if(_0x3a14bd){var _0x422363=typeof _0x3d6484[_0x1bf3('0x1c')]===_0x1bf3('0x1d')&&typeof _0x3d6484['limit']===_0x1bf3('0x1d');var _0x521a42=_0x3a14bd[_0x1bf3('0x1e')];var _0x27b89a=_0x422363?0x0:_0x3d6484[_0x1bf3('0x1c')];var _0x388b1e=_0x422363?_0x3a14bd[_0x1bf3('0x1e')]:_0x3d6484[_0x1bf3('0x1c')]+_0x3d6484[_0x1bf3('0x1f')];var _0x459fe2;if(_0x388b1e>=_0x521a42){_0x388b1e=_0x521a42;_0x459fe2=0xc8;}else{_0x459fe2=0xce;}_0x4786f8[_0x1bf3('0x19')](_0x459fe2);return _0x4786f8['set'](_0x1bf3('0x20'),_0x27b89a+'-'+_0x388b1e+'/'+_0x521a42)[_0x1bf3('0x1b')](_0x3a14bd);}return null;};}function patchUpdates(_0x3a3294){return function(_0x161f9a){try{jsonpatch[_0x1bf3('0x21')](_0x161f9a,_0x3a3294,!![]);}catch(_0x3d0cf4){return BPromise['reject'](_0x3d0cf4);}return _0x161f9a['save']();};}function saveUpdates(_0xfc874d,_0x17bb50){return function(_0x445865){if(_0x445865){return _0x445865[_0x1bf3('0x22')](_0xfc874d)['then'](function(_0x27f322){return _0x27f322;});}return null;};}function removeEntity(_0x569b2c,_0x386725){return function(_0x14081e){if(_0x14081e){return _0x14081e[_0x1bf3('0x23')]()['then'](function(){var _0x3c4b2e=_0x14081e['get']({'plain':!![]});var _0x5ea381=_0x1bf3('0x24');return db['UserProfileResource'][_0x1bf3('0x23')]({'where':{'type':_0x5ea381,'resourceId':_0x3c4b2e['id']}})['then'](function(){return _0x14081e;});})[_0x1bf3('0x25')](function(){_0x569b2c[_0x1bf3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7a95,_0x1da8f0){return function(_0x50f336){if(!_0x50f336){_0x2b7a95[_0x1bf3('0x18')](0x194);}return _0x50f336;};}function handleError(_0x4f4000,_0x383da7){_0x383da7=_0x383da7||0x1f4;return function(_0x2305af){logger[_0x1bf3('0x26')](_0x2305af[_0x1bf3('0x27')]);if(_0x2305af['name']){delete _0x2305af[_0x1bf3('0x28')];}_0x4f4000['status'](_0x383da7)['send'](_0x2305af);};}exports['index']=function(_0x5adeae,_0x3f9a6e){var _0x59bef9={},_0x221689={},_0xdbc528={'count':0x0,'rows':[]};var _0x2d4a92=_[_0x1bf3('0x29')](db[_0x1bf3('0x2a')]['rawAttributes'],function(_0x55a4e1){return{'name':_0x55a4e1[_0x1bf3('0x2b')],'type':_0x55a4e1[_0x1bf3('0x2c')][_0x1bf3('0x2d')]};});_0x221689[_0x1bf3('0x2e')]=_[_0x1bf3('0x29')](_0x2d4a92,'name');_0x221689[_0x1bf3('0x2f')]=_[_0x1bf3('0x30')](_0x5adeae[_0x1bf3('0x2f')]);_0x221689[_0x1bf3('0x31')]=_[_0x1bf3('0x32')](_0x221689['model'],_0x221689[_0x1bf3('0x2f')]);_0x59bef9[_0x1bf3('0x33')]=_[_0x1bf3('0x32')](_0x221689[_0x1bf3('0x2e')],qs[_0x1bf3('0x34')](_0x5adeae[_0x1bf3('0x2f')][_0x1bf3('0x34')]));_0x59bef9['attributes']=_0x59bef9[_0x1bf3('0x33')]['length']?_0x59bef9['attributes']:_0x221689[_0x1bf3('0x2e')];if(!_0x5adeae[_0x1bf3('0x2f')][_0x1bf3('0x35')](_0x1bf3('0x36'))){_0x59bef9[_0x1bf3('0x1f')]=qs[_0x1bf3('0x1f')](_0x5adeae[_0x1bf3('0x2f')][_0x1bf3('0x1f')]);_0x59bef9[_0x1bf3('0x1c')]=qs['offset'](_0x5adeae[_0x1bf3('0x2f')][_0x1bf3('0x1c')]);}_0x59bef9[_0x1bf3('0x37')]=qs['sort'](_0x5adeae[_0x1bf3('0x2f')][_0x1bf3('0x38')]);_0x59bef9[_0x1bf3('0x39')]=qs[_0x1bf3('0x31')](_[_0x1bf3('0x3a')](_0x5adeae['query'],_0x221689[_0x1bf3('0x31')]),_0x2d4a92);if(_0x5adeae['query']['filter']){_0x59bef9[_0x1bf3('0x39')]=_[_0x1bf3('0x3b')](_0x59bef9['where'],{'$or':_['map'](_0x2d4a92,function(_0xd2ec4d){if(_0xd2ec4d['type']!==_0x1bf3('0x3c')){var _0x3032cc={};_0x3032cc[_0xd2ec4d[_0x1bf3('0x28')]]={'$like':'%'+_0x5adeae[_0x1bf3('0x2f')][_0x1bf3('0x3d')]+'%'};return _0x3032cc;}})});}_0x59bef9=_['merge']({},_0x59bef9,_0x5adeae['options']);var _0x5922aa={'where':_0x59bef9[_0x1bf3('0x39')]};return db[_0x1bf3('0x2a')]['count'](_0x5922aa)['then'](function(_0x204d20){_0xdbc528[_0x1bf3('0x1e')]=_0x204d20;if(_0x5adeae[_0x1bf3('0x2f')][_0x1bf3('0x3e')]){_0x59bef9[_0x1bf3('0x3f')]=[{'all':!![]}];}return db[_0x1bf3('0x2a')]['findAll'](_0x59bef9);})[_0x1bf3('0x25')](function(_0x2f236e){_0xdbc528[_0x1bf3('0x40')]=_0x2f236e;return _0xdbc528;})[_0x1bf3('0x25')](respondWithFilteredResult(_0x3f9a6e,_0x59bef9))['catch'](handleError(_0x3f9a6e,null));};exports['show']=function(_0x9e7afe,_0x15c9c7){var _0x35b835={'raw':!![],'where':{'id':_0x9e7afe[_0x1bf3('0x41')]['id']}},_0x5276db={};_0x5276db[_0x1bf3('0x2e')]=_[_0x1bf3('0x30')](db[_0x1bf3('0x2a')][_0x1bf3('0x42')]);_0x5276db[_0x1bf3('0x2f')]=_['keys'](_0x9e7afe[_0x1bf3('0x2f')]);_0x5276db[_0x1bf3('0x31')]=_[_0x1bf3('0x32')](_0x5276db['model'],_0x5276db['query']);_0x35b835[_0x1bf3('0x33')]=_[_0x1bf3('0x32')](_0x5276db[_0x1bf3('0x2e')],qs[_0x1bf3('0x34')](_0x9e7afe['query'][_0x1bf3('0x34')]));_0x35b835[_0x1bf3('0x33')]=_0x35b835['attributes']['length']?_0x35b835[_0x1bf3('0x33')]:_0x5276db[_0x1bf3('0x2e')];if(_0x9e7afe['query']['includeAll']){_0x35b835[_0x1bf3('0x3f')]=[{'all':!![]}];}_0x35b835=_['merge']({},_0x35b835,_0x9e7afe[_0x1bf3('0x43')]);return db[_0x1bf3('0x2a')][_0x1bf3('0x44')](_0x35b835)[_0x1bf3('0x25')](handleEntityNotFound(_0x15c9c7,null))[_0x1bf3('0x25')](respondWithResult(_0x15c9c7,null))[_0x1bf3('0x45')](handleError(_0x15c9c7,null));};exports[_0x1bf3('0x46')]=function(_0x499255,_0x14ded8,_0x43756e){return db['Sound'][_0x1bf3('0x44')]({'where':{'id':_0x499255[_0x1bf3('0x41')]['id']},'attributes':['name',_0x1bf3('0x47'),_0x1bf3('0x48')],'raw':!![]})[_0x1bf3('0x25')](handleEntityNotFound(_0x14ded8,null))[_0x1bf3('0x25')](function(_0x24feff){if(_0x24feff){if(!fs[_0x1bf3('0x49')](path['join'](config[_0x1bf3('0x4a')],'server/files/sounds/converted',_0x24feff[_0x1bf3('0x47')]+'.'+_0x24feff['converted_format']))){throw new db['Sequelize'][(_0x1bf3('0x4b'))](_0x1bf3('0x4c'));}return _0x14ded8[_0x1bf3('0x46')](path[_0x1bf3('0x4d')](config[_0x1bf3('0x4a')],_0x1bf3('0x4e'),util[_0x1bf3('0x4f')](_0x1bf3('0x50'),_0x24feff[_0x1bf3('0x47')],_0x24feff[_0x1bf3('0x48')])),util[_0x1bf3('0x4f')](_0x1bf3('0x50'),_0x24feff[_0x1bf3('0x28')],_0x24feff[_0x1bf3('0x48')]));}return null;})[_0x1bf3('0x45')](handleError(_0x14ded8,null));};exports['create']=function(_0x569704,_0x3d8017,_0x472601){var _0x13aea8={'name':path['basename'](_0x569704[_0x1bf3('0x51')][_0x1bf3('0x52')],path[_0x1bf3('0x53')](_0x569704[_0x1bf3('0x51')]['originalname'])),'save_name':path[_0x1bf3('0x54')](_0x569704[_0x1bf3('0x51')]['filename'],path[_0x1bf3('0x53')](_0x569704[_0x1bf3('0x51')][_0x1bf3('0x55')])),'original_format':path[_0x1bf3('0x53')](_0x569704[_0x1bf3('0x51')][_0x1bf3('0x52')])['substring'](0x1),'converted_format':_0x1bf3('0x56')};var _0x194696=path['join'](config['root'],_0x1bf3('0x57'),_0x569704[_0x1bf3('0x51')][_0x1bf3('0x55')]);var _0x3fc426=path[_0x1bf3('0x4d')](config[_0x1bf3('0x4a')],'server/files/sounds/converted',util[_0x1bf3('0x4f')](_0x1bf3('0x50'),path[_0x1bf3('0x54')](_0x569704[_0x1bf3('0x51')]['filename'],path[_0x1bf3('0x53')](_0x569704[_0x1bf3('0x51')][_0x1bf3('0x55')])),_0x13aea8[_0x1bf3('0x48')]));logger[_0x1bf3('0x58')](_0x1bf3('0x59'),_0x194696);logger['info'](_0x1bf3('0x5a'),_0x3fc426);try{fs[_0x1bf3('0x5b')](_0x194696,parseInt(_0x1bf3('0x5c'),0x8));var _0xc5886a=sox[_0x1bf3('0x5d')](_0x194696,_0x3fc426,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xc5886a['on']('error',function(_0x113500){fs[_0x1bf3('0x5e')](_0x194696);_0x3d8017[_0x1bf3('0x19')](0x1f4)['send'](_0x113500);});_0xc5886a['on'](_0x1bf3('0x5f'),function(_0x2e2722){_0x13aea8['original_duration']=isNaN(_0x2e2722[_0x1bf3('0x60')])?null:_0x2e2722['duration']*0x3e8;_0x13aea8['original_sampleCount']=isNaN(_0x2e2722[_0x1bf3('0x61')])?null:_0x2e2722[_0x1bf3('0x61')];_0x13aea8[_0x1bf3('0x62')]=isNaN(_0x2e2722[_0x1bf3('0x63')])?null:_0x2e2722['channelCount'];_0x13aea8[_0x1bf3('0x64')]=isNaN(_0x2e2722[_0x1bf3('0x65')])?null:_0x2e2722[_0x1bf3('0x65')];_0x13aea8[_0x1bf3('0x66')]=isNaN(_0x2e2722[_0x1bf3('0x67')])?null:_0x2e2722['sampleRate'];});_0xc5886a['on'](_0x1bf3('0x68'),function(_0x729fa0){_0x13aea8[_0x1bf3('0x69')]=isNaN(_0x729fa0['duration'])?null:_0x729fa0[_0x1bf3('0x60')]*0x3e8;_0x13aea8[_0x1bf3('0x6a')]=isNaN(_0x729fa0[_0x1bf3('0x61')])?null:_0x729fa0[_0x1bf3('0x61')];_0x13aea8[_0x1bf3('0x6b')]=isNaN(_0x729fa0['channelCount'])?null:_0x729fa0[_0x1bf3('0x63')];_0x13aea8[_0x1bf3('0x6c')]=isNaN(_0x729fa0[_0x1bf3('0x65')])?null:_0x729fa0[_0x1bf3('0x65')];_0x13aea8[_0x1bf3('0x6d')]=isNaN(_0x729fa0['sampleRate'])?null:_0x729fa0[_0x1bf3('0x67')];});_0xc5886a['on'](_0x1bf3('0x1a'),function(){fs['chmodSync'](_0x3fc426,parseInt(_0x1bf3('0x5c'),0x8));return db['Sound'][_0x1bf3('0x6e')](_0x13aea8)[_0x1bf3('0x25')](function(_0x3a5c84){var _0x250d74={'role':_0x569704[_0x1bf3('0x6f')][_0x1bf3('0x70')],'userProfileId':_0x569704['body'][_0x1bf3('0x71')]};if(!_0x250d74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x250d74['role']===_0x1bf3('0x72')){var _0x143eea=_0x3a5c84[_0x1bf3('0x73')]({'plain':!![]});return db[_0x1bf3('0x74')][_0x1bf3('0x44')]({'where':{'name':_0x1bf3('0x24'),'userProfileId':_0x250d74[_0x1bf3('0x71')]},'raw':!![]})[_0x1bf3('0x25')](function(_0x4602f4){if(_0x4602f4&&_0x4602f4['autoAssociation']===0x0){return db[_0x1bf3('0x75')]['create']({'name':_0x143eea[_0x1bf3('0x28')],'resourceId':_0x143eea['id'],'type':_0x4602f4[_0x1bf3('0x28')],'sectionId':_0x4602f4['id']},{})[_0x1bf3('0x25')](function(){return _0x3a5c84;});}else{return _0x3a5c84;}})['catch'](function(_0x3e5da4){logger[_0x1bf3('0x26')](_0x1bf3('0x76'),_0x3e5da4);throw _0x3e5da4;});}return _0x3a5c84;})[_0x1bf3('0x25')](respondWithResult(_0x3d8017,null))[_0x1bf3('0x45')](handleError(_0x3d8017,null));});_0xc5886a[_0x1bf3('0x77')]();}catch(_0x5cc56c){_0x3d8017[_0x1bf3('0x19')](0x1f4)[_0x1bf3('0x78')](_0x5cc56c);}};exports['update']=function(_0x7ecc5f,_0x1c2413,_0x2e0966){return db['Sound'][_0x1bf3('0x44')]({'where':{'id':_0x7ecc5f[_0x1bf3('0x41')]['id']}})[_0x1bf3('0x25')](handleEntityNotFound(_0x1c2413,null))['then'](saveUpdates(_['pick'](_0x7ecc5f[_0x1bf3('0x6f')],[_0x1bf3('0x28'),_0x1bf3('0x79')]),null))[_0x1bf3('0x25')](respondWithResult(_0x1c2413,null))[_0x1bf3('0x45')](handleError(_0x1c2413,null));};exports[_0x1bf3('0x7a')]=function(_0x48e8b5,_0x2de094,_0x565296){return db[_0x1bf3('0x2a')][_0x1bf3('0x44')]({'where':{'id':_0x48e8b5[_0x1bf3('0x41')]['id']}})[_0x1bf3('0x25')](function(_0x1cf5b7){if(_0x1cf5b7){return _0x1cf5b7[_0x1bf3('0x23')]();}})[_0x1bf3('0x25')](function(_0x5811d5){var _0x34d1e5=path[_0x1bf3('0x4d')](config[_0x1bf3('0x4a')],'server/files/sounds/original',util[_0x1bf3('0x4f')]('%s.%s',_0x5811d5['save_name'],_0x5811d5[_0x1bf3('0x7b')]));var _0x588659=path[_0x1bf3('0x4d')](config[_0x1bf3('0x4a')],_0x1bf3('0x4e'),util['format']('%s.%s',_0x5811d5[_0x1bf3('0x47')],_0x5811d5[_0x1bf3('0x48')]));fs[_0x1bf3('0x5e')](_0x34d1e5);fs[_0x1bf3('0x5e')](_0x588659);return _0x5811d5;})['then'](function(_0xf9f692){if(_0xf9f692){return _0x2de094[_0x1bf3('0x19')](0xcc)[_0x1bf3('0x1a')]();}})[_0x1bf3('0x25')](handleEntityNotFound(_0x2de094,null))['catch'](handleError(_0x2de094,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7b84863..f06a950 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 _0x50f1=['util','../../config/logger','moment','request-promise','path','./sound.attributes','exports','Sound','tools_sounds'];(function(_0x30c187,_0x1a4d55){var _0x4ba7bc=function(_0x2c1801){while(--_0x2c1801){_0x30c187['push'](_0x30c187['shift']());}};_0x4ba7bc(++_0x1a4d55);}(_0x50f1,0x99));var _0x150f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x50f1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x150f('0x0'));var logger=require(_0x150f('0x1'))('api');var moment=require(_0x150f('0x2'));var BPromise=require('bluebird');var rp=require(_0x150f('0x3'));var fs=require('fs');var path=require(_0x150f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x150f('0x5'));module[_0x150f('0x6')]=function(_0x276cd6,_0x39dc1b){return _0x276cd6['define'](_0x150f('0x7'),attributes,{'tableName':_0x150f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bcd=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','api','bluebird','request-promise','path'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x3bcd,0x192));var _0xd3bc=function(_0x287234,_0x4b9e28){_0x287234=_0x287234-0x0;var _0x4bfc27=_0x3bcd[_0x287234];return _0x4bfc27;};'use strict';var _=require(_0xd3bc('0x0'));var util=require(_0xd3bc('0x1'));var logger=require('../../config/logger')(_0xd3bc('0x2'));var moment=require('moment');var BPromise=require(_0xd3bc('0x3'));var rp=require(_0xd3bc('0x4'));var fs=require('fs');var path=require(_0xd3bc('0x5'));var rimraf=require('rimraf');var config=require(_0xd3bc('0x6'));var attributes=require(_0xd3bc('0x7'));module[_0xd3bc('0x8')]=function(_0x19c1b7,_0x4e0e0b){return _0x19c1b7[_0xd3bc('0x9')](_0xd3bc('0xa'),attributes,{'tableName':_0xd3bc('0xb'),'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 5e0d536..990a8e4 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 _0xd3a2=['Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','ShowSound','find','options','raw','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x501b4b,_0x4c6b11){var _0x91e1f3=function(_0x111dce){while(--_0x111dce){_0x501b4b['push'](_0x501b4b['shift']());}};_0x91e1f3(++_0x4c6b11);}(_0xd3a2,0x166));var _0x2d3a=function(_0x5b9d91,_0x4e9e87){_0x5b9d91=_0x5b9d91-0x0;var _0x469037=_0xd3a2[_0x5b9d91];return _0x469037;};'use strict';var _=require(_0x2d3a('0x0'));var util=require(_0x2d3a('0x1'));var moment=require(_0x2d3a('0x2'));var BPromise=require(_0x2d3a('0x3'));var rs=require(_0x2d3a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d3a('0x5'))['db'];var utils=require(_0x2d3a('0x6'));var logger=require(_0x2d3a('0x7'))(_0x2d3a('0x8'));var config=require('../../config/environment');var jayson=require(_0x2d3a('0x9'));var client=jayson[_0x2d3a('0xa')][_0x2d3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x164bc9,_0x3d7fd9,_0x37ed3e){return new BPromise(function(_0x4566a2,_0x31e81d){return client[_0x2d3a('0xc')](_0x164bc9,_0x37ed3e)[_0x2d3a('0xd')](function(_0x126e6e){logger['info'](_0x2d3a('0xe'),_0x3d7fd9,'request\x20sent');logger[_0x2d3a('0xf')](_0x2d3a('0x10'),_0x3d7fd9,_0x2d3a('0x11'),JSON['stringify'](_0x126e6e));if(_0x126e6e[_0x2d3a('0x12')]){if(_0x126e6e['error'][_0x2d3a('0x13')]===0x1f4){logger[_0x2d3a('0x12')](_0x2d3a('0xe'),_0x3d7fd9,_0x126e6e[_0x2d3a('0x12')][_0x2d3a('0x14')]);return _0x31e81d(_0x126e6e[_0x2d3a('0x12')][_0x2d3a('0x14')]);}logger[_0x2d3a('0x12')](_0x2d3a('0xe'),_0x3d7fd9,_0x126e6e[_0x2d3a('0x12')][_0x2d3a('0x14')]);return _0x4566a2(_0x126e6e['error'][_0x2d3a('0x14')]);}else{logger[_0x2d3a('0x15')](_0x2d3a('0xe'),_0x3d7fd9,_0x2d3a('0x11'));_0x4566a2(_0x126e6e['result'][_0x2d3a('0x14')]);}})[_0x2d3a('0x16')](function(_0x656b3c){logger['error'](_0x2d3a('0xe'),_0x3d7fd9,_0x656b3c);_0x31e81d(_0x656b3c);});});}exports[_0x2d3a('0x17')]=function(_0x4690d6){var _0x567d86=this;return new Promise(function(_0x5c0760,_0x2d4f60){return db['Sound'][_0x2d3a('0x18')]({'raw':_0x4690d6[_0x2d3a('0x19')]?_0x4690d6['options'][_0x2d3a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4690d6['options']?_0x4690d6[_0x2d3a('0x19')]['where']||null:null,'attributes':_0x4690d6[_0x2d3a('0x19')]?_0x4690d6['options']['attributes']||null:null,'include':_0x4690d6[_0x2d3a('0x19')]?_0x4690d6[_0x2d3a('0x19')][_0x2d3a('0x1b')]?_[_0x2d3a('0x1c')](_0x4690d6[_0x2d3a('0x19')][_0x2d3a('0x1b')],function(_0x1e38f3){return{'model':db[_0x1e38f3[_0x2d3a('0x1d')]],'as':_0x1e38f3['as'],'attributes':_0x1e38f3[_0x2d3a('0x1e')],'include':_0x1e38f3[_0x2d3a('0x1b')]?_[_0x2d3a('0x1c')](_0x1e38f3[_0x2d3a('0x1b')],function(_0x2776ea){return{'model':db[_0x2776ea[_0x2d3a('0x1d')]],'as':_0x2776ea['as'],'attributes':_0x2776ea[_0x2d3a('0x1e')],'include':_0x2776ea[_0x2d3a('0x1b')]?_['map'](_0x2776ea[_0x2d3a('0x1b')],function(_0x1f7f36){return{'model':db[_0x1f7f36[_0x2d3a('0x1d')]],'as':_0x1f7f36['as'],'attributes':_0x1f7f36[_0x2d3a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2d3a('0xd')](function(_0x2bba8e){logger[_0x2d3a('0x15')](_0x2d3a('0x17'),_0x4690d6);logger[_0x2d3a('0xf')](_0x2d3a('0x17'),_0x4690d6,JSON['stringify'](_0x2bba8e));_0x5c0760(_0x2bba8e);})[_0x2d3a('0x16')](function(_0x4b55f2){logger['error'](_0x2d3a('0x17'),_0x4b55f2[_0x2d3a('0x14')],_0x4690d6);_0x2d4f60(_0x567d86[_0x2d3a('0x12')](0x1f4,_0x4b55f2['message']));});});}; \ No newline at end of file +var _0x300d=['debug','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','ShowSound','Sound','options','raw','attributes','include','map','model'];(function(_0x2dce24,_0x56c113){var _0x45f466=function(_0x146bb6){while(--_0x146bb6){_0x2dce24['push'](_0x2dce24['shift']());}};_0x45f466(++_0x56c113);}(_0x300d,0x65));var _0xd300=function(_0x260395,_0x292523){_0x260395=_0x260395-0x0;var _0x5723b8=_0x300d[_0x260395];return _0x5723b8;};'use strict';var _=require(_0xd300('0x0'));var util=require(_0xd300('0x1'));var moment=require(_0xd300('0x2'));var BPromise=require(_0xd300('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd300('0x4'))['db'];var utils=require(_0xd300('0x5'));var logger=require(_0xd300('0x6'))(_0xd300('0x7'));var config=require(_0xd300('0x8'));var jayson=require(_0xd300('0x9'));var client=jayson[_0xd300('0xa')][_0xd300('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cf8fd,_0xef59e0,_0x19a4da){return new BPromise(function(_0x4f69c,_0x5da170){return client[_0xd300('0xc')](_0x5cf8fd,_0x19a4da)[_0xd300('0xd')](function(_0x21124d){logger[_0xd300('0xe')](_0xd300('0xf'),_0xef59e0,'request\x20sent');logger['debug'](_0xd300('0x10'),_0xef59e0,'request\x20sent',JSON[_0xd300('0x11')](_0x21124d));if(_0x21124d[_0xd300('0x12')]){if(_0x21124d[_0xd300('0x12')][_0xd300('0x13')]===0x1f4){logger[_0xd300('0x12')](_0xd300('0xf'),_0xef59e0,_0x21124d[_0xd300('0x12')][_0xd300('0x14')]);return _0x5da170(_0x21124d['error'][_0xd300('0x14')]);}logger['error'](_0xd300('0xf'),_0xef59e0,_0x21124d[_0xd300('0x12')]['message']);return _0x4f69c(_0x21124d[_0xd300('0x12')][_0xd300('0x14')]);}else{logger[_0xd300('0xe')]('Sound,\x20%s,\x20%s',_0xef59e0,_0xd300('0x15'));_0x4f69c(_0x21124d[_0xd300('0x16')][_0xd300('0x14')]);}})['catch'](function(_0xdc70b){logger[_0xd300('0x12')](_0xd300('0xf'),_0xef59e0,_0xdc70b);_0x5da170(_0xdc70b);});});}exports[_0xd300('0x17')]=function(_0x1230af){var _0x120f37=this;return new Promise(function(_0x4afc64,_0x504bc2){return db[_0xd300('0x18')]['find']({'raw':_0x1230af[_0xd300('0x19')]?_0x1230af['options'][_0xd300('0x1a')]===undefined?!![]:![]:!![],'where':_0x1230af[_0xd300('0x19')]?_0x1230af[_0xd300('0x19')]['where']||null:null,'attributes':_0x1230af[_0xd300('0x19')]?_0x1230af[_0xd300('0x19')][_0xd300('0x1b')]||null:null,'include':_0x1230af[_0xd300('0x19')]?_0x1230af['options'][_0xd300('0x1c')]?_[_0xd300('0x1d')](_0x1230af['options'][_0xd300('0x1c')],function(_0x37e0f4){return{'model':db[_0x37e0f4[_0xd300('0x1e')]],'as':_0x37e0f4['as'],'attributes':_0x37e0f4[_0xd300('0x1b')],'include':_0x37e0f4[_0xd300('0x1c')]?_[_0xd300('0x1d')](_0x37e0f4[_0xd300('0x1c')],function(_0x3bc8ec){return{'model':db[_0x3bc8ec[_0xd300('0x1e')]],'as':_0x3bc8ec['as'],'attributes':_0x3bc8ec[_0xd300('0x1b')],'include':_0x3bc8ec[_0xd300('0x1c')]?_['map'](_0x3bc8ec[_0xd300('0x1c')],function(_0x32b89d){return{'model':db[_0x32b89d[_0xd300('0x1e')]],'as':_0x32b89d['as'],'attributes':_0x32b89d[_0xd300('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd300('0xd')](function(_0x4f94d2){logger[_0xd300('0xe')](_0xd300('0x17'),_0x1230af);logger[_0xd300('0x1f')](_0xd300('0x17'),_0x1230af,JSON[_0xd300('0x11')](_0x4f94d2));_0x4afc64(_0x4f94d2);})[_0xd300('0x20')](function(_0x9a5840){logger[_0xd300('0x12')](_0xd300('0x17'),_0x9a5840['message'],_0x1230af);_0x504bc2(_0x120f37[_0xd300('0x12')](0x1f4,_0x9a5840[_0xd300('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 372fc29..344bf2d 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x24a654,_0x2ca441){var _0x458651=function(_0x1ecda1){while(--_0x1ecda1){_0x24a654['push'](_0x24a654['shift']());}};_0x458651(++_0x2ca441);}(_0x8603,0x190));var _0x3860=function(_0x38eca5,_0x51010f){_0x38eca5=_0x38eca5-0x0;var _0x29c733=_0x8603[_0x38eca5];return _0x29c733;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x113a7e,_0x161e82){var _0x44f32c=function(_0x4f1b30){while(--_0x4f1b30){_0x113a7e['push'](_0x113a7e['shift']());}};_0x44f32c(++_0x161e82);}(_0xb10b,0x12a));var _0xbb10=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xb10b[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1a104b3..351190f 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 _0x7973=['STRING','ENUM','out','TEXT','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7973,0x153));var _0x3797=function(_0x3ab14e,_0x2f9b98){_0x3ab14e=_0x3ab14e-0x0;var _0x38f5b6=_0x7973[_0x3ab14e];return _0x38f5b6;};'use strict';var Sequelize=require(_0x3797('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3797('0x1')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x3797('0x2')]('in',_0x3797('0x3')),'defaultValue':_0x3797('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3797('0x1')]},'providerResponse':{'type':Sequelize[_0x3797('0x4')]}}; \ No newline at end of file +var _0xc45e=['STRING','TEXT','out'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xc45e,0x93));var _0xec45=function(_0x9154ee,_0x5f2a85){_0x9154ee=_0x9154ee-0x0;var _0x24c414=_0xc45e[_0x9154ee];return _0x24c414;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xec45('0x0')]},'body':{'type':Sequelize[_0xec45('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xec45('0x2')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xec45('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2220b40..51c742a 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 _0x09a1=['rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','catch','show','keys','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','map','SquareMessage'];(function(_0x470b14,_0x23a860){var _0x5011dc=function(_0x118a6b){while(--_0x118a6b){_0x470b14['push'](_0x470b14['shift']());}};_0x5011dc(++_0x23a860);}(_0x09a1,0xf0));var _0x109a=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x09a1[_0xbeb808];return _0x5d6909;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x109a('0x0'));var jsonpatch=require(_0x109a('0x1'));var rp=require(_0x109a('0x2'));var moment=require(_0x109a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x109a('0x4'));var util=require(_0x109a('0x5'));var path=require(_0x109a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x109a('0x7'));var fs=require('fs');var fs_extra=require(_0x109a('0x8'));var _=require(_0x109a('0x9'));var squel=require(_0x109a('0xa'));var crypto=require('crypto');var jsforce=require(_0x109a('0xb'));var deskjs=require(_0x109a('0xc'));var toCsv=require(_0x109a('0xd'));var querystring=require('querystring');var Papa=require(_0x109a('0xe'));var Redis=require(_0x109a('0xf'));var authService=require(_0x109a('0x10'));var qs=require(_0x109a('0x11'));var as=require(_0x109a('0x12'));var hardwareService=require(_0x109a('0x13'));var logger=require(_0x109a('0x14'))(_0x109a('0x15'));var utils=require(_0x109a('0x16'));var config=require(_0x109a('0x17'));var licenseUtil=require(_0x109a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x101355,_0x3d0bb3){_0x3d0bb3=_0x3d0bb3||0xcc;return function(_0x57606f){if(_0x57606f){return _0x101355['sendStatus'](_0x3d0bb3);}return _0x101355[_0x109a('0x19')](_0x3d0bb3)[_0x109a('0x1a')]();};}function respondWithResult(_0x2149c0,_0x4e9b6f){_0x4e9b6f=_0x4e9b6f||0xc8;return function(_0x43431){if(_0x43431){return _0x2149c0[_0x109a('0x19')](_0x4e9b6f)[_0x109a('0x1b')](_0x43431);}};}function respondWithFilteredResult(_0x5152b1,_0xf61eee){return function(_0x3ae0e9){if(_0x3ae0e9){var _0x3c0f39=typeof _0xf61eee[_0x109a('0x1c')]==='undefined'&&typeof _0xf61eee[_0x109a('0x1d')]===_0x109a('0x1e');var _0x150eee=_0x3ae0e9[_0x109a('0x1f')];var _0x45d231=_0x3c0f39?0x0:_0xf61eee[_0x109a('0x1c')];var _0x431366=_0x3c0f39?_0x3ae0e9['count']:_0xf61eee['offset']+_0xf61eee[_0x109a('0x1d')];var _0x1ddfa3;if(_0x431366>=_0x150eee){_0x431366=_0x150eee;_0x1ddfa3=0xc8;}else{_0x1ddfa3=0xce;}_0x5152b1[_0x109a('0x19')](_0x1ddfa3);return _0x5152b1['set'](_0x109a('0x20'),_0x45d231+'-'+_0x431366+'/'+_0x150eee)['json'](_0x3ae0e9);}return null;};}function patchUpdates(_0x398013){return function(_0x5e8697){try{jsonpatch[_0x109a('0x21')](_0x5e8697,_0x398013,!![]);}catch(_0x20b103){return BPromise[_0x109a('0x22')](_0x20b103);}return _0x5e8697[_0x109a('0x23')]();};}function saveUpdates(_0x3a34b6,_0x210432){return function(_0x51fb5f){if(_0x51fb5f){return _0x51fb5f[_0x109a('0x24')](_0x3a34b6)[_0x109a('0x25')](function(_0xa6f2f7){return _0xa6f2f7;});}return null;};}function removeEntity(_0x2a0b06,_0x836149){return function(_0x59875e){if(_0x59875e){return _0x59875e[_0x109a('0x26')]()['then'](function(){_0x2a0b06[_0x109a('0x19')](0xcc)[_0x109a('0x1a')]();});}};}function handleEntityNotFound(_0xe66291,_0x1597a1){return function(_0x29e2ed){if(!_0x29e2ed){_0xe66291[_0x109a('0x27')](0x194);}return _0x29e2ed;};}function handleError(_0x32a050,_0x58c32c){_0x58c32c=_0x58c32c||0x1f4;return function(_0x24b1bc){logger[_0x109a('0x28')](_0x24b1bc['stack']);if(_0x24b1bc[_0x109a('0x29')]){delete _0x24b1bc[_0x109a('0x29')];}_0x32a050[_0x109a('0x19')](_0x58c32c)['send'](_0x24b1bc);};}exports['index']=function(_0x2a881e,_0x5bb661){var _0x23cf4e={},_0x3e43ed={},_0x4397a8={'count':0x0,'rows':[]};var _0xda7ea=_[_0x109a('0x2a')](db[_0x109a('0x2b')][_0x109a('0x2c')],function(_0x3e9f6c){return{'name':_0x3e9f6c['fieldName'],'type':_0x3e9f6c[_0x109a('0x2d')][_0x109a('0x2e')]};});_0x3e43ed[_0x109a('0x2f')]=_['map'](_0xda7ea,_0x109a('0x29'));_0x3e43ed[_0x109a('0x30')]=_['keys'](_0x2a881e[_0x109a('0x30')]);_0x3e43ed[_0x109a('0x31')]=_[_0x109a('0x32')](_0x3e43ed[_0x109a('0x2f')],_0x3e43ed[_0x109a('0x30')]);_0x23cf4e['attributes']=_[_0x109a('0x32')](_0x3e43ed[_0x109a('0x2f')],qs[_0x109a('0x33')](_0x2a881e['query'][_0x109a('0x33')]));_0x23cf4e['attributes']=_0x23cf4e[_0x109a('0x34')][_0x109a('0x35')]?_0x23cf4e[_0x109a('0x34')]:_0x3e43ed[_0x109a('0x2f')];if(!_0x2a881e[_0x109a('0x30')][_0x109a('0x36')](_0x109a('0x37'))){_0x23cf4e[_0x109a('0x1d')]=qs[_0x109a('0x1d')](_0x2a881e['query'][_0x109a('0x1d')]);_0x23cf4e[_0x109a('0x1c')]=qs[_0x109a('0x1c')](_0x2a881e[_0x109a('0x30')][_0x109a('0x1c')]);}_0x23cf4e[_0x109a('0x38')]=qs['sort'](_0x2a881e[_0x109a('0x30')]['sort']);_0x23cf4e[_0x109a('0x39')]=qs[_0x109a('0x31')](_[_0x109a('0x3a')](_0x2a881e[_0x109a('0x30')],_0x3e43ed[_0x109a('0x31')]),_0xda7ea);if(_0x2a881e['query'][_0x109a('0x3b')]){_0x23cf4e['where']=_[_0x109a('0x3c')](_0x23cf4e['where'],{'$or':_[_0x109a('0x2a')](_0xda7ea,function(_0x2d067d){if(_0x2d067d[_0x109a('0x2d')]!=='VIRTUAL'){var _0x2587cf={};_0x2587cf[_0x2d067d['name']]={'$like':'%'+_0x2a881e['query']['filter']+'%'};return _0x2587cf;}})});}_0x23cf4e=_['merge']({},_0x23cf4e,_0x2a881e[_0x109a('0x3d')]);var _0x25ba78={'where':_0x23cf4e[_0x109a('0x39')]};return db[_0x109a('0x2b')]['count'](_0x25ba78)[_0x109a('0x25')](function(_0x1245bd){_0x4397a8[_0x109a('0x1f')]=_0x1245bd;if(_0x2a881e[_0x109a('0x30')][_0x109a('0x3e')]){_0x23cf4e[_0x109a('0x3f')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x23cf4e);})[_0x109a('0x25')](function(_0x38ef27){_0x4397a8['rows']=_0x38ef27;return _0x4397a8;})[_0x109a('0x25')](respondWithFilteredResult(_0x5bb661,_0x23cf4e))[_0x109a('0x40')](handleError(_0x5bb661,null));};exports[_0x109a('0x41')]=function(_0x1e0377,_0x36877e){var _0x188791={'raw':!![],'where':{'id':_0x1e0377['params']['id']}},_0x59287c={};_0x59287c['model']=_[_0x109a('0x42')](db[_0x109a('0x2b')][_0x109a('0x2c')]);_0x59287c[_0x109a('0x30')]=_[_0x109a('0x42')](_0x1e0377[_0x109a('0x30')]);_0x59287c[_0x109a('0x31')]=_[_0x109a('0x32')](_0x59287c[_0x109a('0x2f')],_0x59287c[_0x109a('0x30')]);_0x188791[_0x109a('0x34')]=_['intersection'](_0x59287c[_0x109a('0x2f')],qs['fields'](_0x1e0377['query']['fields']));_0x188791[_0x109a('0x34')]=_0x188791['attributes'][_0x109a('0x35')]?_0x188791[_0x109a('0x34')]:_0x59287c['model'];if(_0x1e0377[_0x109a('0x30')][_0x109a('0x3e')]){_0x188791[_0x109a('0x3f')]=[{'all':!![]}];}_0x188791=_[_0x109a('0x3c')]({},_0x188791,_0x1e0377[_0x109a('0x3d')]);return db['SquareMessage'][_0x109a('0x43')](_0x188791)[_0x109a('0x25')](handleEntityNotFound(_0x36877e,null))['then'](respondWithResult(_0x36877e,null))[_0x109a('0x40')](handleError(_0x36877e,null));};exports[_0x109a('0x44')]=function(_0x3eebde,_0xbb946){return db[_0x109a('0x2b')][_0x109a('0x44')](_0x3eebde[_0x109a('0x45')],{})[_0x109a('0x25')](respondWithResult(_0xbb946,0xc9))['catch'](handleError(_0xbb946,null));};exports[_0x109a('0x24')]=function(_0x1fe096,_0x38a74a){if(_0x1fe096['body']['id']){delete _0x1fe096[_0x109a('0x45')]['id'];}return db[_0x109a('0x2b')]['find']({'where':{'id':_0x1fe096[_0x109a('0x46')]['id']}})['then'](handleEntityNotFound(_0x38a74a,null))[_0x109a('0x25')](saveUpdates(_0x1fe096['body'],null))[_0x109a('0x25')](respondWithResult(_0x38a74a,null))['catch'](handleError(_0x38a74a,null));};exports[_0x109a('0x26')]=function(_0x5e82f3,_0x557d05){return db[_0x109a('0x2b')][_0x109a('0x43')]({'where':{'id':_0x5e82f3[_0x109a('0x46')]['id']}})[_0x109a('0x25')](handleEntityNotFound(_0x557d05,null))[_0x109a('0x25')](removeEntity(_0x557d05,null))[_0x109a('0x40')](handleError(_0x557d05,null));}; \ No newline at end of file +var _0xf99a=['filter','options','where','catch','show','keys','includeAll','include','create','body','destroy','find','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','map','SquareMessage','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','merge','VIRTUAL'];(function(_0x30c63a,_0x218845){var _0x1f4e05=function(_0x3de015){while(--_0x3de015){_0x30c63a['push'](_0x30c63a['shift']());}};_0x1f4e05(++_0x218845);}(_0xf99a,0x166));var _0xaf99=function(_0x26a655,_0x466715){_0x26a655=_0x26a655-0x0;var _0x40e27e=_0xf99a[_0x26a655];return _0x40e27e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaf99('0x0'));var jsonpatch=require(_0xaf99('0x1'));var rp=require('request-promise');var moment=require(_0xaf99('0x2'));var BPromise=require(_0xaf99('0x3'));var Mustache=require(_0xaf99('0x4'));var util=require(_0xaf99('0x5'));var path=require(_0xaf99('0x6'));var sox=require('sox');var csv=require(_0xaf99('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf99('0x8'));var _=require(_0xaf99('0x9'));var squel=require(_0xaf99('0xa'));var crypto=require(_0xaf99('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaf99('0xc'));var toCsv=require(_0xaf99('0x7'));var querystring=require(_0xaf99('0xd'));var Papa=require(_0xaf99('0xe'));var Redis=require('ioredis');var authService=require(_0xaf99('0xf'));var qs=require(_0xaf99('0x10'));var as=require(_0xaf99('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf99('0x12'));var utils=require(_0xaf99('0x13'));var config=require(_0xaf99('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf99('0x15'))['db'];function respondWithStatusCode(_0x3edd06,_0x1eebaa){_0x1eebaa=_0x1eebaa||0xcc;return function(_0x511d1b){if(_0x511d1b){return _0x3edd06[_0xaf99('0x16')](_0x1eebaa);}return _0x3edd06[_0xaf99('0x17')](_0x1eebaa)[_0xaf99('0x18')]();};}function respondWithResult(_0x26ed70,_0x31280d){_0x31280d=_0x31280d||0xc8;return function(_0x154b00){if(_0x154b00){return _0x26ed70[_0xaf99('0x17')](_0x31280d)['json'](_0x154b00);}};}function respondWithFilteredResult(_0x531bb8,_0x5c23ab){return function(_0x39cfd8){if(_0x39cfd8){var _0x2b9171=typeof _0x5c23ab[_0xaf99('0x19')]===_0xaf99('0x1a')&&typeof _0x5c23ab['limit']===_0xaf99('0x1a');var _0x1fe34a=_0x39cfd8[_0xaf99('0x1b')];var _0x1a1e71=_0x2b9171?0x0:_0x5c23ab[_0xaf99('0x19')];var _0x1b34a4=_0x2b9171?_0x39cfd8[_0xaf99('0x1b')]:_0x5c23ab[_0xaf99('0x19')]+_0x5c23ab[_0xaf99('0x1c')];var _0x579812;if(_0x1b34a4>=_0x1fe34a){_0x1b34a4=_0x1fe34a;_0x579812=0xc8;}else{_0x579812=0xce;}_0x531bb8[_0xaf99('0x17')](_0x579812);return _0x531bb8[_0xaf99('0x1d')](_0xaf99('0x1e'),_0x1a1e71+'-'+_0x1b34a4+'/'+_0x1fe34a)[_0xaf99('0x1f')](_0x39cfd8);}return null;};}function patchUpdates(_0x36cfda){return function(_0xc8cf7d){try{jsonpatch[_0xaf99('0x20')](_0xc8cf7d,_0x36cfda,!![]);}catch(_0x51a183){return BPromise[_0xaf99('0x21')](_0x51a183);}return _0xc8cf7d[_0xaf99('0x22')]();};}function saveUpdates(_0x4fd25b,_0x3d19e7){return function(_0x4831b2){if(_0x4831b2){return _0x4831b2[_0xaf99('0x23')](_0x4fd25b)[_0xaf99('0x24')](function(_0x8b664e){return _0x8b664e;});}return null;};}function removeEntity(_0x3f92e3,_0x247ea4){return function(_0x22c63c){if(_0x22c63c){return _0x22c63c['destroy']()[_0xaf99('0x24')](function(){_0x3f92e3[_0xaf99('0x17')](0xcc)[_0xaf99('0x18')]();});}};}function handleEntityNotFound(_0x238224,_0x32e053){return function(_0x358564){if(!_0x358564){_0x238224[_0xaf99('0x16')](0x194);}return _0x358564;};}function handleError(_0xf6fe07,_0x852cf1){_0x852cf1=_0x852cf1||0x1f4;return function(_0x205e34){logger[_0xaf99('0x25')](_0x205e34['stack']);if(_0x205e34[_0xaf99('0x26')]){delete _0x205e34['name'];}_0xf6fe07[_0xaf99('0x17')](_0x852cf1)[_0xaf99('0x27')](_0x205e34);};}exports['index']=function(_0x25c79c,_0x2112dd){var _0x57548c={},_0x4f65ee={},_0xb32560={'count':0x0,'rows':[]};var _0x34c8b7=_[_0xaf99('0x28')](db[_0xaf99('0x29')][_0xaf99('0x2a')],function(_0x39a97c){return{'name':_0x39a97c[_0xaf99('0x2b')],'type':_0x39a97c['type']['key']};});_0x4f65ee[_0xaf99('0x2c')]=_[_0xaf99('0x28')](_0x34c8b7,_0xaf99('0x26'));_0x4f65ee[_0xaf99('0x2d')]=_['keys'](_0x25c79c['query']);_0x4f65ee['filters']=_[_0xaf99('0x2e')](_0x4f65ee[_0xaf99('0x2c')],_0x4f65ee[_0xaf99('0x2d')]);_0x57548c[_0xaf99('0x2f')]=_[_0xaf99('0x2e')](_0x4f65ee[_0xaf99('0x2c')],qs[_0xaf99('0x30')](_0x25c79c[_0xaf99('0x2d')][_0xaf99('0x30')]));_0x57548c[_0xaf99('0x2f')]=_0x57548c[_0xaf99('0x2f')][_0xaf99('0x31')]?_0x57548c['attributes']:_0x4f65ee['model'];if(!_0x25c79c['query'][_0xaf99('0x32')]('nolimit')){_0x57548c[_0xaf99('0x1c')]=qs[_0xaf99('0x1c')](_0x25c79c[_0xaf99('0x2d')]['limit']);_0x57548c[_0xaf99('0x19')]=qs[_0xaf99('0x19')](_0x25c79c[_0xaf99('0x2d')]['offset']);}_0x57548c['order']=qs[_0xaf99('0x33')](_0x25c79c['query'][_0xaf99('0x33')]);_0x57548c['where']=qs[_0xaf99('0x34')](_[_0xaf99('0x35')](_0x25c79c[_0xaf99('0x2d')],_0x4f65ee[_0xaf99('0x34')]),_0x34c8b7);if(_0x25c79c[_0xaf99('0x2d')]['filter']){_0x57548c['where']=_[_0xaf99('0x36')](_0x57548c['where'],{'$or':_[_0xaf99('0x28')](_0x34c8b7,function(_0x38881d){if(_0x38881d['type']!==_0xaf99('0x37')){var _0x44f52b={};_0x44f52b[_0x38881d['name']]={'$like':'%'+_0x25c79c[_0xaf99('0x2d')][_0xaf99('0x38')]+'%'};return _0x44f52b;}})});}_0x57548c=_[_0xaf99('0x36')]({},_0x57548c,_0x25c79c[_0xaf99('0x39')]);var _0xdc6049={'where':_0x57548c[_0xaf99('0x3a')]};return db[_0xaf99('0x29')][_0xaf99('0x1b')](_0xdc6049)[_0xaf99('0x24')](function(_0x217851){_0xb32560[_0xaf99('0x1b')]=_0x217851;if(_0x25c79c['query']['includeAll']){_0x57548c['include']=[{'all':!![]}];}return db[_0xaf99('0x29')]['findAll'](_0x57548c);})[_0xaf99('0x24')](function(_0x3b2449){_0xb32560['rows']=_0x3b2449;return _0xb32560;})['then'](respondWithFilteredResult(_0x2112dd,_0x57548c))[_0xaf99('0x3b')](handleError(_0x2112dd,null));};exports[_0xaf99('0x3c')]=function(_0x599a7e,_0x7ff42b){var _0x275236={'raw':!![],'where':{'id':_0x599a7e['params']['id']}},_0xc4db59={};_0xc4db59[_0xaf99('0x2c')]=_[_0xaf99('0x3d')](db[_0xaf99('0x29')]['rawAttributes']);_0xc4db59[_0xaf99('0x2d')]=_[_0xaf99('0x3d')](_0x599a7e[_0xaf99('0x2d')]);_0xc4db59[_0xaf99('0x34')]=_[_0xaf99('0x2e')](_0xc4db59['model'],_0xc4db59[_0xaf99('0x2d')]);_0x275236['attributes']=_[_0xaf99('0x2e')](_0xc4db59[_0xaf99('0x2c')],qs['fields'](_0x599a7e['query'][_0xaf99('0x30')]));_0x275236[_0xaf99('0x2f')]=_0x275236[_0xaf99('0x2f')][_0xaf99('0x31')]?_0x275236[_0xaf99('0x2f')]:_0xc4db59[_0xaf99('0x2c')];if(_0x599a7e[_0xaf99('0x2d')][_0xaf99('0x3e')]){_0x275236[_0xaf99('0x3f')]=[{'all':!![]}];}_0x275236=_[_0xaf99('0x36')]({},_0x275236,_0x599a7e[_0xaf99('0x39')]);return db[_0xaf99('0x29')]['find'](_0x275236)[_0xaf99('0x24')](handleEntityNotFound(_0x7ff42b,null))[_0xaf99('0x24')](respondWithResult(_0x7ff42b,null))[_0xaf99('0x3b')](handleError(_0x7ff42b,null));};exports[_0xaf99('0x40')]=function(_0x56e8ce,_0x4d8bb8){return db[_0xaf99('0x29')][_0xaf99('0x40')](_0x56e8ce[_0xaf99('0x41')],{})[_0xaf99('0x24')](respondWithResult(_0x4d8bb8,0xc9))[_0xaf99('0x3b')](handleError(_0x4d8bb8,null));};exports[_0xaf99('0x23')]=function(_0x356a34,_0x16df18){if(_0x356a34[_0xaf99('0x41')]['id']){delete _0x356a34[_0xaf99('0x41')]['id'];}return db[_0xaf99('0x29')]['find']({'where':{'id':_0x356a34['params']['id']}})[_0xaf99('0x24')](handleEntityNotFound(_0x16df18,null))[_0xaf99('0x24')](saveUpdates(_0x356a34[_0xaf99('0x41')],null))[_0xaf99('0x24')](respondWithResult(_0x16df18,null))[_0xaf99('0x3b')](handleError(_0x16df18,null));};exports[_0xaf99('0x42')]=function(_0xa10985,_0x2450a7){return db[_0xaf99('0x29')][_0xaf99('0x43')]({'where':{'id':_0xa10985[_0xaf99('0x44')]['id']}})['then'](handleEntityNotFound(_0x2450a7,null))[_0xaf99('0x24')](removeEntity(_0x2450a7,null))[_0xaf99('0x3b')](handleError(_0x2450a7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1c0db1f..d7ccdf7 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 _0xd660=['./squareMessage.attributes','exports','SquareMessage','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0xd660,0xe9));var _0x0d66=function(_0xf9f239,_0x30c0df){_0xf9f239=_0xf9f239-0x0;var _0x536d3d=_0xd660[_0xf9f239];return _0x536d3d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d66('0x0'))(_0x0d66('0x1'));var moment=require(_0x0d66('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d66('0x3'));var fs=require('fs');var path=require(_0x0d66('0x4'));var rimraf=require(_0x0d66('0x5'));var config=require(_0x0d66('0x6'));var attributes=require(_0x0d66('0x7'));module[_0x0d66('0x8')]=function(_0x51fd77,_0x3558f0){return _0x51fd77['define'](_0x0d66('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e6a=['bluebird','request-promise','rimraf','exports','SquareMessage','square_messages','../../config/logger','api','moment'];(function(_0x42c77e,_0x5c0fd5){var _0x58baaf=function(_0x1b72a9){while(--_0x1b72a9){_0x42c77e['push'](_0x42c77e['shift']());}};_0x58baaf(++_0x5c0fd5);}(_0x6e6a,0xf0));var _0xa6e6=function(_0xb3adf5,_0x3c6a97){_0xb3adf5=_0xb3adf5-0x0;var _0x15b27e=_0x6e6a[_0xb3adf5];return _0x15b27e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa6e6('0x0'))(_0xa6e6('0x1'));var moment=require(_0xa6e6('0x2'));var BPromise=require(_0xa6e6('0x3'));var rp=require(_0xa6e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6e6('0x5'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xa6e6('0x6')]=function(_0x2def17,_0x2e3c21){return _0x2def17['define'](_0xa6e6('0x7'),attributes,{'tableName':_0xa6e6('0x8'),'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 91ad191..f8c5958 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 _0xbe78=['create','body','options','raw','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x3dd822,_0x3b9fed){var _0x4f58d0=function(_0x41be33){while(--_0x41be33){_0x3dd822['push'](_0x3dd822['shift']());}};_0x4f58d0(++_0x3b9fed);}(_0xbe78,0x1c7));var _0x8be7=function(_0x3007a3,_0x4206f8){_0x3007a3=_0x3007a3-0x0;var _0x4f7d4c=_0xbe78[_0x3007a3];return _0x4f7d4c;};'use strict';var _=require(_0x8be7('0x0'));var util=require(_0x8be7('0x1'));var moment=require(_0x8be7('0x2'));var BPromise=require(_0x8be7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8be7('0x4'));var db=require(_0x8be7('0x5'))['db'];var utils=require(_0x8be7('0x6'));var logger=require(_0x8be7('0x7'))(_0x8be7('0x8'));var config=require(_0x8be7('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8be7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cc884,_0x38cf4a,_0xd5e5a5){return new BPromise(function(_0x36367b,_0x66c43c){return client[_0x8be7('0xb')](_0x5cc884,_0xd5e5a5)[_0x8be7('0xc')](function(_0x4766f3){logger['info'](_0x8be7('0xd'),_0x38cf4a,'request\x20sent');logger[_0x8be7('0xe')](_0x8be7('0xf'),_0x38cf4a,'request\x20sent',JSON[_0x8be7('0x10')](_0x4766f3));if(_0x4766f3[_0x8be7('0x11')]){if(_0x4766f3[_0x8be7('0x11')][_0x8be7('0x12')]===0x1f4){logger[_0x8be7('0x11')](_0x8be7('0xd'),_0x38cf4a,_0x4766f3[_0x8be7('0x11')][_0x8be7('0x13')]);return _0x66c43c(_0x4766f3[_0x8be7('0x11')][_0x8be7('0x13')]);}logger[_0x8be7('0x11')]('SquareMessage,\x20%s,\x20%s',_0x38cf4a,_0x4766f3[_0x8be7('0x11')]['message']);return _0x36367b(_0x4766f3['error']['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x38cf4a,_0x8be7('0x14'));_0x36367b(_0x4766f3[_0x8be7('0x15')][_0x8be7('0x13')]);}})[_0x8be7('0x16')](function(_0x393e62){logger[_0x8be7('0x11')](_0x8be7('0xd'),_0x38cf4a,_0x393e62);_0x66c43c(_0x393e62);});});}exports[_0x8be7('0x17')]=function(_0x2b7aa7){var _0x39bd42=this;return new Promise(function(_0x716079,_0x157c56){return db[_0x8be7('0x18')][_0x8be7('0x19')](_0x2b7aa7[_0x8be7('0x1a')],{'raw':_0x2b7aa7[_0x8be7('0x1b')]?_0x2b7aa7['options'][_0x8be7('0x1c')]===undefined?!![]:![]:!![]})[_0x8be7('0xc')](function(_0x30a6a6){logger[_0x8be7('0x1d')]('CreateSquareMessage',_0x2b7aa7);logger[_0x8be7('0xe')](_0x8be7('0x17'),_0x2b7aa7,JSON[_0x8be7('0x10')](_0x30a6a6));_0x716079(_0x30a6a6);})[_0x8be7('0x16')](function(_0x3a9fb5){logger[_0x8be7('0x11')](_0x8be7('0x17'),_0x3a9fb5[_0x8be7('0x13')],_0x2b7aa7);_0x157c56(_0x39bd42[_0x8be7('0x11')](0x1f4,_0x3a9fb5[_0x8be7('0x13')]));});});}; \ No newline at end of file +var _0xfa09=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','create','body','options','raw','debug','stringify','lodash'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0xfa09,0xad));var _0x9fa0=function(_0x41bba8,_0x21f469){_0x41bba8=_0x41bba8-0x0;var _0x58d0e7=_0xfa09[_0x41bba8];return _0x58d0e7;};'use strict';var _=require(_0x9fa0('0x0'));var util=require(_0x9fa0('0x1'));var moment=require('moment');var BPromise=require(_0x9fa0('0x2'));var rs=require(_0x9fa0('0x3'));var fs=require('fs');var Redis=require(_0x9fa0('0x4'));var db=require(_0x9fa0('0x5'))['db'];var utils=require(_0x9fa0('0x6'));var logger=require(_0x9fa0('0x7'))(_0x9fa0('0x8'));var config=require(_0x9fa0('0x9'));var jayson=require(_0x9fa0('0xa'));var client=jayson[_0x9fa0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x522caa,_0xca837b,_0x52d218){return new BPromise(function(_0x2fcebd,_0x588c0f){return client['request'](_0x522caa,_0x52d218)[_0x9fa0('0xc')](function(_0xd9db79){logger[_0x9fa0('0xd')](_0x9fa0('0xe'),_0xca837b,_0x9fa0('0xf'));logger['debug'](_0x9fa0('0x10'),_0xca837b,'request\x20sent',JSON['stringify'](_0xd9db79));if(_0xd9db79[_0x9fa0('0x11')]){if(_0xd9db79[_0x9fa0('0x11')][_0x9fa0('0x12')]===0x1f4){logger[_0x9fa0('0x11')](_0x9fa0('0xe'),_0xca837b,_0xd9db79[_0x9fa0('0x11')][_0x9fa0('0x13')]);return _0x588c0f(_0xd9db79[_0x9fa0('0x11')][_0x9fa0('0x13')]);}logger[_0x9fa0('0x11')]('SquareMessage,\x20%s,\x20%s',_0xca837b,_0xd9db79[_0x9fa0('0x11')][_0x9fa0('0x13')]);return _0x2fcebd(_0xd9db79['error'][_0x9fa0('0x13')]);}else{logger['info'](_0x9fa0('0xe'),_0xca837b,_0x9fa0('0xf'));_0x2fcebd(_0xd9db79[_0x9fa0('0x14')]['message']);}})[_0x9fa0('0x15')](function(_0x456678){logger['error']('SquareMessage,\x20%s,\x20%s',_0xca837b,_0x456678);_0x588c0f(_0x456678);});});}exports[_0x9fa0('0x16')]=function(_0x2b1974){var _0x5b27a6=this;return new Promise(function(_0xece98f,_0x292adc){return db['SquareMessage'][_0x9fa0('0x17')](_0x2b1974[_0x9fa0('0x18')],{'raw':_0x2b1974[_0x9fa0('0x19')]?_0x2b1974['options'][_0x9fa0('0x1a')]===undefined?!![]:![]:!![]})[_0x9fa0('0xc')](function(_0x14253a){logger['info'](_0x9fa0('0x16'),_0x2b1974);logger[_0x9fa0('0x1b')]('CreateSquareMessage',_0x2b1974,JSON[_0x9fa0('0x1c')](_0x14253a));_0xece98f(_0x14253a);})[_0x9fa0('0x15')](function(_0x29abe8){logger['error']('CreateSquareMessage',_0x29abe8['message'],_0x2b1974);_0x292adc(_0x5b27a6[_0x9fa0('0x11')](0x1f4,_0x29abe8[_0x9fa0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ec44d35..e033835 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 _0x5313=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','post','create','put','update','delete','destroy','exports'];(function(_0x52c33c,_0x423b38){var _0x3c7a84=function(_0x503345){while(--_0x503345){_0x52c33c['push'](_0x52c33c['shift']());}};_0x3c7a84(++_0x423b38);}(_0x5313,0x108));var _0x3531=function(_0xb7b284,_0xa1131e){_0xb7b284=_0xb7b284-0x0;var _0x825f3a=_0x5313[_0xb7b284];return _0x825f3a;};'use strict';var multer=require('multer');var util=require(_0x3531('0x0'));var path=require(_0x3531('0x1'));var timeout=require('connect-timeout');var express=require(_0x3531('0x2'));var router=express[_0x3531('0x3')]();var fs_extra=require(_0x3531('0x4'));var auth=require(_0x3531('0x5'));var interaction=require(_0x3531('0x6'));var config=require(_0x3531('0x7'));var controller=require(_0x3531('0x8'));router[_0x3531('0x9')]('/',auth['isAuthenticated'](),controller[_0x3531('0xa')]);router[_0x3531('0x9')](_0x3531('0xb'),auth[_0x3531('0xc')](),controller[_0x3531('0xd')]);router[_0x3531('0x9')](_0x3531('0xe'),auth[_0x3531('0xc')](),timeout('15s'),controller['test']);router[_0x3531('0xf')]('/',auth[_0x3531('0xc')](),controller[_0x3531('0x10')]);router[_0x3531('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3531('0x12')]);router[_0x3531('0x13')](_0x3531('0xb'),auth[_0x3531('0xc')](),controller[_0x3531('0x14')]);module[_0x3531('0x15')]=router; \ No newline at end of file +var _0xeb52=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','index','get','/:id','isAuthenticated','15s','test','create','put','update','delete','destroy','multer'];(function(_0x31f23f,_0x421862){var _0x572b25=function(_0x41c5ca){while(--_0x41c5ca){_0x31f23f['push'](_0x31f23f['shift']());}};_0x572b25(++_0x421862);}(_0xeb52,0x1e2));var _0x2eb5=function(_0x227775,_0x34a8d3){_0x227775=_0x227775-0x0;var _0x576577=_0xeb52[_0x227775];return _0x576577;};'use strict';var multer=require(_0x2eb5('0x0'));var util=require(_0x2eb5('0x1'));var path=require('path');var timeout=require(_0x2eb5('0x2'));var express=require(_0x2eb5('0x3'));var router=express[_0x2eb5('0x4')]();var fs_extra=require(_0x2eb5('0x5'));var auth=require(_0x2eb5('0x6'));var interaction=require(_0x2eb5('0x7'));var config=require(_0x2eb5('0x8'));var controller=require(_0x2eb5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2eb5('0xa')]);router[_0x2eb5('0xb')](_0x2eb5('0xc'),auth[_0x2eb5('0xd')](),controller['show']);router[_0x2eb5('0xb')]('/:id/test',auth[_0x2eb5('0xd')](),timeout(_0x2eb5('0xe')),controller[_0x2eb5('0xf')]);router['post']('/',auth[_0x2eb5('0xd')](),controller[_0x2eb5('0x10')]);router[_0x2eb5('0x11')](_0x2eb5('0xc'),auth[_0x2eb5('0xd')](),controller[_0x2eb5('0x12')]);router[_0x2eb5('0x13')](_0x2eb5('0xc'),auth['isAuthenticated'](),controller[_0x2eb5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index dae80fe..ae9dd73 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 _0xae7a=['STRING','name','exports'];(function(_0x283ab2,_0x504c73){var _0x2e501c=function(_0x1a30dd){while(--_0x1a30dd){_0x283ab2['push'](_0x283ab2['shift']());}};_0x2e501c(++_0x504c73);}(_0xae7a,0x98));var _0xaae7=function(_0x19dd8a,_0x449861){_0x19dd8a=_0x19dd8a-0x0;var _0x212ccc=_0xae7a[_0x19dd8a];return _0x212ccc;};'use strict';var Sequelize=require('sequelize');module[_0xaae7('0x0')]={'name':{'type':Sequelize[_0xaae7('0x1')],'unique':_0xaae7('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xaae7('0x1')]},'description':{'type':Sequelize[_0xaae7('0x1')]}}; \ No newline at end of file +var _0x93d3=['sequelize','exports','STRING','name'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x93d3,0x104));var _0x393d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x93d3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x393d('0x0'));module[_0x393d('0x1')]={'name':{'type':Sequelize[_0x393d('0x2')],'unique':_0x393d('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 8447d84..db89951 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 _0x909e=['index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','openSync','dsn','closeSync','eml-format','rimraf','fast-json-patch','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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','end','offset','limit','undefined','count','status','set','json','reject','save','destroy','then','get','ODBC','error','name','send'];(function(_0x3140da,_0x36f1fe){var _0xcc825a=function(_0x580484){while(--_0x580484){_0x3140da['push'](_0x3140da['shift']());}};_0xcc825a(++_0x36f1fe);}(_0x909e,0x131));var _0xe909=function(_0xe5865c,_0x14ceb2){_0xe5865c=_0xe5865c-0x0;var _0x95f84a=_0x909e[_0xe5865c];return _0x95f84a;};'use strict';var emlformat=require(_0xe909('0x0'));var rimraf=require(_0xe909('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe909('0x2'));var rp=require('request-promise');var moment=require(_0xe909('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe909('0x4'));var util=require(_0xe909('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe909('0x6'));var fs=require('fs');var fs_extra=require(_0xe909('0x7'));var _=require(_0xe909('0x8'));var squel=require(_0xe909('0x9'));var crypto=require(_0xe909('0xa'));var jsforce=require(_0xe909('0xb'));var deskjs=require(_0xe909('0xc'));var toCsv=require(_0xe909('0xd'));var querystring=require('querystring');var Papa=require(_0xe909('0xe'));var Redis=require('ioredis');var authService=require(_0xe909('0xf'));var qs=require(_0xe909('0x10'));var as=require(_0xe909('0x11'));var hardwareService=require(_0xe909('0x12'));var logger=require(_0xe909('0x13'))(_0xe909('0x14'));var utils=require(_0xe909('0x15'));var config=require(_0xe909('0x16'));var licenseUtil=require(_0xe909('0x17'));var db=require(_0xe909('0x18'))['db'];function respondWithStatusCode(_0x18e470,_0x58e579){_0x58e579=_0x58e579||0xcc;return function(_0x4fbe85){if(_0x4fbe85){return _0x18e470[_0xe909('0x19')](_0x58e579);}return _0x18e470['status'](_0x58e579)[_0xe909('0x1a')]();};}function respondWithResult(_0x2940ae,_0x14630a){_0x14630a=_0x14630a||0xc8;return function(_0x1aca1e){if(_0x1aca1e){return _0x2940ae['status'](_0x14630a)['json'](_0x1aca1e);}};}function respondWithFilteredResult(_0x48408d,_0x3f1c44){return function(_0xdf5748){if(_0xdf5748){var _0x48f817=typeof _0x3f1c44[_0xe909('0x1b')]==='undefined'&&typeof _0x3f1c44[_0xe909('0x1c')]===_0xe909('0x1d');var _0x3bcb2a=_0xdf5748[_0xe909('0x1e')];var _0x20ba1d=_0x48f817?0x0:_0x3f1c44['offset'];var _0x4c8f96=_0x48f817?_0xdf5748[_0xe909('0x1e')]:_0x3f1c44[_0xe909('0x1b')]+_0x3f1c44[_0xe909('0x1c')];var _0x31f070;if(_0x4c8f96>=_0x3bcb2a){_0x4c8f96=_0x3bcb2a;_0x31f070=0xc8;}else{_0x31f070=0xce;}_0x48408d[_0xe909('0x1f')](_0x31f070);return _0x48408d[_0xe909('0x20')]('Content-Range',_0x20ba1d+'-'+_0x4c8f96+'/'+_0x3bcb2a)[_0xe909('0x21')](_0xdf5748);}return null;};}function patchUpdates(_0x3497c7){return function(_0x4e1975){try{jsonpatch['apply'](_0x4e1975,_0x3497c7,!![]);}catch(_0x16f7fc){return BPromise[_0xe909('0x22')](_0x16f7fc);}return _0x4e1975[_0xe909('0x23')]();};}function saveUpdates(_0x3ef5b9,_0x53ada3){return function(_0x39cea4){if(_0x39cea4){return _0x39cea4['update'](_0x3ef5b9)['then'](function(_0x262752){return _0x262752;});}return null;};}function removeEntity(_0x2e150b,_0x30f030){return function(_0x21d793){if(_0x21d793){return _0x21d793[_0xe909('0x24')]()[_0xe909('0x25')](function(){var _0x357513=_0x21d793[_0xe909('0x26')]({'plain':!![]});var _0x450d77=_0xe909('0x27');return db['UserProfileResource'][_0xe909('0x24')]({'where':{'type':_0x450d77,'resourceId':_0x357513['id']}})['then'](function(){return _0x21d793;});})[_0xe909('0x25')](function(){_0x2e150b[_0xe909('0x1f')](0xcc)[_0xe909('0x1a')]();});}};}function handleEntityNotFound(_0x3eef62,_0x4e3a1e){return function(_0x1ac0c9){if(!_0x1ac0c9){_0x3eef62[_0xe909('0x19')](0x194);}return _0x1ac0c9;};}function handleError(_0x11d9ef,_0x23a831){_0x23a831=_0x23a831||0x1f4;return function(_0x5c07f4){logger[_0xe909('0x28')](_0x5c07f4['stack']);if(_0x5c07f4[_0xe909('0x29')]){delete _0x5c07f4[_0xe909('0x29')];}_0x11d9ef[_0xe909('0x1f')](_0x23a831)[_0xe909('0x2a')](_0x5c07f4);};}exports[_0xe909('0x2b')]=function(_0x41b4ff,_0x2243e9){var _0x5e8c35={},_0x54ee0f={},_0x43c9e5={'count':0x0,'rows':[]};var _0x273dca=_[_0xe909('0x2c')](db[_0xe909('0x2d')][_0xe909('0x2e')],function(_0x1c7900){return{'name':_0x1c7900[_0xe909('0x2f')],'type':_0x1c7900[_0xe909('0x30')][_0xe909('0x31')]};});_0x54ee0f[_0xe909('0x32')]=_[_0xe909('0x2c')](_0x273dca,_0xe909('0x29'));_0x54ee0f[_0xe909('0x33')]=_[_0xe909('0x34')](_0x41b4ff[_0xe909('0x33')]);_0x54ee0f[_0xe909('0x35')]=_[_0xe909('0x36')](_0x54ee0f[_0xe909('0x32')],_0x54ee0f['query']);_0x5e8c35[_0xe909('0x37')]=_['intersection'](_0x54ee0f['model'],qs[_0xe909('0x38')](_0x41b4ff[_0xe909('0x33')][_0xe909('0x38')]));_0x5e8c35[_0xe909('0x37')]=_0x5e8c35[_0xe909('0x37')][_0xe909('0x39')]?_0x5e8c35[_0xe909('0x37')]:_0x54ee0f[_0xe909('0x32')];if(!_0x41b4ff[_0xe909('0x33')]['hasOwnProperty']('nolimit')){_0x5e8c35[_0xe909('0x1c')]=qs[_0xe909('0x1c')](_0x41b4ff[_0xe909('0x33')]['limit']);_0x5e8c35['offset']=qs[_0xe909('0x1b')](_0x41b4ff[_0xe909('0x33')][_0xe909('0x1b')]);}_0x5e8c35[_0xe909('0x3a')]=qs[_0xe909('0x3b')](_0x41b4ff[_0xe909('0x33')]['sort']);_0x5e8c35[_0xe909('0x3c')]=qs['filters'](_[_0xe909('0x3d')](_0x41b4ff[_0xe909('0x33')],_0x54ee0f[_0xe909('0x35')]),_0x273dca);if(_0x41b4ff[_0xe909('0x33')][_0xe909('0x3e')]){_0x5e8c35[_0xe909('0x3c')]=_[_0xe909('0x3f')](_0x5e8c35['where'],{'$or':_[_0xe909('0x2c')](_0x273dca,function(_0x1455e1){if(_0x1455e1['type']!==_0xe909('0x40')){var _0x14bf86={};_0x14bf86[_0x1455e1[_0xe909('0x29')]]={'$like':'%'+_0x41b4ff[_0xe909('0x33')]['filter']+'%'};return _0x14bf86;}})});}_0x5e8c35=_[_0xe909('0x3f')]({},_0x5e8c35,_0x41b4ff[_0xe909('0x41')]);var _0x1f4fc3={'where':_0x5e8c35[_0xe909('0x3c')]};return db['SquareOdbc'][_0xe909('0x1e')](_0x1f4fc3)[_0xe909('0x25')](function(_0x3ecefc){_0x43c9e5[_0xe909('0x1e')]=_0x3ecefc;if(_0x41b4ff[_0xe909('0x33')][_0xe909('0x42')]){_0x5e8c35[_0xe909('0x43')]=[{'all':!![]}];}return db[_0xe909('0x2d')][_0xe909('0x44')](_0x5e8c35);})[_0xe909('0x25')](function(_0x49eea6){_0x43c9e5[_0xe909('0x45')]=_0x49eea6;return _0x43c9e5;})[_0xe909('0x25')](respondWithFilteredResult(_0x2243e9,_0x5e8c35))[_0xe909('0x46')](handleError(_0x2243e9,null));};exports[_0xe909('0x47')]=function(_0x304dfb,_0x276254){var _0x49f41f={'raw':!![],'where':{'id':_0x304dfb['params']['id']}},_0x5ebb00={};_0x5ebb00[_0xe909('0x32')]=_[_0xe909('0x34')](db[_0xe909('0x2d')][_0xe909('0x2e')]);_0x5ebb00[_0xe909('0x33')]=_[_0xe909('0x34')](_0x304dfb['query']);_0x5ebb00['filters']=_[_0xe909('0x36')](_0x5ebb00[_0xe909('0x32')],_0x5ebb00['query']);_0x49f41f[_0xe909('0x37')]=_[_0xe909('0x36')](_0x5ebb00[_0xe909('0x32')],qs[_0xe909('0x38')](_0x304dfb[_0xe909('0x33')][_0xe909('0x38')]));_0x49f41f['attributes']=_0x49f41f[_0xe909('0x37')][_0xe909('0x39')]?_0x49f41f[_0xe909('0x37')]:_0x5ebb00[_0xe909('0x32')];if(_0x304dfb['query'][_0xe909('0x42')]){_0x49f41f[_0xe909('0x43')]=[{'all':!![]}];}_0x49f41f=_['merge']({},_0x49f41f,_0x304dfb['options']);return db[_0xe909('0x2d')][_0xe909('0x48')](_0x49f41f)[_0xe909('0x25')](handleEntityNotFound(_0x276254,null))[_0xe909('0x25')](respondWithResult(_0x276254,null))['catch'](handleError(_0x276254,null));};exports[_0xe909('0x49')]=function(_0x4e2294,_0x48314d){return db['SquareOdbc'][_0xe909('0x49')](_0x4e2294[_0xe909('0x4a')],{})['then'](function(_0x47bc80){var _0x2283a1=_0x4e2294[_0xe909('0x4b')]['get']({'plain':!![]});if(!_0x2283a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2283a1[_0xe909('0x4c')]==='user'){var _0x1a9923=_0x47bc80[_0xe909('0x26')]({'plain':!![]});var _0x58ffc8='ODBC';return db[_0xe909('0x4d')][_0xe909('0x48')]({'where':{'name':_0x58ffc8,'userProfileId':_0x2283a1[_0xe909('0x4e')]},'raw':!![]})[_0xe909('0x25')](function(_0x4eb58a){if(_0x4eb58a&&_0x4eb58a['autoAssociation']===0x0){return db[_0xe909('0x4f')][_0xe909('0x49')]({'name':_0x1a9923[_0xe909('0x29')],'resourceId':_0x1a9923['id'],'type':_0x4eb58a[_0xe909('0x29')],'sectionId':_0x4eb58a['id']},{})['then'](function(){return _0x47bc80;});}else{return _0x47bc80;}})['catch'](function(_0x2ad155){logger[_0xe909('0x28')](_0xe909('0x50'),_0x2ad155);throw _0x2ad155;});}return _0x47bc80;})[_0xe909('0x25')](respondWithResult(_0x48314d,0xc9))['catch'](handleError(_0x48314d,null));};exports[_0xe909('0x51')]=function(_0x47229a,_0x1b52ad){if(_0x47229a['body']['id']){delete _0x47229a[_0xe909('0x4a')]['id'];}return db['SquareOdbc'][_0xe909('0x48')]({'where':{'id':_0x47229a['params']['id']}})[_0xe909('0x25')](handleEntityNotFound(_0x1b52ad,null))['then'](saveUpdates(_0x47229a[_0xe909('0x4a')],null))[_0xe909('0x25')](respondWithResult(_0x1b52ad,null))[_0xe909('0x46')](handleError(_0x1b52ad,null));};exports[_0xe909('0x24')]=function(_0x1f265f,_0x690750){return db[_0xe909('0x2d')]['find']({'where':{'id':_0x1f265f[_0xe909('0x52')]['id']}})[_0xe909('0x25')](handleEntityNotFound(_0x690750,null))['then'](removeEntity(_0x690750,null))[_0xe909('0x46')](handleError(_0x690750,null));};exports[_0xe909('0x53')]=function(_0x117eb2,_0x386e75,_0x571d1f){var _0x11152c;return db[_0xe909('0x2d')][_0xe909('0x48')]({'where':{'id':_0x117eb2[_0xe909('0x52')]['id']},'attributes':['id','dsn']})[_0xe909('0x25')](handleEntityNotFound(_0x386e75,null))[_0xe909('0x25')](function(_0x34b3b6){if(_0x34b3b6){var _0xe9bd87=require('odbc')();_0xe9bd87[_0xe909('0x54')](_0x34b3b6[_0xe909('0x55')]);_0xe9bd87[_0xe909('0x56')]();return _0x34b3b6;}})[_0xe909('0x25')](respondWithResult(_0x386e75,null))['catch'](handleError(_0x386e75,null));}; \ No newline at end of file +var _0xe0ff=['nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','params','options','find','create','role','user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','get','ODBC','destroy','error','stack','name','map','SquareOdbc','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty'];(function(_0x513f45,_0x21d195){var _0x78190a=function(_0x5a2fcb){while(--_0x5a2fcb){_0x513f45['push'](_0x513f45['shift']());}};_0x78190a(++_0x21d195);}(_0xe0ff,0x1c8));var _0xfe0f=function(_0x36a9e9,_0xc53bc6){_0x36a9e9=_0x36a9e9-0x0;var _0x4ac1c0=_0xe0ff[_0x36a9e9];return _0x4ac1c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe0f('0x0'));var zipdir=require(_0xfe0f('0x1'));var jsonpatch=require(_0xfe0f('0x2'));var rp=require(_0xfe0f('0x3'));var moment=require(_0xfe0f('0x4'));var BPromise=require(_0xfe0f('0x5'));var Mustache=require(_0xfe0f('0x6'));var util=require('util');var path=require(_0xfe0f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfe0f('0x8'));var fs=require('fs');var fs_extra=require(_0xfe0f('0x9'));var _=require(_0xfe0f('0xa'));var squel=require(_0xfe0f('0xb'));var crypto=require(_0xfe0f('0xc'));var jsforce=require(_0xfe0f('0xd'));var deskjs=require(_0xfe0f('0xe'));var toCsv=require(_0xfe0f('0xf'));var querystring=require(_0xfe0f('0x10'));var Papa=require('papaparse');var Redis=require(_0xfe0f('0x11'));var authService=require(_0xfe0f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfe0f('0x13'));var hardwareService=require(_0xfe0f('0x14'));var logger=require(_0xfe0f('0x15'))(_0xfe0f('0x16'));var utils=require(_0xfe0f('0x17'));var config=require(_0xfe0f('0x18'));var licenseUtil=require(_0xfe0f('0x19'));var db=require(_0xfe0f('0x1a'))['db'];function respondWithStatusCode(_0x3e5e4a,_0xe00571){_0xe00571=_0xe00571||0xcc;return function(_0x2d504e){if(_0x2d504e){return _0x3e5e4a[_0xfe0f('0x1b')](_0xe00571);}return _0x3e5e4a[_0xfe0f('0x1c')](_0xe00571)[_0xfe0f('0x1d')]();};}function respondWithResult(_0x37c3aa,_0x656a5f){_0x656a5f=_0x656a5f||0xc8;return function(_0x5895e5){if(_0x5895e5){return _0x37c3aa['status'](_0x656a5f)[_0xfe0f('0x1e')](_0x5895e5);}};}function respondWithFilteredResult(_0x38a8ca,_0x1e0bca){return function(_0x5a70a8){if(_0x5a70a8){var _0x775e1e=typeof _0x1e0bca[_0xfe0f('0x1f')]===_0xfe0f('0x20')&&typeof _0x1e0bca[_0xfe0f('0x21')]==='undefined';var _0x516d4f=_0x5a70a8[_0xfe0f('0x22')];var _0x50d5f8=_0x775e1e?0x0:_0x1e0bca[_0xfe0f('0x1f')];var _0x1872cf=_0x775e1e?_0x5a70a8[_0xfe0f('0x22')]:_0x1e0bca[_0xfe0f('0x1f')]+_0x1e0bca[_0xfe0f('0x21')];var _0xb7dc56;if(_0x1872cf>=_0x516d4f){_0x1872cf=_0x516d4f;_0xb7dc56=0xc8;}else{_0xb7dc56=0xce;}_0x38a8ca['status'](_0xb7dc56);return _0x38a8ca[_0xfe0f('0x23')]('Content-Range',_0x50d5f8+'-'+_0x1872cf+'/'+_0x516d4f)['json'](_0x5a70a8);}return null;};}function patchUpdates(_0x590666){return function(_0x2d3c09){try{jsonpatch['apply'](_0x2d3c09,_0x590666,!![]);}catch(_0x1a80d1){return BPromise[_0xfe0f('0x24')](_0x1a80d1);}return _0x2d3c09[_0xfe0f('0x25')]();};}function saveUpdates(_0x3a7c99,_0x191855){return function(_0x505678){if(_0x505678){return _0x505678[_0xfe0f('0x26')](_0x3a7c99)['then'](function(_0x1b8a7e){return _0x1b8a7e;});}return null;};}function removeEntity(_0x5495e4,_0x28e9cb){return function(_0x3f1e27){if(_0x3f1e27){return _0x3f1e27['destroy']()[_0xfe0f('0x27')](function(){var _0x2b160c=_0x3f1e27[_0xfe0f('0x28')]({'plain':!![]});var _0xe9eb93=_0xfe0f('0x29');return db['UserProfileResource'][_0xfe0f('0x2a')]({'where':{'type':_0xe9eb93,'resourceId':_0x2b160c['id']}})[_0xfe0f('0x27')](function(){return _0x3f1e27;});})[_0xfe0f('0x27')](function(){_0x5495e4[_0xfe0f('0x1c')](0xcc)[_0xfe0f('0x1d')]();});}};}function handleEntityNotFound(_0x269614,_0x5c0401){return function(_0x1a81fc){if(!_0x1a81fc){_0x269614['sendStatus'](0x194);}return _0x1a81fc;};}function handleError(_0x55527b,_0x3cc64b){_0x3cc64b=_0x3cc64b||0x1f4;return function(_0x573a6c){logger[_0xfe0f('0x2b')](_0x573a6c[_0xfe0f('0x2c')]);if(_0x573a6c[_0xfe0f('0x2d')]){delete _0x573a6c[_0xfe0f('0x2d')];}_0x55527b[_0xfe0f('0x1c')](_0x3cc64b)['send'](_0x573a6c);};}exports['index']=function(_0x2902d6,_0x2de5f8){var _0x14af17={},_0x2ff8d6={},_0x4193ab={'count':0x0,'rows':[]};var _0x2a3b33=_[_0xfe0f('0x2e')](db[_0xfe0f('0x2f')][_0xfe0f('0x30')],function(_0x426405){return{'name':_0x426405[_0xfe0f('0x31')],'type':_0x426405[_0xfe0f('0x32')]['key']};});_0x2ff8d6['model']=_[_0xfe0f('0x2e')](_0x2a3b33,_0xfe0f('0x2d'));_0x2ff8d6[_0xfe0f('0x33')]=_[_0xfe0f('0x34')](_0x2902d6['query']);_0x2ff8d6[_0xfe0f('0x35')]=_['intersection'](_0x2ff8d6['model'],_0x2ff8d6[_0xfe0f('0x33')]);_0x14af17[_0xfe0f('0x36')]=_[_0xfe0f('0x37')](_0x2ff8d6[_0xfe0f('0x38')],qs[_0xfe0f('0x39')](_0x2902d6[_0xfe0f('0x33')]['fields']));_0x14af17['attributes']=_0x14af17[_0xfe0f('0x36')][_0xfe0f('0x3a')]?_0x14af17[_0xfe0f('0x36')]:_0x2ff8d6['model'];if(!_0x2902d6['query'][_0xfe0f('0x3b')](_0xfe0f('0x3c'))){_0x14af17['limit']=qs[_0xfe0f('0x21')](_0x2902d6['query']['limit']);_0x14af17[_0xfe0f('0x1f')]=qs['offset'](_0x2902d6[_0xfe0f('0x33')][_0xfe0f('0x1f')]);}_0x14af17[_0xfe0f('0x3d')]=qs[_0xfe0f('0x3e')](_0x2902d6[_0xfe0f('0x33')]['sort']);_0x14af17['where']=qs[_0xfe0f('0x35')](_[_0xfe0f('0x3f')](_0x2902d6[_0xfe0f('0x33')],_0x2ff8d6[_0xfe0f('0x35')]),_0x2a3b33);if(_0x2902d6[_0xfe0f('0x33')][_0xfe0f('0x40')]){_0x14af17[_0xfe0f('0x41')]=_['merge'](_0x14af17[_0xfe0f('0x41')],{'$or':_[_0xfe0f('0x2e')](_0x2a3b33,function(_0x5dc671){if(_0x5dc671['type']!==_0xfe0f('0x42')){var _0x310b97={};_0x310b97[_0x5dc671[_0xfe0f('0x2d')]]={'$like':'%'+_0x2902d6['query']['filter']+'%'};return _0x310b97;}})});}_0x14af17=_[_0xfe0f('0x43')]({},_0x14af17,_0x2902d6['options']);var _0x465da1={'where':_0x14af17[_0xfe0f('0x41')]};return db[_0xfe0f('0x2f')][_0xfe0f('0x22')](_0x465da1)[_0xfe0f('0x27')](function(_0x41d262){_0x4193ab['count']=_0x41d262;if(_0x2902d6['query']['includeAll']){_0x14af17[_0xfe0f('0x44')]=[{'all':!![]}];}return db[_0xfe0f('0x2f')][_0xfe0f('0x45')](_0x14af17);})[_0xfe0f('0x27')](function(_0x343bef){_0x4193ab[_0xfe0f('0x46')]=_0x343bef;return _0x4193ab;})['then'](respondWithFilteredResult(_0x2de5f8,_0x14af17))[_0xfe0f('0x47')](handleError(_0x2de5f8,null));};exports['show']=function(_0x1dd41b,_0x27d680){var _0x4abd57={'raw':!![],'where':{'id':_0x1dd41b[_0xfe0f('0x48')]['id']}},_0x277a5f={};_0x277a5f[_0xfe0f('0x38')]=_['keys'](db[_0xfe0f('0x2f')]['rawAttributes']);_0x277a5f[_0xfe0f('0x33')]=_[_0xfe0f('0x34')](_0x1dd41b[_0xfe0f('0x33')]);_0x277a5f['filters']=_['intersection'](_0x277a5f['model'],_0x277a5f['query']);_0x4abd57[_0xfe0f('0x36')]=_['intersection'](_0x277a5f[_0xfe0f('0x38')],qs[_0xfe0f('0x39')](_0x1dd41b[_0xfe0f('0x33')][_0xfe0f('0x39')]));_0x4abd57['attributes']=_0x4abd57[_0xfe0f('0x36')][_0xfe0f('0x3a')]?_0x4abd57['attributes']:_0x277a5f[_0xfe0f('0x38')];if(_0x1dd41b['query']['includeAll']){_0x4abd57[_0xfe0f('0x44')]=[{'all':!![]}];}_0x4abd57=_['merge']({},_0x4abd57,_0x1dd41b[_0xfe0f('0x49')]);return db[_0xfe0f('0x2f')][_0xfe0f('0x4a')](_0x4abd57)['then'](handleEntityNotFound(_0x27d680,null))[_0xfe0f('0x27')](respondWithResult(_0x27d680,null))[_0xfe0f('0x47')](handleError(_0x27d680,null));};exports[_0xfe0f('0x4b')]=function(_0x18021c,_0x555ed2){return db[_0xfe0f('0x2f')][_0xfe0f('0x4b')](_0x18021c['body'],{})[_0xfe0f('0x27')](function(_0x50befb){var _0x4271a9=_0x18021c['user'][_0xfe0f('0x28')]({'plain':!![]});if(!_0x4271a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4271a9[_0xfe0f('0x4c')]===_0xfe0f('0x4d')){var _0x478f4b=_0x50befb[_0xfe0f('0x28')]({'plain':!![]});var _0x3b3c04=_0xfe0f('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x3b3c04,'userProfileId':_0x4271a9['userProfileId']},'raw':!![]})[_0xfe0f('0x27')](function(_0x8fd88a){if(_0x8fd88a&&_0x8fd88a['autoAssociation']===0x0){return db[_0xfe0f('0x4e')][_0xfe0f('0x4b')]({'name':_0x478f4b[_0xfe0f('0x2d')],'resourceId':_0x478f4b['id'],'type':_0x8fd88a['name'],'sectionId':_0x8fd88a['id']},{})[_0xfe0f('0x27')](function(){return _0x50befb;});}else{return _0x50befb;}})[_0xfe0f('0x47')](function(_0x21b29c){logger['error'](_0xfe0f('0x4f'),_0x21b29c);throw _0x21b29c;});}return _0x50befb;})['then'](respondWithResult(_0x555ed2,0xc9))[_0xfe0f('0x47')](handleError(_0x555ed2,null));};exports[_0xfe0f('0x26')]=function(_0x48feef,_0x437975){if(_0x48feef[_0xfe0f('0x50')]['id']){delete _0x48feef[_0xfe0f('0x50')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x48feef[_0xfe0f('0x48')]['id']}})[_0xfe0f('0x27')](handleEntityNotFound(_0x437975,null))[_0xfe0f('0x27')](saveUpdates(_0x48feef[_0xfe0f('0x50')],null))[_0xfe0f('0x27')](respondWithResult(_0x437975,null))[_0xfe0f('0x47')](handleError(_0x437975,null));};exports[_0xfe0f('0x2a')]=function(_0x123180,_0x359ef1){return db[_0xfe0f('0x2f')][_0xfe0f('0x4a')]({'where':{'id':_0x123180[_0xfe0f('0x48')]['id']}})[_0xfe0f('0x27')](handleEntityNotFound(_0x359ef1,null))[_0xfe0f('0x27')](removeEntity(_0x359ef1,null))[_0xfe0f('0x47')](handleError(_0x359ef1,null));};exports[_0xfe0f('0x51')]=function(_0x41e3ea,_0x4aa4fe,_0x76eb95){var _0x3720fd;return db[_0xfe0f('0x2f')][_0xfe0f('0x4a')]({'where':{'id':_0x41e3ea[_0xfe0f('0x48')]['id']},'attributes':['id',_0xfe0f('0x52')]})[_0xfe0f('0x27')](handleEntityNotFound(_0x4aa4fe,null))[_0xfe0f('0x27')](function(_0x382407){if(_0x382407){var _0x434bff=require(_0xfe0f('0x53'))();_0x434bff[_0xfe0f('0x54')](_0x382407[_0xfe0f('0x52')]);_0x434bff[_0xfe0f('0x55')]();return _0x382407;}})[_0xfe0f('0x27')](respondWithResult(_0x4aa4fe,null))[_0xfe0f('0x47')](handleError(_0x4aa4fe,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 06334a2..26e1a13 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 _0x3d9b=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','lodash'];(function(_0x1df2f5,_0x1f7f66){var _0x3850d8=function(_0x810a8e){while(--_0x810a8e){_0x1df2f5['push'](_0x1df2f5['shift']());}};_0x3850d8(++_0x1f7f66);}(_0x3d9b,0x1ee));var _0xb3d9=function(_0x2ba218,_0x504da8){_0x2ba218=_0x2ba218-0x0;var _0x4ef0df=_0x3d9b[_0x2ba218];return _0x4ef0df;};'use strict';var _=require(_0xb3d9('0x0'));var util=require('util');var logger=require(_0xb3d9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb3d9('0x2'));var rp=require(_0xb3d9('0x3'));var fs=require('fs');var path=require(_0xb3d9('0x4'));var rimraf=require(_0xb3d9('0x5'));var config=require(_0xb3d9('0x6'));var attributes=require(_0xb3d9('0x7'));module['exports']=function(_0x3caff1,_0x348993){return _0x3caff1[_0xb3d9('0x8')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45a4=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','SquareOdbc'];(function(_0xed7c70,_0x1e59ce){var _0x971ddb=function(_0x52f83e){while(--_0x52f83e){_0xed7c70['push'](_0xed7c70['shift']());}};_0x971ddb(++_0x1e59ce);}(_0x45a4,0xf3));var _0x445a=function(_0x2465f4,_0x250223){_0x2465f4=_0x2465f4-0x0;var _0x2c326d=_0x45a4[_0x2465f4];return _0x2c326d;};'use strict';var _=require(_0x445a('0x0'));var util=require(_0x445a('0x1'));var logger=require('../../config/logger')(_0x445a('0x2'));var moment=require(_0x445a('0x3'));var BPromise=require(_0x445a('0x4'));var rp=require(_0x445a('0x5'));var fs=require('fs');var path=require(_0x445a('0x6'));var rimraf=require('rimraf');var config=require(_0x445a('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x500e8e,_0x3d3626){return _0x500e8e['define'](_0x445a('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 85f55da..50f243e 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 _0x594b=['SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','include','map','model','attributes','debug','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code'];(function(_0x2b8816,_0x2c5dac){var _0x4da4a3=function(_0x28baac){while(--_0x28baac){_0x2b8816['push'](_0x2b8816['shift']());}};_0x4da4a3(++_0x2c5dac);}(_0x594b,0x79));var _0xb594=function(_0xc359dc,_0x2e48f3){_0xc359dc=_0xc359dc-0x0;var _0x2c94e3=_0x594b[_0xc359dc];return _0x2c94e3;};'use strict';var _=require('lodash');var util=require(_0xb594('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb594('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb594('0x2'))['db'];var utils=require(_0xb594('0x3'));var logger=require(_0xb594('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb594('0x5'));var client=jayson[_0xb594('0x6')][_0xb594('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1140fa,_0x580500,_0x3a6546){return new BPromise(function(_0x52a70f,_0x5a7ebf){return client['request'](_0x1140fa,_0x3a6546)[_0xb594('0x8')](function(_0x9bd155){logger[_0xb594('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x580500,_0xb594('0xa'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x580500,_0xb594('0xa'),JSON[_0xb594('0xb')](_0x9bd155));if(_0x9bd155[_0xb594('0xc')]){if(_0x9bd155[_0xb594('0xc')][_0xb594('0xd')]===0x1f4){logger['error'](_0xb594('0xe'),_0x580500,_0x9bd155['error']['message']);return _0x5a7ebf(_0x9bd155[_0xb594('0xc')][_0xb594('0xf')]);}logger['error'](_0xb594('0xe'),_0x580500,_0x9bd155[_0xb594('0xc')][_0xb594('0xf')]);return _0x52a70f(_0x9bd155[_0xb594('0xc')]['message']);}else{logger[_0xb594('0x9')](_0xb594('0xe'),_0x580500,_0xb594('0xa'));_0x52a70f(_0x9bd155[_0xb594('0x10')][_0xb594('0xf')]);}})[_0xb594('0x11')](function(_0xf7b7f8){logger['error'](_0xb594('0xe'),_0x580500,_0xf7b7f8);_0x5a7ebf(_0xf7b7f8);});});}exports[_0xb594('0x12')]=function(_0x492b75){var _0x437fcb=this;return new Promise(function(_0x3b6ec8,_0x391ccb){return db[_0xb594('0x13')]['find']({'raw':_0x492b75[_0xb594('0x14')]?_0x492b75[_0xb594('0x14')][_0xb594('0x15')]===undefined?!![]:![]:!![],'where':_0x492b75[_0xb594('0x14')]?_0x492b75['options']['where']||null:null,'attributes':_0x492b75['options']?_0x492b75[_0xb594('0x14')]['attributes']||null:null,'include':_0x492b75[_0xb594('0x14')]?_0x492b75[_0xb594('0x14')][_0xb594('0x16')]?_[_0xb594('0x17')](_0x492b75[_0xb594('0x14')][_0xb594('0x16')],function(_0x52b33f){return{'model':db[_0x52b33f[_0xb594('0x18')]],'as':_0x52b33f['as'],'attributes':_0x52b33f[_0xb594('0x19')],'include':_0x52b33f[_0xb594('0x16')]?_[_0xb594('0x17')](_0x52b33f['include'],function(_0xe94efb){return{'model':db[_0xe94efb['model']],'as':_0xe94efb['as'],'attributes':_0xe94efb[_0xb594('0x19')],'include':_0xe94efb['include']?_['map'](_0xe94efb[_0xb594('0x16')],function(_0x34583f){return{'model':db[_0x34583f[_0xb594('0x18')]],'as':_0x34583f['as'],'attributes':_0x34583f[_0xb594('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb594('0x8')](function(_0x1b7e7f){logger[_0xb594('0x9')](_0xb594('0x12'),_0x492b75);logger[_0xb594('0x1a')](_0xb594('0x12'),_0x492b75,JSON[_0xb594('0xb')](_0x1b7e7f));_0x3b6ec8(_0x1b7e7f);})[_0xb594('0x11')](function(_0x514839){logger[_0xb594('0xc')](_0xb594('0x12'),_0x514839['message'],_0x492b75);_0x391ccb(_0x437fcb[_0xb594('0xc')](0x1f4,_0x514839[_0xb594('0xf')]));});});}; \ No newline at end of file +var _0x59b5=['ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','SquareOdbc,\x20%s,\x20%s','message','result','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x59b5,0x9f));var _0x559b=function(_0x305f96,_0x17dc65){_0x305f96=_0x305f96-0x0;var _0x4ca5ee=_0x59b5[_0x305f96];return _0x4ca5ee;};'use strict';var _=require(_0x559b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x559b('0x1'));var rs=require(_0x559b('0x2'));var fs=require('fs');var Redis=require(_0x559b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x559b('0x4'))(_0x559b('0x5'));var config=require(_0x559b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x559b('0x7')][_0x559b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc68f98,_0x36449a,_0xd10f21){return new BPromise(function(_0x5232f4,_0x157545){return client[_0x559b('0x9')](_0xc68f98,_0xd10f21)[_0x559b('0xa')](function(_0x5b5c25){logger[_0x559b('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x36449a,_0x559b('0xc'));logger[_0x559b('0xd')](_0x559b('0xe'),_0x36449a,_0x559b('0xc'),JSON[_0x559b('0xf')](_0x5b5c25));if(_0x5b5c25[_0x559b('0x10')]){if(_0x5b5c25[_0x559b('0x10')]['code']===0x1f4){logger[_0x559b('0x10')](_0x559b('0x11'),_0x36449a,_0x5b5c25[_0x559b('0x10')][_0x559b('0x12')]);return _0x157545(_0x5b5c25[_0x559b('0x10')]['message']);}logger[_0x559b('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x36449a,_0x5b5c25[_0x559b('0x10')]['message']);return _0x5232f4(_0x5b5c25['error'][_0x559b('0x12')]);}else{logger[_0x559b('0xb')](_0x559b('0x11'),_0x36449a,_0x559b('0xc'));_0x5232f4(_0x5b5c25[_0x559b('0x13')][_0x559b('0x12')]);}})[_0x559b('0x14')](function(_0x4e099f){logger[_0x559b('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x36449a,_0x4e099f);_0x157545(_0x4e099f);});});}exports[_0x559b('0x15')]=function(_0xd907c){var _0x169858=this;return new Promise(function(_0x1dc1a0,_0x4ca9f0){return db[_0x559b('0x16')]['find']({'raw':_0xd907c[_0x559b('0x17')]?_0xd907c[_0x559b('0x17')][_0x559b('0x18')]===undefined?!![]:![]:!![],'where':_0xd907c[_0x559b('0x17')]?_0xd907c[_0x559b('0x17')][_0x559b('0x19')]||null:null,'attributes':_0xd907c['options']?_0xd907c[_0x559b('0x17')][_0x559b('0x1a')]||null:null,'include':_0xd907c[_0x559b('0x17')]?_0xd907c['options'][_0x559b('0x1b')]?_[_0x559b('0x1c')](_0xd907c[_0x559b('0x17')][_0x559b('0x1b')],function(_0x3eb5fc){return{'model':db[_0x3eb5fc[_0x559b('0x1d')]],'as':_0x3eb5fc['as'],'attributes':_0x3eb5fc[_0x559b('0x1a')],'include':_0x3eb5fc[_0x559b('0x1b')]?_[_0x559b('0x1c')](_0x3eb5fc[_0x559b('0x1b')],function(_0x7c4fec){return{'model':db[_0x7c4fec[_0x559b('0x1d')]],'as':_0x7c4fec['as'],'attributes':_0x7c4fec['attributes'],'include':_0x7c4fec[_0x559b('0x1b')]?_[_0x559b('0x1c')](_0x7c4fec[_0x559b('0x1b')],function(_0x447dea){return{'model':db[_0x447dea[_0x559b('0x1d')]],'as':_0x447dea['as'],'attributes':_0x447dea[_0x559b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x559b('0xa')](function(_0x4d3778){logger[_0x559b('0xb')]('ShowSquareOdbc',_0xd907c);logger['debug'](_0x559b('0x15'),_0xd907c,JSON[_0x559b('0xf')](_0x4d3778));_0x1dc1a0(_0x4d3778);})['catch'](function(_0x634682){logger[_0x559b('0x10')](_0x559b('0x15'),_0x634682[_0x559b('0x12')],_0xd907c);_0x4ca9f0(_0x169858['error'](0x1f4,_0x634682[_0x559b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d667398..38e3036 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 _0xab6a=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id'];(function(_0x264bb5,_0x106b82){var _0x519516=function(_0xe1341f){while(--_0xe1341f){_0x264bb5['push'](_0x264bb5['shift']());}};_0x519516(++_0x106b82);}(_0xab6a,0x1ab));var _0xaab6=function(_0x22e3ec,_0x45c741){_0x22e3ec=_0x22e3ec-0x0;var _0xad2ecf=_0xab6a[_0x22e3ec];return _0xad2ecf;};'use strict';var multer=require(_0xaab6('0x0'));var util=require(_0xaab6('0x1'));var path=require('path');var timeout=require(_0xaab6('0x2'));var express=require(_0xaab6('0x3'));var router=express[_0xaab6('0x4')]();var fs_extra=require(_0xaab6('0x5'));var auth=require(_0xaab6('0x6'));var interaction=require(_0xaab6('0x7'));var config=require(_0xaab6('0x8'));var controller=require(_0xaab6('0x9'));router[_0xaab6('0xa')]('/',auth[_0xaab6('0xb')](),controller['index']);router[_0xaab6('0xa')](_0xaab6('0xc'),auth[_0xaab6('0xb')](),controller[_0xaab6('0xd')]);router[_0xaab6('0xe')]('/',auth[_0xaab6('0xb')](),controller[_0xaab6('0xf')]);router[_0xaab6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaab6('0x11')]);router[_0xaab6('0x12')](_0xaab6('0xc'),auth[_0xaab6('0xb')](),controller[_0xaab6('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5484=['index','/:id','show','isAuthenticated','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5484,0x1a0));var _0x4548=function(_0x42f143,_0x344195){_0x42f143=_0x42f143-0x0;var _0x2c0c30=_0x5484[_0x42f143];return _0x2c0c30;};'use strict';var multer=require(_0x4548('0x0'));var util=require(_0x4548('0x1'));var path=require(_0x4548('0x2'));var timeout=require(_0x4548('0x3'));var express=require(_0x4548('0x4'));var router=express[_0x4548('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4548('0x6'));var interaction=require(_0x4548('0x7'));var config=require('../../config/environment');var controller=require(_0x4548('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4548('0x9')]);router['get'](_0x4548('0xa'),auth['isAuthenticated'](),controller[_0x4548('0xb')]);router['post']('/',auth[_0x4548('0xc')](),controller[_0x4548('0xd')]);router[_0x4548('0xe')](_0x4548('0xa'),auth[_0x4548('0xc')](),controller[_0x4548('0xf')]);router['delete'](_0x4548('0xa'),auth['isAuthenticated'](),controller[_0x4548('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4a3caad..9906788 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 _0x5f14=['utf8','getDataValue','production','toString','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction'];(function(_0x397019,_0x3bdb46){var _0x53a935=function(_0x43e19c){while(--_0x43e19c){_0x397019['push'](_0x397019['shift']());}};_0x53a935(++_0x3bdb46);}(_0x5f14,0x157));var _0x45f1=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x5f14[_0x2ba740];return _0x358bda;};'use strict';var Sequelize=require(_0x45f1('0x0'));module[_0x45f1('0x1')]={'name':{'type':Sequelize[_0x45f1('0x2')],'unique':_0x45f1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x45f1('0x2')]},'notes':{'type':Sequelize[_0x45f1('0x4')]},'preproduction':{'type':Sequelize[_0x45f1('0x5')](_0x45f1('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0x45f1('0x7'))['toString'](_0x45f1('0x8'));}}},'production':{'type':Sequelize[_0x45f1('0x5')]('long'),'get':function(){if(this[_0x45f1('0x9')]('production')){return this[_0x45f1('0x9')](_0x45f1('0xa'))[_0x45f1('0xb')](_0x45f1('0x8'));}}},'savedAt':{'type':Sequelize[_0x45f1('0xc')]},'publishedAt':{'type':Sequelize[_0x45f1('0xc')]}}; \ No newline at end of file +var _0x858c=['BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','sequelize','STRING','TEXT'];(function(_0x4ad734,_0x2c4f94){var _0xb8b812=function(_0x41a438){while(--_0x41a438){_0x4ad734['push'](_0x4ad734['shift']());}};_0xb8b812(++_0x2c4f94);}(_0x858c,0x17e));var _0xc858=function(_0x2cbca6,_0x261d37){_0x2cbca6=_0x2cbca6-0x0;var _0x2be35e=_0x858c[_0x2cbca6];return _0x2be35e;};'use strict';var Sequelize=require(_0xc858('0x0'));module['exports']={'name':{'type':Sequelize[_0xc858('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xc858('0x2')]},'preproduction':{'type':Sequelize[_0xc858('0x3')]('long'),'get':function(){if(this[_0xc858('0x4')]('preproduction')){return this['getDataValue'](_0xc858('0x5'))[_0xc858('0x6')](_0xc858('0x7'));}}},'production':{'type':Sequelize[_0xc858('0x3')](_0xc858('0x8')),'get':function(){if(this[_0xc858('0x4')](_0xc858('0x9'))){return this[_0xc858('0x4')](_0xc858('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xc858('0xa')]},'publishedAt':{'type':Sequelize[_0xc858('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2f097c5..af6a05b 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 _0x325b=['redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','then','destroy','SquareProjects','UserProfileResource','publish','agi','error','stack','name','index','SquareProject','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','params','rawAttributes','keys','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','production','ioredis','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x325b,0xc5));var _0xb325=function(_0x3f3e79,_0x4a07c5){_0x3f3e79=_0x3f3e79-0x0;var _0x3106de=_0x325b[_0x3f3e79];return _0x3106de;};'use strict';var _=require('lodash');var Redis=require(_0xb325('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xb325('0x1'))('api');var config=require(_0xb325('0x2'));var db=require(_0xb325('0x3'))['db'];config[_0xb325('0x4')]=_[_0xb325('0x5')](config[_0xb325('0x4')],{'host':_0xb325('0x6'),'port':0x18eb});var socket=require(_0xb325('0x7'))(new Redis(config[_0xb325('0x4')]));require(_0xb325('0x8'))[_0xb325('0x9')](socket);function respondWithResult(_0x14712b,_0x595577){_0x595577=_0x595577||0xc8;return function(_0x33a092){if(_0x33a092){return _0x14712b[_0xb325('0xa')](_0x595577)[_0xb325('0xb')](_0x33a092);}};}function respondWithFilteredResult(_0x3cc56c,_0x2aafb5){return function(_0x44dba6){if(_0x44dba6){var _0x235bc3=typeof _0x2aafb5[_0xb325('0xc')]===_0xb325('0xd')&&typeof _0x2aafb5[_0xb325('0xe')]===_0xb325('0xd');var _0x3c5435=_0x44dba6[_0xb325('0xf')];var _0x154b01=_0x235bc3?0x0:_0x2aafb5[_0xb325('0xc')];var _0x30bb2d=_0x235bc3?_0x44dba6[_0xb325('0xf')]:_0x2aafb5[_0xb325('0xc')]+_0x2aafb5['limit'];var _0x3d66ff;if(_0x30bb2d>=_0x3c5435){_0x30bb2d=_0x3c5435;_0x3d66ff=0xc8;}else{_0x3d66ff=0xce;}_0x3cc56c[_0xb325('0xa')](_0x3d66ff);return _0x3cc56c['set']('Content-Range',_0x154b01+'-'+_0x30bb2d+'/'+_0x3c5435)[_0xb325('0xb')](_0x44dba6);}return null;};}function saveUpdates(_0x3738d6){return function(_0x4f4110){if(_0x4f4110){return _0x4f4110['update'](_0x3738d6)[_0xb325('0x10')](function(_0x433e60){return _0x433e60;});}return null;};}function removeEntity(_0x1f33c6){return function(_0x2cc859){if(_0x2cc859){return _0x2cc859[_0xb325('0x11')]()[_0xb325('0x10')](function(){var _0x1a4574=_0x2cc859['get']({'plain':!![]});var _0x39e378=_0xb325('0x12');return db[_0xb325('0x13')][_0xb325('0x11')]({'where':{'type':_0x39e378,'resourceId':_0x1a4574['id']}})[_0xb325('0x10')](function(){return _0x2cc859;});})[_0xb325('0x10')](function(){var _0x279092=new Redis(config[_0xb325('0x4')]);_0x279092[_0xb325('0x14')](_0xb325('0x15'),JSON['stringify']({'id':_0x2cc859['id'],'deleted':!![]}));})[_0xb325('0x10')](function(){_0x1f33c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe23e58){return function(_0x506a9f){if(!_0x506a9f){_0xe23e58['sendStatus'](0x194);}return _0x506a9f;};}function handleError(_0x2a0834,_0x3310b0){_0x3310b0=_0x3310b0||0x1f4;return function(_0x122220){logger[_0xb325('0x16')](_0x122220[_0xb325('0x17')]);if(_0x122220[_0xb325('0x18')]){delete _0x122220['name'];}_0x2a0834[_0xb325('0xa')](_0x3310b0)['send'](_0x122220);};}exports[_0xb325('0x19')]=function(_0x38f8dc,_0x2469c5){var _0x324ff0={},_0x321f1e={},_0x4dd761={'count':0x0,'rows':[]};var _0xf38217=_['map'](db[_0xb325('0x1a')]['rawAttributes'],function(_0x171a82){return{'name':_0x171a82[_0xb325('0x1b')],'type':_0x171a82[_0xb325('0x1c')][_0xb325('0x1d')]};});_0x321f1e[_0xb325('0x1e')]=_[_0xb325('0x1f')](_0xf38217,_0xb325('0x18'));_0x321f1e['query']=_['keys'](_0x38f8dc[_0xb325('0x20')]);_0x321f1e[_0xb325('0x21')]=_[_0xb325('0x22')](_0x321f1e[_0xb325('0x1e')],_0x321f1e[_0xb325('0x20')]);_0x324ff0[_0xb325('0x23')]=_[_0xb325('0x22')](_0x321f1e['model'],qs[_0xb325('0x24')](_0x38f8dc['query'][_0xb325('0x24')]));_0x324ff0[_0xb325('0x23')]=_0x324ff0['attributes']['length']?_0x324ff0[_0xb325('0x23')]:_0x321f1e[_0xb325('0x1e')];if(!_0x38f8dc[_0xb325('0x20')][_0xb325('0x25')]('nolimit')){_0x324ff0['limit']=qs['limit'](_0x38f8dc[_0xb325('0x20')]['limit']);_0x324ff0[_0xb325('0xc')]=qs[_0xb325('0xc')](_0x38f8dc['query']['offset']);}_0x324ff0[_0xb325('0x26')]=qs[_0xb325('0x27')](_0x38f8dc[_0xb325('0x20')][_0xb325('0x27')]);_0x324ff0['where']=qs[_0xb325('0x21')](_[_0xb325('0x28')](_0x38f8dc[_0xb325('0x20')],_0x321f1e[_0xb325('0x21')]),_0xf38217);if(_0x38f8dc['query'][_0xb325('0x29')]){_0x324ff0[_0xb325('0x2a')]=_[_0xb325('0x2b')](_0x324ff0[_0xb325('0x2a')],{'$or':_[_0xb325('0x1f')](_0xf38217,function(_0x27582e){if(_0x27582e[_0xb325('0x1c')]!==_0xb325('0x2c')){var _0x4a09c8={};_0x4a09c8[_0x27582e[_0xb325('0x18')]]={'$like':'%'+_0x38f8dc[_0xb325('0x20')][_0xb325('0x29')]+'%'};return _0x4a09c8;}})});}_0x324ff0=_[_0xb325('0x2b')]({},_0x324ff0,_0x38f8dc[_0xb325('0x2d')]);var _0x26f310={'where':_0x324ff0[_0xb325('0x2a')]};return db[_0xb325('0x1a')][_0xb325('0xf')](_0x26f310)[_0xb325('0x10')](function(_0x7fd6e6){_0x4dd761[_0xb325('0xf')]=_0x7fd6e6;if(_0x38f8dc['query']['includeAll']){_0x324ff0[_0xb325('0x2e')]=[{'all':!![]}];}return db[_0xb325('0x1a')]['findAll'](_0x324ff0);})[_0xb325('0x10')](function(_0x3685f8){_0x4dd761[_0xb325('0x2f')]=_0x3685f8;return _0x4dd761;})[_0xb325('0x10')](respondWithFilteredResult(_0x2469c5,_0x324ff0))['catch'](handleError(_0x2469c5,null));};exports[_0xb325('0x30')]=function(_0x215572,_0x79c3a){var _0x42a33e={'raw':![],'where':{'id':_0x215572[_0xb325('0x31')]['id']}},_0x28a925={};_0x28a925[_0xb325('0x1e')]=_['keys'](db[_0xb325('0x1a')][_0xb325('0x32')]);_0x28a925[_0xb325('0x20')]=_[_0xb325('0x33')](_0x215572['query']);_0x28a925['filters']=_[_0xb325('0x22')](_0x28a925[_0xb325('0x1e')],_0x28a925['query']);_0x42a33e['attributes']=_[_0xb325('0x22')](_0x28a925[_0xb325('0x1e')],qs[_0xb325('0x24')](_0x215572[_0xb325('0x20')]['fields']));_0x42a33e['attributes']=_0x42a33e[_0xb325('0x23')][_0xb325('0x34')]?_0x42a33e[_0xb325('0x23')]:_0x28a925[_0xb325('0x1e')];if(_0x215572[_0xb325('0x20')]['includeAll']){_0x42a33e[_0xb325('0x2e')]=[{'all':!![]}];}_0x42a33e=_[_0xb325('0x2b')]({},_0x42a33e,_0x215572[_0xb325('0x2d')]);return db[_0xb325('0x1a')][_0xb325('0x35')](_0x42a33e)[_0xb325('0x10')](handleEntityNotFound(_0x79c3a,null))[_0xb325('0x10')](respondWithResult(_0x79c3a,null))[_0xb325('0x36')](handleError(_0x79c3a,null));};exports[_0xb325('0x37')]=function(_0x22bbee,_0x558d64){return db[_0xb325('0x1a')][_0xb325('0x37')](_0x22bbee[_0xb325('0x38')],{})[_0xb325('0x10')](function(_0x31fc97){var _0x3eb9cc=_0x22bbee[_0xb325('0x39')][_0xb325('0x3a')]({'plain':!![]});if(!_0x3eb9cc)throw new Error(_0xb325('0x3b'));if(_0x3eb9cc[_0xb325('0x3c')]==='user'){var _0x343707=_0x31fc97['get']({'plain':!![]});var _0x24528a=_0xb325('0x12');return db[_0xb325('0x3d')][_0xb325('0x35')]({'where':{'name':_0x24528a,'userProfileId':_0x3eb9cc[_0xb325('0x3e')]},'raw':!![]})['then'](function(_0x34063f){if(_0x34063f&&_0x34063f[_0xb325('0x3f')]===0x0){return db[_0xb325('0x13')][_0xb325('0x37')]({'name':_0x343707[_0xb325('0x18')],'resourceId':_0x343707['id'],'type':_0x34063f[_0xb325('0x18')],'sectionId':_0x34063f['id']},{})[_0xb325('0x10')](function(){return _0x31fc97;});}else{return _0x31fc97;}})[_0xb325('0x36')](function(_0x5e1e36){logger[_0xb325('0x16')](_0xb325('0x40'),_0x5e1e36);throw _0x5e1e36;});}return _0x31fc97;})['then'](respondWithResult(_0x558d64,0xc9))[_0xb325('0x36')](handleError(_0x558d64,null));};exports[_0xb325('0x41')]=function(_0x267721,_0x5dc2fe){if(_0x267721[_0xb325('0x38')]['id']){delete _0x267721[_0xb325('0x38')]['id'];}return db[_0xb325('0x1a')][_0xb325('0x35')]({'where':{'id':_0x267721[_0xb325('0x31')]['id']}})[_0xb325('0x10')](handleEntityNotFound(_0x5dc2fe,null))[_0xb325('0x10')](saveUpdates(_0x267721[_0xb325('0x38')],null))[_0xb325('0x10')](function(_0x568cc4){if(!_0x568cc4)return;var _0x5e4b5d=_0x568cc4[_0xb325('0x3a')]({'plain':!![]});return _0x5e4b5d;})[_0xb325('0x10')](function(_0x145098){var _0x2a381c=new Redis(config[_0xb325('0x4')]);_0x2a381c[_0xb325('0x14')]('agi',JSON['stringify'](_[_0xb325('0x28')](_0x145098,['id',_0xb325('0x18'),_0xb325('0x42')])));return _0x145098;})[_0xb325('0x10')](respondWithResult(_0x5dc2fe,null))['catch'](handleError(_0x5dc2fe,null));};exports[_0xb325('0x11')]=function(_0x5e2507,_0x387d35){return db['SquareProject']['find']({'where':{'id':_0x5e2507[_0xb325('0x31')]['id']}})[_0xb325('0x10')](handleEntityNotFound(_0x387d35,null))[_0xb325('0x10')](removeEntity(_0x387d35,null))['catch'](handleError(_0x387d35,null));}; \ No newline at end of file +var _0xa9c6=['get','SquareProjects','UserProfileResource','publish','stringify','end','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','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','update','agi','lodash','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','json','offset','undefined','count','limit','Content-Range','then','destroy'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xa9c6,0x7b));var _0x6a9c=function(_0x15f306,_0x4b7328){_0x15f306=_0x15f306-0x0;var _0x2138bb=_0xa9c6[_0x15f306];return _0x2138bb;};'use strict';var _=require(_0x6a9c('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x6a9c('0x1'))(_0x6a9c('0x2'));var config=require('../../config/environment');var db=require(_0x6a9c('0x3'))['db'];config['redis']=_[_0x6a9c('0x4')](config[_0x6a9c('0x5')],{'host':_0x6a9c('0x6'),'port':0x18eb});var socket=require(_0x6a9c('0x7'))(new Redis(config[_0x6a9c('0x5')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x143762,_0x2dba05){_0x2dba05=_0x2dba05||0xc8;return function(_0x1b543a){if(_0x1b543a){return _0x143762[_0x6a9c('0x8')](_0x2dba05)[_0x6a9c('0x9')](_0x1b543a);}};}function respondWithFilteredResult(_0x20869f,_0x31cc27){return function(_0x27567c){if(_0x27567c){var _0x3f318b=typeof _0x31cc27[_0x6a9c('0xa')]===_0x6a9c('0xb')&&typeof _0x31cc27['limit']===_0x6a9c('0xb');var _0x9b18b9=_0x27567c[_0x6a9c('0xc')];var _0x305ee1=_0x3f318b?0x0:_0x31cc27[_0x6a9c('0xa')];var _0x240cd6=_0x3f318b?_0x27567c[_0x6a9c('0xc')]:_0x31cc27[_0x6a9c('0xa')]+_0x31cc27[_0x6a9c('0xd')];var _0x88c1e4;if(_0x240cd6>=_0x9b18b9){_0x240cd6=_0x9b18b9;_0x88c1e4=0xc8;}else{_0x88c1e4=0xce;}_0x20869f[_0x6a9c('0x8')](_0x88c1e4);return _0x20869f['set'](_0x6a9c('0xe'),_0x305ee1+'-'+_0x240cd6+'/'+_0x9b18b9)[_0x6a9c('0x9')](_0x27567c);}return null;};}function saveUpdates(_0x5539d0){return function(_0x1ab323){if(_0x1ab323){return _0x1ab323['update'](_0x5539d0)[_0x6a9c('0xf')](function(_0x9b336a){return _0x9b336a;});}return null;};}function removeEntity(_0x1f5714){return function(_0x1fa05e){if(_0x1fa05e){return _0x1fa05e[_0x6a9c('0x10')]()[_0x6a9c('0xf')](function(){var _0x569e26=_0x1fa05e[_0x6a9c('0x11')]({'plain':!![]});var _0x4fb569=_0x6a9c('0x12');return db[_0x6a9c('0x13')][_0x6a9c('0x10')]({'where':{'type':_0x4fb569,'resourceId':_0x569e26['id']}})['then'](function(){return _0x1fa05e;});})['then'](function(){var _0x2e9bf7=new Redis(config[_0x6a9c('0x5')]);_0x2e9bf7[_0x6a9c('0x14')]('agi',JSON[_0x6a9c('0x15')]({'id':_0x1fa05e['id'],'deleted':!![]}));})['then'](function(){_0x1f5714[_0x6a9c('0x8')](0xcc)[_0x6a9c('0x16')]();});}};}function handleEntityNotFound(_0x2e6b){return function(_0x33be54){if(!_0x33be54){_0x2e6b['sendStatus'](0x194);}return _0x33be54;};}function handleError(_0x2cabe2,_0x2f7f44){_0x2f7f44=_0x2f7f44||0x1f4;return function(_0x48b651){logger[_0x6a9c('0x17')](_0x48b651[_0x6a9c('0x18')]);if(_0x48b651[_0x6a9c('0x19')]){delete _0x48b651['name'];}_0x2cabe2['status'](_0x2f7f44)[_0x6a9c('0x1a')](_0x48b651);};}exports[_0x6a9c('0x1b')]=function(_0x4886de,_0x4643ed){var _0x3863ba={},_0x1d4483={},_0x4b6f30={'count':0x0,'rows':[]};var _0x2117ad=_[_0x6a9c('0x1c')](db[_0x6a9c('0x1d')][_0x6a9c('0x1e')],function(_0x1eaea3){return{'name':_0x1eaea3[_0x6a9c('0x1f')],'type':_0x1eaea3[_0x6a9c('0x20')]['key']};});_0x1d4483[_0x6a9c('0x21')]=_[_0x6a9c('0x1c')](_0x2117ad,_0x6a9c('0x19'));_0x1d4483[_0x6a9c('0x22')]=_[_0x6a9c('0x23')](_0x4886de[_0x6a9c('0x22')]);_0x1d4483[_0x6a9c('0x24')]=_[_0x6a9c('0x25')](_0x1d4483[_0x6a9c('0x21')],_0x1d4483[_0x6a9c('0x22')]);_0x3863ba[_0x6a9c('0x26')]=_[_0x6a9c('0x25')](_0x1d4483[_0x6a9c('0x21')],qs[_0x6a9c('0x27')](_0x4886de[_0x6a9c('0x22')][_0x6a9c('0x27')]));_0x3863ba[_0x6a9c('0x26')]=_0x3863ba[_0x6a9c('0x26')][_0x6a9c('0x28')]?_0x3863ba[_0x6a9c('0x26')]:_0x1d4483[_0x6a9c('0x21')];if(!_0x4886de[_0x6a9c('0x22')][_0x6a9c('0x29')](_0x6a9c('0x2a'))){_0x3863ba[_0x6a9c('0xd')]=qs[_0x6a9c('0xd')](_0x4886de[_0x6a9c('0x22')][_0x6a9c('0xd')]);_0x3863ba[_0x6a9c('0xa')]=qs[_0x6a9c('0xa')](_0x4886de[_0x6a9c('0x22')]['offset']);}_0x3863ba[_0x6a9c('0x2b')]=qs[_0x6a9c('0x2c')](_0x4886de[_0x6a9c('0x22')]['sort']);_0x3863ba[_0x6a9c('0x2d')]=qs['filters'](_[_0x6a9c('0x2e')](_0x4886de[_0x6a9c('0x22')],_0x1d4483[_0x6a9c('0x24')]),_0x2117ad);if(_0x4886de[_0x6a9c('0x22')][_0x6a9c('0x2f')]){_0x3863ba[_0x6a9c('0x2d')]=_[_0x6a9c('0x30')](_0x3863ba[_0x6a9c('0x2d')],{'$or':_[_0x6a9c('0x1c')](_0x2117ad,function(_0x56a31e){if(_0x56a31e[_0x6a9c('0x20')]!==_0x6a9c('0x31')){var _0x5e1791={};_0x5e1791[_0x56a31e[_0x6a9c('0x19')]]={'$like':'%'+_0x4886de['query'][_0x6a9c('0x2f')]+'%'};return _0x5e1791;}})});}_0x3863ba=_[_0x6a9c('0x30')]({},_0x3863ba,_0x4886de[_0x6a9c('0x32')]);var _0x34314a={'where':_0x3863ba[_0x6a9c('0x2d')]};return db[_0x6a9c('0x1d')][_0x6a9c('0xc')](_0x34314a)['then'](function(_0x49a635){_0x4b6f30['count']=_0x49a635;if(_0x4886de[_0x6a9c('0x22')][_0x6a9c('0x33')]){_0x3863ba['include']=[{'all':!![]}];}return db[_0x6a9c('0x1d')][_0x6a9c('0x34')](_0x3863ba);})[_0x6a9c('0xf')](function(_0x462ab4){_0x4b6f30[_0x6a9c('0x35')]=_0x462ab4;return _0x4b6f30;})[_0x6a9c('0xf')](respondWithFilteredResult(_0x4643ed,_0x3863ba))[_0x6a9c('0x36')](handleError(_0x4643ed,null));};exports[_0x6a9c('0x37')]=function(_0x3a9783,_0x291c8e){var _0x390559={'raw':![],'where':{'id':_0x3a9783[_0x6a9c('0x38')]['id']}},_0x374b1d={};_0x374b1d[_0x6a9c('0x21')]=_[_0x6a9c('0x23')](db['SquareProject']['rawAttributes']);_0x374b1d[_0x6a9c('0x22')]=_[_0x6a9c('0x23')](_0x3a9783['query']);_0x374b1d[_0x6a9c('0x24')]=_[_0x6a9c('0x25')](_0x374b1d['model'],_0x374b1d['query']);_0x390559[_0x6a9c('0x26')]=_[_0x6a9c('0x25')](_0x374b1d[_0x6a9c('0x21')],qs[_0x6a9c('0x27')](_0x3a9783[_0x6a9c('0x22')][_0x6a9c('0x27')]));_0x390559[_0x6a9c('0x26')]=_0x390559[_0x6a9c('0x26')][_0x6a9c('0x28')]?_0x390559['attributes']:_0x374b1d[_0x6a9c('0x21')];if(_0x3a9783[_0x6a9c('0x22')][_0x6a9c('0x33')]){_0x390559[_0x6a9c('0x39')]=[{'all':!![]}];}_0x390559=_[_0x6a9c('0x30')]({},_0x390559,_0x3a9783[_0x6a9c('0x32')]);return db[_0x6a9c('0x1d')][_0x6a9c('0x3a')](_0x390559)['then'](handleEntityNotFound(_0x291c8e,null))[_0x6a9c('0xf')](respondWithResult(_0x291c8e,null))[_0x6a9c('0x36')](handleError(_0x291c8e,null));};exports['create']=function(_0x21f20f,_0x37768d){return db[_0x6a9c('0x1d')][_0x6a9c('0x3b')](_0x21f20f[_0x6a9c('0x3c')],{})[_0x6a9c('0xf')](function(_0x59246b){var _0xb1b9da=_0x21f20f[_0x6a9c('0x3d')][_0x6a9c('0x11')]({'plain':!![]});if(!_0xb1b9da)throw new Error(_0x6a9c('0x3e'));if(_0xb1b9da[_0x6a9c('0x3f')]==='user'){var _0x233376=_0x59246b[_0x6a9c('0x11')]({'plain':!![]});var _0x47f78e='SquareProjects';return db[_0x6a9c('0x40')][_0x6a9c('0x3a')]({'where':{'name':_0x47f78e,'userProfileId':_0xb1b9da[_0x6a9c('0x41')]},'raw':!![]})[_0x6a9c('0xf')](function(_0x4fbc3c){if(_0x4fbc3c&&_0x4fbc3c[_0x6a9c('0x42')]===0x0){return db['UserProfileResource']['create']({'name':_0x233376[_0x6a9c('0x19')],'resourceId':_0x233376['id'],'type':_0x4fbc3c[_0x6a9c('0x19')],'sectionId':_0x4fbc3c['id']},{})[_0x6a9c('0xf')](function(){return _0x59246b;});}else{return _0x59246b;}})['catch'](function(_0x551d1d){logger[_0x6a9c('0x17')](_0x6a9c('0x43'),_0x551d1d);throw _0x551d1d;});}return _0x59246b;})[_0x6a9c('0xf')](respondWithResult(_0x37768d,0xc9))[_0x6a9c('0x36')](handleError(_0x37768d,null));};exports[_0x6a9c('0x44')]=function(_0x39f3e0,_0x362dc6){if(_0x39f3e0[_0x6a9c('0x3c')]['id']){delete _0x39f3e0[_0x6a9c('0x3c')]['id'];}return db[_0x6a9c('0x1d')][_0x6a9c('0x3a')]({'where':{'id':_0x39f3e0[_0x6a9c('0x38')]['id']}})[_0x6a9c('0xf')](handleEntityNotFound(_0x362dc6,null))[_0x6a9c('0xf')](saveUpdates(_0x39f3e0[_0x6a9c('0x3c')],null))[_0x6a9c('0xf')](function(_0x1f9011){if(!_0x1f9011)return;var _0x442659=_0x1f9011[_0x6a9c('0x11')]({'plain':!![]});return _0x442659;})[_0x6a9c('0xf')](function(_0x262fd6){var _0x3e8c05=new Redis(config['redis']);_0x3e8c05['publish'](_0x6a9c('0x45'),JSON[_0x6a9c('0x15')](_[_0x6a9c('0x2e')](_0x262fd6,['id','name','production'])));return _0x262fd6;})[_0x6a9c('0xf')](respondWithResult(_0x362dc6,null))['catch'](handleError(_0x362dc6,null));};exports[_0x6a9c('0x10')]=function(_0x32f1fc,_0x429de2){return db[_0x6a9c('0x1d')]['find']({'where':{'id':_0x32f1fc['params']['id']}})['then'](handleEntityNotFound(_0x429de2,null))['then'](removeEntity(_0x429de2,null))[_0x6a9c('0x36')](handleError(_0x429de2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fe84df2..2edb4b8 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 _0x72b3=['exports','events','SquareProject','setMaxListeners','update','remove','emit','hook'];(function(_0x2055cf,_0x3b4900){var _0x4293b7=function(_0x23b50f){while(--_0x23b50f){_0x2055cf['push'](_0x2055cf['shift']());}};_0x4293b7(++_0x3b4900);}(_0x72b3,0x1c1));var _0x372b=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x72b3[_0x4c6d6f];return _0x2d4478;};'use strict';var EventEmitter=require(_0x372b('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x372b('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x372b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x372b('0x3'),'afterDestroy':_0x372b('0x4')};function emitEvent(_0x216112){return function(_0x7d6820,_0x3653a2,_0x5e4a99){SquareProjectEvents[_0x372b('0x5')](_0x216112+':'+_0x7d6820['id'],_0x7d6820);SquareProjectEvents[_0x372b('0x5')](_0x216112,_0x7d6820);_0x5e4a99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x372b('0x6')](e,emitEvent(event));}}module[_0x372b('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x16f3=['update','emit','hasOwnProperty','hook','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x14a3cf,_0xae014f){var _0x5bcffb=function(_0x45fdad){while(--_0x45fdad){_0x14a3cf['push'](_0x14a3cf['shift']());}};_0x5bcffb(++_0xae014f);}(_0x16f3,0x11c));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x316f('0x0'))['db'][_0x316f('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x316f('0x2')](0x0);var events={'afterCreate':_0x316f('0x3'),'afterUpdate':_0x316f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53e0a8){return function(_0x3fc53a,_0x79d090,_0x2ab352){SquareProjectEvents['emit'](_0x53e0a8+':'+_0x3fc53a['id'],_0x3fc53a);SquareProjectEvents[_0x316f('0x5')](_0x53e0a8,_0x3fc53a);_0x2ab352(null);};}for(var e in events){if(events[_0x316f('0x6')](e)){var event=events[e];SquareProject[_0x316f('0x7')](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 03ae3bf..4526e5b 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 _0x4bba=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2b9969,_0x2bb700){var _0x18e493=function(_0x5ae29c){while(--_0x5ae29c){_0x2b9969['push'](_0x2b9969['shift']());}};_0x18e493(++_0x2bb700);}(_0x4bba,0x131));var _0xa4bb=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4bba[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xa4bb('0x0'));var util=require(_0xa4bb('0x1'));var logger=require(_0xa4bb('0x2'))(_0xa4bb('0x3'));var moment=require(_0xa4bb('0x4'));var BPromise=require(_0xa4bb('0x5'));var rp=require(_0xa4bb('0x6'));var fs=require('fs');var path=require(_0xa4bb('0x7'));var rimraf=require('rimraf');var config=require(_0xa4bb('0x8'));var attributes=require(_0xa4bb('0x9'));module['exports']=function(_0x3ccaae,_0x32a59b){return _0x3ccaae[_0xa4bb('0xa')](_0xa4bb('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x841e0c,_0x4a1a39,_0x5b2c75){if(_0x841e0c[_0xa4bb('0xc')](_0xa4bb('0xd'))){_0x841e0c[_0xa4bb('0xe')]=moment()[_0xa4bb('0xf')](_0xa4bb('0x10'));}if(_0x841e0c['changed']('production')){_0x841e0c['publishedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5b2c75(null,_0x841e0c);}}});}; \ No newline at end of file +var _0x6c66=['../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x134ce6,_0x420433){var _0x3e52a1=function(_0x4bff88){while(--_0x4bff88){_0x134ce6['push'](_0x134ce6['shift']());}};_0x3e52a1(++_0x420433);}(_0x6c66,0x175));var _0x66c6=function(_0xd04b83,_0x456f09){_0xd04b83=_0xd04b83-0x0;var _0x44b162=_0x6c66[_0xd04b83];return _0x44b162;};'use strict';var _=require(_0x66c6('0x0'));var util=require(_0x66c6('0x1'));var logger=require(_0x66c6('0x2'))(_0x66c6('0x3'));var moment=require(_0x66c6('0x4'));var BPromise=require(_0x66c6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c6('0x6'));var config=require(_0x66c6('0x7'));var attributes=require('./squareProject.attributes');module[_0x66c6('0x8')]=function(_0x159a52,_0x2caf27){return _0x159a52[_0x66c6('0x9')](_0x66c6('0xa'),attributes,{'tableName':_0x66c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5eddf8,_0x262f7c,_0x39821e){if(_0x5eddf8[_0x66c6('0xc')](_0x66c6('0xd'))){_0x5eddf8[_0x66c6('0xe')]=moment()[_0x66c6('0xf')](_0x66c6('0x10'));}if(_0x5eddf8[_0x66c6('0xc')](_0x66c6('0x11'))){_0x5eddf8[_0x66c6('0x12')]=moment()[_0x66c6('0xf')](_0x66c6('0x10'));}_0x39821e(null,_0x5eddf8);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index e61647b..664c0c2 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 _0x497c=['SquareProject','options','raw','attributes','limit','include','map','model','then','info','stringify','catch','error','message','find','where','debug','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects'];(function(_0x309e4c,_0xe50b68){var _0x18e3ae=function(_0x3a189b){while(--_0x3a189b){_0x309e4c['push'](_0x309e4c['shift']());}};_0x18e3ae(++_0xe50b68);}(_0x497c,0x13e));var _0xc497=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x497c[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xc497('0x0'));var Redis=require(_0xc497('0x1'));var db=require(_0xc497('0x2'))['db'];var logger=require(_0xc497('0x3'))(_0xc497('0x4'));var config=require(_0xc497('0x5'));config['redis']=_[_0xc497('0x6')](config[_0xc497('0x7')],{'host':_0xc497('0x8'),'port':0x18eb});var socket=require(_0xc497('0x9'))(new Redis(config[_0xc497('0x7')]));require(_0xc497('0xa'))['register'](socket);exports[_0xc497('0xb')]=function(_0x1accf0){var _0xb031c=this;return new Promise(function(_0x5400e8,_0x4d36aa){return db[_0xc497('0xc')]['findAll']({'raw':_0x1accf0[_0xc497('0xd')]?_0x1accf0[_0xc497('0xd')][_0xc497('0xe')]===undefined?!![]:![]:!![],'where':_0x1accf0[_0xc497('0xd')]?_0x1accf0[_0xc497('0xd')]['where']||null:null,'attributes':_0x1accf0[_0xc497('0xd')]?_0x1accf0[_0xc497('0xd')][_0xc497('0xf')]||null:null,'limit':_0x1accf0[_0xc497('0xd')]?_0x1accf0[_0xc497('0xd')][_0xc497('0x10')]||null:null,'include':_0x1accf0['options']?_0x1accf0[_0xc497('0xd')][_0xc497('0x11')]?_[_0xc497('0x12')](_0x1accf0[_0xc497('0xd')][_0xc497('0x11')],function(_0x36a89d){return{'model':db[_0x36a89d[_0xc497('0x13')]],'as':_0x36a89d['as'],'attributes':_0x36a89d[_0xc497('0xf')],'include':_0x36a89d[_0xc497('0x11')]?_[_0xc497('0x12')](_0x36a89d[_0xc497('0x11')],function(_0x457962){return{'model':db[_0x457962['model']],'as':_0x457962['as'],'attributes':_0x457962[_0xc497('0xf')],'include':_0x457962[_0xc497('0x11')]?_['map'](_0x457962[_0xc497('0x11')],function(_0x4a58ec){return{'model':db[_0x4a58ec[_0xc497('0x13')]],'as':_0x4a58ec['as'],'attributes':_0x4a58ec[_0xc497('0xf')]};}):[]};}):[]};}):[]:[]})[_0xc497('0x14')](function(_0x1a5434){logger[_0xc497('0x15')]('GetSquareProjects',_0x1accf0);logger['debug'](_0xc497('0xb'),_0x1accf0,JSON[_0xc497('0x16')](_0x1a5434));_0x5400e8(_0x1a5434);})[_0xc497('0x17')](function(_0x91c3e2){logger[_0xc497('0x18')]('GetSquareProjects',_0x91c3e2['message'],_0x1accf0);_0x4d36aa(_0xb031c['error'](0x1f4,_0x91c3e2[_0xc497('0x19')]));});});};exports['ShowSquareProject']=function(_0x3f6a57){var _0x264a67=this;return new Promise(function(_0x4f6fd4,_0x52d6cd){return db['SquareProject'][_0xc497('0x1a')]({'raw':_0x3f6a57[_0xc497('0xd')]?_0x3f6a57[_0xc497('0xd')][_0xc497('0xe')]===undefined?!![]:![]:!![],'where':_0x3f6a57[_0xc497('0xd')]?_0x3f6a57[_0xc497('0xd')][_0xc497('0x1b')]||null:null,'attributes':_0x3f6a57[_0xc497('0xd')]?_0x3f6a57[_0xc497('0xd')][_0xc497('0xf')]||null:null,'include':_0x3f6a57[_0xc497('0xd')]?_0x3f6a57[_0xc497('0xd')][_0xc497('0x11')]?_[_0xc497('0x12')](_0x3f6a57[_0xc497('0xd')][_0xc497('0x11')],function(_0x5aadfb){return{'model':db[_0x5aadfb[_0xc497('0x13')]],'as':_0x5aadfb['as'],'attributes':_0x5aadfb[_0xc497('0xf')],'include':_0x5aadfb[_0xc497('0x11')]?_[_0xc497('0x12')](_0x5aadfb[_0xc497('0x11')],function(_0x514431){return{'model':db[_0x514431[_0xc497('0x13')]],'as':_0x514431['as'],'attributes':_0x514431[_0xc497('0xf')],'include':_0x514431[_0xc497('0x11')]?_[_0xc497('0x12')](_0x514431[_0xc497('0x11')],function(_0x1d6ea2){return{'model':db[_0x1d6ea2['model']],'as':_0x1d6ea2['as'],'attributes':_0x1d6ea2[_0xc497('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b8ba2){logger['info']('ShowSquareProject',_0x3f6a57);logger[_0xc497('0x1c')](_0xc497('0x1d'),_0x3f6a57,JSON[_0xc497('0x16')](_0x9b8ba2));_0x4f6fd4(_0x9b8ba2);})['catch'](function(_0x191626){logger[_0xc497('0x18')](_0xc497('0x1d'),_0x191626[_0xc497('0x19')],_0x3f6a57);_0x52d6cd(_0x264a67[_0xc497('0x18')](0x1f4,_0x191626[_0xc497('0x19')]));});});}; \ No newline at end of file +var _0xb903=['redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','attributes','limit','include','map','model','info','error','ShowSquareProject','SquareProject','find','then','debug','stringify','message','lodash','ioredis','../../mysqldb','rpc'];(function(_0x4c3bff,_0x670a24){var _0x4ff8f2=function(_0x1865c3){while(--_0x1865c3){_0x4c3bff['push'](_0x4c3bff['shift']());}};_0x4ff8f2(++_0x670a24);}(_0xb903,0x1c7));var _0x3b90=function(_0x57f528,_0x50c9a6){_0x57f528=_0x57f528-0x0;var _0x2f5fd9=_0xb903[_0x57f528];return _0x2f5fd9;};'use strict';var _=require(_0x3b90('0x0'));var Redis=require(_0x3b90('0x1'));var db=require(_0x3b90('0x2'))['db'];var logger=require('../../config/logger')(_0x3b90('0x3'));var config=require('../../config/environment');config[_0x3b90('0x4')]=_['defaults'](config[_0x3b90('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b90('0x5'))(new Redis(config['redis']));require(_0x3b90('0x6'))[_0x3b90('0x7')](socket);exports[_0x3b90('0x8')]=function(_0x282e47){var _0x4e3af8=this;return new Promise(function(_0x25a6c6,_0xa7556b){return db['SquareProject'][_0x3b90('0x9')]({'raw':_0x282e47[_0x3b90('0xa')]?_0x282e47[_0x3b90('0xa')][_0x3b90('0xb')]===undefined?!![]:![]:!![],'where':_0x282e47['options']?_0x282e47[_0x3b90('0xa')][_0x3b90('0xc')]||null:null,'attributes':_0x282e47[_0x3b90('0xa')]?_0x282e47[_0x3b90('0xa')][_0x3b90('0xd')]||null:null,'limit':_0x282e47[_0x3b90('0xa')]?_0x282e47[_0x3b90('0xa')][_0x3b90('0xe')]||null:null,'include':_0x282e47[_0x3b90('0xa')]?_0x282e47[_0x3b90('0xa')][_0x3b90('0xf')]?_['map'](_0x282e47['options'][_0x3b90('0xf')],function(_0x1f6a8b){return{'model':db[_0x1f6a8b['model']],'as':_0x1f6a8b['as'],'attributes':_0x1f6a8b[_0x3b90('0xd')],'include':_0x1f6a8b[_0x3b90('0xf')]?_[_0x3b90('0x10')](_0x1f6a8b[_0x3b90('0xf')],function(_0x2a2bca){return{'model':db[_0x2a2bca[_0x3b90('0x11')]],'as':_0x2a2bca['as'],'attributes':_0x2a2bca[_0x3b90('0xd')],'include':_0x2a2bca[_0x3b90('0xf')]?_['map'](_0x2a2bca[_0x3b90('0xf')],function(_0x59024b){return{'model':db[_0x59024b[_0x3b90('0x11')]],'as':_0x59024b['as'],'attributes':_0x59024b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b1b56){logger[_0x3b90('0x12')]('GetSquareProjects',_0x282e47);logger['debug'](_0x3b90('0x8'),_0x282e47,JSON['stringify'](_0x5b1b56));_0x25a6c6(_0x5b1b56);})['catch'](function(_0x2060dd){logger['error'](_0x3b90('0x8'),_0x2060dd['message'],_0x282e47);_0xa7556b(_0x4e3af8[_0x3b90('0x13')](0x1f4,_0x2060dd['message']));});});};exports[_0x3b90('0x14')]=function(_0x441521){var _0x154a2d=this;return new Promise(function(_0x27cd29,_0x565d9f){return db[_0x3b90('0x15')][_0x3b90('0x16')]({'raw':_0x441521[_0x3b90('0xa')]?_0x441521['options']['raw']===undefined?!![]:![]:!![],'where':_0x441521[_0x3b90('0xa')]?_0x441521[_0x3b90('0xa')]['where']||null:null,'attributes':_0x441521[_0x3b90('0xa')]?_0x441521['options'][_0x3b90('0xd')]||null:null,'include':_0x441521[_0x3b90('0xa')]?_0x441521[_0x3b90('0xa')][_0x3b90('0xf')]?_[_0x3b90('0x10')](_0x441521[_0x3b90('0xa')][_0x3b90('0xf')],function(_0xc1d28b){return{'model':db[_0xc1d28b['model']],'as':_0xc1d28b['as'],'attributes':_0xc1d28b[_0x3b90('0xd')],'include':_0xc1d28b[_0x3b90('0xf')]?_['map'](_0xc1d28b['include'],function(_0x357c1a){return{'model':db[_0x357c1a[_0x3b90('0x11')]],'as':_0x357c1a['as'],'attributes':_0x357c1a[_0x3b90('0xd')],'include':_0x357c1a[_0x3b90('0xf')]?_[_0x3b90('0x10')](_0x357c1a[_0x3b90('0xf')],function(_0x3e8c01){return{'model':db[_0x3e8c01['model']],'as':_0x3e8c01['as'],'attributes':_0x3e8c01['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b90('0x17')](function(_0x2f19a8){logger[_0x3b90('0x12')](_0x3b90('0x14'),_0x441521);logger[_0x3b90('0x18')](_0x3b90('0x14'),_0x441521,JSON[_0x3b90('0x19')](_0x2f19a8));_0x27cd29(_0x2f19a8);})['catch'](function(_0x46bbc1){logger[_0x3b90('0x13')]('ShowSquareProject',_0x46bbc1['message'],_0x441521);_0x565d9f(_0x154a2d[_0x3b90('0x13')](0x1f4,_0x46bbc1[_0x3b90('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b0cb807..84b8ab9 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 _0xe62f=['update','removeListener','length','squareProject:','./squareProject.events'];(function(_0x191dba,_0x47cb00){var _0x3441eb=function(_0x51ee2c){while(--_0x51ee2c){_0x191dba['push'](_0x191dba['shift']());}};_0x3441eb(++_0x47cb00);}(_0xe62f,0xf9));var _0xfe62=function(_0x26c6c4,_0x12bdab){_0x26c6c4=_0x26c6c4-0x0;var _0x1ff6de=_0xe62f[_0x26c6c4];return _0x1ff6de;};'use strict';var SquareProjectEvents=require(_0xfe62('0x0'));var events=['save','remove',_0xfe62('0x1')];function createListener(_0x17a890,_0x55a411){return function(_0x3cd170){_0x55a411['emit'](_0x17a890,_0x3cd170);};}function removeListener(_0x1cc091,_0x57865b){return function(){SquareProjectEvents[_0xfe62('0x2')](_0x1cc091,_0x57865b);};}exports['register']=function(_0x5c9700){for(var _0x5ceb97=0x0,_0x2f940a=events[_0xfe62('0x3')];_0x5ceb97<_0x2f940a;_0x5ceb97++){var _0x461e45=events[_0x5ceb97];var _0x23f07c=createListener(_0xfe62('0x4')+_0x461e45,_0x5c9700);SquareProjectEvents['on'](_0x461e45,_0x23f07c);}}; \ No newline at end of file +var _0x9e88=['squareProject:','./squareProject.events','remove','update','emit','removeListener','register','length'];(function(_0x47bbf5,_0x147480){var _0x15a0b8=function(_0xe84468){while(--_0xe84468){_0x47bbf5['push'](_0x47bbf5['shift']());}};_0x15a0b8(++_0x147480);}(_0x9e88,0x1d9));var _0x89e8=function(_0x38c65b,_0x5a6a7a){_0x38c65b=_0x38c65b-0x0;var _0xa4f985=_0x9e88[_0x38c65b];return _0xa4f985;};'use strict';var SquareProjectEvents=require(_0x89e8('0x0'));var events=['save',_0x89e8('0x1'),_0x89e8('0x2')];function createListener(_0x389ec3,_0xaed26f){return function(_0x5a0c52){_0xaed26f[_0x89e8('0x3')](_0x389ec3,_0x5a0c52);};}function removeListener(_0x371ec7,_0x41aacd){return function(){SquareProjectEvents[_0x89e8('0x4')](_0x371ec7,_0x41aacd);};}exports[_0x89e8('0x5')]=function(_0x22a02b){for(var _0x5ad301=0x0,_0xfe3157=events[_0x89e8('0x6')];_0x5ad301<_0xfe3157;_0x5ad301++){var _0x2bc5ed=events[_0x5ad301];var _0x1dd1b5=createListener(_0x89e8('0x7')+_0x2bc5ed,_0x22a02b);SquareProjectEvents['on'](_0x2bc5ed,_0x1dd1b5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a6277c1..d700820 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x5d01a,_0x56cf87){var _0xaecd8c=function(_0x296f41){while(--_0x296f41){_0x5d01a['push'](_0x5d01a['shift']());}};_0xaecd8c(++_0x56cf87);}(_0x53ec,0x192));var _0xc53e=function(_0x30631b,_0x50799b){_0x30631b=_0x30631b-0x0;var _0x3d57c6=_0x53ec[_0x30631b];return _0x3d57c6;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x43bc4b,_0x1a1938){var _0x4700bd=function(_0x230ecb){while(--_0x230ecb){_0x43bc4b['push'](_0x43bc4b['shift']());}};_0x4700bd(++_0x1a1938);}(_0xf494,0x1c6));var _0x4f49=function(_0x5e0448,_0x3db6f2){_0x5e0448=_0x5e0448-0x0;var _0xdec316=_0xf494[_0x5e0448];return _0xdec316;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index d82248b..9d35a6f 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 _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x46db46,_0x54e664){var _0x4a4d81=function(_0x1e1465){while(--_0x1e1465){_0x46db46['push'](_0x46db46['shift']());}};_0x4a4d81(++_0x54e664);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file +var _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x49db5c,_0x2b4f98){var _0x5bed3f=function(_0x3b2916){while(--_0x3b2916){_0x49db5c['push'](_0x49db5c['shift']());}};_0x5bed3f(++_0x2b4f98);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x12e703,_0x4dbfa5){_0x12e703=_0x12e703-0x0;var _0xd8e44e=_0x9c5a[_0x12e703];return _0xd8e44e;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6b549c7..a89b119 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 _0xbb4e=['../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','decryptFile','secrets','existsSync','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','reject','save','then','destroy','end','error','stack','name','index','map','SquareRecording','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','fields','find','create','body','update','download'];(function(_0x11ba46,_0x1d6752){var _0x1c8c6f=function(_0x4cf96f){while(--_0x4cf96f){_0x11ba46['push'](_0x11ba46['shift']());}};_0x1c8c6f(++_0x1d6752);}(_0xbb4e,0x1e2));var _0xebb4=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xbb4e[_0x2341c6];return _0x54c34d;};'use strict';var emlformat=require(_0xebb4('0x0'));var rimraf=require(_0xebb4('0x1'));var zipdir=require(_0xebb4('0x2'));var jsonpatch=require(_0xebb4('0x3'));var rp=require('request-promise');var moment=require(_0xebb4('0x4'));var BPromise=require(_0xebb4('0x5'));var Mustache=require(_0xebb4('0x6'));var util=require(_0xebb4('0x7'));var path=require(_0xebb4('0x8'));var sox=require(_0xebb4('0x9'));var csv=require('to-csv');var ejs=require(_0xebb4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xebb4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xebb4('0xc'));var querystring=require(_0xebb4('0xd'));var Papa=require('papaparse');var Redis=require(_0xebb4('0xe'));var authService=require(_0xebb4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xebb4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebb4('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebb4('0x12'));var db=require(_0xebb4('0x13'))['db'];function respondWithStatusCode(_0x1f96fe,_0x3fdea1){_0x3fdea1=_0x3fdea1||0xcc;return function(_0x5dab8a){if(_0x5dab8a){return _0x1f96fe[_0xebb4('0x14')](_0x3fdea1);}return _0x1f96fe[_0xebb4('0x15')](_0x3fdea1)['end']();};}function respondWithResult(_0x2012ac,_0x1bc07d){_0x1bc07d=_0x1bc07d||0xc8;return function(_0x21dc71){if(_0x21dc71){return _0x2012ac[_0xebb4('0x15')](_0x1bc07d)[_0xebb4('0x16')](_0x21dc71);}};}function respondWithFilteredResult(_0x14f2d0,_0x177ea2){return function(_0x42da14){if(_0x42da14){var _0x553af4=typeof _0x177ea2['offset']===_0xebb4('0x17')&&typeof _0x177ea2[_0xebb4('0x18')]===_0xebb4('0x17');var _0x3600b6=_0x42da14['count'];var _0x7650e0=_0x553af4?0x0:_0x177ea2[_0xebb4('0x19')];var _0x4c045f=_0x553af4?_0x42da14[_0xebb4('0x1a')]:_0x177ea2[_0xebb4('0x19')]+_0x177ea2[_0xebb4('0x18')];var _0x4acef7;if(_0x4c045f>=_0x3600b6){_0x4c045f=_0x3600b6;_0x4acef7=0xc8;}else{_0x4acef7=0xce;}_0x14f2d0[_0xebb4('0x15')](_0x4acef7);return _0x14f2d0[_0xebb4('0x1b')]('Content-Range',_0x7650e0+'-'+_0x4c045f+'/'+_0x3600b6)[_0xebb4('0x16')](_0x42da14);}return null;};}function patchUpdates(_0xf53a87){return function(_0x5add85){try{jsonpatch[_0xebb4('0x1c')](_0x5add85,_0xf53a87,!![]);}catch(_0x285530){return BPromise[_0xebb4('0x1d')](_0x285530);}return _0x5add85[_0xebb4('0x1e')]();};}function saveUpdates(_0x36319e,_0x582067){return function(_0x41316a){if(_0x41316a){return _0x41316a['update'](_0x36319e)[_0xebb4('0x1f')](function(_0x209382){return _0x209382;});}return null;};}function removeEntity(_0x5dbaee,_0x4e1d4c){return function(_0x46b5b6){if(_0x46b5b6){return _0x46b5b6[_0xebb4('0x20')]()[_0xebb4('0x1f')](function(){_0x5dbaee[_0xebb4('0x15')](0xcc)[_0xebb4('0x21')]();});}};}function handleEntityNotFound(_0x45bb47,_0x4bb5ec){return function(_0x20b968){if(!_0x20b968){_0x45bb47[_0xebb4('0x14')](0x194);}return _0x20b968;};}function handleError(_0x16f460,_0x2e956a){_0x2e956a=_0x2e956a||0x1f4;return function(_0x5a6727){logger[_0xebb4('0x22')](_0x5a6727[_0xebb4('0x23')]);if(_0x5a6727[_0xebb4('0x24')]){delete _0x5a6727[_0xebb4('0x24')];}_0x16f460[_0xebb4('0x15')](_0x2e956a)['send'](_0x5a6727);};}exports[_0xebb4('0x25')]=function(_0xdd3466,_0x26359f){var _0x4980fa={},_0x12d6b0={},_0x402b5f={'count':0x0,'rows':[]};var _0x5357b0=_[_0xebb4('0x26')](db[_0xebb4('0x27')]['rawAttributes'],function(_0x3cec0d){return{'name':_0x3cec0d[_0xebb4('0x28')],'type':_0x3cec0d[_0xebb4('0x29')][_0xebb4('0x2a')]};});_0x12d6b0[_0xebb4('0x2b')]=_[_0xebb4('0x26')](_0x5357b0,_0xebb4('0x24'));_0x12d6b0[_0xebb4('0x2c')]=_['keys'](_0xdd3466['query']);_0x12d6b0[_0xebb4('0x2d')]=_['intersection'](_0x12d6b0[_0xebb4('0x2b')],_0x12d6b0[_0xebb4('0x2c')]);_0x4980fa[_0xebb4('0x2e')]=_[_0xebb4('0x2f')](_0x12d6b0[_0xebb4('0x2b')],qs['fields'](_0xdd3466[_0xebb4('0x2c')]['fields']));_0x4980fa[_0xebb4('0x2e')]=_0x4980fa[_0xebb4('0x2e')][_0xebb4('0x30')]?_0x4980fa[_0xebb4('0x2e')]:_0x12d6b0['model'];if(!_0xdd3466[_0xebb4('0x2c')][_0xebb4('0x31')](_0xebb4('0x32'))){_0x4980fa[_0xebb4('0x18')]=qs[_0xebb4('0x18')](_0xdd3466[_0xebb4('0x2c')][_0xebb4('0x18')]);_0x4980fa[_0xebb4('0x19')]=qs['offset'](_0xdd3466[_0xebb4('0x2c')][_0xebb4('0x19')]);}_0x4980fa['order']=qs['sort'](_0xdd3466[_0xebb4('0x2c')]['sort']);_0x4980fa['where']=qs[_0xebb4('0x2d')](_[_0xebb4('0x33')](_0xdd3466[_0xebb4('0x2c')],_0x12d6b0[_0xebb4('0x2d')]),_0x5357b0);if(_0xdd3466[_0xebb4('0x2c')][_0xebb4('0x34')]){_0x4980fa[_0xebb4('0x35')]=_[_0xebb4('0x36')](_0x4980fa[_0xebb4('0x35')],{'$or':_[_0xebb4('0x26')](_0x5357b0,function(_0x679750){if(_0x679750[_0xebb4('0x29')]!==_0xebb4('0x37')){var _0x27907b={};_0x27907b[_0x679750[_0xebb4('0x24')]]={'$like':'%'+_0xdd3466[_0xebb4('0x2c')][_0xebb4('0x34')]+'%'};return _0x27907b;}})});}_0x4980fa=_['merge']({},_0x4980fa,_0xdd3466['options']);var _0x3836d9={'where':_0x4980fa[_0xebb4('0x35')]};return db[_0xebb4('0x27')][_0xebb4('0x1a')](_0x3836d9)['then'](function(_0x3859de){_0x402b5f[_0xebb4('0x1a')]=_0x3859de;if(_0xdd3466[_0xebb4('0x2c')][_0xebb4('0x38')]){_0x4980fa[_0xebb4('0x39')]=[{'all':!![]}];}return db[_0xebb4('0x27')][_0xebb4('0x3a')](_0x4980fa);})['then'](function(_0x40eb6c){_0x402b5f[_0xebb4('0x3b')]=_0x40eb6c;return _0x402b5f;})[_0xebb4('0x1f')](respondWithFilteredResult(_0x26359f,_0x4980fa))[_0xebb4('0x3c')](handleError(_0x26359f,null));};exports['show']=function(_0x3d8c33,_0x524036){var _0x29fa33={'raw':!![],'where':{'id':_0x3d8c33[_0xebb4('0x3d')]['id']}},_0x53e1b7={};_0x53e1b7[_0xebb4('0x2b')]=_[_0xebb4('0x3e')](db[_0xebb4('0x27')][_0xebb4('0x3f')]);_0x53e1b7[_0xebb4('0x2c')]=_[_0xebb4('0x3e')](_0x3d8c33['query']);_0x53e1b7[_0xebb4('0x2d')]=_['intersection'](_0x53e1b7[_0xebb4('0x2b')],_0x53e1b7[_0xebb4('0x2c')]);_0x29fa33['attributes']=_[_0xebb4('0x2f')](_0x53e1b7[_0xebb4('0x2b')],qs[_0xebb4('0x40')](_0x3d8c33[_0xebb4('0x2c')][_0xebb4('0x40')]));_0x29fa33[_0xebb4('0x2e')]=_0x29fa33[_0xebb4('0x2e')][_0xebb4('0x30')]?_0x29fa33[_0xebb4('0x2e')]:_0x53e1b7[_0xebb4('0x2b')];if(_0x3d8c33[_0xebb4('0x2c')][_0xebb4('0x38')]){_0x29fa33[_0xebb4('0x39')]=[{'all':!![]}];}_0x29fa33=_[_0xebb4('0x36')]({},_0x29fa33,_0x3d8c33['options']);return db[_0xebb4('0x27')][_0xebb4('0x41')](_0x29fa33)[_0xebb4('0x1f')](handleEntityNotFound(_0x524036,null))['then'](respondWithResult(_0x524036,null))[_0xebb4('0x3c')](handleError(_0x524036,null));};exports[_0xebb4('0x42')]=function(_0x2b611c,_0x228307){return db['SquareRecording']['create'](_0x2b611c[_0xebb4('0x43')],{})['then'](respondWithResult(_0x228307,0xc9))[_0xebb4('0x3c')](handleError(_0x228307,null));};exports[_0xebb4('0x44')]=function(_0x30c229,_0x584245){if(_0x30c229['body']['id']){delete _0x30c229[_0xebb4('0x43')]['id'];}return db['SquareRecording'][_0xebb4('0x41')]({'where':{'id':_0x30c229[_0xebb4('0x3d')]['id']}})[_0xebb4('0x1f')](handleEntityNotFound(_0x584245,null))['then'](saveUpdates(_0x30c229[_0xebb4('0x43')],null))['then'](respondWithResult(_0x584245,null))[_0xebb4('0x3c')](handleError(_0x584245,null));};exports[_0xebb4('0x45')]=function(_0x300a90,_0x33ba69,_0x3ab99d){var _0x9ddf92=require(_0xebb4('0x46'));var _0x5876ce=![];var _0x3f6ce4={};if(_0x300a90[_0xebb4('0x2c')]['type']&&_0x300a90[_0xebb4('0x2c')][_0xebb4('0x29')]===_0xebb4('0x47')){_0x3f6ce4['uniqueid']=_0x300a90['params']['id'];}else{_0x3f6ce4['id']=_0x300a90[_0xebb4('0x3d')]['id'];}return db['SquareRecording'][_0xebb4('0x41')]({'where':_0x3f6ce4,'attributes':['id','savePath',_0xebb4('0x48')],'raw':!![]})[_0xebb4('0x1f')](handleEntityNotFound(_0x33ba69,null))['then'](function(_0x507f25){if(_0x507f25){var _0x4dc5a1=_0x507f25[_0xebb4('0x49')];var _0x3095e7=util[_0xebb4('0x4a')](_0xebb4('0x4b'),_0x4dc5a1);if(fs['existsSync'](_0x3095e7)){_0x5876ce=!![];return _0x9ddf92[_0xebb4('0x4c')](_0x3095e7,_0x4dc5a1,config[_0xebb4('0x4d')]['recording'])[_0xebb4('0x1f')](function(){return _0x507f25;});}return _0x507f25;}})[_0xebb4('0x1f')](function(_0x29d046){if(_0x29d046){var _0x21a03f=_0x29d046[_0xebb4('0x49')];if(!fs[_0xebb4('0x4e')](_0x21a03f)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x29d046['filename']){return _0x33ba69[_0xebb4('0x45')](_0x21a03f,_0x29d046[_0xebb4('0x48')]+path[_0xebb4('0x4f')](_0x21a03f),function(){if(_0x5876ce){fs[_0xebb4('0x50')](_0x21a03f);}});}else{return _0x33ba69[_0xebb4('0x45')](_0x21a03f,function(_0x2463b1){if(_0x5876ce){fs['unlink'](_0x21a03f);}});}}})[_0xebb4('0x3c')](function(_0x2494ab){if(_0x2494ab[_0xebb4('0x51')]===_0xebb4('0x52')){_0x33ba69[_0xebb4('0x15')](0x194)['send'](_0xebb4('0x53'));}else{return handleError(_0x33ba69,null);}});};exports[_0xebb4('0x20')]=function(_0x4f6733,_0x4f5f99){return db[_0xebb4('0x27')][_0xebb4('0x41')]({'where':{'id':_0x4f6733['params']['id']}})[_0xebb4('0x1f')](function(_0x18963b){if(_[_0xebb4('0x54')](_0x18963b)){throw new ReferenceError(_0xebb4('0x55'));}return _0x18963b;})[_0xebb4('0x1f')](function(_0x67dd15){var _0x4c6332=_0x67dd15[_0xebb4('0x49')];logger['info'](_0xebb4('0x56'),_0x4c6332);if(!_[_0xebb4('0x54')](_0x67dd15[_0xebb4('0x49')])&&fs['existsSync'](_0x4c6332)){logger['info'](_0xebb4('0x57')+_0x4c6332+_0xebb4('0x58'));fs[_0xebb4('0x59')](_0x4c6332);}_0x4c6332=_0x4c6332+_0xebb4('0x5a');if(!_[_0xebb4('0x54')](_0x67dd15[_0xebb4('0x49')])&&fs[_0xebb4('0x4e')](_0x4c6332)){logger[_0xebb4('0x5b')](_0xebb4('0x57')+_0x4c6332+_0xebb4('0x58'));fs['unlinkSync'](_0x4c6332);}return _0x67dd15;})[_0xebb4('0x1f')](function(_0x1867a4){if(!_0x1867a4)throw new InternalError();return _0x1867a4[_0xebb4('0x20')]();})['then'](function(){_0x4f5f99['status'](0xcc)[_0xebb4('0x21')]();})[_0xebb4('0x3c')](handleError(_0x4f5f99,null));}; \ No newline at end of file +var _0xb8e6=['error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','update','download','../../components/encryptor','uniqueid','find','filename','savePath','%s.cypher','existsSync','decryptFile','recording','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','end'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb8e6,0x9c));var _0x6b8e=function(_0x112d78,_0x12563a){_0x112d78=_0x112d78-0x0;var _0xf7c8c2=_0xb8e6[_0x112d78];return _0xf7c8c2;};'use strict';var emlformat=require(_0x6b8e('0x0'));var rimraf=require(_0x6b8e('0x1'));var zipdir=require(_0x6b8e('0x2'));var jsonpatch=require(_0x6b8e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b8e('0x4'));var Mustache=require(_0x6b8e('0x5'));var util=require(_0x6b8e('0x6'));var path=require('path');var sox=require(_0x6b8e('0x7'));var csv=require('to-csv');var ejs=require(_0x6b8e('0x8'));var fs=require('fs');var fs_extra=require(_0x6b8e('0x9'));var _=require('lodash');var squel=require(_0x6b8e('0xa'));var crypto=require(_0x6b8e('0xb'));var jsforce=require(_0x6b8e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6b8e('0xd'));var querystring=require('querystring');var Papa=require(_0x6b8e('0xe'));var Redis=require(_0x6b8e('0xf'));var authService=require(_0x6b8e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6b8e('0x11'));var hardwareService=require(_0x6b8e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6b8e('0x13'));var config=require(_0x6b8e('0x14'));var licenseUtil=require(_0x6b8e('0x15'));var db=require(_0x6b8e('0x16'))['db'];function respondWithStatusCode(_0x18da8d,_0x4155a8){_0x4155a8=_0x4155a8||0xcc;return function(_0xb880e9){if(_0xb880e9){return _0x18da8d[_0x6b8e('0x17')](_0x4155a8);}return _0x18da8d[_0x6b8e('0x18')](_0x4155a8)['end']();};}function respondWithResult(_0x267a9a,_0x3535b0){_0x3535b0=_0x3535b0||0xc8;return function(_0x34d053){if(_0x34d053){return _0x267a9a[_0x6b8e('0x18')](_0x3535b0)[_0x6b8e('0x19')](_0x34d053);}};}function respondWithFilteredResult(_0x583622,_0x43810b){return function(_0xbec5a7){if(_0xbec5a7){var _0x1b4482=typeof _0x43810b[_0x6b8e('0x1a')]==='undefined'&&typeof _0x43810b[_0x6b8e('0x1b')]===_0x6b8e('0x1c');var _0x135748=_0xbec5a7[_0x6b8e('0x1d')];var _0x1befee=_0x1b4482?0x0:_0x43810b[_0x6b8e('0x1a')];var _0x35778a=_0x1b4482?_0xbec5a7[_0x6b8e('0x1d')]:_0x43810b['offset']+_0x43810b[_0x6b8e('0x1b')];var _0xc8a9d4;if(_0x35778a>=_0x135748){_0x35778a=_0x135748;_0xc8a9d4=0xc8;}else{_0xc8a9d4=0xce;}_0x583622[_0x6b8e('0x18')](_0xc8a9d4);return _0x583622[_0x6b8e('0x1e')](_0x6b8e('0x1f'),_0x1befee+'-'+_0x35778a+'/'+_0x135748)[_0x6b8e('0x19')](_0xbec5a7);}return null;};}function patchUpdates(_0x1bc95d){return function(_0x2c61ee){try{jsonpatch[_0x6b8e('0x20')](_0x2c61ee,_0x1bc95d,!![]);}catch(_0x4b74c1){return BPromise[_0x6b8e('0x21')](_0x4b74c1);}return _0x2c61ee['save']();};}function saveUpdates(_0x363026,_0x5aa974){return function(_0x2903b4){if(_0x2903b4){return _0x2903b4['update'](_0x363026)['then'](function(_0x2ad14e){return _0x2ad14e;});}return null;};}function removeEntity(_0x2b868b,_0x59e1f6){return function(_0x52cd43){if(_0x52cd43){return _0x52cd43[_0x6b8e('0x22')]()['then'](function(){_0x2b868b['status'](0xcc)[_0x6b8e('0x23')]();});}};}function handleEntityNotFound(_0x57b414,_0x50b9c3){return function(_0x228bd4){if(!_0x228bd4){_0x57b414['sendStatus'](0x194);}return _0x228bd4;};}function handleError(_0xabb60a,_0x556692){_0x556692=_0x556692||0x1f4;return function(_0x302525){logger[_0x6b8e('0x24')](_0x302525[_0x6b8e('0x25')]);if(_0x302525[_0x6b8e('0x26')]){delete _0x302525[_0x6b8e('0x26')];}_0xabb60a[_0x6b8e('0x18')](_0x556692)[_0x6b8e('0x27')](_0x302525);};}exports[_0x6b8e('0x28')]=function(_0xd1ff36,_0x52e2d2){var _0x5b43cf={},_0x4f926f={},_0x5835c9={'count':0x0,'rows':[]};var _0x2c4888=_[_0x6b8e('0x29')](db[_0x6b8e('0x2a')][_0x6b8e('0x2b')],function(_0x87b4b2){return{'name':_0x87b4b2[_0x6b8e('0x2c')],'type':_0x87b4b2['type'][_0x6b8e('0x2d')]};});_0x4f926f[_0x6b8e('0x2e')]=_['map'](_0x2c4888,_0x6b8e('0x26'));_0x4f926f[_0x6b8e('0x2f')]=_[_0x6b8e('0x30')](_0xd1ff36[_0x6b8e('0x2f')]);_0x4f926f[_0x6b8e('0x31')]=_['intersection'](_0x4f926f[_0x6b8e('0x2e')],_0x4f926f[_0x6b8e('0x2f')]);_0x5b43cf['attributes']=_[_0x6b8e('0x32')](_0x4f926f[_0x6b8e('0x2e')],qs['fields'](_0xd1ff36[_0x6b8e('0x2f')][_0x6b8e('0x33')]));_0x5b43cf[_0x6b8e('0x34')]=_0x5b43cf[_0x6b8e('0x34')][_0x6b8e('0x35')]?_0x5b43cf[_0x6b8e('0x34')]:_0x4f926f[_0x6b8e('0x2e')];if(!_0xd1ff36[_0x6b8e('0x2f')][_0x6b8e('0x36')](_0x6b8e('0x37'))){_0x5b43cf['limit']=qs[_0x6b8e('0x1b')](_0xd1ff36['query']['limit']);_0x5b43cf[_0x6b8e('0x1a')]=qs['offset'](_0xd1ff36[_0x6b8e('0x2f')][_0x6b8e('0x1a')]);}_0x5b43cf[_0x6b8e('0x38')]=qs[_0x6b8e('0x39')](_0xd1ff36[_0x6b8e('0x2f')][_0x6b8e('0x39')]);_0x5b43cf['where']=qs['filters'](_[_0x6b8e('0x3a')](_0xd1ff36['query'],_0x4f926f['filters']),_0x2c4888);if(_0xd1ff36[_0x6b8e('0x2f')][_0x6b8e('0x3b')]){_0x5b43cf[_0x6b8e('0x3c')]=_[_0x6b8e('0x3d')](_0x5b43cf['where'],{'$or':_[_0x6b8e('0x29')](_0x2c4888,function(_0x428a1c){if(_0x428a1c[_0x6b8e('0x3e')]!=='VIRTUAL'){var _0x35bef1={};_0x35bef1[_0x428a1c[_0x6b8e('0x26')]]={'$like':'%'+_0xd1ff36[_0x6b8e('0x2f')]['filter']+'%'};return _0x35bef1;}})});}_0x5b43cf=_['merge']({},_0x5b43cf,_0xd1ff36[_0x6b8e('0x3f')]);var _0x2ba56d={'where':_0x5b43cf[_0x6b8e('0x3c')]};return db[_0x6b8e('0x2a')][_0x6b8e('0x1d')](_0x2ba56d)[_0x6b8e('0x40')](function(_0x3b2e9f){_0x5835c9[_0x6b8e('0x1d')]=_0x3b2e9f;if(_0xd1ff36[_0x6b8e('0x2f')][_0x6b8e('0x41')]){_0x5b43cf[_0x6b8e('0x42')]=[{'all':!![]}];}return db[_0x6b8e('0x2a')][_0x6b8e('0x43')](_0x5b43cf);})[_0x6b8e('0x40')](function(_0x314dbe){_0x5835c9[_0x6b8e('0x44')]=_0x314dbe;return _0x5835c9;})[_0x6b8e('0x40')](respondWithFilteredResult(_0x52e2d2,_0x5b43cf))[_0x6b8e('0x45')](handleError(_0x52e2d2,null));};exports[_0x6b8e('0x46')]=function(_0x496562,_0x2b08a4){var _0x276c62={'raw':!![],'where':{'id':_0x496562[_0x6b8e('0x47')]['id']}},_0xf3d664={};_0xf3d664[_0x6b8e('0x2e')]=_['keys'](db[_0x6b8e('0x2a')][_0x6b8e('0x2b')]);_0xf3d664[_0x6b8e('0x2f')]=_[_0x6b8e('0x30')](_0x496562[_0x6b8e('0x2f')]);_0xf3d664['filters']=_['intersection'](_0xf3d664[_0x6b8e('0x2e')],_0xf3d664[_0x6b8e('0x2f')]);_0x276c62['attributes']=_[_0x6b8e('0x32')](_0xf3d664[_0x6b8e('0x2e')],qs[_0x6b8e('0x33')](_0x496562[_0x6b8e('0x2f')][_0x6b8e('0x33')]));_0x276c62[_0x6b8e('0x34')]=_0x276c62['attributes'][_0x6b8e('0x35')]?_0x276c62[_0x6b8e('0x34')]:_0xf3d664[_0x6b8e('0x2e')];if(_0x496562[_0x6b8e('0x2f')][_0x6b8e('0x41')]){_0x276c62[_0x6b8e('0x42')]=[{'all':!![]}];}_0x276c62=_[_0x6b8e('0x3d')]({},_0x276c62,_0x496562[_0x6b8e('0x3f')]);return db[_0x6b8e('0x2a')]['find'](_0x276c62)[_0x6b8e('0x40')](handleEntityNotFound(_0x2b08a4,null))[_0x6b8e('0x40')](respondWithResult(_0x2b08a4,null))[_0x6b8e('0x45')](handleError(_0x2b08a4,null));};exports[_0x6b8e('0x48')]=function(_0x33bc78,_0x50de6b){return db[_0x6b8e('0x2a')][_0x6b8e('0x48')](_0x33bc78[_0x6b8e('0x49')],{})[_0x6b8e('0x40')](respondWithResult(_0x50de6b,0xc9))[_0x6b8e('0x45')](handleError(_0x50de6b,null));};exports[_0x6b8e('0x4a')]=function(_0x2d7aa1,_0x5ec80a){if(_0x2d7aa1[_0x6b8e('0x49')]['id']){delete _0x2d7aa1['body']['id'];}return db[_0x6b8e('0x2a')]['find']({'where':{'id':_0x2d7aa1[_0x6b8e('0x47')]['id']}})[_0x6b8e('0x40')](handleEntityNotFound(_0x5ec80a,null))[_0x6b8e('0x40')](saveUpdates(_0x2d7aa1[_0x6b8e('0x49')],null))['then'](respondWithResult(_0x5ec80a,null))['catch'](handleError(_0x5ec80a,null));};exports[_0x6b8e('0x4b')]=function(_0x46fa4b,_0x47930b,_0x152aee){var _0x3fe94c=require(_0x6b8e('0x4c'));var _0x2bdef7=![];var _0x7e9213={};if(_0x46fa4b[_0x6b8e('0x2f')][_0x6b8e('0x3e')]&&_0x46fa4b[_0x6b8e('0x2f')][_0x6b8e('0x3e')]==='uniqueid'){_0x7e9213[_0x6b8e('0x4d')]=_0x46fa4b[_0x6b8e('0x47')]['id'];}else{_0x7e9213['id']=_0x46fa4b[_0x6b8e('0x47')]['id'];}return db['SquareRecording'][_0x6b8e('0x4e')]({'where':_0x7e9213,'attributes':['id','savePath',_0x6b8e('0x4f')],'raw':!![]})[_0x6b8e('0x40')](handleEntityNotFound(_0x47930b,null))[_0x6b8e('0x40')](function(_0x34128e){if(_0x34128e){var _0x580596=_0x34128e[_0x6b8e('0x50')];var _0x4a35f6=util['format'](_0x6b8e('0x51'),_0x580596);if(fs[_0x6b8e('0x52')](_0x4a35f6)){_0x2bdef7=!![];return _0x3fe94c[_0x6b8e('0x53')](_0x4a35f6,_0x580596,config['secrets'][_0x6b8e('0x54')])[_0x6b8e('0x40')](function(){return _0x34128e;});}return _0x34128e;}})['then'](function(_0x505600){if(_0x505600){var _0x16ad76=_0x505600[_0x6b8e('0x50')];if(!fs['existsSync'](_0x16ad76)){throw new db['Sequelize']['ValidationError'](_0x6b8e('0x55'));}if(_0x505600['filename']){return _0x47930b['download'](_0x16ad76,_0x505600['filename']+path[_0x6b8e('0x56')](_0x16ad76),function(){if(_0x2bdef7){fs['unlink'](_0x16ad76);}});}else{return _0x47930b['download'](_0x16ad76,function(_0x327c53){if(_0x2bdef7){fs[_0x6b8e('0x57')](_0x16ad76);}});}}})['catch'](function(_0x5b8f5d){if(_0x5b8f5d[_0x6b8e('0x58')]===_0x6b8e('0x55')){_0x47930b[_0x6b8e('0x18')](0x194)[_0x6b8e('0x27')]('Not\x20found');}else{return handleError(_0x47930b,null);}});};exports[_0x6b8e('0x22')]=function(_0x1cf738,_0x478a8a){return db['SquareRecording'][_0x6b8e('0x4e')]({'where':{'id':_0x1cf738[_0x6b8e('0x47')]['id']}})[_0x6b8e('0x40')](function(_0x28fb80){if(_[_0x6b8e('0x59')](_0x28fb80)){throw new ReferenceError(_0x6b8e('0x5a'));}return _0x28fb80;})[_0x6b8e('0x40')](function(_0x1e0652){var _0x22fc1f=_0x1e0652[_0x6b8e('0x50')];logger[_0x6b8e('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x22fc1f);if(!_[_0x6b8e('0x59')](_0x1e0652[_0x6b8e('0x50')])&&fs['existsSync'](_0x22fc1f)){logger[_0x6b8e('0x5b')]('File:\x20\x22'+_0x22fc1f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6b8e('0x5c')](_0x22fc1f);}_0x22fc1f=_0x22fc1f+_0x6b8e('0x5d');if(!_[_0x6b8e('0x59')](_0x1e0652[_0x6b8e('0x50')])&&fs[_0x6b8e('0x52')](_0x22fc1f)){logger[_0x6b8e('0x5b')](_0x6b8e('0x5e')+_0x22fc1f+_0x6b8e('0x5f'));fs[_0x6b8e('0x5c')](_0x22fc1f);}return _0x1e0652;})[_0x6b8e('0x40')](function(_0x45686a){if(!_0x45686a)throw new InternalError();return _0x45686a[_0x6b8e('0x22')]();})['then'](function(){_0x478a8a[_0x6b8e('0x18')](0xcc)[_0x6b8e('0x23')]();})[_0x6b8e('0x45')](handleError(_0x478a8a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 510dfbc..11671f9 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 _0xfbbb=['exports','define','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2fedda,_0x1b8df7){var _0x19ffc2=function(_0x2ac171){while(--_0x2ac171){_0x2fedda['push'](_0x2fedda['shift']());}};_0x19ffc2(++_0x1b8df7);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x13beb9,_0x1f14c9){_0x13beb9=_0x13beb9-0x0;var _0xa3df3d=_0xfbbb[_0x13beb9];return _0xa3df3d;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var logger=require(_0xbfbb('0x2'))(_0xbfbb('0x3'));var moment=require(_0xbfbb('0x4'));var BPromise=require(_0xbfbb('0x5'));var rp=require(_0xbfbb('0x6'));var fs=require('fs');var path=require(_0xbfbb('0x7'));var rimraf=require(_0xbfbb('0x8'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xbfbb('0x9')]=function(_0x568492,_0x89ee36){return _0x568492[_0xbfbb('0xa')](_0xbfbb('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x073d=['square_recordings','util','../../config/logger','api','bluebird','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x2155a4,_0x496665){var _0x50099c=function(_0x54aaef){while(--_0x54aaef){_0x2155a4['push'](_0x2155a4['shift']());}};_0x50099c(++_0x496665);}(_0x073d,0xd2));var _0xd073=function(_0x4e7fbe,_0x585460){_0x4e7fbe=_0x4e7fbe-0x0;var _0x2e2277=_0x073d[_0x4e7fbe];return _0x2e2277;};'use strict';var _=require('lodash');var util=require(_0xd073('0x0'));var logger=require(_0xd073('0x1'))(_0xd073('0x2'));var moment=require('moment');var BPromise=require(_0xd073('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd073('0x4'));var rimraf=require(_0xd073('0x5'));var config=require('../../config/environment');var attributes=require(_0xd073('0x6'));module[_0xd073('0x7')]=function(_0x1799b8,_0x1fdaeb){return _0x1799b8[_0xd073('0x8')](_0xd073('0x9'),attributes,{'tableName':_0xd073('0xa'),'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 2cfdcb2..7f4c48d 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 _0x8d9f=['client','then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','CreateSquareRecording','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2422ca,_0x5b4fac){var _0x23d310=function(_0x1e4c50){while(--_0x1e4c50){_0x2422ca['push'](_0x2422ca['shift']());}};_0x23d310(++_0x5b4fac);}(_0x8d9f,0xb6));var _0xf8d9=function(_0x400401,_0x30dbcf){_0x400401=_0x400401-0x0;var _0x345c39=_0x8d9f[_0x400401];return _0x345c39;};'use strict';var _=require('lodash');var util=require(_0xf8d9('0x0'));var moment=require(_0xf8d9('0x1'));var BPromise=require(_0xf8d9('0x2'));var rs=require(_0xf8d9('0x3'));var fs=require('fs');var Redis=require(_0xf8d9('0x4'));var db=require(_0xf8d9('0x5'))['db'];var utils=require(_0xf8d9('0x6'));var logger=require(_0xf8d9('0x7'))('rpc');var config=require(_0xf8d9('0x8'));var jayson=require(_0xf8d9('0x9'));var client=jayson[_0xf8d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5246bd,_0x19ef3d,_0xe88ebb){return new BPromise(function(_0x571719,_0x2b1ee8){return client['request'](_0x5246bd,_0xe88ebb)[_0xf8d9('0xb')](function(_0x50636c){logger[_0xf8d9('0xc')](_0xf8d9('0xd'),_0x19ef3d,'request\x20sent');logger[_0xf8d9('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x19ef3d,_0xf8d9('0xf'),JSON[_0xf8d9('0x10')](_0x50636c));if(_0x50636c[_0xf8d9('0x11')]){if(_0x50636c[_0xf8d9('0x11')]['code']===0x1f4){logger[_0xf8d9('0x11')](_0xf8d9('0xd'),_0x19ef3d,_0x50636c[_0xf8d9('0x11')]['message']);return _0x2b1ee8(_0x50636c['error'][_0xf8d9('0x12')]);}logger[_0xf8d9('0x11')]('SquareRecording,\x20%s,\x20%s',_0x19ef3d,_0x50636c[_0xf8d9('0x11')][_0xf8d9('0x12')]);return _0x571719(_0x50636c[_0xf8d9('0x11')][_0xf8d9('0x12')]);}else{logger[_0xf8d9('0xc')](_0xf8d9('0xd'),_0x19ef3d,_0xf8d9('0xf'));_0x571719(_0x50636c[_0xf8d9('0x13')][_0xf8d9('0x12')]);}})['catch'](function(_0xf08bdf){logger['error'](_0xf8d9('0xd'),_0x19ef3d,_0xf08bdf);_0x2b1ee8(_0xf08bdf);});});}exports[_0xf8d9('0x14')]=function(_0x594c46){var _0x467940=this;return new Promise(function(_0x450efb,_0x13a213){return db['SquareRecording'][_0xf8d9('0x15')](_0x594c46['body'],{'raw':_0x594c46[_0xf8d9('0x16')]?_0x594c46['options'][_0xf8d9('0x17')]===undefined?!![]:![]:!![]})[_0xf8d9('0xb')](function(_0x1961b1){logger[_0xf8d9('0xc')]('CreateSquareRecording',_0x594c46);logger['debug'](_0xf8d9('0x14'),_0x594c46,JSON[_0xf8d9('0x10')](_0x1961b1));_0x450efb(_0x1961b1);})['catch'](function(_0x3b97e1){logger[_0xf8d9('0x11')](_0xf8d9('0x14'),_0x3b97e1[_0xf8d9('0x12')],_0x594c46);_0x13a213(_0x467940[_0xf8d9('0x11')](0x1f4,_0x3b97e1[_0xf8d9('0x12')]));});});}; \ No newline at end of file +var _0xd77e=['debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','SquareRecording,\x20%s,\x20%s','message','info','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then'];(function(_0x11de5a,_0xc10c6c){var _0x217f88=function(_0x11c3fa){while(--_0x11c3fa){_0x11de5a['push'](_0x11de5a['shift']());}};_0x217f88(++_0xc10c6c);}(_0xd77e,0x151));var _0xed77=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd77e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed77('0x0'));var BPromise=require(_0xed77('0x1'));var rs=require(_0xed77('0x2'));var fs=require('fs');var Redis=require(_0xed77('0x3'));var db=require(_0xed77('0x4'))['db'];var utils=require(_0xed77('0x5'));var logger=require(_0xed77('0x6'))(_0xed77('0x7'));var config=require(_0xed77('0x8'));var jayson=require(_0xed77('0x9'));var client=jayson[_0xed77('0xa')][_0xed77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ca1fe,_0x4386f7,_0x47142d){return new BPromise(function(_0x119b66,_0x387de7){return client[_0xed77('0xc')](_0x4ca1fe,_0x47142d)['then'](function(_0x25aef4){logger['info']('SquareRecording,\x20%s,\x20%s',_0x4386f7,'request\x20sent');logger['debug'](_0xed77('0xd'),_0x4386f7,_0xed77('0xe'),JSON['stringify'](_0x25aef4));if(_0x25aef4[_0xed77('0xf')]){if(_0x25aef4[_0xed77('0xf')]['code']===0x1f4){logger[_0xed77('0xf')](_0xed77('0x10'),_0x4386f7,_0x25aef4[_0xed77('0xf')]['message']);return _0x387de7(_0x25aef4['error']['message']);}logger[_0xed77('0xf')](_0xed77('0x10'),_0x4386f7,_0x25aef4[_0xed77('0xf')][_0xed77('0x11')]);return _0x119b66(_0x25aef4[_0xed77('0xf')][_0xed77('0x11')]);}else{logger[_0xed77('0x12')](_0xed77('0x10'),_0x4386f7,_0xed77('0xe'));_0x119b66(_0x25aef4[_0xed77('0x13')][_0xed77('0x11')]);}})[_0xed77('0x14')](function(_0x37e6d3){logger[_0xed77('0xf')](_0xed77('0x10'),_0x4386f7,_0x37e6d3);_0x387de7(_0x37e6d3);});});}exports[_0xed77('0x15')]=function(_0x3bfead){var _0x52753f=this;return new Promise(function(_0x1585e0,_0x4b2063){return db[_0xed77('0x16')]['create'](_0x3bfead[_0xed77('0x17')],{'raw':_0x3bfead[_0xed77('0x18')]?_0x3bfead[_0xed77('0x18')][_0xed77('0x19')]===undefined?!![]:![]:!![]})[_0xed77('0x1a')](function(_0x51411e){logger[_0xed77('0x12')](_0xed77('0x15'),_0x3bfead);logger[_0xed77('0x1b')](_0xed77('0x15'),_0x3bfead,JSON['stringify'](_0x51411e));_0x1585e0(_0x51411e);})[_0xed77('0x14')](function(_0x1075b1){logger[_0xed77('0xf')]('CreateSquareRecording',_0x1075b1['message'],_0x3bfead);_0x4b2063(_0x52753f[_0xed77('0xf')](0x1f4,_0x1075b1[_0xed77('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 4e7e52c..7464a36 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0xedf0ce,_0x1f1114){var _0x2afffc=function(_0x523c4e){while(--_0x523c4e){_0xedf0ce['push'](_0xedf0ce['shift']());}};_0x2afffc(++_0x1f1114);}(_0xe706,0xa3));var _0x6e70=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0xe706[_0x3fbb91];return _0x3eb213;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x3937ff,_0x5e939c){var _0x249d90=function(_0xc8a6a1){while(--_0xc8a6a1){_0x3937ff['push'](_0x3937ff['shift']());}};_0x249d90(++_0x5e939c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3de195f..f587f7f 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 _0xae21=['DATE','BOOLEAN','exports','STRING'];(function(_0x4bd489,_0x559d05){var _0x48eaf1=function(_0x5143d0){while(--_0x5143d0){_0x4bd489['push'](_0x4bd489['shift']());}};_0x48eaf1(++_0x559d05);}(_0xae21,0x142));var _0x1ae2=function(_0x15edb3,_0x4f4dc3){_0x15edb3=_0x15edb3-0x0;var _0x3a0e7b=_0xae21[_0x15edb3];return _0x3a0e7b;};'use strict';var Sequelize=require('sequelize');module[_0x1ae2('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x1ae2('0x1')]},'request':{'type':Sequelize[_0x1ae2('0x1')]},'channel':{'type':Sequelize[_0x1ae2('0x1')]},'language':{'type':Sequelize[_0x1ae2('0x1')]},'type':{'type':Sequelize[_0x1ae2('0x1')]},'uniqueid':{'type':Sequelize[_0x1ae2('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1ae2('0x1')]},'calleridname':{'type':Sequelize[_0x1ae2('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x1ae2('0x1')]},'callington':{'type':Sequelize[_0x1ae2('0x1')]},'callingtns':{'type':Sequelize[_0x1ae2('0x1')]},'dnid':{'type':Sequelize[_0x1ae2('0x1')]},'rdnis':{'type':Sequelize[_0x1ae2('0x1')]},'context':{'type':Sequelize[_0x1ae2('0x1')]},'extension':{'type':Sequelize[_0x1ae2('0x1')]},'priority':{'type':Sequelize[_0x1ae2('0x1')]},'enhanced':{'type':Sequelize[_0x1ae2('0x1')]},'accountcode':{'type':Sequelize[_0x1ae2('0x1')]},'threadid':{'type':Sequelize[_0x1ae2('0x1')]},'project_name':{'type':Sequelize[_0x1ae2('0x1')]},'joinAt':{'type':Sequelize[_0x1ae2('0x2')]},'leaveAt':{'type':Sequelize[_0x1ae2('0x2')]},'bot':{'type':Sequelize[_0x1ae2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x138e=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x421676,_0x56f8fa){var _0x4b5d3d=function(_0x326749){while(--_0x326749){_0x421676['push'](_0x421676['shift']());}};_0x4b5d3d(++_0x56f8fa);}(_0x138e,0x109));var _0xe138=function(_0x337bbd,_0x5f2fa5){_0x337bbd=_0x337bbd-0x0;var _0x4b4767=_0x138e[_0x337bbd];return _0x4b4767;};'use strict';var Sequelize=require(_0xe138('0x0'));module[_0xe138('0x1')]={'network':{'type':Sequelize[_0xe138('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xe138('0x2')]},'channel':{'type':Sequelize[_0xe138('0x2')]},'language':{'type':Sequelize[_0xe138('0x2')]},'type':{'type':Sequelize[_0xe138('0x2')]},'uniqueid':{'type':Sequelize[_0xe138('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe138('0x2')]},'calleridname':{'type':Sequelize[_0xe138('0x2')]},'callingpres':{'type':Sequelize[_0xe138('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xe138('0x2')]},'callingtns':{'type':Sequelize[_0xe138('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xe138('0x2')]},'context':{'type':Sequelize[_0xe138('0x2')]},'extension':{'type':Sequelize[_0xe138('0x2')]},'priority':{'type':Sequelize[_0xe138('0x2')]},'enhanced':{'type':Sequelize[_0xe138('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xe138('0x2')]},'project_name':{'type':Sequelize[_0xe138('0x2')]},'joinAt':{'type':Sequelize[_0xe138('0x3')]},'leaveAt':{'type':Sequelize[_0xe138('0x3')]},'bot':{'type':Sequelize[_0xe138('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 00045f9..ee7eb1c 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 _0x3476=['merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','destroy','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','status','error','stack','name','send','index','map','SquareReport','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter'];(function(_0xd6bb26,_0x63ff2){var _0x122866=function(_0x4e0feb){while(--_0x4e0feb){_0xd6bb26['push'](_0xd6bb26['shift']());}};_0x122866(++_0x63ff2);}(_0x3476,0x1ce));var _0x6347=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x3476[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6347('0x0'));var rp=require('request-promise');var moment=require(_0x6347('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6347('0x2'));var util=require(_0x6347('0x3'));var path=require(_0x6347('0x4'));var sox=require(_0x6347('0x5'));var csv=require(_0x6347('0x6'));var ejs=require(_0x6347('0x7'));var fs=require('fs');var fs_extra=require(_0x6347('0x8'));var _=require(_0x6347('0x9'));var squel=require(_0x6347('0xa'));var crypto=require(_0x6347('0xb'));var jsforce=require(_0x6347('0xc'));var deskjs=require(_0x6347('0xd'));var toCsv=require(_0x6347('0x6'));var querystring=require(_0x6347('0xe'));var Papa=require('papaparse');var Redis=require(_0x6347('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6347('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6347('0x11'));var logger=require(_0x6347('0x12'))(_0x6347('0x13'));var utils=require(_0x6347('0x14'));var config=require(_0x6347('0x15'));var licenseUtil=require(_0x6347('0x16'));var db=require(_0x6347('0x17'))['db'];function respondWithStatusCode(_0x155f55,_0xbe8aff){_0xbe8aff=_0xbe8aff||0xcc;return function(_0x5399f7){if(_0x5399f7){return _0x155f55[_0x6347('0x18')](_0xbe8aff);}return _0x155f55['status'](_0xbe8aff)['end']();};}function respondWithResult(_0x36dd35,_0x42262f){_0x42262f=_0x42262f||0xc8;return function(_0x52e088){if(_0x52e088){return _0x36dd35['status'](_0x42262f)[_0x6347('0x19')](_0x52e088);}};}function respondWithFilteredResult(_0x37db90,_0x31ece6){return function(_0xcec8f9){if(_0xcec8f9){var _0x241044=typeof _0x31ece6[_0x6347('0x1a')]===_0x6347('0x1b')&&typeof _0x31ece6[_0x6347('0x1c')]===_0x6347('0x1b');var _0x25f010=_0xcec8f9[_0x6347('0x1d')];var _0x3a1678=_0x241044?0x0:_0x31ece6['offset'];var _0x5aeccd=_0x241044?_0xcec8f9[_0x6347('0x1d')]:_0x31ece6['offset']+_0x31ece6[_0x6347('0x1c')];var _0x190d56;if(_0x5aeccd>=_0x25f010){_0x5aeccd=_0x25f010;_0x190d56=0xc8;}else{_0x190d56=0xce;}_0x37db90['status'](_0x190d56);return _0x37db90[_0x6347('0x1e')](_0x6347('0x1f'),_0x3a1678+'-'+_0x5aeccd+'/'+_0x25f010)[_0x6347('0x19')](_0xcec8f9);}return null;};}function patchUpdates(_0x5e61b8){return function(_0x1043a0){try{jsonpatch[_0x6347('0x20')](_0x1043a0,_0x5e61b8,!![]);}catch(_0x373b35){return BPromise[_0x6347('0x21')](_0x373b35);}return _0x1043a0[_0x6347('0x22')]();};}function saveUpdates(_0x8ccf2b,_0x54accc){return function(_0x32a66d){if(_0x32a66d){return _0x32a66d[_0x6347('0x23')](_0x8ccf2b)['then'](function(_0x47abb6){return _0x47abb6;});}return null;};}function removeEntity(_0x348ee6,_0x1214f9){return function(_0x37e728){if(_0x37e728){return _0x37e728['destroy']()[_0x6347('0x24')](function(){_0x348ee6[_0x6347('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6d06,_0x193e7d){return function(_0x1d81ad){if(!_0x1d81ad){_0x2d6d06['sendStatus'](0x194);}return _0x1d81ad;};}function handleError(_0x30de95,_0x229dcd){_0x229dcd=_0x229dcd||0x1f4;return function(_0x1fe181){logger[_0x6347('0x26')](_0x1fe181[_0x6347('0x27')]);if(_0x1fe181[_0x6347('0x28')]){delete _0x1fe181['name'];}_0x30de95[_0x6347('0x25')](_0x229dcd)[_0x6347('0x29')](_0x1fe181);};}exports[_0x6347('0x2a')]=function(_0x5dadca,_0x5a9ab9){var _0x19d192={},_0x55515d={},_0x25b698={'count':0x0,'rows':[]};var _0x16398c=_[_0x6347('0x2b')](db[_0x6347('0x2c')]['rawAttributes'],function(_0x56439f){return{'name':_0x56439f[_0x6347('0x2d')],'type':_0x56439f[_0x6347('0x2e')]['key']};});_0x55515d[_0x6347('0x2f')]=_[_0x6347('0x2b')](_0x16398c,_0x6347('0x28'));_0x55515d[_0x6347('0x30')]=_[_0x6347('0x31')](_0x5dadca[_0x6347('0x30')]);_0x55515d['filters']=_[_0x6347('0x32')](_0x55515d['model'],_0x55515d[_0x6347('0x30')]);_0x19d192[_0x6347('0x33')]=_[_0x6347('0x32')](_0x55515d['model'],qs[_0x6347('0x34')](_0x5dadca[_0x6347('0x30')][_0x6347('0x34')]));_0x19d192[_0x6347('0x33')]=_0x19d192[_0x6347('0x33')][_0x6347('0x35')]?_0x19d192[_0x6347('0x33')]:_0x55515d[_0x6347('0x2f')];if(!_0x5dadca[_0x6347('0x30')][_0x6347('0x36')](_0x6347('0x37'))){_0x19d192['limit']=qs[_0x6347('0x1c')](_0x5dadca[_0x6347('0x30')][_0x6347('0x1c')]);_0x19d192[_0x6347('0x1a')]=qs[_0x6347('0x1a')](_0x5dadca[_0x6347('0x30')][_0x6347('0x1a')]);}_0x19d192[_0x6347('0x38')]=qs[_0x6347('0x39')](_0x5dadca[_0x6347('0x30')][_0x6347('0x39')]);_0x19d192['where']=qs[_0x6347('0x3a')](_[_0x6347('0x3b')](_0x5dadca[_0x6347('0x30')],_0x55515d['filters']),_0x16398c);if(_0x5dadca[_0x6347('0x30')]['filter']){_0x19d192[_0x6347('0x3c')]=_['merge'](_0x19d192[_0x6347('0x3c')],{'$or':_[_0x6347('0x2b')](_0x16398c,function(_0x166d7d){if(_0x166d7d[_0x6347('0x2e')]!==_0x6347('0x3d')){var _0x570911={};_0x570911[_0x166d7d[_0x6347('0x28')]]={'$like':'%'+_0x5dadca[_0x6347('0x30')][_0x6347('0x3e')]+'%'};return _0x570911;}})});}_0x19d192=_[_0x6347('0x3f')]({},_0x19d192,_0x5dadca['options']);var _0x596e07={'where':_0x19d192[_0x6347('0x3c')]};return db[_0x6347('0x2c')][_0x6347('0x1d')](_0x596e07)[_0x6347('0x24')](function(_0x45b482){_0x25b698[_0x6347('0x1d')]=_0x45b482;if(_0x5dadca[_0x6347('0x30')]['includeAll']){_0x19d192[_0x6347('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0x6347('0x41')](_0x19d192);})[_0x6347('0x24')](function(_0x50946e){_0x25b698[_0x6347('0x42')]=_0x50946e;return _0x25b698;})[_0x6347('0x24')](respondWithFilteredResult(_0x5a9ab9,_0x19d192))[_0x6347('0x43')](handleError(_0x5a9ab9,null));};exports['show']=function(_0x4d5dd3,_0x2bbebe){var _0x1563a9={'raw':!![],'where':{'id':_0x4d5dd3[_0x6347('0x44')]['id']}},_0x14c6d3={};_0x14c6d3[_0x6347('0x2f')]=_['keys'](db[_0x6347('0x2c')]['rawAttributes']);_0x14c6d3[_0x6347('0x30')]=_[_0x6347('0x31')](_0x4d5dd3[_0x6347('0x30')]);_0x14c6d3[_0x6347('0x3a')]=_['intersection'](_0x14c6d3[_0x6347('0x2f')],_0x14c6d3[_0x6347('0x30')]);_0x1563a9[_0x6347('0x33')]=_['intersection'](_0x14c6d3[_0x6347('0x2f')],qs['fields'](_0x4d5dd3[_0x6347('0x30')]['fields']));_0x1563a9[_0x6347('0x33')]=_0x1563a9[_0x6347('0x33')][_0x6347('0x35')]?_0x1563a9[_0x6347('0x33')]:_0x14c6d3[_0x6347('0x2f')];if(_0x4d5dd3['query'][_0x6347('0x45')]){_0x1563a9[_0x6347('0x40')]=[{'all':!![]}];}_0x1563a9=_[_0x6347('0x3f')]({},_0x1563a9,_0x4d5dd3[_0x6347('0x46')]);return db['SquareReport'][_0x6347('0x47')](_0x1563a9)[_0x6347('0x24')](handleEntityNotFound(_0x2bbebe,null))[_0x6347('0x24')](respondWithResult(_0x2bbebe,null))[_0x6347('0x43')](handleError(_0x2bbebe,null));};exports[_0x6347('0x48')]=function(_0x3f6e04,_0x1d404c){return db['SquareReport']['create'](_0x3f6e04[_0x6347('0x49')],{})[_0x6347('0x24')](respondWithResult(_0x1d404c,0xc9))[_0x6347('0x43')](handleError(_0x1d404c,null));};exports[_0x6347('0x23')]=function(_0x200865,_0x2cb6a9){if(_0x200865[_0x6347('0x49')]['id']){delete _0x200865[_0x6347('0x49')]['id'];}return db[_0x6347('0x2c')][_0x6347('0x47')]({'where':{'id':_0x200865[_0x6347('0x44')]['id']}})[_0x6347('0x24')](handleEntityNotFound(_0x2cb6a9,null))['then'](saveUpdates(_0x200865[_0x6347('0x49')],null))[_0x6347('0x24')](respondWithResult(_0x2cb6a9,null))[_0x6347('0x43')](handleError(_0x2cb6a9,null));};exports[_0x6347('0x4a')]=function(_0x4aa308,_0x3beb62){return db[_0x6347('0x2c')][_0x6347('0x47')]({'where':{'id':_0x4aa308[_0x6347('0x44')]['id']}})[_0x6347('0x24')](handleEntityNotFound(_0x3beb62,null))[_0x6347('0x24')](removeEntity(_0x3beb62,null))[_0x6347('0x43')](handleError(_0x3beb62,null));};exports['describe']=function(_0x6598c6,_0x238291){return db[_0x6347('0x2c')]['describe']()[_0x6347('0x24')](respondWithResult(_0x238291,null))['catch'](handleError(_0x238291,null));}; \ No newline at end of file +var _0x08a5=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','name','send','index','SquareReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','options','include','findAll','catch','show','params','model','length','includeAll','create','update','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse'];(function(_0x1e68ef,_0xbbdc1f){var _0xf5cc5a=function(_0x506e05){while(--_0x506e05){_0x1e68ef['push'](_0x1e68ef['shift']());}};_0xf5cc5a(++_0xbbdc1f);}(_0x08a5,0x19b));var _0x508a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x508a('0x0'));var rimraf=require(_0x508a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x508a('0x2'));var rp=require('request-promise');var moment=require(_0x508a('0x3'));var BPromise=require(_0x508a('0x4'));var Mustache=require('mustache');var util=require(_0x508a('0x5'));var path=require(_0x508a('0x6'));var sox=require('sox');var csv=require(_0x508a('0x7'));var ejs=require(_0x508a('0x8'));var fs=require('fs');var fs_extra=require(_0x508a('0x9'));var _=require(_0x508a('0xa'));var squel=require(_0x508a('0xb'));var crypto=require(_0x508a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x508a('0x7'));var querystring=require(_0x508a('0xd'));var Papa=require(_0x508a('0xe'));var Redis=require(_0x508a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x508a('0x10'));var as=require(_0x508a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x508a('0x12'));var utils=require(_0x508a('0x13'));var config=require(_0x508a('0x14'));var licenseUtil=require(_0x508a('0x15'));var db=require(_0x508a('0x16'))['db'];function respondWithStatusCode(_0x49c6d4,_0x577e9d){_0x577e9d=_0x577e9d||0xcc;return function(_0x4bfb56){if(_0x4bfb56){return _0x49c6d4[_0x508a('0x17')](_0x577e9d);}return _0x49c6d4[_0x508a('0x18')](_0x577e9d)[_0x508a('0x19')]();};}function respondWithResult(_0x4e2567,_0x1d1213){_0x1d1213=_0x1d1213||0xc8;return function(_0x40ae40){if(_0x40ae40){return _0x4e2567[_0x508a('0x18')](_0x1d1213)[_0x508a('0x1a')](_0x40ae40);}};}function respondWithFilteredResult(_0x1be416,_0x4c4d32){return function(_0x5bdeff){if(_0x5bdeff){var _0x241c89=typeof _0x4c4d32[_0x508a('0x1b')]===_0x508a('0x1c')&&typeof _0x4c4d32['limit']===_0x508a('0x1c');var _0x480246=_0x5bdeff[_0x508a('0x1d')];var _0x3aac7d=_0x241c89?0x0:_0x4c4d32[_0x508a('0x1b')];var _0x304b25=_0x241c89?_0x5bdeff['count']:_0x4c4d32[_0x508a('0x1b')]+_0x4c4d32[_0x508a('0x1e')];var _0x640cad;if(_0x304b25>=_0x480246){_0x304b25=_0x480246;_0x640cad=0xc8;}else{_0x640cad=0xce;}_0x1be416[_0x508a('0x18')](_0x640cad);return _0x1be416[_0x508a('0x1f')](_0x508a('0x20'),_0x3aac7d+'-'+_0x304b25+'/'+_0x480246)['json'](_0x5bdeff);}return null;};}function patchUpdates(_0x15afa2){return function(_0x4f6db1){try{jsonpatch[_0x508a('0x21')](_0x4f6db1,_0x15afa2,!![]);}catch(_0x10bdd9){return BPromise['reject'](_0x10bdd9);}return _0x4f6db1[_0x508a('0x22')]();};}function saveUpdates(_0x54e9c5,_0x47afc0){return function(_0xf397f1){if(_0xf397f1){return _0xf397f1['update'](_0x54e9c5)[_0x508a('0x23')](function(_0xeff9b9){return _0xeff9b9;});}return null;};}function removeEntity(_0x573a72,_0x4f2fd7){return function(_0x4a1cbe){if(_0x4a1cbe){return _0x4a1cbe[_0x508a('0x24')]()['then'](function(){_0x573a72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x304b1d,_0x12807e){return function(_0x45e2ed){if(!_0x45e2ed){_0x304b1d[_0x508a('0x17')](0x194);}return _0x45e2ed;};}function handleError(_0x57eb02,_0x5d7585){_0x5d7585=_0x5d7585||0x1f4;return function(_0x5cf3dd){logger['error'](_0x5cf3dd['stack']);if(_0x5cf3dd[_0x508a('0x25')]){delete _0x5cf3dd[_0x508a('0x25')];}_0x57eb02[_0x508a('0x18')](_0x5d7585)[_0x508a('0x26')](_0x5cf3dd);};}exports[_0x508a('0x27')]=function(_0xf73c6b,_0x266955){var _0x2c088d={},_0x81a4b3={},_0x5d036c={'count':0x0,'rows':[]};var _0x1662a3=_['map'](db[_0x508a('0x28')][_0x508a('0x29')],function(_0x149b04){return{'name':_0x149b04[_0x508a('0x2a')],'type':_0x149b04[_0x508a('0x2b')][_0x508a('0x2c')]};});_0x81a4b3['model']=_[_0x508a('0x2d')](_0x1662a3,_0x508a('0x25'));_0x81a4b3['query']=_[_0x508a('0x2e')](_0xf73c6b[_0x508a('0x2f')]);_0x81a4b3[_0x508a('0x30')]=_[_0x508a('0x31')](_0x81a4b3['model'],_0x81a4b3['query']);_0x2c088d[_0x508a('0x32')]=_[_0x508a('0x31')](_0x81a4b3['model'],qs[_0x508a('0x33')](_0xf73c6b[_0x508a('0x2f')][_0x508a('0x33')]));_0x2c088d[_0x508a('0x32')]=_0x2c088d[_0x508a('0x32')]['length']?_0x2c088d['attributes']:_0x81a4b3['model'];if(!_0xf73c6b[_0x508a('0x2f')]['hasOwnProperty'](_0x508a('0x34'))){_0x2c088d[_0x508a('0x1e')]=qs['limit'](_0xf73c6b[_0x508a('0x2f')]['limit']);_0x2c088d[_0x508a('0x1b')]=qs[_0x508a('0x1b')](_0xf73c6b['query']['offset']);}_0x2c088d['order']=qs[_0x508a('0x35')](_0xf73c6b[_0x508a('0x2f')][_0x508a('0x35')]);_0x2c088d[_0x508a('0x36')]=qs[_0x508a('0x30')](_[_0x508a('0x37')](_0xf73c6b[_0x508a('0x2f')],_0x81a4b3[_0x508a('0x30')]),_0x1662a3);if(_0xf73c6b[_0x508a('0x2f')]['filter']){_0x2c088d[_0x508a('0x36')]=_[_0x508a('0x38')](_0x2c088d[_0x508a('0x36')],{'$or':_[_0x508a('0x2d')](_0x1662a3,function(_0x35fb5a){if(_0x35fb5a['type']!=='VIRTUAL'){var _0x2521e8={};_0x2521e8[_0x35fb5a[_0x508a('0x25')]]={'$like':'%'+_0xf73c6b[_0x508a('0x2f')]['filter']+'%'};return _0x2521e8;}})});}_0x2c088d=_[_0x508a('0x38')]({},_0x2c088d,_0xf73c6b[_0x508a('0x39')]);var _0x5b5a1f={'where':_0x2c088d['where']};return db[_0x508a('0x28')][_0x508a('0x1d')](_0x5b5a1f)['then'](function(_0x5ca2af){_0x5d036c[_0x508a('0x1d')]=_0x5ca2af;if(_0xf73c6b[_0x508a('0x2f')]['includeAll']){_0x2c088d[_0x508a('0x3a')]=[{'all':!![]}];}return db[_0x508a('0x28')][_0x508a('0x3b')](_0x2c088d);})[_0x508a('0x23')](function(_0x1dbba1){_0x5d036c['rows']=_0x1dbba1;return _0x5d036c;})['then'](respondWithFilteredResult(_0x266955,_0x2c088d))[_0x508a('0x3c')](handleError(_0x266955,null));};exports[_0x508a('0x3d')]=function(_0x253852,_0x5db285){var _0x2f2068={'raw':!![],'where':{'id':_0x253852[_0x508a('0x3e')]['id']}},_0x3ef702={};_0x3ef702[_0x508a('0x3f')]=_['keys'](db['SquareReport'][_0x508a('0x29')]);_0x3ef702[_0x508a('0x2f')]=_['keys'](_0x253852[_0x508a('0x2f')]);_0x3ef702['filters']=_[_0x508a('0x31')](_0x3ef702[_0x508a('0x3f')],_0x3ef702[_0x508a('0x2f')]);_0x2f2068['attributes']=_[_0x508a('0x31')](_0x3ef702[_0x508a('0x3f')],qs[_0x508a('0x33')](_0x253852[_0x508a('0x2f')][_0x508a('0x33')]));_0x2f2068['attributes']=_0x2f2068[_0x508a('0x32')][_0x508a('0x40')]?_0x2f2068['attributes']:_0x3ef702[_0x508a('0x3f')];if(_0x253852['query'][_0x508a('0x41')]){_0x2f2068[_0x508a('0x3a')]=[{'all':!![]}];}_0x2f2068=_[_0x508a('0x38')]({},_0x2f2068,_0x253852[_0x508a('0x39')]);return db['SquareReport']['find'](_0x2f2068)['then'](handleEntityNotFound(_0x5db285,null))['then'](respondWithResult(_0x5db285,null))['catch'](handleError(_0x5db285,null));};exports['create']=function(_0x19ed3c,_0x4dd4a6){return db['SquareReport'][_0x508a('0x42')](_0x19ed3c['body'],{})[_0x508a('0x23')](respondWithResult(_0x4dd4a6,0xc9))[_0x508a('0x3c')](handleError(_0x4dd4a6,null));};exports[_0x508a('0x43')]=function(_0x19c78a,_0x283009){if(_0x19c78a['body']['id']){delete _0x19c78a[_0x508a('0x44')]['id'];}return db[_0x508a('0x28')][_0x508a('0x45')]({'where':{'id':_0x19c78a['params']['id']}})[_0x508a('0x23')](handleEntityNotFound(_0x283009,null))['then'](saveUpdates(_0x19c78a['body'],null))[_0x508a('0x23')](respondWithResult(_0x283009,null))[_0x508a('0x3c')](handleError(_0x283009,null));};exports[_0x508a('0x24')]=function(_0x405364,_0x29e019){return db[_0x508a('0x28')][_0x508a('0x45')]({'where':{'id':_0x405364[_0x508a('0x3e')]['id']}})[_0x508a('0x23')](handleEntityNotFound(_0x29e019,null))['then'](removeEntity(_0x29e019,null))[_0x508a('0x3c')](handleError(_0x29e019,null));};exports[_0x508a('0x46')]=function(_0x33b786,_0x4cae44){return db[_0x508a('0x28')][_0x508a('0x46')]()[_0x508a('0x23')](respondWithResult(_0x4cae44,null))[_0x508a('0x3c')](handleError(_0x4cae44,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index cb6d385..b13641d 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 _0xda90=['rimraf','../../config/environment','exports','define','SquareReport','report_square','uniqueid','leaveAt','util','api','moment','bluebird','request-promise','path'];(function(_0x1d593b,_0x3f675a){var _0x5e0082=function(_0x410bd7){while(--_0x410bd7){_0x1d593b['push'](_0x1d593b['shift']());}};_0x5e0082(++_0x3f675a);}(_0xda90,0x1e4));var _0x0da9=function(_0x46b24f,_0x3cc2e9){_0x46b24f=_0x46b24f-0x0;var _0x246927=_0xda90[_0x46b24f];return _0x246927;};'use strict';var _=require('lodash');var util=require(_0x0da9('0x0'));var logger=require('../../config/logger')(_0x0da9('0x1'));var moment=require(_0x0da9('0x2'));var BPromise=require(_0x0da9('0x3'));var rp=require(_0x0da9('0x4'));var fs=require('fs');var path=require(_0x0da9('0x5'));var rimraf=require(_0x0da9('0x6'));var config=require(_0x0da9('0x7'));var attributes=require('./squareReport.attributes');module[_0x0da9('0x8')]=function(_0x132d81,_0x4700ce){return _0x132d81[_0x0da9('0x9')](_0x0da9('0xa'),attributes,{'tableName':_0x0da9('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x0da9('0xc'),'project_name']},{'name':_0x0da9('0xd'),'fields':[_0x0da9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3087=['exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','api','moment','request-promise','path','rimraf','./squareReport.attributes'];(function(_0x244f5d,_0x3c98c6){var _0x1a3886=function(_0x2bf049){while(--_0x2bf049){_0x244f5d['push'](_0x244f5d['shift']());}};_0x1a3886(++_0x3c98c6);}(_0x3087,0x85));var _0x7308=function(_0x96d9b7,_0x219fcd){_0x96d9b7=_0x96d9b7-0x0;var _0x50d66c=_0x3087[_0x96d9b7];return _0x50d66c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7308('0x0'))(_0x7308('0x1'));var moment=require(_0x7308('0x2'));var BPromise=require('bluebird');var rp=require(_0x7308('0x3'));var fs=require('fs');var path=require(_0x7308('0x4'));var rimraf=require(_0x7308('0x5'));var config=require('../../config/environment');var attributes=require(_0x7308('0x6'));module[_0x7308('0x7')]=function(_0x49395b,_0x56b077){return _0x49395b[_0x7308('0x8')]('SquareReport',attributes,{'tableName':_0x7308('0x9'),'paranoid':![],'indexes':[{'name':_0x7308('0xa'),'fields':[_0x7308('0xb'),_0x7308('0xc')]},{'name':_0x7308('0xd'),'fields':[_0x7308('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 494ae2a..1bc6408 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 _0x733d=['raw','info','update','where','attributes','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SquareReport','create','body','options'];(function(_0x1d4f8f,_0x1c6522){var _0x472d6a=function(_0x5e2892){while(--_0x5e2892){_0x1d4f8f['push'](_0x1d4f8f['shift']());}};_0x472d6a(++_0x1c6522);}(_0x733d,0x1e7));var _0xd733=function(_0x3621e6,_0x281545){_0x3621e6=_0x3621e6-0x0;var _0x4f3d3c=_0x733d[_0x3621e6];return _0x4f3d3c;};'use strict';var _=require(_0xd733('0x0'));var util=require(_0xd733('0x1'));var moment=require(_0xd733('0x2'));var BPromise=require('bluebird');var rs=require(_0xd733('0x3'));var fs=require('fs');var Redis=require(_0xd733('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd733('0x5'));var config=require(_0xd733('0x6'));var jayson=require(_0xd733('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe1c711,_0x5b26f4,_0x2d3dea){return new BPromise(function(_0x347230,_0x1f32c1){return client[_0xd733('0x8')](_0xe1c711,_0x2d3dea)[_0xd733('0x9')](function(_0x5824a9){logger['info'](_0xd733('0xa'),_0x5b26f4,_0xd733('0xb'));logger[_0xd733('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5b26f4,'request\x20sent',JSON[_0xd733('0xd')](_0x5824a9));if(_0x5824a9[_0xd733('0xe')]){if(_0x5824a9[_0xd733('0xe')][_0xd733('0xf')]===0x1f4){logger[_0xd733('0xe')](_0xd733('0xa'),_0x5b26f4,_0x5824a9[_0xd733('0xe')][_0xd733('0x10')]);return _0x1f32c1(_0x5824a9[_0xd733('0xe')]['message']);}logger['error'](_0xd733('0xa'),_0x5b26f4,_0x5824a9[_0xd733('0xe')][_0xd733('0x10')]);return _0x347230(_0x5824a9[_0xd733('0xe')][_0xd733('0x10')]);}else{logger['info'](_0xd733('0xa'),_0x5b26f4,_0xd733('0xb'));_0x347230(_0x5824a9[_0xd733('0x11')][_0xd733('0x10')]);}})[_0xd733('0x12')](function(_0x137ac1){logger[_0xd733('0xe')](_0xd733('0xa'),_0x5b26f4,_0x137ac1);_0x1f32c1(_0x137ac1);});});}exports['CreateSquareReport']=function(_0x44fac5){var _0x996fed=this;return new Promise(function(_0x63140e,_0xbb3d0c){return db[_0xd733('0x13')][_0xd733('0x14')](_0x44fac5[_0xd733('0x15')],{'raw':_0x44fac5[_0xd733('0x16')]?_0x44fac5[_0xd733('0x16')][_0xd733('0x17')]===undefined?!![]:![]:!![]})[_0xd733('0x9')](function(_0x3dee1b){logger[_0xd733('0x18')]('CreateSquareReport',_0x44fac5);logger[_0xd733('0xc')]('CreateSquareReport',_0x44fac5,JSON[_0xd733('0xd')](_0x3dee1b));_0x63140e(_0x3dee1b);})[_0xd733('0x12')](function(_0x46b719){logger['error']('CreateSquareReport',_0x46b719[_0xd733('0x10')],_0x44fac5);_0xbb3d0c(_0x996fed[_0xd733('0xe')](0x1f4,_0x46b719[_0xd733('0x10')]));});});};exports['UpdateSquareReport']=function(_0x17b184){var _0x5a987a=this;return new Promise(function(_0xbdf2ac,_0x29669b){return db[_0xd733('0x13')][_0xd733('0x19')](_0x17b184[_0xd733('0x15')],{'raw':_0x17b184['options']?_0x17b184[_0xd733('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b184['options']?_0x17b184[_0xd733('0x16')][_0xd733('0x1a')]||null:null,'attributes':_0x17b184[_0xd733('0x16')]?_0x17b184[_0xd733('0x16')][_0xd733('0x1b')]||null:null,'limit':_0x17b184[_0xd733('0x16')]?_0x17b184[_0xd733('0x16')][_0xd733('0x1c')]||null:null})['then'](function(_0x436ed7){logger[_0xd733('0x18')](_0xd733('0x1d'),_0x17b184);logger['debug'](_0xd733('0x1d'),_0x17b184,JSON[_0xd733('0xd')](_0x436ed7));_0xbdf2ac(_0x436ed7);})[_0xd733('0x12')](function(_0x2ed572){logger['error'](_0xd733('0x1d'),_0x2ed572[_0xd733('0x10')],_0x17b184);_0x29669b(_0x5a987a[_0xd733('0xe')](0x1f4,_0x2ed572[_0xd733('0x10')]));});});}; \ No newline at end of file +var _0xb208=['update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb208,0x1c3));var _0x8b20=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb208[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x8b20('0x0'));var util=require(_0x8b20('0x1'));var moment=require('moment');var BPromise=require(_0x8b20('0x2'));var rs=require(_0x8b20('0x3'));var fs=require('fs');var Redis=require(_0x8b20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b20('0x5'));var logger=require(_0x8b20('0x6'))(_0x8b20('0x7'));var config=require(_0x8b20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x557d72,_0x132a54,_0x2c5174){return new BPromise(function(_0x5584de,_0x1b2aab){return client[_0x8b20('0xa')](_0x557d72,_0x2c5174)[_0x8b20('0xb')](function(_0x6f3d1a){logger[_0x8b20('0xc')](_0x8b20('0xd'),_0x132a54,_0x8b20('0xe'));logger[_0x8b20('0xf')](_0x8b20('0x10'),_0x132a54,'request\x20sent',JSON['stringify'](_0x6f3d1a));if(_0x6f3d1a[_0x8b20('0x11')]){if(_0x6f3d1a['error'][_0x8b20('0x12')]===0x1f4){logger[_0x8b20('0x11')](_0x8b20('0xd'),_0x132a54,_0x6f3d1a[_0x8b20('0x11')]['message']);return _0x1b2aab(_0x6f3d1a[_0x8b20('0x11')][_0x8b20('0x13')]);}logger[_0x8b20('0x11')](_0x8b20('0xd'),_0x132a54,_0x6f3d1a[_0x8b20('0x11')]['message']);return _0x5584de(_0x6f3d1a[_0x8b20('0x11')][_0x8b20('0x13')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x132a54,'request\x20sent');_0x5584de(_0x6f3d1a[_0x8b20('0x14')]['message']);}})[_0x8b20('0x15')](function(_0x99edd6){logger[_0x8b20('0x11')](_0x8b20('0xd'),_0x132a54,_0x99edd6);_0x1b2aab(_0x99edd6);});});}exports['CreateSquareReport']=function(_0x2c270d){var _0x84bbf3=this;return new Promise(function(_0x1e9da1,_0x735851){return db[_0x8b20('0x16')][_0x8b20('0x17')](_0x2c270d[_0x8b20('0x18')],{'raw':_0x2c270d[_0x8b20('0x19')]?_0x2c270d['options'][_0x8b20('0x1a')]===undefined?!![]:![]:!![]})[_0x8b20('0xb')](function(_0x30444a){logger[_0x8b20('0xc')](_0x8b20('0x1b'),_0x2c270d);logger[_0x8b20('0xf')](_0x8b20('0x1b'),_0x2c270d,JSON['stringify'](_0x30444a));_0x1e9da1(_0x30444a);})['catch'](function(_0x228f54){logger['error'](_0x8b20('0x1b'),_0x228f54[_0x8b20('0x13')],_0x2c270d);_0x735851(_0x84bbf3[_0x8b20('0x11')](0x1f4,_0x228f54[_0x8b20('0x13')]));});});};exports[_0x8b20('0x1c')]=function(_0x1e8363){var _0x137213=this;return new Promise(function(_0x2ffa12,_0x392a95){return db['SquareReport'][_0x8b20('0x1d')](_0x1e8363[_0x8b20('0x18')],{'raw':_0x1e8363[_0x8b20('0x19')]?_0x1e8363[_0x8b20('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8363[_0x8b20('0x19')]?_0x1e8363[_0x8b20('0x19')][_0x8b20('0x1e')]||null:null,'attributes':_0x1e8363[_0x8b20('0x19')]?_0x1e8363[_0x8b20('0x19')]['attributes']||null:null,'limit':_0x1e8363[_0x8b20('0x19')]?_0x1e8363['options'][_0x8b20('0x1f')]||null:null})[_0x8b20('0xb')](function(_0x2e6bec){logger[_0x8b20('0xc')](_0x8b20('0x1c'),_0x1e8363);logger[_0x8b20('0xf')](_0x8b20('0x1c'),_0x1e8363,JSON['stringify'](_0x2e6bec));_0x2ffa12(_0x2e6bec);})[_0x8b20('0x15')](function(_0x2d00d6){logger[_0x8b20('0x11')](_0x8b20('0x1c'),_0x2d00d6[_0x8b20('0x13')],_0x1e8363);_0x392a95(_0x137213[_0x8b20('0x11')](0x1f4,_0x2d00d6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4aeffdf..4f08fc6 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 _0x3718=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','destroy','exports','multer','util','Router','fs-extra'];(function(_0x5e5ecb,_0x2b519b){var _0x322b22=function(_0x47bbf2){while(--_0x47bbf2){_0x5e5ecb['push'](_0x5e5ecb['shift']());}};_0x322b22(++_0x2b519b);}(_0x3718,0x13f));var _0x8371=function(_0x874f5c,_0x3fad97){_0x874f5c=_0x874f5c-0x0;var _0x4c83d4=_0x3718[_0x874f5c];return _0x4c83d4;};'use strict';var multer=require(_0x8371('0x0'));var util=require(_0x8371('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8371('0x2')]();var fs_extra=require(_0x8371('0x3'));var auth=require(_0x8371('0x4'));var interaction=require(_0x8371('0x5'));var config=require(_0x8371('0x6'));var controller=require(_0x8371('0x7'));router[_0x8371('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8371('0x8')](_0x8371('0x9'),auth[_0x8371('0xa')](),controller[_0x8371('0xb')]);router[_0x8371('0x8')](_0x8371('0xc'),auth[_0x8371('0xa')](),controller[_0x8371('0xd')]);router[_0x8371('0xe')]('/',auth[_0x8371('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8371('0xf')]);router[_0x8371('0x10')](_0x8371('0xc'),auth[_0x8371('0xa')](),controller[_0x8371('0x11')]);module[_0x8371('0x12')]=router; \ No newline at end of file +var _0x4926=['index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0xb40c1d,_0x51c83a){var _0x4e74dc=function(_0x114588){while(--_0x114588){_0xb40c1d['push'](_0xb40c1d['shift']());}};_0x4e74dc(++_0x51c83a);}(_0x4926,0x15f));var _0x6492=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x4926[_0x211fef];return _0x5447bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6492('0x0'));var timeout=require(_0x6492('0x1'));var express=require('express');var router=express[_0x6492('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6492('0x3'));var interaction=require(_0x6492('0x4'));var config=require(_0x6492('0x5'));var controller=require(_0x6492('0x6'));router[_0x6492('0x7')]('/',auth[_0x6492('0x8')](),controller[_0x6492('0x9')]);router['get'](_0x6492('0xa'),auth[_0x6492('0x8')](),controller['describe']);router[_0x6492('0x7')](_0x6492('0xb'),auth[_0x6492('0x8')](),controller[_0x6492('0xc')]);router[_0x6492('0xd')]('/',auth['isAuthenticated'](),controller[_0x6492('0xe')]);router[_0x6492('0xf')]('/:id',auth[_0x6492('0x8')](),controller[_0x6492('0x10')]);router[_0x6492('0x11')](_0x6492('0xb'),auth[_0x6492('0x8')](),controller[_0x6492('0x12')]);module[_0x6492('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5a0a5c9..8d08e27 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 _0xfa10=['exports','STRING','TEXT'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xfa10,0x10b));var _0x0fa1=function(_0x66913e,_0x4d930d){_0x66913e=_0x66913e-0x0;var _0x939ae0=_0xfa10[_0x66913e];return _0x939ae0;};'use strict';var Sequelize=require('sequelize');module[_0x0fa1('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x0fa1('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x0fa1('0x2')]},'project_name':{'type':Sequelize[_0x0fa1('0x1')]},'callerid':{'type':Sequelize[_0x0fa1('0x1')]}}; \ No newline at end of file +var _0xf91d=['TEXT','sequelize','exports','STRING'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0xf91d,0x155));var _0xdf91=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf91d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xdf91('0x0'));module[_0xdf91('0x1')]={'uniqueid':{'type':Sequelize[_0xdf91('0x2')]},'node':{'type':Sequelize[_0xdf91('0x2')]},'application':{'type':Sequelize[_0xdf91('0x2')]},'data':{'type':Sequelize[_0xdf91('0x3')]},'project_name':{'type':Sequelize[_0xdf91('0x2')]},'callerid':{'type':Sequelize[_0xdf91('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4247675..8c888bf 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 _0xc131=['nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','attributes','length','find','create','body','describe','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x4774b4,_0x46fc5f){var _0x5d64a5=function(_0x2cb85d){while(--_0x2cb85d){_0x4774b4['push'](_0x4774b4['shift']());}};_0x5d64a5(++_0x46fc5f);}(_0xc131,0x162));var _0x1c13=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc131[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c13('0x0'));var zipdir=require(_0x1c13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c13('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1c13('0x3'));var util=require(_0x1c13('0x4'));var path=require(_0x1c13('0x5'));var sox=require('sox');var csv=require(_0x1c13('0x6'));var ejs=require(_0x1c13('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c13('0x8'));var squel=require(_0x1c13('0x9'));var crypto=require(_0x1c13('0xa'));var jsforce=require(_0x1c13('0xb'));var deskjs=require(_0x1c13('0xc'));var toCsv=require(_0x1c13('0x6'));var querystring=require('querystring');var Papa=require(_0x1c13('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1c13('0xe'));var as=require(_0x1c13('0xf'));var hardwareService=require(_0x1c13('0x10'));var logger=require('../../config/logger')(_0x1c13('0x11'));var utils=require(_0x1c13('0x12'));var config=require(_0x1c13('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c13('0x14'))['db'];function respondWithStatusCode(_0x58795f,_0x4b04c){_0x4b04c=_0x4b04c||0xcc;return function(_0x109a95){if(_0x109a95){return _0x58795f['sendStatus'](_0x4b04c);}return _0x58795f[_0x1c13('0x15')](_0x4b04c)[_0x1c13('0x16')]();};}function respondWithResult(_0x5af459,_0x1f3760){_0x1f3760=_0x1f3760||0xc8;return function(_0x6759a2){if(_0x6759a2){return _0x5af459[_0x1c13('0x15')](_0x1f3760)[_0x1c13('0x17')](_0x6759a2);}};}function respondWithFilteredResult(_0x5efe3a,_0x35b64d){return function(_0xd1c3c6){if(_0xd1c3c6){var _0x12b957=typeof _0x35b64d[_0x1c13('0x18')]===_0x1c13('0x19')&&typeof _0x35b64d[_0x1c13('0x1a')]===_0x1c13('0x19');var _0x1dc061=_0xd1c3c6[_0x1c13('0x1b')];var _0x599338=_0x12b957?0x0:_0x35b64d[_0x1c13('0x18')];var _0x3a494c=_0x12b957?_0xd1c3c6['count']:_0x35b64d[_0x1c13('0x18')]+_0x35b64d[_0x1c13('0x1a')];var _0x500ec9;if(_0x3a494c>=_0x1dc061){_0x3a494c=_0x1dc061;_0x500ec9=0xc8;}else{_0x500ec9=0xce;}_0x5efe3a[_0x1c13('0x15')](_0x500ec9);return _0x5efe3a[_0x1c13('0x1c')]('Content-Range',_0x599338+'-'+_0x3a494c+'/'+_0x1dc061)[_0x1c13('0x17')](_0xd1c3c6);}return null;};}function patchUpdates(_0x565448){return function(_0x218cc4){try{jsonpatch['apply'](_0x218cc4,_0x565448,!![]);}catch(_0x24e5c1){return BPromise['reject'](_0x24e5c1);}return _0x218cc4['save']();};}function saveUpdates(_0x4cfc62,_0x174b9c){return function(_0x3881ec){if(_0x3881ec){return _0x3881ec[_0x1c13('0x1d')](_0x4cfc62)[_0x1c13('0x1e')](function(_0x236bb6){return _0x236bb6;});}return null;};}function removeEntity(_0x4e8aff,_0x5a47d2){return function(_0x54bebd){if(_0x54bebd){return _0x54bebd[_0x1c13('0x1f')]()[_0x1c13('0x1e')](function(){_0x4e8aff[_0x1c13('0x15')](0xcc)[_0x1c13('0x16')]();});}};}function handleEntityNotFound(_0x20faec,_0x1d7dfa){return function(_0x311ed6){if(!_0x311ed6){_0x20faec[_0x1c13('0x20')](0x194);}return _0x311ed6;};}function handleError(_0x4d27ac,_0x196872){_0x196872=_0x196872||0x1f4;return function(_0x3da9b8){logger[_0x1c13('0x21')](_0x3da9b8['stack']);if(_0x3da9b8[_0x1c13('0x22')]){delete _0x3da9b8[_0x1c13('0x22')];}_0x4d27ac['status'](_0x196872)[_0x1c13('0x23')](_0x3da9b8);};}exports['index']=function(_0x2584c1,_0x1f40ce){var _0x5afd18={},_0x597ad6={},_0x293695={'count':0x0,'rows':[]};var _0x6b0779=_[_0x1c13('0x24')](db[_0x1c13('0x25')][_0x1c13('0x26')],function(_0x3734e8){return{'name':_0x3734e8[_0x1c13('0x27')],'type':_0x3734e8[_0x1c13('0x28')][_0x1c13('0x29')]};});_0x597ad6[_0x1c13('0x2a')]=_[_0x1c13('0x24')](_0x6b0779,_0x1c13('0x22'));_0x597ad6[_0x1c13('0x2b')]=_[_0x1c13('0x2c')](_0x2584c1[_0x1c13('0x2b')]);_0x597ad6[_0x1c13('0x2d')]=_[_0x1c13('0x2e')](_0x597ad6[_0x1c13('0x2a')],_0x597ad6['query']);_0x5afd18['attributes']=_[_0x1c13('0x2e')](_0x597ad6[_0x1c13('0x2a')],qs[_0x1c13('0x2f')](_0x2584c1[_0x1c13('0x2b')][_0x1c13('0x2f')]));_0x5afd18['attributes']=_0x5afd18['attributes']['length']?_0x5afd18['attributes']:_0x597ad6[_0x1c13('0x2a')];if(!_0x2584c1[_0x1c13('0x2b')]['hasOwnProperty'](_0x1c13('0x30'))){_0x5afd18[_0x1c13('0x1a')]=qs[_0x1c13('0x1a')](_0x2584c1[_0x1c13('0x2b')][_0x1c13('0x1a')]);_0x5afd18['offset']=qs[_0x1c13('0x18')](_0x2584c1[_0x1c13('0x2b')]['offset']);}_0x5afd18['order']=qs[_0x1c13('0x31')](_0x2584c1[_0x1c13('0x2b')][_0x1c13('0x31')]);_0x5afd18[_0x1c13('0x32')]=qs[_0x1c13('0x2d')](_[_0x1c13('0x33')](_0x2584c1[_0x1c13('0x2b')],_0x597ad6['filters']),_0x6b0779);if(_0x2584c1[_0x1c13('0x2b')]['filter']){_0x5afd18['where']=_[_0x1c13('0x34')](_0x5afd18['where'],{'$or':_[_0x1c13('0x24')](_0x6b0779,function(_0x42f456){if(_0x42f456['type']!==_0x1c13('0x35')){var _0x53e978={};_0x53e978[_0x42f456[_0x1c13('0x22')]]={'$like':'%'+_0x2584c1[_0x1c13('0x2b')][_0x1c13('0x36')]+'%'};return _0x53e978;}})});}_0x5afd18=_['merge']({},_0x5afd18,_0x2584c1[_0x1c13('0x37')]);var _0x5bbd5a={'where':_0x5afd18[_0x1c13('0x32')]};return db[_0x1c13('0x25')][_0x1c13('0x1b')](_0x5bbd5a)[_0x1c13('0x1e')](function(_0x2ea03f){_0x293695[_0x1c13('0x1b')]=_0x2ea03f;if(_0x2584c1[_0x1c13('0x2b')]['includeAll']){_0x5afd18[_0x1c13('0x38')]=[{'all':!![]}];}return db[_0x1c13('0x25')]['findAll'](_0x5afd18);})[_0x1c13('0x1e')](function(_0xe43edf){_0x293695[_0x1c13('0x39')]=_0xe43edf;return _0x293695;})[_0x1c13('0x1e')](respondWithFilteredResult(_0x1f40ce,_0x5afd18))[_0x1c13('0x3a')](handleError(_0x1f40ce,null));};exports[_0x1c13('0x3b')]=function(_0x3495a3,_0x4ae7db){var _0x2b11b6={'raw':!![],'where':{'id':_0x3495a3[_0x1c13('0x3c')]['id']}},_0x4859dc={};_0x4859dc[_0x1c13('0x2a')]=_[_0x1c13('0x2c')](db[_0x1c13('0x25')][_0x1c13('0x26')]);_0x4859dc[_0x1c13('0x2b')]=_[_0x1c13('0x2c')](_0x3495a3[_0x1c13('0x2b')]);_0x4859dc[_0x1c13('0x2d')]=_[_0x1c13('0x2e')](_0x4859dc[_0x1c13('0x2a')],_0x4859dc['query']);_0x2b11b6[_0x1c13('0x3d')]=_[_0x1c13('0x2e')](_0x4859dc[_0x1c13('0x2a')],qs[_0x1c13('0x2f')](_0x3495a3[_0x1c13('0x2b')]['fields']));_0x2b11b6[_0x1c13('0x3d')]=_0x2b11b6[_0x1c13('0x3d')][_0x1c13('0x3e')]?_0x2b11b6[_0x1c13('0x3d')]:_0x4859dc['model'];if(_0x3495a3['query']['includeAll']){_0x2b11b6[_0x1c13('0x38')]=[{'all':!![]}];}_0x2b11b6=_[_0x1c13('0x34')]({},_0x2b11b6,_0x3495a3['options']);return db[_0x1c13('0x25')][_0x1c13('0x3f')](_0x2b11b6)[_0x1c13('0x1e')](handleEntityNotFound(_0x4ae7db,null))[_0x1c13('0x1e')](respondWithResult(_0x4ae7db,null))[_0x1c13('0x3a')](handleError(_0x4ae7db,null));};exports[_0x1c13('0x40')]=function(_0x199acc,_0x3b3fac){return db[_0x1c13('0x25')][_0x1c13('0x40')](_0x199acc[_0x1c13('0x41')],{})[_0x1c13('0x1e')](respondWithResult(_0x3b3fac,0xc9))[_0x1c13('0x3a')](handleError(_0x3b3fac,null));};exports[_0x1c13('0x1d')]=function(_0x492c7d,_0x388585){if(_0x492c7d[_0x1c13('0x41')]['id']){delete _0x492c7d[_0x1c13('0x41')]['id'];}return db[_0x1c13('0x25')][_0x1c13('0x3f')]({'where':{'id':_0x492c7d['params']['id']}})[_0x1c13('0x1e')](handleEntityNotFound(_0x388585,null))['then'](saveUpdates(_0x492c7d['body'],null))[_0x1c13('0x1e')](respondWithResult(_0x388585,null))['catch'](handleError(_0x388585,null));};exports['destroy']=function(_0x506056,_0x427ed0){return db['SquareDetailsReport']['find']({'where':{'id':_0x506056[_0x1c13('0x3c')]['id']}})[_0x1c13('0x1e')](handleEntityNotFound(_0x427ed0,null))[_0x1c13('0x1e')](removeEntity(_0x427ed0,null))[_0x1c13('0x3a')](handleError(_0x427ed0,null));};exports[_0x1c13('0x42')]=function(_0x23adbf,_0x237eee){return db[_0x1c13('0x25')][_0x1c13('0x42')]()[_0x1c13('0x1e')](respondWithResult(_0x237eee,null))[_0x1c13('0x3a')](handleError(_0x237eee,null));}; \ No newline at end of file +var _0x4c91=['reject','save','update','then','error','stack','name','send','index','SquareDetailsReport','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x4c91,0x75));var _0x14c9=function(_0x37c6f5,_0x310c55){_0x37c6f5=_0x37c6f5-0x0;var _0x1380a9=_0x4c91[_0x37c6f5];return _0x1380a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14c9('0x0'));var jsonpatch=require(_0x14c9('0x1'));var rp=require(_0x14c9('0x2'));var moment=require(_0x14c9('0x3'));var BPromise=require(_0x14c9('0x4'));var Mustache=require(_0x14c9('0x5'));var util=require('util');var path=require(_0x14c9('0x6'));var sox=require('sox');var csv=require(_0x14c9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14c9('0x8'));var _=require(_0x14c9('0x9'));var squel=require(_0x14c9('0xa'));var crypto=require(_0x14c9('0xb'));var jsforce=require(_0x14c9('0xc'));var deskjs=require(_0x14c9('0xd'));var toCsv=require(_0x14c9('0x7'));var querystring=require(_0x14c9('0xe'));var Papa=require(_0x14c9('0xf'));var Redis=require(_0x14c9('0x10'));var authService=require(_0x14c9('0x11'));var qs=require(_0x14c9('0x12'));var as=require(_0x14c9('0x13'));var hardwareService=require(_0x14c9('0x14'));var logger=require(_0x14c9('0x15'))(_0x14c9('0x16'));var utils=require('../../config/utils');var config=require(_0x14c9('0x17'));var licenseUtil=require(_0x14c9('0x18'));var db=require(_0x14c9('0x19'))['db'];function respondWithStatusCode(_0x5bdce8,_0x56b299){_0x56b299=_0x56b299||0xcc;return function(_0x521e7a){if(_0x521e7a){return _0x5bdce8[_0x14c9('0x1a')](_0x56b299);}return _0x5bdce8[_0x14c9('0x1b')](_0x56b299)[_0x14c9('0x1c')]();};}function respondWithResult(_0xc952cb,_0x424ac7){_0x424ac7=_0x424ac7||0xc8;return function(_0x4c9e01){if(_0x4c9e01){return _0xc952cb[_0x14c9('0x1b')](_0x424ac7)[_0x14c9('0x1d')](_0x4c9e01);}};}function respondWithFilteredResult(_0x25b82c,_0x18ac4b){return function(_0x29af83){if(_0x29af83){var _0x4b3a24=typeof _0x18ac4b['offset']===_0x14c9('0x1e')&&typeof _0x18ac4b[_0x14c9('0x1f')]===_0x14c9('0x1e');var _0x2a9f5c=_0x29af83[_0x14c9('0x20')];var _0x2dd759=_0x4b3a24?0x0:_0x18ac4b[_0x14c9('0x21')];var _0x560ea3=_0x4b3a24?_0x29af83[_0x14c9('0x20')]:_0x18ac4b['offset']+_0x18ac4b[_0x14c9('0x1f')];var _0x3dc546;if(_0x560ea3>=_0x2a9f5c){_0x560ea3=_0x2a9f5c;_0x3dc546=0xc8;}else{_0x3dc546=0xce;}_0x25b82c[_0x14c9('0x1b')](_0x3dc546);return _0x25b82c[_0x14c9('0x22')](_0x14c9('0x23'),_0x2dd759+'-'+_0x560ea3+'/'+_0x2a9f5c)[_0x14c9('0x1d')](_0x29af83);}return null;};}function patchUpdates(_0x1329e9){return function(_0x6bd103){try{jsonpatch[_0x14c9('0x24')](_0x6bd103,_0x1329e9,!![]);}catch(_0x2b5a3d){return BPromise[_0x14c9('0x25')](_0x2b5a3d);}return _0x6bd103[_0x14c9('0x26')]();};}function saveUpdates(_0x24fac9,_0x46f9db){return function(_0x4c24b8){if(_0x4c24b8){return _0x4c24b8[_0x14c9('0x27')](_0x24fac9)[_0x14c9('0x28')](function(_0x5c2134){return _0x5c2134;});}return null;};}function removeEntity(_0x472b98,_0x57493b){return function(_0x6418d9){if(_0x6418d9){return _0x6418d9['destroy']()[_0x14c9('0x28')](function(){_0x472b98[_0x14c9('0x1b')](0xcc)[_0x14c9('0x1c')]();});}};}function handleEntityNotFound(_0x25c3f2,_0x3602df){return function(_0x5a19e2){if(!_0x5a19e2){_0x25c3f2['sendStatus'](0x194);}return _0x5a19e2;};}function handleError(_0x3bf366,_0x4ab895){_0x4ab895=_0x4ab895||0x1f4;return function(_0xa5701e){logger[_0x14c9('0x29')](_0xa5701e[_0x14c9('0x2a')]);if(_0xa5701e[_0x14c9('0x2b')]){delete _0xa5701e['name'];}_0x3bf366[_0x14c9('0x1b')](_0x4ab895)[_0x14c9('0x2c')](_0xa5701e);};}exports[_0x14c9('0x2d')]=function(_0x223474,_0x2988a3){var _0x33a574={},_0x133a3f={},_0x5b2397={'count':0x0,'rows':[]};var _0x8423f=_['map'](db[_0x14c9('0x2e')]['rawAttributes'],function(_0x31d7ce){return{'name':_0x31d7ce[_0x14c9('0x2f')],'type':_0x31d7ce[_0x14c9('0x30')]['key']};});_0x133a3f[_0x14c9('0x31')]=_[_0x14c9('0x32')](_0x8423f,_0x14c9('0x2b'));_0x133a3f['query']=_[_0x14c9('0x33')](_0x223474[_0x14c9('0x34')]);_0x133a3f[_0x14c9('0x35')]=_[_0x14c9('0x36')](_0x133a3f[_0x14c9('0x31')],_0x133a3f[_0x14c9('0x34')]);_0x33a574['attributes']=_['intersection'](_0x133a3f[_0x14c9('0x31')],qs[_0x14c9('0x37')](_0x223474[_0x14c9('0x34')][_0x14c9('0x37')]));_0x33a574['attributes']=_0x33a574[_0x14c9('0x38')][_0x14c9('0x39')]?_0x33a574[_0x14c9('0x38')]:_0x133a3f['model'];if(!_0x223474[_0x14c9('0x34')]['hasOwnProperty'](_0x14c9('0x3a'))){_0x33a574[_0x14c9('0x1f')]=qs[_0x14c9('0x1f')](_0x223474[_0x14c9('0x34')]['limit']);_0x33a574[_0x14c9('0x21')]=qs['offset'](_0x223474['query'][_0x14c9('0x21')]);}_0x33a574[_0x14c9('0x3b')]=qs[_0x14c9('0x3c')](_0x223474[_0x14c9('0x34')][_0x14c9('0x3c')]);_0x33a574['where']=qs[_0x14c9('0x35')](_[_0x14c9('0x3d')](_0x223474[_0x14c9('0x34')],_0x133a3f[_0x14c9('0x35')]),_0x8423f);if(_0x223474[_0x14c9('0x34')][_0x14c9('0x3e')]){_0x33a574['where']=_['merge'](_0x33a574['where'],{'$or':_['map'](_0x8423f,function(_0x5805bb){if(_0x5805bb[_0x14c9('0x30')]!==_0x14c9('0x3f')){var _0xb56c0f={};_0xb56c0f[_0x5805bb[_0x14c9('0x2b')]]={'$like':'%'+_0x223474[_0x14c9('0x34')]['filter']+'%'};return _0xb56c0f;}})});}_0x33a574=_[_0x14c9('0x40')]({},_0x33a574,_0x223474[_0x14c9('0x41')]);var _0x38c3d9={'where':_0x33a574[_0x14c9('0x42')]};return db[_0x14c9('0x2e')][_0x14c9('0x20')](_0x38c3d9)[_0x14c9('0x28')](function(_0x2b3e76){_0x5b2397[_0x14c9('0x20')]=_0x2b3e76;if(_0x223474[_0x14c9('0x34')][_0x14c9('0x43')]){_0x33a574[_0x14c9('0x44')]=[{'all':!![]}];}return db[_0x14c9('0x2e')][_0x14c9('0x45')](_0x33a574);})['then'](function(_0x2b66a9){_0x5b2397[_0x14c9('0x46')]=_0x2b66a9;return _0x5b2397;})[_0x14c9('0x28')](respondWithFilteredResult(_0x2988a3,_0x33a574))[_0x14c9('0x47')](handleError(_0x2988a3,null));};exports['show']=function(_0x67e2c1,_0x222a3b){var _0x5c1ee7={'raw':!![],'where':{'id':_0x67e2c1[_0x14c9('0x48')]['id']}},_0x47457a={};_0x47457a[_0x14c9('0x31')]=_[_0x14c9('0x33')](db['SquareDetailsReport'][_0x14c9('0x49')]);_0x47457a['query']=_[_0x14c9('0x33')](_0x67e2c1[_0x14c9('0x34')]);_0x47457a[_0x14c9('0x35')]=_[_0x14c9('0x36')](_0x47457a[_0x14c9('0x31')],_0x47457a[_0x14c9('0x34')]);_0x5c1ee7['attributes']=_[_0x14c9('0x36')](_0x47457a['model'],qs[_0x14c9('0x37')](_0x67e2c1[_0x14c9('0x34')][_0x14c9('0x37')]));_0x5c1ee7[_0x14c9('0x38')]=_0x5c1ee7['attributes'][_0x14c9('0x39')]?_0x5c1ee7[_0x14c9('0x38')]:_0x47457a['model'];if(_0x67e2c1[_0x14c9('0x34')][_0x14c9('0x43')]){_0x5c1ee7[_0x14c9('0x44')]=[{'all':!![]}];}_0x5c1ee7=_[_0x14c9('0x40')]({},_0x5c1ee7,_0x67e2c1[_0x14c9('0x41')]);return db[_0x14c9('0x2e')][_0x14c9('0x4a')](_0x5c1ee7)[_0x14c9('0x28')](handleEntityNotFound(_0x222a3b,null))[_0x14c9('0x28')](respondWithResult(_0x222a3b,null))[_0x14c9('0x47')](handleError(_0x222a3b,null));};exports['create']=function(_0x33bc17,_0x214710){return db['SquareDetailsReport']['create'](_0x33bc17['body'],{})[_0x14c9('0x28')](respondWithResult(_0x214710,0xc9))[_0x14c9('0x47')](handleError(_0x214710,null));};exports[_0x14c9('0x27')]=function(_0x15456e,_0x3c7277){if(_0x15456e['body']['id']){delete _0x15456e[_0x14c9('0x4b')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x15456e[_0x14c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c7277,null))[_0x14c9('0x28')](saveUpdates(_0x15456e[_0x14c9('0x4b')],null))[_0x14c9('0x28')](respondWithResult(_0x3c7277,null))[_0x14c9('0x47')](handleError(_0x3c7277,null));};exports[_0x14c9('0x4c')]=function(_0x4b4c32,_0x353388){return db['SquareDetailsReport']['find']({'where':{'id':_0x4b4c32['params']['id']}})[_0x14c9('0x28')](handleEntityNotFound(_0x353388,null))[_0x14c9('0x28')](removeEntity(_0x353388,null))[_0x14c9('0x47')](handleError(_0x353388,null));};exports['describe']=function(_0x28470d,_0x26da2f){return db[_0x14c9('0x2e')]['describe']()[_0x14c9('0x28')](respondWithResult(_0x26da2f,null))[_0x14c9('0x47')](handleError(_0x26da2f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 44a5271..1cb51e4 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 _0x961c=['define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports'];(function(_0x5c401e,_0x462df1){var _0x59f112=function(_0x362b64){while(--_0x362b64){_0x5c401e['push'](_0x5c401e['shift']());}};_0x59f112(++_0x462df1);}(_0x961c,0x6a));var _0xc961=function(_0x2e2b6c,_0x2a38fd){_0x2e2b6c=_0x2e2b6c-0x0;var _0xea6865=_0x961c[_0x2e2b6c];return _0xea6865;};'use strict';var _=require(_0xc961('0x0'));var util=require(_0xc961('0x1'));var logger=require(_0xc961('0x2'))(_0xc961('0x3'));var moment=require(_0xc961('0x4'));var BPromise=require(_0xc961('0x5'));var rp=require(_0xc961('0x6'));var fs=require('fs');var path=require(_0xc961('0x7'));var rimraf=require(_0xc961('0x8'));var config=require('../../config/environment');var attributes=require(_0xc961('0x9'));module[_0xc961('0xa')]=function(_0x5669bb,_0x59ea68){return _0x5669bb[_0xc961('0xb')](_0xc961('0xc'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4864=['define','SquareDetailsReport','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0xe9f7fd,_0x431edd){var _0x3d22d9=function(_0x3a1d3d){while(--_0x3a1d3d){_0xe9f7fd['push'](_0xe9f7fd['shift']());}};_0x3d22d9(++_0x431edd);}(_0x4864,0x66));var _0x4486=function(_0x68fd87,_0x17f037){_0x68fd87=_0x68fd87-0x0;var _0x559470=_0x4864[_0x68fd87];return _0x559470;};'use strict';var _=require('lodash');var util=require(_0x4486('0x0'));var logger=require(_0x4486('0x1'))(_0x4486('0x2'));var moment=require(_0x4486('0x3'));var BPromise=require(_0x4486('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4486('0x5'));var config=require(_0x4486('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x4486('0x7')]=function(_0x35f009,_0x5dc32a){return _0x35f009[_0x4486('0x8')](_0x4486('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 988d149..67672eb 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 _0xd7d1=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','create','body','options','raw'];(function(_0x5dda63,_0x1c96a2){var _0xb53e0c=function(_0x5befd4){while(--_0x5befd4){_0x5dda63['push'](_0x5dda63['shift']());}};_0xb53e0c(++_0x1c96a2);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5f49d5,_0x48ee22){_0x5f49d5=_0x5f49d5-0x0;var _0x1a8f01=_0xd7d1[_0x5f49d5];return _0x1a8f01;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});}exports[_0x1d7d('0x19')]=function(_0x4db4f2){var _0x664e3f=this;return new Promise(function(_0x191024,_0x5cbb8f){return db['SquareDetailsReport'][_0x1d7d('0x1a')](_0x4db4f2[_0x1d7d('0x1b')],{'raw':_0x4db4f2[_0x1d7d('0x1c')]?_0x4db4f2[_0x1d7d('0x1c')][_0x1d7d('0x1d')]===undefined?!![]:![]:!![]})[_0x1d7d('0xe')](function(_0x54d401){logger[_0x1d7d('0xf')](_0x1d7d('0x19'),_0x4db4f2);logger[_0x1d7d('0x1e')]('CreateSquareDetailsReport',_0x4db4f2,JSON[_0x1d7d('0x13')](_0x54d401));_0x191024(_0x54d401);})[_0x1d7d('0x18')](function(_0x4a1cdc){logger['error'](_0x1d7d('0x19'),_0x4a1cdc[_0x1d7d('0x16')],_0x4db4f2);_0x5cbb8f(_0x664e3f[_0x1d7d('0x14')](0x1f4,_0x4a1cdc['message']));});});}; \ No newline at end of file +var _0xd070=['code','message','result','catch','create','options','CreateSquareDetailsReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1968b1,_0x58467d){var _0x447458=function(_0x4497c6){while(--_0x4497c6){_0x1968b1['push'](_0x1968b1['shift']());}};_0x447458(++_0x58467d);}(_0xd070,0x8e));var _0x0d07=function(_0x1a3cac,_0x696add){_0x1a3cac=_0x1a3cac-0x0;var _0x309e96=_0xd070[_0x1a3cac];return _0x309e96;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var moment=require(_0x0d07('0x1'));var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require(_0x0d07('0x7'))(_0x0d07('0x8'));var config=require(_0x0d07('0x9'));var jayson=require(_0x0d07('0xa'));var client=jayson[_0x0d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d75a,_0x5a4366,_0x20fd56){return new BPromise(function(_0x8c16d8,_0x1f989e){return client[_0x0d07('0xc')](_0x13d75a,_0x20fd56)[_0x0d07('0xd')](function(_0xc5b04d){logger[_0x0d07('0xe')](_0x0d07('0xf'),_0x5a4366,_0x0d07('0x10'));logger[_0x0d07('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5a4366,'request\x20sent',JSON[_0x0d07('0x12')](_0xc5b04d));if(_0xc5b04d[_0x0d07('0x13')]){if(_0xc5b04d['error'][_0x0d07('0x14')]===0x1f4){logger['error'](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')]['message']);return _0x1f989e(_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);}logger[_0x0d07('0x13')](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);return _0x8c16d8(_0xc5b04d['error'][_0x0d07('0x15')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x5a4366,_0x0d07('0x10'));_0x8c16d8(_0xc5b04d[_0x0d07('0x16')][_0x0d07('0x15')]);}})[_0x0d07('0x17')](function(_0x220203){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5a4366,_0x220203);_0x1f989e(_0x220203);});});}exports['CreateSquareDetailsReport']=function(_0x187df2){var _0x312015=this;return new Promise(function(_0x52cb4b,_0x410ad2){return db['SquareDetailsReport'][_0x0d07('0x18')](_0x187df2['body'],{'raw':_0x187df2['options']?_0x187df2[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0d07('0xd')](function(_0x54790f){logger[_0x0d07('0xe')]('CreateSquareDetailsReport',_0x187df2);logger['debug'](_0x0d07('0x1a'),_0x187df2,JSON[_0x0d07('0x12')](_0x54790f));_0x52cb4b(_0x54790f);})[_0x0d07('0x17')](function(_0x57e997){logger[_0x0d07('0x13')]('CreateSquareDetailsReport',_0x57e997['message'],_0x187df2);_0x410ad2(_0x312015[_0x0d07('0x13')](0x1f4,_0x57e997[_0x0d07('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 9616d17..c09469e 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 _0x630a=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','exports','express'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x630a,0x10f));var _0xa630=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x630a[_0x2f3794];return _0x1c9fbe;};'use strict';var express=require(_0xa630('0x0'));var router=express[_0xa630('0x1')]();var auth=require(_0xa630('0x2'));var controller=require(_0xa630('0x3'));router[_0xa630('0x4')]('/',auth[_0xa630('0x5')](),controller['index']);router[_0xa630('0x4')]('/process/:pid/kill',auth[_0xa630('0x5')](),controller[_0xa630('0x6')]);module[_0xa630('0x7')]=router; \ No newline at end of file +var _0x8600=['/process/:pid/kill','killProcess','exports','../../components/auth/service','./system.controller','isAuthenticated','index'];(function(_0x4de900,_0x3bf8c2){var _0x449d9f=function(_0x15326a){while(--_0x15326a){_0x4de900['push'](_0x4de900['shift']());}};_0x449d9f(++_0x3bf8c2);}(_0x8600,0xab));var _0x0860=function(_0x3e9030,_0x16c384){_0x3e9030=_0x3e9030-0x0;var _0x526b49=_0x8600[_0x3e9030];return _0x526b49;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x0860('0x0'));var controller=require(_0x0860('0x1'));router['get']('/',auth[_0x0860('0x2')](),controller[_0x0860('0x3')]);router['get'](_0x0860('0x4'),auth[_0x0860('0x2')](),controller[_0x0860('0x5')]);module[_0x0860('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 6bd6b2f..7625899 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 _0xd669=['send','index','getAllData','then','status','json','catch','killProcess','format','params','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x380084,_0x43c3b5){var _0x239cc7=function(_0x32d40a){while(--_0x32d40a){_0x380084['push'](_0x380084['shift']());}};_0x239cc7(++_0x43c3b5);}(_0xd669,0xcd));var _0x9d66=function(_0x25b5c1,_0x15f706){_0x25b5c1=_0x25b5c1-0x0;var _0x15cb0d=_0xd669[_0x25b5c1];return _0x15cb0d;};'use strict';var info=require(_0x9d66('0x0'));var exec=require(_0x9d66('0x1'))[_0x9d66('0x2')];var logger=require(_0x9d66('0x3'))(_0x9d66('0x4'));var util=require(_0x9d66('0x5'));var BPromise=require(_0x9d66('0x6'));var _=require('lodash');function handleError(_0x4d6f2e,_0x5383d6,_0x58ac43){_0x5383d6=_0x5383d6||0x1f4;return function(_0x36892a){logger[_0x9d66('0x7')](_0x9d66('0x8'),_0x58ac43,_0x5383d6,util[_0x9d66('0x9')](_0x36892a,{'showHidden':![],'depth':null}));delete _0x36892a[_0x9d66('0xa')];_0x4d6f2e['status'](_0x5383d6)[_0x9d66('0xb')](_0x36892a);};}exports[_0x9d66('0xc')]=function(_0x350da0,_0x38078d){return info[_0x9d66('0xd')]()[_0x9d66('0xe')](function(_0x34d52e){return _0x38078d[_0x9d66('0xf')](0xc8)[_0x9d66('0x10')](_0x34d52e);})[_0x9d66('0x11')](function(_0x214180){return _0x38078d[_0x9d66('0xf')](0x1f4)[_0x9d66('0x10')](_0x214180);});};exports[_0x9d66('0x12')]=function(_0x43f403,_0x157177){var _0x33ef45=['components/import/cm'];return new BPromise(function(_0x4dfc92,_0x19c780){return exec(util[_0x9d66('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x43f403[_0x9d66('0x14')]['pid']),function(_0x4d4ba9,_0x1a3bb2,_0x52a041){if(_0x4d4ba9){return _0x19c780(_0x4d4ba9);}return _0x4dfc92(_0x1a3bb2);});})[_0x9d66('0xe')](function(_0x2954ef){var _0x2674c8=![];var _0x4af838=_0x2954ef[_0x9d66('0x15')](/\n/);for(var _0x363083=0x0,_0x2dd07f=_0x33ef45[_0x9d66('0x16')];_0x363083<_0x2dd07f,_0x2674c8===![];_0x363083+=0x1){if(_0x2954ef['indexOf'](_0x33ef45[_0x363083])>=0x0){_0x2674c8=!![];}}if(!_0x2674c8){throw new Error(util[_0x9d66('0x13')](_0x9d66('0x17'),_0x43f403[_0x9d66('0x14')][_0x9d66('0x18')]));}process[_0x9d66('0x19')](_0x43f403['params'][_0x9d66('0x18')],'SIGINT');return _0x157177[_0x9d66('0xf')](0xc8)[_0x9d66('0x10')]({'message':util[_0x9d66('0x13')](_0x9d66('0x1a'),_0x43f403[_0x9d66('0x14')][_0x9d66('0x18')])});})[_0x9d66('0x11')](handleError(_0x157177,null,_0x9d66('0x12')));}; \ No newline at end of file +var _0xe4df=['systeminformation','child_process','exec','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x829690,_0x5dbf1d){var _0x431a54=function(_0x13c6d8){while(--_0x13c6d8){_0x829690['push'](_0x829690['shift']());}};_0x431a54(++_0x5dbf1d);}(_0xe4df,0xfc));var _0xfe4d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe4df[_0x1facfa];return _0x9ec701;};'use strict';var info=require(_0xfe4d('0x0'));var exec=require(_0xfe4d('0x1'))[_0xfe4d('0x2')];var logger=require('../../config/logger')('api');var util=require(_0xfe4d('0x3'));var BPromise=require(_0xfe4d('0x4'));var _=require(_0xfe4d('0x5'));function handleError(_0xc73f2b,_0x1b8431,_0x541e34){_0x1b8431=_0x1b8431||0x1f4;return function(_0x360fcc){logger[_0xfe4d('0x6')](_0xfe4d('0x7'),_0x541e34,_0x1b8431,util[_0xfe4d('0x8')](_0x360fcc,{'showHidden':![],'depth':null}));delete _0x360fcc[_0xfe4d('0x9')];_0xc73f2b[_0xfe4d('0xa')](_0x1b8431)[_0xfe4d('0xb')](_0x360fcc);};}exports[_0xfe4d('0xc')]=function(_0xcbd8a4,_0x32791f){return info[_0xfe4d('0xd')]()['then'](function(_0x5be10c){return _0x32791f[_0xfe4d('0xa')](0xc8)[_0xfe4d('0xe')](_0x5be10c);})[_0xfe4d('0xf')](function(_0x8f332e){return _0x32791f[_0xfe4d('0xa')](0x1f4)[_0xfe4d('0xe')](_0x8f332e);});};exports[_0xfe4d('0x10')]=function(_0x433264,_0x296e90){var _0x38d7b1=['components/import/cm'];return new BPromise(function(_0x2841b3,_0x1cc845){return exec(util['format'](_0xfe4d('0x11'),_0x433264[_0xfe4d('0x12')][_0xfe4d('0x13')]),function(_0x5a0107,_0x2bc8de,_0x515bd1){if(_0x5a0107){return _0x1cc845(_0x5a0107);}return _0x2841b3(_0x2bc8de);});})[_0xfe4d('0x14')](function(_0x298a7c){var _0x54b90d=![];var _0x51a38b=_0x298a7c['split'](/\n/);for(var _0x57ba0f=0x0,_0x2febcd=_0x38d7b1[_0xfe4d('0x15')];_0x57ba0f<_0x2febcd,_0x54b90d===![];_0x57ba0f+=0x1){if(_0x298a7c[_0xfe4d('0x16')](_0x38d7b1[_0x57ba0f])>=0x0){_0x54b90d=!![];}}if(!_0x54b90d){throw new Error(util[_0xfe4d('0x17')](_0xfe4d('0x18'),_0x433264[_0xfe4d('0x12')]['pid']));}process[_0xfe4d('0x19')](_0x433264['params'][_0xfe4d('0x13')],_0xfe4d('0x1a'));return _0x296e90['status'](0xc8)[_0xfe4d('0xe')]({'message':util[_0xfe4d('0x17')](_0xfe4d('0x1b'),_0x433264['params']['pid'])});})[_0xfe4d('0xf')](handleError(_0x296e90,null,_0xfe4d('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ccdcb34..af6fde2 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 _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get'];(function(_0x59222e,_0x1a800e){var _0x5a53a0=function(_0x472797){while(--_0x472797){_0x59222e['push'](_0x59222e['shift']());}};_0x5a53a0(++_0x1a800e);}(_0x5636,0x102));var _0x6563=function(_0x6ec9,_0x5bc3ed){_0x6ec9=_0x6ec9-0x0;var _0x74259c=_0x5636[_0x6ec9];return _0x74259c;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('0x12')]=router; \ No newline at end of file +var _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./tag.controller','get','isAuthenticated','index'];(function(_0x5ecc63,_0x110d0d){var _0x56e65f=function(_0x138202){while(--_0x138202){_0x5ecc63['push'](_0x5ecc63['shift']());}};_0x56e65f(++_0x110d0d);}(_0x0e85,0x7c));var _0x50e8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0e85[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ec437c5..bec49f9 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 _0x7d06=['sequelize','exports','STRING','name'];(function(_0x154958,_0x5e3440){var _0x36bd13=function(_0x32b6d9){while(--_0x32b6d9){_0x154958['push'](_0x154958['shift']());}};_0x36bd13(++_0x5e3440);}(_0x7d06,0x158));var _0x67d0=function(_0x4a55c4,_0x5c0679){_0x4a55c4=_0x4a55c4-0x0;var _0x446b53=_0x7d06[_0x4a55c4];return _0x446b53;};'use strict';var Sequelize=require(_0x67d0('0x0'));module[_0x67d0('0x1')]={'name':{'type':Sequelize[_0x67d0('0x2')],'unique':_0x67d0('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x67d0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x67d0('0x2')]}}; \ No newline at end of file +var _0x236c=['#0091EA','sequelize','STRING','name'];(function(_0x279841,_0x35b3c2){var _0x10b7dd=function(_0x3ab681){while(--_0x3ab681){_0x279841['push'](_0x279841['shift']());}};_0x10b7dd(++_0x35b3c2);}(_0x236c,0x155));var _0xc236=function(_0xf10433,_0x1892d8){_0xf10433=_0xf10433-0x0;var _0xf0a6bb=_0x236c[_0xf10433];return _0xf0a6bb;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc236('0x1')],'defaultValue':_0xc236('0x3')},'description':{'type':Sequelize[_0xc236('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 49933a8..7774220 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 _0xc712=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','map','Tag','rawAttributes','fieldName','type','model','query'];(function(_0x100152,_0x1f3e8f){var _0x433e5b=function(_0x1f15af){while(--_0x1f15af){_0x100152['push'](_0x100152['shift']());}};_0x433e5b(++_0x1f3e8f);}(_0xc712,0xbd));var _0x2c71=function(_0x29a800,_0x3a39dc){_0x29a800=_0x29a800-0x0;var _0x23748a=_0xc712[_0x29a800];return _0x23748a;};'use strict';var emlformat=require(_0x2c71('0x0'));var rimraf=require(_0x2c71('0x1'));var zipdir=require(_0x2c71('0x2'));var jsonpatch=require(_0x2c71('0x3'));var rp=require('request-promise');var moment=require(_0x2c71('0x4'));var BPromise=require(_0x2c71('0x5'));var Mustache=require(_0x2c71('0x6'));var util=require(_0x2c71('0x7'));var path=require(_0x2c71('0x8'));var sox=require('sox');var csv=require(_0x2c71('0x9'));var ejs=require(_0x2c71('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c71('0xb'));var squel=require(_0x2c71('0xc'));var crypto=require(_0x2c71('0xd'));var jsforce=require(_0x2c71('0xe'));var deskjs=require(_0x2c71('0xf'));var toCsv=require(_0x2c71('0x9'));var querystring=require(_0x2c71('0x10'));var Papa=require(_0x2c71('0x11'));var Redis=require('ioredis');var authService=require(_0x2c71('0x12'));var qs=require(_0x2c71('0x13'));var as=require(_0x2c71('0x14'));var hardwareService=require(_0x2c71('0x15'));var logger=require(_0x2c71('0x16'))('api');var utils=require(_0x2c71('0x17'));var config=require(_0x2c71('0x18'));var licenseUtil=require(_0x2c71('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d71e5,_0x22dc34){_0x22dc34=_0x22dc34||0xcc;return function(_0x57f4d1){if(_0x57f4d1){return _0x3d71e5[_0x2c71('0x1a')](_0x22dc34);}return _0x3d71e5[_0x2c71('0x1b')](_0x22dc34)[_0x2c71('0x1c')]();};}function respondWithResult(_0x4700db,_0x2a12b1){_0x2a12b1=_0x2a12b1||0xc8;return function(_0x5a9f43){if(_0x5a9f43){return _0x4700db['status'](_0x2a12b1)[_0x2c71('0x1d')](_0x5a9f43);}};}function respondWithFilteredResult(_0x31e7ba,_0x53dd3c){return function(_0x4037e9){if(_0x4037e9){var _0x3a0ffb=typeof _0x53dd3c[_0x2c71('0x1e')]===_0x2c71('0x1f')&&typeof _0x53dd3c[_0x2c71('0x20')]===_0x2c71('0x1f');var _0x1d2996=_0x4037e9['count'];var _0x2a96b9=_0x3a0ffb?0x0:_0x53dd3c['offset'];var _0x2db611=_0x3a0ffb?_0x4037e9[_0x2c71('0x21')]:_0x53dd3c[_0x2c71('0x1e')]+_0x53dd3c[_0x2c71('0x20')];var _0x597a1e;if(_0x2db611>=_0x1d2996){_0x2db611=_0x1d2996;_0x597a1e=0xc8;}else{_0x597a1e=0xce;}_0x31e7ba['status'](_0x597a1e);return _0x31e7ba[_0x2c71('0x22')]('Content-Range',_0x2a96b9+'-'+_0x2db611+'/'+_0x1d2996)[_0x2c71('0x1d')](_0x4037e9);}return null;};}function patchUpdates(_0x4074ee){return function(_0x371508){try{jsonpatch[_0x2c71('0x23')](_0x371508,_0x4074ee,!![]);}catch(_0x2b4694){return BPromise[_0x2c71('0x24')](_0x2b4694);}return _0x371508[_0x2c71('0x25')]();};}function saveUpdates(_0x5bdc68,_0x1b1368){return function(_0x150d29){if(_0x150d29){return _0x150d29[_0x2c71('0x26')](_0x5bdc68)[_0x2c71('0x27')](function(_0x280e11){return _0x280e11;});}return null;};}function removeEntity(_0x599648,_0x2d61ec){return function(_0x9f1bc1){if(_0x9f1bc1){return _0x9f1bc1[_0x2c71('0x28')]()['then'](function(){var _0x4defd7=_0x9f1bc1[_0x2c71('0x29')]({'plain':!![]});var _0x30ab10=_0x2c71('0x2a');return db[_0x2c71('0x2b')][_0x2c71('0x28')]({'where':{'type':_0x30ab10,'resourceId':_0x4defd7['id']}})[_0x2c71('0x27')](function(){return _0x9f1bc1;});})[_0x2c71('0x27')](function(){_0x599648[_0x2c71('0x1b')](0xcc)[_0x2c71('0x1c')]();});}};}function handleEntityNotFound(_0x3b77c8,_0xfedc8b){return function(_0x61a14b){if(!_0x61a14b){_0x3b77c8['sendStatus'](0x194);}return _0x61a14b;};}function handleError(_0x1cab55,_0x2e711d){_0x2e711d=_0x2e711d||0x1f4;return function(_0x274d47){logger[_0x2c71('0x2c')](_0x274d47[_0x2c71('0x2d')]);if(_0x274d47[_0x2c71('0x2e')]){delete _0x274d47['name'];}_0x1cab55[_0x2c71('0x1b')](_0x2e711d)['send'](_0x274d47);};}exports['index']=function(_0x3ac629,_0x1764db){var _0x3ca0a1={},_0x5e18de={},_0x3b6818={'count':0x0,'rows':[]};var _0x351718=_[_0x2c71('0x2f')](db[_0x2c71('0x30')][_0x2c71('0x31')],function(_0x57dd36){return{'name':_0x57dd36[_0x2c71('0x32')],'type':_0x57dd36[_0x2c71('0x33')]['key']};});_0x5e18de[_0x2c71('0x34')]=_[_0x2c71('0x2f')](_0x351718,_0x2c71('0x2e'));_0x5e18de[_0x2c71('0x35')]=_[_0x2c71('0x36')](_0x3ac629[_0x2c71('0x35')]);_0x5e18de[_0x2c71('0x37')]=_[_0x2c71('0x38')](_0x5e18de['model'],_0x5e18de['query']);_0x3ca0a1[_0x2c71('0x39')]=_[_0x2c71('0x38')](_0x5e18de[_0x2c71('0x34')],qs['fields'](_0x3ac629['query'][_0x2c71('0x3a')]));_0x3ca0a1[_0x2c71('0x39')]=_0x3ca0a1['attributes']['length']?_0x3ca0a1[_0x2c71('0x39')]:_0x5e18de[_0x2c71('0x34')];if(!_0x3ac629['query'][_0x2c71('0x3b')](_0x2c71('0x3c'))){_0x3ca0a1['limit']=qs[_0x2c71('0x20')](_0x3ac629[_0x2c71('0x35')]['limit']);_0x3ca0a1['offset']=qs[_0x2c71('0x1e')](_0x3ac629[_0x2c71('0x35')]['offset']);}_0x3ca0a1['order']=qs['sort'](_0x3ac629[_0x2c71('0x35')][_0x2c71('0x3d')]);_0x3ca0a1[_0x2c71('0x3e')]=qs[_0x2c71('0x37')](_[_0x2c71('0x3f')](_0x3ac629[_0x2c71('0x35')],_0x5e18de['filters']),_0x351718);if(_0x3ac629[_0x2c71('0x35')][_0x2c71('0x40')]){_0x3ca0a1[_0x2c71('0x3e')]=_[_0x2c71('0x41')](_0x3ca0a1['where'],{'$or':_['map'](_0x351718,function(_0xb0fec2){if(_0xb0fec2[_0x2c71('0x33')]!==_0x2c71('0x42')){var _0x3ef68c={};_0x3ef68c[_0xb0fec2[_0x2c71('0x2e')]]={'$like':'%'+_0x3ac629[_0x2c71('0x35')][_0x2c71('0x40')]+'%'};return _0x3ef68c;}})});}_0x3ca0a1=_[_0x2c71('0x41')]({},_0x3ca0a1,_0x3ac629[_0x2c71('0x43')]);var _0x49e4ac={'where':_0x3ca0a1[_0x2c71('0x3e')]};return db['Tag'][_0x2c71('0x21')](_0x49e4ac)[_0x2c71('0x27')](function(_0x148b72){_0x3b6818[_0x2c71('0x21')]=_0x148b72;if(_0x3ac629[_0x2c71('0x35')]['includeAll']){_0x3ca0a1[_0x2c71('0x44')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x3ca0a1);})[_0x2c71('0x27')](function(_0xa06e1a){_0x3b6818['rows']=_0xa06e1a;return _0x3b6818;})[_0x2c71('0x27')](respondWithFilteredResult(_0x1764db,_0x3ca0a1))[_0x2c71('0x45')](handleError(_0x1764db,null));};exports['show']=function(_0x1eca3a,_0x327464){var _0x5c9c19={'raw':!![],'where':{'id':_0x1eca3a[_0x2c71('0x46')]['id']}},_0x429ea6={};_0x429ea6['model']=_[_0x2c71('0x36')](db[_0x2c71('0x30')][_0x2c71('0x31')]);_0x429ea6[_0x2c71('0x35')]=_[_0x2c71('0x36')](_0x1eca3a['query']);_0x429ea6[_0x2c71('0x37')]=_[_0x2c71('0x38')](_0x429ea6[_0x2c71('0x34')],_0x429ea6[_0x2c71('0x35')]);_0x5c9c19['attributes']=_[_0x2c71('0x38')](_0x429ea6[_0x2c71('0x34')],qs['fields'](_0x1eca3a[_0x2c71('0x35')][_0x2c71('0x3a')]));_0x5c9c19['attributes']=_0x5c9c19['attributes'][_0x2c71('0x47')]?_0x5c9c19[_0x2c71('0x39')]:_0x429ea6[_0x2c71('0x34')];if(_0x1eca3a[_0x2c71('0x35')]['includeAll']){_0x5c9c19[_0x2c71('0x44')]=[{'all':!![]}];}_0x5c9c19=_[_0x2c71('0x41')]({},_0x5c9c19,_0x1eca3a['options']);return db['Tag'][_0x2c71('0x48')](_0x5c9c19)[_0x2c71('0x27')](handleEntityNotFound(_0x327464,null))[_0x2c71('0x27')](respondWithResult(_0x327464,null))[_0x2c71('0x45')](handleError(_0x327464,null));};exports['create']=function(_0x525c21,_0x124152){return db[_0x2c71('0x30')][_0x2c71('0x49')](_0x525c21['body'],{})[_0x2c71('0x27')](function(_0x4a9a24){var _0x32f4b6=_0x525c21[_0x2c71('0x4a')][_0x2c71('0x29')]({'plain':!![]});if(!_0x32f4b6)throw new Error(_0x2c71('0x4b'));if(_0x32f4b6[_0x2c71('0x4c')]===_0x2c71('0x4a')){var _0xfaff03=_0x4a9a24[_0x2c71('0x29')]({'plain':!![]});var _0x96f8f6=_0x2c71('0x2a');return db['UserProfileSection'][_0x2c71('0x48')]({'where':{'name':_0x96f8f6,'userProfileId':_0x32f4b6[_0x2c71('0x4d')]},'raw':!![]})[_0x2c71('0x27')](function(_0x50dcfd){if(_0x50dcfd&&_0x50dcfd[_0x2c71('0x4e')]===0x0){return db[_0x2c71('0x2b')][_0x2c71('0x49')]({'name':_0xfaff03[_0x2c71('0x2e')],'resourceId':_0xfaff03['id'],'type':_0x50dcfd[_0x2c71('0x2e')],'sectionId':_0x50dcfd['id']},{})[_0x2c71('0x27')](function(){return _0x4a9a24;});}else{return _0x4a9a24;}})[_0x2c71('0x45')](function(_0x2978f7){logger[_0x2c71('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2978f7);throw _0x2978f7;});}return _0x4a9a24;})[_0x2c71('0x27')](respondWithResult(_0x124152,0xc9))[_0x2c71('0x45')](handleError(_0x124152,null));};exports['update']=function(_0x854252,_0x2a8c73){if(_0x854252[_0x2c71('0x4f')]['id']){delete _0x854252[_0x2c71('0x4f')]['id'];}return db['Tag'][_0x2c71('0x48')]({'where':{'id':_0x854252['params']['id']}})['then'](handleEntityNotFound(_0x2a8c73,null))[_0x2c71('0x27')](saveUpdates(_0x854252[_0x2c71('0x4f')],null))[_0x2c71('0x27')](respondWithResult(_0x2a8c73,null))[_0x2c71('0x45')](handleError(_0x2a8c73,null));};exports[_0x2c71('0x28')]=function(_0x5a4334,_0x1af111){return db[_0x2c71('0x30')][_0x2c71('0x48')]({'where':{'id':_0x5a4334['params']['id']}})['then'](handleEntityNotFound(_0x1af111,null))[_0x2c71('0x27')](removeEntity(_0x1af111,null))[_0x2c71('0x45')](handleError(_0x1af111,null));};exports[_0x2c71('0x50')]=function(_0x54ac8a,_0x5c52b2){return db[_0x2c71('0x30')]['describe']()[_0x2c71('0x27')](respondWithResult(_0x5c52b2,null))[_0x2c71('0x45')](handleError(_0x5c52b2,null));}; \ No newline at end of file +var _0xca72=['model','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','rows','show','params','includeAll','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes'];(function(_0x2a5755,_0x17f587){var _0x1700da=function(_0x40c908){while(--_0x40c908){_0x2a5755['push'](_0x2a5755['shift']());}};_0x1700da(++_0x17f587);}(_0xca72,0x1bf));var _0x2ca7=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xca72[_0x43b584];return _0x48f27b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ca7('0x0'));var zipdir=require(_0x2ca7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ca7('0x2'));var moment=require('moment');var BPromise=require(_0x2ca7('0x3'));var Mustache=require(_0x2ca7('0x4'));var util=require(_0x2ca7('0x5'));var path=require(_0x2ca7('0x6'));var sox=require('sox');var csv=require(_0x2ca7('0x7'));var ejs=require(_0x2ca7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ca7('0x9'));var squel=require(_0x2ca7('0xa'));var crypto=require('crypto');var jsforce=require(_0x2ca7('0xb'));var deskjs=require(_0x2ca7('0xc'));var toCsv=require(_0x2ca7('0x7'));var querystring=require(_0x2ca7('0xd'));var Papa=require('papaparse');var Redis=require(_0x2ca7('0xe'));var authService=require(_0x2ca7('0xf'));var qs=require(_0x2ca7('0x10'));var as=require(_0x2ca7('0x11'));var hardwareService=require(_0x2ca7('0x12'));var logger=require(_0x2ca7('0x13'))(_0x2ca7('0x14'));var utils=require(_0x2ca7('0x15'));var config=require(_0x2ca7('0x16'));var licenseUtil=require(_0x2ca7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca2d3,_0x4c39df){_0x4c39df=_0x4c39df||0xcc;return function(_0x1131d9){if(_0x1131d9){return _0x2ca2d3[_0x2ca7('0x18')](_0x4c39df);}return _0x2ca2d3[_0x2ca7('0x19')](_0x4c39df)[_0x2ca7('0x1a')]();};}function respondWithResult(_0x53e1be,_0x18ebcc){_0x18ebcc=_0x18ebcc||0xc8;return function(_0x545c5e){if(_0x545c5e){return _0x53e1be[_0x2ca7('0x19')](_0x18ebcc)[_0x2ca7('0x1b')](_0x545c5e);}};}function respondWithFilteredResult(_0x9ff647,_0x2362f4){return function(_0x296f92){if(_0x296f92){var _0x409ef5=typeof _0x2362f4[_0x2ca7('0x1c')]===_0x2ca7('0x1d')&&typeof _0x2362f4[_0x2ca7('0x1e')]===_0x2ca7('0x1d');var _0x4d9a07=_0x296f92[_0x2ca7('0x1f')];var _0x26a4c8=_0x409ef5?0x0:_0x2362f4[_0x2ca7('0x1c')];var _0x2665af=_0x409ef5?_0x296f92[_0x2ca7('0x1f')]:_0x2362f4[_0x2ca7('0x1c')]+_0x2362f4[_0x2ca7('0x1e')];var _0x310ecd;if(_0x2665af>=_0x4d9a07){_0x2665af=_0x4d9a07;_0x310ecd=0xc8;}else{_0x310ecd=0xce;}_0x9ff647[_0x2ca7('0x19')](_0x310ecd);return _0x9ff647[_0x2ca7('0x20')](_0x2ca7('0x21'),_0x26a4c8+'-'+_0x2665af+'/'+_0x4d9a07)[_0x2ca7('0x1b')](_0x296f92);}return null;};}function patchUpdates(_0x798f81){return function(_0x1d4965){try{jsonpatch[_0x2ca7('0x22')](_0x1d4965,_0x798f81,!![]);}catch(_0x517a65){return BPromise[_0x2ca7('0x23')](_0x517a65);}return _0x1d4965[_0x2ca7('0x24')]();};}function saveUpdates(_0x1a1217,_0x3c8961){return function(_0x3a0c9d){if(_0x3a0c9d){return _0x3a0c9d[_0x2ca7('0x25')](_0x1a1217)['then'](function(_0x2ff281){return _0x2ff281;});}return null;};}function removeEntity(_0x469732,_0x28ba3a){return function(_0x17ad56){if(_0x17ad56){return _0x17ad56[_0x2ca7('0x26')]()[_0x2ca7('0x27')](function(){var _0x4d1a0f=_0x17ad56[_0x2ca7('0x28')]({'plain':!![]});var _0x11b68f=_0x2ca7('0x29');return db[_0x2ca7('0x2a')]['destroy']({'where':{'type':_0x11b68f,'resourceId':_0x4d1a0f['id']}})[_0x2ca7('0x27')](function(){return _0x17ad56;});})[_0x2ca7('0x27')](function(){_0x469732[_0x2ca7('0x19')](0xcc)[_0x2ca7('0x1a')]();});}};}function handleEntityNotFound(_0x5ca1b5,_0x49634b){return function(_0x53b998){if(!_0x53b998){_0x5ca1b5['sendStatus'](0x194);}return _0x53b998;};}function handleError(_0x79e3c3,_0x553ede){_0x553ede=_0x553ede||0x1f4;return function(_0x353e92){logger[_0x2ca7('0x2b')](_0x353e92[_0x2ca7('0x2c')]);if(_0x353e92['name']){delete _0x353e92[_0x2ca7('0x2d')];}_0x79e3c3[_0x2ca7('0x19')](_0x553ede)['send'](_0x353e92);};}exports[_0x2ca7('0x2e')]=function(_0x1b5e72,_0x2eae2f){var _0x1fa9fe={},_0x9d1824={},_0x69a7fd={'count':0x0,'rows':[]};var _0x5611c5=_[_0x2ca7('0x2f')](db[_0x2ca7('0x30')][_0x2ca7('0x31')],function(_0x4c95bd){return{'name':_0x4c95bd[_0x2ca7('0x32')],'type':_0x4c95bd[_0x2ca7('0x33')]['key']};});_0x9d1824['model']=_[_0x2ca7('0x2f')](_0x5611c5,_0x2ca7('0x2d'));_0x9d1824['query']=_[_0x2ca7('0x34')](_0x1b5e72[_0x2ca7('0x35')]);_0x9d1824[_0x2ca7('0x36')]=_[_0x2ca7('0x37')](_0x9d1824['model'],_0x9d1824['query']);_0x1fa9fe[_0x2ca7('0x38')]=_[_0x2ca7('0x37')](_0x9d1824[_0x2ca7('0x39')],qs[_0x2ca7('0x3a')](_0x1b5e72[_0x2ca7('0x35')]['fields']));_0x1fa9fe[_0x2ca7('0x38')]=_0x1fa9fe['attributes'][_0x2ca7('0x3b')]?_0x1fa9fe[_0x2ca7('0x38')]:_0x9d1824[_0x2ca7('0x39')];if(!_0x1b5e72[_0x2ca7('0x35')][_0x2ca7('0x3c')]('nolimit')){_0x1fa9fe[_0x2ca7('0x1e')]=qs[_0x2ca7('0x1e')](_0x1b5e72[_0x2ca7('0x35')][_0x2ca7('0x1e')]);_0x1fa9fe[_0x2ca7('0x1c')]=qs[_0x2ca7('0x1c')](_0x1b5e72['query']['offset']);}_0x1fa9fe[_0x2ca7('0x3d')]=qs['sort'](_0x1b5e72['query'][_0x2ca7('0x3e')]);_0x1fa9fe[_0x2ca7('0x3f')]=qs[_0x2ca7('0x36')](_['pick'](_0x1b5e72[_0x2ca7('0x35')],_0x9d1824['filters']),_0x5611c5);if(_0x1b5e72[_0x2ca7('0x35')][_0x2ca7('0x40')]){_0x1fa9fe['where']=_[_0x2ca7('0x41')](_0x1fa9fe[_0x2ca7('0x3f')],{'$or':_[_0x2ca7('0x2f')](_0x5611c5,function(_0x413ddd){if(_0x413ddd['type']!==_0x2ca7('0x42')){var _0x442783={};_0x442783[_0x413ddd[_0x2ca7('0x2d')]]={'$like':'%'+_0x1b5e72[_0x2ca7('0x35')][_0x2ca7('0x40')]+'%'};return _0x442783;}})});}_0x1fa9fe=_['merge']({},_0x1fa9fe,_0x1b5e72['options']);var _0x47fb84={'where':_0x1fa9fe[_0x2ca7('0x3f')]};return db[_0x2ca7('0x30')][_0x2ca7('0x1f')](_0x47fb84)['then'](function(_0x249ab6){_0x69a7fd['count']=_0x249ab6;if(_0x1b5e72[_0x2ca7('0x35')]['includeAll']){_0x1fa9fe['include']=[{'all':!![]}];}return db[_0x2ca7('0x30')]['findAll'](_0x1fa9fe);})[_0x2ca7('0x27')](function(_0x53a88e){_0x69a7fd[_0x2ca7('0x43')]=_0x53a88e;return _0x69a7fd;})[_0x2ca7('0x27')](respondWithFilteredResult(_0x2eae2f,_0x1fa9fe))['catch'](handleError(_0x2eae2f,null));};exports[_0x2ca7('0x44')]=function(_0x36a342,_0x2193d7){var _0x20c0e4={'raw':!![],'where':{'id':_0x36a342[_0x2ca7('0x45')]['id']}},_0x5f0309={};_0x5f0309[_0x2ca7('0x39')]=_[_0x2ca7('0x34')](db[_0x2ca7('0x30')]['rawAttributes']);_0x5f0309['query']=_[_0x2ca7('0x34')](_0x36a342[_0x2ca7('0x35')]);_0x5f0309['filters']=_[_0x2ca7('0x37')](_0x5f0309[_0x2ca7('0x39')],_0x5f0309['query']);_0x20c0e4[_0x2ca7('0x38')]=_[_0x2ca7('0x37')](_0x5f0309['model'],qs['fields'](_0x36a342[_0x2ca7('0x35')][_0x2ca7('0x3a')]));_0x20c0e4[_0x2ca7('0x38')]=_0x20c0e4['attributes']['length']?_0x20c0e4['attributes']:_0x5f0309[_0x2ca7('0x39')];if(_0x36a342[_0x2ca7('0x35')][_0x2ca7('0x46')]){_0x20c0e4[_0x2ca7('0x47')]=[{'all':!![]}];}_0x20c0e4=_[_0x2ca7('0x41')]({},_0x20c0e4,_0x36a342[_0x2ca7('0x48')]);return db[_0x2ca7('0x30')][_0x2ca7('0x49')](_0x20c0e4)[_0x2ca7('0x27')](handleEntityNotFound(_0x2193d7,null))['then'](respondWithResult(_0x2193d7,null))[_0x2ca7('0x4a')](handleError(_0x2193d7,null));};exports[_0x2ca7('0x4b')]=function(_0x2bf39f,_0x5d290f){return db[_0x2ca7('0x30')][_0x2ca7('0x4b')](_0x2bf39f[_0x2ca7('0x4c')],{})[_0x2ca7('0x27')](function(_0x55f9dc){var _0x22a4c1=_0x2bf39f[_0x2ca7('0x4d')][_0x2ca7('0x28')]({'plain':!![]});if(!_0x22a4c1)throw new Error(_0x2ca7('0x4e'));if(_0x22a4c1[_0x2ca7('0x4f')]===_0x2ca7('0x4d')){var _0x1171a9=_0x55f9dc[_0x2ca7('0x28')]({'plain':!![]});var _0x39086b=_0x2ca7('0x29');return db['UserProfileSection'][_0x2ca7('0x49')]({'where':{'name':_0x39086b,'userProfileId':_0x22a4c1[_0x2ca7('0x50')]},'raw':!![]})[_0x2ca7('0x27')](function(_0x29ebfb){if(_0x29ebfb&&_0x29ebfb[_0x2ca7('0x51')]===0x0){return db[_0x2ca7('0x2a')][_0x2ca7('0x4b')]({'name':_0x1171a9['name'],'resourceId':_0x1171a9['id'],'type':_0x29ebfb[_0x2ca7('0x2d')],'sectionId':_0x29ebfb['id']},{})['then'](function(){return _0x55f9dc;});}else{return _0x55f9dc;}})['catch'](function(_0x5e9569){logger[_0x2ca7('0x2b')](_0x2ca7('0x52'),_0x5e9569);throw _0x5e9569;});}return _0x55f9dc;})[_0x2ca7('0x27')](respondWithResult(_0x5d290f,0xc9))[_0x2ca7('0x4a')](handleError(_0x5d290f,null));};exports[_0x2ca7('0x25')]=function(_0x2bb539,_0x35268b){if(_0x2bb539[_0x2ca7('0x4c')]['id']){delete _0x2bb539[_0x2ca7('0x4c')]['id'];}return db['Tag'][_0x2ca7('0x49')]({'where':{'id':_0x2bb539[_0x2ca7('0x45')]['id']}})[_0x2ca7('0x27')](handleEntityNotFound(_0x35268b,null))[_0x2ca7('0x27')](saveUpdates(_0x2bb539[_0x2ca7('0x4c')],null))[_0x2ca7('0x27')](respondWithResult(_0x35268b,null))[_0x2ca7('0x4a')](handleError(_0x35268b,null));};exports['destroy']=function(_0x18df46,_0x4fd3c1){return db[_0x2ca7('0x30')]['find']({'where':{'id':_0x18df46[_0x2ca7('0x45')]['id']}})[_0x2ca7('0x27')](handleEntityNotFound(_0x4fd3c1,null))[_0x2ca7('0x27')](removeEntity(_0x4fd3c1,null))[_0x2ca7('0x4a')](handleError(_0x4fd3c1,null));};exports[_0x2ca7('0x53')]=function(_0xa3db33,_0x4e1ba2){return db[_0x2ca7('0x30')][_0x2ca7('0x53')]()[_0x2ca7('0x27')](respondWithResult(_0x4e1ba2,null))['catch'](handleError(_0x4e1ba2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 83bd270..9d9ee8a 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 _0x8060=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','Tag'];(function(_0x33ec5e,_0x13092b){var _0x562b59=function(_0x5d04b4){while(--_0x5d04b4){_0x33ec5e['push'](_0x33ec5e['shift']());}};_0x562b59(++_0x13092b);}(_0x8060,0x1c4));var _0x0806=function(_0x492e32,_0x2e0a93){_0x492e32=_0x492e32-0x0;var _0x4a335e=_0x8060[_0x492e32];return _0x4a335e;};'use strict';var _=require(_0x0806('0x0'));var util=require(_0x0806('0x1'));var logger=require(_0x0806('0x2'))(_0x0806('0x3'));var moment=require(_0x0806('0x4'));var BPromise=require(_0x0806('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0806('0x6'));var config=require(_0x0806('0x7'));var attributes=require('./tag.attributes');module[_0x0806('0x8')]=function(_0x4219fa,_0x359980){return _0x4219fa['define'](_0x0806('0x9'),attributes,{'tableName':_0x0806('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b40=['define','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x5c2b64,_0x12a6e7){var _0x584eb6=function(_0x4d1018){while(--_0x4d1018){_0x5c2b64['push'](_0x5c2b64['shift']());}};_0x584eb6(++_0x12a6e7);}(_0x9b40,0xf6));var _0x09b4=function(_0x2b0327,_0x1b16c0){_0x2b0327=_0x2b0327-0x0;var _0x2a2f2c=_0x9b40[_0x2b0327];return _0x2a2f2c;};'use strict';var _=require('lodash');var util=require(_0x09b4('0x0'));var logger=require('../../config/logger')(_0x09b4('0x1'));var moment=require(_0x09b4('0x2'));var BPromise=require(_0x09b4('0x3'));var rp=require(_0x09b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x09b4('0x5'));var attributes=require('./tag.attributes');module['exports']=function(_0x20e14b,_0x535359){return _0x20e14b[_0x09b4('0x6')]('Tag',attributes,{'tableName':'tools_tags','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 4b6c294..4291ca3 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 _0x66fa=['../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1a4039,_0x354d6f){var _0x21add9=function(_0x40e84b){while(--_0x40e84b){_0x1a4039['push'](_0x1a4039['shift']());}};_0x21add9(++_0x354d6f);}(_0x66fa,0x168));var _0xa66f=function(_0x471ae1,_0x591c7c){_0x471ae1=_0x471ae1-0x0;var _0x314743=_0x66fa[_0x471ae1];return _0x314743;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require(_0xa66f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var utils=require(_0xa66f('0x5'));var logger=require(_0xa66f('0x6'))(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var jayson=require(_0xa66f('0x9'));var client=jayson[_0xa66f('0xa')][_0xa66f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33bd0d,_0x150f73,_0x5b7cf7){return new BPromise(function(_0x1cf624,_0x5ec156){return client[_0xa66f('0xc')](_0x33bd0d,_0x5b7cf7)[_0xa66f('0xd')](function(_0x5ad336){logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,_0xa66f('0x10'));logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x150f73,_0xa66f('0x10'),JSON['stringify'](_0x5ad336));if(_0x5ad336['error']){if(_0x5ad336[_0xa66f('0x13')]['code']===0x1f4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')]['message']);return _0x5ec156(_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);}logger['error'](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);return _0x1cf624(_0x5ad336[_0xa66f('0x13')]['message']);}else{logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,'request\x20sent');_0x1cf624(_0x5ad336[_0xa66f('0x15')][_0xa66f('0x14')]);}})[_0xa66f('0x16')](function(_0x76af81){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x76af81);_0x5ec156(_0x76af81);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','Tag,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x53a02b,_0x5540cf){var _0x549e87=function(_0x26eed7){while(--_0x26eed7){_0x53a02b['push'](_0x53a02b['shift']());}};_0x549e87(++_0x5540cf);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ae02ec3..9d174e1 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 f5217f4..b564950 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 _0xd8b0=['exports','sequelize'];(function(_0x5bcb58,_0x4682f0){var _0x969ce2=function(_0x452a95){while(--_0x452a95){_0x5bcb58['push'](_0x5bcb58['shift']());}};_0x969ce2(++_0x4682f0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xe4326d,_0x25784d){var _0xd1ff82=function(_0x4908ad){while(--_0x4908ad){_0xe4326d['push'](_0xe4326d['shift']());}};_0xd1ff82(++_0x25784d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a624dce..e10f781 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 _0x4586=['Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','voicePause','all','spread','removeAgents','Queue:remove','getAgents','pick','length','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','update','then','stack','name','index','map','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Team','include','findAll','rows','catch','show','keys','includeAll','find','create','user','get','role','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','getQueues','findOne','params','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','rawAttributes','order','Queues','addQueues','Unknown\x20channel','add','ids','remove','addAgents','isArray','Voice','Chat'];(function(_0x184428,_0x1735fc){var _0x40ed56=function(_0xbf66f5){while(--_0xbf66f5){_0x184428['push'](_0x184428['shift']());}};_0x40ed56(++_0x1735fc);}(_0x4586,0x152));var _0x6458=function(_0x2fd873,_0x51262f){_0x2fd873=_0x2fd873-0x0;var _0x23e544=_0x4586[_0x2fd873];return _0x23e544;};'use strict';var emlformat=require(_0x6458('0x0'));var rimraf=require(_0x6458('0x1'));var zipdir=require(_0x6458('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6458('0x3'));var moment=require(_0x6458('0x4'));var BPromise=require(_0x6458('0x5'));var Mustache=require(_0x6458('0x6'));var util=require(_0x6458('0x7'));var path=require(_0x6458('0x8'));var sox=require('sox');var csv=require(_0x6458('0x9'));var ejs=require(_0x6458('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6458('0xb'));var squel=require('squel');var crypto=require(_0x6458('0xc'));var jsforce=require(_0x6458('0xd'));var deskjs=require(_0x6458('0xe'));var toCsv=require(_0x6458('0x9'));var querystring=require('querystring');var Papa=require(_0x6458('0xf'));var Redis=require(_0x6458('0x10'));var authService=require(_0x6458('0x11'));var qs=require(_0x6458('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6458('0x13'));var logger=require(_0x6458('0x14'))('api');var utils=require(_0x6458('0x15'));var config=require(_0x6458('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6458('0x17'))['db'];config[_0x6458('0x18')]=_[_0x6458('0x19')](config['redis'],{'host':_0x6458('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6458('0x18')]));require(_0x6458('0x1b'))[_0x6458('0x1c')](socket);function respondWithStatusCode(_0xcbfbbf,_0x5a5899){_0x5a5899=_0x5a5899||0xcc;return function(_0x36102c){if(_0x36102c){return _0xcbfbbf[_0x6458('0x1d')](_0x5a5899);}return _0xcbfbbf['status'](_0x5a5899)[_0x6458('0x1e')]();};}function respondWithResult(_0x1d0bd4,_0x2d454e){_0x2d454e=_0x2d454e||0xc8;return function(_0x1ebc83){if(_0x1ebc83){return _0x1d0bd4['status'](_0x2d454e)['json'](_0x1ebc83);}};}function respondWithFilteredResult(_0x501496,_0x3af61a){return function(_0x20a94e){if(_0x20a94e){var _0x22a03d=typeof _0x3af61a[_0x6458('0x1f')]===_0x6458('0x20')&&typeof _0x3af61a['limit']===_0x6458('0x20');var _0x1ce1fb=_0x20a94e[_0x6458('0x21')];var _0x14178d=_0x22a03d?0x0:_0x3af61a[_0x6458('0x1f')];var _0x8ff198=_0x22a03d?_0x20a94e[_0x6458('0x21')]:_0x3af61a[_0x6458('0x1f')]+_0x3af61a[_0x6458('0x22')];var _0x5752d9;if(_0x8ff198>=_0x1ce1fb){_0x8ff198=_0x1ce1fb;_0x5752d9=0xc8;}else{_0x5752d9=0xce;}_0x501496[_0x6458('0x23')](_0x5752d9);return _0x501496[_0x6458('0x24')](_0x6458('0x25'),_0x14178d+'-'+_0x8ff198+'/'+_0x1ce1fb)[_0x6458('0x26')](_0x20a94e);}return null;};}function patchUpdates(_0xed1fda){return function(_0x338cf6){try{jsonpatch[_0x6458('0x27')](_0x338cf6,_0xed1fda,!![]);}catch(_0x460806){return BPromise['reject'](_0x460806);}return _0x338cf6['save']();};}function saveUpdates(_0x5a4df4,_0x186ef3){return function(_0x3b2a07){if(_0x3b2a07){return _0x3b2a07[_0x6458('0x28')](_0x5a4df4)[_0x6458('0x29')](function(_0x452cb2){return _0x452cb2;});}return null;};}function handleEntityNotFound(_0x308807,_0x15252e){return function(_0xd254c8){if(!_0xd254c8){_0x308807[_0x6458('0x1d')](0x194);}return _0xd254c8;};}function handleError(_0x3c5136,_0x4ece5a){_0x4ece5a=_0x4ece5a||0x1f4;return function(_0x5a45ea){logger['error'](_0x5a45ea[_0x6458('0x2a')]);if(_0x5a45ea['name']){delete _0x5a45ea[_0x6458('0x2b')];}_0x3c5136[_0x6458('0x23')](_0x4ece5a)['send'](_0x5a45ea);};}exports[_0x6458('0x2c')]=function(_0xcc9dba,_0x1b461c){var _0x25d587={},_0x1187e7={},_0xa0f9a={'count':0x0,'rows':[]};var _0x3a1971=_[_0x6458('0x2d')](db['Team']['rawAttributes'],function(_0x2a6663){return{'name':_0x2a6663[_0x6458('0x2e')],'type':_0x2a6663[_0x6458('0x2f')]['key']};});_0x1187e7[_0x6458('0x30')]=_['map'](_0x3a1971,_0x6458('0x2b'));_0x1187e7[_0x6458('0x31')]=_['keys'](_0xcc9dba['query']);_0x1187e7[_0x6458('0x32')]=_['intersection'](_0x1187e7[_0x6458('0x30')],_0x1187e7['query']);_0x25d587[_0x6458('0x33')]=_[_0x6458('0x34')](_0x1187e7[_0x6458('0x30')],qs['fields'](_0xcc9dba[_0x6458('0x31')][_0x6458('0x35')]));_0x25d587[_0x6458('0x33')]=_0x25d587['attributes']['length']?_0x25d587[_0x6458('0x33')]:_0x1187e7['model'];if(!_0xcc9dba[_0x6458('0x31')][_0x6458('0x36')](_0x6458('0x37'))){_0x25d587['limit']=qs[_0x6458('0x22')](_0xcc9dba[_0x6458('0x31')][_0x6458('0x22')]);_0x25d587[_0x6458('0x1f')]=qs['offset'](_0xcc9dba[_0x6458('0x31')][_0x6458('0x1f')]);}_0x25d587['order']=qs[_0x6458('0x38')](_0xcc9dba[_0x6458('0x31')][_0x6458('0x38')]);_0x25d587[_0x6458('0x39')]=qs[_0x6458('0x32')](_['pick'](_0xcc9dba[_0x6458('0x31')],_0x1187e7[_0x6458('0x32')]),_0x3a1971);if(_0xcc9dba[_0x6458('0x31')][_0x6458('0x3a')]){_0x25d587['where']=_[_0x6458('0x3b')](_0x25d587['where'],{'$or':_[_0x6458('0x2d')](_0x3a1971,function(_0x4b25fc){if(_0x4b25fc[_0x6458('0x2f')]!==_0x6458('0x3c')){var _0x772921={};_0x772921[_0x4b25fc[_0x6458('0x2b')]]={'$like':'%'+_0xcc9dba[_0x6458('0x31')]['filter']+'%'};return _0x772921;}})});}_0x25d587=_[_0x6458('0x3b')]({},_0x25d587,_0xcc9dba[_0x6458('0x3d')]);var _0x3c5bbc={'where':_0x25d587['where']};return db[_0x6458('0x3e')][_0x6458('0x21')](_0x3c5bbc)[_0x6458('0x29')](function(_0x2a9249){_0xa0f9a[_0x6458('0x21')]=_0x2a9249;if(_0xcc9dba[_0x6458('0x31')]['includeAll']){_0x25d587[_0x6458('0x3f')]=[{'all':!![]}];}return db[_0x6458('0x3e')][_0x6458('0x40')](_0x25d587);})[_0x6458('0x29')](function(_0x2d2bd4){_0xa0f9a[_0x6458('0x41')]=_0x2d2bd4;return _0xa0f9a;})[_0x6458('0x29')](respondWithFilteredResult(_0x1b461c,_0x25d587))[_0x6458('0x42')](handleError(_0x1b461c,null));};exports[_0x6458('0x43')]=function(_0x4f8a20,_0x387e59){var _0x411ace={'raw':![],'where':{'id':_0x4f8a20['params']['id']}},_0xd2f278={};_0xd2f278['model']=_['keys'](db[_0x6458('0x3e')]['rawAttributes']);_0xd2f278[_0x6458('0x31')]=_[_0x6458('0x44')](_0x4f8a20[_0x6458('0x31')]);_0xd2f278['filters']=_[_0x6458('0x34')](_0xd2f278[_0x6458('0x30')],_0xd2f278[_0x6458('0x31')]);_0x411ace[_0x6458('0x33')]=_[_0x6458('0x34')](_0xd2f278[_0x6458('0x30')],qs[_0x6458('0x35')](_0x4f8a20[_0x6458('0x31')][_0x6458('0x35')]));_0x411ace['attributes']=_0x411ace['attributes']['length']?_0x411ace[_0x6458('0x33')]:_0xd2f278[_0x6458('0x30')];if(_0x4f8a20[_0x6458('0x31')][_0x6458('0x45')]){_0x411ace[_0x6458('0x3f')]=[{'all':!![]}];}_0x411ace=_[_0x6458('0x3b')]({},_0x411ace,_0x4f8a20[_0x6458('0x3d')]);return db[_0x6458('0x3e')][_0x6458('0x46')](_0x411ace)['then'](handleEntityNotFound(_0x387e59,null))[_0x6458('0x29')](respondWithResult(_0x387e59,null))[_0x6458('0x42')](handleError(_0x387e59,null));};exports['create']=function(_0x376e01,_0x16e8fc){return db[_0x6458('0x3e')][_0x6458('0x47')](_0x376e01['body'],{})[_0x6458('0x29')](function(_0x6519f6){var _0x2941a6=_0x376e01[_0x6458('0x48')][_0x6458('0x49')]({'plain':!![]});if(!_0x2941a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2941a6[_0x6458('0x4a')]===_0x6458('0x48')){var _0x1bfe3e=_0x6519f6[_0x6458('0x49')]({'plain':!![]});var _0x8a2c94='Teams';return db['UserProfileSection'][_0x6458('0x46')]({'where':{'name':_0x8a2c94,'userProfileId':_0x2941a6['userProfileId']},'raw':!![]})[_0x6458('0x29')](function(_0x212426){if(_0x212426&&_0x212426[_0x6458('0x4b')]===0x0){return db[_0x6458('0x4c')][_0x6458('0x47')]({'name':_0x1bfe3e[_0x6458('0x2b')],'resourceId':_0x1bfe3e['id'],'type':_0x212426['name'],'sectionId':_0x212426['id']},{})[_0x6458('0x29')](function(){return _0x6519f6;});}else{return _0x6519f6;}})[_0x6458('0x42')](function(_0x2a43dc){logger[_0x6458('0x4d')](_0x6458('0x4e'),_0x2a43dc);throw _0x2a43dc;});}return _0x6519f6;})[_0x6458('0x29')](respondWithResult(_0x16e8fc,0xc9))['catch'](handleError(_0x16e8fc,null));};exports[_0x6458('0x28')]=function(_0x47e576,_0x110186){if(_0x47e576[_0x6458('0x4f')]['id']){delete _0x47e576['body']['id'];}return db[_0x6458('0x3e')][_0x6458('0x46')]({'where':{'id':_0x47e576['params']['id']}})['then'](handleEntityNotFound(_0x110186,null))[_0x6458('0x29')](saveUpdates(_0x47e576['body'],null))['then'](respondWithResult(_0x110186,null))[_0x6458('0x42')](handleError(_0x110186,null));};exports['destroy']=function(_0x493314,_0x24b0fc){var _0x21ff16=_0x493314['params']['id'];var _0x2a1947=[];return db['sequelize'][_0x6458('0x50')](function(_0x20110b){var _0x54e170=_0x6458('0x51')+_0x21ff16;return db[_0x6458('0x52')][_0x6458('0x31')](_0x54e170,{'type':db['Sequelize'][_0x6458('0x53')]['SELECT'],'raw':!![],'transaction':_0x20110b})['then'](function(_0x5254){_0x2a1947=_[_0x6458('0x2d')](_0x5254,function(_0x1c99bb){return Number(_0x1c99bb[_0x6458('0x54')]);});})[_0x6458('0x29')](function(){var _0x56528b=_0x6458('0x55')+_0x21ff16;return db['sequelize'][_0x6458('0x31')](_0x56528b,{'type':db[_0x6458('0x56')][_0x6458('0x53')]['SELECT'],'raw':!![],'transaction':_0x20110b});})[_0x6458('0x29')](function(_0x571f6f){var _0x16f281=_[_0x6458('0x2d')](_0x571f6f,function(_0x2a82ae){return Number(_0x2a82ae['VoiceQueueId']);});return db[_0x6458('0x57')][_0x6458('0x58')]({'where':{'UserId':{'$in':_0x2a1947},'VoiceQueueId':{'$in':_0x16f281}},'transaction':_0x20110b});})[_0x6458('0x29')](function(){var _0x42e065=_0x6458('0x59')+_0x21ff16;return db[_0x6458('0x52')][_0x6458('0x31')](_0x42e065,{'type':db[_0x6458('0x56')][_0x6458('0x53')][_0x6458('0x5a')],'raw':!![],'transaction':_0x20110b});})[_0x6458('0x29')](function(_0x48d679){var _0x2cdd01=_[_0x6458('0x2d')](_0x48d679,function(_0x547e89){return Number(_0x547e89[_0x6458('0x5b')]);});return db['UserMailQueue'][_0x6458('0x58')]({'where':{'UserId':{'$in':_0x2a1947},'MailQueueId':{'$in':_0x2cdd01}},'transaction':_0x20110b});})[_0x6458('0x29')](function(){var _0x124c35=_0x6458('0x5c')+_0x21ff16;return db['sequelize'][_0x6458('0x31')](_0x124c35,{'type':db[_0x6458('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x20110b});})['then'](function(_0x2feb93){var _0x3823cc=_[_0x6458('0x2d')](_0x2feb93,function(_0x1b801a){return Number(_0x1b801a['SmsQueueId']);});return db[_0x6458('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x2a1947},'SmsQueueId':{'$in':_0x3823cc}},'transaction':_0x20110b});})['then'](function(){var _0x370372=_0x6458('0x5e')+_0x21ff16;return db[_0x6458('0x52')][_0x6458('0x31')](_0x370372,{'type':db[_0x6458('0x56')][_0x6458('0x53')][_0x6458('0x5a')],'raw':!![],'transaction':_0x20110b});})[_0x6458('0x29')](function(_0x30e53b){var _0x9bef7f=_[_0x6458('0x2d')](_0x30e53b,function(_0x383bfa){return Number(_0x383bfa[_0x6458('0x5f')]);});return db[_0x6458('0x60')]['destroy']({'where':{'UserId':{'$in':_0x2a1947},'ChatQueueId':{'$in':_0x9bef7f}},'transaction':_0x20110b});})[_0x6458('0x29')](function(){var _0x5af7e2=_0x6458('0x61')+_0x21ff16;return db[_0x6458('0x52')][_0x6458('0x31')](_0x5af7e2,{'type':db[_0x6458('0x56')][_0x6458('0x53')]['SELECT'],'raw':!![],'transaction':_0x20110b});})[_0x6458('0x29')](function(_0x5731c0){var _0x176f05=_[_0x6458('0x2d')](_0x5731c0,function(_0x5b81d3){return Number(_0x5b81d3[_0x6458('0x62')]);});return db[_0x6458('0x63')]['destroy']({'where':{'UserId':{'$in':_0x2a1947},'FaxQueueId':{'$in':_0x176f05}},'transaction':_0x20110b});})[_0x6458('0x29')](function(){var _0x4a2bfb=_0x6458('0x64')+_0x21ff16;return db[_0x6458('0x52')][_0x6458('0x31')](_0x4a2bfb,{'type':db[_0x6458('0x56')][_0x6458('0x53')][_0x6458('0x5a')],'raw':!![],'transaction':_0x20110b});})[_0x6458('0x29')](function(_0x951f6d){var _0x5dc276=_[_0x6458('0x2d')](_0x951f6d,function(_0xed5eb3){return Number(_0xed5eb3[_0x6458('0x65')]);});return db[_0x6458('0x66')]['destroy']({'where':{'UserId':{'$in':_0x2a1947},'OpenchannelQueueId':{'$in':_0x5dc276}},'transaction':_0x20110b});})[_0x6458('0x29')](function(){var _0x28ba26='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21ff16;return db['sequelize'][_0x6458('0x31')](_0x28ba26,{'type':db[_0x6458('0x56')]['QueryTypes'][_0x6458('0x5a')],'raw':!![],'transaction':_0x20110b});})['then'](function(_0x3238e3){var _0x2f382c=_['map'](_0x3238e3,function(_0x2fa449){return Number(_0x2fa449[_0x6458('0x67')]);});return db[_0x6458('0x68')][_0x6458('0x58')]({'where':{'UserId':{'$in':_0x2a1947},'WhatsappQueueId':{'$in':_0x2f382c}},'transaction':_0x20110b});})['then'](function(){return db[_0x6458('0x69')][_0x6458('0x46')]({'where':{'TeamId':_0x21ff16}});})[_0x6458('0x29')](function(_0x39c3fd){if(_0x39c3fd===null){return;}return db[_0x6458('0x6a')][_0x6458('0x58')]({'where':{'UserId':{'$in':_0x2a1947},'VoicePrefixId':_0x39c3fd[_0x6458('0x6b')]},'transaction':_0x20110b});})[_0x6458('0x29')](function(){return db[_0x6458('0x3e')]['destroy']({'where':{'id':_0x21ff16},'cascade':!![],'transaction':_0x20110b});})[_0x6458('0x29')](function(_0x1695bf){if(_0x1695bf===0x0){_0x24b0fc[_0x6458('0x1d')](0x194);}else{return db[_0x6458('0x4c')]['destroy']({'where':{'type':'Teams','resourceId':_0x21ff16},'cascade':!![],'transaction':_0x20110b})[_0x6458('0x29')](function(){_0x24b0fc[_0x6458('0x23')](0xcc)[_0x6458('0x1e')]();});}})['catch'](function(_0x176a23){_0x24b0fc[_0x6458('0x23')](0x1f4)[_0x6458('0x6c')](_0x176a23);});});};exports[_0x6458('0x6d')]=function(_0x5f1682,_0x2c5b93,_0x1d87ea){return db[_0x6458('0x3e')][_0x6458('0x6e')]({'where':{'id':_0x5f1682[_0x6458('0x6f')]['id']}})['then'](handleEntityNotFound(_0x2c5b93,null))[_0x6458('0x29')](function(_0x34a7e1){if(!_0x5f1682['query'][_0x6458('0x70')]||!utils[_0x6458('0x71')](_0x5f1682[_0x6458('0x31')][_0x6458('0x70')])){throw new db[(_0x6458('0x56'))][(_0x6458('0x72'))]('Unknown\x20channel');}var _0x2d8b8b={};var _0x42e49a={};_0x42e49a[_0x6458('0x30')]=_[_0x6458('0x44')](db[_[_0x6458('0x73')](_0x5f1682[_0x6458('0x31')][_0x6458('0x70')][_0x6458('0x74')]())+_0x6458('0x75')][_0x6458('0x76')]);_0x42e49a[_0x6458('0x31')]=_[_0x6458('0x44')](_0x5f1682[_0x6458('0x31')]);_0x42e49a[_0x6458('0x32')]=_[_0x6458('0x34')](_0x42e49a[_0x6458('0x30')],_0x42e49a[_0x6458('0x31')]);_0x2d8b8b['attributes']=_[_0x6458('0x34')](_0x42e49a[_0x6458('0x30')],qs[_0x6458('0x35')](_0x5f1682[_0x6458('0x31')][_0x6458('0x35')]));_0x2d8b8b['attributes']=_0x2d8b8b[_0x6458('0x33')]['length']?_0x2d8b8b[_0x6458('0x33')]:_0x42e49a['model'];_0x2d8b8b[_0x6458('0x22')]=qs['limit'](_0x5f1682['query']['limit']);_0x2d8b8b[_0x6458('0x1f')]=qs[_0x6458('0x1f')](_0x5f1682[_0x6458('0x31')]['offset']);_0x2d8b8b[_0x6458('0x77')]=qs[_0x6458('0x38')](_0x5f1682[_0x6458('0x31')]['sort']);_0x2d8b8b[_0x6458('0x39')]=qs[_0x6458('0x32')](_['pick'](_0x5f1682['query'],_0x42e49a[_0x6458('0x32')]));_0x2d8b8b=_[_0x6458('0x3b')]({},_0x2d8b8b,_0x5f1682[_0x6458('0x3d')]);return _0x34a7e1[_0x6458('0x49')+_['capitalize'](_0x5f1682['query'][_0x6458('0x70')][_0x6458('0x74')]())+_0x6458('0x78')](_0x2d8b8b);})[_0x6458('0x29')](respondWithResult(_0x2c5b93,null))[_0x6458('0x42')](handleError(_0x2c5b93,null));};exports[_0x6458('0x79')]=function(_0x580b21,_0x165c65,_0x182f0e){return db[_0x6458('0x3e')]['findOne']({'where':{'id':_0x580b21[_0x6458('0x6f')]['id']}})['then'](function(_0x430bfd){if(_0x430bfd){if(!_0x580b21[_0x6458('0x4f')]['channel']||!utils['isValidChannel'](_0x580b21[_0x6458('0x4f')][_0x6458('0x70')])){throw new db['Sequelize'][(_0x6458('0x72'))](_0x6458('0x7a'));}return _0x430bfd[_0x6458('0x7b')+_[_0x6458('0x73')](_0x580b21['body'][_0x6458('0x70')][_0x6458('0x74')]())+_0x6458('0x78')](_0x580b21[_0x6458('0x4f')][_0x6458('0x7c')]);}return null;})[_0x6458('0x29')](handleEntityNotFound(_0x165c65,null))[_0x6458('0x29')](respondWithStatusCode(_0x165c65,null))[_0x6458('0x42')](handleError(_0x165c65,null));};exports['removeQueues']=function(_0x388b88,_0x16e767,_0x3300d8){return db['Team'][_0x6458('0x6e')]({'where':{'id':_0x388b88[_0x6458('0x6f')]['id']}})[_0x6458('0x29')](function(_0x2452b6){if(_0x2452b6){if(!_0x388b88['query'][_0x6458('0x70')]||!utils['isValidChannel'](_0x388b88[_0x6458('0x31')][_0x6458('0x70')])){throw new db[(_0x6458('0x56'))]['ValidationError'](_0x6458('0x7a'));}return _0x2452b6[_0x6458('0x7d')+_[_0x6458('0x73')](_0x388b88[_0x6458('0x31')][_0x6458('0x70')][_0x6458('0x74')]())+_0x6458('0x78')](_0x388b88['query'][_0x6458('0x7c')]);}return null;})[_0x6458('0x29')](handleEntityNotFound(_0x16e767,null))['then'](respondWithStatusCode(_0x16e767,null))[_0x6458('0x42')](handleError(_0x16e767,null));};exports[_0x6458('0x7e')]=function(_0x4f63cb,_0x3b15e3){var _0x4ccd3f=_[_0x6458('0x7f')](_0x4f63cb[_0x6458('0x4f')]['ids'])?_0x4f63cb[_0x6458('0x4f')][_0x6458('0x7c')]:[_0x4f63cb[_0x6458('0x4f')][_0x6458('0x7c')]];var _0x132bde=_0x4f63cb[_0x6458('0x6f')]['id'];return db[_0x6458('0x3e')]['find']({'where':{'id':_0x132bde}})[_0x6458('0x29')](handleEntityNotFound(_0x3b15e3,null))[_0x6458('0x29')](function(_0x105e64){if(_0x105e64){var _0x17645f=[_0x6458('0x80'),_0x6458('0x81'),_0x6458('0x82'),_0x6458('0x83'),_0x6458('0x84'),_0x6458('0x85'),_0x6458('0x86')];return db[_0x6458('0x52')][_0x6458('0x50')](function(_0x518997){var _0x45c77a=_[_0x6458('0x2d')](_0x17645f,function(_0x504751){var _0x1b11ea={'attributes':['id',_0x6458('0x2b')]};if(_0x504751===_0x6458('0x80')){_0x1b11ea[_0x6458('0x87')]={'attributes':[_0x6458('0x88')]};}return _0x105e64[_0x6458('0x49')+_0x504751+_0x6458('0x78')](_0x1b11ea)[_0x6458('0x29')](function(_0x8ab422){var _0x638eb6=_['map'](_0x8ab422,function(_0x1806aa){var _0x4f3f7b=_[_0x6458('0x2d')](_0x4ccd3f,function(_0x1f773c){var _0x58f285={'where':{'UserId':_0x1f773c,[_0x504751+_0x6458('0x89')]:_0x1806aa['id']},'transaction':_0x518997};if(_0x504751===_0x6458('0x80')){_0x58f285[_0x6458('0x19')]={'penalty':_0x1806aa['TeamVoiceQueue']['penalty']};}return db[_0x6458('0x8a')+_0x504751+_0x6458('0x75')][_0x6458('0x8b')](_0x58f285)['then'](function(){socket[_0x6458('0x8c')]('user'+_0x504751+_0x6458('0x8d'),{'UserId':_0x1f773c,[_0x504751+_0x6458('0x89')]:_0x1806aa['id']});if(_0x504751!==_0x6458('0x80')){return;}return db['User'][_0x6458('0x40')]({'where':{'id':_0x4ccd3f,'online':0x1},'attributes':['id','name',_0x6458('0x8e'),'voicePause',_0x6458('0x8f')],'raw':!![]})[_0x6458('0x29')](function(_0x39b6ca){var _0xf7295=_[_0x6458('0x2d')](_0x39b6ca,function(_0x3df9f2){return db[_0x6458('0x90')][_0x6458('0x91')]({'membername':_0x3df9f2[_0x6458('0x2b')],'UserId':_0x3df9f2['id'],'queue_name':_0x1806aa[_0x6458('0x2b')],'VoiceQueueId':_0x1806aa['id'],'interface':_[_0x6458('0x92')](_0x3df9f2[_0x6458('0x8f')])?util['format'](_0x6458('0x93'),_0x3df9f2[_0x6458('0x2b')]):_0x3df9f2[_0x6458('0x8f')],'paused':_0x3df9f2[_0x6458('0x94')]||![],'penalty':_0x1806aa['TeamVoiceQueue'][_0x6458('0x88')]},{'transaction':_0x518997});});return Promise[_0x6458('0x95')](_0xf7295);});});});return Promise[_0x6458('0x95')](_0x4f3f7b);});return Promise[_0x6458('0x95')](_0x638eb6);})['then'](function(){return db[_0x6458('0x69')][_0x6458('0x6e')]({'where':{'teamId':_0x132bde}})[_0x6458('0x29')](function(_0xb7da08){if(_0xb7da08){var _0x223106=_[_0x6458('0x2d')](_0x4ccd3f,function(_0x3f28fd){db[_0x6458('0x6a')]['upsert']({'UserId':_0x3f28fd,'VoicePrefixId':_0xb7da08[_0x6458('0x6b')]});});return Promise[_0x6458('0x95')](_0x223106);}});});});return Promise[_0x6458('0x95')](_0x45c77a)[_0x6458('0x29')](function(){return _0x105e64[_0x6458('0x7e')](_0x4ccd3f,{'transaction':_0x518997})[_0x6458('0x96')](function(_0x37e87d){return _0x37e87d;});});});}})['then'](respondWithResult(_0x3b15e3,null))[_0x6458('0x42')](handleError(_0x3b15e3,null));};exports[_0x6458('0x97')]=function(_0x3c7a75,_0x4a5bf7){var _0x30bb2e=_[_0x6458('0x7f')](_0x3c7a75[_0x6458('0x31')][_0x6458('0x7c')])?_0x3c7a75[_0x6458('0x31')]['ids']:[_0x3c7a75[_0x6458('0x31')][_0x6458('0x7c')]];var _0x505c4a=_0x3c7a75[_0x6458('0x6f')]['id'];return db[_0x6458('0x3e')][_0x6458('0x46')]({'where':{'id':_0x505c4a}})[_0x6458('0x29')](handleEntityNotFound(_0x4a5bf7,null))['then'](function(_0x3cd266){if(_0x3cd266){var _0x4c5549=[_0x6458('0x80'),_0x6458('0x81'),_0x6458('0x82'),'Sms','Fax',_0x6458('0x85'),'Whatsapp'];return db[_0x6458('0x52')]['transaction'](function(_0x3bfa7b){var _0x41517f=_[_0x6458('0x2d')](_0x4c5549,function(_0x543d7c){var _0x44983d={'attributes':['id',_0x6458('0x2b')]};return _0x3cd266[_0x6458('0x49')+_0x543d7c+'Queues'](_0x44983d)[_0x6458('0x29')](function(_0x5cac1a){var _0x537c9e=_['map'](_0x5cac1a,function(_0x35ca2e){return _0x35ca2e[_0x6458('0x97')](_0x30bb2e,{'transaction':_0x3bfa7b})[_0x6458('0x29')](function(){var _0x14ac29=_[_0x6458('0x2d')](_0x30bb2e,function(_0x42ea79){socket['emit']('user'+_0x543d7c+_0x6458('0x98'),{'UserId':Number(_0x42ea79),[_0x543d7c+_0x6458('0x89')]:_0x35ca2e['id']});if(_0x543d7c!==_0x6458('0x80')){return;}return db[_0x6458('0x90')][_0x6458('0x58')]({'where':{'VoiceQueueId':_0x35ca2e['id'],'UserId':_0x42ea79},'transaction':_0x3bfa7b});});return Promise['all'](_0x14ac29);});});return Promise[_0x6458('0x95')](_0x537c9e);});});return Promise['all'](_0x41517f)['then'](function(){return _0x3cd266[_0x6458('0x97')](_0x30bb2e,{'transaction':_0x3bfa7b});})[_0x6458('0x29')](function(){return db[_0x6458('0x69')][_0x6458('0x6e')]({'where':{'teamId':_0x505c4a}})[_0x6458('0x29')](function(_0x1e671c){if(_0x1e671c){var _0x1d9516=_[_0x6458('0x2d')](_0x30bb2e,function(_0x6bda1f){db[_0x6458('0x6a')]['destroy']({'where':{'UserId':_0x6bda1f,'VoicePrefixId':_0x1e671c[_0x6458('0x6b')]}});});return Promise[_0x6458('0x95')](_0x1d9516);}});});});}})[_0x6458('0x29')](respondWithStatusCode(_0x4a5bf7,null))[_0x6458('0x42')](handleError(_0x4a5bf7,null));};exports[_0x6458('0x99')]=function(_0x2cf6ce,_0x443aad,_0x3327f5){var _0x5a642f={};var _0x17db18={};var _0x226cd9;var _0x2f433a;return db['Team'][_0x6458('0x6e')]({'where':{'id':_0x2cf6ce[_0x6458('0x6f')]['id']}})[_0x6458('0x29')](handleEntityNotFound(_0x443aad,null))[_0x6458('0x29')](function(_0x9b06b8){if(_0x9b06b8){_0x226cd9=_0x9b06b8;_0x17db18['model']=_[_0x6458('0x44')](db[_0x6458('0x8a')]['rawAttributes']);_0x17db18['query']=_[_0x6458('0x44')](_0x2cf6ce[_0x6458('0x31')]);_0x17db18[_0x6458('0x32')]=_[_0x6458('0x34')](_0x17db18[_0x6458('0x30')],_0x17db18[_0x6458('0x31')]);_0x5a642f[_0x6458('0x33')]=_[_0x6458('0x34')](_0x17db18[_0x6458('0x30')],qs[_0x6458('0x35')](_0x2cf6ce[_0x6458('0x31')][_0x6458('0x35')]));_0x5a642f[_0x6458('0x33')]=_0x5a642f['attributes']['length']?_0x5a642f[_0x6458('0x33')]:_0x17db18[_0x6458('0x30')];_0x5a642f['order']=qs[_0x6458('0x38')](_0x2cf6ce['query']['sort']);_0x5a642f['where']=qs[_0x6458('0x32')](_[_0x6458('0x9a')](_0x2cf6ce[_0x6458('0x31')],_0x17db18[_0x6458('0x32')]));if(_0x2cf6ce[_0x6458('0x31')][_0x6458('0x3a')]){_0x5a642f['where']=_[_0x6458('0x3b')](_0x5a642f['where'],{'$or':_['map'](_0x5a642f[_0x6458('0x33')],function(_0x3745e0){var _0x54aabf={};_0x54aabf[_0x3745e0]={'$like':'%'+_0x2cf6ce['query']['filter']+'%'};return _0x54aabf;})});}_0x5a642f=_[_0x6458('0x3b')]({},_0x5a642f,_0x2cf6ce[_0x6458('0x3d')]);return _0x226cd9[_0x6458('0x99')](_0x5a642f);}})[_0x6458('0x29')](function(_0x5b5162){if(_0x5b5162){_0x2f433a=_0x5b5162[_0x6458('0x9b')];if(!_0x2cf6ce['query'][_0x6458('0x36')](_0x6458('0x37'))){_0x5a642f[_0x6458('0x22')]=qs[_0x6458('0x22')](_0x2cf6ce[_0x6458('0x31')][_0x6458('0x22')]);_0x5a642f[_0x6458('0x1f')]=qs['offset'](_0x2cf6ce[_0x6458('0x31')][_0x6458('0x1f')]);}return _0x226cd9[_0x6458('0x99')](_0x5a642f);}})[_0x6458('0x29')](function(_0x2a3f74){if(_0x2a3f74){return _0x2a3f74?{'count':_0x2f433a,'rows':_0x2a3f74}:null;}})[_0x6458('0x29')](respondWithResult(_0x443aad,null))[_0x6458('0x42')](handleError(_0x443aad,null));}; \ No newline at end of file +var _0x1228=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Team','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','catch','show','params','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','userProfileId','autoAssociation','UserProfileResource','error','body','destroy','sequelize','QueryTypes','SELECT','Sequelize','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','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','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','capitalize','toLowerCase','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Voice','Mail','Fax','Openchannel','transaction','through','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','penalty','all','TeamVoicePrefix','upsert','spread','removeAgents','isArray','Chat','Whatsapp','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x8e5815,_0x2892a0){var _0x28396b=function(_0x4179c8){while(--_0x4179c8){_0x8e5815['push'](_0x8e5815['shift']());}};_0x28396b(++_0x2892a0);}(_0x1228,0x8f));var _0x8122=function(_0x2af627,_0x33d47f){_0x2af627=_0x2af627-0x0;var _0x14eda9=_0x1228[_0x2af627];return _0x14eda9;};'use strict';var emlformat=require(_0x8122('0x0'));var rimraf=require(_0x8122('0x1'));var zipdir=require(_0x8122('0x2'));var jsonpatch=require(_0x8122('0x3'));var rp=require('request-promise');var moment=require(_0x8122('0x4'));var BPromise=require(_0x8122('0x5'));var Mustache=require(_0x8122('0x6'));var util=require(_0x8122('0x7'));var path=require(_0x8122('0x8'));var sox=require(_0x8122('0x9'));var csv=require(_0x8122('0xa'));var ejs=require(_0x8122('0xb'));var fs=require('fs');var fs_extra=require(_0x8122('0xc'));var _=require(_0x8122('0xd'));var squel=require('squel');var crypto=require(_0x8122('0xe'));var jsforce=require(_0x8122('0xf'));var deskjs=require(_0x8122('0x10'));var toCsv=require(_0x8122('0xa'));var querystring=require(_0x8122('0x11'));var Papa=require('papaparse');var Redis=require(_0x8122('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8122('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8122('0x14'));var utils=require(_0x8122('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8122('0x16'));var db=require(_0x8122('0x17'))['db'];config['redis']=_[_0x8122('0x18')](config[_0x8122('0x19')],{'host':_0x8122('0x1a'),'port':0x18eb});var socket=require(_0x8122('0x1b'))(new Redis(config[_0x8122('0x19')]));require(_0x8122('0x1c'))['register'](socket);function respondWithStatusCode(_0x3f8f5f,_0x4c7ffc){_0x4c7ffc=_0x4c7ffc||0xcc;return function(_0x2ad03a){if(_0x2ad03a){return _0x3f8f5f[_0x8122('0x1d')](_0x4c7ffc);}return _0x3f8f5f[_0x8122('0x1e')](_0x4c7ffc)[_0x8122('0x1f')]();};}function respondWithResult(_0x380b59,_0x36ec6f){_0x36ec6f=_0x36ec6f||0xc8;return function(_0x48b31c){if(_0x48b31c){return _0x380b59[_0x8122('0x1e')](_0x36ec6f)[_0x8122('0x20')](_0x48b31c);}};}function respondWithFilteredResult(_0x1f4739,_0xa85552){return function(_0x26514d){if(_0x26514d){var _0x4c0d59=typeof _0xa85552[_0x8122('0x21')]===_0x8122('0x22')&&typeof _0xa85552['limit']==='undefined';var _0x597162=_0x26514d[_0x8122('0x23')];var _0x133197=_0x4c0d59?0x0:_0xa85552[_0x8122('0x21')];var _0x2ad105=_0x4c0d59?_0x26514d[_0x8122('0x23')]:_0xa85552[_0x8122('0x21')]+_0xa85552[_0x8122('0x24')];var _0x3d7563;if(_0x2ad105>=_0x597162){_0x2ad105=_0x597162;_0x3d7563=0xc8;}else{_0x3d7563=0xce;}_0x1f4739[_0x8122('0x1e')](_0x3d7563);return _0x1f4739[_0x8122('0x25')](_0x8122('0x26'),_0x133197+'-'+_0x2ad105+'/'+_0x597162)[_0x8122('0x20')](_0x26514d);}return null;};}function patchUpdates(_0xb4acb5){return function(_0xde1d02){try{jsonpatch[_0x8122('0x27')](_0xde1d02,_0xb4acb5,!![]);}catch(_0xcb9904){return BPromise[_0x8122('0x28')](_0xcb9904);}return _0xde1d02[_0x8122('0x29')]();};}function saveUpdates(_0x109843,_0x314288){return function(_0x1998b9){if(_0x1998b9){return _0x1998b9[_0x8122('0x2a')](_0x109843)[_0x8122('0x2b')](function(_0x16b612){return _0x16b612;});}return null;};}function handleEntityNotFound(_0xc283ec,_0x329bc8){return function(_0x23274a){if(!_0x23274a){_0xc283ec[_0x8122('0x1d')](0x194);}return _0x23274a;};}function handleError(_0x148827,_0x180ac9){_0x180ac9=_0x180ac9||0x1f4;return function(_0x44827c){logger['error'](_0x44827c[_0x8122('0x2c')]);if(_0x44827c[_0x8122('0x2d')]){delete _0x44827c[_0x8122('0x2d')];}_0x148827[_0x8122('0x1e')](_0x180ac9)[_0x8122('0x2e')](_0x44827c);};}exports[_0x8122('0x2f')]=function(_0x3e589c,_0x4020f3){var _0x43bf14={},_0x1399b9={},_0x499c43={'count':0x0,'rows':[]};var _0x4b4daa=_[_0x8122('0x30')](db[_0x8122('0x31')][_0x8122('0x32')],function(_0xfe4fc2){return{'name':_0xfe4fc2['fieldName'],'type':_0xfe4fc2[_0x8122('0x33')]['key']};});_0x1399b9[_0x8122('0x34')]=_[_0x8122('0x30')](_0x4b4daa,'name');_0x1399b9[_0x8122('0x35')]=_[_0x8122('0x36')](_0x3e589c[_0x8122('0x35')]);_0x1399b9[_0x8122('0x37')]=_[_0x8122('0x38')](_0x1399b9['model'],_0x1399b9[_0x8122('0x35')]);_0x43bf14['attributes']=_[_0x8122('0x38')](_0x1399b9[_0x8122('0x34')],qs[_0x8122('0x39')](_0x3e589c[_0x8122('0x35')][_0x8122('0x39')]));_0x43bf14[_0x8122('0x3a')]=_0x43bf14[_0x8122('0x3a')][_0x8122('0x3b')]?_0x43bf14[_0x8122('0x3a')]:_0x1399b9['model'];if(!_0x3e589c[_0x8122('0x35')]['hasOwnProperty'](_0x8122('0x3c'))){_0x43bf14[_0x8122('0x24')]=qs['limit'](_0x3e589c['query'][_0x8122('0x24')]);_0x43bf14[_0x8122('0x21')]=qs[_0x8122('0x21')](_0x3e589c[_0x8122('0x35')][_0x8122('0x21')]);}_0x43bf14[_0x8122('0x3d')]=qs[_0x8122('0x3e')](_0x3e589c[_0x8122('0x35')][_0x8122('0x3e')]);_0x43bf14[_0x8122('0x3f')]=qs[_0x8122('0x37')](_[_0x8122('0x40')](_0x3e589c[_0x8122('0x35')],_0x1399b9[_0x8122('0x37')]),_0x4b4daa);if(_0x3e589c[_0x8122('0x35')]['filter']){_0x43bf14[_0x8122('0x3f')]=_[_0x8122('0x41')](_0x43bf14[_0x8122('0x3f')],{'$or':_[_0x8122('0x30')](_0x4b4daa,function(_0x11a0d6){if(_0x11a0d6[_0x8122('0x33')]!==_0x8122('0x42')){var _0x144138={};_0x144138[_0x11a0d6[_0x8122('0x2d')]]={'$like':'%'+_0x3e589c[_0x8122('0x35')][_0x8122('0x43')]+'%'};return _0x144138;}})});}_0x43bf14=_[_0x8122('0x41')]({},_0x43bf14,_0x3e589c['options']);var _0x5159a5={'where':_0x43bf14[_0x8122('0x3f')]};return db['Team'][_0x8122('0x23')](_0x5159a5)[_0x8122('0x2b')](function(_0x329af8){_0x499c43['count']=_0x329af8;if(_0x3e589c[_0x8122('0x35')][_0x8122('0x44')]){_0x43bf14['include']=[{'all':!![]}];}return db[_0x8122('0x31')]['findAll'](_0x43bf14);})['then'](function(_0x49972e){_0x499c43['rows']=_0x49972e;return _0x499c43;})[_0x8122('0x2b')](respondWithFilteredResult(_0x4020f3,_0x43bf14))[_0x8122('0x45')](handleError(_0x4020f3,null));};exports[_0x8122('0x46')]=function(_0x52b1bc,_0xcf016){var _0x547840={'raw':![],'where':{'id':_0x52b1bc[_0x8122('0x47')]['id']}},_0x404619={};_0x404619[_0x8122('0x34')]=_[_0x8122('0x36')](db['Team'][_0x8122('0x32')]);_0x404619[_0x8122('0x35')]=_[_0x8122('0x36')](_0x52b1bc[_0x8122('0x35')]);_0x404619[_0x8122('0x37')]=_['intersection'](_0x404619['model'],_0x404619['query']);_0x547840[_0x8122('0x3a')]=_[_0x8122('0x38')](_0x404619[_0x8122('0x34')],qs[_0x8122('0x39')](_0x52b1bc[_0x8122('0x35')][_0x8122('0x39')]));_0x547840[_0x8122('0x3a')]=_0x547840['attributes']['length']?_0x547840[_0x8122('0x3a')]:_0x404619['model'];if(_0x52b1bc[_0x8122('0x35')][_0x8122('0x44')]){_0x547840[_0x8122('0x48')]=[{'all':!![]}];}_0x547840=_['merge']({},_0x547840,_0x52b1bc[_0x8122('0x49')]);return db['Team'][_0x8122('0x4a')](_0x547840)[_0x8122('0x2b')](handleEntityNotFound(_0xcf016,null))['then'](respondWithResult(_0xcf016,null))[_0x8122('0x45')](handleError(_0xcf016,null));};exports[_0x8122('0x4b')]=function(_0x29463f,_0x2dcf63){return db['Team'][_0x8122('0x4b')](_0x29463f['body'],{})[_0x8122('0x2b')](function(_0x169f74){var _0x3d3e83=_0x29463f['user']['get']({'plain':!![]});if(!_0x3d3e83)throw new Error(_0x8122('0x4c'));if(_0x3d3e83['role']===_0x8122('0x4d')){var _0x1950df=_0x169f74[_0x8122('0x4e')]({'plain':!![]});var _0x48a210='Teams';return db['UserProfileSection'][_0x8122('0x4a')]({'where':{'name':_0x48a210,'userProfileId':_0x3d3e83[_0x8122('0x4f')]},'raw':!![]})[_0x8122('0x2b')](function(_0x278419){if(_0x278419&&_0x278419[_0x8122('0x50')]===0x0){return db[_0x8122('0x51')][_0x8122('0x4b')]({'name':_0x1950df[_0x8122('0x2d')],'resourceId':_0x1950df['id'],'type':_0x278419[_0x8122('0x2d')],'sectionId':_0x278419['id']},{})['then'](function(){return _0x169f74;});}else{return _0x169f74;}})[_0x8122('0x45')](function(_0x40e676){logger[_0x8122('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40e676);throw _0x40e676;});}return _0x169f74;})[_0x8122('0x2b')](respondWithResult(_0x2dcf63,0xc9))[_0x8122('0x45')](handleError(_0x2dcf63,null));};exports[_0x8122('0x2a')]=function(_0x3ef6b4,_0x8c115c){if(_0x3ef6b4[_0x8122('0x53')]['id']){delete _0x3ef6b4[_0x8122('0x53')]['id'];}return db[_0x8122('0x31')][_0x8122('0x4a')]({'where':{'id':_0x3ef6b4[_0x8122('0x47')]['id']}})[_0x8122('0x2b')](handleEntityNotFound(_0x8c115c,null))[_0x8122('0x2b')](saveUpdates(_0x3ef6b4['body'],null))[_0x8122('0x2b')](respondWithResult(_0x8c115c,null))[_0x8122('0x45')](handleError(_0x8c115c,null));};exports[_0x8122('0x54')]=function(_0x152f39,_0x500d9f){var _0x53dc6c=_0x152f39[_0x8122('0x47')]['id'];var _0xf0ae79=[];return db[_0x8122('0x55')]['transaction'](function(_0x3e60ed){var _0x126eb8='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x53dc6c;return db[_0x8122('0x55')][_0x8122('0x35')](_0x126eb8,{'type':db['Sequelize'][_0x8122('0x56')][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed})['then'](function(_0x532163){_0xf0ae79=_[_0x8122('0x30')](_0x532163,function(_0x4ee3e3){return Number(_0x4ee3e3['UserId']);});})[_0x8122('0x2b')](function(){var _0x17cd59='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x53dc6c;return db['sequelize'][_0x8122('0x35')](_0x17cd59,{'type':db[_0x8122('0x58')][_0x8122('0x56')][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(_0xba0118){var _0x572623=_[_0x8122('0x30')](_0xba0118,function(_0x513704){return Number(_0x513704[_0x8122('0x59')]);});return db['UserVoiceQueue'][_0x8122('0x54')]({'where':{'UserId':{'$in':_0xf0ae79},'VoiceQueueId':{'$in':_0x572623}},'transaction':_0x3e60ed});})['then'](function(){var _0x3361a=_0x8122('0x5a')+_0x53dc6c;return db['sequelize'][_0x8122('0x35')](_0x3361a,{'type':db[_0x8122('0x58')]['QueryTypes'][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(_0x425017){var _0x2d0a1=_[_0x8122('0x30')](_0x425017,function(_0x443259){return Number(_0x443259['MailQueueId']);});return db[_0x8122('0x5b')][_0x8122('0x54')]({'where':{'UserId':{'$in':_0xf0ae79},'MailQueueId':{'$in':_0x2d0a1}},'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(){var _0xb56359='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x53dc6c;return db['sequelize'][_0x8122('0x35')](_0xb56359,{'type':db['Sequelize'][_0x8122('0x56')][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(_0x74a030){var _0x2d070a=_[_0x8122('0x30')](_0x74a030,function(_0x21027d){return Number(_0x21027d[_0x8122('0x5c')]);});return db['UserSmsQueue'][_0x8122('0x54')]({'where':{'UserId':{'$in':_0xf0ae79},'SmsQueueId':{'$in':_0x2d070a}},'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(){var _0xf258fc=_0x8122('0x5d')+_0x53dc6c;return db[_0x8122('0x55')][_0x8122('0x35')](_0xf258fc,{'type':db[_0x8122('0x58')][_0x8122('0x56')][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(_0x25499f){var _0x5e4dd7=_[_0x8122('0x30')](_0x25499f,function(_0x5048c2){return Number(_0x5048c2[_0x8122('0x5e')]);});return db[_0x8122('0x5f')][_0x8122('0x54')]({'where':{'UserId':{'$in':_0xf0ae79},'ChatQueueId':{'$in':_0x5e4dd7}},'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(){var _0x53344e='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x53dc6c;return db[_0x8122('0x55')][_0x8122('0x35')](_0x53344e,{'type':db[_0x8122('0x58')][_0x8122('0x56')][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(_0x3bf650){var _0x598413=_[_0x8122('0x30')](_0x3bf650,function(_0x3689ff){return Number(_0x3689ff[_0x8122('0x60')]);});return db[_0x8122('0x61')][_0x8122('0x54')]({'where':{'UserId':{'$in':_0xf0ae79},'FaxQueueId':{'$in':_0x598413}},'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(){var _0x2093f5=_0x8122('0x62')+_0x53dc6c;return db[_0x8122('0x55')][_0x8122('0x35')](_0x2093f5,{'type':db['Sequelize'][_0x8122('0x56')][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed});})['then'](function(_0x3f739b){var _0x5e5536=_[_0x8122('0x30')](_0x3f739b,function(_0x133c2e){return Number(_0x133c2e['OpenchannelQueueId']);});return db[_0x8122('0x63')]['destroy']({'where':{'UserId':{'$in':_0xf0ae79},'OpenchannelQueueId':{'$in':_0x5e5536}},'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(){var _0x3b1ae6=_0x8122('0x64')+_0x53dc6c;return db['sequelize'][_0x8122('0x35')](_0x3b1ae6,{'type':db[_0x8122('0x58')][_0x8122('0x56')][_0x8122('0x57')],'raw':!![],'transaction':_0x3e60ed});})['then'](function(_0x4f4912){var _0x271a81=_[_0x8122('0x30')](_0x4f4912,function(_0x52ec12){return Number(_0x52ec12['WhatsappQueueId']);});return db[_0x8122('0x65')][_0x8122('0x54')]({'where':{'UserId':{'$in':_0xf0ae79},'WhatsappQueueId':{'$in':_0x271a81}},'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(){return db['TeamVoicePrefix'][_0x8122('0x4a')]({'where':{'TeamId':_0x53dc6c}});})[_0x8122('0x2b')](function(_0x124e91){if(_0x124e91===null){return;}return db[_0x8122('0x66')]['destroy']({'where':{'UserId':{'$in':_0xf0ae79},'VoicePrefixId':_0x124e91[_0x8122('0x67')]},'transaction':_0x3e60ed});})['then'](function(){return db['Team'][_0x8122('0x54')]({'where':{'id':_0x53dc6c},'cascade':!![],'transaction':_0x3e60ed});})[_0x8122('0x2b')](function(_0x39deb5){if(_0x39deb5===0x0){_0x500d9f[_0x8122('0x1d')](0x194);}else{return db[_0x8122('0x51')]['destroy']({'where':{'type':_0x8122('0x68'),'resourceId':_0x53dc6c},'cascade':!![],'transaction':_0x3e60ed})[_0x8122('0x2b')](function(){_0x500d9f['status'](0xcc)[_0x8122('0x1f')]();});}})[_0x8122('0x45')](function(_0x1f735b){_0x500d9f[_0x8122('0x1e')](0x1f4)['send'](_0x1f735b);});});};exports[_0x8122('0x69')]=function(_0x35862f,_0x44248d,_0x551f41){return db[_0x8122('0x31')][_0x8122('0x6a')]({'where':{'id':_0x35862f['params']['id']}})[_0x8122('0x2b')](handleEntityNotFound(_0x44248d,null))['then'](function(_0x2d19f3){if(!_0x35862f[_0x8122('0x35')][_0x8122('0x6b')]||!utils[_0x8122('0x6c')](_0x35862f[_0x8122('0x35')][_0x8122('0x6b')])){throw new db['Sequelize'][(_0x8122('0x6d'))](_0x8122('0x6e'));}var _0x234fa1={};var _0x349c07={};_0x349c07['model']=_[_0x8122('0x36')](db[_['capitalize'](_0x35862f[_0x8122('0x35')]['channel']['toLowerCase']())+_0x8122('0x6f')][_0x8122('0x32')]);_0x349c07['query']=_[_0x8122('0x36')](_0x35862f[_0x8122('0x35')]);_0x349c07[_0x8122('0x37')]=_[_0x8122('0x38')](_0x349c07[_0x8122('0x34')],_0x349c07[_0x8122('0x35')]);_0x234fa1[_0x8122('0x3a')]=_[_0x8122('0x38')](_0x349c07[_0x8122('0x34')],qs[_0x8122('0x39')](_0x35862f['query'][_0x8122('0x39')]));_0x234fa1[_0x8122('0x3a')]=_0x234fa1[_0x8122('0x3a')][_0x8122('0x3b')]?_0x234fa1[_0x8122('0x3a')]:_0x349c07[_0x8122('0x34')];_0x234fa1[_0x8122('0x24')]=qs[_0x8122('0x24')](_0x35862f[_0x8122('0x35')][_0x8122('0x24')]);_0x234fa1[_0x8122('0x21')]=qs[_0x8122('0x21')](_0x35862f[_0x8122('0x35')][_0x8122('0x21')]);_0x234fa1['order']=qs[_0x8122('0x3e')](_0x35862f['query'][_0x8122('0x3e')]);_0x234fa1[_0x8122('0x3f')]=qs['filters'](_['pick'](_0x35862f[_0x8122('0x35')],_0x349c07[_0x8122('0x37')]));_0x234fa1=_[_0x8122('0x41')]({},_0x234fa1,_0x35862f[_0x8122('0x49')]);return _0x2d19f3['get'+_[_0x8122('0x70')](_0x35862f[_0x8122('0x35')]['channel'][_0x8122('0x71')]())+_0x8122('0x72')](_0x234fa1);})[_0x8122('0x2b')](respondWithResult(_0x44248d,null))['catch'](handleError(_0x44248d,null));};exports[_0x8122('0x73')]=function(_0x32eab5,_0x22a224,_0xb214){return db[_0x8122('0x31')][_0x8122('0x6a')]({'where':{'id':_0x32eab5[_0x8122('0x47')]['id']}})['then'](function(_0x336ac8){if(_0x336ac8){if(!_0x32eab5[_0x8122('0x53')][_0x8122('0x6b')]||!utils[_0x8122('0x6c')](_0x32eab5['body'][_0x8122('0x6b')])){throw new db['Sequelize'][(_0x8122('0x6d'))](_0x8122('0x6e'));}return _0x336ac8[_0x8122('0x74')+_['capitalize'](_0x32eab5[_0x8122('0x53')][_0x8122('0x6b')]['toLowerCase']())+'Queues'](_0x32eab5[_0x8122('0x53')][_0x8122('0x75')]);}return null;})[_0x8122('0x2b')](handleEntityNotFound(_0x22a224,null))[_0x8122('0x2b')](respondWithStatusCode(_0x22a224,null))['catch'](handleError(_0x22a224,null));};exports[_0x8122('0x76')]=function(_0x19f751,_0x4b67a9,_0x4f5e1d){return db['Team'][_0x8122('0x6a')]({'where':{'id':_0x19f751['params']['id']}})[_0x8122('0x2b')](function(_0x54687c){if(_0x54687c){if(!_0x19f751['query'][_0x8122('0x6b')]||!utils[_0x8122('0x6c')](_0x19f751[_0x8122('0x35')][_0x8122('0x6b')])){throw new db[(_0x8122('0x58'))]['ValidationError'](_0x8122('0x6e'));}return _0x54687c[_0x8122('0x77')+_[_0x8122('0x70')](_0x19f751[_0x8122('0x35')]['channel'][_0x8122('0x71')]())+_0x8122('0x72')](_0x19f751[_0x8122('0x35')][_0x8122('0x75')]);}return null;})[_0x8122('0x2b')](handleEntityNotFound(_0x4b67a9,null))[_0x8122('0x2b')](respondWithStatusCode(_0x4b67a9,null))[_0x8122('0x45')](handleError(_0x4b67a9,null));};exports[_0x8122('0x78')]=function(_0x162c0a,_0x3ecdcf){var _0x4e8d54=_['isArray'](_0x162c0a[_0x8122('0x53')][_0x8122('0x75')])?_0x162c0a[_0x8122('0x53')][_0x8122('0x75')]:[_0x162c0a[_0x8122('0x53')]['ids']];var _0x486334=_0x162c0a[_0x8122('0x47')]['id'];return db[_0x8122('0x31')][_0x8122('0x4a')]({'where':{'id':_0x486334}})[_0x8122('0x2b')](handleEntityNotFound(_0x3ecdcf,null))[_0x8122('0x2b')](function(_0x159774){if(_0x159774){var _0x33876f=[_0x8122('0x79'),'Chat',_0x8122('0x7a'),'Sms',_0x8122('0x7b'),_0x8122('0x7c'),'Whatsapp'];return db[_0x8122('0x55')][_0x8122('0x7d')](function(_0x3d3bb2){var _0x2a30f9=_[_0x8122('0x30')](_0x33876f,function(_0x80e4ba){var _0x513a54={'attributes':['id',_0x8122('0x2d')]};if(_0x80e4ba===_0x8122('0x79')){_0x513a54[_0x8122('0x7e')]={'attributes':['penalty']};}return _0x159774['get'+_0x80e4ba+_0x8122('0x72')](_0x513a54)['then'](function(_0x593594){var _0x19940d=_[_0x8122('0x30')](_0x593594,function(_0x4d9196){var _0x4a2a80=_['map'](_0x4e8d54,function(_0x3f4cb2){var _0x58996c={'where':{'UserId':_0x3f4cb2,[_0x80e4ba+_0x8122('0x7f')]:_0x4d9196['id']},'transaction':_0x3d3bb2};if(_0x80e4ba==='Voice'){_0x58996c[_0x8122('0x18')]={'penalty':_0x4d9196[_0x8122('0x80')]['penalty']};}return db[_0x8122('0x81')+_0x80e4ba+_0x8122('0x6f')][_0x8122('0x82')](_0x58996c)[_0x8122('0x2b')](function(){socket[_0x8122('0x83')](_0x8122('0x4d')+_0x80e4ba+_0x8122('0x84'),{'UserId':_0x3f4cb2,[_0x80e4ba+'QueueId']:_0x4d9196['id']});if(_0x80e4ba!=='Voice'){return;}return db['User'][_0x8122('0x85')]({'where':{'id':_0x4e8d54,'online':0x1},'attributes':['id',_0x8122('0x2d'),_0x8122('0x86'),_0x8122('0x87'),_0x8122('0x88')],'raw':!![]})[_0x8122('0x2b')](function(_0x49d77c){var _0xbec7f5=_[_0x8122('0x30')](_0x49d77c,function(_0x2765d8){return db[_0x8122('0x89')]['upsert']({'membername':_0x2765d8[_0x8122('0x2d')],'UserId':_0x2765d8['id'],'queue_name':_0x4d9196[_0x8122('0x2d')],'VoiceQueueId':_0x4d9196['id'],'interface':_[_0x8122('0x8a')](_0x2765d8['interface'])?util[_0x8122('0x8b')](_0x8122('0x8c'),_0x2765d8[_0x8122('0x2d')]):_0x2765d8[_0x8122('0x88')],'paused':_0x2765d8[_0x8122('0x87')]||![],'penalty':_0x4d9196[_0x8122('0x80')][_0x8122('0x8d')]},{'transaction':_0x3d3bb2});});return Promise['all'](_0xbec7f5);});});});return Promise[_0x8122('0x8e')](_0x4a2a80);});return Promise[_0x8122('0x8e')](_0x19940d);})[_0x8122('0x2b')](function(){return db[_0x8122('0x8f')][_0x8122('0x6a')]({'where':{'teamId':_0x486334}})[_0x8122('0x2b')](function(_0x26c88f){if(_0x26c88f){var _0x3205bb=_[_0x8122('0x30')](_0x4e8d54,function(_0x402b9e){db[_0x8122('0x66')][_0x8122('0x90')]({'UserId':_0x402b9e,'VoicePrefixId':_0x26c88f[_0x8122('0x67')]});});return Promise[_0x8122('0x8e')](_0x3205bb);}});});});return Promise[_0x8122('0x8e')](_0x2a30f9)['then'](function(){return _0x159774['addAgents'](_0x4e8d54,{'transaction':_0x3d3bb2})[_0x8122('0x91')](function(_0x1b9cbf){return _0x1b9cbf;});});});}})[_0x8122('0x2b')](respondWithResult(_0x3ecdcf,null))[_0x8122('0x45')](handleError(_0x3ecdcf,null));};exports[_0x8122('0x92')]=function(_0x3f74a2,_0x374cf5){var _0x3749c9=_[_0x8122('0x93')](_0x3f74a2[_0x8122('0x35')]['ids'])?_0x3f74a2[_0x8122('0x35')][_0x8122('0x75')]:[_0x3f74a2[_0x8122('0x35')][_0x8122('0x75')]];var _0x458de5=_0x3f74a2[_0x8122('0x47')]['id'];return db[_0x8122('0x31')][_0x8122('0x4a')]({'where':{'id':_0x458de5}})['then'](handleEntityNotFound(_0x374cf5,null))['then'](function(_0x2f7be3){if(_0x2f7be3){var _0x5e517b=[_0x8122('0x79'),_0x8122('0x94'),_0x8122('0x7a'),'Sms',_0x8122('0x7b'),_0x8122('0x7c'),_0x8122('0x95')];return db['sequelize'][_0x8122('0x7d')](function(_0x457a1b){var _0x45fbfc=_[_0x8122('0x30')](_0x5e517b,function(_0x28a1cf){var _0x5e0b71={'attributes':['id',_0x8122('0x2d')]};return _0x2f7be3[_0x8122('0x4e')+_0x28a1cf+_0x8122('0x72')](_0x5e0b71)[_0x8122('0x2b')](function(_0x524a24){var _0x1bb1b3=_[_0x8122('0x30')](_0x524a24,function(_0x3e8a98){return _0x3e8a98[_0x8122('0x92')](_0x3749c9,{'transaction':_0x457a1b})[_0x8122('0x2b')](function(){var _0xe3f04=_[_0x8122('0x30')](_0x3749c9,function(_0x3bbfca){socket[_0x8122('0x83')]('user'+_0x28a1cf+_0x8122('0x96'),{'UserId':Number(_0x3bbfca),[_0x28a1cf+_0x8122('0x7f')]:_0x3e8a98['id']});if(_0x28a1cf!=='Voice'){return;}return db[_0x8122('0x89')][_0x8122('0x54')]({'where':{'VoiceQueueId':_0x3e8a98['id'],'UserId':_0x3bbfca},'transaction':_0x457a1b});});return Promise[_0x8122('0x8e')](_0xe3f04);});});return Promise[_0x8122('0x8e')](_0x1bb1b3);});});return Promise[_0x8122('0x8e')](_0x45fbfc)[_0x8122('0x2b')](function(){return _0x2f7be3[_0x8122('0x92')](_0x3749c9,{'transaction':_0x457a1b});})[_0x8122('0x2b')](function(){return db['TeamVoicePrefix'][_0x8122('0x6a')]({'where':{'teamId':_0x458de5}})[_0x8122('0x2b')](function(_0x3f85ea){if(_0x3f85ea){var _0x3bde77=_[_0x8122('0x30')](_0x3749c9,function(_0x55c1eb){db[_0x8122('0x66')][_0x8122('0x54')]({'where':{'UserId':_0x55c1eb,'VoicePrefixId':_0x3f85ea[_0x8122('0x67')]}});});return Promise[_0x8122('0x8e')](_0x3bde77);}});});});}})[_0x8122('0x2b')](respondWithStatusCode(_0x374cf5,null))['catch'](handleError(_0x374cf5,null));};exports[_0x8122('0x97')]=function(_0x212a29,_0x4145b0,_0x47a6f6){var _0x30046d={};var _0x444d8b={};var _0x41ae29;var _0x361411;return db[_0x8122('0x31')][_0x8122('0x6a')]({'where':{'id':_0x212a29[_0x8122('0x47')]['id']}})[_0x8122('0x2b')](handleEntityNotFound(_0x4145b0,null))['then'](function(_0x11ef5f){if(_0x11ef5f){_0x41ae29=_0x11ef5f;_0x444d8b[_0x8122('0x34')]=_['keys'](db[_0x8122('0x81')][_0x8122('0x32')]);_0x444d8b[_0x8122('0x35')]=_[_0x8122('0x36')](_0x212a29['query']);_0x444d8b['filters']=_['intersection'](_0x444d8b['model'],_0x444d8b[_0x8122('0x35')]);_0x30046d[_0x8122('0x3a')]=_[_0x8122('0x38')](_0x444d8b[_0x8122('0x34')],qs['fields'](_0x212a29[_0x8122('0x35')][_0x8122('0x39')]));_0x30046d[_0x8122('0x3a')]=_0x30046d[_0x8122('0x3a')]['length']?_0x30046d[_0x8122('0x3a')]:_0x444d8b[_0x8122('0x34')];_0x30046d[_0x8122('0x3d')]=qs[_0x8122('0x3e')](_0x212a29[_0x8122('0x35')][_0x8122('0x3e')]);_0x30046d[_0x8122('0x3f')]=qs[_0x8122('0x37')](_[_0x8122('0x40')](_0x212a29['query'],_0x444d8b[_0x8122('0x37')]));if(_0x212a29['query'][_0x8122('0x43')]){_0x30046d[_0x8122('0x3f')]=_[_0x8122('0x41')](_0x30046d[_0x8122('0x3f')],{'$or':_['map'](_0x30046d[_0x8122('0x3a')],function(_0xbd27c6){var _0x172f29={};_0x172f29[_0xbd27c6]={'$like':'%'+_0x212a29[_0x8122('0x35')][_0x8122('0x43')]+'%'};return _0x172f29;})});}_0x30046d=_[_0x8122('0x41')]({},_0x30046d,_0x212a29[_0x8122('0x49')]);return _0x41ae29[_0x8122('0x97')](_0x30046d);}})['then'](function(_0x4a6ab6){if(_0x4a6ab6){_0x361411=_0x4a6ab6['length'];if(!_0x212a29[_0x8122('0x35')][_0x8122('0x98')](_0x8122('0x3c'))){_0x30046d[_0x8122('0x24')]=qs[_0x8122('0x24')](_0x212a29[_0x8122('0x35')][_0x8122('0x24')]);_0x30046d[_0x8122('0x21')]=qs['offset'](_0x212a29[_0x8122('0x35')][_0x8122('0x21')]);}return _0x41ae29[_0x8122('0x97')](_0x30046d);}})['then'](function(_0xcbe2b4){if(_0xcbe2b4){return _0xcbe2b4?{'count':_0x361411,'rows':_0xcbe2b4}:null;}})[_0x8122('0x2b')](respondWithResult(_0x4145b0,null))[_0x8122('0x45')](handleError(_0x4145b0,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 3f6497f..f919d2c 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 _0x94c5=['events','../../mysqldb','Team','emit','hasOwnProperty','hook','exports'];(function(_0xf2d0e3,_0xe62461){var _0x215b41=function(_0x1e296a){while(--_0x1e296a){_0xf2d0e3['push'](_0xf2d0e3['shift']());}};_0x215b41(++_0xe62461);}(_0x94c5,0x7e));var _0x594c=function(_0x30c5ce,_0x3e3f7a){_0x30c5ce=_0x30c5ce-0x0;var _0x33cc16=_0x94c5[_0x30c5ce];return _0x33cc16;};'use strict';var EventEmitter=require(_0x594c('0x0'));var Team=require(_0x594c('0x1'))['db'][_0x594c('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a5e60){return function(_0x2fe6e1,_0x4fca12,_0x1d4794){TeamEvents[_0x594c('0x3')](_0x5a5e60+':'+_0x2fe6e1['id'],_0x2fe6e1);TeamEvents[_0x594c('0x3')](_0x5a5e60,_0x2fe6e1);_0x1d4794(null);};}for(var e in events){if(events[_0x594c('0x4')](e)){var event=events[e];Team[_0x594c('0x5')](e,emitEvent(event));}}module[_0x594c('0x6')]=TeamEvents; \ No newline at end of file +var _0x9f26=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xfaa413,_0x520ca5){var _0x29bad0=function(_0x27d01a){while(--_0x27d01a){_0xfaa413['push'](_0xfaa413['shift']());}};_0x29bad0(++_0x520ca5);}(_0x9f26,0x152));var _0x69f2=function(_0x5c285b,_0x337003){_0x5c285b=_0x5c285b-0x0;var _0x4a4ada=_0x9f26[_0x5c285b];return _0x4a4ada;};'use strict';var EventEmitter=require(_0x69f2('0x0'));var Team=require(_0x69f2('0x1'))['db'][_0x69f2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x69f2('0x3')](0x0);var events={'afterCreate':_0x69f2('0x4'),'afterUpdate':_0x69f2('0x5'),'afterDestroy':_0x69f2('0x6')};function emitEvent(_0x2e7f98){return function(_0x15a52e,_0x338364,_0x456494){TeamEvents[_0x69f2('0x7')](_0x2e7f98+':'+_0x15a52e['id'],_0x15a52e);TeamEvents[_0x69f2('0x7')](_0x2e7f98,_0x15a52e);_0x456494(null);};}for(var e in events){if(events[_0x69f2('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x69f2('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0203a54..e81eba5 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 _0xeda8=['Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','then','all','lodash','./team.attributes','get','Queues','map','channel','catch','exports','define','Team','teams'];(function(_0x41d33b,_0x23aaf9){var _0x38ce98=function(_0x20f9b4){while(--_0x20f9b4){_0x41d33b['push'](_0x41d33b['shift']());}};_0x38ce98(++_0x23aaf9);}(_0xeda8,0x106));var _0x8eda=function(_0x3b2f52,_0x21ba7f){_0x3b2f52=_0x3b2f52-0x0;var _0x56b46e=_0xeda8[_0x3b2f52];return _0x56b46e;};'use strict';var _=require(_0x8eda('0x0'));var attributes=require(_0x8eda('0x1'));function getQueuesByChannel(_0x4f1986,_0x102ae5){var _0x4b334e=_0x8eda('0x2')+_0x102ae5+_0x8eda('0x3');return _0x4f1986[_0x4b334e]()['then'](function(_0x43c79c){return _[_0x8eda('0x4')](_0x43c79c,function(_0x2d2797){_0x2d2797['setDataValue'](_0x8eda('0x5'),_0x102ae5);return _0x2d2797;});})[_0x8eda('0x6')](function(_0x4be9ec){throw _0x4be9ec;});}module[_0x8eda('0x7')]=function(_0xf4fc75){return _0xf4fc75[_0x8eda('0x8')](_0x8eda('0x9'),attributes,{'tableName':_0x8eda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x515259=this;var _0x47ddf5=[_0x8eda('0xb'),_0x8eda('0xc'),_0x8eda('0xd'),_0x8eda('0xe'),_0x8eda('0xf'),_0x8eda('0x10'),_0x8eda('0x11')];return Promise[_0x8eda('0x12')]()[_0x8eda('0x13')](function(){var _0x54f617=_[_0x8eda('0x4')](_0x47ddf5,function(_0x4d9460){return getQueuesByChannel(_0x515259,_0x4d9460);});return Promise[_0x8eda('0x14')](_0x54f617);})['catch'](function(_0x1b25d9){throw _0x1b25d9;});}}});}; \ No newline at end of file +var _0x297d=['Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','get','Queues','then','map','channel','catch','exports','define','Team','teams'];(function(_0x51885b,_0x310685){var _0x4efee6=function(_0x4d435c){while(--_0x4d435c){_0x51885b['push'](_0x51885b['shift']());}};_0x4efee6(++_0x310685);}(_0x297d,0x1c1));var _0xd297=function(_0x130942,_0x11f3c5){_0x130942=_0x130942-0x0;var _0x16204e=_0x297d[_0x130942];return _0x16204e;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x10cb8f,_0x40773a){var _0x3061c9=_0xd297('0x0')+_0x40773a+_0xd297('0x1');return _0x10cb8f[_0x3061c9]()[_0xd297('0x2')](function(_0x5efabf){return _[_0xd297('0x3')](_0x5efabf,function(_0x488462){_0x488462['setDataValue'](_0xd297('0x4'),_0x40773a);return _0x488462;});})[_0xd297('0x5')](function(_0x4e6267){throw _0x4e6267;});}module[_0xd297('0x6')]=function(_0x583503){return _0x583503[_0xd297('0x7')](_0xd297('0x8'),attributes,{'tableName':_0xd297('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5c659b=this;var _0x282648=['Chat','Fax',_0xd297('0xa'),_0xd297('0xb'),_0xd297('0xc'),_0xd297('0xd'),_0xd297('0xe')];return Promise[_0xd297('0xf')]()[_0xd297('0x2')](function(){var _0x2fbbb7=_[_0xd297('0x3')](_0x282648,function(_0x40c2dd){return getQueuesByChannel(_0x5c659b,_0x40c2dd);});return Promise[_0xd297('0x10')](_0x2fbbb7);})[_0xd297('0x5')](function(_0x1135f2){throw _0x1135f2;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index fd247c7..197bf4f 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 _0xa6f9=['redis','defaults','localhost','socket.io-emitter','./team.socket','register','info','request\x20sent','stringify','error','message','Team,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x383f90,_0x42edf5){var _0x101752=function(_0x2669c9){while(--_0x2669c9){_0x383f90['push'](_0x383f90['shift']());}};_0x101752(++_0x42edf5);}(_0xa6f9,0x1e9));var _0x9a6f=function(_0x1b3711,_0x3493bc){_0x1b3711=_0x1b3711-0x0;var _0x516e51=_0xa6f9[_0x1b3711];return _0x516e51;};'use strict';var _=require(_0x9a6f('0x0'));var util=require('util');var moment=require(_0x9a6f('0x1'));var BPromise=require(_0x9a6f('0x2'));var rs=require(_0x9a6f('0x3'));var fs=require('fs');var Redis=require(_0x9a6f('0x4'));var db=require(_0x9a6f('0x5'))['db'];var utils=require(_0x9a6f('0x6'));var logger=require(_0x9a6f('0x7'))('rpc');var config=require(_0x9a6f('0x8'));var jayson=require(_0x9a6f('0x9'));var client=jayson[_0x9a6f('0xa')]['http']({'port':0x232a});config[_0x9a6f('0xb')]=_[_0x9a6f('0xc')](config[_0x9a6f('0xb')],{'host':_0x9a6f('0xd'),'port':0x18eb});var socket=require(_0x9a6f('0xe'))(new Redis(config[_0x9a6f('0xb')]));require(_0x9a6f('0xf'))[_0x9a6f('0x10')](socket);function respondWithRpcPromise(_0x14fe10,_0x4e749f,_0x515409){return new BPromise(function(_0x391d46,_0x45e76b){return client['request'](_0x14fe10,_0x515409)['then'](function(_0x58bab8){logger[_0x9a6f('0x11')]('Team,\x20%s,\x20%s',_0x4e749f,_0x9a6f('0x12'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x4e749f,'request\x20sent',JSON[_0x9a6f('0x13')](_0x58bab8));if(_0x58bab8[_0x9a6f('0x14')]){if(_0x58bab8['error']['code']===0x1f4){logger[_0x9a6f('0x14')]('Team,\x20%s,\x20%s',_0x4e749f,_0x58bab8[_0x9a6f('0x14')][_0x9a6f('0x15')]);return _0x45e76b(_0x58bab8[_0x9a6f('0x14')]['message']);}logger[_0x9a6f('0x14')](_0x9a6f('0x16'),_0x4e749f,_0x58bab8[_0x9a6f('0x14')][_0x9a6f('0x15')]);return _0x391d46(_0x58bab8[_0x9a6f('0x14')][_0x9a6f('0x15')]);}else{logger[_0x9a6f('0x11')]('Team,\x20%s,\x20%s',_0x4e749f,_0x9a6f('0x12'));_0x391d46(_0x58bab8[_0x9a6f('0x17')][_0x9a6f('0x15')]);}})[_0x9a6f('0x18')](function(_0x5541ab){logger[_0x9a6f('0x14')](_0x9a6f('0x16'),_0x4e749f,_0x5541ab);_0x45e76b(_0x5541ab);});});} \ No newline at end of file +var _0x58ed=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x446066,_0x31e68f){var _0x45c96f=function(_0x4f4c7f){while(--_0x4f4c7f){_0x446066['push'](_0x446066['shift']());}};_0x45c96f(++_0x31e68f);}(_0x58ed,0xed));var _0xd58e=function(_0x3670fb,_0x2bc44b){_0x3670fb=_0x3670fb-0x0;var _0x4772ba=_0x58ed[_0x3670fb];return _0x4772ba;};'use strict';var _=require(_0xd58e('0x0'));var util=require(_0xd58e('0x1'));var moment=require(_0xd58e('0x2'));var BPromise=require(_0xd58e('0x3'));var rs=require(_0xd58e('0x4'));var fs=require('fs');var Redis=require(_0xd58e('0x5'));var db=require(_0xd58e('0x6'))['db'];var utils=require(_0xd58e('0x7'));var logger=require(_0xd58e('0x8'))(_0xd58e('0x9'));var config=require(_0xd58e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd58e('0xb')][_0xd58e('0xc')]({'port':0x232a});config[_0xd58e('0xd')]=_['defaults'](config[_0xd58e('0xd')],{'host':_0xd58e('0xe'),'port':0x18eb});var socket=require(_0xd58e('0xf'))(new Redis(config[_0xd58e('0xd')]));require(_0xd58e('0x10'))[_0xd58e('0x11')](socket);function respondWithRpcPromise(_0x491258,_0x22026f,_0x253a58){return new BPromise(function(_0x418c7a,_0x3a56d8){return client[_0xd58e('0x12')](_0x491258,_0x253a58)['then'](function(_0x5d348e){logger[_0xd58e('0x13')](_0xd58e('0x14'),_0x22026f,_0xd58e('0x15'));logger[_0xd58e('0x16')]('Team,\x20%s,\x20%s,\x20%s',_0x22026f,'request\x20sent',JSON['stringify'](_0x5d348e));if(_0x5d348e[_0xd58e('0x17')]){if(_0x5d348e[_0xd58e('0x17')]['code']===0x1f4){logger['error'](_0xd58e('0x14'),_0x22026f,_0x5d348e[_0xd58e('0x17')][_0xd58e('0x18')]);return _0x3a56d8(_0x5d348e[_0xd58e('0x17')]['message']);}logger[_0xd58e('0x17')]('Team,\x20%s,\x20%s',_0x22026f,_0x5d348e[_0xd58e('0x17')][_0xd58e('0x18')]);return _0x418c7a(_0x5d348e[_0xd58e('0x17')][_0xd58e('0x18')]);}else{logger[_0xd58e('0x13')](_0xd58e('0x14'),_0x22026f,_0xd58e('0x15'));_0x418c7a(_0x5d348e[_0xd58e('0x19')]['message']);}})[_0xd58e('0x1a')](function(_0x48ea17){logger[_0xd58e('0x17')](_0xd58e('0x14'),_0x22026f,_0x48ea17);_0x3a56d8(_0x48ea17);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8cf2363..05bae92 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 _0x945d=['length','team:','./team.events','save','update','emit','removeListener','register'];(function(_0xc5605,_0x2a6be6){var _0x8f3a49=function(_0x690206){while(--_0x690206){_0xc5605['push'](_0xc5605['shift']());}};_0x8f3a49(++_0x2a6be6);}(_0x945d,0xe2));var _0xd945=function(_0x45e815,_0x6ef037){_0x45e815=_0x45e815-0x0;var _0x3b82cc=_0x945d[_0x45e815];return _0x3b82cc;};'use strict';var TeamEvents=require(_0xd945('0x0'));var events=[_0xd945('0x1'),'remove',_0xd945('0x2')];function createListener(_0x48a906,_0x5af0bc){return function(_0x4c37d4){_0x5af0bc[_0xd945('0x3')](_0x48a906,_0x4c37d4);};}function removeListener(_0x1fe0d7,_0x3e19c1){return function(){TeamEvents[_0xd945('0x4')](_0x1fe0d7,_0x3e19c1);};}exports[_0xd945('0x5')]=function(_0x1a062b){for(var _0x576a58=0x0,_0x520a7c=events[_0xd945('0x6')];_0x576a58<_0x520a7c;_0x576a58++){var _0x4a4763=events[_0x576a58];var _0xb9ffca=createListener(_0xd945('0x7')+_0x4a4763,_0x1a062b);TeamEvents['on'](_0x4a4763,_0xb9ffca);}}; \ No newline at end of file +var _0x18a6=['emit','register','length','team:','remove','update'];(function(_0x58b22e,_0x4102af){var _0x5e2f1b=function(_0x24adcc){while(--_0x24adcc){_0x58b22e['push'](_0x58b22e['shift']());}};_0x5e2f1b(++_0x4102af);}(_0x18a6,0x190));var _0x618a=function(_0x5479f9,_0x2cd28a){_0x5479f9=_0x5479f9-0x0;var _0x3ed301=_0x18a6[_0x5479f9];return _0x3ed301;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x618a('0x0'),_0x618a('0x1')];function createListener(_0x408b6d,_0x5ae080){return function(_0x4a94a5){_0x5ae080[_0x618a('0x2')](_0x408b6d,_0x4a94a5);};}function removeListener(_0x288005,_0xfeed68){return function(){TeamEvents['removeListener'](_0x288005,_0xfeed68);};}exports[_0x618a('0x3')]=function(_0x12e5bd){for(var _0x10ad50=0x0,_0x1e1f92=events[_0x618a('0x4')];_0x10ad50<_0x1e1f92;_0x10ad50++){var _0x4c93b4=events[_0x10ad50];var _0x50fb46=createListener(_0x618a('0x5')+_0x4c93b4,_0x12e5bd);TeamEvents['on'](_0x4c93b4,_0x50fb46);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 604c03a..8d60e85 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 _0x5699=['INTEGER','sequelize','exports'];(function(_0x2068ee,_0x42966a){var _0xa36814=function(_0x35dba2){while(--_0x35dba2){_0x2068ee['push'](_0x2068ee['shift']());}};_0xa36814(++_0x42966a);}(_0x5699,0xaf));var _0x9569=function(_0x58ce85,_0x3b877c){_0x58ce85=_0x58ce85-0x0;var _0x236bd0=_0x5699[_0x58ce85];return _0x236bd0;};'use strict';var Sequelize=require(_0x9569('0x0'));module[_0x9569('0x1')]={'TeamId':{'type':Sequelize[_0x9569('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x710e=['sequelize','INTEGER'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x710e,0xb6));var _0xe710=function(_0xce34af,_0x3ed1cf){_0xce34af=_0xce34af-0x0;var _0xe3371=_0x710e[_0xce34af];return _0xe3371;};'use strict';var Sequelize=require(_0xe710('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xe710('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index c673a05..330d27a 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 _0x757a=['define','team_has_voice_prefixes','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x757a,0xde));var _0xa757=function(_0x88cc4,_0x1a4ef8){_0x88cc4=_0x88cc4-0x0;var _0x31cc44=_0x757a[_0x88cc4];return _0x31cc44;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c71=['util','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x486660,_0x228736){var _0x42381e=function(_0x2ca109){while(--_0x2ca109){_0x486660['push'](_0x486660['shift']());}};_0x42381e(++_0x228736);}(_0x4c71,0x12b));var _0x14c7=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x4c71[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x14c7('0x0'));var util=require(_0x14c7('0x1'));var logger=require('../../config/logger')(_0x14c7('0x2'));var moment=require(_0x14c7('0x3'));var BPromise=require(_0x14c7('0x4'));var rp=require(_0x14c7('0x5'));var fs=require('fs');var path=require(_0x14c7('0x6'));var rimraf=require('rimraf');var config=require(_0x14c7('0x7'));var attributes=require(_0x14c7('0x8'));module[_0x14c7('0x9')]=function(_0x3c6929,_0x5b50b6){return _0x3c6929['define'](_0x14c7('0xa'),attributes,{'tableName':_0x14c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 69937d7..df09257 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2bb19f,_0x380199){var _0x1f8cf7=function(_0x333c9e){while(--_0x333c9e){_0x2bb19f['push'](_0x2bb19f['shift']());}};_0x1f8cf7(++_0x380199);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x59acea,_0x1de2de){var _0x50a9fe=function(_0x1031cc){while(--_0x1031cc){_0x59acea['push'](_0x59acea['shift']());}};_0x50a9fe(++_0x1de2de);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xcb91[_0x2df724];return _0x1b2504;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9006424..064f914 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x32f6=['INTEGER'];(function(_0x417e0a,_0x446db8){var _0x223dab=function(_0x56978c){while(--_0x56978c){_0x417e0a['push'](_0x417e0a['shift']());}};_0x223dab(++_0x446db8);}(_0x32f6,0xbd));var _0x632f=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x32f6[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x632f('0x0')],'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 51790fe..9ecab7c 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 _0xa7b4=['bluebird','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','moment'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x2a607c,_0x2c0ede){_0x2a607c=_0x2a607c-0x0;var _0x46f19a=_0xa7b4[_0x2a607c];return _0x46f19a;};'use strict';var _=require('lodash');var util=require(_0x4a7b('0x0'));var logger=require(_0x4a7b('0x1'))('api');var moment=require(_0x4a7b('0x2'));var BPromise=require(_0x4a7b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a7b('0x4'));var attributes=require(_0x4a7b('0x5'));module['exports']=function(_0x27e783,_0xf43e24){return _0x27e783[_0x4a7b('0x6')](_0x4a7b('0x7'),attributes,{'tableName':_0x4a7b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bd=['../../config/environment','./teamVoiceQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3cd51b,_0x2967f8){var _0x3db403=function(_0x86056c){while(--_0x86056c){_0x3cd51b['push'](_0x3cd51b['shift']());}};_0x3db403(++_0x2967f8);}(_0x81bd,0x7c));var _0xd81b=function(_0x37bf43,_0x5b2339){_0x37bf43=_0x37bf43-0x0;var _0x4101c5=_0x81bd[_0x37bf43];return _0x4101c5;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','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 32742ea..1a89193 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 _0x9df6=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9df6,0x1ca));var _0x69df=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x9df6[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x69df('0x0'));var util=require(_0x69df('0x1'));var moment=require(_0x69df('0x2'));var BPromise=require(_0x69df('0x3'));var rs=require(_0x69df('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69df('0x5'))['db'];var utils=require(_0x69df('0x6'));var logger=require(_0x69df('0x7'))('rpc');var config=require(_0x69df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x69df('0x9')][_0x69df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22b91d,_0x2d6035,_0x2ab3fa){return new BPromise(function(_0x153a9f,_0x5db5e5){return client['request'](_0x22b91d,_0x2ab3fa)[_0x69df('0xb')](function(_0x3f070d){logger[_0x69df('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d6035,_0x69df('0xd'));logger[_0x69df('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2d6035,'request\x20sent',JSON['stringify'](_0x3f070d));if(_0x3f070d['error']){if(_0x3f070d[_0x69df('0xf')][_0x69df('0x10')]===0x1f4){logger[_0x69df('0xf')](_0x69df('0x11'),_0x2d6035,_0x3f070d[_0x69df('0xf')][_0x69df('0x12')]);return _0x5db5e5(_0x3f070d['error'][_0x69df('0x12')]);}logger['error'](_0x69df('0x11'),_0x2d6035,_0x3f070d[_0x69df('0xf')][_0x69df('0x12')]);return _0x153a9f(_0x3f070d[_0x69df('0xf')]['message']);}else{logger[_0x69df('0xc')](_0x69df('0x11'),_0x2d6035,_0x69df('0xd'));_0x153a9f(_0x3f070d['result'][_0x69df('0x12')]);}})[_0x69df('0x13')](function(_0x5b8500){logger[_0x69df('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d6035,_0x5b8500);_0x5db5e5(_0x5b8500);});});} \ No newline at end of file +var _0xd458=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x24045e,_0x3c1540){var _0x5da302=function(_0x30c3c3){while(--_0x30c3c3){_0x24045e['push'](_0x24045e['shift']());}};_0x5da302(++_0x3c1540);}(_0xd458,0x1b9));var _0x8d45=function(_0x2eb3c9,_0x16e31b){_0x2eb3c9=_0x2eb3c9-0x0;var _0x138ff7=_0xd458[_0x2eb3c9];return _0x138ff7;};'use strict';var _=require(_0x8d45('0x0'));var util=require(_0x8d45('0x1'));var moment=require(_0x8d45('0x2'));var BPromise=require(_0x8d45('0x3'));var rs=require(_0x8d45('0x4'));var fs=require('fs');var Redis=require(_0x8d45('0x5'));var db=require(_0x8d45('0x6'))['db'];var utils=require(_0x8d45('0x7'));var logger=require(_0x8d45('0x8'))(_0x8d45('0x9'));var config=require('../../config/environment');var jayson=require(_0x8d45('0xa'));var client=jayson[_0x8d45('0xb')][_0x8d45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fd970,_0x5380eb,_0x397264){return new BPromise(function(_0x209e2e,_0x880e7b){return client['request'](_0x4fd970,_0x397264)[_0x8d45('0xd')](function(_0x2bd67c){logger[_0x8d45('0xe')](_0x8d45('0xf'),_0x5380eb,_0x8d45('0x10'));logger[_0x8d45('0x11')](_0x8d45('0x12'),_0x5380eb,_0x8d45('0x10'),JSON[_0x8d45('0x13')](_0x2bd67c));if(_0x2bd67c[_0x8d45('0x14')]){if(_0x2bd67c[_0x8d45('0x14')][_0x8d45('0x15')]===0x1f4){logger[_0x8d45('0x14')](_0x8d45('0xf'),_0x5380eb,_0x2bd67c[_0x8d45('0x14')][_0x8d45('0x16')]);return _0x880e7b(_0x2bd67c[_0x8d45('0x14')]['message']);}logger[_0x8d45('0x14')](_0x8d45('0xf'),_0x5380eb,_0x2bd67c[_0x8d45('0x14')][_0x8d45('0x16')]);return _0x209e2e(_0x2bd67c['error'][_0x8d45('0x16')]);}else{logger[_0x8d45('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5380eb,_0x8d45('0x10'));_0x209e2e(_0x2bd67c['result']['message']);}})[_0x8d45('0x17')](function(_0x470277){logger[_0x8d45('0x14')](_0x8d45('0xf'),_0x5380eb,_0x470277);_0x880e7b(_0x470277);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3e24667..d1e169a 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 _0x8b52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x590985,_0x3a1e02){var _0x2d8d61=function(_0x406e48){while(--_0x406e48){_0x590985['push'](_0x590985['shift']());}};_0x2d8d61(++_0x3a1e02);}(_0x8b52,0x151));var _0x28b5=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8b52[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x28b5('0x0'));var util=require(_0x28b5('0x1'));var path=require(_0x28b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x28b5('0x3'));var router=express[_0x28b5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28b5('0x5'));var interaction=require(_0x28b5('0x6'));var config=require(_0x28b5('0x7'));var controller=require(_0x28b5('0x8'));router[_0x28b5('0x9')]('/',auth[_0x28b5('0xa')](),controller[_0x28b5('0xb')]);router[_0x28b5('0x9')](_0x28b5('0xc'),auth['isAuthenticated'](),controller[_0x28b5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x28b5('0xe')]);router[_0x28b5('0xf')]('/:id',auth[_0x28b5('0xa')](),controller[_0x28b5('0x10')]);router['delete'](_0x28b5('0xc'),auth[_0x28b5('0xa')](),controller[_0x28b5('0x11')]);module[_0x28b5('0x12')]=router; \ No newline at end of file +var _0x6c45=['index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x38ab6d,_0x279eb9){var _0x282ebd=function(_0x25d222){while(--_0x25d222){_0x38ab6d['push'](_0x38ab6d['shift']());}};_0x282ebd(++_0x279eb9);}(_0x6c45,0xb1));var _0x56c4=function(_0x2748f4,_0x4baa81){_0x2748f4=_0x2748f4-0x0;var _0x57da83=_0x6c45[_0x2748f4];return _0x57da83;};'use strict';var multer=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var path=require('path');var timeout=require(_0x56c4('0x2'));var express=require(_0x56c4('0x3'));var router=express[_0x56c4('0x4')]();var fs_extra=require(_0x56c4('0x5'));var auth=require(_0x56c4('0x6'));var interaction=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var controller=require(_0x56c4('0x9'));router[_0x56c4('0xa')]('/',auth[_0x56c4('0xb')](),controller[_0x56c4('0xc')]);router[_0x56c4('0xa')](_0x56c4('0xd'),auth[_0x56c4('0xb')](),controller[_0x56c4('0xe')]);router[_0x56c4('0xf')]('/',auth[_0x56c4('0xb')](),controller[_0x56c4('0x10')]);router[_0x56c4('0x11')](_0x56c4('0xd'),auth['isAuthenticated'](),controller[_0x56c4('0x12')]);router[_0x56c4('0x13')](_0x56c4('0xd'),auth[_0x56c4('0xb')](),controller['destroy']);module[_0x56c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ce62a7d..a9b132c 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 _0xde3d=['TEXT','sequelize','exports','STRING'];(function(_0x2a99dd,_0x228918){var _0x154fe0=function(_0x442464){while(--_0x442464){_0x2a99dd['push'](_0x2a99dd['shift']());}};_0x154fe0(++_0x228918);}(_0xde3d,0x185));var _0xdde3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xde3d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xdde3('0x0'));module[_0xdde3('0x1')]={'name':{'type':Sequelize[_0xdde3('0x2')]},'description':{'type':Sequelize[_0xdde3('0x2')]},'html':{'type':Sequelize[_0xdde3('0x3')]}}; \ No newline at end of file +var _0x6f5e=['STRING','TEXT','sequelize','exports'];(function(_0x1f788d,_0x3acaea){var _0x4ffb91=function(_0x58b8f3){while(--_0x58b8f3){_0x1f788d['push'](_0x1f788d['shift']());}};_0x4ffb91(++_0x3acaea);}(_0x6f5e,0x10a));var _0xe6f5=function(_0x489d76,_0x353674){_0x489d76=_0x489d76-0x0;var _0x2f8fb2=_0x6f5e[_0x489d76];return _0x2f8fb2;};'use strict';var Sequelize=require(_0xe6f5('0x0'));module[_0xe6f5('0x1')]={'name':{'type':Sequelize[_0xe6f5('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xe6f5('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9a0bbe1..8e9dbf9 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 _0x4c0c=['moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2c4729,_0x502940){var _0x5a6f14=function(_0x429681){while(--_0x429681){_0x2c4729['push'](_0x2c4729['shift']());}};_0x5a6f14(++_0x502940);}(_0x4c0c,0xfa));var _0xc4c0=function(_0x24930c,_0xf01ff1){_0x24930c=_0x24930c-0x0;var _0x3ff362=_0x4c0c[_0x24930c];return _0x3ff362;};'use strict';var emlformat=require(_0xc4c0('0x0'));var rimraf=require(_0xc4c0('0x1'));var zipdir=require(_0xc4c0('0x2'));var jsonpatch=require(_0xc4c0('0x3'));var rp=require(_0xc4c0('0x4'));var moment=require(_0xc4c0('0x5'));var BPromise=require(_0xc4c0('0x6'));var Mustache=require(_0xc4c0('0x7'));var util=require(_0xc4c0('0x8'));var path=require(_0xc4c0('0x9'));var sox=require(_0xc4c0('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4c0('0xb'));var squel=require(_0xc4c0('0xc'));var crypto=require(_0xc4c0('0xd'));var jsforce=require(_0xc4c0('0xe'));var deskjs=require(_0xc4c0('0xf'));var toCsv=require(_0xc4c0('0x10'));var querystring=require(_0xc4c0('0x11'));var Papa=require(_0xc4c0('0x12'));var Redis=require('ioredis');var authService=require(_0xc4c0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc4c0('0x14'));var hardwareService=require(_0xc4c0('0x15'));var logger=require('../../config/logger')(_0xc4c0('0x16'));var utils=require('../../config/utils');var config=require(_0xc4c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4c0('0x18'))['db'];function respondWithStatusCode(_0x160b6d,_0x2ca915){_0x2ca915=_0x2ca915||0xcc;return function(_0x39754d){if(_0x39754d){return _0x160b6d[_0xc4c0('0x19')](_0x2ca915);}return _0x160b6d['status'](_0x2ca915)[_0xc4c0('0x1a')]();};}function respondWithResult(_0x2c2599,_0x14ca68){_0x14ca68=_0x14ca68||0xc8;return function(_0x5b5987){if(_0x5b5987){return _0x2c2599[_0xc4c0('0x1b')](_0x14ca68)[_0xc4c0('0x1c')](_0x5b5987);}};}function respondWithFilteredResult(_0x38bfb7,_0x2c4652){return function(_0x4ca00b){if(_0x4ca00b){var _0x2f72e5=typeof _0x2c4652[_0xc4c0('0x1d')]===_0xc4c0('0x1e')&&typeof _0x2c4652[_0xc4c0('0x1f')]===_0xc4c0('0x1e');var _0x338de2=_0x4ca00b[_0xc4c0('0x20')];var _0xbdbe2c=_0x2f72e5?0x0:_0x2c4652['offset'];var _0x59af8c=_0x2f72e5?_0x4ca00b[_0xc4c0('0x20')]:_0x2c4652[_0xc4c0('0x1d')]+_0x2c4652[_0xc4c0('0x1f')];var _0x5b96d6;if(_0x59af8c>=_0x338de2){_0x59af8c=_0x338de2;_0x5b96d6=0xc8;}else{_0x5b96d6=0xce;}_0x38bfb7[_0xc4c0('0x1b')](_0x5b96d6);return _0x38bfb7[_0xc4c0('0x21')](_0xc4c0('0x22'),_0xbdbe2c+'-'+_0x59af8c+'/'+_0x338de2)[_0xc4c0('0x1c')](_0x4ca00b);}return null;};}function patchUpdates(_0x2c904e){return function(_0xe7012f){try{jsonpatch[_0xc4c0('0x23')](_0xe7012f,_0x2c904e,!![]);}catch(_0x907b24){return BPromise[_0xc4c0('0x24')](_0x907b24);}return _0xe7012f[_0xc4c0('0x25')]();};}function saveUpdates(_0x1c11ee,_0x2a8b5f){return function(_0x23ddbc){if(_0x23ddbc){return _0x23ddbc[_0xc4c0('0x26')](_0x1c11ee)[_0xc4c0('0x27')](function(_0x310401){return _0x310401;});}return null;};}function removeEntity(_0x7a29fd,_0x154ab3){return function(_0x318eb7){if(_0x318eb7){return _0x318eb7[_0xc4c0('0x28')]()[_0xc4c0('0x27')](function(){var _0xcc375f=_0x318eb7[_0xc4c0('0x29')]({'plain':!![]});var _0x140a97=_0xc4c0('0x2a');return db[_0xc4c0('0x2b')]['destroy']({'where':{'type':_0x140a97,'resourceId':_0xcc375f['id']}})[_0xc4c0('0x27')](function(){return _0x318eb7;});})[_0xc4c0('0x27')](function(){_0x7a29fd[_0xc4c0('0x1b')](0xcc)[_0xc4c0('0x1a')]();});}};}function handleEntityNotFound(_0x5f2757,_0x158322){return function(_0xafd9f3){if(!_0xafd9f3){_0x5f2757[_0xc4c0('0x19')](0x194);}return _0xafd9f3;};}function handleError(_0x383bab,_0x2c9c76){_0x2c9c76=_0x2c9c76||0x1f4;return function(_0x501535){logger[_0xc4c0('0x2c')](_0x501535[_0xc4c0('0x2d')]);if(_0x501535['name']){delete _0x501535[_0xc4c0('0x2e')];}_0x383bab[_0xc4c0('0x1b')](_0x2c9c76)['send'](_0x501535);};}exports['index']=function(_0x36a4f6,_0x53cc80){var _0x4184e4={},_0x38ef84={},_0x4e1e06={'count':0x0,'rows':[]};var _0x34647d=_[_0xc4c0('0x2f')](db[_0xc4c0('0x30')][_0xc4c0('0x31')],function(_0x5d98ff){return{'name':_0x5d98ff[_0xc4c0('0x32')],'type':_0x5d98ff[_0xc4c0('0x33')][_0xc4c0('0x34')]};});_0x38ef84['model']=_[_0xc4c0('0x2f')](_0x34647d,_0xc4c0('0x2e'));_0x38ef84[_0xc4c0('0x35')]=_[_0xc4c0('0x36')](_0x36a4f6[_0xc4c0('0x35')]);_0x38ef84[_0xc4c0('0x37')]=_[_0xc4c0('0x38')](_0x38ef84[_0xc4c0('0x39')],_0x38ef84[_0xc4c0('0x35')]);_0x4184e4[_0xc4c0('0x3a')]=_['intersection'](_0x38ef84[_0xc4c0('0x39')],qs[_0xc4c0('0x3b')](_0x36a4f6['query'][_0xc4c0('0x3b')]));_0x4184e4['attributes']=_0x4184e4[_0xc4c0('0x3a')][_0xc4c0('0x3c')]?_0x4184e4[_0xc4c0('0x3a')]:_0x38ef84[_0xc4c0('0x39')];if(!_0x36a4f6[_0xc4c0('0x35')][_0xc4c0('0x3d')]('nolimit')){_0x4184e4[_0xc4c0('0x1f')]=qs[_0xc4c0('0x1f')](_0x36a4f6[_0xc4c0('0x35')][_0xc4c0('0x1f')]);_0x4184e4[_0xc4c0('0x1d')]=qs['offset'](_0x36a4f6['query'][_0xc4c0('0x1d')]);}_0x4184e4[_0xc4c0('0x3e')]=qs[_0xc4c0('0x3f')](_0x36a4f6[_0xc4c0('0x35')][_0xc4c0('0x3f')]);_0x4184e4['where']=qs[_0xc4c0('0x37')](_[_0xc4c0('0x40')](_0x36a4f6[_0xc4c0('0x35')],_0x38ef84[_0xc4c0('0x37')]),_0x34647d);if(_0x36a4f6['query']['filter']){_0x4184e4[_0xc4c0('0x41')]=_[_0xc4c0('0x42')](_0x4184e4[_0xc4c0('0x41')],{'$or':_['map'](_0x34647d,function(_0x391837){if(_0x391837[_0xc4c0('0x33')]!==_0xc4c0('0x43')){var _0x4fe3c4={};_0x4fe3c4[_0x391837[_0xc4c0('0x2e')]]={'$like':'%'+_0x36a4f6[_0xc4c0('0x35')]['filter']+'%'};return _0x4fe3c4;}})});}_0x4184e4=_[_0xc4c0('0x42')]({},_0x4184e4,_0x36a4f6['options']);var _0x53ebc3={'where':_0x4184e4[_0xc4c0('0x41')]};return db['Template'][_0xc4c0('0x20')](_0x53ebc3)['then'](function(_0xf8fbb2){_0x4e1e06[_0xc4c0('0x20')]=_0xf8fbb2;if(_0x36a4f6[_0xc4c0('0x35')]['includeAll']){_0x4184e4[_0xc4c0('0x44')]=[{'all':!![]}];}return db[_0xc4c0('0x30')][_0xc4c0('0x45')](_0x4184e4);})[_0xc4c0('0x27')](function(_0x1a5ef6){_0x4e1e06[_0xc4c0('0x46')]=_0x1a5ef6;return _0x4e1e06;})[_0xc4c0('0x27')](respondWithFilteredResult(_0x53cc80,_0x4184e4))[_0xc4c0('0x47')](handleError(_0x53cc80,null));};exports[_0xc4c0('0x48')]=function(_0x3be129,_0x24ea79){var _0x13a80d={'raw':!![],'where':{'id':_0x3be129['params']['id']}},_0x5d8358={};_0x5d8358[_0xc4c0('0x39')]=_[_0xc4c0('0x36')](db[_0xc4c0('0x30')][_0xc4c0('0x31')]);_0x5d8358[_0xc4c0('0x35')]=_['keys'](_0x3be129[_0xc4c0('0x35')]);_0x5d8358[_0xc4c0('0x37')]=_[_0xc4c0('0x38')](_0x5d8358[_0xc4c0('0x39')],_0x5d8358[_0xc4c0('0x35')]);_0x13a80d[_0xc4c0('0x3a')]=_[_0xc4c0('0x38')](_0x5d8358[_0xc4c0('0x39')],qs['fields'](_0x3be129[_0xc4c0('0x35')][_0xc4c0('0x3b')]));_0x13a80d[_0xc4c0('0x3a')]=_0x13a80d[_0xc4c0('0x3a')][_0xc4c0('0x3c')]?_0x13a80d[_0xc4c0('0x3a')]:_0x5d8358['model'];if(_0x3be129[_0xc4c0('0x35')][_0xc4c0('0x49')]){_0x13a80d[_0xc4c0('0x44')]=[{'all':!![]}];}_0x13a80d=_[_0xc4c0('0x42')]({},_0x13a80d,_0x3be129[_0xc4c0('0x4a')]);return db['Template'][_0xc4c0('0x4b')](_0x13a80d)['then'](handleEntityNotFound(_0x24ea79,null))[_0xc4c0('0x27')](respondWithResult(_0x24ea79,null))['catch'](handleError(_0x24ea79,null));};exports['create']=function(_0x139a36,_0x4503c1){return db[_0xc4c0('0x30')][_0xc4c0('0x4c')](_0x139a36[_0xc4c0('0x4d')],{})[_0xc4c0('0x27')](function(_0x5a875f){var _0x3eebe8=_0x139a36[_0xc4c0('0x4e')][_0xc4c0('0x29')]({'plain':!![]});if(!_0x3eebe8)throw new Error(_0xc4c0('0x4f'));if(_0x3eebe8[_0xc4c0('0x50')]===_0xc4c0('0x4e')){var _0x38fde5=_0x5a875f[_0xc4c0('0x29')]({'plain':!![]});var _0x59e4f6=_0xc4c0('0x2a');return db[_0xc4c0('0x51')][_0xc4c0('0x4b')]({'where':{'name':_0x59e4f6,'userProfileId':_0x3eebe8[_0xc4c0('0x52')]},'raw':!![]})[_0xc4c0('0x27')](function(_0x2271a7){if(_0x2271a7&&_0x2271a7['autoAssociation']===0x0){return db[_0xc4c0('0x2b')][_0xc4c0('0x4c')]({'name':_0x38fde5[_0xc4c0('0x2e')],'resourceId':_0x38fde5['id'],'type':_0x2271a7['name'],'sectionId':_0x2271a7['id']},{})[_0xc4c0('0x27')](function(){return _0x5a875f;});}else{return _0x5a875f;}})[_0xc4c0('0x47')](function(_0x49cb11){logger[_0xc4c0('0x2c')](_0xc4c0('0x53'),_0x49cb11);throw _0x49cb11;});}return _0x5a875f;})[_0xc4c0('0x27')](respondWithResult(_0x4503c1,0xc9))[_0xc4c0('0x47')](handleError(_0x4503c1,null));};exports[_0xc4c0('0x26')]=function(_0x42ae84,_0x3f938a){if(_0x42ae84[_0xc4c0('0x4d')]['id']){delete _0x42ae84['body']['id'];}return db[_0xc4c0('0x30')][_0xc4c0('0x4b')]({'where':{'id':_0x42ae84['params']['id']}})[_0xc4c0('0x27')](handleEntityNotFound(_0x3f938a,null))[_0xc4c0('0x27')](saveUpdates(_0x42ae84[_0xc4c0('0x4d')],null))[_0xc4c0('0x27')](respondWithResult(_0x3f938a,null))[_0xc4c0('0x47')](handleError(_0x3f938a,null));};exports[_0xc4c0('0x28')]=function(_0x1cde1a,_0xd98d4e){return db['Template'][_0xc4c0('0x4b')]({'where':{'id':_0x1cde1a[_0xc4c0('0x54')]['id']}})[_0xc4c0('0x27')](handleEntityNotFound(_0xd98d4e,null))[_0xc4c0('0x27')](removeEntity(_0xd98d4e,null))[_0xc4c0('0x47')](handleError(_0xd98d4e,null));}; \ No newline at end of file +var _0xbc1f=['update','then','get','Templates','UserProfileResource','sendStatus','name','index','Template','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','user','role','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','apply','reject','save'];(function(_0x1a60e6,_0x25e6a6){var _0x5c802e=function(_0x55bfc5){while(--_0x55bfc5){_0x1a60e6['push'](_0x1a60e6['shift']());}};_0x5c802e(++_0x25e6a6);}(_0xbc1f,0x104));var _0xfbc1=function(_0x2ddd02,_0x5d2742){_0x2ddd02=_0x2ddd02-0x0;var _0x3bd763=_0xbc1f[_0x2ddd02];return _0x3bd763;};'use strict';var emlformat=require(_0xfbc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbc1('0x1'));var jsonpatch=require(_0xfbc1('0x2'));var rp=require(_0xfbc1('0x3'));var moment=require(_0xfbc1('0x4'));var BPromise=require(_0xfbc1('0x5'));var Mustache=require(_0xfbc1('0x6'));var util=require('util');var path=require(_0xfbc1('0x7'));var sox=require('sox');var csv=require(_0xfbc1('0x8'));var ejs=require(_0xfbc1('0x9'));var fs=require('fs');var fs_extra=require(_0xfbc1('0xa'));var _=require(_0xfbc1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfbc1('0xc'));var deskjs=require(_0xfbc1('0xd'));var toCsv=require(_0xfbc1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfbc1('0xe'));var authService=require(_0xfbc1('0xf'));var qs=require(_0xfbc1('0x10'));var as=require(_0xfbc1('0x11'));var hardwareService=require(_0xfbc1('0x12'));var logger=require(_0xfbc1('0x13'))(_0xfbc1('0x14'));var utils=require(_0xfbc1('0x15'));var config=require(_0xfbc1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51b9d9,_0x456bbf){_0x456bbf=_0x456bbf||0xcc;return function(_0x20d986){if(_0x20d986){return _0x51b9d9['sendStatus'](_0x456bbf);}return _0x51b9d9['status'](_0x456bbf)['end']();};}function respondWithResult(_0x4efed1,_0x2da168){_0x2da168=_0x2da168||0xc8;return function(_0x7b5394){if(_0x7b5394){return _0x4efed1[_0xfbc1('0x17')](_0x2da168)[_0xfbc1('0x18')](_0x7b5394);}};}function respondWithFilteredResult(_0x124369,_0x5c0aad){return function(_0x4be2c8){if(_0x4be2c8){var _0x4ad694=typeof _0x5c0aad[_0xfbc1('0x19')]===_0xfbc1('0x1a')&&typeof _0x5c0aad[_0xfbc1('0x1b')]===_0xfbc1('0x1a');var _0x5b49fd=_0x4be2c8['count'];var _0x3eee06=_0x4ad694?0x0:_0x5c0aad[_0xfbc1('0x19')];var _0x1c30d3=_0x4ad694?_0x4be2c8[_0xfbc1('0x1c')]:_0x5c0aad[_0xfbc1('0x19')]+_0x5c0aad['limit'];var _0x59ac95;if(_0x1c30d3>=_0x5b49fd){_0x1c30d3=_0x5b49fd;_0x59ac95=0xc8;}else{_0x59ac95=0xce;}_0x124369[_0xfbc1('0x17')](_0x59ac95);return _0x124369['set']('Content-Range',_0x3eee06+'-'+_0x1c30d3+'/'+_0x5b49fd)[_0xfbc1('0x18')](_0x4be2c8);}return null;};}function patchUpdates(_0x3a3fbb){return function(_0x1a8de1){try{jsonpatch[_0xfbc1('0x1d')](_0x1a8de1,_0x3a3fbb,!![]);}catch(_0x4f62a7){return BPromise[_0xfbc1('0x1e')](_0x4f62a7);}return _0x1a8de1[_0xfbc1('0x1f')]();};}function saveUpdates(_0x35fdc6,_0x2dff1c){return function(_0x755f2f){if(_0x755f2f){return _0x755f2f[_0xfbc1('0x20')](_0x35fdc6)[_0xfbc1('0x21')](function(_0x3052e1){return _0x3052e1;});}return null;};}function removeEntity(_0x5cf502,_0x5cd5ee){return function(_0xe9f63a){if(_0xe9f63a){return _0xe9f63a['destroy']()['then'](function(){var _0x254b5f=_0xe9f63a[_0xfbc1('0x22')]({'plain':!![]});var _0x24904a=_0xfbc1('0x23');return db[_0xfbc1('0x24')]['destroy']({'where':{'type':_0x24904a,'resourceId':_0x254b5f['id']}})[_0xfbc1('0x21')](function(){return _0xe9f63a;});})[_0xfbc1('0x21')](function(){_0x5cf502['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x352ef9,_0x43f6ec){return function(_0x5832c7){if(!_0x5832c7){_0x352ef9[_0xfbc1('0x25')](0x194);}return _0x5832c7;};}function handleError(_0x1d81d3,_0xc0276b){_0xc0276b=_0xc0276b||0x1f4;return function(_0x53308a){logger['error'](_0x53308a['stack']);if(_0x53308a[_0xfbc1('0x26')]){delete _0x53308a[_0xfbc1('0x26')];}_0x1d81d3['status'](_0xc0276b)['send'](_0x53308a);};}exports[_0xfbc1('0x27')]=function(_0x14757e,_0x1418e7){var _0x49aa77={},_0x2a48af={},_0x203a26={'count':0x0,'rows':[]};var _0x3d2f86=_['map'](db[_0xfbc1('0x28')][_0xfbc1('0x29')],function(_0x11aad0){return{'name':_0x11aad0['fieldName'],'type':_0x11aad0['type'][_0xfbc1('0x2a')]};});_0x2a48af[_0xfbc1('0x2b')]=_[_0xfbc1('0x2c')](_0x3d2f86,_0xfbc1('0x26'));_0x2a48af[_0xfbc1('0x2d')]=_[_0xfbc1('0x2e')](_0x14757e[_0xfbc1('0x2d')]);_0x2a48af[_0xfbc1('0x2f')]=_[_0xfbc1('0x30')](_0x2a48af['model'],_0x2a48af['query']);_0x49aa77[_0xfbc1('0x31')]=_[_0xfbc1('0x30')](_0x2a48af[_0xfbc1('0x2b')],qs[_0xfbc1('0x32')](_0x14757e[_0xfbc1('0x2d')][_0xfbc1('0x32')]));_0x49aa77['attributes']=_0x49aa77[_0xfbc1('0x31')][_0xfbc1('0x33')]?_0x49aa77[_0xfbc1('0x31')]:_0x2a48af['model'];if(!_0x14757e['query'][_0xfbc1('0x34')](_0xfbc1('0x35'))){_0x49aa77[_0xfbc1('0x1b')]=qs[_0xfbc1('0x1b')](_0x14757e[_0xfbc1('0x2d')][_0xfbc1('0x1b')]);_0x49aa77[_0xfbc1('0x19')]=qs['offset'](_0x14757e['query'][_0xfbc1('0x19')]);}_0x49aa77[_0xfbc1('0x36')]=qs[_0xfbc1('0x37')](_0x14757e['query'][_0xfbc1('0x37')]);_0x49aa77[_0xfbc1('0x38')]=qs[_0xfbc1('0x2f')](_[_0xfbc1('0x39')](_0x14757e['query'],_0x2a48af[_0xfbc1('0x2f')]),_0x3d2f86);if(_0x14757e[_0xfbc1('0x2d')][_0xfbc1('0x3a')]){_0x49aa77[_0xfbc1('0x38')]=_[_0xfbc1('0x3b')](_0x49aa77[_0xfbc1('0x38')],{'$or':_['map'](_0x3d2f86,function(_0x4fe7bb){if(_0x4fe7bb[_0xfbc1('0x3c')]!==_0xfbc1('0x3d')){var _0x3b696a={};_0x3b696a[_0x4fe7bb[_0xfbc1('0x26')]]={'$like':'%'+_0x14757e[_0xfbc1('0x2d')]['filter']+'%'};return _0x3b696a;}})});}_0x49aa77=_['merge']({},_0x49aa77,_0x14757e['options']);var _0x5a7338={'where':_0x49aa77[_0xfbc1('0x38')]};return db['Template'][_0xfbc1('0x1c')](_0x5a7338)[_0xfbc1('0x21')](function(_0x300aa9){_0x203a26[_0xfbc1('0x1c')]=_0x300aa9;if(_0x14757e[_0xfbc1('0x2d')][_0xfbc1('0x3e')]){_0x49aa77[_0xfbc1('0x3f')]=[{'all':!![]}];}return db[_0xfbc1('0x28')][_0xfbc1('0x40')](_0x49aa77);})[_0xfbc1('0x21')](function(_0x748ae5){_0x203a26['rows']=_0x748ae5;return _0x203a26;})[_0xfbc1('0x21')](respondWithFilteredResult(_0x1418e7,_0x49aa77))[_0xfbc1('0x41')](handleError(_0x1418e7,null));};exports[_0xfbc1('0x42')]=function(_0x354c90,_0x2543ad){var _0x568c2f={'raw':!![],'where':{'id':_0x354c90[_0xfbc1('0x43')]['id']}},_0x256159={};_0x256159['model']=_[_0xfbc1('0x2e')](db['Template'][_0xfbc1('0x29')]);_0x256159[_0xfbc1('0x2d')]=_[_0xfbc1('0x2e')](_0x354c90[_0xfbc1('0x2d')]);_0x256159[_0xfbc1('0x2f')]=_['intersection'](_0x256159[_0xfbc1('0x2b')],_0x256159[_0xfbc1('0x2d')]);_0x568c2f['attributes']=_[_0xfbc1('0x30')](_0x256159['model'],qs[_0xfbc1('0x32')](_0x354c90['query'][_0xfbc1('0x32')]));_0x568c2f[_0xfbc1('0x31')]=_0x568c2f[_0xfbc1('0x31')][_0xfbc1('0x33')]?_0x568c2f[_0xfbc1('0x31')]:_0x256159[_0xfbc1('0x2b')];if(_0x354c90[_0xfbc1('0x2d')][_0xfbc1('0x3e')]){_0x568c2f[_0xfbc1('0x3f')]=[{'all':!![]}];}_0x568c2f=_[_0xfbc1('0x3b')]({},_0x568c2f,_0x354c90['options']);return db[_0xfbc1('0x28')][_0xfbc1('0x44')](_0x568c2f)[_0xfbc1('0x21')](handleEntityNotFound(_0x2543ad,null))[_0xfbc1('0x21')](respondWithResult(_0x2543ad,null))[_0xfbc1('0x41')](handleError(_0x2543ad,null));};exports['create']=function(_0x298d9e,_0x144da9){return db[_0xfbc1('0x28')][_0xfbc1('0x45')](_0x298d9e[_0xfbc1('0x46')],{})[_0xfbc1('0x21')](function(_0x1c7e5e){var _0x2a9155=_0x298d9e[_0xfbc1('0x47')]['get']({'plain':!![]});if(!_0x2a9155)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a9155[_0xfbc1('0x48')]==='user'){var _0x38997b=_0x1c7e5e['get']({'plain':!![]});var _0x52452a=_0xfbc1('0x23');return db['UserProfileSection'][_0xfbc1('0x44')]({'where':{'name':_0x52452a,'userProfileId':_0x2a9155['userProfileId']},'raw':!![]})[_0xfbc1('0x21')](function(_0x356d7b){if(_0x356d7b&&_0x356d7b['autoAssociation']===0x0){return db[_0xfbc1('0x24')]['create']({'name':_0x38997b[_0xfbc1('0x26')],'resourceId':_0x38997b['id'],'type':_0x356d7b[_0xfbc1('0x26')],'sectionId':_0x356d7b['id']},{})['then'](function(){return _0x1c7e5e;});}else{return _0x1c7e5e;}})['catch'](function(_0x3941a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3941a6);throw _0x3941a6;});}return _0x1c7e5e;})[_0xfbc1('0x21')](respondWithResult(_0x144da9,0xc9))[_0xfbc1('0x41')](handleError(_0x144da9,null));};exports['update']=function(_0x566b1c,_0x31cd68){if(_0x566b1c[_0xfbc1('0x46')]['id']){delete _0x566b1c['body']['id'];}return db[_0xfbc1('0x28')]['find']({'where':{'id':_0x566b1c['params']['id']}})['then'](handleEntityNotFound(_0x31cd68,null))[_0xfbc1('0x21')](saveUpdates(_0x566b1c[_0xfbc1('0x46')],null))[_0xfbc1('0x21')](respondWithResult(_0x31cd68,null))[_0xfbc1('0x41')](handleError(_0x31cd68,null));};exports['destroy']=function(_0x3e1a44,_0x44a567){return db['Template'][_0xfbc1('0x44')]({'where':{'id':_0x3e1a44[_0xfbc1('0x43')]['id']}})[_0xfbc1('0x21')](handleEntityNotFound(_0x44a567,null))[_0xfbc1('0x21')](removeEntity(_0x44a567,null))[_0xfbc1('0x41')](handleError(_0x44a567,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b019c19..8fbe6e6 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 _0x1283=['exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x111f99,_0x3b347f){var _0x3687c0=function(_0x4641d7){while(--_0x4641d7){_0x111f99['push'](_0x111f99['shift']());}};_0x3687c0(++_0x3b347f);}(_0x1283,0x98));var _0x3128=function(_0x1bb0b8,_0x24add2){_0x1bb0b8=_0x1bb0b8-0x0;var _0x22fc67=_0x1283[_0x1bb0b8];return _0x22fc67;};'use strict';var _=require(_0x3128('0x0'));var util=require(_0x3128('0x1'));var logger=require(_0x3128('0x2'))('api');var moment=require(_0x3128('0x3'));var BPromise=require(_0x3128('0x4'));var rp=require(_0x3128('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3128('0x6'));var config=require(_0x3128('0x7'));var attributes=require('./template.attributes');module[_0x3128('0x8')]=function(_0x3b605a,_0x2fd2dc){return _0x3b605a[_0x3128('0x9')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x486b=['api','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x486b,0x183));var _0xb486=function(_0x4d4bea,_0x36231c){_0x4d4bea=_0x4d4bea-0x0;var _0x5d523b=_0x486b[_0x4d4bea];return _0x5d523b;};'use strict';var _=require(_0xb486('0x0'));var util=require(_0xb486('0x1'));var logger=require(_0xb486('0x2'))(_0xb486('0x3'));var moment=require(_0xb486('0x4'));var BPromise=require(_0xb486('0x5'));var rp=require(_0xb486('0x6'));var fs=require('fs');var path=require(_0xb486('0x7'));var rimraf=require('rimraf');var config=require(_0xb486('0x8'));var attributes=require(_0xb486('0x9'));module[_0xb486('0xa')]=function(_0x36c769,_0x3e8c97){return _0x36c769[_0xb486('0xb')]('Template',attributes,{'tableName':_0xb486('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 6e7f8e5..3dde28c 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 _0xa46a=['include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetTemplate','Template','options','where','attributes','limit'];(function(_0x5b3a0e,_0x1d8878){var _0x10b7b8=function(_0xfc0186){while(--_0xfc0186){_0x5b3a0e['push'](_0x5b3a0e['shift']());}};_0x10b7b8(++_0x1d8878);}(_0xa46a,0x113));var _0xaa46=function(_0x584229,_0x11c7c9){_0x584229=_0x584229-0x0;var _0x334eae=_0xa46a[_0x584229];return _0x334eae;};'use strict';var _=require(_0xaa46('0x0'));var util=require(_0xaa46('0x1'));var moment=require(_0xaa46('0x2'));var BPromise=require(_0xaa46('0x3'));var rs=require(_0xaa46('0x4'));var fs=require('fs');var Redis=require(_0xaa46('0x5'));var db=require(_0xaa46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa46('0x7'))(_0xaa46('0x8'));var config=require(_0xaa46('0x9'));var jayson=require(_0xaa46('0xa'));var client=jayson[_0xaa46('0xb')][_0xaa46('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xec5249,_0x4aa01b,_0x444f07){return new BPromise(function(_0x264eca,_0x95d0a3){return client[_0xaa46('0xd')](_0xec5249,_0x444f07)[_0xaa46('0xe')](function(_0x50d152){logger['info'](_0xaa46('0xf'),_0x4aa01b,_0xaa46('0x10'));logger[_0xaa46('0x11')]('Template,\x20%s,\x20%s,\x20%s',_0x4aa01b,_0xaa46('0x10'),JSON[_0xaa46('0x12')](_0x50d152));if(_0x50d152[_0xaa46('0x13')]){if(_0x50d152[_0xaa46('0x13')][_0xaa46('0x14')]===0x1f4){logger[_0xaa46('0x13')](_0xaa46('0xf'),_0x4aa01b,_0x50d152[_0xaa46('0x13')][_0xaa46('0x15')]);return _0x95d0a3(_0x50d152[_0xaa46('0x13')][_0xaa46('0x15')]);}logger[_0xaa46('0x13')]('Template,\x20%s,\x20%s',_0x4aa01b,_0x50d152['error'][_0xaa46('0x15')]);return _0x264eca(_0x50d152[_0xaa46('0x13')]['message']);}else{logger[_0xaa46('0x16')](_0xaa46('0xf'),_0x4aa01b,_0xaa46('0x10'));_0x264eca(_0x50d152[_0xaa46('0x17')]['message']);}})[_0xaa46('0x18')](function(_0x916c63){logger[_0xaa46('0x13')](_0xaa46('0xf'),_0x4aa01b,_0x916c63);_0x95d0a3(_0x916c63);});});}exports[_0xaa46('0x19')]=function(_0x35af5b){var _0x2b9379=this;return new Promise(function(_0x3c4366,_0x498f81){return db[_0xaa46('0x1a')]['findAll']({'raw':_0x35af5b[_0xaa46('0x1b')]?_0x35af5b['options']['raw']===undefined?!![]:![]:!![],'where':_0x35af5b[_0xaa46('0x1b')]?_0x35af5b[_0xaa46('0x1b')][_0xaa46('0x1c')]||null:null,'attributes':_0x35af5b[_0xaa46('0x1b')]?_0x35af5b[_0xaa46('0x1b')][_0xaa46('0x1d')]||null:null,'limit':_0x35af5b[_0xaa46('0x1b')]?_0x35af5b['options'][_0xaa46('0x1e')]||null:null,'include':_0x35af5b['options']?_0x35af5b[_0xaa46('0x1b')][_0xaa46('0x1f')]?_[_0xaa46('0x20')](_0x35af5b[_0xaa46('0x1b')][_0xaa46('0x1f')],function(_0x293953){return{'model':db[_0x293953[_0xaa46('0x21')]],'as':_0x293953['as'],'attributes':_0x293953[_0xaa46('0x1d')],'include':_0x293953[_0xaa46('0x1f')]?_[_0xaa46('0x20')](_0x293953[_0xaa46('0x1f')],function(_0x1cc08b){return{'model':db[_0x1cc08b['model']],'as':_0x1cc08b['as'],'attributes':_0x1cc08b['attributes'],'include':_0x1cc08b[_0xaa46('0x1f')]?_[_0xaa46('0x20')](_0x1cc08b[_0xaa46('0x1f')],function(_0x1046f9){return{'model':db[_0x1046f9[_0xaa46('0x21')]],'as':_0x1046f9['as'],'attributes':_0x1046f9[_0xaa46('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaa46('0xe')](function(_0x145452){logger[_0xaa46('0x16')](_0xaa46('0x19'),_0x35af5b);logger[_0xaa46('0x11')](_0xaa46('0x19'),_0x35af5b,JSON[_0xaa46('0x12')](_0x145452));_0x3c4366(_0x145452);})['catch'](function(_0x5633bd){logger[_0xaa46('0x13')](_0xaa46('0x19'),_0x5633bd[_0xaa46('0x15')],_0x35af5b);_0x498f81(_0x2b9379[_0xaa46('0x13')](0x1f4,_0x5633bd['message']));});});}; \ No newline at end of file +var _0x5926=['request\x20sent','debug','stringify','error','message','result','catch','GetTemplate','findAll','options','raw','where','limit','include','map','attributes','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s'];(function(_0x491a40,_0x19aa6e){var _0x1c3e17=function(_0x579739){while(--_0x579739){_0x491a40['push'](_0x491a40['shift']());}};_0x1c3e17(++_0x19aa6e);}(_0x5926,0xdb));var _0x6592=function(_0x4053b5,_0x3bf833){_0x4053b5=_0x4053b5-0x0;var _0x13f224=_0x5926[_0x4053b5];return _0x13f224;};'use strict';var _=require(_0x6592('0x0'));var util=require(_0x6592('0x1'));var moment=require(_0x6592('0x2'));var BPromise=require('bluebird');var rs=require(_0x6592('0x3'));var fs=require('fs');var Redis=require(_0x6592('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6592('0x5'));var config=require(_0x6592('0x6'));var jayson=require(_0x6592('0x7'));var client=jayson[_0x6592('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb90a,_0x4b0365,_0x359176){return new BPromise(function(_0x363253,_0x44005d){return client[_0x6592('0x9')](_0x1bb90a,_0x359176)[_0x6592('0xa')](function(_0x5328a8){logger[_0x6592('0xb')](_0x6592('0xc'),_0x4b0365,_0x6592('0xd'));logger[_0x6592('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4b0365,_0x6592('0xd'),JSON[_0x6592('0xf')](_0x5328a8));if(_0x5328a8['error']){if(_0x5328a8[_0x6592('0x10')]['code']===0x1f4){logger['error'](_0x6592('0xc'),_0x4b0365,_0x5328a8[_0x6592('0x10')][_0x6592('0x11')]);return _0x44005d(_0x5328a8[_0x6592('0x10')][_0x6592('0x11')]);}logger[_0x6592('0x10')](_0x6592('0xc'),_0x4b0365,_0x5328a8[_0x6592('0x10')][_0x6592('0x11')]);return _0x363253(_0x5328a8[_0x6592('0x10')][_0x6592('0x11')]);}else{logger[_0x6592('0xb')](_0x6592('0xc'),_0x4b0365,'request\x20sent');_0x363253(_0x5328a8[_0x6592('0x12')][_0x6592('0x11')]);}})[_0x6592('0x13')](function(_0x35ae11){logger[_0x6592('0x10')](_0x6592('0xc'),_0x4b0365,_0x35ae11);_0x44005d(_0x35ae11);});});}exports[_0x6592('0x14')]=function(_0x2b0029){var _0x3d3b96=this;return new Promise(function(_0x5e742c,_0x591f03){return db['Template'][_0x6592('0x15')]({'raw':_0x2b0029[_0x6592('0x16')]?_0x2b0029[_0x6592('0x16')][_0x6592('0x17')]===undefined?!![]:![]:!![],'where':_0x2b0029['options']?_0x2b0029[_0x6592('0x16')][_0x6592('0x18')]||null:null,'attributes':_0x2b0029['options']?_0x2b0029[_0x6592('0x16')]['attributes']||null:null,'limit':_0x2b0029[_0x6592('0x16')]?_0x2b0029['options'][_0x6592('0x19')]||null:null,'include':_0x2b0029[_0x6592('0x16')]?_0x2b0029[_0x6592('0x16')][_0x6592('0x1a')]?_[_0x6592('0x1b')](_0x2b0029[_0x6592('0x16')][_0x6592('0x1a')],function(_0x1849b7){return{'model':db[_0x1849b7['model']],'as':_0x1849b7['as'],'attributes':_0x1849b7[_0x6592('0x1c')],'include':_0x1849b7[_0x6592('0x1a')]?_[_0x6592('0x1b')](_0x1849b7[_0x6592('0x1a')],function(_0x29758c){return{'model':db[_0x29758c['model']],'as':_0x29758c['as'],'attributes':_0x29758c[_0x6592('0x1c')],'include':_0x29758c['include']?_[_0x6592('0x1b')](_0x29758c[_0x6592('0x1a')],function(_0x1c1122){return{'model':db[_0x1c1122['model']],'as':_0x1c1122['as'],'attributes':_0x1c1122[_0x6592('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6592('0xa')](function(_0x3f611f){logger['info'](_0x6592('0x14'),_0x2b0029);logger[_0x6592('0xe')](_0x6592('0x14'),_0x2b0029,JSON[_0x6592('0xf')](_0x3f611f));_0x5e742c(_0x3f611f);})['catch'](function(_0x38aef4){logger[_0x6592('0x10')](_0x6592('0x14'),_0x38aef4[_0x6592('0x11')],_0x2b0029);_0x591f03(_0x3d3b96[_0x6592('0x10')](0x1f4,_0x38aef4[_0x6592('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0607b9e..9f52f97 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 _0xc765=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','post','create','addAnyCondition','/:id/actions','put','update','destroy','multer','util','path','express','fs-extra'];(function(_0x12d2c3,_0x11584b){var _0xd75c5=function(_0x119cdd){while(--_0x119cdd){_0x12d2c3['push'](_0x12d2c3['shift']());}};_0xd75c5(++_0x11584b);}(_0xc765,0x14b));var _0x5c76=function(_0x1bb746,_0x40a782){_0x1bb746=_0x1bb746-0x0;var _0x27ffbb=_0xc765[_0x1bb746];return _0x27ffbb;};'use strict';var multer=require(_0x5c76('0x0'));var util=require(_0x5c76('0x1'));var path=require(_0x5c76('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c76('0x3'));var router=express['Router']();var fs_extra=require(_0x5c76('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5c76('0x5'));var config=require(_0x5c76('0x6'));var controller=require('./trigger.controller');router[_0x5c76('0x7')]('/',auth[_0x5c76('0x8')](),controller['index']);router['get'](_0x5c76('0x9'),auth['isAuthenticated'](),controller[_0x5c76('0xa')]);router[_0x5c76('0x7')](_0x5c76('0xb'),auth[_0x5c76('0x8')](),controller['getAllConditions']);router[_0x5c76('0x7')](_0x5c76('0xc'),auth['isAuthenticated'](),controller[_0x5c76('0xd')]);router[_0x5c76('0x7')]('/:id/actions',auth[_0x5c76('0x8')](),controller['getActions']);router[_0x5c76('0xe')]('/',auth[_0x5c76('0x8')](),controller[_0x5c76('0xf')]);router[_0x5c76('0xe')](_0x5c76('0xb'),auth[_0x5c76('0x8')](),controller['addAllCondition']);router[_0x5c76('0xe')]('/:id/any_conditions',auth[_0x5c76('0x8')](),controller[_0x5c76('0x10')]);router['post'](_0x5c76('0x11'),auth[_0x5c76('0x8')](),controller['addAction']);router[_0x5c76('0x12')]('/:id',auth[_0x5c76('0x8')](),controller[_0x5c76('0x13')]);router['delete']('/:id',auth[_0x5c76('0x8')](),controller[_0x5c76('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1f93=['getAllConditions','/:id/any_conditions','getActions','post','/:id/actions','addAction','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/all_conditions'];(function(_0x5a40a1,_0x55728c){var _0x5342f3=function(_0x4b72c7){while(--_0x4b72c7){_0x5a40a1['push'](_0x5a40a1['shift']());}};_0x5342f3(++_0x55728c);}(_0x1f93,0x112));var _0x31f9=function(_0x192596,_0x2abfc4){_0x192596=_0x192596-0x0;var _0x35ea89=_0x1f93[_0x192596];return _0x35ea89;};'use strict';var multer=require(_0x31f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x31f9('0x1'));var express=require(_0x31f9('0x2'));var router=express[_0x31f9('0x3')]();var fs_extra=require(_0x31f9('0x4'));var auth=require(_0x31f9('0x5'));var interaction=require(_0x31f9('0x6'));var config=require(_0x31f9('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0x31f9('0x8')](),controller[_0x31f9('0x9')]);router[_0x31f9('0xa')](_0x31f9('0xb'),auth[_0x31f9('0x8')](),controller[_0x31f9('0xc')]);router[_0x31f9('0xa')](_0x31f9('0xd'),auth[_0x31f9('0x8')](),controller[_0x31f9('0xe')]);router[_0x31f9('0xa')](_0x31f9('0xf'),auth[_0x31f9('0x8')](),controller['getAnyConditions']);router[_0x31f9('0xa')]('/:id/actions',auth[_0x31f9('0x8')](),controller[_0x31f9('0x10')]);router['post']('/',auth[_0x31f9('0x8')](),controller['create']);router[_0x31f9('0x11')](_0x31f9('0xd'),auth[_0x31f9('0x8')](),controller['addAllCondition']);router[_0x31f9('0x11')](_0x31f9('0xf'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x31f9('0x11')](_0x31f9('0x12'),auth[_0x31f9('0x8')](),controller[_0x31f9('0x13')]);router[_0x31f9('0x14')](_0x31f9('0xb'),auth[_0x31f9('0x8')](),controller['update']);router[_0x31f9('0x15')](_0x31f9('0xb'),auth[_0x31f9('0x8')](),controller[_0x31f9('0x16')]);module[_0x31f9('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index aa60bd5..b6abbee 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 _0x0a41=['STRING','BOOLEAN','exports'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x0a41,0xe6));var _0x10a4=function(_0x279fc8,_0x1ba427){_0x279fc8=_0x279fc8-0x0;var _0x4521a5=_0x0a41[_0x279fc8];return _0x4521a5;};'use strict';var Sequelize=require('sequelize');module[_0x10a4('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x10a4('0x1')]},'status':{'type':Sequelize[_0x10a4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b5c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x4b5c,0xb8));var _0xc4b5=function(_0xe49ec3,_0x57a4e6){_0xe49ec3=_0xe49ec3-0x0;var _0x18bde1=_0x4b5c[_0xe49ec3];return _0x18bde1;};'use strict';var Sequelize=require(_0xc4b5('0x0'));module[_0xc4b5('0x1')]={'name':{'type':Sequelize[_0xc4b5('0x2')]},'channel':{'type':Sequelize[_0xc4b5('0x2')]},'description':{'type':Sequelize[_0xc4b5('0x2')]},'status':{'type':Sequelize[_0xc4b5('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 6786f2f..f97bdc6 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 _0xb6a3=['sox','to-csv','ejs','fs-extra','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x345e4c,_0x3e73ba){var _0x40c41c=function(_0x23dfe0){while(--_0x23dfe0){_0x345e4c['push'](_0x345e4c['shift']());}};_0x40c41c(++_0x3e73ba);}(_0xb6a3,0x103));var _0x3b6a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb6a3[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x3b6a('0x0'));var rimraf=require(_0x3b6a('0x1'));var zipdir=require(_0x3b6a('0x2'));var jsonpatch=require(_0x3b6a('0x3'));var rp=require(_0x3b6a('0x4'));var moment=require(_0x3b6a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3b6a('0x6'));var util=require(_0x3b6a('0x7'));var path=require('path');var sox=require(_0x3b6a('0x8'));var csv=require(_0x3b6a('0x9'));var ejs=require(_0x3b6a('0xa'));var fs=require('fs');var fs_extra=require(_0x3b6a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b6a('0xc'));var toCsv=require(_0x3b6a('0x9'));var querystring=require(_0x3b6a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b6a('0xe'));var qs=require(_0x3b6a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b6a('0x10'));var logger=require('../../config/logger')(_0x3b6a('0x11'));var utils=require('../../config/utils');var config=require(_0x3b6a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b6a('0x13'))['db'];function respondWithStatusCode(_0x3de3e6,_0x524218){_0x524218=_0x524218||0xcc;return function(_0x8b6cdc){if(_0x8b6cdc){return _0x3de3e6[_0x3b6a('0x14')](_0x524218);}return _0x3de3e6[_0x3b6a('0x15')](_0x524218)[_0x3b6a('0x16')]();};}function respondWithResult(_0x2cc744,_0x11c0c2){_0x11c0c2=_0x11c0c2||0xc8;return function(_0x4c33b1){if(_0x4c33b1){return _0x2cc744[_0x3b6a('0x15')](_0x11c0c2)[_0x3b6a('0x17')](_0x4c33b1);}};}function respondWithFilteredResult(_0x1612f9,_0x1b3497){return function(_0x3f9af0){if(_0x3f9af0){var _0x3573e2=typeof _0x1b3497[_0x3b6a('0x18')]===_0x3b6a('0x19')&&typeof _0x1b3497[_0x3b6a('0x1a')]==='undefined';var _0xd1bda9=_0x3f9af0['count'];var _0x5690c2=_0x3573e2?0x0:_0x1b3497[_0x3b6a('0x18')];var _0xff7463=_0x3573e2?_0x3f9af0[_0x3b6a('0x1b')]:_0x1b3497[_0x3b6a('0x18')]+_0x1b3497[_0x3b6a('0x1a')];var _0x2fd5f8;if(_0xff7463>=_0xd1bda9){_0xff7463=_0xd1bda9;_0x2fd5f8=0xc8;}else{_0x2fd5f8=0xce;}_0x1612f9[_0x3b6a('0x15')](_0x2fd5f8);return _0x1612f9[_0x3b6a('0x1c')](_0x3b6a('0x1d'),_0x5690c2+'-'+_0xff7463+'/'+_0xd1bda9)['json'](_0x3f9af0);}return null;};}function patchUpdates(_0x2f6ceb){return function(_0x5695a0){try{jsonpatch[_0x3b6a('0x1e')](_0x5695a0,_0x2f6ceb,!![]);}catch(_0x17daaa){return BPromise['reject'](_0x17daaa);}return _0x5695a0['save']();};}function saveUpdates(_0x415f8f,_0x44d73e){return function(_0x2f00a8){if(_0x2f00a8){return _0x2f00a8[_0x3b6a('0x1f')](_0x415f8f)[_0x3b6a('0x20')](function(_0x510517){return _0x510517;});}return null;};}function removeEntity(_0x685bdf,_0x4941e8){return function(_0xfa829b){if(_0xfa829b){return _0xfa829b[_0x3b6a('0x21')]()[_0x3b6a('0x20')](function(){var _0x9ee623=_0xfa829b['get']({'plain':!![]});var _0x55a0e8=_0x3b6a('0x22');return db['UserProfileResource'][_0x3b6a('0x21')]({'where':{'type':_0x55a0e8,'resourceId':_0x9ee623['id']}})['then'](function(){return _0xfa829b;});})[_0x3b6a('0x20')](function(){_0x685bdf[_0x3b6a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x147ccd,_0x43d237){return function(_0x1984ae){if(!_0x1984ae){_0x147ccd[_0x3b6a('0x14')](0x194);}return _0x1984ae;};}function handleError(_0x558c1b,_0x2c1a4c){_0x2c1a4c=_0x2c1a4c||0x1f4;return function(_0x16d31f){logger[_0x3b6a('0x23')](_0x16d31f[_0x3b6a('0x24')]);if(_0x16d31f[_0x3b6a('0x25')]){delete _0x16d31f[_0x3b6a('0x25')];}_0x558c1b[_0x3b6a('0x15')](_0x2c1a4c)[_0x3b6a('0x26')](_0x16d31f);};}exports[_0x3b6a('0x27')]=function(_0x55d692,_0x4ed4cc){var _0x3aa94c={},_0x194255={},_0x481954={'count':0x0,'rows':[]};var _0x9c4811=_[_0x3b6a('0x28')](db[_0x3b6a('0x29')][_0x3b6a('0x2a')],function(_0x5b0da2){return{'name':_0x5b0da2[_0x3b6a('0x2b')],'type':_0x5b0da2[_0x3b6a('0x2c')]['key']};});_0x194255[_0x3b6a('0x2d')]=_[_0x3b6a('0x28')](_0x9c4811,'name');_0x194255[_0x3b6a('0x2e')]=_['keys'](_0x55d692[_0x3b6a('0x2e')]);_0x194255[_0x3b6a('0x2f')]=_[_0x3b6a('0x30')](_0x194255['model'],_0x194255['query']);_0x3aa94c['attributes']=_[_0x3b6a('0x30')](_0x194255[_0x3b6a('0x2d')],qs[_0x3b6a('0x31')](_0x55d692[_0x3b6a('0x2e')]['fields']));_0x3aa94c[_0x3b6a('0x32')]=_0x3aa94c[_0x3b6a('0x32')][_0x3b6a('0x33')]?_0x3aa94c['attributes']:_0x194255[_0x3b6a('0x2d')];if(!_0x55d692[_0x3b6a('0x2e')][_0x3b6a('0x34')](_0x3b6a('0x35'))){_0x3aa94c['limit']=qs['limit'](_0x55d692['query'][_0x3b6a('0x1a')]);_0x3aa94c[_0x3b6a('0x18')]=qs['offset'](_0x55d692['query']['offset']);}_0x3aa94c[_0x3b6a('0x36')]=qs[_0x3b6a('0x37')](_0x55d692['query'][_0x3b6a('0x37')]);_0x3aa94c[_0x3b6a('0x38')]=qs[_0x3b6a('0x2f')](_[_0x3b6a('0x39')](_0x55d692[_0x3b6a('0x2e')],_0x194255['filters']),_0x9c4811);if(_0x55d692[_0x3b6a('0x2e')][_0x3b6a('0x3a')]){_0x3aa94c[_0x3b6a('0x38')]=_[_0x3b6a('0x3b')](_0x3aa94c[_0x3b6a('0x38')],{'$or':_[_0x3b6a('0x28')](_0x9c4811,function(_0xe31670){if(_0xe31670[_0x3b6a('0x2c')]!==_0x3b6a('0x3c')){var _0x2bd862={};_0x2bd862[_0xe31670[_0x3b6a('0x25')]]={'$like':'%'+_0x55d692['query'][_0x3b6a('0x3a')]+'%'};return _0x2bd862;}})});}_0x3aa94c=_['merge']({},_0x3aa94c,_0x55d692['options']);var _0x2bedf7={'where':_0x3aa94c[_0x3b6a('0x38')]};return db[_0x3b6a('0x29')]['count'](_0x2bedf7)[_0x3b6a('0x20')](function(_0x54a05b){_0x481954['count']=_0x54a05b;if(_0x55d692[_0x3b6a('0x2e')]['includeAll']){_0x3aa94c[_0x3b6a('0x3d')]=[{'all':!![]}];}return db[_0x3b6a('0x29')][_0x3b6a('0x3e')](_0x3aa94c);})['then'](function(_0x4e371f){_0x481954[_0x3b6a('0x3f')]=_0x4e371f;return _0x481954;})[_0x3b6a('0x20')](respondWithFilteredResult(_0x4ed4cc,_0x3aa94c))[_0x3b6a('0x40')](handleError(_0x4ed4cc,null));};exports['show']=function(_0x2e8952,_0x21a6e5){var _0x1106a4={'raw':![],'where':{'id':_0x2e8952[_0x3b6a('0x41')]['id']}},_0x1dae9d={};_0x1dae9d[_0x3b6a('0x2d')]=_[_0x3b6a('0x42')](db['Trigger'][_0x3b6a('0x2a')]);_0x1dae9d[_0x3b6a('0x2e')]=_[_0x3b6a('0x42')](_0x2e8952[_0x3b6a('0x2e')]);_0x1dae9d['filters']=_[_0x3b6a('0x30')](_0x1dae9d[_0x3b6a('0x2d')],_0x1dae9d[_0x3b6a('0x2e')]);_0x1106a4['attributes']=_[_0x3b6a('0x30')](_0x1dae9d[_0x3b6a('0x2d')],qs[_0x3b6a('0x31')](_0x2e8952[_0x3b6a('0x2e')]['fields']));_0x1106a4[_0x3b6a('0x32')]=_0x1106a4[_0x3b6a('0x32')][_0x3b6a('0x33')]?_0x1106a4['attributes']:_0x1dae9d[_0x3b6a('0x2d')];if(_0x2e8952[_0x3b6a('0x2e')]['includeAll']){_0x1106a4[_0x3b6a('0x3d')]=[{'all':!![]}];}_0x1106a4=_[_0x3b6a('0x3b')]({},_0x1106a4,_0x2e8952[_0x3b6a('0x43')]);return db['Trigger']['find'](_0x1106a4)['then'](handleEntityNotFound(_0x21a6e5,null))[_0x3b6a('0x20')](respondWithResult(_0x21a6e5,null))[_0x3b6a('0x40')](handleError(_0x21a6e5,null));};exports['create']=function(_0x3b48d8,_0x4c36ec){return db[_0x3b6a('0x29')]['create'](_0x3b48d8[_0x3b6a('0x44')],{})[_0x3b6a('0x20')](function(_0x4d116f){var _0x2fea37=_0x3b48d8[_0x3b6a('0x45')]['get']({'plain':!![]});if(!_0x2fea37)throw new Error(_0x3b6a('0x46'));if(_0x2fea37[_0x3b6a('0x47')]==='user'){var _0x43022b=_0x4d116f[_0x3b6a('0x48')]({'plain':!![]});var _0x4fa8ad=_0x3b6a('0x22');return db[_0x3b6a('0x49')]['find']({'where':{'name':_0x4fa8ad,'userProfileId':_0x2fea37[_0x3b6a('0x4a')]},'raw':!![]})[_0x3b6a('0x20')](function(_0x358469){if(_0x358469&&_0x358469[_0x3b6a('0x4b')]===0x0){return db['UserProfileResource'][_0x3b6a('0x4c')]({'name':_0x43022b[_0x3b6a('0x25')],'resourceId':_0x43022b['id'],'type':_0x358469[_0x3b6a('0x25')],'sectionId':_0x358469['id']},{})[_0x3b6a('0x20')](function(){return _0x4d116f;});}else{return _0x4d116f;}})[_0x3b6a('0x40')](function(_0x2685d9){logger[_0x3b6a('0x23')](_0x3b6a('0x4d'),_0x2685d9);throw _0x2685d9;});}return _0x4d116f;})['then'](respondWithResult(_0x4c36ec,0xc9))[_0x3b6a('0x40')](handleError(_0x4c36ec,null));};exports[_0x3b6a('0x1f')]=function(_0x2a491c,_0xb451c4){if(_0x2a491c[_0x3b6a('0x44')]['id']){delete _0x2a491c[_0x3b6a('0x44')]['id'];}return db[_0x3b6a('0x29')][_0x3b6a('0x4e')]({'where':{'id':_0x2a491c[_0x3b6a('0x41')]['id']}})['then'](handleEntityNotFound(_0xb451c4,null))[_0x3b6a('0x20')](saveUpdates(_0x2a491c[_0x3b6a('0x44')],null))[_0x3b6a('0x20')](respondWithResult(_0xb451c4,null))[_0x3b6a('0x40')](handleError(_0xb451c4,null));};exports[_0x3b6a('0x21')]=function(_0x2fa0fc,_0x4d0031){return db[_0x3b6a('0x29')]['find']({'where':{'id':_0x2fa0fc['params']['id']}})[_0x3b6a('0x20')](handleEntityNotFound(_0x4d0031,null))[_0x3b6a('0x20')](removeEntity(_0x4d0031,null))['catch'](handleError(_0x4d0031,null));};exports['addAllCondition']=function(_0x342dea,_0x264b9a,_0x364ca6){if(_0x342dea[_0x3b6a('0x44')]['id']){delete _0x342dea[_0x3b6a('0x44')]['id'];}return db['Trigger'][_0x3b6a('0x4e')]({'where':{'id':_0x342dea[_0x3b6a('0x41')]['id']}})['then'](handleEntityNotFound(_0x264b9a,null))['then'](function(_0x4ecd07){if(_0x4ecd07){_0x342dea[_0x3b6a('0x44')][_0x3b6a('0x4f')]=_0x4ecd07['id'];return db[_0x3b6a('0x50')][_0x3b6a('0x4c')](_0x342dea[_0x3b6a('0x44')]);}})[_0x3b6a('0x20')](respondWithResult(_0x264b9a,null))[_0x3b6a('0x40')](handleError(_0x264b9a,null));};exports[_0x3b6a('0x51')]=function(_0x58a6d3,_0x538eb9,_0x16196b){if(_0x58a6d3[_0x3b6a('0x44')]['id']){delete _0x58a6d3['body']['id'];}return db[_0x3b6a('0x29')][_0x3b6a('0x4e')]({'where':{'id':_0x58a6d3[_0x3b6a('0x41')]['id']}})[_0x3b6a('0x20')](handleEntityNotFound(_0x538eb9,null))[_0x3b6a('0x20')](function(_0x59b03e){if(_0x59b03e){_0x58a6d3[_0x3b6a('0x44')]['TriggerAnyId']=_0x59b03e['id'];return db[_0x3b6a('0x50')][_0x3b6a('0x4c')](_0x58a6d3['body']);}})[_0x3b6a('0x20')](respondWithResult(_0x538eb9,null))['catch'](handleError(_0x538eb9,null));};exports[_0x3b6a('0x52')]=function(_0x1daa20,_0x2a9feb,_0x186ad2){var _0x469899={};var _0x412c17={};var _0x20cbff;var _0x2c0cc0;return db[_0x3b6a('0x29')][_0x3b6a('0x53')]({'where':{'id':_0x1daa20['params']['id']}})[_0x3b6a('0x20')](handleEntityNotFound(_0x2a9feb,null))[_0x3b6a('0x20')](function(_0x4d2678){if(_0x4d2678){_0x20cbff=_0x4d2678;_0x412c17['model']=_['keys'](db[_0x3b6a('0x50')][_0x3b6a('0x2a')]);_0x412c17[_0x3b6a('0x2e')]=_[_0x3b6a('0x42')](_0x1daa20[_0x3b6a('0x2e')]);_0x412c17[_0x3b6a('0x2f')]=_[_0x3b6a('0x30')](_0x412c17[_0x3b6a('0x2d')],_0x412c17['query']);_0x469899[_0x3b6a('0x32')]=_[_0x3b6a('0x30')](_0x412c17[_0x3b6a('0x2d')],qs[_0x3b6a('0x31')](_0x1daa20[_0x3b6a('0x2e')][_0x3b6a('0x31')]));_0x469899[_0x3b6a('0x32')]=_0x469899[_0x3b6a('0x32')]['length']?_0x469899[_0x3b6a('0x32')]:_0x412c17[_0x3b6a('0x2d')];_0x469899[_0x3b6a('0x36')]=qs[_0x3b6a('0x37')](_0x1daa20[_0x3b6a('0x2e')][_0x3b6a('0x37')]);_0x469899[_0x3b6a('0x38')]=qs[_0x3b6a('0x2f')](_[_0x3b6a('0x39')](_0x1daa20[_0x3b6a('0x2e')],_0x412c17[_0x3b6a('0x2f')]));if(_0x1daa20['query'][_0x3b6a('0x3a')]){_0x469899[_0x3b6a('0x38')]=_[_0x3b6a('0x3b')](_0x469899[_0x3b6a('0x38')],{'$or':_[_0x3b6a('0x28')](_0x469899[_0x3b6a('0x32')],function(_0x1839f1){var _0x37cc78={};_0x37cc78[_0x1839f1]={'$like':'%'+_0x1daa20[_0x3b6a('0x2e')][_0x3b6a('0x3a')]+'%'};return _0x37cc78;})});}_0x469899=_[_0x3b6a('0x3b')]({},_0x469899,_0x1daa20[_0x3b6a('0x43')]);return _0x20cbff[_0x3b6a('0x52')](_0x469899);}})[_0x3b6a('0x20')](function(_0x375f51){if(_0x375f51){_0x2c0cc0=_0x375f51['length'];if(!_0x1daa20[_0x3b6a('0x2e')]['hasOwnProperty']('nolimit')){_0x469899['limit']=qs[_0x3b6a('0x1a')](_0x1daa20[_0x3b6a('0x2e')][_0x3b6a('0x1a')]);_0x469899['offset']=qs[_0x3b6a('0x18')](_0x1daa20['query'][_0x3b6a('0x18')]);}return _0x20cbff[_0x3b6a('0x52')](_0x469899);}})['then'](function(_0x1c043d){if(_0x1c043d){return _0x1c043d?{'count':_0x2c0cc0,'rows':_0x1c043d}:null;}})[_0x3b6a('0x20')](respondWithResult(_0x2a9feb,null))['catch'](handleError(_0x2a9feb,null));};exports[_0x3b6a('0x54')]=function(_0x14700,_0x14d85c,_0x1ef0b9){var _0xcccacb={};var _0x1a4a9e={};var _0x3de939;var _0x8a4b72;return db[_0x3b6a('0x29')][_0x3b6a('0x53')]({'where':{'id':_0x14700[_0x3b6a('0x41')]['id']}})[_0x3b6a('0x20')](handleEntityNotFound(_0x14d85c,null))['then'](function(_0x4f4479){if(_0x4f4479){_0x3de939=_0x4f4479;_0x1a4a9e['model']=_['keys'](db['Condition'][_0x3b6a('0x2a')]);_0x1a4a9e[_0x3b6a('0x2e')]=_[_0x3b6a('0x42')](_0x14700[_0x3b6a('0x2e')]);_0x1a4a9e[_0x3b6a('0x2f')]=_[_0x3b6a('0x30')](_0x1a4a9e[_0x3b6a('0x2d')],_0x1a4a9e['query']);_0xcccacb[_0x3b6a('0x32')]=_[_0x3b6a('0x30')](_0x1a4a9e[_0x3b6a('0x2d')],qs[_0x3b6a('0x31')](_0x14700['query'][_0x3b6a('0x31')]));_0xcccacb[_0x3b6a('0x32')]=_0xcccacb[_0x3b6a('0x32')][_0x3b6a('0x33')]?_0xcccacb[_0x3b6a('0x32')]:_0x1a4a9e[_0x3b6a('0x2d')];_0xcccacb[_0x3b6a('0x36')]=qs[_0x3b6a('0x37')](_0x14700[_0x3b6a('0x2e')]['sort']);_0xcccacb[_0x3b6a('0x38')]=qs['filters'](_[_0x3b6a('0x39')](_0x14700[_0x3b6a('0x2e')],_0x1a4a9e[_0x3b6a('0x2f')]));if(_0x14700[_0x3b6a('0x2e')]['filter']){_0xcccacb['where']=_['merge'](_0xcccacb['where'],{'$or':_[_0x3b6a('0x28')](_0xcccacb['attributes'],function(_0x1eb07f){var _0x534727={};_0x534727[_0x1eb07f]={'$like':'%'+_0x14700['query'][_0x3b6a('0x3a')]+'%'};return _0x534727;})});}_0xcccacb=_['merge']({},_0xcccacb,_0x14700[_0x3b6a('0x43')]);return _0x3de939[_0x3b6a('0x54')](_0xcccacb);}})[_0x3b6a('0x20')](function(_0x3cb265){if(_0x3cb265){_0x8a4b72=_0x3cb265[_0x3b6a('0x33')];if(!_0x14700[_0x3b6a('0x2e')][_0x3b6a('0x34')](_0x3b6a('0x35'))){_0xcccacb[_0x3b6a('0x1a')]=qs[_0x3b6a('0x1a')](_0x14700['query']['limit']);_0xcccacb['offset']=qs[_0x3b6a('0x18')](_0x14700['query'][_0x3b6a('0x18')]);}return _0x3de939[_0x3b6a('0x54')](_0xcccacb);}})[_0x3b6a('0x20')](function(_0x4b28ee){if(_0x4b28ee){return _0x4b28ee?{'count':_0x8a4b72,'rows':_0x4b28ee}:null;}})[_0x3b6a('0x20')](respondWithResult(_0x14d85c,null))[_0x3b6a('0x40')](handleError(_0x14d85c,null));};exports[_0x3b6a('0x55')]=function(_0x2d8b51,_0x3b8557,_0x3d7b0b){if(_0x2d8b51[_0x3b6a('0x44')]['id']){delete _0x2d8b51[_0x3b6a('0x44')]['id'];}return db[_0x3b6a('0x29')][_0x3b6a('0x4e')]({'where':{'id':_0x2d8b51[_0x3b6a('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b8557,null))[_0x3b6a('0x20')](function(_0x2090e3){if(_0x2090e3){_0x2d8b51[_0x3b6a('0x44')][_0x3b6a('0x56')]=_0x2090e3['id'];return db[_0x3b6a('0x57')][_0x3b6a('0x4c')](_0x2d8b51[_0x3b6a('0x44')]);}})[_0x3b6a('0x20')](respondWithResult(_0x3b8557,null))[_0x3b6a('0x40')](handleError(_0x3b8557,null));};exports['getActions']=function(_0x138468,_0x55bf1e,_0x1ffe80){var _0xc5d1e0={};var _0x197d54={};var _0x7708e5;var _0x10189f;return db['Trigger'][_0x3b6a('0x53')]({'where':{'id':_0x138468[_0x3b6a('0x41')]['id']}})[_0x3b6a('0x20')](handleEntityNotFound(_0x55bf1e,null))[_0x3b6a('0x20')](function(_0x3ed893){if(_0x3ed893){_0x7708e5=_0x3ed893;_0x197d54[_0x3b6a('0x2d')]=_[_0x3b6a('0x42')](db['Action'][_0x3b6a('0x2a')]);_0x197d54[_0x3b6a('0x2e')]=_[_0x3b6a('0x42')](_0x138468[_0x3b6a('0x2e')]);_0x197d54[_0x3b6a('0x2f')]=_[_0x3b6a('0x30')](_0x197d54[_0x3b6a('0x2d')],_0x197d54[_0x3b6a('0x2e')]);_0xc5d1e0[_0x3b6a('0x32')]=_[_0x3b6a('0x30')](_0x197d54[_0x3b6a('0x2d')],qs[_0x3b6a('0x31')](_0x138468['query'][_0x3b6a('0x31')]));_0xc5d1e0['attributes']=_0xc5d1e0[_0x3b6a('0x32')][_0x3b6a('0x33')]?_0xc5d1e0[_0x3b6a('0x32')]:_0x197d54[_0x3b6a('0x2d')];_0xc5d1e0['order']=qs['sort'](_0x138468[_0x3b6a('0x2e')]['sort']);_0xc5d1e0['where']=qs[_0x3b6a('0x2f')](_[_0x3b6a('0x39')](_0x138468[_0x3b6a('0x2e')],_0x197d54[_0x3b6a('0x2f')]));if(_0x138468[_0x3b6a('0x2e')]['filter']){_0xc5d1e0[_0x3b6a('0x38')]=_[_0x3b6a('0x3b')](_0xc5d1e0[_0x3b6a('0x38')],{'$or':_[_0x3b6a('0x28')](_0xc5d1e0[_0x3b6a('0x32')],function(_0x5163bf){var _0x309aa6={};_0x309aa6[_0x5163bf]={'$like':'%'+_0x138468[_0x3b6a('0x2e')][_0x3b6a('0x3a')]+'%'};return _0x309aa6;})});}_0xc5d1e0=_[_0x3b6a('0x3b')]({},_0xc5d1e0,_0x138468[_0x3b6a('0x43')]);return _0x7708e5[_0x3b6a('0x58')](_0xc5d1e0);}})['then'](function(_0x51014e){if(_0x51014e){_0x10189f=_0x51014e[_0x3b6a('0x33')];if(!_0x138468['query']['hasOwnProperty'](_0x3b6a('0x35'))){_0xc5d1e0['limit']=qs[_0x3b6a('0x1a')](_0x138468[_0x3b6a('0x2e')][_0x3b6a('0x1a')]);_0xc5d1e0[_0x3b6a('0x18')]=qs[_0x3b6a('0x18')](_0x138468[_0x3b6a('0x2e')][_0x3b6a('0x18')]);}return _0x7708e5[_0x3b6a('0x58')](_0xc5d1e0);}})[_0x3b6a('0x20')](function(_0x26d368){if(_0x26d368){return _0x26d368?{'count':_0x10189f,'rows':_0x26d368}:null;}})['then'](respondWithResult(_0x55bf1e,null))['catch'](handleError(_0x55bf1e,null));}; \ No newline at end of file +var _0xf7b3=['moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','set','json','apply','reject','save','update','get','UserProfileResource','destroy','then','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','Trigger','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5cc4de,_0x2df335){var _0x1bf255=function(_0x479413){while(--_0x479413){_0x5cc4de['push'](_0x5cc4de['shift']());}};_0x1bf255(++_0x2df335);}(_0xf7b3,0x16b));var _0x3f7b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xf7b3[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require(_0x3f7b('0x0'));var rimraf=require(_0x3f7b('0x1'));var zipdir=require(_0x3f7b('0x2'));var jsonpatch=require(_0x3f7b('0x3'));var rp=require(_0x3f7b('0x4'));var moment=require(_0x3f7b('0x5'));var BPromise=require(_0x3f7b('0x6'));var Mustache=require(_0x3f7b('0x7'));var util=require(_0x3f7b('0x8'));var path=require(_0x3f7b('0x9'));var sox=require(_0x3f7b('0xa'));var csv=require('to-csv');var ejs=require(_0x3f7b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f7b('0xc'));var squel=require(_0x3f7b('0xd'));var crypto=require(_0x3f7b('0xe'));var jsforce=require(_0x3f7b('0xf'));var deskjs=require(_0x3f7b('0x10'));var toCsv=require(_0x3f7b('0x11'));var querystring=require('querystring');var Papa=require(_0x3f7b('0x12'));var Redis=require(_0x3f7b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f7b('0x14'));var logger=require(_0x3f7b('0x15'))('api');var utils=require(_0x3f7b('0x16'));var config=require(_0x3f7b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f7b('0x18'))['db'];function respondWithStatusCode(_0x2da63b,_0x28a2be){_0x28a2be=_0x28a2be||0xcc;return function(_0x5003a5){if(_0x5003a5){return _0x2da63b['sendStatus'](_0x28a2be);}return _0x2da63b['status'](_0x28a2be)['end']();};}function respondWithResult(_0x56b72a,_0x378009){_0x378009=_0x378009||0xc8;return function(_0x25aadb){if(_0x25aadb){return _0x56b72a[_0x3f7b('0x19')](_0x378009)['json'](_0x25aadb);}};}function respondWithFilteredResult(_0x5bdea9,_0x2a349b){return function(_0x2f328f){if(_0x2f328f){var _0x10e1bb=typeof _0x2a349b[_0x3f7b('0x1a')]===_0x3f7b('0x1b')&&typeof _0x2a349b['limit']===_0x3f7b('0x1b');var _0x540553=_0x2f328f[_0x3f7b('0x1c')];var _0x47914c=_0x10e1bb?0x0:_0x2a349b[_0x3f7b('0x1a')];var _0x45b653=_0x10e1bb?_0x2f328f['count']:_0x2a349b['offset']+_0x2a349b[_0x3f7b('0x1d')];var _0x3928e0;if(_0x45b653>=_0x540553){_0x45b653=_0x540553;_0x3928e0=0xc8;}else{_0x3928e0=0xce;}_0x5bdea9['status'](_0x3928e0);return _0x5bdea9[_0x3f7b('0x1e')]('Content-Range',_0x47914c+'-'+_0x45b653+'/'+_0x540553)[_0x3f7b('0x1f')](_0x2f328f);}return null;};}function patchUpdates(_0x554024){return function(_0x4c1ace){try{jsonpatch[_0x3f7b('0x20')](_0x4c1ace,_0x554024,!![]);}catch(_0x4f8bfb){return BPromise[_0x3f7b('0x21')](_0x4f8bfb);}return _0x4c1ace[_0x3f7b('0x22')]();};}function saveUpdates(_0x570b37,_0x49592d){return function(_0xcde9d8){if(_0xcde9d8){return _0xcde9d8[_0x3f7b('0x23')](_0x570b37)['then'](function(_0x44eedd){return _0x44eedd;});}return null;};}function removeEntity(_0x1d2f8d,_0x44e6f1){return function(_0x535eca){if(_0x535eca){return _0x535eca['destroy']()['then'](function(){var _0xa097a5=_0x535eca[_0x3f7b('0x24')]({'plain':!![]});var _0xeffc73='Triggers';return db[_0x3f7b('0x25')][_0x3f7b('0x26')]({'where':{'type':_0xeffc73,'resourceId':_0xa097a5['id']}})[_0x3f7b('0x27')](function(){return _0x535eca;});})[_0x3f7b('0x27')](function(){_0x1d2f8d['status'](0xcc)[_0x3f7b('0x28')]();});}};}function handleEntityNotFound(_0x150201,_0x4f698c){return function(_0x1b0873){if(!_0x1b0873){_0x150201['sendStatus'](0x194);}return _0x1b0873;};}function handleError(_0x468944,_0x1c17b5){_0x1c17b5=_0x1c17b5||0x1f4;return function(_0x5682b1){logger[_0x3f7b('0x29')](_0x5682b1[_0x3f7b('0x2a')]);if(_0x5682b1[_0x3f7b('0x2b')]){delete _0x5682b1[_0x3f7b('0x2b')];}_0x468944['status'](_0x1c17b5)['send'](_0x5682b1);};}exports['index']=function(_0x2b739d,_0x50cd33){var _0x3e8e82={},_0x5dd609={},_0x29baad={'count':0x0,'rows':[]};var _0x2e42e=_[_0x3f7b('0x2c')](db['Trigger'][_0x3f7b('0x2d')],function(_0x2c01ba){return{'name':_0x2c01ba[_0x3f7b('0x2e')],'type':_0x2c01ba[_0x3f7b('0x2f')][_0x3f7b('0x30')]};});_0x5dd609[_0x3f7b('0x31')]=_[_0x3f7b('0x2c')](_0x2e42e,_0x3f7b('0x2b'));_0x5dd609[_0x3f7b('0x32')]=_[_0x3f7b('0x33')](_0x2b739d[_0x3f7b('0x32')]);_0x5dd609[_0x3f7b('0x34')]=_[_0x3f7b('0x35')](_0x5dd609[_0x3f7b('0x31')],_0x5dd609[_0x3f7b('0x32')]);_0x3e8e82[_0x3f7b('0x36')]=_[_0x3f7b('0x35')](_0x5dd609['model'],qs[_0x3f7b('0x37')](_0x2b739d[_0x3f7b('0x32')][_0x3f7b('0x37')]));_0x3e8e82['attributes']=_0x3e8e82[_0x3f7b('0x36')][_0x3f7b('0x38')]?_0x3e8e82['attributes']:_0x5dd609[_0x3f7b('0x31')];if(!_0x2b739d[_0x3f7b('0x32')][_0x3f7b('0x39')]('nolimit')){_0x3e8e82[_0x3f7b('0x1d')]=qs[_0x3f7b('0x1d')](_0x2b739d[_0x3f7b('0x32')][_0x3f7b('0x1d')]);_0x3e8e82[_0x3f7b('0x1a')]=qs[_0x3f7b('0x1a')](_0x2b739d[_0x3f7b('0x32')]['offset']);}_0x3e8e82[_0x3f7b('0x3a')]=qs['sort'](_0x2b739d['query'][_0x3f7b('0x3b')]);_0x3e8e82['where']=qs[_0x3f7b('0x34')](_[_0x3f7b('0x3c')](_0x2b739d[_0x3f7b('0x32')],_0x5dd609[_0x3f7b('0x34')]),_0x2e42e);if(_0x2b739d['query'][_0x3f7b('0x3d')]){_0x3e8e82[_0x3f7b('0x3e')]=_[_0x3f7b('0x3f')](_0x3e8e82[_0x3f7b('0x3e')],{'$or':_[_0x3f7b('0x2c')](_0x2e42e,function(_0x4b9c09){if(_0x4b9c09['type']!=='VIRTUAL'){var _0x12ad0c={};_0x12ad0c[_0x4b9c09[_0x3f7b('0x2b')]]={'$like':'%'+_0x2b739d[_0x3f7b('0x32')][_0x3f7b('0x3d')]+'%'};return _0x12ad0c;}})});}_0x3e8e82=_[_0x3f7b('0x3f')]({},_0x3e8e82,_0x2b739d[_0x3f7b('0x40')]);var _0x5bbd94={'where':_0x3e8e82[_0x3f7b('0x3e')]};return db[_0x3f7b('0x41')][_0x3f7b('0x1c')](_0x5bbd94)[_0x3f7b('0x27')](function(_0x5c4fa9){_0x29baad[_0x3f7b('0x1c')]=_0x5c4fa9;if(_0x2b739d[_0x3f7b('0x32')][_0x3f7b('0x42')]){_0x3e8e82[_0x3f7b('0x43')]=[{'all':!![]}];}return db[_0x3f7b('0x41')]['findAll'](_0x3e8e82);})['then'](function(_0x1c6697){_0x29baad['rows']=_0x1c6697;return _0x29baad;})[_0x3f7b('0x27')](respondWithFilteredResult(_0x50cd33,_0x3e8e82))[_0x3f7b('0x44')](handleError(_0x50cd33,null));};exports[_0x3f7b('0x45')]=function(_0x5f3c62,_0x1263df){var _0x1246fc={'raw':![],'where':{'id':_0x5f3c62[_0x3f7b('0x46')]['id']}},_0x8f6af6={};_0x8f6af6['model']=_[_0x3f7b('0x33')](db[_0x3f7b('0x41')][_0x3f7b('0x2d')]);_0x8f6af6[_0x3f7b('0x32')]=_[_0x3f7b('0x33')](_0x5f3c62[_0x3f7b('0x32')]);_0x8f6af6[_0x3f7b('0x34')]=_[_0x3f7b('0x35')](_0x8f6af6[_0x3f7b('0x31')],_0x8f6af6[_0x3f7b('0x32')]);_0x1246fc[_0x3f7b('0x36')]=_['intersection'](_0x8f6af6[_0x3f7b('0x31')],qs[_0x3f7b('0x37')](_0x5f3c62['query'][_0x3f7b('0x37')]));_0x1246fc['attributes']=_0x1246fc[_0x3f7b('0x36')][_0x3f7b('0x38')]?_0x1246fc['attributes']:_0x8f6af6['model'];if(_0x5f3c62[_0x3f7b('0x32')][_0x3f7b('0x42')]){_0x1246fc['include']=[{'all':!![]}];}_0x1246fc=_['merge']({},_0x1246fc,_0x5f3c62[_0x3f7b('0x40')]);return db['Trigger'][_0x3f7b('0x47')](_0x1246fc)[_0x3f7b('0x27')](handleEntityNotFound(_0x1263df,null))['then'](respondWithResult(_0x1263df,null))[_0x3f7b('0x44')](handleError(_0x1263df,null));};exports[_0x3f7b('0x48')]=function(_0x4d18f0,_0xbdfe52){return db[_0x3f7b('0x41')][_0x3f7b('0x48')](_0x4d18f0[_0x3f7b('0x49')],{})[_0x3f7b('0x27')](function(_0x24ff58){var _0x2d9269=_0x4d18f0[_0x3f7b('0x4a')][_0x3f7b('0x24')]({'plain':!![]});if(!_0x2d9269)throw new Error(_0x3f7b('0x4b'));if(_0x2d9269[_0x3f7b('0x4c')]===_0x3f7b('0x4a')){var _0x322a0e=_0x24ff58['get']({'plain':!![]});var _0x305ebf=_0x3f7b('0x4d');return db['UserProfileSection'][_0x3f7b('0x47')]({'where':{'name':_0x305ebf,'userProfileId':_0x2d9269[_0x3f7b('0x4e')]},'raw':!![]})[_0x3f7b('0x27')](function(_0x975f83){if(_0x975f83&&_0x975f83[_0x3f7b('0x4f')]===0x0){return db[_0x3f7b('0x25')]['create']({'name':_0x322a0e[_0x3f7b('0x2b')],'resourceId':_0x322a0e['id'],'type':_0x975f83[_0x3f7b('0x2b')],'sectionId':_0x975f83['id']},{})[_0x3f7b('0x27')](function(){return _0x24ff58;});}else{return _0x24ff58;}})[_0x3f7b('0x44')](function(_0xa7070){logger['error'](_0x3f7b('0x50'),_0xa7070);throw _0xa7070;});}return _0x24ff58;})['then'](respondWithResult(_0xbdfe52,0xc9))[_0x3f7b('0x44')](handleError(_0xbdfe52,null));};exports[_0x3f7b('0x23')]=function(_0x51cbe8,_0x3c78c8){if(_0x51cbe8['body']['id']){delete _0x51cbe8[_0x3f7b('0x49')]['id'];}return db[_0x3f7b('0x41')][_0x3f7b('0x47')]({'where':{'id':_0x51cbe8[_0x3f7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c78c8,null))[_0x3f7b('0x27')](saveUpdates(_0x51cbe8[_0x3f7b('0x49')],null))['then'](respondWithResult(_0x3c78c8,null))['catch'](handleError(_0x3c78c8,null));};exports[_0x3f7b('0x26')]=function(_0x5753de,_0x56911c){return db[_0x3f7b('0x41')]['find']({'where':{'id':_0x5753de['params']['id']}})['then'](handleEntityNotFound(_0x56911c,null))[_0x3f7b('0x27')](removeEntity(_0x56911c,null))['catch'](handleError(_0x56911c,null));};exports[_0x3f7b('0x51')]=function(_0x4475b4,_0x34bc0e,_0x274750){if(_0x4475b4[_0x3f7b('0x49')]['id']){delete _0x4475b4[_0x3f7b('0x49')]['id'];}return db['Trigger'][_0x3f7b('0x47')]({'where':{'id':_0x4475b4[_0x3f7b('0x46')]['id']}})[_0x3f7b('0x27')](handleEntityNotFound(_0x34bc0e,null))[_0x3f7b('0x27')](function(_0x43bace){if(_0x43bace){_0x4475b4[_0x3f7b('0x49')]['TriggerAllId']=_0x43bace['id'];return db[_0x3f7b('0x52')][_0x3f7b('0x48')](_0x4475b4['body']);}})[_0x3f7b('0x27')](respondWithResult(_0x34bc0e,null))[_0x3f7b('0x44')](handleError(_0x34bc0e,null));};exports[_0x3f7b('0x53')]=function(_0x136400,_0x2688c8,_0x52a403){if(_0x136400[_0x3f7b('0x49')]['id']){delete _0x136400['body']['id'];}return db[_0x3f7b('0x41')][_0x3f7b('0x47')]({'where':{'id':_0x136400[_0x3f7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2688c8,null))[_0x3f7b('0x27')](function(_0x12509c){if(_0x12509c){_0x136400[_0x3f7b('0x49')]['TriggerAnyId']=_0x12509c['id'];return db[_0x3f7b('0x52')]['create'](_0x136400[_0x3f7b('0x49')]);}})['then'](respondWithResult(_0x2688c8,null))[_0x3f7b('0x44')](handleError(_0x2688c8,null));};exports[_0x3f7b('0x54')]=function(_0x35f72d,_0x2616fe,_0x4773e3){var _0x53b29a={};var _0x1e7d95={};var _0x422ef3;var _0x45bf24;return db[_0x3f7b('0x41')][_0x3f7b('0x55')]({'where':{'id':_0x35f72d[_0x3f7b('0x46')]['id']}})[_0x3f7b('0x27')](handleEntityNotFound(_0x2616fe,null))[_0x3f7b('0x27')](function(_0x546c5a){if(_0x546c5a){_0x422ef3=_0x546c5a;_0x1e7d95['model']=_['keys'](db['Condition'][_0x3f7b('0x2d')]);_0x1e7d95[_0x3f7b('0x32')]=_[_0x3f7b('0x33')](_0x35f72d[_0x3f7b('0x32')]);_0x1e7d95['filters']=_[_0x3f7b('0x35')](_0x1e7d95[_0x3f7b('0x31')],_0x1e7d95[_0x3f7b('0x32')]);_0x53b29a[_0x3f7b('0x36')]=_[_0x3f7b('0x35')](_0x1e7d95['model'],qs['fields'](_0x35f72d[_0x3f7b('0x32')][_0x3f7b('0x37')]));_0x53b29a['attributes']=_0x53b29a[_0x3f7b('0x36')][_0x3f7b('0x38')]?_0x53b29a[_0x3f7b('0x36')]:_0x1e7d95[_0x3f7b('0x31')];_0x53b29a[_0x3f7b('0x3a')]=qs['sort'](_0x35f72d[_0x3f7b('0x32')][_0x3f7b('0x3b')]);_0x53b29a[_0x3f7b('0x3e')]=qs['filters'](_['pick'](_0x35f72d['query'],_0x1e7d95['filters']));if(_0x35f72d[_0x3f7b('0x32')]['filter']){_0x53b29a[_0x3f7b('0x3e')]=_[_0x3f7b('0x3f')](_0x53b29a[_0x3f7b('0x3e')],{'$or':_[_0x3f7b('0x2c')](_0x53b29a['attributes'],function(_0x2da14d){var _0x28eb4b={};_0x28eb4b[_0x2da14d]={'$like':'%'+_0x35f72d[_0x3f7b('0x32')][_0x3f7b('0x3d')]+'%'};return _0x28eb4b;})});}_0x53b29a=_[_0x3f7b('0x3f')]({},_0x53b29a,_0x35f72d['options']);return _0x422ef3[_0x3f7b('0x54')](_0x53b29a);}})[_0x3f7b('0x27')](function(_0x504375){if(_0x504375){_0x45bf24=_0x504375[_0x3f7b('0x38')];if(!_0x35f72d[_0x3f7b('0x32')]['hasOwnProperty'](_0x3f7b('0x56'))){_0x53b29a[_0x3f7b('0x1d')]=qs['limit'](_0x35f72d[_0x3f7b('0x32')][_0x3f7b('0x1d')]);_0x53b29a[_0x3f7b('0x1a')]=qs[_0x3f7b('0x1a')](_0x35f72d[_0x3f7b('0x32')]['offset']);}return _0x422ef3[_0x3f7b('0x54')](_0x53b29a);}})[_0x3f7b('0x27')](function(_0x92ea21){if(_0x92ea21){return _0x92ea21?{'count':_0x45bf24,'rows':_0x92ea21}:null;}})[_0x3f7b('0x27')](respondWithResult(_0x2616fe,null))[_0x3f7b('0x44')](handleError(_0x2616fe,null));};exports['getAnyConditions']=function(_0x547d0e,_0x3b3053,_0x5043b0){var _0x36494a={};var _0x5ade65={};var _0x29bbc5;var _0x2ce4f5;return db['Trigger'][_0x3f7b('0x55')]({'where':{'id':_0x547d0e[_0x3f7b('0x46')]['id']}})[_0x3f7b('0x27')](handleEntityNotFound(_0x3b3053,null))[_0x3f7b('0x27')](function(_0x498d90){if(_0x498d90){_0x29bbc5=_0x498d90;_0x5ade65['model']=_['keys'](db[_0x3f7b('0x52')][_0x3f7b('0x2d')]);_0x5ade65['query']=_[_0x3f7b('0x33')](_0x547d0e[_0x3f7b('0x32')]);_0x5ade65[_0x3f7b('0x34')]=_[_0x3f7b('0x35')](_0x5ade65[_0x3f7b('0x31')],_0x5ade65[_0x3f7b('0x32')]);_0x36494a[_0x3f7b('0x36')]=_['intersection'](_0x5ade65[_0x3f7b('0x31')],qs[_0x3f7b('0x37')](_0x547d0e[_0x3f7b('0x32')]['fields']));_0x36494a[_0x3f7b('0x36')]=_0x36494a[_0x3f7b('0x36')]['length']?_0x36494a[_0x3f7b('0x36')]:_0x5ade65[_0x3f7b('0x31')];_0x36494a[_0x3f7b('0x3a')]=qs[_0x3f7b('0x3b')](_0x547d0e[_0x3f7b('0x32')][_0x3f7b('0x3b')]);_0x36494a[_0x3f7b('0x3e')]=qs[_0x3f7b('0x34')](_[_0x3f7b('0x3c')](_0x547d0e[_0x3f7b('0x32')],_0x5ade65['filters']));if(_0x547d0e[_0x3f7b('0x32')][_0x3f7b('0x3d')]){_0x36494a['where']=_[_0x3f7b('0x3f')](_0x36494a[_0x3f7b('0x3e')],{'$or':_[_0x3f7b('0x2c')](_0x36494a[_0x3f7b('0x36')],function(_0x16c860){var _0x25db27={};_0x25db27[_0x16c860]={'$like':'%'+_0x547d0e[_0x3f7b('0x32')][_0x3f7b('0x3d')]+'%'};return _0x25db27;})});}_0x36494a=_[_0x3f7b('0x3f')]({},_0x36494a,_0x547d0e['options']);return _0x29bbc5[_0x3f7b('0x57')](_0x36494a);}})['then'](function(_0x18a05d){if(_0x18a05d){_0x2ce4f5=_0x18a05d[_0x3f7b('0x38')];if(!_0x547d0e[_0x3f7b('0x32')][_0x3f7b('0x39')](_0x3f7b('0x56'))){_0x36494a[_0x3f7b('0x1d')]=qs[_0x3f7b('0x1d')](_0x547d0e['query'][_0x3f7b('0x1d')]);_0x36494a['offset']=qs[_0x3f7b('0x1a')](_0x547d0e['query'][_0x3f7b('0x1a')]);}return _0x29bbc5[_0x3f7b('0x57')](_0x36494a);}})['then'](function(_0x58b829){if(_0x58b829){return _0x58b829?{'count':_0x2ce4f5,'rows':_0x58b829}:null;}})[_0x3f7b('0x27')](respondWithResult(_0x3b3053,null))[_0x3f7b('0x44')](handleError(_0x3b3053,null));};exports[_0x3f7b('0x58')]=function(_0x57d365,_0x2a0967,_0x50c01c){if(_0x57d365[_0x3f7b('0x49')]['id']){delete _0x57d365[_0x3f7b('0x49')]['id'];}return db[_0x3f7b('0x41')][_0x3f7b('0x47')]({'where':{'id':_0x57d365[_0x3f7b('0x46')]['id']}})[_0x3f7b('0x27')](handleEntityNotFound(_0x2a0967,null))['then'](function(_0x117917){if(_0x117917){_0x57d365['body'][_0x3f7b('0x59')]=_0x117917['id'];return db[_0x3f7b('0x5a')][_0x3f7b('0x48')](_0x57d365[_0x3f7b('0x49')]);}})['then'](respondWithResult(_0x2a0967,null))[_0x3f7b('0x44')](handleError(_0x2a0967,null));};exports[_0x3f7b('0x5b')]=function(_0x39a807,_0x4ebdee,_0xc7fc02){var _0x178083={};var _0x4d417a={};var _0x17b2e1;var _0x16d753;return db['Trigger'][_0x3f7b('0x55')]({'where':{'id':_0x39a807[_0x3f7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ebdee,null))[_0x3f7b('0x27')](function(_0x2921d9){if(_0x2921d9){_0x17b2e1=_0x2921d9;_0x4d417a[_0x3f7b('0x31')]=_['keys'](db[_0x3f7b('0x5a')][_0x3f7b('0x2d')]);_0x4d417a['query']=_[_0x3f7b('0x33')](_0x39a807[_0x3f7b('0x32')]);_0x4d417a[_0x3f7b('0x34')]=_[_0x3f7b('0x35')](_0x4d417a[_0x3f7b('0x31')],_0x4d417a[_0x3f7b('0x32')]);_0x178083[_0x3f7b('0x36')]=_['intersection'](_0x4d417a[_0x3f7b('0x31')],qs[_0x3f7b('0x37')](_0x39a807[_0x3f7b('0x32')][_0x3f7b('0x37')]));_0x178083[_0x3f7b('0x36')]=_0x178083[_0x3f7b('0x36')][_0x3f7b('0x38')]?_0x178083[_0x3f7b('0x36')]:_0x4d417a['model'];_0x178083[_0x3f7b('0x3a')]=qs[_0x3f7b('0x3b')](_0x39a807[_0x3f7b('0x32')][_0x3f7b('0x3b')]);_0x178083['where']=qs[_0x3f7b('0x34')](_[_0x3f7b('0x3c')](_0x39a807[_0x3f7b('0x32')],_0x4d417a[_0x3f7b('0x34')]));if(_0x39a807[_0x3f7b('0x32')]['filter']){_0x178083[_0x3f7b('0x3e')]=_[_0x3f7b('0x3f')](_0x178083['where'],{'$or':_[_0x3f7b('0x2c')](_0x178083[_0x3f7b('0x36')],function(_0x5386f6){var _0x4d353c={};_0x4d353c[_0x5386f6]={'$like':'%'+_0x39a807['query'][_0x3f7b('0x3d')]+'%'};return _0x4d353c;})});}_0x178083=_[_0x3f7b('0x3f')]({},_0x178083,_0x39a807['options']);return _0x17b2e1[_0x3f7b('0x5b')](_0x178083);}})[_0x3f7b('0x27')](function(_0x5c6dcd){if(_0x5c6dcd){_0x16d753=_0x5c6dcd[_0x3f7b('0x38')];if(!_0x39a807[_0x3f7b('0x32')]['hasOwnProperty'](_0x3f7b('0x56'))){_0x178083[_0x3f7b('0x1d')]=qs[_0x3f7b('0x1d')](_0x39a807[_0x3f7b('0x32')]['limit']);_0x178083[_0x3f7b('0x1a')]=qs[_0x3f7b('0x1a')](_0x39a807[_0x3f7b('0x32')]['offset']);}return _0x17b2e1[_0x3f7b('0x5b')](_0x178083);}})[_0x3f7b('0x27')](function(_0x2dc9e1){if(_0x2dc9e1){return _0x2dc9e1?{'count':_0x16d753,'rows':_0x2dc9e1}:null;}})[_0x3f7b('0x27')](respondWithResult(_0x4ebdee,null))[_0x3f7b('0x44')](handleError(_0x4ebdee,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 030ed97..e3217f0 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 _0x50b9=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x50b9,0x171));var _0x950b=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x50b9[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0x950b('0x0'));var util=require('util');var logger=require(_0x950b('0x1'))('api');var moment=require(_0x950b('0x2'));var BPromise=require(_0x950b('0x3'));var rp=require(_0x950b('0x4'));var fs=require('fs');var path=require(_0x950b('0x5'));var rimraf=require(_0x950b('0x6'));var config=require(_0x950b('0x7'));var attributes=require(_0x950b('0x8'));module[_0x950b('0x9')]=function(_0xc9024,_0x56ce3f){return _0xc9024[_0x950b('0xa')](_0x950b('0xb'),attributes,{'tableName':_0x950b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['tools_triggers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger'];(function(_0xeb17cf,_0xe6ee30){var _0x1d3ca4=function(_0x4fd66d){while(--_0x4fd66d){_0xeb17cf['push'](_0xeb17cf['shift']());}};_0x1d3ca4(++_0xe6ee30);}(_0x34e8,0x12c));var _0x834e=function(_0x129293,_0x23b393){_0x129293=_0x129293-0x0;var _0x259be4=_0x34e8[_0x129293];return _0x259be4;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'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 a0fc344..ac465ac 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 _0xba1f=['rpc','http','request','then','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','attributes','include','map','model','find','raw','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x180fda,_0x1af14f){var _0x3bddc9=function(_0x516a35){while(--_0x516a35){_0x180fda['push'](_0x180fda['shift']());}};_0x3bddc9(++_0x1af14f);}(_0xba1f,0x79));var _0xfba1=function(_0x58806c,_0x2e81c7){_0x58806c=_0x58806c-0x0;var _0x15ec56=_0xba1f[_0x58806c];return _0x15ec56;};'use strict';var _=require('lodash');var util=require(_0xfba1('0x0'));var moment=require(_0xfba1('0x1'));var BPromise=require(_0xfba1('0x2'));var rs=require(_0xfba1('0x3'));var fs=require('fs');var Redis=require(_0xfba1('0x4'));var db=require(_0xfba1('0x5'))['db'];var utils=require(_0xfba1('0x6'));var logger=require('../../config/logger')(_0xfba1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfba1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eab91,_0x41e6dc,_0x5d88d9){return new BPromise(function(_0x16e22f,_0x3a3450){return client[_0xfba1('0x9')](_0x2eab91,_0x5d88d9)[_0xfba1('0xa')](function(_0x45c907){logger[_0xfba1('0xb')](_0xfba1('0xc'),_0x41e6dc,'request\x20sent');logger[_0xfba1('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x41e6dc,_0xfba1('0xe'),JSON[_0xfba1('0xf')](_0x45c907));if(_0x45c907[_0xfba1('0x10')]){if(_0x45c907[_0xfba1('0x10')][_0xfba1('0x11')]===0x1f4){logger['error'](_0xfba1('0xc'),_0x41e6dc,_0x45c907[_0xfba1('0x10')][_0xfba1('0x12')]);return _0x3a3450(_0x45c907[_0xfba1('0x10')][_0xfba1('0x12')]);}logger[_0xfba1('0x10')](_0xfba1('0xc'),_0x41e6dc,_0x45c907[_0xfba1('0x10')][_0xfba1('0x12')]);return _0x16e22f(_0x45c907['error'][_0xfba1('0x12')]);}else{logger[_0xfba1('0xb')](_0xfba1('0xc'),_0x41e6dc,_0xfba1('0xe'));_0x16e22f(_0x45c907[_0xfba1('0x13')][_0xfba1('0x12')]);}})[_0xfba1('0x14')](function(_0x1c15c0){logger['error']('Trigger,\x20%s,\x20%s',_0x41e6dc,_0x1c15c0);_0x3a3450(_0x1c15c0);});});}exports[_0xfba1('0x15')]=function(_0x3936b7){var _0x156639=this;return new Promise(function(_0x145b69,_0x3df9a9){return db[_0xfba1('0x16')][_0xfba1('0x17')]({'raw':_0x3936b7[_0xfba1('0x18')]?_0x3936b7[_0xfba1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3936b7[_0xfba1('0x18')]?_0x3936b7[_0xfba1('0x18')]['where']||null:null,'attributes':_0x3936b7[_0xfba1('0x18')]?_0x3936b7[_0xfba1('0x18')][_0xfba1('0x19')]||null:null,'limit':_0x3936b7[_0xfba1('0x18')]?_0x3936b7[_0xfba1('0x18')]['limit']||null:null,'include':_0x3936b7[_0xfba1('0x18')]?_0x3936b7[_0xfba1('0x18')][_0xfba1('0x1a')]?_['map'](_0x3936b7['options'][_0xfba1('0x1a')],function(_0x558e49){return{'model':db[_0x558e49['model']],'as':_0x558e49['as'],'attributes':_0x558e49[_0xfba1('0x19')],'include':_0x558e49[_0xfba1('0x1a')]?_[_0xfba1('0x1b')](_0x558e49[_0xfba1('0x1a')],function(_0x1181b7){return{'model':db[_0x1181b7[_0xfba1('0x1c')]],'as':_0x1181b7['as'],'attributes':_0x1181b7[_0xfba1('0x19')],'include':_0x1181b7[_0xfba1('0x1a')]?_[_0xfba1('0x1b')](_0x1181b7[_0xfba1('0x1a')],function(_0x377848){return{'model':db[_0x377848[_0xfba1('0x1c')]],'as':_0x377848['as'],'attributes':_0x377848[_0xfba1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfba1('0xa')](function(_0x36fc9b){logger['info'](_0xfba1('0x15'),_0x3936b7);logger['debug'](_0xfba1('0x15'),_0x3936b7,JSON[_0xfba1('0xf')](_0x36fc9b));_0x145b69(_0x36fc9b);})[_0xfba1('0x14')](function(_0xf3401c){logger[_0xfba1('0x10')]('GetTrigger',_0xf3401c['message'],_0x3936b7);_0x3df9a9(_0x156639['error'](0x1f4,_0xf3401c[_0xfba1('0x12')]));});});};exports['ShowTrigger']=function(_0x545ac3){var _0x293648=this;return new Promise(function(_0x20a00a,_0x48ecc3){return db[_0xfba1('0x16')][_0xfba1('0x1d')]({'raw':_0x545ac3[_0xfba1('0x18')]?_0x545ac3[_0xfba1('0x18')][_0xfba1('0x1e')]===undefined?!![]:![]:!![],'where':_0x545ac3['options']?_0x545ac3[_0xfba1('0x18')]['where']||null:null,'attributes':_0x545ac3[_0xfba1('0x18')]?_0x545ac3[_0xfba1('0x18')][_0xfba1('0x19')]||null:null,'include':_0x545ac3[_0xfba1('0x18')]?_0x545ac3[_0xfba1('0x18')][_0xfba1('0x1a')]?_[_0xfba1('0x1b')](_0x545ac3[_0xfba1('0x18')][_0xfba1('0x1a')],function(_0x10772c){return{'model':db[_0x10772c[_0xfba1('0x1c')]],'as':_0x10772c['as'],'attributes':_0x10772c['attributes'],'include':_0x10772c[_0xfba1('0x1a')]?_[_0xfba1('0x1b')](_0x10772c[_0xfba1('0x1a')],function(_0x246f70){return{'model':db[_0x246f70[_0xfba1('0x1c')]],'as':_0x246f70['as'],'attributes':_0x246f70[_0xfba1('0x19')],'include':_0x246f70[_0xfba1('0x1a')]?_[_0xfba1('0x1b')](_0x246f70[_0xfba1('0x1a')],function(_0x2d476e){return{'model':db[_0x2d476e[_0xfba1('0x1c')]],'as':_0x2d476e['as'],'attributes':_0x2d476e[_0xfba1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfba1('0xa')](function(_0x31a8d8){logger['info']('ShowTrigger',_0x545ac3);logger['debug'](_0xfba1('0x1f'),_0x545ac3,JSON[_0xfba1('0xf')](_0x31a8d8));_0x20a00a(_0x31a8d8);})[_0xfba1('0x14')](function(_0x1d5f3a){logger['error'](_0xfba1('0x1f'),_0x1d5f3a['message'],_0x545ac3);_0x48ecc3(_0x293648[_0xfba1('0x10')](0x1f4,_0x1d5f3a[_0xfba1('0x12')]));});});}; \ No newline at end of file +var _0xb2d9=['options','raw','attributes','limit','map','include','model','GetTrigger','stringify','ShowTrigger','find','where','then','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','message','Trigger,\x20%s,\x20%s','result','catch','Trigger','findAll'];(function(_0x55ac7f,_0x4a1704){var _0x1655be=function(_0x1c3b50){while(--_0x1c3b50){_0x55ac7f['push'](_0x55ac7f['shift']());}};_0x1655be(++_0x4a1704);}(_0xb2d9,0x1a6));var _0x9b2d=function(_0x522fb0,_0x38b2ff){_0x522fb0=_0x522fb0-0x0;var _0xa92879=_0xb2d9[_0x522fb0];return _0xa92879;};'use strict';var _=require(_0x9b2d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9b2d('0x1'));var rs=require(_0x9b2d('0x2'));var fs=require('fs');var Redis=require(_0x9b2d('0x3'));var db=require(_0x9b2d('0x4'))['db'];var utils=require(_0x9b2d('0x5'));var logger=require('../../config/logger')(_0x9b2d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9b2d('0x7')][_0x9b2d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24eaf5,_0x36752e,_0x46cbcb){return new BPromise(function(_0x17ac5f,_0x51edaa){return client[_0x9b2d('0x9')](_0x24eaf5,_0x46cbcb)['then'](function(_0x11beb8){logger[_0x9b2d('0xa')]('Trigger,\x20%s,\x20%s',_0x36752e,_0x9b2d('0xb'));logger['debug'](_0x9b2d('0xc'),_0x36752e,_0x9b2d('0xb'),JSON['stringify'](_0x11beb8));if(_0x11beb8[_0x9b2d('0xd')]){if(_0x11beb8[_0x9b2d('0xd')]['code']===0x1f4){logger[_0x9b2d('0xd')]('Trigger,\x20%s,\x20%s',_0x36752e,_0x11beb8['error'][_0x9b2d('0xe')]);return _0x51edaa(_0x11beb8[_0x9b2d('0xd')][_0x9b2d('0xe')]);}logger[_0x9b2d('0xd')](_0x9b2d('0xf'),_0x36752e,_0x11beb8[_0x9b2d('0xd')]['message']);return _0x17ac5f(_0x11beb8[_0x9b2d('0xd')][_0x9b2d('0xe')]);}else{logger[_0x9b2d('0xa')](_0x9b2d('0xf'),_0x36752e,_0x9b2d('0xb'));_0x17ac5f(_0x11beb8[_0x9b2d('0x10')]['message']);}})[_0x9b2d('0x11')](function(_0x422944){logger[_0x9b2d('0xd')](_0x9b2d('0xf'),_0x36752e,_0x422944);_0x51edaa(_0x422944);});});}exports['GetTrigger']=function(_0x562498){var _0x40e10f=this;return new Promise(function(_0x1ca19d,_0x5a7518){return db[_0x9b2d('0x12')][_0x9b2d('0x13')]({'raw':_0x562498[_0x9b2d('0x14')]?_0x562498[_0x9b2d('0x14')][_0x9b2d('0x15')]===undefined?!![]:![]:!![],'where':_0x562498[_0x9b2d('0x14')]?_0x562498[_0x9b2d('0x14')]['where']||null:null,'attributes':_0x562498[_0x9b2d('0x14')]?_0x562498[_0x9b2d('0x14')][_0x9b2d('0x16')]||null:null,'limit':_0x562498[_0x9b2d('0x14')]?_0x562498[_0x9b2d('0x14')][_0x9b2d('0x17')]||null:null,'include':_0x562498[_0x9b2d('0x14')]?_0x562498[_0x9b2d('0x14')]['include']?_[_0x9b2d('0x18')](_0x562498[_0x9b2d('0x14')][_0x9b2d('0x19')],function(_0x461ab5){return{'model':db[_0x461ab5[_0x9b2d('0x1a')]],'as':_0x461ab5['as'],'attributes':_0x461ab5[_0x9b2d('0x16')],'include':_0x461ab5[_0x9b2d('0x19')]?_[_0x9b2d('0x18')](_0x461ab5[_0x9b2d('0x19')],function(_0x2ed636){return{'model':db[_0x2ed636['model']],'as':_0x2ed636['as'],'attributes':_0x2ed636['attributes'],'include':_0x2ed636[_0x9b2d('0x19')]?_[_0x9b2d('0x18')](_0x2ed636['include'],function(_0x445ba6){return{'model':db[_0x445ba6[_0x9b2d('0x1a')]],'as':_0x445ba6['as'],'attributes':_0x445ba6[_0x9b2d('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d9c30){logger[_0x9b2d('0xa')](_0x9b2d('0x1b'),_0x562498);logger['debug']('GetTrigger',_0x562498,JSON[_0x9b2d('0x1c')](_0x2d9c30));_0x1ca19d(_0x2d9c30);})[_0x9b2d('0x11')](function(_0x4defaf){logger[_0x9b2d('0xd')](_0x9b2d('0x1b'),_0x4defaf['message'],_0x562498);_0x5a7518(_0x40e10f[_0x9b2d('0xd')](0x1f4,_0x4defaf['message']));});});};exports[_0x9b2d('0x1d')]=function(_0x5e3a17){var _0x13e199=this;return new Promise(function(_0x38ac46,_0x4eb0ab){return db[_0x9b2d('0x12')][_0x9b2d('0x1e')]({'raw':_0x5e3a17[_0x9b2d('0x14')]?_0x5e3a17[_0x9b2d('0x14')][_0x9b2d('0x15')]===undefined?!![]:![]:!![],'where':_0x5e3a17['options']?_0x5e3a17[_0x9b2d('0x14')][_0x9b2d('0x1f')]||null:null,'attributes':_0x5e3a17[_0x9b2d('0x14')]?_0x5e3a17['options']['attributes']||null:null,'include':_0x5e3a17[_0x9b2d('0x14')]?_0x5e3a17['options'][_0x9b2d('0x19')]?_[_0x9b2d('0x18')](_0x5e3a17[_0x9b2d('0x14')][_0x9b2d('0x19')],function(_0x837c5a){return{'model':db[_0x837c5a[_0x9b2d('0x1a')]],'as':_0x837c5a['as'],'attributes':_0x837c5a[_0x9b2d('0x16')],'include':_0x837c5a[_0x9b2d('0x19')]?_['map'](_0x837c5a[_0x9b2d('0x19')],function(_0x11612e){return{'model':db[_0x11612e[_0x9b2d('0x1a')]],'as':_0x11612e['as'],'attributes':_0x11612e['attributes'],'include':_0x11612e[_0x9b2d('0x19')]?_['map'](_0x11612e['include'],function(_0x3f6bfe){return{'model':db[_0x3f6bfe[_0x9b2d('0x1a')]],'as':_0x3f6bfe['as'],'attributes':_0x3f6bfe[_0x9b2d('0x16')]};}):[]};}):[]};}):[]:[]})[_0x9b2d('0x20')](function(_0x5d2fa1){logger[_0x9b2d('0xa')](_0x9b2d('0x1d'),_0x5e3a17);logger[_0x9b2d('0x21')]('ShowTrigger',_0x5e3a17,JSON[_0x9b2d('0x1c')](_0x5d2fa1));_0x38ac46(_0x5d2fa1);})[_0x9b2d('0x11')](function(_0x51c051){logger[_0x9b2d('0xd')](_0x9b2d('0x1d'),_0x51c051['message'],_0x5e3a17);_0x4eb0ab(_0x13e199['error'](0x1f4,_0x51c051['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 79da090..9cc11d7 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 _0x4f8e=['exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','show','clone','post','create','put','/:id','update','delete','destroy'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x4f8e,0x19f));var _0xe4f8=function(_0x505df9,_0x14138e){_0x505df9=_0x505df9-0x0;var _0x1cc025=_0x4f8e[_0x505df9];return _0x1cc025;};'use strict';var multer=require('multer');var util=require(_0xe4f8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4f8('0x1'));var router=express['Router']();var fs_extra=require(_0xe4f8('0x2'));var auth=require(_0xe4f8('0x3'));var interaction=require(_0xe4f8('0x4'));var config=require('../../config/environment');var controller=require(_0xe4f8('0x5'));router[_0xe4f8('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe4f8('0x6')]('/:id',auth[_0xe4f8('0x7')](),controller[_0xe4f8('0x8')]);router['post']('/:id/clone',auth[_0xe4f8('0x7')](),controller[_0xe4f8('0x9')]);router[_0xe4f8('0xa')]('/',auth['isAuthenticated'](),controller[_0xe4f8('0xb')]);router[_0xe4f8('0xc')](_0xe4f8('0xd'),auth['isAuthenticated'](),controller[_0xe4f8('0xe')]);router[_0xe4f8('0xf')](_0xe4f8('0xd'),auth[_0xe4f8('0x7')](),controller[_0xe4f8('0x10')]);module[_0xe4f8('0x11')]=router; \ No newline at end of file +var _0xea4b=['Router','../../components/auth/service','./trunk.controller','index','/:id','isAuthenticated','show','post','/:id/clone','put','update','destroy','exports','connect-timeout','express'];(function(_0x3db8d8,_0x13756b){var _0x26e5ae=function(_0x1fcfa2){while(--_0x1fcfa2){_0x3db8d8['push'](_0x3db8d8['shift']());}};_0x26e5ae(++_0x13756b);}(_0xea4b,0x184));var _0xbea4=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xea4b[_0x4687df];return _0x32eaef;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbea4('0x0'));var express=require(_0xbea4('0x1'));var router=express[_0xbea4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbea4('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbea4('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xbea4('0x5')]);router['get'](_0xbea4('0x6'),auth[_0xbea4('0x7')](),controller[_0xbea4('0x8')]);router[_0xbea4('0x9')](_0xbea4('0xa'),auth[_0xbea4('0x7')](),controller['clone']);router['post']('/',auth[_0xbea4('0x7')](),controller['create']);router[_0xbea4('0xb')](_0xbea4('0x6'),auth['isAuthenticated'](),controller[_0xbea4('0xc')]);router['delete'](_0xbea4('0x6'),auth[_0xbea4('0x7')](),controller[_0xbea4('0xd')]);module[_0xbea4('0xe')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index baec660..b4d35ca 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 _0xdb4d=['all','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','\x22\x22\x20<>','INTEGER','accept','refuse','originate','uas','pai','fingerprint','certificate','active','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x43edb1,_0x564880){var _0x926e84=function(_0x31fc2f){while(--_0x31fc2f){_0x43edb1['push'](_0x43edb1['shift']());}};_0x926e84(++_0x564880);}(_0xdb4d,0x1f2));var _0xddb4=function(_0x198a00,_0x54c679){_0x198a00=_0x198a00-0x0;var _0x5f595e=_0xdb4d[_0x198a00];return _0x5f595e;};'use strict';var Sequelize=require(_0xddb4('0x0'));module[_0xddb4('0x1')]={'name':{'type':Sequelize[_0xddb4('0x2')],'allowNull':![],'unique':_0xddb4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x5'),_0xddb4('0x6'),_0xddb4('0x7')),'allowNull':![],'defaultValue':_0xddb4('0x5')},'context':{'type':Sequelize[_0xddb4('0x2')],'allowNull':![],'defaultValue':_0xddb4('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0xddb4('0x9'),_0xddb4('0xa'),'ALLOWED_FAILED_SCREEN',_0xddb4('0xb'),_0xddb4('0xc'),_0xddb4('0xd'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xddb4('0x2')]},'permit':{'type':Sequelize[_0xddb4('0x2')]},'secret':{'type':Sequelize[_0xddb4('0x2')]},'md5secret':{'type':Sequelize[_0xddb4('0x2')]},'remotesecret':{'type':Sequelize[_0xddb4('0x2')]},'transport':{'type':Sequelize[_0xddb4('0x2')],'defaultValue':_0xddb4('0xe'),'set':function(_0x2201fe){this['setDataValue'](_0xddb4('0xf'),_0x2201fe?_0x2201fe[_0xddb4('0x10')](','):null);},'get':function(){return this[_0xddb4('0x11')](_0xddb4('0xf'))?this['getDataValue'](_0xddb4('0xf'))[_0xddb4('0x12')](','):null;},'comment':_0xddb4('0x13')},'dtmfmode':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x14'),'info','shortinfo','inband',_0xddb4('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xddb4('0x4')]('yes','no',_0xddb4('0x16'),_0xddb4('0x17'),_0xddb4('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xddb4('0x2')],'defaultValue':_0xddb4('0x1a'),'set':function(_0x2a7719){this[_0xddb4('0x1b')](_0xddb4('0x1c'),_0x2a7719?_0x2a7719[_0xddb4('0x10')](','):null);},'get':function(){return this[_0xddb4('0x11')]('nat')?this[_0xddb4('0x11')](_0xddb4('0x1c'))['split'](','):null;},'comment':_0xddb4('0x1d')},'callgroup':{'type':Sequelize[_0xddb4('0x2')]},'namedcallgroup':{'type':Sequelize[_0xddb4('0x2')]},'pickupgroup':{'type':Sequelize[_0xddb4('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xddb4('0x2')]},'language':{'type':Sequelize[_0xddb4('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xddb4('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xddb4('0x2')],'defaultValue':_0xddb4('0x1e')},'allow':{'type':Sequelize[_0xddb4('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3dae20){this[_0xddb4('0x1b')](_0xddb4('0x1f'),_0x3dae20?_0x3dae20['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xddb4('0x11')](_0xddb4('0x1f'))?this[_0xddb4('0x11')](_0xddb4('0x1f'))['split'](';'):null;},'comment':_0xddb4('0x20')},'autoframing':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'insecure':{'type':Sequelize[_0xddb4('0x2')],'defaultValue':_0xddb4('0x21'),'set':function(_0x1e6229){this[_0xddb4('0x1b')](_0xddb4('0x22'),_0x1e6229?_0x1e6229['join'](','):null);},'get':function(){return this['getDataValue'](_0xddb4('0x22'))?this[_0xddb4('0x11')](_0xddb4('0x22'))[_0xddb4('0x12')](','):null;},'comment':_0xddb4('0x23')},'trustrpid':{'type':Sequelize[_0xddb4('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no',_0xddb4('0x24'))},'promiscredir':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xddb4('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xddb4('0x2')]},'callerid':{'type':Sequelize[_0xddb4('0x2')],'defaultValue':_0xddb4('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xddb4('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xddb4('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xddb4('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xddb4('0x2')]},'template':{'type':Sequelize[_0xddb4('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xddb4('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xddb4('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'mailbox':{'type':Sequelize[_0xddb4('0x2')]},'session_timers':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x27'),_0xddb4('0x28'),_0xddb4('0x29'))},'session_expires':{'type':Sequelize[_0xddb4('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xddb4('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xddb4('0x4')]('uac',_0xddb4('0x2a')),'defaultValue':_0xddb4('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xddb4('0x2')]},'regexten':{'type':Sequelize[_0xddb4('0x2')]},'fromdomain':{'type':Sequelize[_0xddb4('0x2')]},'fromuser':{'type':Sequelize[_0xddb4('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xddb4('0x19'),'no'),'defaultValue':_0xddb4('0x19')},'keepalive':{'type':Sequelize[_0xddb4('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xddb4('0x2')]},'defaultuser':{'type':Sequelize[_0xddb4('0x2')]},'rtptimeout':{'type':Sequelize[_0xddb4('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xddb4('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xddb4('0x4')]('yes','no',_0xddb4('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xddb4('0x2')]},'callbackextension':{'type':Sequelize[_0xddb4('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xddb4('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xddb4('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xddb4('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xddb4('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xddb4('0x2')]},'use_q850_reason':{'type':Sequelize[_0xddb4('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xddb4('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xddb4('0x19'),'no')},'icesupport':{'type':Sequelize[_0xddb4('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xddb4('0x19'),'no',_0xddb4('0x2c'),_0xddb4('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xddb4('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xddb4('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xddb4('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xddb4('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x2e'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xddb4('0x2')]},'usereqphone':{'type':Sequelize[_0xddb4('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xddb4('0x2')]},'recordofffeature':{'type':Sequelize[_0xddb4('0x2')]},'call_limit':{'type':Sequelize[_0xddb4('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no')},'vmexten':{'type':Sequelize[_0xddb4('0x2')]},'mohinterpret':{'type':Sequelize[_0xddb4('0x2')]},'mohsuggest':{'type':Sequelize[_0xddb4('0x2')]},'parkinglot':{'type':Sequelize[_0xddb4('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xddb4('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xddb4('0x4')](_0xddb4('0x19'),'no',_0xddb4('0x16'),_0xddb4('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xddb4('0x2')]},'otherFields':{'type':Sequelize[_0xddb4('0x2')]},'active':{'type':Sequelize[_0xddb4('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xe9d8=['inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','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','uas','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','user','peer','from-voip-provider','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','info'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe9d8,0x111));var _0x8e9d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe9d8[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x8e9d('0x0'));module[_0x8e9d('0x1')]={'name':{'type':Sequelize[_0x8e9d('0x2')],'allowNull':![],'unique':_0x8e9d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x8e9d('0x4'),_0x8e9d('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8e9d('0x6')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x8e9d('0x7'),_0x8e9d('0x8'),_0x8e9d('0x9'),'PROHIB_PASSED_SCREEN',_0x8e9d('0xa'),_0x8e9d('0xb'))},'deny':{'type':Sequelize[_0x8e9d('0x2')]},'permit':{'type':Sequelize[_0x8e9d('0x2')]},'secret':{'type':Sequelize[_0x8e9d('0x2')]},'md5secret':{'type':Sequelize[_0x8e9d('0x2')]},'remotesecret':{'type':Sequelize[_0x8e9d('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x8e9d('0xc'),'set':function(_0xd74a2e){this[_0x8e9d('0xd')](_0x8e9d('0xe'),_0xd74a2e?_0xd74a2e[_0x8e9d('0xf')](','):null);},'get':function(){return this[_0x8e9d('0x10')]('transport')?this[_0x8e9d('0x10')](_0x8e9d('0xe'))[_0x8e9d('0x11')](','):null;},'comment':_0x8e9d('0x12')},'dtmfmode':{'type':Sequelize[_0x8e9d('0x13')]('rfc2833',_0x8e9d('0x14'),'shortinfo',_0x8e9d('0x15'),_0x8e9d('0x16')),'defaultValue':_0x8e9d('0x17')},'directmedia':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no',_0x8e9d('0x19'),_0x8e9d('0x1a'),_0x8e9d('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8e9d('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x8e9d('0x2')],'defaultValue':_0x8e9d('0x1c'),'set':function(_0x53ace2){this[_0x8e9d('0xd')](_0x8e9d('0x1d'),_0x53ace2?_0x53ace2[_0x8e9d('0xf')](','):null);},'get':function(){return this[_0x8e9d('0x10')](_0x8e9d('0x1d'))?this[_0x8e9d('0x10')](_0x8e9d('0x1d'))[_0x8e9d('0x11')](','):null;},'comment':_0x8e9d('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x8e9d('0x2')]},'pickupgroup':{'type':Sequelize[_0x8e9d('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8e9d('0x2')]},'language':{'type':Sequelize[_0x8e9d('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8e9d('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8e9d('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x8e9d('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xf41494){this[_0x8e9d('0xd')](_0x8e9d('0x1f'),_0xf41494?_0xf41494[_0x8e9d('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x8e9d('0x10')](_0x8e9d('0x1f'))?this['getDataValue'](_0x8e9d('0x1f'))[_0x8e9d('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no')},'insecure':{'type':Sequelize[_0x8e9d('0x2')],'defaultValue':_0x8e9d('0x20'),'set':function(_0x4aade0){this[_0x8e9d('0xd')](_0x8e9d('0x21'),_0x4aade0?_0x4aade0[_0x8e9d('0xf')](','):null);},'get':function(){return this[_0x8e9d('0x10')](_0x8e9d('0x21'))?this[_0x8e9d('0x10')](_0x8e9d('0x21'))[_0x8e9d('0x11')](','):null;},'comment':_0x8e9d('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0x8e9d('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8e9d('0x13')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8e9d('0x13')]('yes','no',_0x8e9d('0x23'))},'promiscredir':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x8e9d('0x25')},'amaflags':{'type':Sequelize[_0x8e9d('0x2')]},'callcounter':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no'),'defaultValue':_0x8e9d('0x18')},'busylevel':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x8e9d('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x8e9d('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no',_0x8e9d('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x8e9d('0x2')]},'session_timers':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x27'),_0x8e9d('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x8e9d('0x29')),'defaultValue':_0x8e9d('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x8e9d('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x8e9d('0x2')]},'fromuser':{'type':Sequelize[_0x8e9d('0x2')]},'port':{'type':Sequelize[_0x8e9d('0x24')](0x5)},'qualify':{'type':Sequelize[_0x8e9d('0x13')]('yes','no'),'defaultValue':_0x8e9d('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8e9d('0x2')]},'rtptimeout':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8e9d('0x2')]},'callbackextension':{'type':Sequelize[_0x8e9d('0x2')]},'timert1':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'timerb':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x8e9d('0x2')]},'contactdeny':{'type':Sequelize[_0x8e9d('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x8e9d('0x2')]},'use_q850_reason':{'type':Sequelize[_0x8e9d('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8e9d('0x13')]('yes','no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x8e9d('0x13')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no',_0x8e9d('0x2a'),_0x8e9d('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x8e9d('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x8e9d('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x8e9d('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x8e9d('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8e9d('0x2c'),_0x8e9d('0x2d'),_0x8e9d('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8e9d('0x2')]},'usereqphone':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x8e9d('0x2')]},'call_limit':{'type':Sequelize[_0x8e9d('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x8e9d('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no')},'vmexten':{'type':Sequelize[_0x8e9d('0x2')]},'mohinterpret':{'type':Sequelize[_0x8e9d('0x2')]},'mohsuggest':{'type':Sequelize[_0x8e9d('0x2')]},'parkinglot':{'type':Sequelize[_0x8e9d('0x2')]},'description':{'type':Sequelize[_0x8e9d('0x2')]},'host':{'type':Sequelize[_0x8e9d('0x2')],'defaultValue':_0x8e9d('0x2f')},'canreinvite':{'type':Sequelize[_0x8e9d('0x13')](_0x8e9d('0x18'),'no','nonat',_0x8e9d('0x1a'),_0x8e9d('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8e9d('0x2')]},'otherFields':{'type':Sequelize[_0x8e9d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8e9d('0x2')],'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 6331eb4..37ed781 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 _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x48c938,_0x14ac2c){var _0x5625b2=function(_0x3edffd){while(--_0x3edffd){_0x48c938['push'](_0x48c938['shift']());}};_0x5625b2(++_0x14ac2c);}(_0x9f62,0x154));var _0x29f6=function(_0x7c4fe4,_0x51a200){_0x7c4fe4=_0x7c4fe4-0x0;var _0x2facef=_0x9f62[_0x7c4fe4];return _0x2facef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x8a3e47,_0x54bfb9){var _0xcab3f2=function(_0x1d7180){while(--_0x1d7180){_0x8a3e47['push'](_0x8a3e47['shift']());}};_0xcab3f2(++_0x54bfb9);}(_0xe14d,0x1ee));var _0xde14=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe14d[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2a1676d..eef3d87 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 _0x659b=['../../config/environment','./trunk.attributes','exports','define','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0x659b,0x198));var _0xb659=function(_0x15e366,_0x10bf91){_0x15e366=_0x15e366-0x0;var _0xa322b3=_0x659b[_0x15e366];return _0xa322b3;};'use strict';var _=require('lodash');var util=require(_0xb659('0x0'));var logger=require(_0xb659('0x1'))(_0xb659('0x2'));var moment=require(_0xb659('0x3'));var BPromise=require(_0xb659('0x4'));var rp=require(_0xb659('0x5'));var fs=require('fs');var path=require(_0xb659('0x6'));var rimraf=require(_0xb659('0x7'));var config=require(_0xb659('0x8'));var attributes=require(_0xb659('0x9'));module[_0xb659('0xa')]=function(_0x1c47f4,_0xae8363){return _0x1c47f4[_0xb659('0xb')]('Trunk',attributes,{'tableName':_0xb659('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb84b=['tools_trunks','util','../../config/logger','api','moment','bluebird','path','rimraf','./trunk.attributes','exports','define'];(function(_0x359399,_0x5bb679){var _0x562e3a=function(_0x41e6bd){while(--_0x41e6bd){_0x359399['push'](_0x359399['shift']());}};_0x562e3a(++_0x5bb679);}(_0xb84b,0x16c));var _0xbb84=function(_0x55ecdb,_0x52e77c){_0x55ecdb=_0x55ecdb-0x0;var _0x196713=_0xb84b[_0x55ecdb];return _0x196713;};'use strict';var _=require('lodash');var util=require(_0xbb84('0x0'));var logger=require(_0xbb84('0x1'))(_0xbb84('0x2'));var moment=require(_0xbb84('0x3'));var BPromise=require(_0xbb84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb84('0x5'));var rimraf=require(_0xbb84('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb84('0x7'));module[_0xbb84('0x8')]=function(_0x5823c6,_0x35726a){return _0x5823c6[_0xbb84('0x9')]('Trunk',attributes,{'tableName':_0xbb84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index c8284b2..3fb653a 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 _0x1b1c=['jayson/promise','client','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','info','GetTrunk','options','raw','include','map','model','attributes','find','ShowTrunk','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x515661,_0x36a15d){var _0x1bf063=function(_0x1f186e){while(--_0x1f186e){_0x515661['push'](_0x515661['shift']());}};_0x1bf063(++_0x36a15d);}(_0x1b1c,0x112));var _0xc1b1=function(_0x44b04c,_0x5786a3){_0x44b04c=_0x44b04c-0x0;var _0x1d2442=_0x1b1c[_0x44b04c];return _0x1d2442;};'use strict';var _=require(_0xc1b1('0x0'));var util=require('util');var moment=require(_0xc1b1('0x1'));var BPromise=require('bluebird');var rs=require(_0xc1b1('0x2'));var fs=require('fs');var Redis=require(_0xc1b1('0x3'));var db=require(_0xc1b1('0x4'))['db'];var utils=require(_0xc1b1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc1b1('0x6'));var client=jayson[_0xc1b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x322f8b,_0x9d3f8c,_0x2d7934){return new BPromise(function(_0x53b7ea,_0x2f3709){return client[_0xc1b1('0x8')](_0x322f8b,_0x2d7934)[_0xc1b1('0x9')](function(_0x527a56){logger['info']('Trunk,\x20%s,\x20%s',_0x9d3f8c,_0xc1b1('0xa'));logger[_0xc1b1('0xb')](_0xc1b1('0xc'),_0x9d3f8c,_0xc1b1('0xa'),JSON[_0xc1b1('0xd')](_0x527a56));if(_0x527a56[_0xc1b1('0xe')]){if(_0x527a56[_0xc1b1('0xe')][_0xc1b1('0xf')]===0x1f4){logger[_0xc1b1('0xe')]('Trunk,\x20%s,\x20%s',_0x9d3f8c,_0x527a56[_0xc1b1('0xe')]['message']);return _0x2f3709(_0x527a56[_0xc1b1('0xe')][_0xc1b1('0x10')]);}logger[_0xc1b1('0xe')](_0xc1b1('0x11'),_0x9d3f8c,_0x527a56['error'][_0xc1b1('0x10')]);return _0x53b7ea(_0x527a56['error']['message']);}else{logger[_0xc1b1('0x12')]('Trunk,\x20%s,\x20%s',_0x9d3f8c,_0xc1b1('0xa'));_0x53b7ea(_0x527a56['result'][_0xc1b1('0x10')]);}})['catch'](function(_0x8a0d11){logger[_0xc1b1('0xe')](_0xc1b1('0x11'),_0x9d3f8c,_0x8a0d11);_0x2f3709(_0x8a0d11);});});}exports[_0xc1b1('0x13')]=function(_0x89d6b1){var _0x2b297a=this;return new Promise(function(_0x2e1f25,_0x268ec3){return db['Trunk']['findAll']({'raw':_0x89d6b1[_0xc1b1('0x14')]?_0x89d6b1[_0xc1b1('0x14')][_0xc1b1('0x15')]===undefined?!![]:![]:!![],'where':_0x89d6b1[_0xc1b1('0x14')]?_0x89d6b1[_0xc1b1('0x14')]['where']||null:null,'attributes':_0x89d6b1[_0xc1b1('0x14')]?_0x89d6b1[_0xc1b1('0x14')]['attributes']||null:null,'limit':_0x89d6b1[_0xc1b1('0x14')]?_0x89d6b1['options']['limit']||null:null,'include':_0x89d6b1[_0xc1b1('0x14')]?_0x89d6b1[_0xc1b1('0x14')][_0xc1b1('0x16')]?_[_0xc1b1('0x17')](_0x89d6b1[_0xc1b1('0x14')][_0xc1b1('0x16')],function(_0x26df47){return{'model':db[_0x26df47[_0xc1b1('0x18')]],'as':_0x26df47['as'],'attributes':_0x26df47[_0xc1b1('0x19')],'include':_0x26df47[_0xc1b1('0x16')]?_['map'](_0x26df47['include'],function(_0x4a0e9e){return{'model':db[_0x4a0e9e['model']],'as':_0x4a0e9e['as'],'attributes':_0x4a0e9e['attributes'],'include':_0x4a0e9e[_0xc1b1('0x16')]?_['map'](_0x4a0e9e[_0xc1b1('0x16')],function(_0x663b52){return{'model':db[_0x663b52[_0xc1b1('0x18')]],'as':_0x663b52['as'],'attributes':_0x663b52[_0xc1b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc1b1('0x9')](function(_0x12c283){logger[_0xc1b1('0x12')](_0xc1b1('0x13'),_0x89d6b1);logger['debug'](_0xc1b1('0x13'),_0x89d6b1,JSON[_0xc1b1('0xd')](_0x12c283));_0x2e1f25(_0x12c283);})['catch'](function(_0x189a86){logger['error'](_0xc1b1('0x13'),_0x189a86[_0xc1b1('0x10')],_0x89d6b1);_0x268ec3(_0x2b297a[_0xc1b1('0xe')](0x1f4,_0x189a86['message']));});});};exports['ShowTrunk']=function(_0x1f6bab){var _0x20227b=this;return new Promise(function(_0x14a46d,_0x2deb13){return db['Trunk'][_0xc1b1('0x1a')]({'raw':_0x1f6bab['options']?_0x1f6bab[_0xc1b1('0x14')][_0xc1b1('0x15')]===undefined?!![]:![]:!![],'where':_0x1f6bab[_0xc1b1('0x14')]?_0x1f6bab[_0xc1b1('0x14')]['where']||null:null,'attributes':_0x1f6bab[_0xc1b1('0x14')]?_0x1f6bab[_0xc1b1('0x14')][_0xc1b1('0x19')]||null:null,'include':_0x1f6bab[_0xc1b1('0x14')]?_0x1f6bab[_0xc1b1('0x14')][_0xc1b1('0x16')]?_[_0xc1b1('0x17')](_0x1f6bab[_0xc1b1('0x14')][_0xc1b1('0x16')],function(_0x159903){return{'model':db[_0x159903[_0xc1b1('0x18')]],'as':_0x159903['as'],'attributes':_0x159903[_0xc1b1('0x19')],'include':_0x159903['include']?_[_0xc1b1('0x17')](_0x159903[_0xc1b1('0x16')],function(_0x343e70){return{'model':db[_0x343e70[_0xc1b1('0x18')]],'as':_0x343e70['as'],'attributes':_0x343e70[_0xc1b1('0x19')],'include':_0x343e70[_0xc1b1('0x16')]?_['map'](_0x343e70['include'],function(_0x2ed19f){return{'model':db[_0x2ed19f['model']],'as':_0x2ed19f['as'],'attributes':_0x2ed19f[_0xc1b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc1b1('0x9')](function(_0x1cfbd5){logger[_0xc1b1('0x12')](_0xc1b1('0x1b'),_0x1f6bab);logger[_0xc1b1('0xb')](_0xc1b1('0x1b'),_0x1f6bab,JSON[_0xc1b1('0xd')](_0x1cfbd5));_0x14a46d(_0x1cfbd5);})['catch'](function(_0x163b8a){logger['error']('ShowTrunk',_0x163b8a[_0xc1b1('0x10')],_0x1f6bab);_0x2deb13(_0x20227b['error'](0x1f4,_0x163b8a[_0xc1b1('0x10')]));});});}; \ No newline at end of file +var _0x4d69=['moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0x4d69,0x82));var _0x94d6=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x4d69[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x94d6('0x0'));var util=require(_0x94d6('0x1'));var moment=require(_0x94d6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x94d6('0x3'));var logger=require(_0x94d6('0x4'))(_0x94d6('0x5'));var config=require('../../config/environment');var jayson=require(_0x94d6('0x6'));var client=jayson[_0x94d6('0x7')][_0x94d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dad55,_0x5971c7,_0x4c9ad5){return new BPromise(function(_0x548fb2,_0x21c3e5){return client[_0x94d6('0x9')](_0x5dad55,_0x4c9ad5)[_0x94d6('0xa')](function(_0x4d8b07){logger[_0x94d6('0xb')]('Trunk,\x20%s,\x20%s',_0x5971c7,'request\x20sent');logger[_0x94d6('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5971c7,_0x94d6('0xd'),JSON[_0x94d6('0xe')](_0x4d8b07));if(_0x4d8b07[_0x94d6('0xf')]){if(_0x4d8b07[_0x94d6('0xf')]['code']===0x1f4){logger['error'](_0x94d6('0x10'),_0x5971c7,_0x4d8b07[_0x94d6('0xf')]['message']);return _0x21c3e5(_0x4d8b07['error']['message']);}logger['error'](_0x94d6('0x10'),_0x5971c7,_0x4d8b07[_0x94d6('0xf')]['message']);return _0x548fb2(_0x4d8b07[_0x94d6('0xf')][_0x94d6('0x11')]);}else{logger[_0x94d6('0xb')](_0x94d6('0x10'),_0x5971c7,_0x94d6('0xd'));_0x548fb2(_0x4d8b07[_0x94d6('0x12')][_0x94d6('0x11')]);}})[_0x94d6('0x13')](function(_0x1cb661){logger[_0x94d6('0xf')](_0x94d6('0x10'),_0x5971c7,_0x1cb661);_0x21c3e5(_0x1cb661);});});}exports[_0x94d6('0x14')]=function(_0x36a65c){var _0x2a4ff4=this;return new Promise(function(_0x1c6c48,_0x1434b1){return db[_0x94d6('0x15')][_0x94d6('0x16')]({'raw':_0x36a65c[_0x94d6('0x17')]?_0x36a65c[_0x94d6('0x17')][_0x94d6('0x18')]===undefined?!![]:![]:!![],'where':_0x36a65c[_0x94d6('0x17')]?_0x36a65c[_0x94d6('0x17')][_0x94d6('0x19')]||null:null,'attributes':_0x36a65c[_0x94d6('0x17')]?_0x36a65c[_0x94d6('0x17')][_0x94d6('0x1a')]||null:null,'limit':_0x36a65c['options']?_0x36a65c[_0x94d6('0x17')][_0x94d6('0x1b')]||null:null,'include':_0x36a65c['options']?_0x36a65c[_0x94d6('0x17')][_0x94d6('0x1c')]?_[_0x94d6('0x1d')](_0x36a65c[_0x94d6('0x17')][_0x94d6('0x1c')],function(_0x2a9591){return{'model':db[_0x2a9591['model']],'as':_0x2a9591['as'],'attributes':_0x2a9591[_0x94d6('0x1a')],'include':_0x2a9591[_0x94d6('0x1c')]?_[_0x94d6('0x1d')](_0x2a9591[_0x94d6('0x1c')],function(_0x3d6f93){return{'model':db[_0x3d6f93[_0x94d6('0x1e')]],'as':_0x3d6f93['as'],'attributes':_0x3d6f93['attributes'],'include':_0x3d6f93[_0x94d6('0x1c')]?_['map'](_0x3d6f93[_0x94d6('0x1c')],function(_0x142598){return{'model':db[_0x142598[_0x94d6('0x1e')]],'as':_0x142598['as'],'attributes':_0x142598['attributes']};}):[]};}):[]};}):[]:[]})[_0x94d6('0xa')](function(_0x5d8668){logger[_0x94d6('0xb')](_0x94d6('0x14'),_0x36a65c);logger[_0x94d6('0xc')](_0x94d6('0x14'),_0x36a65c,JSON[_0x94d6('0xe')](_0x5d8668));_0x1c6c48(_0x5d8668);})[_0x94d6('0x13')](function(_0x151f37){logger[_0x94d6('0xf')](_0x94d6('0x14'),_0x151f37[_0x94d6('0x11')],_0x36a65c);_0x1434b1(_0x2a4ff4[_0x94d6('0xf')](0x1f4,_0x151f37[_0x94d6('0x11')]));});});};exports[_0x94d6('0x1f')]=function(_0x228166){var _0x42e0ac=this;return new Promise(function(_0x4a30a9,_0x1cf361){return db[_0x94d6('0x15')][_0x94d6('0x20')]({'raw':_0x228166['options']?_0x228166[_0x94d6('0x17')][_0x94d6('0x18')]===undefined?!![]:![]:!![],'where':_0x228166[_0x94d6('0x17')]?_0x228166[_0x94d6('0x17')][_0x94d6('0x19')]||null:null,'attributes':_0x228166[_0x94d6('0x17')]?_0x228166[_0x94d6('0x17')]['attributes']||null:null,'include':_0x228166['options']?_0x228166[_0x94d6('0x17')][_0x94d6('0x1c')]?_[_0x94d6('0x1d')](_0x228166[_0x94d6('0x17')][_0x94d6('0x1c')],function(_0x290f0c){return{'model':db[_0x290f0c[_0x94d6('0x1e')]],'as':_0x290f0c['as'],'attributes':_0x290f0c[_0x94d6('0x1a')],'include':_0x290f0c['include']?_[_0x94d6('0x1d')](_0x290f0c['include'],function(_0x44245c){return{'model':db[_0x44245c[_0x94d6('0x1e')]],'as':_0x44245c['as'],'attributes':_0x44245c[_0x94d6('0x1a')],'include':_0x44245c[_0x94d6('0x1c')]?_['map'](_0x44245c[_0x94d6('0x1c')],function(_0xf7451c){return{'model':db[_0xf7451c[_0x94d6('0x1e')]],'as':_0xf7451c['as'],'attributes':_0xf7451c[_0x94d6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38fd39){logger[_0x94d6('0xb')]('ShowTrunk',_0x228166);logger['debug'](_0x94d6('0x1f'),_0x228166,JSON[_0x94d6('0xe')](_0x38fd39));_0x4a30a9(_0x38fd39);})['catch'](function(_0x291b38){logger[_0x94d6('0xf')]('ShowTrunk',_0x291b38[_0x94d6('0x11')],_0x228166);_0x1cf361(_0x42e0ac[_0x94d6('0xf')](0x1f4,_0x291b38[_0x94d6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index cb50d94..b4f836b 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 _0x7bf6=['update','express','Router','/:id','isAuthenticated'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7bf6,0xe7));var _0x67bf=function(_0x192b03,_0x3718e7){_0x192b03=_0x192b03-0x0;var _0x2e09db=_0x7bf6[_0x192b03];return _0x2e09db;};'use strict';var express=require(_0x67bf('0x0'));var router=express[_0x67bf('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router['put'](_0x67bf('0x2'),auth[_0x67bf('0x3')](),controller[_0x67bf('0x4')]);module['exports']=router; \ No newline at end of file +var _0xe0f7=['Router','put','/:id','update','exports'];(function(_0x19ef32,_0x3b78ff){var _0x20034e=function(_0x3eb2d9){while(--_0x3eb2d9){_0x19ef32['push'](_0x19ef32['shift']());}};_0x20034e(++_0x3b78ff);}(_0xe0f7,0x1a9));var _0x7e0f=function(_0x2f3028,_0x1552ab){_0x2f3028=_0x2f3028-0x0;var _0x4693f8=_0xe0f7[_0x2f3028];return _0x4693f8;};'use strict';var express=require('express');var router=express[_0x7e0f('0x0')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x7e0f('0x1')](_0x7e0f('0x2'),auth['isAuthenticated'](),controller[_0x7e0f('0x3')]);module[_0x7e0f('0x4')]=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 9e4d8cb..2c896e9 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 _0x6088=['error','info','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x6088,0x1cb));var _0x8608=function(_0x31e719,_0x736e78){_0x31e719=_0x31e719-0x0;var _0x5cb5a3=_0x6088[_0x31e719];return _0x5cb5a3;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x8608('0x0'),'warning',_0x8608('0x1'),'debug'];module[_0x8608('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8608('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8608('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8608('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8608('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8608('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8608('0x7')],'unique':_0x8608('0x8')}}; \ No newline at end of file +var _0x75d3=['warning','info','debug','ENUM','BOOLEAN','DATE','INTEGER','sequelize','error'];(function(_0x1ed476,_0xf395ef){var _0x38d470=function(_0x253f37){while(--_0x253f37){_0x1ed476['push'](_0x1ed476['shift']());}};_0x38d470(++_0xf395ef);}(_0x75d3,0x97));var _0x375d=function(_0x33cc74,_0x2f90e8){_0x33cc74=_0x33cc74-0x0;var _0x261fe6=_0x75d3[_0x33cc74];return _0x261fe6;};'use strict';var Sequelize=require(_0x375d('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x375d('0x1'),_0x375d('0x2'),_0x375d('0x3'),_0x375d('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x375d('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x375d('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x375d('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x375d('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x375d('0x8')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 0278876..51f8f3a 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 _0x9ef8=['admin','params','find','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','localhost','status','json','then','sendStatus','error','name','send','user','role'];(function(_0x356e5c,_0x23156b){var _0x459517=function(_0x425042){while(--_0x425042){_0x356e5c['push'](_0x356e5c['shift']());}};_0x459517(++_0x23156b);}(_0x9ef8,0x17f));var _0x89ef=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0x9ef8[_0x3d27ba];return _0xf01885;};'use strict';var _=require(_0x89ef('0x0'));var Redis=require(_0x89ef('0x1'));var logger=require('../../config/logger')(_0x89ef('0x2'));var config=require(_0x89ef('0x3'));var db=require(_0x89ef('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x89ef('0x5')]));require(_0x89ef('0x6'))['register'](socket);config['redis']=_['defaults'](config[_0x89ef('0x5')],{'host':_0x89ef('0x7'),'port':0x18eb});function respondWithResult(_0x24439e,_0x90b5bf){_0x90b5bf=_0x90b5bf||0xc8;return function(_0x46c0da){if(_0x46c0da){return _0x24439e[_0x89ef('0x8')](_0x90b5bf)[_0x89ef('0x9')](_0x46c0da);}};}function saveUpdates(_0x3d204a){return function(_0xbd0084){if(_0xbd0084){return _0xbd0084['update'](_0x3d204a)[_0x89ef('0xa')](function(_0x4687cb){return _0x4687cb;});}return null;};}function handleEntityNotFound(_0x30c8f4){return function(_0x5c5435){if(!_0x5c5435){_0x30c8f4[_0x89ef('0xb')](0x194);}return _0x5c5435;};}function handleError(_0x7f5df1,_0x1c69aa){_0x1c69aa=_0x1c69aa||0x1f4;return function(_0x4b52dc){logger[_0x89ef('0xc')](_0x4b52dc['stack']);if(_0x4b52dc[_0x89ef('0xd')]){delete _0x4b52dc['name'];}_0x7f5df1[_0x89ef('0x8')](_0x1c69aa)[_0x89ef('0xe')](_0x4b52dc);};}exports['update']=function(_0x21ac0b,_0x269192){if(_0x21ac0b[_0x89ef('0xf')][_0x89ef('0x10')]!==_0x89ef('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x21ac0b[_0x89ef('0x12')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0x89ef('0x13')]({'where':{'id':_0x21ac0b[_0x89ef('0x12')]['id']}})['then'](handleEntityNotFound(_0x269192,null))[_0x89ef('0xa')](saveUpdates(_0x21ac0b['body'],null))[_0x89ef('0xa')](respondWithResult(_0x269192,null))['catch'](handleError(_0x269192,null));}; \ No newline at end of file +var _0x5645=['redis','./user-setting.socket','register','defaults','localhost','status','json','update','sendStatus','error','stack','name','send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter'];(function(_0x4bde50,_0x4213dd){var _0x732af1=function(_0x5097de){while(--_0x5097de){_0x4bde50['push'](_0x4bde50['shift']());}};_0x732af1(++_0x4213dd);}(_0x5645,0x19e));var _0x5564=function(_0x63885,_0x5d0a2e){_0x63885=_0x63885-0x0;var _0x4eba18=_0x5645[_0x63885];return _0x4eba18;};'use strict';var _=require(_0x5564('0x0'));var Redis=require(_0x5564('0x1'));var logger=require(_0x5564('0x2'))(_0x5564('0x3'));var config=require(_0x5564('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x5564('0x5'))(new Redis(config[_0x5564('0x6')]));require(_0x5564('0x7'))[_0x5564('0x8')](socket);config[_0x5564('0x6')]=_[_0x5564('0x9')](config[_0x5564('0x6')],{'host':_0x5564('0xa'),'port':0x18eb});function respondWithResult(_0x372fb5,_0x49567f){_0x49567f=_0x49567f||0xc8;return function(_0x49be4e){if(_0x49be4e){return _0x372fb5[_0x5564('0xb')](_0x49567f)[_0x5564('0xc')](_0x49be4e);}};}function saveUpdates(_0x12778a){return function(_0x180900){if(_0x180900){return _0x180900[_0x5564('0xd')](_0x12778a)['then'](function(_0x1ba45a){return _0x1ba45a;});}return null;};}function handleEntityNotFound(_0x7d0bd5){return function(_0x5ca56f){if(!_0x5ca56f){_0x7d0bd5[_0x5564('0xe')](0x194);}return _0x5ca56f;};}function handleError(_0x1e63ca,_0x1c124a){_0x1c124a=_0x1c124a||0x1f4;return function(_0x1f5bb5){logger[_0x5564('0xf')](_0x1f5bb5[_0x5564('0x10')]);if(_0x1f5bb5[_0x5564('0x11')]){delete _0x1f5bb5[_0x5564('0x11')];}_0x1e63ca['status'](_0x1c124a)[_0x5564('0x12')](_0x1f5bb5);};}exports['update']=function(_0x423074,_0x10185f){if(_0x423074['user'][_0x5564('0x13')]!==_0x5564('0x14'))throw new Error(_0x5564('0x15'));if(isNaN(Number(_0x423074[_0x5564('0x16')]['id'])))throw new Error(_0x5564('0x17'));return db[_0x5564('0x18')]['find']({'where':{'id':_0x423074[_0x5564('0x16')]['id']}})[_0x5564('0x19')](handleEntityNotFound(_0x10185f,null))[_0x5564('0x19')](saveUpdates(_0x423074[_0x5564('0x1a')],null))['then'](respondWithResult(_0x10185f,null))[_0x5564('0x1b')](handleError(_0x10185f,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 b8d4c3c..e6b4596 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 _0xe91f=['exports','events','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4128bd,_0x2727c0){var _0x179867=function(_0x429988){while(--_0x429988){_0x4128bd['push'](_0x4128bd['shift']());}};_0x179867(++_0x2727c0);}(_0xe91f,0x19b));var _0xfe91=function(_0x4ac315,_0x24c6af){_0x4ac315=_0x4ac315-0x0;var _0x56333f=_0xe91f[_0x4ac315];return _0x56333f;};'use strict';var EventEmitter=require(_0xfe91('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xfe91('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xfe91('0x2')](0x0);var events={'afterCreate':_0xfe91('0x3'),'afterUpdate':_0xfe91('0x4'),'afterDestroy':_0xfe91('0x5')};function emitEvent(_0x141751){return function(_0x3009df,_0x2ed612,_0xba415){UserSettingEvents['emit'](_0x141751+':'+_0x3009df['id'],_0x3009df);UserSettingEvents[_0xfe91('0x6')](_0x141751,_0x3009df);_0xba415(null);};}for(var e in events){if(events[_0xfe91('0x7')](e)){var event=events[e];UserSetting[_0xfe91('0x8')](e,emitEvent(event));}}module[_0xfe91('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x3961=['hook','exports','events','../../mysqldb','UserSetting','save','update','remove','emit'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3961,0x1d6));var _0x1396=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x3961[_0x44afa4];return _0xcad289;};'use strict';var EventEmitter=require(_0x1396('0x0'));var UserSetting=require(_0x1396('0x1'))['db'][_0x1396('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1396('0x3'),'afterUpdate':_0x1396('0x4'),'afterDestroy':_0x1396('0x5')};function emitEvent(_0x31f3a4){return function(_0x38f65a,_0x155863,_0x4f1a6b){UserSettingEvents['emit'](_0x31f3a4+':'+_0x38f65a['id'],_0x38f65a);UserSettingEvents[_0x1396('0x6')](_0x31f3a4,_0x38f65a);_0x4f1a6b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x1396('0x7')](e,emitEvent(event));}}module[_0x1396('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 f4ac712..6fa7658 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 _0xc577=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define'];(function(_0x573a93,_0x3b1b43){var _0x1fa964=function(_0x31c4c7){while(--_0x31c4c7){_0x573a93['push'](_0x573a93['shift']());}};_0x1fa964(++_0x3b1b43);}(_0xc577,0x172));var _0x7c57=function(_0x52e251,_0x3b6303){_0x52e251=_0x52e251-0x0;var _0x5eee63=_0xc577[_0x52e251];return _0x5eee63;};'use strict';var attributes=require(_0x7c57('0x0'));module['exports']=function(_0x5cbd78){return _0x5cbd78[_0x7c57('0x1')](_0x7c57('0x2'),attributes,{'tableName':_0x7c57('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a2415){if(!_0x2a2415[_0x7c57('0x4')])_0x2a2415[_0x7c57('0x5')]=null;else if(_0x2a2415[_0x7c57('0x5')]===null)_0x2a2415['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xce3a=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x2b98d4,_0x1de753){var _0x76ce5b=function(_0x5bfe11){while(--_0x5bfe11){_0x2b98d4['push'](_0x2b98d4['shift']());}};_0x76ce5b(++_0x1de753);}(_0xce3a,0x194));var _0xace3=function(_0x527636,_0x157965){_0x527636=_0x527636-0x0;var _0x5abe4b=_0xce3a[_0x527636];return _0x5abe4b;};'use strict';var attributes=require(_0xace3('0x0'));module[_0xace3('0x1')]=function(_0x3ecaa1){return _0x3ecaa1[_0xace3('0x2')](_0xace3('0x3'),attributes,{'tableName':_0xace3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f1865){if(!_0x1f1865[_0xace3('0x5')])_0x1f1865[_0xace3('0x6')]=null;else if(_0x1f1865[_0xace3('0x6')]===null)_0x1f1865[_0xace3('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 7143d18..e4061d4 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 _0x920b=['user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','update','emit'];(function(_0x1582b9,_0x23c6c2){var _0x1b838a=function(_0x385e10){while(--_0x385e10){_0x1582b9['push'](_0x1582b9['shift']());}};_0x1b838a(++_0x23c6c2);}(_0x920b,0x11d));var _0xb920=function(_0x3e2964,_0x479553){_0x3e2964=_0x3e2964-0x0;var _0x5b4d76=_0x920b[_0x3e2964];return _0x5b4d76;};'use strict';var UserSettingEvents=require(_0xb920('0x0'));var events=[_0xb920('0x1'),_0xb920('0x2'),_0xb920('0x3')];function createListener(_0x48c792,_0x149aa4){return function(_0x19c80f){_0x149aa4[_0xb920('0x4')](_0x48c792,_0x19c80f);if(_0x48c792==='user-setting:update'){_0x149aa4[_0xb920('0x4')](_0xb920('0x5')+_0x19c80f[_0xb920('0x6')],_0x19c80f);}};}exports[_0xb920('0x7')]=function(_0x480383){for(var _0x1ceebd=0x0,_0x55c69c=events[_0xb920('0x8')];_0x1ceebd<_0x55c69c;_0x1ceebd++){var _0xd802cf=events[_0x1ceebd];var _0x9b3873=createListener(_0xb920('0x9')+_0xd802cf,_0x480383);UserSettingEvents['on'](_0xd802cf,_0x9b3873);}}; \ No newline at end of file +var _0xf50f=['user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','remove','emit'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xf50f,0x84));var _0xff50=function(_0x2866fe,_0x28d070){_0x2866fe=_0x2866fe-0x0;var _0x4271e9=_0xf50f[_0x2866fe];return _0x4271e9;};'use strict';var UserSettingEvents=require(_0xff50('0x0'));var events=[_0xff50('0x1'),_0xff50('0x2'),'update'];function createListener(_0x3474f4,_0x3af943){return function(_0x310d44){_0x3af943[_0xff50('0x3')](_0x3474f4,_0x310d44);if(_0x3474f4==='user-setting:update'){_0x3af943[_0xff50('0x3')](_0xff50('0x4')+_0x310d44['UserId'],_0x310d44);}};}exports[_0xff50('0x5')]=function(_0x241875){for(var _0x30c23f=0x0,_0x2532aa=events[_0xff50('0x6')];_0x30c23f<_0x2532aa;_0x30c23f++){var _0x4f8998=events[_0x30c23f];var _0x37ead4=createListener(_0xff50('0x7')+_0x4f8998,_0x241875);UserSettingEvents['on'](_0x4f8998,_0x37ead4);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index dee2e77..850da8a 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 _0x3c8e=['/:id/chat_websites','/:id/whatsapp_accounts','addWhatsappAccounts','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id','getAvatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0x3c8e,0x89));var _0xe3c8=function(_0x4cc77b,_0x26e138){_0x4cc77b=_0x4cc77b-0x0;var _0x305fa6=_0x3c8e[_0x4cc77b];return _0x305fa6;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3c8('0x2'));var router=express[_0xe3c8('0x3')]();var fs_extra=require(_0xe3c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe3c8('0x5'));var config=require(_0xe3c8('0x6'));var controller=require(_0xe3c8('0x7'));router[_0xe3c8('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3c8('0x9')]);router[_0xe3c8('0x8')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xc')]);router['get'](_0xe3c8('0xd'),auth['isAuthenticated'](),controller[_0xe3c8('0xe')]);router[_0xe3c8('0x8')](_0xe3c8('0xf'),auth[_0xe3c8('0xb')](),controller['getPresence']);router[_0xe3c8('0x8')](_0xe3c8('0x10'),auth[_0xe3c8('0xb')](),controller['show']);router[_0xe3c8('0x8')]('/:id/avatar',controller[_0xe3c8('0x11')]);router['get']('/:id/open_tabs',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x12')]);router[_0xe3c8('0x8')]('/:id/contacts',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x13')]);router[_0xe3c8('0x8')](_0xe3c8('0x14'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x15')]);router['get'](_0xe3c8('0x16'),auth[_0xe3c8('0xb')](),controller['getVoiceQueuesRt']);router[_0xe3c8('0x8')](_0xe3c8('0x17'),auth[_0xe3c8('0xb')](),controller['getGroups']);router[_0xe3c8('0x8')](_0xe3c8('0x18'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x19')]);router[_0xe3c8('0x8')](_0xe3c8('0x1a'),auth[_0xe3c8('0xb')](),controller['getScreenRecordings']);router[_0xe3c8('0x8')](_0xe3c8('0x1b'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x1c')]);router[_0xe3c8('0x8')](_0xe3c8('0x1d'),auth['isAuthenticated'](),controller[_0xe3c8('0x1e')]);router[_0xe3c8('0x8')]('/:id/mail/interactions',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x1f')]);router['get'](_0xe3c8('0x20'),auth[_0xe3c8('0xb')](),controller['getSmsInteractions']);router[_0xe3c8('0x8')](_0xe3c8('0x21'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x22')]);router[_0xe3c8('0x8')]('/:id/whatsapp/interactions',auth[_0xe3c8('0xb')](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0xe3c8('0xb')](),controller['getTeams']);router[_0xe3c8('0x8')](_0xe3c8('0x23'),auth['isAuthenticated'](),controller[_0xe3c8('0x24')]);router['get'](_0xe3c8('0x25'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x26')]);router[_0xe3c8('0x8')](_0xe3c8('0x27'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x28')]);router['get']('/:id/fax_accounts',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x29')]);router[_0xe3c8('0x8')]('/:id/mail_accounts',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x2a')]);router[_0xe3c8('0x8')](_0xe3c8('0x2b'),auth['isAuthenticated'](),controller[_0xe3c8('0x2c')]);router['get'](_0xe3c8('0x2d'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x2e')]);router[_0xe3c8('0x8')]('/:id/chat_websites',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x2f')]);router[_0xe3c8('0x8')]('/:id/whatsapp_accounts',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x30')]);router[_0xe3c8('0x8')](_0xe3c8('0x31'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x32')]);router['get'](_0xe3c8('0x33'),auth['isAuthenticated'](),controller[_0xe3c8('0x34')]);router[_0xe3c8('0x35')](_0xe3c8('0x36'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x37')]);router[_0xe3c8('0x35')]('/',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x38')]);router['post'](_0xe3c8('0x39'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xe3c8('0x35')](_0xe3c8('0x14'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x3a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x462b04,_0x4c5f06,_0x26e8ad){_0x26e8ad(null,path[_0xe3c8('0x3b')](config[_0xe3c8('0x3c')],_0xe3c8('0x3d')));},'filename':function(_0x308a74,_0x543d70,_0x257c02){_0x257c02(null,util[_0xe3c8('0x3e')](_0xe3c8('0x3f'),Date[_0xe3c8('0x40')](),_0x543d70[_0xe3c8('0x41')]));}})});router['post']('/:id/avatar',upload[_0xe3c8('0x42')](_0xe3c8('0x43')),controller[_0xe3c8('0x44')]);router[_0xe3c8('0x35')]('/:id/login',auth[_0xe3c8('0xb')](),controller['login']);router[_0xe3c8('0x35')](_0xe3c8('0x45'),auth[_0xe3c8('0xb')](),controller['logout']);router[_0xe3c8('0x35')](_0xe3c8('0x46'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x47')]);router[_0xe3c8('0x35')](_0xe3c8('0x48'),auth[_0xe3c8('0xb')](),controller['unpause']);router['post'](_0xe3c8('0x49'),auth['isAuthenticated'](),controller[_0xe3c8('0x4a')]);router[_0xe3c8('0x35')](_0xe3c8('0x4b'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x4c')]);router[_0xe3c8('0x35')]('/:id/mail_interactions',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x4d')]);router[_0xe3c8('0x35')](_0xe3c8('0x4e'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post']('/:id/sms_interactions',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x4f')]);router[_0xe3c8('0x35')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xe3c8('0x50')]);router[_0xe3c8('0x35')](_0xe3c8('0x51'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x52')]);router[_0xe3c8('0x35')](_0xe3c8('0x53'),auth['isAuthenticated'](),controller[_0xe3c8('0x54')]);router[_0xe3c8('0x35')](_0xe3c8('0x55'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x56')]);router[_0xe3c8('0x35')]('/:id/openchannel_accounts',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x57')]);router['post']('/:id/sms_accounts',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x58')]);router['post'](_0xe3c8('0x59'),auth[_0xe3c8('0xb')](),controller['addChatWebsites']);router[_0xe3c8('0x35')](_0xe3c8('0x5a'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x5b')]);router[_0xe3c8('0x35')](_0xe3c8('0x33'),auth[_0xe3c8('0xb')](),controller['createApiKey']);router['put'](_0xe3c8('0x10'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x5c')]);router[_0xe3c8('0x5d')](_0xe3c8('0x5e'),auth['isAuthenticated'](),controller[_0xe3c8('0x5f')]);router[_0xe3c8('0x60')](_0xe3c8('0x14'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x61')]);router[_0xe3c8('0x60')]('/:id/teams',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x62')]);router[_0xe3c8('0x60')](_0xe3c8('0x10'),auth[_0xe3c8('0xb')](),controller['destroy']);router['delete'](_0xe3c8('0x4b'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x63')]);router[_0xe3c8('0x60')](_0xe3c8('0x64'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x65')]);router[_0xe3c8('0x60')](_0xe3c8('0x4e'),auth['isAuthenticated'](),controller[_0xe3c8('0x66')]);router[_0xe3c8('0x60')](_0xe3c8('0x67'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0xe3c8('0x68'),auth[_0xe3c8('0xb')](),controller['removeOpenchannelInteractions']);router[_0xe3c8('0x60')](_0xe3c8('0x51'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe3c8('0x69')]);router['delete'](_0xe3c8('0x55'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x6a')]);router[_0xe3c8('0x60')](_0xe3c8('0x2b'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x6b')]);router['delete'](_0xe3c8('0x2d'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x6c')]);router[_0xe3c8('0x60')]('/:id/chat_websites',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x6d')]);router[_0xe3c8('0x60')](_0xe3c8('0x5a'),auth[_0xe3c8('0xb')](),controller['removeWhatsappAccounts']);router['delete'](_0xe3c8('0x33'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x6e')]);router['post'](_0xe3c8('0x6f'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x70')]);module['exports']=router; \ No newline at end of file +var _0xc759=['logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout'];(function(_0x5e8130,_0x40e714){var _0x679567=function(_0x3cb3dd){while(--_0x3cb3dd){_0x5e8130['push'](_0x5e8130['shift']());}};_0x679567(++_0x40e714);}(_0xc759,0xa0));var _0x9c75=function(_0x5322de,_0x138180){_0x5322de=_0x5322de-0x0;var _0x55fd0c=_0xc759[_0x5322de];return _0x55fd0c;};'use strict';var multer=require('multer');var util=require(_0x9c75('0x0'));var path=require(_0x9c75('0x1'));var timeout=require(_0x9c75('0x2'));var express=require(_0x9c75('0x3'));var router=express['Router']();var fs_extra=require(_0x9c75('0x4'));var auth=require(_0x9c75('0x5'));var interaction=require(_0x9c75('0x6'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x9c75('0x7')]('/',auth[_0x9c75('0x8')](),controller['index']);router[_0x9c75('0x7')](_0x9c75('0x9'),auth[_0x9c75('0x8')](),controller['describe']);router[_0x9c75('0x7')](_0x9c75('0xa'),auth[_0x9c75('0x8')](),controller['whoami']);router[_0x9c75('0x7')](_0x9c75('0xb'),auth[_0x9c75('0x8')](),controller['getPresence']);router[_0x9c75('0x7')](_0x9c75('0xc'),auth[_0x9c75('0x8')](),controller[_0x9c75('0xd')]);router[_0x9c75('0x7')](_0x9c75('0xe'),controller[_0x9c75('0xf')]);router[_0x9c75('0x7')](_0x9c75('0x10'),auth['isAuthenticated'](),controller[_0x9c75('0x11')]);router[_0x9c75('0x7')](_0x9c75('0x12'),auth['isAuthenticated'](),controller[_0x9c75('0x13')]);router[_0x9c75('0x7')]('/:id/queues',auth[_0x9c75('0x8')](),controller[_0x9c75('0x14')]);router[_0x9c75('0x7')](_0x9c75('0x15'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x16')]);router[_0x9c75('0x7')](_0x9c75('0x17'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x18')]);router['get'](_0x9c75('0x19'),auth[_0x9c75('0x8')](),controller['getRecordings']);router['get'](_0x9c75('0x1a'),auth['isAuthenticated'](),controller[_0x9c75('0x1b')]);router[_0x9c75('0x7')](_0x9c75('0x1c'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x1d')]);router[_0x9c75('0x7')](_0x9c75('0x1e'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x1f')]);router['get'](_0x9c75('0x20'),auth[_0x9c75('0x8')](),controller['getMailInteractions']);router[_0x9c75('0x7')]('/:id/sms/interactions',auth[_0x9c75('0x8')](),controller['getSmsInteractions']);router[_0x9c75('0x7')]('/:id/fax/interactions',auth[_0x9c75('0x8')](),controller['getFaxInteractions']);router[_0x9c75('0x7')](_0x9c75('0x21'),auth['isAuthenticated'](),controller[_0x9c75('0x22')]);router[_0x9c75('0x7')]('/:id/teams',auth[_0x9c75('0x8')](),controller[_0x9c75('0x23')]);router[_0x9c75('0x7')](_0x9c75('0x24'),auth['isAuthenticated'](),controller['getLists']);router[_0x9c75('0x7')](_0x9c75('0x25'),auth[_0x9c75('0x8')](),controller['getAgents']);router['get'](_0x9c75('0x26'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x27')]);router['get'](_0x9c75('0x28'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x29')]);router[_0x9c75('0x7')](_0x9c75('0x2a'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x2b')]);router[_0x9c75('0x7')](_0x9c75('0x2c'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x2d')]);router[_0x9c75('0x7')](_0x9c75('0x2e'),auth['isAuthenticated'](),controller[_0x9c75('0x2f')]);router[_0x9c75('0x7')](_0x9c75('0x30'),auth['isAuthenticated'](),controller[_0x9c75('0x31')]);router[_0x9c75('0x7')](_0x9c75('0x32'),auth[_0x9c75('0x8')](),controller['getWhatsappAccounts']);router[_0x9c75('0x7')](_0x9c75('0x33'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x34')]);router[_0x9c75('0x7')](_0x9c75('0x35'),auth['isAuthenticated'](),controller[_0x9c75('0x36')]);router[_0x9c75('0x37')](_0x9c75('0x12'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x38')]);router[_0x9c75('0x37')]('/',auth[_0x9c75('0x8')](),controller[_0x9c75('0x39')]);router[_0x9c75('0x37')](_0x9c75('0x3a'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x3b')]);router[_0x9c75('0x37')](_0x9c75('0x3c'),auth['isAuthenticated'](),controller[_0x9c75('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x242b36,_0x31442b,_0x5992d7){_0x5992d7(null,path[_0x9c75('0x3e')](config[_0x9c75('0x3f')],_0x9c75('0x40')));},'filename':function(_0xf794d2,_0x2c101b,_0x6c5649){_0x6c5649(null,util[_0x9c75('0x41')](_0x9c75('0x42'),Date[_0x9c75('0x43')](),_0x2c101b[_0x9c75('0x44')]));}})});router['post']('/:id/avatar',upload[_0x9c75('0x45')](_0x9c75('0x46')),controller[_0x9c75('0x47')]);router[_0x9c75('0x37')]('/:id/login',auth[_0x9c75('0x8')](),controller[_0x9c75('0x48')]);router[_0x9c75('0x37')](_0x9c75('0x49'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x4a')]);router['post'](_0x9c75('0x4b'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x4c')]);router[_0x9c75('0x37')](_0x9c75('0x4d'),auth[_0x9c75('0x8')](),controller['unpause']);router[_0x9c75('0x37')](_0x9c75('0x4e'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x4f')]);router[_0x9c75('0x37')](_0x9c75('0x50'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x51')]);router[_0x9c75('0x37')](_0x9c75('0x52'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x53')]);router[_0x9c75('0x37')](_0x9c75('0x54'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x55')]);router['post'](_0x9c75('0x56'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x57')]);router[_0x9c75('0x37')](_0x9c75('0x58'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x59')]);router['post']('/:id/whatsapp_interactions',auth[_0x9c75('0x8')](),controller[_0x9c75('0x5a')]);router[_0x9c75('0x37')](_0x9c75('0x28'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x5b')]);router[_0x9c75('0x37')](_0x9c75('0x2a'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x9c75('0x37')](_0x9c75('0x2c'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x5c')]);router['post'](_0x9c75('0x2e'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x5d')]);router['post'](_0x9c75('0x30'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x5e')]);router[_0x9c75('0x37')]('/:id/whatsapp_accounts',auth[_0x9c75('0x8')](),controller[_0x9c75('0x5f')]);router[_0x9c75('0x37')](_0x9c75('0x35'),auth[_0x9c75('0x8')](),controller['createApiKey']);router['put']('/:id',auth[_0x9c75('0x8')](),controller[_0x9c75('0x60')]);router[_0x9c75('0x61')](_0x9c75('0x62'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x63')]);router[_0x9c75('0x64')](_0x9c75('0x3c'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x65')]);router[_0x9c75('0x64')](_0x9c75('0x4e'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x66')]);router[_0x9c75('0x64')](_0x9c75('0xc'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x67')]);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x9c75('0x64')](_0x9c75('0x52'),auth[_0x9c75('0x8')](),controller['removeMailInteractions']);router[_0x9c75('0x64')](_0x9c75('0x54'),auth[_0x9c75('0x8')](),controller['removeFaxInteractions']);router[_0x9c75('0x64')](_0x9c75('0x56'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x68')]);router[_0x9c75('0x64')]('/:id/openchannel_interactions',auth[_0x9c75('0x8')](),controller[_0x9c75('0x69')]);router[_0x9c75('0x64')](_0x9c75('0x6a'),auth[_0x9c75('0x8')](),controller['removeWhatsappInteractions']);router['delete'](_0x9c75('0x28'),auth['isAuthenticated'](),controller[_0x9c75('0x6b')]);router['delete'](_0x9c75('0x2a'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x6c')]);router[_0x9c75('0x64')](_0x9c75('0x2c'),auth['isAuthenticated'](),controller[_0x9c75('0x6d')]);router[_0x9c75('0x64')](_0x9c75('0x2e'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x6e')]);router[_0x9c75('0x64')](_0x9c75('0x30'),auth['isAuthenticated'](),controller[_0x9c75('0x6f')]);router[_0x9c75('0x64')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x9c75('0x70')]);router['delete'](_0x9c75('0x35'),auth['isAuthenticated'](),controller[_0x9c75('0x71')]);router[_0x9c75('0x37')](_0x9c75('0x72'),auth[_0x9c75('0x8')](),controller[_0x9c75('0x73')]);module[_0x9c75('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c653639..512090f 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 _0x9b5a=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','TEXT','get','isArray','udp','encryption','avpf','force_avp','icesupport','dtlsverify','dtlscertfile','wss','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','setDataValue','name','fullname','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','agent','local','INTEGER','internal','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','user','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0xbd4746,_0x9ca2c8){var _0x2afcef=function(_0x5c6a0b){while(--_0x5c6a0b){_0xbd4746['push'](_0xbd4746['shift']());}};_0x2afcef(++_0x9ca2c8);}(_0x9b5a,0x194));var _0xa9b5=function(_0x10ec3c,_0xc507ad){_0x10ec3c=_0x10ec3c-0x0;var _0x21dd46=_0x9b5a[_0x10ec3c];return _0x21dd46;};'use strict';var Sequelize=require(_0xa9b5('0x0'));var moment=require(_0xa9b5('0x1'));var util=require('util');var _=require(_0xa9b5('0x2'));module[_0xa9b5('0x3')]={'name':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3854c5){this[_0xa9b5('0x5')](_0xa9b5('0x6'),_0x3854c5);this[_0xa9b5('0x5')]('defaultuser',_0x3854c5);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x49deef){this[_0xa9b5('0x5')](_0xa9b5('0x7'),_0x49deef);this[_0xa9b5('0x5')]('callerid',util[_0xa9b5('0x8')](_0xa9b5('0x9'),_0x49deef,this[_0xa9b5('0xa')]('internal')));}},'alias':{'type':Sequelize[_0xa9b5('0x4')]},'email':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':![],'unique':_0xa9b5('0xb'),'validate':{'isEmail':!![]},'set':function(_0x193ca8){if(_0x193ca8){this[_0xa9b5('0x5')](_0xa9b5('0xb'),_0x193ca8[_0xa9b5('0xc')]());}}},'role':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0xe'),'user',_0xa9b5('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa9b5('0x4')],'defaultValue':_0xa9b5('0x10')},'internal':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4608e4){this[_0xa9b5('0x5')](_0xa9b5('0x12'),_0x4608e4);this[_0xa9b5('0x5')](_0xa9b5('0x13'),_0x4608e4);this[_0xa9b5('0x5')](_0xa9b5('0x14'),util[_0xa9b5('0x8')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xa9b5('0x7')),_0x4608e4));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa9b5('0x4')]},'mobile':{'type':Sequelize[_0xa9b5('0x4')]},'address':{'type':Sequelize[_0xa9b5('0x4')]},'zipcode':{'type':Sequelize[_0xa9b5('0x4')]},'userpic':{'type':Sequelize[_0xa9b5('0x4')]},'city':{'type':Sequelize[_0xa9b5('0x4')]},'country':{'type':Sequelize[_0xa9b5('0x4')]},'online':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa9b5('0x16')]},'voicePause':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa9b5('0x4')],'defaultValue':_0xa9b5('0x17')},'lastPauseAt':{'type':Sequelize[_0xa9b5('0x16')]},'chatCapacity':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa9b5('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xa9b5('0x18'),_0xa9b5('0x19'),'peer'),'allowNull':!![],'defaultValue':_0xa9b5('0x18')},'context':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![],'defaultValue':_0xa9b5('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0xa9b5('0x1b'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xa9b5('0x1c'),_0xa9b5('0x1d'),'PROHIB_PASSED_SCREEN',_0xa9b5('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x18eedc){this[_0xa9b5('0x5')](_0xa9b5('0x1f'),_0x18eedc?_0x18eedc['join'](','):null);},'get':function(){return this[_0xa9b5('0xa')](_0xa9b5('0x1f'))?this[_0xa9b5('0xa')]('transport')[_0xa9b5('0x20')](','):null;},'comment':_0xa9b5('0x21')},'dtmfmode':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x22'),_0xa9b5('0x23'),_0xa9b5('0x24'),'inband',_0xa9b5('0x25')),'allowNull':!![],'defaultValue':_0xa9b5('0x22')},'directmedia':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no',_0xa9b5('0x27'),'update',_0xa9b5('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![],'defaultValue':_0xa9b5('0x29'),'set':function(_0x2365f2){this[_0xa9b5('0x5')](_0xa9b5('0x2a'),_0x2365f2?_0x2365f2[_0xa9b5('0x2b')](','):null);},'get':function(){return this['getDataValue'](_0xa9b5('0x2a'))?this[_0xa9b5('0xa')]('nat')[_0xa9b5('0x20')](','):null;},'comment':_0xa9b5('0x2c')},'callgroup':{'type':Sequelize[_0xa9b5('0x4')]},'namedcallgroup':{'type':Sequelize[_0xa9b5('0x4')]},'pickupgroup':{'type':Sequelize[_0xa9b5('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa9b5('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa9b5('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa9b5('0x2d')},'allow':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':![],'defaultValue':_0xa9b5('0x2e'),'set':function(_0x5cf1fc){this['setDataValue']('allow',_0x5cf1fc?_0x5cf1fc[_0xa9b5('0x2b')](';'):_0xa9b5('0x2e'));},'get':function(){return this[_0xa9b5('0xa')](_0xa9b5('0x2f'))?this[_0xa9b5('0xa')](_0xa9b5('0x2f'))['split'](';'):null;},'comment':_0xa9b5('0x30')},'autoframing':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![],'set':function(_0x3a91fc){this[_0xa9b5('0x5')](_0xa9b5('0x31'),_0x3a91fc?_0x3a91fc['join'](','):null);},'get':function(){return this[_0xa9b5('0xa')](_0xa9b5('0x31'))?this[_0xa9b5('0xa')](_0xa9b5('0x31'))[_0xa9b5('0x20')](','):null;},'comment':_0xa9b5('0x32')},'trustrpid':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa9b5('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa9b5('0x26'),'no',_0xa9b5('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa9b5('0x34')},'amaflags':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xa9b5('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no',_0xa9b5('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x36'),_0xa9b5('0x37'),_0xa9b5('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x39'),_0xa9b5('0x3a')),'allowNull':!![],'defaultValue':_0xa9b5('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xa9b5('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xa9b5('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa9b5('0xd')]('yes','no',_0xa9b5('0x3b'),_0xa9b5('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x3d'),_0xa9b5('0x3e'),_0xa9b5('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa9b5('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa9b5('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa9b5('0xd')](_0xa9b5('0x26'),'no',_0xa9b5('0x27'),_0xa9b5('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa9b5('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xa9b5('0x16')]},'passwordResetAt':{'type':Sequelize[_0xa9b5('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa9b5('0x41')]},'showWebBar':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0,'set':function(_0x3f8c47){this['setDataValue']('showWebBar',_0x3f8c47);var _0x26e436=this[_0xa9b5('0x42')]({'plain':!![]});switch(_0x3f8c47){case 0x0:case 0x1:var _0x416607=_0x26e436[_0xa9b5('0x1f')]?_[_0xa9b5('0x43')](_0x26e436[_0xa9b5('0x1f')])?_0x26e436[_0xa9b5('0x1f')][_0xa9b5('0x2b')]():_0x26e436['transport']:_0xa9b5('0x44');if(_0x416607==='wss'){_0x416607='udp';}this[_0xa9b5('0x5')](_0xa9b5('0x1f'),_0x416607);this[_0xa9b5('0x5')](_0xa9b5('0x45'),'no');this['setDataValue'](_0xa9b5('0x46'),null);this['setDataValue'](_0xa9b5('0x47'),null);this[_0xa9b5('0x5')](_0xa9b5('0x48'),null);this['setDataValue']('dtlsenable',null);this[_0xa9b5('0x5')](_0xa9b5('0x49'),null);this[_0xa9b5('0x5')]('dtlssetup',null);this[_0xa9b5('0x5')](_0xa9b5('0x4a'),null);this[_0xa9b5('0x5')]('dtlsprivatekey',null);this[_0xa9b5('0x5')]('rtcp_mux','no');break;case 0x2:this[_0xa9b5('0x5')](_0xa9b5('0x1f'),_0xa9b5('0x4b'));this['setDataValue']('encryption',_0xa9b5('0x26'));this[_0xa9b5('0x5')](_0xa9b5('0x46'),_0xa9b5('0x26'));this[_0xa9b5('0x5')]('force_avp',_0xa9b5('0x26'));this[_0xa9b5('0x5')](_0xa9b5('0x48'),_0xa9b5('0x26'));this[_0xa9b5('0x5')]('dtlsenable',_0xa9b5('0x26'));this[_0xa9b5('0x5')](_0xa9b5('0x49'),'no');this[_0xa9b5('0x5')]('dtlssetup',_0xa9b5('0x3f'));this[_0xa9b5('0x5')]('dtlscertfile',_0x26e436[_0xa9b5('0x4a')]||_0xa9b5('0x4c'));this[_0xa9b5('0x5')](_0xa9b5('0x4d'),_0x26e436[_0xa9b5('0x4d')]||_0xa9b5('0x4e'));this[_0xa9b5('0x5')](_0xa9b5('0x4f'),_0xa9b5('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0xa9b5('0x41')],'set':function(_0x2e6b7f){this['setDataValue'](_0xa9b5('0x50'),_0x2e6b7f?_0x2e6b7f['join'](','):[]);},'get':function(){return this['getDataValue'](_0xa9b5('0x50'))?_[_0xa9b5('0x51')](this[_0xa9b5('0xa')](_0xa9b5('0x50'))[_0xa9b5('0x20')](','),function(_0x3ba59e){return parseInt(_0x3ba59e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa9b5('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa9b5('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa9b5('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xa9b5('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa9b5('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa9b5('0x52')],'get':function(){return this[_0xa9b5('0xa')]('phoneBarEnableScreenRecordingByAgent')?this[_0xa9b5('0xa')](_0xa9b5('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa9b5('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa9b5('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![],'set':function(_0x57fa4d){if(typeof _0x57fa4d==='string'){var _0x17b4b1=_0x57fa4d==='1'?!![]:_0x57fa4d==='0'?![]:_0x57fa4d==='true'?!![]:_0x57fa4d===_0xa9b5('0x54')?![]:![];this[_0xa9b5('0x5')]('screenrecording',_0x17b4b1);}else{this[_0xa9b5('0x5')](_0xa9b5('0x55'),_0x57fa4d);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x318e01){this[_0xa9b5('0x5')](_0xa9b5('0x56'),_0x318e01);if(_0x318e01===!![]){this[_0xa9b5('0x5')](_0xa9b5('0x57'),moment());this[_0xa9b5('0x5')](_0xa9b5('0x58'),0x0);}else{this[_0xa9b5('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xa9b5('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa9b5('0x11')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xa9b5('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xdded=['dtlsprivatekey','rtcp_mux','icesupport','dtlsenable','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','sequelize','moment','util','lodash','STRING','name','setDataValue','fullname','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlscertfile'];(function(_0x59eef6,_0x120d63){var _0x3dc0f4=function(_0x1a898c){while(--_0x1a898c){_0x59eef6['push'](_0x59eef6['shift']());}};_0x3dc0f4(++_0x120d63);}(_0xdded,0x188));var _0xddde=function(_0x32fe4b,_0x5dde01){_0x32fe4b=_0x32fe4b-0x0;var _0x61c6e5=_0xdded[_0x32fe4b];return _0x61c6e5;};'use strict';var Sequelize=require(_0xddde('0x0'));var moment=require(_0xddde('0x1'));var util=require(_0xddde('0x2'));var _=require(_0xddde('0x3'));module['exports']={'name':{'type':Sequelize[_0xddde('0x4')],'allowNull':![],'unique':_0xddde('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4ffe41){this[_0xddde('0x6')](_0xddde('0x5'),_0x4ffe41);this['setDataValue']('defaultuser',_0x4ffe41);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56535a){this[_0xddde('0x6')](_0xddde('0x7'),_0x56535a);this[_0xddde('0x6')]('callerid',util[_0xddde('0x8')]('\x22%s\x22\x20<%s>',_0x56535a,this[_0xddde('0x9')](_0xddde('0xa'))));}},'alias':{'type':Sequelize[_0xddde('0x4')]},'email':{'type':Sequelize[_0xddde('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x532487){if(_0x532487){this[_0xddde('0x6')](_0xddde('0xb'),_0x532487[_0xddde('0xc')]());}}},'role':{'type':Sequelize[_0xddde('0xd')](_0xddde('0xe'),_0xddde('0xf'),_0xddde('0x10'),_0xddde('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xddde('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xddde('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':![],'unique':_0xddde('0xa'),'set':function(_0x5d31eb){this[_0xddde('0x6')](_0xddde('0xa'),_0x5d31eb);this[_0xddde('0x6')](_0xddde('0x13'),_0x5d31eb);this[_0xddde('0x6')]('callerid',util['format']('\x22%s\x22\x20<%s>',this['getDataValue'](_0xddde('0x7')),_0x5d31eb));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xddde('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xddde('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xddde('0x4')]},'city':{'type':Sequelize[_0xddde('0x4')]},'country':{'type':Sequelize[_0xddde('0x4')]},'online':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xddde('0x15')]},'voicePause':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xddde('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xddde('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xddde('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xddde('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xddde('0xd')]('friend',_0xddde('0xf'),_0xddde('0x16')),'allowNull':!![],'defaultValue':_0xddde('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xddde('0x18')},'callingpres':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x19'),_0xddde('0x1a'),_0xddde('0x1b'),_0xddde('0x1c'),_0xddde('0x1d'),_0xddde('0x1e'),_0xddde('0x1f'),_0xddde('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3b70fd){this[_0xddde('0x6')](_0xddde('0x21'),_0x3b70fd?_0x3b70fd[_0xddde('0x22')](','):null);},'get':function(){return this[_0xddde('0x9')]('transport')?this[_0xddde('0x9')](_0xddde('0x21'))[_0xddde('0x23')](','):null;},'comment':_0xddde('0x24')},'dtmfmode':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x25'),_0xddde('0x26'),_0xddde('0x27'),_0xddde('0x28'),_0xddde('0x29')),'allowNull':!![],'defaultValue':_0xddde('0x25')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xddde('0x2a'),_0xddde('0x2b'),_0xddde('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x171df4){this[_0xddde('0x6')](_0xddde('0x2d'),_0x171df4?_0x171df4['join'](','):null);},'get':function(){return this[_0xddde('0x9')]('nat')?this[_0xddde('0x9')]('nat')[_0xddde('0x23')](','):null;},'comment':_0xddde('0x2e')},'callgroup':{'type':Sequelize[_0xddde('0x4')]},'namedcallgroup':{'type':Sequelize[_0xddde('0x4')]},'pickupgroup':{'type':Sequelize[_0xddde('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xddde('0x4')]},'language':{'type':Sequelize[_0xddde('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xddde('0x4')]},'disallow':{'type':Sequelize[_0xddde('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xddde('0x4')],'allowNull':![],'defaultValue':_0xddde('0x2f'),'set':function(_0x4b36e2){this[_0xddde('0x6')](_0xddde('0x30'),_0x4b36e2?_0x4b36e2[_0xddde('0x22')](';'):_0xddde('0x2f'));},'get':function(){return this['getDataValue'](_0xddde('0x30'))?this['getDataValue'](_0xddde('0x30'))['split'](';'):null;},'comment':_0xddde('0x31')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x360587){this[_0xddde('0x6')](_0xddde('0x32'),_0x360587?_0x360587['join'](','):null);},'get':function(){return this[_0xddde('0x9')](_0xddde('0x32'))?this['getDataValue'](_0xddde('0x32'))[_0xddde('0x23')](','):null;},'comment':_0xddde('0x33')},'trustrpid':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no',_0xddde('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xddde('0x34'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![],'defaultValue':_0xddde('0x36')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xddde('0x34'),'no'),'allowNull':!![],'defaultValue':_0xddde('0x34')},'busylevel':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no',_0xddde('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xddde('0xd')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xddde('0x38'),_0xddde('0x39'),_0xddde('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x3b'),_0xddde('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![],'defaultValue':_0xddde('0x34')},'keepalive':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xddde('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xddde('0x34'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xddde('0xd')]('yes','no',_0xddde('0x3d'),_0xddde('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x3f'),_0xddde('0x40'),_0xddde('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xddde('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xddde('0x34'),'no',_0xddde('0x2a'),'update',_0xddde('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xddde('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xddde('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0,'set':function(_0x20c679){this[_0xddde('0x6')](_0xddde('0x43'),_0x20c679);var _0xe056d1=this[_0xddde('0x44')]({'plain':!![]});switch(_0x20c679){case 0x0:case 0x1:var _0x329a00=_0xe056d1[_0xddde('0x21')]?_[_0xddde('0x45')](_0xe056d1['transport'])?_0xe056d1[_0xddde('0x21')][_0xddde('0x22')]():_0xe056d1['transport']:_0xddde('0x46');if(_0x329a00===_0xddde('0x47')){_0x329a00=_0xddde('0x46');}this[_0xddde('0x6')](_0xddde('0x21'),_0x329a00);this[_0xddde('0x6')](_0xddde('0x48'),'no');this['setDataValue'](_0xddde('0x49'),null);this[_0xddde('0x6')](_0xddde('0x4a'),null);this[_0xddde('0x6')]('icesupport',null);this[_0xddde('0x6')]('dtlsenable',null);this['setDataValue'](_0xddde('0x4b'),null);this[_0xddde('0x6')](_0xddde('0x4c'),null);this[_0xddde('0x6')](_0xddde('0x4d'),null);this[_0xddde('0x6')](_0xddde('0x4e'),null);this[_0xddde('0x6')](_0xddde('0x4f'),'no');break;case 0x2:this[_0xddde('0x6')](_0xddde('0x21'),_0xddde('0x47'));this['setDataValue']('encryption',_0xddde('0x34'));this[_0xddde('0x6')](_0xddde('0x49'),_0xddde('0x34'));this[_0xddde('0x6')]('force_avp',_0xddde('0x34'));this[_0xddde('0x6')](_0xddde('0x50'),'yes');this[_0xddde('0x6')](_0xddde('0x51'),'yes');this['setDataValue']('dtlsverify','no');this[_0xddde('0x6')](_0xddde('0x4c'),_0xddde('0x41'));this[_0xddde('0x6')](_0xddde('0x4d'),_0xe056d1[_0xddde('0x4d')]||'/etc/pki/tls/certs/motion.crt');this[_0xddde('0x6')]('dtlsprivatekey',_0xe056d1[_0xddde('0x4e')]||_0xddde('0x52'));this[_0xddde('0x6')](_0xddde('0x4f'),_0xddde('0x34'));break;default:}}},'permissions':{'type':Sequelize[_0xddde('0x53')],'set':function(_0x23bc87){this[_0xddde('0x6')]('permissions',_0x23bc87?_0x23bc87[_0xddde('0x22')](','):[]);},'get':function(){return this['getDataValue'](_0xddde('0x54'))?_[_0xddde('0x55')](this[_0xddde('0x9')](_0xddde('0x54'))[_0xddde('0x23')](','),function(_0x5af63b){return parseInt(_0x5af63b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xddde('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xddde('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xddde('0xd')](_0xddde('0x34'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xddde('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xddde('0x56')],'get':function(){return this['getDataValue'](_0xddde('0x57'))?this[_0xddde('0x9')](_0xddde('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xddde('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xddde('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2c41d1){if(typeof _0x2c41d1===_0xddde('0x58')){var _0x2accf5=_0x2c41d1==='1'?!![]:_0x2c41d1==='0'?![]:_0x2c41d1===_0xddde('0x59')?!![]:_0x2c41d1===_0xddde('0x5a')?![]:![];this[_0xddde('0x6')](_0xddde('0x5b'),_0x2accf5);}else{this[_0xddde('0x6')](_0xddde('0x5b'),_0x2c41d1);}}},'blocked':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![],'set':function(_0x4e8692){this['setDataValue'](_0xddde('0x5c'),_0x4e8692);if(_0x4e8692===!![]){this[_0xddde('0x6')]('blockedAt',moment());this[_0xddde('0x6')](_0xddde('0x5d'),0x0);}else{this[_0xddde('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xddde('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xddde('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xddde('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xddde('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xddde('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xddde('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9fe9d0c..dbc0d20 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 _0x03f0=['server/files/images/logos/default_profile.png','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','tag','model','keys','Queue','filters','intersection','fields','order','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','x-forwarded-for','connection','remoteAddress','socket','UserVoiceQueueRt','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','bulkCreate','LOGININPAUSE','isMiddleware','resolve','logout','online','QueuePause','pause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getLists','values','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','inbound','flatten','toString','lower','col','desc','asc','orderBy','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','ui.','field','ui.createdAt','user_has_','_interactions','messengerSoundNotification','enabled','moment','util','path','lodash','squel','jayson/promise','../../components/contacts','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APIForbiddenrror','handleError','../../mysqldb','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','role','emit','destroy','get','admin','Users','Agents','agent','telephone','filter','ignore','map','value','includes','find','UserProfileResource','name','send','User','rawAttributes','fieldName','key','password','previousPasswords','resetPasswordToken','resetPasswordExpires','where','query','includeAll','include','userSetting','UserSetting','attributes','push','findAll','openTabs','length','rows','dataValues','sms','fax','mail','openchannel','whatsapp','all','params','getOptions','true','merge','options','chat','update','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','internal','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)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','103','113','110','105','106','107','108','100','115','user','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','create','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','addQueues','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','Queues','penalty','spread','toLowerCase','QueueId','capitalize','Queue:save','VoiceQueue','SIP/%s','channel','isArray','Queue:remove','voice','addAvatar','userpic','file','filename','join','root'];(function(_0x2e6404,_0x4a5906){var _0x2f4a4d=function(_0x35a9f8){while(--_0x35a9f8){_0x2e6404['push'](_0x2e6404['shift']());}};_0x2f4a4d(++_0x4a5906);}(_0x03f0,0xce));var _0x003f=function(_0x1baaac,_0x2e31e6){_0x1baaac=_0x1baaac-0x0;var _0x4e05ea=_0x03f0[_0x1baaac];return _0x4e05ea;};'use strict';var moment=require(_0x003f('0x0'));var util=require(_0x003f('0x1'));var path=require(_0x003f('0x2'));var fs=require('fs');var _=require(_0x003f('0x3'));var squel=require(_0x003f('0x4'));var Redis=require('ioredis');var jayson=require(_0x003f('0x5'));var authService=require('../../components/auth/service');var contacts=require(_0x003f('0x6'));var qs=require('../../components/parsers/qs');var rta=require('../../components/realtime/agents');var logger=require(_0x003f('0x7'))(_0x003f('0x8'));var utils=require('../../config/utils');var config=require(_0x003f('0x9'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x003f('0xa'))[_0x003f('0xb')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIForbiddenError=require('../../errors/api')[_0x003f('0xc')];var APIHandleError=require(_0x003f('0xa'))[_0x003f('0xd')];var db=require(_0x003f('0xe'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x003f('0xf')]));require(_0x003f('0x10'))[_0x003f('0x11')](socket);config[_0x003f('0xf')]=_[_0x003f('0x12')](config[_0x003f('0xf')],{'host':_0x003f('0x13'),'port':0x18eb});var amiClient=jayson[_0x003f('0x14')][_0x003f('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x43b94e,_0x491b1e){_0x491b1e=_0x491b1e||0xcc;return function(_0x3091ee){if(_0x3091ee){return _0x43b94e[_0x003f('0x16')](_0x491b1e);}return _0x43b94e[_0x003f('0x17')](_0x491b1e)[_0x003f('0x18')]();};}function respondWithResult(_0x3773d4,_0x11097a){_0x11097a=_0x11097a||0xc8;return function(_0x535afd){if(_0x535afd){return _0x3773d4[_0x003f('0x17')](_0x11097a)[_0x003f('0x19')](_0x535afd);}};}function respondWithFilteredResult(_0x24d637,_0x29b60b){return function(_0x51a14a){if(_0x51a14a){var _0x3e46db=typeof _0x29b60b['offset']===_0x003f('0x1a')&&typeof _0x29b60b['limit']==='undefined';var _0x53a027=_0x51a14a[_0x003f('0x1b')];var _0x3c18fd=_0x3e46db?0x0:_0x29b60b[_0x003f('0x1c')];var _0x33c0b3=_0x3e46db?_0x51a14a[_0x003f('0x1b')]:_0x29b60b[_0x003f('0x1c')]+_0x29b60b[_0x003f('0x1d')];var _0x1c5e65;if(_0x33c0b3>=_0x53a027){_0x33c0b3=_0x53a027;_0x1c5e65=0xc8;}else{_0x1c5e65=0xce;}_0x24d637[_0x003f('0x17')](_0x1c5e65);return _0x24d637['set'](_0x003f('0x1e'),_0x3c18fd+'-'+_0x33c0b3+'/'+_0x53a027)['json'](_0x51a14a);}return null;};}function respondWithRpcPromise(_0x4f921b,_0x298493,_0x18ba8a,_0x562f33){return new Promise(function(_0x62ebb5,_0x285ba3){var _0x2d7c25=_0x562f33||amiClient;return _0x2d7c25[_0x003f('0x1f')](_0x4f921b,_0x18ba8a)[_0x003f('0x20')](function(_0x2d68d4){logger[_0x003f('0x21')](_0x003f('0x22'),_0x298493,_0x003f('0x23'));logger[_0x003f('0x24')](_0x003f('0x25'),_0x298493,_0x003f('0x23'),JSON[_0x003f('0x26')](_0x2d68d4));if(_0x2d68d4[_0x003f('0x27')]){if(_0x2d68d4[_0x003f('0x27')][_0x003f('0x28')]===0x1f4){logger[_0x003f('0x27')](_0x003f('0x22'),_0x298493,_0x2d68d4['error'][_0x003f('0x29')]);return _0x285ba3(_0x2d68d4[_0x003f('0x27')]['message']);}logger[_0x003f('0x27')](_0x003f('0x22'),_0x298493,_0x2d68d4['error'][_0x003f('0x29')]);return _0x62ebb5(_0x2d68d4[_0x003f('0x27')][_0x003f('0x29')]);}else{logger[_0x003f('0x21')](_0x003f('0x22'),_0x298493,'request\x20sent');_0x62ebb5(_0x2d68d4[_0x003f('0x2a')][_0x003f('0x29')]);}})[_0x003f('0x2b')](function(_0x9b124d){logger[_0x003f('0x27')]('User,\x20%s,\x20%s',_0x298493,_0x9b124d);_0x285ba3(_0x9b124d);});});}function saveUpdates(_0x2813b3){return function(_0x5ef1c6){if(_0x5ef1c6){return _0x5ef1c6['update'](_0x2813b3)[_0x003f('0x20')](function(_0x386f1f){if(_0x386f1f[_0x003f('0x2c')]==='agent'){socket[_0x003f('0x2d')]('userNotification:recalc:'+_0x386f1f['id'],_0x386f1f);}return _0x386f1f;});}return null;};}function removeEntity(_0x3cfcfa,_0x29da28){return function(_0xc295cc){if(_0xc295cc){return _0xc295cc[_0x003f('0x2e')]({'transaction':_0x29da28})[_0x003f('0x20')](function(){var _0x2652a1=_0xc295cc[_0x003f('0x2f')]({'plain':!![]});if(_0x2652a1[_0x003f('0x2c')]===_0x003f('0x30'))return;var _0x17a45b=[{'name':_0x003f('0x31'),'value':'user','ignore':!![]},{'name':_0x003f('0x32'),'value':_0x003f('0x33'),'ignore':![]},{'name':'Telephones','value':_0x003f('0x34'),'ignore':![]}];var _0x359797=_(_0x17a45b)[_0x003f('0x35')](_0x003f('0x36'))[_0x003f('0x37')](_0x003f('0x38'))[_0x003f('0x38')]();if(_[_0x003f('0x39')](_0x359797,_0x2652a1['role'])){return;}var _0x6e9ae1=_[_0x003f('0x3a')](_0x17a45b,[_0x003f('0x38'),_0x2652a1[_0x003f('0x2c')]])['name'];return db[_0x003f('0x3b')][_0x003f('0x2e')]({'where':{'type':_0x6e9ae1,'resourceId':_0x2652a1['id']},'transaction':_0x29da28})['then'](function(){return _0xc295cc;});})[_0x003f('0x20')](function(){_0x3cfcfa['status'](0xcc)[_0x003f('0x18')]();});}};}function handleEntityNotFound(_0x492530){return function(_0xe47e71){if(!_0xe47e71){_0x492530[_0x003f('0x16')](0x194);}return _0xe47e71;};}function handleError(_0x594e30,_0x254db3){_0x254db3=_0x254db3||0x1f4;return function(_0x236c64){logger[_0x003f('0x27')](_0x236c64['stack']);if(_0x236c64[_0x003f('0x3c')]){delete _0x236c64[_0x003f('0x3c')];}_0x594e30[_0x003f('0x17')](_0x254db3)[_0x003f('0x3d')](_0x236c64);};}function getUserAttributes(){return _(db[_0x003f('0x3e')][_0x003f('0x3f')])[_0x003f('0x37')](function(_0x42a323){return{'name':_0x42a323[_0x003f('0x40')],'type':_0x42a323['type'][_0x003f('0x41')]};})[_0x003f('0x35')](function(_0x46716f){return![_0x003f('0x42'),'salt',_0x003f('0x43'),_0x003f('0x44'),_0x003f('0x45'),'md5secret'][_0x003f('0x39')](_0x46716f[_0x003f('0x3c')]);})[_0x003f('0x38')]();}exports['index']=function(_0x1be149,_0x15c8df){var _0x42e8c9={},_0x19fdb1={'count':0x0,'rows':[]};var _0x1b8074=getUserAttributes();_0x42e8c9=qs['getOptions'](_0x1b8074,_0x1be149);var _0xe9f5f6={'where':_0x42e8c9[_0x003f('0x46')]};return db[_0x003f('0x3e')]['count'](_0xe9f5f6)[_0x003f('0x20')](function(_0x38e0af){_0x19fdb1['count']=_0x38e0af;if(_0x1be149[_0x003f('0x47')][_0x003f('0x48')]){_0x42e8c9[_0x003f('0x49')]=[{'all':!![]}];}if(_0x1be149[_0x003f('0x47')][_0x003f('0x4a')]==='true'){_0x42e8c9['include']=[{'model':db[_0x003f('0x4b')],'as':_0x003f('0x4a')}];}if(!_['includes'](_0x42e8c9[_0x003f('0x4c')],'id')){_0x42e8c9['attributes'][_0x003f('0x4d')]('id');}return db[_0x003f('0x3e')][_0x003f('0x4e')](_0x42e8c9);})[_0x003f('0x20')](function(_0x2a18ef){_0x19fdb1['rows']=_0x2a18ef;if(_0x1be149[_0x003f('0x47')][_0x003f('0x4f')]==='true'){var _0x52906c=[];for(var _0x44592b=0x0;_0x44592b<_0x19fdb1['rows'][_0x003f('0x50')];_0x44592b++){_0x52906c[_0x003f('0x4d')](get_open_tabs('chat',_0x19fdb1[_0x003f('0x51')][_0x44592b][_0x003f('0x52')]));_0x52906c['push'](get_open_tabs(_0x003f('0x53'),_0x19fdb1[_0x003f('0x51')][_0x44592b]['dataValues']));_0x52906c[_0x003f('0x4d')](get_open_tabs(_0x003f('0x54'),_0x19fdb1[_0x003f('0x51')][_0x44592b][_0x003f('0x52')]));_0x52906c['push'](get_open_tabs(_0x003f('0x55'),_0x19fdb1[_0x003f('0x51')][_0x44592b][_0x003f('0x52')]));_0x52906c[_0x003f('0x4d')](get_open_tabs(_0x003f('0x56'),_0x19fdb1['rows'][_0x44592b][_0x003f('0x52')]));_0x52906c['push'](get_open_tabs(_0x003f('0x57'),_0x19fdb1[_0x003f('0x51')][_0x44592b][_0x003f('0x52')]));}return Promise[_0x003f('0x58')](_0x52906c)[_0x003f('0x20')](function(){return _0x19fdb1;});}else{return _0x19fdb1;}})[_0x003f('0x20')](respondWithFilteredResult(_0x15c8df,_0x42e8c9))['catch'](handleError(_0x15c8df,null));};exports['show']=function(_0x1cfba6,_0x3a14ed){var _0x2f17d0=getUserAttributes();_0x1cfba6[_0x003f('0x47')]['id']=_0x1cfba6[_0x003f('0x59')]['id'];var _0x114c65=qs[_0x003f('0x5a')](_0x2f17d0,_0x1cfba6);if(_0x1cfba6[_0x003f('0x47')][_0x003f('0x48')]){_0x114c65['include']=[{'all':!![]}];}if(_0x1cfba6[_0x003f('0x47')]['userSetting']===_0x003f('0x5b')){_0x114c65[_0x003f('0x49')]=[{'model':db[_0x003f('0x4b')],'as':'userSetting'}];}_0x114c65=_[_0x003f('0x5c')]({},_0x114c65,_0x1cfba6[_0x003f('0x5d')]);if(!_[_0x003f('0x39')](_0x114c65['attributes'],'id')){_0x114c65[_0x003f('0x4c')][_0x003f('0x4d')]('id');}return db[_0x003f('0x3e')][_0x003f('0x3a')](_0x114c65)['then'](handleEntityNotFound(_0x3a14ed,null))['then'](function(_0x1e0685){var _0x3bc6b4=[];values=_0x1e0685;if(_0x1cfba6[_0x003f('0x47')][_0x003f('0x4f')]===_0x003f('0x5b')){_0x3bc6b4['push'](get_open_tabs(_0x003f('0x5e'),_0x1e0685[_0x003f('0x52')]));_0x3bc6b4['push'](get_open_tabs(_0x003f('0x53'),_0x1e0685[_0x003f('0x52')]));_0x3bc6b4[_0x003f('0x4d')](get_open_tabs(_0x003f('0x56'),_0x1e0685[_0x003f('0x52')]));_0x3bc6b4[_0x003f('0x4d')](get_open_tabs('whatsapp',_0x1e0685[_0x003f('0x52')]));_0x3bc6b4[_0x003f('0x4d')](get_open_tabs(_0x003f('0x54'),_0x1e0685[_0x003f('0x52')]));_0x3bc6b4[_0x003f('0x4d')](get_open_tabs(_0x003f('0x55'),_0x1e0685['dataValues']));return Promise[_0x003f('0x58')](_0x3bc6b4);}else{return values;}})[_0x003f('0x20')](function(){return values;})[_0x003f('0x20')](respondWithResult(_0x3a14ed,null))[_0x003f('0x2b')](handleError(_0x3a14ed,null));};exports[_0x003f('0x5f')]=function(_0x5554fb,_0x28289c){if(_0x5554fb['body']['id']){delete _0x5554fb[_0x003f('0x60')]['id'];}delete _0x5554fb[_0x003f('0x60')]['role'];return db[_0x003f('0x3e')][_0x003f('0x3a')]({'where':{'id':_0x5554fb['params']['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x28289c,null))['then'](saveUpdates(_0x5554fb[_0x003f('0x60')],null))['then'](respondWithResult(_0x28289c,null))['catch'](handleError(_0x28289c,null));};exports[_0x003f('0x61')]=function(_0x518d83,_0x2ef4d8){return db['User']['describe']()[_0x003f('0x20')](respondWithResult(_0x2ef4d8,null))[_0x003f('0x2b')](handleError(_0x2ef4d8,null));};exports['addContacts']=function(_0x1c6ccc,_0x4fda92){return db['User']['find']({'where':{'id':_0x1c6ccc[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x4fda92,null))[_0x003f('0x20')](function(_0x56aa37){if(_0x56aa37){return _0x56aa37[_0x003f('0x62')](_0x1c6ccc[_0x003f('0x60')][_0x003f('0x63')],_[_0x003f('0x64')](_0x1c6ccc[_0x003f('0x60')],[_0x003f('0x63'),'id'])||{});}})[_0x003f('0x20')](respondWithResult(_0x4fda92,null))[_0x003f('0x2b')](handleError(_0x4fda92,null));};function validateUser(_0x2b0c8b){return new Promise(function(_0x71d06,_0x48fb0f){if(_0x2b0c8b['internal'])return _0x71d06(_0x2b0c8b);return db[_0x003f('0x65')][_0x003f('0x66')](0x1)[_0x003f('0x20')](function(_0xadd4f2){if(_0xadd4f2[_0x003f('0x67')])authService[_0x003f('0x68')](_0x2b0c8b[_0x003f('0x42')]);db[_0x003f('0x3e')][_0x003f('0x69')](_0x003f('0x6a'))[_0x003f('0x20')](function(_0x537642){if(_['isNil'](_0x537642)){_0x2b0c8b['internal']=_0xadd4f2['min_internal']||0x1;return;}if(_[_0x003f('0x6b')](_0xadd4f2[_0x003f('0x6c')])||_0xadd4f2[_0x003f('0x6c')]===_0x537642){_0x2b0c8b[_0x003f('0x6a')]=_0x537642+0x1;return;}if(_0xadd4f2[_0x003f('0x6c')]>_0x537642){_0x2b0c8b['internal']=_0xadd4f2['min_internal'];return;}return db[_0x003f('0x6d')]['query'](_0x003f('0x6e'),{'type':db[_0x003f('0x6d')]['QueryTypes'][_0x003f('0x6f')]})[_0x003f('0x20')](function(_0x477730){if(_0x477730&&_0x477730[_0x003f('0x50')]){for(var _0x333255=0x0,_0x1e4809=_0x477730[_0x003f('0x50')];_0x333255<_0x1e4809&&_[_0x003f('0x6b')](_0x2b0c8b[_0x003f('0x6a')]);_0x333255++){if(_0xadd4f2['min_internal']<=_0x477730[_0x333255][_0x003f('0x70')]){_0x2b0c8b['internal']=_0x477730[_0x333255][_0x003f('0x70')];}else if(_0xadd4f2[_0x003f('0x6c')]>_0x477730[_0x333255][_0x003f('0x70')]&&_0xadd4f2[_0x003f('0x6c')]<=_0x477730[_0x333255]['to']){_0x2b0c8b['internal']=_0xadd4f2[_0x003f('0x6c')];}}}if(_[_0x003f('0x6b')](_0x2b0c8b[_0x003f('0x6a')])){_0x2b0c8b[_0x003f('0x6a')]=_0x537642+0x1;}return _0x71d06(_0x2b0c8b);});});})[_0x003f('0x2b')](function(_0x3c54f7){_0x48fb0f(_0x3c54f7);});});}function updateUser(_0xfba546){return new Promise(function(_0x534846,_0x14bdf8){try{if(_0xfba546[_0x003f('0x71')]){_0xfba546[_0x003f('0x72')]=_0xfba546['internal'];_0xfba546[_0x003f('0x73')]={'mailbox':_0xfba546[_0x003f('0x6a')],'password':_0xfba546[_0x003f('0x42')],'fullname':_0xfba546[_0x003f('0x74')],'email':_0xfba546['email']};}if(_0xfba546[_0x003f('0x2c')]===_0x003f('0x33')){if(!_0xfba546['permissions'])_0xfba546[_0x003f('0x75')]=[_0x003f('0x76'),'102',_0x003f('0x77'),_0x003f('0x78'),_0x003f('0x79'),'104',_0x003f('0x7a'),_0x003f('0x7b'),_0x003f('0x7c'),_0x003f('0x7d'),'109',_0x003f('0x7e'),'111','114',_0x003f('0x7f')];}_0x534846(_0xfba546);}catch(_0x100376){_0x14bdf8(_0x100376);}});}exports['create']=function(_0x2559fc,_0x584dcf){if(_0x2559fc['user'][_0x003f('0x2c')]===_0x003f('0x33'))throw new Error('Unauthorized');if(_0x2559fc[_0x003f('0x60')][_0x003f('0x2c')]===_0x003f('0x80')&&_0x2559fc[_0x003f('0x80')]['role']!=='admin'){throw new Error(_0x003f('0x81'));}if(_0x2559fc[_0x003f('0x60')][_0x003f('0x2c')]===_0x003f('0x30')&&_0x2559fc[_0x003f('0x80')][_0x003f('0x2c')]!==_0x003f('0x30')){throw new Error(_0x003f('0x82'));}return licenseUtil[_0x003f('0x83')]([_0x2559fc[_0x003f('0x60')]])[_0x003f('0x20')](function(){return validateUser(_0x2559fc[_0x003f('0x60')]);})[_0x003f('0x20')](function(_0x180a90){return updateUser(_0x180a90)[_0x003f('0x20')](function(_0x28b4e1){if(_0x28b4e1['role']==='admin'){_0x28b4e1[_0x003f('0x84')]=_0x2559fc[_0x003f('0x80')][_0x003f('0x84')];delete _0x28b4e1[_0x003f('0x85')];}return _0x28b4e1;});})[_0x003f('0x20')](function(_0x9892e2){return db[_0x003f('0x3e')][_0x003f('0x86')](_0x9892e2,{'include':[{'model':db[_0x003f('0x73')],'as':_0x003f('0x73')}]});})[_0x003f('0x20')](function(_0x5362c9){if(_0x2559fc[_0x003f('0x60')][_0x003f('0x2c')]===_0x003f('0x80'))return _0x5362c9;if(_0x2559fc[_0x003f('0x80')]['role']!==_0x003f('0x80'))return _0x5362c9;return db[_0x003f('0x87')][_0x003f('0x3a')]({'where':{'name':_0x5362c9['role']===_0x003f('0x33')?_0x003f('0x32'):_0x003f('0x88'),'userProfileId':_0x2559fc[_0x003f('0x80')][_0x003f('0x85')]},'raw':!![]})[_0x003f('0x20')](function(_0x15b16e){if(!_0x15b16e||_0x15b16e[_0x003f('0x89')]!=0x0)return _0x5362c9;return db[_0x003f('0x3b')][_0x003f('0x86')]({'name':_0x5362c9[_0x003f('0x3c')],'resourceId':_0x5362c9['id'],'type':_0x15b16e['name'],'sectionId':_0x15b16e['id']},{})['then'](function(){return _0x5362c9;});})[_0x003f('0x2b')](function(_0x28bc44){logger[_0x003f('0x27')](_0x003f('0x8a'),_0x28bc44);throw _0x28bc44;});})[_0x003f('0x20')](respondWithResult(_0x584dcf,0xc9))[_0x003f('0x2b')](handleError(_0x584dcf,null));};exports['bulkCreate']=function(_0x43d29e,_0x573cda){var _0x2ab8a3=_0x43d29e['body'];var _0x3351da=[];if(_0x43d29e[_0x003f('0x80')][_0x003f('0x2c')]===_0x003f('0x33'))throw new Error(_0x003f('0x8b'));if(_['some'](_0x2ab8a3,['role',_0x003f('0x80')])&&_0x43d29e[_0x003f('0x80')]['role']!==_0x003f('0x30')){throw new Error(_0x003f('0x81'));}if(_[_0x003f('0x8c')](_0x2ab8a3,[_0x003f('0x2c'),_0x003f('0x30')])&&_0x43d29e[_0x003f('0x80')][_0x003f('0x2c')]!==_0x003f('0x30')){throw new Error(_0x003f('0x8d'));}return licenseUtil['checkUserLimits'](_0x2ab8a3)[_0x003f('0x20')](function(){return validateUser(_0x2ab8a3[0x0]);})[_0x003f('0x20')](function(){for(var _0x33e42f=0x1;_0x33e42f<_0x2ab8a3['length'];_0x33e42f++){var _0x285f8e=_0x2ab8a3[_0x33e42f-0x1][_0x003f('0x6a')];if(!_0x2ab8a3[_0x33e42f]['internal'])_0x2ab8a3[_0x33e42f]['internal']=_0x285f8e+0x1;_0x3351da[_0x003f('0x4d')](validateUser(_0x2ab8a3[_0x33e42f]));}return Promise[_0x003f('0x58')](_0x3351da);})[_0x003f('0x20')](function(){_0x3351da=[];for(var _0x10a36c=0x0;_0x10a36c<_0x2ab8a3['length'];_0x10a36c++){_0x3351da[_0x003f('0x4d')](updateUser(_0x2ab8a3[_0x10a36c]));}return Promise[_0x003f('0x58')](_0x3351da);})[_0x003f('0x20')](function(){_0x3351da=_0x2ab8a3[_0x003f('0x37')](function(_0x3b8f07){return db[_0x003f('0x3e')][_0x003f('0x86')](_0x3b8f07,{'include':[{'model':db[_0x003f('0x73')],'as':'VoiceMail'}]})[_0x003f('0x20')](function(_0x2c341a){_0x3b8f07['id']=_0x2c341a['id'];return _0x3b8f07;});});return Promise[_0x003f('0x58')](_0x3351da);})[_0x003f('0x20')](function(_0x445b67){if(_0x43d29e['body'][_0x003f('0x2c')]==='user')return _0x445b67;if(_0x43d29e[_0x003f('0x80')][_0x003f('0x2c')]!==_0x003f('0x80'))return _0x445b67;var _0x43ead5=_[_0x003f('0x8c')](_0x445b67,function(_0x35e0ae){return _0x35e0ae[_0x003f('0x2c')]==='agent'||_0x35e0ae[_0x003f('0x2c')]===_0x003f('0x34');});if(!_0x43ead5)return _0x445b67;return db[_0x003f('0x87')]['findAll']({'where':{'name':{'$or':[_0x003f('0x32'),_0x003f('0x88')]},'userProfileId':_0x43d29e[_0x003f('0x80')][_0x003f('0x85')]},'raw':!![]})[_0x003f('0x20')](function(_0xc0b9a4){if(_[_0x003f('0x8e')](_0xc0b9a4)||!_[_0x003f('0x8c')](_0xc0b9a4,[_0x003f('0x89'),0x0]))return _0x445b67;_0x3351da=[];var _0x27af53=_(_0xc0b9a4)[_0x003f('0x37')](function(_0xb9a9b0){if(_0xb9a9b0[_0x003f('0x89')]===0x1)return;return _0xb9a9b0['name']===_0x003f('0x32')?'agent':'telephone';})[_0x003f('0x8f')]()[_0x003f('0x38')]();for(var _0x114ecc=0x0;_0x114ecc<_0x445b67['length'];_0x114ecc++){if(!_[_0x003f('0x39')](_0x27af53,_0x445b67[_0x114ecc][_0x003f('0x2c')]))return;var _0x471232=_0x445b67[_0x114ecc][_0x003f('0x2c')]===_0x003f('0x33')?'Agents':_0x003f('0x88');_0x3351da[_0x003f('0x4d')](db[_0x003f('0x3b')][_0x003f('0x86')]({'name':_0x445b67[_0x114ecc][_0x003f('0x3c')],'resourceId':_0x445b67[_0x114ecc]['id'],'type':_0x471232,'sectionId':_[_0x003f('0x3a')](_0xc0b9a4,['name',_0x471232])['id']},{}));}return Promise[_0x003f('0x58')](_0x3351da);});})['then'](respondWithResult(_0x573cda,0xc9))['catch'](handleError(_0x573cda,null));};exports[_0x003f('0x90')]=function(_0x5afcf0,_0x346c5b){if(_0x5afcf0[_0x003f('0x60')]['id']){delete _0x5afcf0[_0x003f('0x60')]['id'];}return db[_0x003f('0x3e')][_0x003f('0x3a')]({'where':{'id':_0x5afcf0['params']['id']}})['then'](function(_0x544446){if(!_0x544446)return null;if(_0x544446['id']===_0x5afcf0[_0x003f('0x80')]['id']){if(!_0x5afcf0[_0x003f('0x60')][_0x003f('0x91')]||!_0x5afcf0['body'][_0x003f('0x92')]){throw new db['Sequelize'][(_0x003f('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x544446['authenticate'](_0x5afcf0[_0x003f('0x60')]['oldPassword'])){throw new db[(_0x003f('0x94'))]['ValidationError'](_0x003f('0x95'));}if(_0x5afcf0[_0x003f('0x60')][_0x003f('0x91')]===_0x5afcf0[_0x003f('0x60')][_0x003f('0x92')]){throw new db[(_0x003f('0x94'))][(_0x003f('0x93'))](_0x003f('0x96'));}}else if(_0x5afcf0[_0x003f('0x80')]['role']===_0x003f('0x30')){if(!_0x5afcf0[_0x003f('0x60')]['newPassword']){throw new db[(_0x003f('0x94'))][(_0x003f('0x93'))](_0x003f('0x97'));}}else if(_0x5afcf0['user'][_0x003f('0x2c')]===_0x003f('0x80')){if(!_0x5afcf0[_0x003f('0x60')][_0x003f('0x92')]){throw new db[(_0x003f('0x94'))]['ValidationError'](_0x003f('0x97'));}if(_0x544446[_0x003f('0x2c')]!==_0x003f('0x33')){throw new db[(_0x003f('0x94'))]['ValidationError'](_0x003f('0x8b'));}}else{throw new db[(_0x003f('0x94'))]['ValidationError'](_0x003f('0x8b'));}return _0x544446;})[_0x003f('0x20')](handleEntityNotFound(_0x346c5b,null))['then'](function(_0x12cdd5){return db[_0x003f('0x65')][_0x003f('0x98')]({'attributes':['id',_0x003f('0x67'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x003f('0x20')](function(_0x61e332){if(_0x61e332[_0x003f('0x67')])authService['validatePasswordPattern'](_0x5afcf0[_0x003f('0x60')][_0x003f('0x92')]);if(!_0x61e332[_0x003f('0x99')]||!_0x12cdd5[_0x003f('0x43')])return _0x12cdd5;authService['validatePasswordHistory'](_0x5afcf0['body'][_0x003f('0x92')],_0x12cdd5[_0x003f('0x43')],_0x61e332[_0x003f('0x9a')]);return _0x12cdd5;})[_0x003f('0x20')](saveUpdates({'password':_0x5afcf0[_0x003f('0x60')]['newPassword'],'passwordResetAt':_0x5afcf0[_0x003f('0x80')]['id']==_0x5afcf0[_0x003f('0x59')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x5afcf0[_0x003f('0x60')][_0x003f('0x92')],_0x12cdd5[_0x003f('0x43')])},null));})[_0x003f('0x20')](respondWithResult(_0x346c5b,null))[_0x003f('0x2b')](handleError(_0x346c5b,null));};exports[_0x003f('0x9b')]=function(_0x47bd68,_0x1e06f0){var _0xbdc361=_0x47bd68['body']['channel'];return db[_0x003f('0x3e')][_0x003f('0x3a')]({'where':{'id':_0x47bd68[_0x003f('0x59')]['id']},'attributes':['id','name','role','online',_0x003f('0x9c'),_0x003f('0x9d'),_0x003f('0x9e')]})[_0x003f('0x20')](handleEntityNotFound(_0x1e06f0,null))[_0x003f('0x20')](function(_0x3d005a){if(_0x3d005a){if(!utils[_0x003f('0x9f')](_0xbdc361)){throw new db[(_0x003f('0x94'))]['ValidationError'](_0x003f('0xa0'));}return _0x3d005a['add'+_['capitalize'](_0xbdc361['toLowerCase']())+_0x003f('0xa1')](_0x47bd68[_0x003f('0x60')][_0x003f('0x63')],{'penalty':_0x47bd68[_0x003f('0x60')][_0x003f('0xa2')]||0x0})[_0x003f('0xa3')](function(_0x281884){for(var _0x1495c0=0x0;_0x1495c0<_0x47bd68[_0x003f('0x60')]['ids'][_0x003f('0x50')];_0x1495c0+=0x1){var _0x1829d5={'UserId':Number(_0x47bd68[_0x003f('0x59')]['id'])};_0x1829d5[_['capitalize'](_0xbdc361[_0x003f('0xa4')]())+_0x003f('0xa5')]=Number(_0x47bd68[_0x003f('0x60')]['ids'][_0x1495c0]);socket[_0x003f('0x2d')]('user'+_[_0x003f('0xa6')](_0xbdc361['toLowerCase']())+_0x003f('0xa7'),_0x1829d5);}return _0x281884;})['then'](function(){if(_0xbdc361==='voice'){return db[_0x003f('0xa8')][_0x003f('0x4e')]({'where':{'id':_0x47bd68[_0x003f('0x60')]['ids']||[]},'raw':!![],'attributes':['id',_0x003f('0x3c')]});}})[_0x003f('0x20')](function(_0x209047){var _0x150c50=_0x3d005a[_0x003f('0x2f')]({'plain':!![]});var _0x61d267=[];if(_0xbdc361==='voice'&&_0x150c50['role']===_0x003f('0x33')&&_0x150c50['online']){for(let _0x4cfe04=0x0;_0x4cfe04<_0x209047[_0x003f('0x50')];_0x4cfe04+=0x1){_0x61d267[_0x003f('0x4d')]({'membername':_0x150c50[_0x003f('0x3c')],'UserId':_0x150c50['id'],'queue_name':_0x209047[_0x4cfe04][_0x003f('0x3c')],'VoiceQueueId':_0x209047[_0x4cfe04]['id'],'interface':_[_0x003f('0x6b')](_0x150c50[_0x003f('0x9e')])?util['format'](_0x003f('0xa9'),_0x150c50['name']):_0x150c50[_0x003f('0x9e')],'paused':_0x150c50[_0x003f('0x9d')]||![],'penalty':_0x47bd68['body']['penalty']||0x0});}return Promise[_0x003f('0x58')](_0x61d267['map'](function(_0x53877a){return db['UserVoiceQueueRt']['upsert'](_0x53877a);}));}return _0x3d005a;});}})[_0x003f('0x20')](respondWithStatusCode(_0x1e06f0,null))[_0x003f('0x2b')](handleError(_0x1e06f0,null));};exports['removeQueues']=function(_0x3aca76,_0x520db5){var _0x125fc,_0x3ae1ae;return db[_0x003f('0x3e')]['find']({'where':{'id':_0x3aca76[_0x003f('0x59')]['id']},'attributes':['id','name',_0x003f('0x2c')]})[_0x003f('0x20')](handleEntityNotFound(_0x520db5,null))[_0x003f('0x20')](function(_0x5ee8c9){if(_0x5ee8c9){_0x125fc=_0x5ee8c9;if(!_0x3aca76[_0x003f('0x47')][_0x003f('0xaa')]||!utils[_0x003f('0x9f')](_0x3aca76[_0x003f('0x47')][_0x003f('0xaa')])){throw new db['Sequelize'][(_0x003f('0x93'))](_0x003f('0xa0'));}return _0x5ee8c9['remove'+_[_0x003f('0xa6')](_0x3aca76[_0x003f('0x47')][_0x003f('0xaa')]['toLowerCase']())+_0x003f('0xa1')](_0x3aca76[_0x003f('0x47')][_0x003f('0x63')]);}})[_0x003f('0x20')](function(_0x7c8c4){if(_[_0x003f('0xab')](_0x3aca76[_0x003f('0x47')][_0x003f('0x63')])){for(var _0x3e1aef=0x0;_0x3e1aef<_0x3aca76[_0x003f('0x47')][_0x003f('0x63')][_0x003f('0x50')];_0x3e1aef+=0x1){_0x3ae1ae={'UserId':Number(_0x3aca76[_0x003f('0x59')]['id'])};_0x3ae1ae[_['capitalize'](_0x3aca76[_0x003f('0x47')][_0x003f('0xaa')][_0x003f('0xa4')]())+_0x003f('0xa5')]=Number(_0x3aca76[_0x003f('0x47')][_0x003f('0x63')][_0x3e1aef]);socket[_0x003f('0x2d')]('user'+_['capitalize'](_0x3aca76['query'][_0x003f('0xaa')][_0x003f('0xa4')]())+_0x003f('0xac'),_0x3ae1ae);}}else{_0x3ae1ae={'UserId':Number(_0x3aca76['params']['id'])};_0x3ae1ae[_[_0x003f('0xa6')](_0x3aca76[_0x003f('0x47')][_0x003f('0xaa')][_0x003f('0xa4')]())+_0x003f('0xa5')]=Number(_0x3aca76[_0x003f('0x47')][_0x003f('0x63')]);socket[_0x003f('0x2d')](_0x003f('0x80')+_[_0x003f('0xa6')](_0x3aca76['query'][_0x003f('0xaa')][_0x003f('0xa4')]())+_0x003f('0xac'),_0x3ae1ae);}return _0x7c8c4;})[_0x003f('0x20')](function(){if(_0x3aca76[_0x003f('0x47')][_0x003f('0xaa')]===_0x003f('0xad')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x3aca76[_0x003f('0x59')]['id'],'VoiceQueueId':_0x3aca76[_0x003f('0x47')][_0x003f('0x63')]},'individualHooks':!![]})[_0x003f('0x20')](function(){return _0x125fc;});}return _0x125fc;})[_0x003f('0x20')](respondWithStatusCode(_0x520db5,null))['catch'](handleError(_0x520db5,null));};exports[_0x003f('0xae')]=function(_0x22b58d,_0x551873){_0x22b58d[_0x003f('0x60')][_0x003f('0xaf')]=_0x22b58d[_0x003f('0xb0')][_0x003f('0xb1')];return db[_0x003f('0x3e')][_0x003f('0x3a')]({'where':{'id':_0x22b58d[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x551873,null))[_0x003f('0x20')](saveUpdates(_0x22b58d[_0x003f('0x60')],null))[_0x003f('0x20')](respondWithResult(_0x551873,null))['catch'](handleError(_0x551873,null));};exports['getAvatar']=function(_0x55a312,_0x333b21){var _0x41e876=path[_0x003f('0xb2')](config[_0x003f('0xb3')],_0x003f('0xb4'));return db['User']['find']({'where':{'id':_0x55a312[_0x003f('0x59')]['id']},'attributes':['id',_0x003f('0xaf')],'raw':!![]})[_0x003f('0x20')](handleEntityNotFound(_0x333b21,null))[_0x003f('0x20')](function(_0x2514dc){if(_0x2514dc){if(_[_0x003f('0x6b')](_0x2514dc[_0x003f('0xaf')])){return _0x333b21['download'](_0x41e876);}else{if(!fs['existsSync'](path[_0x003f('0xb2')](config[_0x003f('0xb3')],_0x003f('0xb5'),_0x2514dc[_0x003f('0xaf')]))){return _0x333b21[_0x003f('0xb6')](_0x41e876);}return _0x333b21[_0x003f('0xb6')](path['join'](config[_0x003f('0xb3')],_0x003f('0xb5'),_0x2514dc[_0x003f('0xaf')]));}}})[_0x003f('0x2b')](handleError(_0x333b21,null));};exports[_0x003f('0xb7')]=function(_0x129fd3,_0x389ad4){return db['User'][_0x003f('0x3a')]({'where':{'id':_0x129fd3['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x389ad4,null))[_0x003f('0x20')](function(_0x3735f1){var _0x2503a7=[];values=_0x3735f1[_0x003f('0x52')];_0x2503a7[_0x003f('0x4d')](get_open_tabs(_0x003f('0x5e'),_0x3735f1[_0x003f('0x52')]));_0x2503a7['push'](get_open_tabs(_0x003f('0x53'),_0x3735f1[_0x003f('0x52')]));_0x2503a7['push'](get_open_tabs('openchannel',_0x3735f1[_0x003f('0x52')]));_0x2503a7[_0x003f('0x4d')](get_open_tabs(_0x003f('0x57'),_0x3735f1['dataValues']));_0x2503a7['push'](get_open_tabs(_0x003f('0x54'),_0x3735f1[_0x003f('0x52')]));_0x2503a7[_0x003f('0x4d')](get_open_tabs(_0x003f('0x55'),_0x3735f1['dataValues']));return Promise[_0x003f('0x58')](_0x2503a7);})[_0x003f('0x20')](function(_0x387131){if(_0x387131){var _0x190aee=_[_0x003f('0x37')](values[_0x003f('0xb8')],function(_0x5dd8f9){return{'channel':_0x003f('0xb9'),'id':_0x5dd8f9['id'],'createdAt':_0x5dd8f9[_0x003f('0xba')]};});var _0x4c4113=_[_0x003f('0x37')](values['FaxOpenTabs'],function(_0x31cea1){return{'channel':_0x003f('0xbb'),'id':_0x31cea1['id'],'createdAt':_0x31cea1['createdAt']};});var _0x10b1ad=_[_0x003f('0x37')](values['OpenchannelOpenTabs'],function(_0xd7fce){return{'channel':_0x003f('0xbc'),'id':_0xd7fce['id'],'createdAt':_0xd7fce[_0x003f('0xba')]};});var _0x51e6ec=_[_0x003f('0x37')](values[_0x003f('0xbd')],function(_0xf40da7){return{'channel':'MAIL','id':_0xf40da7['id'],'createdAt':_0xf40da7[_0x003f('0xba')]};});var _0x3f9943=_[_0x003f('0x37')](values[_0x003f('0xbe')],function(_0x1eb8c1){return{'channel':_0x003f('0xbf'),'id':_0x1eb8c1['id'],'createdAt':_0x1eb8c1[_0x003f('0xba')]};});var _0x1a16d2=_['map'](values[_0x003f('0xc0')],function(_0x449eff){return{'channel':_0x003f('0xc1'),'id':_0x449eff['id'],'createdAt':_0x449eff[_0x003f('0xba')]};});var _0x4fdea3=_[_0x003f('0xc2')](_0x190aee,_0x4c4113,_0x10b1ad,_0x51e6ec,_0x3f9943,_0x1a16d2);var _0x160b03={'count':_0x4fdea3[_0x003f('0x50')],'rows':_0x4fdea3};return _0x160b03;}else return null;})[_0x003f('0x20')](respondWithResult(_0x389ad4,null))['catch'](handleError(_0x389ad4,null));};exports[_0x003f('0xc3')]=function(_0x51812c,_0x13a613){var _0x5ec94f={};return db['User'][_0x003f('0x98')]({'where':{'id':_0x51812c[_0x003f('0x59')]['id']}})[_0x003f('0x20')](function(_0x2ca27){if(!_0x2ca27){throw new APINotFoundError(util[_0x003f('0xc4')](_0x003f('0xc5'),_0x51812c[_0x003f('0x59')]['id']));}return contacts[_0x003f('0x61')]();})[_0x003f('0x20')](function(_0x2d9965){_0x51812c[_0x003f('0x47')][_0x003f('0x3e')]=_0x51812c[_0x003f('0x59')]['id'];_0x5ec94f=qs[_0x003f('0x5a')](_0x2d9965,_0x51812c);if(_0x51812c[_0x003f('0x47')][_0x003f('0xc6')](_0x003f('0x48'))){_0x5ec94f[_0x003f('0x49')]=[{'model':db[_0x003f('0xc7')],'as':_0x003f('0xc8'),'required':![]},{'model':db[_0x003f('0xc9')],'as':_0x003f('0xca'),'attributes':['id',_0x003f('0x3c'),'color'],'where':_0x51812c['query']['tag']?{'id':_0x51812c[_0x003f('0x47')][_0x003f('0xcb')]}:undefined,'required':_0x51812c['query']['tag']?!![]:![]}];}return contacts[_0x003f('0x4e')](_0x51812c['query'],_0x51812c['user'],_0x5ec94f,_0x2d9965);})['then'](respondWithFilteredResult(_0x13a613,_0x5ec94f))[_0x003f('0x2b')](APIHandleError(_0x13a613));};exports['getQueues']=function(_0x43f5c4,_0x2ae7b0){var _0x1176af;var _0x3127ea={};var _0x7a353;return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x43f5c4['params']['id']},'attributes':['id',_0x003f('0x3c'),_0x003f('0x2c')]})[_0x003f('0x20')](handleEntityNotFound(_0x2ae7b0,null))[_0x003f('0x20')](function(_0x212b5d){if(!utils[_0x003f('0x9f')](_0x43f5c4[_0x003f('0x47')]['channel'])){throw new db[(_0x003f('0x94'))]['ValidationError'](_0x003f('0xa0'));}_0x1176af=_0x212b5d;var _0x5a67c1={};_0x5a67c1[_0x003f('0xcc')]=_[_0x003f('0xcd')](db[_[_0x003f('0xa6')](_0x43f5c4[_0x003f('0x47')][_0x003f('0xaa')])+_0x003f('0xce')][_0x003f('0x3f')]);_0x5a67c1['query']=_[_0x003f('0xcd')](_0x43f5c4[_0x003f('0x47')]);_0x5a67c1[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x5a67c1[_0x003f('0xcc')],_0x5a67c1[_0x003f('0x47')]);_0x3127ea[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x5a67c1[_0x003f('0xcc')],qs['fields'](_0x43f5c4[_0x003f('0x47')][_0x003f('0xd1')]));_0x3127ea[_0x003f('0x4c')]=_0x3127ea[_0x003f('0x4c')]['length']?_0x3127ea['attributes']:_0x5a67c1[_0x003f('0xcc')];_0x3127ea[_0x003f('0xd2')]=qs[_0x003f('0xd3')](_0x43f5c4[_0x003f('0x47')][_0x003f('0xd3')]);_0x3127ea['where']=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x43f5c4[_0x003f('0x47')],_0x5a67c1[_0x003f('0xcf')]));if(_0x43f5c4['query'][_0x003f('0x35')]){_0x3127ea[_0x003f('0x46')]=_['merge'](_0x3127ea[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x3127ea['attributes'],function(_0x7861c){var _0x50a3a6={};_0x50a3a6[_0x7861c]={'$like':'%'+_0x43f5c4[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x50a3a6;})});}_0x3127ea=_[_0x003f('0x5c')]({},_0x3127ea,_0x43f5c4[_0x003f('0x5d')]);switch(_0x1176af[_0x003f('0x2c')]){case _0x003f('0x30'):return db[_[_0x003f('0xa6')](_0x43f5c4[_0x003f('0x47')][_0x003f('0xaa')])+'Queue'][_0x003f('0x4e')](_0x3127ea);case _0x003f('0x80'):case'agent':return _0x1176af[_0x003f('0x2f')+_[_0x003f('0xa6')](_0x43f5c4['query']['channel'])+_0x003f('0xa1')](_0x3127ea);default:throw new db['Sequelize'][(_0x003f('0x93'))](_0x003f('0xd5'));}})[_0x003f('0x20')](function(_0x566cc7){_0x7a353=_0x566cc7[_0x003f('0x50')];if(!_0x43f5c4['query'][_0x003f('0xc6')](_0x003f('0xd6'))){_0x3127ea[_0x003f('0x1d')]=qs[_0x003f('0x1d')](_0x43f5c4[_0x003f('0x47')][_0x003f('0x1d')]);_0x3127ea[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x43f5c4[_0x003f('0x47')][_0x003f('0x1c')]);}switch(_0x1176af[_0x003f('0x2c')]){case'admin':return db[_[_0x003f('0xa6')](_0x43f5c4['query']['channel'])+_0x003f('0xce')][_0x003f('0x4e')](_0x3127ea);case _0x003f('0x80'):case'agent':return _0x1176af['get'+_['capitalize'](_0x43f5c4['query'][_0x003f('0xaa')])+'Queues'](_0x3127ea);}})['then'](function(_0x4567c5){return{'count':_0x7a353,'rows':_0x4567c5};})[_0x003f('0x20')](respondWithResult(_0x2ae7b0,null))['catch'](handleError(_0x2ae7b0,null));};exports['getVoiceQueuesRt']=function(_0x3398b5,_0x1b1c9f){var _0x27c7a5={};var _0x37232c={};var _0x19e7d4;var _0x194992;return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x3398b5[_0x003f('0x59')]['id']}})['then'](handleEntityNotFound(_0x1b1c9f,null))[_0x003f('0x20')](function(_0x21c93c){if(_0x21c93c){_0x19e7d4=_0x21c93c;_0x37232c['model']=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x37232c[_0x003f('0x47')]=_[_0x003f('0xcd')](_0x3398b5['query']);_0x37232c[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x37232c[_0x003f('0xcc')],_0x37232c[_0x003f('0x47')]);_0x27c7a5[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x37232c[_0x003f('0xcc')],qs[_0x003f('0xd1')](_0x3398b5['query']['fields']));_0x27c7a5[_0x003f('0x4c')]=_0x27c7a5['attributes'][_0x003f('0x50')]?_0x27c7a5[_0x003f('0x4c')]:_0x37232c['model'];_0x27c7a5[_0x003f('0xd2')]=qs[_0x003f('0xd3')](_0x3398b5[_0x003f('0x47')][_0x003f('0xd3')]);_0x27c7a5[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x3398b5[_0x003f('0x47')],_0x37232c[_0x003f('0xcf')]));if(_0x3398b5[_0x003f('0x47')][_0x003f('0x35')]){_0x27c7a5[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x27c7a5[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x27c7a5[_0x003f('0x4c')],function(_0x168aa9){var _0x2b51a7={};_0x2b51a7[_0x168aa9]={'$like':'%'+_0x3398b5[_0x003f('0x47')]['filter']+'%'};return _0x2b51a7;})});}_0x27c7a5=_[_0x003f('0x5c')]({},_0x27c7a5,_0x3398b5[_0x003f('0x5d')]);return _0x19e7d4[_0x003f('0xd7')](_0x27c7a5);}})[_0x003f('0x20')](function(_0x41cbbd){if(_0x41cbbd){_0x194992=_0x41cbbd[_0x003f('0x50')];if(!_0x3398b5[_0x003f('0x47')]['hasOwnProperty'](_0x003f('0xd6'))){_0x27c7a5[_0x003f('0x1d')]=qs[_0x003f('0x1d')](_0x3398b5[_0x003f('0x47')][_0x003f('0x1d')]);_0x27c7a5[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x3398b5[_0x003f('0x47')][_0x003f('0x1c')]);}return _0x19e7d4[_0x003f('0xd7')](_0x27c7a5);}})[_0x003f('0x20')](function(_0x395cbb){if(_0x395cbb){return _0x395cbb?{'count':_0x194992,'rows':_0x395cbb}:null;}})[_0x003f('0x20')](respondWithResult(_0x1b1c9f,null))[_0x003f('0x2b')](handleError(_0x1b1c9f,null));};exports[_0x003f('0xd8')]=function(_0x35e773,_0x3d338f){var _0x3c298b={};var _0x1e72b9={};var _0x3fdc37;var _0x4b0663;return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x35e773[_0x003f('0x59')]['id']}})['then'](handleEntityNotFound(_0x3d338f,null))[_0x003f('0x20')](function(_0x1b6929){if(_0x1b6929){_0x3fdc37=_0x1b6929;_0x1e72b9[_0x003f('0xcc')]=_[_0x003f('0xcd')](db[_0x003f('0xd9')][_0x003f('0x3f')]);_0x1e72b9['query']=_[_0x003f('0xcd')](_0x35e773[_0x003f('0x47')]);_0x1e72b9[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x1e72b9['model'],_0x1e72b9[_0x003f('0x47')]);_0x3c298b[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x1e72b9['model'],qs[_0x003f('0xd1')](_0x35e773['query']['fields']));_0x3c298b[_0x003f('0x4c')]=_0x3c298b[_0x003f('0x4c')][_0x003f('0x50')]?_0x3c298b[_0x003f('0x4c')]:_0x1e72b9[_0x003f('0xcc')];_0x3c298b[_0x003f('0xd2')]=qs[_0x003f('0xd3')](_0x35e773[_0x003f('0x47')][_0x003f('0xd3')]);_0x3c298b[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x35e773[_0x003f('0x47')],_0x1e72b9['filters']));if(_0x35e773[_0x003f('0x47')][_0x003f('0x35')]){_0x3c298b[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x3c298b[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x3c298b[_0x003f('0x4c')],function(_0x2b8c3b){var _0x1bd115={};_0x1bd115[_0x2b8c3b]={'$like':'%'+_0x35e773[_0x003f('0x47')]['filter']+'%'};return _0x1bd115;})});}_0x3c298b=_['merge']({},_0x3c298b,_0x35e773[_0x003f('0x5d')]);return _0x3fdc37[_0x003f('0xd8')](_0x3c298b);}})[_0x003f('0x20')](function(_0x40c368){if(_0x40c368){_0x4b0663=_0x40c368[_0x003f('0x50')];if(!_0x35e773[_0x003f('0x47')]['hasOwnProperty'](_0x003f('0xd6'))){_0x3c298b[_0x003f('0x1d')]=qs['limit'](_0x35e773[_0x003f('0x47')][_0x003f('0x1d')]);_0x3c298b[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x35e773[_0x003f('0x47')]['offset']);}return _0x3fdc37['getGroups'](_0x3c298b);}})['then'](function(_0x5ecd57){if(_0x5ecd57){return _0x5ecd57?{'count':_0x4b0663,'rows':_0x5ecd57}:null;}})[_0x003f('0x20')](respondWithResult(_0x3d338f,null))[_0x003f('0x2b')](handleError(_0x3d338f,null));};exports[_0x003f('0xda')]=function(_0x24a4db,_0x22ec7a){var _0x2bd0da={'raw':!![],'where':{}};var _0x4a86d7={};var _0x583689={'count':0x0,'rows':[]};return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x24a4db[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x22ec7a,null))[_0x003f('0x20')](function(_0x383cbf){if(_0x383cbf){_0x4a86d7[_0x003f('0xcc')]=_['keys'](db[_0x003f('0xdb')][_0x003f('0x3f')]);_0x4a86d7['query']=_[_0x003f('0xcd')](_0x24a4db[_0x003f('0x47')]);_0x4a86d7[_0x003f('0xcf')]=_['intersection'](_0x4a86d7[_0x003f('0xcc')],_0x4a86d7[_0x003f('0x47')]);_0x2bd0da[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x4a86d7['model'],qs[_0x003f('0xd1')](_0x24a4db[_0x003f('0x47')][_0x003f('0xd1')]));_0x2bd0da['attributes']=_0x2bd0da[_0x003f('0x4c')][_0x003f('0x50')]?_0x2bd0da['attributes']:_0x4a86d7[_0x003f('0xcc')];if(!_0x24a4db[_0x003f('0x47')][_0x003f('0xc6')]('nolimit')){_0x2bd0da[_0x003f('0x1d')]=qs[_0x003f('0x1d')](_0x24a4db[_0x003f('0x47')][_0x003f('0x1d')]);_0x2bd0da[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x24a4db['query'][_0x003f('0x1c')]);}_0x2bd0da[_0x003f('0xd2')]=qs[_0x003f('0xd3')](_0x24a4db['query']['sort']);_0x2bd0da[_0x003f('0x46')]=qs['filters'](_['pick'](_0x24a4db['query'],_0x4a86d7[_0x003f('0xcf')]));_0x2bd0da[_0x003f('0x46')][_0x003f('0xdc')]=_0x383cbf['id'];if(_0x24a4db[_0x003f('0x47')][_0x003f('0x35')]){_0x2bd0da[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x2bd0da['where'],{'$or':_[_0x003f('0x37')](_0x2bd0da[_0x003f('0x4c')],function(_0x33c439){var _0x33c0f2={};_0x33c0f2[_0x33c439]={'$like':'%'+_0x24a4db[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x33c0f2;})});}_0x2bd0da=_[_0x003f('0x5c')]({},_0x2bd0da,_0x24a4db['options']);return db[_0x003f('0xdb')]['count']({'where':_0x2bd0da[_0x003f('0x46')]})[_0x003f('0x20')](function(_0x4923d0){_0x583689['count']=_0x4923d0;if(_0x24a4db[_0x003f('0x47')][_0x003f('0x48')]){_0x2bd0da['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x003f('0x4e')](_0x2bd0da);})['then'](function(_0x5bc71c){_0x583689[_0x003f('0x51')]=_0x5bc71c;return _0x583689;});}})[_0x003f('0x20')](respondWithFilteredResult(_0x22ec7a,_0x2bd0da))[_0x003f('0x2b')](handleError(_0x22ec7a,null));};exports[_0x003f('0xdd')]=function(_0x5cc0c4,_0x24e61c){var _0x3c3645={'raw':!![],'where':{}};var _0x9f306c={};var _0x37fb9e={'count':0x0,'rows':[]};return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x5cc0c4[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x24e61c,null))[_0x003f('0x20')](function(_0x47d4d0){if(_0x47d4d0){_0x9f306c[_0x003f('0xcc')]=_[_0x003f('0xcd')](db['ScreenRecording'][_0x003f('0x3f')]);_0x9f306c[_0x003f('0x47')]=_['keys'](_0x5cc0c4[_0x003f('0x47')]);_0x9f306c[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x9f306c['model'],_0x9f306c[_0x003f('0x47')]);_0x3c3645['attributes']=_[_0x003f('0xd0')](_0x9f306c[_0x003f('0xcc')],qs[_0x003f('0xd1')](_0x5cc0c4[_0x003f('0x47')][_0x003f('0xd1')]));_0x3c3645[_0x003f('0x4c')]=_0x3c3645['attributes'][_0x003f('0x50')]?_0x3c3645[_0x003f('0x4c')]:_0x9f306c[_0x003f('0xcc')];if(!_0x5cc0c4[_0x003f('0x47')][_0x003f('0xc6')](_0x003f('0xd6'))){_0x3c3645[_0x003f('0x1d')]=qs[_0x003f('0x1d')](_0x5cc0c4[_0x003f('0x47')][_0x003f('0x1d')]);_0x3c3645[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x5cc0c4['query'][_0x003f('0x1c')]);}_0x3c3645['order']=qs[_0x003f('0xd3')](_0x5cc0c4['query'][_0x003f('0xd3')]);_0x3c3645[_0x003f('0x46')]=qs[_0x003f('0xcf')](_['pick'](_0x5cc0c4[_0x003f('0x47')],_0x9f306c[_0x003f('0xcf')]));_0x3c3645['where'][_0x003f('0xdc')]=_0x47d4d0['id'];if(_0x5cc0c4[_0x003f('0x47')]['filter']){_0x3c3645[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x3c3645[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x3c3645[_0x003f('0x4c')],function(_0xc3bab4){var _0x47d336={};_0x47d336[_0xc3bab4]={'$like':'%'+_0x5cc0c4[_0x003f('0x47')]['filter']+'%'};return _0x47d336;})});}_0x3c3645=_[_0x003f('0x5c')]({},_0x3c3645,_0x5cc0c4[_0x003f('0x5d')]);return db[_0x003f('0xde')][_0x003f('0x1b')]({'where':_0x3c3645[_0x003f('0x46')]})[_0x003f('0x20')](function(_0x303dfd){_0x37fb9e[_0x003f('0x1b')]=_0x303dfd;if(_0x5cc0c4[_0x003f('0x47')][_0x003f('0x48')]){_0x3c3645[_0x003f('0x49')]=[{'all':!![]}];}return db[_0x003f('0xde')][_0x003f('0x4e')](_0x3c3645);})[_0x003f('0x20')](function(_0xa63f80){_0x37fb9e[_0x003f('0x51')]=_0xa63f80;return _0x37fb9e;});}})['then'](respondWithFilteredResult(_0x24e61c,_0x3c3645))[_0x003f('0x2b')](handleError(_0x24e61c,null));};exports[_0x003f('0xdf')]=function(_0x131559,_0x2ef2ef){var _0x14e2d2={};var _0x20fa9a={};var _0x3e2ebe;var _0x29c301;return db[_0x003f('0x3e')]['findOne']({'where':{'id':_0x131559[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x2ef2ef,null))[_0x003f('0x20')](function(_0x3a7475){if(_0x3a7475){_0x3e2ebe=_0x3a7475;_0x20fa9a[_0x003f('0xcc')]=_['keys'](db['ChatInteraction'][_0x003f('0x3f')]);_0x20fa9a['query']=_[_0x003f('0xcd')](_0x131559['query']);_0x20fa9a[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x20fa9a[_0x003f('0xcc')],_0x20fa9a[_0x003f('0x47')]);_0x14e2d2[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x20fa9a['model'],qs[_0x003f('0xd1')](_0x131559[_0x003f('0x47')][_0x003f('0xd1')]));_0x14e2d2[_0x003f('0x4c')]=_0x14e2d2[_0x003f('0x4c')][_0x003f('0x50')]?_0x14e2d2[_0x003f('0x4c')]:_0x20fa9a[_0x003f('0xcc')];_0x14e2d2['order']=qs[_0x003f('0xd3')](_0x131559['query'][_0x003f('0xd3')]);_0x14e2d2['where']=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x131559[_0x003f('0x47')],_0x20fa9a['filters']));if(_0x131559[_0x003f('0x47')][_0x003f('0x35')]){_0x14e2d2[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x14e2d2[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x14e2d2['attributes'],function(_0x416800){var _0x58b9d7={};_0x58b9d7[_0x416800]={'$like':'%'+_0x131559[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x58b9d7;})});}_0x14e2d2=_[_0x003f('0x5c')]({},_0x14e2d2,_0x131559[_0x003f('0x5d')]);return _0x3e2ebe[_0x003f('0xdf')](_0x14e2d2);}})[_0x003f('0x20')](function(_0x4de995){if(_0x4de995){_0x29c301=_0x4de995[_0x003f('0x50')];if(!_0x131559['query']['hasOwnProperty']('nolimit')){_0x14e2d2['limit']=qs[_0x003f('0x1d')](_0x131559[_0x003f('0x47')][_0x003f('0x1d')]);_0x14e2d2[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x131559['query'][_0x003f('0x1c')]);}return _0x3e2ebe[_0x003f('0xdf')](_0x14e2d2);}})[_0x003f('0x20')](function(_0x402844){if(_0x402844){return _0x402844?{'count':_0x29c301,'rows':_0x402844}:null;}})[_0x003f('0x20')](respondWithResult(_0x2ef2ef,null))[_0x003f('0x2b')](handleError(_0x2ef2ef,null));};exports['getOpenchannelInteractions']=function(_0x120399,_0x2f578c){var _0x326652={};var _0x490978={};var _0x21955d;var _0x427df7;return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x120399[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x2f578c,null))[_0x003f('0x20')](function(_0x3593aa){if(_0x3593aa){_0x21955d=_0x3593aa;_0x490978[_0x003f('0xcc')]=_['keys'](db[_0x003f('0xe0')][_0x003f('0x3f')]);_0x490978[_0x003f('0x47')]=_[_0x003f('0xcd')](_0x120399[_0x003f('0x47')]);_0x490978[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x490978[_0x003f('0xcc')],_0x490978[_0x003f('0x47')]);_0x326652['attributes']=_[_0x003f('0xd0')](_0x490978[_0x003f('0xcc')],qs['fields'](_0x120399[_0x003f('0x47')]['fields']));_0x326652[_0x003f('0x4c')]=_0x326652[_0x003f('0x4c')][_0x003f('0x50')]?_0x326652['attributes']:_0x490978[_0x003f('0xcc')];_0x326652[_0x003f('0xd2')]=qs['sort'](_0x120399['query'][_0x003f('0xd3')]);_0x326652[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x120399['query'],_0x490978[_0x003f('0xcf')]));if(_0x120399[_0x003f('0x47')][_0x003f('0x35')]){_0x326652[_0x003f('0x46')]=_['merge'](_0x326652[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x326652[_0x003f('0x4c')],function(_0x599944){var _0x362514={};_0x362514[_0x599944]={'$like':'%'+_0x120399[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x362514;})});}_0x326652=_[_0x003f('0x5c')]({},_0x326652,_0x120399[_0x003f('0x5d')]);return _0x21955d['getOpenchannelInteractions'](_0x326652);}})[_0x003f('0x20')](function(_0x403089){if(_0x403089){_0x427df7=_0x403089['length'];if(!_0x120399['query'][_0x003f('0xc6')](_0x003f('0xd6'))){_0x326652[_0x003f('0x1d')]=qs['limit'](_0x120399[_0x003f('0x47')][_0x003f('0x1d')]);_0x326652[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x120399[_0x003f('0x47')][_0x003f('0x1c')]);}return _0x21955d[_0x003f('0xe1')](_0x326652);}})[_0x003f('0x20')](function(_0x4f0da4){if(_0x4f0da4){return _0x4f0da4?{'count':_0x427df7,'rows':_0x4f0da4}:null;}})[_0x003f('0x20')](respondWithResult(_0x2f578c,null))[_0x003f('0x2b')](handleError(_0x2f578c,null));};exports[_0x003f('0xe2')]=function(_0x507583,_0x4ebfff){var _0x139e36={'raw':!![],'where':{}};var _0x592d70={};var _0x59e444={'count':0x0,'rows':[]};return db['User'][_0x003f('0x98')]({'where':{'id':_0x507583[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x4ebfff,null))[_0x003f('0x20')](function(_0x3d59a6){if(_0x3d59a6){_0x592d70['model']=_['keys'](db['MailInteraction'][_0x003f('0x3f')]);_0x592d70[_0x003f('0x47')]=_[_0x003f('0xcd')](_0x507583['query']);_0x592d70[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x592d70[_0x003f('0xcc')],_0x592d70['query']);_0x139e36['attributes']=_[_0x003f('0xd0')](_0x592d70[_0x003f('0xcc')],qs[_0x003f('0xd1')](_0x507583[_0x003f('0x47')][_0x003f('0xd1')]));_0x139e36[_0x003f('0x4c')]=_0x139e36['attributes'][_0x003f('0x50')]?_0x139e36[_0x003f('0x4c')]:_0x592d70[_0x003f('0xcc')];if(!_0x507583[_0x003f('0x47')][_0x003f('0xc6')](_0x003f('0xd6'))){_0x139e36[_0x003f('0x1d')]=qs[_0x003f('0x1d')](_0x507583[_0x003f('0x47')]['limit']);_0x139e36[_0x003f('0x1c')]=qs['offset'](_0x507583[_0x003f('0x47')][_0x003f('0x1c')]);}_0x139e36[_0x003f('0xd2')]=qs[_0x003f('0xd3')](_0x507583[_0x003f('0x47')][_0x003f('0xd3')]);_0x139e36[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x507583['query'],_0x592d70['filters']));_0x139e36[_0x003f('0x46')][_0x003f('0xdc')]=_0x3d59a6['id'];if(_0x507583[_0x003f('0x47')][_0x003f('0x35')]){_0x139e36[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x139e36[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x139e36['attributes'],function(_0x333204){var _0x3c7d59={};_0x3c7d59[_0x333204]={'$like':'%'+_0x507583[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x3c7d59;})});}_0x139e36=_[_0x003f('0x5c')]({},_0x139e36,_0x507583[_0x003f('0x5d')]);return db['MailInteraction']['count']({'where':_0x139e36[_0x003f('0x46')]})[_0x003f('0x20')](function(_0x2fb3eb){_0x59e444[_0x003f('0x1b')]=_0x2fb3eb;if(_0x507583[_0x003f('0x47')][_0x003f('0x48')]){_0x139e36['include']=[{'all':!![]}];}return db[_0x003f('0xe3')][_0x003f('0x4e')](_0x139e36);})[_0x003f('0x20')](function(_0x1b8c26){_0x59e444['rows']=_0x1b8c26;return _0x59e444;});}})[_0x003f('0x20')](respondWithFilteredResult(_0x4ebfff,_0x139e36))[_0x003f('0x2b')](handleError(_0x4ebfff,null));};exports[_0x003f('0xe4')]=function(_0x23e996,_0xaf4107){var _0x18d03c={};var _0x361cc0={};var _0x54483e;var _0x494ec8;return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x23e996[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0xaf4107,null))[_0x003f('0x20')](function(_0x48bc01){if(_0x48bc01){_0x54483e=_0x48bc01;_0x361cc0[_0x003f('0xcc')]=_[_0x003f('0xcd')](db['SmsInteraction']['rawAttributes']);_0x361cc0['query']=_[_0x003f('0xcd')](_0x23e996[_0x003f('0x47')]);_0x361cc0['filters']=_[_0x003f('0xd0')](_0x361cc0[_0x003f('0xcc')],_0x361cc0['query']);_0x18d03c[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x361cc0[_0x003f('0xcc')],qs['fields'](_0x23e996[_0x003f('0x47')]['fields']));_0x18d03c[_0x003f('0x4c')]=_0x18d03c[_0x003f('0x4c')][_0x003f('0x50')]?_0x18d03c[_0x003f('0x4c')]:_0x361cc0[_0x003f('0xcc')];_0x18d03c[_0x003f('0xd2')]=qs[_0x003f('0xd3')](_0x23e996[_0x003f('0x47')][_0x003f('0xd3')]);_0x18d03c[_0x003f('0x46')]=qs['filters'](_[_0x003f('0xd4')](_0x23e996[_0x003f('0x47')],_0x361cc0[_0x003f('0xcf')]));if(_0x23e996[_0x003f('0x47')][_0x003f('0x35')]){_0x18d03c[_0x003f('0x46')]=_['merge'](_0x18d03c[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x18d03c['attributes'],function(_0x4ebb51){var _0x9366ef={};_0x9366ef[_0x4ebb51]={'$like':'%'+_0x23e996[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x9366ef;})});}_0x18d03c=_[_0x003f('0x5c')]({},_0x18d03c,_0x23e996['options']);return _0x54483e[_0x003f('0xe4')](_0x18d03c);}})[_0x003f('0x20')](function(_0x20d4d5){if(_0x20d4d5){_0x494ec8=_0x20d4d5['length'];if(!_0x23e996[_0x003f('0x47')][_0x003f('0xc6')](_0x003f('0xd6'))){_0x18d03c['limit']=qs['limit'](_0x23e996['query'][_0x003f('0x1d')]);_0x18d03c[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x23e996[_0x003f('0x47')][_0x003f('0x1c')]);}return _0x54483e[_0x003f('0xe4')](_0x18d03c);}})[_0x003f('0x20')](function(_0x23b970){if(_0x23b970){return _0x23b970?{'count':_0x494ec8,'rows':_0x23b970}:null;}})[_0x003f('0x20')](respondWithResult(_0xaf4107,null))[_0x003f('0x2b')](handleError(_0xaf4107,null));};exports[_0x003f('0xe5')]=function(_0x103d27,_0x5160b7){var _0x324d75={};var _0x5e3028={};var _0xcaba39;var _0x43763c;return db['User'][_0x003f('0x98')]({'where':{'id':_0x103d27[_0x003f('0x59')]['id']}})['then'](handleEntityNotFound(_0x5160b7,null))[_0x003f('0x20')](function(_0x3b617a){if(_0x3b617a){_0xcaba39=_0x3b617a;_0x5e3028['model']=_[_0x003f('0xcd')](db['FaxInteraction'][_0x003f('0x3f')]);_0x5e3028[_0x003f('0x47')]=_['keys'](_0x103d27[_0x003f('0x47')]);_0x5e3028[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x5e3028[_0x003f('0xcc')],_0x5e3028[_0x003f('0x47')]);_0x324d75[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x5e3028['model'],qs[_0x003f('0xd1')](_0x103d27[_0x003f('0x47')]['fields']));_0x324d75['attributes']=_0x324d75[_0x003f('0x4c')]['length']?_0x324d75['attributes']:_0x5e3028[_0x003f('0xcc')];_0x324d75['order']=qs[_0x003f('0xd3')](_0x103d27[_0x003f('0x47')][_0x003f('0xd3')]);_0x324d75[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x103d27[_0x003f('0x47')],_0x5e3028[_0x003f('0xcf')]));if(_0x103d27['query'][_0x003f('0x35')]){_0x324d75['where']=_[_0x003f('0x5c')](_0x324d75[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x324d75[_0x003f('0x4c')],function(_0x47b3c6){var _0x4b33aa={};_0x4b33aa[_0x47b3c6]={'$like':'%'+_0x103d27[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x4b33aa;})});}_0x324d75=_[_0x003f('0x5c')]({},_0x324d75,_0x103d27['options']);return _0xcaba39['getFaxInteractions'](_0x324d75);}})['then'](function(_0x1c7fdd){if(_0x1c7fdd){_0x43763c=_0x1c7fdd[_0x003f('0x50')];if(!_0x103d27[_0x003f('0x47')][_0x003f('0xc6')](_0x003f('0xd6'))){_0x324d75[_0x003f('0x1d')]=qs[_0x003f('0x1d')](_0x103d27[_0x003f('0x47')]['limit']);_0x324d75['offset']=qs['offset'](_0x103d27[_0x003f('0x47')][_0x003f('0x1c')]);}return _0xcaba39[_0x003f('0xe5')](_0x324d75);}})[_0x003f('0x20')](function(_0xace6b5){if(_0xace6b5){return _0xace6b5?{'count':_0x43763c,'rows':_0xace6b5}:null;}})[_0x003f('0x20')](respondWithResult(_0x5160b7,null))[_0x003f('0x2b')](handleError(_0x5160b7,null));};exports[_0x003f('0xe6')]=function(_0x23c4f9,_0x144671){var _0x31400a={};var _0x531d23={};var _0x595f84;var _0x47ffe8;return db[_0x003f('0x3e')]['findOne']({'where':{'id':_0x23c4f9[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x144671,null))[_0x003f('0x20')](function(_0xe3c7f9){if(_0xe3c7f9){_0x595f84=_0xe3c7f9;_0x531d23[_0x003f('0xcc')]=_[_0x003f('0xcd')](db['WhatsappInteraction'][_0x003f('0x3f')]);_0x531d23[_0x003f('0x47')]=_[_0x003f('0xcd')](_0x23c4f9[_0x003f('0x47')]);_0x531d23[_0x003f('0xcf')]=_['intersection'](_0x531d23['model'],_0x531d23[_0x003f('0x47')]);_0x31400a[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x531d23[_0x003f('0xcc')],qs['fields'](_0x23c4f9[_0x003f('0x47')][_0x003f('0xd1')]));_0x31400a[_0x003f('0x4c')]=_0x31400a[_0x003f('0x4c')][_0x003f('0x50')]?_0x31400a[_0x003f('0x4c')]:_0x531d23['model'];_0x31400a['order']=qs['sort'](_0x23c4f9[_0x003f('0x47')]['sort']);_0x31400a[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x23c4f9[_0x003f('0x47')],_0x531d23['filters']));if(_0x23c4f9[_0x003f('0x47')]['filter']){_0x31400a[_0x003f('0x46')]=_['merge'](_0x31400a[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x31400a[_0x003f('0x4c')],function(_0x52dc97){var _0x110e42={};_0x110e42[_0x52dc97]={'$like':'%'+_0x23c4f9['query']['filter']+'%'};return _0x110e42;})});}_0x31400a=_[_0x003f('0x5c')]({},_0x31400a,_0x23c4f9[_0x003f('0x5d')]);return _0x595f84['getWhatsappInteractions'](_0x31400a);}})['then'](function(_0x33c634){if(_0x33c634){_0x47ffe8=_0x33c634[_0x003f('0x50')];if(!_0x23c4f9[_0x003f('0x47')][_0x003f('0xc6')](_0x003f('0xd6'))){_0x31400a['limit']=qs['limit'](_0x23c4f9[_0x003f('0x47')][_0x003f('0x1d')]);_0x31400a['offset']=qs[_0x003f('0x1c')](_0x23c4f9[_0x003f('0x47')][_0x003f('0x1c')]);}return _0x595f84[_0x003f('0xe6')](_0x31400a);}})['then'](function(_0x131168){if(_0x131168){return _0x131168?{'count':_0x47ffe8,'rows':_0x131168}:null;}})[_0x003f('0x20')](respondWithResult(_0x144671,null))[_0x003f('0x2b')](handleError(_0x144671,null));};exports[_0x003f('0xe7')]=function(_0x4fbeda,_0x4a27fd,_0xba6de5){var _0x2071d3;var _0x4af79c;var _0x181f41;var _0x34a3aa=!_['isNil'](_0x4fbeda[_0x003f('0x59')]['id'])?_0x4fbeda[_0x003f('0x59')]['id']:!_[_0x003f('0x6b')](_0x4fbeda[_0x003f('0x80')]['id'])?_0x4fbeda[_0x003f('0x80')]['id']:null;return db[_0x003f('0x3e')][_0x003f('0x3a')]({'where':{'id':_0x34a3aa,'role':{'$or':[_0x003f('0x30'),_0x003f('0x80'),_0x003f('0x33')]}},'attributes':['id',_0x003f('0x3c'),_0x003f('0xe8'),_0x003f('0xe9'),'role',_0x003f('0x6a'),'loginInPause']})[_0x003f('0x20')](function(_0x587e28){if(_0x587e28){if(_0x587e28[_0x003f('0x2c')]===_0x003f('0x33')){_0x2071d3=_0x587e28;if(_0x4fbeda[_0x003f('0x60')][_0x003f('0x9e')]){_0x181f41=util['format'](_0x003f('0xea'),_0x2071d3[_0x4fbeda[_0x003f('0x60')][_0x003f('0x9e')]]);}else if(_0x4fbeda[_0x003f('0x60')]['intrf']){_0x181f41=util[_0x003f('0xc4')](_0x003f('0xa9'),_0x4fbeda['body'][_0x003f('0xeb')]);}else{_0x181f41=util[_0x003f('0xc4')](_0x003f('0xa9'),_0x2071d3[_0x003f('0x3c')]);}socket['to'](util[_0x003f('0xc4')]('user:%s',_0x2071d3[_0x003f('0x3c')]))[_0x003f('0x2d')]('user:forcelogout',{'user':{'id':_0x2071d3['id'],'name':_0x2071d3[_0x003f('0x3c')]},'ip':_0x4fbeda['headers'][_0x003f('0xec')]||_0x4fbeda[_0x003f('0xed')][_0x003f('0xee')]||_0x4fbeda[_0x003f('0xef')]['remoteAddress']||_0x4fbeda['connection'][_0x003f('0xef')][_0x003f('0xee')]});return db[_0x003f('0xf0')][_0x003f('0x2e')]({'where':{'membername':_0x2071d3[_0x003f('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0x003f('0x94'))][(_0x003f('0x93'))](_0x003f('0xf1'));}})[_0x003f('0x20')](function(){if(_0x2071d3){return _0x2071d3[_0x003f('0xf2')]({'raw':!![]});}})[_0x003f('0x20')](function(_0x430a3b){if(_0x2071d3){if(_0x430a3b){_0x4af79c=_0x430a3b;if(_0x4af79c[_0x003f('0x50')]){var _0x3f5457=_0x4af79c[_0x003f('0x37')](function(_0x58df2f){var _0x24233b={'membername':_0x2071d3[_0x003f('0x3c')],'UserId':_0x2071d3['id'],'queue_name':_0x58df2f[_0x003f('0x3c')],'VoiceQueueId':_0x58df2f['id'],'interface':_0x181f41,'paused':_0x2071d3['loginInPause']||![],'penalty':_0x58df2f[_0x003f('0xf3')]||0x0};return db[_0x003f('0xf0')][_0x003f('0xf4')](_0x24233b);});return Promise[_0x003f('0x58')](_0x3f5457);}}}})[_0x003f('0x20')](function(){if(_0x2071d3){return db[_0x003f('0xf5')][_0x003f('0x4e')]({'where':{'membername':_0x2071d3[_0x003f('0x3c')],'exitAt':null}});}})['then'](function(_0x2eb1af){if(_0x2071d3){var _0x59e0fb=[];_0x2eb1af['forEach'](function(_0x4a8f2b){_0x59e0fb[_0x003f('0x4d')](_0x4a8f2b['update']({'exitAt':moment()['format'](_0x003f('0xf6'))}));});return Promise[_0x003f('0x58')](_0x59e0fb);}})[_0x003f('0x20')](function(){if(_0x2071d3){var _0x405ceb=[];var _0x58f1ed=[];var _0x195b1d=utils[_0x003f('0xf7')]();var _0x45e848={'membername':_0x2071d3['name'],'interface':_0x181f41,'enterAt':moment()[_0x003f('0xc4')](_0x003f('0xf6')),'role':_0x2071d3[_0x003f('0x2c')],'internal':_0x2071d3[_0x003f('0x6a')]};_0x195b1d['forEach'](function(_0x44d94e){_0x405ceb[_0x003f('0x4d')](_[_0x003f('0x5c')]({'channel':_0x44d94e,'type':_0x003f('0xf8'),'data1':_0x4fbeda['body'][_0x003f('0xf9')],'data2':_0x181f41},_0x45e848));if(_0x2071d3['loginInPause']){_0x58f1ed['push'](_[_0x003f('0x5c')]({'channel':_0x44d94e,'type':_0x003f('0xfa'),'data1':'LOGININPAUSE'},_0x45e848));}});return db['MemberReport'][_0x003f('0xfb')](_0x405ceb['concat'](_0x58f1ed),{'individualHooks':!![]});}})[_0x003f('0x20')](function(){if(_0x2071d3){return _0x2071d3[_0x003f('0x5f')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2071d3[_0x003f('0x9c')]||![],'mailPause':_0x2071d3[_0x003f('0x9c')]||![],'chatPause':_0x2071d3[_0x003f('0x9c')]||![],'faxPause':_0x2071d3[_0x003f('0x9c')]||![],'smsPause':_0x2071d3[_0x003f('0x9c')]||![],'openchannelPause':_0x2071d3['loginInPause']||![],'whatsappPause':_0x2071d3[_0x003f('0x9c')]||![],'pauseType':_0x2071d3[_0x003f('0x9c')]?_0x003f('0xfc'):null,'interface':_0x181f41,'lastPauseAt':moment()[_0x003f('0xc4')](_0x003f('0xf6'))});}})['then'](function(_0x5d3495){if(_0x4fbeda[_0x003f('0xfd')]){return _0xba6de5();}else{return Promise[_0x003f('0xfe')](_0x5d3495)['then'](respondWithResult(_0x4a27fd,null));}})[_0x003f('0x2b')](handleError(_0x4a27fd,null));};exports[_0x003f('0xff')]=function(_0x4c0d8e,_0x5bdaa7){var _0x15cbcc;return db[_0x003f('0x3e')][_0x003f('0x3a')]({'where':{'id':_0x4c0d8e[_0x003f('0x59')]['id'],'role':_0x003f('0x33')},'attributes':['id',_0x003f('0x3c'),_0x003f('0x2c')]})[_0x003f('0x20')](handleEntityNotFound(_0x5bdaa7,null))[_0x003f('0x20')](function(_0x293159){if(_0x293159){_0x15cbcc=_0x293159;return db[_0x003f('0xf0')]['destroy']({'where':{'membername':_0x15cbcc['name']},'individualHooks':!![]});}})[_0x003f('0x20')](function(){return db[_0x003f('0xf5')][_0x003f('0x4e')]({'where':{'membername':_0x15cbcc[_0x003f('0x3c')],'exitAt':null}});})[_0x003f('0x20')](function(_0x1fb324){var _0x2fec4e=[];_0x1fb324['forEach'](function(_0x48ed54){_0x2fec4e['push'](_0x48ed54[_0x003f('0x5f')]({'exitAt':moment()['format'](_0x003f('0xf6'))}));});return Promise['all'](_0x2fec4e);})[_0x003f('0x20')](function(){return _0x15cbcc['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x003f('0x20')](respondWithResult(_0x5bdaa7,null))[_0x003f('0x2b')](handleError(_0x5bdaa7,null));};exports['pause']=function(_0x1239e5,_0x17c1e2){var _0x10452b;return db['UserVoiceQueueRt'][_0x003f('0x5f')]({'paused':0x1},{'where':{'UserId':_0x1239e5[_0x003f('0x59')]['id']},'individualHooks':!![]})[_0x003f('0x20')](function(){return db[_0x003f('0x3e')][_0x003f('0x3a')]({'where':{'id':_0x1239e5[_0x003f('0x59')]['id'],'role':_0x003f('0x33')},'attributes':['id',_0x003f('0x3c'),'role',_0x003f('0x6a'),_0x003f('0x9e'),_0x003f('0x100')]});})[_0x003f('0x20')](handleEntityNotFound(_0x17c1e2,null))[_0x003f('0x20')](function(_0x7584a0){if(_0x7584a0){_0x10452b=_0x7584a0;return respondWithRpcPromise(_0x003f('0x101'),_0x003f('0x102'),{'id':_0x10452b['id'],'name':_0x10452b[_0x003f('0x3c')],'pause':!![]});}})[_0x003f('0x20')](function(){if(_0x10452b){return db[_0x003f('0xf5')][_0x003f('0x4e')]({'where':{'membername':_0x10452b['name'],'type':_0x003f('0xfa'),'exitAt':null}});}})[_0x003f('0x20')](function(_0x383863){if(_0x383863[_0x003f('0x50')]){var _0x338b11=moment()[_0x003f('0xc4')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x264f5f=0x0,_0x360981=_0x383863[_0x003f('0x50')];_0x264f5f<_0x360981;_0x264f5f++){_0x383863[_0x264f5f][_0x003f('0x103')]({'exitAt':_0x338b11});}}})[_0x003f('0x20')](function(){var _0x2023a1=[];var _0x234f8e=utils[_0x003f('0xf7')]();_0x234f8e['forEach'](function(_0x43e949){_0x2023a1[_0x003f('0x4d')]({'channel':_0x43e949,'membername':_0x10452b[_0x003f('0x3c')],'interface':_[_0x003f('0x6b')](_0x10452b[_0x003f('0x9e')])?util['format']('SIP/%s',_0x10452b['name']):_0x10452b['interface'],'type':'PAUSE','enterAt':moment()[_0x003f('0xc4')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1239e5[_0x003f('0x60')][_0x003f('0x104')]||'DEFAULT\x20PAUSE','role':_0x10452b[_0x003f('0x2c')],'internal':_0x10452b[_0x003f('0x6a')]});});return db[_0x003f('0xf5')][_0x003f('0xfb')](_0x2023a1,{'individualHooks':!![]});})['then'](function(){return _0x10452b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1239e5['body'][_0x003f('0x104')]||_0x003f('0x105'),'lastPauseAt':moment()[_0x003f('0xc4')](_0x003f('0xf6'))});})['then'](respondWithResult(_0x17c1e2,null))['catch'](handleError(_0x17c1e2,null));};exports[_0x003f('0x106')]=function(_0x3a6a8b,_0x43e569){if(_0x3a6a8b['body'][_0x003f('0xaa')]&&!utils[_0x003f('0x9f')](_0x3a6a8b['body']['channel'])){throw new APIBadRequestError(util['format'](_0x003f('0x107'),_0x3a6a8b[_0x003f('0x60')]['channel']));}return db[_0x003f('0x3e')]['find']({'where':{'id':_0x3a6a8b['params']['id']},'attributes':['id',_0x003f('0x3c'),'role',_0x003f('0x6a'),_0x003f('0x9e'),_0x003f('0x100'),'voicePause','mailPause',_0x003f('0x108'),_0x003f('0x109'),_0x003f('0x10a'),_0x003f('0x10b'),'whatsappPause',_0x003f('0x10c'),_0x003f('0x10d')]})[_0x003f('0x20')](function(_0x739b2f){if(!_0x739b2f){throw new APINotFoundError(util[_0x003f('0xc4')](_0x003f('0xc5'),_0x3a6a8b[_0x003f('0x59')]['id']));}return _0x739b2f[_0x003f('0x106')](_0x3a6a8b[_0x003f('0x60')][_0x003f('0xaa')]);})[_0x003f('0x20')](respondWithResult(_0x43e569,null))[_0x003f('0x2b')](APIHandleError(_0x43e569));};exports[_0x003f('0x10e')]=function(_0x3a5866,_0x39f149){var _0x109fbc={};var _0x402ef2={};var _0x1509ce;var _0x506120;return db[_0x003f('0x3e')]['findOne']({'where':{'id':_0x3a5866[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x39f149,null))[_0x003f('0x20')](function(_0x238f6b){if(_0x238f6b){_0x1509ce=_0x238f6b;_0x402ef2['model']=_[_0x003f('0xcd')](db[_0x003f('0x10f')]['rawAttributes']);_0x402ef2['query']=_[_0x003f('0xcd')](_0x3a5866[_0x003f('0x47')]);_0x402ef2[_0x003f('0xcf')]=_['intersection'](_0x402ef2[_0x003f('0xcc')],_0x402ef2['query']);_0x109fbc[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x402ef2[_0x003f('0xcc')],qs[_0x003f('0xd1')](_0x3a5866['query'][_0x003f('0xd1')]));_0x109fbc['attributes']=_0x109fbc[_0x003f('0x4c')][_0x003f('0x50')]?_0x109fbc[_0x003f('0x4c')]:_0x402ef2[_0x003f('0xcc')];_0x109fbc[_0x003f('0xd2')]=qs['sort'](_0x3a5866['query']['sort']);_0x109fbc[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x3a5866['query'],_0x402ef2[_0x003f('0xcf')]));if(_0x3a5866['query'][_0x003f('0x35')]){_0x109fbc[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x109fbc[_0x003f('0x46')],{'$or':_[_0x003f('0x37')](_0x109fbc['attributes'],function(_0x3b918f){var _0x3a017f={};_0x3a017f[_0x3b918f]={'$like':'%'+_0x3a5866['query'][_0x003f('0x35')]+'%'};return _0x3a017f;})});}_0x109fbc=_[_0x003f('0x5c')]({},_0x109fbc,_0x3a5866[_0x003f('0x5d')]);return _0x1509ce['getTeams'](_0x109fbc);}})[_0x003f('0x20')](function(_0x1810d7){if(_0x1810d7){_0x506120=_0x1810d7[_0x003f('0x50')];if(!_0x3a5866[_0x003f('0x47')][_0x003f('0xc6')](_0x003f('0xd6'))){_0x109fbc[_0x003f('0x1d')]=qs[_0x003f('0x1d')](_0x3a5866['query'][_0x003f('0x1d')]);_0x109fbc[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x3a5866['query'][_0x003f('0x1c')]);}return _0x1509ce[_0x003f('0x10e')](_0x109fbc);}})[_0x003f('0x20')](function(_0x13783e){if(_0x13783e){return _0x13783e?{'count':_0x506120,'rows':_0x13783e}:null;}})[_0x003f('0x20')](respondWithResult(_0x39f149,null))[_0x003f('0x2b')](handleError(_0x39f149,null));};exports[_0x003f('0x110')]=function(_0xac68f7,_0x36c17e){var _0x3adbc1=_0xac68f7[_0x003f('0x59')]['id'];var _0x3c8c77=_0xac68f7[_0x003f('0x60')]?_0xac68f7[_0x003f('0x60')][_0x003f('0x63')]:null;var _0x507a6e=[];return Promise['resolve']()['then'](function(){if(!_0x3c8c77)throw new APIBadRequestError(_0x003f('0x111'));})[_0x003f('0x20')](function(){return db['User'][_0x003f('0x98')]({'where':{'id':_0x3adbc1}});})[_0x003f('0x20')](function(_0x3a8eed){if(!_0x3a8eed)throw new APINotFoundError(util[_0x003f('0xc4')](_0x003f('0xc5'),_0xac68f7[_0x003f('0x59')]['id']));return db[_0x003f('0x6d')]['transaction'](function(_0xd9b213){return _0x3a8eed[_0x003f('0x110')](_0x3c8c77,{'transaction':_0xd9b213})[_0x003f('0x20')](function(){return db[_0x003f('0x10f')]['findAll']({'where':{'id':{'$in':_0x3c8c77}}});})[_0x003f('0x20')](function(_0x56486a){var _0x2d2e07=_[_0x003f('0x37')](_0x56486a,function(_0x24c8e0){return _0x24c8e0[_0x003f('0x112')]();});return Promise[_0x003f('0x58')](_0x2d2e07);})[_0x003f('0x20')](function(_0x12d8bf){_0x507a6e=_[_0x003f('0x113')](_0x12d8bf);var _0xff4aa5=_['map'](_0x507a6e,function(_0x3521ad){return _0x3521ad[_0x003f('0x114')](_0x3a8eed['id'],{'transaction':_0xd9b213});});return Promise['all'](_0xff4aa5);})[_0x003f('0x20')](function(){if(!_0x3a8eed[_0x003f('0x100')])return;var _0x573e7e=_[_0x003f('0x35')](_0x507a6e,function(_0x474555){return _0x474555[_0x003f('0x115')](_0x003f('0xaa'))==='Voice';});var _0x288bf8=_['map'](_0x573e7e,function(_0xe216e9){return db['UserVoiceQueueRt'][_0x003f('0xf4')]({'membername':_0x3a8eed[_0x003f('0x3c')],'UserId':_0x3a8eed['id'],'queue_name':_0xe216e9['name'],'VoiceQueueId':_0xe216e9['id'],'interface':_[_0x003f('0x6b')](_0x3a8eed[_0x003f('0x9e')])?util[_0x003f('0xc4')](_0x003f('0xa9'),_0x3a8eed[_0x003f('0x3c')]):_0x3a8eed[_0x003f('0x9e')],'paused':_0x3a8eed[_0x003f('0x9d')]||![],'penalty':_0x3a8eed['penalty']},{'transaction':_0xd9b213});});return Promise['all'](_0x288bf8);})[_0x003f('0x20')](function(){return db[_0x003f('0x116')][_0x003f('0x4e')]({'where':{'teamId':{'$in':_0x3c8c77}}});})['then'](function(_0x452a4b){var _0x817692=_[_0x003f('0x37')](_0x452a4b,function(_0x69c4bc){return db[_0x003f('0x117')][_0x003f('0x86')]({'UserId':_0x3a8eed['id'],'VoicePrefixId':_0x69c4bc[_0x003f('0x118')]},{'transaction':_0xd9b213});});return Promise[_0x003f('0x58')](_0x817692);});});})[_0x003f('0x20')](function(){for(var _0x4fc53f=0x0;_0x4fc53f<_0x507a6e[_0x003f('0x50')];_0x4fc53f++){var _0x18000c=_0x507a6e[_0x4fc53f]['getDataValue'](_0x003f('0xaa'));var _0x343b50=_0x18000c+_0x003f('0xa5');socket[_0x003f('0x2d')]('user'+_0x18000c+_0x003f('0xa7'),{'UserId':_0x3adbc1,['queueField']:_0x507a6e[_0x4fc53f]['id']});}})[_0x003f('0x20')](respondWithStatusCode(_0x36c17e,null))[_0x003f('0x2b')](APIHandleError(_0x36c17e));};exports[_0x003f('0x119')]=function(_0x3be56e,_0x41fc94){var _0x115811=_0x3be56e[_0x003f('0x59')]['id'];var _0x1babb5=null;if(_0x3be56e[_0x003f('0x47')][_0x003f('0x63')]){_0x1babb5=_[_0x003f('0xab')](_0x3be56e[_0x003f('0x47')]['ids'])?_0x3be56e[_0x003f('0x47')][_0x003f('0x63')]:[_0x3be56e['query']['ids']];}var _0xc4cf14=[];return Promise[_0x003f('0xfe')]()[_0x003f('0x20')](function(){if(!_0x1babb5)throw new APIBadRequestError(_0x003f('0x11a'));})[_0x003f('0x20')](function(){return db['User']['findOne']({'where':{'id':_0x115811}});})[_0x003f('0x20')](function(_0x495152){if(!_0x495152)throw new APINotFoundError(util['format'](_0x003f('0xc5'),_0x3be56e[_0x003f('0x59')]['id']));return db[_0x003f('0x6d')][_0x003f('0x11b')](function(_0x2c64a6){return _0x495152[_0x003f('0x119')](_0x1babb5,{'transaction':_0x2c64a6})['then'](function(){return db[_0x003f('0x10f')]['findAll']({'where':{'id':{'$in':_0x1babb5}}});})[_0x003f('0x20')](function(_0x14ee92){var _0x595b8e=_[_0x003f('0x37')](_0x14ee92,function(_0x227993){return _0x227993[_0x003f('0x112')]();});return Promise[_0x003f('0x58')](_0x595b8e);})[_0x003f('0x20')](function(_0x22421b){_0xc4cf14=_[_0x003f('0x113')](_0x22421b);var _0x2b3953=_['map'](_0xc4cf14,function(_0x1f22c2){return _0x1f22c2['removeAgent'](_0x495152['id'],{'transaction':_0x2c64a6});});return Promise[_0x003f('0x58')](_0x2b3953);})[_0x003f('0x20')](function(){if(!_0x495152['online'])return;var _0x5dd560=_['filter'](_0xc4cf14,function(_0x4cdd36){return _0x4cdd36[_0x003f('0x115')](_0x003f('0xaa'))==='Voice';});var _0x5be7c6=_[_0x003f('0x37')](_0x5dd560,function(_0x5d07b4){return db[_0x003f('0xf0')][_0x003f('0x2e')]({'where':{'VoiceQueueId':_0x5d07b4['id'],'UserId':_0x495152['id']},'transaction':_0x2c64a6});});return Promise[_0x003f('0x58')](_0x5be7c6);})[_0x003f('0x20')](function(){return db[_0x003f('0x116')][_0x003f('0x4e')]({'where':{'teamId':{'$in':_0x1babb5}}});})['then'](function(_0x1baa21){var _0x5e6995=_[_0x003f('0x37')](_0x1baa21,function(_0x5942ca){return db[_0x003f('0x117')][_0x003f('0x2e')]({'where':{'UserId':_0x495152['id'],'VoicePrefixId':_0x5942ca[_0x003f('0x118')]}},{'transaction':_0x2c64a6});});return Promise[_0x003f('0x58')](_0x5e6995);});});})['then'](function(){for(var _0x2671f1=0x0;_0x2671f1<_0xc4cf14['length'];_0x2671f1++){var _0x17f4cd=_0xc4cf14[_0x2671f1][_0x003f('0x115')](_0x003f('0xaa'));var _0x49cbb7=_0x17f4cd+_0x003f('0xa5');socket[_0x003f('0x2d')](_0x003f('0x80')+_0x17f4cd+_0x003f('0xac'),{'UserId':_0x115811,['queueField']:_0xc4cf14[_0x2671f1]['id']});}})[_0x003f('0x20')](respondWithStatusCode(_0x41fc94,null))[_0x003f('0x2b')](APIHandleError(_0x41fc94));};exports['getLists']=function(_0xf5a5f,_0x8dd7f2){var _0xe97932={};var _0x1a629c={};var _0x4466a9;var _0x5b2e25;return db['User'][_0x003f('0x98')]({'where':{'id':_0xf5a5f[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x8dd7f2,null))['then'](function(_0x3ceeac){if(_0x3ceeac){_0x4466a9=_0x3ceeac;_0x1a629c[_0x003f('0xcc')]=_[_0x003f('0xcd')](db['CmList'][_0x003f('0x3f')]);_0x1a629c[_0x003f('0x47')]=_['keys'](_0xf5a5f['query']);_0x1a629c[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x1a629c[_0x003f('0xcc')],_0x1a629c[_0x003f('0x47')]);_0xe97932[_0x003f('0x4c')]=_[_0x003f('0xd0')](_0x1a629c[_0x003f('0xcc')],qs[_0x003f('0xd1')](_0xf5a5f['query']['fields']));_0xe97932[_0x003f('0x4c')]=_0xe97932[_0x003f('0x4c')][_0x003f('0x50')]?_0xe97932['attributes']:_0x1a629c[_0x003f('0xcc')];_0xe97932[_0x003f('0xd2')]=qs[_0x003f('0xd3')](_0xf5a5f[_0x003f('0x47')][_0x003f('0xd3')]);_0xe97932[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0xf5a5f[_0x003f('0x47')],_0x1a629c[_0x003f('0xcf')]));if(_0xf5a5f[_0x003f('0x47')]['filter']){_0xe97932[_0x003f('0x46')]=_[_0x003f('0x5c')](_0xe97932['where'],{'$or':_['map'](_0xe97932['attributes'],function(_0x15087c){var _0x3911b2={};_0x3911b2[_0x15087c]={'$like':'%'+_0xf5a5f[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x3911b2;})});}_0xe97932=_[_0x003f('0x5c')]({},_0xe97932,_0xf5a5f[_0x003f('0x5d')]);return _0x4466a9['getLists'](_0xe97932);}})['then'](function(_0x474f9d){if(_0x474f9d){_0x5b2e25=_0x474f9d[_0x003f('0x50')];if(!_0xf5a5f[_0x003f('0x47')][_0x003f('0xc6')]('nolimit')){_0xe97932[_0x003f('0x1d')]=qs['limit'](_0xf5a5f[_0x003f('0x47')][_0x003f('0x1d')]);_0xe97932[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0xf5a5f[_0x003f('0x47')]['offset']);}return _0x4466a9[_0x003f('0x11c')](_0xe97932);}})[_0x003f('0x20')](function(_0x3675b8){if(_0x3675b8){return _0x3675b8?{'count':_0x5b2e25,'rows':_0x3675b8}:null;}})['then'](respondWithResult(_0x8dd7f2,null))[_0x003f('0x2b')](handleError(_0x8dd7f2,null));};exports['getAgents']=function(_0x526a1c,_0x1a3ba5){var _0x3a6283={};var _0x1c6638={};var _0x46fd4d;return db[_0x003f('0x3e')][_0x003f('0x98')]({'where':{'id':_0x526a1c[_0x003f('0x59')]['id']}})[_0x003f('0x20')](handleEntityNotFound(_0x1a3ba5,null))[_0x003f('0x20')](function(_0x4151a1){if(_0x4151a1){_0x46fd4d=_0x4151a1;_0x1c6638[_0x003f('0xcc')]=_[_0x003f('0xcd')](db[_0x003f('0x3e')][_0x003f('0x3f')]);_0x1c6638['query']=_['keys'](_0x526a1c[_0x003f('0x47')]);_0x1c6638[_0x003f('0xcf')]=_[_0x003f('0xd0')](_0x1c6638['model'],_0x1c6638[_0x003f('0x47')]);_0x3a6283[_0x003f('0x4c')]=_['intersection'](_0x1c6638[_0x003f('0xcc')],qs[_0x003f('0xd1')](_0x526a1c[_0x003f('0x47')][_0x003f('0xd1')]));_0x3a6283[_0x003f('0x4c')]=_0x3a6283['attributes'][_0x003f('0x50')]?_0x3a6283[_0x003f('0x4c')]:_0x1c6638[_0x003f('0xcc')];_0x3a6283[_0x003f('0xd2')]=qs['sort'](_0x526a1c[_0x003f('0x47')][_0x003f('0xd3')]);_0x3a6283[_0x003f('0x46')]=qs[_0x003f('0xcf')](_[_0x003f('0xd4')](_0x526a1c[_0x003f('0x47')],_0x1c6638[_0x003f('0xcf')]));if(_0x526a1c[_0x003f('0x47')]['filter']){_0x3a6283[_0x003f('0x46')]=_[_0x003f('0x5c')](_0x3a6283[_0x003f('0x46')],{'$or':_['map'](_0x3a6283[_0x003f('0x4c')],function(_0x42638a){var _0x3f0b6e={};_0x3f0b6e[_0x42638a]={'$like':'%'+_0x526a1c[_0x003f('0x47')][_0x003f('0x35')]+'%'};return _0x3f0b6e;})});}_0x3a6283[_0x003f('0xcc')]=db[_0x003f('0x3e')];_0x3a6283['as']=_0x003f('0x32');_0x3a6283=_[_0x003f('0x5c')]({},_0x3a6283,_0x526a1c[_0x003f('0x5d')]);return _0x46fd4d[_0x003f('0xf2')]({'include':[_0x3a6283]});}})[_0x003f('0x20')](function(_0x2171d3){if(_0x2171d3){var _0x36b07f={},_0x5d6fb8=[];for(var _0x14d710=0x0;_0x14d710<_0x2171d3[_0x003f('0x50')];_0x14d710+=0x1){for(var _0x320e4b=0x0,_0x264bc8;_0x320e4b<_0x2171d3[_0x14d710]['Agents'][_0x003f('0x50')];_0x320e4b+=0x1){_0x264bc8=_0x2171d3[_0x14d710][_0x003f('0x32')][_0x320e4b][_0x003f('0x2f')]({'plain':!![]});_0x36b07f[_0x264bc8['id']]=_0x264bc8;}}_0x36b07f=_[_0x003f('0x11d')](_0x36b07f);for(var _0x360d76=qs[_0x003f('0x1c')](_0x526a1c['query'][_0x003f('0x1c')]);_0x360d76<_0x36b07f[_0x003f('0x50')]&&_0x5d6fb8[_0x003f('0x50')]=_0x136dbd){_0x2e391a=_0x136dbd;_0x32e753=0xc8;}else{_0x32e753=0xce;}_0x469264[_0x7955('0x17')](_0x32e753);return _0x469264[_0x7955('0x18')](_0x7955('0x19'),_0x48bc3a+'-'+_0x2e391a+'/'+_0x136dbd)[_0x7955('0x13')](_0x40d7a9);}return null;};}function respondWithRpcPromise(_0x22e4c9,_0x2e2569,_0x2fc8f0,_0x4366d9){return new Promise(function(_0x38ee27,_0x48d4f8){var _0x3ef3e9=_0x4366d9||amiClient;return _0x3ef3e9[_0x7955('0x1a')](_0x22e4c9,_0x2fc8f0)[_0x7955('0x1b')](function(_0x2b5fc3){logger[_0x7955('0x1c')](_0x7955('0x1d'),_0x2e2569,_0x7955('0x1e'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x2e2569,_0x7955('0x1e'),JSON[_0x7955('0x1f')](_0x2b5fc3));if(_0x2b5fc3['error']){if(_0x2b5fc3['error']['code']===0x1f4){logger[_0x7955('0x20')](_0x7955('0x1d'),_0x2e2569,_0x2b5fc3['error'][_0x7955('0x21')]);return _0x48d4f8(_0x2b5fc3[_0x7955('0x20')][_0x7955('0x21')]);}logger[_0x7955('0x20')](_0x7955('0x1d'),_0x2e2569,_0x2b5fc3['error'][_0x7955('0x21')]);return _0x38ee27(_0x2b5fc3[_0x7955('0x20')][_0x7955('0x21')]);}else{logger[_0x7955('0x1c')]('User,\x20%s,\x20%s',_0x2e2569,'request\x20sent');_0x38ee27(_0x2b5fc3['result'][_0x7955('0x21')]);}})['catch'](function(_0x400a0e){logger[_0x7955('0x20')](_0x7955('0x1d'),_0x2e2569,_0x400a0e);_0x48d4f8(_0x400a0e);});});}function saveUpdates(_0x673a10){return function(_0x5c5e02){if(_0x5c5e02){return _0x5c5e02['update'](_0x673a10)['then'](function(_0xdbdcee){if(_0xdbdcee[_0x7955('0x22')]===_0x7955('0x23')){socket[_0x7955('0x24')](_0x7955('0x25')+_0xdbdcee['id'],_0xdbdcee);}return _0xdbdcee;});}return null;};}function removeEntity(_0x5cb7e0,_0x5cab52){return function(_0x451f7f){if(_0x451f7f){return _0x451f7f[_0x7955('0x26')]({'transaction':_0x5cab52})[_0x7955('0x1b')](function(){var _0x4fb9bb=_0x451f7f[_0x7955('0x27')]({'plain':!![]});if(_0x4fb9bb['role']===_0x7955('0x28'))return;var _0x3e0545=[{'name':_0x7955('0x29'),'value':_0x7955('0x2a'),'ignore':!![]},{'name':_0x7955('0x2b'),'value':_0x7955('0x23'),'ignore':![]},{'name':'Telephones','value':_0x7955('0x2c'),'ignore':![]}];var _0x2eda9d=_(_0x3e0545)[_0x7955('0x2d')](_0x7955('0x2e'))[_0x7955('0x2f')](_0x7955('0x30'))[_0x7955('0x30')]();if(_['includes'](_0x2eda9d,_0x4fb9bb['role'])){return;}var _0x5e97cb=_['find'](_0x3e0545,[_0x7955('0x30'),_0x4fb9bb[_0x7955('0x22')]])[_0x7955('0x31')];return db[_0x7955('0x32')][_0x7955('0x26')]({'where':{'type':_0x5e97cb,'resourceId':_0x4fb9bb['id']},'transaction':_0x5cab52})[_0x7955('0x1b')](function(){return _0x451f7f;});})[_0x7955('0x1b')](function(){_0x5cb7e0['status'](0xcc)[_0x7955('0x12')]();});}};}function handleEntityNotFound(_0x481148){return function(_0x4e10f6){if(!_0x4e10f6){_0x481148['sendStatus'](0x194);}return _0x4e10f6;};}function handleError(_0xe143cd,_0x1c3f12){_0x1c3f12=_0x1c3f12||0x1f4;return function(_0x4ca3c9){logger[_0x7955('0x20')](_0x4ca3c9[_0x7955('0x33')]);if(_0x4ca3c9[_0x7955('0x31')]){delete _0x4ca3c9[_0x7955('0x31')];}_0xe143cd[_0x7955('0x17')](_0x1c3f12)['send'](_0x4ca3c9);};}function getUserAttributes(){return _(db[_0x7955('0x34')][_0x7955('0x35')])['map'](function(_0x5ef45b){return{'name':_0x5ef45b['fieldName'],'type':_0x5ef45b[_0x7955('0x36')]['key']};})['filter'](function(_0x4577ae){return![_0x7955('0x37'),_0x7955('0x38'),'previousPasswords',_0x7955('0x39'),_0x7955('0x3a'),_0x7955('0x3b')][_0x7955('0x3c')](_0x4577ae[_0x7955('0x31')]);})['value']();}exports['index']=function(_0x33a753,_0x375164){var _0x495bad={},_0x56c4eb={'count':0x0,'rows':[]};var _0x17845d=getUserAttributes();_0x495bad=qs[_0x7955('0x3d')](_0x17845d,_0x33a753);var _0x37a4f0={'where':_0x495bad[_0x7955('0x3e')]};return db[_0x7955('0x34')][_0x7955('0x16')](_0x37a4f0)[_0x7955('0x1b')](function(_0x4f8557){_0x56c4eb[_0x7955('0x16')]=_0x4f8557;if(_0x33a753[_0x7955('0x3f')][_0x7955('0x40')]){_0x495bad[_0x7955('0x41')]=[{'all':!![]}];}if(_0x33a753[_0x7955('0x3f')]['userSetting']===_0x7955('0x42')){_0x495bad['include']=[{'model':db[_0x7955('0x43')],'as':_0x7955('0x44')}];}if(!_[_0x7955('0x3c')](_0x495bad[_0x7955('0x45')],'id')){_0x495bad[_0x7955('0x45')][_0x7955('0x46')]('id');}return db[_0x7955('0x34')]['findAll'](_0x495bad);})[_0x7955('0x1b')](function(_0x1df586){_0x56c4eb[_0x7955('0x47')]=_0x1df586;if(_0x33a753[_0x7955('0x3f')]['openTabs']===_0x7955('0x42')){var _0x239590=[];for(var _0x19fb7a=0x0;_0x19fb7a<_0x56c4eb['rows'][_0x7955('0x48')];_0x19fb7a++){_0x239590[_0x7955('0x46')](get_open_tabs('chat',_0x56c4eb[_0x7955('0x47')][_0x19fb7a][_0x7955('0x49')]));_0x239590[_0x7955('0x46')](get_open_tabs(_0x7955('0x4a'),_0x56c4eb[_0x7955('0x47')][_0x19fb7a]['dataValues']));_0x239590['push'](get_open_tabs('fax',_0x56c4eb[_0x7955('0x47')][_0x19fb7a][_0x7955('0x49')]));_0x239590['push'](get_open_tabs('mail',_0x56c4eb[_0x7955('0x47')][_0x19fb7a][_0x7955('0x49')]));_0x239590['push'](get_open_tabs(_0x7955('0x4b'),_0x56c4eb[_0x7955('0x47')][_0x19fb7a][_0x7955('0x49')]));_0x239590['push'](get_open_tabs(_0x7955('0x4c'),_0x56c4eb[_0x7955('0x47')][_0x19fb7a][_0x7955('0x49')]));}return Promise[_0x7955('0x4d')](_0x239590)[_0x7955('0x1b')](function(){return _0x56c4eb;});}else{return _0x56c4eb;}})[_0x7955('0x1b')](respondWithFilteredResult(_0x375164,_0x495bad))[_0x7955('0x4e')](handleError(_0x375164,null));};exports['show']=function(_0x2eab06,_0x61490f){var _0x59a8d8=getUserAttributes();_0x2eab06['query']['id']=_0x2eab06[_0x7955('0x4f')]['id'];var _0x45cd92=qs[_0x7955('0x3d')](_0x59a8d8,_0x2eab06);if(_0x2eab06['query'][_0x7955('0x40')]){_0x45cd92['include']=[{'all':!![]}];}if(_0x2eab06[_0x7955('0x3f')]['userSetting']==='true'){_0x45cd92['include']=[{'model':db[_0x7955('0x43')],'as':_0x7955('0x44')}];}_0x45cd92=_['merge']({},_0x45cd92,_0x2eab06[_0x7955('0x50')]);if(!_[_0x7955('0x3c')](_0x45cd92['attributes'],'id')){_0x45cd92[_0x7955('0x45')][_0x7955('0x46')]('id');}return db[_0x7955('0x34')][_0x7955('0x51')](_0x45cd92)[_0x7955('0x1b')](handleEntityNotFound(_0x61490f,null))['then'](function(_0x39b1ed){var _0x44919c=[];values=_0x39b1ed;if(_0x2eab06['query']['openTabs']==='true'){_0x44919c['push'](get_open_tabs(_0x7955('0x52'),_0x39b1ed[_0x7955('0x49')]));_0x44919c[_0x7955('0x46')](get_open_tabs(_0x7955('0x4a'),_0x39b1ed['dataValues']));_0x44919c[_0x7955('0x46')](get_open_tabs(_0x7955('0x4b'),_0x39b1ed[_0x7955('0x49')]));_0x44919c[_0x7955('0x46')](get_open_tabs(_0x7955('0x4c'),_0x39b1ed[_0x7955('0x49')]));_0x44919c[_0x7955('0x46')](get_open_tabs('fax',_0x39b1ed['dataValues']));_0x44919c[_0x7955('0x46')](get_open_tabs(_0x7955('0x53'),_0x39b1ed['dataValues']));return Promise[_0x7955('0x4d')](_0x44919c);}else{return values;}})[_0x7955('0x1b')](function(){return values;})[_0x7955('0x1b')](respondWithResult(_0x61490f,null))[_0x7955('0x4e')](handleError(_0x61490f,null));};exports[_0x7955('0x54')]=function(_0x3e39ee,_0x1d99e9){if(_0x3e39ee[_0x7955('0x55')]['id']){delete _0x3e39ee[_0x7955('0x55')]['id'];}delete _0x3e39ee['body']['role'];return db[_0x7955('0x34')]['find']({'where':{'id':_0x3e39ee[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x1d99e9,null))[_0x7955('0x1b')](saveUpdates(_0x3e39ee['body'],null))['then'](respondWithResult(_0x1d99e9,null))['catch'](handleError(_0x1d99e9,null));};exports[_0x7955('0x56')]=function(_0x322d16,_0x4a4b58){return db[_0x7955('0x34')][_0x7955('0x56')]()[_0x7955('0x1b')](respondWithResult(_0x4a4b58,null))[_0x7955('0x4e')](handleError(_0x4a4b58,null));};exports['addContacts']=function(_0x2fa8e7,_0x45f3e5){return db[_0x7955('0x34')]['find']({'where':{'id':_0x2fa8e7[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x45f3e5,null))[_0x7955('0x1b')](function(_0x2448d8){if(_0x2448d8){return _0x2448d8[_0x7955('0x57')](_0x2fa8e7[_0x7955('0x55')][_0x7955('0x58')],_[_0x7955('0x59')](_0x2fa8e7['body'],['ids','id'])||{});}})[_0x7955('0x1b')](respondWithResult(_0x45f3e5,null))[_0x7955('0x4e')](handleError(_0x45f3e5,null));};function validateUser(_0x1b8353){return new Promise(function(_0x3bb9ac,_0x5d15e3){if(_0x1b8353[_0x7955('0x5a')])return _0x3bb9ac(_0x1b8353);return db[_0x7955('0x5b')][_0x7955('0x5c')](0x1)['then'](function(_0x5e37dd){if(_0x5e37dd[_0x7955('0x5d')])authService[_0x7955('0x5e')](_0x1b8353['password']);db[_0x7955('0x34')][_0x7955('0x5f')]('internal')[_0x7955('0x1b')](function(_0x36c257){if(_[_0x7955('0x60')](_0x36c257)){_0x1b8353[_0x7955('0x5a')]=_0x5e37dd[_0x7955('0x61')]||0x1;return;}if(_[_0x7955('0x60')](_0x5e37dd['min_internal'])||_0x5e37dd[_0x7955('0x61')]===_0x36c257){_0x1b8353[_0x7955('0x5a')]=_0x36c257+0x1;return;}if(_0x5e37dd['min_internal']>_0x36c257){_0x1b8353[_0x7955('0x5a')]=_0x5e37dd[_0x7955('0x61')];return;}return db[_0x7955('0x62')][_0x7955('0x3f')]('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'][_0x7955('0x63')][_0x7955('0x64')]})[_0x7955('0x1b')](function(_0x2e5a54){if(_0x2e5a54&&_0x2e5a54[_0x7955('0x48')]){for(var _0x14943=0x0,_0x1a625d=_0x2e5a54[_0x7955('0x48')];_0x14943<_0x1a625d&&_[_0x7955('0x60')](_0x1b8353[_0x7955('0x5a')]);_0x14943++){if(_0x5e37dd[_0x7955('0x61')]<=_0x2e5a54[_0x14943][_0x7955('0x65')]){_0x1b8353[_0x7955('0x5a')]=_0x2e5a54[_0x14943][_0x7955('0x65')];}else if(_0x5e37dd[_0x7955('0x61')]>_0x2e5a54[_0x14943][_0x7955('0x65')]&&_0x5e37dd[_0x7955('0x61')]<=_0x2e5a54[_0x14943]['to']){_0x1b8353['internal']=_0x5e37dd['min_internal'];}}}if(_[_0x7955('0x60')](_0x1b8353[_0x7955('0x5a')])){_0x1b8353[_0x7955('0x5a')]=_0x36c257+0x1;}return _0x3bb9ac(_0x1b8353);});});})[_0x7955('0x4e')](function(_0x4914d1){_0x5d15e3(_0x4914d1);});});}function updateUser(_0x33d411){return new Promise(function(_0x3f9e02,_0x488be9){try{if(_0x33d411[_0x7955('0x66')]){_0x33d411[_0x7955('0x67')]=_0x33d411[_0x7955('0x5a')];_0x33d411[_0x7955('0x68')]={'mailbox':_0x33d411[_0x7955('0x5a')],'password':_0x33d411['password'],'fullname':_0x33d411[_0x7955('0x69')],'email':_0x33d411[_0x7955('0x6a')]};}if(_0x33d411['role']===_0x7955('0x23')){if(!_0x33d411[_0x7955('0x6b')])_0x33d411[_0x7955('0x6b')]=['101',_0x7955('0x6c'),_0x7955('0x6d'),'113','110',_0x7955('0x6e'),'105',_0x7955('0x6f'),_0x7955('0x70'),_0x7955('0x71'),_0x7955('0x72'),_0x7955('0x73'),_0x7955('0x74'),_0x7955('0x75'),_0x7955('0x76')];}_0x3f9e02(_0x33d411);}catch(_0x4357d8){_0x488be9(_0x4357d8);}});}exports['create']=function(_0x38d3f8,_0x25eae9){if(_0x38d3f8[_0x7955('0x2a')][_0x7955('0x22')]===_0x7955('0x23'))throw new Error('Unauthorized');if(_0x38d3f8[_0x7955('0x55')][_0x7955('0x22')]===_0x7955('0x2a')&&_0x38d3f8[_0x7955('0x2a')][_0x7955('0x22')]!==_0x7955('0x28')){throw new Error(_0x7955('0x77'));}if(_0x38d3f8[_0x7955('0x55')][_0x7955('0x22')]===_0x7955('0x28')&&_0x38d3f8['user'][_0x7955('0x22')]!=='admin'){throw new Error(_0x7955('0x78'));}return licenseUtil['checkUserLimits']([_0x38d3f8[_0x7955('0x55')]])[_0x7955('0x1b')](function(){return validateUser(_0x38d3f8[_0x7955('0x55')]);})['then'](function(_0x159acb){return updateUser(_0x159acb)[_0x7955('0x1b')](function(_0x59a3da){if(_0x59a3da[_0x7955('0x22')]===_0x7955('0x28')){_0x59a3da[_0x7955('0x79')]=_0x38d3f8[_0x7955('0x2a')]['settingsEnabled'];delete _0x59a3da[_0x7955('0x7a')];}return _0x59a3da;});})[_0x7955('0x1b')](function(_0x46c624){return db[_0x7955('0x34')]['create'](_0x46c624,{'include':[{'model':db[_0x7955('0x68')],'as':_0x7955('0x68')}]});})[_0x7955('0x1b')](function(_0x4544b8){if(_0x38d3f8[_0x7955('0x55')][_0x7955('0x22')]===_0x7955('0x2a'))return _0x4544b8;if(_0x38d3f8['user'][_0x7955('0x22')]!==_0x7955('0x2a'))return _0x4544b8;return db[_0x7955('0x7b')]['find']({'where':{'name':_0x4544b8[_0x7955('0x22')]===_0x7955('0x23')?_0x7955('0x2b'):_0x7955('0x7c'),'userProfileId':_0x38d3f8[_0x7955('0x2a')][_0x7955('0x7a')]},'raw':!![]})[_0x7955('0x1b')](function(_0x9cad0f){if(!_0x9cad0f||_0x9cad0f[_0x7955('0x7d')]!=0x0)return _0x4544b8;return db[_0x7955('0x32')][_0x7955('0x7e')]({'name':_0x4544b8['name'],'resourceId':_0x4544b8['id'],'type':_0x9cad0f['name'],'sectionId':_0x9cad0f['id']},{})[_0x7955('0x1b')](function(){return _0x4544b8;});})[_0x7955('0x4e')](function(_0x9dd1be){logger[_0x7955('0x20')](_0x7955('0x7f'),_0x9dd1be);throw _0x9dd1be;});})['then'](respondWithResult(_0x25eae9,0xc9))[_0x7955('0x4e')](handleError(_0x25eae9,null));};exports['bulkCreate']=function(_0x2b5920,_0x56dba3){var _0x4c0365=_0x2b5920[_0x7955('0x55')];var _0x6f912d=[];if(_0x2b5920['user'][_0x7955('0x22')]===_0x7955('0x23'))throw new Error(_0x7955('0x80'));if(_['some'](_0x4c0365,['role','user'])&&_0x2b5920[_0x7955('0x2a')][_0x7955('0x22')]!==_0x7955('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x7955('0x81')](_0x4c0365,[_0x7955('0x22'),_0x7955('0x28')])&&_0x2b5920[_0x7955('0x2a')][_0x7955('0x22')]!==_0x7955('0x28')){throw new Error(_0x7955('0x82'));}return licenseUtil[_0x7955('0x83')](_0x4c0365)['then'](function(){return validateUser(_0x4c0365[0x0]);})[_0x7955('0x1b')](function(){for(var _0x5264a5=0x1;_0x5264a5<_0x4c0365[_0x7955('0x48')];_0x5264a5++){var _0x90c5ee=_0x4c0365[_0x5264a5-0x1][_0x7955('0x5a')];if(!_0x4c0365[_0x5264a5][_0x7955('0x5a')])_0x4c0365[_0x5264a5][_0x7955('0x5a')]=_0x90c5ee+0x1;_0x6f912d[_0x7955('0x46')](validateUser(_0x4c0365[_0x5264a5]));}return Promise[_0x7955('0x4d')](_0x6f912d);})[_0x7955('0x1b')](function(){_0x6f912d=[];for(var _0x4ce56c=0x0;_0x4ce56c<_0x4c0365[_0x7955('0x48')];_0x4ce56c++){_0x6f912d[_0x7955('0x46')](updateUser(_0x4c0365[_0x4ce56c]));}return Promise[_0x7955('0x4d')](_0x6f912d);})['then'](function(){_0x6f912d=_0x4c0365[_0x7955('0x2f')](function(_0x145e9d){return db[_0x7955('0x34')][_0x7955('0x7e')](_0x145e9d,{'include':[{'model':db[_0x7955('0x68')],'as':_0x7955('0x68')}]})[_0x7955('0x1b')](function(_0x3529e2){_0x145e9d['id']=_0x3529e2['id'];return _0x145e9d;});});return Promise[_0x7955('0x4d')](_0x6f912d);})[_0x7955('0x1b')](function(_0x3cc228){if(_0x2b5920[_0x7955('0x55')][_0x7955('0x22')]===_0x7955('0x2a'))return _0x3cc228;if(_0x2b5920[_0x7955('0x2a')][_0x7955('0x22')]!==_0x7955('0x2a'))return _0x3cc228;var _0x3ad5c8=_[_0x7955('0x81')](_0x3cc228,function(_0x2c31f7){return _0x2c31f7[_0x7955('0x22')]==='agent'||_0x2c31f7[_0x7955('0x22')]===_0x7955('0x2c');});if(!_0x3ad5c8)return _0x3cc228;return db[_0x7955('0x7b')][_0x7955('0x84')]({'where':{'name':{'$or':[_0x7955('0x2b'),'Telephones']},'userProfileId':_0x2b5920[_0x7955('0x2a')][_0x7955('0x7a')]},'raw':!![]})[_0x7955('0x1b')](function(_0x277fde){if(_[_0x7955('0x85')](_0x277fde)||!_[_0x7955('0x81')](_0x277fde,['autoAssociation',0x0]))return _0x3cc228;_0x6f912d=[];var _0xa47d1b=_(_0x277fde)['map'](function(_0x1b8873){if(_0x1b8873[_0x7955('0x7d')]===0x1)return;return _0x1b8873[_0x7955('0x31')]===_0x7955('0x2b')?'agent':_0x7955('0x2c');})[_0x7955('0x86')]()['value']();for(var _0x3ba294=0x0;_0x3ba294<_0x3cc228[_0x7955('0x48')];_0x3ba294++){if(!_[_0x7955('0x3c')](_0xa47d1b,_0x3cc228[_0x3ba294][_0x7955('0x22')]))return;var _0x200555=_0x3cc228[_0x3ba294]['role']===_0x7955('0x23')?'Agents':'Telephones';_0x6f912d[_0x7955('0x46')](db['UserProfileResource']['create']({'name':_0x3cc228[_0x3ba294][_0x7955('0x31')],'resourceId':_0x3cc228[_0x3ba294]['id'],'type':_0x200555,'sectionId':_['find'](_0x277fde,[_0x7955('0x31'),_0x200555])['id']},{}));}return Promise[_0x7955('0x4d')](_0x6f912d);});})[_0x7955('0x1b')](respondWithResult(_0x56dba3,0xc9))[_0x7955('0x4e')](handleError(_0x56dba3,null));};exports[_0x7955('0x87')]=function(_0x3b5f96,_0x356abe){if(_0x3b5f96[_0x7955('0x55')]['id']){delete _0x3b5f96[_0x7955('0x55')]['id'];}return db['User'][_0x7955('0x51')]({'where':{'id':_0x3b5f96[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](function(_0x2a0551){if(!_0x2a0551)return null;if(_0x2a0551['id']===_0x3b5f96['user']['id']){if(!_0x3b5f96['body']['oldPassword']||!_0x3b5f96[_0x7955('0x55')][_0x7955('0x88')]){throw new db[(_0x7955('0x89'))][(_0x7955('0x8a'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2a0551['authenticate'](_0x3b5f96['body']['oldPassword'])){throw new db['Sequelize'][(_0x7955('0x8a'))]('Wrong\x20credentials');}if(_0x3b5f96[_0x7955('0x55')][_0x7955('0x8b')]===_0x3b5f96[_0x7955('0x55')][_0x7955('0x88')]){throw new db[(_0x7955('0x89'))][(_0x7955('0x8a'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x3b5f96[_0x7955('0x2a')][_0x7955('0x22')]===_0x7955('0x28')){if(!_0x3b5f96[_0x7955('0x55')][_0x7955('0x88')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x3b5f96['user'][_0x7955('0x22')]===_0x7955('0x2a')){if(!_0x3b5f96['body'][_0x7955('0x88')]){throw new db['Sequelize'][(_0x7955('0x8a'))](_0x7955('0x8c'));}if(_0x2a0551[_0x7955('0x22')]!==_0x7955('0x23')){throw new db[(_0x7955('0x89'))][(_0x7955('0x8a'))]('Unauthorized');}}else{throw new db[(_0x7955('0x89'))][(_0x7955('0x8a'))]('Unauthorized');}return _0x2a0551;})[_0x7955('0x1b')](handleEntityNotFound(_0x356abe,null))[_0x7955('0x1b')](function(_0x265821){return db[_0x7955('0x5b')]['findOne']({'attributes':['id',_0x7955('0x5d'),_0x7955('0x8d'),_0x7955('0x8e')]})[_0x7955('0x1b')](function(_0x183dae){if(_0x183dae[_0x7955('0x5d')])authService['validatePasswordPattern'](_0x3b5f96['body'][_0x7955('0x88')]);if(!_0x183dae[_0x7955('0x8d')]||!_0x265821[_0x7955('0x8f')])return _0x265821;authService[_0x7955('0x90')](_0x3b5f96[_0x7955('0x55')][_0x7955('0x88')],_0x265821['previousPasswords'],_0x183dae[_0x7955('0x8e')]);return _0x265821;})['then'](saveUpdates({'password':_0x3b5f96[_0x7955('0x55')]['newPassword'],'passwordResetAt':_0x3b5f96[_0x7955('0x2a')]['id']==_0x3b5f96[_0x7955('0x4f')]['id']?moment():null,'previousPasswords':authService[_0x7955('0x91')](_0x3b5f96[_0x7955('0x55')][_0x7955('0x88')],_0x265821['previousPasswords'])},null));})[_0x7955('0x1b')](respondWithResult(_0x356abe,null))[_0x7955('0x4e')](handleError(_0x356abe,null));};exports[_0x7955('0x92')]=function(_0x27411a,_0x2fac28){var _0x59663e=_0x27411a['body'][_0x7955('0x93')];return db['User']['find']({'where':{'id':_0x27411a[_0x7955('0x4f')]['id']},'attributes':['id',_0x7955('0x31'),_0x7955('0x22'),_0x7955('0x94'),_0x7955('0x95'),_0x7955('0x96'),_0x7955('0x97')]})['then'](handleEntityNotFound(_0x2fac28,null))[_0x7955('0x1b')](function(_0x364752){if(_0x364752){if(!utils['isValidChannel'](_0x59663e)){throw new db['Sequelize'][(_0x7955('0x8a'))](_0x7955('0x98'));}return _0x364752['add'+_[_0x7955('0x99')](_0x59663e[_0x7955('0x9a')]())+_0x7955('0x9b')](_0x27411a[_0x7955('0x55')]['ids'],{'penalty':_0x27411a[_0x7955('0x55')][_0x7955('0x9c')]||0x0})[_0x7955('0x9d')](function(_0x5e9755){for(var _0x3da0ae=0x0;_0x3da0ae<_0x27411a[_0x7955('0x55')]['ids'][_0x7955('0x48')];_0x3da0ae+=0x1){var _0x5a697d={'UserId':Number(_0x27411a[_0x7955('0x4f')]['id'])};_0x5a697d[_[_0x7955('0x99')](_0x59663e[_0x7955('0x9a')]())+_0x7955('0x9e')]=Number(_0x27411a[_0x7955('0x55')]['ids'][_0x3da0ae]);socket[_0x7955('0x24')](_0x7955('0x2a')+_['capitalize'](_0x59663e[_0x7955('0x9a')]())+_0x7955('0x9f'),_0x5a697d);}return _0x5e9755;})[_0x7955('0x1b')](function(){if(_0x59663e==='voice'){return db[_0x7955('0xa0')][_0x7955('0x84')]({'where':{'id':_0x27411a[_0x7955('0x55')][_0x7955('0x58')]||[]},'raw':!![],'attributes':['id',_0x7955('0x31')]});}})[_0x7955('0x1b')](function(_0x1129b7){var _0x386631=_0x364752['get']({'plain':!![]});var _0xcadbed=[];if(_0x59663e==='voice'&&_0x386631[_0x7955('0x22')]===_0x7955('0x23')&&_0x386631[_0x7955('0x94')]){for(let _0x3a1361=0x0;_0x3a1361<_0x1129b7[_0x7955('0x48')];_0x3a1361+=0x1){_0xcadbed[_0x7955('0x46')]({'membername':_0x386631[_0x7955('0x31')],'UserId':_0x386631['id'],'queue_name':_0x1129b7[_0x3a1361]['name'],'VoiceQueueId':_0x1129b7[_0x3a1361]['id'],'interface':_[_0x7955('0x60')](_0x386631[_0x7955('0x97')])?util['format'](_0x7955('0xa1'),_0x386631['name']):_0x386631[_0x7955('0x97')],'paused':_0x386631[_0x7955('0x96')]||![],'penalty':_0x27411a['body']['penalty']||0x0});}return Promise['all'](_0xcadbed['map'](function(_0x2f849a){return db[_0x7955('0xa2')][_0x7955('0xa3')](_0x2f849a);}));}return _0x364752;});}})[_0x7955('0x1b')](respondWithStatusCode(_0x2fac28,null))[_0x7955('0x4e')](handleError(_0x2fac28,null));};exports[_0x7955('0xa4')]=function(_0x187052,_0x55b0cd){var _0x59ad3a,_0x124363;return db[_0x7955('0x34')][_0x7955('0x51')]({'where':{'id':_0x187052['params']['id']},'attributes':['id',_0x7955('0x31'),_0x7955('0x22')]})['then'](handleEntityNotFound(_0x55b0cd,null))[_0x7955('0x1b')](function(_0x560942){if(_0x560942){_0x59ad3a=_0x560942;if(!_0x187052['query'][_0x7955('0x93')]||!utils[_0x7955('0xa5')](_0x187052[_0x7955('0x3f')][_0x7955('0x93')])){throw new db[(_0x7955('0x89'))][(_0x7955('0x8a'))](_0x7955('0x98'));}return _0x560942[_0x7955('0xa6')+_[_0x7955('0x99')](_0x187052[_0x7955('0x3f')]['channel'][_0x7955('0x9a')]())+_0x7955('0x9b')](_0x187052[_0x7955('0x3f')][_0x7955('0x58')]);}})[_0x7955('0x1b')](function(_0x53c1ef){if(_[_0x7955('0xa7')](_0x187052['query'][_0x7955('0x58')])){for(var _0x196375=0x0;_0x196375<_0x187052[_0x7955('0x3f')][_0x7955('0x58')][_0x7955('0x48')];_0x196375+=0x1){_0x124363={'UserId':Number(_0x187052[_0x7955('0x4f')]['id'])};_0x124363[_[_0x7955('0x99')](_0x187052['query'][_0x7955('0x93')]['toLowerCase']())+_0x7955('0x9e')]=Number(_0x187052[_0x7955('0x3f')][_0x7955('0x58')][_0x196375]);socket['emit'](_0x7955('0x2a')+_['capitalize'](_0x187052['query'][_0x7955('0x93')]['toLowerCase']())+_0x7955('0xa8'),_0x124363);}}else{_0x124363={'UserId':Number(_0x187052[_0x7955('0x4f')]['id'])};_0x124363[_[_0x7955('0x99')](_0x187052['query'][_0x7955('0x93')][_0x7955('0x9a')]())+_0x7955('0x9e')]=Number(_0x187052['query']['ids']);socket['emit'](_0x7955('0x2a')+_['capitalize'](_0x187052[_0x7955('0x3f')][_0x7955('0x93')][_0x7955('0x9a')]())+_0x7955('0xa8'),_0x124363);}return _0x53c1ef;})[_0x7955('0x1b')](function(){if(_0x187052['query'][_0x7955('0x93')]===_0x7955('0xa9')){return db[_0x7955('0xa2')][_0x7955('0x26')]({'where':{'UserId':_0x187052[_0x7955('0x4f')]['id'],'VoiceQueueId':_0x187052[_0x7955('0x3f')][_0x7955('0x58')]},'individualHooks':!![]})[_0x7955('0x1b')](function(){return _0x59ad3a;});}return _0x59ad3a;})[_0x7955('0x1b')](respondWithStatusCode(_0x55b0cd,null))[_0x7955('0x4e')](handleError(_0x55b0cd,null));};exports['addAvatar']=function(_0x5e998b,_0x26fb63){_0x5e998b['body']['userpic']=_0x5e998b['file'][_0x7955('0xaa')];return db[_0x7955('0x34')][_0x7955('0x51')]({'where':{'id':_0x5e998b['params']['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x26fb63,null))[_0x7955('0x1b')](saveUpdates(_0x5e998b[_0x7955('0x55')],null))[_0x7955('0x1b')](respondWithResult(_0x26fb63,null))[_0x7955('0x4e')](handleError(_0x26fb63,null));};exports[_0x7955('0xab')]=function(_0x4b6547,_0x32f541){var _0x223994=path['join'](config[_0x7955('0xac')],_0x7955('0xad'));return db['User'][_0x7955('0x51')]({'where':{'id':_0x4b6547['params']['id']},'attributes':['id',_0x7955('0xae')],'raw':!![]})[_0x7955('0x1b')](handleEntityNotFound(_0x32f541,null))[_0x7955('0x1b')](function(_0x2eb408){if(_0x2eb408){if(_[_0x7955('0x60')](_0x2eb408[_0x7955('0xae')])){return _0x32f541['download'](_0x223994);}else{if(!fs[_0x7955('0xaf')](path[_0x7955('0xb0')](config[_0x7955('0xac')],_0x7955('0xb1'),_0x2eb408[_0x7955('0xae')]))){return _0x32f541[_0x7955('0xb2')](_0x223994);}return _0x32f541[_0x7955('0xb2')](path[_0x7955('0xb0')](config['root'],_0x7955('0xb1'),_0x2eb408[_0x7955('0xae')]));}}})['catch'](handleError(_0x32f541,null));};exports[_0x7955('0xb3')]=function(_0x743509,_0x45933c){return db[_0x7955('0x34')]['find']({'where':{'id':_0x743509[_0x7955('0x4f')]['id']},'attributes':['id']})[_0x7955('0x1b')](handleEntityNotFound(_0x45933c,null))['then'](function(_0x30af15){var _0x296c21=[];values=_0x30af15['dataValues'];_0x296c21[_0x7955('0x46')](get_open_tabs(_0x7955('0x52'),_0x30af15[_0x7955('0x49')]));_0x296c21[_0x7955('0x46')](get_open_tabs(_0x7955('0x4a'),_0x30af15[_0x7955('0x49')]));_0x296c21['push'](get_open_tabs('openchannel',_0x30af15[_0x7955('0x49')]));_0x296c21[_0x7955('0x46')](get_open_tabs('whatsapp',_0x30af15['dataValues']));_0x296c21[_0x7955('0x46')](get_open_tabs(_0x7955('0xb4'),_0x30af15['dataValues']));_0x296c21[_0x7955('0x46')](get_open_tabs(_0x7955('0x53'),_0x30af15['dataValues']));return Promise[_0x7955('0x4d')](_0x296c21);})[_0x7955('0x1b')](function(_0x1f28c0){if(_0x1f28c0){var _0x27c602=_[_0x7955('0x2f')](values['ChatOpenTabs'],function(_0x4a4163){return{'channel':_0x7955('0xb5'),'id':_0x4a4163['id'],'createdAt':_0x4a4163[_0x7955('0xb6')]};});var _0x5acdc4=_[_0x7955('0x2f')](values[_0x7955('0xb7')],function(_0x5cbfcf){return{'channel':_0x7955('0xb8'),'id':_0x5cbfcf['id'],'createdAt':_0x5cbfcf[_0x7955('0xb6')]};});var _0x4e9438=_[_0x7955('0x2f')](values[_0x7955('0xb9')],function(_0x5539ee){return{'channel':_0x7955('0xba'),'id':_0x5539ee['id'],'createdAt':_0x5539ee['createdAt']};});var _0x42ed2b=_['map'](values[_0x7955('0xbb')],function(_0x53d383){return{'channel':_0x7955('0xbc'),'id':_0x53d383['id'],'createdAt':_0x53d383['createdAt']};});var _0x45e041=_['map'](values['SmsOpenTabs'],function(_0x56cc69){return{'channel':_0x7955('0xbd'),'id':_0x56cc69['id'],'createdAt':_0x56cc69[_0x7955('0xb6')]};});var _0x2092ac=_[_0x7955('0x2f')](values[_0x7955('0xbe')],function(_0x1be926){return{'channel':'WHATSAPP','id':_0x1be926['id'],'createdAt':_0x1be926[_0x7955('0xb6')]};});var _0x1b6674=_[_0x7955('0xbf')](_0x27c602,_0x5acdc4,_0x4e9438,_0x42ed2b,_0x45e041,_0x2092ac);var _0x3748a7={'count':_0x1b6674[_0x7955('0x48')],'rows':_0x1b6674};return _0x3748a7;}else return null;})['then'](respondWithResult(_0x45933c,null))[_0x7955('0x4e')](handleError(_0x45933c,null));};exports['getContacts']=function(_0x38ce4c,_0x149a69){var _0x7553ea={};return db['User'][_0x7955('0xc0')]({'where':{'id':_0x38ce4c[_0x7955('0x4f')]['id']}})['then'](function(_0x4eb128){if(!_0x4eb128){throw new APINotFoundError(util[_0x7955('0xc1')](_0x7955('0xc2'),_0x38ce4c['params']['id']));}return contacts['describe']();})[_0x7955('0x1b')](function(_0x2b0f4b){_0x38ce4c['query'][_0x7955('0x34')]=_0x38ce4c[_0x7955('0x4f')]['id'];_0x7553ea=qs[_0x7955('0x3d')](_0x2b0f4b,_0x38ce4c);if(_0x38ce4c[_0x7955('0x3f')]['hasOwnProperty']('includeAll')){_0x7553ea['include']=[{'model':db[_0x7955('0xc3')],'as':_0x7955('0xc4'),'required':![]},{'model':db['Tag'],'as':_0x7955('0xc5'),'attributes':['id','name',_0x7955('0xc6')],'where':_0x38ce4c[_0x7955('0x3f')][_0x7955('0xc7')]?{'id':_0x38ce4c[_0x7955('0x3f')][_0x7955('0xc7')]}:undefined,'required':_0x38ce4c[_0x7955('0x3f')][_0x7955('0xc7')]?!![]:![]}];}return contacts[_0x7955('0x84')](_0x38ce4c[_0x7955('0x3f')],_0x38ce4c[_0x7955('0x2a')],_0x7553ea,_0x2b0f4b);})[_0x7955('0x1b')](respondWithFilteredResult(_0x149a69,_0x7553ea))[_0x7955('0x4e')](APIHandleError(_0x149a69));};exports[_0x7955('0xc8')]=function(_0x27f967,_0xcdb0f2){var _0xf614ef;var _0x4d4a8d={};var _0xfa98dc;return db['User']['findOne']({'where':{'id':_0x27f967[_0x7955('0x4f')]['id']},'attributes':['id',_0x7955('0x31'),_0x7955('0x22')]})[_0x7955('0x1b')](handleEntityNotFound(_0xcdb0f2,null))['then'](function(_0x48b2d1){if(!utils[_0x7955('0xa5')](_0x27f967[_0x7955('0x3f')][_0x7955('0x93')])){throw new db['Sequelize'][(_0x7955('0x8a'))](_0x7955('0x98'));}_0xf614ef=_0x48b2d1;var _0x199699={};_0x199699[_0x7955('0xc9')]=_[_0x7955('0xca')](db[_['capitalize'](_0x27f967['query']['channel'])+'Queue'][_0x7955('0x35')]);_0x199699[_0x7955('0x3f')]=_[_0x7955('0xca')](_0x27f967['query']);_0x199699[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x199699['model'],_0x199699['query']);_0x4d4a8d[_0x7955('0x45')]=_['intersection'](_0x199699['model'],qs[_0x7955('0xcd')](_0x27f967[_0x7955('0x3f')][_0x7955('0xcd')]));_0x4d4a8d[_0x7955('0x45')]=_0x4d4a8d['attributes'][_0x7955('0x48')]?_0x4d4a8d[_0x7955('0x45')]:_0x199699[_0x7955('0xc9')];_0x4d4a8d[_0x7955('0xce')]=qs['sort'](_0x27f967[_0x7955('0x3f')]['sort']);_0x4d4a8d['where']=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x27f967[_0x7955('0x3f')],_0x199699['filters']));if(_0x27f967[_0x7955('0x3f')][_0x7955('0x2d')]){_0x4d4a8d['where']=_[_0x7955('0xd0')](_0x4d4a8d[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x4d4a8d[_0x7955('0x45')],function(_0x26d809){var _0x4fd0d8={};_0x4fd0d8[_0x26d809]={'$like':'%'+_0x27f967[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0x4fd0d8;})});}_0x4d4a8d=_[_0x7955('0xd0')]({},_0x4d4a8d,_0x27f967[_0x7955('0x50')]);switch(_0xf614ef[_0x7955('0x22')]){case _0x7955('0x28'):return db[_['capitalize'](_0x27f967[_0x7955('0x3f')][_0x7955('0x93')])+'Queue'][_0x7955('0x84')](_0x4d4a8d);case _0x7955('0x2a'):case'agent':return _0xf614ef[_0x7955('0x27')+_['capitalize'](_0x27f967[_0x7955('0x3f')][_0x7955('0x93')])+_0x7955('0x9b')](_0x4d4a8d);default:throw new db['Sequelize']['ValidationError'](_0x7955('0xd1'));}})[_0x7955('0x1b')](function(_0x3687d7){_0xfa98dc=_0x3687d7[_0x7955('0x48')];if(!_0x27f967[_0x7955('0x3f')][_0x7955('0xd2')](_0x7955('0xd3'))){_0x4d4a8d[_0x7955('0x15')]=qs[_0x7955('0x15')](_0x27f967[_0x7955('0x3f')][_0x7955('0x15')]);_0x4d4a8d[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x27f967[_0x7955('0x3f')][_0x7955('0x14')]);}switch(_0xf614ef[_0x7955('0x22')]){case _0x7955('0x28'):return db[_[_0x7955('0x99')](_0x27f967[_0x7955('0x3f')]['channel'])+'Queue'][_0x7955('0x84')](_0x4d4a8d);case'user':case'agent':return _0xf614ef[_0x7955('0x27')+_[_0x7955('0x99')](_0x27f967[_0x7955('0x3f')][_0x7955('0x93')])+_0x7955('0x9b')](_0x4d4a8d);}})[_0x7955('0x1b')](function(_0x2f6acf){return{'count':_0xfa98dc,'rows':_0x2f6acf};})[_0x7955('0x1b')](respondWithResult(_0xcdb0f2,null))['catch'](handleError(_0xcdb0f2,null));};exports[_0x7955('0xd4')]=function(_0x4269d8,_0x3695db){var _0x81d074={};var _0x34d798={};var _0x459869;var _0x28e576;return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x4269d8[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x3695db,null))[_0x7955('0x1b')](function(_0x247f07){if(_0x247f07){_0x459869=_0x247f07;_0x34d798[_0x7955('0xc9')]=_['keys'](db[_0x7955('0xa2')][_0x7955('0x35')]);_0x34d798[_0x7955('0x3f')]=_['keys'](_0x4269d8[_0x7955('0x3f')]);_0x34d798[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x34d798[_0x7955('0xc9')],_0x34d798[_0x7955('0x3f')]);_0x81d074[_0x7955('0x45')]=_[_0x7955('0xcc')](_0x34d798['model'],qs['fields'](_0x4269d8['query'][_0x7955('0xcd')]));_0x81d074[_0x7955('0x45')]=_0x81d074['attributes'][_0x7955('0x48')]?_0x81d074[_0x7955('0x45')]:_0x34d798['model'];_0x81d074[_0x7955('0xce')]=qs[_0x7955('0xd5')](_0x4269d8['query'][_0x7955('0xd5')]);_0x81d074[_0x7955('0x3e')]=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x4269d8['query'],_0x34d798[_0x7955('0xcb')]));if(_0x4269d8[_0x7955('0x3f')][_0x7955('0x2d')]){_0x81d074[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x81d074[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x81d074[_0x7955('0x45')],function(_0x323945){var _0x307a91={};_0x307a91[_0x323945]={'$like':'%'+_0x4269d8[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0x307a91;})});}_0x81d074=_[_0x7955('0xd0')]({},_0x81d074,_0x4269d8[_0x7955('0x50')]);return _0x459869[_0x7955('0xd4')](_0x81d074);}})[_0x7955('0x1b')](function(_0x2d5211){if(_0x2d5211){_0x28e576=_0x2d5211[_0x7955('0x48')];if(!_0x4269d8[_0x7955('0x3f')][_0x7955('0xd2')](_0x7955('0xd3'))){_0x81d074[_0x7955('0x15')]=qs[_0x7955('0x15')](_0x4269d8[_0x7955('0x3f')]['limit']);_0x81d074[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x4269d8['query'][_0x7955('0x14')]);}return _0x459869[_0x7955('0xd4')](_0x81d074);}})[_0x7955('0x1b')](function(_0x5dbe24){if(_0x5dbe24){return _0x5dbe24?{'count':_0x28e576,'rows':_0x5dbe24}:null;}})['then'](respondWithResult(_0x3695db,null))[_0x7955('0x4e')](handleError(_0x3695db,null));};exports[_0x7955('0xd6')]=function(_0x56fbc4,_0x29f35b){var _0x21ea5f={};var _0x283b2d={};var _0x89e7e3;var _0x480a3d;return db['User']['findOne']({'where':{'id':_0x56fbc4[_0x7955('0x4f')]['id']}})['then'](handleEntityNotFound(_0x29f35b,null))[_0x7955('0x1b')](function(_0x10ca44){if(_0x10ca44){_0x89e7e3=_0x10ca44;_0x283b2d[_0x7955('0xc9')]=_[_0x7955('0xca')](db[_0x7955('0xd7')][_0x7955('0x35')]);_0x283b2d[_0x7955('0x3f')]=_[_0x7955('0xca')](_0x56fbc4[_0x7955('0x3f')]);_0x283b2d[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x283b2d[_0x7955('0xc9')],_0x283b2d[_0x7955('0x3f')]);_0x21ea5f[_0x7955('0x45')]=_[_0x7955('0xcc')](_0x283b2d[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x56fbc4['query']['fields']));_0x21ea5f[_0x7955('0x45')]=_0x21ea5f['attributes'][_0x7955('0x48')]?_0x21ea5f[_0x7955('0x45')]:_0x283b2d[_0x7955('0xc9')];_0x21ea5f[_0x7955('0xce')]=qs[_0x7955('0xd5')](_0x56fbc4[_0x7955('0x3f')][_0x7955('0xd5')]);_0x21ea5f['where']=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x56fbc4[_0x7955('0x3f')],_0x283b2d[_0x7955('0xcb')]));if(_0x56fbc4['query']['filter']){_0x21ea5f[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x21ea5f['where'],{'$or':_[_0x7955('0x2f')](_0x21ea5f[_0x7955('0x45')],function(_0x37d494){var _0x10b18b={};_0x10b18b[_0x37d494]={'$like':'%'+_0x56fbc4[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0x10b18b;})});}_0x21ea5f=_['merge']({},_0x21ea5f,_0x56fbc4[_0x7955('0x50')]);return _0x89e7e3['getGroups'](_0x21ea5f);}})[_0x7955('0x1b')](function(_0x465b57){if(_0x465b57){_0x480a3d=_0x465b57[_0x7955('0x48')];if(!_0x56fbc4[_0x7955('0x3f')]['hasOwnProperty'](_0x7955('0xd3'))){_0x21ea5f[_0x7955('0x15')]=qs[_0x7955('0x15')](_0x56fbc4[_0x7955('0x3f')][_0x7955('0x15')]);_0x21ea5f['offset']=qs[_0x7955('0x14')](_0x56fbc4[_0x7955('0x3f')]['offset']);}return _0x89e7e3[_0x7955('0xd6')](_0x21ea5f);}})[_0x7955('0x1b')](function(_0x135520){if(_0x135520){return _0x135520?{'count':_0x480a3d,'rows':_0x135520}:null;}})[_0x7955('0x1b')](respondWithResult(_0x29f35b,null))[_0x7955('0x4e')](handleError(_0x29f35b,null));};exports[_0x7955('0xd8')]=function(_0x22abc1,_0x5406c3){var _0x3a8f15={'raw':!![],'where':{}};var _0x44cda2={};var _0x3dafb9={'count':0x0,'rows':[]};return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x22abc1['params']['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x5406c3,null))['then'](function(_0x4871d8){if(_0x4871d8){_0x44cda2[_0x7955('0xc9')]=_[_0x7955('0xca')](db[_0x7955('0xd9')][_0x7955('0x35')]);_0x44cda2[_0x7955('0x3f')]=_[_0x7955('0xca')](_0x22abc1[_0x7955('0x3f')]);_0x44cda2['filters']=_[_0x7955('0xcc')](_0x44cda2[_0x7955('0xc9')],_0x44cda2[_0x7955('0x3f')]);_0x3a8f15[_0x7955('0x45')]=_['intersection'](_0x44cda2[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x22abc1[_0x7955('0x3f')][_0x7955('0xcd')]));_0x3a8f15[_0x7955('0x45')]=_0x3a8f15[_0x7955('0x45')][_0x7955('0x48')]?_0x3a8f15[_0x7955('0x45')]:_0x44cda2[_0x7955('0xc9')];if(!_0x22abc1[_0x7955('0x3f')]['hasOwnProperty'](_0x7955('0xd3'))){_0x3a8f15[_0x7955('0x15')]=qs['limit'](_0x22abc1[_0x7955('0x3f')][_0x7955('0x15')]);_0x3a8f15[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x22abc1[_0x7955('0x3f')][_0x7955('0x14')]);}_0x3a8f15[_0x7955('0xce')]=qs[_0x7955('0xd5')](_0x22abc1[_0x7955('0x3f')][_0x7955('0xd5')]);_0x3a8f15[_0x7955('0x3e')]=qs[_0x7955('0xcb')](_['pick'](_0x22abc1[_0x7955('0x3f')],_0x44cda2[_0x7955('0xcb')]));_0x3a8f15[_0x7955('0x3e')][_0x7955('0xda')]=_0x4871d8['id'];if(_0x22abc1['query'][_0x7955('0x2d')]){_0x3a8f15[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x3a8f15[_0x7955('0x3e')],{'$or':_['map'](_0x3a8f15['attributes'],function(_0x267b9b){var _0x2d3d47={};_0x2d3d47[_0x267b9b]={'$like':'%'+_0x22abc1[_0x7955('0x3f')]['filter']+'%'};return _0x2d3d47;})});}_0x3a8f15=_[_0x7955('0xd0')]({},_0x3a8f15,_0x22abc1[_0x7955('0x50')]);return db[_0x7955('0xd9')][_0x7955('0x16')]({'where':_0x3a8f15['where']})[_0x7955('0x1b')](function(_0xcd0e1f){_0x3dafb9[_0x7955('0x16')]=_0xcd0e1f;if(_0x22abc1[_0x7955('0x3f')]['includeAll']){_0x3a8f15[_0x7955('0x41')]=[{'all':!![]}];}return db[_0x7955('0xd9')]['findAll'](_0x3a8f15);})[_0x7955('0x1b')](function(_0x29bcab){_0x3dafb9[_0x7955('0x47')]=_0x29bcab;return _0x3dafb9;});}})['then'](respondWithFilteredResult(_0x5406c3,_0x3a8f15))[_0x7955('0x4e')](handleError(_0x5406c3,null));};exports[_0x7955('0xdb')]=function(_0x8101bc,_0x283c48){var _0x29d66b={'raw':!![],'where':{}};var _0x4113ab={};var _0x38a86c={'count':0x0,'rows':[]};return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x8101bc['params']['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x283c48,null))[_0x7955('0x1b')](function(_0x5e0ae6){if(_0x5e0ae6){_0x4113ab[_0x7955('0xc9')]=_['keys'](db[_0x7955('0xdc')][_0x7955('0x35')]);_0x4113ab['query']=_[_0x7955('0xca')](_0x8101bc[_0x7955('0x3f')]);_0x4113ab[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x4113ab[_0x7955('0xc9')],_0x4113ab[_0x7955('0x3f')]);_0x29d66b[_0x7955('0x45')]=_[_0x7955('0xcc')](_0x4113ab[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x8101bc[_0x7955('0x3f')][_0x7955('0xcd')]));_0x29d66b[_0x7955('0x45')]=_0x29d66b['attributes'][_0x7955('0x48')]?_0x29d66b[_0x7955('0x45')]:_0x4113ab[_0x7955('0xc9')];if(!_0x8101bc[_0x7955('0x3f')][_0x7955('0xd2')](_0x7955('0xd3'))){_0x29d66b[_0x7955('0x15')]=qs[_0x7955('0x15')](_0x8101bc[_0x7955('0x3f')][_0x7955('0x15')]);_0x29d66b[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x8101bc[_0x7955('0x3f')]['offset']);}_0x29d66b[_0x7955('0xce')]=qs[_0x7955('0xd5')](_0x8101bc[_0x7955('0x3f')]['sort']);_0x29d66b['where']=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x8101bc['query'],_0x4113ab[_0x7955('0xcb')]));_0x29d66b[_0x7955('0x3e')]['UserId']=_0x5e0ae6['id'];if(_0x8101bc[_0x7955('0x3f')][_0x7955('0x2d')]){_0x29d66b[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x29d66b[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x29d66b[_0x7955('0x45')],function(_0xece686){var _0xe26934={};_0xe26934[_0xece686]={'$like':'%'+_0x8101bc[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0xe26934;})});}_0x29d66b=_['merge']({},_0x29d66b,_0x8101bc['options']);return db['ScreenRecording'][_0x7955('0x16')]({'where':_0x29d66b['where']})[_0x7955('0x1b')](function(_0x462fc0){_0x38a86c['count']=_0x462fc0;if(_0x8101bc[_0x7955('0x3f')]['includeAll']){_0x29d66b[_0x7955('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x7955('0x84')](_0x29d66b);})[_0x7955('0x1b')](function(_0x5cea6b){_0x38a86c[_0x7955('0x47')]=_0x5cea6b;return _0x38a86c;});}})['then'](respondWithFilteredResult(_0x283c48,_0x29d66b))[_0x7955('0x4e')](handleError(_0x283c48,null));};exports['getChatInteractions']=function(_0x5e3c8c,_0x1a6163){var _0xa121d4={};var _0x2abed2={};var _0x718db6;var _0x24ddd8;return db['User']['findOne']({'where':{'id':_0x5e3c8c[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x1a6163,null))['then'](function(_0x5d99ee){if(_0x5d99ee){_0x718db6=_0x5d99ee;_0x2abed2[_0x7955('0xc9')]=_['keys'](db[_0x7955('0xdd')][_0x7955('0x35')]);_0x2abed2[_0x7955('0x3f')]=_['keys'](_0x5e3c8c[_0x7955('0x3f')]);_0x2abed2[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x2abed2[_0x7955('0xc9')],_0x2abed2[_0x7955('0x3f')]);_0xa121d4[_0x7955('0x45')]=_['intersection'](_0x2abed2[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x5e3c8c[_0x7955('0x3f')][_0x7955('0xcd')]));_0xa121d4[_0x7955('0x45')]=_0xa121d4[_0x7955('0x45')][_0x7955('0x48')]?_0xa121d4[_0x7955('0x45')]:_0x2abed2[_0x7955('0xc9')];_0xa121d4[_0x7955('0xce')]=qs[_0x7955('0xd5')](_0x5e3c8c[_0x7955('0x3f')][_0x7955('0xd5')]);_0xa121d4['where']=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x5e3c8c['query'],_0x2abed2['filters']));if(_0x5e3c8c[_0x7955('0x3f')]['filter']){_0xa121d4[_0x7955('0x3e')]=_['merge'](_0xa121d4[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0xa121d4[_0x7955('0x45')],function(_0x118082){var _0x239227={};_0x239227[_0x118082]={'$like':'%'+_0x5e3c8c[_0x7955('0x3f')]['filter']+'%'};return _0x239227;})});}_0xa121d4=_['merge']({},_0xa121d4,_0x5e3c8c[_0x7955('0x50')]);return _0x718db6[_0x7955('0xde')](_0xa121d4);}})[_0x7955('0x1b')](function(_0x3cfdf7){if(_0x3cfdf7){_0x24ddd8=_0x3cfdf7[_0x7955('0x48')];if(!_0x5e3c8c[_0x7955('0x3f')]['hasOwnProperty'](_0x7955('0xd3'))){_0xa121d4['limit']=qs[_0x7955('0x15')](_0x5e3c8c[_0x7955('0x3f')][_0x7955('0x15')]);_0xa121d4[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x5e3c8c[_0x7955('0x3f')][_0x7955('0x14')]);}return _0x718db6[_0x7955('0xde')](_0xa121d4);}})['then'](function(_0x5dd88a){if(_0x5dd88a){return _0x5dd88a?{'count':_0x24ddd8,'rows':_0x5dd88a}:null;}})[_0x7955('0x1b')](respondWithResult(_0x1a6163,null))[_0x7955('0x4e')](handleError(_0x1a6163,null));};exports[_0x7955('0xdf')]=function(_0x189fcb,_0x231d3e){var _0x29e1aa={};var _0xbf07c7={};var _0x4922b2;var _0x82d83c;return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x189fcb[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x231d3e,null))[_0x7955('0x1b')](function(_0x37028a){if(_0x37028a){_0x4922b2=_0x37028a;_0xbf07c7[_0x7955('0xc9')]=_['keys'](db[_0x7955('0xe0')][_0x7955('0x35')]);_0xbf07c7[_0x7955('0x3f')]=_[_0x7955('0xca')](_0x189fcb[_0x7955('0x3f')]);_0xbf07c7[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0xbf07c7[_0x7955('0xc9')],_0xbf07c7[_0x7955('0x3f')]);_0x29e1aa[_0x7955('0x45')]=_[_0x7955('0xcc')](_0xbf07c7[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x189fcb[_0x7955('0x3f')][_0x7955('0xcd')]));_0x29e1aa[_0x7955('0x45')]=_0x29e1aa[_0x7955('0x45')]['length']?_0x29e1aa[_0x7955('0x45')]:_0xbf07c7['model'];_0x29e1aa['order']=qs[_0x7955('0xd5')](_0x189fcb[_0x7955('0x3f')][_0x7955('0xd5')]);_0x29e1aa[_0x7955('0x3e')]=qs[_0x7955('0xcb')](_['pick'](_0x189fcb[_0x7955('0x3f')],_0xbf07c7['filters']));if(_0x189fcb[_0x7955('0x3f')][_0x7955('0x2d')]){_0x29e1aa['where']=_[_0x7955('0xd0')](_0x29e1aa['where'],{'$or':_[_0x7955('0x2f')](_0x29e1aa[_0x7955('0x45')],function(_0x1452fd){var _0x4a1375={};_0x4a1375[_0x1452fd]={'$like':'%'+_0x189fcb[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0x4a1375;})});}_0x29e1aa=_[_0x7955('0xd0')]({},_0x29e1aa,_0x189fcb[_0x7955('0x50')]);return _0x4922b2[_0x7955('0xdf')](_0x29e1aa);}})[_0x7955('0x1b')](function(_0x36e087){if(_0x36e087){_0x82d83c=_0x36e087[_0x7955('0x48')];if(!_0x189fcb[_0x7955('0x3f')][_0x7955('0xd2')](_0x7955('0xd3'))){_0x29e1aa['limit']=qs[_0x7955('0x15')](_0x189fcb['query']['limit']);_0x29e1aa['offset']=qs[_0x7955('0x14')](_0x189fcb[_0x7955('0x3f')][_0x7955('0x14')]);}return _0x4922b2['getOpenchannelInteractions'](_0x29e1aa);}})['then'](function(_0x2a3e44){if(_0x2a3e44){return _0x2a3e44?{'count':_0x82d83c,'rows':_0x2a3e44}:null;}})['then'](respondWithResult(_0x231d3e,null))['catch'](handleError(_0x231d3e,null));};exports[_0x7955('0xe1')]=function(_0x97593,_0x10e85b){var _0x30f1f2={'raw':!![],'where':{}};var _0x4609af={};var _0x26fb54={'count':0x0,'rows':[]};return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x97593['params']['id']}})['then'](handleEntityNotFound(_0x10e85b,null))[_0x7955('0x1b')](function(_0x5e37bf){if(_0x5e37bf){_0x4609af[_0x7955('0xc9')]=_[_0x7955('0xca')](db[_0x7955('0xe2')]['rawAttributes']);_0x4609af['query']=_[_0x7955('0xca')](_0x97593[_0x7955('0x3f')]);_0x4609af[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x4609af['model'],_0x4609af['query']);_0x30f1f2['attributes']=_['intersection'](_0x4609af['model'],qs[_0x7955('0xcd')](_0x97593[_0x7955('0x3f')][_0x7955('0xcd')]));_0x30f1f2['attributes']=_0x30f1f2[_0x7955('0x45')]['length']?_0x30f1f2[_0x7955('0x45')]:_0x4609af[_0x7955('0xc9')];if(!_0x97593[_0x7955('0x3f')][_0x7955('0xd2')](_0x7955('0xd3'))){_0x30f1f2[_0x7955('0x15')]=qs[_0x7955('0x15')](_0x97593['query'][_0x7955('0x15')]);_0x30f1f2[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x97593[_0x7955('0x3f')][_0x7955('0x14')]);}_0x30f1f2[_0x7955('0xce')]=qs[_0x7955('0xd5')](_0x97593[_0x7955('0x3f')][_0x7955('0xd5')]);_0x30f1f2[_0x7955('0x3e')]=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x97593[_0x7955('0x3f')],_0x4609af[_0x7955('0xcb')]));_0x30f1f2['where'][_0x7955('0xda')]=_0x5e37bf['id'];if(_0x97593[_0x7955('0x3f')]['filter']){_0x30f1f2['where']=_[_0x7955('0xd0')](_0x30f1f2[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x30f1f2[_0x7955('0x45')],function(_0x1ff84d){var _0x318b2e={};_0x318b2e[_0x1ff84d]={'$like':'%'+_0x97593[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0x318b2e;})});}_0x30f1f2=_[_0x7955('0xd0')]({},_0x30f1f2,_0x97593['options']);return db[_0x7955('0xe2')][_0x7955('0x16')]({'where':_0x30f1f2[_0x7955('0x3e')]})[_0x7955('0x1b')](function(_0x572c83){_0x26fb54['count']=_0x572c83;if(_0x97593['query'][_0x7955('0x40')]){_0x30f1f2[_0x7955('0x41')]=[{'all':!![]}];}return db[_0x7955('0xe2')][_0x7955('0x84')](_0x30f1f2);})[_0x7955('0x1b')](function(_0x47bfef){_0x26fb54[_0x7955('0x47')]=_0x47bfef;return _0x26fb54;});}})[_0x7955('0x1b')](respondWithFilteredResult(_0x10e85b,_0x30f1f2))[_0x7955('0x4e')](handleError(_0x10e85b,null));};exports[_0x7955('0xe3')]=function(_0x14aa1b,_0x4dfa98){var _0x5e408a={};var _0x9e4892={};var _0xae9c88;var _0x29a769;return db['User'][_0x7955('0xc0')]({'where':{'id':_0x14aa1b[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x4dfa98,null))[_0x7955('0x1b')](function(_0x2d31ab){if(_0x2d31ab){_0xae9c88=_0x2d31ab;_0x9e4892['model']=_[_0x7955('0xca')](db[_0x7955('0xe4')]['rawAttributes']);_0x9e4892[_0x7955('0x3f')]=_['keys'](_0x14aa1b[_0x7955('0x3f')]);_0x9e4892[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x9e4892['model'],_0x9e4892[_0x7955('0x3f')]);_0x5e408a[_0x7955('0x45')]=_['intersection'](_0x9e4892[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x14aa1b[_0x7955('0x3f')][_0x7955('0xcd')]));_0x5e408a['attributes']=_0x5e408a['attributes'][_0x7955('0x48')]?_0x5e408a[_0x7955('0x45')]:_0x9e4892['model'];_0x5e408a['order']=qs[_0x7955('0xd5')](_0x14aa1b['query']['sort']);_0x5e408a[_0x7955('0x3e')]=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x14aa1b[_0x7955('0x3f')],_0x9e4892[_0x7955('0xcb')]));if(_0x14aa1b[_0x7955('0x3f')][_0x7955('0x2d')]){_0x5e408a[_0x7955('0x3e')]=_['merge'](_0x5e408a[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x5e408a[_0x7955('0x45')],function(_0x2a87d6){var _0x35d436={};_0x35d436[_0x2a87d6]={'$like':'%'+_0x14aa1b['query']['filter']+'%'};return _0x35d436;})});}_0x5e408a=_[_0x7955('0xd0')]({},_0x5e408a,_0x14aa1b[_0x7955('0x50')]);return _0xae9c88[_0x7955('0xe3')](_0x5e408a);}})[_0x7955('0x1b')](function(_0x1419be){if(_0x1419be){_0x29a769=_0x1419be[_0x7955('0x48')];if(!_0x14aa1b['query'][_0x7955('0xd2')](_0x7955('0xd3'))){_0x5e408a['limit']=qs['limit'](_0x14aa1b[_0x7955('0x3f')][_0x7955('0x15')]);_0x5e408a[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x14aa1b[_0x7955('0x3f')][_0x7955('0x14')]);}return _0xae9c88['getSmsInteractions'](_0x5e408a);}})[_0x7955('0x1b')](function(_0x17385a){if(_0x17385a){return _0x17385a?{'count':_0x29a769,'rows':_0x17385a}:null;}})[_0x7955('0x1b')](respondWithResult(_0x4dfa98,null))[_0x7955('0x4e')](handleError(_0x4dfa98,null));};exports[_0x7955('0xe5')]=function(_0x4c7843,_0xcc55fa){var _0x81a3c4={};var _0x53dc48={};var _0x37f614;var _0xb1c795;return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x4c7843[_0x7955('0x4f')]['id']}})['then'](handleEntityNotFound(_0xcc55fa,null))['then'](function(_0x3bd591){if(_0x3bd591){_0x37f614=_0x3bd591;_0x53dc48[_0x7955('0xc9')]=_[_0x7955('0xca')](db['FaxInteraction'][_0x7955('0x35')]);_0x53dc48[_0x7955('0x3f')]=_[_0x7955('0xca')](_0x4c7843[_0x7955('0x3f')]);_0x53dc48['filters']=_[_0x7955('0xcc')](_0x53dc48['model'],_0x53dc48['query']);_0x81a3c4[_0x7955('0x45')]=_['intersection'](_0x53dc48[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x4c7843[_0x7955('0x3f')]['fields']));_0x81a3c4['attributes']=_0x81a3c4[_0x7955('0x45')]['length']?_0x81a3c4['attributes']:_0x53dc48[_0x7955('0xc9')];_0x81a3c4[_0x7955('0xce')]=qs['sort'](_0x4c7843[_0x7955('0x3f')][_0x7955('0xd5')]);_0x81a3c4['where']=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x4c7843[_0x7955('0x3f')],_0x53dc48[_0x7955('0xcb')]));if(_0x4c7843[_0x7955('0x3f')][_0x7955('0x2d')]){_0x81a3c4[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x81a3c4[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x81a3c4[_0x7955('0x45')],function(_0xc71750){var _0x2401f8={};_0x2401f8[_0xc71750]={'$like':'%'+_0x4c7843[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0x2401f8;})});}_0x81a3c4=_[_0x7955('0xd0')]({},_0x81a3c4,_0x4c7843[_0x7955('0x50')]);return _0x37f614[_0x7955('0xe5')](_0x81a3c4);}})[_0x7955('0x1b')](function(_0x4aa119){if(_0x4aa119){_0xb1c795=_0x4aa119[_0x7955('0x48')];if(!_0x4c7843['query']['hasOwnProperty']('nolimit')){_0x81a3c4['limit']=qs['limit'](_0x4c7843['query'][_0x7955('0x15')]);_0x81a3c4[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x4c7843[_0x7955('0x3f')][_0x7955('0x14')]);}return _0x37f614[_0x7955('0xe5')](_0x81a3c4);}})[_0x7955('0x1b')](function(_0x18b195){if(_0x18b195){return _0x18b195?{'count':_0xb1c795,'rows':_0x18b195}:null;}})[_0x7955('0x1b')](respondWithResult(_0xcc55fa,null))['catch'](handleError(_0xcc55fa,null));};exports['getWhatsappInteractions']=function(_0x166a42,_0x31efd6){var _0x3fdbc8={};var _0x41f866={};var _0x373aea;var _0x1b3888;return db['User'][_0x7955('0xc0')]({'where':{'id':_0x166a42[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x31efd6,null))[_0x7955('0x1b')](function(_0x33eb56){if(_0x33eb56){_0x373aea=_0x33eb56;_0x41f866[_0x7955('0xc9')]=_[_0x7955('0xca')](db[_0x7955('0xe6')][_0x7955('0x35')]);_0x41f866[_0x7955('0x3f')]=_[_0x7955('0xca')](_0x166a42[_0x7955('0x3f')]);_0x41f866[_0x7955('0xcb')]=_[_0x7955('0xcc')](_0x41f866['model'],_0x41f866[_0x7955('0x3f')]);_0x3fdbc8[_0x7955('0x45')]=_[_0x7955('0xcc')](_0x41f866[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x166a42[_0x7955('0x3f')]['fields']));_0x3fdbc8[_0x7955('0x45')]=_0x3fdbc8[_0x7955('0x45')]['length']?_0x3fdbc8[_0x7955('0x45')]:_0x41f866[_0x7955('0xc9')];_0x3fdbc8[_0x7955('0xce')]=qs['sort'](_0x166a42['query'][_0x7955('0xd5')]);_0x3fdbc8['where']=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x166a42[_0x7955('0x3f')],_0x41f866[_0x7955('0xcb')]));if(_0x166a42[_0x7955('0x3f')][_0x7955('0x2d')]){_0x3fdbc8[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x3fdbc8[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x3fdbc8['attributes'],function(_0x255ea9){var _0x214a8f={};_0x214a8f[_0x255ea9]={'$like':'%'+_0x166a42['query'][_0x7955('0x2d')]+'%'};return _0x214a8f;})});}_0x3fdbc8=_[_0x7955('0xd0')]({},_0x3fdbc8,_0x166a42[_0x7955('0x50')]);return _0x373aea[_0x7955('0xe7')](_0x3fdbc8);}})[_0x7955('0x1b')](function(_0xab3d73){if(_0xab3d73){_0x1b3888=_0xab3d73['length'];if(!_0x166a42[_0x7955('0x3f')][_0x7955('0xd2')](_0x7955('0xd3'))){_0x3fdbc8[_0x7955('0x15')]=qs['limit'](_0x166a42[_0x7955('0x3f')]['limit']);_0x3fdbc8[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x166a42[_0x7955('0x3f')][_0x7955('0x14')]);}return _0x373aea[_0x7955('0xe7')](_0x3fdbc8);}})['then'](function(_0x5e8b1d){if(_0x5e8b1d){return _0x5e8b1d?{'count':_0x1b3888,'rows':_0x5e8b1d}:null;}})[_0x7955('0x1b')](respondWithResult(_0x31efd6,null))[_0x7955('0x4e')](handleError(_0x31efd6,null));};exports[_0x7955('0xe8')]=function(_0xb33b75,_0xca43e1,_0x44bbc0){var _0x48aff4;var _0x14f014;var _0x115383;var _0x20783c=!_[_0x7955('0x60')](_0xb33b75[_0x7955('0x4f')]['id'])?_0xb33b75[_0x7955('0x4f')]['id']:!_[_0x7955('0x60')](_0xb33b75[_0x7955('0x2a')]['id'])?_0xb33b75[_0x7955('0x2a')]['id']:null;return db[_0x7955('0x34')][_0x7955('0x51')]({'where':{'id':_0x20783c,'role':{'$or':[_0x7955('0x28'),_0x7955('0x2a'),_0x7955('0x23')]}},'attributes':['id',_0x7955('0x31'),_0x7955('0xe9'),_0x7955('0xea'),_0x7955('0x22'),_0x7955('0x5a'),_0x7955('0x95')]})[_0x7955('0x1b')](function(_0x48d254){if(_0x48d254){if(_0x48d254[_0x7955('0x22')]==='agent'){_0x48aff4=_0x48d254;if(_0xb33b75[_0x7955('0x55')]['interface']){_0x115383=util[_0x7955('0xc1')](_0x7955('0xeb'),_0x48aff4[_0xb33b75[_0x7955('0x55')][_0x7955('0x97')]]);}else if(_0xb33b75['body'][_0x7955('0xec')]){_0x115383=util[_0x7955('0xc1')](_0x7955('0xa1'),_0xb33b75[_0x7955('0x55')][_0x7955('0xec')]);}else{_0x115383=util[_0x7955('0xc1')](_0x7955('0xa1'),_0x48aff4['name']);}socket['to'](util['format'](_0x7955('0xed'),_0x48aff4['name']))['emit']('user:forcelogout',{'user':{'id':_0x48aff4['id'],'name':_0x48aff4[_0x7955('0x31')]},'ip':_0xb33b75['headers'][_0x7955('0xee')]||_0xb33b75['connection'][_0x7955('0xef')]||_0xb33b75[_0x7955('0xf0')][_0x7955('0xef')]||_0xb33b75[_0x7955('0xf1')][_0x7955('0xf0')][_0x7955('0xef')]});return db['UserVoiceQueueRt'][_0x7955('0x26')]({'where':{'membername':_0x48aff4[_0x7955('0x31')]},'individualHooks':!![]});}}else{throw new db[(_0x7955('0x89'))][(_0x7955('0x8a'))](_0x7955('0xf2'));}})[_0x7955('0x1b')](function(){if(_0x48aff4){return _0x48aff4['getVoiceQueues']({'raw':!![]});}})[_0x7955('0x1b')](function(_0x13610b){if(_0x48aff4){if(_0x13610b){_0x14f014=_0x13610b;if(_0x14f014[_0x7955('0x48')]){var _0x32e067=_0x14f014[_0x7955('0x2f')](function(_0x1ec8f8){var _0x3047e7={'membername':_0x48aff4['name'],'UserId':_0x48aff4['id'],'queue_name':_0x1ec8f8[_0x7955('0x31')],'VoiceQueueId':_0x1ec8f8['id'],'interface':_0x115383,'paused':_0x48aff4[_0x7955('0x95')]||![],'penalty':_0x1ec8f8[_0x7955('0xf3')]||0x0};return db[_0x7955('0xa2')][_0x7955('0xa3')](_0x3047e7);});return Promise['all'](_0x32e067);}}}})[_0x7955('0x1b')](function(){if(_0x48aff4){return db['MemberReport'][_0x7955('0x84')]({'where':{'membername':_0x48aff4[_0x7955('0x31')],'exitAt':null}});}})[_0x7955('0x1b')](function(_0x4c4823){if(_0x48aff4){var _0x15b72e=[];_0x4c4823['forEach'](function(_0x203bb1){_0x15b72e[_0x7955('0x46')](_0x203bb1[_0x7955('0x54')]({'exitAt':moment()[_0x7955('0xc1')](_0x7955('0xf4'))}));});return Promise['all'](_0x15b72e);}})['then'](function(){if(_0x48aff4){var _0x1c942c=[];var _0x3f0376=[];var _0x266c4c=utils[_0x7955('0xf5')]();var _0x20ab67={'membername':_0x48aff4[_0x7955('0x31')],'interface':_0x115383,'enterAt':moment()[_0x7955('0xc1')](_0x7955('0xf4')),'role':_0x48aff4[_0x7955('0x22')],'internal':_0x48aff4['internal']};_0x266c4c[_0x7955('0xf6')](function(_0x54391b){_0x1c942c[_0x7955('0x46')](_[_0x7955('0xd0')]({'channel':_0x54391b,'type':_0x7955('0xf7'),'data1':_0xb33b75[_0x7955('0x55')][_0x7955('0xf8')],'data2':_0x115383},_0x20ab67));if(_0x48aff4[_0x7955('0x95')]){_0x3f0376[_0x7955('0x46')](_['merge']({'channel':_0x54391b,'type':_0x7955('0xf9'),'data1':_0x7955('0xfa')},_0x20ab67));}});return db[_0x7955('0xfb')][_0x7955('0xfc')](_0x1c942c[_0x7955('0xbf')](_0x3f0376),{'individualHooks':!![]});}})[_0x7955('0x1b')](function(){if(_0x48aff4){return _0x48aff4[_0x7955('0x54')]({'online':!![],'lastLoginAt':moment()['format'](_0x7955('0xf4')),'voicePause':_0x48aff4[_0x7955('0x95')]||![],'mailPause':_0x48aff4[_0x7955('0x95')]||![],'chatPause':_0x48aff4[_0x7955('0x95')]||![],'faxPause':_0x48aff4[_0x7955('0x95')]||![],'smsPause':_0x48aff4[_0x7955('0x95')]||![],'openchannelPause':_0x48aff4['loginInPause']||![],'whatsappPause':_0x48aff4[_0x7955('0x95')]||![],'pauseType':_0x48aff4[_0x7955('0x95')]?'LOGININPAUSE':null,'interface':_0x115383,'lastPauseAt':moment()[_0x7955('0xc1')](_0x7955('0xf4'))});}})[_0x7955('0x1b')](function(_0x474f0a){if(_0xb33b75['isMiddleware']){return _0x44bbc0();}else{return Promise['resolve'](_0x474f0a)['then'](respondWithResult(_0xca43e1,null));}})[_0x7955('0x4e')](handleError(_0xca43e1,null));};exports[_0x7955('0xfd')]=function(_0x2c16d6,_0x2682fe){var _0x50abb1;return db[_0x7955('0x34')][_0x7955('0x51')]({'where':{'id':_0x2c16d6[_0x7955('0x4f')]['id'],'role':_0x7955('0x23')},'attributes':['id',_0x7955('0x31'),_0x7955('0x22')]})[_0x7955('0x1b')](handleEntityNotFound(_0x2682fe,null))[_0x7955('0x1b')](function(_0x2a73d0){if(_0x2a73d0){_0x50abb1=_0x2a73d0;return db[_0x7955('0xa2')][_0x7955('0x26')]({'where':{'membername':_0x50abb1[_0x7955('0x31')]},'individualHooks':!![]});}})[_0x7955('0x1b')](function(){return db['MemberReport'][_0x7955('0x84')]({'where':{'membername':_0x50abb1['name'],'exitAt':null}});})[_0x7955('0x1b')](function(_0x356e27){var _0x475db3=[];_0x356e27['forEach'](function(_0x2300f0){_0x475db3['push'](_0x2300f0[_0x7955('0x54')]({'exitAt':moment()['format'](_0x7955('0xf4'))}));});return Promise['all'](_0x475db3);})[_0x7955('0x1b')](function(){return _0x50abb1['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2682fe,null))[_0x7955('0x4e')](handleError(_0x2682fe,null));};exports[_0x7955('0xfe')]=function(_0x1e1a9a,_0x39c3a7){var _0x30efb3;return db['UserVoiceQueueRt'][_0x7955('0x54')]({'paused':0x1},{'where':{'UserId':_0x1e1a9a[_0x7955('0x4f')]['id']},'individualHooks':!![]})[_0x7955('0x1b')](function(){return db[_0x7955('0x34')][_0x7955('0x51')]({'where':{'id':_0x1e1a9a[_0x7955('0x4f')]['id'],'role':_0x7955('0x23')},'attributes':['id','name','role',_0x7955('0x5a'),'interface',_0x7955('0x94')]});})[_0x7955('0x1b')](handleEntityNotFound(_0x39c3a7,null))['then'](function(_0x93076d){if(_0x93076d){_0x30efb3=_0x93076d;return respondWithRpcPromise(_0x7955('0xff'),'pause',{'id':_0x30efb3['id'],'name':_0x30efb3[_0x7955('0x31')],'pause':!![]});}})[_0x7955('0x1b')](function(){if(_0x30efb3){return db[_0x7955('0xfb')][_0x7955('0x84')]({'where':{'membername':_0x30efb3[_0x7955('0x31')],'type':_0x7955('0xf9'),'exitAt':null}});}})[_0x7955('0x1b')](function(_0x3f6871){if(_0x3f6871[_0x7955('0x48')]){var _0x2ce3fb=moment()['format'](_0x7955('0xf4'));for(var _0x4bf1dd=0x0,_0x185c83=_0x3f6871['length'];_0x4bf1dd<_0x185c83;_0x4bf1dd++){_0x3f6871[_0x4bf1dd][_0x7955('0x100')]({'exitAt':_0x2ce3fb});}}})[_0x7955('0x1b')](function(){var _0x52bf08=[];var _0x5f1f42=utils[_0x7955('0xf5')]();_0x5f1f42['forEach'](function(_0x3310f3){_0x52bf08['push']({'channel':_0x3310f3,'membername':_0x30efb3[_0x7955('0x31')],'interface':_[_0x7955('0x60')](_0x30efb3[_0x7955('0x97')])?util[_0x7955('0xc1')](_0x7955('0xa1'),_0x30efb3['name']):_0x30efb3[_0x7955('0x97')],'type':_0x7955('0xf9'),'enterAt':moment()[_0x7955('0xc1')](_0x7955('0xf4')),'data1':_0x1e1a9a[_0x7955('0x55')][_0x7955('0x36')]||_0x7955('0x101'),'role':_0x30efb3['role'],'internal':_0x30efb3[_0x7955('0x5a')]});});return db[_0x7955('0xfb')][_0x7955('0xfc')](_0x52bf08,{'individualHooks':!![]});})[_0x7955('0x1b')](function(){return _0x30efb3[_0x7955('0x54')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1e1a9a[_0x7955('0x55')][_0x7955('0x36')]||_0x7955('0x101'),'lastPauseAt':moment()[_0x7955('0xc1')](_0x7955('0xf4'))});})['then'](respondWithResult(_0x39c3a7,null))['catch'](handleError(_0x39c3a7,null));};exports['unpause']=function(_0x274cc7,_0x5c448f){if(_0x274cc7[_0x7955('0x55')][_0x7955('0x93')]&&!utils[_0x7955('0xa5')](_0x274cc7['body'][_0x7955('0x93')])){throw new APIBadRequestError(util[_0x7955('0xc1')](_0x7955('0x102'),_0x274cc7['body'][_0x7955('0x93')]));}return db[_0x7955('0x34')][_0x7955('0x51')]({'where':{'id':_0x274cc7['params']['id']},'attributes':['id',_0x7955('0x31'),_0x7955('0x22'),_0x7955('0x5a'),_0x7955('0x97'),'online',_0x7955('0x96'),_0x7955('0x103'),_0x7955('0x104'),_0x7955('0x105'),'openchannelPause',_0x7955('0x106'),'whatsappPause',_0x7955('0x107'),_0x7955('0x108')]})['then'](function(_0x5acb64){if(!_0x5acb64){throw new APINotFoundError(util['format'](_0x7955('0xc2'),_0x274cc7['params']['id']));}return _0x5acb64['unpause'](_0x274cc7[_0x7955('0x55')]['channel']);})[_0x7955('0x1b')](respondWithResult(_0x5c448f,null))[_0x7955('0x4e')](APIHandleError(_0x5c448f));};exports[_0x7955('0x109')]=function(_0x7d06e4,_0x1eb5d2){var _0xe2c14c={};var _0xc9a20d={};var _0x2716b4;var _0x3bde97;return db['User'][_0x7955('0xc0')]({'where':{'id':_0x7d06e4[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x1eb5d2,null))[_0x7955('0x1b')](function(_0x3810ad){if(_0x3810ad){_0x2716b4=_0x3810ad;_0xc9a20d['model']=_['keys'](db[_0x7955('0x10a')][_0x7955('0x35')]);_0xc9a20d['query']=_['keys'](_0x7d06e4['query']);_0xc9a20d['filters']=_[_0x7955('0xcc')](_0xc9a20d[_0x7955('0xc9')],_0xc9a20d[_0x7955('0x3f')]);_0xe2c14c['attributes']=_[_0x7955('0xcc')](_0xc9a20d[_0x7955('0xc9')],qs['fields'](_0x7d06e4['query']['fields']));_0xe2c14c[_0x7955('0x45')]=_0xe2c14c[_0x7955('0x45')][_0x7955('0x48')]?_0xe2c14c[_0x7955('0x45')]:_0xc9a20d[_0x7955('0xc9')];_0xe2c14c['order']=qs[_0x7955('0xd5')](_0x7d06e4[_0x7955('0x3f')][_0x7955('0xd5')]);_0xe2c14c['where']=qs['filters'](_[_0x7955('0xcf')](_0x7d06e4[_0x7955('0x3f')],_0xc9a20d[_0x7955('0xcb')]));if(_0x7d06e4['query'][_0x7955('0x2d')]){_0xe2c14c[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0xe2c14c[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0xe2c14c[_0x7955('0x45')],function(_0x5971bf){var _0x94c773={};_0x94c773[_0x5971bf]={'$like':'%'+_0x7d06e4[_0x7955('0x3f')]['filter']+'%'};return _0x94c773;})});}_0xe2c14c=_['merge']({},_0xe2c14c,_0x7d06e4['options']);return _0x2716b4[_0x7955('0x109')](_0xe2c14c);}})[_0x7955('0x1b')](function(_0x32bf6d){if(_0x32bf6d){_0x3bde97=_0x32bf6d[_0x7955('0x48')];if(!_0x7d06e4[_0x7955('0x3f')]['hasOwnProperty'](_0x7955('0xd3'))){_0xe2c14c['limit']=qs[_0x7955('0x15')](_0x7d06e4[_0x7955('0x3f')][_0x7955('0x15')]);_0xe2c14c['offset']=qs[_0x7955('0x14')](_0x7d06e4[_0x7955('0x3f')][_0x7955('0x14')]);}return _0x2716b4['getTeams'](_0xe2c14c);}})[_0x7955('0x1b')](function(_0x4a3e34){if(_0x4a3e34){return _0x4a3e34?{'count':_0x3bde97,'rows':_0x4a3e34}:null;}})['then'](respondWithResult(_0x1eb5d2,null))[_0x7955('0x4e')](handleError(_0x1eb5d2,null));};exports['addTeams']=function(_0x1af6a0,_0x48a298){var _0x53824b=_0x1af6a0[_0x7955('0x4f')]['id'];var _0x28ad13=_0x1af6a0[_0x7955('0x55')]?_0x1af6a0['body'][_0x7955('0x58')]:null;var _0x5d08cc=[];return Promise[_0x7955('0x10b')]()['then'](function(){if(!_0x28ad13)throw new APIBadRequestError(_0x7955('0x10c'));})[_0x7955('0x1b')](function(){return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x53824b}});})[_0x7955('0x1b')](function(_0x4368d7){if(!_0x4368d7)throw new APINotFoundError(util['format'](_0x7955('0xc2'),_0x1af6a0[_0x7955('0x4f')]['id']));return db[_0x7955('0x62')]['transaction'](function(_0x387752){return _0x4368d7[_0x7955('0x10d')](_0x28ad13,{'transaction':_0x387752})['then'](function(){return db['Team'][_0x7955('0x84')]({'where':{'id':{'$in':_0x28ad13}}});})[_0x7955('0x1b')](function(_0xd847f4){var _0x2dce42=_[_0x7955('0x2f')](_0xd847f4,function(_0x247071){return _0x247071[_0x7955('0x10e')]();});return Promise['all'](_0x2dce42);})[_0x7955('0x1b')](function(_0x56dc4a){_0x5d08cc=_['flattenDeep'](_0x56dc4a);var _0x2416dd=_[_0x7955('0x2f')](_0x5d08cc,function(_0x4c9d26){return _0x4c9d26['addAgent'](_0x4368d7['id'],{'transaction':_0x387752});});return Promise['all'](_0x2416dd);})[_0x7955('0x1b')](function(){if(!_0x4368d7[_0x7955('0x94')])return;var _0xd575f5=_[_0x7955('0x2d')](_0x5d08cc,function(_0x187db3){return _0x187db3[_0x7955('0x10f')](_0x7955('0x93'))===_0x7955('0x110');});var _0x3bc21f=_['map'](_0xd575f5,function(_0x389d90){return db[_0x7955('0xa2')][_0x7955('0xa3')]({'membername':_0x4368d7[_0x7955('0x31')],'UserId':_0x4368d7['id'],'queue_name':_0x389d90['name'],'VoiceQueueId':_0x389d90['id'],'interface':_[_0x7955('0x60')](_0x4368d7[_0x7955('0x97')])?util['format']('SIP/%s',_0x4368d7[_0x7955('0x31')]):_0x4368d7[_0x7955('0x97')],'paused':_0x4368d7[_0x7955('0x96')]||![],'penalty':_0x4368d7[_0x7955('0x9c')]},{'transaction':_0x387752});});return Promise['all'](_0x3bc21f);})[_0x7955('0x1b')](function(){return db['TeamVoicePrefix'][_0x7955('0x84')]({'where':{'teamId':{'$in':_0x28ad13}}});})[_0x7955('0x1b')](function(_0x1baa95){var _0x3c1033=_['map'](_0x1baa95,function(_0x5b1074){return db['UserVoicePrefix'][_0x7955('0x7e')]({'UserId':_0x4368d7['id'],'VoicePrefixId':_0x5b1074[_0x7955('0x111')]},{'transaction':_0x387752});});return Promise[_0x7955('0x4d')](_0x3c1033);});});})[_0x7955('0x1b')](function(){for(var _0x529a84=0x0;_0x529a84<_0x5d08cc[_0x7955('0x48')];_0x529a84++){var _0x45640e=_0x5d08cc[_0x529a84][_0x7955('0x10f')](_0x7955('0x93'));var _0x1903b0=_0x45640e+_0x7955('0x9e');socket['emit'](_0x7955('0x2a')+_0x45640e+_0x7955('0x9f'),{'UserId':_0x53824b,['queueField']:_0x5d08cc[_0x529a84]['id']});}})['then'](respondWithStatusCode(_0x48a298,null))[_0x7955('0x4e')](APIHandleError(_0x48a298));};exports[_0x7955('0x112')]=function(_0x3b6b1a,_0x1c7b59){var _0x95b694=_0x3b6b1a[_0x7955('0x4f')]['id'];var _0x49e5cb=null;if(_0x3b6b1a[_0x7955('0x3f')][_0x7955('0x58')]){_0x49e5cb=_['isArray'](_0x3b6b1a[_0x7955('0x3f')][_0x7955('0x58')])?_0x3b6b1a[_0x7955('0x3f')]['ids']:[_0x3b6b1a['query'][_0x7955('0x58')]];}var _0x3eab21=[];return Promise['resolve']()[_0x7955('0x1b')](function(){if(!_0x49e5cb)throw new APIBadRequestError(_0x7955('0x113'));})['then'](function(){return db[_0x7955('0x34')]['findOne']({'where':{'id':_0x95b694}});})[_0x7955('0x1b')](function(_0xe55c77){if(!_0xe55c77)throw new APINotFoundError(util[_0x7955('0xc1')](_0x7955('0xc2'),_0x3b6b1a[_0x7955('0x4f')]['id']));return db[_0x7955('0x62')][_0x7955('0x114')](function(_0x5d2337){return _0xe55c77[_0x7955('0x112')](_0x49e5cb,{'transaction':_0x5d2337})[_0x7955('0x1b')](function(){return db[_0x7955('0x10a')][_0x7955('0x84')]({'where':{'id':{'$in':_0x49e5cb}}});})[_0x7955('0x1b')](function(_0x275fe8){var _0x5a279c=_[_0x7955('0x2f')](_0x275fe8,function(_0x537027){return _0x537027['getAssociatedQueues']();});return Promise[_0x7955('0x4d')](_0x5a279c);})[_0x7955('0x1b')](function(_0x1e14b2){_0x3eab21=_['flattenDeep'](_0x1e14b2);var _0x2a4895=_[_0x7955('0x2f')](_0x3eab21,function(_0xdee39d){return _0xdee39d[_0x7955('0x115')](_0xe55c77['id'],{'transaction':_0x5d2337});});return Promise['all'](_0x2a4895);})[_0x7955('0x1b')](function(){if(!_0xe55c77['online'])return;var _0x324375=_[_0x7955('0x2d')](_0x3eab21,function(_0x51d7be){return _0x51d7be['getDataValue'](_0x7955('0x93'))===_0x7955('0x110');});var _0x438a75=_[_0x7955('0x2f')](_0x324375,function(_0x3ae535){return db[_0x7955('0xa2')][_0x7955('0x26')]({'where':{'VoiceQueueId':_0x3ae535['id'],'UserId':_0xe55c77['id']},'transaction':_0x5d2337});});return Promise[_0x7955('0x4d')](_0x438a75);})[_0x7955('0x1b')](function(){return db['TeamVoicePrefix'][_0x7955('0x84')]({'where':{'teamId':{'$in':_0x49e5cb}}});})['then'](function(_0x3c9ef5){var _0x5ae2f1=_[_0x7955('0x2f')](_0x3c9ef5,function(_0x4ee355){return db[_0x7955('0x116')][_0x7955('0x26')]({'where':{'UserId':_0xe55c77['id'],'VoicePrefixId':_0x4ee355[_0x7955('0x111')]}},{'transaction':_0x5d2337});});return Promise['all'](_0x5ae2f1);});});})[_0x7955('0x1b')](function(){for(var _0x10be7f=0x0;_0x10be7f<_0x3eab21[_0x7955('0x48')];_0x10be7f++){var _0x2d3003=_0x3eab21[_0x10be7f]['getDataValue'](_0x7955('0x93'));var _0xc51306=_0x2d3003+_0x7955('0x9e');socket[_0x7955('0x24')](_0x7955('0x2a')+_0x2d3003+_0x7955('0xa8'),{'UserId':_0x95b694,['queueField']:_0x3eab21[_0x10be7f]['id']});}})['then'](respondWithStatusCode(_0x1c7b59,null))[_0x7955('0x4e')](APIHandleError(_0x1c7b59));};exports[_0x7955('0x117')]=function(_0x48ce68,_0x3d0f05){var _0x32168a={};var _0x495aca={};var _0x238ac6;var _0x2cc400;return db[_0x7955('0x34')][_0x7955('0xc0')]({'where':{'id':_0x48ce68['params']['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x3d0f05,null))[_0x7955('0x1b')](function(_0x246752){if(_0x246752){_0x238ac6=_0x246752;_0x495aca[_0x7955('0xc9')]=_[_0x7955('0xca')](db[_0x7955('0xc3')][_0x7955('0x35')]);_0x495aca[_0x7955('0x3f')]=_['keys'](_0x48ce68[_0x7955('0x3f')]);_0x495aca['filters']=_[_0x7955('0xcc')](_0x495aca[_0x7955('0xc9')],_0x495aca['query']);_0x32168a['attributes']=_[_0x7955('0xcc')](_0x495aca[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x48ce68[_0x7955('0x3f')][_0x7955('0xcd')]));_0x32168a[_0x7955('0x45')]=_0x32168a[_0x7955('0x45')]['length']?_0x32168a[_0x7955('0x45')]:_0x495aca[_0x7955('0xc9')];_0x32168a[_0x7955('0xce')]=qs['sort'](_0x48ce68['query'][_0x7955('0xd5')]);_0x32168a[_0x7955('0x3e')]=qs[_0x7955('0xcb')](_['pick'](_0x48ce68[_0x7955('0x3f')],_0x495aca[_0x7955('0xcb')]));if(_0x48ce68['query'][_0x7955('0x2d')]){_0x32168a[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x32168a[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x32168a[_0x7955('0x45')],function(_0x29dd54){var _0x273012={};_0x273012[_0x29dd54]={'$like':'%'+_0x48ce68[_0x7955('0x3f')][_0x7955('0x2d')]+'%'};return _0x273012;})});}_0x32168a=_[_0x7955('0xd0')]({},_0x32168a,_0x48ce68[_0x7955('0x50')]);return _0x238ac6[_0x7955('0x117')](_0x32168a);}})['then'](function(_0x169eea){if(_0x169eea){_0x2cc400=_0x169eea[_0x7955('0x48')];if(!_0x48ce68[_0x7955('0x3f')][_0x7955('0xd2')](_0x7955('0xd3'))){_0x32168a[_0x7955('0x15')]=qs[_0x7955('0x15')](_0x48ce68[_0x7955('0x3f')][_0x7955('0x15')]);_0x32168a[_0x7955('0x14')]=qs[_0x7955('0x14')](_0x48ce68[_0x7955('0x3f')][_0x7955('0x14')]);}return _0x238ac6[_0x7955('0x117')](_0x32168a);}})[_0x7955('0x1b')](function(_0xca787c){if(_0xca787c){return _0xca787c?{'count':_0x2cc400,'rows':_0xca787c}:null;}})[_0x7955('0x1b')](respondWithResult(_0x3d0f05,null))[_0x7955('0x4e')](handleError(_0x3d0f05,null));};exports[_0x7955('0x118')]=function(_0x99525d,_0x1efc32){var _0x42bb30={};var _0xbe4982={};var _0x3f2143;return db[_0x7955('0x34')]['findOne']({'where':{'id':_0x99525d[_0x7955('0x4f')]['id']}})[_0x7955('0x1b')](handleEntityNotFound(_0x1efc32,null))[_0x7955('0x1b')](function(_0x4e178b){if(_0x4e178b){_0x3f2143=_0x4e178b;_0xbe4982[_0x7955('0xc9')]=_[_0x7955('0xca')](db[_0x7955('0x34')][_0x7955('0x35')]);_0xbe4982['query']=_[_0x7955('0xca')](_0x99525d[_0x7955('0x3f')]);_0xbe4982['filters']=_['intersection'](_0xbe4982[_0x7955('0xc9')],_0xbe4982[_0x7955('0x3f')]);_0x42bb30['attributes']=_[_0x7955('0xcc')](_0xbe4982[_0x7955('0xc9')],qs[_0x7955('0xcd')](_0x99525d['query'][_0x7955('0xcd')]));_0x42bb30['attributes']=_0x42bb30[_0x7955('0x45')]['length']?_0x42bb30[_0x7955('0x45')]:_0xbe4982['model'];_0x42bb30['order']=qs[_0x7955('0xd5')](_0x99525d[_0x7955('0x3f')]['sort']);_0x42bb30['where']=qs[_0x7955('0xcb')](_[_0x7955('0xcf')](_0x99525d[_0x7955('0x3f')],_0xbe4982['filters']));if(_0x99525d[_0x7955('0x3f')]['filter']){_0x42bb30[_0x7955('0x3e')]=_[_0x7955('0xd0')](_0x42bb30[_0x7955('0x3e')],{'$or':_[_0x7955('0x2f')](_0x42bb30[_0x7955('0x45')],function(_0x17b9aa){var _0x1d957d={};_0x1d957d[_0x17b9aa]={'$like':'%'+_0x99525d[_0x7955('0x3f')]['filter']+'%'};return _0x1d957d;})});}_0x42bb30[_0x7955('0xc9')]=db[_0x7955('0x34')];_0x42bb30['as']=_0x7955('0x2b');_0x42bb30=_['merge']({},_0x42bb30,_0x99525d[_0x7955('0x50')]);return _0x3f2143[_0x7955('0x119')]({'include':[_0x42bb30]});}})[_0x7955('0x1b')](function(_0x324eb6){if(_0x324eb6){var _0x24a8eb={},_0xc0f8ed=[];for(var _0x283a48=0x0;_0x283a48<_0x324eb6['length'];_0x283a48+=0x1){for(var _0x3bc6bb=0x0,_0x1d0b1a;_0x3bc6bb<_0x324eb6[_0x283a48]['Agents']['length'];_0x3bc6bb+=0x1){_0x1d0b1a=_0x324eb6[_0x283a48][_0x7955('0x2b')][_0x3bc6bb][_0x7955('0x27')]({'plain':!![]});_0x24a8eb[_0x1d0b1a['id']]=_0x1d0b1a;}}_0x24a8eb=_[_0x7955('0x11a')](_0x24a8eb);for(var _0x1d9d4e=qs[_0x7955('0x14')](_0x99525d[_0x7955('0x3f')][_0x7955('0x14')]);_0x1d9d4e<_0x24a8eb['length']&&_0xc0f8ed[_0x7955('0x48')]=_0x17f7dd[_0x0ff1('0x4a')]){throw new Error(_0x0ff1('0x4b'));}})[_0x0ff1('0x14')](function(){if(_0x5f04b3){return db[_0x0ff1('0x22')][_0x0ff1('0x41')]({'where':{'membername':_0x5f04b3[_0x0ff1('0x1d')]},'individualHooks':!![]});}})['then'](function(){if(_0x5f04b3){return _0x5f04b3['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x53b248){if(_0x5f04b3){if(_0x53b248){var _0x4ececc=[];_0x78a6f0=_0x53b248;if(_0x78a6f0['length']){for(var _0x20138e=0x0;_0x20138e<_0x78a6f0[_0x0ff1('0x26')];_0x20138e++){_0x4ececc[_0x0ff1('0x2a')](db['UserVoiceQueueRt'][_0x0ff1('0x4c')]({'membername':_0x5f04b3['name'],'UserId':_0x5f04b3['id'],'queue_name':_0x78a6f0[_0x20138e][_0x0ff1('0x1d')],'VoiceQueueId':_0x78a6f0[_0x20138e]['id'],'interface':_0x3c1423,'paused':_0x5f04b3['loginInPause']||![],'penalty':_0x78a6f0[_0x20138e][_0x0ff1('0x4d')]||0x0}));}return BPromise[_0x0ff1('0x43')](_0x4ececc);}}}})[_0x0ff1('0x14')](function(){if(_0x5f04b3){return db[_0x0ff1('0x23')][_0x0ff1('0x24')]({'where':{'membername':_0x5f04b3['name'],'exitAt':null}});}})[_0x0ff1('0x14')](function(_0x11990f){if(_0x5f04b3){if(_0x11990f&&_0x11990f['length']){var _0x1c197d=[];_0x11990f[_0x0ff1('0x42')](function(_0x15bd7c){_0x1c197d[_0x0ff1('0x2a')](_0x15bd7c['update']({'exitAt':moment()[_0x0ff1('0x20')](_0x0ff1('0x27'))}));});return BPromise[_0x0ff1('0x43')](_0x1c197d);}}})[_0x0ff1('0x14')](function(){if(_0x5f04b3){var _0x45e36a=[];var _0x6076bf=[];var _0x430165=utils['getChannels']();var _0xd1a86e={'membername':_0x5f04b3[_0x0ff1('0x1d')],'interface':_0x3c1423,'enterAt':moment()[_0x0ff1('0x20')](_0x0ff1('0x27')),'role':_0x5f04b3[_0x0ff1('0x1e')],'internal':_0x5f04b3[_0x0ff1('0x1f')]};_0x430165['forEach'](function(_0x5d4a8f){_0x45e36a[_0x0ff1('0x2a')](_['merge']({'channel':_0x5d4a8f,'type':_0x0ff1('0x4e'),'data1':_0x0ff1('0x4f'),'data2':_0x3c1423},_0xd1a86e));if(_0x5f04b3[_0x0ff1('0x46')]){_0x6076bf[_0x0ff1('0x2a')](_[_0x0ff1('0x50')]({'channel':_0x5d4a8f,'type':'PAUSE','data1':_0x0ff1('0x51')},_0xd1a86e));}});return db['MemberReport'][_0x0ff1('0x30')](_0x45e36a[_0x0ff1('0x52')](_0x6076bf),{'individualHooks':!![]});}})[_0x0ff1('0x14')](function(){if(_0x5f04b3){return _0x5f04b3[_0x0ff1('0x31')]({'online':!![],'lastLoginAt':moment()[_0x0ff1('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5f04b3['loginInPause']||![],'mailPause':_0x5f04b3['loginInPause']||![],'chatPause':_0x5f04b3[_0x0ff1('0x46')]||![],'faxPause':_0x5f04b3[_0x0ff1('0x46')]||![],'smsPause':_0x5f04b3[_0x0ff1('0x46')]||![],'openchannelPause':_0x5f04b3[_0x0ff1('0x46')]||![],'pauseType':_0x5f04b3[_0x0ff1('0x46')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x0ff1('0x20')](_0x0ff1('0x27')),'interface':_0x3c1423});}})[_0x0ff1('0x14')](function(_0x2e44dd){_0x57f788(_0x2e44dd);})[_0x0ff1('0x16')](function(_0x13c61b){_0x29251e(_0x360ffa[_0x0ff1('0x17')](0x1f4,_0x13c61b['message']));});});}; \ No newline at end of file +var _0x1d5c=['faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','unpause','LogoutUser','destroy','push','all','mobile','phone','internal','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','defaults','redis','localhost','./user.socket','register','User','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','GetUser','stringify','error','message','ShowUser','find','catch','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','body','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause'];(function(_0x90e3e0,_0x5ddcdf){var _0x4df3d1=function(_0x57d9e6){while(--_0x57d9e6){_0x90e3e0['push'](_0x90e3e0['shift']());}};_0x4df3d1(++_0x5ddcdf);}(_0x1d5c,0x74));var _0xc1d5=function(_0x5046cf,_0x44c493){_0x5046cf=_0x5046cf-0x0;var _0x2fb819=_0x1d5c[_0x5046cf];return _0x2fb819;};'use strict';var _=require(_0xc1d5('0x0'));var util=require(_0xc1d5('0x1'));var moment=require(_0xc1d5('0x2'));var BPromise=require(_0xc1d5('0x3'));var Redis=require(_0xc1d5('0x4'));var db=require(_0xc1d5('0x5'))['db'];var utils=require(_0xc1d5('0x6'));var logger=require('../../config/logger')(_0xc1d5('0x7'));var config=require('../../config/environment');config['redis']=_[_0xc1d5('0x8')](config[_0xc1d5('0x9')],{'host':_0xc1d5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1d5('0x9')]));require(_0xc1d5('0xb'))[_0xc1d5('0xc')](socket);exports['GetUser']=function(_0x2e8cf1){var _0x58b14c=this;return new Promise(function(_0x58e350,_0x221037){return db[_0xc1d5('0xd')][_0xc1d5('0xe')]({'raw':_0x2e8cf1[_0xc1d5('0xf')]?_0x2e8cf1[_0xc1d5('0xf')][_0xc1d5('0x10')]===undefined?!![]:![]:!![],'where':_0x2e8cf1[_0xc1d5('0xf')]?_0x2e8cf1['options'][_0xc1d5('0x11')]||null:null,'attributes':_0x2e8cf1[_0xc1d5('0xf')]?_0x2e8cf1[_0xc1d5('0xf')][_0xc1d5('0x12')]||null:null,'limit':_0x2e8cf1['options']?_0x2e8cf1[_0xc1d5('0xf')][_0xc1d5('0x13')]||null:null,'include':_0x2e8cf1[_0xc1d5('0xf')]?_0x2e8cf1['options'][_0xc1d5('0x14')]?_[_0xc1d5('0x15')](_0x2e8cf1[_0xc1d5('0xf')][_0xc1d5('0x14')],function(_0x3df160){return{'model':db[_0x3df160[_0xc1d5('0x16')]],'as':_0x3df160['as'],'attributes':_0x3df160[_0xc1d5('0x12')],'include':_0x3df160[_0xc1d5('0x14')]?_['map'](_0x3df160['include'],function(_0x592ae7){return{'model':db[_0x592ae7[_0xc1d5('0x16')]],'as':_0x592ae7['as'],'attributes':_0x592ae7[_0xc1d5('0x12')],'include':_0x592ae7['include']?_['map'](_0x592ae7[_0xc1d5('0x14')],function(_0x37a3c2){return{'model':db[_0x37a3c2[_0xc1d5('0x16')]],'as':_0x37a3c2['as'],'attributes':_0x37a3c2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1d5('0x17')](function(_0x424d22){logger[_0xc1d5('0x18')]('GetUser',_0x2e8cf1);logger[_0xc1d5('0x19')](_0xc1d5('0x1a'),_0x2e8cf1,JSON[_0xc1d5('0x1b')](_0x424d22));_0x58e350(_0x424d22);})['catch'](function(_0x33202d){logger[_0xc1d5('0x1c')]('GetUser',_0x33202d[_0xc1d5('0x1d')],_0x2e8cf1);_0x221037(_0x58b14c[_0xc1d5('0x1c')](0x1f4,_0x33202d[_0xc1d5('0x1d')]));});});};exports[_0xc1d5('0x1e')]=function(_0x2393ab){var _0x3a080b=this;return new Promise(function(_0x56ff24,_0x188d20){return db[_0xc1d5('0xd')][_0xc1d5('0x1f')]({'raw':_0x2393ab['options']?_0x2393ab[_0xc1d5('0xf')][_0xc1d5('0x10')]===undefined?!![]:![]:!![],'where':_0x2393ab[_0xc1d5('0xf')]?_0x2393ab['options'][_0xc1d5('0x11')]||null:null,'attributes':_0x2393ab['options']?_0x2393ab[_0xc1d5('0xf')][_0xc1d5('0x12')]||null:null,'include':_0x2393ab[_0xc1d5('0xf')]?_0x2393ab[_0xc1d5('0xf')][_0xc1d5('0x14')]?_[_0xc1d5('0x15')](_0x2393ab[_0xc1d5('0xf')][_0xc1d5('0x14')],function(_0x3be1c6){return{'model':db[_0x3be1c6[_0xc1d5('0x16')]],'as':_0x3be1c6['as'],'attributes':_0x3be1c6['attributes'],'include':_0x3be1c6['include']?_['map'](_0x3be1c6[_0xc1d5('0x14')],function(_0x51a0b3){return{'model':db[_0x51a0b3['model']],'as':_0x51a0b3['as'],'attributes':_0x51a0b3[_0xc1d5('0x12')],'include':_0x51a0b3['include']?_['map'](_0x51a0b3[_0xc1d5('0x14')],function(_0x1897d6){return{'model':db[_0x1897d6[_0xc1d5('0x16')]],'as':_0x1897d6['as'],'attributes':_0x1897d6[_0xc1d5('0x12')]};}):[]};}):[]};}):[]:[]})[_0xc1d5('0x17')](function(_0x142154){logger[_0xc1d5('0x18')]('ShowUser',_0x2393ab);logger[_0xc1d5('0x19')](_0xc1d5('0x1e'),_0x2393ab,JSON[_0xc1d5('0x1b')](_0x142154));_0x56ff24(_0x142154);})[_0xc1d5('0x20')](function(_0x188997){logger[_0xc1d5('0x1c')](_0xc1d5('0x1e'),_0x188997[_0xc1d5('0x1d')],_0x2393ab);_0x188d20(_0x3a080b[_0xc1d5('0x1c')](0x1f4,_0x188997[_0xc1d5('0x1d')]));});});};exports['PauseUser']=function(_0x5c0833){var _0x583bb5;return db['User'][_0xc1d5('0x1f')]({'where':_0x5c0833[_0xc1d5('0xf')][_0xc1d5('0x11')]||{},'attributes':['id',_0xc1d5('0x21'),_0xc1d5('0x22'),'internal',_0xc1d5('0x23')]})[_0xc1d5('0x17')](function(_0x4cb666){if(!_0x4cb666){throw new Error(util[_0xc1d5('0x24')](_0xc1d5('0x25'),_0x5c0833[_0xc1d5('0x26')]['id']));}_0x583bb5=_0x4cb666;return db[_0xc1d5('0x27')][_0xc1d5('0x28')]({'paused':0x1},{'where':{'UserId':_0x583bb5['id']},'individualHooks':!![]});})['then'](function(){return db[_0xc1d5('0x29')][_0xc1d5('0xe')]({'where':{'membername':_0x583bb5[_0xc1d5('0x21')],'type':_0xc1d5('0x2a'),'exitAt':null}});})[_0xc1d5('0x17')](function(_0x4ba792){if(_0x4ba792&&_0x4ba792[_0xc1d5('0x2b')]){var _0x48b045=moment()[_0xc1d5('0x24')](_0xc1d5('0x2c'));for(var _0x487ad8=0x0,_0x1104c3=_0x4ba792[_0xc1d5('0x2b')];_0x487ad8<_0x1104c3;_0x487ad8++){_0x4ba792[_0x487ad8][_0xc1d5('0x2d')]({'exitAt':_0x48b045});}}})[_0xc1d5('0x17')](function(){var _0x5e78f9=[];var _0x33c170=utils[_0xc1d5('0x2e')]();_0x33c170[_0xc1d5('0x2f')](function(_0x45874f){_0x5e78f9['push']({'channel':_0x45874f,'membername':_0x583bb5[_0xc1d5('0x21')],'interface':_[_0xc1d5('0x30')](_0x583bb5[_0xc1d5('0x23')])?util['format'](_0xc1d5('0x31'),_0x583bb5[_0xc1d5('0x21')]):_0x583bb5['interface'],'type':_0xc1d5('0x2a'),'enterAt':moment()[_0xc1d5('0x24')](_0xc1d5('0x2c')),'data1':_0x5c0833['body'][_0xc1d5('0x32')]||_0xc1d5('0x33'),'role':_0x583bb5[_0xc1d5('0x22')],'internal':_0x583bb5['internal'],'uniqueid':_0x5c0833['body'][_0xc1d5('0x34')]||null});});return db['MemberReport'][_0xc1d5('0x35')](_0x5e78f9,{'individualHooks':!![]});})[_0xc1d5('0x17')](function(){return _0x583bb5[_0xc1d5('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5c0833[_0xc1d5('0x36')][_0xc1d5('0x32')]||_0xc1d5('0x33'),'lastPauseAt':moment()[_0xc1d5('0x24')](_0xc1d5('0x2c'))});})[_0xc1d5('0x20')](function(_0x2cc862){throw _0x2cc862;});};exports['UnpauseUser']=function(_0x14e48b){return Promise['resolve']()[_0xc1d5('0x17')](function(){if(_0x14e48b[_0xc1d5('0x36')][_0xc1d5('0x37')]&&!utils['isValidChannel'](_0x14e48b[_0xc1d5('0x36')][_0xc1d5('0x37')])){throw new Error(util[_0xc1d5('0x24')](_0xc1d5('0x38'),_0x14e48b[_0xc1d5('0x36')][_0xc1d5('0x37')]));}return db[_0xc1d5('0xd')][_0xc1d5('0x39')]({'where':_0x14e48b[_0xc1d5('0xf')][_0xc1d5('0x11')]||{},'attributes':['id',_0xc1d5('0x21'),_0xc1d5('0x22'),'internal',_0xc1d5('0x23'),_0xc1d5('0x3a'),'voicePause',_0xc1d5('0x3b'),'chatPause',_0xc1d5('0x3c'),_0xc1d5('0x3d'),'smsPause',_0xc1d5('0x3e'),_0xc1d5('0x3f'),_0xc1d5('0x40')]});})[_0xc1d5('0x17')](function(_0x1be71a){if(!_0x1be71a){throw new Error(util[_0xc1d5('0x24')](_0xc1d5('0x25'),_0x14e48b[_0xc1d5('0x26')]['id']));}return _0x1be71a[_0xc1d5('0x41')](_0x14e48b['body'][_0xc1d5('0x37')],'system');})[_0xc1d5('0x20')](function(_0x5cd780){throw _0x5cd780;});};exports[_0xc1d5('0x42')]=function(_0x366a9f){var _0x14e76e=this;return new Promise(function(_0x11ec43,_0x546ef8){var _0x10953f;return db[_0xc1d5('0xd')][_0xc1d5('0x39')]({'where':_0x366a9f[_0xc1d5('0xf')][_0xc1d5('0x11')]||{},'attributes':['id','name']})[_0xc1d5('0x17')](function(_0x475ecb){if(_0x475ecb){_0x10953f=_0x475ecb;return db[_0xc1d5('0x27')][_0xc1d5('0x43')]({'where':{'membername':_0x10953f['name']},'individualHooks':!![]});}})[_0xc1d5('0x17')](function(){if(_0x10953f){return db[_0xc1d5('0x29')]['findAll']({'where':{'membername':_0x10953f['name'],'exitAt':null}});}})[_0xc1d5('0x17')](function(_0x581762){if(_0x10953f){if(_0x581762&&_0x581762['length']){var _0x20005e=[];_0x581762[_0xc1d5('0x2f')](function(_0x2985cc){_0x20005e[_0xc1d5('0x44')](_0x2985cc[_0xc1d5('0x28')]({'exitAt':moment()[_0xc1d5('0x24')](_0xc1d5('0x2c'))}));});return BPromise[_0xc1d5('0x45')](_0x20005e);}}})[_0xc1d5('0x17')](function(){if(_0x10953f){return _0x10953f[_0xc1d5('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xc1d5('0x17')](function(_0x51e15a){_0x11ec43(_0x51e15a);})['catch'](function(_0x2c66a9){_0x546ef8(_0x14e76e[_0xc1d5('0x1c')](0x1f4,_0x2c66a9['message']));});});};exports['LoginUser']=function(_0x36b9ee){var _0x198623=this;return new Promise(function(_0x17a4dd,_0x42ce7d){var _0x372410;var _0x12f10c;var _0x42cce1;var _0x360a7b;return db[_0xc1d5('0xd')][_0xc1d5('0x39')]({'where':_0x36b9ee[_0xc1d5('0xf')]['where']||{},'attributes':['id',_0xc1d5('0x21'),'role',_0xc1d5('0x46'),_0xc1d5('0x47'),_0xc1d5('0x48'),_0xc1d5('0x49'),'interface']})[_0xc1d5('0x17')](function(_0x5e5fd3){if(_0x5e5fd3){_0x372410=_0x5e5fd3;_0x360a7b=_0x36b9ee[_0xc1d5('0x36')][_0xc1d5('0x23')]?_0x36b9ee[_0xc1d5('0x36')][_0xc1d5('0x23')]:util[_0xc1d5('0x24')](_0xc1d5('0x31'),_0x372410[_0xc1d5('0x21')]);return db[_0xc1d5('0xd')][_0xc1d5('0x4a')]({'where':{'role':_0xc1d5('0x4b'),'online':!![],'id':{'$ne':_0x372410['id']}}});}})[_0xc1d5('0x17')](function(_0x47477d){if(_0x47477d){_0x42cce1=_0x47477d;return require(_0xc1d5('0x4c'))[_0xc1d5('0x4d')]();}})[_0xc1d5('0x17')](function(_0x2474ca){if(_0x2474ca&&_0x2474ca[_0xc1d5('0x4e')]&&_0x42cce1>=_0x2474ca[_0xc1d5('0x4e')]){throw new Error(_0xc1d5('0x4f'));}})['then'](function(){if(_0x372410){return db[_0xc1d5('0x27')][_0xc1d5('0x43')]({'where':{'membername':_0x372410[_0xc1d5('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x372410){return _0x372410[_0xc1d5('0x50')]({'raw':!![]});}})[_0xc1d5('0x17')](function(_0x3ae74b){if(_0x372410){if(_0x3ae74b){var _0x84809b=[];_0x12f10c=_0x3ae74b;if(_0x12f10c['length']){for(var _0x5cbd76=0x0;_0x5cbd76<_0x12f10c[_0xc1d5('0x2b')];_0x5cbd76++){_0x84809b['push'](db[_0xc1d5('0x27')][_0xc1d5('0x51')]({'membername':_0x372410['name'],'UserId':_0x372410['id'],'queue_name':_0x12f10c[_0x5cbd76][_0xc1d5('0x21')],'VoiceQueueId':_0x12f10c[_0x5cbd76]['id'],'interface':_0x360a7b,'paused':_0x372410['loginInPause']||![],'penalty':_0x12f10c[_0x5cbd76][_0xc1d5('0x52')]||0x0}));}return BPromise[_0xc1d5('0x45')](_0x84809b);}}}})[_0xc1d5('0x17')](function(){if(_0x372410){return db[_0xc1d5('0x29')]['findAll']({'where':{'membername':_0x372410[_0xc1d5('0x21')],'exitAt':null}});}})[_0xc1d5('0x17')](function(_0x2f6092){if(_0x372410){if(_0x2f6092&&_0x2f6092['length']){var _0x2e457f=[];_0x2f6092['forEach'](function(_0x11ab6c){_0x2e457f[_0xc1d5('0x44')](_0x11ab6c[_0xc1d5('0x28')]({'exitAt':moment()[_0xc1d5('0x24')](_0xc1d5('0x2c'))}));});return BPromise[_0xc1d5('0x45')](_0x2e457f);}}})[_0xc1d5('0x17')](function(){if(_0x372410){var _0x41933f=[];var _0x5b9536=[];var _0x1b15d6=utils[_0xc1d5('0x2e')]();var _0x3837f8={'membername':_0x372410[_0xc1d5('0x21')],'interface':_0x360a7b,'enterAt':moment()['format'](_0xc1d5('0x2c')),'role':_0x372410[_0xc1d5('0x22')],'internal':_0x372410['internal']};_0x1b15d6[_0xc1d5('0x2f')](function(_0x30dfec){_0x41933f[_0xc1d5('0x44')](_[_0xc1d5('0x53')]({'channel':_0x30dfec,'type':_0xc1d5('0x54'),'data1':_0xc1d5('0x55'),'data2':_0x360a7b},_0x3837f8));if(_0x372410['loginInPause']){_0x5b9536[_0xc1d5('0x44')](_[_0xc1d5('0x53')]({'channel':_0x30dfec,'type':_0xc1d5('0x2a'),'data1':_0xc1d5('0x56')},_0x3837f8));}});return db['MemberReport'][_0xc1d5('0x35')](_0x41933f[_0xc1d5('0x57')](_0x5b9536),{'individualHooks':!![]});}})[_0xc1d5('0x17')](function(){if(_0x372410){return _0x372410[_0xc1d5('0x28')]({'online':!![],'lastLoginAt':moment()['format'](_0xc1d5('0x2c')),'voicePause':_0x372410['loginInPause']||![],'mailPause':_0x372410['loginInPause']||![],'chatPause':_0x372410[_0xc1d5('0x49')]||![],'faxPause':_0x372410[_0xc1d5('0x49')]||![],'smsPause':_0x372410[_0xc1d5('0x49')]||![],'openchannelPause':_0x372410[_0xc1d5('0x49')]||![],'pauseType':_0x372410[_0xc1d5('0x49')]?_0xc1d5('0x56'):null,'lastPauseAt':moment()[_0xc1d5('0x24')](_0xc1d5('0x2c')),'interface':_0x360a7b});}})['then'](function(_0x34ed7b){_0x17a4dd(_0x34ed7b);})[_0xc1d5('0x20')](function(_0x9b0fb0){_0x42ce7d(_0x198623[_0xc1d5('0x1c')](0x1f4,_0x9b0fb0[_0xc1d5('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bb991bd..453e7bc 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 _0xd58e=['update','emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x3b3613,_0x521e7a){var _0x1fc80d=function(_0x32e775){while(--_0x32e775){_0x3b3613['push'](_0x3b3613['shift']());}};_0x1fc80d(++_0x521e7a);}(_0xd58e,0x19b));var _0xed58=function(_0x3f574f,_0x51bad2){_0x3f574f=_0x3f574f-0x0;var _0x4b0397=_0xd58e[_0x3f574f];return _0x4b0397;};'use strict';var UserEvents=require(_0xed58('0x0'));var events=[_0xed58('0x1'),_0xed58('0x2'),_0xed58('0x3')];function createListener(_0x5e4aa4,_0x29db2d){return function(_0x31ff59){_0x29db2d[_0xed58('0x4')](_0x5e4aa4,_0x31ff59);};}function removeListener(_0xc79c64,_0x39d38d){return function(){UserEvents[_0xed58('0x5')](_0xc79c64,_0x39d38d);};}exports[_0xed58('0x6')]=function(_0xef7b10){for(var _0x429e88=0x0,_0x54643f=events[_0xed58('0x7')];_0x429e88<_0x54643f;_0x429e88++){var _0x391232=events[_0x429e88];var _0x3c773c=createListener(_0xed58('0x8')+_0x391232,_0xef7b10);UserEvents['on'](_0x391232,_0x3c773c);}}; \ No newline at end of file +var _0x4a40=['update','emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4a40,0x14a));var _0x04a4=function(_0x55adee,_0x4d9108){_0x55adee=_0x55adee-0x0;var _0x5f0455=_0x4a40[_0x55adee];return _0x5f0455;};'use strict';var UserEvents=require(_0x04a4('0x0'));var events=[_0x04a4('0x1'),_0x04a4('0x2'),_0x04a4('0x3')];function createListener(_0x34b61e,_0xf19ad7){return function(_0x4cf806){_0xf19ad7[_0x04a4('0x4')](_0x34b61e,_0x4cf806);};}function removeListener(_0x8bb10,_0x31ba4d){return function(){UserEvents[_0x04a4('0x5')](_0x8bb10,_0x31ba4d);};}exports[_0x04a4('0x6')]=function(_0x445b9d){for(var _0x1f6c45=0x0,_0x278be3=events[_0x04a4('0x7')];_0x1f6c45<_0x278be3;_0x1f6c45++){var _0x5b7361=events[_0x1f6c45];var _0x46f3c3=createListener(_0x04a4('0x8')+_0x5b7361,_0x445b9d);UserEvents['on'](_0x5b7361,_0x46f3c3);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 84b8d1f..5c22410 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3e4557,_0x2f7730){var _0x22e593=function(_0x5307da){while(--_0x5307da){_0x3e4557['push'](_0x3e4557['shift']());}};_0x22e593(++_0x2f7730);}(_0x70e0,0x17b));var _0x070e=function(_0x29e373,_0xace428){_0x29e373=_0x29e373-0x0;var _0xec976d=_0x70e0[_0x29e373];return _0xec976d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1818f4,_0x598dd3){var _0x546d98=function(_0x100a04){while(--_0x100a04){_0x1818f4['push'](_0x1818f4['shift']());}};_0x546d98(++_0x598dd3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a1377b4..db1530b 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 _0x0b5b=['INTEGER','exports'];(function(_0x47c894,_0x22cdc1){var _0xdab4b7=function(_0x2cf3c6){while(--_0x2cf3c6){_0x47c894['push'](_0x47c894['shift']());}};_0xdab4b7(++_0x22cdc1);}(_0x0b5b,0x147));var _0xb0b5=function(_0x5b485f,_0x3ca456){_0x5b485f=_0x5b485f-0x0;var _0x262f45=_0x0b5b[_0x5b485f];return _0x262f45;};'use strict';var Sequelize=require('sequelize');module[_0xb0b5('0x0')]={'penalty':{'type':Sequelize[_0xb0b5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ac6=['INTEGER'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x0ac6,0x188));var _0x60ac=function(_0x408a51,_0xd49817){_0x408a51=_0x408a51-0x0;var _0x454cf9=_0x0ac6[_0x408a51];return _0x454cf9;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x60ac('0x0')],'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 6beb4e0..a0dc063 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 _0xda6b=['moment','path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xda6b,0xad));var _0xbda6=function(_0x4f4a70,_0x4ed866){_0x4f4a70=_0x4f4a70-0x0;var _0x531f5a=_0xda6b[_0x4f4a70];return _0x531f5a;};'use strict';var _=require(_0xbda6('0x0'));var util=require('util');var logger=require(_0xbda6('0x1'))(_0xbda6('0x2'));var moment=require(_0xbda6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbda6('0x4'));var rimraf=require('rimraf');var config=require(_0xbda6('0x5'));var attributes=require(_0xbda6('0x6'));module[_0xbda6('0x7')]=function(_0xc2131a,_0x286eca){return _0xc2131a[_0xbda6('0x8')](_0xbda6('0x9'),attributes,{'tableName':_0xbda6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8848=['api','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','lodash','../../config/logger'];(function(_0x350dc6,_0x36ab14){var _0x2e5887=function(_0x5370ad){while(--_0x5370ad){_0x350dc6['push'](_0x350dc6['shift']());}};_0x2e5887(++_0x36ab14);}(_0x8848,0x134));var _0x8884=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x8848[_0x211632];return _0x5a1da1;};'use strict';var _=require(_0x8884('0x0'));var util=require('util');var logger=require(_0x8884('0x1'))(_0x8884('0x2'));var moment=require('moment');var BPromise=require(_0x8884('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8884('0x4'));var rimraf=require(_0x8884('0x5'));var config=require(_0x8884('0x6'));var attributes=require(_0x8884('0x7'));module[_0x8884('0x8')]=function(_0x3d5023,_0x81a179){return _0x3d5023['define'](_0x8884('0x9'),attributes,{'tableName':'user_has_chat_queues','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 7bfcc5f..9628b67 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 _0x5a9f=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x40de39,_0x200789){var _0x297839=function(_0x3ed462){while(--_0x3ed462){_0x40de39['push'](_0x40de39['shift']());}};_0x297839(++_0x200789);}(_0x5a9f,0x8d));var _0xf5a9=function(_0x1dd7e6,_0x45d47e){_0x1dd7e6=_0x1dd7e6-0x0;var _0x29ebbc=_0x5a9f[_0x1dd7e6];return _0x29ebbc;};'use strict';var _=require(_0xf5a9('0x0'));var util=require('util');var moment=require(_0xf5a9('0x1'));var BPromise=require(_0xf5a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5a9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf5a9('0x4'));var config=require(_0xf5a9('0x5'));var jayson=require(_0xf5a9('0x6'));var client=jayson['client'][_0xf5a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ccdf0,_0x19065d,_0x3dabc8){return new BPromise(function(_0x264cc1,_0x273af3){return client[_0xf5a9('0x8')](_0x2ccdf0,_0x3dabc8)[_0xf5a9('0x9')](function(_0x5c603a){logger[_0xf5a9('0xa')](_0xf5a9('0xb'),_0x19065d,_0xf5a9('0xc'));logger[_0xf5a9('0xd')](_0xf5a9('0xe'),_0x19065d,_0xf5a9('0xc'),JSON['stringify'](_0x5c603a));if(_0x5c603a['error']){if(_0x5c603a[_0xf5a9('0xf')][_0xf5a9('0x10')]===0x1f4){logger[_0xf5a9('0xf')](_0xf5a9('0xb'),_0x19065d,_0x5c603a[_0xf5a9('0xf')]['message']);return _0x273af3(_0x5c603a[_0xf5a9('0xf')]['message']);}logger[_0xf5a9('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x19065d,_0x5c603a[_0xf5a9('0xf')][_0xf5a9('0x11')]);return _0x264cc1(_0x5c603a[_0xf5a9('0xf')][_0xf5a9('0x11')]);}else{logger['info'](_0xf5a9('0xb'),_0x19065d,_0xf5a9('0xc'));_0x264cc1(_0x5c603a[_0xf5a9('0x12')][_0xf5a9('0x11')]);}})['catch'](function(_0x4a9eab){logger[_0xf5a9('0xf')](_0xf5a9('0xb'),_0x19065d,_0x4a9eab);_0x273af3(_0x4a9eab);});});} \ No newline at end of file +var _0xe30d=['../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1412c3,_0x3d4f35){var _0x25b589=function(_0x3fa3a9){while(--_0x3fa3a9){_0x1412c3['push'](_0x1412c3['shift']());}};_0x25b589(++_0x3d4f35);}(_0xe30d,0x1f3));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde30('0x0'));var util=require(_0xde30('0x1'));var moment=require(_0xde30('0x2'));var BPromise=require(_0xde30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde30('0x4'));var db=require(_0xde30('0x5'))['db'];var utils=require(_0xde30('0x6'));var logger=require(_0xde30('0x7'))(_0xde30('0x8'));var config=require(_0xde30('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xde30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd3ec77,_0x439f4a,_0x3cc127){return new BPromise(function(_0x2ff698,_0x17af7c){return client['request'](_0xd3ec77,_0x3cc127)[_0xde30('0xb')](function(_0x44b008){logger[_0xde30('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x439f4a,_0xde30('0xd'));logger[_0xde30('0xe')](_0xde30('0xf'),_0x439f4a,_0xde30('0xd'),JSON[_0xde30('0x10')](_0x44b008));if(_0x44b008[_0xde30('0x11')]){if(_0x44b008['error'][_0xde30('0x12')]===0x1f4){logger['error'](_0xde30('0x13'),_0x439f4a,_0x44b008[_0xde30('0x11')][_0xde30('0x14')]);return _0x17af7c(_0x44b008['error'][_0xde30('0x14')]);}logger[_0xde30('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x439f4a,_0x44b008['error']['message']);return _0x2ff698(_0x44b008[_0xde30('0x11')][_0xde30('0x14')]);}else{logger[_0xde30('0xc')](_0xde30('0x13'),_0x439f4a,_0xde30('0xd'));_0x2ff698(_0x44b008['result']['message']);}})[_0xde30('0x15')](function(_0x33f2c6){logger[_0xde30('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x439f4a,_0x33f2c6);_0x17af7c(_0x33f2c6);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 92b0023..3e01223 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc782d3,_0x28a86c){var _0x510d56=function(_0x8b18a3){while(--_0x8b18a3){_0xc782d3['push'](_0xc782d3['shift']());}};_0x510d56(++_0x28a86c);}(_0xe706,0xa3));var _0x6e70=function(_0x260ce2,_0x2e22b8){_0x260ce2=_0x260ce2-0x0;var _0x16b105=_0xe706[_0x260ce2];return _0x16b105;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d219c,_0x50820a){var _0x3d9fde=function(_0x2e5b62){while(--_0x2e5b62){_0x1d219c['push'](_0x1d219c['shift']());}};_0x3d9fde(++_0x50820a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 3d9e8bd..ad819dc 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 _0x8a43=['INTEGER','STRING','sequelize','exports'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x8a43,0x15a));var _0x38a4=function(_0x52ec57,_0x5a25a5){_0x52ec57=_0x52ec57-0x0;var _0x2212f1=_0x8a43[_0x52ec57];return _0x2212f1;};'use strict';var Sequelize=require(_0x38a4('0x0'));module[_0x38a4('0x1')]={'penalty':{'type':Sequelize[_0x38a4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x38a4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x38a4('0x3')]}}; \ No newline at end of file +var _0xa58d=['STRING','exports','INTEGER'];(function(_0x2ab9b5,_0x5607b8){var _0x9f6232=function(_0x3fe88d){while(--_0x3fe88d){_0x2ab9b5['push'](_0x2ab9b5['shift']());}};_0x9f6232(++_0x5607b8);}(_0xa58d,0x100));var _0xda58=function(_0x30cdf5,_0x328e54){_0x30cdf5=_0x30cdf5-0x0;var _0xeaf6f3=_0xa58d[_0x30cdf5];return _0xeaf6f3;};'use strict';var Sequelize=require('sequelize');module[_0xda58('0x0')]={'penalty':{'type':Sequelize[_0xda58('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xda58('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xda58('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 20fbbe7..d5668b8 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 _0xa34e=['exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x110ab7,_0x3e61a9){var _0x1fed2a=function(_0x2fec4f){while(--_0x2fec4f){_0x110ab7['push'](_0x110ab7['shift']());}};_0x1fed2a(++_0x3e61a9);}(_0xa34e,0x18b));var _0xea34=function(_0x4218d0,_0x18aa4c){_0x4218d0=_0x4218d0-0x0;var _0x2c142c=_0xa34e[_0x4218d0];return _0x2c142c;};'use strict';var _=require(_0xea34('0x0'));var util=require(_0xea34('0x1'));var logger=require(_0xea34('0x2'))(_0xea34('0x3'));var moment=require(_0xea34('0x4'));var BPromise=require(_0xea34('0x5'));var rp=require(_0xea34('0x6'));var fs=require('fs');var path=require(_0xea34('0x7'));var rimraf=require(_0xea34('0x8'));var config=require(_0xea34('0x9'));var attributes=require(_0xea34('0xa'));module[_0xea34('0xb')]=function(_0x4a6039,_0x2a41a7){return _0x4a6039['define'](_0xea34('0xc'),attributes,{'tableName':_0xea34('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2996=['rimraf','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x473766,_0x46ead9){var _0x4d1e5a=function(_0x58b056){while(--_0x58b056){_0x473766['push'](_0x473766['shift']());}};_0x4d1e5a(++_0x46ead9);}(_0x2996,0x14f));var _0x6299=function(_0x296805,_0x4460e9){_0x296805=_0x296805-0x0;var _0x4bb609=_0x2996[_0x296805];return _0x4bb609;};'use strict';var _=require('lodash');var util=require(_0x6299('0x0'));var logger=require(_0x6299('0x1'))(_0x6299('0x2'));var moment=require('moment');var BPromise=require(_0x6299('0x3'));var rp=require(_0x6299('0x4'));var fs=require('fs');var path=require(_0x6299('0x5'));var rimraf=require(_0x6299('0x6'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x6299('0x7')]=function(_0x44160a,_0x33f94c){return _0x44160a[_0x6299('0x8')](_0x6299('0x9'),attributes,{'tableName':_0x6299('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 45a858c..d9d9c8b 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 _0xd6b6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','randomstring','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd6b6,0x18c));var _0x6d6b=function(_0x3a01be,_0x1ab778){_0x3a01be=_0x3a01be-0x0;var _0x4d2615=_0xd6b6[_0x3a01be];return _0x4d2615;};'use strict';var _=require(_0x6d6b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d6b('0x1'));var fs=require('fs');var Redis=require(_0x6d6b('0x2'));var db=require(_0x6d6b('0x3'))['db'];var utils=require(_0x6d6b('0x4'));var logger=require(_0x6d6b('0x5'))(_0x6d6b('0x6'));var config=require(_0x6d6b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d6b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56664f,_0x4c0cad,_0x23e0c0){return new BPromise(function(_0x8615e2,_0x28602f){return client[_0x6d6b('0x9')](_0x56664f,_0x23e0c0)['then'](function(_0x276d89){logger['info'](_0x6d6b('0xa'),_0x4c0cad,_0x6d6b('0xb'));logger[_0x6d6b('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4c0cad,_0x6d6b('0xb'),JSON[_0x6d6b('0xd')](_0x276d89));if(_0x276d89['error']){if(_0x276d89[_0x6d6b('0xe')]['code']===0x1f4){logger['error'](_0x6d6b('0xa'),_0x4c0cad,_0x276d89[_0x6d6b('0xe')][_0x6d6b('0xf')]);return _0x28602f(_0x276d89['error']['message']);}logger[_0x6d6b('0xe')](_0x6d6b('0xa'),_0x4c0cad,_0x276d89[_0x6d6b('0xe')][_0x6d6b('0xf')]);return _0x8615e2(_0x276d89[_0x6d6b('0xe')][_0x6d6b('0xf')]);}else{logger[_0x6d6b('0x10')](_0x6d6b('0xa'),_0x4c0cad,'request\x20sent');_0x8615e2(_0x276d89[_0x6d6b('0x11')][_0x6d6b('0xf')]);}})[_0x6d6b('0x12')](function(_0x4f4962){logger[_0x6d6b('0xe')](_0x6d6b('0xa'),_0x4c0cad,_0x4f4962);_0x28602f(_0x4f4962);});});} \ No newline at end of file +var _0x7aab=['error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x329978,_0x28323f){var _0x10525a=function(_0x67aba0){while(--_0x67aba0){_0x329978['push'](_0x329978['shift']());}};_0x10525a(++_0x28323f);}(_0x7aab,0x97));var _0xb7aa=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7aab[_0x432682];return _0x463d05;};'use strict';var _=require(_0xb7aa('0x0'));var util=require(_0xb7aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb7aa('0x2'));var fs=require('fs');var Redis=require(_0xb7aa('0x3'));var db=require(_0xb7aa('0x4'))['db'];var utils=require(_0xb7aa('0x5'));var logger=require(_0xb7aa('0x6'))(_0xb7aa('0x7'));var config=require(_0xb7aa('0x8'));var jayson=require(_0xb7aa('0x9'));var client=jayson['client'][_0xb7aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58783f,_0x2c0aef,_0x41eac3){return new BPromise(function(_0x4d4546,_0x17da69){return client[_0xb7aa('0xb')](_0x58783f,_0x41eac3)['then'](function(_0xefbe69){logger[_0xb7aa('0xc')](_0xb7aa('0xd'),_0x2c0aef,'request\x20sent');logger[_0xb7aa('0xe')](_0xb7aa('0xf'),_0x2c0aef,_0xb7aa('0x10'),JSON['stringify'](_0xefbe69));if(_0xefbe69[_0xb7aa('0x11')]){if(_0xefbe69[_0xb7aa('0x11')]['code']===0x1f4){logger[_0xb7aa('0x11')](_0xb7aa('0xd'),_0x2c0aef,_0xefbe69[_0xb7aa('0x11')]['message']);return _0x17da69(_0xefbe69[_0xb7aa('0x11')]['message']);}logger[_0xb7aa('0x11')](_0xb7aa('0xd'),_0x2c0aef,_0xefbe69[_0xb7aa('0x11')][_0xb7aa('0x12')]);return _0x4d4546(_0xefbe69[_0xb7aa('0x11')][_0xb7aa('0x12')]);}else{logger[_0xb7aa('0xc')](_0xb7aa('0xd'),_0x2c0aef,_0xb7aa('0x10'));_0x4d4546(_0xefbe69[_0xb7aa('0x13')]['message']);}})[_0xb7aa('0x14')](function(_0xad3a75){logger[_0xb7aa('0x11')](_0xb7aa('0xd'),_0x2c0aef,_0xad3a75);_0x17da69(_0xad3a75);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 0db4ade..db6ec29 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(_0x50de2e,_0x374fa8){var _0x510f2f=function(_0x35f73b){while(--_0x35f73b){_0x50de2e['push'](_0x50de2e['shift']());}};_0x510f2f(++_0x374fa8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19691f,_0x159737){_0x19691f=_0x19691f-0x0;var _0x5677b6=_0xcb91[_0x19691f];return _0x5677b6;};'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(_0x297834,_0x4eecba){var _0x200202=function(_0x386fca){while(--_0x386fca){_0x297834['push'](_0x297834['shift']());}};_0x200202(++_0x4eecba);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xcb91[_0x4232d8];return _0x324de2;};'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 31ea675..1c14c91 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 _0x20c3=['sequelize','exports','INTEGER'];(function(_0x485d46,_0x5b3dac){var _0x45eeca=function(_0x3ddbbb){while(--_0x3ddbbb){_0x485d46['push'](_0x485d46['shift']());}};_0x45eeca(++_0x5b3dac);}(_0x20c3,0x1b0));var _0x320c=function(_0x1d47a9,_0x28c6cd){_0x1d47a9=_0x1d47a9-0x0;var _0x5da009=_0x20c3[_0x1d47a9];return _0x5da009;};'use strict';var Sequelize=require(_0x320c('0x0'));module[_0x320c('0x1')]={'penalty':{'type':Sequelize[_0x320c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9333=['INTEGER'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0x9333,0x1c3));var _0x3933=function(_0x37a9f7,_0x53c0d4){_0x37a9f7=_0x37a9f7-0x0;var _0x26d2f5=_0x9333[_0x37a9f7];return _0x26d2f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x3933('0x0')],'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 4508dd6..ec5fa60 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 _0x933d=['./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x50b6cd,_0x428332){var _0x289d3d=function(_0x32e628){while(--_0x32e628){_0x50b6cd['push'](_0x50b6cd['shift']());}};_0x289d3d(++_0x428332);}(_0x933d,0x191));var _0xd933=function(_0x27ad21,_0x295336){_0x27ad21=_0x27ad21-0x0;var _0x3deb2e=_0x933d[_0x27ad21];return _0x3deb2e;};'use strict';var _=require(_0xd933('0x0'));var util=require(_0xd933('0x1'));var logger=require('../../config/logger')(_0xd933('0x2'));var moment=require(_0xd933('0x3'));var BPromise=require(_0xd933('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd933('0x5'));var rimraf=require('rimraf');var config=require(_0xd933('0x6'));var attributes=require(_0xd933('0x7'));module[_0xd933('0x8')]=function(_0x4c8135,_0x3f37a7){return _0x4c8135[_0xd933('0x9')](_0xd933('0xa'),attributes,{'tableName':_0xd933('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9cd=['bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment'];(function(_0x58702f,_0x34f578){var _0x5033b3=function(_0x4fa793){while(--_0x4fa793){_0x58702f['push'](_0x58702f['shift']());}};_0x5033b3(++_0x34f578);}(_0xd9cd,0x15b));var _0xdd9c=function(_0x2cb58b,_0x5a879d){_0x2cb58b=_0x2cb58b-0x0;var _0xe9dd9c=_0xd9cd[_0x2cb58b];return _0xe9dd9c;};'use strict';var _=require(_0xdd9c('0x0'));var util=require(_0xdd9c('0x1'));var logger=require('../../config/logger')(_0xdd9c('0x2'));var moment=require(_0xdd9c('0x3'));var BPromise=require(_0xdd9c('0x4'));var rp=require(_0xdd9c('0x5'));var fs=require('fs');var path=require(_0xdd9c('0x6'));var rimraf=require(_0xdd9c('0x7'));var config=require('../../config/environment');var attributes=require(_0xdd9c('0x8'));module[_0xdd9c('0x9')]=function(_0x2018c3,_0x106076){return _0x2018c3[_0xdd9c('0xa')](_0xdd9c('0xb'),attributes,{'tableName':_0xdd9c('0xc'),'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 d16f788..088f25c 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1409f7,_0x2cdfc6){var _0x304ed9=function(_0x48576c){while(--_0x48576c){_0x1409f7['push'](_0x1409f7['shift']());}};_0x304ed9(++_0x2cdfc6);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ccc03,_0x2b4bcb){_0x1ccc03=_0x1ccc03-0x0;var _0x4f335a=_0x6aa7[_0x1ccc03];return _0x4f335a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa0cbbf,_0x3db155){var _0x1edbb7=function(_0x3d7e75){while(--_0x3d7e75){_0xa0cbbf['push'](_0xa0cbbf['shift']());}};_0x1edbb7(++_0x3db155);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5843c6,_0x4427a5){_0x5843c6=_0x5843c6-0x0;var _0x3c3553=_0x8ef6[_0x5843c6];return _0x3c3553;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 534faac..c4cc63c 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 _0xf886=['path','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xf886,0xb3));var _0x6f88=function(_0xbf09ab,_0x251a19){_0xbf09ab=_0xbf09ab-0x0;var _0x2a9aef=_0xf886[_0xbf09ab];return _0x2a9aef;};'use strict';var multer=require(_0x6f88('0x0'));var util=require('util');var path=require(_0x6f88('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f88('0x2'));var router=express[_0x6f88('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f88('0x4'));var interaction=require(_0x6f88('0x5'));var config=require('../../config/environment');var controller=require(_0x6f88('0x6'));router[_0x6f88('0x7')]('/',auth[_0x6f88('0x8')](),controller[_0x6f88('0x9')]);module['exports']=router; \ No newline at end of file +var _0x95d2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x95d2,0x180));var _0x295d=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x95d2[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0x295d('0x0'));var util=require(_0x295d('0x1'));var path=require(_0x295d('0x2'));var timeout=require(_0x295d('0x3'));var express=require(_0x295d('0x4'));var router=express[_0x295d('0x5')]();var fs_extra=require(_0x295d('0x6'));var auth=require(_0x295d('0x7'));var interaction=require(_0x295d('0x8'));var config=require(_0x295d('0x9'));var controller=require(_0x295d('0xa'));router[_0x295d('0xb')]('/',auth[_0x295d('0xc')](),controller[_0x295d('0xd')]);module[_0x295d('0xe')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 8ac5aeb..c8b4c17 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 _0xfdb5=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3c7e26,_0x3cc265){var _0x530070=function(_0x5e8036){while(--_0x5e8036){_0x3c7e26['push'](_0x3c7e26['shift']());}};_0x530070(++_0x3cc265);}(_0xfdb5,0x194));var _0x5fdb=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xfdb5[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x5fdb('0x0'));module[_0x5fdb('0x1')]={'body':{'type':Sequelize[_0x5fdb('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x5fdb('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5fdb('0x3')]},'beep':{'type':Sequelize[_0x5fdb('0x4')]}}; \ No newline at end of file +var _0x5130=['exports','TEXT','BOOLEAN'];(function(_0x44044a,_0x3a0097){var _0x43bb6e=function(_0x1afe12){while(--_0x1afe12){_0x44044a['push'](_0x44044a['shift']());}};_0x43bb6e(++_0x3a0097);}(_0x5130,0xe4));var _0x0513=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x5130[_0x421196];return _0x2738af;};'use strict';var Sequelize=require('sequelize');module[_0x0513('0x0')]={'body':{'type':Sequelize[_0x0513('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x0513('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x0513('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 353dc94..adfec91 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 _0xbefc=['recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','UserNotification','create','forEach','emit','userNotification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','catch','startCase','union','ids','queue','replace','Queue','push','flatten','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter'];(function(_0x30b23c,_0x2368bc){var _0x4f247e=function(_0x407aea){while(--_0x407aea){_0x30b23c['push'](_0x30b23c['shift']());}};_0x4f247e(++_0x2368bc);}(_0xbefc,0x8b));var _0xcbef=function(_0xa9212,_0x574e08){_0xa9212=_0xa9212-0x0;var _0x1df65e=_0xbefc[_0xa9212];return _0x1df65e;};'use strict';var emlformat=require(_0xcbef('0x0'));var rimraf=require(_0xcbef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcbef('0x2'));var moment=require('moment');var BPromise=require(_0xcbef('0x3'));var Mustache=require(_0xcbef('0x4'));var util=require(_0xcbef('0x5'));var path=require(_0xcbef('0x6'));var sox=require(_0xcbef('0x7'));var csv=require('to-csv');var ejs=require(_0xcbef('0x8'));var fs=require('fs');var fs_extra=require(_0xcbef('0x9'));var _=require('lodash');var squel=require(_0xcbef('0xa'));var crypto=require('crypto');var jsforce=require(_0xcbef('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcbef('0xc'));var querystring=require(_0xcbef('0xd'));var Papa=require(_0xcbef('0xe'));var Redis=require(_0xcbef('0xf'));var authService=require(_0xcbef('0x10'));var qs=require(_0xcbef('0x11'));var as=require(_0xcbef('0x12'));var hardwareService=require(_0xcbef('0x13'));var logger=require('../../config/logger')(_0xcbef('0x14'));var utils=require(_0xcbef('0x15'));var config=require(_0xcbef('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbef('0x17'))['db'];config['redis']=_[_0xcbef('0x18')](config['redis'],{'host':_0xcbef('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbef('0x1a')]));require(_0xcbef('0x1b'))[_0xcbef('0x1c')](socket);function respondWithStatusCode(_0x262aa5,_0x431e9e){_0x431e9e=_0x431e9e||0xcc;return function(_0x189eea){if(_0x189eea){return _0x262aa5[_0xcbef('0x1d')](_0x431e9e);}return _0x262aa5[_0xcbef('0x1e')](_0x431e9e)[_0xcbef('0x1f')]();};}function respondWithResult(_0x3027a6,_0x71e273){_0x71e273=_0x71e273||0xc8;return function(_0x4d41bc){if(_0x4d41bc){return _0x3027a6[_0xcbef('0x1e')](_0x71e273)[_0xcbef('0x20')](_0x4d41bc);}};}function respondWithFilteredResult(_0x4c016b,_0x110d91){return function(_0xa94af8){if(_0xa94af8){var _0x416841=typeof _0x110d91[_0xcbef('0x21')]==='undefined'&&typeof _0x110d91[_0xcbef('0x22')]===_0xcbef('0x23');var _0xcff468=_0xa94af8[_0xcbef('0x24')];var _0x3c87e8=_0x416841?0x0:_0x110d91['offset'];var _0xb1e42a=_0x416841?_0xa94af8[_0xcbef('0x24')]:_0x110d91['offset']+_0x110d91[_0xcbef('0x22')];var _0x24bf1f;if(_0xb1e42a>=_0xcff468){_0xb1e42a=_0xcff468;_0x24bf1f=0xc8;}else{_0x24bf1f=0xce;}_0x4c016b[_0xcbef('0x1e')](_0x24bf1f);return _0x4c016b[_0xcbef('0x25')](_0xcbef('0x26'),_0x3c87e8+'-'+_0xb1e42a+'/'+_0xcff468)[_0xcbef('0x20')](_0xa94af8);}return null;};}function patchUpdates(_0x5e1e51){return function(_0x1c7b12){try{jsonpatch[_0xcbef('0x27')](_0x1c7b12,_0x5e1e51,!![]);}catch(_0x62aac1){return BPromise[_0xcbef('0x28')](_0x62aac1);}return _0x1c7b12['save']();};}function saveUpdates(_0x46c94d,_0x25384a){return function(_0x59b09a){if(_0x59b09a){return _0x59b09a['update'](_0x46c94d)[_0xcbef('0x29')](function(_0xadc741){return _0xadc741;});}return null;};}function removeEntity(_0x3f1c78,_0x3e5ad1){return function(_0x120f68){if(_0x120f68){return _0x120f68[_0xcbef('0x2a')]()[_0xcbef('0x29')](function(){_0x3f1c78['status'](0xcc)[_0xcbef('0x1f')]();});}};}function handleEntityNotFound(_0x58fe57,_0x288bb5){return function(_0x54ea77){if(!_0x54ea77){_0x58fe57[_0xcbef('0x1d')](0x194);}return _0x54ea77;};}function handleError(_0xce556,_0x3a17de){_0x3a17de=_0x3a17de||0x1f4;return function(_0x20de1f){logger['error'](_0x20de1f[_0xcbef('0x2b')]);if(_0x20de1f[_0xcbef('0x2c')]){delete _0x20de1f[_0xcbef('0x2c')];}_0xce556['status'](_0x3a17de)['send'](_0x20de1f);};}exports[_0xcbef('0x2d')]=function(_0x42909a,_0x2520d5,_0x5d094d){if(!_0x42909a[_0xcbef('0x2e')][_0xcbef('0x2f')](_0xcbef('0x30'))&&!_0x42909a[_0xcbef('0x2e')]['hasOwnProperty'](_0xcbef('0x31'))){throw new db['Sequelize']['ValidationError'](_0xcbef('0x32'));}else{if(_0x42909a['body'][_0xcbef('0x2f')](_0xcbef('0x31'))&&!_0x42909a[_0xcbef('0x2e')]['hasOwnProperty']('view')){throw new db[(_0xcbef('0x33'))]['ValidationError'](_0xcbef('0x34'));}if(!_0x42909a[_0xcbef('0x2e')][_0xcbef('0x2f')](_0xcbef('0x35'))){throw new db[(_0xcbef('0x33'))][(_0xcbef('0x36'))](_0xcbef('0x37'));}else{try{var _0x252c3c=JSON['parse'](_0x42909a['body'][_0xcbef('0x35')]);}catch(_0x25b6aa){logger[_0xcbef('0x38')](_0x25b6aa);throw new db[(_0xcbef('0x33'))]['ValidationError'](_0xcbef('0x39'));}var _0x30a6b5=['chatqueue','faxqueue',_0xcbef('0x3a'),_0xcbef('0x3b'),_0xcbef('0x3c'),_0xcbef('0x3d'),'whatsappqueue',_0xcbef('0x3e'),_0xcbef('0x3f')];if(_['some'](_0x252c3c,function(_0x1ad109){return!_[_0xcbef('0x40')](_0x30a6b5,_0x1ad109[_0xcbef('0x41')][_0xcbef('0x42')]());})){throw new db[(_0xcbef('0x33'))][(_0xcbef('0x36'))](_0xcbef('0x43'));}}}var _0x2ac011={};_0x2ac011[_0xcbef('0x44')]=_0x42909a[_0xcbef('0x2e')][_0xcbef('0x2f')](_0xcbef('0x44'))?_0x42909a['body'][_0xcbef('0x44')]:_0x42909a[_0xcbef('0x3f')][_0xcbef('0x45')];_0x2ac011[_0xcbef('0x46')]=_['isEmpty'](_0x42909a[_0xcbef('0x2e')][_0xcbef('0x46')])?null:_0x42909a[_0xcbef('0x2e')][_0xcbef('0x46')];_0x2ac011[_0xcbef('0x47')]=_0x42909a['body']['beep']||![];_0x2ac011[_0xcbef('0x48')]=_0x42909a[_0xcbef('0x3f')]['id'];return getContent(_0x42909a[_0xcbef('0x2e')])[_0xcbef('0x29')](function(_0x1f1e61){_0x2ac011[_0xcbef('0x2e')]=_0x1f1e61;return getRecipients(_0x252c3c);})[_0xcbef('0x29')](function(_0xd5e430){_0x2ac011[_0xcbef('0x49')]=_[_0xcbef('0x4a')](_0xd5e430)['join'](',');return db[_0xcbef('0x4b')]['transaction'](function(_0x450fcf){return db[_0xcbef('0x4c')][_0xcbef('0x4d')](_0x2ac011,{'raw':!![],'transaction':_0x450fcf})['then'](function(_0x301134){var _0x18ef38={'sender':_0x2ac011[_0xcbef('0x44')],'description':_0x2ac011[_0xcbef('0x46')],'content':_0x2ac011[_0xcbef('0x2e')],'beep':_0x2ac011[_0xcbef('0x47')]};_0xd5e430[_0xcbef('0x4e')](function(_0x56f0da){_0x18ef38['recipient']=_0x56f0da;socket[_0xcbef('0x4f')](_0xcbef('0x50'),_0x18ef38);});return _0x301134;});});})[_0xcbef('0x29')](respondWithResult(_0x2520d5,0xc9))['catch'](handleError(_0x2520d5,null));};function getContent(_0x4d4282){return new BPromise(function(_0x34353c,_0x3eef29){if(_0x4d4282[_0xcbef('0x30')]){_0x34353c(_0x4d4282[_0xcbef('0x30')]);return;}return db[_0xcbef('0x51')][_0xcbef('0x52')]({'attributes':['html'],'where':{'id':_0x4d4282[_0xcbef('0x31')]},'raw':!![]})[_0xcbef('0x29')](function(_0x4b4a0e){if(!_0x4b4a0e)throw new db[(_0xcbef('0x33'))]['ValidationError'](_0xcbef('0x53'));var _0x14c367=Mustache[_0xcbef('0x54')](_0x4b4a0e[_0xcbef('0x55')],_0x4d4282[_0xcbef('0x56')]);_0x34353c(_0x14c367);})[_0xcbef('0x57')](function(_0x3699b0){_0x3eef29(_0x3699b0);});});}function getRecipients(_0x2f1aae){return new BPromise(function(_0x2aaf7b,_0x381a87){var _0x3f705f=[];var _0x5f84b6=[];_0x2f1aae[_0xcbef('0x4e')](function(_0x32b0e1){var _0x357749=_[_0xcbef('0x58')](_0x32b0e1[_0xcbef('0x41')][_0xcbef('0x42')]());if(_0x357749==='User'){_0x3f705f=_[_0xcbef('0x59')](_0x3f705f,_0x32b0e1[_0xcbef('0x5a')]);}else{if(_['includes'](_0x357749,_0xcbef('0x5b')))_0x357749=_0x357749[_0xcbef('0x5c')](_0xcbef('0x5b'),_0xcbef('0x5d'));_0x32b0e1[_0xcbef('0x5a')][_0xcbef('0x4e')](function(_0x2f16ac){_0x5f84b6[_0xcbef('0x5e')](getAgents(_0x357749,_0x2f16ac));});}});return BPromise['all'](_0x5f84b6)[_0xcbef('0x29')](function(_0x247cc9){_0x3f705f=_['union'](_0x3f705f,_[_0xcbef('0x5f')](_0x247cc9));_0x2aaf7b(_0x3f705f);})[_0xcbef('0x57')](function(_0x37a386){_0x381a87(_0x37a386);});});}function getAgents(_0x1c6df0,_0x351847){return new BPromise(function(_0x33ad66,_0x540f6d){return db[_0x1c6df0][_0xcbef('0x52')]({'where':{'id':_0x351847}})[_0xcbef('0x29')](function(_0x3d20d7){return _0x3d20d7['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x5cac1a){var _0x1edcd5=_['map'](_0x5cac1a,'id');_0x33ad66(_0x1edcd5);});})[_0xcbef('0x57')](function(_0x16d3ed){_0x540f6d(_0x16d3ed);});});} \ No newline at end of file +var _0x8595=['replace','ids','push','flatten','getAgents','map','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','body','hasOwnProperty','text','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','error','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','queue'];(function(_0x1b435b,_0x1eeed9){var _0x5bf86f=function(_0x7bae89){while(--_0x7bae89){_0x1b435b['push'](_0x1b435b['shift']());}};_0x5bf86f(++_0x1eeed9);}(_0x8595,0xcc));var _0x5859=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x8595[_0x166742];return _0xb7814a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5859('0x0'));var jsonpatch=require(_0x5859('0x1'));var rp=require(_0x5859('0x2'));var moment=require(_0x5859('0x3'));var BPromise=require(_0x5859('0x4'));var Mustache=require(_0x5859('0x5'));var util=require(_0x5859('0x6'));var path=require(_0x5859('0x7'));var sox=require(_0x5859('0x8'));var csv=require(_0x5859('0x9'));var ejs=require(_0x5859('0xa'));var fs=require('fs');var fs_extra=require(_0x5859('0xb'));var _=require('lodash');var squel=require(_0x5859('0xc'));var crypto=require(_0x5859('0xd'));var jsforce=require(_0x5859('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5859('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5859('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5859('0x11'))(_0x5859('0x12'));var utils=require('../../config/utils');var config=require(_0x5859('0x13'));var licenseUtil=require(_0x5859('0x14'));var db=require(_0x5859('0x15'))['db'];config[_0x5859('0x16')]=_[_0x5859('0x17')](config[_0x5859('0x16')],{'host':_0x5859('0x18'),'port':0x18eb});var socket=require(_0x5859('0x19'))(new Redis(config['redis']));require('./userNotification.socket')[_0x5859('0x1a')](socket);function respondWithStatusCode(_0x18642b,_0x35ca17){_0x35ca17=_0x35ca17||0xcc;return function(_0x2809f8){if(_0x2809f8){return _0x18642b[_0x5859('0x1b')](_0x35ca17);}return _0x18642b[_0x5859('0x1c')](_0x35ca17)[_0x5859('0x1d')]();};}function respondWithResult(_0x1d40da,_0x303969){_0x303969=_0x303969||0xc8;return function(_0x32dc0c){if(_0x32dc0c){return _0x1d40da[_0x5859('0x1c')](_0x303969)[_0x5859('0x1e')](_0x32dc0c);}};}function respondWithFilteredResult(_0x4867a1,_0x116203){return function(_0x36d39c){if(_0x36d39c){var _0x462cab=typeof _0x116203[_0x5859('0x1f')]==='undefined'&&typeof _0x116203[_0x5859('0x20')]===_0x5859('0x21');var _0x1e93fd=_0x36d39c['count'];var _0x514cb5=_0x462cab?0x0:_0x116203[_0x5859('0x1f')];var _0x50944d=_0x462cab?_0x36d39c['count']:_0x116203[_0x5859('0x1f')]+_0x116203[_0x5859('0x20')];var _0x2f66b8;if(_0x50944d>=_0x1e93fd){_0x50944d=_0x1e93fd;_0x2f66b8=0xc8;}else{_0x2f66b8=0xce;}_0x4867a1[_0x5859('0x1c')](_0x2f66b8);return _0x4867a1[_0x5859('0x22')](_0x5859('0x23'),_0x514cb5+'-'+_0x50944d+'/'+_0x1e93fd)[_0x5859('0x1e')](_0x36d39c);}return null;};}function patchUpdates(_0x1081d0){return function(_0x338790){try{jsonpatch[_0x5859('0x24')](_0x338790,_0x1081d0,!![]);}catch(_0x499f55){return BPromise[_0x5859('0x25')](_0x499f55);}return _0x338790['save']();};}function saveUpdates(_0x567c45,_0x317407){return function(_0x496f1b){if(_0x496f1b){return _0x496f1b[_0x5859('0x26')](_0x567c45)[_0x5859('0x27')](function(_0x49c112){return _0x49c112;});}return null;};}function removeEntity(_0xaf6f62,_0x280b6b){return function(_0x4cc88d){if(_0x4cc88d){return _0x4cc88d[_0x5859('0x28')]()[_0x5859('0x27')](function(){_0xaf6f62[_0x5859('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb054,_0x536e0b){return function(_0x40b3ac){if(!_0x40b3ac){_0x2bb054[_0x5859('0x1b')](0x194);}return _0x40b3ac;};}function handleError(_0x392f86,_0x3bb168){_0x3bb168=_0x3bb168||0x1f4;return function(_0xf223f0){logger['error'](_0xf223f0[_0x5859('0x29')]);if(_0xf223f0[_0x5859('0x2a')]){delete _0xf223f0[_0x5859('0x2a')];}_0x392f86[_0x5859('0x1c')](_0x3bb168)[_0x5859('0x2b')](_0xf223f0);};}exports['sendUserNotification']=function(_0x5af85c,_0x59de76,_0x1c0efa){if(!_0x5af85c[_0x5859('0x2c')][_0x5859('0x2d')](_0x5859('0x2e'))&&!_0x5af85c[_0x5859('0x2c')][_0x5859('0x2d')]('TemplateId')){throw new db[(_0x5859('0x2f'))]['ValidationError'](_0x5859('0x30'));}else{if(_0x5af85c['body'][_0x5859('0x2d')](_0x5859('0x31'))&&!_0x5af85c[_0x5859('0x2c')]['hasOwnProperty'](_0x5859('0x32'))){throw new db[(_0x5859('0x2f'))][(_0x5859('0x33'))](_0x5859('0x34'));}if(!_0x5af85c[_0x5859('0x2c')][_0x5859('0x2d')](_0x5859('0x35'))){throw new db['Sequelize']['ValidationError'](_0x5859('0x36'));}else{try{var _0x247f92=JSON['parse'](_0x5af85c[_0x5859('0x2c')][_0x5859('0x35')]);}catch(_0x174a25){logger[_0x5859('0x37')](_0x174a25);throw new db[(_0x5859('0x2f'))][(_0x5859('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x56a69d=[_0x5859('0x38'),_0x5859('0x39'),_0x5859('0x3a'),_0x5859('0x3b'),_0x5859('0x3c'),_0x5859('0x3d'),_0x5859('0x3e'),_0x5859('0x3f'),_0x5859('0x40')];if(_['some'](_0x247f92,function(_0x48fcb8){return!_[_0x5859('0x41')](_0x56a69d,_0x48fcb8[_0x5859('0x42')]['toLowerCase']());})){throw new db[(_0x5859('0x2f'))]['ValidationError'](_0x5859('0x43'));}}}var _0x1c8afe={};_0x1c8afe[_0x5859('0x44')]=_0x5af85c[_0x5859('0x2c')][_0x5859('0x2d')](_0x5859('0x44'))?_0x5af85c['body']['senderName']:_0x5af85c[_0x5859('0x40')]['fullname'];_0x1c8afe['recipientsDescription']=_[_0x5859('0x45')](_0x5af85c[_0x5859('0x2c')][_0x5859('0x46')])?null:_0x5af85c[_0x5859('0x2c')][_0x5859('0x46')];_0x1c8afe[_0x5859('0x47')]=_0x5af85c[_0x5859('0x2c')]['beep']||![];_0x1c8afe[_0x5859('0x48')]=_0x5af85c[_0x5859('0x40')]['id'];return getContent(_0x5af85c['body'])[_0x5859('0x27')](function(_0x26949e){_0x1c8afe[_0x5859('0x2c')]=_0x26949e;return getRecipients(_0x247f92);})[_0x5859('0x27')](function(_0x44a4e2){_0x1c8afe['recipientsId']=_[_0x5859('0x49')](_0x44a4e2)[_0x5859('0x4a')](',');return db[_0x5859('0x4b')][_0x5859('0x4c')](function(_0x4fe88b){return db[_0x5859('0x4d')][_0x5859('0x4e')](_0x1c8afe,{'raw':!![],'transaction':_0x4fe88b})[_0x5859('0x27')](function(_0x54041d){var _0x2d690c={'sender':_0x1c8afe[_0x5859('0x44')],'description':_0x1c8afe[_0x5859('0x46')],'content':_0x1c8afe[_0x5859('0x2c')],'beep':_0x1c8afe['beep']};_0x44a4e2[_0x5859('0x4f')](function(_0x3420b3){_0x2d690c[_0x5859('0x50')]=_0x3420b3;socket['emit'](_0x5859('0x51'),_0x2d690c);});return _0x54041d;});});})['then'](respondWithResult(_0x59de76,0xc9))[_0x5859('0x52')](handleError(_0x59de76,null));};function getContent(_0x482ac4){return new BPromise(function(_0x6be701,_0x109e24){if(_0x482ac4[_0x5859('0x2e')]){_0x6be701(_0x482ac4[_0x5859('0x2e')]);return;}return db[_0x5859('0x53')][_0x5859('0x54')]({'attributes':[_0x5859('0x55')],'where':{'id':_0x482ac4[_0x5859('0x31')]},'raw':!![]})['then'](function(_0x5d6f51){if(!_0x5d6f51)throw new db[(_0x5859('0x2f'))][(_0x5859('0x33'))](_0x5859('0x56'));var _0x5f1ac5=Mustache[_0x5859('0x57')](_0x5d6f51[_0x5859('0x55')],_0x482ac4[_0x5859('0x32')]);_0x6be701(_0x5f1ac5);})[_0x5859('0x52')](function(_0x327cda){_0x109e24(_0x327cda);});});}function getRecipients(_0x4dc1cc){return new BPromise(function(_0x468260,_0xac7a2c){var _0x17f537=[];var _0x133591=[];_0x4dc1cc[_0x5859('0x4f')](function(_0x32dd33){var _0x152b04=_[_0x5859('0x58')](_0x32dd33[_0x5859('0x42')][_0x5859('0x59')]());if(_0x152b04===_0x5859('0x5a')){_0x17f537=_[_0x5859('0x5b')](_0x17f537,_0x32dd33['ids']);}else{if(_[_0x5859('0x41')](_0x152b04,_0x5859('0x5c')))_0x152b04=_0x152b04[_0x5859('0x5d')](_0x5859('0x5c'),'Queue');_0x32dd33[_0x5859('0x5e')][_0x5859('0x4f')](function(_0x3176e2){_0x133591[_0x5859('0x5f')](getAgents(_0x152b04,_0x3176e2));});}});return BPromise['all'](_0x133591)[_0x5859('0x27')](function(_0x2518c){_0x17f537=_[_0x5859('0x5b')](_0x17f537,_[_0x5859('0x60')](_0x2518c));_0x468260(_0x17f537);})[_0x5859('0x52')](function(_0x4e5bfe){_0xac7a2c(_0x4e5bfe);});});}function getAgents(_0x1cec48,_0x1472cf){return new BPromise(function(_0x22906e,_0x57ef0b){return db[_0x1cec48][_0x5859('0x54')]({'where':{'id':_0x1472cf}})['then'](function(_0x41404f){return _0x41404f[_0x5859('0x61')]({'attributes':['id'],'raw':!![]})[_0x5859('0x27')](function(_0x47c88c){var _0x530d9f=_[_0x5859('0x62')](_0x47c88c,'id');_0x22906e(_0x530d9f);});})[_0x5859('0x52')](function(_0x1c3b56){_0x57ef0b(_0x1c3b56);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f408c53..a585715 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 _0xe6d9=['emit','hasOwnProperty','exports','../../mysqldb','UserNotification','setMaxListeners','update','remove'];(function(_0xd61e34,_0x53347f){var _0x2e7471=function(_0x4e462a){while(--_0x4e462a){_0xd61e34['push'](_0xd61e34['shift']());}};_0x2e7471(++_0x53347f);}(_0xe6d9,0x12b));var _0x9e6d=function(_0x7e19de,_0x368cce){_0x7e19de=_0x7e19de-0x0;var _0x3b06be=_0xe6d9[_0x7e19de];return _0x3b06be;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x9e6d('0x0'))['db'][_0x9e6d('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9e6d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e6d('0x3'),'afterDestroy':_0x9e6d('0x4')};function emitEvent(_0x9a80f2){return function(_0x1a381c,_0x32d51d,_0x5e9be2){UserNotificationEvents[_0x9e6d('0x5')](_0x9a80f2+':'+_0x1a381c['id'],_0x1a381c);UserNotificationEvents[_0x9e6d('0x5')](_0x9a80f2,_0x1a381c);_0x5e9be2(null);};}for(var e in events){if(events[_0x9e6d('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9e6d('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x4d76=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','save','remove'];(function(_0x5bb124,_0x3464e8){var _0x5e4326=function(_0x283915){while(--_0x283915){_0x5bb124['push'](_0x5bb124['shift']());}};_0x5e4326(++_0x3464e8);}(_0x4d76,0xf7));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x64d7('0x0'));var UserNotification=require(_0x64d7('0x1'))['db'][_0x64d7('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x64d7('0x3'),'afterUpdate':'update','afterDestroy':_0x64d7('0x4')};function emitEvent(_0x3576b0){return function(_0x75885f,_0x24292e,_0x2636ad){UserNotificationEvents[_0x64d7('0x5')](_0x3576b0+':'+_0x75885f['id'],_0x75885f);UserNotificationEvents['emit'](_0x3576b0,_0x75885f);_0x2636ad(null);};}for(var e in events){if(events[_0x64d7('0x6')](e)){var event=events[e];UserNotification[_0x64d7('0x7')](e,emitEvent(event));}}module[_0x64d7('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 5f210b8..797d86d 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 _0x4c0e=['util','../../config/logger','moment','bluebird','path','../../config/environment','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x15a8fa,_0x4652b2){var _0x1355c2=function(_0x203292){while(--_0x203292){_0x15a8fa['push'](_0x15a8fa['shift']());}};_0x1355c2(++_0x4652b2);}(_0x4c0e,0x83));var _0xe4c0=function(_0x1a0016,_0x3d80e1){_0x1a0016=_0x1a0016-0x0;var _0x2945df=_0x4c0e[_0x1a0016];return _0x2945df;};'use strict';var _=require(_0xe4c0('0x0'));var util=require(_0xe4c0('0x1'));var logger=require(_0xe4c0('0x2'))('api');var moment=require(_0xe4c0('0x3'));var BPromise=require(_0xe4c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4c0('0x5'));var rimraf=require('rimraf');var config=require(_0xe4c0('0x6'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x44c427,_0x217ad2){return _0x44c427[_0xe4c0('0x7')](_0xe4c0('0x8'),attributes,{'tableName':_0xe4c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4c0('0xa'),'collate':_0xe4c0('0xb')});}; \ No newline at end of file +var _0x605d=['utf8mb4','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x605d,0xe8));var _0xd605=function(_0x101094,_0x5d3900){_0x101094=_0x101094-0x0;var _0x3d6d75=_0x605d[_0x101094];return _0x3d6d75;};'use strict';var _=require('lodash');var util=require(_0xd605('0x0'));var logger=require(_0xd605('0x1'))(_0xd605('0x2'));var moment=require('moment');var BPromise=require(_0xd605('0x3'));var rp=require(_0xd605('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd605('0x5'));var config=require(_0xd605('0x6'));var attributes=require(_0xd605('0x7'));module[_0xd605('0x8')]=function(_0x335c3f,_0x1343c6){return _0x335c3f[_0xd605('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd605('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index ddb298b..7a9eb0f 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 _0xfe6d=['client','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x14a6cf,_0x27e1cb){var _0x66d8e7=function(_0x33c220){while(--_0x33c220){_0x14a6cf['push'](_0x14a6cf['shift']());}};_0x66d8e7(++_0x27e1cb);}(_0xfe6d,0x13b));var _0xdfe6=function(_0x5266e7,_0x97b16b){_0x5266e7=_0x5266e7-0x0;var _0x5470f1=_0xfe6d[_0x5266e7];return _0x5470f1;};'use strict';var _=require(_0xdfe6('0x0'));var util=require('util');var moment=require(_0xdfe6('0x1'));var BPromise=require(_0xdfe6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfe6('0x3'));var db=require(_0xdfe6('0x4'))['db'];var utils=require(_0xdfe6('0x5'));var logger=require(_0xdfe6('0x6'))('rpc');var config=require(_0xdfe6('0x7'));var jayson=require(_0xdfe6('0x8'));var client=jayson[_0xdfe6('0x9')]['http']({'port':0x232a});config['redis']=_[_0xdfe6('0xa')](config[_0xdfe6('0xb')],{'host':_0xdfe6('0xc'),'port':0x18eb});var socket=require(_0xdfe6('0xd'))(new Redis(config[_0xdfe6('0xb')]));require(_0xdfe6('0xe'))[_0xdfe6('0xf')](socket);function respondWithRpcPromise(_0x5a45e2,_0x2fe684,_0x5ca7d5){return new BPromise(function(_0x4a0d1d,_0x322f4d){return client[_0xdfe6('0x10')](_0x5a45e2,_0x5ca7d5)[_0xdfe6('0x11')](function(_0x45be5d){logger[_0xdfe6('0x12')]('UserNotification,\x20%s,\x20%s',_0x2fe684,_0xdfe6('0x13'));logger[_0xdfe6('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x2fe684,'request\x20sent',JSON['stringify'](_0x45be5d));if(_0x45be5d[_0xdfe6('0x15')]){if(_0x45be5d['error'][_0xdfe6('0x16')]===0x1f4){logger[_0xdfe6('0x15')](_0xdfe6('0x17'),_0x2fe684,_0x45be5d[_0xdfe6('0x15')][_0xdfe6('0x18')]);return _0x322f4d(_0x45be5d[_0xdfe6('0x15')]['message']);}logger[_0xdfe6('0x15')](_0xdfe6('0x17'),_0x2fe684,_0x45be5d['error'][_0xdfe6('0x18')]);return _0x4a0d1d(_0x45be5d[_0xdfe6('0x15')][_0xdfe6('0x18')]);}else{logger[_0xdfe6('0x12')](_0xdfe6('0x17'),_0x2fe684,'request\x20sent');_0x4a0d1d(_0x45be5d[_0xdfe6('0x19')][_0xdfe6('0x18')]);}})[_0xdfe6('0x1a')](function(_0x39c2e8){logger[_0xdfe6('0x15')](_0xdfe6('0x17'),_0x2fe684,_0x39c2e8);_0x322f4d(_0x39c2e8);});});} \ No newline at end of file +var _0x5cb4=['redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x2553bb,_0x497713){var _0x3d18a4=function(_0x12046c){while(--_0x12046c){_0x2553bb['push'](_0x2553bb['shift']());}};_0x3d18a4(++_0x497713);}(_0x5cb4,0x123));var _0x45cb=function(_0x20c006,_0x722fd4){_0x20c006=_0x20c006-0x0;var _0xddb6e4=_0x5cb4[_0x20c006];return _0xddb6e4;};'use strict';var _=require('lodash');var util=require(_0x45cb('0x0'));var moment=require(_0x45cb('0x1'));var BPromise=require('bluebird');var rs=require(_0x45cb('0x2'));var fs=require('fs');var Redis=require(_0x45cb('0x3'));var db=require(_0x45cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45cb('0x5'))(_0x45cb('0x6'));var config=require(_0x45cb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x45cb('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x45cb('0x9')],{'host':_0x45cb('0xa'),'port':0x18eb});var socket=require(_0x45cb('0xb'))(new Redis(config[_0x45cb('0x9')]));require(_0x45cb('0xc'))['register'](socket);function respondWithRpcPromise(_0x5281d4,_0x45589c,_0x46e2ad){return new BPromise(function(_0x304dc0,_0x152f50){return client[_0x45cb('0xd')](_0x5281d4,_0x46e2ad)[_0x45cb('0xe')](function(_0x147d15){logger[_0x45cb('0xf')](_0x45cb('0x10'),_0x45589c,_0x45cb('0x11'));logger[_0x45cb('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x45589c,_0x45cb('0x11'),JSON[_0x45cb('0x13')](_0x147d15));if(_0x147d15[_0x45cb('0x14')]){if(_0x147d15[_0x45cb('0x14')][_0x45cb('0x15')]===0x1f4){logger[_0x45cb('0x14')]('UserNotification,\x20%s,\x20%s',_0x45589c,_0x147d15[_0x45cb('0x14')][_0x45cb('0x16')]);return _0x152f50(_0x147d15[_0x45cb('0x14')][_0x45cb('0x16')]);}logger['error'](_0x45cb('0x10'),_0x45589c,_0x147d15[_0x45cb('0x14')][_0x45cb('0x16')]);return _0x304dc0(_0x147d15[_0x45cb('0x14')]['message']);}else{logger[_0x45cb('0xf')]('UserNotification,\x20%s,\x20%s',_0x45589c,_0x45cb('0x11'));_0x304dc0(_0x147d15[_0x45cb('0x17')][_0x45cb('0x16')]);}})[_0x45cb('0x18')](function(_0xafe18e){logger['error'](_0x45cb('0x10'),_0x45589c,_0xafe18e);_0x152f50(_0xafe18e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index cc716ba..6112c83 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 _0xb351=['removeListener','register','length','remove','update'];(function(_0x21a8ba,_0x2b09e1){var _0x1da12a=function(_0xb9a7f0){while(--_0xb9a7f0){_0x21a8ba['push'](_0x21a8ba['shift']());}};_0x1da12a(++_0x2b09e1);}(_0xb351,0xf8));var _0x1b35=function(_0x28be93,_0x3276f7){_0x28be93=_0x28be93-0x0;var _0x493c59=_0xb351[_0x28be93];return _0x493c59;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0x1b35('0x0'),_0x1b35('0x1')];function createListener(_0x2542fb,_0x243e06){return function(_0x5e7311){_0x243e06['emit'](_0x2542fb,_0x5e7311);};}function removeListener(_0x2b0d73,_0x57f5b4){return function(){UserNotificationEvents[_0x1b35('0x2')](_0x2b0d73,_0x57f5b4);};}exports[_0x1b35('0x3')]=function(_0x3db2c5){for(var _0x2e53a0=0x0,_0x16bb8b=events[_0x1b35('0x4')];_0x2e53a0<_0x16bb8b;_0x2e53a0++){var _0x1ea550=events[_0x2e53a0];var _0x2b91d6=createListener('userNotification:'+_0x1ea550,_0x3db2c5);UserNotificationEvents['on'](_0x1ea550,_0x2b91d6);}}; \ No newline at end of file +var _0x0dbc=['userNotification:','./userNotification.events','save','remove','emit','removeListener','length'];(function(_0x7ef41e,_0x1da6c4){var _0x1cfb32=function(_0x810388){while(--_0x810388){_0x7ef41e['push'](_0x7ef41e['shift']());}};_0x1cfb32(++_0x1da6c4);}(_0x0dbc,0x174));var _0xc0db=function(_0x3bc13e,_0x46db0c){_0x3bc13e=_0x3bc13e-0x0;var _0x3cb833=_0x0dbc[_0x3bc13e];return _0x3cb833;};'use strict';var UserNotificationEvents=require(_0xc0db('0x0'));var events=[_0xc0db('0x1'),_0xc0db('0x2'),'update'];function createListener(_0x5d8263,_0x4ecd6d){return function(_0x58f063){_0x4ecd6d[_0xc0db('0x3')](_0x5d8263,_0x58f063);};}function removeListener(_0x3cb20a,_0x48fc8f){return function(){UserNotificationEvents[_0xc0db('0x4')](_0x3cb20a,_0x48fc8f);};}exports['register']=function(_0x38cce0){for(var _0xf95f75=0x0,_0x1f92a8=events[_0xc0db('0x5')];_0xf95f75<_0x1f92a8;_0xf95f75++){var _0x1fa577=events[_0xf95f75];var _0x4eaec1=createListener(_0xc0db('0x6')+_0x1fa577,_0x38cce0);UserNotificationEvents['on'](_0x1fa577,_0x4eaec1);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8194d20..f1cb403 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5259f7,_0xdcdc61){var _0x11e597=function(_0x390f89){while(--_0x390f89){_0x5259f7['push'](_0x5259f7['shift']());}};_0x11e597(++_0xdcdc61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x503848,_0x31bcc4){var _0xe0ef09=function(_0x461582){while(--_0x461582){_0x503848['push'](_0x503848['shift']());}};_0xe0ef09(++_0x31bcc4);}(_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'));module[_0x0a9e('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 8b5824b..85cb755 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 _0x0dd6=['INTEGER'];(function(_0x39507b,_0x3efdac){var _0x5e7dd4=function(_0x18527e){while(--_0x18527e){_0x39507b['push'](_0x39507b['shift']());}};_0x5e7dd4(++_0x3efdac);}(_0x0dd6,0xca));var _0x60dd=function(_0x45e335,_0x1add07){_0x45e335=_0x45e335-0x0;var _0x31497d=_0x0dd6[_0x45e335];return _0x31497d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x60dd('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xff16=['exports'];(function(_0x180d0a,_0x31029c){var _0x285808=function(_0x5db3e1){while(--_0x5db3e1){_0x180d0a['push'](_0x180d0a['shift']());}};_0x285808(++_0x31029c);}(_0xff16,0xa6));var _0x6ff1=function(_0x4daf63,_0x4752b8){_0x4daf63=_0x4daf63-0x0;var _0x1917d3=_0xff16[_0x4daf63];return _0x1917d3;};'use strict';var Sequelize=require('sequelize');module[_0x6ff1('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 0869767..f62dd45 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 _0x55b5=['path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','bluebird'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x55b5,0xf6));var _0x555b=function(_0x47ced1,_0x4bdac3){_0x47ced1=_0x47ced1-0x0;var _0x4f8c04=_0x55b5[_0x47ced1];return _0x4f8c04;};'use strict';var _=require('lodash');var util=require(_0x555b('0x0'));var logger=require(_0x555b('0x1'))(_0x555b('0x2'));var moment=require('moment');var BPromise=require(_0x555b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x555b('0x4'));var rimraf=require(_0x555b('0x5'));var config=require('../../config/environment');var attributes=require(_0x555b('0x6'));module['exports']=function(_0x550133,_0x2c042e){return _0x550133[_0x555b('0x7')](_0x555b('0x8'),attributes,{'tableName':_0x555b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaad5=['bluebird','request-promise','path','rimraf','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x258e3a,_0x23318c){var _0xcfa382=function(_0x223554){while(--_0x223554){_0x258e3a['push'](_0x258e3a['shift']());}};_0xcfa382(++_0x23318c);}(_0xaad5,0x8c));var _0x5aad=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xaad5[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0x5aad('0x0'));var util=require(_0x5aad('0x1'));var logger=require(_0x5aad('0x2'))(_0x5aad('0x3'));var moment=require('moment');var BPromise=require(_0x5aad('0x4'));var rp=require(_0x5aad('0x5'));var fs=require('fs');var path=require(_0x5aad('0x6'));var rimraf=require(_0x5aad('0x7'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x5aad('0x8')]=function(_0x1276bc,_0x3c581b){return _0x1276bc[_0x5aad('0x9')](_0x5aad('0xa'),attributes,{'tableName':_0x5aad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 5d97007..6130bcc 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 _0x644b=['UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x644b,0xf0));var _0xb644=function(_0x3f127b,_0x986b51){_0x3f127b=_0x3f127b-0x0;var _0x23ed00=_0x644b[_0x3f127b];return _0x23ed00;};'use strict';var _=require(_0xb644('0x0'));var util=require(_0xb644('0x1'));var moment=require('moment');var BPromise=require(_0xb644('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb644('0x3'));var db=require(_0xb644('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb644('0x5'));var config=require(_0xb644('0x6'));var jayson=require(_0xb644('0x7'));var client=jayson['client'][_0xb644('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x394644,_0x9fdadf,_0x3c64a8){return new BPromise(function(_0xe9ecd2,_0x1d739a){return client[_0xb644('0x9')](_0x394644,_0x3c64a8)[_0xb644('0xa')](function(_0x24876a){logger[_0xb644('0xb')](_0xb644('0xc'),_0x9fdadf,'request\x20sent');logger[_0xb644('0xd')](_0xb644('0xe'),_0x9fdadf,'request\x20sent',JSON['stringify'](_0x24876a));if(_0x24876a[_0xb644('0xf')]){if(_0x24876a['error'][_0xb644('0x10')]===0x1f4){logger[_0xb644('0xf')](_0xb644('0xc'),_0x9fdadf,_0x24876a[_0xb644('0xf')]['message']);return _0x1d739a(_0x24876a[_0xb644('0xf')][_0xb644('0x11')]);}logger[_0xb644('0xf')](_0xb644('0xc'),_0x9fdadf,_0x24876a[_0xb644('0xf')][_0xb644('0x11')]);return _0xe9ecd2(_0x24876a[_0xb644('0xf')][_0xb644('0x11')]);}else{logger[_0xb644('0xb')](_0xb644('0xc'),_0x9fdadf,_0xb644('0x12'));_0xe9ecd2(_0x24876a[_0xb644('0x13')][_0xb644('0x11')]);}})[_0xb644('0x14')](function(_0x3d122c){logger[_0xb644('0xf')](_0xb644('0xc'),_0x9fdadf,_0x3d122c);_0x1d739a(_0x3d122c);});});} \ No newline at end of file +var _0x4b29=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0xe5a629,_0x20be77){var _0x5ef3fa=function(_0x4aec8e){while(--_0x4aec8e){_0xe5a629['push'](_0xe5a629['shift']());}};_0x5ef3fa(++_0x20be77);}(_0x4b29,0x73));var _0x94b2=function(_0xaf2b4b,_0x25c192){_0xaf2b4b=_0xaf2b4b-0x0;var _0x316e1e=_0x4b29[_0xaf2b4b];return _0x316e1e;};'use strict';var _=require('lodash');var util=require(_0x94b2('0x0'));var moment=require(_0x94b2('0x1'));var BPromise=require(_0x94b2('0x2'));var rs=require(_0x94b2('0x3'));var fs=require('fs');var Redis=require(_0x94b2('0x4'));var db=require(_0x94b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x94b2('0x6'))(_0x94b2('0x7'));var config=require(_0x94b2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x94b2('0x9')][_0x94b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33d805,_0x27424d,_0x10fb9e){return new BPromise(function(_0x128f30,_0x1911af){return client[_0x94b2('0xb')](_0x33d805,_0x10fb9e)['then'](function(_0x129570){logger['info'](_0x94b2('0xc'),_0x27424d,'request\x20sent');logger[_0x94b2('0xd')](_0x94b2('0xe'),_0x27424d,_0x94b2('0xf'),JSON['stringify'](_0x129570));if(_0x129570[_0x94b2('0x10')]){if(_0x129570['error'][_0x94b2('0x11')]===0x1f4){logger[_0x94b2('0x10')](_0x94b2('0xc'),_0x27424d,_0x129570[_0x94b2('0x10')][_0x94b2('0x12')]);return _0x1911af(_0x129570[_0x94b2('0x10')][_0x94b2('0x12')]);}logger[_0x94b2('0x10')](_0x94b2('0xc'),_0x27424d,_0x129570[_0x94b2('0x10')][_0x94b2('0x12')]);return _0x128f30(_0x129570[_0x94b2('0x10')][_0x94b2('0x12')]);}else{logger['info'](_0x94b2('0xc'),_0x27424d,_0x94b2('0xf'));_0x128f30(_0x129570[_0x94b2('0x13')][_0x94b2('0x12')]);}})['catch'](function(_0x219500){logger[_0x94b2('0x10')](_0x94b2('0xc'),_0x27424d,_0x219500);_0x1911af(_0x219500);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 142a10b..3ec5bd2 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 _0xec19=['get','index','/describe','isAuthenticated','describe','show','/:id/sections','/:id/resources','getResources','post','/:id/clone','clone','addResources','put','/:id','update','delete','destroy','removeResources','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0xec19,0x7f));var _0x9ec1=function(_0x1b7377,_0x528bf1){_0x1b7377=_0x1b7377-0x0;var _0xcbceca=_0xec19[_0x1b7377];return _0xcbceca;};'use strict';var multer=require(_0x9ec1('0x0'));var util=require('util');var path=require(_0x9ec1('0x1'));var timeout=require(_0x9ec1('0x2'));var express=require(_0x9ec1('0x3'));var router=express['Router']();var fs_extra=require(_0x9ec1('0x4'));var auth=require(_0x9ec1('0x5'));var interaction=require(_0x9ec1('0x6'));var config=require('../../config/environment');var controller=require(_0x9ec1('0x7'));router[_0x9ec1('0x8')]('/',auth['isAuthenticated'](),controller[_0x9ec1('0x9')]);router[_0x9ec1('0x8')](_0x9ec1('0xa'),auth[_0x9ec1('0xb')](),controller[_0x9ec1('0xc')]);router[_0x9ec1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9ec1('0xd')]);router[_0x9ec1('0x8')](_0x9ec1('0xe'),auth[_0x9ec1('0xb')](),controller['getSections']);router[_0x9ec1('0x8')](_0x9ec1('0xf'),auth[_0x9ec1('0xb')](),controller[_0x9ec1('0x10')]);router[_0x9ec1('0x11')]('/',auth[_0x9ec1('0xb')](),controller['create']);router[_0x9ec1('0x11')](_0x9ec1('0x12'),auth[_0x9ec1('0xb')](),controller[_0x9ec1('0x13')]);router[_0x9ec1('0x11')]('/:id/sections',auth[_0x9ec1('0xb')](),controller['addSections']);router['post'](_0x9ec1('0xf'),auth[_0x9ec1('0xb')](),controller[_0x9ec1('0x14')]);router[_0x9ec1('0x15')](_0x9ec1('0x16'),auth['isAuthenticated'](),controller[_0x9ec1('0x17')]);router[_0x9ec1('0x18')](_0x9ec1('0x16'),auth[_0x9ec1('0xb')](),controller[_0x9ec1('0x19')]);router[_0x9ec1('0x18')](_0x9ec1('0xe'),auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0x9ec1('0xf'),auth[_0x9ec1('0xb')](),controller[_0x9ec1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x280f=['removeSections','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','delete','destroy'];(function(_0x4c50fb,_0x42d1f2){var _0x5a289f=function(_0x377a84){while(--_0x377a84){_0x4c50fb['push'](_0x4c50fb['shift']());}};_0x5a289f(++_0x42d1f2);}(_0x280f,0x17b));var _0xf280=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x280f[_0x592e40];return _0x5d4288;};'use strict';var multer=require(_0xf280('0x0'));var util=require('util');var path=require(_0xf280('0x1'));var timeout=require(_0xf280('0x2'));var express=require(_0xf280('0x3'));var router=express[_0xf280('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf280('0x5'));var interaction=require(_0xf280('0x6'));var config=require(_0xf280('0x7'));var controller=require(_0xf280('0x8'));router[_0xf280('0x9')]('/',auth[_0xf280('0xa')](),controller[_0xf280('0xb')]);router[_0xf280('0x9')](_0xf280('0xc'),auth[_0xf280('0xa')](),controller['describe']);router[_0xf280('0x9')](_0xf280('0xd'),auth[_0xf280('0xa')](),controller[_0xf280('0xe')]);router[_0xf280('0x9')](_0xf280('0xf'),auth[_0xf280('0xa')](),controller[_0xf280('0x10')]);router[_0xf280('0x9')](_0xf280('0x11'),auth[_0xf280('0xa')](),controller['getResources']);router[_0xf280('0x12')]('/',auth[_0xf280('0xa')](),controller[_0xf280('0x13')]);router[_0xf280('0x12')](_0xf280('0x14'),auth[_0xf280('0xa')](),controller[_0xf280('0x15')]);router[_0xf280('0x12')](_0xf280('0xf'),auth[_0xf280('0xa')](),controller[_0xf280('0x16')]);router[_0xf280('0x12')](_0xf280('0x11'),auth[_0xf280('0xa')](),controller[_0xf280('0x17')]);router[_0xf280('0x18')](_0xf280('0xd'),auth[_0xf280('0xa')](),controller['update']);router[_0xf280('0x19')](_0xf280('0xd'),auth[_0xf280('0xa')](),controller[_0xf280('0x1a')]);router[_0xf280('0x19')](_0xf280('0xf'),auth['isAuthenticated'](),controller[_0xf280('0x1b')]);router[_0xf280('0x19')](_0xf280('0x11'),auth[_0xf280('0xa')](),controller['removeResources']);module[_0xf280('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2779757..98a5b80 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 _0xe1be=['name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','STRING'];(function(_0x308813,_0x5b634a){var _0x3760ab=function(_0x53f460){while(--_0x53f460){_0x308813['push'](_0x308813['shift']());}};_0x3760ab(++_0x5b634a);}(_0xe1be,0x102));var _0xee1b=function(_0x4746ca,_0x3fdd15){_0x4746ca=_0x4746ca-0x0;var _0x7a723a=_0xe1be[_0x4746ca];return _0x7a723a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee1b('0x0')],'allowNull':![],'unique':_0xee1b('0x1')},'crudPermissions':{'type':Sequelize[_0xee1b('0x0')],'set':function(_0x88cff9){this[_0xee1b('0x2')](_0xee1b('0x3'),_0x88cff9?_0x88cff9[_0xee1b('0x4')](''):[]);},'get':function(){return this[_0xee1b('0x5')](_0xee1b('0x3'))?this[_0xee1b('0x5')](_0xee1b('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xee1b('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xee1b('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xee1b('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xee1b('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xee1b('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xee1b('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xee1b('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0249=['exports','STRING','name','setDataValue','crudPermissions','join','split','BOOLEAN','sequelize'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x0249,0xce));var _0x9024=function(_0x29746d,_0x3caff6){_0x29746d=_0x29746d-0x0;var _0x29d781=_0x0249[_0x29746d];return _0x29d781;};'use strict';var Sequelize=require(_0x9024('0x0'));module[_0x9024('0x1')]={'name':{'type':Sequelize[_0x9024('0x2')],'allowNull':![],'unique':_0x9024('0x3')},'crudPermissions':{'type':Sequelize[_0x9024('0x2')],'set':function(_0x9ced18){this[_0x9024('0x4')](_0x9024('0x5'),_0x9ced18?_0x9ced18[_0x9024('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x9024('0x5'))?this['getDataValue']('crudPermissions')[_0x9024('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9024('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9024('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9024('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9024('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9024('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9024('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9024('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7b71c57..0a9d28d 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 _0xf962=['includeAll','find','create','clone','include','get','createdAt','updatedAt','crudPermissions','body','omit','sequelize','transaction','UserProfileSection','findAll','params','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','destroy','push','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','UserProfile','rows','catch','show','keys'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xf962,0x10e));var _0x2f96=function(_0x36ce93,_0xdfd9a5){_0x36ce93=_0x36ce93-0x0;var _0x459145=_0xf962[_0x36ce93];return _0x459145;};'use strict';var emlformat=require(_0x2f96('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f96('0x1'));var rp=require(_0x2f96('0x2'));var moment=require(_0x2f96('0x3'));var BPromise=require(_0x2f96('0x4'));var Mustache=require(_0x2f96('0x5'));var util=require(_0x2f96('0x6'));var path=require(_0x2f96('0x7'));var sox=require(_0x2f96('0x8'));var csv=require(_0x2f96('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f96('0xa'));var _=require(_0x2f96('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2f96('0xc'));var deskjs=require(_0x2f96('0xd'));var toCsv=require(_0x2f96('0x9'));var querystring=require(_0x2f96('0xe'));var Papa=require('papaparse');var Redis=require(_0x2f96('0xf'));var authService=require(_0x2f96('0x10'));var qs=require(_0x2f96('0x11'));var as=require(_0x2f96('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2f96('0x13'));var config=require(_0x2f96('0x14'));var licenseUtil=require(_0x2f96('0x15'));var db=require('../../mysqldb')['db'];config[_0x2f96('0x16')]=_[_0x2f96('0x17')](config[_0x2f96('0x16')],{'host':_0x2f96('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f96('0x16')]));require(_0x2f96('0x19'))[_0x2f96('0x1a')](socket);function respondWithStatusCode(_0x2d2a1e,_0x252bcf){_0x252bcf=_0x252bcf||0xcc;return function(_0x51c317){if(_0x51c317){return _0x2d2a1e['sendStatus'](_0x252bcf);}return _0x2d2a1e['status'](_0x252bcf)['end']();};}function respondWithResult(_0x5546ed,_0x30ab75){_0x30ab75=_0x30ab75||0xc8;return function(_0xfbb89c){if(_0xfbb89c){return _0x5546ed[_0x2f96('0x1b')](_0x30ab75)[_0x2f96('0x1c')](_0xfbb89c);}};}function respondWithFilteredResult(_0x223851,_0x5791c8){return function(_0x256cc6){if(_0x256cc6){var _0x58fd7f=typeof _0x5791c8['offset']===_0x2f96('0x1d')&&typeof _0x5791c8[_0x2f96('0x1e')]===_0x2f96('0x1d');var _0x674f07=_0x256cc6[_0x2f96('0x1f')];var _0x328ede=_0x58fd7f?0x0:_0x5791c8[_0x2f96('0x20')];var _0x545a6d=_0x58fd7f?_0x256cc6[_0x2f96('0x1f')]:_0x5791c8[_0x2f96('0x20')]+_0x5791c8[_0x2f96('0x1e')];var _0x15e588;if(_0x545a6d>=_0x674f07){_0x545a6d=_0x674f07;_0x15e588=0xc8;}else{_0x15e588=0xce;}_0x223851[_0x2f96('0x1b')](_0x15e588);return _0x223851[_0x2f96('0x21')](_0x2f96('0x22'),_0x328ede+'-'+_0x545a6d+'/'+_0x674f07)['json'](_0x256cc6);}return null;};}function patchUpdates(_0x4be870){return function(_0xa88dfb){try{jsonpatch[_0x2f96('0x23')](_0xa88dfb,_0x4be870,!![]);}catch(_0x9e1479){return BPromise[_0x2f96('0x24')](_0x9e1479);}return _0xa88dfb[_0x2f96('0x25')]();};}function saveUpdates(_0x184882,_0x5cfa6a){return function(_0x545aa2){if(_0x545aa2){return _0x545aa2[_0x2f96('0x26')](_0x184882)[_0x2f96('0x27')](function(_0x74a2ec){return _0x74a2ec;});}return null;};}function removeEntity(_0x43e26f,_0x27a27a){return function(_0x48ddba){if(_0x48ddba){return _0x48ddba['destroy']()['then'](function(){_0x43e26f['status'](0xcc)[_0x2f96('0x28')]();});}};}function handleEntityNotFound(_0x4ce925,_0x2da971){return function(_0x514cec){if(!_0x514cec){_0x4ce925[_0x2f96('0x29')](0x194);}return _0x514cec;};}function handleError(_0x887b1e,_0x3ba433){_0x3ba433=_0x3ba433||0x1f4;return function(_0x22d43a){logger[_0x2f96('0x2a')](_0x22d43a[_0x2f96('0x2b')]);if(_0x22d43a['name']){delete _0x22d43a[_0x2f96('0x2c')];}_0x887b1e[_0x2f96('0x1b')](_0x3ba433)[_0x2f96('0x2d')](_0x22d43a);};}exports['index']=function(_0x398bc1,_0x18eccd){var _0x50a2e6={},_0x5f1e4e={},_0x3a4f11={'count':0x0,'rows':[]};var _0x560a52=_['map'](db['UserProfile'][_0x2f96('0x2e')],function(_0x341382){return{'name':_0x341382['fieldName'],'type':_0x341382['type']['key']};});_0x5f1e4e[_0x2f96('0x2f')]=_[_0x2f96('0x30')](_0x560a52,_0x2f96('0x2c'));_0x5f1e4e[_0x2f96('0x31')]=_['keys'](_0x398bc1['query']);_0x5f1e4e[_0x2f96('0x32')]=_[_0x2f96('0x33')](_0x5f1e4e['model'],_0x5f1e4e[_0x2f96('0x31')]);_0x50a2e6[_0x2f96('0x34')]=_[_0x2f96('0x33')](_0x5f1e4e['model'],qs[_0x2f96('0x35')](_0x398bc1[_0x2f96('0x31')]['fields']));_0x50a2e6[_0x2f96('0x34')]=_0x50a2e6['attributes'][_0x2f96('0x36')]?_0x50a2e6[_0x2f96('0x34')]:_0x5f1e4e[_0x2f96('0x2f')];if(!_0x398bc1['query'][_0x2f96('0x37')](_0x2f96('0x38'))){_0x50a2e6['limit']=qs['limit'](_0x398bc1['query'][_0x2f96('0x1e')]);_0x50a2e6[_0x2f96('0x20')]=qs['offset'](_0x398bc1['query']['offset']);}_0x50a2e6[_0x2f96('0x39')]=qs[_0x2f96('0x3a')](_0x398bc1[_0x2f96('0x31')][_0x2f96('0x3a')]);_0x50a2e6['where']=qs[_0x2f96('0x32')](_[_0x2f96('0x3b')](_0x398bc1[_0x2f96('0x31')],_0x5f1e4e[_0x2f96('0x32')]),_0x560a52);if(_0x398bc1[_0x2f96('0x31')][_0x2f96('0x3c')]){_0x50a2e6[_0x2f96('0x3d')]=_[_0x2f96('0x3e')](_0x50a2e6['where'],{'$or':_[_0x2f96('0x30')](_0x560a52,function(_0x577dbe){if(_0x577dbe['type']!=='VIRTUAL'){var _0x1da1f={};_0x1da1f[_0x577dbe[_0x2f96('0x2c')]]={'$like':'%'+_0x398bc1[_0x2f96('0x31')]['filter']+'%'};return _0x1da1f;}})});}_0x50a2e6=_[_0x2f96('0x3e')]({},_0x50a2e6,_0x398bc1[_0x2f96('0x3f')]);var _0x4160cb={'where':_0x50a2e6[_0x2f96('0x3d')]};return db['UserProfile']['count'](_0x4160cb)['then'](function(_0x175243){_0x3a4f11[_0x2f96('0x1f')]=_0x175243;if(_0x398bc1[_0x2f96('0x31')]['includeAll']){_0x50a2e6['include']=[{'all':!![]}];}return db[_0x2f96('0x40')]['findAll'](_0x50a2e6);})['then'](function(_0x3b8bea){_0x3a4f11[_0x2f96('0x41')]=_0x3b8bea;return _0x3a4f11;})[_0x2f96('0x27')](respondWithFilteredResult(_0x18eccd,_0x50a2e6))[_0x2f96('0x42')](handleError(_0x18eccd,null));};exports[_0x2f96('0x43')]=function(_0x285843,_0x607a4){var _0x3ad199={'raw':![],'where':{'id':_0x285843['params']['id']}},_0x3365c5={};_0x3365c5[_0x2f96('0x2f')]=_[_0x2f96('0x44')](db[_0x2f96('0x40')][_0x2f96('0x2e')]);_0x3365c5[_0x2f96('0x31')]=_[_0x2f96('0x44')](_0x285843[_0x2f96('0x31')]);_0x3365c5[_0x2f96('0x32')]=_[_0x2f96('0x33')](_0x3365c5['model'],_0x3365c5[_0x2f96('0x31')]);_0x3ad199['attributes']=_[_0x2f96('0x33')](_0x3365c5[_0x2f96('0x2f')],qs[_0x2f96('0x35')](_0x285843[_0x2f96('0x31')]['fields']));_0x3ad199['attributes']=_0x3ad199[_0x2f96('0x34')][_0x2f96('0x36')]?_0x3ad199[_0x2f96('0x34')]:_0x3365c5[_0x2f96('0x2f')];if(_0x285843[_0x2f96('0x31')][_0x2f96('0x45')]){_0x3ad199['include']=[{'all':!![]}];}_0x3ad199=_[_0x2f96('0x3e')]({},_0x3ad199,_0x285843[_0x2f96('0x3f')]);return db[_0x2f96('0x40')][_0x2f96('0x46')](_0x3ad199)[_0x2f96('0x27')](handleEntityNotFound(_0x607a4,null))[_0x2f96('0x27')](respondWithResult(_0x607a4,null))['catch'](handleError(_0x607a4,null));};exports[_0x2f96('0x47')]=function(_0x4c7b28,_0x581d8a){return db[_0x2f96('0x40')]['create'](_0x4c7b28['body'],{})[_0x2f96('0x27')](respondWithResult(_0x581d8a,0xc9))[_0x2f96('0x42')](handleError(_0x581d8a,null));};exports[_0x2f96('0x48')]=function(_0x593f89,_0x5ac1d9){var _0x475c00={'where':{'id':_0x593f89['params']['id']}},_0x50a17b={};_0x50a17b[_0x2f96('0x2f')]=_[_0x2f96('0x44')](db['UserProfile'][_0x2f96('0x2e')]);_0x475c00['attributes']=_[_0x2f96('0x33')](_0x50a17b['model'],qs[_0x2f96('0x35')](_0x593f89[_0x2f96('0x31')][_0x2f96('0x35')]));_0x475c00['attributes']=_0x475c00[_0x2f96('0x34')]['length']?_0x475c00[_0x2f96('0x34')]:_0x50a17b[_0x2f96('0x2f')];if(_0x593f89['query'][_0x2f96('0x45')]){_0x475c00[_0x2f96('0x49')]=[{'all':!![]}];}_0x475c00=_['merge']({},_0x475c00,_0x593f89[_0x2f96('0x3f')]);return db['UserProfile'][_0x2f96('0x46')](_0x475c00)[_0x2f96('0x27')](handleEntityNotFound(_0x5ac1d9,null))[_0x2f96('0x27')](function(_0x4fae84){if(_0x4fae84){var _0x3cdc04=_0x4fae84[_0x2f96('0x4a')]({'plain':!![]});_0x3cdc04=qs['omit'](_0x3cdc04,['id',_0x2f96('0x4b'),_0x2f96('0x4c'),_0x2f96('0x4d')]);_0x593f89[_0x2f96('0x4e')]=_[_0x2f96('0x4f')](_0x593f89[_0x2f96('0x4e')],['id',_0x2f96('0x4b'),_0x2f96('0x4c')]);return db[_0x2f96('0x50')][_0x2f96('0x51')](function(_0x5d99bd){return db[_0x2f96('0x40')]['create'](_[_0x2f96('0x3e')](_0x3cdc04,_0x593f89['body']),{'include':_0x593f89[_0x2f96('0x31')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5d99bd})[_0x2f96('0x27')](function(_0x58a042){var _0x2e024a=_0x58a042[_0x2f96('0x4a')]({'plain':!![]});return db[_0x2f96('0x52')][_0x2f96('0x53')]({'where':{'userProfileId':_0x593f89[_0x2f96('0x54')]['id']},'raw':!![]})['then'](function(_0x18d4e3){if(_0x18d4e3){return BPromise[_0x2f96('0x55')](_0x18d4e3,function(_0x135360){return new BPromise(function(_0x3c7f9c,_0x36c1ff){if(_0x135360['autoAssociation']===null||_0x135360[_0x2f96('0x56')]===0x1)_0x3c7f9c(null);return db['UserProfileResource'][_0x2f96('0x53')]({'where':{'sectionId':_0x135360['id']},'raw':!![]})[_0x2f96('0x27')](function(_0x1d6a93){var _0x44e0ce=_[_0x2f96('0x30')](_0x1d6a93,function(_0x10fb46){return qs['omit'](_0x10fb46,['id',_0x2f96('0x4b'),_0x2f96('0x4c'),_0x2f96('0x57')]);});_0x3c7f9c(_0x44e0ce);})[_0x2f96('0x42')](function(_0x1327a9){_0x36c1ff(_0x1327a9);});})[_0x2f96('0x27')](function(_0x528ff1){var _0x4c3303=qs[_0x2f96('0x4f')](_0x135360,['id',_0x2f96('0x4b'),_0x2f96('0x4c')]);_0x4c3303[_0x2f96('0x58')]=_0x2e024a['id'];if(_0x528ff1)_0x4c3303[_0x2f96('0x59')]=_0x528ff1;return _0x4c3303;})[_0x2f96('0x27')](function(_0x174dee){return db[_0x2f96('0x52')][_0x2f96('0x47')](_0x174dee,{'include':[{'model':db[_0x2f96('0x5a')],'as':_0x2f96('0x59')}],'raw':!![],'transaction':_0x5d99bd});});})[_0x2f96('0x27')](function(){return _0x2e024a;});}});});});}})[_0x2f96('0x27')](respondWithResult(_0x5ac1d9,0xc9))[_0x2f96('0x42')](handleError(_0x5ac1d9,null));};exports[_0x2f96('0x26')]=function(_0x2d9359,_0x222b76){if(_0x2d9359[_0x2f96('0x4e')]['id']){delete _0x2d9359[_0x2f96('0x4e')]['id'];}return db[_0x2f96('0x40')]['find']({'where':{'id':_0x2d9359[_0x2f96('0x54')]['id']}})[_0x2f96('0x27')](handleEntityNotFound(_0x222b76,null))['then'](saveUpdates(_0x2d9359[_0x2f96('0x4e')],null))[_0x2f96('0x27')](respondWithResult(_0x222b76,null))[_0x2f96('0x42')](handleError(_0x222b76,null));};exports['destroy']=function(_0xf74327,_0x470735){return db[_0x2f96('0x40')][_0x2f96('0x46')]({'where':{'id':_0xf74327['params']['id']}})[_0x2f96('0x27')](handleEntityNotFound(_0x470735,null))[_0x2f96('0x27')](removeEntity(_0x470735,null))[_0x2f96('0x42')](handleError(_0x470735,null));};exports[_0x2f96('0x5b')]=function(_0x48ade5,_0x1cc28e){return db['UserProfile']['describe']()[_0x2f96('0x27')](respondWithResult(_0x1cc28e,null))[_0x2f96('0x42')](handleError(_0x1cc28e,null));};exports[_0x2f96('0x5c')]=function(_0x375840,_0x5c1986){var _0x11f03f=_0x375840['body'];return db[_0x2f96('0x40')][_0x2f96('0x46')]({'where':{'id':_0x375840[_0x2f96('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c1986,null))['then'](function(_0x5a3a18){if(_0x5a3a18){return db['sequelize'][_0x2f96('0x51')](function(_0x1b25a5){return db['UserProfileSection'][_0x2f96('0x5d')]({'where':{'userProfileId':_0x375840[_0x2f96('0x54')]['id'],'sectionId':_[_0x2f96('0x30')](_0x11f03f,function(_0x5a0523){return _0x5a0523[_0x2f96('0x57')];})},'transaction':_0x1b25a5})['then'](function(){var _0x30f6aa=_[_0x2f96('0x30')](_0x11f03f,function(_0x5ac491){_0x5ac491[_0x2f96('0x58')]=_0x375840['params']['id'];return _0x5ac491;});var _0x34a90a=[];return BPromise[_0x2f96('0x55')](_0x30f6aa,function(_0x56078f){return db['UserProfileSection'][_0x2f96('0x47')](_0x56078f,{'include':[{'model':db[_0x2f96('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x1b25a5})['then'](function(_0x5b5b53){_0x34a90a[_0x2f96('0x5e')](_0x5b5b53[_0x2f96('0x4a')]({'plain':!![]}));});})[_0x2f96('0x27')](function(){return _0x34a90a;});});});}})[_0x2f96('0x27')](function(_0x471dbd){return _0x471dbd;})['then'](respondWithResult(_0x5c1986,null))[_0x2f96('0x42')](handleError(_0x5c1986,null));};exports['removeSections']=function(_0x1991fe,_0x15a8ae){var _0x414afe;return db['UserProfile']['find']({'where':{'id':_0x1991fe[_0x2f96('0x54')]['id']},'attributes':['id',_0x2f96('0x2c')]})[_0x2f96('0x27')](handleEntityNotFound(_0x15a8ae,null))[_0x2f96('0x27')](function(_0x1c715f){if(_0x1c715f){_0x414afe=_0x1c715f;return db[_0x2f96('0x52')][_0x2f96('0x5d')]({'where':{'userProfileId':_0x1991fe[_0x2f96('0x54')]['id'],'sectionId':_0x1991fe[_0x2f96('0x31')]['ids']}});}})['then'](function(){return _0x414afe;})[_0x2f96('0x27')](respondWithStatusCode(_0x15a8ae,null))['catch'](handleError(_0x15a8ae,null));};exports[_0x2f96('0x5f')]=function(_0x137346,_0x1bdbaf){var _0x529e9f=[];var _0x44a4ac=[];return db[_0x2f96('0x52')]['findAll']({'where':{'userProfileId':_0x137346['params']['id']},'raw':!![]})[_0x2f96('0x27')](function(_0x313151){_0x529e9f=_[_0x2f96('0x3c')](_0x313151,function(_0x23d033){return _0x23d033[_0x2f96('0x60')]===0x1||_[_0x2f96('0x61')]([0x3eb,0x709],_0x23d033[_0x2f96('0x57')]);});if(!_[_0x2f96('0x62')](_0x529e9f)){return _[_0x2f96('0x30')](_0x529e9f,function(_0x253086){return _0x253086[_0x2f96('0x57')];});}else{return;}})['then'](function(_0x13e814){if(_0x13e814)_0x44a4ac=_0x13e814;if(_[_0x2f96('0x61')](_0x44a4ac,0x64)){var _0x226d52=_[_0x2f96('0x46')](_0x529e9f,{'sectionId':0x64});return hasDefaultDashboard(_0x226d52)[_0x2f96('0x27')](function(_0x995327){return _[_0x2f96('0x30')](_0x529e9f,function(_0x1f10ed){if(_0x1f10ed['sectionId']===0x64){_0x1f10ed[_0x2f96('0x63')]=_0x995327;}return _0x1f10ed;});});}else{return;}})[_0x2f96('0x27')](function(_0x239f42){if(_0x239f42)_0x529e9f=_0x239f42;if(_[_0x2f96('0x61')](_0x44a4ac,0x3eb)){var _0x5e9ba2=_[_0x2f96('0x46')](_0x529e9f,{'sectionId':0x3eb});return getCustomDashboards(_0x5e9ba2)[_0x2f96('0x27')](function(_0xf316e6){return _['map'](_0x529e9f,function(_0x1e0652){if(_0x5e9ba2[_0x2f96('0x60')]){if(_0x1e0652[_0x2f96('0x57')]===0x3eb){_0x1e0652[_0x2f96('0x63')]=_0xf316e6;}}else{if(_0x1e0652['sectionId']===0x64){if(!_0x1e0652['subsections']){_0x1e0652['subsections']=[];}_0x1e0652[_0x2f96('0x63')]=_0x1e0652[_0x2f96('0x63')][_0x2f96('0x64')](_0xf316e6);}}return _0x1e0652;});});}else{return;}})['then'](function(_0x3dd626){if(_0x3dd626)_0x529e9f=_0x3dd626;if(_[_0x2f96('0x61')](_0x44a4ac,0x709)){var _0x5cf4d9=_[_0x2f96('0x46')](_0x529e9f,{'sectionId':0x709});return getPlugins(_0x5cf4d9)[_0x2f96('0x27')](function(_0x3ff5fa){if(_0x5cf4d9[_0x2f96('0x60')]){return _[_0x2f96('0x30')](_0x529e9f,function(_0x585e39){if(_0x585e39[_0x2f96('0x57')]===0x709){_0x585e39[_0x2f96('0x63')]=_0x3ff5fa;}return _0x585e39;});}else{var _0x5bcad3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3ff5fa};var _0x68349d=_['map'](_0x529e9f);_0x68349d[_0x2f96('0x5e')](_0x5bcad3);return _0x68349d;}});}else{return;}})[_0x2f96('0x27')](function(_0x2537b8){if(_0x2537b8)_0x529e9f=_0x2537b8;return _[_0x2f96('0x3c')](_0x529e9f,['enabled',0x1]);})[_0x2f96('0x27')](respondWithResult(_0x1bdbaf,null))['catch'](handleError(_0x1bdbaf,null));};function hasDefaultDashboard(_0x38518e){var _0x56dddd=[0x65];return new BPromise(function(_0x1f6be3,_0x1d3965){try{if(_0x38518e['autoAssociation']){_0x1f6be3(_0x56dddd);}else{return db[_0x2f96('0x5a')][_0x2f96('0x65')]({'where':{'sectionId':_0x38518e['id']},'raw':!![]})['then'](function(_0x15ab8d){_0x15ab8d?_0x1f6be3(_0x56dddd):_0x1f6be3();});}}catch(_0x3224cd){_0x1d3965(_0x3224cd);}});}function getCustomDashboards(_0x36925b){var _0x2e466c=[];return new BPromise(function(_0x2c7e84,_0x58c533){try{if(_0x36925b[_0x2f96('0x56')]){return db[_0x2f96('0x66')][_0x2f96('0x53')]({'raw':!![]})[_0x2f96('0x27')](function(_0x2e34ec){_0x2e34ec[_0x2f96('0x67')](function(_0x3c82d6){_0x2e466c['push'](_0x3c82d6['id']+0x1869f);});_0x2c7e84(_0x2e466c);});}else{return db[_0x2f96('0x5a')]['findAll']({'where':{'sectionId':_0x36925b['id']},'raw':!![]})[_0x2f96('0x27')](function(_0x8445fe){_0x8445fe[_0x2f96('0x67')](function(_0x5a1938){_0x2e466c[_0x2f96('0x5e')](_0x5a1938[_0x2f96('0x68')]+0x1869f);});_0x2c7e84(_0x2e466c);});}}catch(_0x154a68){_0x58c533(_0x154a68);}});}function getPlugins(_0x1da507){var _0x118843=[];return new BPromise(function(_0x4367cb,_0x2e666b){try{if(_0x1da507[_0x2f96('0x56')]){return db['Plugin'][_0x2f96('0x53')]({'raw':!![]})[_0x2f96('0x27')](function(_0x572b7a){_0x572b7a[_0x2f96('0x67')](function(_0xf52577){_0x118843['push'](_0xf52577['id']+0x15b38);});_0x4367cb(_0x118843);});}else{return db[_0x2f96('0x5a')][_0x2f96('0x53')]({'where':{'sectionId':_0x1da507['id']},'raw':!![]})[_0x2f96('0x27')](function(_0x1bf8bf){_0x1bf8bf['forEach'](function(_0x2ee307){_0x118843[_0x2f96('0x5e')](_0x2ee307[_0x2f96('0x68')]+0x15b38);});_0x4367cb(_0x118843);});}}catch(_0x3f5b73){_0x2e666b(_0x3f5b73);}});}exports[_0x2f96('0x69')]=function(_0x33cfda,_0x18dd03){return db[_0x2f96('0x40')][_0x2f96('0x46')]({'where':{'id':_0x33cfda[_0x2f96('0x54')]['id']}})[_0x2f96('0x27')](handleEntityNotFound(_0x18dd03,null))[_0x2f96('0x27')](function(_0x452554){if(_0x452554){return db['sequelize'][_0x2f96('0x51')](function(_0x4ab77b){return db[_0x2f96('0x52')][_0x2f96('0x53')]({'where':{'userProfileId':_0x33cfda[_0x2f96('0x54')]['id']},'attributes':['id'],'raw':!![]})[_0x2f96('0x27')](function(_0x2ce075){if(_0x2ce075){return db[_0x2f96('0x52')]['destroy']({'where':{'userProfileId':_0x33cfda[_0x2f96('0x54')]['id'],'id':_['map'](_0x2ce075,function(_0x226519){return _0x226519['id'];})},'transaction':_0x4ab77b});}})[_0x2f96('0x27')](function(_0x5482bb){var _0x3771a9=_[_0x2f96('0x30')](_0x33cfda[_0x2f96('0x4e')],function(_0x45ff47){_0x45ff47['userProfileId']=_0x33cfda[_0x2f96('0x54')]['id'];return _0x45ff47;});return db[_0x2f96('0x52')][_0x2f96('0x6a')](_0x3771a9,{'raw':!![],'transaction':_0x4ab77b});})[_0x2f96('0x27')](function(_0x573e8a){var _0x17d058=_[_0x2f96('0x3c')](_[_0x2f96('0x30')](_0x573e8a,function(_0x4254f1){return _0x4254f1['get']({'plain':!![]});}),{'includeAll':![]});if(_0x17d058){return db[_0x2f96('0x52')][_0x2f96('0x53')]({'where':{'userProfileId':_0x33cfda[_0x2f96('0x54')]['id'],'sectionId':_['map'](_0x17d058,function(_0xe9b477){return _0xe9b477[_0x2f96('0x57')];})},'attributes':['id',_0x2f96('0x57')],'raw':!![]})[_0x2f96('0x27')](function(_0x33c0ae){var _0x1e31b4=_[_0x2f96('0x30')](_0x33cfda[_0x2f96('0x4e')],function(_0xf535fa){_0xf535fa['userProfileId']=_0x33cfda[_0x2f96('0x54')]['id'];return _0xf535fa;});return db[_0x2f96('0x5a')]['bulkCreate'](_0x1e31b4,{'raw':!![],'transaction':_0x4ab77b});});}})[_0x2f96('0x42')](handleError(_0x18dd03,null));});}})[_0x2f96('0x27')](function(_0x1153fb){var _0x17a9f1=_[_0x2f96('0x30')](_0x1153fb,function(_0x508387){return _0x508387[_0x2f96('0x4a')]({'plain':!![]});});})['then'](respondWithResult(_0x18dd03,null))['catch'](handleError(_0x18dd03,null));};exports['removeResources']=function(_0x226cb9,_0x3659dc,_0x572b71){return db[_0x2f96('0x40')][_0x2f96('0x46')]({'where':{'id':_0x226cb9[_0x2f96('0x54')]['id']}})['then'](handleEntityNotFound(_0x3659dc,null))[_0x2f96('0x27')](function(_0xa3450d){if(_0xa3450d){return _0xa3450d[_0x2f96('0x6b')](_0x226cb9[_0x2f96('0x31')][_0x2f96('0x6c')]);}})[_0x2f96('0x27')](respondWithStatusCode(_0x3659dc,null))[_0x2f96('0x42')](handleError(_0x3659dc,null));};exports[_0x2f96('0x6d')]=function(_0x327881,_0x4f1d72){var _0x4cc65b={};if(!_0x327881[_0x2f96('0x31')][_0x2f96('0x6e')])throw new Error(_0x2f96('0x6f'));if(!_0x327881[_0x2f96('0x31')][_0x2f96('0x37')](_0x2f96('0x38'))){_0x4cc65b[_0x2f96('0x1e')]=qs[_0x2f96('0x1e')](_0x327881[_0x2f96('0x31')][_0x2f96('0x1e')]);_0x4cc65b[_0x2f96('0x20')]=qs[_0x2f96('0x20')](_0x327881[_0x2f96('0x31')][_0x2f96('0x20')]);}return db[_0x2f96('0x40')]['find']({'where':{'id':_0x327881[_0x2f96('0x54')]['id']}})['then'](function(_0x4000a8){if(!_0x4000a8)throw new Error(_0x2f96('0x70')+_0x327881[_0x2f96('0x54')]['id']);return db[_0x2f96('0x40')][_0x2f96('0x6d')](_0x327881);})['then'](respondWithFilteredResult(_0x4f1d72,_0x4cc65b))[_0x2f96('0x42')](handleError(_0x4f1d72,null));}; \ No newline at end of file +var _0x7c6c=['index','map','UserProfile','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','options','includeAll','include','rows','catch','show','params','merge','find','create','body','clone','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','UserProfileSection','update','describe','addSections','push','get','removeSections','ids','getSections','filter','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','userProfileId','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','send'];(function(_0x38646c,_0x1bb99c){var _0x826935=function(_0x350aa5){while(--_0x350aa5){_0x38646c['push'](_0x38646c['shift']());}};_0x826935(++_0x1bb99c);}(_0x7c6c,0xb9));var _0xc7c6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7c6c[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xc7c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc7c6('0x1'));var jsonpatch=require(_0xc7c6('0x2'));var rp=require('request-promise');var moment=require(_0xc7c6('0x3'));var BPromise=require(_0xc7c6('0x4'));var Mustache=require(_0xc7c6('0x5'));var util=require(_0xc7c6('0x6'));var path=require(_0xc7c6('0x7'));var sox=require(_0xc7c6('0x8'));var csv=require('to-csv');var ejs=require(_0xc7c6('0x9'));var fs=require('fs');var fs_extra=require(_0xc7c6('0xa'));var _=require(_0xc7c6('0xb'));var squel=require('squel');var crypto=require(_0xc7c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc7c6('0xd'));var toCsv=require(_0xc7c6('0xe'));var querystring=require(_0xc7c6('0xf'));var Papa=require(_0xc7c6('0x10'));var Redis=require(_0xc7c6('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc7c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7c6('0x13'))(_0xc7c6('0x14'));var utils=require(_0xc7c6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7c6('0x16'));var db=require(_0xc7c6('0x17'))['db'];config[_0xc7c6('0x18')]=_[_0xc7c6('0x19')](config[_0xc7c6('0x18')],{'host':_0xc7c6('0x1a'),'port':0x18eb});var socket=require(_0xc7c6('0x1b'))(new Redis(config[_0xc7c6('0x18')]));require('./userProfile.socket')[_0xc7c6('0x1c')](socket);function respondWithStatusCode(_0x1dd347,_0x252c2a){_0x252c2a=_0x252c2a||0xcc;return function(_0xf1949){if(_0xf1949){return _0x1dd347['sendStatus'](_0x252c2a);}return _0x1dd347[_0xc7c6('0x1d')](_0x252c2a)[_0xc7c6('0x1e')]();};}function respondWithResult(_0x442ad1,_0x3cf936){_0x3cf936=_0x3cf936||0xc8;return function(_0x30b9cd){if(_0x30b9cd){return _0x442ad1[_0xc7c6('0x1d')](_0x3cf936)[_0xc7c6('0x1f')](_0x30b9cd);}};}function respondWithFilteredResult(_0x485131,_0xa50b40){return function(_0x5b07ec){if(_0x5b07ec){var _0x3ecbd0=typeof _0xa50b40[_0xc7c6('0x20')]===_0xc7c6('0x21')&&typeof _0xa50b40[_0xc7c6('0x22')]===_0xc7c6('0x21');var _0x3c6678=_0x5b07ec[_0xc7c6('0x23')];var _0x3b7f74=_0x3ecbd0?0x0:_0xa50b40[_0xc7c6('0x20')];var _0x98646b=_0x3ecbd0?_0x5b07ec[_0xc7c6('0x23')]:_0xa50b40[_0xc7c6('0x20')]+_0xa50b40[_0xc7c6('0x22')];var _0x2c5d37;if(_0x98646b>=_0x3c6678){_0x98646b=_0x3c6678;_0x2c5d37=0xc8;}else{_0x2c5d37=0xce;}_0x485131[_0xc7c6('0x1d')](_0x2c5d37);return _0x485131[_0xc7c6('0x24')](_0xc7c6('0x25'),_0x3b7f74+'-'+_0x98646b+'/'+_0x3c6678)[_0xc7c6('0x1f')](_0x5b07ec);}return null;};}function patchUpdates(_0x55e70d){return function(_0x4786ac){try{jsonpatch['apply'](_0x4786ac,_0x55e70d,!![]);}catch(_0x27fe2c){return BPromise[_0xc7c6('0x26')](_0x27fe2c);}return _0x4786ac[_0xc7c6('0x27')]();};}function saveUpdates(_0x3dd09a,_0x242d41){return function(_0x826f42){if(_0x826f42){return _0x826f42['update'](_0x3dd09a)[_0xc7c6('0x28')](function(_0x175045){return _0x175045;});}return null;};}function removeEntity(_0x565564,_0x3d265d){return function(_0x13df9b){if(_0x13df9b){return _0x13df9b[_0xc7c6('0x29')]()[_0xc7c6('0x28')](function(){_0x565564['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48aa32,_0x584b5d){return function(_0x2823b5){if(!_0x2823b5){_0x48aa32['sendStatus'](0x194);}return _0x2823b5;};}function handleError(_0x463e76,_0x53f348){_0x53f348=_0x53f348||0x1f4;return function(_0x8e707b){logger[_0xc7c6('0x2a')](_0x8e707b[_0xc7c6('0x2b')]);if(_0x8e707b['name']){delete _0x8e707b['name'];}_0x463e76[_0xc7c6('0x1d')](_0x53f348)[_0xc7c6('0x2c')](_0x8e707b);};}exports[_0xc7c6('0x2d')]=function(_0x115a5b,_0x44aa32){var _0x57d01e={},_0x42fc39={},_0x1edd1b={'count':0x0,'rows':[]};var _0x3acf2b=_[_0xc7c6('0x2e')](db[_0xc7c6('0x2f')][_0xc7c6('0x30')],function(_0x2bb170){return{'name':_0x2bb170[_0xc7c6('0x31')],'type':_0x2bb170[_0xc7c6('0x32')][_0xc7c6('0x33')]};});_0x42fc39[_0xc7c6('0x34')]=_['map'](_0x3acf2b,_0xc7c6('0x35'));_0x42fc39[_0xc7c6('0x36')]=_[_0xc7c6('0x37')](_0x115a5b[_0xc7c6('0x36')]);_0x42fc39[_0xc7c6('0x38')]=_[_0xc7c6('0x39')](_0x42fc39[_0xc7c6('0x34')],_0x42fc39[_0xc7c6('0x36')]);_0x57d01e[_0xc7c6('0x3a')]=_[_0xc7c6('0x39')](_0x42fc39[_0xc7c6('0x34')],qs[_0xc7c6('0x3b')](_0x115a5b[_0xc7c6('0x36')][_0xc7c6('0x3b')]));_0x57d01e['attributes']=_0x57d01e[_0xc7c6('0x3a')][_0xc7c6('0x3c')]?_0x57d01e[_0xc7c6('0x3a')]:_0x42fc39['model'];if(!_0x115a5b[_0xc7c6('0x36')][_0xc7c6('0x3d')](_0xc7c6('0x3e'))){_0x57d01e[_0xc7c6('0x22')]=qs[_0xc7c6('0x22')](_0x115a5b['query'][_0xc7c6('0x22')]);_0x57d01e['offset']=qs['offset'](_0x115a5b[_0xc7c6('0x36')][_0xc7c6('0x20')]);}_0x57d01e[_0xc7c6('0x3f')]=qs['sort'](_0x115a5b[_0xc7c6('0x36')]['sort']);_0x57d01e['where']=qs['filters'](_[_0xc7c6('0x40')](_0x115a5b['query'],_0x42fc39[_0xc7c6('0x38')]),_0x3acf2b);if(_0x115a5b[_0xc7c6('0x36')]['filter']){_0x57d01e[_0xc7c6('0x41')]=_['merge'](_0x57d01e[_0xc7c6('0x41')],{'$or':_['map'](_0x3acf2b,function(_0x290587){if(_0x290587[_0xc7c6('0x32')]!=='VIRTUAL'){var _0x1e178d={};_0x1e178d[_0x290587[_0xc7c6('0x35')]]={'$like':'%'+_0x115a5b['query']['filter']+'%'};return _0x1e178d;}})});}_0x57d01e=_['merge']({},_0x57d01e,_0x115a5b[_0xc7c6('0x42')]);var _0x29d9b6={'where':_0x57d01e['where']};return db[_0xc7c6('0x2f')]['count'](_0x29d9b6)[_0xc7c6('0x28')](function(_0x3ca2be){_0x1edd1b['count']=_0x3ca2be;if(_0x115a5b['query'][_0xc7c6('0x43')]){_0x57d01e[_0xc7c6('0x44')]=[{'all':!![]}];}return db[_0xc7c6('0x2f')]['findAll'](_0x57d01e);})[_0xc7c6('0x28')](function(_0xd4e103){_0x1edd1b[_0xc7c6('0x45')]=_0xd4e103;return _0x1edd1b;})[_0xc7c6('0x28')](respondWithFilteredResult(_0x44aa32,_0x57d01e))[_0xc7c6('0x46')](handleError(_0x44aa32,null));};exports[_0xc7c6('0x47')]=function(_0x25ce6d,_0x248c46){var _0x29a72f={'raw':![],'where':{'id':_0x25ce6d[_0xc7c6('0x48')]['id']}},_0x412d86={};_0x412d86[_0xc7c6('0x34')]=_[_0xc7c6('0x37')](db['UserProfile'][_0xc7c6('0x30')]);_0x412d86['query']=_[_0xc7c6('0x37')](_0x25ce6d[_0xc7c6('0x36')]);_0x412d86[_0xc7c6('0x38')]=_[_0xc7c6('0x39')](_0x412d86[_0xc7c6('0x34')],_0x412d86['query']);_0x29a72f[_0xc7c6('0x3a')]=_[_0xc7c6('0x39')](_0x412d86[_0xc7c6('0x34')],qs[_0xc7c6('0x3b')](_0x25ce6d['query'][_0xc7c6('0x3b')]));_0x29a72f[_0xc7c6('0x3a')]=_0x29a72f[_0xc7c6('0x3a')][_0xc7c6('0x3c')]?_0x29a72f[_0xc7c6('0x3a')]:_0x412d86[_0xc7c6('0x34')];if(_0x25ce6d['query'][_0xc7c6('0x43')]){_0x29a72f['include']=[{'all':!![]}];}_0x29a72f=_[_0xc7c6('0x49')]({},_0x29a72f,_0x25ce6d[_0xc7c6('0x42')]);return db[_0xc7c6('0x2f')][_0xc7c6('0x4a')](_0x29a72f)[_0xc7c6('0x28')](handleEntityNotFound(_0x248c46,null))[_0xc7c6('0x28')](respondWithResult(_0x248c46,null))[_0xc7c6('0x46')](handleError(_0x248c46,null));};exports[_0xc7c6('0x4b')]=function(_0x476ef8,_0x5c9c8f){return db['UserProfile'][_0xc7c6('0x4b')](_0x476ef8[_0xc7c6('0x4c')],{})[_0xc7c6('0x28')](respondWithResult(_0x5c9c8f,0xc9))[_0xc7c6('0x46')](handleError(_0x5c9c8f,null));};exports[_0xc7c6('0x4d')]=function(_0x111aba,_0x2478c3){var _0x2f2b01={'where':{'id':_0x111aba['params']['id']}},_0x5129ca={};_0x5129ca['model']=_[_0xc7c6('0x37')](db[_0xc7c6('0x2f')]['rawAttributes']);_0x2f2b01[_0xc7c6('0x3a')]=_[_0xc7c6('0x39')](_0x5129ca[_0xc7c6('0x34')],qs[_0xc7c6('0x3b')](_0x111aba[_0xc7c6('0x36')][_0xc7c6('0x3b')]));_0x2f2b01[_0xc7c6('0x3a')]=_0x2f2b01[_0xc7c6('0x3a')][_0xc7c6('0x3c')]?_0x2f2b01['attributes']:_0x5129ca['model'];if(_0x111aba[_0xc7c6('0x36')][_0xc7c6('0x43')]){_0x2f2b01[_0xc7c6('0x44')]=[{'all':!![]}];}_0x2f2b01=_[_0xc7c6('0x49')]({},_0x2f2b01,_0x111aba[_0xc7c6('0x42')]);return db[_0xc7c6('0x2f')][_0xc7c6('0x4a')](_0x2f2b01)[_0xc7c6('0x28')](handleEntityNotFound(_0x2478c3,null))['then'](function(_0x476471){if(_0x476471){var _0x14af07=_0x476471['get']({'plain':!![]});_0x14af07=qs['omit'](_0x14af07,['id',_0xc7c6('0x4e'),_0xc7c6('0x4f'),_0xc7c6('0x50')]);_0x111aba['body']=_[_0xc7c6('0x51')](_0x111aba[_0xc7c6('0x4c')],['id',_0xc7c6('0x4e'),_0xc7c6('0x4f')]);return db[_0xc7c6('0x52')][_0xc7c6('0x53')](function(_0x1d6e2f){return db['UserProfile'][_0xc7c6('0x4b')](_[_0xc7c6('0x49')](_0x14af07,_0x111aba[_0xc7c6('0x4c')]),{'include':_0x111aba[_0xc7c6('0x36')][_0xc7c6('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x1d6e2f})[_0xc7c6('0x28')](function(_0x1e99e8){var _0x20b127=_0x1e99e8['get']({'plain':!![]});return db['UserProfileSection'][_0xc7c6('0x54')]({'where':{'userProfileId':_0x111aba['params']['id']},'raw':!![]})[_0xc7c6('0x28')](function(_0x6b7342){if(_0x6b7342){return BPromise[_0xc7c6('0x55')](_0x6b7342,function(_0x5653d2){return new BPromise(function(_0x408618,_0x5cf4db){if(_0x5653d2[_0xc7c6('0x56')]===null||_0x5653d2[_0xc7c6('0x56')]===0x1)_0x408618(null);return db[_0xc7c6('0x57')][_0xc7c6('0x54')]({'where':{'sectionId':_0x5653d2['id']},'raw':!![]})['then'](function(_0x55dbfd){var _0x22ff28=_[_0xc7c6('0x2e')](_0x55dbfd,function(_0xe87c12){return qs['omit'](_0xe87c12,['id',_0xc7c6('0x4e'),_0xc7c6('0x4f'),_0xc7c6('0x58')]);});_0x408618(_0x22ff28);})[_0xc7c6('0x46')](function(_0x688c){_0x5cf4db(_0x688c);});})[_0xc7c6('0x28')](function(_0x1e6632){var _0x3f944f=qs['omit'](_0x5653d2,['id',_0xc7c6('0x4e'),_0xc7c6('0x4f')]);_0x3f944f['userProfileId']=_0x20b127['id'];if(_0x1e6632)_0x3f944f[_0xc7c6('0x59')]=_0x1e6632;return _0x3f944f;})['then'](function(_0x465cb7){return db[_0xc7c6('0x5a')][_0xc7c6('0x4b')](_0x465cb7,{'include':[{'model':db[_0xc7c6('0x57')],'as':_0xc7c6('0x59')}],'raw':!![],'transaction':_0x1d6e2f});});})[_0xc7c6('0x28')](function(){return _0x20b127;});}});});});}})[_0xc7c6('0x28')](respondWithResult(_0x2478c3,0xc9))[_0xc7c6('0x46')](handleError(_0x2478c3,null));};exports[_0xc7c6('0x5b')]=function(_0xc95a2f,_0x2aee19){if(_0xc95a2f[_0xc7c6('0x4c')]['id']){delete _0xc95a2f[_0xc7c6('0x4c')]['id'];}return db['UserProfile']['find']({'where':{'id':_0xc95a2f[_0xc7c6('0x48')]['id']}})[_0xc7c6('0x28')](handleEntityNotFound(_0x2aee19,null))[_0xc7c6('0x28')](saveUpdates(_0xc95a2f[_0xc7c6('0x4c')],null))['then'](respondWithResult(_0x2aee19,null))[_0xc7c6('0x46')](handleError(_0x2aee19,null));};exports[_0xc7c6('0x29')]=function(_0x28b518,_0x50d529){return db[_0xc7c6('0x2f')][_0xc7c6('0x4a')]({'where':{'id':_0x28b518[_0xc7c6('0x48')]['id']}})[_0xc7c6('0x28')](handleEntityNotFound(_0x50d529,null))[_0xc7c6('0x28')](removeEntity(_0x50d529,null))[_0xc7c6('0x46')](handleError(_0x50d529,null));};exports['describe']=function(_0x1a7539,_0x43e90a){return db[_0xc7c6('0x2f')][_0xc7c6('0x5c')]()['then'](respondWithResult(_0x43e90a,null))[_0xc7c6('0x46')](handleError(_0x43e90a,null));};exports[_0xc7c6('0x5d')]=function(_0x3a2c6d,_0x9c1834){var _0x519940=_0x3a2c6d['body'];return db[_0xc7c6('0x2f')][_0xc7c6('0x4a')]({'where':{'id':_0x3a2c6d[_0xc7c6('0x48')]['id']}})[_0xc7c6('0x28')](handleEntityNotFound(_0x9c1834,null))['then'](function(_0x541caa){if(_0x541caa){return db['sequelize']['transaction'](function(_0x32dc6a){return db[_0xc7c6('0x5a')][_0xc7c6('0x29')]({'where':{'userProfileId':_0x3a2c6d[_0xc7c6('0x48')]['id'],'sectionId':_[_0xc7c6('0x2e')](_0x519940,function(_0x565d57){return _0x565d57[_0xc7c6('0x58')];})},'transaction':_0x32dc6a})['then'](function(){var _0x395405=_[_0xc7c6('0x2e')](_0x519940,function(_0x2c084f){_0x2c084f['userProfileId']=_0x3a2c6d[_0xc7c6('0x48')]['id'];return _0x2c084f;});var _0x2dfb43=[];return BPromise[_0xc7c6('0x55')](_0x395405,function(_0x5ffe5d){return db[_0xc7c6('0x5a')]['create'](_0x5ffe5d,{'include':[{'model':db[_0xc7c6('0x57')],'as':_0xc7c6('0x59')}],'raw':!![],'transaction':_0x32dc6a})[_0xc7c6('0x28')](function(_0x1c44f8){_0x2dfb43[_0xc7c6('0x5e')](_0x1c44f8[_0xc7c6('0x5f')]({'plain':!![]}));});})['then'](function(){return _0x2dfb43;});});});}})[_0xc7c6('0x28')](function(_0x1ee6a8){return _0x1ee6a8;})[_0xc7c6('0x28')](respondWithResult(_0x9c1834,null))[_0xc7c6('0x46')](handleError(_0x9c1834,null));};exports[_0xc7c6('0x60')]=function(_0x3edb80,_0x2b01bd){var _0x17c47d;return db[_0xc7c6('0x2f')][_0xc7c6('0x4a')]({'where':{'id':_0x3edb80['params']['id']},'attributes':['id',_0xc7c6('0x35')]})[_0xc7c6('0x28')](handleEntityNotFound(_0x2b01bd,null))['then'](function(_0x443306){if(_0x443306){_0x17c47d=_0x443306;return db['UserProfileSection'][_0xc7c6('0x29')]({'where':{'userProfileId':_0x3edb80[_0xc7c6('0x48')]['id'],'sectionId':_0x3edb80[_0xc7c6('0x36')][_0xc7c6('0x61')]}});}})[_0xc7c6('0x28')](function(){return _0x17c47d;})[_0xc7c6('0x28')](respondWithStatusCode(_0x2b01bd,null))[_0xc7c6('0x46')](handleError(_0x2b01bd,null));};exports[_0xc7c6('0x62')]=function(_0x728f95,_0x26f3cc){var _0x385b7c=[];var _0x562637=[];return db[_0xc7c6('0x5a')][_0xc7c6('0x54')]({'where':{'userProfileId':_0x728f95['params']['id']},'raw':!![]})[_0xc7c6('0x28')](function(_0x1c0a7f){_0x385b7c=_[_0xc7c6('0x63')](_0x1c0a7f,function(_0x2aed45){return _0x2aed45[_0xc7c6('0x64')]===0x1||_[_0xc7c6('0x65')]([0x3eb,0x709],_0x2aed45[_0xc7c6('0x58')]);});if(!_[_0xc7c6('0x66')](_0x385b7c)){return _['map'](_0x385b7c,function(_0x5ef25e){return _0x5ef25e['sectionId'];});}else{return;}})[_0xc7c6('0x28')](function(_0x5b8e02){if(_0x5b8e02)_0x562637=_0x5b8e02;if(_[_0xc7c6('0x65')](_0x562637,0x64)){var _0x7fa081=_['find'](_0x385b7c,{'sectionId':0x64});return hasDefaultDashboard(_0x7fa081)[_0xc7c6('0x28')](function(_0x5164ed){return _['map'](_0x385b7c,function(_0x413391){if(_0x413391[_0xc7c6('0x58')]===0x64){_0x413391[_0xc7c6('0x67')]=_0x5164ed;}return _0x413391;});});}else{return;}})[_0xc7c6('0x28')](function(_0x2f674f){if(_0x2f674f)_0x385b7c=_0x2f674f;if(_[_0xc7c6('0x65')](_0x562637,0x3eb)){var _0x443762=_[_0xc7c6('0x4a')](_0x385b7c,{'sectionId':0x3eb});return getCustomDashboards(_0x443762)[_0xc7c6('0x28')](function(_0x4fb854){return _['map'](_0x385b7c,function(_0x4d4cd7){if(_0x443762[_0xc7c6('0x64')]){if(_0x4d4cd7[_0xc7c6('0x58')]===0x3eb){_0x4d4cd7[_0xc7c6('0x67')]=_0x4fb854;}}else{if(_0x4d4cd7[_0xc7c6('0x58')]===0x64){if(!_0x4d4cd7[_0xc7c6('0x67')]){_0x4d4cd7[_0xc7c6('0x67')]=[];}_0x4d4cd7['subsections']=_0x4d4cd7[_0xc7c6('0x67')][_0xc7c6('0x68')](_0x4fb854);}}return _0x4d4cd7;});});}else{return;}})[_0xc7c6('0x28')](function(_0x28c55f){if(_0x28c55f)_0x385b7c=_0x28c55f;if(_['includes'](_0x562637,0x709)){var _0xb19950=_[_0xc7c6('0x4a')](_0x385b7c,{'sectionId':0x709});return getPlugins(_0xb19950)[_0xc7c6('0x28')](function(_0x2484f1){if(_0xb19950[_0xc7c6('0x64')]){return _[_0xc7c6('0x2e')](_0x385b7c,function(_0x43923a){if(_0x43923a['sectionId']===0x709){_0x43923a[_0xc7c6('0x67')]=_0x2484f1;}return _0x43923a;});}else{var _0x2aae5c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2484f1};var _0x5b1999=_[_0xc7c6('0x2e')](_0x385b7c);_0x5b1999[_0xc7c6('0x5e')](_0x2aae5c);return _0x5b1999;}});}else{return;}})[_0xc7c6('0x28')](function(_0x1abe45){if(_0x1abe45)_0x385b7c=_0x1abe45;return _[_0xc7c6('0x63')](_0x385b7c,[_0xc7c6('0x64'),0x1]);})[_0xc7c6('0x28')](respondWithResult(_0x26f3cc,null))[_0xc7c6('0x46')](handleError(_0x26f3cc,null));};function hasDefaultDashboard(_0x3c928b){var _0x351dba=[0x65];return new BPromise(function(_0x3e13d8,_0xacc7e6){try{if(_0x3c928b[_0xc7c6('0x56')]){_0x3e13d8(_0x351dba);}else{return db[_0xc7c6('0x57')][_0xc7c6('0x69')]({'where':{'sectionId':_0x3c928b['id']},'raw':!![]})['then'](function(_0x4e3087){_0x4e3087?_0x3e13d8(_0x351dba):_0x3e13d8();});}}catch(_0x30c29b){_0xacc7e6(_0x30c29b);}});}function getCustomDashboards(_0x33b0aa){var _0x94435c=[];return new BPromise(function(_0x5e273c,_0x538fc3){try{if(_0x33b0aa['autoAssociation']){return db[_0xc7c6('0x6a')][_0xc7c6('0x54')]({'raw':!![]})['then'](function(_0x3a6606){_0x3a6606[_0xc7c6('0x6b')](function(_0x5b2c76){_0x94435c['push'](_0x5b2c76['id']+0x1869f);});_0x5e273c(_0x94435c);});}else{return db['UserProfileResource'][_0xc7c6('0x54')]({'where':{'sectionId':_0x33b0aa['id']},'raw':!![]})['then'](function(_0x2d198c){_0x2d198c[_0xc7c6('0x6b')](function(_0x334fc1){_0x94435c[_0xc7c6('0x5e')](_0x334fc1[_0xc7c6('0x6c')]+0x1869f);});_0x5e273c(_0x94435c);});}}catch(_0x21be89){_0x538fc3(_0x21be89);}});}function getPlugins(_0x4ca115){var _0x2e7060=[];return new BPromise(function(_0x15db87,_0x27e22c){try{if(_0x4ca115[_0xc7c6('0x56')]){return db['Plugin'][_0xc7c6('0x54')]({'raw':!![]})[_0xc7c6('0x28')](function(_0x27b6c3){_0x27b6c3['forEach'](function(_0x4614c1){_0x2e7060[_0xc7c6('0x5e')](_0x4614c1['id']+0x15b38);});_0x15db87(_0x2e7060);});}else{return db[_0xc7c6('0x57')][_0xc7c6('0x54')]({'where':{'sectionId':_0x4ca115['id']},'raw':!![]})[_0xc7c6('0x28')](function(_0x456817){_0x456817[_0xc7c6('0x6b')](function(_0x21625c){_0x2e7060['push'](_0x21625c[_0xc7c6('0x6c')]+0x15b38);});_0x15db87(_0x2e7060);});}}catch(_0x1337d4){_0x27e22c(_0x1337d4);}});}exports['addResources']=function(_0x2ce444,_0x59cb6){return db['UserProfile'][_0xc7c6('0x4a')]({'where':{'id':_0x2ce444[_0xc7c6('0x48')]['id']}})[_0xc7c6('0x28')](handleEntityNotFound(_0x59cb6,null))[_0xc7c6('0x28')](function(_0x2b05b2){if(_0x2b05b2){return db['sequelize']['transaction'](function(_0x16ccaf){return db[_0xc7c6('0x5a')][_0xc7c6('0x54')]({'where':{'userProfileId':_0x2ce444[_0xc7c6('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4d592f){if(_0x4d592f){return db['UserProfileSection'][_0xc7c6('0x29')]({'where':{'userProfileId':_0x2ce444[_0xc7c6('0x48')]['id'],'id':_[_0xc7c6('0x2e')](_0x4d592f,function(_0x892032){return _0x892032['id'];})},'transaction':_0x16ccaf});}})['then'](function(_0xd991cf){var _0x410493=_[_0xc7c6('0x2e')](_0x2ce444[_0xc7c6('0x4c')],function(_0x3c002a){_0x3c002a[_0xc7c6('0x6d')]=_0x2ce444[_0xc7c6('0x48')]['id'];return _0x3c002a;});return db['UserProfileSection'][_0xc7c6('0x6e')](_0x410493,{'raw':!![],'transaction':_0x16ccaf});})[_0xc7c6('0x28')](function(_0x845c81){var _0x22933d=_[_0xc7c6('0x63')](_['map'](_0x845c81,function(_0x1dabf6){return _0x1dabf6[_0xc7c6('0x5f')]({'plain':!![]});}),{'includeAll':![]});if(_0x22933d){return db[_0xc7c6('0x5a')]['findAll']({'where':{'userProfileId':_0x2ce444['params']['id'],'sectionId':_[_0xc7c6('0x2e')](_0x22933d,function(_0x17b17d){return _0x17b17d[_0xc7c6('0x58')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xc7c6('0x28')](function(_0x3375c5){var _0x264e2f=_[_0xc7c6('0x2e')](_0x2ce444[_0xc7c6('0x4c')],function(_0xae8220){_0xae8220[_0xc7c6('0x6d')]=_0x2ce444['params']['id'];return _0xae8220;});return db['UserProfileResource'][_0xc7c6('0x6e')](_0x264e2f,{'raw':!![],'transaction':_0x16ccaf});});}})['catch'](handleError(_0x59cb6,null));});}})[_0xc7c6('0x28')](function(_0x1c7409){var _0x2131a8=_[_0xc7c6('0x2e')](_0x1c7409,function(_0x4e042c){return _0x4e042c[_0xc7c6('0x5f')]({'plain':!![]});});})[_0xc7c6('0x28')](respondWithResult(_0x59cb6,null))[_0xc7c6('0x46')](handleError(_0x59cb6,null));};exports[_0xc7c6('0x6f')]=function(_0xc702b6,_0x39a20e,_0x45eb3a){return db[_0xc7c6('0x2f')]['find']({'where':{'id':_0xc702b6[_0xc7c6('0x48')]['id']}})[_0xc7c6('0x28')](handleEntityNotFound(_0x39a20e,null))[_0xc7c6('0x28')](function(_0x36968c){if(_0x36968c){return _0x36968c[_0xc7c6('0x6f')](_0xc702b6[_0xc7c6('0x36')][_0xc7c6('0x61')]);}})[_0xc7c6('0x28')](respondWithStatusCode(_0x39a20e,null))['catch'](handleError(_0x39a20e,null));};exports['getResources']=function(_0x481b83,_0x2cf029){var _0x2332e2={};if(!_0x481b83[_0xc7c6('0x36')][_0xc7c6('0x70')])throw new Error(_0xc7c6('0x71'));if(!_0x481b83[_0xc7c6('0x36')][_0xc7c6('0x3d')](_0xc7c6('0x3e'))){_0x2332e2[_0xc7c6('0x22')]=qs[_0xc7c6('0x22')](_0x481b83[_0xc7c6('0x36')][_0xc7c6('0x22')]);_0x2332e2['offset']=qs[_0xc7c6('0x20')](_0x481b83[_0xc7c6('0x36')][_0xc7c6('0x20')]);}return db['UserProfile']['find']({'where':{'id':_0x481b83[_0xc7c6('0x48')]['id']}})[_0xc7c6('0x28')](function(_0x2108de){if(!_0x2108de)throw new Error(_0xc7c6('0x72')+_0x481b83['params']['id']);return db[_0xc7c6('0x2f')]['getResources'](_0x481b83);})[_0xc7c6('0x28')](respondWithFilteredResult(_0x2cf029,_0x2332e2))['catch'](handleError(_0x2cf029,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5824a9d..8cafde4 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 _0x3914=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x425ecf,_0x495081){var _0x580f4c=function(_0x57058a){while(--_0x57058a){_0x425ecf['push'](_0x425ecf['shift']());}};_0x580f4c(++_0x495081);}(_0x3914,0xeb));var _0x4391=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x3914[_0x541ea6];return _0x3c3e84;};'use strict';var EventEmitter=require(_0x4391('0x0'));var UserProfile=require(_0x4391('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4391('0x2')](0x0);var events={'afterCreate':_0x4391('0x3'),'afterUpdate':'update','afterDestroy':_0x4391('0x4')};function emitEvent(_0x343fb7){return function(_0x175dbc,_0x5b5acb,_0x1eecd4){UserProfileEvents[_0x4391('0x5')](_0x343fb7+':'+_0x175dbc['id'],_0x175dbc);UserProfileEvents['emit'](_0x343fb7,_0x175dbc);_0x1eecd4(null);};}for(var e in events){if(events[_0x4391('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4391('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x7e27=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0x7e27,0xdd));var _0x77e2=function(_0x26bcff,_0x1bf100){_0x26bcff=_0x26bcff-0x0;var _0xb14b0d=_0x7e27[_0x26bcff];return _0xb14b0d;};'use strict';var EventEmitter=require(_0x77e2('0x0'));var UserProfile=require(_0x77e2('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x77e2('0x2')](0x0);var events={'afterCreate':_0x77e2('0x3'),'afterUpdate':_0x77e2('0x4'),'afterDestroy':_0x77e2('0x5')};function emitEvent(_0x49537e){return function(_0x30766a,_0x21bb94,_0x20c6f0){UserProfileEvents['emit'](_0x49537e+':'+_0x30766a['id'],_0x30766a);UserProfileEvents[_0x77e2('0x6')](_0x49537e,_0x30766a);_0x20c6f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x77e2('0x7')](e,emitEvent(event));}}module[_0x77e2('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3057de9..006c38c 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 _0x65c0=['models','filter','findAll','then','associatedResources','value','model','map','catch','UserProfileResource','field','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','JscriptyProject','Lists','lists','CmList','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','membername','telephone','queue','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','sounds','tags','triggers','Trigger','trunks','Trunk','Variable','plugins','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','ignore','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','key','VIRTUAL','find','foreignKey','options','includeAll','include','DefaultReports','custom','CustomReports','count','ids','customSorting','order','extraQueryConditions','CmContact','Tag','Tags','color','ThroughTags','tag','rows','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','all','lodash','./userProfile.attributes','squel'];(function(_0x5a2f4b,_0x425b95){var _0x169410=function(_0x5748b6){while(--_0x5748b6){_0x5a2f4b['push'](_0x5a2f4b['shift']());}};_0x169410(++_0x425b95);}(_0x65c0,0x17f));var _0x065c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x65c0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x065c('0x0'));var attributes=require(_0x065c('0x1'));var squel=require(_0x065c('0x2'));module['exports']=function(_0x4c4b4a){var _0x2dfebc=_0x4c4b4a[_0x065c('0x3')];function _0x548ca5(_0x486b90,_0x4d0522){return new Promise(function(_0x3da58f,_0x46a47f){if(!_0x4d0522)return _0x3da58f(null);var _0x495ec5=_0x4d0522[_0x065c('0x4')]?{[_0x4d0522[_0x065c('0x4')]['field']]:_0x4d0522[_0x065c('0x4')]['value']}:undefined;return _0x2dfebc[_0x486b90][_0x065c('0x5')]({'where':_0x495ec5,'raw':!![]})[_0x065c('0x6')](function(_0x5889e8){_0x4d0522[_0x065c('0x7')]=_['map'](_0x5889e8,'id');_0x3da58f(_0x4d0522);})['catch'](function(_0x2733eb){_0x46a47f(_0x2733eb);});});}function _0x1c9558(_0x16ad42,_0x239998){return new Promise(function(_0x1b9599,_0x2c3a7a){var _0x160bde=_0x16ad42['filter']?{[_0x16ad42['filter']['field']]:_0x16ad42['filter'][_0x065c('0x8')]}:undefined;return _0x2dfebc[_0x16ad42[_0x065c('0x9')]][_0x065c('0x5')]({'where':_0x160bde,'raw':!![]})[_0x065c('0x6')](function(_0x28e9bb){_0x239998[_0x065c('0x7')]=_[_0x065c('0xa')](_0x28e9bb,function(_0x2b183d){return _0x2b183d['name'];});_0x1b9599(_0x239998);})[_0x065c('0xb')](function(_0xe6e2f0){_0x2c3a7a(_0xe6e2f0);});});}function _0x40dcb4(_0x14dfd5,_0x42e999,_0x4817e4){if(!_0x42e999)return Promise['resolve'](null);return new Promise(function(_0x213de0,_0x1c4683){return _0x2dfebc[_0x065c('0xc')][_0x065c('0x5')]({'where':{'sectionId':_0x42e999['id']},'raw':!![]})[_0x065c('0x6')](function(_0x14125a){if(_0x14dfd5[_0x065c('0xd')]&&_0x14dfd5[_0x065c('0xd')]!=='id'){_0x42e999[_0x065c('0x7')]=_[_0x065c('0xa')](_0x14125a,function(_0x45242b){return _0x45242b[_0x14dfd5[_0x065c('0xd')]];});}else{if(_0x4817e4===_0x065c('0xe')){_0x42e999[_0x065c('0x7')]=_['map'](_0x14125a,function(_0x27a3e1){return{'id':_0x27a3e1[_0x065c('0xf')],'type':_0x27a3e1[_0x065c('0x10')]};});}else{_0x42e999[_0x065c('0x7')]=_[_0x065c('0xa')](_0x14125a,function(_0x3948b8){return _0x3948b8[_0x065c('0xf')];});}}_0x213de0(_0x42e999);})['catch'](function(_0x3858a2){_0x1c4683(_0x3858a2);});});}function _0x1fd24c(_0x259ebf,_0x322723){var _0x32d519={'parentSections':[]};switch(_0x259ebf['toLowerCase']()){case _0x065c('0x11'):_0x32d519[_0x065c('0x12')]=_0x065c('0x13');break;case _0x065c('0x14'):_0x32d519[_0x065c('0x12')]=_0x065c('0x15');break;case'squarerecordings':_0x32d519[_0x065c('0x12')]=_0x065c('0x16');_0x32d519[_0x065c('0x17')]=[{'name':_0x065c('0x18'),'field':_0x065c('0x19'),'foreignKey':_0x065c('0x1a')}];break;case'projects':_0x32d519[_0x065c('0x12')]=_0x065c('0x1b');break;case'contacts':_0x32d519[_0x065c('0x12')]='CmContact';_0x32d519[_0x065c('0x17')]=[{'name':_0x065c('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0x065c('0x1d'):_0x32d519[_0x065c('0x12')]=_0x065c('0x1e');break;case'companies':_0x32d519[_0x065c('0x12')]=_0x065c('0x1f');break;case _0x065c('0x20'):_0x32d519[_0x065c('0x12')]=_0x065c('0x21');break;case'chatqueues':_0x32d519['childModel']=_0x065c('0x22');break;case _0x065c('0x23'):_0x32d519[_0x065c('0x12')]=_0x065c('0x24');break;case _0x065c('0x25'):_0x32d519['childModel']=_0x065c('0x26');break;case'faxaccounts':_0x32d519[_0x065c('0x12')]=_0x065c('0x27');break;case _0x065c('0x28'):case _0x065c('0x29'):case'outboundroutes':_0x32d519[_0x065c('0x12')]=_0x065c('0x2a');break;case _0x065c('0x2b'):_0x32d519[_0x065c('0x12')]=_0x065c('0x2c');break;case _0x065c('0x2d'):_0x32d519[_0x065c('0x12')]=_0x065c('0x2e');break;case _0x065c('0x2f'):_0x32d519[_0x065c('0x12')]=_0x065c('0x30');_0x32d519[_0x065c('0x17')]=[{'name':_0x065c('0x31'),'field':_0x065c('0x19'),'foreignKey':'membername','model':_0x065c('0x32'),'filter':{'field':_0x065c('0x33'),'value':['agent']}},{'name':'Telephones','field':'name','foreignKey':_0x065c('0x34'),'model':'User','filter':{'field':_0x065c('0x33'),'value':[_0x065c('0x35')]}},{'name':'VoiceQueues','field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':'QueueCampaigns','field':_0x065c('0x19'),'foreignKey':_0x065c('0x36'),'model':_0x065c('0x37'),'filter':{'field':_0x065c('0x10'),'value':[_0x065c('0x38')]}}];break;case'musiconholds':_0x32d519[_0x065c('0x12')]=_0x065c('0x39');break;case _0x065c('0x3a'):_0x32d519[_0x065c('0x12')]='VoiceChanSpy';break;case _0x065c('0x3b'):_0x32d519['childModel']=_0x065c('0x3c');break;case _0x065c('0x3d'):_0x32d519[_0x065c('0x12')]=_0x065c('0x3e');break;case _0x065c('0x3f'):_0x32d519['childModel']=_0x065c('0x40');break;case'mailaccounts':_0x32d519['childModel']=_0x065c('0x41');break;case _0x065c('0x42'):_0x32d519[_0x065c('0x12')]=_0x065c('0x43');break;case _0x065c('0x44'):_0x32d519[_0x065c('0x12')]=_0x065c('0x45');break;case _0x065c('0x46'):_0x32d519['childModel']=_0x065c('0x47');break;case _0x065c('0x48'):_0x32d519[_0x065c('0x12')]=_0x065c('0x49');break;case _0x065c('0x4a'):_0x32d519[_0x065c('0x12')]='SmsAccount';break;case'whatsappqueues':_0x32d519[_0x065c('0x12')]=_0x065c('0x4b');break;case _0x065c('0x4c'):_0x32d519[_0x065c('0x12')]=_0x065c('0x4d');break;case _0x065c('0x4e'):_0x32d519[_0x065c('0x12')]='Team';break;case _0x065c('0x4f'):case _0x065c('0x50'):_0x32d519[_0x065c('0x12')]='VoiceQueue';if(_0x322723){_0x32d519[_0x065c('0x17')]=[{'name':'VoiceQueues'},{'name':_0x065c('0x51')}];}break;case _0x065c('0x52'):case _0x065c('0x53'):case _0x065c('0x54'):_0x32d519[_0x065c('0x12')]=_0x065c('0x32');if(_0x322723){_0x32d519[_0x065c('0x17')]=[{'name':'Users','filter':{'field':_0x065c('0x33'),'value':[_0x065c('0x55'),_0x065c('0x56')]},'ignore':!![]},{'name':_0x065c('0x31')},{'name':_0x065c('0x57')}];}break;case _0x065c('0x58'):_0x32d519[_0x065c('0x12')]=_0x065c('0x59');break;case _0x065c('0x5a'):_0x32d519[_0x065c('0x12')]='SalesforceAccount';break;case _0x065c('0x5b'):_0x32d519[_0x065c('0x12')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x32d519[_0x065c('0x12')]=_0x065c('0x5c');break;case _0x065c('0x5d'):_0x32d519[_0x065c('0x12')]='DeskAccount';break;case _0x065c('0x5e'):_0x32d519[_0x065c('0x12')]=_0x065c('0x5f');break;case _0x065c('0x60'):_0x32d519[_0x065c('0x12')]=_0x065c('0x32');break;case _0x065c('0x61'):_0x32d519['childModel']=_0x065c('0x62');break;case _0x065c('0x63'):_0x32d519[_0x065c('0x12')]='Disposition';break;case _0x065c('0x64'):_0x32d519[_0x065c('0x12')]=_0x065c('0x65');break;case _0x065c('0x66'):_0x32d519['childModel']='Interval';break;case _0x065c('0x67'):_0x32d519['childModel']=_0x065c('0x68');break;case _0x065c('0x69'):_0x32d519[_0x065c('0x12')]='Schedule';break;case _0x065c('0x6a'):_0x32d519[_0x065c('0x12')]='Sound';break;case _0x065c('0x6b'):_0x32d519[_0x065c('0x12')]='Tag';break;case'templates':_0x32d519['childModel']='Template';break;case _0x065c('0x6c'):_0x32d519[_0x065c('0x12')]=_0x065c('0x6d');break;case _0x065c('0x6e'):_0x32d519['childModel']=_0x065c('0x6f');break;case'variables':_0x32d519[_0x065c('0x12')]=_0x065c('0x70');break;case _0x065c('0x71'):_0x32d519['childModel']='Plugin';break;case _0x065c('0x72'):_0x32d519[_0x065c('0x12')]=_0x065c('0xe');_0x32d519[_0x065c('0x17')]=[{'name':_0x065c('0x73'),'field':'id','foreignKey':_0x065c('0x74')}];break;case _0x065c('0x75'):_0x32d519[_0x065c('0x12')]='AnalyticMetric';break;}return _0x32d519;}function _0x2fa55f(_0x551a0f,_0x11dd71){var _0x5ae58b=_0x551a0f[_0x065c('0x76')](0x0)[_0x065c('0x77')]()+_0x551a0f[_0x065c('0x78')](0x1);var _0x3aa6d6={'type':_0x2dfebc[_0x065c('0x79')][_0x065c('0x7a')][_0x065c('0x7b')],'raw':!![]};return new Promise(function(_0x202efa,_0x28f482){var _0x18004e=squel[_0x065c('0x7c')]()[_0x065c('0xd')](_0x065c('0x7d')+_0x5ae58b+'InteractionId','id')[_0x065c('0xd')](_0x065c('0x7e'))['from'](_0x065c('0x7f')+_0x551a0f+_0x065c('0x80'),'ui')['where'](_0x065c('0x81'),_0x11dd71['id']);return _0x2dfebc[_0x065c('0x82')]['query'](_0x18004e[_0x065c('0x83')](),_0x3aa6d6)['then'](function(_0xd937cb){_0x11dd71[_0x5ae58b+_0x065c('0x84')]=_0xd937cb;_0x202efa(_0xd937cb);})[_0x065c('0xb')](function(_0x3ac331){_0x28f482(_0x3ac331);});});}return _0x4c4b4a[_0x065c('0x85')](_0x065c('0x86'),attributes,{'tableName':_0x065c('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x452151){var _0x1183ad=require(_0x065c('0x88'));var _0x3d26a2={'raw':_0x452151['query'][_0x065c('0x89')],'where':{}};var _0x1c1031={};var _0x64318={'count':0x0,'rows':[]};var _0x2cbab8=_0x452151[_0x065c('0x8a')][_0x065c('0x8b')];var _0x47a521=_0x452151[_0x065c('0x8a')][_0x065c('0x8c')]||![];var _0x4787f8=_0x1fd24c(_0x2cbab8,_0x47a521);if(!_0x4787f8[_0x065c('0x12')])throw new Error(_0x065c('0x8d')+_0x2cbab8+'\x27');var _0x4c3871=[{'name':_0x2cbab8}];if(!_[_0x065c('0x8e')](_0x4787f8[_0x065c('0x17')]))_0x4c3871=_0x4787f8[_0x065c('0x17')];var _0x411f34=[];for(var _0x4d1e3a=0x0;_0x4d1e3a<_0x4c3871[_0x065c('0x8f')];_0x4d1e3a++){_0x411f34[_0x065c('0x90')](_0x2dfebc[_0x065c('0x91')]['find']({'where':{'userProfileId':_0x452151[_0x065c('0x92')]['id'],'name':_0x4c3871[_0x4d1e3a]['name']},'raw':!![]}));}return Promise['all'](_0x411f34)[_0x065c('0x6')](function(_0x4382d8){var _0x3212e2=_['filter'](_0x4382d8,function(_0x16df64){return _0x16df64?_0x16df64:undefined;});var _0x1a68ce=_['filter'](_0x4c3871,[_0x065c('0x93'),!![]]);var _0x48ca7a=_[_0x065c('0x8e')](_0x3212e2)&&_['isEmpty'](_0x1a68ce)?null:_['union'](_0x1a68ce,_0x3212e2);if(!_0x48ca7a)return null;var _0x44b1c6=[];for(var _0x405b51=0x0;_0x405b51<_0x48ca7a[_0x065c('0x8f')];_0x405b51++){var _0x4795d6=_['find'](_0x4c3871,function(_0x2429dc){return _0x48ca7a[_0x405b51]?_0x2429dc[_0x065c('0x19')]===_0x48ca7a[_0x405b51]['name']:null;});if(_0x4795d6){if(_0x48ca7a[_0x405b51][_0x065c('0x93')]){_0x44b1c6['push'](_0x548ca5(_0x4787f8['childModel'],_0x48ca7a[_0x405b51]));}else{if(!_0x48ca7a[_0x405b51][_0x065c('0x94')]){_0x44b1c6[_0x065c('0x90')](_0x40dcb4(_0x4795d6,_0x48ca7a[_0x405b51],_0x4787f8[_0x065c('0x12')]));}else{if(_0x4795d6[_0x065c('0x9')]){_0x44b1c6[_0x065c('0x90')](_0x1c9558(_0x4795d6,_0x48ca7a[_0x405b51]));}}}}}return Promise['all'](_0x44b1c6);})[_0x065c('0x6')](function(_0x1bdd60){var _0x421a7e=_0x1bdd60;var _0x2f69ea=null;if(_0x421a7e){_0x2f69ea=_0x421a7e[_0x065c('0x8f')]===0x1?_0x421a7e[0x0]:null;}if(!_0x2f69ea&&!_0x421a7e)return _0x64318;var _0x22dddd=_0x2dfebc[_0x4787f8['childModel']]['rawAttributes'];_0x1c1031[_0x065c('0x9')]=_[_0x065c('0x95')](_0x22dddd);_0x1c1031[_0x065c('0x8a')]=_[_0x065c('0x95')](_0x452151[_0x065c('0x8a')]);_0x1c1031[_0x065c('0x96')]=_[_0x065c('0x97')](_0x1c1031[_0x065c('0x9')],_0x1c1031[_0x065c('0x8a')]);_0x3d26a2[_0x065c('0x98')]=_[_0x065c('0x97')](_0x1c1031['model'],_0x1183ad[_0x065c('0x99')](_0x452151[_0x065c('0x8a')][_0x065c('0x99')]));_0x3d26a2[_0x065c('0x98')]=_0x3d26a2['attributes'][_0x065c('0x8f')]?_0x3d26a2['attributes']:_0x1c1031[_0x065c('0x9')];if(!_0x452151[_0x065c('0x8a')][_0x065c('0x9a')](_0x065c('0x9b'))){_0x3d26a2[_0x065c('0x9c')]=_0x1183ad[_0x065c('0x9c')](_0x452151[_0x065c('0x8a')]['limit']);_0x3d26a2[_0x065c('0x9d')]=_0x1183ad[_0x065c('0x9d')](_0x452151[_0x065c('0x8a')][_0x065c('0x9d')]);}_0x3d26a2['order']=_0x1183ad[_0x065c('0x9e')](_0x452151[_0x065c('0x8a')][_0x065c('0x9e')]);_0x3d26a2[_0x065c('0x9f')]=_0x1183ad[_0x065c('0x96')](_[_0x065c('0xa0')](_0x452151[_0x065c('0x8a')],_0x1c1031[_0x065c('0x96')]));if(_0x452151[_0x065c('0x8a')][_0x065c('0x4')]){_0x3d26a2['where']=_[_0x065c('0xa1')](_0x3d26a2[_0x065c('0x9f')],{'$or':_[_0x065c('0xa')](_0x22dddd,function(_0x1d989d){if(_0x1d989d[_0x065c('0x10')][_0x065c('0xa2')]!==_0x065c('0xa3')){var _0x2462a6={};_0x2462a6[_0x1d989d['field']]={'$like':'%'+_0x452151[_0x065c('0x8a')][_0x065c('0x4')]+'%'};return _0x2462a6;}})});}var _0x26b472=[];var _0x149037=null;var _0x4b08e8={};if(_0x2f69ea){_0x149037=_[_0x065c('0xa4')](_0x4c3871,[_0x065c('0x19'),_0x2f69ea[_0x065c('0x19')]]);if(_0x149037['field']){_0x4b08e8={};if(_0x4787f8[_0x065c('0x12')]===_0x065c('0xe')){_0x4b08e8[_0x149037[_0x065c('0xa5')]]=_[_0x065c('0xa')](_0x2f69ea[_0x065c('0x7')],'id');}else{_0x4b08e8[_0x149037[_0x065c('0xa5')]]=_0x2f69ea['associatedResources'];}_0x26b472[_0x065c('0x90')](_0x4b08e8);}else{_0x3d26a2[_0x065c('0x9f')]['id']=_0x2f69ea[_0x065c('0x7')];}}else{for(var _0x357dad=0x0;_0x357dad<_0x421a7e[_0x065c('0x8f')];_0x357dad++){_0x149037=_[_0x065c('0xa4')](_0x4c3871,[_0x065c('0x19'),_0x421a7e[_0x357dad][_0x065c('0x19')]]);if(_0x149037[_0x065c('0xd')]){_0x4b08e8={};_0x4b08e8[_0x149037['foreignKey']]=_0x421a7e[_0x357dad]['associatedResources'];_0x26b472[_0x065c('0x90')](_0x4b08e8);}else{if(!_0x3d26a2[_0x065c('0x9f')]['id'])_0x3d26a2[_0x065c('0x9f')]['id']=[];_0x421a7e[_0x357dad][_0x065c('0x7')]['forEach'](function(_0x374caa){_0x3d26a2[_0x065c('0x9f')]['id'][_0x065c('0x90')](_0x374caa);});}}}if(!_[_0x065c('0x8e')](_0x26b472)){_0x3d26a2[_0x065c('0x9f')]=_[_0x065c('0xa1')](_0x3d26a2[_0x065c('0x9f')],{'$and':{'$or':_0x26b472}});}_0x3d26a2=_['merge']({},_0x3d26a2,_0x452151[_0x065c('0xa6')]);if(_0x2f69ea&&!_0x2f69ea[_0x065c('0x94')]&&_0x4787f8[_0x065c('0x12')]===_0x065c('0xe')){if(_0x452151[_0x065c('0x8a')][_0x065c('0xa7')]){_0x3d26a2[_0x065c('0xa8')]=[{'all':!![]}];}return _0x2dfebc[_0x4787f8[_0x065c('0x12')]][_0x065c('0x5')](_0x3d26a2)[_0x065c('0x6')](function(_0x2c8cbe){var _0x4bdcb9=[];_0x2c8cbe['forEach'](function(_0x282565){var _0x3988cc;switch(_0x282565['reportType']){case'default':_0x3988cc=_[_0x065c('0xa4')](_0x2f69ea['associatedResources'],function(_0x2ab7fc){return _0x2ab7fc['id']===_0x282565[_0x065c('0x74')]&&_0x2ab7fc[_0x065c('0x10')]===_0x065c('0xa9');});break;case _0x065c('0xaa'):_0x3988cc=_[_0x065c('0xa4')](_0x2f69ea[_0x065c('0x7')],function(_0x55ec80){return _0x55ec80['id']===_0x282565[_0x065c('0x74')]&&_0x55ec80[_0x065c('0x10')]===_0x065c('0xab');});break;}if(_0x3988cc)_0x4bdcb9[_0x065c('0x90')](_0x282565);});_0x64318[_0x065c('0xac')]=_0x4bdcb9['length'];_0x64318['rows']=_0x4bdcb9;return _0x64318;});}else{if(!_[_0x065c('0x8e')](_0x452151['query'][_0x065c('0xad')])){_0x3d26a2[_0x065c('0x9f')]['id']=_0x3d26a2[_0x065c('0x9f')]['id']?_[_0x065c('0x97')](_0x3d26a2[_0x065c('0x9f')]['id'],_0x452151['query']['ids']):_0x452151[_0x065c('0x8a')][_0x065c('0xad')];if(_0x452151[_0x065c('0x8a')][_0x065c('0xae')]){_0x3d26a2[_0x065c('0xaf')]=_0x452151[_0x065c('0x8a')][_0x065c('0xae')];}}if(_0x452151[_0x065c('0x8a')][_0x065c('0xb0')]){_0x3d26a2[_0x065c('0x9f')]=_[_0x065c('0xa1')](_0x3d26a2[_0x065c('0x9f')],{'$and':_0x452151[_0x065c('0x8a')][_0x065c('0xb0')]});}return _0x2dfebc[_0x4787f8[_0x065c('0x12')]][_0x065c('0xac')]({'where':_0x3d26a2[_0x065c('0x9f')]})[_0x065c('0x6')](function(_0x2dfea8){_0x64318[_0x065c('0xac')]=_0x2dfea8;if(_0x452151['query'][_0x065c('0xa7')]){if(_0x4787f8['childModel']===_0x065c('0xb1')){_0x3d26a2['include']=[{'model':_0x2dfebc[_0x065c('0xb2')],'as':_0x065c('0xb3'),'attributes':['id',_0x065c('0x19'),_0x065c('0xb4')],'required':_0x452151[_0x065c('0x8a')]['tag']?!![]:![]},{'model':_0x2dfebc[_0x065c('0xb2')],'as':_0x065c('0xb5'),'attributes':['id',_0x065c('0x19'),_0x065c('0xb4')],'through':_0x452151[_0x065c('0x8a')][_0x065c('0xb6')]?{'attributes':[],'where':{'TagId':_0x452151[_0x065c('0x8a')][_0x065c('0xb6')]||undefined}}:{},'required':_0x452151['query']['tag']?!![]:![]}];}else{_0x3d26a2[_0x065c('0xa8')]=[{'all':!![]}];}}return _0x2dfebc[_0x4787f8[_0x065c('0x12')]][_0x065c('0x5')](_0x3d26a2);})[_0x065c('0x6')](function(_0x3a3e64){_0x64318[_0x065c('0xb7')]=_0x3a3e64;if(_0x2cbab8===_0x065c('0x31')&&_0x452151[_0x065c('0x8a')][_0x065c('0xb8')]===_0x065c('0xb9')){var _0x4efac4=[];for(var _0x52df2e=0x0;_0x52df2e<_0x64318[_0x065c('0xb7')]['length'];_0x52df2e++){_0x4efac4['push'](_0x2fa55f('chat',_0x64318[_0x065c('0xb7')][_0x52df2e][_0x065c('0xba')]));_0x4efac4[_0x065c('0x90')](_0x2fa55f(_0x065c('0xbb'),_0x64318[_0x065c('0xb7')][_0x52df2e]['dataValues']));_0x4efac4[_0x065c('0x90')](_0x2fa55f(_0x065c('0xbc'),_0x64318[_0x065c('0xb7')][_0x52df2e][_0x065c('0xba')]));_0x4efac4[_0x065c('0x90')](_0x2fa55f(_0x065c('0xbd'),_0x64318['rows'][_0x52df2e][_0x065c('0xba')]));_0x4efac4[_0x065c('0x90')](_0x2fa55f(_0x065c('0xbe'),_0x64318[_0x065c('0xb7')][_0x52df2e][_0x065c('0xba')]));_0x4efac4[_0x065c('0x90')](_0x2fa55f(_0x065c('0xbf'),_0x64318[_0x065c('0xb7')][_0x52df2e][_0x065c('0xba')]));}return Promise[_0x065c('0xc0')](_0x4efac4)[_0x065c('0x6')](function(){return _0x64318;});}return _0x64318;});}});}}});}; \ No newline at end of file +var _0xdd29=['smsqueues','SmsQueue','WhatsappQueue','whatsappaccounts','teams','Team','telephones','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','union','autoAssociation','rawAttributes','model','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','sort','filters','pick','merge','VIRTUAL','foreignKey','forEach','options','include','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','color','tag','true','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','squel','exports','filter','value','findAll','then','associatedResources','map','catch','field','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxaccounts','internalroutes','VoiceExtension','contexts','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue'];(function(_0x182973,_0xb2ac57){var _0x25b239=function(_0x286c5a){while(--_0x286c5a){_0x182973['push'](_0x182973['shift']());}};_0x25b239(++_0xb2ac57);}(_0xdd29,0x12b));var _0x9dd2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd29[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9dd2('0x0'));var attributes=require(_0x9dd2('0x1'));var squel=require(_0x9dd2('0x2'));module[_0x9dd2('0x3')]=function(_0x55ccff){var _0x302da0=_0x55ccff['models'];function _0xc5489f(_0x3a1325,_0x43b6ca){return new Promise(function(_0x2b14db,_0x35ff60){if(!_0x43b6ca)return _0x2b14db(null);var _0x5b0926=_0x43b6ca[_0x9dd2('0x4')]?{[_0x43b6ca['filter']['field']]:_0x43b6ca[_0x9dd2('0x4')][_0x9dd2('0x5')]}:undefined;return _0x302da0[_0x3a1325][_0x9dd2('0x6')]({'where':_0x5b0926,'raw':!![]})[_0x9dd2('0x7')](function(_0xee1864){_0x43b6ca[_0x9dd2('0x8')]=_[_0x9dd2('0x9')](_0xee1864,'id');_0x2b14db(_0x43b6ca);})[_0x9dd2('0xa')](function(_0xdfd652){_0x35ff60(_0xdfd652);});});}function _0x2ec53c(_0xcf0fd5,_0x3c1337){return new Promise(function(_0x45bc12,_0x520556){var _0x4b8cf0=_0xcf0fd5[_0x9dd2('0x4')]?{[_0xcf0fd5[_0x9dd2('0x4')][_0x9dd2('0xb')]]:_0xcf0fd5['filter']['value']}:undefined;return _0x302da0[_0xcf0fd5['model']][_0x9dd2('0x6')]({'where':_0x4b8cf0,'raw':!![]})[_0x9dd2('0x7')](function(_0x231bf0){_0x3c1337[_0x9dd2('0x8')]=_[_0x9dd2('0x9')](_0x231bf0,function(_0x529d6f){return _0x529d6f['name'];});_0x45bc12(_0x3c1337);})[_0x9dd2('0xa')](function(_0x33047f){_0x520556(_0x33047f);});});}function _0x2f18d3(_0x354b5d,_0xc97fc4,_0x4dfc33){if(!_0xc97fc4)return Promise['resolve'](null);return new Promise(function(_0xeeb5eb,_0x407205){return _0x302da0[_0x9dd2('0xc')][_0x9dd2('0x6')]({'where':{'sectionId':_0xc97fc4['id']},'raw':!![]})[_0x9dd2('0x7')](function(_0x218f93){if(_0x354b5d['field']&&_0x354b5d[_0x9dd2('0xb')]!=='id'){_0xc97fc4[_0x9dd2('0x8')]=_[_0x9dd2('0x9')](_0x218f93,function(_0x2524a0){return _0x2524a0[_0x354b5d['field']];});}else{if(_0x4dfc33===_0x9dd2('0xd')){_0xc97fc4[_0x9dd2('0x8')]=_['map'](_0x218f93,function(_0x4d1188){return{'id':_0x4d1188[_0x9dd2('0xe')],'type':_0x4d1188[_0x9dd2('0xf')]};});}else{_0xc97fc4[_0x9dd2('0x8')]=_[_0x9dd2('0x9')](_0x218f93,function(_0x393f0b){return _0x393f0b[_0x9dd2('0xe')];});}}_0xeeb5eb(_0xc97fc4);})[_0x9dd2('0xa')](function(_0x4ec127){_0x407205(_0x4ec127);});});}function _0xef1e8(_0x46aba8,_0x3cb56f){var _0x5216c6={'parentSections':[]};switch(_0x46aba8[_0x9dd2('0x10')]()){case'squareprojects':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x12');break;case _0x9dd2('0x13'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x14');break;case'squarerecordings':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x15');_0x5216c6[_0x9dd2('0x16')]=[{'name':_0x9dd2('0x17'),'field':_0x9dd2('0x18'),'foreignKey':_0x9dd2('0x19')}];break;case _0x9dd2('0x1a'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x1b');break;case _0x9dd2('0x1c'):_0x5216c6['childModel']=_0x9dd2('0x1d');_0x5216c6[_0x9dd2('0x16')]=[{'name':_0x9dd2('0x1e'),'field':'id','foreignKey':_0x9dd2('0x1f')}];break;case _0x9dd2('0x20'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x21');break;case _0x9dd2('0x22'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x23');break;case _0x9dd2('0x24'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x25');break;case _0x9dd2('0x26'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x27');break;case'chatwebsites':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x28');break;case'faxqueues':_0x5216c6[_0x9dd2('0x11')]='FaxQueue';break;case _0x9dd2('0x29'):_0x5216c6[_0x9dd2('0x11')]='FaxAccount';break;case'inboundroutes':case _0x9dd2('0x2a'):case'outboundroutes':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x2b');break;case _0x9dd2('0x2c'):_0x5216c6[_0x9dd2('0x11')]='VoiceContext';break;case'voicemails':_0x5216c6['childModel']=_0x9dd2('0x2d');break;case'voicerecordings':_0x5216c6['childModel']=_0x9dd2('0x2e');_0x5216c6['parentSections']=[{'name':_0x9dd2('0x2f'),'field':_0x9dd2('0x18'),'foreignKey':_0x9dd2('0x30'),'model':_0x9dd2('0x31'),'filter':{'field':_0x9dd2('0x32'),'value':[_0x9dd2('0x33')]}},{'name':_0x9dd2('0x34'),'field':_0x9dd2('0x18'),'foreignKey':_0x9dd2('0x30'),'model':_0x9dd2('0x31'),'filter':{'field':'role','value':[_0x9dd2('0x35')]}},{'name':_0x9dd2('0x36'),'field':_0x9dd2('0x18'),'foreignKey':_0x9dd2('0x37'),'model':_0x9dd2('0x38'),'filter':{'field':_0x9dd2('0xf'),'value':[_0x9dd2('0x39')]}},{'name':_0x9dd2('0x3a'),'field':_0x9dd2('0x18'),'foreignKey':_0x9dd2('0x37'),'model':'VoiceQueue','filter':{'field':_0x9dd2('0xf'),'value':[_0x9dd2('0x3b')]}}];break;case _0x9dd2('0x3c'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x3d');break;case'chanspies':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x3e');break;case _0x9dd2('0x3f'):_0x5216c6['childModel']=_0x9dd2('0x40');break;case _0x9dd2('0x41'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x42');break;case _0x9dd2('0x43'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x44');break;case _0x9dd2('0x45'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x46');break;case _0x9dd2('0x47'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x48');break;case _0x9dd2('0x49'):_0x5216c6['childModel']=_0x9dd2('0x4a');break;case'openchannelaccounts':_0x5216c6['childModel']='OpenchannelAccount';break;case _0x9dd2('0x4b'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x4c');break;case'smsaccounts':_0x5216c6['childModel']='SmsAccount';break;case'whatsappqueues':_0x5216c6['childModel']=_0x9dd2('0x4d');break;case _0x9dd2('0x4e'):_0x5216c6[_0x9dd2('0x11')]='WhatsappAccount';break;case _0x9dd2('0x4f'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x50');break;case'voicequeues':case'queuecampaigns':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x38');if(_0x3cb56f){_0x5216c6[_0x9dd2('0x16')]=[{'name':_0x9dd2('0x36')},{'name':_0x9dd2('0x3a')}];}break;case'users':case'agents':case _0x9dd2('0x51'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x31');if(_0x3cb56f){_0x5216c6[_0x9dd2('0x16')]=[{'name':'Users','filter':{'field':_0x9dd2('0x32'),'value':[_0x9dd2('0x52'),'user']},'ignore':!![]},{'name':_0x9dd2('0x2f')},{'name':_0x9dd2('0x34')}];}break;case _0x9dd2('0x53'):_0x5216c6['childModel']=_0x9dd2('0x54');break;case _0x9dd2('0x55'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x56');break;case _0x9dd2('0x57'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x58');break;case'sugarcrmaccounts':_0x5216c6['childModel']=_0x9dd2('0x59');break;case _0x9dd2('0x5a'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x5b');break;case _0x9dd2('0x5c'):_0x5216c6['childModel']=_0x9dd2('0x5d');break;case _0x9dd2('0x5e'):_0x5216c6['childModel']='User';break;case _0x9dd2('0x5f'):_0x5216c6['childModel']='CannedAnswer';break;case _0x9dd2('0x60'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x61');break;case'customdashboards':_0x5216c6['childModel']=_0x9dd2('0x62');break;case _0x9dd2('0x63'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x64');break;case'pauses':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x65');break;case _0x9dd2('0x66'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x67');break;case _0x9dd2('0x68'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x69');break;case _0x9dd2('0x6a'):_0x5216c6['childModel']=_0x9dd2('0x6b');break;case _0x9dd2('0x6c'):_0x5216c6[_0x9dd2('0x11')]='Template';break;case _0x9dd2('0x6d'):_0x5216c6['childModel']=_0x9dd2('0x6e');break;case _0x9dd2('0x6f'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x70');break;case _0x9dd2('0x71'):_0x5216c6['childModel']=_0x9dd2('0x72');break;case _0x9dd2('0x73'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x74');break;case _0x9dd2('0x75'):_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0xd');_0x5216c6[_0x9dd2('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0x9dd2('0x76')}];break;case'metrics':_0x5216c6[_0x9dd2('0x11')]=_0x9dd2('0x77');break;}return _0x5216c6;}function _0x4daa69(_0x5e4051,_0x217bbc){var _0x4f317f=_0x5e4051[_0x9dd2('0x78')](0x0)[_0x9dd2('0x79')]()+_0x5e4051[_0x9dd2('0x7a')](0x1);var _0xdfa8a={'type':_0x302da0['Sequelize'][_0x9dd2('0x7b')][_0x9dd2('0x7c')],'raw':!![]};return new Promise(function(_0x5b3698,_0x5df63f){var _0x39ac8c=squel[_0x9dd2('0x7d')]()[_0x9dd2('0xb')](_0x9dd2('0x7e')+_0x4f317f+'InteractionId','id')['field'](_0x9dd2('0x7f'))['from']('user_has_'+_0x5e4051+_0x9dd2('0x80'),'ui')[_0x9dd2('0x81')](_0x9dd2('0x82'),_0x217bbc['id']);return _0x302da0[_0x9dd2('0x83')]['query'](_0x39ac8c[_0x9dd2('0x84')](),_0xdfa8a)[_0x9dd2('0x7')](function(_0x47fa88){_0x217bbc[_0x4f317f+_0x9dd2('0x85')]=_0x47fa88;_0x5b3698(_0x47fa88);})[_0x9dd2('0xa')](function(_0x24db3e){_0x5df63f(_0x24db3e);});});}return _0x55ccff[_0x9dd2('0x86')](_0x9dd2('0x87'),attributes,{'tableName':_0x9dd2('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x19769a){var _0x66e1c8=require(_0x9dd2('0x89'));var _0x4d4c0c={'raw':_0x19769a['query'][_0x9dd2('0x8a')],'where':{}};var _0x30d25e={};var _0x4e268d={'count':0x0,'rows':[]};var _0x2422e1=_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0x8c')];var _0x118c10=_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0x8d')]||![];var _0xb2e0fc=_0xef1e8(_0x2422e1,_0x118c10);if(!_0xb2e0fc['childModel'])throw new Error(_0x9dd2('0x8e')+_0x2422e1+'\x27');var _0x30cf7d=[{'name':_0x2422e1}];if(!_[_0x9dd2('0x8f')](_0xb2e0fc[_0x9dd2('0x16')]))_0x30cf7d=_0xb2e0fc[_0x9dd2('0x16')];var _0x432c2f=[];for(var _0x5d8b1a=0x0;_0x5d8b1a<_0x30cf7d[_0x9dd2('0x90')];_0x5d8b1a++){_0x432c2f[_0x9dd2('0x91')](_0x302da0[_0x9dd2('0x92')][_0x9dd2('0x93')]({'where':{'userProfileId':_0x19769a['params']['id'],'name':_0x30cf7d[_0x5d8b1a][_0x9dd2('0x18')]},'raw':!![]}));}return Promise[_0x9dd2('0x94')](_0x432c2f)[_0x9dd2('0x7')](function(_0x227b49){var _0x477ff2=_[_0x9dd2('0x4')](_0x227b49,function(_0x763b4e){return _0x763b4e?_0x763b4e:undefined;});var _0x5f1ae5=_[_0x9dd2('0x4')](_0x30cf7d,[_0x9dd2('0x95'),!![]]);var _0x29acc0=_[_0x9dd2('0x8f')](_0x477ff2)&&_[_0x9dd2('0x8f')](_0x5f1ae5)?null:_[_0x9dd2('0x96')](_0x5f1ae5,_0x477ff2);if(!_0x29acc0)return null;var _0x567b5e=[];for(var _0xe3e025=0x0;_0xe3e025<_0x29acc0['length'];_0xe3e025++){var _0x54d463=_[_0x9dd2('0x93')](_0x30cf7d,function(_0x24477e){return _0x29acc0[_0xe3e025]?_0x24477e[_0x9dd2('0x18')]===_0x29acc0[_0xe3e025][_0x9dd2('0x18')]:null;});if(_0x54d463){if(_0x29acc0[_0xe3e025][_0x9dd2('0x95')]){_0x567b5e[_0x9dd2('0x91')](_0xc5489f(_0xb2e0fc[_0x9dd2('0x11')],_0x29acc0[_0xe3e025]));}else{if(!_0x29acc0[_0xe3e025][_0x9dd2('0x97')]){_0x567b5e[_0x9dd2('0x91')](_0x2f18d3(_0x54d463,_0x29acc0[_0xe3e025],_0xb2e0fc[_0x9dd2('0x11')]));}else{if(_0x54d463['model']){_0x567b5e[_0x9dd2('0x91')](_0x2ec53c(_0x54d463,_0x29acc0[_0xe3e025]));}}}}}return Promise[_0x9dd2('0x94')](_0x567b5e);})[_0x9dd2('0x7')](function(_0x3c0650){var _0x27f975=_0x3c0650;var _0x3d62c1=null;if(_0x27f975){_0x3d62c1=_0x27f975['length']===0x1?_0x27f975[0x0]:null;}if(!_0x3d62c1&&!_0x27f975)return _0x4e268d;var _0x322580=_0x302da0[_0xb2e0fc[_0x9dd2('0x11')]][_0x9dd2('0x98')];_0x30d25e[_0x9dd2('0x99')]=_['keys'](_0x322580);_0x30d25e[_0x9dd2('0x8b')]=_[_0x9dd2('0x9a')](_0x19769a[_0x9dd2('0x8b')]);_0x30d25e['filters']=_[_0x9dd2('0x9b')](_0x30d25e[_0x9dd2('0x99')],_0x30d25e[_0x9dd2('0x8b')]);_0x4d4c0c[_0x9dd2('0x9c')]=_[_0x9dd2('0x9b')](_0x30d25e[_0x9dd2('0x99')],_0x66e1c8[_0x9dd2('0x9d')](_0x19769a['query'][_0x9dd2('0x9d')]));_0x4d4c0c[_0x9dd2('0x9c')]=_0x4d4c0c[_0x9dd2('0x9c')][_0x9dd2('0x90')]?_0x4d4c0c[_0x9dd2('0x9c')]:_0x30d25e[_0x9dd2('0x99')];if(!_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0x9e')]('nolimit')){_0x4d4c0c[_0x9dd2('0x9f')]=_0x66e1c8[_0x9dd2('0x9f')](_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0x9f')]);_0x4d4c0c[_0x9dd2('0xa0')]=_0x66e1c8[_0x9dd2('0xa0')](_0x19769a[_0x9dd2('0x8b')]['offset']);}_0x4d4c0c['order']=_0x66e1c8[_0x9dd2('0xa1')](_0x19769a['query'][_0x9dd2('0xa1')]);_0x4d4c0c[_0x9dd2('0x81')]=_0x66e1c8[_0x9dd2('0xa2')](_[_0x9dd2('0xa3')](_0x19769a[_0x9dd2('0x8b')],_0x30d25e[_0x9dd2('0xa2')]));if(_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0x4')]){_0x4d4c0c[_0x9dd2('0x81')]=_[_0x9dd2('0xa4')](_0x4d4c0c[_0x9dd2('0x81')],{'$or':_['map'](_0x322580,function(_0x19d68b){if(_0x19d68b[_0x9dd2('0xf')]['key']!==_0x9dd2('0xa5')){var _0x3ac016={};_0x3ac016[_0x19d68b['field']]={'$like':'%'+_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0x4')]+'%'};return _0x3ac016;}})});}var _0x545d61=[];var _0xcea26b=null;var _0x45b4c7={};if(_0x3d62c1){_0xcea26b=_[_0x9dd2('0x93')](_0x30cf7d,['name',_0x3d62c1[_0x9dd2('0x18')]]);if(_0xcea26b[_0x9dd2('0xb')]){_0x45b4c7={};if(_0xb2e0fc[_0x9dd2('0x11')]===_0x9dd2('0xd')){_0x45b4c7[_0xcea26b[_0x9dd2('0xa6')]]=_[_0x9dd2('0x9')](_0x3d62c1[_0x9dd2('0x8')],'id');}else{_0x45b4c7[_0xcea26b['foreignKey']]=_0x3d62c1['associatedResources'];}_0x545d61[_0x9dd2('0x91')](_0x45b4c7);}else{_0x4d4c0c[_0x9dd2('0x81')]['id']=_0x3d62c1[_0x9dd2('0x8')];}}else{for(var _0x14c3b9=0x0;_0x14c3b9<_0x27f975[_0x9dd2('0x90')];_0x14c3b9++){_0xcea26b=_[_0x9dd2('0x93')](_0x30cf7d,['name',_0x27f975[_0x14c3b9][_0x9dd2('0x18')]]);if(_0xcea26b['field']){_0x45b4c7={};_0x45b4c7[_0xcea26b[_0x9dd2('0xa6')]]=_0x27f975[_0x14c3b9][_0x9dd2('0x8')];_0x545d61['push'](_0x45b4c7);}else{if(!_0x4d4c0c[_0x9dd2('0x81')]['id'])_0x4d4c0c[_0x9dd2('0x81')]['id']=[];_0x27f975[_0x14c3b9]['associatedResources'][_0x9dd2('0xa7')](function(_0x53b45a){_0x4d4c0c[_0x9dd2('0x81')]['id'][_0x9dd2('0x91')](_0x53b45a);});}}}if(!_[_0x9dd2('0x8f')](_0x545d61)){_0x4d4c0c['where']=_[_0x9dd2('0xa4')](_0x4d4c0c[_0x9dd2('0x81')],{'$and':{'$or':_0x545d61}});}_0x4d4c0c=_[_0x9dd2('0xa4')]({},_0x4d4c0c,_0x19769a[_0x9dd2('0xa8')]);if(_0x3d62c1&&!_0x3d62c1[_0x9dd2('0x97')]&&_0xb2e0fc[_0x9dd2('0x11')]==='AnalyticExtractedReport'){if(_0x19769a[_0x9dd2('0x8b')]['includeAll']){_0x4d4c0c[_0x9dd2('0xa9')]=[{'all':!![]}];}return _0x302da0[_0xb2e0fc[_0x9dd2('0x11')]]['findAll'](_0x4d4c0c)[_0x9dd2('0x7')](function(_0xa14d9c){var _0x5cc3f2=[];_0xa14d9c['forEach'](function(_0x12a8ea){var _0x294d7e;switch(_0x12a8ea[_0x9dd2('0xaa')]){case _0x9dd2('0xab'):_0x294d7e=_['find'](_0x3d62c1[_0x9dd2('0x8')],function(_0x2c8179){return _0x2c8179['id']===_0x12a8ea[_0x9dd2('0x76')]&&_0x2c8179['type']===_0x9dd2('0xac');});break;case _0x9dd2('0xad'):_0x294d7e=_[_0x9dd2('0x93')](_0x3d62c1[_0x9dd2('0x8')],function(_0x2cfcd7){return _0x2cfcd7['id']===_0x12a8ea[_0x9dd2('0x76')]&&_0x2cfcd7[_0x9dd2('0xf')]==='CustomReports';});break;}if(_0x294d7e)_0x5cc3f2['push'](_0x12a8ea);});_0x4e268d[_0x9dd2('0xae')]=_0x5cc3f2['length'];_0x4e268d[_0x9dd2('0xaf')]=_0x5cc3f2;return _0x4e268d;});}else{if(!_[_0x9dd2('0x8f')](_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0xb0')])){_0x4d4c0c[_0x9dd2('0x81')]['id']=_0x4d4c0c['where']['id']?_['intersection'](_0x4d4c0c[_0x9dd2('0x81')]['id'],_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0xb0')]):_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0xb0')];if(_0x19769a['query'][_0x9dd2('0xb1')]){_0x4d4c0c['order']=_0x19769a[_0x9dd2('0x8b')]['customSorting'];}}if(_0x19769a[_0x9dd2('0x8b')]['extraQueryConditions']){_0x4d4c0c[_0x9dd2('0x81')]=_[_0x9dd2('0xa4')](_0x4d4c0c['where'],{'$and':_0x19769a['query'][_0x9dd2('0xb2')]});}return _0x302da0[_0xb2e0fc[_0x9dd2('0x11')]]['count']({'where':_0x4d4c0c[_0x9dd2('0x81')]})[_0x9dd2('0x7')](function(_0x234f1b){_0x4e268d['count']=_0x234f1b;if(_0x19769a[_0x9dd2('0x8b')]['includeAll']){if(_0xb2e0fc[_0x9dd2('0x11')]===_0x9dd2('0x1d')){_0x4d4c0c[_0x9dd2('0xa9')]=[{'model':_0x302da0['Tag'],'as':'Tags','attributes':['id',_0x9dd2('0x18'),_0x9dd2('0xb3')],'required':_0x19769a['query'][_0x9dd2('0xb4')]?!![]:![]},{'model':_0x302da0[_0x9dd2('0x6b')],'as':'ThroughTags','attributes':['id','name',_0x9dd2('0xb3')],'through':_0x19769a['query']['tag']?{'attributes':[],'where':{'TagId':_0x19769a[_0x9dd2('0x8b')][_0x9dd2('0xb4')]||undefined}}:{},'required':_0x19769a[_0x9dd2('0x8b')]['tag']?!![]:![]}];}else{_0x4d4c0c[_0x9dd2('0xa9')]=[{'all':!![]}];}}return _0x302da0[_0xb2e0fc['childModel']][_0x9dd2('0x6')](_0x4d4c0c);})[_0x9dd2('0x7')](function(_0x5a7456){_0x4e268d['rows']=_0x5a7456;if(_0x2422e1===_0x9dd2('0x2f')&&_0x19769a[_0x9dd2('0x8b')]['openTabs']===_0x9dd2('0xb5')){var _0x1d56a5=[];for(var _0x4bab16=0x0;_0x4bab16<_0x4e268d['rows'][_0x9dd2('0x90')];_0x4bab16++){_0x1d56a5[_0x9dd2('0x91')](_0x4daa69('chat',_0x4e268d['rows'][_0x4bab16][_0x9dd2('0xb6')]));_0x1d56a5[_0x9dd2('0x91')](_0x4daa69(_0x9dd2('0xb7'),_0x4e268d['rows'][_0x4bab16][_0x9dd2('0xb6')]));_0x1d56a5[_0x9dd2('0x91')](_0x4daa69(_0x9dd2('0xb8'),_0x4e268d[_0x9dd2('0xaf')][_0x4bab16][_0x9dd2('0xb6')]));_0x1d56a5[_0x9dd2('0x91')](_0x4daa69(_0x9dd2('0xb9'),_0x4e268d[_0x9dd2('0xaf')][_0x4bab16][_0x9dd2('0xb6')]));_0x1d56a5['push'](_0x4daa69(_0x9dd2('0xba'),_0x4e268d['rows'][_0x4bab16][_0x9dd2('0xb6')]));_0x1d56a5[_0x9dd2('0x91')](_0x4daa69('whatsapp',_0x4e268d[_0x9dd2('0xaf')][_0x4bab16][_0x9dd2('0xb6')]));}return Promise['all'](_0x1d56a5)[_0x9dd2('0x7')](function(){return _0x4e268d;});}return _0x4e268d;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f68ef6a..879979e 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 _0xe978=['error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe978,0x70));var _0x8e97=function(_0x25534c,_0x331667){_0x25534c=_0x25534c-0x0;var _0x36d6f7=_0xe978[_0x25534c];return _0x36d6f7;};'use strict';var _=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var moment=require(_0x8e97('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e97('0x3'));var db=require(_0x8e97('0x4'))['db'];var utils=require(_0x8e97('0x5'));var logger=require(_0x8e97('0x6'))(_0x8e97('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e97('0x8'));var client=jayson[_0x8e97('0x9')][_0x8e97('0xa')]({'port':0x232a});config[_0x8e97('0xb')]=_[_0x8e97('0xc')](config['redis'],{'host':_0x8e97('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e97('0xb')]));require(_0x8e97('0xe'))[_0x8e97('0xf')](socket);function respondWithRpcPromise(_0x515bc2,_0x3149de,_0x1d2aa1){return new BPromise(function(_0x4406ad,_0x37b212){return client[_0x8e97('0x10')](_0x515bc2,_0x1d2aa1)[_0x8e97('0x11')](function(_0xa97614){logger[_0x8e97('0x12')](_0x8e97('0x13'),_0x3149de,_0x8e97('0x14'));logger[_0x8e97('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3149de,_0x8e97('0x14'),JSON[_0x8e97('0x16')](_0xa97614));if(_0xa97614[_0x8e97('0x17')]){if(_0xa97614[_0x8e97('0x17')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x3149de,_0xa97614['error']['message']);return _0x37b212(_0xa97614['error'][_0x8e97('0x18')]);}logger['error'](_0x8e97('0x13'),_0x3149de,_0xa97614[_0x8e97('0x17')]['message']);return _0x4406ad(_0xa97614['error'][_0x8e97('0x18')]);}else{logger[_0x8e97('0x12')](_0x8e97('0x13'),_0x3149de,_0x8e97('0x14'));_0x4406ad(_0xa97614[_0x8e97('0x19')][_0x8e97('0x18')]);}})[_0x8e97('0x1a')](function(_0x2a0800){logger[_0x8e97('0x17')]('UserProfile,\x20%s,\x20%s',_0x3149de,_0x2a0800);_0x37b212(_0x2a0800);});});} \ No newline at end of file +var _0xb5f3=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userProfile.socket','register','request','then','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message'];(function(_0x1934a0,_0xcdb917){var _0x2cdd1c=function(_0x3294e4){while(--_0x3294e4){_0x1934a0['push'](_0x1934a0['shift']());}};_0x2cdd1c(++_0xcdb917);}(_0xb5f3,0x137));var _0x3b5f=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0xb5f3[_0x576e2b];return _0x46461a;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var moment=require(_0x3b5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b5f('0x3'));var fs=require('fs');var Redis=require(_0x3b5f('0x4'));var db=require(_0x3b5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b5f('0x6'));var config=require(_0x3b5f('0x7'));var jayson=require(_0x3b5f('0x8'));var client=jayson[_0x3b5f('0x9')]['http']({'port':0x232a});config[_0x3b5f('0xa')]=_[_0x3b5f('0xb')](config['redis'],{'host':_0x3b5f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b5f('0xa')]));require(_0x3b5f('0xd'))[_0x3b5f('0xe')](socket);function respondWithRpcPromise(_0xfa2a4d,_0x5f5a5f,_0x13be1a){return new BPromise(function(_0x3d33cb,_0x158ac9){return client[_0x3b5f('0xf')](_0xfa2a4d,_0x13be1a)[_0x3b5f('0x10')](function(_0x57267a){logger['info']('UserProfile,\x20%s,\x20%s',_0x5f5a5f,_0x3b5f('0x11'));logger[_0x3b5f('0x12')](_0x3b5f('0x13'),_0x5f5a5f,_0x3b5f('0x11'),JSON[_0x3b5f('0x14')](_0x57267a));if(_0x57267a[_0x3b5f('0x15')]){if(_0x57267a[_0x3b5f('0x15')][_0x3b5f('0x16')]===0x1f4){logger['error'](_0x3b5f('0x17'),_0x5f5a5f,_0x57267a[_0x3b5f('0x15')][_0x3b5f('0x18')]);return _0x158ac9(_0x57267a['error'][_0x3b5f('0x18')]);}logger['error'](_0x3b5f('0x17'),_0x5f5a5f,_0x57267a[_0x3b5f('0x15')]['message']);return _0x3d33cb(_0x57267a[_0x3b5f('0x15')][_0x3b5f('0x18')]);}else{logger[_0x3b5f('0x19')](_0x3b5f('0x17'),_0x5f5a5f,'request\x20sent');_0x3d33cb(_0x57267a[_0x3b5f('0x1a')]['message']);}})[_0x3b5f('0x1b')](function(_0x19d6fe){logger[_0x3b5f('0x15')]('UserProfile,\x20%s,\x20%s',_0x5f5a5f,_0x19d6fe);_0x158ac9(_0x19d6fe);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9e6fa61..d960442 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 _0xbf83=['save','remove','emit','removeListener','length','./userProfile.events'];(function(_0x1e06c0,_0x3c8d32){var _0x20a073=function(_0x5e370f){while(--_0x5e370f){_0x1e06c0['push'](_0x1e06c0['shift']());}};_0x20a073(++_0x3c8d32);}(_0xbf83,0x83));var _0x3bf8=function(_0x883339,_0x568895){_0x883339=_0x883339-0x0;var _0x3402f3=_0xbf83[_0x883339];return _0x3402f3;};'use strict';var UserProfileEvents=require(_0x3bf8('0x0'));var events=[_0x3bf8('0x1'),_0x3bf8('0x2'),'update'];function createListener(_0x22ca95,_0x7874ea){return function(_0x2f6143){_0x7874ea[_0x3bf8('0x3')](_0x22ca95,_0x2f6143);};}function removeListener(_0x2df77f,_0x1a1e59){return function(){UserProfileEvents[_0x3bf8('0x4')](_0x2df77f,_0x1a1e59);};}exports['register']=function(_0x5ab996){for(var _0x335d21=0x0,_0x54d85b=events[_0x3bf8('0x5')];_0x335d21<_0x54d85b;_0x335d21++){var _0xc6ab4a=events[_0x335d21];var _0xd8a3d2=createListener('userProfile:'+_0xc6ab4a,_0x5ab996);UserProfileEvents['on'](_0xc6ab4a,_0xd8a3d2);}}; \ No newline at end of file +var _0x30f5=['save','remove','update','removeListener','register','userProfile:','./userProfile.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30f5,0x1bf));var _0x530f=function(_0x3f560e,_0x289aa8){_0x3f560e=_0x3f560e-0x0;var _0x5bf213=_0x30f5[_0x3f560e];return _0x5bf213;};'use strict';var UserProfileEvents=require(_0x530f('0x0'));var events=[_0x530f('0x1'),_0x530f('0x2'),_0x530f('0x3')];function createListener(_0xf63afe,_0x41bab9){return function(_0x557ee2){_0x41bab9['emit'](_0xf63afe,_0x557ee2);};}function removeListener(_0x557d17,_0x117107){return function(){UserProfileEvents[_0x530f('0x4')](_0x557d17,_0x117107);};}exports[_0x530f('0x5')]=function(_0x18caf1){for(var _0x245169=0x0,_0x285a93=events['length'];_0x245169<_0x285a93;_0x245169++){var _0x5570a0=events[_0x245169];var _0x40a33a=createListener(_0x530f('0x6')+_0x5570a0,_0x18caf1);UserProfileEvents['on'](_0x5570a0,_0x40a33a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d0b1266..c15ec4d 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 _0x7ef2=['/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','describe'];(function(_0x3d0902,_0x39b8c5){var _0x302bf4=function(_0x2525a1){while(--_0x2525a1){_0x3d0902['push'](_0x3d0902['shift']());}};_0x302bf4(++_0x39b8c5);}(_0x7ef2,0x15d));var _0x27ef=function(_0x28e347,_0x2f66af){_0x28e347=_0x28e347-0x0;var _0x1d3cc9=_0x7ef2[_0x28e347];return _0x1d3cc9;};'use strict';var multer=require(_0x27ef('0x0'));var util=require('util');var path=require(_0x27ef('0x1'));var timeout=require(_0x27ef('0x2'));var express=require('express');var router=express[_0x27ef('0x3')]();var fs_extra=require(_0x27ef('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x27ef('0x5'));var controller=require(_0x27ef('0x6'));router['get']('/',auth[_0x27ef('0x7')](),controller[_0x27ef('0x8')]);router[_0x27ef('0x9')]('/describe',auth[_0x27ef('0x7')](),controller[_0x27ef('0xa')]);router[_0x27ef('0x9')](_0x27ef('0xb'),auth[_0x27ef('0x7')](),controller['show']);router[_0x27ef('0xc')]('/',auth['isAuthenticated'](),controller[_0x27ef('0xd')]);router['put'](_0x27ef('0xb'),auth['isAuthenticated'](),controller[_0x27ef('0xe')]);router[_0x27ef('0xf')](_0x27ef('0xb'),auth[_0x27ef('0x7')](),controller[_0x27ef('0x10')]);module[_0x27ef('0x11')]=router; \ No newline at end of file +var _0x53f0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3f553b,_0x49a9c2){var _0x183c4e=function(_0x873b22){while(--_0x873b22){_0x3f553b['push'](_0x3f553b['shift']());}};_0x183c4e(++_0x49a9c2);}(_0x53f0,0x14c));var _0x053f=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x53f0[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x053f('0x0'));var util=require(_0x053f('0x1'));var path=require(_0x053f('0x2'));var timeout=require(_0x053f('0x3'));var express=require(_0x053f('0x4'));var router=express[_0x053f('0x5')]();var fs_extra=require(_0x053f('0x6'));var auth=require(_0x053f('0x7'));var interaction=require(_0x053f('0x8'));var config=require(_0x053f('0x9'));var controller=require(_0x053f('0xa'));router[_0x053f('0xb')]('/',auth['isAuthenticated'](),controller[_0x053f('0xc')]);router[_0x053f('0xb')](_0x053f('0xd'),auth[_0x053f('0xe')](),controller[_0x053f('0xf')]);router[_0x053f('0xb')](_0x053f('0x10'),auth['isAuthenticated'](),controller[_0x053f('0x11')]);router[_0x053f('0x12')]('/',auth[_0x053f('0xe')](),controller[_0x053f('0x13')]);router[_0x053f('0x14')](_0x053f('0x10'),auth['isAuthenticated'](),controller[_0x053f('0x15')]);router['delete'](_0x053f('0x10'),auth[_0x053f('0xe')](),controller[_0x053f('0x16')]);module[_0x053f('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4d3f8c6..d1fb978 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 _0xccb4=['exports','STRING','INTEGER','sequelize'];(function(_0x58f2b6,_0x5af1c6){var _0x3a0d0b=function(_0x4be4be){while(--_0x4be4be){_0x58f2b6['push'](_0x58f2b6['shift']());}};_0x3a0d0b(++_0x5af1c6);}(_0xccb4,0x193));var _0x4ccb=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xccb4[_0xbf8ebe];return _0x1e25e8;};'use strict';var Sequelize=require(_0x4ccb('0x0'));module[_0x4ccb('0x1')]={'name':{'type':Sequelize[_0x4ccb('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4ccb('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc5b5=['STRING','sequelize','INTEGER'];(function(_0x429be1,_0x1dc9e7){var _0x4f68f5=function(_0x2bac9e){while(--_0x2bac9e){_0x429be1['push'](_0x429be1['shift']());}};_0x4f68f5(++_0x1dc9e7);}(_0xc5b5,0x15d));var _0x5c5b=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0xc5b5[_0x24c135];return _0x290c66;};'use strict';var Sequelize=require(_0x5c5b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5c5b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5c5b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index eb794c4..dafe99b 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 _0x1a37=['index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1a37[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file +var _0x4c60=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','UserProfileResource','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x497641,_0x5d4f64){var _0x3c355e=function(_0xb903f4){while(--_0xb903f4){_0x497641['push'](_0x497641['shift']());}};_0x3c355e(++_0x5d4f64);}(_0x4c60,0xc1));var _0x04c6=function(_0x4af4b3,_0x2512aa){_0x4af4b3=_0x4af4b3-0x0;var _0x3f6498=_0x4c60[_0x4af4b3];return _0x3f6498;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['UserProfileResource'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['UserProfileResource'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['UserProfileResource'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['UserProfileResource'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));};exports[_0x04c6('0x46')]=function(_0x1b8fa4,_0x160f91){return db[_0x04c6('0x27')][_0x04c6('0x46')]()[_0x04c6('0x1f')](respondWithResult(_0x160f91,null))[_0x04c6('0x3e')](handleError(_0x160f91,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 11af3c9..257374f 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 _0x398c=['bluebird','request-promise','path','rimraf','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','util','../../config/logger'];(function(_0x2ac9f1,_0x15ffee){var _0x521539=function(_0x99d050){while(--_0x99d050){_0x2ac9f1['push'](_0x2ac9f1['shift']());}};_0x521539(++_0x15ffee);}(_0x398c,0xbd));var _0xc398=function(_0x24003a,_0x4f4649){_0x24003a=_0x24003a-0x0;var _0x1d76b0=_0x398c[_0x24003a];return _0x1d76b0;};'use strict';var _=require(_0xc398('0x0'));var util=require(_0xc398('0x1'));var logger=require(_0xc398('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc398('0x3'));var rp=require(_0xc398('0x4'));var fs=require('fs');var path=require(_0xc398('0x5'));var rimraf=require(_0xc398('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xc398('0x7')]=function(_0x40ea25,_0x1cb96f){return _0x40ea25[_0xc398('0x8')](_0xc398('0x9'),attributes,{'tableName':_0xc398('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc398('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x533d=['rimraf','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x504f15,_0x5f0050){var _0x35c9cc=function(_0x3173a5){while(--_0x3173a5){_0x504f15['push'](_0x504f15['shift']());}};_0x35c9cc(++_0x5f0050);}(_0x533d,0x80));var _0xd533=function(_0x5a1e13,_0xff2238){_0x5a1e13=_0x5a1e13-0x0;var _0x248220=_0x533d[_0x5a1e13];return _0x248220;};'use strict';var _=require(_0xd533('0x0'));var util=require(_0xd533('0x1'));var logger=require(_0xd533('0x2'))(_0xd533('0x3'));var moment=require(_0xd533('0x4'));var BPromise=require(_0xd533('0x5'));var rp=require(_0xd533('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd533('0x7'));var config=require('../../config/environment');var attributes=require(_0xd533('0x8'));module[_0xd533('0x9')]=function(_0x55e2f5,_0x55be6f){return _0x55e2f5[_0xd533('0xa')]('UserProfileResource',attributes,{'tableName':_0xd533('0xb'),'paranoid':![],'indexes':[{'name':_0xd533('0xc'),'fields':[_0xd533('0xd'),_0xd533('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 2348e7e..61e4b83 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 _0x5225=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x5225,0x1c5));var _0x5522=function(_0x2665a3,_0x3bac99){_0x2665a3=_0x2665a3-0x0;var _0x586de6=_0x5225[_0x2665a3];return _0x586de6;};'use strict';var _=require(_0x5522('0x0'));var util=require(_0x5522('0x1'));var moment=require('moment');var BPromise=require(_0x5522('0x2'));var rs=require(_0x5522('0x3'));var fs=require('fs');var Redis=require(_0x5522('0x4'));var db=require(_0x5522('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5522('0x6'))(_0x5522('0x7'));var config=require(_0x5522('0x8'));var jayson=require(_0x5522('0x9'));var client=jayson[_0x5522('0xa')][_0x5522('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401066,_0x2c028e,_0x236729){return new BPromise(function(_0x454501,_0x18bffa){return client['request'](_0x401066,_0x236729)[_0x5522('0xc')](function(_0x11b701){logger[_0x5522('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x2c028e,_0x5522('0xe'));logger[_0x5522('0xf')](_0x5522('0x10'),_0x2c028e,_0x5522('0xe'),JSON[_0x5522('0x11')](_0x11b701));if(_0x11b701[_0x5522('0x12')]){if(_0x11b701['error'][_0x5522('0x13')]===0x1f4){logger['error'](_0x5522('0x14'),_0x2c028e,_0x11b701[_0x5522('0x12')]['message']);return _0x18bffa(_0x11b701[_0x5522('0x12')][_0x5522('0x15')]);}logger['error'](_0x5522('0x14'),_0x2c028e,_0x11b701[_0x5522('0x12')]['message']);return _0x454501(_0x11b701[_0x5522('0x12')][_0x5522('0x15')]);}else{logger[_0x5522('0xd')](_0x5522('0x14'),_0x2c028e,_0x5522('0xe'));_0x454501(_0x11b701[_0x5522('0x16')][_0x5522('0x15')]);}})[_0x5522('0x17')](function(_0x30faee){logger[_0x5522('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x2c028e,_0x30faee);_0x18bffa(_0x30faee);});});} \ No newline at end of file +var _0x9237=['client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x42db23,_0x498af6){var _0x3c8aab=function(_0x4a64ea){while(--_0x4a64ea){_0x42db23['push'](_0x42db23['shift']());}};_0x3c8aab(++_0x498af6);}(_0x9237,0x1b0));var _0x7923=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x9237[_0x2c9b79];return _0x265032;};'use strict';var _=require(_0x7923('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7923('0x1'));var rs=require(_0x7923('0x2'));var fs=require('fs');var Redis=require(_0x7923('0x3'));var db=require(_0x7923('0x4'))['db'];var utils=require(_0x7923('0x5'));var logger=require('../../config/logger')(_0x7923('0x6'));var config=require(_0x7923('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7923('0x8')][_0x7923('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110cee,_0x1a014d,_0x1370ac){return new BPromise(function(_0x23bc6a,_0x227c47){return client[_0x7923('0xa')](_0x110cee,_0x1370ac)[_0x7923('0xb')](function(_0x43e53f){logger['info'](_0x7923('0xc'),_0x1a014d,_0x7923('0xd'));logger['debug'](_0x7923('0xe'),_0x1a014d,'request\x20sent',JSON['stringify'](_0x43e53f));if(_0x43e53f[_0x7923('0xf')]){if(_0x43e53f[_0x7923('0xf')][_0x7923('0x10')]===0x1f4){logger[_0x7923('0xf')](_0x7923('0xc'),_0x1a014d,_0x43e53f[_0x7923('0xf')][_0x7923('0x11')]);return _0x227c47(_0x43e53f[_0x7923('0xf')][_0x7923('0x11')]);}logger[_0x7923('0xf')](_0x7923('0xc'),_0x1a014d,_0x43e53f[_0x7923('0xf')][_0x7923('0x11')]);return _0x23bc6a(_0x43e53f[_0x7923('0xf')]['message']);}else{logger[_0x7923('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x1a014d,'request\x20sent');_0x23bc6a(_0x43e53f['result']['message']);}})[_0x7923('0x13')](function(_0x3fceaf){logger['error'](_0x7923('0xc'),_0x1a014d,_0x3fceaf);_0x227c47(_0x3fceaf);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 49c0f66..d483073 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 _0x9129=['put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x9129,0xd5));var _0x9912=function(_0x298152,_0x2bab07){_0x298152=_0x298152-0x0;var _0x58117d=_0x9129[_0x298152];return _0x58117d;};'use strict';var multer=require(_0x9912('0x0'));var util=require('util');var path=require(_0x9912('0x1'));var timeout=require(_0x9912('0x2'));var express=require(_0x9912('0x3'));var router=express[_0x9912('0x4')]();var fs_extra=require(_0x9912('0x5'));var auth=require(_0x9912('0x6'));var interaction=require(_0x9912('0x7'));var config=require(_0x9912('0x8'));var controller=require(_0x9912('0x9'));router['get']('/',auth[_0x9912('0xa')](),controller[_0x9912('0xb')]);router[_0x9912('0xc')](_0x9912('0xd'),auth[_0x9912('0xa')](),controller[_0x9912('0xe')]);router[_0x9912('0xc')](_0x9912('0xf'),auth[_0x9912('0xa')](),controller['show']);router[_0x9912('0x10')]('/',auth['isAuthenticated'](),controller[_0x9912('0x11')]);router[_0x9912('0x12')](_0x9912('0xf'),auth[_0x9912('0xa')](),controller[_0x9912('0x13')]);router['delete']('/:id',auth[_0x9912('0xa')](),controller[_0x9912('0x14')]);module['exports']=router; \ No newline at end of file +var _0x90df=['describe','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x489618,_0x233987){var _0x3d34b8=function(_0xe4ffd0){while(--_0xe4ffd0){_0x489618['push'](_0x489618['shift']());}};_0x3d34b8(++_0x233987);}(_0x90df,0x106));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf90d('0x0'));var util=require(_0xf90d('0x1'));var path=require(_0xf90d('0x2'));var timeout=require(_0xf90d('0x3'));var express=require('express');var router=express[_0xf90d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf90d('0x5'));var config=require(_0xf90d('0x6'));var controller=require('./userProfileSection.controller');router[_0xf90d('0x7')]('/',auth[_0xf90d('0x8')](),controller['index']);router[_0xf90d('0x7')](_0xf90d('0x9'),auth['isAuthenticated'](),controller[_0xf90d('0xa')]);router[_0xf90d('0x7')](_0xf90d('0xb'),auth['isAuthenticated'](),controller[_0xf90d('0xc')]);router['post']('/',auth[_0xf90d('0x8')](),controller[_0xf90d('0xd')]);router['put']('/:id',auth[_0xf90d('0x8')](),controller[_0xf90d('0xe')]);router[_0xf90d('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf90d('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 9c917b4..6810be8 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 _0xe2cf=['crudPermissions','join','getDataValue','exports','STRING','BOOLEAN'];(function(_0x4f235f,_0x350745){var _0x347fe9=function(_0x1f8e84){while(--_0x1f8e84){_0x4f235f['push'](_0x4f235f['shift']());}};_0x347fe9(++_0x350745);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x566622,_0x399507){_0x566622=_0x566622-0x0;var _0x1851dd=_0xe2cf[_0x566622];return _0x1851dd;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xfe2c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfe2c('0x1')],'set':function(_0x11b6b8){this['setDataValue'](_0xfe2c('0x3'),_0x11b6b8?_0x11b6b8[_0xfe2c('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xfe2c('0x5')](_0xfe2c('0x3'))['split'](''):[];}}}; \ No newline at end of file +var _0xbfcc=['split','sequelize','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xbfcc[_0x4d674b];return _0x535a1f;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xcbfc('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xcbfc('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x59b1de){this['setDataValue']('crudPermissions',_0x59b1de?_0x59b1de[_0xcbfc('0x4')](''):[]);},'get':function(){return this[_0xcbfc('0x5')]('crudPermissions')?this[_0xcbfc('0x5')]('crudPermissions')[_0xcbfc('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 131240d..c1780be 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 _0x5525=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x4609d0,_0x4b671a){var _0x3d3940=function(_0x3c3d27){while(--_0x3c3d27){_0x4609d0['push'](_0x4609d0['shift']());}};_0x3d3940(++_0x4b671a);}(_0x5525,0x163));var _0x5552=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5525[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5552('0x0'));var zipdir=require(_0x5552('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5552('0x2'));var BPromise=require(_0x5552('0x3'));var Mustache=require(_0x5552('0x4'));var util=require(_0x5552('0x5'));var path=require(_0x5552('0x6'));var sox=require('sox');var csv=require(_0x5552('0x7'));var ejs=require(_0x5552('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5552('0x9'));var squel=require(_0x5552('0xa'));var crypto=require('crypto');var jsforce=require(_0x5552('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5552('0x7'));var querystring=require(_0x5552('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5552('0xd'));var qs=require(_0x5552('0xe'));var as=require(_0x5552('0xf'));var hardwareService=require(_0x5552('0x10'));var logger=require(_0x5552('0x11'))(_0x5552('0x12'));var utils=require(_0x5552('0x13'));var config=require(_0x5552('0x14'));var licenseUtil=require(_0x5552('0x15'));var db=require(_0x5552('0x16'))['db'];function respondWithStatusCode(_0x21072f,_0x234241){_0x234241=_0x234241||0xcc;return function(_0x166234){if(_0x166234){return _0x21072f[_0x5552('0x17')](_0x234241);}return _0x21072f[_0x5552('0x18')](_0x234241)[_0x5552('0x19')]();};}function respondWithResult(_0x3f2317,_0x1ad47e){_0x1ad47e=_0x1ad47e||0xc8;return function(_0x3f12a3){if(_0x3f12a3){return _0x3f2317[_0x5552('0x18')](_0x1ad47e)[_0x5552('0x1a')](_0x3f12a3);}};}function respondWithFilteredResult(_0x243adf,_0x2efc58){return function(_0x4373c7){if(_0x4373c7){var _0x45739d=typeof _0x2efc58[_0x5552('0x1b')]==='undefined'&&typeof _0x2efc58[_0x5552('0x1c')]===_0x5552('0x1d');var _0x55d2c9=_0x4373c7[_0x5552('0x1e')];var _0x484982=_0x45739d?0x0:_0x2efc58[_0x5552('0x1b')];var _0x588e19=_0x45739d?_0x4373c7[_0x5552('0x1e')]:_0x2efc58[_0x5552('0x1b')]+_0x2efc58[_0x5552('0x1c')];var _0x2ae7be;if(_0x588e19>=_0x55d2c9){_0x588e19=_0x55d2c9;_0x2ae7be=0xc8;}else{_0x2ae7be=0xce;}_0x243adf[_0x5552('0x18')](_0x2ae7be);return _0x243adf[_0x5552('0x1f')](_0x5552('0x20'),_0x484982+'-'+_0x588e19+'/'+_0x55d2c9)[_0x5552('0x1a')](_0x4373c7);}return null;};}function patchUpdates(_0x21a629){return function(_0x15a717){try{jsonpatch[_0x5552('0x21')](_0x15a717,_0x21a629,!![]);}catch(_0x8e9817){return BPromise['reject'](_0x8e9817);}return _0x15a717[_0x5552('0x22')]();};}function saveUpdates(_0x306f6b,_0x3d1115){return function(_0x46c486){if(_0x46c486){return _0x46c486[_0x5552('0x23')](_0x306f6b)[_0x5552('0x24')](function(_0x2c34bb){return _0x2c34bb;});}return null;};}function removeEntity(_0x288df2,_0x3643ec){return function(_0x2d4c49){if(_0x2d4c49){return _0x2d4c49['destroy']()['then'](function(){_0x288df2['status'](0xcc)[_0x5552('0x19')]();});}};}function handleEntityNotFound(_0x283e82,_0x125175){return function(_0x4b39f5){if(!_0x4b39f5){_0x283e82['sendStatus'](0x194);}return _0x4b39f5;};}function handleError(_0x5f5c8e,_0x453d78){_0x453d78=_0x453d78||0x1f4;return function(_0x1ba236){logger[_0x5552('0x25')](_0x1ba236[_0x5552('0x26')]);if(_0x1ba236[_0x5552('0x27')]){delete _0x1ba236['name'];}_0x5f5c8e[_0x5552('0x18')](_0x453d78)[_0x5552('0x28')](_0x1ba236);};}exports[_0x5552('0x29')]=function(_0x51cf17,_0x594845){var _0x4cbf1a={},_0x279896={},_0x7a4f10={'count':0x0,'rows':[]};var _0x339494=_['map'](db[_0x5552('0x2a')][_0x5552('0x2b')],function(_0x167d36){return{'name':_0x167d36[_0x5552('0x2c')],'type':_0x167d36['type'][_0x5552('0x2d')]};});_0x279896[_0x5552('0x2e')]=_[_0x5552('0x2f')](_0x339494,_0x5552('0x27'));_0x279896[_0x5552('0x30')]=_[_0x5552('0x31')](_0x51cf17[_0x5552('0x30')]);_0x279896['filters']=_[_0x5552('0x32')](_0x279896[_0x5552('0x2e')],_0x279896[_0x5552('0x30')]);_0x4cbf1a[_0x5552('0x33')]=_['intersection'](_0x279896[_0x5552('0x2e')],qs['fields'](_0x51cf17[_0x5552('0x30')]['fields']));_0x4cbf1a[_0x5552('0x33')]=_0x4cbf1a[_0x5552('0x33')]['length']?_0x4cbf1a[_0x5552('0x33')]:_0x279896[_0x5552('0x2e')];if(!_0x51cf17[_0x5552('0x30')]['hasOwnProperty']('nolimit')){_0x4cbf1a[_0x5552('0x1c')]=qs[_0x5552('0x1c')](_0x51cf17['query'][_0x5552('0x1c')]);_0x4cbf1a[_0x5552('0x1b')]=qs['offset'](_0x51cf17[_0x5552('0x30')][_0x5552('0x1b')]);}_0x4cbf1a[_0x5552('0x34')]=qs['sort'](_0x51cf17['query'][_0x5552('0x35')]);_0x4cbf1a['where']=qs[_0x5552('0x36')](_[_0x5552('0x37')](_0x51cf17['query'],_0x279896['filters']),_0x339494);if(_0x51cf17['query'][_0x5552('0x38')]){_0x4cbf1a['where']=_['merge'](_0x4cbf1a[_0x5552('0x39')],{'$or':_[_0x5552('0x2f')](_0x339494,function(_0x401cd5){if(_0x401cd5[_0x5552('0x3a')]!==_0x5552('0x3b')){var _0x914f0a={};_0x914f0a[_0x401cd5['name']]={'$like':'%'+_0x51cf17[_0x5552('0x30')]['filter']+'%'};return _0x914f0a;}})});}_0x4cbf1a=_[_0x5552('0x3c')]({},_0x4cbf1a,_0x51cf17[_0x5552('0x3d')]);var _0x3eb9bf={'where':_0x4cbf1a[_0x5552('0x39')]};return db[_0x5552('0x2a')][_0x5552('0x1e')](_0x3eb9bf)[_0x5552('0x24')](function(_0x27aa5c){_0x7a4f10[_0x5552('0x1e')]=_0x27aa5c;if(_0x51cf17[_0x5552('0x30')][_0x5552('0x3e')]){_0x4cbf1a[_0x5552('0x3f')]=[{'all':!![]}];}return db['UserProfileSection'][_0x5552('0x40')](_0x4cbf1a);})['then'](function(_0x3ec1dc){_0x7a4f10[_0x5552('0x41')]=_0x3ec1dc;return _0x7a4f10;})[_0x5552('0x24')](respondWithFilteredResult(_0x594845,_0x4cbf1a))[_0x5552('0x42')](handleError(_0x594845,null));};exports['show']=function(_0x20c603,_0x5ed605){var _0x56e537={'raw':![],'where':{'id':_0x20c603[_0x5552('0x43')]['id']}},_0x596b30={};_0x596b30['model']=_[_0x5552('0x31')](db[_0x5552('0x2a')][_0x5552('0x2b')]);_0x596b30[_0x5552('0x30')]=_[_0x5552('0x31')](_0x20c603['query']);_0x596b30[_0x5552('0x36')]=_['intersection'](_0x596b30[_0x5552('0x2e')],_0x596b30[_0x5552('0x30')]);_0x56e537[_0x5552('0x33')]=_['intersection'](_0x596b30[_0x5552('0x2e')],qs[_0x5552('0x44')](_0x20c603['query']['fields']));_0x56e537[_0x5552('0x33')]=_0x56e537[_0x5552('0x33')][_0x5552('0x45')]?_0x56e537[_0x5552('0x33')]:_0x596b30[_0x5552('0x2e')];if(_0x20c603[_0x5552('0x30')]['includeAll']){_0x56e537[_0x5552('0x3f')]=[{'all':!![]}];}_0x56e537=_['merge']({},_0x56e537,_0x20c603['options']);return db['UserProfileSection'][_0x5552('0x46')](_0x56e537)[_0x5552('0x24')](handleEntityNotFound(_0x5ed605,null))[_0x5552('0x24')](respondWithResult(_0x5ed605,null))[_0x5552('0x42')](handleError(_0x5ed605,null));};exports[_0x5552('0x47')]=function(_0x2455e9,_0x525673){return db[_0x5552('0x2a')][_0x5552('0x47')](_0x2455e9[_0x5552('0x48')],{})[_0x5552('0x24')](respondWithResult(_0x525673,0xc9))[_0x5552('0x42')](handleError(_0x525673,null));};exports[_0x5552('0x23')]=function(_0x3b3418,_0x55e83d){if(_0x3b3418['body']['id']){delete _0x3b3418['body']['id'];}return db[_0x5552('0x2a')][_0x5552('0x46')]({'where':{'id':_0x3b3418[_0x5552('0x43')]['id']}})[_0x5552('0x24')](handleEntityNotFound(_0x55e83d,null))[_0x5552('0x24')](saveUpdates(_0x3b3418[_0x5552('0x48')],null))[_0x5552('0x24')](respondWithResult(_0x55e83d,null))['catch'](handleError(_0x55e83d,null));};exports['destroy']=function(_0x336063,_0x2fc519){return db[_0x5552('0x2a')][_0x5552('0x46')]({'where':{'id':_0x336063[_0x5552('0x43')]['id']}})[_0x5552('0x24')](handleEntityNotFound(_0x2fc519,null))[_0x5552('0x24')](removeEntity(_0x2fc519,null))[_0x5552('0x42')](handleError(_0x2fc519,null));};exports[_0x5552('0x49')]=function(_0x24ad8c,_0x347a7c){return db[_0x5552('0x2a')][_0x5552('0x49')]()[_0x5552('0x24')](respondWithResult(_0x347a7c,null))[_0x5552('0x42')](handleError(_0x347a7c,null));}; \ No newline at end of file +var _0x8df4=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','UserProfileSection','includeAll','include','rows','catch','show','params','rawAttributes','options','find','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0xdae520,_0x5cb070){var _0x21f40a=function(_0x153d31){while(--_0x153d31){_0xdae520['push'](_0xdae520['shift']());}};_0x21f40a(++_0x5cb070);}(_0x8df4,0x90));var _0x48df=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x8df4[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48df('0x0'));var zipdir=require(_0x48df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48df('0x2'));var moment=require(_0x48df('0x3'));var BPromise=require(_0x48df('0x4'));var Mustache=require(_0x48df('0x5'));var util=require(_0x48df('0x6'));var path=require(_0x48df('0x7'));var sox=require(_0x48df('0x8'));var csv=require(_0x48df('0x9'));var ejs=require(_0x48df('0xa'));var fs=require('fs');var fs_extra=require(_0x48df('0xb'));var _=require(_0x48df('0xc'));var squel=require('squel');var crypto=require(_0x48df('0xd'));var jsforce=require(_0x48df('0xe'));var deskjs=require(_0x48df('0xf'));var toCsv=require(_0x48df('0x9'));var querystring=require(_0x48df('0x10'));var Papa=require(_0x48df('0x11'));var Redis=require('ioredis');var authService=require(_0x48df('0x12'));var qs=require(_0x48df('0x13'));var as=require(_0x48df('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x48df('0x15'));var utils=require(_0x48df('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x48df('0x17'));var db=require(_0x48df('0x18'))['db'];function respondWithStatusCode(_0x4566c2,_0x593487){_0x593487=_0x593487||0xcc;return function(_0x10fc57){if(_0x10fc57){return _0x4566c2['sendStatus'](_0x593487);}return _0x4566c2[_0x48df('0x19')](_0x593487)[_0x48df('0x1a')]();};}function respondWithResult(_0x123672,_0x58c6a2){_0x58c6a2=_0x58c6a2||0xc8;return function(_0x499a3c){if(_0x499a3c){return _0x123672[_0x48df('0x19')](_0x58c6a2)[_0x48df('0x1b')](_0x499a3c);}};}function respondWithFilteredResult(_0x2f1979,_0x4e3941){return function(_0x4ddb6f){if(_0x4ddb6f){var _0x23124d=typeof _0x4e3941[_0x48df('0x1c')]===_0x48df('0x1d')&&typeof _0x4e3941[_0x48df('0x1e')]===_0x48df('0x1d');var _0x496efe=_0x4ddb6f[_0x48df('0x1f')];var _0x5e8582=_0x23124d?0x0:_0x4e3941[_0x48df('0x1c')];var _0x2e20a7=_0x23124d?_0x4ddb6f['count']:_0x4e3941['offset']+_0x4e3941['limit'];var _0x3d0554;if(_0x2e20a7>=_0x496efe){_0x2e20a7=_0x496efe;_0x3d0554=0xc8;}else{_0x3d0554=0xce;}_0x2f1979['status'](_0x3d0554);return _0x2f1979[_0x48df('0x20')](_0x48df('0x21'),_0x5e8582+'-'+_0x2e20a7+'/'+_0x496efe)[_0x48df('0x1b')](_0x4ddb6f);}return null;};}function patchUpdates(_0x4eec60){return function(_0x3f7c7c){try{jsonpatch[_0x48df('0x22')](_0x3f7c7c,_0x4eec60,!![]);}catch(_0x590eed){return BPromise[_0x48df('0x23')](_0x590eed);}return _0x3f7c7c['save']();};}function saveUpdates(_0x45b500,_0x4be1ac){return function(_0x288df8){if(_0x288df8){return _0x288df8[_0x48df('0x24')](_0x45b500)[_0x48df('0x25')](function(_0x27363a){return _0x27363a;});}return null;};}function removeEntity(_0x441bbb,_0x1a4423){return function(_0x2aed45){if(_0x2aed45){return _0x2aed45[_0x48df('0x26')]()[_0x48df('0x25')](function(){_0x441bbb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420197,_0x26a232){return function(_0x3f64fc){if(!_0x3f64fc){_0x420197['sendStatus'](0x194);}return _0x3f64fc;};}function handleError(_0x32a057,_0x46ae07){_0x46ae07=_0x46ae07||0x1f4;return function(_0x29851c){logger[_0x48df('0x27')](_0x29851c[_0x48df('0x28')]);if(_0x29851c[_0x48df('0x29')]){delete _0x29851c[_0x48df('0x29')];}_0x32a057[_0x48df('0x19')](_0x46ae07)[_0x48df('0x2a')](_0x29851c);};}exports['index']=function(_0xd1f83a,_0x2c942c){var _0x31342a={},_0x5919d0={},_0x1970aa={'count':0x0,'rows':[]};var _0x1688b7=_[_0x48df('0x2b')](db['UserProfileSection']['rawAttributes'],function(_0x50c0b4){return{'name':_0x50c0b4[_0x48df('0x2c')],'type':_0x50c0b4[_0x48df('0x2d')][_0x48df('0x2e')]};});_0x5919d0['model']=_[_0x48df('0x2b')](_0x1688b7,'name');_0x5919d0[_0x48df('0x2f')]=_[_0x48df('0x30')](_0xd1f83a['query']);_0x5919d0[_0x48df('0x31')]=_[_0x48df('0x32')](_0x5919d0[_0x48df('0x33')],_0x5919d0[_0x48df('0x2f')]);_0x31342a['attributes']=_['intersection'](_0x5919d0[_0x48df('0x33')],qs[_0x48df('0x34')](_0xd1f83a[_0x48df('0x2f')][_0x48df('0x34')]));_0x31342a[_0x48df('0x35')]=_0x31342a[_0x48df('0x35')][_0x48df('0x36')]?_0x31342a[_0x48df('0x35')]:_0x5919d0[_0x48df('0x33')];if(!_0xd1f83a[_0x48df('0x2f')][_0x48df('0x37')](_0x48df('0x38'))){_0x31342a[_0x48df('0x1e')]=qs[_0x48df('0x1e')](_0xd1f83a[_0x48df('0x2f')][_0x48df('0x1e')]);_0x31342a[_0x48df('0x1c')]=qs[_0x48df('0x1c')](_0xd1f83a[_0x48df('0x2f')][_0x48df('0x1c')]);}_0x31342a['order']=qs[_0x48df('0x39')](_0xd1f83a['query'][_0x48df('0x39')]);_0x31342a['where']=qs['filters'](_[_0x48df('0x3a')](_0xd1f83a[_0x48df('0x2f')],_0x5919d0['filters']),_0x1688b7);if(_0xd1f83a[_0x48df('0x2f')][_0x48df('0x3b')]){_0x31342a[_0x48df('0x3c')]=_[_0x48df('0x3d')](_0x31342a[_0x48df('0x3c')],{'$or':_[_0x48df('0x2b')](_0x1688b7,function(_0x3f5e56){if(_0x3f5e56[_0x48df('0x2d')]!==_0x48df('0x3e')){var _0x3c46a4={};_0x3c46a4[_0x3f5e56[_0x48df('0x29')]]={'$like':'%'+_0xd1f83a[_0x48df('0x2f')][_0x48df('0x3b')]+'%'};return _0x3c46a4;}})});}_0x31342a=_[_0x48df('0x3d')]({},_0x31342a,_0xd1f83a['options']);var _0x344714={'where':_0x31342a[_0x48df('0x3c')]};return db[_0x48df('0x3f')]['count'](_0x344714)[_0x48df('0x25')](function(_0x3fa592){_0x1970aa[_0x48df('0x1f')]=_0x3fa592;if(_0xd1f83a[_0x48df('0x2f')][_0x48df('0x40')]){_0x31342a[_0x48df('0x41')]=[{'all':!![]}];}return db[_0x48df('0x3f')]['findAll'](_0x31342a);})[_0x48df('0x25')](function(_0x22d7ae){_0x1970aa[_0x48df('0x42')]=_0x22d7ae;return _0x1970aa;})[_0x48df('0x25')](respondWithFilteredResult(_0x2c942c,_0x31342a))[_0x48df('0x43')](handleError(_0x2c942c,null));};exports[_0x48df('0x44')]=function(_0x4d6bc8,_0x3d287f){var _0x534c41={'raw':![],'where':{'id':_0x4d6bc8[_0x48df('0x45')]['id']}},_0x379e61={};_0x379e61[_0x48df('0x33')]=_[_0x48df('0x30')](db['UserProfileSection'][_0x48df('0x46')]);_0x379e61['query']=_['keys'](_0x4d6bc8[_0x48df('0x2f')]);_0x379e61[_0x48df('0x31')]=_[_0x48df('0x32')](_0x379e61[_0x48df('0x33')],_0x379e61[_0x48df('0x2f')]);_0x534c41[_0x48df('0x35')]=_['intersection'](_0x379e61[_0x48df('0x33')],qs['fields'](_0x4d6bc8[_0x48df('0x2f')][_0x48df('0x34')]));_0x534c41[_0x48df('0x35')]=_0x534c41['attributes'][_0x48df('0x36')]?_0x534c41[_0x48df('0x35')]:_0x379e61[_0x48df('0x33')];if(_0x4d6bc8[_0x48df('0x2f')]['includeAll']){_0x534c41[_0x48df('0x41')]=[{'all':!![]}];}_0x534c41=_[_0x48df('0x3d')]({},_0x534c41,_0x4d6bc8[_0x48df('0x47')]);return db[_0x48df('0x3f')][_0x48df('0x48')](_0x534c41)[_0x48df('0x25')](handleEntityNotFound(_0x3d287f,null))[_0x48df('0x25')](respondWithResult(_0x3d287f,null))[_0x48df('0x43')](handleError(_0x3d287f,null));};exports['create']=function(_0xa52bca,_0x483be4){return db['UserProfileSection']['create'](_0xa52bca['body'],{})[_0x48df('0x25')](respondWithResult(_0x483be4,0xc9))[_0x48df('0x43')](handleError(_0x483be4,null));};exports[_0x48df('0x24')]=function(_0x2f4d8d,_0x28fd17){if(_0x2f4d8d['body']['id']){delete _0x2f4d8d[_0x48df('0x49')]['id'];}return db['UserProfileSection'][_0x48df('0x48')]({'where':{'id':_0x2f4d8d['params']['id']}})[_0x48df('0x25')](handleEntityNotFound(_0x28fd17,null))[_0x48df('0x25')](saveUpdates(_0x2f4d8d[_0x48df('0x49')],null))[_0x48df('0x25')](respondWithResult(_0x28fd17,null))['catch'](handleError(_0x28fd17,null));};exports[_0x48df('0x26')]=function(_0x8a6b7,_0x1a4f36){return db[_0x48df('0x3f')][_0x48df('0x48')]({'where':{'id':_0x8a6b7['params']['id']}})[_0x48df('0x25')](handleEntityNotFound(_0x1a4f36,null))[_0x48df('0x25')](removeEntity(_0x1a4f36,null))['catch'](handleError(_0x1a4f36,null));};exports[_0x48df('0x4a')]=function(_0x24f082,_0x2dd22d){return db[_0x48df('0x3f')][_0x48df('0x4a')]()[_0x48df('0x25')](respondWithResult(_0x2dd22d,null))[_0x48df('0x43')](handleError(_0x2dd22d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 071a993..0e8ef07 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 _0xdca1=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x84cae6,_0x9e11a4){var _0x40abc1=function(_0x1575d6){while(--_0x1575d6){_0x84cae6['push'](_0x84cae6['shift']());}};_0x40abc1(++_0x9e11a4);}(_0xdca1,0x171));var _0x1dca=function(_0x38fb82,_0x197088){_0x38fb82=_0x38fb82-0x0;var _0x5b1838=_0xdca1[_0x38fb82];return _0x5b1838;};'use strict';var _=require(_0x1dca('0x0'));var util=require(_0x1dca('0x1'));var logger=require(_0x1dca('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1dca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1dca('0x4'));var config=require(_0x1dca('0x5'));var attributes=require(_0x1dca('0x6'));module[_0x1dca('0x7')]=function(_0x1e613c,_0x249a0c){return _0x1e613c['define'](_0x1dca('0x8'),attributes,{'tableName':_0x1dca('0x9'),'paranoid':![],'indexes':[{'name':_0x1dca('0xa'),'fields':[_0x1dca('0xb'),_0x1dca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x523e=['exports','user_profile_has_sections','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a3a82,_0x3e076a){var _0x563434=function(_0x3796e0){while(--_0x3796e0){_0x4a3a82['push'](_0x4a3a82['shift']());}};_0x563434(++_0x3e076a);}(_0x523e,0x146));var _0xe523=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x523e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe523('0x0'));var util=require(_0xe523('0x1'));var logger=require(_0xe523('0x2'))(_0xe523('0x3'));var moment=require(_0xe523('0x4'));var BPromise=require(_0xe523('0x5'));var rp=require(_0xe523('0x6'));var fs=require('fs');var path=require(_0xe523('0x7'));var rimraf=require(_0xe523('0x8'));var config=require(_0xe523('0x9'));var attributes=require('./userProfileSection.attributes');module[_0xe523('0xa')]=function(_0x30dc56,_0x5720c7){return _0x30dc56['define']('UserProfileSection',attributes,{'tableName':_0xe523('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','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 8f3276a..c9153ee 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 _0xa87c=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result'];(function(_0x51c06c,_0x2322e6){var _0x289364=function(_0x41bd30){while(--_0x41bd30){_0x51c06c['push'](_0x51c06c['shift']());}};_0x289364(++_0x2322e6);}(_0xa87c,0x135));var _0xca87=function(_0x532685,_0x1a38c2){_0x532685=_0x532685-0x0;var _0x21426a=_0xa87c[_0x532685];return _0x21426a;};'use strict';var _=require(_0xca87('0x0'));var util=require(_0xca87('0x1'));var moment=require(_0xca87('0x2'));var BPromise=require(_0xca87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca87('0x4'));var db=require(_0xca87('0x5'))['db'];var utils=require(_0xca87('0x6'));var logger=require(_0xca87('0x7'))('rpc');var config=require(_0xca87('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x75b8ba,_0x25f961,_0x4f51f0){return new BPromise(function(_0x189544,_0xd22997){return client[_0xca87('0xa')](_0x75b8ba,_0x4f51f0)['then'](function(_0x456702){logger[_0xca87('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x25f961,_0xca87('0xc'));logger[_0xca87('0xd')](_0xca87('0xe'),_0x25f961,_0xca87('0xc'),JSON[_0xca87('0xf')](_0x456702));if(_0x456702[_0xca87('0x10')]){if(_0x456702[_0xca87('0x10')][_0xca87('0x11')]===0x1f4){logger[_0xca87('0x10')](_0xca87('0x12'),_0x25f961,_0x456702[_0xca87('0x10')][_0xca87('0x13')]);return _0xd22997(_0x456702[_0xca87('0x10')]['message']);}logger['error'](_0xca87('0x12'),_0x25f961,_0x456702[_0xca87('0x10')]['message']);return _0x189544(_0x456702[_0xca87('0x10')][_0xca87('0x13')]);}else{logger[_0xca87('0xb')](_0xca87('0x12'),_0x25f961,'request\x20sent');_0x189544(_0x456702[_0xca87('0x14')][_0xca87('0x13')]);}})[_0xca87('0x15')](function(_0x378b9e){logger['error'](_0xca87('0x12'),_0x25f961,_0x378b9e);_0xd22997(_0x378b9e);});});} \ No newline at end of file +var _0x5697=['message','catch','lodash','moment','bluebird','randomstring','../../config/environment','request','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0x5697,0x1b5));var _0x7569=function(_0x5f3562,_0x212f41){_0x5f3562=_0x5f3562-0x0;var _0x1b39b4=_0x5697[_0x5f3562];return _0x1b39b4;};'use strict';var _=require(_0x7569('0x0'));var util=require('util');var moment=require(_0x7569('0x1'));var BPromise=require(_0x7569('0x2'));var rs=require(_0x7569('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7569('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x149fa1,_0x11536f,_0x30b7e2){return new BPromise(function(_0xee5a4,_0x3c0470){return client[_0x7569('0x5')](_0x149fa1,_0x30b7e2)['then'](function(_0x45cb1f){logger['info'](_0x7569('0x6'),_0x11536f,_0x7569('0x7'));logger[_0x7569('0x8')](_0x7569('0x9'),_0x11536f,_0x7569('0x7'),JSON[_0x7569('0xa')](_0x45cb1f));if(_0x45cb1f[_0x7569('0xb')]){if(_0x45cb1f[_0x7569('0xb')][_0x7569('0xc')]===0x1f4){logger['error'](_0x7569('0x6'),_0x11536f,_0x45cb1f[_0x7569('0xb')][_0x7569('0xd')]);return _0x3c0470(_0x45cb1f[_0x7569('0xb')][_0x7569('0xd')]);}logger[_0x7569('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x11536f,_0x45cb1f[_0x7569('0xb')][_0x7569('0xd')]);return _0xee5a4(_0x45cb1f[_0x7569('0xb')][_0x7569('0xd')]);}else{logger['info'](_0x7569('0x6'),_0x11536f,_0x7569('0x7'));_0xee5a4(_0x45cb1f['result']['message']);}})[_0x7569('0xe')](function(_0x97974d){logger['error'](_0x7569('0x6'),_0x11536f,_0x97974d);_0x3c0470(_0x97974d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 0549ade..37a5a88 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5c5d17,_0xf562e9){var _0x563a64=function(_0x3cd78b){while(--_0x3cd78b){_0x5c5d17['push'](_0x5c5d17['shift']());}};_0x563a64(++_0xf562e9);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2cc03b,_0x295c7b){var _0x54948c=function(_0x5e567b){while(--_0x5e567b){_0x2cc03b['push'](_0x2cc03b['shift']());}};_0x54948c(++_0x295c7b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2555ff,_0x2539bd){_0x2555ff=_0x2555ff-0x0;var _0x490fc5=_0xedd9[_0x2555ff];return _0x490fc5;};'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 5e7dc64..4796ba0 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 _0x33c1=['exports'];(function(_0x4dbfec,_0x3c4e52){var _0x286ebc=function(_0x43deba){while(--_0x43deba){_0x4dbfec['push'](_0x4dbfec['shift']());}};_0x286ebc(++_0x3c4e52);}(_0x33c1,0x82));var _0x133c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33c1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x133c('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6710=['exports','INTEGER','sequelize'];(function(_0x28392a,_0x1a9084){var _0x52f948=function(_0x723c43){while(--_0x723c43){_0x28392a['push'](_0x28392a['shift']());}};_0x52f948(++_0x1a9084);}(_0x6710,0x12b));var _0x0671=function(_0xfc957f,_0x2e353b){_0xfc957f=_0xfc957f-0x0;var _0x10a878=_0x6710[_0xfc957f];return _0x10a878;};'use strict';var Sequelize=require(_0x0671('0x0'));module[_0x0671('0x1')]={'penalty':{'type':Sequelize[_0x0671('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 39f5922..512b5f4 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 _0x6f44=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','api','moment'];(function(_0x423f00,_0x467bb2){var _0x238c49=function(_0x1cd9ae){while(--_0x1cd9ae){_0x423f00['push'](_0x423f00['shift']());}};_0x238c49(++_0x467bb2);}(_0x6f44,0x1ea));var _0x46f4=function(_0x23ad96,_0x391222){_0x23ad96=_0x23ad96-0x0;var _0xce8a18=_0x6f44[_0x23ad96];return _0xce8a18;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1c=['exports','UserSmsQueue','user_has_sms_queues','lodash','util','request-promise','path','rimraf','./userSmsQueue.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xed1c,0xe4));var _0xced1=function(_0x17946f,_0x12a5ef){_0x17946f=_0x17946f-0x0;var _0x316c8c=_0xed1c[_0x17946f];return _0x316c8c;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'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 64acfb4..1357820 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 _0x433a=['../../config/environment','jayson/promise','client','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x345b5f,_0x15a2b3){var _0x444221=function(_0x10fa0e){while(--_0x10fa0e){_0x345b5f['push'](_0x345b5f['shift']());}};_0x444221(++_0x15a2b3);}(_0x433a,0x18e));var _0xa433=function(_0x21ef76,_0x375f58){_0x21ef76=_0x21ef76-0x0;var _0x31a642=_0x433a[_0x21ef76];return _0x31a642;};'use strict';var _=require(_0xa433('0x0'));var util=require(_0xa433('0x1'));var moment=require(_0xa433('0x2'));var BPromise=require(_0xa433('0x3'));var rs=require(_0xa433('0x4'));var fs=require('fs');var Redis=require(_0xa433('0x5'));var db=require(_0xa433('0x6'))['db'];var utils=require(_0xa433('0x7'));var logger=require(_0xa433('0x8'))(_0xa433('0x9'));var config=require(_0xa433('0xa'));var jayson=require(_0xa433('0xb'));var client=jayson[_0xa433('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x405d9c,_0x3cb624,_0x1d8b28){return new BPromise(function(_0xe955d0,_0x13f663){return client[_0xa433('0xd')](_0x405d9c,_0x1d8b28)['then'](function(_0x34563a){logger[_0xa433('0xe')](_0xa433('0xf'),_0x3cb624,_0xa433('0x10'));logger[_0xa433('0x11')](_0xa433('0x12'),_0x3cb624,_0xa433('0x10'),JSON[_0xa433('0x13')](_0x34563a));if(_0x34563a[_0xa433('0x14')]){if(_0x34563a['error'][_0xa433('0x15')]===0x1f4){logger[_0xa433('0x14')](_0xa433('0xf'),_0x3cb624,_0x34563a[_0xa433('0x14')][_0xa433('0x16')]);return _0x13f663(_0x34563a[_0xa433('0x14')][_0xa433('0x16')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x3cb624,_0x34563a['error'][_0xa433('0x16')]);return _0xe955d0(_0x34563a[_0xa433('0x14')][_0xa433('0x16')]);}else{logger[_0xa433('0xe')](_0xa433('0xf'),_0x3cb624,_0xa433('0x10'));_0xe955d0(_0x34563a[_0xa433('0x17')][_0xa433('0x16')]);}})['catch'](function(_0x4f26cd){logger[_0xa433('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x3cb624,_0x4f26cd);_0x13f663(_0x4f26cd);});});} \ No newline at end of file +var _0x1689=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x98ff43,_0x538579){var _0x4f5757=function(_0x20eac9){while(--_0x20eac9){_0x98ff43['push'](_0x98ff43['shift']());}};_0x4f5757(++_0x538579);}(_0x1689,0x14f));var _0x9168=function(_0x148a91,_0x169d87){_0x148a91=_0x148a91-0x0;var _0x1764c5=_0x1689[_0x148a91];return _0x1764c5;};'use strict';var _=require(_0x9168('0x0'));var util=require(_0x9168('0x1'));var moment=require(_0x9168('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9168('0x3'));var db=require(_0x9168('0x4'))['db'];var utils=require(_0x9168('0x5'));var logger=require(_0x9168('0x6'))(_0x9168('0x7'));var config=require(_0x9168('0x8'));var jayson=require(_0x9168('0x9'));var client=jayson[_0x9168('0xa')][_0x9168('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ad76,_0x346df4,_0x170cff){return new BPromise(function(_0x46b419,_0x339ccc){return client[_0x9168('0xc')](_0x47ad76,_0x170cff)[_0x9168('0xd')](function(_0x16a0fe){logger[_0x9168('0xe')](_0x9168('0xf'),_0x346df4,_0x9168('0x10'));logger[_0x9168('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x346df4,_0x9168('0x10'),JSON[_0x9168('0x12')](_0x16a0fe));if(_0x16a0fe[_0x9168('0x13')]){if(_0x16a0fe[_0x9168('0x13')][_0x9168('0x14')]===0x1f4){logger[_0x9168('0x13')](_0x9168('0xf'),_0x346df4,_0x16a0fe[_0x9168('0x13')][_0x9168('0x15')]);return _0x339ccc(_0x16a0fe[_0x9168('0x13')][_0x9168('0x15')]);}logger[_0x9168('0x13')](_0x9168('0xf'),_0x346df4,_0x16a0fe[_0x9168('0x13')]['message']);return _0x46b419(_0x16a0fe[_0x9168('0x13')]['message']);}else{logger['info'](_0x9168('0xf'),_0x346df4,_0x9168('0x10'));_0x46b419(_0x16a0fe[_0x9168('0x16')]['message']);}})['catch'](function(_0x1d5acb){logger['error'](_0x9168('0xf'),_0x346df4,_0x1d5acb);_0x339ccc(_0x1d5acb);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 16e5406..a221dd0 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 _0xec39=['INTEGER','sequelize','exports'];(function(_0x3e1463,_0x1d8ce4){var _0x32add3=function(_0xb13f82){while(--_0xb13f82){_0x3e1463['push'](_0x3e1463['shift']());}};_0x32add3(++_0x1d8ce4);}(_0xec39,0x178));var _0x9ec3=function(_0x377e74,_0x481ba1){_0x377e74=_0x377e74-0x0;var _0x3d0c3d=_0xec39[_0x377e74];return _0x3d0c3d;};'use strict';var Sequelize=require(_0x9ec3('0x0'));module[_0x9ec3('0x1')]={'UserId':{'type':Sequelize[_0x9ec3('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x73be=['INTEGER','sequelize','exports'];(function(_0x1a160c,_0x5ed766){var _0x4103f7=function(_0x4b4547){while(--_0x4b4547){_0x1a160c['push'](_0x1a160c['shift']());}};_0x4103f7(++_0x5ed766);}(_0x73be,0x11b));var _0xe73b=function(_0x293382,_0x7cac78){_0x293382=_0x293382-0x0;var _0x1cf13b=_0x73be[_0x293382];return _0x1cf13b;};'use strict';var Sequelize=require(_0xe73b('0x0'));module[_0xe73b('0x1')]={'UserId':{'type':Sequelize[_0xe73b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe73b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ca50d8c..ef20fe4 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(_0x30b138,_0x2e0be8){var _0x31ff7e=function(_0x44eb39){while(--_0x44eb39){_0x30b138['push'](_0x30b138['shift']());}};_0x31ff7e(++_0x2e0be8);}(_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 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(_0x11c11a,_0x2b68e2){var _0x27a4e1=function(_0x517f7e){while(--_0x517f7e){_0x11c11a['push'](_0x11c11a['shift']());}};_0x27a4e1(++_0x2b68e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index b26bd9d..eecfd64 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5c6390,_0xfa0b91){var _0x32917b=function(_0x2aba55){while(--_0x2aba55){_0x5c6390['push'](_0x5c6390['shift']());}};_0x32917b(++_0xfa0b91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x79324e,_0x4af67e){var _0x555666=function(_0x15d9c2){while(--_0x15d9c2){_0x79324e['push'](_0x79324e['shift']());}};_0x555666(++_0x4af67e);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index bfc5d9f..9196976 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 _0x17da=['INTEGER','sequelize'];(function(_0x34df41,_0x485cc9){var _0x1de19f=function(_0x4164f7){while(--_0x4164f7){_0x34df41['push'](_0x34df41['shift']());}};_0x1de19f(++_0x485cc9);}(_0x17da,0x167));var _0xa17d=function(_0x2c8333,_0x5a6995){_0x2c8333=_0x2c8333-0x0;var _0x3821e4=_0x17da[_0x2c8333];return _0x3821e4;};'use strict';var Sequelize=require(_0xa17d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa17d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe8c5=['sequelize','exports'];(function(_0x3cf6b4,_0x49f800){var _0x17f9e7=function(_0x2523f4){while(--_0x2523f4){_0x3cf6b4['push'](_0x3cf6b4['shift']());}};_0x17f9e7(++_0x49f800);}(_0xe8c5,0x1c0));var _0x5e8c=function(_0x1462e8,_0x43ef01){_0x1462e8=_0x1462e8-0x0;var _0x8b2312=_0xe8c5[_0x1462e8];return _0x8b2312;};'use strict';var Sequelize=require(_0x5e8c('0x0'));module[_0x5e8c('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 65a606b..9f1c4a1 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 _0x98d9=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','lodash','util','moment','bluebird','request-promise'];(function(_0x1157aa,_0x299bbc){var _0x585681=function(_0x186441){while(--_0x186441){_0x1157aa['push'](_0x1157aa['shift']());}};_0x585681(++_0x299bbc);}(_0x98d9,0x7d));var _0x998d=function(_0x580b85,_0x2245dc){_0x580b85=_0x580b85-0x0;var _0x23009a=_0x98d9[_0x580b85];return _0x23009a;};'use strict';var _=require(_0x998d('0x0'));var util=require(_0x998d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x998d('0x2'));var BPromise=require(_0x998d('0x3'));var rp=require(_0x998d('0x4'));var fs=require('fs');var path=require(_0x998d('0x5'));var rimraf=require(_0x998d('0x6'));var config=require(_0x998d('0x7'));var attributes=require(_0x998d('0x8'));module['exports']=function(_0x1ee2bc,_0x446dcb){return _0x1ee2bc['define'](_0x998d('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x154c=['define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x2c149c,_0x234daa){var _0x32f252=function(_0x51abe4){while(--_0x51abe4){_0x2c149c['push'](_0x2c149c['shift']());}};_0x32f252(++_0x234daa);}(_0x154c,0x161));var _0xc154=function(_0x58e29f,_0x475e63){_0x58e29f=_0x58e29f-0x0;var _0x32a7ab=_0x154c[_0x58e29f];return _0x32a7ab;};'use strict';var _=require(_0xc154('0x0'));var util=require(_0xc154('0x1'));var logger=require(_0xc154('0x2'))(_0xc154('0x3'));var moment=require(_0xc154('0x4'));var BPromise=require(_0xc154('0x5'));var rp=require(_0xc154('0x6'));var fs=require('fs');var path=require(_0xc154('0x7'));var rimraf=require('rimraf');var config=require(_0xc154('0x8'));var attributes=require(_0xc154('0x9'));module[_0xc154('0xa')]=function(_0x3498cb,_0x917250){return _0x3498cb[_0xc154('0xb')](_0xc154('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index e128d09..6e0a185 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 _0x17de=['UserVoiceQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x44a0cb,_0xe5115e){var _0x2584ea=function(_0x50a172){while(--_0x50a172){_0x44a0cb['push'](_0x44a0cb['shift']());}};_0x2584ea(++_0xe5115e);}(_0x17de,0x115));var _0xe17d=function(_0x21e049,_0x378eb9){_0x21e049=_0x21e049-0x0;var _0x486008=_0x17de[_0x21e049];return _0x486008;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe17d('0x0'));var BPromise=require(_0xe17d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe17d('0x2'));var db=require(_0xe17d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe17d('0x4'))(_0xe17d('0x5'));var config=require(_0xe17d('0x6'));var jayson=require(_0xe17d('0x7'));var client=jayson[_0xe17d('0x8')][_0xe17d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x560479,_0x126224,_0x4856b5){return new BPromise(function(_0x3a33de,_0x3342ff){return client['request'](_0x560479,_0x4856b5)[_0xe17d('0xa')](function(_0x4d0244){logger[_0xe17d('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x126224,_0xe17d('0xc'));logger[_0xe17d('0xd')](_0xe17d('0xe'),_0x126224,'request\x20sent',JSON['stringify'](_0x4d0244));if(_0x4d0244[_0xe17d('0xf')]){if(_0x4d0244[_0xe17d('0xf')][_0xe17d('0x10')]===0x1f4){logger[_0xe17d('0xf')](_0xe17d('0x11'),_0x126224,_0x4d0244[_0xe17d('0xf')][_0xe17d('0x12')]);return _0x3342ff(_0x4d0244[_0xe17d('0xf')][_0xe17d('0x12')]);}logger['error'](_0xe17d('0x11'),_0x126224,_0x4d0244[_0xe17d('0xf')][_0xe17d('0x12')]);return _0x3a33de(_0x4d0244[_0xe17d('0xf')][_0xe17d('0x12')]);}else{logger['info'](_0xe17d('0x11'),_0x126224,_0xe17d('0xc'));_0x3a33de(_0x4d0244[_0xe17d('0x13')][_0xe17d('0x12')]);}})[_0xe17d('0x14')](function(_0x279c56){logger[_0xe17d('0xf')](_0xe17d('0x11'),_0x126224,_0x279c56);_0x3342ff(_0x279c56);});});} \ No newline at end of file +var _0x15e6=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x15e6,0x132));var _0x615e=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0x15e6[_0x2ad008];return _0x4538cf;};'use strict';var _=require('lodash');var util=require(_0x615e('0x0'));var moment=require(_0x615e('0x1'));var BPromise=require(_0x615e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x615e('0x3'));var db=require(_0x615e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x615e('0x5'))(_0x615e('0x6'));var config=require(_0x615e('0x7'));var jayson=require(_0x615e('0x8'));var client=jayson['client'][_0x615e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3355c,_0x135e32,_0x256e23){return new BPromise(function(_0x144631,_0x4f2076){return client[_0x615e('0xa')](_0xe3355c,_0x256e23)[_0x615e('0xb')](function(_0x13cc98){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x135e32,_0x615e('0xc'));logger[_0x615e('0xd')](_0x615e('0xe'),_0x135e32,'request\x20sent',JSON[_0x615e('0xf')](_0x13cc98));if(_0x13cc98['error']){if(_0x13cc98[_0x615e('0x10')]['code']===0x1f4){logger[_0x615e('0x10')](_0x615e('0x11'),_0x135e32,_0x13cc98[_0x615e('0x10')][_0x615e('0x12')]);return _0x4f2076(_0x13cc98[_0x615e('0x10')][_0x615e('0x12')]);}logger[_0x615e('0x10')](_0x615e('0x11'),_0x135e32,_0x13cc98[_0x615e('0x10')][_0x615e('0x12')]);return _0x144631(_0x13cc98[_0x615e('0x10')][_0x615e('0x12')]);}else{logger['info'](_0x615e('0x11'),_0x135e32,_0x615e('0xc'));_0x144631(_0x13cc98[_0x615e('0x13')][_0x615e('0x12')]);}})['catch'](function(_0x50fb1c){logger[_0x615e('0x10')](_0x615e('0x11'),_0x135e32,_0x50fb1c);_0x4f2076(_0x50fb1c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 83a97f7..d972411 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1d0aee,_0x2c4454){var _0x34ee2c=function(_0x6e3b9d){while(--_0x6e3b9d){_0x1d0aee['push'](_0x1d0aee['shift']());}};_0x34ee2c(++_0x2c4454);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2f5113,_0x535501){var _0x4a5436=function(_0x6ba163){while(--_0x6ba163){_0x2f5113['push'](_0x2f5113['shift']());}};_0x4a5436(++_0x535501);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ea34501..83ad65a 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 _0xcd10=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcd10,0x16d));var _0x0cd1=function(_0x250467,_0x33137e){_0x250467=_0x250467-0x0;var _0x39b492=_0xcd10[_0x250467];return _0x39b492;};'use strict';var Sequelize=require('sequelize');module[_0x0cd1('0x0')]={'uniqueid':{'type':Sequelize[_0x0cd1('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0cd1('0x2')},'membername':{'type':Sequelize[_0x0cd1('0x3')],'allowNull':![],'comment':_0x0cd1('0x2')},'UserId':{'type':Sequelize[_0x0cd1('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0cd1('0x3')],'allowNull':![],'unique':_0x0cd1('0x4'),'comment':_0x0cd1('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x0cd1('0x3')],'allowNull':![],'unique':_0x0cd1('0x4'),'comment':_0x0cd1('0x2')},'penalty':{'type':Sequelize[_0x0cd1('0x1')](0xb),'defaultValue':0x0,'comment':_0x0cd1('0x2')},'paused':{'type':Sequelize[_0x0cd1('0x1')](0xb),'defaultValue':0x0,'comment':_0x0cd1('0x2')}}; \ No newline at end of file +var _0x8502=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','sequelize'];(function(_0x3c56e2,_0x2d4997){var _0x31f370=function(_0x10fd6f){while(--_0x10fd6f){_0x3c56e2['push'](_0x3c56e2['shift']());}};_0x31f370(++_0x2d4997);}(_0x8502,0xd1));var _0x2850=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x8502[_0x9c3c56];return _0x2dd782;};'use strict';var Sequelize=require(_0x2850('0x0'));module[_0x2850('0x1')]={'uniqueid':{'type':Sequelize[_0x2850('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2850('0x3')},'membername':{'type':Sequelize[_0x2850('0x4')],'allowNull':![],'comment':_0x2850('0x3')},'UserId':{'type':Sequelize[_0x2850('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2850('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x2850('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2850('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x2850('0x3')},'penalty':{'type':Sequelize[_0x2850('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x2850('0x2')](0xb),'defaultValue':0x0,'comment':_0x2850('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4de712e..139e7e3 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 _0xecd3=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x36cbe9,_0x41ea42){var _0x443303=function(_0x54a228){while(--_0x54a228){_0x36cbe9['push'](_0x36cbe9['shift']());}};_0x443303(++_0x41ea42);}(_0xecd3,0x1cf));var _0x3ecd=function(_0x41fe0e,_0x1fe71f){_0x41fe0e=_0x41fe0e-0x0;var _0x22ae18=_0xecd3[_0x41fe0e];return _0x22ae18;};'use strict';var EventEmitter=require(_0x3ecd('0x0'));var UserVoiceQueueRt=require(_0x3ecd('0x1'))['db'][_0x3ecd('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3ecd('0x3')](0x0);var events={'afterCreate':_0x3ecd('0x4'),'afterUpdate':'update','afterDestroy':_0x3ecd('0x5')};function emitEvent(_0x10f5dd){return function(_0x45573c,_0x43d65d,_0xdc61b5){UserVoiceQueueRtEvents[_0x3ecd('0x6')](_0x10f5dd+':'+_0x45573c['id'],_0x45573c);UserVoiceQueueRtEvents[_0x3ecd('0x6')](_0x10f5dd,_0x45573c);_0xdc61b5(null);};}for(var e in events){if(events[_0x3ecd('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x3ecd('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x235a=['hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','remove','emit'];(function(_0x408d95,_0x43248e){var _0x552bf9=function(_0x37a3d2){while(--_0x37a3d2){_0x408d95['push'](_0x408d95['shift']());}};_0x552bf9(++_0x43248e);}(_0x235a,0xa2));var _0xa235=function(_0x3bc575,_0x400f90){_0x3bc575=_0x3bc575-0x0;var _0x25c47f=_0x235a[_0x3bc575];return _0x25c47f;};'use strict';var EventEmitter=require(_0xa235('0x0'));var UserVoiceQueueRt=require(_0xa235('0x1'))['db'][_0xa235('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa235('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa235('0x4')};function emitEvent(_0x2a5ba8){return function(_0x44bb50,_0x2400f6,_0x31e0ce){UserVoiceQueueRtEvents[_0xa235('0x5')](_0x2a5ba8+':'+_0x44bb50['id'],_0x44bb50);UserVoiceQueueRtEvents['emit'](_0x2a5ba8,_0x44bb50);_0x31e0ce(null);};}for(var e in events){if(events[_0xa235('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa235('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index e3db7da..caef3a8 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 _0x3c4e=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x4db2d6,_0x1d39ec){var _0x1b707b=function(_0x1314d9){while(--_0x1314d9){_0x4db2d6['push'](_0x4db2d6['shift']());}};_0x1b707b(++_0x1d39ec);}(_0x3c4e,0x112));var _0xe3c4=function(_0x58be60,_0x3150e9){_0x58be60=_0x58be60-0x0;var _0x126469=_0x3c4e[_0x58be60];return _0x126469;};'use strict';var _=require(_0xe3c4('0x0'));var util=require('util');var logger=require(_0xe3c4('0x1'))(_0xe3c4('0x2'));var moment=require('moment');var BPromise=require(_0xe3c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3c4('0x4'));var rimraf=require(_0xe3c4('0x5'));var config=require(_0xe3c4('0x6'));var attributes=require(_0xe3c4('0x7'));module[_0xe3c4('0x8')]=function(_0x1886b6,_0xfd566d){return _0x1886b6['define'](_0xe3c4('0x9'),attributes,{'tableName':_0xe3c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5674=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','util','../../config/logger','api','moment'];(function(_0x9f1737,_0x3e160a){var _0x1cc57f=function(_0x19c034){while(--_0x19c034){_0x9f1737['push'](_0x9f1737['shift']());}};_0x1cc57f(++_0x3e160a);}(_0x5674,0x74));var _0x4567=function(_0x2650df,_0x5daf20){_0x2650df=_0x2650df-0x0;var _0xa8cc92=_0x5674[_0x2650df];return _0xa8cc92;};'use strict';var _=require('lodash');var util=require(_0x4567('0x0'));var logger=require(_0x4567('0x1'))(_0x4567('0x2'));var moment=require(_0x4567('0x3'));var BPromise=require('bluebird');var rp=require(_0x4567('0x4'));var fs=require('fs');var path=require(_0x4567('0x5'));var rimraf=require(_0x4567('0x6'));var config=require(_0x4567('0x7'));var attributes=require(_0x4567('0x8'));module[_0x4567('0x9')]=function(_0x4d362e,_0x8aa6fd){return _0x4d362e[_0x4567('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x4567('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 66fbf04..f71d015 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 _0x5fe1=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','outboundQueuePauses','util','bluebird','ioredis'];(function(_0x123ea8,_0x45eb48){var _0x5f0dc9=function(_0x5a39cf){while(--_0x5a39cf){_0x123ea8['push'](_0x123ea8['shift']());}};_0x5f0dc9(++_0x45eb48);}(_0x5fe1,0x1ad));var _0x15fe=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5fe1[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x15fe('0x0'));var moment=require('moment');var BPromise=require(_0x15fe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15fe('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x15fe('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x15fe('0x4'));var client=jayson[_0x15fe('0x5')][_0x15fe('0x6')]({'port':0x232a});config[_0x15fe('0x7')]=_[_0x15fe('0x8')](config['redis'],{'host':_0x15fe('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15fe('0x7')]));require('./userVoiceQueueRt.socket')[_0x15fe('0xa')](socket);function respondWithRpcPromise(_0x4482b1,_0x5df9e5,_0x15a163){return new BPromise(function(_0xdf9e47,_0x327042){return client[_0x15fe('0xb')](_0x4482b1,_0x15a163)[_0x15fe('0xc')](function(_0x32deda){logger[_0x15fe('0xd')](_0x15fe('0xe'),_0x5df9e5,_0x15fe('0xf'));logger[_0x15fe('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5df9e5,_0x15fe('0xf'),JSON['stringify'](_0x32deda));if(_0x32deda['error']){if(_0x32deda[_0x15fe('0x11')]['code']===0x1f4){logger[_0x15fe('0x11')](_0x15fe('0xe'),_0x5df9e5,_0x32deda[_0x15fe('0x11')][_0x15fe('0x12')]);return _0x327042(_0x32deda['error'][_0x15fe('0x12')]);}logger[_0x15fe('0x11')](_0x15fe('0xe'),_0x5df9e5,_0x32deda['error'][_0x15fe('0x12')]);return _0xdf9e47(_0x32deda['error'][_0x15fe('0x12')]);}else{logger[_0x15fe('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5df9e5,_0x15fe('0xf'));_0xdf9e47(_0x32deda['result'][_0x15fe('0x12')]);}})[_0x15fe('0x13')](function(_0x2522f7){logger[_0x15fe('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5df9e5,_0x2522f7);_0x327042(_0x2522f7);});});}exports['GetVoiceQueueRtPauses']=function(_0x396f2b){var _0x220b46=this;return new Promise(function(_0x52aa16,_0x2fe531){return db[_0x15fe('0x14')]['findAll']({'raw':_0x396f2b[_0x15fe('0x15')]?_0x396f2b[_0x15fe('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x396f2b[_0x15fe('0x15')]?_0x396f2b[_0x15fe('0x15')][_0x15fe('0x16')]||null:null,'attributes':[[db[_0x15fe('0x17')]['fn'](_0x15fe('0x18'),db[_0x15fe('0x17')]['fn']('IF',db[_0x15fe('0x17')][_0x15fe('0x19')]('`paused`\x20=\x201,\x201,\x20null'))),_0x15fe('0x1a')]]})['then'](function(_0x314bd0){logger[_0x15fe('0xd')]('GetVoiceQueueRtPauses',_0x396f2b);logger[_0x15fe('0x10')]('GetVoiceQueueRtPauses',_0x396f2b,JSON['stringify'](_0x314bd0));_0x52aa16(_0x314bd0);})[_0x15fe('0x13')](function(_0x34793a){logger[_0x15fe('0x11')]('GetVoiceQueueRtPauses',_0x34793a['message'],_0x396f2b);_0x2fe531(_0x220b46[_0x15fe('0x11')](0x1f4,_0x34793a['message']));});});}; \ No newline at end of file +var _0xf0ce=['UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses'];(function(_0xaccc4e,_0x396cda){var _0x3da67b=function(_0x49868b){while(--_0x49868b){_0xaccc4e['push'](_0xaccc4e['shift']());}};_0x3da67b(++_0x396cda);}(_0xf0ce,0xb7));var _0xef0c=function(_0xfb9f9d,_0xadc363){_0xfb9f9d=_0xfb9f9d-0x0;var _0x2a6859=_0xf0ce[_0xfb9f9d];return _0x2a6859;};'use strict';var _=require('lodash');var util=require(_0xef0c('0x0'));var moment=require(_0xef0c('0x1'));var BPromise=require(_0xef0c('0x2'));var rs=require(_0xef0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef0c('0x4'))['db'];var utils=require(_0xef0c('0x5'));var logger=require(_0xef0c('0x6'))(_0xef0c('0x7'));var config=require(_0xef0c('0x8'));var jayson=require(_0xef0c('0x9'));var client=jayson[_0xef0c('0xa')]['http']({'port':0x232a});config['redis']=_[_0xef0c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xef0c('0xc'))(new Redis(config[_0xef0c('0xd')]));require(_0xef0c('0xe'))['register'](socket);function respondWithRpcPromise(_0x4b3d6d,_0x598c5e,_0x40dbee){return new BPromise(function(_0x2daa64,_0x2598d2){return client['request'](_0x4b3d6d,_0x40dbee)[_0xef0c('0xf')](function(_0x541990){logger[_0xef0c('0x10')](_0xef0c('0x11'),_0x598c5e,'request\x20sent');logger['debug'](_0xef0c('0x12'),_0x598c5e,_0xef0c('0x13'),JSON[_0xef0c('0x14')](_0x541990));if(_0x541990[_0xef0c('0x15')]){if(_0x541990[_0xef0c('0x15')][_0xef0c('0x16')]===0x1f4){logger[_0xef0c('0x15')](_0xef0c('0x11'),_0x598c5e,_0x541990['error'][_0xef0c('0x17')]);return _0x2598d2(_0x541990[_0xef0c('0x15')][_0xef0c('0x17')]);}logger[_0xef0c('0x15')](_0xef0c('0x11'),_0x598c5e,_0x541990[_0xef0c('0x15')]['message']);return _0x2daa64(_0x541990[_0xef0c('0x15')][_0xef0c('0x17')]);}else{logger[_0xef0c('0x10')](_0xef0c('0x11'),_0x598c5e,_0xef0c('0x13'));_0x2daa64(_0x541990[_0xef0c('0x18')]['message']);}})[_0xef0c('0x19')](function(_0xd02531){logger[_0xef0c('0x15')](_0xef0c('0x11'),_0x598c5e,_0xd02531);_0x2598d2(_0xd02531);});});}exports[_0xef0c('0x1a')]=function(_0x1aed27){var _0x6c1c00=this;return new Promise(function(_0x1187dc,_0x3cd236){return db[_0xef0c('0x1b')]['findAll']({'raw':_0x1aed27[_0xef0c('0x1c')]?_0x1aed27['options'][_0xef0c('0x1d')]===undefined?!![]:![]:!![],'where':_0x1aed27['options']?_0x1aed27[_0xef0c('0x1c')][_0xef0c('0x1e')]||null:null,'attributes':[[db[_0xef0c('0x1f')]['fn'](_0xef0c('0x20'),db[_0xef0c('0x1f')]['fn']('IF',db[_0xef0c('0x1f')][_0xef0c('0x21')](_0xef0c('0x22')))),'outboundQueuePauses']]})[_0xef0c('0xf')](function(_0x19cde2){logger[_0xef0c('0x10')](_0xef0c('0x1a'),_0x1aed27);logger['debug'](_0xef0c('0x1a'),_0x1aed27,JSON[_0xef0c('0x14')](_0x19cde2));_0x1187dc(_0x19cde2);})[_0xef0c('0x19')](function(_0x28161c){logger[_0xef0c('0x15')](_0xef0c('0x1a'),_0x28161c[_0xef0c('0x17')],_0x1aed27);_0x3cd236(_0x6c1c00[_0xef0c('0x15')](0x1f4,_0x28161c[_0xef0c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 549e5c3..7288912 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 _0x6299=['register','remove','update','emit','removeListener'];(function(_0x55e5ed,_0x1549d3){var _0x5e4675=function(_0x354826){while(--_0x354826){_0x55e5ed['push'](_0x55e5ed['shift']());}};_0x5e4675(++_0x1549d3);}(_0x6299,0x169));var _0x9629=function(_0x2cb393,_0x2a6518){_0x2cb393=_0x2cb393-0x0;var _0xa090a0=_0x6299[_0x2cb393];return _0xa090a0;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9629('0x0'),_0x9629('0x1')];function createListener(_0x3cf1e1,_0x35868a){return function(_0x3c3ab2){_0x35868a[_0x9629('0x2')](_0x3cf1e1,_0x3c3ab2);};}function removeListener(_0x55d4ce,_0x327ee9){return function(){UserVoiceQueueRtEvents[_0x9629('0x3')](_0x55d4ce,_0x327ee9);};}exports[_0x9629('0x4')]=function(_0x1edc13){for(var _0x1206bf=0x0,_0x5d5981=events['length'];_0x1206bf<_0x5d5981;_0x1206bf++){var _0x2c5ca5=events[_0x1206bf];var _0x1754e6=createListener('userVoiceQueueRt:'+_0x2c5ca5,_0x1edc13);UserVoiceQueueRtEvents['on'](_0x2c5ca5,_0x1754e6);}}; \ No newline at end of file +var _0x885a=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x885a,0x180));var _0xa885=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x885a[_0x21a9d9];return _0x46adce;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa885('0x0'),_0xa885('0x1'),_0xa885('0x2')];function createListener(_0x2e4bc8,_0x573a2b){return function(_0xcf0656){_0x573a2b[_0xa885('0x3')](_0x2e4bc8,_0xcf0656);};}function removeListener(_0x2386ec,_0x106e16){return function(){UserVoiceQueueRtEvents[_0xa885('0x4')](_0x2386ec,_0x106e16);};}exports[_0xa885('0x5')]=function(_0x5dfd7e){for(var _0x7ac6bd=0x0,_0x1200c7=events[_0xa885('0x6')];_0x7ac6bd<_0x1200c7;_0x7ac6bd++){var _0x546175=events[_0x7ac6bd];var _0x6b26e2=createListener(_0xa885('0x7')+_0x546175,_0x5dfd7e);UserVoiceQueueRtEvents['on'](_0x546175,_0x6b26e2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0ce9f94..80b7377 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(_0x3d075a,_0x507f04){var _0x418be1=function(_0x19c75b){while(--_0x19c75b){_0x3d075a['push'](_0x3d075a['shift']());}};_0x418be1(++_0x507f04);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x14311a,_0x4fa562){var _0x4b798b=function(_0x5b3a89){while(--_0x5b3a89){_0x14311a['push'](_0x14311a['shift']());}};_0x4b798b(++_0x4fa562);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 2ce9bf6..c42fb05 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 _0x9815=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9815,0x1d0));var _0x5981=function(_0xea475f,_0x4d6981){_0xea475f=_0xea475f-0x0;var _0x2920e9=_0x9815[_0xea475f];return _0x2920e9;};'use strict';var Sequelize=require(_0x5981('0x0'));module[_0x5981('0x1')]={'penalty':{'type':Sequelize[_0x5981('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x66d6=['sequelize','exports','INTEGER'];(function(_0x50f7b5,_0x42c733){var _0x2774fd=function(_0xa4b47a){while(--_0xa4b47a){_0x50f7b5['push'](_0x50f7b5['shift']());}};_0x2774fd(++_0x42c733);}(_0x66d6,0x1ad));var _0x666d=function(_0x51991f,_0x3e2f25){_0x51991f=_0x51991f-0x0;var _0x40c6f0=_0x66d6[_0x51991f];return _0x40c6f0;};'use strict';var Sequelize=require(_0x666d('0x0'));module[_0x666d('0x1')]={'penalty':{'type':Sequelize[_0x666d('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 b9571df..ff44a9e 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 _0x8aa1=['moment','bluebird','path','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8aa1,0x110));var _0x18aa=function(_0x6923ea,_0x4b5785){_0x6923ea=_0x6923ea-0x0;var _0x37b5d1=_0x8aa1[_0x6923ea];return _0x37b5d1;};'use strict';var _=require(_0x18aa('0x0'));var util=require(_0x18aa('0x1'));var logger=require(_0x18aa('0x2'))('api');var moment=require(_0x18aa('0x3'));var BPromise=require(_0x18aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18aa('0x5'));var rimraf=require('rimraf');var config=require(_0x18aa('0x6'));var attributes=require(_0x18aa('0x7'));module[_0x18aa('0x8')]=function(_0x59d5ec,_0x1ae460){return _0x59d5ec['define'](_0x18aa('0x9'),attributes,{'tableName':_0x18aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2b4=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x1d7e28,_0x32e7f8){var _0x54edf8=function(_0x1b4c7e){while(--_0x1b4c7e){_0x1d7e28['push'](_0x1d7e28['shift']());}};_0x54edf8(++_0x32e7f8);}(_0xf2b4,0x17e));var _0x4f2b=function(_0x4a9f36,_0x7a92a1){_0x4a9f36=_0x4a9f36-0x0;var _0x4097ee=_0xf2b4[_0x4a9f36];return _0x4097ee;};'use strict';var _=require(_0x4f2b('0x0'));var util=require(_0x4f2b('0x1'));var logger=require(_0x4f2b('0x2'))(_0x4f2b('0x3'));var moment=require(_0x4f2b('0x4'));var BPromise=require('bluebird');var rp=require(_0x4f2b('0x5'));var fs=require('fs');var path=require(_0x4f2b('0x6'));var rimraf=require(_0x4f2b('0x7'));var config=require(_0x4f2b('0x8'));var attributes=require(_0x4f2b('0x9'));module[_0x4f2b('0xa')]=function(_0x337f23,_0x4418f5){return _0x337f23[_0x4f2b('0xb')](_0x4f2b('0xc'),attributes,{'tableName':_0x4f2b('0xd'),'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 d4625f8..f9b7495 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 _0xb0d7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x11ef6d,_0xbc627b){var _0x3be32a=function(_0x2dda84){while(--_0x2dda84){_0x11ef6d['push'](_0x11ef6d['shift']());}};_0x3be32a(++_0xbc627b);}(_0xb0d7,0x156));var _0x7b0d=function(_0x506762,_0x5c2639){_0x506762=_0x506762-0x0;var _0x559d09=_0xb0d7[_0x506762];return _0x559d09;};'use strict';var _=require(_0x7b0d('0x0'));var util=require(_0x7b0d('0x1'));var moment=require(_0x7b0d('0x2'));var BPromise=require(_0x7b0d('0x3'));var rs=require(_0x7b0d('0x4'));var fs=require('fs');var Redis=require(_0x7b0d('0x5'));var db=require(_0x7b0d('0x6'))['db'];var utils=require(_0x7b0d('0x7'));var logger=require(_0x7b0d('0x8'))(_0x7b0d('0x9'));var config=require(_0x7b0d('0xa'));var jayson=require(_0x7b0d('0xb'));var client=jayson[_0x7b0d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc797,_0x2262e3,_0x788ed6){return new BPromise(function(_0x292786,_0x184801){return client[_0x7b0d('0xd')](_0xc797,_0x788ed6)['then'](function(_0x24bfeb){logger['info'](_0x7b0d('0xe'),_0x2262e3,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2262e3,_0x7b0d('0xf'),JSON[_0x7b0d('0x10')](_0x24bfeb));if(_0x24bfeb[_0x7b0d('0x11')]){if(_0x24bfeb[_0x7b0d('0x11')][_0x7b0d('0x12')]===0x1f4){logger['error'](_0x7b0d('0xe'),_0x2262e3,_0x24bfeb[_0x7b0d('0x11')][_0x7b0d('0x13')]);return _0x184801(_0x24bfeb[_0x7b0d('0x11')][_0x7b0d('0x13')]);}logger[_0x7b0d('0x11')](_0x7b0d('0xe'),_0x2262e3,_0x24bfeb['error'][_0x7b0d('0x13')]);return _0x292786(_0x24bfeb['error'][_0x7b0d('0x13')]);}else{logger[_0x7b0d('0x14')](_0x7b0d('0xe'),_0x2262e3,_0x7b0d('0xf'));_0x292786(_0x24bfeb[_0x7b0d('0x15')][_0x7b0d('0x13')]);}})[_0x7b0d('0x16')](function(_0x3a6d90){logger[_0x7b0d('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2262e3,_0x3a6d90);_0x184801(_0x3a6d90);});});} \ No newline at end of file +var _0x50c1=['stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/logger','rpc','../../config/environment','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x50c1,0xa6));var _0x150c=function(_0x1123ad,_0xede2f3){_0x1123ad=_0x1123ad-0x0;var _0x5c02a0=_0x50c1[_0x1123ad];return _0x5c02a0;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var moment=require(_0x150c('0x1'));var BPromise=require(_0x150c('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(_0x150c('0x3'))(_0x150c('0x4'));var config=require(_0x150c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x150c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14e0c7,_0x30d435,_0x2c9c13){return new BPromise(function(_0x550d2c,_0x403cc0){return client[_0x150c('0x7')](_0x14e0c7,_0x2c9c13)[_0x150c('0x8')](function(_0x3e62c6){logger[_0x150c('0x9')](_0x150c('0xa'),_0x30d435,_0x150c('0xb'));logger[_0x150c('0xc')](_0x150c('0xd'),_0x30d435,_0x150c('0xb'),JSON[_0x150c('0xe')](_0x3e62c6));if(_0x3e62c6[_0x150c('0xf')]){if(_0x3e62c6[_0x150c('0xf')][_0x150c('0x10')]===0x1f4){logger['error'](_0x150c('0xa'),_0x30d435,_0x3e62c6[_0x150c('0xf')][_0x150c('0x11')]);return _0x403cc0(_0x3e62c6[_0x150c('0xf')][_0x150c('0x11')]);}logger[_0x150c('0xf')](_0x150c('0xa'),_0x30d435,_0x3e62c6['error'][_0x150c('0x11')]);return _0x550d2c(_0x3e62c6[_0x150c('0xf')][_0x150c('0x11')]);}else{logger[_0x150c('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x30d435,_0x150c('0xb'));_0x550d2c(_0x3e62c6[_0x150c('0x12')]['message']);}})[_0x150c('0x13')](function(_0x1cdfdf){logger[_0x150c('0xf')](_0x150c('0xa'),_0x30d435,_0x1cdfdf);_0x403cc0(_0x1cdfdf);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 0749d05..51c1b76 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 _0x97d5=['get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45eacc,_0x3727a4){var _0x3f1252=function(_0x36b7f4){while(--_0x36b7f4){_0x45eacc['push'](_0x45eacc['shift']());}};_0x3f1252(++_0x3727a4);}(_0x97d5,0x199));var _0x597d=function(_0x1cf116,_0x21eace){_0x1cf116=_0x1cf116-0x0;var _0x4ba35f=_0x97d5[_0x1cf116];return _0x4ba35f;};'use strict';var multer=require(_0x597d('0x0'));var util=require(_0x597d('0x1'));var path=require(_0x597d('0x2'));var timeout=require(_0x597d('0x3'));var express=require(_0x597d('0x4'));var router=express[_0x597d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x597d('0x6'));var interaction=require(_0x597d('0x7'));var config=require(_0x597d('0x8'));var controller=require('./variable.controller');router[_0x597d('0x9')]('/',auth[_0x597d('0xa')](),controller[_0x597d('0xb')]);router[_0x597d('0x9')](_0x597d('0xc'),auth[_0x597d('0xa')](),controller[_0x597d('0xd')]);router['post']('/',auth[_0x597d('0xa')](),controller[_0x597d('0xe')]);router['put'](_0x597d('0xc'),auth['isAuthenticated'](),controller[_0x597d('0xf')]);router[_0x597d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x597d('0x11')]);module[_0x597d('0x12')]=router; \ No newline at end of file +var _0x03bc=['create','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x5d5011,_0x4a30cf){var _0x1faf6c=function(_0x51e4eb){while(--_0x51e4eb){_0x5d5011['push'](_0x5d5011['shift']());}};_0x1faf6c(++_0x4a30cf);}(_0x03bc,0xb8));var _0xc03b=function(_0x29d81f,_0x2bf489){_0x29d81f=_0x29d81f-0x0;var _0x54c8ac=_0x03bc[_0x29d81f];return _0x54c8ac;};'use strict';var multer=require(_0xc03b('0x0'));var util=require('util');var path=require(_0xc03b('0x1'));var timeout=require(_0xc03b('0x2'));var express=require('express');var router=express[_0xc03b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc03b('0x4'));var interaction=require(_0xc03b('0x5'));var config=require(_0xc03b('0x6'));var controller=require(_0xc03b('0x7'));router[_0xc03b('0x8')]('/',auth['isAuthenticated'](),controller[_0xc03b('0x9')]);router['get'](_0xc03b('0xa'),auth[_0xc03b('0xb')](),controller[_0xc03b('0xc')]);router[_0xc03b('0xd')]('/',auth[_0xc03b('0xb')](),controller[_0xc03b('0xe')]);router[_0xc03b('0xf')](_0xc03b('0xa'),auth['isAuthenticated'](),controller[_0xc03b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc03b('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 13927b2..3833b4a 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 _0x43f8=['exports','STRING','sequelize'];(function(_0x5527dd,_0x2389f6){var _0x2ffd1b=function(_0x4e9abf){while(--_0x4e9abf){_0x5527dd['push'](_0x5527dd['shift']());}};_0x2ffd1b(++_0x2389f6);}(_0x43f8,0x1bb));var _0x843f=function(_0x4a3c65,_0x150dfb){_0x4a3c65=_0x4a3c65-0x0;var _0x4a9565=_0x43f8[_0x4a3c65];return _0x4a9565;};'use strict';var Sequelize=require(_0x843f('0x0'));module[_0x843f('0x1')]={'name':{'type':Sequelize[_0x843f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b91=['sequelize','exports','STRING','name'];(function(_0x25effb,_0x43bf70){var _0x26d900=function(_0x202648){while(--_0x202648){_0x25effb['push'](_0x25effb['shift']());}};_0x26d900(++_0x43bf70);}(_0x5b91,0x128));var _0x15b9=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x5b91[_0x151721];return _0x2deaa7;};'use strict';var Sequelize=require(_0x15b9('0x0'));module[_0x15b9('0x1')]={'name':{'type':Sequelize[_0x15b9('0x2')],'unique':_0x15b9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x15b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 1832b38..546a311 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 _0x66f3=['fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','catch','show','params','Variable','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','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x66f3,0x13e));var _0x366f=function(_0x2a93f0,_0x1f8fb7){_0x2a93f0=_0x2a93f0-0x0;var _0x439217=_0x66f3[_0x2a93f0];return _0x439217;};'use strict';var emlformat=require(_0x366f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x366f('0x1'));var jsonpatch=require(_0x366f('0x2'));var rp=require(_0x366f('0x3'));var moment=require(_0x366f('0x4'));var BPromise=require(_0x366f('0x5'));var Mustache=require('mustache');var util=require(_0x366f('0x6'));var path=require(_0x366f('0x7'));var sox=require(_0x366f('0x8'));var csv=require('to-csv');var ejs=require(_0x366f('0x9'));var fs=require('fs');var fs_extra=require(_0x366f('0xa'));var _=require(_0x366f('0xb'));var squel=require(_0x366f('0xc'));var crypto=require(_0x366f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x366f('0xe'));var toCsv=require(_0x366f('0xf'));var querystring=require(_0x366f('0x10'));var Papa=require('papaparse');var Redis=require(_0x366f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x366f('0x12'));var as=require(_0x366f('0x13'));var hardwareService=require(_0x366f('0x14'));var logger=require(_0x366f('0x15'))(_0x366f('0x16'));var utils=require('../../config/utils');var config=require(_0x366f('0x17'));var licenseUtil=require(_0x366f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x520248,_0x2eb634){_0x2eb634=_0x2eb634||0xcc;return function(_0xe8d344){if(_0xe8d344){return _0x520248[_0x366f('0x19')](_0x2eb634);}return _0x520248[_0x366f('0x1a')](_0x2eb634)['end']();};}function respondWithResult(_0x475c84,_0x3517fb){_0x3517fb=_0x3517fb||0xc8;return function(_0x15b0dd){if(_0x15b0dd){return _0x475c84[_0x366f('0x1a')](_0x3517fb)[_0x366f('0x1b')](_0x15b0dd);}};}function respondWithFilteredResult(_0xebe2f2,_0x290ebc){return function(_0x145e31){if(_0x145e31){var _0x1bff03=typeof _0x290ebc[_0x366f('0x1c')]===_0x366f('0x1d')&&typeof _0x290ebc[_0x366f('0x1e')]===_0x366f('0x1d');var _0x198ff4=_0x145e31[_0x366f('0x1f')];var _0x224c04=_0x1bff03?0x0:_0x290ebc[_0x366f('0x1c')];var _0x44acf9=_0x1bff03?_0x145e31[_0x366f('0x1f')]:_0x290ebc[_0x366f('0x1c')]+_0x290ebc[_0x366f('0x1e')];var _0x2e729e;if(_0x44acf9>=_0x198ff4){_0x44acf9=_0x198ff4;_0x2e729e=0xc8;}else{_0x2e729e=0xce;}_0xebe2f2[_0x366f('0x1a')](_0x2e729e);return _0xebe2f2['set']('Content-Range',_0x224c04+'-'+_0x44acf9+'/'+_0x198ff4)[_0x366f('0x1b')](_0x145e31);}return null;};}function patchUpdates(_0x3c8ad2){return function(_0x1c510e){try{jsonpatch['apply'](_0x1c510e,_0x3c8ad2,!![]);}catch(_0x3daa2c){return BPromise['reject'](_0x3daa2c);}return _0x1c510e[_0x366f('0x20')]();};}function saveUpdates(_0xb0561e,_0x2d6a61){return function(_0x5f4da4){if(_0x5f4da4){return _0x5f4da4[_0x366f('0x21')](_0xb0561e)[_0x366f('0x22')](function(_0x4195ad){return _0x4195ad;});}return null;};}function removeEntity(_0x58836a,_0x3dfb1e){return function(_0xcde06d){if(_0xcde06d){return _0xcde06d['destroy']()[_0x366f('0x22')](function(){var _0xc60cc0=_0xcde06d[_0x366f('0x23')]({'plain':!![]});var _0x343897=_0x366f('0x24');return db[_0x366f('0x25')][_0x366f('0x26')]({'where':{'type':_0x343897,'resourceId':_0xc60cc0['id']}})[_0x366f('0x22')](function(){return _0xcde06d;});})[_0x366f('0x22')](function(){_0x58836a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e865a,_0x383414){return function(_0x3c6d94){if(!_0x3c6d94){_0x2e865a[_0x366f('0x19')](0x194);}return _0x3c6d94;};}function handleError(_0x499f39,_0x5cae68){_0x5cae68=_0x5cae68||0x1f4;return function(_0x35b633){logger[_0x366f('0x27')](_0x35b633[_0x366f('0x28')]);if(_0x35b633[_0x366f('0x29')]){delete _0x35b633[_0x366f('0x29')];}_0x499f39[_0x366f('0x1a')](_0x5cae68)[_0x366f('0x2a')](_0x35b633);};}exports['index']=function(_0x3138bb,_0x4fa46d){var _0x2f9c89={},_0x8f1437={},_0x350c4d={'count':0x0,'rows':[]};var _0x4f8a01=_['map'](db['Variable'][_0x366f('0x2b')],function(_0x1715f0){return{'name':_0x1715f0[_0x366f('0x2c')],'type':_0x1715f0[_0x366f('0x2d')]['key']};});_0x8f1437['model']=_[_0x366f('0x2e')](_0x4f8a01,'name');_0x8f1437[_0x366f('0x2f')]=_[_0x366f('0x30')](_0x3138bb[_0x366f('0x2f')]);_0x8f1437[_0x366f('0x31')]=_[_0x366f('0x32')](_0x8f1437[_0x366f('0x33')],_0x8f1437[_0x366f('0x2f')]);_0x2f9c89[_0x366f('0x34')]=_[_0x366f('0x32')](_0x8f1437[_0x366f('0x33')],qs[_0x366f('0x35')](_0x3138bb[_0x366f('0x2f')][_0x366f('0x35')]));_0x2f9c89[_0x366f('0x34')]=_0x2f9c89[_0x366f('0x34')][_0x366f('0x36')]?_0x2f9c89[_0x366f('0x34')]:_0x8f1437[_0x366f('0x33')];if(!_0x3138bb['query'][_0x366f('0x37')](_0x366f('0x38'))){_0x2f9c89[_0x366f('0x1e')]=qs[_0x366f('0x1e')](_0x3138bb['query']['limit']);_0x2f9c89[_0x366f('0x1c')]=qs[_0x366f('0x1c')](_0x3138bb['query'][_0x366f('0x1c')]);}_0x2f9c89[_0x366f('0x39')]=qs[_0x366f('0x3a')](_0x3138bb['query'][_0x366f('0x3a')]);_0x2f9c89['where']=qs['filters'](_[_0x366f('0x3b')](_0x3138bb[_0x366f('0x2f')],_0x8f1437['filters']),_0x4f8a01);if(_0x3138bb[_0x366f('0x2f')][_0x366f('0x3c')]){_0x2f9c89[_0x366f('0x3d')]=_[_0x366f('0x3e')](_0x2f9c89[_0x366f('0x3d')],{'$or':_[_0x366f('0x2e')](_0x4f8a01,function(_0x5d2092){if(_0x5d2092[_0x366f('0x2d')]!==_0x366f('0x3f')){var _0x7616c4={};_0x7616c4[_0x5d2092[_0x366f('0x29')]]={'$like':'%'+_0x3138bb[_0x366f('0x2f')]['filter']+'%'};return _0x7616c4;}})});}_0x2f9c89=_['merge']({},_0x2f9c89,_0x3138bb[_0x366f('0x40')]);var _0x261efc={'where':_0x2f9c89[_0x366f('0x3d')]};return db['Variable'][_0x366f('0x1f')](_0x261efc)[_0x366f('0x22')](function(_0x45e2e9){_0x350c4d[_0x366f('0x1f')]=_0x45e2e9;if(_0x3138bb[_0x366f('0x2f')]['includeAll']){_0x2f9c89['include']=[{'all':!![]}];}return db['Variable'][_0x366f('0x41')](_0x2f9c89);})[_0x366f('0x22')](function(_0x435c82){_0x350c4d['rows']=_0x435c82;return _0x350c4d;})[_0x366f('0x22')](respondWithFilteredResult(_0x4fa46d,_0x2f9c89))[_0x366f('0x42')](handleError(_0x4fa46d,null));};exports[_0x366f('0x43')]=function(_0x58d7d7,_0x3f2f0d){var _0xc207ae={'raw':!![],'where':{'id':_0x58d7d7[_0x366f('0x44')]['id']}},_0x2ae32c={};_0x2ae32c[_0x366f('0x33')]=_['keys'](db[_0x366f('0x45')][_0x366f('0x2b')]);_0x2ae32c[_0x366f('0x2f')]=_[_0x366f('0x30')](_0x58d7d7[_0x366f('0x2f')]);_0x2ae32c[_0x366f('0x31')]=_[_0x366f('0x32')](_0x2ae32c[_0x366f('0x33')],_0x2ae32c['query']);_0xc207ae['attributes']=_[_0x366f('0x32')](_0x2ae32c[_0x366f('0x33')],qs[_0x366f('0x35')](_0x58d7d7[_0x366f('0x2f')][_0x366f('0x35')]));_0xc207ae[_0x366f('0x34')]=_0xc207ae[_0x366f('0x34')][_0x366f('0x36')]?_0xc207ae['attributes']:_0x2ae32c[_0x366f('0x33')];if(_0x58d7d7[_0x366f('0x2f')][_0x366f('0x46')]){_0xc207ae[_0x366f('0x47')]=[{'all':!![]}];}_0xc207ae=_[_0x366f('0x3e')]({},_0xc207ae,_0x58d7d7['options']);return db[_0x366f('0x45')][_0x366f('0x48')](_0xc207ae)[_0x366f('0x22')](handleEntityNotFound(_0x3f2f0d,null))[_0x366f('0x22')](respondWithResult(_0x3f2f0d,null))['catch'](handleError(_0x3f2f0d,null));};exports[_0x366f('0x49')]=function(_0x4475e5,_0x53aab2){return db[_0x366f('0x45')]['create'](_0x4475e5['body'],{})[_0x366f('0x22')](function(_0x1101c6){var _0xef3a81=_0x4475e5[_0x366f('0x4a')][_0x366f('0x23')]({'plain':!![]});if(!_0xef3a81)throw new Error(_0x366f('0x4b'));if(_0xef3a81[_0x366f('0x4c')]==='user'){var _0x3ba59a=_0x1101c6[_0x366f('0x23')]({'plain':!![]});var _0x19c5b5='Variables';return db[_0x366f('0x4d')][_0x366f('0x48')]({'where':{'name':_0x19c5b5,'userProfileId':_0xef3a81[_0x366f('0x4e')]},'raw':!![]})[_0x366f('0x22')](function(_0x3d8bdf){if(_0x3d8bdf&&_0x3d8bdf[_0x366f('0x4f')]===0x0){return db[_0x366f('0x25')][_0x366f('0x49')]({'name':_0x3ba59a[_0x366f('0x29')],'resourceId':_0x3ba59a['id'],'type':_0x3d8bdf[_0x366f('0x29')],'sectionId':_0x3d8bdf['id']},{})[_0x366f('0x22')](function(){return _0x1101c6;});}else{return _0x1101c6;}})[_0x366f('0x42')](function(_0x2cd25d){logger[_0x366f('0x27')](_0x366f('0x50'),_0x2cd25d);throw _0x2cd25d;});}return _0x1101c6;})['then'](respondWithResult(_0x53aab2,0xc9))[_0x366f('0x42')](handleError(_0x53aab2,null));};exports[_0x366f('0x21')]=function(_0xc61c4f,_0x1216ba){if(_0xc61c4f[_0x366f('0x51')]['id']){delete _0xc61c4f[_0x366f('0x51')]['id'];}return db[_0x366f('0x45')][_0x366f('0x48')]({'where':{'id':_0xc61c4f['params']['id']}})['then'](handleEntityNotFound(_0x1216ba,null))[_0x366f('0x22')](saveUpdates(_0xc61c4f[_0x366f('0x51')],null))[_0x366f('0x22')](respondWithResult(_0x1216ba,null))[_0x366f('0x42')](handleError(_0x1216ba,null));};exports['destroy']=function(_0x3b5730,_0x2766cc){return db[_0x366f('0x45')][_0x366f('0x48')]({'where':{'id':_0x3b5730['params']['id']}})['then'](handleEntityNotFound(_0x2766cc,null))[_0x366f('0x22')](removeEntity(_0x2766cc,null))[_0x366f('0x42')](handleError(_0x2766cc,null));}; \ No newline at end of file +var _0x212f=['findAll','rows','show','include','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','Variable','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x3b4a6c,_0x5721d6){var _0xa9768b=function(_0x2a6584){while(--_0x2a6584){_0x3b4a6c['push'](_0x3b4a6c['shift']());}};_0xa9768b(++_0x5721d6);}(_0x212f,0x160));var _0xf212=function(_0x3dadc6,_0x129208){_0x3dadc6=_0x3dadc6-0x0;var _0x3994fb=_0x212f[_0x3dadc6];return _0x3994fb;};'use strict';var emlformat=require(_0xf212('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf212('0x1'));var jsonpatch=require(_0xf212('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf212('0x3'));var Mustache=require(_0xf212('0x4'));var util=require(_0xf212('0x5'));var path=require(_0xf212('0x6'));var sox=require(_0xf212('0x7'));var csv=require(_0xf212('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf212('0x9'));var _=require(_0xf212('0xa'));var squel=require(_0xf212('0xb'));var crypto=require(_0xf212('0xc'));var jsforce=require(_0xf212('0xd'));var deskjs=require(_0xf212('0xe'));var toCsv=require(_0xf212('0x8'));var querystring=require(_0xf212('0xf'));var Papa=require('papaparse');var Redis=require(_0xf212('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf212('0x11'));var as=require(_0xf212('0x12'));var hardwareService=require(_0xf212('0x13'));var logger=require('../../config/logger')(_0xf212('0x14'));var utils=require(_0xf212('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf212('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d3c1a,_0x5236d2){_0x5236d2=_0x5236d2||0xcc;return function(_0x40239c){if(_0x40239c){return _0x1d3c1a[_0xf212('0x17')](_0x5236d2);}return _0x1d3c1a[_0xf212('0x18')](_0x5236d2)[_0xf212('0x19')]();};}function respondWithResult(_0xb798b,_0xf22795){_0xf22795=_0xf22795||0xc8;return function(_0x3c180c){if(_0x3c180c){return _0xb798b[_0xf212('0x18')](_0xf22795)[_0xf212('0x1a')](_0x3c180c);}};}function respondWithFilteredResult(_0x39f63a,_0x14a474){return function(_0x1ecef1){if(_0x1ecef1){var _0x32b5d7=typeof _0x14a474['offset']==='undefined'&&typeof _0x14a474[_0xf212('0x1b')]===_0xf212('0x1c');var _0x116c5c=_0x1ecef1['count'];var _0x558ac5=_0x32b5d7?0x0:_0x14a474[_0xf212('0x1d')];var _0x4cb61d=_0x32b5d7?_0x1ecef1[_0xf212('0x1e')]:_0x14a474[_0xf212('0x1d')]+_0x14a474[_0xf212('0x1b')];var _0x2e39dd;if(_0x4cb61d>=_0x116c5c){_0x4cb61d=_0x116c5c;_0x2e39dd=0xc8;}else{_0x2e39dd=0xce;}_0x39f63a[_0xf212('0x18')](_0x2e39dd);return _0x39f63a[_0xf212('0x1f')](_0xf212('0x20'),_0x558ac5+'-'+_0x4cb61d+'/'+_0x116c5c)[_0xf212('0x1a')](_0x1ecef1);}return null;};}function patchUpdates(_0x54b53c){return function(_0x3f67ca){try{jsonpatch[_0xf212('0x21')](_0x3f67ca,_0x54b53c,!![]);}catch(_0x19175f){return BPromise[_0xf212('0x22')](_0x19175f);}return _0x3f67ca['save']();};}function saveUpdates(_0x3f8536,_0x1ff784){return function(_0x5d70a2){if(_0x5d70a2){return _0x5d70a2[_0xf212('0x23')](_0x3f8536)[_0xf212('0x24')](function(_0x39d44f){return _0x39d44f;});}return null;};}function removeEntity(_0x16c6b3,_0x133475){return function(_0x1e71d1){if(_0x1e71d1){return _0x1e71d1['destroy']()[_0xf212('0x24')](function(){var _0x25b2be=_0x1e71d1[_0xf212('0x25')]({'plain':!![]});var _0x55aa26=_0xf212('0x26');return db[_0xf212('0x27')][_0xf212('0x28')]({'where':{'type':_0x55aa26,'resourceId':_0x25b2be['id']}})[_0xf212('0x24')](function(){return _0x1e71d1;});})['then'](function(){_0x16c6b3['status'](0xcc)[_0xf212('0x19')]();});}};}function handleEntityNotFound(_0x4a5b8a,_0x5139e9){return function(_0x48a485){if(!_0x48a485){_0x4a5b8a[_0xf212('0x17')](0x194);}return _0x48a485;};}function handleError(_0x1f60ed,_0x59ae62){_0x59ae62=_0x59ae62||0x1f4;return function(_0x1be8b8){logger[_0xf212('0x29')](_0x1be8b8[_0xf212('0x2a')]);if(_0x1be8b8[_0xf212('0x2b')]){delete _0x1be8b8[_0xf212('0x2b')];}_0x1f60ed[_0xf212('0x18')](_0x59ae62)[_0xf212('0x2c')](_0x1be8b8);};}exports['index']=function(_0x4c5004,_0x21cbd7){var _0x72c0ef={},_0x2f926c={},_0x50b863={'count':0x0,'rows':[]};var _0x3696f1=_['map'](db[_0xf212('0x2d')][_0xf212('0x2e')],function(_0x135be0){return{'name':_0x135be0[_0xf212('0x2f')],'type':_0x135be0[_0xf212('0x30')][_0xf212('0x31')]};});_0x2f926c[_0xf212('0x32')]=_[_0xf212('0x33')](_0x3696f1,'name');_0x2f926c['query']=_[_0xf212('0x34')](_0x4c5004[_0xf212('0x35')]);_0x2f926c[_0xf212('0x36')]=_[_0xf212('0x37')](_0x2f926c['model'],_0x2f926c['query']);_0x72c0ef[_0xf212('0x38')]=_[_0xf212('0x37')](_0x2f926c[_0xf212('0x32')],qs['fields'](_0x4c5004[_0xf212('0x35')][_0xf212('0x39')]));_0x72c0ef[_0xf212('0x38')]=_0x72c0ef[_0xf212('0x38')][_0xf212('0x3a')]?_0x72c0ef['attributes']:_0x2f926c[_0xf212('0x32')];if(!_0x4c5004[_0xf212('0x35')][_0xf212('0x3b')](_0xf212('0x3c'))){_0x72c0ef[_0xf212('0x1b')]=qs[_0xf212('0x1b')](_0x4c5004[_0xf212('0x35')][_0xf212('0x1b')]);_0x72c0ef[_0xf212('0x1d')]=qs[_0xf212('0x1d')](_0x4c5004[_0xf212('0x35')][_0xf212('0x1d')]);}_0x72c0ef[_0xf212('0x3d')]=qs[_0xf212('0x3e')](_0x4c5004[_0xf212('0x35')][_0xf212('0x3e')]);_0x72c0ef['where']=qs[_0xf212('0x36')](_[_0xf212('0x3f')](_0x4c5004[_0xf212('0x35')],_0x2f926c[_0xf212('0x36')]),_0x3696f1);if(_0x4c5004[_0xf212('0x35')][_0xf212('0x40')]){_0x72c0ef[_0xf212('0x41')]=_[_0xf212('0x42')](_0x72c0ef[_0xf212('0x41')],{'$or':_[_0xf212('0x33')](_0x3696f1,function(_0x242fb8){if(_0x242fb8[_0xf212('0x30')]!==_0xf212('0x43')){var _0x1d5172={};_0x1d5172[_0x242fb8[_0xf212('0x2b')]]={'$like':'%'+_0x4c5004[_0xf212('0x35')][_0xf212('0x40')]+'%'};return _0x1d5172;}})});}_0x72c0ef=_['merge']({},_0x72c0ef,_0x4c5004['options']);var _0x55dc3c={'where':_0x72c0ef[_0xf212('0x41')]};return db[_0xf212('0x2d')][_0xf212('0x1e')](_0x55dc3c)['then'](function(_0x5ace53){_0x50b863[_0xf212('0x1e')]=_0x5ace53;if(_0x4c5004[_0xf212('0x35')]['includeAll']){_0x72c0ef['include']=[{'all':!![]}];}return db[_0xf212('0x2d')][_0xf212('0x44')](_0x72c0ef);})['then'](function(_0x6fbba5){_0x50b863[_0xf212('0x45')]=_0x6fbba5;return _0x50b863;})[_0xf212('0x24')](respondWithFilteredResult(_0x21cbd7,_0x72c0ef))['catch'](handleError(_0x21cbd7,null));};exports[_0xf212('0x46')]=function(_0x31247f,_0x4c660a){var _0x225ce0={'raw':!![],'where':{'id':_0x31247f['params']['id']}},_0x304134={};_0x304134[_0xf212('0x32')]=_[_0xf212('0x34')](db['Variable'][_0xf212('0x2e')]);_0x304134['query']=_[_0xf212('0x34')](_0x31247f['query']);_0x304134[_0xf212('0x36')]=_['intersection'](_0x304134[_0xf212('0x32')],_0x304134[_0xf212('0x35')]);_0x225ce0[_0xf212('0x38')]=_['intersection'](_0x304134[_0xf212('0x32')],qs[_0xf212('0x39')](_0x31247f['query'][_0xf212('0x39')]));_0x225ce0['attributes']=_0x225ce0[_0xf212('0x38')][_0xf212('0x3a')]?_0x225ce0[_0xf212('0x38')]:_0x304134[_0xf212('0x32')];if(_0x31247f[_0xf212('0x35')]['includeAll']){_0x225ce0[_0xf212('0x47')]=[{'all':!![]}];}_0x225ce0=_[_0xf212('0x42')]({},_0x225ce0,_0x31247f[_0xf212('0x48')]);return db['Variable'][_0xf212('0x49')](_0x225ce0)[_0xf212('0x24')](handleEntityNotFound(_0x4c660a,null))[_0xf212('0x24')](respondWithResult(_0x4c660a,null))[_0xf212('0x4a')](handleError(_0x4c660a,null));};exports['create']=function(_0x52c429,_0x259be7){return db[_0xf212('0x2d')][_0xf212('0x4b')](_0x52c429[_0xf212('0x4c')],{})['then'](function(_0xa21816){var _0x25f43c=_0x52c429[_0xf212('0x4d')]['get']({'plain':!![]});if(!_0x25f43c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25f43c[_0xf212('0x4e')]===_0xf212('0x4d')){var _0x472683=_0xa21816[_0xf212('0x25')]({'plain':!![]});var _0x4923d7='Variables';return db[_0xf212('0x4f')][_0xf212('0x49')]({'where':{'name':_0x4923d7,'userProfileId':_0x25f43c[_0xf212('0x50')]},'raw':!![]})[_0xf212('0x24')](function(_0x3b61ce){if(_0x3b61ce&&_0x3b61ce[_0xf212('0x51')]===0x0){return db['UserProfileResource'][_0xf212('0x4b')]({'name':_0x472683['name'],'resourceId':_0x472683['id'],'type':_0x3b61ce[_0xf212('0x2b')],'sectionId':_0x3b61ce['id']},{})[_0xf212('0x24')](function(){return _0xa21816;});}else{return _0xa21816;}})['catch'](function(_0x2d9965){logger[_0xf212('0x29')](_0xf212('0x52'),_0x2d9965);throw _0x2d9965;});}return _0xa21816;})[_0xf212('0x24')](respondWithResult(_0x259be7,0xc9))['catch'](handleError(_0x259be7,null));};exports['update']=function(_0x203a9d,_0x44d196){if(_0x203a9d[_0xf212('0x4c')]['id']){delete _0x203a9d[_0xf212('0x4c')]['id'];}return db[_0xf212('0x2d')][_0xf212('0x49')]({'where':{'id':_0x203a9d[_0xf212('0x53')]['id']}})['then'](handleEntityNotFound(_0x44d196,null))[_0xf212('0x24')](saveUpdates(_0x203a9d[_0xf212('0x4c')],null))[_0xf212('0x24')](respondWithResult(_0x44d196,null))[_0xf212('0x4a')](handleError(_0x44d196,null));};exports[_0xf212('0x28')]=function(_0x2df2f7,_0x4d4581){return db[_0xf212('0x2d')][_0xf212('0x49')]({'where':{'id':_0x2df2f7[_0xf212('0x53')]['id']}})[_0xf212('0x24')](handleEntityNotFound(_0x4d4581,null))['then'](removeEntity(_0x4d4581,null))[_0xf212('0x4a')](handleError(_0x4d4581,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5239b95..8c459de 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 _0xe0ce=['./variable.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x1c83c0,_0x5b83fd){var _0x326639=function(_0x17f1cc){while(--_0x17f1cc){_0x1c83c0['push'](_0x1c83c0['shift']());}};_0x326639(++_0x5b83fd);}(_0xe0ce,0x1b0));var _0xee0c=function(_0x327cbf,_0x114362){_0x327cbf=_0x327cbf-0x0;var _0x409cb8=_0xe0ce[_0x327cbf];return _0x409cb8;};'use strict';var _=require(_0xee0c('0x0'));var util=require(_0xee0c('0x1'));var logger=require(_0xee0c('0x2'))(_0xee0c('0x3'));var moment=require(_0xee0c('0x4'));var BPromise=require(_0xee0c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xee0c('0x6'));var config=require(_0xee0c('0x7'));var attributes=require(_0xee0c('0x8'));module[_0xee0c('0x9')]=function(_0x5caa33,_0x4d3e5a){return _0x5caa33['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x621f=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x621f,0x80));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var util=require(_0xf621('0x1'));var logger=require(_0xf621('0x2'))(_0xf621('0x3'));var moment=require(_0xf621('0x4'));var BPromise=require(_0xf621('0x5'));var rp=require(_0xf621('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf621('0x7'));var config=require('../../config/environment');var attributes=require(_0xf621('0x8'));module[_0xf621('0x9')]=function(_0x5a23e4,_0x4e0574){return _0x5a23e4[_0xf621('0xa')](_0xf621('0xb'),attributes,{'tableName':_0xf621('0xc'),'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 bb36354..d3f96a5 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1d69ba,_0x4090c9){var _0x8bab8c=function(_0x33ce38){while(--_0x33ce38){_0x1d69ba['push'](_0x1d69ba['shift']());}};_0x8bab8c(++_0x4090c9);}(_0x8ef6,0xf2));var _0x68ef=function(_0xef9522,_0x20a893){_0xef9522=_0xef9522-0x0;var _0xef9569=_0x8ef6[_0xef9522];return _0xef9569;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x36ea79,_0x19ad3f){var _0x19ea3a=function(_0x3c8821){while(--_0x3c8821){_0x36ea79['push'](_0x36ea79['shift']());}};_0x19ea3a(++_0x19ad3f);}(_0x6aa7,0x178));var _0x76aa=function(_0x276c5c,_0x3e5c1f){_0x276c5c=_0x276c5c-0x0;var _0x1d6b23=_0x6aa7[_0x276c5c];return _0x1d6b23;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 62c38d1..bf4cc7d 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 _0x62fa=['canUpdate','reset','/pull','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch'];(function(_0x47f23d,_0x567e66){var _0x4e08f9=function(_0x296189){while(--_0x296189){_0x47f23d['push'](_0x47f23d['shift']());}};_0x4e08f9(++_0x567e66);}(_0x62fa,0x7f));var _0xa62f=function(_0x34bbe3,_0x28d122){_0x34bbe3=_0x34bbe3-0x0;var _0x4301aa=_0x62fa[_0x34bbe3];return _0x4301aa;};'use strict';var express=require('express');var router=express[_0xa62f('0x0')]();var auth=require(_0xa62f('0x1'));var controller=require(_0xa62f('0x2'));router[_0xa62f('0x3')]('/',controller[_0xa62f('0x4')]);router[_0xa62f('0x3')](_0xa62f('0x5'),auth[_0xa62f('0x6')](),auth['canUpdate'](),controller[_0xa62f('0x7')]);router['get']('/reset',auth['isAuthenticated'](),auth[_0xa62f('0x8')](),controller[_0xa62f('0x9')]);router['get'](_0xa62f('0xa'),auth[_0xa62f('0x6')](),auth['canUpdate'](),controller['pull']);router[_0xa62f('0x3')]('/restart',auth[_0xa62f('0x6')](),controller[_0xa62f('0xb')]);router['get'](_0xa62f('0xc'),controller[_0xa62f('0xd')]);module[_0xa62f('0xe')]=router; \ No newline at end of file +var _0x0c2c=['index','get','/fetch','isAuthenticated','canUpdate','reset','/pull','pull','/restart','/migrations','migrations','Router','./version.controller'];(function(_0x148b59,_0x4e5c5b){var _0x2b9f56=function(_0x431e57){while(--_0x431e57){_0x148b59['push'](_0x148b59['shift']());}};_0x2b9f56(++_0x4e5c5b);}(_0x0c2c,0xb4));var _0xc0c2=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x0c2c[_0x19a49f];return _0x5351ae;};'use strict';var express=require('express');var router=express[_0xc0c2('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc0c2('0x1'));router['get']('/',controller[_0xc0c2('0x2')]);router[_0xc0c2('0x3')](_0xc0c2('0x4'),auth[_0xc0c2('0x5')](),auth[_0xc0c2('0x6')](),controller['fetch']);router[_0xc0c2('0x3')]('/reset',auth['isAuthenticated'](),auth[_0xc0c2('0x6')](),controller[_0xc0c2('0x7')]);router[_0xc0c2('0x3')](_0xc0c2('0x8'),auth['isAuthenticated'](),auth[_0xc0c2('0x6')](),controller[_0xc0c2('0x9')]);router['get'](_0xc0c2('0xa'),auth[_0xc0c2('0x5')](),controller['restart']);router['get'](_0xc0c2('0xb'),controller[_0xc0c2('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9d1cc8f..9d53679 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 _0x76c3=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','push','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','version','latest','tags','2.0.0','json','status','fetch','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','then'];(function(_0x95b44e,_0x4af5e1){var _0x4d33ea=function(_0x35acd6){while(--_0x35acd6){_0x95b44e['push'](_0x95b44e['shift']());}};_0x4d33ea(++_0x4af5e1);}(_0x76c3,0x114));var _0x376c=function(_0x28d23d,_0x186bca){_0x28d23d=_0x28d23d-0x0;var _0x539fc0=_0x76c3[_0x28d23d];return _0x539fc0;};'use strict';var Umzug=require(_0x376c('0x0'));var path=require(_0x376c('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x376c('0x2'))(module,'version');var compareVersions=require(_0x376c('0x3'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x376c('0x4'));var pm2=require(_0x376c('0x5'));var logger=require(_0x376c('0x6'))(_0x376c('0x7'));var git=require('simple-git')(config[_0x376c('0x8')]);exports[_0x376c('0x9')]=function(_0x535289,_0xbbdb4e){var _0x375ebb={'current':module[_0x376c('0xa')][_0x376c('0xb')],'phonebar':0x2};if(_0x535289['query']&&_0x535289['query'][_0x376c('0xc')]){return git['fetch']()[_0x376c('0xd')](function(_0x3c46c3,_0x28d4bb){_0x375ebb['latest']=(_0x3c46c3?module['exports'][_0x376c('0xb')]:_0x28d4bb['latest'])||_0x376c('0xe');return _0xbbdb4e['status'](0xc8)[_0x376c('0xf')](_0x375ebb);});}else{return _0xbbdb4e[_0x376c('0x10')](0xc8)[_0x376c('0xf')](_0x375ebb);}};exports[_0x376c('0x11')]=function(_0x1ca8ee,_0x459b12){return git[_0x376c('0x11')]([_0x376c('0x12'),_0x376c('0x13')],function(_0x3ef784){if(_0x3ef784){logger[_0x376c('0x14')](_0x3ef784);return _0x459b12[_0x376c('0x10')](0x1f4)['json'](_0x3ef784);}logger[_0x376c('0x15')](_0x376c('0x16'));return _0x459b12[_0x376c('0x10')](0xc8)[_0x376c('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x376c('0x17')]=function(_0x24a792,_0x5571fd){return git['reset']([_0x376c('0x18'),_0x376c('0x19')],function(_0x1d39fe){if(_0x1d39fe){logger[_0x376c('0x14')](_0x1d39fe);return _0x5571fd[_0x376c('0x10')](0x1f4)[_0x376c('0xf')](_0x1d39fe);}logger[_0x376c('0x15')](_0x376c('0x1a'));return _0x5571fd[_0x376c('0x10')](0xc8)[_0x376c('0xf')]({'output':_0x376c('0x1b')});});};exports['pull']=function(_0x4a3acc,_0x4112f6){exec('npm\x20install\x20--production',function(_0x265b24,_0x321a12,_0x18de06){logger['info'](_0x321a12);logger['info'](_0x18de06);if(_0x265b24){logger[_0x376c('0x14')](_0x265b24);return _0x4112f6[_0x376c('0x10')](0x1f4)[_0x376c('0xf')](_0x265b24);}return _0x4112f6['status'](0xc8)['json']({'output':_0x321a12});});};exports[_0x376c('0x1c')]=function(_0x4a4f71,_0x436012){return pm2[_0x376c('0x1c')]('motion2')[_0x376c('0x1d')](function(_0x18e429){logger[_0x376c('0x15')](_0x376c('0x1e'),_0x18e429);return _0x436012['status'](0xc8)['json']({'output':_0x376c('0x1f')});})[_0x376c('0x20')](function(_0x57eeb9){logger[_0x376c('0x14')](_0x57eeb9);return _0x436012[_0x376c('0x10')](0x1f4)[_0x376c('0xf')](_0x57eeb9);});};exports[_0x376c('0x21')]=function(_0x5f3b24,_0x4bbca5){var _0x171b8c=fs[_0x376c('0x22')](path['join'](config[_0x376c('0x8')],_0x376c('0x23'),_0x376c('0x21')));var _0x34148f=[];for(var _0x4ac684=0x0;_0x4ac684<_0x171b8c[_0x376c('0x24')];_0x4ac684++){var _0x5cefb7=_0x171b8c[_0x4ac684][_0x376c('0x25')]('.js','');if(compareVersions(module[_0x376c('0xa')]['version'],_0x5cefb7)===-0x1){_0x34148f[_0x376c('0x26')](_0x5cefb7);}}if(_0x34148f[_0x376c('0x24')]){var _0x10ad51=_0x34148f['sort'](compareVersions);var _0x4b13a7=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x376c('0x27')],'modelName':_0x376c('0x27'),'columnName':_0x376c('0xb')},'migrations':{'params':[db[_0x376c('0x28')][_0x376c('0x29')](),db[_0x376c('0x28')][_0x376c('0x2a')],function(){throw new Error(_0x376c('0x2b'));}],'path':path[_0x376c('0x2c')](config[_0x376c('0x8')],_0x376c('0x23'),_0x376c('0x21')),'pattern':/\.js$/}});_0x4b13a7['up']({'migrations':_['map'](_0x10ad51,function(_0x27bd6c){return _0x27bd6c+_0x376c('0x2d');})})['then'](function(){return _0x4bbca5[_0x376c('0x10')](0xc8)['json']({'output':_0x376c('0x2e')+module['exports'][_0x376c('0xb')]+_0x376c('0x2f')+_[_0x376c('0x30')](_0x10ad51),'migrations':_[_0x376c('0x2c')](_0x10ad51)});})['catch'](function(_0x17efc3){if(_0x17efc3 instanceof db['sequelize'][_0x376c('0x31')]){return _0x4bbca5[_0x376c('0x10')](0xc8)[_0x376c('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4bbca5['status'](0x1f4)[_0x376c('0xf')](_0x17efc3);}});}else{return _0x4bbca5[_0x376c('0x10')](0xc8)[_0x376c('0xf')]({'output':_0x376c('0x32')});}}; \ No newline at end of file +var _0xaa75=['then','pm2\x20restart\x20motion\x20%s','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','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','exports','version','query','latest','tags','2.0.0','status','json','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2'];(function(_0x4c2eb8,_0x331297){var _0x284044=function(_0x5ae927){while(--_0x5ae927){_0x4c2eb8['push'](_0x4c2eb8['shift']());}};_0x284044(++_0x331297);}(_0xaa75,0x165));var _0x5aa7=function(_0x3045d5,_0x447aab){_0x3045d5=_0x3045d5-0x0;var _0x1cd5ee=_0xaa75[_0x3045d5];return _0x1cd5ee;};'use strict';var Umzug=require(_0x5aa7('0x0'));var path=require(_0x5aa7('0x1'));var fs=require('fs');var _=require(_0x5aa7('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x5aa7('0x3'));var exec=require(_0x5aa7('0x4'))[_0x5aa7('0x5')];var db=require(_0x5aa7('0x6'))['db'];var config=require(_0x5aa7('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x5aa7('0x8'))('update');var git=require(_0x5aa7('0x9'))(config[_0x5aa7('0xa')]);exports[_0x5aa7('0xb')]=function(_0x50144a,_0x5d5d52){var _0x334b0a={'current':module[_0x5aa7('0xc')][_0x5aa7('0xd')],'phonebar':0x2};if(_0x50144a[_0x5aa7('0xe')]&&_0x50144a['query'][_0x5aa7('0xf')]){return git['fetch']()[_0x5aa7('0x10')](function(_0x2cf09f,_0x436821){_0x334b0a[_0x5aa7('0xf')]=(_0x2cf09f?module[_0x5aa7('0xc')][_0x5aa7('0xd')]:_0x436821[_0x5aa7('0xf')])||_0x5aa7('0x11');return _0x5d5d52[_0x5aa7('0x12')](0xc8)[_0x5aa7('0x13')](_0x334b0a);});}else{return _0x5d5d52[_0x5aa7('0x12')](0xc8)[_0x5aa7('0x13')](_0x334b0a);}};exports[_0x5aa7('0x14')]=function(_0x145f26,_0x5cbfaf){return git[_0x5aa7('0x14')]([_0x5aa7('0x15'),_0x5aa7('0x16')],function(_0x192dbd){if(_0x192dbd){logger[_0x5aa7('0x17')](_0x192dbd);return _0x5cbfaf['status'](0x1f4)[_0x5aa7('0x13')](_0x192dbd);}logger['info'](_0x5aa7('0x18'));return _0x5cbfaf[_0x5aa7('0x12')](0xc8)[_0x5aa7('0x13')]({'output':_0x5aa7('0x19')});});};exports[_0x5aa7('0x1a')]=function(_0x530a18,_0x291334){return git[_0x5aa7('0x1a')](['--hard',_0x5aa7('0x1b')],function(_0x3a9f18){if(_0x3a9f18){logger[_0x5aa7('0x17')](_0x3a9f18);return _0x291334[_0x5aa7('0x12')](0x1f4)['json'](_0x3a9f18);}logger['info'](_0x5aa7('0x1c'));return _0x291334[_0x5aa7('0x12')](0xc8)[_0x5aa7('0x13')]({'output':_0x5aa7('0x1d')});});};exports[_0x5aa7('0x1e')]=function(_0x354b40,_0x396b82){exec(_0x5aa7('0x1f'),function(_0x200cb4,_0x343811,_0x5754a0){logger[_0x5aa7('0x20')](_0x343811);logger[_0x5aa7('0x20')](_0x5754a0);if(_0x200cb4){logger[_0x5aa7('0x17')](_0x200cb4);return _0x396b82['status'](0x1f4)[_0x5aa7('0x13')](_0x200cb4);}return _0x396b82[_0x5aa7('0x12')](0xc8)[_0x5aa7('0x13')]({'output':_0x343811});});};exports[_0x5aa7('0x21')]=function(_0x1f766a,_0x5464d2){return pm2['restart'](_0x5aa7('0x22'))[_0x5aa7('0x23')](function(_0x370923){logger[_0x5aa7('0x20')](_0x5aa7('0x24'),_0x370923);return _0x5464d2[_0x5aa7('0x12')](0xc8)[_0x5aa7('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x5aa7('0x25')](function(_0xf0d23b){logger[_0x5aa7('0x17')](_0xf0d23b);return _0x5464d2[_0x5aa7('0x12')](0x1f4)['json'](_0xf0d23b);});};exports[_0x5aa7('0x26')]=function(_0x31ab5c,_0x37a426){var _0x20185a=fs[_0x5aa7('0x27')](path[_0x5aa7('0x28')](config['root'],_0x5aa7('0x29'),_0x5aa7('0x26')));var _0xaa5151=[];for(var _0x526070=0x0;_0x526070<_0x20185a[_0x5aa7('0x2a')];_0x526070++){var _0x197a91=_0x20185a[_0x526070][_0x5aa7('0x2b')](_0x5aa7('0x2c'),'');if(compareVersions(module[_0x5aa7('0xc')]['version'],_0x197a91)===-0x1){_0xaa5151[_0x5aa7('0x2d')](_0x197a91);}}if(_0xaa5151[_0x5aa7('0x2a')]){var _0x56fa3e=_0xaa5151['sort'](compareVersions);var _0x59693d=new Umzug({'storage':_0x5aa7('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':_0x5aa7('0x2f'),'columnName':'version'},'migrations':{'params':[db[_0x5aa7('0x2e')][_0x5aa7('0x30')](),db[_0x5aa7('0x2e')][_0x5aa7('0x31')],function(){throw new Error(_0x5aa7('0x32'));}],'path':path[_0x5aa7('0x28')](config['root'],'server',_0x5aa7('0x26')),'pattern':/\.js$/}});_0x59693d['up']({'migrations':_[_0x5aa7('0x33')](_0x56fa3e,function(_0x38dbd1){return _0x38dbd1+_0x5aa7('0x2c');})})[_0x5aa7('0x23')](function(){return _0x37a426[_0x5aa7('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x5aa7('0xd')]+_0x5aa7('0x34')+_[_0x5aa7('0x35')](_0x56fa3e),'migrations':_[_0x5aa7('0x28')](_0x56fa3e)});})[_0x5aa7('0x25')](function(_0x73116d){if(_0x73116d instanceof db[_0x5aa7('0x2e')][_0x5aa7('0x36')]){return _0x37a426[_0x5aa7('0x12')](0xc8)['json']({'output':_0x5aa7('0x37')});}else{return _0x37a426[_0x5aa7('0x12')](0x1f4)[_0x5aa7('0x13')](_0x73116d);}});}else{return _0x37a426[_0x5aa7('0x12')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7643f06..c3d2efc 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 _0xc3ae=['get','/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0xc3ae,0xdc));var _0xec3a=function(_0x138e40,_0x3479bf){_0x138e40=_0x138e40-0x0;var _0x10384b=_0xc3ae[_0x138e40];return _0x10384b;};'use strict';var multer=require(_0xec3a('0x0'));var util=require(_0xec3a('0x1'));var path=require(_0xec3a('0x2'));var timeout=require(_0xec3a('0x3'));var express=require('express');var router=express[_0xec3a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xec3a('0x5'));var interaction=require(_0xec3a('0x6'));var config=require(_0xec3a('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xec3a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec3a('0x8')](_0xec3a('0x9'),auth[_0xec3a('0xa')](),controller[_0xec3a('0xb')]);router[_0xec3a('0x8')](_0xec3a('0xc'),auth[_0xec3a('0xa')](),controller['show']);router[_0xec3a('0xd')]('/',auth[_0xec3a('0xa')](),controller['create']);router[_0xec3a('0xe')]('/:id',auth[_0xec3a('0xa')](),controller[_0xec3a('0xf')]);router[_0xec3a('0x10')]('/:id',auth[_0xec3a('0xa')](),controller[_0xec3a('0x11')]);module[_0xec3a('0x12')]=router; \ No newline at end of file +var _0x1d89=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x1d89,0x176));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x91d8('0x0'));var path=require(_0x91d8('0x1'));var timeout=require(_0x91d8('0x2'));var express=require(_0x91d8('0x3'));var router=express[_0x91d8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91d8('0x5'));var interaction=require(_0x91d8('0x6'));var config=require(_0x91d8('0x7'));var controller=require(_0x91d8('0x8'));router[_0x91d8('0x9')]('/',auth[_0x91d8('0xa')](),controller[_0x91d8('0xb')]);router['get'](_0x91d8('0xc'),auth[_0x91d8('0xa')](),controller[_0x91d8('0xd')]);router[_0x91d8('0x9')](_0x91d8('0xe'),auth['isAuthenticated'](),controller[_0x91d8('0xf')]);router[_0x91d8('0x10')]('/',auth[_0x91d8('0xa')](),controller['create']);router[_0x91d8('0x11')](_0x91d8('0xe'),auth['isAuthenticated'](),controller[_0x91d8('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x91d8('0x13')]);module[_0x91d8('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 8094cd2..4412919 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 _0x3014=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x24f988,_0x4ec3dc){var _0x3c0c17=function(_0x335950){while(--_0x335950){_0x24f988['push'](_0x24f988['shift']());}};_0x3c0c17(++_0x4ec3dc);}(_0x3014,0x1d7));var _0x4301=function(_0x583c24,_0x515768){_0x583c24=_0x583c24-0x0;var _0x493609=_0x3014[_0x583c24];return _0x493609;};'use strict';var Sequelize=require(_0x4301('0x0'));module[_0x4301('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4301('0x2')]},'calleridnum':{'type':Sequelize[_0x4301('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4301('0x2')]},'membername':{'type':Sequelize[_0x4301('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4301('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4301('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4301('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4301('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4301('0x3')]},'holdtime':{'type':Sequelize[_0x4301('0x4')]},'agentcomplete':{'type':Sequelize[_0x4301('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4301('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4301('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4301('0x4')]},'reason':{'type':Sequelize[_0x4301('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4301('0x2')]},'channelstate':{'type':Sequelize[_0x4301('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4301('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4301('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4301('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4301('0x2')]},'exten':{'type':Sequelize[_0x4301('0x2')]},'priority':{'type':Sequelize[_0x4301('0x2')]},'destchannel':{'type':Sequelize[_0x4301('0x2')]},'destchannelstate':{'type':Sequelize[_0x4301('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4301('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4301('0x2')]},'destcalleridname':{'type':Sequelize[_0x4301('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4301('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4301('0x2')]},'destlanguage':{'type':Sequelize[_0x4301('0x2')]},'destaccountcode':{'type':Sequelize[_0x4301('0x2')]},'destcontext':{'type':Sequelize[_0x4301('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4301('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4301('0x2')]},'transfer':{'type':Sequelize[_0x4301('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4301('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4301('0x2')]},'agententerreason':{'type':Sequelize[_0x4301('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7708=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x7708,0x188));var _0x8770=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x7708[_0x17c483];return _0x112bdb;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8770('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8770('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8770('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x8770('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x8770('0x3')]},'holdtime':{'type':Sequelize[_0x8770('0x4')]},'agentcomplete':{'type':Sequelize[_0x8770('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8770('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8770('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8770('0x4')]},'agentacw':{'type':Sequelize[_0x8770('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x8770('0x2')]},'lastevent':{'type':Sequelize[_0x8770('0x2')]},'channel':{'type':Sequelize[_0x8770('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8770('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8770('0x2')]},'connectedlinename':{'type':Sequelize[_0x8770('0x2')]},'language':{'type':Sequelize[_0x8770('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8770('0x2')]},'exten':{'type':Sequelize[_0x8770('0x2')]},'priority':{'type':Sequelize[_0x8770('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8770('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8770('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8770('0x2')]},'destcalleridname':{'type':Sequelize[_0x8770('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8770('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x8770('0x2')]},'destlanguage':{'type':Sequelize[_0x8770('0x2')]},'destaccountcode':{'type':Sequelize[_0x8770('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8770('0x2')]},'destpriority':{'type':Sequelize[_0x8770('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8770('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x8770('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x8770('0x2')]},'agententerreason':{'type':Sequelize[_0x8770('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 0f5f4e0..8d31bdd 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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index b91cd1f..6e3dd1b 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 _0x0763=['path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x973790,_0x5993b8){var _0xa84f7=function(_0x4639b2){while(--_0x4639b2){_0x973790['push'](_0x973790['shift']());}};_0xa84f7(++_0x5993b8);}(_0x0763,0x87));var _0x3076=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x0763[_0x22ee1e];return _0x49a5c9;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var logger=require(_0x3076('0x1'))(_0x3076('0x2'));var moment=require('moment');var BPromise=require(_0x3076('0x3'));var rp=require(_0x3076('0x4'));var fs=require('fs');var path=require(_0x3076('0x5'));var rimraf=require(_0x3076('0x6'));var config=require('../../config/environment');var attributes=require(_0x3076('0x7'));module[_0x3076('0x8')]=function(_0x1ce2ff,_0x1b5f4e){return _0x1ce2ff[_0x3076('0x9')](_0x3076('0xa'),attributes,{'tableName':_0x3076('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3076('0xc'),_0x3076('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6596=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceAgentReport','destuniqueid','lodash'];(function(_0x557ac9,_0x313e13){var _0x30e5bc=function(_0x4ce033){while(--_0x4ce033){_0x557ac9['push'](_0x557ac9['shift']());}};_0x30e5bc(++_0x313e13);}(_0x6596,0x1d3));var _0x6659=function(_0x55a12d,_0x258c0f){_0x55a12d=_0x55a12d-0x0;var _0x148fd1=_0x6596[_0x55a12d];return _0x148fd1;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var logger=require('../../config/logger')(_0x6659('0x2'));var moment=require(_0x6659('0x3'));var BPromise=require(_0x6659('0x4'));var rp=require(_0x6659('0x5'));var fs=require('fs');var path=require(_0x6659('0x6'));var rimraf=require(_0x6659('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x6659('0x8')]=function(_0x3091f1,_0xd6bf59){return _0x3091f1[_0x6659('0x9')](_0x6659('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x6659('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index fa10c4b..1a0ced7 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 _0x2513=['error','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','then','update','body','raw','where','attributes','limit','UpdateVoiceAgentReport','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x2513,0xab));var _0x3251=function(_0x436b99,_0x5eeb86){_0x436b99=_0x436b99-0x0;var _0x2829a6=_0x2513[_0x436b99];return _0x2829a6;};'use strict';var _=require(_0x3251('0x0'));var util=require(_0x3251('0x1'));var moment=require(_0x3251('0x2'));var BPromise=require('bluebird');var rs=require(_0x3251('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3251('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3251('0x5'))('rpc');var config=require(_0x3251('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3251('0x7')][_0x3251('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f9ebe,_0x494241,_0x13334e){return new BPromise(function(_0x8b9684,_0x23ba20){return client['request'](_0x3f9ebe,_0x13334e)['then'](function(_0x3b32a6){logger[_0x3251('0x9')](_0x3251('0xa'),_0x494241,_0x3251('0xb'));logger[_0x3251('0xc')](_0x3251('0xd'),_0x494241,_0x3251('0xb'),JSON[_0x3251('0xe')](_0x3b32a6));if(_0x3b32a6[_0x3251('0xf')]){if(_0x3b32a6['error']['code']===0x1f4){logger[_0x3251('0xf')](_0x3251('0xa'),_0x494241,_0x3b32a6[_0x3251('0xf')]['message']);return _0x23ba20(_0x3b32a6[_0x3251('0xf')][_0x3251('0x10')]);}logger[_0x3251('0xf')](_0x3251('0xa'),_0x494241,_0x3b32a6[_0x3251('0xf')][_0x3251('0x10')]);return _0x8b9684(_0x3b32a6[_0x3251('0xf')][_0x3251('0x10')]);}else{logger[_0x3251('0x9')](_0x3251('0xa'),_0x494241,_0x3251('0xb'));_0x8b9684(_0x3b32a6[_0x3251('0x11')]['message']);}})['catch'](function(_0x4981b5){logger['error'](_0x3251('0xa'),_0x494241,_0x4981b5);_0x23ba20(_0x4981b5);});});}exports[_0x3251('0x12')]=function(_0x553a89){var _0x4d2bfe=this;return new Promise(function(_0x522048,_0x3b86ca){return db[_0x3251('0x13')][_0x3251('0x14')](_0x553a89['body'],{'raw':_0x553a89[_0x3251('0x15')]?_0x553a89[_0x3251('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x3251('0x16')](function(_0x3800f7){logger[_0x3251('0x9')](_0x3251('0x12'),_0x553a89);logger[_0x3251('0xc')]('CreateVoiceAgentReport',_0x553a89,JSON[_0x3251('0xe')](_0x3800f7));_0x522048(_0x3800f7);})['catch'](function(_0x37fe53){logger['error'](_0x3251('0x12'),_0x37fe53['message'],_0x553a89);_0x3b86ca(_0x4d2bfe[_0x3251('0xf')](0x1f4,_0x37fe53['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x4115b4){var _0x3adf47=this;return new Promise(function(_0x5ddc8c,_0x46effb){return db[_0x3251('0x13')][_0x3251('0x17')](_0x4115b4[_0x3251('0x18')],{'raw':_0x4115b4[_0x3251('0x15')]?_0x4115b4['options'][_0x3251('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4115b4[_0x3251('0x15')]?_0x4115b4[_0x3251('0x15')][_0x3251('0x1a')]||null:null,'attributes':_0x4115b4[_0x3251('0x15')]?_0x4115b4[_0x3251('0x15')][_0x3251('0x1b')]||null:null,'limit':_0x4115b4[_0x3251('0x15')]?_0x4115b4[_0x3251('0x15')][_0x3251('0x1c')]||null:null})[_0x3251('0x16')](function(_0x46d821){logger[_0x3251('0x9')](_0x3251('0x1d'),_0x4115b4);logger[_0x3251('0xc')](_0x3251('0x1d'),_0x4115b4,JSON[_0x3251('0xe')](_0x46d821));_0x5ddc8c(_0x46d821);})[_0x3251('0x1e')](function(_0x45fe1a){logger[_0x3251('0xf')]('UpdateVoiceAgentReport',_0x45fe1a[_0x3251('0x10')],_0x4115b4);_0x46effb(_0x3adf47['error'](0x1f4,_0x45fe1a[_0x3251('0x10')]));});});}; \ No newline at end of file +var _0x1fe0=['http','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','request\x20sent','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','catch','UpdateVoiceAgentReport','update','raw','where','limit','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x223682,_0x1d1b74){var _0xb6ef3d=function(_0x136635){while(--_0x136635){_0x223682['push'](_0x223682['shift']());}};_0xb6ef3d(++_0x1d1b74);}(_0x1fe0,0x1b0));var _0x01fe=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x1fe0[_0x1a72f3];return _0x57ef47;};'use strict';var _=require('lodash');var util=require(_0x01fe('0x0'));var moment=require(_0x01fe('0x1'));var BPromise=require(_0x01fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01fe('0x3'));var db=require(_0x01fe('0x4'))['db'];var utils=require(_0x01fe('0x5'));var logger=require('../../config/logger')(_0x01fe('0x6'));var config=require(_0x01fe('0x7'));var jayson=require(_0x01fe('0x8'));var client=jayson[_0x01fe('0x9')][_0x01fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ba9e1,_0x372add,_0x295a83){return new BPromise(function(_0x199a32,_0x43b36e){return client[_0x01fe('0xb')](_0x1ba9e1,_0x295a83)[_0x01fe('0xc')](function(_0x5495c4){logger[_0x01fe('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x372add,'request\x20sent');logger[_0x01fe('0xe')](_0x01fe('0xf'),_0x372add,'request\x20sent',JSON['stringify'](_0x5495c4));if(_0x5495c4[_0x01fe('0x10')]){if(_0x5495c4['error'][_0x01fe('0x11')]===0x1f4){logger['error'](_0x01fe('0x12'),_0x372add,_0x5495c4['error']['message']);return _0x43b36e(_0x5495c4[_0x01fe('0x10')][_0x01fe('0x13')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x372add,_0x5495c4[_0x01fe('0x10')]['message']);return _0x199a32(_0x5495c4[_0x01fe('0x10')][_0x01fe('0x13')]);}else{logger[_0x01fe('0xd')](_0x01fe('0x12'),_0x372add,_0x01fe('0x14'));_0x199a32(_0x5495c4[_0x01fe('0x15')]['message']);}})['catch'](function(_0x23ffb0){logger[_0x01fe('0x10')](_0x01fe('0x12'),_0x372add,_0x23ffb0);_0x43b36e(_0x23ffb0);});});}exports[_0x01fe('0x16')]=function(_0x1d4abc){var _0x5c90b2=this;return new Promise(function(_0x3e69dc,_0x1c52ac){return db[_0x01fe('0x17')][_0x01fe('0x18')](_0x1d4abc[_0x01fe('0x19')],{'raw':_0x1d4abc[_0x01fe('0x1a')]?_0x1d4abc[_0x01fe('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x18f0a4){logger['info'](_0x01fe('0x16'),_0x1d4abc);logger['debug'](_0x01fe('0x16'),_0x1d4abc,JSON['stringify'](_0x18f0a4));_0x3e69dc(_0x18f0a4);})[_0x01fe('0x1b')](function(_0x6d2103){logger[_0x01fe('0x10')]('CreateVoiceAgentReport',_0x6d2103[_0x01fe('0x13')],_0x1d4abc);_0x1c52ac(_0x5c90b2[_0x01fe('0x10')](0x1f4,_0x6d2103[_0x01fe('0x13')]));});});};exports[_0x01fe('0x1c')]=function(_0x20306c){var _0xc3dbd2=this;return new Promise(function(_0x28810b,_0x4faf7a){return db[_0x01fe('0x17')][_0x01fe('0x1d')](_0x20306c[_0x01fe('0x19')],{'raw':_0x20306c[_0x01fe('0x1a')]?_0x20306c['options'][_0x01fe('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20306c[_0x01fe('0x1a')]?_0x20306c[_0x01fe('0x1a')][_0x01fe('0x1f')]||null:null,'attributes':_0x20306c[_0x01fe('0x1a')]?_0x20306c['options']['attributes']||null:null,'limit':_0x20306c[_0x01fe('0x1a')]?_0x20306c[_0x01fe('0x1a')][_0x01fe('0x20')]||null:null})[_0x01fe('0xc')](function(_0x191bf9){logger[_0x01fe('0xd')](_0x01fe('0x1c'),_0x20306c);logger[_0x01fe('0xe')](_0x01fe('0x1c'),_0x20306c,JSON[_0x01fe('0x21')](_0x191bf9));_0x28810b(_0x191bf9);})['catch'](function(_0x508bf9){logger['error'](_0x01fe('0x1c'),_0x508bf9['message'],_0x20306c);_0x4faf7a(_0xc3dbd2[_0x01fe('0x10')](0x1f4,_0x508bf9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index bd6f368..94694fd 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 _0x4bc3=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x182095,_0x45ec5b){var _0x299650=function(_0x26b35e){while(--_0x26b35e){_0x182095['push'](_0x182095['shift']());}};_0x299650(++_0x45ec5b);}(_0x4bc3,0x16e));var _0x34bc=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x4bc3[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x10')]('/:id',auth[_0x34bc('0xa')](),controller[_0x34bc('0x11')]);module[_0x34bc('0x12')]=router; \ No newline at end of file +var _0x9b67=['../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x421f92,_0x3c0f19){var _0x20c2ac=function(_0x32a489){while(--_0x32a489){_0x421f92['push'](_0x421f92['shift']());}};_0x20c2ac(++_0x3c0f19);}(_0x9b67,0xf6));var _0x79b6=function(_0x5533b3,_0x4bebd0){_0x5533b3=_0x5533b3-0x0;var _0xc0d971=_0x9b67[_0x5533b3];return _0xc0d971;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['describe']);router[_0x79b6('0x8')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xe')]('/',auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller['update']);router['delete'](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 141c42e..a6788a2 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 _0xde44=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0xde44,0x160));var _0x4de4=function(_0x464fbd,_0x4edb93){_0x464fbd=_0x464fbd-0x0;var _0xcabf88=_0xde44[_0x464fbd];return _0xcabf88;};'use strict';var Sequelize=require(_0x4de4('0x0'));module[_0x4de4('0x1')]={'uniqueid':{'type':Sequelize[_0x4de4('0x2')]},'type':{'type':Sequelize[_0x4de4('0x3')]('inbound',_0x4de4('0x4'),_0x4de4('0x5'),_0x4de4('0x6'),_0x4de4('0x7'),_0x4de4('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4de4('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x4de4('0x2')]},'destinationcontext':{'type':Sequelize[_0x4de4('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x4de4('0x2')]},'lastapplication':{'type':Sequelize[_0x4de4('0x2')]},'lastdata':{'type':Sequelize[_0x4de4('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4de4('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4de4('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4de4('0xb')]},'mohtime':{'type':Sequelize[_0x4de4('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4de4('0x2')]},'userfield':{'type':Sequelize[_0x4de4('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x4de4('0x2')]},'note':{'type':Sequelize[_0x4de4('0x2')]},'prefix':{'type':Sequelize[_0x4de4('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x4de4('0x2')]}}; \ No newline at end of file +var _0x6d3f=['exports','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x369cf2,_0x47e28c){var _0x5c7d3e=function(_0x4143d9){while(--_0x4143d9){_0x369cf2['push'](_0x369cf2['shift']());}};_0x5c7d3e(++_0x47e28c);}(_0x6d3f,0xe6));var _0xf6d3=function(_0x239cfa,_0x5c022f){_0x239cfa=_0x239cfa-0x0;var _0x4bbcbf=_0x6d3f[_0x239cfa];return _0x4bbcbf;};'use strict';var Sequelize=require(_0xf6d3('0x0'));module[_0xf6d3('0x1')]={'uniqueid':{'type':Sequelize[_0xf6d3('0x2')]},'type':{'type':Sequelize[_0xf6d3('0x3')](_0xf6d3('0x4'),_0xf6d3('0x5'),'outbound',_0xf6d3('0x6'),_0xf6d3('0x7'),_0xf6d3('0x8'))},'tag':{'type':Sequelize[_0xf6d3('0x2')]},'accountcode':{'type':Sequelize[_0xf6d3('0x2')]},'source':{'type':Sequelize[_0xf6d3('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xf6d3('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf6d3('0x2')]},'destinationchannel':{'type':Sequelize[_0xf6d3('0x2')]},'lastapplication':{'type':Sequelize[_0xf6d3('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xf6d3('0x9')]},'systemanswertime':{'type':Sequelize[_0xf6d3('0x9')]},'answertime':{'type':Sequelize[_0xf6d3('0x9')]},'endtime':{'type':Sequelize[_0xf6d3('0x9')]},'duration':{'type':Sequelize[_0xf6d3('0xa')]},'billableseconds':{'type':Sequelize[_0xf6d3('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf6d3('0x2')]},'amaflags':{'type':Sequelize[_0xf6d3('0x2')]},'userfield':{'type':Sequelize[_0xf6d3('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xf6d3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xf6d3('0x2')]},'note':{'type':Sequelize[_0xf6d3('0x2')]},'prefix':{'type':Sequelize[_0xf6d3('0x2')]},'routeid':{'type':Sequelize[_0xf6d3('0xa')]},'sipcallid':{'type':Sequelize[_0xf6d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2215f6c..1c71938 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(_0x42dbc2,_0xfcd5d6){_0x42dbc2=_0x42dbc2-0x0;var _0x32477a=_0x2032[_0x42dbc2];return _0x32477a;};'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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 403450e..f4e0d77 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 _0xcdd0=['api','moment','bluebird','request-promise','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger'];(function(_0x1733b9,_0x33a1b6){var _0x40e7e9=function(_0x1075b3){while(--_0x1075b3){_0x1733b9['push'](_0x1733b9['shift']());}};_0x40e7e9(++_0x33a1b6);}(_0xcdd0,0x169));var _0x0cdd=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xcdd0[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var logger=require(_0x0cdd('0x2'))(_0x0cdd('0x3'));var moment=require(_0x0cdd('0x4'));var BPromise=require(_0x0cdd('0x5'));var rp=require(_0x0cdd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cdd('0x7'));var config=require('../../config/environment');var attributes=require(_0x0cdd('0x8'));module[_0x0cdd('0x9')]=function(_0x154e80,_0x43f99d){return _0x154e80[_0x0cdd('0xa')](_0x0cdd('0xb'),attributes,{'tableName':_0x0cdd('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc036=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','util'];(function(_0x31b1c6,_0x2d5ece){var _0x33c909=function(_0x12920b){while(--_0x12920b){_0x31b1c6['push'](_0x31b1c6['shift']());}};_0x33c909(++_0x2d5ece);}(_0xc036,0x1ec));var _0x6c03=function(_0x16169b,_0x1fe209){_0x16169b=_0x16169b-0x0;var _0x7a7d78=_0xc036[_0x16169b];return _0x7a7d78;};'use strict';var _=require(_0x6c03('0x0'));var util=require(_0x6c03('0x1'));var logger=require(_0x6c03('0x2'))('api');var moment=require(_0x6c03('0x3'));var BPromise=require(_0x6c03('0x4'));var rp=require(_0x6c03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c03('0x6'));var config=require(_0x6c03('0x7'));var attributes=require(_0x6c03('0x8'));module['exports']=function(_0xd587a,_0x3cafb3){return _0xd587a[_0x6c03('0x9')](_0x6c03('0xa'),attributes,{'tableName':_0x6c03('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6c03('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 0af0323..8d3dd41 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 _0xb1c1=['randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','VoiceCallReport','update','lodash','util','moment','bluebird'];(function(_0x3d1c2a,_0x4643ce){var _0x494989=function(_0x4dfbf8){while(--_0x4dfbf8){_0x3d1c2a['push'](_0x3d1c2a['shift']());}};_0x494989(++_0x4643ce);}(_0xb1c1,0x1c4));var _0x1b1c=function(_0x38b9e3,_0x4f8400){_0x38b9e3=_0x38b9e3-0x0;var _0xe2b7a7=_0xb1c1[_0x38b9e3];return _0xe2b7a7;};'use strict';var _=require(_0x1b1c('0x0'));var util=require(_0x1b1c('0x1'));var moment=require(_0x1b1c('0x2'));var BPromise=require(_0x1b1c('0x3'));var rs=require(_0x1b1c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b1c('0x5'))['db'];var utils=require(_0x1b1c('0x6'));var logger=require('../../config/logger')(_0x1b1c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1b1c('0x8')][_0x1b1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11e077,_0x5bc89b,_0x2bf986){return new BPromise(function(_0x5ae490,_0x58915c){return client[_0x1b1c('0xa')](_0x11e077,_0x2bf986)[_0x1b1c('0xb')](function(_0x1eeeb4){logger[_0x1b1c('0xc')](_0x1b1c('0xd'),_0x5bc89b,_0x1b1c('0xe'));logger[_0x1b1c('0xf')](_0x1b1c('0x10'),_0x5bc89b,'request\x20sent',JSON[_0x1b1c('0x11')](_0x1eeeb4));if(_0x1eeeb4[_0x1b1c('0x12')]){if(_0x1eeeb4[_0x1b1c('0x12')][_0x1b1c('0x13')]===0x1f4){logger[_0x1b1c('0x12')](_0x1b1c('0xd'),_0x5bc89b,_0x1eeeb4[_0x1b1c('0x12')][_0x1b1c('0x14')]);return _0x58915c(_0x1eeeb4[_0x1b1c('0x12')]['message']);}logger[_0x1b1c('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5bc89b,_0x1eeeb4[_0x1b1c('0x12')][_0x1b1c('0x14')]);return _0x5ae490(_0x1eeeb4[_0x1b1c('0x12')][_0x1b1c('0x14')]);}else{logger[_0x1b1c('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x5bc89b,_0x1b1c('0xe'));_0x5ae490(_0x1eeeb4[_0x1b1c('0x15')][_0x1b1c('0x14')]);}})[_0x1b1c('0x16')](function(_0x3afb84){logger['error'](_0x1b1c('0xd'),_0x5bc89b,_0x3afb84);_0x58915c(_0x3afb84);});});}exports[_0x1b1c('0x17')]=function(_0x268eba){var _0x5e4112=this;return new Promise(function(_0x38a79f,_0x10cfb9){return db['VoiceCallReport'][_0x1b1c('0x18')]({'raw':_0x268eba[_0x1b1c('0x19')]?_0x268eba['options'][_0x1b1c('0x1a')]===undefined?!![]:![]:!![],'where':_0x268eba[_0x1b1c('0x19')]?_0x268eba[_0x1b1c('0x19')][_0x1b1c('0x1b')]||null:null,'attributes':_0x268eba[_0x1b1c('0x19')]?_0x268eba[_0x1b1c('0x19')][_0x1b1c('0x1c')]||null:null,'limit':_0x268eba[_0x1b1c('0x19')]?_0x268eba[_0x1b1c('0x19')]['limit']||null:null,'include':_0x268eba[_0x1b1c('0x19')]?_0x268eba[_0x1b1c('0x19')][_0x1b1c('0x1d')]?_[_0x1b1c('0x1e')](_0x268eba[_0x1b1c('0x19')][_0x1b1c('0x1d')],function(_0x432d9d){return{'model':db[_0x432d9d[_0x1b1c('0x1f')]],'as':_0x432d9d['as'],'attributes':_0x432d9d[_0x1b1c('0x1c')],'include':_0x432d9d['include']?_['map'](_0x432d9d[_0x1b1c('0x1d')],function(_0x18f136){return{'model':db[_0x18f136[_0x1b1c('0x1f')]],'as':_0x18f136['as'],'attributes':_0x18f136[_0x1b1c('0x1c')],'include':_0x18f136['include']?_[_0x1b1c('0x1e')](_0x18f136[_0x1b1c('0x1d')],function(_0x1e042a){return{'model':db[_0x1e042a[_0x1b1c('0x1f')]],'as':_0x1e042a['as'],'attributes':_0x1e042a[_0x1b1c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1b1c('0xb')](function(_0x58150e){logger[_0x1b1c('0xc')](_0x1b1c('0x17'),_0x268eba);logger[_0x1b1c('0xf')]('GetVoiceCallReport',_0x268eba,JSON[_0x1b1c('0x11')](_0x58150e));_0x38a79f(_0x58150e);})['catch'](function(_0x2137f4){logger['error']('GetVoiceCallReport',_0x2137f4[_0x1b1c('0x14')],_0x268eba);_0x10cfb9(_0x5e4112['error'](0x1f4,_0x2137f4[_0x1b1c('0x14')]));});});};exports[_0x1b1c('0x20')]=function(_0x299a41){var _0xfed490=this;return new Promise(function(_0x51cd34,_0x375570){return db['VoiceCallReport'][_0x1b1c('0x21')](_0x299a41[_0x1b1c('0x22')],{'raw':_0x299a41[_0x1b1c('0x19')]?_0x299a41[_0x1b1c('0x19')][_0x1b1c('0x1a')]===undefined?!![]:![]:!![]})[_0x1b1c('0xb')](function(_0x12e458){logger[_0x1b1c('0xc')](_0x1b1c('0x20'),_0x299a41);logger['debug'](_0x1b1c('0x20'),_0x299a41,JSON[_0x1b1c('0x11')](_0x12e458));_0x51cd34(_0x12e458);})[_0x1b1c('0x16')](function(_0x24610a){logger[_0x1b1c('0x12')](_0x1b1c('0x20'),_0x24610a['message'],_0x299a41);_0x375570(_0xfed490['error'](0x1f4,_0x24610a[_0x1b1c('0x14')]));});});};exports[_0x1b1c('0x23')]=function(_0x573e12){var _0x2d42a5=this;return new Promise(function(_0x51c0ea,_0x476927){return db[_0x1b1c('0x24')][_0x1b1c('0x25')](_0x573e12['body'],{'raw':_0x573e12[_0x1b1c('0x19')]?_0x573e12[_0x1b1c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573e12[_0x1b1c('0x19')]?_0x573e12[_0x1b1c('0x19')][_0x1b1c('0x1b')]||null:null,'attributes':_0x573e12[_0x1b1c('0x19')]?_0x573e12[_0x1b1c('0x19')][_0x1b1c('0x1c')]||null:null,'limit':_0x573e12['options']?_0x573e12[_0x1b1c('0x19')]['limit']||null:null})[_0x1b1c('0xb')](function(_0x3ea3e5){logger[_0x1b1c('0xc')](_0x1b1c('0x23'),_0x573e12);logger[_0x1b1c('0xf')]('UpdateVoiceCallReport',_0x573e12,JSON['stringify'](_0x3ea3e5));_0x51c0ea(_0x3ea3e5);})[_0x1b1c('0x16')](function(_0x4b263a){logger[_0x1b1c('0x12')](_0x1b1c('0x23'),_0x4b263a[_0x1b1c('0x14')],_0x573e12);_0x476927(_0x2d42a5[_0x1b1c('0x12')](0x1f4,_0x4b263a[_0x1b1c('0x14')]));});});}; \ No newline at end of file +var _0xadfc=['../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xadfc,0x1e8));var _0xcadf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xadfc[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xcadf('0x0'));var util=require('util');var moment=require(_0xcadf('0x1'));var BPromise=require('bluebird');var rs=require(_0xcadf('0x2'));var fs=require('fs');var Redis=require(_0xcadf('0x3'));var db=require(_0xcadf('0x4'))['db'];var utils=require(_0xcadf('0x5'));var logger=require(_0xcadf('0x6'))(_0xcadf('0x7'));var config=require('../../config/environment');var jayson=require(_0xcadf('0x8'));var client=jayson[_0xcadf('0x9')][_0xcadf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a458f,_0x1ac4de,_0x4fa365){return new BPromise(function(_0x42bdd2,_0x11d568){return client[_0xcadf('0xb')](_0x3a458f,_0x4fa365)[_0xcadf('0xc')](function(_0x241df8){logger['info'](_0xcadf('0xd'),_0x1ac4de,'request\x20sent');logger[_0xcadf('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1ac4de,_0xcadf('0xf'),JSON[_0xcadf('0x10')](_0x241df8));if(_0x241df8['error']){if(_0x241df8[_0xcadf('0x11')][_0xcadf('0x12')]===0x1f4){logger[_0xcadf('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x1ac4de,_0x241df8[_0xcadf('0x11')][_0xcadf('0x13')]);return _0x11d568(_0x241df8[_0xcadf('0x11')][_0xcadf('0x13')]);}logger['error'](_0xcadf('0xd'),_0x1ac4de,_0x241df8['error'][_0xcadf('0x13')]);return _0x42bdd2(_0x241df8['error']['message']);}else{logger[_0xcadf('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x1ac4de,_0xcadf('0xf'));_0x42bdd2(_0x241df8[_0xcadf('0x15')][_0xcadf('0x13')]);}})[_0xcadf('0x16')](function(_0x4c4cf2){logger[_0xcadf('0x11')](_0xcadf('0xd'),_0x1ac4de,_0x4c4cf2);_0x11d568(_0x4c4cf2);});});}exports[_0xcadf('0x17')]=function(_0x61890b){var _0x78d9f5=this;return new Promise(function(_0x2f7821,_0x398182){return db[_0xcadf('0x18')][_0xcadf('0x19')]({'raw':_0x61890b[_0xcadf('0x1a')]?_0x61890b[_0xcadf('0x1a')][_0xcadf('0x1b')]===undefined?!![]:![]:!![],'where':_0x61890b[_0xcadf('0x1a')]?_0x61890b['options']['where']||null:null,'attributes':_0x61890b['options']?_0x61890b[_0xcadf('0x1a')][_0xcadf('0x1c')]||null:null,'limit':_0x61890b[_0xcadf('0x1a')]?_0x61890b['options'][_0xcadf('0x1d')]||null:null,'include':_0x61890b[_0xcadf('0x1a')]?_0x61890b[_0xcadf('0x1a')][_0xcadf('0x1e')]?_[_0xcadf('0x1f')](_0x61890b['options'][_0xcadf('0x1e')],function(_0x14b254){return{'model':db[_0x14b254['model']],'as':_0x14b254['as'],'attributes':_0x14b254['attributes'],'include':_0x14b254[_0xcadf('0x1e')]?_[_0xcadf('0x1f')](_0x14b254['include'],function(_0x18ac0c){return{'model':db[_0x18ac0c[_0xcadf('0x20')]],'as':_0x18ac0c['as'],'attributes':_0x18ac0c['attributes'],'include':_0x18ac0c['include']?_['map'](_0x18ac0c[_0xcadf('0x1e')],function(_0x13a034){return{'model':db[_0x13a034[_0xcadf('0x20')]],'as':_0x13a034['as'],'attributes':_0x13a034['attributes']};}):[]};}):[]};}):[]:[]})[_0xcadf('0xc')](function(_0x373502){logger[_0xcadf('0x14')]('GetVoiceCallReport',_0x61890b);logger[_0xcadf('0xe')]('GetVoiceCallReport',_0x61890b,JSON['stringify'](_0x373502));_0x2f7821(_0x373502);})[_0xcadf('0x16')](function(_0x1452d7){logger[_0xcadf('0x11')](_0xcadf('0x17'),_0x1452d7[_0xcadf('0x13')],_0x61890b);_0x398182(_0x78d9f5['error'](0x1f4,_0x1452d7[_0xcadf('0x13')]));});});};exports[_0xcadf('0x21')]=function(_0x37e9d3){var _0x1d3eee=this;return new Promise(function(_0x2095d5,_0x3ccc54){return db[_0xcadf('0x18')][_0xcadf('0x22')](_0x37e9d3[_0xcadf('0x23')],{'raw':_0x37e9d3[_0xcadf('0x1a')]?_0x37e9d3[_0xcadf('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcadf('0xc')](function(_0x43d1c8){logger['info']('CreateVoiceCallReport',_0x37e9d3);logger['debug'](_0xcadf('0x21'),_0x37e9d3,JSON['stringify'](_0x43d1c8));_0x2095d5(_0x43d1c8);})[_0xcadf('0x16')](function(_0x262595){logger[_0xcadf('0x11')](_0xcadf('0x21'),_0x262595[_0xcadf('0x13')],_0x37e9d3);_0x3ccc54(_0x1d3eee[_0xcadf('0x11')](0x1f4,_0x262595[_0xcadf('0x13')]));});});};exports[_0xcadf('0x24')]=function(_0x44c2d3){var _0x43b697=this;return new Promise(function(_0xf4143b,_0x4b4582){return db[_0xcadf('0x18')][_0xcadf('0x25')](_0x44c2d3[_0xcadf('0x23')],{'raw':_0x44c2d3['options']?_0x44c2d3[_0xcadf('0x1a')][_0xcadf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44c2d3['options']?_0x44c2d3[_0xcadf('0x1a')]['where']||null:null,'attributes':_0x44c2d3[_0xcadf('0x1a')]?_0x44c2d3[_0xcadf('0x1a')][_0xcadf('0x1c')]||null:null,'limit':_0x44c2d3[_0xcadf('0x1a')]?_0x44c2d3['options']['limit']||null:null})['then'](function(_0x4991e0){logger['info'](_0xcadf('0x24'),_0x44c2d3);logger[_0xcadf('0xe')](_0xcadf('0x24'),_0x44c2d3,JSON[_0xcadf('0x10')](_0x4991e0));_0xf4143b(_0x4991e0);})[_0xcadf('0x16')](function(_0x3020ac){logger[_0xcadf('0x11')]('UpdateVoiceCallReport',_0x3020ac['message'],_0x44c2d3);_0x4b4582(_0x43b697[_0xcadf('0x11')](0x1f4,_0x3020ac['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7c89b9a..e868451 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 _0x4060=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x4060,0x127));var _0x0406=function(_0x17a1db,_0x990353){_0x17a1db=_0x17a1db-0x0;var _0x25d1e1=_0x4060[_0x17a1db];return _0x25d1e1;};'use strict';var multer=require(_0x0406('0x0'));var util=require(_0x0406('0x1'));var path=require(_0x0406('0x2'));var timeout=require(_0x0406('0x3'));var express=require(_0x0406('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0406('0x5'));var interaction=require(_0x0406('0x6'));var config=require(_0x0406('0x7'));var controller=require(_0x0406('0x8'));router[_0x0406('0x9')]('/',auth['isAuthenticated'](),controller[_0x0406('0xa')]);router[_0x0406('0x9')](_0x0406('0xb'),auth['isAuthenticated'](),controller[_0x0406('0xc')]);router[_0x0406('0xd')]('/',auth[_0x0406('0xe')](),controller[_0x0406('0xf')]);router[_0x0406('0x10')]('/:id',auth[_0x0406('0xe')](),controller[_0x0406('0x11')]);router[_0x0406('0x12')](_0x0406('0xb'),auth[_0x0406('0xe')](),controller[_0x0406('0x13')]);module[_0x0406('0x14')]=router; \ No newline at end of file +var _0x1269=['fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','/:id','post','isAuthenticated','create','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x315861,_0x735b4){var _0x3e2b76=function(_0x436457){while(--_0x436457){_0x315861['push'](_0x315861['shift']());}};_0x3e2b76(++_0x735b4);}(_0x1269,0xbc));var _0x9126=function(_0x7f677f,_0x5f2c1c){_0x7f677f=_0x7f677f-0x0;var _0x5acea1=_0x1269[_0x7f677f];return _0x5acea1;};'use strict';var multer=require(_0x9126('0x0'));var util=require('util');var path=require(_0x9126('0x1'));var timeout=require(_0x9126('0x2'));var express=require('express');var router=express[_0x9126('0x3')]();var fs_extra=require(_0x9126('0x4'));var auth=require(_0x9126('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9126('0x6'));var controller=require(_0x9126('0x7'));router[_0x9126('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9126('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9126('0xa')]('/',auth[_0x9126('0xb')](),controller[_0x9126('0xc')]);router['put']('/:id',auth[_0x9126('0xb')](),controller['update']);router[_0x9126('0xd')]('/:id',auth[_0x9126('0xb')](),controller[_0x9126('0xe')]);module[_0x9126('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6bf3a1a..aee7ac8 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 _0x1c67=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','options'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x1c67,0x1db));var _0x71c6=function(_0x2e5952,_0x311989){_0x2e5952=_0x2e5952-0x0;var _0x2d26bb=_0x1c67[_0x2e5952];return _0x2d26bb;};'use strict';var Sequelize=require(_0x71c6('0x0'));module[_0x71c6('0x1')]={'name':{'type':Sequelize[_0x71c6('0x2')]},'prefix':{'type':Sequelize[_0x71c6('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x210d12){this[_0x71c6('0x3')](_0x71c6('0x4'),_0x210d12?_0x210d12['join'](''):[]);},'get':function(){return this[_0x71c6('0x5')](_0x71c6('0x4'))?this[_0x71c6('0x5')]('options')[_0x71c6('0x6')](''):[];}},'auth':{'type':Sequelize[_0x71c6('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x71c6('0x2')]},'record':{'type':Sequelize[_0x71c6('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x71c6('0x2')]}}; \ No newline at end of file +var _0x1dd6=['exports','STRING','setDataValue','options','getDataValue','split','sequelize'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1dd6,0x1d4));var _0x61dd=function(_0x1dbca3,_0x2717e1){_0x1dbca3=_0x1dbca3-0x0;var _0x50bd3f=_0x1dd6[_0x1dbca3];return _0x50bd3f;};'use strict';var Sequelize=require(_0x61dd('0x0'));module[_0x61dd('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x61dd('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x61dd('0x2')],'set':function(_0x54d32e){this[_0x61dd('0x3')](_0x61dd('0x4'),_0x54d32e?_0x54d32e['join'](''):[]);},'get':function(){return this[_0x61dd('0x5')](_0x61dd('0x4'))?this[_0x61dd('0x5')](_0x61dd('0x4'))[_0x61dd('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x61dd('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x61dd('0x2')]},'description':{'type':Sequelize[_0x61dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 3757abb..6029793 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 _0x847d=['keys','filters','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','send','index','map','VoiceChanSpy','rawAttributes','key','model','name','query','intersection','fields','attributes','length','nolimit','sort','pick','where','type','VIRTUAL','merge','includeAll','findAll','rows','show','params'];(function(_0x44508f,_0x3d2edc){var _0x3cc7b9=function(_0x362c76){while(--_0x362c76){_0x44508f['push'](_0x44508f['shift']());}};_0x3cc7b9(++_0x3d2edc);}(_0x847d,0x14a));var _0xd847=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0x847d[_0x529296];return _0x1796bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd847('0x0'));var zipdir=require(_0xd847('0x1'));var jsonpatch=require(_0xd847('0x2'));var rp=require('request-promise');var moment=require(_0xd847('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd847('0x4'));var util=require(_0xd847('0x5'));var path=require('path');var sox=require(_0xd847('0x6'));var csv=require(_0xd847('0x7'));var ejs=require(_0xd847('0x8'));var fs=require('fs');var fs_extra=require(_0xd847('0x9'));var _=require('lodash');var squel=require(_0xd847('0xa'));var crypto=require(_0xd847('0xb'));var jsforce=require(_0xd847('0xc'));var deskjs=require(_0xd847('0xd'));var toCsv=require(_0xd847('0x7'));var querystring=require(_0xd847('0xe'));var Papa=require(_0xd847('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd847('0x10'));var logger=require(_0xd847('0x11'))(_0xd847('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd847('0x13'));var db=require(_0xd847('0x14'))['db'];function respondWithStatusCode(_0x344d39,_0x2ea8e7){_0x2ea8e7=_0x2ea8e7||0xcc;return function(_0x1e4e26){if(_0x1e4e26){return _0x344d39[_0xd847('0x15')](_0x2ea8e7);}return _0x344d39[_0xd847('0x16')](_0x2ea8e7)[_0xd847('0x17')]();};}function respondWithResult(_0x1c827a,_0x2faa39){_0x2faa39=_0x2faa39||0xc8;return function(_0x3c4805){if(_0x3c4805){return _0x1c827a['status'](_0x2faa39)[_0xd847('0x18')](_0x3c4805);}};}function respondWithFilteredResult(_0x165fbe,_0xd69fc9){return function(_0x404bdb){if(_0x404bdb){var _0x16c79a=typeof _0xd69fc9['offset']===_0xd847('0x19')&&typeof _0xd69fc9[_0xd847('0x1a')]===_0xd847('0x19');var _0x1a01ad=_0x404bdb['count'];var _0x1ef765=_0x16c79a?0x0:_0xd69fc9['offset'];var _0x4b6264=_0x16c79a?_0x404bdb[_0xd847('0x1b')]:_0xd69fc9[_0xd847('0x1c')]+_0xd69fc9[_0xd847('0x1a')];var _0x3905b8;if(_0x4b6264>=_0x1a01ad){_0x4b6264=_0x1a01ad;_0x3905b8=0xc8;}else{_0x3905b8=0xce;}_0x165fbe['status'](_0x3905b8);return _0x165fbe[_0xd847('0x1d')]('Content-Range',_0x1ef765+'-'+_0x4b6264+'/'+_0x1a01ad)['json'](_0x404bdb);}return null;};}function patchUpdates(_0x25e139){return function(_0x2c1091){try{jsonpatch[_0xd847('0x1e')](_0x2c1091,_0x25e139,!![]);}catch(_0x2a57df){return BPromise[_0xd847('0x1f')](_0x2a57df);}return _0x2c1091[_0xd847('0x20')]();};}function saveUpdates(_0x1490a1,_0x39c465){return function(_0x1eaf08){if(_0x1eaf08){return _0x1eaf08[_0xd847('0x21')](_0x1490a1)[_0xd847('0x22')](function(_0x3795fc){return _0x3795fc;});}return null;};}function removeEntity(_0x4a1691,_0x560563){return function(_0x26a787){if(_0x26a787){return _0x26a787[_0xd847('0x23')]()[_0xd847('0x22')](function(){var _0x5075a2=_0x26a787[_0xd847('0x24')]({'plain':!![]});var _0x246920=_0xd847('0x25');return db[_0xd847('0x26')][_0xd847('0x23')]({'where':{'type':_0x246920,'resourceId':_0x5075a2['id']}})[_0xd847('0x22')](function(){return _0x26a787;});})[_0xd847('0x22')](function(){_0x4a1691[_0xd847('0x16')](0xcc)[_0xd847('0x17')]();});}};}function handleEntityNotFound(_0x59296b,_0x46b213){return function(_0x1d03e2){if(!_0x1d03e2){_0x59296b[_0xd847('0x15')](0x194);}return _0x1d03e2;};}function handleError(_0x1a5370,_0x19bf66){_0x19bf66=_0x19bf66||0x1f4;return function(_0x3301cd){logger['error'](_0x3301cd[_0xd847('0x27')]);if(_0x3301cd['name']){delete _0x3301cd['name'];}_0x1a5370['status'](_0x19bf66)[_0xd847('0x28')](_0x3301cd);};}exports[_0xd847('0x29')]=function(_0x2678dc,_0x18d162){var _0x38c015={},_0x2306cf={},_0x329df1={'count':0x0,'rows':[]};var _0x197b7b=_[_0xd847('0x2a')](db[_0xd847('0x2b')][_0xd847('0x2c')],function(_0x156575){return{'name':_0x156575['fieldName'],'type':_0x156575['type'][_0xd847('0x2d')]};});_0x2306cf[_0xd847('0x2e')]=_[_0xd847('0x2a')](_0x197b7b,_0xd847('0x2f'));_0x2306cf[_0xd847('0x30')]=_['keys'](_0x2678dc[_0xd847('0x30')]);_0x2306cf['filters']=_[_0xd847('0x31')](_0x2306cf['model'],_0x2306cf[_0xd847('0x30')]);_0x38c015['attributes']=_[_0xd847('0x31')](_0x2306cf[_0xd847('0x2e')],qs['fields'](_0x2678dc['query'][_0xd847('0x32')]));_0x38c015[_0xd847('0x33')]=_0x38c015[_0xd847('0x33')][_0xd847('0x34')]?_0x38c015[_0xd847('0x33')]:_0x2306cf[_0xd847('0x2e')];if(!_0x2678dc['query']['hasOwnProperty'](_0xd847('0x35'))){_0x38c015[_0xd847('0x1a')]=qs[_0xd847('0x1a')](_0x2678dc['query'][_0xd847('0x1a')]);_0x38c015[_0xd847('0x1c')]=qs['offset'](_0x2678dc['query'][_0xd847('0x1c')]);}_0x38c015['order']=qs[_0xd847('0x36')](_0x2678dc[_0xd847('0x30')][_0xd847('0x36')]);_0x38c015['where']=qs['filters'](_[_0xd847('0x37')](_0x2678dc['query'],_0x2306cf['filters']),_0x197b7b);if(_0x2678dc[_0xd847('0x30')]['filter']){_0x38c015['where']=_['merge'](_0x38c015[_0xd847('0x38')],{'$or':_[_0xd847('0x2a')](_0x197b7b,function(_0x379814){if(_0x379814[_0xd847('0x39')]!==_0xd847('0x3a')){var _0x1dd9ed={};_0x1dd9ed[_0x379814['name']]={'$like':'%'+_0x2678dc[_0xd847('0x30')]['filter']+'%'};return _0x1dd9ed;}})});}_0x38c015=_[_0xd847('0x3b')]({},_0x38c015,_0x2678dc['options']);var _0x16eb77={'where':_0x38c015[_0xd847('0x38')]};return db['VoiceChanSpy'][_0xd847('0x1b')](_0x16eb77)[_0xd847('0x22')](function(_0x3b551a){_0x329df1[_0xd847('0x1b')]=_0x3b551a;if(_0x2678dc[_0xd847('0x30')][_0xd847('0x3c')]){_0x38c015['include']=[{'all':!![]}];}return db[_0xd847('0x2b')][_0xd847('0x3d')](_0x38c015);})[_0xd847('0x22')](function(_0x4ec489){_0x329df1[_0xd847('0x3e')]=_0x4ec489;return _0x329df1;})[_0xd847('0x22')](respondWithFilteredResult(_0x18d162,_0x38c015))['catch'](handleError(_0x18d162,null));};exports[_0xd847('0x3f')]=function(_0x581927,_0x4037fe){var _0x21d102={'raw':![],'where':{'id':_0x581927[_0xd847('0x40')]['id']}},_0x3a1654={};_0x3a1654['model']=_[_0xd847('0x41')](db[_0xd847('0x2b')][_0xd847('0x2c')]);_0x3a1654['query']=_[_0xd847('0x41')](_0x581927[_0xd847('0x30')]);_0x3a1654[_0xd847('0x42')]=_['intersection'](_0x3a1654[_0xd847('0x2e')],_0x3a1654[_0xd847('0x30')]);_0x21d102[_0xd847('0x33')]=_[_0xd847('0x31')](_0x3a1654['model'],qs['fields'](_0x581927['query'][_0xd847('0x32')]));_0x21d102[_0xd847('0x33')]=_0x21d102[_0xd847('0x33')][_0xd847('0x34')]?_0x21d102['attributes']:_0x3a1654[_0xd847('0x2e')];if(_0x581927['query'][_0xd847('0x3c')]){_0x21d102['include']=[{'all':!![]}];}_0x21d102=_[_0xd847('0x3b')]({},_0x21d102,_0x581927['options']);return db[_0xd847('0x2b')]['find'](_0x21d102)[_0xd847('0x22')](handleEntityNotFound(_0x4037fe,null))[_0xd847('0x22')](respondWithResult(_0x4037fe,null))[_0xd847('0x43')](handleError(_0x4037fe,null));};exports['create']=function(_0x2a130b,_0x465158){return db[_0xd847('0x2b')][_0xd847('0x44')](_0x2a130b['body'],{})['then'](function(_0x58dd6f){var _0x1c7a7d=_0x2a130b[_0xd847('0x45')][_0xd847('0x24')]({'plain':!![]});if(!_0x1c7a7d)throw new Error(_0xd847('0x46'));if(_0x1c7a7d[_0xd847('0x47')]===_0xd847('0x45')){var _0x341289=_0x58dd6f[_0xd847('0x24')]({'plain':!![]});var _0x2934ce='ChanSpies';return db[_0xd847('0x48')][_0xd847('0x49')]({'where':{'name':_0x2934ce,'userProfileId':_0x1c7a7d[_0xd847('0x4a')]},'raw':!![]})[_0xd847('0x22')](function(_0x4e7144){if(_0x4e7144&&_0x4e7144[_0xd847('0x4b')]===0x0){return db[_0xd847('0x26')][_0xd847('0x44')]({'name':_0x341289[_0xd847('0x2f')],'resourceId':_0x341289['id'],'type':_0x4e7144[_0xd847('0x2f')],'sectionId':_0x4e7144['id']},{})[_0xd847('0x22')](function(){return _0x58dd6f;});}else{return _0x58dd6f;}})[_0xd847('0x43')](function(_0x209e13){logger[_0xd847('0x4c')](_0xd847('0x4d'),_0x209e13);throw _0x209e13;});}return _0x58dd6f;})[_0xd847('0x22')](respondWithResult(_0x465158,0xc9))[_0xd847('0x43')](handleError(_0x465158,null));};exports[_0xd847('0x21')]=function(_0x6fe8cd,_0x39d0c2){if(_0x6fe8cd[_0xd847('0x4e')]['id']){delete _0x6fe8cd['body']['id'];}return db[_0xd847('0x2b')][_0xd847('0x49')]({'where':{'id':_0x6fe8cd[_0xd847('0x40')]['id']}})['then'](handleEntityNotFound(_0x39d0c2,null))[_0xd847('0x22')](saveUpdates(_0x6fe8cd[_0xd847('0x4e')],null))[_0xd847('0x22')](respondWithResult(_0x39d0c2,null))[_0xd847('0x43')](handleError(_0x39d0c2,null));};exports[_0xd847('0x23')]=function(_0x2dcb7d,_0x3744cf){return db['VoiceChanSpy'][_0xd847('0x49')]({'where':{'id':_0x2dcb7d['params']['id']}})[_0xd847('0x22')](handleEntityNotFound(_0x3744cf,null))[_0xd847('0x22')](removeEntity(_0x3744cf,null))[_0xd847('0x43')](handleError(_0x3744cf,null));}; \ No newline at end of file +var _0x851d=['merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','get','ChanSpies','UserProfileResource','then','end','error','stack','name','send','index','map','VoiceChanSpy','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x17427f,_0x3a58cd){var _0x3ade33=function(_0x19fd36){while(--_0x19fd36){_0x17427f['push'](_0x17427f['shift']());}};_0x3ade33(++_0x3a58cd);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd851('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd851('0x1'));var jsonpatch=require(_0xd851('0x2'));var rp=require('request-promise');var moment=require(_0xd851('0x3'));var BPromise=require(_0xd851('0x4'));var Mustache=require(_0xd851('0x5'));var util=require(_0xd851('0x6'));var path=require(_0xd851('0x7'));var sox=require(_0xd851('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd851('0x9'));var _=require(_0xd851('0xa'));var squel=require(_0xd851('0xb'));var crypto=require(_0xd851('0xc'));var jsforce=require(_0xd851('0xd'));var deskjs=require(_0xd851('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd851('0xf'));var Papa=require('papaparse');var Redis=require(_0xd851('0x10'));var authService=require(_0xd851('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd851('0x12'));var hardwareService=require(_0xd851('0x13'));var logger=require(_0xd851('0x14'))(_0xd851('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd851('0x16'));var db=require(_0xd851('0x17'))['db'];function respondWithStatusCode(_0x173c88,_0x1188d5){_0x1188d5=_0x1188d5||0xcc;return function(_0x5a01bf){if(_0x5a01bf){return _0x173c88[_0xd851('0x18')](_0x1188d5);}return _0x173c88[_0xd851('0x19')](_0x1188d5)['end']();};}function respondWithResult(_0x399128,_0x2705fd){_0x2705fd=_0x2705fd||0xc8;return function(_0x237dda){if(_0x237dda){return _0x399128['status'](_0x2705fd)[_0xd851('0x1a')](_0x237dda);}};}function respondWithFilteredResult(_0x370ad3,_0xb26cf1){return function(_0x1e2ee7){if(_0x1e2ee7){var _0x1b3d4c=typeof _0xb26cf1[_0xd851('0x1b')]==='undefined'&&typeof _0xb26cf1[_0xd851('0x1c')]===_0xd851('0x1d');var _0x1f4f98=_0x1e2ee7[_0xd851('0x1e')];var _0x12b309=_0x1b3d4c?0x0:_0xb26cf1[_0xd851('0x1b')];var _0x3559a1=_0x1b3d4c?_0x1e2ee7['count']:_0xb26cf1['offset']+_0xb26cf1[_0xd851('0x1c')];var _0x8ddf05;if(_0x3559a1>=_0x1f4f98){_0x3559a1=_0x1f4f98;_0x8ddf05=0xc8;}else{_0x8ddf05=0xce;}_0x370ad3[_0xd851('0x19')](_0x8ddf05);return _0x370ad3[_0xd851('0x1f')](_0xd851('0x20'),_0x12b309+'-'+_0x3559a1+'/'+_0x1f4f98)[_0xd851('0x1a')](_0x1e2ee7);}return null;};}function patchUpdates(_0x8585e5){return function(_0x239356){try{jsonpatch[_0xd851('0x21')](_0x239356,_0x8585e5,!![]);}catch(_0x46773f){return BPromise[_0xd851('0x22')](_0x46773f);}return _0x239356[_0xd851('0x23')]();};}function saveUpdates(_0x17cb41,_0x4e38af){return function(_0x404ba4){if(_0x404ba4){return _0x404ba4[_0xd851('0x24')](_0x17cb41)['then'](function(_0x3856a8){return _0x3856a8;});}return null;};}function removeEntity(_0x30177c,_0x2f888e){return function(_0x4bb814){if(_0x4bb814){return _0x4bb814['destroy']()['then'](function(){var _0x35a9b0=_0x4bb814[_0xd851('0x25')]({'plain':!![]});var _0x2f2009=_0xd851('0x26');return db[_0xd851('0x27')]['destroy']({'where':{'type':_0x2f2009,'resourceId':_0x35a9b0['id']}})[_0xd851('0x28')](function(){return _0x4bb814;});})['then'](function(){_0x30177c[_0xd851('0x19')](0xcc)[_0xd851('0x29')]();});}};}function handleEntityNotFound(_0x39f9d4,_0x36457c){return function(_0x337da5){if(!_0x337da5){_0x39f9d4[_0xd851('0x18')](0x194);}return _0x337da5;};}function handleError(_0x4d1fa6,_0x94977e){_0x94977e=_0x94977e||0x1f4;return function(_0x441c27){logger[_0xd851('0x2a')](_0x441c27[_0xd851('0x2b')]);if(_0x441c27[_0xd851('0x2c')]){delete _0x441c27[_0xd851('0x2c')];}_0x4d1fa6[_0xd851('0x19')](_0x94977e)[_0xd851('0x2d')](_0x441c27);};}exports[_0xd851('0x2e')]=function(_0x2ef08d,_0xce3947){var _0x132df8={},_0x598ad4={},_0x15ce59={'count':0x0,'rows':[]};var _0x990498=_[_0xd851('0x2f')](db[_0xd851('0x30')]['rawAttributes'],function(_0x165f79){return{'name':_0x165f79['fieldName'],'type':_0x165f79['type'][_0xd851('0x31')]};});_0x598ad4[_0xd851('0x32')]=_['map'](_0x990498,'name');_0x598ad4[_0xd851('0x33')]=_[_0xd851('0x34')](_0x2ef08d[_0xd851('0x33')]);_0x598ad4[_0xd851('0x35')]=_[_0xd851('0x36')](_0x598ad4['model'],_0x598ad4['query']);_0x132df8[_0xd851('0x37')]=_[_0xd851('0x36')](_0x598ad4[_0xd851('0x32')],qs[_0xd851('0x38')](_0x2ef08d[_0xd851('0x33')][_0xd851('0x38')]));_0x132df8[_0xd851('0x37')]=_0x132df8[_0xd851('0x37')]['length']?_0x132df8['attributes']:_0x598ad4['model'];if(!_0x2ef08d[_0xd851('0x33')][_0xd851('0x39')](_0xd851('0x3a'))){_0x132df8[_0xd851('0x1c')]=qs[_0xd851('0x1c')](_0x2ef08d['query'][_0xd851('0x1c')]);_0x132df8[_0xd851('0x1b')]=qs['offset'](_0x2ef08d[_0xd851('0x33')][_0xd851('0x1b')]);}_0x132df8[_0xd851('0x3b')]=qs[_0xd851('0x3c')](_0x2ef08d['query']['sort']);_0x132df8[_0xd851('0x3d')]=qs['filters'](_[_0xd851('0x3e')](_0x2ef08d[_0xd851('0x33')],_0x598ad4[_0xd851('0x35')]),_0x990498);if(_0x2ef08d['query']['filter']){_0x132df8[_0xd851('0x3d')]=_[_0xd851('0x3f')](_0x132df8[_0xd851('0x3d')],{'$or':_['map'](_0x990498,function(_0x326631){if(_0x326631[_0xd851('0x40')]!==_0xd851('0x41')){var _0x321d6e={};_0x321d6e[_0x326631['name']]={'$like':'%'+_0x2ef08d['query'][_0xd851('0x42')]+'%'};return _0x321d6e;}})});}_0x132df8=_[_0xd851('0x3f')]({},_0x132df8,_0x2ef08d[_0xd851('0x43')]);var _0x5056bc={'where':_0x132df8[_0xd851('0x3d')]};return db[_0xd851('0x30')][_0xd851('0x1e')](_0x5056bc)['then'](function(_0x1ebf20){_0x15ce59[_0xd851('0x1e')]=_0x1ebf20;if(_0x2ef08d[_0xd851('0x33')][_0xd851('0x44')]){_0x132df8[_0xd851('0x45')]=[{'all':!![]}];}return db[_0xd851('0x30')][_0xd851('0x46')](_0x132df8);})[_0xd851('0x28')](function(_0x23dc50){_0x15ce59[_0xd851('0x47')]=_0x23dc50;return _0x15ce59;})[_0xd851('0x28')](respondWithFilteredResult(_0xce3947,_0x132df8))[_0xd851('0x48')](handleError(_0xce3947,null));};exports['show']=function(_0x5e4f40,_0x4fe987){var _0x247bb3={'raw':![],'where':{'id':_0x5e4f40['params']['id']}},_0x273868={};_0x273868[_0xd851('0x32')]=_[_0xd851('0x34')](db[_0xd851('0x30')][_0xd851('0x49')]);_0x273868['query']=_[_0xd851('0x34')](_0x5e4f40[_0xd851('0x33')]);_0x273868[_0xd851('0x35')]=_[_0xd851('0x36')](_0x273868[_0xd851('0x32')],_0x273868['query']);_0x247bb3[_0xd851('0x37')]=_[_0xd851('0x36')](_0x273868[_0xd851('0x32')],qs[_0xd851('0x38')](_0x5e4f40['query'][_0xd851('0x38')]));_0x247bb3[_0xd851('0x37')]=_0x247bb3[_0xd851('0x37')][_0xd851('0x4a')]?_0x247bb3['attributes']:_0x273868['model'];if(_0x5e4f40[_0xd851('0x33')][_0xd851('0x44')]){_0x247bb3[_0xd851('0x45')]=[{'all':!![]}];}_0x247bb3=_[_0xd851('0x3f')]({},_0x247bb3,_0x5e4f40[_0xd851('0x43')]);return db[_0xd851('0x30')][_0xd851('0x4b')](_0x247bb3)[_0xd851('0x28')](handleEntityNotFound(_0x4fe987,null))[_0xd851('0x28')](respondWithResult(_0x4fe987,null))[_0xd851('0x48')](handleError(_0x4fe987,null));};exports[_0xd851('0x4c')]=function(_0x3bcd39,_0x3828fe){return db['VoiceChanSpy'][_0xd851('0x4c')](_0x3bcd39[_0xd851('0x4d')],{})[_0xd851('0x28')](function(_0x38014d){var _0x5b9d03=_0x3bcd39[_0xd851('0x4e')][_0xd851('0x25')]({'plain':!![]});if(!_0x5b9d03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b9d03['role']===_0xd851('0x4e')){var _0x2d9ecb=_0x38014d['get']({'plain':!![]});var _0x95c37e=_0xd851('0x26');return db[_0xd851('0x4f')][_0xd851('0x4b')]({'where':{'name':_0x95c37e,'userProfileId':_0x5b9d03[_0xd851('0x50')]},'raw':!![]})['then'](function(_0x10cf5b){if(_0x10cf5b&&_0x10cf5b['autoAssociation']===0x0){return db['UserProfileResource'][_0xd851('0x4c')]({'name':_0x2d9ecb[_0xd851('0x2c')],'resourceId':_0x2d9ecb['id'],'type':_0x10cf5b[_0xd851('0x2c')],'sectionId':_0x10cf5b['id']},{})[_0xd851('0x28')](function(){return _0x38014d;});}else{return _0x38014d;}})['catch'](function(_0x4bc500){logger[_0xd851('0x2a')](_0xd851('0x51'),_0x4bc500);throw _0x4bc500;});}return _0x38014d;})['then'](respondWithResult(_0x3828fe,0xc9))[_0xd851('0x48')](handleError(_0x3828fe,null));};exports[_0xd851('0x24')]=function(_0x2b8db2,_0x2478ad){if(_0x2b8db2['body']['id']){delete _0x2b8db2[_0xd851('0x4d')]['id'];}return db[_0xd851('0x30')]['find']({'where':{'id':_0x2b8db2[_0xd851('0x52')]['id']}})[_0xd851('0x28')](handleEntityNotFound(_0x2478ad,null))[_0xd851('0x28')](saveUpdates(_0x2b8db2[_0xd851('0x4d')],null))[_0xd851('0x28')](respondWithResult(_0x2478ad,null))[_0xd851('0x48')](handleError(_0x2478ad,null));};exports[_0xd851('0x53')]=function(_0x129412,_0x1118cc){return db['VoiceChanSpy'][_0xd851('0x4b')]({'where':{'id':_0x129412['params']['id']}})[_0xd851('0x28')](handleEntityNotFound(_0x1118cc,null))[_0xd851('0x28')](removeEntity(_0x1118cc,null))['catch'](handleError(_0x1118cc,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index baab580..1cbac90 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 _0xdb90=['StopMixMonitor','length','concat','internal','User','findAll','agent','then','exports','models','VoiceChanSpy','voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','system','Set','CDR(type)=%s','chanspy','record','push','merge','MixMonitor','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join'];(function(_0xe6edd7,_0x2993d2){var _0xc07080=function(_0x14d02b){while(--_0x14d02b){_0xe6edd7['push'](_0xe6edd7['shift']());}};_0xc07080(++_0x2993d2);}(_0xdb90,0x196));var _0x0db9=function(_0x53bec3,_0x550a58){_0x53bec3=_0x53bec3-0x0;var _0x159317=_0xdb90[_0x53bec3];return _0x159317;};'use strict';var _=require(_0x0db9('0x0'));var util=require(_0x0db9('0x1'));var BPromise=require(_0x0db9('0x2'));var attributes=require(_0x0db9('0x3'));var getUserApplications=function(_0x28ea1b,_0xdac15e,_0x3d5df8){var _0x1ce3f3=0x1;var _0x4cc55e=[];var _0x55b2d3={'context':_0xdac15e[_0x0db9('0x4')]||'from-sip','exten':util[_0x0db9('0x5')](_0x0db9('0x6'),_0x28ea1b['prefix'],_0x3d5df8),'type':_0x0db9('0x7'),'isApp':![],'ChanSpyId':_0x28ea1b['id'],'UserId':_0xdac15e['id']};_0x4cc55e['push'](_['merge']({'app':_0x0db9('0x8'),'appdata':util[_0x0db9('0x5')](_0x0db9('0x9'),_0x0db9('0xa')),'priority':_0x1ce3f3++},_0x55b2d3));if(_0x28ea1b[_0x0db9('0xb')]){_0x4cc55e[_0x0db9('0xc')](_[_0x0db9('0xd')]({'app':_0x0db9('0xe'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x28ea1b['recordingFormat']),'priority':_0x1ce3f3++},_0x55b2d3));}if(_0x28ea1b[_0x0db9('0xf')]){_0x4cc55e[_0x0db9('0xc')](_[_0x0db9('0xd')]({'app':_0x0db9('0x10'),'appdata':_0x28ea1b[_0x0db9('0x11')],'priority':_0x1ce3f3++},_0x55b2d3));}_0x4cc55e['push'](_[_0x0db9('0xd')]({'app':_0x0db9('0x12'),'appdata':util[_0x0db9('0x5')](_0x0db9('0x13'),_0xdac15e[_0x0db9('0x14')],_0x28ea1b[_0x0db9('0x15')]?_0x28ea1b[_0x0db9('0x15')][_0x0db9('0x16')](''):''),'priority':_0x1ce3f3++},_0x55b2d3));if(_0x28ea1b[_0x0db9('0xb')]){_0x4cc55e[_0x0db9('0xc')](_['merge']({'app':_0x0db9('0x17'),'priority':_0x1ce3f3++},_0x55b2d3));}return _0x4cc55e;};var getChanSpyApplications=function(_0x1a167c,_0x2fa47d){var _0x2ff644=[];for(var _0x40c1b3=0x0,_0x5a19b9=0x1;_0x40c1b3<_0x2fa47d[_0x0db9('0x18')];_0x40c1b3++,_0x5a19b9=0x1){_0x2ff644=_0x2ff644[_0x0db9('0x19')](getUserApplications(_0x1a167c,_0x2fa47d[_0x40c1b3],_0x2fa47d[_0x40c1b3]['internal']));if(_0x2fa47d[_0x40c1b3][_0x0db9('0x1a')]!=_0x2fa47d[_0x40c1b3]['name']){_0x2ff644=_0x2ff644[_0x0db9('0x19')](getUserApplications(_0x1a167c,_0x2fa47d[_0x40c1b3],_0x2fa47d[_0x40c1b3][_0x0db9('0x14')]));}}return _0x2ff644;};var getChanSpyPromise=function(_0x43ee96,_0x447d2b){return new BPromise(function(_0x395c9b,_0x2fbd12){return _0x43ee96[_0x0db9('0x1b')][_0x0db9('0x1c')]({'attributes':['id',_0x0db9('0x14'),_0x0db9('0x1a')],'where':{'role':_0x0db9('0x1d'),'chanspy':!![]},'raw':!![]})[_0x0db9('0x1e')](function(_0x3cef7a){if(_0x3cef7a){return _0x395c9b(getChanSpyApplications(_0x447d2b,_0x3cef7a));}return _0x395c9b([]);})['catch'](function(_0x43c0f8){_0x2fbd12(_0x43c0f8);});});};module[_0x0db9('0x1f')]=function(_0x405d5e,_0x3deaa2){var _0x19be7d=_0x405d5e[_0x0db9('0x20')];return _0x405d5e['define'](_0x0db9('0x21'),attributes,{'tableName':_0x0db9('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2942bd,_0x5451ec,_0x5751a2){return getChanSpyPromise(_0x19be7d,_0x2942bd)['then'](function(_0x362a16){if(_0x362a16&&_0x362a16[_0x0db9('0x18')]){return _0x19be7d['VoiceExtension'][_0x0db9('0x23')](_0x362a16);}})[_0x0db9('0x1e')](function(){_0x5751a2();})[_0x0db9('0x24')](function(_0x888e5f){_0x5751a2(_0x888e5f);});},'afterUpdate':function(_0x16c321,_0x3dab4,_0x259d7c){return _0x19be7d[_0x0db9('0x25')][_0x0db9('0x26')]({'where':{'ChanSpyId':_0x16c321['id']}})[_0x0db9('0x1e')](function(){return getChanSpyPromise(_0x19be7d,_0x16c321);})[_0x0db9('0x1e')](function(_0x11e878){if(_0x11e878&&_0x11e878['length']){return _0x19be7d['VoiceExtension'][_0x0db9('0x23')](_0x11e878);}})[_0x0db9('0x1e')](function(){_0x259d7c();})[_0x0db9('0x24')](function(_0x6dec9f){_0x259d7c(_0x6dec9f);});},'afterDestroy':function(_0x50eac9,_0x2a8b78,_0x193108){return _0x19be7d[_0x0db9('0x25')][_0x0db9('0x26')]({'where':{'ChanSpyId':_0x50eac9['id']}})[_0x0db9('0x1e')](function(){_0x193108();})['catch'](function(_0x26773a){_0x193108(_0x26773a);});}}});}; \ No newline at end of file +var _0x85ed=['SIP/%s,%s','options','StopMixMonitor','length','concat','internal','name','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','Set','CDR(type)=%s','chanspy','record','MixMonitor','format','recordingFormat','auth','merge','Authenticate','password','ChanSpy'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x85ed,0x15e));var _0xd85e=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x85ed[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xd85e('0x0'));var util=require(_0xd85e('0x1'));var BPromise=require('bluebird');var attributes=require(_0xd85e('0x2'));var getUserApplications=function(_0x2a1a5a,_0x4c9230,_0x32ae0a){var _0x2dd30a=0x1;var _0xb4332f=[];var _0x390e2a={'context':_0x4c9230[_0xd85e('0x3')]||_0xd85e('0x4'),'exten':util['format']('%s%s',_0x2a1a5a[_0xd85e('0x5')],_0x32ae0a),'type':_0xd85e('0x6'),'isApp':![],'ChanSpyId':_0x2a1a5a['id'],'UserId':_0x4c9230['id']};_0xb4332f[_0xd85e('0x7')](_['merge']({'app':_0xd85e('0x8'),'appdata':util['format'](_0xd85e('0x9'),_0xd85e('0xa')),'priority':_0x2dd30a++},_0x390e2a));if(_0x2a1a5a[_0xd85e('0xb')]){_0xb4332f[_0xd85e('0x7')](_['merge']({'app':_0xd85e('0xc'),'appdata':util[_0xd85e('0xd')]('${UNIQUEID}.%s,a',_0x2a1a5a[_0xd85e('0xe')]),'priority':_0x2dd30a++},_0x390e2a));}if(_0x2a1a5a[_0xd85e('0xf')]){_0xb4332f[_0xd85e('0x7')](_[_0xd85e('0x10')]({'app':_0xd85e('0x11'),'appdata':_0x2a1a5a[_0xd85e('0x12')],'priority':_0x2dd30a++},_0x390e2a));}_0xb4332f['push'](_[_0xd85e('0x10')]({'app':_0xd85e('0x13'),'appdata':util[_0xd85e('0xd')](_0xd85e('0x14'),_0x4c9230['name'],_0x2a1a5a[_0xd85e('0x15')]?_0x2a1a5a[_0xd85e('0x15')]['join'](''):''),'priority':_0x2dd30a++},_0x390e2a));if(_0x2a1a5a[_0xd85e('0xb')]){_0xb4332f[_0xd85e('0x7')](_[_0xd85e('0x10')]({'app':_0xd85e('0x16'),'priority':_0x2dd30a++},_0x390e2a));}return _0xb4332f;};var getChanSpyApplications=function(_0x1f1cfa,_0x34fbc1){var _0x1a4050=[];for(var _0x574f3e=0x0,_0x207baa=0x1;_0x574f3e<_0x34fbc1[_0xd85e('0x17')];_0x574f3e++,_0x207baa=0x1){_0x1a4050=_0x1a4050[_0xd85e('0x18')](getUserApplications(_0x1f1cfa,_0x34fbc1[_0x574f3e],_0x34fbc1[_0x574f3e]['internal']));if(_0x34fbc1[_0x574f3e][_0xd85e('0x19')]!=_0x34fbc1[_0x574f3e][_0xd85e('0x1a')]){_0x1a4050=_0x1a4050['concat'](getUserApplications(_0x1f1cfa,_0x34fbc1[_0x574f3e],_0x34fbc1[_0x574f3e][_0xd85e('0x1a')]));}}return _0x1a4050;};var getChanSpyPromise=function(_0x9664f2,_0x2124f4){return new BPromise(function(_0x3b3ee7,_0x5aa043){return _0x9664f2['User']['findAll']({'attributes':['id','name',_0xd85e('0x19')],'where':{'role':_0xd85e('0x1b'),'chanspy':!![]},'raw':!![]})[_0xd85e('0x1c')](function(_0x466b8c){if(_0x466b8c){return _0x3b3ee7(getChanSpyApplications(_0x2124f4,_0x466b8c));}return _0x3b3ee7([]);})[_0xd85e('0x1d')](function(_0x533967){_0x5aa043(_0x533967);});});};module[_0xd85e('0x1e')]=function(_0x124e9b,_0x4cdb6c){var _0x55c0a4=_0x124e9b[_0xd85e('0x1f')];return _0x124e9b[_0xd85e('0x20')](_0xd85e('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe1a9dd,_0x56b2fe,_0x26feca){return getChanSpyPromise(_0x55c0a4,_0xe1a9dd)[_0xd85e('0x1c')](function(_0x399867){if(_0x399867&&_0x399867[_0xd85e('0x17')]){return _0x55c0a4[_0xd85e('0x22')][_0xd85e('0x23')](_0x399867);}})['then'](function(){_0x26feca();})[_0xd85e('0x1d')](function(_0x4e97d4){_0x26feca(_0x4e97d4);});},'afterUpdate':function(_0x16287d,_0x118ea4,_0x3e6366){return _0x55c0a4['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x16287d['id']}})[_0xd85e('0x1c')](function(){return getChanSpyPromise(_0x55c0a4,_0x16287d);})['then'](function(_0x20ac18){if(_0x20ac18&&_0x20ac18[_0xd85e('0x17')]){return _0x55c0a4[_0xd85e('0x22')]['bulkCreate'](_0x20ac18);}})[_0xd85e('0x1c')](function(){_0x3e6366();})[_0xd85e('0x1d')](function(_0x17471e){_0x3e6366(_0x17471e);});},'afterDestroy':function(_0x3aeeab,_0x7772c6,_0x1fed19){return _0x55c0a4[_0xd85e('0x22')][_0xd85e('0x24')]({'where':{'ChanSpyId':_0x3aeeab['id']}})[_0xd85e('0x1c')](function(){_0x1fed19();})['catch'](function(_0x51a916){_0x1fed19(_0x51a916);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index bcd2c44..ea04467 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 _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x4fb810,_0x441071){var _0x5c646c=function(_0x3ce080){while(--_0x3ce080){_0x4fb810['push'](_0x4fb810['shift']());}};_0x5c646c(++_0x441071);}(_0x702d,0x147));var _0xd702=function(_0x4c7877,_0x291c0f){_0x4c7877=_0x4c7877-0x0;var _0x1e041b=_0x702d[_0x4c7877];return _0x1e041b;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file +var _0x41bb=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x57a55f,_0x3182d3){var _0x50e8ab=function(_0xcb0dc7){while(--_0xcb0dc7){_0x57a55f['push'](_0x57a55f['shift']());}};_0x50e8ab(++_0x3182d3);}(_0x41bb,0xc5));var _0xb41b=function(_0x143727,_0x775f88){_0x143727=_0x143727-0x0;var _0x4753e5=_0x41bb[_0x143727];return _0x4753e5;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 160e010..e579c4e 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 _0x31ee=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x31ee,0x75));var _0xe31e=function(_0x1d7f33,_0x3a5e76){_0x1d7f33=_0x1d7f33-0x0;var _0x1f9ce4=_0x31ee[_0x1d7f33];return _0x1f9ce4;};'use strict';var multer=require(_0xe31e('0x0'));var util=require(_0xe31e('0x1'));var path=require(_0xe31e('0x2'));var timeout=require('connect-timeout');var express=require(_0xe31e('0x3'));var router=express['Router']();var fs_extra=require(_0xe31e('0x4'));var auth=require(_0xe31e('0x5'));var interaction=require(_0xe31e('0x6'));var config=require(_0xe31e('0x7'));var controller=require(_0xe31e('0x8'));router[_0xe31e('0x9')]('/',auth['isAuthenticated'](),controller[_0xe31e('0xa')]);router[_0xe31e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe31e('0xb')]);router[_0xe31e('0xc')]('/',auth[_0xe31e('0xd')](),controller[_0xe31e('0xe')]);router[_0xe31e('0xf')](_0xe31e('0x10'),auth['isAuthenticated'](),controller[_0xe31e('0x11')]);router[_0xe31e('0x12')](_0xe31e('0x10'),auth[_0xe31e('0xd')](),controller[_0xe31e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6f69=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5469ba,_0x52f08f){var _0x1a8518=function(_0x9714e8){while(--_0x9714e8){_0x5469ba['push'](_0x5469ba['shift']());}};_0x1a8518(++_0x52f08f);}(_0x6f69,0x8a));var _0x96f6=function(_0x5c2000,_0x8fa375){_0x5c2000=_0x5c2000-0x0;var _0x16da17=_0x6f69[_0x5c2000];return _0x16da17;};'use strict';var multer=require(_0x96f6('0x0'));var util=require(_0x96f6('0x1'));var path=require(_0x96f6('0x2'));var timeout=require(_0x96f6('0x3'));var express=require(_0x96f6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x96f6('0x5'));var interaction=require(_0x96f6('0x6'));var config=require(_0x96f6('0x7'));var controller=require(_0x96f6('0x8'));router[_0x96f6('0x9')]('/',auth['isAuthenticated'](),controller[_0x96f6('0xa')]);router['get'](_0x96f6('0xb'),auth[_0x96f6('0xc')](),controller[_0x96f6('0xd')]);router[_0x96f6('0xe')]('/',auth[_0x96f6('0xc')](),controller[_0x96f6('0xf')]);router[_0x96f6('0x10')](_0x96f6('0xb'),auth[_0x96f6('0xc')](),controller[_0x96f6('0x11')]);router['delete'](_0x96f6('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 37f7959..d49f2a7 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 _0x63ab=['BOOLEAN','sequelize','exports','STRING'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0x63ab,0x14d));var _0xb63a=function(_0xa67244,_0x3abb3b){_0xa67244=_0xa67244-0x0;var _0x3a05e4=_0x63ab[_0xa67244];return _0x3a05e4;};'use strict';var Sequelize=require(_0xb63a('0x0'));module[_0xb63a('0x1')]={'name':{'type':Sequelize[_0xb63a('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xb63a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb63a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ad5=['BOOLEAN','sequelize','STRING','name'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0x6ad5,0x1e1));var _0x56ad=function(_0x5c338d,_0x2c9274){_0x5c338d=_0x5c338d-0x0;var _0x28f8f5=_0x6ad5[_0x5c338d];return _0x28f8f5;};'use strict';var Sequelize=require(_0x56ad('0x0'));module['exports']={'name':{'type':Sequelize[_0x56ad('0x1')],'unique':_0x56ad('0x2')},'description':{'type':Sequelize[_0x56ad('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x56ad('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 446aac0..2b8ad32 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 _0xfc9e=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','end','stack','name','index','map','VoiceContext','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','writeFileSync','chan_sip.so','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus'];(function(_0x1b1a88,_0x18a8fe){var _0x2de49b=function(_0x4fdabc){while(--_0x4fdabc){_0x1b1a88['push'](_0x1b1a88['shift']());}};_0x2de49b(++_0x18a8fe);}(_0xfc9e,0x110));var _0xefc9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xfc9e[_0x1b6186];return _0x186121;};'use strict';var emlformat=require(_0xefc9('0x0'));var rimraf=require(_0xefc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xefc9('0x2'));var moment=require(_0xefc9('0x3'));var BPromise=require(_0xefc9('0x4'));var Mustache=require('mustache');var util=require(_0xefc9('0x5'));var path=require(_0xefc9('0x6'));var sox=require(_0xefc9('0x7'));var csv=require('to-csv');var ejs=require(_0xefc9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefc9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xefc9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xefc9('0xb'));var querystring=require(_0xefc9('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xefc9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefc9('0xe'));var logger=require(_0xefc9('0xf'))(_0xefc9('0x10'));var utils=require(_0xefc9('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xefc9('0x12'));var db=require(_0xefc9('0x13'))['db'];var jayson=require(_0xefc9('0x14'));var client=jayson['client'][_0xefc9('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1210e0,_0x30f4cc,_0x2bb1d8,_0x35f945){return new BPromise(function(_0x47ba0a,_0x2b81ee){var _0x315e46=_0x35f945||client;return _0x315e46[_0xefc9('0x16')](_0x1210e0,_0x2bb1d8)[_0xefc9('0x17')](function(_0x4e345e){logger[_0xefc9('0x18')]('VoiceContext,\x20%s,\x20%s',_0x30f4cc,'request\x20sent');logger[_0xefc9('0x19')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x30f4cc,_0xefc9('0x1a'),JSON[_0xefc9('0x1b')](_0x4e345e));if(_0x4e345e[_0xefc9('0x1c')]){if(_0x4e345e['error']['code']===0x1f4){logger[_0xefc9('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x30f4cc,_0x4e345e[_0xefc9('0x1c')][_0xefc9('0x1d')]);return _0x2b81ee(_0x4e345e[_0xefc9('0x1c')][_0xefc9('0x1d')]);}logger[_0xefc9('0x1c')](_0xefc9('0x1e'),_0x30f4cc,_0x4e345e['error'][_0xefc9('0x1d')]);return _0x47ba0a(_0x4e345e[_0xefc9('0x1c')]['message']);}else{logger[_0xefc9('0x18')](_0xefc9('0x1e'),_0x30f4cc,_0xefc9('0x1a'));_0x47ba0a(_0x4e345e[_0xefc9('0x1f')]['message']);}})[_0xefc9('0x20')](function(_0xbef17d){logger['error'](_0xefc9('0x1e'),_0x30f4cc,_0xbef17d);_0x2b81ee(_0xbef17d);});});}function respondWithStatusCode(_0x18610b,_0x2918f0){_0x2918f0=_0x2918f0||0xcc;return function(_0x2b3208){if(_0x2b3208){return _0x18610b[_0xefc9('0x21')](_0x2918f0);}return _0x18610b[_0xefc9('0x22')](_0x2918f0)['end']();};}function respondWithResult(_0x36bbe0,_0x44d72a){_0x44d72a=_0x44d72a||0xc8;return function(_0x41e20c){if(_0x41e20c){return _0x36bbe0[_0xefc9('0x22')](_0x44d72a)[_0xefc9('0x23')](_0x41e20c);}};}function respondWithFilteredResult(_0x131346,_0x4915b1){return function(_0x39ab83){if(_0x39ab83){var _0x1bba8e=typeof _0x4915b1[_0xefc9('0x24')]===_0xefc9('0x25')&&typeof _0x4915b1[_0xefc9('0x26')]==='undefined';var _0x4c8ec7=_0x39ab83['count'];var _0x3d075e=_0x1bba8e?0x0:_0x4915b1['offset'];var _0x3443dd=_0x1bba8e?_0x39ab83[_0xefc9('0x27')]:_0x4915b1['offset']+_0x4915b1['limit'];var _0x5c6b06;if(_0x3443dd>=_0x4c8ec7){_0x3443dd=_0x4c8ec7;_0x5c6b06=0xc8;}else{_0x5c6b06=0xce;}_0x131346[_0xefc9('0x22')](_0x5c6b06);return _0x131346[_0xefc9('0x28')](_0xefc9('0x29'),_0x3d075e+'-'+_0x3443dd+'/'+_0x4c8ec7)[_0xefc9('0x23')](_0x39ab83);}return null;};}function patchUpdates(_0x1fabb1){return function(_0x244e89){try{jsonpatch[_0xefc9('0x2a')](_0x244e89,_0x1fabb1,!![]);}catch(_0x421afc){return BPromise[_0xefc9('0x2b')](_0x421afc);}return _0x244e89[_0xefc9('0x2c')]();};}function saveUpdates(_0x1038d7,_0xc80bd5){return function(_0x3a2279){if(_0x3a2279){return _0x3a2279['update'](_0x1038d7)[_0xefc9('0x17')](function(_0x227528){return _0x227528;});}return null;};}function removeEntity(_0x4b6dd9,_0x308a60){return function(_0x4be115){if(_0x4be115){return _0x4be115[_0xefc9('0x2d')]()[_0xefc9('0x17')](function(){var _0x7ae148=_0x4be115[_0xefc9('0x2e')]({'plain':!![]});var _0x4f221b=_0xefc9('0x2f');return db[_0xefc9('0x30')]['destroy']({'where':{'type':_0x4f221b,'resourceId':_0x7ae148['id']}})[_0xefc9('0x17')](function(){return _0x4be115;});})[_0xefc9('0x17')](function(){_0x4b6dd9[_0xefc9('0x22')](0xcc)[_0xefc9('0x31')]();});}};}function handleEntityNotFound(_0x564898,_0x56f915){return function(_0x47754b){if(!_0x47754b){_0x564898[_0xefc9('0x21')](0x194);}return _0x47754b;};}function handleError(_0x4c4afc,_0x340f9b){_0x340f9b=_0x340f9b||0x1f4;return function(_0x5a34f5){logger[_0xefc9('0x1c')](_0x5a34f5[_0xefc9('0x32')]);if(_0x5a34f5[_0xefc9('0x33')]){delete _0x5a34f5[_0xefc9('0x33')];}_0x4c4afc[_0xefc9('0x22')](_0x340f9b)['send'](_0x5a34f5);};}exports[_0xefc9('0x34')]=function(_0x1f571e,_0x15fba6){var _0x5be854={},_0x141910={},_0xfc77a4={'count':0x0,'rows':[]};var _0xd0a1b6=_[_0xefc9('0x35')](db[_0xefc9('0x36')][_0xefc9('0x37')],function(_0x3dc021){return{'name':_0x3dc021[_0xefc9('0x38')],'type':_0x3dc021['type'][_0xefc9('0x39')]};});_0x141910['model']=_[_0xefc9('0x35')](_0xd0a1b6,'name');_0x141910[_0xefc9('0x3a')]=_[_0xefc9('0x3b')](_0x1f571e['query']);_0x141910[_0xefc9('0x3c')]=_[_0xefc9('0x3d')](_0x141910['model'],_0x141910[_0xefc9('0x3a')]);_0x5be854[_0xefc9('0x3e')]=_[_0xefc9('0x3d')](_0x141910['model'],qs[_0xefc9('0x3f')](_0x1f571e[_0xefc9('0x3a')]['fields']));_0x5be854['attributes']=_0x5be854[_0xefc9('0x3e')][_0xefc9('0x40')]?_0x5be854[_0xefc9('0x3e')]:_0x141910[_0xefc9('0x41')];if(!_0x1f571e[_0xefc9('0x3a')][_0xefc9('0x42')](_0xefc9('0x43'))){_0x5be854[_0xefc9('0x26')]=qs[_0xefc9('0x26')](_0x1f571e[_0xefc9('0x3a')][_0xefc9('0x26')]);_0x5be854[_0xefc9('0x24')]=qs[_0xefc9('0x24')](_0x1f571e[_0xefc9('0x3a')][_0xefc9('0x24')]);}_0x5be854['order']=qs[_0xefc9('0x44')](_0x1f571e[_0xefc9('0x3a')][_0xefc9('0x44')]);_0x5be854[_0xefc9('0x45')]=qs['filters'](_[_0xefc9('0x46')](_0x1f571e['query'],_0x141910[_0xefc9('0x3c')]),_0xd0a1b6);if(_0x1f571e['query'][_0xefc9('0x47')]){_0x5be854[_0xefc9('0x45')]=_[_0xefc9('0x48')](_0x5be854[_0xefc9('0x45')],{'$or':_[_0xefc9('0x35')](_0xd0a1b6,function(_0xfb3029){if(_0xfb3029[_0xefc9('0x49')]!==_0xefc9('0x4a')){var _0x1ee9aa={};_0x1ee9aa[_0xfb3029[_0xefc9('0x33')]]={'$like':'%'+_0x1f571e[_0xefc9('0x3a')][_0xefc9('0x47')]+'%'};return _0x1ee9aa;}})});}_0x5be854=_[_0xefc9('0x48')]({},_0x5be854,_0x1f571e[_0xefc9('0x4b')]);var _0xeb8f6f={'where':_0x5be854[_0xefc9('0x45')]};return db['VoiceContext']['count'](_0xeb8f6f)[_0xefc9('0x17')](function(_0x5b6edc){_0xfc77a4[_0xefc9('0x27')]=_0x5b6edc;if(_0x1f571e[_0xefc9('0x3a')][_0xefc9('0x4c')]){_0x5be854[_0xefc9('0x4d')]=[{'all':!![]}];}return db[_0xefc9('0x36')][_0xefc9('0x4e')](_0x5be854);})[_0xefc9('0x17')](function(_0x13bd7c){_0xfc77a4['rows']=_0x13bd7c;return _0xfc77a4;})['then'](respondWithFilteredResult(_0x15fba6,_0x5be854))[_0xefc9('0x20')](handleError(_0x15fba6,null));};exports[_0xefc9('0x4f')]=function(_0x42d0e9,_0x43a157){var _0x3f5bf5={'raw':![],'where':{'id':_0x42d0e9[_0xefc9('0x50')]['id']}},_0x48777d={};_0x48777d[_0xefc9('0x41')]=_[_0xefc9('0x3b')](db[_0xefc9('0x36')]['rawAttributes']);_0x48777d[_0xefc9('0x3a')]=_['keys'](_0x42d0e9[_0xefc9('0x3a')]);_0x48777d[_0xefc9('0x3c')]=_[_0xefc9('0x3d')](_0x48777d['model'],_0x48777d['query']);_0x3f5bf5[_0xefc9('0x3e')]=_[_0xefc9('0x3d')](_0x48777d[_0xefc9('0x41')],qs['fields'](_0x42d0e9[_0xefc9('0x3a')][_0xefc9('0x3f')]));_0x3f5bf5[_0xefc9('0x3e')]=_0x3f5bf5[_0xefc9('0x3e')][_0xefc9('0x40')]?_0x3f5bf5[_0xefc9('0x3e')]:_0x48777d[_0xefc9('0x41')];if(_0x42d0e9[_0xefc9('0x3a')][_0xefc9('0x4c')]){_0x3f5bf5[_0xefc9('0x4d')]=[{'all':!![]}];}_0x3f5bf5=_[_0xefc9('0x48')]({},_0x3f5bf5,_0x42d0e9['options']);return db[_0xefc9('0x36')][_0xefc9('0x51')](_0x3f5bf5)['then'](handleEntityNotFound(_0x43a157,null))[_0xefc9('0x17')](respondWithResult(_0x43a157,null))[_0xefc9('0x20')](handleError(_0x43a157,null));};exports[_0xefc9('0x52')]=function(_0x26b300,_0x295ad3,_0x1514de){var _0x41979f;return db[_0xefc9('0x36')][_0xefc9('0x52')](_0x26b300[_0xefc9('0x53')],{'raw':!![]})[_0xefc9('0x17')](function(_0x4c7698){_0x41979f=_0x4c7698;return db['VoiceContext'][_0xefc9('0x4e')]({'raw':!![]});})['then'](function(_0x6d122){var _0x1955c0=fs[_0xefc9('0x54')](path[_0xefc9('0x55')](config[_0xefc9('0x56')],_0xefc9('0x57')),_0xefc9('0x58'));var _0x118150=ejs[_0xefc9('0x59')](_0x1955c0,{'contexts':_0x6d122||[]});fs['writeFileSync'](_0xefc9('0x5a'),_0x118150);})['then'](function(){return respondWithRpcPromise(_0xefc9('0x5b'),_0xefc9('0x52'),{'module':'chan_sip.so'});})[_0xefc9('0x17')](function(){var _0x3c8c18=_0x26b300['user'][_0xefc9('0x2e')]({'plain':!![]});if(!_0x3c8c18)throw new Error(_0xefc9('0x5c'));if(_0x3c8c18[_0xefc9('0x5d')]===_0xefc9('0x5e')){var _0x37e696=_0x41979f['get']({'plain':!![]});return db[_0xefc9('0x5f')][_0xefc9('0x51')]({'where':{'name':'Contexts','userProfileId':_0x3c8c18[_0xefc9('0x60')]},'raw':!![]})['then'](function(_0x2d4bae){if(_0x2d4bae&&_0x2d4bae[_0xefc9('0x61')]===0x0){return db[_0xefc9('0x30')][_0xefc9('0x52')]({'name':_0x37e696[_0xefc9('0x33')],'resourceId':_0x37e696['id'],'type':_0x2d4bae[_0xefc9('0x33')],'sectionId':_0x2d4bae['id']},{})['then'](function(){return _0x41979f;});}else{return _0x41979f;}})['catch'](function(_0x2ecc8f){logger[_0xefc9('0x1c')](_0xefc9('0x62'),_0x2ecc8f);throw _0x2ecc8f;});}return _0x41979f;})['then'](respondWithResult(_0x295ad3,0xc9))[_0xefc9('0x20')](handleError(_0x295ad3,null));};exports['update']=function(_0x3ad470,_0x9d5dfa,_0x15d4f1){var _0x1504b9;return db[_0xefc9('0x36')][_0xefc9('0x51')]({'where':{'id':_0x3ad470[_0xefc9('0x50')]['id']}})[_0xefc9('0x17')](handleEntityNotFound(_0x9d5dfa,null))[_0xefc9('0x17')](saveUpdates(_0x3ad470[_0xefc9('0x53')],null))[_0xefc9('0x17')](function(_0x31a101){if(_0x31a101){_0x1504b9=_0x31a101;return db[_0xefc9('0x36')][_0xefc9('0x4e')]({'raw':!![]});}})[_0xefc9('0x17')](function(_0x1ae376){var _0x535050=fs[_0xefc9('0x54')](path[_0xefc9('0x55')](config[_0xefc9('0x56')],_0xefc9('0x57')),_0xefc9('0x58'));var _0x51c7bd=ejs['render'](_0x535050,{'contexts':_0x1ae376||[]});fs['writeFileSync'](_0xefc9('0x5a'),_0x51c7bd);})['then'](function(){return respondWithRpcPromise('Reload',_0xefc9('0x63'),{'module':'chan_sip.so'});})[_0xefc9('0x17')](function(){return _0x1504b9;})['then'](respondWithResult(_0x9d5dfa,null))[_0xefc9('0x20')](handleError(_0x9d5dfa,null));};exports['destroy']=function(_0x6b5ec4,_0x29831a,_0x15b19c){var _0x22b3ba;return db[_0xefc9('0x36')][_0xefc9('0x51')]({'where':{'id':_0x6b5ec4['params']['id']}})[_0xefc9('0x17')](handleEntityNotFound(_0x29831a,null))['then'](removeEntity(_0x29831a,null))[_0xefc9('0x17')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xefc9('0x17')](function(_0x5f1a58){var _0x33367e=fs['readFileSync'](path['join'](config['root'],_0xefc9('0x57')),_0xefc9('0x58'));var _0x3c5c16=ejs[_0xefc9('0x59')](_0x33367e,{'contexts':_0x5f1a58});fs[_0xefc9('0x64')](_0xefc9('0x5a'),_0x3c5c16);return respondWithRpcPromise(_0xefc9('0x5b'),_0xefc9('0x2d'),{'module':_0xefc9('0x65')});})['catch'](handleError(_0x29831a,null));}; \ No newline at end of file +var _0x62a3=['Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','readFileSync','writeFileSync','render','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','client','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','create','body','findAll','join','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0xf35621,_0xa71e8c){var _0x46ec28=function(_0x50d7d9){while(--_0x50d7d9){_0xf35621['push'](_0xf35621['shift']());}};_0x46ec28(++_0xa71e8c);}(_0x62a3,0xe2));var _0x362a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x62a3[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x362a('0x0'));var rimraf=require(_0x362a('0x1'));var zipdir=require(_0x362a('0x2'));var jsonpatch=require(_0x362a('0x3'));var rp=require('request-promise');var moment=require(_0x362a('0x4'));var BPromise=require(_0x362a('0x5'));var Mustache=require(_0x362a('0x6'));var util=require(_0x362a('0x7'));var path=require(_0x362a('0x8'));var sox=require(_0x362a('0x9'));var csv=require(_0x362a('0xa'));var ejs=require(_0x362a('0xb'));var fs=require('fs');var fs_extra=require(_0x362a('0xc'));var _=require(_0x362a('0xd'));var squel=require(_0x362a('0xe'));var crypto=require(_0x362a('0xf'));var jsforce=require(_0x362a('0x10'));var deskjs=require(_0x362a('0x11'));var toCsv=require(_0x362a('0xa'));var querystring=require(_0x362a('0x12'));var Papa=require(_0x362a('0x13'));var Redis=require(_0x362a('0x14'));var authService=require(_0x362a('0x15'));var qs=require(_0x362a('0x16'));var as=require(_0x362a('0x17'));var hardwareService=require(_0x362a('0x18'));var logger=require(_0x362a('0x19'))('api');var utils=require(_0x362a('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x362a('0x1b'));var db=require(_0x362a('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x362a('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d66e8,_0x2db1fb,_0x22371c,_0x37893c){return new BPromise(function(_0x9ec41c,_0x1b196b){var _0x460325=_0x37893c||client;return _0x460325[_0x362a('0x1e')](_0x4d66e8,_0x22371c)['then'](function(_0x534cc4){logger[_0x362a('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x2db1fb,_0x362a('0x20'));logger[_0x362a('0x21')](_0x362a('0x22'),_0x2db1fb,_0x362a('0x20'),JSON[_0x362a('0x23')](_0x534cc4));if(_0x534cc4['error']){if(_0x534cc4[_0x362a('0x24')][_0x362a('0x25')]===0x1f4){logger['error'](_0x362a('0x26'),_0x2db1fb,_0x534cc4[_0x362a('0x24')][_0x362a('0x27')]);return _0x1b196b(_0x534cc4[_0x362a('0x24')][_0x362a('0x27')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x2db1fb,_0x534cc4['error'][_0x362a('0x27')]);return _0x9ec41c(_0x534cc4['error'][_0x362a('0x27')]);}else{logger['info'](_0x362a('0x26'),_0x2db1fb,_0x362a('0x20'));_0x9ec41c(_0x534cc4[_0x362a('0x28')][_0x362a('0x27')]);}})[_0x362a('0x29')](function(_0x1352c4){logger[_0x362a('0x24')](_0x362a('0x26'),_0x2db1fb,_0x1352c4);_0x1b196b(_0x1352c4);});});}function respondWithStatusCode(_0x5605eb,_0x13cfef){_0x13cfef=_0x13cfef||0xcc;return function(_0x35901e){if(_0x35901e){return _0x5605eb[_0x362a('0x2a')](_0x13cfef);}return _0x5605eb[_0x362a('0x2b')](_0x13cfef)[_0x362a('0x2c')]();};}function respondWithResult(_0x53dcd5,_0x51c9d0){_0x51c9d0=_0x51c9d0||0xc8;return function(_0x2342ab){if(_0x2342ab){return _0x53dcd5[_0x362a('0x2b')](_0x51c9d0)[_0x362a('0x2d')](_0x2342ab);}};}function respondWithFilteredResult(_0x2d0631,_0xe4f6a){return function(_0x3867cc){if(_0x3867cc){var _0x3f1aaa=typeof _0xe4f6a[_0x362a('0x2e')]==='undefined'&&typeof _0xe4f6a[_0x362a('0x2f')]===_0x362a('0x30');var _0x290807=_0x3867cc[_0x362a('0x31')];var _0x46e98e=_0x3f1aaa?0x0:_0xe4f6a['offset'];var _0x2dfbe9=_0x3f1aaa?_0x3867cc[_0x362a('0x31')]:_0xe4f6a['offset']+_0xe4f6a[_0x362a('0x2f')];var _0x2b01f2;if(_0x2dfbe9>=_0x290807){_0x2dfbe9=_0x290807;_0x2b01f2=0xc8;}else{_0x2b01f2=0xce;}_0x2d0631[_0x362a('0x2b')](_0x2b01f2);return _0x2d0631[_0x362a('0x32')](_0x362a('0x33'),_0x46e98e+'-'+_0x2dfbe9+'/'+_0x290807)[_0x362a('0x2d')](_0x3867cc);}return null;};}function patchUpdates(_0x32ac8c){return function(_0x143408){try{jsonpatch[_0x362a('0x34')](_0x143408,_0x32ac8c,!![]);}catch(_0x468217){return BPromise[_0x362a('0x35')](_0x468217);}return _0x143408['save']();};}function saveUpdates(_0x27852d,_0x34a4c6){return function(_0x3ccab6){if(_0x3ccab6){return _0x3ccab6[_0x362a('0x36')](_0x27852d)[_0x362a('0x37')](function(_0x4d5b4e){return _0x4d5b4e;});}return null;};}function removeEntity(_0x46c55f,_0x1ad98e){return function(_0x4fae2b){if(_0x4fae2b){return _0x4fae2b[_0x362a('0x38')]()['then'](function(){var _0x1f1d84=_0x4fae2b[_0x362a('0x39')]({'plain':!![]});var _0x26d04d=_0x362a('0x3a');return db[_0x362a('0x3b')][_0x362a('0x38')]({'where':{'type':_0x26d04d,'resourceId':_0x1f1d84['id']}})[_0x362a('0x37')](function(){return _0x4fae2b;});})[_0x362a('0x37')](function(){_0x46c55f[_0x362a('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x397cc6,_0x5ec271){return function(_0x220f01){if(!_0x220f01){_0x397cc6[_0x362a('0x2a')](0x194);}return _0x220f01;};}function handleError(_0x4bff95,_0x2158d5){_0x2158d5=_0x2158d5||0x1f4;return function(_0x186aeb){logger[_0x362a('0x24')](_0x186aeb[_0x362a('0x3c')]);if(_0x186aeb[_0x362a('0x3d')]){delete _0x186aeb['name'];}_0x4bff95['status'](_0x2158d5)[_0x362a('0x3e')](_0x186aeb);};}exports[_0x362a('0x3f')]=function(_0x1084b4,_0x23081c){var _0x548f41={},_0x356b44={},_0x233103={'count':0x0,'rows':[]};var _0xdb4903=_[_0x362a('0x40')](db[_0x362a('0x41')][_0x362a('0x42')],function(_0x4dee2b){return{'name':_0x4dee2b[_0x362a('0x43')],'type':_0x4dee2b[_0x362a('0x44')][_0x362a('0x45')]};});_0x356b44[_0x362a('0x46')]=_[_0x362a('0x40')](_0xdb4903,_0x362a('0x3d'));_0x356b44['query']=_[_0x362a('0x47')](_0x1084b4['query']);_0x356b44[_0x362a('0x48')]=_['intersection'](_0x356b44[_0x362a('0x46')],_0x356b44[_0x362a('0x49')]);_0x548f41[_0x362a('0x4a')]=_[_0x362a('0x4b')](_0x356b44['model'],qs[_0x362a('0x4c')](_0x1084b4[_0x362a('0x49')][_0x362a('0x4c')]));_0x548f41['attributes']=_0x548f41[_0x362a('0x4a')][_0x362a('0x4d')]?_0x548f41['attributes']:_0x356b44['model'];if(!_0x1084b4['query']['hasOwnProperty']('nolimit')){_0x548f41[_0x362a('0x2f')]=qs[_0x362a('0x2f')](_0x1084b4[_0x362a('0x49')][_0x362a('0x2f')]);_0x548f41['offset']=qs[_0x362a('0x2e')](_0x1084b4['query'][_0x362a('0x2e')]);}_0x548f41['order']=qs[_0x362a('0x4e')](_0x1084b4['query'][_0x362a('0x4e')]);_0x548f41[_0x362a('0x4f')]=qs['filters'](_['pick'](_0x1084b4[_0x362a('0x49')],_0x356b44[_0x362a('0x48')]),_0xdb4903);if(_0x1084b4[_0x362a('0x49')][_0x362a('0x50')]){_0x548f41['where']=_[_0x362a('0x51')](_0x548f41['where'],{'$or':_[_0x362a('0x40')](_0xdb4903,function(_0x78239a){if(_0x78239a['type']!==_0x362a('0x52')){var _0x53ef9a={};_0x53ef9a[_0x78239a[_0x362a('0x3d')]]={'$like':'%'+_0x1084b4[_0x362a('0x49')][_0x362a('0x50')]+'%'};return _0x53ef9a;}})});}_0x548f41=_['merge']({},_0x548f41,_0x1084b4[_0x362a('0x53')]);var _0x28e5ec={'where':_0x548f41[_0x362a('0x4f')]};return db[_0x362a('0x41')][_0x362a('0x31')](_0x28e5ec)[_0x362a('0x37')](function(_0x1ff709){_0x233103[_0x362a('0x31')]=_0x1ff709;if(_0x1084b4[_0x362a('0x49')][_0x362a('0x54')]){_0x548f41['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x548f41);})[_0x362a('0x37')](function(_0x14b867){_0x233103[_0x362a('0x55')]=_0x14b867;return _0x233103;})[_0x362a('0x37')](respondWithFilteredResult(_0x23081c,_0x548f41))[_0x362a('0x29')](handleError(_0x23081c,null));};exports[_0x362a('0x56')]=function(_0x3463e5,_0xc85a69){var _0x12f86d={'raw':![],'where':{'id':_0x3463e5[_0x362a('0x57')]['id']}},_0x1fb2fb={};_0x1fb2fb[_0x362a('0x46')]=_['keys'](db[_0x362a('0x41')][_0x362a('0x42')]);_0x1fb2fb[_0x362a('0x49')]=_[_0x362a('0x47')](_0x3463e5[_0x362a('0x49')]);_0x1fb2fb[_0x362a('0x48')]=_[_0x362a('0x4b')](_0x1fb2fb[_0x362a('0x46')],_0x1fb2fb[_0x362a('0x49')]);_0x12f86d[_0x362a('0x4a')]=_[_0x362a('0x4b')](_0x1fb2fb[_0x362a('0x46')],qs[_0x362a('0x4c')](_0x3463e5[_0x362a('0x49')][_0x362a('0x4c')]));_0x12f86d[_0x362a('0x4a')]=_0x12f86d[_0x362a('0x4a')]['length']?_0x12f86d[_0x362a('0x4a')]:_0x1fb2fb[_0x362a('0x46')];if(_0x3463e5[_0x362a('0x49')][_0x362a('0x54')]){_0x12f86d[_0x362a('0x58')]=[{'all':!![]}];}_0x12f86d=_['merge']({},_0x12f86d,_0x3463e5['options']);return db['VoiceContext'][_0x362a('0x59')](_0x12f86d)[_0x362a('0x37')](handleEntityNotFound(_0xc85a69,null))[_0x362a('0x37')](respondWithResult(_0xc85a69,null))['catch'](handleError(_0xc85a69,null));};exports[_0x362a('0x5a')]=function(_0x1c4204,_0x57cbb0,_0x5ed74f){var _0x5de846;return db['VoiceContext']['create'](_0x1c4204[_0x362a('0x5b')],{'raw':!![]})['then'](function(_0xdf27fe){_0x5de846=_0xdf27fe;return db[_0x362a('0x41')][_0x362a('0x5c')]({'raw':!![]});})[_0x362a('0x37')](function(_0x2aa367){var _0x474819=fs['readFileSync'](path[_0x362a('0x5d')](config[_0x362a('0x5e')],_0x362a('0x5f')),_0x362a('0x60'));var _0x585f52=ejs['render'](_0x474819,{'contexts':_0x2aa367||[]});fs['writeFileSync'](_0x362a('0x61'),_0x585f52);})[_0x362a('0x37')](function(){return respondWithRpcPromise(_0x362a('0x62'),_0x362a('0x5a'),{'module':_0x362a('0x63')});})[_0x362a('0x37')](function(){var _0x240e43=_0x1c4204['user'][_0x362a('0x39')]({'plain':!![]});if(!_0x240e43)throw new Error(_0x362a('0x64'));if(_0x240e43[_0x362a('0x65')]===_0x362a('0x66')){var _0x47a7f8=_0x5de846['get']({'plain':!![]});return db[_0x362a('0x67')][_0x362a('0x59')]({'where':{'name':'Contexts','userProfileId':_0x240e43[_0x362a('0x68')]},'raw':!![]})['then'](function(_0x4f79d2){if(_0x4f79d2&&_0x4f79d2['autoAssociation']===0x0){return db[_0x362a('0x3b')]['create']({'name':_0x47a7f8[_0x362a('0x3d')],'resourceId':_0x47a7f8['id'],'type':_0x4f79d2[_0x362a('0x3d')],'sectionId':_0x4f79d2['id']},{})[_0x362a('0x37')](function(){return _0x5de846;});}else{return _0x5de846;}})[_0x362a('0x29')](function(_0x27054e){logger[_0x362a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27054e);throw _0x27054e;});}return _0x5de846;})[_0x362a('0x37')](respondWithResult(_0x57cbb0,0xc9))[_0x362a('0x29')](handleError(_0x57cbb0,null));};exports[_0x362a('0x36')]=function(_0x2e0435,_0x56a893,_0x507a32){var _0x1b6afa;return db[_0x362a('0x41')]['find']({'where':{'id':_0x2e0435[_0x362a('0x57')]['id']}})[_0x362a('0x37')](handleEntityNotFound(_0x56a893,null))[_0x362a('0x37')](saveUpdates(_0x2e0435[_0x362a('0x5b')],null))[_0x362a('0x37')](function(_0x2ea0d8){if(_0x2ea0d8){_0x1b6afa=_0x2ea0d8;return db['VoiceContext'][_0x362a('0x5c')]({'raw':!![]});}})[_0x362a('0x37')](function(_0x1224bc){var _0x34ff7f=fs[_0x362a('0x69')](path['join'](config['root'],_0x362a('0x5f')),'utf8');var _0x21ed95=ejs['render'](_0x34ff7f,{'contexts':_0x1224bc||[]});fs[_0x362a('0x6a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x21ed95);})[_0x362a('0x37')](function(){return respondWithRpcPromise(_0x362a('0x62'),'update',{'module':_0x362a('0x63')});})['then'](function(){return _0x1b6afa;})[_0x362a('0x37')](respondWithResult(_0x56a893,null))[_0x362a('0x29')](handleError(_0x56a893,null));};exports[_0x362a('0x38')]=function(_0x576ac2,_0x5a6a3d,_0x3fdd79){var _0x3a39c0;return db[_0x362a('0x41')][_0x362a('0x59')]({'where':{'id':_0x576ac2[_0x362a('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a6a3d,null))[_0x362a('0x37')](removeEntity(_0x5a6a3d,null))['then'](function(){return db[_0x362a('0x41')][_0x362a('0x5c')]({'raw':!![]});})['then'](function(_0x3ff610){var _0x3a45db=fs['readFileSync'](path[_0x362a('0x5d')](config[_0x362a('0x5e')],_0x362a('0x5f')),_0x362a('0x60'));var _0x217c25=ejs[_0x362a('0x6b')](_0x3a45db,{'contexts':_0x3ff610});fs[_0x362a('0x6a')](_0x362a('0x61'),_0x217c25);return respondWithRpcPromise(_0x362a('0x62'),_0x362a('0x38'),{'module':'chan_sip.so'});})[_0x362a('0x29')](handleError(_0x5a6a3d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0e8eccd..a176026 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 _0xa7f3=['request-promise','path','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','../../config/logger','api','moment','bluebird'];(function(_0x245386,_0x391e32){var _0x5cfacb=function(_0x5458e5){while(--_0x5458e5){_0x245386['push'](_0x245386['shift']());}};_0x5cfacb(++_0x391e32);}(_0xa7f3,0x1e0));var _0x3a7f=function(_0x2f20f8,_0x54a3f2){_0x2f20f8=_0x2f20f8-0x0;var _0xfcb1b7=_0xa7f3[_0x2f20f8];return _0xfcb1b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3a7f('0x0'))(_0x3a7f('0x1'));var moment=require(_0x3a7f('0x2'));var BPromise=require(_0x3a7f('0x3'));var rp=require(_0x3a7f('0x4'));var fs=require('fs');var path=require(_0x3a7f('0x5'));var rimraf=require('rimraf');var config=require(_0x3a7f('0x6'));var attributes=require(_0x3a7f('0x7'));module[_0x3a7f('0x8')]=function(_0x11297b,_0x8e90e9){return _0x11297b[_0x3a7f('0x9')]('VoiceContext',attributes,{'tableName':_0x3a7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb2=['../../config/logger','bluebird','path','./voiceContext.attributes','exports','define','voice_contexts','lodash','util'];(function(_0x75b0e8,_0x4f0954){var _0xb93ff=function(_0x33ba4b){while(--_0x33ba4b){_0x75b0e8['push'](_0x75b0e8['shift']());}};_0xb93ff(++_0x4f0954);}(_0xafb2,0x73));var _0x2afb=function(_0x4353dc,_0x53196a){_0x4353dc=_0x4353dc-0x0;var _0xea058d=_0xafb2[_0x4353dc];return _0xea058d;};'use strict';var _=require(_0x2afb('0x0'));var util=require(_0x2afb('0x1'));var logger=require(_0x2afb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2afb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2afb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2afb('0x5'));module[_0x2afb('0x6')]=function(_0x2e37c6,_0x1e542b){return _0x2e37c6[_0x2afb('0x7')]('VoiceContext',attributes,{'tableName':_0x2afb('0x8'),'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 32b2fd5..f94de88 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 _0x6da1=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x6da1,0x1b8));var _0x16da=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x6da1[_0x121b1a];return _0x2d89a6;};'use strict';var _=require('lodash');var util=require(_0x16da('0x0'));var moment=require('moment');var BPromise=require(_0x16da('0x1'));var rs=require(_0x16da('0x2'));var fs=require('fs');var Redis=require(_0x16da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x16da('0x4'));var logger=require(_0x16da('0x5'))('rpc');var config=require(_0x16da('0x6'));var jayson=require(_0x16da('0x7'));var client=jayson[_0x16da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aa4b0,_0x414b10,_0x9ced5c){return new BPromise(function(_0x12df0e,_0x4410d0){return client['request'](_0x4aa4b0,_0x9ced5c)[_0x16da('0x9')](function(_0x495f89){logger[_0x16da('0xa')](_0x16da('0xb'),_0x414b10,_0x16da('0xc'));logger[_0x16da('0xd')](_0x16da('0xe'),_0x414b10,_0x16da('0xc'),JSON[_0x16da('0xf')](_0x495f89));if(_0x495f89[_0x16da('0x10')]){if(_0x495f89[_0x16da('0x10')][_0x16da('0x11')]===0x1f4){logger[_0x16da('0x10')]('VoiceContext,\x20%s,\x20%s',_0x414b10,_0x495f89['error']['message']);return _0x4410d0(_0x495f89[_0x16da('0x10')][_0x16da('0x12')]);}logger[_0x16da('0x10')]('VoiceContext,\x20%s,\x20%s',_0x414b10,_0x495f89[_0x16da('0x10')][_0x16da('0x12')]);return _0x12df0e(_0x495f89[_0x16da('0x10')]['message']);}else{logger[_0x16da('0xa')](_0x16da('0xb'),_0x414b10,_0x16da('0xc'));_0x12df0e(_0x495f89[_0x16da('0x13')]['message']);}})[_0x16da('0x14')](function(_0x30e761){logger[_0x16da('0x10')](_0x16da('0xb'),_0x414b10,_0x30e761);_0x4410d0(_0x30e761);});});} \ No newline at end of file +var _0xb13f=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x471dfd,_0x187c29){var _0x3cd9b2=function(_0x29d03f){while(--_0x29d03f){_0x471dfd['push'](_0x471dfd['shift']());}};_0x3cd9b2(++_0x187c29);}(_0xb13f,0x1de));var _0xfb13=function(_0x1ae5f0,_0x29e46b){_0x1ae5f0=_0x1ae5f0-0x0;var _0x13798b=_0xb13f[_0x1ae5f0];return _0x13798b;};'use strict';var _=require(_0xfb13('0x0'));var util=require(_0xfb13('0x1'));var moment=require('moment');var BPromise=require(_0xfb13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb13('0x3'));var db=require(_0xfb13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb13('0x5'))('rpc');var config=require(_0xfb13('0x6'));var jayson=require(_0xfb13('0x7'));var client=jayson[_0xfb13('0x8')][_0xfb13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x227dc0,_0xbad653,_0x2d3890){return new BPromise(function(_0x3472ed,_0x79e42){return client[_0xfb13('0xa')](_0x227dc0,_0x2d3890)[_0xfb13('0xb')](function(_0x4e4877){logger[_0xfb13('0xc')]('VoiceContext,\x20%s,\x20%s',_0xbad653,_0xfb13('0xd'));logger['debug'](_0xfb13('0xe'),_0xbad653,_0xfb13('0xd'),JSON['stringify'](_0x4e4877));if(_0x4e4877[_0xfb13('0xf')]){if(_0x4e4877['error'][_0xfb13('0x10')]===0x1f4){logger['error'](_0xfb13('0x11'),_0xbad653,_0x4e4877['error'][_0xfb13('0x12')]);return _0x79e42(_0x4e4877[_0xfb13('0xf')][_0xfb13('0x12')]);}logger['error'](_0xfb13('0x11'),_0xbad653,_0x4e4877[_0xfb13('0xf')]['message']);return _0x3472ed(_0x4e4877[_0xfb13('0xf')][_0xfb13('0x12')]);}else{logger[_0xfb13('0xc')]('VoiceContext,\x20%s,\x20%s',_0xbad653,_0xfb13('0xd'));_0x3472ed(_0x4e4877['result'][_0xfb13('0x12')]);}})[_0xfb13('0x13')](function(_0x97d5c0){logger[_0xfb13('0xf')](_0xfb13('0x11'),_0xbad653,_0x97d5c0);_0x79e42(_0x97d5c0);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index be9b4cb..76cd0b7 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 _0xcbdd=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xcbdd,0xec));var _0xdcbd=function(_0x12edeb,_0x3f5e5e){_0x12edeb=_0x12edeb-0x0;var _0x2905e7=_0xcbdd[_0x12edeb];return _0x2905e7;};'use strict';var multer=require(_0xdcbd('0x0'));var util=require('util');var path=require(_0xdcbd('0x1'));var timeout=require(_0xdcbd('0x2'));var express=require(_0xdcbd('0x3'));var router=express['Router']();var fs_extra=require(_0xdcbd('0x4'));var auth=require(_0xdcbd('0x5'));var interaction=require(_0xdcbd('0x6'));var config=require('../../config/environment');var controller=require(_0xdcbd('0x7'));router['get']('/',auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x9')]);router[_0xdcbd('0xa')](_0xdcbd('0xb'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0xc')]);router[_0xdcbd('0xa')](_0xdcbd('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xdcbd('0xe')]('/',auth[_0xdcbd('0x8')](),controller[_0xdcbd('0xf')]);router[_0xdcbd('0x10')](_0xdcbd('0xd'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x11')]);router[_0xdcbd('0x12')](_0xdcbd('0xd'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x13')]);module[_0xdcbd('0x14')]=router; \ No newline at end of file +var _0x2d1f=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','destroy','exports','multer'];(function(_0x4d1dfc,_0x1a7cd5){var _0x24fdec=function(_0x7175b8){while(--_0x7175b8){_0x4d1dfc['push'](_0x4d1dfc['shift']());}};_0x24fdec(++_0x1a7cd5);}(_0x2d1f,0x143));var _0xf2d1=function(_0x5c9659,_0x26c8e1){_0x5c9659=_0x5c9659-0x0;var _0x4fc6a0=_0x2d1f[_0x5c9659];return _0x4fc6a0;};'use strict';var multer=require(_0xf2d1('0x0'));var util=require(_0xf2d1('0x1'));var path=require('path');var timeout=require(_0xf2d1('0x2'));var express=require(_0xf2d1('0x3'));var router=express[_0xf2d1('0x4')]();var fs_extra=require(_0xf2d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf2d1('0x6'));var config=require('../../config/environment');var controller=require(_0xf2d1('0x7'));router[_0xf2d1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf2d1('0x9'),auth[_0xf2d1('0xa')](),controller[_0xf2d1('0xb')]);router['get'](_0xf2d1('0xc'),auth[_0xf2d1('0xa')](),controller['show']);router[_0xf2d1('0xd')]('/',auth[_0xf2d1('0xa')](),controller[_0xf2d1('0xe')]);router[_0xf2d1('0xf')](_0xf2d1('0xc'),auth[_0xf2d1('0xa')](),controller['update']);router['delete'](_0xf2d1('0xc'),auth[_0xf2d1('0xa')](),controller[_0xf2d1('0x10')]);module[_0xf2d1('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 ad3438b..7c2a1fa 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 _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x9f62,0x154));var _0x29f6=function(_0x330209,_0x2d27c9){_0x330209=_0x330209-0x0;var _0x38bc12=_0x9f62[_0x330209];return _0x38bc12;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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 85a8e16..082ef4a 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 _0xe98b=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','params','include','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe98b,0x184));var _0xbe98=function(_0x2d7018,_0x5effe1){_0x2d7018=_0x2d7018-0x0;var _0x4e4820=_0xe98b[_0x2d7018];return _0x4e4820;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe98('0x0'));var zipdir=require(_0xbe98('0x1'));var jsonpatch=require(_0xbe98('0x2'));var rp=require(_0xbe98('0x3'));var moment=require(_0xbe98('0x4'));var BPromise=require(_0xbe98('0x5'));var Mustache=require(_0xbe98('0x6'));var util=require(_0xbe98('0x7'));var path=require(_0xbe98('0x8'));var sox=require(_0xbe98('0x9'));var csv=require(_0xbe98('0xa'));var ejs=require(_0xbe98('0xb'));var fs=require('fs');var fs_extra=require(_0xbe98('0xc'));var _=require(_0xbe98('0xd'));var squel=require('squel');var crypto=require(_0xbe98('0xe'));var jsforce=require(_0xbe98('0xf'));var deskjs=require(_0xbe98('0x10'));var toCsv=require(_0xbe98('0xa'));var querystring=require('querystring');var Papa=require(_0xbe98('0x11'));var Redis=require(_0xbe98('0x12'));var authService=require(_0xbe98('0x13'));var qs=require(_0xbe98('0x14'));var as=require(_0xbe98('0x15'));var hardwareService=require(_0xbe98('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xbe98('0x17'));var config=require(_0xbe98('0x18'));var licenseUtil=require(_0xbe98('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fe163,_0x3d9ce7){_0x3d9ce7=_0x3d9ce7||0xcc;return function(_0x3e7e8c){if(_0x3e7e8c){return _0x2fe163['sendStatus'](_0x3d9ce7);}return _0x2fe163[_0xbe98('0x1a')](_0x3d9ce7)[_0xbe98('0x1b')]();};}function respondWithResult(_0x12b719,_0x59ad59){_0x59ad59=_0x59ad59||0xc8;return function(_0x26f0e6){if(_0x26f0e6){return _0x12b719[_0xbe98('0x1a')](_0x59ad59)[_0xbe98('0x1c')](_0x26f0e6);}};}function respondWithFilteredResult(_0x3e5fcb,_0x27a7a1){return function(_0x41f566){if(_0x41f566){var _0x39d06d=typeof _0x27a7a1[_0xbe98('0x1d')]==='undefined'&&typeof _0x27a7a1[_0xbe98('0x1e')]===_0xbe98('0x1f');var _0x5590b8=_0x41f566['count'];var _0x3534db=_0x39d06d?0x0:_0x27a7a1['offset'];var _0xcf9f36=_0x39d06d?_0x41f566[_0xbe98('0x20')]:_0x27a7a1[_0xbe98('0x1d')]+_0x27a7a1[_0xbe98('0x1e')];var _0x2efeec;if(_0xcf9f36>=_0x5590b8){_0xcf9f36=_0x5590b8;_0x2efeec=0xc8;}else{_0x2efeec=0xce;}_0x3e5fcb[_0xbe98('0x1a')](_0x2efeec);return _0x3e5fcb['set'](_0xbe98('0x21'),_0x3534db+'-'+_0xcf9f36+'/'+_0x5590b8)['json'](_0x41f566);}return null;};}function patchUpdates(_0x52cace){return function(_0x4194ea){try{jsonpatch[_0xbe98('0x22')](_0x4194ea,_0x52cace,!![]);}catch(_0x503463){return BPromise[_0xbe98('0x23')](_0x503463);}return _0x4194ea[_0xbe98('0x24')]();};}function saveUpdates(_0x5bdcef,_0x526deb){return function(_0x585483){if(_0x585483){return _0x585483[_0xbe98('0x25')](_0x5bdcef)[_0xbe98('0x26')](function(_0x31bb53){return _0x31bb53;});}return null;};}function removeEntity(_0x258ef0,_0x17d8d5){return function(_0x16b549){if(_0x16b549){return _0x16b549[_0xbe98('0x27')]()[_0xbe98('0x26')](function(){_0x258ef0[_0xbe98('0x1a')](0xcc)[_0xbe98('0x1b')]();});}};}function handleEntityNotFound(_0x5eeb72,_0xe31695){return function(_0x5e55f3){if(!_0x5e55f3){_0x5eeb72[_0xbe98('0x28')](0x194);}return _0x5e55f3;};}function handleError(_0x500329,_0x38e6e){_0x38e6e=_0x38e6e||0x1f4;return function(_0x31f7b2){logger[_0xbe98('0x29')](_0x31f7b2[_0xbe98('0x2a')]);if(_0x31f7b2[_0xbe98('0x2b')]){delete _0x31f7b2[_0xbe98('0x2b')];}_0x500329[_0xbe98('0x1a')](_0x38e6e)[_0xbe98('0x2c')](_0x31f7b2);};}exports['index']=function(_0x489971,_0x234f28){var _0x251984={},_0x5261c2={},_0x11aff8={'count':0x0,'rows':[]};var _0x48bd15=_[_0xbe98('0x2d')](db[_0xbe98('0x2e')][_0xbe98('0x2f')],function(_0x10ba58){return{'name':_0x10ba58[_0xbe98('0x30')],'type':_0x10ba58[_0xbe98('0x31')][_0xbe98('0x32')]};});_0x5261c2['model']=_[_0xbe98('0x2d')](_0x48bd15,_0xbe98('0x2b'));_0x5261c2[_0xbe98('0x33')]=_[_0xbe98('0x34')](_0x489971[_0xbe98('0x33')]);_0x5261c2['filters']=_[_0xbe98('0x35')](_0x5261c2[_0xbe98('0x36')],_0x5261c2[_0xbe98('0x33')]);_0x251984['attributes']=_['intersection'](_0x5261c2[_0xbe98('0x36')],qs[_0xbe98('0x37')](_0x489971[_0xbe98('0x33')]['fields']));_0x251984[_0xbe98('0x38')]=_0x251984[_0xbe98('0x38')]['length']?_0x251984[_0xbe98('0x38')]:_0x5261c2[_0xbe98('0x36')];if(!_0x489971[_0xbe98('0x33')][_0xbe98('0x39')](_0xbe98('0x3a'))){_0x251984['limit']=qs[_0xbe98('0x1e')](_0x489971['query']['limit']);_0x251984[_0xbe98('0x1d')]=qs[_0xbe98('0x1d')](_0x489971['query']['offset']);}_0x251984[_0xbe98('0x3b')]=qs[_0xbe98('0x3c')](_0x489971[_0xbe98('0x33')][_0xbe98('0x3c')]);_0x251984[_0xbe98('0x3d')]=qs[_0xbe98('0x3e')](_[_0xbe98('0x3f')](_0x489971['query'],_0x5261c2['filters']),_0x48bd15);if(_0x489971['query']['filter']){_0x251984[_0xbe98('0x3d')]=_['merge'](_0x251984[_0xbe98('0x3d')],{'$or':_['map'](_0x48bd15,function(_0x270866){if(_0x270866[_0xbe98('0x31')]!==_0xbe98('0x40')){var _0x318707={};_0x318707[_0x270866[_0xbe98('0x2b')]]={'$like':'%'+_0x489971[_0xbe98('0x33')][_0xbe98('0x41')]+'%'};return _0x318707;}})});}_0x251984=_[_0xbe98('0x42')]({},_0x251984,_0x489971[_0xbe98('0x43')]);var _0x2d7b5a={'where':_0x251984[_0xbe98('0x3d')]};return db[_0xbe98('0x2e')][_0xbe98('0x20')](_0x2d7b5a)['then'](function(_0x3ce9b1){_0x11aff8[_0xbe98('0x20')]=_0x3ce9b1;if(_0x489971[_0xbe98('0x33')]['includeAll']){_0x251984['include']=[{'all':!![]}];}return db[_0xbe98('0x2e')][_0xbe98('0x44')](_0x251984);})[_0xbe98('0x26')](function(_0x3af38c){_0x11aff8[_0xbe98('0x45')]=_0x3af38c;return _0x11aff8;})[_0xbe98('0x26')](respondWithFilteredResult(_0x234f28,_0x251984))[_0xbe98('0x46')](handleError(_0x234f28,null));};exports['show']=function(_0x1ce621,_0xdc2d35){var _0x136f10={'raw':!![],'where':{'id':_0x1ce621[_0xbe98('0x47')]['id']}},_0x282335={};_0x282335[_0xbe98('0x36')]=_[_0xbe98('0x34')](db[_0xbe98('0x2e')][_0xbe98('0x2f')]);_0x282335[_0xbe98('0x33')]=_[_0xbe98('0x34')](_0x1ce621[_0xbe98('0x33')]);_0x282335[_0xbe98('0x3e')]=_[_0xbe98('0x35')](_0x282335[_0xbe98('0x36')],_0x282335['query']);_0x136f10[_0xbe98('0x38')]=_['intersection'](_0x282335[_0xbe98('0x36')],qs['fields'](_0x1ce621[_0xbe98('0x33')][_0xbe98('0x37')]));_0x136f10[_0xbe98('0x38')]=_0x136f10['attributes']['length']?_0x136f10['attributes']:_0x282335[_0xbe98('0x36')];if(_0x1ce621[_0xbe98('0x33')]['includeAll']){_0x136f10[_0xbe98('0x48')]=[{'all':!![]}];}_0x136f10=_[_0xbe98('0x42')]({},_0x136f10,_0x1ce621[_0xbe98('0x43')]);return db['VoiceDialReport'][_0xbe98('0x49')](_0x136f10)['then'](handleEntityNotFound(_0xdc2d35,null))[_0xbe98('0x26')](respondWithResult(_0xdc2d35,null))[_0xbe98('0x46')](handleError(_0xdc2d35,null));};exports[_0xbe98('0x4a')]=function(_0x2968d8,_0x4559cb){return db[_0xbe98('0x2e')][_0xbe98('0x4a')](_0x2968d8[_0xbe98('0x4b')],{})[_0xbe98('0x26')](respondWithResult(_0x4559cb,0xc9))['catch'](handleError(_0x4559cb,null));};exports[_0xbe98('0x25')]=function(_0xbbee8,_0x2fbf74){if(_0xbbee8[_0xbe98('0x4b')]['id']){delete _0xbbee8[_0xbe98('0x4b')]['id'];}return db[_0xbe98('0x2e')][_0xbe98('0x49')]({'where':{'id':_0xbbee8[_0xbe98('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fbf74,null))['then'](saveUpdates(_0xbbee8[_0xbe98('0x4b')],null))[_0xbe98('0x26')](respondWithResult(_0x2fbf74,null))['catch'](handleError(_0x2fbf74,null));};exports[_0xbe98('0x27')]=function(_0x46d17e,_0x5eb584){return db['VoiceDialReport'][_0xbe98('0x49')]({'where':{'id':_0x46d17e[_0xbe98('0x47')]['id']}})[_0xbe98('0x26')](handleEntityNotFound(_0x5eb584,null))[_0xbe98('0x26')](removeEntity(_0x5eb584,null))[_0xbe98('0x46')](handleError(_0x5eb584,null));};exports[_0xbe98('0x4c')]=function(_0x360a73,_0x33b7bc){return db[_0xbe98('0x2e')][_0xbe98('0x4c')]()[_0xbe98('0x26')](respondWithResult(_0x33b7bc,null))[_0xbe98('0x46')](handleError(_0x33b7bc,null));}; \ No newline at end of file +var _0xd2fb=['key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','status','send','index','map','VoiceDialReport','type'];(function(_0x2fbdd5,_0x389146){var _0x3eb861=function(_0x38feed){while(--_0x38feed){_0x2fbdd5['push'](_0x2fbdd5['shift']());}};_0x3eb861(++_0x389146);}(_0xd2fb,0x1ca));var _0xbd2f=function(_0x304d10,_0x595fff){_0x304d10=_0x304d10-0x0;var _0x1225d9=_0xd2fb[_0x304d10];return _0x1225d9;};'use strict';var emlformat=require(_0xbd2f('0x0'));var rimraf=require(_0xbd2f('0x1'));var zipdir=require(_0xbd2f('0x2'));var jsonpatch=require(_0xbd2f('0x3'));var rp=require(_0xbd2f('0x4'));var moment=require(_0xbd2f('0x5'));var BPromise=require(_0xbd2f('0x6'));var Mustache=require(_0xbd2f('0x7'));var util=require(_0xbd2f('0x8'));var path=require('path');var sox=require(_0xbd2f('0x9'));var csv=require(_0xbd2f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd2f('0xb'));var squel=require('squel');var crypto=require(_0xbd2f('0xc'));var jsforce=require(_0xbd2f('0xd'));var deskjs=require(_0xbd2f('0xe'));var toCsv=require(_0xbd2f('0xa'));var querystring=require('querystring');var Papa=require(_0xbd2f('0xf'));var Redis=require('ioredis');var authService=require(_0xbd2f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbd2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd2f('0x12'))(_0xbd2f('0x13'));var utils=require(_0xbd2f('0x14'));var config=require(_0xbd2f('0x15'));var licenseUtil=require(_0xbd2f('0x16'));var db=require(_0xbd2f('0x17'))['db'];function respondWithStatusCode(_0x3c2a2e,_0x51fe22){_0x51fe22=_0x51fe22||0xcc;return function(_0x3077a9){if(_0x3077a9){return _0x3c2a2e['sendStatus'](_0x51fe22);}return _0x3c2a2e['status'](_0x51fe22)[_0xbd2f('0x18')]();};}function respondWithResult(_0xfd1b80,_0x4c927b){_0x4c927b=_0x4c927b||0xc8;return function(_0x1523c1){if(_0x1523c1){return _0xfd1b80['status'](_0x4c927b)['json'](_0x1523c1);}};}function respondWithFilteredResult(_0x25d70f,_0x21dfd2){return function(_0x1ce14e){if(_0x1ce14e){var _0x314cc1=typeof _0x21dfd2[_0xbd2f('0x19')]==='undefined'&&typeof _0x21dfd2[_0xbd2f('0x1a')]==='undefined';var _0x3ff56b=_0x1ce14e[_0xbd2f('0x1b')];var _0x417fec=_0x314cc1?0x0:_0x21dfd2[_0xbd2f('0x19')];var _0x3e356b=_0x314cc1?_0x1ce14e['count']:_0x21dfd2[_0xbd2f('0x19')]+_0x21dfd2[_0xbd2f('0x1a')];var _0x1a2a42;if(_0x3e356b>=_0x3ff56b){_0x3e356b=_0x3ff56b;_0x1a2a42=0xc8;}else{_0x1a2a42=0xce;}_0x25d70f['status'](_0x1a2a42);return _0x25d70f['set'](_0xbd2f('0x1c'),_0x417fec+'-'+_0x3e356b+'/'+_0x3ff56b)[_0xbd2f('0x1d')](_0x1ce14e);}return null;};}function patchUpdates(_0x2d46e2){return function(_0x1eca92){try{jsonpatch[_0xbd2f('0x1e')](_0x1eca92,_0x2d46e2,!![]);}catch(_0x42d9b8){return BPromise[_0xbd2f('0x1f')](_0x42d9b8);}return _0x1eca92[_0xbd2f('0x20')]();};}function saveUpdates(_0x3821dd,_0x58f9a6){return function(_0x2eda1c){if(_0x2eda1c){return _0x2eda1c[_0xbd2f('0x21')](_0x3821dd)[_0xbd2f('0x22')](function(_0x15f5bc){return _0x15f5bc;});}return null;};}function removeEntity(_0x23fea7,_0x32fdc2){return function(_0x58d837){if(_0x58d837){return _0x58d837[_0xbd2f('0x23')]()[_0xbd2f('0x22')](function(){_0x23fea7['status'](0xcc)[_0xbd2f('0x18')]();});}};}function handleEntityNotFound(_0x2b9374,_0xb29ce2){return function(_0x23764a){if(!_0x23764a){_0x2b9374[_0xbd2f('0x24')](0x194);}return _0x23764a;};}function handleError(_0x4af8a5,_0x44cf79){_0x44cf79=_0x44cf79||0x1f4;return function(_0x3a99c9){logger[_0xbd2f('0x25')](_0x3a99c9[_0xbd2f('0x26')]);if(_0x3a99c9[_0xbd2f('0x27')]){delete _0x3a99c9[_0xbd2f('0x27')];}_0x4af8a5[_0xbd2f('0x28')](_0x44cf79)[_0xbd2f('0x29')](_0x3a99c9);};}exports[_0xbd2f('0x2a')]=function(_0xce7c41,_0x4e3e89){var _0x211196={},_0x4409f1={},_0x45e771={'count':0x0,'rows':[]};var _0x54c985=_[_0xbd2f('0x2b')](db[_0xbd2f('0x2c')]['rawAttributes'],function(_0x2b8154){return{'name':_0x2b8154['fieldName'],'type':_0x2b8154[_0xbd2f('0x2d')][_0xbd2f('0x2e')]};});_0x4409f1[_0xbd2f('0x2f')]=_[_0xbd2f('0x2b')](_0x54c985,_0xbd2f('0x27'));_0x4409f1[_0xbd2f('0x30')]=_[_0xbd2f('0x31')](_0xce7c41[_0xbd2f('0x30')]);_0x4409f1['filters']=_['intersection'](_0x4409f1[_0xbd2f('0x2f')],_0x4409f1[_0xbd2f('0x30')]);_0x211196['attributes']=_['intersection'](_0x4409f1[_0xbd2f('0x2f')],qs['fields'](_0xce7c41['query'][_0xbd2f('0x32')]));_0x211196['attributes']=_0x211196[_0xbd2f('0x33')][_0xbd2f('0x34')]?_0x211196[_0xbd2f('0x33')]:_0x4409f1[_0xbd2f('0x2f')];if(!_0xce7c41[_0xbd2f('0x30')][_0xbd2f('0x35')](_0xbd2f('0x36'))){_0x211196['limit']=qs[_0xbd2f('0x1a')](_0xce7c41[_0xbd2f('0x30')][_0xbd2f('0x1a')]);_0x211196[_0xbd2f('0x19')]=qs[_0xbd2f('0x19')](_0xce7c41[_0xbd2f('0x30')][_0xbd2f('0x19')]);}_0x211196['order']=qs[_0xbd2f('0x37')](_0xce7c41[_0xbd2f('0x30')][_0xbd2f('0x37')]);_0x211196[_0xbd2f('0x38')]=qs[_0xbd2f('0x39')](_[_0xbd2f('0x3a')](_0xce7c41['query'],_0x4409f1['filters']),_0x54c985);if(_0xce7c41[_0xbd2f('0x30')][_0xbd2f('0x3b')]){_0x211196[_0xbd2f('0x38')]=_['merge'](_0x211196['where'],{'$or':_['map'](_0x54c985,function(_0x2b525d){if(_0x2b525d[_0xbd2f('0x2d')]!=='VIRTUAL'){var _0x41d9f4={};_0x41d9f4[_0x2b525d['name']]={'$like':'%'+_0xce7c41[_0xbd2f('0x30')]['filter']+'%'};return _0x41d9f4;}})});}_0x211196=_[_0xbd2f('0x3c')]({},_0x211196,_0xce7c41[_0xbd2f('0x3d')]);var _0x2b2aaa={'where':_0x211196[_0xbd2f('0x38')]};return db[_0xbd2f('0x2c')]['count'](_0x2b2aaa)[_0xbd2f('0x22')](function(_0x19dc19){_0x45e771[_0xbd2f('0x1b')]=_0x19dc19;if(_0xce7c41[_0xbd2f('0x30')][_0xbd2f('0x3e')]){_0x211196[_0xbd2f('0x3f')]=[{'all':!![]}];}return db[_0xbd2f('0x2c')][_0xbd2f('0x40')](_0x211196);})[_0xbd2f('0x22')](function(_0x50abfa){_0x45e771['rows']=_0x50abfa;return _0x45e771;})[_0xbd2f('0x22')](respondWithFilteredResult(_0x4e3e89,_0x211196))[_0xbd2f('0x41')](handleError(_0x4e3e89,null));};exports['show']=function(_0x52d187,_0x15405e){var _0x41efe7={'raw':!![],'where':{'id':_0x52d187[_0xbd2f('0x42')]['id']}},_0x557dd0={};_0x557dd0[_0xbd2f('0x2f')]=_[_0xbd2f('0x31')](db['VoiceDialReport'][_0xbd2f('0x43')]);_0x557dd0['query']=_[_0xbd2f('0x31')](_0x52d187[_0xbd2f('0x30')]);_0x557dd0[_0xbd2f('0x39')]=_['intersection'](_0x557dd0['model'],_0x557dd0[_0xbd2f('0x30')]);_0x41efe7['attributes']=_['intersection'](_0x557dd0[_0xbd2f('0x2f')],qs[_0xbd2f('0x32')](_0x52d187[_0xbd2f('0x30')][_0xbd2f('0x32')]));_0x41efe7['attributes']=_0x41efe7[_0xbd2f('0x33')][_0xbd2f('0x34')]?_0x41efe7[_0xbd2f('0x33')]:_0x557dd0[_0xbd2f('0x2f')];if(_0x52d187[_0xbd2f('0x30')][_0xbd2f('0x3e')]){_0x41efe7[_0xbd2f('0x3f')]=[{'all':!![]}];}_0x41efe7=_[_0xbd2f('0x3c')]({},_0x41efe7,_0x52d187[_0xbd2f('0x3d')]);return db[_0xbd2f('0x2c')][_0xbd2f('0x44')](_0x41efe7)[_0xbd2f('0x22')](handleEntityNotFound(_0x15405e,null))[_0xbd2f('0x22')](respondWithResult(_0x15405e,null))['catch'](handleError(_0x15405e,null));};exports[_0xbd2f('0x45')]=function(_0x333f79,_0x48b1b6){return db[_0xbd2f('0x2c')][_0xbd2f('0x45')](_0x333f79[_0xbd2f('0x46')],{})[_0xbd2f('0x22')](respondWithResult(_0x48b1b6,0xc9))[_0xbd2f('0x41')](handleError(_0x48b1b6,null));};exports['update']=function(_0x233554,_0x27881d){if(_0x233554[_0xbd2f('0x46')]['id']){delete _0x233554['body']['id'];}return db['VoiceDialReport'][_0xbd2f('0x44')]({'where':{'id':_0x233554[_0xbd2f('0x42')]['id']}})[_0xbd2f('0x22')](handleEntityNotFound(_0x27881d,null))['then'](saveUpdates(_0x233554['body'],null))['then'](respondWithResult(_0x27881d,null))[_0xbd2f('0x41')](handleError(_0x27881d,null));};exports[_0xbd2f('0x23')]=function(_0x3c0a7f,_0x160318){return db[_0xbd2f('0x2c')][_0xbd2f('0x44')]({'where':{'id':_0x3c0a7f[_0xbd2f('0x42')]['id']}})['then'](handleEntityNotFound(_0x160318,null))['then'](removeEntity(_0x160318,null))[_0xbd2f('0x41')](handleError(_0x160318,null));};exports[_0xbd2f('0x47')]=function(_0x325175,_0x586398){return db[_0xbd2f('0x2c')][_0xbd2f('0x47')]()[_0xbd2f('0x22')](respondWithResult(_0x586398,null))['catch'](handleError(_0x586398,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7c0d9ad..49977f9 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 _0xb3be=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb3be,0x13c));var _0xeb3b=function(_0x3b4d88,_0x32cffa){_0x3b4d88=_0x3b4d88-0x0;var _0x4d39f9=_0xb3be[_0x3b4d88];return _0x4d39f9;};'use strict';var _=require(_0xeb3b('0x0'));var util=require(_0xeb3b('0x1'));var logger=require('../../config/logger')(_0xeb3b('0x2'));var moment=require(_0xeb3b('0x3'));var BPromise=require(_0xeb3b('0x4'));var rp=require(_0xeb3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb3b('0x6'));var config=require(_0xeb3b('0x7'));var attributes=require(_0xeb3b('0x8'));module[_0xeb3b('0x9')]=function(_0x20e1ef,_0x5a3b08){return _0x20e1ef[_0xeb3b('0xa')](_0xeb3b('0xb'),attributes,{'tableName':_0xeb3b('0xc'),'paranoid':![],'indexes':[{'fields':[_0xeb3b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf541=['rimraf','../../config/environment','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','bluebird'];(function(_0xdb357c,_0x3786b6){var _0x5c8735=function(_0x2e179c){while(--_0x2e179c){_0xdb357c['push'](_0xdb357c['shift']());}};_0x5c8735(++_0x3786b6);}(_0xf541,0x176));var _0x1f54=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0xf541[_0x35d8af];return _0x1d08b0;};'use strict';var _=require(_0x1f54('0x0'));var util=require(_0x1f54('0x1'));var logger=require(_0x1f54('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f54('0x4'));var config=require(_0x1f54('0x5'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x487fb6,_0x3a1b3e){return _0x487fb6[_0x1f54('0x6')](_0x1f54('0x7'),attributes,{'tableName':_0x1f54('0x8'),'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 0f4e7fe..0da77de 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 _0xd7cc=['../../config/logger','jayson/promise','client','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s','message','error','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','stringify','body','where','attributes','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0xd7cc,0x1a4));var _0xcd7c=function(_0x5f4d2e,_0x111e63){_0x5f4d2e=_0x5f4d2e-0x0;var _0x37bde8=_0xd7cc[_0x5f4d2e];return _0x37bde8;};'use strict';var _=require(_0xcd7c('0x0'));var util=require(_0xcd7c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd7c('0x2'));var fs=require('fs');var Redis=require(_0xcd7c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd7c('0x4'));var logger=require(_0xcd7c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcd7c('0x6'));var client=jayson[_0xcd7c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565768,_0x15667b,_0x43436e){return new BPromise(function(_0x5309ea,_0x3ff826){return client['request'](_0x565768,_0x43436e)[_0xcd7c('0x8')](function(_0x2cbca2){logger[_0xcd7c('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x15667b,_0xcd7c('0xa'));logger[_0xcd7c('0xb')](_0xcd7c('0xc'),_0x15667b,_0xcd7c('0xa'),JSON['stringify'](_0x2cbca2));if(_0x2cbca2['error']){if(_0x2cbca2['error']['code']===0x1f4){logger['error'](_0xcd7c('0xd'),_0x15667b,_0x2cbca2['error'][_0xcd7c('0xe')]);return _0x3ff826(_0x2cbca2[_0xcd7c('0xf')][_0xcd7c('0xe')]);}logger[_0xcd7c('0xf')](_0xcd7c('0xd'),_0x15667b,_0x2cbca2[_0xcd7c('0xf')][_0xcd7c('0xe')]);return _0x5309ea(_0x2cbca2[_0xcd7c('0xf')][_0xcd7c('0xe')]);}else{logger[_0xcd7c('0x9')](_0xcd7c('0xd'),_0x15667b,_0xcd7c('0xa'));_0x5309ea(_0x2cbca2['result'][_0xcd7c('0xe')]);}})[_0xcd7c('0x10')](function(_0x2a703c){logger[_0xcd7c('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x15667b,_0x2a703c);_0x3ff826(_0x2a703c);});});}exports[_0xcd7c('0x11')]=function(_0x40f867){var _0x21062f=this;return new Promise(function(_0x5c2061,_0x1c59ac){return db[_0xcd7c('0x12')]['create'](_0x40f867['body'],{'raw':_0x40f867[_0xcd7c('0x13')]?_0x40f867[_0xcd7c('0x13')][_0xcd7c('0x14')]===undefined?!![]:![]:!![]})[_0xcd7c('0x8')](function(_0x5388d6){logger[_0xcd7c('0x9')](_0xcd7c('0x11'),_0x40f867);logger['debug'](_0xcd7c('0x11'),_0x40f867,JSON[_0xcd7c('0x15')](_0x5388d6));_0x5c2061(_0x5388d6);})[_0xcd7c('0x10')](function(_0x467567){logger[_0xcd7c('0xf')](_0xcd7c('0x11'),_0x467567[_0xcd7c('0xe')],_0x40f867);_0x1c59ac(_0x21062f[_0xcd7c('0xf')](0x1f4,_0x467567[_0xcd7c('0xe')]));});});};exports['UpdateVoiceDialReport']=function(_0x3e4de3){var _0x324815=this;return new Promise(function(_0x33000c,_0x25a71a){return db[_0xcd7c('0x12')]['update'](_0x3e4de3[_0xcd7c('0x16')],{'raw':_0x3e4de3[_0xcd7c('0x13')]?_0x3e4de3[_0xcd7c('0x13')][_0xcd7c('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e4de3[_0xcd7c('0x13')]?_0x3e4de3[_0xcd7c('0x13')][_0xcd7c('0x17')]||null:null,'attributes':_0x3e4de3[_0xcd7c('0x13')]?_0x3e4de3[_0xcd7c('0x13')][_0xcd7c('0x18')]||null:null,'limit':_0x3e4de3['options']?_0x3e4de3[_0xcd7c('0x13')]['limit']||null:null})['then'](function(_0x1cec1b){logger['info']('UpdateVoiceDialReport',_0x3e4de3);logger[_0xcd7c('0xb')]('UpdateVoiceDialReport',_0x3e4de3,JSON[_0xcd7c('0x15')](_0x1cec1b));_0x33000c(_0x1cec1b);})[_0xcd7c('0x10')](function(_0x4b5d26){logger[_0xcd7c('0xf')]('UpdateVoiceDialReport',_0x4b5d26['message'],_0x3e4de3);_0x25a71a(_0x324815[_0xcd7c('0xf')](0x1f4,_0x4b5d26[_0xcd7c('0xe')]));});});}; \ No newline at end of file +var _0x4e8c=['message','result','VoiceDialReport','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x245e73,_0x1ceba5){var _0x51f71e=function(_0x38cbba){while(--_0x38cbba){_0x245e73['push'](_0x245e73['shift']());}};_0x51f71e(++_0x1ceba5);}(_0x4e8c,0xa7));var _0xc4e8=function(_0xeffc63,_0x4acafd){_0xeffc63=_0xeffc63-0x0;var _0x175db2=_0x4e8c[_0xeffc63];return _0x175db2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc4e8('0x0'));var BPromise=require(_0xc4e8('0x1'));var rs=require(_0xc4e8('0x2'));var fs=require('fs');var Redis=require(_0xc4e8('0x3'));var db=require(_0xc4e8('0x4'))['db'];var utils=require(_0xc4e8('0x5'));var logger=require('../../config/logger')(_0xc4e8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc4e8('0x7')][_0xc4e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x531912,_0x565085,_0x30a187){return new BPromise(function(_0x6faacf,_0x438269){return client[_0xc4e8('0x9')](_0x531912,_0x30a187)[_0xc4e8('0xa')](function(_0x3eb484){logger[_0xc4e8('0xb')](_0xc4e8('0xc'),_0x565085,'request\x20sent');logger[_0xc4e8('0xd')](_0xc4e8('0xe'),_0x565085,_0xc4e8('0xf'),JSON[_0xc4e8('0x10')](_0x3eb484));if(_0x3eb484[_0xc4e8('0x11')]){if(_0x3eb484['error'][_0xc4e8('0x12')]===0x1f4){logger[_0xc4e8('0x11')](_0xc4e8('0xc'),_0x565085,_0x3eb484[_0xc4e8('0x11')]['message']);return _0x438269(_0x3eb484['error'][_0xc4e8('0x13')]);}logger[_0xc4e8('0x11')](_0xc4e8('0xc'),_0x565085,_0x3eb484[_0xc4e8('0x11')][_0xc4e8('0x13')]);return _0x6faacf(_0x3eb484['error'][_0xc4e8('0x13')]);}else{logger[_0xc4e8('0xb')](_0xc4e8('0xc'),_0x565085,'request\x20sent');_0x6faacf(_0x3eb484[_0xc4e8('0x14')][_0xc4e8('0x13')]);}})['catch'](function(_0x3b50a9){logger[_0xc4e8('0x11')](_0xc4e8('0xc'),_0x565085,_0x3b50a9);_0x438269(_0x3b50a9);});});}exports['CreateVoiceDialReport']=function(_0x434c5e){var _0x18da90=this;return new Promise(function(_0x4586c2,_0x1f893c){return db[_0xc4e8('0x15')]['create'](_0x434c5e[_0xc4e8('0x16')],{'raw':_0x434c5e['options']?_0x434c5e[_0xc4e8('0x17')][_0xc4e8('0x18')]===undefined?!![]:![]:!![]})[_0xc4e8('0xa')](function(_0x519cf0){logger['info'](_0xc4e8('0x19'),_0x434c5e);logger[_0xc4e8('0xd')](_0xc4e8('0x19'),_0x434c5e,JSON[_0xc4e8('0x10')](_0x519cf0));_0x4586c2(_0x519cf0);})[_0xc4e8('0x1a')](function(_0x285287){logger[_0xc4e8('0x11')](_0xc4e8('0x19'),_0x285287[_0xc4e8('0x13')],_0x434c5e);_0x1f893c(_0x18da90[_0xc4e8('0x11')](0x1f4,_0x285287[_0xc4e8('0x13')]));});});};exports[_0xc4e8('0x1b')]=function(_0x4f0414){var _0x1adeb9=this;return new Promise(function(_0x5d9c0a,_0x285f0c){return db['VoiceDialReport']['update'](_0x4f0414[_0xc4e8('0x16')],{'raw':_0x4f0414[_0xc4e8('0x17')]?_0x4f0414['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0414[_0xc4e8('0x17')]?_0x4f0414[_0xc4e8('0x17')][_0xc4e8('0x1c')]||null:null,'attributes':_0x4f0414[_0xc4e8('0x17')]?_0x4f0414['options'][_0xc4e8('0x1d')]||null:null,'limit':_0x4f0414[_0xc4e8('0x17')]?_0x4f0414[_0xc4e8('0x17')][_0xc4e8('0x1e')]||null:null})[_0xc4e8('0xa')](function(_0x4cc151){logger[_0xc4e8('0xb')]('UpdateVoiceDialReport',_0x4f0414);logger[_0xc4e8('0xd')]('UpdateVoiceDialReport',_0x4f0414,JSON[_0xc4e8('0x10')](_0x4cc151));_0x5d9c0a(_0x4cc151);})[_0xc4e8('0x1a')](function(_0x15b7f6){logger[_0xc4e8('0x11')](_0xc4e8('0x1b'),_0x15b7f6[_0xc4e8('0x13')],_0x4f0414);_0x285f0c(_0x1adeb9[_0xc4e8('0x11')](0x1f4,_0x15b7f6[_0xc4e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d83b330..b4b42b1 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 _0x478c=['/:id','show','post','create','addApplications','update','destroy','exports','multer','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x3e697a,_0x3d19de){var _0x164710=function(_0x1d3e86){while(--_0x1d3e86){_0x3e697a['push'](_0x3e697a['shift']());}};_0x164710(++_0x3d19de);}(_0x478c,0x98));var _0xc478=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x478c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc478('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc478('0x1'));var auth=require(_0xc478('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xc478('0x3'));var controller=require(_0xc478('0x4'));router[_0xc478('0x5')]('/',auth[_0xc478('0x6')](),controller[_0xc478('0x7')]);router[_0xc478('0x5')](_0xc478('0x8'),auth[_0xc478('0x6')](),controller[_0xc478('0x9')]);router[_0xc478('0xa')]('/',auth['isAuthenticated'](),controller[_0xc478('0xb')]);router[_0xc478('0xa')]('/:id/applications',auth[_0xc478('0x6')](),controller[_0xc478('0xc')]);router['put'](_0xc478('0x8'),auth[_0xc478('0x6')](),controller[_0xc478('0xd')]);router['delete'](_0xc478('0x8'),auth[_0xc478('0x6')](),controller[_0xc478('0xe')]);module[_0xc478('0xf')]=router; \ No newline at end of file +var _0x2716=['../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','post','/:id/applications','addApplications','delete','destroy','exports','util','path','../../components/auth/service'];(function(_0x14c6ad,_0x516172){var _0x1e4858=function(_0x3988c8){while(--_0x3988c8){_0x14c6ad['push'](_0x14c6ad['shift']());}};_0x1e4858(++_0x516172);}(_0x2716,0x6d));var _0x6271=function(_0x52dace,_0x530aa7){_0x52dace=_0x52dace-0x0;var _0x4e43b6=_0x2716[_0x52dace];return _0x4e43b6;};'use strict';var multer=require('multer');var util=require(_0x6271('0x0'));var path=require(_0x6271('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6271('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6271('0x3'));var controller=require(_0x6271('0x4'));router[_0x6271('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6271('0x5')](_0x6271('0x6'),auth[_0x6271('0x7')](),controller['show']);router[_0x6271('0x8')]('/',auth[_0x6271('0x7')](),controller['create']);router[_0x6271('0x8')](_0x6271('0x9'),auth[_0x6271('0x7')](),controller[_0x6271('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6271('0xb')](_0x6271('0x6'),auth[_0x6271('0x7')](),controller[_0x6271('0xc')]);module[_0x6271('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 1b4e6c1..bc3ece3 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 _0xbfdb=['STRING','compositeIndex','NoOp','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','sequelize'];(function(_0x3c126c,_0x22f353){var _0x3b89e4=function(_0x1472c0){while(--_0x1472c0){_0x3c126c['push'](_0x3c126c['shift']());}};_0x3b89e4(++_0x22f353);}(_0xbfdb,0xed));var _0xbbfd=function(_0x28ffb5,_0x2deba8){_0x28ffb5=_0x28ffb5-0x0;var _0x15b509=_0xbfdb[_0x28ffb5];return _0x15b509;};'use strict';var Sequelize=require(_0xbbfd('0x0'));module['exports']={'context':{'type':Sequelize[_0xbbfd('0x1')],'allowNull':![],'unique':_0xbbfd('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbbfd('0x2')},'priority':{'type':Sequelize[_0xbbfd('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xbbfd('0x2')},'tag':{'type':Sequelize[_0xbbfd('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbbfd('0x1')],'allowNull':![],'defaultValue':_0xbbfd('0x3')},'appdata':{'type':Sequelize[_0xbbfd('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbbfd('0x4')](_0xbbfd('0x5'),'outbound',_0xbbfd('0x6'),_0xbbfd('0x7'),_0xbbfd('0x8'),_0xbbfd('0x9'),_0xbbfd('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xbbfd('0x1')]},'interval':{'type':Sequelize[_0xbbfd('0x1')],'allowNull':![],'defaultValue':_0xbbfd('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xbbfd('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbbfd('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbbfd('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbbfd('0xd')]},'recordingFormat':{'type':Sequelize[_0xbbfd('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xbbfd('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xbbfd('0xe')],'get':function(_0xb9a934){return this[_0xbbfd('0xf')](_0xbbfd('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x2fd1=['any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','internal','outbound-fax','system'];(function(_0x4a7d9b,_0xd28d37){var _0x238d70=function(_0x53a872){while(--_0x53a872){_0x4a7d9b['push'](_0x4a7d9b['shift']());}};_0x238d70(++_0xd28d37);}(_0x2fd1,0x106));var _0x12fd=function(_0x4bcbc2,_0x46cbff){_0x4bcbc2=_0x4bcbc2-0x0;var _0xe5b888=_0x2fd1[_0x4bcbc2];return _0xe5b888;};'use strict';var Sequelize=require(_0x12fd('0x0'));module[_0x12fd('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x12fd('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x12fd('0x2')},'priority':{'type':Sequelize[_0x12fd('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x12fd('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x12fd('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x12fd('0x4')](_0x12fd('0x5'),_0x12fd('0x6'),_0x12fd('0x7'),'inbound-fax',_0x12fd('0x8'),_0x12fd('0x9'),_0x12fd('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x12fd('0x3')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x12fd('0xb')]},'isApp':{'type':Sequelize[_0x12fd('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x12fd('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x12fd('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x12fd('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x12fd('0xd')},'answer':{'type':Sequelize[_0x12fd('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x12fd('0xe')],'get':function(_0x2536ac){return this[_0x12fd('0xf')](_0x12fd('0x10'));}},'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 5ff5b38..6400c29 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 _0x6335=['context','addApplications','sequelize','Transaction','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','Content-Range','json','then','InboundRoutes','inbound','ignore','map','value','type','name','UserProfileResource','error','stack','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceExtension','count','includeAll','include','findAll','catch','show','params','keys','fields','find','destroy','outbound','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','internal','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition'];(function(_0x414364,_0xd70cb){var _0x546b4e=function(_0xfb2af1){while(--_0xfb2af1){_0x414364['push'](_0x414364['shift']());}};_0x546b4e(++_0xd70cb);}(_0x6335,0x64));var _0x5633=function(_0x134328,_0x3a4bc5){_0x134328=_0x134328-0x0;var _0x569e6f=_0x6335[_0x134328];return _0x569e6f;};'use strict';var _=require(_0x5633('0x0'));var Redis=require(_0x5633('0x1'));var qs=require(_0x5633('0x2'));var logger=require(_0x5633('0x3'))('api');var config=require(_0x5633('0x4'));var db=require(_0x5633('0x5'))['db'];config[_0x5633('0x6')]=_[_0x5633('0x7')](config[_0x5633('0x6')],{'host':_0x5633('0x8'),'port':0x18eb});var socket=require(_0x5633('0x9'))(new Redis(config[_0x5633('0x6')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x2aee44,_0x198d81){_0x198d81=_0x198d81||0xcc;return function(_0x15ef03){if(_0x15ef03){return _0x2aee44[_0x5633('0xa')](_0x198d81);}return _0x2aee44[_0x5633('0xb')](_0x198d81)[_0x5633('0xc')]();};}function respondWithResult(_0x5359a9,_0x2e4663){_0x2e4663=_0x2e4663||0xc8;return function(_0x53f5cd){if(_0x53f5cd){return _0x5359a9[_0x5633('0xb')](_0x2e4663)['json'](_0x53f5cd);}};}function respondWithFilteredResult(_0x2aa93e,_0x564aa9){return function(_0x23df49){if(_0x23df49){var _0x3299b3=typeof _0x564aa9[_0x5633('0xd')]==='undefined'&&typeof _0x564aa9['limit']==='undefined';var _0x5ab7da=_0x23df49['count'];var _0x2576c9=_0x3299b3?0x0:_0x564aa9[_0x5633('0xd')];var _0x3be877=_0x3299b3?_0x23df49['count']:_0x564aa9['offset']+_0x564aa9['limit'];var _0x3147e1;if(_0x3be877>=_0x5ab7da){_0x3be877=_0x5ab7da;_0x3147e1=0xc8;}else{_0x3147e1=0xce;}_0x2aa93e[_0x5633('0xb')](_0x3147e1);return _0x2aa93e[_0x5633('0xe')](_0x5633('0xf'),_0x2576c9+'-'+_0x3be877+'/'+_0x5ab7da)[_0x5633('0x10')](_0x23df49);}return null;};}function removeEntity(_0x19b5cd){return function(_0x3c3c2d){if(_0x3c3c2d){return _0x3c3c2d['destroy']()[_0x5633('0x11')](function(){var _0x5d6cd2=_0x3c3c2d['get']({'plain':!![]});var _0x52573a=[{'name':_0x5633('0x12'),'value':_0x5633('0x13'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x3afae1=_(_0x52573a)['filter'](_0x5633('0x14'))[_0x5633('0x15')](_0x5633('0x16'))[_0x5633('0x16')]();if(_['includes'](_0x3afae1,_0x5d6cd2[_0x5633('0x17')])){return;}var _0x26118c=_['find'](_0x52573a,[_0x5633('0x16'),_0x5d6cd2[_0x5633('0x17')]])[_0x5633('0x18')];return db[_0x5633('0x19')]['destroy']({'where':{'type':_0x26118c,'resourceId':_0x5d6cd2['id']}})[_0x5633('0x11')](function(){return _0x3c3c2d;});})[_0x5633('0x11')](function(){_0x19b5cd['status'](0xcc)[_0x5633('0xc')]();});}};}function handleEntityNotFound(_0x41b635){return function(_0x4fd6e7){if(!_0x4fd6e7){_0x41b635[_0x5633('0xa')](0x194);}return _0x4fd6e7;};}function handleError(_0xc59f15,_0x728308){_0x728308=_0x728308||0x1f4;return function(_0x5bec37){logger[_0x5633('0x1a')](_0x5bec37[_0x5633('0x1b')]);if(_0x5bec37[_0x5633('0x18')]){delete _0x5bec37['name'];}_0xc59f15[_0x5633('0xb')](_0x728308)['send'](_0x5bec37);};}exports[_0x5633('0x1c')]=function(_0x3b3d3d,_0x2d3c16){var _0x456124={},_0x13a16b={},_0x42d680={'count':0x0,'rows':[]};var _0x1e02e1=_[_0x5633('0x15')](db['VoiceExtension'][_0x5633('0x1d')],function(_0x5efedb){return{'name':_0x5efedb[_0x5633('0x1e')],'type':_0x5efedb[_0x5633('0x17')][_0x5633('0x1f')]};});_0x13a16b[_0x5633('0x20')]=_[_0x5633('0x15')](_0x1e02e1,_0x5633('0x18'));_0x13a16b[_0x5633('0x21')]=_['keys'](_0x3b3d3d[_0x5633('0x21')]);_0x13a16b[_0x5633('0x22')]=_[_0x5633('0x23')](_0x13a16b[_0x5633('0x20')],_0x13a16b[_0x5633('0x21')]);_0x456124[_0x5633('0x24')]=_[_0x5633('0x23')](_0x13a16b[_0x5633('0x20')],qs['fields'](_0x3b3d3d['query']['fields']));_0x456124[_0x5633('0x24')]=_0x456124['attributes'][_0x5633('0x25')]?_0x456124[_0x5633('0x24')]:_0x13a16b[_0x5633('0x20')];if(!_0x3b3d3d['query']['hasOwnProperty'](_0x5633('0x26'))){_0x456124[_0x5633('0x27')]=qs[_0x5633('0x27')](_0x3b3d3d[_0x5633('0x21')][_0x5633('0x27')]);_0x456124[_0x5633('0xd')]=qs[_0x5633('0xd')](_0x3b3d3d['query'][_0x5633('0xd')]);}_0x456124[_0x5633('0x28')]=qs[_0x5633('0x29')](_0x3b3d3d['query'][_0x5633('0x29')]);_0x456124[_0x5633('0x2a')]=qs[_0x5633('0x22')](_[_0x5633('0x2b')](_0x3b3d3d[_0x5633('0x21')],_0x13a16b[_0x5633('0x22')]),_0x1e02e1);if(_0x3b3d3d['query'][_0x5633('0x2c')]){_0x456124[_0x5633('0x2a')]=_['merge'](_0x456124[_0x5633('0x2a')],{'$or':_[_0x5633('0x15')](_0x1e02e1,function(_0x3422f3){if(_0x3422f3[_0x5633('0x17')]!==_0x5633('0x2d')){var _0x54a42d={};_0x54a42d[_0x3422f3[_0x5633('0x18')]]={'$like':'%'+_0x3b3d3d[_0x5633('0x21')]['filter']+'%'};return _0x54a42d;}})});}_0x456124=_[_0x5633('0x2e')]({},_0x456124,_0x3b3d3d[_0x5633('0x2f')]);var _0x316ca1={'where':_0x456124['where']};return db[_0x5633('0x30')][_0x5633('0x31')](_0x316ca1)[_0x5633('0x11')](function(_0x1d8cb1){_0x42d680[_0x5633('0x31')]=_0x1d8cb1;if(_0x3b3d3d['query'][_0x5633('0x32')]){_0x456124[_0x5633('0x33')]=[{'all':!![]}];}return db['VoiceExtension'][_0x5633('0x34')](_0x456124);})[_0x5633('0x11')](function(_0x4589b8){_0x42d680['rows']=_0x4589b8;return _0x42d680;})[_0x5633('0x11')](respondWithFilteredResult(_0x2d3c16,_0x456124))[_0x5633('0x35')](handleError(_0x2d3c16,null));};exports[_0x5633('0x36')]=function(_0x57bc31,_0x4e0870){var _0x453453={'raw':![],'where':{'id':_0x57bc31[_0x5633('0x37')]['id']}},_0x33e382={};_0x33e382[_0x5633('0x20')]=_[_0x5633('0x38')](db[_0x5633('0x30')][_0x5633('0x1d')]);_0x33e382[_0x5633('0x21')]=_[_0x5633('0x38')](_0x57bc31[_0x5633('0x21')]);_0x33e382[_0x5633('0x22')]=_[_0x5633('0x23')](_0x33e382[_0x5633('0x20')],_0x33e382[_0x5633('0x21')]);_0x453453[_0x5633('0x24')]=_[_0x5633('0x23')](_0x33e382[_0x5633('0x20')],qs[_0x5633('0x39')](_0x57bc31[_0x5633('0x21')][_0x5633('0x39')]));_0x453453[_0x5633('0x24')]=_0x453453[_0x5633('0x24')][_0x5633('0x25')]?_0x453453['attributes']:_0x33e382[_0x5633('0x20')];if(_0x57bc31['query'][_0x5633('0x32')]){_0x453453[_0x5633('0x33')]=[{'all':!![]}];}_0x453453=_[_0x5633('0x2e')]({},_0x453453,_0x57bc31[_0x5633('0x2f')]);return db[_0x5633('0x30')][_0x5633('0x3a')](_0x453453)[_0x5633('0x11')](handleEntityNotFound(_0x4e0870,null))['then'](respondWithResult(_0x4e0870,null))['catch'](handleError(_0x4e0870,null));};exports[_0x5633('0x3b')]=function(_0x328aa2,_0x43a6ae){return db[_0x5633('0x30')]['find']({'where':{'id':_0x328aa2[_0x5633('0x37')]['id']}})[_0x5633('0x11')](handleEntityNotFound(_0x43a6ae,null))[_0x5633('0x11')](removeEntity(_0x43a6ae,null))['catch'](handleError(_0x43a6ae,null));};exports['create']=function(_0x12b03c,_0x34cd32){if(_0x12b03c['body'][_0x5633('0x17')]===_0x5633('0x3c')&&!_['startsWith'](_0x12b03c[_0x5633('0x3d')][_0x5633('0x3e')],'_')){_0x12b03c['body'][_0x5633('0x3e')]='_'[_0x5633('0x3f')](_0x12b03c['body'][_0x5633('0x3e')]);}return db['VoiceExtension']['create'](_0x12b03c[_0x5633('0x3d')],{'raw':![]})[_0x5633('0x11')](function(_0xd17327){var _0x590b1b=_0x12b03c[_0x5633('0x40')][_0x5633('0x41')]({'plain':!![]});if(!_0x590b1b)throw new Error(_0x5633('0x42'));if(_0x590b1b[_0x5633('0x43')]===_0x5633('0x40')){var _0x49fa72=_0xd17327[_0x5633('0x41')]({'plain':!![]});var _0x340643=[{'name':_0x5633('0x12'),'value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x5633('0x44'),'value':_0x5633('0x45')}];var _0x158357=_['find'](_0x340643,['value',_0x49fa72[_0x5633('0x17')]])[_0x5633('0x18')];return db[_0x5633('0x46')]['find']({'where':{'name':_0x158357,'userProfileId':_0x590b1b['userProfileId']},'raw':!![]})[_0x5633('0x11')](function(_0x721fce){if(_0x721fce&&_0x721fce['autoAssociation']===0x0){return db['UserProfileResource'][_0x5633('0x47')]({'name':_0x49fa72[_0x5633('0x18')],'resourceId':_0x49fa72['id'],'type':_0x721fce[_0x5633('0x18')],'sectionId':_0x721fce['id']},{})['then'](function(){return _0xd17327;});}else{return _0xd17327;}})['catch'](function(_0x1c6dc5){logger[_0x5633('0x1a')](_0x5633('0x48'),_0x1c6dc5);throw _0x1c6dc5;});}return _0xd17327;})['then'](respondWithResult(_0x34cd32,0xc9))[_0x5633('0x35')](handleError(_0x34cd32,null));};exports[_0x5633('0x49')]=function(_0x4ca71c,_0x318e9e){if(_0x4ca71c[_0x5633('0x3d')]['id']){delete _0x4ca71c[_0x5633('0x3d')]['id'];}return db[_0x5633('0x30')][_0x5633('0x3a')]({'where':{'id':_0x4ca71c[_0x5633('0x37')]['id']}})[_0x5633('0x11')](handleEntityNotFound(_0x318e9e,null))[_0x5633('0x11')](function(_0x268ae9){if(_0x268ae9){return db[_0x5633('0x30')][_0x5633('0x49')](_[_0x5633('0x2b')](_0x4ca71c[_0x5633('0x3d')],[_0x5633('0x3e'),'context',_0x5633('0x4a'),_0x5633('0x4b'),_0x5633('0x4c'),_0x5633('0x4d'),'alias']),{'where':{'context':_0x268ae9[_0x5633('0x4e')],'exten':_0x268ae9[_0x5633('0x3e')]},'individualHooks':!![]})['then'](function(_0xb1f6f6){return _0xb1f6f6;});}return null;})[_0x5633('0x11')](respondWithStatusCode(_0x318e9e,null))[_0x5633('0x35')](handleError(_0x318e9e,null));};exports[_0x5633('0x4f')]=function(_0x257c2d,_0x1ebedc){var _0x46bb29=_0x257c2d[_0x5633('0x37')]['id'];var _0x40906d=_0x257c2d[_0x5633('0x3d')];var _0x9f45c7=0xc8;var _0x2ca667=null;return db[_0x5633('0x50')]['transaction']({'isolationLevel':db[_0x5633('0x50')][_0x5633('0x51')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x565585){return db[_0x5633('0x30')]['findOne']({'where':{'id':_0x46bb29},'transaction':_0x565585})[_0x5633('0x11')](function(_0x362630){if(_0x362630){return db[_0x5633('0x30')]['destroy']({'where':{'VoiceExtensionId':_0x46bb29},'transaction':_0x565585})[_0x5633('0x11')](function(){var _0x4ab97b=_[_0x5633('0x15')](_0x40906d,function(_0x4d79d4){_0x4d79d4[_0x5633('0x52')]=_0x46bb29;_0x4d79d4[_0x5633('0x53')]=!![];return _0x4d79d4;});return _0x362630[_0x5633('0x54')](_0x4ab97b);})['then'](function(_0x4e399f){return db[_0x5633('0x30')][_0x5633('0x55')](_0x4e399f,{'transaction':_0x565585});});}else{_0x9f45c7=0x194;_0x2ca667=[];}});})[_0x5633('0x11')](function(){if(_0x9f45c7!==0x194){return db[_0x5633('0x30')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x46bb29},'order':_0x5633('0x56')})[_0x5633('0x11')](function(_0x42c0ea){_0x2ca667=_0x42c0ea;});}})[_0x5633('0x35')](function(_0x3a2f0c){_0x9f45c7=0x1f4;logger[_0x5633('0x1a')](_0x3a2f0c[_0x5633('0x1b')]);if(_0x3a2f0c[_0x5633('0x18')]){delete _0x3a2f0c[_0x5633('0x18')];}_0x2ca667=_0x3a2f0c;})[_0x5633('0x57')](function(){if(_0x2ca667===null){_0x1ebedc[_0x5633('0xa')](_0x9f45c7);}else{if(_0x9f45c7===0x1f4){_0x1ebedc['status'](_0x9f45c7)[_0x5633('0x58')](_0x2ca667);}else{_0x1ebedc[_0x5633('0xb')](_0x9f45c7)['json'](_0x2ca667);}}});}; \ No newline at end of file +var _0xddd1=['inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','type','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','finally','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','destroy','then','get','InboundRoutes'];(function(_0x178cbc,_0x5dd294){var _0x5da6cb=function(_0xd099cc){while(--_0xd099cc){_0x178cbc['push'](_0x178cbc['shift']());}};_0x5da6cb(++_0x5dd294);}(_0xddd1,0x147));var _0x1ddd=function(_0x1b1c33,_0x429996){_0x1b1c33=_0x1b1c33-0x0;var _0x25bb4f=_0xddd1[_0x1b1c33];return _0x25bb4f;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x1ddd('0x0'));var logger=require(_0x1ddd('0x1'))('api');var config=require('../../config/environment');var db=require(_0x1ddd('0x2'))['db'];config['redis']=_[_0x1ddd('0x3')](config[_0x1ddd('0x4')],{'host':_0x1ddd('0x5'),'port':0x18eb});var socket=require(_0x1ddd('0x6'))(new Redis(config[_0x1ddd('0x4')]));require(_0x1ddd('0x7'))[_0x1ddd('0x8')](socket);function respondWithStatusCode(_0x342adc,_0x1138ff){_0x1138ff=_0x1138ff||0xcc;return function(_0x641689){if(_0x641689){return _0x342adc[_0x1ddd('0x9')](_0x1138ff);}return _0x342adc[_0x1ddd('0xa')](_0x1138ff)['end']();};}function respondWithResult(_0x382903,_0x26c00f){_0x26c00f=_0x26c00f||0xc8;return function(_0x114601){if(_0x114601){return _0x382903[_0x1ddd('0xa')](_0x26c00f)[_0x1ddd('0xb')](_0x114601);}};}function respondWithFilteredResult(_0x5e9551,_0x28891e){return function(_0x2d5abf){if(_0x2d5abf){var _0x51829a=typeof _0x28891e[_0x1ddd('0xc')]===_0x1ddd('0xd')&&typeof _0x28891e['limit']===_0x1ddd('0xd');var _0xa3e268=_0x2d5abf[_0x1ddd('0xe')];var _0x4a98d9=_0x51829a?0x0:_0x28891e[_0x1ddd('0xc')];var _0x5559ee=_0x51829a?_0x2d5abf[_0x1ddd('0xe')]:_0x28891e[_0x1ddd('0xc')]+_0x28891e[_0x1ddd('0xf')];var _0x526200;if(_0x5559ee>=_0xa3e268){_0x5559ee=_0xa3e268;_0x526200=0xc8;}else{_0x526200=0xce;}_0x5e9551[_0x1ddd('0xa')](_0x526200);return _0x5e9551['set'](_0x1ddd('0x10'),_0x4a98d9+'-'+_0x5559ee+'/'+_0xa3e268)[_0x1ddd('0xb')](_0x2d5abf);}return null;};}function removeEntity(_0x204250){return function(_0x42dbb6){if(_0x42dbb6){return _0x42dbb6[_0x1ddd('0x11')]()[_0x1ddd('0x12')](function(){var _0x35338a=_0x42dbb6[_0x1ddd('0x13')]({'plain':!![]});var _0x99ce6e=[{'name':_0x1ddd('0x14'),'value':_0x1ddd('0x15'),'ignore':![]},{'name':_0x1ddd('0x16'),'value':_0x1ddd('0x17'),'ignore':![]},{'name':_0x1ddd('0x18'),'value':_0x1ddd('0x19'),'ignore':![]}];var _0x334005=_(_0x99ce6e)['filter'](_0x1ddd('0x1a'))[_0x1ddd('0x1b')](_0x1ddd('0x1c'))[_0x1ddd('0x1c')]();if(_['includes'](_0x334005,_0x35338a[_0x1ddd('0x1d')])){return;}var _0x47cdde=_[_0x1ddd('0x1e')](_0x99ce6e,[_0x1ddd('0x1c'),_0x35338a[_0x1ddd('0x1d')]])[_0x1ddd('0x1f')];return db[_0x1ddd('0x20')][_0x1ddd('0x11')]({'where':{'type':_0x47cdde,'resourceId':_0x35338a['id']}})[_0x1ddd('0x12')](function(){return _0x42dbb6;});})['then'](function(){_0x204250['status'](0xcc)[_0x1ddd('0x21')]();});}};}function handleEntityNotFound(_0x4d446c){return function(_0x15ab81){if(!_0x15ab81){_0x4d446c[_0x1ddd('0x9')](0x194);}return _0x15ab81;};}function handleError(_0x567858,_0x85d84a){_0x85d84a=_0x85d84a||0x1f4;return function(_0x586fc8){logger[_0x1ddd('0x22')](_0x586fc8[_0x1ddd('0x23')]);if(_0x586fc8[_0x1ddd('0x1f')]){delete _0x586fc8['name'];}_0x567858[_0x1ddd('0xa')](_0x85d84a)[_0x1ddd('0x24')](_0x586fc8);};}exports['index']=function(_0x1e0525,_0x2e82cf){var _0x59db46={},_0x4dbc3b={},_0x50ecd0={'count':0x0,'rows':[]};var _0x316fef=_[_0x1ddd('0x1b')](db[_0x1ddd('0x25')][_0x1ddd('0x26')],function(_0x135bda){return{'name':_0x135bda['fieldName'],'type':_0x135bda['type'][_0x1ddd('0x27')]};});_0x4dbc3b['model']=_['map'](_0x316fef,'name');_0x4dbc3b[_0x1ddd('0x28')]=_[_0x1ddd('0x29')](_0x1e0525[_0x1ddd('0x28')]);_0x4dbc3b[_0x1ddd('0x2a')]=_[_0x1ddd('0x2b')](_0x4dbc3b['model'],_0x4dbc3b[_0x1ddd('0x28')]);_0x59db46[_0x1ddd('0x2c')]=_['intersection'](_0x4dbc3b[_0x1ddd('0x2d')],qs[_0x1ddd('0x2e')](_0x1e0525[_0x1ddd('0x28')][_0x1ddd('0x2e')]));_0x59db46['attributes']=_0x59db46[_0x1ddd('0x2c')][_0x1ddd('0x2f')]?_0x59db46[_0x1ddd('0x2c')]:_0x4dbc3b[_0x1ddd('0x2d')];if(!_0x1e0525[_0x1ddd('0x28')][_0x1ddd('0x30')]('nolimit')){_0x59db46['limit']=qs[_0x1ddd('0xf')](_0x1e0525['query'][_0x1ddd('0xf')]);_0x59db46[_0x1ddd('0xc')]=qs[_0x1ddd('0xc')](_0x1e0525['query'][_0x1ddd('0xc')]);}_0x59db46[_0x1ddd('0x31')]=qs[_0x1ddd('0x32')](_0x1e0525[_0x1ddd('0x28')][_0x1ddd('0x32')]);_0x59db46['where']=qs[_0x1ddd('0x2a')](_['pick'](_0x1e0525['query'],_0x4dbc3b[_0x1ddd('0x2a')]),_0x316fef);if(_0x1e0525[_0x1ddd('0x28')][_0x1ddd('0x33')]){_0x59db46['where']=_[_0x1ddd('0x34')](_0x59db46[_0x1ddd('0x35')],{'$or':_[_0x1ddd('0x1b')](_0x316fef,function(_0x4061d1){if(_0x4061d1[_0x1ddd('0x1d')]!==_0x1ddd('0x36')){var _0x5f32e2={};_0x5f32e2[_0x4061d1[_0x1ddd('0x1f')]]={'$like':'%'+_0x1e0525[_0x1ddd('0x28')]['filter']+'%'};return _0x5f32e2;}})});}_0x59db46=_[_0x1ddd('0x34')]({},_0x59db46,_0x1e0525[_0x1ddd('0x37')]);var _0x4cf841={'where':_0x59db46[_0x1ddd('0x35')]};return db[_0x1ddd('0x25')][_0x1ddd('0xe')](_0x4cf841)[_0x1ddd('0x12')](function(_0x2957f1){_0x50ecd0['count']=_0x2957f1;if(_0x1e0525[_0x1ddd('0x28')][_0x1ddd('0x38')]){_0x59db46[_0x1ddd('0x39')]=[{'all':!![]}];}return db[_0x1ddd('0x25')][_0x1ddd('0x3a')](_0x59db46);})[_0x1ddd('0x12')](function(_0x3eda99){_0x50ecd0[_0x1ddd('0x3b')]=_0x3eda99;return _0x50ecd0;})[_0x1ddd('0x12')](respondWithFilteredResult(_0x2e82cf,_0x59db46))['catch'](handleError(_0x2e82cf,null));};exports['show']=function(_0x16bb33,_0x349354){var _0x33c949={'raw':![],'where':{'id':_0x16bb33[_0x1ddd('0x3c')]['id']}},_0x50a033={};_0x50a033['model']=_['keys'](db[_0x1ddd('0x25')][_0x1ddd('0x26')]);_0x50a033[_0x1ddd('0x28')]=_[_0x1ddd('0x29')](_0x16bb33[_0x1ddd('0x28')]);_0x50a033['filters']=_[_0x1ddd('0x2b')](_0x50a033[_0x1ddd('0x2d')],_0x50a033[_0x1ddd('0x28')]);_0x33c949[_0x1ddd('0x2c')]=_[_0x1ddd('0x2b')](_0x50a033[_0x1ddd('0x2d')],qs[_0x1ddd('0x2e')](_0x16bb33['query'][_0x1ddd('0x2e')]));_0x33c949[_0x1ddd('0x2c')]=_0x33c949[_0x1ddd('0x2c')][_0x1ddd('0x2f')]?_0x33c949['attributes']:_0x50a033['model'];if(_0x16bb33[_0x1ddd('0x28')][_0x1ddd('0x38')]){_0x33c949[_0x1ddd('0x39')]=[{'all':!![]}];}_0x33c949=_['merge']({},_0x33c949,_0x16bb33[_0x1ddd('0x37')]);return db[_0x1ddd('0x25')][_0x1ddd('0x1e')](_0x33c949)[_0x1ddd('0x12')](handleEntityNotFound(_0x349354,null))[_0x1ddd('0x12')](respondWithResult(_0x349354,null))[_0x1ddd('0x3d')](handleError(_0x349354,null));};exports[_0x1ddd('0x11')]=function(_0x20d8af,_0x2f9dc9){return db[_0x1ddd('0x25')][_0x1ddd('0x1e')]({'where':{'id':_0x20d8af[_0x1ddd('0x3c')]['id']}})[_0x1ddd('0x12')](handleEntityNotFound(_0x2f9dc9,null))['then'](removeEntity(_0x2f9dc9,null))[_0x1ddd('0x3d')](handleError(_0x2f9dc9,null));};exports[_0x1ddd('0x3e')]=function(_0x1060b9,_0x224af6){if(_0x1060b9[_0x1ddd('0x3f')][_0x1ddd('0x1d')]==='outbound'&&!_['startsWith'](_0x1060b9[_0x1ddd('0x3f')]['exten'],'_')){_0x1060b9['body']['exten']='_'[_0x1ddd('0x40')](_0x1060b9[_0x1ddd('0x3f')][_0x1ddd('0x41')]);}return db[_0x1ddd('0x25')]['create'](_0x1060b9[_0x1ddd('0x3f')],{'raw':![]})[_0x1ddd('0x12')](function(_0x84e2a6){var _0xc49d85=_0x1060b9[_0x1ddd('0x42')][_0x1ddd('0x13')]({'plain':!![]});if(!_0xc49d85)throw new Error(_0x1ddd('0x43'));if(_0xc49d85['role']===_0x1ddd('0x42')){var _0x5d1d01=_0x84e2a6[_0x1ddd('0x13')]({'plain':!![]});var _0x9dc0c6=[{'name':_0x1ddd('0x14'),'value':'inbound'},{'name':_0x1ddd('0x16'),'value':_0x1ddd('0x17')},{'name':_0x1ddd('0x18'),'value':_0x1ddd('0x19')}];var _0x49c792=_['find'](_0x9dc0c6,[_0x1ddd('0x1c'),_0x5d1d01[_0x1ddd('0x1d')]])[_0x1ddd('0x1f')];return db[_0x1ddd('0x44')]['find']({'where':{'name':_0x49c792,'userProfileId':_0xc49d85[_0x1ddd('0x45')]},'raw':!![]})[_0x1ddd('0x12')](function(_0x464351){if(_0x464351&&_0x464351['autoAssociation']===0x0){return db[_0x1ddd('0x20')][_0x1ddd('0x3e')]({'name':_0x5d1d01[_0x1ddd('0x1f')],'resourceId':_0x5d1d01['id'],'type':_0x464351[_0x1ddd('0x1f')],'sectionId':_0x464351['id']},{})[_0x1ddd('0x12')](function(){return _0x84e2a6;});}else{return _0x84e2a6;}})['catch'](function(_0x1bf833){logger[_0x1ddd('0x22')](_0x1ddd('0x46'),_0x1bf833);throw _0x1bf833;});}return _0x84e2a6;})[_0x1ddd('0x12')](respondWithResult(_0x224af6,0xc9))[_0x1ddd('0x3d')](handleError(_0x224af6,null));};exports[_0x1ddd('0x47')]=function(_0x38abca,_0x12bfa8){if(_0x38abca[_0x1ddd('0x3f')]['id']){delete _0x38abca[_0x1ddd('0x3f')]['id'];}return db[_0x1ddd('0x25')]['find']({'where':{'id':_0x38abca[_0x1ddd('0x3c')]['id']}})['then'](handleEntityNotFound(_0x12bfa8,null))[_0x1ddd('0x12')](function(_0x11494c){if(_0x11494c){return db[_0x1ddd('0x25')][_0x1ddd('0x47')](_[_0x1ddd('0x48')](_0x38abca[_0x1ddd('0x3f')],['exten',_0x1ddd('0x49'),'description','recordingFormat','cutdigits',_0x1ddd('0x4a'),_0x1ddd('0x4b')]),{'where':{'context':_0x11494c['context'],'exten':_0x11494c['exten']},'individualHooks':!![]})['then'](function(_0x487000){return _0x487000;});}return null;})['then'](respondWithStatusCode(_0x12bfa8,null))[_0x1ddd('0x3d')](handleError(_0x12bfa8,null));};exports[_0x1ddd('0x4c')]=function(_0x5c3d8,_0x2a6410){var _0x50ca2c=_0x5c3d8[_0x1ddd('0x3c')]['id'];var _0x37c3db=_0x5c3d8['body'];var _0x4da024=0xc8;var _0x2e29c2=null;return db['sequelize'][_0x1ddd('0x4d')]({'isolationLevel':db[_0x1ddd('0x4e')][_0x1ddd('0x4f')][_0x1ddd('0x50')]['READ_COMMITTED']},function(_0x304a17){return db[_0x1ddd('0x25')][_0x1ddd('0x51')]({'where':{'id':_0x50ca2c},'transaction':_0x304a17})[_0x1ddd('0x12')](function(_0x37ccc3){if(_0x37ccc3){return db[_0x1ddd('0x25')][_0x1ddd('0x11')]({'where':{'VoiceExtensionId':_0x50ca2c},'transaction':_0x304a17})[_0x1ddd('0x12')](function(){var _0x11e6c1=_[_0x1ddd('0x1b')](_0x37c3db,function(_0x190785){_0x190785[_0x1ddd('0x52')]=_0x50ca2c;_0x190785[_0x1ddd('0x53')]=!![];return _0x190785;});return _0x37ccc3[_0x1ddd('0x54')](_0x11e6c1);})[_0x1ddd('0x12')](function(_0x24c377){return db[_0x1ddd('0x25')][_0x1ddd('0x55')](_0x24c377,{'transaction':_0x304a17});});}else{_0x4da024=0x194;_0x2e29c2=[];}});})[_0x1ddd('0x12')](function(){if(_0x4da024!==0x194){return db[_0x1ddd('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x50ca2c},'order':'cast(priority\x20as\x20unsigned)'})[_0x1ddd('0x12')](function(_0x1afd07){_0x2e29c2=_0x1afd07;});}})['catch'](function(_0x496b14){_0x4da024=0x1f4;logger[_0x1ddd('0x22')](_0x496b14[_0x1ddd('0x23')]);if(_0x496b14[_0x1ddd('0x1f')]){delete _0x496b14[_0x1ddd('0x1f')];}_0x2e29c2=_0x496b14;})[_0x1ddd('0x56')](function(){if(_0x2e29c2===null){_0x2a6410[_0x1ddd('0x9')](_0x4da024);}else{if(_0x4da024===0x1f4){_0x2a6410[_0x1ddd('0xa')](_0x4da024)[_0x1ddd('0x24')](_0x2e29c2);}else{_0x2a6410[_0x1ddd('0xa')](_0x4da024)[_0x1ddd('0xb')](_0x2e29c2);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cefc496..5f52cd1 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 _0xd7ed=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x567c2d,_0x45454f){var _0x2b1c2b=function(_0x4a5e43){while(--_0x4a5e43){_0x567c2d['push'](_0x567c2d['shift']());}};_0x2b1c2b(++_0x45454f);}(_0xd7ed,0xb0));var _0xdd7e=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xd7ed[_0x1344d6];return _0xf45b24;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xdd7e('0x0'))['db'][_0xdd7e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdd7e('0x2')](0x0);var events={'afterCreate':_0xdd7e('0x3'),'afterUpdate':_0xdd7e('0x4'),'afterDestroy':_0xdd7e('0x5')};function emitEvent(_0x438010){return function(_0x5ac346,_0x1f597f,_0x3fab4c){VoiceExtensionEvents[_0xdd7e('0x6')](_0x438010+':'+_0x5ac346['id'],_0x5ac346);VoiceExtensionEvents[_0xdd7e('0x6')](_0x438010,_0x5ac346);_0x3fab4c(null);};}for(var e in events){if(events[_0xdd7e('0x7')](e)){var event=events[e];VoiceExtension[_0xdd7e('0x8')](e,emitEvent(event));}}module[_0xdd7e('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x42fe=['events','VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x112b41,_0x1b882e){var _0x10047a=function(_0x222267){while(--_0x222267){_0x112b41['push'](_0x112b41['shift']());}};_0x10047a(++_0x1b882e);}(_0x42fe,0x1c0));var _0xe42f=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0x42fe[_0x27b423];return _0x5c11b8;};'use strict';var EventEmitter=require(_0xe42f('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xe42f('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe42f('0x2')](0x0);var events={'afterCreate':_0xe42f('0x3'),'afterUpdate':_0xe42f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f889d){return function(_0x4120c3,_0x411339,_0x200760){VoiceExtensionEvents[_0xe42f('0x5')](_0x3f889d+':'+_0x4120c3['id'],_0x4120c3);VoiceExtensionEvents[_0xe42f('0x5')](_0x3f889d,_0x4120c3);_0x200760(null);};}for(var e in events){if(events[_0xe42f('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xe42f('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d2d8c56..f9b9c05 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 _0xb3c8=['CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','param','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xb3c8,0x197));var _0x8b3c=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb3c8[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x8b3c('0x0'));var attributes=require(_0x8b3c('0x1'));module[_0x8b3c('0x2')]=function(_0x39260b){var _0x290fe8=_0x39260b[_0x8b3c('0x3')];function _0x3cee45(_0x25af7a){var _0x3631c4=0x2;var _0x540b00=[{'type':_0x25af7a[_0x8b3c('0x4')],'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x6')+_0x25af7a[_0x8b3c('0x4')],'context':_0x25af7a[_0x8b3c('0x7')],'exten':_0x25af7a[_0x8b3c('0x8')],'priority':_0x3631c4++,'VoiceExtensionId':_0x25af7a['id']},{'type':_0x25af7a[_0x8b3c('0x4')],'app':_0x25af7a['alias']?_0x8b3c('0x5'):_0x8b3c('0x9'),'appdata':_0x25af7a[_0x8b3c('0xa')]?_0x8b3c('0xb')+_0x25af7a[_0x8b3c('0xa')]:'No\x20alias\x20set','context':_0x25af7a['context'],'exten':_0x25af7a[_0x8b3c('0x8')],'priority':_0x3631c4++,'VoiceExtensionId':_0x25af7a['id']}];if(_0x25af7a[_0x8b3c('0x4')]===_0x8b3c('0xc')){_0x540b00[_0x8b3c('0xd')]({'type':'inbound','app':_0x8b3c('0x5'),'appdata':'CDR(routeid)='+_0x25af7a['id'],'context':_0x25af7a[_0x8b3c('0x7')],'exten':_0x25af7a[_0x8b3c('0x8')],'priority':_0x3631c4++,'VoiceExtensionId':_0x25af7a['id']});}_0x540b00[_0x8b3c('0xd')]({'type':_0x25af7a[_0x8b3c('0x4')],'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0xe'),'context':_0x25af7a['context'],'exten':_0x25af7a[_0x8b3c('0x8')],'priority':_0x3631c4++,'VoiceExtensionId':_0x25af7a['id']},{'type':_0x25af7a[_0x8b3c('0x4')],'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0xf'),'context':_0x25af7a[_0x8b3c('0x7')],'exten':_0x25af7a[_0x8b3c('0x8')],'priority':_0x3631c4++,'VoiceExtensionId':_0x25af7a['id']},{'type':_0x25af7a[_0x8b3c('0x4')],'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x10'),'context':_0x25af7a[_0x8b3c('0x7')],'exten':_0x25af7a[_0x8b3c('0x8')],'priority':_0x3631c4++,'VoiceExtensionId':_0x25af7a['id']});return _0x540b00;}function _0x2c6f6f(_0x14acb8){var _0x13d496=0x2;var _0x5407c6=[{'type':_0x8b3c('0x11'),'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x12'),'context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8['exten'],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':_0x14acb8[_0x8b3c('0xa')]?'Set':_0x8b3c('0x9'),'appdata':_0x14acb8[_0x8b3c('0xa')]?_0x8b3c('0xb')+_0x14acb8[_0x8b3c('0xa')]:_0x8b3c('0x13'),'context':_0x14acb8['context'],'exten':_0x14acb8[_0x8b3c('0x8')],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x14')+(_0x14acb8[_0x8b3c('0x15')]?'${EXTEN:'+_0x14acb8[_0x8b3c('0x15')]+'}':_0x8b3c('0x16')),'context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8[_0x8b3c('0x8')],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x17')+_0x14acb8['id'],'context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8[_0x8b3c('0x8')],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':_0x8b3c('0x18'),'appdata':_0x8b3c('0x19')+(_0x13d496+0x2)+_0x8b3c('0x1a')+(_0x13d496+0x1)+')','context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8[_0x8b3c('0x8')],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':_0x8b3c('0x5'),'appdata':_0x14acb8[_0x8b3c('0x15')]?_0x8b3c('0x1b')+_0x14acb8[_0x8b3c('0x15')]+'}':_0x8b3c('0x1c'),'context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8[_0x8b3c('0x8')],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':'outbound','app':_0x8b3c('0x5'),'appdata':_0x8b3c('0xe'),'context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8['exten'],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':'Set','appdata':_0x8b3c('0xf'),'context':_0x14acb8['context'],'exten':_0x14acb8['exten'],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':_0x8b3c('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8['exten'],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':_0x8b3c('0x5'),'appdata':'outboundrouteid='+_0x14acb8['id'],'context':_0x14acb8['context'],'exten':_0x14acb8['exten'],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']}];if(_0x14acb8[_0x8b3c('0x1d')]('recordingFormat')&&_0x14acb8[_0x8b3c('0x1e')]!==_0x8b3c('0x1f')){_0x5407c6[_0x8b3c('0xd')]({'type':'outbound','app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x20'),'context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8[_0x8b3c('0x8')],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']},{'type':_0x8b3c('0x11'),'app':'Set','appdata':_0x8b3c('0x21')+_0x14acb8[_0x8b3c('0x1e')]||_0x8b3c('0x22'),'context':_0x14acb8[_0x8b3c('0x7')],'exten':_0x14acb8[_0x8b3c('0x8')],'priority':_0x13d496++,'VoiceExtensionId':_0x14acb8['id']});}return _0x5407c6;}function _0xce7dbb(_0x4377c4,_0xc999df){var _0x2674af=[{'name':_0x8b3c('0x23'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x8b3c('0x24'),'param':0x2},{'name':_0x8b3c('0x25'),'param':0x3}];var _0x35066e={};var _0x76c3da=_0xc999df['split'](',');var _0x5c8e2d=[];for(var _0x565cb2=0x0;_0x565cb2<_0x2674af[_0x8b3c('0x26')];_0x565cb2++){switch(_0x2674af[_0x565cb2]['name']){case _0x8b3c('0x23'):_0x35066e[_0x8b3c('0x23')]=_0x76c3da[_0x2674af[_0x565cb2][_0x8b3c('0x27')]]['split']('/')[0x1];_0x35066e[_0x8b3c('0x28')]=_0x76c3da[_0x2674af[_0x565cb2][_0x8b3c('0x27')]]['split']('/')[0x2];_0x35066e[_0x8b3c('0x29')]=_0x35066e[_0x8b3c('0x28')]?_0x35066e['phone']['split']('$')[0x0]:undefined;_0x35066e[_0x8b3c('0x28')]=_0x4377c4[_0x8b3c('0x15')]?(_0x35066e[_0x8b3c('0x29')]||'')+_0x8b3c('0x2a')+_0x4377c4['cutdigits']+'}':(_0x35066e['prefix']||'')+_0x8b3c('0x16');_0x5c8e2d[_0x2674af[_0x565cb2][_0x8b3c('0x27')]]=[_0x8b3c('0x2b'),_0x35066e['trunk'],_0x35066e[_0x8b3c('0x28')]][_0x8b3c('0x2c')]('/');break;case'options':_0x35066e['options']=_0x76c3da[_0x2674af[_0x565cb2][_0x8b3c('0x27')]];if(_0x4377c4[_0x8b3c('0x1e')]!==_0x8b3c('0x1f')){if(_0x35066e[_0x8b3c('0x24')][_0x8b3c('0x2d')](_0x8b3c('0x2e'))<0x0){_0x35066e['options']+=_0x8b3c('0x2e');}}else{_0x35066e[_0x8b3c('0x24')]=_0x35066e[_0x8b3c('0x24')][_0x8b3c('0x2f')](_0x8b3c('0x2e'),'');}_0x5c8e2d[_0x2674af[_0x565cb2][_0x8b3c('0x27')]]=_0x35066e[_0x8b3c('0x24')];break;default:_0x5c8e2d[_0x2674af[_0x565cb2][_0x8b3c('0x27')]]=_0x76c3da[_0x2674af[_0x565cb2][_0x8b3c('0x27')]];}}return _0x5c8e2d[_0x8b3c('0x2c')](',');}function _0x2f8f4c(_0x9a4315,_0x5c812a,_0x4bd794){return new Promise(function(_0x1659ab,_0x32c6b6){var _0x1bb9e0=[];if(_[_0x8b3c('0x30')](_0x5c812a))return _0x1659ab(_0x1bb9e0);_0x290fe8[_0x8b3c('0x31')]['findAll']({'attributes':['id',_0x8b3c('0x32'),_0x8b3c('0x33')],'raw':!![]})[_0x8b3c('0x34')](function(_0x5d1bc4){for(var _0x33c897=0x0,_0xa19d39=0x0;_0x33c897<_0x5c812a[_0x8b3c('0x26')];_0x33c897++,_0xa19d39=0x0){var _0x23b32f=_0x5c812a[_0x33c897];var _0x278e84=[];var _0x531e46=[];delete _0x23b32f['id'];if(_0x23b32f[_0x8b3c('0x32')]!==_0x8b3c('0x35')){_0x23b32f[_0x8b3c('0x36')]=[_0x23b32f[_0x8b3c('0x32')]];}else{_0x23b32f['intervals']=_0x23b32f[_0x8b3c('0x33')]?_[_0x8b3c('0x37')](_[_0x8b3c('0x38')](_0x5d1bc4,{'IntervalId':_0x23b32f[_0x8b3c('0x33')]}),_0x8b3c('0x32')):[];}_0x23b32f[_0x8b3c('0x7')]=_0x9a4315['context'];_0x23b32f[_0x8b3c('0x8')]=_0x9a4315[_0x8b3c('0x8')];if(_0x23b32f[_0x8b3c('0x4')])_0x23b32f[_0x8b3c('0x4')]=_0x23b32f[_0x8b3c('0x4')][_0x8b3c('0x39')]();if(_0x9a4315['type']===_0x8b3c('0x11')){if(_0x23b32f[_0x8b3c('0x1d')]('tag')&&_0x23b32f[_0x8b3c('0x3a')]&&_0x23b32f[_0x8b3c('0x3a')]!=='--'){_0x278e84[_0x8b3c('0xd')]({'type':_0x23b32f[_0x8b3c('0x4')][_0x8b3c('0x39')](),'app':_0x8b3c('0x5'),'appdata':'CDR(tag)='+_0x23b32f[_0x8b3c('0x3a')],'context':_0x9a4315[_0x8b3c('0x7')],'exten':_0x9a4315[_0x8b3c('0x8')],'priority':_0x23b32f[_0x8b3c('0x36')]['length']+_0x4bd794+_0xa19d39++,'VoiceExtensionId':_0x9a4315['id']});}_0x278e84[_0x8b3c('0xd')]({'type':_0x23b32f[_0x8b3c('0x4')]['toLowerCase'](),'app':_0x8b3c('0x18'),'appdata':_0x8b3c('0x3b')+(_0x23b32f[_0x8b3c('0x3c')]?_0x8b3c('0x3d')+_0x23b32f[_0x8b3c('0x3c')]+')':_0x8b3c('0x3e')),'context':_0x9a4315[_0x8b3c('0x7')],'exten':_0x9a4315[_0x8b3c('0x8')],'priority':_0x23b32f[_0x8b3c('0x36')][_0x8b3c('0x26')]+_0x4bd794+_0xa19d39++,'VoiceExtensionId':_0x9a4315['id']});}else{if(_0x23b32f['hasOwnProperty'](_0x8b3c('0x3f'))){if([_0x8b3c('0x40'),_0x8b3c('0x41')]['includes'](_0x23b32f['app'][_0x8b3c('0x39')]())&&_0x23b32f['appType']!==_0x8b3c('0x42')){if(_0x23b32f['answer']){_0x278e84[_0x8b3c('0xd')]({'type':_0x23b32f['type'][_0x8b3c('0x39')](),'app':_0x8b3c('0x18'),'appdata':_0x8b3c('0x43'),'context':_0x9a4315[_0x8b3c('0x7')],'exten':_0x9a4315[_0x8b3c('0x8')],'priority':_0x23b32f[_0x8b3c('0x36')][_0x8b3c('0x26')]+_0x4bd794+_0xa19d39++,'VoiceExtensionId':_0x9a4315['id']});_0x278e84[_0x8b3c('0xd')]({'type':_0x23b32f[_0x8b3c('0x4')][_0x8b3c('0x39')](),'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x44'),'context':_0x9a4315[_0x8b3c('0x7')],'exten':_0x9a4315[_0x8b3c('0x8')],'priority':_0x23b32f[_0x8b3c('0x36')][_0x8b3c('0x26')]+_0x4bd794+_0xa19d39++,'VoiceExtensionId':_0x9a4315['id']});}else{_0x278e84[_0x8b3c('0xd')]({'type':_0x23b32f[_0x8b3c('0x4')]['toLowerCase'](),'app':_0x8b3c('0x18'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x9a4315[_0x8b3c('0x7')],'exten':_0x9a4315[_0x8b3c('0x8')],'priority':_0x23b32f[_0x8b3c('0x36')][_0x8b3c('0x26')]+_0x4bd794+_0xa19d39++,'VoiceExtensionId':_0x9a4315['id']});_0x278e84[_0x8b3c('0xd')]({'type':_0x23b32f[_0x8b3c('0x4')][_0x8b3c('0x39')](),'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x45'),'context':_0x9a4315[_0x8b3c('0x7')],'exten':_0x9a4315[_0x8b3c('0x8')],'priority':_0x23b32f[_0x8b3c('0x36')]['length']+_0x4bd794+_0xa19d39++,'VoiceExtensionId':_0x9a4315['id']});}}}}for(var _0xee68cd=0x0;_0xee68cd<_0x23b32f['intervals'][_0x8b3c('0x26')];_0xee68cd++){var _0xc57ca9=_0x4bd794+_0x23b32f[_0x8b3c('0x36')]['length'];var _0x4d3d5b=_0xee68cd===_0x23b32f[_0x8b3c('0x36')][_0x8b3c('0x26')]-0x1?_0x4bd794+_0x278e84['length']+_0x531e46[_0x8b3c('0x26')]+0x2:_0x4bd794+_0xee68cd+0x1;_0x278e84[_0x8b3c('0x46')](_0xee68cd,0x0,{'type':_0x9a4315[_0x8b3c('0x4')],'app':_0x8b3c('0x47'),'appdata':_0x23b32f[_0x8b3c('0x36')][_0xee68cd]+'?'+_0x9a4315[_0x8b3c('0x7')]+_0x8b3c('0x48')+_0xc57ca9+':'+_0x9a4315[_0x8b3c('0x7')]+_0x8b3c('0x48')+_0x4d3d5b,'exten':_0x9a4315[_0x8b3c('0x8')],'context':_0x9a4315[_0x8b3c('0x7')],'priority':_0x4bd794+_0xee68cd,'VoiceExtensionId':_0x9a4315['id']});}if(_0x23b32f[_0x8b3c('0x49')]===_0x8b3c('0x4a')){_0x23b32f['appdata']=_0xce7dbb(_0x9a4315,_0x23b32f[_0x8b3c('0x4b')]);}if(_0x23b32f[_0x8b3c('0x49')]===_0x8b3c('0x4c')){_0x278e84[_0x8b3c('0xd')]({'type':_0x23b32f[_0x8b3c('0x4')]['toLowerCase'](),'app':_0x8b3c('0x5'),'appdata':_0x8b3c('0x4d'),'context':_0x9a4315[_0x8b3c('0x7')],'exten':_0x9a4315[_0x8b3c('0x8')],'priority':_0x23b32f[_0x8b3c('0x36')]['length']+_0x4bd794+_0xa19d39++,'VoiceExtensionId':_0x9a4315['id']});}_0x23b32f[_0x8b3c('0x4e')]=_0x278e84['length']?_[_0x8b3c('0x4f')](_0x278e84)[_0x8b3c('0x4e')]+0x1:_0x4bd794;_0x1bb9e0=_[_0x8b3c('0x50')](_0x1bb9e0,_0x278e84,[_0x23b32f],_0x531e46);_0x4bd794=_[_0x8b3c('0x4f')](_0x1bb9e0)['priority']+0x1;}return _0x1659ab(_0x1bb9e0);})[_0x8b3c('0x51')](function(_0x2bf120){_0x32c6b6(_0x2bf120);});});}return _0x39260b[_0x8b3c('0x52')](_0x8b3c('0x53'),attributes,{'tableName':_0x8b3c('0x54'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x37d74d){var _0xd96e01=this[_0x8b3c('0x55')]({'plain':!![]});var _0x300147=_0xd96e01[_0x8b3c('0x4')]===_0x8b3c('0x11')?_0x2c6f6f(_0xd96e01):_0x3cee45(_0xd96e01);return _0x2f8f4c(_0xd96e01,_0x37d74d,_[_0x8b3c('0x4f')](_0x300147)['priority']+0x1)['then'](function(_0x1b547c){var _0x3143cf=_[_0x8b3c('0x50')](_0x300147,_0x1b547c);_0x3143cf[_0x8b3c('0xd')]({'type':_0xd96e01['type'],'app':_0x8b3c('0x56'),'exten':_0xd96e01[_0x8b3c('0x8')],'context':_0xd96e01[_0x8b3c('0x7')],'priority':_[_0x8b3c('0x4f')](_0x3143cf)[_0x8b3c('0x4e')]+0x1,'VoiceExtensionId':_0xd96e01['id']});return _0x3143cf;});}}});}; \ No newline at end of file +var _0x3141=['answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','exports','models','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','url','split','length','name','param','phone','prefix','${EXTEN:','SIP','options','U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x3141,0x6d));var _0x1314=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3141[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1314('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x1314('0x1')]=function(_0x5296bf){var _0x81c992=_0x5296bf[_0x1314('0x2')];function _0x20087a(_0xf8130b){var _0x1d67cd=0x2;var _0x50d8bc=[{'type':_0xf8130b[_0x1314('0x3')],'app':'Set','appdata':'CDR(type)='+_0xf8130b[_0x1314('0x3')],'context':_0xf8130b[_0x1314('0x4')],'exten':_0xf8130b[_0x1314('0x5')],'priority':_0x1d67cd++,'VoiceExtensionId':_0xf8130b['id']},{'type':_0xf8130b[_0x1314('0x3')],'app':_0xf8130b[_0x1314('0x6')]?'Set':_0x1314('0x7'),'appdata':_0xf8130b[_0x1314('0x6')]?_0x1314('0x8')+_0xf8130b[_0x1314('0x6')]:_0x1314('0x9'),'context':_0xf8130b[_0x1314('0x4')],'exten':_0xf8130b['exten'],'priority':_0x1d67cd++,'VoiceExtensionId':_0xf8130b['id']}];if(_0xf8130b[_0x1314('0x3')]===_0x1314('0xa')){_0x50d8bc[_0x1314('0xb')]({'type':_0x1314('0xa'),'app':_0x1314('0xc'),'appdata':_0x1314('0xd')+_0xf8130b['id'],'context':_0xf8130b[_0x1314('0x4')],'exten':_0xf8130b['exten'],'priority':_0x1d67cd++,'VoiceExtensionId':_0xf8130b['id']});}_0x50d8bc[_0x1314('0xb')]({'type':_0xf8130b[_0x1314('0x3')],'app':_0x1314('0xc'),'appdata':_0x1314('0xe'),'context':_0xf8130b[_0x1314('0x4')],'exten':_0xf8130b[_0x1314('0x5')],'priority':_0x1d67cd++,'VoiceExtensionId':_0xf8130b['id']},{'type':_0xf8130b[_0x1314('0x3')],'app':_0x1314('0xc'),'appdata':_0x1314('0xf'),'context':_0xf8130b['context'],'exten':_0xf8130b[_0x1314('0x5')],'priority':_0x1d67cd++,'VoiceExtensionId':_0xf8130b['id']},{'type':_0xf8130b[_0x1314('0x3')],'app':'Set','appdata':_0x1314('0x10'),'context':_0xf8130b[_0x1314('0x4')],'exten':_0xf8130b[_0x1314('0x5')],'priority':_0x1d67cd++,'VoiceExtensionId':_0xf8130b['id']});return _0x50d8bc;}function _0x4595ff(_0x3fb085){var _0x4aa911=0x2;var _0xb9038e=[{'type':_0x1314('0x11'),'app':_0x1314('0xc'),'appdata':_0x1314('0x12'),'context':_0x3fb085['context'],'exten':_0x3fb085['exten'],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':_0x3fb085[_0x1314('0x6')]?_0x1314('0xc'):'NoOp','appdata':_0x3fb085[_0x1314('0x6')]?_0x1314('0x8')+_0x3fb085[_0x1314('0x6')]:_0x1314('0x9'),'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':_0x1314('0xc'),'appdata':_0x1314('0x13')+(_0x3fb085[_0x1314('0x14')]?'${EXTEN:'+_0x3fb085[_0x1314('0x14')]+'}':_0x1314('0x15')),'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':'outbound','app':'Set','appdata':_0x1314('0xd')+_0x3fb085['id'],'context':_0x3fb085['context'],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4aa911+0x2)+_0x1314('0x16')+(_0x4aa911+0x1)+')','context':_0x3fb085['context'],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':'outbound','app':'Set','appdata':_0x3fb085['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x3fb085[_0x1314('0x14')]+'}':_0x1314('0x17'),'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':_0x1314('0xc'),'appdata':_0x1314('0xe'),'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085['exten'],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':_0x1314('0xc'),'appdata':_0x1314('0xf'),'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':'Set','appdata':_0x1314('0x10'),'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':_0x1314('0xc'),'appdata':_0x1314('0x18')+_0x3fb085['id'],'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']}];if(_0x3fb085[_0x1314('0x19')](_0x1314('0x1a'))&&_0x3fb085[_0x1314('0x1a')]!==_0x1314('0x1b')){_0xb9038e['push']({'type':_0x1314('0x11'),'app':'Set','appdata':_0x1314('0x1c'),'context':_0x3fb085['context'],'exten':_0x3fb085[_0x1314('0x5')],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']},{'type':_0x1314('0x11'),'app':_0x1314('0xc'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3fb085[_0x1314('0x1a')]||_0x1314('0x1d'),'context':_0x3fb085[_0x1314('0x4')],'exten':_0x3fb085['exten'],'priority':_0x4aa911++,'VoiceExtensionId':_0x3fb085['id']});}return _0xb9038e;}function _0x108647(_0xe9f8f0,_0x236741){var _0x574cad=[{'name':_0x1314('0x1e'),'param':0x0},{'name':_0x1314('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x1314('0x20'),'param':0x3}];var _0x16b6c4={};var _0xba772=_0x236741[_0x1314('0x21')](',');var _0x5d3a16=[];for(var _0x18d7e1=0x0;_0x18d7e1<_0x574cad[_0x1314('0x22')];_0x18d7e1++){switch(_0x574cad[_0x18d7e1][_0x1314('0x23')]){case _0x1314('0x1e'):_0x16b6c4[_0x1314('0x1e')]=_0xba772[_0x574cad[_0x18d7e1][_0x1314('0x24')]][_0x1314('0x21')]('/')[0x1];_0x16b6c4[_0x1314('0x25')]=_0xba772[_0x574cad[_0x18d7e1][_0x1314('0x24')]][_0x1314('0x21')]('/')[0x2];_0x16b6c4['prefix']=_0x16b6c4[_0x1314('0x25')]?_0x16b6c4[_0x1314('0x25')][_0x1314('0x21')]('$')[0x0]:undefined;_0x16b6c4[_0x1314('0x25')]=_0xe9f8f0[_0x1314('0x14')]?(_0x16b6c4[_0x1314('0x26')]||'')+_0x1314('0x27')+_0xe9f8f0[_0x1314('0x14')]+'}':(_0x16b6c4[_0x1314('0x26')]||'')+_0x1314('0x15');_0x5d3a16[_0x574cad[_0x18d7e1]['param']]=[_0x1314('0x28'),_0x16b6c4[_0x1314('0x1e')],_0x16b6c4['phone']]['join']('/');break;case _0x1314('0x29'):_0x16b6c4[_0x1314('0x29')]=_0xba772[_0x574cad[_0x18d7e1]['param']];if(_0xe9f8f0[_0x1314('0x1a')]!==_0x1314('0x1b')){if(_0x16b6c4[_0x1314('0x29')]['indexOf'](_0x1314('0x2a'))<0x0){_0x16b6c4['options']+=_0x1314('0x2a');}}else{_0x16b6c4['options']=_0x16b6c4[_0x1314('0x29')][_0x1314('0x2b')](_0x1314('0x2a'),'');}_0x5d3a16[_0x574cad[_0x18d7e1][_0x1314('0x24')]]=_0x16b6c4['options'];break;default:_0x5d3a16[_0x574cad[_0x18d7e1][_0x1314('0x24')]]=_0xba772[_0x574cad[_0x18d7e1][_0x1314('0x24')]];}}return _0x5d3a16[_0x1314('0x2c')](',');}function _0xa9f444(_0x5510b4,_0x6c45c4,_0x5cd4d2){return new Promise(function(_0x110fa2,_0x22f51a){var _0x3e99e0=[];if(_[_0x1314('0x2d')](_0x6c45c4))return _0x110fa2(_0x3e99e0);_0x81c992['Interval'][_0x1314('0x2e')]({'attributes':['id','interval',_0x1314('0x2f')],'raw':!![]})[_0x1314('0x30')](function(_0x5da14b){for(var _0x2b29de=0x0,_0x255e66=0x0;_0x2b29de<_0x6c45c4[_0x1314('0x22')];_0x2b29de++,_0x255e66=0x0){var _0x3ee1c8=_0x6c45c4[_0x2b29de];var _0x37c9d0=[];var _0x4433a2=[];delete _0x3ee1c8['id'];if(_0x3ee1c8[_0x1314('0x31')]!==_0x1314('0x32')){_0x3ee1c8[_0x1314('0x33')]=[_0x3ee1c8['interval']];}else{_0x3ee1c8[_0x1314('0x33')]=_0x3ee1c8['IntervalId']?_[_0x1314('0x34')](_[_0x1314('0x35')](_0x5da14b,{'IntervalId':_0x3ee1c8[_0x1314('0x2f')]}),'interval'):[];}_0x3ee1c8[_0x1314('0x4')]=_0x5510b4[_0x1314('0x4')];_0x3ee1c8[_0x1314('0x5')]=_0x5510b4['exten'];if(_0x3ee1c8['type'])_0x3ee1c8[_0x1314('0x3')]=_0x3ee1c8['type']['toLowerCase']();if(_0x5510b4[_0x1314('0x3')]===_0x1314('0x11')){if(_0x3ee1c8[_0x1314('0x19')](_0x1314('0x36'))&&_0x3ee1c8[_0x1314('0x36')]&&_0x3ee1c8[_0x1314('0x36')]!=='--'){_0x37c9d0[_0x1314('0xb')]({'type':_0x3ee1c8[_0x1314('0x3')][_0x1314('0x37')](),'app':'Set','appdata':_0x1314('0x38')+_0x3ee1c8[_0x1314('0x36')],'context':_0x5510b4[_0x1314('0x4')],'exten':_0x5510b4['exten'],'priority':_0x3ee1c8[_0x1314('0x33')][_0x1314('0x22')]+_0x5cd4d2+_0x255e66++,'VoiceExtensionId':_0x5510b4['id']});}_0x37c9d0[_0x1314('0xb')]({'type':_0x3ee1c8[_0x1314('0x3')][_0x1314('0x37')](),'app':_0x1314('0x39'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3ee1c8[_0x1314('0x3a')]?_0x1314('0x3b')+_0x3ee1c8[_0x1314('0x3a')]+')':_0x1314('0x3c')),'context':_0x5510b4[_0x1314('0x4')],'exten':_0x5510b4[_0x1314('0x5')],'priority':_0x3ee1c8['intervals']['length']+_0x5cd4d2+_0x255e66++,'VoiceExtensionId':_0x5510b4['id']});}else{if(_0x3ee1c8['hasOwnProperty'](_0x1314('0x3d'))){if([_0x1314('0x3e'),_0x1314('0x3f')][_0x1314('0x40')](_0x3ee1c8[_0x1314('0x41')][_0x1314('0x37')]())&&_0x3ee1c8[_0x1314('0x42')]!==_0x1314('0x43')){if(_0x3ee1c8[_0x1314('0x3d')]){_0x37c9d0[_0x1314('0xb')]({'type':_0x3ee1c8['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x1314('0x44'),'context':_0x5510b4[_0x1314('0x4')],'exten':_0x5510b4[_0x1314('0x5')],'priority':_0x3ee1c8[_0x1314('0x33')]['length']+_0x5cd4d2+_0x255e66++,'VoiceExtensionId':_0x5510b4['id']});_0x37c9d0[_0x1314('0xb')]({'type':_0x3ee1c8[_0x1314('0x3')][_0x1314('0x37')](),'app':_0x1314('0xc'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5510b4[_0x1314('0x4')],'exten':_0x5510b4[_0x1314('0x5')],'priority':_0x3ee1c8['intervals'][_0x1314('0x22')]+_0x5cd4d2+_0x255e66++,'VoiceExtensionId':_0x5510b4['id']});}else{_0x37c9d0[_0x1314('0xb')]({'type':_0x3ee1c8[_0x1314('0x3')][_0x1314('0x37')](),'app':'ExecIf','appdata':_0x1314('0x45'),'context':_0x5510b4['context'],'exten':_0x5510b4['exten'],'priority':_0x3ee1c8[_0x1314('0x33')][_0x1314('0x22')]+_0x5cd4d2+_0x255e66++,'VoiceExtensionId':_0x5510b4['id']});_0x37c9d0[_0x1314('0xb')]({'type':_0x3ee1c8[_0x1314('0x3')][_0x1314('0x37')](),'app':_0x1314('0xc'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5510b4['context'],'exten':_0x5510b4[_0x1314('0x5')],'priority':_0x3ee1c8[_0x1314('0x33')][_0x1314('0x22')]+_0x5cd4d2+_0x255e66++,'VoiceExtensionId':_0x5510b4['id']});}}}}for(var _0x4469ea=0x0;_0x4469ea<_0x3ee1c8[_0x1314('0x33')][_0x1314('0x22')];_0x4469ea++){var _0x4622ed=_0x5cd4d2+_0x3ee1c8['intervals']['length'];var _0x39b63e=_0x4469ea===_0x3ee1c8[_0x1314('0x33')][_0x1314('0x22')]-0x1?_0x5cd4d2+_0x37c9d0[_0x1314('0x22')]+_0x4433a2[_0x1314('0x22')]+0x2:_0x5cd4d2+_0x4469ea+0x1;_0x37c9d0[_0x1314('0x46')](_0x4469ea,0x0,{'type':_0x5510b4[_0x1314('0x3')],'app':_0x1314('0x47'),'appdata':_0x3ee1c8[_0x1314('0x33')][_0x4469ea]+'?'+_0x5510b4['context']+_0x1314('0x48')+_0x4622ed+':'+_0x5510b4['context']+_0x1314('0x48')+_0x39b63e,'exten':_0x5510b4['exten'],'context':_0x5510b4[_0x1314('0x4')],'priority':_0x5cd4d2+_0x4469ea,'VoiceExtensionId':_0x5510b4['id']});}if(_0x3ee1c8[_0x1314('0x42')]===_0x1314('0x49')){_0x3ee1c8[_0x1314('0x4a')]=_0x108647(_0x5510b4,_0x3ee1c8[_0x1314('0x4a')]);}if(_0x3ee1c8[_0x1314('0x42')]===_0x1314('0x4b')){_0x37c9d0['push']({'type':_0x3ee1c8[_0x1314('0x3')][_0x1314('0x37')](),'app':_0x1314('0xc'),'appdata':_0x1314('0x4c'),'context':_0x5510b4[_0x1314('0x4')],'exten':_0x5510b4[_0x1314('0x5')],'priority':_0x3ee1c8[_0x1314('0x33')]['length']+_0x5cd4d2+_0x255e66++,'VoiceExtensionId':_0x5510b4['id']});}_0x3ee1c8[_0x1314('0x4d')]=_0x37c9d0['length']?_[_0x1314('0x4e')](_0x37c9d0)[_0x1314('0x4d')]+0x1:_0x5cd4d2;_0x3e99e0=_[_0x1314('0x4f')](_0x3e99e0,_0x37c9d0,[_0x3ee1c8],_0x4433a2);_0x5cd4d2=_[_0x1314('0x4e')](_0x3e99e0)[_0x1314('0x4d')]+0x1;}return _0x110fa2(_0x3e99e0);})[_0x1314('0x50')](function(_0x44d6ef){_0x22f51a(_0x44d6ef);});});}return _0x5296bf[_0x1314('0x51')](_0x1314('0x52'),attributes,{'tableName':_0x1314('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5c564f){var _0x498ee5=this['get']({'plain':!![]});var _0x524c76=_0x498ee5[_0x1314('0x3')]===_0x1314('0x11')?_0x4595ff(_0x498ee5):_0x20087a(_0x498ee5);return _0xa9f444(_0x498ee5,_0x5c564f,_[_0x1314('0x4e')](_0x524c76)[_0x1314('0x4d')]+0x1)[_0x1314('0x30')](function(_0x389b5c){var _0x629825=_[_0x1314('0x4f')](_0x524c76,_0x389b5c);_0x629825[_0x1314('0xb')]({'type':_0x498ee5[_0x1314('0x3')],'app':_0x1314('0x54'),'exten':_0x498ee5[_0x1314('0x5')],'context':_0x498ee5[_0x1314('0x4')],'priority':_['last'](_0x629825)[_0x1314('0x4d')]+0x1,'VoiceExtensionId':_0x498ee5['id']});return _0x629825;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 570a3fe..2c3093d 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 _0xbd0a=['request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','GetVoiceExtension','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket'];(function(_0x2f88c2,_0x1e1086){var _0x381475=function(_0xbfe3d3){while(--_0xbfe3d3){_0x2f88c2['push'](_0x2f88c2['shift']());}};_0x381475(++_0x1e1086);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x4f3c4f,_0x453492){_0x4f3c4f=_0x4f3c4f-0x0;var _0x58c273=_0xbd0a[_0x4f3c4f];return _0x58c273;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var moment=require(_0xabd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabd0('0x2'))['db'];var utils=require(_0xabd0('0x3'));var logger=require(_0xabd0('0x4'))(_0xabd0('0x5'));var config=require(_0xabd0('0x6'));var jayson=require(_0xabd0('0x7'));var client=jayson[_0xabd0('0x8')][_0xabd0('0x9')]({'port':0x232a});config[_0xabd0('0xa')]=_['defaults'](config[_0xabd0('0xa')],{'host':_0xabd0('0xb'),'port':0x18eb});var socket=require(_0xabd0('0xc'))(new Redis(config['redis']));require(_0xabd0('0xd'))['register'](socket);function respondWithRpcPromise(_0x151048,_0x23d4e4,_0x2c31c9){return new BPromise(function(_0x3dc0ab,_0x50fc2d){return client[_0xabd0('0xe')](_0x151048,_0x2c31c9)['then'](function(_0x1b78e2){logger[_0xabd0('0xf')](_0xabd0('0x10'),_0x23d4e4,_0xabd0('0x11'));logger[_0xabd0('0x12')](_0xabd0('0x13'),_0x23d4e4,'request\x20sent',JSON[_0xabd0('0x14')](_0x1b78e2));if(_0x1b78e2['error']){if(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x23d4e4,_0x1b78e2['error']['message']);return _0x50fc2d(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);return _0x3dc0ab(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}else{logger[_0xabd0('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x23d4e4,_0xabd0('0x11'));_0x3dc0ab(_0x1b78e2['result']['message']);}})[_0xabd0('0x18')](function(_0x391988){logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x391988);_0x50fc2d(_0x391988);});});}exports['GetVoiceExtension']=function(_0x862492){var _0x1f2ecb=this;return new Promise(function(_0x4eed20,_0x56c2f5){return db[_0xabd0('0x19')][_0xabd0('0x1a')]({'raw':_0x862492['options']?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1c')]===undefined?!![]:![]:!![],'where':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')]['where']||null:null,'attributes':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1d')]||null:null,'limit':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1e')]||null:null,'include':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1f')]?_[_0xabd0('0x20')](_0x862492['options'][_0xabd0('0x1f')],function(_0x2699c4){return{'model':db[_0x2699c4[_0xabd0('0x21')]],'as':_0x2699c4['as'],'attributes':_0x2699c4[_0xabd0('0x1d')],'include':_0x2699c4[_0xabd0('0x1f')]?_[_0xabd0('0x20')](_0x2699c4[_0xabd0('0x1f')],function(_0x3a10d6){return{'model':db[_0x3a10d6[_0xabd0('0x21')]],'as':_0x3a10d6['as'],'attributes':_0x3a10d6[_0xabd0('0x1d')],'include':_0x3a10d6[_0xabd0('0x1f')]?_[_0xabd0('0x20')](_0x3a10d6[_0xabd0('0x1f')],function(_0x3246de){return{'model':db[_0x3246de[_0xabd0('0x21')]],'as':_0x3246de['as'],'attributes':_0x3246de[_0xabd0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c0d90){logger[_0xabd0('0xf')](_0xabd0('0x22'),_0x862492);logger[_0xabd0('0x12')]('GetVoiceExtension',_0x862492,JSON[_0xabd0('0x14')](_0x1c0d90));_0x4eed20(_0x1c0d90);})[_0xabd0('0x18')](function(_0x20ff0a){logger['error'](_0xabd0('0x22'),_0x20ff0a[_0xabd0('0x17')],_0x862492);_0x56c2f5(_0x1f2ecb['error'](0x1f4,_0x20ff0a[_0xabd0('0x17')]));});});}; \ No newline at end of file +var _0xbd0a=['request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','GetVoiceExtension','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket'];(function(_0x1debb7,_0x4fce1d){var _0xf2bd90=function(_0x2a01ac){while(--_0x2a01ac){_0x1debb7['push'](_0x1debb7['shift']());}};_0xf2bd90(++_0x4fce1d);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x137035,_0x32ae77){_0x137035=_0x137035-0x0;var _0x117561=_0xbd0a[_0x137035];return _0x117561;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var moment=require(_0xabd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabd0('0x2'))['db'];var utils=require(_0xabd0('0x3'));var logger=require(_0xabd0('0x4'))(_0xabd0('0x5'));var config=require(_0xabd0('0x6'));var jayson=require(_0xabd0('0x7'));var client=jayson[_0xabd0('0x8')][_0xabd0('0x9')]({'port':0x232a});config[_0xabd0('0xa')]=_['defaults'](config[_0xabd0('0xa')],{'host':_0xabd0('0xb'),'port':0x18eb});var socket=require(_0xabd0('0xc'))(new Redis(config['redis']));require(_0xabd0('0xd'))['register'](socket);function respondWithRpcPromise(_0x151048,_0x23d4e4,_0x2c31c9){return new BPromise(function(_0x3dc0ab,_0x50fc2d){return client[_0xabd0('0xe')](_0x151048,_0x2c31c9)['then'](function(_0x1b78e2){logger[_0xabd0('0xf')](_0xabd0('0x10'),_0x23d4e4,_0xabd0('0x11'));logger[_0xabd0('0x12')](_0xabd0('0x13'),_0x23d4e4,'request\x20sent',JSON[_0xabd0('0x14')](_0x1b78e2));if(_0x1b78e2['error']){if(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x23d4e4,_0x1b78e2['error']['message']);return _0x50fc2d(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);return _0x3dc0ab(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}else{logger[_0xabd0('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x23d4e4,_0xabd0('0x11'));_0x3dc0ab(_0x1b78e2['result']['message']);}})[_0xabd0('0x18')](function(_0x391988){logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x391988);_0x50fc2d(_0x391988);});});}exports['GetVoiceExtension']=function(_0x862492){var _0x1f2ecb=this;return new Promise(function(_0x4eed20,_0x56c2f5){return db[_0xabd0('0x19')][_0xabd0('0x1a')]({'raw':_0x862492['options']?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1c')]===undefined?!![]:![]:!![],'where':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')]['where']||null:null,'attributes':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1d')]||null:null,'limit':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1e')]||null:null,'include':_0x862492[_0xabd0('0x1b')]?_0x862492[_0xabd0('0x1b')][_0xabd0('0x1f')]?_[_0xabd0('0x20')](_0x862492['options'][_0xabd0('0x1f')],function(_0x2699c4){return{'model':db[_0x2699c4[_0xabd0('0x21')]],'as':_0x2699c4['as'],'attributes':_0x2699c4[_0xabd0('0x1d')],'include':_0x2699c4[_0xabd0('0x1f')]?_[_0xabd0('0x20')](_0x2699c4[_0xabd0('0x1f')],function(_0x3a10d6){return{'model':db[_0x3a10d6[_0xabd0('0x21')]],'as':_0x3a10d6['as'],'attributes':_0x3a10d6[_0xabd0('0x1d')],'include':_0x3a10d6[_0xabd0('0x1f')]?_[_0xabd0('0x20')](_0x3a10d6[_0xabd0('0x1f')],function(_0x3246de){return{'model':db[_0x3246de[_0xabd0('0x21')]],'as':_0x3246de['as'],'attributes':_0x3246de[_0xabd0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c0d90){logger[_0xabd0('0xf')](_0xabd0('0x22'),_0x862492);logger[_0xabd0('0x12')]('GetVoiceExtension',_0x862492,JSON[_0xabd0('0x14')](_0x1c0d90));_0x4eed20(_0x1c0d90);})[_0xabd0('0x18')](function(_0x20ff0a){logger['error'](_0xabd0('0x22'),_0x20ff0a[_0xabd0('0x17')],_0x862492);_0x56c2f5(_0x1f2ecb['error'](0x1f4,_0x20ff0a[_0xabd0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 839f83d..a4bb83f 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x4abf8b,_0x46f226){var _0x504664=function(_0x4b936b){while(--_0x4b936b){_0x4abf8b['push'](_0x4abf8b['shift']());}};_0x504664(++_0x46f226);}(_0x0295,0x1f0));var _0x5029=function(_0x118733,_0x2bd820){_0x118733=_0x118733-0x0;var _0x4777af=_0x0295[_0x118733];return _0x4777af;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x128d77,_0x32b2a4){var _0x37feb2=function(_0x5f5c6f){while(--_0x5f5c6f){_0x128d77['push'](_0x128d77['shift']());}};_0x37feb2(++_0x32b2a4);}(_0x4975,0x86));var _0x5497=function(_0x2f6baf,_0x164593){_0x2f6baf=_0x2f6baf-0x0;var _0xf4a8d9=_0x4975[_0x2f6baf];return _0xf4a8d9;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c6cfdff..6dd1a50 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 _0xe3da=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy'];(function(_0x4dc3c5,_0x1416ff){var _0x5b3d59=function(_0x424566){while(--_0x424566){_0x4dc3c5['push'](_0x4dc3c5['shift']());}};_0x5b3d59(++_0x1416ff);}(_0xe3da,0x1cd));var _0xae3d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe3da[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router['delete'](_0xae3d('0xe'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);module[_0xae3d('0x16')]=router; \ No newline at end of file +var _0x3e24=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','create','destroy','exports','multer'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x3e24,0x167));var _0x43e2=function(_0x240df3,_0x515368){_0x240df3=_0x240df3-0x0;var _0x4a2815=_0x3e24[_0x240df3];return _0x4a2815;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var fs_extra=require(_0x43e2('0x5'));var auth=require(_0x43e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x7'));var controller=require(_0x43e2('0x8'));router[_0x43e2('0x9')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xb')]);router[_0x43e2('0x9')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x9')]('/:id/messages',auth[_0x43e2('0xa')](),controller[_0x43e2('0xe')]);router['post']('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xf')]);router['put'](_0x43e2('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x43e2('0xc'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x10')]);module[_0x43e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e73bc40..763b627 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 _0x4d35=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox'];(function(_0x2fdaba,_0x1744c4){var _0x205c28=function(_0x27008a){while(--_0x27008a){_0x2fdaba['push'](_0x2fdaba['shift']());}};_0x205c28(++_0x1744c4);}(_0x4d35,0x187));var _0x54d3=function(_0xc45c71,_0x5015c7){_0xc45c71=_0xc45c71-0x0;var _0x511962=_0x4d35[_0xc45c71];return _0x511962;};'use strict';var Sequelize=require(_0x54d3('0x0'));module[_0x54d3('0x1')]={'customer_id':{'type':Sequelize[_0x54d3('0x2')]},'context':{'type':Sequelize[_0x54d3('0x2')],'defaultValue':_0x54d3('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x54d3('0x2')],'defaultValue':'','allowNull':![],'unique':_0x54d3('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x54d3('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2cc4cf){this[_0x54d3('0x5')]('email',typeof _0x2cc4cf===_0x54d3('0x6')&&_0x2cc4cf[_0x54d3('0x7')]()?_0x2cc4cf['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x54d3('0x8')},'attach':{'type':Sequelize[_0x54d3('0x9')]('yes','no'),'defaultValue':_0x54d3('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':_0x54d3('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x54d3('0x2')]},'callback':{'type':Sequelize[_0x54d3('0x2')]},'review':{'type':Sequelize['ENUM'](_0x54d3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x54d3('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x54d3('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x54d3('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':_0x54d3('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x54d3('0x9')](_0x54d3('0xa'),'no'),'defaultValue':_0x54d3('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x54d3('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x54d3('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x54d3('0xd')],'get':function(){return this[_0x54d3('0xe')]('fullname')+_0x54d3('0xf')+this[_0x54d3('0xe')](_0x54d3('0x10'));}}}; \ No newline at end of file +var _0x3505=['INTEGER','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x54d635,_0x5a7888){var _0x59cf7a=function(_0x5b166d){while(--_0x5b166d){_0x54d635['push'](_0x54d635['shift']());}};_0x59cf7a(++_0x5a7888);}(_0x3505,0x112));var _0x5350=function(_0x56dbdb,_0x39509c){_0x56dbdb=_0x56dbdb-0x0;var _0x41f3b2=_0x3505[_0x56dbdb];return _0x41f3b2;};'use strict';var Sequelize=require(_0x5350('0x0'));module[_0x5350('0x1')]={'customer_id':{'type':Sequelize[_0x5350('0x2')]},'context':{'type':Sequelize[_0x5350('0x2')],'defaultValue':_0x5350('0x3'),'unique':_0x5350('0x4')},'mailbox':{'type':Sequelize[_0x5350('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x5350('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5350('0x2')],'validate':{'isEmail':!![]},'set':function(_0x27619c){this[_0x5350('0x5')](_0x5350('0x6'),typeof _0x27619c===_0x5350('0x7')&&_0x27619c[_0x5350('0x8')]()?_0x27619c[_0x5350('0x8')]():null);}},'pager':{'type':Sequelize[_0x5350('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x5350('0x9')},'attach':{'type':Sequelize[_0x5350('0xa')]('yes','no'),'defaultValue':_0x5350('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5350('0xa')](_0x5350('0xb'),'no'),'defaultValue':_0x5350('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x5350('0x2')]},'review':{'type':Sequelize[_0x5350('0xa')](_0x5350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5350('0xa')](_0x5350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5350('0xa')](_0x5350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5350('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x5350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5350('0xa')]('yes','no'),'defaultValue':_0x5350('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x5350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5350('0xa')](_0x5350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x5350('0xb'),'allowNull':![]},'stamp':{'type':_0x5350('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x5350('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5350('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x5350('0xf')](_0x5350('0x10'))+_0x5350('0x11')+this[_0x5350('0xf')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 314062a..48f38e8 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 _0x5eb8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','VoiceMail','findAll','rows','catch','show','params','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','VoiceMailMessage','pick','filter','mailbox'];(function(_0x5104f5,_0x2908bd){var _0x2bb4f9=function(_0x431014){while(--_0x431014){_0x5104f5['push'](_0x5104f5['shift']());}};_0x2bb4f9(++_0x2908bd);}(_0x5eb8,0xb0));var _0x85eb=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x5eb8[_0x529abc];return _0x453afa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){var _0x312b3e=_0x1426c8[_0x85eb('0x27')]({'plain':!![]});var _0x5dfc96=_0x85eb('0x28');return db[_0x85eb('0x29')][_0x85eb('0x25')]({'where':{'type':_0x5dfc96,'resourceId':_0x312b3e['id']}})[_0x85eb('0x26')](function(){return _0x1426c8;});})[_0x85eb('0x26')](function(){_0x5b48d9['status'](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x792d3a,_0x291557){return function(_0x3e7eb9){if(!_0x3e7eb9){_0x792d3a[_0x85eb('0x2a')](0x194);}return _0x3e7eb9;};}function handleError(_0x29d262,_0x50541a){_0x50541a=_0x50541a||0x1f4;return function(_0x562792){logger[_0x85eb('0x2b')](_0x562792['stack']);if(_0x562792[_0x85eb('0x2c')]){delete _0x562792['name'];}_0x29d262[_0x85eb('0x1a')](_0x50541a)[_0x85eb('0x2d')](_0x562792);};}exports[_0x85eb('0x2e')]=function(_0x1d9278,_0xa67e1c){var _0xf4ac13={},_0x41ed76={},_0x5decd5={'count':0x0,'rows':[]};var _0x237f19=_[_0x85eb('0x2f')](db['VoiceMail'][_0x85eb('0x30')],function(_0x5af2de){return{'name':_0x5af2de['fieldName'],'type':_0x5af2de[_0x85eb('0x31')][_0x85eb('0x32')]};});_0x41ed76[_0x85eb('0x33')]=_[_0x85eb('0x2f')](_0x237f19,_0x85eb('0x2c'));_0x41ed76[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x1d9278[_0x85eb('0x34')]);_0x41ed76[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x41ed76['model'],_0x41ed76[_0x85eb('0x34')]);_0xf4ac13[_0x85eb('0x38')]=_['intersection'](_0x41ed76['model'],qs[_0x85eb('0x39')](_0x1d9278[_0x85eb('0x34')][_0x85eb('0x39')]));_0xf4ac13[_0x85eb('0x38')]=_0xf4ac13[_0x85eb('0x38')][_0x85eb('0x3a')]?_0xf4ac13[_0x85eb('0x38')]:_0x41ed76[_0x85eb('0x33')];if(!_0x1d9278[_0x85eb('0x34')][_0x85eb('0x3b')](_0x85eb('0x3c'))){_0xf4ac13[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x1d9278[_0x85eb('0x34')]['limit']);_0xf4ac13[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x1d9278['query']['offset']);}_0xf4ac13[_0x85eb('0x3d')]=qs[_0x85eb('0x3e')](_0x1d9278['query'][_0x85eb('0x3e')]);_0xf4ac13['where']=qs[_0x85eb('0x36')](_['pick'](_0x1d9278[_0x85eb('0x34')],_0x41ed76['filters']),_0x237f19);if(_0x1d9278[_0x85eb('0x34')]['filter']){_0xf4ac13[_0x85eb('0x3f')]=_[_0x85eb('0x40')](_0xf4ac13['where'],{'$or':_[_0x85eb('0x2f')](_0x237f19,function(_0x5a1c15){if(_0x5a1c15[_0x85eb('0x31')]!==_0x85eb('0x41')){var _0x5c0156={};_0x5c0156[_0x5a1c15[_0x85eb('0x2c')]]={'$like':'%'+_0x1d9278['query']['filter']+'%'};return _0x5c0156;}})});}_0xf4ac13=_[_0x85eb('0x40')]({},_0xf4ac13,_0x1d9278['options']);var _0x17cc20={'where':_0xf4ac13[_0x85eb('0x3f')]};return db['VoiceMail']['count'](_0x17cc20)[_0x85eb('0x26')](function(_0x422ec3){_0x5decd5['count']=_0x422ec3;if(_0x1d9278['query'][_0x85eb('0x42')]){_0xf4ac13[_0x85eb('0x43')]=[{'all':!![]}];}return db[_0x85eb('0x44')][_0x85eb('0x45')](_0xf4ac13);})[_0x85eb('0x26')](function(_0x5b7411){_0x5decd5[_0x85eb('0x46')]=_0x5b7411;return _0x5decd5;})[_0x85eb('0x26')](respondWithFilteredResult(_0xa67e1c,_0xf4ac13))[_0x85eb('0x47')](handleError(_0xa67e1c,null));};exports[_0x85eb('0x48')]=function(_0x2ed39d,_0xbc43a7){var _0x40e2a2={'raw':!![],'where':{'id':_0x2ed39d[_0x85eb('0x49')]['id']}},_0x3e11a8={};_0x3e11a8['model']=_[_0x85eb('0x35')](db[_0x85eb('0x44')]['rawAttributes']);_0x3e11a8[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x2ed39d[_0x85eb('0x34')]);_0x3e11a8[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x3e11a8[_0x85eb('0x33')],_0x3e11a8['query']);_0x40e2a2[_0x85eb('0x38')]=_[_0x85eb('0x37')](_0x3e11a8[_0x85eb('0x33')],qs[_0x85eb('0x39')](_0x2ed39d[_0x85eb('0x34')][_0x85eb('0x39')]));_0x40e2a2[_0x85eb('0x38')]=_0x40e2a2[_0x85eb('0x38')]['length']?_0x40e2a2[_0x85eb('0x38')]:_0x3e11a8[_0x85eb('0x33')];if(_0x2ed39d[_0x85eb('0x34')][_0x85eb('0x42')]){_0x40e2a2[_0x85eb('0x43')]=[{'all':!![]}];}_0x40e2a2=_[_0x85eb('0x40')]({},_0x40e2a2,_0x2ed39d[_0x85eb('0x4a')]);return db[_0x85eb('0x44')][_0x85eb('0x4b')](_0x40e2a2)[_0x85eb('0x26')](handleEntityNotFound(_0xbc43a7,null))[_0x85eb('0x26')](respondWithResult(_0xbc43a7,null))[_0x85eb('0x47')](handleError(_0xbc43a7,null));};exports['create']=function(_0x11da79,_0x2c951b){return db[_0x85eb('0x44')]['create'](_0x11da79[_0x85eb('0x4c')],{})[_0x85eb('0x26')](function(_0x2cf928){var _0xd2f302=_0x11da79[_0x85eb('0x4d')]['get']({'plain':!![]});if(!_0xd2f302)throw new Error(_0x85eb('0x4e'));if(_0xd2f302[_0x85eb('0x4f')]===_0x85eb('0x4d')){var _0x50e264=_0x2cf928[_0x85eb('0x27')]({'plain':!![]});var _0x4550fd=_0x85eb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x4550fd,'userProfileId':_0xd2f302[_0x85eb('0x50')]},'raw':!![]})['then'](function(_0x5ed98a){if(_0x5ed98a&&_0x5ed98a[_0x85eb('0x51')]===0x0){return db['UserProfileResource'][_0x85eb('0x52')]({'name':_0x50e264[_0x85eb('0x2c')],'resourceId':_0x50e264['id'],'type':_0x5ed98a['name'],'sectionId':_0x5ed98a['id']},{})['then'](function(){return _0x2cf928;});}else{return _0x2cf928;}})[_0x85eb('0x47')](function(_0x249511){logger[_0x85eb('0x2b')](_0x85eb('0x53'),_0x249511);throw _0x249511;});}return _0x2cf928;})[_0x85eb('0x26')](respondWithResult(_0x2c951b,0xc9))['catch'](handleError(_0x2c951b,null));};exports[_0x85eb('0x24')]=function(_0x30062e,_0x270bb2){if(_0x30062e[_0x85eb('0x4c')]['id']){delete _0x30062e[_0x85eb('0x4c')]['id'];}return db['VoiceMail'][_0x85eb('0x4b')]({'where':{'id':_0x30062e['params']['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x270bb2,null))[_0x85eb('0x26')](saveUpdates(_0x30062e['body'],null))[_0x85eb('0x26')](respondWithResult(_0x270bb2,null))[_0x85eb('0x47')](handleError(_0x270bb2,null));};exports[_0x85eb('0x25')]=function(_0x26e04a,_0x214ef7){return db[_0x85eb('0x44')]['find']({'where':{'id':_0x26e04a[_0x85eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x214ef7,null))[_0x85eb('0x26')](removeEntity(_0x214ef7,null))[_0x85eb('0x47')](handleError(_0x214ef7,null));};exports['getMessages']=function(_0x152452,_0x2a0f8b,_0x4a3af9){return db[_0x85eb('0x44')]['findOne']({'where':{'id':_0x152452[_0x85eb('0x49')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2a0f8b,null))[_0x85eb('0x26')](function(_0x13c0b3){var _0x45a201;var _0x15d4a7={},_0x5a729e={};_0x5a729e[_0x85eb('0x33')]=_[_0x85eb('0x35')](db[_0x85eb('0x54')][_0x85eb('0x30')]);_0x5a729e[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x152452[_0x85eb('0x34')]);_0x5a729e[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x5a729e[_0x85eb('0x33')],_0x5a729e[_0x85eb('0x34')]);_0x15d4a7['attributes']=_[_0x85eb('0x37')](_0x5a729e[_0x85eb('0x33')],qs[_0x85eb('0x39')](_0x152452[_0x85eb('0x34')][_0x85eb('0x39')]));_0x15d4a7[_0x85eb('0x38')]=_0x15d4a7['attributes'][_0x85eb('0x3a')]?_0x15d4a7['attributes']:_0x5a729e[_0x85eb('0x33')];if(!_0x152452[_0x85eb('0x34')][_0x85eb('0x3b')](_0x85eb('0x3c'))){_0x15d4a7[_0x85eb('0x1e')]=qs['limit'](_0x152452[_0x85eb('0x34')][_0x85eb('0x1e')]);_0x15d4a7[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x152452[_0x85eb('0x34')][_0x85eb('0x1c')]);}_0x15d4a7[_0x85eb('0x3d')]=qs[_0x85eb('0x3e')](_0x152452['query'][_0x85eb('0x3e')]);_0x15d4a7['where']=qs[_0x85eb('0x36')](_[_0x85eb('0x55')](_0x152452[_0x85eb('0x34')],_0x5a729e[_0x85eb('0x36')]));if(_0x152452[_0x85eb('0x34')]['filter']){_0x15d4a7[_0x85eb('0x3f')]=_[_0x85eb('0x40')](_0x15d4a7[_0x85eb('0x3f')],{'$or':_[_0x85eb('0x2f')](_0x15d4a7[_0x85eb('0x38')],function(_0x419b24){var _0x562ffa={};_0x562ffa[_0x419b24]={'$like':'%'+_0x152452['query'][_0x85eb('0x56')]+'%'};return _0x562ffa;})});}_0x15d4a7['where']=_[_0x85eb('0x40')](_0x15d4a7[_0x85eb('0x3f')],{'mailboxuser':_0x13c0b3[_0x85eb('0x57')]});_0x15d4a7=_[_0x85eb('0x40')]({},_0x15d4a7,_0x152452[_0x85eb('0x4a')]);return db[_0x85eb('0x54')]['findAndCountAll'](_0x15d4a7)[_0x85eb('0x26')](respondWithFilteredResult(_0x2a0f8b,_0x15d4a7));})[_0x85eb('0x47')](handleError(_0x2a0f8b,null));}; \ No newline at end of file +var _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x20ae63,_0x348927){var _0x2f0657=function(_0x4c4ff7){while(--_0x4c4ff7){_0x20ae63['push'](_0x20ae63['shift']());}};_0x2f0657(++_0x348927);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5dbc86,_0xcdbb86){_0x5dbc86=_0x5dbc86-0x0;var _0x1f80e3=_0x9c00[_0x5dbc86];return _0x1f80e3;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6f5e347..9c13a9a 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 _0xa5b8=['./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','api','path','../../config/environment'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xa5b8,0x1ca));var _0x8a5b=function(_0x4fed56,_0x33241d){_0x4fed56=_0x4fed56-0x0;var _0x1618fb=_0xa5b8[_0x4fed56];return _0x1618fb;};'use strict';var _=require(_0x8a5b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8a5b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a5b('0x2'));var rimraf=require('rimraf');var config=require(_0x8a5b('0x3'));var attributes=require(_0x8a5b('0x4'));module[_0x8a5b('0x5')]=function(_0x73821f,_0x587af7){return _0x73821f[_0x8a5b('0x6')](_0x8a5b('0x7'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x8a5b('0x8'),'fields':[_0x8a5b('0x9'),_0x8a5b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a68=['path','../../config/environment','exports','define','VoiceMail','mailbox_context','context','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1cf433,_0x98dbde){var _0x1e2287=function(_0x1c5788){while(--_0x1c5788){_0x1cf433['push'](_0x1cf433['shift']());}};_0x1e2287(++_0x98dbde);}(_0x0a68,0x67));var _0x80a6=function(_0x1d6b45,_0x3f4b08){_0x1d6b45=_0x1d6b45-0x0;var _0x127935=_0x0a68[_0x1d6b45];return _0x127935;};'use strict';var _=require(_0x80a6('0x0'));var util=require(_0x80a6('0x1'));var logger=require(_0x80a6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x80a6('0x3'));var rp=require(_0x80a6('0x4'));var fs=require('fs');var path=require(_0x80a6('0x5'));var rimraf=require('rimraf');var config=require(_0x80a6('0x6'));var attributes=require('./voiceMail.attributes');module[_0x80a6('0x7')]=function(_0x39889d,_0x5b691e){return _0x39889d[_0x80a6('0x8')](_0x80a6('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x80a6('0xa'),'fields':['mailbox',_0x80a6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index aa47a0a..3bdae2d 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 _0x2b33=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0xdce78a,_0x507cad){var _0x47c31c=function(_0x4238b5){while(--_0x4238b5){_0xdce78a['push'](_0xdce78a['shift']());}};_0x47c31c(++_0x507cad);}(_0x2b33,0xf3));var _0x32b3=function(_0x156488,_0x3e7952){_0x156488=_0x156488-0x0;var _0x2c6847=_0x2b33[_0x156488];return _0x2c6847;};'use strict';var _=require(_0x32b3('0x0'));var util=require(_0x32b3('0x1'));var moment=require(_0x32b3('0x2'));var BPromise=require(_0x32b3('0x3'));var rs=require(_0x32b3('0x4'));var fs=require('fs');var Redis=require(_0x32b3('0x5'));var db=require(_0x32b3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x32b3('0x7'))('rpc');var config=require(_0x32b3('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x63cb5c,_0x2d91f3,_0x3ec49d){return new BPromise(function(_0x2ab23b,_0x4f8f2e){return client['request'](_0x63cb5c,_0x3ec49d)['then'](function(_0xed1908){logger[_0x32b3('0x9')]('VoiceMail,\x20%s,\x20%s',_0x2d91f3,_0x32b3('0xa'));logger[_0x32b3('0xb')](_0x32b3('0xc'),_0x2d91f3,_0x32b3('0xa'),JSON[_0x32b3('0xd')](_0xed1908));if(_0xed1908[_0x32b3('0xe')]){if(_0xed1908[_0x32b3('0xe')]['code']===0x1f4){logger[_0x32b3('0xe')]('VoiceMail,\x20%s,\x20%s',_0x2d91f3,_0xed1908[_0x32b3('0xe')][_0x32b3('0xf')]);return _0x4f8f2e(_0xed1908[_0x32b3('0xe')][_0x32b3('0xf')]);}logger[_0x32b3('0xe')](_0x32b3('0x10'),_0x2d91f3,_0xed1908[_0x32b3('0xe')][_0x32b3('0xf')]);return _0x2ab23b(_0xed1908[_0x32b3('0xe')]['message']);}else{logger[_0x32b3('0x9')](_0x32b3('0x10'),_0x2d91f3,_0x32b3('0xa'));_0x2ab23b(_0xed1908[_0x32b3('0x11')][_0x32b3('0xf')]);}})[_0x32b3('0x12')](function(_0x4ed85b){logger[_0x32b3('0xe')](_0x32b3('0x10'),_0x2d91f3,_0x4ed85b);_0x4f8f2e(_0x4ed85b);});});} \ No newline at end of file +var _0x9e23=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http'];(function(_0x14f89e,_0x139fce){var _0x26092d=function(_0x2bdc20){while(--_0x2bdc20){_0x14f89e['push'](_0x14f89e['shift']());}};_0x26092d(++_0x139fce);}(_0x9e23,0xf4));var _0x39e2=function(_0x38fce3,_0x535e95){_0x38fce3=_0x38fce3-0x0;var _0x2b2571=_0x9e23[_0x38fce3];return _0x2b2571;};'use strict';var _=require('lodash');var util=require(_0x39e2('0x0'));var moment=require(_0x39e2('0x1'));var BPromise=require('bluebird');var rs=require(_0x39e2('0x2'));var fs=require('fs');var Redis=require(_0x39e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x39e2('0x4'));var logger=require('../../config/logger')(_0x39e2('0x5'));var config=require('../../config/environment');var jayson=require(_0x39e2('0x6'));var client=jayson['client'][_0x39e2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3efe81,_0x394788,_0x52e947){return new BPromise(function(_0x52e451,_0x275c25){return client['request'](_0x3efe81,_0x52e947)[_0x39e2('0x8')](function(_0x1d1030){logger[_0x39e2('0x9')](_0x39e2('0xa'),_0x394788,_0x39e2('0xb'));logger['debug'](_0x39e2('0xc'),_0x394788,_0x39e2('0xb'),JSON[_0x39e2('0xd')](_0x1d1030));if(_0x1d1030[_0x39e2('0xe')]){if(_0x1d1030[_0x39e2('0xe')][_0x39e2('0xf')]===0x1f4){logger[_0x39e2('0xe')]('VoiceMail,\x20%s,\x20%s',_0x394788,_0x1d1030[_0x39e2('0xe')][_0x39e2('0x10')]);return _0x275c25(_0x1d1030[_0x39e2('0xe')][_0x39e2('0x10')]);}logger[_0x39e2('0xe')](_0x39e2('0xa'),_0x394788,_0x1d1030[_0x39e2('0xe')][_0x39e2('0x10')]);return _0x52e451(_0x1d1030[_0x39e2('0xe')][_0x39e2('0x10')]);}else{logger[_0x39e2('0x9')](_0x39e2('0xa'),_0x394788,_0x39e2('0xb'));_0x52e451(_0x1d1030['result'][_0x39e2('0x10')]);}})[_0x39e2('0x11')](function(_0x10975c){logger[_0x39e2('0xe')](_0x39e2('0xa'),_0x394788,_0x10975c);_0x275c25(_0x10975c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 19d6e90..0066928 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 _0xc0fd=['post','create','/:id','delete','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','show','/:id/download','download'];(function(_0x7c3bf0,_0x33ad9c){var _0x4a691f=function(_0x4cc46d){while(--_0x4cc46d){_0x7c3bf0['push'](_0x7c3bf0['shift']());}};_0x4a691f(++_0x33ad9c);}(_0xc0fd,0xd0));var _0xdc0f=function(_0x188e31,_0x117cdf){_0x188e31=_0x188e31-0x0;var _0x475bd0=_0xc0fd[_0x188e31];return _0x475bd0;};'use strict';var multer=require(_0xdc0f('0x0'));var util=require(_0xdc0f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc0f('0x2'));var router=express['Router']();var fs_extra=require(_0xdc0f('0x3'));var auth=require(_0xdc0f('0x4'));var interaction=require(_0xdc0f('0x5'));var config=require(_0xdc0f('0x6'));var controller=require(_0xdc0f('0x7'));router[_0xdc0f('0x8')]('/',auth[_0xdc0f('0x9')](),controller['index']);router[_0xdc0f('0x8')]('/:id',auth[_0xdc0f('0x9')](),controller[_0xdc0f('0xa')]);router['get'](_0xdc0f('0xb'),auth[_0xdc0f('0x9')](),controller[_0xdc0f('0xc')]);router[_0xdc0f('0xd')]('/',auth[_0xdc0f('0x9')](),controller[_0xdc0f('0xe')]);router['put'](_0xdc0f('0xf'),auth[_0xdc0f('0x9')](),controller['update']);router[_0xdc0f('0x10')](_0xdc0f('0xf'),auth[_0xdc0f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x86b2=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','show','get','/:id/download','post','create','put','update','delete','exports','multer'];(function(_0x4d85fe,_0x3d1cfb){var _0x1a8b76=function(_0x3a1efe){while(--_0x3a1efe){_0x4d85fe['push'](_0x4d85fe['shift']());}};_0x1a8b76(++_0x3d1cfb);}(_0x86b2,0x103));var _0x286b=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x86b2[_0x342700];return _0x53406f;};'use strict';var multer=require(_0x286b('0x0'));var util=require(_0x286b('0x1'));var path=require(_0x286b('0x2'));var timeout=require('connect-timeout');var express=require(_0x286b('0x3'));var router=express[_0x286b('0x4')]();var fs_extra=require(_0x286b('0x5'));var auth=require(_0x286b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x286b('0x7'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x286b('0x8')]);router['get'](_0x286b('0x9'),auth[_0x286b('0xa')](),controller[_0x286b('0xb')]);router[_0x286b('0xc')](_0x286b('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x286b('0xe')]('/',auth[_0x286b('0xa')](),controller[_0x286b('0xf')]);router[_0x286b('0x10')](_0x286b('0x9'),auth['isAuthenticated'](),controller[_0x286b('0x11')]);router[_0x286b('0x12')]('/:id',auth[_0x286b('0xa')](),controller['destroy']);module[_0x286b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 687acc0..0086f00 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 _0xa19d=['INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x4b17af,_0x35b7ef){var _0xf5398e=function(_0x1534f6){while(--_0x1534f6){_0x4b17af['push'](_0x4b17af['shift']());}};_0xf5398e(++_0x35b7ef);}(_0xa19d,0x100));var _0xda19=function(_0x322a07,_0x5a0c88){_0x322a07=_0x322a07-0x0;var _0x1d7845=_0xa19d[_0x322a07];return _0x1d7845;};'use strict';var Sequelize=require(_0xda19('0x0'));module[_0xda19('0x1')]={'name':{'type':Sequelize[_0xda19('0x2')],'get':function(_0x132605){return this[_0xda19('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xda19('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xda19('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xda19('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xda19('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xda19('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xda19('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xda19('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xda19('0x6')](_0xda19('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xda19('0x5')],'defaultValue':''},'stamp':{'type':_0xda19('0x8'),'defaultValue':Sequelize['literal'](_0xda19('0x9'))}}; \ No newline at end of file +var _0xb027=['VIRTUAL','INTEGER','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x30eeb3,_0x3f2ca1){var _0x2854d6=function(_0x14115c){while(--_0x14115c){_0x30eeb3['push'](_0x30eeb3['shift']());}};_0x2854d6(++_0x3f2ca1);}(_0xb027,0xb7));var _0x7b02=function(_0x174c76,_0x4224c9){_0x174c76=_0x174c76-0x0;var _0x228b84=_0xb027[_0x174c76];return _0x228b84;};'use strict';var Sequelize=require(_0x7b02('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b02('0x1')],'get':function(_0x23c1e3){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x7b02('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x7b02('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7b02('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x7b02('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7b02('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7b02('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x7b02('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x7b02('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x7b02('0x5'),'defaultValue':Sequelize[_0x7b02('0x6')](_0x7b02('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 194a006..7432e67 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 _0x8a7f=['key','model','differenceBy','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','keys','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type'];(function(_0x425cf0,_0x3f194a){var _0x2ba5ec=function(_0x4934fc){while(--_0x4934fc){_0x425cf0['push'](_0x425cf0['shift']());}};_0x2ba5ec(++_0x3f194a);}(_0x8a7f,0xd1));var _0xf8a7=function(_0x3afd30,_0x5a5e11){_0x3afd30=_0x3afd30-0x0;var _0x140895=_0x8a7f[_0x3afd30];return _0x140895;};'use strict';var emlformat=require(_0xf8a7('0x0'));var rimraf=require(_0xf8a7('0x1'));var zipdir=require(_0xf8a7('0x2'));var jsonpatch=require(_0xf8a7('0x3'));var rp=require(_0xf8a7('0x4'));var moment=require(_0xf8a7('0x5'));var BPromise=require(_0xf8a7('0x6'));var Mustache=require(_0xf8a7('0x7'));var util=require(_0xf8a7('0x8'));var path=require('path');var sox=require(_0xf8a7('0x9'));var csv=require(_0xf8a7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8a7('0xb'));var _=require(_0xf8a7('0xc'));var squel=require(_0xf8a7('0xd'));var crypto=require('crypto');var jsforce=require(_0xf8a7('0xe'));var deskjs=require(_0xf8a7('0xf'));var toCsv=require(_0xf8a7('0xa'));var querystring=require('querystring');var Papa=require(_0xf8a7('0x10'));var Redis=require(_0xf8a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf8a7('0x12'));var as=require(_0xf8a7('0x13'));var hardwareService=require(_0xf8a7('0x14'));var logger=require(_0xf8a7('0x15'))(_0xf8a7('0x16'));var utils=require(_0xf8a7('0x17'));var config=require(_0xf8a7('0x18'));var licenseUtil=require(_0xf8a7('0x19'));var db=require(_0xf8a7('0x1a'))['db'];function respondWithStatusCode(_0x517e9c,_0x1c96d7){_0x1c96d7=_0x1c96d7||0xcc;return function(_0x32cf71){if(_0x32cf71){return _0x517e9c[_0xf8a7('0x1b')](_0x1c96d7);}return _0x517e9c[_0xf8a7('0x1c')](_0x1c96d7)[_0xf8a7('0x1d')]();};}function respondWithResult(_0x1c2b24,_0x2744ab){_0x2744ab=_0x2744ab||0xc8;return function(_0x2137c5){if(_0x2137c5){return _0x1c2b24['status'](_0x2744ab)[_0xf8a7('0x1e')](_0x2137c5);}};}function respondWithFilteredResult(_0x50474f,_0x510a98){return function(_0x57f695){if(_0x57f695){var _0x2e1fd8=typeof _0x510a98[_0xf8a7('0x1f')]===_0xf8a7('0x20')&&typeof _0x510a98[_0xf8a7('0x21')]==='undefined';var _0x4de977=_0x57f695['count'];var _0x2c37a9=_0x2e1fd8?0x0:_0x510a98[_0xf8a7('0x1f')];var _0x44780b=_0x2e1fd8?_0x57f695['count']:_0x510a98[_0xf8a7('0x1f')]+_0x510a98[_0xf8a7('0x21')];var _0x2ef973;if(_0x44780b>=_0x4de977){_0x44780b=_0x4de977;_0x2ef973=0xc8;}else{_0x2ef973=0xce;}_0x50474f[_0xf8a7('0x1c')](_0x2ef973);return _0x50474f[_0xf8a7('0x22')]('Content-Range',_0x2c37a9+'-'+_0x44780b+'/'+_0x4de977)[_0xf8a7('0x1e')](_0x57f695);}return null;};}function patchUpdates(_0x54ae1c){return function(_0x3048c7){try{jsonpatch[_0xf8a7('0x23')](_0x3048c7,_0x54ae1c,!![]);}catch(_0xe495cc){return BPromise[_0xf8a7('0x24')](_0xe495cc);}return _0x3048c7[_0xf8a7('0x25')]();};}function saveUpdates(_0x4abeb9,_0x182265){return function(_0x3b1d1c){if(_0x3b1d1c){return _0x3b1d1c[_0xf8a7('0x26')](_0x4abeb9)[_0xf8a7('0x27')](function(_0xaf0a59){return _0xaf0a59;});}return null;};}function removeEntity(_0x28b739,_0x15151d){return function(_0x2505ca){if(_0x2505ca){return _0x2505ca[_0xf8a7('0x28')]()[_0xf8a7('0x27')](function(){_0x28b739[_0xf8a7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57d971,_0x51b882){return function(_0x487a40){if(!_0x487a40){_0x57d971[_0xf8a7('0x1b')](0x194);}return _0x487a40;};}function handleError(_0x5e121d,_0x7feaaa){_0x7feaaa=_0x7feaaa||0x1f4;return function(_0x82d5d2){logger[_0xf8a7('0x29')](_0x82d5d2['stack']);if(_0x82d5d2[_0xf8a7('0x2a')]){delete _0x82d5d2[_0xf8a7('0x2a')];}_0x5e121d['status'](_0x7feaaa)[_0xf8a7('0x2b')](_0x82d5d2);};}exports[_0xf8a7('0x2c')]=function(_0x12b4c4,_0x304478){var _0x4ace47={},_0x585d97={},_0x92c0af={'count':0x0,'rows':[]};var _0x36f53a=_['map'](db[_0xf8a7('0x2d')][_0xf8a7('0x2e')],function(_0x5ef6d5){return{'name':_0x5ef6d5[_0xf8a7('0x2f')],'type':_0x5ef6d5[_0xf8a7('0x30')][_0xf8a7('0x31')]};});_0x585d97[_0xf8a7('0x32')]=_[_0xf8a7('0x33')](_[_0xf8a7('0x34')](_0x36f53a,_0xf8a7('0x2a')),[_0xf8a7('0x2a')]);_0x585d97[_0xf8a7('0x35')]=_['keys'](_0x12b4c4['query']);_0x585d97[_0xf8a7('0x36')]=_['intersection'](_0x585d97[_0xf8a7('0x32')],_0x585d97[_0xf8a7('0x35')]);_0x4ace47['attributes']=_[_0xf8a7('0x37')](_0x585d97[_0xf8a7('0x32')],qs['fields'](_0x12b4c4[_0xf8a7('0x35')][_0xf8a7('0x38')]));_0x4ace47[_0xf8a7('0x39')]=_0x4ace47[_0xf8a7('0x39')][_0xf8a7('0x3a')]?_0x4ace47['attributes']:_0x585d97[_0xf8a7('0x32')];if(!_0x12b4c4[_0xf8a7('0x35')][_0xf8a7('0x3b')](_0xf8a7('0x3c'))){_0x4ace47[_0xf8a7('0x21')]=qs['limit'](_0x12b4c4[_0xf8a7('0x35')][_0xf8a7('0x21')]);_0x4ace47[_0xf8a7('0x1f')]=qs[_0xf8a7('0x1f')](_0x12b4c4[_0xf8a7('0x35')][_0xf8a7('0x1f')]);}_0x4ace47[_0xf8a7('0x3d')]=qs[_0xf8a7('0x3e')](_0x12b4c4[_0xf8a7('0x35')][_0xf8a7('0x3e')]);_0x4ace47['where']=qs['filters'](_['pick'](_0x12b4c4['query'],_0x585d97[_0xf8a7('0x36')]),_0x36f53a);if(_0x12b4c4['query']['filter']){_0x4ace47[_0xf8a7('0x3f')]=_[_0xf8a7('0x40')](_0x4ace47['where'],{'$or':_[_0xf8a7('0x34')](_0x36f53a,function(_0x5c96e0){if(_0x5c96e0['type']!==_0xf8a7('0x41')){var _0x90dbd5={};_0x90dbd5[_0x5c96e0[_0xf8a7('0x2a')]]={'$like':'%'+_0x12b4c4[_0xf8a7('0x35')]['filter']+'%'};return _0x90dbd5;}})});}_0x4ace47=_[_0xf8a7('0x40')]({},_0x4ace47,_0x12b4c4[_0xf8a7('0x42')]);var _0xa1e46f={'where':_0x4ace47[_0xf8a7('0x3f')]};return db[_0xf8a7('0x2d')][_0xf8a7('0x43')](_0xa1e46f)['then'](function(_0x3812fd){_0x92c0af['count']=_0x3812fd;if(_0x12b4c4[_0xf8a7('0x35')][_0xf8a7('0x44')]){_0x4ace47[_0xf8a7('0x45')]=[{'all':!![]}];}return db[_0xf8a7('0x2d')]['findAll'](_0x4ace47);})[_0xf8a7('0x27')](function(_0x3b8f28){_0x92c0af['rows']=_0x3b8f28;return _0x92c0af;})[_0xf8a7('0x27')](respondWithFilteredResult(_0x304478,_0x4ace47))[_0xf8a7('0x46')](handleError(_0x304478,null));};exports[_0xf8a7('0x47')]=function(_0x5f3f13,_0x32074b){var _0x43704e={'raw':!![],'where':{'id':_0x5f3f13[_0xf8a7('0x48')]['id']}},_0x2d5f93={};_0x2d5f93['model']=_['keys'](db[_0xf8a7('0x2d')][_0xf8a7('0x2e')]);_0x2d5f93[_0xf8a7('0x35')]=_[_0xf8a7('0x49')](_0x5f3f13['query']);_0x2d5f93['filters']=_[_0xf8a7('0x37')](_0x2d5f93[_0xf8a7('0x32')],_0x2d5f93[_0xf8a7('0x35')]);_0x43704e[_0xf8a7('0x39')]=_['intersection'](_0x2d5f93[_0xf8a7('0x32')],qs[_0xf8a7('0x38')](_0x5f3f13[_0xf8a7('0x35')]['fields']));_0x43704e[_0xf8a7('0x39')]=_0x43704e[_0xf8a7('0x39')][_0xf8a7('0x3a')]?_0x43704e['attributes']:_0x2d5f93[_0xf8a7('0x32')];if(_0x5f3f13[_0xf8a7('0x35')]['includeAll']){_0x43704e[_0xf8a7('0x45')]=[{'all':!![]}];}_0x43704e=_['merge']({},_0x43704e,_0x5f3f13[_0xf8a7('0x42')]);return db[_0xf8a7('0x2d')][_0xf8a7('0x4a')](_0x43704e)[_0xf8a7('0x27')](handleEntityNotFound(_0x32074b,null))['then'](respondWithResult(_0x32074b,null))['catch'](handleError(_0x32074b,null));};exports[_0xf8a7('0x4b')]=function(_0x2fca73,_0x3cdbbd){return db[_0xf8a7('0x2d')]['create'](_0x2fca73[_0xf8a7('0x4c')],{})[_0xf8a7('0x27')](respondWithResult(_0x3cdbbd,0xc9))[_0xf8a7('0x46')](handleError(_0x3cdbbd,null));};exports[_0xf8a7('0x26')]=function(_0x3f3b66,_0x185e1c){if(_0x3f3b66[_0xf8a7('0x4c')]['id']){delete _0x3f3b66[_0xf8a7('0x4c')]['id'];}return db[_0xf8a7('0x2d')][_0xf8a7('0x4a')]({'where':{'id':_0x3f3b66['params']['id']}})[_0xf8a7('0x27')](handleEntityNotFound(_0x185e1c,null))[_0xf8a7('0x27')](saveUpdates(_0x3f3b66['body'],null))[_0xf8a7('0x27')](respondWithResult(_0x185e1c,null))[_0xf8a7('0x46')](handleError(_0x185e1c,null));};exports[_0xf8a7('0x28')]=function(_0x4552ed,_0x2e5111){return db[_0xf8a7('0x2d')]['find']({'where':{'id':_0x4552ed[_0xf8a7('0x48')]['id']}})[_0xf8a7('0x27')](handleEntityNotFound(_0x2e5111,null))[_0xf8a7('0x27')](removeEntity(_0x2e5111,null))[_0xf8a7('0x46')](handleError(_0x2e5111,null));};exports[_0xf8a7('0x4d')]=function(_0x389e20,_0x19f892,_0x4ed721){return db[_0xf8a7('0x2d')]['find']({'where':{'id':_0x389e20['params']['id']},'attributes':['id',_0xf8a7('0x4e'),'msg_id']})[_0xf8a7('0x27')](handleEntityNotFound(_0x19f892,null))['then'](function(_0x2ff54c){if(_0x2ff54c){if(!_0x2ff54c[_0xf8a7('0x4e')]){throw new db[(_0xf8a7('0x4f'))][(_0xf8a7('0x50'))](_0xf8a7('0x51'));}var _0x3abdd1={'Content-Type':_0xf8a7('0x52'),'Content-Disposition':_0xf8a7('0x53')};if(_0x2ff54c[_0xf8a7('0x54')]){_0x3abdd1['Content-Disposition']='attachment;\x20filename=\x22'+_0x2ff54c[_0xf8a7('0x54')]+_0xf8a7('0x55');}_0x19f892[_0xf8a7('0x22')](_0x3abdd1);return _0x19f892[_0xf8a7('0x2b')](new Buffer(_0x2ff54c[_0xf8a7('0x4e')]));}})[_0xf8a7('0x46')](handleError(_0x19f892,null));}; \ No newline at end of file +var _0x9c50=['options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','destroy','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','msg_id','.wav\x22','set','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','where','filters','filter','merge','VIRTUAL'];(function(_0x3f1d63,_0x1c9397){var _0x48173a=function(_0xa1ae0b){while(--_0xa1ae0b){_0x3f1d63['push'](_0x3f1d63['shift']());}};_0x48173a(++_0x1c9397);}(_0x9c50,0x1a9));var _0x09c5=function(_0x1f8a0e,_0xa8c3fe){_0x1f8a0e=_0x1f8a0e-0x0;var _0x1ab7a9=_0x9c50[_0x1f8a0e];return _0x1ab7a9;};'use strict';var emlformat=require(_0x09c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09c5('0x1'));var jsonpatch=require(_0x09c5('0x2'));var rp=require(_0x09c5('0x3'));var moment=require(_0x09c5('0x4'));var BPromise=require(_0x09c5('0x5'));var Mustache=require(_0x09c5('0x6'));var util=require('util');var path=require(_0x09c5('0x7'));var sox=require('sox');var csv=require(_0x09c5('0x8'));var ejs=require(_0x09c5('0x9'));var fs=require('fs');var fs_extra=require(_0x09c5('0xa'));var _=require(_0x09c5('0xb'));var squel=require(_0x09c5('0xc'));var crypto=require('crypto');var jsforce=require(_0x09c5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x09c5('0xe'));var Papa=require(_0x09c5('0xf'));var Redis=require(_0x09c5('0x10'));var authService=require(_0x09c5('0x11'));var qs=require(_0x09c5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09c5('0x13'));var logger=require(_0x09c5('0x14'))(_0x09c5('0x15'));var utils=require('../../config/utils');var config=require(_0x09c5('0x16'));var licenseUtil=require(_0x09c5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14a37d,_0x44e7aa){_0x44e7aa=_0x44e7aa||0xcc;return function(_0x1580f1){if(_0x1580f1){return _0x14a37d[_0x09c5('0x18')](_0x44e7aa);}return _0x14a37d[_0x09c5('0x19')](_0x44e7aa)[_0x09c5('0x1a')]();};}function respondWithResult(_0x1c403b,_0x24b31f){_0x24b31f=_0x24b31f||0xc8;return function(_0x29dfdc){if(_0x29dfdc){return _0x1c403b[_0x09c5('0x19')](_0x24b31f)[_0x09c5('0x1b')](_0x29dfdc);}};}function respondWithFilteredResult(_0x34bd15,_0x112068){return function(_0x5c2fa5){if(_0x5c2fa5){var _0x17abc4=typeof _0x112068['offset']===_0x09c5('0x1c')&&typeof _0x112068[_0x09c5('0x1d')]===_0x09c5('0x1c');var _0x5414d4=_0x5c2fa5[_0x09c5('0x1e')];var _0x37d210=_0x17abc4?0x0:_0x112068['offset'];var _0x1112fc=_0x17abc4?_0x5c2fa5[_0x09c5('0x1e')]:_0x112068['offset']+_0x112068[_0x09c5('0x1d')];var _0x170606;if(_0x1112fc>=_0x5414d4){_0x1112fc=_0x5414d4;_0x170606=0xc8;}else{_0x170606=0xce;}_0x34bd15[_0x09c5('0x19')](_0x170606);return _0x34bd15['set'](_0x09c5('0x1f'),_0x37d210+'-'+_0x1112fc+'/'+_0x5414d4)['json'](_0x5c2fa5);}return null;};}function patchUpdates(_0x4879a9){return function(_0x47faaf){try{jsonpatch['apply'](_0x47faaf,_0x4879a9,!![]);}catch(_0x32155c){return BPromise[_0x09c5('0x20')](_0x32155c);}return _0x47faaf[_0x09c5('0x21')]();};}function saveUpdates(_0x338ec7,_0xdce33d){return function(_0xc5094c){if(_0xc5094c){return _0xc5094c[_0x09c5('0x22')](_0x338ec7)['then'](function(_0x454fe3){return _0x454fe3;});}return null;};}function removeEntity(_0x3b1c24,_0x5b3854){return function(_0x548bf5){if(_0x548bf5){return _0x548bf5['destroy']()[_0x09c5('0x23')](function(){_0x3b1c24[_0x09c5('0x19')](0xcc)[_0x09c5('0x1a')]();});}};}function handleEntityNotFound(_0x53b745,_0x40bac6){return function(_0x33b3ff){if(!_0x33b3ff){_0x53b745[_0x09c5('0x18')](0x194);}return _0x33b3ff;};}function handleError(_0x387e4e,_0x28b06d){_0x28b06d=_0x28b06d||0x1f4;return function(_0x65f20){logger[_0x09c5('0x24')](_0x65f20[_0x09c5('0x25')]);if(_0x65f20[_0x09c5('0x26')]){delete _0x65f20['name'];}_0x387e4e[_0x09c5('0x19')](_0x28b06d)[_0x09c5('0x27')](_0x65f20);};}exports[_0x09c5('0x28')]=function(_0x5c9bf1,_0x256299){var _0x3b441b={},_0x27cc2e={},_0x2e726e={'count':0x0,'rows':[]};var _0x312681=_['map'](db[_0x09c5('0x29')][_0x09c5('0x2a')],function(_0x39ba82){return{'name':_0x39ba82[_0x09c5('0x2b')],'type':_0x39ba82[_0x09c5('0x2c')][_0x09c5('0x2d')]};});_0x27cc2e['model']=_['differenceBy'](_[_0x09c5('0x2e')](_0x312681,_0x09c5('0x26')),[_0x09c5('0x26')]);_0x27cc2e[_0x09c5('0x2f')]=_['keys'](_0x5c9bf1['query']);_0x27cc2e['filters']=_[_0x09c5('0x30')](_0x27cc2e[_0x09c5('0x31')],_0x27cc2e[_0x09c5('0x2f')]);_0x3b441b[_0x09c5('0x32')]=_[_0x09c5('0x30')](_0x27cc2e[_0x09c5('0x31')],qs[_0x09c5('0x33')](_0x5c9bf1[_0x09c5('0x2f')]['fields']));_0x3b441b[_0x09c5('0x32')]=_0x3b441b['attributes'][_0x09c5('0x34')]?_0x3b441b[_0x09c5('0x32')]:_0x27cc2e[_0x09c5('0x31')];if(!_0x5c9bf1['query'][_0x09c5('0x35')]('nolimit')){_0x3b441b[_0x09c5('0x1d')]=qs[_0x09c5('0x1d')](_0x5c9bf1[_0x09c5('0x2f')][_0x09c5('0x1d')]);_0x3b441b['offset']=qs[_0x09c5('0x36')](_0x5c9bf1[_0x09c5('0x2f')][_0x09c5('0x36')]);}_0x3b441b[_0x09c5('0x37')]=qs['sort'](_0x5c9bf1[_0x09c5('0x2f')]['sort']);_0x3b441b[_0x09c5('0x38')]=qs['filters'](_['pick'](_0x5c9bf1[_0x09c5('0x2f')],_0x27cc2e[_0x09c5('0x39')]),_0x312681);if(_0x5c9bf1[_0x09c5('0x2f')][_0x09c5('0x3a')]){_0x3b441b[_0x09c5('0x38')]=_[_0x09c5('0x3b')](_0x3b441b[_0x09c5('0x38')],{'$or':_[_0x09c5('0x2e')](_0x312681,function(_0x382ac1){if(_0x382ac1[_0x09c5('0x2c')]!==_0x09c5('0x3c')){var _0x538994={};_0x538994[_0x382ac1[_0x09c5('0x26')]]={'$like':'%'+_0x5c9bf1[_0x09c5('0x2f')][_0x09c5('0x3a')]+'%'};return _0x538994;}})});}_0x3b441b=_['merge']({},_0x3b441b,_0x5c9bf1[_0x09c5('0x3d')]);var _0x3c8d8b={'where':_0x3b441b['where']};return db[_0x09c5('0x29')][_0x09c5('0x1e')](_0x3c8d8b)[_0x09c5('0x23')](function(_0x488f0a){_0x2e726e[_0x09c5('0x1e')]=_0x488f0a;if(_0x5c9bf1[_0x09c5('0x2f')][_0x09c5('0x3e')]){_0x3b441b['include']=[{'all':!![]}];}return db[_0x09c5('0x29')][_0x09c5('0x3f')](_0x3b441b);})[_0x09c5('0x23')](function(_0x798710){_0x2e726e[_0x09c5('0x40')]=_0x798710;return _0x2e726e;})['then'](respondWithFilteredResult(_0x256299,_0x3b441b))[_0x09c5('0x41')](handleError(_0x256299,null));};exports[_0x09c5('0x42')]=function(_0x45781a,_0x4afb65){var _0x1cfa53={'raw':!![],'where':{'id':_0x45781a[_0x09c5('0x43')]['id']}},_0x21c486={};_0x21c486['model']=_[_0x09c5('0x44')](db[_0x09c5('0x29')][_0x09c5('0x2a')]);_0x21c486['query']=_['keys'](_0x45781a[_0x09c5('0x2f')]);_0x21c486[_0x09c5('0x39')]=_[_0x09c5('0x30')](_0x21c486['model'],_0x21c486[_0x09c5('0x2f')]);_0x1cfa53[_0x09c5('0x32')]=_['intersection'](_0x21c486[_0x09c5('0x31')],qs['fields'](_0x45781a[_0x09c5('0x2f')][_0x09c5('0x33')]));_0x1cfa53[_0x09c5('0x32')]=_0x1cfa53['attributes'][_0x09c5('0x34')]?_0x1cfa53[_0x09c5('0x32')]:_0x21c486[_0x09c5('0x31')];if(_0x45781a[_0x09c5('0x2f')]['includeAll']){_0x1cfa53['include']=[{'all':!![]}];}_0x1cfa53=_[_0x09c5('0x3b')]({},_0x1cfa53,_0x45781a[_0x09c5('0x3d')]);return db['VoiceMailMessage'][_0x09c5('0x45')](_0x1cfa53)[_0x09c5('0x23')](handleEntityNotFound(_0x4afb65,null))[_0x09c5('0x23')](respondWithResult(_0x4afb65,null))[_0x09c5('0x41')](handleError(_0x4afb65,null));};exports[_0x09c5('0x46')]=function(_0x4767e4,_0x21ab76){return db['VoiceMailMessage'][_0x09c5('0x46')](_0x4767e4[_0x09c5('0x47')],{})[_0x09c5('0x23')](respondWithResult(_0x21ab76,0xc9))[_0x09c5('0x41')](handleError(_0x21ab76,null));};exports[_0x09c5('0x22')]=function(_0x2155a9,_0x51c546){if(_0x2155a9['body']['id']){delete _0x2155a9[_0x09c5('0x47')]['id'];}return db[_0x09c5('0x29')][_0x09c5('0x45')]({'where':{'id':_0x2155a9[_0x09c5('0x43')]['id']}})['then'](handleEntityNotFound(_0x51c546,null))['then'](saveUpdates(_0x2155a9['body'],null))[_0x09c5('0x23')](respondWithResult(_0x51c546,null))[_0x09c5('0x41')](handleError(_0x51c546,null));};exports[_0x09c5('0x48')]=function(_0x43a99f,_0x18881f){return db[_0x09c5('0x29')][_0x09c5('0x45')]({'where':{'id':_0x43a99f[_0x09c5('0x43')]['id']}})['then'](handleEntityNotFound(_0x18881f,null))['then'](removeEntity(_0x18881f,null))[_0x09c5('0x41')](handleError(_0x18881f,null));};exports['download']=function(_0x5666c6,_0x45657f,_0x3d2833){return db[_0x09c5('0x29')][_0x09c5('0x45')]({'where':{'id':_0x5666c6[_0x09c5('0x43')]['id']},'attributes':['id',_0x09c5('0x49'),'msg_id']})[_0x09c5('0x23')](handleEntityNotFound(_0x45657f,null))['then'](function(_0xcf4178){if(_0xcf4178){if(!_0xcf4178['recording']){throw new db[(_0x09c5('0x4a'))][(_0x09c5('0x4b'))](_0x09c5('0x4c'));}var _0x28bab8={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0xcf4178['msg_id']){_0x28bab8[_0x09c5('0x4d')]='attachment;\x20filename=\x22'+_0xcf4178[_0x09c5('0x4e')]+_0x09c5('0x4f');}_0x45657f[_0x09c5('0x50')](_0x28bab8);return _0x45657f[_0x09c5('0x27')](new Buffer(_0xcf4178[_0x09c5('0x49')]));}})[_0x09c5('0x41')](handleError(_0x45657f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c371116..f06d110 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 _0x1c49=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x122006,_0x343cb4){var _0xd3582d=function(_0x2e6ef0){while(--_0x2e6ef0){_0x122006['push'](_0x122006['shift']());}};_0xd3582d(++_0x343cb4);}(_0x1c49,0x138));var _0x91c4=function(_0x3e36b6,_0x43de3b){_0x3e36b6=_0x3e36b6-0x0;var _0x4a3a36=_0x1c49[_0x3e36b6];return _0x4a3a36;};'use strict';var _=require(_0x91c4('0x0'));var util=require(_0x91c4('0x1'));var logger=require('../../config/logger')(_0x91c4('0x2'));var moment=require(_0x91c4('0x3'));var BPromise=require(_0x91c4('0x4'));var rp=require(_0x91c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91c4('0x6'));var config=require(_0x91c4('0x7'));var attributes=require(_0x91c4('0x8'));module['exports']=function(_0x3039f9,_0x5e0b58){return _0x3039f9[_0x91c4('0x9')](_0x91c4('0xa'),attributes,{'tableName':_0x91c4('0xb'),'paranoid':![],'indexes':[{'name':_0x91c4('0xc'),'fields':[_0x91c4('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xde7f=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x513d97,_0x4a86d6){var _0x173833=function(_0x34d4af){while(--_0x34d4af){_0x513d97['push'](_0x513d97['shift']());}};_0x173833(++_0x4a86d6);}(_0xde7f,0x1e8));var _0xfde7=function(_0x1613c0,_0x2bda97){_0x1613c0=_0x1613c0-0x0;var _0x41b12b=_0xde7f[_0x1613c0];return _0x41b12b;};'use strict';var _=require(_0xfde7('0x0'));var util=require(_0xfde7('0x1'));var logger=require(_0xfde7('0x2'))(_0xfde7('0x3'));var moment=require(_0xfde7('0x4'));var BPromise=require(_0xfde7('0x5'));var rp=require(_0xfde7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfde7('0x7'));var config=require(_0xfde7('0x8'));var attributes=require(_0xfde7('0x9'));module[_0xfde7('0xa')]=function(_0x1c2f1a,_0x52964d){return _0x1c2f1a[_0xfde7('0xb')](_0xfde7('0xc'),attributes,{'tableName':_0xfde7('0xd'),'paranoid':![],'indexes':[{'name':_0xfde7('0xe'),'fields':[_0xfde7('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9e11b4c..c9c0c26 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 _0x00a3=['message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x4f6d0e,_0x5d82af){var _0x4ddc07=function(_0x5f125e){while(--_0x5f125e){_0x4f6d0e['push'](_0x4f6d0e['shift']());}};_0x4ddc07(++_0x5d82af);}(_0x00a3,0xa5));var _0x300a=function(_0x2e76c5,_0x1fb02e){_0x2e76c5=_0x2e76c5-0x0;var _0x108a0d=_0x00a3[_0x2e76c5];return _0x108a0d;};'use strict';var _=require('lodash');var util=require(_0x300a('0x0'));var moment=require(_0x300a('0x1'));var BPromise=require(_0x300a('0x2'));var rs=require(_0x300a('0x3'));var fs=require('fs');var Redis=require(_0x300a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x300a('0x5'));var logger=require(_0x300a('0x6'))(_0x300a('0x7'));var config=require(_0x300a('0x8'));var jayson=require(_0x300a('0x9'));var client=jayson['client'][_0x300a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15116a,_0x40c455,_0x4ecd18){return new BPromise(function(_0x53ae2d,_0x152a9a){return client[_0x300a('0xb')](_0x15116a,_0x4ecd18)[_0x300a('0xc')](function(_0x1f1eb9){logger['info'](_0x300a('0xd'),_0x40c455,'request\x20sent');logger[_0x300a('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x40c455,_0x300a('0xf'),JSON[_0x300a('0x10')](_0x1f1eb9));if(_0x1f1eb9[_0x300a('0x11')]){if(_0x1f1eb9['error'][_0x300a('0x12')]===0x1f4){logger['error'](_0x300a('0xd'),_0x40c455,_0x1f1eb9[_0x300a('0x11')][_0x300a('0x13')]);return _0x152a9a(_0x1f1eb9[_0x300a('0x11')]['message']);}logger[_0x300a('0x11')](_0x300a('0xd'),_0x40c455,_0x1f1eb9[_0x300a('0x11')][_0x300a('0x13')]);return _0x53ae2d(_0x1f1eb9[_0x300a('0x11')][_0x300a('0x13')]);}else{logger[_0x300a('0x14')](_0x300a('0xd'),_0x40c455,'request\x20sent');_0x53ae2d(_0x1f1eb9[_0x300a('0x15')][_0x300a('0x13')]);}})[_0x300a('0x16')](function(_0x31cee6){logger[_0x300a('0x11')](_0x300a('0xd'),_0x40c455,_0x31cee6);_0x152a9a(_0x31cee6);});});} \ No newline at end of file +var _0xd716=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4374d1,_0x2cdb4a){var _0x3d5dc2=function(_0x19c2fe){while(--_0x19c2fe){_0x4374d1['push'](_0x4374d1['shift']());}};_0x3d5dc2(++_0x2cdb4a);}(_0xd716,0x11d));var _0x6d71=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xd716[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0x6d71('0x0'));var util=require(_0x6d71('0x1'));var moment=require('moment');var BPromise=require(_0x6d71('0x2'));var rs=require(_0x6d71('0x3'));var fs=require('fs');var Redis=require(_0x6d71('0x4'));var db=require(_0x6d71('0x5'))['db'];var utils=require(_0x6d71('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d71('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6d71('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x196b7b,_0x22d339,_0x487f0d){return new BPromise(function(_0x17f702,_0x4c75a8){return client[_0x6d71('0x9')](_0x196b7b,_0x487f0d)[_0x6d71('0xa')](function(_0x146c83){logger[_0x6d71('0xb')](_0x6d71('0xc'),_0x22d339,_0x6d71('0xd'));logger[_0x6d71('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x22d339,_0x6d71('0xd'),JSON[_0x6d71('0xf')](_0x146c83));if(_0x146c83[_0x6d71('0x10')]){if(_0x146c83[_0x6d71('0x10')][_0x6d71('0x11')]===0x1f4){logger['error'](_0x6d71('0xc'),_0x22d339,_0x146c83[_0x6d71('0x10')][_0x6d71('0x12')]);return _0x4c75a8(_0x146c83[_0x6d71('0x10')][_0x6d71('0x12')]);}logger[_0x6d71('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x22d339,_0x146c83[_0x6d71('0x10')]['message']);return _0x17f702(_0x146c83[_0x6d71('0x10')][_0x6d71('0x12')]);}else{logger[_0x6d71('0xb')](_0x6d71('0xc'),_0x22d339,'request\x20sent');_0x17f702(_0x146c83[_0x6d71('0x13')][_0x6d71('0x12')]);}})['catch'](function(_0x32db4e){logger[_0x6d71('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x22d339,_0x32db4e);_0x4c75a8(_0x32db4e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 078cfd3..a0c5c04 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 _0x1cb6=['/:id/sounds','getSounds','post','create','addSound','put','delete','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x57101c,_0x1ab2d3){var _0x525315=function(_0x10cabb){while(--_0x10cabb){_0x57101c['push'](_0x57101c['shift']());}};_0x525315(++_0x1ab2d3);}(_0x1cb6,0x1c2));var _0x61cb=function(_0x3097c3,_0x237e3e){_0x3097c3=_0x3097c3-0x0;var _0x3657d5=_0x1cb6[_0x3097c3];return _0x3657d5;};'use strict';var multer=require(_0x61cb('0x0'));var util=require(_0x61cb('0x1'));var path=require('path');var timeout=require(_0x61cb('0x2'));var express=require(_0x61cb('0x3'));var router=express[_0x61cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x61cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x61cb('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x61cb('0x7')]('/',auth[_0x61cb('0x8')](),controller[_0x61cb('0x9')]);router['get'](_0x61cb('0xa'),auth[_0x61cb('0x8')](),controller[_0x61cb('0xb')]);router[_0x61cb('0x7')](_0x61cb('0xc'),auth[_0x61cb('0x8')](),controller[_0x61cb('0xd')]);router[_0x61cb('0xe')]('/',auth[_0x61cb('0x8')](),controller[_0x61cb('0xf')]);router['post'](_0x61cb('0xc'),auth[_0x61cb('0x8')](),controller[_0x61cb('0x10')]);router[_0x61cb('0x11')]('/:id',auth[_0x61cb('0x8')](),controller['update']);router[_0x61cb('0x12')](_0x61cb('0xa'),auth[_0x61cb('0x8')](),controller['destroy']);router['delete'](_0x61cb('0x13'),auth[_0x61cb('0x8')](),controller[_0x61cb('0x14')]);module[_0x61cb('0x15')]=router; \ No newline at end of file +var _0xf549=['isAuthenticated','index','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get'];(function(_0x5d909a,_0x3752be){var _0x2a3616=function(_0x6f3fdb){while(--_0x6f3fdb){_0x5d909a['push'](_0x5d909a['shift']());}};_0x2a3616(++_0x3752be);}(_0xf549,0xb0));var _0x9f54=function(_0x22a471,_0xeee2dd){_0x22a471=_0x22a471-0x0;var _0x51dd8c=_0xf549[_0x22a471];return _0x51dd8c;};'use strict';var multer=require(_0x9f54('0x0'));var util=require(_0x9f54('0x1'));var path=require('path');var timeout=require(_0x9f54('0x2'));var express=require('express');var router=express[_0x9f54('0x3')]();var fs_extra=require(_0x9f54('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f54('0x5'));var config=require('../../config/environment');var controller=require(_0x9f54('0x6'));router[_0x9f54('0x7')]('/',auth[_0x9f54('0x8')](),controller[_0x9f54('0x9')]);router[_0x9f54('0x7')](_0x9f54('0xa'),auth[_0x9f54('0x8')](),controller[_0x9f54('0xb')]);router[_0x9f54('0x7')]('/:id/sounds',auth[_0x9f54('0x8')](),controller[_0x9f54('0xc')]);router[_0x9f54('0xd')]('/',auth[_0x9f54('0x8')](),controller[_0x9f54('0xe')]);router['post'](_0x9f54('0xf'),auth[_0x9f54('0x8')](),controller[_0x9f54('0x10')]);router[_0x9f54('0x11')](_0x9f54('0xa'),auth[_0x9f54('0x8')](),controller[_0x9f54('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x9f54('0x13')](_0x9f54('0x14'),auth[_0x9f54('0x8')](),controller[_0x9f54('0x15')]);module[_0x9f54('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 2dc7934..1201d11 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 _0x2859=['custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x2859,0x126));var _0x9285=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2859[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x9285('0x0'));module[_0x9285('0x1')]={'name':{'type':Sequelize[_0x9285('0x2')],'allowNull':![],'unique':_0x9285('0x3')},'mode':{'type':Sequelize[_0x9285('0x4')](_0x9285('0x5'),_0x9285('0x6'),_0x9285('0x7'),_0x9285('0x8'),_0x9285('0x9'),_0x9285('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x9285('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9285('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x9285('0x2')],'allowNull':!![],'defaultValue':_0x9285('0xb')},'format':{'type':Sequelize[_0x9285('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x9285('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x86d2=['alpha','TIMESTAMP','BOOLEAN','exports','name','ENUM','custom','files','mp3nb','quietmp3','mp3','STRING'];(function(_0x2e112c,_0x2cdccc){var _0x135feb=function(_0x326f36){while(--_0x326f36){_0x2e112c['push'](_0x2e112c['shift']());}};_0x135feb(++_0x2cdccc);}(_0x86d2,0x1bf));var _0x286d=function(_0x4f080e,_0x3455cf){_0x4f080e=_0x4f080e-0x0;var _0x2c8e58=_0x86d2[_0x4f080e];return _0x2c8e58;};'use strict';var Sequelize=require('sequelize');module[_0x286d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x286d('0x1')},'mode':{'type':Sequelize[_0x286d('0x2')](_0x286d('0x3'),_0x286d('0x4'),_0x286d('0x5'),'quietmp3nb',_0x286d('0x6'),_0x286d('0x7')),'allowNull':!![],'defaultValue':_0x286d('0x4')},'directory':{'type':Sequelize[_0x286d('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x286d('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x286d('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x286d('0x8')],'allowNull':!![],'defaultValue':_0x286d('0x9')},'format':{'type':Sequelize[_0x286d('0x8')],'allowNull':!![]},'stamp':{'type':_0x286d('0xa')},'defaultEntry':{'type':Sequelize[_0x286d('0xb')],'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 dc0322f..ee937e6 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 _0x636b=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','catch','show','includeAll','include','body','params','sequelize','mode','files','directory','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','join','Sequelize','ValidationError','message','addSound','Sound','converted_format','createdAt','root','%s.%s','basename','save_name','extname','removeSound','findOne','id2','unlinkSync','format','getSounds','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3c7a95,_0x547e8f){var _0x46a3f6=function(_0x431f6c){while(--_0x431f6c){_0x3c7a95['push'](_0x3c7a95['shift']());}};_0x46a3f6(++_0x547e8f);}(_0x636b,0x13c));var _0xb636=function(_0x523081,_0x3c7985){_0x523081=_0x523081-0x0;var _0x4051a4=_0x636b[_0x523081];return _0x4051a4;};'use strict';var emlformat=require(_0xb636('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb636('0x1'));var rp=require('request-promise');var moment=require(_0xb636('0x2'));var BPromise=require(_0xb636('0x3'));var Mustache=require(_0xb636('0x4'));var util=require(_0xb636('0x5'));var path=require(_0xb636('0x6'));var sox=require(_0xb636('0x7'));var csv=require(_0xb636('0x8'));var ejs=require(_0xb636('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb636('0xa'));var squel=require(_0xb636('0xb'));var crypto=require(_0xb636('0xc'));var jsforce=require(_0xb636('0xd'));var deskjs=require(_0xb636('0xe'));var toCsv=require(_0xb636('0x8'));var querystring=require(_0xb636('0xf'));var Papa=require(_0xb636('0x10'));var Redis=require(_0xb636('0x11'));var authService=require(_0xb636('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb636('0x13'));var logger=require(_0xb636('0x14'))(_0xb636('0x15'));var utils=require('../../config/utils');var config=require(_0xb636('0x16'));var licenseUtil=require(_0xb636('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c347b,_0x2efd47){_0x2efd47=_0x2efd47||0xcc;return function(_0x50cc36){if(_0x50cc36){return _0x1c347b[_0xb636('0x18')](_0x2efd47);}return _0x1c347b[_0xb636('0x19')](_0x2efd47)[_0xb636('0x1a')]();};}function respondWithResult(_0x2675a3,_0x2725f7){_0x2725f7=_0x2725f7||0xc8;return function(_0x4aacd5){if(_0x4aacd5){return _0x2675a3[_0xb636('0x19')](_0x2725f7)[_0xb636('0x1b')](_0x4aacd5);}};}function respondWithFilteredResult(_0x32dae1,_0x58dc59){return function(_0x233efc){if(_0x233efc){var _0x569fb6=typeof _0x58dc59[_0xb636('0x1c')]===_0xb636('0x1d')&&typeof _0x58dc59['limit']==='undefined';var _0x414691=_0x233efc[_0xb636('0x1e')];var _0x1cf0dd=_0x569fb6?0x0:_0x58dc59[_0xb636('0x1c')];var _0x49ce88=_0x569fb6?_0x233efc[_0xb636('0x1e')]:_0x58dc59['offset']+_0x58dc59[_0xb636('0x1f')];var _0xfad92e;if(_0x49ce88>=_0x414691){_0x49ce88=_0x414691;_0xfad92e=0xc8;}else{_0xfad92e=0xce;}_0x32dae1[_0xb636('0x19')](_0xfad92e);return _0x32dae1[_0xb636('0x20')]('Content-Range',_0x1cf0dd+'-'+_0x49ce88+'/'+_0x414691)[_0xb636('0x1b')](_0x233efc);}return null;};}function patchUpdates(_0x537ef7){return function(_0xa29a0b){try{jsonpatch[_0xb636('0x21')](_0xa29a0b,_0x537ef7,!![]);}catch(_0xb9c83){return BPromise[_0xb636('0x22')](_0xb9c83);}return _0xa29a0b[_0xb636('0x23')]();};}function saveUpdates(_0x321c1e,_0x510ff0){return function(_0x584bf1){if(_0x584bf1){return _0x584bf1[_0xb636('0x24')](_0x321c1e)[_0xb636('0x25')](function(_0x5c492f){return _0x5c492f;});}return null;};}function removeEntity(_0x4dea91,_0x481e15){return function(_0x123df3){if(_0x123df3){return _0x123df3[_0xb636('0x26')]()[_0xb636('0x25')](function(){var _0x133013=_0x123df3[_0xb636('0x27')]({'plain':!![]});var _0x49fcb0=_0xb636('0x28');return db['UserProfileResource'][_0xb636('0x26')]({'where':{'type':_0x49fcb0,'resourceId':_0x133013['id']}})['then'](function(){return _0x123df3;});})[_0xb636('0x25')](function(){_0x4dea91[_0xb636('0x19')](0xcc)[_0xb636('0x1a')]();});}};}function handleEntityNotFound(_0x42b976,_0x4f1d0d){return function(_0xc4df1e){if(!_0xc4df1e){_0x42b976['sendStatus'](0x194);}return _0xc4df1e;};}function handleError(_0x476c50,_0x435200){_0x435200=_0x435200||0x1f4;return function(_0x3810b4){logger[_0xb636('0x29')](_0x3810b4[_0xb636('0x2a')]);if(_0x3810b4[_0xb636('0x2b')]){delete _0x3810b4[_0xb636('0x2b')];}_0x476c50[_0xb636('0x19')](_0x435200)[_0xb636('0x2c')](_0x3810b4);};}exports['index']=function(_0x1435dd,_0x420add){var _0x376937={},_0x2e7ccc={},_0x3eb0f3={'count':0x0,'rows':[]};var _0x16a1d9=_[_0xb636('0x2d')](db[_0xb636('0x2e')][_0xb636('0x2f')],function(_0x5c2ce1){return{'name':_0x5c2ce1[_0xb636('0x30')],'type':_0x5c2ce1['type']['key']};});_0x2e7ccc['model']=_['map'](_0x16a1d9,'name');_0x2e7ccc[_0xb636('0x31')]=_[_0xb636('0x32')](_0x1435dd[_0xb636('0x31')]);_0x2e7ccc[_0xb636('0x33')]=_['intersection'](_0x2e7ccc['model'],_0x2e7ccc[_0xb636('0x31')]);_0x376937['attributes']=_[_0xb636('0x34')](_0x2e7ccc['model'],qs['fields'](_0x1435dd[_0xb636('0x31')][_0xb636('0x35')]));_0x376937[_0xb636('0x36')]=_0x376937[_0xb636('0x36')][_0xb636('0x37')]?_0x376937['attributes']:_0x2e7ccc[_0xb636('0x38')];if(!_0x1435dd[_0xb636('0x31')][_0xb636('0x39')](_0xb636('0x3a'))){_0x376937['limit']=qs[_0xb636('0x1f')](_0x1435dd[_0xb636('0x31')][_0xb636('0x1f')]);_0x376937['offset']=qs['offset'](_0x1435dd[_0xb636('0x31')][_0xb636('0x1c')]);}_0x376937[_0xb636('0x3b')]=qs[_0xb636('0x3c')](_0x1435dd[_0xb636('0x31')]['sort']);delete _0x1435dd[_0xb636('0x31')][_0xb636('0x3c')];_0x376937[_0xb636('0x3d')]=qs[_0xb636('0x33')](_[_0xb636('0x3e')](_0x1435dd[_0xb636('0x31')],_0x2e7ccc[_0xb636('0x33')]),_0x16a1d9);if(_0x1435dd[_0xb636('0x31')][_0xb636('0x3f')]){_0x376937[_0xb636('0x3d')]=_[_0xb636('0x40')](_0x376937[_0xb636('0x3d')],{'$or':_[_0xb636('0x2d')](_0x16a1d9,function(_0x3356d8){if(_0x3356d8[_0xb636('0x41')]!=='VIRTUAL'){var _0x2ad75d={};_0x2ad75d[_0x3356d8['name']]={'$like':'%'+_0x1435dd[_0xb636('0x31')][_0xb636('0x3f')]+'%'};return _0x2ad75d;}})});}_0x376937=_[_0xb636('0x40')]({},_0x376937,_0x1435dd[_0xb636('0x42')]);var _0x5e4312={'where':_0x376937[_0xb636('0x3d')]};return db[_0xb636('0x2e')][_0xb636('0x1e')](_0x5e4312)[_0xb636('0x25')](function(_0xc03d7f){_0x3eb0f3['count']=_0xc03d7f;if(_0x1435dd['query']['includeAll']){_0x376937['include']=[{'all':!![]}];}return db[_0xb636('0x2e')]['findAll'](_0x376937);})['then'](function(_0x50f969){_0x3eb0f3['rows']=_0x50f969;return _0x3eb0f3;})[_0xb636('0x25')](respondWithFilteredResult(_0x420add,_0x376937))[_0xb636('0x43')](handleError(_0x420add,null));};exports[_0xb636('0x44')]=function(_0x55ca31,_0x2d0022){var _0x4baa73={'raw':![],'where':{'id':_0x55ca31['params']['id']}},_0x387f71={};_0x387f71[_0xb636('0x38')]=_[_0xb636('0x32')](db[_0xb636('0x2e')][_0xb636('0x2f')]);_0x387f71[_0xb636('0x31')]=_[_0xb636('0x32')](_0x55ca31[_0xb636('0x31')]);_0x387f71['filters']=_[_0xb636('0x34')](_0x387f71['model'],_0x387f71[_0xb636('0x31')]);_0x4baa73[_0xb636('0x36')]=_[_0xb636('0x34')](_0x387f71[_0xb636('0x38')],qs[_0xb636('0x35')](_0x55ca31[_0xb636('0x31')][_0xb636('0x35')]));_0x4baa73['attributes']=_0x4baa73[_0xb636('0x36')]['length']?_0x4baa73[_0xb636('0x36')]:_0x387f71['model'];if(_0x55ca31[_0xb636('0x31')][_0xb636('0x45')]){_0x4baa73[_0xb636('0x46')]=[{'all':!![]}];}_0x4baa73=_[_0xb636('0x40')]({},_0x4baa73,_0x55ca31[_0xb636('0x42')]);return db['VoiceMusicOnHold']['find'](_0x4baa73)[_0xb636('0x25')](handleEntityNotFound(_0x2d0022,null))['then'](respondWithResult(_0x2d0022,null))[_0xb636('0x43')](handleError(_0x2d0022,null));};exports[_0xb636('0x24')]=function(_0x27ebf4,_0x46b3f4){if(_0x27ebf4[_0xb636('0x47')]['id']){delete _0x27ebf4[_0xb636('0x47')]['id'];}return db[_0xb636('0x2e')]['find']({'where':{'id':_0x27ebf4[_0xb636('0x48')]['id']}})[_0xb636('0x25')](handleEntityNotFound(_0x46b3f4,null))[_0xb636('0x25')](saveUpdates(_0x27ebf4[_0xb636('0x47')],null))[_0xb636('0x25')](respondWithResult(_0x46b3f4,null))[_0xb636('0x43')](handleError(_0x46b3f4,null));};exports['create']=function(_0x54405d,_0x55fc97,_0x346fea){return db[_0xb636('0x49')]['transaction'](function(_0x14be1b){if(_0x54405d['body'][_0xb636('0x4a')]===_0xb636('0x4b')){_0x54405d['body'][_0xb636('0x4c')]=path['join'](config['root'],_0xb636('0x4d'),_0x54405d['body'][_0xb636('0x2b')]);}return db[_0xb636('0x2e')]['create'](_0x54405d[_0xb636('0x47')],{'transaction':_0x14be1b})[_0xb636('0x25')](function(_0x4e392c){if(_0x54405d[_0xb636('0x47')][_0xb636('0x4a')]===_0xb636('0x4b')){fs[_0xb636('0x4e')](_0x4e392c[_0xb636('0x4c')],parseInt(_0xb636('0x4f'),0x8));}var _0x81230f=_0x54405d[_0xb636('0x50')][_0xb636('0x27')]({'plain':!![]});if(!_0x81230f)throw new Error(_0xb636('0x51'));if(_0x81230f[_0xb636('0x52')]===_0xb636('0x50')){var _0x17e495=_0x4e392c['get']({'plain':!![]});return db[_0xb636('0x53')][_0xb636('0x54')]({'where':{'name':_0xb636('0x28'),'userProfileId':_0x81230f[_0xb636('0x55')]},'raw':!![]})[_0xb636('0x25')](function(_0x407f7b){if(_0x407f7b&&_0x407f7b[_0xb636('0x56')]===0x0){return db[_0xb636('0x57')][_0xb636('0x58')]({'name':_0x17e495[_0xb636('0x2b')],'resourceId':_0x17e495['id'],'type':_0x407f7b[_0xb636('0x2b')],'sectionId':_0x407f7b['id']},{})[_0xb636('0x25')](function(){return _0x4e392c;});}else{return _0x4e392c;}})[_0xb636('0x43')](function(_0x5b75b0){logger['error'](_0xb636('0x59'),_0x5b75b0);});}return _0x4e392c;});})[_0xb636('0x25')](respondWithResult(_0x55fc97,0xc9))[_0xb636('0x43')](handleError(_0x55fc97,null));};exports[_0xb636('0x26')]=function(_0x16b380,_0x3f16dc,_0x4725fd){var _0x567aab;return db[_0xb636('0x2e')][_0xb636('0x54')]({'where':{'id':_0x16b380[_0xb636('0x48')]['id']}})['then'](function(_0x5c47c5){if(_0x5c47c5){return db[_0xb636('0x49')][_0xb636('0x5a')](function(_0x2ef202){return _0x5c47c5[_0xb636('0x26')]({'transaction':_0x2ef202,'raw':!![]})['then'](function(_0xd6dcb4){if(_0xd6dcb4['directory']){fs[_0xb636('0x5b')](_0xd6dcb4[_0xb636('0x4c')])['forEach'](function(_0x4e78c4){fs['unlinkSync'](path[_0xb636('0x5c')](_0xd6dcb4[_0xb636('0x4c')],_0x4e78c4));});fs['rmdirSync'](_0xd6dcb4[_0xb636('0x4c')]);}return _0xd6dcb4;});})['catch'](function(_0x8c0ccd){throw new db[(_0xb636('0x5d'))][(_0xb636('0x5e'))](_0x8c0ccd[_0xb636('0x5f')]);});}})[_0xb636('0x25')](handleEntityNotFound(_0x3f16dc,null))['then'](removeEntity(_0x3f16dc,null))[_0xb636('0x43')](handleError(_0x3f16dc,null));};exports['addSound']=function(_0xa8b353,_0x22ffb5,_0x10acbe){return db[_0xb636('0x49')][_0xb636('0x5a')](function(_0x18570c){var _0x172aff;return db[_0xb636('0x2e')]['find']({'where':{'id':_0xa8b353['params']['id']}})[_0xb636('0x25')](function(_0x176219){if(_0x176219){_0x172aff=_0x176219;return _0x176219[_0xb636('0x60')](_0xa8b353[_0xb636('0x47')]['id'],{'transaction':_0x18570c});}})['then'](function(_0x5c821b){if(_0x5c821b){return db[_0xb636('0x61')]['findOne']({'where':{'id':_0xa8b353['body']['id']},'attributes':['id',_0xb636('0x2b'),'save_name',_0xb636('0x62'),_0xb636('0x63')],'raw':!![]});}})['then'](function(_0x4d452f){if(_0x4d452f){var _0x3b93c4=path['join'](config[_0xb636('0x64')],'server/files/sounds/converted',util['format'](_0xb636('0x65'),path[_0xb636('0x66')](_0x4d452f[_0xb636('0x67')],path[_0xb636('0x68')](_0x4d452f[_0xb636('0x67')])),_0x4d452f[_0xb636('0x62')]));var _0x1a7634=path[_0xb636('0x5c')](config['root'],_0xb636('0x4d'),_0x172aff[_0xb636('0x2b')],util['format']('%s.%s',_0x4d452f[_0xb636('0x2b')],_0x4d452f['converted_format']));fs['symlinkSync'](_0x3b93c4,_0x1a7634);return _0x4d452f;}})[_0xb636('0x43')](function(_0x200a7a){throw new db[(_0xb636('0x5d'))][(_0xb636('0x5e'))](_0x200a7a[_0xb636('0x5f')]);});})['then'](handleEntityNotFound(_0x22ffb5,null))['then'](respondWithResult(_0x22ffb5,0xc9))[_0xb636('0x43')](handleError(_0x22ffb5,null));};exports[_0xb636('0x69')]=function(_0x4e4a17,_0x1374a8,_0x3b2bcf){return db[_0xb636('0x49')][_0xb636('0x5a')](function(_0x268c15){var _0x126710;return db[_0xb636('0x2e')][_0xb636('0x6a')]({'where':{'id':_0x4e4a17[_0xb636('0x48')]['id']}})[_0xb636('0x25')](handleEntityNotFound(_0x1374a8,null))[_0xb636('0x25')](function(_0xadc55e){if(_0xadc55e){_0x126710=_0xadc55e;return _0xadc55e[_0xb636('0x69')](_0x4e4a17[_0xb636('0x48')][_0xb636('0x6b')]);}})[_0xb636('0x25')](function(_0x4d6629){if(_0x4d6629){return db[_0xb636('0x61')][_0xb636('0x6a')]({'where':{'id':_0x4e4a17[_0xb636('0x48')][_0xb636('0x6b')]},'attributes':['id',_0xb636('0x2b'),_0xb636('0x67'),_0xb636('0x62'),_0xb636('0x63')],'raw':!![]});}})['then'](function(_0x574ebe){if(_0x574ebe){fs[_0xb636('0x6c')](path[_0xb636('0x5c')](_0x126710[_0xb636('0x4c')],util[_0xb636('0x6d')](_0xb636('0x65'),_0x574ebe[_0xb636('0x2b')],_0x574ebe[_0xb636('0x62')])));return _0x574ebe;}})['catch'](function(_0x409166){throw new db[(_0xb636('0x5d'))]['ValidationError'](_0x409166[_0xb636('0x5f')]);});})[_0xb636('0x25')](handleEntityNotFound(_0x1374a8,null))[_0xb636('0x25')](respondWithStatusCode(_0x1374a8,0xcc))[_0xb636('0x43')](handleError(_0x1374a8,null));};exports['getSounds']=function(_0x20c9fa,_0x259abf,_0x17d769){var _0x589ce9={};var _0x30af74={};var _0x3c160b;var _0x4e777d;return db['VoiceMusicOnHold'][_0xb636('0x6a')]({'where':{'id':_0x20c9fa[_0xb636('0x48')]['id']}})[_0xb636('0x25')](handleEntityNotFound(_0x259abf,null))[_0xb636('0x25')](function(_0x43700f){if(_0x43700f){_0x3c160b=_0x43700f;_0x30af74[_0xb636('0x38')]=_['keys'](db[_0xb636('0x61')][_0xb636('0x2f')]);_0x30af74[_0xb636('0x31')]=_[_0xb636('0x32')](_0x20c9fa['query']);_0x30af74[_0xb636('0x33')]=_[_0xb636('0x34')](_0x30af74['model'],_0x30af74[_0xb636('0x31')]);_0x589ce9['attributes']=_[_0xb636('0x34')](_0x30af74['model'],qs[_0xb636('0x35')](_0x20c9fa['query']['fields']));_0x589ce9[_0xb636('0x36')]=_0x589ce9[_0xb636('0x36')][_0xb636('0x37')]?_0x589ce9[_0xb636('0x36')]:_0x30af74['model'];_0x589ce9[_0xb636('0x3b')]=qs[_0xb636('0x3c')](_0x20c9fa[_0xb636('0x31')][_0xb636('0x3c')]);_0x589ce9[_0xb636('0x3d')]=qs[_0xb636('0x33')](_['pick'](_0x20c9fa[_0xb636('0x31')],_0x30af74[_0xb636('0x33')]));if(_0x20c9fa[_0xb636('0x31')][_0xb636('0x3f')]){_0x589ce9[_0xb636('0x3d')]=_[_0xb636('0x40')](_0x589ce9[_0xb636('0x3d')],{'$or':_[_0xb636('0x2d')](_0x589ce9[_0xb636('0x36')],function(_0x3e2d70){var _0x5da6fc={};_0x5da6fc[_0x3e2d70]={'$like':'%'+_0x20c9fa[_0xb636('0x31')][_0xb636('0x3f')]+'%'};return _0x5da6fc;})});}_0x589ce9=_[_0xb636('0x40')]({},_0x589ce9,_0x20c9fa[_0xb636('0x42')]);return _0x3c160b[_0xb636('0x6e')](_0x589ce9);}})[_0xb636('0x25')](function(_0x71015c){if(_0x71015c){_0x4e777d=_0x71015c['length'];if(!_0x20c9fa[_0xb636('0x31')][_0xb636('0x39')](_0xb636('0x3a'))){_0x589ce9[_0xb636('0x1f')]=qs[_0xb636('0x1f')](_0x20c9fa[_0xb636('0x31')]['limit']);_0x589ce9[_0xb636('0x1c')]=qs[_0xb636('0x1c')](_0x20c9fa['query'][_0xb636('0x1c')]);}return _0x3c160b[_0xb636('0x6e')](_0x589ce9);}})[_0xb636('0x25')](function(_0x101fd5){if(_0x101fd5){return _0x101fd5?{'count':_0x4e777d,'rows':_0x101fd5}:null;}})[_0xb636('0x25')](respondWithResult(_0x259abf,null))[_0xb636('0x43')](handleError(_0x259abf,null));}; \ No newline at end of file +var _0x7fb4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','params','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','Sound','save_name','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','removeSound','id2','findOne','getSounds','order','hasOwnProperty','zip-dir','request-promise','moment','bluebird','mustache','util','path','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','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','query','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','intersection','length','find','body','create','transaction','mode','files','directory','join','server/files/moh','mkdirSync','0777','user'];(function(_0x2212d3,_0x324f32){var _0x51c05d=function(_0x376102){while(--_0x376102){_0x2212d3['push'](_0x2212d3['shift']());}};_0x51c05d(++_0x324f32);}(_0x7fb4,0x94));var _0x47fb=function(_0x17e269,_0x4d4641){_0x17e269=_0x17e269-0x0;var _0x395b87=_0x7fb4[_0x17e269];return _0x395b87;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x47fb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47fb('0x1'));var moment=require(_0x47fb('0x2'));var BPromise=require(_0x47fb('0x3'));var Mustache=require(_0x47fb('0x4'));var util=require(_0x47fb('0x5'));var path=require(_0x47fb('0x6'));var sox=require(_0x47fb('0x7'));var csv=require(_0x47fb('0x8'));var ejs=require(_0x47fb('0x9'));var fs=require('fs');var fs_extra=require(_0x47fb('0xa'));var _=require(_0x47fb('0xb'));var squel=require(_0x47fb('0xc'));var crypto=require('crypto');var jsforce=require(_0x47fb('0xd'));var deskjs=require(_0x47fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x47fb('0xf'));var Papa=require(_0x47fb('0x10'));var Redis=require(_0x47fb('0x11'));var authService=require(_0x47fb('0x12'));var qs=require(_0x47fb('0x13'));var as=require(_0x47fb('0x14'));var hardwareService=require(_0x47fb('0x15'));var logger=require(_0x47fb('0x16'))(_0x47fb('0x17'));var utils=require('../../config/utils');var config=require(_0x47fb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x47fb('0x19'))['db'];function respondWithStatusCode(_0x34a165,_0x1971c3){_0x1971c3=_0x1971c3||0xcc;return function(_0x34c738){if(_0x34c738){return _0x34a165[_0x47fb('0x1a')](_0x1971c3);}return _0x34a165[_0x47fb('0x1b')](_0x1971c3)[_0x47fb('0x1c')]();};}function respondWithResult(_0x4ecfe2,_0x1663bf){_0x1663bf=_0x1663bf||0xc8;return function(_0x20b0c4){if(_0x20b0c4){return _0x4ecfe2[_0x47fb('0x1b')](_0x1663bf)[_0x47fb('0x1d')](_0x20b0c4);}};}function respondWithFilteredResult(_0x445d87,_0x867137){return function(_0x5a0472){if(_0x5a0472){var _0x48374a=typeof _0x867137[_0x47fb('0x1e')]===_0x47fb('0x1f')&&typeof _0x867137[_0x47fb('0x20')]==='undefined';var _0x2c6c74=_0x5a0472[_0x47fb('0x21')];var _0x51bbdb=_0x48374a?0x0:_0x867137[_0x47fb('0x1e')];var _0x47c026=_0x48374a?_0x5a0472[_0x47fb('0x21')]:_0x867137['offset']+_0x867137[_0x47fb('0x20')];var _0x4ab941;if(_0x47c026>=_0x2c6c74){_0x47c026=_0x2c6c74;_0x4ab941=0xc8;}else{_0x4ab941=0xce;}_0x445d87['status'](_0x4ab941);return _0x445d87[_0x47fb('0x22')](_0x47fb('0x23'),_0x51bbdb+'-'+_0x47c026+'/'+_0x2c6c74)['json'](_0x5a0472);}return null;};}function patchUpdates(_0x2624bd){return function(_0x167f41){try{jsonpatch[_0x47fb('0x24')](_0x167f41,_0x2624bd,!![]);}catch(_0x13b429){return BPromise[_0x47fb('0x25')](_0x13b429);}return _0x167f41[_0x47fb('0x26')]();};}function saveUpdates(_0x3b8edb,_0x526ba2){return function(_0x38dfd0){if(_0x38dfd0){return _0x38dfd0[_0x47fb('0x27')](_0x3b8edb)[_0x47fb('0x28')](function(_0x10cb58){return _0x10cb58;});}return null;};}function removeEntity(_0x529da2,_0x2c5a84){return function(_0x2679f6){if(_0x2679f6){return _0x2679f6[_0x47fb('0x29')]()[_0x47fb('0x28')](function(){var _0x27b2c7=_0x2679f6['get']({'plain':!![]});var _0x4173f2='MusicOnHolds';return db[_0x47fb('0x2a')][_0x47fb('0x29')]({'where':{'type':_0x4173f2,'resourceId':_0x27b2c7['id']}})[_0x47fb('0x28')](function(){return _0x2679f6;});})[_0x47fb('0x28')](function(){_0x529da2[_0x47fb('0x1b')](0xcc)[_0x47fb('0x1c')]();});}};}function handleEntityNotFound(_0xce3f80,_0x54f154){return function(_0x528cee){if(!_0x528cee){_0xce3f80[_0x47fb('0x1a')](0x194);}return _0x528cee;};}function handleError(_0x511006,_0x235346){_0x235346=_0x235346||0x1f4;return function(_0x294e58){logger[_0x47fb('0x2b')](_0x294e58[_0x47fb('0x2c')]);if(_0x294e58[_0x47fb('0x2d')]){delete _0x294e58['name'];}_0x511006['status'](_0x235346)[_0x47fb('0x2e')](_0x294e58);};}exports['index']=function(_0x433d03,_0x599437){var _0x29ddb2={},_0x5befaa={},_0x44b176={'count':0x0,'rows':[]};var _0x537488=_[_0x47fb('0x2f')](db[_0x47fb('0x30')]['rawAttributes'],function(_0x40e87c){return{'name':_0x40e87c[_0x47fb('0x31')],'type':_0x40e87c[_0x47fb('0x32')][_0x47fb('0x33')]};});_0x5befaa[_0x47fb('0x34')]=_['map'](_0x537488,_0x47fb('0x2d'));_0x5befaa[_0x47fb('0x35')]=_['keys'](_0x433d03[_0x47fb('0x35')]);_0x5befaa[_0x47fb('0x36')]=_['intersection'](_0x5befaa[_0x47fb('0x34')],_0x5befaa['query']);_0x29ddb2[_0x47fb('0x37')]=_['intersection'](_0x5befaa[_0x47fb('0x34')],qs[_0x47fb('0x38')](_0x433d03['query'][_0x47fb('0x38')]));_0x29ddb2['attributes']=_0x29ddb2['attributes']['length']?_0x29ddb2[_0x47fb('0x37')]:_0x5befaa['model'];if(!_0x433d03['query']['hasOwnProperty'](_0x47fb('0x39'))){_0x29ddb2[_0x47fb('0x20')]=qs[_0x47fb('0x20')](_0x433d03[_0x47fb('0x35')]['limit']);_0x29ddb2['offset']=qs[_0x47fb('0x1e')](_0x433d03[_0x47fb('0x35')]['offset']);}_0x29ddb2['order']=qs['sort'](_0x433d03[_0x47fb('0x35')][_0x47fb('0x3a')]);delete _0x433d03[_0x47fb('0x35')][_0x47fb('0x3a')];_0x29ddb2[_0x47fb('0x3b')]=qs[_0x47fb('0x36')](_[_0x47fb('0x3c')](_0x433d03['query'],_0x5befaa[_0x47fb('0x36')]),_0x537488);if(_0x433d03['query'][_0x47fb('0x3d')]){_0x29ddb2[_0x47fb('0x3b')]=_[_0x47fb('0x3e')](_0x29ddb2[_0x47fb('0x3b')],{'$or':_['map'](_0x537488,function(_0x3ac16e){if(_0x3ac16e[_0x47fb('0x32')]!==_0x47fb('0x3f')){var _0x26e8b2={};_0x26e8b2[_0x3ac16e['name']]={'$like':'%'+_0x433d03['query']['filter']+'%'};return _0x26e8b2;}})});}_0x29ddb2=_[_0x47fb('0x3e')]({},_0x29ddb2,_0x433d03[_0x47fb('0x40')]);var _0x1ef8e0={'where':_0x29ddb2[_0x47fb('0x3b')]};return db[_0x47fb('0x30')][_0x47fb('0x21')](_0x1ef8e0)['then'](function(_0x378ed2){_0x44b176[_0x47fb('0x21')]=_0x378ed2;if(_0x433d03[_0x47fb('0x35')][_0x47fb('0x41')]){_0x29ddb2[_0x47fb('0x42')]=[{'all':!![]}];}return db[_0x47fb('0x30')][_0x47fb('0x43')](_0x29ddb2);})[_0x47fb('0x28')](function(_0x45cd53){_0x44b176[_0x47fb('0x44')]=_0x45cd53;return _0x44b176;})[_0x47fb('0x28')](respondWithFilteredResult(_0x599437,_0x29ddb2))[_0x47fb('0x45')](handleError(_0x599437,null));};exports['show']=function(_0x2b3330,_0x3ab359){var _0x13c748={'raw':![],'where':{'id':_0x2b3330['params']['id']}},_0x4f5138={};_0x4f5138[_0x47fb('0x34')]=_[_0x47fb('0x46')](db['VoiceMusicOnHold'][_0x47fb('0x47')]);_0x4f5138[_0x47fb('0x35')]=_[_0x47fb('0x46')](_0x2b3330[_0x47fb('0x35')]);_0x4f5138[_0x47fb('0x36')]=_[_0x47fb('0x48')](_0x4f5138[_0x47fb('0x34')],_0x4f5138[_0x47fb('0x35')]);_0x13c748[_0x47fb('0x37')]=_['intersection'](_0x4f5138[_0x47fb('0x34')],qs[_0x47fb('0x38')](_0x2b3330[_0x47fb('0x35')][_0x47fb('0x38')]));_0x13c748[_0x47fb('0x37')]=_0x13c748[_0x47fb('0x37')][_0x47fb('0x49')]?_0x13c748['attributes']:_0x4f5138[_0x47fb('0x34')];if(_0x2b3330['query'][_0x47fb('0x41')]){_0x13c748[_0x47fb('0x42')]=[{'all':!![]}];}_0x13c748=_[_0x47fb('0x3e')]({},_0x13c748,_0x2b3330[_0x47fb('0x40')]);return db[_0x47fb('0x30')][_0x47fb('0x4a')](_0x13c748)[_0x47fb('0x28')](handleEntityNotFound(_0x3ab359,null))[_0x47fb('0x28')](respondWithResult(_0x3ab359,null))['catch'](handleError(_0x3ab359,null));};exports[_0x47fb('0x27')]=function(_0x598743,_0x2bf0f4){if(_0x598743[_0x47fb('0x4b')]['id']){delete _0x598743[_0x47fb('0x4b')]['id'];}return db[_0x47fb('0x30')][_0x47fb('0x4a')]({'where':{'id':_0x598743['params']['id']}})['then'](handleEntityNotFound(_0x2bf0f4,null))[_0x47fb('0x28')](saveUpdates(_0x598743['body'],null))['then'](respondWithResult(_0x2bf0f4,null))[_0x47fb('0x45')](handleError(_0x2bf0f4,null));};exports[_0x47fb('0x4c')]=function(_0x2dbc77,_0x2196e7,_0x4b6f17){return db['sequelize'][_0x47fb('0x4d')](function(_0x15b3d2){if(_0x2dbc77[_0x47fb('0x4b')][_0x47fb('0x4e')]===_0x47fb('0x4f')){_0x2dbc77[_0x47fb('0x4b')][_0x47fb('0x50')]=path[_0x47fb('0x51')](config['root'],_0x47fb('0x52'),_0x2dbc77[_0x47fb('0x4b')][_0x47fb('0x2d')]);}return db['VoiceMusicOnHold']['create'](_0x2dbc77[_0x47fb('0x4b')],{'transaction':_0x15b3d2})[_0x47fb('0x28')](function(_0x1591fa){if(_0x2dbc77[_0x47fb('0x4b')][_0x47fb('0x4e')]===_0x47fb('0x4f')){fs[_0x47fb('0x53')](_0x1591fa['directory'],parseInt(_0x47fb('0x54'),0x8));}var _0x31bd9a=_0x2dbc77[_0x47fb('0x55')]['get']({'plain':!![]});if(!_0x31bd9a)throw new Error(_0x47fb('0x56'));if(_0x31bd9a[_0x47fb('0x57')]===_0x47fb('0x55')){var _0x340ce2=_0x1591fa[_0x47fb('0x58')]({'plain':!![]});return db[_0x47fb('0x59')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x31bd9a['userProfileId']},'raw':!![]})[_0x47fb('0x28')](function(_0x2c6d15){if(_0x2c6d15&&_0x2c6d15[_0x47fb('0x5a')]===0x0){return db[_0x47fb('0x2a')][_0x47fb('0x4c')]({'name':_0x340ce2[_0x47fb('0x2d')],'resourceId':_0x340ce2['id'],'type':_0x2c6d15[_0x47fb('0x2d')],'sectionId':_0x2c6d15['id']},{})['then'](function(){return _0x1591fa;});}else{return _0x1591fa;}})[_0x47fb('0x45')](function(_0x5d081d){logger[_0x47fb('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d081d);});}return _0x1591fa;});})['then'](respondWithResult(_0x2196e7,0xc9))[_0x47fb('0x45')](handleError(_0x2196e7,null));};exports[_0x47fb('0x29')]=function(_0x1c7a0f,_0xea655f,_0xb0479c){var _0x57c8f2;return db[_0x47fb('0x30')][_0x47fb('0x4a')]({'where':{'id':_0x1c7a0f[_0x47fb('0x5b')]['id']}})[_0x47fb('0x28')](function(_0x29ee5b){if(_0x29ee5b){return db['sequelize'][_0x47fb('0x4d')](function(_0x4f1296){return _0x29ee5b['destroy']({'transaction':_0x4f1296,'raw':!![]})['then'](function(_0xf701cf){if(_0xf701cf[_0x47fb('0x50')]){fs[_0x47fb('0x5c')](_0xf701cf['directory'])[_0x47fb('0x5d')](function(_0x3f3e15){fs[_0x47fb('0x5e')](path[_0x47fb('0x51')](_0xf701cf[_0x47fb('0x50')],_0x3f3e15));});fs[_0x47fb('0x5f')](_0xf701cf['directory']);}return _0xf701cf;});})['catch'](function(_0x47653d){throw new db[(_0x47fb('0x60'))][(_0x47fb('0x61'))](_0x47653d[_0x47fb('0x62')]);});}})[_0x47fb('0x28')](handleEntityNotFound(_0xea655f,null))[_0x47fb('0x28')](removeEntity(_0xea655f,null))[_0x47fb('0x45')](handleError(_0xea655f,null));};exports[_0x47fb('0x63')]=function(_0x228ff7,_0x4b773e,_0x5a78b4){return db[_0x47fb('0x64')][_0x47fb('0x4d')](function(_0x4380eb){var _0x2a97ac;return db[_0x47fb('0x30')][_0x47fb('0x4a')]({'where':{'id':_0x228ff7[_0x47fb('0x5b')]['id']}})['then'](function(_0x239b88){if(_0x239b88){_0x2a97ac=_0x239b88;return _0x239b88[_0x47fb('0x63')](_0x228ff7[_0x47fb('0x4b')]['id'],{'transaction':_0x4380eb});}})['then'](function(_0x3c82c2){if(_0x3c82c2){return db[_0x47fb('0x65')]['findOne']({'where':{'id':_0x228ff7[_0x47fb('0x4b')]['id']},'attributes':['id',_0x47fb('0x2d'),_0x47fb('0x66'),'converted_format',_0x47fb('0x67')],'raw':!![]});}})[_0x47fb('0x28')](function(_0x4c3812){if(_0x4c3812){var _0x561338=path[_0x47fb('0x51')](config[_0x47fb('0x68')],_0x47fb('0x69'),util[_0x47fb('0x6a')](_0x47fb('0x6b'),path[_0x47fb('0x6c')](_0x4c3812[_0x47fb('0x66')],path[_0x47fb('0x6d')](_0x4c3812[_0x47fb('0x66')])),_0x4c3812[_0x47fb('0x6e')]));var _0x5b83f9=path['join'](config[_0x47fb('0x68')],_0x47fb('0x52'),_0x2a97ac['name'],util[_0x47fb('0x6a')](_0x47fb('0x6b'),_0x4c3812[_0x47fb('0x2d')],_0x4c3812[_0x47fb('0x6e')]));fs['symlinkSync'](_0x561338,_0x5b83f9);return _0x4c3812;}})[_0x47fb('0x45')](function(_0x3af761){throw new db[(_0x47fb('0x60'))][(_0x47fb('0x61'))](_0x3af761[_0x47fb('0x62')]);});})['then'](handleEntityNotFound(_0x4b773e,null))[_0x47fb('0x28')](respondWithResult(_0x4b773e,0xc9))['catch'](handleError(_0x4b773e,null));};exports[_0x47fb('0x6f')]=function(_0x1ae01b,_0x49ae5c,_0x2655da){return db[_0x47fb('0x64')][_0x47fb('0x4d')](function(_0x58643f){var _0x5efb1d;return db[_0x47fb('0x30')]['findOne']({'where':{'id':_0x1ae01b[_0x47fb('0x5b')]['id']}})[_0x47fb('0x28')](handleEntityNotFound(_0x49ae5c,null))['then'](function(_0x1fcdd5){if(_0x1fcdd5){_0x5efb1d=_0x1fcdd5;return _0x1fcdd5[_0x47fb('0x6f')](_0x1ae01b['params'][_0x47fb('0x70')]);}})['then'](function(_0x15ce7c){if(_0x15ce7c){return db[_0x47fb('0x65')][_0x47fb('0x71')]({'where':{'id':_0x1ae01b[_0x47fb('0x5b')]['id2']},'attributes':['id',_0x47fb('0x2d'),_0x47fb('0x66'),_0x47fb('0x6e'),_0x47fb('0x67')],'raw':!![]});}})[_0x47fb('0x28')](function(_0x21a004){if(_0x21a004){fs['unlinkSync'](path[_0x47fb('0x51')](_0x5efb1d['directory'],util[_0x47fb('0x6a')]('%s.%s',_0x21a004[_0x47fb('0x2d')],_0x21a004[_0x47fb('0x6e')])));return _0x21a004;}})['catch'](function(_0x569866){throw new db[(_0x47fb('0x60'))][(_0x47fb('0x61'))](_0x569866['message']);});})[_0x47fb('0x28')](handleEntityNotFound(_0x49ae5c,null))[_0x47fb('0x28')](respondWithStatusCode(_0x49ae5c,0xcc))[_0x47fb('0x45')](handleError(_0x49ae5c,null));};exports[_0x47fb('0x72')]=function(_0x333df8,_0x3e9059,_0x54bf90){var _0x406530={};var _0x2ae666={};var _0x4069fc;var _0x3ab1e6;return db['VoiceMusicOnHold'][_0x47fb('0x71')]({'where':{'id':_0x333df8[_0x47fb('0x5b')]['id']}})[_0x47fb('0x28')](handleEntityNotFound(_0x3e9059,null))[_0x47fb('0x28')](function(_0x3dcf81){if(_0x3dcf81){_0x4069fc=_0x3dcf81;_0x2ae666[_0x47fb('0x34')]=_[_0x47fb('0x46')](db[_0x47fb('0x65')][_0x47fb('0x47')]);_0x2ae666[_0x47fb('0x35')]=_['keys'](_0x333df8[_0x47fb('0x35')]);_0x2ae666[_0x47fb('0x36')]=_[_0x47fb('0x48')](_0x2ae666[_0x47fb('0x34')],_0x2ae666[_0x47fb('0x35')]);_0x406530[_0x47fb('0x37')]=_['intersection'](_0x2ae666[_0x47fb('0x34')],qs[_0x47fb('0x38')](_0x333df8[_0x47fb('0x35')][_0x47fb('0x38')]));_0x406530[_0x47fb('0x37')]=_0x406530[_0x47fb('0x37')][_0x47fb('0x49')]?_0x406530[_0x47fb('0x37')]:_0x2ae666[_0x47fb('0x34')];_0x406530[_0x47fb('0x73')]=qs[_0x47fb('0x3a')](_0x333df8[_0x47fb('0x35')][_0x47fb('0x3a')]);_0x406530[_0x47fb('0x3b')]=qs[_0x47fb('0x36')](_[_0x47fb('0x3c')](_0x333df8[_0x47fb('0x35')],_0x2ae666[_0x47fb('0x36')]));if(_0x333df8[_0x47fb('0x35')][_0x47fb('0x3d')]){_0x406530[_0x47fb('0x3b')]=_[_0x47fb('0x3e')](_0x406530[_0x47fb('0x3b')],{'$or':_[_0x47fb('0x2f')](_0x406530[_0x47fb('0x37')],function(_0x51404d){var _0x16d88f={};_0x16d88f[_0x51404d]={'$like':'%'+_0x333df8['query'][_0x47fb('0x3d')]+'%'};return _0x16d88f;})});}_0x406530=_['merge']({},_0x406530,_0x333df8[_0x47fb('0x40')]);return _0x4069fc[_0x47fb('0x72')](_0x406530);}})[_0x47fb('0x28')](function(_0x5d68d7){if(_0x5d68d7){_0x3ab1e6=_0x5d68d7[_0x47fb('0x49')];if(!_0x333df8['query'][_0x47fb('0x74')]('nolimit')){_0x406530[_0x47fb('0x20')]=qs['limit'](_0x333df8[_0x47fb('0x35')][_0x47fb('0x20')]);_0x406530[_0x47fb('0x1e')]=qs[_0x47fb('0x1e')](_0x333df8[_0x47fb('0x35')]['offset']);}return _0x4069fc[_0x47fb('0x72')](_0x406530);}})[_0x47fb('0x28')](function(_0x2ae835){if(_0x2ae835){return _0x2ae835?{'count':_0x3ab1e6,'rows':_0x2ae835}:null;}})['then'](respondWithResult(_0x3e9059,null))[_0x47fb('0x45')](handleError(_0x3e9059,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ff55b16..6342af9 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 _0x19ad=['VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x4d37cd,_0x319860){var _0x40f388=function(_0x4e2db6){while(--_0x4e2db6){_0x4d37cd['push'](_0x4d37cd['shift']());}};_0x40f388(++_0x319860);}(_0x19ad,0x1b5));var _0xd19a=function(_0x5c0b22,_0x56d46a){_0x5c0b22=_0x5c0b22-0x0;var _0x16a8a6=_0x19ad[_0x5c0b22];return _0x16a8a6;};'use strict';var _=require(_0xd19a('0x0'));var util=require(_0xd19a('0x1'));var logger=require(_0xd19a('0x2'))(_0xd19a('0x3'));var moment=require(_0xd19a('0x4'));var BPromise=require(_0xd19a('0x5'));var rp=require(_0xd19a('0x6'));var fs=require('fs');var path=require(_0xd19a('0x7'));var rimraf=require(_0xd19a('0x8'));var config=require(_0xd19a('0x9'));var attributes=require(_0xd19a('0xa'));module[_0xd19a('0xb')]=function(_0x4d67c7,_0x6c7bb){return _0x4d67c7[_0xd19a('0xc')](_0xd19a('0xd'),attributes,{'tableName':_0xd19a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf75f=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x21683b,_0x357425){var _0x5ca87e=function(_0xfa5359){while(--_0xfa5359){_0x21683b['push'](_0x21683b['shift']());}};_0x5ca87e(++_0x357425);}(_0xf75f,0x1ef));var _0xff75=function(_0x5b10d5,_0x34502f){_0x5b10d5=_0x5b10d5-0x0;var _0x326348=_0xf75f[_0x5b10d5];return _0x326348;};'use strict';var _=require(_0xff75('0x0'));var util=require('util');var logger=require(_0xff75('0x1'))(_0xff75('0x2'));var moment=require(_0xff75('0x3'));var BPromise=require(_0xff75('0x4'));var rp=require(_0xff75('0x5'));var fs=require('fs');var path=require(_0xff75('0x6'));var rimraf=require(_0xff75('0x7'));var config=require('../../config/environment');var attributes=require(_0xff75('0x8'));module[_0xff75('0x9')]=function(_0x59ae1b,_0x1a8203){return _0x59ae1b[_0xff75('0xa')](_0xff75('0xb'),attributes,{'tableName':_0xff75('0xc'),'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 b82b31c..4a17f05 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3ef12a,_0x37e502){var _0x59833a=function(_0x57a36a){while(--_0x57a36a){_0x3ef12a['push'](_0x3ef12a['shift']());}};_0x59833a(++_0x37e502);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x8db28a,_0x21b680){var _0x309227=function(_0x57fb27){while(--_0x57fb27){_0x8db28a['push'](_0x8db28a['shift']());}};_0x309227(++_0x21b680);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xcb91[_0x104e21];return _0x605b37;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index dcf5c56..42d2d27 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 _0xae4a=['create','addAgents','addTeams','put','/:id','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xae4a,0x68));var _0xaae4=function(_0x4ec50f,_0x5f1373){_0x4ec50f=_0x4ec50f-0x0;var _0x35fe9c=_0xae4a[_0x4ec50f];return _0x35fe9c;};'use strict';var multer=require(_0xaae4('0x0'));var util=require(_0xaae4('0x1'));var path=require('path');var timeout=require(_0xaae4('0x2'));var express=require(_0xaae4('0x3'));var router=express['Router']();var fs_extra=require(_0xaae4('0x4'));var auth=require(_0xaae4('0x5'));var interaction=require(_0xaae4('0x6'));var config=require(_0xaae4('0x7'));var controller=require(_0xaae4('0x8'));router[_0xaae4('0x9')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0xb')]);router[_0xaae4('0x9')](_0xaae4('0xc'),auth[_0xaae4('0xa')](),controller[_0xaae4('0xd')]);router[_0xaae4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaae4('0xe')]);router[_0xaae4('0x9')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x10')]);router[_0xaae4('0x9')](_0xaae4('0x11'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x12')]);router[_0xaae4('0x13')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0x14')]);router[_0xaae4('0x13')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x15')]);router[_0xaae4('0x13')](_0xaae4('0x11'),auth['isAuthenticated'](),controller[_0xaae4('0x16')]);router[_0xaae4('0x17')](_0xaae4('0x18'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x19')]);router['delete'](_0xaae4('0x18'),auth['isAuthenticated'](),controller[_0xaae4('0x1a')]);router[_0xaae4('0x1b')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x1c')]);router[_0xaae4('0x1b')]('/:id/teams',auth[_0xaae4('0xa')](),controller[_0xaae4('0x1d')]);module[_0xaae4('0x1e')]=router; \ No newline at end of file +var _0x1134=['show','getAgents','/:id/teams','getTeams','post','create','put','destroy','delete','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1134,0x19c));var _0x4113=function(_0x97421b,_0x2ebb2e){_0x97421b=_0x97421b-0x0;var _0x1f7cf2=_0x1134[_0x97421b];return _0x1f7cf2;};'use strict';var multer=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var path=require('path');var timeout=require(_0x4113('0x2'));var express=require(_0x4113('0x3'));var router=express['Router']();var fs_extra=require(_0x4113('0x4'));var auth=require(_0x4113('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4113('0x6'));var controller=require('./voicePrefix.controller');router[_0x4113('0x7')]('/',auth['isAuthenticated'](),controller[_0x4113('0x8')]);router['get'](_0x4113('0x9'),auth[_0x4113('0xa')](),controller[_0x4113('0xb')]);router[_0x4113('0x7')](_0x4113('0xc'),auth[_0x4113('0xa')](),controller[_0x4113('0xd')]);router[_0x4113('0x7')]('/:id/users',auth[_0x4113('0xa')](),controller[_0x4113('0xe')]);router[_0x4113('0x7')](_0x4113('0xf'),auth[_0x4113('0xa')](),controller[_0x4113('0x10')]);router[_0x4113('0x11')]('/',auth[_0x4113('0xa')](),controller[_0x4113('0x12')]);router[_0x4113('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x4113('0x11')](_0x4113('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4113('0x13')]('/:id',auth[_0x4113('0xa')](),controller['update']);router['delete'](_0x4113('0xc'),auth[_0x4113('0xa')](),controller[_0x4113('0x14')]);router[_0x4113('0x15')](_0x4113('0x16'),auth[_0x4113('0xa')](),controller[_0x4113('0x17')]);router[_0x4113('0x15')](_0x4113('0xf'),auth[_0x4113('0xa')](),controller['removeTeams']);module[_0x4113('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index fb7bdcd..90ea8a9 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 _0xf583=['system-','getDataValue','INTEGER','exports','STRING','name','VIRTUAL'];(function(_0x1e1f97,_0x2f6925){var _0x1e45fb=function(_0x2389ac){while(--_0x2389ac){_0x1e1f97['push'](_0x1e1f97['shift']());}};_0x1e45fb(++_0x2f6925);}(_0xf583,0xab));var _0x3f58=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xf583[_0x35007a];return _0x574f68;};'use strict';var Sequelize=require('sequelize');module[_0x3f58('0x0')]={'name':{'type':Sequelize[_0x3f58('0x1')],'allowNull':![],'unique':_0x3f58('0x2')},'prefix':{'type':Sequelize[_0x3f58('0x3')],'get':function(_0x93ca77){return _0x3f58('0x4')+this[_0x3f58('0x5')](_0x3f58('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x3f58('0x6')]}}; \ No newline at end of file +var _0x8451=['STRING','VIRTUAL','system-','name','sequelize','exports'];(function(_0x41dabf,_0x4fc101){var _0x2426d1=function(_0x3dfee3){while(--_0x3dfee3){_0x41dabf['push'](_0x41dabf['shift']());}};_0x2426d1(++_0x4fc101);}(_0x8451,0x100));var _0x1845=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x8451[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x1845('0x0'));module[_0x1845('0x1')]={'name':{'type':Sequelize[_0x1845('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x1845('0x3')],'get':function(_0x523968){return _0x1845('0x4')+this['getDataValue'](_0x1845('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x1845('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 f2c66ca..6e8276e 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 _0x8f59=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtensionId','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','appdata','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','params','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','upsert','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x14de57,_0x320a64){var _0x338dd6=function(_0x42b4f6){while(--_0x42b4f6){_0x14de57['push'](_0x14de57['shift']());}};_0x338dd6(++_0x320a64);}(_0x8f59,0x11d));var _0x98f5=function(_0x4ab7a5,_0x35eb99){_0x4ab7a5=_0x4ab7a5-0x0;var _0x5f5013=_0x8f59[_0x4ab7a5];return _0x5f5013;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];config[_0x98f5('0x18')]=_[_0x98f5('0x19')](config[_0x98f5('0x18')],{'host':_0x98f5('0x1a'),'port':0x18eb});var socket=require(_0x98f5('0x1b'))(new Redis(config['redis']));require(_0x98f5('0x1c'))[_0x98f5('0x1d')](socket);function respondWithStatusCode(_0x5b8bab,_0x9df84){_0x9df84=_0x9df84||0xcc;return function(_0x3d6b5c){if(_0x3d6b5c){return _0x5b8bab[_0x98f5('0x1e')](_0x9df84);}return _0x5b8bab['status'](_0x9df84)[_0x98f5('0x1f')]();};}function respondWithResult(_0xc7a49b,_0x113545){_0x113545=_0x113545||0xc8;return function(_0x5bb486){if(_0x5bb486){return _0xc7a49b[_0x98f5('0x20')](_0x113545)[_0x98f5('0x21')](_0x5bb486);}};}function respondWithFilteredResult(_0x574644,_0x1df52d){return function(_0x51a567){if(_0x51a567){var _0x10c57c=typeof _0x1df52d[_0x98f5('0x22')]===_0x98f5('0x23')&&typeof _0x1df52d[_0x98f5('0x24')]===_0x98f5('0x23');var _0xa4477c=_0x51a567['count'];var _0xf88f34=_0x10c57c?0x0:_0x1df52d['offset'];var _0xd1209d=_0x10c57c?_0x51a567[_0x98f5('0x25')]:_0x1df52d['offset']+_0x1df52d[_0x98f5('0x24')];var _0x2933d1;if(_0xd1209d>=_0xa4477c){_0xd1209d=_0xa4477c;_0x2933d1=0xc8;}else{_0x2933d1=0xce;}_0x574644[_0x98f5('0x20')](_0x2933d1);return _0x574644[_0x98f5('0x26')](_0x98f5('0x27'),_0xf88f34+'-'+_0xd1209d+'/'+_0xa4477c)[_0x98f5('0x21')](_0x51a567);}return null;};}function patchUpdates(_0x38b46d){return function(_0x5ac2b7){try{jsonpatch[_0x98f5('0x28')](_0x5ac2b7,_0x38b46d,!![]);}catch(_0x49ee4e){return BPromise[_0x98f5('0x29')](_0x49ee4e);}return _0x5ac2b7['save']();};}function saveUpdates(_0x44bfbb,_0x40c69b){return function(_0x106b24){if(_0x106b24){return _0x106b24[_0x98f5('0x2a')](_0x44bfbb)[_0x98f5('0x2b')](function(_0x18052d){return _0x18052d;});}return null;};}function removeEntity(_0x46dbd4,_0x58d506){return function(_0x27a533){if(_0x27a533){return _0x27a533[_0x98f5('0x2c')]()['then'](function(){var _0x1a1c55=_0x27a533[_0x98f5('0x2d')]({'plain':!![]});var _0x5b08c2=_0x98f5('0x2e');return db[_0x98f5('0x2f')][_0x98f5('0x2c')]({'where':{'type':_0x5b08c2,'resourceId':_0x1a1c55['id']}})[_0x98f5('0x2b')](function(){return _0x27a533;});})[_0x98f5('0x2b')](function(){_0x46dbd4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x428c85,_0x71661e){return function(_0x18bb29){if(!_0x18bb29){_0x428c85[_0x98f5('0x1e')](0x194);}return _0x18bb29;};}function handleError(_0x15bf92,_0x1ae531){_0x1ae531=_0x1ae531||0x1f4;return function(_0x5e9d73){logger[_0x98f5('0x30')](_0x5e9d73[_0x98f5('0x31')]);if(_0x5e9d73[_0x98f5('0x32')]){delete _0x5e9d73[_0x98f5('0x32')];}_0x15bf92[_0x98f5('0x20')](_0x1ae531)[_0x98f5('0x33')](_0x5e9d73);};}exports['index']=function(_0x1e7027,_0x4d4b5c){var _0x229495={},_0x1e193c={},_0x492771={'count':0x0,'rows':[]};var _0x45ca95=_[_0x98f5('0x34')](db[_0x98f5('0x35')][_0x98f5('0x36')],function(_0x45e55c){return{'name':_0x45e55c[_0x98f5('0x37')],'type':_0x45e55c[_0x98f5('0x38')][_0x98f5('0x39')]};});_0x1e193c[_0x98f5('0x3a')]=_[_0x98f5('0x34')](_0x45ca95,_0x98f5('0x32'));_0x1e193c[_0x98f5('0x3b')]=_[_0x98f5('0x3c')](_0x1e7027[_0x98f5('0x3b')]);_0x1e193c[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x1e193c[_0x98f5('0x3a')],_0x1e193c[_0x98f5('0x3b')]);_0x229495[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x1e193c['model'],qs[_0x98f5('0x40')](_0x1e7027['query']['fields']));_0x229495[_0x98f5('0x3f')]=_0x229495[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x229495[_0x98f5('0x3f')]:_0x1e193c['model'];if(!_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x42')](_0x98f5('0x43'))){_0x229495['limit']=qs[_0x98f5('0x24')](_0x1e7027[_0x98f5('0x3b')]['limit']);_0x229495[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x1e7027[_0x98f5('0x3b')]['offset']);}_0x229495[_0x98f5('0x44')]=qs[_0x98f5('0x45')](_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x229495[_0x98f5('0x46')]=qs['filters'](_['pick'](_0x1e7027[_0x98f5('0x3b')],_0x1e193c[_0x98f5('0x3d')]),_0x45ca95);if(_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x47')]){_0x229495[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x229495['where'],{'$or':_['map'](_0x45ca95,function(_0x3f6394){if(_0x3f6394[_0x98f5('0x38')]!==_0x98f5('0x49')){var _0x2f9638={};_0x2f9638[_0x3f6394['name']]={'$like':'%'+_0x1e7027['query'][_0x98f5('0x47')]+'%'};return _0x2f9638;}})});}_0x229495=_[_0x98f5('0x48')]({},_0x229495,_0x1e7027[_0x98f5('0x4a')]);var _0x110aa7={'where':_0x229495['where']};return db['VoicePrefix'][_0x98f5('0x25')](_0x110aa7)[_0x98f5('0x2b')](function(_0x372c33){_0x492771['count']=_0x372c33;if(_0x1e7027[_0x98f5('0x3b')]['includeAll']){_0x229495[_0x98f5('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0x98f5('0x4c')](_0x229495);})[_0x98f5('0x2b')](function(_0x1b8d40){_0x492771['rows']=_0x1b8d40;return _0x492771;})[_0x98f5('0x2b')](respondWithFilteredResult(_0x4d4b5c,_0x229495))[_0x98f5('0x4d')](handleError(_0x4d4b5c,null));};exports['show']=function(_0x3b5dee,_0xd27e7c){var _0x5ed787={'raw':![],'where':{'id':_0x3b5dee['params']['id']}},_0x42ec3e={};_0x42ec3e[_0x98f5('0x3a')]=_[_0x98f5('0x3c')](db['VoicePrefix']['rawAttributes']);_0x42ec3e['query']=_['keys'](_0x3b5dee[_0x98f5('0x3b')]);_0x42ec3e['filters']=_[_0x98f5('0x3e')](_0x42ec3e[_0x98f5('0x3a')],_0x42ec3e[_0x98f5('0x3b')]);_0x5ed787[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x42ec3e[_0x98f5('0x3a')],qs['fields'](_0x3b5dee[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x5ed787[_0x98f5('0x3f')]=_0x5ed787[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x5ed787[_0x98f5('0x3f')]:_0x42ec3e['model'];if(_0x3b5dee[_0x98f5('0x3b')][_0x98f5('0x4e')]){_0x5ed787[_0x98f5('0x4b')]=[{'all':!![]}];}_0x5ed787=_[_0x98f5('0x48')]({},_0x5ed787,_0x3b5dee['options']);return db[_0x98f5('0x35')][_0x98f5('0x4f')](_0x5ed787)[_0x98f5('0x2b')](handleEntityNotFound(_0xd27e7c,null))[_0x98f5('0x2b')](respondWithResult(_0xd27e7c,null))[_0x98f5('0x4d')](handleError(_0xd27e7c,null));};exports['destroy']=function(_0x8d7ebd,_0x254005){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x8d7ebd['params']['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x254005,null))['then'](removeEntity(_0x254005,null))[_0x98f5('0x4d')](handleError(_0x254005,null));};exports[_0x98f5('0x50')]=function(_0x3114a4,_0x5b495e){return db[_0x98f5('0x35')][_0x98f5('0x50')]()[_0x98f5('0x2b')](respondWithResult(_0x5b495e,null))[_0x98f5('0x4d')](handleError(_0x5b495e,null));};exports[_0x98f5('0x51')]=function(_0xf39073,_0x37e620){var _0x1891ac;return db[_0x98f5('0x52')][_0x98f5('0x53')](function(_0x50343c){return db[_0x98f5('0x35')][_0x98f5('0x51')](_0xf39073[_0x98f5('0x54')],{'transaction':_0x50343c})[_0x98f5('0x2b')](function(_0x1289a7){_0x1891ac=_0x1289a7[_0x98f5('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0x98f5('0x4f')]({'where':{'id':_0x1891ac[_0x98f5('0x55')]},'raw':!![]})[_0x98f5('0x2b')](function(_0x4663f2){return createVoicePrefixExtensions(_0x1891ac,_0x4663f2,_0x50343c);});});})[_0x98f5('0x2b')](function(){var _0x15c514=_0xf39073['user']['get']({'plain':!![]});if(!_0x15c514)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c514[_0x98f5('0x56')]===_0x98f5('0x57')){var _0x372c49=_0x1891ac;return db[_0x98f5('0x58')]['find']({'where':{'name':_0x98f5('0x2e'),'userProfileId':_0x15c514['userProfileId']},'raw':!![]})[_0x98f5('0x2b')](function(_0x583be6){if(_0x583be6&&_0x583be6['autoAssociation']===0x0){return db[_0x98f5('0x2f')][_0x98f5('0x51')]({'name':_0x372c49[_0x98f5('0x32')],'resourceId':_0x372c49['id'],'type':_0x583be6['name'],'sectionId':_0x583be6['id']},{})['then'](function(){return _0x1891ac;});}else{return _0x1891ac;}})[_0x98f5('0x4d')](function(_0x139ca3){logger['error'](_0x98f5('0x59'),_0x139ca3);throw _0x139ca3;});}return _0x1891ac;})[_0x98f5('0x2b')](respondWithResult(_0x37e620,null))['catch'](handleError(_0x37e620,null));};function Extension(_0x400f32,_0x974509,_0x8e6975,_0x53249f){this[_0x98f5('0x5a')]=_0x98f5('0x5b');this[_0x98f5('0x5c')]=_0x400f32;this[_0x98f5('0x5d')]=_0x8e6975;this[_0x98f5('0x38')]=_0x98f5('0x5e');this[_0x98f5('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x98f5('0x60')]=_0x974509;this[_0x98f5('0x61')]=_0x53249f;}function createVoicePrefixExtensions(_0x3f2da8,_0x58041d,_0x577552){return new BPromise(function(_0x43b8de,_0x43edfc){var _0x5ae48c=new Extension(formatPrefixName(_0x3f2da8['prefix']),0x1,'NoOp','Voice\x20Prefix');_0x5ae48c[_0x98f5('0x62')]=_0x3f2da8['id'];return db['VoiceExtension'][_0x98f5('0x51')](_0x5ae48c,{'transaction':_0x577552})[_0x98f5('0x2b')](function(_0x44149f){var _0x368567=_0x44149f[_0x98f5('0x2d')]({'plain':!![]});var _0x26cc86=_[_0x98f5('0x34')](addVoicePrefixExtensions(_0x3f2da8,_0x58041d),function(_0x9758e8){_0x9758e8['VoiceExtensionId']=_0x368567['id'];_0x9758e8['VoicePrefixId']=_0x3f2da8['id'];return _0x9758e8;});return db[_0x98f5('0x63')]['bulkCreate'](_0x26cc86,{'transaction':_0x577552})[_0x98f5('0x2b')](function(_0x4ae63d){if(!_0x4ae63d){return _0x43edfc(_0x98f5('0x64'));}else{return _0x43b8de(_0x4ae63d);}})['catch'](function(_0x1cd03f){return _0x43edfc(_0x1cd03f);});});;});};function addVoicePrefixExtensions(_0x56b308,_0x4a1de1){var _0x595aee=[];var _0x2d9cd8=formatPrefixName(_0x56b308['prefix']);_0x595aee[_0x98f5('0x65')](new Extension(_0x2d9cd8,0x2,_0x98f5('0x66'),_0x98f5('0x67')+_0x56b308['name']));if(_0x56b308['callerIdAll']){_0x595aee['push'](new Extension(_0x2d9cd8,0x3,_0x98f5('0x66'),_0x98f5('0x68')+_0x56b308['callerIdAll']));}else{_0x595aee['push'](new Extension(_0x2d9cd8,0x3,_0x98f5('0x69'),_0x98f5('0x6a')));}_0x595aee[_0x98f5('0x65')](new Extension(_0x2d9cd8,0x4,_0x98f5('0x6b'),_0x4a1de1[_0x98f5('0x5a')]+','+_0x98f5('0x6c')+(0x8+_0x56b308[_0x98f5('0x32')][_0x98f5('0x41')])+'}'+','+0x1));return _0x595aee;}function formatPrefixName(_0x139d2c){var _0x4fc5d6='_';for(var _0x35e965=0x0;_0x35e965<_0x139d2c[_0x98f5('0x41')];_0x35e965++){if(_0x139d2c[_0x98f5('0x6d')](_0x35e965)=='-'){_0x4fc5d6+=_0x139d2c[_0x98f5('0x6d')](_0x35e965);}else{_0x4fc5d6+='['+_0x139d2c['charAt'](_0x35e965)+']';}}_0x4fc5d6+='.';return _0x4fc5d6;}exports[_0x98f5('0x2a')]=function(_0x48b175,_0x42c7a6,_0x5760b3){var _0x1d54d8=_0x48b175[_0x98f5('0x54')];_0x1d54d8['prefix']=_0x98f5('0x6e')+_0x1d54d8[_0x98f5('0x32')]+'-';return db[_0x98f5('0x52')]['transaction'](function(_0x45413e){return db[_0x98f5('0x35')][_0x98f5('0x2a')](_0x1d54d8,{'where':{'id':_0x1d54d8['id']},'transaction':_0x45413e})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x63')][_0x98f5('0x2c')]({'where':{'VoicePrefixId':_0x1d54d8['id']},'transaction':_0x45413e})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x63')][_0x98f5('0x4f')]({'where':{'id':_0x1d54d8['VoiceExtensionId']},'raw':!![]})[_0x98f5('0x2b')](function(_0x486ff6){return createVoicePrefixExtensions(_0x1d54d8,_0x486ff6,_0x45413e);});});});})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x35')][_0x98f5('0x6f')](_0x1d54d8['id']);})[_0x98f5('0x2b')](respondWithResult(_0x42c7a6,null))['catch'](handleError(_0x42c7a6,null));};exports[_0x98f5('0x70')]=function(_0x23bf5f,_0x57b9c1,_0x540c00){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x23bf5f[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x57b9c1,null))[_0x98f5('0x2b')](function(_0x5427a3){if(_0x5427a3){return _0x5427a3['addAgents'](_0x23bf5f[_0x98f5('0x54')][_0x98f5('0x72')],_['omit'](_0x23bf5f[_0x98f5('0x54')],[_0x98f5('0x72'),'id'])||{})[_0x98f5('0x73')](function(_0x28aa43){for(var _0x258ee7=0x0;_0x258ee7<_0x23bf5f[_0x98f5('0x54')][_0x98f5('0x72')][_0x98f5('0x41')];_0x258ee7+=0x1){socket[_0x98f5('0x74')](_0x98f5('0x75'),{'UserId':Number(_0x23bf5f[_0x98f5('0x54')]['ids'][_0x258ee7]),'VoicePrefixId':Number(_0x23bf5f['params']['id'])});}return _0x28aa43;});}})[_0x98f5('0x2b')](respondWithResult(_0x57b9c1,null))[_0x98f5('0x4d')](handleError(_0x57b9c1,null));};exports[_0x98f5('0x76')]=function(_0x54c7f9,_0x28d910,_0x3303d4){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x54c7f9[_0x98f5('0x71')]['id']}})['then'](handleEntityNotFound(_0x28d910,null))['then'](function(_0x4dfef7){if(_0x4dfef7){return _0x4dfef7['removeAgents'](_0x54c7f9[_0x98f5('0x3b')][_0x98f5('0x72')])['then'](function(){if(_[_0x98f5('0x77')](_0x54c7f9[_0x98f5('0x3b')]['ids'])){for(var _0x2afe1d=0x0;_0x2afe1d<_0x54c7f9['query']['ids'][_0x98f5('0x41')];_0x2afe1d+=0x1){socket[_0x98f5('0x74')](_0x98f5('0x78'),{'UserId':Number(_0x54c7f9[_0x98f5('0x3b')]['ids'][_0x2afe1d]),'VoicePrefixId':Number(_0x54c7f9[_0x98f5('0x71')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x54c7f9['query'][_0x98f5('0x72')]),'VoicePrefixId':Number(_0x54c7f9[_0x98f5('0x71')]['id'])});}});}})[_0x98f5('0x2b')](respondWithStatusCode(_0x28d910,null))[_0x98f5('0x4d')](handleError(_0x28d910,null));};exports[_0x98f5('0x79')]=function(_0x3ab0dc,_0x36048c,_0x11e72a){var _0x1a3a76={};var _0x2aa9a4={};var _0x485a15;var _0x40b6fa;return db[_0x98f5('0x35')][_0x98f5('0x7a')]({'where':{'id':_0x3ab0dc[_0x98f5('0x71')]['id']}})['then'](handleEntityNotFound(_0x36048c,null))[_0x98f5('0x2b')](function(_0x1aba52){if(_0x1aba52){_0x485a15=_0x1aba52;_0x2aa9a4['model']=_[_0x98f5('0x3c')](db[_0x98f5('0x7b')][_0x98f5('0x36')]);_0x2aa9a4['query']=_[_0x98f5('0x3c')](_0x3ab0dc[_0x98f5('0x3b')]);_0x2aa9a4[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x2aa9a4[_0x98f5('0x3a')],_0x2aa9a4[_0x98f5('0x3b')]);_0x1a3a76['attributes']=_['intersection'](_0x2aa9a4[_0x98f5('0x3a')],qs[_0x98f5('0x40')](_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x1a3a76['attributes']=_0x1a3a76[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x1a3a76['attributes']:_0x2aa9a4['model'];_0x1a3a76[_0x98f5('0x44')]=qs['sort'](_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x1a3a76[_0x98f5('0x46')]=qs['filters'](_[_0x98f5('0x7c')](_0x3ab0dc[_0x98f5('0x3b')],_0x2aa9a4['filters']));if(_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x47')]){_0x1a3a76[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x1a3a76['where'],{'$or':_['map'](_0x1a3a76[_0x98f5('0x3f')],function(_0x1e32f1){var _0x514dea={};_0x514dea[_0x1e32f1]={'$like':'%'+_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x47')]+'%'};return _0x514dea;})});}_0x1a3a76=_[_0x98f5('0x48')]({},_0x1a3a76,_0x3ab0dc['options']);return _0x485a15[_0x98f5('0x79')](_0x1a3a76);}})[_0x98f5('0x2b')](function(_0x2de7e7){if(_0x2de7e7){_0x40b6fa=_0x2de7e7[_0x98f5('0x41')];if(!_0x3ab0dc['query'][_0x98f5('0x42')]('nolimit')){_0x1a3a76[_0x98f5('0x24')]=qs[_0x98f5('0x24')](_0x3ab0dc['query'][_0x98f5('0x24')]);_0x1a3a76[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x3ab0dc[_0x98f5('0x3b')]['offset']);}return _0x485a15[_0x98f5('0x79')](_0x1a3a76);}})['then'](function(_0x6c3951){if(_0x6c3951){return _0x6c3951?{'count':_0x40b6fa,'rows':_0x6c3951}:null;}})['then'](respondWithResult(_0x36048c,null))[_0x98f5('0x4d')](handleError(_0x36048c,null));};exports['getTeams']=function(_0x1ba9a2,_0x193cbb,_0x3a411f){var _0x1a04f6={};var _0x40eb2f={};var _0x421e3c;var _0x1e28b7;return db[_0x98f5('0x35')][_0x98f5('0x7a')]({'where':{'id':_0x1ba9a2[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x193cbb,null))[_0x98f5('0x2b')](function(_0x5bec4f){if(_0x5bec4f){_0x421e3c=_0x5bec4f;_0x40eb2f['model']=_[_0x98f5('0x3c')](db[_0x98f5('0x7d')]['rawAttributes']);_0x40eb2f[_0x98f5('0x3b')]=_[_0x98f5('0x3c')](_0x1ba9a2[_0x98f5('0x3b')]);_0x40eb2f[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x40eb2f[_0x98f5('0x3a')],_0x40eb2f['query']);_0x1a04f6[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x40eb2f[_0x98f5('0x3a')],qs[_0x98f5('0x40')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x1a04f6['attributes']=_0x1a04f6[_0x98f5('0x3f')]['length']?_0x1a04f6[_0x98f5('0x3f')]:_0x40eb2f[_0x98f5('0x3a')];_0x1a04f6[_0x98f5('0x44')]=qs[_0x98f5('0x45')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x1a04f6[_0x98f5('0x46')]=qs[_0x98f5('0x3d')](_['pick'](_0x1ba9a2['query'],_0x40eb2f[_0x98f5('0x3d')]));if(_0x1ba9a2['query'][_0x98f5('0x47')]){_0x1a04f6[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x1a04f6['where'],{'$or':_['map'](_0x1a04f6['attributes'],function(_0x20cbaf){var _0x45779d={};_0x45779d[_0x20cbaf]={'$like':'%'+_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x47')]+'%'};return _0x45779d;})});}_0x1a04f6=_[_0x98f5('0x48')]({},_0x1a04f6,_0x1ba9a2['options']);return _0x421e3c[_0x98f5('0x7e')](_0x1a04f6);}})[_0x98f5('0x2b')](function(_0x163f7e){if(_0x163f7e){_0x1e28b7=_0x163f7e[_0x98f5('0x41')];if(!_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x42')](_0x98f5('0x43'))){_0x1a04f6[_0x98f5('0x24')]=qs[_0x98f5('0x24')](_0x1ba9a2[_0x98f5('0x3b')]['limit']);_0x1a04f6[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x22')]);}return _0x421e3c[_0x98f5('0x7e')](_0x1a04f6);}})['then'](function(_0x3af4fc){if(_0x3af4fc){return _0x3af4fc?{'count':_0x1e28b7,'rows':_0x3af4fc}:null;}})[_0x98f5('0x2b')](respondWithResult(_0x193cbb,null))[_0x98f5('0x4d')](handleError(_0x193cbb,null));};exports['addTeams']=function(_0x87ae6,_0x14a01b,_0x31282d){var _0x2e85ad=_0x87ae6[_0x98f5('0x54')][_0x98f5('0x72')];var _0x2a983e;return db[_0x98f5('0x7d')][_0x98f5('0x4c')]({'where':{'id':_0x2e85ad},'attributes':['id'],'include':[{'model':db['User'],'as':_0x98f5('0x7f'),'attributes':['id','name',_0x98f5('0x80'),_0x98f5('0x81'),_0x98f5('0x82')],'raw':!![]}]})[_0x98f5('0x2b')](function(_0x1f90ce){if(_0x1f90ce){_0x2a983e=_0x1f90ce;var _0x2bf55c=_[_0x98f5('0x83')](_0x1f90ce,function(_0x54eb1d){var _0x1aa66f=_0x54eb1d[_0x98f5('0x2d')]({'plain':!![]});return _0x1aa66f[_0x98f5('0x7f')];});return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x87ae6[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](function(_0x37a1a7){return db[_0x98f5('0x52')][_0x98f5('0x53')](function(_0x55de57){return _0x37a1a7[_0x98f5('0x84')](_0x2e85ad,{'transaction':_0x55de57})[_0x98f5('0x2b')](function(){return BPromise[_0x98f5('0x85')](_0x2a983e,function(_0x462498){return db[_0x98f5('0x86')][_0x98f5('0x87')]({'TeamId':_0x462498['id'],'VoicePrefixId':_0x87ae6[_0x98f5('0x71')]['id']},{'transaction':_0x55de57});});})[_0x98f5('0x2b')](function(){return BPromise[_0x98f5('0x85')](_0x2bf55c,function(_0x2adc96){return db['UserVoicePrefix'][_0x98f5('0x88')]({'where':{'UserId':_0x2adc96['id'],'VoicePrefixId':_0x87ae6[_0x98f5('0x71')]['id']},'transaction':_0x55de57});});})[_0x98f5('0x2b')](function(){_0x2bf55c[_0x98f5('0x89')](function(_0x4c06c3){socket[_0x98f5('0x74')](_0x98f5('0x75'),{'UserId':_0x4c06c3['id'],'VoicePrefixId':_0x37a1a7['id']});});});});});}})[_0x98f5('0x2b')](respondWithStatusCode(_0x14a01b,null))['catch'](handleError(_0x14a01b,null));};exports[_0x98f5('0x8a')]=function(_0x29f1af,_0x165c5c,_0x401ec7){return db[_0x98f5('0x7d')]['findAll']({'where':{'id':_0x29f1af['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x98f5('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x98f5('0x2b')](handleEntityNotFound(_0x165c5c,null))['then'](function(_0x55edfd){var _0x339388=_[_0x98f5('0x34')](_0x55edfd,'id');var _0x1f1e6c=[];var _0x22009b=[];var _0x269fe1=squel['select']();_0x269fe1['field'](_0x98f5('0x8b'))[_0x98f5('0x8c')](_0x98f5('0x8d'),'tq')['join'](_0x98f5('0x8e'),'ut',_0x98f5('0x8f'))['where']('VoicePrefixId\x20=\x20?',_0x29f1af[_0x98f5('0x71')]['id']);for(var _0x4a8f92=0x0;_0x4a8f92<_0x55edfd['length'];_0x4a8f92+=0x1){let _0x20b788=_0x55edfd[_0x4a8f92];for(var _0x1743a8=0x0;_0x1743a8<_0x20b788[_0x98f5('0x7f')][_0x98f5('0x41')];_0x1743a8+=0x1){let _0x18bb66=_0x20b788[_0x98f5('0x7f')][_0x1743a8];var _0x1f1b89=_0x269fe1['clone']();_0x1f1b89[_0x98f5('0x46')](_0x98f5('0x90'),_0x18bb66['id']);_0x22009b[_0x98f5('0x65')](db[_0x98f5('0x52')]['query'](_0x1f1b89[_0x98f5('0x91')](),{'type':db[_0x98f5('0x52')][_0x98f5('0x92')][_0x98f5('0x93')]})[_0x98f5('0x2b')](function(_0x10d7d0){if(_0x10d7d0[_0x98f5('0x41')]===0x1){return _0x18bb66['id'];}else{var _0x4cc03e=_['every'](_[_0x98f5('0x34')](_0x10d7d0,_0x98f5('0x94')),function(_0x1068ff){return _[_0x98f5('0x95')](_0x339388,_0x1068ff);});if(_0x4cc03e){return _0x18bb66['id'];}}}));}}return BPromise['all'](_0x22009b)['then'](function(_0x2ddef8){_0x1f1e6c=_(_0x1f1e6c)['union'](_0x2ddef8)[_0x98f5('0x96')]()[_0x98f5('0x97')]();return db[_0x98f5('0x35')][_0x98f5('0x4f')]({'where':{'id':_0x29f1af[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](function(_0x1d1949){return db['sequelize'][_0x98f5('0x53')](function(_0x2391f1){return _0x1d1949['removeTeams'](_0x29f1af[_0x98f5('0x3b')][_0x98f5('0x72')],{'transaction':_0x2391f1})[_0x98f5('0x2b')](function(){if(!_['isEmpty'](_0x1f1e6c)){return _0x1d1949['removeAgents'](_0x1f1e6c,{'transaction':_0x2391f1});}})[_0x98f5('0x2b')](function(){_0x1f1e6c[_0x98f5('0x89')](function(_0x4de795){socket['emit'](_0x98f5('0x78'),{'UserId':_0x4de795,'VoicePrefixId':_0x1d1949['id']});});});});});});})[_0x98f5('0x2b')](respondWithStatusCode(_0x165c5c,null))[_0x98f5('0x4d')](handleError(_0x165c5c,null));}; \ No newline at end of file +var _0x757a=['create','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','update','body','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','UserProfileResource','error','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','find','destroy','params','describe'];(function(_0x4e81a6,_0x55dee5){var _0x36cade=function(_0x24fb52){while(--_0x24fb52){_0x4e81a6['push'](_0x4e81a6['shift']());}};_0x36cade(++_0x55dee5);}(_0x757a,0xde));var _0xa757=function(_0x41548e,_0x1c582c){_0x41548e=_0x41548e-0x0;var _0x4cf99e=_0x757a[_0x41548e];return _0x4cf99e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa757('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa757('0x16'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xa757('0x17')](socket);function respondWithStatusCode(_0x1b670e,_0x355f0a){_0x355f0a=_0x355f0a||0xcc;return function(_0x4a0c38){if(_0x4a0c38){return _0x1b670e[_0xa757('0x18')](_0x355f0a);}return _0x1b670e[_0xa757('0x19')](_0x355f0a)[_0xa757('0x1a')]();};}function respondWithResult(_0x2f7947,_0x185011){_0x185011=_0x185011||0xc8;return function(_0x3df1f9){if(_0x3df1f9){return _0x2f7947['status'](_0x185011)[_0xa757('0x1b')](_0x3df1f9);}};}function respondWithFilteredResult(_0x44eab8,_0xde8248){return function(_0x4d9f58){if(_0x4d9f58){var _0x54b305=typeof _0xde8248[_0xa757('0x1c')]===_0xa757('0x1d')&&typeof _0xde8248[_0xa757('0x1e')]===_0xa757('0x1d');var _0x27f4ba=_0x4d9f58[_0xa757('0x1f')];var _0x4bd137=_0x54b305?0x0:_0xde8248[_0xa757('0x1c')];var _0x4fec52=_0x54b305?_0x4d9f58[_0xa757('0x1f')]:_0xde8248[_0xa757('0x1c')]+_0xde8248[_0xa757('0x1e')];var _0x2c9ec6;if(_0x4fec52>=_0x27f4ba){_0x4fec52=_0x27f4ba;_0x2c9ec6=0xc8;}else{_0x2c9ec6=0xce;}_0x44eab8['status'](_0x2c9ec6);return _0x44eab8['set'](_0xa757('0x20'),_0x4bd137+'-'+_0x4fec52+'/'+_0x27f4ba)[_0xa757('0x1b')](_0x4d9f58);}return null;};}function patchUpdates(_0x2ba923){return function(_0x8d121f){try{jsonpatch[_0xa757('0x21')](_0x8d121f,_0x2ba923,!![]);}catch(_0x40562f){return BPromise[_0xa757('0x22')](_0x40562f);}return _0x8d121f[_0xa757('0x23')]();};}function saveUpdates(_0x2bf276,_0x59fae6){return function(_0x3707c1){if(_0x3707c1){return _0x3707c1['update'](_0x2bf276)[_0xa757('0x24')](function(_0x47903b){return _0x47903b;});}return null;};}function removeEntity(_0x40551d,_0x3859ce){return function(_0x37c7e6){if(_0x37c7e6){return _0x37c7e6['destroy']()[_0xa757('0x24')](function(){var _0xcd98bd=_0x37c7e6[_0xa757('0x25')]({'plain':!![]});var _0x3bf7f3='VoicePrefixes';return db[_0xa757('0x26')]['destroy']({'where':{'type':_0x3bf7f3,'resourceId':_0xcd98bd['id']}})['then'](function(){return _0x37c7e6;});})['then'](function(){_0x40551d['status'](0xcc)[_0xa757('0x1a')]();});}};}function handleEntityNotFound(_0x596ae2,_0x2208f9){return function(_0x3bc24c){if(!_0x3bc24c){_0x596ae2['sendStatus'](0x194);}return _0x3bc24c;};}function handleError(_0x2a0c9a,_0x5119ad){_0x5119ad=_0x5119ad||0x1f4;return function(_0x2c4823){logger[_0xa757('0x27')](_0x2c4823['stack']);if(_0x2c4823[_0xa757('0x28')]){delete _0x2c4823['name'];}_0x2a0c9a[_0xa757('0x19')](_0x5119ad)[_0xa757('0x29')](_0x2c4823);};}exports[_0xa757('0x2a')]=function(_0x300dc4,_0xcc87c0){var _0x2c1885={},_0x1a44a9={},_0x2220df={'count':0x0,'rows':[]};var _0x112282=_[_0xa757('0x2b')](db[_0xa757('0x2c')][_0xa757('0x2d')],function(_0x25dfbb){return{'name':_0x25dfbb[_0xa757('0x2e')],'type':_0x25dfbb[_0xa757('0x2f')][_0xa757('0x30')]};});_0x1a44a9[_0xa757('0x31')]=_[_0xa757('0x2b')](_0x112282,_0xa757('0x28'));_0x1a44a9[_0xa757('0x32')]=_[_0xa757('0x33')](_0x300dc4[_0xa757('0x32')]);_0x1a44a9[_0xa757('0x34')]=_[_0xa757('0x35')](_0x1a44a9['model'],_0x1a44a9[_0xa757('0x32')]);_0x2c1885[_0xa757('0x36')]=_[_0xa757('0x35')](_0x1a44a9[_0xa757('0x31')],qs[_0xa757('0x37')](_0x300dc4['query'][_0xa757('0x37')]));_0x2c1885[_0xa757('0x36')]=_0x2c1885[_0xa757('0x36')][_0xa757('0x38')]?_0x2c1885[_0xa757('0x36')]:_0x1a44a9[_0xa757('0x31')];if(!_0x300dc4['query'][_0xa757('0x39')](_0xa757('0x3a'))){_0x2c1885[_0xa757('0x1e')]=qs[_0xa757('0x1e')](_0x300dc4[_0xa757('0x32')][_0xa757('0x1e')]);_0x2c1885[_0xa757('0x1c')]=qs[_0xa757('0x1c')](_0x300dc4[_0xa757('0x32')]['offset']);}_0x2c1885[_0xa757('0x3b')]=qs[_0xa757('0x3c')](_0x300dc4[_0xa757('0x32')][_0xa757('0x3c')]);_0x2c1885[_0xa757('0x3d')]=qs[_0xa757('0x34')](_['pick'](_0x300dc4[_0xa757('0x32')],_0x1a44a9[_0xa757('0x34')]),_0x112282);if(_0x300dc4['query']['filter']){_0x2c1885[_0xa757('0x3d')]=_[_0xa757('0x3e')](_0x2c1885['where'],{'$or':_['map'](_0x112282,function(_0xcff7c4){if(_0xcff7c4[_0xa757('0x2f')]!==_0xa757('0x3f')){var _0x59d699={};_0x59d699[_0xcff7c4[_0xa757('0x28')]]={'$like':'%'+_0x300dc4[_0xa757('0x32')][_0xa757('0x40')]+'%'};return _0x59d699;}})});}_0x2c1885=_[_0xa757('0x3e')]({},_0x2c1885,_0x300dc4[_0xa757('0x41')]);var _0x4c6639={'where':_0x2c1885[_0xa757('0x3d')]};return db['VoicePrefix']['count'](_0x4c6639)[_0xa757('0x24')](function(_0x57298b){_0x2220df[_0xa757('0x1f')]=_0x57298b;if(_0x300dc4[_0xa757('0x32')][_0xa757('0x42')]){_0x2c1885['include']=[{'all':!![]}];}return db['VoicePrefix'][_0xa757('0x43')](_0x2c1885);})[_0xa757('0x24')](function(_0x2b171c){_0x2220df[_0xa757('0x44')]=_0x2b171c;return _0x2220df;})[_0xa757('0x24')](respondWithFilteredResult(_0xcc87c0,_0x2c1885))[_0xa757('0x45')](handleError(_0xcc87c0,null));};exports['show']=function(_0xd61628,_0x364998){var _0x4d66d4={'raw':![],'where':{'id':_0xd61628['params']['id']}},_0x40e291={};_0x40e291[_0xa757('0x31')]=_[_0xa757('0x33')](db['VoicePrefix'][_0xa757('0x2d')]);_0x40e291[_0xa757('0x32')]=_['keys'](_0xd61628[_0xa757('0x32')]);_0x40e291[_0xa757('0x34')]=_[_0xa757('0x35')](_0x40e291[_0xa757('0x31')],_0x40e291['query']);_0x4d66d4[_0xa757('0x36')]=_[_0xa757('0x35')](_0x40e291[_0xa757('0x31')],qs[_0xa757('0x37')](_0xd61628['query'][_0xa757('0x37')]));_0x4d66d4['attributes']=_0x4d66d4['attributes'][_0xa757('0x38')]?_0x4d66d4[_0xa757('0x36')]:_0x40e291[_0xa757('0x31')];if(_0xd61628['query'][_0xa757('0x42')]){_0x4d66d4['include']=[{'all':!![]}];}_0x4d66d4=_[_0xa757('0x3e')]({},_0x4d66d4,_0xd61628[_0xa757('0x41')]);return db[_0xa757('0x2c')][_0xa757('0x46')](_0x4d66d4)[_0xa757('0x24')](handleEntityNotFound(_0x364998,null))[_0xa757('0x24')](respondWithResult(_0x364998,null))[_0xa757('0x45')](handleError(_0x364998,null));};exports[_0xa757('0x47')]=function(_0x581e95,_0x2de226){return db[_0xa757('0x2c')][_0xa757('0x46')]({'where':{'id':_0x581e95[_0xa757('0x48')]['id']}})[_0xa757('0x24')](handleEntityNotFound(_0x2de226,null))[_0xa757('0x24')](removeEntity(_0x2de226,null))[_0xa757('0x45')](handleError(_0x2de226,null));};exports[_0xa757('0x49')]=function(_0x405397,_0x1d05d7){return db[_0xa757('0x2c')][_0xa757('0x49')]()[_0xa757('0x24')](respondWithResult(_0x1d05d7,null))[_0xa757('0x45')](handleError(_0x1d05d7,null));};exports[_0xa757('0x4a')]=function(_0x23caca,_0x492e7e){var _0x3b5116;return db['sequelize'][_0xa757('0x4b')](function(_0x311c25){return db[_0xa757('0x2c')][_0xa757('0x4a')](_0x23caca['body'],{'transaction':_0x311c25})[_0xa757('0x24')](function(_0x1ee01e){_0x3b5116=_0x1ee01e[_0xa757('0x25')]({'plain':!![]});return db[_0xa757('0x4c')]['find']({'where':{'id':_0x3b5116[_0xa757('0x4d')]},'raw':!![]})[_0xa757('0x24')](function(_0x216b32){return createVoicePrefixExtensions(_0x3b5116,_0x216b32,_0x311c25);});});})[_0xa757('0x24')](function(){var _0x33666d=_0x23caca[_0xa757('0x4e')]['get']({'plain':!![]});if(!_0x33666d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33666d['role']==='user'){var _0x1d8742=_0x3b5116;return db[_0xa757('0x4f')][_0xa757('0x46')]({'where':{'name':_0xa757('0x50'),'userProfileId':_0x33666d[_0xa757('0x51')]},'raw':!![]})[_0xa757('0x24')](function(_0x5efb32){if(_0x5efb32&&_0x5efb32[_0xa757('0x52')]===0x0){return db[_0xa757('0x26')][_0xa757('0x4a')]({'name':_0x1d8742[_0xa757('0x28')],'resourceId':_0x1d8742['id'],'type':_0x5efb32['name'],'sectionId':_0x5efb32['id']},{})[_0xa757('0x24')](function(){return _0x3b5116;});}else{return _0x3b5116;}})[_0xa757('0x45')](function(_0x4af840){logger[_0xa757('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4af840);throw _0x4af840;});}return _0x3b5116;})[_0xa757('0x24')](respondWithResult(_0x492e7e,null))['catch'](handleError(_0x492e7e,null));};function Extension(_0x51be6e,_0x58633a,_0x4badee,_0x367b48){this[_0xa757('0x53')]=_0xa757('0x54');this[_0xa757('0x55')]=_0x51be6e;this[_0xa757('0x56')]=_0x4badee;this[_0xa757('0x2f')]='system';this['description']=_0xa757('0x57');this[_0xa757('0x58')]=_0x58633a;this[_0xa757('0x59')]=_0x367b48;}function createVoicePrefixExtensions(_0x4a5ad5,_0x55a7d2,_0x18dff7){return new BPromise(function(_0x31c4cd,_0x215a80){var _0x504c4f=new Extension(formatPrefixName(_0x4a5ad5[_0xa757('0x5a')]),0x1,_0xa757('0x5b'),'Voice\x20Prefix');_0x504c4f[_0xa757('0x5c')]=_0x4a5ad5['id'];return db[_0xa757('0x4c')][_0xa757('0x4a')](_0x504c4f,{'transaction':_0x18dff7})[_0xa757('0x24')](function(_0x1291df){var _0xfbcb43=_0x1291df[_0xa757('0x25')]({'plain':!![]});var _0x13dd81=_[_0xa757('0x2b')](addVoicePrefixExtensions(_0x4a5ad5,_0x55a7d2),function(_0x3b1bb8){_0x3b1bb8['VoiceExtensionId']=_0xfbcb43['id'];_0x3b1bb8[_0xa757('0x5c')]=_0x4a5ad5['id'];return _0x3b1bb8;});return db['VoiceExtension']['bulkCreate'](_0x13dd81,{'transaction':_0x18dff7})[_0xa757('0x24')](function(_0x3da8c1){if(!_0x3da8c1){return _0x215a80(_0xa757('0x5d'));}else{return _0x31c4cd(_0x3da8c1);}})[_0xa757('0x45')](function(_0x3c3ff1){return _0x215a80(_0x3c3ff1);});});;});};function addVoicePrefixExtensions(_0x3672a7,_0x1b34ad){var _0x32e0b9=[];var _0x13e584=formatPrefixName(_0x3672a7[_0xa757('0x5a')]);_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x2,'Set',_0xa757('0x5f')+_0x3672a7[_0xa757('0x28')]));if(_0x3672a7['callerIdAll']){_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x3,_0xa757('0x60'),_0xa757('0x61')+_0x3672a7[_0xa757('0x62')]));}else{_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x3,_0xa757('0x5b'),'No\x20callerid\x20available'));}_0x32e0b9[_0xa757('0x5e')](new Extension(_0x13e584,0x4,'goto',_0x1b34ad[_0xa757('0x53')]+','+_0xa757('0x63')+(0x8+_0x3672a7[_0xa757('0x28')][_0xa757('0x38')])+'}'+','+0x1));return _0x32e0b9;}function formatPrefixName(_0x39ca41){var _0x5c0870='_';for(var _0x57ec52=0x0;_0x57ec52<_0x39ca41[_0xa757('0x38')];_0x57ec52++){if(_0x39ca41[_0xa757('0x64')](_0x57ec52)=='-'){_0x5c0870+=_0x39ca41[_0xa757('0x64')](_0x57ec52);}else{_0x5c0870+='['+_0x39ca41['charAt'](_0x57ec52)+']';}}_0x5c0870+='.';return _0x5c0870;}exports[_0xa757('0x65')]=function(_0x55bc0f,_0x34982a,_0x294165){var _0x2b0ad4=_0x55bc0f[_0xa757('0x66')];_0x2b0ad4[_0xa757('0x5a')]=_0xa757('0x67')+_0x2b0ad4['name']+'-';return db[_0xa757('0x68')][_0xa757('0x4b')](function(_0x1e15ee){return db[_0xa757('0x2c')][_0xa757('0x65')](_0x2b0ad4,{'where':{'id':_0x2b0ad4['id']},'transaction':_0x1e15ee})['then'](function(){return db[_0xa757('0x4c')][_0xa757('0x47')]({'where':{'VoicePrefixId':_0x2b0ad4['id']},'transaction':_0x1e15ee})[_0xa757('0x24')](function(){return db[_0xa757('0x4c')][_0xa757('0x46')]({'where':{'id':_0x2b0ad4['VoiceExtensionId']},'raw':!![]})[_0xa757('0x24')](function(_0x1c6287){return createVoicePrefixExtensions(_0x2b0ad4,_0x1c6287,_0x1e15ee);});});});})[_0xa757('0x24')](function(){return db['VoicePrefix'][_0xa757('0x69')](_0x2b0ad4['id']);})[_0xa757('0x24')](respondWithResult(_0x34982a,null))[_0xa757('0x45')](handleError(_0x34982a,null));};exports[_0xa757('0x6a')]=function(_0x78511f,_0x4695ef,_0x19ff32){return db[_0xa757('0x2c')][_0xa757('0x46')]({'where':{'id':_0x78511f[_0xa757('0x48')]['id']}})[_0xa757('0x24')](handleEntityNotFound(_0x4695ef,null))[_0xa757('0x24')](function(_0x47425b){if(_0x47425b){return _0x47425b[_0xa757('0x6a')](_0x78511f['body'][_0xa757('0x6b')],_[_0xa757('0x6c')](_0x78511f['body'],[_0xa757('0x6b'),'id'])||{})[_0xa757('0x6d')](function(_0x505bd6){for(var _0x29aea2=0x0;_0x29aea2<_0x78511f[_0xa757('0x66')][_0xa757('0x6b')][_0xa757('0x38')];_0x29aea2+=0x1){socket[_0xa757('0x6e')](_0xa757('0x6f'),{'UserId':Number(_0x78511f[_0xa757('0x66')][_0xa757('0x6b')][_0x29aea2]),'VoicePrefixId':Number(_0x78511f[_0xa757('0x48')]['id'])});}return _0x505bd6;});}})[_0xa757('0x24')](respondWithResult(_0x4695ef,null))[_0xa757('0x45')](handleError(_0x4695ef,null));};exports[_0xa757('0x70')]=function(_0x2c2b40,_0x46bc34,_0x27604c){return db[_0xa757('0x2c')]['find']({'where':{'id':_0x2c2b40[_0xa757('0x48')]['id']}})['then'](handleEntityNotFound(_0x46bc34,null))[_0xa757('0x24')](function(_0x20c444){if(_0x20c444){return _0x20c444[_0xa757('0x70')](_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')])['then'](function(){if(_[_0xa757('0x71')](_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')])){for(var _0x4a691d=0x0;_0x4a691d<_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')][_0xa757('0x38')];_0x4a691d+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2c2b40[_0xa757('0x32')][_0xa757('0x6b')][_0x4a691d]),'VoicePrefixId':Number(_0x2c2b40[_0xa757('0x48')]['id'])});}}else{socket['emit'](_0xa757('0x72'),{'UserId':Number(_0x2c2b40['query']['ids']),'VoicePrefixId':Number(_0x2c2b40[_0xa757('0x48')]['id'])});}});}})[_0xa757('0x24')](respondWithStatusCode(_0x46bc34,null))[_0xa757('0x45')](handleError(_0x46bc34,null));};exports['getAgents']=function(_0x2a1c30,_0x1f85b,_0x17accd){var _0x199f75={};var _0x3e5cf5={};var _0x2d0ce0;var _0x26dcec;return db[_0xa757('0x2c')][_0xa757('0x73')]({'where':{'id':_0x2a1c30[_0xa757('0x48')]['id']}})[_0xa757('0x24')](handleEntityNotFound(_0x1f85b,null))[_0xa757('0x24')](function(_0x5a7042){if(_0x5a7042){_0x2d0ce0=_0x5a7042;_0x3e5cf5[_0xa757('0x31')]=_[_0xa757('0x33')](db[_0xa757('0x74')][_0xa757('0x2d')]);_0x3e5cf5[_0xa757('0x32')]=_[_0xa757('0x33')](_0x2a1c30[_0xa757('0x32')]);_0x3e5cf5[_0xa757('0x34')]=_[_0xa757('0x35')](_0x3e5cf5[_0xa757('0x31')],_0x3e5cf5[_0xa757('0x32')]);_0x199f75[_0xa757('0x36')]=_[_0xa757('0x35')](_0x3e5cf5[_0xa757('0x31')],qs[_0xa757('0x37')](_0x2a1c30[_0xa757('0x32')][_0xa757('0x37')]));_0x199f75[_0xa757('0x36')]=_0x199f75[_0xa757('0x36')][_0xa757('0x38')]?_0x199f75[_0xa757('0x36')]:_0x3e5cf5[_0xa757('0x31')];_0x199f75['order']=qs[_0xa757('0x3c')](_0x2a1c30[_0xa757('0x32')]['sort']);_0x199f75[_0xa757('0x3d')]=qs['filters'](_[_0xa757('0x75')](_0x2a1c30[_0xa757('0x32')],_0x3e5cf5['filters']));if(_0x2a1c30[_0xa757('0x32')][_0xa757('0x40')]){_0x199f75[_0xa757('0x3d')]=_[_0xa757('0x3e')](_0x199f75['where'],{'$or':_[_0xa757('0x2b')](_0x199f75[_0xa757('0x36')],function(_0x4bf5c2){var _0x30716a={};_0x30716a[_0x4bf5c2]={'$like':'%'+_0x2a1c30[_0xa757('0x32')]['filter']+'%'};return _0x30716a;})});}_0x199f75=_[_0xa757('0x3e')]({},_0x199f75,_0x2a1c30[_0xa757('0x41')]);return _0x2d0ce0[_0xa757('0x76')](_0x199f75);}})[_0xa757('0x24')](function(_0x7d106e){if(_0x7d106e){_0x26dcec=_0x7d106e[_0xa757('0x38')];if(!_0x2a1c30[_0xa757('0x32')][_0xa757('0x39')](_0xa757('0x3a'))){_0x199f75['limit']=qs['limit'](_0x2a1c30[_0xa757('0x32')][_0xa757('0x1e')]);_0x199f75[_0xa757('0x1c')]=qs[_0xa757('0x1c')](_0x2a1c30[_0xa757('0x32')][_0xa757('0x1c')]);}return _0x2d0ce0[_0xa757('0x76')](_0x199f75);}})['then'](function(_0x4603f3){if(_0x4603f3){return _0x4603f3?{'count':_0x26dcec,'rows':_0x4603f3}:null;}})['then'](respondWithResult(_0x1f85b,null))[_0xa757('0x45')](handleError(_0x1f85b,null));};exports[_0xa757('0x77')]=function(_0x365a0d,_0x1b8444,_0x9723da){var _0x558b86={};var _0x3fa436={};var _0x4cb547;var _0x2d1113;return db[_0xa757('0x2c')][_0xa757('0x73')]({'where':{'id':_0x365a0d[_0xa757('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b8444,null))[_0xa757('0x24')](function(_0x1975a3){if(_0x1975a3){_0x4cb547=_0x1975a3;_0x3fa436[_0xa757('0x31')]=_[_0xa757('0x33')](db[_0xa757('0x78')][_0xa757('0x2d')]);_0x3fa436[_0xa757('0x32')]=_[_0xa757('0x33')](_0x365a0d['query']);_0x3fa436[_0xa757('0x34')]=_[_0xa757('0x35')](_0x3fa436[_0xa757('0x31')],_0x3fa436[_0xa757('0x32')]);_0x558b86['attributes']=_[_0xa757('0x35')](_0x3fa436[_0xa757('0x31')],qs[_0xa757('0x37')](_0x365a0d[_0xa757('0x32')][_0xa757('0x37')]));_0x558b86[_0xa757('0x36')]=_0x558b86[_0xa757('0x36')]['length']?_0x558b86['attributes']:_0x3fa436[_0xa757('0x31')];_0x558b86['order']=qs[_0xa757('0x3c')](_0x365a0d['query']['sort']);_0x558b86[_0xa757('0x3d')]=qs[_0xa757('0x34')](_[_0xa757('0x75')](_0x365a0d[_0xa757('0x32')],_0x3fa436[_0xa757('0x34')]));if(_0x365a0d[_0xa757('0x32')][_0xa757('0x40')]){_0x558b86[_0xa757('0x3d')]=_[_0xa757('0x3e')](_0x558b86[_0xa757('0x3d')],{'$or':_['map'](_0x558b86[_0xa757('0x36')],function(_0x5b37f0){var _0x221e5b={};_0x221e5b[_0x5b37f0]={'$like':'%'+_0x365a0d[_0xa757('0x32')][_0xa757('0x40')]+'%'};return _0x221e5b;})});}_0x558b86=_[_0xa757('0x3e')]({},_0x558b86,_0x365a0d['options']);return _0x4cb547[_0xa757('0x77')](_0x558b86);}})[_0xa757('0x24')](function(_0x3e097b){if(_0x3e097b){_0x2d1113=_0x3e097b[_0xa757('0x38')];if(!_0x365a0d[_0xa757('0x32')][_0xa757('0x39')](_0xa757('0x3a'))){_0x558b86[_0xa757('0x1e')]=qs[_0xa757('0x1e')](_0x365a0d[_0xa757('0x32')][_0xa757('0x1e')]);_0x558b86[_0xa757('0x1c')]=qs[_0xa757('0x1c')](_0x365a0d[_0xa757('0x32')][_0xa757('0x1c')]);}return _0x4cb547['getTeams'](_0x558b86);}})['then'](function(_0x1176d5){if(_0x1176d5){return _0x1176d5?{'count':_0x2d1113,'rows':_0x1176d5}:null;}})['then'](respondWithResult(_0x1b8444,null))[_0xa757('0x45')](handleError(_0x1b8444,null));};exports[_0xa757('0x79')]=function(_0x2edad2,_0x1d03a7,_0x48c52f){var _0x33995b=_0x2edad2[_0xa757('0x66')][_0xa757('0x6b')];var _0x2f0ec5;return db[_0xa757('0x78')][_0xa757('0x43')]({'where':{'id':_0x33995b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa757('0x7a'),'attributes':['id',_0xa757('0x28'),_0xa757('0x7b'),_0xa757('0x7c'),_0xa757('0x7d')],'raw':!![]}]})['then'](function(_0x4b022c){if(_0x4b022c){_0x2f0ec5=_0x4b022c;var _0x26954d=_['flatMap'](_0x4b022c,function(_0x2b177c){var _0x55e4e5=_0x2b177c[_0xa757('0x25')]({'plain':!![]});return _0x55e4e5[_0xa757('0x7a')];});return db[_0xa757('0x2c')][_0xa757('0x46')]({'where':{'id':_0x2edad2[_0xa757('0x48')]['id']}})[_0xa757('0x24')](function(_0x2fb515){return db[_0xa757('0x68')][_0xa757('0x4b')](function(_0x1a4911){return _0x2fb515[_0xa757('0x79')](_0x33995b,{'transaction':_0x1a4911})['then'](function(){return BPromise[_0xa757('0x7e')](_0x2f0ec5,function(_0x38a6db){return db[_0xa757('0x7f')][_0xa757('0x80')]({'TeamId':_0x38a6db['id'],'VoicePrefixId':_0x2edad2[_0xa757('0x48')]['id']},{'transaction':_0x1a4911});});})[_0xa757('0x24')](function(){return BPromise['each'](_0x26954d,function(_0x30439a){return db[_0xa757('0x81')]['findOrCreate']({'where':{'UserId':_0x30439a['id'],'VoicePrefixId':_0x2edad2[_0xa757('0x48')]['id']},'transaction':_0x1a4911});});})[_0xa757('0x24')](function(){_0x26954d[_0xa757('0x82')](function(_0x5e6171){socket[_0xa757('0x6e')](_0xa757('0x6f'),{'UserId':_0x5e6171['id'],'VoicePrefixId':_0x2fb515['id']});});});});});}})[_0xa757('0x24')](respondWithStatusCode(_0x1d03a7,null))[_0xa757('0x45')](handleError(_0x1d03a7,null));};exports[_0xa757('0x83')]=function(_0x5b9be2,_0x16fdb7,_0x5ddcab){return db['Team'][_0xa757('0x43')]({'where':{'id':_0x5b9be2['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa757('0x74')],'as':_0xa757('0x7a'),'attributes':['id'],'raw':!![]}]})[_0xa757('0x24')](handleEntityNotFound(_0x16fdb7,null))[_0xa757('0x24')](function(_0x168313){var _0x2ed413=_['map'](_0x168313,'id');var _0x59e5c8=[];var _0x556b78=[];var _0x4b4a87=squel['select']();_0x4b4a87['field']('tq.TeamId')[_0xa757('0x84')]('team_has_voice_prefixes','tq')[_0xa757('0x85')](_0xa757('0x86'),'ut',_0xa757('0x87'))[_0xa757('0x3d')](_0xa757('0x88'),_0x5b9be2[_0xa757('0x48')]['id']);for(var _0x399952=0x0;_0x399952<_0x168313[_0xa757('0x38')];_0x399952+=0x1){let _0x1b1524=_0x168313[_0x399952];for(var _0x49f3fe=0x0;_0x49f3fe<_0x1b1524['Agents'][_0xa757('0x38')];_0x49f3fe+=0x1){let _0x3147eb=_0x1b1524[_0xa757('0x7a')][_0x49f3fe];var _0x2a7147=_0x4b4a87['clone']();_0x2a7147[_0xa757('0x3d')](_0xa757('0x89'),_0x3147eb['id']);_0x556b78[_0xa757('0x5e')](db[_0xa757('0x68')][_0xa757('0x32')](_0x2a7147[_0xa757('0x8a')](),{'type':db[_0xa757('0x68')]['QueryTypes'][_0xa757('0x8b')]})[_0xa757('0x24')](function(_0x494735){if(_0x494735[_0xa757('0x38')]===0x1){return _0x3147eb['id'];}else{var _0x3924af=_[_0xa757('0x8c')](_[_0xa757('0x2b')](_0x494735,_0xa757('0x8d')),function(_0x5d0701){return _[_0xa757('0x8e')](_0x2ed413,_0x5d0701);});if(_0x3924af){return _0x3147eb['id'];}}}));}}return BPromise[_0xa757('0x8f')](_0x556b78)[_0xa757('0x24')](function(_0x5081a0){_0x59e5c8=_(_0x59e5c8)[_0xa757('0x90')](_0x5081a0)[_0xa757('0x91')]()[_0xa757('0x92')]();return db['VoicePrefix'][_0xa757('0x46')]({'where':{'id':_0x5b9be2[_0xa757('0x48')]['id']}})[_0xa757('0x24')](function(_0x41b710){return db[_0xa757('0x68')]['transaction'](function(_0x2dcc43){return _0x41b710['removeTeams'](_0x5b9be2['query'][_0xa757('0x6b')],{'transaction':_0x2dcc43})[_0xa757('0x24')](function(){if(!_[_0xa757('0x93')](_0x59e5c8)){return _0x41b710[_0xa757('0x70')](_0x59e5c8,{'transaction':_0x2dcc43});}})['then'](function(){_0x59e5c8[_0xa757('0x82')](function(_0x36c462){socket[_0xa757('0x6e')](_0xa757('0x72'),{'UserId':_0x36c462,'VoicePrefixId':_0x41b710['id']});});});});});});})[_0xa757('0x24')](respondWithStatusCode(_0x16fdb7,null))[_0xa757('0x45')](handleError(_0x16fdb7,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index da686e8..3021a39 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 _0x2353=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x2353,0xec));var _0x3235=function(_0x1f9c43,_0x24d1bc){_0x1f9c43=_0x1f9c43-0x0;var _0x2928fd=_0x2353[_0x1f9c43];return _0x2928fd;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x3235('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3235('0x1')](0x0);var events={'afterCreate':_0x3235('0x2'),'afterUpdate':_0x3235('0x3'),'afterDestroy':_0x3235('0x4')};function emitEvent(_0x5bbd11){return function(_0x14617f,_0x26ca64,_0xeabf30){VoicePrefixEvents[_0x3235('0x5')](_0x5bbd11+':'+_0x14617f['id'],_0x14617f);VoicePrefixEvents['emit'](_0x5bbd11,_0x14617f);_0xeabf30(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x3235('0x6')](e,emitEvent(event));}}module[_0x3235('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x6217=['emit','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0x6217,0x133));var _0x7621=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x6217[_0x11e30d];return _0x2d4e29;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x7621('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7621('0x1')](0x0);var events={'afterCreate':_0x7621('0x2'),'afterUpdate':_0x7621('0x3'),'afterDestroy':_0x7621('0x4')};function emitEvent(_0x1fcd1b){return function(_0x46355f,_0x54fbe1,_0xb6f3bf){VoicePrefixEvents[_0x7621('0x5')](_0x1fcd1b+':'+_0x46355f['id'],_0x46355f);VoicePrefixEvents[_0x7621('0x5')](_0x1fcd1b,_0x46355f);_0xb6f3bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7621('0x6')](e,emitEvent(event));}}module[_0x7621('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 11f79c6..2326398 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 _0x20e2=['util','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash'];(function(_0x4b388f,_0x20e19c){var _0x4d70f7=function(_0x1ac74f){while(--_0x1ac74f){_0x4b388f['push'](_0x4b388f['shift']());}};_0x4d70f7(++_0x20e19c);}(_0x20e2,0x1c2));var _0x220e=function(_0x20af3e,_0x130a58){_0x20af3e=_0x20af3e-0x0;var _0x45fcfb=_0x20e2[_0x20af3e];return _0x45fcfb;};'use strict';var _=require(_0x220e('0x0'));var util=require(_0x220e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x220e('0x2'));var BPromise=require(_0x220e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x220e('0x4'));var rimraf=require(_0x220e('0x5'));var config=require(_0x220e('0x6'));var attributes=require(_0x220e('0x7'));module[_0x220e('0x8')]=function(_0x38d4f3,_0x10ca24){return _0x38d4f3[_0x220e('0x9')](_0x220e('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf38f=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4abfd2,_0xd09564){var _0x35a13c=function(_0x232d0b){while(--_0x232d0b){_0x4abfd2['push'](_0x4abfd2['shift']());}};_0x35a13c(++_0xd09564);}(_0xf38f,0x161));var _0xff38=function(_0x37437c,_0x55dacf){_0x37437c=_0x37437c-0x0;var _0x35e1a1=_0xf38f[_0x37437c];return _0x35e1a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff38('0x0'))(_0xff38('0x1'));var moment=require(_0xff38('0x2'));var BPromise=require(_0xff38('0x3'));var rp=require(_0xff38('0x4'));var fs=require('fs');var path=require(_0xff38('0x5'));var rimraf=require(_0xff38('0x6'));var config=require('../../config/environment');var attributes=require(_0xff38('0x7'));module[_0xff38('0x8')]=function(_0x467dc0,_0x2d462c){return _0x467dc0[_0xff38('0x9')](_0xff38('0xa'),attributes,{'tableName':_0xff38('0xb'),'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 fe731b3..9d5f71f 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 _0x4489=['util','bluebird','randomstring','ioredis','../../mysqldb','client','redis','localhost','socket.io-emitter','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x1760c8,_0xddc3e8){var _0x3ca9e6=function(_0x590e19){while(--_0x590e19){_0x1760c8['push'](_0x1760c8['shift']());}};_0x3ca9e6(++_0xddc3e8);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9448('0x0'));var util=require(_0x9448('0x1'));var moment=require('moment');var BPromise=require(_0x9448('0x2'));var rs=require(_0x9448('0x3'));var fs=require('fs');var Redis=require(_0x9448('0x4'));var db=require(_0x9448('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9448('0x6')]['http']({'port':0x232a});config[_0x9448('0x7')]=_['defaults'](config[_0x9448('0x7')],{'host':_0x9448('0x8'),'port':0x18eb});var socket=require(_0x9448('0x9'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x301bf5,_0x3e272d,_0x4640c3){return new BPromise(function(_0x5d20e2,_0x20b436){return client['request'](_0x301bf5,_0x4640c3)[_0x9448('0xa')](function(_0x444830){logger[_0x9448('0xb')](_0x9448('0xc'),_0x3e272d,_0x9448('0xd'));logger[_0x9448('0xe')](_0x9448('0xf'),_0x3e272d,_0x9448('0xd'),JSON['stringify'](_0x444830));if(_0x444830[_0x9448('0x10')]){if(_0x444830['error'][_0x9448('0x11')]===0x1f4){logger[_0x9448('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x3e272d,_0x444830[_0x9448('0x10')][_0x9448('0x12')]);return _0x20b436(_0x444830[_0x9448('0x10')][_0x9448('0x12')]);}logger[_0x9448('0x10')](_0x9448('0xc'),_0x3e272d,_0x444830[_0x9448('0x10')][_0x9448('0x12')]);return _0x5d20e2(_0x444830['error'][_0x9448('0x12')]);}else{logger['info'](_0x9448('0xc'),_0x3e272d,_0x9448('0xd'));_0x5d20e2(_0x444830[_0x9448('0x13')][_0x9448('0x12')]);}})[_0x9448('0x14')](function(_0x194e0e){logger[_0x9448('0x10')](_0x9448('0xc'),_0x3e272d,_0x194e0e);_0x20b436(_0x194e0e);});});} \ No newline at end of file +var _0x565e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','moment','bluebird'];(function(_0x4b6383,_0x2d248f){var _0xc5ebf0=function(_0x396322){while(--_0x396322){_0x4b6383['push'](_0x4b6383['shift']());}};_0xc5ebf0(++_0x2d248f);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});config[_0xe565('0xb')]=_[_0xe565('0xc')](config[_0xe565('0xb')],{'host':_0xe565('0xd'),'port':0x18eb});var socket=require(_0xe565('0xe'))(new Redis(config[_0xe565('0xb')]));require(_0xe565('0xf'))[_0xe565('0x10')](socket);function respondWithRpcPromise(_0x41640f,_0x5b82c1,_0x3dd4dc){return new BPromise(function(_0x36c827,_0x9fd021){return client['request'](_0x41640f,_0x3dd4dc)[_0xe565('0x11')](function(_0x9f674){logger[_0xe565('0x12')](_0xe565('0x13'),_0x5b82c1,'request\x20sent');logger[_0xe565('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5b82c1,_0xe565('0x15'),JSON['stringify'](_0x9f674));if(_0x9f674[_0xe565('0x16')]){if(_0x9f674[_0xe565('0x16')][_0xe565('0x17')]===0x1f4){logger['error'](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x9fd021(_0x9f674[_0xe565('0x16')]['message']);}logger[_0xe565('0x16')](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x36c827(_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);}else{logger['info'](_0xe565('0x13'),_0x5b82c1,_0xe565('0x15'));_0x36c827(_0x9f674[_0xe565('0x19')][_0xe565('0x18')]);}})['catch'](function(_0x403f94){logger[_0xe565('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x5b82c1,_0x403f94);_0x9fd021(_0x403f94);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1498691..d227318 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 _0xbdeb=['voicePrefix:','save','update','emit','register'];(function(_0x1f0400,_0x9b2e4a){var _0xb0c042=function(_0x93a0c){while(--_0x93a0c){_0x1f0400['push'](_0x1f0400['shift']());}};_0xb0c042(++_0x9b2e4a);}(_0xbdeb,0x6f));var _0xbbde=function(_0xec590e,_0x406821){_0xec590e=_0xec590e-0x0;var _0x52b041=_0xbdeb[_0xec590e];return _0x52b041;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xbbde('0x0'),'remove',_0xbbde('0x1')];function createListener(_0x51599e,_0x1279b0){return function(_0x365857){_0x1279b0[_0xbbde('0x2')](_0x51599e,_0x365857);};}function removeListener(_0x3ee0ec,_0x5362c3){return function(){VoicePrefixEvents['removeListener'](_0x3ee0ec,_0x5362c3);};}exports[_0xbbde('0x3')]=function(_0x1d4042){for(var _0x278651=0x0,_0x1a8482=events['length'];_0x278651<_0x1a8482;_0x278651++){var _0x49966c=events[_0x278651];var _0x3215c9=createListener(_0xbbde('0x4')+_0x49966c,_0x1d4042);VoicePrefixEvents['on'](_0x49966c,_0x3215c9);}}; \ No newline at end of file +var _0x9755=['remove','update','removeListener','register','./voicePrefix.events'];(function(_0x216c10,_0xd83344){var _0x53cfca=function(_0xab6d33){while(--_0xab6d33){_0x216c10['push'](_0x216c10['shift']());}};_0x53cfca(++_0xd83344);}(_0x9755,0x1c6));var _0x5975=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9755[_0x1cc8fe];return _0x230054;};'use strict';var VoicePrefixEvents=require(_0x5975('0x0'));var events=['save',_0x5975('0x1'),_0x5975('0x2')];function createListener(_0x398970,_0x5e3640){return function(_0x53201e){_0x5e3640['emit'](_0x398970,_0x53201e);};}function removeListener(_0x261737,_0x453917){return function(){VoicePrefixEvents[_0x5975('0x3')](_0x261737,_0x453917);};}exports[_0x5975('0x4')]=function(_0x414e54){for(var _0x1839fb=0x0,_0x365ac3=events['length'];_0x1839fb<_0x365ac3;_0x1839fb++){var _0x48d8b5=events[_0x1839fb];var _0x2209f1=createListener('voicePrefix:'+_0x48d8b5,_0x414e54);VoicePrefixEvents['on'](_0x48d8b5,_0x2209f1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 249798a..ef9aabd 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x34f164,_0x1d9946){var _0xaa1b7b=function(_0x4acfab){while(--_0x4acfab){_0x34f164['push'](_0x34f164['shift']());}};_0xaa1b7b(++_0x1d9946);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x2093f0,_0x1f903c){var _0x37829f=function(_0x27d3bc){while(--_0x27d3bc){_0x2093f0['push'](_0x2093f0['shift']());}};_0x37829f(++_0x1f903c);}(_0xb10b,0x12a));var _0xbb10=function(_0x360c92,_0x5ed443){_0x360c92=_0x360c92-0x0;var _0x429495=_0xb10b[_0x360c92];return _0x429495;};'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 82faa42..3a15337 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 _0x1bf2=['Only\x20for\x20predictive\x20method.','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','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)','#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','never','onlyIfOpen','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\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','#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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','wrandom','setDataValue','strategy','getDataValue','type','preview','booked','rrmemory','includes','INTEGER','yes','all','once','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate'];(function(_0x452cf5,_0x17dacc){var _0x5929fa=function(_0x211d43){while(--_0x211d43){_0x452cf5['push'](_0x452cf5['shift']());}};_0x5929fa(++_0x17dacc);}(_0x1bf2,0x167));var _0x21bf=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x1bf2[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x21bf('0x0'));module[_0x21bf('0x1')]={'name':{'type':Sequelize[_0x21bf('0x2')],'allowNull':![],'unique':_0x21bf('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x5'),_0x21bf('0x6')),'allowNull':![],'defaultValue':_0x21bf('0x5')},'musiconhold':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':_0x21bf('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x21bf('0x4')]('rr',_0x21bf('0x8'),_0x21bf('0x9'),'fewestcalls',_0x21bf('0xa'),'rrmemory','linear',_0x21bf('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x21bf('0x8'),'set':function(_0x37b941){this[_0x21bf('0xc')](_0x21bf('0xd'),_0x37b941?_0x37b941:'rrmemory');},'get':function(){var _0x6e902a=this[_0x21bf('0xe')](_0x21bf('0xf'));var _0x22c51a=this[_0x21bf('0xe')]('dialMethod');var _0x4839e6=this[_0x21bf('0xe')](_0x21bf('0xd'));if(_0x6e902a===_0x21bf('0x6')){if(_0x22c51a===_0x21bf('0x10')){return null;}if(_0x22c51a===_0x21bf('0x11')&&![_0x21bf('0x12'),'roundrobin'][_0x21bf('0x13')](_0x4839e6)){this['setDataValue']('strategy',_0x21bf('0x12'));}}return _0x4839e6;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x21bf('0x14')](0xb)},'timeout':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x21bf('0x2')]},'weight':{'type':Sequelize[_0x21bf('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defaultValue':_0x21bf('0x15')},'autopause':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no',_0x21bf('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x21bf('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x21bf('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x21bf('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x21bf('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x21bf('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x21bf('0x4')]('yes','no'),'defaultValue':_0x21bf('0x15')},'announce_holdtime':{'type':Sequelize[_0x21bf('0x4')]('yes','no',_0x21bf('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x21bf('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x21bf('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2869d6){this['setDataValue']('periodic_announce',_0x2869d6?_0x2869d6['join'](','):[]);},'get':function(){return this[_0x21bf('0xe')](_0x21bf('0x18'))?this[_0x21bf('0xe')]('periodic_announce')[_0x21bf('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':'yes','set':function(_0x39436f){this[_0x21bf('0xc')](_0x21bf('0x1a'),_0x39436f?_0x39436f['join'](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x21bf('0xe')](_0x21bf('0x1a'))[_0x21bf('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':'no','set':function(_0x1e50d4){this[_0x21bf('0xc')]('leavewhenempty',_0x1e50d4?_0x1e50d4[_0x21bf('0x1b')](','):undefined);},'get':function(){return this[_0x21bf('0xe')](_0x21bf('0x1c'))?this[_0x21bf('0xe')](_0x21bf('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x21bf('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':0x0,'set':function(_0x12a3c7){this['setDataValue'](_0x21bf('0x1e'),_0x12a3c7);if(_0x12a3c7){if(this[_0x21bf('0xe')](_0x21bf('0x1f'))<0x2){this[_0x21bf('0xc')](_0x21bf('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x21bf('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':0x0,'comment':_0x21bf('0x20')},'dialMethod':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x10'),'progressive',_0x21bf('0x21'),'predictive',_0x21bf('0x11')),'defaultValue':'progressive','comment':_0x21bf('0x22')},'dialLimitChannel':{'type':Sequelize[_0x21bf('0x14')](0x4)[_0x21bf('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x21bf('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x21bf('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x21bf('0x25')},'dialPowerLevel':{'type':Sequelize[_0x21bf('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x27'),_0x21bf('0x28')),'defaultValue':_0x21bf('0x28'),'comment':_0x21bf('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x21bf('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x21bf('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x21bf('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':_0x21bf('0x2c'),'comment':_0x21bf('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x21bf('0x2')],'comment':_0x21bf('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x21bf('0x14')](0x5)[_0x21bf('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21bf('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x21bf('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'comment':_0x21bf('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x21bf('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21bf('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x21bf('0x34')},'dialTimezone':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x21bf('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x35'),_0x21bf('0x36'),_0x21bf('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':0x0,'comment':_0x21bf('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x21bf('0x14')](0x9)[_0x21bf('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x21bf('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x21bf('0x14')](0x9)[_0x21bf('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x21bf('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x21bf('0x14')](0x9)[_0x21bf('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x21bf('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x21bf('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x21bf('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x21bf('0x14')](0x9)[_0x21bf('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x21bf('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x21bf('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x21bf('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x21bf('0x14')](0x9)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x21bf('0x14')](0x5)[_0x21bf('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x21bf('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x21bf('0x14')](0x9)[_0x21bf('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x21bf('0x14')](0x5)[_0x21bf('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x21bf('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x21bf('0x4')](_0x21bf('0x41'),_0x21bf('0x42')),'defaultValue':_0x21bf('0x41')},'dialQueueProject2':{'type':Sequelize[_0x21bf('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x21bf('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21bf('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x45')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x21bf('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21bf('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x21bf('0x14')](0x5)[_0x21bf('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21bf('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x21bf('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21bf('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21bf('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x21bf('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21bf('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x21bf('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':![],'comment':_0x21bf('0x4d'),'set':function(_0x568253){if(!_0x568253)this[_0x21bf('0xc')](_0x21bf('0x4e'),null);this['setDataValue'](_0x21bf('0x4f'),_0x568253);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x21bf('0x14')](0x3)[_0x21bf('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x21bf('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x9aa2=['leavewhenempty','wrapuptime','preview','predictive','booked','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','ENUM','outbound','inbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','dialMethod','strategy','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty'];(function(_0x1fcbb7,_0x21ff69){var _0x1a5046=function(_0xe0768){while(--_0xe0768){_0x1fcbb7['push'](_0x1fcbb7['shift']());}};_0x1a5046(++_0x21ff69);}(_0x9aa2,0xc7));var _0x29aa=function(_0xab44f7,_0x4794e0){_0xab44f7=_0xab44f7-0x0;var _0x284b58=_0x9aa2[_0xab44f7];return _0x284b58;};'use strict';var Sequelize=require('sequelize');module[_0x29aa('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x29aa('0x1')]('inbound',_0x29aa('0x2')),'allowNull':![],'defaultValue':_0x29aa('0x3')},'musiconhold':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':_0x29aa('0x5')},'announce':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0x29aa('0x1')]('rr',_0x29aa('0x6'),_0x29aa('0x7'),_0x29aa('0x8'),_0x29aa('0x9'),_0x29aa('0xa'),_0x29aa('0xb'),_0x29aa('0xc'),_0x29aa('0xd')),'allowNull':![],'defaultValue':_0x29aa('0x6'),'set':function(_0x46c62c){this[_0x29aa('0xe')]('strategy',_0x46c62c?_0x46c62c:'rrmemory');},'get':function(){var _0x29cc80=this[_0x29aa('0xf')]('type');var _0x3471bc=this[_0x29aa('0xf')](_0x29aa('0x10'));var _0x3a2111=this[_0x29aa('0xf')](_0x29aa('0x11'));if(_0x29cc80===_0x29aa('0x2')){if(_0x3471bc==='preview'){return null;}if(_0x3471bc==='booked'&&![_0x29aa('0xa'),_0x29aa('0x12')][_0x29aa('0x13')](_0x3a2111)){this[_0x29aa('0xe')](_0x29aa('0x11'),'rrmemory');}}return _0x3a2111;}},'servicelevel':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x29aa('0x14')](0xb)},'timeout':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x29aa('0x4')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':_0x29aa('0x15')},'autopause':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no',_0x29aa('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x29aa('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x29aa('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x29aa('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x29aa('0x15'),'no',_0x29aa('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x29aa('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x29aa('0x4')]},'queue_youarenext':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x29aa('0x4')]},'queue_quantity1':{'type':Sequelize[_0x29aa('0x4')]},'queue_quantity2':{'type':Sequelize[_0x29aa('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0x29aa('0x4')]},'queue_less_than':{'type':Sequelize[_0x29aa('0x4')]},'periodic_announce':{'type':Sequelize[_0x29aa('0x18')],'set':function(_0x5aba63){this[_0x29aa('0xe')](_0x29aa('0x19'),_0x5aba63?_0x5aba63[_0x29aa('0x1a')](','):[]);},'get':function(){return this[_0x29aa('0xf')](_0x29aa('0x19'))?this[_0x29aa('0xf')](_0x29aa('0x19'))[_0x29aa('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x29aa('0x15'),'set':function(_0x1f9f70){this[_0x29aa('0xe')]('joinempty',_0x1f9f70?_0x1f9f70[_0x29aa('0x1a')](','):undefined);},'get':function(){return this[_0x29aa('0xf')]('joinempty')?this[_0x29aa('0xf')](_0x29aa('0x1c'))[_0x29aa('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':'no','set':function(_0x3ccb6e){this['setDataValue']('leavewhenempty',_0x3ccb6e?_0x3ccb6e[_0x29aa('0x1a')](','):undefined);},'get':function(){return this[_0x29aa('0xf')]('leavewhenempty')?this[_0x29aa('0xf')](_0x29aa('0x1d'))[_0x29aa('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x29aa('0x1')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x29aa('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x29aa('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0xc445f7){this['setDataValue']('acw',_0xc445f7);if(_0xc445f7){if(this['getDataValue'](_0x29aa('0x1e'))<0x2){this[_0x29aa('0xe')](_0x29aa('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x1f'),'progressive','power',_0x29aa('0x20'),_0x29aa('0x21')),'defaultValue':_0x29aa('0x22'),'comment':_0x29aa('0x23')},'dialLimitChannel':{'type':Sequelize[_0x29aa('0x14')](0x4)[_0x29aa('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x29aa('0x25')},'dialLimitQueue':{'type':Sequelize[_0x29aa('0x14')](0x4)[_0x29aa('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x29aa('0x26')](0x2)[_0x29aa('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x29aa('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x29aa('0x1')]('agentBusyFactor','dropRate'),'defaultValue':_0x29aa('0x28'),'comment':_0x29aa('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x29aa('0x26')](0x2)[_0x29aa('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x29aa('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x29aa('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x29aa('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x29aa('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x29aa('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x29aa('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':_0x29aa('0x2d'),'comment':_0x29aa('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x29aa('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x29aa('0x2f')},'dialQueueProject':{'type':Sequelize[_0x29aa('0x4')],'comment':_0x29aa('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x29aa('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x29aa('0x32')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x29aa('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x29aa('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'defaultValue':0x3,'comment':_0x29aa('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x29aa('0x35')},'dialTimezone':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':_0x29aa('0x36')},'dialPrefix':{'type':Sequelize[_0x29aa('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x37'),'never',_0x29aa('0x38')),'defaultValue':_0x29aa('0x37')},'dialAMDActive':{'type':Sequelize[_0x29aa('0x39')],'defaultValue':0x0,'comment':_0x29aa('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x29aa('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x29aa('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x29aa('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x29aa('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x29aa('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x29aa('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x29aa('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x29aa('0x14')](0x9)[_0x29aa('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x29aa('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x29aa('0x14')](0x9)[_0x29aa('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x29aa('0x14')](0x9)[_0x29aa('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x29aa('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x29aa('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x29aa('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x29aa('0x39')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x29aa('0x1')](_0x29aa('0x41'),'ASC'),'defaultValue':_0x29aa('0x41')},'dialQueueProject2':{'type':Sequelize[_0x29aa('0x4')],'comment':_0x29aa('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x29aa('0x39')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x29aa('0x39')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x29aa('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x29aa('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x29aa('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x29aa('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x29aa('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x29aa('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x29aa('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x29aa('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x29aa('0x14')](0x5)[_0x29aa('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x29aa('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x29aa('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x29aa('0x39')],'defaultValue':![],'comment':_0x29aa('0x4a'),'set':function(_0x519458){if(!_0x519458)this['setDataValue'](_0x29aa('0x4b'),null);this[_0x29aa('0xe')]('mandatoryDisposition',_0x519458);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x29aa('0x14')](0x3)[_0x29aa('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x29aa('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x29aa('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ebbcacb..de75b16 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','insert','into','fromQuery','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','end','json','offset','undefined','count','limit','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','sendStatus','stack','name','status','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','clone','params','keys','omit','updatedAt','createdAt','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','nolimit','sort','filters','pick','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','phone','scheduledAt','field','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x2c200d,_0x321292){var _0x1de96d=function(_0x8b5ec9){while(--_0x8b5ec9){_0x2c200d['push'](_0x2c200d['shift']());}};_0x1de96d(++_0x321292);}(_0x3e74,0x175));var _0x43e7=function(_0x504226,_0x434c5b){_0x504226=_0x504226-0x0;var _0x3dda47=_0x3e74[_0x504226];return _0x3dda47;};'use strict';var moment=require(_0x43e7('0x0'));var BPromise=require('bluebird');var util=require(_0x43e7('0x1'));var _=require(_0x43e7('0x2'));var squel=require(_0x43e7('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x4'))('api');var config=require(_0x43e7('0x5'));var db=require(_0x43e7('0x6'))['db'];config[_0x43e7('0x7')]=_[_0x43e7('0x8')](config[_0x43e7('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x43e7('0x9'))(new Redis(config[_0x43e7('0x7')]));require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);function respondWithStatusCode(_0x21f491,_0x516b4d){_0x516b4d=_0x516b4d||0xcc;return function(_0x212c6c){if(_0x212c6c){return _0x21f491['sendStatus'](_0x516b4d);}return _0x21f491['status'](_0x516b4d)[_0x43e7('0xc')]();};}function respondWithResult(_0x4139c9,_0x5c34f4){_0x5c34f4=_0x5c34f4||0xc8;return function(_0x2803d9){if(_0x2803d9){return _0x4139c9['status'](_0x5c34f4)[_0x43e7('0xd')](_0x2803d9);}};}function respondWithFilteredResult(_0x37302c,_0x4ebc8e){return function(_0x3eb206){if(_0x3eb206){var _0xc960ea=typeof _0x4ebc8e[_0x43e7('0xe')]===_0x43e7('0xf')&&typeof _0x4ebc8e['limit']==='undefined';var _0x2fcb36=_0x3eb206[_0x43e7('0x10')];var _0x44b0bd=_0xc960ea?0x0:_0x4ebc8e['offset'];var _0x5e641c=_0xc960ea?_0x3eb206[_0x43e7('0x10')]:_0x4ebc8e[_0x43e7('0xe')]+_0x4ebc8e[_0x43e7('0x11')];var _0x328445;if(_0x5e641c>=_0x2fcb36){_0x5e641c=_0x2fcb36;_0x328445=0xc8;}else{_0x328445=0xce;}_0x37302c['status'](_0x328445);return _0x37302c['set'](_0x43e7('0x12'),_0x44b0bd+'-'+_0x5e641c+'/'+_0x2fcb36)[_0x43e7('0xd')](_0x3eb206);}return null;};}function saveUpdates(_0x273a32){return function(_0x5d346f){if(_0x5d346f){return _0x5d346f['update'](_0x273a32)[_0x43e7('0x13')](function(_0x1ca758){return _0x1ca758;});}return null;};}function removeEntity(_0x9037d3){return function(_0x140657){if(_0x140657){return _0x140657[_0x43e7('0x14')]()[_0x43e7('0x13')](function(){var _0x619236=_0x140657[_0x43e7('0x15')]({'plain':!![]});var _0x2377a3=[{'name':_0x43e7('0x16'),'value':_0x43e7('0x17'),'ignore':![]},{'name':_0x43e7('0x18'),'value':'outbound','ignore':![]}];var _0xef1a5a=_(_0x2377a3)[_0x43e7('0x19')]('ignore')[_0x43e7('0x1a')](_0x43e7('0x1b'))[_0x43e7('0x1b')]();if(_[_0x43e7('0x1c')](_0xef1a5a,_0x619236[_0x43e7('0x1d')])){return;}var _0x2f4cb4=_['find'](_0x2377a3,[_0x43e7('0x1b'),_0x619236['type']])['name'];return db[_0x43e7('0x1e')][_0x43e7('0x14')]({'where':{'type':_0x2f4cb4,'resourceId':_0x619236['id']}})['then'](function(){return _0x140657;});})[_0x43e7('0x13')](function(){_0x9037d3['status'](0xcc)[_0x43e7('0xc')]();});}};}function handleEntityNotFound(_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x5c5e67[_0x43e7('0x1f')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x20')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x21')];}_0x20888b[_0x43e7('0x22')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={};var _0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x1a')](db[_0x43e7('0x25')][_0x43e7('0x26')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x27')],'type':_0x31b2a6[_0x43e7('0x1d')][_0x43e7('0x28')]};});_0x4690a6=qs[_0x43e7('0x29')](_0x50f9f5,_0x5087d7);var _0x2bde44={'where':_0x4690a6[_0x43e7('0x2a')]};return db['VoiceQueue'][_0x43e7('0x10')](_0x2bde44)[_0x43e7('0x13')](function(_0x3b8f78){_0x45b675[_0x43e7('0x10')]=_0x3b8f78;_0x4690a6[_0x43e7('0x2b')]=qs['include'](_0x5087d7[_0x43e7('0x2c')]);return db[_0x43e7('0x25')][_0x43e7('0x2d')](_0x4690a6);})[_0x43e7('0x13')](function(_0x4c61b9){_0x45b675['rows']=_0x4c61b9;return _0x45b675;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x2e')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x2f')]=function(_0x117c07,_0x234fe6){var _0x108313={'raw':![],'where':{'id':_0x117c07['params']['id']}},_0xde7ed={};_0xde7ed['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0xde7ed['query']=_['keys'](_0x117c07[_0x43e7('0x2c')]);_0xde7ed['filters']=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],_0xde7ed[_0x43e7('0x2c')]);_0x108313[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x117c07['query']['fields']));_0x108313['attributes']=_0x108313[_0x43e7('0x32')][_0x43e7('0x34')]?_0x108313[_0x43e7('0x32')]:_0xde7ed[_0x43e7('0x31')];if(_0x117c07[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x108313[_0x43e7('0x2b')]=[{'all':!![]}];}_0x108313=_[_0x43e7('0x36')]({},_0x108313,_0x117c07['options']);return db[_0x43e7('0x25')][_0x43e7('0x37')](_0x108313)['then'](handleEntityNotFound(_0x234fe6,null))[_0x43e7('0x13')](respondWithResult(_0x234fe6,null))['catch'](handleError(_0x234fe6,null));};exports[_0x43e7('0x38')]=function(_0x2ad008,_0x1c6f45){return db[_0x43e7('0x25')][_0x43e7('0x38')](_0x2ad008[_0x43e7('0x39')],{})['then'](function(_0x574a93){var _0x30dfa9=_0x2ad008[_0x43e7('0x3a')][_0x43e7('0x15')]({'plain':!![]});if(!_0x30dfa9)throw new Error(_0x43e7('0x3b'));if(_0x30dfa9[_0x43e7('0x3c')]==='user'){var _0x32a451=_0x574a93[_0x43e7('0x15')]({'plain':!![]});var _0x575439=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':_0x43e7('0x18'),'value':'outbound'}];var _0x3d81ae=_[_0x43e7('0x37')](_0x575439,[_0x43e7('0x1b'),_0x32a451[_0x43e7('0x1d')]])['name'];return db['UserProfileSection'][_0x43e7('0x37')]({'where':{'name':_0x3d81ae,'userProfileId':_0x30dfa9[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x36b770){if(_0x36b770&&_0x36b770['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x32a451[_0x43e7('0x21')],'resourceId':_0x32a451['id'],'type':_0x36b770['name'],'sectionId':_0x36b770['id']},{})[_0x43e7('0x13')](function(){return _0x574a93;});}else{return _0x574a93;}})['catch'](function(_0x5b28db){logger[_0x43e7('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b28db);throw _0x5b28db;});}return _0x574a93;})[_0x43e7('0x13')](respondWithResult(_0x1c6f45,0xc9))[_0x43e7('0x2e')](handleError(_0x1c6f45,null));};exports[_0x43e7('0x3f')]=function(_0x99b9e1,_0x4fc5e8){var _0x91f1e4={'where':{'id':_0x99b9e1[_0x43e7('0x40')]['id']}},_0x2b9046={};_0x2b9046[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x25')]['rawAttributes']);_0x91f1e4['attributes']=_[_0x43e7('0x30')](_0x2b9046[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x99b9e1['query']['fields']));_0x91f1e4['attributes']=_0x91f1e4[_0x43e7('0x32')][_0x43e7('0x34')]?_0x91f1e4['attributes']:_0x2b9046[_0x43e7('0x31')];if(_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x91f1e4['include']=[{'all':!![]}];}_0x91f1e4=_['merge']({},_0x91f1e4,_0x99b9e1['options']);return db['VoiceQueue'][_0x43e7('0x37')](_0x91f1e4)[_0x43e7('0x13')](handleEntityNotFound(_0x4fc5e8,null))['then'](function(_0x23e7cb){if(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x15')]({'plain':!![]});_0x82d32f=qs[_0x43e7('0x42')](_0x82d32f,['id','createdAt',_0x43e7('0x43')]);_0x99b9e1['body']=_['omit'](_0x99b9e1[_0x43e7('0x39')],['id',_0x43e7('0x44'),_0x43e7('0x43')]);return db[_0x43e7('0x25')][_0x43e7('0x38')](_[_0x43e7('0x36')](_0x82d32f,_0x99b9e1[_0x43e7('0x39')]),{'include':_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]?[{'all':!![]}]:undefined})[_0x43e7('0x13')](function(_0x58dfd0){var _0x119d34=_0x99b9e1[_0x43e7('0x3a')]['get']({'plain':!![]});if(!_0x119d34)throw new Error(_0x43e7('0x3b'));if(_0x119d34['role']===_0x43e7('0x3a')){var _0x520857=_0x58dfd0[_0x43e7('0x15')]({'plain':!![]});var _0x1f561f=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x43e7('0x45')}];var _0x2ab7ee=_[_0x43e7('0x37')](_0x1f561f,[_0x43e7('0x1b'),_0x520857[_0x43e7('0x1d')]])[_0x43e7('0x21')];return db[_0x43e7('0x46')][_0x43e7('0x37')]({'where':{'name':_0x2ab7ee,'userProfileId':_0x119d34[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x312306){if(_0x312306&&_0x312306['autoAssociation']===0x0){return db[_0x43e7('0x1e')][_0x43e7('0x38')]({'name':_0x520857['name'],'resourceId':_0x520857['id'],'type':_0x312306[_0x43e7('0x21')],'sectionId':_0x312306['id']},{})[_0x43e7('0x13')](function(){return _0x58dfd0;});}else{return _0x58dfd0;}})[_0x43e7('0x2e')](function(_0x558d54){logger['error'](_0x43e7('0x47'),_0x558d54);throw _0x558d54;});}return _0x58dfd0;});}})[_0x43e7('0x13')](respondWithResult(_0x4fc5e8,0xc9))['catch'](handleError(_0x4fc5e8,null));};exports[_0x43e7('0x48')]=function(_0x54506d,_0x49a6ce){if(_0x54506d[_0x43e7('0x39')]['id']){delete _0x54506d[_0x43e7('0x39')]['id'];}return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x54506d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a6ce,null))[_0x43e7('0x13')](saveUpdates(_0x54506d[_0x43e7('0x39')],null))['then'](respondWithResult(_0x49a6ce,null))[_0x43e7('0x2e')](handleError(_0x49a6ce,null));};exports[_0x43e7('0x14')]=function(_0x296a0d,_0x5bb536){return db['VoiceQueue']['find']({'where':{'id':_0x296a0d[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x5bb536,null))[_0x43e7('0x13')](removeEntity(_0x5bb536,null))[_0x43e7('0x2e')](handleError(_0x5bb536,null));};exports['getHoppers']=function(_0x5a50fc,_0x1b27da){var _0x8b50bb={'raw':![],'where':{}};var _0x140438={};var _0x5dd349={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x5a50fc[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1b27da,null))[_0x43e7('0x13')](function(_0x3369b8){if(_0x3369b8){_0x140438[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x4a')][_0x43e7('0x26')]);_0x140438[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x5a50fc['query']);_0x140438['filters']=_[_0x43e7('0x30')](_0x140438['model'],_0x140438['query']);_0x8b50bb['attributes']=_[_0x43e7('0x30')](_0x140438[_0x43e7('0x31')],qs['fields'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x8b50bb[_0x43e7('0x32')]=_0x8b50bb['attributes'][_0x43e7('0x34')]?_0x8b50bb[_0x43e7('0x32')]:_0x140438[_0x43e7('0x31')];if(!_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x8b50bb[_0x43e7('0x11')]=qs['limit'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x8b50bb[_0x43e7('0xe')]=qs['offset'](_0x5a50fc['query'][_0x43e7('0xe')]);}_0x8b50bb['order']=qs['sort'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x8b50bb['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x5a50fc[_0x43e7('0x2c')],_0x140438[_0x43e7('0x4e')]));_0x8b50bb[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x3369b8['id'];if(_0x5a50fc[_0x43e7('0x2c')]['filter']){_0x8b50bb[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x8b50bb['where'],{'$or':_[_0x43e7('0x1a')](_0x8b50bb['attributes'],function(_0x26ee52){var _0x248936={};_0x248936[_0x26ee52]={'$like':'%'+_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x248936;})});}_0x8b50bb=_['merge']({},_0x8b50bb,_0x5a50fc[_0x43e7('0x51')]);return db[_0x43e7('0x4a')][_0x43e7('0x10')]({'where':_0x8b50bb['where']})[_0x43e7('0x13')](function(_0x38fa5b){_0x5dd349[_0x43e7('0x10')]=_0x38fa5b;if(_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x8b50bb['include']=[{'all':!![]}];}return db[_0x43e7('0x4a')][_0x43e7('0x2d')](_0x8b50bb);})[_0x43e7('0x13')](function(_0x2499ef){_0x5dd349[_0x43e7('0x52')]=_0x2499ef;return _0x5dd349;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x1b27da,_0x8b50bb))[_0x43e7('0x2e')](handleError(_0x1b27da,null));};exports['getHopperHistories']=function(_0x499ee9,_0x405faa){var _0x536477={'raw':!![],'where':{}};var _0x550036={};var _0x5b98bf={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x499ee9[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x405faa,null))[_0x43e7('0x13')](function(_0x1ae0c8){if(_0x1ae0c8){_0x550036['model']=_[_0x43e7('0x41')](db[_0x43e7('0x53')][_0x43e7('0x26')]);_0x550036['query']=_[_0x43e7('0x41')](_0x499ee9[_0x43e7('0x2c')]);_0x550036[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x550036[_0x43e7('0x31')],_0x550036[_0x43e7('0x2c')]);_0x536477[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x550036['model'],qs['fields'](_0x499ee9['query'][_0x43e7('0x33')]));_0x536477[_0x43e7('0x32')]=_0x536477['attributes'][_0x43e7('0x34')]?_0x536477[_0x43e7('0x32')]:_0x550036[_0x43e7('0x31')];if(!_0x499ee9[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x536477['limit']=qs[_0x43e7('0x11')](_0x499ee9[_0x43e7('0x2c')]['limit']);_0x536477['offset']=qs[_0x43e7('0xe')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x536477['order']=qs[_0x43e7('0x4d')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x536477[_0x43e7('0x2a')]=qs['filters'](_[_0x43e7('0x4f')](_0x499ee9['query'],_0x550036[_0x43e7('0x4e')]));_0x536477[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1ae0c8['id'];if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x536477[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x536477['where'],{'$or':_[_0x43e7('0x1a')](_0x536477[_0x43e7('0x32')],function(_0x1aea4e){var _0x6fb694={};_0x6fb694[_0x1aea4e]={'$like':'%'+_0x499ee9['query']['filter']+'%'};return _0x6fb694;})});}_0x536477=_['merge']({},_0x536477,_0x499ee9[_0x43e7('0x51')]);return db['CmHopperHistory'][_0x43e7('0x10')]({'where':_0x536477[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x7387f6){_0x5b98bf[_0x43e7('0x10')]=_0x7387f6;if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x536477[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x53')][_0x43e7('0x2d')](_0x536477);})[_0x43e7('0x13')](function(_0x5b3565){_0x5b98bf[_0x43e7('0x52')]=_0x5b3565;return _0x5b98bf;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x405faa,_0x536477))[_0x43e7('0x2e')](handleError(_0x405faa,null));};exports[_0x43e7('0x54')]=function(_0x206e54,_0x4ea4a9){var _0x5e04ec={'raw':!![],'where':{}};var _0x162a27={};var _0x3e3c82={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x206e54[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ea4a9,null))['then'](function(_0x1e869a){if(_0x1e869a){_0x162a27[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x55')][_0x43e7('0x26')]);_0x162a27['query']=_['keys'](_0x206e54[_0x43e7('0x2c')]);_0x162a27[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],_0x162a27['query']);_0x5e04ec[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x206e54['query'][_0x43e7('0x33')]));_0x5e04ec[_0x43e7('0x32')]=_0x5e04ec[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5e04ec[_0x43e7('0x32')]:_0x162a27['model'];if(!_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0x5e04ec[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5e04ec['offset']=qs[_0x43e7('0xe')](_0x206e54['query'][_0x43e7('0xe')]);}_0x5e04ec[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5e04ec[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x206e54[_0x43e7('0x2c')],_0x162a27['filters']));_0x5e04ec[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1e869a['id'];if(_0x206e54[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x5e04ec['where']=_['merge'](_0x5e04ec[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5e04ec[_0x43e7('0x32')],function(_0x4d30f7){var _0x12e7a8={};_0x12e7a8[_0x4d30f7]={'$like':'%'+_0x206e54['query']['filter']+'%'};return _0x12e7a8;})});}_0x5e04ec=_['merge']({},_0x5e04ec,_0x206e54[_0x43e7('0x51')]);return db['CmHopperFinal'][_0x43e7('0x10')]({'where':_0x5e04ec[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x2fea54){_0x3e3c82[_0x43e7('0x10')]=_0x2fea54;if(_0x206e54['query']['includeAll']){_0x5e04ec[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x55')]['findAll'](_0x5e04ec);})[_0x43e7('0x13')](function(_0x10fd28){_0x3e3c82[_0x43e7('0x52')]=_0x10fd28;return _0x3e3c82;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x4ea4a9,_0x5e04ec))[_0x43e7('0x2e')](handleError(_0x4ea4a9,null));};exports[_0x43e7('0x57')]=function(_0x399253,_0x32e698){var _0x39ce5e={'raw':!![],'where':{}};var _0x284617={};var _0x610819={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x399253[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x32e698,null))[_0x43e7('0x13')](function(_0x3286b1){if(_0x3286b1){_0x284617[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x58')][_0x43e7('0x26')]);_0x284617[_0x43e7('0x2c')]=_['keys'](_0x399253[_0x43e7('0x2c')]);_0x284617[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x284617[_0x43e7('0x31')],_0x284617['query']);_0x39ce5e[_0x43e7('0x32')]=_['intersection'](_0x284617[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x399253[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x39ce5e[_0x43e7('0x32')]=_0x39ce5e[_0x43e7('0x32')]['length']?_0x39ce5e[_0x43e7('0x32')]:_0x284617[_0x43e7('0x31')];if(!_0x399253[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x39ce5e['limit']=qs['limit'](_0x399253[_0x43e7('0x2c')]['limit']);_0x39ce5e[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x399253[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x39ce5e['order']=qs['sort'](_0x399253['query'][_0x43e7('0x4d')]);_0x39ce5e['where']=qs['filters'](_['pick'](_0x399253[_0x43e7('0x2c')],_0x284617[_0x43e7('0x4e')]));_0x39ce5e['where'][_0x43e7('0x50')]=_0x3286b1['id'];if(_0x399253['query'][_0x43e7('0x19')]){_0x39ce5e[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x39ce5e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x39ce5e['attributes'],function(_0x1f4162){var _0x449cb4={};_0x449cb4[_0x1f4162]={'$like':'%'+_0x399253[_0x43e7('0x2c')]['filter']+'%'};return _0x449cb4;})});}_0x39ce5e=_['merge']({},_0x39ce5e,_0x399253[_0x43e7('0x51')]);return db[_0x43e7('0x58')][_0x43e7('0x10')]({'where':_0x39ce5e[_0x43e7('0x2a')]})['then'](function(_0x385cc1){_0x610819[_0x43e7('0x10')]=_0x385cc1;if(_0x399253[_0x43e7('0x2c')]['includeAll']){_0x39ce5e[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x58')][_0x43e7('0x2d')](_0x39ce5e);})[_0x43e7('0x13')](function(_0x541ce8){_0x610819[_0x43e7('0x52')]=_0x541ce8;return _0x610819;});}})['then'](respondWithFilteredResult(_0x32e698,_0x39ce5e))[_0x43e7('0x2e')](handleError(_0x32e698,null));};exports[_0x43e7('0x59')]=function(_0x47f29f,_0x4e5484){var _0xc62dc9={};var _0x1480c6={};var _0x21d001;var _0x4600e5;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x47f29f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x4e5484,null))[_0x43e7('0x13')](function(_0xfc577b){if(_0xfc577b){_0x21d001=_0xfc577b;_0x1480c6[_0x43e7('0x31')]=_['keys'](db[_0x43e7('0x5a')]['rawAttributes']);_0x1480c6[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x47f29f[_0x43e7('0x2c')]);_0x1480c6['filters']=_[_0x43e7('0x30')](_0x1480c6[_0x43e7('0x31')],_0x1480c6[_0x43e7('0x2c')]);_0xc62dc9[_0x43e7('0x32')]=_['intersection'](_0x1480c6[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x47f29f['query']['fields']));_0xc62dc9['attributes']=_0xc62dc9[_0x43e7('0x32')][_0x43e7('0x34')]?_0xc62dc9[_0x43e7('0x32')]:_0x1480c6[_0x43e7('0x31')];_0xc62dc9[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0xc62dc9['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x47f29f[_0x43e7('0x2c')],_0x1480c6[_0x43e7('0x4e')]));if(_0x47f29f['query']['filter']){_0xc62dc9[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0xc62dc9[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0xc62dc9['attributes'],function(_0x2f529b){var _0x427cec={};_0x427cec[_0x2f529b]={'$like':'%'+_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x427cec;})});}_0xc62dc9=_[_0x43e7('0x36')]({},_0xc62dc9,_0x47f29f[_0x43e7('0x51')]);return _0x21d001['getTeams'](_0xc62dc9);}})[_0x43e7('0x13')](function(_0x52c974){if(_0x52c974){_0x4600e5=_0x52c974['length'];if(!_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0xc62dc9['limit']=qs[_0x43e7('0x11')](_0x47f29f[_0x43e7('0x2c')]['limit']);_0xc62dc9[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x21d001['getTeams'](_0xc62dc9);}})['then'](function(_0x2a084b){if(_0x2a084b){return _0x2a084b?{'count':_0x4600e5,'rows':_0x2a084b}:null;}})[_0x43e7('0x13')](respondWithResult(_0x4e5484,null))[_0x43e7('0x2e')](handleError(_0x4e5484,null));};exports['addTeams']=function(_0x49de67,_0x298239){var _0xf682ec=_0x49de67[_0x43e7('0x39')][_0x43e7('0x5b')];var _0x1e247f=_[_0x43e7('0x1a')](_0xf682ec,'id');return db[_0x43e7('0x5a')][_0x43e7('0x2d')]({'where':{'id':_0x1e247f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]}]})[_0x43e7('0x13')](function(_0x44fee0){if(_0x44fee0){var _0x41d130=_[_0x43e7('0x5e')](_0x44fee0,function(_0x5e87d6){var _0x21039a=_0x5e87d6[_0x43e7('0x15')]({'plain':!![]});_0x21039a[_0x43e7('0x5f')][_0x43e7('0x60')](function(_0x59f68a){_0x59f68a[_0x43e7('0x61')]=_[_0x43e7('0x37')](_0xf682ec,{'id':_0x21039a['id']})[_0x43e7('0x61')];});return _0x21039a[_0x43e7('0x5f')];});return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x49de67[_0x43e7('0x40')]['id']}})['then'](function(_0xc9356c){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0x3637d9){return _0xc9356c[_0x43e7('0x64')](_0x1e247f,{'transaction':_0x3637d9})['then'](function(){return BPromise[_0x43e7('0x65')](_0xf682ec,function(_0x25ddf8){return db['TeamVoiceQueue'][_0x43e7('0x66')]({'TeamId':_0x25ddf8['id'],'VoiceQueueId':_0x49de67[_0x43e7('0x40')]['id'],'penalty':_0x25ddf8['penalty']},{'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_0x41d130,function(_0x110154){return db[_0x43e7('0x67')][_0x43e7('0x68')]({'where':{'UserId':_0x110154['id'],'VoiceQueueId':_0x49de67['params']['id']},'defaults':{'penalty':_0x110154[_0x43e7('0x61')]},'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_['filter'](_0x41d130,{'online':!![]}),function(_0x32b788){return db[_0x43e7('0x69')]['upsert']({'membername':_0x32b788[_0x43e7('0x21')],'UserId':_0x32b788['id'],'queue_name':_0xc9356c[_0x43e7('0x21')],'VoiceQueueId':_0xc9356c['id'],'interface':_[_0x43e7('0x6a')](_0x32b788[_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x32b788['name']):_0x32b788[_0x43e7('0x5d')],'paused':_0x32b788[_0x43e7('0x6d')]||![],'penalty':_0x32b788[_0x43e7('0x61')]},{'transaction':_0x3637d9});});})['then'](function(){_0x41d130[_0x43e7('0x60')](function(_0x21901c){socket[_0x43e7('0x6e')](_0x43e7('0x6f'),{'UserId':_0x21901c['id'],'VoiceQueueId':_0xc9356c['id']});});});});});}})[_0x43e7('0x13')](respondWithStatusCode(_0x298239,null))[_0x43e7('0x2e')](handleError(_0x298239,null));};exports[_0x43e7('0x70')]=function(_0x1896b3,_0x4345a5){return db['Team'][_0x43e7('0x2d')]({'where':{'id':_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x43e7('0x72')],'as':_0x43e7('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x43e7('0x13')](handleEntityNotFound(_0x4345a5,null))[_0x43e7('0x13')](function(_0x3e8631){var _0x51e17c=_[_0x43e7('0x1a')](_0x3e8631,'id');var _0x6246c4=[];var _0xd0dca2=[];var _0xa721ba=squel[_0x43e7('0x73')]();_0xa721ba['field'](_0x43e7('0x74'))[_0x43e7('0x75')](_0x43e7('0x76'),'tq')[_0x43e7('0x77')](_0x43e7('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x1896b3[_0x43e7('0x40')]['id']);for(var _0x339826=0x0;_0x339826<_0x3e8631[_0x43e7('0x34')];_0x339826+=0x1){let _0xc28ac6=_0x3e8631[_0x339826];for(var _0x4b0abd=0x0;_0x4b0abd<_0xc28ac6[_0x43e7('0x5f')][_0x43e7('0x34')];_0x4b0abd+=0x1){let _0x41d636=_0xc28ac6[_0x43e7('0x5f')][_0x4b0abd];var _0x19bdf7=_0xa721ba[_0x43e7('0x3f')]();_0x19bdf7[_0x43e7('0x2a')](_0x43e7('0x79'),_0x41d636['id']);_0xd0dca2[_0x43e7('0x7a')](db[_0x43e7('0x62')][_0x43e7('0x2c')](_0x19bdf7['toString'](),{'type':db['sequelize'][_0x43e7('0x7b')]['SELECT']})['then'](function(_0x4a0d5d){if(_0x4a0d5d[_0x43e7('0x34')]===0x1){return _0x41d636['id'];}else{var _0x5eae45=_[_0x43e7('0x7c')](_['map'](_0x4a0d5d,'TeamId'),function(_0x55f1df){return _[_0x43e7('0x1c')](_0x51e17c,_0x55f1df);});if(_0x5eae45){return _0x41d636['id'];}}}));}}return BPromise[_0x43e7('0x7d')](_0xd0dca2)[_0x43e7('0x13')](function(_0xd6ebb0){_0x6246c4=_(_0x6246c4)[_0x43e7('0x7e')](_0xd6ebb0)[_0x43e7('0x7f')]()[_0x43e7('0x1b')]();return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1896b3[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](function(_0x2a1218){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0xe14e67){return _0x2a1218[_0x43e7('0x70')](_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')],{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){if(!_[_0x43e7('0x80')](_0x6246c4)){return _0x2a1218['removeAgents'](_0x6246c4,{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x1896b3[_0x43e7('0x40')]['id'],'UserId':_0x6246c4},'transaction':_0xe14e67});});}})[_0x43e7('0x13')](function(){_0x6246c4[_0x43e7('0x60')](function(_0x32b33c){socket['emit'](_0x43e7('0x81'),{'UserId':_0x32b33c,'VoiceQueueId':_0x2a1218['id']});});});});});});})[_0x43e7('0x13')](respondWithStatusCode(_0x4345a5,null))['catch'](handleError(_0x4345a5,null));};exports[_0x43e7('0x82')]=function(_0x1a520e,_0xb4cf23){var _0x559145,_0x22b824;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1a520e[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0xb4cf23,null))['then'](function(_0x33b63b){if(_0x33b63b){_0x22b824=_0x33b63b;return _0x33b63b[_0x43e7('0x82')](_0x1a520e['body'][_0x43e7('0x71')],_['omit'](_0x1a520e['body'],['ids','id'])||{})['spread'](function(_0x255113){for(var _0x451fb5=0x0;_0x451fb5<_0x1a520e[_0x43e7('0x39')][_0x43e7('0x71')]['length'];_0x451fb5+=0x1){socket['emit'](_0x43e7('0x6f'),{'UserId':Number(_0x1a520e['body'][_0x43e7('0x71')][_0x451fb5]),'VoiceQueueId':Number(_0x1a520e['params']['id'])});}return _0x255113;});}})[_0x43e7('0x13')](function(_0x4cf7e9){_0x559145=_0x4cf7e9||[];if(_0x22b824){return db['User']['findAll']({'where':{'id':_0x1a520e['body'][_0x43e7('0x71')]},'attributes':['id',_0x43e7('0x21'),_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]});}})[_0x43e7('0x13')](function(_0x517289){if(!_['isEmpty'](_0x517289)){var _0x25fd39=[];for(var _0xb2aca0=0x0;_0xb2aca0<_0x517289[_0x43e7('0x34')];_0xb2aca0++){if(_0x517289[_0xb2aca0][_0x43e7('0x5c')]){_0x25fd39['push'](db[_0x43e7('0x69')]['upsert']({'membername':_0x517289[_0xb2aca0][_0x43e7('0x21')],'UserId':_0x517289[_0xb2aca0]['id'],'queue_name':_0x22b824[_0x43e7('0x21')],'VoiceQueueId':_0x22b824['id'],'interface':_[_0x43e7('0x6a')](_0x517289[_0xb2aca0][_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x517289[_0xb2aca0][_0x43e7('0x21')]):_0x517289[_0xb2aca0]['interface'],'paused':_0x517289[_0xb2aca0][_0x43e7('0x6d')]||![],'penalty':_0x1a520e[_0x43e7('0x39')]['penalty']||0x0}));}}return BPromise[_0x43e7('0x7d')](_0x25fd39);}})[_0x43e7('0x13')](function(){return _0x559145;})[_0x43e7('0x13')](respondWithResult(_0xb4cf23,null))[_0x43e7('0x2e')](handleError(_0xb4cf23,null));};exports[_0x43e7('0x83')]=function(_0x4fd17e,_0x3fd573){return db['VoiceQueue'][_0x43e7('0x37')]({'where':{'id':_0x4fd17e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3fd573,null))[_0x43e7('0x13')](function(_0x4446cb){if(_0x4446cb){return _0x4446cb[_0x43e7('0x83')](_0x4fd17e[_0x43e7('0x2c')]['ids'])[_0x43e7('0x13')](function(){if(_['isArray'](_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')])){for(var _0x34d476=0x0;_0x34d476<_0x4fd17e['query'][_0x43e7('0x71')][_0x43e7('0x34')];_0x34d476+=0x1){socket[_0x43e7('0x6e')](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')]['ids'][_0x34d476]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}}else{socket['emit'](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}});}})[_0x43e7('0x13')](function(_0x34ed9e){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x4fd17e[_0x43e7('0x40')]['id'],'UserId':_0x4fd17e['query'][_0x43e7('0x71')]}})[_0x43e7('0x13')](function(){return _0x34ed9e;});})[_0x43e7('0x13')](respondWithStatusCode(_0x3fd573,null))[_0x43e7('0x2e')](handleError(_0x3fd573,null));};exports[_0x43e7('0x84')]=function(_0xf9178f,_0x3bb7ab){var _0x2be8c7={};var _0x2bb14d={};var _0x57f7ea;var _0x240478;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0xf9178f[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bb7ab,null))[_0x43e7('0x13')](function(_0x381e47){if(_0x381e47){_0x57f7ea=_0x381e47;_0x2bb14d['model']=_[_0x43e7('0x41')](db[_0x43e7('0x72')][_0x43e7('0x26')]);_0x2bb14d[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0xf9178f[_0x43e7('0x2c')]);_0x2bb14d[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2bb14d['model'],_0x2bb14d[_0x43e7('0x2c')]);_0x2be8c7[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2bb14d['model'],qs[_0x43e7('0x33')](_0xf9178f[_0x43e7('0x2c')]['fields']));_0x2be8c7[_0x43e7('0x32')]=_0x2be8c7[_0x43e7('0x32')]['length']?_0x2be8c7[_0x43e7('0x32')]:_0x2bb14d[_0x43e7('0x31')];_0x2be8c7[_0x43e7('0x56')]=qs['sort'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x2be8c7['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0xf9178f[_0x43e7('0x2c')],_0x2bb14d[_0x43e7('0x4e')]));if(_0xf9178f['query']['filter']){_0x2be8c7[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x2be8c7[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x2be8c7['attributes'],function(_0x1e6245){var _0x36860d={};_0x36860d[_0x1e6245]={'$like':'%'+_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x36860d;})});}_0x2be8c7=_['merge']({},_0x2be8c7,_0xf9178f[_0x43e7('0x51')]);return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x3ff5d6){if(_0x3ff5d6){_0x240478=_0x3ff5d6[_0x43e7('0x34')];if(!_0xf9178f['query']['hasOwnProperty']('nolimit')){_0x2be8c7[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0xf9178f[_0x43e7('0x2c')]['limit']);_0x2be8c7[_0x43e7('0xe')]=qs['offset'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x249a8d){if(_0x249a8d){return _0x249a8d?{'count':_0x240478,'rows':_0x249a8d}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3bb7ab,null))['catch'](handleError(_0x3bb7ab,null));};exports[_0x43e7('0x85')]=function(_0x202421,_0x12e4a3){var _0x16ca0e={};var _0x2f467b={};var _0x7f43b5;var _0x4637f6;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x202421[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x12e4a3,null))[_0x43e7('0x13')](function(_0x24e9a7){if(_0x24e9a7){_0x7f43b5=_0x24e9a7;_0x2f467b['model']=_[_0x43e7('0x41')](db[_0x43e7('0x69')]['rawAttributes']);_0x2f467b[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x202421['query']);_0x2f467b[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],_0x2f467b['query']);_0x16ca0e['attributes']=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x16ca0e[_0x43e7('0x32')]=_0x16ca0e[_0x43e7('0x32')][_0x43e7('0x34')]?_0x16ca0e['attributes']:_0x2f467b[_0x43e7('0x31')];_0x16ca0e[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x16ca0e[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x202421[_0x43e7('0x2c')],_0x2f467b[_0x43e7('0x4e')]));if(_0x202421[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x16ca0e['where']=_[_0x43e7('0x36')](_0x16ca0e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x16ca0e[_0x43e7('0x32')],function(_0x49f43c){var _0xad02f6={};_0xad02f6[_0x49f43c]={'$like':'%'+_0x202421['query'][_0x43e7('0x19')]+'%'};return _0xad02f6;})});}_0x16ca0e=_['merge']({},_0x16ca0e,_0x202421[_0x43e7('0x51')]);return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})[_0x43e7('0x13')](function(_0x4a500c){if(_0x4a500c){_0x4637f6=_0x4a500c[_0x43e7('0x34')];if(!_0x202421[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x16ca0e['limit']=qs[_0x43e7('0x11')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x16ca0e[_0x43e7('0xe')]=qs['offset'](_0x202421[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})['then'](function(_0x12c4f9){return _0x12c4f9?{'count':_0x4637f6,'rows':_0x12c4f9}:null;})[_0x43e7('0x13')](respondWithResult(_0x12e4a3,null))[_0x43e7('0x2e')](handleError(_0x12e4a3,null));};exports[_0x43e7('0x86')]=function(_0x77c2f,_0x1e4a25){var _0x5790b5={};var _0x3f057e={};var _0x505287;var _0x221938;return db[_0x43e7('0x25')]['findOne']({'where':{'id':_0x77c2f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1e4a25,null))['then'](function(_0x46aa47){if(_0x46aa47){_0x505287=_0x46aa47;_0x3f057e[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x87')]['rawAttributes']);_0x3f057e['query']=_[_0x43e7('0x41')](_0x77c2f[_0x43e7('0x2c')]);_0x3f057e[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x3f057e[_0x43e7('0x31')],_0x3f057e[_0x43e7('0x2c')]);_0x5790b5[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x3f057e['model'],qs[_0x43e7('0x33')](_0x77c2f[_0x43e7('0x2c')]['fields']));_0x5790b5[_0x43e7('0x32')]=_0x5790b5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5790b5[_0x43e7('0x32')]:_0x3f057e[_0x43e7('0x31')];_0x5790b5[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x77c2f['query'][_0x43e7('0x4d')]);_0x5790b5['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x77c2f['query'],_0x3f057e[_0x43e7('0x4e')]));if(_0x77c2f['query'][_0x43e7('0x19')]){_0x5790b5[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5790b5['where'],{'$or':_['map'](_0x5790b5[_0x43e7('0x32')],function(_0xcfecd2){var _0x4cd879={};_0x4cd879[_0xcfecd2]={'$like':'%'+_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x4cd879;})});}_0x5790b5=_[_0x43e7('0x36')]({},_0x5790b5,_0x77c2f['options']);return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0xb2eb62){if(_0xb2eb62){_0x221938=_0xb2eb62['length'];if(!_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x5790b5[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x77c2f[_0x43e7('0x2c')]['limit']);_0x5790b5[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x77c2f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0x34ab5a){if(_0x34ab5a){return _0x34ab5a?{'count':_0x221938,'rows':_0x34ab5a}:null;}})[_0x43e7('0x13')](respondWithResult(_0x1e4a25,null))[_0x43e7('0x2e')](handleError(_0x1e4a25,null));};exports[_0x43e7('0x88')]=function(_0x13133c,_0x288d6a){var _0x47ef9d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x56598f,_0x280668;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x13133c[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x288d6a,null))[_0x43e7('0x13')](function(_0x51dc07){if(_0x51dc07){_0x280668=_0x51dc07;return _0x51dc07['addLists'](_0x13133c[_0x43e7('0x39')][_0x43e7('0x71')],_['omit'](_0x13133c['body'],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x58a783){var _0x3d6659;_0x56598f=_0x58a783||[];var _0x57bcab=[];if(_0x58a783){for(var _0x5f4023=0x0;_0x5f4023<_0x58a783[_0x43e7('0x34')];_0x5f4023+=0x1){var _0x2be66d=_0x58a783[_0x5f4023]['get']({'plain':!![]});_0x280668['dialCheckDuplicateType']=_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]?_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]:_0x280668['dialCheckDuplicateType'];switch(_0x280668[_0x43e7('0x8a')]){case _0x43e7('0x8b'):_0x3d6659=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8d'),'ContactId','ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')]('phone',_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))['field'](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')]['toString']())[_0x43e7('0x2a')]('phone\x20IS\x20NOT\x20NULL')[_0x43e7('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x43e7('0x73')]()['field'](_0x43e7('0x95'))[_0x43e7('0x75')](_0x43e7('0x96'))[_0x43e7('0x2a')](_0x43e7('0x97'),_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]()))[_0x43e7('0x2a')](_0x43e7('0x98'),squel[_0x43e7('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x43e7('0x99'))['where']('VoiceQueueId\x20=\x20?',_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;case _0x43e7('0x9a'):_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0x99'))[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),'ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel['select']()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))['field'](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))['where'](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e'))['where'](_0x43e7('0x98'),squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x9f'))['from']('cm_hopper')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x13133c['params']['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;default:_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper')[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),'createdAt','updatedAt'],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))['field']('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),'ListId')[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))[_0x43e7('0x75')]('cm_contacts')[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();}_0x57bcab['push'](db['sequelize'][_0x43e7('0x2c')](_0x3d6659));}return BPromise[_0x43e7('0x7d')](_0x57bcab);}})[_0x43e7('0x13')](function(){var _0x3ac223=[];var _0x486780=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0xa1'))[_0x43e7('0x9d')]([_0x43e7('0xa2'),_0x43e7('0x8c'),_0x43e7('0xa3'),'createdAt',_0x43e7('0x43')],squel['select']()['field']('h.id')[_0x43e7('0x8e')](_0x43e7('0xa4'))[_0x43e7('0x8e')](_0x43e7('0xa5'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0xa6'),'ci')['join'](_0x43e7('0x99'),'h',_0x43e7('0xa7'))[_0x43e7('0x2a')](_0x43e7('0xa8'),_0x47ef9d)['where']('ci.ItemClass=?',_0x43e7('0xa9')))[_0x43e7('0x91')]();_0x3ac223['push'](db['sequelize'][_0x43e7('0x2c')](_0x486780));return BPromise[_0x43e7('0x7d')](_0x3ac223);})[_0x43e7('0x13')](function(){return _0x56598f;})[_0x43e7('0x13')](respondWithResult(_0x288d6a,null))[_0x43e7('0x2e')](handleError(_0x288d6a,null));};exports[_0x43e7('0xaa')]=function(_0x71807e,_0x314259){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x71807e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x314259,null))[_0x43e7('0x13')](function(_0x2613fc){if(_0x2613fc){return _0x2613fc[_0x43e7('0xaa')](_0x71807e['query'][_0x43e7('0x71')]);}})['then'](function(_0x17b298){if(_0x17b298){return db[_0x43e7('0x4a')][_0x43e7('0x14')]({'where':{'ListId':_0x71807e[_0x43e7('0x2c')]['ids'],'VoiceQueueId':_0x71807e['params']['id']}})[_0x43e7('0x13')](function(){return _0x17b298;});}})['then'](respondWithStatusCode(_0x314259,null))[_0x43e7('0x2e')](handleError(_0x314259,null));};exports[_0x43e7('0xab')]=function(_0x44c536,_0x3a9550){var _0x5dcd3f={};var _0x2e7f00={};var _0x2627e2;var _0x591517;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x44c536[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3a9550,null))[_0x43e7('0x13')](function(_0x5e042f){if(_0x5e042f){_0x2627e2=_0x5e042f;_0x2e7f00['model']=_[_0x43e7('0x41')](db[_0x43e7('0x87')][_0x43e7('0x26')]);_0x2e7f00[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x44c536[_0x43e7('0x2c')]);_0x2e7f00[_0x43e7('0x4e')]=_['intersection'](_0x2e7f00[_0x43e7('0x31')],_0x2e7f00[_0x43e7('0x2c')]);_0x5dcd3f[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2e7f00[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x5dcd3f[_0x43e7('0x32')]=_0x5dcd3f[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5dcd3f[_0x43e7('0x32')]:_0x2e7f00[_0x43e7('0x31')];_0x5dcd3f[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5dcd3f['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x44c536[_0x43e7('0x2c')],_0x2e7f00[_0x43e7('0x4e')]));if(_0x44c536[_0x43e7('0x2c')]['filter']){_0x5dcd3f[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5dcd3f[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5dcd3f[_0x43e7('0x32')],function(_0x5278fd){var _0x84b4f4={};_0x84b4f4[_0x5278fd]={'$like':'%'+_0x44c536['query']['filter']+'%'};return _0x84b4f4;})});}_0x5dcd3f=_['merge']({},_0x5dcd3f,_0x44c536[_0x43e7('0x51')]);return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x4ee587){if(_0x4ee587){_0x591517=_0x4ee587[_0x43e7('0x34')];if(!_0x44c536[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x5dcd3f[_0x43e7('0x11')]=qs['limit'](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5dcd3f[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x44c536[_0x43e7('0x2c')]['offset']);}return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x3b641e){if(_0x3b641e){return _0x3b641e?{'count':_0x591517,'rows':_0x3b641e}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3a9550,null))[_0x43e7('0x2e')](handleError(_0x3a9550,null));};exports['addBlackLists']=function(_0x5b046d,_0x4a0427){var _0xc3460c;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x5b046d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4a0427,null))[_0x43e7('0x13')](function(_0x19c1d2){if(_0x19c1d2){return _0x19c1d2[_0x43e7('0xac')](_0x5b046d['body'][_0x43e7('0x71')],_['omit'](_0x5b046d[_0x43e7('0x39')],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x40cc83){var _0x148d72;_0xc3460c=_0x40cc83||[];var _0x1ceb94=[];if(_0x40cc83){for(var _0x19c29b=0x0;_0x19c29b<_0x40cc83[_0x43e7('0x34')];_0x19c29b+=0x1){var _0x38a8db=_0x40cc83[_0x19c29b]['get']({'plain':!![]});_0x148d72=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper_black')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('id','ContactId')[_0x43e7('0x8e')](_0x38a8db['CmListId'][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x5b046d[_0x43e7('0x40')]['id']['toString'](),_0x43e7('0x50'))[_0x43e7('0x8e')]('NOW()',_0x43e7('0x44'))[_0x43e7('0x8e')](_0x43e7('0xad'),_0x43e7('0x43'))[_0x43e7('0x75')](_0x43e7('0x93'))[_0x43e7('0x2a')]('deletedAt\x20IS\x20NULL')[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x38a8db[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();_0x1ceb94[_0x43e7('0x7a')](db[_0x43e7('0x62')]['query'](_0x148d72));}return BPromise[_0x43e7('0x7d')](_0x1ceb94);}})['then'](function(){return _0xc3460c;})[_0x43e7('0x13')](respondWithResult(_0x4a0427,null))[_0x43e7('0x2e')](handleError(_0x4a0427,null));};exports[_0x43e7('0xae')]=function(_0x1dc579,_0x6d9fb){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1dc579['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x6d9fb,null))['then'](function(_0x59ca95){if(_0x59ca95){return _0x59ca95[_0x43e7('0xae')](_0x1dc579['query']['ids']);}})[_0x43e7('0x13')](function(_0x759eb5){if(_0x759eb5){return db[_0x43e7('0x58')][_0x43e7('0x14')]({'where':{'ListId':_0x1dc579['query'][_0x43e7('0x71')],'VoiceQueueId':_0x1dc579['params']['id']}})[_0x43e7('0x13')](function(){return _0x759eb5;});}})[_0x43e7('0x13')](respondWithStatusCode(_0x6d9fb,null))[_0x43e7('0x2e')](handleError(_0x6d9fb,null));}; \ No newline at end of file +var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x4b84[_0x3fd3a3];return _0xa3e4d5;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 0c5cad9..981959f 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 _0xf866=['VoiceQueue','setMaxListeners','save','remove','emit','hook','events'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xf866,0x1e2));var _0x6f86=function(_0x32c1e8,_0x1bf7d1){_0x32c1e8=_0x32c1e8-0x0;var _0x46d9d4=_0xf866[_0x32c1e8];return _0x46d9d4;};'use strict';var EventEmitter=require(_0x6f86('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x6f86('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6f86('0x2')](0x0);var events={'afterCreate':_0x6f86('0x3'),'afterUpdate':'update','afterDestroy':_0x6f86('0x4')};function emitEvent(_0x37c457){return function(_0x5d3307,_0x1016e4,_0x177885){VoiceQueueEvents[_0x6f86('0x5')](_0x37c457+':'+_0x5d3307['id'],_0x5d3307);VoiceQueueEvents[_0x6f86('0x5')](_0x37c457,_0x5d3307);_0x177885(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x6f86('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x9dcf=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0x9dcf,0x114));var _0xf9dc=function(_0x58d937,_0x3550de){_0x58d937=_0x58d937-0x0;var _0x445496=_0x9dcf[_0x58d937];return _0x445496;};'use strict';var EventEmitter=require(_0xf9dc('0x0'));var VoiceQueue=require(_0xf9dc('0x1'))['db'][_0xf9dc('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf9dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf9dc('0x4'),'afterDestroy':_0xf9dc('0x5')};function emitEvent(_0x5a0d8f){return function(_0x3d6c24,_0x49499b,_0xfbdf70){VoiceQueueEvents['emit'](_0x5a0d8f+':'+_0x3d6c24['id'],_0x3d6c24);VoiceQueueEvents[_0xf9dc('0x6')](_0x5a0d8f,_0x3d6c24);_0xfbdf70(null);};}for(var e in events){if(events[_0xf9dc('0x7')](e)){var event=events[e];VoiceQueue[_0xf9dc('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 654dcaf..cd5a7f1 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x400fae,_0x437273){var _0x5b100a=function(_0x10192){while(--_0x10192){_0x400fae['push'](_0x400fae['shift']());}};_0x5b100a(++_0x437273);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x4031c0,_0x4df123){var _0x2f3527=function(_0x5ad852){while(--_0x5ad852){_0x4031c0['push'](_0x4031c0['shift']());}};_0x2f3527(++_0x4df123);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 15e5276..62c2f9d 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 _0x9141=['info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowVoiceQueue','util','moment','randomstring','ioredis','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then'];(function(_0x6b4826,_0x3ec6a3){var _0x2605eb=function(_0x1a976b){while(--_0x1a976b){_0x6b4826['push'](_0x6b4826['shift']());}};_0x2605eb(++_0x3ec6a3);}(_0x9141,0x85));var _0x1914=function(_0x1e51ad,_0x5a8c9e){_0x1e51ad=_0x1e51ad-0x0;var _0x15435f=_0x9141[_0x1e51ad];return _0x15435f;};'use strict';var _=require('lodash');var util=require(_0x1914('0x0'));var moment=require(_0x1914('0x1'));var BPromise=require('bluebird');var rs=require(_0x1914('0x2'));var fs=require('fs');var Redis=require(_0x1914('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1914('0x4'));var config=require(_0x1914('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1914('0x6')][_0x1914('0x7')]({'port':0x232a});config[_0x1914('0x8')]=_[_0x1914('0x9')](config[_0x1914('0x8')],{'host':_0x1914('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1914('0x8')]));require(_0x1914('0xb'))[_0x1914('0xc')](socket);function respondWithRpcPromise(_0x4cadfc,_0x25da32,_0x2dae3e){return new BPromise(function(_0x60ccc,_0x52245c){return client[_0x1914('0xd')](_0x4cadfc,_0x2dae3e)[_0x1914('0xe')](function(_0x182a50){logger[_0x1914('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x25da32,_0x1914('0x10'));logger[_0x1914('0x11')](_0x1914('0x12'),_0x25da32,_0x1914('0x10'),JSON[_0x1914('0x13')](_0x182a50));if(_0x182a50['error']){if(_0x182a50['error']['code']===0x1f4){logger[_0x1914('0x14')](_0x1914('0x15'),_0x25da32,_0x182a50['error']['message']);return _0x52245c(_0x182a50[_0x1914('0x14')][_0x1914('0x16')]);}logger[_0x1914('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x25da32,_0x182a50[_0x1914('0x14')][_0x1914('0x16')]);return _0x60ccc(_0x182a50['error'][_0x1914('0x16')]);}else{logger[_0x1914('0xf')](_0x1914('0x15'),_0x25da32,_0x1914('0x10'));_0x60ccc(_0x182a50[_0x1914('0x17')][_0x1914('0x16')]);}})[_0x1914('0x18')](function(_0x134165){logger[_0x1914('0x14')](_0x1914('0x15'),_0x25da32,_0x134165);_0x52245c(_0x134165);});});}exports[_0x1914('0x19')]=function(_0x4b2cc5){var _0xbb2d96=this;return new Promise(function(_0x33be40,_0xc3b32c){return db[_0x1914('0x1a')][_0x1914('0x1b')]({'raw':_0x4b2cc5[_0x1914('0x1c')]?_0x4b2cc5[_0x1914('0x1c')][_0x1914('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b2cc5[_0x1914('0x1c')]?_0x4b2cc5[_0x1914('0x1c')][_0x1914('0x1e')]||null:null,'attributes':_0x4b2cc5['options']?_0x4b2cc5[_0x1914('0x1c')]['attributes']||null:null,'limit':_0x4b2cc5[_0x1914('0x1c')]?_0x4b2cc5[_0x1914('0x1c')][_0x1914('0x1f')]||null:null,'include':_0x4b2cc5['options']?_0x4b2cc5[_0x1914('0x1c')]['include']?_[_0x1914('0x20')](_0x4b2cc5['options'][_0x1914('0x21')],function(_0x1943d7){return{'model':db[_0x1943d7[_0x1914('0x22')]],'as':_0x1943d7['as'],'attributes':_0x1943d7[_0x1914('0x23')],'include':_0x1943d7[_0x1914('0x21')]?_[_0x1914('0x20')](_0x1943d7[_0x1914('0x21')],function(_0x386e73){return{'model':db[_0x386e73[_0x1914('0x22')]],'as':_0x386e73['as'],'attributes':_0x386e73[_0x1914('0x23')],'include':_0x386e73[_0x1914('0x21')]?_[_0x1914('0x20')](_0x386e73['include'],function(_0x35f76b){return{'model':db[_0x35f76b[_0x1914('0x22')]],'as':_0x35f76b['as'],'attributes':_0x35f76b[_0x1914('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc518cb){logger['info'](_0x1914('0x19'),_0x4b2cc5);logger['debug'](_0x1914('0x19'),_0x4b2cc5,JSON[_0x1914('0x13')](_0xc518cb));_0x33be40(_0xc518cb);})['catch'](function(_0x144ee6){logger[_0x1914('0x14')](_0x1914('0x19'),_0x144ee6['message'],_0x4b2cc5);_0xc3b32c(_0xbb2d96[_0x1914('0x14')](0x1f4,_0x144ee6[_0x1914('0x16')]));});});};exports[_0x1914('0x24')]=function(_0x5927a0){var _0x48c015=this;return new Promise(function(_0x3bfff6,_0x2754b7){return db[_0x1914('0x1a')]['find']({'raw':_0x5927a0[_0x1914('0x1c')]?_0x5927a0['options'][_0x1914('0x1d')]===undefined?!![]:![]:!![],'where':_0x5927a0[_0x1914('0x1c')]?_0x5927a0[_0x1914('0x1c')][_0x1914('0x1e')]||null:null,'attributes':_0x5927a0[_0x1914('0x1c')]?_0x5927a0['options'][_0x1914('0x23')]||null:null,'include':_0x5927a0['options']?_0x5927a0[_0x1914('0x1c')][_0x1914('0x21')]?_[_0x1914('0x20')](_0x5927a0['options']['include'],function(_0x4518e6){return{'model':db[_0x4518e6['model']],'as':_0x4518e6['as'],'attributes':_0x4518e6[_0x1914('0x23')],'include':_0x4518e6[_0x1914('0x21')]?_[_0x1914('0x20')](_0x4518e6[_0x1914('0x21')],function(_0x1efa47){return{'model':db[_0x1efa47[_0x1914('0x22')]],'as':_0x1efa47['as'],'attributes':_0x1efa47['attributes'],'include':_0x1efa47[_0x1914('0x21')]?_[_0x1914('0x20')](_0x1efa47[_0x1914('0x21')],function(_0x23bc13){return{'model':db[_0x23bc13[_0x1914('0x22')]],'as':_0x23bc13['as'],'attributes':_0x23bc13[_0x1914('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1914('0xe')](function(_0x5cb692){logger['info'](_0x1914('0x24'),_0x5927a0);logger[_0x1914('0x11')](_0x1914('0x24'),_0x5927a0,JSON['stringify'](_0x5cb692));_0x3bfff6(_0x5cb692);})[_0x1914('0x18')](function(_0x29fe47){logger[_0x1914('0x14')](_0x1914('0x24'),_0x29fe47[_0x1914('0x16')],_0x5927a0);_0x2754b7(_0x48c015[_0x1914('0x14')](0x1f4,_0x29fe47[_0x1914('0x16')]));});});}; \ No newline at end of file +var _0x08a3=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','raw','attributes','limit','include','model','then','GetVoiceQueue','where','map','ShowVoiceQueue','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x08a3,0xbc));var _0x308a=function(_0x4837a0,_0x524ae3){_0x4837a0=_0x4837a0-0x0;var _0xb28920=_0x08a3[_0x4837a0];return _0xb28920;};'use strict';var _=require('lodash');var util=require(_0x308a('0x0'));var moment=require(_0x308a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x308a('0x2'))['db'];var utils=require(_0x308a('0x3'));var logger=require(_0x308a('0x4'))('rpc');var config=require(_0x308a('0x5'));var jayson=require(_0x308a('0x6'));var client=jayson['client'][_0x308a('0x7')]({'port':0x232a});config['redis']=_[_0x308a('0x8')](config[_0x308a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x308a('0xa'))(new Redis(config[_0x308a('0x9')]));require(_0x308a('0xb'))[_0x308a('0xc')](socket);function respondWithRpcPromise(_0x52a59a,_0x16663d,_0x68b2b5){return new BPromise(function(_0x41ef66,_0x42e043){return client[_0x308a('0xd')](_0x52a59a,_0x68b2b5)['then'](function(_0x50560b){logger[_0x308a('0xe')](_0x308a('0xf'),_0x16663d,_0x308a('0x10'));logger[_0x308a('0x11')](_0x308a('0x12'),_0x16663d,_0x308a('0x10'),JSON[_0x308a('0x13')](_0x50560b));if(_0x50560b[_0x308a('0x14')]){if(_0x50560b[_0x308a('0x14')][_0x308a('0x15')]===0x1f4){logger[_0x308a('0x14')](_0x308a('0xf'),_0x16663d,_0x50560b[_0x308a('0x14')]['message']);return _0x42e043(_0x50560b['error']['message']);}logger['error'](_0x308a('0xf'),_0x16663d,_0x50560b[_0x308a('0x14')][_0x308a('0x16')]);return _0x41ef66(_0x50560b[_0x308a('0x14')][_0x308a('0x16')]);}else{logger['info'](_0x308a('0xf'),_0x16663d,_0x308a('0x10'));_0x41ef66(_0x50560b[_0x308a('0x17')][_0x308a('0x16')]);}})[_0x308a('0x18')](function(_0x59d5cc){logger[_0x308a('0x14')](_0x308a('0xf'),_0x16663d,_0x59d5cc);_0x42e043(_0x59d5cc);});});}exports['GetVoiceQueue']=function(_0x4d6261){var _0x58296b=this;return new Promise(function(_0x1c058d,_0x408d58){return db[_0x308a('0x19')][_0x308a('0x1a')]({'raw':_0x4d6261[_0x308a('0x1b')]?_0x4d6261[_0x308a('0x1b')][_0x308a('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d6261[_0x308a('0x1b')]?_0x4d6261[_0x308a('0x1b')]['where']||null:null,'attributes':_0x4d6261['options']?_0x4d6261[_0x308a('0x1b')][_0x308a('0x1d')]||null:null,'limit':_0x4d6261[_0x308a('0x1b')]?_0x4d6261['options'][_0x308a('0x1e')]||null:null,'include':_0x4d6261['options']?_0x4d6261[_0x308a('0x1b')]['include']?_['map'](_0x4d6261[_0x308a('0x1b')][_0x308a('0x1f')],function(_0x7d97ef){return{'model':db[_0x7d97ef[_0x308a('0x20')]],'as':_0x7d97ef['as'],'attributes':_0x7d97ef['attributes'],'include':_0x7d97ef[_0x308a('0x1f')]?_['map'](_0x7d97ef['include'],function(_0x38224b){return{'model':db[_0x38224b['model']],'as':_0x38224b['as'],'attributes':_0x38224b[_0x308a('0x1d')],'include':_0x38224b[_0x308a('0x1f')]?_['map'](_0x38224b[_0x308a('0x1f')],function(_0x2c0cf5){return{'model':db[_0x2c0cf5['model']],'as':_0x2c0cf5['as'],'attributes':_0x2c0cf5['attributes']};}):[]};}):[]};}):[]:[]})[_0x308a('0x21')](function(_0x2448e8){logger[_0x308a('0xe')](_0x308a('0x22'),_0x4d6261);logger[_0x308a('0x11')](_0x308a('0x22'),_0x4d6261,JSON[_0x308a('0x13')](_0x2448e8));_0x1c058d(_0x2448e8);})[_0x308a('0x18')](function(_0x17d834){logger['error']('GetVoiceQueue',_0x17d834[_0x308a('0x16')],_0x4d6261);_0x408d58(_0x58296b[_0x308a('0x14')](0x1f4,_0x17d834[_0x308a('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x13ad74){var _0x2abf3f=this;return new Promise(function(_0xb97c9e,_0x4d611b){return db[_0x308a('0x19')]['find']({'raw':_0x13ad74['options']?_0x13ad74[_0x308a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x13ad74['options']?_0x13ad74[_0x308a('0x1b')][_0x308a('0x23')]||null:null,'attributes':_0x13ad74['options']?_0x13ad74[_0x308a('0x1b')]['attributes']||null:null,'include':_0x13ad74[_0x308a('0x1b')]?_0x13ad74[_0x308a('0x1b')][_0x308a('0x1f')]?_[_0x308a('0x24')](_0x13ad74[_0x308a('0x1b')][_0x308a('0x1f')],function(_0x3e5129){return{'model':db[_0x3e5129['model']],'as':_0x3e5129['as'],'attributes':_0x3e5129[_0x308a('0x1d')],'include':_0x3e5129[_0x308a('0x1f')]?_[_0x308a('0x24')](_0x3e5129['include'],function(_0x1c6739){return{'model':db[_0x1c6739[_0x308a('0x20')]],'as':_0x1c6739['as'],'attributes':_0x1c6739[_0x308a('0x1d')],'include':_0x1c6739[_0x308a('0x1f')]?_[_0x308a('0x24')](_0x1c6739[_0x308a('0x1f')],function(_0x2d3735){return{'model':db[_0x2d3735[_0x308a('0x20')]],'as':_0x2d3735['as'],'attributes':_0x2d3735[_0x308a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x308a('0x21')](function(_0x145bc1){logger[_0x308a('0xe')](_0x308a('0x25'),_0x13ad74);logger[_0x308a('0x11')](_0x308a('0x25'),_0x13ad74,JSON[_0x308a('0x13')](_0x145bc1));_0xb97c9e(_0x145bc1);})['catch'](function(_0xe2babf){logger['error'](_0x308a('0x25'),_0xe2babf[_0x308a('0x16')],_0x13ad74);_0x4d611b(_0x2abf3f[_0x308a('0x14')](0x1f4,_0xe2babf[_0x308a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 42f83ed..aea7dd3 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 _0x74b5=['./voiceQueue.events','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x74b5,0xc8));var _0x574b=function(_0x52fc0f,_0x391070){_0x52fc0f=_0x52fc0f-0x0;var _0x1c3f18=_0x74b5[_0x52fc0f];return _0x1c3f18;};'use strict';var VoiceQueueEvents=require(_0x574b('0x0'));var events=['save',_0x574b('0x1'),_0x574b('0x2')];function createListener(_0x309347,_0x4572a2){return function(_0x5d59dd){_0x4572a2[_0x574b('0x3')](_0x309347,_0x5d59dd);};}function removeListener(_0x1c1db4,_0x132e46){return function(){VoiceQueueEvents[_0x574b('0x4')](_0x1c1db4,_0x132e46);};}exports[_0x574b('0x5')]=function(_0x178ebf){for(var _0xb52b64=0x0,_0x1ab2b8=events[_0x574b('0x6')];_0xb52b64<_0x1ab2b8;_0xb52b64++){var _0x1a1d86=events[_0xb52b64];var _0x4d0e37=createListener(_0x574b('0x7')+_0x1a1d86,_0x178ebf);VoiceQueueEvents['on'](_0x1a1d86,_0x4d0e37);}}; \ No newline at end of file +var _0xd383=['./voiceQueue.events','remove','update','register','voiceQueue:'];(function(_0x201c46,_0x3ed68e){var _0x197e98=function(_0x481494){while(--_0x481494){_0x201c46['push'](_0x201c46['shift']());}};_0x197e98(++_0x3ed68e);}(_0xd383,0xcd));var _0x3d38=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xd383[_0x5a95fa];return _0x1a61b8;};'use strict';var VoiceQueueEvents=require(_0x3d38('0x0'));var events=['save',_0x3d38('0x1'),_0x3d38('0x2')];function createListener(_0x39e56f,_0xd93efc){return function(_0x30ecdb){_0xd93efc['emit'](_0x39e56f,_0x30ecdb);};}function removeListener(_0x5e5b83,_0x410113){return function(){VoiceQueueEvents['removeListener'](_0x5e5b83,_0x410113);};}exports[_0x3d38('0x3')]=function(_0x4c422c){for(var _0x445caa=0x0,_0xa47602=events['length'];_0x445caa<_0xa47602;_0x445caa++){var _0x3bcdf3=events[_0x445caa];var _0xafd844=createListener(_0x3d38('0x4')+_0x3bcdf3,_0x4c422c);VoiceQueueEvents['on'](_0x3bcdf3,_0xafd844);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d9a3fc9..cd540b4 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 _0xd88a=['index','get','/describe','describe','/index','isAuthenticated','/:id','show','post','create','update','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x217cd1,_0x10c0a5){var _0x515315=function(_0x27882f){while(--_0x27882f){_0x217cd1['push'](_0x217cd1['shift']());}};_0x515315(++_0x10c0a5);}(_0xd88a,0x1d9));var _0xad88=function(_0x493370,_0x4c7fac){_0x493370=_0x493370-0x0;var _0xac15d=_0xd88a[_0x493370];return _0xac15d;};'use strict';var multer=require('multer');var util=require(_0xad88('0x0'));var path=require(_0xad88('0x1'));var timeout=require('connect-timeout');var express=require(_0xad88('0x2'));var router=express[_0xad88('0x3')]();var fs_extra=require(_0xad88('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xad88('0x5'));var config=require(_0xad88('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xad88('0x7')]);router[_0xad88('0x8')](_0xad88('0x9'),auth['isAuthenticated'](),controller[_0xad88('0xa')]);router[_0xad88('0x8')](_0xad88('0xb'),auth[_0xad88('0xc')](),controller['getVoiceQueuesReport']);router[_0xad88('0x8')](_0xad88('0xd'),auth[_0xad88('0xc')](),controller[_0xad88('0xe')]);router[_0xad88('0xf')]('/',auth['isAuthenticated'](),controller[_0xad88('0x10')]);router['put']('/:id',auth[_0xad88('0xc')](),controller[_0xad88('0x11')]);router[_0xad88('0x12')](_0xad88('0xd'),auth[_0xad88('0xc')](),controller['destroy']);module[_0xad88('0x13')]=router; \ No newline at end of file +var _0x732e=['destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','/index','getVoiceQueuesReport','/:id','show','create','put','update','delete'];(function(_0x62199f,_0x1b8ce5){var _0x853db1=function(_0x5db525){while(--_0x5db525){_0x62199f['push'](_0x62199f['shift']());}};_0x853db1(++_0x1b8ce5);}(_0x732e,0x1c9));var _0xe732=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0x732e[_0x41ed37];return _0x13f7ea;};'use strict';var multer=require(_0xe732('0x0'));var util=require(_0xe732('0x1'));var path=require(_0xe732('0x2'));var timeout=require(_0xe732('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe732('0x4'));var auth=require(_0xe732('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe732('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xe732('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe732('0x8'),auth[_0xe732('0x9')](),controller['describe']);router['get'](_0xe732('0xa'),auth[_0xe732('0x9')](),controller[_0xe732('0xb')]);router['get'](_0xe732('0xc'),auth[_0xe732('0x9')](),controller[_0xe732('0xd')]);router['post']('/',auth[_0xe732('0x9')](),controller[_0xe732('0xe')]);router[_0xe732('0xf')](_0xe732('0xc'),auth[_0xe732('0x9')](),controller[_0xe732('0x10')]);router[_0xe732('0x11')](_0xe732('0xc'),auth[_0xe732('0x9')](),controller[_0xe732('0x12')]);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 0e3c0a5..212bd8a 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 _0x15a9=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x15a9,0x122));var _0x915a=function(_0x554b57,_0x6c143b){_0x554b57=_0x554b57-0x0;var _0x4e9b05=_0x15a9[_0x554b57];return _0x4e9b05;};'use strict';var Sequelize=require(_0x915a('0x0'));var moment=require('moment');module[_0x915a('0x1')]={'type':{'type':Sequelize[_0x915a('0x2')]},'uniqueid':{'type':Sequelize[_0x915a('0x2')]},'calleridnum':{'type':Sequelize[_0x915a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x915a('0x3')],'set':function(_0x4e37f9){var _0x14e3c6=moment(_0x4e37f9);var _0x5d59c3=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x915a('0x4'));var _0x412a2d=_0x14e3c6[_0x915a('0x5')](_0x5d59c3,'seconds');this[_0x915a('0x6')]('queuecallerleaveAt',_0x4e37f9);this[_0x915a('0x6')](_0x915a('0x7'),_0x412a2d||null);}},'position':{'type':Sequelize[_0x915a('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x915a('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x915a('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x915a('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x915a('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x915a('0x2')],'comment':_0x915a('0xa')},'originalposition':{'type':Sequelize[_0x915a('0x8')]},'channel':{'type':Sequelize[_0x915a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x915a('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x915a('0x2')]},'priority':{'type':Sequelize[_0x915a('0x2')]},'holdtime':{'type':Sequelize[_0x915a('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x915a('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x915a('0x2')]},'transfer':{'type':Sequelize[_0x915a('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x915a('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x915a('0x2')]},'disposition':{'type':Sequelize[_0x915a('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x915a('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x915a('0x8')],'defaultValue':0x0},'note':{'type':Sequelize[_0x915a('0x2')]}}; \ No newline at end of file +var _0x752f=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x752f,0x177));var _0xf752=function(_0x2a3d49,_0x1067b1){_0x2a3d49=_0x2a3d49-0x0;var _0x1e91e3=_0x752f[_0x2a3d49];return _0x1e91e3;};'use strict';var Sequelize=require(_0xf752('0x0'));var moment=require(_0xf752('0x1'));module[_0xf752('0x2')]={'type':{'type':Sequelize[_0xf752('0x3')]},'uniqueid':{'type':Sequelize[_0xf752('0x3')]},'calleridnum':{'type':Sequelize[_0xf752('0x3')]},'calleridname':{'type':Sequelize[_0xf752('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xf752('0x4')],'set':function(_0x55d6cf){var _0x28e07c=moment(_0x55d6cf);var _0x2517c3=moment(this[_0xf752('0x5')]('queuecallerjoinAt'))['format'](_0xf752('0x6'));var _0x941f9c=_0x28e07c[_0xf752('0x7')](_0x2517c3,_0xf752('0x8'));this['setDataValue']('queuecallerleaveAt',_0x55d6cf);this['setDataValue']('holdtime',_0x941f9c||null);}},'position':{'type':Sequelize[_0xf752('0x9')]},'count':{'type':Sequelize[_0xf752('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf752('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xf752('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf752('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf752('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xf752('0xb')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xf752('0x3')]},'connectedlinenum':{'type':Sequelize[_0xf752('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf752('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf752('0x3')]},'holdtime':{'type':Sequelize[_0xf752('0x9')]},'mohtime':{'type':Sequelize[_0xf752('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf752('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xf752('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf752('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf752('0x3')]},'secondDisposition':{'type':Sequelize[_0xf752('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf752('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xf752('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8e4b29c..ddb1ef8 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 _0xf27e=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','destroy','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','end','error','stack','name','send','map','VoiceQueueReport','fieldName','type','key'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf27e,0x119));var _0xef27=function(_0x3fbfe8,_0x4d88fe){_0x3fbfe8=_0x3fbfe8-0x0;var _0x5db024=_0xf27e[_0x3fbfe8];return _0x5db024;};'use strict';var emlformat=require(_0xef27('0x0'));var rimraf=require(_0xef27('0x1'));var zipdir=require(_0xef27('0x2'));var jsonpatch=require(_0xef27('0x3'));var rp=require(_0xef27('0x4'));var moment=require('moment');var BPromise=require(_0xef27('0x5'));var Mustache=require(_0xef27('0x6'));var util=require(_0xef27('0x7'));var path=require(_0xef27('0x8'));var sox=require(_0xef27('0x9'));var csv=require(_0xef27('0xa'));var ejs=require(_0xef27('0xb'));var fs=require('fs');var fs_extra=require(_0xef27('0xc'));var _=require(_0xef27('0xd'));var squel=require(_0xef27('0xe'));var crypto=require('crypto');var jsforce=require(_0xef27('0xf'));var deskjs=require(_0xef27('0x10'));var toCsv=require(_0xef27('0xa'));var querystring=require(_0xef27('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef27('0x12'));var qs=require(_0xef27('0x13'));var as=require(_0xef27('0x14'));var hardwareService=require(_0xef27('0x15'));var logger=require('../../config/logger')(_0xef27('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef27('0x17'));var db=require('../../mysqldb')['db'];config[_0xef27('0x18')]=_['defaults'](config[_0xef27('0x18')],{'host':_0xef27('0x19'),'port':0x18eb});var socket=require(_0xef27('0x1a'))(new Redis(config[_0xef27('0x18')]));require(_0xef27('0x1b'))[_0xef27('0x1c')](socket);function respondWithStatusCode(_0x43fa5e,_0xebfa7b){_0xebfa7b=_0xebfa7b||0xcc;return function(_0x49585b){if(_0x49585b){return _0x43fa5e[_0xef27('0x1d')](_0xebfa7b);}return _0x43fa5e[_0xef27('0x1e')](_0xebfa7b)['end']();};}function respondWithResult(_0x22a302,_0x31a804){_0x31a804=_0x31a804||0xc8;return function(_0x41ae83){if(_0x41ae83){return _0x22a302[_0xef27('0x1e')](_0x31a804)[_0xef27('0x1f')](_0x41ae83);}};}function respondWithFilteredResult(_0x10f993,_0x48f186){return function(_0x303d25){if(_0x303d25){var _0x4c18d5=typeof _0x48f186[_0xef27('0x20')]==='undefined'&&typeof _0x48f186['limit']===_0xef27('0x21');var _0x1455cf=_0x303d25[_0xef27('0x22')];var _0x6d39d6=_0x4c18d5?0x0:_0x48f186[_0xef27('0x20')];var _0x115cd5=_0x4c18d5?_0x303d25[_0xef27('0x22')]:_0x48f186['offset']+_0x48f186[_0xef27('0x23')];var _0x1beee6;if(_0x115cd5>=_0x1455cf){_0x115cd5=_0x1455cf;_0x1beee6=0xc8;}else{_0x1beee6=0xce;}_0x10f993[_0xef27('0x1e')](_0x1beee6);return _0x10f993['set'](_0xef27('0x24'),_0x6d39d6+'-'+_0x115cd5+'/'+_0x1455cf)['json'](_0x303d25);}return null;};}function patchUpdates(_0x26b7b7){return function(_0x21a0a8){try{jsonpatch[_0xef27('0x25')](_0x21a0a8,_0x26b7b7,!![]);}catch(_0x5304a0){return BPromise['reject'](_0x5304a0);}return _0x21a0a8[_0xef27('0x26')]();};}function saveUpdates(_0x19855e,_0x588aaf){return function(_0x9f5c1e){if(_0x9f5c1e){return _0x9f5c1e[_0xef27('0x27')](_0x19855e)[_0xef27('0x28')](function(_0x4cbc6a){return _0x4cbc6a;});}return null;};}function removeEntity(_0x2318be,_0x114411){return function(_0x1c9e22){if(_0x1c9e22){return _0x1c9e22['destroy']()[_0xef27('0x28')](function(){_0x2318be[_0xef27('0x1e')](0xcc)[_0xef27('0x29')]();});}};}function handleEntityNotFound(_0xef0ee,_0x2bb126){return function(_0x81e1d6){if(!_0x81e1d6){_0xef0ee[_0xef27('0x1d')](0x194);}return _0x81e1d6;};}function handleError(_0x2f127e,_0xba3662){_0xba3662=_0xba3662||0x1f4;return function(_0x369314){logger[_0xef27('0x2a')](_0x369314[_0xef27('0x2b')]);if(_0x369314[_0xef27('0x2c')]){delete _0x369314[_0xef27('0x2c')];}_0x2f127e['status'](_0xba3662)[_0xef27('0x2d')](_0x369314);};}exports['index']=function(_0x30b671,_0x11bfdc){var _0x47fcc4={},_0xb50913={},_0x4caf16={'count':0x0,'rows':[]};var _0x87698=_[_0xef27('0x2e')](db[_0xef27('0x2f')]['rawAttributes'],function(_0x5313b8){return{'name':_0x5313b8[_0xef27('0x30')],'type':_0x5313b8[_0xef27('0x31')][_0xef27('0x32')]};});_0xb50913[_0xef27('0x33')]=_['map'](_0x87698,_0xef27('0x2c'));_0xb50913[_0xef27('0x34')]=_[_0xef27('0x35')](_0x30b671['query']);_0xb50913[_0xef27('0x36')]=_[_0xef27('0x37')](_0xb50913['model'],_0xb50913[_0xef27('0x34')]);_0x47fcc4[_0xef27('0x38')]=_[_0xef27('0x37')](_0xb50913['model'],qs[_0xef27('0x39')](_0x30b671['query'][_0xef27('0x39')]));_0x47fcc4['attributes']=_0x47fcc4[_0xef27('0x38')][_0xef27('0x3a')]?_0x47fcc4[_0xef27('0x38')]:_0xb50913[_0xef27('0x33')];if(!_0x30b671[_0xef27('0x34')][_0xef27('0x3b')](_0xef27('0x3c'))){_0x47fcc4['limit']=qs['limit'](_0x30b671['query'][_0xef27('0x23')]);_0x47fcc4[_0xef27('0x20')]=qs['offset'](_0x30b671[_0xef27('0x34')]['offset']);}_0x47fcc4[_0xef27('0x3d')]=qs[_0xef27('0x3e')](_0x30b671['query'][_0xef27('0x3e')]);_0x47fcc4[_0xef27('0x3f')]=qs[_0xef27('0x36')](_[_0xef27('0x40')](_0x30b671[_0xef27('0x34')],_0xb50913[_0xef27('0x36')]),_0x87698);if(_0x30b671[_0xef27('0x34')][_0xef27('0x41')]){_0x47fcc4[_0xef27('0x3f')]=_['merge'](_0x47fcc4[_0xef27('0x3f')],{'$or':_[_0xef27('0x2e')](_0x87698,function(_0x481a24){if(_0x481a24[_0xef27('0x31')]!==_0xef27('0x42')){var _0x2f61f6={};_0x2f61f6[_0x481a24[_0xef27('0x2c')]]={'$like':'%'+_0x30b671['query'][_0xef27('0x41')]+'%'};return _0x2f61f6;}})});}_0x47fcc4=_['merge']({},_0x47fcc4,_0x30b671[_0xef27('0x43')]);var _0x16551f={'where':_0x47fcc4['where']};return db[_0xef27('0x2f')][_0xef27('0x22')](_0x16551f)[_0xef27('0x28')](function(_0x5cc35b){_0x4caf16[_0xef27('0x22')]=_0x5cc35b;if(_0x30b671[_0xef27('0x34')][_0xef27('0x44')]){_0x47fcc4[_0xef27('0x45')]=[{'all':!![]}];}return db[_0xef27('0x2f')][_0xef27('0x46')](_0x47fcc4);})[_0xef27('0x28')](function(_0x517eb7){_0x4caf16[_0xef27('0x47')]=_0x517eb7;return _0x4caf16;})['then'](respondWithFilteredResult(_0x11bfdc,_0x47fcc4))[_0xef27('0x48')](handleError(_0x11bfdc,null));};exports[_0xef27('0x49')]=function(_0x40a891,_0x278e08){var _0x45ffac={'raw':![],'where':{'id':_0x40a891[_0xef27('0x4a')]['id']}},_0x2583ea={};_0x2583ea[_0xef27('0x33')]=_[_0xef27('0x35')](db[_0xef27('0x2f')][_0xef27('0x4b')]);_0x2583ea['query']=_[_0xef27('0x35')](_0x40a891['query']);_0x2583ea['filters']=_[_0xef27('0x37')](_0x2583ea[_0xef27('0x33')],_0x2583ea[_0xef27('0x34')]);_0x45ffac[_0xef27('0x38')]=_[_0xef27('0x37')](_0x2583ea[_0xef27('0x33')],qs['fields'](_0x40a891['query'][_0xef27('0x39')]));_0x45ffac[_0xef27('0x38')]=_0x45ffac[_0xef27('0x38')][_0xef27('0x3a')]?_0x45ffac[_0xef27('0x38')]:_0x2583ea[_0xef27('0x33')];if(_0x40a891[_0xef27('0x34')][_0xef27('0x44')]){_0x45ffac[_0xef27('0x45')]=[{'all':!![]}];}_0x45ffac=_[_0xef27('0x4c')]({},_0x45ffac,_0x40a891[_0xef27('0x43')]);return db['VoiceQueueReport'][_0xef27('0x4d')](_0x45ffac)['then'](handleEntityNotFound(_0x278e08,null))[_0xef27('0x28')](respondWithResult(_0x278e08,null))[_0xef27('0x48')](handleError(_0x278e08,null));};exports[_0xef27('0x4e')]=function(_0x13ab40,_0x90aa45){return db[_0xef27('0x2f')][_0xef27('0x4e')](_0x13ab40[_0xef27('0x4f')],{})[_0xef27('0x28')](respondWithResult(_0x90aa45,0xc9))[_0xef27('0x48')](handleError(_0x90aa45,null));};exports['update']=function(_0x451f9c,_0x388c1b){if(_0x451f9c[_0xef27('0x4f')]['id']){delete _0x451f9c['body']['id'];}return db[_0xef27('0x2f')][_0xef27('0x4d')]({'where':{'id':_0x451f9c[_0xef27('0x4a')]['id']}})[_0xef27('0x28')](handleEntityNotFound(_0x388c1b,null))[_0xef27('0x28')](saveUpdates(_0x451f9c[_0xef27('0x4f')],null))[_0xef27('0x28')](respondWithResult(_0x388c1b,null))[_0xef27('0x48')](handleError(_0x388c1b,null));};exports[_0xef27('0x50')]=function(_0x3d3407,_0x5ec07e){return db[_0xef27('0x2f')][_0xef27('0x4d')]({'where':{'id':_0x3d3407[_0xef27('0x4a')]['id']}})[_0xef27('0x28')](handleEntityNotFound(_0x5ec07e,null))[_0xef27('0x28')](removeEntity(_0x5ec07e,null))[_0xef27('0x48')](handleError(_0x5ec07e,null));};exports['describe']=function(_0x3df887,_0x22561a){return db[_0xef27('0x2f')][_0xef27('0x51')]()[_0xef27('0x28')](respondWithResult(_0x22561a,null))[_0xef27('0x48')](handleError(_0x22561a,null));};exports[_0xef27('0x52')]=function(_0x244b67,_0x2433fd){var _0x4dd415={},_0x139351={},_0x20e9ac={'count':0x0,'rows':[]};_0x139351[_0xef27('0x33')]=_[_0xef27('0x35')](db[_0xef27('0x2f')][_0xef27('0x4b')]);_0x139351[_0xef27('0x34')]=_[_0xef27('0x35')](_0x244b67[_0xef27('0x34')]);_0x139351[_0xef27('0x36')]=_['intersection'](_0x139351[_0xef27('0x33')],_0x139351[_0xef27('0x34')]);_0x4dd415[_0xef27('0x38')]=_[_0xef27('0x37')](_0x139351['model'],qs[_0xef27('0x39')](_0x244b67['query'][_0xef27('0x39')]));_0x4dd415[_0xef27('0x38')]=_0x4dd415['attributes'][_0xef27('0x3a')]?_0x4dd415['attributes']:_0x139351[_0xef27('0x33')];if(!_0x244b67[_0xef27('0x34')]['hasOwnProperty'](_0xef27('0x3c'))){_0x4dd415[_0xef27('0x23')]=qs[_0xef27('0x23')](_0x244b67[_0xef27('0x34')][_0xef27('0x23')]);_0x4dd415[_0xef27('0x20')]=qs['offset'](_0x244b67[_0xef27('0x34')]['offset']);}_0x4dd415[_0xef27('0x3d')]=qs['sort'](_0x244b67[_0xef27('0x34')][_0xef27('0x3e')]);_0x4dd415[_0xef27('0x3f')]=qs[_0xef27('0x36')](_[_0xef27('0x40')](_0x244b67[_0xef27('0x34')],_0x139351[_0xef27('0x36')]));if(_0x244b67[_0xef27('0x34')][_0xef27('0x41')]){_0x4dd415[_0xef27('0x3f')]=_[_0xef27('0x4c')](_0x4dd415['where'],{'$or':_['map'](_0x4dd415['attributes'],function(_0x27982f){var _0x3e5d3d={};_0x3e5d3d[_0x27982f]={'$like':'%'+_0x244b67[_0xef27('0x34')][_0xef27('0x41')]+'%'};return _0x3e5d3d;})});}_0x4dd415=_['merge']({},_0x4dd415,_0x244b67[_0xef27('0x43')]);var _0x2390c6={'where':_0x4dd415[_0xef27('0x3f')]};return db[_0xef27('0x2f')][_0xef27('0x22')](_0x2390c6)[_0xef27('0x28')](function(_0x39465a){_0x20e9ac[_0xef27('0x22')]=_0x39465a;if(_0x244b67[_0xef27('0x34')][_0xef27('0x44')]){_0x4dd415[_0xef27('0x45')]=[{'all':!![]}];}return db[_0xef27('0x2f')][_0xef27('0x46')](_0x4dd415);})['then'](function(_0x41d50d){_0x20e9ac[_0xef27('0x47')]=_0x41d50d;return _0x20e9ac;})['then'](respondWithFilteredResult(_0x2433fd,_0x4dd415,_0xef27('0x52')))['catch'](handleError(_0x2433fd,null,_0xef27('0x52')));}; \ No newline at end of file +var _0x61da=['limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','nolimit','order','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','offset','count'];(function(_0x54ff85,_0x49f9c0){var _0x53273f=function(_0x1ce1df){while(--_0x1ce1df){_0x54ff85['push'](_0x54ff85['shift']());}};_0x53273f(++_0x49f9c0);}(_0x61da,0x12b));var _0xa61d=function(_0x1c09a3,_0x46e97a){_0x1c09a3=_0x1c09a3-0x0;var _0x6a11fd=_0x61da[_0x1c09a3];return _0x6a11fd;};'use strict';var emlformat=require(_0xa61d('0x0'));var rimraf=require(_0xa61d('0x1'));var zipdir=require(_0xa61d('0x2'));var jsonpatch=require(_0xa61d('0x3'));var rp=require(_0xa61d('0x4'));var moment=require(_0xa61d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa61d('0x6'));var path=require(_0xa61d('0x7'));var sox=require('sox');var csv=require(_0xa61d('0x8'));var ejs=require(_0xa61d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa61d('0xa'));var squel=require(_0xa61d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa61d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa61d('0xd'));var Papa=require(_0xa61d('0xe'));var Redis=require(_0xa61d('0xf'));var authService=require(_0xa61d('0x10'));var qs=require(_0xa61d('0x11'));var as=require(_0xa61d('0x12'));var hardwareService=require(_0xa61d('0x13'));var logger=require(_0xa61d('0x14'))(_0xa61d('0x15'));var utils=require(_0xa61d('0x16'));var config=require(_0xa61d('0x17'));var licenseUtil=require(_0xa61d('0x18'));var db=require(_0xa61d('0x19'))['db'];config['redis']=_['defaults'](config[_0xa61d('0x1a')],{'host':_0xa61d('0x1b'),'port':0x18eb});var socket=require(_0xa61d('0x1c'))(new Redis(config[_0xa61d('0x1a')]));require('./voiceQueueReport.socket')[_0xa61d('0x1d')](socket);function respondWithStatusCode(_0x61a9aa,_0x56e833){_0x56e833=_0x56e833||0xcc;return function(_0x403bdd){if(_0x403bdd){return _0x61a9aa[_0xa61d('0x1e')](_0x56e833);}return _0x61a9aa[_0xa61d('0x1f')](_0x56e833)[_0xa61d('0x20')]();};}function respondWithResult(_0x175c91,_0x1ecdf0){_0x1ecdf0=_0x1ecdf0||0xc8;return function(_0x1efa29){if(_0x1efa29){return _0x175c91[_0xa61d('0x1f')](_0x1ecdf0)[_0xa61d('0x21')](_0x1efa29);}};}function respondWithFilteredResult(_0x4ecaa4,_0x3695ec){return function(_0x4b2111){if(_0x4b2111){var _0x15806b=typeof _0x3695ec['offset']==='undefined'&&typeof _0x3695ec['limit']===_0xa61d('0x22');var _0x41ff25=_0x4b2111['count'];var _0x234650=_0x15806b?0x0:_0x3695ec[_0xa61d('0x23')];var _0x4fbcf0=_0x15806b?_0x4b2111[_0xa61d('0x24')]:_0x3695ec[_0xa61d('0x23')]+_0x3695ec[_0xa61d('0x25')];var _0x5097dd;if(_0x4fbcf0>=_0x41ff25){_0x4fbcf0=_0x41ff25;_0x5097dd=0xc8;}else{_0x5097dd=0xce;}_0x4ecaa4[_0xa61d('0x1f')](_0x5097dd);return _0x4ecaa4['set'](_0xa61d('0x26'),_0x234650+'-'+_0x4fbcf0+'/'+_0x41ff25)[_0xa61d('0x21')](_0x4b2111);}return null;};}function patchUpdates(_0x339555){return function(_0x44226c){try{jsonpatch[_0xa61d('0x27')](_0x44226c,_0x339555,!![]);}catch(_0x110bdb){return BPromise[_0xa61d('0x28')](_0x110bdb);}return _0x44226c['save']();};}function saveUpdates(_0x3acba7,_0x13dcba){return function(_0x18a037){if(_0x18a037){return _0x18a037[_0xa61d('0x29')](_0x3acba7)[_0xa61d('0x2a')](function(_0x26a6c9){return _0x26a6c9;});}return null;};}function removeEntity(_0x4965e3,_0x1595a2){return function(_0x4521ef){if(_0x4521ef){return _0x4521ef[_0xa61d('0x2b')]()[_0xa61d('0x2a')](function(){_0x4965e3[_0xa61d('0x1f')](0xcc)[_0xa61d('0x20')]();});}};}function handleEntityNotFound(_0x272375,_0x1ed731){return function(_0x2e1ad3){if(!_0x2e1ad3){_0x272375[_0xa61d('0x1e')](0x194);}return _0x2e1ad3;};}function handleError(_0x59c59e,_0x58b90a){_0x58b90a=_0x58b90a||0x1f4;return function(_0xbc7877){logger[_0xa61d('0x2c')](_0xbc7877[_0xa61d('0x2d')]);if(_0xbc7877[_0xa61d('0x2e')]){delete _0xbc7877[_0xa61d('0x2e')];}_0x59c59e[_0xa61d('0x1f')](_0x58b90a)['send'](_0xbc7877);};}exports[_0xa61d('0x2f')]=function(_0x105c5e,_0x51d8cd){var _0x4153ea={},_0x4ad074={},_0x3b370b={'count':0x0,'rows':[]};var _0x41fd67=_['map'](db[_0xa61d('0x30')][_0xa61d('0x31')],function(_0x42594e){return{'name':_0x42594e[_0xa61d('0x32')],'type':_0x42594e[_0xa61d('0x33')][_0xa61d('0x34')]};});_0x4ad074[_0xa61d('0x35')]=_[_0xa61d('0x36')](_0x41fd67,_0xa61d('0x2e'));_0x4ad074[_0xa61d('0x37')]=_[_0xa61d('0x38')](_0x105c5e[_0xa61d('0x37')]);_0x4ad074[_0xa61d('0x39')]=_['intersection'](_0x4ad074[_0xa61d('0x35')],_0x4ad074['query']);_0x4153ea[_0xa61d('0x3a')]=_[_0xa61d('0x3b')](_0x4ad074[_0xa61d('0x35')],qs[_0xa61d('0x3c')](_0x105c5e[_0xa61d('0x37')]['fields']));_0x4153ea[_0xa61d('0x3a')]=_0x4153ea[_0xa61d('0x3a')][_0xa61d('0x3d')]?_0x4153ea['attributes']:_0x4ad074['model'];if(!_0x105c5e[_0xa61d('0x37')][_0xa61d('0x3e')]('nolimit')){_0x4153ea[_0xa61d('0x25')]=qs['limit'](_0x105c5e['query']['limit']);_0x4153ea[_0xa61d('0x23')]=qs[_0xa61d('0x23')](_0x105c5e['query'][_0xa61d('0x23')]);}_0x4153ea['order']=qs[_0xa61d('0x3f')](_0x105c5e[_0xa61d('0x37')][_0xa61d('0x3f')]);_0x4153ea['where']=qs['filters'](_[_0xa61d('0x40')](_0x105c5e['query'],_0x4ad074[_0xa61d('0x39')]),_0x41fd67);if(_0x105c5e[_0xa61d('0x37')][_0xa61d('0x41')]){_0x4153ea[_0xa61d('0x42')]=_[_0xa61d('0x43')](_0x4153ea[_0xa61d('0x42')],{'$or':_[_0xa61d('0x36')](_0x41fd67,function(_0x324694){if(_0x324694['type']!==_0xa61d('0x44')){var _0x5cdcfc={};_0x5cdcfc[_0x324694['name']]={'$like':'%'+_0x105c5e[_0xa61d('0x37')][_0xa61d('0x41')]+'%'};return _0x5cdcfc;}})});}_0x4153ea=_['merge']({},_0x4153ea,_0x105c5e[_0xa61d('0x45')]);var _0x2562e7={'where':_0x4153ea[_0xa61d('0x42')]};return db[_0xa61d('0x30')][_0xa61d('0x24')](_0x2562e7)['then'](function(_0x3690e2){_0x3b370b['count']=_0x3690e2;if(_0x105c5e[_0xa61d('0x37')]['includeAll']){_0x4153ea[_0xa61d('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xa61d('0x47')](_0x4153ea);})[_0xa61d('0x2a')](function(_0x368e6f){_0x3b370b[_0xa61d('0x48')]=_0x368e6f;return _0x3b370b;})[_0xa61d('0x2a')](respondWithFilteredResult(_0x51d8cd,_0x4153ea))[_0xa61d('0x49')](handleError(_0x51d8cd,null));};exports[_0xa61d('0x4a')]=function(_0x35de7f,_0x36a2a1){var _0x4ef0e0={'raw':![],'where':{'id':_0x35de7f[_0xa61d('0x4b')]['id']}},_0x471a5c={};_0x471a5c[_0xa61d('0x35')]=_[_0xa61d('0x38')](db['VoiceQueueReport'][_0xa61d('0x31')]);_0x471a5c[_0xa61d('0x37')]=_[_0xa61d('0x38')](_0x35de7f['query']);_0x471a5c[_0xa61d('0x39')]=_[_0xa61d('0x3b')](_0x471a5c[_0xa61d('0x35')],_0x471a5c['query']);_0x4ef0e0['attributes']=_[_0xa61d('0x3b')](_0x471a5c[_0xa61d('0x35')],qs[_0xa61d('0x3c')](_0x35de7f['query']['fields']));_0x4ef0e0[_0xa61d('0x3a')]=_0x4ef0e0[_0xa61d('0x3a')][_0xa61d('0x3d')]?_0x4ef0e0['attributes']:_0x471a5c[_0xa61d('0x35')];if(_0x35de7f[_0xa61d('0x37')][_0xa61d('0x4c')]){_0x4ef0e0['include']=[{'all':!![]}];}_0x4ef0e0=_[_0xa61d('0x43')]({},_0x4ef0e0,_0x35de7f['options']);return db[_0xa61d('0x30')][_0xa61d('0x4d')](_0x4ef0e0)['then'](handleEntityNotFound(_0x36a2a1,null))[_0xa61d('0x2a')](respondWithResult(_0x36a2a1,null))[_0xa61d('0x49')](handleError(_0x36a2a1,null));};exports[_0xa61d('0x4e')]=function(_0x18be5a,_0x3990a0){return db[_0xa61d('0x30')]['create'](_0x18be5a[_0xa61d('0x4f')],{})[_0xa61d('0x2a')](respondWithResult(_0x3990a0,0xc9))[_0xa61d('0x49')](handleError(_0x3990a0,null));};exports[_0xa61d('0x29')]=function(_0x1789a3,_0x423a30){if(_0x1789a3[_0xa61d('0x4f')]['id']){delete _0x1789a3[_0xa61d('0x4f')]['id'];}return db[_0xa61d('0x30')][_0xa61d('0x4d')]({'where':{'id':_0x1789a3[_0xa61d('0x4b')]['id']}})[_0xa61d('0x2a')](handleEntityNotFound(_0x423a30,null))[_0xa61d('0x2a')](saveUpdates(_0x1789a3[_0xa61d('0x4f')],null))[_0xa61d('0x2a')](respondWithResult(_0x423a30,null))['catch'](handleError(_0x423a30,null));};exports['destroy']=function(_0x5301b0,_0x2e53c1){return db[_0xa61d('0x30')][_0xa61d('0x4d')]({'where':{'id':_0x5301b0[_0xa61d('0x4b')]['id']}})[_0xa61d('0x2a')](handleEntityNotFound(_0x2e53c1,null))[_0xa61d('0x2a')](removeEntity(_0x2e53c1,null))[_0xa61d('0x49')](handleError(_0x2e53c1,null));};exports[_0xa61d('0x50')]=function(_0x1e86a2,_0x324c96){return db[_0xa61d('0x30')][_0xa61d('0x50')]()['then'](respondWithResult(_0x324c96,null))[_0xa61d('0x49')](handleError(_0x324c96,null));};exports['getVoiceQueuesReport']=function(_0x127cbf,_0x493118){var _0xc27472={},_0x38e0f9={},_0x7abd48={'count':0x0,'rows':[]};_0x38e0f9[_0xa61d('0x35')]=_[_0xa61d('0x38')](db['VoiceQueueReport'][_0xa61d('0x31')]);_0x38e0f9[_0xa61d('0x37')]=_[_0xa61d('0x38')](_0x127cbf[_0xa61d('0x37')]);_0x38e0f9[_0xa61d('0x39')]=_[_0xa61d('0x3b')](_0x38e0f9[_0xa61d('0x35')],_0x38e0f9[_0xa61d('0x37')]);_0xc27472['attributes']=_['intersection'](_0x38e0f9[_0xa61d('0x35')],qs[_0xa61d('0x3c')](_0x127cbf[_0xa61d('0x37')][_0xa61d('0x3c')]));_0xc27472[_0xa61d('0x3a')]=_0xc27472[_0xa61d('0x3a')][_0xa61d('0x3d')]?_0xc27472[_0xa61d('0x3a')]:_0x38e0f9[_0xa61d('0x35')];if(!_0x127cbf['query']['hasOwnProperty'](_0xa61d('0x51'))){_0xc27472[_0xa61d('0x25')]=qs[_0xa61d('0x25')](_0x127cbf[_0xa61d('0x37')]['limit']);_0xc27472['offset']=qs[_0xa61d('0x23')](_0x127cbf['query'][_0xa61d('0x23')]);}_0xc27472[_0xa61d('0x52')]=qs[_0xa61d('0x3f')](_0x127cbf[_0xa61d('0x37')][_0xa61d('0x3f')]);_0xc27472[_0xa61d('0x42')]=qs[_0xa61d('0x39')](_[_0xa61d('0x40')](_0x127cbf[_0xa61d('0x37')],_0x38e0f9[_0xa61d('0x39')]));if(_0x127cbf[_0xa61d('0x37')][_0xa61d('0x41')]){_0xc27472[_0xa61d('0x42')]=_[_0xa61d('0x43')](_0xc27472[_0xa61d('0x42')],{'$or':_[_0xa61d('0x36')](_0xc27472[_0xa61d('0x3a')],function(_0xb63e3b){var _0x135bcb={};_0x135bcb[_0xb63e3b]={'$like':'%'+_0x127cbf[_0xa61d('0x37')][_0xa61d('0x41')]+'%'};return _0x135bcb;})});}_0xc27472=_[_0xa61d('0x43')]({},_0xc27472,_0x127cbf['options']);var _0x514284={'where':_0xc27472['where']};return db[_0xa61d('0x30')][_0xa61d('0x24')](_0x514284)[_0xa61d('0x2a')](function(_0xaed267){_0x7abd48[_0xa61d('0x24')]=_0xaed267;if(_0x127cbf[_0xa61d('0x37')][_0xa61d('0x4c')]){_0xc27472['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xa61d('0x47')](_0xc27472);})[_0xa61d('0x2a')](function(_0x5c9652){_0x7abd48[_0xa61d('0x48')]=_0x5c9652;return _0x7abd48;})[_0xa61d('0x2a')](respondWithFilteredResult(_0x493118,_0xc27472,_0xa61d('0x53')))[_0xa61d('0x49')](handleError(_0x493118,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 689a3ef..9ebbab9 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 _0x8ea7=['hasOwnProperty','hook','events','VoiceQueueReport','save','update','remove','emit'];(function(_0x86dc5c,_0x3a42c6){var _0x1f19a8=function(_0x163614){while(--_0x163614){_0x86dc5c['push'](_0x86dc5c['shift']());}};_0x1f19a8(++_0x3a42c6);}(_0x8ea7,0x82));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x78ea('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x78ea('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x78ea('0x2'),'afterUpdate':_0x78ea('0x3'),'afterDestroy':_0x78ea('0x4')};function emitEvent(_0x52f2a3){return function(_0x5aa3c2,_0x417c37,_0x500f7c){VoiceQueueReportEvents[_0x78ea('0x5')](_0x52f2a3+':'+_0x5aa3c2['id'],_0x5aa3c2);VoiceQueueReportEvents[_0x78ea('0x5')](_0x52f2a3,_0x5aa3c2);_0x500f7c(null);};}for(var e in events){if(events[_0x78ea('0x6')](e)){var event=events[e];VoiceQueueReport[_0x78ea('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xc351=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x13d5a3,_0x4fe4ec){var _0xf5e40d=function(_0x240fe2){while(--_0x240fe2){_0x13d5a3['push'](_0x13d5a3['shift']());}};_0xf5e40d(++_0x4fe4ec);}(_0xc351,0x83));var _0x1c35=function(_0x4bc4ab,_0x2c1bad){_0x4bc4ab=_0x4bc4ab-0x0;var _0x368014=_0xc351[_0x4bc4ab];return _0x368014;};'use strict';var EventEmitter=require(_0x1c35('0x0'));var VoiceQueueReport=require(_0x1c35('0x1'))['db'][_0x1c35('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1c35('0x3')](0x0);var events={'afterCreate':_0x1c35('0x4'),'afterUpdate':_0x1c35('0x5'),'afterDestroy':_0x1c35('0x6')};function emitEvent(_0x49ca9c){return function(_0x153cef,_0x1e6abb,_0x147884){VoiceQueueReportEvents['emit'](_0x49ca9c+':'+_0x153cef['id'],_0x153cef);VoiceQueueReportEvents[_0x1c35('0x7')](_0x49ca9c,_0x153cef);_0x147884(null);};}for(var e in events){if(events[_0x1c35('0x8')](e)){var event=events[e];VoiceQueueReport[_0x1c35('0x9')](e,emitEvent(event));}}module[_0x1c35('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 673474a..cea4d6e 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 _0x0614=['uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0xb2bedd,_0x31fd7f){var _0xe4c3a4=function(_0x5af4fd){while(--_0x5af4fd){_0xb2bedd['push'](_0xb2bedd['shift']());}};_0xe4c3a4(++_0x31fd7f);}(_0x0614,0x12e));var _0x4061=function(_0x4b43e7,_0x55d87d){_0x4b43e7=_0x4b43e7-0x0;var _0x2451d8=_0x0614[_0x4b43e7];return _0x2451d8;};'use strict';var _=require(_0x4061('0x0'));var util=require(_0x4061('0x1'));var logger=require(_0x4061('0x2'))(_0x4061('0x3'));var moment=require('moment');var BPromise=require(_0x4061('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4061('0x5'));var rimraf=require(_0x4061('0x6'));var config=require(_0x4061('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x4061('0x8')]=function(_0x68461a,_0x5aff1b){return _0x68461a[_0x4061('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x4061('0xa')]},{'fields':[_0x4061('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0390=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util'];(function(_0x38d4ac,_0x19cf87){var _0x3497fb=function(_0x5dc7a0){while(--_0x5dc7a0){_0x38d4ac['push'](_0x38d4ac['shift']());}};_0x3497fb(++_0x19cf87);}(_0x0390,0x1e9));var _0x0039=function(_0x59355d,_0xd083fb){_0x59355d=_0x59355d-0x0;var _0x65d2b9=_0x0390[_0x59355d];return _0x65d2b9;};'use strict';var _=require('lodash');var util=require(_0x0039('0x0'));var logger=require(_0x0039('0x1'))(_0x0039('0x2'));var moment=require(_0x0039('0x3'));var BPromise=require(_0x0039('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0039('0x5'));var config=require(_0x0039('0x6'));var attributes=require(_0x0039('0x7'));module[_0x0039('0x8')]=function(_0x19bdae,_0x15bdd6){return _0x19bdae[_0x0039('0x9')](_0x0039('0xa'),attributes,{'tableName':_0x0039('0xb'),'paranoid':![],'indexes':[{'fields':[_0x0039('0xc')]},{'fields':[_0x0039('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 ccc237a..58bc61d 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 _0x1380=['code','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','model','map','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x48e1bf,_0x197e63){var _0x56d217=function(_0x45cb40){while(--_0x45cb40){_0x48e1bf['push'](_0x48e1bf['shift']());}};_0x56d217(++_0x197e63);}(_0x1380,0xdb));var _0x0138=function(_0x503cd3,_0x13e11e){_0x503cd3=_0x503cd3-0x0;var _0x6bab62=_0x1380[_0x503cd3];return _0x6bab62;};'use strict';var _=require(_0x0138('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0138('0x1'));var rs=require(_0x0138('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0138('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0138('0x4'))(_0x0138('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0138('0x6')][_0x0138('0x7')]({'port':0x232a});config[_0x0138('0x8')]=_[_0x0138('0x9')](config['redis'],{'host':_0x0138('0xa'),'port':0x18eb});var socket=require(_0x0138('0xb'))(new Redis(config['redis']));require(_0x0138('0xc'))['register'](socket);function respondWithRpcPromise(_0x2dbd76,_0x675e82,_0x59fb89){return new BPromise(function(_0xad4416,_0x31fb07){return client['request'](_0x2dbd76,_0x59fb89)[_0x0138('0xd')](function(_0x4168d9){logger[_0x0138('0xe')](_0x0138('0xf'),_0x675e82,'request\x20sent');logger[_0x0138('0x10')](_0x0138('0x11'),_0x675e82,_0x0138('0x12'),JSON[_0x0138('0x13')](_0x4168d9));if(_0x4168d9['error']){if(_0x4168d9[_0x0138('0x14')][_0x0138('0x15')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x675e82,_0x4168d9[_0x0138('0x14')][_0x0138('0x16')]);return _0x31fb07(_0x4168d9[_0x0138('0x14')][_0x0138('0x16')]);}logger[_0x0138('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x675e82,_0x4168d9[_0x0138('0x14')][_0x0138('0x16')]);return _0xad4416(_0x4168d9[_0x0138('0x14')][_0x0138('0x16')]);}else{logger[_0x0138('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x675e82,'request\x20sent');_0xad4416(_0x4168d9[_0x0138('0x17')]['message']);}})['catch'](function(_0x4ef455){logger['error'](_0x0138('0xf'),_0x675e82,_0x4ef455);_0x31fb07(_0x4ef455);});});}exports[_0x0138('0x18')]=function(_0x268116){var _0x1ef248=this;return new Promise(function(_0x1d9d08,_0x1f7cff){return db[_0x0138('0x19')]['findAll']({'raw':_0x268116['options']?_0x268116[_0x0138('0x1a')][_0x0138('0x1b')]===undefined?!![]:![]:!![],'where':_0x268116[_0x0138('0x1a')]?_0x268116[_0x0138('0x1a')][_0x0138('0x1c')]||null:null,'attributes':_0x268116[_0x0138('0x1a')]?_0x268116[_0x0138('0x1a')][_0x0138('0x1d')]||null:null,'limit':_0x268116[_0x0138('0x1a')]?_0x268116[_0x0138('0x1a')][_0x0138('0x1e')]||null:null,'include':_0x268116['options']?_0x268116[_0x0138('0x1a')][_0x0138('0x1f')]?_['map'](_0x268116['options'][_0x0138('0x1f')],function(_0x3f3b55){return{'model':db[_0x3f3b55[_0x0138('0x20')]],'as':_0x3f3b55['as'],'attributes':_0x3f3b55[_0x0138('0x1d')],'include':_0x3f3b55[_0x0138('0x1f')]?_[_0x0138('0x21')](_0x3f3b55[_0x0138('0x1f')],function(_0x4de350){return{'model':db[_0x4de350[_0x0138('0x20')]],'as':_0x4de350['as'],'attributes':_0x4de350[_0x0138('0x1d')],'include':_0x4de350[_0x0138('0x1f')]?_['map'](_0x4de350[_0x0138('0x1f')],function(_0x253179){return{'model':db[_0x253179[_0x0138('0x20')]],'as':_0x253179['as'],'attributes':_0x253179[_0x0138('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0138('0xd')](function(_0x2ed62c){logger[_0x0138('0xe')](_0x0138('0x18'),_0x268116);logger[_0x0138('0x10')]('GetVoiceQueueReport',_0x268116,JSON['stringify'](_0x2ed62c));_0x1d9d08(_0x2ed62c);})[_0x0138('0x22')](function(_0x5732d5){logger[_0x0138('0x14')](_0x0138('0x18'),_0x5732d5[_0x0138('0x16')],_0x268116);_0x1f7cff(_0x1ef248[_0x0138('0x14')](0x1f4,_0x5732d5[_0x0138('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x5d6ff5){var _0x17b7e0=this;return new Promise(function(_0x500bd4,_0x411f82){return db[_0x0138('0x19')][_0x0138('0x23')](_0x5d6ff5[_0x0138('0x24')],{'raw':_0x5d6ff5[_0x0138('0x1a')]?_0x5d6ff5[_0x0138('0x1a')][_0x0138('0x1b')]===undefined?!![]:![]:!![]})[_0x0138('0xd')](function(_0x44597c){logger[_0x0138('0xe')](_0x0138('0x25'),_0x5d6ff5);logger[_0x0138('0x10')](_0x0138('0x25'),_0x5d6ff5,JSON['stringify'](_0x44597c));_0x500bd4(_0x44597c);})[_0x0138('0x22')](function(_0x122d1a){logger['error'](_0x0138('0x25'),_0x122d1a[_0x0138('0x16')],_0x5d6ff5);_0x411f82(_0x17b7e0['error'](0x1f4,_0x122d1a[_0x0138('0x16')]));});});};exports[_0x0138('0x26')]=function(_0x2b8f26){var _0x4f8755=this;return new Promise(function(_0x58606c,_0x2c6ebf){return db['VoiceQueueReport'][_0x0138('0x27')](_0x2b8f26['body'],{'raw':_0x2b8f26[_0x0138('0x1a')]?_0x2b8f26['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b8f26[_0x0138('0x1a')]?_0x2b8f26[_0x0138('0x1a')][_0x0138('0x1c')]||null:null,'attributes':_0x2b8f26[_0x0138('0x1a')]?_0x2b8f26[_0x0138('0x1a')][_0x0138('0x1d')]||null:null,'limit':_0x2b8f26['options']?_0x2b8f26[_0x0138('0x1a')][_0x0138('0x1e')]||null:null})[_0x0138('0xd')](function(_0x1d3a38){logger[_0x0138('0xe')](_0x0138('0x26'),_0x2b8f26);logger[_0x0138('0x10')](_0x0138('0x26'),_0x2b8f26,JSON['stringify'](_0x1d3a38));_0x58606c(_0x1d3a38);})[_0x0138('0x22')](function(_0x5777e3){logger[_0x0138('0x14')](_0x0138('0x26'),_0x5777e3['message'],_0x2b8f26);_0x2c6ebf(_0x4f8755['error'](0x1f4,_0x5777e3[_0x0138('0x16')]));});});}; \ No newline at end of file +var _0x2ef3=['rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetVoiceQueueReport','VoiceQueueReport','findAll','raw','options','attributes','include','model','map','catch','CreateVoiceQueueReport','create','body','where','limit','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ee5cd,_0x3023f6){var _0x593fa4=function(_0x266f68){while(--_0x266f68){_0x3ee5cd['push'](_0x3ee5cd['shift']());}};_0x593fa4(++_0x3023f6);}(_0x2ef3,0xa8));var _0x32ef=function(_0x3d9fd9,_0x5842bd){_0x3d9fd9=_0x3d9fd9-0x0;var _0x4db947=_0x2ef3[_0x3d9fd9];return _0x4db947;};'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(_0x32ef('0x6'))['db'];var utils=require(_0x32ef('0x7'));var logger=require('../../config/logger')(_0x32ef('0x8'));var config=require(_0x32ef('0x9'));var jayson=require(_0x32ef('0xa'));var client=jayson[_0x32ef('0xb')]['http']({'port':0x232a});config['redis']=_[_0x32ef('0xc')](config['redis'],{'host':_0x32ef('0xd'),'port':0x18eb});var socket=require(_0x32ef('0xe'))(new Redis(config[_0x32ef('0xf')]));require(_0x32ef('0x10'))[_0x32ef('0x11')](socket);function respondWithRpcPromise(_0x23d37e,_0x51bdd7,_0x19c10b){return new BPromise(function(_0x31875a,_0x155888){return client['request'](_0x23d37e,_0x19c10b)[_0x32ef('0x12')](function(_0x702a70){logger['info'](_0x32ef('0x13'),_0x51bdd7,_0x32ef('0x14'));logger[_0x32ef('0x15')](_0x32ef('0x16'),_0x51bdd7,'request\x20sent',JSON[_0x32ef('0x17')](_0x702a70));if(_0x702a70[_0x32ef('0x18')]){if(_0x702a70['error']['code']===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x51bdd7,_0x702a70[_0x32ef('0x18')][_0x32ef('0x19')]);return _0x155888(_0x702a70[_0x32ef('0x18')][_0x32ef('0x19')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x51bdd7,_0x702a70['error'][_0x32ef('0x19')]);return _0x31875a(_0x702a70[_0x32ef('0x18')][_0x32ef('0x19')]);}else{logger[_0x32ef('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x51bdd7,'request\x20sent');_0x31875a(_0x702a70[_0x32ef('0x1b')]['message']);}})['catch'](function(_0x5db4ca){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x51bdd7,_0x5db4ca);_0x155888(_0x5db4ca);});});}exports[_0x32ef('0x1c')]=function(_0x426f18){var _0x3e833d=this;return new Promise(function(_0x32be77,_0x336372){return db[_0x32ef('0x1d')][_0x32ef('0x1e')]({'raw':_0x426f18['options']?_0x426f18['options'][_0x32ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x426f18['options']?_0x426f18[_0x32ef('0x20')]['where']||null:null,'attributes':_0x426f18[_0x32ef('0x20')]?_0x426f18[_0x32ef('0x20')][_0x32ef('0x21')]||null:null,'limit':_0x426f18['options']?_0x426f18[_0x32ef('0x20')]['limit']||null:null,'include':_0x426f18['options']?_0x426f18['options']['include']?_['map'](_0x426f18[_0x32ef('0x20')][_0x32ef('0x22')],function(_0x4429be){return{'model':db[_0x4429be[_0x32ef('0x23')]],'as':_0x4429be['as'],'attributes':_0x4429be[_0x32ef('0x21')],'include':_0x4429be['include']?_[_0x32ef('0x24')](_0x4429be[_0x32ef('0x22')],function(_0x2ef3c2){return{'model':db[_0x2ef3c2['model']],'as':_0x2ef3c2['as'],'attributes':_0x2ef3c2[_0x32ef('0x21')],'include':_0x2ef3c2['include']?_[_0x32ef('0x24')](_0x2ef3c2['include'],function(_0x563581){return{'model':db[_0x563581[_0x32ef('0x23')]],'as':_0x563581['as'],'attributes':_0x563581[_0x32ef('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b89bc){logger['info'](_0x32ef('0x1c'),_0x426f18);logger[_0x32ef('0x15')]('GetVoiceQueueReport',_0x426f18,JSON[_0x32ef('0x17')](_0x2b89bc));_0x32be77(_0x2b89bc);})[_0x32ef('0x25')](function(_0x3de420){logger[_0x32ef('0x18')](_0x32ef('0x1c'),_0x3de420[_0x32ef('0x19')],_0x426f18);_0x336372(_0x3e833d[_0x32ef('0x18')](0x1f4,_0x3de420[_0x32ef('0x19')]));});});};exports[_0x32ef('0x26')]=function(_0x10dae3){var _0x4769fa=this;return new Promise(function(_0x16413e,_0xc9e053){return db[_0x32ef('0x1d')][_0x32ef('0x27')](_0x10dae3[_0x32ef('0x28')],{'raw':_0x10dae3['options']?_0x10dae3[_0x32ef('0x20')][_0x32ef('0x1f')]===undefined?!![]:![]:!![]})[_0x32ef('0x12')](function(_0x26bc36){logger[_0x32ef('0x1a')](_0x32ef('0x26'),_0x10dae3);logger['debug'](_0x32ef('0x26'),_0x10dae3,JSON[_0x32ef('0x17')](_0x26bc36));_0x16413e(_0x26bc36);})[_0x32ef('0x25')](function(_0x2ddfab){logger[_0x32ef('0x18')](_0x32ef('0x26'),_0x2ddfab[_0x32ef('0x19')],_0x10dae3);_0xc9e053(_0x4769fa[_0x32ef('0x18')](0x1f4,_0x2ddfab[_0x32ef('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x20d957){var _0x1d3d1a=this;return new Promise(function(_0x240831,_0x23e6f2){return db[_0x32ef('0x1d')]['update'](_0x20d957[_0x32ef('0x28')],{'raw':_0x20d957[_0x32ef('0x20')]?_0x20d957[_0x32ef('0x20')][_0x32ef('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d957[_0x32ef('0x20')]?_0x20d957['options'][_0x32ef('0x29')]||null:null,'attributes':_0x20d957[_0x32ef('0x20')]?_0x20d957['options'][_0x32ef('0x21')]||null:null,'limit':_0x20d957[_0x32ef('0x20')]?_0x20d957['options'][_0x32ef('0x2a')]||null:null})[_0x32ef('0x12')](function(_0x4709ed){logger[_0x32ef('0x1a')](_0x32ef('0x2b'),_0x20d957);logger[_0x32ef('0x15')](_0x32ef('0x2b'),_0x20d957,JSON[_0x32ef('0x17')](_0x4709ed));_0x240831(_0x4709ed);})[_0x32ef('0x25')](function(_0x10d4f2){logger[_0x32ef('0x18')](_0x32ef('0x2b'),_0x10d4f2['message'],_0x20d957);_0x23e6f2(_0x1d3d1a[_0x32ef('0x18')](0x1f4,_0x10d4f2[_0x32ef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f755c15..71083b8 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 _0xd7ce=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ce,0x16b));var _0xed7c=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xd7ce[_0x51bda1];return _0x1ce08c;};'use strict';var VoiceQueueReportEvents=require(_0xed7c('0x0'));var events=[_0xed7c('0x1'),_0xed7c('0x2'),_0xed7c('0x3')];function createListener(_0x4ce2a9,_0x4fe5c1){return function(_0x1230ec){_0x4fe5c1['emit'](_0x4ce2a9,_0x1230ec);};}function removeListener(_0x4a6138,_0x587c5a){return function(){VoiceQueueReportEvents[_0xed7c('0x4')](_0x4a6138,_0x587c5a);};}exports[_0xed7c('0x5')]=function(_0x194d4b){for(var _0x1aa7a0=0x0,_0x34bbd7=events[_0xed7c('0x6')];_0x1aa7a0<_0x34bbd7;_0x1aa7a0++){var _0x41afb9=events[_0x1aa7a0];var _0x270db6=createListener(_0xed7c('0x7')+_0x41afb9,_0x194d4b);VoiceQueueReportEvents['on'](_0x41afb9,_0x270db6);}}; \ No newline at end of file +var _0x120b=['removeListener','register','length','./voiceQueueReport.events','save','update','emit'];(function(_0x1c951c,_0x1f6839){var _0x879b04=function(_0x460245){while(--_0x460245){_0x1c951c['push'](_0x1c951c['shift']());}};_0x879b04(++_0x1f6839);}(_0x120b,0x8f));var _0xb120=function(_0x238a66,_0x4381fb){_0x238a66=_0x238a66-0x0;var _0x2a3b2f=_0x120b[_0x238a66];return _0x2a3b2f;};'use strict';var VoiceQueueReportEvents=require(_0xb120('0x0'));var events=[_0xb120('0x1'),'remove',_0xb120('0x2')];function createListener(_0xad3ac,_0x4301e9){return function(_0x2580ae){_0x4301e9[_0xb120('0x3')](_0xad3ac,_0x2580ae);};}function removeListener(_0xe1d9d1,_0x2208f9){return function(){VoiceQueueReportEvents[_0xb120('0x4')](_0xe1d9d1,_0x2208f9);};}exports[_0xb120('0x5')]=function(_0xbc7c27){for(var _0x1e3073=0x0,_0x568841=events[_0xb120('0x6')];_0x1e3073<_0x568841;_0x1e3073++){var _0x1f1165=events[_0x1e3073];var _0xa1d8ba=createListener('voiceQueueReport:'+_0x1f1165,_0xbc7c27);VoiceQueueReportEvents['on'](_0x1f1165,_0xa1d8ba);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8520fcb..2b79bcc 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 _0xe492=['put','update','delete','/:id','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create'];(function(_0x2c293f,_0x584d76){var _0x1e29af=function(_0x50eb09){while(--_0x50eb09){_0x2c293f['push'](_0x2c293f['shift']());}};_0x1e29af(++_0x584d76);}(_0xe492,0x169));var _0x2e49=function(_0x2f8d76,_0x3f6a7c){_0x2f8d76=_0x2f8d76-0x0;var _0x3fbb4a=_0xe492[_0x2f8d76];return _0x3fbb4a;};'use strict';var multer=require(_0x2e49('0x0'));var util=require(_0x2e49('0x1'));var path=require(_0x2e49('0x2'));var timeout=require(_0x2e49('0x3'));var express=require('express');var router=express[_0x2e49('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2e49('0x5'));var interaction=require(_0x2e49('0x6'));var config=require(_0x2e49('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x2e49('0x8')]('/',auth[_0x2e49('0x9')](),controller[_0x2e49('0xa')]);router[_0x2e49('0x8')]('/:id',auth[_0x2e49('0x9')](),controller[_0x2e49('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2e49('0xc')]);router[_0x2e49('0xd')]('/:id',auth[_0x2e49('0x9')](),controller[_0x2e49('0xe')]);router[_0x2e49('0xf')](_0x2e49('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x238f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3bf51a,_0x5ce05f){var _0x33e0c5=function(_0x51b95e){while(--_0x51b95e){_0x3bf51a['push'](_0x3bf51a['shift']());}};_0x33e0c5(++_0x5ce05f);}(_0x238f,0xa5));var _0xf238=function(_0x3f6dc1,_0x50a8f7){_0x3f6dc1=_0x3f6dc1-0x0;var _0x417eba=_0x238f[_0x3f6dc1];return _0x417eba;};'use strict';var multer=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var path=require(_0xf238('0x2'));var timeout=require('connect-timeout');var express=require(_0xf238('0x3'));var router=express[_0xf238('0x4')]();var fs_extra=require(_0xf238('0x5'));var auth=require(_0xf238('0x6'));var interaction=require(_0xf238('0x7'));var config=require(_0xf238('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0xf238('0x9')]('/',auth[_0xf238('0xa')](),controller['index']);router['get'](_0xf238('0xb'),auth['isAuthenticated'](),controller[_0xf238('0xc')]);router[_0xf238('0xd')]('/',auth[_0xf238('0xa')](),controller[_0xf238('0xe')]);router['put'](_0xf238('0xb'),auth['isAuthenticated'](),controller[_0xf238('0xf')]);router[_0xf238('0x10')](_0xf238('0xb'),auth[_0xf238('0xa')](),controller[_0xf238('0x11')]);module[_0xf238('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 0522df0..422358e 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 _0x7be8=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING'];(function(_0x442ad9,_0x2a0ea7){var _0x480808=function(_0x4ab713){while(--_0x4ab713){_0x442ad9['push'](_0x442ad9['shift']());}};_0x480808(++_0x2a0ea7);}(_0x7be8,0x81));var _0x87be=function(_0x299b08,_0x5338a6){_0x299b08=_0x299b08-0x0;var _0x14d50c=_0x7be8[_0x299b08];return _0x14d50c;};'use strict';var Sequelize=require(_0x87be('0x0'));var moment=require('moment');module[_0x87be('0x1')]={'time':{'type':Sequelize[_0x87be('0x2')]},'callid':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x87be('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x87be('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x87be('0x4')](_0x87be('0x5'))}}; \ No newline at end of file +var _0xec6f=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x213c2c,_0x3e685b){var _0x40da97=function(_0x188047){while(--_0x188047){_0x213c2c['push'](_0x213c2c['shift']());}};_0x40da97(++_0x3e685b);}(_0xec6f,0x130));var _0xfec6=function(_0x27a0bd,_0x41e831){_0x27a0bd=_0x27a0bd-0x0;var _0xa68da6=_0xec6f[_0x27a0bd];return _0xa68da6;};'use strict';var Sequelize=require(_0xfec6('0x0'));var moment=require(_0xfec6('0x1'));module[_0xfec6('0x2')]={'time':{'type':Sequelize[_0xfec6('0x3')]},'callid':{'type':Sequelize[_0xfec6('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfec6('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfec6('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfec6('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfec6('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfec6('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xfec6('0x5')](_0xfec6('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d9b29e4..84367fd 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 _0xa58a=['VoiceQueuesLog','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','rawAttributes','keys','catch','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x22c512,_0x2ad19b){var _0xfbb64b=function(_0x585ac1){while(--_0x585ac1){_0x22c512['push'](_0x22c512['shift']());}};_0xfbb64b(++_0x2ad19b);}(_0xa58a,0x104));var _0xaa58=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xa58a[_0x1347f8];return _0x218368;};'use strict';var emlformat=require(_0xaa58('0x0'));var rimraf=require(_0xaa58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa58('0x2'));var rp=require('request-promise');var moment=require(_0xaa58('0x3'));var BPromise=require(_0xaa58('0x4'));var Mustache=require('mustache');var util=require(_0xaa58('0x5'));var path=require(_0xaa58('0x6'));var sox=require(_0xaa58('0x7'));var csv=require('to-csv');var ejs=require(_0xaa58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa58('0x9'));var squel=require(_0xaa58('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa58('0xb'));var deskjs=require(_0xaa58('0xc'));var toCsv=require(_0xaa58('0xd'));var querystring=require(_0xaa58('0xe'));var Papa=require(_0xaa58('0xf'));var Redis=require(_0xaa58('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xaa58('0x11'));var as=require(_0xaa58('0x12'));var hardwareService=require(_0xaa58('0x13'));var logger=require(_0xaa58('0x14'))(_0xaa58('0x15'));var utils=require(_0xaa58('0x16'));var config=require(_0xaa58('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa58('0x18'))['db'];function respondWithStatusCode(_0x271a91,_0x8eb501){_0x8eb501=_0x8eb501||0xcc;return function(_0x3056b7){if(_0x3056b7){return _0x271a91[_0xaa58('0x19')](_0x8eb501);}return _0x271a91[_0xaa58('0x1a')](_0x8eb501)[_0xaa58('0x1b')]();};}function respondWithResult(_0x8aa1af,_0x1a074f){_0x1a074f=_0x1a074f||0xc8;return function(_0x52e4e1){if(_0x52e4e1){return _0x8aa1af[_0xaa58('0x1a')](_0x1a074f)[_0xaa58('0x1c')](_0x52e4e1);}};}function respondWithFilteredResult(_0x5673d2,_0x4d03a1){return function(_0x537b3d){if(_0x537b3d){var _0xb29157=typeof _0x4d03a1[_0xaa58('0x1d')]===_0xaa58('0x1e')&&typeof _0x4d03a1[_0xaa58('0x1f')]===_0xaa58('0x1e');var _0x25683c=_0x537b3d[_0xaa58('0x20')];var _0x410942=_0xb29157?0x0:_0x4d03a1[_0xaa58('0x1d')];var _0xb5d8e7=_0xb29157?_0x537b3d[_0xaa58('0x20')]:_0x4d03a1['offset']+_0x4d03a1[_0xaa58('0x1f')];var _0x3b403a;if(_0xb5d8e7>=_0x25683c){_0xb5d8e7=_0x25683c;_0x3b403a=0xc8;}else{_0x3b403a=0xce;}_0x5673d2[_0xaa58('0x1a')](_0x3b403a);return _0x5673d2['set'](_0xaa58('0x21'),_0x410942+'-'+_0xb5d8e7+'/'+_0x25683c)[_0xaa58('0x1c')](_0x537b3d);}return null;};}function patchUpdates(_0x23ca97){return function(_0x42215c){try{jsonpatch[_0xaa58('0x22')](_0x42215c,_0x23ca97,!![]);}catch(_0x3fbc51){return BPromise[_0xaa58('0x23')](_0x3fbc51);}return _0x42215c[_0xaa58('0x24')]();};}function saveUpdates(_0x1f475d,_0x2f407a){return function(_0x45a4c7){if(_0x45a4c7){return _0x45a4c7[_0xaa58('0x25')](_0x1f475d)['then'](function(_0x183b43){return _0x183b43;});}return null;};}function removeEntity(_0x5d7fef,_0x2c7105){return function(_0x3f16b5){if(_0x3f16b5){return _0x3f16b5[_0xaa58('0x26')]()[_0xaa58('0x27')](function(){_0x5d7fef[_0xaa58('0x1a')](0xcc)[_0xaa58('0x1b')]();});}};}function handleEntityNotFound(_0x16b94a,_0x405332){return function(_0x457293){if(!_0x457293){_0x16b94a[_0xaa58('0x19')](0x194);}return _0x457293;};}function handleError(_0x55b518,_0x19f601){_0x19f601=_0x19f601||0x1f4;return function(_0x242479){logger[_0xaa58('0x28')](_0x242479[_0xaa58('0x29')]);if(_0x242479[_0xaa58('0x2a')]){delete _0x242479[_0xaa58('0x2a')];}_0x55b518['status'](_0x19f601)[_0xaa58('0x2b')](_0x242479);};}exports['index']=function(_0x3eaf8c,_0x29c581){var _0x338acb={},_0x49eeb7={},_0x137d70={'count':0x0,'rows':[]};var _0x1c5507=_['map'](db[_0xaa58('0x2c')]['rawAttributes'],function(_0x3835fe){return{'name':_0x3835fe['fieldName'],'type':_0x3835fe[_0xaa58('0x2d')][_0xaa58('0x2e')]};});_0x49eeb7[_0xaa58('0x2f')]=_[_0xaa58('0x30')](_0x1c5507,'name');_0x49eeb7[_0xaa58('0x31')]=_['keys'](_0x3eaf8c[_0xaa58('0x31')]);_0x49eeb7[_0xaa58('0x32')]=_[_0xaa58('0x33')](_0x49eeb7['model'],_0x49eeb7[_0xaa58('0x31')]);_0x338acb['attributes']=_[_0xaa58('0x33')](_0x49eeb7[_0xaa58('0x2f')],qs[_0xaa58('0x34')](_0x3eaf8c['query'][_0xaa58('0x34')]));_0x338acb['attributes']=_0x338acb[_0xaa58('0x35')][_0xaa58('0x36')]?_0x338acb[_0xaa58('0x35')]:_0x49eeb7[_0xaa58('0x2f')];if(!_0x3eaf8c[_0xaa58('0x31')][_0xaa58('0x37')](_0xaa58('0x38'))){_0x338acb[_0xaa58('0x1f')]=qs[_0xaa58('0x1f')](_0x3eaf8c[_0xaa58('0x31')][_0xaa58('0x1f')]);_0x338acb[_0xaa58('0x1d')]=qs[_0xaa58('0x1d')](_0x3eaf8c[_0xaa58('0x31')]['offset']);}_0x338acb[_0xaa58('0x39')]=qs[_0xaa58('0x3a')](_0x3eaf8c[_0xaa58('0x31')][_0xaa58('0x3a')]);_0x338acb['where']=qs['filters'](_[_0xaa58('0x3b')](_0x3eaf8c['query'],_0x49eeb7[_0xaa58('0x32')]),_0x1c5507);if(_0x3eaf8c['query'][_0xaa58('0x3c')]){_0x338acb[_0xaa58('0x3d')]=_['merge'](_0x338acb[_0xaa58('0x3d')],{'$or':_[_0xaa58('0x30')](_0x1c5507,function(_0xa088e6){if(_0xa088e6[_0xaa58('0x2d')]!==_0xaa58('0x3e')){var _0x303c56={};_0x303c56[_0xa088e6[_0xaa58('0x2a')]]={'$like':'%'+_0x3eaf8c[_0xaa58('0x31')][_0xaa58('0x3c')]+'%'};return _0x303c56;}})});}_0x338acb=_[_0xaa58('0x3f')]({},_0x338acb,_0x3eaf8c[_0xaa58('0x40')]);var _0x43c62a={'where':_0x338acb[_0xaa58('0x3d')]};return db[_0xaa58('0x2c')][_0xaa58('0x20')](_0x43c62a)['then'](function(_0x3e176b){_0x137d70['count']=_0x3e176b;if(_0x3eaf8c[_0xaa58('0x31')][_0xaa58('0x41')]){_0x338acb[_0xaa58('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xaa58('0x43')](_0x338acb);})['then'](function(_0x5a055a){_0x137d70[_0xaa58('0x44')]=_0x5a055a;return _0x137d70;})['then'](respondWithFilteredResult(_0x29c581,_0x338acb))['catch'](handleError(_0x29c581,null));};exports['show']=function(_0x3009f5,_0x3d561a){var _0x3a6f58={'raw':!![],'where':{'id':_0x3009f5[_0xaa58('0x45')]['id']}},_0x2e2257={};_0x2e2257['model']=_['keys'](db[_0xaa58('0x2c')][_0xaa58('0x46')]);_0x2e2257[_0xaa58('0x31')]=_[_0xaa58('0x47')](_0x3009f5[_0xaa58('0x31')]);_0x2e2257[_0xaa58('0x32')]=_[_0xaa58('0x33')](_0x2e2257['model'],_0x2e2257[_0xaa58('0x31')]);_0x3a6f58[_0xaa58('0x35')]=_[_0xaa58('0x33')](_0x2e2257[_0xaa58('0x2f')],qs[_0xaa58('0x34')](_0x3009f5['query']['fields']));_0x3a6f58[_0xaa58('0x35')]=_0x3a6f58[_0xaa58('0x35')][_0xaa58('0x36')]?_0x3a6f58['attributes']:_0x2e2257[_0xaa58('0x2f')];if(_0x3009f5[_0xaa58('0x31')][_0xaa58('0x41')]){_0x3a6f58[_0xaa58('0x42')]=[{'all':!![]}];}_0x3a6f58=_[_0xaa58('0x3f')]({},_0x3a6f58,_0x3009f5[_0xaa58('0x40')]);return db[_0xaa58('0x2c')]['find'](_0x3a6f58)['then'](handleEntityNotFound(_0x3d561a,null))[_0xaa58('0x27')](respondWithResult(_0x3d561a,null))[_0xaa58('0x48')](handleError(_0x3d561a,null));};exports[_0xaa58('0x49')]=function(_0x5c3f49,_0x30d0b4){return db[_0xaa58('0x2c')][_0xaa58('0x49')](_0x5c3f49[_0xaa58('0x4a')],{})[_0xaa58('0x27')](respondWithResult(_0x30d0b4,0xc9))['catch'](handleError(_0x30d0b4,null));};exports[_0xaa58('0x25')]=function(_0x4e1030,_0x16a579){if(_0x4e1030[_0xaa58('0x4a')]['id']){delete _0x4e1030[_0xaa58('0x4a')]['id'];}return db[_0xaa58('0x2c')][_0xaa58('0x4b')]({'where':{'id':_0x4e1030[_0xaa58('0x45')]['id']}})[_0xaa58('0x27')](handleEntityNotFound(_0x16a579,null))[_0xaa58('0x27')](saveUpdates(_0x4e1030[_0xaa58('0x4a')],null))[_0xaa58('0x27')](respondWithResult(_0x16a579,null))['catch'](handleError(_0x16a579,null));};exports['destroy']=function(_0x3c5fc9,_0x30fd96){return db[_0xaa58('0x2c')]['find']({'where':{'id':_0x3c5fc9[_0xaa58('0x45')]['id']}})[_0xaa58('0x27')](handleEntityNotFound(_0x30fd96,null))[_0xaa58('0x27')](removeEntity(_0x30fd96,null))[_0xaa58('0x48')](handleError(_0x30fd96,null));}; \ No newline at end of file +var _0xf8d6=['limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xf8d6,0xc7));var _0x6f8d=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf8d6[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f8d('0x0'));var jsonpatch=require(_0x6f8d('0x1'));var rp=require(_0x6f8d('0x2'));var moment=require(_0x6f8d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f8d('0x4'));var util=require('util');var path=require(_0x6f8d('0x5'));var sox=require(_0x6f8d('0x6'));var csv=require(_0x6f8d('0x7'));var ejs=require(_0x6f8d('0x8'));var fs=require('fs');var fs_extra=require(_0x6f8d('0x9'));var _=require(_0x6f8d('0xa'));var squel=require(_0x6f8d('0xb'));var crypto=require(_0x6f8d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6f8d('0xd'));var toCsv=require(_0x6f8d('0x7'));var querystring=require(_0x6f8d('0xe'));var Papa=require(_0x6f8d('0xf'));var Redis=require(_0x6f8d('0x10'));var authService=require(_0x6f8d('0x11'));var qs=require(_0x6f8d('0x12'));var as=require(_0x6f8d('0x13'));var hardwareService=require(_0x6f8d('0x14'));var logger=require(_0x6f8d('0x15'))(_0x6f8d('0x16'));var utils=require(_0x6f8d('0x17'));var config=require(_0x6f8d('0x18'));var licenseUtil=require(_0x6f8d('0x19'));var db=require(_0x6f8d('0x1a'))['db'];function respondWithStatusCode(_0x43c8b1,_0x4564e6){_0x4564e6=_0x4564e6||0xcc;return function(_0x33c2f9){if(_0x33c2f9){return _0x43c8b1[_0x6f8d('0x1b')](_0x4564e6);}return _0x43c8b1[_0x6f8d('0x1c')](_0x4564e6)[_0x6f8d('0x1d')]();};}function respondWithResult(_0x407324,_0x27b0d4){_0x27b0d4=_0x27b0d4||0xc8;return function(_0xdfa919){if(_0xdfa919){return _0x407324[_0x6f8d('0x1c')](_0x27b0d4)['json'](_0xdfa919);}};}function respondWithFilteredResult(_0x10e482,_0x5e6e9d){return function(_0x28a5fb){if(_0x28a5fb){var _0x38f97f=typeof _0x5e6e9d[_0x6f8d('0x1e')]===_0x6f8d('0x1f')&&typeof _0x5e6e9d[_0x6f8d('0x20')]===_0x6f8d('0x1f');var _0x5b221d=_0x28a5fb['count'];var _0x2c954d=_0x38f97f?0x0:_0x5e6e9d['offset'];var _0x4f761f=_0x38f97f?_0x28a5fb[_0x6f8d('0x21')]:_0x5e6e9d[_0x6f8d('0x1e')]+_0x5e6e9d[_0x6f8d('0x20')];var _0x26e753;if(_0x4f761f>=_0x5b221d){_0x4f761f=_0x5b221d;_0x26e753=0xc8;}else{_0x26e753=0xce;}_0x10e482['status'](_0x26e753);return _0x10e482[_0x6f8d('0x22')](_0x6f8d('0x23'),_0x2c954d+'-'+_0x4f761f+'/'+_0x5b221d)['json'](_0x28a5fb);}return null;};}function patchUpdates(_0xcf1505){return function(_0x5b5579){try{jsonpatch[_0x6f8d('0x24')](_0x5b5579,_0xcf1505,!![]);}catch(_0x592a18){return BPromise['reject'](_0x592a18);}return _0x5b5579['save']();};}function saveUpdates(_0x3261b1,_0xf1b8c1){return function(_0x141e70){if(_0x141e70){return _0x141e70[_0x6f8d('0x25')](_0x3261b1)['then'](function(_0x3618fe){return _0x3618fe;});}return null;};}function removeEntity(_0x42beff,_0x3aa7dc){return function(_0x2a9774){if(_0x2a9774){return _0x2a9774[_0x6f8d('0x26')]()[_0x6f8d('0x27')](function(){_0x42beff[_0x6f8d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d5a8,_0x55e1ab){return function(_0x3a8184){if(!_0x3a8184){_0x14d5a8['sendStatus'](0x194);}return _0x3a8184;};}function handleError(_0x1210bb,_0x128421){_0x128421=_0x128421||0x1f4;return function(_0x2bc7a9){logger[_0x6f8d('0x28')](_0x2bc7a9[_0x6f8d('0x29')]);if(_0x2bc7a9[_0x6f8d('0x2a')]){delete _0x2bc7a9[_0x6f8d('0x2a')];}_0x1210bb[_0x6f8d('0x1c')](_0x128421)[_0x6f8d('0x2b')](_0x2bc7a9);};}exports[_0x6f8d('0x2c')]=function(_0x1a5fac,_0x2c2ed7){var _0x5806cc={},_0x2237c8={},_0x883f98={'count':0x0,'rows':[]};var _0x563992=_[_0x6f8d('0x2d')](db[_0x6f8d('0x2e')][_0x6f8d('0x2f')],function(_0x2fd4ea){return{'name':_0x2fd4ea[_0x6f8d('0x30')],'type':_0x2fd4ea[_0x6f8d('0x31')][_0x6f8d('0x32')]};});_0x2237c8['model']=_[_0x6f8d('0x2d')](_0x563992,_0x6f8d('0x2a'));_0x2237c8[_0x6f8d('0x33')]=_['keys'](_0x1a5fac[_0x6f8d('0x33')]);_0x2237c8[_0x6f8d('0x34')]=_['intersection'](_0x2237c8[_0x6f8d('0x35')],_0x2237c8[_0x6f8d('0x33')]);_0x5806cc[_0x6f8d('0x36')]=_[_0x6f8d('0x37')](_0x2237c8[_0x6f8d('0x35')],qs['fields'](_0x1a5fac[_0x6f8d('0x33')][_0x6f8d('0x38')]));_0x5806cc['attributes']=_0x5806cc[_0x6f8d('0x36')][_0x6f8d('0x39')]?_0x5806cc['attributes']:_0x2237c8[_0x6f8d('0x35')];if(!_0x1a5fac['query'][_0x6f8d('0x3a')](_0x6f8d('0x3b'))){_0x5806cc[_0x6f8d('0x20')]=qs[_0x6f8d('0x20')](_0x1a5fac['query'][_0x6f8d('0x20')]);_0x5806cc[_0x6f8d('0x1e')]=qs[_0x6f8d('0x1e')](_0x1a5fac[_0x6f8d('0x33')]['offset']);}_0x5806cc[_0x6f8d('0x3c')]=qs[_0x6f8d('0x3d')](_0x1a5fac[_0x6f8d('0x33')][_0x6f8d('0x3d')]);_0x5806cc[_0x6f8d('0x3e')]=qs[_0x6f8d('0x34')](_['pick'](_0x1a5fac[_0x6f8d('0x33')],_0x2237c8[_0x6f8d('0x34')]),_0x563992);if(_0x1a5fac[_0x6f8d('0x33')][_0x6f8d('0x3f')]){_0x5806cc[_0x6f8d('0x3e')]=_[_0x6f8d('0x40')](_0x5806cc[_0x6f8d('0x3e')],{'$or':_['map'](_0x563992,function(_0x36be37){if(_0x36be37[_0x6f8d('0x31')]!==_0x6f8d('0x41')){var _0x6a1f14={};_0x6a1f14[_0x36be37['name']]={'$like':'%'+_0x1a5fac['query'][_0x6f8d('0x3f')]+'%'};return _0x6a1f14;}})});}_0x5806cc=_[_0x6f8d('0x40')]({},_0x5806cc,_0x1a5fac['options']);var _0x1a4580={'where':_0x5806cc['where']};return db[_0x6f8d('0x2e')]['count'](_0x1a4580)[_0x6f8d('0x27')](function(_0x200b10){_0x883f98[_0x6f8d('0x21')]=_0x200b10;if(_0x1a5fac['query'][_0x6f8d('0x42')]){_0x5806cc[_0x6f8d('0x43')]=[{'all':!![]}];}return db[_0x6f8d('0x2e')][_0x6f8d('0x44')](_0x5806cc);})['then'](function(_0x55af52){_0x883f98[_0x6f8d('0x45')]=_0x55af52;return _0x883f98;})[_0x6f8d('0x27')](respondWithFilteredResult(_0x2c2ed7,_0x5806cc))['catch'](handleError(_0x2c2ed7,null));};exports['show']=function(_0x455f77,_0x12c015){var _0x4abeef={'raw':!![],'where':{'id':_0x455f77[_0x6f8d('0x46')]['id']}},_0x47c619={};_0x47c619[_0x6f8d('0x35')]=_[_0x6f8d('0x47')](db[_0x6f8d('0x2e')][_0x6f8d('0x2f')]);_0x47c619[_0x6f8d('0x33')]=_[_0x6f8d('0x47')](_0x455f77[_0x6f8d('0x33')]);_0x47c619[_0x6f8d('0x34')]=_[_0x6f8d('0x37')](_0x47c619[_0x6f8d('0x35')],_0x47c619[_0x6f8d('0x33')]);_0x4abeef[_0x6f8d('0x36')]=_[_0x6f8d('0x37')](_0x47c619[_0x6f8d('0x35')],qs['fields'](_0x455f77[_0x6f8d('0x33')][_0x6f8d('0x38')]));_0x4abeef[_0x6f8d('0x36')]=_0x4abeef[_0x6f8d('0x36')][_0x6f8d('0x39')]?_0x4abeef['attributes']:_0x47c619[_0x6f8d('0x35')];if(_0x455f77[_0x6f8d('0x33')]['includeAll']){_0x4abeef[_0x6f8d('0x43')]=[{'all':!![]}];}_0x4abeef=_[_0x6f8d('0x40')]({},_0x4abeef,_0x455f77[_0x6f8d('0x48')]);return db[_0x6f8d('0x2e')][_0x6f8d('0x49')](_0x4abeef)[_0x6f8d('0x27')](handleEntityNotFound(_0x12c015,null))['then'](respondWithResult(_0x12c015,null))[_0x6f8d('0x4a')](handleError(_0x12c015,null));};exports[_0x6f8d('0x4b')]=function(_0xcbbcd5,_0x391982){return db[_0x6f8d('0x2e')]['create'](_0xcbbcd5[_0x6f8d('0x4c')],{})[_0x6f8d('0x27')](respondWithResult(_0x391982,0xc9))[_0x6f8d('0x4a')](handleError(_0x391982,null));};exports['update']=function(_0x5357dc,_0x4077c5){if(_0x5357dc['body']['id']){delete _0x5357dc['body']['id'];}return db[_0x6f8d('0x2e')][_0x6f8d('0x49')]({'where':{'id':_0x5357dc['params']['id']}})['then'](handleEntityNotFound(_0x4077c5,null))[_0x6f8d('0x27')](saveUpdates(_0x5357dc[_0x6f8d('0x4c')],null))[_0x6f8d('0x27')](respondWithResult(_0x4077c5,null))[_0x6f8d('0x4a')](handleError(_0x4077c5,null));};exports[_0x6f8d('0x26')]=function(_0x5ab704,_0x213af7){return db['VoiceQueuesLog'][_0x6f8d('0x49')]({'where':{'id':_0x5ab704[_0x6f8d('0x46')]['id']}})[_0x6f8d('0x27')](handleEntityNotFound(_0x213af7,null))['then'](removeEntity(_0x213af7,null))[_0x6f8d('0x4a')](handleError(_0x213af7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 18e6dbc..6c0e312 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 _0x4c3c=['util','api','request-promise','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','lodash'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x3fe780,_0x26079d){_0x3fe780=_0x3fe780-0x0;var _0x59c64e=_0x4c3c[_0x3fe780];return _0x59c64e;};'use strict';var _=require(_0xc4c3('0x0'));var util=require(_0xc4c3('0x1'));var logger=require('../../config/logger')(_0xc4c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc4c3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4c3('0x4'));var attributes=require(_0xc4c3('0x5'));module[_0xc4c3('0x6')]=function(_0x36cea1,_0x1cb620){return _0x36cea1[_0xc4c3('0x7')](_0xc4c3('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xc4c3('0x9'),'fields':[_0xc4c3('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x6113=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6113,0x1c8));var _0x3611=function(_0x244c29,_0x1ab93c){_0x244c29=_0x244c29-0x0;var _0x4845af=_0x6113[_0x244c29];return _0x4845af;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))('api');var moment=require(_0x3611('0x3'));var BPromise=require(_0x3611('0x4'));var rp=require(_0x3611('0x5'));var fs=require('fs');var path=require(_0x3611('0x6'));var rimraf=require(_0x3611('0x7'));var config=require(_0x3611('0x8'));var attributes=require(_0x3611('0x9'));module['exports']=function(_0x377654,_0x18306f){return _0x377654[_0x3611('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x3611('0xb'),'paranoid':![],'indexes':[{'name':_0x3611('0xc'),'fields':[_0x3611('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 06163c0..4eb1bba 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 _0x657b=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x657b,0x131));var _0xb657=function(_0x246c1c,_0x538e20){_0x246c1c=_0x246c1c-0x0;var _0x4ef12c=_0x657b[_0x246c1c];return _0x4ef12c;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var moment=require(_0xb657('0x2'));var BPromise=require(_0xb657('0x3'));var rs=require(_0xb657('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb657('0x5'))['db'];var utils=require(_0xb657('0x6'));var logger=require('../../config/logger')(_0xb657('0x7'));var config=require(_0xb657('0x8'));var jayson=require(_0xb657('0x9'));var client=jayson[_0xb657('0xa')][_0xb657('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d54f6,_0x471e78,_0x55acdf){return new BPromise(function(_0x326dd7,_0x42a844){return client[_0xb657('0xc')](_0x5d54f6,_0x55acdf)['then'](function(_0x36b334){logger['info'](_0xb657('0xd'),_0x471e78,'request\x20sent');logger[_0xb657('0xe')](_0xb657('0xf'),_0x471e78,_0xb657('0x10'),JSON['stringify'](_0x36b334));if(_0x36b334[_0xb657('0x11')]){if(_0x36b334[_0xb657('0x11')][_0xb657('0x12')]===0x1f4){logger[_0xb657('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x471e78,_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);return _0x42a844(_0x36b334['error'][_0xb657('0x13')]);}logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x36b334[_0xb657('0x11')]['message']);return _0x326dd7(_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x471e78,_0xb657('0x10'));_0x326dd7(_0x36b334[_0xb657('0x14')][_0xb657('0x13')]);}})[_0xb657('0x15')](function(_0x17c045){logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x17c045);_0x42a844(_0x17c045);});});} \ No newline at end of file +var _0xccef=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch'];(function(_0x5c12f2,_0x5de043){var _0x5e8344=function(_0x445932){while(--_0x445932){_0x5c12f2['push'](_0x5c12f2['shift']());}};_0x5e8344(++_0x5de043);}(_0xccef,0x1ee));var _0xfcce=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xccef[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcce('0x3'))['db'];var utils=require(_0xfcce('0x4'));var logger=require(_0xfcce('0x5'))('rpc');var config=require(_0xfcce('0x6'));var jayson=require(_0xfcce('0x7'));var client=jayson['client'][_0xfcce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25256d,_0x4bcc9f,_0x30730c){return new BPromise(function(_0x2e4775,_0x51586d){return client['request'](_0x25256d,_0x30730c)[_0xfcce('0x9')](function(_0x4566ad){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x4bcc9f,'request\x20sent');logger[_0xfcce('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4bcc9f,_0xfcce('0xd'),JSON[_0xfcce('0xe')](_0x4566ad));if(_0x4566ad['error']){if(_0x4566ad[_0xfcce('0xf')]['code']===0x1f4){logger[_0xfcce('0xf')](_0xfcce('0xb'),_0x4bcc9f,_0x4566ad[_0xfcce('0xf')][_0xfcce('0x10')]);return _0x51586d(_0x4566ad['error'][_0xfcce('0x10')]);}logger[_0xfcce('0xf')](_0xfcce('0xb'),_0x4bcc9f,_0x4566ad[_0xfcce('0xf')]['message']);return _0x2e4775(_0x4566ad['error'][_0xfcce('0x10')]);}else{logger[_0xfcce('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4bcc9f,_0xfcce('0xd'));_0x2e4775(_0x4566ad[_0xfcce('0x11')]['message']);}})[_0xfcce('0x12')](function(_0x5b7b9b){logger[_0xfcce('0xf')](_0xfcce('0xb'),_0x4bcc9f,_0x5b7b9b);_0x51586d(_0x5b7b9b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8119861..6bb9d70 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 _0x7861=['download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','runTranscribe','put','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','/:id','/:id/download'];(function(_0x5e03ab,_0x595d38){var _0x25a10f=function(_0x49fd47){while(--_0x49fd47){_0x5e03ab['push'](_0x5e03ab['shift']());}};_0x25a10f(++_0x595d38);}(_0x7861,0x153));var _0x1786=function(_0x49b383,_0x268869){_0x49b383=_0x49b383-0x0;var _0x20948d=_0x7861[_0x49b383];return _0x20948d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1786('0x0'));var timeout=require(_0x1786('0x1'));var express=require(_0x1786('0x2'));var router=express[_0x1786('0x3')]();var fs_extra=require(_0x1786('0x4'));var auth=require(_0x1786('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1786('0x6'));var controller=require(_0x1786('0x7'));router[_0x1786('0x8')]('/',auth[_0x1786('0x9')](),controller['index']);router['get']('/describe',auth[_0x1786('0x9')](),controller[_0x1786('0xa')]);router['get'](_0x1786('0xb'),auth[_0x1786('0x9')](),controller['show']);router[_0x1786('0x8')](_0x1786('0xc'),auth[_0x1786('0x9')](),controller[_0x1786('0xd')]);router[_0x1786('0x8')](_0x1786('0xe'),controller[_0x1786('0xf')]);router[_0x1786('0x8')](_0x1786('0x10'),auth[_0x1786('0x9')](),controller[_0x1786('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/transcribe',auth[_0x1786('0x9')](),controller[_0x1786('0x12')]);router[_0x1786('0x13')](_0x1786('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1786('0x14')](_0x1786('0xb'),auth[_0x1786('0x9')](),controller[_0x1786('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7018=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7018,0x1b6));var _0x8701=function(_0x3fc009,_0x4c36e3){_0x3fc009=_0x3fc009-0x0;var _0x414869=_0x7018[_0x3fc009];return _0x414869;};'use strict';var multer=require(_0x8701('0x0'));var util=require(_0x8701('0x1'));var path=require('path');var timeout=require(_0x8701('0x2'));var express=require(_0x8701('0x3'));var router=express[_0x8701('0x4')]();var fs_extra=require(_0x8701('0x5'));var auth=require(_0x8701('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8701('0x7'));var controller=require('./voiceRecording.controller');router[_0x8701('0x8')]('/',auth[_0x8701('0x9')](),controller[_0x8701('0xa')]);router[_0x8701('0x8')](_0x8701('0xb'),auth[_0x8701('0x9')](),controller[_0x8701('0xc')]);router[_0x8701('0x8')](_0x8701('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8701('0x8')](_0x8701('0xe'),auth[_0x8701('0x9')](),controller['download']);router['get']('/:id/downloads',controller[_0x8701('0xf')]);router['get'](_0x8701('0x10'),auth[_0x8701('0x9')](),controller[_0x8701('0x11')]);router[_0x8701('0x12')]('/',auth[_0x8701('0x9')](),controller['create']);router[_0x8701('0x12')](_0x8701('0x10'),auth[_0x8701('0x9')](),controller[_0x8701('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8701('0x14')]);router[_0x8701('0x15')](_0x8701('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8701('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e5c08c5..300e17e 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(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 fe98bf0..4b2ebad 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 _0xb3c6=['crypto','desk.js','querystring','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','keys','include','create','body','update','find','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','existsSync','decryptFile','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','status','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash'];(function(_0x42c2f7,_0x16bbdd){var _0x55c3ae=function(_0x24502f){while(--_0x24502f){_0x42c2f7['push'](_0x42c2f7['shift']());}};_0x55c3ae(++_0x16bbdd);}(_0xb3c6,0x12b));var _0x6b3c=function(_0x4295fd,_0x1f2573){_0x4295fd=_0x4295fd-0x0;var _0x96f34e=_0xb3c6[_0x4295fd];return _0x96f34e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b3c('0x0'));var zipdir=require(_0x6b3c('0x1'));var jsonpatch=require(_0x6b3c('0x2'));var rp=require(_0x6b3c('0x3'));var moment=require(_0x6b3c('0x4'));var BPromise=require(_0x6b3c('0x5'));var Mustache=require(_0x6b3c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6b3c('0x7'));var csv=require(_0x6b3c('0x8'));var ejs=require(_0x6b3c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b3c('0xa'));var squel=require('squel');var crypto=require(_0x6b3c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6b3c('0xc'));var toCsv=require(_0x6b3c('0x8'));var querystring=require(_0x6b3c('0xd'));var Papa=require('papaparse');var AWS=require(_0x6b3c('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0x6b3c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6b3c('0x10'));var as=require(_0x6b3c('0x11'));var hardwareService=require(_0x6b3c('0x12'));var logger=require(_0x6b3c('0x13'))(_0x6b3c('0x14'));var utils=require(_0x6b3c('0x15'));var config=require(_0x6b3c('0x16'));var licenseUtil=require(_0x6b3c('0x17'));var db=require(_0x6b3c('0x18'))['db'];function respondWithStatusCode(_0x3ff726,_0x3e80d3){_0x3e80d3=_0x3e80d3||0xcc;return function(_0x221273){if(_0x221273){return _0x3ff726['sendStatus'](_0x3e80d3);}return _0x3ff726['status'](_0x3e80d3)[_0x6b3c('0x19')]();};}function respondWithResult(_0x23e80c,_0x428ba4){_0x428ba4=_0x428ba4||0xc8;return function(_0x16a8dc){if(_0x16a8dc){return _0x23e80c['status'](_0x428ba4)[_0x6b3c('0x1a')](_0x16a8dc);}};}function respondWithFilteredResult(_0x38ad04,_0x9849e7){return function(_0x298ea2){if(_0x298ea2){var _0x49aac9=typeof _0x9849e7[_0x6b3c('0x1b')]===_0x6b3c('0x1c')&&typeof _0x9849e7[_0x6b3c('0x1d')]===_0x6b3c('0x1c');var _0x2b2b22=_0x298ea2[_0x6b3c('0x1e')];var _0x2f07f7=_0x49aac9?0x0:_0x9849e7['offset'];var _0x8fea33=_0x49aac9?_0x298ea2[_0x6b3c('0x1e')]:_0x9849e7[_0x6b3c('0x1b')]+_0x9849e7[_0x6b3c('0x1d')];var _0x51be09;if(_0x8fea33>=_0x2b2b22){_0x8fea33=_0x2b2b22;_0x51be09=0xc8;}else{_0x51be09=0xce;}_0x38ad04['status'](_0x51be09);return _0x38ad04[_0x6b3c('0x1f')](_0x6b3c('0x20'),_0x2f07f7+'-'+_0x8fea33+'/'+_0x2b2b22)[_0x6b3c('0x1a')](_0x298ea2);}return null;};}function patchUpdates(_0x289e7c){return function(_0x5c6bcb){try{jsonpatch[_0x6b3c('0x21')](_0x5c6bcb,_0x289e7c,!![]);}catch(_0x5d9f68){return BPromise['reject'](_0x5d9f68);}return _0x5c6bcb[_0x6b3c('0x22')]();};}function saveUpdates(_0x2d77c6,_0x5b02cd){return function(_0x11cf59){if(_0x11cf59){return _0x11cf59['update'](_0x2d77c6)[_0x6b3c('0x23')](function(_0x260540){return _0x260540;});}return null;};}function removeEntity(_0x1dd1d5,_0x306784){return function(_0x1c94bb){if(_0x1c94bb){return _0x1c94bb['destroy']()[_0x6b3c('0x23')](function(){_0x1dd1d5['status'](0xcc)[_0x6b3c('0x19')]();});}};}function handleEntityNotFound(_0x25d8e8,_0x570ac4){return function(_0x38a553){if(!_0x38a553){_0x25d8e8[_0x6b3c('0x24')](0x194);}return _0x38a553;};}function handleError(_0x58c1aa,_0x32819f){_0x32819f=_0x32819f||0x1f4;return function(_0x5a0340){logger[_0x6b3c('0x25')](_0x5a0340[_0x6b3c('0x26')]);if(_0x5a0340[_0x6b3c('0x27')]){delete _0x5a0340[_0x6b3c('0x27')];}_0x58c1aa['status'](_0x32819f)[_0x6b3c('0x28')](_0x5a0340);};}exports['index']=function(_0x441c15,_0x567eb8){var _0x2274db={},_0x1dc2a2={},_0xce222c={'count':0x0,'rows':[]};var _0x5e802a=_[_0x6b3c('0x29')](db[_0x6b3c('0x2a')][_0x6b3c('0x2b')],function(_0x341531){return{'name':_0x341531[_0x6b3c('0x2c')],'type':_0x341531[_0x6b3c('0x2d')][_0x6b3c('0x2e')]};});_0x1dc2a2['model']=_[_0x6b3c('0x2f')](_[_0x6b3c('0x29')](_0x5e802a,_0x6b3c('0x27')),[_0x6b3c('0x30')]);_0x1dc2a2['query']=_['keys'](_0x441c15[_0x6b3c('0x31')]);_0x1dc2a2[_0x6b3c('0x32')]=_[_0x6b3c('0x33')](_0x1dc2a2['model'],_0x1dc2a2[_0x6b3c('0x31')]);_0x2274db[_0x6b3c('0x34')]=_['intersection'](_0x1dc2a2[_0x6b3c('0x35')],qs[_0x6b3c('0x36')](_0x441c15[_0x6b3c('0x31')]['fields']));_0x2274db['attributes']=_0x2274db[_0x6b3c('0x34')][_0x6b3c('0x37')]?_0x2274db[_0x6b3c('0x34')]:_0x1dc2a2[_0x6b3c('0x35')];if(!_0x441c15[_0x6b3c('0x31')][_0x6b3c('0x38')](_0x6b3c('0x39'))){_0x2274db[_0x6b3c('0x1d')]=qs['limit'](_0x441c15[_0x6b3c('0x31')]['limit']);_0x2274db[_0x6b3c('0x1b')]=qs[_0x6b3c('0x1b')](_0x441c15[_0x6b3c('0x31')][_0x6b3c('0x1b')]);}_0x2274db[_0x6b3c('0x3a')]=qs[_0x6b3c('0x3b')](_0x441c15['query'][_0x6b3c('0x3b')]);_0x2274db['where']=qs[_0x6b3c('0x32')](_[_0x6b3c('0x3c')](_0x441c15[_0x6b3c('0x31')],_0x1dc2a2['filters']),_0x5e802a);if(_0x441c15['query'][_0x6b3c('0x3d')]){_0x2274db[_0x6b3c('0x3e')]=_['merge'](_0x2274db[_0x6b3c('0x3e')],{'$or':_['map'](_0x5e802a,function(_0x3b57ce){if(_0x3b57ce[_0x6b3c('0x2d')]!==_0x6b3c('0x3f')){var _0x4fbe0a={};_0x4fbe0a[_0x3b57ce[_0x6b3c('0x27')]]={'$like':'%'+_0x441c15[_0x6b3c('0x31')][_0x6b3c('0x3d')]+'%'};return _0x4fbe0a;}})});}_0x2274db=_[_0x6b3c('0x40')]({},_0x2274db,_0x441c15[_0x6b3c('0x41')]);var _0x1d9fe4={'where':_0x2274db[_0x6b3c('0x3e')]};return db[_0x6b3c('0x2a')]['count'](_0x1d9fe4)[_0x6b3c('0x23')](function(_0x5db5d2){_0xce222c[_0x6b3c('0x1e')]=_0x5db5d2;if(_0x441c15['query'][_0x6b3c('0x42')]){_0x2274db['include']=[{'all':!![]}];}return db[_0x6b3c('0x2a')]['findAll'](_0x2274db);})['then'](function(_0x1899cf){_0xce222c[_0x6b3c('0x43')]=_0x1899cf;return _0xce222c;})['then'](respondWithFilteredResult(_0x567eb8,_0x2274db))[_0x6b3c('0x44')](handleError(_0x567eb8,null));};exports['show']=function(_0x1b6335,_0x3c2ebb){var _0x2680b9={'raw':![],'where':{'id':_0x1b6335['params']['id']}},_0x59b3b5={};_0x59b3b5['model']=_[_0x6b3c('0x45')](db[_0x6b3c('0x2a')][_0x6b3c('0x2b')]);_0x59b3b5['query']=_[_0x6b3c('0x45')](_0x1b6335[_0x6b3c('0x31')]);_0x59b3b5['filters']=_[_0x6b3c('0x33')](_0x59b3b5['model'],_0x59b3b5[_0x6b3c('0x31')]);_0x2680b9['attributes']=_[_0x6b3c('0x33')](_0x59b3b5['model'],qs['fields'](_0x1b6335[_0x6b3c('0x31')][_0x6b3c('0x36')]));_0x2680b9[_0x6b3c('0x34')]=_0x2680b9[_0x6b3c('0x34')]['length']?_0x2680b9[_0x6b3c('0x34')]:_0x59b3b5[_0x6b3c('0x35')];if(_0x1b6335['query'][_0x6b3c('0x42')]){_0x2680b9[_0x6b3c('0x46')]=[{'all':!![]}];}_0x2680b9=_[_0x6b3c('0x40')]({},_0x2680b9,_0x1b6335[_0x6b3c('0x41')]);return db['VoiceRecording']['find'](_0x2680b9)['then'](handleEntityNotFound(_0x3c2ebb,null))[_0x6b3c('0x23')](respondWithResult(_0x3c2ebb,null))[_0x6b3c('0x44')](handleError(_0x3c2ebb,null));};exports[_0x6b3c('0x47')]=function(_0x192b45,_0x592961){return db[_0x6b3c('0x2a')][_0x6b3c('0x47')](_0x192b45[_0x6b3c('0x48')],{})[_0x6b3c('0x23')](respondWithResult(_0x592961,0xc9))[_0x6b3c('0x44')](handleError(_0x592961,null));};exports[_0x6b3c('0x49')]=function(_0x439bf2,_0x2cb080){if(_0x439bf2['body']['id']){delete _0x439bf2[_0x6b3c('0x48')]['id'];}return db['VoiceRecording'][_0x6b3c('0x4a')]({'where':{'id':_0x439bf2['params']['id']}})[_0x6b3c('0x23')](handleEntityNotFound(_0x2cb080,null))[_0x6b3c('0x23')](saveUpdates(_0x439bf2[_0x6b3c('0x48')],null))[_0x6b3c('0x23')](respondWithResult(_0x2cb080,null))[_0x6b3c('0x44')](handleError(_0x2cb080,null));};exports['describe']=function(_0x22306d,_0x528817){return db[_0x6b3c('0x2a')][_0x6b3c('0x4b')]()[_0x6b3c('0x23')](respondWithResult(_0x528817,null))[_0x6b3c('0x44')](handleError(_0x528817,null));};exports[_0x6b3c('0x4c')]=function(_0x3cbffa,_0x24ab17,_0x37e53e){var _0x74c6e9=require(_0x6b3c('0x4d'));var _0x443294=![];var _0x9a8970={};if(_0x3cbffa['query'][_0x6b3c('0x2d')]&&_0x3cbffa[_0x6b3c('0x31')][_0x6b3c('0x2d')]===_0x6b3c('0x4e')){_0x9a8970[_0x6b3c('0x4e')]=_0x3cbffa[_0x6b3c('0x4f')]['id'];}else{_0x9a8970['id']=_0x3cbffa[_0x6b3c('0x4f')]['id'];}return db[_0x6b3c('0x2a')][_0x6b3c('0x4a')]({'where':_0x9a8970,'attributes':['id',_0x6b3c('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x24ab17,null))[_0x6b3c('0x23')](function(_0x3a4329){if(_0x3a4329){var _0x3b7272=_0x3a4329[_0x6b3c('0x50')];var _0x11ebc1=util[_0x6b3c('0x30')](_0x6b3c('0x51'),_0x3b7272);if(fs['existsSync'](_0x11ebc1)){_0x443294=!![];return _0x74c6e9['decryptFile'](_0x11ebc1,_0x3b7272,config[_0x6b3c('0x52')][_0x6b3c('0x53')])[_0x6b3c('0x23')](function(){return _0x3a4329;});}return _0x3a4329;}})[_0x6b3c('0x23')](function(_0x5542bc){if(_0x5542bc){var _0x1f20e6=_0x5542bc[_0x6b3c('0x50')];if(!fs['existsSync'](_0x1f20e6)){throw new db[(_0x6b3c('0x54'))][(_0x6b3c('0x55'))](_0x6b3c('0x56'));}if(_0x5542bc[_0x6b3c('0x57')]){return _0x24ab17[_0x6b3c('0x4c')](_0x1f20e6,_0x5542bc[_0x6b3c('0x57')]+path['extname'](_0x1f20e6),function(){if(_0x443294){fs[_0x6b3c('0x58')](_0x1f20e6);}});}else{return _0x24ab17[_0x6b3c('0x4c')](_0x1f20e6,function(_0x224094){if(_0x443294){fs[_0x6b3c('0x58')](_0x1f20e6);}});}}})['catch'](function(_0x4c95d4){if(_0x4c95d4[_0x6b3c('0x59')]===_0x6b3c('0x56')){_0x24ab17['status'](0x194)['send'](_0x6b3c('0x5a'));}else{return handleError(_0x24ab17,null);}});};exports[_0x6b3c('0x5b')]=function(_0x318467,_0x298cfe,_0x899f73){var _0x21df60=require('../../components/encryptor');var _0x1001a8=![];var _0x3b73f4={'$and':[db[_0x6b3c('0x5c')][_0x6b3c('0x3e')](db[_0x6b3c('0x5c')]['fn'](_0x6b3c('0x5d'),db[_0x6b3c('0x5c')]['col'](_0x6b3c('0x4e'))),_0x318467['query'][_0x6b3c('0x5e')])]};if(_0x318467[_0x6b3c('0x31')][_0x6b3c('0x2d')]&&_0x318467['query'][_0x6b3c('0x2d')]===_0x6b3c('0x4e')){_0x3b73f4[_0x6b3c('0x5f')]['push']({'uniqueid':_0x318467[_0x6b3c('0x4f')]['id']});}else{_0x3b73f4[_0x6b3c('0x5f')][_0x6b3c('0x60')]({'id':_0x318467['params']['id']});}return db['VoiceRecording'][_0x6b3c('0x4a')]({'where':_0x3b73f4,'attributes':['id',_0x6b3c('0x50')],'raw':!![]})[_0x6b3c('0x23')](handleEntityNotFound(_0x298cfe,null))['then'](function(_0x2113d9){if(_0x2113d9){var _0x25999e=util[_0x6b3c('0x30')](_0x6b3c('0x51'),_0x2113d9[_0x6b3c('0x50')]);if(fs[_0x6b3c('0x61')](_0x25999e)){_0x1001a8=!![];return _0x21df60[_0x6b3c('0x62')](_0x25999e,_0x2113d9['value'],config[_0x6b3c('0x52')][_0x6b3c('0x53')])[_0x6b3c('0x23')](function(){return _0x2113d9;});}return _0x2113d9;}})[_0x6b3c('0x23')](function(_0x5099e7){if(_0x5099e7){if(!fs[_0x6b3c('0x61')](_0x5099e7['value'])){throw new db[(_0x6b3c('0x54'))]['ValidationError'](_0x6b3c('0x56'));}if(_0x5099e7[_0x6b3c('0x57')]){return _0x298cfe[_0x6b3c('0x4c')](_0x5099e7[_0x6b3c('0x50')],_0x5099e7[_0x6b3c('0x57')]+path['extname'](_0x5099e7[_0x6b3c('0x50')]),function(){if(_0x1001a8){fs['unlink'](_0x5099e7['value']);}});}else{return _0x298cfe[_0x6b3c('0x4c')](_0x5099e7[_0x6b3c('0x50')],function(_0x26a68c){if(_0x1001a8){fs['unlink'](_0x5099e7[_0x6b3c('0x50')]);}});}}})[_0x6b3c('0x44')](handleError(_0x298cfe,null));};exports[_0x6b3c('0x63')]=function(_0x43fd4c,_0x2c6855){return db[_0x6b3c('0x2a')]['find']({'where':{'id':_0x43fd4c['params']['id']}})[_0x6b3c('0x23')](function(_0x17e117){if(_[_0x6b3c('0x64')](_0x17e117)){throw new ReferenceError(_0x6b3c('0x65'));}return _0x17e117;})[_0x6b3c('0x23')](function(_0x1a74d3){var _0x2c6040=_0x1a74d3[_0x6b3c('0x50')];logger['info'](_0x6b3c('0x66'),_0x2c6040);if(!_['isNil'](_0x1a74d3[_0x6b3c('0x50')])&&fs[_0x6b3c('0x61')](_0x2c6040)){logger[_0x6b3c('0x67')](_0x6b3c('0x68')+_0x2c6040+_0x6b3c('0x69'));fs[_0x6b3c('0x6a')](_0x2c6040);}_0x2c6040=_0x2c6040+'.cypher';if(!_['isNil'](_0x1a74d3['value'])&&fs['existsSync'](_0x2c6040)){logger[_0x6b3c('0x67')](_0x6b3c('0x68')+_0x2c6040+_0x6b3c('0x69'));fs[_0x6b3c('0x6a')](_0x2c6040);}return _0x1a74d3;})[_0x6b3c('0x23')](function(_0x19d545){if(!_0x19d545)throw new InternalError();return _0x19d545[_0x6b3c('0x63')]();})['then'](function(){_0x2c6855[_0x6b3c('0x6b')](0xcc)[_0x6b3c('0x19')]();})[_0x6b3c('0x44')](handleError(_0x2c6855,null));};function getBucketslist(_0x201334,_0x3d0be1,_0xcf8825){return new Promise(function(_0x5a1f2c,_0x19f79c){var _0x1e3a8d=new AWS['S3']({'accessKeyId':_0x3d0be1,'secretAccessKey':_0x201334,'region':_0xcf8825});_0x1e3a8d[_0x6b3c('0x6c')]({},function(_0x299725,_0xc96007){if(_0x299725){return _0x19f79c(_0x299725);}else{return _0x5a1f2c(_0xc96007);}});});}function createBucket(_0x821769,_0x2ddc80,_0x2b2861,_0x8a1063){return new Promise(function(_0x38e959,_0x3a6dcf){var _0x5a26c0=new AWS['S3']({'accessKeyId':_0x2ddc80,'secretAccessKey':_0x821769,'region':_0x2b2861});_0x5a26c0['createBucket']({'Bucket':_0x8a1063},function(_0x40a452,_0x1c4d4a){if(_0x40a452){return _0x3a6dcf(_0x40a452);}else{return _0x38e959(_0x1c4d4a);}});});}function uploadFile(_0x93c975,_0x43dae7,_0xb23a95,_0x55601f,_0x321d48,_0x1a7d2d){return new Promise(function(_0x2b67d1,_0x564500){var _0x2175e6=new AWS['S3']({'accessKeyId':_0x43dae7,'secretAccessKey':_0x93c975,'region':_0xb23a95});_0x2175e6[_0x6b3c('0x6d')]({'Bucket':_0x55601f,'Key':_0x321d48,'Body':_0x1a7d2d},function(_0x16e186,_0x2ef59c){if(_0x16e186){return _0x564500(_0x16e186);}else{return _0x2b67d1(_0x2ef59c);}});});}function startTranscribe(_0x2f6bd4,_0x12ea9b,_0x1a8016,_0x180a5a,_0x303fea,_0x589c81){return new Promise(function(_0x3eb890,_0x5a0301){var _0x566161=new AWS[(_0x6b3c('0x6e'))]({'accessKeyId':_0x12ea9b,'secretAccessKey':_0x2f6bd4,'region':_0x1a8016});_0x566161[_0x6b3c('0x6f')]({'TranscriptionJobName':_0x180a5a,'LanguageCode':_0x303fea,'Media':{'MediaFileUri':_0x589c81}},function(_0x91162b,_0x3c87cb){if(_0x91162b){return _0x5a0301(_0x91162b);}else{return _0x3eb890(_0x3c87cb);}});});}function transcribe(_0x359490,_0x4f010d,_0x25b761,_0x19442c,_0x1040cc,_0x12a42b,_0x543d33){return new Promise(function(_0x2685ab,_0x23472f){var _0x404e3a={};logger['info'](util[_0x6b3c('0x30')](_0x6b3c('0x70'),_0x359490,_0x1040cc));return uploadFile(_0x4f010d,_0x25b761,_0x19442c,_0x1040cc,path[_0x6b3c('0x71')](_0x12a42b),fs['readFileSync'](_0x12a42b))[_0x6b3c('0x23')](function(_0x893d5f){logger['info'](util[_0x6b3c('0x30')](_0x6b3c('0x72'),_0x359490,_0x1040cc,_0x893d5f[_0x6b3c('0x73')]));_0x404e3a[_0x6b3c('0x74')]=_0x893d5f[_0x6b3c('0x75')];_0x404e3a['location']=_0x893d5f[_0x6b3c('0x73')];logger['info'](util[_0x6b3c('0x30')](_0x6b3c('0x76'),_0x359490));return startTranscribe(_0x4f010d,_0x25b761,_0x19442c,uuidv4(),_0x543d33,_0x893d5f[_0x6b3c('0x73')]);})[_0x6b3c('0x23')](function(_0x555086){logger['info'](util[_0x6b3c('0x30')](_0x6b3c('0x77'),_0x359490,_0x555086[_0x6b3c('0x78')]['TranscriptionJobName']));_0x404e3a[_0x6b3c('0x79')]=_0x555086[_0x6b3c('0x78')][_0x6b3c('0x7a')];_0x404e3a['transcribeStatus']=_0x555086[_0x6b3c('0x78')][_0x6b3c('0x7b')];return _0x2685ab(_0x404e3a);})[_0x6b3c('0x44')](function(_0x27b25f){return _0x23472f(_0x27b25f);});});}exports['runTranscribe']=function(_0x159957,_0x595e14,_0x3307d1){var _0x36d229;var _0x5c83b4;var _0x3567b4;var _0x385e90=require(_0x6b3c('0x4d'));return db['VoiceRecording'][_0x6b3c('0x7c')]({'where':{'id':_0x159957['params']['id']}})[_0x6b3c('0x23')](function(_0x6b46e9){if(_0x6b46e9){var _0x3ba152=util['format'](_0x6b3c('0x51'),_0x6b46e9[_0x6b3c('0x50')]);if(fs[_0x6b3c('0x61')](_0x3ba152)){cypher=!![];return _0x385e90['decryptFile'](_0x3ba152,_0x6b46e9[_0x6b3c('0x50')],config['secrets'][_0x6b3c('0x53')])[_0x6b3c('0x23')](function(){return _0x6b46e9;});}return _0x6b46e9;}})[_0x6b3c('0x23')](function(_0x475e64){if(!_0x475e64){throw new db['Sequelize'][(_0x6b3c('0x55'))](_0x6b3c('0x7d'));}_0x5c83b4=_0x475e64;return db[_0x6b3c('0x7e')]['findOne']({'where':{'id':0x1}});})[_0x6b3c('0x23')](handleEntityNotFound(_0x595e14,null))['then'](function(_0xefd867){if(_0xefd867){_0x36d229=_0xefd867;if(!_0x36d229[_0x6b3c('0x7f')]||!_0x36d229[_0x6b3c('0x80')]||!_0x36d229[_0x6b3c('0x81')]||!_0x36d229[_0x6b3c('0x82')]||!_0x36d229['bucket']){throw new db[(_0x6b3c('0x54'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x159957[_0x6b3c('0x48')]['runSentiment']&&(!_0x36d229[_0x6b3c('0x83')]||!_0x36d229[_0x6b3c('0x84')]||!_0x36d229['sentimentRegion']||!_0x36d229[_0x6b3c('0x82')]||!_0x36d229[_0x6b3c('0x74')])){throw new db['Sequelize'][(_0x6b3c('0x55'))](_0x6b3c('0x85'));}return db[_0x6b3c('0x86')][_0x6b3c('0x7c')]({'where':{'id':_0x36d229[_0x6b3c('0x80')]}});}})[_0x6b3c('0x23')](function(_0x136478){if(!_0x136478){throw new db['Sequelize']['ValidationError'](_0x6b3c('0x87'));}if(!_0x136478[_0x6b3c('0x88')]||!_0x136478[_0x6b3c('0x89')]){throw new db[(_0x6b3c('0x54'))][(_0x6b3c('0x55'))](_0x6b3c('0x8a'));}_0x3567b4=_0x136478;return getBucketslist(_0x3567b4[_0x6b3c('0x88')],_0x3567b4[_0x6b3c('0x89')],_0x36d229[_0x6b3c('0x81')]);})[_0x6b3c('0x23')](function(_0x1ba764){if(_0x1ba764&&_0x1ba764[_0x6b3c('0x8b')]){var _0x464c5d=_['find'](_0x1ba764[_0x6b3c('0x8b')],function(_0x11c95e){return _0x11c95e[_0x6b3c('0x8c')]===_0x36d229[_0x6b3c('0x74')];});if(!_0x464c5d){logger[_0x6b3c('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x159957[_0x6b3c('0x4f')]['id'],_0x36d229['bucket']));return createBucket(_0x3567b4['data1'],_0x3567b4['data2'],_0x36d229[_0x6b3c('0x81')],_0x36d229[_0x6b3c('0x74')]);}logger[_0x6b3c('0x67')](util[_0x6b3c('0x30')](_0x6b3c('0x8d'),_0x159957[_0x6b3c('0x4f')]['id'],_0x36d229['bucket']));return;}})['then'](function(_0x4c6aa4){if(_0x5c83b4[_0x6b3c('0x8e')]===_0x6b3c('0x8f')){return transcribe(_0x159957[_0x6b3c('0x4f')]['id'],_0x3567b4[_0x6b3c('0x88')],_0x3567b4[_0x6b3c('0x89')],_0x36d229['transcribeRegion'],_0x36d229[_0x6b3c('0x74')],_0x5c83b4[_0x6b3c('0x50')],_0x36d229[_0x6b3c('0x82')]);}else{logger[_0x6b3c('0x67')](util['format'](_0x6b3c('0x90'),_0x159957['params']['id']));return{'transcribeStatus':_0x6b3c('0x91')};}})['then'](function(_0x399a7f){if(_0x399a7f){_0x399a7f[_0x6b3c('0x92')]=_0x159957['body'][_0x6b3c('0x93')];return _0x5c83b4['updateAttributes'](_0x399a7f);}})['then'](respondWithResult(_0x595e14,null))[_0x6b3c('0x44')](handleError(_0x595e14,null));};function writeFile(_0x5b985e,_0x1f37b5){return new Promise(function(_0x1c658e,_0x193c5a){fs[_0x6b3c('0x94')](_0x1f37b5,_0x5b985e,function(_0x5a11a4,_0x5d1f7c){if(_0x5a11a4){return _0x193c5a(_0x5a11a4);}else{return _0x1c658e(_0x5d1f7c);}});});}exports[_0x6b3c('0x95')]=function(_0x19fc0a,_0x4b0507,_0x1b8964){return db[_0x6b3c('0x2a')][_0x6b3c('0x7c')]({'where':{'id':_0x19fc0a['params']['id']}})[_0x6b3c('0x23')](handleEntityNotFound(_0x4b0507))[_0x6b3c('0x23')](function(_0x2c447b){if(_0x2c447b&&_0x2c447b['fileText']){var _0x69d8fc=_0x2c447b[_0x6b3c('0x96')];var _0x180004=config[_0x6b3c('0x97')]+_0x6b3c('0x98')+_0x2c447b['id']+_0x6b3c('0x99');if(fs['existsSync'](_0x180004)){return _0x180004;}return writeFile(_0x69d8fc,_0x180004)[_0x6b3c('0x23')](function(){return _0x180004;});}else{throw new db[(_0x6b3c('0x54'))][(_0x6b3c('0x55'))](_0x6b3c('0x9a'));}})[_0x6b3c('0x23')](function(_0x523adf){return _0x4b0507[_0x6b3c('0x4c')](_0x523adf);})['catch'](handleError(_0x4b0507));}; \ No newline at end of file +var _0x2778=['readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','params','length','includeAll','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','col','token','$and','push','%s.cypher','recording','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','basename'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x2778,0x1e9));var _0x8277=function(_0x125529,_0x4d081e){_0x125529=_0x125529-0x0;var _0x98822c=_0x2778[_0x125529];return _0x98822c;};'use strict';var emlformat=require(_0x8277('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8277('0x1'));var jsonpatch=require(_0x8277('0x2'));var rp=require(_0x8277('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8277('0x4'));var util=require(_0x8277('0x5'));var path=require(_0x8277('0x6'));var sox=require('sox');var csv=require(_0x8277('0x7'));var ejs=require(_0x8277('0x8'));var fs=require('fs');var fs_extra=require(_0x8277('0x9'));var _=require(_0x8277('0xa'));var squel=require(_0x8277('0xb'));var crypto=require(_0x8277('0xc'));var jsforce=require(_0x8277('0xd'));var deskjs=require(_0x8277('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8277('0xf'));var Papa=require(_0x8277('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x8277('0x11'));var Redis=require(_0x8277('0x12'));var authService=require(_0x8277('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8277('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8277('0x15'))(_0x8277('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8277('0x17'));var db=require(_0x8277('0x18'))['db'];function respondWithStatusCode(_0x3f7454,_0xb5ef52){_0xb5ef52=_0xb5ef52||0xcc;return function(_0x547cf2){if(_0x547cf2){return _0x3f7454[_0x8277('0x19')](_0xb5ef52);}return _0x3f7454['status'](_0xb5ef52)[_0x8277('0x1a')]();};}function respondWithResult(_0x3b0aa4,_0x51f54b){_0x51f54b=_0x51f54b||0xc8;return function(_0x3586d6){if(_0x3586d6){return _0x3b0aa4['status'](_0x51f54b)[_0x8277('0x1b')](_0x3586d6);}};}function respondWithFilteredResult(_0xe9ab34,_0x26b9c4){return function(_0x2ab034){if(_0x2ab034){var _0x2e5b8f=typeof _0x26b9c4[_0x8277('0x1c')]===_0x8277('0x1d')&&typeof _0x26b9c4['limit']==='undefined';var _0x17d87c=_0x2ab034['count'];var _0x25cf94=_0x2e5b8f?0x0:_0x26b9c4[_0x8277('0x1c')];var _0x32d75b=_0x2e5b8f?_0x2ab034[_0x8277('0x1e')]:_0x26b9c4['offset']+_0x26b9c4[_0x8277('0x1f')];var _0x24f267;if(_0x32d75b>=_0x17d87c){_0x32d75b=_0x17d87c;_0x24f267=0xc8;}else{_0x24f267=0xce;}_0xe9ab34[_0x8277('0x20')](_0x24f267);return _0xe9ab34['set'](_0x8277('0x21'),_0x25cf94+'-'+_0x32d75b+'/'+_0x17d87c)[_0x8277('0x1b')](_0x2ab034);}return null;};}function patchUpdates(_0x10be10){return function(_0x2432b6){try{jsonpatch[_0x8277('0x22')](_0x2432b6,_0x10be10,!![]);}catch(_0xc53e9d){return BPromise[_0x8277('0x23')](_0xc53e9d);}return _0x2432b6[_0x8277('0x24')]();};}function saveUpdates(_0x2e4db5,_0x4fc1e4){return function(_0x4468aa){if(_0x4468aa){return _0x4468aa[_0x8277('0x25')](_0x2e4db5)[_0x8277('0x26')](function(_0x565616){return _0x565616;});}return null;};}function removeEntity(_0x4867a5,_0x379c82){return function(_0x2f7e51){if(_0x2f7e51){return _0x2f7e51['destroy']()[_0x8277('0x26')](function(){_0x4867a5[_0x8277('0x20')](0xcc)[_0x8277('0x1a')]();});}};}function handleEntityNotFound(_0x3b2324,_0x1920cc){return function(_0xec41b7){if(!_0xec41b7){_0x3b2324[_0x8277('0x19')](0x194);}return _0xec41b7;};}function handleError(_0x9899fa,_0x3f94ad){_0x3f94ad=_0x3f94ad||0x1f4;return function(_0x549ff0){logger[_0x8277('0x27')](_0x549ff0['stack']);if(_0x549ff0[_0x8277('0x28')]){delete _0x549ff0['name'];}_0x9899fa[_0x8277('0x20')](_0x3f94ad)[_0x8277('0x29')](_0x549ff0);};}exports[_0x8277('0x2a')]=function(_0x2aa0f4,_0x5482cc){var _0x278bba={},_0x42e3a5={},_0x4f37c8={'count':0x0,'rows':[]};var _0x103995=_[_0x8277('0x2b')](db[_0x8277('0x2c')][_0x8277('0x2d')],function(_0x35c19f){return{'name':_0x35c19f[_0x8277('0x2e')],'type':_0x35c19f['type'][_0x8277('0x2f')]};});_0x42e3a5[_0x8277('0x30')]=_[_0x8277('0x31')](_['map'](_0x103995,_0x8277('0x28')),[_0x8277('0x32')]);_0x42e3a5[_0x8277('0x33')]=_[_0x8277('0x34')](_0x2aa0f4[_0x8277('0x33')]);_0x42e3a5[_0x8277('0x35')]=_[_0x8277('0x36')](_0x42e3a5['model'],_0x42e3a5[_0x8277('0x33')]);_0x278bba[_0x8277('0x37')]=_['intersection'](_0x42e3a5[_0x8277('0x30')],qs['fields'](_0x2aa0f4['query'][_0x8277('0x38')]));_0x278bba[_0x8277('0x37')]=_0x278bba[_0x8277('0x37')]['length']?_0x278bba[_0x8277('0x37')]:_0x42e3a5['model'];if(!_0x2aa0f4[_0x8277('0x33')][_0x8277('0x39')](_0x8277('0x3a'))){_0x278bba[_0x8277('0x1f')]=qs[_0x8277('0x1f')](_0x2aa0f4[_0x8277('0x33')][_0x8277('0x1f')]);_0x278bba[_0x8277('0x1c')]=qs['offset'](_0x2aa0f4[_0x8277('0x33')][_0x8277('0x1c')]);}_0x278bba['order']=qs[_0x8277('0x3b')](_0x2aa0f4[_0x8277('0x33')]['sort']);_0x278bba[_0x8277('0x3c')]=qs['filters'](_['pick'](_0x2aa0f4[_0x8277('0x33')],_0x42e3a5[_0x8277('0x35')]),_0x103995);if(_0x2aa0f4[_0x8277('0x33')][_0x8277('0x3d')]){_0x278bba['where']=_[_0x8277('0x3e')](_0x278bba[_0x8277('0x3c')],{'$or':_[_0x8277('0x2b')](_0x103995,function(_0x3860a5){if(_0x3860a5['type']!==_0x8277('0x3f')){var _0x2a2e7b={};_0x2a2e7b[_0x3860a5[_0x8277('0x28')]]={'$like':'%'+_0x2aa0f4[_0x8277('0x33')][_0x8277('0x3d')]+'%'};return _0x2a2e7b;}})});}_0x278bba=_['merge']({},_0x278bba,_0x2aa0f4[_0x8277('0x40')]);var _0x30d100={'where':_0x278bba['where']};return db[_0x8277('0x2c')][_0x8277('0x1e')](_0x30d100)[_0x8277('0x26')](function(_0x3dff25){_0x4f37c8[_0x8277('0x1e')]=_0x3dff25;if(_0x2aa0f4[_0x8277('0x33')]['includeAll']){_0x278bba[_0x8277('0x41')]=[{'all':!![]}];}return db[_0x8277('0x2c')]['findAll'](_0x278bba);})['then'](function(_0x41ff24){_0x4f37c8[_0x8277('0x42')]=_0x41ff24;return _0x4f37c8;})[_0x8277('0x26')](respondWithFilteredResult(_0x5482cc,_0x278bba))[_0x8277('0x43')](handleError(_0x5482cc,null));};exports['show']=function(_0x1215ef,_0x18534c){var _0x31d688={'raw':![],'where':{'id':_0x1215ef[_0x8277('0x44')]['id']}},_0x503aad={};_0x503aad[_0x8277('0x30')]=_[_0x8277('0x34')](db['VoiceRecording'][_0x8277('0x2d')]);_0x503aad['query']=_[_0x8277('0x34')](_0x1215ef[_0x8277('0x33')]);_0x503aad[_0x8277('0x35')]=_[_0x8277('0x36')](_0x503aad[_0x8277('0x30')],_0x503aad[_0x8277('0x33')]);_0x31d688['attributes']=_[_0x8277('0x36')](_0x503aad['model'],qs[_0x8277('0x38')](_0x1215ef['query'][_0x8277('0x38')]));_0x31d688[_0x8277('0x37')]=_0x31d688[_0x8277('0x37')][_0x8277('0x45')]?_0x31d688[_0x8277('0x37')]:_0x503aad[_0x8277('0x30')];if(_0x1215ef[_0x8277('0x33')][_0x8277('0x46')]){_0x31d688[_0x8277('0x41')]=[{'all':!![]}];}_0x31d688=_[_0x8277('0x3e')]({},_0x31d688,_0x1215ef[_0x8277('0x40')]);return db['VoiceRecording'][_0x8277('0x47')](_0x31d688)['then'](handleEntityNotFound(_0x18534c,null))[_0x8277('0x26')](respondWithResult(_0x18534c,null))[_0x8277('0x43')](handleError(_0x18534c,null));};exports[_0x8277('0x48')]=function(_0x3ccd93,_0x4666bc){return db[_0x8277('0x2c')]['create'](_0x3ccd93[_0x8277('0x49')],{})[_0x8277('0x26')](respondWithResult(_0x4666bc,0xc9))[_0x8277('0x43')](handleError(_0x4666bc,null));};exports[_0x8277('0x25')]=function(_0x56885f,_0x32c9d3){if(_0x56885f[_0x8277('0x49')]['id']){delete _0x56885f['body']['id'];}return db[_0x8277('0x2c')][_0x8277('0x47')]({'where':{'id':_0x56885f[_0x8277('0x44')]['id']}})['then'](handleEntityNotFound(_0x32c9d3,null))[_0x8277('0x26')](saveUpdates(_0x56885f['body'],null))[_0x8277('0x26')](respondWithResult(_0x32c9d3,null))[_0x8277('0x43')](handleError(_0x32c9d3,null));};exports[_0x8277('0x4a')]=function(_0xd09a45,_0x460dc1){return db[_0x8277('0x2c')][_0x8277('0x4a')]()[_0x8277('0x26')](respondWithResult(_0x460dc1,null))['catch'](handleError(_0x460dc1,null));};exports[_0x8277('0x4b')]=function(_0x5288cb,_0x3b4882,_0x4a8177){var _0xa7faa2=require(_0x8277('0x4c'));var _0x32f71c=![];var _0x56b4d8={};if(_0x5288cb[_0x8277('0x33')][_0x8277('0x4d')]&&_0x5288cb[_0x8277('0x33')][_0x8277('0x4d')]===_0x8277('0x4e')){_0x56b4d8['uniqueid']=_0x5288cb[_0x8277('0x44')]['id'];}else{_0x56b4d8['id']=_0x5288cb[_0x8277('0x44')]['id'];}return db[_0x8277('0x2c')][_0x8277('0x47')]({'where':_0x56b4d8,'attributes':['id',_0x8277('0x4f')],'raw':!![]})[_0x8277('0x26')](handleEntityNotFound(_0x3b4882,null))[_0x8277('0x26')](function(_0x4c52c3){if(_0x4c52c3){var _0x25a22f=_0x4c52c3['value'];var _0x513f58=util[_0x8277('0x32')]('%s.cypher',_0x25a22f);if(fs[_0x8277('0x50')](_0x513f58)){_0x32f71c=!![];return _0xa7faa2[_0x8277('0x51')](_0x513f58,_0x25a22f,config[_0x8277('0x52')]['recording'])['then'](function(){return _0x4c52c3;});}return _0x4c52c3;}})[_0x8277('0x26')](function(_0x36e143){if(_0x36e143){var _0x4ddf45=_0x36e143['value'];if(!fs['existsSync'](_0x4ddf45)){throw new db['Sequelize'][(_0x8277('0x53'))](_0x8277('0x54'));}if(_0x36e143[_0x8277('0x55')]){return _0x3b4882['download'](_0x4ddf45,_0x36e143[_0x8277('0x55')]+path[_0x8277('0x56')](_0x4ddf45),function(){if(_0x32f71c){fs[_0x8277('0x57')](_0x4ddf45);}});}else{return _0x3b4882['download'](_0x4ddf45,function(_0x45e726){if(_0x32f71c){fs['unlink'](_0x4ddf45);}});}}})[_0x8277('0x43')](function(_0x127ff0){if(_0x127ff0[_0x8277('0x58')]==='VoiceRecording\x20not\x20found'){_0x3b4882[_0x8277('0x20')](0x194)[_0x8277('0x29')](_0x8277('0x59'));}else{return handleError(_0x3b4882,null);}});};exports[_0x8277('0x5a')]=function(_0x236ea6,_0x37076f,_0x5532c8){var _0x5976a9=require(_0x8277('0x4c'));var _0x580e7e=![];var _0x50c57d={'$and':[db[_0x8277('0x5b')][_0x8277('0x3c')](db[_0x8277('0x5b')]['fn']('MD5',db[_0x8277('0x5b')][_0x8277('0x5c')](_0x8277('0x4e'))),_0x236ea6[_0x8277('0x33')][_0x8277('0x5d')])]};if(_0x236ea6[_0x8277('0x33')][_0x8277('0x4d')]&&_0x236ea6[_0x8277('0x33')]['type']===_0x8277('0x4e')){_0x50c57d[_0x8277('0x5e')][_0x8277('0x5f')]({'uniqueid':_0x236ea6[_0x8277('0x44')]['id']});}else{_0x50c57d[_0x8277('0x5e')][_0x8277('0x5f')]({'id':_0x236ea6[_0x8277('0x44')]['id']});}return db[_0x8277('0x2c')][_0x8277('0x47')]({'where':_0x50c57d,'attributes':['id',_0x8277('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x37076f,null))[_0x8277('0x26')](function(_0x44c632){if(_0x44c632){var _0x3ecc1d=util[_0x8277('0x32')](_0x8277('0x60'),_0x44c632[_0x8277('0x4f')]);if(fs['existsSync'](_0x3ecc1d)){_0x580e7e=!![];return _0x5976a9[_0x8277('0x51')](_0x3ecc1d,_0x44c632[_0x8277('0x4f')],config['secrets'][_0x8277('0x61')])[_0x8277('0x26')](function(){return _0x44c632;});}return _0x44c632;}})['then'](function(_0x30811a){if(_0x30811a){if(!fs[_0x8277('0x50')](_0x30811a[_0x8277('0x4f')])){throw new db['Sequelize'][(_0x8277('0x53'))](_0x8277('0x54'));}if(_0x30811a[_0x8277('0x55')]){return _0x37076f['download'](_0x30811a[_0x8277('0x4f')],_0x30811a[_0x8277('0x55')]+path[_0x8277('0x56')](_0x30811a[_0x8277('0x4f')]),function(){if(_0x580e7e){fs[_0x8277('0x57')](_0x30811a[_0x8277('0x4f')]);}});}else{return _0x37076f[_0x8277('0x4b')](_0x30811a[_0x8277('0x4f')],function(_0x5bdd2e){if(_0x580e7e){fs[_0x8277('0x57')](_0x30811a[_0x8277('0x4f')]);}});}}})[_0x8277('0x43')](handleError(_0x37076f,null));};exports[_0x8277('0x62')]=function(_0x5f5d90,_0x170938){return db[_0x8277('0x2c')][_0x8277('0x47')]({'where':{'id':_0x5f5d90['params']['id']}})[_0x8277('0x26')](function(_0x372c13){if(_[_0x8277('0x63')](_0x372c13)){throw new ReferenceError(_0x8277('0x64'));}return _0x372c13;})['then'](function(_0x17c9a6){var _0x6b6e59=_0x17c9a6[_0x8277('0x4f')];logger[_0x8277('0x65')](_0x8277('0x66'),_0x6b6e59);if(!_[_0x8277('0x63')](_0x17c9a6[_0x8277('0x4f')])&&fs[_0x8277('0x50')](_0x6b6e59)){logger[_0x8277('0x65')]('File:\x20\x22'+_0x6b6e59+_0x8277('0x67'));fs[_0x8277('0x68')](_0x6b6e59);}_0x6b6e59=_0x6b6e59+'.cypher';if(!_[_0x8277('0x63')](_0x17c9a6['value'])&&fs['existsSync'](_0x6b6e59)){logger['info'](_0x8277('0x69')+_0x6b6e59+_0x8277('0x67'));fs[_0x8277('0x68')](_0x6b6e59);}return _0x17c9a6;})[_0x8277('0x26')](function(_0x29ee73){if(!_0x29ee73)throw new InternalError();return _0x29ee73[_0x8277('0x62')]();})[_0x8277('0x26')](function(){_0x170938[_0x8277('0x20')](0xcc)[_0x8277('0x1a')]();})[_0x8277('0x43')](handleError(_0x170938,null));};function getBucketslist(_0x349455,_0x5ad543,_0xd2cdec){return new Promise(function(_0x54f865,_0x24149b){var _0x206796=new AWS['S3']({'accessKeyId':_0x5ad543,'secretAccessKey':_0x349455,'region':_0xd2cdec});_0x206796[_0x8277('0x6a')]({},function(_0x33139e,_0x5836b1){if(_0x33139e){return _0x24149b(_0x33139e);}else{return _0x54f865(_0x5836b1);}});});}function createBucket(_0x55e5b2,_0x5a6fa6,_0x42f227,_0x58b878){return new Promise(function(_0x294eab,_0x453ff4){var _0x31a6d0=new AWS['S3']({'accessKeyId':_0x5a6fa6,'secretAccessKey':_0x55e5b2,'region':_0x42f227});_0x31a6d0[_0x8277('0x6b')]({'Bucket':_0x58b878},function(_0x13f60d,_0x491a64){if(_0x13f60d){return _0x453ff4(_0x13f60d);}else{return _0x294eab(_0x491a64);}});});}function uploadFile(_0x513c0d,_0x2bbd71,_0x3663ed,_0x5a32d9,_0x3e6cbe,_0x2d8791){return new Promise(function(_0x536d9f,_0x3e1194){var _0x7f18ae=new AWS['S3']({'accessKeyId':_0x2bbd71,'secretAccessKey':_0x513c0d,'region':_0x3663ed});_0x7f18ae[_0x8277('0x6c')]({'Bucket':_0x5a32d9,'Key':_0x3e6cbe,'Body':_0x2d8791},function(_0x391675,_0x304944){if(_0x391675){return _0x3e1194(_0x391675);}else{return _0x536d9f(_0x304944);}});});}function startTranscribe(_0x27680e,_0x3a6d7a,_0x47796e,_0x412cbd,_0x28d8fe,_0x49d339){return new Promise(function(_0x43ab0d,_0xf28a85){var _0xf4dfac=new AWS[(_0x8277('0x6d'))]({'accessKeyId':_0x3a6d7a,'secretAccessKey':_0x27680e,'region':_0x47796e});_0xf4dfac['startTranscriptionJob']({'TranscriptionJobName':_0x412cbd,'LanguageCode':_0x28d8fe,'Media':{'MediaFileUri':_0x49d339}},function(_0x2a46b2,_0x4f8747){if(_0x2a46b2){return _0xf28a85(_0x2a46b2);}else{return _0x43ab0d(_0x4f8747);}});});}function transcribe(_0xabac28,_0x1179d9,_0x45fc1b,_0x2099c6,_0x1533ff,_0x17c6e3,_0x973312){return new Promise(function(_0x45e5b6,_0x27eead){var _0x4e40e9={};logger['info'](util[_0x8277('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xabac28,_0x1533ff));return uploadFile(_0x1179d9,_0x45fc1b,_0x2099c6,_0x1533ff,path[_0x8277('0x6e')](_0x17c6e3),fs[_0x8277('0x6f')](_0x17c6e3))[_0x8277('0x26')](function(_0x64511d){logger[_0x8277('0x65')](util['format'](_0x8277('0x70'),_0xabac28,_0x1533ff,_0x64511d[_0x8277('0x71')]));_0x4e40e9[_0x8277('0x72')]=_0x64511d[_0x8277('0x73')];_0x4e40e9[_0x8277('0x74')]=_0x64511d[_0x8277('0x71')];logger['info'](util[_0x8277('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xabac28));return startTranscribe(_0x1179d9,_0x45fc1b,_0x2099c6,uuidv4(),_0x973312,_0x64511d[_0x8277('0x71')]);})[_0x8277('0x26')](function(_0x285422){logger[_0x8277('0x65')](util[_0x8277('0x32')](_0x8277('0x75'),_0xabac28,_0x285422[_0x8277('0x76')][_0x8277('0x77')]));_0x4e40e9[_0x8277('0x78')]=_0x285422['TranscriptionJob'][_0x8277('0x77')];_0x4e40e9[_0x8277('0x79')]=_0x285422[_0x8277('0x76')][_0x8277('0x7a')];return _0x45e5b6(_0x4e40e9);})[_0x8277('0x43')](function(_0x5058ac){return _0x27eead(_0x5058ac);});});}exports[_0x8277('0x7b')]=function(_0x355545,_0x515124,_0x38660e){var _0x5a3a50;var _0x1ab434;var _0x47988e;var _0x278e2a=require('../../components/encryptor');return db[_0x8277('0x2c')][_0x8277('0x7c')]({'where':{'id':_0x355545[_0x8277('0x44')]['id']}})[_0x8277('0x26')](function(_0x543145){if(_0x543145){var _0x2acb62=util['format'](_0x8277('0x60'),_0x543145[_0x8277('0x4f')]);if(fs[_0x8277('0x50')](_0x2acb62)){cypher=!![];return _0x278e2a[_0x8277('0x51')](_0x2acb62,_0x543145[_0x8277('0x4f')],config[_0x8277('0x52')][_0x8277('0x61')])[_0x8277('0x26')](function(){return _0x543145;});}return _0x543145;}})[_0x8277('0x26')](function(_0x36059d){if(!_0x36059d){throw new db[(_0x8277('0x7d'))]['ValidationError'](_0x8277('0x7e'));}_0x1ab434=_0x36059d;return db['Setting'][_0x8277('0x7c')]({'where':{'id':0x1}});})[_0x8277('0x26')](handleEntityNotFound(_0x515124,null))[_0x8277('0x26')](function(_0x52fdb8){if(_0x52fdb8){_0x5a3a50=_0x52fdb8;if(!_0x5a3a50[_0x8277('0x7f')]||!_0x5a3a50[_0x8277('0x80')]||!_0x5a3a50[_0x8277('0x81')]||!_0x5a3a50[_0x8277('0x82')]||!_0x5a3a50['bucket']){throw new db[(_0x8277('0x7d'))][(_0x8277('0x53'))](_0x8277('0x83'));}if(_0x355545[_0x8277('0x49')][_0x8277('0x84')]&&(!_0x5a3a50[_0x8277('0x85')]||!_0x5a3a50['sentimentAccountId']||!_0x5a3a50['sentimentRegion']||!_0x5a3a50['language']||!_0x5a3a50[_0x8277('0x72')])){throw new db[(_0x8277('0x7d'))][(_0x8277('0x53'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x8277('0x86')][_0x8277('0x7c')]({'where':{'id':_0x5a3a50[_0x8277('0x80')]}});}})[_0x8277('0x26')](function(_0x1b7f8b){if(!_0x1b7f8b){throw new db[(_0x8277('0x7d'))]['ValidationError'](_0x8277('0x87'));}if(!_0x1b7f8b[_0x8277('0x88')]||!_0x1b7f8b[_0x8277('0x89')]){throw new db[(_0x8277('0x7d'))][(_0x8277('0x53'))]('Cloud\x20Provider\x20not\x20configured');}_0x47988e=_0x1b7f8b;return getBucketslist(_0x47988e[_0x8277('0x88')],_0x47988e[_0x8277('0x89')],_0x5a3a50[_0x8277('0x81')]);})[_0x8277('0x26')](function(_0x19e9bb){if(_0x19e9bb&&_0x19e9bb[_0x8277('0x8a')]){var _0x195851=_[_0x8277('0x47')](_0x19e9bb[_0x8277('0x8a')],function(_0x576050){return _0x576050[_0x8277('0x8b')]===_0x5a3a50[_0x8277('0x72')];});if(!_0x195851){logger[_0x8277('0x65')](util[_0x8277('0x32')](_0x8277('0x8c'),_0x355545[_0x8277('0x44')]['id'],_0x5a3a50[_0x8277('0x72')]));return createBucket(_0x47988e[_0x8277('0x88')],_0x47988e['data2'],_0x5a3a50['transcribeRegion'],_0x5a3a50[_0x8277('0x72')]);}logger[_0x8277('0x65')](util[_0x8277('0x32')](_0x8277('0x8d'),_0x355545[_0x8277('0x44')]['id'],_0x5a3a50[_0x8277('0x72')]));return;}})[_0x8277('0x26')](function(_0x236cc8){if(_0x1ab434['transcribeStatus']===_0x8277('0x8e')){return transcribe(_0x355545['params']['id'],_0x47988e[_0x8277('0x88')],_0x47988e[_0x8277('0x89')],_0x5a3a50['transcribeRegion'],_0x5a3a50['bucket'],_0x1ab434[_0x8277('0x4f')],_0x5a3a50[_0x8277('0x82')]);}else{logger['info'](util[_0x8277('0x32')](_0x8277('0x8f'),_0x355545[_0x8277('0x44')]['id']));return{'transcribeStatus':_0x8277('0x90')};}})['then'](function(_0x5aa3f8){if(_0x5aa3f8){_0x5aa3f8['tempSentiment']=_0x355545[_0x8277('0x49')]['runSentiment'];return _0x1ab434['updateAttributes'](_0x5aa3f8);}})['then'](respondWithResult(_0x515124,null))[_0x8277('0x43')](handleError(_0x515124,null));};function writeFile(_0x351f10,_0x343583){return new Promise(function(_0x381e42,_0x550718){fs['writeFile'](_0x343583,_0x351f10,function(_0x1edf09,_0x54efa9){if(_0x1edf09){return _0x550718(_0x1edf09);}else{return _0x381e42(_0x54efa9);}});});}exports[_0x8277('0x91')]=function(_0x45e446,_0x1f7745,_0x250ad3){return db[_0x8277('0x2c')][_0x8277('0x7c')]({'where':{'id':_0x45e446[_0x8277('0x44')]['id']}})[_0x8277('0x26')](handleEntityNotFound(_0x1f7745))[_0x8277('0x26')](function(_0x2ff2d2){if(_0x2ff2d2&&_0x2ff2d2[_0x8277('0x92')]){var _0x3a9e28=_0x2ff2d2[_0x8277('0x92')];var _0x3bec8e=config[_0x8277('0x93')]+_0x8277('0x94')+_0x2ff2d2['id']+'.txt';if(fs[_0x8277('0x50')](_0x3bec8e)){return _0x3bec8e;}return writeFile(_0x3a9e28,_0x3bec8e)[_0x8277('0x26')](function(){return _0x3bec8e;});}else{throw new db[(_0x8277('0x7d'))][(_0x8277('0x53'))](_0x8277('0x95'));}})['then'](function(_0x597d13){return _0x1f7745[_0x8277('0x4b')](_0x597d13);})[_0x8277('0x43')](handleError(_0x1f7745));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8bb2f6a..fbab781 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 _0x3645=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','exports','define'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x3645,0x154));var _0x5364=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x3645[_0x2a7b50];return _0x4224c9;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x5364('0x0')]=function(_0x12217b,_0x2fbfcc){return _0x12217b[_0x5364('0x1')](_0x5364('0x2'),attributes,{'tableName':_0x5364('0x3'),'paranoid':![],'indexes':[{'name':_0x5364('0x4'),'fields':['uniqueid']},{'name':_0x5364('0x5'),'fields':[_0x5364('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3351=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','define'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x3351,0x1b4));var _0x1335=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x3351[_0xc6be3a];return _0x56a310;};'use strict';var attributes=require(_0x1335('0x0'));module['exports']=function(_0x5a075d,_0x2bf4df){return _0x5a075d[_0x1335('0x1')](_0x1335('0x2'),attributes,{'tableName':_0x1335('0x3'),'paranoid':![],'indexes':[{'name':_0x1335('0x4'),'fields':[_0x1335('0x4')]},{'name':_0x1335('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index aa9c6f7..e1c8199 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 _0x32b6=['jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x32b6,0x1d1));var _0x632b=function(_0x3f2512,_0x2221b9){_0x3f2512=_0x3f2512-0x0;var _0x4b5988=_0x32b6[_0x3f2512];return _0x4b5988;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['where']||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['attributes']||null:null,'limit':_0x3bb27f[_0x632b('0x19')]?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1b')]||null:null})['then'](function(_0x10fc32){logger[_0x632b('0x14')]('UpdateVoiceRecording',_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON[_0x632b('0xf')](_0x10fc32));_0x51c894(_0x10fc32);})[_0x632b('0x1c')](function(_0x45d017){logger[_0x632b('0x10')]('UpdateVoiceRecording',_0x45d017['message'],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x45d017['message']));});});};exports[_0x632b('0x1d')]=function(_0x954fa0){var _0x5d6855=this;return new Promise(function(_0x273e89,_0x3f4eab){var _0x29d9aa=require(_0x632b('0x1e'));var _0x4728a8;return db[_0x632b('0x1f')][_0x632b('0x20')]({'attributes':['id',_0x632b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x632b('0xc')](function(_0x4f8410){_0x4728a8=_0x4f8410;return db[_0x632b('0x16')][_0x632b('0x22')](_0x954fa0[_0x632b('0x18')]);})[_0x632b('0xc')](function(_0x17a5ba){if(_0x4728a8[_0x632b('0x21')]&&fs[_0x632b('0x23')](_0x17a5ba[_0x632b('0x24')])){var _0x1ace1b=util[_0x632b('0x25')](_0x632b('0x26'),_0x17a5ba[_0x632b('0x24')]);return _0x29d9aa[_0x632b('0x27')](_0x17a5ba[_0x632b('0x24')],_0x1ace1b,config[_0x632b('0x28')][_0x632b('0x29')])[_0x632b('0xc')](function(){fs[_0x632b('0x2a')](_0x17a5ba[_0x632b('0x24')]);logger[_0x632b('0x14')]('CreateVoiceRecording\x20file\x20encrypted');return _0x17a5ba;});}return _0x17a5ba;})[_0x632b('0xc')](function(_0x4401dc){logger[_0x632b('0x14')](_0x632b('0x1d'),_0x954fa0);logger['debug'](_0x632b('0x1d'),_0x954fa0,JSON['stringify'](_0x4401dc));_0x273e89(_0x4401dc);})[_0x632b('0x1c')](function(_0x15b22d){logger['error'](_0x632b('0x1d'),_0x15b22d[_0x632b('0x13')],_0x954fa0);_0x3f4eab(_0x5d6855[_0x632b('0x10')](0x1f4,_0x15b22d[_0x632b('0x13')]));});});}; \ No newline at end of file +var _0x0b0e=['secrets','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','update','options','where','attributes','UpdateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','body','existsSync','format','encryptFile','value'];(function(_0xa380e1,_0x42698c){var _0x341c25=function(_0x289cf8){while(--_0x289cf8){_0xa380e1['push'](_0xa380e1['shift']());}};_0x341c25(++_0x42698c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x0b0e[_0x623e7];return _0x121131;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['UpdateVoiceRecording']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['VoiceRecording'][_0xe0b0('0x18')](_0x54a3eb['body'],{'raw':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb['options'][_0xe0b0('0x1a')]||null:null,'attributes':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb[_0xe0b0('0x19')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb['options']['limit']||null:null})[_0xe0b0('0xd')](function(_0x5512bb){logger[_0xe0b0('0xe')](_0xe0b0('0x1c'),_0x54a3eb);logger['debug'](_0xe0b0('0x1c'),_0x54a3eb,JSON['stringify'](_0x5512bb));_0x50a441(_0x5512bb);})[_0xe0b0('0x17')](function(_0x49a727){logger[_0xe0b0('0x13')]('UpdateVoiceRecording',_0x49a727[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44['error'](0x1f4,_0x49a727[_0xe0b0('0x14')]));});});};exports['CreateVoiceRecording']=function(_0x3c221d){var _0x5c5317=this;return new Promise(function(_0x362aba,_0x3c3bc2){var _0x1f1ebd=require(_0xe0b0('0x1d'));var _0x3ec2;return db[_0xe0b0('0x1e')]['findOne']({'attributes':['id',_0xe0b0('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xe0b0('0xd')](function(_0x5b7a64){_0x3ec2=_0x5b7a64;return db[_0xe0b0('0x20')][_0xe0b0('0x21')](_0x3c221d[_0xe0b0('0x22')]);})[_0xe0b0('0xd')](function(_0x3cdbd5){if(_0x3ec2[_0xe0b0('0x1f')]&&fs[_0xe0b0('0x23')](_0x3cdbd5['value'])){var _0x1854b8=util[_0xe0b0('0x24')]('%s.cypher',_0x3cdbd5['value']);return _0x1f1ebd[_0xe0b0('0x25')](_0x3cdbd5[_0xe0b0('0x26')],_0x1854b8,config[_0xe0b0('0x27')][_0xe0b0('0x28')])[_0xe0b0('0xd')](function(){fs['unlink'](_0x3cdbd5[_0xe0b0('0x26')]);logger[_0xe0b0('0xe')](_0xe0b0('0x29'));return _0x3cdbd5;});}return _0x3cdbd5;})[_0xe0b0('0xd')](function(_0x27158f){logger['info'](_0xe0b0('0x2a'),_0x3c221d);logger[_0xe0b0('0x10')](_0xe0b0('0x2a'),_0x3c221d,JSON[_0xe0b0('0x12')](_0x27158f));_0x362aba(_0x27158f);})[_0xe0b0('0x17')](function(_0x12eeb8){logger[_0xe0b0('0x13')](_0xe0b0('0x2a'),_0x12eeb8[_0xe0b0('0x14')],_0x3c221d);_0x3c3bc2(_0x5c5317[_0xe0b0('0x13')](0x1f4,_0x12eeb8[_0xe0b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 72abda5..b6516ad 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 _0xc7d3=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update','exports','multer','path','express','fs-extra'];(function(_0xf03f9e,_0x2f85e8){var _0x2326a7=function(_0x44702b){while(--_0x44702b){_0xf03f9e['push'](_0xf03f9e['shift']());}};_0x2326a7(++_0x2f85e8);}(_0xc7d3,0xdc));var _0x3c7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7d3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3c7d('0x0'));var util=require('util');var path=require(_0x3c7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c7d('0x2'));var router=express['Router']();var fs_extra=require(_0x3c7d('0x3'));var auth=require(_0x3c7d('0x4'));var interaction=require(_0x3c7d('0x5'));var config=require('../../config/environment');var controller=require(_0x3c7d('0x6'));router[_0x3c7d('0x7')]('/',auth[_0x3c7d('0x8')](),controller['index']);router[_0x3c7d('0x7')](_0x3c7d('0x9'),auth[_0x3c7d('0x8')](),controller[_0x3c7d('0xa')]);router[_0x3c7d('0x7')](_0x3c7d('0xb'),auth[_0x3c7d('0x8')](),controller[_0x3c7d('0xc')]);router['post']('/',auth[_0x3c7d('0x8')](),controller[_0x3c7d('0xd')]);router['put'](_0x3c7d('0xb'),auth[_0x3c7d('0x8')](),controller[_0x3c7d('0xe')]);router['delete'](_0x3c7d('0xb'),auth[_0x3c7d('0x8')](),controller['destroy']);module[_0x3c7d('0xf')]=router; \ No newline at end of file +var _0xcae5=['../../components/interaction/service','./voiceTransferReport.controller','index','/describe','isAuthenticated','describe','get','/:id','post','update','exports','util','express','fs-extra'];(function(_0x57f8b8,_0x2ac6d2){var _0x40a6d4=function(_0x5b3dcd){while(--_0x5b3dcd){_0x57f8b8['push'](_0x57f8b8['shift']());}};_0x40a6d4(++_0x2ac6d2);}(_0xcae5,0x1bd));var _0x5cae=function(_0x22edc8,_0x508ec4){_0x22edc8=_0x22edc8-0x0;var _0x47ac3e=_0xcae5[_0x22edc8];return _0x47ac3e;};'use strict';var multer=require('multer');var util=require(_0x5cae('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5cae('0x1'));var router=express['Router']();var fs_extra=require(_0x5cae('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5cae('0x3'));var config=require('../../config/environment');var controller=require(_0x5cae('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x5cae('0x5')]);router['get'](_0x5cae('0x6'),auth[_0x5cae('0x7')](),controller[_0x5cae('0x8')]);router[_0x5cae('0x9')](_0x5cae('0xa'),auth[_0x5cae('0x7')](),controller['show']);router[_0x5cae('0xb')]('/',auth[_0x5cae('0x7')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5cae('0xc')]);router['delete'](_0x5cae('0xa'),auth[_0x5cae('0x7')](),controller['destroy']);module[_0x5cae('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1179920..ab3fe86 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 _0x260d=['blind','STRING','moment','ENUM'];(function(_0x43c112,_0x4a770f){var _0x4ea632=function(_0x5e8af6){while(--_0x5e8af6){_0x43c112['push'](_0x43c112['shift']());}};_0x4ea632(++_0x4a770f);}(_0x260d,0x1ae));var _0xd260=function(_0x3f98fc,_0x4e48d8){_0x3f98fc=_0x3f98fc-0x0;var _0x24ba7e=_0x260d[_0x3f98fc];return _0x24ba7e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd260('0x0'));module['exports']={'type':{'type':Sequelize[_0xd260('0x1')](_0xd260('0x2'),'attended')},'result':{'type':Sequelize[_0xd260('0x3')]},'transfererchannel':{'type':Sequelize[_0xd260('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xd260('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xd260('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xd260('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xd260('0x3')]},'transferercontext':{'type':Sequelize[_0xd260('0x3')]},'transfererexten':{'type':Sequelize[_0xd260('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xd260('0x3')]},'transfereechannel':{'type':Sequelize[_0xd260('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xd260('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xd260('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd260('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xd260('0x3')]},'transfereeexten':{'type':Sequelize[_0xd260('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xd260('0x3')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xd260('0x3')]},'extension':{'type':Sequelize[_0xd260('0x3')]}}; \ No newline at end of file +var _0xcee9=['blind','attended','STRING','ENUM','Yes'];(function(_0x43747e,_0x13b832){var _0x7fb853=function(_0x4b1028){while(--_0x4b1028){_0x43747e['push'](_0x43747e['shift']());}};_0x7fb853(++_0x13b832);}(_0xcee9,0x6e));var _0x9cee=function(_0x132d09,_0xeb22db){_0x132d09=_0x132d09-0x0;var _0x818e12=_0xcee9[_0x132d09];return _0x818e12;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x9cee('0x0'),_0x9cee('0x1'))},'result':{'type':Sequelize[_0x9cee('0x2')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x9cee('0x2')]},'transferercalleridname':{'type':Sequelize[_0x9cee('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9cee('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x9cee('0x2')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x9cee('0x2')]},'transfererlinkedid':{'type':Sequelize[_0x9cee('0x2')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x9cee('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x9cee('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9cee('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x9cee('0x2')]},'transfereecontext':{'type':Sequelize[_0x9cee('0x2')]},'transfereeexten':{'type':Sequelize[_0x9cee('0x2')]},'transfereelinkedid':{'type':Sequelize[_0x9cee('0x2')]},'isexternal':{'type':Sequelize[_0x9cee('0x3')](_0x9cee('0x4'),'No')},'context':{'type':Sequelize[_0x9cee('0x2')]},'extension':{'type':Sequelize[_0x9cee('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 072be00..e19924d 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 _0xd2ba=['includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options'];(function(_0x289fd8,_0x29c288){var _0x1fccf7=function(_0x1c549a){while(--_0x1c549a){_0x289fd8['push'](_0x289fd8['shift']());}};_0x1fccf7(++_0x29c288);}(_0xd2ba,0x9b));var _0xad2b=function(_0x5086f7,_0x35bb69){_0x5086f7=_0x5086f7-0x0;var _0x253f9b=_0xd2ba[_0x5086f7];return _0x253f9b;};'use strict';var emlformat=require(_0xad2b('0x0'));var rimraf=require(_0xad2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad2b('0x2'));var rp=require(_0xad2b('0x3'));var moment=require(_0xad2b('0x4'));var BPromise=require(_0xad2b('0x5'));var Mustache=require(_0xad2b('0x6'));var util=require('util');var path=require(_0xad2b('0x7'));var sox=require(_0xad2b('0x8'));var csv=require(_0xad2b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad2b('0xa'));var squel=require(_0xad2b('0xb'));var crypto=require('crypto');var jsforce=require(_0xad2b('0xc'));var deskjs=require(_0xad2b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad2b('0xe'));var Redis=require(_0xad2b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xad2b('0x10'));var as=require(_0xad2b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xad2b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xad2b('0x13'));var db=require(_0xad2b('0x14'))['db'];function respondWithStatusCode(_0x443682,_0x3c4905){_0x3c4905=_0x3c4905||0xcc;return function(_0xafbe74){if(_0xafbe74){return _0x443682[_0xad2b('0x15')](_0x3c4905);}return _0x443682['status'](_0x3c4905)[_0xad2b('0x16')]();};}function respondWithResult(_0x3d0c84,_0x2b829d){_0x2b829d=_0x2b829d||0xc8;return function(_0x4442cc){if(_0x4442cc){return _0x3d0c84[_0xad2b('0x17')](_0x2b829d)[_0xad2b('0x18')](_0x4442cc);}};}function respondWithFilteredResult(_0xfb7bf3,_0x791972){return function(_0x242b97){if(_0x242b97){var _0x1784ac=typeof _0x791972['offset']===_0xad2b('0x19')&&typeof _0x791972['limit']===_0xad2b('0x19');var _0x122057=_0x242b97[_0xad2b('0x1a')];var _0x39b951=_0x1784ac?0x0:_0x791972[_0xad2b('0x1b')];var _0x6d09eb=_0x1784ac?_0x242b97[_0xad2b('0x1a')]:_0x791972[_0xad2b('0x1b')]+_0x791972['limit'];var _0x58ec6a;if(_0x6d09eb>=_0x122057){_0x6d09eb=_0x122057;_0x58ec6a=0xc8;}else{_0x58ec6a=0xce;}_0xfb7bf3[_0xad2b('0x17')](_0x58ec6a);return _0xfb7bf3[_0xad2b('0x1c')](_0xad2b('0x1d'),_0x39b951+'-'+_0x6d09eb+'/'+_0x122057)[_0xad2b('0x18')](_0x242b97);}return null;};}function patchUpdates(_0x55d1b3){return function(_0x2514f1){try{jsonpatch[_0xad2b('0x1e')](_0x2514f1,_0x55d1b3,!![]);}catch(_0x54dc4c){return BPromise[_0xad2b('0x1f')](_0x54dc4c);}return _0x2514f1['save']();};}function saveUpdates(_0x1ea738,_0x24790c){return function(_0x1d70ee){if(_0x1d70ee){return _0x1d70ee[_0xad2b('0x20')](_0x1ea738)[_0xad2b('0x21')](function(_0x288c63){return _0x288c63;});}return null;};}function removeEntity(_0x119c2f,_0x4b983f){return function(_0x4288d5){if(_0x4288d5){return _0x4288d5['destroy']()[_0xad2b('0x21')](function(){_0x119c2f[_0xad2b('0x17')](0xcc)[_0xad2b('0x16')]();});}};}function handleEntityNotFound(_0x180135,_0x3a330a){return function(_0x86201b){if(!_0x86201b){_0x180135[_0xad2b('0x15')](0x194);}return _0x86201b;};}function handleError(_0x1ba4e4,_0x37bf5d){_0x37bf5d=_0x37bf5d||0x1f4;return function(_0x2a8c60){logger[_0xad2b('0x22')](_0x2a8c60[_0xad2b('0x23')]);if(_0x2a8c60[_0xad2b('0x24')]){delete _0x2a8c60['name'];}_0x1ba4e4[_0xad2b('0x17')](_0x37bf5d)['send'](_0x2a8c60);};}exports[_0xad2b('0x25')]=function(_0x517f0a,_0x4bb4f6){var _0xd32b8d={},_0x291e20={},_0x5a67f1={'count':0x0,'rows':[]};var _0x39e9be=_[_0xad2b('0x26')](db[_0xad2b('0x27')][_0xad2b('0x28')],function(_0x483ad3){return{'name':_0x483ad3[_0xad2b('0x29')],'type':_0x483ad3[_0xad2b('0x2a')][_0xad2b('0x2b')]};});_0x291e20[_0xad2b('0x2c')]=_[_0xad2b('0x26')](_0x39e9be,_0xad2b('0x24'));_0x291e20['query']=_[_0xad2b('0x2d')](_0x517f0a[_0xad2b('0x2e')]);_0x291e20['filters']=_[_0xad2b('0x2f')](_0x291e20[_0xad2b('0x2c')],_0x291e20[_0xad2b('0x2e')]);_0xd32b8d['attributes']=_['intersection'](_0x291e20[_0xad2b('0x2c')],qs[_0xad2b('0x30')](_0x517f0a[_0xad2b('0x2e')][_0xad2b('0x30')]));_0xd32b8d[_0xad2b('0x31')]=_0xd32b8d[_0xad2b('0x31')]['length']?_0xd32b8d[_0xad2b('0x31')]:_0x291e20[_0xad2b('0x2c')];if(!_0x517f0a[_0xad2b('0x2e')]['hasOwnProperty'](_0xad2b('0x32'))){_0xd32b8d[_0xad2b('0x33')]=qs[_0xad2b('0x33')](_0x517f0a[_0xad2b('0x2e')]['limit']);_0xd32b8d[_0xad2b('0x1b')]=qs['offset'](_0x517f0a[_0xad2b('0x2e')][_0xad2b('0x1b')]);}_0xd32b8d[_0xad2b('0x34')]=qs[_0xad2b('0x35')](_0x517f0a[_0xad2b('0x2e')][_0xad2b('0x35')]);_0xd32b8d[_0xad2b('0x36')]=qs['filters'](_[_0xad2b('0x37')](_0x517f0a[_0xad2b('0x2e')],_0x291e20[_0xad2b('0x38')]),_0x39e9be);if(_0x517f0a[_0xad2b('0x2e')]['filter']){_0xd32b8d[_0xad2b('0x36')]=_[_0xad2b('0x39')](_0xd32b8d[_0xad2b('0x36')],{'$or':_[_0xad2b('0x26')](_0x39e9be,function(_0x2337ea){if(_0x2337ea[_0xad2b('0x2a')]!==_0xad2b('0x3a')){var _0x27711b={};_0x27711b[_0x2337ea[_0xad2b('0x24')]]={'$like':'%'+_0x517f0a[_0xad2b('0x2e')][_0xad2b('0x3b')]+'%'};return _0x27711b;}})});}_0xd32b8d=_['merge']({},_0xd32b8d,_0x517f0a[_0xad2b('0x3c')]);var _0x30c746={'where':_0xd32b8d['where']};return db['VoiceTransferReport'][_0xad2b('0x1a')](_0x30c746)['then'](function(_0xb45988){_0x5a67f1[_0xad2b('0x1a')]=_0xb45988;if(_0x517f0a['query'][_0xad2b('0x3d')]){_0xd32b8d[_0xad2b('0x3e')]=[{'all':!![]}];}return db[_0xad2b('0x27')][_0xad2b('0x3f')](_0xd32b8d);})[_0xad2b('0x21')](function(_0x580194){_0x5a67f1['rows']=_0x580194;return _0x5a67f1;})[_0xad2b('0x21')](respondWithFilteredResult(_0x4bb4f6,_0xd32b8d))[_0xad2b('0x40')](handleError(_0x4bb4f6,null));};exports[_0xad2b('0x41')]=function(_0x47af8f,_0x46d553){var _0x2aca54={'raw':!![],'where':{'id':_0x47af8f[_0xad2b('0x42')]['id']}},_0x2cd14a={};_0x2cd14a[_0xad2b('0x2c')]=_[_0xad2b('0x2d')](db['VoiceTransferReport']['rawAttributes']);_0x2cd14a[_0xad2b('0x2e')]=_[_0xad2b('0x2d')](_0x47af8f[_0xad2b('0x2e')]);_0x2cd14a[_0xad2b('0x38')]=_[_0xad2b('0x2f')](_0x2cd14a[_0xad2b('0x2c')],_0x2cd14a[_0xad2b('0x2e')]);_0x2aca54[_0xad2b('0x31')]=_[_0xad2b('0x2f')](_0x2cd14a['model'],qs[_0xad2b('0x30')](_0x47af8f[_0xad2b('0x2e')][_0xad2b('0x30')]));_0x2aca54[_0xad2b('0x31')]=_0x2aca54[_0xad2b('0x31')]['length']?_0x2aca54[_0xad2b('0x31')]:_0x2cd14a['model'];if(_0x47af8f[_0xad2b('0x2e')][_0xad2b('0x3d')]){_0x2aca54[_0xad2b('0x3e')]=[{'all':!![]}];}_0x2aca54=_[_0xad2b('0x39')]({},_0x2aca54,_0x47af8f[_0xad2b('0x3c')]);return db['VoiceTransferReport']['find'](_0x2aca54)['then'](handleEntityNotFound(_0x46d553,null))[_0xad2b('0x21')](respondWithResult(_0x46d553,null))['catch'](handleError(_0x46d553,null));};exports[_0xad2b('0x43')]=function(_0x12a739,_0x3b834b){return db['VoiceTransferReport']['create'](_0x12a739['body'],{})[_0xad2b('0x21')](respondWithResult(_0x3b834b,0xc9))[_0xad2b('0x40')](handleError(_0x3b834b,null));};exports['update']=function(_0x381e1f,_0xa165f9){if(_0x381e1f[_0xad2b('0x44')]['id']){delete _0x381e1f[_0xad2b('0x44')]['id'];}return db[_0xad2b('0x27')][_0xad2b('0x45')]({'where':{'id':_0x381e1f[_0xad2b('0x42')]['id']}})[_0xad2b('0x21')](handleEntityNotFound(_0xa165f9,null))['then'](saveUpdates(_0x381e1f[_0xad2b('0x44')],null))[_0xad2b('0x21')](respondWithResult(_0xa165f9,null))[_0xad2b('0x40')](handleError(_0xa165f9,null));};exports[_0xad2b('0x46')]=function(_0x42081c,_0x4a1697){return db['VoiceTransferReport'][_0xad2b('0x45')]({'where':{'id':_0x42081c[_0xad2b('0x42')]['id']}})[_0xad2b('0x21')](handleEntityNotFound(_0x4a1697,null))[_0xad2b('0x21')](removeEntity(_0x4a1697,null))[_0xad2b('0x40')](handleError(_0x4a1697,null));};exports['describe']=function(_0x4ef200,_0x52b116){return db[_0xad2b('0x27')][_0xad2b('0x47')]()['then'](respondWithResult(_0x52b116,null))['catch'](handleError(_0x52b116,null));}; \ No newline at end of file +var _0xd932=['update','body','params','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','VoiceTransferReport','includeAll','include','findAll','rows','show','find','catch','create'];(function(_0x5ab3b4,_0x5ede5d){var _0x1a7c0c=function(_0x590648){while(--_0x590648){_0x5ab3b4['push'](_0x5ab3b4['shift']());}};_0x1a7c0c(++_0x5ede5d);}(_0xd932,0xa1));var _0x2d93=function(_0x34535a,_0x2a99c8){_0x34535a=_0x34535a-0x0;var _0x2fb9ca=_0xd932[_0x34535a];return _0x2fb9ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d93('0x0'));var rp=require(_0x2d93('0x1'));var moment=require(_0x2d93('0x2'));var BPromise=require(_0x2d93('0x3'));var Mustache=require(_0x2d93('0x4'));var util=require('util');var path=require(_0x2d93('0x5'));var sox=require('sox');var csv=require(_0x2d93('0x6'));var ejs=require(_0x2d93('0x7'));var fs=require('fs');var fs_extra=require(_0x2d93('0x8'));var _=require(_0x2d93('0x9'));var squel=require(_0x2d93('0xa'));var crypto=require('crypto');var jsforce=require(_0x2d93('0xb'));var deskjs=require(_0x2d93('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2d93('0xd'));var Papa=require(_0x2d93('0xe'));var Redis=require(_0x2d93('0xf'));var authService=require(_0x2d93('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d93('0x11'));var logger=require(_0x2d93('0x12'))(_0x2d93('0x13'));var utils=require(_0x2d93('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d93('0x15'));var db=require(_0x2d93('0x16'))['db'];function respondWithStatusCode(_0x511680,_0x33cbd3){_0x33cbd3=_0x33cbd3||0xcc;return function(_0x4b179a){if(_0x4b179a){return _0x511680['sendStatus'](_0x33cbd3);}return _0x511680[_0x2d93('0x17')](_0x33cbd3)[_0x2d93('0x18')]();};}function respondWithResult(_0xa23af2,_0x59e4cf){_0x59e4cf=_0x59e4cf||0xc8;return function(_0xb71d3c){if(_0xb71d3c){return _0xa23af2[_0x2d93('0x17')](_0x59e4cf)[_0x2d93('0x19')](_0xb71d3c);}};}function respondWithFilteredResult(_0x572bd6,_0x1211cc){return function(_0x3c18ca){if(_0x3c18ca){var _0x384df1=typeof _0x1211cc[_0x2d93('0x1a')]==='undefined'&&typeof _0x1211cc['limit']===_0x2d93('0x1b');var _0x4f50a1=_0x3c18ca[_0x2d93('0x1c')];var _0x31f320=_0x384df1?0x0:_0x1211cc[_0x2d93('0x1a')];var _0x570d03=_0x384df1?_0x3c18ca[_0x2d93('0x1c')]:_0x1211cc['offset']+_0x1211cc[_0x2d93('0x1d')];var _0x2645b0;if(_0x570d03>=_0x4f50a1){_0x570d03=_0x4f50a1;_0x2645b0=0xc8;}else{_0x2645b0=0xce;}_0x572bd6['status'](_0x2645b0);return _0x572bd6[_0x2d93('0x1e')](_0x2d93('0x1f'),_0x31f320+'-'+_0x570d03+'/'+_0x4f50a1)[_0x2d93('0x19')](_0x3c18ca);}return null;};}function patchUpdates(_0x39c738){return function(_0x2c1b74){try{jsonpatch[_0x2d93('0x20')](_0x2c1b74,_0x39c738,!![]);}catch(_0xefd642){return BPromise[_0x2d93('0x21')](_0xefd642);}return _0x2c1b74[_0x2d93('0x22')]();};}function saveUpdates(_0x14d80b,_0x180995){return function(_0x586ff4){if(_0x586ff4){return _0x586ff4['update'](_0x14d80b)[_0x2d93('0x23')](function(_0x43da6f){return _0x43da6f;});}return null;};}function removeEntity(_0x5382c7,_0x3ed127){return function(_0x253f00){if(_0x253f00){return _0x253f00['destroy']()['then'](function(){_0x5382c7[_0x2d93('0x17')](0xcc)[_0x2d93('0x18')]();});}};}function handleEntityNotFound(_0x1573db,_0x2985d3){return function(_0x542756){if(!_0x542756){_0x1573db[_0x2d93('0x24')](0x194);}return _0x542756;};}function handleError(_0x491534,_0x50fef1){_0x50fef1=_0x50fef1||0x1f4;return function(_0x2f57ad){logger[_0x2d93('0x25')](_0x2f57ad['stack']);if(_0x2f57ad[_0x2d93('0x26')]){delete _0x2f57ad[_0x2d93('0x26')];}_0x491534[_0x2d93('0x17')](_0x50fef1)[_0x2d93('0x27')](_0x2f57ad);};}exports[_0x2d93('0x28')]=function(_0x138606,_0x52f44b){var _0x23d721={},_0x3cdfb3={},_0x52e7a7={'count':0x0,'rows':[]};var _0x2d3a96=_['map'](db['VoiceTransferReport'][_0x2d93('0x29')],function(_0x2bf6f0){return{'name':_0x2bf6f0[_0x2d93('0x2a')],'type':_0x2bf6f0[_0x2d93('0x2b')][_0x2d93('0x2c')]};});_0x3cdfb3[_0x2d93('0x2d')]=_['map'](_0x2d3a96,_0x2d93('0x26'));_0x3cdfb3['query']=_[_0x2d93('0x2e')](_0x138606['query']);_0x3cdfb3[_0x2d93('0x2f')]=_['intersection'](_0x3cdfb3[_0x2d93('0x2d')],_0x3cdfb3[_0x2d93('0x30')]);_0x23d721['attributes']=_[_0x2d93('0x31')](_0x3cdfb3['model'],qs[_0x2d93('0x32')](_0x138606[_0x2d93('0x30')][_0x2d93('0x32')]));_0x23d721[_0x2d93('0x33')]=_0x23d721[_0x2d93('0x33')][_0x2d93('0x34')]?_0x23d721[_0x2d93('0x33')]:_0x3cdfb3[_0x2d93('0x2d')];if(!_0x138606[_0x2d93('0x30')][_0x2d93('0x35')](_0x2d93('0x36'))){_0x23d721[_0x2d93('0x1d')]=qs[_0x2d93('0x1d')](_0x138606[_0x2d93('0x30')][_0x2d93('0x1d')]);_0x23d721[_0x2d93('0x1a')]=qs[_0x2d93('0x1a')](_0x138606[_0x2d93('0x30')][_0x2d93('0x1a')]);}_0x23d721[_0x2d93('0x37')]=qs[_0x2d93('0x38')](_0x138606[_0x2d93('0x30')][_0x2d93('0x38')]);_0x23d721['where']=qs[_0x2d93('0x2f')](_[_0x2d93('0x39')](_0x138606['query'],_0x3cdfb3[_0x2d93('0x2f')]),_0x2d3a96);if(_0x138606[_0x2d93('0x30')][_0x2d93('0x3a')]){_0x23d721[_0x2d93('0x3b')]=_['merge'](_0x23d721['where'],{'$or':_[_0x2d93('0x3c')](_0x2d3a96,function(_0x32945e){if(_0x32945e['type']!==_0x2d93('0x3d')){var _0x103275={};_0x103275[_0x32945e['name']]={'$like':'%'+_0x138606[_0x2d93('0x30')][_0x2d93('0x3a')]+'%'};return _0x103275;}})});}_0x23d721=_[_0x2d93('0x3e')]({},_0x23d721,_0x138606[_0x2d93('0x3f')]);var _0x1a94ec={'where':_0x23d721['where']};return db[_0x2d93('0x40')]['count'](_0x1a94ec)[_0x2d93('0x23')](function(_0x181b61){_0x52e7a7[_0x2d93('0x1c')]=_0x181b61;if(_0x138606[_0x2d93('0x30')][_0x2d93('0x41')]){_0x23d721[_0x2d93('0x42')]=[{'all':!![]}];}return db[_0x2d93('0x40')][_0x2d93('0x43')](_0x23d721);})[_0x2d93('0x23')](function(_0x37ac7d){_0x52e7a7[_0x2d93('0x44')]=_0x37ac7d;return _0x52e7a7;})[_0x2d93('0x23')](respondWithFilteredResult(_0x52f44b,_0x23d721))['catch'](handleError(_0x52f44b,null));};exports[_0x2d93('0x45')]=function(_0x51c7c8,_0x54d5e1){var _0x5f45f9={'raw':!![],'where':{'id':_0x51c7c8['params']['id']}},_0x3014df={};_0x3014df[_0x2d93('0x2d')]=_[_0x2d93('0x2e')](db[_0x2d93('0x40')][_0x2d93('0x29')]);_0x3014df[_0x2d93('0x30')]=_[_0x2d93('0x2e')](_0x51c7c8['query']);_0x3014df[_0x2d93('0x2f')]=_[_0x2d93('0x31')](_0x3014df['model'],_0x3014df[_0x2d93('0x30')]);_0x5f45f9['attributes']=_[_0x2d93('0x31')](_0x3014df[_0x2d93('0x2d')],qs[_0x2d93('0x32')](_0x51c7c8['query'][_0x2d93('0x32')]));_0x5f45f9[_0x2d93('0x33')]=_0x5f45f9['attributes']['length']?_0x5f45f9[_0x2d93('0x33')]:_0x3014df[_0x2d93('0x2d')];if(_0x51c7c8[_0x2d93('0x30')][_0x2d93('0x41')]){_0x5f45f9['include']=[{'all':!![]}];}_0x5f45f9=_[_0x2d93('0x3e')]({},_0x5f45f9,_0x51c7c8[_0x2d93('0x3f')]);return db['VoiceTransferReport'][_0x2d93('0x46')](_0x5f45f9)[_0x2d93('0x23')](handleEntityNotFound(_0x54d5e1,null))[_0x2d93('0x23')](respondWithResult(_0x54d5e1,null))[_0x2d93('0x47')](handleError(_0x54d5e1,null));};exports['create']=function(_0x2f6287,_0x56d2f3){return db[_0x2d93('0x40')][_0x2d93('0x48')](_0x2f6287['body'],{})[_0x2d93('0x23')](respondWithResult(_0x56d2f3,0xc9))[_0x2d93('0x47')](handleError(_0x56d2f3,null));};exports[_0x2d93('0x49')]=function(_0x273a1e,_0x263205){if(_0x273a1e[_0x2d93('0x4a')]['id']){delete _0x273a1e['body']['id'];}return db[_0x2d93('0x40')]['find']({'where':{'id':_0x273a1e[_0x2d93('0x4b')]['id']}})[_0x2d93('0x23')](handleEntityNotFound(_0x263205,null))['then'](saveUpdates(_0x273a1e[_0x2d93('0x4a')],null))[_0x2d93('0x23')](respondWithResult(_0x263205,null))[_0x2d93('0x47')](handleError(_0x263205,null));};exports[_0x2d93('0x4c')]=function(_0x4de01e,_0x483e9b){return db['VoiceTransferReport'][_0x2d93('0x46')]({'where':{'id':_0x4de01e['params']['id']}})[_0x2d93('0x23')](handleEntityNotFound(_0x483e9b,null))[_0x2d93('0x23')](removeEntity(_0x483e9b,null))[_0x2d93('0x47')](handleError(_0x483e9b,null));};exports[_0x2d93('0x4d')]=function(_0x3cc579,_0x3fd5a2){return db[_0x2d93('0x40')][_0x2d93('0x4d')]()[_0x2d93('0x23')](respondWithResult(_0x3fd5a2,null))[_0x2d93('0x47')](handleError(_0x3fd5a2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 3c17fa1..26a8fe1 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 _0x34ba=['request-promise','path','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x1d695f,_0x4d8dc8){var _0x5987b5=function(_0x48dca0){while(--_0x48dca0){_0x1d695f['push'](_0x1d695f['shift']());}};_0x5987b5(++_0x4d8dc8);}(_0x34ba,0x145));var _0xa34b=function(_0x4152d0,_0x3c9c2d){_0x4152d0=_0x4152d0-0x0;var _0x3a0e50=_0x34ba[_0x4152d0];return _0x3a0e50;};'use strict';var _=require(_0xa34b('0x0'));var util=require(_0xa34b('0x1'));var logger=require(_0xa34b('0x2'))(_0xa34b('0x3'));var moment=require(_0xa34b('0x4'));var BPromise=require('bluebird');var rp=require(_0xa34b('0x5'));var fs=require('fs');var path=require(_0xa34b('0x6'));var rimraf=require('rimraf');var config=require(_0xa34b('0x7'));var attributes=require(_0xa34b('0x8'));module['exports']=function(_0x176619,_0x48a194){return _0x176619['define'](_0xa34b('0x9'),attributes,{'tableName':_0xa34b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3705=['exports','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x5691ec,_0x319320){var _0x8a7d6d=function(_0x5c8419){while(--_0x5c8419){_0x5691ec['push'](_0x5691ec['shift']());}};_0x8a7d6d(++_0x319320);}(_0x3705,0x1a7));var _0x5370=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3705[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x5370('0x0'));var util=require(_0x5370('0x1'));var logger=require(_0x5370('0x2'))(_0x5370('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5370('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5370('0x5'));var config=require(_0x5370('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x5370('0x7')]=function(_0x311a68,_0x358d92){return _0x311a68['define'](_0x5370('0x8'),attributes,{'tableName':_0x5370('0x9'),'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 d742b67..9713bd3 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 _0x1142=['../../config/utils','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4fd5d6,_0x50dced){var _0x1f635d=function(_0x47a3c8){while(--_0x47a3c8){_0x4fd5d6['push'](_0x4fd5d6['shift']());}};_0x1f635d(++_0x50dced);}(_0x1142,0x182));var _0x2114=function(_0x5d8d02,_0xe8c638){_0x5d8d02=_0x5d8d02-0x0;var _0x246743=_0x1142[_0x5d8d02];return _0x246743;};'use strict';var _=require(_0x2114('0x0'));var util=require(_0x2114('0x1'));var moment=require('moment');var BPromise=require(_0x2114('0x2'));var rs=require(_0x2114('0x3'));var fs=require('fs');var Redis=require(_0x2114('0x4'));var db=require(_0x2114('0x5'))['db'];var utils=require(_0x2114('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2114('0x7'));var client=jayson[_0x2114('0x8')][_0x2114('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a2a9b,_0x154dd1,_0x2047c0){return new BPromise(function(_0xb57074,_0x192b54){return client[_0x2114('0xa')](_0x4a2a9b,_0x2047c0)[_0x2114('0xb')](function(_0x2fe1d6){logger[_0x2114('0xc')](_0x2114('0xd'),_0x154dd1,_0x2114('0xe'));logger[_0x2114('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x154dd1,_0x2114('0xe'),JSON['stringify'](_0x2fe1d6));if(_0x2fe1d6[_0x2114('0x10')]){if(_0x2fe1d6[_0x2114('0x10')][_0x2114('0x11')]===0x1f4){logger[_0x2114('0x10')](_0x2114('0xd'),_0x154dd1,_0x2fe1d6[_0x2114('0x10')]['message']);return _0x192b54(_0x2fe1d6[_0x2114('0x10')]['message']);}logger[_0x2114('0x10')](_0x2114('0xd'),_0x154dd1,_0x2fe1d6[_0x2114('0x10')][_0x2114('0x12')]);return _0xb57074(_0x2fe1d6[_0x2114('0x10')][_0x2114('0x12')]);}else{logger[_0x2114('0xc')](_0x2114('0xd'),_0x154dd1,_0x2114('0xe'));_0xb57074(_0x2fe1d6[_0x2114('0x13')][_0x2114('0x12')]);}})[_0x2114('0x14')](function(_0x39a14c){logger[_0x2114('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x154dd1,_0x39a14c);_0x192b54(_0x39a14c);});});}exports[_0x2114('0x15')]=function(_0x2a6e8e){var _0x3d27d3=this;return new Promise(function(_0x51746e,_0x279185){return db[_0x2114('0x16')][_0x2114('0x17')](_0x2a6e8e[_0x2114('0x18')],{'raw':_0x2a6e8e[_0x2114('0x19')]?_0x2a6e8e[_0x2114('0x19')][_0x2114('0x1a')]===undefined?!![]:![]:!![]})[_0x2114('0xb')](function(_0x10f618){logger[_0x2114('0xc')](_0x2114('0x15'),_0x2a6e8e);logger['debug'](_0x2114('0x15'),_0x2a6e8e,JSON[_0x2114('0x1b')](_0x10f618));_0x51746e(_0x10f618);})[_0x2114('0x14')](function(_0x3f168e){logger[_0x2114('0x10')](_0x2114('0x15'),_0x3f168e[_0x2114('0x12')],_0x2a6e8e);_0x279185(_0x3d27d3[_0x2114('0x10')](0x1f4,_0x3f168e[_0x2114('0x12')]));});});}; \ No newline at end of file +var _0x3c5c=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','info','catch'];(function(_0x1f4d52,_0x59dc1c){var _0x1c6209=function(_0x5d9bad){while(--_0x5d9bad){_0x1f4d52['push'](_0x1f4d52['shift']());}};_0x1c6209(++_0x59dc1c);}(_0x3c5c,0x96));var _0xc3c5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3c5c[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xc3c5('0x0'));var moment=require('moment');var BPromise=require(_0xc3c5('0x1'));var rs=require(_0xc3c5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3c5('0x3'))['db'];var utils=require(_0xc3c5('0x4'));var logger=require(_0xc3c5('0x5'))('rpc');var config=require(_0xc3c5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc3c5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbeb50b,_0x13dd21,_0x2114ab){return new BPromise(function(_0x51a09a,_0x26e864){return client['request'](_0xbeb50b,_0x2114ab)[_0xc3c5('0x8')](function(_0x3aca95){logger['info'](_0xc3c5('0x9'),_0x13dd21,_0xc3c5('0xa'));logger[_0xc3c5('0xb')](_0xc3c5('0xc'),_0x13dd21,'request\x20sent',JSON[_0xc3c5('0xd')](_0x3aca95));if(_0x3aca95[_0xc3c5('0xe')]){if(_0x3aca95['error']['code']===0x1f4){logger[_0xc3c5('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x13dd21,_0x3aca95[_0xc3c5('0xe')][_0xc3c5('0xf')]);return _0x26e864(_0x3aca95[_0xc3c5('0xe')][_0xc3c5('0xf')]);}logger[_0xc3c5('0xe')](_0xc3c5('0x9'),_0x13dd21,_0x3aca95[_0xc3c5('0xe')][_0xc3c5('0xf')]);return _0x51a09a(_0x3aca95[_0xc3c5('0xe')]['message']);}else{logger['info'](_0xc3c5('0x9'),_0x13dd21,'request\x20sent');_0x51a09a(_0x3aca95[_0xc3c5('0x10')][_0xc3c5('0xf')]);}})['catch'](function(_0x46d971){logger['error'](_0xc3c5('0x9'),_0x13dd21,_0x46d971);_0x26e864(_0x46d971);});});}exports[_0xc3c5('0x11')]=function(_0x386fb6){var _0x5c4cf7=this;return new Promise(function(_0x398c73,_0x5c54d3){return db[_0xc3c5('0x12')][_0xc3c5('0x13')](_0x386fb6[_0xc3c5('0x14')],{'raw':_0x386fb6[_0xc3c5('0x15')]?_0x386fb6[_0xc3c5('0x15')][_0xc3c5('0x16')]===undefined?!![]:![]:!![]})[_0xc3c5('0x8')](function(_0x4ec955){logger[_0xc3c5('0x17')](_0xc3c5('0x11'),_0x386fb6);logger[_0xc3c5('0xb')](_0xc3c5('0x11'),_0x386fb6,JSON['stringify'](_0x4ec955));_0x398c73(_0x4ec955);})[_0xc3c5('0x18')](function(_0xa5d541){logger[_0xc3c5('0xe')](_0xc3c5('0x11'),_0xa5d541[_0xc3c5('0xf')],_0x386fb6);_0x5c54d3(_0x5c4cf7[_0xc3c5('0xe')](0x1f4,_0xa5d541[_0xc3c5('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 79fa4e6..aa5d4bb 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 _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x1c3e69,_0x5a4c37){var _0x34dde8=function(_0x3dfcb0){while(--_0x3dfcb0){_0x1c3e69['push'](_0x1c3e69['shift']());}};_0x34dde8(++_0x5a4c37);}(_0xf109,0xce));var _0x9f10=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf109[_0x22b68a];return _0x1ac67a;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x94d082,_0x394007){var _0xc23f81=function(_0x2ff6b0){while(--_0x2ff6b0){_0x94d082['push'](_0x94d082['shift']());}};_0xc23f81(++_0x394007);}(_0xb821,0xa7));var _0x1b82=function(_0xae4569,_0x304a05){_0xae4569=_0xae4569-0x0;var _0x410dc9=_0xb821[_0xae4569];return _0x410dc9;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0a3ae1d..0db5a71 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 _0xe28e=['../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','stack','name','send','status','NotFound','request','error','code','message','result','catch','findOne','VoiceChannels','all','then','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','format','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','webbar:unhold','calls','rows','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','transferNumber','path','lodash'];(function(_0x2cdca0,_0x241be4){var _0xa301f2=function(_0x104e88){while(--_0x104e88){_0x2cdca0['push'](_0x2cdca0['shift']());}};_0xa301f2(++_0x241be4);}(_0xe28e,0x1ba));var _0xee28=function(_0x5b4e11,_0x477803){_0x5b4e11=_0x5b4e11-0x0;var _0x123b4d=_0xe28e[_0x5b4e11];return _0x123b4d;};'use strict';var path=require(_0xee28('0x0'));var fs=require('fs');var _=require(_0xee28('0x1'));var db=require(_0xee28('0x2'))['db'];var config=require(_0xee28('0x3'));var util=require(_0xee28('0x4'));var BPromise=require(_0xee28('0x5'));var jayson=require(_0xee28('0x6'));var amiClient=jayson[_0xee28('0x7')][_0xee28('0x8')]({'port':0x232a});var logger=require(_0xee28('0x9'))(_0xee28('0xa'));var Redis=require(_0xee28('0xb'));config[_0xee28('0xc')]=_['defaults'](config[_0xee28('0xc')],{'host':_0xee28('0xd'),'port':0x18eb});var io=require(_0xee28('0xe'))(new Redis(config[_0xee28('0xc')]));var Schema=require(_0xee28('0xf'));var originateValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xee28('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x13')]},'transferNumber':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]}});function emit(_0x343358,_0x1ff99e,_0x11c95d){logger['info'](_0x343358,_0x1ff99e,JSON[_0xee28('0x15')](_0x11c95d));io['to'](_0x343358)['emit'](_0x1ff99e,_0x11c95d);}function handleError(_0x37e429){return function(_0x19472a){console['log'](_0xee28('0x16'),_0x19472a,_0x19472a instanceof RangeError);logger['error'](_0x19472a[_0xee28('0x17')]);if(_0x19472a instanceof RangeError){if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429['status'](0x194)[_0xee28('0x19')](_0x19472a);}else{if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429[_0xee28('0x1a')](0x1f4)[_0xee28('0x19')](_0x19472a);}};}function checkError(){return function(_0x3674c7){if(!_0x3674c7){throw new RangeError(_0xee28('0x1b'));}return _0x3674c7;};}function respondWithRpcPromise(_0x1280f5,_0x2dbd49){return new BPromise(function(_0x4bda53,_0x342798){var _0x44d7ff=amiClient;return _0x44d7ff[_0xee28('0x1c')](_0x1280f5,_0x2dbd49)['then'](function(_0x5b500b){if(_0x5b500b[_0xee28('0x1d')]){if(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1e')]===0x1f4){return _0x342798(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}return _0x4bda53(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}else{_0x4bda53(_0x5b500b[_0xee28('0x20')]);}})[_0xee28('0x21')](function(_0x733ca8){_0x342798(_0x733ca8);});});}function getAgent(_0x281c8a){return db['User'][_0xee28('0x22')]({'where':{'id':_0x281c8a,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x54528b,_0x587aac){return new BPromise(function(_0x51eae7,_0x8373a7){var _0x884e7d=respondWithRpcPromise(_0xee28('0x23'));var _0x469889=getAgent(_0x54528b);Promise[_0xee28('0x24')]([_0x884e7d,_0x469889])[_0xee28('0x25')](function(_0xbafd67){var _0x4fcc8f=_0xbafd67[0x0];var _0x84e0ba=_0xbafd67[0x1];var _0x7390dc=_[_0xee28('0x26')](_0x4fcc8f['rows'],function(_0x14f7c4){return _0x14f7c4[_0xee28('0x27')]==_0x84e0ba['id']&&_0x14f7c4[_0xee28('0x28')]==_0x587aac;});if(_0x7390dc[_0xee28('0x29')]==0x1){_0x51eae7(_0x84e0ba);}else{_0x8373a7(new RangeError(_0xee28('0x2a')+_0x587aac+_0xee28('0x2b')));}});});}exports[_0xee28('0x2c')]=function(_0x5d2a9d,_0x15f294){logger[_0xee28('0x2d')]('originate\x20fired:',_0x5d2a9d[_0xee28('0x2e')]);var _0x34dd11=originateValidation[_0xee28('0xf')](_0x5d2a9d[_0xee28('0x2e')]);if(_0x34dd11[_0xee28('0x29')]>0x0){return _0x15f294[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x34dd11);}var _0x5a4f48=_0x5d2a9d['body']['userId'];var _0x1a8ef0=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x30')];var _0x3402ce=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x31')];var _0x5b0c20=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x32')];return getAgent(_0x5a4f48)['then'](function(_0x51b28d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x51b28d['name']);emit(util['format'](_0xee28('0x34'),_0x51b28d[_0xee28('0x18')]),'webbar:originate',{'callNumber':_0x1a8ef0,'callerId':_0x3402ce,'callbackUrl':_0x5b0c20});return _0x15f294[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x35')});})[_0xee28('0x21')](handleError(_0x15f294));};exports[_0xee28('0x36')]=function(_0x594116,_0x2a5d06){logger[_0xee28('0x2d')](_0xee28('0x37'),_0x594116[_0xee28('0x2e')]);var _0x43b587=hangupValidation[_0xee28('0xf')](_0x594116['body']);if(_0x43b587[_0xee28('0x29')]>0x0){return _0x2a5d06['status'](0x190)['json'](_0x43b587);}var _0x265ae5=_0x594116['body'][_0xee28('0x38')];var _0x5c5f08=_0x594116[_0xee28('0x2e')]['sessionId'];return getAgent(_0x265ae5)[_0xee28('0x25')](function(_0x211345){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x211345['name']);emit(util[_0xee28('0x39')]('user:%s',_0x211345[_0xee28('0x18')]),_0xee28('0x3a'),{'sessionId':_0x5c5f08});return _0x2a5d06[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3b')});})[_0xee28('0x21')](handleError(_0x2a5d06));};exports[_0xee28('0x3c')]=function(_0x5a4b9c,_0x4d9d21){logger[_0xee28('0x2d')]('answer\x20fired:',_0x5a4b9c['body']);var _0x4064cf=answerValidation[_0xee28('0xf')](_0x5a4b9c['body']);if(_0x4064cf[_0xee28('0x29')]>0x0){return _0x4d9d21[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x4064cf);}var _0x24cfaa=_0x5a4b9c[_0xee28('0x2e')][_0xee28('0x38')];var _0x1735a9=_0x5a4b9c['body'][_0xee28('0x28')];return getAgent(_0x24cfaa)[_0xee28('0x25')](function(_0x2dd024){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2dd024['name']);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x2dd024['name']),_0xee28('0x3d'),{'sessionId':_0x1735a9});return _0x4d9d21[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3e')});})[_0xee28('0x21')](handleError(_0x4d9d21));};exports[_0xee28('0x3f')]=function(_0x54ab7b,_0x36e5bb){logger['info']('hold\x20fired:',_0x54ab7b[_0xee28('0x2e')]);var _0x2f240f=holdValidation['validate'](_0x54ab7b[_0xee28('0x2e')]);if(_0x2f240f[_0xee28('0x29')]>0x0){return _0x36e5bb[_0xee28('0x1a')](0x190)['json'](_0x2f240f);}var _0x57e57e=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x38')];var _0x1bb1ac=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x57e57e)[_0xee28('0x25')](function(_0x2574c5){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2574c5[_0xee28('0x18')]);emit(util['format'](_0xee28('0x34'),_0x2574c5['name']),_0xee28('0x40'),{'sessionId':_0x1bb1ac});return _0x36e5bb[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x41')});})[_0xee28('0x21')](handleError(_0x36e5bb));};exports['unhold']=function(_0x5247fe,_0x5ca018){logger[_0xee28('0x2d')]('unhold\x20fired:',_0x5247fe['body']);var _0x659fc4=unholdValidation['validate'](_0x5247fe[_0xee28('0x2e')]);if(_0x659fc4[_0xee28('0x29')]>0x0){return _0x5ca018[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x659fc4);}var _0x398120=_0x5247fe[_0xee28('0x2e')][_0xee28('0x38')];var _0xc1bdba=_0x5247fe[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x398120)['then'](function(_0x1f3680){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x1f3680['name']);emit(util['format']('user:%s',_0x1f3680['name']),_0xee28('0x42'),{'sessionId':_0xc1bdba});return _0x5ca018[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xee28('0x21')](handleError(_0x5ca018));};exports[_0xee28('0x43')]=function(_0x204bbe,_0x39b228){logger[_0xee28('0x2d')]('calls\x20fired:',_0x39b228[_0xee28('0x2e')]);var _0x1c6696=callsValidation[_0xee28('0xf')](_0x204bbe['body']);if(_0x1c6696[_0xee28('0x29')]>0x0){return _0x39b228[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x1c6696);}var _0x47794a=_0x204bbe[_0xee28('0x2e')][_0xee28('0x38')];var _0xfcca7e=respondWithRpcPromise('VoiceChannels');var _0x161394=getAgent(_0x47794a);return Promise['all']([_0xfcca7e,_0x161394])['then'](function(_0x5b7292){var _0x333d7e=_0x5b7292[0x0];var _0x7c51d5=_0x5b7292[0x1];var _0x3cad0a=_[_0xee28('0x26')](_0x333d7e[_0xee28('0x44')],function(_0x27d96d){return _0x27d96d[_0xee28('0x27')]==_0x7c51d5['id'];});return _0x39b228[_0xee28('0x1a')](0xc8)['json']({'count':_0x3cad0a[_0xee28('0x29')],'rows':_0x3cad0a});})[_0xee28('0x21')](handleError(_0x39b228));};exports[_0xee28('0x45')]=function(_0x2b8252,_0x209c3e){logger[_0xee28('0x2d')](_0xee28('0x46'),_0x2b8252['body']);var _0x438943=conferenceValidation['validate'](_0x2b8252[_0xee28('0x2e')]);if(_0x438943[_0xee28('0x29')]>0x0){return _0x209c3e['status'](0x190)[_0xee28('0x2f')](_0x438943);}var _0x2a5fa7=_0x2b8252[_0xee28('0x2e')][_0xee28('0x38')];return getAgent(_0x2a5fa7)['then'](function(_0x209d6d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x209d6d[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x209d6d[_0xee28('0x18')]),'webbar:conference');return _0x209c3e[_0xee28('0x1a')](0xc8)['json']({'error':![],'message':_0xee28('0x47')});})[_0xee28('0x21')](handleError(_0x209c3e));};exports['transfer']=function(_0x4b222a,_0x14bc7a){logger['info'](_0xee28('0x48'),_0x4b222a[_0xee28('0x2e')]);var _0x19f81a=transferValidation[_0xee28('0xf')](_0x4b222a[_0xee28('0x2e')]);if(_0x19f81a[_0xee28('0x29')]>0x0){return _0x14bc7a[_0xee28('0x1a')](0x190)['json'](_0x19f81a);}var _0x179ce6=_0x4b222a[_0xee28('0x2e')][_0xee28('0x38')];var _0x57ded5=_0x4b222a[_0xee28('0x2e')][_0xee28('0x28')];var _0x1e190f=_0x4b222a[_0xee28('0x2e')][_0xee28('0x49')];return getAgent(_0x179ce6)[_0xee28('0x25')](function(_0x5dc31e){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x5dc31e[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x5dc31e[_0xee28('0x18')]),'webbar:transfer',{'sessionId':_0x57ded5,'transferNumber':_0x1e190f});return _0x14bc7a[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x14bc7a));}; \ No newline at end of file +var _0x04b8=['sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','hangup\x20fired:','sessionId','format','user:%s','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','length'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x04b8,0x159));var _0x804b=function(_0x2afb28,_0x19e8b0){_0x2afb28=_0x2afb28-0x0;var _0x41d764=_0x04b8[_0x2afb28];return _0x41d764;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x804b('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x804b('0x1'));var util=require(_0x804b('0x2'));var BPromise=require('bluebird');var jayson=require(_0x804b('0x3'));var amiClient=jayson[_0x804b('0x4')]['http']({'port':0x232a});var logger=require(_0x804b('0x5'))(_0x804b('0x6'));var Redis=require(_0x804b('0x7'));config['redis']=_[_0x804b('0x8')](config[_0x804b('0x9')],{'host':_0x804b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x804b('0x9')]));var Schema=require(_0x804b('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x804b('0xc')]},'callNumber':{'type':_0x804b('0xd'),'required':[!![],_0x804b('0xe')]},'callerId':{'type':_0x804b('0xd')},'callbackUrl':{'type':_0x804b('0xd')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x804b('0xc')]},'sessionId':{'type':_0x804b('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x804b('0xf'),'required':[!![],_0x804b('0xc')]},'sessionId':{'type':_0x804b('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x804b('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x804b('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x804b('0xd'),'required':[!![],_0x804b('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x804b('0xf'),'required':[!![],_0x804b('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x804b('0xf'),'required':[!![],_0x804b('0xc')]},'sessionId':{'type':_0x804b('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x804b('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x804b('0xf'),'required':[!![],_0x804b('0xc')]}});function emit(_0x5e1cfe,_0x3c5986,_0x511d22){logger[_0x804b('0x11')](_0x5e1cfe,_0x3c5986,JSON[_0x804b('0x12')](_0x511d22));io['to'](_0x5e1cfe)[_0x804b('0x13')](_0x3c5986,_0x511d22);}function handleError(_0x1760f8){return function(_0x3a05c0){console['log'](_0x804b('0x14'),_0x3a05c0,_0x3a05c0 instanceof RangeError);logger['error'](_0x3a05c0[_0x804b('0x15')]);if(_0x3a05c0 instanceof RangeError){if(_0x3a05c0[_0x804b('0x16')]){delete _0x3a05c0[_0x804b('0x16')];}_0x1760f8[_0x804b('0x17')](0x194)['send'](_0x3a05c0);}else{if(_0x3a05c0[_0x804b('0x16')]){delete _0x3a05c0[_0x804b('0x16')];}_0x1760f8[_0x804b('0x17')](0x1f4)[_0x804b('0x18')](_0x3a05c0);}};}function checkError(){return function(_0x27844b){if(!_0x27844b){throw new RangeError(_0x804b('0x19'));}return _0x27844b;};}function respondWithRpcPromise(_0x3241a0,_0x162204){return new BPromise(function(_0xaa9521,_0x2b7271){var _0x1acc48=amiClient;return _0x1acc48['request'](_0x3241a0,_0x162204)[_0x804b('0x1a')](function(_0x5a77e0){if(_0x5a77e0['error']){if(_0x5a77e0[_0x804b('0x1b')][_0x804b('0x1c')]===0x1f4){return _0x2b7271(_0x5a77e0[_0x804b('0x1b')][_0x804b('0x1d')]);}return _0xaa9521(_0x5a77e0[_0x804b('0x1b')]['message']);}else{_0xaa9521(_0x5a77e0[_0x804b('0x1e')]);}})[_0x804b('0x1f')](function(_0x4e7266){_0x2b7271(_0x4e7266);});});}function getAgent(_0x12b6a6){return db[_0x804b('0x20')][_0x804b('0x21')]({'where':{'id':_0x12b6a6,'role':_0x804b('0x22')}})[_0x804b('0x1a')](checkError());}function getAgentCheckSession(_0x5cc1dd,_0x456580){return new BPromise(function(_0x22f822,_0x1f08f4){var _0xe145e=respondWithRpcPromise(_0x804b('0x23'));var _0x4a6079=getAgent(_0x5cc1dd);Promise[_0x804b('0x24')]([_0xe145e,_0x4a6079])[_0x804b('0x1a')](function(_0x410871){var _0x5c7026=_0x410871[0x0];var _0x3dbd41=_0x410871[0x1];var _0x407357=_[_0x804b('0x25')](_0x5c7026['rows'],function(_0x408857){return _0x408857[_0x804b('0x26')]==_0x3dbd41['id']&&_0x408857['sessionId']==_0x456580;});if(_0x407357[_0x804b('0x27')]==0x1){_0x22f822(_0x3dbd41);}else{_0x1f08f4(new RangeError(_0x804b('0x28')+_0x456580+_0x804b('0x29')));}});});}exports[_0x804b('0x2a')]=function(_0x46de73,_0x241c96){logger['info'](_0x804b('0x2b'),_0x46de73[_0x804b('0x2c')]);var _0x16e460=originateValidation[_0x804b('0xb')](_0x46de73[_0x804b('0x2c')]);if(_0x16e460[_0x804b('0x27')]>0x0){return _0x241c96[_0x804b('0x17')](0x190)[_0x804b('0x2d')](_0x16e460);}var _0x30f25f=_0x46de73[_0x804b('0x2c')][_0x804b('0x2e')];var _0x27906a=_0x46de73[_0x804b('0x2c')][_0x804b('0x2f')];var _0x20c50b=_0x46de73[_0x804b('0x2c')][_0x804b('0x30')];var _0x1be16f=_0x46de73[_0x804b('0x2c')][_0x804b('0x31')];return getAgent(_0x30f25f)[_0x804b('0x1a')](function(_0x350387){logger[_0x804b('0x11')](_0x804b('0x32'),_0x350387[_0x804b('0x16')]);emit(util['format']('user:%s',_0x350387['name']),_0x804b('0x33'),{'callNumber':_0x27906a,'callerId':_0x20c50b,'callbackUrl':_0x1be16f});return _0x241c96[_0x804b('0x17')](0xc8)[_0x804b('0x2d')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x241c96));};exports['hangup']=function(_0x27a4fb,_0x1aaa47){logger[_0x804b('0x11')](_0x804b('0x34'),_0x27a4fb[_0x804b('0x2c')]);var _0x10b49a=hangupValidation[_0x804b('0xb')](_0x27a4fb[_0x804b('0x2c')]);if(_0x10b49a[_0x804b('0x27')]>0x0){return _0x1aaa47[_0x804b('0x17')](0x190)[_0x804b('0x2d')](_0x10b49a);}var _0x22a3fa=_0x27a4fb[_0x804b('0x2c')]['userId'];var _0x2c6e93=_0x27a4fb[_0x804b('0x2c')][_0x804b('0x35')];return getAgent(_0x22a3fa)[_0x804b('0x1a')](function(_0x62cfee){logger['info']('entityFound:',_0x62cfee[_0x804b('0x16')]);emit(util[_0x804b('0x36')](_0x804b('0x37'),_0x62cfee['name']),_0x804b('0x38'),{'sessionId':_0x2c6e93});return _0x1aaa47['status'](0xc8)[_0x804b('0x2d')]({'error':![],'message':_0x804b('0x39')});})[_0x804b('0x1f')](handleError(_0x1aaa47));};exports[_0x804b('0x3a')]=function(_0xc4a0fc,_0x13b986){logger[_0x804b('0x11')]('answer\x20fired:',_0xc4a0fc[_0x804b('0x2c')]);var _0x1c0363=answerValidation[_0x804b('0xb')](_0xc4a0fc[_0x804b('0x2c')]);if(_0x1c0363['length']>0x0){return _0x13b986[_0x804b('0x17')](0x190)[_0x804b('0x2d')](_0x1c0363);}var _0x1df519=_0xc4a0fc[_0x804b('0x2c')][_0x804b('0x2e')];var _0xbca498=_0xc4a0fc[_0x804b('0x2c')][_0x804b('0x35')];return getAgent(_0x1df519)['then'](function(_0x3f6f1c){logger['info']('entityFound:',_0x3f6f1c['name']);emit(util[_0x804b('0x36')]('user:%s',_0x3f6f1c[_0x804b('0x16')]),_0x804b('0x3b'),{'sessionId':_0xbca498});return _0x13b986[_0x804b('0x17')](0xc8)[_0x804b('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x804b('0x1f')](handleError(_0x13b986));};exports[_0x804b('0x3c')]=function(_0x44211d,_0x523dbb){logger[_0x804b('0x11')](_0x804b('0x3d'),_0x44211d[_0x804b('0x2c')]);var _0x4cada2=holdValidation[_0x804b('0xb')](_0x44211d[_0x804b('0x2c')]);if(_0x4cada2[_0x804b('0x27')]>0x0){return _0x523dbb[_0x804b('0x17')](0x190)[_0x804b('0x2d')](_0x4cada2);}var _0x3a39f5=_0x44211d[_0x804b('0x2c')][_0x804b('0x2e')];var _0x1d3e73=_0x44211d[_0x804b('0x2c')][_0x804b('0x35')];return getAgent(_0x3a39f5)[_0x804b('0x1a')](function(_0x20862f){logger[_0x804b('0x11')]('entityFound:',_0x20862f['name']);emit(util[_0x804b('0x36')](_0x804b('0x37'),_0x20862f[_0x804b('0x16')]),_0x804b('0x3e'),{'sessionId':_0x1d3e73});return _0x523dbb[_0x804b('0x17')](0xc8)['json']({'error':![],'message':_0x804b('0x3f')});})[_0x804b('0x1f')](handleError(_0x523dbb));};exports[_0x804b('0x40')]=function(_0x3ca9ff,_0x47247c){logger[_0x804b('0x11')]('unhold\x20fired:',_0x3ca9ff['body']);var _0x3fe62a=unholdValidation[_0x804b('0xb')](_0x3ca9ff['body']);if(_0x3fe62a['length']>0x0){return _0x47247c[_0x804b('0x17')](0x190)[_0x804b('0x2d')](_0x3fe62a);}var _0x4a5068=_0x3ca9ff['body'][_0x804b('0x2e')];var _0x38c2c0=_0x3ca9ff['body'][_0x804b('0x35')];return getAgent(_0x4a5068)['then'](function(_0x165155){logger['info'](_0x804b('0x32'),_0x165155[_0x804b('0x16')]);emit(util['format'](_0x804b('0x37'),_0x165155['name']),_0x804b('0x41'),{'sessionId':_0x38c2c0});return _0x47247c[_0x804b('0x17')](0xc8)[_0x804b('0x2d')]({'error':![],'message':_0x804b('0x42')});})[_0x804b('0x1f')](handleError(_0x47247c));};exports[_0x804b('0x43')]=function(_0x3a3a59,_0x13a84f){logger[_0x804b('0x11')](_0x804b('0x44'),_0x13a84f['body']);var _0x53b91d=callsValidation[_0x804b('0xb')](_0x3a3a59['body']);if(_0x53b91d['length']>0x0){return _0x13a84f[_0x804b('0x17')](0x190)[_0x804b('0x2d')](_0x53b91d);}var _0x2df300=_0x3a3a59[_0x804b('0x2c')]['userId'];var _0x4f7cc4=respondWithRpcPromise(_0x804b('0x23'));var _0x3954d0=getAgent(_0x2df300);return Promise[_0x804b('0x24')]([_0x4f7cc4,_0x3954d0])[_0x804b('0x1a')](function(_0x9e261a){var _0xe19c3d=_0x9e261a[0x0];var _0x24c9b0=_0x9e261a[0x1];var _0x3100aa=_[_0x804b('0x25')](_0xe19c3d[_0x804b('0x45')],function(_0x3c0f28){return _0x3c0f28[_0x804b('0x26')]==_0x24c9b0['id'];});return _0x13a84f[_0x804b('0x17')](0xc8)[_0x804b('0x2d')]({'count':_0x3100aa[_0x804b('0x27')],'rows':_0x3100aa});})[_0x804b('0x1f')](handleError(_0x13a84f));};exports['conference']=function(_0x30b23a,_0x3d94f9){logger['info'](_0x804b('0x46'),_0x30b23a[_0x804b('0x2c')]);var _0x180251=conferenceValidation[_0x804b('0xb')](_0x30b23a['body']);if(_0x180251[_0x804b('0x27')]>0x0){return _0x3d94f9[_0x804b('0x17')](0x190)['json'](_0x180251);}var _0x3098a1=_0x30b23a[_0x804b('0x2c')][_0x804b('0x2e')];return getAgent(_0x3098a1)['then'](function(_0x126ae4){logger[_0x804b('0x11')](_0x804b('0x32'),_0x126ae4[_0x804b('0x16')]);emit(util[_0x804b('0x36')]('user:%s',_0x126ae4[_0x804b('0x16')]),_0x804b('0x47'));return _0x3d94f9[_0x804b('0x17')](0xc8)[_0x804b('0x2d')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x3d94f9));};exports[_0x804b('0x48')]=function(_0x5695bb,_0x22d816){logger[_0x804b('0x11')](_0x804b('0x49'),_0x5695bb[_0x804b('0x2c')]);var _0x2bfef2=transferValidation['validate'](_0x5695bb[_0x804b('0x2c')]);if(_0x2bfef2[_0x804b('0x27')]>0x0){return _0x22d816[_0x804b('0x17')](0x190)['json'](_0x2bfef2);}var _0x360a81=_0x5695bb[_0x804b('0x2c')]['userId'];var _0xb9deae=_0x5695bb['body'][_0x804b('0x35')];var _0x45d98f=_0x5695bb['body'][_0x804b('0x4a')];return getAgent(_0x360a81)[_0x804b('0x1a')](function(_0xaedaf6){logger['info'](_0x804b('0x32'),_0xaedaf6['name']);emit(util[_0x804b('0x36')](_0x804b('0x37'),_0xaedaf6[_0x804b('0x16')]),_0x804b('0x4b'),{'sessionId':_0xb9deae,'transferNumber':_0x45d98f});return _0x22d816['status'](0xc8)[_0x804b('0x2d')]({'error':![],'message':_0x804b('0x4c')});})[_0x804b('0x1f')](handleError(_0x22d816));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6a5075a..27bb5b1 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 _0x8df3=['/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','notify','/:id/send','send','put','update','destroy','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5da01c,_0x53bf77){var _0x1216c2=function(_0x1d8513){while(--_0x1d8513){_0x5da01c['push'](_0x5da01c['shift']());}};_0x1216c2(++_0x53bf77);}(_0x8df3,0x120));var _0x38df=function(_0xbfc389,_0x5aad2e){_0xbfc389=_0xbfc389-0x0;var _0x31583a=_0x8df3[_0xbfc389];return _0x31583a;};'use strict';var multer=require(_0x38df('0x0'));var util=require(_0x38df('0x1'));var path=require(_0x38df('0x2'));var timeout=require(_0x38df('0x3'));var express=require(_0x38df('0x4'));var router=express['Router']();var fs_extra=require(_0x38df('0x5'));var auth=require(_0x38df('0x6'));var interaction=require(_0x38df('0x7'));var config=require('../../config/environment');var controller=require(_0x38df('0x8'));router[_0x38df('0x9')]('/',auth[_0x38df('0xa')](),controller[_0x38df('0xb')]);router[_0x38df('0x9')](_0x38df('0xc'),auth[_0x38df('0xa')](),controller[_0x38df('0xd')]);router[_0x38df('0x9')](_0x38df('0xe'),auth[_0x38df('0xa')](),controller[_0x38df('0xf')]);router[_0x38df('0x9')](_0x38df('0x10'),auth[_0x38df('0xa')](),controller[_0x38df('0x11')]);router['get'](_0x38df('0x12'),auth[_0x38df('0xa')](),controller['getAnswers']);router['get'](_0x38df('0x13'),auth[_0x38df('0xa')](),controller[_0x38df('0x14')]);router[_0x38df('0x9')](_0x38df('0x15'),auth[_0x38df('0xa')](),controller[_0x38df('0x16')]);router[_0x38df('0x17')]('/',auth['isAuthenticated'](),controller[_0x38df('0x18')]);router[_0x38df('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x38df('0x19')]);router[_0x38df('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x38df('0x1a')]);router[_0x38df('0x17')](_0x38df('0x13'),auth[_0x38df('0xa')](),controller[_0x38df('0x1b')]);router['post'](_0x38df('0x15'),auth[_0x38df('0xa')](),controller[_0x38df('0x1c')]);router[_0x38df('0x17')]('/:id/notify',controller[_0x38df('0x1d')]);router[_0x38df('0x17')](_0x38df('0x1e'),auth['isAuthenticated'](),controller[_0x38df('0x1f')]);router[_0x38df('0x20')](_0x38df('0xe'),auth[_0x38df('0xa')](),controller[_0x38df('0x21')]);router['delete'](_0x38df('0xe'),auth[_0x38df('0xa')](),controller[_0x38df('0x22')]);router[_0x38df('0x23')](_0x38df('0x10'),auth['isAuthenticated'](),controller[_0x38df('0x24')]);router[_0x38df('0x23')](_0x38df('0x12'),auth[_0x38df('0xa')](),controller['removeAnswers']);router['delete'](_0x38df('0x13'),auth[_0x38df('0xa')](),controller['removeAgents']);module[_0x38df('0x25')]=router; \ No newline at end of file +var _0x51ad=['index','/describe','describe','/:id','get','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x51ad,0x1be));var _0xd51a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x51ad[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xd51a('0x0'));var util=require(_0xd51a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd51a('0x2'));var router=express['Router']();var fs_extra=require(_0xd51a('0x3'));var auth=require(_0xd51a('0x4'));var interaction=require(_0xd51a('0x5'));var config=require(_0xd51a('0x6'));var controller=require(_0xd51a('0x7'));router['get']('/',auth[_0xd51a('0x8')](),controller[_0xd51a('0x9')]);router['get'](_0xd51a('0xa'),auth[_0xd51a('0x8')](),controller[_0xd51a('0xb')]);router['get'](_0xd51a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd51a('0xd')](_0xd51a('0xe'),auth[_0xd51a('0x8')](),controller['getDispositions']);router['get'](_0xd51a('0xf'),auth[_0xd51a('0x8')](),controller['getAnswers']);router[_0xd51a('0xd')](_0xd51a('0x10'),auth[_0xd51a('0x8')](),controller[_0xd51a('0x11')]);router[_0xd51a('0xd')]('/:id/applications',auth[_0xd51a('0x8')](),controller[_0xd51a('0x12')]);router[_0xd51a('0x13')]('/',auth[_0xd51a('0x8')](),controller[_0xd51a('0x14')]);router['post'](_0xd51a('0xe'),auth[_0xd51a('0x8')](),controller[_0xd51a('0x15')]);router[_0xd51a('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd51a('0x16')]);router[_0xd51a('0x13')](_0xd51a('0x10'),auth[_0xd51a('0x8')](),controller[_0xd51a('0x17')]);router[_0xd51a('0x13')](_0xd51a('0x18'),auth[_0xd51a('0x8')](),controller[_0xd51a('0x19')]);router[_0xd51a('0x13')](_0xd51a('0x1a'),controller[_0xd51a('0x1b')]);router['post']('/:id/send',auth[_0xd51a('0x8')](),controller[_0xd51a('0x1c')]);router[_0xd51a('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xd51a('0x1e')]);router[_0xd51a('0x1f')]('/:id',auth[_0xd51a('0x8')](),controller[_0xd51a('0x20')]);router[_0xd51a('0x1f')](_0xd51a('0xe'),auth[_0xd51a('0x8')](),controller[_0xd51a('0x21')]);router[_0xd51a('0x1f')](_0xd51a('0xf'),auth[_0xd51a('0x8')](),controller['removeAnswers']);router[_0xd51a('0x1f')](_0xd51a('0x10'),auth[_0xd51a('0x8')](),controller[_0xd51a('0x22')]);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 fd695e4..d15186d 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 _0xbe59=['exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x2a54df,_0x45ea17){var _0x1d5f05=function(_0x5b5fee){while(--_0x5b5fee){_0x2a54df['push'](_0x2a54df['shift']());}};_0x1d5f05(++_0x45ea17);}(_0xbe59,0x166));var _0x9be5=function(_0x45faae,_0x13b1c3){_0x45faae=_0x45faae-0x0;var _0xbdd122=_0xbe59[_0x45faae];return _0xbdd122;};'use strict';var Sequelize=require(_0x9be5('0x0'));var rs=require(_0x9be5('0x1'));module[_0x9be5('0x2')]={'name':{'type':Sequelize[_0x9be5('0x3')],'unique':_0x9be5('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x9be5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9be5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9be5('0x3')],'defaultValue':function(){return rs[_0x9be5('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9be5('0x6')]('twilio',_0x9be5('0x7'))},'accountSid':{'type':Sequelize[_0x9be5('0x3')]},'baseUrl':{'type':Sequelize[_0x9be5('0x3')]},'authToken':{'type':Sequelize[_0x9be5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9be5('0x8')],'defaultValue':function(){return _0x9be5('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9be5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9be5('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9be5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9be5('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9be5('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9be5('0xb')],'defaultValue':![],'comment':_0x9be5('0xc'),'set':function(_0x4017f1){if(!_0x4017f1){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x9be5('0xd')](_0x9be5('0xe'),_0x4017f1);}},'description':{'type':Sequelize[_0x9be5('0x3')]}}; \ No newline at end of file +var _0xbd85=['ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','generate'];(function(_0x53a36b,_0x29679c){var _0x42fed8=function(_0x31dcf8){while(--_0x31dcf8){_0x53a36b['push'](_0x53a36b['shift']());}};_0x42fed8(++_0x29679c);}(_0xbd85,0x1f4));var _0x5bd8=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0xbd85[_0x152aa1];return _0x1bc01a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5bd8('0x0'));module[_0x5bd8('0x1')]={'name':{'type':Sequelize[_0x5bd8('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5bd8('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5bd8('0x2')],'defaultValue':function(){return rs[_0x5bd8('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5bd8('0x4')](_0x5bd8('0x5'),_0x5bd8('0x6'))},'accountSid':{'type':Sequelize[_0x5bd8('0x2')]},'baseUrl':{'type':Sequelize[_0x5bd8('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5bd8('0x7')],'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[_0x5bd8('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5bd8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5bd8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5bd8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5bd8('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5bd8('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4b470c){if(!_0x4b470c){this['setDataValue'](_0x5bd8('0xb'),null);}this[_0x5bd8('0xc')](_0x5bd8('0xd'),_0x4b470c);}},'description':{'type':Sequelize[_0x5bd8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 3b82bf9..a0870b0 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 _0x9330=['unshift','queue','waitForTheAssignedQueue','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','get','WhatsappAccounts','destroy','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','merge','options','WhatsappAccount','includeAll','include','rows','params','keys','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','WhatsappAccountId','Disposition','getDispositions','findOne','order','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','pick','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','WhatsappApplication','bulkCreate','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','applications','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','message_id','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','WhatsappQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9330,0xd3));var _0x0933=function(_0x34e615,_0x3d1f7c){_0x34e615=_0x34e615-0x0;var _0x1d124d=_0x9330[_0x34e615];return _0x1d124d;};'use strict';var emlformat=require(_0x0933('0x0'));var rimraf=require(_0x0933('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0933('0x2'));var rp=require('request-promise');var moment=require(_0x0933('0x3'));var BPromise=require(_0x0933('0x4'));var Mustache=require(_0x0933('0x5'));var util=require(_0x0933('0x6'));var path=require(_0x0933('0x7'));var sox=require(_0x0933('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0933('0x9'));var crypto=require(_0x0933('0xa'));var jsforce=require(_0x0933('0xb'));var deskjs=require(_0x0933('0xc'));var toCsv=require(_0x0933('0xd'));var querystring=require(_0x0933('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0933('0xf'));var as=require(_0x0933('0x10'));var hardwareService=require(_0x0933('0x11'));var logger=require(_0x0933('0x12'))('api');var utils=require(_0x0933('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0933('0x14'));var db=require(_0x0933('0x15'))['db'];config[_0x0933('0x16')]=_[_0x0933('0x17')](config[_0x0933('0x16')],{'host':_0x0933('0x18'),'port':0x18eb});var socket=require(_0x0933('0x19'))(new Redis(config['redis']));require(_0x0933('0x1a'))[_0x0933('0x1b')](socket);var jayson=require(_0x0933('0x1c'));var client=jayson[_0x0933('0x1d')][_0x0933('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5ab362,_0x534bb2,_0x561569,_0x3da79b){return new BPromise(function(_0x244ecf,_0x5f0186){var _0x568b53=_0x3da79b||client;return _0x568b53['request'](_0x5ab362,_0x561569)['then'](function(_0x4bc15e){logger[_0x0933('0x1f')](_0x0933('0x20'),_0x534bb2,_0x0933('0x21'));logger[_0x0933('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x534bb2,_0x0933('0x21'),JSON[_0x0933('0x23')](_0x4bc15e));if(_0x4bc15e[_0x0933('0x24')]){if(_0x4bc15e[_0x0933('0x24')][_0x0933('0x25')]===0x1f4){logger['error'](_0x0933('0x20'),_0x534bb2,_0x4bc15e[_0x0933('0x24')][_0x0933('0x26')]);return _0x5f0186(_0x4bc15e['error'][_0x0933('0x26')]);}logger[_0x0933('0x24')](_0x0933('0x20'),_0x534bb2,_0x4bc15e[_0x0933('0x24')]['message']);return _0x244ecf(_0x4bc15e[_0x0933('0x24')][_0x0933('0x26')]);}else{logger[_0x0933('0x1f')](_0x0933('0x20'),_0x534bb2,'request\x20sent');_0x244ecf(_0x4bc15e[_0x0933('0x27')]['message']);}})[_0x0933('0x28')](function(_0x163601){logger[_0x0933('0x24')](_0x0933('0x20'),_0x534bb2,_0x163601);_0x5f0186(_0x163601);});});}function respondWithStatusCode(_0x2c151c,_0x2f0cd2){_0x2f0cd2=_0x2f0cd2||0xcc;return function(_0x283ab2){if(_0x283ab2){return _0x2c151c[_0x0933('0x29')](_0x2f0cd2);}return _0x2c151c[_0x0933('0x2a')](_0x2f0cd2)[_0x0933('0x2b')]();};}function respondWithResult(_0x54db00,_0x1a3e9a){_0x1a3e9a=_0x1a3e9a||0xc8;return function(_0xf1f341){if(_0xf1f341){return _0x54db00[_0x0933('0x2a')](_0x1a3e9a)['json'](_0xf1f341);}};}function respondWithFilteredResult(_0x321b79,_0x2e391e){return function(_0x186378){if(_0x186378){var _0x1df76b=typeof _0x2e391e[_0x0933('0x2c')]==='undefined'&&typeof _0x2e391e['limit']===_0x0933('0x2d');var _0x1edfa7=_0x186378[_0x0933('0x2e')];var _0x91814e=_0x1df76b?0x0:_0x2e391e[_0x0933('0x2c')];var _0x5dfb2a=_0x1df76b?_0x186378[_0x0933('0x2e')]:_0x2e391e[_0x0933('0x2c')]+_0x2e391e[_0x0933('0x2f')];var _0x53b992;if(_0x5dfb2a>=_0x1edfa7){_0x5dfb2a=_0x1edfa7;_0x53b992=0xc8;}else{_0x53b992=0xce;}_0x321b79[_0x0933('0x2a')](_0x53b992);return _0x321b79[_0x0933('0x30')](_0x0933('0x31'),_0x91814e+'-'+_0x5dfb2a+'/'+_0x1edfa7)[_0x0933('0x32')](_0x186378);}return null;};}function patchUpdates(_0x1a3262){return function(_0x49125f){try{jsonpatch[_0x0933('0x33')](_0x49125f,_0x1a3262,!![]);}catch(_0x44af38){return BPromise['reject'](_0x44af38);}return _0x49125f['save']();};}function saveUpdates(_0x2b5e3b,_0x181cb3){return function(_0xabbcf3){if(_0xabbcf3){return _0xabbcf3[_0x0933('0x34')](_0x2b5e3b)['then'](function(_0x1f5390){return _0x1f5390;});}return null;};}function removeEntity(_0x51998f,_0x4b0a82){return function(_0x4adad3){if(_0x4adad3){return _0x4adad3['destroy']()[_0x0933('0x35')](function(){var _0x37eced=_0x4adad3[_0x0933('0x36')]({'plain':!![]});var _0x12c5d2=_0x0933('0x37');return db['UserProfileResource'][_0x0933('0x38')]({'where':{'type':_0x12c5d2,'resourceId':_0x37eced['id']}})[_0x0933('0x35')](function(){return _0x4adad3;});})['then'](function(){_0x51998f['status'](0xcc)[_0x0933('0x2b')]();});}};}function handleEntityNotFound(_0x4181e9,_0x6c36e7){return function(_0x48af73){if(!_0x48af73){_0x4181e9[_0x0933('0x29')](0x194);}return _0x48af73;};}function handleError(_0x9d96bd,_0x2c0fb8){_0x2c0fb8=_0x2c0fb8||0x1f4;return function(_0x5f5b9b){logger[_0x0933('0x24')](_0x5f5b9b['stack']);if(_0x5f5b9b[_0x0933('0x39')]){delete _0x5f5b9b[_0x0933('0x39')];}_0x9d96bd[_0x0933('0x2a')](_0x2c0fb8)[_0x0933('0x3a')](_0x5f5b9b);};}exports[_0x0933('0x3b')]=function(_0x1f2c8c,_0x5c7205){var _0x1bf694={'include':[{'model':db[_0x0933('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4fdb5c={},_0x23ea65={'count':0x0,'rows':[]};var _0x3131de=_[_0x0933('0x3d')](db['WhatsappAccount'][_0x0933('0x3e')],function(_0x5e8529){return{'name':_0x5e8529[_0x0933('0x3f')],'type':_0x5e8529[_0x0933('0x40')][_0x0933('0x41')]};});_0x4fdb5c[_0x0933('0x42')]=_[_0x0933('0x3d')](_0x3131de,_0x0933('0x39'));_0x4fdb5c[_0x0933('0x43')]=_['keys'](_0x1f2c8c[_0x0933('0x43')]);_0x4fdb5c[_0x0933('0x44')]=_[_0x0933('0x45')](_0x4fdb5c[_0x0933('0x42')],_0x4fdb5c['query']);_0x1bf694[_0x0933('0x46')]=_[_0x0933('0x45')](_0x4fdb5c['model'],qs[_0x0933('0x47')](_0x1f2c8c[_0x0933('0x43')]['fields']));_0x1bf694['attributes']=_0x1bf694[_0x0933('0x46')][_0x0933('0x48')]?_0x1bf694[_0x0933('0x46')]:_0x4fdb5c['model'];if(!_0x1f2c8c['query']['hasOwnProperty'](_0x0933('0x49'))){_0x1bf694[_0x0933('0x2f')]=qs['limit'](_0x1f2c8c[_0x0933('0x43')]['limit']);_0x1bf694[_0x0933('0x2c')]=qs[_0x0933('0x2c')](_0x1f2c8c[_0x0933('0x43')][_0x0933('0x2c')]);}_0x1bf694['order']=qs[_0x0933('0x4a')](_0x1f2c8c[_0x0933('0x43')][_0x0933('0x4a')]);_0x1bf694[_0x0933('0x4b')]=qs[_0x0933('0x44')](_['pick'](_0x1f2c8c['query'],_0x4fdb5c[_0x0933('0x44')]),_0x3131de);if(_0x1f2c8c['query']['filter']){_0x1bf694[_0x0933('0x4b')]=_['merge'](_0x1bf694[_0x0933('0x4b')],{'$or':_[_0x0933('0x3d')](_0x3131de,function(_0x58fa5a){if(_0x58fa5a['type']!==_0x0933('0x4c')){var _0x453d94={};_0x453d94[_0x58fa5a['name']]={'$like':'%'+_0x1f2c8c[_0x0933('0x43')]['filter']+'%'};return _0x453d94;}})});}_0x1bf694=_[_0x0933('0x4d')]({},_0x1bf694,_0x1f2c8c[_0x0933('0x4e')]);var _0x2f9565={'where':_0x1bf694[_0x0933('0x4b')]};return db[_0x0933('0x4f')][_0x0933('0x2e')](_0x2f9565)[_0x0933('0x35')](function(_0x512c39){_0x23ea65[_0x0933('0x2e')]=_0x512c39;if(_0x1f2c8c['query'][_0x0933('0x50')]){_0x1bf694[_0x0933('0x51')]=[{'all':!![]}];}return db[_0x0933('0x4f')]['findAll'](_0x1bf694);})[_0x0933('0x35')](function(_0x57bc2d){_0x23ea65[_0x0933('0x52')]=_0x57bc2d;return _0x23ea65;})[_0x0933('0x35')](respondWithFilteredResult(_0x5c7205,_0x1bf694))[_0x0933('0x28')](handleError(_0x5c7205,null));};exports['show']=function(_0x4a1373,_0x11732b){var _0x5a845f={'raw':![],'where':{'id':_0x4a1373[_0x0933('0x53')]['id']},'include':[{'model':db[_0x0933('0x3c')],'as':'mandatoryDispositionPause'}]},_0x3b5be3={};_0x3b5be3[_0x0933('0x42')]=_[_0x0933('0x54')](db[_0x0933('0x4f')][_0x0933('0x3e')]);_0x3b5be3[_0x0933('0x43')]=_['keys'](_0x4a1373['query']);_0x3b5be3[_0x0933('0x44')]=_[_0x0933('0x45')](_0x3b5be3[_0x0933('0x42')],_0x3b5be3['query']);_0x5a845f['attributes']=_[_0x0933('0x45')](_0x3b5be3[_0x0933('0x42')],qs['fields'](_0x4a1373[_0x0933('0x43')]['fields']));_0x5a845f['attributes']=_0x5a845f[_0x0933('0x46')]['length']?_0x5a845f['attributes']:_0x3b5be3[_0x0933('0x42')];if(_0x4a1373[_0x0933('0x43')]['includeAll']){_0x5a845f[_0x0933('0x51')]=[{'all':!![]}];}_0x5a845f=_[_0x0933('0x4d')]({},_0x5a845f,_0x4a1373[_0x0933('0x4e')]);return db[_0x0933('0x4f')][_0x0933('0x55')](_0x5a845f)[_0x0933('0x35')](handleEntityNotFound(_0x11732b,null))[_0x0933('0x35')](respondWithResult(_0x11732b,null))[_0x0933('0x28')](handleError(_0x11732b,null));};exports[_0x0933('0x56')]=function(_0x39bab7,_0x17b8de){return db['WhatsappAccount'][_0x0933('0x56')](_0x39bab7[_0x0933('0x57')],{})[_0x0933('0x35')](function(_0x2e2a23){var _0x3bb3d2=_0x39bab7[_0x0933('0x58')][_0x0933('0x36')]({'plain':!![]});if(!_0x3bb3d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bb3d2[_0x0933('0x59')]==='user'){var _0xa95b5c=_0x2e2a23[_0x0933('0x36')]({'plain':!![]});var _0x13ed87='WhatsappAccounts';return db['UserProfileSection'][_0x0933('0x55')]({'where':{'name':_0x13ed87,'userProfileId':_0x3bb3d2[_0x0933('0x5a')]},'raw':!![]})[_0x0933('0x35')](function(_0xe4adcd){if(_0xe4adcd&&_0xe4adcd[_0x0933('0x5b')]===0x0){return db[_0x0933('0x5c')][_0x0933('0x56')]({'name':_0xa95b5c[_0x0933('0x39')],'resourceId':_0xa95b5c['id'],'type':_0xe4adcd[_0x0933('0x39')],'sectionId':_0xe4adcd['id']},{})[_0x0933('0x35')](function(){return _0x2e2a23;});}else{return _0x2e2a23;}})['catch'](function(_0x2dfcb5){logger['error'](_0x0933('0x5d'),_0x2dfcb5);throw _0x2dfcb5;});}return _0x2e2a23;})[_0x0933('0x35')](respondWithResult(_0x17b8de,0xc9))[_0x0933('0x28')](handleError(_0x17b8de,null));};exports[_0x0933('0x34')]=function(_0x5d5ef0,_0x9755b5){if(_0x5d5ef0['body']['id']){delete _0x5d5ef0[_0x0933('0x57')]['id'];}return db[_0x0933('0x4f')][_0x0933('0x55')]({'where':{'id':_0x5d5ef0['params']['id']},'include':[{'model':db[_0x0933('0x3c')],'as':_0x0933('0x5e')}]})[_0x0933('0x35')](handleEntityNotFound(_0x9755b5,null))[_0x0933('0x35')](saveUpdates(_0x5d5ef0[_0x0933('0x57')],null))[_0x0933('0x35')](respondWithResult(_0x9755b5,null))[_0x0933('0x28')](handleError(_0x9755b5,null));};exports[_0x0933('0x38')]=function(_0x53be29,_0x2bb006){return db[_0x0933('0x4f')]['find']({'where':{'id':_0x53be29['params']['id']}})['then'](handleEntityNotFound(_0x2bb006,null))[_0x0933('0x35')](removeEntity(_0x2bb006,null))[_0x0933('0x28')](handleError(_0x2bb006,null));};exports[_0x0933('0x5f')]=function(_0x5037a1,_0x36a6ca){return db[_0x0933('0x4f')][_0x0933('0x5f')]()[_0x0933('0x35')](respondWithResult(_0x36a6ca,null))['catch'](handleError(_0x36a6ca,null));};exports['addDisposition']=function(_0x2986a3,_0x5d45c7,_0x2c48b9){if(_0x2986a3[_0x0933('0x57')]['id']){delete _0x2986a3[_0x0933('0x57')]['id'];}return db[_0x0933('0x4f')][_0x0933('0x55')]({'where':{'id':_0x2986a3['params']['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x5d45c7,null))[_0x0933('0x35')](function(_0x4b12af){if(_0x4b12af){_0x2986a3['body'][_0x0933('0x60')]=_0x4b12af['id'];return db[_0x0933('0x61')][_0x0933('0x56')](_0x2986a3[_0x0933('0x57')]);}})[_0x0933('0x35')](respondWithResult(_0x5d45c7,null))[_0x0933('0x28')](handleError(_0x5d45c7,null));};exports[_0x0933('0x62')]=function(_0x2eaa59,_0x499ab1,_0x4b59fe){var _0x2c438f={'raw':![],'where':{}};var _0xdd28db={};var _0x1eb09d={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x0933('0x63')]({'where':{'id':_0x2eaa59[_0x0933('0x53')]['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x499ab1,null))['then'](function(_0x17e52b){if(_0x17e52b){_0xdd28db['model']=_['keys'](db['Disposition'][_0x0933('0x3e')]);_0xdd28db[_0x0933('0x43')]=_['keys'](_0x2eaa59['query']);_0xdd28db[_0x0933('0x44')]=_['intersection'](_0xdd28db['model'],_0xdd28db[_0x0933('0x43')]);_0x2c438f['attributes']=_[_0x0933('0x45')](_0xdd28db[_0x0933('0x42')],qs[_0x0933('0x47')](_0x2eaa59['query'][_0x0933('0x47')]));_0x2c438f[_0x0933('0x46')]=_0x2c438f[_0x0933('0x46')][_0x0933('0x48')]?_0x2c438f[_0x0933('0x46')]:_0xdd28db[_0x0933('0x42')];if(!_0x2eaa59[_0x0933('0x43')]['hasOwnProperty']('nolimit')){_0x2c438f[_0x0933('0x2f')]=qs[_0x0933('0x2f')](_0x2eaa59[_0x0933('0x43')][_0x0933('0x2f')]);_0x2c438f['offset']=qs[_0x0933('0x2c')](_0x2eaa59[_0x0933('0x43')]['offset']);}_0x2c438f[_0x0933('0x64')]=qs[_0x0933('0x4a')](_0x2eaa59['query'][_0x0933('0x4a')]);_0x2c438f['where']=qs[_0x0933('0x44')](_['pick'](_0x2eaa59[_0x0933('0x43')],_0xdd28db[_0x0933('0x44')]));_0x2c438f['where'][_0x0933('0x60')]=_0x17e52b['id'];if(_0x2eaa59[_0x0933('0x43')][_0x0933('0x65')]){_0x2c438f[_0x0933('0x4b')]=_['merge'](_0x2c438f['where'],{'$or':_[_0x0933('0x3d')](_0x2c438f['attributes'],function(_0x38877c){var _0x19faa4={};_0x19faa4[_0x38877c]={'$like':'%'+_0x2eaa59['query']['filter']+'%'};return _0x19faa4;})});}_0x2c438f=_[_0x0933('0x4d')]({},_0x2c438f,_0x2eaa59['options']);return db['Disposition']['count']({'where':_0x2c438f['where']})['then'](function(_0x47f976){_0x1eb09d[_0x0933('0x2e')]=_0x47f976;if(_0x2eaa59[_0x0933('0x43')][_0x0933('0x50')]){_0x2c438f[_0x0933('0x51')]=[{'all':!![]}];}return db[_0x0933('0x61')]['findAll'](_0x2c438f);})['then'](function(_0x5a6c2c){_0x1eb09d[_0x0933('0x52')]=_0x5a6c2c;return _0x1eb09d;});}})['then'](respondWithFilteredResult(_0x499ab1,_0x2c438f))['catch'](handleError(_0x499ab1,null));};exports[_0x0933('0x66')]=function(_0x1b6e0e,_0x1aa733,_0x5000ed){return db[_0x0933('0x4f')][_0x0933('0x55')]({'where':{'id':_0x1b6e0e[_0x0933('0x53')]['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x1aa733,null))[_0x0933('0x35')](function(_0x3ba6be){if(_0x3ba6be){return _0x3ba6be[_0x0933('0x66')](_0x1b6e0e[_0x0933('0x43')][_0x0933('0x67')]);}})[_0x0933('0x35')](respondWithStatusCode(_0x1aa733,null))[_0x0933('0x28')](handleError(_0x1aa733,null));};exports[_0x0933('0x68')]=function(_0x4cf4e2,_0x49d3d1,_0x26ebb3){if(_0x4cf4e2['body']['id']){delete _0x4cf4e2[_0x0933('0x57')]['id'];}return db[_0x0933('0x4f')]['find']({'where':{'id':_0x4cf4e2[_0x0933('0x53')]['id']}})['then'](handleEntityNotFound(_0x49d3d1,null))[_0x0933('0x35')](function(_0x38f2e7){if(_0x38f2e7){_0x4cf4e2['body']['WhatsappAccountId']=_0x38f2e7['id'];return db[_0x0933('0x69')]['create'](_0x4cf4e2[_0x0933('0x57')]);}})[_0x0933('0x35')](respondWithResult(_0x49d3d1,null))[_0x0933('0x28')](handleError(_0x49d3d1,null));};exports[_0x0933('0x6a')]=function(_0x313485,_0x1fafaf,_0x4a6b92){var _0x513827={'raw':![],'where':{}};var _0x44351e={};var _0x59d978={'count':0x0,'rows':[]};return db[_0x0933('0x4f')]['findOne']({'where':{'id':_0x313485[_0x0933('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fafaf,null))['then'](function(_0x2d0f4a){if(_0x2d0f4a){_0x44351e[_0x0933('0x42')]=_[_0x0933('0x54')](db['CannedAnswer'][_0x0933('0x3e')]);_0x44351e['query']=_[_0x0933('0x54')](_0x313485[_0x0933('0x43')]);_0x44351e[_0x0933('0x44')]=_[_0x0933('0x45')](_0x44351e[_0x0933('0x42')],_0x44351e[_0x0933('0x43')]);_0x513827[_0x0933('0x46')]=_[_0x0933('0x45')](_0x44351e[_0x0933('0x42')],qs[_0x0933('0x47')](_0x313485['query'][_0x0933('0x47')]));_0x513827[_0x0933('0x46')]=_0x513827[_0x0933('0x46')][_0x0933('0x48')]?_0x513827[_0x0933('0x46')]:_0x44351e['model'];if(!_0x313485['query'][_0x0933('0x6b')](_0x0933('0x49'))){_0x513827[_0x0933('0x2f')]=qs[_0x0933('0x2f')](_0x313485[_0x0933('0x43')][_0x0933('0x2f')]);_0x513827[_0x0933('0x2c')]=qs['offset'](_0x313485[_0x0933('0x43')][_0x0933('0x2c')]);}_0x513827[_0x0933('0x64')]=qs[_0x0933('0x4a')](_0x313485['query'][_0x0933('0x4a')]);_0x513827[_0x0933('0x4b')]=qs[_0x0933('0x44')](_[_0x0933('0x6c')](_0x313485[_0x0933('0x43')],_0x44351e[_0x0933('0x44')]));_0x513827[_0x0933('0x4b')]['WhatsappAccountId']=_0x2d0f4a['id'];if(_0x313485[_0x0933('0x43')][_0x0933('0x65')]){_0x513827[_0x0933('0x4b')]=_[_0x0933('0x4d')](_0x513827[_0x0933('0x4b')],{'$or':_[_0x0933('0x3d')](_0x513827['attributes'],function(_0x23caa9){var _0x3dc3a0={};_0x3dc3a0[_0x23caa9]={'$like':'%'+_0x313485[_0x0933('0x43')][_0x0933('0x65')]+'%'};return _0x3dc3a0;})});}_0x513827=_[_0x0933('0x4d')]({},_0x513827,_0x313485['options']);return db['CannedAnswer'][_0x0933('0x2e')]({'where':_0x513827[_0x0933('0x4b')]})[_0x0933('0x35')](function(_0x10dab2){_0x59d978[_0x0933('0x2e')]=_0x10dab2;if(_0x313485['query'][_0x0933('0x50')]){_0x513827[_0x0933('0x51')]=[{'all':!![]}];}return db[_0x0933('0x69')]['findAll'](_0x513827);})[_0x0933('0x35')](function(_0x1e3afd){_0x59d978[_0x0933('0x52')]=_0x1e3afd;return _0x59d978;});}})[_0x0933('0x35')](respondWithFilteredResult(_0x1fafaf,_0x513827))[_0x0933('0x28')](handleError(_0x1fafaf,null));};exports['removeAnswers']=function(_0x590fbe,_0x2e8878,_0x387c97){return db[_0x0933('0x4f')][_0x0933('0x55')]({'where':{'id':_0x590fbe[_0x0933('0x53')]['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x2e8878,null))['then'](function(_0x48198c){if(_0x48198c){return _0x48198c[_0x0933('0x6d')](_0x590fbe[_0x0933('0x43')]['ids']);}})[_0x0933('0x35')](respondWithStatusCode(_0x2e8878,null))[_0x0933('0x28')](handleError(_0x2e8878,null));};exports[_0x0933('0x6e')]=function(_0x5c68f0,_0x2f2564,_0x2b9655){return db[_0x0933('0x4f')]['find']({'where':{'id':_0x5c68f0[_0x0933('0x53')]['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x2f2564,null))[_0x0933('0x35')](function(_0x332900){if(_0x332900){return _0x332900['addAgents'](_0x5c68f0['body'][_0x0933('0x67')],_[_0x0933('0x6f')](_0x5c68f0[_0x0933('0x57')],['ids','id'])||{})[_0x0933('0x70')](function(_0x1f2312){for(var _0x3538ff=0x0;_0x3538ff<_0x5c68f0['body'][_0x0933('0x67')][_0x0933('0x48')];_0x3538ff+=0x1){socket['emit'](_0x0933('0x71'),{'UserId':Number(_0x5c68f0['body'][_0x0933('0x67')][_0x3538ff]),'WhatsappAccountId':Number(_0x5c68f0[_0x0933('0x53')]['id'])});}return _0x1f2312;});}})[_0x0933('0x35')](respondWithResult(_0x2f2564,null))[_0x0933('0x28')](handleError(_0x2f2564,null));};exports['removeAgents']=function(_0x3a587c,_0x51d1ec,_0x28fcc9){return db[_0x0933('0x4f')][_0x0933('0x55')]({'where':{'id':_0x3a587c[_0x0933('0x53')]['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x51d1ec,null))[_0x0933('0x35')](function(_0x29ace0){if(_0x29ace0){return _0x29ace0[_0x0933('0x72')](_0x3a587c[_0x0933('0x43')][_0x0933('0x67')])[_0x0933('0x35')](function(){if(_[_0x0933('0x73')](_0x3a587c[_0x0933('0x43')]['ids'])){for(var _0x355814=0x0;_0x355814<_0x3a587c[_0x0933('0x43')]['ids']['length'];_0x355814+=0x1){socket[_0x0933('0x74')](_0x0933('0x75'),{'UserId':Number(_0x3a587c[_0x0933('0x43')][_0x0933('0x67')][_0x355814]),'WhatsappAccountId':Number(_0x3a587c['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x3a587c[_0x0933('0x43')][_0x0933('0x67')]),'WhatsappAccountId':Number(_0x3a587c['params']['id'])});}});}})[_0x0933('0x35')](respondWithStatusCode(_0x51d1ec,null))['catch'](handleError(_0x51d1ec,null));};exports[_0x0933('0x76')]=function(_0xadf85f,_0x15c83b,_0x4851b4){var _0x2b851f={};var _0x513f5f={};var _0x17ffb0;var _0x1c0d8b;return db[_0x0933('0x4f')][_0x0933('0x63')]({'where':{'id':_0xadf85f['params']['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x15c83b,null))[_0x0933('0x35')](function(_0x5272f4){if(_0x5272f4){_0x17ffb0=_0x5272f4;_0x513f5f['model']=_[_0x0933('0x54')](db[_0x0933('0x77')][_0x0933('0x3e')]);_0x513f5f[_0x0933('0x43')]=_[_0x0933('0x54')](_0xadf85f[_0x0933('0x43')]);_0x513f5f['filters']=_[_0x0933('0x45')](_0x513f5f[_0x0933('0x42')],_0x513f5f['query']);_0x2b851f['attributes']=_['intersection'](_0x513f5f['model'],qs[_0x0933('0x47')](_0xadf85f[_0x0933('0x43')]['fields']));_0x2b851f[_0x0933('0x46')]=_0x2b851f[_0x0933('0x46')]['length']?_0x2b851f[_0x0933('0x46')]:_0x513f5f['model'];_0x2b851f[_0x0933('0x64')]=qs[_0x0933('0x4a')](_0xadf85f['query'][_0x0933('0x4a')]);_0x2b851f['where']=qs[_0x0933('0x44')](_[_0x0933('0x6c')](_0xadf85f[_0x0933('0x43')],_0x513f5f[_0x0933('0x44')]));if(_0xadf85f[_0x0933('0x43')][_0x0933('0x65')]){_0x2b851f[_0x0933('0x4b')]=_[_0x0933('0x4d')](_0x2b851f[_0x0933('0x4b')],{'$or':_[_0x0933('0x3d')](_0x2b851f[_0x0933('0x46')],function(_0x55aed1){var _0x5a7ef9={};_0x5a7ef9[_0x55aed1]={'$like':'%'+_0xadf85f[_0x0933('0x43')]['filter']+'%'};return _0x5a7ef9;})});}_0x2b851f=_['merge']({},_0x2b851f,_0xadf85f[_0x0933('0x4e')]);return _0x17ffb0['getAgents'](_0x2b851f);}})[_0x0933('0x35')](function(_0x275598){if(_0x275598){_0x1c0d8b=_0x275598[_0x0933('0x48')];if(!_0xadf85f[_0x0933('0x43')]['hasOwnProperty'](_0x0933('0x49'))){_0x2b851f[_0x0933('0x2f')]=qs[_0x0933('0x2f')](_0xadf85f[_0x0933('0x43')][_0x0933('0x2f')]);_0x2b851f['offset']=qs['offset'](_0xadf85f[_0x0933('0x43')][_0x0933('0x2c')]);}return _0x17ffb0[_0x0933('0x76')](_0x2b851f);}})[_0x0933('0x35')](function(_0x19d3f3){if(_0x19d3f3){return _0x19d3f3?{'count':_0x1c0d8b,'rows':_0x19d3f3}:null;}})['then'](respondWithResult(_0x15c83b,null))[_0x0933('0x28')](handleError(_0x15c83b,null));};exports[_0x0933('0x78')]=function(_0x445c1b,_0x4dfc2c){var _0x326778=_0x445c1b[_0x0933('0x53')]['id'];var _0x31a5e8=_0x445c1b[_0x0933('0x57')];var _0x4a818c=0xc8;var _0x3c0b8e=null;return db[_0x0933('0x79')]['transaction']({'isolationLevel':db[_0x0933('0x79')][_0x0933('0x7a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x490534){return db[_0x0933('0x4f')][_0x0933('0x63')]({'where':{'id':_0x326778},'transaction':_0x490534})[_0x0933('0x35')](function(_0x4e6688){if(_0x4e6688){return db[_0x0933('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x326778},'transaction':_0x490534})[_0x0933('0x35')](function(){var _0x1debfa=_[_0x0933('0x3d')](_0x31a5e8,function(_0x1369a3){_0x1369a3['WhatsappAccountId']=_0x326778;return _0x1369a3;});return db[_0x0933('0x7b')][_0x0933('0x7c')](_0x1debfa,{'transaction':_0x490534});});}else{_0x4a818c=0x194;_0x3c0b8e=[];}});})[_0x0933('0x35')](function(){if(_0x4a818c!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x326778},'order':_0x0933('0x7d')})[_0x0933('0x35')](function(_0x32540c){_0x3c0b8e=_0x32540c;});}})[_0x0933('0x28')](function(_0x2486b9){_0x4a818c=0x1f4;logger['error'](_0x2486b9[_0x0933('0x7e')]);if(_0x2486b9['name']){delete _0x2486b9[_0x0933('0x39')];}_0x3c0b8e=_0x2486b9;})[_0x0933('0x7f')](function(){if(_0x3c0b8e===null){_0x4dfc2c[_0x0933('0x29')](_0x4a818c);}else{if(_0x4a818c===0x1f4){_0x4dfc2c['status'](_0x4a818c)[_0x0933('0x3a')](_0x3c0b8e);}else{_0x4dfc2c['status'](_0x4a818c)[_0x0933('0x32')](_0x3c0b8e);}}});};exports[_0x0933('0x80')]=function(_0x4dbb42,_0x359093,_0x3cd472){var _0x28a2ff={};var _0x203d73={};var _0x321c62;var _0x5c4ab9;return db[_0x0933('0x4f')]['findOne']({'where':{'id':_0x4dbb42['params']['id']}})[_0x0933('0x35')](handleEntityNotFound(_0x359093,null))['then'](function(_0x862b52){if(_0x862b52){_0x321c62=_0x862b52;_0x203d73[_0x0933('0x42')]=_[_0x0933('0x54')](db[_0x0933('0x7b')]['rawAttributes']);_0x203d73[_0x0933('0x43')]=_['keys'](_0x4dbb42[_0x0933('0x43')]);_0x203d73['filters']=_[_0x0933('0x45')](_0x203d73[_0x0933('0x42')],_0x203d73[_0x0933('0x43')]);_0x28a2ff[_0x0933('0x46')]=_['intersection'](_0x203d73['model'],qs[_0x0933('0x47')](_0x4dbb42[_0x0933('0x43')][_0x0933('0x47')]));_0x28a2ff['attributes']=_0x28a2ff['attributes']['length']?_0x28a2ff[_0x0933('0x46')]:_0x203d73[_0x0933('0x42')];_0x28a2ff[_0x0933('0x64')]=qs[_0x0933('0x4a')](_0x4dbb42[_0x0933('0x43')]['sort']);_0x28a2ff[_0x0933('0x4b')]=qs['filters'](_[_0x0933('0x6c')](_0x4dbb42[_0x0933('0x43')],_0x203d73['filters']));if(_0x4dbb42['query']['filter']){_0x28a2ff['where']=_[_0x0933('0x4d')](_0x28a2ff[_0x0933('0x4b')],{'$or':_[_0x0933('0x3d')](_0x28a2ff[_0x0933('0x46')],function(_0x57f718){var _0x56c157={};_0x56c157[_0x57f718]={'$like':'%'+_0x4dbb42['query'][_0x0933('0x65')]+'%'};return _0x56c157;})});}_0x28a2ff=_['merge']({},_0x28a2ff,_0x4dbb42[_0x0933('0x4e')]);return _0x321c62[_0x0933('0x80')](_0x28a2ff);}})[_0x0933('0x35')](function(_0xb182a1){if(_0xb182a1){_0x5c4ab9=_0xb182a1[_0x0933('0x48')];if(!_0x4dbb42[_0x0933('0x43')][_0x0933('0x6b')](_0x0933('0x49'))){_0x28a2ff[_0x0933('0x2f')]=qs['limit'](_0x4dbb42['query']['limit']);_0x28a2ff[_0x0933('0x2c')]=qs[_0x0933('0x2c')](_0x4dbb42[_0x0933('0x43')][_0x0933('0x2c')]);}return _0x321c62[_0x0933('0x80')](_0x28a2ff);}})['then'](function(_0x211559){if(_0x211559){return _0x211559?{'count':_0x5c4ab9,'rows':_0x211559}:null;}})[_0x0933('0x35')](respondWithResult(_0x359093,null))[_0x0933('0x28')](handleError(_0x359093,null));};exports[_0x0933('0x81')]=function(_0xf0d347,_0x413384,_0x3a6997){var _0x41c086={'channel':_0x0933('0x82')};var _0x3a1eeb=[];var _0x27a0a5=[];var _0x5d1a86={};return db[_0x0933('0x4f')][_0x0933('0x55')]({'where':{'id':_0xf0d347[_0x0933('0x53')]['id']},'include':[{'model':db[_0x0933('0x7b')],'as':_0x0933('0x83')}]})['then'](handleEntityNotFound(_0x413384,null))['then'](function(_0x119073){_0x41c086[_0x0933('0x84')]=_0x119073;if(_0x41c086[_0x0933('0x84')]&&_0x41c086['account'][_0x0933('0x40')]===_0x0933('0x85')&&_0xf0d347[_0x0933('0x57')][_0x0933('0x86')]){if(_0xf0d347[_0x0933('0x57')]['statuses']['length']===0x0)return;if(_0xf0d347[_0x0933('0x57')][_0x0933('0x86')][0x0][_0x0933('0x87')]!==_0x0933('0x88'))return;return db[_0x0933('0x89')][_0x0933('0x34')]({'read':!![],'readAt':_0xf0d347['body']['statuses'][0x0]['timestamp']},{'where':{'messageId':_0xf0d347[_0x0933('0x57')][_0x0933('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x0933('0x35')](function(_0x58f09e){return _0x413384[_0x0933('0x2a')](0xc8)[_0x0933('0x32')](_0x58f09e);});}_0x41c086[_0x0933('0x8a')]=_['orderBy'](_0x119073[_0x0933('0x83')],[_0x0933('0x7d')],[_0x0933('0x8b')]);if(_0x41c086[_0x0933('0x84')][_0x0933('0x83')]){delete _0x41c086[_0x0933('0x84')][_0x0933('0x83')];}return db[_0x0933('0x8c')][_0x0933('0x5f')]()[_0x0933('0x35')](function(_0x23197d){if(!_0x23197d){throw new db[(_0x0933('0x8d'))]['ValidationError'](_0x0933('0x8e'));}_0x3a1eeb=_['difference'](_[_0x0933('0x54')](_0x23197d),[_0x0933('0x8f'),_0x0933('0x90')]);_0x27a0a5=_[_0x0933('0x91')](_[_0x0933('0x54')](_0x23197d),[_0x0933('0x8f'),'updatedAt','CompanyId',_0x0933('0x92')]);_0x41c086[_0x0933('0x57')]={'mapKey':_0x0933('0x93')};if(_0x41c086[_0x0933('0x84')]&&_0x41c086[_0x0933('0x84')][_0x0933('0x40')]===_0x0933('0x94')){_0x41c086[_0x0933('0x57')][_0x0933('0x95')]=_0xf0d347[_0x0933('0x57')][_0x0933('0x96')]['replace'](_0x0933('0x97'),'');_0x41c086[_0x0933('0x57')][_0x0933('0x57')]=_0xf0d347[_0x0933('0x57')][_0x0933('0x98')];_0x41c086['body'][_0x0933('0x99')]=_0xf0d347[_0x0933('0x57')][_0x0933('0x9a')];}if(_0x41c086['account']&&_0x41c086[_0x0933('0x84')][_0x0933('0x40')]===_0x0933('0x85')){_0x41c086[_0x0933('0x57')][_0x0933('0x95')]=_0xf0d347[_0x0933('0x57')][_0x0933('0x9b')][0x0]['from'];_0x41c086[_0x0933('0x57')][_0x0933('0x57')]=_0xf0d347['body'][_0x0933('0x9b')][0x0][_0x0933('0x26')][_0x0933('0x57')];_0x41c086['body'][_0x0933('0x99')]=_0xf0d347[_0x0933('0x57')][_0x0933('0x9b')][0x0][_0x0933('0x9c')];}if(_0x41c086['body']['id']){delete _0x41c086[_0x0933('0x57')]['id'];}if(_['isNil'](_0x41c086[_0x0933('0x57')]['from'])){throw new db[(_0x0933('0x8d'))][(_0x0933('0x9d'))]('from\x20is\x20mandatory');}if(_[_0x0933('0x9e')](_0x41c086['body'][_0x0933('0x57')])||_0x41c086[_0x0933('0x57')][_0x0933('0x57')]===''){throw new db[(_0x0933('0x8d'))]['ValidationError'](_0x0933('0x9f'));}if(_[_0x0933('0x9e')](_0x41c086[_0x0933('0x57')]['mapKey'])){throw new db[(_0x0933('0x8d'))]['ValidationError'](_0x0933('0xa0')+_0x27a0a5);}if(!_['includes'](_0x27a0a5,_0x41c086[_0x0933('0x57')][_0x0933('0xa1')])){throw new db[(_0x0933('0x8d'))][(_0x0933('0x9d'))](_0x0933('0xa2')+_0x27a0a5);}_0x5d1a86[_0x41c086['body'][_0x0933('0xa1')]]=_0x41c086[_0x0933('0x57')][_0x0933('0x95')];return db[_0x0933('0xa3')]['find']({'where':{'id':_0x41c086['account'][_0x0933('0x92')]},'include':[{'model':db[_0x0933('0x8c')],'as':_0x0933('0xa4'),'where':_0x5d1a86,'limit':0x1,'order':[['updatedAt',_0x0933('0xa5')]]}]});})['then'](handleEntityNotFound(_0x413384,null))['then'](function(_0x3b5f72){if(_0x3b5f72){_0x41c086[_0x0933('0xa6')]=_[_0x0933('0x6f')](_0x3b5f72,[_0x0933('0xa4')]);if(_0x3b5f72[_0x0933('0xa4')][_0x0933('0x48')]){return _0x3b5f72[_0x0933('0xa4')][0x0];}var _0x248585=_[_0x0933('0x17')](_0x41c086[_0x0933('0x57')],{'firstName':_0x41c086[_0x0933('0x57')][_0x0933('0x95')],'ListId':_0x3b5f72['id']});_0x248585[_0x41c086[_0x0933('0x57')]['mapKey']]=_0x41c086[_0x0933('0x57')][_0x0933('0x95')];return db[_0x0933('0x8c')][_0x0933('0x56')](_0x248585,{'fields':_0x3a1eeb,'raw':!![]});}})[_0x0933('0x35')](handleEntityNotFound(_0x413384,null))[_0x0933('0x35')](function(_0x207730){if(_0x207730){_0x41c086['contact']=_0x207730;var _0x2145b8={'ContactId':_0x207730['id'],'phone':_0x41c086[_0x0933('0x57')][_0x0933('0x95')],'WhatsappAccountId':_0xf0d347[_0x0933('0x53')]['id']};var _0x9b3ad2={'ContactId':_0x207730['id'],'WhatsappAccountId':_0xf0d347['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x0933('0x55')]({'where':_0x9b3ad2})[_0x0933('0x35')](function(_0x4ac954){if(_0x4ac954){return[_0x4ac954,![]];}return db[_0x0933('0xa7')][_0x0933('0x56')](_0x2145b8)[_0x0933('0x35')](function(_0x440750){return[_0x440750,!![]];});});}})[_0x0933('0x70')](function(_0xb7710,_0x4ec241){_0x41c086[_0x0933('0xa8')]=_0xb7710[_0x0933('0x36')]({'plain':!![]});_0x41c086['interaction'][_0x0933('0xa9')]=![];if(_0x4ec241){if(_0x41c086['account']['autoclose']){_0x41c086['applications'][_0x0933('0xaa')]({'id':0x0,'priority':_0x41c086[_0x0933('0x8a')]['length']+0x1,'app':_0x0933('0xab'),'appdata':_0x0933('0xac'),'interval':_0x0933('0xad')});}_0x41c086[_0x0933('0xa8')][_0x0933('0xa9')]=!![];}return db['WhatsappMessage'][_0x0933('0x56')]({'phone':_0x41c086[_0x0933('0x57')][_0x0933('0x95')],'messageId':_0x41c086[_0x0933('0x57')][_0x0933('0x99')],'body':_0x41c086[_0x0933('0x57')]['body'],'WhatsappAccountId':_0xf0d347['params']['id'],'WhatsappInteractionId':_0xb7710['id'],'direction':'in','ContactId':_0xb7710[_0x0933('0xae')],'AttachmentId':_0x41c086[_0x0933('0x57')][_0x0933('0xaf')]});})[_0x0933('0x35')](function(_0x54814c){_0x41c086[_0x0933('0x26')]=_0x54814c;if(!_0x41c086[_0x0933('0xa8')]['UserId'])return;return db[_0x0933('0x77')][_0x0933('0x55')]({'attributes':['id',_0x0933('0x39')],'where':{'id':_0x41c086[_0x0933('0xa8')][_0x0933('0xb0')]}});})[_0x0933('0x35')](function(_0x31394a){if(_0x31394a){_0x41c086[_0x0933('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0933('0xb1'),'appdata':_0x31394a[_0x0933('0x39')]+','+(_0x41c086[_0x0933('0x84')][_0x0933('0xb2')]||0xa),'interval':_0x0933('0xad')});}if(!_0x41c086[_0x0933('0xa8')][_0x0933('0xb3')])return;return db[_0x0933('0xb4')][_0x0933('0x55')]({'attributes':['id','name'],'where':{'id':_0x41c086[_0x0933('0xa8')]['queueId']}});})[_0x0933('0x35')](function(_0x153ed3){if(_0x153ed3){_0x41c086[_0x0933('0x8a')][_0x0933('0xb5')]({'id':0x0,'priority':0x1,'app':_0x0933('0xb6'),'appdata':_0x153ed3[_0x0933('0x39')]+','+(_0x41c086[_0x0933('0x84')][_0x0933('0xb7')]||0x12c),'interval':_0x0933('0xad')});}return respondWithRpcPromise(_0x0933('0xb8'),'startRouting',_0x41c086);})['then'](function(_0xf55654){if(_0xf55654){var _0x574f6c=0xc8;var _0x26c8f9='receiveMessage';logger[_0x0933('0x1f')](_0x0933('0xb9'),_0x26c8f9,_0x574f6c,_0x0933('0xba'));logger[_0x0933('0x22')](_0x0933('0xbb'),_0x26c8f9,_0x574f6c,_0x0933('0xba'),JSON[_0x0933('0x23')](_0xf55654));if(_0x41c086[_0x0933('0x84')][_0x0933('0x40')]===_0x0933('0x94')){return _0x413384[_0x0933('0x2a')](_0x574f6c)[_0x0933('0x30')](_0x0933('0xbc'),_0x0933('0xbd'))[_0x0933('0x3a')](_0x0933('0xbe'));}else{return _0x413384[_0x0933('0x2a')](_0x574f6c)['json'](_0xf55654);}}});})['catch'](handleError(_0x413384,null));};exports['send']=function(_0x19026c,_0x163b56,_0x5a67ab){var _0x5d94d3,_0xf776cd,_0x5260ea;if(_['isNil'](_0x19026c[_0x0933('0x57')][_0x0933('0x57')])||_0x19026c[_0x0933('0x57')][_0x0933('0x57')]===''){throw new db['Sequelize'][(_0x0933('0x9d'))](_0x0933('0x9f'));}if(_[_0x0933('0x9e')](_0x19026c[_0x0933('0x57')]['to'])){throw new db['Sequelize'][(_0x0933('0x9d'))](_0x0933('0xbf'));}_0x5d94d3=_0x19026c[_0x0933('0x57')]['to'];return db['WhatsappAccount'][_0x0933('0x55')]({'where':{'id':_0x19026c['params']['id']},'include':[{'model':db[_0x0933('0xa3')],'as':_0x0933('0xc0'),'include':[{'model':db[_0x0933('0x8c')],'as':_0x0933('0xa4'),'where':{'mobile':_0x5d94d3},'limit':0x1,'order':[[_0x0933('0x90'),'DESC']]}]}]})[_0x0933('0x35')](handleEntityNotFound(_0x163b56,null))['then'](function(_0xd0bf11){if(_0xd0bf11&&_0xd0bf11[_0x0933('0xc0')]){_0xf776cd=_0xd0bf11[_0x0933('0x36')]({'plain':!![]});if(_0xf776cd['List']&&_0xf776cd[_0x0933('0xc0')][_0x0933('0xa4')][_0x0933('0x48')]){return _0xf776cd[_0x0933('0xc0')][_0x0933('0xa4')][0x0];}return db[_0x0933('0x8c')][_0x0933('0x56')](_[_0x0933('0x17')](_0x19026c[_0x0933('0x57')],{'firstName':_0x5d94d3,'mobile':_0x5d94d3,'phone':_0x5d94d3,'ListId':_0xf776cd[_0x0933('0x92')]}));}})['then'](handleEntityNotFound(_0x163b56,null))[_0x0933('0x35')](function(_0x2a66cc){if(_0x2a66cc){_0x5260ea=_0x2a66cc;return db[_0x0933('0xa7')]['find']({'where':{'ContactId':_0x5260ea['id'],'closed':![],'WhatsappAccountId':_0xf776cd['id']}})[_0x0933('0x35')](function(_0x3ae7d4){if(_0x3ae7d4){return[_0x3ae7d4,![]];}return db[_0x0933('0xa7')][_0x0933('0x56')]({'UserId':_0x19026c[_0x0933('0x58')]['id'],'ContactId':_0x5260ea['id'],'WhatsappAccountId':_0xf776cd['id'],'phone':_0x5d94d3,'firstMsgDirection':_0x0933('0xc1'),'Messages':[_[_0x0933('0x4d')](_0x19026c[_0x0933('0x57')],{'read':![],'body':_0x19026c[_0x0933('0x57')][_0x0933('0x57')],'phone':_0x5d94d3,'WhatsappAccountId':_0xf776cd['id'],'UserId':_0x19026c['user']['id'],'ContactId':_0x5260ea['id']})]},{'include':[{'model':db[_0x0933('0x89')],'as':_0x0933('0xc2')}]})['then'](function(_0x506e93){return[_0x506e93,!![]];});});}})[_0x0933('0x70')](function(_0x386f9c,_0x4729a4){if(_0x4729a4){return _0x386f9c;}return db[_0x0933('0x89')]['create'](_[_0x0933('0x4d')](_0x19026c[_0x0933('0x57')],{'read':![],'body':_0x19026c[_0x0933('0x57')][_0x0933('0x57')],'phone':_0x5d94d3,'WhatsappAccountId':_0xf776cd['id'],'WhatsappInteractionId':_0x386f9c['id'],'UserId':_0x19026c[_0x0933('0x58')]['id'],'ContactId':_0x5260ea['id']}))[_0x0933('0x35')](function(_0xe99dc1){_0x386f9c[_0x0933('0xc3')][_0x0933('0xc2')]=[];_0x386f9c[_0x0933('0xc3')][_0x0933('0xc2')][_0x0933('0xaa')](_0xe99dc1[_0x0933('0xc3')]);return _0x386f9c;});})[_0x0933('0x35')](respondWithResult(_0x163b56,null))[_0x0933('0x28')](handleError(_0x163b56,null));}; \ No newline at end of file +var _0x42dc=['result','catch','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappAccounts','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','findAll','show','keys','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','findOne','merge','includeAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','messageId','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','user','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappAccount.socket','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b5886,_0x30c981){var _0x247fbe=function(_0x1148e6){while(--_0x1148e6){_0x4b5886['push'](_0x4b5886['shift']());}};_0x247fbe(++_0x30c981);}(_0x42dc,0xa6));var _0xc42d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x42dc[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xc42d('0x0'));var rimraf=require(_0xc42d('0x1'));var zipdir=require(_0xc42d('0x2'));var jsonpatch=require(_0xc42d('0x3'));var rp=require(_0xc42d('0x4'));var moment=require(_0xc42d('0x5'));var BPromise=require(_0xc42d('0x6'));var Mustache=require(_0xc42d('0x7'));var util=require(_0xc42d('0x8'));var path=require(_0xc42d('0x9'));var sox=require(_0xc42d('0xa'));var csv=require(_0xc42d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc42d('0xc'));var _=require(_0xc42d('0xd'));var squel=require(_0xc42d('0xe'));var crypto=require('crypto');var jsforce=require(_0xc42d('0xf'));var deskjs=require(_0xc42d('0x10'));var toCsv=require(_0xc42d('0xb'));var querystring=require(_0xc42d('0x11'));var Papa=require(_0xc42d('0x12'));var Redis=require(_0xc42d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc42d('0x14'));var as=require(_0xc42d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc42d('0x16'))('api');var utils=require(_0xc42d('0x17'));var config=require(_0xc42d('0x18'));var licenseUtil=require(_0xc42d('0x19'));var db=require('../../mysqldb')['db'];config[_0xc42d('0x1a')]=_[_0xc42d('0x1b')](config[_0xc42d('0x1a')],{'host':_0xc42d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc42d('0x1a')]));require(_0xc42d('0x1d'))['register'](socket);var jayson=require(_0xc42d('0x1e'));var client=jayson['client'][_0xc42d('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xa59016,_0x3b8e33,_0x567480,_0x27c6e3){return new BPromise(function(_0x4a637f,_0x5a3536){var _0x23b4ff=_0x27c6e3||client;return _0x23b4ff[_0xc42d('0x20')](_0xa59016,_0x567480)['then'](function(_0x478536){logger[_0xc42d('0x21')](_0xc42d('0x22'),_0x3b8e33,_0xc42d('0x23'));logger['debug'](_0xc42d('0x24'),_0x3b8e33,_0xc42d('0x23'),JSON[_0xc42d('0x25')](_0x478536));if(_0x478536['error']){if(_0x478536[_0xc42d('0x26')][_0xc42d('0x27')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3b8e33,_0x478536[_0xc42d('0x26')][_0xc42d('0x28')]);return _0x5a3536(_0x478536[_0xc42d('0x26')][_0xc42d('0x28')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3b8e33,_0x478536[_0xc42d('0x26')][_0xc42d('0x28')]);return _0x4a637f(_0x478536['error'][_0xc42d('0x28')]);}else{logger[_0xc42d('0x21')](_0xc42d('0x22'),_0x3b8e33,_0xc42d('0x23'));_0x4a637f(_0x478536[_0xc42d('0x29')][_0xc42d('0x28')]);}})[_0xc42d('0x2a')](function(_0x3b36e){logger[_0xc42d('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x3b8e33,_0x3b36e);_0x5a3536(_0x3b36e);});});}function respondWithStatusCode(_0x2f8e2d,_0x5f0140){_0x5f0140=_0x5f0140||0xcc;return function(_0x1d8a68){if(_0x1d8a68){return _0x2f8e2d[_0xc42d('0x2b')](_0x5f0140);}return _0x2f8e2d['status'](_0x5f0140)[_0xc42d('0x2c')]();};}function respondWithResult(_0x1aedb4,_0x3991e9){_0x3991e9=_0x3991e9||0xc8;return function(_0x3f0494){if(_0x3f0494){return _0x1aedb4['status'](_0x3991e9)['json'](_0x3f0494);}};}function respondWithFilteredResult(_0x1aa740,_0x1c56db){return function(_0x505b49){if(_0x505b49){var _0x5b7da2=typeof _0x1c56db[_0xc42d('0x2d')]===_0xc42d('0x2e')&&typeof _0x1c56db[_0xc42d('0x2f')]===_0xc42d('0x2e');var _0x4780b8=_0x505b49[_0xc42d('0x30')];var _0x6004ec=_0x5b7da2?0x0:_0x1c56db[_0xc42d('0x2d')];var _0x34a4da=_0x5b7da2?_0x505b49[_0xc42d('0x30')]:_0x1c56db['offset']+_0x1c56db[_0xc42d('0x2f')];var _0x13a132;if(_0x34a4da>=_0x4780b8){_0x34a4da=_0x4780b8;_0x13a132=0xc8;}else{_0x13a132=0xce;}_0x1aa740[_0xc42d('0x31')](_0x13a132);return _0x1aa740[_0xc42d('0x32')](_0xc42d('0x33'),_0x6004ec+'-'+_0x34a4da+'/'+_0x4780b8)[_0xc42d('0x34')](_0x505b49);}return null;};}function patchUpdates(_0x75c90c){return function(_0x1c9cb4){try{jsonpatch[_0xc42d('0x35')](_0x1c9cb4,_0x75c90c,!![]);}catch(_0x42f3cf){return BPromise[_0xc42d('0x36')](_0x42f3cf);}return _0x1c9cb4[_0xc42d('0x37')]();};}function saveUpdates(_0x5a8e98,_0x4b4c64){return function(_0x376e0f){if(_0x376e0f){return _0x376e0f[_0xc42d('0x38')](_0x5a8e98)[_0xc42d('0x39')](function(_0x1f0c15){return _0x1f0c15;});}return null;};}function removeEntity(_0x2dc0f7,_0x1555ef){return function(_0xfb29f2){if(_0xfb29f2){return _0xfb29f2[_0xc42d('0x3a')]()['then'](function(){var _0x336eb7=_0xfb29f2[_0xc42d('0x3b')]({'plain':!![]});var _0x5bf13c=_0xc42d('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0x5bf13c,'resourceId':_0x336eb7['id']}})['then'](function(){return _0xfb29f2;});})['then'](function(){_0x2dc0f7[_0xc42d('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be790,_0x593746){return function(_0x52d77f){if(!_0x52d77f){_0x4be790[_0xc42d('0x2b')](0x194);}return _0x52d77f;};}function handleError(_0x52b28d,_0x26c369){_0x26c369=_0x26c369||0x1f4;return function(_0x233bdc){logger['error'](_0x233bdc['stack']);if(_0x233bdc[_0xc42d('0x3d')]){delete _0x233bdc[_0xc42d('0x3d')];}_0x52b28d[_0xc42d('0x31')](_0x26c369)[_0xc42d('0x3e')](_0x233bdc);};}exports[_0xc42d('0x3f')]=function(_0x35679c,_0x267742){var _0x43d73d={'include':[{'model':db[_0xc42d('0x40')],'as':_0xc42d('0x41')}]},_0x58e964={},_0xa565ea={'count':0x0,'rows':[]};var _0x35df2f=_[_0xc42d('0x42')](db[_0xc42d('0x43')][_0xc42d('0x44')],function(_0x2b05a6){return{'name':_0x2b05a6['fieldName'],'type':_0x2b05a6[_0xc42d('0x45')][_0xc42d('0x46')]};});_0x58e964[_0xc42d('0x47')]=_[_0xc42d('0x42')](_0x35df2f,'name');_0x58e964[_0xc42d('0x48')]=_['keys'](_0x35679c[_0xc42d('0x48')]);_0x58e964['filters']=_['intersection'](_0x58e964[_0xc42d('0x47')],_0x58e964[_0xc42d('0x48')]);_0x43d73d[_0xc42d('0x49')]=_['intersection'](_0x58e964[_0xc42d('0x47')],qs[_0xc42d('0x4a')](_0x35679c[_0xc42d('0x48')][_0xc42d('0x4a')]));_0x43d73d['attributes']=_0x43d73d[_0xc42d('0x49')][_0xc42d('0x4b')]?_0x43d73d[_0xc42d('0x49')]:_0x58e964['model'];if(!_0x35679c[_0xc42d('0x48')][_0xc42d('0x4c')](_0xc42d('0x4d'))){_0x43d73d[_0xc42d('0x2f')]=qs[_0xc42d('0x2f')](_0x35679c[_0xc42d('0x48')][_0xc42d('0x2f')]);_0x43d73d['offset']=qs[_0xc42d('0x2d')](_0x35679c[_0xc42d('0x48')][_0xc42d('0x2d')]);}_0x43d73d[_0xc42d('0x4e')]=qs[_0xc42d('0x4f')](_0x35679c[_0xc42d('0x48')]['sort']);_0x43d73d[_0xc42d('0x50')]=qs[_0xc42d('0x51')](_[_0xc42d('0x52')](_0x35679c[_0xc42d('0x48')],_0x58e964['filters']),_0x35df2f);if(_0x35679c[_0xc42d('0x48')][_0xc42d('0x53')]){_0x43d73d[_0xc42d('0x50')]=_['merge'](_0x43d73d[_0xc42d('0x50')],{'$or':_[_0xc42d('0x42')](_0x35df2f,function(_0x4dd3ab){if(_0x4dd3ab[_0xc42d('0x45')]!==_0xc42d('0x54')){var _0x10d14f={};_0x10d14f[_0x4dd3ab[_0xc42d('0x3d')]]={'$like':'%'+_0x35679c['query']['filter']+'%'};return _0x10d14f;}})});}_0x43d73d=_['merge']({},_0x43d73d,_0x35679c[_0xc42d('0x55')]);var _0x27be9c={'where':_0x43d73d[_0xc42d('0x50')]};return db[_0xc42d('0x43')][_0xc42d('0x30')](_0x27be9c)[_0xc42d('0x39')](function(_0x24a0ab){_0xa565ea[_0xc42d('0x30')]=_0x24a0ab;if(_0x35679c[_0xc42d('0x48')]['includeAll']){_0x43d73d[_0xc42d('0x56')]=[{'all':!![]}];}return db[_0xc42d('0x43')][_0xc42d('0x57')](_0x43d73d);})[_0xc42d('0x39')](function(_0x5d1358){_0xa565ea['rows']=_0x5d1358;return _0xa565ea;})[_0xc42d('0x39')](respondWithFilteredResult(_0x267742,_0x43d73d))[_0xc42d('0x2a')](handleError(_0x267742,null));};exports[_0xc42d('0x58')]=function(_0x3e4f57,_0x5e0b79){var _0x10f449={'raw':![],'where':{'id':_0x3e4f57['params']['id']},'include':[{'model':db['Pause'],'as':_0xc42d('0x41')}]},_0x2dcd13={};_0x2dcd13[_0xc42d('0x47')]=_[_0xc42d('0x59')](db[_0xc42d('0x43')][_0xc42d('0x44')]);_0x2dcd13[_0xc42d('0x48')]=_[_0xc42d('0x59')](_0x3e4f57[_0xc42d('0x48')]);_0x2dcd13[_0xc42d('0x51')]=_['intersection'](_0x2dcd13[_0xc42d('0x47')],_0x2dcd13['query']);_0x10f449['attributes']=_[_0xc42d('0x5a')](_0x2dcd13[_0xc42d('0x47')],qs[_0xc42d('0x4a')](_0x3e4f57[_0xc42d('0x48')][_0xc42d('0x4a')]));_0x10f449[_0xc42d('0x49')]=_0x10f449[_0xc42d('0x49')][_0xc42d('0x4b')]?_0x10f449['attributes']:_0x2dcd13[_0xc42d('0x47')];if(_0x3e4f57[_0xc42d('0x48')]['includeAll']){_0x10f449['include']=[{'all':!![]}];}_0x10f449=_['merge']({},_0x10f449,_0x3e4f57[_0xc42d('0x55')]);return db[_0xc42d('0x43')][_0xc42d('0x5b')](_0x10f449)[_0xc42d('0x39')](handleEntityNotFound(_0x5e0b79,null))[_0xc42d('0x39')](respondWithResult(_0x5e0b79,null))[_0xc42d('0x2a')](handleError(_0x5e0b79,null));};exports[_0xc42d('0x5c')]=function(_0x5b27e0,_0x1dcb47){return db[_0xc42d('0x43')]['create'](_0x5b27e0[_0xc42d('0x5d')],{})[_0xc42d('0x39')](function(_0xf82255){var _0x38b5bf=_0x5b27e0['user'][_0xc42d('0x3b')]({'plain':!![]});if(!_0x38b5bf)throw new Error(_0xc42d('0x5e'));if(_0x38b5bf[_0xc42d('0x5f')]==='user'){var _0x205ca1=_0xf82255['get']({'plain':!![]});var _0xe19b48='WhatsappAccounts';return db[_0xc42d('0x60')][_0xc42d('0x5b')]({'where':{'name':_0xe19b48,'userProfileId':_0x38b5bf[_0xc42d('0x61')]},'raw':!![]})[_0xc42d('0x39')](function(_0x8df06f){if(_0x8df06f&&_0x8df06f[_0xc42d('0x62')]===0x0){return db[_0xc42d('0x63')][_0xc42d('0x5c')]({'name':_0x205ca1['name'],'resourceId':_0x205ca1['id'],'type':_0x8df06f[_0xc42d('0x3d')],'sectionId':_0x8df06f['id']},{})[_0xc42d('0x39')](function(){return _0xf82255;});}else{return _0xf82255;}})['catch'](function(_0xc0b247){logger[_0xc42d('0x26')](_0xc42d('0x64'),_0xc0b247);throw _0xc0b247;});}return _0xf82255;})[_0xc42d('0x39')](respondWithResult(_0x1dcb47,0xc9))['catch'](handleError(_0x1dcb47,null));};exports[_0xc42d('0x38')]=function(_0x16c66e,_0x4a64f0){if(_0x16c66e['body']['id']){delete _0x16c66e[_0xc42d('0x5d')]['id'];}return db[_0xc42d('0x43')][_0xc42d('0x5b')]({'where':{'id':_0x16c66e['params']['id']},'include':[{'model':db[_0xc42d('0x40')],'as':_0xc42d('0x41')}]})[_0xc42d('0x39')](handleEntityNotFound(_0x4a64f0,null))[_0xc42d('0x39')](saveUpdates(_0x16c66e[_0xc42d('0x5d')],null))[_0xc42d('0x39')](respondWithResult(_0x4a64f0,null))['catch'](handleError(_0x4a64f0,null));};exports[_0xc42d('0x3a')]=function(_0x1ab786,_0x3f0443){return db[_0xc42d('0x43')]['find']({'where':{'id':_0x1ab786[_0xc42d('0x65')]['id']}})['then'](handleEntityNotFound(_0x3f0443,null))[_0xc42d('0x39')](removeEntity(_0x3f0443,null))[_0xc42d('0x2a')](handleError(_0x3f0443,null));};exports[_0xc42d('0x66')]=function(_0xfbb108,_0x4fa19c){return db[_0xc42d('0x43')][_0xc42d('0x66')]()[_0xc42d('0x39')](respondWithResult(_0x4fa19c,null))['catch'](handleError(_0x4fa19c,null));};exports[_0xc42d('0x67')]=function(_0x1fd464,_0xd8178e,_0x1f8e15){if(_0x1fd464['body']['id']){delete _0x1fd464[_0xc42d('0x5d')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1fd464[_0xc42d('0x65')]['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0xd8178e,null))[_0xc42d('0x39')](function(_0x1e3a84){if(_0x1e3a84){_0x1fd464[_0xc42d('0x5d')][_0xc42d('0x68')]=_0x1e3a84['id'];return db[_0xc42d('0x69')][_0xc42d('0x5c')](_0x1fd464[_0xc42d('0x5d')]);}})['then'](respondWithResult(_0xd8178e,null))[_0xc42d('0x2a')](handleError(_0xd8178e,null));};exports['getDispositions']=function(_0x1d7f0c,_0x93481c,_0x41cd6a){var _0x568818={'raw':![],'where':{}};var _0x3da72e={};var _0x339611={'count':0x0,'rows':[]};return db[_0xc42d('0x43')][_0xc42d('0x6a')]({'where':{'id':_0x1d7f0c[_0xc42d('0x65')]['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0x93481c,null))[_0xc42d('0x39')](function(_0x5c35da){if(_0x5c35da){_0x3da72e[_0xc42d('0x47')]=_['keys'](db[_0xc42d('0x69')][_0xc42d('0x44')]);_0x3da72e[_0xc42d('0x48')]=_[_0xc42d('0x59')](_0x1d7f0c[_0xc42d('0x48')]);_0x3da72e[_0xc42d('0x51')]=_[_0xc42d('0x5a')](_0x3da72e['model'],_0x3da72e[_0xc42d('0x48')]);_0x568818['attributes']=_[_0xc42d('0x5a')](_0x3da72e[_0xc42d('0x47')],qs[_0xc42d('0x4a')](_0x1d7f0c[_0xc42d('0x48')][_0xc42d('0x4a')]));_0x568818[_0xc42d('0x49')]=_0x568818['attributes'][_0xc42d('0x4b')]?_0x568818[_0xc42d('0x49')]:_0x3da72e[_0xc42d('0x47')];if(!_0x1d7f0c[_0xc42d('0x48')][_0xc42d('0x4c')](_0xc42d('0x4d'))){_0x568818[_0xc42d('0x2f')]=qs['limit'](_0x1d7f0c[_0xc42d('0x48')][_0xc42d('0x2f')]);_0x568818[_0xc42d('0x2d')]=qs[_0xc42d('0x2d')](_0x1d7f0c['query']['offset']);}_0x568818[_0xc42d('0x4e')]=qs[_0xc42d('0x4f')](_0x1d7f0c[_0xc42d('0x48')]['sort']);_0x568818[_0xc42d('0x50')]=qs['filters'](_['pick'](_0x1d7f0c[_0xc42d('0x48')],_0x3da72e['filters']));_0x568818[_0xc42d('0x50')][_0xc42d('0x68')]=_0x5c35da['id'];if(_0x1d7f0c[_0xc42d('0x48')]['filter']){_0x568818[_0xc42d('0x50')]=_[_0xc42d('0x6b')](_0x568818[_0xc42d('0x50')],{'$or':_[_0xc42d('0x42')](_0x568818[_0xc42d('0x49')],function(_0x19ccb7){var _0x1ba49a={};_0x1ba49a[_0x19ccb7]={'$like':'%'+_0x1d7f0c['query'][_0xc42d('0x53')]+'%'};return _0x1ba49a;})});}_0x568818=_[_0xc42d('0x6b')]({},_0x568818,_0x1d7f0c[_0xc42d('0x55')]);return db[_0xc42d('0x69')]['count']({'where':_0x568818['where']})[_0xc42d('0x39')](function(_0x5d7416){_0x339611[_0xc42d('0x30')]=_0x5d7416;if(_0x1d7f0c['query'][_0xc42d('0x6c')]){_0x568818['include']=[{'all':!![]}];}return db['Disposition'][_0xc42d('0x57')](_0x568818);})[_0xc42d('0x39')](function(_0x1a061b){_0x339611[_0xc42d('0x6d')]=_0x1a061b;return _0x339611;});}})[_0xc42d('0x39')](respondWithFilteredResult(_0x93481c,_0x568818))[_0xc42d('0x2a')](handleError(_0x93481c,null));};exports[_0xc42d('0x6e')]=function(_0x49c8c0,_0x6ca98c,_0x3d9761){return db['WhatsappAccount'][_0xc42d('0x5b')]({'where':{'id':_0x49c8c0[_0xc42d('0x65')]['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0x6ca98c,null))['then'](function(_0x10c118){if(_0x10c118){return _0x10c118[_0xc42d('0x6e')](_0x49c8c0[_0xc42d('0x48')][_0xc42d('0x6f')]);}})[_0xc42d('0x39')](respondWithStatusCode(_0x6ca98c,null))[_0xc42d('0x2a')](handleError(_0x6ca98c,null));};exports['addAnswer']=function(_0x5e6ab3,_0x35cacd,_0x4d8fdf){if(_0x5e6ab3['body']['id']){delete _0x5e6ab3[_0xc42d('0x5d')]['id'];}return db[_0xc42d('0x43')][_0xc42d('0x5b')]({'where':{'id':_0x5e6ab3[_0xc42d('0x65')]['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0x35cacd,null))[_0xc42d('0x39')](function(_0x502a48){if(_0x502a48){_0x5e6ab3[_0xc42d('0x5d')]['WhatsappAccountId']=_0x502a48['id'];return db[_0xc42d('0x70')][_0xc42d('0x5c')](_0x5e6ab3[_0xc42d('0x5d')]);}})['then'](respondWithResult(_0x35cacd,null))[_0xc42d('0x2a')](handleError(_0x35cacd,null));};exports[_0xc42d('0x71')]=function(_0x3d825d,_0x3ed4b4,_0x9c3ba1){var _0x1bec6f={'raw':![],'where':{}};var _0xed6051={};var _0x5b0639={'count':0x0,'rows':[]};return db[_0xc42d('0x43')][_0xc42d('0x6a')]({'where':{'id':_0x3d825d[_0xc42d('0x65')]['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0x3ed4b4,null))[_0xc42d('0x39')](function(_0x5b45bc){if(_0x5b45bc){_0xed6051['model']=_['keys'](db['CannedAnswer'][_0xc42d('0x44')]);_0xed6051[_0xc42d('0x48')]=_[_0xc42d('0x59')](_0x3d825d[_0xc42d('0x48')]);_0xed6051[_0xc42d('0x51')]=_[_0xc42d('0x5a')](_0xed6051[_0xc42d('0x47')],_0xed6051['query']);_0x1bec6f[_0xc42d('0x49')]=_[_0xc42d('0x5a')](_0xed6051[_0xc42d('0x47')],qs[_0xc42d('0x4a')](_0x3d825d['query']['fields']));_0x1bec6f[_0xc42d('0x49')]=_0x1bec6f[_0xc42d('0x49')][_0xc42d('0x4b')]?_0x1bec6f['attributes']:_0xed6051[_0xc42d('0x47')];if(!_0x3d825d[_0xc42d('0x48')][_0xc42d('0x4c')]('nolimit')){_0x1bec6f[_0xc42d('0x2f')]=qs[_0xc42d('0x2f')](_0x3d825d[_0xc42d('0x48')][_0xc42d('0x2f')]);_0x1bec6f[_0xc42d('0x2d')]=qs[_0xc42d('0x2d')](_0x3d825d['query'][_0xc42d('0x2d')]);}_0x1bec6f[_0xc42d('0x4e')]=qs[_0xc42d('0x4f')](_0x3d825d[_0xc42d('0x48')][_0xc42d('0x4f')]);_0x1bec6f[_0xc42d('0x50')]=qs[_0xc42d('0x51')](_[_0xc42d('0x52')](_0x3d825d['query'],_0xed6051[_0xc42d('0x51')]));_0x1bec6f[_0xc42d('0x50')][_0xc42d('0x68')]=_0x5b45bc['id'];if(_0x3d825d[_0xc42d('0x48')][_0xc42d('0x53')]){_0x1bec6f[_0xc42d('0x50')]=_['merge'](_0x1bec6f[_0xc42d('0x50')],{'$or':_[_0xc42d('0x42')](_0x1bec6f[_0xc42d('0x49')],function(_0x4ac9b3){var _0x327a44={};_0x327a44[_0x4ac9b3]={'$like':'%'+_0x3d825d[_0xc42d('0x48')][_0xc42d('0x53')]+'%'};return _0x327a44;})});}_0x1bec6f=_[_0xc42d('0x6b')]({},_0x1bec6f,_0x3d825d['options']);return db[_0xc42d('0x70')][_0xc42d('0x30')]({'where':_0x1bec6f['where']})[_0xc42d('0x39')](function(_0x449a2c){_0x5b0639[_0xc42d('0x30')]=_0x449a2c;if(_0x3d825d[_0xc42d('0x48')]['includeAll']){_0x1bec6f[_0xc42d('0x56')]=[{'all':!![]}];}return db[_0xc42d('0x70')][_0xc42d('0x57')](_0x1bec6f);})[_0xc42d('0x39')](function(_0x4514eb){_0x5b0639[_0xc42d('0x6d')]=_0x4514eb;return _0x5b0639;});}})['then'](respondWithFilteredResult(_0x3ed4b4,_0x1bec6f))[_0xc42d('0x2a')](handleError(_0x3ed4b4,null));};exports['removeAnswers']=function(_0x5e284f,_0x1426ec,_0x4f4316){return db['WhatsappAccount'][_0xc42d('0x5b')]({'where':{'id':_0x5e284f['params']['id']}})['then'](handleEntityNotFound(_0x1426ec,null))[_0xc42d('0x39')](function(_0x2c8f24){if(_0x2c8f24){return _0x2c8f24[_0xc42d('0x72')](_0x5e284f[_0xc42d('0x48')][_0xc42d('0x6f')]);}})['then'](respondWithStatusCode(_0x1426ec,null))[_0xc42d('0x2a')](handleError(_0x1426ec,null));};exports[_0xc42d('0x73')]=function(_0x368a11,_0x50fb1f,_0x43812b){return db[_0xc42d('0x43')][_0xc42d('0x5b')]({'where':{'id':_0x368a11[_0xc42d('0x65')]['id']}})['then'](handleEntityNotFound(_0x50fb1f,null))[_0xc42d('0x39')](function(_0x6dc280){if(_0x6dc280){return _0x6dc280[_0xc42d('0x73')](_0x368a11[_0xc42d('0x5d')][_0xc42d('0x6f')],_['omit'](_0x368a11['body'],[_0xc42d('0x6f'),'id'])||{})[_0xc42d('0x74')](function(_0x29d2b1){for(var _0xd08fe=0x0;_0xd08fe<_0x368a11['body'][_0xc42d('0x6f')][_0xc42d('0x4b')];_0xd08fe+=0x1){socket[_0xc42d('0x75')](_0xc42d('0x76'),{'UserId':Number(_0x368a11[_0xc42d('0x5d')][_0xc42d('0x6f')][_0xd08fe]),'WhatsappAccountId':Number(_0x368a11[_0xc42d('0x65')]['id'])});}return _0x29d2b1;});}})[_0xc42d('0x39')](respondWithResult(_0x50fb1f,null))['catch'](handleError(_0x50fb1f,null));};exports[_0xc42d('0x77')]=function(_0x3b839d,_0x4153fd,_0x39ac13){return db[_0xc42d('0x43')][_0xc42d('0x5b')]({'where':{'id':_0x3b839d[_0xc42d('0x65')]['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0x4153fd,null))[_0xc42d('0x39')](function(_0x1f84af){if(_0x1f84af){return _0x1f84af[_0xc42d('0x77')](_0x3b839d['query'][_0xc42d('0x6f')])[_0xc42d('0x39')](function(){if(_[_0xc42d('0x78')](_0x3b839d[_0xc42d('0x48')][_0xc42d('0x6f')])){for(var _0x165d03=0x0;_0x165d03<_0x3b839d[_0xc42d('0x48')][_0xc42d('0x6f')]['length'];_0x165d03+=0x1){socket[_0xc42d('0x75')](_0xc42d('0x79'),{'UserId':Number(_0x3b839d[_0xc42d('0x48')]['ids'][_0x165d03]),'WhatsappAccountId':Number(_0x3b839d[_0xc42d('0x65')]['id'])});}}else{socket['emit'](_0xc42d('0x79'),{'UserId':Number(_0x3b839d[_0xc42d('0x48')][_0xc42d('0x6f')]),'WhatsappAccountId':Number(_0x3b839d['params']['id'])});}});}})[_0xc42d('0x39')](respondWithStatusCode(_0x4153fd,null))['catch'](handleError(_0x4153fd,null));};exports[_0xc42d('0x7a')]=function(_0x5e2bbd,_0x4bcee5,_0x5d9f9f){var _0x2610e1={};var _0x1493b1={};var _0x31d69f;var _0x44d7fe;return db['WhatsappAccount']['findOne']({'where':{'id':_0x5e2bbd['params']['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0x4bcee5,null))[_0xc42d('0x39')](function(_0x4ea490){if(_0x4ea490){_0x31d69f=_0x4ea490;_0x1493b1['model']=_[_0xc42d('0x59')](db[_0xc42d('0x7b')][_0xc42d('0x44')]);_0x1493b1[_0xc42d('0x48')]=_[_0xc42d('0x59')](_0x5e2bbd['query']);_0x1493b1['filters']=_[_0xc42d('0x5a')](_0x1493b1[_0xc42d('0x47')],_0x1493b1[_0xc42d('0x48')]);_0x2610e1[_0xc42d('0x49')]=_[_0xc42d('0x5a')](_0x1493b1['model'],qs[_0xc42d('0x4a')](_0x5e2bbd[_0xc42d('0x48')]['fields']));_0x2610e1[_0xc42d('0x49')]=_0x2610e1[_0xc42d('0x49')][_0xc42d('0x4b')]?_0x2610e1[_0xc42d('0x49')]:_0x1493b1[_0xc42d('0x47')];_0x2610e1[_0xc42d('0x4e')]=qs[_0xc42d('0x4f')](_0x5e2bbd['query']['sort']);_0x2610e1[_0xc42d('0x50')]=qs[_0xc42d('0x51')](_[_0xc42d('0x52')](_0x5e2bbd[_0xc42d('0x48')],_0x1493b1[_0xc42d('0x51')]));if(_0x5e2bbd[_0xc42d('0x48')][_0xc42d('0x53')]){_0x2610e1['where']=_[_0xc42d('0x6b')](_0x2610e1[_0xc42d('0x50')],{'$or':_[_0xc42d('0x42')](_0x2610e1[_0xc42d('0x49')],function(_0x2f490a){var _0x3e9763={};_0x3e9763[_0x2f490a]={'$like':'%'+_0x5e2bbd[_0xc42d('0x48')][_0xc42d('0x53')]+'%'};return _0x3e9763;})});}_0x2610e1=_[_0xc42d('0x6b')]({},_0x2610e1,_0x5e2bbd[_0xc42d('0x55')]);return _0x31d69f['getAgents'](_0x2610e1);}})[_0xc42d('0x39')](function(_0xb1b7d6){if(_0xb1b7d6){_0x44d7fe=_0xb1b7d6[_0xc42d('0x4b')];if(!_0x5e2bbd[_0xc42d('0x48')][_0xc42d('0x4c')]('nolimit')){_0x2610e1[_0xc42d('0x2f')]=qs[_0xc42d('0x2f')](_0x5e2bbd[_0xc42d('0x48')]['limit']);_0x2610e1['offset']=qs[_0xc42d('0x2d')](_0x5e2bbd[_0xc42d('0x48')][_0xc42d('0x2d')]);}return _0x31d69f[_0xc42d('0x7a')](_0x2610e1);}})[_0xc42d('0x39')](function(_0x39229c){if(_0x39229c){return _0x39229c?{'count':_0x44d7fe,'rows':_0x39229c}:null;}})[_0xc42d('0x39')](respondWithResult(_0x4bcee5,null))['catch'](handleError(_0x4bcee5,null));};exports[_0xc42d('0x7c')]=function(_0x382f57,_0xd022dc){var _0x31200c=_0x382f57[_0xc42d('0x65')]['id'];var _0x5baabb=_0x382f57['body'];var _0x414915=0xc8;var _0x384c13=null;return db[_0xc42d('0x7d')][_0xc42d('0x7e')]({'isolationLevel':db[_0xc42d('0x7d')][_0xc42d('0x7f')][_0xc42d('0x80')]['READ_COMMITTED']},function(_0x150b2c){return db['WhatsappAccount'][_0xc42d('0x6a')]({'where':{'id':_0x31200c},'transaction':_0x150b2c})['then'](function(_0x308be4){if(_0x308be4){return db[_0xc42d('0x81')][_0xc42d('0x3a')]({'where':{'WhatsappAccountId':_0x31200c},'transaction':_0x150b2c})[_0xc42d('0x39')](function(){var _0x1e5e3d=_['map'](_0x5baabb,function(_0x48e5dc){_0x48e5dc[_0xc42d('0x68')]=_0x31200c;return _0x48e5dc;});return db[_0xc42d('0x81')][_0xc42d('0x82')](_0x1e5e3d,{'transaction':_0x150b2c});});}else{_0x414915=0x194;_0x384c13=[];}});})['then'](function(){if(_0x414915!==0x194){return db[_0xc42d('0x81')][_0xc42d('0x83')]({'where':{'WhatsappAccountId':_0x31200c},'order':_0xc42d('0x84')})[_0xc42d('0x39')](function(_0x480955){_0x384c13=_0x480955;});}})['catch'](function(_0xb31b35){_0x414915=0x1f4;logger['error'](_0xb31b35['stack']);if(_0xb31b35[_0xc42d('0x3d')]){delete _0xb31b35[_0xc42d('0x3d')];}_0x384c13=_0xb31b35;})[_0xc42d('0x85')](function(){if(_0x384c13===null){_0xd022dc[_0xc42d('0x2b')](_0x414915);}else{if(_0x414915===0x1f4){_0xd022dc[_0xc42d('0x31')](_0x414915)['send'](_0x384c13);}else{_0xd022dc[_0xc42d('0x31')](_0x414915)[_0xc42d('0x34')](_0x384c13);}}});};exports['getApplications']=function(_0x539f3f,_0x5df6d1,_0x23b0ca){var _0x4a1cf9={};var _0x55862e={};var _0x3213d1;var _0x32bb53;return db[_0xc42d('0x43')][_0xc42d('0x6a')]({'where':{'id':_0x539f3f['params']['id']}})[_0xc42d('0x39')](handleEntityNotFound(_0x5df6d1,null))[_0xc42d('0x39')](function(_0x3873d1){if(_0x3873d1){_0x3213d1=_0x3873d1;_0x55862e[_0xc42d('0x47')]=_[_0xc42d('0x59')](db['WhatsappApplication'][_0xc42d('0x44')]);_0x55862e['query']=_[_0xc42d('0x59')](_0x539f3f[_0xc42d('0x48')]);_0x55862e[_0xc42d('0x51')]=_[_0xc42d('0x5a')](_0x55862e[_0xc42d('0x47')],_0x55862e['query']);_0x4a1cf9['attributes']=_[_0xc42d('0x5a')](_0x55862e['model'],qs['fields'](_0x539f3f[_0xc42d('0x48')][_0xc42d('0x4a')]));_0x4a1cf9[_0xc42d('0x49')]=_0x4a1cf9['attributes'][_0xc42d('0x4b')]?_0x4a1cf9['attributes']:_0x55862e['model'];_0x4a1cf9['order']=qs[_0xc42d('0x4f')](_0x539f3f[_0xc42d('0x48')][_0xc42d('0x4f')]);_0x4a1cf9[_0xc42d('0x50')]=qs[_0xc42d('0x51')](_[_0xc42d('0x52')](_0x539f3f[_0xc42d('0x48')],_0x55862e[_0xc42d('0x51')]));if(_0x539f3f[_0xc42d('0x48')][_0xc42d('0x53')]){_0x4a1cf9[_0xc42d('0x50')]=_[_0xc42d('0x6b')](_0x4a1cf9['where'],{'$or':_[_0xc42d('0x42')](_0x4a1cf9[_0xc42d('0x49')],function(_0x26f00e){var _0x2f246c={};_0x2f246c[_0x26f00e]={'$like':'%'+_0x539f3f['query']['filter']+'%'};return _0x2f246c;})});}_0x4a1cf9=_[_0xc42d('0x6b')]({},_0x4a1cf9,_0x539f3f[_0xc42d('0x55')]);return _0x3213d1[_0xc42d('0x86')](_0x4a1cf9);}})[_0xc42d('0x39')](function(_0x313b72){if(_0x313b72){_0x32bb53=_0x313b72[_0xc42d('0x4b')];if(!_0x539f3f['query'][_0xc42d('0x4c')](_0xc42d('0x4d'))){_0x4a1cf9[_0xc42d('0x2f')]=qs[_0xc42d('0x2f')](_0x539f3f[_0xc42d('0x48')][_0xc42d('0x2f')]);_0x4a1cf9[_0xc42d('0x2d')]=qs[_0xc42d('0x2d')](_0x539f3f[_0xc42d('0x48')][_0xc42d('0x2d')]);}return _0x3213d1[_0xc42d('0x86')](_0x4a1cf9);}})['then'](function(_0x2365f7){if(_0x2365f7){return _0x2365f7?{'count':_0x32bb53,'rows':_0x2365f7}:null;}})[_0xc42d('0x39')](respondWithResult(_0x5df6d1,null))['catch'](handleError(_0x5df6d1,null));};exports[_0xc42d('0x87')]=function(_0x3f49a2,_0x1d8836,_0x193c1d){var _0x181849={'channel':_0xc42d('0x88')};var _0x293eca=[];var _0x229c76=[];var _0x3c4d60={};return db[_0xc42d('0x43')][_0xc42d('0x5b')]({'where':{'id':_0x3f49a2[_0xc42d('0x65')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xc42d('0x89')}]})[_0xc42d('0x39')](handleEntityNotFound(_0x1d8836,null))['then'](function(_0x49db16){_0x181849[_0xc42d('0x8a')]=_0x49db16;if(_0x181849[_0xc42d('0x8a')]&&_0x181849[_0xc42d('0x8a')][_0xc42d('0x45')]===_0xc42d('0x8b')&&_0x3f49a2[_0xc42d('0x5d')]['statuses']){if(_0x3f49a2[_0xc42d('0x5d')]['statuses'][_0xc42d('0x4b')]===0x0)return;if(_0x3f49a2[_0xc42d('0x5d')][_0xc42d('0x8c')][0x0][_0xc42d('0x8d')]!==_0xc42d('0x8e'))return;return db['WhatsappMessage'][_0xc42d('0x38')]({'read':!![],'readAt':_0x3f49a2[_0xc42d('0x5d')][_0xc42d('0x8c')][0x0][_0xc42d('0x8f')]},{'where':{'messageId':_0x3f49a2[_0xc42d('0x5d')]['statuses'][0x0][_0xc42d('0x90')]},'individualHooks':!![]})[_0xc42d('0x39')](function(_0x58f020){return _0x1d8836['status'](0xc8)[_0xc42d('0x34')](_0x58f020);});}_0x181849[_0xc42d('0x91')]=_['orderBy'](_0x49db16[_0xc42d('0x89')],[_0xc42d('0x84')],[_0xc42d('0x92')]);if(_0x181849[_0xc42d('0x8a')][_0xc42d('0x89')]){delete _0x181849[_0xc42d('0x8a')][_0xc42d('0x89')];}return db[_0xc42d('0x93')][_0xc42d('0x66')]()[_0xc42d('0x39')](function(_0x56a35e){if(!_0x56a35e){throw new db[(_0xc42d('0x94'))][(_0xc42d('0x95'))](_0xc42d('0x96'));}_0x293eca=_[_0xc42d('0x97')](_[_0xc42d('0x59')](_0x56a35e),['createdAt',_0xc42d('0x98')]);_0x229c76=_[_0xc42d('0x97')](_[_0xc42d('0x59')](_0x56a35e),[_0xc42d('0x99'),_0xc42d('0x98'),_0xc42d('0x9a'),_0xc42d('0x9b')]);_0x181849[_0xc42d('0x5d')]={'mapKey':_0xc42d('0x9c')};if(_0x181849['account']&&_0x181849[_0xc42d('0x8a')][_0xc42d('0x45')]===_0xc42d('0x9d')){_0x181849['body'][_0xc42d('0x9e')]=_0x3f49a2[_0xc42d('0x5d')]['From'][_0xc42d('0x9f')](_0xc42d('0xa0'),'');_0x181849[_0xc42d('0x5d')]['body']=_0x3f49a2['body']['Body'];_0x181849[_0xc42d('0x5d')][_0xc42d('0xa1')]=_0x3f49a2[_0xc42d('0x5d')]['MessageSid'];}if(_0x181849[_0xc42d('0x8a')]&&_0x181849[_0xc42d('0x8a')][_0xc42d('0x45')]===_0xc42d('0x8b')){_0x181849[_0xc42d('0x5d')][_0xc42d('0x9e')]=_0x3f49a2[_0xc42d('0x5d')][_0xc42d('0xa2')][0x0][_0xc42d('0x9e')];_0x181849[_0xc42d('0x5d')][_0xc42d('0x5d')]=_0x3f49a2['body'][_0xc42d('0xa2')][0x0][_0xc42d('0x28')][_0xc42d('0x5d')];_0x181849['body'][_0xc42d('0xa1')]=_0x3f49a2['body'][_0xc42d('0xa2')][0x0][_0xc42d('0x90')];}if(_0x181849[_0xc42d('0x5d')]['id']){delete _0x181849[_0xc42d('0x5d')]['id'];}if(_[_0xc42d('0xa3')](_0x181849[_0xc42d('0x5d')][_0xc42d('0x9e')])){throw new db[(_0xc42d('0x94'))][(_0xc42d('0x95'))](_0xc42d('0xa4'));}if(_[_0xc42d('0xa3')](_0x181849[_0xc42d('0x5d')][_0xc42d('0x5d')])||_0x181849[_0xc42d('0x5d')][_0xc42d('0x5d')]===''){throw new db[(_0xc42d('0x94'))][(_0xc42d('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc42d('0xa3')](_0x181849['body'][_0xc42d('0xa5')])){throw new db[(_0xc42d('0x94'))]['ValidationError'](_0xc42d('0xa6')+_0x229c76);}if(!_[_0xc42d('0xa7')](_0x229c76,_0x181849[_0xc42d('0x5d')][_0xc42d('0xa5')])){throw new db[(_0xc42d('0x94'))][(_0xc42d('0x95'))](_0xc42d('0xa8')+_0x229c76);}_0x3c4d60[_0x181849['body'][_0xc42d('0xa5')]]=_0x181849[_0xc42d('0x5d')][_0xc42d('0x9e')];return db[_0xc42d('0xa9')][_0xc42d('0x5b')]({'where':{'id':_0x181849[_0xc42d('0x8a')][_0xc42d('0x9b')]},'include':[{'model':db[_0xc42d('0x93')],'as':_0xc42d('0xaa'),'where':_0x3c4d60,'limit':0x1,'order':[['updatedAt',_0xc42d('0xab')]]}]});})['then'](handleEntityNotFound(_0x1d8836,null))[_0xc42d('0x39')](function(_0x335dfd){if(_0x335dfd){_0x181849[_0xc42d('0xac')]=_[_0xc42d('0xad')](_0x335dfd,[_0xc42d('0xaa')]);if(_0x335dfd['Contacts'][_0xc42d('0x4b')]){return _0x335dfd[_0xc42d('0xaa')][0x0];}var _0x550d96=_[_0xc42d('0x1b')](_0x181849[_0xc42d('0x5d')],{'firstName':_0x181849[_0xc42d('0x5d')][_0xc42d('0x9e')],'ListId':_0x335dfd['id']});_0x550d96[_0x181849['body'][_0xc42d('0xa5')]]=_0x181849[_0xc42d('0x5d')][_0xc42d('0x9e')];return db[_0xc42d('0x93')]['create'](_0x550d96,{'fields':_0x293eca,'raw':!![]});}})[_0xc42d('0x39')](handleEntityNotFound(_0x1d8836,null))[_0xc42d('0x39')](function(_0xa026e9){if(_0xa026e9){_0x181849[_0xc42d('0xae')]=_0xa026e9;var _0x507e80={'ContactId':_0xa026e9['id'],'phone':_0x181849[_0xc42d('0x5d')]['from'],'WhatsappAccountId':_0x3f49a2['params']['id']};var _0x2b358d={'ContactId':_0xa026e9['id'],'WhatsappAccountId':_0x3f49a2[_0xc42d('0x65')]['id'],'closed':![]};return db[_0xc42d('0xaf')][_0xc42d('0x5b')]({'where':_0x2b358d})[_0xc42d('0x39')](function(_0x12d492){if(_0x12d492){return[_0x12d492,![]];}return db['WhatsappInteraction']['create'](_0x507e80)[_0xc42d('0x39')](function(_0xe11c9){return[_0xe11c9,!![]];});});}})['spread'](function(_0x206888,_0x456edf){_0x181849[_0xc42d('0xb0')]=_0x206888[_0xc42d('0x3b')]({'plain':!![]});_0x181849[_0xc42d('0xb0')][_0xc42d('0xb1')]=![];if(_0x456edf){if(_0x181849[_0xc42d('0x8a')]['autoclose']){_0x181849[_0xc42d('0x91')][_0xc42d('0xb2')]({'id':0x0,'priority':_0x181849[_0xc42d('0x91')][_0xc42d('0x4b')]+0x1,'app':_0xc42d('0xb3'),'appdata':_0xc42d('0xb4'),'interval':_0xc42d('0xb5')});}_0x181849[_0xc42d('0xb0')]['created']=!![];}return db[_0xc42d('0xb6')][_0xc42d('0x5c')]({'phone':_0x181849[_0xc42d('0x5d')]['from'],'messageId':_0x181849[_0xc42d('0x5d')][_0xc42d('0xa1')],'body':_0x181849[_0xc42d('0x5d')][_0xc42d('0x5d')],'WhatsappAccountId':_0x3f49a2[_0xc42d('0x65')]['id'],'WhatsappInteractionId':_0x206888['id'],'direction':'in','ContactId':_0x206888[_0xc42d('0xb7')],'AttachmentId':_0x181849[_0xc42d('0x5d')]['AttachmentId']});})[_0xc42d('0x39')](function(_0x2ee8ed){_0x181849[_0xc42d('0x28')]=_0x2ee8ed;if(!_0x181849[_0xc42d('0xb0')][_0xc42d('0xb8')])return;return db[_0xc42d('0x7b')]['find']({'attributes':['id',_0xc42d('0x3d')],'where':{'id':_0x181849[_0xc42d('0xb0')][_0xc42d('0xb8')]}});})[_0xc42d('0x39')](function(_0x5c806d){if(_0x5c806d){_0x181849[_0xc42d('0x91')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc42d('0xb9'),'appdata':_0x5c806d[_0xc42d('0x3d')]+','+(_0x181849[_0xc42d('0x8a')][_0xc42d('0xba')]||0xa),'interval':'*,*,*,*'});}if(!_0x181849[_0xc42d('0xb0')]['queueId'])return;return db['WhatsappQueue'][_0xc42d('0x5b')]({'attributes':['id',_0xc42d('0x3d')],'where':{'id':_0x181849[_0xc42d('0xb0')][_0xc42d('0xbb')]}});})[_0xc42d('0x39')](function(_0x6b6602){if(_0x6b6602){_0x181849[_0xc42d('0x91')][_0xc42d('0xbc')]({'id':0x0,'priority':0x1,'app':_0xc42d('0xbd'),'appdata':_0x6b6602[_0xc42d('0x3d')]+','+(_0x181849[_0xc42d('0x8a')][_0xc42d('0xbe')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc42d('0xbf'),_0xc42d('0xc0'),_0x181849);})[_0xc42d('0x39')](function(_0x2acded){if(_0x2acded){var _0x2b63b6=0xc8;var _0x2a3b5c=_0xc42d('0xc1');logger[_0xc42d('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2a3b5c,_0x2b63b6,_0xc42d('0xc2'));logger[_0xc42d('0xc3')](_0xc42d('0xc4'),_0x2a3b5c,_0x2b63b6,_0xc42d('0xc2'),JSON[_0xc42d('0x25')](_0x2acded));if(_0x181849[_0xc42d('0x8a')][_0xc42d('0x45')]===_0xc42d('0x9d')){return _0x1d8836[_0xc42d('0x31')](_0x2b63b6)[_0xc42d('0x32')](_0xc42d('0xc5'),_0xc42d('0xc6'))[_0xc42d('0x3e')](_0xc42d('0xc7'));}else{return _0x1d8836['status'](_0x2b63b6)['json'](_0x2acded);}}});})[_0xc42d('0x2a')](handleError(_0x1d8836,null));};exports['send']=function(_0x2add6f,_0x295fbc,_0x32af8e){var _0x447f51,_0x4c030c,_0x54a6d7;if(_['isNil'](_0x2add6f[_0xc42d('0x5d')][_0xc42d('0x5d')])||_0x2add6f[_0xc42d('0x5d')][_0xc42d('0x5d')]===''){throw new db[(_0xc42d('0x94'))][(_0xc42d('0x95'))](_0xc42d('0xc8'));}if(_[_0xc42d('0xa3')](_0x2add6f[_0xc42d('0x5d')]['to'])){throw new db['Sequelize']['ValidationError'](_0xc42d('0xc9'));}_0x447f51=_0x2add6f['body']['to'];return db[_0xc42d('0x43')][_0xc42d('0x5b')]({'where':{'id':_0x2add6f[_0xc42d('0x65')]['id']},'include':[{'model':db[_0xc42d('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc42d('0xaa'),'where':{'mobile':_0x447f51},'limit':0x1,'order':[[_0xc42d('0x98'),_0xc42d('0xab')]]}]}]})[_0xc42d('0x39')](handleEntityNotFound(_0x295fbc,null))[_0xc42d('0x39')](function(_0x3f84fe){if(_0x3f84fe&&_0x3f84fe['List']){_0x4c030c=_0x3f84fe[_0xc42d('0x3b')]({'plain':!![]});if(_0x4c030c[_0xc42d('0xca')]&&_0x4c030c[_0xc42d('0xca')][_0xc42d('0xaa')][_0xc42d('0x4b')]){return _0x4c030c[_0xc42d('0xca')][_0xc42d('0xaa')][0x0];}return db[_0xc42d('0x93')][_0xc42d('0x5c')](_['defaults'](_0x2add6f[_0xc42d('0x5d')],{'firstName':_0x447f51,'mobile':_0x447f51,'phone':_0x447f51,'ListId':_0x4c030c['ListId']}));}})[_0xc42d('0x39')](handleEntityNotFound(_0x295fbc,null))[_0xc42d('0x39')](function(_0x23c160){if(_0x23c160){_0x54a6d7=_0x23c160;return db[_0xc42d('0xaf')][_0xc42d('0x5b')]({'where':{'ContactId':_0x54a6d7['id'],'closed':![],'WhatsappAccountId':_0x4c030c['id']}})[_0xc42d('0x39')](function(_0x151298){if(_0x151298){return[_0x151298,![]];}return db[_0xc42d('0xaf')]['create']({'UserId':_0x2add6f[_0xc42d('0xcb')]['id'],'ContactId':_0x54a6d7['id'],'WhatsappAccountId':_0x4c030c['id'],'phone':_0x447f51,'firstMsgDirection':_0xc42d('0xcc'),'Messages':[_[_0xc42d('0x6b')](_0x2add6f[_0xc42d('0x5d')],{'read':![],'body':_0x2add6f[_0xc42d('0x5d')][_0xc42d('0x5d')],'phone':_0x447f51,'WhatsappAccountId':_0x4c030c['id'],'UserId':_0x2add6f[_0xc42d('0xcb')]['id'],'ContactId':_0x54a6d7['id']})]},{'include':[{'model':db[_0xc42d('0xb6')],'as':_0xc42d('0xcd')}]})[_0xc42d('0x39')](function(_0x43fd04){return[_0x43fd04,!![]];});});}})[_0xc42d('0x74')](function(_0x2be7c8,_0x3b23b1){if(_0x3b23b1){return _0x2be7c8;}return db[_0xc42d('0xb6')][_0xc42d('0x5c')](_['merge'](_0x2add6f[_0xc42d('0x5d')],{'read':![],'body':_0x2add6f[_0xc42d('0x5d')]['body'],'phone':_0x447f51,'WhatsappAccountId':_0x4c030c['id'],'WhatsappInteractionId':_0x2be7c8['id'],'UserId':_0x2add6f[_0xc42d('0xcb')]['id'],'ContactId':_0x54a6d7['id']}))[_0xc42d('0x39')](function(_0x113d10){_0x2be7c8[_0xc42d('0xce')][_0xc42d('0xcd')]=[];_0x2be7c8[_0xc42d('0xce')][_0xc42d('0xcd')][_0xc42d('0xb2')](_0x113d10[_0xc42d('0xce')]);return _0x2be7c8;});})['then'](respondWithResult(_0x295fbc,null))['catch'](handleError(_0x295fbc,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 626d030..aaeb3b4 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 _0xd821=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x195654,_0x1252db){var _0x5b0eba=function(_0x7422c5){while(--_0x7422c5){_0x195654['push'](_0x195654['shift']());}};_0x5b0eba(++_0x1252db);}(_0xd821,0x168));var _0x1d82=function(_0xd7f9f3,_0x11b2c9){_0xd7f9f3=_0xd7f9f3-0x0;var _0x254d5b=_0xd821[_0xd7f9f3];return _0x254d5b;};'use strict';var EventEmitter=require(_0x1d82('0x0'));var WhatsappAccount=require(_0x1d82('0x1'))['db'][_0x1d82('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1d82('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1d82('0x4'),'afterDestroy':_0x1d82('0x5')};function emitEvent(_0x4c1de6){return function(_0x21f87a,_0x388fe3,_0x2228db){WhatsappAccountEvents[_0x1d82('0x6')](_0x4c1de6+':'+_0x21f87a['id'],_0x21f87a);WhatsappAccountEvents[_0x1d82('0x6')](_0x4c1de6,_0x21f87a);_0x2228db(null);};}for(var e in events){if(events[_0x1d82('0x7')](e)){var event=events[e];WhatsappAccount[_0x1d82('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x7245=['emit','hasOwnProperty','hook','events','../../mysqldb','update','remove'];(function(_0x82a0bf,_0x57b0ec){var _0x505859=function(_0x34799f){while(--_0x34799f){_0x82a0bf['push'](_0x82a0bf['shift']());}};_0x505859(++_0x57b0ec);}(_0x7245,0x106));var _0x5724=function(_0x3645f1,_0x346420){_0x3645f1=_0x3645f1-0x0;var _0x131b69=_0x7245[_0x3645f1];return _0x131b69;};'use strict';var EventEmitter=require(_0x5724('0x0'));var WhatsappAccount=require(_0x5724('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5724('0x2'),'afterDestroy':_0x5724('0x3')};function emitEvent(_0x278309){return function(_0x11015c,_0x57972d,_0x5d696f){WhatsappAccountEvents[_0x5724('0x4')](_0x278309+':'+_0x11015c['id'],_0x11015c);WhatsappAccountEvents['emit'](_0x278309,_0x11015c);_0x5d696f(null);};}for(var e in events){if(events[_0x5724('0x5')](e)){var event=events[e];WhatsappAccount[_0x5724('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 44b3c55..553d302 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 _0x63f1=['WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x1ddb9b,_0x3b4467){var _0x3c4ad4=function(_0xedb5a2){while(--_0xedb5a2){_0x1ddb9b['push'](_0x1ddb9b['shift']());}};_0x3c4ad4(++_0x3b4467);}(_0x63f1,0xf9));var _0x163f=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x63f1[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x163f('0x0'));var util=require(_0x163f('0x1'));var logger=require('../../config/logger')(_0x163f('0x2'));var moment=require(_0x163f('0x3'));var BPromise=require(_0x163f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x163f('0x5'));var rimraf=require(_0x163f('0x6'));var config=require(_0x163f('0x7'));var attributes=require(_0x163f('0x8'));module[_0x163f('0x9')]=function(_0x111a4d,_0xba2299){return _0x111a4d[_0x163f('0xa')](_0x163f('0xb'),attributes,{'tableName':_0x163f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6971=['exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x14dbdd,_0x3a073c){var _0x4afd72=function(_0x30bd02){while(--_0x30bd02){_0x14dbdd['push'](_0x14dbdd['shift']());}};_0x4afd72(++_0x3a073c);}(_0x6971,0x10c));var _0x1697=function(_0x206f86,_0x279fcc){_0x206f86=_0x206f86-0x0;var _0x46bbf4=_0x6971[_0x206f86];return _0x46bbf4;};'use strict';var _=require('lodash');var util=require(_0x1697('0x0'));var logger=require(_0x1697('0x1'))(_0x1697('0x2'));var moment=require('moment');var BPromise=require(_0x1697('0x3'));var rp=require(_0x1697('0x4'));var fs=require('fs');var path=require(_0x1697('0x5'));var rimraf=require('rimraf');var config=require(_0x1697('0x6'));var attributes=require(_0x1697('0x7'));module[_0x1697('0x8')]=function(_0x126c16,_0x421370){return _0x126c16[_0x1697('0x9')](_0x1697('0xa'),attributes,{'tableName':_0x1697('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 6c38458..07ceb80 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 _0x4ab3=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowWhatsappAccount','raw','options','where','include','model','attributes','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x4ab3,0x164));var _0x34ab=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x4ab3[_0x27dba4];return _0x35ec9d;};'use strict';var _=require('lodash');var util=require(_0x34ab('0x0'));var moment=require(_0x34ab('0x1'));var BPromise=require(_0x34ab('0x2'));var rs=require(_0x34ab('0x3'));var fs=require('fs');var Redis=require(_0x34ab('0x4'));var db=require(_0x34ab('0x5'))['db'];var utils=require(_0x34ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34ab('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x34ab('0x8')]=_[_0x34ab('0x9')](config['redis'],{'host':_0x34ab('0xa'),'port':0x18eb});var socket=require(_0x34ab('0xb'))(new Redis(config[_0x34ab('0x8')]));require(_0x34ab('0xc'))[_0x34ab('0xd')](socket);function respondWithRpcPromise(_0x188998,_0x3498db,_0x44a117){return new BPromise(function(_0x87d1ad,_0x104e92){return client[_0x34ab('0xe')](_0x188998,_0x44a117)[_0x34ab('0xf')](function(_0x4fabb2){logger['info'](_0x34ab('0x10'),_0x3498db,_0x34ab('0x11'));logger[_0x34ab('0x12')](_0x34ab('0x13'),_0x3498db,_0x34ab('0x11'),JSON[_0x34ab('0x14')](_0x4fabb2));if(_0x4fabb2[_0x34ab('0x15')]){if(_0x4fabb2[_0x34ab('0x15')][_0x34ab('0x16')]===0x1f4){logger[_0x34ab('0x15')](_0x34ab('0x10'),_0x3498db,_0x4fabb2[_0x34ab('0x15')][_0x34ab('0x17')]);return _0x104e92(_0x4fabb2['error'][_0x34ab('0x17')]);}logger['error'](_0x34ab('0x10'),_0x3498db,_0x4fabb2[_0x34ab('0x15')][_0x34ab('0x17')]);return _0x87d1ad(_0x4fabb2[_0x34ab('0x15')][_0x34ab('0x17')]);}else{logger[_0x34ab('0x18')](_0x34ab('0x10'),_0x3498db,_0x34ab('0x11'));_0x87d1ad(_0x4fabb2['result'][_0x34ab('0x17')]);}})[_0x34ab('0x19')](function(_0x431dc6){logger[_0x34ab('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x3498db,_0x431dc6);_0x104e92(_0x431dc6);});});}exports[_0x34ab('0x1a')]=function(_0x35222e){var _0x5a986d=this;return new Promise(function(_0x1278b0,_0x18ce85){return db['WhatsappAccount']['find']({'raw':_0x35222e['options']?_0x35222e['options'][_0x34ab('0x1b')]===undefined?!![]:![]:!![],'where':_0x35222e[_0x34ab('0x1c')]?_0x35222e['options'][_0x34ab('0x1d')]||null:null,'attributes':_0x35222e[_0x34ab('0x1c')]?_0x35222e[_0x34ab('0x1c')]['attributes']||null:null,'include':_0x35222e['options']?_0x35222e[_0x34ab('0x1c')][_0x34ab('0x1e')]?_['map'](_0x35222e[_0x34ab('0x1c')][_0x34ab('0x1e')],function(_0x2b0206){return{'model':db[_0x2b0206[_0x34ab('0x1f')]],'as':_0x2b0206['as'],'attributes':_0x2b0206[_0x34ab('0x20')],'include':_0x2b0206['include']?_[_0x34ab('0x21')](_0x2b0206[_0x34ab('0x1e')],function(_0x4a8ea3){return{'model':db[_0x4a8ea3['model']],'as':_0x4a8ea3['as'],'attributes':_0x4a8ea3['attributes'],'include':_0x4a8ea3[_0x34ab('0x1e')]?_[_0x34ab('0x21')](_0x4a8ea3[_0x34ab('0x1e')],function(_0x376923){return{'model':db[_0x376923[_0x34ab('0x1f')]],'as':_0x376923['as'],'attributes':_0x376923[_0x34ab('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3041b5){logger['info']('ShowWhatsappAccount',_0x35222e);logger[_0x34ab('0x12')]('ShowWhatsappAccount',_0x35222e,JSON[_0x34ab('0x14')](_0x3041b5));_0x1278b0(_0x3041b5);})[_0x34ab('0x19')](function(_0x2bf1e0){logger[_0x34ab('0x15')](_0x34ab('0x1a'),_0x2bf1e0[_0x34ab('0x17')],_0x35222e);_0x18ce85(_0x5a986d[_0x34ab('0x15')](0x1f4,_0x2bf1e0[_0x34ab('0x17')]));});});}; \ No newline at end of file +var _0x93a2=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','lodash','moment'];(function(_0x3722b3,_0x18a764){var _0x4614ae=function(_0x522c8e){while(--_0x522c8e){_0x3722b3['push'](_0x3722b3['shift']());}};_0x4614ae(++_0x18a764);}(_0x93a2,0x142));var _0x293a=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x93a2[_0x49d19d];return _0x4ebef1;};'use strict';var _=require(_0x293a('0x0'));var util=require('util');var moment=require(_0x293a('0x1'));var BPromise=require(_0x293a('0x2'));var rs=require(_0x293a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x293a('0x4'))['db'];var utils=require(_0x293a('0x5'));var logger=require(_0x293a('0x6'))(_0x293a('0x7'));var config=require(_0x293a('0x8'));var jayson=require(_0x293a('0x9'));var client=jayson['client'][_0x293a('0xa')]({'port':0x232a});config[_0x293a('0xb')]=_[_0x293a('0xc')](config[_0x293a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x293a('0xd'))(new Redis(config[_0x293a('0xb')]));require(_0x293a('0xe'))['register'](socket);function respondWithRpcPromise(_0x3cc016,_0x73d1c8,_0x51db32){return new BPromise(function(_0x80bd3d,_0x42b511){return client['request'](_0x3cc016,_0x51db32)[_0x293a('0xf')](function(_0x28c4e1){logger['info'](_0x293a('0x10'),_0x73d1c8,_0x293a('0x11'));logger[_0x293a('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x73d1c8,_0x293a('0x11'),JSON[_0x293a('0x13')](_0x28c4e1));if(_0x28c4e1[_0x293a('0x14')]){if(_0x28c4e1[_0x293a('0x14')][_0x293a('0x15')]===0x1f4){logger[_0x293a('0x14')](_0x293a('0x10'),_0x73d1c8,_0x28c4e1[_0x293a('0x14')][_0x293a('0x16')]);return _0x42b511(_0x28c4e1[_0x293a('0x14')]['message']);}logger[_0x293a('0x14')](_0x293a('0x10'),_0x73d1c8,_0x28c4e1['error'][_0x293a('0x16')]);return _0x80bd3d(_0x28c4e1['error']['message']);}else{logger[_0x293a('0x17')](_0x293a('0x10'),_0x73d1c8,_0x293a('0x11'));_0x80bd3d(_0x28c4e1[_0x293a('0x18')]['message']);}})[_0x293a('0x19')](function(_0x222edb){logger[_0x293a('0x14')](_0x293a('0x10'),_0x73d1c8,_0x222edb);_0x42b511(_0x222edb);});});}exports['ShowWhatsappAccount']=function(_0x4edc0e){var _0x52a089=this;return new Promise(function(_0x3ccae7,_0x38dc3f){return db[_0x293a('0x1a')][_0x293a('0x1b')]({'raw':_0x4edc0e[_0x293a('0x1c')]?_0x4edc0e[_0x293a('0x1c')][_0x293a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4edc0e[_0x293a('0x1c')]?_0x4edc0e[_0x293a('0x1c')][_0x293a('0x1e')]||null:null,'attributes':_0x4edc0e[_0x293a('0x1c')]?_0x4edc0e[_0x293a('0x1c')][_0x293a('0x1f')]||null:null,'include':_0x4edc0e[_0x293a('0x1c')]?_0x4edc0e['options']['include']?_['map'](_0x4edc0e[_0x293a('0x1c')][_0x293a('0x20')],function(_0x2ed651){return{'model':db[_0x2ed651[_0x293a('0x21')]],'as':_0x2ed651['as'],'attributes':_0x2ed651[_0x293a('0x1f')],'include':_0x2ed651[_0x293a('0x20')]?_[_0x293a('0x22')](_0x2ed651[_0x293a('0x20')],function(_0x1bf4f3){return{'model':db[_0x1bf4f3[_0x293a('0x21')]],'as':_0x1bf4f3['as'],'attributes':_0x1bf4f3[_0x293a('0x1f')],'include':_0x1bf4f3[_0x293a('0x20')]?_['map'](_0x1bf4f3[_0x293a('0x20')],function(_0x51b93d){return{'model':db[_0x51b93d['model']],'as':_0x51b93d['as'],'attributes':_0x51b93d[_0x293a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x293a('0xf')](function(_0x3ea50c){logger[_0x293a('0x17')]('ShowWhatsappAccount',_0x4edc0e);logger[_0x293a('0x12')](_0x293a('0x23'),_0x4edc0e,JSON[_0x293a('0x13')](_0x3ea50c));_0x3ccae7(_0x3ea50c);})[_0x293a('0x19')](function(_0x304e19){logger[_0x293a('0x14')](_0x293a('0x23'),_0x304e19[_0x293a('0x16')],_0x4edc0e);_0x38dc3f(_0x52a089['error'](0x1f4,_0x304e19[_0x293a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3440860..a978965 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 _0x6537=['./whatsappAccount.events','remove','register','length','whatsappAccount:'];(function(_0x3edb30,_0x24a66f){var _0x58fa12=function(_0x11a27a){while(--_0x11a27a){_0x3edb30['push'](_0x3edb30['shift']());}};_0x58fa12(++_0x24a66f);}(_0x6537,0xaa));var _0x7653=function(_0x1f1525,_0x270974){_0x1f1525=_0x1f1525-0x0;var _0x1a2171=_0x6537[_0x1f1525];return _0x1a2171;};'use strict';var WhatsappAccountEvents=require(_0x7653('0x0'));var events=['save',_0x7653('0x1'),'update'];function createListener(_0x3366ea,_0x45afc0){return function(_0x402e6e){_0x45afc0['emit'](_0x3366ea,_0x402e6e);};}function removeListener(_0xf372e4,_0x2f91b9){return function(){WhatsappAccountEvents['removeListener'](_0xf372e4,_0x2f91b9);};}exports[_0x7653('0x2')]=function(_0x1be1ab){for(var _0x1970fb=0x0,_0x41c7f2=events[_0x7653('0x3')];_0x1970fb<_0x41c7f2;_0x1970fb++){var _0x51f5c0=events[_0x1970fb];var _0xe2297f=createListener(_0x7653('0x4')+_0x51f5c0,_0x1be1ab);WhatsappAccountEvents['on'](_0x51f5c0,_0xe2297f);}}; \ No newline at end of file +var _0x63b9=['emit','removeListener','register','./whatsappAccount.events','update'];(function(_0x56ccd2,_0x1fbef1){var _0x341819=function(_0x5b0bc1){while(--_0x5b0bc1){_0x56ccd2['push'](_0x56ccd2['shift']());}};_0x341819(++_0x1fbef1);}(_0x63b9,0x15c));var _0x963b=function(_0x5e586a,_0xe70795){_0x5e586a=_0x5e586a-0x0;var _0x47568a=_0x63b9[_0x5e586a];return _0x47568a;};'use strict';var WhatsappAccountEvents=require(_0x963b('0x0'));var events=['save','remove',_0x963b('0x1')];function createListener(_0x9ae9a5,_0x5d8105){return function(_0x40be61){_0x5d8105[_0x963b('0x2')](_0x9ae9a5,_0x40be61);};}function removeListener(_0xc72d3a,_0x2dbe04){return function(){WhatsappAccountEvents[_0x963b('0x3')](_0xc72d3a,_0x2dbe04);};}exports[_0x963b('0x4')]=function(_0x3c9cf0){for(var _0x30455c=0x0,_0x553bb8=events['length'];_0x30455c<_0x553bb8;_0x30455c++){var _0x1364a1=events[_0x30455c];var _0x37c089=createListener('whatsappAccount:'+_0x1364a1,_0x3c9cf0);WhatsappAccountEvents['on'](_0x1364a1,_0x37c089);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c3594e9..41261dc 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 _0x5a87=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x17788d,_0x5802a2){var _0x36cc48=function(_0x19b053){while(--_0x19b053){_0x17788d['push'](_0x17788d['shift']());}};_0x36cc48(++_0x5802a2);}(_0x5a87,0x15a));var _0x75a8=function(_0x57eba4,_0x51131b){_0x57eba4=_0x57eba4-0x0;var _0xf50650=_0x5a87[_0x57eba4];return _0xf50650;};'use strict';var multer=require(_0x75a8('0x0'));var util=require(_0x75a8('0x1'));var path=require(_0x75a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x75a8('0x3'));var router=express['Router']();var fs_extra=require(_0x75a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75a8('0x5'));var config=require(_0x75a8('0x6'));var controller=require('./whatsappApplication.controller');router[_0x75a8('0x7')]('/',auth[_0x75a8('0x8')](),controller[_0x75a8('0x9')]);router[_0x75a8('0x7')](_0x75a8('0xa'),auth[_0x75a8('0x8')](),controller[_0x75a8('0xb')]);router[_0x75a8('0xc')]('/',auth[_0x75a8('0x8')](),controller[_0x75a8('0xd')]);router[_0x75a8('0xe')](_0x75a8('0xa'),auth[_0x75a8('0x8')](),controller[_0x75a8('0xf')]);router[_0x75a8('0x10')](_0x75a8('0xa'),auth[_0x75a8('0x8')](),controller[_0x75a8('0x11')]);module[_0x75a8('0x12')]=router; \ No newline at end of file +var _0xd9ad=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports'];(function(_0xab1b8d,_0x2ca1d7){var _0x446863=function(_0x1aebe9){while(--_0x1aebe9){_0xab1b8d['push'](_0xab1b8d['shift']());}};_0x446863(++_0x2ca1d7);}(_0xd9ad,0x10a));var _0xdd9a=function(_0x294288,_0x3005db){_0x294288=_0x294288-0x0;var _0x3b0156=_0xd9ad[_0x294288];return _0x3b0156;};'use strict';var multer=require('multer');var util=require(_0xdd9a('0x0'));var path=require(_0xdd9a('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd9a('0x2'));var router=express[_0xdd9a('0x3')]();var fs_extra=require(_0xdd9a('0x4'));var auth=require(_0xdd9a('0x5'));var interaction=require(_0xdd9a('0x6'));var config=require(_0xdd9a('0x7'));var controller=require(_0xdd9a('0x8'));router[_0xdd9a('0x9')]('/',auth[_0xdd9a('0xa')](),controller['index']);router[_0xdd9a('0x9')](_0xdd9a('0xb'),auth[_0xdd9a('0xa')](),controller[_0xdd9a('0xc')]);router[_0xdd9a('0xd')]('/',auth[_0xdd9a('0xa')](),controller[_0xdd9a('0xe')]);router[_0xdd9a('0xf')](_0xdd9a('0xb'),auth[_0xdd9a('0xa')](),controller['update']);router[_0xdd9a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdd9a('0x11')]);module[_0xdd9a('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 1b03c3b..32f3a5a 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 _0x3620=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x11fd58,_0x21fd24){var _0x187e39=function(_0x52596a){while(--_0x52596a){_0x11fd58['push'](_0x11fd58['shift']());}};_0x187e39(++_0x21fd24);}(_0x3620,0xc4));var _0x0362=function(_0x14b439,_0x1353e6){_0x14b439=_0x14b439-0x0;var _0x509d83=_0x3620[_0x14b439];return _0x509d83;};'use strict';var Sequelize=require(_0x0362('0x0'));module[_0x0362('0x1')]={'priority':{'type':Sequelize[_0x0362('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0362('0x3')],'allowNull':![],'defaultValue':_0x0362('0x4')},'appdata':{'type':Sequelize[_0x0362('0x5')]()},'description':{'type':Sequelize[_0x0362('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0362('0x6')}}; \ No newline at end of file +var _0xd46a=['sequelize','exports','TEXT','STRING','*,*,*,*'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0xd46a,0x1a9));var _0xad46=function(_0x4e6b76,_0x789fcf){_0x4e6b76=_0x4e6b76-0x0;var _0xc0ef98=_0xd46a[_0x4e6b76];return _0xc0ef98;};'use strict';var Sequelize=require(_0xad46('0x0'));module[_0xad46('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xad46('0x2')]()},'description':{'type':Sequelize[_0xad46('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xad46('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 8c22a41..9ab0916 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 _0xee55=['count','set','Content-Range','apply','reject','save','update','then','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined'];(function(_0x102900,_0x23d97e){var _0x4f6543=function(_0x2c73c5){while(--_0x2c73c5){_0x102900['push'](_0x102900['shift']());}};_0x4f6543(++_0x23d97e);}(_0xee55,0x1a0));var _0x5ee5=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xee55[_0x4409e7];return _0x24c751;};'use strict';var emlformat=require(_0x5ee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ee5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ee5('0x2'));var moment=require('moment');var BPromise=require(_0x5ee5('0x3'));var Mustache=require(_0x5ee5('0x4'));var util=require('util');var path=require(_0x5ee5('0x5'));var sox=require(_0x5ee5('0x6'));var csv=require(_0x5ee5('0x7'));var ejs=require(_0x5ee5('0x8'));var fs=require('fs');var fs_extra=require(_0x5ee5('0x9'));var _=require(_0x5ee5('0xa'));var squel=require(_0x5ee5('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ee5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ee5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ee5('0xe'));var qs=require(_0x5ee5('0xf'));var as=require(_0x5ee5('0x10'));var hardwareService=require(_0x5ee5('0x11'));var logger=require('../../config/logger')(_0x5ee5('0x12'));var utils=require(_0x5ee5('0x13'));var config=require(_0x5ee5('0x14'));var licenseUtil=require(_0x5ee5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a9abc,_0x38437c){_0x38437c=_0x38437c||0xcc;return function(_0x349c46){if(_0x349c46){return _0x4a9abc[_0x5ee5('0x16')](_0x38437c);}return _0x4a9abc['status'](_0x38437c)[_0x5ee5('0x17')]();};}function respondWithResult(_0x2cbfab,_0x1a5da4){_0x1a5da4=_0x1a5da4||0xc8;return function(_0x1cd19c){if(_0x1cd19c){return _0x2cbfab[_0x5ee5('0x18')](_0x1a5da4)[_0x5ee5('0x19')](_0x1cd19c);}};}function respondWithFilteredResult(_0x2ef66a,_0x5dd990){return function(_0x2773ab){if(_0x2773ab){var _0x184e53=typeof _0x5dd990[_0x5ee5('0x1a')]===_0x5ee5('0x1b')&&typeof _0x5dd990['limit']==='undefined';var _0x3bb1b5=_0x2773ab[_0x5ee5('0x1c')];var _0x173043=_0x184e53?0x0:_0x5dd990['offset'];var _0x1eafc3=_0x184e53?_0x2773ab['count']:_0x5dd990[_0x5ee5('0x1a')]+_0x5dd990['limit'];var _0x2c859a;if(_0x1eafc3>=_0x3bb1b5){_0x1eafc3=_0x3bb1b5;_0x2c859a=0xc8;}else{_0x2c859a=0xce;}_0x2ef66a[_0x5ee5('0x18')](_0x2c859a);return _0x2ef66a[_0x5ee5('0x1d')](_0x5ee5('0x1e'),_0x173043+'-'+_0x1eafc3+'/'+_0x3bb1b5)[_0x5ee5('0x19')](_0x2773ab);}return null;};}function patchUpdates(_0x24ce1b){return function(_0x46416a){try{jsonpatch[_0x5ee5('0x1f')](_0x46416a,_0x24ce1b,!![]);}catch(_0x45e278){return BPromise[_0x5ee5('0x20')](_0x45e278);}return _0x46416a[_0x5ee5('0x21')]();};}function saveUpdates(_0x72a60d,_0x3a15e2){return function(_0xb133d4){if(_0xb133d4){return _0xb133d4[_0x5ee5('0x22')](_0x72a60d)[_0x5ee5('0x23')](function(_0x3aa2d5){return _0x3aa2d5;});}return null;};}function removeEntity(_0x1e0f65,_0x1c2004){return function(_0x218f79){if(_0x218f79){return _0x218f79['destroy']()['then'](function(){_0x1e0f65[_0x5ee5('0x18')](0xcc)[_0x5ee5('0x17')]();});}};}function handleEntityNotFound(_0x6a7dca,_0x59c422){return function(_0x1df98d){if(!_0x1df98d){_0x6a7dca['sendStatus'](0x194);}return _0x1df98d;};}function handleError(_0x474d24,_0xbcc308){_0xbcc308=_0xbcc308||0x1f4;return function(_0x252da3){logger['error'](_0x252da3['stack']);if(_0x252da3[_0x5ee5('0x24')]){delete _0x252da3[_0x5ee5('0x24')];}_0x474d24[_0x5ee5('0x18')](_0xbcc308)[_0x5ee5('0x25')](_0x252da3);};}exports[_0x5ee5('0x26')]=function(_0x14254a,_0x334295){var _0x483c28={},_0x3d78a8={},_0x1947ae={'count':0x0,'rows':[]};var _0x422e71=_['map'](db[_0x5ee5('0x27')][_0x5ee5('0x28')],function(_0x2542da){return{'name':_0x2542da[_0x5ee5('0x29')],'type':_0x2542da[_0x5ee5('0x2a')][_0x5ee5('0x2b')]};});_0x3d78a8[_0x5ee5('0x2c')]=_[_0x5ee5('0x2d')](_0x422e71,'name');_0x3d78a8[_0x5ee5('0x2e')]=_['keys'](_0x14254a[_0x5ee5('0x2e')]);_0x3d78a8['filters']=_[_0x5ee5('0x2f')](_0x3d78a8[_0x5ee5('0x2c')],_0x3d78a8['query']);_0x483c28['attributes']=_[_0x5ee5('0x2f')](_0x3d78a8[_0x5ee5('0x2c')],qs[_0x5ee5('0x30')](_0x14254a[_0x5ee5('0x2e')]['fields']));_0x483c28[_0x5ee5('0x31')]=_0x483c28['attributes'][_0x5ee5('0x32')]?_0x483c28['attributes']:_0x3d78a8[_0x5ee5('0x2c')];if(!_0x14254a['query'][_0x5ee5('0x33')](_0x5ee5('0x34'))){_0x483c28[_0x5ee5('0x35')]=qs[_0x5ee5('0x35')](_0x14254a[_0x5ee5('0x2e')][_0x5ee5('0x35')]);_0x483c28[_0x5ee5('0x1a')]=qs['offset'](_0x14254a[_0x5ee5('0x2e')][_0x5ee5('0x1a')]);}_0x483c28[_0x5ee5('0x36')]=qs[_0x5ee5('0x37')](_0x14254a['query'][_0x5ee5('0x37')]);_0x483c28['where']=qs[_0x5ee5('0x38')](_[_0x5ee5('0x39')](_0x14254a['query'],_0x3d78a8[_0x5ee5('0x38')]),_0x422e71);if(_0x14254a['query'][_0x5ee5('0x3a')]){_0x483c28[_0x5ee5('0x3b')]=_[_0x5ee5('0x3c')](_0x483c28[_0x5ee5('0x3b')],{'$or':_[_0x5ee5('0x2d')](_0x422e71,function(_0xeab8e3){if(_0xeab8e3['type']!=='VIRTUAL'){var _0x11fad0={};_0x11fad0[_0xeab8e3['name']]={'$like':'%'+_0x14254a['query'][_0x5ee5('0x3a')]+'%'};return _0x11fad0;}})});}_0x483c28=_['merge']({},_0x483c28,_0x14254a[_0x5ee5('0x3d')]);var _0x36062b={'where':_0x483c28[_0x5ee5('0x3b')]};return db[_0x5ee5('0x27')]['count'](_0x36062b)['then'](function(_0xe5607e){_0x1947ae[_0x5ee5('0x1c')]=_0xe5607e;if(_0x14254a[_0x5ee5('0x2e')][_0x5ee5('0x3e')]){_0x483c28[_0x5ee5('0x3f')]=[{'all':!![]}];}return db[_0x5ee5('0x27')][_0x5ee5('0x40')](_0x483c28);})[_0x5ee5('0x23')](function(_0x1973e0){_0x1947ae[_0x5ee5('0x41')]=_0x1973e0;return _0x1947ae;})[_0x5ee5('0x23')](respondWithFilteredResult(_0x334295,_0x483c28))[_0x5ee5('0x42')](handleError(_0x334295,null));};exports[_0x5ee5('0x43')]=function(_0x5ed5f7,_0x21cbfb){var _0x199667={'raw':!![],'where':{'id':_0x5ed5f7[_0x5ee5('0x44')]['id']}},_0x5a5d3c={};_0x5a5d3c[_0x5ee5('0x2c')]=_['keys'](db['WhatsappApplication'][_0x5ee5('0x28')]);_0x5a5d3c[_0x5ee5('0x2e')]=_[_0x5ee5('0x45')](_0x5ed5f7[_0x5ee5('0x2e')]);_0x5a5d3c[_0x5ee5('0x38')]=_[_0x5ee5('0x2f')](_0x5a5d3c['model'],_0x5a5d3c[_0x5ee5('0x2e')]);_0x199667[_0x5ee5('0x31')]=_[_0x5ee5('0x2f')](_0x5a5d3c[_0x5ee5('0x2c')],qs[_0x5ee5('0x30')](_0x5ed5f7['query']['fields']));_0x199667[_0x5ee5('0x31')]=_0x199667['attributes'][_0x5ee5('0x32')]?_0x199667[_0x5ee5('0x31')]:_0x5a5d3c[_0x5ee5('0x2c')];if(_0x5ed5f7[_0x5ee5('0x2e')][_0x5ee5('0x3e')]){_0x199667[_0x5ee5('0x3f')]=[{'all':!![]}];}_0x199667=_[_0x5ee5('0x3c')]({},_0x199667,_0x5ed5f7[_0x5ee5('0x3d')]);return db['WhatsappApplication'][_0x5ee5('0x46')](_0x199667)[_0x5ee5('0x23')](handleEntityNotFound(_0x21cbfb,null))[_0x5ee5('0x23')](respondWithResult(_0x21cbfb,null))[_0x5ee5('0x42')](handleError(_0x21cbfb,null));};exports[_0x5ee5('0x47')]=function(_0x1373ba,_0x4b11d0){return db['WhatsappApplication']['create'](_0x1373ba[_0x5ee5('0x48')],{})[_0x5ee5('0x23')](respondWithResult(_0x4b11d0,0xc9))[_0x5ee5('0x42')](handleError(_0x4b11d0,null));};exports[_0x5ee5('0x22')]=function(_0x117086,_0x2b2c79){if(_0x117086['body']['id']){delete _0x117086[_0x5ee5('0x48')]['id'];}return db[_0x5ee5('0x27')]['find']({'where':{'id':_0x117086[_0x5ee5('0x44')]['id']}})[_0x5ee5('0x23')](handleEntityNotFound(_0x2b2c79,null))[_0x5ee5('0x23')](saveUpdates(_0x117086[_0x5ee5('0x48')],null))['then'](respondWithResult(_0x2b2c79,null))[_0x5ee5('0x42')](handleError(_0x2b2c79,null));};exports[_0x5ee5('0x49')]=function(_0x5586d3,_0x4ffd24){return db[_0x5ee5('0x27')][_0x5ee5('0x46')]({'where':{'id':_0x5586d3['params']['id']}})['then'](handleEntityNotFound(_0x4ffd24,null))[_0x5ee5('0x23')](removeEntity(_0x4ffd24,null))[_0x5ee5('0x42')](handleError(_0x4ffd24,null));}; \ No newline at end of file +var _0x38b8=['crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','catch','show','params','length','include','create','body','find','eml-format','zip-dir','fast-json-patch','moment','util','path','ejs','fs-extra','squel'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x838b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x838b('0x1'));var jsonpatch=require(_0x838b('0x2'));var rp=require('request-promise');var moment=require(_0x838b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x838b('0x4'));var path=require(_0x838b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x838b('0x6'));var fs=require('fs');var fs_extra=require(_0x838b('0x7'));var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0xa'));var querystring=require(_0x838b('0xb'));var Papa=require(_0x838b('0xc'));var Redis=require('ioredis');var authService=require(_0x838b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xe'));var hardwareService=require(_0x838b('0xf'));var logger=require(_0x838b('0x10'))(_0x838b('0x11'));var utils=require(_0x838b('0x12'));var config=require(_0x838b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x838b('0x14'))['db'];function respondWithStatusCode(_0x281764,_0x13fe8a){_0x13fe8a=_0x13fe8a||0xcc;return function(_0x144189){if(_0x144189){return _0x281764[_0x838b('0x15')](_0x13fe8a);}return _0x281764[_0x838b('0x16')](_0x13fe8a)[_0x838b('0x17')]();};}function respondWithResult(_0x3324de,_0x1ddf43){_0x1ddf43=_0x1ddf43||0xc8;return function(_0x525c60){if(_0x525c60){return _0x3324de[_0x838b('0x16')](_0x1ddf43)['json'](_0x525c60);}};}function respondWithFilteredResult(_0x4e1085,_0x584b04){return function(_0x450b9b){if(_0x450b9b){var _0x1da340=typeof _0x584b04[_0x838b('0x18')]===_0x838b('0x19')&&typeof _0x584b04[_0x838b('0x1a')]==='undefined';var _0x21aa1a=_0x450b9b[_0x838b('0x1b')];var _0x44a62c=_0x1da340?0x0:_0x584b04[_0x838b('0x18')];var _0x48c4ab=_0x1da340?_0x450b9b[_0x838b('0x1b')]:_0x584b04[_0x838b('0x18')]+_0x584b04['limit'];var _0x4c1251;if(_0x48c4ab>=_0x21aa1a){_0x48c4ab=_0x21aa1a;_0x4c1251=0xc8;}else{_0x4c1251=0xce;}_0x4e1085[_0x838b('0x16')](_0x4c1251);return _0x4e1085['set'](_0x838b('0x1c'),_0x44a62c+'-'+_0x48c4ab+'/'+_0x21aa1a)[_0x838b('0x1d')](_0x450b9b);}return null;};}function patchUpdates(_0x432a75){return function(_0x4deb91){try{jsonpatch[_0x838b('0x1e')](_0x4deb91,_0x432a75,!![]);}catch(_0x389a99){return BPromise[_0x838b('0x1f')](_0x389a99);}return _0x4deb91[_0x838b('0x20')]();};}function saveUpdates(_0x371082,_0x3f8848){return function(_0x11de0e){if(_0x11de0e){return _0x11de0e[_0x838b('0x21')](_0x371082)[_0x838b('0x22')](function(_0xd48f3b){return _0xd48f3b;});}return null;};}function removeEntity(_0x2eecf9,_0xba76){return function(_0x451089){if(_0x451089){return _0x451089[_0x838b('0x23')]()['then'](function(){_0x2eecf9[_0x838b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51adc6,_0x430400){return function(_0x2bc24c){if(!_0x2bc24c){_0x51adc6[_0x838b('0x15')](0x194);}return _0x2bc24c;};}function handleError(_0x5cec50,_0x302445){_0x302445=_0x302445||0x1f4;return function(_0x27f385){logger['error'](_0x27f385[_0x838b('0x24')]);if(_0x27f385[_0x838b('0x25')]){delete _0x27f385['name'];}_0x5cec50['status'](_0x302445)['send'](_0x27f385);};}exports['index']=function(_0x4f6179,_0x4b46bc){var _0x1e74a6={},_0x227876={},_0x5b66f6={'count':0x0,'rows':[]};var _0x5aeeca=_[_0x838b('0x26')](db[_0x838b('0x27')][_0x838b('0x28')],function(_0x29e161){return{'name':_0x29e161[_0x838b('0x29')],'type':_0x29e161[_0x838b('0x2a')][_0x838b('0x2b')]};});_0x227876[_0x838b('0x2c')]=_[_0x838b('0x26')](_0x5aeeca,'name');_0x227876[_0x838b('0x2d')]=_[_0x838b('0x2e')](_0x4f6179[_0x838b('0x2d')]);_0x227876[_0x838b('0x2f')]=_['intersection'](_0x227876[_0x838b('0x2c')],_0x227876[_0x838b('0x2d')]);_0x1e74a6[_0x838b('0x30')]=_[_0x838b('0x31')](_0x227876[_0x838b('0x2c')],qs['fields'](_0x4f6179[_0x838b('0x2d')][_0x838b('0x32')]));_0x1e74a6[_0x838b('0x30')]=_0x1e74a6[_0x838b('0x30')]['length']?_0x1e74a6[_0x838b('0x30')]:_0x227876[_0x838b('0x2c')];if(!_0x4f6179['query'][_0x838b('0x33')](_0x838b('0x34'))){_0x1e74a6[_0x838b('0x1a')]=qs[_0x838b('0x1a')](_0x4f6179[_0x838b('0x2d')]['limit']);_0x1e74a6[_0x838b('0x18')]=qs[_0x838b('0x18')](_0x4f6179['query'][_0x838b('0x18')]);}_0x1e74a6['order']=qs[_0x838b('0x35')](_0x4f6179['query'][_0x838b('0x35')]);_0x1e74a6['where']=qs[_0x838b('0x2f')](_[_0x838b('0x36')](_0x4f6179[_0x838b('0x2d')],_0x227876[_0x838b('0x2f')]),_0x5aeeca);if(_0x4f6179[_0x838b('0x2d')][_0x838b('0x37')]){_0x1e74a6[_0x838b('0x38')]=_[_0x838b('0x39')](_0x1e74a6[_0x838b('0x38')],{'$or':_[_0x838b('0x26')](_0x5aeeca,function(_0x4ee9c2){if(_0x4ee9c2[_0x838b('0x2a')]!=='VIRTUAL'){var _0x24958f={};_0x24958f[_0x4ee9c2[_0x838b('0x25')]]={'$like':'%'+_0x4f6179[_0x838b('0x2d')][_0x838b('0x37')]+'%'};return _0x24958f;}})});}_0x1e74a6=_[_0x838b('0x39')]({},_0x1e74a6,_0x4f6179[_0x838b('0x3a')]);var _0x26dfab={'where':_0x1e74a6[_0x838b('0x38')]};return db['WhatsappApplication'][_0x838b('0x1b')](_0x26dfab)[_0x838b('0x22')](function(_0x18db4f){_0x5b66f6[_0x838b('0x1b')]=_0x18db4f;if(_0x4f6179[_0x838b('0x2d')][_0x838b('0x3b')]){_0x1e74a6['include']=[{'all':!![]}];}return db[_0x838b('0x27')]['findAll'](_0x1e74a6);})[_0x838b('0x22')](function(_0x3e67de){_0x5b66f6['rows']=_0x3e67de;return _0x5b66f6;})[_0x838b('0x22')](respondWithFilteredResult(_0x4b46bc,_0x1e74a6))[_0x838b('0x3c')](handleError(_0x4b46bc,null));};exports[_0x838b('0x3d')]=function(_0x8e18a8,_0x4a66fb){var _0x51689a={'raw':!![],'where':{'id':_0x8e18a8[_0x838b('0x3e')]['id']}},_0x3e727d={};_0x3e727d['model']=_[_0x838b('0x2e')](db['WhatsappApplication'][_0x838b('0x28')]);_0x3e727d[_0x838b('0x2d')]=_[_0x838b('0x2e')](_0x8e18a8[_0x838b('0x2d')]);_0x3e727d[_0x838b('0x2f')]=_['intersection'](_0x3e727d[_0x838b('0x2c')],_0x3e727d['query']);_0x51689a[_0x838b('0x30')]=_['intersection'](_0x3e727d[_0x838b('0x2c')],qs[_0x838b('0x32')](_0x8e18a8['query'][_0x838b('0x32')]));_0x51689a[_0x838b('0x30')]=_0x51689a['attributes'][_0x838b('0x3f')]?_0x51689a['attributes']:_0x3e727d[_0x838b('0x2c')];if(_0x8e18a8[_0x838b('0x2d')]['includeAll']){_0x51689a[_0x838b('0x40')]=[{'all':!![]}];}_0x51689a=_['merge']({},_0x51689a,_0x8e18a8['options']);return db['WhatsappApplication']['find'](_0x51689a)[_0x838b('0x22')](handleEntityNotFound(_0x4a66fb,null))[_0x838b('0x22')](respondWithResult(_0x4a66fb,null))[_0x838b('0x3c')](handleError(_0x4a66fb,null));};exports[_0x838b('0x41')]=function(_0x829aef,_0x1aaeb2){return db['WhatsappApplication'][_0x838b('0x41')](_0x829aef['body'],{})[_0x838b('0x22')](respondWithResult(_0x1aaeb2,0xc9))['catch'](handleError(_0x1aaeb2,null));};exports[_0x838b('0x21')]=function(_0x2b8990,_0x2d7e50){if(_0x2b8990[_0x838b('0x42')]['id']){delete _0x2b8990[_0x838b('0x42')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x2b8990[_0x838b('0x3e')]['id']}})[_0x838b('0x22')](handleEntityNotFound(_0x2d7e50,null))['then'](saveUpdates(_0x2b8990['body'],null))[_0x838b('0x22')](respondWithResult(_0x2d7e50,null))[_0x838b('0x3c')](handleError(_0x2d7e50,null));};exports[_0x838b('0x23')]=function(_0xa54216,_0x438afa){return db[_0x838b('0x27')][_0x838b('0x43')]({'where':{'id':_0xa54216[_0x838b('0x3e')]['id']}})[_0x838b('0x22')](handleEntityNotFound(_0x438afa,null))[_0x838b('0x22')](removeEntity(_0x438afa,null))['catch'](handleError(_0x438afa,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8691532..1108e67 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 _0xeddd=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x17c3d7,_0x424d58){var _0x71f2dc=function(_0x47a8cd){while(--_0x47a8cd){_0x17c3d7['push'](_0x17c3d7['shift']());}};_0x71f2dc(++_0x424d58);}(_0xeddd,0x69));var _0xdedd=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xeddd[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))(_0xdedd('0x3'));var moment=require('moment');var BPromise=require(_0xdedd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdedd('0x5'));var rimraf=require(_0xdedd('0x6'));var config=require('../../config/environment');var attributes=require(_0xdedd('0x7'));module[_0xdedd('0x8')]=function(_0x16801a,_0x3e6b5a){return _0x16801a[_0xdedd('0x9')](_0xdedd('0xa'),attributes,{'tableName':_0xdedd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdedd('0xc'),'collate':_0xdedd('0xd')});}; \ No newline at end of file +var _0x48ea=['lodash','../../config/logger','api','moment','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x48ea,0x9c));var _0xa48e=function(_0x45e6cf,_0x46cd24){_0x45e6cf=_0x45e6cf-0x0;var _0x4cba3f=_0x48ea[_0x45e6cf];return _0x4cba3f;};'use strict';var _=require(_0xa48e('0x0'));var util=require('util');var logger=require(_0xa48e('0x1'))(_0xa48e('0x2'));var moment=require(_0xa48e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa48e('0x4'));var rimraf=require('rimraf');var config=require(_0xa48e('0x5'));var attributes=require(_0xa48e('0x6'));module[_0xa48e('0x7')]=function(_0x4387b5,_0x2b058d){return _0x4387b5[_0xa48e('0x8')](_0xa48e('0x9'),attributes,{'tableName':_0xa48e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa48e('0xb'),'collate':_0xa48e('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 79c8561..0c11782 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 _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x5b94df,_0x2ecad7){var _0x5645d6=function(_0x5c179d){while(--_0x5c179d){_0x5b94df['push'](_0x5b94df['shift']());}};_0x5645d6(++_0x2ecad7);}(_0x5fd1,0x155));var _0x15fd=function(_0x59c59b,_0x2ef8ac){_0x59c59b=_0x59c59b-0x0;var _0x5665ae=_0x5fd1[_0x59c59b];return _0x5665ae;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file +var _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0x9a19,0x114));var _0x99a1=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x9a19[_0x2d2ca2];return _0x48489d;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 9837912..846650a 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 _0x326f=['./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','whatsapp','put','/:id','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d64f9,_0x2bdb41){var _0x536355=function(_0x4f6f05){while(--_0x4f6f05){_0x1d64f9['push'](_0x1d64f9['shift']());}};_0x536355(++_0x2bdb41);}(_0x326f,0xd1));var _0xf326=function(_0x252d0b,_0x2634a0){_0x252d0b=_0x252d0b-0x0;var _0x3496bd=_0x326f[_0x252d0b];return _0x3496bd;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['post']('/',auth[_0xf326('0xa')](),controller['create']);router[_0xf326('0x12')](_0xf326('0xe'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x12')](_0xf326('0x14'),auth[_0xf326('0xa')](),interaction['tracked'](_0xf326('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xf326('0x16')](_0xf326('0x17'),auth[_0xf326('0xa')](),interaction[_0xf326('0x18')](_0xf326('0x15'),_0xf326('0x19')),controller[_0xf326('0x1a')]);router[_0xf326('0x1b')]('/:id',auth[_0xf326('0xa')](),interaction[_0xf326('0x18')](_0xf326('0x15'),_0xf326('0x1c')),controller[_0xf326('0x1d')]);router[_0xf326('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xf326('0x1e')]=router; \ No newline at end of file +var _0x6ec2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsapp','whatsappinteraction:update','update','delete'];(function(_0x448c77,_0x490e48){var _0x33eda2=function(_0x13b6b7){while(--_0x13b6b7){_0x448c77['push'](_0x448c77['shift']());}};_0x33eda2(++_0x490e48);}(_0x6ec2,0x78));var _0x26ec=function(_0x4eab29,_0x5e9eec){_0x4eab29=_0x4eab29-0x0;var _0x55e176=_0x6ec2[_0x4eab29];return _0x55e176;};'use strict';var multer=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var path=require(_0x26ec('0x2'));var timeout=require(_0x26ec('0x3'));var express=require(_0x26ec('0x4'));var router=express[_0x26ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26ec('0x6'));var interaction=require(_0x26ec('0x7'));var config=require(_0x26ec('0x8'));var controller=require(_0x26ec('0x9'));router[_0x26ec('0xa')]('/',auth['isAuthenticated'](),controller[_0x26ec('0xb')]);router['get']('/describe',auth[_0x26ec('0xc')](),controller[_0x26ec('0xd')]);router[_0x26ec('0xa')]('/:id',auth[_0x26ec('0xc')](),controller['show']);router[_0x26ec('0xa')](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0xf')]);router[_0x26ec('0xa')](_0x26ec('0x10'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x11')]);router[_0x26ec('0x12')]('/',auth[_0x26ec('0xc')](),controller['create']);router['post'](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x13')]);router[_0x26ec('0x12')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp',_0x26ec('0x16')),controller[_0x26ec('0x17')]);router[_0x26ec('0x18')](_0x26ec('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0x26ec('0x1a'),_0x26ec('0x1b')),controller[_0x26ec('0x1c')]);router[_0x26ec('0x1d')]('/:id',auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router[_0x26ec('0x1d')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d33de98..62f2005 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 _0x078f=['ENUM','out','BOOLEAN','INTEGER','moment','exports','DATE','STRING'];(function(_0x189e54,_0x9630d8){var _0x27cd7b=function(_0x757fa){while(--_0x757fa){_0x189e54['push'](_0x189e54['shift']());}};_0x27cd7b(++_0x9630d8);}(_0x078f,0x1b4));var _0xf078=function(_0x2f1e25,_0x3e5590){_0x2f1e25=_0x2f1e25-0x0;var _0x227c8a=_0x078f[_0x2f1e25];return _0x227c8a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf078('0x0'));module[_0xf078('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf078('0x2')]},'disposition':{'type':Sequelize[_0xf078('0x3')]},'secondDisposition':{'type':Sequelize[_0xf078('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf078('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf078('0x3')]},'read1stAt':{'type':Sequelize[_0xf078('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf078('0x4')]('in',_0xf078('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf078('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf078('0x4')]('in',_0xf078('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf078('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf078('0x7')]}}; \ No newline at end of file +var _0x1678=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x531c46,_0x55fa63){var _0x3b4ec5=function(_0x35c94b){while(--_0x35c94b){_0x531c46['push'](_0x531c46['shift']());}};_0x3b4ec5(++_0x55fa63);}(_0x1678,0x17b));var _0x8167=function(_0x23ce26,_0x2524ee){_0x23ce26=_0x23ce26-0x0;var _0x8d4207=_0x1678[_0x23ce26];return _0x8d4207;};'use strict';var Sequelize=require(_0x8167('0x0'));var moment=require(_0x8167('0x1'));module[_0x8167('0x2')]={'closed':{'type':Sequelize[_0x8167('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8167('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8167('0x5')]},'note':{'type':Sequelize[_0x8167('0x5')]},'phone':{'type':Sequelize[_0x8167('0x5')]},'read1stAt':{'type':Sequelize[_0x8167('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8167('0x6')]('in',_0x8167('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8167('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8167('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8167('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8167('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index fb6510f..30dd7cd 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 _0x13be=['download','log','err','unlinkSync','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','end','status','offset','undefined','limit','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','whatsapp','query','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','count','findAll','rows','setTags','spread','Tag','color','emit','removeTags','unix','join','root','files','tmp','server','attachments','format','User','fullname','push','CmContact','lastName','Attachment','Messages','WhatsappAccount','Owner','Whatsapp','Account','N.A.','toString','closed','closedAt','filter','basename','existsSync','pipe','createWriteStream','direction','out','System','Contact','secret','read','value','renderFile','.pdf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13be,0x175));var _0xe13b=function(_0x364154,_0x399863){_0x364154=_0x364154-0x0;var _0x413d88=_0x13be[_0x364154];return _0x413d88;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe13b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe13b('0x1'));var path=require(_0xe13b('0x2'));var ejs=require(_0xe13b('0x3'));var fs=require('fs');var _=require(_0xe13b('0x4'));var Redis=require(_0xe13b('0x5'));var interaction=require(_0xe13b('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe13b('0x7'));var logger=require(_0xe13b('0x8'))(_0xe13b('0x9'));var config=require(_0xe13b('0xa'));var db=require(_0xe13b('0xb'))['db'];config[_0xe13b('0xc')]=_[_0xe13b('0xd')](config[_0xe13b('0xc')],{'host':_0xe13b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe13b('0xc')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3e245a,_0x18ad8b){_0x18ad8b=_0x18ad8b||0xcc;return function(_0x364ff0){if(_0x364ff0){return _0x3e245a['sendStatus'](_0x18ad8b);}return _0x3e245a['status'](_0x18ad8b)[_0xe13b('0xf')]();};}function respondWithResult(_0x23a1a8,_0x6b5662){_0x6b5662=_0x6b5662||0xc8;return function(_0x47c2fe){if(_0x47c2fe){return _0x23a1a8[_0xe13b('0x10')](_0x6b5662)['json'](_0x47c2fe);}};}function respondWithFilteredResult(_0x1b05dc,_0x602b89){return function(_0x39f126){if(_0x39f126){var _0x4f9fc6=typeof _0x602b89[_0xe13b('0x11')]===_0xe13b('0x12')&&typeof _0x602b89[_0xe13b('0x13')]==='undefined';var _0x54dd71=_0x39f126['count'];var _0xf8d34c=_0x4f9fc6?0x0:_0x602b89['offset'];var _0x318efb=_0x4f9fc6?_0x39f126['count']:_0x602b89[_0xe13b('0x11')]+_0x602b89['limit'];var _0x237c3a;if(_0x318efb>=_0x54dd71){_0x318efb=_0x54dd71;_0x237c3a=0xc8;}else{_0x237c3a=0xce;}_0x1b05dc['status'](_0x237c3a);return _0x1b05dc['set'](_0xe13b('0x14'),_0xf8d34c+'-'+_0x318efb+'/'+_0x54dd71)[_0xe13b('0x15')](_0x39f126);}return null;};}function saveUpdates(_0xac8534){return function(_0x2acf51){if(_0x2acf51){return _0x2acf51[_0xe13b('0x16')](_0xac8534)[_0xe13b('0x17')](function(_0x3c63ff){return _0x3c63ff;});}return null;};}function removeEntity(_0x49543b){return function(_0x5d0dd5){if(_0x5d0dd5){return _0x5d0dd5[_0xe13b('0x18')]()[_0xe13b('0x17')](function(){_0x49543b['status'](0xcc)[_0xe13b('0xf')]();});}};}function handleEntityNotFound(_0x43cc95){return function(_0x501d4d){if(!_0x501d4d){_0x43cc95[_0xe13b('0x19')](0x194);}return _0x501d4d;};}function handleError(_0x56d7d3,_0x31d86a){_0x31d86a=_0x31d86a||0x1f4;return function(_0xa3037){logger[_0xe13b('0x1a')](_0xa3037[_0xe13b('0x1b')]);if(_0xa3037[_0xe13b('0x1c')]){delete _0xa3037['name'];}_0x56d7d3['status'](_0x31d86a)[_0xe13b('0x1d')](_0xa3037);};}exports[_0xe13b('0x1e')]=function(_0x1076ee,_0x3b3ba2){var _0x374a9a={};var _0x4771db=_[_0xe13b('0x1f')](db[_0xe13b('0x20')][_0xe13b('0x21')],function(_0x193ff2){return{'name':_0x193ff2[_0xe13b('0x22')],'type':_0x193ff2[_0xe13b('0x23')]['key']};});_0x374a9a=qs[_0xe13b('0x24')](_0x4771db,_0x1076ee);return interaction['findAll'](_0xe13b('0x25'),_0x1076ee[_0xe13b('0x26')],_0x1076ee['user'],_0x374a9a,_0x4771db)['then'](respondWithFilteredResult(_0x3b3ba2,_0x374a9a))[_0xe13b('0x27')](handleError(_0x3b3ba2,null));};exports[_0xe13b('0x28')]=function(_0x4a9cce,_0x5db958){var _0x23ec75={'raw':![],'where':{'id':_0x4a9cce[_0xe13b('0x29')]['id']}},_0x244baa={};_0x244baa[_0xe13b('0x2a')]=_[_0xe13b('0x2b')](db[_0xe13b('0x20')][_0xe13b('0x21')]);_0x244baa['query']=_[_0xe13b('0x2b')](_0x4a9cce[_0xe13b('0x26')]);_0x244baa[_0xe13b('0x2c')]=_[_0xe13b('0x2d')](_0x244baa[_0xe13b('0x2a')],_0x244baa['query']);_0x23ec75['attributes']=_[_0xe13b('0x2d')](_0x244baa[_0xe13b('0x2a')],qs['fields'](_0x4a9cce[_0xe13b('0x26')][_0xe13b('0x2e')]));_0x23ec75[_0xe13b('0x2f')]=_0x23ec75[_0xe13b('0x2f')][_0xe13b('0x30')]?_0x23ec75[_0xe13b('0x2f')]:_0x244baa[_0xe13b('0x2a')];if(_0x4a9cce[_0xe13b('0x26')][_0xe13b('0x31')]){_0x23ec75[_0xe13b('0x32')]=[{'all':!![]}];}_0x23ec75=_['merge']({},_0x23ec75,_0x4a9cce['options']);return db[_0xe13b('0x20')][_0xe13b('0x33')](_0x23ec75)['then'](handleEntityNotFound(_0x5db958,null))[_0xe13b('0x17')](respondWithResult(_0x5db958,null))[_0xe13b('0x27')](handleError(_0x5db958,null));};exports[_0xe13b('0x34')]=function(_0x24ad22,_0x35ac4a){return db[_0xe13b('0x20')][_0xe13b('0x34')](_0x24ad22[_0xe13b('0x35')],{})[_0xe13b('0x17')](respondWithResult(_0x35ac4a,0xc9))[_0xe13b('0x27')](handleError(_0x35ac4a,null));};exports[_0xe13b('0x16')]=function(_0x28ffd8,_0x381914){if(_0x28ffd8[_0xe13b('0x35')]['id']){delete _0x28ffd8['body']['id'];}return db[_0xe13b('0x20')][_0xe13b('0x33')]({'where':{'id':_0x28ffd8[_0xe13b('0x29')]['id']}})[_0xe13b('0x17')](handleEntityNotFound(_0x381914,null))[_0xe13b('0x17')](saveUpdates(_0x28ffd8[_0xe13b('0x35')],null))[_0xe13b('0x17')](respondWithResult(_0x381914,null))[_0xe13b('0x27')](handleError(_0x381914,null));};exports[_0xe13b('0x18')]=function(_0x13de89,_0x582097){return db[_0xe13b('0x20')][_0xe13b('0x33')]({'where':{'id':_0x13de89[_0xe13b('0x29')]['id']}})[_0xe13b('0x17')](handleEntityNotFound(_0x582097,null))[_0xe13b('0x17')](removeEntity(_0x582097,null))['catch'](handleError(_0x582097,null));};exports[_0xe13b('0x36')]=function(_0x4801d0,_0x435eb3){return db[_0xe13b('0x20')][_0xe13b('0x36')]()[_0xe13b('0x17')](respondWithResult(_0x435eb3,null))[_0xe13b('0x27')](handleError(_0x435eb3,null));};exports[_0xe13b('0x37')]=function(_0x3fde4d,_0x150877){return db['WhatsappMessage']['find']({'where':{'id':_0x3fde4d['params']['id']}})[_0xe13b('0x17')](handleEntityNotFound(_0x150877,null))[_0xe13b('0x17')](function(_0x373329){if(_0x373329){return _0x373329[_0xe13b('0x37')](_0x3fde4d[_0xe13b('0x35')][_0xe13b('0x38')],_[_0xe13b('0x39')](_0x3fde4d[_0xe13b('0x35')],['ids','id'])||{});}})[_0xe13b('0x17')](respondWithResult(_0x150877,null))[_0xe13b('0x27')](handleError(_0x150877,null));};exports[_0xe13b('0x3a')]=function(_0x42e0a7,_0x1185b7){var _0x5f253f={'raw':![],'where':{}};var _0x565ce1={};var _0x2eeb17={'count':0x0,'rows':[]};return db[_0xe13b('0x20')][_0xe13b('0x3b')]({'where':{'id':_0x42e0a7[_0xe13b('0x29')]['id']}})[_0xe13b('0x17')](handleEntityNotFound(_0x1185b7,null))['then'](function(_0x267255){if(_0x267255){_0x565ce1[_0xe13b('0x2a')]=_[_0xe13b('0x2b')](db[_0xe13b('0x3c')]['rawAttributes']);_0x565ce1[_0xe13b('0x26')]=_['keys'](_0x42e0a7[_0xe13b('0x26')]);_0x565ce1[_0xe13b('0x2c')]=_[_0xe13b('0x2d')](_0x565ce1[_0xe13b('0x2a')],_0x565ce1['query']);_0x5f253f[_0xe13b('0x2f')]=_[_0xe13b('0x2d')](_0x565ce1[_0xe13b('0x2a')],qs['fields'](_0x42e0a7[_0xe13b('0x26')][_0xe13b('0x2e')]));_0x5f253f[_0xe13b('0x2f')]=_0x5f253f[_0xe13b('0x2f')][_0xe13b('0x30')]?_0x5f253f['attributes']:_0x565ce1['model'];if(!_0x42e0a7['query'][_0xe13b('0x3d')](_0xe13b('0x3e'))){_0x5f253f[_0xe13b('0x13')]=qs['limit'](_0x42e0a7['query']['limit']);_0x5f253f[_0xe13b('0x11')]=qs[_0xe13b('0x11')](_0x42e0a7[_0xe13b('0x26')]['offset']);}_0x5f253f[_0xe13b('0x3f')]=qs[_0xe13b('0x40')](_0x42e0a7[_0xe13b('0x26')]['sort']);_0x5f253f['where']=qs[_0xe13b('0x2c')](_[_0xe13b('0x41')](_0x42e0a7[_0xe13b('0x26')],_0x565ce1[_0xe13b('0x2c')]));_0x5f253f[_0xe13b('0x42')][_0xe13b('0x43')]=_0x267255['id'];if(_0x42e0a7[_0xe13b('0x26')]['filter']){_0x5f253f[_0xe13b('0x42')]=_[_0xe13b('0x44')](_0x5f253f['where'],{'$or':_['map'](_0x5f253f[_0xe13b('0x2f')],function(_0x198e07){var _0xf3b032={};_0xf3b032[_0x198e07]={'$like':'%'+_0x42e0a7[_0xe13b('0x26')]['filter']+'%'};return _0xf3b032;})});}if(_0x42e0a7['query'][_0xe13b('0x45')]){var _0xca6f3f=_0x42e0a7['query'][_0xe13b('0x45')][_0xe13b('0x46')](',');var _0x304f0e={};_0x304f0e[_0xca6f3f[0x0]]={'$gte':moment(_0xca6f3f[0x1])['format'](_0xe13b('0x47'))};_0x5f253f[_0xe13b('0x42')]=_[_0xe13b('0x44')](_0x5f253f[_0xe13b('0x42')],_0x304f0e);}_0x5f253f=_[_0xe13b('0x44')]({},_0x5f253f,_0x42e0a7[_0xe13b('0x48')]);return db[_0xe13b('0x3c')][_0xe13b('0x49')]({'where':_0x5f253f['where']})['then'](function(_0xd39ef4){_0x2eeb17[_0xe13b('0x49')]=_0xd39ef4;if(_0x42e0a7[_0xe13b('0x26')][_0xe13b('0x31')]){_0x5f253f[_0xe13b('0x32')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xe13b('0x4a')](_0x5f253f);})['then'](function(_0x1e5632){_0x2eeb17[_0xe13b('0x4b')]=_0x1e5632;return _0x2eeb17;});}})[_0xe13b('0x17')](respondWithFilteredResult(_0x1185b7,_0x5f253f))['catch'](handleError(_0x1185b7,null));};exports['addTags']=function(_0x10a0ec,_0xf710a2){return db['WhatsappInteraction'][_0xe13b('0x33')]({'where':{'id':_0x10a0ec[_0xe13b('0x29')]['id']}})['then'](handleEntityNotFound(_0xf710a2,null))['then'](function(_0x5d2e09){if(_0x5d2e09){return _0x5d2e09[_0xe13b('0x4c')](_0x10a0ec[_0xe13b('0x35')]['ids'],_[_0xe13b('0x39')](_0x10a0ec[_0xe13b('0x35')],[_0xe13b('0x38'),'id'])||{})[_0xe13b('0x4d')](function(){return db[_0xe13b('0x4e')][_0xe13b('0x4a')]({'attributes':['id',_0xe13b('0x1c'),_0xe13b('0x4f')],'where':{'id':_0x10a0ec[_0xe13b('0x35')][_0xe13b('0x38')]}});})[_0xe13b('0x17')](function(_0xdf6b4d){socket[_0xe13b('0x50')]('whatsappInteractionTags:save',{'id':Number(_0x10a0ec[_0xe13b('0x29')]['id']),'tags':_0xdf6b4d||[]});return{'id':Number(_0x10a0ec[_0xe13b('0x29')]['id']),'tags':_0xdf6b4d||[]};});}})[_0xe13b('0x17')](respondWithResult(_0xf710a2,null))['catch'](handleError(_0xf710a2,null));};exports[_0xe13b('0x51')]=function(_0x2da08b,_0x1b70e8){return db[_0xe13b('0x20')][_0xe13b('0x33')]({'where':{'id':_0x2da08b[_0xe13b('0x29')]['id']}})['then'](handleEntityNotFound(_0x1b70e8,null))[_0xe13b('0x17')](function(_0x96d29){if(_0x96d29){return _0x96d29[_0xe13b('0x51')](_0x2da08b[_0xe13b('0x26')][_0xe13b('0x38')]);}})[_0xe13b('0x17')](respondWithStatusCode(_0x1b70e8,null))[_0xe13b('0x27')](handleError(_0x1b70e8,null));};exports['download']=function(_0x4d6762,_0x2595ea){var _0x4f3f14=moment()[_0xe13b('0x52')]()['toString']();var _0x3d71ae=path[_0xe13b('0x53')](config[_0xe13b('0x54')],'server',_0xe13b('0x55'),_0xe13b('0x56'));var _0x28b7e9=path[_0xe13b('0x53')](config[_0xe13b('0x54')],_0xe13b('0x57'),'files',_0xe13b('0x58'));var _0x2091f2=path[_0xe13b('0x53')](_0x3d71ae,_0x4f3f14);var _0x280528=util[_0xe13b('0x59')]('transcript-%d-%s.zip',_0x4d6762['params']['id'],_0x4f3f14);var _0x1dfe77=path[_0xe13b('0x53')](_0x3d71ae,_0x280528);var _0x629791=[];_0x629791['push']({'model':db['User'],'as':_0xe13b('0x5a'),'attributes':['id',_0xe13b('0x5b')],'raw':!![]});_0x629791[_0xe13b('0x5c')]({'model':db[_0xe13b('0x5d')],'as':'Contact','attributes':['id','firstName',_0xe13b('0x5e')],'raw':!![]});if(_0x4d6762[_0xe13b('0x26')][_0xe13b('0x58')]){_0x629791[_0xe13b('0x5c')]({'model':db[_0xe13b('0x5f')],'as':_0xe13b('0x5f'),'raw':!![]});}var _0x3091cb=[{'model':db[_0xe13b('0x3c')],'as':_0xe13b('0x60'),'attributes':['id',_0xe13b('0x35'),'createdAt','direction','secret','read'],'include':_0x629791}];_0x3091cb['push']({'model':db[_0xe13b('0x61')],'as':'Account','attributes':['id',_0xe13b('0x1c')]});_0x3091cb[_0xe13b('0x5c')]({'model':db[_0xe13b('0x5a')],'as':_0xe13b('0x62'),'attributes':['id',_0xe13b('0x5b')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x4d6762[_0xe13b('0x29')]['id']},'include':_0x3091cb})[_0xe13b('0x17')](handleEntityNotFound(_0x2595ea,null))[_0xe13b('0x17')](function(_0xfae7b1){if(_0xfae7b1){var _0x843e7=_0xfae7b1['get']({'plain':!![]});fs['mkdirSync'](_0x2091f2);var _0x4ae345={'channel':_0xe13b('0x63'),'account':_0x843e7[_0xe13b('0x64')]['name'],'agent':_0x843e7['Owner']?_0x843e7['Owner'][_0xe13b('0x5b')]:_0xe13b('0x65'),'createdAt':moment(_0x843e7['createdAt'])[_0xe13b('0x59')](_0xe13b('0x47'))[_0xe13b('0x66')](),'closedAt':_0x843e7[_0xe13b('0x67')]?moment(_0x843e7[_0xe13b('0x68')])[_0xe13b('0x59')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe13b('0x66')]():'','disposition':_0x843e7['disposition'],'messages':_(_0x843e7[_0xe13b('0x60')])[_0xe13b('0x69')]({'secret':![]})[_0xe13b('0x1f')](function(_0x119fa9){if(_0x119fa9['Attachment']){var _0x5e7aa1=path[_0xe13b('0x53')](_0x28b7e9,_0x119fa9[_0xe13b('0x5f')][_0xe13b('0x6a')]);if(fs[_0xe13b('0x6b')](_0x5e7aa1)){fs['createReadStream'](_0x5e7aa1)[_0xe13b('0x6c')](fs[_0xe13b('0x6d')](path['join'](_0x2091f2,_0x119fa9[_0xe13b('0x5f')][_0xe13b('0x6a')])));}}return{'date':moment(_0x119fa9['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe13b('0x66')](),'sender':_0x119fa9[_0xe13b('0x6e')]===_0xe13b('0x6f')?_0x119fa9['User']?_0x119fa9[_0xe13b('0x5a')][_0xe13b('0x5b')]:_0xe13b('0x70'):_0x119fa9[_0xe13b('0x71')]['firstName']+(_0x119fa9['Contact'][_0xe13b('0x5e')]?'\x20'+_0x119fa9['Contact'][_0xe13b('0x5e')]:''),'body':_0x119fa9[_0xe13b('0x5f')]?_0x119fa9[_0xe13b('0x5f')][_0xe13b('0x6a')]:_0x119fa9[_0xe13b('0x35')],'direction':_0x119fa9[_0xe13b('0x6e')]==='out'?'A':'C','secret':_0x119fa9[_0xe13b('0x72')],'read':_0x119fa9[_0xe13b('0x73')],'attachment':_0x119fa9['Attachment']};})[_0xe13b('0x74')]()};return ejs[_0xe13b('0x75')](path[_0xe13b('0x53')](config['root'],_0xe13b('0x57'),'views','downloadInteraction.ejs'),{'interaction':_0x4ae345})[_0xe13b('0x17')](function(_0x1cfceb){var _0x27661e=path[_0xe13b('0x53')](_0x2091f2,'transcript-'+_0x843e7['id']+'-'+_0x4f3f14+_0xe13b('0x76'));var _0x1ad3f5={'path':_0x27661e,'channel':_0xe13b('0x63'),'interactionId':_0x843e7['id']};return pdf['createPdfFromHTML'](_0x1cfceb,_0x1ad3f5);})[_0xe13b('0x17')](function(){return new BPromise(function(_0x476f4a,_0x4e4136){zipdir(_0x2091f2,{'saveTo':_0x1dfe77},function(_0x40966b,_0x4b1b1c){if(_0x40966b)return _0x4e4136(_0x40966b);return _0x476f4a(_0x4b1b1c);});})['then'](function(){return new BPromise(function(_0x313842,_0x103fa8){rimraf(_0x2091f2,function(_0x352f31){if(_0x352f31)_0x103fa8(_0x352f31);return _0x313842();});});})[_0xe13b('0x17')](function(){return _0x2595ea[_0xe13b('0x77')](_0x1dfe77,_0x280528,function(_0x311622){if(_0x311622){console[_0xe13b('0x78')](_0xe13b('0x79'),_0x311622);}else{fs[_0xe13b('0x7a')](_0x1dfe77);}});});});}else{return _0x2595ea[_0xe13b('0x19')](0xc8);}})[_0xe13b('0x27')](handleError(_0x2595ea,null));}; \ No newline at end of file +var _0xb3f9=['tmp','attachments','User','CmContact','firstName','push','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','direction','System','Contact','lastName','value','downloadInteraction.ejs','transcript-','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','stack','name','map','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','model','keys','WhatsappInteraction','filters','attributes','intersection','fields','length','includeAll','include','options','find','catch','create','body','params','describe','ids','getMessages','WhatsappMessage','order','sort','where','pick','WhatsappInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','Tag','color','emit','whatsappInteractionTags:save','removeTags','toString','join','root','server','files'];(function(_0x35e4ee,_0x5a1de3){var _0x34cf61=function(_0x29ac33){while(--_0x29ac33){_0x35e4ee['push'](_0x35e4ee['shift']());}};_0x34cf61(++_0x5a1de3);}(_0xb3f9,0x122));var _0x9b3f=function(_0x4539b4,_0x574eb0){_0x4539b4=_0x4539b4-0x0;var _0x490b1a=_0xb3f9[_0x4539b4];return _0x490b1a;};'use strict';var rimraf=require(_0x9b3f('0x0'));var zipdir=require(_0x9b3f('0x1'));var moment=require(_0x9b3f('0x2'));var BPromise=require(_0x9b3f('0x3'));var util=require(_0x9b3f('0x4'));var path=require('path');var ejs=require(_0x9b3f('0x5'));var fs=require('fs');var _=require(_0x9b3f('0x6'));var Redis=require(_0x9b3f('0x7'));var interaction=require(_0x9b3f('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x9b3f('0x9'));var logger=require('../../config/logger')(_0x9b3f('0xa'));var config=require(_0x9b3f('0xb'));var db=require(_0x9b3f('0xc'))['db'];config[_0x9b3f('0xd')]=_['defaults'](config['redis'],{'host':_0x9b3f('0xe'),'port':0x18eb});var socket=require(_0x9b3f('0xf'))(new Redis(config[_0x9b3f('0xd')]));require(_0x9b3f('0x10'))[_0x9b3f('0x11')](socket);function respondWithStatusCode(_0x2a53d1,_0x32eafa){_0x32eafa=_0x32eafa||0xcc;return function(_0x154317){if(_0x154317){return _0x2a53d1[_0x9b3f('0x12')](_0x32eafa);}return _0x2a53d1[_0x9b3f('0x13')](_0x32eafa)[_0x9b3f('0x14')]();};}function respondWithResult(_0x202e07,_0x40faaf){_0x40faaf=_0x40faaf||0xc8;return function(_0x56a7b2){if(_0x56a7b2){return _0x202e07[_0x9b3f('0x13')](_0x40faaf)[_0x9b3f('0x15')](_0x56a7b2);}};}function respondWithFilteredResult(_0x39931d,_0x84412e){return function(_0x2d8879){if(_0x2d8879){var _0x1fec63=typeof _0x84412e[_0x9b3f('0x16')]===_0x9b3f('0x17')&&typeof _0x84412e[_0x9b3f('0x18')]===_0x9b3f('0x17');var _0x21fef5=_0x2d8879[_0x9b3f('0x19')];var _0x21cd24=_0x1fec63?0x0:_0x84412e['offset'];var _0x267da8=_0x1fec63?_0x2d8879[_0x9b3f('0x19')]:_0x84412e[_0x9b3f('0x16')]+_0x84412e[_0x9b3f('0x18')];var _0x50baf0;if(_0x267da8>=_0x21fef5){_0x267da8=_0x21fef5;_0x50baf0=0xc8;}else{_0x50baf0=0xce;}_0x39931d[_0x9b3f('0x13')](_0x50baf0);return _0x39931d[_0x9b3f('0x1a')](_0x9b3f('0x1b'),_0x21cd24+'-'+_0x267da8+'/'+_0x21fef5)[_0x9b3f('0x15')](_0x2d8879);}return null;};}function saveUpdates(_0x32fecc){return function(_0x4e159c){if(_0x4e159c){return _0x4e159c[_0x9b3f('0x1c')](_0x32fecc)['then'](function(_0x3addd7){return _0x3addd7;});}return null;};}function removeEntity(_0x406631){return function(_0x1c29d2){if(_0x1c29d2){return _0x1c29d2[_0x9b3f('0x1d')]()[_0x9b3f('0x1e')](function(){_0x406631['status'](0xcc)[_0x9b3f('0x14')]();});}};}function handleEntityNotFound(_0xbb7aa5){return function(_0x4f0e55){if(!_0x4f0e55){_0xbb7aa5[_0x9b3f('0x12')](0x194);}return _0x4f0e55;};}function handleError(_0x4ef190,_0x599b4a){_0x599b4a=_0x599b4a||0x1f4;return function(_0x18a8ce){logger['error'](_0x18a8ce[_0x9b3f('0x1f')]);if(_0x18a8ce[_0x9b3f('0x20')]){delete _0x18a8ce[_0x9b3f('0x20')];}_0x4ef190['status'](_0x599b4a)['send'](_0x18a8ce);};}exports['index']=function(_0x2d84d7,_0x1fb8f6){var _0x58b464={};var _0x5644e4=_[_0x9b3f('0x21')](db['WhatsappInteraction'][_0x9b3f('0x22')],function(_0x401eef){return{'name':_0x401eef[_0x9b3f('0x23')],'type':_0x401eef[_0x9b3f('0x24')][_0x9b3f('0x25')]};});_0x58b464=qs[_0x9b3f('0x26')](_0x5644e4,_0x2d84d7);return interaction[_0x9b3f('0x27')](_0x9b3f('0x28'),_0x2d84d7[_0x9b3f('0x29')],_0x2d84d7[_0x9b3f('0x2a')],_0x58b464,_0x5644e4)[_0x9b3f('0x1e')](respondWithFilteredResult(_0x1fb8f6,_0x58b464))['catch'](handleError(_0x1fb8f6,null));};exports['show']=function(_0x54ed85,_0x3bb032){var _0x85bb32={'raw':![],'where':{'id':_0x54ed85['params']['id']}},_0x406e30={};_0x406e30[_0x9b3f('0x2b')]=_[_0x9b3f('0x2c')](db[_0x9b3f('0x2d')]['rawAttributes']);_0x406e30['query']=_['keys'](_0x54ed85[_0x9b3f('0x29')]);_0x406e30[_0x9b3f('0x2e')]=_['intersection'](_0x406e30['model'],_0x406e30['query']);_0x85bb32[_0x9b3f('0x2f')]=_[_0x9b3f('0x30')](_0x406e30['model'],qs[_0x9b3f('0x31')](_0x54ed85[_0x9b3f('0x29')]['fields']));_0x85bb32[_0x9b3f('0x2f')]=_0x85bb32[_0x9b3f('0x2f')][_0x9b3f('0x32')]?_0x85bb32[_0x9b3f('0x2f')]:_0x406e30[_0x9b3f('0x2b')];if(_0x54ed85[_0x9b3f('0x29')][_0x9b3f('0x33')]){_0x85bb32[_0x9b3f('0x34')]=[{'all':!![]}];}_0x85bb32=_['merge']({},_0x85bb32,_0x54ed85[_0x9b3f('0x35')]);return db[_0x9b3f('0x2d')][_0x9b3f('0x36')](_0x85bb32)['then'](handleEntityNotFound(_0x3bb032,null))[_0x9b3f('0x1e')](respondWithResult(_0x3bb032,null))[_0x9b3f('0x37')](handleError(_0x3bb032,null));};exports[_0x9b3f('0x38')]=function(_0x1fd02d,_0x8c8a34){return db[_0x9b3f('0x2d')]['create'](_0x1fd02d['body'],{})[_0x9b3f('0x1e')](respondWithResult(_0x8c8a34,0xc9))[_0x9b3f('0x37')](handleError(_0x8c8a34,null));};exports['update']=function(_0x518afa,_0x44bea4){if(_0x518afa[_0x9b3f('0x39')]['id']){delete _0x518afa[_0x9b3f('0x39')]['id'];}return db[_0x9b3f('0x2d')][_0x9b3f('0x36')]({'where':{'id':_0x518afa['params']['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x44bea4,null))[_0x9b3f('0x1e')](saveUpdates(_0x518afa[_0x9b3f('0x39')],null))[_0x9b3f('0x1e')](respondWithResult(_0x44bea4,null))[_0x9b3f('0x37')](handleError(_0x44bea4,null));};exports[_0x9b3f('0x1d')]=function(_0x4de0cc,_0x57ac30){return db['WhatsappInteraction'][_0x9b3f('0x36')]({'where':{'id':_0x4de0cc[_0x9b3f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x57ac30,null))[_0x9b3f('0x1e')](removeEntity(_0x57ac30,null))[_0x9b3f('0x37')](handleError(_0x57ac30,null));};exports[_0x9b3f('0x3b')]=function(_0x4ce00b,_0x5be3fd){return db[_0x9b3f('0x2d')][_0x9b3f('0x3b')]()[_0x9b3f('0x1e')](respondWithResult(_0x5be3fd,null))[_0x9b3f('0x37')](handleError(_0x5be3fd,null));};exports['addMessage']=function(_0x7a6369,_0x4c7cb9){return db['WhatsappMessage']['find']({'where':{'id':_0x7a6369[_0x9b3f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4c7cb9,null))['then'](function(_0x4431c){if(_0x4431c){return _0x4431c['addMessage'](_0x7a6369[_0x9b3f('0x39')][_0x9b3f('0x3c')],_['omit'](_0x7a6369[_0x9b3f('0x39')],[_0x9b3f('0x3c'),'id'])||{});}})[_0x9b3f('0x1e')](respondWithResult(_0x4c7cb9,null))[_0x9b3f('0x37')](handleError(_0x4c7cb9,null));};exports[_0x9b3f('0x3d')]=function(_0x21455d,_0x36f69f){var _0x5abd51={'raw':![],'where':{}};var _0x1eae83={};var _0x468ea6={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x21455d[_0x9b3f('0x3a')]['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x36f69f,null))[_0x9b3f('0x1e')](function(_0x2bea23){if(_0x2bea23){_0x1eae83[_0x9b3f('0x2b')]=_[_0x9b3f('0x2c')](db[_0x9b3f('0x3e')][_0x9b3f('0x22')]);_0x1eae83[_0x9b3f('0x29')]=_[_0x9b3f('0x2c')](_0x21455d[_0x9b3f('0x29')]);_0x1eae83[_0x9b3f('0x2e')]=_[_0x9b3f('0x30')](_0x1eae83[_0x9b3f('0x2b')],_0x1eae83[_0x9b3f('0x29')]);_0x5abd51[_0x9b3f('0x2f')]=_[_0x9b3f('0x30')](_0x1eae83[_0x9b3f('0x2b')],qs[_0x9b3f('0x31')](_0x21455d[_0x9b3f('0x29')][_0x9b3f('0x31')]));_0x5abd51['attributes']=_0x5abd51['attributes']['length']?_0x5abd51['attributes']:_0x1eae83[_0x9b3f('0x2b')];if(!_0x21455d[_0x9b3f('0x29')]['hasOwnProperty']('nolimit')){_0x5abd51[_0x9b3f('0x18')]=qs[_0x9b3f('0x18')](_0x21455d['query']['limit']);_0x5abd51[_0x9b3f('0x16')]=qs['offset'](_0x21455d['query']['offset']);}_0x5abd51[_0x9b3f('0x3f')]=qs[_0x9b3f('0x40')](_0x21455d[_0x9b3f('0x29')][_0x9b3f('0x40')]);_0x5abd51[_0x9b3f('0x41')]=qs[_0x9b3f('0x2e')](_[_0x9b3f('0x42')](_0x21455d[_0x9b3f('0x29')],_0x1eae83[_0x9b3f('0x2e')]));_0x5abd51['where'][_0x9b3f('0x43')]=_0x2bea23['id'];if(_0x21455d[_0x9b3f('0x29')]['filter']){_0x5abd51['where']=_[_0x9b3f('0x44')](_0x5abd51[_0x9b3f('0x41')],{'$or':_[_0x9b3f('0x21')](_0x5abd51['attributes'],function(_0x2742e7){var _0x491eae={};_0x491eae[_0x2742e7]={'$like':'%'+_0x21455d['query'][_0x9b3f('0x45')]+'%'};return _0x491eae;})});}if(_0x21455d[_0x9b3f('0x29')]['$gte']){var _0x43f4a4=_0x21455d['query'][_0x9b3f('0x46')][_0x9b3f('0x47')](',');var _0x5624d1={};_0x5624d1[_0x43f4a4[0x0]]={'$gte':moment(_0x43f4a4[0x1])[_0x9b3f('0x48')](_0x9b3f('0x49'))};_0x5abd51['where']=_['merge'](_0x5abd51['where'],_0x5624d1);}_0x5abd51=_[_0x9b3f('0x44')]({},_0x5abd51,_0x21455d[_0x9b3f('0x35')]);return db[_0x9b3f('0x3e')][_0x9b3f('0x19')]({'where':_0x5abd51[_0x9b3f('0x41')]})['then'](function(_0x54d9ed){_0x468ea6['count']=_0x54d9ed;if(_0x21455d['query'][_0x9b3f('0x33')]){_0x5abd51['include']=[{'all':!![]}];}return db[_0x9b3f('0x3e')][_0x9b3f('0x27')](_0x5abd51);})['then'](function(_0x5af60a){_0x468ea6[_0x9b3f('0x4a')]=_0x5af60a;return _0x468ea6;});}})[_0x9b3f('0x1e')](respondWithFilteredResult(_0x36f69f,_0x5abd51))[_0x9b3f('0x37')](handleError(_0x36f69f,null));};exports[_0x9b3f('0x4b')]=function(_0x2d04fe,_0x235272){return db[_0x9b3f('0x2d')][_0x9b3f('0x36')]({'where':{'id':_0x2d04fe[_0x9b3f('0x3a')]['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x235272,null))[_0x9b3f('0x1e')](function(_0x2e86b1){if(_0x2e86b1){return _0x2e86b1[_0x9b3f('0x4c')](_0x2d04fe[_0x9b3f('0x39')][_0x9b3f('0x3c')],_[_0x9b3f('0x4d')](_0x2d04fe[_0x9b3f('0x39')],[_0x9b3f('0x3c'),'id'])||{})['spread'](function(){return db[_0x9b3f('0x4e')]['findAll']({'attributes':['id',_0x9b3f('0x20'),_0x9b3f('0x4f')],'where':{'id':_0x2d04fe['body'][_0x9b3f('0x3c')]}});})[_0x9b3f('0x1e')](function(_0x520b8e){socket[_0x9b3f('0x50')](_0x9b3f('0x51'),{'id':Number(_0x2d04fe[_0x9b3f('0x3a')]['id']),'tags':_0x520b8e||[]});return{'id':Number(_0x2d04fe['params']['id']),'tags':_0x520b8e||[]};});}})['then'](respondWithResult(_0x235272,null))[_0x9b3f('0x37')](handleError(_0x235272,null));};exports[_0x9b3f('0x52')]=function(_0x243536,_0x10ed2d){return db[_0x9b3f('0x2d')][_0x9b3f('0x36')]({'where':{'id':_0x243536['params']['id']}})[_0x9b3f('0x1e')](handleEntityNotFound(_0x10ed2d,null))[_0x9b3f('0x1e')](function(_0x4aeb7f){if(_0x4aeb7f){return _0x4aeb7f[_0x9b3f('0x52')](_0x243536[_0x9b3f('0x29')][_0x9b3f('0x3c')]);}})[_0x9b3f('0x1e')](respondWithStatusCode(_0x10ed2d,null))[_0x9b3f('0x37')](handleError(_0x10ed2d,null));};exports['download']=function(_0x6d506d,_0x428e85){var _0x4546da=moment()['unix']()[_0x9b3f('0x53')]();var _0xb63012=path[_0x9b3f('0x54')](config[_0x9b3f('0x55')],_0x9b3f('0x56'),_0x9b3f('0x57'),_0x9b3f('0x58'));var _0x30bfb7=path['join'](config[_0x9b3f('0x55')],_0x9b3f('0x56'),_0x9b3f('0x57'),_0x9b3f('0x59'));var _0x32b703=path[_0x9b3f('0x54')](_0xb63012,_0x4546da);var _0x5d6797=util['format']('transcript-%d-%s.zip',_0x6d506d[_0x9b3f('0x3a')]['id'],_0x4546da);var _0x7cc6ac=path[_0x9b3f('0x54')](_0xb63012,_0x5d6797);var _0x2ffb12=[];_0x2ffb12['push']({'model':db['User'],'as':_0x9b3f('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x2ffb12['push']({'model':db[_0x9b3f('0x5b')],'as':'Contact','attributes':['id',_0x9b3f('0x5c'),'lastName'],'raw':!![]});if(_0x6d506d[_0x9b3f('0x29')]['attachments']){_0x2ffb12[_0x9b3f('0x5d')]({'model':db['Attachment'],'as':_0x9b3f('0x5e'),'raw':!![]});}var _0x207a1e=[{'model':db[_0x9b3f('0x3e')],'as':_0x9b3f('0x5f'),'attributes':['id',_0x9b3f('0x39'),_0x9b3f('0x60'),'direction',_0x9b3f('0x61'),_0x9b3f('0x62')],'include':_0x2ffb12}];_0x207a1e[_0x9b3f('0x5d')]({'model':db[_0x9b3f('0x63')],'as':_0x9b3f('0x64'),'attributes':['id',_0x9b3f('0x20')]});_0x207a1e[_0x9b3f('0x5d')]({'model':db[_0x9b3f('0x5a')],'as':_0x9b3f('0x65'),'attributes':['id',_0x9b3f('0x66')]});return db[_0x9b3f('0x2d')]['find']({'where':{'id':_0x6d506d['params']['id']},'include':_0x207a1e})[_0x9b3f('0x1e')](handleEntityNotFound(_0x428e85,null))[_0x9b3f('0x1e')](function(_0x168d36){if(_0x168d36){var _0x2dbc3a=_0x168d36[_0x9b3f('0x67')]({'plain':!![]});fs[_0x9b3f('0x68')](_0x32b703);var _0x52252e={'channel':_0x9b3f('0x69'),'account':_0x2dbc3a['Account'][_0x9b3f('0x20')],'agent':_0x2dbc3a['Owner']?_0x2dbc3a[_0x9b3f('0x65')][_0x9b3f('0x66')]:_0x9b3f('0x6a'),'createdAt':moment(_0x2dbc3a[_0x9b3f('0x60')])[_0x9b3f('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9b3f('0x53')](),'closedAt':_0x2dbc3a[_0x9b3f('0x6b')]?moment(_0x2dbc3a[_0x9b3f('0x6c')])[_0x9b3f('0x48')](_0x9b3f('0x49'))['toString']():'','disposition':_0x2dbc3a[_0x9b3f('0x6d')],'messages':_(_0x2dbc3a[_0x9b3f('0x5f')])[_0x9b3f('0x45')]({'secret':![]})[_0x9b3f('0x21')](function(_0xb9f259){if(_0xb9f259['Attachment']){var _0x1061b0=path[_0x9b3f('0x54')](_0x30bfb7,_0xb9f259['Attachment'][_0x9b3f('0x6e')]);if(fs['existsSync'](_0x1061b0)){fs[_0x9b3f('0x6f')](_0x1061b0)[_0x9b3f('0x70')](fs[_0x9b3f('0x71')](path[_0x9b3f('0x54')](_0x32b703,_0xb9f259[_0x9b3f('0x5e')][_0x9b3f('0x6e')])));}}return{'date':moment(_0xb9f259[_0x9b3f('0x60')])[_0x9b3f('0x48')](_0x9b3f('0x49'))[_0x9b3f('0x53')](),'sender':_0xb9f259[_0x9b3f('0x72')]==='out'?_0xb9f259[_0x9b3f('0x5a')]?_0xb9f259['User'][_0x9b3f('0x66')]:_0x9b3f('0x73'):_0xb9f259[_0x9b3f('0x74')]['firstName']+(_0xb9f259[_0x9b3f('0x74')]['lastName']?'\x20'+_0xb9f259['Contact'][_0x9b3f('0x75')]:''),'body':_0xb9f259[_0x9b3f('0x5e')]?_0xb9f259[_0x9b3f('0x5e')][_0x9b3f('0x6e')]:_0xb9f259[_0x9b3f('0x39')],'direction':_0xb9f259[_0x9b3f('0x72')]==='out'?'A':'C','secret':_0xb9f259['secret'],'read':_0xb9f259[_0x9b3f('0x62')],'attachment':_0xb9f259['Attachment']};})[_0x9b3f('0x76')]()};return ejs['renderFile'](path[_0x9b3f('0x54')](config[_0x9b3f('0x55')],_0x9b3f('0x56'),'views',_0x9b3f('0x77')),{'interaction':_0x52252e})[_0x9b3f('0x1e')](function(_0x243d07){var _0x8d1f04=path['join'](_0x32b703,_0x9b3f('0x78')+_0x2dbc3a['id']+'-'+_0x4546da+_0x9b3f('0x79'));var _0xef6d9b={'path':_0x8d1f04,'channel':'Whatsapp','interactionId':_0x2dbc3a['id']};return pdf['createPdfFromHTML'](_0x243d07,_0xef6d9b);})[_0x9b3f('0x1e')](function(){return new BPromise(function(_0x237ed2,_0x574461){zipdir(_0x32b703,{'saveTo':_0x7cc6ac},function(_0x4c1c9f,_0x3390d9){if(_0x4c1c9f)return _0x574461(_0x4c1c9f);return _0x237ed2(_0x3390d9);});})[_0x9b3f('0x1e')](function(){return new BPromise(function(_0x35ba43,_0x52083b){rimraf(_0x32b703,function(_0x17d462){if(_0x17d462)_0x52083b(_0x17d462);return _0x35ba43();});});})['then'](function(){return _0x428e85[_0x9b3f('0x7a')](_0x7cc6ac,_0x5d6797,function(_0x36bb42){if(_0x36bb42){console[_0x9b3f('0x7b')](_0x9b3f('0x7c'),_0x36bb42);}else{fs[_0x9b3f('0x7d')](_0x7cc6ac);}});});});}else{return _0x428e85[_0x9b3f('0x12')](0xc8);}})[_0x9b3f('0x37')](handleError(_0x428e85,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b225ae0..4729e0a 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 _0x5712=['setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x47bf35,_0x159c89){var _0x32ea70=function(_0x1796cb){while(--_0x1796cb){_0x47bf35['push'](_0x47bf35['shift']());}};_0x32ea70(++_0x159c89);}(_0x5712,0x140));var _0x2571=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5712[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x2571('0x0'));var WhatsappInteraction=require(_0x2571('0x1'))['db'][_0x2571('0x2')];var WhatsappMessage=require(_0x2571('0x1'))['db'][_0x2571('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2571('0x4')](0x0);var events={'afterCreate':_0x2571('0x5'),'afterUpdate':_0x2571('0x6'),'afterDestroy':_0x2571('0x7')};function emitEvent(_0x42459b){return function(_0x53f883,_0x49d593,_0x4713ad){_0x53f883['getUsers']({'attributes':['id'],'raw':!![]})[_0x2571('0x8')](function(_0x251ee6){_0x53f883[_0x2571('0x9')](_0x2571('0xa'),_0x251ee6[_0x2571('0xb')](function(_0x26355f){return{'id':_0x26355f['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x53f883['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2571('0x8')](function(_0x558992){_0x53f883[_0x2571('0x9')](_0x2571('0xc'),_0x558992[_0x2571('0xd')]);WhatsappInteractionEvents[_0x2571('0xe')](_0x42459b+':'+_0x53f883['id'],_0x53f883);WhatsappInteractionEvents[_0x2571('0xe')](_0x42459b,_0x53f883);_0x4713ad(null);})[_0x2571('0xf')](_0x4713ad(null));};}for(var e in events){if(events[_0x2571('0x10')](e)){var event=events[e];WhatsappInteraction[_0x2571('0x11')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x422f=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x506a4f,_0x188735){var _0x59ab1b=function(_0x10ccdb){while(--_0x10ccdb){_0x506a4f['push'](_0x506a4f['shift']());}};_0x59ab1b(++_0x188735);}(_0x422f,0x1c7));var _0xf422=function(_0x31fe44,_0x33271b){_0x31fe44=_0x31fe44-0x0;var _0x424745=_0x422f[_0x31fe44];return _0x424745;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xf422('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xf422('0x0'))['db'][_0xf422('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf422('0x2'),'afterUpdate':_0xf422('0x3'),'afterDestroy':_0xf422('0x4')};function emitEvent(_0x444ad5){return function(_0x16047c,_0x434f27,_0x3e3e5d){_0x16047c[_0xf422('0x5')]({'attributes':['id'],'raw':!![]})[_0xf422('0x6')](function(_0x583283){_0x16047c[_0xf422('0x7')](_0xf422('0x8'),_0x583283[_0xf422('0x9')](function(_0x23a1bf){return{'id':_0x23a1bf['id']};}));return WhatsappMessage[_0xf422('0xa')]({'where':{'WhatsappInteractionId':_0x16047c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x419ec4){_0x16047c['setDataValue']('unreadMessages',_0x419ec4[_0xf422('0xb')]);WhatsappInteractionEvents[_0xf422('0xc')](_0x444ad5+':'+_0x16047c['id'],_0x16047c);WhatsappInteractionEvents[_0xf422('0xc')](_0x444ad5,_0x16047c);_0x3e3e5d(null);})[_0xf422('0xd')](_0x3e3e5d(null));};}for(var e in events){if(events[_0xf422('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf422('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index fdbc5b8..9b57722 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 _0x5f8e=['WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x2e8ff6,_0x2039a9){var _0x2e0682=function(_0x3dd1fa){while(--_0x3dd1fa){_0x2e8ff6['push'](_0x2e8ff6['shift']());}};_0x2e0682(++_0x2039a9);}(_0x5f8e,0x1aa));var _0xe5f8=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x5f8e[_0x26fc81];return _0x9feece;};'use strict';var _=require('lodash');var util=require(_0xe5f8('0x0'));var logger=require(_0xe5f8('0x1'))(_0xe5f8('0x2'));var moment=require(_0xe5f8('0x3'));var BPromise=require(_0xe5f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5f8('0x5'));var rimraf=require(_0xe5f8('0x6'));var config=require(_0xe5f8('0x7'));var attributes=require(_0xe5f8('0x8'));module['exports']=function(_0x494236,_0x2baa65){return _0x494236['define'](_0xe5f8('0x9'),attributes,{'tableName':_0xe5f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e3ab3,_0x1e0a11,_0x356708){if(_0x3e3ab3['changed'](_0xe5f8('0xb'))){_0x3e3ab3[_0xe5f8('0xc')]=moment()[_0xe5f8('0xd')](_0xe5f8('0xe'));}_0x356708(null,_0x3e3ab3);}}});}; \ No newline at end of file +var _0x7ff7=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','changed','closed','closedAt'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7ff7,0xef));var _0x77ff=function(_0x20c425,_0xe35a98){_0x20c425=_0x20c425-0x0;var _0x3e9a5c=_0x7ff7[_0x20c425];return _0x3e9a5c;};'use strict';var _=require(_0x77ff('0x0'));var util=require('util');var logger=require(_0x77ff('0x1'))(_0x77ff('0x2'));var moment=require(_0x77ff('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77ff('0x4'));var rimraf=require(_0x77ff('0x5'));var config=require(_0x77ff('0x6'));var attributes=require(_0x77ff('0x7'));module['exports']=function(_0x5e3b10,_0x3a5e03){return _0x5e3b10[_0x77ff('0x8')](_0x77ff('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cf9e3,_0x3be72b,_0x2638d9){if(_0x2cf9e3[_0x77ff('0xa')](_0x77ff('0xb'))){_0x2cf9e3[_0x77ff('0xc')]=moment()['format'](_0x77ff('0xd'));}_0x2638d9(null,_0x2cf9e3);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6b23d9c..07f2bf6 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 _0xd8f1=['body','options','raw','where','attributes','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UpdateWhatsappInteraction'];(function(_0x12c7e3,_0x417a84){var _0x348f08=function(_0x3b3052){while(--_0x3b3052){_0x12c7e3['push'](_0x12c7e3['shift']());}};_0x348f08(++_0x417a84);}(_0xd8f1,0x82));var _0x1d8f=function(_0x2d2b8e,_0x453b4b){_0x2d2b8e=_0x2d2b8e-0x0;var _0x556d19=_0xd8f1[_0x2d2b8e];return _0x556d19;};'use strict';var _=require(_0x1d8f('0x0'));var util=require(_0x1d8f('0x1'));var moment=require(_0x1d8f('0x2'));var BPromise=require(_0x1d8f('0x3'));var rs=require(_0x1d8f('0x4'));var fs=require('fs');var Redis=require(_0x1d8f('0x5'));var db=require(_0x1d8f('0x6'))['db'];var utils=require(_0x1d8f('0x7'));var logger=require('../../config/logger')(_0x1d8f('0x8'));var config=require(_0x1d8f('0x9'));var jayson=require(_0x1d8f('0xa'));var client=jayson[_0x1d8f('0xb')]['http']({'port':0x232a});config[_0x1d8f('0xc')]=_['defaults'](config[_0x1d8f('0xc')],{'host':_0x1d8f('0xd'),'port':0x18eb});var socket=require(_0x1d8f('0xe'))(new Redis(config[_0x1d8f('0xc')]));require(_0x1d8f('0xf'))[_0x1d8f('0x10')](socket);function respondWithRpcPromise(_0x763c0e,_0x318c16,_0x26a4c5){return new BPromise(function(_0x58935b,_0x178f94){return client[_0x1d8f('0x11')](_0x763c0e,_0x26a4c5)[_0x1d8f('0x12')](function(_0x6f7916){logger[_0x1d8f('0x13')](_0x1d8f('0x14'),_0x318c16,_0x1d8f('0x15'));logger[_0x1d8f('0x16')](_0x1d8f('0x17'),_0x318c16,_0x1d8f('0x15'),JSON[_0x1d8f('0x18')](_0x6f7916));if(_0x6f7916['error']){if(_0x6f7916['error'][_0x1d8f('0x19')]===0x1f4){logger[_0x1d8f('0x1a')](_0x1d8f('0x14'),_0x318c16,_0x6f7916[_0x1d8f('0x1a')]['message']);return _0x178f94(_0x6f7916[_0x1d8f('0x1a')]['message']);}logger[_0x1d8f('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x318c16,_0x6f7916['error'][_0x1d8f('0x1b')]);return _0x58935b(_0x6f7916['error'][_0x1d8f('0x1b')]);}else{logger[_0x1d8f('0x13')](_0x1d8f('0x14'),_0x318c16,_0x1d8f('0x15'));_0x58935b(_0x6f7916['result']['message']);}})[_0x1d8f('0x1c')](function(_0x10bb25){logger[_0x1d8f('0x1a')](_0x1d8f('0x14'),_0x318c16,_0x10bb25);_0x178f94(_0x10bb25);});});}exports[_0x1d8f('0x1d')]=function(_0x1a278d){var _0x331798=this;return new Promise(function(_0x35320c,_0x3a9fe1){return db['WhatsappInteraction']['update'](_0x1a278d[_0x1d8f('0x1e')],{'raw':_0x1a278d[_0x1d8f('0x1f')]?_0x1a278d['options'][_0x1d8f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a278d[_0x1d8f('0x1f')]?_0x1a278d[_0x1d8f('0x1f')][_0x1d8f('0x21')]||null:null,'attributes':_0x1a278d[_0x1d8f('0x1f')]?_0x1a278d['options'][_0x1d8f('0x22')]||null:null,'limit':_0x1a278d[_0x1d8f('0x1f')]?_0x1a278d[_0x1d8f('0x1f')]['limit']||null:null})[_0x1d8f('0x12')](function(_0x434c73){logger['info'](_0x1d8f('0x1d'),_0x1a278d);logger[_0x1d8f('0x16')]('UpdateWhatsappInteraction',_0x1a278d,JSON[_0x1d8f('0x18')](_0x434c73));_0x35320c(_0x434c73);})[_0x1d8f('0x1c')](function(_0x4a9798){logger[_0x1d8f('0x1a')](_0x1d8f('0x1d'),_0x4a9798['message'],_0x1a278d);_0x3a9fe1(_0x331798[_0x1d8f('0x1a')](0x1f4,_0x4a9798['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3f82a8){return new Promise(function(_0x46ddba,_0x50d53e){return db['WhatsappInteraction'][_0x1d8f('0x23')]({'where':_0x3f82a8['options']?_0x3f82a8[_0x1d8f('0x1f')]['where']||null:null})[_0x1d8f('0x12')](function(_0x4100eb){if(_0x4100eb){return _0x4100eb[_0x1d8f('0x24')](_0x3f82a8['body']['ids'],_[_0x1d8f('0x25')](_0x3f82a8[_0x1d8f('0x1e')],[_0x1d8f('0x26'),'id'])||{});}})['spread'](function(_0x18dcf1){logger[_0x1d8f('0x13')](_0x1d8f('0x27'),_0x3f82a8);logger['debug'](_0x1d8f('0x27'),_0x3f82a8,JSON[_0x1d8f('0x18')](_0x18dcf1));_0x46ddba(_0x18dcf1);})[_0x1d8f('0x1c')](function(_0x501ab8){logger[_0x1d8f('0x1a')](_0x1d8f('0x27'),_0x501ab8[_0x1d8f('0x1b')],_0x3f82a8);_0x50d53e(_this[_0x1d8f('0x1a')](0x1f4,_0x501ab8[_0x1d8f('0x1b')]));});});}; \ No newline at end of file +var _0x1abf=['stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','omit','ids','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x1abf,0x1d6));var _0xf1ab=function(_0xb49f68,_0x3b2899){_0xb49f68=_0xb49f68-0x0;var _0x503f83=_0x1abf[_0xb49f68];return _0x503f83;};'use strict';var _=require('lodash');var util=require(_0xf1ab('0x0'));var moment=require(_0xf1ab('0x1'));var BPromise=require('bluebird');var rs=require(_0xf1ab('0x2'));var fs=require('fs');var Redis=require(_0xf1ab('0x3'));var db=require(_0xf1ab('0x4'))['db'];var utils=require(_0xf1ab('0x5'));var logger=require(_0xf1ab('0x6'))(_0xf1ab('0x7'));var config=require(_0xf1ab('0x8'));var jayson=require(_0xf1ab('0x9'));var client=jayson[_0xf1ab('0xa')][_0xf1ab('0xb')]({'port':0x232a});config[_0xf1ab('0xc')]=_['defaults'](config[_0xf1ab('0xc')],{'host':_0xf1ab('0xd'),'port':0x18eb});var socket=require(_0xf1ab('0xe'))(new Redis(config[_0xf1ab('0xc')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x314474,_0xb4a110,_0x5a87d8){return new BPromise(function(_0xf6b23e,_0x342a86){return client[_0xf1ab('0xf')](_0x314474,_0x5a87d8)[_0xf1ab('0x10')](function(_0x36198a){logger[_0xf1ab('0x11')](_0xf1ab('0x12'),_0xb4a110,_0xf1ab('0x13'));logger[_0xf1ab('0x14')](_0xf1ab('0x15'),_0xb4a110,_0xf1ab('0x13'),JSON[_0xf1ab('0x16')](_0x36198a));if(_0x36198a[_0xf1ab('0x17')]){if(_0x36198a[_0xf1ab('0x17')][_0xf1ab('0x18')]===0x1f4){logger['error'](_0xf1ab('0x12'),_0xb4a110,_0x36198a[_0xf1ab('0x17')][_0xf1ab('0x19')]);return _0x342a86(_0x36198a[_0xf1ab('0x17')][_0xf1ab('0x19')]);}logger['error'](_0xf1ab('0x12'),_0xb4a110,_0x36198a[_0xf1ab('0x17')][_0xf1ab('0x19')]);return _0xf6b23e(_0x36198a[_0xf1ab('0x17')][_0xf1ab('0x19')]);}else{logger[_0xf1ab('0x11')](_0xf1ab('0x12'),_0xb4a110,'request\x20sent');_0xf6b23e(_0x36198a[_0xf1ab('0x1a')][_0xf1ab('0x19')]);}})[_0xf1ab('0x1b')](function(_0x1ca2ed){logger[_0xf1ab('0x17')](_0xf1ab('0x12'),_0xb4a110,_0x1ca2ed);_0x342a86(_0x1ca2ed);});});}exports[_0xf1ab('0x1c')]=function(_0x14a07c){var _0x5127d4=this;return new Promise(function(_0x734437,_0x41abb2){return db[_0xf1ab('0x1d')][_0xf1ab('0x1e')](_0x14a07c[_0xf1ab('0x1f')],{'raw':_0x14a07c['options']?_0x14a07c[_0xf1ab('0x20')][_0xf1ab('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a07c['options']?_0x14a07c[_0xf1ab('0x20')][_0xf1ab('0x22')]||null:null,'attributes':_0x14a07c[_0xf1ab('0x20')]?_0x14a07c[_0xf1ab('0x20')][_0xf1ab('0x23')]||null:null,'limit':_0x14a07c[_0xf1ab('0x20')]?_0x14a07c[_0xf1ab('0x20')][_0xf1ab('0x24')]||null:null})[_0xf1ab('0x10')](function(_0x531674){logger[_0xf1ab('0x11')]('UpdateWhatsappInteraction',_0x14a07c);logger[_0xf1ab('0x14')]('UpdateWhatsappInteraction',_0x14a07c,JSON[_0xf1ab('0x16')](_0x531674));_0x734437(_0x531674);})[_0xf1ab('0x1b')](function(_0x5f4be8){logger[_0xf1ab('0x17')]('UpdateWhatsappInteraction',_0x5f4be8[_0xf1ab('0x19')],_0x14a07c);_0x41abb2(_0x5127d4[_0xf1ab('0x17')](0x1f4,_0x5f4be8[_0xf1ab('0x19')]));});});};exports[_0xf1ab('0x25')]=function(_0x2e03fe){return new Promise(function(_0x4c8d4a,_0x5532a6){return db[_0xf1ab('0x1d')]['find']({'where':_0x2e03fe['options']?_0x2e03fe['options'][_0xf1ab('0x22')]||null:null})[_0xf1ab('0x10')](function(_0x53253d){if(_0x53253d){return _0x53253d['addTags'](_0x2e03fe[_0xf1ab('0x1f')]['ids'],_[_0xf1ab('0x26')](_0x2e03fe[_0xf1ab('0x1f')],[_0xf1ab('0x27'),'id'])||{});}})['spread'](function(_0x552c15){logger['info'](_0xf1ab('0x28'),_0x2e03fe);logger[_0xf1ab('0x14')]('AddTags',_0x2e03fe,JSON[_0xf1ab('0x16')](_0x552c15));_0x4c8d4a(_0x552c15);})[_0xf1ab('0x1b')](function(_0x4c33b4){logger[_0xf1ab('0x17')](_0xf1ab('0x28'),_0x4c33b4[_0xf1ab('0x19')],_0x2e03fe);_0x5532a6(_this[_0xf1ab('0x17')](0x1f4,_0x4c33b4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 91b7f48..4f4538a 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 _0x58eb=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x1f538a,_0x46abdb){var _0x33a374=function(_0x42698f){while(--_0x42698f){_0x1f538a['push'](_0x1f538a['shift']());}};_0x33a374(++_0x46abdb);}(_0x58eb,0x199));var _0xb58e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x58eb[_0x1abb09];return _0xea1c07;};'use strict';var WhatsappInteractionEvents=require(_0xb58e('0x0'));var events=[_0xb58e('0x1'),_0xb58e('0x2'),_0xb58e('0x3')];function createListener(_0x20d524,_0x22f140){return function(_0x83c143){_0x22f140[_0xb58e('0x4')](_0x20d524,_0x83c143);};}function removeListener(_0xb8247c,_0x2b8238){return function(){WhatsappInteractionEvents[_0xb58e('0x5')](_0xb8247c,_0x2b8238);};}exports[_0xb58e('0x6')]=function(_0x3ca816){for(var _0x3b60ef=0x0,_0x3b28e4=events[_0xb58e('0x7')];_0x3b60ef<_0x3b28e4;_0x3b60ef++){var _0x3fac36=events[_0x3b60ef];var _0x166a52=createListener(_0xb58e('0x8')+_0x3fac36,_0x3ca816);WhatsappInteractionEvents['on'](_0x3fac36,_0x166a52);}}; \ No newline at end of file +var _0xb7d5=['update','emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xb7d5,0x116));var _0x5b7d=function(_0x18b47d,_0x170b85){_0x18b47d=_0x18b47d-0x0;var _0x1b0086=_0xb7d5[_0x18b47d];return _0x1b0086;};'use strict';var WhatsappInteractionEvents=require(_0x5b7d('0x0'));var events=[_0x5b7d('0x1'),'remove',_0x5b7d('0x2')];function createListener(_0x403b0a,_0x5db728){return function(_0x165f07){_0x5db728[_0x5b7d('0x3')](_0x403b0a,_0x165f07);};}function removeListener(_0x2dda76,_0x425cbd){return function(){WhatsappInteractionEvents['removeListener'](_0x2dda76,_0x425cbd);};}exports[_0x5b7d('0x4')]=function(_0x3561ef){for(var _0x25109f=0x0,_0x37b745=events[_0x5b7d('0x5')];_0x25109f<_0x37b745;_0x25109f++){var _0x4219a7=events[_0x25109f];var _0xdb5304=createListener(_0x5b7d('0x6')+_0x4219a7,_0x3561ef);WhatsappInteractionEvents['on'](_0x4219a7,_0xdb5304);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 7a4c976..fbbc429 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 _0x49dd=['whatsapp','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','show','post','tracked'];(function(_0x5c50ac,_0x12a10a){var _0x1fba86=function(_0x38a6ff){while(--_0x38a6ff){_0x5c50ac['push'](_0x5c50ac['shift']());}};_0x1fba86(++_0x12a10a);}(_0x49dd,0x16a));var _0xd49d=function(_0x5de22f,_0x5a1b8b){_0x5de22f=_0x5de22f-0x0;var _0x5dca4a=_0x49dd[_0x5de22f];return _0x5dca4a;};'use strict';var multer=require('multer');var util=require(_0xd49d('0x0'));var path=require(_0xd49d('0x1'));var timeout=require(_0xd49d('0x2'));var express=require(_0xd49d('0x3'));var router=express[_0xd49d('0x4')]();var fs_extra=require(_0xd49d('0x5'));var auth=require(_0xd49d('0x6'));var interaction=require(_0xd49d('0x7'));var config=require(_0xd49d('0x8'));var controller=require(_0xd49d('0x9'));router[_0xd49d('0xa')]('/',auth[_0xd49d('0xb')](),controller[_0xd49d('0xc')]);router[_0xd49d('0xa')]('/describe',auth[_0xd49d('0xb')](),controller['describe']);router[_0xd49d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd49d('0xd')]);router[_0xd49d('0xe')]('/',auth['isAuthenticated'](),interaction[_0xd49d('0xf')](_0xd49d('0x10'),'whatsappmessage:create'),controller[_0xd49d('0x11')]);router[_0xd49d('0xe')](_0xd49d('0x12'),controller[_0xd49d('0x13')]);router[_0xd49d('0x14')](_0xd49d('0x15'),auth[_0xd49d('0xb')](),controller['update']);router[_0xd49d('0x14')](_0xd49d('0x16'),auth[_0xd49d('0xb')](),controller[_0xd49d('0x17')]);router[_0xd49d('0x14')](_0xd49d('0x18'),auth[_0xd49d('0xb')](),controller[_0xd49d('0x19')]);router[_0xd49d('0x1a')](_0xd49d('0x15'),auth[_0xd49d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5c12=['index','/describe','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','/:id','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x46dab8,_0x4ef8ed){var _0x3d1e3a=function(_0x4579fe){while(--_0x4579fe){_0x46dab8['push'](_0x46dab8['shift']());}};_0x3d1e3a(++_0x4ef8ed);}(_0x5c12,0xbf));var _0x25c1=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x5c12[_0x126f47];return _0x49508a;};'use strict';var multer=require(_0x25c1('0x0'));var util=require(_0x25c1('0x1'));var path=require('path');var timeout=require(_0x25c1('0x2'));var express=require(_0x25c1('0x3'));var router=express[_0x25c1('0x4')]();var fs_extra=require(_0x25c1('0x5'));var auth=require(_0x25c1('0x6'));var interaction=require(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var controller=require(_0x25c1('0x9'));router[_0x25c1('0xa')]('/',auth[_0x25c1('0xb')](),controller[_0x25c1('0xc')]);router[_0x25c1('0xa')](_0x25c1('0xd'),auth[_0x25c1('0xb')](),controller[_0x25c1('0xe')]);router[_0x25c1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')]('/',auth[_0x25c1('0xb')](),interaction[_0x25c1('0x11')](_0x25c1('0x12'),_0x25c1('0x13')),controller[_0x25c1('0x14')]);router[_0x25c1('0x10')]('/:id/status',controller[_0x25c1('0x15')]);router[_0x25c1('0x16')](_0x25c1('0x17'),auth[_0x25c1('0xb')](),controller['update']);router[_0x25c1('0x16')](_0x25c1('0x18'),auth[_0x25c1('0xb')](),controller['accept']);router['put'](_0x25c1('0x19'),auth[_0x25c1('0xb')](),controller['reject']);router[_0x25c1('0x1a')]('/:id',auth[_0x25c1('0xb')](),controller[_0x25c1('0x1b')]);module[_0x25c1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7c49d96..26d80ab 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 _0x34e7=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','exports','medium'];(function(_0x569eb3,_0x338a0c){var _0x203115=function(_0x24b50a){while(--_0x24b50a){_0x569eb3['push'](_0x569eb3['shift']());}};_0x203115(++_0x338a0c);}(_0x34e7,0x1be));var _0x734e=function(_0x5880ad,_0x4da2dc){_0x5880ad=_0x5880ad-0x0;var _0x5b3222=_0x34e7[_0x5880ad];return _0x5b3222;};'use strict';var Sequelize=require('sequelize');module[_0x734e('0x0')]={'body':{'type':Sequelize['TEXT'](_0x734e('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x734e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x734e('0x3')]('in',_0x734e('0x4')),'defaultValue':_0x734e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x734e('0x5')]},'readAt':{'type':Sequelize[_0x734e('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x734e('0x5')]},'providerResponse':{'type':Sequelize[_0x734e('0x7')]}}; \ No newline at end of file +var _0x5097=['TEXT','BOOLEAN','STRING','DATE','sequelize','exports'];(function(_0x100ca3,_0x37d616){var _0x2d572e=function(_0x1f504c){while(--_0x1f504c){_0x100ca3['push'](_0x100ca3['shift']());}};_0x2d572e(++_0x37d616);}(_0x5097,0x1ae));var _0x7509=function(_0x4b61f0,_0x414129){_0x4b61f0=_0x4b61f0-0x0;var _0x9de7de=_0x5097[_0x4b61f0];return _0x9de7de;};'use strict';var Sequelize=require(_0x7509('0x0'));module[_0x7509('0x1')]={'body':{'type':Sequelize[_0x7509('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7509('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7509('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7509('0x5')]},'secret':{'type':Sequelize[_0x7509('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7509('0x4')]},'providerResponse':{'type':Sequelize[_0x7509('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6d949b4..a50767b 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 _0xcf83=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','index','map','WhatsappMessage','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','params','rawAttributes','length','includeAll','include','find','create','body','update','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','User','interface','rejectmessage','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus'];(function(_0x46e5cc,_0x2d646e){var _0x4d79e5=function(_0x5984b6){while(--_0x5984b6){_0x46e5cc['push'](_0x46e5cc['shift']());}};_0x4d79e5(++_0x2d646e);}(_0xcf83,0x182));var _0x3cf8=function(_0x3bded8,_0x4cbb26){_0x3bded8=_0x3bded8-0x0;var _0x5e6421=_0xcf83[_0x3bded8];return _0x5e6421;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cf8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cf8('0x1'));var rp=require(_0x3cf8('0x2'));var moment=require(_0x3cf8('0x3'));var BPromise=require(_0x3cf8('0x4'));var Mustache=require(_0x3cf8('0x5'));var util=require('util');var path=require(_0x3cf8('0x6'));var sox=require('sox');var csv=require(_0x3cf8('0x7'));var ejs=require(_0x3cf8('0x8'));var fs=require('fs');var fs_extra=require(_0x3cf8('0x9'));var _=require(_0x3cf8('0xa'));var squel=require(_0x3cf8('0xb'));var crypto=require(_0x3cf8('0xc'));var jsforce=require(_0x3cf8('0xd'));var deskjs=require(_0x3cf8('0xe'));var toCsv=require(_0x3cf8('0x7'));var querystring=require(_0x3cf8('0xf'));var Papa=require(_0x3cf8('0x10'));var Redis=require('ioredis');var authService=require(_0x3cf8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cf8('0x12'));var logger=require('../../config/logger')(_0x3cf8('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3cf8('0x14'));var db=require(_0x3cf8('0x15'))['db'];config[_0x3cf8('0x16')]=_[_0x3cf8('0x17')](config[_0x3cf8('0x16')],{'host':_0x3cf8('0x18'),'port':0x18eb});var socket=require(_0x3cf8('0x19'))(new Redis(config[_0x3cf8('0x16')]));require('./whatsappMessage.socket')[_0x3cf8('0x1a')](socket);var jayson=require(_0x3cf8('0x1b'));var client=jayson[_0x3cf8('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x3cf8('0x1c')][_0x3cf8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x56fa9b,_0x197ff2,_0x1ce48d,_0x2b0547){return new BPromise(function(_0x178ac9,_0x2d8c8e){var _0xf593a5=_0x2b0547||client;return _0xf593a5[_0x3cf8('0x1e')](_0x56fa9b,_0x1ce48d)[_0x3cf8('0x1f')](function(_0x2557a7){logger[_0x3cf8('0x20')](_0x3cf8('0x21'),_0x197ff2,_0x3cf8('0x22'));logger[_0x3cf8('0x23')](_0x3cf8('0x24'),_0x197ff2,_0x3cf8('0x22'),JSON['stringify'](_0x2557a7));if(_0x2557a7[_0x3cf8('0x25')]){if(_0x2557a7[_0x3cf8('0x25')][_0x3cf8('0x26')]===0x1f4){logger['error'](_0x3cf8('0x21'),_0x197ff2,_0x2557a7['error'][_0x3cf8('0x27')]);return _0x2d8c8e(_0x2557a7[_0x3cf8('0x25')]['message']);}logger[_0x3cf8('0x25')](_0x3cf8('0x21'),_0x197ff2,_0x2557a7[_0x3cf8('0x25')][_0x3cf8('0x27')]);return _0x178ac9(_0x2557a7[_0x3cf8('0x25')][_0x3cf8('0x27')]);}else{logger[_0x3cf8('0x20')](_0x3cf8('0x21'),_0x197ff2,_0x3cf8('0x22'));_0x178ac9(_0x2557a7[_0x3cf8('0x28')]['message']);}})[_0x3cf8('0x29')](function(_0x86c328){logger[_0x3cf8('0x25')](_0x3cf8('0x21'),_0x197ff2,_0x86c328);_0x2d8c8e(_0x86c328);});});}function respondWithStatusCode(_0x38794e,_0x4bb74b){_0x4bb74b=_0x4bb74b||0xcc;return function(_0x32e2d0){if(_0x32e2d0){return _0x38794e[_0x3cf8('0x2a')](_0x4bb74b);}return _0x38794e[_0x3cf8('0x2b')](_0x4bb74b)[_0x3cf8('0x2c')]();};}function respondWithResult(_0x2386bc,_0x33c04b){_0x33c04b=_0x33c04b||0xc8;return function(_0x10ea77){if(_0x10ea77){return _0x2386bc[_0x3cf8('0x2b')](_0x33c04b)[_0x3cf8('0x2d')](_0x10ea77);}};}function respondWithFilteredResult(_0x4269f4,_0x57c846){return function(_0x42438c){if(_0x42438c){var _0x2ce2c7=typeof _0x57c846[_0x3cf8('0x2e')]===_0x3cf8('0x2f')&&typeof _0x57c846[_0x3cf8('0x30')]===_0x3cf8('0x2f');var _0x128765=_0x42438c[_0x3cf8('0x31')];var _0x373d8a=_0x2ce2c7?0x0:_0x57c846['offset'];var _0x2d00b4=_0x2ce2c7?_0x42438c['count']:_0x57c846[_0x3cf8('0x2e')]+_0x57c846[_0x3cf8('0x30')];var _0x4b5e99;if(_0x2d00b4>=_0x128765){_0x2d00b4=_0x128765;_0x4b5e99=0xc8;}else{_0x4b5e99=0xce;}_0x4269f4[_0x3cf8('0x2b')](_0x4b5e99);return _0x4269f4[_0x3cf8('0x32')](_0x3cf8('0x33'),_0x373d8a+'-'+_0x2d00b4+'/'+_0x128765)['json'](_0x42438c);}return null;};}function patchUpdates(_0x243c4d){return function(_0x3832f8){try{jsonpatch['apply'](_0x3832f8,_0x243c4d,!![]);}catch(_0xe2fd7f){return BPromise[_0x3cf8('0x34')](_0xe2fd7f);}return _0x3832f8[_0x3cf8('0x35')]();};}function saveUpdates(_0x1a4657,_0x17611f){return function(_0xc71155){if(_0xc71155){return _0xc71155['update'](_0x1a4657)[_0x3cf8('0x1f')](function(_0x55c435){return _0x55c435;});}return null;};}function removeEntity(_0x1f766a,_0x4b41f3){return function(_0x8af6c3){if(_0x8af6c3){return _0x8af6c3[_0x3cf8('0x36')]()[_0x3cf8('0x1f')](function(){_0x1f766a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17b6b1,_0x5528ba){return function(_0x163a03){if(!_0x163a03){_0x17b6b1[_0x3cf8('0x2a')](0x194);}return _0x163a03;};}function handleError(_0x211ebf,_0x421df1){_0x421df1=_0x421df1||0x1f4;return function(_0x353515){logger[_0x3cf8('0x25')](_0x353515[_0x3cf8('0x37')]);if(_0x353515[_0x3cf8('0x38')]){delete _0x353515['name'];}_0x211ebf[_0x3cf8('0x2b')](_0x421df1)['send'](_0x353515);};}exports[_0x3cf8('0x39')]=function(_0x2b918f,_0x10fdf6){var _0x39d82c={},_0x3baca9={},_0x3f0287={'count':0x0,'rows':[]};var _0x4da3fe=_[_0x3cf8('0x3a')](db[_0x3cf8('0x3b')]['rawAttributes'],function(_0x49895d){return{'name':_0x49895d['fieldName'],'type':_0x49895d[_0x3cf8('0x3c')][_0x3cf8('0x3d')]};});_0x3baca9['model']=_[_0x3cf8('0x3a')](_0x4da3fe,_0x3cf8('0x38'));_0x3baca9[_0x3cf8('0x3e')]=_[_0x3cf8('0x3f')](_0x2b918f[_0x3cf8('0x3e')]);_0x3baca9[_0x3cf8('0x40')]=_[_0x3cf8('0x41')](_0x3baca9[_0x3cf8('0x42')],_0x3baca9[_0x3cf8('0x3e')]);_0x39d82c[_0x3cf8('0x43')]=_['intersection'](_0x3baca9[_0x3cf8('0x42')],qs[_0x3cf8('0x44')](_0x2b918f['query']['fields']));_0x39d82c[_0x3cf8('0x43')]=_0x39d82c[_0x3cf8('0x43')]['length']?_0x39d82c['attributes']:_0x3baca9[_0x3cf8('0x42')];if(!_0x2b918f[_0x3cf8('0x3e')][_0x3cf8('0x45')](_0x3cf8('0x46'))){_0x39d82c[_0x3cf8('0x30')]=qs[_0x3cf8('0x30')](_0x2b918f[_0x3cf8('0x3e')][_0x3cf8('0x30')]);_0x39d82c[_0x3cf8('0x2e')]=qs[_0x3cf8('0x2e')](_0x2b918f[_0x3cf8('0x3e')][_0x3cf8('0x2e')]);}_0x39d82c[_0x3cf8('0x47')]=qs[_0x3cf8('0x48')](_0x2b918f[_0x3cf8('0x3e')][_0x3cf8('0x48')]);_0x39d82c['where']=qs['filters'](_[_0x3cf8('0x49')](_0x2b918f[_0x3cf8('0x3e')],_0x3baca9[_0x3cf8('0x40')]),_0x4da3fe);if(_0x2b918f['query'][_0x3cf8('0x4a')]){_0x39d82c[_0x3cf8('0x4b')]=_[_0x3cf8('0x4c')](_0x39d82c[_0x3cf8('0x4b')],{'$or':_[_0x3cf8('0x3a')](_0x4da3fe,function(_0x4a36c4){if(_0x4a36c4[_0x3cf8('0x3c')]!==_0x3cf8('0x4d')){var _0xafb33f={};_0xafb33f[_0x4a36c4[_0x3cf8('0x38')]]={'$like':'%'+_0x2b918f[_0x3cf8('0x3e')]['filter']+'%'};return _0xafb33f;}})});}_0x39d82c=_[_0x3cf8('0x4c')]({},_0x39d82c,_0x2b918f[_0x3cf8('0x4e')]);var _0x1f43c7={'where':_0x39d82c['where']};return db[_0x3cf8('0x3b')][_0x3cf8('0x31')](_0x1f43c7)[_0x3cf8('0x1f')](function(_0x27be4a){_0x3f0287['count']=_0x27be4a;if(_0x2b918f['query']['includeAll']){_0x39d82c['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x3cf8('0x4f')](_0x39d82c);})[_0x3cf8('0x1f')](function(_0x2f22a3){_0x3f0287[_0x3cf8('0x50')]=_0x2f22a3;return _0x3f0287;})[_0x3cf8('0x1f')](respondWithFilteredResult(_0x10fdf6,_0x39d82c))[_0x3cf8('0x29')](handleError(_0x10fdf6,null));};exports['show']=function(_0x39aff7,_0x1c11bb){var _0x51dc78={'raw':!![],'where':{'id':_0x39aff7[_0x3cf8('0x51')]['id']}},_0x5805ce={};_0x5805ce[_0x3cf8('0x42')]=_['keys'](db[_0x3cf8('0x3b')][_0x3cf8('0x52')]);_0x5805ce['query']=_[_0x3cf8('0x3f')](_0x39aff7[_0x3cf8('0x3e')]);_0x5805ce['filters']=_[_0x3cf8('0x41')](_0x5805ce['model'],_0x5805ce[_0x3cf8('0x3e')]);_0x51dc78[_0x3cf8('0x43')]=_['intersection'](_0x5805ce[_0x3cf8('0x42')],qs[_0x3cf8('0x44')](_0x39aff7[_0x3cf8('0x3e')][_0x3cf8('0x44')]));_0x51dc78[_0x3cf8('0x43')]=_0x51dc78[_0x3cf8('0x43')][_0x3cf8('0x53')]?_0x51dc78[_0x3cf8('0x43')]:_0x5805ce[_0x3cf8('0x42')];if(_0x39aff7[_0x3cf8('0x3e')][_0x3cf8('0x54')]){_0x51dc78[_0x3cf8('0x55')]=[{'all':!![]}];}_0x51dc78=_[_0x3cf8('0x4c')]({},_0x51dc78,_0x39aff7[_0x3cf8('0x4e')]);return db[_0x3cf8('0x3b')][_0x3cf8('0x56')](_0x51dc78)['then'](handleEntityNotFound(_0x1c11bb,null))[_0x3cf8('0x1f')](respondWithResult(_0x1c11bb,null))[_0x3cf8('0x29')](handleError(_0x1c11bb,null));};exports[_0x3cf8('0x57')]=function(_0x21b57d,_0x3feefd){return db[_0x3cf8('0x3b')][_0x3cf8('0x57')](_0x21b57d[_0x3cf8('0x58')],{})[_0x3cf8('0x1f')](respondWithResult(_0x3feefd,0xc9))[_0x3cf8('0x29')](handleError(_0x3feefd,null));};exports[_0x3cf8('0x59')]=function(_0x6e3aad,_0x4d59b4){if(_0x6e3aad[_0x3cf8('0x58')]['id']){delete _0x6e3aad['body']['id'];}return db[_0x3cf8('0x3b')]['find']({'where':{'id':_0x6e3aad[_0x3cf8('0x51')]['id']}})[_0x3cf8('0x1f')](handleEntityNotFound(_0x4d59b4,null))[_0x3cf8('0x1f')](saveUpdates(_0x6e3aad[_0x3cf8('0x58')],null))[_0x3cf8('0x1f')](respondWithResult(_0x4d59b4,null))['catch'](handleError(_0x4d59b4,null));};exports[_0x3cf8('0x36')]=function(_0xe8c144,_0x2d0cce){return db[_0x3cf8('0x3b')][_0x3cf8('0x56')]({'where':{'id':_0xe8c144['params']['id']}})[_0x3cf8('0x1f')](handleEntityNotFound(_0x2d0cce,null))[_0x3cf8('0x1f')](removeEntity(_0x2d0cce,null))[_0x3cf8('0x29')](handleError(_0x2d0cce,null));};exports[_0x3cf8('0x5a')]=function(_0xace54d,_0x15ed9f){return db['WhatsappMessage'][_0x3cf8('0x5a')]()[_0x3cf8('0x1f')](respondWithResult(_0x15ed9f,null))[_0x3cf8('0x29')](handleError(_0x15ed9f,null));};var interaction_log=require(_0x3cf8('0x5b'))(_0x3cf8('0x5c'));exports['accept']=function(_0x521c4c,_0x28f0b7,_0x2042cd){var _0x2f9407={'agent':{},'channel':_0x3cf8('0x5d')};if(_0x521c4c[_0x3cf8('0x58')]['id']){delete _0x521c4c[_0x3cf8('0x58')]['id'];}_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x5e')]=!![];_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x5f')]=moment()[_0x3cf8('0x60')](_0x3cf8('0x61'));_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x62')]=_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x62')]||_0x521c4c[_0x3cf8('0x63')]['id'];_0x2f9407[_0x3cf8('0x64')]['id']=_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x62')];return db[_0x3cf8('0x3b')][_0x3cf8('0x56')]({'where':{'id':_0x521c4c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28f0b7,null))[_0x3cf8('0x1f')](saveUpdates(_0x521c4c[_0x3cf8('0x58')],null))['then'](function(_0x2d5be1){if(_0x2d5be1){_0x2f9407[_0x3cf8('0x27')]=_0x2d5be1[_0x3cf8('0x65')]({'plain':!![]});return db[_0x3cf8('0x66')][_0x3cf8('0x56')]({'where':{'id':_0x2d5be1[_0x3cf8('0x67')]}});}return null;})[_0x3cf8('0x1f')](handleEntityNotFound(_0x28f0b7,null))['then'](function(_0x29a8c4){if(_0x29a8c4){return _0x29a8c4[_0x3cf8('0x59')]({'UserId':_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x62')],'read1stAt':_['isNil'](_0x29a8c4[_0x3cf8('0x68')])?moment()['format'](_0x3cf8('0x61')):undefined});}return null;})[_0x3cf8('0x1f')](function(_0x57b6b9){if(_0x57b6b9){_0x2f9407[_0x3cf8('0x69')]=_0x57b6b9[_0x3cf8('0x65')]({'plain':!![]});interaction_log[_0x3cf8('0x20')](_0x3cf8('0x6a'),_0x521c4c[_0x3cf8('0x63')]['id'],_0x521c4c[_0x3cf8('0x63')][_0x3cf8('0x38')],_0x521c4c[_0x3cf8('0x63')][_0x3cf8('0x6b')],_0x2f9407['interaction']['id'],_0x521c4c['body']?JSON['stringify'](_0x521c4c['body']):_0x3cf8('0x6c'));return respondWithRpcPromise(_0x3cf8('0x6d'),_0x3cf8('0x6e'),_0x2f9407);}return null;})['then'](function(_0x25cbf6){var _0x17df4e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25cbf6[_0x3cf8('0x27')][_0x3cf8('0x6f')];return db['sequelize'][_0x3cf8('0x3e')](_0x17df4e,{'type':db[_0x3cf8('0x70')][_0x3cf8('0x71')][_0x3cf8('0x72')],'raw':!![]})[_0x3cf8('0x1f')](function(_0x463845){return _0x463845;});})[_0x3cf8('0x1f')](function(_0x3e1b0a){if(_0x3e1b0a){_0x2f9407[_0x3cf8('0x27')][_0x3cf8('0x73')]=_0x3e1b0a[0x0];if(!_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x62')])return;return db['User'][_0x3cf8('0x56')]({'where':{'id':_0x521c4c[_0x3cf8('0x58')][_0x3cf8('0x62')],'role':_0x3cf8('0x64')},'attributes':['id',_0x3cf8('0x38'),_0x3cf8('0x74'),_0x3cf8('0x75'),_0x3cf8('0x76')],'raw':!![]});}return null;})[_0x3cf8('0x1f')](function(_0x584970){if(!_0x584970)return null;_0x2f9407[_0x3cf8('0x27')][_0x3cf8('0x64')]=_0x584970;return _0x2f9407;})[_0x3cf8('0x1f')](function(_0x4466c6){if(_0x4466c6){if(_0x521c4c['body'][_0x3cf8('0x77')]){_0x2f9407[_0x3cf8('0x27')]['interface']=util[_0x3cf8('0x60')](_0x3cf8('0x78'),_0x521c4c['user']['name']);_0x2f9407[_0x3cf8('0x27')][_0x3cf8('0x79')]=_0x2f9407['channel'];_0x2f9407[_0x3cf8('0x27')][_0x3cf8('0x7a')]=_0x2f9407[_0x3cf8('0x79')];_0x2f9407[_0x3cf8('0x27')][_0x3cf8('0x7b')]=_0x3cf8('0x7c');return respondWithRpcPromise(_0x3cf8('0x7d'),_0x3cf8('0x7d'),{'event':_0x3cf8('0x7e'),'message':_0x2f9407['message']},client9002)[_0x3cf8('0x1f')](function(){return _0x2f9407;});}return _0x2f9407;}return null;})[_0x3cf8('0x1f')](respondWithResult(_0x28f0b7,null))[_0x3cf8('0x29')](handleError(_0x28f0b7,null));};var interaction_log=require(_0x3cf8('0x5b'))('whatsapp-interactions');exports['reject']=function(_0x1df8bb,_0x136391,_0x2b790a){var _0x111585={'agent':{},'channel':_0x3cf8('0x5d')};if(_0x1df8bb[_0x3cf8('0x58')]['id']){delete _0x1df8bb[_0x3cf8('0x58')]['id'];}_0x1df8bb[_0x3cf8('0x58')]['UserId']=_0x1df8bb[_0x3cf8('0x58')][_0x3cf8('0x62')]||_0x1df8bb[_0x3cf8('0x63')]['id'];_0x111585[_0x3cf8('0x64')]['id']=_0x1df8bb[_0x3cf8('0x58')][_0x3cf8('0x62')];return db['WhatsappMessage']['find']({'where':{'id':_0x1df8bb[_0x3cf8('0x51')]['id'],'UserId':null}})[_0x3cf8('0x1f')](handleEntityNotFound(_0x136391,null))[_0x3cf8('0x1f')](function(_0x2af63c){if(_0x2af63c){_0x111585[_0x3cf8('0x27')]=_0x2af63c[_0x3cf8('0x65')]({'plain':!![]});return db[_0x3cf8('0x66')]['find']({'where':{'id':_0x2af63c[_0x3cf8('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x136391,null))[_0x3cf8('0x1f')](function(_0x2f1ddd){if(_0x2f1ddd){_0x111585[_0x3cf8('0x69')]=_0x2f1ddd[_0x3cf8('0x65')]({'plain':!![]});interaction_log[_0x3cf8('0x20')](_0x3cf8('0x7f'),_0x1df8bb[_0x3cf8('0x63')]['id'],_0x1df8bb[_0x3cf8('0x63')][_0x3cf8('0x38')],_0x1df8bb[_0x3cf8('0x63')][_0x3cf8('0x6b')],_0x111585[_0x3cf8('0x69')]['id'],_0x1df8bb[_0x3cf8('0x58')]?JSON[_0x3cf8('0x80')](_0x1df8bb[_0x3cf8('0x58')]):_0x3cf8('0x6c'));return respondWithRpcPromise(_0x3cf8('0x81'),_0x3cf8('0x82'),_0x111585);}return null;})[_0x3cf8('0x1f')](function(_0x38024f){var _0x2ac7de=_0x3cf8('0x83')+_0x38024f[_0x3cf8('0x27')][_0x3cf8('0x6f')];return db[_0x3cf8('0x84')]['query'](_0x2ac7de,{'type':db[_0x3cf8('0x70')][_0x3cf8('0x71')][_0x3cf8('0x72')],'raw':!![]})[_0x3cf8('0x1f')](function(_0x4cd7ab){return _0x4cd7ab;});})[_0x3cf8('0x1f')](function(_0x5201df){if(_0x5201df){_0x111585['message'][_0x3cf8('0x73')]=_0x5201df[0x0];if(!_0x1df8bb['body'][_0x3cf8('0x62')])return;return db[_0x3cf8('0x85')][_0x3cf8('0x56')]({'where':{'id':_0x1df8bb[_0x3cf8('0x58')][_0x3cf8('0x62')],'role':_0x3cf8('0x64')},'attributes':['id',_0x3cf8('0x38'),_0x3cf8('0x74'),_0x3cf8('0x75'),'internal'],'raw':!![]});}return null;})[_0x3cf8('0x1f')](function(_0xb2ceb7){if(!_0xb2ceb7)return null;_0x111585[_0x3cf8('0x27')][_0x3cf8('0x64')]=_0xb2ceb7;return _0x111585;})[_0x3cf8('0x1f')](function(_0x3f4e69){if(_0x3f4e69){_0x3f4e69['message'][_0x3cf8('0x86')]=util['format']('SIP/%s',_0x1df8bb['user']['name']);_0x3f4e69['message'][_0x3cf8('0x79')]=_0x111585[_0x3cf8('0x79')];_0x3f4e69[_0x3cf8('0x27')][_0x3cf8('0x7a')]=_0x111585['channel'];_0x3f4e69[_0x3cf8('0x27')][_0x3cf8('0x7b')]=_0x3cf8('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0x3cf8('0x87'),'message':_0x3f4e69[_0x3cf8('0x27')]},client9002);return _0x111585;}return null;})[_0x3cf8('0x1f')](respondWithResult(_0x136391,null))[_0x3cf8('0x29')](handleError(_0x136391,null));};exports['status']=function(_0x2cfa69,_0x39a5b9,_0x225c86){if(_0x2cfa69[_0x3cf8('0x58')]['id']){delete _0x2cfa69[_0x3cf8('0x58')]['id'];}var _0x4fa981;return db['WhatsappMessage']['find']({'where':{'id':_0x2cfa69['params']['id']}})[_0x3cf8('0x1f')](handleEntityNotFound(_0x39a5b9,null))[_0x3cf8('0x1f')](function(_0x437b68){if(_0x437b68){_0x4fa981=_0x437b68;return db['WhatsappAccount']['find']({'where':{'id':_0x437b68['WhatsappAccountId']}});}})[_0x3cf8('0x1f')](handleEntityNotFound(_0x39a5b9,null))['then'](function(_0x5446dd){if(_0x5446dd){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x3cf8('0x88'),_0x5446dd[_0x3cf8('0x3c')],util['inspect'](_0x2cfa69[_0x3cf8('0x58')],{'showHidden':![],'depth':null}));switch(_0x5446dd[_0x3cf8('0x3c')]){case _0x3cf8('0x89'):if(_0x2cfa69[_0x3cf8('0x58')]['MessageSid']&&_0x2cfa69['body'][_0x3cf8('0x8a')]===_0x4fa981[_0x3cf8('0x8b')]&&_0x2cfa69['body'][_0x3cf8('0x8c')]&&_0x2cfa69[_0x3cf8('0x58')][_0x3cf8('0x8c')]===_0x3cf8('0x5e')){return _0x4fa981['update']({'read':!![]});}else{logger[_0x3cf8('0x25')](_0x3cf8('0x8d'),_0x3cf8('0x2b'),'twilio',util[_0x3cf8('0x8e')](_0x2cfa69['body'],{'showHidden':![],'depth':null}));}break;}return _0x4fa981;}})[_0x3cf8('0x1f')](respondWithResult(_0x39a5b9,null))[_0x3cf8('0x29')](handleError(_0x39a5b9,null));}; \ No newline at end of file +var _0xca7d=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','WhatsappMessage','findAll','show','params','length','create','body','find','describe','whatsapp-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','format','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','whatsapp','WhatsappInteraction','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xca7d,0x18a));var _0xdca7=function(_0x4fa6cc,_0xd46a5b){_0x4fa6cc=_0x4fa6cc-0x0;var _0x49ba0d=_0xca7d[_0x4fa6cc];return _0x49ba0d;};'use strict';var emlformat=require(_0xdca7('0x0'));var rimraf=require(_0xdca7('0x1'));var zipdir=require(_0xdca7('0x2'));var jsonpatch=require(_0xdca7('0x3'));var rp=require(_0xdca7('0x4'));var moment=require(_0xdca7('0x5'));var BPromise=require(_0xdca7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdca7('0x7'));var sox=require(_0xdca7('0x8'));var csv=require(_0xdca7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdca7('0xa'));var _=require(_0xdca7('0xb'));var squel=require('squel');var crypto=require(_0xdca7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdca7('0x9'));var querystring=require('querystring');var Papa=require(_0xdca7('0xd'));var Redis=require(_0xdca7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdca7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdca7('0x10'));var logger=require(_0xdca7('0x11'))(_0xdca7('0x12'));var utils=require('../../config/utils');var config=require(_0xdca7('0x13'));var licenseUtil=require(_0xdca7('0x14'));var db=require(_0xdca7('0x15'))['db'];config['redis']=_['defaults'](config[_0xdca7('0x16')],{'host':_0xdca7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdca7('0x16')]));require(_0xdca7('0x18'))[_0xdca7('0x19')](socket);var jayson=require(_0xdca7('0x1a'));var client=jayson[_0xdca7('0x1b')][_0xdca7('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xdca7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2ed6a9,_0x5ec92a,_0x4789f8,_0x459b89){return new BPromise(function(_0x30f40c,_0x48907e){var _0x2d20f4=_0x459b89||client;return _0x2d20f4['request'](_0x2ed6a9,_0x4789f8)[_0xdca7('0x1d')](function(_0x57ac83){logger[_0xdca7('0x1e')](_0xdca7('0x1f'),_0x5ec92a,'request\x20sent');logger[_0xdca7('0x20')](_0xdca7('0x21'),_0x5ec92a,_0xdca7('0x22'),JSON['stringify'](_0x57ac83));if(_0x57ac83[_0xdca7('0x23')]){if(_0x57ac83[_0xdca7('0x23')]['code']===0x1f4){logger['error'](_0xdca7('0x1f'),_0x5ec92a,_0x57ac83[_0xdca7('0x23')][_0xdca7('0x24')]);return _0x48907e(_0x57ac83[_0xdca7('0x23')][_0xdca7('0x24')]);}logger[_0xdca7('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5ec92a,_0x57ac83[_0xdca7('0x23')]['message']);return _0x30f40c(_0x57ac83[_0xdca7('0x23')][_0xdca7('0x24')]);}else{logger['info'](_0xdca7('0x1f'),_0x5ec92a,_0xdca7('0x22'));_0x30f40c(_0x57ac83[_0xdca7('0x25')]['message']);}})[_0xdca7('0x26')](function(_0x5ab3f2){logger[_0xdca7('0x23')](_0xdca7('0x1f'),_0x5ec92a,_0x5ab3f2);_0x48907e(_0x5ab3f2);});});}function respondWithStatusCode(_0x10f285,_0xb63a65){_0xb63a65=_0xb63a65||0xcc;return function(_0x592fc2){if(_0x592fc2){return _0x10f285[_0xdca7('0x27')](_0xb63a65);}return _0x10f285[_0xdca7('0x28')](_0xb63a65)[_0xdca7('0x29')]();};}function respondWithResult(_0x2eb424,_0x5a7e43){_0x5a7e43=_0x5a7e43||0xc8;return function(_0x36feb0){if(_0x36feb0){return _0x2eb424[_0xdca7('0x28')](_0x5a7e43)[_0xdca7('0x2a')](_0x36feb0);}};}function respondWithFilteredResult(_0xb90610,_0x75341d){return function(_0x1561fd){if(_0x1561fd){var _0x5a8311=typeof _0x75341d['offset']==='undefined'&&typeof _0x75341d['limit']===_0xdca7('0x2b');var _0x27678e=_0x1561fd[_0xdca7('0x2c')];var _0x181d4d=_0x5a8311?0x0:_0x75341d[_0xdca7('0x2d')];var _0x170049=_0x5a8311?_0x1561fd['count']:_0x75341d['offset']+_0x75341d['limit'];var _0x36c837;if(_0x170049>=_0x27678e){_0x170049=_0x27678e;_0x36c837=0xc8;}else{_0x36c837=0xce;}_0xb90610[_0xdca7('0x28')](_0x36c837);return _0xb90610[_0xdca7('0x2e')](_0xdca7('0x2f'),_0x181d4d+'-'+_0x170049+'/'+_0x27678e)['json'](_0x1561fd);}return null;};}function patchUpdates(_0x186f82){return function(_0x14e191){try{jsonpatch[_0xdca7('0x30')](_0x14e191,_0x186f82,!![]);}catch(_0x486963){return BPromise[_0xdca7('0x31')](_0x486963);}return _0x14e191[_0xdca7('0x32')]();};}function saveUpdates(_0x5f2b71,_0x487f5c){return function(_0x1e01d9){if(_0x1e01d9){return _0x1e01d9[_0xdca7('0x33')](_0x5f2b71)[_0xdca7('0x1d')](function(_0x2ccb51){return _0x2ccb51;});}return null;};}function removeEntity(_0x4f4592,_0x163051){return function(_0x538af7){if(_0x538af7){return _0x538af7[_0xdca7('0x34')]()['then'](function(){_0x4f4592[_0xdca7('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2894d5,_0x1e71b6){return function(_0x17009a){if(!_0x17009a){_0x2894d5['sendStatus'](0x194);}return _0x17009a;};}function handleError(_0x20a948,_0x3084ea){_0x3084ea=_0x3084ea||0x1f4;return function(_0x22e2c3){logger[_0xdca7('0x23')](_0x22e2c3[_0xdca7('0x35')]);if(_0x22e2c3[_0xdca7('0x36')]){delete _0x22e2c3[_0xdca7('0x36')];}_0x20a948[_0xdca7('0x28')](_0x3084ea)['send'](_0x22e2c3);};}exports[_0xdca7('0x37')]=function(_0x598770,_0x4d2846){var _0x45d92a={},_0x2a4704={},_0x2a4125={'count':0x0,'rows':[]};var _0x230935=_['map'](db['WhatsappMessage'][_0xdca7('0x38')],function(_0x27ce15){return{'name':_0x27ce15[_0xdca7('0x39')],'type':_0x27ce15[_0xdca7('0x3a')][_0xdca7('0x3b')]};});_0x2a4704[_0xdca7('0x3c')]=_[_0xdca7('0x3d')](_0x230935,_0xdca7('0x36'));_0x2a4704[_0xdca7('0x3e')]=_[_0xdca7('0x3f')](_0x598770[_0xdca7('0x3e')]);_0x2a4704[_0xdca7('0x40')]=_[_0xdca7('0x41')](_0x2a4704[_0xdca7('0x3c')],_0x2a4704[_0xdca7('0x3e')]);_0x45d92a[_0xdca7('0x42')]=_[_0xdca7('0x41')](_0x2a4704[_0xdca7('0x3c')],qs['fields'](_0x598770[_0xdca7('0x3e')][_0xdca7('0x43')]));_0x45d92a[_0xdca7('0x42')]=_0x45d92a[_0xdca7('0x42')]['length']?_0x45d92a[_0xdca7('0x42')]:_0x2a4704[_0xdca7('0x3c')];if(!_0x598770[_0xdca7('0x3e')]['hasOwnProperty'](_0xdca7('0x44'))){_0x45d92a['limit']=qs[_0xdca7('0x45')](_0x598770[_0xdca7('0x3e')][_0xdca7('0x45')]);_0x45d92a[_0xdca7('0x2d')]=qs[_0xdca7('0x2d')](_0x598770['query'][_0xdca7('0x2d')]);}_0x45d92a['order']=qs[_0xdca7('0x46')](_0x598770[_0xdca7('0x3e')][_0xdca7('0x46')]);_0x45d92a['where']=qs[_0xdca7('0x40')](_[_0xdca7('0x47')](_0x598770['query'],_0x2a4704['filters']),_0x230935);if(_0x598770[_0xdca7('0x3e')][_0xdca7('0x48')]){_0x45d92a[_0xdca7('0x49')]=_['merge'](_0x45d92a['where'],{'$or':_[_0xdca7('0x3d')](_0x230935,function(_0x4aa4a1){if(_0x4aa4a1[_0xdca7('0x3a')]!==_0xdca7('0x4a')){var _0x369072={};_0x369072[_0x4aa4a1['name']]={'$like':'%'+_0x598770[_0xdca7('0x3e')]['filter']+'%'};return _0x369072;}})});}_0x45d92a=_[_0xdca7('0x4b')]({},_0x45d92a,_0x598770[_0xdca7('0x4c')]);var _0x1d3dbc={'where':_0x45d92a[_0xdca7('0x49')]};return db['WhatsappMessage'][_0xdca7('0x2c')](_0x1d3dbc)['then'](function(_0x37cd5b){_0x2a4125[_0xdca7('0x2c')]=_0x37cd5b;if(_0x598770[_0xdca7('0x3e')][_0xdca7('0x4d')]){_0x45d92a[_0xdca7('0x4e')]=[{'all':!![]}];}return db[_0xdca7('0x4f')][_0xdca7('0x50')](_0x45d92a);})[_0xdca7('0x1d')](function(_0x150c90){_0x2a4125['rows']=_0x150c90;return _0x2a4125;})['then'](respondWithFilteredResult(_0x4d2846,_0x45d92a))[_0xdca7('0x26')](handleError(_0x4d2846,null));};exports[_0xdca7('0x51')]=function(_0x39499d,_0x59fc24){var _0x1ab9a1={'raw':!![],'where':{'id':_0x39499d[_0xdca7('0x52')]['id']}},_0x175b23={};_0x175b23[_0xdca7('0x3c')]=_[_0xdca7('0x3f')](db[_0xdca7('0x4f')][_0xdca7('0x38')]);_0x175b23[_0xdca7('0x3e')]=_['keys'](_0x39499d['query']);_0x175b23['filters']=_[_0xdca7('0x41')](_0x175b23['model'],_0x175b23[_0xdca7('0x3e')]);_0x1ab9a1[_0xdca7('0x42')]=_[_0xdca7('0x41')](_0x175b23[_0xdca7('0x3c')],qs[_0xdca7('0x43')](_0x39499d[_0xdca7('0x3e')][_0xdca7('0x43')]));_0x1ab9a1[_0xdca7('0x42')]=_0x1ab9a1['attributes'][_0xdca7('0x53')]?_0x1ab9a1['attributes']:_0x175b23[_0xdca7('0x3c')];if(_0x39499d[_0xdca7('0x3e')]['includeAll']){_0x1ab9a1[_0xdca7('0x4e')]=[{'all':!![]}];}_0x1ab9a1=_[_0xdca7('0x4b')]({},_0x1ab9a1,_0x39499d['options']);return db[_0xdca7('0x4f')]['find'](_0x1ab9a1)[_0xdca7('0x1d')](handleEntityNotFound(_0x59fc24,null))[_0xdca7('0x1d')](respondWithResult(_0x59fc24,null))['catch'](handleError(_0x59fc24,null));};exports[_0xdca7('0x54')]=function(_0x19a75a,_0x1119e2){return db[_0xdca7('0x4f')]['create'](_0x19a75a[_0xdca7('0x55')],{})[_0xdca7('0x1d')](respondWithResult(_0x1119e2,0xc9))[_0xdca7('0x26')](handleError(_0x1119e2,null));};exports['update']=function(_0x23fe9b,_0x15d547){if(_0x23fe9b['body']['id']){delete _0x23fe9b[_0xdca7('0x55')]['id'];}return db[_0xdca7('0x4f')][_0xdca7('0x56')]({'where':{'id':_0x23fe9b[_0xdca7('0x52')]['id']}})[_0xdca7('0x1d')](handleEntityNotFound(_0x15d547,null))[_0xdca7('0x1d')](saveUpdates(_0x23fe9b[_0xdca7('0x55')],null))[_0xdca7('0x1d')](respondWithResult(_0x15d547,null))['catch'](handleError(_0x15d547,null));};exports[_0xdca7('0x34')]=function(_0x5c92a7,_0x2aeac8){return db['WhatsappMessage']['find']({'where':{'id':_0x5c92a7[_0xdca7('0x52')]['id']}})[_0xdca7('0x1d')](handleEntityNotFound(_0x2aeac8,null))[_0xdca7('0x1d')](removeEntity(_0x2aeac8,null))[_0xdca7('0x26')](handleError(_0x2aeac8,null));};exports[_0xdca7('0x57')]=function(_0x3af4a7,_0x581421){return db[_0xdca7('0x4f')][_0xdca7('0x57')]()['then'](respondWithResult(_0x581421,null))['catch'](handleError(_0x581421,null));};var interaction_log=require('../../config/logger')(_0xdca7('0x58'));exports[_0xdca7('0x59')]=function(_0x32bd84,_0x13f178,_0xbf0bc7){var _0x19a5ef={'agent':{},'channel':'whatsapp'};if(_0x32bd84['body']['id']){delete _0x32bd84[_0xdca7('0x55')]['id'];}_0x32bd84[_0xdca7('0x55')]['read']=!![];_0x32bd84['body'][_0xdca7('0x5a')]=moment()['format'](_0xdca7('0x5b'));_0x32bd84[_0xdca7('0x55')]['UserId']=_0x32bd84['body'][_0xdca7('0x5c')]||_0x32bd84[_0xdca7('0x5d')]['id'];_0x19a5ef[_0xdca7('0x5e')]['id']=_0x32bd84[_0xdca7('0x55')]['UserId'];return db[_0xdca7('0x4f')][_0xdca7('0x56')]({'where':{'id':_0x32bd84[_0xdca7('0x52')]['id'],'UserId':null}})[_0xdca7('0x1d')](handleEntityNotFound(_0x13f178,null))[_0xdca7('0x1d')](saveUpdates(_0x32bd84[_0xdca7('0x55')],null))['then'](function(_0x1cb0f7){if(_0x1cb0f7){_0x19a5ef[_0xdca7('0x24')]=_0x1cb0f7[_0xdca7('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xdca7('0x56')]({'where':{'id':_0x1cb0f7[_0xdca7('0x60')]}});}return null;})[_0xdca7('0x1d')](handleEntityNotFound(_0x13f178,null))['then'](function(_0x27068a){if(_0x27068a){return _0x27068a['update']({'UserId':_0x32bd84[_0xdca7('0x55')][_0xdca7('0x5c')],'read1stAt':_[_0xdca7('0x61')](_0x27068a[_0xdca7('0x62')])?moment()[_0xdca7('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdca7('0x1d')](function(_0x58e45f){if(_0x58e45f){_0x19a5ef[_0xdca7('0x64')]=_0x58e45f[_0xdca7('0x5f')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x32bd84[_0xdca7('0x5d')]['id'],_0x32bd84[_0xdca7('0x5d')][_0xdca7('0x36')],_0x32bd84[_0xdca7('0x5d')]['role'],_0x19a5ef[_0xdca7('0x64')]['id'],_0x32bd84[_0xdca7('0x55')]?JSON[_0xdca7('0x65')](_0x32bd84[_0xdca7('0x55')]):_0xdca7('0x66'));return respondWithRpcPromise(_0xdca7('0x67'),'acceptMessage',_0x19a5ef);}return null;})[_0xdca7('0x1d')](function(_0x50715d){var _0x145e4e=_0xdca7('0x68')+_0x50715d[_0xdca7('0x24')][_0xdca7('0x69')];return db[_0xdca7('0x6a')][_0xdca7('0x3e')](_0x145e4e,{'type':db[_0xdca7('0x6b')][_0xdca7('0x6c')][_0xdca7('0x6d')],'raw':!![]})['then'](function(_0x122b87){return _0x122b87;});})[_0xdca7('0x1d')](function(_0x28abca){if(_0x28abca){_0x19a5ef['message'][_0xdca7('0x6e')]=_0x28abca[0x0];if(!_0x32bd84[_0xdca7('0x55')][_0xdca7('0x5c')])return;return db[_0xdca7('0x6f')][_0xdca7('0x56')]({'where':{'id':_0x32bd84[_0xdca7('0x55')][_0xdca7('0x5c')],'role':_0xdca7('0x5e')},'attributes':['id',_0xdca7('0x36'),_0xdca7('0x70'),_0xdca7('0x71'),_0xdca7('0x72')],'raw':!![]});}return null;})[_0xdca7('0x1d')](function(_0x199e24){if(!_0x199e24)return null;_0x19a5ef[_0xdca7('0x24')][_0xdca7('0x5e')]=_0x199e24;return _0x19a5ef;})['then'](function(_0x4ff33c){if(_0x4ff33c){if(_0x32bd84[_0xdca7('0x55')][_0xdca7('0x73')]){_0x19a5ef[_0xdca7('0x24')][_0xdca7('0x74')]=util[_0xdca7('0x63')](_0xdca7('0x75'),_0x32bd84[_0xdca7('0x5d')][_0xdca7('0x36')]);_0x19a5ef['message'][_0xdca7('0x76')]=_0x19a5ef[_0xdca7('0x76')];_0x19a5ef[_0xdca7('0x24')][_0xdca7('0x77')]=_0x19a5ef['channel'];_0x19a5ef['message']['event']=_0xdca7('0x59');return respondWithRpcPromise(_0xdca7('0x78'),'EventManager',{'event':_0xdca7('0x79'),'message':_0x19a5ef[_0xdca7('0x24')]},client9002)['then'](function(){return _0x19a5ef;});}return _0x19a5ef;}return null;})['then'](respondWithResult(_0x13f178,null))['catch'](handleError(_0x13f178,null));};var interaction_log=require(_0xdca7('0x11'))(_0xdca7('0x58'));exports[_0xdca7('0x31')]=function(_0x39f036,_0x26e543,_0x544eb8){var _0x575a29={'agent':{},'channel':_0xdca7('0x7a')};if(_0x39f036[_0xdca7('0x55')]['id']){delete _0x39f036[_0xdca7('0x55')]['id'];}_0x39f036['body'][_0xdca7('0x5c')]=_0x39f036[_0xdca7('0x55')][_0xdca7('0x5c')]||_0x39f036[_0xdca7('0x5d')]['id'];_0x575a29[_0xdca7('0x5e')]['id']=_0x39f036[_0xdca7('0x55')][_0xdca7('0x5c')];return db[_0xdca7('0x4f')][_0xdca7('0x56')]({'where':{'id':_0x39f036['params']['id'],'UserId':null}})[_0xdca7('0x1d')](handleEntityNotFound(_0x26e543,null))[_0xdca7('0x1d')](function(_0x21c2e3){if(_0x21c2e3){_0x575a29[_0xdca7('0x24')]=_0x21c2e3['get']({'plain':!![]});return db[_0xdca7('0x7b')][_0xdca7('0x56')]({'where':{'id':_0x21c2e3['WhatsappInteractionId']}});}return null;})[_0xdca7('0x1d')](handleEntityNotFound(_0x26e543,null))[_0xdca7('0x1d')](function(_0x27acbe){if(_0x27acbe){_0x575a29[_0xdca7('0x64')]=_0x27acbe[_0xdca7('0x5f')]({'plain':!![]});interaction_log[_0xdca7('0x1e')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x39f036[_0xdca7('0x5d')]['id'],_0x39f036[_0xdca7('0x5d')][_0xdca7('0x36')],_0x39f036[_0xdca7('0x5d')]['role'],_0x575a29['interaction']['id'],_0x39f036['body']?JSON[_0xdca7('0x65')](_0x39f036['body']):_0xdca7('0x66'));return respondWithRpcPromise(_0xdca7('0x7c'),_0xdca7('0x7d'),_0x575a29);}return null;})[_0xdca7('0x1d')](function(_0x9a6756){var _0x32dede='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x9a6756[_0xdca7('0x24')][_0xdca7('0x69')];return db['sequelize']['query'](_0x32dede,{'type':db[_0xdca7('0x6b')][_0xdca7('0x6c')][_0xdca7('0x6d')],'raw':!![]})['then'](function(_0x449d41){return _0x449d41;});})['then'](function(_0x466520){if(_0x466520){_0x575a29['message'][_0xdca7('0x6e')]=_0x466520[0x0];if(!_0x39f036[_0xdca7('0x55')][_0xdca7('0x5c')])return;return db[_0xdca7('0x6f')][_0xdca7('0x56')]({'where':{'id':_0x39f036['body'][_0xdca7('0x5c')],'role':_0xdca7('0x5e')},'attributes':['id',_0xdca7('0x36'),_0xdca7('0x70'),'email',_0xdca7('0x72')],'raw':!![]});}return null;})[_0xdca7('0x1d')](function(_0x28c359){if(!_0x28c359)return null;_0x575a29[_0xdca7('0x24')][_0xdca7('0x5e')]=_0x28c359;return _0x575a29;})[_0xdca7('0x1d')](function(_0x1acf37){if(_0x1acf37){_0x1acf37[_0xdca7('0x24')][_0xdca7('0x74')]=util[_0xdca7('0x63')](_0xdca7('0x75'),_0x39f036[_0xdca7('0x5d')][_0xdca7('0x36')]);_0x1acf37[_0xdca7('0x24')][_0xdca7('0x76')]=_0x575a29[_0xdca7('0x76')];_0x1acf37[_0xdca7('0x24')][_0xdca7('0x77')]=_0x575a29['channel'];_0x1acf37['message']['event']=_0xdca7('0x31');respondWithRpcPromise('EventManager',_0xdca7('0x78'),{'event':_0xdca7('0x7e'),'message':_0x1acf37[_0xdca7('0x24')]},client9002);return _0x575a29;}return null;})['then'](respondWithResult(_0x26e543,null))[_0xdca7('0x26')](handleError(_0x26e543,null));};exports[_0xdca7('0x28')]=function(_0x45043b,_0x47c4fc,_0xc76570){if(_0x45043b['body']['id']){delete _0x45043b[_0xdca7('0x55')]['id'];}var _0x380f21;return db[_0xdca7('0x4f')][_0xdca7('0x56')]({'where':{'id':_0x45043b[_0xdca7('0x52')]['id']}})['then'](handleEntityNotFound(_0x47c4fc,null))[_0xdca7('0x1d')](function(_0x485f00){if(_0x485f00){_0x380f21=_0x485f00;return db[_0xdca7('0x7f')][_0xdca7('0x56')]({'where':{'id':_0x485f00[_0xdca7('0x80')]}});}})[_0xdca7('0x1d')](handleEntityNotFound(_0x47c4fc,null))[_0xdca7('0x1d')](function(_0x2e5c75){if(_0x2e5c75){logger[_0xdca7('0x20')](_0xdca7('0x81'),'status',_0xdca7('0x82'),_0x2e5c75[_0xdca7('0x3a')],util[_0xdca7('0x83')](_0x45043b[_0xdca7('0x55')],{'showHidden':![],'depth':null}));switch(_0x2e5c75['type']){case _0xdca7('0x84'):if(_0x45043b[_0xdca7('0x55')][_0xdca7('0x85')]&&_0x45043b['body'][_0xdca7('0x85')]===_0x380f21['messageId']&&_0x45043b[_0xdca7('0x55')][_0xdca7('0x86')]&&_0x45043b['body'][_0xdca7('0x86')]===_0xdca7('0x87')){return _0x380f21['update']({'read':!![]});}else{logger[_0xdca7('0x23')](_0xdca7('0x88'),'status','twilio',util[_0xdca7('0x83')](_0x45043b[_0xdca7('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x380f21;}})[_0xdca7('0x1d')](respondWithResult(_0x47c4fc,null))[_0xdca7('0x26')](handleError(_0x47c4fc,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 16e4fb8..e558ac4 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 _0x80df=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x264c81,_0x460b13){var _0x1908a0=function(_0x162184){while(--_0x162184){_0x264c81['push'](_0x264c81['shift']());}};_0x1908a0(++_0x460b13);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xf80d('0x0'));var WhatsappMessage=require(_0xf80d('0x1'))['db'][_0xf80d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf80d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf80d('0x4'),'afterDestroy':_0xf80d('0x5')};function emitEvent(_0xfd239e){return function(_0x21365c,_0x15d302,_0xa6b1bb){WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e+':'+_0x21365c['id'],_0x21365c);WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e,_0x21365c);_0xa6b1bb(null);};}for(var e in events){if(events[_0xf80d('0x7')](e)){var event=events[e];WhatsappMessage[_0xf80d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x2f3a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x3e10b0,_0x4544e3){var _0x14b94d=function(_0x75a72d){while(--_0x75a72d){_0x3e10b0['push'](_0x3e10b0['shift']());}};_0x14b94d(++_0x4544e3);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x2e4ef9,_0x42f504){_0x2e4ef9=_0x2e4ef9-0x0;var _0x4160ac=_0x2f3a[_0x2e4ef9];return _0x4160ac;};'use strict';var EventEmitter=require(_0xa2f3('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xa2f3('0x1')](0x0);var events={'afterCreate':_0xa2f3('0x2'),'afterUpdate':_0xa2f3('0x3'),'afterDestroy':_0xa2f3('0x4')};function emitEvent(_0x17ec7a){return function(_0xdf4c17,_0x50ef95,_0x78edcd){WhatsappMessageEvents['emit'](_0x17ec7a+':'+_0xdf4c17['id'],_0xdf4c17);WhatsappMessageEvents[_0xa2f3('0x5')](_0x17ec7a,_0xdf4c17);_0x78edcd(null);};}for(var e in events){if(events[_0xa2f3('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a4c9d05..b948c5f 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 _0x652f=['inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','node-fetch','path','../../config/environment','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','whatsapp:','remote','/api/whatsapp/messages/','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x539ce2,_0x54efa0){var _0x1c85b0=function(_0x3d82ac){while(--_0x3d82ac){_0x539ce2['push'](_0x539ce2['shift']());}};_0x1c85b0(++_0x54efa0);}(_0x652f,0xf1));var _0xf652=function(_0x47ef0c,_0x4b5af9){_0x47ef0c=_0x47ef0c-0x0;var _0x316487=_0x652f[_0x47ef0c];return _0x316487;};'use strict';var _=require('lodash');var util=require(_0xf652('0x0'));var logger=require('../../config/logger')(_0xf652('0x1'));var moment=require('moment');var BPromise=require(_0xf652('0x2'));var rp=require(_0xf652('0x3'));var fetch=require(_0xf652('0x4'));var fs=require('fs');var path=require(_0xf652('0x5'));var rimraf=require('rimraf');var config=require(_0xf652('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xf652('0x7')]=function(_0x3a9f56,_0x581d9f){return _0x3a9f56['define'](_0xf652('0x8'),attributes,{'tableName':_0xf652('0x9'),'paranoid':![],'indexes':[{'name':_0xf652('0xa'),'fields':[_0xf652('0xa')]},{'name':_0xf652('0xb'),'fields':[_0xf652('0xc')],'type':_0xf652('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5252df,_0x45e0ef,_0x4eb4d8){var _0x5f1c5b=_0x3a9f56[_0xf652('0xe')];var _0x55f800=_0x5252df[_0xf652('0xf')]({'plain':!![]});if(_0x55f800[_0xf652('0x10')][_0xf652('0x11')]()==='in'||_0x55f800[_0xf652('0x10')][_0xf652('0x11')]()===_0xf652('0x12')&&!_0x55f800['secret']&&!_[_0xf652('0x13')](_0x55f800[_0xf652('0x14')])){_0x5f1c5b[_0xf652('0x15')][_0xf652('0x16')]({'where':{'id':_0x55f800[_0xf652('0x17')]}})[_0xf652('0x18')](function(_0x350d75){if(_0x350d75){_0x350d75['update']({'lastMsgAt':_0x55f800[_0xf652('0x19')],'lastMsgDirection':_0x55f800['direction'][_0xf652('0x11')]()});}})[_0xf652('0x1a')](function(_0xeba63b){console[_0xf652('0x1b')](_0xeba63b);});}if(_0x55f800[_0xf652('0x10')]===_0xf652('0x12')&&!_0x55f800[_0xf652('0x1c')]){var _0x1e0e9c;_0x5f1c5b[_0xf652('0x1d')]['find']({'where':{'id':_0x55f800[_0xf652('0x1e')]},'raw':!![]})['then'](function(_0x253df4){_0x1e0e9c=_0x253df4;if(_0x1e0e9c&&_0x1e0e9c[_0xf652('0x1f')]){switch(_0x1e0e9c['type']){case'twilio':var _0xd3aed7=require(_0xf652('0x20'));if(_0x1e0e9c[_0xf652('0x21')]&&_0x1e0e9c['authToken']&&_0x1e0e9c[_0xf652('0x22')]){var _0x1364a2=new _0xd3aed7(_0x1e0e9c[_0xf652('0x21')],_0x1e0e9c[_0xf652('0x23')]);_0x1364a2[_0xf652('0x24')]['create']({'body':_0x55f800[_0xf652('0xc')],'to':_0xf652('0x25')+_0x55f800[_0xf652('0x22')],'from':'whatsapp:'+_0x1e0e9c[_0xf652('0x22')],'statusCallback':_0x1e0e9c[_0xf652('0x26')]+_0xf652('0x27')+_0x55f800['id']+'/status?token='+_0x1e0e9c[_0xf652('0x28')]})[_0xf652('0x18')](function(_0x48a77e){if(_0x48a77e[_0xf652('0x29')]){return _0x5252df[_0xf652('0x2a')]({'messageId':_0x48a77e[_0xf652('0x29')]});}})['catch'](function(_0x2aabf2){logger[_0xf652('0x1b')](_0xf652('0x2b'),'afterCreate',_0xf652('0x20'),util[_0xf652('0x2c')](_0x2aabf2,{'showHidden':![],'depth':null}));});}else{logger[_0xf652('0x1b')](_0xf652('0x2b'),'afterCreate',_0xf652('0x20'),_0xf652('0x2d'));}break;case _0xf652('0x2e'):var _0x27ee51=_0x1e0e9c[_0xf652('0x21')];var _0x2d429d=_0x1e0e9c[_0xf652('0x23')];var _0x1844ff=_0x1e0e9c['baseUrl']+_0xf652('0x2f')+_0x27ee51+_0xf652('0x30');var _0x58af51={'to':[_0x55f800[_0xf652('0x22')]],'message':{'type':'text','text':_0x55f800[_0xf652('0xc')]}};var _0x2aae32={'method':'POST','uri':_0x1844ff,'headers':{'Authorization':_0xf652('0x31')+_0x2d429d,'Content-Type':_0xf652('0x32')},'body':_0x58af51,'json':!![]};rp(_0x2aae32)['then'](function(_0x311543){if(_0x311543['statuses'][0x0][_0xf652('0x33')]){return _0x5252df[_0xf652('0x2a')]({'messageId':_0x311543[_0xf652('0x34')][0x0][_0xf652('0x33')]});}})['catch'](function(_0x282375){logger[_0xf652('0x35')](_0xf652('0x36'),_0x282375);});break;}}})['finally'](function(){_0x4eb4d8();});}else{_0x4eb4d8();}}},'charset':_0xf652('0x37'),'collate':_0xf652('0x38')});}; \ No newline at end of file +var _0x27c0=['then','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/status?token=','token','update','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','node-fetch','path','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','catch','out','WhatsappAccount','find','WhatsappAccountId'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x27c0,0x1bb));var _0x027c=function(_0x4cae3f,_0x26442e){_0x4cae3f=_0x4cae3f-0x0;var _0x408eaf=_0x27c0[_0x4cae3f];return _0x408eaf;};'use strict';var _=require(_0x027c('0x0'));var util=require(_0x027c('0x1'));var logger=require('../../config/logger')(_0x027c('0x2'));var moment=require(_0x027c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x027c('0x4'));var fs=require('fs');var path=require(_0x027c('0x5'));var rimraf=require(_0x027c('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x027c('0x7')]=function(_0x43d883,_0x4a8bc2){return _0x43d883[_0x027c('0x8')](_0x027c('0x9'),attributes,{'tableName':_0x027c('0xa'),'paranoid':![],'indexes':[{'name':_0x027c('0xb'),'fields':[_0x027c('0xb')]},{'name':_0x027c('0xc'),'fields':[_0x027c('0xd')],'type':_0x027c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa77231,_0x11ae91,_0x566e70){var _0x1e814d=_0x43d883[_0x027c('0xf')];var _0x24c90a=_0xa77231['get']({'plain':!![]});if(_0x24c90a[_0x027c('0x10')][_0x027c('0x11')]()==='in'||_0x24c90a[_0x027c('0x10')][_0x027c('0x11')]()==='out'&&!_0x24c90a[_0x027c('0x12')]&&!_[_0x027c('0x13')](_0x24c90a[_0x027c('0x14')])){_0x1e814d[_0x027c('0x15')][_0x027c('0x16')]({'where':{'id':_0x24c90a[_0x027c('0x17')]}})['then'](function(_0x4f4e36){if(_0x4f4e36){_0x4f4e36['update']({'lastMsgAt':_0x24c90a['createdAt'],'lastMsgDirection':_0x24c90a[_0x027c('0x10')]['toLowerCase']()});}})[_0x027c('0x18')](function(_0x35688e){console['error'](_0x35688e);});}if(_0x24c90a[_0x027c('0x10')]===_0x027c('0x19')&&!_0x24c90a[_0x027c('0x12')]){var _0x52aa9e;_0x1e814d[_0x027c('0x1a')][_0x027c('0x1b')]({'where':{'id':_0x24c90a[_0x027c('0x1c')]},'raw':!![]})[_0x027c('0x1d')](function(_0x2f59ed){_0x52aa9e=_0x2f59ed;if(_0x52aa9e&&_0x52aa9e[_0x027c('0x1e')]){switch(_0x52aa9e[_0x027c('0x1e')]){case _0x027c('0x1f'):var _0x26454c=require(_0x027c('0x1f'));if(_0x52aa9e[_0x027c('0x20')]&&_0x52aa9e['authToken']&&_0x52aa9e['phone']){var _0x3740db=new _0x26454c(_0x52aa9e[_0x027c('0x20')],_0x52aa9e[_0x027c('0x21')]);_0x3740db['messages'][_0x027c('0x22')]({'body':_0x24c90a['body'],'to':_0x027c('0x23')+_0x24c90a['phone'],'from':_0x027c('0x23')+_0x52aa9e[_0x027c('0x24')],'statusCallback':_0x52aa9e[_0x027c('0x25')]+'/api/whatsapp/messages/'+_0x24c90a['id']+_0x027c('0x26')+_0x52aa9e[_0x027c('0x27')]})['then'](function(_0x374765){if(_0x374765['sid']){return _0xa77231[_0x027c('0x28')]({'messageId':_0x374765[_0x027c('0x29')]});}})[_0x027c('0x18')](function(_0x2f9a3d){logger[_0x027c('0x2a')](_0x027c('0x2b'),_0x027c('0x2c'),_0x027c('0x1f'),util[_0x027c('0x2d')](_0x2f9a3d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x027c('0x2b'),_0x027c('0x2c'),_0x027c('0x1f'),_0x027c('0x2e'));}break;case _0x027c('0x2f'):var _0x10706e=_0x52aa9e[_0x027c('0x20')];var _0x315a59=_0x52aa9e[_0x027c('0x21')];var _0x13968f=_0x52aa9e[_0x027c('0x30')]+_0x027c('0x31')+_0x10706e+_0x027c('0x32');var _0x56cee7={'to':[_0x24c90a[_0x027c('0x24')]],'message':{'type':'text','text':_0x24c90a[_0x027c('0xd')]}};var _0x54fa7c={'method':_0x027c('0x33'),'uri':_0x13968f,'headers':{'Authorization':'Bearer\x20'+_0x315a59,'Content-Type':_0x027c('0x34')},'body':_0x56cee7,'json':!![]};rp(_0x54fa7c)[_0x027c('0x1d')](function(_0x206bc9){if(_0x206bc9['statuses'][0x0][_0x027c('0x35')]){return _0xa77231[_0x027c('0x28')]({'messageId':_0x206bc9[_0x027c('0x36')][0x0][_0x027c('0x35')]});}})[_0x027c('0x18')](function(_0x454e88){logger[_0x027c('0x37')](_0x027c('0x38'),_0x454e88);});break;}}})['finally'](function(){_0x566e70();});}else{_0x566e70();}}},'charset':_0x027c('0x39'),'collate':_0x027c('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 339c169..f966214 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 _0xd930=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','request','info','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','create','options','raw','then','debug','lodash'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xd930,0xff));var _0x0d93=function(_0x117049,_0x46d729){_0x117049=_0x117049-0x0;var _0x5adfb4=_0xd930[_0x117049];return _0x5adfb4;};'use strict';var _=require(_0x0d93('0x0'));var util=require(_0x0d93('0x1'));var moment=require(_0x0d93('0x2'));var BPromise=require(_0x0d93('0x3'));var rs=require(_0x0d93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d93('0x5'))['db'];var utils=require(_0x0d93('0x6'));var logger=require(_0x0d93('0x7'))(_0x0d93('0x8'));var config=require(_0x0d93('0x9'));var jayson=require(_0x0d93('0xa'));var client=jayson[_0x0d93('0xb')][_0x0d93('0xc')]({'port':0x232a});config[_0x0d93('0xd')]=_[_0x0d93('0xe')](config[_0x0d93('0xd')],{'host':_0x0d93('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d93('0x10'))['register'](socket);function respondWithRpcPromise(_0x3ac8cf,_0x3c9b41,_0x559a38){return new BPromise(function(_0x263cf4,_0x294db9){return client[_0x0d93('0x11')](_0x3ac8cf,_0x559a38)['then'](function(_0x349d24){logger[_0x0d93('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x3c9b41,_0x0d93('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3c9b41,'request\x20sent',JSON[_0x0d93('0x14')](_0x349d24));if(_0x349d24[_0x0d93('0x15')]){if(_0x349d24[_0x0d93('0x15')][_0x0d93('0x16')]===0x1f4){logger[_0x0d93('0x15')](_0x0d93('0x17'),_0x3c9b41,_0x349d24[_0x0d93('0x15')]['message']);return _0x294db9(_0x349d24[_0x0d93('0x15')]['message']);}logger[_0x0d93('0x15')](_0x0d93('0x17'),_0x3c9b41,_0x349d24[_0x0d93('0x15')][_0x0d93('0x18')]);return _0x263cf4(_0x349d24['error'][_0x0d93('0x18')]);}else{logger[_0x0d93('0x12')](_0x0d93('0x17'),_0x3c9b41,_0x0d93('0x13'));_0x263cf4(_0x349d24[_0x0d93('0x19')][_0x0d93('0x18')]);}})['catch'](function(_0x202b4e){logger[_0x0d93('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x3c9b41,_0x202b4e);_0x294db9(_0x202b4e);});});}exports[_0x0d93('0x1a')]=function(_0xf50670){var _0x37c4ae=this;return new Promise(function(_0x40aaf4,_0x24ffd6){return db['WhatsappMessage'][_0x0d93('0x1b')](_0xf50670['body'],{'raw':_0xf50670['options']?_0xf50670[_0x0d93('0x1c')][_0x0d93('0x1d')]===undefined?!![]:![]:!![]})[_0x0d93('0x1e')](function(_0x42c89b){logger[_0x0d93('0x12')](_0x0d93('0x1a'),_0xf50670);logger[_0x0d93('0x1f')]('CreateWhatsappMessage',_0xf50670,JSON[_0x0d93('0x14')](_0x42c89b));_0x40aaf4(_0x42c89b);})['catch'](function(_0x1fb67c){logger[_0x0d93('0x15')]('CreateWhatsappMessage',_0x1fb67c['message'],_0xf50670);_0x24ffd6(_0x37c4ae[_0x0d93('0x15')](0x1f4,_0x1fb67c['message']));});});}; \ No newline at end of file +var _0x2748=['http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','create','body','options','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31fdb0,_0x22eb3c){var _0x1051bb=function(_0x1083a5){while(--_0x1083a5){_0x31fdb0['push'](_0x31fdb0['shift']());}};_0x1051bb(++_0x22eb3c);}(_0x2748,0xe9));var _0x8274=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2748[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x8274('0x0'));var util=require(_0x8274('0x1'));var moment=require(_0x8274('0x2'));var BPromise=require(_0x8274('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8274('0x4'));var db=require(_0x8274('0x5'))['db'];var utils=require(_0x8274('0x6'));var logger=require(_0x8274('0x7'))(_0x8274('0x8'));var config=require(_0x8274('0x9'));var jayson=require(_0x8274('0xa'));var client=jayson[_0x8274('0xb')][_0x8274('0xc')]({'port':0x232a});config[_0x8274('0xd')]=_[_0x8274('0xe')](config['redis'],{'host':_0x8274('0xf'),'port':0x18eb});var socket=require(_0x8274('0x10'))(new Redis(config['redis']));require(_0x8274('0x11'))[_0x8274('0x12')](socket);function respondWithRpcPromise(_0x2b637e,_0x8dbb4,_0xcd5fc){return new BPromise(function(_0x83e822,_0x2b59d5){return client['request'](_0x2b637e,_0xcd5fc)[_0x8274('0x13')](function(_0x4af7bb){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x8dbb4,_0x8274('0x14'));logger[_0x8274('0x15')](_0x8274('0x16'),_0x8dbb4,'request\x20sent',JSON[_0x8274('0x17')](_0x4af7bb));if(_0x4af7bb['error']){if(_0x4af7bb[_0x8274('0x18')][_0x8274('0x19')]===0x1f4){logger[_0x8274('0x18')](_0x8274('0x1a'),_0x8dbb4,_0x4af7bb[_0x8274('0x18')][_0x8274('0x1b')]);return _0x2b59d5(_0x4af7bb['error']['message']);}logger[_0x8274('0x18')](_0x8274('0x1a'),_0x8dbb4,_0x4af7bb['error']['message']);return _0x83e822(_0x4af7bb[_0x8274('0x18')][_0x8274('0x1b')]);}else{logger['info'](_0x8274('0x1a'),_0x8dbb4,_0x8274('0x14'));_0x83e822(_0x4af7bb[_0x8274('0x1c')][_0x8274('0x1b')]);}})[_0x8274('0x1d')](function(_0x3d2c17){logger['error'](_0x8274('0x1a'),_0x8dbb4,_0x3d2c17);_0x2b59d5(_0x3d2c17);});});}exports[_0x8274('0x1e')]=function(_0x41254b){var _0x41330a=this;return new Promise(function(_0x5c81c6,_0x397029){return db['WhatsappMessage'][_0x8274('0x1f')](_0x41254b[_0x8274('0x20')],{'raw':_0x41254b[_0x8274('0x21')]?_0x41254b[_0x8274('0x21')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x49febd){logger[_0x8274('0x22')]('CreateWhatsappMessage',_0x41254b);logger[_0x8274('0x15')](_0x8274('0x1e'),_0x41254b,JSON[_0x8274('0x17')](_0x49febd));_0x5c81c6(_0x49febd);})[_0x8274('0x1d')](function(_0x3e09bc){logger[_0x8274('0x18')](_0x8274('0x1e'),_0x3e09bc[_0x8274('0x1b')],_0x41254b);_0x397029(_0x41330a[_0x8274('0x18')](0x1f4,_0x3e09bc[_0x8274('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 65095f2..81d0aa1 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 _0x86e0=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x366511,_0x55abe4){var _0x3169e9=function(_0xa100d4){while(--_0xa100d4){_0x366511['push'](_0x366511['shift']());}};_0x3169e9(++_0x55abe4);}(_0x86e0,0x142));var _0x086e=function(_0x2ee8c9,_0x591d80){_0x2ee8c9=_0x2ee8c9-0x0;var _0x33e880=_0x86e0[_0x2ee8c9];return _0x33e880;};'use strict';var WhatsappMessageEvents=require(_0x086e('0x0'));var events=[_0x086e('0x1'),_0x086e('0x2'),_0x086e('0x3')];function createListener(_0x27b5a9,_0x8b774c){return function(_0x32a4bc){_0x8b774c[_0x086e('0x4')](_0x27b5a9,_0x32a4bc);};}function removeListener(_0x34bf32,_0x249415){return function(){WhatsappMessageEvents[_0x086e('0x5')](_0x34bf32,_0x249415);};}exports[_0x086e('0x6')]=function(_0x195301){for(var _0x5298a0=0x0,_0x5900d6=events[_0x086e('0x7')];_0x5298a0<_0x5900d6;_0x5298a0++){var _0x27d8be=events[_0x5298a0];var _0x2528c9=createListener(_0x086e('0x8')+_0x27d8be,_0x195301);WhatsappMessageEvents['on'](_0x27d8be,_0x2528c9);}}; \ No newline at end of file +var _0x240f=['register','./whatsappMessage.events','save','remove','update','emit'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x240f,0x67));var _0xf240=function(_0x4c4cff,_0xaa8322){_0x4c4cff=_0x4c4cff-0x0;var _0x19a607=_0x240f[_0x4c4cff];return _0x19a607;};'use strict';var WhatsappMessageEvents=require(_0xf240('0x0'));var events=[_0xf240('0x1'),_0xf240('0x2'),_0xf240('0x3')];function createListener(_0x19d777,_0x5632ad){return function(_0x1306d7){_0x5632ad[_0xf240('0x4')](_0x19d777,_0x1306d7);};}function removeListener(_0x129154,_0x30a471){return function(){WhatsappMessageEvents['removeListener'](_0x129154,_0x30a471);};}exports[_0xf240('0x5')]=function(_0x30d828){for(var _0x44bb0d=0x0,_0x409f36=events['length'];_0x44bb0d<_0x409f36;_0x44bb0d++){var _0x51c71e=events[_0x44bb0d];var _0x5ad0d7=createListener('whatsappMessage:'+_0x51c71e,_0x30d828);WhatsappMessageEvents['on'](_0x51c71e,_0x5ad0d7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e1f5672..3401b89 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 _0xb5fc=['removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete','removeTeams'];(function(_0x12ce42,_0x5eb1b2){var _0x52e005=function(_0x37ed99){while(--_0x37ed99){_0x12ce42['push'](_0x12ce42['shift']());}};_0x52e005(++_0x5eb1b2);}(_0xb5fc,0x88));var _0xcb5f=function(_0x3699a8,_0x17e64d){_0x3699a8=_0x3699a8-0x0;var _0x59c306=_0xb5fc[_0x3699a8];return _0x59c306;};'use strict';var multer=require('multer');var util=require(_0xcb5f('0x0'));var path=require(_0xcb5f('0x1'));var timeout=require(_0xcb5f('0x2'));var express=require(_0xcb5f('0x3'));var router=express[_0xcb5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb5f('0x5'));var interaction=require(_0xcb5f('0x6'));var config=require(_0xcb5f('0x7'));var controller=require(_0xcb5f('0x8'));router[_0xcb5f('0x9')]('/',auth[_0xcb5f('0xa')](),controller['index']);router[_0xcb5f('0x9')]('/describe',auth[_0xcb5f('0xa')](),controller[_0xcb5f('0xb')]);router[_0xcb5f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xcb5f('0xc')]);router[_0xcb5f('0x9')](_0xcb5f('0xd'),auth[_0xcb5f('0xa')](),controller[_0xcb5f('0xe')]);router[_0xcb5f('0x9')](_0xcb5f('0xf'),auth[_0xcb5f('0xa')](),controller['getTeams']);router[_0xcb5f('0x9')](_0xcb5f('0x10'),auth[_0xcb5f('0xa')](),controller[_0xcb5f('0x11')]);router[_0xcb5f('0x12')]('/',auth[_0xcb5f('0xa')](),controller[_0xcb5f('0x13')]);router['post']('/:id/teams',auth[_0xcb5f('0xa')](),controller['addTeams']);router[_0xcb5f('0x12')](_0xcb5f('0x10'),auth[_0xcb5f('0xa')](),controller[_0xcb5f('0x14')]);router[_0xcb5f('0x15')](_0xcb5f('0x16'),auth['isAuthenticated'](),controller[_0xcb5f('0x17')]);router[_0xcb5f('0x18')](_0xcb5f('0x16'),auth[_0xcb5f('0xa')](),controller['destroy']);router['delete'](_0xcb5f('0xf'),auth[_0xcb5f('0xa')](),controller[_0xcb5f('0x19')]);router[_0xcb5f('0x18')](_0xcb5f('0x10'),auth[_0xcb5f('0xa')](),controller[_0xcb5f('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xcbb1=['/describe','describe','/:id','isAuthenticated','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addAgents','update','delete','removeTeams','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','index','get'];(function(_0x4146ac,_0x380390){var _0x1773d0=function(_0x1b4037){while(--_0x1b4037){_0x4146ac['push'](_0x4146ac['shift']());}};_0x1773d0(++_0x380390);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x6c3a50,_0x242eb2){_0x6c3a50=_0x6c3a50-0x0;var _0x51f665=_0xcbb1[_0x6c3a50];return _0x51f665;};'use strict';var multer=require('multer');var util=require(_0x1cbb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1cbb('0x1'));var router=express[_0x1cbb('0x2')]();var fs_extra=require(_0x1cbb('0x3'));var auth=require(_0x1cbb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1cbb('0x5'));var controller=require(_0x1cbb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1cbb('0x7')]);router[_0x1cbb('0x8')](_0x1cbb('0x9'),auth['isAuthenticated'](),controller[_0x1cbb('0xa')]);router[_0x1cbb('0x8')](_0x1cbb('0xb'),auth[_0x1cbb('0xc')](),controller['show']);router[_0x1cbb('0x8')](_0x1cbb('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x1cbb('0xe'),auth[_0x1cbb('0xc')](),controller[_0x1cbb('0xf')]);router[_0x1cbb('0x8')](_0x1cbb('0x10'),auth[_0x1cbb('0xc')](),controller['getAgents']);router[_0x1cbb('0x11')]('/',auth[_0x1cbb('0xc')](),controller[_0x1cbb('0x12')]);router[_0x1cbb('0x11')](_0x1cbb('0xe'),auth[_0x1cbb('0xc')](),controller['addTeams']);router[_0x1cbb('0x11')](_0x1cbb('0x10'),auth['isAuthenticated'](),controller[_0x1cbb('0x13')]);router['put'](_0x1cbb('0xb'),auth[_0x1cbb('0xc')](),controller[_0x1cbb('0x14')]);router[_0x1cbb('0x15')]('/:id',auth[_0x1cbb('0xc')](),controller['destroy']);router[_0x1cbb('0x15')]('/:id/teams',auth[_0x1cbb('0xc')](),controller[_0x1cbb('0x16')]);router[_0x1cbb('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x1cbb('0x17')]);module[_0x1cbb('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2558a22..65b403b 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 _0xf197=['sequelize','exports','STRING','ENUM'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xf197,0x130));var _0x7f19=function(_0x4fde14,_0x10431b){_0x4fde14=_0x4fde14-0x0;var _0x5bbbd5=_0xf197[_0x4fde14];return _0x5bbbd5;};'use strict';var Sequelize=require(_0x7f19('0x0'));module[_0x7f19('0x1')]={'name':{'type':Sequelize[_0x7f19('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7f19('0x3')]('rrmemory','beepall','roundrobin')},'description':{'type':Sequelize[_0x7f19('0x2')]}}; \ No newline at end of file +var _0x6ce9=['STRING','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x1e8bea,_0x47bde9){var _0x29f756=function(_0x37bb53){while(--_0x37bb53){_0x1e8bea['push'](_0x1e8bea['shift']());}};_0x29f756(++_0x47bde9);}(_0x6ce9,0x76));var _0x96ce=function(_0x593929,_0x51385b){_0x593929=_0x593929-0x0;var _0x548c5c=_0x6ce9[_0x593929];return _0x548c5c;};'use strict';var Sequelize=require(_0x96ce('0x0'));module[_0x96ce('0x1')]={'name':{'type':Sequelize[_0x96ce('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x96ce('0x3')]('rrmemory',_0x96ce('0x4'),_0x96ce('0x5'))},'description':{'type':Sequelize[_0x96ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f01c3b1..124db0b 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 _0xd6b9=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserWhatsappQueue','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappQueueId','filter','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','%s/%s','SIP','getTeams','Team','order','ids','Agents','online','interface','flatMap','transaction','addTeams','findOrCreate','emit','removeTeams','User','select','field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','update','then','get','WhatsappQueues','UserProfileResource','destroy','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','include','query','findAll','catch','model','keys','intersection','fields','attributes','length','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId'];(function(_0x4143a8,_0x3dbc9e){var _0x1ada4c=function(_0x4e74df){while(--_0x4e74df){_0x4143a8['push'](_0x4143a8['shift']());}};_0x1ada4c(++_0x3dbc9e);}(_0xd6b9,0x137));var _0x9d6b=function(_0x2d7f58,_0x4d5c28){_0x2d7f58=_0x2d7f58-0x0;var _0x174c16=_0xd6b9[_0x2d7f58];return _0x174c16;};'use strict';var BPromise=require(_0x9d6b('0x0'));var util=require(_0x9d6b('0x1'));var _=require(_0x9d6b('0x2'));var squel=require(_0x9d6b('0x3'));var Redis=require(_0x9d6b('0x4'));var qs=require(_0x9d6b('0x5'));var logger=require(_0x9d6b('0x6'))(_0x9d6b('0x7'));var config=require(_0x9d6b('0x8'));var db=require(_0x9d6b('0x9'))['db'];config[_0x9d6b('0xa')]=_[_0x9d6b('0xb')](config['redis'],{'host':_0x9d6b('0xc'),'port':0x18eb});var socket=require(_0x9d6b('0xd'))(new Redis(config[_0x9d6b('0xa')]));require(_0x9d6b('0xe'))[_0x9d6b('0xf')](socket);function respondWithStatusCode(_0x22a9a3,_0x3c8cd4){_0x3c8cd4=_0x3c8cd4||0xcc;return function(_0x1bdec7){if(_0x1bdec7){return _0x22a9a3[_0x9d6b('0x10')](_0x3c8cd4);}return _0x22a9a3[_0x9d6b('0x11')](_0x3c8cd4)[_0x9d6b('0x12')]();};}function respondWithResult(_0x19ed3a,_0x2273e9){_0x2273e9=_0x2273e9||0xc8;return function(_0x46f43c){if(_0x46f43c){return _0x19ed3a[_0x9d6b('0x11')](_0x2273e9)[_0x9d6b('0x13')](_0x46f43c);}};}function respondWithFilteredResult(_0xd44631,_0x52edda){return function(_0x15060d){if(_0x15060d){var _0x22e96e=typeof _0x52edda['offset']===_0x9d6b('0x14')&&typeof _0x52edda[_0x9d6b('0x15')]===_0x9d6b('0x14');var _0x437ac0=_0x15060d[_0x9d6b('0x16')];var _0x5e9dac=_0x22e96e?0x0:_0x52edda[_0x9d6b('0x17')];var _0x176b4b=_0x22e96e?_0x15060d['count']:_0x52edda[_0x9d6b('0x17')]+_0x52edda['limit'];var _0x557b97;if(_0x176b4b>=_0x437ac0){_0x176b4b=_0x437ac0;_0x557b97=0xc8;}else{_0x557b97=0xce;}_0xd44631[_0x9d6b('0x11')](_0x557b97);return _0xd44631['set']('Content-Range',_0x5e9dac+'-'+_0x176b4b+'/'+_0x437ac0)[_0x9d6b('0x13')](_0x15060d);}return null;};}function saveUpdates(_0x146c60){return function(_0x33129b){if(_0x33129b){return _0x33129b[_0x9d6b('0x18')](_0x146c60)[_0x9d6b('0x19')](function(_0x5af2f8){return _0x5af2f8;});}return null;};}function removeEntity(_0x498453){return function(_0x249707){if(_0x249707){return _0x249707['destroy']()[_0x9d6b('0x19')](function(){var _0x4dd6d7=_0x249707[_0x9d6b('0x1a')]({'plain':!![]});var _0x48b2a4=_0x9d6b('0x1b');return db[_0x9d6b('0x1c')][_0x9d6b('0x1d')]({'where':{'type':_0x48b2a4,'resourceId':_0x4dd6d7['id']}})['then'](function(){return _0x249707;});})[_0x9d6b('0x19')](function(){_0x498453['status'](0xcc)[_0x9d6b('0x12')]();});}};}function handleEntityNotFound(_0x3be623){return function(_0x2c8a3d){if(!_0x2c8a3d){_0x3be623[_0x9d6b('0x10')](0x194);}return _0x2c8a3d;};}function handleError(_0x3e9f30,_0xdb00f4){_0xdb00f4=_0xdb00f4||0x1f4;return function(_0x57a81c){logger['error'](_0x57a81c[_0x9d6b('0x1e')]);if(_0x57a81c[_0x9d6b('0x1f')]){delete _0x57a81c[_0x9d6b('0x1f')];}_0x3e9f30[_0x9d6b('0x11')](_0xdb00f4)[_0x9d6b('0x20')](_0x57a81c);};}exports[_0x9d6b('0x21')]=function(_0x4e22d9,_0x48a18d){var _0x11f4d2={};var _0x39686c={'count':0x0,'rows':[]};var _0x4c95c4=_[_0x9d6b('0x22')](db[_0x9d6b('0x23')][_0x9d6b('0x24')],function(_0x52cff7){return{'name':_0x52cff7[_0x9d6b('0x25')],'type':_0x52cff7[_0x9d6b('0x26')][_0x9d6b('0x27')]};});_0x11f4d2=qs[_0x9d6b('0x28')](_0x4c95c4,_0x4e22d9);var _0x1ee886={'where':_0x11f4d2['where']};return db['WhatsappQueue']['count'](_0x1ee886)[_0x9d6b('0x19')](function(_0x960e5e){_0x39686c[_0x9d6b('0x16')]=_0x960e5e;_0x11f4d2['include']=qs[_0x9d6b('0x29')](_0x4e22d9[_0x9d6b('0x2a')]);return db[_0x9d6b('0x23')][_0x9d6b('0x2b')](_0x11f4d2);})[_0x9d6b('0x19')](function(_0xb6d217){_0x39686c['rows']=_0xb6d217;return _0x39686c;})[_0x9d6b('0x19')](respondWithFilteredResult(_0x48a18d,_0x11f4d2))[_0x9d6b('0x2c')](handleError(_0x48a18d,null));};exports['show']=function(_0x26f849,_0x28a436){var _0x26c16e={'raw':!![],'where':{'id':_0x26f849['params']['id']}},_0x48d9b8={};_0x48d9b8[_0x9d6b('0x2d')]=_[_0x9d6b('0x2e')](db[_0x9d6b('0x23')][_0x9d6b('0x24')]);_0x48d9b8[_0x9d6b('0x2a')]=_['keys'](_0x26f849['query']);_0x48d9b8['filters']=_['intersection'](_0x48d9b8['model'],_0x48d9b8[_0x9d6b('0x2a')]);_0x26c16e['attributes']=_[_0x9d6b('0x2f')](_0x48d9b8['model'],qs[_0x9d6b('0x30')](_0x26f849['query'][_0x9d6b('0x30')]));_0x26c16e[_0x9d6b('0x31')]=_0x26c16e[_0x9d6b('0x31')][_0x9d6b('0x32')]?_0x26c16e[_0x9d6b('0x31')]:_0x48d9b8[_0x9d6b('0x2d')];if(_0x26f849[_0x9d6b('0x2a')][_0x9d6b('0x33')]){_0x26c16e[_0x9d6b('0x29')]=[{'all':!![]}];}_0x26c16e=_[_0x9d6b('0x34')]({},_0x26c16e,_0x26f849[_0x9d6b('0x35')]);return db[_0x9d6b('0x23')][_0x9d6b('0x36')](_0x26c16e)[_0x9d6b('0x19')](handleEntityNotFound(_0x28a436,null))[_0x9d6b('0x19')](respondWithResult(_0x28a436,null))[_0x9d6b('0x2c')](handleError(_0x28a436,null));};exports[_0x9d6b('0x37')]=function(_0x1b15f1,_0x50aa9b){return db['WhatsappQueue'][_0x9d6b('0x37')](_0x1b15f1['body'],{})[_0x9d6b('0x19')](function(_0x5f3855){var _0x5aac29=_0x1b15f1['user'][_0x9d6b('0x1a')]({'plain':!![]});if(!_0x5aac29)throw new Error(_0x9d6b('0x38'));if(_0x5aac29['role']==='user'){var _0x14bfd1=_0x5f3855[_0x9d6b('0x1a')]({'plain':!![]});var _0x52bbdf='WhatsappQueues';return db['UserProfileSection']['find']({'where':{'name':_0x52bbdf,'userProfileId':_0x5aac29[_0x9d6b('0x39')]},'raw':!![]})['then'](function(_0x44cf25){if(_0x44cf25&&_0x44cf25[_0x9d6b('0x3a')]===0x0){return db[_0x9d6b('0x1c')][_0x9d6b('0x37')]({'name':_0x14bfd1[_0x9d6b('0x1f')],'resourceId':_0x14bfd1['id'],'type':_0x44cf25[_0x9d6b('0x1f')],'sectionId':_0x44cf25['id']},{})[_0x9d6b('0x19')](function(){return _0x5f3855;});}else{return _0x5f3855;}})['catch'](function(_0x5222f1){logger[_0x9d6b('0x3b')](_0x9d6b('0x3c'),_0x5222f1);throw _0x5222f1;});}return _0x5f3855;})[_0x9d6b('0x19')](respondWithResult(_0x50aa9b,0xc9))[_0x9d6b('0x2c')](handleError(_0x50aa9b,null));};exports[_0x9d6b('0x18')]=function(_0x45f010,_0x5c2d91){if(_0x45f010['body']['id']){delete _0x45f010[_0x9d6b('0x3d')]['id'];}return db[_0x9d6b('0x23')][_0x9d6b('0x36')]({'where':{'id':_0x45f010[_0x9d6b('0x3e')]['id']}})[_0x9d6b('0x19')](handleEntityNotFound(_0x5c2d91,null))[_0x9d6b('0x19')](saveUpdates(_0x45f010['body'],null))['then'](respondWithResult(_0x5c2d91,null))['catch'](handleError(_0x5c2d91,null));};exports[_0x9d6b('0x1d')]=function(_0x498be1,_0xecd976){return db[_0x9d6b('0x23')][_0x9d6b('0x36')]({'where':{'id':_0x498be1[_0x9d6b('0x3e')]['id']}})[_0x9d6b('0x19')](handleEntityNotFound(_0xecd976,null))[_0x9d6b('0x19')](removeEntity(_0xecd976,null))[_0x9d6b('0x2c')](handleError(_0xecd976,null));};exports[_0x9d6b('0x3f')]=function(_0x3a31ba,_0x3986d7){return db[_0x9d6b('0x23')][_0x9d6b('0x3f')]()[_0x9d6b('0x19')](respondWithResult(_0x3986d7,null))[_0x9d6b('0x2c')](handleError(_0x3986d7,null));};exports[_0x9d6b('0x40')]=function(_0x5f0905,_0x348099){var _0x535bd4={'raw':!![],'where':{}},_0x554de8={},_0x1f862d;return db['WhatsappQueue'][_0x9d6b('0x41')]({'where':{'id':_0x5f0905[_0x9d6b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x348099,null))[_0x9d6b('0x19')](function(_0x264943){if(_0x264943){_0x1f862d=_0x264943[_0x9d6b('0x1a')]({'plain':!![]});_0x554de8[_0x9d6b('0x2d')]=_[_0x9d6b('0x2e')](db[_0x9d6b('0x42')][_0x9d6b('0x24')]);_0x554de8[_0x9d6b('0x2a')]=_[_0x9d6b('0x2e')](_0x5f0905[_0x9d6b('0x2a')]);_0x554de8[_0x9d6b('0x43')]=_[_0x9d6b('0x2f')](_0x554de8[_0x9d6b('0x2d')],_0x554de8[_0x9d6b('0x2a')]);_0x535bd4[_0x9d6b('0x31')]=_[_0x9d6b('0x2f')](_0x554de8[_0x9d6b('0x2d')],qs['fields'](_0x5f0905[_0x9d6b('0x2a')][_0x9d6b('0x30')]));_0x535bd4[_0x9d6b('0x31')]=_0x535bd4[_0x9d6b('0x31')]['length']?_0x535bd4[_0x9d6b('0x31')]:_0x554de8[_0x9d6b('0x2d')];if(!_0x5f0905[_0x9d6b('0x2a')][_0x9d6b('0x44')](_0x9d6b('0x45'))){_0x535bd4[_0x9d6b('0x15')]=qs[_0x9d6b('0x15')](_0x5f0905['query'][_0x9d6b('0x15')]);_0x535bd4[_0x9d6b('0x17')]=qs[_0x9d6b('0x17')](_0x5f0905[_0x9d6b('0x2a')]['offset']);}_0x535bd4['order']=qs[_0x9d6b('0x46')](_0x5f0905['query'][_0x9d6b('0x46')]);_0x535bd4[_0x9d6b('0x47')]=qs[_0x9d6b('0x43')](_[_0x9d6b('0x48')](_0x5f0905[_0x9d6b('0x2a')],_0x554de8[_0x9d6b('0x43')]));_0x535bd4[_0x9d6b('0x47')][_0x9d6b('0x49')]=_0x264943['id'];if(_0x5f0905['query'][_0x9d6b('0x4a')]){_0x535bd4[_0x9d6b('0x47')]=_[_0x9d6b('0x34')](_0x535bd4[_0x9d6b('0x47')],{'$or':_[_0x9d6b('0x22')](_0x535bd4[_0x9d6b('0x31')],function(_0x4181ea){var _0x5c44f5={};_0x5c44f5[_0x4181ea]={'$like':'%'+_0x5f0905['query']['filter']+'%'};return _0x5c44f5;})});}_0x535bd4=_[_0x9d6b('0x34')]({},_0x535bd4,_0x5f0905['options']);return db[_0x9d6b('0x42')][_0x9d6b('0x2b')](_0x535bd4);}})[_0x9d6b('0x19')](function(_0x44be63){if(_0x44be63){return db['User'][_0x9d6b('0x4b')]({'where':{'id':_[_0x9d6b('0x22')](_0x44be63,_0x9d6b('0x4c')),'role':_0x9d6b('0x4d')},'attributes':['id',_0x9d6b('0x1f'),_0x9d6b('0x4e'),_0x9d6b('0x4f'),'createdAt']});}})['then'](function(_0x498d52){if(_0x498d52){return{'count':_0x498d52[_0x9d6b('0x16')],'rows':_['map'](_0x498d52[_0x9d6b('0x50')],function(_0x2be959){return{'membername':_0x2be959[_0x9d6b('0x1f')],'UserId':_0x2be959['id'],'queue_name':_0x1f862d['name'],'WhatsappQueueId':_0x1f862d['id'],'interface':util[_0x9d6b('0x51')](_0x9d6b('0x52'),_0x9d6b('0x53'),_0x2be959['name']),'penalty':0x0,'paused':_0x2be959[_0x9d6b('0x4e')],'createdAt':_0x2be959['createdAt'],'updatedAt':_0x2be959[_0x9d6b('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9d6b('0x19')](respondWithFilteredResult(_0x348099,_0x535bd4))[_0x9d6b('0x2c')](handleError(_0x348099,null));};exports[_0x9d6b('0x54')]=function(_0x111f46,_0x23c166){var _0x4bf807={};var _0x1fd32c={};var _0x26a551;var _0x9fb946;return db['WhatsappQueue'][_0x9d6b('0x41')]({'where':{'id':_0x111f46['params']['id']}})[_0x9d6b('0x19')](handleEntityNotFound(_0x23c166,null))['then'](function(_0x1837d3){if(_0x1837d3){_0x26a551=_0x1837d3;_0x1fd32c[_0x9d6b('0x2d')]=_['keys'](db[_0x9d6b('0x55')][_0x9d6b('0x24')]);_0x1fd32c[_0x9d6b('0x2a')]=_[_0x9d6b('0x2e')](_0x111f46[_0x9d6b('0x2a')]);_0x1fd32c[_0x9d6b('0x43')]=_['intersection'](_0x1fd32c['model'],_0x1fd32c[_0x9d6b('0x2a')]);_0x4bf807[_0x9d6b('0x31')]=_[_0x9d6b('0x2f')](_0x1fd32c[_0x9d6b('0x2d')],qs['fields'](_0x111f46[_0x9d6b('0x2a')][_0x9d6b('0x30')]));_0x4bf807[_0x9d6b('0x31')]=_0x4bf807['attributes'][_0x9d6b('0x32')]?_0x4bf807[_0x9d6b('0x31')]:_0x1fd32c[_0x9d6b('0x2d')];_0x4bf807[_0x9d6b('0x56')]=qs[_0x9d6b('0x46')](_0x111f46['query'][_0x9d6b('0x46')]);_0x4bf807[_0x9d6b('0x47')]=qs['filters'](_[_0x9d6b('0x48')](_0x111f46[_0x9d6b('0x2a')],_0x1fd32c[_0x9d6b('0x43')]));if(_0x111f46[_0x9d6b('0x2a')][_0x9d6b('0x4a')]){_0x4bf807[_0x9d6b('0x47')]=_[_0x9d6b('0x34')](_0x4bf807[_0x9d6b('0x47')],{'$or':_[_0x9d6b('0x22')](_0x4bf807[_0x9d6b('0x31')],function(_0x74a71c){var _0x5a0e7a={};_0x5a0e7a[_0x74a71c]={'$like':'%'+_0x111f46[_0x9d6b('0x2a')]['filter']+'%'};return _0x5a0e7a;})});}_0x4bf807=_[_0x9d6b('0x34')]({},_0x4bf807,_0x111f46[_0x9d6b('0x35')]);return _0x26a551[_0x9d6b('0x54')](_0x4bf807);}})['then'](function(_0x57934d){if(_0x57934d){_0x9fb946=_0x57934d[_0x9d6b('0x32')];if(!_0x111f46[_0x9d6b('0x2a')][_0x9d6b('0x44')](_0x9d6b('0x45'))){_0x4bf807[_0x9d6b('0x15')]=qs[_0x9d6b('0x15')](_0x111f46[_0x9d6b('0x2a')][_0x9d6b('0x15')]);_0x4bf807[_0x9d6b('0x17')]=qs[_0x9d6b('0x17')](_0x111f46[_0x9d6b('0x2a')][_0x9d6b('0x17')]);}return _0x26a551[_0x9d6b('0x54')](_0x4bf807);}})[_0x9d6b('0x19')](function(_0x58f157){if(_0x58f157){return _0x58f157?{'count':_0x9fb946,'rows':_0x58f157}:null;}})[_0x9d6b('0x19')](respondWithResult(_0x23c166,null))[_0x9d6b('0x2c')](handleError(_0x23c166,null));};exports['addTeams']=function(_0x527b14,_0x3499a8){var _0x3c5fb5=_0x527b14[_0x9d6b('0x3d')][_0x9d6b('0x57')];return db[_0x9d6b('0x55')][_0x9d6b('0x2b')]({'where':{'id':_0x3c5fb5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9d6b('0x58'),'attributes':['id','name',_0x9d6b('0x59'),'voicePause',_0x9d6b('0x5a')],'raw':!![]}]})['then'](function(_0x40bb95){if(_0x40bb95){var _0x5ba2e1=_[_0x9d6b('0x5b')](_0x40bb95,function(_0x2226f2){var _0x2f47a8=_0x2226f2[_0x9d6b('0x1a')]({'plain':!![]});return _0x2f47a8[_0x9d6b('0x58')];});return db[_0x9d6b('0x23')][_0x9d6b('0x36')]({'where':{'id':_0x527b14[_0x9d6b('0x3e')]['id']}})[_0x9d6b('0x19')](function(_0x43f61f){return db['sequelize'][_0x9d6b('0x5c')](function(_0x2ab6a0){return _0x43f61f[_0x9d6b('0x5d')](_0x3c5fb5,{'transaction':_0x2ab6a0})[_0x9d6b('0x19')](function(){return BPromise['each'](_0x5ba2e1,function(_0x45e220){return db[_0x9d6b('0x42')][_0x9d6b('0x5e')]({'where':{'UserId':_0x45e220['id'],'WhatsappQueueId':_0x527b14[_0x9d6b('0x3e')]['id']},'transaction':_0x2ab6a0});});})[_0x9d6b('0x19')](function(){_0x5ba2e1['forEach'](function(_0x205530){socket[_0x9d6b('0x5f')]('userWhatsappQueue:save',{'UserId':_0x205530['id'],'WhatsappQueueId':_0x43f61f['id']});});});});});}})[_0x9d6b('0x19')](respondWithStatusCode(_0x3499a8,null))[_0x9d6b('0x2c')](handleError(_0x3499a8,null));};exports[_0x9d6b('0x60')]=function(_0x5dc407,_0x541e00){return db['Team'][_0x9d6b('0x2b')]({'where':{'id':_0x5dc407[_0x9d6b('0x2a')][_0x9d6b('0x57')]},'attributes':['id'],'include':[{'model':db[_0x9d6b('0x61')],'as':_0x9d6b('0x58'),'attributes':['id'],'raw':!![]}]})[_0x9d6b('0x19')](handleEntityNotFound(_0x541e00,null))['then'](function(_0x4a4fec){var _0x4784d4=_['map'](_0x4a4fec,'id');var _0x2223b1=[];var _0x1efa21=[];var _0xd367e0=squel[_0x9d6b('0x62')]();_0xd367e0[_0x9d6b('0x63')](_0x9d6b('0x64'))['from'](_0x9d6b('0x65'),'tq')[_0x9d6b('0x66')]('user_has_teams','ut',_0x9d6b('0x67'))[_0x9d6b('0x47')](_0x9d6b('0x68'),_0x5dc407[_0x9d6b('0x3e')]['id']);for(var _0x6c2a66=0x0;_0x6c2a66<_0x4a4fec[_0x9d6b('0x32')];_0x6c2a66+=0x1){let _0x50387d=_0x4a4fec[_0x6c2a66];for(var _0x49c88a=0x0;_0x49c88a<_0x50387d['Agents'][_0x9d6b('0x32')];_0x49c88a+=0x1){let _0x581575=_0x50387d[_0x9d6b('0x58')][_0x49c88a];var _0x119407=_0xd367e0[_0x9d6b('0x69')]();_0x119407['where']('ut.UserId\x20=\x20?',_0x581575['id']);_0x1efa21[_0x9d6b('0x6a')](db['sequelize'][_0x9d6b('0x2a')](_0x119407['toString'](),{'type':db[_0x9d6b('0x6b')][_0x9d6b('0x6c')][_0x9d6b('0x6d')]})[_0x9d6b('0x19')](function(_0x38c3e4){if(_0x38c3e4[_0x9d6b('0x32')]===0x1){return _0x581575['id'];}else{var _0x42de26=_[_0x9d6b('0x6e')](_[_0x9d6b('0x22')](_0x38c3e4,_0x9d6b('0x6f')),function(_0x2912b0){return _[_0x9d6b('0x70')](_0x4784d4,_0x2912b0);});if(_0x42de26){return _0x581575['id'];}}}));}}return BPromise['all'](_0x1efa21)[_0x9d6b('0x19')](function(_0x480fc0){_0x2223b1=_(_0x2223b1)[_0x9d6b('0x71')](_0x480fc0)['compact']()[_0x9d6b('0x72')]();return db['WhatsappQueue'][_0x9d6b('0x36')]({'where':{'id':_0x5dc407[_0x9d6b('0x3e')]['id']}})['then'](function(_0x31e347){return db[_0x9d6b('0x6b')][_0x9d6b('0x5c')](function(_0x2a0eb4){return _0x31e347[_0x9d6b('0x60')](_0x5dc407[_0x9d6b('0x2a')][_0x9d6b('0x57')],{'transaction':_0x2a0eb4})[_0x9d6b('0x19')](function(){if(!_[_0x9d6b('0x73')](_0x2223b1)){return _0x31e347['removeAgents'](_0x2223b1,{'transaction':_0x2a0eb4});}})[_0x9d6b('0x19')](function(){_0x2223b1[_0x9d6b('0x74')](function(_0x1e52f0){socket['emit'](_0x9d6b('0x75'),{'UserId':_0x1e52f0,'WhatsappQueueId':_0x31e347['id']});});});});});});})[_0x9d6b('0x19')](respondWithStatusCode(_0x541e00,null))['catch'](handleError(_0x541e00,null));};exports[_0x9d6b('0x76')]=function(_0x335dbd,_0xd6408){return db[_0x9d6b('0x23')][_0x9d6b('0x36')]({'where':{'id':_0x335dbd['params']['id']}})[_0x9d6b('0x19')](handleEntityNotFound(_0xd6408,null))[_0x9d6b('0x19')](function(_0x511f8e){if(_0x511f8e){return _0x511f8e['addAgents'](_0x335dbd[_0x9d6b('0x3d')][_0x9d6b('0x57')],_[_0x9d6b('0x77')](_0x335dbd['body'],[_0x9d6b('0x57'),'id'])||{})[_0x9d6b('0x78')](function(_0xed4f3d){for(var _0x5a8377=0x0;_0x5a8377<_0x335dbd[_0x9d6b('0x3d')][_0x9d6b('0x57')]['length'];_0x5a8377+=0x1){socket[_0x9d6b('0x5f')]('userWhatsappQueue:save',{'UserId':Number(_0x335dbd[_0x9d6b('0x3d')][_0x9d6b('0x57')][_0x5a8377]),'WhatsappQueueId':Number(_0x335dbd['params']['id'])});}return _0xed4f3d;});}})['then'](respondWithResult(_0xd6408,null))[_0x9d6b('0x2c')](handleError(_0xd6408,null));};exports['removeAgents']=function(_0x174622,_0x4d94bd){return db['WhatsappQueue']['find']({'where':{'id':_0x174622[_0x9d6b('0x3e')]['id']}})[_0x9d6b('0x19')](handleEntityNotFound(_0x4d94bd,null))[_0x9d6b('0x19')](function(_0x1b492f){if(_0x1b492f){return _0x1b492f[_0x9d6b('0x79')](_0x174622[_0x9d6b('0x2a')][_0x9d6b('0x57')])['then'](function(){if(_['isArray'](_0x174622[_0x9d6b('0x2a')][_0x9d6b('0x57')])){for(var _0x34d410=0x0;_0x34d410<_0x174622[_0x9d6b('0x2a')][_0x9d6b('0x57')][_0x9d6b('0x32')];_0x34d410+=0x1){socket[_0x9d6b('0x5f')](_0x9d6b('0x75'),{'UserId':Number(_0x174622[_0x9d6b('0x2a')][_0x9d6b('0x57')][_0x34d410]),'WhatsappQueueId':Number(_0x174622[_0x9d6b('0x3e')]['id'])});}}else{socket[_0x9d6b('0x5f')](_0x9d6b('0x75'),{'UserId':Number(_0x174622[_0x9d6b('0x2a')][_0x9d6b('0x57')]),'WhatsappQueueId':Number(_0x174622[_0x9d6b('0x3e')]['id'])});}});}})[_0x9d6b('0x19')](respondWithStatusCode(_0x4d94bd,null))['catch'](handleError(_0x4d94bd,null));};exports['getAgents']=function(_0xb2e537,_0x239eea){var _0x34014d={};var _0x333735={};var _0x281ee2;var _0x367510;return db[_0x9d6b('0x23')][_0x9d6b('0x41')]({'where':{'id':_0xb2e537[_0x9d6b('0x3e')]['id']}})[_0x9d6b('0x19')](handleEntityNotFound(_0x239eea,null))[_0x9d6b('0x19')](function(_0x1c0418){if(_0x1c0418){_0x281ee2=_0x1c0418;_0x333735['model']=_[_0x9d6b('0x2e')](db['User'][_0x9d6b('0x24')]);_0x333735['query']=_['keys'](_0xb2e537[_0x9d6b('0x2a')]);_0x333735['filters']=_['intersection'](_0x333735[_0x9d6b('0x2d')],_0x333735[_0x9d6b('0x2a')]);_0x34014d[_0x9d6b('0x31')]=_[_0x9d6b('0x2f')](_0x333735[_0x9d6b('0x2d')],qs['fields'](_0xb2e537['query'][_0x9d6b('0x30')]));_0x34014d['attributes']=_0x34014d[_0x9d6b('0x31')][_0x9d6b('0x32')]?_0x34014d['attributes']:_0x333735[_0x9d6b('0x2d')];_0x34014d['order']=qs[_0x9d6b('0x46')](_0xb2e537[_0x9d6b('0x2a')][_0x9d6b('0x46')]);_0x34014d[_0x9d6b('0x47')]=qs[_0x9d6b('0x43')](_[_0x9d6b('0x48')](_0xb2e537['query'],_0x333735[_0x9d6b('0x43')]));if(_0xb2e537['query']['filter']){_0x34014d['where']=_['merge'](_0x34014d['where'],{'$or':_[_0x9d6b('0x22')](_0x34014d[_0x9d6b('0x31')],function(_0x501e34){var _0x238d0d={};_0x238d0d[_0x501e34]={'$like':'%'+_0xb2e537[_0x9d6b('0x2a')]['filter']+'%'};return _0x238d0d;})});}_0x34014d=_[_0x9d6b('0x34')]({},_0x34014d,_0xb2e537[_0x9d6b('0x35')]);return _0x281ee2[_0x9d6b('0x7a')](_0x34014d);}})['then'](function(_0x4f30f8){if(_0x4f30f8){_0x367510=_0x4f30f8[_0x9d6b('0x32')];if(!_0xb2e537[_0x9d6b('0x2a')][_0x9d6b('0x44')]('nolimit')){_0x34014d[_0x9d6b('0x15')]=qs[_0x9d6b('0x15')](_0xb2e537[_0x9d6b('0x2a')][_0x9d6b('0x15')]);_0x34014d[_0x9d6b('0x17')]=qs['offset'](_0xb2e537[_0x9d6b('0x2a')][_0x9d6b('0x17')]);}return _0x281ee2[_0x9d6b('0x7a')](_0x34014d);}})[_0x9d6b('0x19')](function(_0x26836d){if(_0x26836d){return _0x26836d?{'count':_0x367510,'rows':_0x26836d}:null;}})[_0x9d6b('0x19')](respondWithResult(_0x239eea,null))[_0x9d6b('0x2c')](handleError(_0x239eea,null));}; \ No newline at end of file +var _0x3958=['register','status','end','json','offset','undefined','count','limit','set','then','destroy','get','UserProfileResource','sendStatus','stack','name','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','include','query','findAll','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','options','create','body','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','update','find','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','where','filters','WhatsappQueueId','filter','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','pick','addTeams','ids','Agents','interface','flatMap','sequelize','transaction','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','SELECT','every','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket'];(function(_0x57e7f8,_0x328bcd){var _0x39f93b=function(_0x478568){while(--_0x478568){_0x57e7f8['push'](_0x57e7f8['shift']());}};_0x39f93b(++_0x328bcd);}(_0x3958,0x6a));var _0x8395=function(_0x5da0dd,_0x621a99){_0x5da0dd=_0x5da0dd-0x0;var _0x2e0032=_0x3958[_0x5da0dd];return _0x2e0032;};'use strict';var BPromise=require(_0x8395('0x0'));var util=require('util');var _=require(_0x8395('0x1'));var squel=require(_0x8395('0x2'));var Redis=require(_0x8395('0x3'));var qs=require(_0x8395('0x4'));var logger=require(_0x8395('0x5'))(_0x8395('0x6'));var config=require('../../config/environment');var db=require(_0x8395('0x7'))['db'];config['redis']=_['defaults'](config[_0x8395('0x8')],{'host':_0x8395('0x9'),'port':0x18eb});var socket=require(_0x8395('0xa'))(new Redis(config[_0x8395('0x8')]));require(_0x8395('0xb'))[_0x8395('0xc')](socket);function respondWithStatusCode(_0x31786e,_0x55fd66){_0x55fd66=_0x55fd66||0xcc;return function(_0x49efeb){if(_0x49efeb){return _0x31786e['sendStatus'](_0x55fd66);}return _0x31786e[_0x8395('0xd')](_0x55fd66)[_0x8395('0xe')]();};}function respondWithResult(_0x1f56ed,_0x200dab){_0x200dab=_0x200dab||0xc8;return function(_0x4f43d6){if(_0x4f43d6){return _0x1f56ed[_0x8395('0xd')](_0x200dab)[_0x8395('0xf')](_0x4f43d6);}};}function respondWithFilteredResult(_0xcfb8d5,_0x34faed){return function(_0x2f5bf2){if(_0x2f5bf2){var _0x60082e=typeof _0x34faed[_0x8395('0x10')]==='undefined'&&typeof _0x34faed['limit']===_0x8395('0x11');var _0x47a3b1=_0x2f5bf2[_0x8395('0x12')];var _0x53fcb4=_0x60082e?0x0:_0x34faed[_0x8395('0x10')];var _0x52792e=_0x60082e?_0x2f5bf2[_0x8395('0x12')]:_0x34faed['offset']+_0x34faed[_0x8395('0x13')];var _0x303dcf;if(_0x52792e>=_0x47a3b1){_0x52792e=_0x47a3b1;_0x303dcf=0xc8;}else{_0x303dcf=0xce;}_0xcfb8d5['status'](_0x303dcf);return _0xcfb8d5[_0x8395('0x14')]('Content-Range',_0x53fcb4+'-'+_0x52792e+'/'+_0x47a3b1)[_0x8395('0xf')](_0x2f5bf2);}return null;};}function saveUpdates(_0x454303){return function(_0x25614e){if(_0x25614e){return _0x25614e['update'](_0x454303)[_0x8395('0x15')](function(_0x2c62ac){return _0x2c62ac;});}return null;};}function removeEntity(_0xe1c06e){return function(_0x39f7b1){if(_0x39f7b1){return _0x39f7b1[_0x8395('0x16')]()[_0x8395('0x15')](function(){var _0x2ccfda=_0x39f7b1[_0x8395('0x17')]({'plain':!![]});var _0x3f3c33='WhatsappQueues';return db[_0x8395('0x18')][_0x8395('0x16')]({'where':{'type':_0x3f3c33,'resourceId':_0x2ccfda['id']}})[_0x8395('0x15')](function(){return _0x39f7b1;});})[_0x8395('0x15')](function(){_0xe1c06e[_0x8395('0xd')](0xcc)[_0x8395('0xe')]();});}};}function handleEntityNotFound(_0x3e1b16){return function(_0x488170){if(!_0x488170){_0x3e1b16[_0x8395('0x19')](0x194);}return _0x488170;};}function handleError(_0x5c3f18,_0x4da678){_0x4da678=_0x4da678||0x1f4;return function(_0xdaffd1){logger['error'](_0xdaffd1[_0x8395('0x1a')]);if(_0xdaffd1[_0x8395('0x1b')]){delete _0xdaffd1[_0x8395('0x1b')];}_0x5c3f18[_0x8395('0xd')](_0x4da678)['send'](_0xdaffd1);};}exports['index']=function(_0x4c6ba1,_0xa494ac){var _0x5c6e47={};var _0xa5e442={'count':0x0,'rows':[]};var _0x5114fe=_[_0x8395('0x1c')](db[_0x8395('0x1d')][_0x8395('0x1e')],function(_0x3224f9){return{'name':_0x3224f9[_0x8395('0x1f')],'type':_0x3224f9[_0x8395('0x20')][_0x8395('0x21')]};});_0x5c6e47=qs[_0x8395('0x22')](_0x5114fe,_0x4c6ba1);var _0x1e26d7={'where':_0x5c6e47['where']};return db['WhatsappQueue'][_0x8395('0x12')](_0x1e26d7)[_0x8395('0x15')](function(_0x51f835){_0xa5e442['count']=_0x51f835;_0x5c6e47[_0x8395('0x23')]=qs[_0x8395('0x23')](_0x4c6ba1[_0x8395('0x24')]);return db['WhatsappQueue'][_0x8395('0x25')](_0x5c6e47);})[_0x8395('0x15')](function(_0xe5a17b){_0xa5e442['rows']=_0xe5a17b;return _0xa5e442;})[_0x8395('0x15')](respondWithFilteredResult(_0xa494ac,_0x5c6e47))[_0x8395('0x26')](handleError(_0xa494ac,null));};exports[_0x8395('0x27')]=function(_0x2f4e00,_0x1b600a){var _0x3a6715={'raw':!![],'where':{'id':_0x2f4e00[_0x8395('0x28')]['id']}},_0x2e8c7e={};_0x2e8c7e[_0x8395('0x29')]=_[_0x8395('0x2a')](db[_0x8395('0x1d')][_0x8395('0x1e')]);_0x2e8c7e['query']=_['keys'](_0x2f4e00[_0x8395('0x24')]);_0x2e8c7e['filters']=_[_0x8395('0x2b')](_0x2e8c7e['model'],_0x2e8c7e[_0x8395('0x24')]);_0x3a6715[_0x8395('0x2c')]=_[_0x8395('0x2b')](_0x2e8c7e[_0x8395('0x29')],qs[_0x8395('0x2d')](_0x2f4e00[_0x8395('0x24')]['fields']));_0x3a6715[_0x8395('0x2c')]=_0x3a6715['attributes'][_0x8395('0x2e')]?_0x3a6715[_0x8395('0x2c')]:_0x2e8c7e[_0x8395('0x29')];if(_0x2f4e00['query'][_0x8395('0x2f')]){_0x3a6715[_0x8395('0x23')]=[{'all':!![]}];}_0x3a6715=_[_0x8395('0x30')]({},_0x3a6715,_0x2f4e00[_0x8395('0x31')]);return db[_0x8395('0x1d')]['find'](_0x3a6715)['then'](handleEntityNotFound(_0x1b600a,null))[_0x8395('0x15')](respondWithResult(_0x1b600a,null))['catch'](handleError(_0x1b600a,null));};exports[_0x8395('0x32')]=function(_0x32fc9e,_0x45df02){return db[_0x8395('0x1d')][_0x8395('0x32')](_0x32fc9e[_0x8395('0x33')],{})[_0x8395('0x15')](function(_0x57c6e1){var _0x37903c=_0x32fc9e['user']['get']({'plain':!![]});if(!_0x37903c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37903c['role']==='user'){var _0x143b84=_0x57c6e1[_0x8395('0x17')]({'plain':!![]});var _0x3cc064=_0x8395('0x34');return db[_0x8395('0x35')]['find']({'where':{'name':_0x3cc064,'userProfileId':_0x37903c[_0x8395('0x36')]},'raw':!![]})['then'](function(_0x2cbb27){if(_0x2cbb27&&_0x2cbb27[_0x8395('0x37')]===0x0){return db[_0x8395('0x18')][_0x8395('0x32')]({'name':_0x143b84['name'],'resourceId':_0x143b84['id'],'type':_0x2cbb27['name'],'sectionId':_0x2cbb27['id']},{})[_0x8395('0x15')](function(){return _0x57c6e1;});}else{return _0x57c6e1;}})[_0x8395('0x26')](function(_0xf23120){logger[_0x8395('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf23120);throw _0xf23120;});}return _0x57c6e1;})['then'](respondWithResult(_0x45df02,0xc9))[_0x8395('0x26')](handleError(_0x45df02,null));};exports[_0x8395('0x39')]=function(_0x50c8b0,_0x2afd88){if(_0x50c8b0[_0x8395('0x33')]['id']){delete _0x50c8b0[_0x8395('0x33')]['id'];}return db[_0x8395('0x1d')][_0x8395('0x3a')]({'where':{'id':_0x50c8b0[_0x8395('0x28')]['id']}})[_0x8395('0x15')](handleEntityNotFound(_0x2afd88,null))[_0x8395('0x15')](saveUpdates(_0x50c8b0[_0x8395('0x33')],null))['then'](respondWithResult(_0x2afd88,null))[_0x8395('0x26')](handleError(_0x2afd88,null));};exports[_0x8395('0x16')]=function(_0x357832,_0x647016){return db[_0x8395('0x1d')][_0x8395('0x3a')]({'where':{'id':_0x357832[_0x8395('0x28')]['id']}})[_0x8395('0x15')](handleEntityNotFound(_0x647016,null))[_0x8395('0x15')](removeEntity(_0x647016,null))[_0x8395('0x26')](handleError(_0x647016,null));};exports[_0x8395('0x3b')]=function(_0x3e44d5,_0x90dd6a){return db[_0x8395('0x1d')][_0x8395('0x3b')]()['then'](respondWithResult(_0x90dd6a,null))[_0x8395('0x26')](handleError(_0x90dd6a,null));};exports[_0x8395('0x3c')]=function(_0xadf959,_0x365562){var _0x28b02b={'raw':!![],'where':{}},_0xdf0dc8={},_0x28a97a;return db[_0x8395('0x1d')][_0x8395('0x3d')]({'where':{'id':_0xadf959['params']['id']}})[_0x8395('0x15')](handleEntityNotFound(_0x365562,null))['then'](function(_0x2d7641){if(_0x2d7641){_0x28a97a=_0x2d7641[_0x8395('0x17')]({'plain':!![]});_0xdf0dc8['model']=_[_0x8395('0x2a')](db['UserWhatsappQueue'][_0x8395('0x1e')]);_0xdf0dc8[_0x8395('0x24')]=_[_0x8395('0x2a')](_0xadf959[_0x8395('0x24')]);_0xdf0dc8['filters']=_[_0x8395('0x2b')](_0xdf0dc8[_0x8395('0x29')],_0xdf0dc8[_0x8395('0x24')]);_0x28b02b[_0x8395('0x2c')]=_[_0x8395('0x2b')](_0xdf0dc8[_0x8395('0x29')],qs[_0x8395('0x2d')](_0xadf959['query'][_0x8395('0x2d')]));_0x28b02b['attributes']=_0x28b02b[_0x8395('0x2c')][_0x8395('0x2e')]?_0x28b02b[_0x8395('0x2c')]:_0xdf0dc8[_0x8395('0x29')];if(!_0xadf959[_0x8395('0x24')][_0x8395('0x3e')](_0x8395('0x3f'))){_0x28b02b['limit']=qs[_0x8395('0x13')](_0xadf959['query'][_0x8395('0x13')]);_0x28b02b['offset']=qs[_0x8395('0x10')](_0xadf959[_0x8395('0x24')]['offset']);}_0x28b02b[_0x8395('0x40')]=qs[_0x8395('0x41')](_0xadf959[_0x8395('0x24')][_0x8395('0x41')]);_0x28b02b[_0x8395('0x42')]=qs[_0x8395('0x43')](_['pick'](_0xadf959[_0x8395('0x24')],_0xdf0dc8[_0x8395('0x43')]));_0x28b02b[_0x8395('0x42')][_0x8395('0x44')]=_0x2d7641['id'];if(_0xadf959[_0x8395('0x24')]['filter']){_0x28b02b[_0x8395('0x42')]=_[_0x8395('0x30')](_0x28b02b[_0x8395('0x42')],{'$or':_[_0x8395('0x1c')](_0x28b02b[_0x8395('0x2c')],function(_0x4590a6){var _0x28791c={};_0x28791c[_0x4590a6]={'$like':'%'+_0xadf959[_0x8395('0x24')][_0x8395('0x45')]+'%'};return _0x28791c;})});}_0x28b02b=_[_0x8395('0x30')]({},_0x28b02b,_0xadf959[_0x8395('0x31')]);return db['UserWhatsappQueue']['findAll'](_0x28b02b);}})['then'](function(_0x96229e){if(_0x96229e){return db[_0x8395('0x46')][_0x8395('0x47')]({'where':{'id':_[_0x8395('0x1c')](_0x96229e,_0x8395('0x48')),'role':'agent'},'attributes':['id',_0x8395('0x1b'),_0x8395('0x49'),_0x8395('0x4a'),_0x8395('0x4b')]});}})[_0x8395('0x15')](function(_0x5e522b){if(_0x5e522b){return{'count':_0x5e522b[_0x8395('0x12')],'rows':_[_0x8395('0x1c')](_0x5e522b[_0x8395('0x4c')],function(_0x53a76d){return{'membername':_0x53a76d['name'],'UserId':_0x53a76d['id'],'queue_name':_0x28a97a[_0x8395('0x1b')],'WhatsappQueueId':_0x28a97a['id'],'interface':util[_0x8395('0x4d')](_0x8395('0x4e'),'SIP',_0x53a76d[_0x8395('0x1b')]),'penalty':0x0,'paused':_0x53a76d[_0x8395('0x49')],'createdAt':_0x53a76d[_0x8395('0x4b')],'updatedAt':_0x53a76d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8395('0x15')](respondWithFilteredResult(_0x365562,_0x28b02b))[_0x8395('0x26')](handleError(_0x365562,null));};exports[_0x8395('0x4f')]=function(_0x46066a,_0x372dea){var _0x4fd500={};var _0x496387={};var _0xb0d0e3;var _0x503dc7;return db['WhatsappQueue'][_0x8395('0x3d')]({'where':{'id':_0x46066a['params']['id']}})['then'](handleEntityNotFound(_0x372dea,null))[_0x8395('0x15')](function(_0x6a20e3){if(_0x6a20e3){_0xb0d0e3=_0x6a20e3;_0x496387[_0x8395('0x29')]=_[_0x8395('0x2a')](db[_0x8395('0x50')][_0x8395('0x1e')]);_0x496387['query']=_[_0x8395('0x2a')](_0x46066a[_0x8395('0x24')]);_0x496387[_0x8395('0x43')]=_[_0x8395('0x2b')](_0x496387[_0x8395('0x29')],_0x496387[_0x8395('0x24')]);_0x4fd500[_0x8395('0x2c')]=_[_0x8395('0x2b')](_0x496387['model'],qs[_0x8395('0x2d')](_0x46066a[_0x8395('0x24')][_0x8395('0x2d')]));_0x4fd500[_0x8395('0x2c')]=_0x4fd500['attributes'][_0x8395('0x2e')]?_0x4fd500[_0x8395('0x2c')]:_0x496387[_0x8395('0x29')];_0x4fd500[_0x8395('0x40')]=qs[_0x8395('0x41')](_0x46066a[_0x8395('0x24')]['sort']);_0x4fd500['where']=qs['filters'](_[_0x8395('0x51')](_0x46066a['query'],_0x496387[_0x8395('0x43')]));if(_0x46066a[_0x8395('0x24')]['filter']){_0x4fd500[_0x8395('0x42')]=_[_0x8395('0x30')](_0x4fd500[_0x8395('0x42')],{'$or':_[_0x8395('0x1c')](_0x4fd500[_0x8395('0x2c')],function(_0x2de2b6){var _0x13f3c8={};_0x13f3c8[_0x2de2b6]={'$like':'%'+_0x46066a[_0x8395('0x24')][_0x8395('0x45')]+'%'};return _0x13f3c8;})});}_0x4fd500=_[_0x8395('0x30')]({},_0x4fd500,_0x46066a[_0x8395('0x31')]);return _0xb0d0e3[_0x8395('0x4f')](_0x4fd500);}})[_0x8395('0x15')](function(_0x35f59f){if(_0x35f59f){_0x503dc7=_0x35f59f[_0x8395('0x2e')];if(!_0x46066a[_0x8395('0x24')][_0x8395('0x3e')](_0x8395('0x3f'))){_0x4fd500['limit']=qs[_0x8395('0x13')](_0x46066a[_0x8395('0x24')][_0x8395('0x13')]);_0x4fd500[_0x8395('0x10')]=qs['offset'](_0x46066a[_0x8395('0x24')][_0x8395('0x10')]);}return _0xb0d0e3[_0x8395('0x4f')](_0x4fd500);}})[_0x8395('0x15')](function(_0x45129a){if(_0x45129a){return _0x45129a?{'count':_0x503dc7,'rows':_0x45129a}:null;}})[_0x8395('0x15')](respondWithResult(_0x372dea,null))[_0x8395('0x26')](handleError(_0x372dea,null));};exports[_0x8395('0x52')]=function(_0x1b7e50,_0x579f22){var _0x476d89=_0x1b7e50[_0x8395('0x33')][_0x8395('0x53')];return db[_0x8395('0x50')]['findAll']({'where':{'id':_0x476d89},'attributes':['id'],'include':[{'model':db[_0x8395('0x46')],'as':_0x8395('0x54'),'attributes':['id',_0x8395('0x1b'),'online','voicePause',_0x8395('0x55')],'raw':!![]}]})[_0x8395('0x15')](function(_0x26cc05){if(_0x26cc05){var _0x3dda11=_[_0x8395('0x56')](_0x26cc05,function(_0x2163c5){var _0x21cee3=_0x2163c5[_0x8395('0x17')]({'plain':!![]});return _0x21cee3['Agents'];});return db[_0x8395('0x1d')]['find']({'where':{'id':_0x1b7e50[_0x8395('0x28')]['id']}})[_0x8395('0x15')](function(_0x2ff705){return db[_0x8395('0x57')][_0x8395('0x58')](function(_0x2aca8f){return _0x2ff705[_0x8395('0x52')](_0x476d89,{'transaction':_0x2aca8f})[_0x8395('0x15')](function(){return BPromise['each'](_0x3dda11,function(_0x2cf52c){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x2cf52c['id'],'WhatsappQueueId':_0x1b7e50[_0x8395('0x28')]['id']},'transaction':_0x2aca8f});});})['then'](function(){_0x3dda11['forEach'](function(_0x4c0fc8){socket[_0x8395('0x59')]('userWhatsappQueue:save',{'UserId':_0x4c0fc8['id'],'WhatsappQueueId':_0x2ff705['id']});});});});});}})[_0x8395('0x15')](respondWithStatusCode(_0x579f22,null))['catch'](handleError(_0x579f22,null));};exports[_0x8395('0x5a')]=function(_0x15bddd,_0x502c36){return db[_0x8395('0x50')]['findAll']({'where':{'id':_0x15bddd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8395('0x46')],'as':_0x8395('0x54'),'attributes':['id'],'raw':!![]}]})[_0x8395('0x15')](handleEntityNotFound(_0x502c36,null))['then'](function(_0x4c79d8){var _0x3ce6a4=_['map'](_0x4c79d8,'id');var _0x3d4570=[];var _0x2b18a5=[];var _0x5a84cb=squel[_0x8395('0x5b')]();_0x5a84cb[_0x8395('0x5c')](_0x8395('0x5d'))[_0x8395('0x5e')](_0x8395('0x5f'),'tq')[_0x8395('0x60')](_0x8395('0x61'),'ut',_0x8395('0x62'))[_0x8395('0x42')](_0x8395('0x63'),_0x15bddd[_0x8395('0x28')]['id']);for(var _0x39ef45=0x0;_0x39ef45<_0x4c79d8[_0x8395('0x2e')];_0x39ef45+=0x1){let _0x3299c8=_0x4c79d8[_0x39ef45];for(var _0xd32424=0x0;_0xd32424<_0x3299c8[_0x8395('0x54')][_0x8395('0x2e')];_0xd32424+=0x1){let _0xa0f2a4=_0x3299c8[_0x8395('0x54')][_0xd32424];var _0x3894e6=_0x5a84cb[_0x8395('0x64')]();_0x3894e6[_0x8395('0x42')]('ut.UserId\x20=\x20?',_0xa0f2a4['id']);_0x2b18a5[_0x8395('0x65')](db[_0x8395('0x57')]['query'](_0x3894e6[_0x8395('0x66')](),{'type':db[_0x8395('0x57')]['QueryTypes'][_0x8395('0x67')]})[_0x8395('0x15')](function(_0x47ae76){if(_0x47ae76[_0x8395('0x2e')]===0x1){return _0xa0f2a4['id'];}else{var _0x1674c3=_[_0x8395('0x68')](_[_0x8395('0x1c')](_0x47ae76,'TeamId'),function(_0x4d3825){return _['includes'](_0x3ce6a4,_0x4d3825);});if(_0x1674c3){return _0xa0f2a4['id'];}}}));}}return BPromise['all'](_0x2b18a5)[_0x8395('0x15')](function(_0x31a198){_0x3d4570=_(_0x3d4570)[_0x8395('0x69')](_0x31a198)[_0x8395('0x6a')]()[_0x8395('0x6b')]();return db[_0x8395('0x1d')][_0x8395('0x3a')]({'where':{'id':_0x15bddd['params']['id']}})[_0x8395('0x15')](function(_0x2c0a54){return db['sequelize'][_0x8395('0x58')](function(_0x43539b){return _0x2c0a54[_0x8395('0x5a')](_0x15bddd[_0x8395('0x24')][_0x8395('0x53')],{'transaction':_0x43539b})['then'](function(){if(!_[_0x8395('0x6c')](_0x3d4570)){return _0x2c0a54[_0x8395('0x6d')](_0x3d4570,{'transaction':_0x43539b});}})[_0x8395('0x15')](function(){_0x3d4570[_0x8395('0x6e')](function(_0x488b0e){socket[_0x8395('0x59')]('userWhatsappQueue:remove',{'UserId':_0x488b0e,'WhatsappQueueId':_0x2c0a54['id']});});});});});});})['then'](respondWithStatusCode(_0x502c36,null))[_0x8395('0x26')](handleError(_0x502c36,null));};exports[_0x8395('0x6f')]=function(_0x207abc,_0x104b42){return db[_0x8395('0x1d')][_0x8395('0x3a')]({'where':{'id':_0x207abc[_0x8395('0x28')]['id']}})[_0x8395('0x15')](handleEntityNotFound(_0x104b42,null))['then'](function(_0x28ca48){if(_0x28ca48){return _0x28ca48[_0x8395('0x6f')](_0x207abc[_0x8395('0x33')][_0x8395('0x53')],_[_0x8395('0x70')](_0x207abc[_0x8395('0x33')],[_0x8395('0x53'),'id'])||{})[_0x8395('0x71')](function(_0x111a9f){for(var _0x9e4397=0x0;_0x9e4397<_0x207abc[_0x8395('0x33')][_0x8395('0x53')][_0x8395('0x2e')];_0x9e4397+=0x1){socket[_0x8395('0x59')](_0x8395('0x72'),{'UserId':Number(_0x207abc['body'][_0x8395('0x53')][_0x9e4397]),'WhatsappQueueId':Number(_0x207abc[_0x8395('0x28')]['id'])});}return _0x111a9f;});}})['then'](respondWithResult(_0x104b42,null))[_0x8395('0x26')](handleError(_0x104b42,null));};exports[_0x8395('0x6d')]=function(_0x17cb9a,_0x4aa4a8){return db[_0x8395('0x1d')][_0x8395('0x3a')]({'where':{'id':_0x17cb9a[_0x8395('0x28')]['id']}})[_0x8395('0x15')](handleEntityNotFound(_0x4aa4a8,null))[_0x8395('0x15')](function(_0x52fa10){if(_0x52fa10){return _0x52fa10[_0x8395('0x6d')](_0x17cb9a[_0x8395('0x24')][_0x8395('0x53')])[_0x8395('0x15')](function(){if(_[_0x8395('0x73')](_0x17cb9a[_0x8395('0x24')][_0x8395('0x53')])){for(var _0x335797=0x0;_0x335797<_0x17cb9a[_0x8395('0x24')]['ids'][_0x8395('0x2e')];_0x335797+=0x1){socket[_0x8395('0x59')](_0x8395('0x74'),{'UserId':Number(_0x17cb9a[_0x8395('0x24')][_0x8395('0x53')][_0x335797]),'WhatsappQueueId':Number(_0x17cb9a['params']['id'])});}}else{socket[_0x8395('0x59')](_0x8395('0x74'),{'UserId':Number(_0x17cb9a[_0x8395('0x24')][_0x8395('0x53')]),'WhatsappQueueId':Number(_0x17cb9a[_0x8395('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x4aa4a8,null))[_0x8395('0x26')](handleError(_0x4aa4a8,null));};exports[_0x8395('0x75')]=function(_0x9b84de,_0xe1ced5){var _0x406053={};var _0x5b7f6e={};var _0x26b40f;var _0x13ead1;return db['WhatsappQueue'][_0x8395('0x3d')]({'where':{'id':_0x9b84de[_0x8395('0x28')]['id']}})[_0x8395('0x15')](handleEntityNotFound(_0xe1ced5,null))[_0x8395('0x15')](function(_0x98ed43){if(_0x98ed43){_0x26b40f=_0x98ed43;_0x5b7f6e[_0x8395('0x29')]=_['keys'](db[_0x8395('0x46')][_0x8395('0x1e')]);_0x5b7f6e[_0x8395('0x24')]=_[_0x8395('0x2a')](_0x9b84de[_0x8395('0x24')]);_0x5b7f6e[_0x8395('0x43')]=_[_0x8395('0x2b')](_0x5b7f6e[_0x8395('0x29')],_0x5b7f6e[_0x8395('0x24')]);_0x406053[_0x8395('0x2c')]=_[_0x8395('0x2b')](_0x5b7f6e['model'],qs[_0x8395('0x2d')](_0x9b84de[_0x8395('0x24')]['fields']));_0x406053[_0x8395('0x2c')]=_0x406053[_0x8395('0x2c')][_0x8395('0x2e')]?_0x406053[_0x8395('0x2c')]:_0x5b7f6e[_0x8395('0x29')];_0x406053[_0x8395('0x40')]=qs[_0x8395('0x41')](_0x9b84de['query'][_0x8395('0x41')]);_0x406053[_0x8395('0x42')]=qs[_0x8395('0x43')](_[_0x8395('0x51')](_0x9b84de[_0x8395('0x24')],_0x5b7f6e[_0x8395('0x43')]));if(_0x9b84de[_0x8395('0x24')]['filter']){_0x406053[_0x8395('0x42')]=_['merge'](_0x406053[_0x8395('0x42')],{'$or':_[_0x8395('0x1c')](_0x406053[_0x8395('0x2c')],function(_0x1fa79c){var _0x576f49={};_0x576f49[_0x1fa79c]={'$like':'%'+_0x9b84de[_0x8395('0x24')][_0x8395('0x45')]+'%'};return _0x576f49;})});}_0x406053=_[_0x8395('0x30')]({},_0x406053,_0x9b84de[_0x8395('0x31')]);return _0x26b40f[_0x8395('0x75')](_0x406053);}})['then'](function(_0x4dd115){if(_0x4dd115){_0x13ead1=_0x4dd115[_0x8395('0x2e')];if(!_0x9b84de[_0x8395('0x24')][_0x8395('0x3e')](_0x8395('0x3f'))){_0x406053['limit']=qs[_0x8395('0x13')](_0x9b84de[_0x8395('0x24')][_0x8395('0x13')]);_0x406053[_0x8395('0x10')]=qs[_0x8395('0x10')](_0x9b84de[_0x8395('0x24')]['offset']);}return _0x26b40f['getAgents'](_0x406053);}})[_0x8395('0x15')](function(_0x24ca6f){if(_0x24ca6f){return _0x24ca6f?{'count':_0x13ead1,'rows':_0x24ca6f}:null;}})[_0x8395('0x15')](respondWithResult(_0xe1ced5,null))[_0x8395('0x26')](handleError(_0xe1ced5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 38440d6..a9661ca 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 _0xe342=['emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe342,0x1b2));var _0x2e34=function(_0x302f85,_0x5bcca3){_0x302f85=_0x302f85-0x0;var _0x5ef7cb=_0xe342[_0x302f85];return _0x5ef7cb;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x2e34('0x0'))['db'][_0x2e34('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2e34('0x2')](0x0);var events={'afterCreate':_0x2e34('0x3'),'afterUpdate':_0x2e34('0x4'),'afterDestroy':_0x2e34('0x5')};function emitEvent(_0x303085){return function(_0x4f0824,_0x3e3933,_0x2bc4b5){WhatsappQueueEvents['emit'](_0x303085+':'+_0x4f0824['id'],_0x4f0824);WhatsappQueueEvents[_0x2e34('0x6')](_0x303085,_0x4f0824);_0x2bc4b5(null);};}for(var e in events){if(events[_0x2e34('0x7')](e)){var event=events[e];WhatsappQueue[_0x2e34('0x8')](e,emitEvent(event));}}module[_0x2e34('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb0c4=['setMaxListeners','update','remove','emit','hook','exports','events','WhatsappQueue'];(function(_0x19109f,_0x472d8a){var _0x36cb4c=function(_0x313791){while(--_0x313791){_0x19109f['push'](_0x19109f['shift']());}};_0x36cb4c(++_0x472d8a);}(_0xb0c4,0x10e));var _0x4b0c=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xb0c4[_0x2cfb58];return _0xd99951;};'use strict';var EventEmitter=require(_0x4b0c('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x4b0c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4b0c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b0c('0x3'),'afterDestroy':_0x4b0c('0x4')};function emitEvent(_0x15afaf){return function(_0x201308,_0x286ef6,_0x57bb8d){WhatsappQueueEvents['emit'](_0x15afaf+':'+_0x201308['id'],_0x201308);WhatsappQueueEvents[_0x4b0c('0x5')](_0x15afaf,_0x201308);_0x57bb8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x4b0c('0x6')](e,emitEvent(event));}}module[_0x4b0c('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 94d5eff..2e7aaea 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 _0x7335=['../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x23b2f4,_0xf82ce){var _0x19d093=function(_0x5d7cbd){while(--_0x5d7cbd){_0x23b2f4['push'](_0x23b2f4['shift']());}};_0x19d093(++_0xf82ce);}(_0x7335,0xc8));var _0x5733=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x7335[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x5733('0x0'));var util=require(_0x5733('0x1'));var logger=require(_0x5733('0x2'))('api');var moment=require(_0x5733('0x3'));var BPromise=require(_0x5733('0x4'));var rp=require(_0x5733('0x5'));var fs=require('fs');var path=require(_0x5733('0x6'));var rimraf=require(_0x5733('0x7'));var config=require(_0x5733('0x8'));var attributes=require(_0x5733('0x9'));module['exports']=function(_0x3470e5,_0x171aec){return _0x3470e5[_0x5733('0xa')](_0x5733('0xb'),attributes,{'tableName':_0x5733('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd841=['WhatsappQueue','whatsapp_queues','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x563f95,_0x1421c2){var _0x267eae=function(_0x42baf5){while(--_0x42baf5){_0x563f95['push'](_0x563f95['shift']());}};_0x267eae(++_0x1421c2);}(_0xd841,0x112));var _0x1d84=function(_0x2a67ac,_0x52f069){_0x2a67ac=_0x2a67ac-0x0;var _0xb86849=_0xd841[_0x2a67ac];return _0xb86849;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1d84('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d84('0x1'));var fs=require('fs');var path=require(_0x1d84('0x2'));var rimraf=require(_0x1d84('0x3'));var config=require(_0x1d84('0x4'));var attributes=require('./whatsappQueue.attributes');module[_0x1d84('0x5')]=function(_0x96584b,_0x585d66){return _0x96584b['define'](_0x1d84('0x6'),attributes,{'tableName':_0x1d84('0x7'),'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 a264967..a8cfebc 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 _0x8164=['error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','info','GetWhatsappQueue','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x245605,_0x240d98){var _0x1a9581=function(_0x411645){while(--_0x411645){_0x245605['push'](_0x245605['shift']());}};_0x1a9581(++_0x240d98);}(_0x8164,0x1ac));var _0x4816=function(_0x47ae1f,_0x328d68){_0x47ae1f=_0x47ae1f-0x0;var _0x2a0233=_0x8164[_0x47ae1f];return _0x2a0233;};'use strict';var _=require(_0x4816('0x0'));var util=require(_0x4816('0x1'));var moment=require(_0x4816('0x2'));var BPromise=require(_0x4816('0x3'));var rs=require(_0x4816('0x4'));var fs=require('fs');var Redis=require(_0x4816('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4816('0x6'));var logger=require('../../config/logger')(_0x4816('0x7'));var config=require(_0x4816('0x8'));var jayson=require(_0x4816('0x9'));var client=jayson['client'][_0x4816('0xa')]({'port':0x232a});config['redis']=_[_0x4816('0xb')](config[_0x4816('0xc')],{'host':_0x4816('0xd'),'port':0x18eb});var socket=require(_0x4816('0xe'))(new Redis(config[_0x4816('0xc')]));require(_0x4816('0xf'))[_0x4816('0x10')](socket);function respondWithRpcPromise(_0x189d59,_0x21f485,_0x2609ef){return new BPromise(function(_0x2bb35e,_0x2e21ad){return client[_0x4816('0x11')](_0x189d59,_0x2609ef)[_0x4816('0x12')](function(_0x180844){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x21f485,'request\x20sent');logger[_0x4816('0x13')](_0x4816('0x14'),_0x21f485,_0x4816('0x15'),JSON[_0x4816('0x16')](_0x180844));if(_0x180844['error']){if(_0x180844[_0x4816('0x17')][_0x4816('0x18')]===0x1f4){logger['error'](_0x4816('0x19'),_0x21f485,_0x180844[_0x4816('0x17')][_0x4816('0x1a')]);return _0x2e21ad(_0x180844['error'][_0x4816('0x1a')]);}logger[_0x4816('0x17')](_0x4816('0x19'),_0x21f485,_0x180844['error'][_0x4816('0x1a')]);return _0x2bb35e(_0x180844['error']['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x21f485,_0x4816('0x15'));_0x2bb35e(_0x180844['result']['message']);}})[_0x4816('0x1b')](function(_0x37fe47){logger[_0x4816('0x17')](_0x4816('0x19'),_0x21f485,_0x37fe47);_0x2e21ad(_0x37fe47);});});}exports['GetWhatsappQueue']=function(_0x3c71de){var _0xd4bf5a=this;return new Promise(function(_0x1b0f23,_0x40c62f){return db[_0x4816('0x1c')][_0x4816('0x1d')]({'raw':_0x3c71de[_0x4816('0x1e')]?_0x3c71de[_0x4816('0x1e')][_0x4816('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c71de[_0x4816('0x1e')]?_0x3c71de['options'][_0x4816('0x20')]||null:null,'attributes':_0x3c71de[_0x4816('0x1e')]?_0x3c71de[_0x4816('0x1e')][_0x4816('0x21')]||null:null,'limit':_0x3c71de[_0x4816('0x1e')]?_0x3c71de['options'][_0x4816('0x22')]||null:null,'include':_0x3c71de[_0x4816('0x1e')]?_0x3c71de[_0x4816('0x1e')]['include']?_[_0x4816('0x23')](_0x3c71de[_0x4816('0x1e')]['include'],function(_0x726982){return{'model':db[_0x726982['model']],'as':_0x726982['as'],'attributes':_0x726982[_0x4816('0x21')],'include':_0x726982[_0x4816('0x24')]?_[_0x4816('0x23')](_0x726982[_0x4816('0x24')],function(_0x444d2b){return{'model':db[_0x444d2b['model']],'as':_0x444d2b['as'],'attributes':_0x444d2b['attributes'],'include':_0x444d2b['include']?_['map'](_0x444d2b[_0x4816('0x24')],function(_0x86a4d6){return{'model':db[_0x86a4d6[_0x4816('0x25')]],'as':_0x86a4d6['as'],'attributes':_0x86a4d6[_0x4816('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4816('0x12')](function(_0x93b6a0){logger[_0x4816('0x26')](_0x4816('0x27'),_0x3c71de);logger['debug']('GetWhatsappQueue',_0x3c71de,JSON[_0x4816('0x16')](_0x93b6a0));_0x1b0f23(_0x93b6a0);})[_0x4816('0x1b')](function(_0x59a5d2){logger[_0x4816('0x17')]('GetWhatsappQueue',_0x59a5d2[_0x4816('0x1a')],_0x3c71de);_0x40c62f(_0xd4bf5a[_0x4816('0x17')](0x1f4,_0x59a5d2[_0x4816('0x1a')]));});});};exports[_0x4816('0x28')]=function(_0x588fa9){var _0x4e34ec=this;return new Promise(function(_0x2befd1,_0x566dbe){return db['WhatsappQueue']['find']({'raw':_0x588fa9[_0x4816('0x1e')]?_0x588fa9[_0x4816('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x588fa9[_0x4816('0x1e')]?_0x588fa9[_0x4816('0x1e')][_0x4816('0x20')]||null:null,'attributes':_0x588fa9['options']?_0x588fa9['options'][_0x4816('0x21')]||null:null,'include':_0x588fa9[_0x4816('0x1e')]?_0x588fa9[_0x4816('0x1e')][_0x4816('0x24')]?_[_0x4816('0x23')](_0x588fa9[_0x4816('0x1e')][_0x4816('0x24')],function(_0x467204){return{'model':db[_0x467204['model']],'as':_0x467204['as'],'attributes':_0x467204[_0x4816('0x21')],'include':_0x467204[_0x4816('0x24')]?_[_0x4816('0x23')](_0x467204['include'],function(_0x4c8599){return{'model':db[_0x4c8599[_0x4816('0x25')]],'as':_0x4c8599['as'],'attributes':_0x4c8599[_0x4816('0x21')],'include':_0x4c8599[_0x4816('0x24')]?_[_0x4816('0x23')](_0x4c8599[_0x4816('0x24')],function(_0x5272cc){return{'model':db[_0x5272cc[_0x4816('0x25')]],'as':_0x5272cc['as'],'attributes':_0x5272cc[_0x4816('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4816('0x12')](function(_0x45dbf9){logger[_0x4816('0x26')](_0x4816('0x28'),_0x588fa9);logger[_0x4816('0x13')](_0x4816('0x28'),_0x588fa9,JSON[_0x4816('0x16')](_0x45dbf9));_0x2befd1(_0x45dbf9);})[_0x4816('0x1b')](function(_0x966f27){logger[_0x4816('0x17')](_0x4816('0x28'),_0x966f27[_0x4816('0x1a')],_0x588fa9);_0x566dbe(_0x4e34ec['error'](0x1f4,_0x966f27['message']));});});}; \ No newline at end of file +var _0x6d54=['catch','ShowWhatsappQueue','find','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','info','stringify'];(function(_0x442151,_0xcbbf6b){var _0x180cf8=function(_0xd52bbf){while(--_0xd52bbf){_0x442151['push'](_0x442151['shift']());}};_0x180cf8(++_0xcbbf6b);}(_0x6d54,0x181));var _0x46d5=function(_0x421443,_0x3eea1e){_0x421443=_0x421443-0x0;var _0x190320=_0x6d54[_0x421443];return _0x190320;};'use strict';var _=require(_0x46d5('0x0'));var util=require('util');var moment=require(_0x46d5('0x1'));var BPromise=require(_0x46d5('0x2'));var rs=require(_0x46d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x46d5('0x5'))(_0x46d5('0x6'));var config=require(_0x46d5('0x7'));var jayson=require(_0x46d5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x46d5('0x9')]=_[_0x46d5('0xa')](config[_0x46d5('0x9')],{'host':_0x46d5('0xb'),'port':0x18eb});var socket=require(_0x46d5('0xc'))(new Redis(config['redis']));require(_0x46d5('0xd'))[_0x46d5('0xe')](socket);function respondWithRpcPromise(_0x17a74d,_0x4eb886,_0x280c25){return new BPromise(function(_0xfc38be,_0x177327){return client[_0x46d5('0xf')](_0x17a74d,_0x280c25)['then'](function(_0x490c78){logger['info'](_0x46d5('0x10'),_0x4eb886,_0x46d5('0x11'));logger[_0x46d5('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4eb886,_0x46d5('0x11'),JSON['stringify'](_0x490c78));if(_0x490c78[_0x46d5('0x13')]){if(_0x490c78[_0x46d5('0x13')]['code']===0x1f4){logger[_0x46d5('0x13')](_0x46d5('0x10'),_0x4eb886,_0x490c78[_0x46d5('0x13')][_0x46d5('0x14')]);return _0x177327(_0x490c78['error'][_0x46d5('0x14')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x4eb886,_0x490c78[_0x46d5('0x13')][_0x46d5('0x14')]);return _0xfc38be(_0x490c78[_0x46d5('0x13')][_0x46d5('0x14')]);}else{logger['info'](_0x46d5('0x10'),_0x4eb886,'request\x20sent');_0xfc38be(_0x490c78['result'][_0x46d5('0x14')]);}})['catch'](function(_0x367f6c){logger[_0x46d5('0x13')](_0x46d5('0x10'),_0x4eb886,_0x367f6c);_0x177327(_0x367f6c);});});}exports[_0x46d5('0x15')]=function(_0x1493d5){var _0x2d3507=this;return new Promise(function(_0x3e4b93,_0x1e7e19){return db[_0x46d5('0x16')][_0x46d5('0x17')]({'raw':_0x1493d5[_0x46d5('0x18')]?_0x1493d5[_0x46d5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1493d5[_0x46d5('0x18')]?_0x1493d5['options'][_0x46d5('0x19')]||null:null,'attributes':_0x1493d5[_0x46d5('0x18')]?_0x1493d5[_0x46d5('0x18')]['attributes']||null:null,'limit':_0x1493d5[_0x46d5('0x18')]?_0x1493d5[_0x46d5('0x18')][_0x46d5('0x1a')]||null:null,'include':_0x1493d5[_0x46d5('0x18')]?_0x1493d5[_0x46d5('0x18')][_0x46d5('0x1b')]?_[_0x46d5('0x1c')](_0x1493d5[_0x46d5('0x18')][_0x46d5('0x1b')],function(_0x22bddf){return{'model':db[_0x22bddf[_0x46d5('0x1d')]],'as':_0x22bddf['as'],'attributes':_0x22bddf[_0x46d5('0x1e')],'include':_0x22bddf['include']?_[_0x46d5('0x1c')](_0x22bddf[_0x46d5('0x1b')],function(_0x514344){return{'model':db[_0x514344['model']],'as':_0x514344['as'],'attributes':_0x514344['attributes'],'include':_0x514344['include']?_[_0x46d5('0x1c')](_0x514344['include'],function(_0x214460){return{'model':db[_0x214460[_0x46d5('0x1d')]],'as':_0x214460['as'],'attributes':_0x214460[_0x46d5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcfa75e){logger[_0x46d5('0x1f')]('GetWhatsappQueue',_0x1493d5);logger[_0x46d5('0x12')](_0x46d5('0x15'),_0x1493d5,JSON[_0x46d5('0x20')](_0xcfa75e));_0x3e4b93(_0xcfa75e);})[_0x46d5('0x21')](function(_0x37fb80){logger['error'](_0x46d5('0x15'),_0x37fb80[_0x46d5('0x14')],_0x1493d5);_0x1e7e19(_0x2d3507[_0x46d5('0x13')](0x1f4,_0x37fb80[_0x46d5('0x14')]));});});};exports[_0x46d5('0x22')]=function(_0x30d395){var _0x3c557b=this;return new Promise(function(_0x14ac89,_0x12fd64){return db[_0x46d5('0x16')][_0x46d5('0x23')]({'raw':_0x30d395['options']?_0x30d395[_0x46d5('0x18')][_0x46d5('0x24')]===undefined?!![]:![]:!![],'where':_0x30d395[_0x46d5('0x18')]?_0x30d395[_0x46d5('0x18')][_0x46d5('0x19')]||null:null,'attributes':_0x30d395[_0x46d5('0x18')]?_0x30d395[_0x46d5('0x18')]['attributes']||null:null,'include':_0x30d395['options']?_0x30d395[_0x46d5('0x18')][_0x46d5('0x1b')]?_[_0x46d5('0x1c')](_0x30d395[_0x46d5('0x18')]['include'],function(_0x4b8278){return{'model':db[_0x4b8278[_0x46d5('0x1d')]],'as':_0x4b8278['as'],'attributes':_0x4b8278['attributes'],'include':_0x4b8278[_0x46d5('0x1b')]?_['map'](_0x4b8278['include'],function(_0x3d8bbd){return{'model':db[_0x3d8bbd[_0x46d5('0x1d')]],'as':_0x3d8bbd['as'],'attributes':_0x3d8bbd[_0x46d5('0x1e')],'include':_0x3d8bbd[_0x46d5('0x1b')]?_[_0x46d5('0x1c')](_0x3d8bbd[_0x46d5('0x1b')],function(_0x5d357b){return{'model':db[_0x5d357b[_0x46d5('0x1d')]],'as':_0x5d357b['as'],'attributes':_0x5d357b[_0x46d5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x46d5('0x25')](function(_0x4df730){logger['info'](_0x46d5('0x22'),_0x30d395);logger[_0x46d5('0x12')]('ShowWhatsappQueue',_0x30d395,JSON[_0x46d5('0x20')](_0x4df730));_0x14ac89(_0x4df730);})[_0x46d5('0x21')](function(_0x2e5a46){logger[_0x46d5('0x13')]('ShowWhatsappQueue',_0x2e5a46[_0x46d5('0x14')],_0x30d395);_0x12fd64(_0x3c557b[_0x46d5('0x13')](0x1f4,_0x2e5a46['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d6c8b79..a0c6f98 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 _0x124b=['save','update','emit','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x360f7c,_0x30176c){var _0x2e4f89=function(_0x23f7a4){while(--_0x23f7a4){_0x360f7c['push'](_0x360f7c['shift']());}};_0x2e4f89(++_0x30176c);}(_0x124b,0xef));var _0xb124=function(_0x2e86ba,_0x3a57af){_0x2e86ba=_0x2e86ba-0x0;var _0x52ebed=_0x124b[_0x2e86ba];return _0x52ebed;};'use strict';var WhatsappQueueEvents=require(_0xb124('0x0'));var events=[_0xb124('0x1'),'remove',_0xb124('0x2')];function createListener(_0x41bb76,_0x388264){return function(_0x409dfd){_0x388264[_0xb124('0x3')](_0x41bb76,_0x409dfd);};}function removeListener(_0x17f654,_0x353aa0){return function(){WhatsappQueueEvents['removeListener'](_0x17f654,_0x353aa0);};}exports['register']=function(_0x3623b8){for(var _0x4cee6b=0x0,_0x53f3b8=events[_0xb124('0x4')];_0x4cee6b<_0x53f3b8;_0x4cee6b++){var _0x2b5f7c=events[_0x4cee6b];var _0x57de75=createListener(_0xb124('0x5')+_0x2b5f7c,_0x3623b8);WhatsappQueueEvents['on'](_0x2b5f7c,_0x57de75);}}; \ No newline at end of file +var _0xa2f6=['remove','update','emit','register','length','whatsappQueue:','save'];(function(_0x4546a6,_0x22f442){var _0x580a27=function(_0xdfa086){while(--_0xdfa086){_0x4546a6['push'](_0x4546a6['shift']());}};_0x580a27(++_0x22f442);}(_0xa2f6,0x180));var _0x6a2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2f6[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6a2f('0x0'),_0x6a2f('0x1'),_0x6a2f('0x2')];function createListener(_0x167419,_0x4bfbeb){return function(_0x5359eb){_0x4bfbeb[_0x6a2f('0x3')](_0x167419,_0x5359eb);};}function removeListener(_0x316a61,_0x56b04c){return function(){WhatsappQueueEvents['removeListener'](_0x316a61,_0x56b04c);};}exports[_0x6a2f('0x4')]=function(_0x565232){for(var _0x33d9a0=0x0,_0x3ce5b7=events[_0x6a2f('0x5')];_0x33d9a0<_0x3ce5b7;_0x33d9a0++){var _0x3e3408=events[_0x33d9a0];var _0x2cd78f=createListener(_0x6a2f('0x6')+_0x3e3408,_0x565232);WhatsappQueueEvents['on'](_0x3e3408,_0x2cd78f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2cf1598..f5ea007 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 _0x7747=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x225d7e,_0x206329){var _0x3d1998=function(_0x2c5072){while(--_0x2c5072){_0x225d7e['push'](_0x225d7e['shift']());}};_0x3d1998(++_0x206329);}(_0x7747,0x1a4));var _0x7774=function(_0x56db28,_0x95952b){_0x56db28=_0x56db28-0x0;var _0x255efc=_0x7747[_0x56db28];return _0x255efc;};'use strict';var multer=require(_0x7774('0x0'));var util=require(_0x7774('0x1'));var path=require(_0x7774('0x2'));var timeout=require('connect-timeout');var express=require(_0x7774('0x3'));var router=express[_0x7774('0x4')]();var fs_extra=require(_0x7774('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7774('0x6'));var config=require(_0x7774('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x7774('0x8')](),controller[_0x7774('0x9')]);router[_0x7774('0xa')](_0x7774('0xb'),auth['isAuthenticated'](),controller[_0x7774('0xc')]);router[_0x7774('0xa')](_0x7774('0xd'),auth[_0x7774('0x8')](),controller[_0x7774('0xe')]);router[_0x7774('0xf')]('/',auth[_0x7774('0x8')](),controller[_0x7774('0x10')]);router[_0x7774('0x11')](_0x7774('0xd'),auth['isAuthenticated'](),controller[_0x7774('0x12')]);router[_0x7774('0x13')]('/:id',auth[_0x7774('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9c2f=['put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x9c2f,0x1e3));var _0xf9c2=function(_0x531adc,_0x11312f){_0x531adc=_0x531adc-0x0;var _0xcb04b6=_0x9c2f[_0x531adc];return _0xcb04b6;};'use strict';var multer=require(_0xf9c2('0x0'));var util=require(_0xf9c2('0x1'));var path=require(_0xf9c2('0x2'));var timeout=require(_0xf9c2('0x3'));var express=require(_0xf9c2('0x4'));var router=express[_0xf9c2('0x5')]();var fs_extra=require(_0xf9c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf9c2('0x7'));var config=require('../../config/environment');var controller=require(_0xf9c2('0x8'));router[_0xf9c2('0x9')]('/',auth[_0xf9c2('0xa')](),controller['index']);router[_0xf9c2('0x9')](_0xf9c2('0xb'),auth['isAuthenticated'](),controller[_0xf9c2('0xc')]);router[_0xf9c2('0x9')](_0xf9c2('0xd'),auth[_0xf9c2('0xa')](),controller[_0xf9c2('0xe')]);router[_0xf9c2('0xf')]('/',auth[_0xf9c2('0xa')](),controller[_0xf9c2('0x10')]);router[_0xf9c2('0x11')](_0xf9c2('0xd'),auth[_0xf9c2('0xa')](),controller[_0xf9c2('0x12')]);router['delete'](_0xf9c2('0xd'),auth[_0xf9c2('0xa')](),controller['destroy']);module[_0xf9c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ef15d32..36283e5 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(_0x59c480,_0x13cea7){var _0xb0246c=function(_0x45b5ef){while(--_0x45b5ef){_0x59c480['push'](_0x59c480['shift']());}};_0xb0246c(++_0x13cea7);}(_0x7a54,0x106));var _0x47a5=function(_0x4efe20,_0x1b7dda){_0x4efe20=_0x4efe20-0x0;var _0x2efee7=_0x7a54[_0x4efe20];return _0x2efee7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x28c02e,_0x32c97c){var _0x546c26=function(_0x44f33c){while(--_0x44f33c){_0x28c02e['push'](_0x28c02e['shift']());}};_0x546c26(++_0x32c97c);}(_0x7a54,0x106));var _0x47a5=function(_0x441bf8,_0x409aca){_0x441bf8=_0x441bf8-0x0;var _0xd704cb=_0x7a54[_0x441bf8];return _0xd704cb;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f27e3a3..704fe4e 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 _0x5eb8=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','catch','show','params','keys','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','WhatsappQueueReport'];(function(_0x59606e,_0x429521){var _0x19e449=function(_0x1a0483){while(--_0x1a0483){_0x59606e['push'](_0x59606e['shift']());}};_0x19e449(++_0x429521);}(_0x5eb8,0xb0));var _0x85eb=function(_0x188905,_0x398fac){_0x188905=_0x188905-0x0;var _0x2bf735=_0x5eb8[_0x188905];return _0x2bf735;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){_0x5b48d9[_0x85eb('0x1a')](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x5dfc96,_0x39d3fe){return function(_0x3453cd){if(!_0x3453cd){_0x5dfc96[_0x85eb('0x27')](0x194);}return _0x3453cd;};}function handleError(_0x30e766,_0x3e2326){_0x3e2326=_0x3e2326||0x1f4;return function(_0x57a03c){logger[_0x85eb('0x28')](_0x57a03c[_0x85eb('0x29')]);if(_0x57a03c[_0x85eb('0x2a')]){delete _0x57a03c[_0x85eb('0x2a')];}_0x30e766[_0x85eb('0x1a')](_0x3e2326)[_0x85eb('0x2b')](_0x57a03c);};}exports['index']=function(_0x562792,_0x37515c){var _0x585f2a={},_0xa9b14f={},_0x5255eb={'count':0x0,'rows':[]};var _0x4229e9=_[_0x85eb('0x2c')](db[_0x85eb('0x2d')][_0x85eb('0x2e')],function(_0xa67e1c){return{'name':_0xa67e1c[_0x85eb('0x2f')],'type':_0xa67e1c[_0x85eb('0x30')]['key']};});_0xa9b14f[_0x85eb('0x31')]=_[_0x85eb('0x2c')](_0x4229e9,'name');_0xa9b14f[_0x85eb('0x32')]=_['keys'](_0x562792['query']);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],_0xa9b14f[_0x85eb('0x32')]);_0x585f2a[_0x85eb('0x35')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x562792[_0x85eb('0x32')][_0x85eb('0x36')]));_0x585f2a['attributes']=_0x585f2a[_0x85eb('0x35')][_0x85eb('0x37')]?_0x585f2a['attributes']:_0xa9b14f['model'];if(!_0x562792[_0x85eb('0x32')][_0x85eb('0x38')](_0x85eb('0x39'))){_0x585f2a[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1e')]);_0x585f2a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1c')]);}_0x585f2a[_0x85eb('0x3a')]=qs[_0x85eb('0x3b')](_0x562792[_0x85eb('0x32')]['sort']);_0x585f2a[_0x85eb('0x3c')]=qs[_0x85eb('0x33')](_['pick'](_0x562792['query'],_0xa9b14f[_0x85eb('0x33')]),_0x4229e9);if(_0x562792[_0x85eb('0x32')]['filter']){_0x585f2a[_0x85eb('0x3c')]=_['merge'](_0x585f2a[_0x85eb('0x3c')],{'$or':_['map'](_0x4229e9,function(_0xaa27ca){if(_0xaa27ca['type']!==_0x85eb('0x3d')){var _0x5c618a={};_0x5c618a[_0xaa27ca[_0x85eb('0x2a')]]={'$like':'%'+_0x562792[_0x85eb('0x32')]['filter']+'%'};return _0x5c618a;}})});}_0x585f2a=_[_0x85eb('0x3e')]({},_0x585f2a,_0x562792['options']);var _0x2a6baa={'where':_0x585f2a[_0x85eb('0x3c')]};return db['WhatsappQueueReport'][_0x85eb('0x1f')](_0x2a6baa)['then'](function(_0x5495cf){_0x5255eb[_0x85eb('0x1f')]=_0x5495cf;if(_0x562792['query'][_0x85eb('0x3f')]){_0x585f2a[_0x85eb('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x585f2a);})[_0x85eb('0x26')](function(_0x422ec3){_0x5255eb['rows']=_0x422ec3;return _0x5255eb;})['then'](respondWithFilteredResult(_0x37515c,_0x585f2a))[_0x85eb('0x41')](handleError(_0x37515c,null));};exports[_0x85eb('0x42')]=function(_0x2211f9,_0x202681){var _0x3be961={'raw':!![],'where':{'id':_0x2211f9[_0x85eb('0x43')]['id']}},_0x5b7411={};_0x5b7411[_0x85eb('0x31')]=_[_0x85eb('0x44')](db[_0x85eb('0x2d')][_0x85eb('0x2e')]);_0x5b7411[_0x85eb('0x32')]=_[_0x85eb('0x44')](_0x2211f9[_0x85eb('0x32')]);_0x5b7411[_0x85eb('0x33')]=_['intersection'](_0x5b7411[_0x85eb('0x31')],_0x5b7411[_0x85eb('0x32')]);_0x3be961['attributes']=_[_0x85eb('0x34')](_0x5b7411[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x2211f9[_0x85eb('0x32')][_0x85eb('0x36')]));_0x3be961[_0x85eb('0x35')]=_0x3be961['attributes'][_0x85eb('0x37')]?_0x3be961[_0x85eb('0x35')]:_0x5b7411[_0x85eb('0x31')];if(_0x2211f9[_0x85eb('0x32')][_0x85eb('0x3f')]){_0x3be961[_0x85eb('0x40')]=[{'all':!![]}];}_0x3be961=_[_0x85eb('0x3e')]({},_0x3be961,_0x2211f9[_0x85eb('0x45')]);return db['WhatsappQueueReport'][_0x85eb('0x46')](_0x3be961)[_0x85eb('0x26')](handleEntityNotFound(_0x202681,null))[_0x85eb('0x26')](respondWithResult(_0x202681,null))[_0x85eb('0x41')](handleError(_0x202681,null));};exports[_0x85eb('0x47')]=function(_0x1a19c2,_0x3c387a){return db[_0x85eb('0x2d')][_0x85eb('0x47')](_0x1a19c2[_0x85eb('0x48')],{})[_0x85eb('0x26')](respondWithResult(_0x3c387a,0xc9))[_0x85eb('0x41')](handleError(_0x3c387a,null));};exports['update']=function(_0x11da79,_0x2c951b){if(_0x11da79[_0x85eb('0x48')]['id']){delete _0x11da79['body']['id'];}return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x11da79[_0x85eb('0x43')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2c951b,null))[_0x85eb('0x26')](saveUpdates(_0x11da79['body'],null))[_0x85eb('0x26')](respondWithResult(_0x2c951b,null))[_0x85eb('0x41')](handleError(_0x2c951b,null));};exports[_0x85eb('0x25')]=function(_0x50e264,_0xc5cb43){return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x50e264['params']['id']}})['then'](handleEntityNotFound(_0xc5cb43,null))[_0x85eb('0x26')](removeEntity(_0xc5cb43,null))['catch'](handleError(_0xc5cb43,null));};exports['describe']=function(_0x3f0b0c,_0x593723){return db[_0x85eb('0x2d')][_0x85eb('0x49')]()['then'](respondWithResult(_0x593723,null))['catch'](handleError(_0x593723,null));}; \ No newline at end of file +var _0xcf66=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','WhatsappQueueReport','catch','show','params','rawAttributes','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end'];(function(_0x4b928c,_0x2ea21a){var _0x40fb3d=function(_0x3cfd2f){while(--_0x3cfd2f){_0x4b928c['push'](_0x4b928c['shift']());}};_0x40fb3d(++_0x2ea21a);}(_0xcf66,0x71));var _0x6cf6=function(_0x1adb64,_0x5d757b){_0x1adb64=_0x1adb64-0x0;var _0x57ccfc=_0xcf66[_0x1adb64];return _0x57ccfc;};'use strict';var emlformat=require(_0x6cf6('0x0'));var rimraf=require(_0x6cf6('0x1'));var zipdir=require(_0x6cf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cf6('0x5'));var path=require(_0x6cf6('0x6'));var sox=require('sox');var csv=require(_0x6cf6('0x7'));var ejs=require(_0x6cf6('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf6('0x9'));var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x7'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdfea,_0x13b1ad){_0x13b1ad=_0x13b1ad||0xcc;return function(_0x372d12){if(_0x372d12){return _0x3fdfea[_0x6cf6('0x14')](_0x13b1ad);}return _0x3fdfea[_0x6cf6('0x15')](_0x13b1ad)[_0x6cf6('0x16')]();};}function respondWithResult(_0x57909f,_0x32fe64){_0x32fe64=_0x32fe64||0xc8;return function(_0x494ece){if(_0x494ece){return _0x57909f[_0x6cf6('0x15')](_0x32fe64)[_0x6cf6('0x17')](_0x494ece);}};}function respondWithFilteredResult(_0x4b073f,_0x40e413){return function(_0x1b40f8){if(_0x1b40f8){var _0x2d23ab=typeof _0x40e413[_0x6cf6('0x18')]===_0x6cf6('0x19')&&typeof _0x40e413[_0x6cf6('0x1a')]===_0x6cf6('0x19');var _0x39ec25=_0x1b40f8[_0x6cf6('0x1b')];var _0x2ca2b1=_0x2d23ab?0x0:_0x40e413['offset'];var _0x11d994=_0x2d23ab?_0x1b40f8[_0x6cf6('0x1b')]:_0x40e413[_0x6cf6('0x18')]+_0x40e413['limit'];var _0x18abd9;if(_0x11d994>=_0x39ec25){_0x11d994=_0x39ec25;_0x18abd9=0xc8;}else{_0x18abd9=0xce;}_0x4b073f[_0x6cf6('0x15')](_0x18abd9);return _0x4b073f[_0x6cf6('0x1c')](_0x6cf6('0x1d'),_0x2ca2b1+'-'+_0x11d994+'/'+_0x39ec25)[_0x6cf6('0x17')](_0x1b40f8);}return null;};}function patchUpdates(_0x21e903){return function(_0x123993){try{jsonpatch['apply'](_0x123993,_0x21e903,!![]);}catch(_0x19f2cd){return BPromise[_0x6cf6('0x1e')](_0x19f2cd);}return _0x123993[_0x6cf6('0x1f')]();};}function saveUpdates(_0x380a40,_0x5cba3a){return function(_0x470ea4){if(_0x470ea4){return _0x470ea4[_0x6cf6('0x20')](_0x380a40)[_0x6cf6('0x21')](function(_0x5b2767){return _0x5b2767;});}return null;};}function removeEntity(_0x5b30e0,_0x276225){return function(_0x59f838){if(_0x59f838){return _0x59f838[_0x6cf6('0x22')]()[_0x6cf6('0x21')](function(){_0x5b30e0[_0x6cf6('0x15')](0xcc)[_0x6cf6('0x16')]();});}};}function handleEntityNotFound(_0x3f9871,_0x565fad){return function(_0x1c966e){if(!_0x1c966e){_0x3f9871['sendStatus'](0x194);}return _0x1c966e;};}function handleError(_0x2779b7,_0xc7b489){_0xc7b489=_0xc7b489||0x1f4;return function(_0x3eaa31){logger['error'](_0x3eaa31[_0x6cf6('0x23')]);if(_0x3eaa31[_0x6cf6('0x24')]){delete _0x3eaa31[_0x6cf6('0x24')];}_0x2779b7[_0x6cf6('0x15')](_0xc7b489)['send'](_0x3eaa31);};}exports['index']=function(_0x2afe84,_0x4521af){var _0x57099f={},_0x5869e9={},_0x5ccc8f={'count':0x0,'rows':[]};var _0x2afc06=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x10bde5){return{'name':_0x10bde5[_0x6cf6('0x25')],'type':_0x10bde5[_0x6cf6('0x26')][_0x6cf6('0x27')]};});_0x5869e9[_0x6cf6('0x28')]=_['map'](_0x2afc06,_0x6cf6('0x24'));_0x5869e9[_0x6cf6('0x29')]=_[_0x6cf6('0x2a')](_0x2afe84['query']);_0x5869e9[_0x6cf6('0x2b')]=_[_0x6cf6('0x2c')](_0x5869e9[_0x6cf6('0x28')],_0x5869e9[_0x6cf6('0x29')]);_0x57099f[_0x6cf6('0x2d')]=_[_0x6cf6('0x2c')](_0x5869e9[_0x6cf6('0x28')],qs[_0x6cf6('0x2e')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x2e')]));_0x57099f[_0x6cf6('0x2d')]=_0x57099f[_0x6cf6('0x2d')][_0x6cf6('0x2f')]?_0x57099f[_0x6cf6('0x2d')]:_0x5869e9[_0x6cf6('0x28')];if(!_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x30')](_0x6cf6('0x31'))){_0x57099f['limit']=qs[_0x6cf6('0x1a')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x1a')]);_0x57099f[_0x6cf6('0x18')]=qs[_0x6cf6('0x18')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x18')]);}_0x57099f[_0x6cf6('0x32')]=qs[_0x6cf6('0x33')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x33')]);_0x57099f['where']=qs[_0x6cf6('0x2b')](_[_0x6cf6('0x34')](_0x2afe84[_0x6cf6('0x29')],_0x5869e9[_0x6cf6('0x2b')]),_0x2afc06);if(_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x35')]){_0x57099f[_0x6cf6('0x36')]=_[_0x6cf6('0x37')](_0x57099f[_0x6cf6('0x36')],{'$or':_['map'](_0x2afc06,function(_0x1c5eda){if(_0x1c5eda[_0x6cf6('0x26')]!==_0x6cf6('0x38')){var _0x3e906f={};_0x3e906f[_0x1c5eda[_0x6cf6('0x24')]]={'$like':'%'+_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x35')]+'%'};return _0x3e906f;}})});}_0x57099f=_[_0x6cf6('0x37')]({},_0x57099f,_0x2afe84[_0x6cf6('0x39')]);var _0x5ed61f={'where':_0x57099f[_0x6cf6('0x36')]};return db['WhatsappQueueReport'][_0x6cf6('0x1b')](_0x5ed61f)[_0x6cf6('0x21')](function(_0x23d280){_0x5ccc8f[_0x6cf6('0x1b')]=_0x23d280;if(_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x3a')]){_0x57099f[_0x6cf6('0x3b')]=[{'all':!![]}];}return db[_0x6cf6('0x3c')]['findAll'](_0x57099f);})[_0x6cf6('0x21')](function(_0x335dce){_0x5ccc8f['rows']=_0x335dce;return _0x5ccc8f;})[_0x6cf6('0x21')](respondWithFilteredResult(_0x4521af,_0x57099f))[_0x6cf6('0x3d')](handleError(_0x4521af,null));};exports[_0x6cf6('0x3e')]=function(_0x4874c0,_0x10bb9b){var _0x128f7a={'raw':!![],'where':{'id':_0x4874c0[_0x6cf6('0x3f')]['id']}},_0x51d915={};_0x51d915[_0x6cf6('0x28')]=_[_0x6cf6('0x2a')](db[_0x6cf6('0x3c')][_0x6cf6('0x40')]);_0x51d915[_0x6cf6('0x29')]=_[_0x6cf6('0x2a')](_0x4874c0['query']);_0x51d915[_0x6cf6('0x2b')]=_['intersection'](_0x51d915[_0x6cf6('0x28')],_0x51d915[_0x6cf6('0x29')]);_0x128f7a['attributes']=_[_0x6cf6('0x2c')](_0x51d915[_0x6cf6('0x28')],qs[_0x6cf6('0x2e')](_0x4874c0[_0x6cf6('0x29')][_0x6cf6('0x2e')]));_0x128f7a['attributes']=_0x128f7a[_0x6cf6('0x2d')][_0x6cf6('0x2f')]?_0x128f7a[_0x6cf6('0x2d')]:_0x51d915['model'];if(_0x4874c0[_0x6cf6('0x29')][_0x6cf6('0x3a')]){_0x128f7a[_0x6cf6('0x3b')]=[{'all':!![]}];}_0x128f7a=_['merge']({},_0x128f7a,_0x4874c0[_0x6cf6('0x39')]);return db['WhatsappQueueReport']['find'](_0x128f7a)[_0x6cf6('0x21')](handleEntityNotFound(_0x10bb9b,null))[_0x6cf6('0x21')](respondWithResult(_0x10bb9b,null))[_0x6cf6('0x3d')](handleError(_0x10bb9b,null));};exports[_0x6cf6('0x41')]=function(_0xb8788a,_0x311745){return db[_0x6cf6('0x3c')][_0x6cf6('0x41')](_0xb8788a[_0x6cf6('0x42')],{})[_0x6cf6('0x21')](respondWithResult(_0x311745,0xc9))[_0x6cf6('0x3d')](handleError(_0x311745,null));};exports[_0x6cf6('0x20')]=function(_0x3786d1,_0x4c8ada){if(_0x3786d1[_0x6cf6('0x42')]['id']){delete _0x3786d1[_0x6cf6('0x42')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x3786d1[_0x6cf6('0x3f')]['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x4c8ada,null))[_0x6cf6('0x21')](saveUpdates(_0x3786d1[_0x6cf6('0x42')],null))[_0x6cf6('0x21')](respondWithResult(_0x4c8ada,null))[_0x6cf6('0x3d')](handleError(_0x4c8ada,null));};exports['destroy']=function(_0x115b9b,_0x262c23){return db[_0x6cf6('0x3c')]['find']({'where':{'id':_0x115b9b['params']['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x262c23,null))[_0x6cf6('0x21')](removeEntity(_0x262c23,null))[_0x6cf6('0x3d')](handleError(_0x262c23,null));};exports[_0x6cf6('0x43')]=function(_0x2dbd71,_0x1fb6f1){return db[_0x6cf6('0x3c')][_0x6cf6('0x43')]()[_0x6cf6('0x21')](respondWithResult(_0x1fb6f1,null))[_0x6cf6('0x3d')](handleError(_0x1fb6f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4e28e67..1fc13b6 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 _0x760b=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x45b916,_0x57ac98){var _0x572505=function(_0x4a6e95){while(--_0x4a6e95){_0x45b916['push'](_0x45b916['shift']());}};_0x572505(++_0x57ac98);}(_0x760b,0x1bf));var _0xb760=function(_0x196613,_0x45475f){_0x196613=_0x196613-0x0;var _0x25a090=_0x760b[_0x196613];return _0x25a090;};'use strict';var _=require(_0xb760('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb760('0x1'));var moment=require(_0xb760('0x2'));var BPromise=require(_0xb760('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb760('0x4'));var rimraf=require(_0xb760('0x5'));var config=require(_0xb760('0x6'));var attributes=require(_0xb760('0x7'));module[_0xb760('0x8')]=function(_0x1268d2,_0x584746){return _0x1268d2[_0xb760('0x9')](_0xb760('0xa'),attributes,{'tableName':_0xb760('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb760('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac02=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_whatsapp_queue','uniqueid','util'];(function(_0x4dd37a,_0x2ed78b){var _0xea5f7c=function(_0x1dc352){while(--_0x1dc352){_0x4dd37a['push'](_0x4dd37a['shift']());}};_0xea5f7c(++_0x2ed78b);}(_0xac02,0xfb));var _0x2ac0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xac02[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x2ac0('0x0'));var logger=require(_0x2ac0('0x1'))(_0x2ac0('0x2'));var moment=require(_0x2ac0('0x3'));var BPromise=require(_0x2ac0('0x4'));var rp=require(_0x2ac0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ac0('0x6'));var config=require(_0x2ac0('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x2ac0('0x8')]=function(_0x5505a2,_0x3a9b6d){return _0x5505a2[_0x2ac0('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x2ac0('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2ac0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9f0129b..29c3504 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 _0x611e=['util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','limit','UpdateWhatsappQueueReport'];(function(_0xab5846,_0x523119){var _0x288809=function(_0x2a1de8){while(--_0x2a1de8){_0xab5846['push'](_0xab5846['shift']());}};_0x288809(++_0x523119);}(_0x611e,0x10e));var _0xe611=function(_0x47a42f,_0x3a1bbc){_0x47a42f=_0x47a42f-0x0;var _0x514eef=_0x611e[_0x47a42f];return _0x514eef;};'use strict';var _=require('lodash');var util=require(_0xe611('0x0'));var moment=require(_0xe611('0x1'));var BPromise=require('bluebird');var rs=require(_0xe611('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe611('0x3'))(_0xe611('0x4'));var config=require(_0xe611('0x5'));var jayson=require(_0xe611('0x6'));var client=jayson[_0xe611('0x7')][_0xe611('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x479061,_0x573614,_0x1fee60){return new BPromise(function(_0x391979,_0x115f5a){return client[_0xe611('0x9')](_0x479061,_0x1fee60)[_0xe611('0xa')](function(_0x5757ef){logger[_0xe611('0xb')](_0xe611('0xc'),_0x573614,_0xe611('0xd'));logger[_0xe611('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x573614,_0xe611('0xd'),JSON[_0xe611('0xf')](_0x5757ef));if(_0x5757ef[_0xe611('0x10')]){if(_0x5757ef[_0xe611('0x10')]['code']===0x1f4){logger[_0xe611('0x10')](_0xe611('0xc'),_0x573614,_0x5757ef[_0xe611('0x10')][_0xe611('0x11')]);return _0x115f5a(_0x5757ef['error'][_0xe611('0x11')]);}logger[_0xe611('0x10')](_0xe611('0xc'),_0x573614,_0x5757ef[_0xe611('0x10')]['message']);return _0x391979(_0x5757ef[_0xe611('0x10')][_0xe611('0x11')]);}else{logger[_0xe611('0xb')](_0xe611('0xc'),_0x573614,_0xe611('0xd'));_0x391979(_0x5757ef[_0xe611('0x12')][_0xe611('0x11')]);}})[_0xe611('0x13')](function(_0x2e8761){logger[_0xe611('0x10')](_0xe611('0xc'),_0x573614,_0x2e8761);_0x115f5a(_0x2e8761);});});}exports[_0xe611('0x14')]=function(_0x10731a){var _0x16153c=this;return new Promise(function(_0x3e043c,_0x19da38){return db[_0xe611('0x15')][_0xe611('0x16')](_0x10731a[_0xe611('0x17')],{'raw':_0x10731a[_0xe611('0x18')]?_0x10731a[_0xe611('0x18')][_0xe611('0x19')]===undefined?!![]:![]:!![]})[_0xe611('0xa')](function(_0xff6796){logger[_0xe611('0xb')](_0xe611('0x14'),_0x10731a);logger['debug'](_0xe611('0x14'),_0x10731a,JSON[_0xe611('0xf')](_0xff6796));_0x3e043c(_0xff6796);})[_0xe611('0x13')](function(_0x4da9b5){logger[_0xe611('0x10')](_0xe611('0x14'),_0x4da9b5[_0xe611('0x11')],_0x10731a);_0x19da38(_0x16153c[_0xe611('0x10')](0x1f4,_0x4da9b5[_0xe611('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1c9e42){var _0x59ecd7=this;return new Promise(function(_0x2c9853,_0x17e8ed){return db['WhatsappQueueReport'][_0xe611('0x1a')](_0x1c9e42['body'],{'raw':_0x1c9e42[_0xe611('0x18')]?_0x1c9e42[_0xe611('0x18')][_0xe611('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9e42[_0xe611('0x18')]?_0x1c9e42[_0xe611('0x18')][_0xe611('0x1b')]||null:null,'attributes':_0x1c9e42[_0xe611('0x18')]?_0x1c9e42[_0xe611('0x18')]['attributes']||null:null,'limit':_0x1c9e42[_0xe611('0x18')]?_0x1c9e42[_0xe611('0x18')][_0xe611('0x1c')]||null:null})[_0xe611('0xa')](function(_0x115595){logger[_0xe611('0xb')](_0xe611('0x1d'),_0x1c9e42);logger[_0xe611('0xe')]('UpdateWhatsappQueueReport',_0x1c9e42,JSON[_0xe611('0xf')](_0x115595));_0x2c9853(_0x115595);})[_0xe611('0x13')](function(_0x76f843){logger[_0xe611('0x10')](_0xe611('0x1d'),_0x76f843['message'],_0x1c9e42);_0x17e8ed(_0x59ecd7[_0xe611('0x10')](0x1f4,_0x76f843[_0xe611('0x11')]));});});}; \ No newline at end of file +var _0x70b9=['../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','create','options','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','update','body','attributes','lodash','util','moment'];(function(_0x93e23c,_0x48b15b){var _0x2d976b=function(_0x1a6cbd){while(--_0x1a6cbd){_0x93e23c['push'](_0x93e23c['shift']());}};_0x2d976b(++_0x48b15b);}(_0x70b9,0x11b));var _0x970b=function(_0x12243e,_0x5e3c91){_0x12243e=_0x12243e-0x0;var _0x440580=_0x70b9[_0x12243e];return _0x440580;};'use strict';var _=require(_0x970b('0x0'));var util=require(_0x970b('0x1'));var moment=require(_0x970b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x970b('0x3'))(_0x970b('0x4'));var config=require('../../config/environment');var jayson=require(_0x970b('0x5'));var client=jayson['client'][_0x970b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1504c7,_0x159982,_0x296446){return new BPromise(function(_0x4af41,_0x53f480){return client[_0x970b('0x7')](_0x1504c7,_0x296446)[_0x970b('0x8')](function(_0x3b8f60){logger[_0x970b('0x9')]('WhatsappQueueReport,\x20%s,\x20%s',_0x159982,_0x970b('0xa'));logger[_0x970b('0xb')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x159982,_0x970b('0xa'),JSON[_0x970b('0xc')](_0x3b8f60));if(_0x3b8f60[_0x970b('0xd')]){if(_0x3b8f60[_0x970b('0xd')]['code']===0x1f4){logger[_0x970b('0xd')](_0x970b('0xe'),_0x159982,_0x3b8f60['error']['message']);return _0x53f480(_0x3b8f60['error'][_0x970b('0xf')]);}logger[_0x970b('0xd')](_0x970b('0xe'),_0x159982,_0x3b8f60['error'][_0x970b('0xf')]);return _0x4af41(_0x3b8f60['error'][_0x970b('0xf')]);}else{logger['info'](_0x970b('0xe'),_0x159982,_0x970b('0xa'));_0x4af41(_0x3b8f60[_0x970b('0x10')][_0x970b('0xf')]);}})['catch'](function(_0x21b2b7){logger[_0x970b('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x159982,_0x21b2b7);_0x53f480(_0x21b2b7);});});}exports[_0x970b('0x11')]=function(_0x536e10){var _0x36922=this;return new Promise(function(_0x54a947,_0x3f0873){return db['WhatsappQueueReport'][_0x970b('0x12')](_0x536e10['body'],{'raw':_0x536e10['options']?_0x536e10[_0x970b('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x970b('0x8')](function(_0x6c277e){logger[_0x970b('0x9')](_0x970b('0x11'),_0x536e10);logger[_0x970b('0xb')](_0x970b('0x11'),_0x536e10,JSON[_0x970b('0xc')](_0x6c277e));_0x54a947(_0x6c277e);})[_0x970b('0x14')](function(_0xadd4ac){logger[_0x970b('0xd')](_0x970b('0x11'),_0xadd4ac[_0x970b('0xf')],_0x536e10);_0x3f0873(_0x36922['error'](0x1f4,_0xadd4ac[_0x970b('0xf')]));});});};exports[_0x970b('0x15')]=function(_0x397743){var _0x5bb60d=this;return new Promise(function(_0x40cf10,_0x2776c5){return db[_0x970b('0x16')][_0x970b('0x17')](_0x397743[_0x970b('0x18')],{'raw':_0x397743[_0x970b('0x13')]?_0x397743[_0x970b('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x397743[_0x970b('0x13')]?_0x397743['options']['where']||null:null,'attributes':_0x397743[_0x970b('0x13')]?_0x397743[_0x970b('0x13')][_0x970b('0x19')]||null:null,'limit':_0x397743[_0x970b('0x13')]?_0x397743['options']['limit']||null:null})[_0x970b('0x8')](function(_0x385a5f){logger[_0x970b('0x9')](_0x970b('0x15'),_0x397743);logger[_0x970b('0xb')]('UpdateWhatsappQueueReport',_0x397743,JSON[_0x970b('0xc')](_0x385a5f));_0x40cf10(_0x385a5f);})[_0x970b('0x14')](function(_0x4055f4){logger[_0x970b('0xd')](_0x970b('0x15'),_0x4055f4[_0x970b('0xf')],_0x397743);_0x2776c5(_0x5bb60d[_0x970b('0xd')](0x1f4,_0x4055f4[_0x970b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1ba8089..61745a1 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 _0x619e=['post','create','put','update','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xb301ed,_0x280e7f){var _0x3558be=function(_0x5f18d1){while(--_0x5f18d1){_0xb301ed['push'](_0xb301ed['shift']());}};_0x3558be(++_0x280e7f);}(_0x619e,0x15b));var _0xe619=function(_0xfe2c60,_0x1866fd){_0xfe2c60=_0xfe2c60-0x0;var _0x1da88e=_0x619e[_0xfe2c60];return _0x1da88e;};'use strict';var multer=require(_0xe619('0x0'));var util=require(_0xe619('0x1'));var path=require(_0xe619('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe619('0x3'));var auth=require(_0xe619('0x4'));var interaction=require(_0xe619('0x5'));var config=require('../../config/environment');var controller=require(_0xe619('0x6'));router[_0xe619('0x7')]('/',auth[_0xe619('0x8')](),controller[_0xe619('0x9')]);router['get'](_0xe619('0xa'),auth[_0xe619('0x8')](),controller[_0xe619('0xb')]);router[_0xe619('0x7')](_0xe619('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe619('0xd')]('/',auth[_0xe619('0x8')](),controller[_0xe619('0xe')]);router[_0xe619('0xf')]('/:id',auth[_0xe619('0x8')](),controller[_0xe619('0x10')]);router['delete']('/:id',auth[_0xe619('0x8')](),controller['destroy']);module[_0xe619('0x11')]=router; \ No newline at end of file +var _0x509e=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc8ea40,_0x3dd328){var _0x3356a2=function(_0x3ddb53){while(--_0x3ddb53){_0xc8ea40['push'](_0xc8ea40['shift']());}};_0x3356a2(++_0x3dd328);}(_0x509e,0xdd));var _0xe509=function(_0x15bd9e,_0x1107f8){_0x15bd9e=_0x15bd9e-0x0;var _0x19da26=_0x509e[_0x15bd9e];return _0x19da26;};'use strict';var multer=require('multer');var util=require(_0xe509('0x0'));var path=require(_0xe509('0x1'));var timeout=require(_0xe509('0x2'));var express=require(_0xe509('0x3'));var router=express[_0xe509('0x4')]();var fs_extra=require(_0xe509('0x5'));var auth=require(_0xe509('0x6'));var interaction=require(_0xe509('0x7'));var config=require(_0xe509('0x8'));var controller=require(_0xe509('0x9'));router[_0xe509('0xa')]('/',auth[_0xe509('0xb')](),controller[_0xe509('0xc')]);router[_0xe509('0xa')](_0xe509('0xd'),auth['isAuthenticated'](),controller[_0xe509('0xe')]);router[_0xe509('0xa')]('/:id',auth[_0xe509('0xb')](),controller[_0xe509('0xf')]);router[_0xe509('0x10')]('/',auth[_0xe509('0xb')](),controller[_0xe509('0x11')]);router[_0xe509('0x12')](_0xe509('0x13'),auth[_0xe509('0xb')](),controller[_0xe509('0x14')]);router['delete'](_0xe509('0x13'),auth[_0xe509('0xb')](),controller[_0xe509('0x15')]);module[_0xe509('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 4d45c94..89dd0ba 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 _0xc15c=['account','queue','STRING','ENUM'];(function(_0x21fbab,_0x1bda8d){var _0x29fef1=function(_0x1ff144){while(--_0x1ff144){_0x21fbab['push'](_0x21fbab['shift']());}};_0x29fef1(++_0x1bda8d);}(_0xc15c,0xae));var _0xcc15=function(_0x167233,_0x2d3947){_0x167233=_0x167233-0x0;var _0x3fc748=_0xc15c[_0x167233];return _0x3fc748;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcc15('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xcc15('0x1')](_0xcc15('0x2'),'agent',_0xcc15('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xd878=['sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0xd2cbcd,_0x22c548){var _0x44d426=function(_0x2e1443){while(--_0x2e1443){_0xd2cbcd['push'](_0xd2cbcd['shift']());}};_0x44d426(++_0x22c548);}(_0xd878,0x118));var _0x8d87=function(_0x23942c,_0x4811b3){_0x23942c=_0x23942c-0x0;var _0x23f7fe=_0xd878[_0x23942c];return _0x23f7fe;};'use strict';var Sequelize=require(_0x8d87('0x0'));module[_0x8d87('0x1')]={'uniqueid':{'type':Sequelize[_0x8d87('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8d87('0x3')](_0x8d87('0x4'),_0x8d87('0x5'),_0x8d87('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index cfc3498..70705f0 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 _0x4511=['findAll','rows','catch','params','includeAll','create','body','destroy','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','Content-Range','reject','update','then','end','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','sort','where','pick','merge','VIRTUAL','filter','options','include'];(function(_0x28da41,_0x4eeb51){var _0x95362b=function(_0x22446e){while(--_0x22446e){_0x28da41['push'](_0x28da41['shift']());}};_0x95362b(++_0x4eeb51);}(_0x4511,0x18b));var _0x1451=function(_0x5eb737,_0x4e3819){_0x5eb737=_0x5eb737-0x0;var _0x213cb8=_0x4511[_0x5eb737];return _0x213cb8;};'use strict';var emlformat=require(_0x1451('0x0'));var rimraf=require(_0x1451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1451('0x2'));var rp=require(_0x1451('0x3'));var moment=require(_0x1451('0x4'));var BPromise=require(_0x1451('0x5'));var Mustache=require(_0x1451('0x6'));var util=require('util');var path=require(_0x1451('0x7'));var sox=require(_0x1451('0x8'));var csv=require(_0x1451('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1451('0xa'));var _=require(_0x1451('0xb'));var squel=require(_0x1451('0xc'));var crypto=require(_0x1451('0xd'));var jsforce=require(_0x1451('0xe'));var deskjs=require(_0x1451('0xf'));var toCsv=require(_0x1451('0x9'));var querystring=require(_0x1451('0x10'));var Papa=require(_0x1451('0x11'));var Redis=require(_0x1451('0x12'));var authService=require(_0x1451('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1451('0x14'));var hardwareService=require(_0x1451('0x15'));var logger=require(_0x1451('0x16'))(_0x1451('0x17'));var utils=require(_0x1451('0x18'));var config=require(_0x1451('0x19'));var licenseUtil=require(_0x1451('0x1a'));var db=require(_0x1451('0x1b'))['db'];function respondWithStatusCode(_0x5a4624,_0x4c10a3){_0x4c10a3=_0x4c10a3||0xcc;return function(_0x40d204){if(_0x40d204){return _0x5a4624[_0x1451('0x1c')](_0x4c10a3);}return _0x5a4624[_0x1451('0x1d')](_0x4c10a3)['end']();};}function respondWithResult(_0x492e24,_0x46813b){_0x46813b=_0x46813b||0xc8;return function(_0x517e84){if(_0x517e84){return _0x492e24[_0x1451('0x1d')](_0x46813b)[_0x1451('0x1e')](_0x517e84);}};}function respondWithFilteredResult(_0x227f0e,_0x88b26e){return function(_0x28981a){if(_0x28981a){var _0x50b017=typeof _0x88b26e['offset']==='undefined'&&typeof _0x88b26e[_0x1451('0x1f')]===_0x1451('0x20');var _0x3a7a36=_0x28981a['count'];var _0x20f5ad=_0x50b017?0x0:_0x88b26e['offset'];var _0x41640b=_0x50b017?_0x28981a[_0x1451('0x21')]:_0x88b26e['offset']+_0x88b26e[_0x1451('0x1f')];var _0x3ec08e;if(_0x41640b>=_0x3a7a36){_0x41640b=_0x3a7a36;_0x3ec08e=0xc8;}else{_0x3ec08e=0xce;}_0x227f0e[_0x1451('0x1d')](_0x3ec08e);return _0x227f0e['set'](_0x1451('0x22'),_0x20f5ad+'-'+_0x41640b+'/'+_0x3a7a36)[_0x1451('0x1e')](_0x28981a);}return null;};}function patchUpdates(_0x5d0183){return function(_0x1d6adb){try{jsonpatch['apply'](_0x1d6adb,_0x5d0183,!![]);}catch(_0x556377){return BPromise[_0x1451('0x23')](_0x556377);}return _0x1d6adb['save']();};}function saveUpdates(_0x2ce497,_0x259df6){return function(_0xf5fbe){if(_0xf5fbe){return _0xf5fbe[_0x1451('0x24')](_0x2ce497)['then'](function(_0x1f9720){return _0x1f9720;});}return null;};}function removeEntity(_0xafaeec,_0x420097){return function(_0x92dcbe){if(_0x92dcbe){return _0x92dcbe['destroy']()[_0x1451('0x25')](function(){_0xafaeec[_0x1451('0x1d')](0xcc)[_0x1451('0x26')]();});}};}function handleEntityNotFound(_0x2ef746,_0x593d33){return function(_0x58415b){if(!_0x58415b){_0x2ef746[_0x1451('0x1c')](0x194);}return _0x58415b;};}function handleError(_0x1f302c,_0x71490c){_0x71490c=_0x71490c||0x1f4;return function(_0x21a076){logger[_0x1451('0x27')](_0x21a076[_0x1451('0x28')]);if(_0x21a076[_0x1451('0x29')]){delete _0x21a076[_0x1451('0x29')];}_0x1f302c[_0x1451('0x1d')](_0x71490c)['send'](_0x21a076);};}exports[_0x1451('0x2a')]=function(_0x31c954,_0x29420d){var _0x1a0ecc={},_0x10d7f9={},_0x319362={'count':0x0,'rows':[]};var _0x2aeca4=_[_0x1451('0x2b')](db[_0x1451('0x2c')][_0x1451('0x2d')],function(_0x5a78ee){return{'name':_0x5a78ee[_0x1451('0x2e')],'type':_0x5a78ee[_0x1451('0x2f')][_0x1451('0x30')]};});_0x10d7f9[_0x1451('0x31')]=_['map'](_0x2aeca4,'name');_0x10d7f9[_0x1451('0x32')]=_[_0x1451('0x33')](_0x31c954[_0x1451('0x32')]);_0x10d7f9[_0x1451('0x34')]=_[_0x1451('0x35')](_0x10d7f9[_0x1451('0x31')],_0x10d7f9[_0x1451('0x32')]);_0x1a0ecc['attributes']=_[_0x1451('0x35')](_0x10d7f9[_0x1451('0x31')],qs[_0x1451('0x36')](_0x31c954['query'][_0x1451('0x36')]));_0x1a0ecc[_0x1451('0x37')]=_0x1a0ecc[_0x1451('0x37')][_0x1451('0x38')]?_0x1a0ecc[_0x1451('0x37')]:_0x10d7f9[_0x1451('0x31')];if(!_0x31c954['query'][_0x1451('0x39')]('nolimit')){_0x1a0ecc['limit']=qs[_0x1451('0x1f')](_0x31c954[_0x1451('0x32')][_0x1451('0x1f')]);_0x1a0ecc[_0x1451('0x3a')]=qs[_0x1451('0x3a')](_0x31c954[_0x1451('0x32')]['offset']);}_0x1a0ecc['order']=qs[_0x1451('0x3b')](_0x31c954['query'][_0x1451('0x3b')]);_0x1a0ecc[_0x1451('0x3c')]=qs[_0x1451('0x34')](_[_0x1451('0x3d')](_0x31c954['query'],_0x10d7f9[_0x1451('0x34')]),_0x2aeca4);if(_0x31c954['query']['filter']){_0x1a0ecc[_0x1451('0x3c')]=_[_0x1451('0x3e')](_0x1a0ecc[_0x1451('0x3c')],{'$or':_['map'](_0x2aeca4,function(_0xeacff8){if(_0xeacff8[_0x1451('0x2f')]!==_0x1451('0x3f')){var _0x58b548={};_0x58b548[_0xeacff8[_0x1451('0x29')]]={'$like':'%'+_0x31c954[_0x1451('0x32')][_0x1451('0x40')]+'%'};return _0x58b548;}})});}_0x1a0ecc=_[_0x1451('0x3e')]({},_0x1a0ecc,_0x31c954[_0x1451('0x41')]);var _0x3e8765={'where':_0x1a0ecc[_0x1451('0x3c')]};return db[_0x1451('0x2c')][_0x1451('0x21')](_0x3e8765)[_0x1451('0x25')](function(_0x3be075){_0x319362['count']=_0x3be075;if(_0x31c954[_0x1451('0x32')]['includeAll']){_0x1a0ecc[_0x1451('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x1451('0x43')](_0x1a0ecc);})['then'](function(_0xf89b5a){_0x319362[_0x1451('0x44')]=_0xf89b5a;return _0x319362;})[_0x1451('0x25')](respondWithFilteredResult(_0x29420d,_0x1a0ecc))[_0x1451('0x45')](handleError(_0x29420d,null));};exports['show']=function(_0x25c0ea,_0x102d87){var _0x1f52a6={'raw':!![],'where':{'id':_0x25c0ea[_0x1451('0x46')]['id']}},_0x1bd8a8={};_0x1bd8a8[_0x1451('0x31')]=_[_0x1451('0x33')](db[_0x1451('0x2c')][_0x1451('0x2d')]);_0x1bd8a8['query']=_[_0x1451('0x33')](_0x25c0ea[_0x1451('0x32')]);_0x1bd8a8[_0x1451('0x34')]=_['intersection'](_0x1bd8a8[_0x1451('0x31')],_0x1bd8a8['query']);_0x1f52a6[_0x1451('0x37')]=_[_0x1451('0x35')](_0x1bd8a8[_0x1451('0x31')],qs[_0x1451('0x36')](_0x25c0ea[_0x1451('0x32')][_0x1451('0x36')]));_0x1f52a6['attributes']=_0x1f52a6[_0x1451('0x37')][_0x1451('0x38')]?_0x1f52a6['attributes']:_0x1bd8a8['model'];if(_0x25c0ea[_0x1451('0x32')][_0x1451('0x47')]){_0x1f52a6[_0x1451('0x42')]=[{'all':!![]}];}_0x1f52a6=_[_0x1451('0x3e')]({},_0x1f52a6,_0x25c0ea[_0x1451('0x41')]);return db[_0x1451('0x2c')]['find'](_0x1f52a6)['then'](handleEntityNotFound(_0x102d87,null))['then'](respondWithResult(_0x102d87,null))[_0x1451('0x45')](handleError(_0x102d87,null));};exports[_0x1451('0x48')]=function(_0x59eb1d,_0x4faf56){return db[_0x1451('0x2c')][_0x1451('0x48')](_0x59eb1d[_0x1451('0x49')],{})[_0x1451('0x25')](respondWithResult(_0x4faf56,0xc9))[_0x1451('0x45')](handleError(_0x4faf56,null));};exports[_0x1451('0x24')]=function(_0x4e406c,_0x383d13){if(_0x4e406c['body']['id']){delete _0x4e406c[_0x1451('0x49')]['id'];}return db[_0x1451('0x2c')]['find']({'where':{'id':_0x4e406c[_0x1451('0x46')]['id']}})[_0x1451('0x25')](handleEntityNotFound(_0x383d13,null))[_0x1451('0x25')](saveUpdates(_0x4e406c['body'],null))['then'](respondWithResult(_0x383d13,null))[_0x1451('0x45')](handleError(_0x383d13,null));};exports[_0x1451('0x4a')]=function(_0x3537c9,_0x76be7){return db['WhatsappTransferReport'][_0x1451('0x4b')]({'where':{'id':_0x3537c9['params']['id']}})[_0x1451('0x25')](handleEntityNotFound(_0x76be7,null))['then'](removeEntity(_0x76be7,null))[_0x1451('0x45')](handleError(_0x76be7,null));};exports[_0x1451('0x4c')]=function(_0x1d811f,_0x5ab237){return db['WhatsappTransferReport'][_0x1451('0x4c')]()[_0x1451('0x25')](respondWithResult(_0x5ab237,null))[_0x1451('0x45')](handleError(_0x5ab237,null));}; \ No newline at end of file +var _0x172c=['include','WhatsappTransferReport','findAll','show','params','fields','length','includeAll','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','apply','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','limit','sort','where','filter','VIRTUAL','merge','options'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x172c,0x95));var _0xc172=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x172c[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xc172('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc172('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc172('0x2'));var moment=require(_0xc172('0x3'));var BPromise=require(_0xc172('0x4'));var Mustache=require(_0xc172('0x5'));var util=require(_0xc172('0x6'));var path=require(_0xc172('0x7'));var sox=require(_0xc172('0x8'));var csv=require(_0xc172('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc172('0xa'));var squel=require('squel');var crypto=require(_0xc172('0xb'));var jsforce=require(_0xc172('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc172('0xd'));var authService=require(_0xc172('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc172('0xf'));var hardwareService=require(_0xc172('0x10'));var logger=require(_0xc172('0x11'))(_0xc172('0x12'));var utils=require(_0xc172('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc172('0x14'))['db'];function respondWithStatusCode(_0x3583a2,_0x59b86a){_0x59b86a=_0x59b86a||0xcc;return function(_0x4f84e0){if(_0x4f84e0){return _0x3583a2['sendStatus'](_0x59b86a);}return _0x3583a2[_0xc172('0x15')](_0x59b86a)[_0xc172('0x16')]();};}function respondWithResult(_0x5297e0,_0x3eaf25){_0x3eaf25=_0x3eaf25||0xc8;return function(_0x3817b6){if(_0x3817b6){return _0x5297e0[_0xc172('0x15')](_0x3eaf25)[_0xc172('0x17')](_0x3817b6);}};}function respondWithFilteredResult(_0x4bb51a,_0x4c0d0f){return function(_0x528246){if(_0x528246){var _0x270503=typeof _0x4c0d0f[_0xc172('0x18')]==='undefined'&&typeof _0x4c0d0f['limit']===_0xc172('0x19');var _0x3b22ff=_0x528246[_0xc172('0x1a')];var _0xc01a3d=_0x270503?0x0:_0x4c0d0f[_0xc172('0x18')];var _0xf4fcf2=_0x270503?_0x528246[_0xc172('0x1a')]:_0x4c0d0f[_0xc172('0x18')]+_0x4c0d0f['limit'];var _0x4eb38f;if(_0xf4fcf2>=_0x3b22ff){_0xf4fcf2=_0x3b22ff;_0x4eb38f=0xc8;}else{_0x4eb38f=0xce;}_0x4bb51a['status'](_0x4eb38f);return _0x4bb51a['set']('Content-Range',_0xc01a3d+'-'+_0xf4fcf2+'/'+_0x3b22ff)[_0xc172('0x17')](_0x528246);}return null;};}function patchUpdates(_0x1c01da){return function(_0x47a0cd){try{jsonpatch[_0xc172('0x1b')](_0x47a0cd,_0x1c01da,!![]);}catch(_0x507198){return BPromise['reject'](_0x507198);}return _0x47a0cd[_0xc172('0x1c')]();};}function saveUpdates(_0x36ce13,_0x457491){return function(_0x4ec487){if(_0x4ec487){return _0x4ec487[_0xc172('0x1d')](_0x36ce13)[_0xc172('0x1e')](function(_0x3c8bd1){return _0x3c8bd1;});}return null;};}function removeEntity(_0x3a37d1,_0xdf6004){return function(_0x1124b4){if(_0x1124b4){return _0x1124b4[_0xc172('0x1f')]()[_0xc172('0x1e')](function(){_0x3a37d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162cab,_0x3b9387){return function(_0xeff832){if(!_0xeff832){_0x162cab[_0xc172('0x20')](0x194);}return _0xeff832;};}function handleError(_0x1591b9,_0x3b6b5f){_0x3b6b5f=_0x3b6b5f||0x1f4;return function(_0x1a5ca7){logger['error'](_0x1a5ca7['stack']);if(_0x1a5ca7[_0xc172('0x21')]){delete _0x1a5ca7[_0xc172('0x21')];}_0x1591b9[_0xc172('0x15')](_0x3b6b5f)[_0xc172('0x22')](_0x1a5ca7);};}exports[_0xc172('0x23')]=function(_0x3de59b,_0x39f012){var _0x507c74={},_0xdac399={},_0x8d3113={'count':0x0,'rows':[]};var _0x3229d3=_[_0xc172('0x24')](db['WhatsappTransferReport'][_0xc172('0x25')],function(_0x406344){return{'name':_0x406344[_0xc172('0x26')],'type':_0x406344[_0xc172('0x27')][_0xc172('0x28')]};});_0xdac399[_0xc172('0x29')]=_[_0xc172('0x24')](_0x3229d3,_0xc172('0x21'));_0xdac399[_0xc172('0x2a')]=_[_0xc172('0x2b')](_0x3de59b[_0xc172('0x2a')]);_0xdac399[_0xc172('0x2c')]=_['intersection'](_0xdac399[_0xc172('0x29')],_0xdac399[_0xc172('0x2a')]);_0x507c74['attributes']=_[_0xc172('0x2d')](_0xdac399[_0xc172('0x29')],qs['fields'](_0x3de59b[_0xc172('0x2a')]['fields']));_0x507c74[_0xc172('0x2e')]=_0x507c74[_0xc172('0x2e')]['length']?_0x507c74[_0xc172('0x2e')]:_0xdac399[_0xc172('0x29')];if(!_0x3de59b[_0xc172('0x2a')][_0xc172('0x2f')]('nolimit')){_0x507c74[_0xc172('0x30')]=qs[_0xc172('0x30')](_0x3de59b[_0xc172('0x2a')][_0xc172('0x30')]);_0x507c74['offset']=qs[_0xc172('0x18')](_0x3de59b[_0xc172('0x2a')]['offset']);}_0x507c74['order']=qs[_0xc172('0x31')](_0x3de59b['query'][_0xc172('0x31')]);_0x507c74[_0xc172('0x32')]=qs[_0xc172('0x2c')](_['pick'](_0x3de59b[_0xc172('0x2a')],_0xdac399['filters']),_0x3229d3);if(_0x3de59b[_0xc172('0x2a')][_0xc172('0x33')]){_0x507c74[_0xc172('0x32')]=_['merge'](_0x507c74[_0xc172('0x32')],{'$or':_[_0xc172('0x24')](_0x3229d3,function(_0x2c189b){if(_0x2c189b[_0xc172('0x27')]!==_0xc172('0x34')){var _0x4f975a={};_0x4f975a[_0x2c189b[_0xc172('0x21')]]={'$like':'%'+_0x3de59b['query'][_0xc172('0x33')]+'%'};return _0x4f975a;}})});}_0x507c74=_[_0xc172('0x35')]({},_0x507c74,_0x3de59b[_0xc172('0x36')]);var _0x51eca5={'where':_0x507c74[_0xc172('0x32')]};return db['WhatsappTransferReport'][_0xc172('0x1a')](_0x51eca5)[_0xc172('0x1e')](function(_0x9bd3a3){_0x8d3113[_0xc172('0x1a')]=_0x9bd3a3;if(_0x3de59b[_0xc172('0x2a')]['includeAll']){_0x507c74[_0xc172('0x37')]=[{'all':!![]}];}return db[_0xc172('0x38')][_0xc172('0x39')](_0x507c74);})['then'](function(_0x4abaae){_0x8d3113['rows']=_0x4abaae;return _0x8d3113;})[_0xc172('0x1e')](respondWithFilteredResult(_0x39f012,_0x507c74))['catch'](handleError(_0x39f012,null));};exports[_0xc172('0x3a')]=function(_0x2f92d9,_0x7b8567){var _0x306ee6={'raw':!![],'where':{'id':_0x2f92d9[_0xc172('0x3b')]['id']}},_0x7acc32={};_0x7acc32[_0xc172('0x29')]=_[_0xc172('0x2b')](db[_0xc172('0x38')]['rawAttributes']);_0x7acc32[_0xc172('0x2a')]=_[_0xc172('0x2b')](_0x2f92d9[_0xc172('0x2a')]);_0x7acc32['filters']=_[_0xc172('0x2d')](_0x7acc32['model'],_0x7acc32[_0xc172('0x2a')]);_0x306ee6['attributes']=_['intersection'](_0x7acc32['model'],qs['fields'](_0x2f92d9[_0xc172('0x2a')][_0xc172('0x3c')]));_0x306ee6[_0xc172('0x2e')]=_0x306ee6[_0xc172('0x2e')][_0xc172('0x3d')]?_0x306ee6[_0xc172('0x2e')]:_0x7acc32[_0xc172('0x29')];if(_0x2f92d9[_0xc172('0x2a')][_0xc172('0x3e')]){_0x306ee6[_0xc172('0x37')]=[{'all':!![]}];}_0x306ee6=_[_0xc172('0x35')]({},_0x306ee6,_0x2f92d9[_0xc172('0x36')]);return db['WhatsappTransferReport'][_0xc172('0x3f')](_0x306ee6)[_0xc172('0x1e')](handleEntityNotFound(_0x7b8567,null))[_0xc172('0x1e')](respondWithResult(_0x7b8567,null))[_0xc172('0x40')](handleError(_0x7b8567,null));};exports[_0xc172('0x41')]=function(_0x33d61f,_0x4d2bb3){return db[_0xc172('0x38')][_0xc172('0x41')](_0x33d61f[_0xc172('0x42')],{})[_0xc172('0x1e')](respondWithResult(_0x4d2bb3,0xc9))[_0xc172('0x40')](handleError(_0x4d2bb3,null));};exports[_0xc172('0x1d')]=function(_0x5c7920,_0x5f1e5e){if(_0x5c7920['body']['id']){delete _0x5c7920[_0xc172('0x42')]['id'];}return db[_0xc172('0x38')][_0xc172('0x3f')]({'where':{'id':_0x5c7920['params']['id']}})[_0xc172('0x1e')](handleEntityNotFound(_0x5f1e5e,null))[_0xc172('0x1e')](saveUpdates(_0x5c7920[_0xc172('0x42')],null))[_0xc172('0x1e')](respondWithResult(_0x5f1e5e,null))[_0xc172('0x40')](handleError(_0x5f1e5e,null));};exports['destroy']=function(_0x232dcc,_0x45ef36){return db[_0xc172('0x38')][_0xc172('0x3f')]({'where':{'id':_0x232dcc[_0xc172('0x3b')]['id']}})[_0xc172('0x1e')](handleEntityNotFound(_0x45ef36,null))[_0xc172('0x1e')](removeEntity(_0x45ef36,null))['catch'](handleError(_0x45ef36,null));};exports[_0xc172('0x43')]=function(_0x1511e7,_0xbaca22){return db[_0xc172('0x38')][_0xc172('0x43')]()[_0xc172('0x1e')](respondWithResult(_0xbaca22,null))[_0xc172('0x40')](handleError(_0xbaca22,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d09a5c3..d82910d 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 _0x4630=['api','moment','bluebird','request-promise','path','define','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x32c34d,_0x4b7972){var _0x5f1e30=function(_0x3f5040){while(--_0x3f5040){_0x32c34d['push'](_0x32c34d['shift']());}};_0x5f1e30(++_0x4b7972);}(_0x4630,0x1ca));var _0x0463=function(_0x29b50a,_0x2865a5){_0x29b50a=_0x29b50a-0x0;var _0x5566bf=_0x4630[_0x29b50a];return _0x5566bf;};'use strict';var _=require(_0x0463('0x0'));var util=require(_0x0463('0x1'));var logger=require('../../config/logger')(_0x0463('0x2'));var moment=require(_0x0463('0x3'));var BPromise=require(_0x0463('0x4'));var rp=require(_0x0463('0x5'));var fs=require('fs');var path=require(_0x0463('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0xa60d71,_0x569ef5){return _0xa60d71[_0x0463('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x0463('0x8'),'paranoid':![],'indexes':[{'name':_0x0463('0x9'),'fields':[_0x0463('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fc0=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','uniqueid','lodash','util'];(function(_0x2dc952,_0x5595cd){var _0x5cba2d=function(_0x281097){while(--_0x281097){_0x2dc952['push'](_0x2dc952['shift']());}};_0x5cba2d(++_0x5595cd);}(_0x8fc0,0x196));var _0x08fc=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x8fc0[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x08fc('0x0'));var util=require(_0x08fc('0x1'));var logger=require(_0x08fc('0x2'))('api');var moment=require(_0x08fc('0x3'));var BPromise=require(_0x08fc('0x4'));var rp=require(_0x08fc('0x5'));var fs=require('fs');var path=require(_0x08fc('0x6'));var rimraf=require(_0x08fc('0x7'));var config=require(_0x08fc('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x08fc('0x9')]=function(_0x3ae056,_0x3df217){return _0x3ae056[_0x08fc('0xa')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x08fc('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b8e83f1..74b6033 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 _0x5b53=['../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappTransferReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x44c26c,_0x5a63c9){var _0x5bf55e=function(_0x3b9f2d){while(--_0x3b9f2d){_0x44c26c['push'](_0x44c26c['shift']());}};_0x5bf55e(++_0x5a63c9);}(_0x5b53,0x1b1));var _0x35b5=function(_0xb29bef,_0x45aff1){_0xb29bef=_0xb29bef-0x0;var _0x878163=_0x5b53[_0xb29bef];return _0x878163;};'use strict';var _=require(_0x35b5('0x0'));var util=require('util');var moment=require(_0x35b5('0x1'));var BPromise=require(_0x35b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35b5('0x3'));var db=require(_0x35b5('0x4'))['db'];var utils=require(_0x35b5('0x5'));var logger=require('../../config/logger')(_0x35b5('0x6'));var config=require(_0x35b5('0x7'));var jayson=require(_0x35b5('0x8'));var client=jayson[_0x35b5('0x9')][_0x35b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56ccd5,_0x4fb588,_0x260260){return new BPromise(function(_0x443022,_0x23aa97){return client['request'](_0x56ccd5,_0x260260)['then'](function(_0x2954f0){logger[_0x35b5('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4fb588,_0x35b5('0xc'));logger[_0x35b5('0xd')](_0x35b5('0xe'),_0x4fb588,_0x35b5('0xc'),JSON[_0x35b5('0xf')](_0x2954f0));if(_0x2954f0[_0x35b5('0x10')]){if(_0x2954f0[_0x35b5('0x10')][_0x35b5('0x11')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x4fb588,_0x2954f0[_0x35b5('0x10')]['message']);return _0x23aa97(_0x2954f0[_0x35b5('0x10')][_0x35b5('0x12')]);}logger[_0x35b5('0x10')](_0x35b5('0x13'),_0x4fb588,_0x2954f0['error']['message']);return _0x443022(_0x2954f0[_0x35b5('0x10')][_0x35b5('0x12')]);}else{logger[_0x35b5('0xb')](_0x35b5('0x13'),_0x4fb588,'request\x20sent');_0x443022(_0x2954f0[_0x35b5('0x14')][_0x35b5('0x12')]);}})[_0x35b5('0x15')](function(_0x1ecb93){logger[_0x35b5('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4fb588,_0x1ecb93);_0x23aa97(_0x1ecb93);});});} \ No newline at end of file +var _0x612b=['http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e9271,_0x388644){var _0x39065c=function(_0x3be0ee){while(--_0x3be0ee){_0x1e9271['push'](_0x1e9271['shift']());}};_0x39065c(++_0x388644);}(_0x612b,0x75));var _0xb612=function(_0x65b3e,_0x1580ed){_0x65b3e=_0x65b3e-0x0;var _0x3a8524=_0x612b[_0x65b3e];return _0x3a8524;};'use strict';var _=require(_0xb612('0x0'));var util=require(_0xb612('0x1'));var moment=require(_0xb612('0x2'));var BPromise=require(_0xb612('0x3'));var rs=require(_0xb612('0x4'));var fs=require('fs');var Redis=require(_0xb612('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb612('0x6'));var logger=require(_0xb612('0x7'))(_0xb612('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb612('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c85cd,_0x3b84cb,_0x1df3e0){return new BPromise(function(_0x485f3f,_0x4c3963){return client[_0xb612('0xa')](_0x1c85cd,_0x1df3e0)[_0xb612('0xb')](function(_0x1ce747){logger['info'](_0xb612('0xc'),_0x3b84cb,_0xb612('0xd'));logger[_0xb612('0xe')](_0xb612('0xf'),_0x3b84cb,_0xb612('0xd'),JSON['stringify'](_0x1ce747));if(_0x1ce747['error']){if(_0x1ce747['error'][_0xb612('0x10')]===0x1f4){logger[_0xb612('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3b84cb,_0x1ce747[_0xb612('0x11')][_0xb612('0x12')]);return _0x4c3963(_0x1ce747[_0xb612('0x11')][_0xb612('0x12')]);}logger[_0xb612('0x11')](_0xb612('0xc'),_0x3b84cb,_0x1ce747[_0xb612('0x11')][_0xb612('0x12')]);return _0x485f3f(_0x1ce747[_0xb612('0x11')]['message']);}else{logger[_0xb612('0x13')](_0xb612('0xc'),_0x3b84cb,'request\x20sent');_0x485f3f(_0x1ce747['result'][_0xb612('0x12')]);}})[_0xb612('0x14')](function(_0x9b3bed){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x3b84cb,_0x9b3bed);_0x4c3963(_0x9b3bed);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 11a1ba9..890c83e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4aa3=['Online\x20apps:','filter','online','join','Offline\x20apps:','status','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4aa3,0x174));var _0x34aa=function(_0x32e7f3,_0x313d33){_0x32e7f3=_0x32e7f3-0x0;var _0x14ed27=_0x4aa3[_0x32e7f3];return _0x14ed27;};'use strict';var _=require(_0x34aa('0x0'));var db=require(_0x34aa('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x34aa('0x2'));var rpc=require(_0x34aa('0x3'));var config=require('./config/environment');var logger=require(_0x34aa('0x4'))(_0x34aa('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x34aa('0x6'));var schedule=require(_0x34aa('0x7'));var chat=require(_0x34aa('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x34aa('0x9'));var provider=require(_0x34aa('0xa'));function main(){return db['sequelize'][_0x34aa('0xb')]()[_0x34aa('0xc')](function(){if(config['seedDB']){return seedDb[_0x34aa('0xd')]();}})['then'](function(){return checkLicense['default']();})[_0x34aa('0xc')](function(){return rpc[_0x34aa('0xe')]();})[_0x34aa('0xc')](function(_0x10fc02){logger[_0x34aa('0xf')](_0x10fc02);return chat[_0x34aa('0x10')]();})['then'](function(){return whatsapp[_0x34aa('0x10')]();})['then'](function(){return schedule['start']();})[_0x34aa('0xc')](function(){return transcribe[_0x34aa('0x10')]();})[_0x34aa('0xc')](function(){return provider['start']();})[_0x34aa('0xc')](function(_0x5a5a5b){logger[_0x34aa('0xf')](_0x5a5a5b);return pm2[_0x34aa('0x10')](pm2Config);})[_0x34aa('0xc')](function(_0x3a6819){var _0x29713a=_0x3a6819['filter'](function(_0x3dc282){return typeof _0x3dc282[_0x34aa('0x11')]===_0x34aa('0x12')&&_0x3dc282[_0x34aa('0x11')]>=0x0;});if(_0x29713a[_0x34aa('0x13')]>0x0){throw new Error(_0x29713a[_0x34aa('0x13')]+_0x34aa('0x14')+_[_0x34aa('0x15')](_0x29713a,function(_0x2663ea){return'\x22'+_0x2663ea[_0x34aa('0x16')][_0x34aa('0x17')]+'\x22';}));}logger[_0x34aa('0xf')](_0x34aa('0x18'),_[_0x34aa('0x15')](_[_0x34aa('0x19')](_0x3a6819,{'status':_0x34aa('0x1a')}),_0x34aa('0x17'))[_0x34aa('0x1b')]());logger[_0x34aa('0xf')](_0x34aa('0x1c'),_[_0x34aa('0x15')](_[_0x34aa('0x19')](_0x3a6819,function(_0x329a6b){return _0x329a6b[_0x34aa('0x1d')]!==_0x34aa('0x1a');}),_0x34aa('0x17'))[_0x34aa('0x1b')]()||'None');console[_0x34aa('0x1e')](_0x34aa('0x1f'));})['catch'](function(_0x2db2ec){console[_0x34aa('0x1e')](_0x34aa('0x20'),_0x2db2ec);logger[_0x34aa('0x21')](_0x34aa('0x22'),_0x2db2ec);process[_0x34aa('0x23')](0x1);});}main(); \ No newline at end of file +var _0x6379=['then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','status','online','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider'];(function(_0x73a1c5,_0x50ce98){var _0x403ed4=function(_0x4bfc84){while(--_0x4bfc84){_0x73a1c5['push'](_0x73a1c5['shift']());}};_0x403ed4(++_0x50ce98);}(_0x6379,0x84));var _0x9637=function(_0x3cd451,_0x26e81a){_0x3cd451=_0x3cd451-0x0;var _0x571ce6=_0x6379[_0x3cd451];return _0x571ce6;};'use strict';var _=require(_0x9637('0x0'));var db=require(_0x9637('0x1'))['db'];var seedDb=require(_0x9637('0x2'));var checkLicense=require(_0x9637('0x3'));var rpc=require(_0x9637('0x4'));var config=require('./config/environment');var logger=require(_0x9637('0x5'))(_0x9637('0x6'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x9637('0x7'));var chat=require(_0x9637('0x8'));var whatsapp=require(_0x9637('0x9'));var transcribe=require(_0x9637('0xa'));var provider=require(_0x9637('0xb'));function main(){return db['sequelize']['sync']()[_0x9637('0xc')](function(){if(config[_0x9637('0xd')]){return seedDb[_0x9637('0xe')]();}})[_0x9637('0xc')](function(){return checkLicense['default']();})[_0x9637('0xc')](function(){return rpc[_0x9637('0xf')]();})[_0x9637('0xc')](function(_0x426ae2){logger[_0x9637('0x10')](_0x426ae2);return chat[_0x9637('0x11')]();})[_0x9637('0xc')](function(){return whatsapp[_0x9637('0x11')]();})[_0x9637('0xc')](function(){return schedule['start']();})[_0x9637('0xc')](function(){return transcribe['start']();})[_0x9637('0xc')](function(){return provider[_0x9637('0x11')]();})['then'](function(_0x2b385f){logger[_0x9637('0x10')](_0x2b385f);return pm2[_0x9637('0x11')](pm2Config);})[_0x9637('0xc')](function(_0x5ecb8a){var _0x361078=_0x5ecb8a[_0x9637('0x12')](function(_0x2d5ea1){return typeof _0x2d5ea1[_0x9637('0x13')]===_0x9637('0x14')&&_0x2d5ea1['exitCode']>=0x0;});if(_0x361078[_0x9637('0x15')]>0x0){throw new Error(_0x361078[_0x9637('0x15')]+_0x9637('0x16')+_[_0x9637('0x17')](_0x361078,function(_0x10daf0){return'\x22'+_0x10daf0[_0x9637('0x18')][_0x9637('0x19')]+'\x22';}));}logger[_0x9637('0x10')](_0x9637('0x1a'),_[_0x9637('0x17')](_['filter'](_0x5ecb8a,{'status':'online'}),_0x9637('0x19'))[_0x9637('0x1b')]());logger[_0x9637('0x10')](_0x9637('0x1c'),_['map'](_['filter'](_0x5ecb8a,function(_0x5ad1b3){return _0x5ad1b3[_0x9637('0x1d')]!==_0x9637('0x1e');}),_0x9637('0x19'))[_0x9637('0x1b')]()||_0x9637('0x1f'));console['log']('App\x20Ready!');})['catch'](function(_0x4a0002){console[_0x9637('0x20')](_0x9637('0x21'),_0x4a0002);logger[_0x9637('0x22')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4a0002);process[_0x9637('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 194ee6b..1ce8dc8 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 _0xa28c=['composable-middleware','basic-auth','crypto','util','moment','secrets','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','query','status','unmanaged','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','json','Wrong\x20credentials.','apikey','getUuid','find','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','use','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','role','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','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','length','splice','unshift','join','promisify','secret','session','payload','options','verify','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt'];(function(_0x500225,_0x523a00){var _0xa4856c=function(_0x4ec077){while(--_0x4ec077){_0x500225['push'](_0x500225['shift']());}};_0xa4856c(++_0x523a00);}(_0xa28c,0x88));var _0xca28=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa28c[_0x5bd426];return _0x23a7eb;};'use strict';var db=require(_0xca28('0x0'))['db'];var config=require(_0xca28('0x1'));var hardwareConf=require(_0xca28('0x2'));var licenseUtil=require(_0xca28('0x3'));var encryptor=require(_0xca28('0x4'));var _=require(_0xca28('0x5'));var jwt=require(_0xca28('0x6'));var expressJwt=require(_0xca28('0x7'));var compose=require(_0xca28('0x8'));var basicAuth=require(_0xca28('0x9'));var crypto=require(_0xca28('0xa'));var BPromise=require('bluebird');var util=require(_0xca28('0xb'));var moment=require(_0xca28('0xc'));var validateJwt=expressJwt({'secret':config[_0xca28('0xd')]['session']});var userAttributes=['id','role',_0xca28('0xe'),_0xca28('0xf'),_0xca28('0x10'),_0xca28('0x11'),_0xca28('0x12'),_0xca28('0x13'),_0xca28('0x14'),_0xca28('0x15'),_0xca28('0x16'),_0xca28('0x17'),_0xca28('0x18'),'smsPause','openchannelPause',_0xca28('0x19'),'showWebBar','lastLoginAt',_0xca28('0x1a'),_0xca28('0x1b'),_0xca28('0x1c'),_0xca28('0x1d'),_0xca28('0x1e'),_0xca28('0x1f'),_0xca28('0x20'),_0xca28('0x21'),'phoneBarEnableRecording',_0xca28('0x22'),_0xca28('0x23'),_0xca28('0x24'),_0xca28('0x25'),_0xca28('0x26'),_0xca28('0x27'),_0xca28('0x28'),_0xca28('0x29'),_0xca28('0x2a'),_0xca28('0x2b'),_0xca28('0x2c'),_0xca28('0x2d'),_0xca28('0x2e'),_0xca28('0x2f'),_0xca28('0x30'),_0xca28('0x31'),'selectRecallMeCampaign',_0xca28('0x32'),'chatAutoanswerDelay',_0xca28('0x33'),_0xca28('0x34'),_0xca28('0x35'),_0xca28('0x36'),_0xca28('0x37'),_0xca28('0x38'),_0xca28('0x39'),_0xca28('0x3a'),_0xca28('0x3b'),_0xca28('0x3c'),_0xca28('0x3d')];exports[_0xca28('0x3e')]=function(){return this[_0xca28('0x3f')](!![])['use'](function(_0x45e9a8,_0x1a85c6,_0x3e2d55){if(_0x45e9a8[_0xca28('0x40')]){_0x3e2d55();}else{return db[_0xca28('0x41')][_0xca28('0x42')]({'where':{'id':_0x45e9a8[_0xca28('0x43')]['id']},'attributes':['id',_0xca28('0x44'),_0xca28('0x45')],'raw':!![]})[_0xca28('0x46')](function(_0x586008){if(_0x586008&&_0x586008[_0xca28('0x44')]&&!_0x45e9a8[_0xca28('0x47')]['forceDownload']){return _0x1a85c6[_0xca28('0x48')](_0x586008[_0xca28('0x45')]===_0xca28('0x49')?0x195:0x193)['json']({'message':_0x586008['disposition']===_0xca28('0x49')?'Unmanaged.':_0xca28('0x4a')});}else{_0x3e2d55();}})[_0xca28('0x4b')](function(_0x44952f){_0x3e2d55(_0x44952f);});}});};exports[_0xca28('0x3f')]=function isAuthenticated(_0x571222){return compose()['use'](function(_0x3c9080,_0x1160cd,_0x3b5686){var _0x1a88d2;if(_0x3c9080[_0xca28('0x4c')][_0xca28('0x4d')]){if(_[_0xca28('0x4e')](_0x3c9080[_0xca28('0x4c')]['authorization'],_0xca28('0x4f'))){var _0x3a4605=basicAuth(_0x3c9080);db[_0xca28('0x50')]['find']({'where':{'name':_0x3a4605[_0xca28('0xf')]}})[_0xca28('0x46')](function(_0x3df4df){if(!_0x3df4df||!_0x3df4df[_0xca28('0x51')](_0x3a4605['pass'])){return _0x1160cd['status'](0x191)[_0xca28('0x52')]({'message':_0xca28('0x53')});}_0x3c9080['user']={'id':_0x3df4df['id']};_0x3b5686();})[_0xca28('0x4b')](function(_0x56e236){_0x3b5686(_0x56e236);});}else if(_['startsWith'](_0x3c9080['headers'][_0xca28('0x4d')],'Bearer')){validateJwt(_0x3c9080,_0x1160cd,_0x3b5686);}else{if(_0x571222){_0x3b5686();}else{return _0x1160cd['status'](0x193)[_0xca28('0x52')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3c9080['query'][_0xca28('0x54')]){try{var _0x381445={'audience':hardwareConf[_0xca28('0x55')](),'issuer':hardwareConf[_0xca28('0x55')]()};verifyJwt(_0x3c9080[_0xca28('0x47')][_0xca28('0x54')],_0x381445)[_0xca28('0x46')](function(_0x15d435){return db['User'][_0xca28('0x56')]({'where':{'id':_0x15d435['sub']}})[_0xca28('0x46')](function(_0x3a27c4){_0x1a88d2=_0x3a27c4;return db[_0xca28('0x57')][_0xca28('0x42')]({'where':{'id':0x1},'attributes':[_0xca28('0x58'),_0xca28('0x59')],'raw':!![]});})[_0xca28('0x46')](function(_0x1acbe3){if(!_0x1a88d2||!_[_0xca28('0x5a')](_0x1a88d2[_0xca28('0x5b')],_0x15d435[_0xca28('0x5c')])){return _0x1160cd[_0xca28('0x48')](0x191)[_0xca28('0x52')]({'message':_0xca28('0x5d')});}if(_0x1a88d2[_0xca28('0x5e')]){return _0x1160cd['status'](0x191)[_0xca28('0x52')]({'message':_0xca28('0x5f')});}if(_0x1a88d2['blocked']){if(_0x1acbe3[_0xca28('0x59')]>0x0){if(moment(_0x1a88d2[_0xca28('0x60')])[_0xca28('0x61')](_0x1acbe3['blockDuration'],_0xca28('0x62'))>moment()){return _0x1160cd['status'](0x191)[_0xca28('0x52')]({'message':_0xca28('0x5f')});}}else{return _0x1160cd[_0xca28('0x48')](0x191)['json']({'message':_0xca28('0x5f')});}}_0x3c9080['user']={'id':_0x1a88d2['id']};_0x3b5686();});})[_0xca28('0x4b')](function(){return _0x1160cd[_0xca28('0x48')](0x191)[_0xca28('0x52')]({'message':_0xca28('0x5f')});});}catch(_0x109b42){_0x3b5686(_0x109b42);}}else if(_0x571222){_0x3b5686();}else{return _0x1160cd['status'](0x193)['json']({'message':_0xca28('0x63')});}})[_0xca28('0x64')](function(_0x3b1f31,_0x1ac13c,_0x5a071f){if(_0x3b1f31['user']){db['User']['find']({'where':{'id':_0x3b1f31[_0xca28('0x40')]['id']},'attributes':userAttributes})[_0xca28('0x46')](function(_0x56c84f){if(!_0x56c84f){return _0x1ac13c['status'](0x194)[_0xca28('0x52')]({'message':_0xca28('0x65')});}_0x3b1f31['user']=_0x56c84f;_0x5a071f();})[_0xca28('0x4b')](function(_0x256139){_0x5a071f(_0x256139);});}else if(_0x571222){_0x5a071f();}else{return _0x1ac13c[_0xca28('0x48')](0x194)[_0xca28('0x52')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xca28('0x66')]=function canUpdate(){return compose()[_0xca28('0x64')](function(_0x39b587,_0x3e53de,_0x30c905){return licenseUtil[_0xca28('0x67')]()[_0xca28('0x46')](function(_0x23a09d){if(_0x23a09d['update']){_0x30c905();}else{return _0x3e53de['status'](0x193)[_0xca28('0x52')]({'message':_0xca28('0x68')});}})[_0xca28('0x4b')](function(_0x5464ca){_0x30c905(_0x5464ca);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xca28('0x64')](function(_0x1cc9ea,_0xe85cb6,_0x10f22b){return licenseUtil[_0xca28('0x67')]()[_0xca28('0x46')](function(_0x3fec38){if(_0x3fec38['webrtc']){_0x10f22b();}else{return _0xe85cb6['status'](0x193)['json']({'message':_0xca28('0x68')});}})[_0xca28('0x4b')](function(_0x50d625){_0x10f22b(_0x50d625);});});};exports[_0xca28('0x69')]=function(_0x273336,_0x1d0d22,_0xeddb66){_0x273336[_0xca28('0x69')]=!![];return _0xeddb66();};exports[_0xca28('0x6a')]=function signToken(_0x42d5a7){return signJwt(_0x42d5a7);};exports[_0xca28('0x6b')]=function(_0x211d72,_0x13f838){if(!_0x211d72[_0xca28('0x40')]){return _0x13f838[_0xca28('0x48')](0x194)[_0xca28('0x52')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x801595={'payload':{'id':_0x211d72[_0xca28('0x40')]['id'],'role':_0x211d72[_0xca28('0x40')][_0xca28('0x6c')]},'options':{'expiresIn':0x15180}};return signJwt(_0x801595)['then'](function(_0x4260b2){_0x13f838['cookie']('motion.token',_0x4260b2);_0x13f838[_0xca28('0x6d')](_0xca28('0x6e'));})['catch'](function(_0x4e5fbb){return _0x13f838[_0xca28('0x48')](0x1f4)[_0xca28('0x6f')](_0x4e5fbb);});};exports[_0xca28('0x70')]=function(_0x379aae){if(_[_0xca28('0x71')](_0x379aae[_0xca28('0x5b')])||_['isNil'](_0x379aae['apiKeyIat'])){return null;}else{return createJwt(_0x379aae);}};exports[_0xca28('0x72')]=function(_0x5e07b4){_0x5e07b4[_0xca28('0x5b')]=generateNonce();_0x5e07b4[_0xca28('0x73')]=generateIssuedAt();return createJwt(_0x5e07b4);};exports[_0xca28('0x74')]=function(_0x1a1e35,_0x14ae2d){var _0x2cbac4=_0x1a1e35[_0xca28('0x47')][_0xca28('0x54')];if(_0x2cbac4){var _0xbc0082={'nonce':_0x14ae2d[_0xca28('0x5b')],'iat':_0x14ae2d[_0xca28('0x73')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xca28('0x55')]()};return verifyJwt(_0x2cbac4,_0xbc0082)[_0xca28('0x46')](function(){return generateApiKey(_0x14ae2d);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xca28('0x75')]=function(_0x46202a){var _0x3683ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3683ad[_0xca28('0x76')](_0x46202a))throw new db[(_0xca28('0x77'))][(_0xca28('0x78'))](_0xca28('0x79'));return;};exports[_0xca28('0x7a')]=function(_0x3cb048,_0x167ee6,_0xbef81e){var _0x3e0fa9=encryptor[_0xca28('0x7b')](_0x167ee6)[_0xca28('0x7c')](',');for(var _0x6f6841=0x0;_0x6f6841<_0xbef81e;_0x6f6841++){if(!_0x3e0fa9[_0x6f6841])break;if(_0x3cb048['toLowerCase']()===_0x3e0fa9[_0x6f6841][_0xca28('0x7d')]()){var _0x24f32f=util[_0xca28('0x7e')](_0xca28('0x7f'),_0xbef81e);if(_0xbef81e===0x1){_0x24f32f=_0xca28('0x80');}throw new db[(_0xca28('0x77'))]['ValidationError'](_0x24f32f);}}return;};exports[_0xca28('0x81')]=function(_0x2dd4af,_0x95fc08){var _0x422fa2=_0x95fc08?encryptor[_0xca28('0x7b')](_0x95fc08)[_0xca28('0x7c')](','):[];if(_0x422fa2[_0xca28('0x82')]===0x5){_0x422fa2[_0xca28('0x83')](-0x1,0x1);}_0x422fa2[_0xca28('0x84')](_0x2dd4af);return encryptor['encryptString'](_0x422fa2[_0xca28('0x85')](','));};function signJwt(_0x120265){var _0x641272=BPromise[_0xca28('0x86')](jwt['sign'],{'context':jwt});var _0x47b38b=_0x120265[_0xca28('0x87')]||config[_0xca28('0xd')][_0xca28('0x88')];return new BPromise(function(_0x4a3ebf,_0x5db162){_0x641272(_0x120265[_0xca28('0x89')],_0x47b38b,_0x120265[_0xca28('0x8a')])['then'](function(_0x526604){_0x4a3ebf(_0x526604);})['catch'](function(_0x3666a2){_0x5db162(_0x3666a2);});});}function verifyJwt(_0x5ba275,_0x14c5c4,_0x596de9){var _0x3a73be=BPromise[_0xca28('0x86')](jwt[_0xca28('0x8b')],{'context':jwt});var _0x15229c=_0x596de9||config['secrets'][_0xca28('0x88')];return new BPromise(function(_0x3723f4,_0x8f699f){_0x3a73be(_0x5ba275,_0x15229c,_0x14c5c4)[_0xca28('0x46')](function(_0x19d4f5){_0x3723f4(_0x19d4f5);})[_0xca28('0x4b')](function(_0x2c1103){_0x8f699f(_0x2c1103);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xca28('0x8c')](_0xca28('0x8d'));}function generateIssuedAt(){return Math['floor'](Date[_0xca28('0x8e')]()/0x3e8)[_0xca28('0x8c')]();}function createJwt(_0x1a5335){var _0x1a2c94={'payload':{'iat':_0x1a5335[_0xca28('0x73')],'nonce':_0x1a5335[_0xca28('0x5b')]},'options':{'algorithm':_0xca28('0x8f'),'subject':_0x1a5335['id'][_0xca28('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xca28('0x55')]()}};return signJwt(_0x1a2c94)[_0xca28('0x46')](function(_0x5ef404){return{'iat':_0x1a5335['apiKeyIat'],'nonce':_0x1a5335[_0xca28('0x5b')],'token':_0x5ef404};});} \ No newline at end of file +var _0xebcf=['../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','role','fullname','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','then','query','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','pass','Bearer','json','Unknown\x20authorization\x20format','apikey','getUuid','find','findOne','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','test','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','sign','secret','session','payload','options','secrets','randomBytes','toString'];(function(_0x577cbc,_0x2ce57b){var _0xf601ee=function(_0x167adc){while(--_0x167adc){_0x577cbc['push'](_0x577cbc['shift']());}};_0xf601ee(++_0x2ce57b);}(_0xebcf,0x89));var _0xfebc=function(_0x2966b2,_0xa951f2){_0x2966b2=_0x2966b2-0x0;var _0x1cd1f1=_0xebcf[_0x2966b2];return _0x1cd1f1;};'use strict';var db=require(_0xfebc('0x0'))['db'];var config=require(_0xfebc('0x1'));var hardwareConf=require(_0xfebc('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfebc('0x3'));var _=require(_0xfebc('0x4'));var jwt=require(_0xfebc('0x5'));var expressJwt=require(_0xfebc('0x6'));var compose=require(_0xfebc('0x7'));var basicAuth=require(_0xfebc('0x8'));var crypto=require(_0xfebc('0x9'));var BPromise=require(_0xfebc('0xa'));var util=require(_0xfebc('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xfebc('0xc'),_0xfebc('0xd'),'name',_0xfebc('0xe'),'email',_0xfebc('0xf'),_0xfebc('0x10'),'md5secret',_0xfebc('0x11'),_0xfebc('0x12'),_0xfebc('0x13'),_0xfebc('0x14'),_0xfebc('0x15'),_0xfebc('0x16'),_0xfebc('0x17'),_0xfebc('0x18'),_0xfebc('0x19'),_0xfebc('0x1a'),_0xfebc('0x1b'),_0xfebc('0x1c'),_0xfebc('0x1d'),'alias',_0xfebc('0x1e'),_0xfebc('0x1f'),_0xfebc('0x20'),_0xfebc('0x21'),_0xfebc('0x22'),_0xfebc('0x23'),_0xfebc('0x24'),_0xfebc('0x25'),_0xfebc('0x26'),_0xfebc('0x27'),_0xfebc('0x28'),'interface',_0xfebc('0x29'),'privacyEnabled',_0xfebc('0x2a'),'wssPort',_0xfebc('0x2b'),_0xfebc('0x2c'),_0xfebc('0x2d'),_0xfebc('0x2e'),_0xfebc('0x2f'),_0xfebc('0x30'),_0xfebc('0x31'),_0xfebc('0x32'),_0xfebc('0x33'),_0xfebc('0x34'),_0xfebc('0x35'),_0xfebc('0x36'),_0xfebc('0x37'),_0xfebc('0x38'),'faxAutoanswerDelay',_0xfebc('0x39'),_0xfebc('0x3a'),_0xfebc('0x3b')];exports[_0xfebc('0x3c')]=function(){return this[_0xfebc('0x3d')](!![])[_0xfebc('0x3e')](function(_0x46b37e,_0x26b809,_0x4d8742){if(_0x46b37e[_0xfebc('0x3f')]){_0x4d8742();}else{return db[_0xfebc('0x40')]['findOne']({'where':{'id':_0x46b37e['params']['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xfebc('0x41')](function(_0x33efc8){if(_0x33efc8&&_0x33efc8['closed']&&!_0x46b37e[_0xfebc('0x42')]['forceDownload']){return _0x26b809[_0xfebc('0x43')](_0x33efc8[_0xfebc('0x44')]===_0xfebc('0x45')?0x195:0x193)['json']({'message':_0x33efc8[_0xfebc('0x44')]==='unmanaged'?_0xfebc('0x46'):_0xfebc('0x47')});}else{_0x4d8742();}})[_0xfebc('0x48')](function(_0x1ecde1){_0x4d8742(_0x1ecde1);});}});};exports[_0xfebc('0x3d')]=function isAuthenticated(_0x3f6743){return compose()[_0xfebc('0x3e')](function(_0x8cfa,_0x3e8ed9,_0x2ddb66){var _0x54bd4f;if(_0x8cfa[_0xfebc('0x49')][_0xfebc('0x4a')]){if(_[_0xfebc('0x4b')](_0x8cfa[_0xfebc('0x49')][_0xfebc('0x4a')],_0xfebc('0x4c'))){var _0x2e2d7d=basicAuth(_0x8cfa);db[_0xfebc('0x4d')]['find']({'where':{'name':_0x2e2d7d['name']}})[_0xfebc('0x41')](function(_0x36a968){if(!_0x36a968||!_0x36a968[_0xfebc('0x4e')](_0x2e2d7d[_0xfebc('0x4f')])){return _0x3e8ed9['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x8cfa['user']={'id':_0x36a968['id']};_0x2ddb66();})['catch'](function(_0x5e3ab6){_0x2ddb66(_0x5e3ab6);});}else if(_['startsWith'](_0x8cfa[_0xfebc('0x49')][_0xfebc('0x4a')],_0xfebc('0x50'))){validateJwt(_0x8cfa,_0x3e8ed9,_0x2ddb66);}else{if(_0x3f6743){_0x2ddb66();}else{return _0x3e8ed9[_0xfebc('0x43')](0x193)[_0xfebc('0x51')]({'message':_0xfebc('0x52')});}}}else if(_0x8cfa[_0xfebc('0x42')][_0xfebc('0x53')]){try{var _0x1b9d92={'audience':hardwareConf[_0xfebc('0x54')](),'issuer':hardwareConf[_0xfebc('0x54')]()};verifyJwt(_0x8cfa[_0xfebc('0x42')][_0xfebc('0x53')],_0x1b9d92)[_0xfebc('0x41')](function(_0x4e2e0f){return db[_0xfebc('0x4d')][_0xfebc('0x55')]({'where':{'id':_0x4e2e0f['sub']}})['then'](function(_0x5242d7){_0x54bd4f=_0x5242d7;return db['Setting'][_0xfebc('0x56')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})['then'](function(_0x3fe177){if(!_0x54bd4f||!_[_0xfebc('0x57')](_0x54bd4f[_0xfebc('0x58')],_0x4e2e0f['nonce'])){return _0x3e8ed9[_0xfebc('0x43')](0x191)['json']({'message':_0xfebc('0x59')});}if(_0x54bd4f['disabled']){return _0x3e8ed9[_0xfebc('0x43')](0x191)[_0xfebc('0x51')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x54bd4f[_0xfebc('0x5a')]){if(_0x3fe177[_0xfebc('0x5b')]>0x0){if(moment(_0x54bd4f['blockedAt'])[_0xfebc('0x5c')](_0x3fe177[_0xfebc('0x5b')],_0xfebc('0x5d'))>moment()){return _0x3e8ed9[_0xfebc('0x43')](0x191)[_0xfebc('0x51')]({'message':_0xfebc('0x5e')});}}else{return _0x3e8ed9[_0xfebc('0x43')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x8cfa[_0xfebc('0x3f')]={'id':_0x54bd4f['id']};_0x2ddb66();});})[_0xfebc('0x48')](function(){return _0x3e8ed9[_0xfebc('0x43')](0x191)['json']({'message':_0xfebc('0x5e')});});}catch(_0x666a6d){_0x2ddb66(_0x666a6d);}}else if(_0x3f6743){_0x2ddb66();}else{return _0x3e8ed9[_0xfebc('0x43')](0x193)[_0xfebc('0x51')]({'message':_0xfebc('0x52')});}})[_0xfebc('0x3e')](function(_0x5c6612,_0x3f4c0a,_0x30970a){if(_0x5c6612[_0xfebc('0x3f')]){db[_0xfebc('0x4d')][_0xfebc('0x55')]({'where':{'id':_0x5c6612[_0xfebc('0x3f')]['id']},'attributes':userAttributes})[_0xfebc('0x41')](function(_0x1b8cc5){if(!_0x1b8cc5){return _0x3f4c0a[_0xfebc('0x43')](0x194)[_0xfebc('0x51')]({'message':_0xfebc('0x5f')});}_0x5c6612['user']=_0x1b8cc5;_0x30970a();})[_0xfebc('0x48')](function(_0x5a9cc6){_0x30970a(_0x5a9cc6);});}else if(_0x3f6743){_0x30970a();}else{return _0x3f4c0a[_0xfebc('0x43')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xfebc('0x60')]=function canUpdate(){return compose()['use'](function(_0x54516d,_0x2cc38c,_0xf0ccd7){return licenseUtil[_0xfebc('0x61')]()[_0xfebc('0x41')](function(_0x15298e){if(_0x15298e[_0xfebc('0x62')]){_0xf0ccd7();}else{return _0x2cc38c[_0xfebc('0x43')](0x193)[_0xfebc('0x51')]({'message':'Forbidden'});}})[_0xfebc('0x48')](function(_0x1cb819){_0xf0ccd7(_0x1cb819);});});};exports[_0xfebc('0x63')]=function isWebrtcLicence(){return compose()[_0xfebc('0x3e')](function(_0x3d6c1f,_0x11e611,_0x261ec3){return licenseUtil['getLicense']()['then'](function(_0x1a5e1c){if(_0x1a5e1c[_0xfebc('0x64')]){_0x261ec3();}else{return _0x11e611[_0xfebc('0x43')](0x193)['json']({'message':_0xfebc('0x65')});}})[_0xfebc('0x48')](function(_0x2e290b){_0x261ec3(_0x2e290b);});});};exports[_0xfebc('0x66')]=function(_0x417aad,_0x497b18,_0x4aa500){_0x417aad[_0xfebc('0x66')]=!![];return _0x4aa500();};exports[_0xfebc('0x67')]=function signToken(_0x485523){return signJwt(_0x485523);};exports[_0xfebc('0x68')]=function(_0x55cbe1,_0x38c25a){if(!_0x55cbe1['user']){return _0x38c25a[_0xfebc('0x43')](0x194)['json']({'message':_0xfebc('0x69')});}var _0x2c6323={'payload':{'id':_0x55cbe1['user']['id'],'role':_0x55cbe1['user'][_0xfebc('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2c6323)['then'](function(_0x446087){_0x38c25a[_0xfebc('0x6a')](_0xfebc('0x6b'),_0x446087);_0x38c25a[_0xfebc('0x6c')]('/dashboards/general');})[_0xfebc('0x48')](function(_0x1437c4){return _0x38c25a[_0xfebc('0x43')](0x1f4)['send'](_0x1437c4);});};exports[_0xfebc('0x6d')]=function(_0x43853e){if(_[_0xfebc('0x6e')](_0x43853e['apiKeyNonce'])||_[_0xfebc('0x6e')](_0x43853e[_0xfebc('0x6f')])){return null;}else{return createJwt(_0x43853e);}};exports[_0xfebc('0x70')]=function(_0x1b432c){_0x1b432c[_0xfebc('0x58')]=generateNonce();_0x1b432c[_0xfebc('0x6f')]=generateIssuedAt();return createJwt(_0x1b432c);};exports[_0xfebc('0x71')]=function(_0x582929,_0x1ddf76){var _0x4612b4=_0x582929[_0xfebc('0x42')][_0xfebc('0x53')];if(_0x4612b4){var _0x454696={'nonce':_0x1ddf76[_0xfebc('0x58')],'iat':_0x1ddf76[_0xfebc('0x6f')],'audience':hardwareConf[_0xfebc('0x54')](),'issuer':hardwareConf[_0xfebc('0x54')]()};return verifyJwt(_0x4612b4,_0x454696)[_0xfebc('0x41')](function(){return generateApiKey(_0x1ddf76);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x1b3f77){var _0x18232b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x18232b[_0xfebc('0x72')](_0x1b3f77))throw new db['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~!@#$%^&-_=+[{]}.');return;};exports[_0xfebc('0x73')]=function(_0x1a7341,_0xd32f9a,_0x488328){var _0x1ef252=encryptor[_0xfebc('0x74')](_0xd32f9a)[_0xfebc('0x75')](',');for(var _0x4b6373=0x0;_0x4b6373<_0x488328;_0x4b6373++){if(!_0x1ef252[_0x4b6373])break;if(_0x1a7341[_0xfebc('0x76')]()===_0x1ef252[_0x4b6373][_0xfebc('0x76')]()){var _0x2d81e3=util[_0xfebc('0x77')](_0xfebc('0x78'),_0x488328);if(_0x488328===0x1){_0x2d81e3='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xfebc('0x79'))][(_0xfebc('0x7a'))](_0x2d81e3);}}return;};exports[_0xfebc('0x7b')]=function(_0x2992b1,_0x341f57){var _0x5229c2=_0x341f57?encryptor['decryptString'](_0x341f57)[_0xfebc('0x75')](','):[];if(_0x5229c2[_0xfebc('0x7c')]===0x5){_0x5229c2[_0xfebc('0x7d')](-0x1,0x1);}_0x5229c2[_0xfebc('0x7e')](_0x2992b1);return encryptor[_0xfebc('0x7f')](_0x5229c2['join'](','));};function signJwt(_0x43df78){var _0xd0e3db=BPromise[_0xfebc('0x80')](jwt[_0xfebc('0x81')],{'context':jwt});var _0x50616b=_0x43df78[_0xfebc('0x82')]||config['secrets'][_0xfebc('0x83')];return new BPromise(function(_0x3c7f03,_0x4b9c81){_0xd0e3db(_0x43df78[_0xfebc('0x84')],_0x50616b,_0x43df78[_0xfebc('0x85')])[_0xfebc('0x41')](function(_0x14dc3e){_0x3c7f03(_0x14dc3e);})[_0xfebc('0x48')](function(_0x308cfa){_0x4b9c81(_0x308cfa);});});}function verifyJwt(_0x2cb158,_0x5649a3,_0x1d17be){var _0x7d65f8=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x2f6715=_0x1d17be||config[_0xfebc('0x86')][_0xfebc('0x83')];return new BPromise(function(_0x16cb82,_0x1e76cd){_0x7d65f8(_0x2cb158,_0x2f6715,_0x5649a3)[_0xfebc('0x41')](function(_0x330b9b){_0x16cb82(_0x330b9b);})[_0xfebc('0x48')](function(_0x480425){_0x1e76cd(_0x480425);});});}function generateNonce(){return crypto[_0xfebc('0x87')](0x10)[_0xfebc('0x88')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0xfebc('0x88')]();}function createJwt(_0x3c3168){var _0x3518f8={'payload':{'iat':_0x3c3168[_0xfebc('0x6f')],'nonce':_0x3c3168[_0xfebc('0x58')]},'options':{'algorithm':'HS512','subject':_0x3c3168['id'][_0xfebc('0x88')](),'issuer':hardwareConf[_0xfebc('0x54')](),'audience':hardwareConf[_0xfebc('0x54')]()}};return signJwt(_0x3518f8)[_0xfebc('0x41')](function(_0x8d560){return{'iat':_0x3c3168[_0xfebc('0x6f')],'nonce':_0x3c3168['apiKeyNonce'],'token':_0x8d560};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index c8eafe5..1bbe54d 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 _0xb10f=['User','buildContactsQuery','getFilteredContacts','rows','describe','keys','filter','startsWith','map','CmCustomField','slice','length','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','clause','user','skip','checkListsRestrictions','then','tag','count'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xb10f,0xbe));var _0xfb10=function(_0x51a610,_0x426307){_0x51a610=_0x51a610-0x0;var _0x352d1e=_0xb10f[_0x51a610];return _0x352d1e;};'use strict';var _=require(_0xfb10('0x0'));var sqlUtils=require(_0xfb10('0x1'));var db=require(_0xfb10('0x2'))['db'];exports[_0xfb10('0x3')]=function(_0x525cc4,_0x228201,_0x3faa6f,_0x367dd4){var _0x2e2089={'count':0x0,'rows':[]};var _0x2956ee=sqlUtils[_0xfb10('0x4')](_0x228201,_0x525cc4);if(_0x2956ee){return Promise[_0xfb10('0x5')](_0x2e2089);}var _0x176a1d=sqlUtils[_0xfb10('0x6')]();var _0x3c2a59={};var _0x43f71e=![];var _0x25aa9c=![];return Promise[_0xfb10('0x5')]()['then'](function(){if(_0x525cc4[_0xfb10('0x7')]){return sqlUtils[_0xfb10('0x8')](_0x525cc4['search'],_0x367dd4);}else{return sqlUtils[_0xfb10('0x9')](_0x525cc4,_0x367dd4);}})['then'](function(_0x4f3ea4){_0x176a1d[_0xfb10('0xa')](_0x4f3ea4[_0xfb10('0xb')]);_0x176a1d[_0xfb10('0xa')](_0x4f3ea4[_0xfb10('0xc')]);_0x176a1d[_0xfb10('0xa')](_0x4f3ea4['filter']);_0x176a1d[_0xfb10('0xa')](_0x4f3ea4['user'][_0xfb10('0xd')]);_0x3c2a59=_0x4f3ea4['tags'];_0x25aa9c=_0x4f3ea4[_0xfb10('0xe')][_0xfb10('0xf')];return sqlUtils[_0xfb10('0x10')](_0x228201,_0x525cc4,_0x25aa9c);})[_0xfb10('0x11')](function(_0x42a3a8){_0x176a1d[_0xfb10('0xa')](_0x42a3a8);var _0x297dc8=_0x525cc4[_0xfb10('0x7')]?_0x3c2a59['ids']:_0x525cc4[_0xfb10('0x12')];_0x43f71e=_0x297dc8?!![]:![];return sqlUtils['countFilteredContacts'](_0x176a1d,_0x297dc8);})['then'](function(_0xccd4bd){_0x2e2089[_0xfb10('0x13')]=_0xccd4bd;if(_0x2e2089['count']===0x0){return;}if(_0x525cc4[_0xfb10('0x14')]){_0x25aa9c=!![];}return sqlUtils[_0xfb10('0x15')](_0x176a1d,_0x525cc4[_0xfb10('0xc')],_0x3faa6f,_0x43f71e,_0x3c2a59[_0xfb10('0xd')],_0x25aa9c);})[_0xfb10('0x11')](function(_0x1acdff){if(!_0x1acdff){return[];}return sqlUtils[_0xfb10('0x16')](_0x1acdff,_0x525cc4,_0x3faa6f);})[_0xfb10('0x11')](function(_0x3b1d2f){_0x2e2089[_0xfb10('0x17')]=_0x3b1d2f;return _0x2e2089;})['catch'](function(_0x320f6f){throw _0x320f6f;});};exports[_0xfb10('0x18')]=function(){var _0x499bc1={};var _0x533e0a=[];return db['CmContact'][_0xfb10('0x18')]()[_0xfb10('0x11')](function(_0x296601){_0x499bc1=_0x296601;var _0x15a6d9=Object[_0xfb10('0x19')](_0x499bc1)[_0xfb10('0x1a')](function(_0x138231){return _[_0xfb10('0x1b')](_0x138231,'cf_')?_0x138231:undefined;});var _0x381ba0=_0x15a6d9[_0xfb10('0x1c')](function(_0x4ed264){return db[_0xfb10('0x1d')]['findOne']({'where':{'id':_0x4ed264[_0xfb10('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x381ba0);})['then'](function(_0x1838c4){for(var _0xd31ed6=0x0;_0xd31ed6<_0x1838c4[_0xfb10('0x1f')];_0xd31ed6++){if(_0x1838c4[_0xd31ed6]){var _0xb8f85b=_0xfb10('0x20')+_0x1838c4[_0xd31ed6]['id'];_0x499bc1[_0xb8f85b][_0xfb10('0x21')]=_0x1838c4[_0xd31ed6][_0xfb10('0x22')];}}_0x533e0a=_[_0xfb10('0x1c')](Object['keys'](_0x499bc1),function(_0x24d5e4){return{'name':_0x24d5e4,'type':_0x499bc1[_0x24d5e4]['type']};});return _0x533e0a;})['catch'](function(_0x2124e0){throw _0x2124e0;});}; \ No newline at end of file +var _0xc8f3=['buildContactsQuery','clause','catch','describe','keys','filter','CmCustomField','findOne','slice','all','length','fieldType','map','type','lodash','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','default','fields','where','user','checkListsRestrictions','ids','tag','countFilteredContacts','count'];(function(_0x2795fb,_0x51a015){var _0x30e660=function(_0x3404c0){while(--_0x3404c0){_0x2795fb['push'](_0x2795fb['shift']());}};_0x30e660(++_0x51a015);}(_0xc8f3,0x158));var _0x3c8f=function(_0x2dd786,_0x45efe9){_0x2dd786=_0x2dd786-0x0;var _0x5165f6=_0xc8f3[_0x2dd786];return _0x5165f6;};'use strict';var _=require(_0x3c8f('0x0'));var sqlUtils=require(_0x3c8f('0x1'));var db=require('../../mysqldb')['db'];exports[_0x3c8f('0x2')]=function(_0x536c43,_0x30974b,_0x1aa7dd,_0x26a18e){var _0x2e6209={'count':0x0,'rows':[]};var _0x25cdb3=sqlUtils['skipContactsQuery'](_0x30974b,_0x536c43);if(_0x25cdb3){return Promise[_0x3c8f('0x3')](_0x2e6209);}var _0x3f99b7=sqlUtils['getContactsSubquery']();var _0x45e399={};var _0x15cb42=![];var _0x49607b=![];return Promise[_0x3c8f('0x3')]()[_0x3c8f('0x4')](function(){if(_0x536c43[_0x3c8f('0x5')]){return sqlUtils[_0x3c8f('0x6')](_0x536c43[_0x3c8f('0x5')],_0x26a18e);}else{return sqlUtils['parseQueryParameters'](_0x536c43,_0x26a18e);}})['then'](function(_0x5bb41d){_0x3f99b7['where'](_0x5bb41d[_0x3c8f('0x7')]);_0x3f99b7['where'](_0x5bb41d[_0x3c8f('0x8')]);_0x3f99b7[_0x3c8f('0x9')](_0x5bb41d['filter']);_0x3f99b7['where'](_0x5bb41d[_0x3c8f('0xa')]['clause']);_0x45e399=_0x5bb41d['tags'];_0x49607b=_0x5bb41d['user']['skip'];return sqlUtils[_0x3c8f('0xb')](_0x30974b,_0x536c43,_0x49607b);})['then'](function(_0x2c28fc){_0x3f99b7[_0x3c8f('0x9')](_0x2c28fc);var _0x57419b=_0x536c43[_0x3c8f('0x5')]?_0x45e399[_0x3c8f('0xc')]:_0x536c43[_0x3c8f('0xd')];_0x15cb42=_0x57419b?!![]:![];return sqlUtils[_0x3c8f('0xe')](_0x3f99b7,_0x57419b);})[_0x3c8f('0x4')](function(_0x39f856){_0x2e6209[_0x3c8f('0xf')]=_0x39f856;if(_0x2e6209[_0x3c8f('0xf')]===0x0){return;}if(_0x536c43['User']){_0x49607b=!![];}return sqlUtils[_0x3c8f('0x10')](_0x3f99b7,_0x536c43['fields'],_0x1aa7dd,_0x15cb42,_0x45e399[_0x3c8f('0x11')],_0x49607b);})['then'](function(_0x34c326){if(!_0x34c326){return[];}return sqlUtils['getFilteredContacts'](_0x34c326,_0x536c43,_0x1aa7dd);})[_0x3c8f('0x4')](function(_0x1d670e){_0x2e6209['rows']=_0x1d670e;return _0x2e6209;})[_0x3c8f('0x12')](function(_0x54dd55){throw _0x54dd55;});};exports[_0x3c8f('0x13')]=function(){var _0x3c1b01={};var _0xe78123=[];return db['CmContact']['describe']()[_0x3c8f('0x4')](function(_0x500b07){_0x3c1b01=_0x500b07;var _0xa11b80=Object[_0x3c8f('0x14')](_0x3c1b01)[_0x3c8f('0x15')](function(_0x372db6){return _['startsWith'](_0x372db6,'cf_')?_0x372db6:undefined;});var _0x20430c=_0xa11b80['map'](function(_0x47adea){return db[_0x3c8f('0x16')][_0x3c8f('0x17')]({'where':{'id':_0x47adea[_0x3c8f('0x18')](0x3)},'raw':!![]});});return Promise[_0x3c8f('0x19')](_0x20430c);})[_0x3c8f('0x4')](function(_0x12c2f7){for(var _0x17f460=0x0;_0x17f460<_0x12c2f7[_0x3c8f('0x1a')];_0x17f460++){if(_0x12c2f7[_0x17f460]){var _0xdfefa1='cf_'+_0x12c2f7[_0x17f460]['id'];_0x3c1b01[_0xdfefa1][_0x3c8f('0x1b')]=_0x12c2f7[_0x17f460]['type'];}}_0xe78123=_[_0x3c8f('0x1c')](Object['keys'](_0x3c1b01),function(_0x4ff3d6){return{'name':_0x4ff3d6,'type':_0x3c1b01[_0x4ff3d6][_0x3c8f('0x1d')]};});return _0xe78123;})['catch'](function(_0x24d434){throw _0x24d434;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index ae61fcc..cf09a2f 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 _0x4bf9=['Sequelize','SELECT','CmContact','query','toString','clone','COUNT(*)','getSelectedTags','isEmpty','QueryTypes','sequelize','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','search','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','ListId','createdAt','deletedAt','TagIds','includes','forEach','field','expr','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.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','DATE','type','default','value','start','end','Tag','map','tags','clause','and','ids','User','user','skip','some','compact','Contact','push','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','keyBy'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x4bf9,0xd6));var _0x94bf=function(_0x4baf7e,_0x422b41){_0x4baf7e=_0x4baf7e-0x0;var _0x308a7f=_0x4bf9[_0x4baf7e];return _0x308a7f;};'use strict';var _=require(_0x94bf('0x0'));var squel=require('squel');var as=require(_0x94bf('0x1'));var qs=require(_0x94bf('0x2'));var utils=require(_0x94bf('0x3'));var db=require(_0x94bf('0x4'))['db'];function skipContactsQuery(_0x28822b,_0x34078c){var _0x2a5610=![];if(_0x28822b[_0x94bf('0x5')]==='agent'&&!_0x34078c[_0x94bf('0x6')]&&!_0x34078c['ListId']&&_0x34078c['autocomplete']!==_0x94bf('0x7')){_0x2a5610=!![];}return _0x2a5610;}function getContactsSubquery(){return squel['select']()[_0x94bf('0x8')](_0x94bf('0x9'),'c')[_0x94bf('0xa')](_0x94bf('0xb'));}function applyJoinClauses(_0x350280,_0x26693c){var _0x2ac3c5=_0x26693c?'c':_0x94bf('0xc');_0x350280['left_join']('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x2ac3c5+_0x94bf('0xd'))[_0x94bf('0xe')](_0x94bf('0xf'),'ct',_0x94bf('0x10')+_0x2ac3c5+_0x94bf('0xd'))[_0x94bf('0xe')](_0x94bf('0x11'),'t',_0x94bf('0x12'));return _0x350280;}function addFieldsToQuery(_0x4d44e3,_0x52576b,_0x2e35d7,_0x43190f,_0x10e2a2){var _0x5bdd47=_0x10e2a2?'c':'subqry';if(!_0x52576b){_0x52576b=['id',_0x94bf('0x13'),_0x94bf('0x14'),_0x94bf('0x15'),_0x94bf('0x16'),_0x94bf('0x17'),_0x94bf('0x18'),_0x94bf('0x19'),'CompanyId',_0x94bf('0x1a'),'updatedAt',_0x94bf('0x1b'),_0x94bf('0x1c')];}else if(!_0x52576b[_0x94bf('0x1d')]('id')){_0x52576b['push']('id');}var _0x5cfea9=_0x2e35d7&&_0x10e2a2||!_0x2e35d7&&!_0x10e2a2;if(_0x43190f){_0x5cfea9=_0x43190f&&_0x10e2a2||!_0x43190f&&!_0x10e2a2;}_0x52576b[_0x94bf('0x1e')](function(_0x584c9c){if(_0x584c9c===_0x94bf('0x1c')){if(_0x5cfea9){_0x4d44e3[_0x94bf('0x1f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x584c9c);}else if(_0x2e35d7||_0x43190f){_0x4d44e3[_0x94bf('0x1f')](_0x5bdd47+'.'+_0x584c9c);}}else{_0x4d44e3[_0x94bf('0x1f')](_0x5bdd47+'.'+_0x584c9c);}});return _0x4d44e3;}function getSqlClauses(){var _0x3f7ba3={'default':squel[_0x94bf('0x20')](),'fields':squel[_0x94bf('0x20')](),'filter':squel[_0x94bf('0x20')](),'tags':{'clause':squel[_0x94bf('0x20')](),'ids':null},'user':{'clause':squel[_0x94bf('0x20')](),'skip':![]}};return _0x3f7ba3;}function parseTagParameter(_0x2c2afe){var _0x2a5729=squel['expr']();if(_0x2c2afe){var _0x1a753a=utils['getSelectedTags'](_0x2c2afe);_0x1a753a[_0x94bf('0x1e')](function(_0x3a6892){_0x2a5729['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3a6892+',%');});}return _0x2a5729;}function parseSearchFilter(_0x571422){var _0x3f57fa=squel[_0x94bf('0x20')]();if(_0x571422){var _0x3363b1=_0x571422[_0x94bf('0x21')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x3363b1[_0x94bf('0x22')]('\x20')[_0x94bf('0x23')]>0x1){_0x3f57fa['or'](_0x94bf('0x24'),qs[_0x94bf('0x25')](_0x3363b1,!![]),null);}else{if(qs['isNumeric'](_0x3363b1)){_0x3f57fa['or'](_0x94bf('0x26'),_0x3363b1+'%');_0x3f57fa['or'](_0x94bf('0x27'),_0x3363b1+'%');_0x3f57fa['or'](_0x94bf('0x28'),_0x3363b1+'%');_0x3f57fa['or'](_0x94bf('0x29'),_0x3363b1+'%');}else if(qs[_0x94bf('0x2a')](_0x3363b1)){_0x3f57fa['or'](_0x94bf('0x2b'),_0x3363b1+'%');}else{_0x3f57fa['or'](_0x94bf('0x2c'),'%'+_0x3363b1+'%');_0x3f57fa['or'](_0x94bf('0x2d'),'%'+_0x3363b1+'%');_0x3f57fa['or']('c.email\x20LIKE\x20?','%'+_0x3363b1+'%');}}}return _0x3f57fa;}function parseAdvancedSearchFilter(_0x2ca425,_0x223314){var _0x1899ba=getSqlClauses();var _0x162959=as[_0x94bf('0x2e')](_0x2ca425);var _0x533dc7=_0x162959[_0x94bf('0x2f')];for(var _0x1c9de8=0x0;_0x1c9de8<_0x162959['conditions']['length'];_0x1c9de8++){var _0x2fb8ff=_0x162959[_0x94bf('0x30')][_0x1c9de8];var _0x2ffbe7='c';var _0x3deefe=_[_0x94bf('0x31')](_0x223314,[_0x94bf('0x32'),_0x2fb8ff[_0x94bf('0x1f')]]);if(_0x3deefe){if(_0x2fb8ff[_0x94bf('0x1f')]===_0x94bf('0x33')||_0x3deefe['fieldType']==='datetime'){_0x2fb8ff['castTo']=_0x94bf('0x34');}var _0x18bc4a=as['buildExpression'](_0x2ffbe7,_0x3deefe[_0x94bf('0x35')],_0x2fb8ff);_0x1899ba[_0x94bf('0x36')][_0x533dc7](_0x18bc4a['text'],_0x18bc4a[_0x94bf('0x37')][_0x94bf('0x38')],_0x18bc4a[_0x94bf('0x37')][_0x94bf('0x39')]);}else{if(_0x2fb8ff[_0x94bf('0x1f')]===_0x94bf('0x3a')){var _0x2734b9=_0x2fb8ff[_0x94bf('0x37')][_0x94bf('0x22')](',')[_0x94bf('0x3b')](function(_0x176a2a){return Number(_0x176a2a);});var _0x4dceba=parseTagParameter(_0x2734b9);_0x1899ba[_0x94bf('0x3c')][_0x94bf('0x3d')][_0x94bf('0x3e')](_0x4dceba);_0x1899ba[_0x94bf('0x3c')][_0x94bf('0x3f')]=_0x2734b9;}else if(_0x2fb8ff[_0x94bf('0x1f')]===_0x94bf('0x40')){_0x1899ba[_0x94bf('0x41')]['clause'][_0x94bf('0x3e')]('uc.UserId\x20=\x20?',_0x2fb8ff[_0x94bf('0x37')]);_0x1899ba[_0x94bf('0x41')][_0x94bf('0x42')]=!![];}}}return _0x1899ba;}function parseModelFields(_0x17a633,_0x58f7ba){var _0xcc4b66=squel[_0x94bf('0x20')]();var _0x2dc92d=_(_0x17a633)['keys']()[_0x94bf('0x3b')](function(_0x5ee46c){return _[_0x94bf('0x43')](_0x58f7ba,[_0x94bf('0x32'),_0x5ee46c])?_0x5ee46c:undefined;})[_0x94bf('0x44')]()['value']();if(_0x17a633[_0x94bf('0x45')]){_0x2dc92d[_0x94bf('0x46')](_0x94bf('0x45'));}if(_0x17a633['User']){_0x2dc92d[_0x94bf('0x46')](_0x94bf('0x40'));}if(_0x2dc92d[_0x94bf('0x23')]>0x0){_0x2dc92d[_0x94bf('0x1e')](function(_0x7ffc8){if(_0x7ffc8===_0x94bf('0x19')){_0xcc4b66[_0x94bf('0x3e')]('c.ListId\x20IN\x20?',[][_0x94bf('0x47')](_0x17a633[_0x7ffc8]));}else if(_0x7ffc8===_0x94bf('0x45')){var _0x49f616='%'+_0x17a633[_0x7ffc8]+'%';_0xcc4b66[_0x94bf('0x3e')](_0x94bf('0x48'),_0x49f616);}else if(_0x7ffc8===_0x94bf('0x40')){_0xcc4b66[_0x94bf('0x3e')]('uc.UserId\x20=\x20?',_0x17a633[_0x7ffc8]);}else{_0xcc4b66['and']('c.'+_0x7ffc8+_0x94bf('0x49'),_0x17a633[_0x7ffc8]);}});}return _0xcc4b66;}function parseQueryParameters(_0xba06b,_0x13b676){var _0xa835d9=getSqlClauses();return Promise[_0x94bf('0x4a')]()[_0x94bf('0x4b')](function(){return parseModelFields(_0xba06b,_0x13b676);})[_0x94bf('0x4b')](function(_0x202c69){_0xa835d9['fields'][_0x94bf('0x3e')](_0x202c69);return parseTagParameter(_0xba06b[_0x94bf('0x4c')]);})[_0x94bf('0x4b')](function(_0x31700f){_0xa835d9['tags'][_0x94bf('0x3d')][_0x94bf('0x3e')](_0x31700f);return parseSearchFilter(_0xba06b[_0x94bf('0x4d')]);})['then'](function(_0x2078f6){_0xa835d9[_0x94bf('0x4d')]=_0x2078f6;return _0xa835d9;});}function checkListsRestrictions(_0x589d6e,_0x4ff88a,_0x56a195){var _0xae1fde=squel[_0x94bf('0x20')]();return Promise[_0x94bf('0x4a')]()[_0x94bf('0x4b')](function(){if(_0x4ff88a['search']&&_0x589d6e[_0x94bf('0x5')]==='agent'&&!_0x56a195){return _0x589d6e['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1c59bf){if(_0x1c59bf){if(_0x1c59bf[_0x94bf('0x23')]===0x0){_0xae1fde[_0x94bf('0x3e')]('c.ListId\x20IS\x20NULL');}else{_0xae1fde[_0x94bf('0x3e')]('c.ListId\x20IN\x20?',_['map'](_0x1c59bf,'id'));}}})['then'](function(){return _0xae1fde;});}function buildContactsQuery(_0x5f3bd2,_0x3a5212,_0x1a523b,_0x42acc6,_0x21cb08,_0x969da1){if(_0x3a5212){_0x3a5212=_0x1a523b['attributes'];}_0x5f3bd2=addFieldsToQuery(_0x5f3bd2,_0x3a5212,_0x42acc6,_0x969da1,!![]);var _0x460ddc=squel[_0x94bf('0x4e')]();_0x460ddc=addFieldsToQuery(_0x460ddc,_0x3a5212,_0x42acc6,_0x969da1,![]);if(_0x42acc6||_0x969da1){_0x5f3bd2=applyJoinClauses(_0x5f3bd2,!![]);_0x5f3bd2[_0x94bf('0x4f')](_0x94bf('0x50'));if(_0x1a523b[_0x94bf('0x51')]){_0x460ddc[_0x94bf('0x51')](_0x1a523b[_0x94bf('0x51')]);}if(_0x1a523b[_0x94bf('0x52')]){_0x460ddc['offset'](_0x1a523b['offset']);}}else{_0x460ddc=applyJoinClauses(_0x460ddc,![]);_0x460ddc[_0x94bf('0x4f')](_0x94bf('0x53'));if(_0x1a523b['limit']){_0x5f3bd2[_0x94bf('0x51')](_0x1a523b[_0x94bf('0x51')]);}if(_0x1a523b['offset']){_0x5f3bd2[_0x94bf('0x52')](_0x1a523b[_0x94bf('0x52')]);}}_0x460ddc[_0x94bf('0x54')](_0x21cb08);if(_0x1a523b[_0x94bf('0x55')]){_0x1a523b[_0x94bf('0x55')]['forEach'](function(_0x4a3d37){_0x5f3bd2['order']('c.'+_0x4a3d37[0x0],_0x4a3d37[0x1]===_0x94bf('0x56')?![]:!![]);_0x460ddc[_0x94bf('0x55')](_0x94bf('0x57')+_0x4a3d37[0x0],_0x4a3d37[0x1]==='DESC'?![]:!![]);});}_0x460ddc[_0x94bf('0x8')](_0x5f3bd2,_0x94bf('0xc'));return _0x460ddc;}function getFilteredContacts(_0x4cf4a4){var _0x2fbde9=[];return db[_0x94bf('0x3a')]['findAll']({'attributes':['id',_0x94bf('0x32'),'color'],'raw':!![]})[_0x94bf('0x4b')](function(_0x235dc1){_0x2fbde9=_[_0x94bf('0x58')](_0x235dc1,'id');var _0xd5f6f2={'type':db[_0x94bf('0x59')]['QueryTypes'][_0x94bf('0x5a')],'model':db[_0x94bf('0x5b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x94bf('0x5c')](_0x4cf4a4[_0x94bf('0x5d')](),_0xd5f6f2);})[_0x94bf('0x4b')](function(_0x972dd){_0x972dd[_0x94bf('0x1e')](function(_0x42f3b9){if(_0x42f3b9[_0x94bf('0x1c')]){_0x42f3b9['Tags']=[];_0x42f3b9[_0x94bf('0x1c')][_0x94bf('0x22')](',')[_0x94bf('0x1e')](function(_0x2af013){_0x42f3b9['Tags']['push'](_0x2fbde9[_0x2af013]);});}delete _0x42f3b9[_0x94bf('0x1c')];});return _0x972dd;});}function countFilteredContacts(_0x57d1fa,_0x47ea4a){var _0x3c892a=_0x57d1fa[_0x94bf('0x5e')]();_0x3c892a['field'](_0x94bf('0x5f'));_0x3c892a=applyJoinClauses(_0x3c892a,!![]);_0x57d1fa[_0x94bf('0x4f')](_0x94bf('0x50'));var _0x118207=utils[_0x94bf('0x60')](_0x47ea4a);if(!_[_0x94bf('0x61')](_0x118207)){_0x3c892a[_0x94bf('0xa')]('t.id\x20IN\x20?',_0x118207);}var _0x26a05d={'type':db[_0x94bf('0x59')][_0x94bf('0x62')]['SELECT'],'raw':!![]};return db[_0x94bf('0x63')]['query'](_0x3c892a[_0x94bf('0x5d')](),_0x26a05d)[_0x94bf('0x4b')](function(_0x3364c6){return _0x3364c6[0x0][_0x94bf('0x5f')];});}module[_0x94bf('0x64')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x83ae=['toString','COUNT(*)','squel','../parsers/qs','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','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.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','text','value','start','end','Tag','map','tags','and','ids','User','skip','keys','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','fields','tag','clause','filter','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','subqry.id','order','subqry.','DESC','color','keyBy','Sequelize','QueryTypes','SELECT','sequelize','query','Tags','clone','isEmpty','t.id\x20IN\x20?'];(function(_0x2375dd,_0x414f9e){var _0x3f494b=function(_0x14a35c){while(--_0x14a35c){_0x2375dd['push'](_0x2375dd['shift']());}};_0x3f494b(++_0x414f9e);}(_0x83ae,0x1a2));var _0xe83a=function(_0x5559b3,_0x1fea6f){_0x5559b3=_0x5559b3-0x0;var _0x50e522=_0x83ae[_0x5559b3];return _0x50e522;};'use strict';var _=require('lodash');var squel=require(_0xe83a('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xe83a('0x1'));var utils=require('../interaction/utils');var db=require(_0xe83a('0x2'))['db'];function skipContactsQuery(_0x11eeae,_0x5f1f31){var _0xf846d9=![];if(_0x11eeae[_0xe83a('0x3')]===_0xe83a('0x4')&&!_0x5f1f31[_0xe83a('0x5')]&&!_0x5f1f31[_0xe83a('0x6')]&&_0x5f1f31[_0xe83a('0x7')]!==_0xe83a('0x8')){_0xf846d9=!![];}return _0xf846d9;}function getContactsSubquery(){return squel[_0xe83a('0x9')]()[_0xe83a('0xa')](_0xe83a('0xb'),'c')[_0xe83a('0xc')](_0xe83a('0xd'));}function applyJoinClauses(_0xce5f4c,_0x374401){var _0x343dae=_0x374401?'c':_0xe83a('0xe');_0xce5f4c['left_join'](_0xe83a('0xf'),'uc',_0xe83a('0x10')+_0x343dae+_0xe83a('0x11'))[_0xe83a('0x12')]('cm_contact_has_tags','ct',_0xe83a('0x13')+_0x343dae+_0xe83a('0x11'))[_0xe83a('0x12')]('tools_tags','t',_0xe83a('0x14'));return _0xce5f4c;}function addFieldsToQuery(_0x1758ff,_0x5d71ac,_0x169024,_0x3f171b,_0x398b16){var _0x3cdf56=_0x398b16?'c':'subqry';if(!_0x5d71ac){_0x5d71ac=['id',_0xe83a('0x15'),_0xe83a('0x16'),'phone',_0xe83a('0x17'),'fax',_0xe83a('0x18'),_0xe83a('0x6'),_0xe83a('0x19'),_0xe83a('0x1a'),_0xe83a('0x1b'),_0xe83a('0x1c'),_0xe83a('0x1d')];}else if(!_0x5d71ac[_0xe83a('0x1e')]('id')){_0x5d71ac[_0xe83a('0x1f')]('id');}var _0x80fd6e=_0x169024&&_0x398b16||!_0x169024&&!_0x398b16;if(_0x3f171b){_0x80fd6e=_0x3f171b&&_0x398b16||!_0x3f171b&&!_0x398b16;}_0x5d71ac[_0xe83a('0x20')](function(_0x2b90e5){if(_0x2b90e5===_0xe83a('0x1d')){if(_0x80fd6e){_0x1758ff['field'](_0xe83a('0x21'),_0x2b90e5);}else if(_0x169024||_0x3f171b){_0x1758ff[_0xe83a('0x22')](_0x3cdf56+'.'+_0x2b90e5);}}else{_0x1758ff[_0xe83a('0x22')](_0x3cdf56+'.'+_0x2b90e5);}});return _0x1758ff;}function getSqlClauses(){var _0x2db9b8={'default':squel['expr'](),'fields':squel[_0xe83a('0x23')](),'filter':squel[_0xe83a('0x23')](),'tags':{'clause':squel[_0xe83a('0x23')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x2db9b8;}function parseTagParameter(_0x97f9ba){var _0x83553=squel[_0xe83a('0x23')]();if(_0x97f9ba){var _0x2f6cc4=utils[_0xe83a('0x24')](_0x97f9ba);_0x2f6cc4['forEach'](function(_0x46bf95){_0x83553['or'](_0xe83a('0x25'),'%,'+_0x46bf95+',%');});}return _0x83553;}function parseSearchFilter(_0xd00bb7){var _0x21074f=squel[_0xe83a('0x23')]();if(_0xd00bb7){var _0x4b32a4=_0xd00bb7[_0xe83a('0x26')]('\x5c','\x5c\x5c')[_0xe83a('0x26')](/'/g,'\x27\x27');if(_0x4b32a4[_0xe83a('0x27')]('\x20')[_0xe83a('0x28')]>0x1){_0x21074f['or'](_0xe83a('0x29'),qs[_0xe83a('0x2a')](_0x4b32a4,!![]),null);}else{if(qs['isNumeric'](_0x4b32a4)){_0x21074f['or']('c.id\x20LIKE\x20?',_0x4b32a4+'%');_0x21074f['or'](_0xe83a('0x2b'),_0x4b32a4+'%');_0x21074f['or']('c.mobile\x20LIKE\x20?',_0x4b32a4+'%');_0x21074f['or'](_0xe83a('0x2c'),_0x4b32a4+'%');}else if(qs['isEmail'](_0x4b32a4)){_0x21074f['or'](_0xe83a('0x2d'),_0x4b32a4+'%');}else{_0x21074f['or'](_0xe83a('0x2e'),'%'+_0x4b32a4+'%');_0x21074f['or'](_0xe83a('0x2f'),'%'+_0x4b32a4+'%');_0x21074f['or'](_0xe83a('0x2d'),'%'+_0x4b32a4+'%');}}}return _0x21074f;}function parseAdvancedSearchFilter(_0x35a3af,_0x38f73c){var _0x34bedd=getSqlClauses();var _0x12feab=as[_0xe83a('0x30')](_0x35a3af);var _0x444557=_0x12feab['sqlOperator'];for(var _0x59a37f=0x0;_0x59a37f<_0x12feab[_0xe83a('0x31')][_0xe83a('0x28')];_0x59a37f++){var _0x47583a=_0x12feab[_0xe83a('0x31')][_0x59a37f];var _0x39314b='c';var _0x7fa82c=_['find'](_0x38f73c,[_0xe83a('0x32'),_0x47583a['field']]);if(_0x7fa82c){if(_0x47583a[_0xe83a('0x22')]===_0xe83a('0x33')||_0x7fa82c[_0xe83a('0x34')]===_0xe83a('0x35')){_0x47583a[_0xe83a('0x36')]='DATE';}var _0x3401f7=as[_0xe83a('0x37')](_0x39314b,_0x7fa82c[_0xe83a('0x38')],_0x47583a);_0x34bedd['default'][_0x444557](_0x3401f7[_0xe83a('0x39')],_0x3401f7[_0xe83a('0x3a')][_0xe83a('0x3b')],_0x3401f7['value'][_0xe83a('0x3c')]);}else{if(_0x47583a[_0xe83a('0x22')]===_0xe83a('0x3d')){var _0x48c87c=_0x47583a[_0xe83a('0x3a')][_0xe83a('0x27')](',')[_0xe83a('0x3e')](function(_0x16bdb8){return Number(_0x16bdb8);});var _0x463388=parseTagParameter(_0x48c87c);_0x34bedd[_0xe83a('0x3f')]['clause'][_0xe83a('0x40')](_0x463388);_0x34bedd['tags'][_0xe83a('0x41')]=_0x48c87c;}else if(_0x47583a[_0xe83a('0x22')]===_0xe83a('0x42')){_0x34bedd['user']['clause']['and']('uc.UserId\x20=\x20?',_0x47583a['value']);_0x34bedd['user'][_0xe83a('0x43')]=!![];}}}return _0x34bedd;}function parseModelFields(_0x40a460,_0x86682b){var _0x21cdcf=squel[_0xe83a('0x23')]();var _0x37ff15=_(_0x40a460)[_0xe83a('0x44')]()['map'](function(_0xcd3dde){return _['some'](_0x86682b,[_0xe83a('0x32'),_0xcd3dde])?_0xcd3dde:undefined;})[_0xe83a('0x45')]()['value']();if(_0x40a460[_0xe83a('0x46')]){_0x37ff15[_0xe83a('0x1f')](_0xe83a('0x46'));}if(_0x40a460[_0xe83a('0x42')]){_0x37ff15[_0xe83a('0x1f')](_0xe83a('0x42'));}if(_0x37ff15[_0xe83a('0x28')]>0x0){_0x37ff15[_0xe83a('0x20')](function(_0x17b777){if(_0x17b777==='ListId'){_0x21cdcf[_0xe83a('0x40')](_0xe83a('0x47'),[][_0xe83a('0x48')](_0x40a460[_0x17b777]));}else if(_0x17b777==='Contact'){var _0x2a7503='%'+_0x40a460[_0x17b777]+'%';_0x21cdcf['and'](_0xe83a('0x49'),_0x2a7503);}else if(_0x17b777===_0xe83a('0x42')){_0x21cdcf[_0xe83a('0x40')](_0xe83a('0x4a'),_0x40a460[_0x17b777]);}else{_0x21cdcf[_0xe83a('0x40')]('c.'+_0x17b777+'\x20=\x20?',_0x40a460[_0x17b777]);}});}return _0x21cdcf;}function parseQueryParameters(_0x45f771,_0x1c0583){var _0x13454c=getSqlClauses();return Promise[_0xe83a('0x4b')]()[_0xe83a('0x4c')](function(){return parseModelFields(_0x45f771,_0x1c0583);})[_0xe83a('0x4c')](function(_0x4184a6){_0x13454c[_0xe83a('0x4d')][_0xe83a('0x40')](_0x4184a6);return parseTagParameter(_0x45f771[_0xe83a('0x4e')]);})[_0xe83a('0x4c')](function(_0x325a3a){_0x13454c[_0xe83a('0x3f')][_0xe83a('0x4f')]['and'](_0x325a3a);return parseSearchFilter(_0x45f771[_0xe83a('0x50')]);})[_0xe83a('0x4c')](function(_0x5b20e5){_0x13454c[_0xe83a('0x50')]=_0x5b20e5;return _0x13454c;});}function checkListsRestrictions(_0x5299ec,_0x430bb1,_0x431658){var _0x2d8c0e=squel[_0xe83a('0x23')]();return Promise[_0xe83a('0x4b')]()['then'](function(){if(_0x430bb1[_0xe83a('0x5')]&&_0x5299ec['role']==='agent'&&!_0x431658){return _0x5299ec['getLists']({'attributes':['id'],'raw':!![]});}})[_0xe83a('0x4c')](function(_0x4cf14d){if(_0x4cf14d){if(_0x4cf14d[_0xe83a('0x28')]===0x0){_0x2d8c0e['and'](_0xe83a('0x51'));}else{_0x2d8c0e[_0xe83a('0x40')](_0xe83a('0x47'),_['map'](_0x4cf14d,'id'));}}})[_0xe83a('0x4c')](function(){return _0x2d8c0e;});}function buildContactsQuery(_0x4abd00,_0x3364a3,_0x55d13e,_0x596fc5,_0x594582,_0x226234){if(_0x3364a3){_0x3364a3=_0x55d13e[_0xe83a('0x52')];}_0x4abd00=addFieldsToQuery(_0x4abd00,_0x3364a3,_0x596fc5,_0x226234,!![]);var _0x468054=squel[_0xe83a('0x9')]();_0x468054=addFieldsToQuery(_0x468054,_0x3364a3,_0x596fc5,_0x226234,![]);if(_0x596fc5||_0x226234){_0x4abd00=applyJoinClauses(_0x4abd00,!![]);_0x4abd00['group'](_0xe83a('0x53'));if(_0x55d13e[_0xe83a('0x54')]){_0x468054[_0xe83a('0x54')](_0x55d13e[_0xe83a('0x54')]);}if(_0x55d13e[_0xe83a('0x55')]){_0x468054[_0xe83a('0x55')](_0x55d13e['offset']);}}else{_0x468054=applyJoinClauses(_0x468054,![]);_0x468054[_0xe83a('0x56')](_0xe83a('0x57'));if(_0x55d13e['limit']){_0x4abd00[_0xe83a('0x54')](_0x55d13e['limit']);}if(_0x55d13e[_0xe83a('0x55')]){_0x4abd00['offset'](_0x55d13e[_0xe83a('0x55')]);}}_0x468054['having'](_0x594582);if(_0x55d13e[_0xe83a('0x58')]){_0x55d13e['order']['forEach'](function(_0x370a35){_0x4abd00['order']('c.'+_0x370a35[0x0],_0x370a35[0x1]==='DESC'?![]:!![]);_0x468054[_0xe83a('0x58')](_0xe83a('0x59')+_0x370a35[0x0],_0x370a35[0x1]===_0xe83a('0x5a')?![]:!![]);});}_0x468054[_0xe83a('0xa')](_0x4abd00,_0xe83a('0xe'));return _0x468054;}function getFilteredContacts(_0x383790){var _0x5413f2=[];return db[_0xe83a('0x3d')]['findAll']({'attributes':['id',_0xe83a('0x32'),_0xe83a('0x5b')],'raw':!![]})['then'](function(_0x2dafd5){_0x5413f2=_[_0xe83a('0x5c')](_0x2dafd5,'id');var _0x5d45b1={'type':db[_0xe83a('0x5d')][_0xe83a('0x5e')][_0xe83a('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xe83a('0x60')][_0xe83a('0x61')](_0x383790['toString'](),_0x5d45b1);})[_0xe83a('0x4c')](function(_0x515bc6){_0x515bc6[_0xe83a('0x20')](function(_0x338788){if(_0x338788[_0xe83a('0x1d')]){_0x338788['Tags']=[];_0x338788[_0xe83a('0x1d')][_0xe83a('0x27')](',')['forEach'](function(_0x3b8098){_0x338788[_0xe83a('0x62')][_0xe83a('0x1f')](_0x5413f2[_0x3b8098]);});}delete _0x338788[_0xe83a('0x1d')];});return _0x515bc6;});}function countFilteredContacts(_0x4deacf,_0xe134b0){var _0x207e0e=_0x4deacf[_0xe83a('0x63')]();_0x207e0e[_0xe83a('0x22')]('COUNT(*)');_0x207e0e=applyJoinClauses(_0x207e0e,!![]);_0x4deacf['group'](_0xe83a('0x53'));var _0x39e7f3=utils[_0xe83a('0x24')](_0xe134b0);if(!_[_0xe83a('0x64')](_0x39e7f3)){_0x207e0e[_0xe83a('0xc')](_0xe83a('0x65'),_0x39e7f3);}var _0x530f94={'type':db[_0xe83a('0x5d')][_0xe83a('0x5e')][_0xe83a('0x5f')],'raw':!![]};return db[_0xe83a('0x60')][_0xe83a('0x61')](_0x207e0e[_0xe83a('0x66')](),_0x530f94)['then'](function(_0x2eb134){return _0x2eb134[0x0][_0xe83a('0x67')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 421b360..527597c 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 _0x64f6=['close','unlink','decryptFile','createDecipher','final','encryptString','secret','createCipher','utf8','base64','crypto','bluebird','lodash','../../config/environment','app','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end'];(function(_0x2e1821,_0x51f1be){var _0x53188c=function(_0x4fc2c6){while(--_0x4fc2c6){_0x2e1821['push'](_0x2e1821['shift']());}};_0x53188c(++_0x51f1be);}(_0x64f6,0x67));var _0x664f=function(_0x39d518,_0x32b600){_0x39d518=_0x39d518-0x0;var _0x2feade=_0x64f6[_0x39d518];return _0x2feade;};'use strict';var crypto=require(_0x664f('0x0'));var fs=require('fs');var BPromise=require(_0x664f('0x1'));var _=require(_0x664f('0x2'));var config=require(_0x664f('0x3'));var logger=require('../../config/logger')(_0x664f('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x664f('0x5')};if(config[_0x664f('0x6')]&&config[_0x664f('0x6')][_0x664f('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x664f('0x6')][_0x664f('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x664f('0x6')]['algorithm'],_0x664f('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x1644b6){return AES_SUPPORTED_RX[_0x664f('0x9')](_0x1644b6);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x664f('0xa')](isASupportedCipher);}function isAlgorithmSupported(_0x46f271){return getSupportedCiphers()[_0x664f('0xb')](_0x46f271)>-0x1;}function combineOptions(_0x35a284){var _0x9b555a={};for(var _0x462233 in fileOptions){if(fileOptions[_0x664f('0xc')](_0x462233)){_0x9b555a[_0x462233]=fileOptions[_0x462233];}}if(_0x35a284){for(var _0x1ee648 in _0x35a284){if(_0x35a284[_0x664f('0xc')](_0x1ee648)){_0x9b555a[_0x1ee648]=_0x35a284[_0x1ee648];}}}return _0x9b555a;}exports[_0x664f('0xd')]=function(_0x3d06f2,_0x203b24,_0x439f50,_0x56622d){return new BPromise(function(_0x214a06,_0x105dad){_0x56622d=combineOptions(_0x56622d);var _0x1fd017=new Buffer(_0x439f50);var _0x2ffd74=fs[_0x664f('0xe')](_0x3d06f2);var _0x2d528f=fs[_0x664f('0xf')](_0x203b24);var _0xf76c05=crypto['createCipher'](_0x56622d[_0x664f('0x7')],_0x1fd017);_0x2ffd74['on'](_0x664f('0x10'),function(_0x30b5fe){var _0x44408f=new Buffer(_0xf76c05[_0x664f('0x11')](_0x30b5fe),_0x664f('0x12'));_0x2d528f['write'](_0x44408f);});_0x2ffd74['on']('end',function(){try{var _0x14cdae=new Buffer(_0xf76c05['final'](_0x664f('0x12')),_0x664f('0x12'));_0x2d528f[_0x664f('0x13')](_0x14cdae);_0x2d528f[_0x664f('0x14')]();_0x2d528f['on'](_0x664f('0x15'),function(){return _0x214a06(_0x203b24);});}catch(_0x4ff2f4){fs[_0x664f('0x16')](_0x203b24);return _0x105dad(_0x4ff2f4);}});});};exports[_0x664f('0x17')]=function(_0x4ed0f8,_0x50d606,_0x38c357,_0x387455){return new BPromise(function(_0x5cd536,_0x43a724){_0x387455=combineOptions(_0x387455);var _0x18c4a6=new Buffer(_0x38c357);var _0x17e1ed=fs[_0x664f('0xe')](_0x4ed0f8);var _0x8654e8=fs['createWriteStream'](_0x50d606);var _0x19ebe0=crypto[_0x664f('0x18')](_0x387455[_0x664f('0x7')],_0x18c4a6);_0x17e1ed['on'](_0x664f('0x10'),function(_0x50162a){var _0x51169f=new Buffer(_0x19ebe0[_0x664f('0x11')](_0x50162a),'binary');_0x8654e8[_0x664f('0x13')](_0x51169f);});_0x17e1ed['on'](_0x664f('0x14'),function(){try{var _0x1c98fc=new Buffer(_0x19ebe0[_0x664f('0x19')](_0x664f('0x12')),_0x664f('0x12'));_0x8654e8[_0x664f('0x13')](_0x1c98fc);_0x8654e8[_0x664f('0x14')]();_0x8654e8['on'](_0x664f('0x15'),function(){return _0x5cd536(_0x50d606);});}catch(_0x13a48c){fs[_0x664f('0x16')](_0x50d606);return _0x43a724(_0x13a48c);}});});};exports[_0x664f('0x1a')]=function(_0x71c2e8,_0x354a54,_0x196100){var _0x4a5703=_0x196100||stringOptions[_0x664f('0x7')];var _0x45b688=_0x354a54||stringOptions[_0x664f('0x1b')];var _0x355865=crypto[_0x664f('0x1c')](_0x4a5703,_0x45b688);var _0x15b711=_0x355865['update'](_0x71c2e8,_0x664f('0x1d'),_0x664f('0x1e'));_0x15b711+=_0x355865[_0x664f('0x19')](_0x664f('0x1e'));return _0x15b711;};exports['decryptString']=function(_0x9f24ed,_0x116d0f,_0x167523){var _0x380d20=_0x167523||stringOptions[_0x664f('0x7')];var _0x557421=_0x116d0f||stringOptions[_0x664f('0x1b')];var _0x3d8514=crypto[_0x664f('0x18')](_0x380d20,_0x557421);var _0x46f455=_0x3d8514[_0x664f('0x11')](_0x9f24ed,_0x664f('0x1e'),_0x664f('0x1d'));_0x46f455+=_0x3d8514[_0x664f('0x19')](_0x664f('0x1d'));return _0x46f455;}; \ No newline at end of file +var _0xeaf9=['createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString','secret','base64','utf8','crypto','lodash','../../config/environment','../../config/logger','app','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeaf9,0xd7));var _0x9eaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeaf9[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x9eaf('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x9eaf('0x1'));var config=require(_0x9eaf('0x2'));var logger=require(_0x9eaf('0x3'))(_0x9eaf('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x9eaf('0x5')};const fileOptions={'algorithm':_0x9eaf('0x6')};if(config[_0x9eaf('0x7')]&&config[_0x9eaf('0x7')][_0x9eaf('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x9eaf('0x7')][_0x9eaf('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x9eaf('0x9')](',\x20');logger['error'](config[_0x9eaf('0x7')][_0x9eaf('0x8')],_0x9eaf('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x541237){return AES_SUPPORTED_RX[_0x9eaf('0xb')](_0x541237);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x9eaf('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x3882b5){return getSupportedCiphers()[_0x9eaf('0xd')](_0x3882b5)>-0x1;}function combineOptions(_0x5abe8f){var _0x1e9dc5={};for(var _0x88ed73 in fileOptions){if(fileOptions[_0x9eaf('0xe')](_0x88ed73)){_0x1e9dc5[_0x88ed73]=fileOptions[_0x88ed73];}}if(_0x5abe8f){for(var _0x13d91c in _0x5abe8f){if(_0x5abe8f[_0x9eaf('0xe')](_0x13d91c)){_0x1e9dc5[_0x13d91c]=_0x5abe8f[_0x13d91c];}}}return _0x1e9dc5;}exports[_0x9eaf('0xf')]=function(_0x4b8d32,_0x257b80,_0x3cc502,_0x1f068d){return new BPromise(function(_0xcae87c,_0x2e5412){_0x1f068d=combineOptions(_0x1f068d);var _0x26d09d=new Buffer(_0x3cc502);var _0xcf9065=fs[_0x9eaf('0x10')](_0x4b8d32);var _0x1161cf=fs[_0x9eaf('0x11')](_0x257b80);var _0x4ce7e9=crypto[_0x9eaf('0x12')](_0x1f068d[_0x9eaf('0x8')],_0x26d09d);_0xcf9065['on'](_0x9eaf('0x13'),function(_0x4dfd07){var _0x32f0ef=new Buffer(_0x4ce7e9[_0x9eaf('0x14')](_0x4dfd07),_0x9eaf('0x15'));_0x1161cf[_0x9eaf('0x16')](_0x32f0ef);});_0xcf9065['on'](_0x9eaf('0x17'),function(){try{var _0x476597=new Buffer(_0x4ce7e9[_0x9eaf('0x18')](_0x9eaf('0x15')),_0x9eaf('0x15'));_0x1161cf['write'](_0x476597);_0x1161cf[_0x9eaf('0x17')]();_0x1161cf['on'](_0x9eaf('0x19'),function(){return _0xcae87c(_0x257b80);});}catch(_0x54e7a8){fs[_0x9eaf('0x1a')](_0x257b80);return _0x2e5412(_0x54e7a8);}});});};exports[_0x9eaf('0x1b')]=function(_0x4be1d1,_0x18581f,_0xea17e5,_0x9dbdd9){return new BPromise(function(_0x5799eb,_0x35f1da){_0x9dbdd9=combineOptions(_0x9dbdd9);var _0x1a625c=new Buffer(_0xea17e5);var _0x1458c9=fs[_0x9eaf('0x10')](_0x4be1d1);var _0x2446a0=fs[_0x9eaf('0x11')](_0x18581f);var _0x1ef650=crypto[_0x9eaf('0x1c')](_0x9dbdd9[_0x9eaf('0x8')],_0x1a625c);_0x1458c9['on'](_0x9eaf('0x13'),function(_0x1fc5e5){var _0x45cf6b=new Buffer(_0x1ef650[_0x9eaf('0x14')](_0x1fc5e5),_0x9eaf('0x15'));_0x2446a0[_0x9eaf('0x16')](_0x45cf6b);});_0x1458c9['on'](_0x9eaf('0x17'),function(){try{var _0x43d9cd=new Buffer(_0x1ef650['final'](_0x9eaf('0x15')),_0x9eaf('0x15'));_0x2446a0[_0x9eaf('0x16')](_0x43d9cd);_0x2446a0[_0x9eaf('0x17')]();_0x2446a0['on']('close',function(){return _0x5799eb(_0x18581f);});}catch(_0x2fd590){fs[_0x9eaf('0x1a')](_0x18581f);return _0x35f1da(_0x2fd590);}});});};exports[_0x9eaf('0x1d')]=function(_0x21766c,_0x3b2d87,_0x3e582c){var _0x1c934c=_0x3e582c||stringOptions[_0x9eaf('0x8')];var _0x26a10d=_0x3b2d87||stringOptions[_0x9eaf('0x1e')];var _0x76253e=crypto[_0x9eaf('0x12')](_0x1c934c,_0x26a10d);var _0x539880=_0x76253e[_0x9eaf('0x14')](_0x21766c,'utf8',_0x9eaf('0x1f'));_0x539880+=_0x76253e[_0x9eaf('0x18')]('base64');return _0x539880;};exports['decryptString']=function(_0x21001c,_0x2a5920,_0x3acdb3){var _0x1b8b98=_0x3acdb3||stringOptions['algorithm'];var _0x571833=_0x2a5920||stringOptions[_0x9eaf('0x1e')];var _0xa65cca=crypto[_0x9eaf('0x1c')](_0x1b8b98,_0x571833);var _0x4d059d=_0xa65cca[_0x9eaf('0x14')](_0x21001c,_0x9eaf('0x1f'),_0x9eaf('0x20'));_0x4d059d+=_0xa65cca[_0x9eaf('0x18')]('utf8');return _0x4d059d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 92fa56e..796eb84 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 _0xce48=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','length','num','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','.csv','split','join','mkdirSync','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize'];(function(_0x14546a,_0x42ffd3){var _0x4a693d=function(_0x35145e){while(--_0x35145e){_0x14546a['push'](_0x14546a['shift']());}};_0x4a693d(++_0x42ffd3);}(_0xce48,0x73));var _0x8ce4=function(_0x3f22e8,_0x37732a){_0x3f22e8=_0x3f22e8-0x0;var _0x368a7e=_0xce48[_0x3f22e8];return _0x368a7e;};'use strict';var util=require(_0x8ce4('0x0'));var path=require('path');var _=require(_0x8ce4('0x1'));var csv=require(_0x8ce4('0x2'));var fs=require('fs');var BPromise=require(_0x8ce4('0x3'));var zipdir=require(_0x8ce4('0x4'));var rimraf=require('rimraf');var db=require(_0x8ce4('0x5'))['db'];var dbH=require('../../mysqldb')[_0x8ce4('0x6')];var logger=require(_0x8ce4('0x7'))(_0x8ce4('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x8ce4('0x9')][0x2]);var QUERY=process[_0x8ce4('0x9')][0x3];var PATH=process[_0x8ce4('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x35c52d,_0x2c1778){var _0x22043b={'status':_0x35c52d};var _0x2890ae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c1778){_0x22043b[_0x8ce4('0xa')]=_0x2c1778;}return db[_0x8ce4('0xb')][_0x8ce4('0xc')](_0x22043b,_0x2890ae);}function main(){var _0x308ae1=0x1388;var _0xd3ba1e;logger[_0x8ce4('0xd')](util['format'](_0x8ce4('0xe'),EXTRACTED_REPORT_ID,_0x8ce4('0xf')));return db['Setting'][_0x8ce4('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8ce4('0x11')]})[_0x8ce4('0x12')](function(_0x3d17b3){if(_0x3d17b3){_0xd3ba1e=_0x3d17b3;_0x308ae1=_0xd3ba1e[_0x8ce4('0x11')]||0x1388;}})[_0x8ce4('0x12')](function(){return dbH[_0x8ce4('0x13')][_0x8ce4('0x14')](util['format'](_0x8ce4('0x15'),QUERY),{'type':dbH[_0x8ce4('0x13')][_0x8ce4('0x16')]['SELECT']});})[_0x8ce4('0x12')](function(_0x45dab9){if(!_0x45dab9[0x0]['num']){return analyticExtractedReport('Empty');}var _0x4d3c0a=[];var _0x5ab0c3=0x0;if(_0xd3ba1e['split']){if(_0x45dab9&&_0x45dab9[_0x8ce4('0x17')]){var _0x508cf8=_['range'](_0x45dab9[0x0][_0x8ce4('0x18')]/_0x308ae1);var _0x28c93a=Number['isInteger'](_0x45dab9[0x0][_0x8ce4('0x18')]/_0x308ae1)?_0x45dab9[0x0]['num']%_0x308ae1:0x0;_0x508cf8['forEach'](function(_0x2c63a2){if(_0x2c63a2>0x0){_0x5ab0c3+=_0x308ae1;}_0x4d3c0a['push'](dbH[_0x8ce4('0x13')][_0x8ce4('0x14')](util[_0x8ce4('0x19')](_0x8ce4('0x1a'),QUERY,_0x308ae1,_0x5ab0c3),{'type':dbH[_0x8ce4('0x13')]['QueryTypes'][_0x8ce4('0x1b')]}));});if(_0x28c93a>0x0){_0x5ab0c3+=_0x308ae1;_0x4d3c0a[_0x8ce4('0x1c')](dbH[_0x8ce4('0x13')][_0x8ce4('0x14')](util[_0x8ce4('0x19')](_0x8ce4('0x1a'),QUERY,_0x28c93a,_0x5ab0c3),{'type':dbH[_0x8ce4('0x13')][_0x8ce4('0x16')]['SELECT']}));}}}else{_0x4d3c0a[_0x8ce4('0x1c')](dbH[_0x8ce4('0x13')][_0x8ce4('0x14')](QUERY,{'type':dbH[_0x8ce4('0x13')]['QueryTypes'][_0x8ce4('0x1b')]}));}var _0x9355ef=path['dirname'](PATH);var _0x72ca66=path['basename'](PATH,_0x8ce4('0x1d'));var _0x9c3bcb=_0xd3ba1e[_0x8ce4('0x1e')]&&_0x4d3c0a[_0x8ce4('0x17')]>0x1;var _0x45e48e=[];if(!fs['existsSync'](path[_0x8ce4('0x1f')](_0x9355ef,_0x72ca66))&&_0x9c3bcb){fs[_0x8ce4('0x20')](path[_0x8ce4('0x1f')](_0x9355ef,_0x72ca66));}return BPromise['each'](_0x4d3c0a,function(_0x5f2170){_0x45e48e[_0x8ce4('0x1c')](_0x5f2170);})[_0x8ce4('0x12')](function(){for(var _0x3604ff=0x0;_0x3604ff<_0x45e48e[_0x8ce4('0x17')];_0x3604ff+=0x1){var _0xdf80ab;var _0x22ba82=_0x45e48e[_0x3604ff];if(_0x9c3bcb){_0xdf80ab=path['join'](_0x9355ef,_0x72ca66,util[_0x8ce4('0x19')]('%s%d.%s',_0x72ca66,_0x3604ff,_0x8ce4('0x21')));}else{_0xdf80ab=path[_0x8ce4('0x1f')](_0x9355ef,util[_0x8ce4('0x19')](_0x8ce4('0x22'),_0x72ca66,_0x8ce4('0x21')));}fs[_0x8ce4('0x23')](_0xdf80ab,csv(_0x22ba82));}})[_0x8ce4('0x12')](function(){if(_0x9c3bcb){return new Promise(function(_0x857a67){zipdir(path['join'](_0x9355ef,_0x72ca66),{'saveTo':path[_0x8ce4('0x1f')](_0x9355ef,util[_0x8ce4('0x19')](_0x8ce4('0x22'),_0x72ca66,_0x8ce4('0x24')))},function(_0x547078,_0x17d7aa){rimraf(path['join'](_0x9355ef,_0x72ca66),function(){});_0x857a67(_0x8ce4('0x25'));});});}})[_0x8ce4('0x12')](function(){logger[_0x8ce4('0xd')](util[_0x8ce4('0x19')](_0x8ce4('0x26'),EXTRACTED_REPORT_ID,_0x8ce4('0xf')));return analyticExtractedReport(_0x8ce4('0x27'),_0x9c3bcb?util[_0x8ce4('0x19')](_0x8ce4('0x22'),_0x72ca66,_0x9c3bcb?_0x8ce4('0x24'):'csv'):null);});})[_0x8ce4('0x28')](function(_0x387d91){logger['info'](util[_0x8ce4('0x19')](_0x8ce4('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x387d91,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8ce4('0x2a'));})[_0x8ce4('0x2b')](function(){process[_0x8ce4('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe072=['num','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','info','CSV','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT'];(function(_0x43c7c9,_0x2fe600){var _0x303f38=function(_0xee16e1){while(--_0xee16e1){_0x43c7c9['push'](_0x43c7c9['shift']());}};_0x303f38(++_0x2fe600);}(_0xe072,0x14b));var _0x2e07=function(_0x126ff6,_0x55acb4){_0x126ff6=_0x126ff6-0x0;var _0x5b9762=_0xe072[_0x126ff6];return _0x5b9762;};'use strict';var util=require(_0x2e07('0x0'));var path=require('path');var _=require(_0x2e07('0x1'));var csv=require(_0x2e07('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x2e07('0x3'));var rimraf=require(_0x2e07('0x4'));var db=require(_0x2e07('0x5'))['db'];var dbH=require(_0x2e07('0x5'))[_0x2e07('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2e07('0x7')][0x2]);var QUERY=process[_0x2e07('0x7')][0x3];var PATH=process[_0x2e07('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b8da6,_0x252be5){var _0x52fb12={'status':_0x2b8da6};var _0x3d95aa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x252be5){_0x52fb12[_0x2e07('0x8')]=_0x252be5;}return db[_0x2e07('0x9')][_0x2e07('0xa')](_0x52fb12,_0x3d95aa);}function main(){var _0x23d21c=0x1388;var _0x4e4be7;logger['info'](util[_0x2e07('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x2e07('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2e07('0xd'),_0x2e07('0xe')]})['then'](function(_0x133702){if(_0x133702){_0x4e4be7=_0x133702;_0x23d21c=_0x4e4be7[_0x2e07('0xe')]||0x1388;}})[_0x2e07('0xf')](function(){return dbH[_0x2e07('0x10')][_0x2e07('0x11')](util[_0x2e07('0xb')](_0x2e07('0x12'),QUERY),{'type':dbH[_0x2e07('0x10')][_0x2e07('0x13')][_0x2e07('0x14')]});})['then'](function(_0x37d11f){if(!_0x37d11f[0x0][_0x2e07('0x15')]){return analyticExtractedReport('Empty');}var _0x38f73a=[];var _0x57e24b=0x0;if(_0x4e4be7['split']){if(_0x37d11f&&_0x37d11f[_0x2e07('0x16')]){var _0x59e0a4=_[_0x2e07('0x17')](_0x37d11f[0x0][_0x2e07('0x15')]/_0x23d21c);var _0x4f5b05=Number['isInteger'](_0x37d11f[0x0][_0x2e07('0x15')]/_0x23d21c)?_0x37d11f[0x0]['num']%_0x23d21c:0x0;_0x59e0a4['forEach'](function(_0x26d9e4){if(_0x26d9e4>0x0){_0x57e24b+=_0x23d21c;}_0x38f73a[_0x2e07('0x18')](dbH[_0x2e07('0x10')][_0x2e07('0x11')](util[_0x2e07('0xb')](_0x2e07('0x19'),QUERY,_0x23d21c,_0x57e24b),{'type':dbH['sequelize'][_0x2e07('0x13')][_0x2e07('0x14')]}));});if(_0x4f5b05>0x0){_0x57e24b+=_0x23d21c;_0x38f73a['push'](dbH[_0x2e07('0x10')][_0x2e07('0x11')](util[_0x2e07('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f5b05,_0x57e24b),{'type':dbH['sequelize'][_0x2e07('0x13')][_0x2e07('0x14')]}));}}}else{_0x38f73a[_0x2e07('0x18')](dbH['sequelize'][_0x2e07('0x11')](QUERY,{'type':dbH[_0x2e07('0x10')][_0x2e07('0x13')]['SELECT']}));}var _0x4b2730=path['dirname'](PATH);var _0x162cfc=path[_0x2e07('0x1a')](PATH,_0x2e07('0x1b'));var _0xf36274=_0x4e4be7['split']&&_0x38f73a['length']>0x1;var _0x41c0b9=[];if(!fs[_0x2e07('0x1c')](path[_0x2e07('0x1d')](_0x4b2730,_0x162cfc))&&_0xf36274){fs[_0x2e07('0x1e')](path[_0x2e07('0x1d')](_0x4b2730,_0x162cfc));}return BPromise[_0x2e07('0x1f')](_0x38f73a,function(_0x2b5bdb){_0x41c0b9[_0x2e07('0x18')](_0x2b5bdb);})['then'](function(){for(var _0x231462=0x0;_0x231462<_0x41c0b9[_0x2e07('0x16')];_0x231462+=0x1){var _0x534c51;var _0x1be28e=_0x41c0b9[_0x231462];if(_0xf36274){_0x534c51=path[_0x2e07('0x1d')](_0x4b2730,_0x162cfc,util[_0x2e07('0xb')](_0x2e07('0x20'),_0x162cfc,_0x231462,_0x2e07('0x21')));}else{_0x534c51=path['join'](_0x4b2730,util[_0x2e07('0xb')](_0x2e07('0x22'),_0x162cfc,_0x2e07('0x21')));}fs[_0x2e07('0x23')](_0x534c51,csv(_0x1be28e));}})[_0x2e07('0xf')](function(){if(_0xf36274){return new Promise(function(_0x3703ef){zipdir(path[_0x2e07('0x1d')](_0x4b2730,_0x162cfc),{'saveTo':path[_0x2e07('0x1d')](_0x4b2730,util[_0x2e07('0xb')](_0x2e07('0x22'),_0x162cfc,'zip'))},function(_0x287799,_0x3f8650){rimraf(path['join'](_0x4b2730,_0x162cfc),function(){});_0x3703ef(_0x2e07('0x24'));});});}})[_0x2e07('0xf')](function(){logger[_0x2e07('0x25')](util[_0x2e07('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2e07('0x26')));return analyticExtractedReport('Completed',_0xf36274?util[_0x2e07('0xb')](_0x2e07('0x22'),_0x162cfc,_0xf36274?_0x2e07('0x27'):_0x2e07('0x21')):null);});})[_0x2e07('0x28')](function(_0x1365e1){logger[_0x2e07('0x25')](util[_0x2e07('0xb')](_0x2e07('0x29'),EXTRACTED_REPORT_ID,_0x2e07('0x26')),util['inspect'](_0x1365e1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2e07('0x2a'));})[_0x2e07('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ed4ff50..c133cc1 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 _0xafbd=['pdf','%s.%s','all','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','zip-dir','JSDOM','window','bluebird','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','body','push','chunk','format','name','startDate','endDate','header','pageBreak','before','margin','landscape','footer','Arial','black','Empty','Setting','find','then','splitSizePdf','split','range','num','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s'];(function(_0x37bb0e,_0x593f9a){var _0x5b5847=function(_0x1a6f3e){while(--_0x1a6f3e){_0x37bb0e['push'](_0x37bb0e['shift']());}};_0x5b5847(++_0x593f9a);}(_0xafbd,0xda));var _0xdafb=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xafbd[_0x86b219];return _0x1f320c;};'use strict';var _=require(_0xdafb('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xdafb('0x1'));var moment=require(_0xdafb('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xdafb('0x3'));var zipdir=require(_0xdafb('0x4'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xdafb('0x5')];var window=new JSDOM('')[_0xdafb('0x6')];var BPromise=require(_0xdafb('0x7'));var db=require(_0xdafb('0x8'))['db'];var dbH=require(_0xdafb('0x8'))['dbH'];var logger=require(_0xdafb('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdafb('0xa')][0x2]);var QUERY=process[_0xdafb('0xa')][0x3];var PATH=process[_0xdafb('0xa')][0x4];var NAME=process[_0xdafb('0xa')][0x5];var FORMAT=_0xdafb('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x35feac,_0x1caadf){var _0x550324={'status':_0x35feac};var _0x13aa15={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1caadf){_0x550324[_0xdafb('0xc')]=_0x1caadf;}return db[_0xdafb('0xd')][_0xdafb('0xe')](_0x550324,_0x13aa15);}function getHeaders(_0x5b2ccf){return _[_0xdafb('0xf')](_0x5b2ccf,function(_0x28a1cd){return{'text':_0x28a1cd,'style':_0xdafb('0x10')};});}function getRows(_0x588767,_0x382e32){return _[_0xdafb('0xf')](_0x382e32,function(_0x5a75dd){return _(_0x5a75dd)['pick'](_0x588767)[_0xdafb('0xf')](function(_0x28c9b4){return _0x28c9b4?_[_0xdafb('0x11')](_0x28c9b4):'';})[_0xdafb('0x12')]();});}function createTable(_0x4acad8,_0x296d0b){var _0x414465={'widths':_[_0xdafb('0x13')](Array(_0x4acad8[_0xdafb('0x14')]),0x91),'heights':function(_0x54989e){return _0x54989e===0x0?_0xdafb('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1a4c50=getHeaders(_0x4acad8);_0x414465[_0xdafb('0x16')][_0xdafb('0x17')](_0x1a4c50);var _0x30cce8=getRows(_0x4acad8,_0x296d0b);_0x414465[_0xdafb('0x16')]=_0x414465[_0xdafb('0x16')]['concat'](_0x30cce8);return _0x414465;}function createTables(_0x198c5d){var _0x4dc01f=[];var _0x4f5a52=_[_0xdafb('0x18')](Object['keys'](_0x198c5d[0x0]),0x5);_0x4f5a52['forEach'](function(_0x3d3c82){_0x4dc01f['push'](createTable(_0x3d3c82,_0x198c5d));});return _0x4dc01f;}function getPDFDocDefinition(_0x315dc1){var _0x23c38b=util[_0xdafb('0x19')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xdafb('0x1a')],moment(EXTRACTED_REPORT[_0xdafb('0x1b')])[_0xdafb('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xdafb('0x1c')])[_0xdafb('0x19')](FORMAT));var _0x52abe9=[];for(var _0x1c750c=0x0;_0x1c750c<_0x315dc1[_0xdafb('0x14')];_0x1c750c++){var _0x3abaa2=[];if(_0x1c750c===0x0){_0x3abaa2['push']({'text':_0x23c38b,'style':_0xdafb('0x1d')});}var _0x503b5b={'table':_0x315dc1[_0x1c750c]};if(_0x1c750c>0x0){_0x503b5b[_0xdafb('0x1e')]=_0xdafb('0x1f');_0x503b5b[_0xdafb('0x20')]=[0x0,0x46,0x0,0x0];}_0x3abaa2[_0xdafb('0x17')](_0x503b5b);_0x52abe9[_0xdafb('0x17')](_0x3abaa2);}return{'pageSize':'A4','pageOrientation':_0xdafb('0x21'),'content':_0x52abe9,'footer':function(_0x3c4560,_0x5c31c2){return{'text':_0x3c4560['toString']()+'\x20/\x20'+_0x5c31c2,'style':_0xdafb('0x22')};},'defaultStyle':{'font':_0xdafb('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xdafb('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x145001){var _0x127db3=0x1388;var _0x46c08a;if(!_0x145001[0x0]['num']){return analyticExtractedReport(_0xdafb('0x25'));}return db[_0xdafb('0x26')][_0xdafb('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0xdafb('0x28')](function(_0x1a24c6){if(_0x1a24c6){_0x46c08a=_0x1a24c6;_0x127db3=_0x46c08a[_0xdafb('0x29')]||0x3e8;}})['then'](function(){var _0x269763=[];var _0x27a8d6=0x0;if(_0x46c08a[_0xdafb('0x2a')]){if(_0x145001&&_0x145001['length']){var _0x4d46a7=_[_0xdafb('0x2b')](_0x145001[0x0][_0xdafb('0x2c')]/_0x127db3);var _0x1d7c38=Number[_0xdafb('0x2d')](_0x145001[0x0][_0xdafb('0x2c')]/_0x127db3)?_0x145001[0x0][_0xdafb('0x2c')]%_0x127db3:0x0;_0x4d46a7[_0xdafb('0x2e')](function(_0x3742d9){if(_0x3742d9>0x0){_0x27a8d6+=_0x127db3;}_0x269763[_0xdafb('0x17')](dbH[_0xdafb('0x2f')][_0xdafb('0x30')](util[_0xdafb('0x19')](_0xdafb('0x31'),QUERY,_0x127db3,_0x27a8d6),{'type':dbH['sequelize'][_0xdafb('0x32')][_0xdafb('0x33')]}));});if(_0x1d7c38>0x0){_0x27a8d6+=_0x127db3;_0x269763['push'](dbH[_0xdafb('0x2f')][_0xdafb('0x30')](util[_0xdafb('0x19')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1d7c38,_0x27a8d6),{'type':dbH[_0xdafb('0x2f')]['QueryTypes'][_0xdafb('0x33')]}));}}}else{_0x269763[_0xdafb('0x17')](dbH[_0xdafb('0x2f')]['query'](QUERY,{'type':dbH['sequelize'][_0xdafb('0x32')][_0xdafb('0x33')]}));}var _0x2b30d8=path[_0xdafb('0x34')](PATH);var _0x29b25a=path['basename'](PATH,_0xdafb('0x35'));var _0x51391d=_0x46c08a['split']&&_0x269763['length']>0x1;var _0x2e3f55=[];if(!fs[_0xdafb('0x36')](path[_0xdafb('0x37')](_0x2b30d8,_0x29b25a))&&_0x51391d){fs[_0xdafb('0x38')](path[_0xdafb('0x37')](_0x2b30d8,_0x29b25a));}return BPromise[_0xdafb('0x39')](_0x269763,function(_0x199385){_0x2e3f55[_0xdafb('0x17')](_0x199385);})['then'](function(){var _0x3f7667=[];for(var _0x1ed110=0x0;_0x1ed110<_0x2e3f55[_0xdafb('0x14')];_0x1ed110+=0x1){var _0x4add3c=_0x2e3f55[_0x1ed110];var _0x45e363=createTables(_[_0xdafb('0x3a')](_0x4add3c));var _0x2e6c6c;var _0x2a647a=getPDFDocDefinition(_0x45e363);var _0x4ec61f=getPDFPrinter();var _0x4f5eb5=_0x4ec61f[_0xdafb('0x3b')](_0x2a647a);if(_0x51391d){_0x2e6c6c=path[_0xdafb('0x37')](_0x2b30d8,_0x29b25a,util[_0xdafb('0x19')](_0xdafb('0x3c'),_0x29b25a,_0x1ed110,_0xdafb('0x3d')));}else{_0x2e6c6c=path['join'](_0x2b30d8,util[_0xdafb('0x19')](_0xdafb('0x3e'),_0x29b25a,_0xdafb('0x3d')));}_0x3f7667[_0xdafb('0x17')](writePDFDocument(_0x4f5eb5,_0x2e6c6c));}return Promise[_0xdafb('0x3f')](_0x3f7667);})[_0xdafb('0x28')](function(){if(_0x51391d){return new Promise(function(_0x5a07a1){zipdir(path[_0xdafb('0x37')](_0x2b30d8,_0x29b25a),{'saveTo':path[_0xdafb('0x37')](_0x2b30d8,util[_0xdafb('0x19')](_0xdafb('0x3e'),_0x29b25a,_0xdafb('0x40')))},function(){rimraf(path['join'](_0x2b30d8,_0x29b25a),function(){});_0x5a07a1(_0xdafb('0x41'));});});}})['then'](function(){if(!_0x51391d)return;rimraf(path[_0xdafb('0x37')](_0x2b30d8,_0x29b25a),function(){});})[_0xdafb('0x28')](function(){logger[_0xdafb('0x42')](util[_0xdafb('0x19')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdafb('0x43')));return analyticExtractedReport(_0xdafb('0x44'),_0x51391d?util[_0xdafb('0x19')](_0xdafb('0x3e'),_0x29b25a,_0x51391d?_0xdafb('0x40'):_0xdafb('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xdafb('0x42')](util[_0xdafb('0x19')](_0xdafb('0x45'),EXTRACTED_REPORT_ID,_0xdafb('0x43')));return db[_0xdafb('0xd')][_0xdafb('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xdafb('0x28')](function(_0x1b53f5){EXTRACTED_REPORT=_0x1b53f5;return dbH['sequelize']['query'](util[_0xdafb('0x19')](_0xdafb('0x47'),QUERY),{'type':dbH[_0xdafb('0x2f')][_0xdafb('0x32')][_0xdafb('0x33')]});})['then'](extractReport)[_0xdafb('0x48')](function(_0x1a0ddc){logger[_0xdafb('0x42')](util[_0xdafb('0x19')](_0xdafb('0x49'),EXTRACTED_REPORT_ID,_0xdafb('0x43')),util[_0xdafb('0x4a')](_0x1a0ddc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdafb('0x4b'));})[_0xdafb('0x4c')](function(){process[_0xdafb('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4aa2f2=new PdfPrinter({'Arial':{'normal':__dirname+_0xdafb('0x4e'),'bold':__dirname+_0xdafb('0x4f'),'italics':__dirname+_0xdafb('0x50'),'bolditalics':__dirname+_0xdafb('0x51')}});return _0x4aa2f2;}function getPDFDocDefinitionFromHTML(_0xe8dad7,_0xecab9){var _0x274f2c=util[_0xdafb('0x19')]('%s\x20#%d',_0xecab9[_0xdafb('0x52')],_0xecab9[_0xdafb('0x53')]);var _0x2d4e55=moment()[_0xdafb('0x19')](_0xdafb('0x54'))[_0xdafb('0x11')]();var _0x38c58b=htmlToPdfmake(_0xe8dad7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x38c58b],'defaultStyle':{'font':_0xdafb('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xdafb('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xdafb('0x56'),'style':_0xdafb('0x1d')}];},'footer':function(_0x159f9d,_0x5a1d3f){return[{'text':util[_0xdafb('0x19')](_0xdafb('0x57'),_0x274f2c,_0x159f9d,_0x5a1d3f,_0x2d4e55),'style':_0xdafb('0x22')}];}};}function writePDFDocument(_0x137dd3,_0x32b608){return new Promise(function(_0x19c37c,_0xe00f82){var _0x5094ad=_0x137dd3[_0xdafb('0x58')](fs['createWriteStream'](_0x32b608));_0x5094ad['on'](_0xdafb('0x59'),function(){_0x19c37c(_0xdafb('0x59'));});_0x5094ad['on'](_0xdafb('0x5a'),function(_0x56391b){_0xe00f82(_0x56391b);});_0x137dd3[_0xdafb('0x5b')]();});}exports[_0xdafb('0x5c')]=function(_0x27a5cf,_0x48cfe5){var _0x3d4c37=getPDFPrinter();var _0x3eb708=getPDFDocDefinitionFromHTML(_0x27a5cf,_0x48cfe5);var _0x4b248d=_0x3d4c37[_0xdafb('0x3b')](_0x3eb708);return writePDFDocument(_0x4b248d,_0x48cfe5[_0xdafb('0x1')])['catch'](function(_0x4c00f1){throw _0x4c00f1;});}; \ No newline at end of file +var _0x9616=['margin','landscape','\x20/\x20','footer','Arial','black','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','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','createWriteStream','finish','error','createPdfFromHTML','path','moment','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header'];(function(_0x2d14a3,_0x1d3fa){var _0x2329c5=function(_0xe7f05){while(--_0xe7f05){_0x2d14a3['push'](_0x2d14a3['shift']());}};_0x2329c5(++_0x1d3fa);}(_0x9616,0x8a));var _0x6961=function(_0x37656f,_0x350ac6){_0x37656f=_0x37656f-0x0;var _0x5cd9d8=_0x9616[_0x37656f];return _0x5cd9d8;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x6961('0x0'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x6961('0x1'));var rimraf=require(_0x6961('0x2'));var JSDOM=require(_0x6961('0x3'))[_0x6961('0x4')];var window=new JSDOM('')[_0x6961('0x5')];var BPromise=require(_0x6961('0x6'));var db=require(_0x6961('0x7'))['db'];var dbH=require(_0x6961('0x7'))['dbH'];var logger=require(_0x6961('0x8'))(_0x6961('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6961('0xa')][0x3];var PATH=process[_0x6961('0xa')][0x4];var NAME=process[_0x6961('0xa')][0x5];var FORMAT=_0x6961('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ad5ee,_0x521f74){var _0x5e07c0={'status':_0x2ad5ee};var _0x1032e2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x521f74){_0x5e07c0[_0x6961('0xc')]=_0x521f74;}return db[_0x6961('0xd')][_0x6961('0xe')](_0x5e07c0,_0x1032e2);}function getHeaders(_0x1376c9){return _['map'](_0x1376c9,function(_0x1574a6){return{'text':_0x1574a6,'style':_0x6961('0xf')};});}function getRows(_0x1e42ea,_0x41e597){return _[_0x6961('0x10')](_0x41e597,function(_0x243a63){return _(_0x243a63)['pick'](_0x1e42ea)[_0x6961('0x10')](function(_0x3518da){return _0x3518da?_[_0x6961('0x11')](_0x3518da):'';})[_0x6961('0x12')]();});}function createTable(_0x368d45,_0x8146a1){var _0x442f1e={'widths':_[_0x6961('0x13')](Array(_0x368d45[_0x6961('0x14')]),0x91),'heights':function(_0x5acad8){return _0x5acad8===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2867f2=getHeaders(_0x368d45);_0x442f1e[_0x6961('0x15')][_0x6961('0x16')](_0x2867f2);var _0x23682d=getRows(_0x368d45,_0x8146a1);_0x442f1e[_0x6961('0x15')]=_0x442f1e['body'][_0x6961('0x17')](_0x23682d);return _0x442f1e;}function createTables(_0x1aa544){var _0x3d2704=[];var _0x3071e6=_['chunk'](Object[_0x6961('0x18')](_0x1aa544[0x0]),0x5);_0x3071e6[_0x6961('0x19')](function(_0xc1782){_0x3d2704[_0x6961('0x16')](createTable(_0xc1782,_0x1aa544));});return _0x3d2704;}function getPDFDocDefinition(_0x260b2d){var _0x49cb03=util[_0x6961('0x1a')](_0x6961('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x6961('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x6961('0x1c')])['format'](FORMAT));var _0x66ef90=[];for(var _0xe2cea2=0x0;_0xe2cea2<_0x260b2d[_0x6961('0x14')];_0xe2cea2++){var _0x356ae6=[];if(_0xe2cea2===0x0){_0x356ae6[_0x6961('0x16')]({'text':_0x49cb03,'style':_0x6961('0x1d')});}var _0x3c9750={'table':_0x260b2d[_0xe2cea2]};if(_0xe2cea2>0x0){_0x3c9750['pageBreak']='before';_0x3c9750[_0x6961('0x1e')]=[0x0,0x46,0x0,0x0];}_0x356ae6[_0x6961('0x16')](_0x3c9750);_0x66ef90[_0x6961('0x16')](_0x356ae6);}return{'pageSize':'A4','pageOrientation':_0x6961('0x1f'),'content':_0x66ef90,'footer':function(_0x677e43,_0x519dc3){return{'text':_0x677e43[_0x6961('0x11')]()+_0x6961('0x20')+_0x519dc3,'style':_0x6961('0x21')};},'defaultStyle':{'font':_0x6961('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6961('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x59b75c){var _0x108ff7=0x1388;var _0x2df34c;if(!_0x59b75c[0x0][_0x6961('0x24')]){return analyticExtractedReport(_0x6961('0x25'));}return db[_0x6961('0x26')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6961('0x27'),_0x6961('0x28')]})['then'](function(_0x4c928f){if(_0x4c928f){_0x2df34c=_0x4c928f;_0x108ff7=_0x2df34c[_0x6961('0x28')]||0x3e8;}})[_0x6961('0x29')](function(){var _0x53fcf2=[];var _0x51ba2e=0x0;if(_0x2df34c[_0x6961('0x27')]){if(_0x59b75c&&_0x59b75c['length']){var _0x4084e2=_[_0x6961('0x2a')](_0x59b75c[0x0][_0x6961('0x24')]/_0x108ff7);var _0x36436f=Number[_0x6961('0x2b')](_0x59b75c[0x0][_0x6961('0x24')]/_0x108ff7)?_0x59b75c[0x0]['num']%_0x108ff7:0x0;_0x4084e2[_0x6961('0x19')](function(_0x174244){if(_0x174244>0x0){_0x51ba2e+=_0x108ff7;}_0x53fcf2[_0x6961('0x16')](dbH[_0x6961('0x2c')][_0x6961('0x2d')](util[_0x6961('0x1a')](_0x6961('0x2e'),QUERY,_0x108ff7,_0x51ba2e),{'type':dbH[_0x6961('0x2c')][_0x6961('0x2f')][_0x6961('0x30')]}));});if(_0x36436f>0x0){_0x51ba2e+=_0x108ff7;_0x53fcf2[_0x6961('0x16')](dbH[_0x6961('0x2c')][_0x6961('0x2d')](util[_0x6961('0x1a')](_0x6961('0x2e'),QUERY,_0x36436f,_0x51ba2e),{'type':dbH[_0x6961('0x2c')][_0x6961('0x2f')][_0x6961('0x30')]}));}}}else{_0x53fcf2[_0x6961('0x16')](dbH[_0x6961('0x2c')]['query'](QUERY,{'type':dbH[_0x6961('0x2c')]['QueryTypes']['SELECT']}));}var _0x316900=path[_0x6961('0x31')](PATH);var _0x4d69f8=path[_0x6961('0x32')](PATH,'.pdf');var _0x4c9141=_0x2df34c[_0x6961('0x27')]&&_0x53fcf2[_0x6961('0x14')]>0x1;var _0x1bcd7f=[];if(!fs[_0x6961('0x33')](path[_0x6961('0x34')](_0x316900,_0x4d69f8))&&_0x4c9141){fs['mkdirSync'](path[_0x6961('0x34')](_0x316900,_0x4d69f8));}return BPromise[_0x6961('0x35')](_0x53fcf2,function(_0x4cb8ad){_0x1bcd7f[_0x6961('0x16')](_0x4cb8ad);})[_0x6961('0x29')](function(){var _0x57d135=[];for(var _0x13f1d7=0x0;_0x13f1d7<_0x1bcd7f[_0x6961('0x14')];_0x13f1d7+=0x1){var _0x21a085=_0x1bcd7f[_0x13f1d7];var _0x5de700=createTables(_[_0x6961('0x36')](_0x21a085));var _0x2e3b95;var _0x5c8e21=getPDFDocDefinition(_0x5de700);var _0xc63802=getPDFPrinter();var _0x33d836=_0xc63802[_0x6961('0x37')](_0x5c8e21);if(_0x4c9141){_0x2e3b95=path[_0x6961('0x34')](_0x316900,_0x4d69f8,util['format'](_0x6961('0x38'),_0x4d69f8,_0x13f1d7,'pdf'));}else{_0x2e3b95=path[_0x6961('0x34')](_0x316900,util['format']('%s.%s',_0x4d69f8,_0x6961('0x39')));}_0x57d135[_0x6961('0x16')](writePDFDocument(_0x33d836,_0x2e3b95));}return Promise['all'](_0x57d135);})[_0x6961('0x29')](function(){if(_0x4c9141){return new Promise(function(_0x450d8d){zipdir(path[_0x6961('0x34')](_0x316900,_0x4d69f8),{'saveTo':path[_0x6961('0x34')](_0x316900,util['format']('%s.%s',_0x4d69f8,_0x6961('0x3a')))},function(){rimraf(path[_0x6961('0x34')](_0x316900,_0x4d69f8),function(){});_0x450d8d(_0x6961('0x3b'));});});}})['then'](function(){if(!_0x4c9141)return;rimraf(path[_0x6961('0x34')](_0x316900,_0x4d69f8),function(){});})[_0x6961('0x29')](function(){logger[_0x6961('0x3c')](util[_0x6961('0x1a')](_0x6961('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x6961('0x3e'),_0x4c9141?util[_0x6961('0x1a')](_0x6961('0x3f'),_0x4d69f8,_0x4c9141?_0x6961('0x3a'):_0x6961('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x6961('0x3c')](util[_0x6961('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6961('0x40')));return db[_0x6961('0xd')][_0x6961('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x54c940){EXTRACTED_REPORT=_0x54c940;return dbH[_0x6961('0x2c')][_0x6961('0x2d')](util['format'](_0x6961('0x42'),QUERY),{'type':dbH[_0x6961('0x2c')][_0x6961('0x2f')][_0x6961('0x30')]});})[_0x6961('0x29')](extractReport)['catch'](function(_0x496ac0){logger[_0x6961('0x3c')](util[_0x6961('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6961('0x40')),util['inspect'](_0x496ac0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6961('0x43'));})[_0x6961('0x44')](function(){process[_0x6961('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2d55e8=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x6961('0x46'),'italics':__dirname+_0x6961('0x47'),'bolditalics':__dirname+_0x6961('0x48')}});return _0x2d55e8;}function getPDFDocDefinitionFromHTML(_0x353e36,_0x385f6b){var _0x21ffbd=util['format'](_0x6961('0x49'),_0x385f6b[_0x6961('0x4a')],_0x385f6b[_0x6961('0x4b')]);var _0x342198=moment()[_0x6961('0x1a')]('YYYY-MM-DD')['toString']();var _0x4d4a90=htmlToPdfmake(_0x353e36,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4d4a90],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x6961('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6961('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6961('0x4c')}},'header':function(){return[{'text':_0x6961('0x4d'),'style':_0x6961('0x1d')}];},'footer':function(_0x3d208a,_0x1446dd){return[{'text':util[_0x6961('0x1a')](_0x6961('0x4e'),_0x21ffbd,_0x3d208a,_0x1446dd,_0x342198),'style':_0x6961('0x21')}];}};}function writePDFDocument(_0x4a246d,_0x384421){return new Promise(function(_0x372c50,_0x1bfd00){var _0x19f85a=_0x4a246d['pipe'](fs[_0x6961('0x4f')](_0x384421));_0x19f85a['on'](_0x6961('0x50'),function(){_0x372c50('finish');});_0x19f85a['on'](_0x6961('0x51'),function(_0x3d8cff){_0x1bfd00(_0x3d8cff);});_0x4a246d['end']();});}exports[_0x6961('0x52')]=function(_0xf3d6b3,_0x5a83ec){var _0x49ea03=getPDFPrinter();var _0xacb7d1=getPDFDocDefinitionFromHTML(_0xf3d6b3,_0x5a83ec);var _0x38a6f5=_0x49ea03[_0x6961('0x37')](_0xacb7d1);return writePDFDocument(_0x38a6f5,_0x5a83ec[_0x6961('0x53')])['catch'](function(_0x4c0c0b){throw _0x4c0c0b;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 6251913..78569ca 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 _0xbf95=['SELECT','Empty','split','range','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','mkdirSync','join','each','xlsx','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Failed','finally','exit','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','Setting','find','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x28ca3c,_0xbb754c){var _0x59230d=function(_0x3325f0){while(--_0x3325f0){_0x28ca3c['push'](_0x28ca3c['shift']());}};_0x59230d(++_0xbb754c);}(_0xbf95,0x7d));var _0x5bf9=function(_0x47f4ee,_0x191fd4){_0x47f4ee=_0x47f4ee-0x0;var _0x1fc86b=_0xbf95[_0x47f4ee];return _0x1fc86b;};'use strict';var util=require('util');var path=require('path');var _=require(_0x5bf9('0x0'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x5bf9('0x1'));var zipdir=require(_0x5bf9('0x2'));var rimraf=require(_0x5bf9('0x3'));var db=require(_0x5bf9('0x4'))['db'];var dbH=require(_0x5bf9('0x4'))[_0x5bf9('0x5')];var logger=require(_0x5bf9('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5bf9('0x7')][0x3];var PATH=process[_0x5bf9('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d0282,_0x3f2e78){var _0x4e2579={'status':_0x2d0282};var _0x2842d3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f2e78){_0x4e2579[_0x5bf9('0x8')]=_0x3f2e78;}return db[_0x5bf9('0x9')]['update'](_0x4e2579,_0x2842d3);}function main(){var _0x40a691=0x1388;var _0x14cf34;logger[_0x5bf9('0xa')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x5bf9('0xb')][_0x5bf9('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5bf9('0xd')]})[_0x5bf9('0xe')](function(_0x99f4b1){if(_0x99f4b1){_0x14cf34=_0x99f4b1;_0x40a691=_0x14cf34['splitSizeXlsx']||0x1388;}})[_0x5bf9('0xe')](function(){return dbH[_0x5bf9('0xf')]['query'](util[_0x5bf9('0x10')](_0x5bf9('0x11'),QUERY),{'type':dbH['sequelize'][_0x5bf9('0x12')][_0x5bf9('0x13')]});})[_0x5bf9('0xe')](function(_0x16afb1){if(!_0x16afb1[0x0]['num']){return analyticExtractedReport(_0x5bf9('0x14'));}var _0x47a882=[];var _0x19c96a=0x0;if(_0x14cf34[_0x5bf9('0x15')]){if(_0x16afb1&&_0x16afb1['length']){var _0x4a0118=_[_0x5bf9('0x16')](_0x16afb1[0x0][_0x5bf9('0x17')]/_0x40a691);var _0x48f19b=Number['isInteger'](_0x16afb1[0x0]['num']/_0x40a691)?_0x16afb1[0x0][_0x5bf9('0x17')]%_0x40a691:0x0;_0x4a0118[_0x5bf9('0x18')](function(_0x11109c){if(_0x11109c>0x0){_0x19c96a+=_0x40a691;}_0x47a882[_0x5bf9('0x19')](dbH[_0x5bf9('0xf')][_0x5bf9('0x1a')](util[_0x5bf9('0x10')](_0x5bf9('0x1b'),QUERY,_0x40a691,_0x19c96a),{'type':dbH[_0x5bf9('0xf')]['QueryTypes'][_0x5bf9('0x13')]}));});if(_0x48f19b>0x0){_0x19c96a+=_0x40a691;_0x47a882['push'](dbH[_0x5bf9('0xf')]['query'](util['format'](_0x5bf9('0x1b'),QUERY,_0x48f19b,_0x19c96a),{'type':dbH[_0x5bf9('0xf')][_0x5bf9('0x12')][_0x5bf9('0x13')]}));}}}else{_0x47a882[_0x5bf9('0x19')](dbH[_0x5bf9('0xf')]['query'](QUERY,{'type':dbH[_0x5bf9('0xf')]['QueryTypes'][_0x5bf9('0x13')]}));}var _0x4104c6=path[_0x5bf9('0x1c')](PATH);var _0x384f4e=path[_0x5bf9('0x1d')](PATH,_0x5bf9('0x1e'));var _0x15c2ed=_0x14cf34[_0x5bf9('0x15')]&&_0x47a882[_0x5bf9('0x1f')]>0x1;var _0x11e4e4=[];if(!fs[_0x5bf9('0x20')](path['join'](_0x4104c6,_0x384f4e))&&_0x15c2ed){fs[_0x5bf9('0x21')](path[_0x5bf9('0x22')](_0x4104c6,_0x384f4e));}return BPromise[_0x5bf9('0x23')](_0x47a882,function(_0x13d136){_0x11e4e4[_0x5bf9('0x19')](_0x13d136);})[_0x5bf9('0xe')](function(){for(var _0x44dffe=0x0;_0x44dffe<_0x11e4e4['length'];_0x44dffe+=0x1){var _0x3a1e93;var _0x1df599=_0x11e4e4[_0x44dffe];if(_0x15c2ed){_0x3a1e93=path['join'](_0x4104c6,_0x384f4e,util[_0x5bf9('0x10')]('%s%d.%s',_0x384f4e,_0x44dffe,_0x5bf9('0x24')));}else{_0x3a1e93=path['join'](_0x4104c6,util[_0x5bf9('0x10')]('%s.%s',_0x384f4e,_0x5bf9('0x24')));}fs[_0x5bf9('0x25')](_0x3a1e93,json2xls(_0x1df599),'binary');}})[_0x5bf9('0xe')](function(){if(_0x15c2ed){return new Promise(function(_0x1a6fdb){zipdir(path[_0x5bf9('0x22')](_0x4104c6,_0x384f4e),{'saveTo':path[_0x5bf9('0x22')](_0x4104c6,util[_0x5bf9('0x10')]('%s.%s',_0x384f4e,_0x5bf9('0x26')))},function(_0x3cd923,_0x536246){rimraf(path[_0x5bf9('0x22')](_0x4104c6,_0x384f4e),function(){});_0x1a6fdb('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0x5bf9('0x10')](_0x5bf9('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x5bf9('0x28'),_0x15c2ed?util[_0x5bf9('0x10')](_0x5bf9('0x29'),_0x384f4e,_0x15c2ed?_0x5bf9('0x26'):'xlsx'):null);});})[_0x5bf9('0x2a')](function(_0x454f85){logger[_0x5bf9('0xa')](util[_0x5bf9('0x10')](_0x5bf9('0x2b'),EXTRACTED_REPORT_ID,_0x5bf9('0x2c')),util['inspect'](_0x454f85,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5bf9('0x2d'));})[_0x5bf9('0x2e')](function(){process[_0x5bf9('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x52ed=['find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0x1b0d19,_0x41297d){var _0x274762=function(_0x236f94){while(--_0x236f94){_0x1b0d19['push'](_0x1b0d19['shift']());}};_0x274762(++_0x41297d);}(_0x52ed,0x132));var _0xd52e=function(_0x5f1d32,_0x47d03f){_0x5f1d32=_0x5f1d32-0x0;var _0x49145a=_0x52ed[_0x5f1d32];return _0x49145a;};'use strict';var util=require(_0xd52e('0x0'));var path=require(_0xd52e('0x1'));var _=require(_0xd52e('0x2'));var fs=require('fs');var json2xls=require(_0xd52e('0x3'));var BPromise=require(_0xd52e('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xd52e('0x5'));var db=require(_0xd52e('0x6'))['db'];var dbH=require(_0xd52e('0x6'))[_0xd52e('0x7')];var logger=require(_0xd52e('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd52e('0x9')][0x2]);var QUERY=process[_0xd52e('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5207fd,_0x321f8d){var _0x5ae178={'status':_0x5207fd};var _0x4d124c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x321f8d){_0x5ae178[_0xd52e('0xa')]=_0x321f8d;}return db[_0xd52e('0xb')][_0xd52e('0xc')](_0x5ae178,_0x4d124c);}function main(){var _0x1d00a9=0x1388;var _0x3d857a;logger[_0xd52e('0xd')](util[_0xd52e('0xe')](_0xd52e('0xf'),EXTRACTED_REPORT_ID,_0xd52e('0x10')));return db[_0xd52e('0x11')][_0xd52e('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd52e('0x13'),_0xd52e('0x14')]})[_0xd52e('0x15')](function(_0x43a5ba){if(_0x43a5ba){_0x3d857a=_0x43a5ba;_0x1d00a9=_0x3d857a['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xd52e('0x16')][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x18'),QUERY),{'type':dbH[_0xd52e('0x16')]['QueryTypes']['SELECT']});})[_0xd52e('0x15')](function(_0x466516){if(!_0x466516[0x0][_0xd52e('0x19')]){return analyticExtractedReport(_0xd52e('0x1a'));}var _0x33230a=[];var _0x58dab2=0x0;if(_0x3d857a[_0xd52e('0x13')]){if(_0x466516&&_0x466516[_0xd52e('0x1b')]){var _0x7eeb4f=_[_0xd52e('0x1c')](_0x466516[0x0][_0xd52e('0x19')]/_0x1d00a9);var _0xdab253=Number[_0xd52e('0x1d')](_0x466516[0x0]['num']/_0x1d00a9)?_0x466516[0x0]['num']%_0x1d00a9:0x0;_0x7eeb4f['forEach'](function(_0x163b1b){if(_0x163b1b>0x0){_0x58dab2+=_0x1d00a9;}_0x33230a[_0xd52e('0x1e')](dbH['sequelize'][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x1f'),QUERY,_0x1d00a9,_0x58dab2),{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')][_0xd52e('0x21')]}));});if(_0xdab253>0x0){_0x58dab2+=_0x1d00a9;_0x33230a[_0xd52e('0x1e')](dbH[_0xd52e('0x16')][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x1f'),QUERY,_0xdab253,_0x58dab2),{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')][_0xd52e('0x21')]}));}}}else{_0x33230a[_0xd52e('0x1e')](dbH[_0xd52e('0x16')][_0xd52e('0x17')](QUERY,{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')]['SELECT']}));}var _0x3c3599=path[_0xd52e('0x22')](PATH);var _0x3a4142=path[_0xd52e('0x23')](PATH,'.xlsx');var _0x140fa0=_0x3d857a[_0xd52e('0x13')]&&_0x33230a['length']>0x1;var _0x5dd8b0=[];if(!fs[_0xd52e('0x24')](path[_0xd52e('0x25')](_0x3c3599,_0x3a4142))&&_0x140fa0){fs[_0xd52e('0x26')](path['join'](_0x3c3599,_0x3a4142));}return BPromise[_0xd52e('0x27')](_0x33230a,function(_0x4b27bc){_0x5dd8b0[_0xd52e('0x1e')](_0x4b27bc);})[_0xd52e('0x15')](function(){for(var _0x505614=0x0;_0x505614<_0x5dd8b0[_0xd52e('0x1b')];_0x505614+=0x1){var _0x2329e4;var _0x5a8ab0=_0x5dd8b0[_0x505614];if(_0x140fa0){_0x2329e4=path['join'](_0x3c3599,_0x3a4142,util[_0xd52e('0xe')](_0xd52e('0x28'),_0x3a4142,_0x505614,'xlsx'));}else{_0x2329e4=path[_0xd52e('0x25')](_0x3c3599,util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0xd52e('0x2a')));}fs[_0xd52e('0x2b')](_0x2329e4,json2xls(_0x5a8ab0),_0xd52e('0x2c'));}})[_0xd52e('0x15')](function(){if(_0x140fa0){return new Promise(function(_0x3b0f46){zipdir(path[_0xd52e('0x25')](_0x3c3599,_0x3a4142),{'saveTo':path[_0xd52e('0x25')](_0x3c3599,util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0xd52e('0x2d')))},function(_0xaf7210,_0x515dc7){rimraf(path[_0xd52e('0x25')](_0x3c3599,_0x3a4142),function(){});_0x3b0f46(_0xd52e('0x2e'));});});}})['then'](function(){logger[_0xd52e('0xd')](util[_0xd52e('0xe')](_0xd52e('0x2f'),EXTRACTED_REPORT_ID,_0xd52e('0x10')));return analyticExtractedReport(_0xd52e('0x30'),_0x140fa0?util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0x140fa0?_0xd52e('0x2d'):_0xd52e('0x2a')):null);});})[_0xd52e('0x31')](function(_0x2181ba){logger[_0xd52e('0xd')](util[_0xd52e('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xd52e('0x32')](_0x2181ba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd52e('0x33'));})[_0xd52e('0x34')](function(){process[_0xd52e('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 e6d9064..547632d 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 _0x3bed=['rewrite','lodash','util','findAll','then','models','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','extensions','extension','find','push','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','type','inbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch'];(function(_0x16b09d,_0xc302ab){var _0x12e85e=function(_0x47ec38){while(--_0x47ec38){_0x16b09d['push'](_0x16b09d['shift']());}};_0x12e85e(++_0xc302ab);}(_0x3bed,0x125));var _0xd3be=function(_0x1b3e94,_0x467671){_0x1b3e94=_0x1b3e94-0x0;var _0x118f99=_0x3bed[_0x1b3e94];return _0x118f99;};'use strict';var _=require(_0xd3be('0x0'));var util=require(_0xd3be('0x1'));function rewrite(_0x215fc1,_0x41815a){var _0x25e271=this;return _0x215fc1['models']['Interval']['findAll']({'raw':!![]})['then'](function(_0x2da7aa){_0x25e271['intervals']=_0x2da7aa;return _0x215fc1['models']['VoiceExtension'][_0xd3be('0x2')]({'where':{'IntervalId':_0x41815a['IntervalId']},'raw':!![]});})[_0xd3be('0x3')](function(_0x2ddc8f){return _0x215fc1[_0xd3be('0x4')][_0xd3be('0x5')][_0xd3be('0x2')]({'where':{'exten':{'$in':_[_0xd3be('0x6')](_[_0xd3be('0x7')](_0x2ddc8f,_0xd3be('0x8')))}},'order':[{'raw':_0xd3be('0x9')}],'raw':!![]});})[_0xd3be('0x3')](function(_0x11594d){var _0x6cb2c3=_[_0xd3be('0xa')](_0x11594d,{'priority':'1'});var _0x55cbe8=_[_0xd3be('0xa')](_0x11594d,{'isApp':0x1});var _0x2ab50a=_[_0xd3be('0xb')](_0x55cbe8,_0xd3be('0x8'));var _0x251a98=[_0xd3be('0xc'),_0xd3be('0xd')];var _0x10386d=[];var _0x5976ed=[];for(var _0xf3fc99 in _0x2ab50a){if(_0x2ab50a['hasOwnProperty'](_0xf3fc99)){_0x25e271['priority']=0x2;_0x25e271[_0xd3be('0xe')]=[];_0x25e271[_0xd3be('0xf')]=_[_0xd3be('0x10')](_0x6cb2c3,{'exten':_0x2ab50a[_0xf3fc99][0x0]['exten']});_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0]['type'],'app':_0xd3be('0x12'),'appdata':util[_0xd3be('0x13')](_0xd3be('0x14'),_0x2ab50a[_0xf3fc99][0x0]['type']),'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});if(_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')]===_0xd3be('0x19')){_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':'CDR(routeid)='+_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')],'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});}else if(_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')]===_0xd3be('0x1a')){if(_0x25e271[_0xd3be('0xf')]){_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':_0xd3be('0x1b')+(_0x25e271[_0xd3be('0xf')]['cutdigits']?_0xd3be('0x1c')+_0x25e271['extension'][_0xd3be('0x1d')]+'}':_0xd3be('0x1e')),'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});}_0x25e271[_0xd3be('0xe')]['push']({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':_0xd3be('0x1f')+_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')],'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0]['VoiceExtensionId']});var _0x18c479=_0x25e271['priority']++;_0x25e271[_0xd3be('0xe')]['push']({'type':_0x2ab50a[_0xf3fc99][0x0]['type'],'app':_0xd3be('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x18c479+0x2)+_0xd3be('0x21')+(_0x18c479+0x1)+')','context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x18c479,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});if(_0x25e271[_0xd3be('0xf')]){_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':_0x25e271['extension'][_0xd3be('0x1d')]?_0xd3be('0x22')+_0x25e271[_0xd3be('0xf')][_0xd3be('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x2ab50a[_0xf3fc99][0x0]['context'],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});}_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':_0xd3be('0x23')+_0x2ab50a[_0xf3fc99][0x0]['VoiceExtensionId'],'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});if(_0x25e271[_0xd3be('0xf')]&&_0x25e271[_0xd3be('0xf')][_0xd3be('0x24')]('recordingFormat')&&_0x25e271['extension'][_0xd3be('0x25')]!==_0xd3be('0x26')){_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0]['type'],'app':'Set','appdata':_0xd3be('0x27'),'context':_0x2ab50a[_0xf3fc99][0x0]['context'],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':'Set','appdata':_0xd3be('0x28')+_0x25e271[_0xd3be('0xf')][_0xd3be('0x25')]||'wav','context':_0x2ab50a[_0xf3fc99][0x0]['context'],'exten':_0x2ab50a[_0xf3fc99][0x0]['exten'],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});}}_0x25e271['extensions'][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0]['type'],'app':_0xd3be('0x12'),'appdata':_0xd3be('0x29'),'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x8')],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0]['VoiceExtensionId']});_0x25e271['extensions'][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':_0xd3be('0x2a'),'context':_0x2ab50a[_0xf3fc99][0x0]['context'],'exten':_0x2ab50a[_0xf3fc99][0x0]['exten'],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0]['VoiceExtensionId']});_0x25e271[_0xd3be('0xe')]['push']({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':_0xd3be('0x2b'),'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'exten':_0x2ab50a[_0xf3fc99][0x0]['exten'],'priority':_0x25e271[_0xd3be('0x16')]++,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});for(var _0x139b5b=0x0,_0x526f73=0x0;_0x139b5b<_0x2ab50a[_0xf3fc99]['length'];_0x139b5b+=0x1,_0x526f73=0x0){var _0x301358=_0x2ab50a[_0xf3fc99][_0x139b5b];if(_0x301358[_0xd3be('0x18')]){_0x301358[_0xd3be('0x18')]=_0x301358[_0xd3be('0x18')][_0xd3be('0x2c')]();}var _0x57aef3=[];var _0x501f37=[];delete _0x301358['id'];delete _0x301358[_0xd3be('0x2d')];delete _0x301358[_0xd3be('0x2e')];var _0x5890b1=_0x301358[_0xd3be('0x2f')]!==_0xd3be('0x30')?[_0x301358[_0xd3be('0x2f')]]:_0x301358[_0xd3be('0x31')]?_[_0xd3be('0x7')](_[_0xd3be('0xa')](_0x25e271[_0xd3be('0x32')],{'IntervalId':_0x301358[_0xd3be('0x31')]}),'interval'):[];if(_0x301358[_0xd3be('0x24')]('tag')){if(_0x301358[_0xd3be('0x33')]&&_0x301358[_0xd3be('0x33')]!=='--'){_0x57aef3['push']({'type':_0x301358[_0xd3be('0x18')],'app':'Set','appdata':_0xd3be('0x34')+_0x301358[_0xd3be('0x33')],'context':_0x301358[_0xd3be('0x15')],'exten':_0x301358[_0xd3be('0x8')],'priority':_0x5890b1['length']+_0x25e271[_0xd3be('0x16')]+_0x526f73++,'VoiceExtensionId':_0x301358[_0xd3be('0x17')]});}}if(_0x301358[_0xd3be('0x18')]==='outbound'&&_0x301358[_0xd3be('0x24')]('callerID')){if(_0x301358['callerID']){_0x57aef3['push']({'type':_0x301358['type'],'app':_0xd3be('0x20'),'appdata':_0xd3be('0x35')+_0x301358[_0xd3be('0x36')]+')','context':_0x301358[_0xd3be('0x15')],'exten':_0x301358[_0xd3be('0x8')],'priority':_0x5890b1[_0xd3be('0x37')]+_0x25e271[_0xd3be('0x16')]+_0x526f73++,'VoiceExtensionId':_0x301358[_0xd3be('0x17')]});}else{_0x57aef3[_0xd3be('0x11')]({'type':_0x301358[_0xd3be('0x18')],'app':_0xd3be('0x20'),'appdata':_0xd3be('0x38'),'context':_0x301358[_0xd3be('0x15')],'exten':_0x301358[_0xd3be('0x8')],'priority':_0x5890b1[_0xd3be('0x37')]+_0x25e271[_0xd3be('0x16')]+_0x526f73++,'VoiceExtensionId':_0x301358['VoiceExtensionId']});}}if(_0x301358[_0xd3be('0x24')](_0xd3be('0x39'))){if(_0x251a98['indexOf'](_0x301358[_0xd3be('0x3a')][_0xd3be('0x2c')]())>=0x0&&_0x301358[_0xd3be('0x3b')]!==_0xd3be('0x3c')){if(_0x301358[_0xd3be('0x39')]){_0x57aef3[_0xd3be('0x11')]({'type':_0x301358[_0xd3be('0x18')],'app':_0xd3be('0x20'),'appdata':_0xd3be('0x3d'),'context':_0x301358['context'],'exten':_0x301358[_0xd3be('0x8')],'priority':_0x5890b1[_0xd3be('0x37')]+_0x25e271['priority']+_0x526f73++,'VoiceExtensionId':_0x301358[_0xd3be('0x17')]});_0x57aef3[_0xd3be('0x11')]({'type':_0x301358[_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x301358[_0xd3be('0x15')],'exten':_0x301358[_0xd3be('0x8')],'priority':_0x5890b1['length']+_0x25e271[_0xd3be('0x16')]+_0x526f73++,'VoiceExtensionId':_0x301358[_0xd3be('0x17')]});}else{_0x57aef3[_0xd3be('0x11')]({'type':_0x301358[_0xd3be('0x18')],'app':_0xd3be('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x301358[_0xd3be('0x15')],'exten':_0x301358[_0xd3be('0x8')],'priority':_0x5890b1['length']+_0x25e271[_0xd3be('0x16')]+_0x526f73++,'VoiceExtensionId':_0x301358[_0xd3be('0x17')]});_0x57aef3[_0xd3be('0x11')]({'type':_0x301358[_0xd3be('0x18')],'app':_0xd3be('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x301358[_0xd3be('0x15')],'exten':_0x301358['exten'],'priority':_0x5890b1[_0xd3be('0x37')]+_0x25e271['priority']+_0x526f73++,'VoiceExtensionId':_0x301358[_0xd3be('0x17')]});}}}for(var _0x242f10=0x0;_0x242f10<_0x5890b1[_0xd3be('0x37')];_0x242f10+=0x1){var _0x3250fc=_0x25e271[_0xd3be('0x16')]+_0x5890b1[_0xd3be('0x37')];var _0x46a71d=_0x242f10===_0x5890b1[_0xd3be('0x37')]-0x1?_0x25e271[_0xd3be('0x16')]+_0x57aef3[_0xd3be('0x37')]+_0x501f37[_0xd3be('0x37')]+0x2:_0x25e271['priority']+_0x242f10+0x1;_0x57aef3[_0xd3be('0x3e')](_0x242f10,0x0,{'type':_0x301358['type'],'app':_0xd3be('0x3f'),'appdata':_0x5890b1[_0x242f10]+'?'+_0x301358[_0xd3be('0x15')]+',${EXTEN},'+_0x3250fc+':'+_0x301358[_0xd3be('0x15')]+_0xd3be('0x40')+_0x46a71d,'exten':_0x301358['exten'],'context':_0x301358[_0xd3be('0x15')],'priority':_0x25e271[_0xd3be('0x16')]+_0x242f10,'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});}_0x301358[_0xd3be('0x16')]=_0x57aef3[_0xd3be('0x37')]?_['last'](_0x57aef3)[_0xd3be('0x16')]+0x1:_0x25e271[_0xd3be('0x16')];_0x25e271['priority']=(_0x501f37[_0xd3be('0x37')]?_[_0xd3be('0x41')](_0x501f37)[_0xd3be('0x16')]:_0x301358[_0xd3be('0x16')])+0x1;_0x25e271['extensions']=_['concat'](_0x25e271[_0xd3be('0xe')],_0x57aef3,[_0x301358],_0x501f37);}_0x25e271[_0xd3be('0xe')][_0xd3be('0x11')]({'type':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x18')],'app':_0xd3be('0x42'),'exten':_0x2ab50a[_0xf3fc99][0x0]['exten'],'context':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x15')],'priority':_0x25e271['priority'],'VoiceExtensionId':_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]});_0x10386d['push'](_0x2ab50a[_0xf3fc99][0x0][_0xd3be('0x17')]);_0x5976ed=_[_0xd3be('0x43')](_0x5976ed,_0x25e271[_0xd3be('0xe')]);}}return _0x215fc1['transaction'](function(_0x334366){return _0x215fc1[_0xd3be('0x4')][_0xd3be('0x5')][_0xd3be('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x10386d}},'transaction':_0x334366})[_0xd3be('0x3')](function(_0x23a98b){return _0x215fc1[_0xd3be('0x4')]['VoiceExtension'][_0xd3be('0x45')](_[_0xd3be('0x46')](_0x5976ed,'priority'),{'transaction':_0x334366});});});})[_0xd3be('0x47')](function(_0x3f66df){console['error'](_0x3f66df);});}exports[_0xd3be('0x48')]=rewrite; \ No newline at end of file +var _0xc635=['XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','filter','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','lodash','util','Interval','findAll','then','intervals','VoiceExtension','models','map','exten','playback','hasOwnProperty','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','priority','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','wav','XCALLY-MOTION-ANSWER=0'];(function(_0x29e278,_0x17a9fd){var _0x37ef66=function(_0x4e1e94){while(--_0x4e1e94){_0x29e278['push'](_0x29e278['shift']());}};_0x37ef66(++_0x17a9fd);}(_0xc635,0x117));var _0x5c63=function(_0x180c70,_0x30d0c7){_0x180c70=_0x180c70-0x0;var _0x51342f=_0xc635[_0x180c70];return _0x51342f;};'use strict';var _=require(_0x5c63('0x0'));var util=require(_0x5c63('0x1'));function rewrite(_0x449e7d,_0x2d52b6){var _0x52b6b7=this;return _0x449e7d['models'][_0x5c63('0x2')][_0x5c63('0x3')]({'raw':!![]})[_0x5c63('0x4')](function(_0x97a74c){_0x52b6b7[_0x5c63('0x5')]=_0x97a74c;return _0x449e7d['models'][_0x5c63('0x6')][_0x5c63('0x3')]({'where':{'IntervalId':_0x2d52b6['IntervalId']},'raw':!![]});})[_0x5c63('0x4')](function(_0x344187){return _0x449e7d[_0x5c63('0x7')][_0x5c63('0x6')][_0x5c63('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x5c63('0x8')](_0x344187,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x5c63('0x4')](function(_0x13597d){var _0x43f9ea=_['filter'](_0x13597d,{'priority':'1'});var _0x51a4a5=_['filter'](_0x13597d,{'isApp':0x1});var _0x4b1d22=_['groupBy'](_0x51a4a5,_0x5c63('0x9'));var _0x40662f=['queue',_0x5c63('0xa')];var _0x18598a=[];var _0x38b357=[];for(var _0x341ff6 in _0x4b1d22){if(_0x4b1d22[_0x5c63('0xb')](_0x341ff6)){_0x52b6b7['priority']=0x2;_0x52b6b7[_0x5c63('0xc')]=[];_0x52b6b7[_0x5c63('0xd')]=_[_0x5c63('0xe')](_0x43f9ea,{'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')]});_0x52b6b7[_0x5c63('0xc')][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0]['type'],'app':_0x5c63('0x10'),'appdata':util[_0x5c63('0x11')](_0x5c63('0x12'),_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')]),'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7[_0x5c63('0x15')]++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0]['VoiceExtensionId']});if(_0x4b1d22[_0x341ff6][0x0]['type']==='inbound'){_0x52b6b7['extensions']['push']({'type':_0x4b1d22[_0x341ff6][0x0]['type'],'app':_0x5c63('0x10'),'appdata':_0x5c63('0x16')+_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')],'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0]['exten'],'priority':_0x52b6b7[_0x5c63('0x15')]++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0]['VoiceExtensionId']});}else if(_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')]===_0x5c63('0x18')){if(_0x52b6b7['extension']){_0x52b6b7['extensions'][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':_0x5c63('0x10'),'appdata':_0x5c63('0x19')+(_0x52b6b7[_0x5c63('0xd')]['cutdigits']?_0x5c63('0x1a')+_0x52b6b7[_0x5c63('0xd')][_0x5c63('0x1b')]+'}':'${EXTEN}'),'context':_0x4b1d22[_0x341ff6][0x0]['context'],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7[_0x5c63('0x15')]++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});}_0x52b6b7[_0x5c63('0xc')][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':'Set','appdata':_0x5c63('0x16')+_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')],'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7['priority']++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});var _0x5bb137=_0x52b6b7[_0x5c63('0x15')]++;_0x52b6b7['extensions'][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':_0x5c63('0x1c'),'appdata':_0x5c63('0x1d')+(_0x5bb137+0x2)+_0x5c63('0x1e')+(_0x5bb137+0x1)+')','context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0]['exten'],'priority':_0x5bb137,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});if(_0x52b6b7[_0x5c63('0xd')]){_0x52b6b7['extensions'][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':_0x5c63('0x10'),'appdata':_0x52b6b7[_0x5c63('0xd')][_0x5c63('0x1b')]?_0x5c63('0x1f')+_0x52b6b7['extension'][_0x5c63('0x1b')]+'}':_0x5c63('0x20'),'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0]['exten'],'priority':_0x52b6b7[_0x5c63('0x15')]++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});}_0x52b6b7['extensions'][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':_0x5c63('0x10'),'appdata':'outboundrouteid='+_0x4b1d22[_0x341ff6][0x0]['VoiceExtensionId'],'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7[_0x5c63('0x15')]++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});if(_0x52b6b7[_0x5c63('0xd')]&&_0x52b6b7[_0x5c63('0xd')]['hasOwnProperty'](_0x5c63('0x21'))&&_0x52b6b7[_0x5c63('0xd')][_0x5c63('0x21')]!=='none'){_0x52b6b7[_0x5c63('0xc')][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7[_0x5c63('0x15')]++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});_0x52b6b7[_0x5c63('0xc')]['push']({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x52b6b7[_0x5c63('0xd')]['recordingFormat']||_0x5c63('0x22'),'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7['priority']++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0]['VoiceExtensionId']});}}_0x52b6b7[_0x5c63('0xc')][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':_0x5c63('0x10'),'appdata':_0x5c63('0x23'),'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7[_0x5c63('0x15')]++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});_0x52b6b7[_0x5c63('0xc')][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0]['type'],'app':_0x5c63('0x10'),'appdata':_0x5c63('0x24'),'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'priority':_0x52b6b7['priority']++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});_0x52b6b7['extensions']['push']({'type':_0x4b1d22[_0x341ff6][0x0]['type'],'app':_0x5c63('0x10'),'appdata':_0x5c63('0x25'),'context':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x14')],'exten':_0x4b1d22[_0x341ff6][0x0]['exten'],'priority':_0x52b6b7['priority']++,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});for(var _0xb454ea=0x0,_0xf52372=0x0;_0xb454ea<_0x4b1d22[_0x341ff6][_0x5c63('0x26')];_0xb454ea+=0x1,_0xf52372=0x0){var _0x2008fc=_0x4b1d22[_0x341ff6][_0xb454ea];if(_0x2008fc[_0x5c63('0x13')]){_0x2008fc[_0x5c63('0x13')]=_0x2008fc[_0x5c63('0x13')]['toLowerCase']();}var _0x391b3c=[];var _0x5e579b=[];delete _0x2008fc['id'];delete _0x2008fc[_0x5c63('0x27')];delete _0x2008fc[_0x5c63('0x28')];var _0x11cae6=_0x2008fc['interval']!=='*,*,*,*'?[_0x2008fc[_0x5c63('0x29')]]:_0x2008fc['IntervalId']?_[_0x5c63('0x8')](_[_0x5c63('0x2a')](_0x52b6b7[_0x5c63('0x5')],{'IntervalId':_0x2008fc['IntervalId']}),_0x5c63('0x29')):[];if(_0x2008fc[_0x5c63('0xb')](_0x5c63('0x2b'))){if(_0x2008fc[_0x5c63('0x2b')]&&_0x2008fc['tag']!=='--'){_0x391b3c[_0x5c63('0xf')]({'type':_0x2008fc[_0x5c63('0x13')],'app':_0x5c63('0x10'),'appdata':_0x5c63('0x2c')+_0x2008fc['tag'],'context':_0x2008fc[_0x5c63('0x14')],'exten':_0x2008fc[_0x5c63('0x9')],'priority':_0x11cae6['length']+_0x52b6b7[_0x5c63('0x15')]+_0xf52372++,'VoiceExtensionId':_0x2008fc[_0x5c63('0x17')]});}}if(_0x2008fc[_0x5c63('0x13')]==='outbound'&&_0x2008fc['hasOwnProperty'](_0x5c63('0x2d'))){if(_0x2008fc[_0x5c63('0x2d')]){_0x391b3c[_0x5c63('0xf')]({'type':_0x2008fc[_0x5c63('0x13')],'app':_0x5c63('0x1c'),'appdata':_0x5c63('0x2e')+_0x2008fc[_0x5c63('0x2d')]+')','context':_0x2008fc[_0x5c63('0x14')],'exten':_0x2008fc[_0x5c63('0x9')],'priority':_0x11cae6[_0x5c63('0x26')]+_0x52b6b7[_0x5c63('0x15')]+_0xf52372++,'VoiceExtensionId':_0x2008fc['VoiceExtensionId']});}else{_0x391b3c['push']({'type':_0x2008fc[_0x5c63('0x13')],'app':'ExecIf','appdata':_0x5c63('0x2f'),'context':_0x2008fc[_0x5c63('0x14')],'exten':_0x2008fc['exten'],'priority':_0x11cae6[_0x5c63('0x26')]+_0x52b6b7[_0x5c63('0x15')]+_0xf52372++,'VoiceExtensionId':_0x2008fc[_0x5c63('0x17')]});}}if(_0x2008fc[_0x5c63('0xb')](_0x5c63('0x30'))){if(_0x40662f['indexOf'](_0x2008fc[_0x5c63('0x31')][_0x5c63('0x32')]())>=0x0&&_0x2008fc['appType']!==_0x5c63('0x33')){if(_0x2008fc[_0x5c63('0x30')]){_0x391b3c[_0x5c63('0xf')]({'type':_0x2008fc[_0x5c63('0x13')],'app':_0x5c63('0x1c'),'appdata':_0x5c63('0x34'),'context':_0x2008fc[_0x5c63('0x14')],'exten':_0x2008fc['exten'],'priority':_0x11cae6[_0x5c63('0x26')]+_0x52b6b7[_0x5c63('0x15')]+_0xf52372++,'VoiceExtensionId':_0x2008fc[_0x5c63('0x17')]});_0x391b3c['push']({'type':_0x2008fc['type'],'app':_0x5c63('0x10'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2008fc['context'],'exten':_0x2008fc[_0x5c63('0x9')],'priority':_0x11cae6['length']+_0x52b6b7[_0x5c63('0x15')]+_0xf52372++,'VoiceExtensionId':_0x2008fc['VoiceExtensionId']});}else{_0x391b3c[_0x5c63('0xf')]({'type':_0x2008fc[_0x5c63('0x13')],'app':_0x5c63('0x1c'),'appdata':_0x5c63('0x35'),'context':_0x2008fc['context'],'exten':_0x2008fc[_0x5c63('0x9')],'priority':_0x11cae6[_0x5c63('0x26')]+_0x52b6b7[_0x5c63('0x15')]+_0xf52372++,'VoiceExtensionId':_0x2008fc['VoiceExtensionId']});_0x391b3c[_0x5c63('0xf')]({'type':_0x2008fc[_0x5c63('0x13')],'app':_0x5c63('0x10'),'appdata':_0x5c63('0x36'),'context':_0x2008fc[_0x5c63('0x14')],'exten':_0x2008fc['exten'],'priority':_0x11cae6[_0x5c63('0x26')]+_0x52b6b7[_0x5c63('0x15')]+_0xf52372++,'VoiceExtensionId':_0x2008fc['VoiceExtensionId']});}}}for(var _0x5b8601=0x0;_0x5b8601<_0x11cae6[_0x5c63('0x26')];_0x5b8601+=0x1){var _0x205a4c=_0x52b6b7[_0x5c63('0x15')]+_0x11cae6['length'];var _0x19ba07=_0x5b8601===_0x11cae6[_0x5c63('0x26')]-0x1?_0x52b6b7[_0x5c63('0x15')]+_0x391b3c['length']+_0x5e579b[_0x5c63('0x26')]+0x2:_0x52b6b7[_0x5c63('0x15')]+_0x5b8601+0x1;_0x391b3c['splice'](_0x5b8601,0x0,{'type':_0x2008fc[_0x5c63('0x13')],'app':'GotoIfTime','appdata':_0x11cae6[_0x5b8601]+'?'+_0x2008fc['context']+',${EXTEN},'+_0x205a4c+':'+_0x2008fc[_0x5c63('0x14')]+',${EXTEN},'+_0x19ba07,'exten':_0x2008fc[_0x5c63('0x9')],'context':_0x2008fc['context'],'priority':_0x52b6b7[_0x5c63('0x15')]+_0x5b8601,'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});}_0x2008fc[_0x5c63('0x15')]=_0x391b3c[_0x5c63('0x26')]?_[_0x5c63('0x37')](_0x391b3c)[_0x5c63('0x15')]+0x1:_0x52b6b7[_0x5c63('0x15')];_0x52b6b7[_0x5c63('0x15')]=(_0x5e579b[_0x5c63('0x26')]?_[_0x5c63('0x37')](_0x5e579b)['priority']:_0x2008fc[_0x5c63('0x15')])+0x1;_0x52b6b7[_0x5c63('0xc')]=_['concat'](_0x52b6b7['extensions'],_0x391b3c,[_0x2008fc],_0x5e579b);}_0x52b6b7['extensions'][_0x5c63('0xf')]({'type':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x13')],'app':_0x5c63('0x38'),'exten':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x9')],'context':_0x4b1d22[_0x341ff6][0x0]['context'],'priority':_0x52b6b7[_0x5c63('0x15')],'VoiceExtensionId':_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]});_0x18598a[_0x5c63('0xf')](_0x4b1d22[_0x341ff6][0x0][_0x5c63('0x17')]);_0x38b357=_[_0x5c63('0x39')](_0x38b357,_0x52b6b7[_0x5c63('0xc')]);}}return _0x449e7d[_0x5c63('0x3a')](function(_0x333d95){return _0x449e7d[_0x5c63('0x7')][_0x5c63('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x18598a}},'transaction':_0x333d95})[_0x5c63('0x4')](function(_0x5a60c7){return _0x449e7d[_0x5c63('0x7')]['VoiceExtension'][_0x5c63('0x3b')](_[_0x5c63('0x3c')](_0x38b357,_0x5c63('0x15')),{'transaction':_0x333d95});});});})[_0x5c63('0x3d')](function(_0xcf6a11){console[_0x5c63('0x3e')](_0xcf6a11);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 17a51bd..a8185c0 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 _0x71f6=['where','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','into','ListId\x20=\x20?','findAll','outbound','dialCheckDuplicateType','CmList','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','VoiceQueue','BlackLists','get','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x2d7094,_0x4241e4){var _0x3d9c67=function(_0x34d46f){while(--_0x34d46f){_0x2d7094['push'](_0x2d7094['shift']());}};_0x3d9c67(++_0x4241e4);}(_0x71f6,0x1e3));var _0x671f=function(_0x2eaf39,_0x185dbb){_0x2eaf39=_0x2eaf39-0x0;var _0x4c4d87=_0x71f6[_0x2eaf39];return _0x4c4d87;};'use strict';var BPromise=require('bluebird');var util=require(_0x671f('0x0'));var _=require(_0x671f('0x1'));var fs=require('fs');var squel=require(_0x671f('0x2'));var Papa=require(_0x671f('0x3'));var Redis=require(_0x671f('0x4'));var db=require(_0x671f('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x671f('0x6'));config['redis']=_[_0x671f('0x7')](config[_0x671f('0x8')],{'host':_0x671f('0x9'),'port':0x18eb});var socket=require(_0x671f('0xa'))(new Redis(config[_0x671f('0x8')]));require(_0x671f('0xb'))[_0x671f('0xc')](socket);try{if(!process[_0x671f('0xd')][0x2]||process['argv'][0x2]===_0x671f('0xe')||process[_0x671f('0xd')][0x2]===_0x671f('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x671f('0xd')][0x2];if(!process[_0x671f('0xd')][0x3]||process['argv'][0x3]===_0x671f('0xe')||process[_0x671f('0xd')][0x3]===_0x671f('0xf')||!process['argv'][0x4]||process[_0x671f('0xd')][0x4]===_0x671f('0xe')||process[_0x671f('0xd')][0x4]==='null'){throw new Error(_0x671f('0x10'));}var FIELDS=_[_0x671f('0x11')](process[_0x671f('0xd')][0x3][_0x671f('0x12')](','),process[_0x671f('0xd')][0x4]['split'](','));if(!process[_0x671f('0xd')][0x5]||process['argv'][0x5]==='undefined'||process[_0x671f('0xd')][0x5]===_0x671f('0xf')){throw new Error(_0x671f('0x13'));}var LISTID=process[_0x671f('0xd')][0x5];var COMPANYID=process[_0x671f('0xd')][0x6]&&process[_0x671f('0xd')][0x6]!==_0x671f('0xe')&&process['argv'][0x6]!=='null'?process[_0x671f('0xd')][0x6]:null;var DUPLICATES=process[_0x671f('0xd')][0x7]&&process[_0x671f('0xd')][0x7]!=='undefined'&&process[_0x671f('0xd')][0x7]!==_0x671f('0xf')?process[_0x671f('0xd')][0x7]:null;if(!process[_0x671f('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x671f('0xd')][0x8]===_0x671f('0xf')){throw new Error(_0x671f('0x14'));}var SOCKET_TIMESTAMP=process[_0x671f('0xd')][0x8];}catch(_0x5b72a5){logger[_0x671f('0x15')](_0x5b72a5);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(_0x3973eb,_0x113236,_0x125544,_0x11b215){var _0x54eee5={'message':_0x113236};_0x54eee5[_0x3973eb]=!![];if(_0x125544){_0x54eee5['contact']=_0x125544;}if(_0x11b215){_0x54eee5['index']=_0x11b215;}return _0x54eee5;}function isEmail(_0x4cb073){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))*$/[_0x671f('0x16')](_0x4cb073);}function checkRow(_0x483e86,_0x2b2e79,_0x5a4fdf){return new BPromise(function(_0x1e651a,_0x504834){if(_[_0x671f('0x17')](_0x483e86)){return _0x504834(handleCheckRowError(_0x671f('0x15'),_0x671f('0x18'),null,_0x5a4fdf));}if(_0x483e86['errors']&&_0x483e86['errors']['length']){var _0x18c2da=_['map'](_0x483e86[_0x671f('0x19')],_0x671f('0x1a'))['join'](';');return _0x504834(handleCheckRowError(_0x671f('0x15'),_0x18c2da,null,_0x5a4fdf));}var _0x233097={};for(var _0xc6d1f4 in FIELDS){if(FIELDS[_0x671f('0x1b')](_0xc6d1f4)&&FIELDS[_0xc6d1f4]){_0x233097[_0xc6d1f4]=_0x483e86[_0x671f('0x1c')][0x0][FIELDS[_0xc6d1f4]]||_0x483e86[_0x671f('0x1c')][0x0]['\ufeff'+FIELDS[_0xc6d1f4]];}}if(!_0x233097['firstName']){return _0x504834(handleCheckRowError('error',_0x671f('0x1d'),null,_0x5a4fdf));}if(!_0x233097[_0x671f('0x1e')]){return _0x504834(handleCheckRowError('error',_0x671f('0x1f'),null,_0x5a4fdf));}if(_0x233097['birthDate']){var _0x1997ff=moment(_0x233097['birthDate'],_0x671f('0x20'));if(!_0x1997ff[_0x671f('0x21')]()){return _0x504834(handleCheckRowError(_0x671f('0x15'),_0x671f('0x22'),null,_0x5a4fdf));}}if(_0x233097[_0x671f('0x23')]){if(!isEmail(_0x233097[_0x671f('0x23')])){return _0x504834(handleCheckRowError(_0x671f('0x15'),_0x671f('0x24'),null,_0x5a4fdf));}}_0x233097[_0x671f('0x25')]=LISTID;_0x233097['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x671f('0x26')]&&_0x2b2e79){var _0x178613={};for(var _0x2e72ea=0x0,_0x2fcb06=DUPLICATES[_0x671f('0x26')];_0x2e72ea<_0x2fcb06;_0x2e72ea+=0x1){_0x178613[DUPLICATES[_0x2e72ea]]=_0x233097[DUPLICATES[_0x2e72ea]];}var _0x2c2960=_[_0x671f('0x27')](_0x2b2e79,_0x178613);if(_0x2c2960){return _0x504834(handleCheckRowError(_0x671f('0x28'),_0x671f('0x29'),_0x2c2960,_0x5a4fdf));}}return db[_0x671f('0x2a')][_0x671f('0x2b')](_0x233097,{'raw':!![],'hooks':![],'fields':_[_0x671f('0x2c')](_0x233097)})[_0x671f('0x2d')](function(_0x2c5baa){if(DUPLICATES&&DUPLICATES['length']&&_0x2b2e79){_0x2b2e79[_0x671f('0x2e')](_[_0x671f('0x2f')](_0x233097,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2c5baa['id'];return _0x1e651a();})[_0x671f('0x30')](function(_0x128313){return _0x504834(handleCheckRowError(_0x671f('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x128313[_0x671f('0x1a')]||JSON[_0x671f('0x31')](_0x128313)),null,_0x5a4fdf));});});}function checkHopper(){function _0x582c95(){return function(_0x1d9ab4){logger[_0x671f('0x15')](_0x671f('0x32'),_0x671f('0x33'),util[_0x671f('0x34')](_0x1d9ab4,{'showHidden':![],'depth':null}));};}var _0x1b70ee=function(_0x5a0ff1,_0x561085){var _0x37147e=squel[_0x671f('0x35')]()['into'](_0x671f('0x36'))[_0x671f('0x37')]([_0x671f('0x1e'),_0x671f('0x38'),_0x671f('0x39'),_0x671f('0x25'),_0x561085,_0x671f('0x3a'),_0x671f('0x3b')],squel[_0x671f('0x3c')]()[_0x671f('0x3d')](_0x671f('0x1e'),_0x671f('0x1e'))['field'](_0x671f('0x3e'),_0x671f('0x38'))[_0x671f('0x3d')]('id','ContactId')[_0x671f('0x3d')](LISTID[_0x671f('0x3f')](),_0x671f('0x25'))[_0x671f('0x3d')](_0x5a0ff1['id'][_0x671f('0x3f')](),_0x561085)['field'](_0x671f('0x3e'),_0x671f('0x3a'))[_0x671f('0x3d')](_0x671f('0x3e'),'updatedAt')[_0x671f('0x40')](_0x671f('0x41'))['where'](_0x671f('0x42'))[_0x671f('0x43')]('ListId\x20=\x20?',LISTID[_0x671f('0x3f')]())['where'](_0x671f('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x671f('0x3c')]()[_0x671f('0x3d')](_0x671f('0x1e'))[_0x671f('0x40')](_0x671f('0x36'))[_0x671f('0x43')](_0x561085+_0x671f('0x45'),_0x5a0ff1['id'][_0x671f('0x3f')]())))[_0x671f('0x3f')]();return _0x37147e;};var _0x1aa5cc=function(_0x376550,_0x25ce2f){var _0x5a6461=squel[_0x671f('0x35')]()['into'](_0x671f('0x36'))['fromQuery'](['phone','scheduledAt',_0x671f('0x39'),_0x671f('0x25'),_0x25ce2f,'createdAt',_0x671f('0x3b')],squel[_0x671f('0x3c')]()[_0x671f('0x3d')]('phone','phone')['field'](_0x671f('0x3e'),_0x671f('0x38'))[_0x671f('0x3d')]('id','ContactId')[_0x671f('0x3d')](LISTID['toString'](),_0x671f('0x25'))[_0x671f('0x3d')](_0x376550['id']['toString'](),_0x25ce2f)[_0x671f('0x3d')](_0x671f('0x3e'),_0x671f('0x3a'))['field']('NOW()',_0x671f('0x3b'))[_0x671f('0x40')](_0x671f('0x41'))[_0x671f('0x43')]('deletedAt\x20IS\x20NULL')[_0x671f('0x43')]('ListId\x20=\x20?',LISTID[_0x671f('0x3f')]())[_0x671f('0x43')](_0x671f('0x46'),squel[_0x671f('0x47')](hopperContacts))[_0x671f('0x43')](_0x671f('0x44'))[_0x671f('0x43')](_0x671f('0x48'),squel['select']()[_0x671f('0x3d')](_0x671f('0x49'))[_0x671f('0x40')](_0x671f('0x4a'))[_0x671f('0x43')](_0x25ce2f+_0x671f('0x45'),_0x376550['id']['toString']()))[_0x671f('0x43')](_0x671f('0x48'),squel[_0x671f('0x3c')]()[_0x671f('0x3d')]('phone')['from'](_0x671f('0x36'))[_0x671f('0x43')](_0x25ce2f+_0x671f('0x45'),_0x376550['id'][_0x671f('0x3f')]())))[_0x671f('0x3f')]();return _0x5a6461;};function _0x2e778a(_0x10cbca,_0x35ce50){var _0x156529=squel[_0x671f('0x35')]()[_0x671f('0x4b')](_0x671f('0x36'))['fromQuery'](['phone','scheduledAt',_0x671f('0x39'),_0x671f('0x25'),_0x35ce50,'createdAt',_0x671f('0x3b')],squel[_0x671f('0x3c')]()[_0x671f('0x3d')](_0x671f('0x1e'),_0x671f('0x1e'))['field'](_0x671f('0x3e'),'scheduledAt')['field']('id',_0x671f('0x39'))[_0x671f('0x3d')](LISTID['toString'](),_0x671f('0x25'))[_0x671f('0x3d')](_0x10cbca['id'][_0x671f('0x3f')](),_0x35ce50)[_0x671f('0x3d')]('NOW()','createdAt')[_0x671f('0x3d')]('NOW()',_0x671f('0x3b'))[_0x671f('0x40')](_0x671f('0x41'))[_0x671f('0x43')](_0x671f('0x42'))[_0x671f('0x43')](_0x671f('0x4c'),LISTID[_0x671f('0x3f')]())['where'](_0x671f('0x46'),squel[_0x671f('0x47')](hopperContacts))[_0x671f('0x43')](_0x671f('0x44')))[_0x671f('0x3f')]();return _0x156529;}function _0x10fbc7(_0x3a24cb,_0x333a54){var _0x505389=squel[_0x671f('0x35')]()[_0x671f('0x4b')]('cm_hopper_black')['fromQuery'](['phone',_0x671f('0x39'),_0x671f('0x25'),_0x333a54,_0x671f('0x3a'),_0x671f('0x3b')],squel[_0x671f('0x3c')]()[_0x671f('0x3d')](_0x671f('0x1e'),_0x671f('0x1e'))['field']('id',_0x671f('0x39'))[_0x671f('0x3d')](LISTID[_0x671f('0x3f')](),_0x671f('0x25'))[_0x671f('0x3d')](_0x3a24cb['id']['toString'](),_0x333a54)[_0x671f('0x3d')](_0x671f('0x3e'),'createdAt')[_0x671f('0x3d')](_0x671f('0x3e'),_0x671f('0x3b'))[_0x671f('0x40')]('cm_contacts')[_0x671f('0x43')](_0x671f('0x42'))[_0x671f('0x43')](_0x671f('0x4c'),LISTID['toString']())[_0x671f('0x43')]('id\x20IN\x20?',squel[_0x671f('0x47')](hopperContacts))[_0x671f('0x43')](_0x671f('0x44')))[_0x671f('0x3f')]();return _0x505389;}return db['VoiceQueue'][_0x671f('0x4d')]({'where':{'type':_0x671f('0x4e')},'attributes':['id',_0x671f('0x4f')],'include':[{'model':db[_0x671f('0x50')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2bc0f7){var _0xa8cd60=[];if(_0x2bc0f7){var _0x3fd28d;for(var _0x14153b=0x0,_0x1ec51a;_0x14153b<_0x2bc0f7['length'];_0x14153b+=0x1){_0x1ec51a=_0x2bc0f7[_0x14153b]['get']({'plain':!![]});switch(_0x1ec51a['dialCheckDuplicateType']){case _0x671f('0x51'):_0xa8cd60[_0x671f('0x2e')](db[_0x671f('0x52')][_0x671f('0x53')](_0x1aa5cc(_0x1ec51a,_0x671f('0x54')))[_0x671f('0x2d')](function(){})[_0x671f('0x30')](_0x582c95()));break;case _0x671f('0x55'):_0xa8cd60[_0x671f('0x2e')](db[_0x671f('0x52')][_0x671f('0x53')](_0x1b70ee(_0x1ec51a,_0x671f('0x54')))['then'](function(){})[_0x671f('0x30')](_0x582c95()));break;default:_0xa8cd60[_0x671f('0x2e')](db[_0x671f('0x52')][_0x671f('0x53')](_0x2e778a(_0x1ec51a,'VoiceQueueId'))['then'](function(){})[_0x671f('0x30')](_0x582c95()));}}}return _0xa8cd60;})[_0x671f('0x56')]()[_0x671f('0x2d')](function(){return db[_0x671f('0x57')][_0x671f('0x4d')]({'where':{'type':_0x671f('0x4e')},'attributes':['id'],'include':[{'model':db[_0x671f('0x50')],'as':_0x671f('0x58'),'where':{'id':LISTID}}]})[_0x671f('0x2d')](function(_0x214cdf){var _0x5a06e8=[];if(_0x214cdf){var _0x4bc5e8;for(var _0x28583b=0x0,_0x4f6723;_0x28583b<_0x214cdf[_0x671f('0x26')];_0x28583b+=0x1){_0x4f6723=_0x214cdf[_0x28583b][_0x671f('0x59')]({'plain':!![]});_0x5a06e8[_0x671f('0x2e')](db[_0x671f('0x52')][_0x671f('0x53')](_0x10fbc7(_0x4f6723,_0x671f('0x54')))[_0x671f('0x2d')](function(){})[_0x671f('0x30')](_0x582c95()));}}return _0x5a06e8;})['all']();})['then'](function(){return db['Campaign'][_0x671f('0x4d')]({'attributes':['id',_0x671f('0x4f')],'include':[{'model':db[_0x671f('0x50')],'as':'Lists','where':{'id':LISTID}}]})[_0x671f('0x2d')](function(_0x3efc3d){var _0x1f567f=[];if(_0x3efc3d){for(var _0x55bd56=0x0,_0x2674b0;_0x55bd56<_0x3efc3d[_0x671f('0x26')];_0x55bd56+=0x1){_0x2674b0=_0x3efc3d[_0x55bd56]['get']({'plain':!![]});switch(_0x2674b0[_0x671f('0x4f')]){case _0x671f('0x51'):_0x1f567f[_0x671f('0x2e')](db['sequelize'][_0x671f('0x53')](_0x1aa5cc(_0x2674b0,_0x671f('0x5a')))[_0x671f('0x2d')](function(){})['catch'](_0x582c95()));break;case'onlyIfOpen':_0x1f567f['push'](db['sequelize'][_0x671f('0x53')](_0x1b70ee(_0x2674b0,_0x671f('0x5a')))[_0x671f('0x2d')](function(){})['catch'](_0x582c95()));break;default:_0x1f567f[_0x671f('0x2e')](db[_0x671f('0x52')][_0x671f('0x53')](_0x2e778a(_0x2674b0,_0x671f('0x5a')))[_0x671f('0x2d')](function(){})[_0x671f('0x30')](_0x582c95()));}}}return _0x1f567f;})[_0x671f('0x56')]();})[_0x671f('0x2d')](function(){return db[_0x671f('0x5b')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x671f('0x50')],'as':_0x671f('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x46d72c){var _0x41f76a=[];if(_0x46d72c){for(var _0x18024e=0x0,_0x584b0e;_0x18024e<_0x46d72c[_0x671f('0x26')];_0x18024e+=0x1){_0x584b0e=_0x46d72c[_0x18024e][_0x671f('0x59')]({'plain':!![]});_0x41f76a['push'](db[_0x671f('0x52')][_0x671f('0x53')](_0x10fbc7(_0x584b0e,_0x671f('0x5a')))[_0x671f('0x2d')](function(){})[_0x671f('0x30')](_0x582c95()));}}return _0x41f76a;})['all']();})['catch'](function(_0x3b10a0){logger[_0x671f('0x15')](_0x671f('0x5c'),_0x671f('0x5d'),_0x3b10a0[_0x671f('0x1a')]);});}var processPromises=function(_0x45d015){return BPromise[_0x671f('0x56')](promises)[_0x671f('0x2d')](function(_0x528b64){})[_0x671f('0x30')](function(_0x419448){logger[_0x671f('0x15')](_0x671f('0x5e'),JSON[_0x671f('0x31')](_0x419448));})[_0x671f('0x5f')](function(){socket[_0x671f('0x60')](_0x671f('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x45d015){return _0x45d015[_0x671f('0x62')]();}});};var endCsv=function(){return BPromise[_0x671f('0x63')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x671f('0x60')](_0x671f('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x671f('0x64')](FILEPATH);}catch(_0xa342f6){logger[_0x671f('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x671f('0x31')](_0xa342f6));}finally{process[_0x671f('0x65')](0x0);}});};process['on'](_0x671f('0x66'),function(){logger['info'](_0x671f('0x67'));endCsv();});function main(){return BPromise[_0x671f('0x63')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x671f('0x12')](',');return db[_0x671f('0x2a')][_0x671f('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x28141f){var _0x1083ba=fs[_0x671f('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x671f('0x69')](_0x1083ba,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d445f,_0x595718){total+=0x1;var _0x2b01f6=total;promises['push'](checkRow(_0x5d445f,_0x28141f,_0x2b01f6)[_0x671f('0x2d')](function(){success+=0x1;})[_0x671f('0x30')](function(_0x4966a8){if(_0x4966a8[_0x671f('0x15')]){errors+=0x1;delete _0x4966a8[_0x671f('0x15')];}else if(_0x4966a8[_0x671f('0x28')]){duplicates+=0x1;delete _0x4966a8[_0x671f('0x28')];}rows['push'](_0x4966a8);}));if(total%0xc8===0x0){_0x595718['pause']();return processPromises(_0x595718);}},'complete':function(){return processPromises()[_0x671f('0x2d')](function(){logger[_0x671f('0x6a')](_0x671f('0x6b'));endCsv();});},'error':function(_0x400179,_0x2dcb76){logger[_0x671f('0x6a')](_0x671f('0x6c'),JSON[_0x671f('0x31')](_0x400179));endCsv();}});})[_0x671f('0x30')](function(_0x13b610){logger[_0x671f('0x15')](_0x671f('0x6d'),JSON['stringify'](_0x13b610));});}main(); \ No newline at end of file +var _0x98c0=['errors','map','message','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','length','duplicate','Duplicate\x20Contact','CmContact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','updatedAt','select','field','toString','NOW()','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','Campaign','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','undefined','null','zipObject','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!'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x98c0,0x128));var _0x098c=function(_0x4f78e9,_0x1cc794){_0x4f78e9=_0x4f78e9-0x0;var _0x32ec94=_0x98c0[_0x4f78e9];return _0x32ec94;};'use strict';var BPromise=require(_0x098c('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x098c('0x1'));var Papa=require('papaparse');var Redis=require(_0x098c('0x2'));var db=require(_0x098c('0x3'))['db'];var config=require(_0x098c('0x4'));var logger=require(_0x098c('0x5'))(_0x098c('0x6'));config[_0x098c('0x7')]=_[_0x098c('0x8')](config[_0x098c('0x7')],{'host':_0x098c('0x9'),'port':0x18eb});var socket=require(_0x098c('0xa'))(new Redis(config[_0x098c('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x098c('0xb')][0x2]||process[_0x098c('0xb')][0x2]===_0x098c('0xc')||process['argv'][0x2]===_0x098c('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x098c('0xb')][0x2];if(!process['argv'][0x3]||process[_0x098c('0xb')][0x3]===_0x098c('0xc')||process[_0x098c('0xb')][0x3]===_0x098c('0xd')||!process[_0x098c('0xb')][0x4]||process[_0x098c('0xb')][0x4]==='undefined'||process[_0x098c('0xb')][0x4]===_0x098c('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x098c('0xe')](process['argv'][0x3]['split'](','),process[_0x098c('0xb')][0x4][_0x098c('0xf')](','));if(!process[_0x098c('0xb')][0x5]||process[_0x098c('0xb')][0x5]===_0x098c('0xc')||process[_0x098c('0xb')][0x5]==='null'){throw new Error(_0x098c('0x10'));}var LISTID=process[_0x098c('0xb')][0x5];var COMPANYID=process[_0x098c('0xb')][0x6]&&process[_0x098c('0xb')][0x6]!==_0x098c('0xc')&&process[_0x098c('0xb')][0x6]!==_0x098c('0xd')?process[_0x098c('0xb')][0x6]:null;var DUPLICATES=process[_0x098c('0xb')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x098c('0xb')][0x7]!==_0x098c('0xd')?process[_0x098c('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0x098c('0xb')][0x8]==='undefined'||process[_0x098c('0xb')][0x8]===_0x098c('0xd')){throw new Error(_0x098c('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xd51ebd){logger[_0x098c('0x12')](_0xd51ebd);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(_0x17db93,_0x4d2375,_0x127ffb,_0x44c391){var _0x53c6f8={'message':_0x4d2375};_0x53c6f8[_0x17db93]=!![];if(_0x127ffb){_0x53c6f8['contact']=_0x127ffb;}if(_0x44c391){_0x53c6f8[_0x098c('0x13')]=_0x44c391;}return _0x53c6f8;}function isEmail(_0x27e2c6){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'](_0x27e2c6);}function checkRow(_0x4936ba,_0x1e4085,_0x1260b8){return new BPromise(function(_0x4d0ac3,_0x1f89a9){if(_[_0x098c('0x14')](_0x4936ba)){return _0x1f89a9(handleCheckRowError(_0x098c('0x12'),_0x098c('0x15'),null,_0x1260b8));}if(_0x4936ba[_0x098c('0x16')]&&_0x4936ba[_0x098c('0x16')]['length']){var _0x26a40f=_[_0x098c('0x17')](_0x4936ba['errors'],_0x098c('0x18'))['join'](';');return _0x1f89a9(handleCheckRowError(_0x098c('0x12'),_0x26a40f,null,_0x1260b8));}var _0x542ba7={};for(var _0x62e4f8 in FIELDS){if(FIELDS['hasOwnProperty'](_0x62e4f8)&&FIELDS[_0x62e4f8]){_0x542ba7[_0x62e4f8]=_0x4936ba[_0x098c('0x19')][0x0][FIELDS[_0x62e4f8]]||_0x4936ba[_0x098c('0x19')][0x0]['\ufeff'+FIELDS[_0x62e4f8]];}}if(!_0x542ba7[_0x098c('0x1a')]){return _0x1f89a9(handleCheckRowError(_0x098c('0x12'),_0x098c('0x1b'),null,_0x1260b8));}if(!_0x542ba7[_0x098c('0x1c')]){return _0x1f89a9(handleCheckRowError(_0x098c('0x12'),_0x098c('0x1d'),null,_0x1260b8));}if(_0x542ba7[_0x098c('0x1e')]){var _0x52fcc0=moment(_0x542ba7['birthDate'],'YYYY-MM-DD');if(!_0x52fcc0[_0x098c('0x1f')]()){return _0x1f89a9(handleCheckRowError('error',_0x098c('0x20'),null,_0x1260b8));}}if(_0x542ba7[_0x098c('0x21')]){if(!isEmail(_0x542ba7[_0x098c('0x21')])){return _0x1f89a9(handleCheckRowError('error',_0x098c('0x22'),null,_0x1260b8));}}_0x542ba7[_0x098c('0x23')]=LISTID;_0x542ba7['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x098c('0x24')]&&_0x1e4085){var _0x5e18bc={};for(var _0x34c5d6=0x0,_0x976e75=DUPLICATES[_0x098c('0x24')];_0x34c5d6<_0x976e75;_0x34c5d6+=0x1){_0x5e18bc[DUPLICATES[_0x34c5d6]]=_0x542ba7[DUPLICATES[_0x34c5d6]];}var _0x1b3ecc=_['find'](_0x1e4085,_0x5e18bc);if(_0x1b3ecc){return _0x1f89a9(handleCheckRowError(_0x098c('0x25'),_0x098c('0x26'),_0x1b3ecc,_0x1260b8));}}return db[_0x098c('0x27')][_0x098c('0x28')](_0x542ba7,{'raw':!![],'hooks':![],'fields':_['keys'](_0x542ba7)})['then'](function(_0x54a85f){if(DUPLICATES&&DUPLICATES[_0x098c('0x24')]&&_0x1e4085){_0x1e4085[_0x098c('0x29')](_[_0x098c('0x2a')](_0x542ba7,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x54a85f['id'];return _0x4d0ac3();})[_0x098c('0x2b')](function(_0x2f9879){return _0x1f89a9(handleCheckRowError('error',_0x098c('0x2c')+(_0x2f9879[_0x098c('0x18')]||JSON[_0x098c('0x2d')](_0x2f9879)),null,_0x1260b8));});});}function checkHopper(){function _0x48633e(){return function(_0x729988){logger[_0x098c('0x12')](_0x098c('0x2e'),_0x098c('0x2f'),util[_0x098c('0x30')](_0x729988,{'showHidden':![],'depth':null}));};}var _0x5c73e2=function(_0x42e526,_0x3c59bb){var _0xb3a48b=squel[_0x098c('0x31')]()[_0x098c('0x32')](_0x098c('0x33'))['fromQuery']([_0x098c('0x1c'),_0x098c('0x34'),_0x098c('0x35'),_0x098c('0x23'),_0x3c59bb,'createdAt',_0x098c('0x36')],squel[_0x098c('0x37')]()['field']('phone',_0x098c('0x1c'))[_0x098c('0x38')]('NOW()',_0x098c('0x34'))[_0x098c('0x38')]('id',_0x098c('0x35'))[_0x098c('0x38')](LISTID[_0x098c('0x39')](),_0x098c('0x23'))['field'](_0x42e526['id'][_0x098c('0x39')](),_0x3c59bb)[_0x098c('0x38')](_0x098c('0x3a'),_0x098c('0x3b'))['field']('NOW()',_0x098c('0x36'))[_0x098c('0x3c')](_0x098c('0x3d'))[_0x098c('0x3e')](_0x098c('0x3f'))[_0x098c('0x3e')](_0x098c('0x40'),LISTID[_0x098c('0x39')]())['where'](_0x098c('0x41'))['where'](_0x098c('0x42'),squel['select']()[_0x098c('0x38')]('phone')['from'](_0x098c('0x33'))[_0x098c('0x3e')](_0x3c59bb+'\x20=\x20?',_0x42e526['id'][_0x098c('0x39')]())))['toString']();return _0xb3a48b;};var _0x42f03c=function(_0xcfeddf,_0x52efc9){var _0x2c88ac=squel[_0x098c('0x31')]()[_0x098c('0x32')](_0x098c('0x33'))[_0x098c('0x43')](['phone',_0x098c('0x34'),_0x098c('0x35'),_0x098c('0x23'),_0x52efc9,_0x098c('0x3b'),_0x098c('0x36')],squel['select']()[_0x098c('0x38')]('phone',_0x098c('0x1c'))['field'](_0x098c('0x3a'),_0x098c('0x34'))[_0x098c('0x38')]('id',_0x098c('0x35'))[_0x098c('0x38')](LISTID[_0x098c('0x39')](),_0x098c('0x23'))[_0x098c('0x38')](_0xcfeddf['id']['toString'](),_0x52efc9)[_0x098c('0x38')](_0x098c('0x3a'),_0x098c('0x3b'))['field'](_0x098c('0x3a'),'updatedAt')[_0x098c('0x3c')](_0x098c('0x3d'))[_0x098c('0x3e')](_0x098c('0x3f'))[_0x098c('0x3e')](_0x098c('0x40'),LISTID[_0x098c('0x39')]())[_0x098c('0x3e')](_0x098c('0x44'),squel[_0x098c('0x45')](hopperContacts))[_0x098c('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x098c('0x3e')](_0x098c('0x42'),squel['select']()['field'](_0x098c('0x46'))[_0x098c('0x3c')](_0x098c('0x47'))['where'](_0x52efc9+_0x098c('0x48'),_0xcfeddf['id'][_0x098c('0x39')]()))[_0x098c('0x3e')](_0x098c('0x42'),squel['select']()['field'](_0x098c('0x1c'))[_0x098c('0x3c')](_0x098c('0x33'))[_0x098c('0x3e')](_0x52efc9+'\x20=\x20?',_0xcfeddf['id']['toString']())))[_0x098c('0x39')]();return _0x2c88ac;};function _0x505a20(_0x2fd0b7,_0x5c0f75){var _0x4c7a84=squel['insert']()[_0x098c('0x32')](_0x098c('0x33'))[_0x098c('0x43')](['phone','scheduledAt','ContactId',_0x098c('0x23'),_0x5c0f75,_0x098c('0x3b'),'updatedAt'],squel[_0x098c('0x37')]()['field']('phone','phone')[_0x098c('0x38')]('NOW()',_0x098c('0x34'))[_0x098c('0x38')]('id',_0x098c('0x35'))[_0x098c('0x38')](LISTID['toString'](),_0x098c('0x23'))[_0x098c('0x38')](_0x2fd0b7['id'][_0x098c('0x39')](),_0x5c0f75)[_0x098c('0x38')](_0x098c('0x3a'),'createdAt')[_0x098c('0x38')](_0x098c('0x3a'),_0x098c('0x36'))[_0x098c('0x3c')]('cm_contacts')[_0x098c('0x3e')]('deletedAt\x20IS\x20NULL')[_0x098c('0x3e')](_0x098c('0x40'),LISTID['toString']())[_0x098c('0x3e')](_0x098c('0x44'),squel[_0x098c('0x45')](hopperContacts))[_0x098c('0x3e')](_0x098c('0x41')))[_0x098c('0x39')]();return _0x4c7a84;}function _0x18ea19(_0x521364,_0x237f22){var _0x44ef65=squel[_0x098c('0x31')]()[_0x098c('0x32')]('cm_hopper_black')[_0x098c('0x43')](['phone',_0x098c('0x35'),'ListId',_0x237f22,_0x098c('0x3b'),_0x098c('0x36')],squel[_0x098c('0x37')]()['field'](_0x098c('0x1c'),_0x098c('0x1c'))[_0x098c('0x38')]('id',_0x098c('0x35'))['field'](LISTID[_0x098c('0x39')](),_0x098c('0x23'))[_0x098c('0x38')](_0x521364['id'][_0x098c('0x39')](),_0x237f22)[_0x098c('0x38')](_0x098c('0x3a'),'createdAt')[_0x098c('0x38')](_0x098c('0x3a'),'updatedAt')[_0x098c('0x3c')]('cm_contacts')[_0x098c('0x3e')]('deletedAt\x20IS\x20NULL')[_0x098c('0x3e')](_0x098c('0x40'),LISTID[_0x098c('0x39')]())[_0x098c('0x3e')](_0x098c('0x44'),squel[_0x098c('0x45')](hopperContacts))[_0x098c('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x44ef65;}return db[_0x098c('0x49')][_0x098c('0x4a')]({'where':{'type':_0x098c('0x4b')},'attributes':['id',_0x098c('0x4c')],'include':[{'model':db[_0x098c('0x4d')],'as':_0x098c('0x4e'),'where':{'id':LISTID}}]})[_0x098c('0x4f')](function(_0x31b9c8){var _0x3baf6b=[];if(_0x31b9c8){var _0x364406;for(var _0x3f9430=0x0,_0x2b12bb;_0x3f9430<_0x31b9c8['length'];_0x3f9430+=0x1){_0x2b12bb=_0x31b9c8[_0x3f9430][_0x098c('0x50')]({'plain':!![]});switch(_0x2b12bb[_0x098c('0x4c')]){case _0x098c('0x51'):_0x3baf6b['push'](db['sequelize'][_0x098c('0x52')](_0x42f03c(_0x2b12bb,_0x098c('0x53')))[_0x098c('0x4f')](function(){})[_0x098c('0x2b')](_0x48633e()));break;case _0x098c('0x54'):_0x3baf6b[_0x098c('0x29')](db[_0x098c('0x55')][_0x098c('0x52')](_0x5c73e2(_0x2b12bb,_0x098c('0x53')))['then'](function(){})[_0x098c('0x2b')](_0x48633e()));break;default:_0x3baf6b['push'](db[_0x098c('0x55')][_0x098c('0x52')](_0x505a20(_0x2b12bb,_0x098c('0x53')))[_0x098c('0x4f')](function(){})['catch'](_0x48633e()));}}}return _0x3baf6b;})[_0x098c('0x56')]()[_0x098c('0x4f')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x098c('0x4b')},'attributes':['id'],'include':[{'model':db[_0x098c('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x098c('0x4f')](function(_0x5a6ea2){var _0x4a41b9=[];if(_0x5a6ea2){var _0x2298f6;for(var _0x4bff8c=0x0,_0xfd7cd5;_0x4bff8c<_0x5a6ea2['length'];_0x4bff8c+=0x1){_0xfd7cd5=_0x5a6ea2[_0x4bff8c]['get']({'plain':!![]});_0x4a41b9[_0x098c('0x29')](db[_0x098c('0x55')][_0x098c('0x52')](_0x18ea19(_0xfd7cd5,_0x098c('0x53')))[_0x098c('0x4f')](function(){})[_0x098c('0x2b')](_0x48633e()));}}return _0x4a41b9;})[_0x098c('0x56')]();})['then'](function(){return db[_0x098c('0x57')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x098c('0x4d')],'as':_0x098c('0x4e'),'where':{'id':LISTID}}]})[_0x098c('0x4f')](function(_0x4df8fd){var _0x5b370c=[];if(_0x4df8fd){for(var _0x56926f=0x0,_0x15b581;_0x56926f<_0x4df8fd[_0x098c('0x24')];_0x56926f+=0x1){_0x15b581=_0x4df8fd[_0x56926f]['get']({'plain':!![]});switch(_0x15b581[_0x098c('0x4c')]){case'always':_0x5b370c[_0x098c('0x29')](db[_0x098c('0x55')][_0x098c('0x52')](_0x42f03c(_0x15b581,_0x098c('0x58')))[_0x098c('0x4f')](function(){})['catch'](_0x48633e()));break;case'onlyIfOpen':_0x5b370c[_0x098c('0x29')](db[_0x098c('0x55')][_0x098c('0x52')](_0x5c73e2(_0x15b581,_0x098c('0x58')))[_0x098c('0x4f')](function(){})[_0x098c('0x2b')](_0x48633e()));break;default:_0x5b370c[_0x098c('0x29')](db[_0x098c('0x55')][_0x098c('0x52')](_0x505a20(_0x15b581,_0x098c('0x58')))[_0x098c('0x4f')](function(){})[_0x098c('0x2b')](_0x48633e()));}}}return _0x5b370c;})[_0x098c('0x56')]();})['then'](function(){return db[_0x098c('0x57')][_0x098c('0x4a')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x098c('0x59'),'where':{'id':LISTID}}]})[_0x098c('0x4f')](function(_0xadb945){var _0x327f8d=[];if(_0xadb945){for(var _0x24523e=0x0,_0x11b674;_0x24523e<_0xadb945[_0x098c('0x24')];_0x24523e+=0x1){_0x11b674=_0xadb945[_0x24523e]['get']({'plain':!![]});_0x327f8d[_0x098c('0x29')](db[_0x098c('0x55')][_0x098c('0x52')](_0x18ea19(_0x11b674,_0x098c('0x58')))['then'](function(){})[_0x098c('0x2b')](_0x48633e()));}}return _0x327f8d;})[_0x098c('0x56')]();})[_0x098c('0x2b')](function(_0xb19af0){logger[_0x098c('0x12')]('cmContact,\x20%s,\x20%s',_0x098c('0x5a'),_0xb19af0[_0x098c('0x18')]);});}var processPromises=function(_0x1bdd02){return BPromise['all'](promises)['then'](function(_0x2b84c7){})[_0x098c('0x2b')](function(_0x54b7b2){logger[_0x098c('0x12')](_0x098c('0x5b'),JSON[_0x098c('0x2d')](_0x54b7b2));})['finally'](function(){socket['emit'](_0x098c('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1bdd02){return _0x1bdd02[_0x098c('0x5d')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x098c('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0x098c('0x4f')](function(){socket[_0x098c('0x5e')](_0x098c('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x098c('0x5f')](FILEPATH);}catch(_0x2e8283){logger[_0x098c('0x12')](_0x098c('0x60'),JSON[_0x098c('0x2d')](_0x2e8283));}finally{process[_0x098c('0x61')](0x0);}});};process['on'](_0x098c('0x62'),function(){logger[_0x098c('0x63')](_0x098c('0x64'));endCsv();});function main(){return BPromise[_0x098c('0x65')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x098c('0xf')](',');return db[_0x098c('0x27')][_0x098c('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x098c('0x4f')](function(_0x1a0309){var _0x554e6a=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x554e6a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x19626f,_0x3c0827){total+=0x1;var _0x2065a7=total;promises[_0x098c('0x29')](checkRow(_0x19626f,_0x1a0309,_0x2065a7)[_0x098c('0x4f')](function(){success+=0x1;})[_0x098c('0x2b')](function(_0x2d4eaa){if(_0x2d4eaa[_0x098c('0x12')]){errors+=0x1;delete _0x2d4eaa[_0x098c('0x12')];}else if(_0x2d4eaa[_0x098c('0x25')]){duplicates+=0x1;delete _0x2d4eaa[_0x098c('0x25')];}rows[_0x098c('0x29')](_0x2d4eaa);}));if(total%0xc8===0x0){_0x3c0827[_0x098c('0x66')]();return processPromises(_0x3c0827);}},'complete':function(){return processPromises()['then'](function(){logger[_0x098c('0x63')](_0x098c('0x67'));endCsv();});},'error':function(_0x146b7e,_0x67e30){logger[_0x098c('0x63')](_0x098c('0x68'),JSON[_0x098c('0x2d')](_0x146b7e));endCsv();}});})['catch'](function(_0x128517){logger[_0x098c('0x12')](_0x098c('0x69'),JSON[_0x098c('0x2d')](_0x128517));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3a0919f..f5b925c 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 _0xa62e=['OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','message','exit','code','sequelize','query','spread','catch','error','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','info','main','send','clone','socket_timestamp','server/files/tmp','.csv','includes','keys','ContactItemType','name','_description','header','writeFileSync','data','rows','errors','find','hasOwnProperty','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','trim','itemTypeId','SystemRow','contact:import:','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','binding','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','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_contacts.updatedAt','insert','cm_hopper_black','ContactId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.createdAt','cm_contacts.priority','priority','UserId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId'];(function(_0x16c6ad,_0x1de5c8){var _0x3fdde6=function(_0x29ed1e){while(--_0x29ed1e){_0x16c6ad['push'](_0x16c6ad['shift']());}};_0x3fdde6(++_0x1de5c8);}(_0xa62e,0x114));var _0xea62=function(_0x394f2c,_0x5d4de7){_0x394f2c=_0x394f2c-0x0;var _0x134114=_0xa62e[_0x394f2c];return _0x134114;};'use strict';var fs=require('fs');var path=require(_0xea62('0x0'));var _=require(_0xea62('0x1'));var Papa=require('papaparse');var util=require(_0xea62('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xea62('0x3'));var Redis=require(_0xea62('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0xea62('0x5'));var logger=require(_0xea62('0x6'))(_0xea62('0x7'));config[_0xea62('0x8')]=_[_0xea62('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea62('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xea62('0xa')](_0xea62('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xea62('0xa')](_0xea62('0xb'));function isEmail(_0x42dbf9){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))*$/[_0xea62('0xc')](_0x42dbf9);}function selectNotIn(_0x2d854f,_0x40bd93,_0x29f91d,_0x102b2d,_0x5151e5){return squel[_0xea62('0xd')]()[_0xea62('0xe')](_0xea62('0xf'))[_0xea62('0x10')](_0x102b2d)[_0xea62('0x11')](_0x40bd93,null,_0x40bd93+_0xea62('0x12')+_0x102b2d+'.'+_0x29f91d)[_0xea62('0x13')](_0x102b2d+'.'+_0x29f91d+_0xea62('0x14')+_0x2d854f+'.'+_0x29f91d)[_0xea62('0x13')](_0x40bd93+_0xea62('0x15')+_0x5151e5['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4b3b79,_0x2823d3){promisesAdditionalPhones=[];return db[_0xea62('0x16')][_0xea62('0x17')]({'raw':!![],'attributes':['id',_0xea62('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xea62('0x19')](function(_0x315fb0){if(_0x315fb0!==null){var _0x3e0fa2=[];for(var _0x41d3a1=0x0;_0x41d3a1<_0x315fb0[_0xea62('0x1a')];_0x41d3a1++){var _0x3e9fa2=_0x315fb0[_0x41d3a1];_0x3e0fa2[_0xea62('0x1b')](insertAdditionalPhones(_0x3e9fa2));}}Promise[_0xea62('0x1c')](_0x3e0fa2)[_0xea62('0x19')](function(){_0x4b3b79({'val':0x1});});});});}function insertAdditionalPhones(_0x38e470){return new Promise(function(_0x46b017,_0x2f57cf){var _0x19eba2=_0x38e470[_0xea62('0x18')];var _0x514075=_0x19eba2[_0xea62('0x1d')](';');var _0x4e1a4a=[];orderBy=0x0;for(var _0x400fce=0x0;_0x400fce<_0x514075[_0xea62('0x1a')];_0x400fce++){_0x4e1a4a[_0xea62('0x1b')](splitAdditionalPhone(_0x38e470['id'],_0x514075[_0x400fce]));}Promise['all'](_0x4e1a4a)[_0xea62('0x19')](function(){_0x46b017({'val':_0x514075[_0xea62('0x1a')]});});});}function splitAdditionalPhone(_0x2e23a2,_0x263c9b){return new Promise(function(_0x1f5d8c,_0x3d1e3f){var _0x6761d7=_0x263c9b[_0xea62('0x1d')](':');var _0x35d00b=_0x6761d7[0x0];var _0x54e19e=_0x6761d7[0x1];if(!_[_0xea62('0x1e')](_0x54e19e)){var _0x3f551a=_0x54e19e[_0xea62('0x1d')]('|');var _0x6f1506=[];for(var _0x545545=0x0;_0x545545<_0x3f551a[_0xea62('0x1a')];_0x545545++){if(_0x3f551a[_0x545545]!==''){var _0x20427a=_[_0xea62('0x1f')](promisesAdditionalPhones,{'contactId':_0x2e23a2,'phone':_0x3f551a[_0x545545]});if(_0x20427a[_0xea62('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xea62('0x1b')]({'contactId':_0x2e23a2,'contactTypeId':_0x35d00b,'phone':_0x3f551a[_0x545545],'orderBy':orderBy});}}}_0x1f5d8c({'ok':0x1});}else _0x1f5d8c({'res':0x0});});}function createAdditionalPhone(_0xb188bd,_0x151f2f,_0x5674aa,_0x49f3cf){var _0xbcf892='';var _0xdae6a5='';var _0x2e18fb=_0x5674aa[_0xea62('0x1d')]('§');_0xbcf892=_0x2e18fb[0x0];if(_0x2e18fb[_0xea62('0x1a')]==0x2)_0xdae6a5=_0x2e18fb[0x1];return new Promise(function(_0x8f7b51,_0x2d17ae){return db[_0xea62('0x20')][_0xea62('0x21')]({'where':{'CmContactId':_0xb188bd,'item':_0xbcf892}})[_0xea62('0x19')](function(_0x4fba30){if(_0x4fba30){return db[_0xea62('0x20')][_0xea62('0x22')]({'ItemTypeId':_0x151f2f,'description':_0xdae6a5,'OrderBy':_0x49f3cf},{'where':{'CmContactId':_0xb188bd,'item':_0xbcf892}})[_0xea62('0x19')](function(_0x5bceda){_0x8f7b51({'res':_0xea62('0x23')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0xb188bd,'item':_0xbcf892,'description':_0xdae6a5,'ItemTypeId':_0x151f2f,'OrderBy':_0x49f3cf,'ItemClass':'PHONE'})[_0xea62('0x19')](function(_0x38c601){_0x8f7b51({'res':_0xea62('0x24')});});}});});}function insertCmHopper(_0xffa270,_0x241979,_0x522d6d,_0x284391,_0x197f83){var _0x5238b3=[_0xea62('0x25'),_0xea62('0x26'),_0xea62('0x27'),_0xea62('0x28'),_0x241979+'.'+_0x284391,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0xea62('0x29'),'\x22'+_0x197f83+'\x22'];return squel['insert']()[_0xea62('0x2a')](_0xea62('0x2b'))[_0xea62('0x2c')](['phone',_0xea62('0x2d'),'ContactId',_0xea62('0x2e'),_0x284391,_0xea62('0x2f'),_0xea62('0x30'),'priority','UserId',_0xea62('0x31')],squel[_0xea62('0xd')]()[_0xea62('0x32')](_0x5238b3)[_0xea62('0x10')](_0x241979)['join'](_0xea62('0x33'),null,_0xea62('0x34')+_0x241979+_0xea62('0x35'))['join'](_0x522d6d,null,_0x522d6d+_0xea62('0x12')+_0x241979+'.'+_0x284391)[_0xea62('0x13')](_0x241979+_0xea62('0x36'),_0xffa270)[_0xea62('0x13')](_0xea62('0x37'),NOW)['where'](_0xea62('0x38'),selectNotIn(_0x241979,_0x522d6d,_0x284391,_0xea62('0x2b'),[_0xea62('0x39'),_0xea62('0x3a')]))[_0xea62('0x13')](_0xea62('0x38'),selectNotIn(_0x241979,_0x522d6d,_0x284391,_0xea62('0x2b'),[_0xea62('0x39')])))[_0xea62('0x3b')]();}function insertCmHopperBlack(_0x8b540a,_0x188f98,_0x4b0f7b,_0x5f251d){var _0xb73fbb=[_0xea62('0x25'),'cm_contacts.id',_0xea62('0x28'),_0x188f98+'.'+_0x5f251d,'cm_contacts.createdAt',_0xea62('0x3c')];return squel[_0xea62('0x3d')]()[_0xea62('0x2a')](_0xea62('0x3e'))[_0xea62('0x2c')]([_0xea62('0xf'),_0xea62('0x3f'),_0xea62('0x2e'),_0x5f251d,_0xea62('0x2f'),'updatedAt'],squel[_0xea62('0xd')]()[_0xea62('0x32')](_0xb73fbb)[_0xea62('0x10')](_0x188f98)[_0xea62('0x11')]('cm_contacts',null,_0xea62('0x34')+_0x188f98+_0xea62('0x35'))[_0xea62('0x11')](_0x4b0f7b,null,_0x4b0f7b+_0xea62('0x12')+_0x188f98+'.'+_0x5f251d)[_0xea62('0x13')](_0x188f98+_0xea62('0x36'),_0x8b540a)[_0xea62('0x13')](_0xea62('0x37'),NOW)[_0xea62('0x13')](_0xea62('0x38'),squel[_0xea62('0xd')]()[_0xea62('0xe')](_0xea62('0xf'))['from'](_0xea62('0x3e'))[_0xea62('0x13')](_0xea62('0x40'),_0x8b540a)[_0xea62('0x13')](_0x5f251d+_0xea62('0x14')+_0x188f98+'.'+_0x5f251d)))[_0xea62('0x3b')]();}function insertTzCmHopper(_0x3b8d6c,_0x1530da,_0x3bf27f,_0x21976f,_0x3463ba,_0x54c9d2){var _0x244d74=[_0xea62('0x25'),_0xea62('0x41')+_0x54c9d2+_0xea62('0x42'),'cm_contacts.id',_0xea62('0x28'),_0x1530da+'.'+_0x21976f,_0xea62('0x43'),_0xea62('0x3c'),_0xea62('0x44'),_0xea62('0x29'),'\x22'+_0x3463ba+'\x22'];var _0x1cf6d9=squel[_0xea62('0x3d')]()[_0xea62('0x2a')](_0xea62('0x2b'))['fromQuery']([_0xea62('0xf'),_0xea62('0x2d'),_0xea62('0x3f'),_0xea62('0x2e'),_0x21976f,_0xea62('0x2f'),_0xea62('0x30'),_0xea62('0x45'),_0xea62('0x46'),_0xea62('0x31')],squel[_0xea62('0xd')]()[_0xea62('0x32')](_0x244d74)['from'](_0x1530da)[_0xea62('0x11')](_0xea62('0x33'),null,_0xea62('0x34')+_0x1530da+_0xea62('0x35'))[_0xea62('0x11')](_0x3bf27f,null,_0x3bf27f+_0xea62('0x12')+_0x1530da+'.'+_0x21976f)['join'](_0x54c9d2,null,_0x54c9d2+_0xea62('0x12')+_0x1530da+'.'+_0x21976f)['where'](_0x1530da+_0xea62('0x36'),_0x3b8d6c)['where'](_0xea62('0x37'),NOW)[_0xea62('0x13')](_0xea62('0x38'),selectNotIn(_0x1530da,_0x3bf27f,_0x21976f,_0xea62('0x2b'),[_0xea62('0x39'),_0xea62('0x3a')]))[_0xea62('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1530da,_0x3bf27f,_0x21976f,_0xea62('0x2b'),['\x22always\x22'])))[_0xea62('0x3b')]();return _0x1cf6d9;}function insertTzCmHopperBlack(_0x572bd1,_0x3f52a4,_0x40b88e,_0x569f36){var _0x3713c4=[_0xea62('0x25'),_0xea62('0x27'),_0xea62('0x28'),_0x3f52a4+'.'+_0x569f36,_0xea62('0x43'),_0xea62('0x3c')];return squel['insert']()['into'](_0xea62('0x3e'))['fromQuery']([_0xea62('0xf'),_0xea62('0x3f'),'ListId',_0x569f36,_0xea62('0x2f'),_0xea62('0x30')],squel[_0xea62('0xd')]()[_0xea62('0x32')](_0x3713c4)['from'](_0x3f52a4)[_0xea62('0x11')]('cm_contacts',null,_0xea62('0x34')+_0x3f52a4+'.CmListId')[_0xea62('0x11')](_0x40b88e,null,_0x40b88e+_0xea62('0x12')+_0x3f52a4+'.'+_0x569f36)[_0xea62('0x13')](_0x3f52a4+_0xea62('0x36'),_0x572bd1)[_0xea62('0x13')](_0xea62('0x37'),NOW)[_0xea62('0x13')](_0xea62('0x38'),squel[_0xea62('0xd')]()[_0xea62('0xe')]('phone')['from'](_0xea62('0x3e'))[_0xea62('0x13')](_0xea62('0x40'),_0x572bd1)[_0xea62('0x13')](_0x569f36+'\x20=\x20'+_0x3f52a4+'.'+_0x569f36)))['toString']();}function insertCmHopperAdditionalPhones(_0x3c52c7){var _0x273151=[_0xea62('0x47'),_0xea62('0x48'),'cm_contact_has_items.OrderBy',_0xea62('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0xea62('0x3d')]()[_0xea62('0x2a')](_0xea62('0x4a'))[_0xea62('0x2c')]([_0xea62('0x4b'),_0xea62('0xf'),_0xea62('0x4c'),_0xea62('0x2f'),'updatedAt'],squel[_0xea62('0xd')]()[_0xea62('0x32')](_0x273151)[_0xea62('0x10')](_0xea62('0x2b'))[_0xea62('0x11')](_0xea62('0x33'),null,_0xea62('0x4d'))[_0xea62('0x11')](_0xea62('0x4e'),null,_0xea62('0x4f'))[_0xea62('0x13')](_0xea62('0x50'),_0x3c52c7)[_0xea62('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xea62('0x3b')]();}function insertCmContact(_0xe10ab0,_0x1c8821,_0x39f9bb,_0x1c08e2){var _0x2b45d5=_[_0xea62('0x51')](_['keys'](_0x1c08e2),[_0xea62('0x2e'),_0xea62('0x52'),_0xea62('0x2f'),'updatedAt',_0xea62('0x53')]);return squel[_0xea62('0x3d')]()[_0xea62('0x2a')]('cm_contacts')[_0xea62('0x2c')](_0x2b45d5,squel[_0xea62('0xd')]()['fields'](_0x2b45d5)['from'](_0x1c8821)['where']('('+_0x39f9bb[_0xea62('0x11')](',')+_0xea62('0x54'),squel[_0xea62('0xd')]()[_0xea62('0x32')](_0x39f9bb)[_0xea62('0x10')](_0xea62('0x33'))[_0xea62('0x13')](_0xea62('0x40'),_0xe10ab0)['where'](_0xea62('0x55')))[_0xea62('0x13')](_0xea62('0x56'),squel['select']()[_0xea62('0xe')](_0xea62('0x57'),_0xea62('0x58'))[_0xea62('0x10')](_0x1c8821)[_0xea62('0x59')](_0x39f9bb['join'](','))))[_0xea62('0x3b')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5cba3f){logger['error'](_0x5cba3f[_0xea62('0x5a')]);process[_0xea62('0x5b')](0x1);}function handleError(_0x5163bf,_0x45e8c2){stats['errors'][_0xea62('0x1b')]({'name':_0x45e8c2[_0xea62('0x5c')],'message':_0x45e8c2[_0xea62('0x5a')],'row':_0x5163bf});}function handleQuery(_0x3f789c){logger['info'](_0x3f789c);return db[_0xea62('0x5d')][_0xea62('0x5e')](_0x3f789c)[_0xea62('0x5f')](function(_0x257649){results[_0xea62('0x1b')](_0x257649);})[_0xea62('0x60')](function(_0x4027af){logger[_0xea62('0x61')](_0x4027af[_0xea62('0x5a')]);});}function updateTzCampaigns(_0x222310){return new Promise(function(_0x4b2d70,_0x59e9aa){var _0x3ee4db=squel[_0xea62('0xd')]()[_0xea62('0x32')](['campaigns.id','campaigns.dialTimezone'])[_0xea62('0x10')](_0xea62('0x62'))['join'](_0xea62('0x63'),null,_0xea62('0x64'))[_0xea62('0x13')]('campaigns_has_cm_lists.CmListId='+_0x222310);db['sequelize'][_0xea62('0x5e')](_0x3ee4db['toString']())['spread'](function(_0x36aa39){var _0x5e6a2b=[];for(var _0x1e65e6=0x0;_0x1e65e6<_0x36aa39[_0xea62('0x1a')];_0x1e65e6++){_0x5e6a2b[_0xea62('0x1b')](getTimezoneData(_0x36aa39[_0x1e65e6],tmp_campaigns));}BPromise['all'](_0x5e6a2b)[_0xea62('0x19')](function(){_0x4b2d70({'val':0x1});});})[_0xea62('0x60')](function(_0xec225){logger[_0xea62('0x61')](_0xec225[_0xea62('0x5a')]);_0x4b2d70({'val':0x0});});});}function updateTzVoiceQueues(_0x5da20c){return new Promise(function(_0x53dfb6,_0x4ea8cf){var _0x394ff6=squel['select']()['fields']([_0xea62('0x65'),_0xea62('0x66')])['from'](_0xea62('0x67'))[_0xea62('0x11')]('voice_queues_has_cm_lists',null,_0xea62('0x68'))['where'](_0xea62('0x69')+_0x5da20c);db[_0xea62('0x5d')][_0xea62('0x5e')](_0x394ff6[_0xea62('0x3b')]())[_0xea62('0x5f')](function(_0x47fcad){var _0x12948b=[];for(var _0x4703bf=0x0;_0x4703bf<_0x47fcad[_0xea62('0x1a')];_0x4703bf++){_0x12948b[_0xea62('0x1b')](getTimezoneData(_0x47fcad[_0x4703bf],tmp_voice_queues));}BPromise[_0xea62('0x1c')](_0x12948b)['then'](function(){_0x53dfb6({'val':0x1});});})['catch'](function(_0x23b7fa){logger[_0xea62('0x61')](_0x23b7fa[_0xea62('0x5a')]);_0x53dfb6({'val':0x0});});});}function getTimezoneData(_0x19c536,_0x59583b){return new Promise(function(_0x40c566,_0x20f5b4){var _0x346bf5=shared[_0xea62('0x6a')];var _0x41e600=_0x346bf5[_0x19c536[_0xea62('0x6b')]];if(_['isNil'](_0x41e600)){_0x40c566({'ret':0x1});}else{var _0x48919f=_0x41e600['utcOffset'];var _0x39c696=squel['insert']()[_0xea62('0x2a')](_0x59583b)[_0xea62('0x6c')]('id',_0x19c536['id'])[_0xea62('0x6c')]('offset',_0x48919f)[_0xea62('0x6c')]('dialTimezone',_0x19c536[_0xea62('0x6b')])[_0xea62('0x3b')]();return db[_0xea62('0x5d')][_0xea62('0x5e')](_0x39c696)[_0xea62('0x5f')](function(_0x418585){_0x40c566({'ret':0x1});})[_0xea62('0x60')](function(_0x160bfb){logger[_0xea62('0x61')](_0x160bfb[_0xea62('0x5a')]);_0x20f5b4({'ret':0x1});});}});}function handleTZQuery(_0x2901a8){logger[_0xea62('0x6d')](_0x2901a8);return db[_0xea62('0x5d')]['query'](_0x2901a8)[_0xea62('0x5f')](function(_0x5ebca6){})['catch'](function(_0x3df131){logger[_0xea62('0x61')](_0x3df131[_0xea62('0x5a')]);});}function main(_0x204b7d,_0x1743e5,_0x2ce380,_0x50d044){logger[_0xea62('0x6d')](_0xea62('0x6e'),_0x204b7d,JSON['stringify'](_0x1743e5));process[_0xea62('0x6f')]('start');var _0x17ebc8=_0x1743e5['binding'];var _0x19ce47=_[_0xea62('0x70')](_0x17ebc8);var _0x185cd0=_0x1743e5[_0xea62('0x71')];var _0x47ccac=path[_0xea62('0x11')](config['root'],_0xea62('0x72'),_0x185cd0+_0xea62('0x73'));hasTZ=_['keys'](_0x17ebc8)[_0xea62('0x74')](_0xea62('0x6b'));var _0x3319ca=_[_0xea62('0x75')](_0x17ebc8)[_0xea62('0x11')]();logger[_0xea62('0x6d')]('header',_0x3319ca);db[_0xea62('0x76')]['findAll']({'raw':!![],'attributes':['id',_0xea62('0x77')]})['then'](function(_0x52d2f1){for(var _0x318fac=0x0;_0x318fac<_0x52d2f1[_0xea62('0x1a')];_0x318fac++){if(_0x52d2f1[_0x318fac][_0xea62('0x77')]in _0x17ebc8){contactItemTypes[_0xea62('0x1b')](_0x52d2f1[_0x318fac]);delete _0x19ce47[_0x52d2f1[_0x318fac]['name']];hasAdditionalPhones=!![];}for(var _0x93d842 in _0x17ebc8){if(_0x52d2f1[_0x318fac][_0xea62('0x77')]+_0xea62('0x78')===_0x93d842){phoneDescriptions['push']({'itemTypeId':_0x52d2f1[_0x318fac]['id'],'description':_0x93d842});delete _0x19ce47[_0x93d842];}}}if(hasAdditionalPhones)_0x19ce47[_0xea62('0x18')]='';var _0x39ab08=_[_0xea62('0x75')](_0x19ce47)['join']();logger[_0xea62('0x6d')](_0xea62('0x79'),_0x39ab08);fs[_0xea62('0x7a')](_0x47ccac,_0x39ab08+'\x0a');Papa['parse'](fs['createReadStream'](_0x204b7d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x13a78e,_0x9591ff){try{for(var _0x23e3b9=0x0,_0x39a8f8=[];_0x23e3b9<_0x13a78e[_0xea62('0x7b')]['length'];_0x23e3b9++){stats[_0xea62('0x7c')]+=0x1;if(_0x13a78e['errors'][_0x23e3b9]){handleError(_0x13a78e[_0xea62('0x7b')][_0x23e3b9],_0x13a78e[_0xea62('0x7d')][_0x23e3b9]);}else{var _0x409c91=[];var _0x57ce0a=[];var _0x1f306d={};for(var _0x1cedf7 in _0x17ebc8){let _0x3c37a7=contactItemTypes[_0xea62('0x7e')](_0x13f618=>_0x13f618[_0xea62('0x77')]===_0x1cedf7);let _0x37c4ec=contactItemTypes[_0xea62('0x7e')](_0x271bd9=>_0x271bd9[_0xea62('0x77')]+_0xea62('0x78')===_0x1cedf7);if(_['isNil'](_0x3c37a7)&&_[_0xea62('0x1e')](_0x37c4ec)){if(_0x17ebc8[_0xea62('0x7f')](_0x1cedf7)){if(_0x13a78e[_0xea62('0x7b')][_0x23e3b9][_0x17ebc8[_0x1cedf7]]){var _0x48610d=_['trim'](_0x13a78e[_0xea62('0x7b')][_0x23e3b9][_0x17ebc8[_0x1cedf7]][_0xea62('0x80')](/"/g,'\x27'));switch(_0x1cedf7){case _0xea62('0x2d'):var _0x214cf0=moment(_0x48610d,_0xea62('0xb'),!![]);if(_0x214cf0['isValid']()){_0x39a8f8['push']('\x22'+_0x48610d+'\x22');}else{_0x409c91['push'](_0xea62('0x81'));}break;case _0xea62('0x45'):var _0xffe890=parseInt(_0x48610d);_0x48610d=_[_0xea62('0x82')](_0xffe890)||_0xffe890<0x0||_0xffe890>0x4?_0x50d044?0x3:0x2:_0xffe890;_0x39a8f8['push']('\x22'+_0x48610d+'\x22');break;case _0xea62('0x46'):var _0x3a61f9=parseInt(_0x48610d);if(_['isNumber'](_0x3a61f9)&&_[_0xea62('0x74')](_0x2ce380,_0x3a61f9)){_0x39a8f8[_0xea62('0x1b')]('\x22'+_0x3a61f9+'\x22');}else{_0x409c91[_0xea62('0x1b')](_0xea62('0x83'));}break;case'email':if(isEmail(_0x48610d)){_0x39a8f8[_0xea62('0x1b')]('\x22'+_0x48610d+'\x22');}else{_0x409c91[_0xea62('0x1b')](_0xea62('0x84'));}break;case _0xea62('0x85'):var _0x5e9548=moment(_0x48610d,_0xea62('0x86'),!![]);if(_0x5e9548['isValid']()){_0x39a8f8[_0xea62('0x1b')]('\x22'+_0x48610d+'\x22');}else{_0x409c91[_0xea62('0x1b')](_0xea62('0x87'));}break;case'dialTimezone':var _0x2086c7=shared[_0xea62('0x6a')];var _0x414cd0=_0x2086c7[_0x48610d];if(!_[_0xea62('0x1e')](_0x414cd0)){var _0x284397=_0x414cd0[_0xea62('0x88')];_0x39a8f8[_0xea62('0x1b')]('\x22'+_0x48610d+'\x22');_0x39a8f8[_0xea62('0x1b')]('\x22'+_0x284397+'\x22');}break;default:_0x39a8f8[_0xea62('0x1b')]('\x22'+_0x48610d+'\x22');}}else{switch(_0x1cedf7){case'firstName':case _0xea62('0xf'):_0x409c91[_0xea62('0x1b')](_0x1cedf7+'\x20not\x20specified');break;default:_0x39a8f8['push']('\x22\x22');}}}}else{var _0x511e7d='';if(!_[_0xea62('0x1e')](_0x3c37a7)){if(!_0x1f306d[_0xea62('0x7f')](_0x3c37a7['id'])){if(!_[_0xea62('0x1e')](_0x13a78e[_0xea62('0x7b')][_0x23e3b9][_0x17ebc8[_0x1cedf7]])){var _0x48610d=_[_0xea62('0x89')](_0x13a78e[_0xea62('0x7b')][_0x23e3b9][_0x17ebc8[_0x1cedf7]][_0xea62('0x80')](/"/g,'\x27'));var _0x5a1922=phoneDescriptions[_0xea62('0x7e')](_0x471c69=>_0x471c69[_0xea62('0x8a')]===_0x3c37a7['id']);if(!_['isNil'](_0x5a1922)){var _0x524c4e=_[_0xea62('0x89')](_0x13a78e[_0xea62('0x7b')][_0x23e3b9][_0x17ebc8[_0x5a1922['description']]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x524c4e))_0x48610d=_0x48610d+'§'+_0x524c4e;}if(_0x511e7d=='')_0x511e7d=_0x48610d;else _0x511e7d+='|'+_0x48610d;}_0x57ce0a[_0xea62('0x1b')](_0x3c37a7['id']+':'+_0x511e7d);_0x1f306d[_0x3c37a7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x39a8f8[_0xea62('0x1b')]('\x22'+_0x57ce0a['join'](';')+'\x22');}if(_0x409c91['length']){handleError(_0x13a78e[_0xea62('0x7b')][_0x23e3b9],{'code':_0xea62('0x8b'),'message':_0x409c91[_0xea62('0x11')]()});}else{fs['appendFileSync'](_0x47ccac,_0x39a8f8[_0xea62('0x11')]()+'\x0a');}_0x39a8f8=[];}if(!(stats[_0xea62('0x7c')]%0xc8)){socket['emit'](_0xea62('0x8c')+_0x185cd0,stats);stats[_0xea62('0x7d')]=[];}}if(stopped){logger[_0xea62('0x6d')]('Abort\x20parser');_0x9591ff['abort']();}}catch(_0x52d10c){handleError(_0x13a78e[_0xea62('0x7b')][_0x23e3b9],{'code':_0xea62('0x8d'),'message':_0x52d10c[_0xea62('0x5a')]});logger[_0xea62('0x61')]('step',_0x52d10c['message']);}},'complete':function(){try{var _0x29e60d=[];var _0x3653f3=[];var _0x27e8d8=_0xea62('0x33');if(_0x1743e5['duplicates']&&_0x1743e5[_0xea62('0x8e')][_0xea62('0x1a')]){_0x27e8d8='cm_contacts_'+_0x185cd0;_0x29e60d[_0xea62('0x1b')](_0xea62('0x8f')+_0x27e8d8+_0xea62('0x90'));}tmp_campaigns=_0xea62('0x91')+_0x185cd0;tmp_voice_queues='voice_queues_'+_0x185cd0;_0x3653f3[_0xea62('0x1b')](_0xea62('0x8f')+tmp_campaigns+_0xea62('0x92'));_0x3653f3['push'](_0xea62('0x8f')+tmp_voice_queues+_0xea62('0x92'));BPromise[_0xea62('0x93')](_0x3653f3,handleTZQuery)[_0xea62('0x19')](function(_0x357a0a){updateTzCampaigns(_0x1743e5['ListId'])[_0xea62('0x19')](function(_0x1d421c){updateTzVoiceQueues(_0x1743e5[_0xea62('0x2e')])['then'](function(_0x7c5cc){if(hasTZ)_0x39ab08=_0x39ab08[_0xea62('0x80')](_0xea62('0x6b'),_0xea62('0x94'));var _0x79c0cf=util[_0xea62('0xa')](_0xea62('0x95'),_0x47ccac,_0x27e8d8,_0x39ab08,_0x1743e5[_0xea62('0x2e')],_0x1743e5[_0xea62('0x52')]||null,NOW,NOW);if(_[_0xea62('0x1e')](_0x17ebc8['scheduledat'])){_0x79c0cf+=_0xea62('0x96');}_0x29e60d[_0xea62('0x1b')](_0x79c0cf);if(_0x1743e5['duplicates']&&_0x1743e5[_0xea62('0x8e')][_0xea62('0x1a')]){_0x29e60d[_0xea62('0x1b')](insertCmContact(_0x1743e5[_0xea62('0x2e')],_0x27e8d8,_0x1743e5[_0xea62('0x8e')],_0x17ebc8));_0x29e60d[_0xea62('0x1b')](_0xea62('0x97')+_0x27e8d8+';');}BPromise[_0xea62('0x93')](_0x29e60d,handleQuery)[_0xea62('0x19')](function(_0x934ceb){BPromise[_0xea62('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x29e60d=[];for(var _0xcd95d6=0x0;_0xcd95d6\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','lodash','papaparse','bluebird','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','CmContact','findAll','then','push','all','AdditionalPhones','split','length','filter','findOne','update','updated','CmContactHasItem','create','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_hopper_black','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','fromQuery','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','code','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','isNil','set','offset','dialTimezone','main','stringify','send','binding','clone','socket_timestamp','root','server/files/tmp','includes','header','ContactItemType','name','_description','parse','createReadStream','data','rows','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)'];(function(_0x224a85,_0xd84e39){var _0xa0372b=function(_0x2139f3){while(--_0x2139f3){_0x224a85['push'](_0x224a85['shift']());}};_0xa0372b(++_0xd84e39);}(_0x648c,0x19d));var _0xc648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x648c[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xc648('0x0'));var Papa=require(_0xc648('0x1'));var util=require('util');var BPromise=require(_0xc648('0x2'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0xc648('0x3'))['db'];var config=require(_0xc648('0x4'));var shared=require('../../../config/environment/shared');var logger=require(_0xc648('0x5'))(_0xc648('0x6'));config[_0xc648('0x7')]=_[_0xc648('0x8')](config['redis'],{'host':_0xc648('0x9'),'port':0x18eb});var socket=require(_0xc648('0xa'))(new Redis(config[_0xc648('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xc648('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc648('0xb')](_0xc648('0xc'));function isEmail(_0xae2812){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'](_0xae2812);}function selectNotIn(_0x213d72,_0x50f4fa,_0x21f9fd,_0x18767d,_0x201465){return squel['select']()[_0xc648('0xd')](_0xc648('0xe'))[_0xc648('0xf')](_0x18767d)[_0xc648('0x10')](_0x50f4fa,null,_0x50f4fa+_0xc648('0x11')+_0x18767d+'.'+_0x21f9fd)['where'](_0x18767d+'.'+_0x21f9fd+_0xc648('0x12')+_0x213d72+'.'+_0x21f9fd)[_0xc648('0x13')](_0x50f4fa+'.dialCheckDuplicateType\x20IN\x20('+_0x201465['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x57670e,_0x14a97e){promisesAdditionalPhones=[];return db[_0xc648('0x14')][_0xc648('0x15')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc648('0x16')](function(_0x59dcff){if(_0x59dcff!==null){var _0x54ee7c=[];for(var _0x81dcfc=0x0;_0x81dcfc<_0x59dcff['length'];_0x81dcfc++){var _0x55d08e=_0x59dcff[_0x81dcfc];_0x54ee7c[_0xc648('0x17')](insertAdditionalPhones(_0x55d08e));}}Promise[_0xc648('0x18')](_0x54ee7c)[_0xc648('0x16')](function(){_0x57670e({'val':0x1});});});});}function insertAdditionalPhones(_0x9e9f41){return new Promise(function(_0x2649a0,_0x2ec7f9){var _0x67d867=_0x9e9f41[_0xc648('0x19')];var _0x2646f9=_0x67d867[_0xc648('0x1a')](';');var _0x589a2d=[];orderBy=0x0;for(var _0x39d6b7=0x0;_0x39d6b7<_0x2646f9[_0xc648('0x1b')];_0x39d6b7++){_0x589a2d['push'](splitAdditionalPhone(_0x9e9f41['id'],_0x2646f9[_0x39d6b7]));}Promise['all'](_0x589a2d)[_0xc648('0x16')](function(){_0x2649a0({'val':_0x2646f9[_0xc648('0x1b')]});});});}function splitAdditionalPhone(_0x107a84,_0x36fcf3){return new Promise(function(_0x5e3e07,_0x233163){var _0x4156ba=_0x36fcf3[_0xc648('0x1a')](':');var _0x106016=_0x4156ba[0x0];var _0x24c4af=_0x4156ba[0x1];if(!_['isNil'](_0x24c4af)){var _0xfcb165=_0x24c4af['split']('|');var _0x1b45c8=[];for(var _0x2e4de9=0x0;_0x2e4de9<_0xfcb165[_0xc648('0x1b')];_0x2e4de9++){if(_0xfcb165[_0x2e4de9]!==''){var _0x1d6bb5=_[_0xc648('0x1c')](promisesAdditionalPhones,{'contactId':_0x107a84,'phone':_0xfcb165[_0x2e4de9]});if(_0x1d6bb5[_0xc648('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xc648('0x17')]({'contactId':_0x107a84,'contactTypeId':_0x106016,'phone':_0xfcb165[_0x2e4de9],'orderBy':orderBy});}}}_0x5e3e07({'ok':0x1});}else _0x5e3e07({'res':0x0});});}function createAdditionalPhone(_0x440da2,_0x42267f,_0x100900,_0x1936a1){var _0x1f764f='';var _0x59f11c='';var _0x5a051f=_0x100900['split']('§');_0x1f764f=_0x5a051f[0x0];if(_0x5a051f[_0xc648('0x1b')]==0x2)_0x59f11c=_0x5a051f[0x1];return new Promise(function(_0x21fa71,_0x771f99){return db['CmContactHasItem'][_0xc648('0x1d')]({'where':{'CmContactId':_0x440da2,'item':_0x1f764f}})['then'](function(_0x4b70f7){if(_0x4b70f7){return db['CmContactHasItem'][_0xc648('0x1e')]({'ItemTypeId':_0x42267f,'description':_0x59f11c,'OrderBy':_0x1936a1},{'where':{'CmContactId':_0x440da2,'item':_0x1f764f}})[_0xc648('0x16')](function(_0x491943){_0x21fa71({'res':_0xc648('0x1f')});});}else{return db[_0xc648('0x20')][_0xc648('0x21')]({'CmContactId':_0x440da2,'item':_0x1f764f,'description':_0x59f11c,'ItemTypeId':_0x42267f,'OrderBy':_0x1936a1,'ItemClass':'PHONE'})[_0xc648('0x16')](function(_0x20cfc6){_0x21fa71({'res':_0xc648('0x22')});});}});});}function insertCmHopper(_0x1e46cf,_0x30ed48,_0x38a710,_0x2d90f4,_0x35ef18){var _0x49cb90=['cm_contacts.phone',_0xc648('0x23'),_0xc648('0x24'),_0xc648('0x25'),_0x30ed48+'.'+_0x2d90f4,'cm_contacts.createdAt',_0xc648('0x26'),_0xc648('0x27'),_0xc648('0x28'),'\x22'+_0x35ef18+'\x22'];return squel[_0xc648('0x29')]()[_0xc648('0x2a')](_0xc648('0x2b'))['fromQuery'](['phone',_0xc648('0x2c'),_0xc648('0x2d'),_0xc648('0x2e'),_0x2d90f4,_0xc648('0x2f'),_0xc648('0x30'),_0xc648('0x31'),_0xc648('0x32'),_0xc648('0x33')],squel[_0xc648('0x34')]()[_0xc648('0x35')](_0x49cb90)[_0xc648('0xf')](_0x30ed48)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x30ed48+_0xc648('0x36'))[_0xc648('0x10')](_0x38a710,null,_0x38a710+_0xc648('0x11')+_0x30ed48+'.'+_0x2d90f4)[_0xc648('0x13')](_0x30ed48+_0xc648('0x37'),_0x1e46cf)[_0xc648('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc648('0x13')](_0xc648('0x38'),selectNotIn(_0x30ed48,_0x38a710,_0x2d90f4,_0xc648('0x2b'),[_0xc648('0x39'),_0xc648('0x3a')]))['where'](_0xc648('0x38'),selectNotIn(_0x30ed48,_0x38a710,_0x2d90f4,'cm_hopper',['\x22always\x22'])))[_0xc648('0x3b')]();}function insertCmHopperBlack(_0x35ac43,_0x5ca884,_0x37efd9,_0x4d5fa4){var _0x5deb35=[_0xc648('0x3c'),_0xc648('0x24'),'cm_contacts.ListId',_0x5ca884+'.'+_0x4d5fa4,_0xc648('0x3d'),'cm_contacts.updatedAt'];return squel['insert']()[_0xc648('0x2a')](_0xc648('0x3e'))['fromQuery'](['phone',_0xc648('0x2d'),'ListId',_0x4d5fa4,_0xc648('0x2f'),_0xc648('0x30')],squel['select']()[_0xc648('0x35')](_0x5deb35)[_0xc648('0xf')](_0x5ca884)[_0xc648('0x10')](_0xc648('0x3f'),null,_0xc648('0x40')+_0x5ca884+_0xc648('0x36'))[_0xc648('0x10')](_0x37efd9,null,_0x37efd9+_0xc648('0x11')+_0x5ca884+'.'+_0x4d5fa4)[_0xc648('0x13')](_0x5ca884+'.CmListId\x20=\x20?',_0x35ac43)[_0xc648('0x13')](_0xc648('0x41'),NOW)[_0xc648('0x13')](_0xc648('0x38'),squel[_0xc648('0x34')]()[_0xc648('0xd')](_0xc648('0xe'))[_0xc648('0xf')](_0xc648('0x3e'))[_0xc648('0x13')]('ListId\x20=\x20?',_0x35ac43)['where'](_0x4d5fa4+_0xc648('0x12')+_0x5ca884+'.'+_0x4d5fa4)))['toString']();}function insertTzCmHopper(_0x5ca29f,_0x19c0ad,_0xe3ee8,_0x513cff,_0xd92ec1,_0x514c83){var _0x2af151=[_0xc648('0x3c'),_0xc648('0x42')+_0x514c83+_0xc648('0x43'),'cm_contacts.id',_0xc648('0x25'),_0x19c0ad+'.'+_0x513cff,_0xc648('0x3d'),_0xc648('0x26'),_0xc648('0x27'),'cm_contacts.UserId','\x22'+_0xd92ec1+'\x22'];var _0x5e70a9=squel[_0xc648('0x29')]()[_0xc648('0x2a')](_0xc648('0x2b'))[_0xc648('0x44')](['phone',_0xc648('0x2c'),'ContactId','ListId',_0x513cff,_0xc648('0x2f'),'updatedAt',_0xc648('0x31'),'UserId',_0xc648('0x33')],squel[_0xc648('0x34')]()[_0xc648('0x35')](_0x2af151)[_0xc648('0xf')](_0x19c0ad)[_0xc648('0x10')](_0xc648('0x3f'),null,_0xc648('0x40')+_0x19c0ad+_0xc648('0x36'))[_0xc648('0x10')](_0xe3ee8,null,_0xe3ee8+_0xc648('0x11')+_0x19c0ad+'.'+_0x513cff)['join'](_0x514c83,null,_0x514c83+_0xc648('0x11')+_0x19c0ad+'.'+_0x513cff)[_0xc648('0x13')](_0x19c0ad+'.CmListId\x20=\x20?',_0x5ca29f)[_0xc648('0x13')](_0xc648('0x41'),NOW)[_0xc648('0x13')](_0xc648('0x38'),selectNotIn(_0x19c0ad,_0xe3ee8,_0x513cff,_0xc648('0x2b'),[_0xc648('0x39'),_0xc648('0x3a')]))[_0xc648('0x13')](_0xc648('0x38'),selectNotIn(_0x19c0ad,_0xe3ee8,_0x513cff,_0xc648('0x2b'),[_0xc648('0x39')])))['toString']();return _0x5e70a9;}function insertTzCmHopperBlack(_0xd7b4f0,_0x596c00,_0x4f6ca3,_0x271e05){var _0x579f53=['cm_contacts.phone',_0xc648('0x24'),_0xc648('0x25'),_0x596c00+'.'+_0x271e05,_0xc648('0x3d'),_0xc648('0x26')];return squel[_0xc648('0x29')]()[_0xc648('0x2a')](_0xc648('0x3e'))[_0xc648('0x44')](['phone',_0xc648('0x2d'),'ListId',_0x271e05,_0xc648('0x2f'),'updatedAt'],squel[_0xc648('0x34')]()['fields'](_0x579f53)[_0xc648('0xf')](_0x596c00)[_0xc648('0x10')]('cm_contacts',null,_0xc648('0x40')+_0x596c00+_0xc648('0x36'))['join'](_0x4f6ca3,null,_0x4f6ca3+_0xc648('0x11')+_0x596c00+'.'+_0x271e05)[_0xc648('0x13')](_0x596c00+_0xc648('0x37'),_0xd7b4f0)[_0xc648('0x13')](_0xc648('0x41'),NOW)[_0xc648('0x13')](_0xc648('0x38'),squel[_0xc648('0x34')]()['field'](_0xc648('0xe'))[_0xc648('0xf')]('cm_hopper_black')['where'](_0xc648('0x45'),_0xd7b4f0)['where'](_0x271e05+_0xc648('0x12')+_0x596c00+'.'+_0x271e05)))[_0xc648('0x3b')]();}function insertCmHopperAdditionalPhones(_0x4794a4){var _0x40a1d6=[_0xc648('0x46'),_0xc648('0x47'),_0xc648('0x48'),'cm_contact_has_items.createdAt',_0xc648('0x49')];return squel['insert']()[_0xc648('0x2a')](_0xc648('0x4a'))[_0xc648('0x44')]([_0xc648('0x4b'),_0xc648('0xe'),_0xc648('0x4c'),'createdAt',_0xc648('0x30')],squel[_0xc648('0x34')]()[_0xc648('0x35')](_0x40a1d6)[_0xc648('0xf')]('cm_hopper')[_0xc648('0x10')](_0xc648('0x3f'),null,_0xc648('0x4d'))[_0xc648('0x10')](_0xc648('0x4e'),null,_0xc648('0x4f'))['where'](_0xc648('0x50'),_0x4794a4)[_0xc648('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x481bbe,_0xc791b4,_0x1aa73b,_0x1ca0f5){var _0x4ea054=_[_0xc648('0x51')](_[_0xc648('0x52')](_0x1ca0f5),[_0xc648('0x2e'),'CompanyId',_0xc648('0x2f'),_0xc648('0x30'),_0xc648('0x53')]);return squel['insert']()[_0xc648('0x2a')](_0xc648('0x3f'))['fromQuery'](_0x4ea054,squel['select']()[_0xc648('0x35')](_0x4ea054)['from'](_0xc791b4)[_0xc648('0x13')]('('+_0x1aa73b[_0xc648('0x10')](',')+_0xc648('0x54'),squel[_0xc648('0x34')]()[_0xc648('0x35')](_0x1aa73b)['from'](_0xc648('0x3f'))[_0xc648('0x13')](_0xc648('0x45'),_0x481bbe)[_0xc648('0x13')](_0xc648('0x55')))['where']('id\x20IN\x20?',squel[_0xc648('0x34')]()[_0xc648('0xd')](_0xc648('0x56'),_0xc648('0x57'))[_0xc648('0xf')](_0xc791b4)[_0xc648('0x58')](_0x1aa73b[_0xc648('0x10')](','))))[_0xc648('0x3b')]();}function handleStop(){logger[_0xc648('0x59')](_0xc648('0x5a'));stopped=!![];}function handleUncaughtException(_0x27da3e){logger[_0xc648('0x5b')](_0x27da3e[_0xc648('0x5c')]);process['exit'](0x1);}function handleError(_0x32cc39,_0x5ef37e){stats[_0xc648('0x5d')][_0xc648('0x17')]({'name':_0x5ef37e[_0xc648('0x5e')],'message':_0x5ef37e[_0xc648('0x5c')],'row':_0x32cc39});}function handleQuery(_0x5aecb2){logger[_0xc648('0x59')](_0x5aecb2);return db[_0xc648('0x5f')][_0xc648('0x60')](_0x5aecb2)['spread'](function(_0x559463){results['push'](_0x559463);})[_0xc648('0x61')](function(_0x38a57f){logger[_0xc648('0x5b')](_0x38a57f[_0xc648('0x5c')]);});}function updateTzCampaigns(_0x5c0120){return new Promise(function(_0x347256,_0x1462a9){var _0x251a6c=squel[_0xc648('0x34')]()[_0xc648('0x35')]([_0xc648('0x62'),_0xc648('0x63')])[_0xc648('0xf')](_0xc648('0x64'))[_0xc648('0x10')](_0xc648('0x65'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0xc648('0x66')+_0x5c0120);db[_0xc648('0x5f')]['query'](_0x251a6c[_0xc648('0x3b')]())[_0xc648('0x67')](function(_0x1eb7c5){var _0x213770=[];for(var _0x25b0bc=0x0;_0x25b0bc<_0x1eb7c5[_0xc648('0x1b')];_0x25b0bc++){_0x213770[_0xc648('0x17')](getTimezoneData(_0x1eb7c5[_0x25b0bc],tmp_campaigns));}BPromise['all'](_0x213770)[_0xc648('0x16')](function(){_0x347256({'val':0x1});});})[_0xc648('0x61')](function(_0x450432){logger[_0xc648('0x5b')](_0x450432[_0xc648('0x5c')]);_0x347256({'val':0x0});});});}function updateTzVoiceQueues(_0xdcb6af){return new Promise(function(_0x1a3c5e,_0x10b9c0){var _0x2301aa=squel[_0xc648('0x34')]()[_0xc648('0x35')]([_0xc648('0x68'),_0xc648('0x69')])[_0xc648('0xf')](_0xc648('0x6a'))['join']('voice_queues_has_cm_lists',null,_0xc648('0x6b'))['where'](_0xc648('0x6c')+_0xdcb6af);db[_0xc648('0x5f')][_0xc648('0x60')](_0x2301aa[_0xc648('0x3b')]())[_0xc648('0x67')](function(_0x52b3e9){var _0x23c86b=[];for(var _0xc832a2=0x0;_0xc832a2<_0x52b3e9[_0xc648('0x1b')];_0xc832a2++){_0x23c86b[_0xc648('0x17')](getTimezoneData(_0x52b3e9[_0xc832a2],tmp_voice_queues));}BPromise['all'](_0x23c86b)[_0xc648('0x16')](function(){_0x1a3c5e({'val':0x1});});})['catch'](function(_0xad0368){logger[_0xc648('0x5b')](_0xad0368[_0xc648('0x5c')]);_0x1a3c5e({'val':0x0});});});}function getTimezoneData(_0x541f8,_0x3fc1eb){return new Promise(function(_0x2396a2,_0x49f477){var _0x3a10=shared['timezones'];var _0x39879a=_0x3a10[_0x541f8['dialTimezone']];if(_[_0xc648('0x6d')](_0x39879a)){_0x2396a2({'ret':0x1});}else{var _0x764480=_0x39879a['utcOffset'];var _0x1aacfd=squel['insert']()[_0xc648('0x2a')](_0x3fc1eb)[_0xc648('0x6e')]('id',_0x541f8['id'])[_0xc648('0x6e')](_0xc648('0x6f'),_0x764480)[_0xc648('0x6e')](_0xc648('0x70'),_0x541f8[_0xc648('0x70')])[_0xc648('0x3b')]();return db[_0xc648('0x5f')][_0xc648('0x60')](_0x1aacfd)[_0xc648('0x67')](function(_0x2188e8){_0x2396a2({'ret':0x1});})[_0xc648('0x61')](function(_0x19e4af){logger[_0xc648('0x5b')](_0x19e4af[_0xc648('0x5c')]);_0x49f477({'ret':0x1});});}});}function handleTZQuery(_0xed97a6){logger[_0xc648('0x59')](_0xed97a6);return db[_0xc648('0x5f')]['query'](_0xed97a6)['spread'](function(_0x23a8a1){})['catch'](function(_0x58faf7){logger[_0xc648('0x5b')](_0x58faf7[_0xc648('0x5c')]);});}function main(_0x449c5f,_0x24d6a7,_0x305e3e,_0x1c3a69){logger[_0xc648('0x59')](_0xc648('0x71'),_0x449c5f,JSON[_0xc648('0x72')](_0x24d6a7));process[_0xc648('0x73')]('start');var _0x4a610d=_0x24d6a7[_0xc648('0x74')];var _0x4fafaf=_[_0xc648('0x75')](_0x4a610d);var _0x26a465=_0x24d6a7[_0xc648('0x76')];var _0x472a32=path[_0xc648('0x10')](config[_0xc648('0x77')],_0xc648('0x78'),_0x26a465+'.csv');hasTZ=_[_0xc648('0x52')](_0x4a610d)[_0xc648('0x79')](_0xc648('0x70'));var _0x55c17b=_[_0xc648('0x52')](_0x4a610d)['join']();logger['info'](_0xc648('0x7a'),_0x55c17b);db[_0xc648('0x7b')]['findAll']({'raw':!![],'attributes':['id','name']})[_0xc648('0x16')](function(_0x161cc3){for(var _0x35c2ff=0x0;_0x35c2ff<_0x161cc3['length'];_0x35c2ff++){if(_0x161cc3[_0x35c2ff][_0xc648('0x7c')]in _0x4a610d){contactItemTypes['push'](_0x161cc3[_0x35c2ff]);delete _0x4fafaf[_0x161cc3[_0x35c2ff][_0xc648('0x7c')]];hasAdditionalPhones=!![];}for(var _0x4d4a8f in _0x4a610d){if(_0x161cc3[_0x35c2ff][_0xc648('0x7c')]+_0xc648('0x7d')===_0x4d4a8f){phoneDescriptions['push']({'itemTypeId':_0x161cc3[_0x35c2ff]['id'],'description':_0x4d4a8f});delete _0x4fafaf[_0x4d4a8f];}}}if(hasAdditionalPhones)_0x4fafaf[_0xc648('0x19')]='';var _0x26a323=_[_0xc648('0x52')](_0x4fafaf)[_0xc648('0x10')]();logger[_0xc648('0x59')](_0xc648('0x7a'),_0x26a323);fs['writeFileSync'](_0x472a32,_0x26a323+'\x0a');Papa[_0xc648('0x7e')](fs[_0xc648('0x7f')](_0x449c5f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4db2cd,_0x45c1aa){try{for(var _0x1f716d=0x0,_0xf1480a=[];_0x1f716d<_0x4db2cd[_0xc648('0x80')][_0xc648('0x1b')];_0x1f716d++){stats[_0xc648('0x81')]+=0x1;if(_0x4db2cd[_0xc648('0x5d')][_0x1f716d]){handleError(_0x4db2cd[_0xc648('0x80')][_0x1f716d],_0x4db2cd[_0xc648('0x5d')][_0x1f716d]);}else{var _0xdf0638=[];var _0x9cef0c=[];var _0x2697d3={};for(var _0x374203 in _0x4a610d){let _0x106657=contactItemTypes['find'](_0x45c1ec=>_0x45c1ec[_0xc648('0x7c')]===_0x374203);let _0x4811db=contactItemTypes['find'](_0x10330d=>_0x10330d[_0xc648('0x7c')]+_0xc648('0x7d')===_0x374203);if(_['isNil'](_0x106657)&&_[_0xc648('0x6d')](_0x4811db)){if(_0x4a610d['hasOwnProperty'](_0x374203)){if(_0x4db2cd[_0xc648('0x80')][_0x1f716d][_0x4a610d[_0x374203]]){var _0x2338b9=_[_0xc648('0x82')](_0x4db2cd[_0xc648('0x80')][_0x1f716d][_0x4a610d[_0x374203]]['replace'](/"/g,'\x27'));switch(_0x374203){case'scheduledat':var _0x979ecd=moment(_0x2338b9,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x979ecd[_0xc648('0x83')]()){_0xf1480a['push']('\x22'+_0x2338b9+'\x22');}else{_0xdf0638[_0xc648('0x17')](_0xc648('0x84'));}break;case _0xc648('0x31'):var _0x515216=parseInt(_0x2338b9);_0x2338b9=_[_0xc648('0x85')](_0x515216)||_0x515216<0x0||_0x515216>0x4?_0x1c3a69?0x3:0x2:_0x515216;_0xf1480a[_0xc648('0x17')]('\x22'+_0x2338b9+'\x22');break;case'UserId':var _0xb86dd0=parseInt(_0x2338b9);if(_['isNumber'](_0xb86dd0)&&_[_0xc648('0x79')](_0x305e3e,_0xb86dd0)){_0xf1480a[_0xc648('0x17')]('\x22'+_0xb86dd0+'\x22');}else{_0xdf0638[_0xc648('0x17')](_0xc648('0x86'));}break;case'email':if(isEmail(_0x2338b9)){_0xf1480a[_0xc648('0x17')]('\x22'+_0x2338b9+'\x22');}else{_0xdf0638[_0xc648('0x17')](_0xc648('0x87'));}break;case _0xc648('0x88'):var _0x44ba73=moment(_0x2338b9,_0xc648('0x89'),!![]);if(_0x44ba73[_0xc648('0x83')]()){_0xf1480a['push']('\x22'+_0x2338b9+'\x22');}else{_0xdf0638[_0xc648('0x17')](_0xc648('0x8a'));}break;case'dialTimezone':var _0x35a2ae=shared[_0xc648('0x8b')];var _0x855a17=_0x35a2ae[_0x2338b9];if(!_[_0xc648('0x6d')](_0x855a17)){var _0x5adddb=_0x855a17['utcOffset'];_0xf1480a[_0xc648('0x17')]('\x22'+_0x2338b9+'\x22');_0xf1480a[_0xc648('0x17')]('\x22'+_0x5adddb+'\x22');}break;default:_0xf1480a[_0xc648('0x17')]('\x22'+_0x2338b9+'\x22');}}else{switch(_0x374203){case _0xc648('0x8c'):case _0xc648('0xe'):_0xdf0638['push'](_0x374203+'\x20not\x20specified');break;default:_0xf1480a[_0xc648('0x17')]('\x22\x22');}}}}else{var _0x32fc3f='';if(!_[_0xc648('0x6d')](_0x106657)){if(!_0x2697d3[_0xc648('0x8d')](_0x106657['id'])){if(!_['isNil'](_0x4db2cd[_0xc648('0x80')][_0x1f716d][_0x4a610d[_0x374203]])){var _0x2338b9=_[_0xc648('0x82')](_0x4db2cd[_0xc648('0x80')][_0x1f716d][_0x4a610d[_0x374203]][_0xc648('0x8e')](/"/g,'\x27'));var _0x5a909=phoneDescriptions[_0xc648('0x8f')](_0x1ea7c4=>_0x1ea7c4[_0xc648('0x90')]===_0x106657['id']);if(!_[_0xc648('0x6d')](_0x5a909)){var _0x4a56f2=_[_0xc648('0x82')](_0x4db2cd['data'][_0x1f716d][_0x4a610d[_0x5a909['description']]]['replace'](/"/g,'\x27'));if(!_[_0xc648('0x6d')](_0x4a56f2))_0x2338b9=_0x2338b9+'§'+_0x4a56f2;}if(_0x32fc3f=='')_0x32fc3f=_0x2338b9;else _0x32fc3f+='|'+_0x2338b9;}_0x9cef0c[_0xc648('0x17')](_0x106657['id']+':'+_0x32fc3f);_0x2697d3[_0x106657['id']]=0x1;}}}}if(hasAdditionalPhones){_0xf1480a[_0xc648('0x17')]('\x22'+_0x9cef0c[_0xc648('0x10')](';')+'\x22');}if(_0xdf0638[_0xc648('0x1b')]){handleError(_0x4db2cd['data'][_0x1f716d],{'code':'SystemRow','message':_0xdf0638[_0xc648('0x10')]()});}else{fs[_0xc648('0x91')](_0x472a32,_0xf1480a['join']()+'\x0a');}_0xf1480a=[];}if(!(stats[_0xc648('0x81')]%0xc8)){socket[_0xc648('0x92')](_0xc648('0x93')+_0x26a465,stats);stats['errors']=[];}}if(stopped){logger[_0xc648('0x59')](_0xc648('0x94'));_0x45c1aa[_0xc648('0x95')]();}}catch(_0x47479a){handleError(_0x4db2cd[_0xc648('0x80')][_0x1f716d],{'code':_0xc648('0x96'),'message':_0x47479a[_0xc648('0x5c')]});logger['error'](_0xc648('0x97'),_0x47479a[_0xc648('0x5c')]);}},'complete':function(){try{var _0x4c5d66=[];var _0x17a970=[];var _0x40176b=_0xc648('0x3f');if(_0x24d6a7[_0xc648('0x98')]&&_0x24d6a7['duplicates'][_0xc648('0x1b')]){_0x40176b=_0xc648('0x99')+_0x26a465;_0x4c5d66[_0xc648('0x17')](_0xc648('0x9a')+_0x40176b+_0xc648('0x9b'));}tmp_campaigns=_0xc648('0x9c')+_0x26a465;tmp_voice_queues='voice_queues_'+_0x26a465;_0x17a970['push'](_0xc648('0x9a')+tmp_campaigns+_0xc648('0x9d'));_0x17a970['push'](_0xc648('0x9a')+tmp_voice_queues+_0xc648('0x9d'));BPromise[_0xc648('0x9e')](_0x17a970,handleTZQuery)[_0xc648('0x16')](function(_0x134dbd){updateTzCampaigns(_0x24d6a7['ListId'])[_0xc648('0x16')](function(_0x3cbae7){updateTzVoiceQueues(_0x24d6a7[_0xc648('0x2e')])[_0xc648('0x16')](function(_0x353fb3){if(hasTZ)_0x26a323=_0x26a323[_0xc648('0x8e')](_0xc648('0x70'),_0xc648('0x9f'));var _0x59d429=util['format'](_0xc648('0xa0'),_0x472a32,_0x40176b,_0x26a323,_0x24d6a7[_0xc648('0x2e')],_0x24d6a7[_0xc648('0xa1')]||null,NOW,NOW);if(_[_0xc648('0x6d')](_0x4a610d[_0xc648('0x2c')])){_0x59d429+=_0xc648('0xa2');}_0x4c5d66[_0xc648('0x17')](_0x59d429);if(_0x24d6a7[_0xc648('0x98')]&&_0x24d6a7[_0xc648('0x98')]['length']){_0x4c5d66['push'](insertCmContact(_0x24d6a7[_0xc648('0x2e')],_0x40176b,_0x24d6a7[_0xc648('0x98')],_0x4a610d));_0x4c5d66[_0xc648('0x17')](_0xc648('0xa3')+_0x40176b+';');}BPromise['each'](_0x4c5d66,handleQuery)[_0xc648('0x16')](function(_0xd45336){BPromise[_0xc648('0x18')]([handleAdditionalPhones()])['then'](function(){_0x4c5d66=[];for(var _0x5785bc=0x0;_0x5785bc_0x55f6fe[_0x3ed0('0x62')]===_0xc394c5);let _0x4ee35b=contactItemTypes[_0x3ed0('0x6a')](_0x2ca7ff=>_0x2ca7ff[_0x3ed0('0x62')]+_0x3ed0('0x63')===_0xc394c5);if(_['isNil'](_0x39f7ad)&&_[_0x3ed0('0x1b')](_0x4ee35b)){if(_0x5af4e1[_0x3ed0('0x6b')](_0xc394c5)){if(_0x4235d8[_0x3ed0('0x68')][_0x585a08][_0x5af4e1[_0xc394c5]]){var _0x505549=_['trim'](_0x4235d8[_0x3ed0('0x68')][_0x585a08][_0x5af4e1[_0xc394c5]][_0x3ed0('0x6c')](/"/g,'\x27'));switch(_0xc394c5){case _0x3ed0('0x33'):var _0x51f697=moment(_0x505549,_0x3ed0('0xc'),!![]);if(_0x51f697[_0x3ed0('0x6d')]()){_0x1fd8ca[_0x3ed0('0x1c')]('\x22'+_0x505549+'\x22');}else{_0x5ce6ba[_0x3ed0('0x1c')](_0x3ed0('0x6e'));}break;case _0x3ed0('0x36'):var _0x84cf70=parseInt(_0x505549);_0x505549=_[_0x3ed0('0x6f')](_0x84cf70)||_0x84cf70<0x0||_0x84cf70>0x4?_0x590a3c?0x3:0x2:_0x84cf70;_0x1fd8ca[_0x3ed0('0x1c')]('\x22'+_0x505549+'\x22');break;case _0x3ed0('0x37'):var _0x5780cf=parseInt(_0x505549);if(_[_0x3ed0('0x70')](_0x5780cf)&&_[_0x3ed0('0x71')](_0x47b626,_0x5780cf)){_0x1fd8ca[_0x3ed0('0x1c')]('\x22'+_0x5780cf+'\x22');}else{_0x5ce6ba[_0x3ed0('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x505549)){_0x1fd8ca[_0x3ed0('0x1c')]('\x22'+_0x505549+'\x22');}else{_0x5ce6ba[_0x3ed0('0x1c')](_0x3ed0('0x72'));}break;case'dateOfBirth':var _0x3e4b29=moment(_0x505549,_0x3ed0('0x73'),!![]);if(_0x3e4b29['isValid']()){_0x1fd8ca['push']('\x22'+_0x505549+'\x22');}else{_0x5ce6ba[_0x3ed0('0x1c')](_0x3ed0('0x74'));}break;default:_0x1fd8ca[_0x3ed0('0x1c')]('\x22'+_0x505549+'\x22');}}else{switch(_0xc394c5){case _0x3ed0('0x75'):case _0x3ed0('0x10'):_0x5ce6ba[_0x3ed0('0x1c')](_0xc394c5+_0x3ed0('0x76'));break;default:_0x1fd8ca['push']('\x22\x22');}}}}else{var _0x53f4d0='';if(!_[_0x3ed0('0x1b')](_0x39f7ad)){if(!_0x3de405['hasOwnProperty'](_0x39f7ad['id'])){for(var _0x5e565d=0x0;_0x5e565d<_0x5af4e1[_0xc394c5][_0x3ed0('0x1a')];_0x5e565d++){var _0x505549=_[_0x3ed0('0x77')](_0x4235d8[_0x3ed0('0x68')][_0x585a08][_0x5af4e1[_0xc394c5][_0x5e565d]]['replace'](/"/g,'\x27'));var _0x1f31e6=phoneDescriptions['find'](_0x444859=>_0x444859['itemTypeId']===_0x39f7ad['id']);if(!_['isNil'](_0x1f31e6)){var _0x362d03=_[_0x3ed0('0x77')](_0x4235d8[_0x3ed0('0x68')][_0x585a08][_0x5af4e1[_0x1f31e6[_0x3ed0('0x78')]][0x0]][_0x3ed0('0x6c')](/"/g,'\x27'));if(!_['isNil'](_0x362d03))_0x505549=_0x505549+'§'+_0x362d03;}if(_0x53f4d0=='')_0x53f4d0=_0x505549;else _0x53f4d0+='|'+_0x505549;}_0x17c1a2['push'](_0x39f7ad['id']+':'+_0x53f4d0);_0x3de405[_0x39f7ad['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1fd8ca[_0x3ed0('0x1c')]('\x22'+_0x17c1a2['join'](';')+'\x22');}if(_0x5ce6ba[_0x3ed0('0x1a')]){handleError(_0x4235d8['data'][_0x585a08],{'code':_0x3ed0('0x79'),'message':_0x5ce6ba['join']()});}else{fs[_0x3ed0('0x7a')](_0x4d92fe,_0x1fd8ca[_0x3ed0('0x12')]()+'\x0a');}_0x1fd8ca=[];}if(!(stats[_0x3ed0('0x69')]%0xc8)){socket[_0x3ed0('0x7b')](_0x3ed0('0x7c')+_0x779e61,stats);stats[_0x3ed0('0x59')]=[];}}if(stopped){logger[_0x3ed0('0x56')]('Abort\x20parser');_0x321702['abort']();}}catch(_0x2e60a5){handleError(_0x4235d8[_0x3ed0('0x68')][_0x585a08],{'code':_0x3ed0('0x7d'),'message':_0x2e60a5[_0x3ed0('0x20')]});logger['error']('step',_0x2e60a5[_0x3ed0('0x20')]);}},'complete':function(){try{var _0x300e0c=[];var _0x5a387e=tempTableName;_0x300e0c[_0x3ed0('0x1c')](_0x3ed0('0x7e')+_0x5a387e+_0x3ed0('0x7f'));logger[_0x3ed0('0x56')]('CIS\x20len',contactItemTypes[_0x3ed0('0x1a')]);var _0x11fc67=util[_0x3ed0('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4d92fe,_0x5a387e,_0x24acea,_0x383358[_0x3ed0('0x43')],_0x383358[_0x3ed0('0x52')]||null,NOW,NOW);if(_[_0x3ed0('0x1b')](_0x5af4e1[_0x3ed0('0x33')])){_0x11fc67+=_0x3ed0('0x80');}_0x300e0c[_0x3ed0('0x1c')](_0x11fc67);BPromise[_0x3ed0('0x81')](_0x300e0c,handleQuery)[_0x3ed0('0x1e')](function(_0x506f71){BPromise[_0x3ed0('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x300e0c=[];for(var _0x2845ff=0x0;_0x2845ff\x20\x20');}var _0x431ff7=path['join'](config['root'],_0x3ed0('0x5e'),process[_0x3ed0('0x8c')][0x2]);if(!fs[_0x3ed0('0x8d')](_0x431ff7)){throw new Error(_0x3ed0('0x8e'));}var _0x176911={};try{_0x176911=JSON[_0x3ed0('0x66')](process[_0x3ed0('0x8c')][0x3]);if(!_0x176911[_0x3ed0('0x5d')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x48a176=0x0;if(_0x176911[_0x3ed0('0x5d')]['UserId']){_0x48a176=0x1;}if(!_0x176911[_0x3ed0('0x43')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x5b92f2){throw new Error(_0x3ed0('0x8f'));}var _0x44a78e=[];try{_0x44a78e=_[_0x3ed0('0x90')](JSON[_0x3ed0('0x66')](process['argv'][0x4]),'id');}catch(_0x16837d){logger[_0x3ed0('0x56')](_0x3ed0('0x91'));}main(_0x431ff7,_0x176911,_0x44a78e,_0x48a176);}validate();process['on'](_0x3ed0('0x92'),handleStop);process['on'](_0x3ed0('0x93'),handleUncaughtException); \ No newline at end of file +var _0xf9ae=['\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','phone','isNil','AdditionalPhones','push','all','then','catch','message','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','into','fromQuery','ContactId','fields','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','error','errors','code','info','main','send','binding','socket_timestamp','root','server/files/tmp','body','findAll','name','keys','header','writeFileSync','parse','createReadStream','data','find','_description','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','itemTypeId','description','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','format',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','each','finish','affectedRows','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','.id\x20=\x20'];(function(_0x268dbd,_0x2ad1f9){var _0x5e3d11=function(_0x1dee4f){while(--_0x1dee4f){_0x268dbd['push'](_0x268dbd['shift']());}};_0x5e3d11(++_0x2ad1f9);}(_0xf9ae,0x85));var _0xef9a=function(_0x456c85,_0x33b2a5){_0x456c85=_0x456c85-0x0;var _0x471ac7=_0xf9ae[_0x456c85];return _0x471ac7;};'use strict';var fs=require('fs');var path=require(_0xef9a('0x0'));var _=require(_0xef9a('0x1'));var Papa=require('papaparse');var util=require(_0xef9a('0x2'));var BPromise=require(_0xef9a('0x3'));var moment=require(_0xef9a('0x4'));var squel=require(_0xef9a('0x5'));var Redis=require('ioredis');var db=require(_0xef9a('0x6'))['db'];var config=require(_0xef9a('0x7'));var logger=require('../../../config/logger')(_0xef9a('0x8'));config[_0xef9a('0x9')]=_[_0xef9a('0xa')](config['redis'],{'host':_0xef9a('0xb'),'port':0x18eb});var socket=require(_0xef9a('0xc'))(new Redis(config[_0xef9a('0x9')]));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'](_0xef9a('0xd'));var tempTableName=_0xef9a('0xe')+moment()['format'](_0xef9a('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xa39500){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))*$/[_0xef9a('0x10')](_0xa39500);}function selectNotIn(_0x5e70f6,_0xc7ce85,_0x5da153,_0x167f8a,_0xd021c1){return squel[_0xef9a('0x11')]()[_0xef9a('0x12')]('phone')[_0xef9a('0x13')](_0x167f8a)['join'](_0xc7ce85,null,_0xc7ce85+_0xef9a('0x14')+_0x167f8a+'.'+_0x5da153)['where'](_0x167f8a+'.'+_0x5da153+_0xef9a('0x15')+_0x5e70f6+'.'+_0x5da153)[_0xef9a('0x16')](_0xc7ce85+_0xef9a('0x17')+_0xd021c1[_0xef9a('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5ec28b,_0x1491a3){promisesAdditionalPhones=[];promisesContact=[];return db[_0xef9a('0x19')][_0xef9a('0x1a')](_0xef9a('0x1b')+tempTableName)[_0xef9a('0x1c')](function(_0x4306f9){if(_0x4306f9!==null){var _0x476941=[];for(var _0x5dee5c=0x0;_0x5dee5c<_0x4306f9[_0xef9a('0x1d')];_0x5dee5c++){var _0x284fda=_0x4306f9[_0x5dee5c];if(!_['isNil'](_0x284fda[_0xef9a('0x1e')])){if(!_[_0xef9a('0x1f')](_0x284fda[_0xef9a('0x20')]))_0x476941[_0xef9a('0x21')](insertAdditionalPhones(_0x284fda));promisesContact[_0xef9a('0x21')]({'contact':_0x284fda});}}}Promise[_0xef9a('0x22')](_0x476941)[_0xef9a('0x23')](function(){_0x5ec28b({'val':0x1});});})[_0xef9a('0x24')](function(_0x426733){logger['error'](_0x426733[_0xef9a('0x25')]);});});}function insertAdditionalPhones(_0xac6117){return new Promise(function(_0x6d6e2f,_0x266b79){var _0xf17902=_0xac6117[_0xef9a('0x20')];if(_[_0xef9a('0x1f')](_0xf17902))_0x266b79({'val':0x0});else{var _0x1e3cde=_0xf17902[_0xef9a('0x26')](';');var _0x14640a=[];orderBy=0x0;for(var _0x5523e8=0x0;_0x5523e8<_0x1e3cde['length'];_0x5523e8++){_0x14640a[_0xef9a('0x21')](splitAdditionalPhone(_0xac6117['id'],_0x1e3cde[_0x5523e8]));}Promise['all'](_0x14640a)[_0xef9a('0x23')](function(){_0x6d6e2f({'val':_0x1e3cde[_0xef9a('0x1d')]});});}});}function splitAdditionalPhone(_0x2cf102,_0x530bf8){return new Promise(function(_0xfb4b5,_0x3eabf2){var _0x51ddae=_0x530bf8[_0xef9a('0x26')](':');var _0x4a16b8=_0x51ddae[0x0];var _0x55598c=_0x51ddae[0x1];if(_0x55598c!==''){var _0x5cfa39=_0x55598c['split']('|');var _0x51c5b4=[];for(var _0x5f2b36=0x0;_0x5f2b36<_0x5cfa39[_0xef9a('0x1d')];_0x5f2b36++){if(_0x5cfa39[_0x5f2b36]!==''){var _0x3964d6=_[_0xef9a('0x27')](promisesAdditionalPhones,{'contactId':_0x2cf102,'phone':_0x5cfa39[_0x5f2b36]});if(_0x3964d6['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2cf102,'contactTypeId':_0x4a16b8,'phone':_0x5cfa39[_0x5f2b36],'orderBy':orderBy});}}}_0xfb4b5({'ok':0x1});}else _0xfb4b5({'res':0x0});});}function createAdditionalPhone(_0x19ba6e,_0x15f806,_0x3050cf,_0x44a212){var _0x49a07a='';var _0x219513='';var _0x240b9d=_0x3050cf[_0xef9a('0x26')]('§');_0x49a07a=_0x240b9d[0x0];if(_0x240b9d['length']==0x2)_0x219513=_0x240b9d[0x1];return new Promise(function(_0x264b15,_0x3b9ba5){return db[_0xef9a('0x28')][_0xef9a('0x29')]({'where':{'CmContactId':_0x19ba6e,'item':_0x49a07a}})['then'](function(_0x5914c7){if(_0x5914c7){return db[_0xef9a('0x28')][_0xef9a('0x2a')]({'ItemTypeId':_0x15f806,'description':_0x219513,'OrderBy':_0x44a212},{'where':{'CmContactId':_0x19ba6e,'item':_0x49a07a}})['then'](function(_0x449547){_0x264b15({'res':_0xef9a('0x2b')});});}else{return db[_0xef9a('0x28')][_0xef9a('0x2c')]({'CmContactId':_0x19ba6e,'item':_0x49a07a,'ItemTypeId':_0x15f806,'description':_0x219513,'OrderBy':_0x44a212,'ItemClass':_0xef9a('0x2d')})[_0xef9a('0x23')](function(_0x3d8ab6){_0x264b15({'res':_0xef9a('0x2e')});});}});});}function updateContact(_0xd7448f){return new Promise(function(_0x46bcc2,_0x23c32a){var _0x58c7db=_0xd7448f['id'];delete _0xd7448f['id'];return db['CmContact'][_0xef9a('0x2a')](_0xd7448f,{'where':{'id':_0x58c7db}})['then'](function(_0x1bc83e){updatedRows+=0x1;return db[_0xef9a('0x2f')][_0xef9a('0x2a')]({'phone':_0xd7448f[_0xef9a('0x1e')]},{'where':{'ContactId':_0x58c7db}})[_0xef9a('0x23')](function(_0x28d6e4){_0x46bcc2({'ret':'OK'});});});});}function insertCmHopper(_0x1ea3f1,_0x312640,_0x3d41bf,_0x755b9c,_0xdc3c1b){var _0x44b09b=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id',_0xef9a('0x30'),_0x312640+'.'+_0x755b9c,_0xef9a('0x31'),'cm_contacts.updatedAt',_0xef9a('0x32'),'cm_contacts.UserId','\x22'+_0xdc3c1b+'\x22'];return squel[_0xef9a('0x33')]()['into'](_0xef9a('0x34'))['fromQuery']([_0xef9a('0x1e'),_0xef9a('0x35'),'ContactId',_0xef9a('0x36'),_0x755b9c,_0xef9a('0x37'),_0xef9a('0x38'),_0xef9a('0x39'),_0xef9a('0x3a'),_0xef9a('0x3b')],squel['select']()['fields'](_0x44b09b)['from'](_0x312640)[_0xef9a('0x18')](_0xef9a('0x3c'),null,_0xef9a('0x3d')+_0x312640+'.CmListId')[_0xef9a('0x18')](_0x3d41bf,null,_0x3d41bf+_0xef9a('0x14')+_0x312640+'.'+_0x755b9c)[_0xef9a('0x16')](_0x312640+_0xef9a('0x3e'),_0x1ea3f1)[_0xef9a('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xef9a('0x16')](_0xef9a('0x3f'),selectNotIn(_0x312640,_0x3d41bf,_0x755b9c,_0xef9a('0x34'),[_0xef9a('0x40'),_0xef9a('0x41')]))[_0xef9a('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x312640,_0x3d41bf,_0x755b9c,_0xef9a('0x34'),[_0xef9a('0x40')])))[_0xef9a('0x42')]();}function insertCmHopperBlack(_0x3678ac,_0x360a6c,_0xbf9b51,_0x28a622){var _0x2f8fc3=[_0xef9a('0x43'),'cm_contacts.id','cm_contacts.ListId',_0x360a6c+'.'+_0x28a622,_0xef9a('0x31'),_0xef9a('0x44')];return squel[_0xef9a('0x33')]()[_0xef9a('0x45')]('cm_hopper_black')[_0xef9a('0x46')]([_0xef9a('0x1e'),_0xef9a('0x47'),_0xef9a('0x36'),_0x28a622,_0xef9a('0x37'),_0xef9a('0x38')],squel[_0xef9a('0x11')]()[_0xef9a('0x48')](_0x2f8fc3)['from'](_0x360a6c)[_0xef9a('0x18')](_0xef9a('0x3c'),null,_0xef9a('0x3d')+_0x360a6c+_0xef9a('0x49'))[_0xef9a('0x18')](_0xbf9b51,null,_0xbf9b51+'.id\x20=\x20'+_0x360a6c+'.'+_0x28a622)[_0xef9a('0x16')](_0x360a6c+_0xef9a('0x3e'),_0x3678ac)[_0xef9a('0x16')](_0xef9a('0x4a'),NOW)[_0xef9a('0x16')](_0xef9a('0x3f'),squel[_0xef9a('0x11')]()['field'](_0xef9a('0x1e'))[_0xef9a('0x13')](_0xef9a('0x4b'))[_0xef9a('0x16')](_0xef9a('0x4c'),_0x3678ac)[_0xef9a('0x16')](_0x28a622+_0xef9a('0x4d'),_0x360a6c+'.'+_0x28a622)))[_0xef9a('0x42')]();}function insertCmHopperAdditionalPhones(_0xbdf10c){var _0x2696df=[_0xef9a('0x4e'),_0xef9a('0x4f'),_0xef9a('0x50'),'cm_contact_has_items.createdAt',_0xef9a('0x51')];return squel[_0xef9a('0x33')]()[_0xef9a('0x45')](_0xef9a('0x52'))[_0xef9a('0x46')]([_0xef9a('0x53'),_0xef9a('0x1e'),_0xef9a('0x54'),_0xef9a('0x37'),_0xef9a('0x38')],squel[_0xef9a('0x11')]()[_0xef9a('0x48')](_0x2696df)[_0xef9a('0x13')](_0xef9a('0x34'))[_0xef9a('0x18')](_0xef9a('0x3c'),null,_0xef9a('0x55'))[_0xef9a('0x18')](_0xef9a('0x56'),null,_0xef9a('0x57'))[_0xef9a('0x16')]('cm_hopper.ListId\x20=\x20?',_0xbdf10c)['where'](_0xef9a('0x4a'),NOW))[_0xef9a('0x42')]();}function insertCmContact(_0x5609e4,_0x35fb8f,_0x594317,_0x248296){var _0x258458=_[_0xef9a('0x58')](_['keys'](_0x248296),[_0xef9a('0x36'),_0xef9a('0x59'),'createdAt','updatedAt']);return squel[_0xef9a('0x33')]()[_0xef9a('0x45')](_0xef9a('0x3c'))['fromQuery'](_0x258458,squel[_0xef9a('0x11')]()['fields'](_0x258458)[_0xef9a('0x13')](_0x35fb8f)['where']('('+_0x594317[_0xef9a('0x18')](',')+_0xef9a('0x5a'),squel[_0xef9a('0x11')]()[_0xef9a('0x48')](_0x594317)[_0xef9a('0x13')](_0xef9a('0x3c'))[_0xef9a('0x16')](_0xef9a('0x4c'),_0x5609e4))[_0xef9a('0x16')](_0xef9a('0x5b'),squel['select']()[_0xef9a('0x12')]('MIN(id)',_0xef9a('0x5c'))[_0xef9a('0x13')](_0x35fb8f)['group'](_0x594317[_0xef9a('0x18')](','))))[_0xef9a('0x42')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x158eab){logger[_0xef9a('0x5d')](_0x158eab[_0xef9a('0x25')]);process['exit'](0x1);}function handleError(_0x3229fd,_0x5b86a1){stats[_0xef9a('0x5e')][_0xef9a('0x21')]({'name':_0x5b86a1[_0xef9a('0x5f')],'message':_0x5b86a1[_0xef9a('0x25')],'row':_0x3229fd});}function handleQuery(_0x7d0db5){logger[_0xef9a('0x60')](_0x7d0db5);return db[_0xef9a('0x19')][_0xef9a('0x1a')](_0x7d0db5)[_0xef9a('0x1c')](function(_0x3fdfe6){results['push'](_0x3fdfe6);})[_0xef9a('0x24')](function(_0x2ac729){logger['error'](_0x2ac729[_0xef9a('0x25')]);});}function main(_0x1f1a47,_0x57ee4d,_0x5e60e0,_0x118751){logger[_0xef9a('0x60')](_0xef9a('0x61'),_0x1f1a47,JSON['stringify'](_0x57ee4d));process[_0xef9a('0x62')]('start');var _0x35722e=_0x57ee4d[_0xef9a('0x63')];var _0x515dcb=_['clone'](_0x35722e);var _0x4a00d2=_0x57ee4d[_0xef9a('0x64')];var _0x15cd21=path[_0xef9a('0x18')](config[_0xef9a('0x65')],_0xef9a('0x66'),_0x4a00d2+'.csv');logger[_0xef9a('0x60')](_0xef9a('0x67'),_0x57ee4d);db['ContactItemType'][_0xef9a('0x68')]({'raw':!![],'attributes':['id',_0xef9a('0x69')]})[_0xef9a('0x23')](function(_0x3cf4ce){for(var _0x23ff3f=0x0;_0x23ff3f<_0x3cf4ce[_0xef9a('0x1d')];_0x23ff3f++){if(_0x3cf4ce[_0x23ff3f][_0xef9a('0x69')]in _0x35722e){contactItemTypes['push'](_0x3cf4ce[_0x23ff3f]);delete _0x515dcb[_0x3cf4ce[_0x23ff3f]['name']];hasAdditionalPhones=!![];}for(var _0x314fc2 in _0x35722e){if(_0x3cf4ce[_0x23ff3f][_0xef9a('0x69')]+'_description'===_0x314fc2){phoneDescriptions['push']({'itemTypeId':_0x3cf4ce[_0x23ff3f]['id'],'description':_0x314fc2});delete _0x515dcb[_0x314fc2];}}}if(hasAdditionalPhones)_0x515dcb[_0xef9a('0x20')]='';var _0x575bee=_[_0xef9a('0x6a')](_0x515dcb)[_0xef9a('0x18')]();logger[_0xef9a('0x60')](_0xef9a('0x6b'),_0x575bee);fs[_0xef9a('0x6c')](_0x15cd21,_0x575bee+'\x0a');Papa[_0xef9a('0x6d')](fs[_0xef9a('0x6e')](_0x1f1a47),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d25bf,_0x38cc93){try{for(var _0x5c21fa=0x0,_0x4fc943=[];_0x5c21fa<_0x3d25bf[_0xef9a('0x6f')]['length'];_0x5c21fa++){stats['rows']+=0x1;if(_0x3d25bf[_0xef9a('0x5e')][_0x5c21fa]){handleError(_0x3d25bf[_0xef9a('0x6f')][_0x5c21fa],_0x3d25bf[_0xef9a('0x5e')][_0x5c21fa]);}else{var _0x5b3bfa=[];var _0x1dca61=[];var _0x34f91d={};for(var _0x374158 in _0x35722e){let _0x48f586=contactItemTypes[_0xef9a('0x70')](_0x53ceb4=>_0x53ceb4[_0xef9a('0x69')]===_0x374158);let _0x121ed9=contactItemTypes[_0xef9a('0x70')](_0x20efcd=>_0x20efcd[_0xef9a('0x69')]+_0xef9a('0x71')===_0x374158);if(_[_0xef9a('0x1f')](_0x48f586)&&_[_0xef9a('0x1f')](_0x121ed9)){if(_0x35722e[_0xef9a('0x72')](_0x374158)){if(_0x3d25bf[_0xef9a('0x6f')][_0x5c21fa][_0x35722e[_0x374158]]){var _0x382d73=_[_0xef9a('0x73')](_0x3d25bf[_0xef9a('0x6f')][_0x5c21fa][_0x35722e[_0x374158]][_0xef9a('0x74')](/"/g,'\x27'));switch(_0x374158){case _0xef9a('0x35'):var _0x2a828e=moment(_0x382d73,_0xef9a('0xd'),!![]);if(_0x2a828e['isValid']()){_0x4fc943[_0xef9a('0x21')]('\x22'+_0x382d73+'\x22');}else{_0x5b3bfa[_0xef9a('0x21')](_0xef9a('0x75'));}break;case _0xef9a('0x39'):var _0x19b890=parseInt(_0x382d73);_0x382d73=_[_0xef9a('0x76')](_0x19b890)||_0x19b890<0x0||_0x19b890>0x4?_0x118751?0x3:0x2:_0x19b890;_0x4fc943[_0xef9a('0x21')]('\x22'+_0x382d73+'\x22');break;case _0xef9a('0x3a'):var _0x825125=parseInt(_0x382d73);if(_[_0xef9a('0x77')](_0x825125)&&_['includes'](_0x5e60e0,_0x825125)){_0x4fc943[_0xef9a('0x21')]('\x22'+_0x825125+'\x22');}else{_0x5b3bfa[_0xef9a('0x21')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x382d73)){_0x4fc943[_0xef9a('0x21')]('\x22'+_0x382d73+'\x22');}else{_0x5b3bfa['push'](_0xef9a('0x78'));}break;case'dateOfBirth':var _0x50afd6=moment(_0x382d73,_0xef9a('0x79'),!![]);if(_0x50afd6[_0xef9a('0x7a')]()){_0x4fc943[_0xef9a('0x21')]('\x22'+_0x382d73+'\x22');}else{_0x5b3bfa[_0xef9a('0x21')](_0xef9a('0x7b'));}break;default:_0x4fc943[_0xef9a('0x21')]('\x22'+_0x382d73+'\x22');}}else{switch(_0x374158){case'firstName':case _0xef9a('0x1e'):_0x5b3bfa[_0xef9a('0x21')](_0x374158+'\x20not\x20specified');break;default:_0x4fc943[_0xef9a('0x21')]('\x22\x22');}}}}else{var _0xf6b6c5='';if(!_[_0xef9a('0x1f')](_0x48f586)){if(!_0x34f91d[_0xef9a('0x72')](_0x48f586['id'])){for(var _0x183cd2=0x0;_0x183cd2<_0x35722e[_0x374158][_0xef9a('0x1d')];_0x183cd2++){var _0x382d73=_['trim'](_0x3d25bf[_0xef9a('0x6f')][_0x5c21fa][_0x35722e[_0x374158][_0x183cd2]]['replace'](/"/g,'\x27'));var _0x13fd27=phoneDescriptions[_0xef9a('0x70')](_0x246cd7=>_0x246cd7[_0xef9a('0x7c')]===_0x48f586['id']);if(!_[_0xef9a('0x1f')](_0x13fd27)){var _0x1501ad=_[_0xef9a('0x73')](_0x3d25bf['data'][_0x5c21fa][_0x35722e[_0x13fd27[_0xef9a('0x7d')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xef9a('0x1f')](_0x1501ad))_0x382d73=_0x382d73+'§'+_0x1501ad;}if(_0xf6b6c5=='')_0xf6b6c5=_0x382d73;else _0xf6b6c5+='|'+_0x382d73;}_0x1dca61[_0xef9a('0x21')](_0x48f586['id']+':'+_0xf6b6c5);_0x34f91d[_0x48f586['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4fc943['push']('\x22'+_0x1dca61[_0xef9a('0x18')](';')+'\x22');}if(_0x5b3bfa[_0xef9a('0x1d')]){handleError(_0x3d25bf[_0xef9a('0x6f')][_0x5c21fa],{'code':_0xef9a('0x7e'),'message':_0x5b3bfa['join']()});}else{fs[_0xef9a('0x7f')](_0x15cd21,_0x4fc943[_0xef9a('0x18')]()+'\x0a');}_0x4fc943=[];}if(!(stats[_0xef9a('0x80')]%0xc8)){socket['emit'](_0xef9a('0x81')+_0x4a00d2,stats);stats[_0xef9a('0x5e')]=[];}}if(stopped){logger[_0xef9a('0x60')]('Abort\x20parser');_0x38cc93[_0xef9a('0x82')]();}}catch(_0x307c96){handleError(_0x3d25bf['data'][_0x5c21fa],{'code':_0xef9a('0x83'),'message':_0x307c96[_0xef9a('0x25')]});logger['error'](_0xef9a('0x84'),_0x307c96['message']);}},'complete':function(){try{var _0x1bdba2=[];var _0x1363cb=tempTableName;_0x1bdba2[_0xef9a('0x21')](_0xef9a('0x85')+_0x1363cb+_0xef9a('0x86'));logger[_0xef9a('0x60')](_0xef9a('0x87'),contactItemTypes[_0xef9a('0x1d')]);var _0x2e47d8=util[_0xef9a('0x88')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x15cd21,_0x1363cb,_0x575bee,_0x57ee4d['ListId'],_0x57ee4d[_0xef9a('0x59')]||null,NOW,NOW);if(_[_0xef9a('0x1f')](_0x35722e[_0xef9a('0x35')])){_0x2e47d8+=_0xef9a('0x89');}_0x1bdba2[_0xef9a('0x21')](_0x2e47d8);BPromise['each'](_0x1bdba2,handleQuery)[_0xef9a('0x23')](function(_0x191195){BPromise[_0xef9a('0x22')]([handleAdditionalPhones()])[_0xef9a('0x23')](function(){_0x1bdba2=[];for(var _0x478add=0x0;_0x478add\x20\x20');}var _0x5efade=path['join'](config[_0xef9a('0x65')],_0xef9a('0x66'),process['argv'][0x2]);if(!fs[_0xef9a('0x93')](_0x5efade)){throw new Error(_0xef9a('0x94'));}var _0x5b41d0={};try{_0x5b41d0=JSON[_0xef9a('0x6d')](process['argv'][0x3]);if(!_0x5b41d0[_0xef9a('0x63')]){throw new Error(_0xef9a('0x95'));}var _0x4ef89a=0x0;if(_0x5b41d0[_0xef9a('0x63')]['UserId']){_0x4ef89a=0x1;}if(!_0x5b41d0[_0xef9a('0x36')]){throw new Error(_0xef9a('0x96'));}}catch(_0x3a3a02){throw new Error(_0xef9a('0x97'));}var _0x356c18=[];try{_0x356c18=_['map'](JSON['parse'](process[_0xef9a('0x92')][0x4]),'id');}catch(_0x40acd6){logger['info']('No\x20agent\x20available');}main(_0x5efade,_0x5b41d0,_0x356c18,_0x4ef89a);}validate();process['on'](_0xef9a('0x98'),handleStop);process['on'](_0xef9a('0x99'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 6313525..7bbce39 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d02=['***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','talktime','outbound','Called\x20Number','Member\x20Name','membername','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','calleridnum','Outbound\x20Call','destcalleridnum','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number'];(function(_0x5ca8fe,_0x5ab430){var _0x1095df=function(_0x352c17){while(--_0x352c17){_0x5ca8fe['push'](_0x5ca8fe['shift']());}};_0x1095df(++_0x5ab430);}(_0x9d02,0x127));var _0x29d0=function(_0x1e7002,_0x1cd53b){_0x1e7002=_0x1e7002-0x0;var _0x506c2a=_0x9d02[_0x1e7002];return _0x506c2a;};'use strict';exports[_0x29d0('0x0')]=function(_0x323597,_0xd34b7b){var _0x1d375b=[{'type':_0x29d0('0x1'),'content':_0x29d0('0x2'),'variableName':null}];switch(_0x323597[_0x29d0('0x3')]()){case _0x29d0('0x4'):switch(_0xd34b7b[_0x29d0('0x3')]()){case'inbound':_0x1d375b[_0x29d0('0x5')]({'type':_0x29d0('0x6'),'content':'','variableName':'queue'});_0x1d375b[_0x29d0('0x5')]({'type':_0x29d0('0x6'),'content':'','variableName':_0x29d0('0x7')});break;case'outbound':_0x1d375b[_0x29d0('0x5')]({'type':'string','content':_0x29d0('0x8'),'variableName':null});_0x1d375b[_0x29d0('0x5')]({'type':_0x29d0('0x6'),'content':'','variableName':_0x29d0('0x9')});break;}}return _0x1d375b;};exports['getDescriptions']=function(_0x12285b,_0x224c65){var _0x45d7f6=[];switch(_0x12285b[_0x29d0('0x3')]()){case _0x29d0('0x4'):switch(_0x224c65[_0x29d0('0x3')]()){case _0x29d0('0xa'):_0x45d7f6=[{'type':_0x29d0('0x1'),'content':_0x29d0('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0xd'),'keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x7')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0xe'),'keyType':_0x29d0('0x6'),'variableName':'calleridname'},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0xf'),'keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x10')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x11'),'keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x12')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x13'),'keyType':'variable','variableName':_0x29d0('0x14')},{'type':'keyValue','content':'','key':_0x29d0('0x15'),'keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x16')},{'type':_0x29d0('0x1'),'content':_0x29d0('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x18'),'keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x19')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x1a'),'keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x9')},{'type':'string','content':_0x29d0('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x29d0('0xc'),'content':'','key':'Agent\x20Ring','keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x16')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x1c'),'keyType':'variable','variableName':_0x29d0('0x1d')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x1e'),'keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x1f')},{'type':_0x29d0('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x29d0('0x6'),'variableName':_0x29d0('0x20')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x29d0('0x21')}];break;case _0x29d0('0x22'):_0x45d7f6=[{'type':_0x29d0('0x1'),'content':_0x29d0('0xb'),'variableName':null},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x23'),'keyType':'variable','keyContent':'','variableName':_0x29d0('0x9')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x24'),'keyType':_0x29d0('0x6'),'keyContent':'','variableName':_0x29d0('0x25')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x13'),'keyType':_0x29d0('0x6'),'keyContent':'','variableName':_0x29d0('0x14')},{'type':_0x29d0('0xc'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':'starttime'},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x26'),'keyType':'variable','keyContent':'','variableName':_0x29d0('0x27')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x28'),'keyType':'variable','keyContent':'','variableName':_0x29d0('0x29')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x2a'),'keyType':_0x29d0('0x6'),'keyContent':'','variableName':_0x29d0('0x2b')},{'type':_0x29d0('0xc'),'content':'','key':_0x29d0('0x2c'),'keyType':'variable','keyContent':'','variableName':_0x29d0('0x2d')}];break;}}return _0x45d7f6;}; \ No newline at end of file +var _0x32d3=['Duration','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','queue','push','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','holdtime','Talk\x20Time','talktime','Member\x20Name','Date','starttime','Answer\x20Time','answertime','Complete\x20Time'];(function(_0x4d4662,_0xf16f8c){var _0x596ae4=function(_0x19f893){while(--_0x19f893){_0x4d4662['push'](_0x4d4662['shift']());}};_0x596ae4(++_0xf16f8c);}(_0x32d3,0x137));var _0x332d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x32d3[_0x2dafbe];return _0x58a45a;};'use strict';exports[_0x332d('0x0')]=function(_0x1765c4,_0x8b97b9){var _0x457de1=[{'type':'string','content':_0x332d('0x1'),'variableName':null}];switch(_0x1765c4['toLowerCase']()){case _0x332d('0x2'):switch(_0x8b97b9[_0x332d('0x3')]()){case _0x332d('0x4'):_0x457de1['push']({'type':_0x332d('0x5'),'content':'','variableName':_0x332d('0x6')});_0x457de1[_0x332d('0x7')]({'type':_0x332d('0x5'),'content':'','variableName':_0x332d('0x8')});break;case _0x332d('0x9'):_0x457de1[_0x332d('0x7')]({'type':_0x332d('0xa'),'content':_0x332d('0xb'),'variableName':null});_0x457de1[_0x332d('0x7')]({'type':'variable','content':'','variableName':_0x332d('0xc')});break;}}return _0x457de1;};exports[_0x332d('0xd')]=function(_0x2f2c95,_0x378809){var _0x578a77=[];switch(_0x2f2c95['toLowerCase']()){case _0x332d('0x2'):switch(_0x378809['toLowerCase']()){case _0x332d('0x4'):_0x578a77=[{'type':_0x332d('0xa'),'content':_0x332d('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x10'),'keyType':_0x332d('0x5'),'variableName':'calleridnum'},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x11'),'keyType':'variable','variableName':_0x332d('0x12')},{'type':_0x332d('0xf'),'content':'','key':'Call\x20To','keyType':_0x332d('0x5'),'variableName':_0x332d('0x13')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x14'),'keyType':_0x332d('0x5'),'variableName':_0x332d('0x6')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x15'),'keyType':_0x332d('0x5'),'variableName':_0x332d('0x16')},{'type':_0x332d('0xf'),'content':'','key':'Date','keyType':'variable','variableName':_0x332d('0x17')},{'type':_0x332d('0xa'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x18'),'keyType':_0x332d('0x5'),'variableName':_0x332d('0x19')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x1a'),'keyType':_0x332d('0x5'),'variableName':_0x332d('0xc')},{'type':'string','content':_0x332d('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x1c'),'keyType':'variable','variableName':_0x332d('0x17')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x1d'),'keyType':_0x332d('0x5'),'variableName':_0x332d('0x1e')},{'type':_0x332d('0xf'),'content':'','key':'Agent\x20Complete','keyType':_0x332d('0x5'),'variableName':_0x332d('0x1f')},{'type':_0x332d('0xf'),'content':'','key':'Hold\x20Time','keyType':_0x332d('0x5'),'variableName':_0x332d('0x20')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x21'),'keyType':_0x332d('0x5'),'variableName':_0x332d('0x22')}];break;case _0x332d('0x9'):_0x578a77=[{'type':_0x332d('0xa'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x332d('0xf'),'content':'','key':'Called\x20Number','keyType':_0x332d('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x23'),'keyType':_0x332d('0x5'),'keyContent':'','variableName':'membername'},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x15'),'keyType':_0x332d('0x5'),'keyContent':'','variableName':_0x332d('0x16')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x24'),'keyType':_0x332d('0x5'),'keyContent':'','variableName':_0x332d('0x25')},{'type':_0x332d('0xa'),'content':_0x332d('0x1b')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x26'),'keyType':_0x332d('0x5'),'keyContent':'','variableName':_0x332d('0x27')},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x28'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x332d('0xf'),'content':'','key':_0x332d('0x29'),'keyType':_0x332d('0x5'),'keyContent':'','variableName':_0x332d('0x2a')},{'type':_0x332d('0xf'),'content':'','key':'Billable\x20Time','keyType':_0x332d('0x5'),'keyContent':'','variableName':_0x332d('0x2b')}];break;}}return _0x578a77;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index de8be0d..742b09a 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04b7=['ids','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','query','clone','body','omit','fax','mobile','updateUser','lodash','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','user','having','read','tags','checkAccountsRestrictions','group','i.id'];(function(_0x4d208f,_0x1730e8){var _0x4e2d22=function(_0x167577){while(--_0x167577){_0x4d208f['push'](_0x4d208f['shift']());}};_0x4e2d22(++_0x1730e8);}(_0x04b7,0x1bb));var _0x704b=function(_0x33c3d3,_0x51eed3){_0x33c3d3=_0x33c3d3-0x0;var _0xf3a17f=_0x04b7[_0x33c3d3];return _0xf3a17f;};'use strict';var _=require(_0x704b('0x0'));var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0x704b('0x1')]=function(_0x226411,_0x38d73e,_0x344f0b,_0x4ec5e4,_0x2112e8){var _0xc704ea={'count':0x0,'rows':[]};var _0x5ed083=sqlUtils[_0x704b('0x2')](_0x226411,_0x344f0b,_0x38d73e);if(_0x5ed083){return Promise[_0x704b('0x3')](_0xc704ea);}var _0x352031=sqlUtils[_0x704b('0x4')](_0x226411);var _0x13305a={};return Promise['resolve']()[_0x704b('0x5')](function(){if(_0x38d73e[_0x704b('0x6')]){return sqlUtils[_0x704b('0x7')](_0x38d73e['search'],_0x2112e8);}else{return sqlUtils[_0x704b('0x8')](_0x226411,_0x38d73e,_0x2112e8);}})[_0x704b('0x5')](function(_0x185bcc){_0x352031[_0x704b('0x9')](_0x185bcc['body']);_0x352031[_0x704b('0x9')](_0x185bcc['contact']);_0x352031[_0x704b('0x9')](_0x185bcc[_0x704b('0xa')]);_0x352031[_0x704b('0x9')](_0x185bcc[_0x704b('0xb')]);_0x352031[_0x704b('0x9')](_0x185bcc['filter']);_0x352031['where'](_0x185bcc[_0x704b('0xc')]);_0x352031[_0x704b('0xd')](_0x185bcc[_0x704b('0xe')]);_0x13305a=_0x185bcc[_0x704b('0xf')];return sqlUtils[_0x704b('0x10')](_0x226411,_0x344f0b,_0x38d73e);})['then'](function(_0x4e7989){_0x352031[_0x704b('0x9')](_0x4e7989);_0x352031[_0x704b('0x11')](_0x704b('0x12'));var _0x3953bc=_0x38d73e[_0x704b('0x6')]?_0x13305a[_0x704b('0x13')]:_0x38d73e[_0x704b('0x14')];return sqlUtils[_0x704b('0x15')](_0x352031,_0x3953bc);})[_0x704b('0x5')](function(_0xe6e939){_0xc704ea[_0x704b('0x16')]=_0xe6e939[_0x704b('0x17')];if(_0xc704ea[_0x704b('0x16')]===0x0){return[];}_0x352031[_0x704b('0xd')](_0x13305a[_0x704b('0x18')]);if(_0x4ec5e4[_0x704b('0x19')]){_0x4ec5e4[_0x704b('0x19')][_0x704b('0x1a')](function(_0x1a5b74){var _0x1e0380=_0x1a5b74[0x0]===_0x704b('0x1b')?_0x1a5b74[0x0]:'i.'+_0x1a5b74[0x0];_0x352031[_0x704b('0x19')](_0x1e0380,_0x1a5b74[0x1]===_0x704b('0x1c')?![]:!![]);if(_0x1a5b74[0x0]===_0x704b('0x1d')){var _0x52cef8=sqlUtils[_0x704b('0x1e')](_0x226411,_0x38d73e);_0x352031[_0x704b('0x19')](_0x52cef8,_0x1a5b74[0x1]===_0x704b('0x1c')?![]:!![]);}});}return sqlUtils[_0x704b('0x1f')](_0x226411,_0x352031,_0x38d73e,_0x4ec5e4);})[_0x704b('0x5')](function(_0x121cfa){_0xc704ea[_0x704b('0x20')]=_0x121cfa;return _0xc704ea;})[_0x704b('0x21')](function(_0x3d9c10){throw _0x3d9c10;});};exports[_0x704b('0x22')]=function(_0x1a397f,_0x1f85f1){return function(_0x34dfe3,_0xd010f,_0x56e931){var _0x339e8d=_0x34dfe3[_0x704b('0xc')];var _0x242d96={};var _0x21a7ea=_0x34dfe3[_0x704b('0x23')];if(_0x242d96){_0x242d96=_[_0x704b('0x24')](_0x34dfe3[_0x704b('0x25')]);_0x242d96=_[_0x704b('0x26')](_0x242d96,[_0x704b('0x25'),'html','phone',_0x704b('0x27'),_0x704b('0x28')]);}utils[_0x704b('0x29')](_0x339e8d,_0x242d96,_0x21a7ea,_0x1a397f,_0x1f85f1);_0x56e931(null);};}; \ No newline at end of file +var _0xf098=['./sql-utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','search','parseAdvancedSearchFilter','then','where','body','contact','default','filter','user','having','tags','group','i.id','countFilteredInteractions','count','length','clause','contactName','order','DESC','closed','getClosedOrderClause','getFilteredInteractions','catch','tracked','query','omit','html','phone','fax','mobile','updateUser','lodash'];(function(_0x29c558,_0x591f21){var _0x30db70=function(_0x2d078){while(--_0x2d078){_0x29c558['push'](_0x29c558['shift']());}};_0x30db70(++_0x591f21);}(_0xf098,0x97));var _0x8f09=function(_0x3ff34f,_0x4c01df){_0x3ff34f=_0x3ff34f-0x0;var _0x86ad1b=_0xf098[_0x3ff34f];return _0x86ad1b;};'use strict';var _=require(_0x8f09('0x0'));var sqlUtils=require(_0x8f09('0x1'));var utils=require('./utils');exports[_0x8f09('0x2')]=function(_0x145b21,_0x34f89d,_0x253bfd,_0xae535c,_0x3fb01b){var _0x4fb497={'count':0x0,'rows':[]};var _0x35037c=sqlUtils[_0x8f09('0x3')](_0x145b21,_0x253bfd,_0x34f89d);if(_0x35037c){return Promise[_0x8f09('0x4')](_0x4fb497);}var _0x26df22=sqlUtils[_0x8f09('0x5')](_0x145b21);var _0x1adfa8={};return Promise[_0x8f09('0x4')]()['then'](function(){if(_0x34f89d[_0x8f09('0x6')]){return sqlUtils[_0x8f09('0x7')](_0x34f89d['search'],_0x3fb01b);}else{return sqlUtils['parseQueryParameters'](_0x145b21,_0x34f89d,_0x3fb01b);}})[_0x8f09('0x8')](function(_0x51e49f){_0x26df22[_0x8f09('0x9')](_0x51e49f[_0x8f09('0xa')]);_0x26df22[_0x8f09('0x9')](_0x51e49f[_0x8f09('0xb')]);_0x26df22['where'](_0x51e49f[_0x8f09('0xc')]);_0x26df22['where'](_0x51e49f['fields']);_0x26df22[_0x8f09('0x9')](_0x51e49f[_0x8f09('0xd')]);_0x26df22[_0x8f09('0x9')](_0x51e49f[_0x8f09('0xe')]);_0x26df22[_0x8f09('0xf')](_0x51e49f['read']);_0x1adfa8=_0x51e49f[_0x8f09('0x10')];return sqlUtils['checkAccountsRestrictions'](_0x145b21,_0x253bfd,_0x34f89d);})[_0x8f09('0x8')](function(_0x119d8e){_0x26df22['where'](_0x119d8e);_0x26df22[_0x8f09('0x11')](_0x8f09('0x12'));var _0x3bf857=_0x34f89d[_0x8f09('0x6')]?_0x1adfa8['ids']:_0x34f89d['tag'];return sqlUtils[_0x8f09('0x13')](_0x26df22,_0x3bf857);})[_0x8f09('0x8')](function(_0x1fc984){_0x4fb497[_0x8f09('0x14')]=_0x1fc984[_0x8f09('0x15')];if(_0x4fb497[_0x8f09('0x14')]===0x0){return[];}_0x26df22[_0x8f09('0xf')](_0x1adfa8[_0x8f09('0x16')]);if(_0xae535c['order']){_0xae535c['order']['forEach'](function(_0x526e18){var _0x4f569d=_0x526e18[0x0]===_0x8f09('0x17')?_0x526e18[0x0]:'i.'+_0x526e18[0x0];_0x26df22[_0x8f09('0x18')](_0x4f569d,_0x526e18[0x1]===_0x8f09('0x19')?![]:!![]);if(_0x526e18[0x0]===_0x8f09('0x1a')){var _0x15f494=sqlUtils[_0x8f09('0x1b')](_0x145b21,_0x34f89d);_0x26df22[_0x8f09('0x18')](_0x15f494,_0x526e18[0x1]===_0x8f09('0x19')?![]:!![]);}});}return sqlUtils[_0x8f09('0x1c')](_0x145b21,_0x26df22,_0x34f89d,_0xae535c);})[_0x8f09('0x8')](function(_0x3d48ac){_0x4fb497['rows']=_0x3d48ac;return _0x4fb497;})[_0x8f09('0x1d')](function(_0x4e3cc1){throw _0x4e3cc1;});};exports[_0x8f09('0x1e')]=function(_0x2e692e,_0x272284){return function(_0x128988,_0x127070,_0x46364b){var _0x1cef50=_0x128988[_0x8f09('0xe')];var _0x2ac096={};var _0x50cc1f=_0x128988[_0x8f09('0x1f')];if(_0x2ac096){_0x2ac096=_['clone'](_0x128988[_0x8f09('0xa')]);_0x2ac096=_[_0x8f09('0x20')](_0x2ac096,[_0x8f09('0xa'),_0x8f09('0x21'),_0x8f09('0x22'),_0x8f09('0x23'),_0x8f09('0x24')]);}utils[_0x8f09('0x25')](_0x1cef50,_0x2ac096,_0x50cc1f,_0x2e692e,_0x272284);_0x46364b(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index c2409b6..482f3f1 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8925=['ContactId','end','Tag','map','and','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','createdAt','$gte','parse','$lte','null','\x20=\x20?','then','fields','clause','filter','get','chat','Websites','Accounts','resolve','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','getInteractionFK','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.UserId','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','toString','groupBy','Setting','enableEmailPreview','all','clone','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','tools_tags','user_has_','_interactions','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','openchannel','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','conditions','find','buildExpression','type','default','text','value','start','read','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','name'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8925,0xfb));var _0x5892=function(_0x10a546,_0x5ea132){_0x10a546=_0x10a546-0x0;var _0x30e897=_0x8925[_0x10a546];return _0x30e897;};'use strict';var _=require(_0x5892('0x0'));var squel=require(_0x5892('0x1'));var as=require(_0x5892('0x2'));var qs=require(_0x5892('0x3'));var updateInteraction=require(_0x5892('0x4'))['updateInteraction'];var utils=require(_0x5892('0x5'));var db=require(_0x5892('0x6'))['db'];function skipInteractionsQuery(_0x130074,_0x5755c3,_0x5cc7f5){var _0x2d5197=![];var _0x59020a=utils[_0x5892('0x7')](_0x130074);if(_0x5755c3[_0x5892('0x8')]==='agent'&&!_0x5cc7f5[_0x5892('0x9')]&&!_0x5cc7f5[_0x59020a]){_0x2d5197=!![];}return _0x2d5197;}function getTagsQuery(){return squel[_0x5892('0xa')]()[_0x5892('0xb')]('id')['field']('name')['field']('color')['from'](_0x5892('0xc'));}function getUsersQuery(_0x291ad3,_0x49d62c){var _0x5a6167=utils['getInteractionFK'](_0x291ad3);var _0x299235=_0x5892('0xd')+_0x291ad3+_0x5892('0xe');var _0x1ec13c=squel[_0x5892('0xa')]()[_0x5892('0xb')](_0x5892('0xf'))[_0x5892('0xb')](_0x5892('0x10'))['field'](_0x5892('0x11')+_0x5a6167)[_0x5892('0x12')](_0x299235,'ui')[_0x5892('0x13')](_0x5892('0x14'),'u',_0x5892('0x15'));if(_0x49d62c[_0x5892('0x16')]>0x0){_0x1ec13c[_0x5892('0x17')](_0x5892('0x11')+_0x5a6167+_0x5892('0x18'),_['map'](_0x49d62c,'id'));}return _0x1ec13c;}function getInteractionsQuery(_0x5e1926){var _0x4dd4ca=utils[_0x5892('0x19')](_0x5e1926);var _0x4f2f74=utils['getAccountFK'](_0x5e1926);var _0x4b2068=utils['getInteractionFK'](_0x5e1926);return squel[_0x5892('0xa')]()['from'](_0x4dd4ca[_0x5892('0x1a')],'i')[_0x5892('0x13')]('cm_contacts','c',_0x5892('0x1b'))[_0x5892('0x13')]('users','o',_0x5892('0x1c'))[_0x5892('0x13')](_0x4dd4ca['accounts'],'a',_0x5892('0x1d')+_0x4f2f74)['left_join'](_0x4dd4ca[_0x5892('0x1e')],'me',_0x5892('0x1f')+_0x4b2068+_0x5892('0x20'))['left_join'](_0x4dd4ca[_0x5892('0x21')],'it',_0x5892('0x22')+_0x4b2068+_0x5892('0x20'))['left_join'](_0x5892('0xc'),'t',_0x5892('0x23'));}function getSqlClauses(){var _0x1948a4={'body':squel[_0x5892('0x24')](),'contact':squel[_0x5892('0x24')](),'default':squel[_0x5892('0x24')](),'fields':squel[_0x5892('0x24')](),'filter':squel[_0x5892('0x24')](),'read':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x5892('0x24')]()};return _0x1948a4;}function parseTagParameter(_0x19e224){var _0x189a8a=squel[_0x5892('0x24')]();if(_0x19e224){var _0x4927bc=utils[_0x5892('0x25')](_0x19e224);_0x4927bc[_0x5892('0x26')](function(_0x3d4f0d){_0x189a8a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d4f0d+',%');});}return _0x189a8a;}function parseReadParameter(_0x49033f){var _0x1ac813='';if(_0x49033f){_0x1ac813=_0x5892('0x27');if(_0x49033f==='1'){_0x1ac813=_0x1ac813['replace'](_0x5892('0x28'),'=');}else{_0x1ac813=_0x1ac813[_0x5892('0x29')](_0x5892('0x28'),'>');}}return _0x1ac813;}function parseSearchFilter(_0x3eb6ae,_0x2da9c1){var _0x1d4ecc=squel[_0x5892('0x24')]();if(_0x2da9c1){var _0x5e5fb9=_0x2da9c1[_0x5892('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5892('0x2a')](_0x5e5fb9)){_0x1d4ecc['or'](_0x5892('0x2b'),_0x5e5fb9+'%');if([_0x5892('0x2c'),'whatsapp'][_0x5892('0x2d')](_0x3eb6ae)){_0x1d4ecc['or'](_0x5892('0x2e'),_0x5e5fb9+'%');}else if(_0x3eb6ae===_0x5892('0x2f')){_0x1d4ecc['or']('i.fax\x20LIKE\x20?',_0x5e5fb9+'%');}else if(_0x3eb6ae===_0x5892('0x30')){_0x1d4ecc['or']('i.from\x20LIKE\x20?',_0x5e5fb9+'%');}}else if(_0x3eb6ae===_0x5892('0x31')&&qs[_0x5892('0x32')](_0x5e5fb9)){_0x1d4ecc['or']('c.email\x20LIKE\x20?',_0x5e5fb9+'%');}else{if(_0x3eb6ae===_0x5892('0x31')){_0x1d4ecc['or'](_0x5892('0x33'),qs[_0x5892('0x34')](_0x5e5fb9,!![]))['or'](_0x5892('0x35'),qs['getFullTextValue'](_0x5e5fb9));}else if(_0x3eb6ae!==_0x5892('0x2f')){_0x1d4ecc['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5e5fb9));}_0x1d4ecc['or'](_0x5892('0x36'),qs['getFullTextValue'](_0x5e5fb9,!![]),null);}}return _0x1d4ecc;}function parseAdvancedSearchFilter(_0x198a00,_0x23de6f){var _0x4b9a44=getSqlClauses();var _0x1612d0=as['parseSearch'](_0x198a00);var _0x18787d=_0x1612d0['sqlOperator'];for(var _0x5e8044=0x0;_0x5e8044<_0x1612d0[_0x5892('0x37')][_0x5892('0x16')];_0x5e8044++){var _0x2b1598=_0x1612d0[_0x5892('0x37')][_0x5e8044];var _0x25bb3f='i';var _0x34de6f=_[_0x5892('0x38')](_0x23de6f,['name',_0x2b1598['field']]);if(_0x34de6f){var _0x201280=as[_0x5892('0x39')](_0x25bb3f,_0x34de6f[_0x5892('0x3a')],_0x2b1598);_0x4b9a44[_0x5892('0x3b')][_0x18787d](_0x201280[_0x5892('0x3c')],_0x201280[_0x5892('0x3d')][_0x5892('0x3e')],_0x201280[_0x5892('0x3d')]['end']);}else{switch(_0x2b1598[_0x5892('0xb')]){case'unreadMessages':var _0x5c7596=parseReadParameter(_0x2b1598[_0x5892('0x3d')]);_0x4b9a44[_0x5892('0x3f')]['and'](_0x5c7596);break;case _0x5892('0x40'):if(_0x2b1598[_0x5892('0x41')]===_0x5892('0x42')){if(_0x2b1598[_0x5892('0x3d')][_0x5892('0x43')]('\x20')['length']>0x1){_0x4b9a44['contact'][_0x18787d](_0x5892('0x36'),qs[_0x5892('0x34')](_0x2b1598['value'],!![]),null);}else{var _0x558f61='%'+_0x2b1598['value']+'%';_0x4b9a44[_0x5892('0x44')][_0x18787d](_0x5892('0x45'),_0x558f61,_0x558f61,_0x558f61);}}else{_0x34de6f=_[_0x5892('0x38')](_0x23de6f,[_0x5892('0x46'),_0x5892('0x47')]);_0x2b1598[_0x5892('0xb')]=_0x5892('0x47');_0x201280=as[_0x5892('0x39')](_0x25bb3f,_0x34de6f[_0x5892('0x3a')],_0x2b1598);_0x4b9a44['contact'][_0x18787d](_0x201280[_0x5892('0x3c')],_0x201280['value'][_0x5892('0x3e')],_0x201280[_0x5892('0x3d')][_0x5892('0x48')]);}break;case _0x5892('0x49'):var _0x29cb8e=_0x2b1598['value'][_0x5892('0x43')](',')[_0x5892('0x4a')](function(_0x2ddb13){return Number(_0x2ddb13);});var _0xdd4301=parseTagParameter(_0x29cb8e);_0x4b9a44['tags']['clause'][_0x5892('0x4b')](_0xdd4301);_0x4b9a44['tags'][_0x5892('0x4c')]=_0x29cb8e;break;case _0x5892('0x4d'):if(_0x2b1598[_0x5892('0x41')]===_0x5892('0x42')){_0x4b9a44[_0x5892('0x4e')][_0x18787d](_0x5892('0x4f'),'%'+_0x2b1598[_0x5892('0x3d')]+'%',null);}else{_0x34de6f=_[_0x5892('0x38')](_0x23de6f,[_0x5892('0x46'),_0x5892('0x50')]);_0x2b1598['field']=_0x5892('0x50');_0x201280=as[_0x5892('0x39')](_0x25bb3f,_0x34de6f['type'],_0x2b1598);_0x4b9a44[_0x5892('0x4e')][_0x18787d](_0x201280[_0x5892('0x3c')],_0x201280[_0x5892('0x3d')][_0x5892('0x3e')],_0x201280[_0x5892('0x3d')][_0x5892('0x48')]);}break;case _0x5892('0x51'):case _0x5892('0x52'):_0x201280=as[_0x5892('0x39')]('me',null,_0x2b1598);_0x4b9a44[_0x5892('0x51')][_0x18787d](_0x201280[_0x5892('0x3c')],_0x201280[_0x5892('0x3d')][_0x5892('0x3e')],_0x201280[_0x5892('0x3d')][_0x5892('0x48')]);break;}}}return _0x4b9a44;}function parseModelFields(_0x4b7524,_0x482688,_0x2312fb){var _0x2e8c34=utils[_0x5892('0x7')](_0x4b7524);var _0x5b81fe=squel[_0x5892('0x24')]();var _0x15d707=_(_0x482688)[_0x5892('0x53')]()[_0x5892('0x4a')](function(_0x4c5910){return _[_0x5892('0x54')](_0x2312fb,[_0x5892('0x46'),_0x4c5910])?_0x4c5910:undefined;})[_0x5892('0x55')]()[_0x5892('0x3d')]();if(_0x15d707[_0x5892('0x16')]>0x0){_0x15d707['forEach'](function(_0x2707c2){if(_0x2707c2===_0x2e8c34){_0x5b81fe[_0x5892('0x4b')]('i.'+_0x2e8c34+_0x5892('0x18'),[]['concat'](_0x482688[_0x2707c2]));}else if(_0x2707c2===_0x5892('0x56')){var _0xe68dd0=JSON['parse'](_0x482688[_0x2707c2])[_0x5892('0x57')];var _0x31333d=JSON[_0x5892('0x58')](_0x482688[_0x2707c2])[_0x5892('0x59')];_0x5b81fe[_0x5892('0x4b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xe68dd0,_0x31333d);}else{if(_0x482688[_0x2707c2]===_0x5892('0x5a')){_0x5b81fe['and']('i.'+_0x2707c2+'\x20IS\x20NULL');}else{_0x5b81fe[_0x5892('0x4b')]('i.'+_0x2707c2+_0x5892('0x5b'),_0x482688[_0x2707c2]);}}});}return _0x5b81fe;}function parseQueryParameters(_0x3dadef,_0x4090c0,_0xfd259c){var _0x46fefc=getSqlClauses();return Promise['resolve']()[_0x5892('0x5c')](function(){return parseModelFields(_0x3dadef,_0x4090c0,_0xfd259c);})['then'](function(_0x4fe39f){_0x46fefc[_0x5892('0x5d')][_0x5892('0x4b')](_0x4fe39f);return parseReadParameter(_0x4090c0['read']);})[_0x5892('0x5c')](function(_0x3cd603){_0x46fefc[_0x5892('0x3f')][_0x5892('0x4b')](_0x3cd603);return parseTagParameter(_0x4090c0['tag']);})[_0x5892('0x5c')](function(_0x4d8837){_0x46fefc['tags'][_0x5892('0x5e')][_0x5892('0x4b')](_0x4d8837);return parseSearchFilter(_0x3dadef,_0x4090c0[_0x5892('0x5f')]);})[_0x5892('0x5c')](function(_0x12e6cc){_0x46fefc[_0x5892('0x5f')]=_0x12e6cc;return _0x46fefc;});}function checkAccountsRestrictions(_0x342158,_0x10187e,_0x31922d){var _0x1c1a0a=utils['getAccountFK'](_0x342158);var _0x4e59b2=_0x5892('0x60')+_['capitalize'](_0x342158)+(_0x342158===_0x5892('0x61')?_0x5892('0x62'):_0x5892('0x63'));var _0x1afe1a=squel['expr']();return Promise[_0x5892('0x64')]()[_0x5892('0x5c')](function(){if(_0x31922d[_0x5892('0x9')]&&_0x10187e['role']===_0x5892('0x65')){return _0x10187e[_0x4e59b2]({'attributes':['id'],'raw':!![]});}})[_0x5892('0x5c')](function(_0x5b3110){if(_0x5b3110){if(_0x5b3110['length']===0x0){_0x1afe1a['and']('i.'+_0x1c1a0a+'\x20IS\x20NULL');}else{_0x1afe1a[_0x5892('0x4b')]('i.'+_0x1c1a0a+'\x20IN\x20?',_[_0x5892('0x4a')](_0x5b3110,'id'));}}else if(!_0x31922d[_0x1c1a0a]){_0x1afe1a['and']('i.'+_0x1c1a0a+_0x5892('0x66'));}})[_0x5892('0x5c')](function(){return _0x1afe1a;});}function getClosedOrderClause(_0x279ce3,_0x158129){var _0xcbbc81='';var _0x326e48=[_0x5892('0x67'),_0x5892('0x68'),_0x5892('0x69')];if(_0x279ce3===_0x5892('0x31')){_0x326e48[_0x5892('0x6a')](_0x5892('0x6b'));}if(_0x158129[_0x5892('0x6c')]==='0'&&_0x279ce3===_0x5892('0x31')){_0xcbbc81=_0x5892('0x6b');}else{if(_0x158129[_0x5892('0x6c')]==='1'){_0x326e48[_0x5892('0x6d')]();}_0xcbbc81='CONCAT_WS(\x27\x27,\x20'+_0x326e48[_0x5892('0x6e')](',\x20')+')';}return _0xcbbc81;}function getFilteredInteractions(_0x545169,_0x39a551,_0x3bb998,_0x5ea2ef){var _0x565e15=utils[_0x5892('0x6f')](_0x545169);var _0x181def=_[_0x5892('0x70')](_0x545169)+_0x5892('0x71');var _0x31c21d=[];var _0x170007=getTagsQuery();var _0x113ca8={'type':db[_0x5892('0x72')][_0x5892('0x73')][_0x5892('0x74')],'raw':!![]};var _0x380283=[];var _0xcd9831=[];return db[_0x5892('0x75')][_0x5892('0x76')](_0x170007['toString'](),_0x113ca8)[_0x5892('0x5c')](function(_0x32b115){_0x31c21d=_[_0x5892('0x77')](_0x32b115,'id');_0x113ca8=_['merge'](_0x113ca8,{'model':db[_0x181def],'mapToModel':!![],'nest':!![]});if(_0x3bb998[_0x5892('0x5d')]){_0x5ea2ef['attributes'][_0x5892('0x26')](function(_0xdd8f87){_0x39a551[_0x5892('0xb')]('i.'+_0xdd8f87);});}else{_0x39a551[_0x5892('0xb')](_0x5892('0x78'),_0x5892('0x79'));_0x39a551[_0x5892('0xb')](_0x5892('0x7a'),_0x5892('0x7b'));_0x39a551[_0x5892('0xb')](_0x5892('0x7c'),_0x5892('0x7d'));if(_0x545169===_0x5892('0x31')){_0x39a551[_0x5892('0xb')]('a.email',_0x5892('0x7e'));_0x39a551[_0x5892('0xb')](_0x5892('0x7f'),_0x5892('0x80'));_0x39a551[_0x5892('0xb')](_0x5892('0x81'));_0x39a551[_0x5892('0xb')](_0x5892('0x82'));_0x39a551['field']('i.updatedAt');_0x39a551[_0x5892('0xb')](_0x5892('0x83'));_0x39a551[_0x5892('0xb')](_0x5892('0x84'));_0x39a551[_0x5892('0xb')](_0x5892('0x85'));_0x39a551[_0x5892('0xb')](_0x5892('0x86'));_0x39a551[_0x5892('0xb')](_0x5892('0x87'));_0x39a551['field']('i.subject');_0x39a551['field'](_0x5892('0x69'));_0x39a551[_0x5892('0xb')]('i.secondDisposition');_0x39a551[_0x5892('0xb')]('i.thirdDisposition');_0x39a551[_0x5892('0xb')](_0x5892('0x6b'));_0x39a551[_0x5892('0xb')]('i.to');_0x39a551['field'](_0x5892('0x88'));_0x39a551[_0x5892('0xb')]('i.MailAccountId');_0x39a551[_0x5892('0xb')](_0x5892('0x89'));}else if(_0x545169===_0x5892('0x30')){_0x39a551[_0x5892('0xb')]('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',_0x5892('0x80'));}else{_0x39a551[_0x5892('0xb')]('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',_0x5892('0x80'));}if(_0x545169!==_0x5892('0x31')){_0x39a551[_0x5892('0xb')](_0x5892('0x8a'));}_0x39a551[_0x5892('0xb')](_0x5892('0x8b'),_0x5892('0x8c'));_0x39a551[_0x5892('0xb')]('c.lastName',_0x5892('0x8d'));_0x39a551['field'](_0x5892('0x8e'),'Contact.email');_0x39a551[_0x5892('0xb')](_0x5892('0x8f'),'Contact.phone');_0x39a551[_0x5892('0xb')]('c.mobile',_0x5892('0x90'));_0x39a551[_0x5892('0xb')](_0x5892('0x91'),_0x5892('0x92'));_0x39a551[_0x5892('0xb')](_0x5892('0x93'),_0x5892('0x94'));_0x39a551['field'](_0x5892('0x95'),'Owner.internal');_0x39a551['field'](_0x5892('0x96'),'TagIds');}if(_0x5ea2ef[_0x5892('0x97')]){_0x39a551[_0x5892('0x97')](_0x5ea2ef[_0x5892('0x97')]);}if(_0x5ea2ef['offset']){_0x39a551[_0x5892('0x98')](_0x5ea2ef[_0x5892('0x98')]);}return db[_0x5892('0x75')][_0x5892('0x76')](_0x39a551['toString'](),_0x113ca8);})[_0x5892('0x5c')](function(_0x4fd016){_0x380283=_0x4fd016;var _0x8e57f2=getUsersQuery(_0x545169,_0x380283);return db['sequelize'][_0x5892('0x76')](_0x8e57f2[_0x5892('0x99')](),_0x113ca8);})['then'](function(_0x313ecb){_0xcd9831=_[_0x5892('0x9a')](_0x313ecb,_0x565e15);if(_0x545169==='mail'){return db[_0x5892('0x9b')]['findOne']({'attributes':[_0x5892('0x9c')],'raw':!![]});}})[_0x5892('0x5c')](function(_0x5aab37){var _0x4a9bed=_0x5aab37?_0x5aab37['enableEmailPreview']:undefined;var _0x449e1f=_0x380283[_0x5892('0x4a')](function(_0x566edb){return updateInteraction(_0x566edb,_0x31c21d,_0xcd9831,_0x4a9bed);});return Promise[_0x5892('0x9d')](_0x449e1f);});}function countFilteredInteractions(_0x432845,_0x3ec462){var _0x314fdf=_0x432845[_0x5892('0x9e')]();_0x314fdf[_0x5892('0xb')]('COUNT(*)');_0x314fdf['field'](_0x5892('0x78'),_0x5892('0x79'));var _0x167bbf=utils['getSelectedTags'](_0x3ec462);if(!_['isEmpty'](_0x167bbf)){_0x314fdf['where'](_0x5892('0x9f'),_0x167bbf);}var _0x544f94={'type':db['Sequelize'][_0x5892('0x73')][_0x5892('0x74')],'raw':!![]};return db['sequelize'][_0x5892('0x76')](_0x314fdf[_0x5892('0x99')](),_0x544f94);}module[_0x5892('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x3635=['cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','messages','me.','it.','\x20=\x20i.id','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.phone\x20LIKE\x20?','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)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','name','type','default','text','value','end','unreadMessages','and','operator','$substring','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','buildExpression','start','Tag','tags','clause','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','concat','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','closed','i.substatus','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.thirdDisposition','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','c.email','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','from','tools_tags','user_has_','_interactions','u.id','u.fullname','left_join','users','length','ui.','\x20IN\x20?','map','getInteractionFK','interactions'];(function(_0x4066f7,_0x5d3125){var _0x340fdd=function(_0x5cc169){while(--_0x5cc169){_0x4066f7['push'](_0x4066f7['shift']());}};_0x340fdd(++_0x5d3125);}(_0x3635,0x8c));var _0x5363=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x3635[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x5363('0x0'));var squel=require('squel');var as=require(_0x5363('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0x5363('0x2'))[_0x5363('0x3')];var utils=require(_0x5363('0x4'));var db=require(_0x5363('0x5'))['db'];function skipInteractionsQuery(_0x3e5a22,_0x426da3,_0x274ef4){var _0x5eeff9=![];var _0x5e50c4=utils[_0x5363('0x6')](_0x3e5a22);if(_0x426da3[_0x5363('0x7')]===_0x5363('0x8')&&!_0x274ef4[_0x5363('0x9')]&&!_0x274ef4[_0x5e50c4]){_0x5eeff9=!![];}return _0x5eeff9;}function getTagsQuery(){return squel[_0x5363('0xa')]()['field']('id')['field']('name')[_0x5363('0xb')]('color')[_0x5363('0xc')](_0x5363('0xd'));}function getUsersQuery(_0x2368aa,_0x21c3cc){var _0x1f5180=utils['getInteractionFK'](_0x2368aa);var _0x2010c1=_0x5363('0xe')+_0x2368aa+_0x5363('0xf');var _0x364eeb=squel[_0x5363('0xa')]()[_0x5363('0xb')](_0x5363('0x10'))['field'](_0x5363('0x11'))[_0x5363('0xb')]('ui.'+_0x1f5180)[_0x5363('0xc')](_0x2010c1,'ui')[_0x5363('0x12')](_0x5363('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x21c3cc[_0x5363('0x14')]>0x0){_0x364eeb['where'](_0x5363('0x15')+_0x1f5180+_0x5363('0x16'),_[_0x5363('0x17')](_0x21c3cc,'id'));}return _0x364eeb;}function getInteractionsQuery(_0x1bf81f){var _0x36a594=utils['getInteractionsTables'](_0x1bf81f);var _0x4d4e3f=utils['getAccountFK'](_0x1bf81f);var _0x22b1d3=utils[_0x5363('0x18')](_0x1bf81f);return squel[_0x5363('0xa')]()[_0x5363('0xc')](_0x36a594[_0x5363('0x19')],'i')['left_join'](_0x5363('0x1a'),'c',_0x5363('0x1b'))[_0x5363('0x12')](_0x5363('0x13'),'o','o.id\x20=\x20i.UserId')[_0x5363('0x12')](_0x36a594[_0x5363('0x1c')],'a','a.id\x20=\x20i.'+_0x4d4e3f)[_0x5363('0x12')](_0x36a594[_0x5363('0x1d')],'me',_0x5363('0x1e')+_0x22b1d3+'\x20=\x20i.id')[_0x5363('0x12')](_0x36a594['interactionsTags'],'it',_0x5363('0x1f')+_0x22b1d3+_0x5363('0x20'))[_0x5363('0x12')](_0x5363('0xd'),'t',_0x5363('0x21'));}function getSqlClauses(){var _0x74bbab={'body':squel[_0x5363('0x22')](),'contact':squel[_0x5363('0x22')](),'default':squel[_0x5363('0x22')](),'fields':squel[_0x5363('0x22')](),'filter':squel[_0x5363('0x22')](),'read':squel[_0x5363('0x22')](),'tags':{'clause':squel[_0x5363('0x22')](),'ids':null},'user':squel[_0x5363('0x22')]()};return _0x74bbab;}function parseTagParameter(_0x13c8dd){var _0x1dd3ae=squel[_0x5363('0x22')]();if(_0x13c8dd){var _0x49d322=utils[_0x5363('0x23')](_0x13c8dd);_0x49d322[_0x5363('0x24')](function(_0x35c821){_0x1dd3ae['or'](_0x5363('0x25'),'%,'+_0x35c821+',%');});}return _0x1dd3ae;}function parseReadParameter(_0x1fb91e){var _0x5b12c7='';if(_0x1fb91e){_0x5b12c7=_0x5363('0x26');if(_0x1fb91e==='1'){_0x5b12c7=_0x5b12c7['replace'](_0x5363('0x27'),'=');}else{_0x5b12c7=_0x5b12c7[_0x5363('0x28')](_0x5363('0x27'),'>');}}return _0x5b12c7;}function parseSearchFilter(_0x115dcc,_0x224478){var _0x21e890=squel['expr']();if(_0x224478){var _0x1449fd=_0x224478['replace']('\x5c','\x5c\x5c')[_0x5363('0x28')](/'/g,'\x27\x27');if(qs[_0x5363('0x29')](_0x1449fd)){_0x21e890['or'](_0x5363('0x2a'),_0x1449fd+'%');if([_0x5363('0x2b'),_0x5363('0x2c')][_0x5363('0x2d')](_0x115dcc)){_0x21e890['or'](_0x5363('0x2e'),_0x1449fd+'%');}else if(_0x115dcc===_0x5363('0x2f')){_0x21e890['or'](_0x5363('0x30'),_0x1449fd+'%');}else if(_0x115dcc===_0x5363('0x31')){_0x21e890['or'](_0x5363('0x32'),_0x1449fd+'%');}}else if(_0x115dcc===_0x5363('0x33')&&qs[_0x5363('0x34')](_0x1449fd)){_0x21e890['or'](_0x5363('0x35'),_0x1449fd+'%');}else{if(_0x115dcc===_0x5363('0x33')){_0x21e890['or'](_0x5363('0x36'),qs['getFullTextValue'](_0x1449fd,!![]))['or'](_0x5363('0x37'),qs[_0x5363('0x38')](_0x1449fd));}else if(_0x115dcc!==_0x5363('0x2f')){_0x21e890['or'](_0x5363('0x39'),qs['getFullTextValue'](_0x1449fd));}_0x21e890['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5363('0x38')](_0x1449fd,!![]),null);}}return _0x21e890;}function parseAdvancedSearchFilter(_0x3d7034,_0x98abe4){var _0x2d8c5c=getSqlClauses();var _0x3d2d83=as['parseSearch'](_0x3d7034);var _0x23ea33=_0x3d2d83[_0x5363('0x3a')];for(var _0x4eb0fb=0x0;_0x4eb0fb<_0x3d2d83[_0x5363('0x3b')][_0x5363('0x14')];_0x4eb0fb++){var _0x467a8f=_0x3d2d83[_0x5363('0x3b')][_0x4eb0fb];var _0x54e2a0='i';var _0x1a5a1e=_[_0x5363('0x3c')](_0x98abe4,[_0x5363('0x3d'),_0x467a8f['field']]);if(_0x1a5a1e){var _0x37c0d3=as['buildExpression'](_0x54e2a0,_0x1a5a1e[_0x5363('0x3e')],_0x467a8f);_0x2d8c5c[_0x5363('0x3f')][_0x23ea33](_0x37c0d3[_0x5363('0x40')],_0x37c0d3[_0x5363('0x41')]['start'],_0x37c0d3[_0x5363('0x41')][_0x5363('0x42')]);}else{switch(_0x467a8f['field']){case _0x5363('0x43'):var _0x339699=parseReadParameter(_0x467a8f['value']);_0x2d8c5c['read'][_0x5363('0x44')](_0x339699);break;case'Contact':if(_0x467a8f[_0x5363('0x45')]===_0x5363('0x46')){if(_0x467a8f['value']['split']('\x20')[_0x5363('0x14')]>0x1){_0x2d8c5c[_0x5363('0x47')][_0x23ea33](_0x5363('0x48'),qs[_0x5363('0x38')](_0x467a8f[_0x5363('0x41')],!![]),null);}else{var _0x405d68='%'+_0x467a8f[_0x5363('0x41')]+'%';_0x2d8c5c['contact'][_0x23ea33](_0x5363('0x49'),_0x405d68,_0x405d68,_0x405d68);}}else{_0x1a5a1e=_[_0x5363('0x3c')](_0x98abe4,[_0x5363('0x3d'),_0x5363('0x4a')]);_0x467a8f['field']=_0x5363('0x4a');_0x37c0d3=as[_0x5363('0x4b')](_0x54e2a0,_0x1a5a1e[_0x5363('0x3e')],_0x467a8f);_0x2d8c5c[_0x5363('0x47')][_0x23ea33](_0x37c0d3[_0x5363('0x40')],_0x37c0d3[_0x5363('0x41')][_0x5363('0x4c')],_0x37c0d3[_0x5363('0x41')][_0x5363('0x42')]);}break;case _0x5363('0x4d'):var _0x515e55=_0x467a8f['value']['split'](',')[_0x5363('0x17')](function(_0x15c2df){return Number(_0x15c2df);});var _0x5d667e=parseTagParameter(_0x515e55);_0x2d8c5c[_0x5363('0x4e')][_0x5363('0x4f')]['and'](_0x5d667e);_0x2d8c5c[_0x5363('0x4e')][_0x5363('0x50')]=_0x515e55;break;case _0x5363('0x51'):if(_0x467a8f[_0x5363('0x45')]===_0x5363('0x46')){_0x2d8c5c['user'][_0x23ea33](_0x5363('0x52'),'%'+_0x467a8f[_0x5363('0x41')]+'%',null);}else{_0x1a5a1e=_[_0x5363('0x3c')](_0x98abe4,[_0x5363('0x3d'),_0x5363('0x53')]);_0x467a8f[_0x5363('0xb')]='UserId';_0x37c0d3=as[_0x5363('0x4b')](_0x54e2a0,_0x1a5a1e[_0x5363('0x3e')],_0x467a8f);_0x2d8c5c['user'][_0x23ea33](_0x37c0d3['text'],_0x37c0d3[_0x5363('0x41')][_0x5363('0x4c')],_0x37c0d3['value'][_0x5363('0x42')]);}break;case'body':case'plainBody':_0x37c0d3=as['buildExpression']('me',null,_0x467a8f);_0x2d8c5c['body'][_0x23ea33](_0x37c0d3['text'],_0x37c0d3['value'][_0x5363('0x4c')],_0x37c0d3['value'][_0x5363('0x42')]);break;}}}return _0x2d8c5c;}function parseModelFields(_0x205ac9,_0x4874e8,_0x1a76be){var _0x1ce63a=utils[_0x5363('0x6')](_0x205ac9);var _0x3622d0=squel[_0x5363('0x22')]();var _0x1456e5=_(_0x4874e8)[_0x5363('0x54')]()['map'](function(_0x459f63){return _[_0x5363('0x55')](_0x1a76be,[_0x5363('0x3d'),_0x459f63])?_0x459f63:undefined;})[_0x5363('0x56')]()[_0x5363('0x41')]();if(_0x1456e5[_0x5363('0x14')]>0x0){_0x1456e5[_0x5363('0x24')](function(_0x1fd085){if(_0x1fd085===_0x1ce63a){_0x3622d0[_0x5363('0x44')]('i.'+_0x1ce63a+_0x5363('0x16'),[][_0x5363('0x57')](_0x4874e8[_0x1fd085]));}else if(_0x1fd085==='createdAt'){var _0x561df1=JSON['parse'](_0x4874e8[_0x1fd085])[_0x5363('0x58')];var _0x553b15=JSON['parse'](_0x4874e8[_0x1fd085])[_0x5363('0x59')];_0x3622d0[_0x5363('0x44')](_0x5363('0x5a'),_0x561df1,_0x553b15);}else{if(_0x4874e8[_0x1fd085]==='null'){_0x3622d0[_0x5363('0x44')]('i.'+_0x1fd085+_0x5363('0x5b'));}else{_0x3622d0[_0x5363('0x44')]('i.'+_0x1fd085+_0x5363('0x5c'),_0x4874e8[_0x1fd085]);}}});}return _0x3622d0;}function parseQueryParameters(_0x1f8343,_0x2cf906,_0xdd068){var _0x524dc8=getSqlClauses();return Promise[_0x5363('0x5d')]()[_0x5363('0x5e')](function(){return parseModelFields(_0x1f8343,_0x2cf906,_0xdd068);})['then'](function(_0x2ff0b0){_0x524dc8['fields'][_0x5363('0x44')](_0x2ff0b0);return parseReadParameter(_0x2cf906[_0x5363('0x5f')]);})[_0x5363('0x5e')](function(_0x588569){_0x524dc8[_0x5363('0x5f')]['and'](_0x588569);return parseTagParameter(_0x2cf906[_0x5363('0x60')]);})[_0x5363('0x5e')](function(_0xc94ae4){_0x524dc8[_0x5363('0x4e')][_0x5363('0x4f')][_0x5363('0x44')](_0xc94ae4);return parseSearchFilter(_0x1f8343,_0x2cf906[_0x5363('0x61')]);})[_0x5363('0x5e')](function(_0x25f499){_0x524dc8[_0x5363('0x61')]=_0x25f499;return _0x524dc8;});}function checkAccountsRestrictions(_0x1ac73f,_0x82a26d,_0x6be46e){var _0x2ebbee=utils['getAccountFK'](_0x1ac73f);var _0x1c1a25=_0x5363('0x62')+_[_0x5363('0x63')](_0x1ac73f)+(_0x1ac73f===_0x5363('0x64')?_0x5363('0x65'):_0x5363('0x66'));var _0x486187=squel[_0x5363('0x22')]();return Promise[_0x5363('0x5d')]()[_0x5363('0x5e')](function(){if(_0x6be46e[_0x5363('0x9')]&&_0x82a26d[_0x5363('0x7')]===_0x5363('0x8')){return _0x82a26d[_0x1c1a25]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2c7f01){if(_0x2c7f01){if(_0x2c7f01[_0x5363('0x14')]===0x0){_0x486187['and']('i.'+_0x2ebbee+_0x5363('0x5b'));}else{_0x486187['and']('i.'+_0x2ebbee+_0x5363('0x16'),_['map'](_0x2c7f01,'id'));}}else if(!_0x6be46e[_0x2ebbee]){_0x486187[_0x5363('0x44')]('i.'+_0x2ebbee+_0x5363('0x67'));}})[_0x5363('0x5e')](function(){return _0x486187;});}function getClosedOrderClause(_0x3a6995,_0x56f21e){var _0x4edf84='';var _0x5bff34=['i.thirdDisposition',_0x5363('0x68'),_0x5363('0x69')];if(_0x3a6995==='mail'){_0x5bff34[_0x5363('0x6a')]('i.substatus');}if(_0x56f21e[_0x5363('0x6b')]==='0'&&_0x3a6995==='mail'){_0x4edf84=_0x5363('0x6c');}else{if(_0x56f21e[_0x5363('0x6b')]==='1'){_0x5bff34['shift']();}_0x4edf84=_0x5363('0x6d')+_0x5bff34[_0x5363('0x6e')](',\x20')+')';}return _0x4edf84;}function getFilteredInteractions(_0x2ca878,_0x10d35a,_0xc1f5e8,_0x362f20){var _0x3db8d0=utils[_0x5363('0x18')](_0x2ca878);var _0x3c6ac7=_[_0x5363('0x63')](_0x2ca878)+_0x5363('0x6f');var _0x28896c=[];var _0x16047b=getTagsQuery();var _0x2e78db={'type':db[_0x5363('0x70')][_0x5363('0x71')][_0x5363('0x72')],'raw':!![]};var _0xa19ca7=[];var _0x512b08=[];return db[_0x5363('0x73')][_0x5363('0x74')](_0x16047b[_0x5363('0x75')](),_0x2e78db)[_0x5363('0x5e')](function(_0x201c03){_0x28896c=_[_0x5363('0x76')](_0x201c03,'id');_0x2e78db=_[_0x5363('0x77')](_0x2e78db,{'model':db[_0x3c6ac7],'mapToModel':!![],'nest':!![]});if(_0xc1f5e8['fields']){_0x362f20[_0x5363('0x78')][_0x5363('0x24')](function(_0x558a6c){_0x10d35a['field']('i.'+_0x558a6c);});}else{_0x10d35a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5363('0x43'));_0x10d35a[_0x5363('0xb')](_0x5363('0x79'),'Account.key');_0x10d35a[_0x5363('0xb')](_0x5363('0x7a'),_0x5363('0x7b'));if(_0x2ca878===_0x5363('0x33')){_0x10d35a[_0x5363('0xb')](_0x5363('0x7c'),'Account.email');_0x10d35a['field'](_0x5363('0x7d'),_0x5363('0x7e'));_0x10d35a[_0x5363('0xb')](_0x5363('0x7f'));_0x10d35a[_0x5363('0xb')](_0x5363('0x80'));_0x10d35a[_0x5363('0xb')](_0x5363('0x81'));_0x10d35a[_0x5363('0xb')](_0x5363('0x82'));_0x10d35a['field'](_0x5363('0x83'));_0x10d35a[_0x5363('0xb')]('i.attach');_0x10d35a[_0x5363('0xb')]('i.lastMsgAt');_0x10d35a['field'](_0x5363('0x84'));_0x10d35a['field']('i.subject');_0x10d35a[_0x5363('0xb')](_0x5363('0x69'));_0x10d35a[_0x5363('0xb')]('i.secondDisposition');_0x10d35a[_0x5363('0xb')](_0x5363('0x85'));_0x10d35a[_0x5363('0xb')]('i.substatus');_0x10d35a['field'](_0x5363('0x86'));_0x10d35a['field'](_0x5363('0x87'));_0x10d35a[_0x5363('0xb')](_0x5363('0x88'));_0x10d35a['field']('i.UserId');}else if(_0x2ca878===_0x5363('0x31')){_0x10d35a[_0x5363('0xb')](_0x5363('0x89'),_0x5363('0x7e'));}else{_0x10d35a[_0x5363('0xb')](_0x5363('0x8a'),_0x5363('0x7e'));}if(_0x2ca878!==_0x5363('0x33')){_0x10d35a[_0x5363('0xb')](_0x5363('0x8b'));}_0x10d35a['field'](_0x5363('0x8c'),_0x5363('0x8d'));_0x10d35a['field'](_0x5363('0x8e'),_0x5363('0x8f'));_0x10d35a[_0x5363('0xb')](_0x5363('0x90'),_0x5363('0x91'));_0x10d35a[_0x5363('0xb')]('c.phone','Contact.phone');_0x10d35a[_0x5363('0xb')](_0x5363('0x92'),_0x5363('0x93'));_0x10d35a[_0x5363('0xb')]('c.fax',_0x5363('0x94'));_0x10d35a[_0x5363('0xb')](_0x5363('0x95'),_0x5363('0x96'));_0x10d35a[_0x5363('0xb')](_0x5363('0x97'),_0x5363('0x98'));_0x10d35a[_0x5363('0xb')](_0x5363('0x99'),_0x5363('0x9a'));}if(_0x362f20[_0x5363('0x9b')]){_0x10d35a['limit'](_0x362f20[_0x5363('0x9b')]);}if(_0x362f20[_0x5363('0x9c')]){_0x10d35a[_0x5363('0x9c')](_0x362f20[_0x5363('0x9c')]);}return db['sequelize'][_0x5363('0x74')](_0x10d35a[_0x5363('0x75')](),_0x2e78db);})[_0x5363('0x5e')](function(_0x4d0921){_0xa19ca7=_0x4d0921;var _0x5a340b=getUsersQuery(_0x2ca878,_0xa19ca7);return db[_0x5363('0x73')][_0x5363('0x74')](_0x5a340b[_0x5363('0x75')](),_0x2e78db);})[_0x5363('0x5e')](function(_0x110a5e){_0x512b08=_[_0x5363('0x9d')](_0x110a5e,_0x3db8d0);if(_0x2ca878===_0x5363('0x33')){return db[_0x5363('0x9e')]['findOne']({'attributes':[_0x5363('0x9f')],'raw':!![]});}})['then'](function(_0x261250){var _0x34ddc0=_0x261250?_0x261250[_0x5363('0x9f')]:undefined;var _0x1b6a07=_0xa19ca7[_0x5363('0x17')](function(_0x51540c){return updateInteraction(_0x51540c,_0x28896c,_0x512b08,_0x34ddc0);});return Promise[_0x5363('0xa0')](_0x1b6a07);});}function countFilteredInteractions(_0x3156f9,_0x1ff00b){var _0x3e4b41=_0x3156f9['clone']();_0x3e4b41[_0x5363('0xb')](_0x5363('0xa1'));_0x3e4b41[_0x5363('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5363('0x43'));var _0x415e81=utils[_0x5363('0x23')](_0x1ff00b);if(!_[_0x5363('0xa2')](_0x415e81)){_0x3e4b41[_0x5363('0xa3')](_0x5363('0xa4'),_0x415e81);}var _0x5402c8={'type':db[_0x5363('0x70')]['QueryTypes'][_0x5363('0x72')],'raw':!![]};return db['sequelize'][_0x5363('0x74')](_0x3e4b41['toString'](),_0x5402c8);}module[_0x5363('0xa5')]={'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 9adbfcb..0fbdd7a 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 _0xdc0d=['abandoned','total','answered','talking','disposition','UserId','MailMessage','findOne','out','-id','trimStart','plainBody','catch','updateInteraction','then','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','unmanaged'];(function(_0x2396a3,_0x9f2c00){var _0x3bcbe2=function(_0x4fe61a){while(--_0x4fe61a){_0x2396a3['push'](_0x2396a3['shift']());}};_0x3bcbe2(++_0x9f2c00);}(_0xdc0d,0x149));var _0xddc0=function(_0x1d7423,_0x531a37){_0x1d7423=_0x1d7423-0x0;var _0xf9f22a=_0xdc0d[_0x1d7423];return _0xf9f22a;};'use strict';var _=require(_0xddc0('0x0'));var db=require(_0xddc0('0x1'))['db'];function getInteractionUsers(_0x5cc874,_0x45149c){return new Promise(function(_0x33d33f,_0x546918){try{var _0x5fb0d=[];if(_0x45149c[_0x5cc874]){_0x5fb0d=_0x45149c[_0x5cc874][_0xddc0('0x2')](function(_0x129bfd){return{'id':_0x129bfd['id'],'fullname':_0x129bfd[_0xddc0('0x3')]};});}return _0x33d33f(_0x5fb0d);}catch(_0x140932){_0x546918(_0x140932);}});}function getInteractionTags(_0x3f41db,_0x413981){var _0x4141c0=[];if(_0x3f41db){_0x3f41db[_0xddc0('0x4')](',')[_0xddc0('0x5')](function(_0x5513eb){_0x4141c0[_0xddc0('0x6')](_0x413981[_0x5513eb]);});}return _0x4141c0;}function updateWaitingCounter(_0x16c5e6){if(_0x16c5e6['waiting']){_0x16c5e6['waiting']-=0x1;}}function updateInteractionCounters(_0x481b37){_0x481b37[_0xddc0('0x7')]=0x0;_0x481b37['talking']=0x0;_0x481b37['answered']=0x0;_0x481b37[_0xddc0('0x8')]=0x0;_0x481b37[_0xddc0('0x9')]=0x0;_0x481b37[_0xddc0('0xa')]=0x0;if(_0x481b37['closed']){if(_0x481b37['disposition']==='abandoned'){_0x481b37[_0xddc0('0x9')]+=0x1;updateWaitingCounter(_0x481b37);}if(_0x481b37['UserId']){_0x481b37[_0xddc0('0xb')]+=0x1;if(_0x481b37[_0xddc0('0xc')]){_0x481b37['talking']-=0x1;}}else{if(_0x481b37[_0xddc0('0xd')]){_0x481b37[_0xddc0('0x8')]+=0x1;updateWaitingCounter(_0x481b37);}}}else{if(!_0x481b37[_0xddc0('0xe')]){_0x481b37['waiting']+=0x1;}if(_0x481b37[_0xddc0('0xe')]){_0x481b37[_0xddc0('0xc')]+=0x1;updateWaitingCounter(_0x481b37);}}_0x481b37[_0xddc0('0xa')]+=0x1;return _0x481b37;}function getLastMessageText(_0x47910f){return db[_0xddc0('0xf')][_0xddc0('0x10')]({'where':{'$and':[{'MailInteractionId':_0x47910f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xddc0('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xddc0('0x12'),'raw':!![]})['then'](function(_0x81c194){if(_0x81c194&&_0x81c194['plainBody']){_0x47910f['lastMsgText']=_[_0xddc0('0x13')](_0x81c194[_0xddc0('0x14')]);}return _0x47910f;})[_0xddc0('0x15')](function(_0x25dc4a){throw _0x25dc4a;});}exports[_0xddc0('0x16')]=function(_0x26792c,_0x282574,_0x37435b,_0x89af83){return new Promise(function(_0x3decb0,_0x2accab){return getInteractionUsers(_0x26792c['id'],_0x37435b)[_0xddc0('0x17')](function(_0x59a071){_0x26792c['Users']=_0x59a071;return getInteractionTags(_0x26792c[_0xddc0('0x18')],_0x282574);})[_0xddc0('0x17')](function(_0x173749){_0x26792c[_0xddc0('0x19')]=_0x173749;delete _0x26792c[_0xddc0('0x18')];return updateInteractionCounters(_0x26792c);})[_0xddc0('0x17')](function(_0x231218){if(_0x89af83){return getLastMessageText(_0x231218);}else{return _0x231218;}})[_0xddc0('0x17')](function(_0x8e579c){_0x3decb0(_0x8e579c);})[_0xddc0('0x15')](function(_0x1986e3){_0x2accab(_0x1986e3);});});}; \ No newline at end of file +var _0x2ec3=['closed','disposition','UserId','MailMessage','findOne','plainBody','-id','then','trimStart','updateInteraction','Users','TagIds','Tags','catch','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total'];(function(_0x1c5ad6,_0x47b206){var _0x1d5829=function(_0x11b47f){while(--_0x11b47f){_0x1c5ad6['push'](_0x1c5ad6['shift']());}};_0x1d5829(++_0x47b206);}(_0x2ec3,0x160));var _0x32ec=function(_0x13176b,_0x2bec5b){_0x13176b=_0x13176b-0x0;var _0x3f82fe=_0x2ec3[_0x13176b];return _0x3f82fe;};'use strict';var _=require(_0x32ec('0x0'));var db=require(_0x32ec('0x1'))['db'];function getInteractionUsers(_0x36fc3d,_0x72f96f){return new Promise(function(_0x67b816,_0x2a181b){try{var _0x4200f0=[];if(_0x72f96f[_0x36fc3d]){_0x4200f0=_0x72f96f[_0x36fc3d][_0x32ec('0x2')](function(_0x32b924){return{'id':_0x32b924['id'],'fullname':_0x32b924['fullname']};});}return _0x67b816(_0x4200f0);}catch(_0xc93690){_0x2a181b(_0xc93690);}});}function getInteractionTags(_0x1109bd,_0x2681d6){var _0x3ed466=[];if(_0x1109bd){_0x1109bd[_0x32ec('0x3')](',')[_0x32ec('0x4')](function(_0x2556f3){_0x3ed466[_0x32ec('0x5')](_0x2681d6[_0x2556f3]);});}return _0x3ed466;}function updateWaitingCounter(_0x4d7d8f){if(_0x4d7d8f[_0x32ec('0x6')]){_0x4d7d8f['waiting']-=0x1;}}function updateInteractionCounters(_0xfe35a4){_0xfe35a4['waiting']=0x0;_0xfe35a4[_0x32ec('0x7')]=0x0;_0xfe35a4[_0x32ec('0x8')]=0x0;_0xfe35a4[_0x32ec('0x9')]=0x0;_0xfe35a4[_0x32ec('0xa')]=0x0;_0xfe35a4[_0x32ec('0xb')]=0x0;if(_0xfe35a4[_0x32ec('0xc')]){if(_0xfe35a4[_0x32ec('0xd')]===_0x32ec('0xa')){_0xfe35a4[_0x32ec('0xa')]+=0x1;updateWaitingCounter(_0xfe35a4);}if(_0xfe35a4['UserId']){_0xfe35a4[_0x32ec('0x8')]+=0x1;if(_0xfe35a4[_0x32ec('0x7')]){_0xfe35a4[_0x32ec('0x7')]-=0x1;}}else{if(_0xfe35a4[_0x32ec('0xd')]){_0xfe35a4[_0x32ec('0x9')]+=0x1;updateWaitingCounter(_0xfe35a4);}}}else{if(!_0xfe35a4[_0x32ec('0xe')]){_0xfe35a4[_0x32ec('0x6')]+=0x1;}if(_0xfe35a4[_0x32ec('0xe')]){_0xfe35a4[_0x32ec('0x7')]+=0x1;updateWaitingCounter(_0xfe35a4);}}_0xfe35a4[_0x32ec('0xb')]+=0x1;return _0xfe35a4;}function getLastMessageText(_0x5cbd92){return db[_0x32ec('0xf')][_0x32ec('0x10')]({'where':{'$and':[{'MailInteractionId':_0x5cbd92['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x32ec('0x11')],'order':_0x32ec('0x12'),'raw':!![]})[_0x32ec('0x13')](function(_0x307062){if(_0x307062&&_0x307062[_0x32ec('0x11')]){_0x5cbd92['lastMsgText']=_[_0x32ec('0x14')](_0x307062[_0x32ec('0x11')]);}return _0x5cbd92;})['catch'](function(_0x53c897){throw _0x53c897;});}exports[_0x32ec('0x15')]=function(_0x167c7f,_0x10a8f0,_0x29b1e8,_0x3c7fc1){return new Promise(function(_0x47408e,_0x42011e){return getInteractionUsers(_0x167c7f['id'],_0x29b1e8)[_0x32ec('0x13')](function(_0xb37e88){_0x167c7f[_0x32ec('0x16')]=_0xb37e88;return getInteractionTags(_0x167c7f[_0x32ec('0x17')],_0x10a8f0);})[_0x32ec('0x13')](function(_0x5e2e9b){_0x167c7f[_0x32ec('0x18')]=_0x5e2e9b;delete _0x167c7f[_0x32ec('0x17')];return updateInteractionCounters(_0x167c7f);})[_0x32ec('0x13')](function(_0x21e19e){if(_0x3c7fc1){return getLastMessageText(_0x21e19e);}else{return _0x21e19e;}})['then'](function(_0x27be4b){_0x47408e(_0x27be4b);})[_0x32ec('0x19')](function(_0x10dc2f){_0x42011e(_0x10dc2f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 9fe2ebd..cf53824 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 _0x3ed8=['_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','Interaction','findOne','update','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','chat','Website','Account','capitalize','upperFirst','InteractionId','unknown','websites','accounts'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3ed8,0x183));var _0x83ed=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x3ed8[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x83ed('0x0'));var db=require(_0x83ed('0x1'))['db'];var loggers={'openchannel':require(_0x83ed('0x2'))(_0x83ed('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x83ed('0x2'))(_0x83ed('0x4')),'sms':require(_0x83ed('0x2'))(_0x83ed('0x5')),'chat':require(_0x83ed('0x2'))(_0x83ed('0x6')),'whatsapp':require(_0x83ed('0x2'))('whatsapp-interactions')};function getAccountFK(_0x52d2f0){return _['capitalize'](_0x52d2f0)+(_0x52d2f0===_0x83ed('0x7')?_0x83ed('0x8'):_0x83ed('0x9'))+'Id';}function getInteractionFK(_0x15b682){return _[_0x83ed('0xa')](_0x15b682)+'InteractionId';}function getInteractionId(_0x30dde8,_0x582419,_0x4b726d){if(_0x30dde8&&_0x30dde8[_[_0x83ed('0xb')](_0x4b726d)+_0x83ed('0xc')]){return _0x30dde8[_[_0x83ed('0xb')](_0x4b726d)+_0x83ed('0xc')];}else if(_0x30dde8&&_0x30dde8['id']){return _0x30dde8['id'];}else if(_0x582419&&_0x582419['id']){return _0x582419['id'];}else{return _0x83ed('0xd');}}function getInteractionsTables(_0xf3279b){return{'accounts':_0xf3279b+'_'+(_0xf3279b==='chat'?_0x83ed('0xe'):_0x83ed('0xf')),'interactions':_0xf3279b+'_interactions','interactionsTags':_0xf3279b+_0x83ed('0x10'),'messages':_0xf3279b+_0x83ed('0x11'),'userInteractions':_0x83ed('0x12')+_0xf3279b+_0x83ed('0x13')};}function getSelectedTags(_0x51d434){var _0x45e90a=[];if(_0x51d434){_0x45e90a=Array[_0x83ed('0x14')](_0x51d434)?_0x51d434:[_0x51d434];}return _0x45e90a;}function log(_0xcc1da6,_0x4e3b33,_0x3a44a4,_0x356454,_0x15837d,_0x2bf844){loggers[_0x15837d[_0x83ed('0x15')]()][_0xcc1da6](_0x83ed('0x16'),_0x2bf844['toUpperCase'](),_0x4e3b33?_0x4e3b33['id']:null,_0x4e3b33?_0x4e3b33[_0x83ed('0x17')]:null,_0x4e3b33?_0x4e3b33[_0x83ed('0x18')]:null,getInteractionId(_0x3a44a4,_0x356454,_0x15837d),_0x3a44a4?JSON[_0x83ed('0x19')](_0x3a44a4):'null');}function updateUser(_0x3d0b41,_0x43b833,_0xc01a4c,_0x23832e,_0x74794d){db[_[_0x83ed('0xb')](_0x23832e)+_0x83ed('0x1a')][_0x83ed('0x1b')]({'where':{'id':getInteractionId(_0x43b833,_0xc01a4c,_0x23832e)}})['then'](function(_0xd15f15){if(_0xd15f15){return _0xd15f15[_0x83ed('0x1c')]({'UserId':_0x3d0b41?_0x3d0b41['id']:null});}})['then'](function(_0x259bf9){if(_0x259bf9){log('info',_0x3d0b41,_0x43b833,_0xc01a4c,_0x23832e,_0x74794d);}})['catch'](function(){log(_0x83ed('0x1d'),_0x3d0b41,_0x43b833,_0xc01a4c,_0x23832e,_0x74794d);});}module[_0x83ed('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x018f=['../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','chat','accounts','_interactions','_interaction_has_tags','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','findOne','then','update','info','catch','error','exports','lodash'];(function(_0x585b86,_0x515d4b){var _0x5f949e=function(_0x4fb750){while(--_0x4fb750){_0x585b86['push'](_0x585b86['shift']());}};_0x5f949e(++_0x515d4b);}(_0x018f,0x12b));var _0xf018=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0x018f[_0x548200];return _0x1a6d74;};'use strict';var _=require(_0xf018('0x0'));var db=require(_0xf018('0x1'))['db'];var loggers={'openchannel':require(_0xf018('0x2'))(_0xf018('0x3')),'mail':require(_0xf018('0x2'))('mail-interactions'),'fax':require(_0xf018('0x2'))(_0xf018('0x4')),'sms':require(_0xf018('0x2'))(_0xf018('0x5')),'chat':require(_0xf018('0x2'))(_0xf018('0x6')),'whatsapp':require('../../config/logger')(_0xf018('0x7'))};function getAccountFK(_0x189066){return _[_0xf018('0x8')](_0x189066)+(_0x189066==='chat'?_0xf018('0x9'):_0xf018('0xa'))+'Id';}function getInteractionFK(_0x55b7a3){return _[_0xf018('0x8')](_0x55b7a3)+_0xf018('0xb');}function getInteractionId(_0x1c961c,_0x261be6,_0x2f8fa4){if(_0x1c961c&&_0x1c961c[_[_0xf018('0xc')](_0x2f8fa4)+_0xf018('0xb')]){return _0x1c961c[_[_0xf018('0xc')](_0x2f8fa4)+'InteractionId'];}else if(_0x1c961c&&_0x1c961c['id']){return _0x1c961c['id'];}else if(_0x261be6&&_0x261be6['id']){return _0x261be6['id'];}else{return'unknown';}}function getInteractionsTables(_0x3c0b58){return{'accounts':_0x3c0b58+'_'+(_0x3c0b58===_0xf018('0xd')?'websites':_0xf018('0xe')),'interactions':_0x3c0b58+_0xf018('0xf'),'interactionsTags':_0x3c0b58+_0xf018('0x10'),'messages':_0x3c0b58+'_messages','userInteractions':'user_has_'+_0x3c0b58+'_interactions'};}function getSelectedTags(_0x118a23){var _0x52fb3f=[];if(_0x118a23){_0x52fb3f=Array[_0xf018('0x11')](_0x118a23)?_0x118a23:[_0x118a23];}return _0x52fb3f;}function log(_0xe34c10,_0x1b73dd,_0x143037,_0x1b9de7,_0x2ccc97,_0x5c6917){loggers[_0x2ccc97[_0xf018('0x12')]()][_0xe34c10](_0xf018('0x13'),_0x5c6917[_0xf018('0x14')](),_0x1b73dd?_0x1b73dd['id']:null,_0x1b73dd?_0x1b73dd['name']:null,_0x1b73dd?_0x1b73dd['role']:null,getInteractionId(_0x143037,_0x1b9de7,_0x2ccc97),_0x143037?JSON[_0xf018('0x15')](_0x143037):_0xf018('0x16'));}function updateUser(_0x319e5a,_0x3154c2,_0x201000,_0x22270d,_0x54e33c){db[_[_0xf018('0xc')](_0x22270d)+'Interaction'][_0xf018('0x17')]({'where':{'id':getInteractionId(_0x3154c2,_0x201000,_0x22270d)}})[_0xf018('0x18')](function(_0x296ed0){if(_0x296ed0){return _0x296ed0[_0xf018('0x19')]({'UserId':_0x319e5a?_0x319e5a['id']:null});}})['then'](function(_0x44ab0e){if(_0x44ab0e){log(_0xf018('0x1a'),_0x319e5a,_0x3154c2,_0x201000,_0x22270d,_0x54e33c);}})[_0xf018('0x1b')](function(){log(_0xf018('0x1c'),_0x319e5a,_0x3154c2,_0x201000,_0x22270d,_0x54e33c);});}module[_0xf018('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 c2d92d2..0cf8476 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 _0x2d64=['License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use'];(function(_0x4d1191,_0x38a586){var _0x141e72=function(_0x4c76ab){while(--_0x4c76ab){_0x4d1191['push'](_0x4d1191['shift']());}};_0x141e72(++_0x38a586);}(_0x2d64,0xad));var _0x42d6=function(_0x507613,_0xfe77fd){_0x507613=_0x507613-0x0;var _0x519ccf=_0x2d64[_0x507613];return _0x519ccf;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x42d6('0x0'));var db=require(_0x42d6('0x1'))['db'];var config=require(_0x42d6('0x2'));function getValueFromLicense(_0x1014a6,_0x40995d){if(_0x1014a6&&_0x40995d){if(_0x40995d['data1']&&_0x40995d[_0x42d6('0x3')]){var _0x965417=_0x40995d['data1'];var _0x3cd890=_0x40995d[_0x42d6('0x3')];var _0x415202=_0x965417[_0x42d6('0x4')]('-')[0x4];var _0x2d045f=_0x965417['split']('-')[0x0];var _0x3ece82=crypto[_0x42d6('0x5')](_0x42d6('0x6'),util[_0x42d6('0x7')](_0x42d6('0x8'),_0x415202,_0x965417,_0x2d045f));var _0x261b58=_0x3ece82[_0x42d6('0x9')](_0x3cd890,_0x42d6('0xa'),_0x42d6('0xb'));_0x261b58+=_0x3ece82[_0x42d6('0xc')](_0x42d6('0xb'));var _0x431b28=JSON[_0x42d6('0xd')](_0x261b58);return _0x431b28[_0x42d6('0xe')](_0x1014a6)?_0x431b28[_0x1014a6]:null;}}return null;}function isLimit(_0x40fb65,_0x48f88d,_0x139676,_0xb4fe24){var _0x5ce15f=_0x48f88d;return compose()[_0x42d6('0xf')](function(_0xa7ba00,_0x2f8e53,_0x403703){return db[_0x42d6('0x10')][_0x42d6('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x42d6('0x12')](function(_0x4c450f){var _0x4b2a72=getValueFromLicense(_0x40fb65,_0x4c450f);return _0x4b2a72?_0x4b2a72:_0x5ce15f;})['then'](function(_0xd6de05){_0x5ce15f=_0xd6de05;return _0x139676[_0x42d6('0x13')](_0xb4fe24);})['then'](function(_0x5401d8){if(_0x5401d8>=_0x5ce15f){return _0x2f8e53[_0x42d6('0x14')](0x193)['json']({'message':util['format'](_0x42d6('0x15'),_0x40fb65)});}_0x403703();})[_0x42d6('0x16')](function(_0x1cdd33){_0x403703(_0x1cdd33);});});}function isUserLimit(){return isLimit(_0x42d6('0x17'),0x1,db[_0x42d6('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x42d6('0x19')}]}});}exports[_0x42d6('0x1a')]=isUserLimit; \ No newline at end of file +var _0xce84=['%s:%s:%s','update','base64','final','utf8','use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format'];(function(_0x5e2aaf,_0x5ee3e3){var _0x508383=function(_0x5ea4a7){while(--_0x5ea4a7){_0x5e2aaf['push'](_0x5e2aaf['shift']());}};_0x508383(++_0x5ee3e3);}(_0xce84,0xc1));var _0x4ce8=function(_0x259cb7,_0x37a90c){_0x259cb7=_0x259cb7-0x0;var _0x3d5c5a=_0xce84[_0x259cb7];return _0x3d5c5a;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0x4ce8('0x0'))['db'];var config=require(_0x4ce8('0x1'));function getValueFromLicense(_0xd23561,_0x19791d){if(_0xd23561&&_0x19791d){if(_0x19791d[_0x4ce8('0x2')]&&_0x19791d[_0x4ce8('0x3')]){var _0x53fa1b=_0x19791d[_0x4ce8('0x2')];var _0x2100a0=_0x19791d[_0x4ce8('0x3')];var _0x352200=_0x53fa1b['split']('-')[0x4];var _0x1decdd=_0x53fa1b['split']('-')[0x0];var _0x558464=crypto[_0x4ce8('0x4')](_0x4ce8('0x5'),util[_0x4ce8('0x6')](_0x4ce8('0x7'),_0x352200,_0x53fa1b,_0x1decdd));var _0x57d6ed=_0x558464[_0x4ce8('0x8')](_0x2100a0,_0x4ce8('0x9'),'utf8');_0x57d6ed+=_0x558464[_0x4ce8('0xa')](_0x4ce8('0xb'));var _0x29c5bd=JSON['parse'](_0x57d6ed);return _0x29c5bd['hasOwnProperty'](_0xd23561)?_0x29c5bd[_0xd23561]:null;}}return null;}function isLimit(_0x32ffad,_0x29bc9b,_0x3f2c6a,_0x279b8d){var _0x582632=_0x29bc9b;return compose()[_0x4ce8('0xc')](function(_0x5aba23,_0x227d43,_0x3eb1a2){return db[_0x4ce8('0xd')][_0x4ce8('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x4ce8('0xf')](function(_0x1f492){var _0x50da39=getValueFromLicense(_0x32ffad,_0x1f492);return _0x50da39?_0x50da39:_0x582632;})[_0x4ce8('0xf')](function(_0x1055b9){_0x582632=_0x1055b9;return _0x3f2c6a[_0x4ce8('0x10')](_0x279b8d);})[_0x4ce8('0xf')](function(_0x46333c){if(_0x46333c>=_0x582632){return _0x227d43['status'](0x193)['json']({'message':util[_0x4ce8('0x6')](_0x4ce8('0x11'),_0x32ffad)});}_0x3eb1a2();})['catch'](function(_0x3dbfa1){_0x3eb1a2(_0x3dbfa1);});});}function isUserLimit(){return isLimit(_0x4ce8('0x12'),0x1,db[_0x4ce8('0x13')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 55ffec1..10060c0 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 _0x53c9=['text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','shift','DATE','utcOffset','add','seconds','start','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','match','indexOf','map','push','operator','$eq','$between','value','includes','$gt','$lte','format','castTo','field'];(function(_0x170941,_0x38d105){var _0x50e48d=function(_0x1eb49a){while(--_0x1eb49a){_0x170941['push'](_0x170941['shift']());}};_0x50e48d(++_0x38d105);}(_0x53c9,0x157));var _0x953c=function(_0x23153a,_0xa2e784){_0x23153a=_0x23153a-0x0;var _0x25b6ef=_0x53c9[_0x23153a];return _0x25b6ef;};'use strict';var _=require('lodash');var moment=require(_0x953c('0x0'));exports[_0x953c('0x1')]=function(_0x13eb39){var _0x559731={'conditions':[]};_0x559731[_0x953c('0x2')]=_[_0x953c('0x3')](_0x13eb39,_0x953c('0x4'))?'or':_0x953c('0x5');var _0x192fa7=_0x13eb39['replace']('[$and]','')[_0x953c('0x6')](_0x953c('0x4'),'')[_0x953c('0x7')]('||');for(var _0x303bef=0x0;_0x303bef<_0x192fa7[_0x953c('0x8')];_0x303bef++){var _0x519c6e=_0x192fa7[_0x303bef][_0x953c('0x7')](':=');var _0x70c1b=_0x519c6e[0x0];var _0x2d7753=_0x519c6e[_0x953c('0x9')](0x1);_0x2d7753[_0x953c('0xa')](function(_0x1c3491){var _0x6ecd06=_0x1c3491['split']('[')['shift']();var _0xc1bf12=_0x1c3491[_0x953c('0xb')](/\[(.*?)\]/g);_0xc1bf12[_0x953c('0xa')](function(_0x4a739a){var _0x2e35ce=_0x4a739a['split']('[')['filter'](function(_0x43725c){return _0x43725c[_0x953c('0xc')](']')>-0x1;})[_0x953c('0xd')](function(_0x2fe0b2){return _0x2fe0b2[_0x953c('0x7')](']')[0x0];})[0x0];_0x559731['conditions'][_0x953c('0xe')]({'field':_0x70c1b,'operator':_0x6ecd06,'value':_0x2e35ce});});});}return _0x559731;};exports['buildExpression']=function(_0x3e3d72,_0x2aedeb,_0x45cf42){var _0x27b29e={};if(_0x2aedeb==='DATE'){if(_0x45cf42[_0x953c('0xf')]===_0x953c('0x10')){_0x45cf42[_0x953c('0xf')]=_0x953c('0x11');_0x45cf42[_0x953c('0x12')]+=','+_0x45cf42['value'];}else if(_[_0x953c('0x13')]([_0x953c('0x14'),_0x953c('0x15')],_0x45cf42[_0x953c('0xf')])){_0x45cf42[_0x953c('0x12')]=moment(_0x45cf42[_0x953c('0x12')])['add'](0x1,'days')[_0x953c('0x16')]('YYYY-MM-DD');}}if(_0x45cf42[_0x953c('0x17')]){_0x2aedeb=_0x45cf42['castTo'];_0x27b29e['text']='CAST('+_0x3e3d72+'.'+_0x45cf42[_0x953c('0x18')]+'\x20AS\x20'+_0x45cf42[_0x953c('0x17')]+')\x20'+parseOperator(_0x45cf42[_0x953c('0xf')]);}else{_0x27b29e[_0x953c('0x19')]=_0x3e3d72+'.'+_0x45cf42[_0x953c('0x18')]+'\x20'+parseOperator(_0x45cf42[_0x953c('0xf')]);}if(_['includes']([_0x953c('0x1a'),_0x953c('0x1b')],_0x45cf42[_0x953c('0xf')]))_0x27b29e[_0x953c('0x19')]='('+_0x27b29e['text']+'\x20OR\x20'+_0x3e3d72+'.'+_0x45cf42['field']+_0x953c('0x1c');_0x27b29e['value']=parseValue(_0x2aedeb,_0x45cf42[_0x953c('0xf')],_0x45cf42['value']);return _0x27b29e;};function parseOperator(_0x12bfbd){var _0x38a96c;switch(_0x12bfbd){case _0x953c('0x1d'):_0x38a96c=_0x953c('0x1e');break;case _0x953c('0x1b'):_0x38a96c=_0x953c('0x1f');break;case _0x953c('0x10'):_0x38a96c='=\x20?';break;case _0x953c('0x1a'):_0x38a96c=_0x953c('0x20');break;case _0x953c('0x21'):case'$startsWith':case _0x953c('0x22'):_0x38a96c=_0x953c('0x23');break;case'$lt':_0x38a96c=_0x953c('0x24');break;case _0x953c('0x14'):_0x38a96c='>\x20?';break;case _0x953c('0x15'):_0x38a96c=_0x953c('0x25');break;case _0x953c('0x26'):_0x38a96c='>=\x20?';break;case'$between':_0x38a96c=_0x953c('0x27');break;}return _0x38a96c;}function parseValue(_0x3d506e,_0x4e17c7,_0x4fdcf7){var _0x26a586={'start':undefined,'end':undefined};switch(_0x4e17c7){case _0x953c('0x1d'):case _0x953c('0x1b'):_0x26a586['start']=_0x4fdcf7[_0x953c('0x7')](',');break;case'$substring':_0x26a586['start']='%'+_0x4fdcf7+'%';break;case'$startsWith':_0x26a586['start']=_0x4fdcf7+'%';break;case'$endsWith':_0x26a586['start']='%'+_0x4fdcf7;break;case'$between':var _0xbe9389=_0x4fdcf7[_0x953c('0x7')](',');var _0x4fdcf7=_0xbe9389[_0x953c('0x28')]();var _0x416d7e=_0xbe9389['pop']();if(_0x3d506e===_0x953c('0x29')){_0x4fdcf7=moment(_0x4fdcf7)['utcOffset'](0x0,!![])[_0x953c('0x16')]();_0x416d7e=moment(_0x416d7e)[_0x953c('0x2a')](0x0,!![])['add'](0x17,'hours')[_0x953c('0x2b')](0x3b,'minutes')[_0x953c('0x2b')](0x3b,_0x953c('0x2c'))[_0x953c('0x16')]();}_0x26a586={'start':_0x4fdcf7,'end':_0x416d7e};break;default:_0x26a586[_0x953c('0x2d')]=_0x4fdcf7;break;}return _0x26a586;} \ No newline at end of file +var _0x07e1=['indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','sqlOperator','startsWith','and','[$and]','replace','[$or]','split','length','forEach','shift','match','filter'];(function(_0x325aef,_0x2a3cdc){var _0x343e14=function(_0x270e25){while(--_0x270e25){_0x325aef['push'](_0x325aef['shift']());}};_0x343e14(++_0x2a3cdc);}(_0x07e1,0x1c4));var _0x107e=function(_0x8608b0,_0x47befb){_0x8608b0=_0x8608b0-0x0;var _0x5bb908=_0x07e1[_0x8608b0];return _0x5bb908;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x4915f5){var _0x91e2b3={'conditions':[]};_0x91e2b3[_0x107e('0x0')]=_[_0x107e('0x1')](_0x4915f5,'[$or]')?'or':_0x107e('0x2');var _0x8d4534=_0x4915f5['replace'](_0x107e('0x3'),'')[_0x107e('0x4')](_0x107e('0x5'),'')[_0x107e('0x6')]('||');for(var _0x5c43da=0x0;_0x5c43da<_0x8d4534[_0x107e('0x7')];_0x5c43da++){var _0x1a658c=_0x8d4534[_0x5c43da]['split'](':=');var _0x2403d4=_0x1a658c[0x0];var _0x5734f0=_0x1a658c['slice'](0x1);_0x5734f0[_0x107e('0x8')](function(_0x3ca86f){var _0x52e2e1=_0x3ca86f[_0x107e('0x6')]('[')[_0x107e('0x9')]();var _0x5b482a=_0x3ca86f[_0x107e('0xa')](/\[(.*?)\]/g);_0x5b482a[_0x107e('0x8')](function(_0x5e660c){var _0x50367a=_0x5e660c[_0x107e('0x6')]('[')[_0x107e('0xb')](function(_0x2932cf){return _0x2932cf[_0x107e('0xc')](']')>-0x1;})[_0x107e('0xd')](function(_0x5ce373){return _0x5ce373['split'](']')[0x0];})[0x0];_0x91e2b3[_0x107e('0xe')][_0x107e('0xf')]({'field':_0x2403d4,'operator':_0x52e2e1,'value':_0x50367a});});});}return _0x91e2b3;};exports[_0x107e('0x10')]=function(_0x3616d9,_0x220015,_0x5e328e){var _0x48de37={};if(_0x220015===_0x107e('0x11')){if(_0x5e328e[_0x107e('0x12')]==='$eq'){_0x5e328e[_0x107e('0x12')]=_0x107e('0x13');_0x5e328e[_0x107e('0x14')]+=','+_0x5e328e['value'];}else if(_[_0x107e('0x15')]([_0x107e('0x16'),_0x107e('0x17')],_0x5e328e['operator'])){_0x5e328e[_0x107e('0x14')]=moment(_0x5e328e[_0x107e('0x14')])[_0x107e('0x18')](0x1,_0x107e('0x19'))[_0x107e('0x1a')](_0x107e('0x1b'));}}if(_0x5e328e[_0x107e('0x1c')]){_0x220015=_0x5e328e[_0x107e('0x1c')];_0x48de37[_0x107e('0x1d')]=_0x107e('0x1e')+_0x3616d9+'.'+_0x5e328e['field']+'\x20AS\x20'+_0x5e328e[_0x107e('0x1c')]+')\x20'+parseOperator(_0x5e328e['operator']);}else{_0x48de37[_0x107e('0x1d')]=_0x3616d9+'.'+_0x5e328e['field']+'\x20'+parseOperator(_0x5e328e['operator']);}if(_['includes']([_0x107e('0x1f'),_0x107e('0x20')],_0x5e328e[_0x107e('0x12')]))_0x48de37[_0x107e('0x1d')]='('+_0x48de37[_0x107e('0x1d')]+_0x107e('0x21')+_0x3616d9+'.'+_0x5e328e['field']+_0x107e('0x22');_0x48de37[_0x107e('0x14')]=parseValue(_0x220015,_0x5e328e['operator'],_0x5e328e['value']);return _0x48de37;};function parseOperator(_0xefd254){var _0x233c03;switch(_0xefd254){case _0x107e('0x23'):_0x233c03=_0x107e('0x24');break;case _0x107e('0x20'):_0x233c03=_0x107e('0x25');break;case _0x107e('0x26'):_0x233c03=_0x107e('0x27');break;case _0x107e('0x1f'):_0x233c03=_0x107e('0x28');break;case'$substring':case _0x107e('0x29'):case _0x107e('0x2a'):_0x233c03=_0x107e('0x2b');break;case _0x107e('0x2c'):_0x233c03=_0x107e('0x2d');break;case _0x107e('0x16'):_0x233c03=_0x107e('0x2e');break;case'$lte':_0x233c03=_0x107e('0x2f');break;case _0x107e('0x30'):_0x233c03=_0x107e('0x31');break;case _0x107e('0x13'):_0x233c03=_0x107e('0x32');break;}return _0x233c03;}function parseValue(_0x5b4e63,_0x1d1578,_0x353961){var _0x48575c={'start':undefined,'end':undefined};switch(_0x1d1578){case _0x107e('0x23'):case'$notIn':_0x48575c[_0x107e('0x33')]=_0x353961['split'](',');break;case _0x107e('0x34'):_0x48575c['start']='%'+_0x353961+'%';break;case'$startsWith':_0x48575c[_0x107e('0x33')]=_0x353961+'%';break;case _0x107e('0x2a'):_0x48575c[_0x107e('0x33')]='%'+_0x353961;break;case'$between':var _0x37c753=_0x353961[_0x107e('0x6')](',');var _0x353961=_0x37c753[_0x107e('0x9')]();var _0x4d319e=_0x37c753[_0x107e('0x35')]();if(_0x5b4e63===_0x107e('0x11')){_0x353961=moment(_0x353961)[_0x107e('0x36')](0x0,!![])[_0x107e('0x1a')]();_0x4d319e=moment(_0x4d319e)[_0x107e('0x36')](0x0,!![])['add'](0x17,_0x107e('0x37'))[_0x107e('0x18')](0x3b,_0x107e('0x38'))[_0x107e('0x18')](0x3b,_0x107e('0x39'))[_0x107e('0x1a')]();}_0x48575c={'start':_0x353961,'end':_0x4d319e};break;default:_0x48575c[_0x107e('0x33')]=_0x353961;break;}return _0x48575c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 537247c..bbb561e 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 _0x15ff=['isPlainObject','YYYY-MM-DD','utc','format','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','unsigned','substr','DESC','priority','omit','length','isObject','isString','unset','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','join','getOptions','query','$id','attributes','intersection','hasOwnProperty','nolimit','order','where','pick','filter','object','value','merge','VIRTUAL','lower','includeAll','push','include','lodash','sequelize','../../mysqldb','parse','keys','includes','model','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE'];(function(_0x349761,_0x23baaf){var _0x5368c1=function(_0x57cae0){while(--_0x57cae0){_0x349761['push'](_0x349761['shift']());}};_0x5368c1(++_0x23baaf);}(_0x15ff,0x74));var _0xf15f=function(_0x784fec,_0x3f7922){_0x784fec=_0x784fec-0x0;var _0x33975e=_0x15ff[_0x784fec];return _0x33975e;};'use strict';var _=require(_0xf15f('0x0'));var sequelize=require(_0xf15f('0x1'));var moment=require('moment');var db=require(_0xf15f('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x53fc85){var _0x393442=['ne'];try{var _0x2d7cb4=JSON[_0xf15f('0x3')](_0x53fc85);var _0x1aa38c=Object[_0xf15f('0x4')](_0x2d7cb4)[0x0];return _0x393442[_0xf15f('0x5')](_0x1aa38c);}catch(_0x53748d){return![];}}function getOperatorValue(_0x31df48){var _0x48b6a4=JSON[_0xf15f('0x3')](_0x31df48);var _0x23a2d9=Object[_0xf15f('0x4')](_0x48b6a4)[0x0];var _0x1a981c=_0x48b6a4[_0x23a2d9];return{['$'+_0x23a2d9]:_0x1a981c};}function parseIncludeModel(_0x5748d4){var _0x28e381=JSON[_0xf15f('0x3')](_0x5748d4);return{'model':db[_0x28e381[_0xf15f('0x6')]],'as':_0x28e381['alias'],'attributes':_0x28e381[_0xf15f('0x7')],'raw':_0x28e381[_0xf15f('0x8')]};}exports['fields']=function(_0x4767f7){var _0x218e47=null;if(_0x4767f7){_0x218e47=_0x4767f7[_0xf15f('0x9')](',');}return _0x218e47;};exports[_0xf15f('0xa')]=function(_0x108ae3,_0xceec8d){var _0x1a5252={};if(!_[_0xf15f('0xb')](_0x108ae3)){_[_0xf15f('0xc')](_0x108ae3,function(_0x35767b,_0x3b5ea8){try{if(_0xceec8d){var _0x3e47c5=_[_0xf15f('0xd')](_0xceec8d,{'name':_0x3b5ea8})||{};if(hasSequelizeOperator(_0x35767b)){_0x1a5252[_0x3b5ea8]=getOperatorValue(_0x35767b);}else if(_0x3e47c5[_0xf15f('0xe')]===_0xf15f('0xf')&&_[_0xf15f('0x10')](_0x35767b)){var _0x473479=JSON[_0xf15f('0x3')](_0x35767b);var _0x37cb43={'$gte':moment(moment(_0x473479['$gte'])['format'](_0xf15f('0x11')))[_0xf15f('0x12')]()['format'](),'$lte':moment(moment(_0x473479['$lte'])[_0xf15f('0x13')]('YYYY-MM-DD'))[_0xf15f('0x12')]()['subtract'](0x1,'s')[_0xf15f('0x13')]()};_0x1a5252[_0x3b5ea8]=_0x37cb43;}else if(_0x3e47c5[_0xf15f('0x14')]===_0xf15f('0x15')){_0x1a5252[_0x3b5ea8]=_0x35767b;}else{_0x1a5252[_0x3b5ea8]=_[_0xf15f('0x16')](_0x35767b)?_0x35767b:JSON[_0xf15f('0x3')](_0x35767b);}}else{_0x1a5252[_0x3b5ea8]=_[_0xf15f('0x16')](_0x35767b)?_0x35767b:JSON[_0xf15f('0x3')](_0x35767b);}}catch(_0x4b6fd4){_0x1a5252[_0x3b5ea8]=_0x35767b['split'](',');}});}return _0x1a5252;};exports[_0xf15f('0x17')]=function(_0x1f3edb){_0x1f3edb=parseInt(_0x1f3edb,0xa);if(!_0x1f3edb||_0x1f3edb<0x0){_0x1f3edb=LIMIT_VALUE;}return _0x1f3edb;};exports[_0xf15f('0x18')]=function(_0x386bf4){_0x386bf4=parseInt(_0x386bf4,0xa);if(!_0x386bf4||_0x386bf4<0x0){_0x386bf4=0x0;}return _0x386bf4;};exports[_0xf15f('0x19')]=function(_0x42523b){var _0x3de061,_0x488647=null;if(_0x42523b){_0x3de061=_0x42523b[_0xf15f('0x9')](',');_0x488647=_[_0xf15f('0x1a')](_0x3de061,function(_0x35a8b2){if(_0x35a8b2[_0xf15f('0x1b')]('-')===0x0){return[_0x35a8b2==='priority'?sequelize[_0xf15f('0x1c')](sequelize[_0xf15f('0x1d')]('priority'),_0xf15f('0x1e')):_0x35a8b2[_0xf15f('0x1f')](0x1),_0xf15f('0x20')];}else{return[_0x35a8b2===_0xf15f('0x21')?sequelize[_0xf15f('0x1c')](sequelize['col']('priority'),'unsigned'):_0x35a8b2,'ASC'];}});}return _0x488647;};exports[_0xf15f('0x22')]=function(_0x34021d,_0x2dbee1){if(_[_0xf15f('0xb')](_0x34021d)){return _0x34021d;}if(_['isArray'](_0x34021d)){for(var _0x4add78=0x0;_0x4add78<_0x34021d[_0xf15f('0x23')];_0x4add78+=0x1){_0x34021d[_0x4add78]=this[_0xf15f('0x22')](_0x34021d[_0x4add78],_0x2dbee1);}return _0x34021d;}if(!_[_0xf15f('0x24')](_0x34021d)){return _0x34021d;}if(_[_0xf15f('0x25')](_0x2dbee1)){_0x2dbee1=[_0x2dbee1];}if(!_[_0xf15f('0x16')](_0x2dbee1)){return _0x34021d;}for(var _0x20b41b=0x0;_0x20b41b<_0x2dbee1[_0xf15f('0x23')];_0x20b41b+=0x1){_[_0xf15f('0x26')](_0x34021d,_0x2dbee1[_0x20b41b]);}for(var _0x400039 in _0x34021d){if(_0x34021d['hasOwnProperty'](_0x400039)){_0x34021d[_0x400039]=this['omit'](_0x34021d[_0x400039],_0x2dbee1);}}return _0x34021d;};exports[_0xf15f('0x27')]=function(_0x56aa1f){return _0x56aa1f[_0xf15f('0x28')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xf15f('0x29')]=function(_0x6a658c){return _0x6a658c[_0xf15f('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0xf15f('0x2a')]=function(_0x244c42,_0xbf32bf){var _0x971bc6=[];var _0x45b73d=/[ `!@#$%^&*()_\-?~]/;var _0x26d863=_0xbf32bf?_0xf15f('0x2b'):_0xf15f('0x2c');_0x244c42[_0xf15f('0x9')](/[ ,]+/)['forEach'](function(_0x5a6c6e){_0x5a6c6e=_0x5a6c6e[_0xf15f('0x2d')](/([^:]")"+/g,'$1');_0x5a6c6e='+'+_0x5a6c6e+'*';var _0x7cc6ec=_0x5a6c6e[_0xf15f('0x28')](_0x45b73d);if(_0x7cc6ec){_0x5a6c6e='\x22'+_0x5a6c6e+'\x22';}_0x971bc6['push'](_0x5a6c6e);});_0x26d863=_0x26d863[_0xf15f('0x2d')](_0xf15f('0x2c'),_0x971bc6[_0xf15f('0x2e')]('\x20'));return _0x26d863;};exports[_0xf15f('0x2f')]=function(_0x34cd24,_0x1bc0f1,_0x16a384){var _0x183fc8={},_0x1d7ca3={};if(_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x31')]){_0x1bc0f1[_0xf15f('0x30')]['id']=_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x31')];delete _0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x31')];}_0x183fc8[_0xf15f('0x6')]=_[_0xf15f('0x1a')](_0x34cd24,'name');_0x183fc8['query']=_['keys'](_0x1bc0f1[_0xf15f('0x30')]);_0x183fc8[_0xf15f('0xa')]=_['intersection'](_0x183fc8[_0xf15f('0x6')],_0x183fc8['query']);_0x1d7ca3[_0xf15f('0x32')]=_[_0xf15f('0x33')](_0x183fc8[_0xf15f('0x6')],this[_0xf15f('0x7')](_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x7')]));_0x1d7ca3[_0xf15f('0x32')]=_0x1d7ca3[_0xf15f('0x32')][_0xf15f('0x23')]?_0x1d7ca3[_0xf15f('0x32')]:_0x183fc8[_0xf15f('0x6')];if(!_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x34')](_0xf15f('0x35'))){_0x1d7ca3[_0xf15f('0x17')]=this[_0xf15f('0x17')](_0x1bc0f1[_0xf15f('0x30')]['limit']);_0x1d7ca3[_0xf15f('0x18')]=this[_0xf15f('0x18')](_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x18')]);}_0x1d7ca3[_0xf15f('0x36')]=this[_0xf15f('0x19')](_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x19')]);_0x1d7ca3[_0xf15f('0x37')]=this[_0xf15f('0xa')](_[_0xf15f('0x38')](_0x1bc0f1[_0xf15f('0x30')],_0x183fc8[_0xf15f('0xa')]),_0x34cd24);if(_0x1bc0f1[_0xf15f('0x30')]['filter']){var _0x32e6d8=_0x34cd24;var _0x4c3c6c=_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x39')];if(typeof _0x4c3c6c===_0xf15f('0x3a')){_0x32e6d8=_[_0xf15f('0x39')](_0x34cd24,function(_0x2b2161){return _['includes'](_0x4c3c6c['columns'],_0x2b2161['name']);});_0x4c3c6c=_0x4c3c6c[_0xf15f('0x3b')];}_0x1d7ca3['where']=_[_0xf15f('0x3c')](_0x1d7ca3[_0xf15f('0x37')],{'$or':_['map'](_0x32e6d8,function(_0x4018e4){if(_0x4018e4[_0xf15f('0xe')]!==_0xf15f('0x3d')){if(_0x16a384){return sequelize[_0xf15f('0x37')](sequelize['fn'](_0xf15f('0x3e'),sequelize[_0xf15f('0x1d')](_0x4018e4[_0xf15f('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x1bc0f1[_0xf15f('0x30')][_0xf15f('0x39')]+'%')});}else{var _0x58a21d={};_0x58a21d[_0x4018e4[_0xf15f('0x14')]]={'$like':'%'+_0x1bc0f1['query']['filter']+'%'};return _0x58a21d;}}})});}_0x1d7ca3=_[_0xf15f('0x3c')]({},_0x1d7ca3,_0x1bc0f1['options']);return _0x1d7ca3;};exports['include']=function(_0x59f6c4){var _0x18778a=[];if(_0x59f6c4[_0xf15f('0x3f')]){_0x18778a[_0xf15f('0x40')]({'all':!![]});}else if(_0x59f6c4['include']){if(Array[_0xf15f('0x16')](_0x59f6c4[_0xf15f('0x41')])){_0x18778a=Object['keys'](_0x59f6c4[_0xf15f('0x41')])['map'](function(_0x4472ad){return parseIncludeModel(_0x59f6c4[_0xf15f('0x41')][_0x4472ad]);});}else{var _0x2150bf=parseIncludeModel(_0x59f6c4[_0xf15f('0x41')]);_0x18778a[_0xf15f('0x40')](_0x2150bf);}}return _0x18778a;}; \ No newline at end of file +var _0x8d59=['$gte','format','utc','$lte','subtract','name','isArray','limit','map','indexOf','priority','cast','unsigned','substr','col','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','{EXPR}','join','getOptions','$id','query','model','intersection','attributes','nolimit','offset','order','sort','where','pick','filters','filter','value','merge','type','VIRTUAL','lower','options','includeAll','include','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','alias','raw','fields','split','DATE','isPlainObject'];(function(_0x2b7a48,_0x33ccde){var _0x2323ae=function(_0x2b66cb){while(--_0x2b66cb){_0x2b7a48['push'](_0x2b7a48['shift']());}};_0x2323ae(++_0x33ccde);}(_0x8d59,0xb9));var _0x98d5=function(_0x3d7f84,_0x4221b4){_0x3d7f84=_0x3d7f84-0x0;var _0x448c24=_0x8d59[_0x3d7f84];return _0x448c24;};'use strict';var _=require(_0x98d5('0x0'));var sequelize=require(_0x98d5('0x1'));var moment=require(_0x98d5('0x2'));var db=require(_0x98d5('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2040ea){var _0x47d6ff=['ne'];try{var _0x3bfca1=JSON[_0x98d5('0x4')](_0x2040ea);var _0x54c41f=Object[_0x98d5('0x5')](_0x3bfca1)[0x0];return _0x47d6ff[_0x98d5('0x6')](_0x54c41f);}catch(_0x5ca7c9){return![];}}function getOperatorValue(_0x36b509){var _0x2daf46=JSON[_0x98d5('0x4')](_0x36b509);var _0x278e4f=Object[_0x98d5('0x5')](_0x2daf46)[0x0];var _0x139e4a=_0x2daf46[_0x278e4f];return{['$'+_0x278e4f]:_0x139e4a};}function parseIncludeModel(_0x29b24b){var _0x2b3b66=JSON[_0x98d5('0x4')](_0x29b24b);return{'model':db[_0x2b3b66['model']],'as':_0x2b3b66[_0x98d5('0x7')],'attributes':_0x2b3b66['fields'],'raw':_0x2b3b66[_0x98d5('0x8')]};}exports[_0x98d5('0x9')]=function(_0x336d71){var _0x17edfd=null;if(_0x336d71){_0x17edfd=_0x336d71[_0x98d5('0xa')](',');}return _0x17edfd;};exports['filters']=function(_0x414230,_0x1b8813){var _0x85067a={};if(!_['isEmpty'](_0x414230)){_['forOwn'](_0x414230,function(_0x300cd6,_0x20592e){try{if(_0x1b8813){var _0x30487d=_['find'](_0x1b8813,{'name':_0x20592e})||{};if(hasSequelizeOperator(_0x300cd6)){_0x85067a[_0x20592e]=getOperatorValue(_0x300cd6);}else if(_0x30487d['type']===_0x98d5('0xb')&&_[_0x98d5('0xc')](_0x300cd6)){var _0x2265b9=JSON[_0x98d5('0x4')](_0x300cd6);var _0x2760d7={'$gte':moment(moment(_0x2265b9[_0x98d5('0xd')])[_0x98d5('0xe')]('YYYY-MM-DD'))[_0x98d5('0xf')]()[_0x98d5('0xe')](),'$lte':moment(moment(_0x2265b9[_0x98d5('0x10')])[_0x98d5('0xe')]('YYYY-MM-DD'))[_0x98d5('0xf')]()[_0x98d5('0x11')](0x1,'s')[_0x98d5('0xe')]()};_0x85067a[_0x20592e]=_0x2760d7;}else if(_0x30487d[_0x98d5('0x12')]==='uniqueid'){_0x85067a[_0x20592e]=_0x300cd6;}else{_0x85067a[_0x20592e]=_[_0x98d5('0x13')](_0x300cd6)?_0x300cd6:JSON[_0x98d5('0x4')](_0x300cd6);}}else{_0x85067a[_0x20592e]=_[_0x98d5('0x13')](_0x300cd6)?_0x300cd6:JSON[_0x98d5('0x4')](_0x300cd6);}}catch(_0x4be78d){_0x85067a[_0x20592e]=_0x300cd6[_0x98d5('0xa')](',');}});}return _0x85067a;};exports[_0x98d5('0x14')]=function(_0x5d79c8){_0x5d79c8=parseInt(_0x5d79c8,0xa);if(!_0x5d79c8||_0x5d79c8<0x0){_0x5d79c8=LIMIT_VALUE;}return _0x5d79c8;};exports['offset']=function(_0x462bbf){_0x462bbf=parseInt(_0x462bbf,0xa);if(!_0x462bbf||_0x462bbf<0x0){_0x462bbf=0x0;}return _0x462bbf;};exports['sort']=function(_0x7db8dd){var _0xe6cbb0,_0x228322=null;if(_0x7db8dd){_0xe6cbb0=_0x7db8dd[_0x98d5('0xa')](',');_0x228322=_[_0x98d5('0x15')](_0xe6cbb0,function(_0x11b015){if(_0x11b015[_0x98d5('0x16')]('-')===0x0){return[_0x11b015===_0x98d5('0x17')?sequelize[_0x98d5('0x18')](sequelize['col']('priority'),_0x98d5('0x19')):_0x11b015[_0x98d5('0x1a')](0x1),'DESC'];}else{return[_0x11b015===_0x98d5('0x17')?sequelize[_0x98d5('0x18')](sequelize[_0x98d5('0x1b')](_0x98d5('0x17')),_0x98d5('0x19')):_0x11b015,'ASC'];}});}return _0x228322;};exports[_0x98d5('0x1c')]=function(_0x119a80,_0x202ab5){if(_['isEmpty'](_0x119a80)){return _0x119a80;}if(_[_0x98d5('0x13')](_0x119a80)){for(var _0x415db8=0x0;_0x415db8<_0x119a80[_0x98d5('0x1d')];_0x415db8+=0x1){_0x119a80[_0x415db8]=this[_0x98d5('0x1c')](_0x119a80[_0x415db8],_0x202ab5);}return _0x119a80;}if(!_[_0x98d5('0x1e')](_0x119a80)){return _0x119a80;}if(_[_0x98d5('0x1f')](_0x202ab5)){_0x202ab5=[_0x202ab5];}if(!_[_0x98d5('0x13')](_0x202ab5)){return _0x119a80;}for(var _0x4d8f7b=0x0;_0x4d8f7b<_0x202ab5[_0x98d5('0x1d')];_0x4d8f7b+=0x1){_[_0x98d5('0x20')](_0x119a80,_0x202ab5[_0x4d8f7b]);}for(var _0x4aab56 in _0x119a80){if(_0x119a80[_0x98d5('0x21')](_0x4aab56)){_0x119a80[_0x4aab56]=this['omit'](_0x119a80[_0x4aab56],_0x202ab5);}}return _0x119a80;};exports[_0x98d5('0x22')]=function(_0xe47a8b){return _0xe47a8b[_0x98d5('0x23')](RegExp(_0x98d5('0x24')))?!![]:![];};exports['isEmail']=function(_0x384a6b){return _0x384a6b['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x98d5('0x25')]=function(_0x2e6d64,_0x1be95b){var _0x126e86=[];var _0x7eaa00=/[ `!@#$%^&*()_\-?~]/;var _0x5da095=_0x1be95b?_0x98d5('0x26'):'{EXPR}';_0x2e6d64[_0x98d5('0xa')](/[ ,]+/)[_0x98d5('0x27')](function(_0x421c43){_0x421c43=_0x421c43[_0x98d5('0x28')](/([^:]")"+/g,'$1');_0x421c43='+'+_0x421c43+'*';var _0x226b95=_0x421c43['match'](_0x7eaa00);if(_0x226b95){_0x421c43='\x22'+_0x421c43+'\x22';}_0x126e86[_0x98d5('0x29')](_0x421c43);});_0x5da095=_0x5da095['replace'](_0x98d5('0x2a'),_0x126e86[_0x98d5('0x2b')]('\x20'));return _0x5da095;};exports[_0x98d5('0x2c')]=function(_0x513b1b,_0x486c93,_0x274512){var _0x48dc18={},_0x4d12b2={};if(_0x486c93['query'][_0x98d5('0x2d')]){_0x486c93[_0x98d5('0x2e')]['id']=_0x486c93[_0x98d5('0x2e')]['$id'];delete _0x486c93[_0x98d5('0x2e')][_0x98d5('0x2d')];}_0x48dc18[_0x98d5('0x2f')]=_[_0x98d5('0x15')](_0x513b1b,_0x98d5('0x12'));_0x48dc18['query']=_[_0x98d5('0x5')](_0x486c93[_0x98d5('0x2e')]);_0x48dc18['filters']=_[_0x98d5('0x30')](_0x48dc18[_0x98d5('0x2f')],_0x48dc18[_0x98d5('0x2e')]);_0x4d12b2['attributes']=_[_0x98d5('0x30')](_0x48dc18[_0x98d5('0x2f')],this[_0x98d5('0x9')](_0x486c93[_0x98d5('0x2e')][_0x98d5('0x9')]));_0x4d12b2[_0x98d5('0x31')]=_0x4d12b2[_0x98d5('0x31')][_0x98d5('0x1d')]?_0x4d12b2[_0x98d5('0x31')]:_0x48dc18['model'];if(!_0x486c93[_0x98d5('0x2e')][_0x98d5('0x21')](_0x98d5('0x32'))){_0x4d12b2['limit']=this[_0x98d5('0x14')](_0x486c93['query'][_0x98d5('0x14')]);_0x4d12b2[_0x98d5('0x33')]=this[_0x98d5('0x33')](_0x486c93[_0x98d5('0x2e')]['offset']);}_0x4d12b2[_0x98d5('0x34')]=this[_0x98d5('0x35')](_0x486c93[_0x98d5('0x2e')][_0x98d5('0x35')]);_0x4d12b2[_0x98d5('0x36')]=this['filters'](_[_0x98d5('0x37')](_0x486c93['query'],_0x48dc18[_0x98d5('0x38')]),_0x513b1b);if(_0x486c93['query'][_0x98d5('0x39')]){var _0x42e509=_0x513b1b;var _0x4ca099=_0x486c93[_0x98d5('0x2e')]['filter'];if(typeof _0x4ca099==='object'){_0x42e509=_['filter'](_0x513b1b,function(_0x59c864){return _[_0x98d5('0x6')](_0x4ca099['columns'],_0x59c864['name']);});_0x4ca099=_0x4ca099[_0x98d5('0x3a')];}_0x4d12b2[_0x98d5('0x36')]=_[_0x98d5('0x3b')](_0x4d12b2[_0x98d5('0x36')],{'$or':_[_0x98d5('0x15')](_0x42e509,function(_0x45905f){if(_0x45905f[_0x98d5('0x3c')]!==_0x98d5('0x3d')){if(_0x274512){return sequelize[_0x98d5('0x36')](sequelize['fn'](_0x98d5('0x3e'),sequelize[_0x98d5('0x1b')](_0x45905f[_0x98d5('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x486c93[_0x98d5('0x2e')][_0x98d5('0x39')]+'%')});}else{var _0x3fa809={};_0x3fa809[_0x45905f[_0x98d5('0x12')]]={'$like':'%'+_0x486c93[_0x98d5('0x2e')][_0x98d5('0x39')]+'%'};return _0x3fa809;}}})});}_0x4d12b2=_[_0x98d5('0x3b')]({},_0x4d12b2,_0x486c93[_0x98d5('0x3f')]);return _0x4d12b2;};exports['include']=function(_0x407b48){var _0x5b92d4=[];if(_0x407b48[_0x98d5('0x40')]){_0x5b92d4[_0x98d5('0x29')]({'all':!![]});}else if(_0x407b48[_0x98d5('0x41')]){if(Array['isArray'](_0x407b48[_0x98d5('0x41')])){_0x5b92d4=Object[_0x98d5('0x5')](_0x407b48[_0x98d5('0x41')])[_0x98d5('0x15')](function(_0x456dfc){return parseIncludeModel(_0x407b48[_0x98d5('0x41')][_0x456dfc]);});}else{var _0x25cf7e=parseIncludeModel(_0x407b48['include']);_0x5b92d4['push'](_0x25cf7e);}}return _0x5b92d4;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 46b7184..c8e56a7 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','faxStatusTime','smsStatusTime','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','filter','length','idle','unavailable','ringing','voicePause','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','unknown','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','resolve','includes','User','findAll','name','fullname','whatsappPause'];(function(_0x22d76b,_0x5c8d23){var _0x2184ad=function(_0x8430af){while(--_0x8430af){_0x22d76b['push'](_0x22d76b['shift']());}};_0x2184ad(++_0x5c8d23);}(_0xf494,0x1c6));var _0x4f49=function(_0xb518e5,_0x5b627c){_0xb518e5=_0xb518e5-0x0;var _0x59c78e=_0xf494[_0xb518e5];return _0x59c78e;};'use strict';var _=require(_0x4f49('0x0'));var jayson=require(_0x4f49('0x1'));var db=require(_0x4f49('0x2'))['db'];var amiClient=jayson['client'][_0x4f49('0x3')]({'port':0x232a});var routingClient=jayson[_0x4f49('0x4')][_0x4f49('0x3')]({'port':0x232c});function isAgentPaused(_0x25677c,_0x20c0d7){var _0x2a15fb=[_0x25677c[_0x4f49('0x5')],_0x25677c[_0x4f49('0x6')],_0x25677c[_0x4f49('0x7')],_0x25677c[_0x4f49('0x8')],_0x25677c[_0x4f49('0x9')],_0x25677c['voicePause'],_0x25677c['whatsappPause']];if(!_0x20c0d7)return _[_0x4f49('0xa')](_0x2a15fb);var _0x327bd5=_[_0x4f49('0xb')](_0x2a15fb);return _0x327bd5[_0x4f49('0xc')]>0x0&&_0x327bd5[_0x4f49('0xc')]<_0x2a15fb[_0x4f49('0xc')]?!![]:![];}function isIdle(_0x151d8c){return _0x151d8c===_0x4f49('0xd')||_0x151d8c==='unknown'||_0x151d8c===_0x4f49('0xe')||_0x151d8c===_0x4f49('0xf')||_['isNil'](_0x151d8c);}function isAgentIdle(_0x15e7a1){if(_0x15e7a1['voiceStatus']!=='idle'&&_0x15e7a1[_0x4f49('0x10')]){_0x15e7a1[_0x4f49('0x11')]='pause';return![];}return _[_0x4f49('0xa')]([_0x15e7a1[_0x4f49('0x12')],_0x15e7a1[_0x4f49('0x13')],_0x15e7a1[_0x4f49('0x14')],_0x15e7a1[_0x4f49('0x15')],_0x15e7a1[_0x4f49('0x16')],_0x15e7a1[_0x4f49('0x11')],_0x15e7a1['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x4f49('0x17')](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x5878f4){if(_0x5878f4['error']){throw new Error(_0x4f49('0x1a'));}var _0x2ecaaa=_0x5878f4[_0x4f49('0x1b')];return routingClient['request'](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x4e85df){if(_0x4e85df['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x560592=_0x4e85df['result'];return _[_0x4f49('0x1c')]({},_0x2ecaaa,_0x560592);});})[_0x4f49('0x1d')](function(_0x1c2d70){throw _0x1c2d70;});}exports[_0x4f49('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5793ac){var _0x416893=_0x4f49('0x1f');if(isAgentPaused(_0x5793ac))_0x416893=_0x4f49('0x20');else if(isAgentPaused(_0x5793ac,!![]))_0x416893=_0x4f49('0x21');else if(isAgentIdle(_0x5793ac))_0x416893=_0x4f49('0xd');else _0x416893='busy';return _0x416893;}exports[_0x4f49('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x357446,_0x3ae590){var _0x53b57d=_[_0x4f49('0x23')](_0x357446)?_0x357446:[_0x357446];var _0x1d70a7=_[_0x4f49('0x24')](_0x3ae590)+_0x4f49('0x25');var _0x9d30aa=_[_0x4f49('0x26')](_0x53b57d,function(_0x559d98){return db[_0x1d70a7]['findOne']({'where':{'id':_0x559d98}})[_0x4f49('0x19')](function(_0x429de7){if(!_0x429de7)return[];return _0x429de7['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4f49('0x27')](_0x9d30aa)[_0x4f49('0x19')](function(_0x35f8e0){var _0x525950=_(_0x35f8e0)[_0x4f49('0x28')]()[_0x4f49('0x26')]('id')[_0x4f49('0x29')]()[_0x4f49('0x2a')]();return _0x525950;});}exports[_0x4f49('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x122404,_0x4915af,_0x50c571){try{if(_0x4915af[_0x4f49('0xc')]>0x0){_0x122404=_0x122404[_0x4f49('0xb')](function(_0x605c91){return _0x4915af['includes'](_0x605c91['id']);});}var _0x3cbfbd=_0x122404[_0x4f49('0xb')](function(_0x43d8e3){var _0x506b20='busy';if(isAgentIdle(_0x43d8e3)){_0x506b20=_0x4f49('0xd');}return _0x506b20===_0x50c571;});return _[_0x4f49('0x26')](_0x3cbfbd,'id');}catch(_0x7a6ea0){throw _0x7a6ea0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1eaac6,_0x35aa33,_0x173657){return Promise[_0x4f49('0x2c')]()[_0x4f49('0x19')](function(){if(_0x35aa33[_0x4f49('0xc')]>0x0){_0x1eaac6=_0x1eaac6[_0x4f49('0xb')](function(_0x45ae19){return _0x35aa33[_0x4f49('0x2d')](_0x45ae19['id']);});}return _0x1eaac6;})[_0x4f49('0x19')](function(){return db[_0x4f49('0x2e')][_0x4f49('0x2f')]({'attributes':['id',_0x4f49('0x30'),_0x4f49('0x31'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),'voicePause',_0x4f49('0x32'),_0x4f49('0x33')],'where':{'id':{'$in':_[_0x4f49('0x26')](_0x1eaac6,'id')}},'raw':!![]});})[_0x4f49('0x19')](function(_0x1c3af8){return _0x1c3af8[_0x4f49('0x26')](function(_0x2cbe4e){var _0x3ad6a7=_[_0x4f49('0x34')](_0x1eaac6,['id',_0x2cbe4e['id']]);var _0x338db8=filterAgentAttributes(_0x3ad6a7);_[_0x4f49('0x1c')](_0x2cbe4e,_0x338db8);_0x2cbe4e[_0x4f49('0x35')]=getAgentStatus(_0x2cbe4e);return _0x2cbe4e;});})[_0x4f49('0x19')](function(_0x4d2d57){var _0x371282=sortAgentsByStatus(_0x4d2d57,_0x173657);return _[_0x4f49('0x26')](_0x371282,'id');})[_0x4f49('0x1d')](function(_0x26014f){throw _0x26014f;});}exports[_0x4f49('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3ee818){var _0xe1b662={'fields':[],'order':null};var _0x25fdf8=_0x3ee818[_0x4f49('0x37')](',');_0xe1b662[_0x4f49('0x38')]=_[_0x4f49('0xb')](_0x25fdf8,function(_0x141db){if(!_0x141db[_0x4f49('0x2d')](_0x4f49('0x35'))){return!![];}_0xe1b662['order']=_[_0x4f49('0x39')](_0x141db,'-')?_0x4f49('0x3a'):'ASC';return![];});return _0xe1b662;}exports[_0x4f49('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xbf05f3){if(!_0xbf05f3){_0xbf05f3='fullname,internal';}if(_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x31'))&&!_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x3c'))){var _0x3bfe7e=_0xbf05f3[_0x4f49('0x3d')](0x0,_0xbf05f3[_0x4f49('0x3e')]('fullname'));_0xbf05f3+=','+_0x3bfe7e+'internal';}return _0xbf05f3;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x15e4b3,_0x15b280){var _0x2e4355=_0x15e4b3[_0x4f49('0x3f')](function(_0x1053b2,_0x1ecf6c){if(_0x1053b2[_0x4f49('0x35')]===_0x1ecf6c[_0x4f49('0x35')]){if(_0x1053b2[_0x4f49('0x35')]==='pause'){if(_0x15b280==='DESC'){return(_0x1053b2[_0x4f49('0x33')]||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')]['toLowerCase']()>_0x1ecf6c[_0x4f49('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1053b2['pauseType']||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()>_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2['fullname'][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?-0x1:0x1;}}});return _0x2e4355;}exports[_0x4f49('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x356785){var _0x435192=[_0x4f49('0x42'),'online',_0x4f49('0x43'),_0x4f49('0x44'),'pauseType',_0x4f49('0x44'),'internal',_0x4f49('0x45'),_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),'smsPause',_0x4f49('0x32'),_0x4f49('0x6'),_0x4f49('0x10'),_0x4f49('0x46'),_0x4f49('0x47'),_0x4f49('0x48'),_0x4f49('0x49'),_0x4f49('0x4a'),_0x4f49('0x4b'),_0x4f49('0x4c'),_0x4f49('0x4d'),_0x4f49('0x4e'),_0x4f49('0x4f'),_0x4f49('0x50'),_0x4f49('0x51'),_0x4f49('0x12'),'openchannelStatus','mailStatus',_0x4f49('0x16'),_0x4f49('0x52'),_0x4f49('0x13'),_0x4f49('0x11'),_0x4f49('0x53'),_0x4f49('0x54'),_0x4f49('0x55'),'smsStatusTime',_0x4f49('0x56'),'faxStatusTime',_0x4f49('0x57'),_0x4f49('0x58'),_0x4f49('0x59'),_0x4f49('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0x4f49('0x5b'),'routealias'];var _0x52d18c=[_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),_0x4f49('0x9'),'whatsappPause','faxPause',_0x4f49('0x10'),_0x4f49('0x5c')];var _0x5cb187=_(_0x356785)[_0x4f49('0x5d')](_0x52d18c)['pick'](_0x435192)['value']();return _0x5cb187;}exports[_0x4f49('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x4f49('0x31'),'role',_0x4f49('0x3c'),_0x4f49('0x5c'),_0x4f49('0x35'),_0x4f49('0x42'),_0x4f49('0x43'),_0x4f49('0x33'),_0x4f49('0x44'),_0x4f49('0x6'),'chatPause',_0x4f49('0x7'),'openchannelPause',_0x4f49('0x9'),_0x4f49('0x10'),_0x4f49('0x32'),_0x4f49('0x12'),_0x4f49('0x13'),_0x4f49('0x14'),'openchannelStatus',_0x4f49('0x16'),_0x4f49('0x11'),'whatsappStatus','chatStatusTime',_0x4f49('0x5f'),_0x4f49('0x55'),_0x4f49('0x54'),_0x4f49('0x60'),_0x4f49('0x57'),'whatsappStatusTime',_0x4f49('0x46'),'faxCapacity',_0x4f49('0x48'),_0x4f49('0x47'),_0x4f49('0x49'),'whatsappCapacity',_0x4f49('0x4c'),_0x4f49('0x51'),_0x4f49('0x4e'),_0x4f49('0x4d'),'smsCurrentCapacity',_0x4f49('0x50'),_0x4f49('0x61'),'phoneBarEnableAutomaticScreenRecording',_0x4f49('0x59'),_0x4f49('0x62'),_0x4f49('0x58'),_0x4f49('0x63'),_0x4f49('0x5a')];}exports[_0x4f49('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x814b=['mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','openchannelStatusTime','voiceStatusTime','faxCapacity','chatCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','resolve','findAll','name','fullname','openchannelPause','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','fullname,internal','indexOf','internal','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity'];(function(_0x1ea640,_0x14f725){var _0x12ad27=function(_0x55f554){while(--_0x55f554){_0x1ea640['push'](_0x1ea640['shift']());}};_0x12ad27(++_0x14f725);}(_0x814b,0x1a2));var _0xb814=function(_0x44ea17,_0x422059){_0x44ea17=_0x44ea17-0x0;var _0x1d8af1=_0x814b[_0x44ea17];return _0x1d8af1;};'use strict';var _=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var db=require(_0xb814('0x2'))['db'];var amiClient=jayson[_0xb814('0x3')][_0xb814('0x4')]({'port':0x232a});var routingClient=jayson[_0xb814('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x38c21a,_0x3e1e9){var _0x258866=[_0x38c21a[_0xb814('0x5')],_0x38c21a[_0xb814('0x6')],_0x38c21a[_0xb814('0x7')],_0x38c21a['openchannelPause'],_0x38c21a[_0xb814('0x8')],_0x38c21a[_0xb814('0x9')],_0x38c21a['whatsappPause']];if(!_0x3e1e9)return _[_0xb814('0xa')](_0x258866);var _0x2913a6=_[_0xb814('0xb')](_0x258866);return _0x2913a6[_0xb814('0xc')]>0x0&&_0x2913a6[_0xb814('0xc')]<_0x258866[_0xb814('0xc')]?!![]:![];}function isIdle(_0x1086f8){return _0x1086f8===_0xb814('0xd')||_0x1086f8===_0xb814('0xe')||_0x1086f8===_0xb814('0xf')||_0x1086f8===_0xb814('0x10')||_['isNil'](_0x1086f8);}function isAgentIdle(_0x43dfe6){if(_0x43dfe6['voiceStatus']!==_0xb814('0xd')&&_0x43dfe6[_0xb814('0x9')]){_0x43dfe6[_0xb814('0x11')]=_0xb814('0x12');return![];}return _[_0xb814('0xa')]([_0x43dfe6[_0xb814('0x13')],_0x43dfe6[_0xb814('0x14')],_0x43dfe6[_0xb814('0x15')],_0x43dfe6[_0xb814('0x16')],_0x43dfe6[_0xb814('0x17')],_0x43dfe6[_0xb814('0x11')],_0x43dfe6[_0xb814('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xb814('0x19')](_0xb814('0x1a'),{})[_0xb814('0x1b')](function(_0x3a71d6){if(_0x3a71d6[_0xb814('0x1c')]){throw new Error(_0xb814('0x1d'));}var _0x125ce2=_0x3a71d6[_0xb814('0x1e')];return routingClient[_0xb814('0x19')]('Agents',{})[_0xb814('0x1b')](function(_0x55ba16){if(_0x55ba16[_0xb814('0x1c')]){throw new Error(_0xb814('0x1f'));}var _0x4c3007=_0x55ba16['result'];return _['merge']({},_0x125ce2,_0x4c3007);});})[_0xb814('0x20')](function(_0x4d5276){throw _0x4d5276;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0xb684ea){var _0x24211d=_0xb814('0xe');if(isAgentPaused(_0xb684ea))_0x24211d='pause';else if(isAgentPaused(_0xb684ea,!![]))_0x24211d=_0xb814('0x21');else if(isAgentIdle(_0xb684ea))_0x24211d='idle';else _0x24211d=_0xb814('0x22');return _0x24211d;}exports[_0xb814('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x3b267e,_0x470e81){var _0x27352e=_[_0xb814('0x24')](_0x3b267e)?_0x3b267e:[_0x3b267e];var _0x1f5d40=_['startCase'](_0x470e81)+_0xb814('0x25');var _0x52b7a3=_[_0xb814('0x26')](_0x27352e,function(_0x457dac){return db[_0x1f5d40][_0xb814('0x27')]({'where':{'id':_0x457dac}})[_0xb814('0x1b')](function(_0x1c8a2e){if(!_0x1c8a2e)return[];return _0x1c8a2e[_0xb814('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xb814('0x29')](_0x52b7a3)['then'](function(_0x392222){var _0xc0ef66=_(_0x392222)[_0xb814('0x2a')]()[_0xb814('0x26')]('id')[_0xb814('0x2b')]()[_0xb814('0x2c')]();return _0xc0ef66;});}exports[_0xb814('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1e4e89,_0x5a6291,_0x271aa8){try{if(_0x5a6291[_0xb814('0xc')]>0x0){_0x1e4e89=_0x1e4e89['filter'](function(_0x9008b2){return _0x5a6291[_0xb814('0x2e')](_0x9008b2['id']);});}var _0x530744=_0x1e4e89['filter'](function(_0x20577b){var _0x2051d0='busy';if(isAgentIdle(_0x20577b)){_0x2051d0=_0xb814('0xd');}return _0x2051d0===_0x271aa8;});return _['map'](_0x530744,'id');}catch(_0x6efe9a){throw _0x6efe9a;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4cfc58,_0x419cd9,_0x4a4f27){return Promise[_0xb814('0x2f')]()[_0xb814('0x1b')](function(){if(_0x419cd9[_0xb814('0xc')]>0x0){_0x4cfc58=_0x4cfc58['filter'](function(_0x51d5ae){return _0x419cd9[_0xb814('0x2e')](_0x51d5ae['id']);});}return _0x4cfc58;})[_0xb814('0x1b')](function(){return db['User'][_0xb814('0x30')]({'attributes':['id',_0xb814('0x31'),_0xb814('0x32'),_0xb814('0x5'),_0xb814('0x6'),_0xb814('0x7'),_0xb814('0x33'),'smsPause',_0xb814('0x9'),_0xb814('0x34'),_0xb814('0x35')],'where':{'id':{'$in':_[_0xb814('0x26')](_0x4cfc58,'id')}},'raw':!![]});})[_0xb814('0x1b')](function(_0x4ff31a){return _0x4ff31a[_0xb814('0x26')](function(_0x57e6e6){var _0x43db67=_[_0xb814('0x36')](_0x4cfc58,['id',_0x57e6e6['id']]);var _0xe0f509=filterAgentAttributes(_0x43db67);_['merge'](_0x57e6e6,_0xe0f509);_0x57e6e6[_0xb814('0x37')]=getAgentStatus(_0x57e6e6);return _0x57e6e6;});})[_0xb814('0x1b')](function(_0x4ea6f8){var _0x2fcd92=sortAgentsByStatus(_0x4ea6f8,_0x4a4f27);return _[_0xb814('0x26')](_0x2fcd92,'id');})[_0xb814('0x20')](function(_0x1f7cd8){throw _0x1f7cd8;});}exports[_0xb814('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x467cf9){var _0x4d81eb={'fields':[],'order':null};var _0xa6ce87=_0x467cf9['split'](',');_0x4d81eb[_0xb814('0x39')]=_['filter'](_0xa6ce87,function(_0x4492ef){if(!_0x4492ef['includes'](_0xb814('0x37'))){return!![];}_0x4d81eb[_0xb814('0x3a')]=_['startsWith'](_0x4492ef,'-')?'DESC':'ASC';return![];});return _0x4d81eb;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x17549e){if(!_0x17549e){_0x17549e=_0xb814('0x3b');}if(_0x17549e[_0xb814('0x2e')](_0xb814('0x32'))&&!_0x17549e['includes']('internal')){var _0x6f15d3=_0x17549e['substring'](0x0,_0x17549e[_0xb814('0x3c')](_0xb814('0x32')));_0x17549e+=','+_0x6f15d3+_0xb814('0x3d');}return _0x17549e;}exports[_0xb814('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x42653f,_0x37369f){var _0x3b7f5a=_0x42653f[_0xb814('0x3f')](function(_0x31989d,_0x4b6ff8){if(_0x31989d['globalStatus']===_0x4b6ff8['globalStatus']){if(_0x31989d[_0xb814('0x37')]==='pause'){if(_0x37369f===_0xb814('0x40')){return(_0x31989d['pauseType']||'')<(_0x4b6ff8[_0xb814('0x35')]||'')||_0x31989d[_0xb814('0x32')][_0xb814('0x41')]()>_0x4b6ff8[_0xb814('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x31989d[_0xb814('0x35')]||'')<(_0x4b6ff8[_0xb814('0x35')]||'')||_0x31989d[_0xb814('0x32')][_0xb814('0x41')]()>_0x4b6ff8[_0xb814('0x32')][_0xb814('0x41')]()?-0x1:0x1;}}else{if(_0x37369f==='DESC'){return _0x31989d[_0xb814('0x32')][_0xb814('0x41')]()<_0x4b6ff8[_0xb814('0x32')][_0xb814('0x41')]()?0x1:-0x1;}else{return _0x31989d[_0xb814('0x32')][_0xb814('0x41')]()<_0x4b6ff8[_0xb814('0x32')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x37369f==='DESC'){return _0x31989d[_0xb814('0x37')]<_0x4b6ff8[_0xb814('0x37')]?0x1:-0x1;}else{return _0x31989d[_0xb814('0x37')]<_0x4b6ff8[_0xb814('0x37')]?-0x1:0x1;}}});return _0x3b7f5a;}exports[_0xb814('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x40e627){var _0x24b697=[_0xb814('0x43'),_0xb814('0x44'),_0xb814('0x45'),_0xb814('0x46'),'pauseType',_0xb814('0x46'),_0xb814('0x3d'),'address',_0xb814('0x5'),'openchannelPause',_0xb814('0x7'),_0xb814('0x8'),_0xb814('0x34'),_0xb814('0x6'),_0xb814('0x9'),_0xb814('0x47'),_0xb814('0x48'),_0xb814('0x49'),_0xb814('0x4a'),_0xb814('0x4b'),'faxCapacity','chatCurrentCapacity',_0xb814('0x4c'),_0xb814('0x4d'),_0xb814('0x4e'),_0xb814('0x4f'),_0xb814('0x50'),_0xb814('0x13'),_0xb814('0x16'),'mailStatus',_0xb814('0x17'),_0xb814('0x18'),_0xb814('0x14'),'voiceStatus',_0xb814('0x51'),'openchannelStatusTime',_0xb814('0x52'),'smsStatusTime',_0xb814('0x53'),_0xb814('0x54'),'voiceStatusTime',_0xb814('0x55'),_0xb814('0x56'),_0xb814('0x57'),'phoneBarEnableScreenRecordingByAgent',_0xb814('0x58'),'routealias'];var _0x13bdcf=[_0xb814('0x5'),'openchannelPause',_0xb814('0x7'),'smsPause','whatsappPause',_0xb814('0x6'),_0xb814('0x9'),_0xb814('0x44')];var _0x47a814=_(_0x40e627)[_0xb814('0x59')](_0x13bdcf)['pick'](_0x24b697)[_0xb814('0x2c')]();return _0x47a814;}exports[_0xb814('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xb814('0x32'),'role',_0xb814('0x3d'),_0xb814('0x44'),_0xb814('0x37'),_0xb814('0x43'),_0xb814('0x45'),_0xb814('0x35'),_0xb814('0x46'),_0xb814('0x6'),'chatPause',_0xb814('0x7'),_0xb814('0x33'),'smsPause',_0xb814('0x9'),_0xb814('0x34'),'chatStatus',_0xb814('0x14'),'mailStatus','openchannelStatus',_0xb814('0x17'),'voiceStatus',_0xb814('0x18'),_0xb814('0x51'),_0xb814('0x54'),'mailStatusTime',_0xb814('0x5b'),'smsStatusTime',_0xb814('0x5c'),_0xb814('0x53'),_0xb814('0x47'),_0xb814('0x5d'),_0xb814('0x49'),_0xb814('0x48'),_0xb814('0x4a'),_0xb814('0x4b'),_0xb814('0x5e'),'faxCurrentCapacity',_0xb814('0x4d'),_0xb814('0x4c'),_0xb814('0x4e'),_0xb814('0x4f'),_0xb814('0x5f'),_0xb814('0x58'),'destconnectedlinenum',_0xb814('0x60'),'queue',_0xb814('0x61'),_0xb814('0x57')];}exports[_0xb814('0x62')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 96bc1f7..3d452cf 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 _0xcc19=['jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialActive','Trunk','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','voice','inbound','concat','outbound','map','get','originated','find','merge','pick','initializeQueues','lodash'];(function(_0x269d1b,_0x5baebe){var _0x58df11=function(_0x5eb5c0){while(--_0x5eb5c0){_0x269d1b['push'](_0x269d1b['shift']());}};_0x58df11(++_0x5baebe);}(_0xcc19,0x1e5));var _0x9cc1=function(_0xfa260b,_0xd2d0d){_0xfa260b=_0xfa260b-0x0;var _0x48fb84=_0xcc19[_0xfa260b];return _0x48fb84;};'use strict';var _=require(_0x9cc1('0x0'));var jayson=require(_0x9cc1('0x1'));var util=require(_0x9cc1('0x2'));var amiClient=jayson[_0x9cc1('0x3')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x9cc1('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x9cc1('0x5'),_0x9cc1('0x6'),_0x9cc1('0x7'),_0x9cc1('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x9cc1('0x9'),_0x9cc1('0xa'),_0x9cc1('0xb'),_0x9cc1('0xc'),'notInUse',_0x9cc1('0xd'),_0x9cc1('0xe'),_0x9cc1('0xf'),_0x9cc1('0x10'),_0x9cc1('0x11'),_0x9cc1('0x12')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9cc1('0x13'),'originated',_0x9cc1('0x14'),_0x9cc1('0x15'),_0x9cc1('0x16'),'dialMethod',_0x9cc1('0x17'),'startPredictive',_0x9cc1('0x18'),_0x9cc1('0x19'),'erlangCallToSecond','erlangAbandonmentRate',_0x9cc1('0x1a'),_0x9cc1('0x1b'),_0x9cc1('0x1c'),_0x9cc1('0x1d'),'predictiveIntervalAvailable',_0x9cc1('0x1e'),'predictiveIntervalAnsweredCalls',_0x9cc1('0x1f'),_0x9cc1('0x20'),_0x9cc1('0x21'),_0x9cc1('0x22')];function getRealtimeQueues(_0x51e931,_0x366375){var _0x401ae8=_0x366375==='voice'?amiClient:routingClient;return _0x401ae8[_0x9cc1('0x23')](_[_0x9cc1('0x24')](_0x366375)+_0x9cc1('0x25'),_0x51e931)[_0x9cc1('0x26')](function(_0x18e1c5){if(_0x18e1c5['error'])throw new Error(util[_0x9cc1('0x27')](_0x9cc1('0x28'),_0x366375));return _0x18e1c5[_0x9cc1('0x29')];})['catch'](function(_0x3792f3){throw _0x3792f3;});}exports[_0x9cc1('0x2a')]=getRealtimeQueues;function initializeQueues(_0x35563f,_0xb4ee5,_0x3f84c3,_0x7dacb1){var _0x4e8566=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3f84c3===_0x9cc1('0x2b')){if(_0x7dacb1===_0x9cc1('0x2c')){_0x4e8566=_0x4e8566[_0x9cc1('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x7dacb1===_0x9cc1('0x2e')){_0x4e8566=_0x4e8566[_0x9cc1('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x35563f[_0x9cc1('0x2f')](function(_0xc3aecf){var _0x1af5e4=_0xc3aecf[_0x9cc1('0x30')]({'plain':!![]});_0x1af5e4[_0x9cc1('0x7')]=0x0;_0x1af5e4['loggedInDb']=0x0;_0x1af5e4['loggedIn']=0x0;_0x1af5e4[_0x9cc1('0x5')]=0x0;_0x1af5e4['waiting']=0x0;if(_0x3f84c3===_0x9cc1('0x2b')){_0x1af5e4[_0x9cc1('0x10')]=0x0;_0x1af5e4[_0x9cc1('0x9')]=0x0;if(_0x7dacb1===_0x9cc1('0x2e')){_0x1af5e4[_0x9cc1('0x13')]=0x0;_0x1af5e4[_0x9cc1('0x31')]=0x0;}}var _0x1041d2=_[_0x9cc1('0x32')](_0xb4ee5,['id',_0x1af5e4['id']]);if(_0x1041d2){_[_0x9cc1('0x33')](_0x1af5e4,_[_0x9cc1('0x34')](_0x1041d2,_0x4e8566));}return _0x1af5e4;});}exports[_0x9cc1('0x35')]=initializeQueues; \ No newline at end of file +var _0xa1d8=['client','http','loggedIn','paused','waiting','inUse','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','available','busy','originated','merge','initializeQueues','lodash','util'];(function(_0x3a851f,_0x532a05){var _0x4ba708=function(_0x342458){while(--_0x342458){_0x3a851f['push'](_0x3a851f['shift']());}};_0x4ba708(++_0x532a05);}(_0xa1d8,0x13c));var _0x8a1d=function(_0x2e1e3,_0x43693f){_0x2e1e3=_0x2e1e3-0x0;var _0x1ae79b=_0xa1d8[_0x2e1e3];return _0x1ae79b;};'use strict';var _=require(_0x8a1d('0x0'));var jayson=require('jayson/promise');var util=require(_0x8a1d('0x1'));var amiClient=jayson[_0x8a1d('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x8a1d('0x2')][_0x8a1d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x8a1d('0x4'),_0x8a1d('0x5'),_0x8a1d('0x6')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x8a1d('0x7'),'invalid',_0x8a1d('0x8'),_0x8a1d('0x9'),_0x8a1d('0xa'),'ringing',_0x8a1d('0xb'),_0x8a1d('0xc'),_0x8a1d('0xd'),_0x8a1d('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8a1d('0xf'),'originated',_0x8a1d('0x10'),_0x8a1d('0x11'),_0x8a1d('0x12'),_0x8a1d('0x13'),_0x8a1d('0x14'),_0x8a1d('0x15'),_0x8a1d('0x16'),_0x8a1d('0x17'),_0x8a1d('0x18'),_0x8a1d('0x19'),_0x8a1d('0x1a'),_0x8a1d('0x1b'),_0x8a1d('0x1c'),_0x8a1d('0x1d'),_0x8a1d('0x1e'),_0x8a1d('0x1f'),'predictiveIntervalAnsweredCalls',_0x8a1d('0x20'),'predictiveIntervalDroppedCallsCallersExit',_0x8a1d('0x21'),_0x8a1d('0x22')];function getRealtimeQueues(_0x12e607,_0x314e67){var _0x2f0643=_0x314e67===_0x8a1d('0x23')?amiClient:routingClient;return _0x2f0643['request'](_[_0x8a1d('0x24')](_0x314e67)+_0x8a1d('0x25'),_0x12e607)[_0x8a1d('0x26')](function(_0x50989c){if(_0x50989c['error'])throw new Error(util[_0x8a1d('0x27')](_0x8a1d('0x28'),_0x314e67));return _0x50989c[_0x8a1d('0x29')];})[_0x8a1d('0x2a')](function(_0x3de7a1){throw _0x3de7a1;});}exports[_0x8a1d('0x2b')]=getRealtimeQueues;function initializeQueues(_0x346539,_0x3c3603,_0x1cba8f,_0x4c4c6a){var _0x174c63=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1cba8f==='voice'){if(_0x4c4c6a===_0x8a1d('0x2c')){_0x174c63=_0x174c63[_0x8a1d('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4c4c6a===_0x8a1d('0x2e')){_0x174c63=_0x174c63[_0x8a1d('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x346539[_0x8a1d('0x2f')](function(_0x3ddc9f){var _0x33d7f1=_0x3ddc9f['get']({'plain':!![]});_0x33d7f1[_0x8a1d('0x5')]=0x0;_0x33d7f1[_0x8a1d('0x8')]=0x0;_0x33d7f1['loggedIn']=0x0;_0x33d7f1[_0x8a1d('0x30')]=0x0;_0x33d7f1[_0x8a1d('0x6')]=0x0;if(_0x1cba8f===_0x8a1d('0x23')){_0x33d7f1['talking']=0x0;_0x33d7f1[_0x8a1d('0x31')]=0x0;if(_0x4c4c6a===_0x8a1d('0x2e')){_0x33d7f1[_0x8a1d('0xf')]=0x0;_0x33d7f1[_0x8a1d('0x32')]=0x0;}}var _0x3ad35b=_['find'](_0x3c3603,['id',_0x33d7f1['id']]);if(_0x3ad35b){_[_0x8a1d('0x33')](_0x33d7f1,_['pick'](_0x3ad35b,_0x174c63));}return _0x33d7f1;});}exports[_0x8a1d('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6aa2b7b..13d295c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x2db025,_0x1cf6de){var _0x47afbe=function(_0x37840e){while(--_0x37840e){_0x2db025['push'](_0x2db025['shift']());}};_0x47afbe(++_0x1cf6de);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _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(_0x23600c,_0x31d165){var _0x57f2a2=function(_0x591ded){while(--_0x591ded){_0x23600c['push'](_0x23600c['shift']());}};_0x57f2a2(++_0x31d165);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 85fe79d..68509f1 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 _0x8321=['hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','../environment','orderBy','keys','length','filter','family','IPv4','internal','head','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x2d3021,_0x2492b8){var _0x128dfe=function(_0x1ac5ce){while(--_0x1ac5ce){_0x2d3021['push'](_0x2d3021['shift']());}};_0x128dfe(++_0x2492b8);}(_0x8321,0x14d));var _0x1832=function(_0x5245d1,_0x3f0c61){_0x5245d1=_0x5245d1-0x0;var _0x22ad4a=_0x8321[_0x5245d1];return _0x22ad4a;};'use strict';var _=require(_0x1832('0x0'));var os=require('os');var crypto=require(_0x1832('0x1'));var machine=require(_0x1832('0x2'));var exec=require('child_process')['execSync'];var config=require(_0x1832('0x3'));function getInterfaces(){var _0xdcd084=[];var _0x1958fa=os['networkInterfaces']();var _0x573458=_[_0x1832('0x4')](_[_0x1832('0x5')](_0x1958fa));for(var _0x39b141=0x0;_0x39b141<_0x573458[_0x1832('0x6')];_0x39b141++){var _0x2782e5=_0x1958fa[_0x573458[_0x39b141]][_0x1832('0x7')](function(_0x4bdc7f){return _0x4bdc7f[_0x1832('0x8')]===_0x1832('0x9')&&_0x4bdc7f[_0x1832('0xa')]===![];});_0xdcd084=_0xdcd084['concat'](_0x2782e5);}return _0xdcd084;}function getFirstInterface(){var _0x4e48d7=_[_0x1832('0xb')](getInterfaces());return{'macAddress':_0x4e48d7&&_0x4e48d7['mac']?_0x4e48d7['mac']:'00:00:00:00:00:00','ipAddress':_0x4e48d7&&_0x4e48d7[_0x1832('0xc')]?_0x4e48d7[_0x1832('0xc')]:_0x1832('0xd')};}exports[_0x1832('0xe')]=getFirstInterface;function getCPUhash(){var _0x5ce6c4=_['orderBy'](os[_0x1832('0xf')]()['map'](function(_0x412ffe){return _0x412ffe[_0x1832('0x10')];}))[_0x1832('0x11')](':');return crypto[_0x1832('0x12')](_0x1832('0x13'))[_0x1832('0x14')](_0x5ce6c4)[_0x1832('0x15')](_0x1832('0x16'));}exports[_0x1832('0x17')]=function(){var _0x2c1a74=os[_0x1832('0x18')]();var _0x57eb0d=/[0-9a-f-]{36}/;if(config[_0x1832('0x19')]&&_0x57eb0d[_0x1832('0x1a')](config['licenseToken'])){return config[_0x1832('0x19')];}else if(_0x2c1a74==='win32'){return exec(_0x1832('0x1b'),{'encoding':_0x1832('0x1c')})[_0x1832('0x1d')]('\x0d\x0a','');}else{var _0x56de64=getFirstInterface();var _0x31e8e0=getCPUhash();var _0x2fb0fe=_0x31e8e0+'|'+os[_0x1832('0x1e')]()+'|'+_0x56de64['macAddress']+'|'+_0x56de64[_0x1832('0x1f')];var _0x50af63=crypto[_0x1832('0x12')](_0x1832('0x13'))[_0x1832('0x14')](_0x2fb0fe)['digest'](_0x1832('0x16'));return _0x50af63[_0x1832('0x20')](0x0,0x8)+'-'+_0x50af63[_0x1832('0x20')](0x8,0xc)+'-'+_0x50af63['substring'](0xc,0x10)+'-'+_0x50af63[_0x1832('0x20')](0x10,0x14)+'-'+_0x50af63[_0x1832('0x20')](0x14);}}; \ No newline at end of file +var _0xc9b0=['execSync','../environment','networkInterfaces','orderBy','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','hex','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','digest','substring','bimedia-machine-uuid','child_process'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xc9b0,0x1b8));var _0x0c9b=function(_0x3b8beb,_0x3892a0){_0x3b8beb=_0x3b8beb-0x0;var _0x459dd2=_0xc9b0[_0x3b8beb];return _0x459dd2;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x0c9b('0x0'));var exec=require(_0x0c9b('0x1'))[_0x0c9b('0x2')];var config=require(_0x0c9b('0x3'));function getInterfaces(){var _0x4e0ebd=[];var _0x1c47a8=os[_0x0c9b('0x4')]();var _0x1fd9b6=_[_0x0c9b('0x5')](_['keys'](_0x1c47a8));for(var _0x4e3d7a=0x0;_0x4e3d7a<_0x1fd9b6['length'];_0x4e3d7a++){var _0x2a369d=_0x1c47a8[_0x1fd9b6[_0x4e3d7a]][_0x0c9b('0x6')](function(_0x41cc04){return _0x41cc04['family']===_0x0c9b('0x7')&&_0x41cc04[_0x0c9b('0x8')]===![];});_0x4e0ebd=_0x4e0ebd[_0x0c9b('0x9')](_0x2a369d);}return _0x4e0ebd;}function getFirstInterface(){var _0x4987f6=_[_0x0c9b('0xa')](getInterfaces());return{'macAddress':_0x4987f6&&_0x4987f6[_0x0c9b('0xb')]?_0x4987f6[_0x0c9b('0xb')]:_0x0c9b('0xc'),'ipAddress':_0x4987f6&&_0x4987f6[_0x0c9b('0xd')]?_0x4987f6[_0x0c9b('0xd')]:'127.0.0.1'};}exports[_0x0c9b('0xe')]=getFirstInterface;function getCPUhash(){var _0x281f5c=_[_0x0c9b('0x5')](os[_0x0c9b('0xf')]()[_0x0c9b('0x10')](function(_0x5cbfde){return _0x5cbfde[_0x0c9b('0x11')];}))[_0x0c9b('0x12')](':');return crypto[_0x0c9b('0x13')](_0x0c9b('0x14'))['update'](_0x281f5c)['digest'](_0x0c9b('0x15'));}exports['getUuid']=function(){var _0x38bf5e=os[_0x0c9b('0x16')]();var _0x49b930=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x49b930[_0x0c9b('0x17')](config[_0x0c9b('0x18')])){return config['licenseToken'];}else if(_0x38bf5e==='win32'){return exec(_0x0c9b('0x19'),{'encoding':_0x0c9b('0x1a')})[_0x0c9b('0x1b')]('\x0d\x0a','');}else{var _0xbb2125=getFirstInterface();var _0xf5dd4c=getCPUhash();var _0x57a0a0=_0xf5dd4c+'|'+os[_0x0c9b('0x1c')]()+'|'+_0xbb2125[_0x0c9b('0x1d')]+'|'+_0xbb2125[_0x0c9b('0x1e')];var _0x35e813=crypto[_0x0c9b('0x13')]('md5')[_0x0c9b('0x1f')](_0x57a0a0)[_0x0c9b('0x20')]('hex');return _0x35e813[_0x0c9b('0x21')](0x0,0x8)+'-'+_0x35e813[_0x0c9b('0x21')](0x8,0xc)+'-'+_0x35e813[_0x0c9b('0x21')](0xc,0x10)+'-'+_0x35e813[_0x0c9b('0x21')](0x10,0x14)+'-'+_0x35e813[_0x0c9b('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 46347c7..99f4b73 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 _0x49ee=['SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','message','getUuid','findOrCreate'];(function(_0x5e2f5c,_0x41160d){var _0x32e26a=function(_0x49b48c){while(--_0x49b48c){_0x5e2f5c['push'](_0x5e2f5c['shift']());}};_0x32e26a(++_0x41160d);}(_0x49ee,0x1ca));var _0xe49e=function(_0x99f61,_0x5777a4){_0x99f61=_0x99f61-0x0;var _0x111865=_0x49ee[_0x99f61];return _0x111865;};'use strict';var util=require(_0xe49e('0x0'));var moment=require(_0xe49e('0x1'));var rp=require(_0xe49e('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xe49e('0x3'))(module,_0xe49e('0x4'));var db=require(_0xe49e('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xe49e('0x6'));var logger=require('../logger')(_0xe49e('0x7'));var HOST=_0xe49e('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2790c9){return new BPromise(function(_0x2e9106,_0x168bb5){var _0xcdb3c=util[_0xe49e('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x2790c9,module[_0xe49e('0xa')][_0xe49e('0x4')]);if(oldToken){_0xcdb3c=util[_0xe49e('0x9')](_0xe49e('0xb'),HOST,_0x2790c9,module[_0xe49e('0xa')][_0xe49e('0x4')],oldToken);}var _0xdc1f04={'uri':_0xcdb3c,'method':_0xe49e('0xc'),'timeout':0xea60,'json':!![]};return rp(_0xdc1f04)[_0xe49e('0xd')](function(_0x19eb4e){_0x2e9106(_0x19eb4e);})['catch'](function(_0x228422){_0x168bb5(_0x228422);});});}function manageLicense(_0x4120b3,_0x5b3e0c){var _0x26e3ab=_0x5b3e0c[_0xe49e('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x26e3ab[_0xe49e('0xf')]!==_0x4120b3&&!_0x26e3ab['data2']){oldToken=_0x26e3ab[_0xe49e('0xf')];}httpRequest(_0x4120b3)[_0xe49e('0xd')](function(_0x5d3407){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5d3407[_0xe49e('0x10')]){isOldTokenSent=![];if(!_0x26e3ab['license']&&_0x26e3ab['license']!=_0x5d3407[_0xe49e('0x7')]||_0x26e3ab[_0xe49e('0x7')]&&_0x26e3ab[_0xe49e('0x11')]){logger[_0xe49e('0x12')](_0xe49e('0x13'));}if(_0x26e3ab['license']&&!_0x26e3ab[_0xe49e('0x11')]&&_0x26e3ab[_0xe49e('0x7')]!=_0x5d3407[_0xe49e('0x7')]){logger[_0xe49e('0x12')](_0xe49e('0x14'));}if(_0x26e3ab[_0xe49e('0x7')]&&!_0x26e3ab[_0xe49e('0x11')]&&_0x26e3ab['license']==_0x5d3407[_0xe49e('0x7')]){return _0x5b3e0c;}return _0x5b3e0c['update']({'data1':_0x4120b3,'data2':null,'license':_0x5d3407[_0xe49e('0x7')]});}else{if(_0x5d3407['license']||_0x26e3ab[_0xe49e('0x7')]){if(!_0x26e3ab[_0xe49e('0x11')]){if(_0x26e3ab[_0xe49e('0xf')]==_0x4120b3){GRAY_PERIOD_REASON=_0xe49e('0x15');logger[_0xe49e('0x12')](_0xe49e('0x16'));}else{GRAY_PERIOD_REASON=_0xe49e('0x17');logger['info'](_0xe49e('0x18'),_0x26e3ab[_0xe49e('0xf')],_0x4120b3);}logger['info'](_0xe49e('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5b3e0c[_0xe49e('0x1a')]({'data2':encryptor[_0xe49e('0x1b')](moment()[_0xe49e('0x9')](_0xe49e('0x1c')))});}else{if(moment()[_0xe49e('0x1d')](encryptor[_0xe49e('0x1e')](_0x26e3ab['data2']),'days')>DAYS){logger[_0xe49e('0x12')](_0xe49e('0x1f'),moment()['format'](_0xe49e('0x1c')));isOldTokenSent=![];return _0x5b3e0c[_0xe49e('0x1a')]({'data1':_0x4120b3,'data2':null,'license':null});}}}else{if(_0x26e3ab[_0xe49e('0xf')]!=_0x4120b3){logger['info'](_0xe49e('0x18'),_0x26e3ab[_0xe49e('0xf')],_0x4120b3);return _0x5b3e0c[_0xe49e('0x1a')]({'data1':_0x4120b3,'data2':null,'license':null});}}}return _0x5b3e0c;})[_0xe49e('0xd')](function(_0x534791){_0x5b3e0c=_0x534791;})[_0xe49e('0x20')](function(_0x5eca82){logger['error'](_0x5eca82[_0xe49e('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xe49e('0x22')](),_0x5b3e0c);},TIME);});}function defaultLicense(){var _0x187b68=hardware[_0xe49e('0x22')]();if(_0x187b68){return db['License'][_0xe49e('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x187b68}})['spread'](function(_0x4fc4d7,_0x1af16d){logger['info'](_0xe49e('0x24'),_0x187b68);manageLicense(_0x187b68,_0x4fc4d7);})[_0xe49e('0x20')](function(_0x453023){logger['error'](_0x453023['message']);});}}exports[_0xe49e('0x25')]=defaultLicense; \ No newline at end of file +var _0x4264=['update','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','decryptString','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','get','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info'];(function(_0x4c1b41,_0x2582f8){var _0x93310b=function(_0x35fdc8){while(--_0x35fdc8){_0x4c1b41['push'](_0x4c1b41['shift']());}};_0x93310b(++_0x2582f8);}(_0x4264,0xa9));var _0x4426=function(_0x4b27a3,_0x59ebc1){_0x4b27a3=_0x4b27a3-0x0;var _0x361935=_0x4264[_0x4b27a3];return _0x361935;};'use strict';var util=require(_0x4426('0x0'));var moment=require(_0x4426('0x1'));var rp=require(_0x4426('0x2'));var BPromise=require(_0x4426('0x3'));var pkginfo=require('pkginfo')(module,_0x4426('0x4'));var db=require(_0x4426('0x5'))['db'];var encryptor=require(_0x4426('0x6'));var hardware=require('./hardware');var logger=require(_0x4426('0x7'))('license');var HOST=_0x4426('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x10dd9f){return new BPromise(function(_0x388ad8,_0x1df45f){var _0x277652=util[_0x4426('0x9')](_0x4426('0xa'),HOST,_0x10dd9f,module[_0x4426('0xb')][_0x4426('0x4')]);if(oldToken){_0x277652=util[_0x4426('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x10dd9f,module[_0x4426('0xb')][_0x4426('0x4')],oldToken);}var _0xd076e2={'uri':_0x277652,'method':_0x4426('0xc'),'timeout':0xea60,'json':!![]};return rp(_0xd076e2)[_0x4426('0xd')](function(_0x1cda67){_0x388ad8(_0x1cda67);})['catch'](function(_0x16db2a){_0x1df45f(_0x16db2a);});});}function manageLicense(_0x362edd,_0xa0a898){var _0x3e9ff7=_0xa0a898[_0x4426('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x3e9ff7[_0x4426('0xf')]!==_0x362edd&&!_0x3e9ff7[_0x4426('0x10')]){oldToken=_0x3e9ff7[_0x4426('0xf')];}httpRequest(_0x362edd)['then'](function(_0xf1831){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xf1831[_0x4426('0x11')]){isOldTokenSent=![];if(!_0x3e9ff7['license']&&_0x3e9ff7[_0x4426('0x12')]!=_0xf1831[_0x4426('0x12')]||_0x3e9ff7[_0x4426('0x12')]&&_0x3e9ff7[_0x4426('0x10')]){logger['info'](_0x4426('0x13'));}if(_0x3e9ff7[_0x4426('0x12')]&&!_0x3e9ff7[_0x4426('0x10')]&&_0x3e9ff7[_0x4426('0x12')]!=_0xf1831[_0x4426('0x12')]){logger[_0x4426('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3e9ff7[_0x4426('0x12')]&&!_0x3e9ff7[_0x4426('0x10')]&&_0x3e9ff7['license']==_0xf1831[_0x4426('0x12')]){return _0xa0a898;}return _0xa0a898[_0x4426('0x15')]({'data1':_0x362edd,'data2':null,'license':_0xf1831[_0x4426('0x12')]});}else{if(_0xf1831[_0x4426('0x12')]||_0x3e9ff7[_0x4426('0x12')]){if(!_0x3e9ff7[_0x4426('0x10')]){if(_0x3e9ff7[_0x4426('0xf')]==_0x362edd){GRAY_PERIOD_REASON='Disabled';logger[_0x4426('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4426('0x16');logger[_0x4426('0x14')](_0x4426('0x17'),_0x3e9ff7[_0x4426('0xf')],_0x362edd);}logger['info'](_0x4426('0x18'),GRAY_PERIOD_REASON[_0x4426('0x19')](),moment()[_0x4426('0x9')](_0x4426('0x1a')));return _0xa0a898[_0x4426('0x15')]({'data2':encryptor[_0x4426('0x1b')](moment()[_0x4426('0x9')](_0x4426('0x1a')))});}else{if(moment()['diff'](encryptor[_0x4426('0x1c')](_0x3e9ff7['data2']),'days')>DAYS){logger[_0x4426('0x14')](_0x4426('0x1d'),moment()['format'](_0x4426('0x1a')));isOldTokenSent=![];return _0xa0a898[_0x4426('0x15')]({'data1':_0x362edd,'data2':null,'license':null});}}}else{if(_0x3e9ff7[_0x4426('0xf')]!=_0x362edd){logger['info'](_0x4426('0x17'),_0x3e9ff7[_0x4426('0xf')],_0x362edd);return _0xa0a898[_0x4426('0x15')]({'data1':_0x362edd,'data2':null,'license':null});}}}return _0xa0a898;})[_0x4426('0xd')](function(_0x454563){_0xa0a898=_0x454563;})[_0x4426('0x1e')](function(_0x4e9316){logger[_0x4426('0x1f')](_0x4e9316[_0x4426('0x20')]);})[_0x4426('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x4426('0x22')](),_0xa0a898);},TIME);});}function defaultLicense(){var _0x50e9b7=hardware[_0x4426('0x22')]();if(_0x50e9b7){return db['License'][_0x4426('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x50e9b7}})[_0x4426('0x24')](function(_0x74e363,_0x51e509){logger[_0x4426('0x14')](_0x4426('0x25'),_0x50e9b7);manageLicense(_0x50e9b7,_0x74e363);})['catch'](function(_0x5b55b9){logger['error'](_0x5b55b9[_0x4426('0x20')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bd2ed9e..9c6f038 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 _0x9e77=['sequelize','COUNT','col','count','admin','user','telephone','users','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','bluebird','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','defaults','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','add','days','message','User','findAll','role'];(function(_0x186176,_0x2dd384){var _0x38c57c=function(_0x45b47b){while(--_0x45b47b){_0x186176['push'](_0x186176['shift']());}};_0x38c57c(++_0x2dd384);}(_0x9e77,0x16a));var _0x79e7=function(_0x2536e9,_0x1b40cc){_0x2536e9=_0x2536e9-0x0;var _0x198fb5=_0x9e77[_0x2536e9];return _0x198fb5;};'use strict';var util=require('util');var _=require(_0x79e7('0x0'));var moment=require('moment');var BPromise=require(_0x79e7('0x1'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x79e7('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x79e7('0x3')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x79e7('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x79e7('0x4'),'machineUuid':hardware[_0x79e7('0x3')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x192b01){return new BPromise(function(_0x40655e,_0x5b87e8){return db['License'][_0x79e7('0x5')](_[_0x79e7('0x6')](_0x192b01,{'raw':!![],'where':{'id':0x1}}))[_0x79e7('0x7')](function(_0xb0e504){return checkLicense(_0xb0e504,null);})[_0x79e7('0x7')](function(_0x17dfed){_0x40655e(_0x17dfed);return;})[_0x79e7('0x8')](function(_0x2b435f){_0x5b87e8(_0x2b435f);});});}function checkLicense(_0x419e28,_0x26b69d){if(!_0x419e28){demoLicense['uuid']=_0x419e28[_0x79e7('0x9')];return demoLicense;}try{var _0x57dc6d=_0x26b69d||_0x419e28['license'];if(_[_0x79e7('0xa')](_0x57dc6d)){throw new Error(_0x79e7('0xb'));}var _0x17aabd=_0x419e28[_0x79e7('0x9')];var _0x4164e3=_0x419e28[_0x79e7('0xc')];var _0x54934b=_0x17aabd[_0x79e7('0xd')]('-')[0x4];var _0x4d9f36=_0x17aabd[_0x79e7('0xd')]('-')[0x0];var _0xe07017=encryptor[_0x79e7('0xe')](_0x57dc6d,util[_0x79e7('0xf')](_0x79e7('0x10'),_0x54934b,_0x17aabd,_0x4d9f36));var _0x2f60f5=JSON[_0x79e7('0x11')](_0xe07017);_0x2f60f5[_0x79e7('0x12')]=![];_0x2f60f5[_0x79e7('0x13')]=_0x17aabd;_0x2f60f5[_0x79e7('0x14')]=hardware[_0x79e7('0x3')]();if(_0x4164e3){var _0x34aee9=encryptor['decryptString'](_0x4164e3);_0x2f60f5[_0x79e7('0x15')]=_0x34aee9;_0x2f60f5['deadline']=moment(_0x34aee9)[_0x79e7('0x16')](0x7,_0x79e7('0x17'))[_0x79e7('0xf')]();_0x2f60f5['grayReason']=_0x2f60f5[_0x79e7('0x13')]!=_0x2f60f5[_0x79e7('0x14')]?'changed':'disabled';}return _0x2f60f5;}catch(_0x128e28){breakingLicense[_0x79e7('0x13')]=_0x419e28[_0x79e7('0x9')];breakingLicense[_0x79e7('0x18')]=_0x128e28[_0x79e7('0x18')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2fdec3,_0x24fec3){getLicense()[_0x79e7('0x7')](function(_0x3bb8c6){return db[_0x79e7('0x19')][_0x79e7('0x1a')]({'attributes':[_0x79e7('0x1b'),[db[_0x79e7('0x1c')]['fn'](_0x79e7('0x1d'),db[_0x79e7('0x1c')][_0x79e7('0x1e')]('role')),_0x79e7('0x1f')]],'group':_0x79e7('0x1b'),'where':{'role':{'$or':[_0x79e7('0x20'),_0x79e7('0x21'),_0x79e7('0x22')]}},'raw':!![]})[_0x79e7('0x7')](function(_0x327060){var _0x12e998={'user':_0x3bb8c6[_0x79e7('0x23')]||0x0,'telephone':_0x3bb8c6['telephones']||0x0};_0x327060['forEach'](function(_0x44b2d4){var _0x4c5f51=_0x44b2d4[_0x79e7('0x1b')]===_0x79e7('0x20')?_0x79e7('0x21'):_0x44b2d4[_0x79e7('0x1b')];_0x12e998[_0x4c5f51]-=_0x44b2d4[_0x79e7('0x1f')];if(_0x12e998[_0x4c5f51]<0x0)_0x12e998[_0x4c5f51]=0x0;});_0x2fdec3(_0x12e998);return;});})[_0x79e7('0x8')](function(_0x445bc0){_0x24fec3(_0x445bc0);});});}function checkUserLimits(_0x1b4724){return new BPromise(function(_0x4979de,_0x574b5c){getLimits()[_0x79e7('0x7')](function(_0x5b286e){var _0x51afdf=_['pick'](_[_0x79e7('0x24')](_0x1b4724,_0x79e7('0x1b')),[_0x79e7('0x20'),_0x79e7('0x21'),_0x79e7('0x22')]);var _0x43f45a=(_0x51afdf['admin']||0x0)+(_0x51afdf['user']||0x0);var _0x2b17af=_0x51afdf['telephone']||0x0;if(_0x43f45a>_0x5b286e[_0x79e7('0x21')])return _0x574b5c('License\x20limit\x20reached\x20for\x20users');if(_0x2b17af>_0x5b286e[_0x79e7('0x22')])return _0x574b5c(_0x79e7('0x25'));return _0x4979de();})[_0x79e7('0x8')](function(_0xeb6672){_0x574b5c(_0xeb6672);});});}module[_0x79e7('0x26')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7c6f=['forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','../../components/encryptor','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','demo','machineUuid','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','telephones'];(function(_0x527221,_0x3ad559){var _0xdd8990=function(_0x45071d){while(--_0x45071d){_0x527221['push'](_0x527221['shift']());}};_0xdd8990(++_0x3ad559);}(_0x7c6f,0x11b));var _0xf7c6=function(_0x3675ad,_0x324a3c){_0x3675ad=_0x3675ad-0x0;var _0x11cf89=_0x7c6f[_0x3675ad];return _0x11cf89;};'use strict';var util=require('util');var _=require(_0xf7c6('0x0'));var moment=require(_0xf7c6('0x1'));var BPromise=require(_0xf7c6('0x2'));var hardware=require('./hardware');var encryptor=require(_0xf7c6('0x3'));var db=require('../../mysqldb')['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':_0xf7c6('0x4'),'machineUuid':hardware[_0xf7c6('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf7c6('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf7c6('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3c36ba){return new BPromise(function(_0x46c229,_0xeba353){return db[_0xf7c6('0x8')][_0xf7c6('0x9')](_['defaults'](_0x3c36ba,{'raw':!![],'where':{'id':0x1}}))[_0xf7c6('0xa')](function(_0x288669){return checkLicense(_0x288669,null);})[_0xf7c6('0xa')](function(_0x2e5e9f){_0x46c229(_0x2e5e9f);return;})[_0xf7c6('0xb')](function(_0x4cbc04){_0xeba353(_0x4cbc04);});});}function checkLicense(_0x47050a,_0xfebbea){if(!_0x47050a){demoLicense[_0xf7c6('0xc')]=_0x47050a['data1'];return demoLicense;}try{var _0xc238b0=_0xfebbea||_0x47050a[_0xf7c6('0xd')];if(_[_0xf7c6('0xe')](_0xc238b0)){throw new Error(_0xf7c6('0xf'));}var _0x521400=_0x47050a['data1'];var _0x41d3ea=_0x47050a[_0xf7c6('0x10')];var _0x87af5f=_0x521400[_0xf7c6('0x11')]('-')[0x4];var _0x3a0edf=_0x521400[_0xf7c6('0x11')]('-')[0x0];var _0x59bdc5=encryptor[_0xf7c6('0x12')](_0xc238b0,util[_0xf7c6('0x13')]('%s:%s:%s',_0x87af5f,_0x521400,_0x3a0edf));var _0x467c8e=JSON['parse'](_0x59bdc5);_0x467c8e[_0xf7c6('0x14')]=![];_0x467c8e[_0xf7c6('0xc')]=_0x521400;_0x467c8e[_0xf7c6('0x15')]=hardware['getUuid']();if(_0x41d3ea){var _0x51efe0=encryptor[_0xf7c6('0x12')](_0x41d3ea);_0x467c8e['gray']=_0x51efe0;_0x467c8e[_0xf7c6('0x16')]=moment(_0x51efe0)[_0xf7c6('0x17')](0x7,_0xf7c6('0x18'))['format']();_0x467c8e[_0xf7c6('0x19')]=_0x467c8e[_0xf7c6('0xc')]!=_0x467c8e[_0xf7c6('0x15')]?'changed':_0xf7c6('0x1a');}return _0x467c8e;}catch(_0x5e1af9){breakingLicense[_0xf7c6('0xc')]=_0x47050a['data1'];breakingLicense['message']=_0x5e1af9[_0xf7c6('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3b4b6f,_0x240b65){getLicense()[_0xf7c6('0xa')](function(_0x31d581){return db[_0xf7c6('0x1c')][_0xf7c6('0x1d')]({'attributes':[_0xf7c6('0x1e'),[db[_0xf7c6('0x1f')]['fn'](_0xf7c6('0x20'),db[_0xf7c6('0x1f')][_0xf7c6('0x21')]('role')),'count']],'group':'role','where':{'role':{'$or':[_0xf7c6('0x22'),_0xf7c6('0x23'),_0xf7c6('0x24')]}},'raw':!![]})[_0xf7c6('0xa')](function(_0x1c87f4){var _0x296364={'user':_0x31d581[_0xf7c6('0x25')]||0x0,'telephone':_0x31d581[_0xf7c6('0x26')]||0x0};_0x1c87f4[_0xf7c6('0x27')](function(_0x3c6f86){var _0x335061=_0x3c6f86[_0xf7c6('0x1e')]===_0xf7c6('0x22')?'user':_0x3c6f86[_0xf7c6('0x1e')];_0x296364[_0x335061]-=_0x3c6f86[_0xf7c6('0x28')];if(_0x296364[_0x335061]<0x0)_0x296364[_0x335061]=0x0;});_0x3b4b6f(_0x296364);return;});})['catch'](function(_0x2c518d){_0x240b65(_0x2c518d);});});}function checkUserLimits(_0x4aa396){return new BPromise(function(_0x3fe3f0,_0x367afb){getLimits()[_0xf7c6('0xa')](function(_0x36ae70){var _0x4597b0=_[_0xf7c6('0x29')](_[_0xf7c6('0x2a')](_0x4aa396,_0xf7c6('0x1e')),['admin',_0xf7c6('0x23'),'telephone']);var _0x20b456=(_0x4597b0['admin']||0x0)+(_0x4597b0[_0xf7c6('0x23')]||0x0);var _0x1590dc=_0x4597b0['telephone']||0x0;if(_0x20b456>_0x36ae70[_0xf7c6('0x23')])return _0x367afb(_0xf7c6('0x2b'));if(_0x1590dc>_0x36ae70[_0xf7c6('0x24')])return _0x367afb(_0xf7c6('0x2c'));return _0x3fe3f0();})[_0xf7c6('0xb')](function(_0x420064){_0x367afb(_0x420064);});});}module[_0xf7c6('0x2d')]={'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 f5c2f88..0a0d27d 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 _0xefda=['exports','app-id','secret'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xefda,0x96));var _0xaefd=function(_0x2045ec,_0x543794){_0x2045ec=_0x2045ec-0x0;var _0xc513a=_0xefda[_0x2045ec];return _0xc513a;};'use strict';module[_0xaefd('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xaefd('0x1'),'GOOGLE_SECRET':_0xaefd('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xd943=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd943,0x15d));var _0x3d94=function(_0x14278a,_0x1e9e05){_0x14278a=_0x14278a-0x0;var _0x276319=_0xd943[_0x14278a];return _0x276319;};'use strict';module[_0x3d94('0x0')]={'DOMAIN':_0x3d94('0x1'),'SESSION_SECRET':_0x3d94('0x2'),'GOOGLE_ID':_0x3d94('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 994a41d..c367ef8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45ae=['fileLogger'];(function(_0x1f2deb,_0x446cc3){var _0x2ce9eb=function(_0x5f9ff5){while(--_0x5f9ff5){_0x1f2deb['push'](_0x1f2deb['shift']());}};_0x2ce9eb(++_0x446cc3);}(_0x45ae,0xcd));var _0xe45a=function(_0x3cfa5b,_0x1c6541){_0x3cfa5b=_0x3cfa5b-0x0;var _0x5e518e=_0x45ae[_0x3cfa5b];return _0x5e518e;};'use strict';var fileLogger=require('../utils/loggers')[_0xe45a('0x0')];module['exports']=fileLogger; \ No newline at end of file +var _0x2450=['fileLogger','exports'];(function(_0x4670eb,_0x49fb20){var _0x253ebe=function(_0xb6674a){while(--_0xb6674a){_0x4670eb['push'](_0x4670eb['shift']());}};_0x253ebe(++_0x49fb20);}(_0x2450,0x166));var _0x0245=function(_0x1ada39,_0x3cd2a6){_0x1ada39=_0x1ada39-0x0;var _0x476c8e=_0x2450[_0x1ada39];return _0x476c8e;};'use strict';var fileLogger=require('../utils/loggers')[_0x0245('0x0')];module[_0x0245('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index fb254ee..d1de1ce 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 _0x70c4=['email','../../services/email/index.js','xdr','../../services/xdr/index.js','exports','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js'];(function(_0x44f4fe,_0x4ddfea){var _0x5f48bc=function(_0x3bfeb7){while(--_0x3bfeb7){_0x44f4fe['push'](_0x44f4fe['shift']());}};_0x5f48bc(++_0x4ddfea);}(_0x70c4,0x1f4));var _0x470c=function(_0x579f74,_0x206aa0){_0x579f74=_0x579f74-0x0;var _0x3bf7d0=_0x70c4[_0x579f74];return _0x3bf7d0;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0x470c('0x0')](cfg[_0x470c('0x1')],_0x470c('0x2')))};var pm2config={'apps':[{'name':_0x470c('0x3'),'script':path['join'](__dirname,_0x470c('0x4')),'env':env},{'name':'ami','script':path['join'](__dirname,_0x470c('0x5')),'env':env},{'name':'agi','script':path[_0x470c('0x0')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x470c('0x6'),'script':path['join'](__dirname,_0x470c('0x7')),'env':env},{'name':'routing','script':path[_0x470c('0x0')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x470c('0x8'),'script':path[_0x470c('0x0')](__dirname,_0x470c('0x9')),'env':env}]};module[_0x470c('0xa')]=pm2config; \ No newline at end of file +var _0x9305=['root','legacy-libs','express','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','../../config/environment','resolve'];(function(_0xeba27a,_0x2c3893){var _0x44e276=function(_0x129aa4){while(--_0x129aa4){_0xeba27a['push'](_0xeba27a['shift']());}};_0x44e276(++_0x2c3893);}(_0x9305,0x64));var _0x5930=function(_0x87208d,_0x320514){_0x87208d=_0x87208d-0x0;var _0x40eb1d=_0x9305[_0x87208d];return _0x40eb1d;};'use strict';var path=require('path');var cfg=require(_0x5930('0x0'));var env={'NODE_PATH':path[_0x5930('0x1')](path['join'](cfg[_0x5930('0x2')],_0x5930('0x3')))};var pm2config={'apps':[{'name':_0x5930('0x4'),'script':path[_0x5930('0x5')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x5930('0x6'),'script':path[_0x5930('0x5')](__dirname,_0x5930('0x7')),'env':env},{'name':_0x5930('0x8'),'script':path[_0x5930('0x5')](__dirname,_0x5930('0x9')),'env':env},{'name':_0x5930('0xa'),'script':path[_0x5930('0x5')](__dirname,_0x5930('0xb')),'env':env},{'name':_0x5930('0xc'),'script':path[_0x5930('0x5')](__dirname,_0x5930('0xd')),'env':env},{'name':_0x5930('0xe'),'script':path[_0x5930('0x5')](__dirname,_0x5930('0xf')),'env':env}]};module[_0x5930('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a0a7fe2..6c47f89 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 _0x87fd=['list','describe','delete','dump','bluebird','./config','connect','start','then','disconnect','stop','restart'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x87fd,0x1a8));var _0xd87f=function(_0x249bdb,_0x82bab2){_0x249bdb=_0x249bdb-0x0;var _0x5ed42d=_0x87fd[_0x249bdb];return _0x5ed42d;};'use strict';var pm2=require('pm2');var BPromise=require(_0xd87f('0x0'));var config=require(_0xd87f('0x1'));function connect(){return new BPromise(function(_0x139675,_0x547d01){return pm2[_0xd87f('0x2')](function(_0x3db9ca){if(_0x3db9ca){return _0x547d01(_0x3db9ca);}return _0x139675('connected');});});};exports[_0xd87f('0x3')]=function(_0x56ca74){return connect()[_0xd87f('0x4')](function(){return new BPromise(function(_0x42dc62,_0x55b8a2){return pm2[_0xd87f('0x3')](_0x56ca74,function(_0x51fc6d,_0x6134dc){if(_0x51fc6d){return _0x55b8a2(_0x51fc6d);}pm2[_0xd87f('0x5')]();return _0x42dc62(_0x6134dc);});});});};exports['stop']=function(_0x2e72df){return connect()[_0xd87f('0x4')](function(){return new BPromise(function(_0x170da2,_0x1f17b5){return pm2[_0xd87f('0x6')](_0x2e72df,function(_0x3b7b1a,_0x2e8d5a){if(_0x3b7b1a){return _0x1f17b5(_0x3b7b1a);}pm2[_0xd87f('0x5')]();return _0x170da2(_0x2e8d5a);});});});};exports[_0xd87f('0x7')]=function(_0xa647da){return connect()['then'](function(){return new BPromise(function(_0x47913f,_0x19f2f4){return pm2[_0xd87f('0x7')](_0xa647da,function(_0x1b6023,_0x5669e3){if(_0x1b6023){return _0x19f2f4(_0x1b6023);}pm2[_0xd87f('0x5')]();return _0x47913f(_0x5669e3);});});});};exports['list']=function(){return connect()[_0xd87f('0x4')](function(){return new BPromise(function(_0x25d2b7,_0x3f9929){return pm2[_0xd87f('0x8')](function(_0x3d27f2,_0x1f75f7){if(_0x3d27f2){return _0x3f9929(_0x3d27f2);}pm2[_0xd87f('0x5')]();return _0x25d2b7(_0x1f75f7);});});});};exports[_0xd87f('0x9')]=function(_0x2a6383){return connect()[_0xd87f('0x4')](function(){return new BPromise(function(_0x4cdba9,_0x1a45f5){return pm2[_0xd87f('0x9')](_0x2a6383,function(_0x18d869,_0x1315fb){if(_0x18d869){return _0x1a45f5(_0x18d869);}pm2[_0xd87f('0x5')]();return _0x4cdba9(_0x1315fb);});});});};exports[_0xd87f('0xa')]=function(_0x5ecbe3){return connect()['then'](function(){return new BPromise(function(_0x11448b,_0x4758b2){return pm2[_0xd87f('0xa')](_0x5ecbe3,function(_0x1492ac,_0x462c34){if(_0x1492ac){return _0x4758b2(_0x1492ac);}pm2[_0xd87f('0x5')]();return _0x11448b(_0x462c34);});});});};exports[_0xd87f('0xb')]=function(){return connect()[_0xd87f('0x4')](function(){return new BPromise(function(_0x4da79f,_0x52fcf2){return pm2[_0xd87f('0xb')](function(_0x5912e3){if(_0x5912e3){return _0x52fcf2(_0x5912e3);}return _0x4da79f('saved');});});});}; \ No newline at end of file +var _0x37ae=['list','describe','delete','dump','saved','pm2','./config','connect','connected','start','then','disconnect','stop'];(function(_0x3fe896,_0x18a20d){var _0x2c548a=function(_0x9199ad){while(--_0x9199ad){_0x3fe896['push'](_0x3fe896['shift']());}};_0x2c548a(++_0x18a20d);}(_0x37ae,0x1d9));var _0xe37a=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x37ae[_0x56fe98];return _0x212f4f;};'use strict';var pm2=require(_0xe37a('0x0'));var BPromise=require('bluebird');var config=require(_0xe37a('0x1'));function connect(){return new BPromise(function(_0x1d5a9c,_0x5a4312){return pm2[_0xe37a('0x2')](function(_0xe21be5){if(_0xe21be5){return _0x5a4312(_0xe21be5);}return _0x1d5a9c(_0xe37a('0x3'));});});};exports[_0xe37a('0x4')]=function(_0x279595){return connect()[_0xe37a('0x5')](function(){return new BPromise(function(_0x57ca11,_0x61c88b){return pm2[_0xe37a('0x4')](_0x279595,function(_0x46d5f0,_0x4e6256){if(_0x46d5f0){return _0x61c88b(_0x46d5f0);}pm2[_0xe37a('0x6')]();return _0x57ca11(_0x4e6256);});});});};exports[_0xe37a('0x7')]=function(_0x5e742f){return connect()['then'](function(){return new BPromise(function(_0x18cddc,_0x52ded7){return pm2[_0xe37a('0x7')](_0x5e742f,function(_0x1ec009,_0x4ad765){if(_0x1ec009){return _0x52ded7(_0x1ec009);}pm2[_0xe37a('0x6')]();return _0x18cddc(_0x4ad765);});});});};exports['restart']=function(_0x42dd8b){return connect()[_0xe37a('0x5')](function(){return new BPromise(function(_0x34fd3e,_0x4ec18f){return pm2['restart'](_0x42dd8b,function(_0x3e9b96,_0x1af546){if(_0x3e9b96){return _0x4ec18f(_0x3e9b96);}pm2[_0xe37a('0x6')]();return _0x34fd3e(_0x1af546);});});});};exports['list']=function(){return connect()[_0xe37a('0x5')](function(){return new BPromise(function(_0x5e5486,_0x1d70ef){return pm2[_0xe37a('0x8')](function(_0x3521f8,_0x1684da){if(_0x3521f8){return _0x1d70ef(_0x3521f8);}pm2[_0xe37a('0x6')]();return _0x5e5486(_0x1684da);});});});};exports[_0xe37a('0x9')]=function(_0xfa34a4){return connect()[_0xe37a('0x5')](function(){return new BPromise(function(_0x3f7636,_0x1910de){return pm2[_0xe37a('0x9')](_0xfa34a4,function(_0x12495d,_0x2b9284){if(_0x12495d){return _0x1910de(_0x12495d);}pm2[_0xe37a('0x6')]();return _0x3f7636(_0x2b9284);});});});};exports[_0xe37a('0xa')]=function(_0xa8045a){return connect()[_0xe37a('0x5')](function(){return new BPromise(function(_0x41dd86,_0x5bc17b){return pm2[_0xe37a('0xa')](_0xa8045a,function(_0x270b85,_0x1b9d2b){if(_0x270b85){return _0x5bc17b(_0x270b85);}pm2[_0xe37a('0x6')]();return _0x41dd86(_0x1b9d2b);});});});};exports[_0xe37a('0xb')]=function(){return connect()[_0xe37a('0x5')](function(){return new BPromise(function(_0x580982,_0x377520){return pm2[_0xe37a('0xb')](function(_0x3e7cd8){if(_0x3e7cd8){return _0x377520(_0x3e7cd8);}return _0x580982(_0xe37a('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index bf5c500..0b2fb4e 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 _0xb684=['length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes'];(function(_0x2e2499,_0x53ea7f){var _0x208669=function(_0x3bdfe9){while(--_0x3bdfe9){_0x2e2499['push'](_0x2e2499['shift']());}};_0x208669(++_0x53ea7f);}(_0xb684,0xa8));var _0x4b68=function(_0x2c20d2,_0x44d927){_0x2c20d2=_0x2c20d2-0x0;var _0x179161=_0xb684[_0x2c20d2];return _0x179161;};'use strict';var _=require(_0x4b68('0x0'));var moment=require(_0x4b68('0x1'));var Redis=require(_0x4b68('0x2'));var util=require('util');var config=require(_0x4b68('0x3'));var db=require(_0x4b68('0x4'))['db'];var logger=require(_0x4b68('0x5'))(_0x4b68('0x6'));config[_0x4b68('0x7')]=_['defaults'](config[_0x4b68('0x7')],{'host':_0x4b68('0x8'),'port':0x18eb});var io=require(_0x4b68('0x9'))(new Redis(config[_0x4b68('0x7')]));function closeInteractions(){var _0x4bc586=0x0;var _0x52d146=[];return db['Setting'][_0x4b68('0xa')]({'raw':!![],'attributes':['id',_0x4b68('0xb')],'where':{'id':0x1}})[_0x4b68('0xc')](function(_0x57d309){_0x4bc586=_0x57d309[_0x4b68('0xb')];if(_0x4bc586){return db[_0x4b68('0xd')][_0x4b68('0xe')]({'raw':!![],'attributes':['id',_0x4b68('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4b68('0x10')](_0x57d309[_0x4b68('0xb')],_0x4b68('0x11'))}}});}else{return[];}})['then'](function(_0x36dab4){if(_0x36dab4&&_0x36dab4[_0x4b68('0x12')]){_0x52d146=_[_0x4b68('0x13')](_0x36dab4||[],'id');logger[_0x4b68('0x14')](_0x4b68('0x15'),_0x52d146[_0x4b68('0x16')]());return db[_0x4b68('0xd')][_0x4b68('0x17')]({'closeReason':_0x4b68('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4b68('0x19')](_0x4b68('0x1a'))},{'where':{'id':_0x52d146}});}})[_0x4b68('0xc')](function(){if(_0x52d146&&_0x52d146[_0x4b68('0x12')]){logger[_0x4b68('0x14')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x52d146[_0x4b68('0x16')]());for(var _0x4b87bf=0x0;_0x4b87bf<_0x52d146[_0x4b68('0x12')];_0x4b87bf++){io[_0x4b68('0x1b')]('chatInteraction:update',{'id':_0x52d146[_0x4b87bf],'closed':!![]});}}})[_0x4b68('0x1c')](function(_0x4c235b){logger['error'](_0x4b68('0x1d'),_0x4c235b?util['inspect'](_0x4c235b,{'showHidden':![],'depth':null}):'');});}exports[_0x4b68('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0834=['[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','../../config/environment','../logger','redis','defaults','Setting','find','then','ChatInteraction','findAll','lastMsgAt','chatTimeout','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error'];(function(_0x49df93,_0x2bb7ac){var _0x471bac=function(_0x3dbdc5){while(--_0x3dbdc5){_0x49df93['push'](_0x49df93['shift']());}};_0x471bac(++_0x2bb7ac);}(_0x0834,0x106));var _0x4083=function(_0x472917,_0x34d079){_0x472917=_0x472917-0x0;var _0x2fffae=_0x0834[_0x472917];return _0x2fffae;};'use strict';var _=require(_0x4083('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0x4083('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x4083('0x2'))('schedule');config[_0x4083('0x3')]=_[_0x4083('0x4')](config[_0x4083('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0xe10753=0x0;var _0x1d4a1c=[];return db[_0x4083('0x5')][_0x4083('0x6')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x4083('0x7')](function(_0x27dbc7){_0xe10753=_0x27dbc7['chatTimeout'];if(_0xe10753){return db[_0x4083('0x8')][_0x4083('0x9')]({'raw':!![],'attributes':['id',_0x4083('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x27dbc7[_0x4083('0xb')],_0x4083('0xc'))}}});}else{return[];}})[_0x4083('0x7')](function(_0x21774a){if(_0x21774a&&_0x21774a[_0x4083('0xd')]){_0x1d4a1c=_['map'](_0x21774a||[],'id');logger[_0x4083('0xe')](_0x4083('0xf'),_0x1d4a1c[_0x4083('0x10')]());return db['ChatInteraction'][_0x4083('0x11')]({'closeReason':'system','disposition':_0x4083('0x12'),'closed':!![],'closedAt':moment()[_0x4083('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1d4a1c}});}})[_0x4083('0x7')](function(){if(_0x1d4a1c&&_0x1d4a1c[_0x4083('0xd')]){logger[_0x4083('0xe')](_0x4083('0x14'),_0x1d4a1c[_0x4083('0x10')]());for(var _0x3eb1ce=0x0;_0x3eb1ce<_0x1d4a1c[_0x4083('0xd')];_0x3eb1ce++){io[_0x4083('0x15')](_0x4083('0x16'),{'id':_0x1d4a1c[_0x3eb1ce],'closed':!![]});}}})['catch'](function(_0x2561a7){logger[_0x4083('0x17')](_0x4083('0x18'),_0x2561a7?util[_0x4083('0x19')](_0x2561a7,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 09d6942..1f16359 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 _0x5e24=['startAllRefreshIntervals','exports'];(function(_0x14c4e1,_0x1a40b8){var _0x15f899=function(_0x4ba923){while(--_0x4ba923){_0x14c4e1['push'](_0x14c4e1['shift']());}};_0x15f899(++_0x1a40b8);}(_0x5e24,0x130));var _0x45e2=function(_0x6782c1,_0x539047){_0x6782c1=_0x6782c1-0x0;var _0x52d22b=_0x5e24[_0x6782c1];return _0x52d22b;};'use strict';function start(){var _0x1c2897=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x1c2897[_0x45e2('0x0')]();}module[_0x45e2('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x24cd=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x897a93,_0x1f2039){var _0x2baf95=function(_0x2536d8){while(--_0x2536d8){_0x897a93['push'](_0x897a93['shift']());}};_0x2baf95(++_0x1f2039);}(_0x24cd,0x170));var _0xd24c=function(_0x59e230,_0x65494a){_0x59e230=_0x59e230-0x0;var _0x231ed9=_0x24cd[_0x59e230];return _0x231ed9;};'use strict';function start(){var _0x2db0a3=require(_0xd24c('0x0'));return _0x2db0a3[_0xd24c('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index c5d37f9..f9130c3 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 _0x386f=['MailAccount','getSmtpOptions','format','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','zip','join','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','SendMail','then','error','stringify','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','run\x20job','cron','active','isBetween','add','start','add\x20cron','endAt','update','update\x20cron','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','Try\x20to\x20send\x20a\x20mail\x20to','email'];(function(_0x217483,_0x422422){var _0x37f8a4=function(_0x7639ac){while(--_0x7639ac){_0x217483['push'](_0x217483['shift']());}};_0x37f8a4(++_0x422422);}(_0x386f,0x194));var _0xf386=function(_0x2a1d7a,_0x2f8c37){_0x2a1d7a=_0x2a1d7a-0x0;var _0xfc9855=_0x386f[_0x2a1d7a];return _0xfc9855;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xf386('0x0'));var _=require(_0xf386('0x1'));var moment=require(_0xf386('0x2'));var CronJobManager=require(_0xf386('0x3'));var jayson=require(_0xf386('0x4'));var BPromise=require(_0xf386('0x5'));var logger=require(_0xf386('0x6'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xf386('0x7'));var analyticDefaultReportController=require(_0xf386('0x8'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5057ee,_0x19abbe){return function(){logger['info'](_0xf386('0x9'),_0x5057ee[_0xf386('0xa')]);var _0x1ceae9=!![];var _0x3d1c86=_0x5057ee[_0xf386('0xb')][_0xf386('0xc')]();var _0x4e9191={'account':_0x3d1c86,'message':{'from':util[_0xf386('0xd')]('\x22%s\x22\x20<%s>',_0x5057ee[_0xf386('0xb')]['name'],_0x5057ee[_0xf386('0xb')][_0xf386('0xa')]||_0x5057ee[_0xf386('0xb')][_0xf386('0xe')][_0xf386('0xf')]),'to':_0x5057ee[_0xf386('0xa')],'cc':_0x5057ee['cc'],'bcc':_0x5057ee['bcc'],'subject':util[_0xf386('0xd')](_0xf386('0x10'),_0x19abbe[_0xf386('0x11')],_0x5057ee[_0xf386('0x12')],_0x5057ee[_0xf386('0x13')])}};var _0x32fad3=path['join'](__dirname,_0xf386('0x14'));var _0x336b70=_0x19abbe[_0xf386('0x15')];var _0x528912=util[_0xf386('0xd')](_0xf386('0x16'),path[_0xf386('0x17')](_0x19abbe[_0xf386('0x15')],path['extname'](_0x19abbe[_0xf386('0x15')])),_0xf386('0x18'));var _0x1bbd1a=path[_0xf386('0x19')](_0x32fad3,_0x336b70);var _0x4d39ec=path[_0xf386('0x19')](_0x32fad3,_0x528912);if(fs['existsSync'](_0x1bbd1a)){_0x19abbe[_0xf386('0x1a')]=_0xf386('0x1b');_0x4e9191['message']['attachments']=[{'filename':_0x336b70,'path':_0x1bbd1a}];_0x4e9191[_0xf386('0x1c')]['text']=util[_0xf386('0xd')](_0xf386('0x1d'),JSON['stringify'](_0x19abbe,null,0x2));}else if(fs[_0xf386('0x1e')](_0x4d39ec)){_0x19abbe['status']=_0xf386('0x1b');_0x4e9191[_0xf386('0x1c')]['attachments']=[{'filename':_0x528912,'path':_0x4d39ec}];}else{_0x4e9191[_0xf386('0x1c')]['text']=_0xf386('0x1f');if(!_0x5057ee[_0xf386('0x20')]){_0x1ceae9=![];logger[_0xf386('0x21')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1ceae9){return client['request'](_0xf386('0x22'),_0x4e9191)[_0xf386('0x23')](function(_0x19bb23){if(_0x19bb23[_0xf386('0x24')]){return logger[_0xf386('0x24')]('error\x20mail',JSON[_0xf386('0x25')](_0x19bb23));}return logger[_0xf386('0x21')]('email\x20sent');})['catch'](function(_0x1b6fe6){return logger[_0xf386('0x24')](_0xf386('0x26'),JSON[_0xf386('0x25')](_0x1b6fe6));});}};}function handleError(){return function(_0x239d84){return logger[_0xf386('0x24')](JSON['stringify'](_0x239d84));};}function handleResult(_0x956622){return function(_0x4fec73){logger[_0xf386('0x21')](_0xf386('0x27'),JSON[_0xf386('0x25')](_0x4fec73));if(_0x956622[_0xf386('0xb')]&&_0x956622[_0xf386('0xb')][_0xf386('0xe')]&&!_[_0xf386('0x28')](_0x956622['email'])){setTimeout(handleSendEmail(_0x956622,_0x4fec73),0x3c*0x3e8);}};}function handleJob(_0x261b8d){return function(){try{if(_[_0xf386('0x28')](_0x261b8d[_0xf386('0x12')])){return logger[_0xf386('0x21')](_0xf386('0x29'));}if(_[_0xf386('0x28')](_0x261b8d['subtractUnit'])){return logger[_0xf386('0x21')](_0xf386('0x2a'));}var _0x33427a={'startDate':moment()[_0xf386('0x2b')](_0x261b8d['subtractNumber'],_0x261b8d[_0xf386('0x13')])[_0xf386('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xf386('0xd')](_0xf386('0x2c')),'type':_0xf386('0x2d'),'output':_0x261b8d[_0xf386('0x2e')],'name':_0x261b8d['name']};if(!_[_0xf386('0x28')](_0x261b8d[_0xf386('0x2f')])){logger['info'](_0xf386('0x30'),_0x261b8d[_0xf386('0x2f')]);return analyticDefaultReportController[_0xf386('0x31')]({'id':_0x261b8d['DefaultReportId']},_0x33427a)[_0xf386('0x23')](handleResult(_0x261b8d))[_0xf386('0x32')](handleError());}if(!_[_0xf386('0x28')](_0x261b8d[_0xf386('0x33')])){logger[_0xf386('0x21')]('exec\x20custom\x20report\x20id:%s',_0x261b8d[_0xf386('0x33')]);return analyticCustomReportController[_0xf386('0x31')]({'id':_0x261b8d[_0xf386('0x33')]},_0x33427a)[_0xf386('0x23')](handleResult(_0x261b8d))[_0xf386('0x32')](handleError());}}catch(_0x3f334a){logger[_0xf386('0x24')](JSON[_0xf386('0x25')](_0x3f334a));}return logger['info'](_0xf386('0x34'));};}function getJobs(_0x3d80e6){var _0x58f5f7={};if(_0x3d80e6){_0x58f5f7['id']=_0x3d80e6;}return db[_0xf386('0x35')]['findAll']({'where':_0x58f5f7,'include':[{'model':db[_0xf386('0xb')],'attributes':['id',_0xf386('0x11'),_0xf386('0xa')],'include':[{'model':db[_0xf386('0x36')],'as':_0xf386('0xe'),'include':[{'model':db[_0xf386('0x37')],'as':_0xf386('0x37')}]}]}]})['then'](function(_0x419c95){var _0x5ee22b=_[_0xf386('0x38')](manager[_0xf386('0x39')]);var _0x132f66=_[_0xf386('0x3a')](_0x419c95,function(_0x32b7c0){return _0x32b7c0['id'][_0xf386('0x3b')]();});var _0x78ea5c=_[_0xf386('0x3c')](_0x419c95,function(_0x3ece71){return _0x3ece71['id']['toString']();});var _0xe1f4c3=_0x3d80e6?_0x132f66:_[_0xf386('0x3d')](_0x132f66,_0x5ee22b);var _0x35e976=_[_0xf386('0x3e')](_0x132f66,_0x5ee22b);var _0x171cbf=_[_0xf386('0x3d')](_0x5ee22b,_0x132f66);var _0x5f48d8;var _0x33db45;for(_0x5f48d8=0x0;_0x5f48d8<_0x171cbf['length']&&!_0x3d80e6;_0x5f48d8+=0x1){_0x33db45=_0x171cbf[_0x5f48d8]['toString']();if(manager[_0xf386('0x3f')](_0x33db45)){manager[_0xf386('0x40')](_0x33db45);manager[_0xf386('0x41')](_0x33db45);logger[_0xf386('0x21')](_0xf386('0x42'),_0x33db45);}}logger[_0xf386('0x21')](_0xf386('0x43'),JSON[_0xf386('0x25')](_0xe1f4c3));for(_0x5f48d8=0x0;_0x5f48d8<_0xe1f4c3[_0xf386('0x44')];_0x5f48d8+=0x1){_0x33db45=_0xe1f4c3[_0x5f48d8][_0xf386('0x3b')]();logger[_0xf386('0x21')](_0xf386('0x45'),_0x33db45);if(_0x3d80e6){logger[_0xf386('0x21')](_0xf386('0x46'),_0x3d80e6);logger['info'](JSON[_0xf386('0x25')](_0x78ea5c[_0x33db45]));BPromise['resolve']()[_0xf386('0x23')](handleJob(_0x78ea5c[_0x33db45]));logger['info'](_0xf386('0x47'),_0x78ea5c[_0x33db45][_0xf386('0x11')],_0x78ea5c[_0x33db45][_0xf386('0x48')]);}else if(_0x78ea5c[_0x33db45][_0xf386('0x48')]&&_0x78ea5c[_0x33db45][_0xf386('0x49')]&&moment()[_0xf386('0x4a')](_0x78ea5c[_0x33db45]['startAt'],_0x78ea5c[_0x33db45]['endAt'])){manager[_0xf386('0x4b')](_0x33db45,_0x78ea5c[_0x33db45][_0xf386('0x48')],handleJob(_0x78ea5c[_0x33db45]));manager[_0xf386('0x4c')](_0x33db45);logger[_0xf386('0x21')](_0xf386('0x4d'),_0x78ea5c[_0x33db45][_0xf386('0x11')],_0x78ea5c[_0x33db45][_0xf386('0x48')]);}else if(manager[_0xf386('0x3f')](_0x33db45)){manager['stop'](_0x33db45);manager['deleteJob'](_0x33db45);logger['info']('stop\x20cron',_0x78ea5c[_0x33db45][_0xf386('0x11')],_0x78ea5c[_0x33db45][_0xf386('0x48')]);}}for(_0x5f48d8=0x0,_0x33db45;_0x5f48d8<_0x35e976[_0xf386('0x44')]&&!_0x3d80e6;_0x5f48d8+=0x1){_0x33db45=_0x35e976[_0x5f48d8][_0xf386('0x3b')]();if(manager[_0xf386('0x3f')](_0x33db45)){if(_0x78ea5c[_0x33db45][_0xf386('0x48')]&&_0x78ea5c[_0x33db45][_0xf386('0x49')]&&moment()[_0xf386('0x4a')](_0x78ea5c[_0x33db45]['startAt'],_0x78ea5c[_0x33db45][_0xf386('0x4e')])){manager[_0xf386('0x4f')](_0x33db45,_0x78ea5c[_0x33db45][_0xf386('0x48')],handleJob(_0x78ea5c[_0x33db45]));logger[_0xf386('0x21')](_0xf386('0x50'),_0x78ea5c[_0x33db45]['name'],_0x78ea5c[_0x33db45][_0xf386('0x48')]);}else{manager[_0xf386('0x40')](_0x33db45);manager['deleteJob'](_0x33db45);logger[_0xf386('0x21')](_0xf386('0x51'),_0x78ea5c[_0x33db45][_0xf386('0x11')],_0x78ea5c[_0x33db45]['cron']);}}}})['catch'](function(_0x1abcc7){logger[_0xf386('0x24')](JSON[_0xf386('0x25')](_0x1abcc7));});}exports[_0xf386('0x52')]=function(_0x48d662){return getJobs(_0x48d662);};exports[_0xf386('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8074=['map','toString','keyBy','difference','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','active','isBetween','cron','start','add\x20cron','stop','stop\x20cron','endAt','update','run','util','path','moment','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','subtractNumber','join','savename','%s.%s','basename','extname','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','existsSync','status','info','request','SendMail','then','error','error\x20mail','stringify','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20custom\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8074,0x143));var _0x4807=function(_0x294b13,_0x3b35bb){_0x294b13=_0x294b13-0x0;var _0xe61ce7=_0x8074[_0x294b13];return _0xe61ce7;};'use strict';var fs=require('fs');var util=require(_0x4807('0x0'));var path=require(_0x4807('0x1'));var _=require('lodash');var moment=require(_0x4807('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x4807('0x3'));var logger=require(_0x4807('0x4'))(_0x4807('0x5'));var db=require(_0x4807('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x4807('0x7'));var client=jayson[_0x4807('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x9055e5,_0x2dd217){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x9055e5[_0x4807('0x9')]);var _0x1f108f=!![];var _0x3b582e=_0x9055e5[_0x4807('0xa')]['getSmtpOptions']();var _0x33bd33={'account':_0x3b582e,'message':{'from':util[_0x4807('0xb')](_0x4807('0xc'),_0x9055e5[_0x4807('0xa')][_0x4807('0xd')],_0x9055e5[_0x4807('0xa')][_0x4807('0x9')]||_0x9055e5[_0x4807('0xa')][_0x4807('0xe')]['user']),'to':_0x9055e5[_0x4807('0x9')],'cc':_0x9055e5['cc'],'bcc':_0x9055e5['bcc'],'subject':util[_0x4807('0xb')]('Report\x20%s\x20last\x20%s\x20%s',_0x2dd217[_0x4807('0xd')],_0x9055e5[_0x4807('0xf')],_0x9055e5['subtractUnit'])}};var _0x3985e9=path[_0x4807('0x10')](__dirname,'../../files/reports');var _0x1bfdfc=_0x2dd217[_0x4807('0x11')];var _0x24f675=util[_0x4807('0xb')](_0x4807('0x12'),path[_0x4807('0x13')](_0x2dd217[_0x4807('0x11')],path[_0x4807('0x14')](_0x2dd217['savename'])),'zip');var _0x29f0fc=path[_0x4807('0x10')](_0x3985e9,_0x1bfdfc);var _0x1fe06a=path['join'](_0x3985e9,_0x24f675);if(fs['existsSync'](_0x29f0fc)){_0x2dd217['status']=_0x4807('0x15');_0x33bd33[_0x4807('0x16')][_0x4807('0x17')]=[{'filename':_0x1bfdfc,'path':_0x29f0fc}];_0x33bd33['message'][_0x4807('0x18')]=util[_0x4807('0xb')](_0x4807('0x19'),JSON['stringify'](_0x2dd217,null,0x2));}else if(fs[_0x4807('0x1a')](_0x1fe06a)){_0x2dd217[_0x4807('0x1b')]='Sent';_0x33bd33[_0x4807('0x16')][_0x4807('0x17')]=[{'filename':_0x24f675,'path':_0x1fe06a}];}else{_0x33bd33['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x9055e5['sendIfEmpty']){_0x1f108f=![];logger[_0x4807('0x1c')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1f108f){return client[_0x4807('0x1d')](_0x4807('0x1e'),_0x33bd33)[_0x4807('0x1f')](function(_0x1cd222){if(_0x1cd222[_0x4807('0x20')]){return logger['error'](_0x4807('0x21'),JSON[_0x4807('0x22')](_0x1cd222));}return logger[_0x4807('0x1c')]('email\x20sent');})[_0x4807('0x23')](function(_0x20e27e){return logger['error'](_0x4807('0x21'),JSON[_0x4807('0x22')](_0x20e27e));});}};}function handleError(){return function(_0x3de195){return logger['error'](JSON[_0x4807('0x22')](_0x3de195));};}function handleResult(_0xcc0276){return function(_0x15f955){logger[_0x4807('0x1c')](_0x4807('0x24'),JSON['stringify'](_0x15f955));if(_0xcc0276[_0x4807('0xa')]&&_0xcc0276['MailAccount'][_0x4807('0xe')]&&!_[_0x4807('0x25')](_0xcc0276[_0x4807('0x9')])){setTimeout(handleSendEmail(_0xcc0276,_0x15f955),0x3c*0x3e8);}};}function handleJob(_0x1f8167){return function(){try{if(_['isNil'](_0x1f8167['subtractNumber'])){return logger[_0x4807('0x1c')](_0x4807('0x26'));}if(_[_0x4807('0x25')](_0x1f8167['subtractUnit'])){return logger[_0x4807('0x1c')]('subtractUnit\x20null\x20or\x20undefined');}var _0x48c8a0={'startDate':moment()['subtract'](_0x1f8167[_0x4807('0xf')],_0x1f8167['subtractUnit'])[_0x4807('0xb')](_0x4807('0x27')),'endDate':moment()['format'](_0x4807('0x27')),'type':_0x4807('0x28'),'output':_0x1f8167[_0x4807('0x29')],'name':_0x1f8167[_0x4807('0xd')]};if(!_[_0x4807('0x25')](_0x1f8167[_0x4807('0x2a')])){logger[_0x4807('0x1c')]('exec\x20defaul\x20report\x20id:%s',_0x1f8167[_0x4807('0x2a')]);return analyticDefaultReportController['runReport']({'id':_0x1f8167[_0x4807('0x2a')]},_0x48c8a0)[_0x4807('0x1f')](handleResult(_0x1f8167))['catch'](handleError());}if(!_['isNil'](_0x1f8167['CustomReportId'])){logger['info'](_0x4807('0x2b'),_0x1f8167['CustomReportId']);return analyticCustomReportController[_0x4807('0x2c')]({'id':_0x1f8167[_0x4807('0x2d')]},_0x48c8a0)[_0x4807('0x1f')](handleResult(_0x1f8167))[_0x4807('0x23')](handleError());}}catch(_0x4bb017){logger[_0x4807('0x20')](JSON['stringify'](_0x4bb017));}return logger['info'](_0x4807('0x2e'));};}function getJobs(_0x37144f){var _0x2168f8={};if(_0x37144f){_0x2168f8['id']=_0x37144f;}return db['Schedule'][_0x4807('0x2f')]({'where':_0x2168f8,'include':[{'model':db[_0x4807('0xa')],'attributes':['id','name',_0x4807('0x9')],'include':[{'model':db[_0x4807('0x30')],'as':_0x4807('0xe'),'include':[{'model':db[_0x4807('0x31')],'as':'CloudProvider'}]}]}]})[_0x4807('0x1f')](function(_0x26ba27){var _0x52fcd4=_[_0x4807('0x32')](manager[_0x4807('0x33')]);var _0x358a2e=_[_0x4807('0x34')](_0x26ba27,function(_0x4eede0){return _0x4eede0['id'][_0x4807('0x35')]();});var _0x4d0aa8=_[_0x4807('0x36')](_0x26ba27,function(_0x4ccfb6){return _0x4ccfb6['id']['toString']();});var _0x328ffd=_0x37144f?_0x358a2e:_['difference'](_0x358a2e,_0x52fcd4);var _0x86704b=_['intersection'](_0x358a2e,_0x52fcd4);var _0x304c01=_[_0x4807('0x37')](_0x52fcd4,_0x358a2e);var _0x10bfbc;var _0x5f22b5;for(_0x10bfbc=0x0;_0x10bfbc<_0x304c01[_0x4807('0x38')]&&!_0x37144f;_0x10bfbc+=0x1){_0x5f22b5=_0x304c01[_0x10bfbc][_0x4807('0x35')]();if(manager[_0x4807('0x39')](_0x5f22b5)){manager['stop'](_0x5f22b5);manager[_0x4807('0x3a')](_0x5f22b5);logger['info'](_0x4807('0x3b'),_0x5f22b5);}}logger[_0x4807('0x1c')](_0x4807('0x3c'),JSON[_0x4807('0x22')](_0x328ffd));for(_0x10bfbc=0x0;_0x10bfbc<_0x328ffd[_0x4807('0x38')];_0x10bfbc+=0x1){_0x5f22b5=_0x328ffd[_0x10bfbc][_0x4807('0x35')]();logger[_0x4807('0x1c')](_0x4807('0x3d'),_0x5f22b5);if(_0x37144f){logger['info'](_0x4807('0x3e'),_0x37144f);logger[_0x4807('0x1c')](JSON[_0x4807('0x22')](_0x4d0aa8[_0x5f22b5]));BPromise[_0x4807('0x3f')]()['then'](handleJob(_0x4d0aa8[_0x5f22b5]));logger[_0x4807('0x1c')](_0x4807('0x40'),_0x4d0aa8[_0x5f22b5][_0x4807('0xd')],_0x4d0aa8[_0x5f22b5]['cron']);}else if(_0x4d0aa8[_0x5f22b5]['cron']&&_0x4d0aa8[_0x5f22b5][_0x4807('0x41')]&&moment()[_0x4807('0x42')](_0x4d0aa8[_0x5f22b5]['startAt'],_0x4d0aa8[_0x5f22b5]['endAt'])){manager['add'](_0x5f22b5,_0x4d0aa8[_0x5f22b5][_0x4807('0x43')],handleJob(_0x4d0aa8[_0x5f22b5]));manager[_0x4807('0x44')](_0x5f22b5);logger[_0x4807('0x1c')](_0x4807('0x45'),_0x4d0aa8[_0x5f22b5]['name'],_0x4d0aa8[_0x5f22b5][_0x4807('0x43')]);}else if(manager['exists'](_0x5f22b5)){manager[_0x4807('0x46')](_0x5f22b5);manager['deleteJob'](_0x5f22b5);logger['info'](_0x4807('0x47'),_0x4d0aa8[_0x5f22b5]['name'],_0x4d0aa8[_0x5f22b5][_0x4807('0x43')]);}}for(_0x10bfbc=0x0,_0x5f22b5;_0x10bfbc<_0x86704b[_0x4807('0x38')]&&!_0x37144f;_0x10bfbc+=0x1){_0x5f22b5=_0x86704b[_0x10bfbc][_0x4807('0x35')]();if(manager[_0x4807('0x39')](_0x5f22b5)){if(_0x4d0aa8[_0x5f22b5]['cron']&&_0x4d0aa8[_0x5f22b5]['active']&&moment()[_0x4807('0x42')](_0x4d0aa8[_0x5f22b5]['startAt'],_0x4d0aa8[_0x5f22b5][_0x4807('0x48')])){manager[_0x4807('0x49')](_0x5f22b5,_0x4d0aa8[_0x5f22b5][_0x4807('0x43')],handleJob(_0x4d0aa8[_0x5f22b5]));logger[_0x4807('0x1c')]('update\x20cron',_0x4d0aa8[_0x5f22b5][_0x4807('0xd')],_0x4d0aa8[_0x5f22b5][_0x4807('0x43')]);}else{manager['stop'](_0x5f22b5);manager[_0x4807('0x3a')](_0x5f22b5);logger[_0x4807('0x1c')](_0x4807('0x47'),_0x4d0aa8[_0x5f22b5][_0x4807('0xd')],_0x4d0aa8[_0x5f22b5][_0x4807('0x43')]);}}}})['catch'](function(_0x33d9dd){logger[_0x4807('0x20')](JSON['stringify'](_0x33d9dd));});}exports[_0x4807('0x4a')]=function(_0x1a5eae){return getJobs(_0x1a5eae);};exports[_0x4807('0x44')]=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 17d75dc..411e32f 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 _0x6584=['Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','catch','name','error','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','info','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne'];(function(_0x58e434,_0x3b6d4f){var _0xfc855a=function(_0x2302c0){while(--_0x2302c0){_0x58e434['push'](_0x58e434['shift']());}};_0xfc855a(++_0x3b6d4f);}(_0x6584,0x175));var _0x4658=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x6584[_0x4394b6];return _0x360244;};var _=require(_0x4658('0x0'));var AWS=require(_0x4658('0x1'));var rp=require(_0x4658('0x2'));var util=require(_0x4658('0x3'));var BPromise=require('bluebird');var db=require(_0x4658('0x4'))['db'];var logger=require(_0x4658('0x5'))(_0x4658('0x6'));function getTranscriptionJob(_0x55b820,_0x53a2eb,_0x15fbf2,_0x126301){return new Promise(function(_0x253182,_0x63273f){var _0x5b2a16=new AWS['TranscribeService']({'accessKeyId':_0x53a2eb,'secretAccessKey':_0x55b820,'region':_0x15fbf2});_0x5b2a16[_0x4658('0x7')]({'TranscriptionJobName':_0x126301},function(_0x2ff543,_0x6e2e03){if(_0x2ff543){return _0x63273f(_0x2ff543);}else{return _0x253182(_0x6e2e03);}});});}function sentiment(_0x51d3f4,_0x10b9e0,_0x796ef7,_0x570ef0,_0x5117fc){return new Promise(function(_0x429f7a,_0x49ec37){var _0x309489=new AWS['Comprehend']({'accessKeyId':_0x10b9e0,'secretAccessKey':_0x51d3f4,'region':_0x796ef7});_0x309489[_0x4658('0x8')]({'Text':_0x570ef0,'LanguageCode':_0x5117fc['substring'](0x0,0x2)},function(_0x4060c6,_0x511c40){if(_0x4060c6){return _0x49ec37(_0x4060c6);}else{return _0x429f7a(_0x511c40);}});});}function checkTranscribeJob(_0x29a06a,_0x243444,_0x424206){var _0x4eb5e5;return new BPromise(function(_0x38aabe,_0x41f611){logger['info'](util['format'](_0x4658('0x9'),_0x29a06a['id'],_0x29a06a['transcribeName']));return getTranscriptionJob(_0x424206[_0x4658('0xa')],_0x424206['data2'],_0x243444[_0x4658('0xb')],_0x29a06a[_0x4658('0xc')])['then'](function(_0x27aede){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x29a06a['id'],_0x29a06a[_0x4658('0xc')],_0x27aede['TranscriptionJob'][_0x4658('0xd')]));if(!_0x29a06a[_0x4658('0xe')]){switch(_0x27aede[_0x4658('0xf')][_0x4658('0xd')]){case _0x4658('0x10'):var _0x30bf0d={'transcribeStatus':_0x27aede['TranscriptionJob'][_0x4658('0xd')],'fileUri':_0x27aede[_0x4658('0xf')][_0x4658('0x11')][_0x4658('0x12')]};logger[_0x4658('0x13')](util[_0x4658('0x14')]('[RECORDING:%d]\x20Get\x20transcript',_0x29a06a['id']));return rp({'uri':_0x27aede[_0x4658('0xf')][_0x4658('0x11')][_0x4658('0x12')],'json':!![]})['then'](function(_0x2eb16d){logger[_0x4658('0x13')](util[_0x4658('0x14')](_0x4658('0x15'),_0x29a06a['id']));if(_0x2eb16d&&_0x2eb16d[_0x4658('0x16')]&&_0x2eb16d[_0x4658('0x16')][_0x4658('0x17')]&&_0x2eb16d['results'][_0x4658('0x17')]['length']){_0x30bf0d[_0x4658('0xe')]='';for(var _0x4516b4=0x0;_0x4516b4<_0x2eb16d[_0x4658('0x16')][_0x4658('0x17')][_0x4658('0x18')];_0x4516b4++){_0x30bf0d['fileText']+=_0x2eb16d[_0x4658('0x16')][_0x4658('0x17')][_0x4516b4][_0x4658('0x19')]+'';}}return _0x29a06a[_0x4658('0x1a')](_0x30bf0d);})[_0x4658('0x1b')](function(){logger[_0x4658('0x13')](util[_0x4658('0x14')](_0x4658('0x1c'),_0x29a06a['id']));if(!_0x29a06a[_0x4658('0x1d')]){throw new db['Sequelize'][(_0x4658('0x1e'))](_0x4658('0x1f'));}if(!_0x243444[_0x4658('0x20')]||!_0x243444[_0x4658('0x21')]||!_0x243444['sentimentRegion']||!_0x243444[_0x4658('0x22')]||!_0x243444[_0x4658('0x23')]){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))](_0x4658('0x25'));}if(!_0x30bf0d['fileText']){throw new Error(_0x4658('0x26'));}if(_0x243444['sentimentAccountId']===_0x424206['id']){return _0x424206;}else{return db[_0x4658('0x27')][_0x4658('0x28')]({'where':{'id':_settings[_0x4658('0x21')]}});}})['then'](function(_0x19856c){if(!_0x19856c){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))](_0x4658('0x29'));}if(!_0x19856c[_0x4658('0xa')]||!_0x19856c[_0x4658('0x2a')]){throw new db['Sequelize'][(_0x4658('0x1e'))](_0x4658('0x2b'));}_0x4eb5e5=_0x19856c;logger[_0x4658('0x13')](util[_0x4658('0x14')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x29a06a['id']));return sentiment(_0x4eb5e5[_0x4658('0xa')],_0x4eb5e5[_0x4658('0x2a')],_0x243444[_0x4658('0x2c')],_0x30bf0d['fileText'],_0x243444['language']);})[_0x4658('0x1b')](function(_0x560618){logger[_0x4658('0x13')](util['format'](_0x4658('0x2d'),_0x29a06a['id']));return _0x29a06a[_0x4658('0x1a')]({'sentiment':_0x560618[_0x4658('0x2e')],'sPositive':_0x560618['SentimentScore'][_0x4658('0x2f')],'sNegative':_0x560618[_0x4658('0x30')][_0x4658('0x31')],'sMixed':_0x560618[_0x4658('0x30')][_0x4658('0x32')],'sNeutral':_0x560618[_0x4658('0x30')][_0x4658('0x33')]});})[_0x4658('0x1b')](function(){logger[_0x4658('0x13')](util[_0x4658('0x14')](_0x4658('0x1c'),_0x29a06a['id']));_0x38aabe();});case _0x4658('0x34'):return _0x29a06a['update']({'transcribeStatus':_0x4658('0x34'),'failureReason':_0x27aede[_0x4658('0xf')][_0x4658('0x35')]})['then'](function(){logger[_0x4658('0x13')](util['format'](_0x4658('0x1c'),_0x29a06a['id']));_0x38aabe();});default:logger[_0x4658('0x13')](util['format'](_0x4658('0x36'),_0x29a06a['id']));break;}}else{return BPromise[_0x4658('0x37')]()[_0x4658('0x1b')](function(){if(!_0x29a06a[_0x4658('0x1d')]){throw new db[(_0x4658('0x24'))]['ValidationError'](_0x4658('0x1f'));}if(!_0x243444['sentiment']||!_0x243444[_0x4658('0x21')]||!_0x243444[_0x4658('0x2c')]||!_0x243444[_0x4658('0x22')]||!_0x243444[_0x4658('0x23')]){throw new db[(_0x4658('0x24'))]['ValidationError'](_0x4658('0x25'));}if(!_0x29a06a['fileText']){throw new Error(_0x4658('0x26'));}if(_0x243444['sentimentAccountId']===_0x424206['id']){return _0x424206;}else{return db[_0x4658('0x27')][_0x4658('0x28')]({'where':{'id':_settings[_0x4658('0x21')]}});}})[_0x4658('0x1b')](function(_0x1eca32){if(!_0x1eca32){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1eca32[_0x4658('0xa')]||!_0x1eca32['data2']){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))](_0x4658('0x2b'));}_0x4eb5e5=_0x1eca32;logger['info'](util[_0x4658('0x14')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x29a06a['id']));return sentiment(_0x4eb5e5['data1'],_0x4eb5e5[_0x4658('0x2a')],_0x243444['sentimentRegion'],_0x29a06a[_0x4658('0xe')],_0x243444['language']);})[_0x4658('0x1b')](function(_0x56995d){logger[_0x4658('0x13')](util[_0x4658('0x14')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x29a06a['id']));return _0x29a06a[_0x4658('0x1a')]({'sentiment':_0x56995d[_0x4658('0x2e')],'sPositive':_0x56995d['SentimentScore'][_0x4658('0x2f')],'sNegative':_0x56995d[_0x4658('0x30')]['Negative'],'sMixed':_0x56995d[_0x4658('0x30')][_0x4658('0x32')],'sNeutral':_0x56995d[_0x4658('0x30')][_0x4658('0x33')],'transcribeStatus':_0x4658('0x10')});})[_0x4658('0x1b')](function(){logger[_0x4658('0x13')](util[_0x4658('0x14')](_0x4658('0x1c'),_0x29a06a['id']));_0x38aabe();});}})[_0x4658('0x38')](function(_0x35075a){if(_0x35075a){if(!_0x35075a[_0x4658('0x39')]||_0x35075a[_0x4658('0x39')]!=='SequelizeValidationError'){logger[_0x4658('0x3a')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x29a06a['id']),util['inspect'](_0x35075a,{'showHidden':![],'depth':null}));}}_0x38aabe();});});}function checkTranscribe(){var _0x47f7fe;var _0xca376d;var _0x3bc7e0;return db[_0x4658('0x3b')][_0x4658('0x3c')]({'where':{'transcribeStatus':_0x4658('0x3d')}})['then'](function(_0x6a11f2){if(!_0x6a11f2||!_0x6a11f2[_0x4658('0x18')]){throw new db['Sequelize'][(_0x4658('0x1e'))](_0x4658('0x3e'));}_0x47f7fe=_0x6a11f2;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x3c5712){if(!_0x3c5712){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))](_0x4658('0x3f'));}_0xca376d=_0x3c5712;if(!_0xca376d[_0x4658('0x6')]||!_0xca376d[_0x4658('0x40')]||!_0xca376d['transcribeRegion']||!_0xca376d[_0x4658('0x22')]||!_0xca376d[_0x4658('0x23')]){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))](_0x4658('0x41'));}return db[_0x4658('0x27')]['findOne']({'where':{'id':_0xca376d[_0x4658('0x40')]}});})[_0x4658('0x1b')](function(_0x583c52){if(!_0x583c52){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))](_0x4658('0x29'));}if(!_0x583c52[_0x4658('0xa')]||!_0x583c52[_0x4658('0x2a')]){throw new db[(_0x4658('0x24'))][(_0x4658('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x3bc7e0=_0x583c52;var _0x33c754=[];_0x47f7fe[_0x4658('0x42')](function(_0x560031){_0x33c754[_0x4658('0x43')](checkTranscribeJob(_0x560031,_0xca376d,_0x3bc7e0));});return BPromise[_0x4658('0x44')](_0x33c754);})[_0x4658('0x38')](function(_0x4093b5){if(_0x4093b5){if(!_0x4093b5[_0x4658('0x39')]||_0x4093b5[_0x4658('0x39')]!=='SequelizeValidationError'){logger[_0x4658('0x3a')](util['inspect'](_0x4093b5,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe99c=['Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Positive','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','error','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','format','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','CloudProvider','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xe99c,0x197));var _0xce99=function(_0x19b860,_0x4ffb60){_0x19b860=_0x19b860-0x0;var _0x31dbc4=_0xe99c[_0x19b860];return _0x31dbc4;};var _=require(_0xce99('0x0'));var AWS=require('aws-sdk');var rp=require(_0xce99('0x1'));var util=require(_0xce99('0x2'));var BPromise=require(_0xce99('0x3'));var db=require(_0xce99('0x4'))['db'];var logger=require(_0xce99('0x5'))(_0xce99('0x6'));function getTranscriptionJob(_0x5e5c2d,_0x58c455,_0x2e4043,_0x577adc){return new Promise(function(_0x32fc7e,_0x58e2aa){var _0x3755dd=new AWS[(_0xce99('0x7'))]({'accessKeyId':_0x58c455,'secretAccessKey':_0x5e5c2d,'region':_0x2e4043});_0x3755dd[_0xce99('0x8')]({'TranscriptionJobName':_0x577adc},function(_0x732cca,_0x39df1c){if(_0x732cca){return _0x58e2aa(_0x732cca);}else{return _0x32fc7e(_0x39df1c);}});});}function sentiment(_0x3675ef,_0x29f7db,_0x48aa48,_0x5727f2,_0x3ceb6f){return new Promise(function(_0xed09d1,_0x4c7423){var _0x26ac93=new AWS[(_0xce99('0x9'))]({'accessKeyId':_0x29f7db,'secretAccessKey':_0x3675ef,'region':_0x48aa48});_0x26ac93[_0xce99('0xa')]({'Text':_0x5727f2,'LanguageCode':_0x3ceb6f['substring'](0x0,0x2)},function(_0x368389,_0x4e83af){if(_0x368389){return _0x4c7423(_0x368389);}else{return _0xed09d1(_0x4e83af);}});});}function checkTranscribeJob(_0x1ad149,_0x3e1606,_0x55a29a){var _0x598662;return new BPromise(function(_0x384c94,_0x115e85){logger[_0xce99('0xb')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x1ad149['id'],_0x1ad149[_0xce99('0xc')]));return getTranscriptionJob(_0x55a29a['data1'],_0x55a29a[_0xce99('0xd')],_0x3e1606['transcribeRegion'],_0x1ad149[_0xce99('0xc')])[_0xce99('0xe')](function(_0x18b3d3){logger['info'](util['format'](_0xce99('0xf'),_0x1ad149['id'],_0x1ad149[_0xce99('0xc')],_0x18b3d3[_0xce99('0x10')]['TranscriptionJobStatus']));if(!_0x1ad149[_0xce99('0x11')]){switch(_0x18b3d3[_0xce99('0x10')][_0xce99('0x12')]){case _0xce99('0x13'):var _0x3f2427={'transcribeStatus':_0x18b3d3[_0xce99('0x10')][_0xce99('0x12')],'fileUri':_0x18b3d3['TranscriptionJob'][_0xce99('0x14')]['TranscriptFileUri']};logger[_0xce99('0xb')](util[_0xce99('0x15')](_0xce99('0x16'),_0x1ad149['id']));return rp({'uri':_0x18b3d3[_0xce99('0x10')][_0xce99('0x14')][_0xce99('0x17')],'json':!![]})['then'](function(_0x18ac4e){logger[_0xce99('0xb')](util['format'](_0xce99('0x18'),_0x1ad149['id']));if(_0x18ac4e&&_0x18ac4e[_0xce99('0x19')]&&_0x18ac4e[_0xce99('0x19')][_0xce99('0x1a')]&&_0x18ac4e[_0xce99('0x19')][_0xce99('0x1a')][_0xce99('0x1b')]){_0x3f2427[_0xce99('0x11')]='';for(var _0x4061e7=0x0;_0x4061e7<_0x18ac4e[_0xce99('0x19')][_0xce99('0x1a')][_0xce99('0x1b')];_0x4061e7++){_0x3f2427[_0xce99('0x11')]+=_0x18ac4e[_0xce99('0x19')][_0xce99('0x1a')][_0x4061e7][_0xce99('0x1c')]+'';}}return _0x1ad149[_0xce99('0x1d')](_0x3f2427);})[_0xce99('0xe')](function(){logger[_0xce99('0xb')](util[_0xce99('0x15')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ad149['id']));if(!_0x1ad149['tempSentiment']){throw new db[(_0xce99('0x1e'))][(_0xce99('0x1f'))](_0xce99('0x20'));}if(!_0x3e1606['sentiment']||!_0x3e1606[_0xce99('0x21')]||!_0x3e1606[_0xce99('0x22')]||!_0x3e1606[_0xce99('0x23')]||!_0x3e1606['bucket']){throw new db['Sequelize'][(_0xce99('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3f2427[_0xce99('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x3e1606[_0xce99('0x21')]===_0x55a29a['id']){return _0x55a29a;}else{return db[_0xce99('0x24')][_0xce99('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xce99('0xe')](function(_0x1640dd){if(!_0x1640dd){throw new db[(_0xce99('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1640dd[_0xce99('0x26')]||!_0x1640dd['data2']){throw new db[(_0xce99('0x1e'))][(_0xce99('0x1f'))](_0xce99('0x27'));}_0x598662=_0x1640dd;logger[_0xce99('0xb')](util[_0xce99('0x15')](_0xce99('0x28'),_0x1ad149['id']));return sentiment(_0x598662[_0xce99('0x26')],_0x598662[_0xce99('0xd')],_0x3e1606['sentimentRegion'],_0x3f2427[_0xce99('0x11')],_0x3e1606[_0xce99('0x23')]);})[_0xce99('0xe')](function(_0xf50024){logger['info'](util[_0xce99('0x15')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ad149['id']));return _0x1ad149[_0xce99('0x1d')]({'sentiment':_0xf50024[_0xce99('0x29')],'sPositive':_0xf50024[_0xce99('0x2a')]['Positive'],'sNegative':_0xf50024[_0xce99('0x2a')][_0xce99('0x2b')],'sMixed':_0xf50024[_0xce99('0x2a')][_0xce99('0x2c')],'sNeutral':_0xf50024[_0xce99('0x2a')][_0xce99('0x2d')]});})[_0xce99('0xe')](function(){logger[_0xce99('0xb')](util['format'](_0xce99('0x2e'),_0x1ad149['id']));_0x384c94();});case _0xce99('0x2f'):return _0x1ad149['update']({'transcribeStatus':_0xce99('0x2f'),'failureReason':_0x18b3d3[_0xce99('0x10')][_0xce99('0x30')]})['then'](function(){logger[_0xce99('0xb')](util['format'](_0xce99('0x2e'),_0x1ad149['id']));_0x384c94();});default:logger[_0xce99('0xb')](util[_0xce99('0x15')](_0xce99('0x31'),_0x1ad149['id']));break;}}else{return BPromise[_0xce99('0x32')]()[_0xce99('0xe')](function(){if(!_0x1ad149['tempSentiment']){throw new db[(_0xce99('0x1e'))][(_0xce99('0x1f'))](_0xce99('0x20'));}if(!_0x3e1606[_0xce99('0x33')]||!_0x3e1606['sentimentAccountId']||!_0x3e1606[_0xce99('0x22')]||!_0x3e1606[_0xce99('0x23')]||!_0x3e1606[_0xce99('0x34')]){throw new db[(_0xce99('0x1e'))]['ValidationError'](_0xce99('0x35'));}if(!_0x1ad149['fileText']){throw new Error(_0xce99('0x36'));}if(_0x3e1606[_0xce99('0x21')]===_0x55a29a['id']){return _0x55a29a;}else{return db[_0xce99('0x24')]['findOne']({'where':{'id':_settings[_0xce99('0x21')]}});}})[_0xce99('0xe')](function(_0x4a16b7){if(!_0x4a16b7){throw new db[(_0xce99('0x1e'))][(_0xce99('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4a16b7[_0xce99('0x26')]||!_0x4a16b7[_0xce99('0xd')]){throw new db['Sequelize'][(_0xce99('0x1f'))](_0xce99('0x27'));}_0x598662=_0x4a16b7;logger[_0xce99('0xb')](util[_0xce99('0x15')](_0xce99('0x28'),_0x1ad149['id']));return sentiment(_0x598662['data1'],_0x598662['data2'],_0x3e1606[_0xce99('0x22')],_0x1ad149['fileText'],_0x3e1606[_0xce99('0x23')]);})['then'](function(_0x2d8ec9){logger[_0xce99('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ad149['id']));return _0x1ad149[_0xce99('0x1d')]({'sentiment':_0x2d8ec9[_0xce99('0x29')],'sPositive':_0x2d8ec9[_0xce99('0x2a')][_0xce99('0x37')],'sNegative':_0x2d8ec9['SentimentScore'][_0xce99('0x2b')],'sMixed':_0x2d8ec9[_0xce99('0x2a')][_0xce99('0x2c')],'sNeutral':_0x2d8ec9[_0xce99('0x2a')]['Neutral'],'transcribeStatus':_0xce99('0x13')});})[_0xce99('0xe')](function(){logger['info'](util[_0xce99('0x15')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ad149['id']));_0x384c94();});}})[_0xce99('0x38')](function(_0x137cb0){if(_0x137cb0){if(!_0x137cb0[_0xce99('0x39')]||_0x137cb0[_0xce99('0x39')]!==_0xce99('0x3a')){logger['error'](util[_0xce99('0x15')](_0xce99('0x3b'),_0x1ad149['id']),util[_0xce99('0x3c')](_0x137cb0,{'showHidden':![],'depth':null}));}}_0x384c94();});});}function checkTranscribe(){var _0x48b851;var _0x2bd7c2;var _0x599b3a;return db[_0xce99('0x3d')][_0xce99('0x3e')]({'where':{'transcribeStatus':_0xce99('0x3f')}})[_0xce99('0xe')](function(_0x28ad59){if(!_0x28ad59||!_0x28ad59[_0xce99('0x1b')]){throw new db[(_0xce99('0x1e'))][(_0xce99('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x48b851=_0x28ad59;return db[_0xce99('0x40')][_0xce99('0x25')]({'where':{'id':0x1}});})[_0xce99('0xe')](function(_0x2322cd){if(!_0x2322cd){throw new db['Sequelize'][(_0xce99('0x1f'))](_0xce99('0x41'));}_0x2bd7c2=_0x2322cd;if(!_0x2bd7c2[_0xce99('0x6')]||!_0x2bd7c2[_0xce99('0x42')]||!_0x2bd7c2[_0xce99('0x43')]||!_0x2bd7c2[_0xce99('0x23')]||!_0x2bd7c2[_0xce99('0x34')]){throw new db['Sequelize']['ValidationError'](_0xce99('0x44'));}return db[_0xce99('0x24')][_0xce99('0x25')]({'where':{'id':_0x2bd7c2['transcribeAccountId']}});})[_0xce99('0xe')](function(_0x484a38){if(!_0x484a38){throw new db['Sequelize'][(_0xce99('0x1f'))](_0xce99('0x45'));}if(!_0x484a38['data1']||!_0x484a38[_0xce99('0xd')]){throw new db[(_0xce99('0x1e'))][(_0xce99('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x599b3a=_0x484a38;var _0x465816=[];_0x48b851[_0xce99('0x46')](function(_0x3319a6){_0x465816[_0xce99('0x47')](checkTranscribeJob(_0x3319a6,_0x2bd7c2,_0x599b3a));});return BPromise[_0xce99('0x48')](_0x465816);})[_0xce99('0x38')](function(_0x5a1d3c){if(_0x5a1d3c){if(!_0x5a1d3c[_0xce99('0x39')]||_0x5a1d3c['name']!==_0xce99('0x3a')){logger[_0xce99('0x49')](util[_0xce99('0x3c')](_0x5a1d3c,{'showHidden':![],'depth':null}));}}});}exports[_0xce99('0x4a')]=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 ac676d1..0eda127 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 _0x975f=['join','WhatsappInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis','redis','defaults','socket.io-emitter','lastMsgAt','subtract','hours','info'];(function(_0x2dd0cf,_0x53a53f){var _0x578453=function(_0x22d324){while(--_0x22d324){_0x2dd0cf['push'](_0x2dd0cf['shift']());}};_0x578453(++_0x53a53f);}(_0x975f,0x167));var _0xf975=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x975f[_0x26d6d9];return _0x1b4875;};'use strict';var _=require('lodash');var moment=require(_0xf975('0x0'));var Redis=require(_0xf975('0x1'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0xf975('0x2')]=_[_0xf975('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf975('0x4'))(new Redis(config[_0xf975('0x2')]));function closeInteractions(){var _0x526ac0=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xf975('0x5')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf975('0x6')](0x18,_0xf975('0x7'))}}})['then'](function(_0x71744b){if(_0x71744b&&_0x71744b['length']){_0x526ac0=_['map'](_0x71744b||[],'id');logger[_0xf975('0x8')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x526ac0[_0xf975('0x9')]());return db[_0xf975('0xa')][_0xf975('0xb')]({'closeReason':'system','disposition':_0xf975('0xc'),'closed':!![],'closedAt':moment()['format'](_0xf975('0xd'))},{'where':{'id':_0x526ac0}});}})[_0xf975('0xe')](function(){if(_0x526ac0&&_0x526ac0[_0xf975('0xf')]){logger[_0xf975('0x8')](_0xf975('0x10'),_0x526ac0[_0xf975('0x9')]());for(var _0x8271c1=0x0;_0x8271c1<_0x526ac0['length'];_0x8271c1++){io[_0xf975('0x11')](_0xf975('0x12'),{'id':_0x526ac0[_0x8271c1],'closed':!![]});}}})[_0xf975('0x13')](function(_0x375d9f){logger[_0xf975('0x14')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x375d9f?util[_0xf975('0x15')](_0x375d9f,{'showHidden':![],'depth':null}):'');});}exports[_0xf975('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2a6f=['hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','error','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt'];(function(_0x2b2ab3,_0x386ce0){var _0x4f65b9=function(_0x1754f4){while(--_0x1754f4){_0x2b2ab3['push'](_0x2b2ab3['shift']());}};_0x4f65b9(++_0x386ce0);}(_0x2a6f,0x15b));var _0xf2a6=function(_0x56d04b,_0x459ce3){_0x56d04b=_0x56d04b-0x0;var _0x583d8f=_0x2a6f[_0x56d04b];return _0x583d8f;};'use strict';var _=require(_0xf2a6('0x0'));var moment=require(_0xf2a6('0x1'));var Redis=require(_0xf2a6('0x2'));var util=require(_0xf2a6('0x3'));var config=require('../../config/environment');var db=require(_0xf2a6('0x4'))['db'];var logger=require(_0xf2a6('0x5'))(_0xf2a6('0x6'));config[_0xf2a6('0x7')]=_[_0xf2a6('0x8')](config[_0xf2a6('0x7')],{'host':_0xf2a6('0x9'),'port':0x18eb});var io=require(_0xf2a6('0xa'))(new Redis(config[_0xf2a6('0x7')]));function closeInteractions(){var _0x2c3fae=[];return db['WhatsappInteraction'][_0xf2a6('0xb')]({'raw':!![],'attributes':['id',_0xf2a6('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf2a6('0xd'))}}})[_0xf2a6('0xe')](function(_0x316d64){if(_0x316d64&&_0x316d64[_0xf2a6('0xf')]){_0x2c3fae=_[_0xf2a6('0x10')](_0x316d64||[],'id');logger['info'](_0xf2a6('0x11'),_0x2c3fae['join']());return db[_0xf2a6('0x12')][_0xf2a6('0x13')]({'closeReason':'system','disposition':_0xf2a6('0x14'),'closed':!![],'closedAt':moment()[_0xf2a6('0x15')](_0xf2a6('0x16'))},{'where':{'id':_0x2c3fae}});}})[_0xf2a6('0xe')](function(){if(_0x2c3fae&&_0x2c3fae['length']){logger[_0xf2a6('0x17')](_0xf2a6('0x18'),_0x2c3fae[_0xf2a6('0x19')]());for(var _0x1dc34f=0x0;_0x1dc34f<_0x2c3fae[_0xf2a6('0xf')];_0x1dc34f++){io[_0xf2a6('0x1a')]('whatsappInteraction:update',{'id':_0x2c3fae[_0x1dc34f],'closed':!![]});}}})['catch'](function(_0x3ed6d1){logger[_0xf2a6('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x3ed6d1?util[_0xf2a6('0x1c')](_0x3ed6d1,{'showHidden':![],'depth':null}):'');});}exports[_0xf2a6('0x1d')]=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 8fa0bb7..f2379ec 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd596=['CmHopper','hopper1','contacts2','util','push','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0x2e9f1e,_0x4d89ae){var _0x9ba79e=function(_0x565880){while(--_0x565880){_0x2e9f1e['push'](_0x2e9f1e['shift']());}};_0x9ba79e(++_0x4d89ae);}(_0xd596,0x83));var _0x6d59=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xd596[_0x211fef];return _0x5447bf;};'use strict';var util=require(_0x6d59('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6d59('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x6d59('0x2')+i,'phone':0xf879fb460+i,'email':_0x6d59('0x3')+i+_0x6d59('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x6d59('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6d59('0x5')](),'updatedAt':Date[_0x6d59('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6d59('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x6d59('0x2')+i,'phone':0xf879fb460+i,'email':_0x6d59('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6d59('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6d59('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6d59('0x5')](),'updatedAt':Date['now']()});}db[_0x6d59('0x6')][_0x6d59('0x7')]({'where':{}})[_0x6d59('0x8')](function(){return db[_0x6d59('0x6')][_0x6d59('0x9')](contacts);})[_0x6d59('0x8')](function(){console[_0x6d59('0xa')](_0x6d59('0xb'),_0x6d59('0xc'));return db[_0x6d59('0xd')]['destroy']({'where':{}});})[_0x6d59('0x8')](function(){return db[_0x6d59('0xd')][_0x6d59('0x9')](hopper);})['then'](function(){console[_0x6d59('0xa')](_0x6d59('0xb'),_0x6d59('0xe'));return db[_0x6d59('0x6')][_0x6d59('0x9')](contacts2);})[_0x6d59('0x8')](function(){console[_0x6d59('0xa')]('finished\x20populating',_0x6d59('0xf'));return db[_0x6d59('0xd')][_0x6d59('0x9')](hopper2);})[_0x6d59('0x8')](function(){console[_0x6d59('0xa')](_0x6d59('0xb'),'hopper2');})['catch'](function(_0x1e63f6){console[_0x6d59('0xa')](_0x1e63f6);}); \ No newline at end of file +var _0x730d=['catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','destroy','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper2'];(function(_0x47ef03,_0x50f4a3){var _0x2299c3=function(_0x50756e){while(--_0x50756e){_0x47ef03['push'](_0x47ef03['shift']());}};_0x2299c3(++_0x50f4a3);}(_0x730d,0xab));var _0xd730=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x730d[_0x18a79d];return _0x4f8848;};'use strict';var util=require(_0xd730('0x0'));var db=require(_0xd730('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd730('0x2')]({'id':i,'firstName':_0xd730('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xd730('0x4')+i+_0xd730('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd730('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd730('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd730('0x6')](),'updatedAt':Date[_0xd730('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd730('0x2')]({'id':i,'firstName':_0xd730('0x3')+i,'lastName':_0xd730('0x7')+i,'phone':0xf879fb460+i,'email':_0xd730('0x4')+i+_0xd730('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd730('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd730('0x6')](),'updatedAt':Date[_0xd730('0x6')]()});}db['CmContact'][_0xd730('0x8')]({'where':{}})[_0xd730('0x9')](function(){return db[_0xd730('0xa')][_0xd730('0xb')](contacts);})[_0xd730('0x9')](function(){console[_0xd730('0xc')](_0xd730('0xd'),'contacts1');return db[_0xd730('0xe')][_0xd730('0x8')]({'where':{}});})[_0xd730('0x9')](function(){return db[_0xd730('0xe')][_0xd730('0xb')](hopper);})[_0xd730('0x9')](function(){console[_0xd730('0xc')]('finished\x20populating','hopper1');return db['CmContact'][_0xd730('0xb')](contacts2);})[_0xd730('0x9')](function(){console[_0xd730('0xc')](_0xd730('0xd'),'contacts2');return db['CmHopper'][_0xd730('0xb')](hopper2);})['then'](function(){console['log'](_0xd730('0xd'),_0xd730('0xf'));})[_0xd730('0x10')](function(_0x50de28){console['log'](_0x50de28);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 88835ad..a610f96 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c7b=['add\x20user','catch','log','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c7b,0x7b));var _0xb8c7=function(_0xf9d583,_0xc9c988){_0xf9d583=_0xf9d583-0x0;var _0x52d96b=_0x8c7b[_0xf9d583];return _0x52d96b;};'use strict';var util=require('util');var db=require(_0xb8c7('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb8c7('0x1')]({'name':util['format'](_0xb8c7('0x2'),_0xb8c7('0x3'),i),'fullname':util[_0xb8c7('0x4')](_0xb8c7('0x2'),_0xb8c7('0x3'),i),'email':util[_0xb8c7('0x4')](_0xb8c7('0x5'),_0xb8c7('0x3'),i),'role':'agent','password':_0xb8c7('0x6'),'internal':0xfa0+i,'type':_0xb8c7('0x7'),'transport':['udp','ws','wss'],'disallow':[_0xb8c7('0x8')],'allow':[_0xb8c7('0x9')],'defaultuser':util[_0xb8c7('0x4')](_0xb8c7('0x2'),_0xb8c7('0x3'),i),'encryption':_0xb8c7('0xa'),'avpf':_0xb8c7('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xb8c7('0xa'),'dtlsverify':'no','dtlscertfile':_0xb8c7('0xb'),'dtlsprivatekey':_0xb8c7('0xc'),'dtlssetup':'actpass','callerid':util['format'](_0xb8c7('0xd'),util[_0xb8c7('0x4')](_0xb8c7('0x2'),_0xb8c7('0x3'),i),0xfa0+i)});}db[_0xb8c7('0xe')][_0xb8c7('0xf')](users)[_0xb8c7('0x10')](function(){console['log'](_0xb8c7('0x11'));})[_0xb8c7('0x12')](function(_0x1b363c){console[_0xb8c7('0x13')](_0x1b363c);}); \ No newline at end of file +var _0x04ad=['friend','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','add\x20user','catch','util','../mysqldb','format','agent','%s%s','%s%s@xcally.com','password'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x04ad,0x175));var _0xd04a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x04ad[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xd04a('0x0'));var db=require(_0xd04a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xd04a('0x2')]('%s%s',_0xd04a('0x3'),i),'fullname':util[_0xd04a('0x2')](_0xd04a('0x4'),'agent',i),'email':util[_0xd04a('0x2')](_0xd04a('0x5'),'agent',i),'role':'agent','password':_0xd04a('0x6'),'internal':0xfa0+i,'type':_0xd04a('0x7'),'transport':['udp','ws',_0xd04a('0x8')],'disallow':['all'],'allow':[_0xd04a('0x9')],'defaultuser':util[_0xd04a('0x2')]('%s%s',_0xd04a('0x3'),i),'encryption':_0xd04a('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0xd04a('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xd04a('0xb'),'dtlsprivatekey':_0xd04a('0xc'),'dtlssetup':_0xd04a('0xd'),'callerid':util[_0xd04a('0x2')](_0xd04a('0xe'),util[_0xd04a('0x2')](_0xd04a('0x4'),'agent',i),0xfa0+i)});}db[_0xd04a('0xf')]['bulkCreate'](users)['then'](function(){console[_0xd04a('0x10')](_0xd04a('0x11'));})[_0xd04a('0x12')](function(_0x41ef17){console[_0xd04a('0x10')](_0x41ef17);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b7b1f0a..f883e05 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2687=['OpenchannelQueue','WhatsappQueue','Trunks','IvrCampaigns','agent','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','leave','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','log','join','default','connection','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','User','role','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','map','where','format','%s:queue:%s','Agents','length','user:%s','find','userProfileId','handshake','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','MailQueue','Trunk','user','VoiceQueue','FaxQueue','SmsQueue'];(function(_0x432d66,_0x283ad9){var _0x64f753=function(_0x5579d5){while(--_0x5579d5){_0x432d66['push'](_0x432d66['shift']());}};_0x64f753(++_0x283ad9);}(_0x2687,0x8f));var _0x7268=function(_0x4173f3,_0x41904c){_0x4173f3=_0x4173f3-0x0;var _0x2431a0=_0x2687[_0x4173f3];return _0x2431a0;};'use strict';var _=require(_0x7268('0x0'));var util=require(_0x7268('0x1'));var BPromise=require('bluebird');var db=require(_0x7268('0x2'))['db'];var config=require(_0x7268('0x3'));var queryQueues={'attributes':['id',_0x7268('0x4')],'include':[{'as':'Agents','model':db[_0x7268('0x5')],'attributes':['id',_0x7268('0x4'),_0x7268('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7268('0x4')],'where':{'role':_0x7268('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7268('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7268('0x4'),_0x7268('0x8')],'where':{'type':_0x7268('0x9')}};function getAssociatedResources(_0x3b25f8,_0x32885e,_0x116b3f){return db[_0x7268('0xa')][_0x7268('0xb')]({'where':{'name':_0x3b25f8,'userProfileId':_0x32885e},'raw':!![]})[_0x7268('0xc')](function(_0x211f25){if(_0x211f25){if(_0x211f25[_0x7268('0xd')]){switch(_0x3b25f8){case _0x7268('0xe'):case _0x7268('0xf'):case _0x7268('0x10'):case'SmsQueues':case _0x7268('0x11'):case _0x7268('0x12'):case _0x7268('0x13'):return db[_0x116b3f][_0x7268('0x14')](queryQueues);case _0x7268('0x15'):return db[_0x116b3f][_0x7268('0x14')](queryTelephones);case'Trunks':return db[_0x116b3f]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x116b3f][_0x7268('0x14')](queryCampaigns);}}else{return db[_0x7268('0x16')][_0x7268('0x14')]({'attributes':[_0x7268('0x17')],'where':{'sectionId':_0x211f25['id']},'raw':!![]})[_0x7268('0xc')](function(_0x64a51){if(_0x64a51){var _0x8abe85={'where':{'id':_[_0x7268('0x18')](_0x64a51,'resourceId')},'raw':!![]};switch(_0x116b3f){case _0x7268('0x5'):_0x8abe85['where'][_0x7268('0x6')]=_0x7268('0x7');break;case'Campaign':_0x8abe85[_0x7268('0x19')][_0x7268('0x8')]='ivr';break;}return db[_0x116b3f][_0x7268('0x14')](_0x8abe85);}else{return[];}});}}else{return[];}})['then'](function(_0x2c3cfe){return _0x2c3cfe;});}function joinOrLeaveQueues(_0x6cd42b,_0x56bac6,_0x1e9d2c,_0x4dd54a){_0x6cd42b[_0x56bac6](util[_0x7268('0x1a')](_0x7268('0x1b'),_0x1e9d2c,_0x4dd54a[_0x7268('0x4')]));if(_0x4dd54a[_0x7268('0x1c')]){for(var _0x49b390=0x0;_0x49b390<_0x4dd54a[_0x7268('0x1c')][_0x7268('0x1d')];_0x49b390+=0x1){_0x6cd42b[_0x56bac6](util[_0x7268('0x1a')](_0x7268('0x1e'),_0x4dd54a[_0x7268('0x1c')][_0x49b390][_0x7268('0x4')]));}}}function joinOrLeave(_0x5ade09,_0x3e551d,_0x3abb49){var _0x4d820b;if(_0x5ade09['handshake']['query']['id']){db[_0x7268('0x5')][_0x7268('0x1f')]({'attributes':['id',_0x7268('0x4'),_0x7268('0x6'),_0x7268('0x20')],'where':{'id':_0x5ade09[_0x7268('0x21')][_0x7268('0x22')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x7268('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x7268('0x24')],'as':_0x7268('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7268('0x26')],'as':_0x7268('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7268('0x28')],'as':_0x7268('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x7268('0x2a')],'as':_0x7268('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x7268('0x2c')],'as':_0x7268('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x7268('0xc')](function(_0x159adb){if(_0x159adb){_0x4d820b=_0x159adb;_0x5ade09[_0x3e551d](util[_0x7268('0x1a')](_0x7268('0x1e'),_0x159adb[_0x7268('0x4')]));var _0x216f8b=[];switch(_0x159adb[_0x7268('0x6')]){case _0x7268('0x2e'):_0x5ade09[_0x3e551d](_0x7268('0x2f'));_0x5ade09[_0x3e551d](_0x7268('0x30'));if(queryQueues[_0x7268('0x31')](_0x7268('0x32'))){delete queryQueues[_0x7268('0x32')];}_0x216f8b['push'](db['VoiceQueue']['findAll'](queryQueues));_0x216f8b[_0x7268('0x33')](db[_0x7268('0x34')][_0x7268('0x14')](queryQueues));_0x216f8b[_0x7268('0x33')](db['FaxQueue']['findAll'](queryQueues));_0x216f8b[_0x7268('0x33')](db['SmsQueue'][_0x7268('0x14')](queryQueues));_0x216f8b['push'](db[_0x7268('0x35')]['findAll'](queryQueues));_0x216f8b[_0x7268('0x33')](db['OpenchannelQueue'][_0x7268('0x14')](queryQueues));_0x216f8b[_0x7268('0x33')](db['WhatsappQueue'][_0x7268('0x14')](queryQueues));_0x216f8b[_0x7268('0x33')](db[_0x7268('0x5')]['findAll'](queryTelephones));_0x216f8b[_0x7268('0x33')](db[_0x7268('0x36')][_0x7268('0x14')](queryTrunks));_0x216f8b['push'](db['Campaign'][_0x7268('0x14')](queryCampaigns));_0x216f8b['push'](db[_0x7268('0x5')][_0x7268('0x14')](queryAgents));break;case _0x7268('0x37'):_0x5ade09[_0x3e551d]('voice:inbound');_0x5ade09[_0x3e551d](_0x7268('0x30'));_0x216f8b[_0x7268('0x33')](getAssociatedResources(_0x7268('0xe'),_0x159adb['userProfileId'],_0x7268('0x38')));_0x216f8b[_0x7268('0x33')](getAssociatedResources(_0x7268('0xf'),_0x159adb['userProfileId'],_0x7268('0x34')));_0x216f8b['push'](getAssociatedResources(_0x7268('0x10'),_0x159adb[_0x7268('0x20')],_0x7268('0x39')));_0x216f8b[_0x7268('0x33')](getAssociatedResources('SmsQueues',_0x159adb[_0x7268('0x20')],_0x7268('0x3a')));_0x216f8b[_0x7268('0x33')](getAssociatedResources(_0x7268('0x11'),_0x159adb['userProfileId'],_0x7268('0x35')));_0x216f8b['push'](getAssociatedResources(_0x7268('0x12'),_0x159adb[_0x7268('0x20')],_0x7268('0x3b')));_0x216f8b[_0x7268('0x33')](getAssociatedResources(_0x7268('0x13'),_0x159adb[_0x7268('0x20')],_0x7268('0x3c')));_0x216f8b[_0x7268('0x33')](getAssociatedResources('Telephones',_0x159adb[_0x7268('0x20')],_0x7268('0x5')));_0x216f8b[_0x7268('0x33')](getAssociatedResources(_0x7268('0x3d'),_0x159adb['userProfileId'],_0x7268('0x36')));_0x216f8b[_0x7268('0x33')](getAssociatedResources(_0x7268('0x3e'),_0x159adb['userProfileId'],'Campaign'));_0x216f8b[_0x7268('0x33')](db[_0x7268('0x5')][_0x7268('0x14')](queryAgents));break;case _0x7268('0x3f'):_0x5ade09[_0x3e551d]('voice:inbound');_0x5ade09[_0x3e551d](_0x7268('0x30'));_0x216f8b[_0x7268('0x33')](_0x159adb[_0x7268('0x40')]({'attributes':['id',_0x7268('0x4')]}));_0x216f8b['push'](_0x159adb['getChatQueues']({'attributes':['id',_0x7268('0x4')]}));_0x216f8b['push'](_0x159adb[_0x7268('0x41')]({'attributes':['id',_0x7268('0x4')]}));_0x216f8b[_0x7268('0x33')](_0x159adb[_0x7268('0x42')]({'attributes':['id',_0x7268('0x4')]}));_0x216f8b[_0x7268('0x33')](_0x159adb[_0x7268('0x43')]({'attributes':['id',_0x7268('0x4')]}));_0x216f8b['push'](_0x159adb['getOpenchannelQueues']({'attributes':['id','name']}));_0x216f8b[_0x7268('0x33')](_0x159adb[_0x7268('0x44')]({'attributes':['id',_0x7268('0x4')]}));break;}return BPromise['all'](_0x216f8b);}})['then'](function(_0x518a2e){if(_0x518a2e&&_0x518a2e['length']){for(var _0x26d77d=0x0;_0x26d77d<_0x518a2e[_0x7268('0x1d')];_0x26d77d+=0x1){for(var _0x1e4a39=0x0;_0x1e4a39<_0x518a2e[_0x26d77d][_0x7268('0x1d')];_0x1e4a39+=0x1){switch(_0x26d77d){case 0x0:joinOrLeaveQueues(_0x5ade09,_0x3e551d,_0x7268('0x45'),_0x518a2e[_0x26d77d][_0x1e4a39]);break;case 0x1:joinOrLeaveQueues(_0x5ade09,_0x3e551d,'chat',_0x518a2e[_0x26d77d][_0x1e4a39]);break;case 0x2:joinOrLeaveQueues(_0x5ade09,_0x3e551d,_0x7268('0x46'),_0x518a2e[_0x26d77d][_0x1e4a39]);break;case 0x3:joinOrLeaveQueues(_0x5ade09,_0x3e551d,_0x7268('0x47'),_0x518a2e[_0x26d77d][_0x1e4a39]);break;case 0x4:joinOrLeaveQueues(_0x5ade09,_0x3e551d,_0x7268('0x48'),_0x518a2e[_0x26d77d][_0x1e4a39]);break;case 0x5:joinOrLeaveQueues(_0x5ade09,_0x3e551d,_0x7268('0x49'),_0x518a2e[_0x26d77d][_0x1e4a39]);break;case 0x6:joinOrLeaveQueues(_0x5ade09,_0x3e551d,_0x7268('0x4a'),_0x518a2e[_0x26d77d][_0x1e4a39]);break;case 0x7:if(_0x4d820b[_0x7268('0x6')]!=='agent')_0x5ade09[_0x3e551d](util[_0x7268('0x1a')](_0x7268('0x4b'),_0x518a2e[_0x26d77d][_0x1e4a39][_0x7268('0x4')]));break;case 0x8:if(_0x4d820b[_0x7268('0x6')]!=='agent')_0x5ade09[_0x3e551d](util[_0x7268('0x1a')]('trunk:%s',_0x518a2e[_0x26d77d][_0x1e4a39][_0x7268('0x4')]));break;case 0x9:if(_0x4d820b[_0x7268('0x6')]!=='agent')_0x5ade09[_0x3e551d](util[_0x7268('0x1a')](_0x7268('0x4c'),_0x518a2e[_0x26d77d][_0x1e4a39][_0x7268('0x8')],_0x518a2e[_0x26d77d][_0x1e4a39][_0x7268('0x4')]));break;case 0xa:_0x5ade09[_0x3e551d](util['format']('user:%s',_0x518a2e[_0x26d77d][_0x1e4a39][_0x7268('0x4')]));break;}}}}})[_0x7268('0xc')](function(){if(_0x3e551d==='leave'){var _0x554db5=_[_0x7268('0x18')](_0x4d820b[_0x7268('0x23')],'id');return _0x4d820b[_0x7268('0x4d')](_0x554db5)[_0x7268('0xc')](function(){for(var _0x24a8d3=0x0;_0x24a8d3<_0x554db5['length'];_0x24a8d3+=0x1){_0x3abb49[_0x7268('0x4e')](_0x7268('0x4f'),{'ChatInteractionId':Number(_0x554db5[_0x24a8d3]),'UserId':Number(_0x4d820b['id'])});}});}})[_0x7268('0xc')](function(){if(_0x3e551d==='leave'){var _0x35072f=_[_0x7268('0x18')](_0x4d820b['MailInteractions'],'id');return _0x4d820b['removeMailInteractions'](_0x35072f)[_0x7268('0xc')](function(){for(var _0x28a39f=0x0;_0x28a39f<_0x35072f[_0x7268('0x1d')];_0x28a39f+=0x1){_0x3abb49[_0x7268('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x35072f[_0x28a39f]),'UserId':Number(_0x4d820b['id'])});}});}})['then'](function(){if(_0x3e551d==='leave'){var _0x4a9905=_[_0x7268('0x18')](_0x4d820b[_0x7268('0x27')],'id');return _0x4d820b[_0x7268('0x50')](_0x4a9905)[_0x7268('0xc')](function(){for(var _0x259e2f=0x0;_0x259e2f<_0x4a9905['length'];_0x259e2f+=0x1){_0x3abb49['emit'](_0x7268('0x51'),{'FaxInteractionId':Number(_0x4a9905[_0x259e2f]),'UserId':Number(_0x4d820b['id'])});}});}})[_0x7268('0xc')](function(){if(_0x3e551d===_0x7268('0x52')){var _0xdc6a57=_[_0x7268('0x18')](_0x4d820b['SmsInteractions'],'id');return _0x4d820b[_0x7268('0x53')](_0xdc6a57)['then'](function(){for(var _0x421a32=0x0;_0x421a32<_0xdc6a57[_0x7268('0x1d')];_0x421a32+=0x1){_0x3abb49['emit'](_0x7268('0x54'),{'SmsInteractionId':Number(_0xdc6a57[_0x421a32]),'UserId':Number(_0x4d820b['id'])});}});}})[_0x7268('0xc')](function(){if(_0x3e551d==='leave'){var _0x3b0049=_[_0x7268('0x18')](_0x4d820b[_0x7268('0x2b')],'id');return _0x4d820b['removeOpenchannelInteractions'](_0x3b0049)[_0x7268('0xc')](function(){for(var _0x4d7277=0x0;_0x4d7277<_0x3b0049['length'];_0x4d7277+=0x1){_0x3abb49['emit'](_0x7268('0x55'),{'OpenchannelInteractionId':Number(_0x3b0049[_0x4d7277]),'UserId':Number(_0x4d820b['id'])});}});}})[_0x7268('0xc')](function(){if(_0x3e551d===_0x7268('0x52')){var _0x494c04=_[_0x7268('0x18')](_0x4d820b['WhatsappInteractions'],'id');return _0x4d820b[_0x7268('0x56')](_0x494c04)['then'](function(){for(var _0x50af71=0x0;_0x50af71<_0x494c04[_0x7268('0x1d')];_0x50af71+=0x1){_0x3abb49[_0x7268('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x494c04[_0x50af71]),'UserId':Number(_0x4d820b['id'])});}});}})['catch'](function(_0x2efb27){_0x5ade09[_0x7268('0x57')](_0x2efb27);});}}function onDisconnect(_0x37c95a,_0x2f24bb){joinOrLeave(_0x37c95a,_0x7268('0x52'),_0x2f24bb);}function onConnect(_0x449969){joinOrLeave(_0x449969,_0x7268('0x58'));}exports[_0x7268('0x59')]=function(_0x269002){_0x269002['on'](_0x7268('0x5a'),function(_0x120af0){_0x120af0['setMaxListeners'](0x0);_0x120af0['address']=_0x120af0['request']['connection'][_0x7268('0x5b')]+':'+_0x120af0[_0x7268('0x5c')]['connection'][_0x7268('0x5d')];_0x120af0[_0x7268('0x5e')]=new Date();_0x120af0[_0x7268('0x57')]=function(_0x4d4167){console[_0x7268('0x57')](_0x7268('0x5f')+_0x120af0[_0x7268('0x60')][_0x7268('0x4')]+'['+_0x120af0[_0x7268('0x61')]+']',_0x4d4167);};_0x120af0['on'](_0x7268('0x62'),function(){onDisconnect(_0x120af0,_0x269002);_0x120af0[_0x7268('0x57')](_0x7268('0x63'));});onConnect(_0x120af0);_0x120af0[_0x7268('0x57')](_0x7268('0x64'));});}; \ No newline at end of file +var _0x4cad=['ChatQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Trunk','VoiceQueue','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','leave','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request','connectedAt','log','SocketIO\x20','nsp','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','type','ivr','UserProfileSection','then','VoiceQueues'];(function(_0x4ff0ab,_0x1ee007){var _0xfd668c=function(_0x2c3e60){while(--_0x2c3e60){_0x4ff0ab['push'](_0x4ff0ab['shift']());}};_0xfd668c(++_0x1ee007);}(_0x4cad,0x179));var _0xd4ca=function(_0x3ffa2e,_0x3874e1){_0x3ffa2e=_0x3ffa2e-0x0;var _0x38493c=_0x4cad[_0x3ffa2e];return _0x38493c;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var BPromise=require(_0xd4ca('0x2'));var db=require(_0xd4ca('0x3'))['db'];var config=require(_0xd4ca('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xd4ca('0x5'),'model':db[_0xd4ca('0x6')],'attributes':['id',_0xd4ca('0x7'),_0xd4ca('0x8')],'raw':!![],'where':{'role':_0xd4ca('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd4ca('0x7')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xd4ca('0xa')],'where':{'type':_0xd4ca('0xb')}};function getAssociatedResources(_0x46c3bf,_0x310286,_0x2420e8){return db[_0xd4ca('0xc')]['findOne']({'where':{'name':_0x46c3bf,'userProfileId':_0x310286},'raw':!![]})[_0xd4ca('0xd')](function(_0x382bb4){if(_0x382bb4){if(_0x382bb4['autoAssociation']){switch(_0x46c3bf){case _0xd4ca('0xe'):case _0xd4ca('0xf'):case'FaxQueues':case _0xd4ca('0x10'):case'MailQueues':case _0xd4ca('0x11'):case'WhatsappQueues':return db[_0x2420e8][_0xd4ca('0x12')](queryQueues);case _0xd4ca('0x13'):return db[_0x2420e8][_0xd4ca('0x12')](queryTelephones);case _0xd4ca('0x14'):return db[_0x2420e8]['findAll'](queryTrunks);case _0xd4ca('0x15'):return db[_0x2420e8][_0xd4ca('0x12')](queryCampaigns);}}else{return db[_0xd4ca('0x16')][_0xd4ca('0x12')]({'attributes':[_0xd4ca('0x17')],'where':{'sectionId':_0x382bb4['id']},'raw':!![]})[_0xd4ca('0xd')](function(_0x43cd03){if(_0x43cd03){var _0x12a302={'where':{'id':_[_0xd4ca('0x18')](_0x43cd03,'resourceId')},'raw':!![]};switch(_0x2420e8){case _0xd4ca('0x6'):_0x12a302[_0xd4ca('0x19')][_0xd4ca('0x8')]=_0xd4ca('0x1a');break;case _0xd4ca('0x1b'):_0x12a302[_0xd4ca('0x19')][_0xd4ca('0xa')]=_0xd4ca('0xb');break;}return db[_0x2420e8][_0xd4ca('0x12')](_0x12a302);}else{return[];}});}}else{return[];}})['then'](function(_0x1151bd){return _0x1151bd;});}function joinOrLeaveQueues(_0x17e59f,_0x44c043,_0x3661db,_0x12e211){_0x17e59f[_0x44c043](util['format'](_0xd4ca('0x1c'),_0x3661db,_0x12e211[_0xd4ca('0x7')]));if(_0x12e211[_0xd4ca('0x5')]){for(var _0xbd2d6f=0x0;_0xbd2d6f<_0x12e211[_0xd4ca('0x5')][_0xd4ca('0x1d')];_0xbd2d6f+=0x1){_0x17e59f[_0x44c043](util[_0xd4ca('0x1e')](_0xd4ca('0x1f'),_0x12e211[_0xd4ca('0x5')][_0xbd2d6f][_0xd4ca('0x7')]));}}}function joinOrLeave(_0x2c705e,_0x46bfb3,_0x4300d1){var _0x4b7798;if(_0x2c705e[_0xd4ca('0x20')][_0xd4ca('0x21')]['id']){db[_0xd4ca('0x6')][_0xd4ca('0x22')]({'attributes':['id','name',_0xd4ca('0x8'),_0xd4ca('0x23')],'where':{'id':_0x2c705e[_0xd4ca('0x20')][_0xd4ca('0x21')]['id']},'include':[{'model':db[_0xd4ca('0x24')],'as':_0xd4ca('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x27')],'as':_0xd4ca('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x29')],'as':_0xd4ca('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xd4ca('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xd4ca('0xd')](function(_0x2bff12){if(_0x2bff12){_0x4b7798=_0x2bff12;_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x1f'),_0x2bff12[_0xd4ca('0x7')]));var _0x2f4483=[];switch(_0x2bff12[_0xd4ca('0x8')]){case'admin':_0x2c705e[_0x46bfb3](_0xd4ca('0x2d'));_0x2c705e[_0x46bfb3](_0xd4ca('0x2e'));if(queryQueues[_0xd4ca('0x2f')](_0xd4ca('0x30'))){delete queryQueues[_0xd4ca('0x30')];}_0x2f4483[_0xd4ca('0x31')](db['VoiceQueue']['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x32')]['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x33')]['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db['SmsQueue'][_0xd4ca('0x12')](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x34')]['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db['OpenchannelQueue']['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x35')][_0xd4ca('0x12')](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x6')][_0xd4ca('0x12')](queryTelephones));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x36')][_0xd4ca('0x12')](queryTrunks));_0x2f4483['push'](db[_0xd4ca('0x1b')][_0xd4ca('0x12')](queryCampaigns));_0x2f4483[_0xd4ca('0x31')](db['User'][_0xd4ca('0x12')](queryAgents));break;case'user':_0x2c705e[_0x46bfb3](_0xd4ca('0x2d'));_0x2c705e[_0x46bfb3](_0xd4ca('0x2e'));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0xe'),_0x2bff12['userProfileId'],_0xd4ca('0x37')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources('ChatQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x32')));_0x2f4483['push'](getAssociatedResources('FaxQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x33')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0x10'),_0x2bff12['userProfileId'],'SmsQueue'));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources('MailQueues',_0x2bff12['userProfileId'],_0xd4ca('0x34')));_0x2f4483['push'](getAssociatedResources('OpenchannelQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x38')));_0x2f4483['push'](getAssociatedResources('WhatsappQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x35')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0x13'),_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x6')));_0x2f4483['push'](getAssociatedResources(_0xd4ca('0x14'),_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x36')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0x15'),_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x1b')));_0x2f4483[_0xd4ca('0x31')](db['User'][_0xd4ca('0x12')](queryAgents));break;case _0xd4ca('0x9'):_0x2c705e[_0x46bfb3]('voice:inbound');_0x2c705e[_0x46bfb3](_0xd4ca('0x2e'));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x39')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3a')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483['push'](_0x2bff12[_0xd4ca('0x3b')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3c')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3d')]({'attributes':['id','name']}));_0x2f4483['push'](_0x2bff12[_0xd4ca('0x3e')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3f')]({'attributes':['id','name']}));break;}return BPromise[_0xd4ca('0x40')](_0x2f4483);}})[_0xd4ca('0xd')](function(_0x59d8c6){if(_0x59d8c6&&_0x59d8c6[_0xd4ca('0x1d')]){for(var _0x1472c8=0x0;_0x1472c8<_0x59d8c6[_0xd4ca('0x1d')];_0x1472c8+=0x1){for(var _0x8e57c=0x0;_0x8e57c<_0x59d8c6[_0x1472c8][_0xd4ca('0x1d')];_0x8e57c+=0x1){switch(_0x1472c8){case 0x0:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x41'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x1:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x42'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x2:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x43'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x3:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x44'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x4:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x45'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x5:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,'openchannel',_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x6:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x46'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x7:if(_0x4b7798['role']!==_0xd4ca('0x9'))_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x47'),_0x59d8c6[_0x1472c8][_0x8e57c]['name']));break;case 0x8:if(_0x4b7798[_0xd4ca('0x8')]!==_0xd4ca('0x9'))_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x48'),_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0x7')]));break;case 0x9:if(_0x4b7798[_0xd4ca('0x8')]!=='agent')_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x49'),_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0xa')],_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0x7')]));break;case 0xa:_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x1f'),_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0x7')]));break;}}}}})['then'](function(){if(_0x46bfb3==='leave'){var _0x1592be=_[_0xd4ca('0x18')](_0x4b7798['ChatInteractions'],'id');return _0x4b7798[_0xd4ca('0x4a')](_0x1592be)[_0xd4ca('0xd')](function(){for(var _0x29c63a=0x0;_0x29c63a<_0x1592be['length'];_0x29c63a+=0x1){_0x4300d1['emit'](_0xd4ca('0x4b'),{'ChatInteractionId':Number(_0x1592be[_0x29c63a]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0xd')](function(){if(_0x46bfb3==='leave'){var _0x94cbc1=_['map'](_0x4b7798['MailInteractions'],'id');return _0x4b7798[_0xd4ca('0x4c')](_0x94cbc1)[_0xd4ca('0xd')](function(){for(var _0x5f22a2=0x0;_0x5f22a2<_0x94cbc1['length'];_0x5f22a2+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x4e'),{'MailInteractionId':Number(_0x94cbc1[_0x5f22a2]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0xd')](function(){if(_0x46bfb3==='leave'){var _0x20ed9b=_[_0xd4ca('0x18')](_0x4b7798[_0xd4ca('0x28')],'id');return _0x4b7798['removeFaxInteractions'](_0x20ed9b)[_0xd4ca('0xd')](function(){for(var _0x31d1a1=0x0;_0x31d1a1<_0x20ed9b['length'];_0x31d1a1+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x4f'),{'FaxInteractionId':Number(_0x20ed9b[_0x31d1a1]),'UserId':Number(_0x4b7798['id'])});}});}})['then'](function(){if(_0x46bfb3===_0xd4ca('0x50')){var _0x4cb261=_[_0xd4ca('0x18')](_0x4b7798['SmsInteractions'],'id');return _0x4b7798[_0xd4ca('0x51')](_0x4cb261)[_0xd4ca('0xd')](function(){for(var _0x193a5a=0x0;_0x193a5a<_0x4cb261[_0xd4ca('0x1d')];_0x193a5a+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x52'),{'SmsInteractionId':Number(_0x4cb261[_0x193a5a]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0xd')](function(){if(_0x46bfb3===_0xd4ca('0x50')){var _0x1629e5=_[_0xd4ca('0x18')](_0x4b7798['OpenchannelInteractions'],'id');return _0x4b7798[_0xd4ca('0x53')](_0x1629e5)[_0xd4ca('0xd')](function(){for(var _0x2dd1bd=0x0;_0x2dd1bd<_0x1629e5['length'];_0x2dd1bd+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x54'),{'OpenchannelInteractionId':Number(_0x1629e5[_0x2dd1bd]),'UserId':Number(_0x4b7798['id'])});}});}})['then'](function(){if(_0x46bfb3===_0xd4ca('0x50')){var _0x2fc89f=_[_0xd4ca('0x18')](_0x4b7798[_0xd4ca('0x2c')],'id');return _0x4b7798[_0xd4ca('0x55')](_0x2fc89f)[_0xd4ca('0xd')](function(){for(var _0x17ca49=0x0;_0x17ca49<_0x2fc89f[_0xd4ca('0x1d')];_0x17ca49+=0x1){_0x4300d1[_0xd4ca('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2fc89f[_0x17ca49]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0x56')](function(_0x3d320f){_0x2c705e['log'](_0x3d320f);});}}function onDisconnect(_0x3a4451,_0x5a54f5){joinOrLeave(_0x3a4451,_0xd4ca('0x50'),_0x5a54f5);}function onConnect(_0x3d2f9d){joinOrLeave(_0x3d2f9d,_0xd4ca('0x57'));}exports[_0xd4ca('0x58')]=function(_0x4b37ae){_0x4b37ae['on'](_0xd4ca('0x59'),function(_0xc0bd5a){_0xc0bd5a[_0xd4ca('0x5a')](0x0);_0xc0bd5a[_0xd4ca('0x5b')]=_0xc0bd5a[_0xd4ca('0x5c')][_0xd4ca('0x59')]['remoteAddress']+':'+_0xc0bd5a[_0xd4ca('0x5c')][_0xd4ca('0x59')]['remotePort'];_0xc0bd5a[_0xd4ca('0x5d')]=new Date();_0xc0bd5a[_0xd4ca('0x5e')]=function(_0x300c1e){console[_0xd4ca('0x5e')](_0xd4ca('0x5f')+_0xc0bd5a[_0xd4ca('0x60')]['name']+'['+_0xc0bd5a[_0xd4ca('0x5b')]+']',_0x300c1e);};_0xc0bd5a['on']('disconnect',function(){onDisconnect(_0xc0bd5a,_0x4b37ae);_0xc0bd5a[_0xd4ca('0x5e')]('DISCONNECTED');});onConnect(_0xc0bd5a);_0xc0bd5a[_0xd4ca('0x5e')](_0xd4ca('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 168bb17..f628669 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 _0x4a87=['callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','afterCreate','newinteraction','ChatInteraction','closedinteraction','newmessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','EventManager','then','Trigger,\x20%s','error','code','catch','get','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','interface','name','agent','channel','incomingmessage','offlineMessage','opened','resolve','contact','format','SIP/%s','AfterCreate','changed','closed','substatus','AfterUpdate','find','fullname','email','internal','default','length','model','hook'];(function(_0x1537d4,_0x497533){var _0x143bb4=function(_0x34c646){while(--_0x34c646){_0x1537d4['push'](_0x1537d4['shift']());}};_0x143bb4(++_0x497533);}(_0x4a87,0x123));var _0x74a8=function(_0x285ecc,_0x51f97e){_0x285ecc=_0x285ecc-0x0;var _0x47c76c=_0x4a87[_0x285ecc];return _0x47c76c;};'use strict';var util=require(_0x74a8('0x0'));var db=require(_0x74a8('0x1'))['db'];var jayson=require(_0x74a8('0x2'));var logger=require(_0x74a8('0x3'))('triggers');var client=jayson[_0x74a8('0x4')][_0x74a8('0x5')]({'port':0x232a});var triggers=[{'channel':_0x74a8('0x6'),'model':'ChatInteraction','event':_0x74a8('0x7'),'condition':_0x74a8('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x74a8('0x9'),'event':'afterUpdate','condition':_0x74a8('0xa'),'callback':afterUpdate},{'channel':_0x74a8('0x6'),'model':'ChatMessage','event':_0x74a8('0x7'),'condition':_0x74a8('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':_0x74a8('0x7'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x74a8('0xc'),'model':'SmsInteraction','event':_0x74a8('0x7'),'condition':_0x74a8('0x8'),'callback':afterCreate},{'channel':'Sms','model':_0x74a8('0xd'),'event':_0x74a8('0xe'),'condition':_0x74a8('0xa'),'callback':afterUpdate},{'channel':_0x74a8('0xc'),'model':_0x74a8('0xf'),'event':_0x74a8('0x7'),'condition':_0x74a8('0xb'),'callback':afterCreateMessage},{'channel':_0x74a8('0x10'),'model':_0x74a8('0x11'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x74a8('0x10'),'model':_0x74a8('0x11'),'event':_0x74a8('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x74a8('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x74a8('0x12'),'model':_0x74a8('0x13'),'event':_0x74a8('0x7'),'condition':_0x74a8('0x8'),'callback':afterCreate},{'channel':_0x74a8('0x12'),'model':_0x74a8('0x13'),'event':_0x74a8('0xe'),'condition':_0x74a8('0xa'),'callback':afterUpdate},{'channel':_0x74a8('0x12'),'model':_0x74a8('0x14'),'event':_0x74a8('0x7'),'condition':_0x74a8('0xb'),'callback':afterCreateMessage},{'channel':_0x74a8('0x15'),'model':_0x74a8('0x16'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x74a8('0x15'),'model':_0x74a8('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x74a8('0x15'),'model':_0x74a8('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x74a8('0x18'),'event':_0x74a8('0x7'),'condition':_0x74a8('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0x74a8('0x18'),'event':_0x74a8('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x74a8('0x19'),'model':'OpenchannelMessage','event':_0x74a8('0x7'),'condition':_0x74a8('0xb'),'callback':afterCreateMessage}];function request(_0x3ad700){return client['request'](_0x74a8('0x1a'),_0x3ad700)[_0x74a8('0x1b')](function(_0x3e4164){logger['info'](_0x74a8('0x1c'),_0x74a8('0x1a'),_0x3e4164);if(_0x3e4164[_0x74a8('0x1d')]){if(_0x3e4164[_0x74a8('0x1d')][_0x74a8('0x1e')]===0x1f4){logger[_0x74a8('0x1d')](_0x74a8('0x1c'),_0x74a8('0x1a'),_0x3e4164['error']);}}})[_0x74a8('0x1f')](function(_0x4100ae){logger['error'](_0x74a8('0x1c'),'EventManager',_0x4100ae);});}function afterCreateMessage(_0x1d32e){return function(_0x3d553c){_0x3d553c=_0x3d553c[_0x74a8('0x20')]({'plain':!![]});_0x3d553c['channel']=_0x1d32e;_0x3d553c[_0x74a8('0x21')]=_0x1d32e;_0x3d553c[_0x74a8('0x22')]=_0x3d553c[_0x74a8('0x23')];Promise['resolve']()['then'](function(){if(typeof _0x3d553c[_0x74a8('0x24')]===_0x74a8('0x25'))return null;var _0x20674b=_0x74a8('0x26')+_0x3d553c[_0x74a8('0x24')];return db[_0x74a8('0x27')][_0x74a8('0x28')](_0x20674b,{'type':db[_0x74a8('0x29')][_0x74a8('0x2a')][_0x74a8('0x2b')],'raw':!![]});})['then'](function(_0x2bb8c1){if(_0x2bb8c1){_0x3d553c['contact']=_0x2bb8c1[0x0];}if(typeof _0x3d553c['UserId']===_0x74a8('0x25'))return;return getAgent(_0x3d553c[_0x74a8('0x2c')]);})[_0x74a8('0x1b')](function(_0x458f67){if(_0x458f67){_0x3d553c[_0x74a8('0x2d')]=util['format']('SIP/%s',_0x458f67[_0x74a8('0x2e')]);_0x3d553c[_0x74a8('0x2f')]=_0x458f67;_0x3d553c[_0x74a8('0x30')]=_0x1d32e;return request({'event':_0x74a8('0x31'),'message':_0x3d553c});}else{return request({'event':'outgoingmessage','message':_0x3d553c});}})[_0x74a8('0x1f')](function(_0x3cf0bd){logger[_0x74a8('0x1d')](_0x74a8('0x1c'),'AfterCreateMessage',_0x3cf0bd);});};}function afterCreateOfflineMessage(_0x18eadf){return function(_0x1023d5){_0x1023d5=_0x1023d5['get']({'plain':!![]});_0x1023d5[_0x74a8('0x30')]=_0x18eadf;_0x1023d5[_0x74a8('0x21')]=_0x18eadf;_0x1023d5['event']=_0x74a8('0x32');return request({'event':_0x1023d5[_0x74a8('0x22')],'message':_0x1023d5});};}function afterCreate(_0x291ea3,_0x2fc368){return function(_0x1371e9){_0x1371e9=_0x1371e9[_0x74a8('0x20')]({'plain':!![]});_0x1371e9['channel']=_0x291ea3;_0x1371e9['motionChannel']=_0x291ea3;_0x1371e9[_0x74a8('0x22')]=_0x74a8('0x33');Promise[_0x74a8('0x34')]()[_0x74a8('0x1b')](function(){var _0x172ca1=_0x74a8('0x26')+_0x1371e9[_0x74a8('0x24')];return db[_0x74a8('0x27')][_0x74a8('0x28')](_0x172ca1,{'type':db[_0x74a8('0x29')]['QueryTypes'][_0x74a8('0x2b')],'raw':!![]});})[_0x74a8('0x1b')](function(_0x4f91a2){if(_0x4f91a2){_0x1371e9[_0x74a8('0x35')]=_0x4f91a2[0x0];}if(typeof _0x1371e9[_0x74a8('0x2c')]===_0x74a8('0x25'))return;return getAgent(_0x1371e9['UserId']);})['then'](function(_0xf052ce){if(_0xf052ce){_0x1371e9['interface']=util[_0x74a8('0x36')](_0x74a8('0x37'),_0xf052ce['name']);_0x1371e9[_0x74a8('0x2f')]=_0xf052ce;}return request({'event':_0x2fc368,'message':_0x1371e9});})[_0x74a8('0x1f')](function(_0x46e539){logger[_0x74a8('0x1d')](_0x74a8('0x1c'),_0x74a8('0x38'),_0x46e539);});};}function afterUpdate(_0x143f12){return function(_0x410f73){var _0x382843=_0x410f73[_0x74a8('0x39')](_0x74a8('0x3a'))&&_0x410f73['closed'];var _0x1d1aeb=_0x410f73[_0x74a8('0x39')](_0x74a8('0x3b'));if(_0x382843||_0x1d1aeb){var _0x535aa4=_0x382843?_0x74a8('0xa'):_0x74a8('0x3b');var _0x45b854=_0x410f73[_0x74a8('0x20')]({'plain':!![]});_0x45b854[_0x74a8('0x30')]=_0x143f12;_0x45b854['motionChannel']=_0x143f12;_0x45b854[_0x74a8('0x22')]=_0x382843?_0x74a8('0x3a'):_0x74a8('0x3b');var _0x261a66=_0x74a8('0x26')+_0x45b854[_0x74a8('0x24')];return db[_0x74a8('0x27')][_0x74a8('0x28')](_0x261a66,{'type':db[_0x74a8('0x29')][_0x74a8('0x2a')][_0x74a8('0x2b')],'raw':!![]})[_0x74a8('0x1b')](function(_0x39b584){if(_0x39b584){_0x45b854['contact']=_0x39b584[0x0];}if(typeof _0x45b854[_0x74a8('0x2c')]===_0x74a8('0x25'))return;return getAgent(_0x45b854[_0x74a8('0x2c')]);})[_0x74a8('0x1b')](function(_0x483736){if(_0x483736){_0x45b854['interface']=util['format']('SIP/%s',_0x483736[_0x74a8('0x2e')]);_0x45b854['agent']=_0x483736;}return request({'event':_0x535aa4,'message':_0x45b854});})[_0x74a8('0x1f')](function(_0x5e689f){logger['error'](_0x74a8('0x1c'),_0x74a8('0x3c'),_0x5e689f);});}};}function getAgent(_0x217fad){return db['User'][_0x74a8('0x3d')]({'where':{'id':_0x217fad},'attributes':['id',_0x74a8('0x2e'),_0x74a8('0x3e'),_0x74a8('0x3f'),_0x74a8('0x40')],'raw':!![]})[_0x74a8('0x1b')](function(_0x6be2b5){return _0x6be2b5;});}exports[_0x74a8('0x41')]=function(){for(var _0x225e44=0x0;_0x225e44=_0x54b52f['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x230f45(_0x121a7b);})['catch'](function(_0x2e040f){_0x27be35(_0x2e040f);});});}; \ No newline at end of file +var _0x8721=['updateAttributes','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','toLowerCase','isUndefined'];(function(_0x1cee55,_0xe75188){var _0x4f640a=function(_0x550c43){while(--_0x550c43){_0x1cee55['push'](_0x1cee55['shift']());}};_0x4f640a(++_0xe75188);}(_0x8721,0x144));var _0x1872=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x8721[_0x52e363];return _0x3fc2b5;};'use strict';var _=require(_0x1872('0x0'));var BPromise=require(_0x1872('0x1'));var db=require(_0x1872('0x2'))['db'];var util=require(_0x1872('0x3'));var channels=[_0x1872('0x4'),_0x1872('0x5'),'chat',_0x1872('0x6'),_0x1872('0x7'),_0x1872('0x8'),_0x1872('0x9')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x19410c){_0x19410c=_0x19410c[_0x1872('0xa')]();return _['includes'](channels,_0x19410c);};exports['clearBlockUser']=function(_0x40aedd,_0x5c0700,_0x2b136a,_0x495b7c){var _0x45e66d={'loginAttempts':_0x5c0700,'blocked':_0x2b136a};if(!_[_0x1872('0xb')](_0x495b7c)){_0x45e66d['blockedAt']=_0x495b7c;}return _0x40aedd[_0x1872('0xc')](_0x45e66d);};exports['getLicense']=function(_0x517d4d){return new BPromise(function(_0x174ca5,_0xc6187a){var _0x4025ef=0x0;if(_0x517d4d[_0x1872('0xd')]!==_0x1872('0xe')){_0x174ca5(_0x517d4d);}db[_0x1872('0xf')][_0x1872('0x10')]({'where':{'role':_0x1872('0xe'),'online':!![],'id':{'$ne':_0x517d4d['id']}}})[_0x1872('0x11')](function(_0x289836){_0x4025ef=_0x289836;return util[_0x1872('0x12')]();})[_0x1872('0x11')](function(_0x1f1015){if(_0x1f1015&&_0x1f1015[_0x1872('0x13')]&&_0x4025ef>=_0x1f1015[_0x1872('0x13')]){throw Error(_0x1872('0x14'));}_0x174ca5(_0x517d4d);})['catch'](function(_0x3aa60d){_0xc6187a(_0x3aa60d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index afb9ca0..8447568 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd34d=['Conflict','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Forbidden','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0xd34d,0x11b));var _0xdd34=function(_0x124e75,_0x4287aa){_0x124e75=_0x124e75-0x0;var _0x2b769d=_0xd34d[_0x124e75];return _0x2b769d;};'use strict';var util=require(_0xdd34('0x0'));var logger=require(_0xdd34('0x1'))(_0xdd34('0x2'));var APIError=function(_0x144647,_0x4c3abd){this[_0xdd34('0x3')]=_0x144647||'Internal\x20Server\x20Error';this[_0xdd34('0x4')]=_0x4c3abd||_0xdd34('0x5');util[_0xdd34('0x6')](APIError,Error);};var APIBadRequestError=function(_0x2afe76){this[_0xdd34('0x3')]=_0x2afe76||_0xdd34('0x7');this['name']=_0xdd34('0x7');util[_0xdd34('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x461340){this['message']=_0x461340||_0xdd34('0x8');this[_0xdd34('0x4')]=_0xdd34('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x53d19a){this[_0xdd34('0x3')]=_0x53d19a||'Entity\x20not\x20found';this[_0xdd34('0x4')]=_0xdd34('0x9');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x31a81c){this['message']=_0x31a81c||_0xdd34('0xa');this['name']=_0xdd34('0xb');this[_0xdd34('0xc')]=0x193;this[_0xdd34('0xd')]={'type':_0xdd34('0xe')};util[_0xdd34('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x59762c){this[_0xdd34('0x3')]=_0x59762c||_0xdd34('0xf');this[_0xdd34('0x4')]=_0xdd34('0x10');util[_0xdd34('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x391558){switch(_0x391558){case _0xdd34('0x7'):return 0x190;case _0xdd34('0x8'),_0xdd34('0xb'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0xa0c4f0){if(_0xa0c4f0===_0xdd34('0xb'))return _0xa0c4f0;return null;}function handleError(_0x2dba20){return function(_0x3b4649){logger[_0xdd34('0x11')](_0x3b4649[_0xdd34('0x12')]);var _0x8d9ad6=getStatusCode(_0x3b4649[_0xdd34('0x4')]);var _0x11e31f=getCustomStatusMessage(_0x3b4649[_0xdd34('0x4')]);if(_0x3b4649[_0xdd34('0x4')]){delete _0x3b4649[_0xdd34('0x4')];}if(_0x11e31f){_0x2dba20[_0xdd34('0x13')]=_0x11e31f;}return _0x2dba20[_0xdd34('0x14')](_0x8d9ad6)[_0xdd34('0x15')](_0x3b4649);};}module[_0xdd34('0x16')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x932f=['Not\x20Found','Out\x20Of\x20Interval','stack','statusMessage','send','exports','../config/logger','api','name','inherits','message','Bad\x20Request','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','OutOfInterval','Resource\x20Conflict','Conflict'];(function(_0x41d9e7,_0x33ef4a){var _0x282c36=function(_0x2bb2a5){while(--_0x2bb2a5){_0x41d9e7['push'](_0x41d9e7['shift']());}};_0x282c36(++_0x33ef4a);}(_0x932f,0x195));var _0xf932=function(_0xd5b875,_0x2336b8){_0xd5b875=_0xd5b875-0x0;var _0x3f8e4b=_0x932f[_0xd5b875];return _0x3f8e4b;};'use strict';var util=require('util');var logger=require(_0xf932('0x0'))(_0xf932('0x1'));var APIError=function(_0x271ed7,_0x309d18){this['message']=_0x271ed7||'Internal\x20Server\x20Error';this[_0xf932('0x2')]=_0x309d18||'Error';util[_0xf932('0x3')](APIError,Error);};var APIBadRequestError=function(_0xc75843){this[_0xf932('0x4')]=_0xc75843||'Bad\x20Request';this[_0xf932('0x2')]=_0xf932('0x5');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x1641de){this['message']=_0x1641de||_0xf932('0x6');this[_0xf932('0x2')]=_0xf932('0x6');util[_0xf932('0x3')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x530921){this[_0xf932('0x4')]=_0x530921||_0xf932('0x7');this[_0xf932('0x2')]='Not\x20Found';util[_0xf932('0x3')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4e3e62){this[_0xf932('0x4')]=_0x4e3e62||_0xf932('0x8');this[_0xf932('0x2')]='Out\x20Of\x20Interval';this[_0xf932('0x9')]=0x193;this['details']={'type':_0xf932('0xa')};util[_0xf932('0x3')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3075aa){this[_0xf932('0x4')]=_0x3075aa||_0xf932('0xb');this['name']=_0xf932('0xc');util[_0xf932('0x3')](APIBadRequestError,APIError);};function getStatusCode(_0x274462){switch(_0x274462){case _0xf932('0x5'):return 0x190;case _0xf932('0x6'),'Out\x20Of\x20Interval':return 0x193;case _0xf932('0xd'):return 0x194;case _0xf932('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x5915e0){if(_0x5915e0===_0xf932('0xe'))return _0x5915e0;return null;}function handleError(_0x15d584){return function(_0x3bebe2){logger['error'](_0x3bebe2[_0xf932('0xf')]);var _0x28d880=getStatusCode(_0x3bebe2[_0xf932('0x2')]);var _0x21b6f7=getCustomStatusMessage(_0x3bebe2['name']);if(_0x3bebe2['name']){delete _0x3bebe2['name'];}if(_0x21b6f7){_0x15d584[_0xf932('0x10')]=_0x21b6f7;}return _0x15d584['status'](_0x28d880)[_0xf932('0x11')](_0x3bebe2);};}module[_0xf932('0x12')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 27c3e98..998358b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2516=['json','send','exports','render','status'];(function(_0x8ba624,_0x42e30e){var _0x43940f=function(_0x1f64af){while(--_0x1f64af){_0x8ba624['push'](_0x8ba624['shift']());}};_0x43940f(++_0x42e30e);}(_0x2516,0x16f));var _0x6251=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x2516[_0x3ce3c];return _0x55a2c9;};'use strict';module[_0x6251('0x0')][0x194]=function pageNotFound(_0x198831,_0x2870f9){var _0x1c120e='404';var _0x4e2f92=0x194;var _0x3e24e8={'status':_0x4e2f92};_0x2870f9['status'](_0x3e24e8['status']);_0x2870f9[_0x6251('0x1')](_0x1c120e,{},function(_0xb6b117,_0x113bda){if(_0xb6b117){return _0x2870f9[_0x6251('0x2')](_0x3e24e8[_0x6251('0x2')])[_0x6251('0x3')](_0x3e24e8);}_0x2870f9[_0x6251('0x4')](_0x113bda);});}; \ No newline at end of file +var _0x3bf3=['404','status','render','json'];(function(_0xefbde8,_0x41d53f){var _0x2e3154=function(_0x7ec068){while(--_0x7ec068){_0xefbde8['push'](_0xefbde8['shift']());}};_0x2e3154(++_0x41d53f);}(_0x3bf3,0x168));var _0x33bf=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x3bf3[_0x3430aa];return _0x2ac5c;};'use strict';module['exports'][0x194]=function pageNotFound(_0x885945,_0x3d881f){var _0x3c2cae=_0x33bf('0x0');var _0x279da7=0x194;var _0x2702f7={'status':_0x279da7};_0x3d881f[_0x33bf('0x1')](_0x2702f7[_0x33bf('0x1')]);_0x3d881f[_0x33bf('0x2')](_0x3c2cae,{},function(_0x59fe4e,_0x399518){if(_0x59fe4e){return _0x3d881f['status'](_0x2702f7[_0x33bf('0x1')])[_0x33bf('0x3')](_0x2702f7);}_0x3d881f['send'](_0x399518);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5d374a4..7372155 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72c9=['MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','Pause','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','Contacts','Phones','CmContactId','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ContactItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerId','Fields','AnalyticFieldReport','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','Subject','Field','FieldId','SugarcrmConfiguration','Configurations','Description','VariableId','DeskAccount','DescriptionId','int_desk_configuration_has_tags','ZohoAccount','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','ServicenowConfiguration','Dynamics365Configuration','FromId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','cm_user_has_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xC@LL1234','utf8mb4','utf8_general_ci','127.0.0.1','name','utf8','database','password','sequelizeHistory','username','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/pause/pause.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','FaxTransferReport','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','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','HopperFinals','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','CmContact','cm_user_has_contacts','Lists','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts'];(function(_0x588e69,_0x5d393b){var _0x3e5ab7=function(_0x300647){while(--_0x300647){_0x588e69['push'](_0x588e69['shift']());}};_0x3e5ab7(++_0x5d393b);}(_0x72c9,0xcc));var _0x972c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x72c9[_0x14add3];return _0x4a174f;};'use strict';var config=require(_0x972c('0x0'));var Sequelize=require(_0x972c('0x1'));var _=require('lodash');var jstz=require(_0x972c('0x2'));var timezone=jstz[_0x972c('0x3')]();config['sequelize']=_[_0x972c('0x4')](config[_0x972c('0x1')],{'database':_0x972c('0x5'),'username':'xcall','password':_0x972c('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x972c('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x972c('0x8')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0x972c('0x6'),'options':{'host':_0x972c('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x972c('0xa')](),'define':{'charset':_0x972c('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x972c('0xc')],config['sequelize']['username'],config[_0x972c('0x1')][_0x972c('0xd')],config[_0x972c('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x972c('0xe')][_0x972c('0xc')],config['sequelizeHistory'][_0x972c('0xf')],config[_0x972c('0xe')][_0x972c('0xd')],config[_0x972c('0xe')][_0x972c('0x10')])};db[_0x972c('0x11')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x13'));db['VoiceChanSpy']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x14'));db[_0x972c('0x15')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x16'));db[_0x972c('0x17')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x18'));db[_0x972c('0x19')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x1a'));db[_0x972c('0x1b')]=db['sequelize']['import'](_0x972c('0x1c'));db[_0x972c('0x1d')]=db['sequelize']['import'](_0x972c('0x1e'));db[_0x972c('0x1f')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x20'));db[_0x972c('0x21')]=db[_0x972c('0x1')]['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x972c('0x22')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x23'));db[_0x972c('0x24')]=db['sequelize'][_0x972c('0x12')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x25'));db[_0x972c('0x26')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x27'));db[_0x972c('0x28')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x29'));db['Trunk']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/trunk/trunk.model');db[_0x972c('0x2a')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x2b'));db[_0x972c('0x2c')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x2d'));db[_0x972c('0x2e')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x2f'));db[_0x972c('0x30')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x31'));db[_0x972c('0x32')]=db[_0x972c('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x972c('0x33')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x34'));db[_0x972c('0x35')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x36'));db[_0x972c('0x37')]=db['sequelize'][_0x972c('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x972c('0x38')]=db[_0x972c('0x1')]['import'](_0x972c('0x39'));db[_0x972c('0x3a')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x3b'));db[_0x972c('0x3c')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x3d'));db[_0x972c('0x3e')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x3f'));db[_0x972c('0x40')]=db[_0x972c('0x1')]['import'](_0x972c('0x41'));db[_0x972c('0x42')]=db[_0x972c('0x1')]['import'](_0x972c('0x43'));db[_0x972c('0x44')]=db[_0x972c('0x1')]['import'](_0x972c('0x45'));db[_0x972c('0x46')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x47'));db['MailQueueReport']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x48'));db[_0x972c('0x49')]=db['sequelize']['import']('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x972c('0x4a')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x4b'));db[_0x972c('0x4c')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x4d'));db['FaxInteraction']=db['sequelize']['import'](_0x972c('0x4e'));db[_0x972c('0x4f')]=db[_0x972c('0x1')]['import'](_0x972c('0x50'));db[_0x972c('0x51')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x52'));db['FaxQueueReport']=db[_0x972c('0x1')]['import'](_0x972c('0x53'));db['SmsAccount']=db['sequelize'][_0x972c('0x12')](_0x972c('0x54'));db[_0x972c('0x55')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x56'));db[_0x972c('0x57')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x58'));db['SmsMessage']=db['sequelize'][_0x972c('0x12')](_0x972c('0x59'));db[_0x972c('0x5a')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x5b'));db[_0x972c('0x5c')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x5d'));db[_0x972c('0x5e')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x5f'));db[_0x972c('0x60')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x61'));db[_0x972c('0x62')]=db[_0x972c('0x1')]['import'](_0x972c('0x63'));db[_0x972c('0x64')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x65'));db[_0x972c('0x66')]=db[_0x972c('0x1')]['import'](_0x972c('0x67'));db[_0x972c('0x68')]=db[_0x972c('0x1')]['import'](_0x972c('0x69'));db[_0x972c('0x6a')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/chatApplication/chatApplication.model');db[_0x972c('0x6b')]=db['sequelize']['import']('../api/chatInteraction/chatInteraction.model');db[_0x972c('0x6c')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/chatMessage/chatMessage.model');db[_0x972c('0x6d')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x6e'));db[_0x972c('0x6f')]=db[_0x972c('0x1')]['import'](_0x972c('0x70'));db['ChatGroup']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x71'));db[_0x972c('0x72')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/cmContact/cmContact.model');db[_0x972c('0x73')]=db[_0x972c('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x972c('0x74')]=db[_0x972c('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x972c('0x75')]=db[_0x972c('0x1')]['import'](_0x972c('0x76'));db[_0x972c('0x77')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x78'));db['ReportAgentPreview']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x79'));db[_0x972c('0x7a')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x7b'));db[_0x972c('0x7c')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x7d'));db[_0x972c('0x7e')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x7f'));db[_0x972c('0x80')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x972c('0x81')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x82'));db['Condition']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x83'));db[_0x972c('0x84')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/interval/interval.model');db['Pause']=db['sequelize'][_0x972c('0x12')](_0x972c('0x85'));db['Cdr']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x86'));db[_0x972c('0x87')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/schedule/schedule.model');db[_0x972c('0x88')]=db[_0x972c('0x1')]['import'](_0x972c('0x89'));db[_0x972c('0x8a')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x8b'));db['ContactItemType']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x8c'));db[_0x972c('0x8d')]=db[_0x972c('0x1')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0x972c('0x8e')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x8f'));db['Template']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/template/template.model');db[_0x972c('0x90')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x91'));db[_0x972c('0x92')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x93'));db[_0x972c('0x94')]=db['sequelize'][_0x972c('0x12')](_0x972c('0x95'));db[_0x972c('0x96')]=db[_0x972c('0x1')]['import'](_0x972c('0x97'));db[_0x972c('0x98')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x99'));db[_0x972c('0x9a')]=db['sequelize']['import'](_0x972c('0x9b'));db[_0x972c('0x9c')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x972c('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x972c('0x9d')]=db[_0x972c('0x1')]['import'](_0x972c('0x9e'));db[_0x972c('0x9f')]=db[_0x972c('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x972c('0xa0')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xa1'));db[_0x972c('0xa2')]=db['sequelize'][_0x972c('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x972c('0xa3')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xa4'));db['SugarcrmConfiguration']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xa5'));db[_0x972c('0xa6')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xa7'));db['DeskAccount']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x972c('0xa8')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xa9'));db[_0x972c('0xaa')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xab'));db['ZohoAccount']=db['sequelize']['import'](_0x972c('0xac'));db[_0x972c('0xad')]=db[_0x972c('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x972c('0xae')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/intZohoField/intZohoField.model');db[_0x972c('0xaf')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xb0'));db[_0x972c('0xb1')]=db[_0x972c('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x972c('0xb2')]=db[_0x972c('0x1')]['import'](_0x972c('0xb3'));db[_0x972c('0xb4')]=db[_0x972c('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x972c('0xb5')]=db['sequelize'][_0x972c('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x972c('0xb6')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xb7'));db[_0x972c('0xb8')]=db[_0x972c('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x972c('0xb9')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xba'));db['ServicenowAccount']=db[_0x972c('0x1')]['import'](_0x972c('0xbb'));db['ServicenowConfiguration']=db['sequelize'][_0x972c('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x972c('0xbc')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xbd'));db[_0x972c('0xbe')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xbf'));db['Dynamics365Configuration']=db[_0x972c('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x972c('0xc0')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xc1'));db[_0x972c('0xc2')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xc3'));db[_0x972c('0xc4')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x972c('0xc5')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xc6'));db[_0x972c('0x94')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x972c('0xc7')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/network/network.model');db[_0x972c('0xc8')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xc9'));db['ChatInternalMessage']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xca'));db['JscriptyAnswerReport']=db[_0x972c('0x1')]['import'](_0x972c('0xcb'));db['JscriptyQuestionReport']=db['sequelize'][_0x972c('0x12')](_0x972c('0xcc'));db[_0x972c('0xcd')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xce'));db[_0x972c('0xcf')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x972c('0xd0')]=db[_0x972c('0x1')]['import'](_0x972c('0xd1'));db['SquareDetailsReport']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xd2'));db[_0x972c('0xd3')]=db['sequelize'][_0x972c('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0x972c('0xd4')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xd5'));db[_0x972c('0xd6')]=db[_0x972c('0x1')]['import'](_0x972c('0xd7'));db[_0x972c('0xd8')]=db[_0x972c('0x1')]['import'](_0x972c('0xd9'));db['SquareRecording']=db['sequelize']['import'](_0x972c('0xda'));db['SquareMessage']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/squareMessage/squareMessage.model');db[_0x972c('0xdb')]=db[_0x972c('0x1')]['import'](_0x972c('0xdc'));db['License']=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xdd'));db[_0x972c('0xde')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xdf'));db[_0x972c('0xe0')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/migration/migration.model');db[_0x972c('0xe1')]=db[_0x972c('0x1')]['import'](_0x972c('0xe2'));db[_0x972c('0xe3')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xe4'));db['MailTransferReport']=db[_0x972c('0x1')][_0x972c('0x12')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x972c('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x972c('0xe5')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/faxTransferReport/faxTransferReport.model');db[_0x972c('0xe6')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xe7'));db[_0x972c('0xe8')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xe9'));db[_0x972c('0xea')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xeb'));db[_0x972c('0xec')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xed'));db[_0x972c('0xee')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xef'));db[_0x972c('0xf0')]=db[_0x972c('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x972c('0xf1')]=db[_0x972c('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x972c('0xf2')]=db[_0x972c('0x1')]['import'](_0x972c('0xf3'));db[_0x972c('0xf4')]=db['sequelize']['import'](_0x972c('0xf5'));db[_0x972c('0xf6')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xf7'));db[_0x972c('0xf8')]=db['sequelize'][_0x972c('0x12')](_0x972c('0xf9'));db['WhatsappMessage']=db['sequelize'][_0x972c('0x12')](_0x972c('0xfa'));db[_0x972c('0xfb')]=db['sequelize']['import'](_0x972c('0xfc'));db[_0x972c('0xfd')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0xfe'));db[_0x972c('0xff')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x100'));db[_0x972c('0x101')]=db[_0x972c('0x1')]['import'](_0x972c('0x102'));db[_0x972c('0x103')]=db[_0x972c('0x1')][_0x972c('0x12')](_0x972c('0x104'));db['TeamVoicePrefix']=db['sequelize'][_0x972c('0x12')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x972c('0x105')]=db[_0x972c('0x1')][_0x972c('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x972c('0x106')]=db[_0x972c('0x1')]['import'](_0x972c('0x107'));db[_0x972c('0x108')]=db[_0x972c('0x1')]['import'](_0x972c('0x109'));db[_0x972c('0x11')][_0x972c('0x10a')](db[_0x972c('0x21')],{'as':_0x972c('0x21'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x10c')});db['User'][_0x972c('0x10a')](db[_0x972c('0x106')],{'as':_0x972c('0x10d'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')][_0x972c('0x10e')](db['VoiceRecording'],{'as':_0x972c('0x10f'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')][_0x972c('0x10e')](db[_0x972c('0x2c')],{'as':_0x972c('0x110'),'foreignKey':_0x972c('0x10c')});db['User'][_0x972c('0x10e')](db[_0x972c('0x17')],{'as':'Extensions','onDelete':_0x972c('0x10b'),'hooks':!![]});db[_0x972c('0x11')]['hasMany'](db[_0x972c('0x75')],{'as':_0x972c('0x111'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')][_0x972c('0x10e')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')][_0x972c('0x10e')](db[_0x972c('0x112')],{'as':_0x972c('0x112'),'foreignKey':'UserId'});db[_0x972c('0x11')][_0x972c('0x10e')](db[_0x972c('0x60')],{'as':_0x972c('0x113'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')][_0x972c('0x10e')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')]['hasMany'](db[_0x972c('0x57')],{'as':_0x972c('0x114'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')]['hasMany'](db[_0x972c('0x115')],{'as':_0x972c('0x116'),'foreignKey':_0x972c('0x10c')});db['User'][_0x972c('0x10e')](db['MailInteraction'],{'as':_0x972c('0x117'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x11')][_0x972c('0x10e')](db[_0x972c('0xf8')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db['User'][_0x972c('0x10e')](db[_0x972c('0xf2')],{'as':_0x972c('0x118'),'foreignKey':'SenderId'});db[_0x972c('0x11')]['hasMany'](db[_0x972c('0x73')],{'as':_0x972c('0x119'),'foreignKey':'UserId','onDelete':_0x972c('0x11a')});db[_0x972c('0x11')][_0x972c('0x11b')](db[_0x972c('0xee')],{'as':_0x972c('0xee'),'foreignKey':'userProfileId'});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x11d')],{'as':_0x972c('0x11e'),'through':_0x972c('0x11f')});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x120')],{'as':'Contacts','through':_0x972c('0x121')});db[_0x972c('0x11')]['belongsToMany'](db['CmList'],{'as':_0x972c('0x122'),'through':'cm_user_has_lists'});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0xdb')],{'through':'user_has_teams'});db[_0x972c('0x11')][_0x972c('0x11c')](db['MailInteraction'],{'as':_0x972c('0x117'),'through':_0x972c('0x123')});db[_0x972c('0x11')][_0x972c('0x11c')](db['ChatInteraction'],{'as':_0x972c('0x124'),'through':_0x972c('0x125')});db['User']['belongsToMany'](db[_0x972c('0x115')],{'as':_0x972c('0x116'),'through':_0x972c('0x126')});db['User'][_0x972c('0x11c')](db[_0x972c('0x57')],{'as':_0x972c('0x114'),'through':'user_has_sms_interactions'});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x60')],{'as':'OpenchannelInteractions','through':_0x972c('0x127')});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0xf8')],{'as':_0x972c('0x128'),'through':_0x972c('0x129')});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x1b')],{'as':_0x972c('0x12a'),'through':_0x972c('0x2e'),'required':![]});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0xec')],{'as':_0x972c('0x12b'),'through':_0x972c('0x105'),'required':![]});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x3e')],{'as':_0x972c('0x12c'),'through':'UserMailQueue','required':![]});db[_0x972c('0x11')]['belongsToMany'](db['ChatQueue'],{'as':_0x972c('0x12d'),'through':_0x972c('0x30'),'required':![],'hooks':!![]});db[_0x972c('0x11')]['belongsToMany'](db[_0x972c('0x51')],{'as':'FaxQueues','through':_0x972c('0x33'),'required':![]});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x5a')],{'as':_0x972c('0x12e'),'through':_0x972c('0x35'),'required':![]});db[_0x972c('0x11')]['belongsToMany'](db[_0x972c('0x64')],{'as':_0x972c('0x12f'),'through':_0x972c('0x37'),'required':![]});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0xff')],{'as':_0x972c('0x130'),'through':_0x972c('0x38'),'required':![]});db[_0x972c('0x11')][_0x972c('0x11c')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x972c('0x11')]['belongsToMany'](db[_0x972c('0x66')],{'as':_0x972c('0x131'),'through':_0x972c('0x132')});db['User'][_0x972c('0x11c')](db[_0x972c('0x4a')],{'as':_0x972c('0x133'),'through':_0x972c('0x134')});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x3c')],{'as':_0x972c('0x135'),'through':_0x972c('0x136')});db[_0x972c('0x11')][_0x972c('0x11c')](db[_0x972c('0x5c')],{'as':_0x972c('0x137'),'through':'user_has_openchannel_accounts'});db['User'][_0x972c('0x11c')](db[_0x972c('0x138')],{'as':_0x972c('0x139'),'through':_0x972c('0x13a')});db[_0x972c('0x11')][_0x972c('0x11c')](db['WhatsappAccount'],{'as':_0x972c('0x13b'),'through':_0x972c('0x13c')});db[_0x972c('0x13d')][_0x972c('0x10e')](db[_0x972c('0x17')],{'as':_0x972c('0x13e'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x13f')});db['VoiceContext']['hasMany'](db[_0x972c('0x17')],{'onDelete':'cascade'});db[_0x972c('0x17')]['hasMany'](db['VoiceExtension'],{'as':_0x972c('0x140'),'onDelete':_0x972c('0x10b')});db['VoiceMusicOnHold'][_0x972c('0x11c')](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db[_0x972c('0x1b')]['hasMany'](db[_0x972c('0x2c')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x972c('0x1b')][_0x972c('0x10e')](db[_0x972c('0x73')],{'as':_0x972c('0x119'),'foreignKey':_0x972c('0x141')});db[_0x972c('0x1b')][_0x972c('0x10e')](db[_0x972c('0x75')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x972c('0x1b')]['hasMany'](db[_0x972c('0x77')],{'as':_0x972c('0x142'),'foreignKey':'VoiceQueueId'});db[_0x972c('0x1b')][_0x972c('0x10e')](db[_0x972c('0x112')],{'as':'ReportAgentPreview','foreignKey':_0x972c('0x141')});db['VoiceQueue'][_0x972c('0x10e')](db[_0x972c('0x74')],{'as':_0x972c('0x143'),'foreignKey':_0x972c('0x141')});db[_0x972c('0x1b')]['hasMany'](db[_0x972c('0xcd')],{'as':_0x972c('0x144'),'foreignKey':_0x972c('0x141')});db[_0x972c('0x1b')]['belongsTo'](db[_0x972c('0x145')],{'as':_0x972c('0x145'),'foreignKey':_0x972c('0x146')});db['VoiceQueue'][_0x972c('0x11b')](db[_0x972c('0x145')],{'as':_0x972c('0x147'),'foreignKey':_0x972c('0x148')});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x972c('0x1b')]['belongsTo'](db['Pause'],{'as':_0x972c('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x972c('0x1b')][_0x972c('0x11c')](db[_0x972c('0xea')],{'as':'Lists','through':_0x972c('0x14a')});db[_0x972c('0x1b')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':'Agents','through':_0x972c('0x2e')});db['VoiceQueue']['belongsToMany'](db[_0x972c('0xdb')],{'as':_0x972c('0x14b'),'through':_0x972c('0x103')});db[_0x972c('0x1b')][_0x972c('0x11c')](db[_0x972c('0xea')],{'as':_0x972c('0x14c'),'through':_0x972c('0x14d')});db[_0x972c('0x1d')][_0x972c('0x11b')](db[_0x972c('0x11')],{'as':_0x972c('0x11'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x1f')][_0x972c('0x11b')](db[_0x972c('0x11')],{'as':'User','foreignKey':_0x972c('0x10c')});db['VoiceMail'][_0x972c('0x10e')](db[_0x972c('0x14e')],{'as':_0x972c('0x14f'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x150'),'sourceKey':_0x972c('0x151')});db[_0x972c('0x14e')][_0x972c('0x11b')](db[_0x972c('0x21')],{'foreignKey':_0x972c('0x150'),'targetKey':_0x972c('0x151')});db[_0x972c('0x22')]['hasMany'](db[_0x972c('0x26')],{'as':_0x972c('0x152'),'foreignKey':_0x972c('0x153'),'constraints':![]});db['VoiceCallReport'][_0x972c('0x10e')](db[_0x972c('0x154')],{'as':_0x972c('0x155'),'foreignKey':_0x972c('0x153'),'constraints':![]});db[_0x972c('0x22')][_0x972c('0x11b')](db[_0x972c('0x11')],{'as':_0x972c('0x11'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x22')][_0x972c('0x11b')](db[_0x972c('0x120')],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db['MailServerIn']['belongsTo'](db[_0x972c('0x3c')],{'as':'MailAccount','foreignKey':_0x972c('0x158')});db[_0x972c('0x3a')][_0x972c('0x11b')](db[_0x972c('0x101')],{'as':_0x972c('0x101'),'foreignKey':_0x972c('0x159'),'onDelete':_0x972c('0x15a')});db[_0x972c('0x15b')][_0x972c('0x11b')](db[_0x972c('0x3c')],{'as':_0x972c('0x3c'),'foreignKey':_0x972c('0x158')});db[_0x972c('0x15b')][_0x972c('0x11b')](db[_0x972c('0x101')],{'as':_0x972c('0x101'),'foreignKey':'CloudProviderId','onDelete':_0x972c('0x15a')});db[_0x972c('0x3c')][_0x972c('0x10a')](db[_0x972c('0x3a')],{'as':'Imap','onDelete':_0x972c('0x10b')});db[_0x972c('0x3c')]['hasOne'](db[_0x972c('0x15b')],{'as':_0x972c('0x15c'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x3c')]['hasMany'](db['Disposition'],{'as':_0x972c('0x15d'),'foreignKey':_0x972c('0x158'),'onDelete':_0x972c('0x10b')});db['MailAccount'][_0x972c('0x10e')](db[_0x972c('0x80')],{'as':_0x972c('0x15e'),'foreignKey':_0x972c('0x158')});db[_0x972c('0x3c')]['hasMany'](db['MailMessage'],{'as':_0x972c('0x14f'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x972c('0x42')],{'as':_0x972c('0x15f')});db['MailAccount'][_0x972c('0x10e')](db[_0x972c('0x46')],{'as':_0x972c('0x140'),'foreignKey':_0x972c('0x158'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x3c')][_0x972c('0x11b')](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161')});db['MailAccount'][_0x972c('0x11b')](db['Template'],{'as':_0x972c('0x162'),'foreignKey':_0x972c('0x163')});db[_0x972c('0x3c')][_0x972c('0x11b')](db[_0x972c('0x164')],{'as':_0x972c('0x149'),'foreignKey':_0x972c('0x165')});db[_0x972c('0x3c')]['belongsToMany'](db['User'],{'as':_0x972c('0x166'),'through':'user_has_mail_accounts'});db[_0x972c('0x3e')][_0x972c('0x11c')](db['User'],{'as':'Agents','through':_0x972c('0x32')});db[_0x972c('0x3e')][_0x972c('0x11c')](db[_0x972c('0xdb')],{'through':_0x972c('0x167'),'as':_0x972c('0x14b')});db[_0x972c('0x42')]['hasMany'](db[_0x972c('0x44')],{'as':_0x972c('0x14f'),'onDelete':_0x972c('0x10b'),'foreignKey':'MailInteractionId'});db[_0x972c('0x42')][_0x972c('0x11b')](db[_0x972c('0x3c')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x158')});db['MailInteraction'][_0x972c('0x11b')](db[_0x972c('0x120')],{'as':'Contact','foreignKey':_0x972c('0x157')});db['MailInteraction'][_0x972c('0x11b')](db['User'],{'as':_0x972c('0x169'),'foreignKey':'UserId'});db['MailInteraction'][_0x972c('0x11c')](db['Tag'],{'through':_0x972c('0x16a'),'as':_0x972c('0x16b')});db[_0x972c('0x42')][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':_0x972c('0x16a'),'as':'ThroughTags'});db[_0x972c('0x42')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x16c'),'through':_0x972c('0x123'),'foreignKey':_0x972c('0x16d')});db['MailMessage'][_0x972c('0x10e')](db[_0x972c('0xe1')],{'as':_0x972c('0x16e'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x44')][_0x972c('0x11b')](db[_0x972c('0x11')],{'as':'User'});db[_0x972c('0x44')]['belongsTo'](db[_0x972c('0x120')],{'onDelete':'cascade','as':_0x972c('0x156')});db[_0x972c('0x44')][_0x972c('0x11b')](db[_0x972c('0x42')],{'as':_0x972c('0x16f'),'foreignKey':_0x972c('0x16d')});db['MailMessage'][_0x972c('0x11b')](db[_0x972c('0x3c')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x158')});db[_0x972c('0x44')][_0x972c('0x11b')](db[_0x972c('0x66')],{'as':_0x972c('0x66'),'foreignKey':_0x972c('0x170')});db['MailMessage'][_0x972c('0x11b')](db[_0x972c('0x6d')],{'as':_0x972c('0x6d'),'foreignKey':_0x972c('0x171')});db['MailApplication'][_0x972c('0x11b')](db[_0x972c('0x11')],{'onDelete':_0x972c('0x15a')});db[_0x972c('0x46')]['belongsTo'](db['MailQueue'],{'onDelete':_0x972c('0x15a')});db[_0x972c('0x46')]['belongsTo'](db[_0x972c('0x3c')],{'onDelete':_0x972c('0x15a')});db[_0x972c('0x46')][_0x972c('0x11b')](db[_0x972c('0x84')],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x172')});db['MailApplication'][_0x972c('0x11b')](db['Tag'],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x173')});db['MailQueueReport'][_0x972c('0x11b')](db['MailAccount'],{});db['MailQueueReport'][_0x972c('0x11b')](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161')});db[_0x972c('0x174')][_0x972c('0x11b')](db[_0x972c('0x120')],{'as':_0x972c('0x156'),'foreignKey':'ContactId'});db[_0x972c('0x174')][_0x972c('0x11b')](db[_0x972c('0x42')],{});db[_0x972c('0x174')][_0x972c('0x11b')](db['MailMessage'],{});db['MailQueueReport']['belongsTo'](db['User'],{});db['MailQueueReport']['belongsTo'](db[_0x972c('0x3e')],{});db[_0x972c('0x49')][_0x972c('0x10e')](db[_0x972c('0x175')],{'as':_0x972c('0x176'),'onDelete':'cascade'});db[_0x972c('0x4a')][_0x972c('0x10e')](db[_0x972c('0x81')],{'as':_0x972c('0x15d'),'foreignKey':_0x972c('0x177'),'onDelete':'cascade'});db[_0x972c('0x4a')][_0x972c('0x10e')](db[_0x972c('0x80')],{'as':_0x972c('0x15e'),'foreignKey':_0x972c('0x177')});db[_0x972c('0x4a')][_0x972c('0x10e')](db[_0x972c('0x115')],{'as':'Interactions'});db['FaxAccount']['hasMany'](db[_0x972c('0x4c')],{'as':'Applications','foreignKey':_0x972c('0x177'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x4a')][_0x972c('0x10e')](db[_0x972c('0x17')],{'as':_0x972c('0x178'),'onDelete':'cascade'});db[_0x972c('0x4a')][_0x972c('0x10e')](db['FaxMessage'],{'as':_0x972c('0x14f')});db[_0x972c('0x4a')][_0x972c('0x11b')](db[_0x972c('0x145')],{'as':'Trunk'});db[_0x972c('0x4a')][_0x972c('0x11b')](db['CmList'],{'as':_0x972c('0x160'),'foreignKey':'ListId'});db[_0x972c('0x4a')][_0x972c('0x11b')](db[_0x972c('0x164')],{'as':_0x972c('0x149'),'foreignKey':_0x972c('0x165')});db[_0x972c('0x4a')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':_0x972c('0x134')});db['FaxApplication']['belongsTo'](db[_0x972c('0x11')],{'onDelete':_0x972c('0x15a')});db[_0x972c('0x4c')][_0x972c('0x11b')](db['FaxQueue'],{'onDelete':_0x972c('0x15a')});db[_0x972c('0x4c')]['belongsTo'](db[_0x972c('0x4a')],{'onDelete':_0x972c('0x15a')});db['FaxApplication'][_0x972c('0x11b')](db['Tag'],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x173')});db[_0x972c('0x115')]['hasMany'](db[_0x972c('0x4f')],{'as':_0x972c('0x14f'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x179')});db['FaxInteraction'][_0x972c('0x11b')](db[_0x972c('0x4a')],{'as':'Account','foreignKey':_0x972c('0x177')});db['FaxInteraction'][_0x972c('0x11b')](db[_0x972c('0x120')],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db[_0x972c('0x115')]['belongsTo'](db[_0x972c('0x11')],{'as':_0x972c('0x169'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x115')]['belongsToMany'](db['Tag'],{'through':_0x972c('0x17a'),'as':'Tags'});db[_0x972c('0x115')]['belongsToMany'](db[_0x972c('0x8a')],{'through':_0x972c('0x17a'),'as':_0x972c('0x17b')});db[_0x972c('0x115')][_0x972c('0x11c')](db['User'],{'as':'Users','through':_0x972c('0x126'),'foreignKey':_0x972c('0x179')});db[_0x972c('0x4f')][_0x972c('0x11b')](db[_0x972c('0x11')],{'onDelete':_0x972c('0x10b'),'as':_0x972c('0x11')});db[_0x972c('0x4f')][_0x972c('0x11b')](db[_0x972c('0x115')],{'as':_0x972c('0x16f'),'foreignKey':'FaxInteractionId'});db[_0x972c('0x4f')][_0x972c('0x11b')](db[_0x972c('0x120')],{'onDelete':_0x972c('0x10b'),'as':_0x972c('0x156')});db[_0x972c('0x4f')][_0x972c('0x11b')](db[_0x972c('0xe1')],{'as':'Attachment','foreignKey':_0x972c('0x17c')});db['FaxMessage'][_0x972c('0x11b')](db[_0x972c('0x4a')],{'as':_0x972c('0x168'),'foreignKey':'FaxAccountId'});db[_0x972c('0x51')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':'Agents','through':_0x972c('0x33')});db[_0x972c('0x51')]['belongsToMany'](db[_0x972c('0xdb')],{'through':_0x972c('0x17d'),'as':_0x972c('0x14b')});db[_0x972c('0x17e')][_0x972c('0x11b')](db[_0x972c('0x4a')],{});db[_0x972c('0x17e')][_0x972c('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x972c('0x161')});db[_0x972c('0x17e')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['FaxQueueReport'][_0x972c('0x11b')](db[_0x972c('0x115')],{});db[_0x972c('0x17e')][_0x972c('0x11b')](db['FaxMessage'],{});db[_0x972c('0x17e')]['belongsTo'](db[_0x972c('0x11')],{});db[_0x972c('0x17e')][_0x972c('0x11b')](db[_0x972c('0x51')],{});db[_0x972c('0x138')][_0x972c('0x10e')](db[_0x972c('0x81')],{'as':_0x972c('0x15d'),'foreignKey':_0x972c('0x17f'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x138')][_0x972c('0x10e')](db['CannedAnswer'],{'as':_0x972c('0x15e'),'foreignKey':_0x972c('0x17f')});db[_0x972c('0x138')][_0x972c('0x10e')](db[_0x972c('0x180')],{'as':_0x972c('0x14f'),'foreignKey':'SmsAccountId'});db[_0x972c('0x138')][_0x972c('0x10e')](db[_0x972c('0x57')],{'as':_0x972c('0x15f')});db[_0x972c('0x138')]['hasMany'](db[_0x972c('0x55')],{'as':'Applications','foreignKey':_0x972c('0x17f'),'onDelete':'cascade'});db['SmsAccount']['belongsTo'](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161')});db['SmsAccount'][_0x972c('0x11b')](db[_0x972c('0x164')],{'as':'mandatoryDispositionPause','foreignKey':_0x972c('0x165')});db[_0x972c('0x138')][_0x972c('0x11c')](db['User'],{'as':'Agents','through':_0x972c('0x13a')});db[_0x972c('0x55')][_0x972c('0x11b')](db[_0x972c('0x11')],{'onDelete':_0x972c('0x15a')});db[_0x972c('0x55')][_0x972c('0x11b')](db[_0x972c('0x5a')],{'onDelete':_0x972c('0x15a')});db[_0x972c('0x55')][_0x972c('0x11b')](db[_0x972c('0x138')],{'onDelete':'restrict'});db[_0x972c('0x55')]['belongsTo'](db[_0x972c('0x84')],{'onDelete':_0x972c('0x15a'),'foreignKey':'IntervalId'});db[_0x972c('0x55')][_0x972c('0x11b')](db[_0x972c('0x8a')],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x173')});db['SmsInteraction']['hasMany'](db[_0x972c('0x180')],{'as':'Messages','onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x181')});db[_0x972c('0x57')]['belongsTo'](db[_0x972c('0x138')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x17f')});db[_0x972c('0x57')][_0x972c('0x11b')](db['CmContact'],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db[_0x972c('0x57')]['belongsTo'](db[_0x972c('0x11')],{'as':_0x972c('0x169'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x57')][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':_0x972c('0x182'),'as':_0x972c('0x16b')});db['SmsInteraction'][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':_0x972c('0x182'),'as':_0x972c('0x17b')});db[_0x972c('0x57')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':'Users','through':_0x972c('0x183'),'foreignKey':'SmsInteractionId'});db[_0x972c('0x180')]['belongsTo'](db[_0x972c('0x11')],{'as':'User'});db['SmsMessage'][_0x972c('0x11b')](db[_0x972c('0x120')],{'onDelete':_0x972c('0x10b'),'as':_0x972c('0x156')});db[_0x972c('0x180')]['belongsTo'](db[_0x972c('0x57')],{'onDelete':'cascade','as':_0x972c('0x16f'),'foreignKey':'SmsInteractionId'});db[_0x972c('0x180')][_0x972c('0x11b')](db['SmsAccount'],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x17f')});db['SmsQueue'][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':_0x972c('0x35'),'foreignKey':_0x972c('0x184')});db[_0x972c('0x5a')][_0x972c('0x11c')](db[_0x972c('0xdb')],{'through':_0x972c('0x185'),'as':_0x972c('0x14b')});db[_0x972c('0x5c')]['hasMany'](db[_0x972c('0x81')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0x972c('0x10b')});db[_0x972c('0x5c')][_0x972c('0x10e')](db[_0x972c('0x80')],{'as':'Answers','foreignKey':_0x972c('0x186')});db['OpenchannelAccount']['hasMany'](db[_0x972c('0x60')],{'as':_0x972c('0x15f'),'foreignKey':_0x972c('0x186')});db[_0x972c('0x5c')][_0x972c('0x10e')](db[_0x972c('0x62')],{'as':_0x972c('0x14f'),'foreignKey':_0x972c('0x186')});db['OpenchannelAccount'][_0x972c('0x10e')](db[_0x972c('0x5e')],{'as':'Applications','foreignKey':_0x972c('0x186'),'onDelete':'cascade'});db[_0x972c('0x5c')][_0x972c('0x11b')](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161')});db['OpenchannelAccount'][_0x972c('0x11b')](db[_0x972c('0x164')],{'as':_0x972c('0x149'),'foreignKey':_0x972c('0x165')});db['OpenchannelAccount'][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':_0x972c('0x187')});db[_0x972c('0x5e')]['belongsTo'](db[_0x972c('0x11')],{'onDelete':'restrict'});db[_0x972c('0x5e')][_0x972c('0x11b')](db[_0x972c('0x64')],{'onDelete':_0x972c('0x15a'),'foreignKey':'OpenchannelQueueId'});db[_0x972c('0x5e')][_0x972c('0x11b')](db[_0x972c('0x5c')],{'onDelete':'restrict','foreignKey':_0x972c('0x186')});db[_0x972c('0x5e')]['belongsTo'](db[_0x972c('0x84')],{'onDelete':'restrict','foreignKey':_0x972c('0x172')});db['OpenchannelApplication'][_0x972c('0x11b')](db[_0x972c('0x8a')],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x173')});db['OpenchannelInteraction'][_0x972c('0x10e')](db[_0x972c('0x62')],{'as':_0x972c('0x14f'),'onDelete':'cascade','foreignKey':_0x972c('0x188')});db[_0x972c('0x60')][_0x972c('0x11b')](db[_0x972c('0x5c')],{'as':'Account','foreignKey':_0x972c('0x186')});db[_0x972c('0x60')]['belongsTo'](db['CmContact'],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db['OpenchannelInteraction'][_0x972c('0x11b')](db[_0x972c('0x11')],{'as':_0x972c('0x169'),'foreignKey':_0x972c('0x10c')});db['OpenchannelInteraction'][_0x972c('0x11c')](db['Tag'],{'through':_0x972c('0x189'),'as':_0x972c('0x16b')});db[_0x972c('0x60')]['belongsToMany'](db[_0x972c('0x8a')],{'through':_0x972c('0x189'),'as':_0x972c('0x17b')});db[_0x972c('0x60')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x16c'),'through':_0x972c('0x127'),'foreignKey':_0x972c('0x188')});db['OpenchannelMessage'][_0x972c('0x11b')](db[_0x972c('0x11')],{'onDelete':'cascade','as':_0x972c('0x11')});db[_0x972c('0x62')][_0x972c('0x11b')](db[_0x972c('0x120')],{'onDelete':_0x972c('0x10b'),'as':_0x972c('0x156')});db['OpenchannelMessage'][_0x972c('0x11b')](db[_0x972c('0x60')],{'onDelete':_0x972c('0x10b'),'as':_0x972c('0x16f'),'foreignKey':_0x972c('0x188')});db[_0x972c('0x62')][_0x972c('0x11b')](db[_0x972c('0xe1')],{'as':_0x972c('0xe1'),'foreignKey':_0x972c('0x17c')});db[_0x972c('0x62')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x186')});db['OpenchannelQueue'][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':'UserOpenchannelQueue','foreignKey':_0x972c('0x18a')});db['OpenchannelQueue'][_0x972c('0x11c')](db[_0x972c('0xdb')],{'through':'team_has_openchannel_queues','as':_0x972c('0x14b')});db[_0x972c('0x66')]['hasMany'](db['Disposition'],{'as':_0x972c('0x15d'),'foreignKey':'ChatWebsiteId','onDelete':_0x972c('0x10b')});db[_0x972c('0x66')][_0x972c('0x10e')](db[_0x972c('0x80')],{'as':_0x972c('0x15e'),'foreignKey':_0x972c('0x170')});db[_0x972c('0x66')][_0x972c('0x10e')](db[_0x972c('0x18b')],{'as':_0x972c('0x18c')});db[_0x972c('0x66')]['hasMany'](db[_0x972c('0x6b')],{'as':_0x972c('0x15f')});db[_0x972c('0x66')][_0x972c('0x10e')](db[_0x972c('0x6a')],{'as':_0x972c('0x140'),'foreignKey':_0x972c('0x170'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x66')]['hasMany'](db[_0x972c('0x6c')],{'as':_0x972c('0x14f')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x972c('0x161')});db['ChatWebsite'][_0x972c('0x11b')](db[_0x972c('0x84')],{'as':_0x972c('0x84'),'foreignKey':_0x972c('0x172')});db[_0x972c('0x66')][_0x972c('0x11b')](db[_0x972c('0x3c')],{'as':_0x972c('0x3c'),'foreignKey':'MailAccountId'});db[_0x972c('0x66')][_0x972c('0x11b')](db[_0x972c('0x164')],{'as':_0x972c('0x149'),'foreignKey':_0x972c('0x165')});db['ChatWebsite'][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':'Agents','through':_0x972c('0x132')});db[_0x972c('0x68')]['belongsTo'](db[_0x972c('0x5c')],{});db[_0x972c('0x68')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x972c('0x68')][_0x972c('0x11b')](db['CmContact'],{'as':_0x972c('0x156'),'foreignKey':'ContactId'});db[_0x972c('0x68')]['belongsTo'](db[_0x972c('0x60')],{});db['OpenchannelQueueReport'][_0x972c('0x11b')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x972c('0x11b')](db['User'],{});db['OpenchannelQueueReport'][_0x972c('0x11b')](db[_0x972c('0x64')],{});db[_0x972c('0x6a')][_0x972c('0x11b')](db['User'],{'as':_0x972c('0x18d'),'foreignKey':'UserId','onDelete':_0x972c('0x15a')});db[_0x972c('0x6a')]['belongsTo'](db[_0x972c('0x6f')],{'as':_0x972c('0x18e'),'foreignKey':_0x972c('0x18f'),'onDelete':_0x972c('0x15a')});db[_0x972c('0x6a')][_0x972c('0x11b')](db[_0x972c('0x66')],{'as':_0x972c('0x190'),'foreignKey':_0x972c('0x170'),'onDelete':_0x972c('0x15a')});db[_0x972c('0x6a')][_0x972c('0x11b')](db[_0x972c('0x8a')],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x173')});db[_0x972c('0x6b')][_0x972c('0x10e')](db[_0x972c('0x6c')],{'as':_0x972c('0x14f'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x191')});db[_0x972c('0x6b')][_0x972c('0x11b')](db[_0x972c('0x66')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x972c('0x6b')]['belongsTo'](db[_0x972c('0x120')],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db[_0x972c('0x6b')]['belongsTo'](db[_0x972c('0x11')],{'as':_0x972c('0x169'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0x6b')][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':_0x972c('0x192'),'as':_0x972c('0x16b')});db[_0x972c('0x6b')]['belongsToMany'](db[_0x972c('0x8a')],{'through':'chat_interaction_has_tags','as':_0x972c('0x17b')});db[_0x972c('0x6b')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x16c'),'through':_0x972c('0x125'),'foreignKey':_0x972c('0x191')});db[_0x972c('0x6c')][_0x972c('0x11b')](db[_0x972c('0x11')],{'onDelete':'cascade','as':_0x972c('0x11')});db[_0x972c('0x6c')][_0x972c('0x11b')](db[_0x972c('0x120')],{'onDelete':'cascade','as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db[_0x972c('0x6c')][_0x972c('0x11b')](db['ChatInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x972c('0x191')});db[_0x972c('0x6c')][_0x972c('0x11b')](db[_0x972c('0xe1')],{'as':_0x972c('0xe1'),'foreignKey':'AttachmentId'});db[_0x972c('0x6c')]['belongsTo'](db[_0x972c('0x66')],{'as':'Account','foreignKey':_0x972c('0x170')});db[_0x972c('0x6d')]['hasMany'](db[_0x972c('0xe1')],{'as':'Attachments','foreignKey':_0x972c('0x171'),'onDelete':'cascade','hooks':!![]});db[_0x972c('0x6d')][_0x972c('0x11b')](db['CmContact'],{'onDelete':'cascade','as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db[_0x972c('0x6d')][_0x972c('0x11b')](db[_0x972c('0x66')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x170')});db[_0x972c('0x6f')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':_0x972c('0x30'),'hooks':!![]});db[_0x972c('0x6f')]['belongsToMany'](db[_0x972c('0xdb')],{'through':_0x972c('0x193'),'as':'Teams'});db[_0x972c('0x11d')][_0x972c('0x10e')](db[_0x972c('0x194')],{'as':_0x972c('0x14f'),'foreignKey':_0x972c('0x195'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x11d')]['belongsToMany'](db[_0x972c('0x11')],{'as':_0x972c('0x196'),'through':'chat_group_has_users'});db[_0x972c('0x18b')][_0x972c('0x11b')](db[_0x972c('0x66')],{'as':'Website','foreignKey':_0x972c('0x170')});db[_0x972c('0x72')][_0x972c('0x10e')](db['CmContact'],{'as':_0x972c('0x197'),'foreignKey':'CompanyId'});db[_0x972c('0x120')][_0x972c('0x10e')](db[_0x972c('0x8d')],{'as':_0x972c('0x198'),'foreignKey':_0x972c('0x199')});db['CmContact'][_0x972c('0x10e')](db[_0x972c('0x73')],{'as':_0x972c('0x119'),'foreignKey':'ContactId'});db[_0x972c('0x120')][_0x972c('0x10e')](db['CmHopperFinal'],{'as':_0x972c('0x111'),'foreignKey':_0x972c('0x157')});db[_0x972c('0x120')]['hasMany'](db[_0x972c('0x77')],{'as':_0x972c('0x142'),'foreignKey':'ContactId'});db[_0x972c('0x120')][_0x972c('0x10e')](db['ReportAgentPreview'],{'as':_0x972c('0x112'),'foreignKey':_0x972c('0x157')});db['CmContact']['hasMany'](db[_0x972c('0xcd')],{'as':_0x972c('0x144'),'foreignKey':_0x972c('0x157')});db['CmContact'][_0x972c('0x10e')](db[_0x972c('0x60')],{'as':_0x972c('0x113'),'foreignKey':_0x972c('0x157'),'onDelete':_0x972c('0x15a')});db[_0x972c('0x120')][_0x972c('0x10e')](db[_0x972c('0x6b')],{'as':_0x972c('0x124'),'foreignKey':_0x972c('0x157'),'onDelete':'restrict'});db[_0x972c('0x120')][_0x972c('0x10e')](db[_0x972c('0x57')],{'as':_0x972c('0x114'),'foreignKey':'ContactId','onDelete':_0x972c('0x15a')});db[_0x972c('0x120')]['hasMany'](db[_0x972c('0x115')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x972c('0x15a')});db[_0x972c('0x120')][_0x972c('0x10e')](db[_0x972c('0x42')],{'as':_0x972c('0x117'),'foreignKey':_0x972c('0x157'),'onDelete':'restrict'});db[_0x972c('0x120')][_0x972c('0x11b')](db[_0x972c('0x72')],{'as':_0x972c('0x19a'),'foreignKey':_0x972c('0x19b')});db[_0x972c('0x120')][_0x972c('0x11b')](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161'),'onDelete':_0x972c('0x10b')});db['CmContact'][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x16c'),'through':'cm_user_has_contacts'});db[_0x972c('0x120')][_0x972c('0x11c')](db[_0x972c('0x8a')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x972c('0x120')][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':_0x972c('0x19c'),'as':_0x972c('0x17b')});db[_0x972c('0x73')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db['CmHopper'][_0x972c('0x11b')](db['CmContact'],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157'),'onDelete':_0x972c('0x10b')});db['CmHopper'][_0x972c('0x11b')](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161'),'onDelete':'cascade'});db[_0x972c('0x73')]['belongsTo'](db['User'],{'as':_0x972c('0x18d'),'foreignKey':'UserId'});db[_0x972c('0x73')]['belongsTo'](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x972c('0x141'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x73')][_0x972c('0x11b')](db[_0x972c('0xde')],{'as':_0x972c('0xde'),'foreignKey':_0x972c('0x19d'),'onDelete':_0x972c('0x10b')});db['CmHopper']['belongsTo'](db[_0x972c('0x11')],{'as':_0x972c('0x169'),'foreignKey':_0x972c('0x19e')});db[_0x972c('0x74')][_0x972c('0x11b')](db[_0x972c('0x120')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x972c('0x10b')});db[_0x972c('0x74')][_0x972c('0x11b')](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161'),'onDelete':'cascade'});db[_0x972c('0x74')][_0x972c('0x11b')](db[_0x972c('0x1b')],{'as':_0x972c('0x18e'),'foreignKey':_0x972c('0x141'),'onDelete':'cascade'});db[_0x972c('0x74')]['belongsTo'](db['Campaign'],{'as':_0x972c('0xde'),'foreignKey':_0x972c('0x19d'),'onDelete':_0x972c('0x10b')});db[_0x972c('0x7e')]['hasMany'](db[_0x972c('0x19f')],{'as':{'plural':_0x972c('0x1a0'),'singular':_0x972c('0x1a1')},'foreignKey':_0x972c('0x1a2'),'onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db[_0x972c('0x19f')],{'as':{'plural':_0x972c('0x1a3'),'singular':_0x972c('0x1a4')},'foreignKey':_0x972c('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x972c('0x7e')][_0x972c('0x10e')](db['Action'],{'as':_0x972c('0x1a6'),'foreignKey':_0x972c('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x972c('0x81')]['hasMany'](db[_0x972c('0x81')],{'as':_0x972c('0x15d'),'foreignKey':'ParentId','onDelete':_0x972c('0x10b')});db[_0x972c('0x84')][_0x972c('0x10e')](db[_0x972c('0x84')],{'as':'Intervals','foreignKey':_0x972c('0x172'),'onDelete':_0x972c('0x10b'),'hooks':!![],'required':![]});db[_0x972c('0x84')][_0x972c('0x10e')](db[_0x972c('0x17')],{'as':_0x972c('0x1a8'),'foreignKey':_0x972c('0x172'),'onDelete':_0x972c('0x15a')});db[_0x972c('0x84')]['hasMany'](db[_0x972c('0x46')],{'as':_0x972c('0x1a9'),'foreignKey':_0x972c('0x172')});db[_0x972c('0x84')]['hasMany'](db[_0x972c('0x6a')],{'as':_0x972c('0x1aa'),'foreignKey':_0x972c('0x172')});db[_0x972c('0x84')][_0x972c('0x10e')](db[_0x972c('0x4c')],{'as':_0x972c('0x1ab'),'foreignKey':_0x972c('0x172')});db[_0x972c('0x84')][_0x972c('0x10e')](db[_0x972c('0x55')],{'as':_0x972c('0x1ac'),'foreignKey':_0x972c('0x172')});db['Schedule']['belongsTo'](db[_0x972c('0x3c')],{});db[_0x972c('0x87')]['belongsTo'](db[_0x972c('0x9a')],{'foreignKey':_0x972c('0x1ad')});db['Schedule'][_0x972c('0x11b')](db[_0x972c('0x98')],{'foreignKey':_0x972c('0x1ae')});db[_0x972c('0x88')][_0x972c('0x11c')](db[_0x972c('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x972c('0x15a')});db[_0x972c('0x8a')][_0x972c('0x11c')](db[_0x972c('0x120')],{'through':_0x972c('0x19c')});db['Tag'][_0x972c('0x11c')](db[_0x972c('0x6b')],{'through':_0x972c('0x192')});db[_0x972c('0x8a')][_0x972c('0x11c')](db[_0x972c('0x42')],{'through':_0x972c('0x16a')});db[_0x972c('0x8a')][_0x972c('0x11c')](db[_0x972c('0x57')],{'through':_0x972c('0x182')});db['Tag']['belongsToMany'](db[_0x972c('0x115')],{'through':_0x972c('0x17a')});db[_0x972c('0x8a')][_0x972c('0x11c')](db['OpenchannelInteraction'],{'through':_0x972c('0x189')});db[_0x972c('0x8a')][_0x972c('0x11c')](db['WhatsappInteraction'],{'through':_0x972c('0x1af')});db['CmContactHasItem']['belongsTo'](db[_0x972c('0x1b0')],{'as':'ItemType','foreignKey':_0x972c('0x1b1')});db[_0x972c('0x8e')][_0x972c('0x11b')](db[_0x972c('0x73')],{'as':_0x972c('0x1b2'),'foreignKey':_0x972c('0x1b3')});db['CmContactHasItem']['belongsTo'](db[_0x972c('0x120')],{'as':'Contact','foreignKey':_0x972c('0x199')});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0x972c('0x1b4'),'singular':_0x972c('0x1b5')},'foreignKey':_0x972c('0x1b6'),'onDelete':_0x972c('0x10b'),'hooks':!![]});db[_0x972c('0x90')][_0x972c('0x10e')](db[_0x972c('0x19f')],{'as':{'plural':_0x972c('0x1b7'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x972c('0x10b'),'hooks':!![]});db[_0x972c('0x90')][_0x972c('0x10e')](db[_0x972c('0x7c')],{'as':_0x972c('0x1a6'),'foreignKey':_0x972c('0x1b8'),'onDelete':_0x972c('0x10b'),'hooks':!![]});db[_0x972c('0x98')][_0x972c('0x10e')](db['AnalyticFieldReport'],{'as':_0x972c('0x1b9'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1ae'),'hooks':!![]});db[_0x972c('0x9a')][_0x972c('0x10e')](db[_0x972c('0x1ba')],{'as':_0x972c('0x1b9'),'onDelete':_0x972c('0x10b'),'foreignKey':'DefaultReportId'});db[_0x972c('0x1bb')]['hasMany'](db[_0x972c('0x1ba')],{'as':_0x972c('0x1b9'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bc')});db['AnalyticFieldReport'][_0x972c('0x11b')](db[_0x972c('0x1bb')],{'foreignKey':_0x972c('0x1bc')});db[_0x972c('0x9f')][_0x972c('0x10e')](db[_0x972c('0xa0')],{'as':'Configurations','onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bd')});db['SalesforceConfiguration'][_0x972c('0x10e')](db[_0x972c('0xa2')],{'as':_0x972c('0x1be'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bf')});db['SalesforceConfiguration'][_0x972c('0x10e')](db['SalesforceField'],{'as':_0x972c('0x1c0'),'onDelete':_0x972c('0x10b'),'foreignKey':'DescriptionId'});db[_0x972c('0xa0')][_0x972c('0x10e')](db['SalesforceField'],{'as':_0x972c('0x1b9'),'onDelete':_0x972c('0x10b'),'foreignKey':'FieldId'});db[_0x972c('0xa0')][_0x972c('0x11b')](db['SalesforceAccount'],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xa2')]['hasMany'](db[_0x972c('0xa2')],{'as':_0x972c('0x1c1'),'foreignKey':'SubjectId'});db[_0x972c('0xa2')][_0x972c('0x10e')](db['SalesforceField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x972c('0xa2')][_0x972c('0x10e')](db[_0x972c('0xa2')],{'as':_0x972c('0x1c2'),'foreignKey':_0x972c('0x1c3')});db[_0x972c('0xa2')][_0x972c('0x11b')](db['Variable'],{'as':_0x972c('0x92'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x972c('0x10e')](db[_0x972c('0x1c4')],{'as':_0x972c('0x1c5'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0x1c4')][_0x972c('0x10e')](db[_0x972c('0xa6')],{'as':'Subjects','onDelete':_0x972c('0x10b'),'foreignKey':'SubjectId'});db[_0x972c('0x1c4')]['hasMany'](db[_0x972c('0xa6')],{'as':_0x972c('0x1c0'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x972c('0x1c4')][_0x972c('0x10e')](db[_0x972c('0xa6')],{'as':_0x972c('0x1b9'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1c3')});db[_0x972c('0x1c4')][_0x972c('0x11b')](db[_0x972c('0xa3')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xa6')][_0x972c('0x10e')](db[_0x972c('0xa6')],{'as':_0x972c('0x1c1'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xa6')][_0x972c('0x10e')](db[_0x972c('0xa6')],{'as':_0x972c('0x1c6'),'foreignKey':'DescriptionId'});db[_0x972c('0xa6')][_0x972c('0x10e')](db[_0x972c('0xa6')],{'as':_0x972c('0x1c2'),'foreignKey':_0x972c('0x1c3')});db['SugarcrmField'][_0x972c('0x11b')](db['Variable'],{'as':_0x972c('0x92'),'foreignKey':_0x972c('0x1c7')});db[_0x972c('0x1c8')]['hasMany'](db[_0x972c('0xa8')],{'as':'Configurations','onDelete':_0x972c('0x10b'),'foreignKey':'AccountId'});db[_0x972c('0xa8')][_0x972c('0x10e')](db[_0x972c('0xaa')],{'as':_0x972c('0x1be'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xa8')]['hasMany'](db[_0x972c('0xaa')],{'as':_0x972c('0x1c0'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1c9')});db['DeskConfiguration']['hasMany'](db[_0x972c('0xaa')],{'as':_0x972c('0x1b9'),'onDelete':'cascade','foreignKey':_0x972c('0x1c3')});db[_0x972c('0xa8')]['belongsTo'](db[_0x972c('0x1c8')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xa8')][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':_0x972c('0x1ca')});db[_0x972c('0xaa')][_0x972c('0x10e')](db[_0x972c('0xaa')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0x972c('0x10e')](db['DeskField'],{'as':_0x972c('0x1c6'),'foreignKey':_0x972c('0x1c9')});db['DeskField'][_0x972c('0x10e')](db[_0x972c('0xaa')],{'as':_0x972c('0x1c2'),'foreignKey':_0x972c('0x1c3')});db[_0x972c('0xaa')][_0x972c('0x11b')](db[_0x972c('0x92')],{'as':_0x972c('0x92'),'foreignKey':_0x972c('0x1c7')});db[_0x972c('0x1cb')][_0x972c('0x10e')](db[_0x972c('0xad')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x972c('0x1bd')});db[_0x972c('0xad')]['hasMany'](db[_0x972c('0xae')],{'as':_0x972c('0x1be'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xad')]['hasMany'](db['ZohoField'],{'as':_0x972c('0x1c0'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1c9')});db[_0x972c('0xad')]['hasMany'](db[_0x972c('0xae')],{'as':_0x972c('0x1b9'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x972c('0xad')]['belongsTo'](db['ZohoAccount'],{'as':'Account','foreignKey':_0x972c('0x1bd')});db[_0x972c('0xae')][_0x972c('0x10e')](db[_0x972c('0xae')],{'as':_0x972c('0x1c1'),'foreignKey':'SubjectId'});db['ZohoField'][_0x972c('0x10e')](db[_0x972c('0xae')],{'as':_0x972c('0x1c6'),'foreignKey':_0x972c('0x1c9')});db['ZohoField'][_0x972c('0x10e')](db['ZohoField'],{'as':'Field','foreignKey':_0x972c('0x1c3')});db['ZohoField'][_0x972c('0x11b')](db[_0x972c('0x92')],{'as':'Variable','foreignKey':_0x972c('0x1c7')});db[_0x972c('0xaf')][_0x972c('0x10e')](db[_0x972c('0xb1')],{'as':_0x972c('0x1c5'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xb1')][_0x972c('0x10e')](db[_0x972c('0xb2')],{'as':_0x972c('0x1be'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xb1')]['hasMany'](db[_0x972c('0xb2')],{'as':'Descriptions','foreignKey':_0x972c('0x1c9')});db[_0x972c('0xb1')][_0x972c('0x10e')](db[_0x972c('0xb2')],{'as':'Fields','foreignKey':'FieldId'});db[_0x972c('0xb1')][_0x972c('0x11b')](db[_0x972c('0xaf')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xb1')][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x972c('0x10e')](db[_0x972c('0xb2')],{'as':_0x972c('0x1c1'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xb2')][_0x972c('0x10e')](db[_0x972c('0xb2')],{'as':_0x972c('0x1c6'),'foreignKey':_0x972c('0x1c9')});db['ZendeskField'][_0x972c('0x10e')](db[_0x972c('0xb2')],{'as':_0x972c('0x1c2'),'foreignKey':_0x972c('0x1c3')});db[_0x972c('0xb2')][_0x972c('0x11b')](db[_0x972c('0x92')],{'as':_0x972c('0x92'),'foreignKey':_0x972c('0x1c7')});db[_0x972c('0xb4')][_0x972c('0x10e')](db['FreshdeskConfiguration'],{'as':_0x972c('0x1c5'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xb5')][_0x972c('0x10e')](db[_0x972c('0xb6')],{'as':_0x972c('0x1be'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xb5')][_0x972c('0x10e')](db['FreshdeskField'],{'as':_0x972c('0x1c0'),'onDelete':_0x972c('0x10b'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x972c('0x1b9'),'onDelete':'cascade','foreignKey':_0x972c('0x1c3')});db['FreshdeskConfiguration'][_0x972c('0x11b')](db[_0x972c('0xb4')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db['FreshdeskConfiguration'][_0x972c('0x11c')](db[_0x972c('0x8a')],{'through':_0x972c('0x1cc')});db[_0x972c('0xb6')][_0x972c('0x10e')](db[_0x972c('0xb6')],{'as':_0x972c('0x1c1'),'foreignKey':_0x972c('0x1bf')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x972c('0x1c6'),'foreignKey':_0x972c('0x1c9')});db[_0x972c('0xb6')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':_0x972c('0x1c3')});db['FreshdeskField'][_0x972c('0x11b')](db[_0x972c('0x92')],{'as':_0x972c('0x92'),'foreignKey':_0x972c('0x1c7')});db[_0x972c('0x1cd')][_0x972c('0x10e')](db[_0x972c('0xb8')],{'as':_0x972c('0x1c5'),'onDelete':_0x972c('0x10b'),'foreignKey':'AccountId'});db[_0x972c('0xb8')][_0x972c('0x10e')](db[_0x972c('0xb9')],{'as':'Subjects','foreignKey':_0x972c('0x1bf')});db[_0x972c('0xb8')][_0x972c('0x10e')](db[_0x972c('0xb9')],{'as':_0x972c('0x1c0'),'foreignKey':_0x972c('0x1c9')});db[_0x972c('0xb8')][_0x972c('0x10e')](db[_0x972c('0xb9')],{'as':_0x972c('0x1b9'),'foreignKey':'FieldId'});db[_0x972c('0xb8')]['belongsTo'](db[_0x972c('0x1cd')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db['VtigerField']['hasMany'](db[_0x972c('0xb9')],{'as':_0x972c('0x1c1'),'foreignKey':_0x972c('0x1bf')});db['VtigerField'][_0x972c('0x10e')](db[_0x972c('0xb9')],{'as':_0x972c('0x1c6'),'foreignKey':_0x972c('0x1c9')});db[_0x972c('0xb9')][_0x972c('0x10e')](db[_0x972c('0xb9')],{'as':_0x972c('0x1c2'),'foreignKey':_0x972c('0x1c3')});db[_0x972c('0xb9')]['belongsTo'](db[_0x972c('0x92')],{'as':_0x972c('0x92'),'foreignKey':'VariableId'});db[_0x972c('0x1ce')][_0x972c('0x10e')](db['ServicenowConfiguration'],{'as':_0x972c('0x1c5'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bd')});db['ServicenowConfiguration'][_0x972c('0x10e')](db[_0x972c('0xbc')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x972c('0x1cf')][_0x972c('0x10e')](db[_0x972c('0xbc')],{'as':_0x972c('0x1c0'),'foreignKey':_0x972c('0x1c9')});db['ServicenowConfiguration'][_0x972c('0x10e')](db[_0x972c('0xbc')],{'as':'Fields','foreignKey':_0x972c('0x1c3')});db[_0x972c('0x1cf')][_0x972c('0x11b')](db[_0x972c('0x1ce')],{'as':_0x972c('0x168'),'foreignKey':'AccountId'});db['ServicenowField'][_0x972c('0x10e')](db[_0x972c('0xbc')],{'as':_0x972c('0x1c1'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xbc')]['hasMany'](db[_0x972c('0xbc')],{'as':_0x972c('0x1c6'),'foreignKey':'DescriptionId'});db[_0x972c('0xbc')][_0x972c('0x10e')](db[_0x972c('0xbc')],{'as':_0x972c('0x1c2'),'foreignKey':_0x972c('0x1c3')});db[_0x972c('0xbc')][_0x972c('0x11b')](db[_0x972c('0x92')],{'as':_0x972c('0x92'),'foreignKey':'VariableId'});db[_0x972c('0xbe')][_0x972c('0x10e')](db[_0x972c('0x1d0')],{'as':_0x972c('0x1c5'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xbe')][_0x972c('0x11b')](db['CloudProvider'],{'as':_0x972c('0x101'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0x972c('0x10e')](db['Dynamics365Field'],{'as':_0x972c('0x1be'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x1bf')});db['Dynamics365Configuration'][_0x972c('0x10e')](db[_0x972c('0xc0')],{'as':_0x972c('0x1c0'),'onDelete':'cascade','foreignKey':_0x972c('0x1c9')});db['Dynamics365Configuration'][_0x972c('0x10e')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x972c('0x10b'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x972c('0x11b')](db[_0x972c('0xbe')],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xc0')][_0x972c('0x10e')](db[_0x972c('0xc0')],{'as':_0x972c('0x1c1'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xc0')][_0x972c('0x10e')](db[_0x972c('0xc0')],{'as':_0x972c('0x1c6'),'foreignKey':_0x972c('0x1c9')});db[_0x972c('0xc0')][_0x972c('0x10e')](db['Dynamics365Field'],{'as':_0x972c('0x1c2'),'foreignKey':'FieldId'});db[_0x972c('0xc0')][_0x972c('0x11b')](db[_0x972c('0x92')],{'as':_0x972c('0x92'),'foreignKey':_0x972c('0x1c7')});db[_0x972c('0xc2')][_0x972c('0x10e')](db['FreshsalesConfiguration'],{'as':_0x972c('0x1c5'),'onDelete':'cascade','foreignKey':_0x972c('0x1bd')});db[_0x972c('0xc4')][_0x972c('0x10e')](db[_0x972c('0xc5')],{'as':_0x972c('0x1be'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xc4')]['hasMany'](db[_0x972c('0xc5')],{'as':_0x972c('0x1c0'),'foreignKey':_0x972c('0x1c9')});db[_0x972c('0xc4')][_0x972c('0x10e')](db[_0x972c('0xc5')],{'as':'Fields','foreignKey':_0x972c('0x1c3')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1bd')});db[_0x972c('0xc5')][_0x972c('0x10e')](db['FreshsalesField'],{'as':_0x972c('0x1c1'),'foreignKey':_0x972c('0x1bf')});db[_0x972c('0xc5')][_0x972c('0x10e')](db[_0x972c('0xc5')],{'as':_0x972c('0x1c6'),'foreignKey':'DescriptionId'});db[_0x972c('0xc5')][_0x972c('0x10e')](db[_0x972c('0xc5')],{'as':'Field','foreignKey':_0x972c('0x1c3')});db[_0x972c('0xc5')][_0x972c('0x11b')](db[_0x972c('0x92')],{'as':_0x972c('0x92'),'foreignKey':'VariableId'});db[_0x972c('0xc8')][_0x972c('0x11b')](db[_0x972c('0x66')],{});db[_0x972c('0xc8')][_0x972c('0x11b')](db[_0x972c('0xea')],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161')});db['ChatQueueReport'][_0x972c('0x11b')](db['CmContact'],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db['ChatQueueReport'][_0x972c('0x11b')](db[_0x972c('0x6b')],{});db['ChatQueueReport'][_0x972c('0x11b')](db[_0x972c('0x6c')],{});db[_0x972c('0xc8')][_0x972c('0x11b')](db[_0x972c('0x11')],{});db[_0x972c('0xc8')][_0x972c('0x11b')](db[_0x972c('0x6f')],{});db['ChatInternalMessage'][_0x972c('0x11b')](db[_0x972c('0x11')],{'onDelete':'cascade','foreignKey':_0x972c('0x1d1')});db[_0x972c('0x194')][_0x972c('0x11b')](db['User'],{'onDelete':_0x972c('0x10b'),'foreignKey':'ToId'});db[_0x972c('0xcd')]['hasMany'](db[_0x972c('0x1d2')],{'foreignKey':_0x972c('0x1d3'),'onDelete':_0x972c('0x10b')});db[_0x972c('0xcd')][_0x972c('0x10e')](db[_0x972c('0x1d4')],{'foreignKey':_0x972c('0x1d3'),'onDelete':_0x972c('0x10b')});db[_0x972c('0xcf')][_0x972c('0x11b')](db['SmsAccount'],{});db['SmsQueueReport'][_0x972c('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x972c('0x161')});db[_0x972c('0xcf')]['belongsTo'](db[_0x972c('0x120')],{'as':_0x972c('0x156'),'foreignKey':'ContactId'});db[_0x972c('0xcf')][_0x972c('0x11b')](db[_0x972c('0x57')],{});db[_0x972c('0xcf')][_0x972c('0x11b')](db[_0x972c('0x180')],{});db[_0x972c('0xcf')][_0x972c('0x11b')](db[_0x972c('0x11')],{});db[_0x972c('0xcf')][_0x972c('0x11b')](db[_0x972c('0x5a')],{});db[_0x972c('0xd3')][_0x972c('0x10e')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x972c('0x1d2')],{'foreignKey':_0x972c('0x1d5')});db[_0x972c('0xd3')][_0x972c('0x10e')](db[_0x972c('0x1d4')],{'foreignKey':'ProjectId'});db[_0x972c('0xdb')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':'user_has_teams'});db['Team'][_0x972c('0x11c')](db[_0x972c('0x1b')],{'through':_0x972c('0x103'),'as':_0x972c('0x12a')});db[_0x972c('0xdb')][_0x972c('0x11c')](db['MailQueue'],{'through':_0x972c('0x167'),'as':_0x972c('0x12c')});db[_0x972c('0xdb')][_0x972c('0x11c')](db['ChatQueue'],{'through':_0x972c('0x193'),'as':'ChatQueues'});db['Team']['belongsToMany'](db[_0x972c('0x51')],{'through':'team_has_fax_queues','as':_0x972c('0x1d6')});db[_0x972c('0xdb')][_0x972c('0x11c')](db[_0x972c('0x5a')],{'through':_0x972c('0x185'),'as':_0x972c('0x12e')});db[_0x972c('0xdb')][_0x972c('0x11c')](db[_0x972c('0x64')],{'through':_0x972c('0x1d7'),'as':_0x972c('0x12f')});db[_0x972c('0xdb')][_0x972c('0x11c')](db[_0x972c('0xff')],{'through':_0x972c('0x1d8'),'as':_0x972c('0x130')});db[_0x972c('0xdb')]['belongsToMany'](db[_0x972c('0xec')],{'through':_0x972c('0x1d9'),'as':_0x972c('0x12b')});db['Campaign']['hasMany'](db['CmHopper'],{'as':_0x972c('0x119'),'foreignKey':'CampaignId'});db[_0x972c('0xde')]['hasMany'](db['CmHopperFinal'],{'as':_0x972c('0x111'),'foreignKey':_0x972c('0x19d')});db[_0x972c('0xde')][_0x972c('0x10e')](db[_0x972c('0x77')],{'as':_0x972c('0x142'),'foreignKey':'CampaignId'});db[_0x972c('0xde')]['hasMany'](db[_0x972c('0x74')],{'as':_0x972c('0x143'),'foreignKey':'CampaignId'});db[_0x972c('0xde')][_0x972c('0x11b')](db[_0x972c('0x145')],{'as':_0x972c('0x145'),'foreignKey':'TrunkId'});db[_0x972c('0xde')][_0x972c('0x11b')](db[_0x972c('0x145')],{'as':'TrunkBackup','foreignKey':_0x972c('0x148')});db[_0x972c('0xde')][_0x972c('0x11b')](db[_0x972c('0x84')],{'as':'Interval','foreignKey':_0x972c('0x172')});db[_0x972c('0xde')][_0x972c('0x11b')](db[_0x972c('0xd8')],{'as':'SquareProject','foreignKey':_0x972c('0x1da')});db[_0x972c('0xde')]['belongsToMany'](db[_0x972c('0xea')],{'as':_0x972c('0x122'),'through':_0x972c('0x1db')});db[_0x972c('0xde')][_0x972c('0x11c')](db[_0x972c('0xea')],{'as':_0x972c('0x14c'),'through':_0x972c('0x1dc')});db[_0x972c('0xe1')]['belongsTo'](db[_0x972c('0x6d')],{'as':_0x972c('0x6d'),'foreignKey':_0x972c('0x171')});db['MailTransferReport'][_0x972c('0x11b')](db[_0x972c('0x44')],{});db[_0x972c('0x1dd')][_0x972c('0x11b')](db[_0x972c('0x42')],{});db[_0x972c('0x1dd')][_0x972c('0x11b')](db['MailAccount'],{'foreignKey':_0x972c('0x1de'),'as':_0x972c('0x1df')});db['MailTransferReport'][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':'FromUserId','as':_0x972c('0x1e0')});db[_0x972c('0x1dd')][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':_0x972c('0x1e1'),'as':'ToAgent'});db[_0x972c('0x1dd')][_0x972c('0x11b')](db[_0x972c('0x3e')],{'foreignKey':_0x972c('0x1e2'),'as':_0x972c('0x1e3')});db[_0x972c('0x1dd')][_0x972c('0x11b')](db[_0x972c('0x3c')],{'foreignKey':'ToMailAccountId','as':_0x972c('0x1e4')});db[_0x972c('0x1e5')][_0x972c('0x11b')](db['ChatMessage'],{});db[_0x972c('0x1e5')][_0x972c('0x11b')](db[_0x972c('0x6b')],{});db[_0x972c('0x1e5')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x972c('0x1df')});db[_0x972c('0x1e5')][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':_0x972c('0x1e6'),'as':_0x972c('0x1e0')});db[_0x972c('0x1e5')][_0x972c('0x11b')](db['User'],{'foreignKey':_0x972c('0x1e1'),'as':_0x972c('0x1e7')});db[_0x972c('0x1e5')][_0x972c('0x11b')](db[_0x972c('0x6f')],{'foreignKey':_0x972c('0x1e8'),'as':_0x972c('0x1e3')});db['ChatTransferReport'][_0x972c('0x11b')](db[_0x972c('0x66')],{'foreignKey':_0x972c('0x1e9'),'as':_0x972c('0x1e4')});db['FaxTransferReport']['belongsTo'](db[_0x972c('0x4f')],{});db[_0x972c('0xe5')][_0x972c('0x11b')](db['FaxInteraction'],{});db['FaxTransferReport'][_0x972c('0x11b')](db['FaxAccount'],{'foreignKey':_0x972c('0x1ea'),'as':_0x972c('0x1df')});db['FaxTransferReport'][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':'FromUserId','as':_0x972c('0x1e0')});db[_0x972c('0xe5')][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':_0x972c('0x1e1'),'as':_0x972c('0x1e7')});db[_0x972c('0xe5')][_0x972c('0x11b')](db[_0x972c('0x51')],{'foreignKey':_0x972c('0x1eb'),'as':_0x972c('0x1e3')});db[_0x972c('0xe5')][_0x972c('0x11b')](db[_0x972c('0x4a')],{'foreignKey':_0x972c('0x1ec'),'as':_0x972c('0x1e4')});db['OpenchannelTransferReport'][_0x972c('0x11b')](db[_0x972c('0x62')],{});db[_0x972c('0xe6')][_0x972c('0x11b')](db[_0x972c('0x60')],{});db[_0x972c('0xe6')][_0x972c('0x11b')](db[_0x972c('0x5c')],{'foreignKey':_0x972c('0x1ed'),'as':_0x972c('0x1df')});db['OpenchannelTransferReport'][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':_0x972c('0x1e6'),'as':'FromAgent'});db[_0x972c('0xe6')][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':_0x972c('0x1e1'),'as':_0x972c('0x1e7')});db[_0x972c('0xe6')][_0x972c('0x11b')](db[_0x972c('0x64')],{'foreignKey':'ToOpenchannelQueueId','as':_0x972c('0x1e3')});db[_0x972c('0xe6')][_0x972c('0x11b')](db[_0x972c('0x5c')],{'foreignKey':_0x972c('0x1ee'),'as':_0x972c('0x1e4')});db[_0x972c('0xe8')][_0x972c('0x11b')](db[_0x972c('0x180')],{});db[_0x972c('0xe8')][_0x972c('0x11b')](db[_0x972c('0x57')],{});db[_0x972c('0xe8')][_0x972c('0x11b')](db[_0x972c('0x138')],{'foreignKey':'FromSmsAccountId','as':_0x972c('0x1df')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x972c('0x1e6'),'as':_0x972c('0x1e0')});db[_0x972c('0xe8')]['belongsTo'](db[_0x972c('0x11')],{'foreignKey':_0x972c('0x1e1'),'as':_0x972c('0x1e7')});db[_0x972c('0xe8')]['belongsTo'](db[_0x972c('0x5a')],{'foreignKey':_0x972c('0x1ef'),'as':_0x972c('0x1e3')});db['SmsTransferReport'][_0x972c('0x11b')](db[_0x972c('0x138')],{'foreignKey':_0x972c('0x1f0'),'as':'ToAccount'});db['CmList']['hasMany'](db[_0x972c('0x81')],{'as':_0x972c('0x15d'),'foreignKey':_0x972c('0x161'),'onDelete':'cascade'});db[_0x972c('0xea')]['hasMany'](db[_0x972c('0x7a')],{'as':_0x972c('0x1f1'),'foreignKey':'ListId'});db['CmList'][_0x972c('0x10e')](db['CmContact'],{'as':_0x972c('0x197'),'onDelete':_0x972c('0x10b'),'foreignKey':_0x972c('0x161')});db[_0x972c('0xea')]['hasMany'](db[_0x972c('0x75')],{'as':_0x972c('0x111'),'foreignKey':_0x972c('0x161')});db[_0x972c('0xea')][_0x972c('0x10e')](db['CmHopperHistory'],{'as':_0x972c('0x1f2'),'foreignKey':_0x972c('0x161')});db[_0x972c('0xea')]['hasMany'](db[_0x972c('0x112')],{'as':'ReportAgentPreview','foreignKey':_0x972c('0x161')});db[_0x972c('0xea')]['belongsToMany'](db[_0x972c('0x1b')],{'as':'Queues','through':_0x972c('0x14a')});db[_0x972c('0xea')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x972c('0x1f3')});db[_0x972c('0xec')][_0x972c('0x10e')](db[_0x972c('0x17')],{'as':_0x972c('0x1a8'),'onDelete':_0x972c('0x10b')});db['VoicePrefix']['belongsToMany'](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':_0x972c('0x105')});db['VoicePrefix'][_0x972c('0x11c')](db[_0x972c('0xdb')],{'through':_0x972c('0x1d9'),'as':_0x972c('0x14b')});db[_0x972c('0xee')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x972c('0x1f4')});db[_0x972c('0xee')]['hasMany'](db[_0x972c('0xf0')],{'as':_0x972c('0x1f5'),'foreignKey':_0x972c('0x1f4'),'onDelete':_0x972c('0x10b')});db['UserProfileSection'][_0x972c('0x10e')](db[_0x972c('0xf1')],{'as':_0x972c('0x1f6'),'foreignKey':_0x972c('0x1f7'),'onDelete':_0x972c('0x10b')});db[_0x972c('0xf4')]['hasMany'](db[_0x972c('0x81')],{'as':_0x972c('0x15d'),'foreignKey':_0x972c('0x1f8'),'onDelete':_0x972c('0x10b')});db[_0x972c('0xf4')][_0x972c('0x10e')](db[_0x972c('0x80')],{'as':_0x972c('0x15e'),'foreignKey':_0x972c('0x1f8')});db[_0x972c('0xf4')][_0x972c('0x10e')](db[_0x972c('0x1f9')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x972c('0xf4')][_0x972c('0x10e')](db[_0x972c('0xf8')],{'as':_0x972c('0x15f')});db[_0x972c('0xf4')][_0x972c('0x10e')](db[_0x972c('0xf6')],{'as':_0x972c('0x140'),'foreignKey':'WhatsappAccountId','onDelete':_0x972c('0x10b')});db[_0x972c('0xf4')][_0x972c('0x11b')](db['CmList'],{'as':_0x972c('0x160'),'foreignKey':_0x972c('0x161')});db['WhatsappAccount'][_0x972c('0x11b')](db[_0x972c('0x164')],{'as':_0x972c('0x149'),'foreignKey':_0x972c('0x165')});db[_0x972c('0xf4')]['belongsToMany'](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':_0x972c('0x13c')});db[_0x972c('0xf6')]['belongsTo'](db[_0x972c('0x11')],{'onDelete':_0x972c('0x15a')});db[_0x972c('0xf6')][_0x972c('0x11b')](db['WhatsappQueue'],{'onDelete':_0x972c('0x15a')});db[_0x972c('0xf6')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x972c('0x15a')});db[_0x972c('0xf6')][_0x972c('0x11b')](db['Interval'],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x172')});db['WhatsappApplication'][_0x972c('0x11b')](db['Tag'],{'onDelete':_0x972c('0x15a'),'foreignKey':_0x972c('0x173')});db[_0x972c('0xf8')]['hasMany'](db[_0x972c('0x1f9')],{'as':_0x972c('0x14f'),'onDelete':_0x972c('0x10b'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x972c('0x11b')](db[_0x972c('0xf4')],{'as':'Account','foreignKey':_0x972c('0x1f8')});db[_0x972c('0xf8')]['belongsTo'](db['CmContact'],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db[_0x972c('0xf8')][_0x972c('0x11b')](db[_0x972c('0x11')],{'as':_0x972c('0x169'),'foreignKey':_0x972c('0x10c')});db[_0x972c('0xf8')]['belongsToMany'](db['Tag'],{'through':_0x972c('0x1af'),'as':_0x972c('0x16b')});db[_0x972c('0xf8')][_0x972c('0x11c')](db['Tag'],{'through':_0x972c('0x1af'),'as':_0x972c('0x17b')});db[_0x972c('0xf8')][_0x972c('0x11c')](db[_0x972c('0x11')],{'as':_0x972c('0x16c'),'through':_0x972c('0x129'),'foreignKey':_0x972c('0x1fa')});db['WhatsappMessage'][_0x972c('0x11b')](db[_0x972c('0x11')],{'as':_0x972c('0x11')});db[_0x972c('0x1f9')][_0x972c('0x11b')](db['CmContact'],{'onDelete':_0x972c('0x10b'),'as':_0x972c('0x156')});db[_0x972c('0x1f9')][_0x972c('0x11b')](db[_0x972c('0xf8')],{'onDelete':_0x972c('0x10b'),'as':_0x972c('0x16f'),'foreignKey':_0x972c('0x1fa')});db[_0x972c('0x1f9')][_0x972c('0x11b')](db['WhatsappAccount'],{'as':_0x972c('0x168'),'foreignKey':_0x972c('0x1f8')});db[_0x972c('0xfb')][_0x972c('0x11b')](db[_0x972c('0xf4')],{});db['WhatsappQueueReport'][_0x972c('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x972c('0x161')});db[_0x972c('0xfb')][_0x972c('0x11b')](db['CmContact'],{'as':_0x972c('0x156'),'foreignKey':_0x972c('0x157')});db[_0x972c('0xfb')][_0x972c('0x11b')](db['WhatsappInteraction'],{});db[_0x972c('0xfb')][_0x972c('0x11b')](db[_0x972c('0xff')],{});db[_0x972c('0xfb')][_0x972c('0x11b')](db[_0x972c('0x1f9')],{});db[_0x972c('0xfb')][_0x972c('0x11b')](db[_0x972c('0x11')],{});db[_0x972c('0xfd')][_0x972c('0x11b')](db[_0x972c('0x1f9')],{});db['WhatsappTransferReport'][_0x972c('0x11b')](db[_0x972c('0xf8')],{});db[_0x972c('0xfd')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x972c('0x1df')});db['WhatsappTransferReport']['belongsTo'](db[_0x972c('0xf4')],{'foreignKey':_0x972c('0x1fb'),'as':'ToAccount'});db['WhatsappTransferReport']['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x972c('0x1fc'),'as':_0x972c('0x1e3')});db[_0x972c('0xfd')][_0x972c('0x11b')](db[_0x972c('0x11')],{'foreignKey':'FromUserId','as':_0x972c('0x1e0')});db[_0x972c('0xfd')]['belongsTo'](db['User'],{'foreignKey':_0x972c('0x1e1'),'as':_0x972c('0x1e7')});db[_0x972c('0xff')]['belongsToMany'](db[_0x972c('0x11')],{'as':_0x972c('0x166'),'through':_0x972c('0x38'),'foreignKey':_0x972c('0x1fd')});db['WhatsappQueue'][_0x972c('0x11c')](db[_0x972c('0xdb')],{'through':_0x972c('0x1d8'),'as':_0x972c('0x14b')});db[_0x972c('0x106')]['belongsTo'](db[_0x972c('0x11')],{'as':_0x972c('0x1fe'),'foreignKey':_0x972c('0x10c'),'onDelete':_0x972c('0x10b'),'hooks':!![]});db[_0x972c('0x101')][_0x972c('0x10a')](db[_0x972c('0xbe')],{'as':_0x972c('0xbe'),'onDelete':'restrict'});db[_0x972c('0x101')]['hasOne'](db[_0x972c('0x3a')],{'as':_0x972c('0x1ff'),'onDelete':_0x972c('0x15a')});db['CloudProvider'][_0x972c('0x10a')](db[_0x972c('0x15b')],{'as':_0x972c('0x15c'),'onDelete':_0x972c('0x15a')});module[_0x972c('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6947=['team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatInternalMessage','Members','CmCompany','CompanyId','Phones','OpenchannelInteractions','MailInteractions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','moh_has_sounds','ItemType','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','AnalyticFieldReport','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskField','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','VtigerAccount','ServicenowConfiguration','Dynamics365Account','FromId','JscriptyQuestionReport','SessionId','ProjectId','TeamVoiceQueue','MailQueues','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CmCustomField','CustomFields','Queues','TeamVoicePrefix','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','sequelize','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','utf8','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Condition','../api/condition/condition.model','Interval','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','UserId','hasOne','UserSetting','hasMany','Recordings','Extensions','cascade','HopperHistory','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','ChatQueues','WhatsappQueues','CmList','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','SmsAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sound','Sounds','VoiceQueueId','HopperFinals','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','restrict','MailServerOut','CloudProviderId','Imap','Smtp','Disposition','Answers','Interactions','List','ListId','user_has_mail_accounts','Agents','team_has_mail_queues','MailInteractionId','Owner','Tags','mail_interaction_has_tags','Users','Attachment','Attachments','Account','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','MailQueueReport','Dashboard','Items','Dispositions','FaxAccountId','fax_interaction_has_tags','ThroughTags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x6947,0x72));var _0x7694=function(_0x4d4d4f,_0x2a2f49){_0x4d4d4f=_0x4d4d4f-0x0;var _0x579f2c=_0x6947[_0x4d4d4f];return _0x579f2c;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x7694('0x0'));var _=require('lodash');var jstz=require(_0x7694('0x1'));var timezone=jstz[_0x7694('0x2')]();config[_0x7694('0x0')]=_[_0x7694('0x3')](config['sequelize'],{'database':'motion2','username':_0x7694('0x4'),'password':_0x7694('0x5'),'options':{'host':_0x7694('0x6'),'port':0xcea,'dialect':_0x7694('0x7'),'dialectOptions':{'charset':_0x7694('0x8')},'logging':![],'timezone':timezone[_0x7694('0x9')](),'define':{'charset':'utf8','collate':_0x7694('0xa')}}});config['sequelizeHistory']=_[_0x7694('0x3')](config[_0x7694('0xb')],{'database':'motion2','username':_0x7694('0x4'),'password':_0x7694('0x5'),'options':{'host':_0x7694('0x6'),'port':0xcea,'dialect':_0x7694('0x7'),'dialectOptions':{'charset':_0x7694('0x8')},'logging':![],'timezone':timezone[_0x7694('0x9')](),'define':{'charset':_0x7694('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7694('0x0')][_0x7694('0xd')],config['sequelize'][_0x7694('0xe')],config[_0x7694('0x0')][_0x7694('0xf')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7694('0xb')][_0x7694('0xd')],config[_0x7694('0xb')]['username'],config[_0x7694('0xb')]['password'],config[_0x7694('0xb')][_0x7694('0x10')])};db[_0x7694('0x11')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/user/user.model');db[_0x7694('0x13')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x14'));db['VoiceContext']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x15'));db[_0x7694('0x16')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/voiceExtension/voiceExtension.model');db[_0x7694('0x17')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x18'));db[_0x7694('0x19')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0x7694('0x1a')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x1b'));db[_0x7694('0x1c')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x1d'));db[_0x7694('0x1e')]=db[_0x7694('0x0')]['import'](_0x7694('0x1f'));db['VoiceMailMessage']=db[_0x7694('0x0')]['import'](_0x7694('0x20'));db[_0x7694('0x21')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x22'));db[_0x7694('0x23')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x24'));db['VoiceAgentReport']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x25'));db[_0x7694('0x26')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x27'));db[_0x7694('0x28')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x29'));db[_0x7694('0x2a')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x2b'));db[_0x7694('0x2c')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x2d'));db[_0x7694('0x2e')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x7694('0x2f')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x30'));db['UserChatQueue']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x31'));db[_0x7694('0x32')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/userMailQueue/userMailQueue.model');db[_0x7694('0x33')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x34'));db[_0x7694('0x35')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x36'));db[_0x7694('0x37')]=db['sequelize'][_0x7694('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x7694('0x38')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x39'));db[_0x7694('0x3a')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x3b'));db['MailServerOut']=db['sequelize'][_0x7694('0x12')](_0x7694('0x3c'));db[_0x7694('0x3d')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x3e'));db[_0x7694('0x3f')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x40'));db[_0x7694('0x41')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x42'));db[_0x7694('0x43')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x44'));db[_0x7694('0x45')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x46'));db[_0x7694('0x47')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x48'));db['Dashboard']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x49'));db['DashboardItem']=db['sequelize'][_0x7694('0x12')](_0x7694('0x4a'));db[_0x7694('0x4b')]=db['sequelize'][_0x7694('0x12')]('../api/faxAccount/faxAccount.model');db[_0x7694('0x4c')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x4d'));db[_0x7694('0x4e')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x7694('0x4f')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x50'));db[_0x7694('0x51')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x52'));db[_0x7694('0x53')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x54'));db[_0x7694('0x55')]=db[_0x7694('0x0')]['import'](_0x7694('0x56'));db[_0x7694('0x57')]=db['sequelize']['import'](_0x7694('0x58'));db['SmsInteraction']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x59'));db[_0x7694('0x5a')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x5b'));db[_0x7694('0x5c')]=db[_0x7694('0x0')]['import'](_0x7694('0x5d'));db[_0x7694('0x5e')]=db[_0x7694('0x0')]['import'](_0x7694('0x5f'));db['OpenchannelApplication']=db[_0x7694('0x0')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x7694('0x60')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x61'));db[_0x7694('0x62')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x63'));db[_0x7694('0x64')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x65'));db[_0x7694('0x66')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x67'));db[_0x7694('0x68')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x69'));db['ChatApplication']=db[_0x7694('0x0')]['import']('../api/chatApplication/chatApplication.model');db[_0x7694('0x6a')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x6b'));db[_0x7694('0x6c')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x6d'));db[_0x7694('0x6e')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x6f'));db[_0x7694('0x70')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x71'));db[_0x7694('0x72')]=db[_0x7694('0x0')]['import'](_0x7694('0x73'));db[_0x7694('0x74')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x75'));db['CmCompany']=db[_0x7694('0x0')][_0x7694('0x12')]('../api/cmCompany/cmCompany.model');db[_0x7694('0x76')]=db[_0x7694('0x0')]['import'](_0x7694('0x77'));db[_0x7694('0x78')]=db[_0x7694('0x0')]['import'](_0x7694('0x79'));db['CmHopperBlack']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x7a'));db[_0x7694('0x7b')]=db['sequelize'][_0x7694('0x12')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x7694('0x7c')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x7d'));db[_0x7694('0x7e')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x7f'));db['CmCustomField']=db[_0x7694('0x0')][_0x7694('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x7694('0x80')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x81'));db[_0x7694('0x82')]=db[_0x7694('0x0')]['import'](_0x7694('0x83'));db[_0x7694('0x84')]=db['sequelize'][_0x7694('0x12')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x7694('0x12')]('../api/disposition/disposition.model');db[_0x7694('0x85')]=db[_0x7694('0x0')]['import'](_0x7694('0x86'));db[_0x7694('0x87')]=db[_0x7694('0x0')]['import']('../api/interval/interval.model');db['Pause']=db[_0x7694('0x0')][_0x7694('0x12')]('../api/pause/pause.model');db[_0x7694('0x88')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/cdr/cdr.model');db[_0x7694('0x89')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x8a'));db[_0x7694('0x8b')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x8c'));db['Sound']=db[_0x7694('0x0')]['import'](_0x7694('0x8d'));db[_0x7694('0x8e')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x8f'));db[_0x7694('0x90')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x91'));db[_0x7694('0x92')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x93'));db[_0x7694('0x94')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x95'));db[_0x7694('0x96')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x97'));db[_0x7694('0x98')]=db[_0x7694('0x0')]['import'](_0x7694('0x99'));db[_0x7694('0x9a')]=db[_0x7694('0x0')]['import'](_0x7694('0x9b'));db['Integration']=db[_0x7694('0x0')][_0x7694('0x12')]('../api/integration/integration.model');db[_0x7694('0x9c')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x9d'));db['AnalyticCustomReport']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x9e'));db[_0x7694('0x9f')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xa0'));db[_0x7694('0xa1')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xa2'));db[_0x7694('0xa3')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xa4'));db['AnalyticFieldReport']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xa5'));db[_0x7694('0xa6')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xa7'));db[_0x7694('0xa8')]=db['sequelize']['import'](_0x7694('0xa9'));db[_0x7694('0xaa')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xab'));db[_0x7694('0xac')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xad'));db[_0x7694('0xae')]=db['sequelize'][_0x7694('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x7694('0xaf')]=db['sequelize'][_0x7694('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x7694('0xb0')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xb1'));db[_0x7694('0xb2')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x7694('0xb3')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intDeskField/intDeskField.model');db[_0x7694('0xb4')]=db['sequelize'][_0x7694('0x12')](_0x7694('0xb5'));db[_0x7694('0xb6')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xb7'));db[_0x7694('0xb8')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intZohoField/intZohoField.model');db[_0x7694('0xb9')]=db['sequelize']['import'](_0x7694('0xba'));db['ZendeskConfiguration']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xbb'));db[_0x7694('0xbc')]=db[_0x7694('0x0')]['import'](_0x7694('0xbd'));db[_0x7694('0xbe')]=db['sequelize'][_0x7694('0x12')](_0x7694('0xbf'));db['FreshdeskConfiguration']=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x7694('0xc0')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xc1'));db['VtigerAccount']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xc2'));db[_0x7694('0xc3')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x7694('0xc4')]=db[_0x7694('0x0')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x7694('0xc5')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xc6'));db[_0x7694('0xc7')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xc8'));db['Dynamics365Account']=db['sequelize'][_0x7694('0x12')](_0x7694('0xc9'));db[_0x7694('0xca')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x7694('0xcb')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xcc'));db[_0x7694('0xcd')]=db['sequelize'][_0x7694('0x12')](_0x7694('0xce'));db[_0x7694('0xcf')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xd0'));db[_0x7694('0xd1')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xd2'));db[_0x7694('0xd3')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xd4'));db[_0x7694('0xd5')]=db['sequelize'][_0x7694('0x12')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x7694('0x0')]['import'](_0x7694('0xd6'));db[_0x7694('0xd7')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xd8'));db['JscriptyQuestionReport']=db[_0x7694('0x0')]['import'](_0x7694('0xd9'));db[_0x7694('0xda')]=db['sequelize']['import'](_0x7694('0xdb'));db[_0x7694('0xdc')]=db['sequelize']['import'](_0x7694('0xdd'));db[_0x7694('0xde')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xdf'));db[_0x7694('0xe0')]=db['sequelize'][_0x7694('0x12')](_0x7694('0xe1'));db[_0x7694('0xe2')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xe3'));db[_0x7694('0xe4')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xe5'));db[_0x7694('0xe6')]=db['sequelize'][_0x7694('0x12')](_0x7694('0xe7'));db[_0x7694('0xe8')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xe9'));db[_0x7694('0xea')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xeb'));db[_0x7694('0xec')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xed'));db[_0x7694('0xee')]=db['sequelize']['import']('../api/team/team.model');db[_0x7694('0xef')]=db['sequelize'][_0x7694('0x12')](_0x7694('0xf0'));db[_0x7694('0xf1')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xf2'));db[_0x7694('0xf3')]=db['sequelize']['import']('../api/migration/migration.model');db['Attachment']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xf4'));db[_0x7694('0xf5')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xf6'));db[_0x7694('0xf7')]=db[_0x7694('0x0')]['import'](_0x7694('0xf8'));db[_0x7694('0xf9')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xfa'));db[_0x7694('0xfb')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xfc'));db[_0x7694('0xfd')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0xfe'));db[_0x7694('0xff')]=db[_0x7694('0x0')][_0x7694('0x12')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db['sequelize'][_0x7694('0x12')](_0x7694('0x100'));db['VoicePrefix']=db['sequelize'][_0x7694('0x12')](_0x7694('0x101'));db[_0x7694('0x102')]=db[_0x7694('0x0')]['import'](_0x7694('0x103'));db[_0x7694('0x104')]=db['sequelize'][_0x7694('0x12')](_0x7694('0x105'));db[_0x7694('0x106')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x107'));db[_0x7694('0x108')]=db[_0x7694('0x0')]['import'](_0x7694('0x109'));db[_0x7694('0x10a')]=db[_0x7694('0x0')]['import'](_0x7694('0x10b'));db['WhatsappApplication']=db[_0x7694('0x0')]['import'](_0x7694('0x10c'));db['WhatsappInteraction']=db[_0x7694('0x0')][_0x7694('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x10d'));db[_0x7694('0x10e')]=db[_0x7694('0x0')]['import'](_0x7694('0x10f'));db['WhatsappTransferReport']=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x110'));db[_0x7694('0x111')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x112'));db['CloudProvider']=db[_0x7694('0x0')]['import']('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x7694('0x0')]['import'](_0x7694('0x113'));db['TeamVoicePrefix']=db[_0x7694('0x0')]['import'](_0x7694('0x114'));db[_0x7694('0x115')]=db[_0x7694('0x0')]['import'](_0x7694('0x116'));db['UserSetting']=db['sequelize']['import'](_0x7694('0x117'));db[_0x7694('0x118')]=db[_0x7694('0x0')][_0x7694('0x12')](_0x7694('0x119'));db['User']['hasOne'](db[_0x7694('0x1e')],{'as':_0x7694('0x1e'),'onDelete':'cascade','foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11b')](db[_0x7694('0x11c')],{'as':'userSetting','onDelete':'cascade','foreignKey':'UserId'});db[_0x7694('0x11')][_0x7694('0x11d')](db['VoiceRecording'],{'as':_0x7694('0x11e'),'foreignKey':_0x7694('0x11a')});db['User']['hasMany'](db[_0x7694('0x2e')],{'as':'VoiceQueuesRt','foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11d')](db[_0x7694('0x16')],{'as':_0x7694('0x11f'),'onDelete':_0x7694('0x120'),'hooks':!![]});db['User'][_0x7694('0x11d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11d')](db['CmHopperHistory'],{'as':_0x7694('0x121'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11d')](db['ReportAgentPreview'],{'as':_0x7694('0x7e'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11d')](db[_0x7694('0x60')],{'as':'OpenchannelInteractions','foreignKey':_0x7694('0x11a')});db['User'][_0x7694('0x11d')](db[_0x7694('0x6a')],{'as':_0x7694('0x122'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11d')](db[_0x7694('0x123')],{'as':_0x7694('0x124'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11d')](db['FaxInteraction'],{'as':_0x7694('0x125'),'foreignKey':_0x7694('0x11a')});db['User'][_0x7694('0x11d')](db[_0x7694('0x43')],{'as':'MailInteractions','foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')]['hasMany'](db[_0x7694('0x126')],{'as':_0x7694('0x127'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x11')][_0x7694('0x11d')](db['UserNotification'],{'as':_0x7694('0x128'),'foreignKey':_0x7694('0x129')});db[_0x7694('0x11')][_0x7694('0x11d')](db[_0x7694('0x78')],{'as':_0x7694('0x12a'),'foreignKey':_0x7694('0x11a'),'onDelete':_0x7694('0x12b')});db[_0x7694('0x11')][_0x7694('0x12c')](db[_0x7694('0x102')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x7694('0x11')][_0x7694('0x12d')](db['ChatGroup'],{'as':'Groups','through':_0x7694('0x12e')});db['User'][_0x7694('0x12d')](db[_0x7694('0x76')],{'as':_0x7694('0x12f'),'through':_0x7694('0x130')});db[_0x7694('0x11')]['belongsToMany'](db['CmList'],{'as':_0x7694('0x131'),'through':_0x7694('0x132')});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0xee')],{'through':_0x7694('0x133')});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x43')],{'as':'MailInteractions','through':_0x7694('0x134')});db[_0x7694('0x11')][_0x7694('0x12d')](db['ChatInteraction'],{'as':_0x7694('0x122'),'through':_0x7694('0x135')});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x4e')],{'as':_0x7694('0x125'),'through':_0x7694('0x136')});db['User']['belongsToMany'](db[_0x7694('0x123')],{'as':_0x7694('0x124'),'through':_0x7694('0x137')});db['User'][_0x7694('0x12d')](db[_0x7694('0x60')],{'as':'OpenchannelInteractions','through':_0x7694('0x138')});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x126')],{'as':_0x7694('0x127'),'through':_0x7694('0x139')});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x19')],{'as':_0x7694('0x13a'),'through':_0x7694('0x2f'),'required':![]});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x13b')],{'as':_0x7694('0x13c'),'through':_0x7694('0x115'),'required':![]});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x3f')],{'as':'MailQueues','through':_0x7694('0x32'),'required':![]});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x70')],{'as':_0x7694('0x13d'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x7694('0x11')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x5c')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db['User'][_0x7694('0x12d')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x7694('0x37'),'required':![]});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x111')],{'as':_0x7694('0x13e'),'through':_0x7694('0x38'),'required':![]});db['User'][_0x7694('0x12d')](db[_0x7694('0x13f')],{'through':_0x7694('0x132')});db['User'][_0x7694('0x12d')](db[_0x7694('0x66')],{'as':'ChatWebsites','through':_0x7694('0x140')});db[_0x7694('0x11')]['belongsToMany'](db[_0x7694('0x4b')],{'as':_0x7694('0x141'),'through':_0x7694('0x142')});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x3d')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x5e')],{'as':_0x7694('0x143'),'through':'user_has_openchannel_accounts'});db[_0x7694('0x11')]['belongsToMany'](db[_0x7694('0x55')],{'as':_0x7694('0x144'),'through':'user_has_sms_accounts'});db[_0x7694('0x11')][_0x7694('0x12d')](db[_0x7694('0x10a')],{'as':'WhatsappAccounts','through':_0x7694('0x145')});db['VoiceChanSpy']['hasMany'](db[_0x7694('0x16')],{'as':_0x7694('0x146'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x147')});db[_0x7694('0x148')][_0x7694('0x11d')](db[_0x7694('0x16')],{'onDelete':_0x7694('0x120')});db[_0x7694('0x16')][_0x7694('0x11d')](db[_0x7694('0x16')],{'as':_0x7694('0x149'),'onDelete':_0x7694('0x120')});db[_0x7694('0x17')][_0x7694('0x12d')](db[_0x7694('0x14a')],{'as':_0x7694('0x14b'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x7694('0x11d')](db[_0x7694('0x2e')],{'as':'Members','foreignKey':_0x7694('0x14c')});db[_0x7694('0x19')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x7694('0x14c')});db[_0x7694('0x19')][_0x7694('0x11d')](db[_0x7694('0x7b')],{'as':_0x7694('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x7694('0x19')]['hasMany'](db[_0x7694('0x7c')],{'as':_0x7694('0x14e'),'foreignKey':_0x7694('0x14c')});db[_0x7694('0x19')][_0x7694('0x11d')](db[_0x7694('0x7e')],{'as':_0x7694('0x7e'),'foreignKey':_0x7694('0x14c')});db[_0x7694('0x19')][_0x7694('0x11d')](db[_0x7694('0x14f')],{'as':_0x7694('0x150'),'foreignKey':_0x7694('0x14c')});db[_0x7694('0x19')][_0x7694('0x11d')](db[_0x7694('0xda')],{'as':_0x7694('0x151'),'foreignKey':_0x7694('0x14c')});db['VoiceQueue'][_0x7694('0x12c')](db[_0x7694('0x2a')],{'as':_0x7694('0x2a'),'foreignKey':_0x7694('0x152')});db[_0x7694('0x19')][_0x7694('0x12c')](db[_0x7694('0x2a')],{'as':_0x7694('0x153'),'foreignKey':_0x7694('0x154')});db['VoiceQueue']['belongsTo'](db[_0x7694('0x87')],{'as':_0x7694('0x87'),'foreignKey':'IntervalId'});db[_0x7694('0x19')][_0x7694('0x12c')](db[_0x7694('0x155')],{'as':_0x7694('0x156'),'foreignKey':_0x7694('0x157')});db[_0x7694('0x19')][_0x7694('0x12d')](db[_0x7694('0x13f')],{'as':'Lists','through':_0x7694('0x158')});db[_0x7694('0x19')][_0x7694('0x12d')](db['User'],{'as':'Agents','through':_0x7694('0x2f')});db[_0x7694('0x19')]['belongsToMany'](db[_0x7694('0xee')],{'as':_0x7694('0x159'),'through':'TeamVoiceQueue'});db[_0x7694('0x19')]['belongsToMany'](db[_0x7694('0x13f')],{'as':_0x7694('0x15a'),'through':_0x7694('0x15b')});db['VoiceRecording'][_0x7694('0x12c')](db['User'],{'as':_0x7694('0x11'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x1c')][_0x7694('0x12c')](db['User'],{'as':'User','foreignKey':_0x7694('0x11a')});db[_0x7694('0x1e')][_0x7694('0x11d')](db[_0x7694('0x15c')],{'as':_0x7694('0x15d'),'onDelete':'cascade','foreignKey':_0x7694('0x15e'),'sourceKey':_0x7694('0x15f')});db[_0x7694('0x15c')][_0x7694('0x12c')](db['VoiceMail'],{'foreignKey':_0x7694('0x15e'),'targetKey':_0x7694('0x15f')});db['VoiceCallReport']['hasMany'](db[_0x7694('0x26')],{'as':_0x7694('0x160'),'foreignKey':'uniqueid','constraints':![]});db[_0x7694('0x21')][_0x7694('0x11d')](db[_0x7694('0x161')],{'as':_0x7694('0x162'),'foreignKey':'uniqueid','constraints':![]});db[_0x7694('0x21')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x11'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x21')][_0x7694('0x12c')](db['CmContact'],{'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x3a')]['belongsTo'](db[_0x7694('0x3d')],{'as':_0x7694('0x3d'),'foreignKey':_0x7694('0x165')});db[_0x7694('0x3a')][_0x7694('0x12c')](db[_0x7694('0x166')],{'as':_0x7694('0x166'),'foreignKey':'CloudProviderId','onDelete':_0x7694('0x167')});db[_0x7694('0x168')]['belongsTo'](db[_0x7694('0x3d')],{'as':_0x7694('0x3d'),'foreignKey':_0x7694('0x165')});db[_0x7694('0x168')]['belongsTo'](db[_0x7694('0x166')],{'as':_0x7694('0x166'),'foreignKey':_0x7694('0x169'),'onDelete':_0x7694('0x167')});db['MailAccount'][_0x7694('0x11b')](db[_0x7694('0x3a')],{'as':_0x7694('0x16a'),'onDelete':_0x7694('0x120')});db[_0x7694('0x3d')][_0x7694('0x11b')](db[_0x7694('0x168')],{'as':_0x7694('0x16b'),'onDelete':_0x7694('0x120')});db['MailAccount'][_0x7694('0x11d')](db[_0x7694('0x16c')],{'as':'Dispositions','foreignKey':_0x7694('0x165'),'onDelete':_0x7694('0x120')});db[_0x7694('0x3d')][_0x7694('0x11d')](db[_0x7694('0x84')],{'as':_0x7694('0x16d'),'foreignKey':_0x7694('0x165')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x7694('0x3d')][_0x7694('0x11d')](db[_0x7694('0x43')],{'as':_0x7694('0x16e')});db['MailAccount']['hasMany'](db[_0x7694('0x47')],{'as':'Applications','foreignKey':'MailAccountId','onDelete':_0x7694('0x120')});db[_0x7694('0x3d')][_0x7694('0x12c')](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x3d')][_0x7694('0x12c')](db['Template'],{'as':_0x7694('0x96'),'foreignKey':'TemplateId'});db[_0x7694('0x3d')][_0x7694('0x12c')](db[_0x7694('0x155')],{'as':'mandatoryDispositionPause','foreignKey':_0x7694('0x157')});db[_0x7694('0x3d')][_0x7694('0x12d')](db['User'],{'as':'Agents','through':_0x7694('0x171')});db[_0x7694('0x3f')][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x172'),'through':_0x7694('0x32')});db[_0x7694('0x3f')][_0x7694('0x12d')](db['Team'],{'through':_0x7694('0x173'),'as':'Teams'});db['MailInteraction'][_0x7694('0x11d')](db[_0x7694('0x45')],{'as':_0x7694('0x15d'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x174')});db[_0x7694('0x43')][_0x7694('0x12c')](db[_0x7694('0x3d')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x7694('0x43')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':'ContactId'});db[_0x7694('0x43')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x175'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x43')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':'mail_interaction_has_tags','as':_0x7694('0x176')});db[_0x7694('0x43')]['belongsToMany'](db[_0x7694('0x8e')],{'through':_0x7694('0x177'),'as':'ThroughTags'});db[_0x7694('0x43')][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x178'),'through':'user_has_mail_interactions','foreignKey':_0x7694('0x174')});db['MailMessage'][_0x7694('0x11d')](db[_0x7694('0x179')],{'as':_0x7694('0x17a'),'onDelete':_0x7694('0x120')});db[_0x7694('0x45')]['belongsTo'](db[_0x7694('0x11')],{'as':_0x7694('0x11')});db[_0x7694('0x45')]['belongsTo'](db[_0x7694('0x76')],{'onDelete':'cascade','as':'Contact'});db[_0x7694('0x45')][_0x7694('0x12c')](db[_0x7694('0x43')],{'as':'Interaction','foreignKey':_0x7694('0x174')});db[_0x7694('0x45')][_0x7694('0x12c')](db[_0x7694('0x3d')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x165')});db[_0x7694('0x45')][_0x7694('0x12c')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x7694('0x17c')});db['MailMessage'][_0x7694('0x12c')](db['ChatOfflineMessage'],{'as':_0x7694('0x6e'),'foreignKey':_0x7694('0x17d')});db[_0x7694('0x47')][_0x7694('0x12c')](db[_0x7694('0x11')],{'onDelete':_0x7694('0x167')});db[_0x7694('0x47')][_0x7694('0x12c')](db[_0x7694('0x3f')],{'onDelete':_0x7694('0x167')});db['MailApplication'][_0x7694('0x12c')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0x7694('0x12c')](db[_0x7694('0x87')],{'onDelete':_0x7694('0x167'),'foreignKey':_0x7694('0x17e')});db[_0x7694('0x47')][_0x7694('0x12c')](db[_0x7694('0x8e')],{'onDelete':_0x7694('0x167'),'foreignKey':_0x7694('0x17f')});db[_0x7694('0x180')][_0x7694('0x12c')](db[_0x7694('0x3d')],{});db['MailQueueReport'][_0x7694('0x12c')](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x180')]['belongsTo'](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':'ContactId'});db[_0x7694('0x180')][_0x7694('0x12c')](db[_0x7694('0x43')],{});db[_0x7694('0x180')][_0x7694('0x12c')](db[_0x7694('0x45')],{});db[_0x7694('0x180')][_0x7694('0x12c')](db[_0x7694('0x11')],{});db[_0x7694('0x180')][_0x7694('0x12c')](db[_0x7694('0x3f')],{});db[_0x7694('0x181')][_0x7694('0x11d')](db['DashboardItem'],{'as':_0x7694('0x182'),'onDelete':_0x7694('0x120')});db[_0x7694('0x4b')][_0x7694('0x11d')](db['Disposition'],{'as':_0x7694('0x183'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x7694('0x4b')][_0x7694('0x11d')](db[_0x7694('0x84')],{'as':_0x7694('0x16d'),'foreignKey':_0x7694('0x184')});db[_0x7694('0x4b')][_0x7694('0x11d')](db['FaxInteraction'],{'as':_0x7694('0x16e')});db[_0x7694('0x4b')][_0x7694('0x11d')](db[_0x7694('0x4c')],{'as':_0x7694('0x149'),'foreignKey':_0x7694('0x184'),'onDelete':'cascade'});db[_0x7694('0x4b')][_0x7694('0x11d')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x7694('0x120')});db['FaxAccount'][_0x7694('0x11d')](db[_0x7694('0x4f')],{'as':_0x7694('0x15d')});db[_0x7694('0x4b')][_0x7694('0x12c')](db['Trunk'],{'as':_0x7694('0x2a')});db[_0x7694('0x4b')]['belongsTo'](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db['FaxAccount']['belongsTo'](db[_0x7694('0x155')],{'as':_0x7694('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7694('0x4b')][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x7694('0x4c')]['belongsTo'](db[_0x7694('0x11')],{'onDelete':'restrict'});db[_0x7694('0x4c')][_0x7694('0x12c')](db[_0x7694('0x51')],{'onDelete':_0x7694('0x167')});db['FaxApplication'][_0x7694('0x12c')](db[_0x7694('0x4b')],{'onDelete':'restrict'});db[_0x7694('0x4c')]['belongsTo'](db[_0x7694('0x8e')],{'onDelete':_0x7694('0x167'),'foreignKey':'TagId'});db[_0x7694('0x4e')][_0x7694('0x11d')](db['FaxMessage'],{'as':'Messages','onDelete':_0x7694('0x120'),'foreignKey':'FaxInteractionId'});db[_0x7694('0x4e')][_0x7694('0x12c')](db[_0x7694('0x4b')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x184')});db[_0x7694('0x4e')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x4e')]['belongsTo'](db[_0x7694('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x7694('0x4e')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':_0x7694('0x185'),'as':_0x7694('0x176')});db[_0x7694('0x4e')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':_0x7694('0x185'),'as':_0x7694('0x186')});db[_0x7694('0x4e')][_0x7694('0x12d')](db['User'],{'as':'Users','through':_0x7694('0x136'),'foreignKey':_0x7694('0x187')});db[_0x7694('0x4f')][_0x7694('0x12c')](db[_0x7694('0x11')],{'onDelete':_0x7694('0x120'),'as':_0x7694('0x11')});db[_0x7694('0x4f')][_0x7694('0x12c')](db[_0x7694('0x4e')],{'as':_0x7694('0x188'),'foreignKey':_0x7694('0x187')});db[_0x7694('0x4f')][_0x7694('0x12c')](db[_0x7694('0x76')],{'onDelete':_0x7694('0x120'),'as':'Contact'});db['FaxMessage'][_0x7694('0x12c')](db['Attachment'],{'as':_0x7694('0x179'),'foreignKey':_0x7694('0x189')});db[_0x7694('0x4f')]['belongsTo'](db[_0x7694('0x4b')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x184')});db['FaxQueue'][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':_0x7694('0x172'),'through':_0x7694('0x33')});db[_0x7694('0x51')][_0x7694('0x12d')](db[_0x7694('0xee')],{'through':_0x7694('0x18a'),'as':_0x7694('0x159')});db['FaxQueueReport'][_0x7694('0x12c')](db[_0x7694('0x4b')],{});db[_0x7694('0x53')][_0x7694('0x12c')](db['CmList'],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x53')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x53')][_0x7694('0x12c')](db[_0x7694('0x4e')],{});db[_0x7694('0x53')][_0x7694('0x12c')](db[_0x7694('0x4f')],{});db[_0x7694('0x53')][_0x7694('0x12c')](db[_0x7694('0x11')],{});db['FaxQueueReport']['belongsTo'](db[_0x7694('0x51')],{});db[_0x7694('0x55')][_0x7694('0x11d')](db[_0x7694('0x16c')],{'as':'Dispositions','foreignKey':_0x7694('0x18b'),'onDelete':_0x7694('0x120')});db[_0x7694('0x55')][_0x7694('0x11d')](db['CannedAnswer'],{'as':_0x7694('0x16d'),'foreignKey':_0x7694('0x18b')});db['SmsAccount'][_0x7694('0x11d')](db[_0x7694('0x5a')],{'as':'Messages','foreignKey':_0x7694('0x18b')});db[_0x7694('0x55')]['hasMany'](db['SmsInteraction'],{'as':_0x7694('0x16e')});db[_0x7694('0x55')][_0x7694('0x11d')](db[_0x7694('0x57')],{'as':_0x7694('0x149'),'foreignKey':_0x7694('0x18b'),'onDelete':_0x7694('0x120')});db[_0x7694('0x55')]['belongsTo'](db[_0x7694('0x13f')],{'as':'List','foreignKey':_0x7694('0x170')});db[_0x7694('0x55')]['belongsTo'](db[_0x7694('0x155')],{'as':_0x7694('0x156'),'foreignKey':_0x7694('0x157')});db[_0x7694('0x55')][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x172'),'through':'user_has_sms_accounts'});db[_0x7694('0x57')][_0x7694('0x12c')](db[_0x7694('0x11')],{'onDelete':_0x7694('0x167')});db[_0x7694('0x57')][_0x7694('0x12c')](db[_0x7694('0x5c')],{'onDelete':_0x7694('0x167')});db[_0x7694('0x57')][_0x7694('0x12c')](db['SmsAccount'],{'onDelete':_0x7694('0x167')});db[_0x7694('0x57')][_0x7694('0x12c')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x7694('0x17e')});db[_0x7694('0x57')][_0x7694('0x12c')](db['Tag'],{'onDelete':_0x7694('0x167'),'foreignKey':_0x7694('0x17f')});db[_0x7694('0x123')]['hasMany'](db['SmsMessage'],{'as':_0x7694('0x15d'),'onDelete':_0x7694('0x120'),'foreignKey':'SmsInteractionId'});db[_0x7694('0x123')][_0x7694('0x12c')](db[_0x7694('0x55')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x18b')});db[_0x7694('0x123')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x123')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x7694('0x123')][_0x7694('0x12d')](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction'][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':_0x7694('0x18c'),'as':_0x7694('0x186')});db['SmsInteraction'][_0x7694('0x12d')](db['User'],{'as':'Users','through':_0x7694('0x137'),'foreignKey':_0x7694('0x18d')});db[_0x7694('0x5a')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':'User'});db[_0x7694('0x5a')][_0x7694('0x12c')](db[_0x7694('0x76')],{'onDelete':_0x7694('0x120'),'as':_0x7694('0x163')});db['SmsMessage'][_0x7694('0x12c')](db[_0x7694('0x123')],{'onDelete':_0x7694('0x120'),'as':'Interaction','foreignKey':_0x7694('0x18d')});db[_0x7694('0x5a')][_0x7694('0x12c')](db[_0x7694('0x55')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x18b')});db[_0x7694('0x5c')][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x172'),'through':_0x7694('0x35'),'foreignKey':_0x7694('0x18e')});db['SmsQueue'][_0x7694('0x12d')](db[_0x7694('0xee')],{'through':'team_has_sms_queues','as':_0x7694('0x159')});db[_0x7694('0x5e')][_0x7694('0x11d')](db[_0x7694('0x16c')],{'as':_0x7694('0x183'),'foreignKey':'OpenchannelAccountId','onDelete':_0x7694('0x120')});db[_0x7694('0x5e')][_0x7694('0x11d')](db[_0x7694('0x84')],{'as':_0x7694('0x16d'),'foreignKey':_0x7694('0x18f')});db[_0x7694('0x5e')][_0x7694('0x11d')](db[_0x7694('0x60')],{'as':_0x7694('0x16e'),'foreignKey':_0x7694('0x18f')});db[_0x7694('0x5e')][_0x7694('0x11d')](db[_0x7694('0x62')],{'as':_0x7694('0x15d'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x7694('0x11d')](db[_0x7694('0x190')],{'as':_0x7694('0x149'),'foreignKey':_0x7694('0x18f'),'onDelete':_0x7694('0x120')});db[_0x7694('0x5e')]['belongsTo'](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x5e')][_0x7694('0x12c')](db[_0x7694('0x155')],{'as':_0x7694('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7694('0x5e')]['belongsToMany'](db[_0x7694('0x11')],{'as':_0x7694('0x172'),'through':'user_has_openchannel_accounts'});db[_0x7694('0x190')][_0x7694('0x12c')](db[_0x7694('0x11')],{'onDelete':_0x7694('0x167')});db[_0x7694('0x190')][_0x7694('0x12c')](db[_0x7694('0x64')],{'onDelete':_0x7694('0x167'),'foreignKey':_0x7694('0x191')});db[_0x7694('0x190')][_0x7694('0x12c')](db[_0x7694('0x5e')],{'onDelete':_0x7694('0x167'),'foreignKey':_0x7694('0x18f')});db['OpenchannelApplication'][_0x7694('0x12c')](db[_0x7694('0x87')],{'onDelete':_0x7694('0x167'),'foreignKey':_0x7694('0x17e')});db[_0x7694('0x190')]['belongsTo'](db[_0x7694('0x8e')],{'onDelete':_0x7694('0x167'),'foreignKey':'TagId'});db[_0x7694('0x60')][_0x7694('0x11d')](db[_0x7694('0x62')],{'as':_0x7694('0x15d'),'onDelete':_0x7694('0x120'),'foreignKey':'OpenchannelInteractionId'});db[_0x7694('0x60')][_0x7694('0x12c')](db['OpenchannelAccount'],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x18f')});db[_0x7694('0x60')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db['OpenchannelInteraction'][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x175'),'foreignKey':_0x7694('0x11a')});db[_0x7694('0x60')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':'openchannel_interaction_has_tags','as':_0x7694('0x176')});db[_0x7694('0x60')][_0x7694('0x12d')](db['Tag'],{'through':_0x7694('0x192'),'as':_0x7694('0x186')});db[_0x7694('0x60')][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':'Users','through':_0x7694('0x138'),'foreignKey':_0x7694('0x193')});db['OpenchannelMessage'][_0x7694('0x12c')](db[_0x7694('0x11')],{'onDelete':_0x7694('0x120'),'as':_0x7694('0x11')});db[_0x7694('0x62')][_0x7694('0x12c')](db[_0x7694('0x76')],{'onDelete':_0x7694('0x120'),'as':'Contact'});db[_0x7694('0x62')][_0x7694('0x12c')](db[_0x7694('0x60')],{'onDelete':_0x7694('0x120'),'as':_0x7694('0x188'),'foreignKey':_0x7694('0x193')});db[_0x7694('0x62')]['belongsTo'](db[_0x7694('0x179')],{'as':_0x7694('0x179'),'foreignKey':'AttachmentId'});db[_0x7694('0x62')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x18f')});db['OpenchannelQueue'][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':_0x7694('0x172'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x7694('0x12d')](db[_0x7694('0xee')],{'through':_0x7694('0x194'),'as':_0x7694('0x159')});db[_0x7694('0x66')][_0x7694('0x11d')](db[_0x7694('0x16c')],{'as':_0x7694('0x183'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db['ChatWebsite'][_0x7694('0x11d')](db[_0x7694('0x84')],{'as':_0x7694('0x16d'),'foreignKey':_0x7694('0x17c')});db[_0x7694('0x66')][_0x7694('0x11d')](db[_0x7694('0x74')],{'as':_0x7694('0x195')});db[_0x7694('0x66')][_0x7694('0x11d')](db[_0x7694('0x6a')],{'as':_0x7694('0x16e')});db['ChatWebsite'][_0x7694('0x11d')](db[_0x7694('0x196')],{'as':_0x7694('0x149'),'foreignKey':_0x7694('0x17c'),'onDelete':'cascade'});db[_0x7694('0x66')][_0x7694('0x11d')](db[_0x7694('0x6c')],{'as':_0x7694('0x15d')});db[_0x7694('0x66')]['belongsTo'](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x66')][_0x7694('0x12c')](db['Interval'],{'as':'Interval','foreignKey':_0x7694('0x17e')});db[_0x7694('0x66')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x7694('0x165')});db[_0x7694('0x66')]['belongsTo'](db[_0x7694('0x155')],{'as':_0x7694('0x156'),'foreignKey':_0x7694('0x157')});db[_0x7694('0x66')]['belongsToMany'](db[_0x7694('0x11')],{'as':_0x7694('0x172'),'through':_0x7694('0x140')});db['OpenchannelQueueReport'][_0x7694('0x12c')](db[_0x7694('0x5e')],{});db[_0x7694('0x68')]['belongsTo'](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x68')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x7694('0x68')]['belongsTo'](db[_0x7694('0x62')],{});db[_0x7694('0x68')][_0x7694('0x12c')](db[_0x7694('0x11')],{});db[_0x7694('0x68')][_0x7694('0x12c')](db['OpenchannelQueue'],{});db[_0x7694('0x196')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x197'),'foreignKey':_0x7694('0x11a'),'onDelete':_0x7694('0x167')});db['ChatApplication'][_0x7694('0x12c')](db[_0x7694('0x70')],{'as':'Queue','foreignKey':_0x7694('0x198'),'onDelete':_0x7694('0x167')});db[_0x7694('0x196')][_0x7694('0x12c')](db[_0x7694('0x66')],{'as':_0x7694('0x199'),'foreignKey':_0x7694('0x17c'),'onDelete':'restrict'});db[_0x7694('0x196')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x7694('0x17f')});db['ChatInteraction'][_0x7694('0x11d')](db['ChatMessage'],{'as':'Messages','onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x19a')});db[_0x7694('0x6a')][_0x7694('0x12c')](db[_0x7694('0x66')],{'as':_0x7694('0x17b'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x6a')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x175'),'foreignKey':_0x7694('0x11a')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x7694('0x19b'),'as':'Tags'});db[_0x7694('0x6a')]['belongsToMany'](db['Tag'],{'through':_0x7694('0x19b'),'as':'ThroughTags'});db[_0x7694('0x6a')][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':_0x7694('0x178'),'through':_0x7694('0x135'),'foreignKey':_0x7694('0x19a')});db[_0x7694('0x6c')][_0x7694('0x12c')](db[_0x7694('0x11')],{'onDelete':'cascade','as':'User'});db['ChatMessage'][_0x7694('0x12c')](db['CmContact'],{'onDelete':_0x7694('0x120'),'as':_0x7694('0x163'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x6c')]['belongsTo'](db[_0x7694('0x6a')],{'onDelete':_0x7694('0x120'),'as':_0x7694('0x188'),'foreignKey':_0x7694('0x19a')});db[_0x7694('0x6c')][_0x7694('0x12c')](db[_0x7694('0x179')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x7694('0x6c')][_0x7694('0x12c')](db[_0x7694('0x66')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x17c')});db[_0x7694('0x6e')][_0x7694('0x11d')](db[_0x7694('0x179')],{'as':_0x7694('0x17a'),'foreignKey':_0x7694('0x17d'),'onDelete':_0x7694('0x120'),'hooks':!![]});db['ChatOfflineMessage'][_0x7694('0x12c')](db[_0x7694('0x76')],{'onDelete':_0x7694('0x120'),'as':_0x7694('0x163'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x7694('0x12c')](db[_0x7694('0x66')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x17c')});db[_0x7694('0x70')][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':_0x7694('0x172'),'through':_0x7694('0x19c'),'hooks':!![]});db[_0x7694('0x70')][_0x7694('0x12d')](db[_0x7694('0xee')],{'through':_0x7694('0x19d'),'as':_0x7694('0x159')});db['ChatGroup'][_0x7694('0x11d')](db[_0x7694('0x19e')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0x7694('0x120')});db['ChatGroup'][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':_0x7694('0x19f'),'through':_0x7694('0x12e')});db[_0x7694('0x74')]['belongsTo'](db[_0x7694('0x66')],{'as':'Website','foreignKey':_0x7694('0x17c')});db[_0x7694('0x1a0')]['hasMany'](db[_0x7694('0x76')],{'as':_0x7694('0x12f'),'foreignKey':_0x7694('0x1a1')});db[_0x7694('0x76')][_0x7694('0x11d')](db[_0x7694('0x92')],{'as':_0x7694('0x1a2'),'foreignKey':'CmContactId'});db['CmContact'][_0x7694('0x11d')](db['CmHopper'],{'as':_0x7694('0x12a'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x76')][_0x7694('0x11d')](db[_0x7694('0x7b')],{'as':_0x7694('0x14d'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x76')][_0x7694('0x11d')](db[_0x7694('0x7c')],{'as':_0x7694('0x14e'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x76')][_0x7694('0x11d')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x7694('0x164')});db[_0x7694('0x76')][_0x7694('0x11d')](db[_0x7694('0xda')],{'as':_0x7694('0x151'),'foreignKey':_0x7694('0x164')});db[_0x7694('0x76')][_0x7694('0x11d')](db['OpenchannelInteraction'],{'as':_0x7694('0x1a3'),'foreignKey':_0x7694('0x164'),'onDelete':_0x7694('0x167')});db['CmContact'][_0x7694('0x11d')](db[_0x7694('0x6a')],{'as':_0x7694('0x122'),'foreignKey':_0x7694('0x164'),'onDelete':_0x7694('0x167')});db[_0x7694('0x76')][_0x7694('0x11d')](db[_0x7694('0x123')],{'as':_0x7694('0x124'),'foreignKey':_0x7694('0x164'),'onDelete':_0x7694('0x167')});db['CmContact'][_0x7694('0x11d')](db[_0x7694('0x4e')],{'as':_0x7694('0x125'),'foreignKey':_0x7694('0x164'),'onDelete':_0x7694('0x167')});db[_0x7694('0x76')][_0x7694('0x11d')](db[_0x7694('0x43')],{'as':_0x7694('0x1a4'),'foreignKey':'ContactId','onDelete':_0x7694('0x167')});db[_0x7694('0x76')]['belongsTo'](db['CmCompany'],{'as':_0x7694('0x1a5'),'foreignKey':_0x7694('0x1a1')});db[_0x7694('0x76')][_0x7694('0x12c')](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170'),'onDelete':_0x7694('0x120')});db['CmContact'][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x178'),'through':_0x7694('0x130')});db[_0x7694('0x76')][_0x7694('0x12d')](db['Tag'],{'as':_0x7694('0x176'),'through':'cm_contact_has_tags'});db[_0x7694('0x76')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':_0x7694('0x1a6'),'as':'ThroughTags'});db[_0x7694('0x78')][_0x7694('0x11d')](db[_0x7694('0x94')],{'as':_0x7694('0x1a7'),'foreignKey':_0x7694('0x1a8')});db[_0x7694('0x78')]['belongsTo'](db['CmContact'],{'as':_0x7694('0x163'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0x7694('0x12c')](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170'),'onDelete':'cascade'});db[_0x7694('0x78')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x197'),'foreignKey':_0x7694('0x11a')});db['CmHopper'][_0x7694('0x12c')](db[_0x7694('0x19')],{'as':_0x7694('0x1a9'),'foreignKey':_0x7694('0x14c'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x7694('0xf1')],{'as':_0x7694('0xf1'),'foreignKey':_0x7694('0x1aa'),'onDelete':_0x7694('0x120')});db[_0x7694('0x78')][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x175'),'foreignKey':_0x7694('0x1ab')});db[_0x7694('0x14f')]['belongsTo'](db[_0x7694('0x76')],{'as':'Contact','foreignKey':_0x7694('0x164'),'onDelete':_0x7694('0x120')});db['CmHopperBlack']['belongsTo'](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':'ListId','onDelete':_0x7694('0x120')});db['CmHopperBlack']['belongsTo'](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x7694('0x14c'),'onDelete':'cascade'});db[_0x7694('0x14f')][_0x7694('0x12c')](db[_0x7694('0xf1')],{'as':_0x7694('0xf1'),'foreignKey':_0x7694('0x1aa'),'onDelete':_0x7694('0x120')});db['Automation'][_0x7694('0x11d')](db[_0x7694('0x85')],{'as':{'plural':_0x7694('0x1ac'),'singular':_0x7694('0x1ad')},'foreignKey':_0x7694('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x7694('0x82')]['hasMany'](db[_0x7694('0x85')],{'as':{'plural':'Any','singular':_0x7694('0x1af')},'foreignKey':_0x7694('0x1b0'),'onDelete':_0x7694('0x120'),'hooks':!![]});db[_0x7694('0x82')]['hasMany'](db[_0x7694('0x80')],{'as':_0x7694('0x1b1'),'foreignKey':_0x7694('0x1b2'),'onDelete':_0x7694('0x120'),'hooks':!![]});db[_0x7694('0x16c')][_0x7694('0x11d')](db[_0x7694('0x16c')],{'as':'Dispositions','foreignKey':_0x7694('0x1b3'),'onDelete':_0x7694('0x120')});db[_0x7694('0x87')][_0x7694('0x11d')](db['Interval'],{'as':_0x7694('0x1b4'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x7694('0x16')],{'as':_0x7694('0x11f'),'foreignKey':_0x7694('0x17e'),'onDelete':_0x7694('0x167')});db[_0x7694('0x87')][_0x7694('0x11d')](db['MailApplication'],{'as':_0x7694('0x1b5'),'foreignKey':'IntervalId'});db[_0x7694('0x87')]['hasMany'](db[_0x7694('0x196')],{'as':'ChatApplications','foreignKey':_0x7694('0x17e')});db[_0x7694('0x87')][_0x7694('0x11d')](db[_0x7694('0x4c')],{'as':_0x7694('0x1b6'),'foreignKey':'IntervalId'});db[_0x7694('0x87')][_0x7694('0x11d')](db[_0x7694('0x57')],{'as':_0x7694('0x1b7'),'foreignKey':_0x7694('0x17e')});db[_0x7694('0x8b')]['belongsTo'](db[_0x7694('0x3d')],{});db['Schedule'][_0x7694('0x12c')](db[_0x7694('0x9f')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x7694('0x1b8')});db[_0x7694('0x14a')][_0x7694('0x12d')](db[_0x7694('0x17')],{'as':_0x7694('0x1b9'),'through':_0x7694('0x1ba'),'onDelete':'restrict'});db[_0x7694('0x8e')]['belongsToMany'](db[_0x7694('0x76')],{'through':_0x7694('0x1a6')});db[_0x7694('0x8e')][_0x7694('0x12d')](db[_0x7694('0x6a')],{'through':_0x7694('0x19b')});db[_0x7694('0x8e')][_0x7694('0x12d')](db[_0x7694('0x43')],{'through':_0x7694('0x177')});db['Tag']['belongsToMany'](db['SmsInteraction'],{'through':_0x7694('0x18c')});db[_0x7694('0x8e')][_0x7694('0x12d')](db[_0x7694('0x4e')],{'through':_0x7694('0x185')});db['Tag'][_0x7694('0x12d')](db[_0x7694('0x60')],{'through':_0x7694('0x192')});db[_0x7694('0x8e')][_0x7694('0x12d')](db[_0x7694('0x126')],{'through':'whatsapp_interaction_has_tags'});db[_0x7694('0x92')]['belongsTo'](db[_0x7694('0x90')],{'as':_0x7694('0x1bb'),'foreignKey':'ItemTypeId'});db[_0x7694('0x94')][_0x7694('0x12c')](db[_0x7694('0x78')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x7694('0x92')]['belongsTo'](db[_0x7694('0x76')],{'as':'Contact','foreignKey':_0x7694('0x1bc')});db[_0x7694('0x98')]['hasMany'](db['Condition'],{'as':{'plural':_0x7694('0x1bd'),'singular':_0x7694('0x1be')},'foreignKey':_0x7694('0x1bf'),'onDelete':_0x7694('0x120'),'hooks':!![]});db['Trigger'][_0x7694('0x11d')](db[_0x7694('0x85')],{'as':{'plural':_0x7694('0x1c0'),'singular':_0x7694('0x1c1')},'foreignKey':_0x7694('0x1c2'),'onDelete':_0x7694('0x120'),'hooks':!![]});db['Trigger'][_0x7694('0x11d')](db[_0x7694('0x80')],{'as':_0x7694('0x1b1'),'foreignKey':'TriggerId','onDelete':_0x7694('0x120'),'hooks':!![]});db[_0x7694('0x1c3')][_0x7694('0x11d')](db['AnalyticFieldReport'],{'as':_0x7694('0x1c4'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1b8'),'hooks':!![]});db[_0x7694('0x9f')][_0x7694('0x11d')](db[_0x7694('0x1c5')],{'as':_0x7694('0x1c4'),'onDelete':_0x7694('0x120'),'foreignKey':'DefaultReportId'});db[_0x7694('0xa3')][_0x7694('0x11d')](db[_0x7694('0x1c5')],{'as':_0x7694('0x1c4'),'onDelete':_0x7694('0x120'),'foreignKey':'MetricId'});db[_0x7694('0x1c5')][_0x7694('0x12c')](db[_0x7694('0xa3')],{'foreignKey':_0x7694('0x1c6')});db[_0x7694('0xa8')]['hasMany'](db[_0x7694('0xaa')],{'as':_0x7694('0x1c7'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xaa')][_0x7694('0x11d')](db['SalesforceField'],{'as':_0x7694('0x1c9'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0xaa')]['hasMany'](db['SalesforceField'],{'as':_0x7694('0x1cb'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1cc')});db['SalesforceConfiguration'][_0x7694('0x11d')](db[_0x7694('0xac')],{'as':_0x7694('0x1c4'),'onDelete':'cascade','foreignKey':_0x7694('0x1cd')});db[_0x7694('0xaa')][_0x7694('0x12c')](db[_0x7694('0xa8')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xac')][_0x7694('0x11d')](db[_0x7694('0xac')],{'as':_0x7694('0x1ce'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0xac')][_0x7694('0x11d')](db[_0x7694('0xac')],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x7694('0x1d0'),'foreignKey':_0x7694('0x1cd')});db[_0x7694('0xac')][_0x7694('0x12c')](db[_0x7694('0x9a')],{'as':_0x7694('0x9a'),'foreignKey':_0x7694('0x1d1')});db['SugarcrmAccount']['hasMany'](db[_0x7694('0xaf')],{'as':_0x7694('0x1c7'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xaf')][_0x7694('0x11d')](db[_0x7694('0xb0')],{'as':_0x7694('0x1c9'),'onDelete':_0x7694('0x120'),'foreignKey':'SubjectId'});db[_0x7694('0xaf')][_0x7694('0x11d')](db[_0x7694('0xb0')],{'as':_0x7694('0x1cb'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0xaf')][_0x7694('0x11d')](db['SugarcrmField'],{'as':_0x7694('0x1c4'),'onDelete':_0x7694('0x120'),'foreignKey':'FieldId'});db[_0x7694('0xaf')][_0x7694('0x12c')](db[_0x7694('0xae')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xb0')][_0x7694('0x11d')](db[_0x7694('0xb0')],{'as':_0x7694('0x1ce'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0xb0')][_0x7694('0x11d')](db[_0x7694('0xb0')],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0xb0')][_0x7694('0x11d')](db['SugarcrmField'],{'as':_0x7694('0x1d0'),'foreignKey':_0x7694('0x1cd')});db[_0x7694('0xb0')]['belongsTo'](db[_0x7694('0x9a')],{'as':_0x7694('0x9a'),'foreignKey':_0x7694('0x1d1')});db[_0x7694('0xb2')][_0x7694('0x11d')](db[_0x7694('0xb3')],{'as':_0x7694('0x1c7'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xb3')][_0x7694('0x11d')](db[_0x7694('0x1d2')],{'as':_0x7694('0x1c9'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1ca')});db['DeskConfiguration'][_0x7694('0x11d')](db['DeskField'],{'as':_0x7694('0x1cb'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7694('0xb3')][_0x7694('0x11d')](db['DeskField'],{'as':_0x7694('0x1c4'),'onDelete':_0x7694('0x120'),'foreignKey':'FieldId'});db[_0x7694('0xb3')][_0x7694('0x12c')](db['DeskAccount'],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db['DeskConfiguration'][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':'int_desk_configuration_has_tags'});db[_0x7694('0x1d2')][_0x7694('0x11d')](db['DeskField'],{'as':_0x7694('0x1ce'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0x1d2')][_0x7694('0x11d')](db[_0x7694('0x1d2')],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0x1d2')][_0x7694('0x11d')](db[_0x7694('0x1d2')],{'as':_0x7694('0x1d0'),'foreignKey':_0x7694('0x1cd')});db[_0x7694('0x1d2')]['belongsTo'](db[_0x7694('0x9a')],{'as':_0x7694('0x9a'),'foreignKey':_0x7694('0x1d1')});db['ZohoAccount'][_0x7694('0x11d')](db['ZohoConfiguration'],{'as':_0x7694('0x1c7'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xb6')]['hasMany'](db[_0x7694('0xb8')],{'as':_0x7694('0x1c9'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1ca')});db['ZohoConfiguration']['hasMany'](db[_0x7694('0xb8')],{'as':_0x7694('0x1cb'),'onDelete':_0x7694('0x120'),'foreignKey':'DescriptionId'});db[_0x7694('0xb6')][_0x7694('0x11d')](db[_0x7694('0xb8')],{'as':_0x7694('0x1c4'),'onDelete':_0x7694('0x120'),'foreignKey':'FieldId'});db[_0x7694('0xb6')]['belongsTo'](db[_0x7694('0xb4')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xb8')][_0x7694('0x11d')](db['ZohoField'],{'as':_0x7694('0x1ce'),'foreignKey':'SubjectId'});db[_0x7694('0xb8')][_0x7694('0x11d')](db['ZohoField'],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0xb8')][_0x7694('0x11d')](db[_0x7694('0xb8')],{'as':_0x7694('0x1d0'),'foreignKey':_0x7694('0x1cd')});db[_0x7694('0xb8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x7694('0xb9')][_0x7694('0x11d')](db['ZendeskConfiguration'],{'as':_0x7694('0x1c7'),'onDelete':'cascade','foreignKey':_0x7694('0x1c8')});db['ZendeskConfiguration'][_0x7694('0x11d')](db['ZendeskField'],{'as':_0x7694('0x1c9'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0x1d3')]['hasMany'](db[_0x7694('0xbc')],{'as':_0x7694('0x1cb'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0x1d3')][_0x7694('0x11d')](db[_0x7694('0xbc')],{'as':'Fields','foreignKey':_0x7694('0x1cd')});db[_0x7694('0x1d3')][_0x7694('0x12c')](db[_0x7694('0xb9')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0x1d3')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':_0x7694('0x1d4')});db[_0x7694('0xbc')][_0x7694('0x11d')](db[_0x7694('0xbc')],{'as':'Subject','foreignKey':_0x7694('0x1ca')});db[_0x7694('0xbc')][_0x7694('0x11d')](db[_0x7694('0xbc')],{'as':_0x7694('0x1cf'),'foreignKey':'DescriptionId'});db[_0x7694('0xbc')]['hasMany'](db[_0x7694('0xbc')],{'as':_0x7694('0x1d0'),'foreignKey':_0x7694('0x1cd')});db[_0x7694('0xbc')]['belongsTo'](db['Variable'],{'as':_0x7694('0x9a'),'foreignKey':'VariableId'});db[_0x7694('0xbe')][_0x7694('0x11d')](db[_0x7694('0x1d5')],{'as':_0x7694('0x1c7'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1c8')});db['FreshdeskConfiguration'][_0x7694('0x11d')](db[_0x7694('0xc0')],{'as':_0x7694('0x1c9'),'onDelete':'cascade','foreignKey':_0x7694('0x1ca')});db[_0x7694('0x1d5')][_0x7694('0x11d')](db[_0x7694('0xc0')],{'as':_0x7694('0x1cb'),'onDelete':_0x7694('0x120'),'foreignKey':'DescriptionId'});db[_0x7694('0x1d5')][_0x7694('0x11d')](db[_0x7694('0xc0')],{'as':_0x7694('0x1c4'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1cd')});db['FreshdeskConfiguration']['belongsTo'](db[_0x7694('0xbe')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0x1d5')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x7694('0xc0')][_0x7694('0x11d')](db['FreshdeskField'],{'as':_0x7694('0x1ce'),'foreignKey':_0x7694('0x1ca')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db['FreshdeskField'][_0x7694('0x11d')](db[_0x7694('0xc0')],{'as':_0x7694('0x1d0'),'foreignKey':'FieldId'});db[_0x7694('0xc0')]['belongsTo'](db[_0x7694('0x9a')],{'as':_0x7694('0x9a'),'foreignKey':'VariableId'});db[_0x7694('0x1d6')]['hasMany'](db[_0x7694('0xc3')],{'as':_0x7694('0x1c7'),'onDelete':'cascade','foreignKey':_0x7694('0x1c8')});db[_0x7694('0xc3')][_0x7694('0x11d')](db[_0x7694('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x7694('0x11d')](db[_0x7694('0xc4')],{'as':_0x7694('0x1cb'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0xc3')]['hasMany'](db[_0x7694('0xc4')],{'as':_0x7694('0x1c4'),'foreignKey':'FieldId'});db[_0x7694('0xc3')][_0x7694('0x12c')](db[_0x7694('0x1d6')],{'as':'Account','foreignKey':'AccountId'});db[_0x7694('0xc4')][_0x7694('0x11d')](db[_0x7694('0xc4')],{'as':_0x7694('0x1ce'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0xc4')][_0x7694('0x11d')](db[_0x7694('0xc4')],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0xc4')][_0x7694('0x11d')](db[_0x7694('0xc4')],{'as':'Field','foreignKey':_0x7694('0x1cd')});db[_0x7694('0xc4')][_0x7694('0x12c')](db[_0x7694('0x9a')],{'as':_0x7694('0x9a'),'foreignKey':_0x7694('0x1d1')});db[_0x7694('0xc5')][_0x7694('0x11d')](db[_0x7694('0x1d7')],{'as':'Configurations','onDelete':_0x7694('0x120'),'foreignKey':'AccountId'});db[_0x7694('0x1d7')]['hasMany'](db[_0x7694('0xc7')],{'as':'Subjects','foreignKey':_0x7694('0x1ca')});db[_0x7694('0x1d7')][_0x7694('0x11d')](db['ServicenowField'],{'as':_0x7694('0x1cb'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0x1d7')][_0x7694('0x11d')](db['ServicenowField'],{'as':_0x7694('0x1c4'),'foreignKey':_0x7694('0x1cd')});db[_0x7694('0x1d7')][_0x7694('0x12c')](db[_0x7694('0xc5')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xc7')][_0x7694('0x11d')](db['ServicenowField'],{'as':_0x7694('0x1ce'),'foreignKey':'SubjectId'});db[_0x7694('0xc7')][_0x7694('0x11d')](db[_0x7694('0xc7')],{'as':_0x7694('0x1cf'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0x7694('0x11d')](db[_0x7694('0xc7')],{'as':_0x7694('0x1d0'),'foreignKey':_0x7694('0x1cd')});db['ServicenowField'][_0x7694('0x12c')](db[_0x7694('0x9a')],{'as':'Variable','foreignKey':_0x7694('0x1d1')});db['Dynamics365Account'][_0x7694('0x11d')](db[_0x7694('0xca')],{'as':'Configurations','onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0x1d8')]['belongsTo'](db[_0x7694('0x166')],{'as':_0x7694('0x166'),'foreignKey':_0x7694('0x169')});db['Dynamics365Configuration'][_0x7694('0x11d')](db[_0x7694('0xcb')],{'as':_0x7694('0x1c9'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0xca')][_0x7694('0x11d')](db[_0x7694('0xcb')],{'as':_0x7694('0x1cb'),'onDelete':_0x7694('0x120'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x7694('0x11d')](db[_0x7694('0xcb')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7694('0x1cd')});db['Dynamics365Configuration']['belongsTo'](db[_0x7694('0x1d8')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xcb')][_0x7694('0x11d')](db[_0x7694('0xcb')],{'as':_0x7694('0x1ce'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0xcb')]['hasMany'](db[_0x7694('0xcb')],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0xcb')][_0x7694('0x11d')](db[_0x7694('0xcb')],{'as':_0x7694('0x1d0'),'foreignKey':_0x7694('0x1cd')});db[_0x7694('0xcb')][_0x7694('0x12c')](db[_0x7694('0x9a')],{'as':_0x7694('0x9a'),'foreignKey':_0x7694('0x1d1')});db['FreshsalesAccount'][_0x7694('0x11d')](db['FreshsalesConfiguration'],{'as':_0x7694('0x1c7'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1c8')});db['FreshsalesConfiguration'][_0x7694('0x11d')](db[_0x7694('0xd1')],{'as':'Subjects','foreignKey':_0x7694('0x1ca')});db[_0x7694('0xcf')]['hasMany'](db[_0x7694('0xd1')],{'as':_0x7694('0x1cb'),'foreignKey':'DescriptionId'});db[_0x7694('0xcf')][_0x7694('0x11d')](db[_0x7694('0xd1')],{'as':_0x7694('0x1c4'),'foreignKey':'FieldId'});db[_0x7694('0xcf')]['belongsTo'](db[_0x7694('0xcd')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1c8')});db[_0x7694('0xd1')][_0x7694('0x11d')](db[_0x7694('0xd1')],{'as':_0x7694('0x1ce'),'foreignKey':_0x7694('0x1ca')});db[_0x7694('0xd1')]['hasMany'](db['FreshsalesField'],{'as':_0x7694('0x1cf'),'foreignKey':_0x7694('0x1cc')});db[_0x7694('0xd1')][_0x7694('0x11d')](db[_0x7694('0xd1')],{'as':_0x7694('0x1d0'),'foreignKey':'FieldId'});db[_0x7694('0xd1')]['belongsTo'](db['Variable'],{'as':_0x7694('0x9a'),'foreignKey':_0x7694('0x1d1')});db[_0x7694('0xd5')][_0x7694('0x12c')](db[_0x7694('0x66')],{});db[_0x7694('0xd5')][_0x7694('0x12c')](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':'Contact','foreignKey':_0x7694('0x164')});db[_0x7694('0xd5')][_0x7694('0x12c')](db[_0x7694('0x6a')],{});db[_0x7694('0xd5')][_0x7694('0x12c')](db[_0x7694('0x6c')],{});db['ChatQueueReport'][_0x7694('0x12c')](db['User'],{});db[_0x7694('0xd5')][_0x7694('0x12c')](db[_0x7694('0x70')],{});db[_0x7694('0x19e')]['belongsTo'](db[_0x7694('0x11')],{'onDelete':'cascade','foreignKey':_0x7694('0x1d9')});db[_0x7694('0x19e')]['belongsTo'](db[_0x7694('0x11')],{'onDelete':_0x7694('0x120'),'foreignKey':'ToId'});db[_0x7694('0xda')][_0x7694('0x11d')](db[_0x7694('0x1da')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x7694('0xda')][_0x7694('0x11d')](db['JscriptyAnswerReport'],{'foreignKey':_0x7694('0x1db'),'onDelete':_0x7694('0x120')});db[_0x7694('0xdc')][_0x7694('0x12c')](db[_0x7694('0x55')],{});db[_0x7694('0xdc')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x7694('0x170')});db[_0x7694('0xdc')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':'Contact','foreignKey':_0x7694('0x164')});db[_0x7694('0xdc')][_0x7694('0x12c')](db[_0x7694('0x123')],{});db['SmsQueueReport'][_0x7694('0x12c')](db[_0x7694('0x5a')],{});db['SmsQueueReport'][_0x7694('0x12c')](db[_0x7694('0x11')],{});db[_0x7694('0xdc')][_0x7694('0x12c')](db[_0x7694('0x5c')],{});db['JscriptyProject'][_0x7694('0x11d')](db[_0x7694('0xda')],{'foreignKey':_0x7694('0x1dc')});db['JscriptyProject']['hasMany'](db[_0x7694('0x1da')],{'foreignKey':_0x7694('0x1dc')});db[_0x7694('0xe2')][_0x7694('0x11d')](db[_0x7694('0xd7')],{'foreignKey':_0x7694('0x1dc')});db['Team'][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x172'),'through':_0x7694('0x133')});db[_0x7694('0xee')]['belongsToMany'](db[_0x7694('0x19')],{'through':_0x7694('0x1dd'),'as':'VoiceQueues'});db[_0x7694('0xee')][_0x7694('0x12d')](db[_0x7694('0x3f')],{'through':_0x7694('0x173'),'as':_0x7694('0x1de')});db[_0x7694('0xee')][_0x7694('0x12d')](db[_0x7694('0x70')],{'through':_0x7694('0x19d'),'as':_0x7694('0x13d')});db[_0x7694('0xee')][_0x7694('0x12d')](db[_0x7694('0x51')],{'through':_0x7694('0x18a'),'as':'FaxQueues'});db['Team'][_0x7694('0x12d')](db[_0x7694('0x5c')],{'through':_0x7694('0x1df'),'as':'SmsQueues'});db[_0x7694('0xee')][_0x7694('0x12d')](db[_0x7694('0x64')],{'through':_0x7694('0x194'),'as':_0x7694('0x1e0')});db[_0x7694('0xee')][_0x7694('0x12d')](db[_0x7694('0x111')],{'through':_0x7694('0x1e1'),'as':_0x7694('0x13e')});db['Team'][_0x7694('0x12d')](db[_0x7694('0x13b')],{'through':'TeamVoicePrefix','as':_0x7694('0x13c')});db['Campaign'][_0x7694('0x11d')](db[_0x7694('0x78')],{'as':_0x7694('0x12a'),'foreignKey':_0x7694('0x1aa')});db[_0x7694('0xf1')][_0x7694('0x11d')](db[_0x7694('0x7b')],{'as':_0x7694('0x14d'),'foreignKey':'CampaignId'});db[_0x7694('0xf1')][_0x7694('0x11d')](db['CmHopperHistory'],{'as':_0x7694('0x14e'),'foreignKey':_0x7694('0x1aa')});db[_0x7694('0xf1')][_0x7694('0x11d')](db[_0x7694('0x14f')],{'as':'HopperBlacks','foreignKey':_0x7694('0x1aa')});db[_0x7694('0xf1')][_0x7694('0x12c')](db['Trunk'],{'as':'Trunk','foreignKey':_0x7694('0x152')});db[_0x7694('0xf1')][_0x7694('0x12c')](db[_0x7694('0x2a')],{'as':'TrunkBackup','foreignKey':_0x7694('0x154')});db[_0x7694('0xf1')]['belongsTo'](db[_0x7694('0x87')],{'as':_0x7694('0x87'),'foreignKey':_0x7694('0x17e')});db[_0x7694('0xf1')]['belongsTo'](db[_0x7694('0xe8')],{'as':_0x7694('0xe8'),'foreignKey':_0x7694('0x1e2')});db[_0x7694('0xf1')]['belongsToMany'](db[_0x7694('0x13f')],{'as':_0x7694('0x131'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x7694('0x12d')](db[_0x7694('0x13f')],{'as':_0x7694('0x15a'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x7694('0x12c')](db['ChatOfflineMessage'],{'as':_0x7694('0x6e'),'foreignKey':_0x7694('0x17d')});db[_0x7694('0xf7')]['belongsTo'](db['MailMessage'],{});db[_0x7694('0xf7')]['belongsTo'](db[_0x7694('0x43')],{});db[_0x7694('0xf7')][_0x7694('0x12c')](db[_0x7694('0x3d')],{'foreignKey':_0x7694('0x1e3'),'as':_0x7694('0x1e4')});db['MailTransferReport'][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e5'),'as':_0x7694('0x1e6')});db[_0x7694('0xf7')][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e7'),'as':_0x7694('0x1e8')});db['MailTransferReport'][_0x7694('0x12c')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x7694('0x1e9')});db[_0x7694('0xf7')]['belongsTo'](db[_0x7694('0x3d')],{'foreignKey':_0x7694('0x1ea'),'as':_0x7694('0x1eb')});db[_0x7694('0xf9')][_0x7694('0x12c')](db['ChatMessage'],{});db[_0x7694('0xf9')][_0x7694('0x12c')](db[_0x7694('0x6a')],{});db[_0x7694('0xf9')][_0x7694('0x12c')](db['ChatWebsite'],{'foreignKey':_0x7694('0x1ec'),'as':_0x7694('0x1e4')});db['ChatTransferReport'][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':'FromUserId','as':_0x7694('0x1e6')});db[_0x7694('0xf9')][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':'ToUserId','as':_0x7694('0x1e8')});db['ChatTransferReport'][_0x7694('0x12c')](db['ChatQueue'],{'foreignKey':_0x7694('0x1ed'),'as':_0x7694('0x1e9')});db[_0x7694('0xf9')][_0x7694('0x12c')](db[_0x7694('0x66')],{'foreignKey':_0x7694('0x1ee'),'as':_0x7694('0x1eb')});db[_0x7694('0xfb')][_0x7694('0x12c')](db[_0x7694('0x4f')],{});db[_0x7694('0xfb')][_0x7694('0x12c')](db[_0x7694('0x4e')],{});db[_0x7694('0xfb')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x7694('0x1ef'),'as':_0x7694('0x1e4')});db['FaxTransferReport'][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':'FromUserId','as':_0x7694('0x1e6')});db[_0x7694('0xfb')][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e7'),'as':'ToAgent'});db['FaxTransferReport'][_0x7694('0x12c')](db[_0x7694('0x51')],{'foreignKey':_0x7694('0x1f0'),'as':'ToQueue'});db['FaxTransferReport'][_0x7694('0x12c')](db['FaxAccount'],{'foreignKey':_0x7694('0x1f1'),'as':_0x7694('0x1eb')});db[_0x7694('0xfd')]['belongsTo'](db[_0x7694('0x62')],{});db[_0x7694('0xfd')][_0x7694('0x12c')](db['OpenchannelInteraction'],{});db[_0x7694('0xfd')]['belongsTo'](db[_0x7694('0x5e')],{'foreignKey':_0x7694('0x1f2'),'as':_0x7694('0x1e4')});db[_0x7694('0xfd')]['belongsTo'](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e5'),'as':_0x7694('0x1e6')});db[_0x7694('0xfd')][_0x7694('0x12c')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x7694('0xfd')][_0x7694('0x12c')](db['OpenchannelQueue'],{'foreignKey':_0x7694('0x1f3'),'as':_0x7694('0x1e9')});db[_0x7694('0xfd')][_0x7694('0x12c')](db[_0x7694('0x5e')],{'foreignKey':_0x7694('0x1f4'),'as':_0x7694('0x1eb')});db[_0x7694('0xff')][_0x7694('0x12c')](db[_0x7694('0x5a')],{});db[_0x7694('0xff')][_0x7694('0x12c')](db[_0x7694('0x123')],{});db[_0x7694('0xff')][_0x7694('0x12c')](db[_0x7694('0x55')],{'foreignKey':'FromSmsAccountId','as':_0x7694('0x1e4')});db[_0x7694('0xff')][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e5'),'as':_0x7694('0x1e6')});db[_0x7694('0xff')][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e7'),'as':_0x7694('0x1e8')});db[_0x7694('0xff')][_0x7694('0x12c')](db[_0x7694('0x5c')],{'foreignKey':_0x7694('0x1f5'),'as':_0x7694('0x1e9')});db[_0x7694('0xff')]['belongsTo'](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x7694('0x1eb')});db[_0x7694('0x13f')][_0x7694('0x11d')](db['Disposition'],{'as':_0x7694('0x183'),'foreignKey':_0x7694('0x170'),'onDelete':_0x7694('0x120')});db['CmList'][_0x7694('0x11d')](db[_0x7694('0x1f6')],{'as':_0x7694('0x1f7'),'foreignKey':_0x7694('0x170')});db['CmList'][_0x7694('0x11d')](db[_0x7694('0x76')],{'as':'Contacts','onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x13f')][_0x7694('0x11d')](db[_0x7694('0x7b')],{'as':_0x7694('0x14d'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x13f')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x7694('0x170')});db[_0x7694('0x13f')][_0x7694('0x11d')](db[_0x7694('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x7694('0x170')});db[_0x7694('0x13f')][_0x7694('0x12d')](db[_0x7694('0x19')],{'as':_0x7694('0x1f8'),'through':_0x7694('0x158')});db[_0x7694('0x13f')][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':_0x7694('0x172'),'through':_0x7694('0x132')});db[_0x7694('0x13b')][_0x7694('0x11d')](db[_0x7694('0x16')],{'as':_0x7694('0x11f'),'onDelete':_0x7694('0x120')});db[_0x7694('0x13b')][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x172'),'through':_0x7694('0x115')});db[_0x7694('0x13b')][_0x7694('0x12d')](db[_0x7694('0xee')],{'through':_0x7694('0x1f9'),'as':_0x7694('0x159')});db[_0x7694('0x102')][_0x7694('0x11d')](db[_0x7694('0x11')],{'as':_0x7694('0x178'),'foreignKey':'userProfileId'});db[_0x7694('0x102')]['hasMany'](db[_0x7694('0x104')],{'as':_0x7694('0x1fa'),'foreignKey':'userProfileId','onDelete':_0x7694('0x120')});db[_0x7694('0x104')][_0x7694('0x11d')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x7694('0x1fb'),'onDelete':'cascade'});db[_0x7694('0x10a')][_0x7694('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7694('0x1fc'),'onDelete':_0x7694('0x120')});db[_0x7694('0x10a')][_0x7694('0x11d')](db[_0x7694('0x84')],{'as':_0x7694('0x16d'),'foreignKey':'WhatsappAccountId'});db[_0x7694('0x10a')][_0x7694('0x11d')](db[_0x7694('0x1fd')],{'as':'Messages','foreignKey':_0x7694('0x1fc')});db['WhatsappAccount'][_0x7694('0x11d')](db['WhatsappInteraction'],{'as':_0x7694('0x16e')});db[_0x7694('0x10a')][_0x7694('0x11d')](db[_0x7694('0x1fe')],{'as':_0x7694('0x149'),'foreignKey':_0x7694('0x1fc'),'onDelete':_0x7694('0x120')});db['WhatsappAccount'][_0x7694('0x12c')](db[_0x7694('0x13f')],{'as':'List','foreignKey':_0x7694('0x170')});db[_0x7694('0x10a')][_0x7694('0x12c')](db[_0x7694('0x155')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x7694('0x10a')][_0x7694('0x12d')](db[_0x7694('0x11')],{'as':_0x7694('0x172'),'through':_0x7694('0x145')});db[_0x7694('0x1fe')][_0x7694('0x12c')](db['User'],{'onDelete':_0x7694('0x167')});db['WhatsappApplication']['belongsTo'](db[_0x7694('0x111')],{'onDelete':_0x7694('0x167')});db[_0x7694('0x1fe')][_0x7694('0x12c')](db['WhatsappAccount'],{'onDelete':_0x7694('0x167')});db['WhatsappApplication'][_0x7694('0x12c')](db[_0x7694('0x87')],{'onDelete':_0x7694('0x167'),'foreignKey':_0x7694('0x17e')});db[_0x7694('0x1fe')][_0x7694('0x12c')](db[_0x7694('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x7694('0x126')][_0x7694('0x11d')](db['WhatsappMessage'],{'as':_0x7694('0x15d'),'onDelete':_0x7694('0x120'),'foreignKey':_0x7694('0x1ff')});db[_0x7694('0x126')][_0x7694('0x12c')](db[_0x7694('0x10a')],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1fc')});db[_0x7694('0x126')][_0x7694('0x12c')](db[_0x7694('0x76')],{'as':_0x7694('0x163'),'foreignKey':'ContactId'});db[_0x7694('0x126')][_0x7694('0x12c')](db['User'],{'as':_0x7694('0x175'),'foreignKey':_0x7694('0x11a')});db['WhatsappInteraction'][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':_0x7694('0x200'),'as':'Tags'});db[_0x7694('0x126')][_0x7694('0x12d')](db[_0x7694('0x8e')],{'through':_0x7694('0x200'),'as':_0x7694('0x186')});db[_0x7694('0x126')][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x178'),'through':_0x7694('0x139'),'foreignKey':_0x7694('0x1ff')});db['WhatsappMessage'][_0x7694('0x12c')](db[_0x7694('0x11')],{'as':_0x7694('0x11')});db[_0x7694('0x1fd')][_0x7694('0x12c')](db[_0x7694('0x76')],{'onDelete':'cascade','as':_0x7694('0x163')});db[_0x7694('0x1fd')][_0x7694('0x12c')](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x7694('0x1ff')});db[_0x7694('0x1fd')]['belongsTo'](db['WhatsappAccount'],{'as':_0x7694('0x17b'),'foreignKey':_0x7694('0x1fc')});db[_0x7694('0x10e')][_0x7694('0x12c')](db['WhatsappAccount'],{});db[_0x7694('0x10e')]['belongsTo'](db[_0x7694('0x13f')],{'as':_0x7694('0x16f'),'foreignKey':_0x7694('0x170')});db[_0x7694('0x10e')]['belongsTo'](db[_0x7694('0x76')],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x7694('0x12c')](db[_0x7694('0x126')],{});db['WhatsappQueueReport'][_0x7694('0x12c')](db[_0x7694('0x111')],{});db[_0x7694('0x10e')][_0x7694('0x12c')](db['WhatsappMessage'],{});db[_0x7694('0x10e')][_0x7694('0x12c')](db['User'],{});db[_0x7694('0x201')]['belongsTo'](db[_0x7694('0x1fd')],{});db[_0x7694('0x201')][_0x7694('0x12c')](db[_0x7694('0x126')],{});db['WhatsappTransferReport'][_0x7694('0x12c')](db[_0x7694('0x10a')],{'foreignKey':_0x7694('0x202'),'as':_0x7694('0x1e4')});db['WhatsappTransferReport'][_0x7694('0x12c')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x7694('0x1eb')});db[_0x7694('0x201')][_0x7694('0x12c')](db[_0x7694('0x111')],{'foreignKey':_0x7694('0x203'),'as':'ToQueue'});db[_0x7694('0x201')][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e5'),'as':'FromAgent'});db[_0x7694('0x201')][_0x7694('0x12c')](db[_0x7694('0x11')],{'foreignKey':_0x7694('0x1e7'),'as':'ToAgent'});db[_0x7694('0x111')][_0x7694('0x12d')](db['User'],{'as':_0x7694('0x172'),'through':_0x7694('0x38'),'foreignKey':_0x7694('0x204')});db[_0x7694('0x111')][_0x7694('0x12d')](db['Team'],{'through':_0x7694('0x1e1'),'as':_0x7694('0x159')});db[_0x7694('0x11c')][_0x7694('0x12c')](db['User'],{'as':'user','foreignKey':_0x7694('0x11a'),'onDelete':_0x7694('0x120'),'hooks':!![]});db[_0x7694('0x166')][_0x7694('0x11b')](db[_0x7694('0x1d8')],{'as':_0x7694('0x1d8'),'onDelete':_0x7694('0x167')});db[_0x7694('0x166')][_0x7694('0x11b')](db['MailServerIn'],{'as':_0x7694('0x16a'),'onDelete':_0x7694('0x167')});db[_0x7694('0x166')][_0x7694('0x11b')](db[_0x7694('0x168')],{'as':'Smtp','onDelete':_0x7694('0x167')});module[_0x7694('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index dca9130..1564b62 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89d1=['./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/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/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/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/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/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/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/freshsales/accounts'];(function(_0x24bea1,_0x16898d){var _0x289d21=function(_0x342c8){while(--_0x342c8){_0x24bea1['push'](_0x24bea1['shift']());}};_0x289d21(++_0x16898d);}(_0x89d1,0x17c));var _0x189d=function(_0x973b12,_0x1ef7c5){_0x973b12=_0x973b12-0x0;var _0x311cb7=_0x89d1[_0x973b12];return _0x311cb7;};'use strict';var path=require(_0x189d('0x0'));var express=require('express');var errors=require(_0x189d('0x1'));var config=require(_0x189d('0x2'));var setupLoggers=require(_0x189d('0x3'))[_0x189d('0x4')];var clientSideLogs=require(_0x189d('0x5'));exports[_0x189d('0x6')]=function(_0x4e5669){return setupLoggers(_0x4e5669)[_0x189d('0x7')](function(){_0x4e5669[_0x189d('0x8')](_0x189d('0x9'),require('./api/user'));_0x4e5669[_0x189d('0x8')](_0x189d('0xa'),require('./api/voiceChanSpy'));_0x4e5669[_0x189d('0x8')](_0x189d('0xb'),require('./api/voiceContext'));_0x4e5669['use'](_0x189d('0xc'),require('./api/voiceExtension'));_0x4e5669[_0x189d('0x8')](_0x189d('0xd'),require(_0x189d('0xe')));_0x4e5669[_0x189d('0x8')](_0x189d('0xf'),require(_0x189d('0x10')));_0x4e5669[_0x189d('0x8')]('/api/voice/recordings',require(_0x189d('0x11')));_0x4e5669['use']('/api/screen/recordings',require(_0x189d('0x12')));_0x4e5669[_0x189d('0x8')](_0x189d('0x13'),require(_0x189d('0x14')));_0x4e5669['use'](_0x189d('0x15'),require(_0x189d('0x16')));_0x4e5669[_0x189d('0x8')](_0x189d('0x17'),require(_0x189d('0x18')));_0x4e5669['use'](_0x189d('0x19'),require(_0x189d('0x1a')));_0x4e5669[_0x189d('0x8')](_0x189d('0x1b'),require('./api/voiceAgentReport'));_0x4e5669[_0x189d('0x8')]('/api/voice/queues/reports',require(_0x189d('0x1c')));_0x4e5669[_0x189d('0x8')](_0x189d('0x1d'),require(_0x189d('0x1e')));_0x4e5669['use']('/api/trunks',require('./api/trunk'));_0x4e5669[_0x189d('0x8')](_0x189d('0x1f'),require(_0x189d('0x20')));_0x4e5669[_0x189d('0x8')](_0x189d('0x21'),require(_0x189d('0x22')));_0x4e5669['use'](_0x189d('0x23'),require(_0x189d('0x24')));_0x4e5669[_0x189d('0x8')](_0x189d('0x25'),require(_0x189d('0x26')));_0x4e5669['use'](_0x189d('0x27'),require('./api/mailSubstatus'));_0x4e5669[_0x189d('0x8')]('/api/mail/interactions',require(_0x189d('0x28')));_0x4e5669[_0x189d('0x8')](_0x189d('0x29'),require(_0x189d('0x2a')));_0x4e5669[_0x189d('0x8')](_0x189d('0x2b'),require(_0x189d('0x2c')));_0x4e5669[_0x189d('0x8')](_0x189d('0x2d'),require(_0x189d('0x2e')));_0x4e5669[_0x189d('0x8')](_0x189d('0x2f'),require(_0x189d('0x30')));_0x4e5669[_0x189d('0x8')](_0x189d('0x31'),require(_0x189d('0x32')));_0x4e5669[_0x189d('0x8')](_0x189d('0x33'),require(_0x189d('0x34')));_0x4e5669['use'](_0x189d('0x35'),require('./api/faxApplication'));_0x4e5669[_0x189d('0x8')](_0x189d('0x36'),require('./api/faxInteraction'));_0x4e5669[_0x189d('0x8')](_0x189d('0x37'),require(_0x189d('0x38')));_0x4e5669[_0x189d('0x8')](_0x189d('0x39'),require(_0x189d('0x3a')));_0x4e5669['use']('/api/fax/reports/queue',require(_0x189d('0x3b')));_0x4e5669[_0x189d('0x8')](_0x189d('0x3c'),require(_0x189d('0x3d')));_0x4e5669[_0x189d('0x8')](_0x189d('0x3e'),require(_0x189d('0x3f')));_0x4e5669['use'](_0x189d('0x40'),require('./api/smsInteraction'));_0x4e5669[_0x189d('0x8')](_0x189d('0x41'),require(_0x189d('0x42')));_0x4e5669[_0x189d('0x8')](_0x189d('0x43'),require(_0x189d('0x44')));_0x4e5669[_0x189d('0x8')]('/api/openchannel/accounts',require(_0x189d('0x45')));_0x4e5669[_0x189d('0x8')](_0x189d('0x46'),require('./api/openchannelApplication'));_0x4e5669['use'](_0x189d('0x47'),require('./api/openchannelInteraction'));_0x4e5669['use'](_0x189d('0x48'),require(_0x189d('0x49')));_0x4e5669['use'](_0x189d('0x4a'),require(_0x189d('0x4b')));_0x4e5669[_0x189d('0x8')]('/api/chat/websites',require(_0x189d('0x4c')));_0x4e5669['use'](_0x189d('0x4d'),require('./api/openchannelQueueReport'));_0x4e5669['use'](_0x189d('0x4e'),require('./api/chatApplication'));_0x4e5669[_0x189d('0x8')](_0x189d('0x4f'),require(_0x189d('0x50')));_0x4e5669[_0x189d('0x8')](_0x189d('0x51'),require(_0x189d('0x52')));_0x4e5669['use'](_0x189d('0x53'),require(_0x189d('0x54')));_0x4e5669['use'](_0x189d('0x55'),require(_0x189d('0x56')));_0x4e5669[_0x189d('0x8')]('/api/chat/groups',require(_0x189d('0x57')));_0x4e5669['use'](_0x189d('0x58'),require(_0x189d('0x59')));_0x4e5669[_0x189d('0x8')](_0x189d('0x5a'),require(_0x189d('0x5b')));_0x4e5669['use'](_0x189d('0x5c'),require(_0x189d('0x5d')));_0x4e5669[_0x189d('0x8')](_0x189d('0x5e'),require(_0x189d('0x5f')));_0x4e5669['use'](_0x189d('0x60'),require('./api/cmHopperBlack'));_0x4e5669[_0x189d('0x8')](_0x189d('0x61'),require(_0x189d('0x62')));_0x4e5669[_0x189d('0x8')]('/api/cm/hopper_history',require(_0x189d('0x63')));_0x4e5669['use'](_0x189d('0x64'),require(_0x189d('0x65')));_0x4e5669[_0x189d('0x8')]('/api/actions',require(_0x189d('0x66')));_0x4e5669[_0x189d('0x8')](_0x189d('0x67'),require(_0x189d('0x68')));_0x4e5669[_0x189d('0x8')](_0x189d('0x69'),require('./api/cannedAnswer'));_0x4e5669['use'](_0x189d('0x6a'),require(_0x189d('0x6b')));_0x4e5669[_0x189d('0x8')](_0x189d('0x6c'),require('./api/condition'));_0x4e5669[_0x189d('0x8')](_0x189d('0x6d'),require(_0x189d('0x6e')));_0x4e5669[_0x189d('0x8')](_0x189d('0x6f'),require(_0x189d('0x70')));_0x4e5669[_0x189d('0x8')](_0x189d('0x71'),require(_0x189d('0x72')));_0x4e5669['use'](_0x189d('0x73'),require(_0x189d('0x74')));_0x4e5669['use']('/api/schedules',require('./api/schedule'));_0x4e5669[_0x189d('0x8')](_0x189d('0x75'),require('./api/sound'));_0x4e5669[_0x189d('0x8')]('/api/tags',require(_0x189d('0x76')));_0x4e5669[_0x189d('0x8')]('/api/contact_item_types',require(_0x189d('0x77')));_0x4e5669[_0x189d('0x8')](_0x189d('0x78'),require(_0x189d('0x79')));_0x4e5669[_0x189d('0x8')](_0x189d('0x7a'),require(_0x189d('0x7b')));_0x4e5669[_0x189d('0x8')](_0x189d('0x7c'),require(_0x189d('0x7d')));_0x4e5669[_0x189d('0x8')](_0x189d('0x7e'),require('./api/trigger'));_0x4e5669[_0x189d('0x8')](_0x189d('0x7f'),require(_0x189d('0x80')));_0x4e5669[_0x189d('0x8')](_0x189d('0x81'),require('./api/integration'));_0x4e5669['use']('/api/integrations/reports',require(_0x189d('0x82')));_0x4e5669['use'](_0x189d('0x83'),require(_0x189d('0x84')));_0x4e5669[_0x189d('0x8')](_0x189d('0x85'),require(_0x189d('0x86')));_0x4e5669[_0x189d('0x8')](_0x189d('0x87'),require('./api/analyticExtractedReport'));_0x4e5669[_0x189d('0x8')](_0x189d('0x88'),require('./api/analyticMetric'));_0x4e5669[_0x189d('0x8')](_0x189d('0x89'),require('./api/analyticFieldReport'));_0x4e5669[_0x189d('0x8')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x4e5669[_0x189d('0x8')](_0x189d('0x8a'),require('./api/intSalesforceAccount'));_0x4e5669[_0x189d('0x8')](_0x189d('0x8b'),require(_0x189d('0x8c')));_0x4e5669[_0x189d('0x8')](_0x189d('0x8d'),require(_0x189d('0x8e')));_0x4e5669[_0x189d('0x8')](_0x189d('0x8f'),require(_0x189d('0x90')));_0x4e5669[_0x189d('0x8')](_0x189d('0x91'),require('./api/intSugarcrmConfiguration'));_0x4e5669['use'](_0x189d('0x92'),require(_0x189d('0x93')));_0x4e5669['use'](_0x189d('0x94'),require(_0x189d('0x95')));_0x4e5669[_0x189d('0x8')](_0x189d('0x96'),require(_0x189d('0x97')));_0x4e5669['use'](_0x189d('0x98'),require(_0x189d('0x99')));_0x4e5669[_0x189d('0x8')](_0x189d('0x9a'),require('./api/intZohoAccount'));_0x4e5669[_0x189d('0x8')]('/api/integrations/zoho/configurations',require(_0x189d('0x9b')));_0x4e5669[_0x189d('0x8')](_0x189d('0x9c'),require(_0x189d('0x9d')));_0x4e5669[_0x189d('0x8')](_0x189d('0x9e'),require('./api/intZendeskAccount'));_0x4e5669[_0x189d('0x8')](_0x189d('0x9f'),require(_0x189d('0xa0')));_0x4e5669[_0x189d('0x8')](_0x189d('0xa1'),require(_0x189d('0xa2')));_0x4e5669[_0x189d('0x8')](_0x189d('0xa3'),require(_0x189d('0xa4')));_0x4e5669[_0x189d('0x8')](_0x189d('0xa5'),require('./api/intFreshdeskConfiguration'));_0x4e5669['use'](_0x189d('0xa6'),require(_0x189d('0xa7')));_0x4e5669[_0x189d('0x8')](_0x189d('0xa8'),require(_0x189d('0xa9')));_0x4e5669['use'](_0x189d('0xaa'),require(_0x189d('0xab')));_0x4e5669[_0x189d('0x8')]('/api/integrations/vtiger/fields',require(_0x189d('0xac')));_0x4e5669[_0x189d('0x8')]('/api/integrations/servicenow/accounts',require(_0x189d('0xad')));_0x4e5669[_0x189d('0x8')]('/api/integrations/servicenow/configurations',require(_0x189d('0xae')));_0x4e5669[_0x189d('0x8')](_0x189d('0xaf'),require(_0x189d('0xb0')));_0x4e5669[_0x189d('0x8')](_0x189d('0xb1'),require(_0x189d('0xb2')));_0x4e5669['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x4e5669[_0x189d('0x8')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x4e5669[_0x189d('0x8')](_0x189d('0xb3'),require(_0x189d('0xb4')));_0x4e5669[_0x189d('0x8')](_0x189d('0xb5'),require(_0x189d('0xb6')));_0x4e5669[_0x189d('0x8')]('/api/integrations/freshsales/fields',require(_0x189d('0xb7')));_0x4e5669[_0x189d('0x8')](_0x189d('0xb8'),require(_0x189d('0xb9')));_0x4e5669[_0x189d('0x8')](_0x189d('0xba'),require(_0x189d('0xbb')));_0x4e5669['use'](_0x189d('0xbc'),require('./api/chatInternalMessage'));_0x4e5669[_0x189d('0x8')](_0x189d('0xbd'),require('./api/jscriptyAnswerReport'));_0x4e5669['use']('/api/jscripty/questions/reports',require(_0x189d('0xbe')));_0x4e5669['use'](_0x189d('0xbf'),require('./api/jscriptySessionReport'));_0x4e5669[_0x189d('0x8')]('/api/sms/reports/queue',require(_0x189d('0xc0')));_0x4e5669[_0x189d('0x8')](_0x189d('0xc1'),require(_0x189d('0xc2')));_0x4e5669[_0x189d('0x8')](_0x189d('0xc3'),require(_0x189d('0xc4')));_0x4e5669['use'](_0x189d('0xc5'),require('./api/jscriptyProject'));_0x4e5669[_0x189d('0x8')](_0x189d('0xc6'),require(_0x189d('0xc7')));_0x4e5669[_0x189d('0x8')](_0x189d('0xc8'),require('./api/squareOdbc'));_0x4e5669['use'](_0x189d('0xc9'),require(_0x189d('0xca')));_0x4e5669[_0x189d('0x8')](_0x189d('0xcb'),require(_0x189d('0xcc')));_0x4e5669[_0x189d('0x8')](_0x189d('0xcd'),require('./api/squareMessage'));_0x4e5669['use'](_0x189d('0xce'),require(_0x189d('0xcf')));_0x4e5669[_0x189d('0x8')](_0x189d('0xd0'),require(_0x189d('0xd1')));_0x4e5669[_0x189d('0x8')](_0x189d('0xd2'),require('./api/campaign'));_0x4e5669[_0x189d('0x8')]('/api/migrations',require('./api/migration'));_0x4e5669[_0x189d('0x8')]('/api/attachments',require(_0x189d('0xd3')));_0x4e5669[_0x189d('0x8')](_0x189d('0xd4'),require(_0x189d('0xd5')));_0x4e5669[_0x189d('0x8')](_0x189d('0xd6'),require(_0x189d('0xd7')));_0x4e5669[_0x189d('0x8')]('/api/chat/reports/transfer',require(_0x189d('0xd8')));_0x4e5669['use'](_0x189d('0xd9'),require(_0x189d('0xda')));_0x4e5669[_0x189d('0x8')](_0x189d('0xdb'),require('./api/openchannelTransferReport'));_0x4e5669[_0x189d('0x8')](_0x189d('0xdc'),require(_0x189d('0xdd')));_0x4e5669[_0x189d('0x8')](_0x189d('0xde'),require(_0x189d('0xdf')));_0x4e5669[_0x189d('0x8')](_0x189d('0xe0'),require(_0x189d('0xe1')));_0x4e5669[_0x189d('0x8')](_0x189d('0xe2'),require(_0x189d('0xe3')));_0x4e5669[_0x189d('0x8')](_0x189d('0xe4'),require('./api/userProfileSection'));_0x4e5669[_0x189d('0x8')]('/api/userProfile/resources',require(_0x189d('0xe5')));_0x4e5669[_0x189d('0x8')](_0x189d('0xe6'),require('./api/userNotification'));_0x4e5669[_0x189d('0x8')](_0x189d('0xe7'),require(_0x189d('0xe8')));_0x4e5669[_0x189d('0x8')](_0x189d('0xe9'),require(_0x189d('0xea')));_0x4e5669[_0x189d('0x8')]('/api/whatsapp/interactions',require(_0x189d('0xeb')));_0x4e5669[_0x189d('0x8')](_0x189d('0xec'),require(_0x189d('0xed')));_0x4e5669['use'](_0x189d('0xee'),require(_0x189d('0xef')));_0x4e5669[_0x189d('0x8')](_0x189d('0xf0'),require(_0x189d('0xf1')));_0x4e5669['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x4e5669[_0x189d('0x8')](_0x189d('0xf2'),require(_0x189d('0xf3')));_0x4e5669[_0x189d('0x8')](_0x189d('0xf4'),require(_0x189d('0xf5')));_0x4e5669[_0x189d('0x8')]('/api/user-settings',require(_0x189d('0xf6')));_0x4e5669[_0x189d('0x8')](_0x189d('0xf7'),require(_0x189d('0xf8')));_0x4e5669['use'](_0x189d('0xf9'),require(_0x189d('0xfa')));_0x4e5669['use']('/api/auth/google',require('./api/authGoogle'));_0x4e5669[_0x189d('0x8')](_0x189d('0xfb'),require(_0x189d('0xfc')));_0x4e5669[_0x189d('0x8')](_0x189d('0xfd'),require(_0x189d('0xfe')));_0x4e5669[_0x189d('0x8')](_0x189d('0xff'),require('./api/rpc'));_0x4e5669['use'](_0x189d('0x100'),require('./api/version'));_0x4e5669['use'](_0x189d('0x101'),require(_0x189d('0x102')));_0x4e5669[_0x189d('0x8')](_0x189d('0x103'),require(_0x189d('0x104')));_0x4e5669[_0x189d('0x8')](_0x189d('0x105'),require(_0x189d('0x106')));_0x4e5669['use'](_0x189d('0x107'),clientSideLogs);_0x4e5669[_0x189d('0x8')](_0x189d('0x108'),express[_0x189d('0x109')](path[_0x189d('0x10a')](config[_0x189d('0x10b')],'/apidoc')));_0x4e5669[_0x189d('0x8')](_0x189d('0x10c'),express['static'](path[_0x189d('0x10a')](config[_0x189d('0x10b')],_0x189d('0x10c'))));_0x4e5669[_0x189d('0x8')](_0x189d('0x10d'),express[_0x189d('0x109')](path['join'](config['root'],_0x189d('0x10d'))));_0x4e5669[_0x189d('0x8')](_0x189d('0x10e'),express[_0x189d('0x109')](path['join'](config['root'],_0x189d('0x10f'),'3.9.0')));_0x4e5669[_0x189d('0x8')](_0x189d('0x110'),express[_0x189d('0x109')](path['join'](config[_0x189d('0x10b')],_0x189d('0x111'))));_0x4e5669[_0x189d('0x112')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x4e5669[_0x189d('0x112')]('/*')[_0x189d('0x113')](function(_0x2ac7a9,_0x5f13d1){_0x5f13d1[_0x189d('0x114')](path[_0x189d('0x115')](_0x4e5669[_0x189d('0x113')](_0x189d('0x116'))+_0x189d('0x117')));});return _0x4e5669;});}; \ No newline at end of file +var _0xdbbe=['/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/mailInteractionHasTag','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./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/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./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/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xdbbe,0x148));var _0xedbb=function(_0x1c0991,_0x4f22d2){_0x1c0991=_0x1c0991-0x0;var _0x5034de=_0xdbbe[_0x1c0991];return _0x5034de;};'use strict';var path=require('path');var express=require(_0xedbb('0x0'));var errors=require(_0xedbb('0x1'));var config=require(_0xedbb('0x2'));var setupLoggers=require(_0xedbb('0x3'))[_0xedbb('0x4')];var clientSideLogs=require(_0xedbb('0x5'));exports['default']=function(_0x282712){return setupLoggers(_0x282712)[_0xedbb('0x6')](function(){_0x282712[_0xedbb('0x7')](_0xedbb('0x8'),require(_0xedbb('0x9')));_0x282712[_0xedbb('0x7')](_0xedbb('0xa'),require('./api/voiceChanSpy'));_0x282712[_0xedbb('0x7')](_0xedbb('0xb'),require('./api/voiceContext'));_0x282712[_0xedbb('0x7')]('/api/voice/extensions',require(_0xedbb('0xc')));_0x282712[_0xedbb('0x7')](_0xedbb('0xd'),require('./api/voiceMusicOnHold'));_0x282712[_0xedbb('0x7')]('/api/voice/queues',require(_0xedbb('0xe')));_0x282712[_0xedbb('0x7')](_0xedbb('0xf'),require(_0xedbb('0x10')));_0x282712['use'](_0xedbb('0x11'),require(_0xedbb('0x12')));_0x282712[_0xedbb('0x7')](_0xedbb('0x13'),require(_0xedbb('0x14')));_0x282712[_0xedbb('0x7')]('/api/voice/mails/messages',require(_0xedbb('0x15')));_0x282712[_0xedbb('0x7')](_0xedbb('0x16'),require(_0xedbb('0x17')));_0x282712[_0xedbb('0x7')](_0xedbb('0x18'),require('./api/voiceDialReport'));_0x282712['use'](_0xedbb('0x19'),require(_0xedbb('0x1a')));_0x282712['use'](_0xedbb('0x1b'),require(_0xedbb('0x1c')));_0x282712[_0xedbb('0x7')]('/api/members/reports',require(_0xedbb('0x1d')));_0x282712['use']('/api/trunks',require('./api/trunk'));_0x282712['use'](_0xedbb('0x1e'),require('./api/voiceTransferReport'));_0x282712['use'](_0xedbb('0x1f'),require(_0xedbb('0x20')));_0x282712[_0xedbb('0x7')](_0xedbb('0x21'),require(_0xedbb('0x22')));_0x282712[_0xedbb('0x7')]('/api/mail/queues',require(_0xedbb('0x23')));_0x282712[_0xedbb('0x7')](_0xedbb('0x24'),require('./api/mailSubstatus'));_0x282712[_0xedbb('0x7')](_0xedbb('0x25'),require(_0xedbb('0x26')));_0x282712['use'](_0xedbb('0x27'),require(_0xedbb('0x28')));_0x282712[_0xedbb('0x7')](_0xedbb('0x29'),require(_0xedbb('0x2a')));_0x282712[_0xedbb('0x7')](_0xedbb('0x2b'),require(_0xedbb('0x2c')));_0x282712[_0xedbb('0x7')]('/api/dashboards',require(_0xedbb('0x2d')));_0x282712[_0xedbb('0x7')](_0xedbb('0x2e'),require('./api/dashboardItem'));_0x282712[_0xedbb('0x7')](_0xedbb('0x2f'),require('./api/faxAccount'));_0x282712['use']('/api/fax/applications',require(_0xedbb('0x30')));_0x282712[_0xedbb('0x7')](_0xedbb('0x31'),require(_0xedbb('0x32')));_0x282712[_0xedbb('0x7')]('/api/fax/messages',require(_0xedbb('0x33')));_0x282712[_0xedbb('0x7')](_0xedbb('0x34'),require(_0xedbb('0x35')));_0x282712[_0xedbb('0x7')]('/api/fax/reports/queue',require(_0xedbb('0x36')));_0x282712[_0xedbb('0x7')](_0xedbb('0x37'),require(_0xedbb('0x38')));_0x282712[_0xedbb('0x7')](_0xedbb('0x39'),require(_0xedbb('0x3a')));_0x282712['use'](_0xedbb('0x3b'),require(_0xedbb('0x3c')));_0x282712[_0xedbb('0x7')]('/api/sms/messages',require('./api/smsMessage'));_0x282712[_0xedbb('0x7')]('/api/sms/queues',require(_0xedbb('0x3d')));_0x282712[_0xedbb('0x7')](_0xedbb('0x3e'),require(_0xedbb('0x3f')));_0x282712['use'](_0xedbb('0x40'),require(_0xedbb('0x41')));_0x282712['use'](_0xedbb('0x42'),require(_0xedbb('0x43')));_0x282712['use'](_0xedbb('0x44'),require('./api/openchannelMessage'));_0x282712[_0xedbb('0x7')](_0xedbb('0x45'),require('./api/openchannelQueue'));_0x282712['use']('/api/chat/websites',require(_0xedbb('0x46')));_0x282712['use'](_0xedbb('0x47'),require(_0xedbb('0x48')));_0x282712[_0xedbb('0x7')]('/api/chat/applications',require(_0xedbb('0x49')));_0x282712[_0xedbb('0x7')](_0xedbb('0x4a'),require(_0xedbb('0x4b')));_0x282712[_0xedbb('0x7')](_0xedbb('0x4c'),require(_0xedbb('0x4d')));_0x282712[_0xedbb('0x7')]('/api/chat/offline_messages',require(_0xedbb('0x4e')));_0x282712[_0xedbb('0x7')]('/api/chat/queues',require('./api/chatQueue'));_0x282712[_0xedbb('0x7')](_0xedbb('0x4f'),require(_0xedbb('0x50')));_0x282712[_0xedbb('0x7')](_0xedbb('0x51'),require(_0xedbb('0x52')));_0x282712['use'](_0xedbb('0x53'),require(_0xedbb('0x54')));_0x282712[_0xedbb('0x7')](_0xedbb('0x55'),require('./api/cmContact'));_0x282712[_0xedbb('0x7')](_0xedbb('0x56'),require(_0xedbb('0x57')));_0x282712['use']('/api/cm/hopper_black',require(_0xedbb('0x58')));_0x282712[_0xedbb('0x7')]('/api/cm/hopper_final',require(_0xedbb('0x59')));_0x282712[_0xedbb('0x7')](_0xedbb('0x5a'),require(_0xedbb('0x5b')));_0x282712[_0xedbb('0x7')](_0xedbb('0x5c'),require(_0xedbb('0x5d')));_0x282712['use'](_0xedbb('0x5e'),require('./api/action'));_0x282712[_0xedbb('0x7')]('/api/automations',require(_0xedbb('0x5f')));_0x282712[_0xedbb('0x7')](_0xedbb('0x60'),require(_0xedbb('0x61')));_0x282712[_0xedbb('0x7')]('/api/dispositions',require(_0xedbb('0x62')));_0x282712[_0xedbb('0x7')](_0xedbb('0x63'),require(_0xedbb('0x64')));_0x282712[_0xedbb('0x7')](_0xedbb('0x65'),require(_0xedbb('0x66')));_0x282712[_0xedbb('0x7')]('/api/pauses',require(_0xedbb('0x67')));_0x282712[_0xedbb('0x7')](_0xedbb('0x68'),require(_0xedbb('0x69')));_0x282712[_0xedbb('0x7')](_0xedbb('0x6a'),require(_0xedbb('0x6b')));_0x282712['use'](_0xedbb('0x6c'),require(_0xedbb('0x6d')));_0x282712['use']('/api/sounds',require(_0xedbb('0x6e')));_0x282712[_0xedbb('0x7')](_0xedbb('0x6f'),require(_0xedbb('0x70')));_0x282712[_0xedbb('0x7')]('/api/contact_item_types',require(_0xedbb('0x71')));_0x282712['use'](_0xedbb('0x72'),require(_0xedbb('0x73')));_0x282712['use'](_0xedbb('0x74'),require('./api/cmHopperAdditionalPhone'));_0x282712['use'](_0xedbb('0x75'),require(_0xedbb('0x76')));_0x282712[_0xedbb('0x7')](_0xedbb('0x77'),require(_0xedbb('0x78')));_0x282712['use'](_0xedbb('0x79'),require(_0xedbb('0x7a')));_0x282712['use'](_0xedbb('0x7b'),require('./api/integration'));_0x282712[_0xedbb('0x7')]('/api/integrations/reports',require(_0xedbb('0x7c')));_0x282712[_0xedbb('0x7')](_0xedbb('0x7d'),require(_0xedbb('0x7e')));_0x282712[_0xedbb('0x7')](_0xedbb('0x7f'),require(_0xedbb('0x80')));_0x282712[_0xedbb('0x7')](_0xedbb('0x81'),require(_0xedbb('0x82')));_0x282712[_0xedbb('0x7')](_0xedbb('0x83'),require(_0xedbb('0x84')));_0x282712[_0xedbb('0x7')](_0xedbb('0x85'),require(_0xedbb('0x86')));_0x282712[_0xedbb('0x7')]('/api/analytics/tree_reports',require(_0xedbb('0x87')));_0x282712[_0xedbb('0x7')](_0xedbb('0x88'),require(_0xedbb('0x89')));_0x282712[_0xedbb('0x7')](_0xedbb('0x8a'),require(_0xedbb('0x8b')));_0x282712[_0xedbb('0x7')]('/api/integrations/salesforce/fields',require(_0xedbb('0x8c')));_0x282712[_0xedbb('0x7')](_0xedbb('0x8d'),require(_0xedbb('0x8e')));_0x282712[_0xedbb('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xedbb('0x8f')));_0x282712[_0xedbb('0x7')](_0xedbb('0x90'),require(_0xedbb('0x91')));_0x282712[_0xedbb('0x7')](_0xedbb('0x92'),require(_0xedbb('0x93')));_0x282712[_0xedbb('0x7')](_0xedbb('0x94'),require(_0xedbb('0x95')));_0x282712[_0xedbb('0x7')](_0xedbb('0x96'),require('./api/intDeskField'));_0x282712[_0xedbb('0x7')](_0xedbb('0x97'),require(_0xedbb('0x98')));_0x282712[_0xedbb('0x7')](_0xedbb('0x99'),require(_0xedbb('0x9a')));_0x282712[_0xedbb('0x7')](_0xedbb('0x9b'),require(_0xedbb('0x9c')));_0x282712['use'](_0xedbb('0x9d'),require(_0xedbb('0x9e')));_0x282712['use']('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x282712[_0xedbb('0x7')](_0xedbb('0x9f'),require('./api/intZendeskField'));_0x282712[_0xedbb('0x7')]('/api/integrations/freshdesk/accounts',require(_0xedbb('0xa0')));_0x282712[_0xedbb('0x7')](_0xedbb('0xa1'),require(_0xedbb('0xa2')));_0x282712[_0xedbb('0x7')](_0xedbb('0xa3'),require('./api/intFreshdeskField'));_0x282712[_0xedbb('0x7')]('/api/integrations/vtiger/accounts',require(_0xedbb('0xa4')));_0x282712['use']('/api/integrations/vtiger/configurations',require(_0xedbb('0xa5')));_0x282712[_0xedbb('0x7')](_0xedbb('0xa6'),require(_0xedbb('0xa7')));_0x282712['use'](_0xedbb('0xa8'),require(_0xedbb('0xa9')));_0x282712[_0xedbb('0x7')](_0xedbb('0xaa'),require('./api/intServicenowConfiguration'));_0x282712['use'](_0xedbb('0xab'),require(_0xedbb('0xac')));_0x282712[_0xedbb('0x7')](_0xedbb('0xad'),require(_0xedbb('0xae')));_0x282712['use'](_0xedbb('0xaf'),require(_0xedbb('0xb0')));_0x282712['use'](_0xedbb('0xb1'),require(_0xedbb('0xb2')));_0x282712[_0xedbb('0x7')](_0xedbb('0xb3'),require(_0xedbb('0xb4')));_0x282712[_0xedbb('0x7')]('/api/integrations/freshsales/configurations',require(_0xedbb('0xb5')));_0x282712[_0xedbb('0x7')]('/api/integrations/freshsales/fields',require(_0xedbb('0xb6')));_0x282712[_0xedbb('0x7')](_0xedbb('0xb7'),require(_0xedbb('0xb8')));_0x282712['use'](_0xedbb('0xb9'),require('./api/chatQueueReport'));_0x282712[_0xedbb('0x7')]('/api/chat/internal/messages',require(_0xedbb('0xba')));_0x282712['use']('/api/jscripty/answers/reports',require(_0xedbb('0xbb')));_0x282712[_0xedbb('0x7')](_0xedbb('0xbc'),require(_0xedbb('0xbd')));_0x282712[_0xedbb('0x7')](_0xedbb('0xbe'),require('./api/jscriptySessionReport'));_0x282712[_0xedbb('0x7')](_0xedbb('0xbf'),require(_0xedbb('0xc0')));_0x282712[_0xedbb('0x7')]('/api/square/reports',require('./api/squareReport'));_0x282712['use'](_0xedbb('0xc1'),require(_0xedbb('0xc2')));_0x282712[_0xedbb('0x7')](_0xedbb('0xc3'),require(_0xedbb('0xc4')));_0x282712[_0xedbb('0x7')](_0xedbb('0xc5'),require(_0xedbb('0xc6')));_0x282712[_0xedbb('0x7')](_0xedbb('0xc7'),require(_0xedbb('0xc8')));_0x282712['use'](_0xedbb('0xc9'),require(_0xedbb('0xca')));_0x282712[_0xedbb('0x7')](_0xedbb('0xcb'),require(_0xedbb('0xcc')));_0x282712[_0xedbb('0x7')](_0xedbb('0xcd'),require(_0xedbb('0xce')));_0x282712[_0xedbb('0x7')]('/api/teams',require(_0xedbb('0xcf')));_0x282712[_0xedbb('0x7')](_0xedbb('0xd0'),require(_0xedbb('0xd1')));_0x282712[_0xedbb('0x7')](_0xedbb('0xd2'),require(_0xedbb('0xd3')));_0x282712[_0xedbb('0x7')](_0xedbb('0xd4'),require(_0xedbb('0xd5')));_0x282712[_0xedbb('0x7')](_0xedbb('0xd6'),require(_0xedbb('0xd7')));_0x282712[_0xedbb('0x7')]('/api/plugins',require(_0xedbb('0xd8')));_0x282712['use'](_0xedbb('0xd9'),require('./api/mailTransferReport'));_0x282712[_0xedbb('0x7')](_0xedbb('0xda'),require(_0xedbb('0xdb')));_0x282712[_0xedbb('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x282712['use'](_0xedbb('0xdc'),require(_0xedbb('0xdd')));_0x282712[_0xedbb('0x7')]('/api/sms/reports/transfer',require(_0xedbb('0xde')));_0x282712[_0xedbb('0x7')](_0xedbb('0xdf'),require('./api/cmList'));_0x282712[_0xedbb('0x7')](_0xedbb('0xe0'),require(_0xedbb('0xe1')));_0x282712[_0xedbb('0x7')](_0xedbb('0xe2'),require(_0xedbb('0xe3')));_0x282712[_0xedbb('0x7')](_0xedbb('0xe4'),require(_0xedbb('0xe5')));_0x282712[_0xedbb('0x7')]('/api/userProfile/resources',require(_0xedbb('0xe6')));_0x282712[_0xedbb('0x7')](_0xedbb('0xe7'),require(_0xedbb('0xe8')));_0x282712[_0xedbb('0x7')](_0xedbb('0xe9'),require(_0xedbb('0xea')));_0x282712[_0xedbb('0x7')](_0xedbb('0xeb'),require(_0xedbb('0xec')));_0x282712[_0xedbb('0x7')](_0xedbb('0xed'),require(_0xedbb('0xee')));_0x282712[_0xedbb('0x7')](_0xedbb('0xef'),require(_0xedbb('0xf0')));_0x282712[_0xedbb('0x7')](_0xedbb('0xf1'),require('./api/whatsappQueueReport'));_0x282712['use'](_0xedbb('0xf2'),require(_0xedbb('0xf3')));_0x282712[_0xedbb('0x7')](_0xedbb('0xf4'),require(_0xedbb('0xf5')));_0x282712['use'](_0xedbb('0xf6'),require(_0xedbb('0xf7')));_0x282712['use'](_0xedbb('0xf8'),require(_0xedbb('0xf9')));_0x282712[_0xedbb('0x7')](_0xedbb('0xfa'),require(_0xedbb('0xfb')));_0x282712[_0xedbb('0x7')]('/api/mail_interaction_has_tags',require(_0xedbb('0xfc')));_0x282712[_0xedbb('0x7')](_0xedbb('0xfd'),require(_0xedbb('0xfe')));_0x282712[_0xedbb('0x7')]('/api/auth/google',require(_0xedbb('0xff')));_0x282712[_0xedbb('0x7')](_0xedbb('0x100'),require(_0xedbb('0x101')));_0x282712[_0xedbb('0x7')](_0xedbb('0x102'),require(_0xedbb('0x103')));_0x282712[_0xedbb('0x7')]('/api/rpc',require(_0xedbb('0x104')));_0x282712['use'](_0xedbb('0x105'),require('./api/version'));_0x282712['use'](_0xedbb('0x106'),require(_0xedbb('0x107')));_0x282712[_0xedbb('0x7')](_0xedbb('0x108'),require(_0xedbb('0x109')));_0x282712[_0xedbb('0x7')]('/api/webbar',require(_0xedbb('0x10a')));_0x282712[_0xedbb('0x7')](_0xedbb('0x10b'),clientSideLogs);_0x282712[_0xedbb('0x7')](_0xedbb('0x10c'),express[_0xedbb('0x10d')](path[_0xedbb('0x10e')](config[_0xedbb('0x10f')],_0xedbb('0x10c'))));_0x282712[_0xedbb('0x7')](_0xedbb('0x110'),express['static'](path[_0xedbb('0x10e')](config[_0xedbb('0x10f')],'/www')));_0x282712['use'](_0xedbb('0x111'),express[_0xedbb('0x10d')](path['join'](config[_0xedbb('0x10f')],'/demo')));_0x282712['use'](_0xedbb('0x112'),express['static'](path['join'](config['root'],_0xedbb('0x113'),_0xedbb('0x114'))));_0x282712[_0xedbb('0x7')](_0xedbb('0x115'),express[_0xedbb('0x10d')](path[_0xedbb('0x10e')](config[_0xedbb('0x10f')],_0xedbb('0x116'))));_0x282712[_0xedbb('0x117')](_0xedbb('0x118'))[_0xedbb('0x119')](errors[0x194]);_0x282712[_0xedbb('0x117')]('/*')[_0xedbb('0x119')](function(_0x2ca62d,_0x58e49e){_0x58e49e['sendFile'](path[_0xedbb('0x11a')](_0x282712['get'](_0xedbb('0x11b'))+_0xedbb('0x11c')));});return _0x282712;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 223c618..e057d83 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6089=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x1575a5,_0x28d177){var _0x3b91f8=function(_0x3f7cb9){while(--_0x3f7cb9){_0x1575a5['push'](_0x1575a5['shift']());}};_0x3b91f8(++_0x28d177);}(_0x6089,0x75));var _0x9608=function(_0x55c8ec,_0x5bc960){_0x55c8ec=_0x55c8ec-0x0;var _0x4cf866=_0x6089[_0x55c8ec];return _0x4cf866;};'use strict';var jayson=require(_0x9608('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x9608('0x1')]=function(){return new Promise(function(_0x19565d,_0xb05a59){var _0x563ff1={};_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x3')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x4')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/voiceQueue/voiceQueue.rpc'));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x5')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x6')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x7')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x8')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x9')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0xa')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0xb')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0xc')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0xd')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0xe')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0xf')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x10')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x11')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x12')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x13')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x14')));_0x563ff1=_['merge'](_0x563ff1,require('../api/faxApplication/faxApplication.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x15')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x16')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/faxQueue/faxQueue.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x17')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x18')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x19')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/smsMessage/smsMessage.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/smsQueue/smsQueue.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x1a')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x1b')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x1c')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x1d')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x1e')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x1f')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/chatQueue/chatQueue.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x20')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/cmHopper/cmHopper.rpc'));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x21')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x22')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x23')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x24')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x25')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x26')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x27')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x28')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x29')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x2a')));_0x563ff1=_['merge'](_0x563ff1,require('../api/variable/variable.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x2b')));_0x563ff1=_['merge'](_0x563ff1,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x563ff1=_['merge'](_0x563ff1,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x2c')));_0x563ff1=_['merge'](_0x563ff1,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x2d')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x2e')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x2f')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x30')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x31')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x32')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x33')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x34')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x35')));_0x563ff1=_['merge'](_0x563ff1,require('../api/squareProject/squareProject.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x36')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x37')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require('../api/campaign/campaign.rpc'));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x38')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x39')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x3a')));_0x563ff1=_['merge'](_0x563ff1,require(_0x9608('0x3b')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x3c')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x3d')));_0x563ff1=_[_0x9608('0x2')](_0x563ff1,require(_0x9608('0x3e')));var _0x3f7a4f=jayson[_0x9608('0x3f')](_0x563ff1)[_0x9608('0x40')]();var _0x2603e3=config[_0x9608('0x41')][_0x9608('0x42')]||config[_0x9608('0x42')]+0x1;var _0x4a03f2=config[_0x9608('0x41')]['ip']||_0x9608('0x43');_0x3f7a4f['on'](_0x9608('0x44'),function(_0x96cb41){return _0xb05a59(_0x96cb41);});_0x3f7a4f[_0x9608('0x1')](_0x2603e3,_0x4a03f2,function(){console[_0x9608('0x45')](_0x9608('0x46'),_0x4a03f2,_0x2603e3);require('../config/triggers')[_0x9608('0x47')]();return _0x19565d('RPC\x20listening\x20on\x20'+_0x4a03f2+':'+_0x2603e3);});});}; \ No newline at end of file +var _0xec32=['../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/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/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec32,0xb8));var _0x2ec3=function(_0x5240b5,_0x6906a3){_0x5240b5=_0x5240b5-0x0;var _0x3190e7=_0xec32[_0x5240b5];return _0x3190e7;};'use strict';var jayson=require(_0x2ec3('0x0'));var _=require(_0x2ec3('0x1'));var config=require(_0x2ec3('0x2'));exports[_0x2ec3('0x3')]=function(){return new Promise(function(_0x391483,_0x418e9e){var _0x5213db={};_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/user/user.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x5')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x6')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x7')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x8')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x9')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/trunk/trunk.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0xa')));_0x5213db=_['merge'](_0x5213db,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0xb')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0xc')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0xd')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0xe')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0xf')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x10')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x11')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x12')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/faxInteraction/faxInteraction.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x13')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x14')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x15')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x16')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/smsMessage/smsMessage.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/smsQueue/smsQueue.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x17')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x18')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x19')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x1a')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x1b')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x1c')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x1d')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x1e')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x1f')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x20')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x21')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x22')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/interval/interval.rpc'));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x23')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x24')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x25')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x26')));_0x5213db=_['merge'](_0x5213db,require('../api/trigger/trigger.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x27')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x28')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x29')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x2a')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x2b')));_0x5213db=_['merge'](_0x5213db,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x2c')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x2d')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x2e')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x2f')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x30')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x31')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x32')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x33')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x34')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x35')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x36')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/squareMessage/squareMessage.rpc'));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x37')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x38')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x39')));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x3a')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5213db=_['merge'](_0x5213db,require(_0x2ec3('0x3b')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require(_0x2ec3('0x3c')));_0x5213db=_[_0x2ec3('0x4')](_0x5213db,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5e5bd0=jayson[_0x2ec3('0x3d')](_0x5213db)[_0x2ec3('0x3e')]();var _0x2111f1=config[_0x2ec3('0x3f')][_0x2ec3('0x40')]||config['port']+0x1;var _0x4784cd=config[_0x2ec3('0x3f')]['ip']||'localhost';_0x5e5bd0['on'](_0x2ec3('0x41'),function(_0x1d8ed6){return _0x418e9e(_0x1d8ed6);});_0x5e5bd0[_0x2ec3('0x3')](_0x2111f1,_0x4784cd,function(){console['log'](_0x2ec3('0x42'),_0x4784cd,_0x2111f1);require(_0x2ec3('0x43'))['default']();return _0x391483(_0x2ec3('0x44')+_0x4784cd+':'+_0x2111f1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 9f8ef43..a7d2952 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 _0xe0ad=['SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','error','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr','startsWith','length','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','destroy','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe0ad,0x1a5));var _0xde0a=function(_0x1ad86c,_0x1b9d47){_0x1ad86c=_0x1ad86c-0x0;var _0x405a97=_0xe0ad[_0x1ad86c];return _0x405a97;};'use strict';var util=require(_0xde0a('0x0'));var _=require('lodash');var EventEmitter=require(_0xde0a('0x1'))[_0xde0a('0x2')];var AGIReply=require(_0xde0a('0x3'));var AGIError=require(_0xde0a('0x4'));function AGIChannel(_0x53c75a){var _0x209b3e=this,_0x349167=new AGIReply(),_0x41800c=![],_0x395fb6={};EventEmitter[_0xde0a('0x5')](_0x209b3e);_0x53c75a[_0xde0a('0x6')](_0xde0a('0x7'));_0x53c75a[_0xde0a('0x8')](0x8*0x3c*0x3c*0x3e8);_0x349167[_0xde0a('0x6')](_0xde0a('0x7'));_0x349167['on'](_0xde0a('0x9'),function(_0x325e86){for(var _0x4070b6 in _0x325e86){_0x209b3e[_0x4070b6]=_0x325e86[_0x4070b6];}_0x209b3e[_0xde0a('0xa')](_0xde0a('0xb'));});_0x349167['on'](_0xde0a('0xc'),function(_0x2ae190){if(_0x2ae190['toLowerCase']()==_0xde0a('0xd')){_0x209b3e[_0xde0a('0xa')]('hangup');return;}if(_0x2ae190[_0xde0a('0xe')](0x0,0xb)==_0xde0a('0xf')){_0x41800c=!![];}if(_0x41800c){_0x395fb6['rx']+=_0x2ae190+'\x0a';if(_0x2ae190[_0xde0a('0x10')](_0xde0a('0x11'))!=-0x1){_0x41800c=![];}}else{_0x395fb6['rx']=_0x2ae190;}if(_0x41800c){return;}if(typeof _0x395fb6['cb']==_0xde0a('0x12')){var _0x1e2941=_0x395fb6['rx']['substring'](0x0,0x3),_0xaa1c4b=null,_0x24de85=null;_0x1e2941=parseInt(_0x1e2941);if(isNaN(_0x1e2941)){_0x395fb6['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xde0a('0x13')});return;}if(_0x1e2941!=0xc8){_0x395fb6['cb'](null,{'code':_0x1e2941,'result':-0x1,'extra':'KO'});return;}_0xaa1c4b=_0x395fb6['rx'][_0xde0a('0xe')](0x4)['replace'](_0xde0a('0x14'),'');if(_0xaa1c4b[_0xde0a('0x15')]('\x20')!=-0x1){_0xaa1c4b=_0xaa1c4b[_0xde0a('0x16')](0x0,_0xaa1c4b[_0xde0a('0x15')]('\x20'));}if(_[_0xde0a('0x17')](_0xaa1c4b,'-1')){_0xaa1c4b=parseInt(_0xaa1c4b);}_0x24de85=_0x395fb6['rx']['split']('\x20');if(_0x24de85[_0xde0a('0x18')]==0x3){_0x24de85=_0x24de85[0x2][_0xde0a('0xe')](0x1,_0x24de85[0x2][_0xde0a('0x18')]-0x1);}else if(_0x24de85[_0xde0a('0x18')]>0x3){var _0x346ff3=/\((.+)\)/;var _0x4e1b2a=_0x395fb6['rx']['match'](_0x346ff3);if(_0x4e1b2a){_0x24de85=_0x4e1b2a[0x1];}else{_0x24de85=null;}}else{_0x24de85=null;}_0x395fb6['cb'](null,{'code':_0x1e2941,'result':_0xaa1c4b,'extra':_0x24de85});}});_0x53c75a['on']('error',function(_0x571574){_0x209b3e[_0xde0a('0xa')]('error',new AGIError(_0xde0a('0x19'),_0x571574['code']));});_0x53c75a['on'](_0xde0a('0x1a'),function(){_0x209b3e[_0xde0a('0xa')]('close',new AGIError(_0xde0a('0x1b')));});_0x53c75a['on'](_0xde0a('0x1c'),function(){_0x209b3e[_0xde0a('0xa')](_0xde0a('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x53c75a['destroy']();});_0x53c75a[_0xde0a('0x1d')](_0x349167);this[_0xde0a('0x1e')]=function(_0x5dc3df,_0x8992c5){var _0x5dc3df=_0x5dc3df||'',_0x8992c5=typeof _0x8992c5==_0xde0a('0x12')?_0x8992c5:new Function();_0x395fb6={'tx':_0x5dc3df,'rx':'','cb':_0x8992c5};_0x53c75a['write'](_0x5dc3df+'\x0a');},this[_0xde0a('0x1a')]=function(){_0x53c75a[_0xde0a('0x1f')]();};}util[_0xde0a('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xde0a('0x21')]=function(_0x51111d){return this[_0xde0a('0x1e')][_0xde0a('0x22')](this,_0x51111d);};AGIChannel[_0xde0a('0x23')][_0xde0a('0x24')]=function(){return this[_0xde0a('0x21')](_0xde0a('0x25'));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x26')]=function(_0x3b6381,_0x57eadf,_0x2438a5){_0x3b6381=_0x3b6381===undefined?'beep':_0x3b6381;_0x57eadf=_0x57eadf===undefined?'5':_0x57eadf;_0x2438a5=_0x2438a5===undefined?'1':_0x2438a5;return this[_0xde0a('0x21')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3b6381,_0x57eadf*0x3e8,_0x2438a5));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x27')]=function(_0xf5479f){_0xf5479f=_0xf5479f||_0xde0a('0x28');return this['sendRequest'](util[_0xde0a('0x29')]('VERBOSE\x20\x22%s\x22',_0xf5479f));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x2a')]=function(_0x236de9,_0x48d197){if(_[_0xde0a('0x2b')](_0x48d197)){return this['sendRequest'](util[_0xde0a('0x29')](_0xde0a('0x2c'),_0x236de9,_0x48d197['join'](',')));}return this[_0xde0a('0x21')](util[_0xde0a('0x29')]('EXEC\x20%s\x20%s',_0x236de9,_0x48d197));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x2d')]=function(_0x4297b8){return this['sendRequest'](util[_0xde0a('0x29')](_0xde0a('0x2e'),_0x4297b8));};AGIChannel[_0xde0a('0x23')]['setExtension']=function(_0x498410){return this[_0xde0a('0x21')](util[_0xde0a('0x29')](_0xde0a('0x2f'),_0x498410));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x30')]=function(_0x22fc38){return this[_0xde0a('0x21')](util[_0xde0a('0x29')](_0xde0a('0x31'),_0x22fc38));};AGIChannel[_0xde0a('0x23')]['hangup']=function(){return this['sendRequest'](_0xde0a('0x32'));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x33')]=function(_0x45bf58,_0x2b876f){var _0x2061bd=_[_0xde0a('0x34')](_0x2b876f)||_[_0xde0a('0x35')](_0x2b876f)?_0x2b876f['toString']():_0x2b876f;return this[_0xde0a('0x21')](util['format'](_0xde0a('0x36'),_0x45bf58,_0x2061bd?_0x2061bd[_0xde0a('0x37')]()[_0xde0a('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x39')]=function(_0x839dda,_0x17a06d){return this['sendRequest'](util[_0xde0a('0x29')](_0xde0a('0x3a'),_0x839dda,_0x17a06d));};AGIChannel['prototype'][_0xde0a('0x3b')]=function(_0x248ada,_0x28b7a8){return this[_0xde0a('0x21')](util[_0xde0a('0x29')](_0xde0a('0x3c'),_0x248ada,_0x28b7a8));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x3d')]=function(_0x3b22c5,_0x1582d8){return this[_0xde0a('0x21')](util[_0xde0a('0x29')](_0xde0a('0x3e'),_0x3b22c5,_0x1582d8));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x3f')]=function(_0x4a682d,_0x195bb1,_0x39c4ad){_0x195bb1=_0x195bb1||this[_0xde0a('0x40')];_0x39c4ad=_0x39c4ad||0x1;this[_0xde0a('0x2d')](_0x4a682d);this[_0xde0a('0x41')](_0x195bb1);this[_0xde0a('0x30')](_0x39c4ad);return this[_0xde0a('0x27')](util[_0xde0a('0x29')](_0xde0a('0x42'),_0x4a682d,_0x195bb1,_0x39c4ad));};AGIChannel[_0xde0a('0x23')]['getVariable']=function(_0x2b796f){return this[_0xde0a('0x21')](util[_0xde0a('0x29')](_0xde0a('0x43'),_0x2b796f));};AGIChannel[_0xde0a('0x23')][_0xde0a('0x44')]=function(_0x779ee6,_0x1b03c2,_0x93afcd,_0x54b2eb,_0x240f38,_0x143294){_0x1b03c2=_0x1b03c2||_0xde0a('0x45');_0x93afcd=_0x93afcd||'';_0x54b2eb=_0x54b2eb===undefined?-0x1:_0x54b2eb==='-1'?-0x1:_0x54b2eb*0x3e8;_0x240f38=_0x240f38===undefined?'':'s='+_0x240f38;_0x143294=_0x143294?_0xde0a('0x46'):'';return this[_0xde0a('0x21')](util[_0xde0a('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x779ee6,_0x1b03c2,_0x93afcd,_0x54b2eb,_0x143294,_0x240f38));};AGIChannel[_0xde0a('0x23')]['streamFile']=function(_0x1ac63b,_0x417dfb){_0x417dfb=_0x417dfb||'';return this['sendRequest'](util[_0xde0a('0x29')](_0xde0a('0x47'),_0x1ac63b,_0x417dfb));};AGIChannel['prototype']['agi']=function(_0x4e9514){return this[_0xde0a('0x2a')](_0xde0a('0x48'),_0x4e9514);};AGIChannel[_0xde0a('0x23')][_0xde0a('0x49')]=function(_0x1e5ce8){return this[_0xde0a('0x2a')](_0xde0a('0x4a'),_0x1e5ce8);};AGIChannel[_0xde0a('0x23')][_0xde0a('0x4b')]=function(_0x37f97b,_0x297367){this['noop'](util[_0xde0a('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x37f97b['id'],_0x37f97b[_0xde0a('0x4c')],_0x297367));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xde0a('0x4d')]=AGIChannel; \ No newline at end of file +var _0x0170=['label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','substr','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','pipe','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x8e04d0,_0x258838){var _0x10f0b7=function(_0x2a4df3){while(--_0x2a4df3){_0x8e04d0['push'](_0x8e04d0['shift']());}};_0x10f0b7(++_0x258838);}(_0x0170,0x1d6));var _0x0017=function(_0x3015d0,_0x2f6634){_0x3015d0=_0x3015d0-0x0;var _0x78e6aa=_0x0170[_0x3015d0];return _0x78e6aa;};'use strict';var util=require(_0x0017('0x0'));var _=require(_0x0017('0x1'));var EventEmitter=require('events')[_0x0017('0x2')];var AGIReply=require(_0x0017('0x3'));var AGIError=require(_0x0017('0x4'));function AGIChannel(_0xe275a5){var _0x5ee6e8=this,_0x20a045=new AGIReply(),_0x255938=![],_0x3ba292={};EventEmitter[_0x0017('0x5')](_0x5ee6e8);_0xe275a5[_0x0017('0x6')](_0x0017('0x7'));_0xe275a5[_0x0017('0x8')](0x8*0x3c*0x3c*0x3e8);_0x20a045[_0x0017('0x6')](_0x0017('0x7'));_0x20a045['on'](_0x0017('0x9'),function(_0x145f14){for(var _0x5ad216 in _0x145f14){_0x5ee6e8[_0x5ad216]=_0x145f14[_0x5ad216];}_0x5ee6e8['emit'](_0x0017('0xa'));});_0x20a045['on'](_0x0017('0xb'),function(_0x46c69f){if(_0x46c69f[_0x0017('0xc')]()==_0x0017('0xd')){_0x5ee6e8[_0x0017('0xe')](_0x0017('0xd'));return;}if(_0x46c69f[_0x0017('0xf')](0x0,0xb)==_0x0017('0x10')){_0x255938=!![];}if(_0x255938){_0x3ba292['rx']+=_0x46c69f+'\x0a';if(_0x46c69f[_0x0017('0x11')](_0x0017('0x12'))!=-0x1){_0x255938=![];}}else{_0x3ba292['rx']=_0x46c69f;}if(_0x255938){return;}if(typeof _0x3ba292['cb']==_0x0017('0x13')){var _0x25200c=_0x3ba292['rx'][_0x0017('0xf')](0x0,0x3),_0x50c5d7=null,_0x21505f=null;_0x25200c=parseInt(_0x25200c);if(isNaN(_0x25200c)){_0x3ba292['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0017('0x14')});return;}if(_0x25200c!=0xc8){_0x3ba292['cb'](null,{'code':_0x25200c,'result':-0x1,'extra':'KO'});return;}_0x50c5d7=_0x3ba292['rx'][_0x0017('0xf')](0x4)[_0x0017('0x15')]('result=','');if(_0x50c5d7['indexOf']('\x20')!=-0x1){_0x50c5d7=_0x50c5d7[_0x0017('0x16')](0x0,_0x50c5d7[_0x0017('0x17')]('\x20'));}if(_[_0x0017('0x18')](_0x50c5d7,'-1')){_0x50c5d7=parseInt(_0x50c5d7);}_0x21505f=_0x3ba292['rx']['split']('\x20');if(_0x21505f[_0x0017('0x19')]==0x3){_0x21505f=_0x21505f[0x2][_0x0017('0xf')](0x1,_0x21505f[0x2][_0x0017('0x19')]-0x1);}else if(_0x21505f[_0x0017('0x19')]>0x3){var _0x5e3c80=/\((.+)\)/;var _0xe765e1=_0x3ba292['rx'][_0x0017('0x1a')](_0x5e3c80);if(_0xe765e1){_0x21505f=_0xe765e1[0x1];}else{_0x21505f=null;}}else{_0x21505f=null;}_0x3ba292['cb'](null,{'code':_0x25200c,'result':_0x50c5d7,'extra':_0x21505f});}});_0xe275a5['on']('error',function(_0x24cce2){_0x5ee6e8[_0x0017('0xe')](_0x0017('0x1b'),new AGIError(_0x0017('0x1c'),_0x24cce2['code']));});_0xe275a5['on'](_0x0017('0x1d'),function(){_0x5ee6e8[_0x0017('0xe')]('close',new AGIError(_0x0017('0x1e')));});_0xe275a5['on']('timeout',function(){_0x5ee6e8[_0x0017('0xe')]('timeout',new AGIError(_0x0017('0x1f')));_0xe275a5['destroy']();});_0xe275a5[_0x0017('0x20')](_0x20a045);this['command']=function(_0x223c14,_0x6cd580){var _0x223c14=_0x223c14||'',_0x6cd580=typeof _0x6cd580==_0x0017('0x13')?_0x6cd580:new Function();_0x3ba292={'tx':_0x223c14,'rx':'','cb':_0x6cd580};_0xe275a5[_0x0017('0x21')](_0x223c14+'\x0a');},this['close']=function(){_0xe275a5['destroy']();};}util[_0x0017('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x0017('0x23')][_0x0017('0x24')]=function(_0x28fa30){return this['command'][_0x0017('0x25')](this,_0x28fa30);};AGIChannel[_0x0017('0x23')][_0x0017('0x26')]=function(){return this[_0x0017('0x24')](_0x0017('0x27'));};AGIChannel[_0x0017('0x23')][_0x0017('0x28')]=function(_0x45bdba,_0x3dcce8,_0x2adbe0){_0x45bdba=_0x45bdba===undefined?_0x0017('0x29'):_0x45bdba;_0x3dcce8=_0x3dcce8===undefined?'5':_0x3dcce8;_0x2adbe0=_0x2adbe0===undefined?'1':_0x2adbe0;return this[_0x0017('0x24')](util[_0x0017('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x45bdba,_0x3dcce8*0x3e8,_0x2adbe0));};AGIChannel[_0x0017('0x23')][_0x0017('0x2b')]=function(_0x54608f){_0x54608f=_0x54608f||'NO\x20MESSAGE';return this[_0x0017('0x24')](util[_0x0017('0x2a')](_0x0017('0x2c'),_0x54608f));};AGIChannel[_0x0017('0x23')]['exec']=function(_0x23e6a3,_0x1596f1){if(_[_0x0017('0x2d')](_0x1596f1)){return this[_0x0017('0x24')](util['format'](_0x0017('0x2e'),_0x23e6a3,_0x1596f1[_0x0017('0x2f')](',')));}return this['sendRequest'](util[_0x0017('0x2a')](_0x0017('0x2e'),_0x23e6a3,_0x1596f1));};AGIChannel[_0x0017('0x23')][_0x0017('0x30')]=function(_0x3f3142){return this[_0x0017('0x24')](util[_0x0017('0x2a')]('SET\x20CONTEXT\x20%s',_0x3f3142));};AGIChannel[_0x0017('0x23')]['setExtension']=function(_0x208a63){return this[_0x0017('0x24')](util[_0x0017('0x2a')](_0x0017('0x31'),_0x208a63));};AGIChannel['prototype'][_0x0017('0x32')]=function(_0x16f6eb){return this['sendRequest'](util[_0x0017('0x2a')](_0x0017('0x33'),_0x16f6eb));};AGIChannel[_0x0017('0x23')]['hangup']=function(){return this['sendRequest'](_0x0017('0x34'));};AGIChannel[_0x0017('0x23')][_0x0017('0x35')]=function(_0x1c7546,_0x4479a8){var _0x1dee37=_['isBoolean'](_0x4479a8)||_[_0x0017('0x36')](_0x4479a8)?_0x4479a8[_0x0017('0x37')]():_0x4479a8;return this[_0x0017('0x24')](util[_0x0017('0x2a')](_0x0017('0x38'),_0x1c7546,_0x1dee37?_0x1dee37[_0x0017('0x37')]()[_0x0017('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0017('0x23')][_0x0017('0x39')]=function(_0x52a312,_0x34a62f){return this[_0x0017('0x24')](util[_0x0017('0x2a')](_0x0017('0x3a'),_0x52a312,_0x34a62f));};AGIChannel[_0x0017('0x23')][_0x0017('0x3b')]=function(_0x7c43a5,_0x19ad28){return this['sendRequest'](util[_0x0017('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x7c43a5,_0x19ad28));};AGIChannel['prototype'][_0x0017('0x3c')]=function(_0x415441,_0x94e6b2){return this[_0x0017('0x24')](util[_0x0017('0x2a')](_0x0017('0x3d'),_0x415441,_0x94e6b2));};AGIChannel[_0x0017('0x23')][_0x0017('0x3e')]=function(_0x4fe8b1,_0x1f87df,_0x142d19){_0x1f87df=_0x1f87df||this[_0x0017('0x3f')];_0x142d19=_0x142d19||0x1;this[_0x0017('0x30')](_0x4fe8b1);this[_0x0017('0x40')](_0x1f87df);this[_0x0017('0x32')](_0x142d19);return this[_0x0017('0x2b')](util[_0x0017('0x2a')](_0x0017('0x41'),_0x4fe8b1,_0x1f87df,_0x142d19));};AGIChannel[_0x0017('0x23')][_0x0017('0x42')]=function(_0x349d5d){return this[_0x0017('0x24')](util[_0x0017('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x349d5d));};AGIChannel['prototype']['recordFile']=function(_0x21a14f,_0x335753,_0x1e4d0f,_0x213dba,_0x5a50af,_0x5032ae){_0x335753=_0x335753||_0x0017('0x43');_0x1e4d0f=_0x1e4d0f||'';_0x213dba=_0x213dba===undefined?-0x1:_0x213dba==='-1'?-0x1:_0x213dba*0x3e8;_0x5a50af=_0x5a50af===undefined?'':'s='+_0x5a50af;_0x5032ae=_0x5032ae?_0x0017('0x44'):'';return this[_0x0017('0x24')](util[_0x0017('0x2a')](_0x0017('0x45'),_0x21a14f,_0x335753,_0x1e4d0f,_0x213dba,_0x5032ae,_0x5a50af));};AGIChannel[_0x0017('0x23')][_0x0017('0x46')]=function(_0x3b68b6,_0x309de6){_0x309de6=_0x309de6||'';return this[_0x0017('0x24')](util[_0x0017('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3b68b6,_0x309de6));};AGIChannel[_0x0017('0x23')]['agi']=function(_0x17ebe0){return this[_0x0017('0x47')](_0x0017('0x48'),_0x17ebe0);};AGIChannel[_0x0017('0x23')][_0x0017('0x49')]=function(_0x55f650){return this[_0x0017('0x47')](_0x0017('0x4a'),_0x55f650);};AGIChannel[_0x0017('0x23')][_0x0017('0x1b')]=function(_0x294efb,_0x45eafa){this['noop'](util[_0x0017('0x2a')](_0x0017('0x4b'),_0x294efb['id'],_0x294efb[_0x0017('0x4c')],_0x45eafa));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0017('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e796ff5..b263408 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 _0x13fc=['Server\x20closed.','[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.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x3f9164,_0x14e2ac){var _0x1eac97=function(_0x3c0b51){while(--_0x3c0b51){_0x3f9164['push'](_0x3f9164['shift']());}};_0x1eac97(++_0x14e2ac);}(_0x13fc,0xee));var _0xc13f=function(_0x156172,_0x2f3f37){_0x156172=_0x156172-0x0;var _0x3cab19=_0x13fc[_0x156172];return _0x3cab19;};'use strict';var util=require(_0xc13f('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xc13f('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xc13f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xc13f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xc13f('0x4'),'E_AGI_SOCKET_ERROR':_0xc13f('0x5'),'E_AGI_SOCKET_CLOSE':_0xc13f('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xc13f('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xc13f('0x8')};function AGIError(_0x608e3c){var _0x608e3c=_0x608e3c||null,_0x196028=_0x196028||[],_0x4bd87a=0x1,_0x42c33f='';if(!error[_0x608e3c]){_0x608e3c=_0xc13f('0x9');}_0x196028[_0xc13f('0xa')](error[_0x608e3c]);while(arguments[_0x4bd87a]){_0x196028[_0xc13f('0xa')](arguments[_0x4bd87a]);_0x4bd87a++;}_0x42c33f=util[_0xc13f('0xb')][_0xc13f('0xc')](util,_0x196028);this[_0xc13f('0xd')]=_0x42c33f;this[_0xc13f('0xe')]=_0x608e3c;}module[_0xc13f('0xf')]=AGIError; \ No newline at end of file +var _0xb06c=['exports','util','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','E_AGI_UNDEFINED','format','apply','name'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0xb06c,0x9b));var _0xcb06=function(_0x24b268,_0xa798a8){_0x24b268=_0x24b268-0x0;var _0x141588=_0xb06c[_0x24b268];return _0x141588;};'use strict';var util=require(_0xcb06('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xcb06('0x1'),'E_AGI_SERVER_VOICE_DISABLED':_0xcb06('0x2'),'E_AGI_SOCKET_ERROR':_0xcb06('0x3'),'E_AGI_SOCKET_CLOSE':_0xcb06('0x4'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xcb06('0x5'),'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(_0x4782e7){var _0x4782e7=_0x4782e7||null,_0x1335eb=_0x1335eb||[],_0x5837b1=0x1,_0x2691c9='';if(!error[_0x4782e7]){_0x4782e7=_0xcb06('0x6');}_0x1335eb['push'](error[_0x4782e7]);while(arguments[_0x5837b1]){_0x1335eb['push'](arguments[_0x5837b1]);_0x5837b1++;}_0x2691c9=util[_0xcb06('0x7')][_0xcb06('0x8')](util,_0x1335eb);this['message']=_0x2691c9;this[_0xcb06('0x9')]=_0x4782e7;}module[_0xcb06('0xa')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 3d93f87..ccdde7d 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 _0x9131=['lodash','EventEmitter','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','projectUpdate'];(function(_0x415608,_0x3b1b35){var _0x3c121e=function(_0x4d8ef7){while(--_0x4d8ef7){_0x415608['push'](_0x415608['shift']());}};_0x3c121e(++_0x3b1b35);}(_0x9131,0x1a4));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1913('0x0'));var EventEmitter=require('events')[_0x1913('0x1')];var Redis=require('ioredis');var AGIError=require(_0x1913('0x2'));var config=require(_0x1913('0x3'));config[_0x1913('0x4')]=_[_0x1913('0x5')](config[_0x1913('0x4')],{'host':_0x1913('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1913('0x4')]);sub[_0x1913('0x7')](_0x1913('0x8'),function(_0x5a319b){if(_0x5a319b)return eventEmitter[_0x1913('0x9')](_0x1913('0xa'),new AGIError(_0x1913('0xb'),_0x5a319b));});sub['on'](_0x1913('0xc'),function(_0xaa7b1e,_0x6a0edf){if(_0xaa7b1e!=='agi')return;try{var _0x2ee640=JSON['parse'](_0x6a0edf);eventEmitter[_0x1913('0x9')](_0x1913('0xd'),_0x2ee640);}catch(_0x51277e){eventEmitter[_0x1913('0x9')](_0x1913('0xa'),new AGIError(_0x1913('0xb'),_0x51277e));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xa810=['projectUpdate','exports','events','EventEmitter','../../config/environment','redis','defaults','agi','emit','error','E_AGI_SERVER_ERROR','message','parse'];(function(_0x5904ea,_0x5b043f){var _0x2055e7=function(_0x377261){while(--_0x377261){_0x5904ea['push'](_0x5904ea['shift']());}};_0x2055e7(++_0x5b043f);}(_0xa810,0x12d));var _0x0a81=function(_0x27b3df,_0x34a01a){_0x27b3df=_0x27b3df-0x0;var _0x275390=_0xa810[_0x27b3df];return _0x275390;};'use strict';var _=require('lodash');var EventEmitter=require(_0x0a81('0x0'))[_0x0a81('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x0a81('0x2'));config[_0x0a81('0x3')]=_[_0x0a81('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x0a81('0x3')]);sub['subscribe'](_0x0a81('0x5'),function(_0x3e350f){if(_0x3e350f)return eventEmitter[_0x0a81('0x6')](_0x0a81('0x7'),new AGIError(_0x0a81('0x8'),_0x3e350f));});sub['on'](_0x0a81('0x9'),function(_0x28fb9,_0x2132e5){if(_0x28fb9!==_0x0a81('0x5'))return;try{var _0x244cc4=JSON[_0x0a81('0xa')](_0x2132e5);eventEmitter[_0x0a81('0x6')](_0x0a81('0xb'),_0x244cc4);}catch(_0x58ada6){eventEmitter[_0x0a81('0x6')](_0x0a81('0x7'),new AGIError(_0x0a81('0x8'),_0x58ada6));}});module[_0x0a81('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 2d0b7a4..901c5e4 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 _0x4646=['prototype','addVertex','addEdge','push','size','relations','getVertex','vertices','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','target','default','invalid','vswitch','includes','max\x20retry\x20reach','condition\x20not\x20found','agi','getdigits','getsecretdigits','edges','numberOfEdges'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4646,0x191));var _0x6464=function(_0x1608ae,_0x52065a){_0x1608ae=_0x1608ae-0x0;var _0x4b33fc=_0x4646[_0x1608ae];return _0x4b33fc;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x6464('0x0'));var verticesWithRetry=['menu',_0x6464('0x1'),_0x6464('0x2')];var Graph=function(){this['vertices']={};this[_0x6464('0x3')]={};this[_0x6464('0x4')]=0x0;};Graph[_0x6464('0x5')][_0x6464('0x6')]=function(_0x59d548){this['vertices'][_0x59d548['id']]=_0x59d548;this[_0x6464('0x3')][_0x59d548['id']]=[];};Graph[_0x6464('0x5')][_0x6464('0x7')]=function(_0x5d0ea3,_0x18de39,_0x37c039){this[_0x6464('0x3')][_0x5d0ea3][_0x6464('0x8')]({'target':_0x18de39,'condition':_0x37c039});this[_0x6464('0x4')]+=0x1;};Graph['prototype'][_0x6464('0x9')]=function(){return _[_0x6464('0x9')](this['vertices']);};Graph[_0x6464('0x5')][_0x6464('0xa')]=function(){return this[_0x6464('0x4')];};Graph[_0x6464('0x5')][_0x6464('0xb')]=function(_0x3e5b56){return this[_0x6464('0xc')][_0x3e5b56];};Graph[_0x6464('0x5')][_0x6464('0xd')]=function(_0x4ba459,_0x298959){if(!this['vertices'][_0x4ba459]){return logger[_0x6464('0xe')](_0x6464('0xf'));}var _0x52e00c=_0x298959(this[_0x6464('0xc')][_0x4ba459]);if(!_0x52e00c){return logger[_0x6464('0xe')](_0x6464('0x10'));}if(this['edges'][_0x4ba459][_0x6464('0x11')]===0x0){return logger[_0x6464('0xe')](_0x6464('0x12'));}for(var _0x39fbf4=0x0,_0x1cedfe=[],_0x2f039a=![];_0x39fbf4\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','name','handleNotFound','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1'];(function(_0x30e6a8,_0x296322){var _0x28bb68=function(_0x5109fd){while(--_0x5109fd){_0x30e6a8['push'](_0x30e6a8['shift']());}};_0x28bb68(++_0x296322);}(_0x7f4c,0xd6));var _0xc7f4=function(_0x29a4ee,_0x1c2a16){_0x29a4ee=_0x29a4ee-0x0;var _0x4a2d3f=_0x7f4c[_0x29a4ee];return _0x4a2d3f;};'use strict';var _=require(_0xc7f4('0x0'));var syncho=require(_0xc7f4('0x1'));var util=require(_0xc7f4('0x2'));var config=require(_0xc7f4('0x3'));var logger=require(_0xc7f4('0x4'))(_0xc7f4('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xc7f4('0x6'))[_0xc7f4('0x7')];var projects=[];config[_0xc7f4('0x5')]=_[_0xc7f4('0x8')](config[_0xc7f4('0x5')],{'ip':_0xc7f4('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x56f017){process[_0xc7f4('0xa')](function(){syncho(function(){try{setChannelVariables(_0x56f017);agiHandler(_0x56f017);}catch(_0x4f7b7e){logger[_0xc7f4('0xb')](_0x4f7b7e[_0xc7f4('0xc')]);}});});}function projectUpdateHandler(_0x592163){try{var _0x5101e7=_[_0xc7f4('0xd')](projects,['id',_0x592163['id']]);if(_0x5101e7>-0x1){if(_0x592163[_0xc7f4('0xe')]===!![]){projects[_0xc7f4('0xf')](_0x5101e7,0x1);}else{projects[_0x5101e7]=_0x592163;}}else{projects[_0xc7f4('0x10')](_0x592163);}}catch(_0x47cd25){logger['error'](_0x47cd25[_0xc7f4('0xc')]);}}function listeningHandler(){console[_0xc7f4('0x11')](_0xc7f4('0x12'),config[_0xc7f4('0x5')][_0xc7f4('0x13')]);logger[_0xc7f4('0x14')](util[_0xc7f4('0x15')](_0xc7f4('0x16'),config[_0xc7f4('0x5')]['ip'],config[_0xc7f4('0x5')]['port']));}function errorHandler(_0x5429b9){if(_0x5429b9&&_0x5429b9['name']&&_0x5429b9['message']){logger[_0xc7f4('0xb')](util[_0xc7f4('0x15')]('[%s]\x20%s',_0x5429b9['name'],_0x5429b9[_0xc7f4('0x17')]));}else{logger[_0xc7f4('0xb')](util['format']('[ERROR]\x20%s',_0x5429b9[_0xc7f4('0xc')]));}}function closeHandler(){logger[_0xc7f4('0x14')](util['format'](_0xc7f4('0x18'),this[_0xc7f4('0x19')],this[_0xc7f4('0x1a')],this[_0xc7f4('0x1b')],this[_0xc7f4('0x1c')],this[_0xc7f4('0x1d')]));try{createSquareReport(this);}catch(_0xe5883f){logger[_0xc7f4('0xb')](_0xe5883f[_0xc7f4('0xc')]);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc7f4('0x19')],this[_0xc7f4('0x1a')],this[_0xc7f4('0x1b')],this[_0xc7f4('0x1c')],this[_0xc7f4('0x1d')]));}function hangupHandler(){logger[_0xc7f4('0x14')](util[_0xc7f4('0x15')](_0xc7f4('0x1e'),this[_0xc7f4('0x19')],this[_0xc7f4('0x1a')],this[_0xc7f4('0x1b')],this[_0xc7f4('0x1c')],this[_0xc7f4('0x1d')]));this[_0xc7f4('0x1f')]=!![];}function createSquareReport(_0x4ce4b7,_0x505034){rpc[_0xc7f4('0x20')](_0x4ce4b7)[_0xc7f4('0x21')](function(_0x5cfb7d){if(_0x505034){_0x505034(null,_0x5cfb7d);}})[_0xc7f4('0x22')](function(_0x298b39){if(_0x505034){_0x505034(null,_0x298b39);}});}function setChannelVariables(_0x4a8aec){for(var _0x2f39ee in _0x4a8aec){if(_0x4a8aec[_0xc7f4('0x23')](_0x2f39ee)){if(_0x2f39ee[_0xc7f4('0x24')](_0xc7f4('0x25'))===0x0){_0x4a8aec[_0x2f39ee[_0xc7f4('0x26')](0x4)]=_0x4a8aec[_0x2f39ee];delete _0x4a8aec[_0x2f39ee];}}}}function agiHandler(_0x3e0a2f){logger[_0xc7f4('0x27')](_0xc7f4('0x28'),JSON[_0xc7f4('0x29')](_0x3e0a2f,null,0x2));logger[_0xc7f4('0x14')](util[_0xc7f4('0x15')](_0xc7f4('0x2a'),_0x3e0a2f['arg_1'],_0x3e0a2f[_0xc7f4('0x1a')],_0x3e0a2f[_0xc7f4('0x1b')],_0x3e0a2f[_0xc7f4('0x1c')],_0x3e0a2f[_0xc7f4('0x1d')]));_0x3e0a2f['on'](_0xc7f4('0xb'),errorHandler);_0x3e0a2f['on']('close',closeHandler);_0x3e0a2f['on'](_0xc7f4('0x2b'),timeoutHandler);_0x3e0a2f[_0xc7f4('0x1f')]=![];_0x3e0a2f['on'](_0xc7f4('0x2c'),hangupHandler);var _0x4acd48=_['find'](projects,[_0xc7f4('0x2d'),_0x3e0a2f[_0xc7f4('0x19')]]);if(!_0x4acd48)return Project[_0xc7f4('0x2e')](_0x3e0a2f);if(!_0x4acd48[_0xc7f4('0x2f')])return Project[_0xc7f4('0x30')](_0x3e0a2f);return Project[_0xc7f4('0x31')](_0x4acd48,_0x3e0a2f);}function main(){var _0x1e80b6;return utilLicense['getLicense']()['then'](function(_0x4696fe){if(!_0x4696fe)return;if(_0x4696fe[_0xc7f4('0x32')]){if(_0x4696fe['callysquare']&&_0x4696fe[_0xc7f4('0x33')]>0x0){logger['info'](util['format'](_0xc7f4('0x34'),_0x4696fe[_0xc7f4('0x33')]));_0x1e80b6=_0x4696fe[_0xc7f4('0x33')];}else{logger['info'](_0xc7f4('0x35'));}}else{logger[_0xc7f4('0x14')](_0xc7f4('0x36'));_0x1e80b6=-0x1;}})[_0xc7f4('0x21')](function(){return Project[_0xc7f4('0x37')]();})['then'](function(_0x683ea6){projects=_0x683ea6;return;})[_0xc7f4('0x22')](function(_0x21178f){logger['error']('[LICENSE]',_0x21178f[_0xc7f4('0xc')]);})[_0xc7f4('0x38')](function(){var _0x2e202a=require(_0xc7f4('0x39'))(config[_0xc7f4('0x5')][_0xc7f4('0x13')],config[_0xc7f4('0x5')]['ip'],_0x1e80b6);_0x2e202a['on'](_0xc7f4('0xb'),errorHandler);_0x2e202a['on'](_0xc7f4('0x3a'),listeningHandler);_0x2e202a['on'](_0xc7f4('0x3b'),connectionHandler);_0x2e202a['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xb21d=['close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','format','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb21d,0x1e2));var _0xdb21=function(_0x121014,_0x59b1d0){_0x121014=_0x121014-0x0;var _0x464b29=_0xb21d[_0x121014];return _0x464b29;};'use strict';var _=require(_0xdb21('0x0'));var syncho=require(_0xdb21('0x1'));var util=require(_0xdb21('0x2'));var config=require('../../config/environment');var logger=require(_0xdb21('0x3'))(_0xdb21('0x4'));var utilLicense=require(_0xdb21('0x5'));var rpc=require(_0xdb21('0x6'));var Project=require(_0xdb21('0x7'));var AGIEmitter=require(_0xdb21('0x8'))[_0xdb21('0x9')];var projects=[];config['agi']=_[_0xdb21('0xa')](config['agi'],{'ip':_0xdb21('0xb'),'port':0x11dd});AGIEmitter['on'](_0xdb21('0xc'),projectUpdateHandler);function connectionHandler(_0x1ebb6c){process[_0xdb21('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1ebb6c);agiHandler(_0x1ebb6c);}catch(_0x1e0a09){logger[_0xdb21('0xe')](_0x1e0a09[_0xdb21('0xf')]);}});});}function projectUpdateHandler(_0x3d91b0){try{var _0x359d3d=_['findIndex'](projects,['id',_0x3d91b0['id']]);if(_0x359d3d>-0x1){if(_0x3d91b0['deleted']===!![]){projects[_0xdb21('0x10')](_0x359d3d,0x1);}else{projects[_0x359d3d]=_0x3d91b0;}}else{projects[_0xdb21('0x11')](_0x3d91b0);}}catch(_0x5c199e){logger[_0xdb21('0xe')](_0x5c199e[_0xdb21('0xf')]);}}function listeningHandler(){console['log'](_0xdb21('0x12'),config[_0xdb21('0x4')][_0xdb21('0x13')]);logger[_0xdb21('0x14')](util['format'](_0xdb21('0x15'),config[_0xdb21('0x4')]['ip'],config[_0xdb21('0x4')][_0xdb21('0x13')]));}function errorHandler(_0x71c2db){if(_0x71c2db&&_0x71c2db[_0xdb21('0x16')]&&_0x71c2db[_0xdb21('0x17')]){logger[_0xdb21('0xe')](util['format'](_0xdb21('0x18'),_0x71c2db[_0xdb21('0x16')],_0x71c2db[_0xdb21('0x17')]));}else{logger[_0xdb21('0xe')](util['format']('[ERROR]\x20%s',_0x71c2db[_0xdb21('0xf')]));}}function closeHandler(){logger[_0xdb21('0x14')](util[_0xdb21('0x19')](_0xdb21('0x1a'),this['arg_1'],this[_0xdb21('0x1b')],this[_0xdb21('0x1c')],this[_0xdb21('0x1d')],this[_0xdb21('0x1e')]));try{createSquareReport(this);}catch(_0x3dfcd5){logger[_0xdb21('0xe')](_0x3dfcd5[_0xdb21('0xf')]);}}function timeoutHandler(){logger[_0xdb21('0x14')](util[_0xdb21('0x19')](_0xdb21('0x1f'),this[_0xdb21('0x20')],this[_0xdb21('0x1b')],this[_0xdb21('0x1c')],this[_0xdb21('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0xdb21('0x14')](util[_0xdb21('0x19')](_0xdb21('0x21'),this[_0xdb21('0x20')],this['calleridname'],this[_0xdb21('0x1c')],this[_0xdb21('0x1d')],this[_0xdb21('0x1e')]));this[_0xdb21('0x22')]=!![];}function createSquareReport(_0x185e89,_0x228290){rpc[_0xdb21('0x23')](_0x185e89)[_0xdb21('0x24')](function(_0x30c4bd){if(_0x228290){_0x228290(null,_0x30c4bd);}})[_0xdb21('0x25')](function(_0x582da3){if(_0x228290){_0x228290(null,_0x582da3);}});}function setChannelVariables(_0x5d149d){for(var _0x5c6263 in _0x5d149d){if(_0x5d149d[_0xdb21('0x26')](_0x5c6263)){if(_0x5c6263[_0xdb21('0x27')](_0xdb21('0x28'))===0x0){_0x5d149d[_0x5c6263[_0xdb21('0x29')](0x4)]=_0x5d149d[_0x5c6263];delete _0x5d149d[_0x5c6263];}}}}function agiHandler(_0x468e0e){logger[_0xdb21('0x2a')](_0xdb21('0x2b'),JSON[_0xdb21('0x2c')](_0x468e0e,null,0x2));logger['info'](util[_0xdb21('0x19')](_0xdb21('0x2d'),_0x468e0e[_0xdb21('0x20')],_0x468e0e[_0xdb21('0x1b')],_0x468e0e[_0xdb21('0x1c')],_0x468e0e[_0xdb21('0x1d')],_0x468e0e[_0xdb21('0x1e')]));_0x468e0e['on']('error',errorHandler);_0x468e0e['on'](_0xdb21('0x2e'),closeHandler);_0x468e0e['on'](_0xdb21('0x2f'),timeoutHandler);_0x468e0e[_0xdb21('0x22')]=![];_0x468e0e['on'](_0xdb21('0x30'),hangupHandler);var _0x4a4efd=_[_0xdb21('0x31')](projects,['name',_0x468e0e[_0xdb21('0x20')]]);if(!_0x4a4efd)return Project[_0xdb21('0x32')](_0x468e0e);if(!_0x4a4efd[_0xdb21('0x33')])return Project[_0xdb21('0x34')](_0x468e0e);return Project[_0xdb21('0x35')](_0x4a4efd,_0x468e0e);}function main(){var _0x56c836;return utilLicense[_0xdb21('0x36')]()[_0xdb21('0x24')](function(_0x5e7623){if(!_0x5e7623)return;if(_0x5e7623[_0xdb21('0x37')]){if(_0x5e7623[_0xdb21('0x38')]&&_0x5e7623[_0xdb21('0x38')]>0x0){logger[_0xdb21('0x14')](util['format'](_0xdb21('0x39'),_0x5e7623[_0xdb21('0x38')]));_0x56c836=_0x5e7623['callysquare'];}else{logger['info'](_0xdb21('0x3a'));}}else{logger[_0xdb21('0x14')](_0xdb21('0x3b'));_0x56c836=-0x1;}})['then'](function(){return Project[_0xdb21('0x3c')]();})[_0xdb21('0x24')](function(_0x5dc72d){projects=_0x5dc72d;return;})[_0xdb21('0x25')](function(_0x8f64e4){logger[_0xdb21('0xe')](_0xdb21('0x3d'),_0x8f64e4[_0xdb21('0xf')]);})[_0xdb21('0x3e')](function(){var _0x37dc45=require(_0xdb21('0x3f'))(config[_0xdb21('0x4')]['port'],config[_0xdb21('0x4')]['ip'],_0x56c836);_0x37dc45['on'](_0xdb21('0xe'),errorHandler);_0x37dc45['on'](_0xdb21('0x40'),listeningHandler);_0x37dc45['on'](_0xdb21('0x41'),connectionHandler);_0x37dc45['on'](_0xdb21('0x2e'),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 334369c..d29e722 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 _0xb313=['http','then','error','message','result','catch','SendMail','bluebird','client'];(function(_0x3199ea,_0x4d36e5){var _0x41abc4=function(_0x1da2e8){while(--_0x1da2e8){_0x3199ea['push'](_0x3199ea['shift']());}};_0x41abc4(++_0x4d36e5);}(_0xb313,0x181));var _0x3b31=function(_0x487a0b,_0x33c302){_0x487a0b=_0x487a0b-0x0;var _0x4cb1ba=_0xb313[_0x487a0b];return _0x4cb1ba;};'use strict';var BPromise=require(_0x3b31('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x3b31('0x1')][_0x3b31('0x2')]({'port':0x232b});function request(_0x3df95d,_0x1d45c1){return new BPromise(function(_0xb67860,_0x152f37){return client['request'](_0x3df95d,_0x1d45c1)[_0x3b31('0x3')](function(_0x557811){if(_0x557811[_0x3b31('0x4')]){return _0x152f37(_0x557811[_0x3b31('0x4')][_0x3b31('0x5')]);}else{return _0xb67860(_0x557811[_0x3b31('0x6')]);}})[_0x3b31('0x7')](function(_0x5ee7e2){return _0x152f37(_0x5ee7e2);});});}exports['sendMailMessage']=function(_0x31e0f3,_0x42d6e2){return request(_0x3b31('0x8'),{'account':_0x31e0f3,'message':_0x42d6e2});}; \ No newline at end of file +var _0x8d6e=['request','error','message','result','SendMail','jayson/promise','client'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x8d6e,0x1da));var _0xe8d6=function(_0x1409b9,_0x1df4a7){_0x1409b9=_0x1409b9-0x0;var _0x1d847f=_0x8d6e[_0x1409b9];return _0x1d847f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xe8d6('0x0'));var client=jayson[_0xe8d6('0x1')]['http']({'port':0x232b});function request(_0x7ccffd,_0x23036a){return new BPromise(function(_0x87d81,_0x163841){return client[_0xe8d6('0x2')](_0x7ccffd,_0x23036a)['then'](function(_0x393ad2){if(_0x393ad2['error']){return _0x163841(_0x393ad2[_0xe8d6('0x3')][_0xe8d6('0x4')]);}else{return _0x87d81(_0x393ad2[_0xe8d6('0x5')]);}})['catch'](function(_0x5e1128){return _0x163841(_0x5e1128);});});}exports['sendMailMessage']=function(_0x254f3d,_0x1176fd){return request(_0xe8d6('0x6'),{'account':_0x254f3d,'message':_0x1176fd});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 35a4ad7..8b164a5 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 _0x94d5=['[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','moment','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','isArray','length','source','target','addEdge','toJson','mxGraphModel','inspect','production','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','traverseBFS','vertex','gotoc','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid'];(function(_0x495dfe,_0xd3636b){var _0x41032e=function(_0x50136b){while(--_0x50136b){_0x495dfe['push'](_0x495dfe['shift']());}};_0x41032e(++_0xd3636b);}(_0x94d5,0x1ed));var _0x594d=function(_0xb2dc85,_0x5243d0){_0xb2dc85=_0xb2dc85-0x0;var _0x13f755=_0x94d5[_0xb2dc85];return _0x13f755;};'use strict';var _=require('lodash');var moment=require(_0x594d('0x0'));var parser=require('xml2json');var util=require(_0x594d('0x1'));var logger=require(_0x594d('0x2'))(_0x594d('0x3'));var rpc=require(_0x594d('0x4'));var mailRpc=require(_0x594d('0x5'));var Graph=require(_0x594d('0x6'));var Vertices=require(_0x594d('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x594d('0x8')]()[_0x594d('0x9')](function(_0x29b091){logger[_0x594d('0xa')](_0x594d('0xb'),_0x29b091[_0x594d('0xc')]);return[];});}function addVertex(_0x496cc,_0x35ba90,_0x4b73fd){_0x35ba90[_0x594d('0xd')]=_0x4b73fd;if(_0x35ba90[_0x594d('0xe')](_0x594d('0xf'))){_0x35ba90[_0x594d('0x10')]=parseInt(_0x35ba90[_0x594d('0xf')],0xa);}_0x496cc[_0x594d('0x11')](_['omit'](_0x35ba90,'mxCell'));}function initGraph(_0x59ae87,_0x2f18d2){var _0x55cfc3=new Graph();for(var _0x342367 in _0x59ae87){if(_0x59ae87[_0x594d('0xe')](_0x342367)){if(_[_0x594d('0x12')](_0x59ae87[_0x342367])){for(var _0x19a5f2=0x0;_0x19a5f2<_0x59ae87[_0x342367][_0x594d('0x13')];_0x19a5f2+=0x1){addVertex(_0x55cfc3,_0x59ae87[_0x342367][_0x19a5f2],_0x342367);}}else{addVertex(_0x55cfc3,_0x59ae87[_0x342367],_0x342367);}}}for(var _0xcb4ff4=0x0;_0xcb4ff4<_0x2f18d2[_0x594d('0x13')];_0xcb4ff4+=0x1){if(_0x2f18d2[_0xcb4ff4][_0x594d('0x14')]&&_0x2f18d2[_0xcb4ff4][_0x594d('0x15')]){_0x55cfc3[_0x594d('0x16')](_0x2f18d2[_0xcb4ff4]['source'],_0x2f18d2[_0xcb4ff4]['target'],_0x2f18d2[_0xcb4ff4]['value']);}}return _0x55cfc3;}function getRoot(_0x18e161){return parser[_0x594d('0x17')](_0x18e161,{'object':!![]})[_0x594d('0x18')]['root'];}function inspect(_0x5b8de7){return util[_0x594d('0x19')](_0x5b8de7,{'showHidden':![],'depth':null});}function initialize(_0x5c23f2,_0x12cc8f){var _0xc095cb=getRoot(_0x5c23f2[_0x594d('0x1a')]);if(!_0xc095cb||!_0xc095cb['start'])return;var _0x16f4fa,_0x1dbc09,_0x550c2d;logger[_0x594d('0x1b')](_0x594d('0x1c'),JSON[_0x594d('0x1d')](_0xc095cb,null,0x2));_0x12cc8f[_0x594d('0x1e')]=moment()[_0x594d('0x1f')](_0x594d('0x20'));_0x16f4fa=initGraph(_[_0x594d('0x21')](_0xc095cb,_0x594d('0x22')),_0xc095cb[_0x594d('0x22')]);_0x1dbc09=new Vertices(_0x12cc8f,rpc,mailRpc);logger[_0x594d('0x23')](util['format'](_0x594d('0x24'),_0x12cc8f[_0x594d('0x25')],_0x12cc8f['calleridname'],_0x12cc8f[_0x594d('0x26')],_0x12cc8f[_0x594d('0x27')],_0x12cc8f['uniqueid']));_0x16f4fa[_0x594d('0x28')](_0xc095cb['start']['id'],function(_0x5e4e12){try{_0x5e4e12=_0x1dbc09['clear'](_0x5e4e12);logger[_0x594d('0x1b')](_0x594d('0x29'),JSON['stringify'](_0x5e4e12,null,0x2));if(_0x5e4e12[_0x594d('0xd')]===_0x594d('0x2a')){logger[_0x594d('0x23')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x12cc8f[_0x594d('0x2b')]=_0x5e4e12[_0x594d('0x2b')]||_0x12cc8f[_0x594d('0x2b')];_0x12cc8f[_0x594d('0x2c')]=_0x5e4e12[_0x594d('0x2c')];_0x12cc8f[_0x594d('0x2d')]=_0x5e4e12[_0x594d('0x2d')]?_0x5e4e12[_0x594d('0x2d')]-0x1:0x1;return null;}else if(_0x5e4e12&&_0x1dbc09[_0x5e4e12[_0x594d('0xd')]]){_0x550c2d=_0x1dbc09[_0x5e4e12[_0x594d('0xd')]](_0x5e4e12);logger[_0x594d('0x23')](_0x594d('0x2e'),JSON[_0x594d('0x1d')](_0x550c2d,null,0x2));if(_0x550c2d&&_0x550c2d['code']===AGI_CODE_SUCCESS&&_0x550c2d[_0x594d('0x2f')]!==AGI_RESULT_ERROR&&!_0x12cc8f[_0x594d('0x30')]){logger[_0x594d('0x1b')](_0x594d('0x2e'),inspect(_0x550c2d));return _[_0x594d('0x31')](_0x550c2d[_0x594d('0x2f')])?null:_0x550c2d[_0x594d('0x2f')][_0x594d('0x32')]();}else{logger[_0x594d('0xa')](_0x594d('0x2e'),inspect(_0x550c2d));return null;}}else{logger[_0x594d('0xa')](_0x594d('0x33'));return null;}}catch(_0xc2286c){logger['error'](_0xc2286c[_0x594d('0xc')]);return null;}});if(_0xc095cb[_0x594d('0x34')]){logger[_0x594d('0x23')](util[_0x594d('0x1f')](_0x594d('0x35'),_0x12cc8f[_0x594d('0x25')],_0x12cc8f[_0x594d('0x36')],_0x12cc8f[_0x594d('0x26')],_0x12cc8f[_0x594d('0x27')],_0x12cc8f[_0x594d('0x37')]));_0x16f4fa[_0x594d('0x28')](_0xc095cb[_0x594d('0x34')]['id'],function(_0x25df11){try{_0x25df11=_0x1dbc09['clear'](_0x25df11);logger[_0x594d('0x1b')](_0x594d('0x29'),JSON[_0x594d('0x1d')](_0x25df11,null,0x2));if(_0x25df11&&_0x1dbc09[_0x25df11[_0x594d('0xd')]]){_0x550c2d=_0x1dbc09[_0x25df11['agicommand']](_0x25df11);if(_0x550c2d){logger[_0x594d('0x1b')]('response',inspect(_0x550c2d));return _[_0x594d('0x31')](_0x550c2d[_0x594d('0x2f')])?null:_0x550c2d[_0x594d('0x2f')][_0x594d('0x32')]();}else{logger['error'](_0x594d('0x2e'),inspect(_0x550c2d));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x3c38dc){logger[_0x594d('0xa')](_0x3c38dc[_0x594d('0xc')]);return null;}});}logger[_0x594d('0x23')](util[_0x594d('0x1f')](_0x594d('0x38'),_0x12cc8f[_0x594d('0x25')],_0x12cc8f['calleridname'],_0x12cc8f[_0x594d('0x26')],_0x12cc8f[_0x594d('0x27')],_0x12cc8f[_0x594d('0x37')]));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x12cc8f[_0x594d('0x2b')],_0x12cc8f['extension'],parseInt(_0x12cc8f[_0x594d('0x2d')],0xa)+0x1));_0x12cc8f[_0x594d('0x39')](_0x12cc8f[_0x594d('0x2b')],_0x12cc8f['extension'],parseInt(_0x12cc8f['priority'],0xa)+0x1);_0x12cc8f[_0x594d('0x3a')]();}function handleNotFound(_0x143de1){logger[_0x594d('0xa')](util['format'](_0x594d('0x3b'),_0x143de1['arg_1']));_0x143de1[_0x594d('0x39')](_0x143de1[_0x594d('0x2b')],_0x143de1['extension'],parseInt(_0x143de1[_0x594d('0x2d')],0xa)+0x1);_0x143de1[_0x594d('0x3a')]();}function handleUnpublished(_0x16371e){logger[_0x594d('0xa')](util[_0x594d('0x1f')]('Project\x20%s\x20not\x20published',_0x16371e[_0x594d('0x25')]));_0x16371e[_0x594d('0x39')](_0x16371e['context'],_0x16371e[_0x594d('0x2c')],parseInt(_0x16371e[_0x594d('0x2d')],0xa)+0x1);_0x16371e[_0x594d('0x3a')]();}module[_0x594d('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa6be=['context','extension','priority','agicommand','response','code','result','isUndefined','toString','error','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','clear','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','../../config/logger','agi','./mailRpc','./vertices','getSquareProjects','catch','stack','hasOwnProperty','retry','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','start','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x1e901f,_0x1c8295){var _0x46c282=function(_0x4b0718){while(--_0x4b0718){_0x1e901f['push'](_0x1e901f['shift']());}};_0x46c282(++_0x1c8295);}(_0xa6be,0x1a2));var _0xea6b=function(_0x2ac192,_0x89e5cc){_0x2ac192=_0x2ac192-0x0;var _0x3e1128=_0xa6be[_0x2ac192];return _0x3e1128;};'use strict';var _=require('lodash');var moment=require(_0xea6b('0x0'));var parser=require('xml2json');var util=require('util');var logger=require(_0xea6b('0x1'))(_0xea6b('0x2'));var rpc=require('./rpc');var mailRpc=require(_0xea6b('0x3'));var Graph=require('./graph');var Vertices=require(_0xea6b('0x4'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xea6b('0x5')]()[_0xea6b('0x6')](function(_0x511066){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x511066[_0xea6b('0x7')]);return[];});}function addVertex(_0x14ab7d,_0x457adb,_0x42ffb0){_0x457adb['agicommand']=_0x42ffb0;if(_0x457adb[_0xea6b('0x8')](_0xea6b('0x9'))){_0x457adb['maxRetry']=parseInt(_0x457adb['retry'],0xa);}_0x14ab7d['addVertex'](_[_0xea6b('0xa')](_0x457adb,_0xea6b('0xb')));}function initGraph(_0x226437,_0x557b67){var _0x2a9c3c=new Graph();for(var _0x459a08 in _0x226437){if(_0x226437[_0xea6b('0x8')](_0x459a08)){if(_[_0xea6b('0xc')](_0x226437[_0x459a08])){for(var _0x5644a5=0x0;_0x5644a5<_0x226437[_0x459a08][_0xea6b('0xd')];_0x5644a5+=0x1){addVertex(_0x2a9c3c,_0x226437[_0x459a08][_0x5644a5],_0x459a08);}}else{addVertex(_0x2a9c3c,_0x226437[_0x459a08],_0x459a08);}}}for(var _0x46de49=0x0;_0x46de49<_0x557b67[_0xea6b('0xd')];_0x46de49+=0x1){if(_0x557b67[_0x46de49][_0xea6b('0xe')]&&_0x557b67[_0x46de49][_0xea6b('0xf')]){_0x2a9c3c[_0xea6b('0x10')](_0x557b67[_0x46de49]['source'],_0x557b67[_0x46de49][_0xea6b('0xf')],_0x557b67[_0x46de49][_0xea6b('0x11')]);}}return _0x2a9c3c;}function getRoot(_0x13365b){return parser[_0xea6b('0x12')](_0x13365b,{'object':!![]})[_0xea6b('0x13')]['root'];}function inspect(_0x40bb30){return util[_0xea6b('0x14')](_0x40bb30,{'showHidden':![],'depth':null});}function initialize(_0xea416c,_0x5c6a36){var _0x44e259=getRoot(_0xea416c[_0xea6b('0x15')]);if(!_0x44e259||!_0x44e259['start'])return;var _0x5c1821,_0x41c9d5,_0x88c2a0;logger[_0xea6b('0x16')](_0xea6b('0x17'),JSON[_0xea6b('0x18')](_0x44e259,null,0x2));_0x5c6a36[_0xea6b('0x19')]=moment()[_0xea6b('0x1a')](_0xea6b('0x1b'));_0x5c1821=initGraph(_[_0xea6b('0xa')](_0x44e259,_0xea6b('0xb')),_0x44e259[_0xea6b('0xb')]);_0x41c9d5=new Vertices(_0x5c6a36,rpc,mailRpc);logger['info'](util['format'](_0xea6b('0x1c'),_0x5c6a36[_0xea6b('0x1d')],_0x5c6a36['calleridname'],_0x5c6a36[_0xea6b('0x1e')],_0x5c6a36[_0xea6b('0x1f')],_0x5c6a36[_0xea6b('0x20')]));_0x5c1821['traverseBFS'](_0x44e259[_0xea6b('0x21')]['id'],function(_0x564d09){try{_0x564d09=_0x41c9d5['clear'](_0x564d09);logger[_0xea6b('0x16')](_0xea6b('0x22'),JSON[_0xea6b('0x18')](_0x564d09,null,0x2));if(_0x564d09['agicommand']===_0xea6b('0x23')){logger[_0xea6b('0x24')](_0xea6b('0x25'));_0x5c6a36[_0xea6b('0x26')]=_0x564d09[_0xea6b('0x26')]||_0x5c6a36['context'];_0x5c6a36[_0xea6b('0x27')]=_0x564d09[_0xea6b('0x27')];_0x5c6a36[_0xea6b('0x28')]=_0x564d09['priority']?_0x564d09[_0xea6b('0x28')]-0x1:0x1;return null;}else if(_0x564d09&&_0x41c9d5[_0x564d09['agicommand']]){_0x88c2a0=_0x41c9d5[_0x564d09[_0xea6b('0x29')]](_0x564d09);logger[_0xea6b('0x24')](_0xea6b('0x2a'),JSON['stringify'](_0x88c2a0,null,0x2));if(_0x88c2a0&&_0x88c2a0[_0xea6b('0x2b')]===AGI_CODE_SUCCESS&&_0x88c2a0[_0xea6b('0x2c')]!==AGI_RESULT_ERROR&&!_0x5c6a36['evtHangup']){logger[_0xea6b('0x16')](_0xea6b('0x2a'),inspect(_0x88c2a0));return _[_0xea6b('0x2d')](_0x88c2a0[_0xea6b('0x2c')])?null:_0x88c2a0[_0xea6b('0x2c')][_0xea6b('0x2e')]();}else{logger[_0xea6b('0x2f')](_0xea6b('0x2a'),inspect(_0x88c2a0));return null;}}else{logger[_0xea6b('0x2f')]('agicommand\x20not\x20found');return null;}}catch(_0x5ef713){logger[_0xea6b('0x2f')](_0x5ef713[_0xea6b('0x7')]);return null;}});if(_0x44e259[_0xea6b('0x30')]){logger['info'](util[_0xea6b('0x1a')](_0xea6b('0x31'),_0x5c6a36[_0xea6b('0x1d')],_0x5c6a36[_0xea6b('0x32')],_0x5c6a36[_0xea6b('0x1e')],_0x5c6a36[_0xea6b('0x1f')],_0x5c6a36[_0xea6b('0x20')]));_0x5c1821['traverseBFS'](_0x44e259['finally']['id'],function(_0x1ab7a9){try{_0x1ab7a9=_0x41c9d5[_0xea6b('0x33')](_0x1ab7a9);logger[_0xea6b('0x16')](_0xea6b('0x22'),JSON[_0xea6b('0x18')](_0x1ab7a9,null,0x2));if(_0x1ab7a9&&_0x41c9d5[_0x1ab7a9['agicommand']]){_0x88c2a0=_0x41c9d5[_0x1ab7a9[_0xea6b('0x29')]](_0x1ab7a9);if(_0x88c2a0){logger[_0xea6b('0x16')](_0xea6b('0x2a'),inspect(_0x88c2a0));return _[_0xea6b('0x2d')](_0x88c2a0[_0xea6b('0x2c')])?null:_0x88c2a0[_0xea6b('0x2c')][_0xea6b('0x2e')]();}else{logger[_0xea6b('0x2f')](_0xea6b('0x2a'),inspect(_0x88c2a0));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x3bf02f){logger[_0xea6b('0x2f')](_0x3bf02f[_0xea6b('0x7')]);return null;}});}logger[_0xea6b('0x24')](util[_0xea6b('0x1a')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c6a36[_0xea6b('0x1d')],_0x5c6a36['calleridname'],_0x5c6a36[_0xea6b('0x1e')],_0x5c6a36[_0xea6b('0x1f')],_0x5c6a36[_0xea6b('0x20')]));logger['info'](util[_0xea6b('0x1a')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5c6a36[_0xea6b('0x26')],_0x5c6a36['extension'],parseInt(_0x5c6a36['priority'],0xa)+0x1));_0x5c6a36[_0xea6b('0x34')](_0x5c6a36[_0xea6b('0x26')],_0x5c6a36[_0xea6b('0x27')],parseInt(_0x5c6a36[_0xea6b('0x28')],0xa)+0x1);_0x5c6a36[_0xea6b('0x35')]();}function handleNotFound(_0x4b2f8e){logger[_0xea6b('0x2f')](util[_0xea6b('0x1a')](_0xea6b('0x36'),_0x4b2f8e[_0xea6b('0x1d')]));_0x4b2f8e[_0xea6b('0x34')](_0x4b2f8e[_0xea6b('0x26')],_0x4b2f8e[_0xea6b('0x27')],parseInt(_0x4b2f8e[_0xea6b('0x28')],0xa)+0x1);_0x4b2f8e[_0xea6b('0x35')]();}function handleUnpublished(_0x2ac9ab){logger['error'](util[_0xea6b('0x1a')](_0xea6b('0x37'),_0x2ac9ab['arg_1']));_0x2ac9ab[_0xea6b('0x34')](_0x2ac9ab[_0xea6b('0x26')],_0x2ac9ab[_0xea6b('0x27')],parseInt(_0x2ac9ab['priority'],0xa)+0x1);_0x2ac9ab[_0xea6b('0x35')]();}module[_0xea6b('0x38')]={'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 612a63d..48f22dc 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 _0x8262=['prototype','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','emit','headers','line','exports','util','stream','Transform','call','_localBuffer'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x8262,0x9d));var _0x2826=function(_0x5cee0f,_0x2c69af){_0x5cee0f=_0x5cee0f-0x0;var _0x2a1ae7=_0x8262[_0x5cee0f];return _0x2a1ae7;};'use strict';var util=require(_0x2826('0x0'));var Transform=require(_0x2826('0x1'))[_0x2826('0x2')];function AGIReply(_0x267c2e){Transform[_0x2826('0x3')](this,_0x267c2e);this[_0x2826('0x4')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x2826('0x5')]['_transform']=function(_0x52d098,_0x4567c5,_0x22d692){var _0x2ba3ea='\x0a',_0x429187=['\x0a\x0a',_0x2826('0x6')],_0x34f637=-0x1,_0xf141e=-0x1,_0x168e6d='',_0x256524=0x0,_0x3fadbc='',_0x5112c7='';this[_0x2826('0x4')]+=_0x52d098[_0x2826('0x7')]();_0x3fadbc=this['_localBuffer'];if(!this[_0x2826('0x8')]){_0x256524=0x0;while(_0x429187[_0x256524]){while((_0xf141e=_0x3fadbc[_0x2826('0x9')](_0x429187[_0x256524]))!=-0x1){_0x168e6d=_0x429187[_0x256524];_0x5112c7=_0x3fadbc[_0x2826('0xa')](0x0,_0xf141e);_0x3fadbc=_0x3fadbc[_0x2826('0xa')](_0xf141e+_0x168e6d[_0x2826('0xb')]);var _0x688b7a=_0x5112c7[_0x2826('0xc')](_0x2ba3ea),_0x1c9ab9=0x0,_0x5723dc={},_0x50f887='',_0x298c28='',_0x9c30c5=-0x1;while(_0x688b7a[_0x1c9ab9]){_0x9c30c5=_0x688b7a[_0x1c9ab9][_0x2826('0x9')](':');if(_0x9c30c5!=-0x1){_0x50f887=_0x688b7a[_0x1c9ab9][_0x2826('0xd')](0x0,_0x9c30c5)['trim']();_0x298c28=_0x688b7a[_0x1c9ab9][_0x2826('0xd')](_0x9c30c5+0x1)['trim']();if(_0x50f887['length']>0x0){_0x5723dc[_0x50f887]=_0x298c28;}}else{}_0x1c9ab9++;}this[_0x2826('0xe')](_0x2826('0xf'),_0x5723dc);this[_0x2826('0x8')]=!![];}_0x256524++;}this[_0x2826('0x4')]=_0x3fadbc;}else{while((_0x34f637=_0x3fadbc[_0x2826('0x9')](_0x2ba3ea))!=-0x1){_0x5112c7=_0x3fadbc['substring'](0x0,_0x34f637);this[_0x2826('0xe')](_0x2826('0x10'),_0x5112c7);_0x3fadbc=_0x3fadbc[_0x2826('0xa')](_0x34f637+_0x2ba3ea[_0x2826('0xb')]);}this[_0x2826('0x4')]=_0x3fadbc;}_0x22d692();};module[_0x2826('0x11')]=AGIReply; \ No newline at end of file +var _0x2160=['stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','length','split','slice','trim','emit','headers','substring'];(function(_0x1c29af,_0x4c5e8a){var _0x3326c2=function(_0x4e9040){while(--_0x4e9040){_0x1c29af['push'](_0x1c29af['shift']());}};_0x3326c2(++_0x4c5e8a);}(_0x2160,0x132));var _0x0216=function(_0x3c2984,_0x2c03fc){_0x3c2984=_0x3c2984-0x0;var _0x10f919=_0x2160[_0x3c2984];return _0x10f919;};'use strict';var util=require('util');var Transform=require(_0x0216('0x0'))[_0x0216('0x1')];function AGIReply(_0x419876){Transform[_0x0216('0x2')](this,_0x419876);this[_0x0216('0x3')]='';this[_0x0216('0x4')]=![];}util[_0x0216('0x5')](AGIReply,Transform);AGIReply[_0x0216('0x6')][_0x0216('0x7')]=function(_0x1c7af9,_0x978b93,_0x2d5a59){var _0x3c6e96='\x0a',_0x462464=['\x0a\x0a',_0x0216('0x8')],_0x47af64=-0x1,_0x337ccd=-0x1,_0x2fd88d='',_0x578377=0x0,_0x555235='',_0x3f6b7e='';this[_0x0216('0x3')]+=_0x1c7af9['toString']();_0x555235=this[_0x0216('0x3')];if(!this[_0x0216('0x4')]){_0x578377=0x0;while(_0x462464[_0x578377]){while((_0x337ccd=_0x555235[_0x0216('0x9')](_0x462464[_0x578377]))!=-0x1){_0x2fd88d=_0x462464[_0x578377];_0x3f6b7e=_0x555235['substring'](0x0,_0x337ccd);_0x555235=_0x555235['substring'](_0x337ccd+_0x2fd88d[_0x0216('0xa')]);var _0x2bbf8b=_0x3f6b7e[_0x0216('0xb')](_0x3c6e96),_0x31eeb7=0x0,_0x5815aa={},_0x55b393='',_0x39d8de='',_0x22e8ed=-0x1;while(_0x2bbf8b[_0x31eeb7]){_0x22e8ed=_0x2bbf8b[_0x31eeb7][_0x0216('0x9')](':');if(_0x22e8ed!=-0x1){_0x55b393=_0x2bbf8b[_0x31eeb7][_0x0216('0xc')](0x0,_0x22e8ed)[_0x0216('0xd')]();_0x39d8de=_0x2bbf8b[_0x31eeb7][_0x0216('0xc')](_0x22e8ed+0x1)['trim']();if(_0x55b393['length']>0x0){_0x5815aa[_0x55b393]=_0x39d8de;}}else{}_0x31eeb7++;}this[_0x0216('0xe')](_0x0216('0xf'),_0x5815aa);this[_0x0216('0x4')]=!![];}_0x578377++;}this[_0x0216('0x3')]=_0x555235;}else{while((_0x47af64=_0x555235['indexOf'](_0x3c6e96))!=-0x1){_0x3f6b7e=_0x555235[_0x0216('0x10')](0x0,_0x47af64);this[_0x0216('0xe')]('line',_0x3f6b7e);_0x555235=_0x555235[_0x0216('0x10')](_0x47af64+_0x3c6e96[_0x0216('0xa')]);}this[_0x0216('0x3')]=_0x555235;}_0x2d5a59();};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 6f4aef8..4dc9c71 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 _0x3c70=['CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','error','message','result','getSquareProjects','GetSquareProjects','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport'];(function(_0x1c009f,_0x3d174b){var _0x5d48ba=function(_0x4e25a8){while(--_0x4e25a8){_0x1c009f['push'](_0x1c009f['shift']());}};_0x5d48ba(++_0x3d174b);}(_0x3c70,0x10c));var _0x03c7=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x3c70[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x03c7('0x0'));var moment=require(_0x03c7('0x1'));var jayson=require(_0x03c7('0x2'));var client=jayson['client'][_0x03c7('0x3')]({'port':0x2329});function request(_0x15adad,_0x1cd556){return new Promise(function(_0x37a9ea,_0x38a36b){return client[_0x03c7('0x4')](_0x15adad,_0x1cd556)['then'](function(_0x1e9745){if(_0x1e9745['error']){return _0x38a36b(_0x1e9745[_0x03c7('0x5')][_0x03c7('0x6')]);}else{return _0x37a9ea(_0x1e9745[_0x03c7('0x7')]);}})['catch'](function(_0x263185){return _0x38a36b(_0x263185);});});}exports[_0x03c7('0x8')]=function(){return request(_0x03c7('0x9'),{'options':{'raw':![],'attributes':['id','name',_0x03c7('0xa')]}});};exports['getSquareProject']=function(_0x103052){return request(_0x03c7('0xb'),{'options':{'raw':![],'where':{'name':_0x103052},'attributes':['production']}});};exports[_0x03c7('0xc')]=function(_0x2b62fb){return request(_0x03c7('0xd'),{'options':{'raw':![],'where':{'id':_0x2b62fb},'include':[{'model':_0x03c7('0xe'),'as':_0x03c7('0xf'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0x03c7('0x10'),_0x03c7('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x44ba3d){return request(_0x03c7('0xb'),{'options':{'where':{'id':_0x44ba3d},'attributes':[_0x03c7('0x10')]}});};exports[_0x03c7('0x12')]=function(_0x1d9668){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1d9668},'attributes':[_0x03c7('0x10')]}});};exports['getVariableById']=function(_0xdc48a7){return request(_0x03c7('0x13'),{'options':{'where':{'id':_0xdc48a7},'attributes':['name']}});};exports[_0x03c7('0x14')]=function(_0x345798){return request(_0x03c7('0x15'),{'options':{'where':{'id':_0x345798},'attributes':['dsn']}});};exports[_0x03c7('0x16')]=function(_0x6c852d){return request(_0x03c7('0x17'),{'options':{'where':{'id':_0x6c852d},'attributes':[_0x03c7('0x10')]}});};exports[_0x03c7('0x18')]=function(_0x2946d7){return request('GetContactByPhone',{'options':{'where':{'phone':_0x2946d7['phone']},'attributes':['id']}});};exports[_0x03c7('0x19')]=function(_0x2cd27c){return request(_0x03c7('0x1a'),{'options':{'where':{'id':_0x2cd27c},'attributes':[_0x03c7('0x10')]}});};exports[_0x03c7('0x1b')]=function(_0x5a03c6){return request(_0x03c7('0x1c'),{'options':{'where':{'id':_0x5a03c6},'attributes':[_0x03c7('0x1d')]}});};exports['getIntervalById']=function(_0x4e8062){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4e8062},'include':[{'model':_0x03c7('0x1e'),'as':_0x03c7('0x1f')}]}});};exports[_0x03c7('0x20')]=function(_0x50b316){return request(_0x03c7('0x21'),{'options':{'where':{'id':_0x50b316},'attributes':['id',_0x03c7('0x10')]}});};exports[_0x03c7('0x22')]=function(_0x4d6a9c){return request(_0x03c7('0x23'),{'body':_0x4d6a9c});};exports['createSquareDetailsReport']=function(_0x43e541){return request('CreateSquareDetailsReport',{'body':_0x43e541});};exports[_0x03c7('0x24')]=function(_0x4844f2){return request(_0x03c7('0x25'),{'body':_[_0x03c7('0x26')](_0x4844f2,{'project_name':_0x4844f2[_0x03c7('0x27')],'prev_project_name':_0x4844f2['arg_2']||'','is_subproject':_0x4844f2[_0x03c7('0x28')]?!![]:![],'leaveAt':moment()[_0x03c7('0x29')](_0x03c7('0x2a'))})});};exports[_0x03c7('0x2b')]=function(_0x5041fe){return request('CreateSquareRecording',{'body':_0x5041fe});};exports[_0x03c7('0x2c')]=function(_0x58ad44){return request(_0x03c7('0x2d'),{'body':_0x58ad44});};exports[_0x03c7('0x2e')]=function(_0x51929b){return request(_0x03c7('0x2f'),{'options':{'raw':![],'where':{'phone':_0x51929b[_0x03c7('0x30')],'ListId':_0x51929b[_0x03c7('0x31')]}}})[_0x03c7('0x32')](function(_0x1e2b90){if(_0x1e2b90){return _0x1e2b90;}return request(_0x03c7('0x33'),{'body':_0x51929b});});};exports[_0x03c7('0x34')]=function(_0x2ab3bb){return request(_0x03c7('0x35'),{'options':{'where':{'id':_0x2ab3bb},'attributes':[_0x03c7('0x10')]}});};exports[_0x03c7('0x36')]=function(_0x4de5f4,_0x19c3ff){return request(_0x03c7('0x37'),{'body':{'interface':_0x19c3ff},'options':{'where':_0x4de5f4}});};exports[_0x03c7('0x38')]=function(_0x5ed9ca,_0x4d6871,_0x54e183){return request(_0x03c7('0x39'),{'body':{'type':_0x4d6871,'uniqueid':_0x54e183},'options':{'where':_0x5ed9ca}});};exports['agentUnpause']=function(_0x233cbd){return request(_0x03c7('0x3a'),{'body':{},'options':{'where':_0x233cbd}});};exports[_0x03c7('0x3b')]=function(_0x53fd4f){return request(_0x03c7('0x3c'),{'body':{},'options':{'where':_0x53fd4f}});}; \ No newline at end of file +var _0x2a3a=['CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','result','catch','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage'];(function(_0x4d88ce,_0x1d8f5c){var _0x2b8294=function(_0xe35e15){while(--_0xe35e15){_0x4d88ce['push'](_0x4d88ce['shift']());}};_0x2b8294(++_0x1d8f5c);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x3f2824,_0x2cc4d3){_0x3f2824=_0x3f2824-0x0;var _0xd6ec8a=_0x2a3a[_0x3f2824];return _0xd6ec8a;};'use strict';var _=require(_0xa2a3('0x0'));var moment=require(_0xa2a3('0x1'));var jayson=require(_0xa2a3('0x2'));var client=jayson[_0xa2a3('0x3')][_0xa2a3('0x4')]({'port':0x2329});function request(_0x4caf0f,_0x531167){return new Promise(function(_0x45b267,_0x34d7f9){return client[_0xa2a3('0x5')](_0x4caf0f,_0x531167)[_0xa2a3('0x6')](function(_0xb4826a){if(_0xb4826a[_0xa2a3('0x7')]){return _0x34d7f9(_0xb4826a[_0xa2a3('0x7')]['message']);}else{return _0x45b267(_0xb4826a[_0xa2a3('0x8')]);}})[_0xa2a3('0x9')](function(_0x2a3753){return _0x34d7f9(_0x2a3753);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0xa2a3('0xa')]}});};exports[_0xa2a3('0xb')]=function(_0x2877fc){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2877fc},'attributes':[_0xa2a3('0xa')]}});};exports[_0xa2a3('0xc')]=function(_0x3d255c){return request(_0xa2a3('0xd'),{'options':{'raw':![],'where':{'id':_0x3d255c},'include':[{'model':_0xa2a3('0xe'),'as':'Smtp','include':[{'model':_0xa2a3('0xf'),'as':'CloudProvider'}]}],'attributes':['id',_0xa2a3('0x10'),_0xa2a3('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x1bddd1){return request(_0xa2a3('0x12'),{'options':{'where':{'id':_0x1bddd1},'attributes':[_0xa2a3('0x10')]}});};exports[_0xa2a3('0x13')]=function(_0x3ebb1b){return request(_0xa2a3('0x14'),{'options':{'where':{'id':_0x3ebb1b},'attributes':[_0xa2a3('0x10')]}});};exports['getVariableById']=function(_0xe91715){return request(_0xa2a3('0x15'),{'options':{'where':{'id':_0xe91715},'attributes':['name']}});};exports[_0xa2a3('0x16')]=function(_0x239716){return request(_0xa2a3('0x17'),{'options':{'where':{'id':_0x239716},'attributes':[_0xa2a3('0x18')]}});};exports[_0xa2a3('0x19')]=function(_0x5f25db){return request(_0xa2a3('0x1a'),{'options':{'where':{'id':_0x5f25db},'attributes':[_0xa2a3('0x10')]}});};exports[_0xa2a3('0x1b')]=function(_0x4a04c4){return request(_0xa2a3('0x1c'),{'options':{'where':{'phone':_0x4a04c4[_0xa2a3('0x1d')]},'attributes':['id']}});};exports[_0xa2a3('0x1e')]=function(_0x32c207){return request(_0xa2a3('0x1f'),{'options':{'where':{'id':_0x32c207},'attributes':[_0xa2a3('0x10')]}});};exports['getSoundById']=function(_0x40a787){return request(_0xa2a3('0x20'),{'options':{'where':{'id':_0x40a787},'attributes':[_0xa2a3('0x21')]}});};exports['getIntervalById']=function(_0x34d848){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x34d848},'include':[{'model':_0xa2a3('0x22'),'as':_0xa2a3('0x23')}]}});};exports[_0xa2a3('0x24')]=function(_0x1ce1f3){return request(_0xa2a3('0x25'),{'options':{'where':{'id':_0x1ce1f3},'attributes':['id',_0xa2a3('0x10')]}});};exports['createSmsMessage']=function(_0x419d77){return request(_0xa2a3('0x26'),{'body':_0x419d77});};exports[_0xa2a3('0x27')]=function(_0x314458){return request(_0xa2a3('0x28'),{'body':_0x314458});};exports[_0xa2a3('0x29')]=function(_0x414d74){return request(_0xa2a3('0x2a'),{'body':_['merge'](_0x414d74,{'project_name':_0x414d74[_0xa2a3('0x2b')],'prev_project_name':_0x414d74['arg_2']||'','is_subproject':_0x414d74[_0xa2a3('0x2c')]?!![]:![],'leaveAt':moment()[_0xa2a3('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xa2a3('0x2e')]=function(_0x2edd1e){return request(_0xa2a3('0x2f'),{'body':_0x2edd1e});};exports[_0xa2a3('0x30')]=function(_0x16d5c0){return request(_0xa2a3('0x31'),{'body':_0x16d5c0});};exports[_0xa2a3('0x32')]=function(_0x1ad382){return request(_0xa2a3('0x33'),{'options':{'raw':![],'where':{'phone':_0x1ad382[_0xa2a3('0x1d')],'ListId':_0x1ad382[_0xa2a3('0x34')]}}})['then'](function(_0x1a5d36){if(_0x1a5d36){return _0x1a5d36;}return request('CreateCmContact',{'body':_0x1ad382});});};exports[_0xa2a3('0x35')]=function(_0x19d6c8){return request(_0xa2a3('0x36'),{'options':{'where':{'id':_0x19d6c8},'attributes':[_0xa2a3('0x10')]}});};exports[_0xa2a3('0x37')]=function(_0x1e7bfd,_0x15f212){return request(_0xa2a3('0x38'),{'body':{'interface':_0x15f212},'options':{'where':_0x1e7bfd}});};exports[_0xa2a3('0x39')]=function(_0x504197,_0x34a3f7,_0x4fe4dc){return request(_0xa2a3('0x3a'),{'body':{'type':_0x34a3f7,'uniqueid':_0x4fe4dc},'options':{'where':_0x504197}});};exports[_0xa2a3('0x3b')]=function(_0x7060d1){return request('UnpauseUser',{'body':{},'options':{'where':_0x7060d1}});};exports[_0xa2a3('0x3c')]=function(_0x4a16ee){return request(_0xa2a3('0x3d'),{'body':{},'options':{'where':_0x4a16ee}});}; \ 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 3c74279..6ba09fe 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 _0xed1f=['./polly','./lex'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xed1f,0x170));var _0xfed1=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xed1f[_0x486f4a];return _0x135d99;};var polly=require(_0xfed1('0x0'));var lex=require(_0xfed1('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5fc3=['./polly','./lex'];(function(_0x15fb82,_0x2c148f){var _0x33e9cb=function(_0x52e2c9){while(--_0x52e2c9){_0x15fb82['push'](_0x15fb82['shift']());}};_0x33e9cb(++_0x2c148f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x5fc3[_0x303c30];return _0x43161b;};var polly=require(_0x35fc('0x0'));var lex=require(_0x35fc('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index cd3f985..a7dda98 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 _0x750a=['exports'];(function(_0x416623,_0x7d0d25){var _0x289659=function(_0x17c537){while(--_0x17c537){_0x416623['push'](_0x416623['shift']());}};_0x289659(++_0x7d0d25);}(_0x750a,0x140));var _0xa750=function(_0x5783ca,_0x5c2fbd){_0x5783ca=_0x5783ca-0x0;var _0x1fca68=_0x750a[_0x5783ca];return _0x1fca68;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ No newline at end of file +var _0xa571=['exports','./lib/api'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa571,0x107));var _0x1a57=function(_0x48ce56,_0x213bea){_0x48ce56=_0x48ce56-0x0;var _0x25e8a1=_0xa571[_0x48ce56];return _0x25e8a1;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ 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 ae5ddb5..94c9bd8 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(_0x218d19,_0x4b439){var _0x397a6e=function(_0x53fc7b){while(--_0x53fc7b){_0x218d19['push'](_0x218d19['shift']());}};_0x397a6e(++_0x4b439);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x332e0e,_0x4fc5bf){var _0x107bfc=function(_0x354460){while(--_0x354460){_0x332e0e['push'](_0x332e0e['shift']());}};_0x107bfc(++_0x4fc5bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 672634f..ffaf0a8 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 _0xb689=['./lib/api','exports'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xb689,0xd0));var _0x9b68=function(_0x5c24b6,_0x5d43c3){_0x5c24b6=_0x5c24b6-0x0;var _0x24c670=_0xb689[_0x5c24b6];return _0x24c670;};'use strict';var polly=require(_0x9b68('0x0'));module[_0x9b68('0x1')]=function(_0x3d62f4,_0x5497ac,_0x3adcae,_0x8a100,_0x5e9405,_0x18a0c0,_0x575743){return polly(_0x3d62f4,_0x5497ac,_0x3adcae,_0x8a100,_0x5e9405,_0x18a0c0,_0x575743);}; \ No newline at end of file +var _0x1a2a=['./lib/api','exports'];(function(_0xba7139,_0x46a55a){var _0xcc1790=function(_0x2cff74){while(--_0x2cff74){_0xba7139['push'](_0xba7139['shift']());}};_0xcc1790(++_0x46a55a);}(_0x1a2a,0xa4));var _0xa1a2=function(_0x11ecea,_0xac684e){_0x11ecea=_0x11ecea-0x0;var _0x3c033b=_0x1a2a[_0x11ecea];return _0x3c033b;};'use strict';var polly=require(_0xa1a2('0x0'));module[_0xa1a2('0x1')]=function(_0x2a2440,_0x4b1526,_0x34c10c,_0x43b5dc,_0x155d31,_0x55984b,_0x29cdf5){return polly(_0x2a2440,_0x4b1526,_0x34c10c,_0x43b5dc,_0x155d31,_0x55984b,_0x29cdf5);}; \ 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 1bd0796..1962a9c 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 _0x929e=['path','bluebird','randomstring','aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x929e,0xb4));var _0xe929=function(_0x5f4e49,_0x5696ad){_0x5f4e49=_0x5f4e49-0x0;var _0x373960=_0x929e[_0x5f4e49];return _0x373960;};'use strict';var fs=require('fs');var path=require(_0xe929('0x0'));var BPromise=require(_0xe929('0x1'));var rs=require(_0xe929('0x2'));var AWS=require(_0xe929('0x3'));function pollyResult(_0x81ff3,_0x4b2a08,_0x2eff66){return new BPromise(function(_0x1baa98,_0x117394){_0x81ff3['synthesizeSpeech'](_0x4b2a08,function(_0x2be724,_0x292c28){if(_0x2be724){_0x117394(_0x2be724);}else if(_0x292c28){if(_0x292c28['AudioStream']instanceof Buffer){fs[_0xe929('0x4')](_0x2eff66,_0x292c28[_0xe929('0x5')],function(_0x5248b6){if(_0x5248b6){_0x117394(_0x5248b6);}else{_0x1baa98();}});}else{_0x117394(new Error(_0xe929('0x6')));}}else{_0x117394(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xe929('0x7')]=function(_0x41904e,_0xf533b9,_0x431c0e,_0x5b57ce,_0x1937f4,_0x84610c,_0x3fe199){var _0x35ff27=new AWS['Polly']({'accessKeyId':_0x41904e,'secretAccessKey':_0xf533b9,'region':_0x431c0e});var _0x518e79={'Text':_0x1937f4,'TextType':_0x84610c||_0xe929('0x8'),'OutputFormat':_0xe929('0x9'),'VoiceId':_0x5b57ce};return pollyResult(_0x35ff27,_0x518e79,_0x3fe199);}; \ No newline at end of file +var _0x76f1=['aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','bluebird'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0x76f1,0x14f));var _0x176f=function(_0x552f19,_0x31142a){_0x552f19=_0x552f19-0x0;var _0x45dced=_0x76f1[_0x552f19];return _0x45dced;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x176f('0x0'));var rs=require('randomstring');var AWS=require(_0x176f('0x1'));function pollyResult(_0x4bdc98,_0x2a0b29,_0x5aa2fc){return new BPromise(function(_0x58b3aa,_0x253450){_0x4bdc98['synthesizeSpeech'](_0x2a0b29,function(_0x4b274c,_0x1d8cf2){if(_0x4b274c){_0x253450(_0x4b274c);}else if(_0x1d8cf2){if(_0x1d8cf2['AudioStream']instanceof Buffer){fs[_0x176f('0x2')](_0x5aa2fc,_0x1d8cf2[_0x176f('0x3')],function(_0x260af0){if(_0x260af0){_0x253450(_0x260af0);}else{_0x58b3aa();}});}else{_0x253450(new Error(_0x176f('0x4')));}}else{_0x253450(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x176f('0x5')]=function(_0x185fe5,_0x2fdde7,_0x2dc0f9,_0x2b95b,_0x3a5bf7,_0x3e9e5d,_0x4180a1){var _0x2a8534=new AWS[(_0x176f('0x6'))]({'accessKeyId':_0x185fe5,'secretAccessKey':_0x2fdde7,'region':_0x2dc0f9});var _0x1a5927={'Text':_0x3a5bf7,'TextType':_0x3e9e5d||'text','OutputFormat':'mp3','VoiceId':_0x2b95b};return pollyResult(_0x2a8534,_0x1a5927,_0x4180a1);}; \ 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 b02edb9..a51b3d9 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 _0xcee8=['./lib/api','exports'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xcee8,0xe4));var _0x8cee=function(_0xa20971,_0x1bf32c){_0xa20971=_0xa20971-0x0;var _0x4f4271=_0xcee8[_0xa20971];return _0x4f4271;};'use strict';var asr=require(_0x8cee('0x0'));module[_0x8cee('0x1')]=function(_0x5b54d0,_0xa5d555,_0x28cb16,_0x5cf7bb){return asr(_0x5b54d0,_0xa5d555,_0x28cb16);}; \ No newline at end of file +var _0x7636=['./lib/api','exports'];(function(_0x160dbd,_0x31a6f9){var _0x83a034=function(_0x3bf94f){while(--_0x3bf94f){_0x160dbd['push'](_0x160dbd['shift']());}};_0x83a034(++_0x31a6f9);}(_0x7636,0x6e));var _0x6763=function(_0xc29e65,_0x7f1e9e){_0xc29e65=_0xc29e65-0x0;var _0x36240d=_0x7636[_0xc29e65];return _0x36240d;};'use strict';var asr=require(_0x6763('0x0'));module[_0x6763('0x1')]=function(_0x41f925,_0x11f3fd,_0x2857d2,_0x431e55){return asr(_0x41f925,_0x11f3fd,_0x2857d2);}; \ 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 c960f1f..ffedad5 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 _0xfe57=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','8000','url','bluebird','string'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfe57,0x195));var _0x7fe5=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0xfe57[_0x1e03a6];return _0x295b64;};'use strict';var url=require(_0x7fe5('0x0'));var BPromise=require(_0x7fe5('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x3f7dca,_0x4744a9,_0xc27f79){return new BPromise(function(_0x421809,_0x89ad5f){var _0x1254d2;if(typeof _0x3f7dca!==_0x7fe5('0x2')||_0x3f7dca[_0x7fe5('0x3')]===0x0){return _0x89ad5f(_0x7fe5('0x4'));}if(typeof _0x4744a9!==_0x7fe5('0x2')||_0x4744a9[_0x7fe5('0x3')]===0x0){return _0x89ad5f(_0x7fe5('0x5'));}if(typeof _0xc27f79!==_0x7fe5('0x6')&&(typeof _0xc27f79!=='string'||_0xc27f79[_0x7fe5('0x3')]===0x0)){return _0x89ad5f('lang\x20should\x20be\x20a\x20string');}try{_0x1254d2=fs[_0x7fe5('0x7')](_0x3f7dca)[_0x7fe5('0x8')]('base64');}catch(_0x534b10){return _0x89ad5f(_0x534b10);}return _0x421809({'method':_0x7fe5('0x9'),'uri':host+_0x7fe5('0xa')+_0x4744a9,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x7fe5('0xb'),'languageCode':_0xc27f79},'audio':{'content':_0x1254d2}},'json':!![]});});}; \ No newline at end of file +var _0x34e5=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','POST','LINEAR16','8000','bluebird','exports','string','length'];(function(_0x532f8c,_0xd61d13){var _0x1d333f=function(_0x1e50f3){while(--_0x1e50f3){_0x532f8c['push'](_0x532f8c['shift']());}};_0x1d333f(++_0xd61d13);}(_0x34e5,0x172));var _0x534e=function(_0x3273ff,_0x4abd5c){_0x3273ff=_0x3273ff-0x0;var _0x16ca39=_0x34e5[_0x3273ff];return _0x16ca39;};'use strict';var url=require('url');var BPromise=require(_0x534e('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x534e('0x1')]=function(_0x467e3e,_0x425ae8,_0x246650){return new BPromise(function(_0x83eb2d,_0x50b790){var _0x11a158;if(typeof _0x467e3e!==_0x534e('0x2')||_0x467e3e[_0x534e('0x3')]===0x0){return _0x50b790(_0x534e('0x4'));}if(typeof _0x425ae8!==_0x534e('0x2')||_0x425ae8[_0x534e('0x3')]===0x0){return _0x50b790(_0x534e('0x5'));}if(typeof _0x246650!=='undefined'&&(typeof _0x246650!==_0x534e('0x2')||_0x246650[_0x534e('0x3')]===0x0)){return _0x50b790(_0x534e('0x6'));}try{_0x11a158=fs['readFileSync'](_0x467e3e)['toString'](_0x534e('0x7'));}catch(_0x4c495c){return _0x50b790(_0x4c495c);}return _0x83eb2d({'method':_0x534e('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x425ae8,'body':{'config':{'encoding':_0x534e('0x9'),'sampleRateHertz':_0x534e('0xa'),'languageCode':_0x246650},'audio':{'content':_0x11a158}},'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 7d531cc..377a50f 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 _0x8e62=['./asr','exports'];(function(_0x2c2390,_0x37ef1c){var _0x478b7e=function(_0x2ea947){while(--_0x2ea947){_0x2c2390['push'](_0x2c2390['shift']());}};_0x478b7e(++_0x37ef1c);}(_0x8e62,0xba));var _0x28e6=function(_0x58175f,_0x275d92){_0x58175f=_0x58175f-0x0;var _0x37e6bc=_0x8e62[_0x58175f];return _0x37e6bc;};var asr=require(_0x28e6('0x0'));module[_0x28e6('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7131=['./asr','exports'];(function(_0x4d76ea,_0x2ba723){var _0x341376=function(_0x4556fe){while(--_0x4556fe){_0x4d76ea['push'](_0x4d76ea['shift']());}};_0x341376(++_0x2ba723);}(_0x7131,0x92));var _0x1713=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7131[_0x40a045];return _0x1a687c;};var asr=require(_0x1713('0x0'));module[_0x1713('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 dc9e82a..5c35e82 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 _0x811a=['writeFile','chmodSync','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','data','googleASR','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','googleDialogflow','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','queryText','responseId','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','format','model=%s','parse','nda','text','channelData','AudioFromTts','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','error','unlink','pipe','end','host','get','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','777','split','readFileSync','base64','googleCloudTTS','?key=','input','voice','audioConfig','MP3','.mp3','audioContent'];(function(_0x34e5d2,_0x4731a3){var _0x11e709=function(_0x3a4972){while(--_0x3a4972){_0x34e5d2['push'](_0x34e5d2['shift']());}};_0x11e709(++_0x4731a3);}(_0x811a,0xc7));var _0xa811=function(_0x425bab,_0x9ef501){_0x425bab=_0x425bab-0x0;var _0x53c76f=_0x811a[_0x425bab];return _0x53c76f;};'use strict';var apiai=require(_0xa811('0x0'));var BPromise=require(_0xa811('0x1'));var dialogflow=require(_0xa811('0x2'));var fs=require('fs');var http=require(_0xa811('0x3'));var https=require(_0xa811('0x4'));var md5=require(_0xa811('0x5'));var path=require(_0xa811('0x6'));var querystring=require('querystring');var rp=require(_0xa811('0x7'));var rs=require(_0xa811('0x8'));var sox=require(_0xa811('0x9'));var tts=require(_0xa811('0xa'));var urlParse=require(_0xa811('0xb'))['parse'];var util=require(_0xa811('0xc'));var aws=require(_0xa811('0xd'));var google=require(_0xa811('0xe'));var sestek=require(_0xa811('0xf'));var tilde=require(_0xa811('0x10'));var logger=require('../../../config/logger')(_0xa811('0x11'));var ISPEECH_API=_0xa811('0x12');function downloadFile(_0x2213fe,_0x3ff775){return new BPromise(function(_0x1230e4,_0x3a080e){var _0x11554d=urlParse(_0x2213fe);var _0x3aa7c7=_0x11554d['protocol']===_0xa811('0x13')?https:http;var _0x8f29d9={'host':_0x11554d['host'],'path':_0x11554d[_0xa811('0x6')],'headers':{'user-agent':_0xa811('0x14')}};_0x3aa7c7['get'](_0x8f29d9,function(_0x277eea){if(_0x277eea[_0xa811('0x15')]!==0xc8){logger['error'](_0xa811('0x16')+_0x2213fe+_0xa811('0x17')+_0x277eea['statusCode']+'\x20('+_0x277eea[_0xa811('0x18')]+')');_0x3a080e(new Error(_0xa811('0x16')+_0x2213fe+_0xa811('0x17')+_0x277eea['statusCode']+'\x20('+_0x277eea[_0xa811('0x18')]+')'));return;}var _0x25f76d=fs[_0xa811('0x19')](_0x3ff775);_0x25f76d['on'](_0xa811('0x1a'),function(){logger[_0xa811('0x1b')]('finish\x20download\x20file');_0x25f76d['close'](_0x1230e4);});_0x25f76d['on'](_0xa811('0x1c'),function(_0xa87790){fs[_0xa811('0x1d')](_0x3ff775);logger[_0xa811('0x1c')]('download\x20error',_0xa87790);_0x3a080e(_0xa87790);});_0x277eea[_0xa811('0x1e')](_0x25f76d);})['on'](_0xa811('0x1c'),function(_0xb02db6){logger[_0xa811('0x1c')](_0xb02db6);_0x3a080e(_0xb02db6);})[_0xa811('0x1f')]();});}function uploadFile(_0x24ca28){return new BPromise(function(_0x19da27,_0x4ec557){var _0x313cea=urlParse(_0x24ca28);var _0x529094=_0x313cea['protocol']===_0xa811('0x13')?https:http;var _0x442d65={'host':_0x313cea[_0xa811('0x20')],'path':_0x313cea[_0xa811('0x6')],'headers':{'user-agent':_0xa811('0x14')}};_0x529094[_0xa811('0x21')](_0x442d65,function(_0x59f1d9){if(_0x59f1d9[_0xa811('0x15')]!==0xc8){_0x4ec557(new Error('request\x20to\x20'+_0x24ca28+_0xa811('0x17')+_0x59f1d9[_0xa811('0x15')]+'\x20('+_0x59f1d9['statusMessage']+')'));return;}var _0x309951='';_0x59f1d9['on']('data',function(_0x20ac0b){_0x309951+=_0x20ac0b;});_0x59f1d9['on'](_0xa811('0x1f'),function(){_0x19da27(_0x309951);});})['on'](_0xa811('0x1c'),function(_0x37b473){_0x4ec557(_0x37b473);})['end']();});}function convertFile(_0x39ad6e,_0x52b517){return new BPromise(function(_0xad5e04,_0x267a93){var _0xc7b79e=sox[_0xa811('0x22')](_0x39ad6e,_0x52b517,{'sampleRate':0x1f40,'format':_0xa811('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xc7b79e['on'](_0xa811('0x1c'),function(_0x1b0283){logger[_0xa811('0x1c')](_0xa811('0x24'),_0x1b0283);_0x267a93(_0x1b0283);});_0xc7b79e['on'](_0xa811('0x1f'),function(){logger[_0xa811('0x1b')](_0xa811('0x25'));_0xad5e04();});_0xc7b79e[_0xa811('0x26')]();});}function base64Decode(_0x3499a8,_0x318c77){var _0x3aa278=path[_0xa811('0x27')](__dirname,_0xa811('0x28'),rs[_0xa811('0x29')](0x4)+_0xa811('0x2a'));fs[_0xa811('0x2b')](_0x3aa278,_0x3499a8,'base64');return convertFile(_0x3aa278,_0x318c77)[_0xa811('0x2c')](function(){try{fs[_0xa811('0x1d')](_0x3aa278);fs['chmodSync'](_0x318c77,_0xa811('0x2d'));}catch(_0x3fb008){logger[_0xa811('0x1c')](_0x3fb008);}return _0x318c77[_0xa811('0x2e')]('.')[0x0];});}function base64Encode(_0x421774){var _0x28a842=fs[_0xa811('0x2f')](_0x421774);return new Buffer(_0x28a842)['toString'](_0xa811('0x30'));}exports[_0xa811('0x31')]=function(_0x3c8ced,_0x25f8ae,_0x1447bd,_0x187bc1,_0x2c33f6,_0x23a108){var _0x606e5b,_0x3d6d06;var _0x54662f='https://texttospeech.googleapis.com/v1/';var _0x4fad98=_0xa811('0x32')+_0x3c8ced;var _0x57ba7a={};if(_0x25f8ae==='ssml'){_0x57ba7a[_0xa811('0x33')]={'ssml':_0x1447bd};}else{_0x57ba7a[_0xa811('0x33')]={'text':_0x1447bd};};_0x57ba7a[_0xa811('0x34')]={'languageCode':_0x187bc1,'ssmlGender':_0x2c33f6};_0x57ba7a[_0xa811('0x35')]={'audioEncoding':_0xa811('0x36'),'sampleRateHertz':0x1f40};var _0x2a36a8={'url':_0x54662f+'text:synthesize'+_0x4fad98,'method':'POST','json':!![],'body':_0x57ba7a};return rp(_0x2a36a8)[_0xa811('0x2c')](function(_0x2ea9a4){return new BPromise(function(_0x128f30,_0x1d7891){_0x606e5b=path['resolve'](__dirname,_0xa811('0x28'),rs[_0xa811('0x29')](0x4)+_0xa811('0x37'));var _0x7cd682=Buffer['from'](_0x2ea9a4[_0xa811('0x38')],_0xa811('0x30'));return fs[_0xa811('0x39')](_0x606e5b,_0x7cd682,function(_0x3132fc){_0x1d7891(_0x3132fc);},function(_0x138b00){fs[_0xa811('0x3a')](_0x606e5b,'777');_0x128f30(_0x138b00);});});})['then'](function(_0x2e3ba1){_0x3d6d06=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xa811('0x2a'));return convertFile(_0x606e5b,_0x3d6d06);})[_0xa811('0x2c')](function(){try{fs[_0xa811('0x1d')](_0x606e5b);fs[_0xa811('0x3a')](_0x3d6d06,_0xa811('0x2d'));}catch(_0x38a272){logger[_0xa811('0x1c')](_0x38a272);}logger[_0xa811('0x1b')](_0xa811('0x3b'),_0x3d6d06['split']('.')[0x0]);return _0x3d6d06[_0xa811('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x2197aa,_0x37d26b){var _0x51d768=_0xa811('0x3c');var _0x1f2a7e,_0x26705e;var _0x21c298;var _0xcedf9c={'encoding':_0xa811('0x3d'),'method':_0xa811('0x3e'),'timeout':0x2710,'url':_0x51d768,'headers':{'Content-Type':_0xa811('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0xa811('0x40')]([[['jQ1olc',JSON[_0xa811('0x40')]([_0x2197aa,_0x37d26b||'en',![],_0xa811('0x41')]),null,_0xa811('0x42')]]]))};return rp(_0xcedf9c)[_0xa811('0x2c')](function(_0x48f713){try{_0x21c298=eval(_0x48f713[_0xa811('0x43')](0x5))[0x0][0x2];}catch(_0x3600ea){throw new Error(_0xa811('0x44')+_0x48f713['data']);}if(!_0x21c298){if(_0x2197aa['length']>0xc8){throw new Error(_0xa811('0x45'));}else{throw new Error(_0xa811('0x46')+_0x37d26b+_0xa811('0x47'));}}try{_0x21c298=eval(_0x21c298)[0x0];}catch(_0x344362){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xa811('0x48')]);}const _0x46eed6=_0x21c298;_0x1f2a7e=path[_0xa811('0x27')](__dirname,'tmp',rs[_0xa811('0x29')](0x4)+'.mp3');fs[_0xa811('0x2b')](_0x1f2a7e,_0x21c298,{'encoding':_0xa811('0x30')});_0x26705e=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xa811('0x2a'));return convertFile(_0x1f2a7e,_0x26705e);})[_0xa811('0x2c')](function(){try{fs[_0xa811('0x1d')](_0x1f2a7e);fs['chmodSync'](_0x26705e,'777');}catch(_0x596cba){logger['error'](_0x596cba);}logger[_0xa811('0x1b')]('goggleTTS\x20path',_0x26705e[_0xa811('0x2e')]('.')[0x0]);return _0x26705e[_0xa811('0x2e')]('.')[0x0];});};exports[_0xa811('0x49')]=function(_0x4cb0bf,_0x349eeb,_0x2c76dd){return google['asr'](_0x4cb0bf,_0x349eeb,_0x2c76dd)['then'](function(_0x4453d3){logger[_0xa811('0x1b')](_0x4453d3['uri']);return rp(_0x4453d3);})[_0xa811('0x2c')](function(_0x2a9e74){var _0x67ded6='';var _0x58328c=0x0;try{fs['unlink'](_0x4cb0bf);}catch(_0x3a89f4){logger[_0xa811('0x1c')](_0x3a89f4);}if(_0x2a9e74&&_0x2a9e74[_0xa811('0x4a')]){_0x67ded6=_0x2a9e74['results'][_0xa811('0x4b')](function(_0x4cd77d){return _0x4cd77d&&_0x4cd77d[_0xa811('0x4c')][0x0]&&_0x4cd77d['alternatives'][0x0][_0xa811('0x4d')]?_0x4cd77d[_0xa811('0x4c')][0x0][_0xa811('0x4d')]:'';})['join']('\x0a');_0x58328c=_0x2a9e74[_0xa811('0x4a')][_0xa811('0x4b')](function(_0x323bbd){return _0x323bbd&&_0x323bbd[_0xa811('0x4c')][0x0]&&_0x323bbd[_0xa811('0x4c')][0x0][_0xa811('0x4e')]?_0x323bbd[_0xa811('0x4c')][0x0]['confidence']:0x0;})[_0xa811('0x4f')]('\x0a');}logger['info'](_0xa811('0x50'),_0x67ded6);logger[_0xa811('0x1b')]('googleASR\x20confidence',_0x58328c);return{'transcript':_0x67ded6,'confidence':_0x58328c};})[_0xa811('0x51')](function(_0x2bb575){logger['error'](_0xa811('0x52'),_0x2bb575[_0xa811('0x15')],_0x2bb575[_0xa811('0x53')],_0x2bb575['message']);});};exports[_0xa811('0x54')]=function(_0x299adc,_0x3cf5cc,_0x20a428,_0x32a5ba){var _0x4171cb=apiai(_0x3cf5cc,{'language':_0x32a5ba||'en'});return _0x4171cb['textRequest'](_0x20a428,{'sessionId':md5(_0x299adc)})[_0xa811('0x2c')](function(_0x10e4ab){logger[_0xa811('0x1b')](JSON['stringify'](_0x10e4ab));return{'source':_0x10e4ab[_0xa811('0x55')]['source'],'resolvedQuery':_0x10e4ab['result'][_0xa811('0x56')],'action':_0x10e4ab['result'][_0xa811('0x57')],'actionIncomplete':_0x10e4ab[_0xa811('0x55')][_0xa811('0x58')],'speech':_0x10e4ab['result'][_0xa811('0x59')][_0xa811('0x5a')],'score':_0x10e4ab[_0xa811('0x55')][_0xa811('0x5b')],'statusCode':_0x10e4ab[_0xa811('0x5c')][_0xa811('0x5d')],'endConversation':_0x10e4ab[_0xa811('0x55')][_0xa811('0x5e')][_0xa811('0x5f')]||![],'isFallbackIntent':_0x10e4ab[_0xa811('0x55')][_0xa811('0x5e')][_0xa811('0x60')]};});};exports[_0xa811('0x61')]=function(_0x90fab5,_0x45f306,_0x4a7ad5,_0x8edb2f,_0x10939d,_0x35ad7b){var _0x4a4fd0=_0x8edb2f[_0xa811('0x62')](/\\n/g,'\x0a');var _0x224206={'credentials':{'private_key':_0x4a4fd0,'client_email':_0x4a7ad5}};var _0x45cc64=new dialogflow['SessionsClient'](_0x224206);var _0xa4ac1c=_0x45cc64[_0xa811('0x63')](_0x45f306,md5(_0x90fab5));var _0x13cee7={'session':_0xa4ac1c,'queryInput':{'text':{'text':_0x10939d,'languageCode':_0x35ad7b}}};return _0x45cc64[_0xa811('0x64')](_0x13cee7)[_0xa811('0x2c')](function(_0x44a254){if(_0x44a254&&_0x44a254[_0xa811('0x65')]){logger['info'](_0xa811('0x66'),JSON[_0xa811('0x40')](_0x44a254));var _0x1f648d=_0x44a254[0x0];if(_0x1f648d){var _0x454842={'action':_0x1f648d['queryResult'][_0xa811('0x57')],'allRequiredParamsPresent':_0x1f648d[_0xa811('0x67')]['allRequiredParamsPresent'],'endConversation':_0x1f648d[_0xa811('0x67')][_0xa811('0x68')]&&_0x1f648d[_0xa811('0x67')]['diagnosticInfo'][_0xa811('0x69')]?_0x1f648d[_0xa811('0x67')]['diagnosticInfo'][_0xa811('0x69')][_0xa811('0x6a')][_0xa811('0x6b')]:![],'fulfillmentText':_0x1f648d[_0xa811('0x67')]['fulfillmentText'],'intentName':_0x1f648d['queryResult'][_0xa811('0x6c')][_0xa811('0x53')],'intentDisplayName':_0x1f648d[_0xa811('0x67')][_0xa811('0x6c')][_0xa811('0x6d')],'isFallbackIntent':_0x1f648d[_0xa811('0x67')][_0xa811('0x6c')]['isFallback'],'languageCode':_0x1f648d[_0xa811('0x67')]['languageCode'],'queryText':_0x1f648d[_0xa811('0x67')][_0xa811('0x6e')],'responseId':_0x1f648d[_0xa811('0x6f')],'score':_0x1f648d['queryResult']['intentDetectionConfidence'],'speech':_0x1f648d[_0xa811('0x67')][_0xa811('0x70')],'providerResponse':JSON['stringify'](_0x44a254)};return _0x454842;}}});};exports[_0xa811('0x71')]=function(_0x20f620,_0x54205d,_0x1e3257,_0x379b9b){return tilde[_0xa811('0x72')](_0x20f620,_0x54205d,_0x1e3257,_0x379b9b)[_0xa811('0x2c')](function(_0x261f1c){try{fs[_0xa811('0x1d')](_0x20f620);}catch(_0x5aacbd){logger[_0xa811('0x1c')](_0x5aacbd);}logger['info'](_0xa811('0x73'),_0x261f1c['transcript']);logger[_0xa811('0x1b')](_0xa811('0x74'),_0x261f1c[_0xa811('0x4e')]);return _0x261f1c;});};exports['awsPolly']=function(_0x330f8a,_0x3fa1d3,_0x2fa7cb,_0x9d378f,_0x498875,_0x1b383f){var _0x14236b=path[_0xa811('0x27')](__dirname,_0xa811('0x28'),rs[_0xa811('0x29')](0x4)+_0xa811('0x37'));var _0x35e7fe;return aws[_0xa811('0x75')](_0x330f8a,_0x3fa1d3,_0x2fa7cb,_0x9d378f,_0x498875,_0x1b383f,_0x14236b)[_0xa811('0x2c')](function(){_0x35e7fe=path[_0xa811('0x27')](__dirname,_0xa811('0x28'),rs[_0xa811('0x29')](0x4)+_0xa811('0x2a'));return convertFile(_0x14236b,_0x35e7fe);})[_0xa811('0x2c')](function(){try{fs[_0xa811('0x1d')](_0x14236b);fs[_0xa811('0x3a')](_0x35e7fe,_0xa811('0x2d'));}catch(_0x93f08d){logger[_0xa811('0x1c')](_0x93f08d);}return _0x35e7fe[_0xa811('0x2e')]('.')[0x0];});};exports[_0xa811('0x76')]=function(_0x1253c9,_0x28aa71,_0x2b6816,_0x2331cd,_0x5dda97,_0x4bc625){return aws[_0xa811('0x77')](_0x1253c9,_0x28aa71,_0x2b6816,_0x2331cd,_0x5dda97,_0x4bc625)[_0xa811('0x2c')](function(_0x3bf28f){logger[_0xa811('0x1b')](JSON['stringify'](_0x3bf28f));return _0x3bf28f;});};exports['ispeechTTS']=function(_0x453248,_0x163394,_0x187136,_0x26e9d2){var _0x10b8f9=util[_0xa811('0x78')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x453248,encodeURIComponent(_0x163394),_0x187136,_0x26e9d2);var _0x419120=path['resolve'](__dirname,_0xa811('0x28'),rs['generate'](0x4)+'.mp3');var _0x2e727c;return downloadFile(_0x10b8f9,_0x419120)['then'](function(){_0x2e727c=path[_0xa811('0x27')](__dirname,'tmp',rs[_0xa811('0x29')](0x4)+'.wav');return convertFile(_0x419120,_0x2e727c);})[_0xa811('0x2c')](function(){try{fs['unlink'](_0x419120);fs[_0xa811('0x3a')](_0x2e727c,_0xa811('0x2d'));}catch(_0x2cf588){logger[_0xa811('0x1c')](_0x2cf588);}return _0x2e727c['split']('.')[0x0];});};exports['ispeechASR']=function(_0x39e684,_0x43b568,_0x3877ed,_0x2617ab){var _0x2343f7=util[_0xa811('0x78')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x43b568,_0x3877ed,base64Encode(_0x39e684),_0x2617ab?util[_0xa811('0x78')](_0xa811('0x79'),encodeURIComponent(_0x2617ab)):'freeform=3');return uploadFile(_0x2343f7)[_0xa811('0x2c')](function(_0x51eab0){return querystring[_0xa811('0x7a')](_0x51eab0);});};exports['sestekNDA']=function(_0x520657,_0x451ce3){return sestek[_0xa811('0x7b')](_0x520657,_0x451ce3)['then'](function(_0x211b10){logger[_0xa811('0x1b')](JSON[_0xa811('0x40')](_0x211b10));var _0xbbcbcb={'speech':_0x211b10[_0xa811('0x7c')],'action':_0x211b10['channelData']?_0x211b10[_0xa811('0x7d')]['CustomAction']:undefined,'actiondata':_0x211b10['channelData']?_0x211b10[_0xa811('0x7d')]['CustomActionData']:undefined};if(_0x211b10[_0xa811('0x7d')]&&_0x211b10[_0xa811('0x7d')][_0xa811('0x7e')]){return base64Decode(_0x211b10[_0xa811('0x7d')][_0xa811('0x7e')]['Data'],path[_0xa811('0x27')](__dirname,_0xa811('0x28'),rs[_0xa811('0x29')](0x4)+_0xa811('0x2a')))[_0xa811('0x2c')](function(_0x35818d){_0xbbcbcb['audiofile']=_0x35818d;return _0xbbcbcb;});}return _0xbbcbcb;});};exports[_0xa811('0x7f')]=function(){return __dirname;}; \ No newline at end of file +var _0xc58d=['chmodSync','split','toString','base64','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','then','tmp','generate','.mp3','from','audioContent','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','slice','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','score','status','code','metadata','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','bluebird','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','close','error','pipe','end','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','unlink'];(function(_0x112184,_0x2bcd22){var _0x4b4f90=function(_0xa085c4){while(--_0xa085c4){_0x112184['push'](_0x112184['shift']());}};_0x4b4f90(++_0x2bcd22);}(_0xc58d,0x1dd));var _0xdc58=function(_0x58c36f,_0xa0c850){_0x58c36f=_0x58c36f-0x0;var _0xbe7c41=_0xc58d[_0x58c36f];return _0xbe7c41;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xdc58('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xdc58('0x1'));var md5=require(_0xdc58('0x2'));var path=require(_0xdc58('0x3'));var querystring=require('querystring');var rp=require(_0xdc58('0x4'));var rs=require(_0xdc58('0x5'));var sox=require(_0xdc58('0x6'));var tts=require(_0xdc58('0x7'));var urlParse=require(_0xdc58('0x8'))[_0xdc58('0x9')];var util=require('util');var aws=require(_0xdc58('0xa'));var google=require(_0xdc58('0xb'));var sestek=require('./sestek');var tilde=require(_0xdc58('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xdc58('0xd');function downloadFile(_0x289ffa,_0x708f6f){return new BPromise(function(_0x56ac35,_0x2a0b7c){var _0x29e431=urlParse(_0x289ffa);var _0x523527=_0x29e431[_0xdc58('0xe')]===_0xdc58('0xf')?https:http;var _0x4a2e5d={'host':_0x29e431[_0xdc58('0x10')],'path':_0x29e431['path'],'headers':{'user-agent':_0xdc58('0x11')}};_0x523527[_0xdc58('0x12')](_0x4a2e5d,function(_0x50d886){if(_0x50d886[_0xdc58('0x13')]!==0xc8){logger['error']('request\x20to\x20'+_0x289ffa+'\x20failed,\x20status\x20code\x20=\x20'+_0x50d886[_0xdc58('0x13')]+'\x20('+_0x50d886[_0xdc58('0x14')]+')');_0x2a0b7c(new Error(_0xdc58('0x15')+_0x289ffa+_0xdc58('0x16')+_0x50d886[_0xdc58('0x13')]+'\x20('+_0x50d886[_0xdc58('0x14')]+')'));return;}var _0x5a3415=fs[_0xdc58('0x17')](_0x708f6f);_0x5a3415['on']('finish',function(){logger[_0xdc58('0x18')](_0xdc58('0x19'));_0x5a3415[_0xdc58('0x1a')](_0x56ac35);});_0x5a3415['on'](_0xdc58('0x1b'),function(_0x1232e9){fs['unlink'](_0x708f6f);logger[_0xdc58('0x1b')]('download\x20error',_0x1232e9);_0x2a0b7c(_0x1232e9);});_0x50d886[_0xdc58('0x1c')](_0x5a3415);})['on']('error',function(_0x2542af){logger[_0xdc58('0x1b')](_0x2542af);_0x2a0b7c(_0x2542af);})[_0xdc58('0x1d')]();});}function uploadFile(_0x5aa2a4){return new BPromise(function(_0xce8f7b,_0x28a879){var _0x4d79c9=urlParse(_0x5aa2a4);var _0x4e503e=_0x4d79c9[_0xdc58('0xe')]===_0xdc58('0xf')?https:http;var _0x4eef68={'host':_0x4d79c9[_0xdc58('0x10')],'path':_0x4d79c9[_0xdc58('0x3')],'headers':{'user-agent':_0xdc58('0x11')}};_0x4e503e[_0xdc58('0x12')](_0x4eef68,function(_0x345a62){if(_0x345a62[_0xdc58('0x13')]!==0xc8){_0x28a879(new Error(_0xdc58('0x15')+_0x5aa2a4+_0xdc58('0x16')+_0x345a62[_0xdc58('0x13')]+'\x20('+_0x345a62['statusMessage']+')'));return;}var _0x1257d3='';_0x345a62['on'](_0xdc58('0x1e'),function(_0x4dba27){_0x1257d3+=_0x4dba27;});_0x345a62['on'](_0xdc58('0x1d'),function(){_0xce8f7b(_0x1257d3);});})['on'](_0xdc58('0x1b'),function(_0x139bc1){_0x28a879(_0x139bc1);})[_0xdc58('0x1d')]();});}function convertFile(_0x31c625,_0x3c78b7){return new BPromise(function(_0xc7584b,_0x50ec3d){var _0x995d17=sox['transcode'](_0x31c625,_0x3c78b7,{'sampleRate':0x1f40,'format':_0xdc58('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x995d17['on'](_0xdc58('0x1b'),function(_0x327d9a){logger[_0xdc58('0x1b')](_0xdc58('0x20'),_0x327d9a);_0x50ec3d(_0x327d9a);});_0x995d17['on'](_0xdc58('0x1d'),function(){logger[_0xdc58('0x18')](_0xdc58('0x21'));_0xc7584b();});_0x995d17[_0xdc58('0x22')]();});}function base64Decode(_0x1c5a54,_0x3c5c0f){var _0x517920=path[_0xdc58('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0xdc58('0x24'));fs[_0xdc58('0x25')](_0x517920,_0x1c5a54,'base64');return convertFile(_0x517920,_0x3c5c0f)['then'](function(){try{fs[_0xdc58('0x26')](_0x517920);fs[_0xdc58('0x27')](_0x3c5c0f,'777');}catch(_0x21da29){logger[_0xdc58('0x1b')](_0x21da29);}return _0x3c5c0f[_0xdc58('0x28')]('.')[0x0];});}function base64Encode(_0x64e520){var _0x2514de=fs['readFileSync'](_0x64e520);return new Buffer(_0x2514de)[_0xdc58('0x29')](_0xdc58('0x2a'));}exports['googleCloudTTS']=function(_0x346fe0,_0x354a6f,_0x328e1a,_0xbeaa48,_0x3628b1,_0x9f3b0a){var _0x32897c,_0x367045;var _0x2abeac='https://texttospeech.googleapis.com/v1/';var _0x5d12ba=_0xdc58('0x2b')+_0x346fe0;var _0x1fc8c1={};if(_0x354a6f==='ssml'){_0x1fc8c1[_0xdc58('0x2c')]={'ssml':_0x328e1a};}else{_0x1fc8c1[_0xdc58('0x2c')]={'text':_0x328e1a};};_0x1fc8c1[_0xdc58('0x2d')]={'languageCode':_0xbeaa48,'ssmlGender':_0x3628b1};_0x1fc8c1[_0xdc58('0x2e')]={'audioEncoding':_0xdc58('0x2f'),'sampleRateHertz':0x1f40};var _0x275bd1={'url':_0x2abeac+_0xdc58('0x30')+_0x5d12ba,'method':_0xdc58('0x31'),'json':!![],'body':_0x1fc8c1};return rp(_0x275bd1)[_0xdc58('0x32')](function(_0x5d6352){return new BPromise(function(_0x52f368,_0x4a654b){_0x32897c=path[_0xdc58('0x23')](__dirname,_0xdc58('0x33'),rs[_0xdc58('0x34')](0x4)+_0xdc58('0x35'));var _0x343bb5=Buffer[_0xdc58('0x36')](_0x5d6352[_0xdc58('0x37')],_0xdc58('0x2a'));return fs['writeFile'](_0x32897c,_0x343bb5,function(_0x25e06f){_0x4a654b(_0x25e06f);},function(_0x42f98e){fs[_0xdc58('0x27')](_0x32897c,_0xdc58('0x38'));_0x52f368(_0x42f98e);});});})[_0xdc58('0x32')](function(_0x3a6687){_0x367045=path[_0xdc58('0x23')](__dirname,_0xdc58('0x33'),rs[_0xdc58('0x34')](0x4)+_0xdc58('0x24'));return convertFile(_0x32897c,_0x367045);})[_0xdc58('0x32')](function(){try{fs[_0xdc58('0x26')](_0x32897c);fs[_0xdc58('0x27')](_0x367045,'777');}catch(_0x661c17){logger['error'](_0x661c17);}logger[_0xdc58('0x18')](_0xdc58('0x39'),_0x367045[_0xdc58('0x28')]('.')[0x0]);return _0x367045[_0xdc58('0x28')]('.')[0x0];});};exports[_0xdc58('0x3a')]=function(_0x497354,_0x20db20){var _0x386d7d=_0xdc58('0x3b');var _0x5af4f1,_0x4db19e;var _0x3f9f22;var _0x7a8329={'encoding':_0xdc58('0x3c'),'method':'POST','timeout':0x2710,'url':_0x386d7d,'headers':{'Content-Type':_0xdc58('0x3d')},'body':'f.req='+encodeURIComponent(JSON[_0xdc58('0x3e')]([[[_0xdc58('0x3f'),JSON['stringify']([_0x497354,_0x20db20||'en',![],'null']),null,'generic']]]))};return rp(_0x7a8329)[_0xdc58('0x32')](function(_0x3787d8){try{_0x3f9f22=eval(_0x3787d8[_0xdc58('0x40')](0x5))[0x0][0x2];}catch(_0x102867){throw new Error(_0xdc58('0x41')+_0x3787d8[_0xdc58('0x1e')]);}if(!_0x3f9f22){if(_0x497354['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xdc58('0x42')+_0x20db20+_0xdc58('0x43'));}}try{_0x3f9f22=eval(_0x3f9f22)[0x0];}catch(_0x1f48ce){throw new Error(_0xdc58('0x41')+res[_0xdc58('0x1e')]);}const _0x2b59c0=_0x3f9f22;_0x5af4f1=path[_0xdc58('0x23')](__dirname,_0xdc58('0x33'),rs[_0xdc58('0x34')](0x4)+_0xdc58('0x35'));fs[_0xdc58('0x25')](_0x5af4f1,_0x3f9f22,{'encoding':_0xdc58('0x2a')});_0x4db19e=path[_0xdc58('0x23')](__dirname,_0xdc58('0x33'),rs[_0xdc58('0x34')](0x4)+_0xdc58('0x24'));return convertFile(_0x5af4f1,_0x4db19e);})['then'](function(){try{fs[_0xdc58('0x26')](_0x5af4f1);fs[_0xdc58('0x27')](_0x4db19e,_0xdc58('0x38'));}catch(_0x17df1e){logger[_0xdc58('0x1b')](_0x17df1e);}logger[_0xdc58('0x18')](_0xdc58('0x44'),_0x4db19e['split']('.')[0x0]);return _0x4db19e[_0xdc58('0x28')]('.')[0x0];});};exports[_0xdc58('0x45')]=function(_0x3aa9a3,_0x17c21b,_0x2e9a35){return google[_0xdc58('0x46')](_0x3aa9a3,_0x17c21b,_0x2e9a35)[_0xdc58('0x32')](function(_0x2c7911){logger['info'](_0x2c7911[_0xdc58('0x47')]);return rp(_0x2c7911);})['then'](function(_0x3e553c){var _0x37a74b='';var _0x7c4e5d=0x0;try{fs[_0xdc58('0x26')](_0x3aa9a3);}catch(_0x3b1445){logger[_0xdc58('0x1b')](_0x3b1445);}if(_0x3e553c&&_0x3e553c[_0xdc58('0x48')]){_0x37a74b=_0x3e553c[_0xdc58('0x48')]['map'](function(_0xfaffa6){return _0xfaffa6&&_0xfaffa6['alternatives'][0x0]&&_0xfaffa6['alternatives'][0x0]['transcript']?_0xfaffa6['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x7c4e5d=_0x3e553c['results'][_0xdc58('0x49')](function(_0x1f5965){return _0x1f5965&&_0x1f5965[_0xdc58('0x4a')][0x0]&&_0x1f5965['alternatives'][0x0][_0xdc58('0x4b')]?_0x1f5965[_0xdc58('0x4a')][0x0][_0xdc58('0x4b')]:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x37a74b);logger['info'](_0xdc58('0x4c'),_0x7c4e5d);return{'transcript':_0x37a74b,'confidence':_0x7c4e5d};})[_0xdc58('0x4d')](function(_0x3331cc){logger['error'](_0xdc58('0x4e'),_0x3331cc['statusCode'],_0x3331cc[_0xdc58('0x4f')],_0x3331cc['message']);});};exports[_0xdc58('0x50')]=function(_0x4c6c15,_0xe4717,_0x17d164,_0x3a9c65){var _0x5ed60c=apiai(_0xe4717,{'language':_0x3a9c65||'en'});return _0x5ed60c[_0xdc58('0x51')](_0x17d164,{'sessionId':md5(_0x4c6c15)})[_0xdc58('0x32')](function(_0x294f07){logger['info'](JSON[_0xdc58('0x3e')](_0x294f07));return{'source':_0x294f07['result'][_0xdc58('0x52')],'resolvedQuery':_0x294f07[_0xdc58('0x53')][_0xdc58('0x54')],'action':_0x294f07[_0xdc58('0x53')][_0xdc58('0x55')],'actionIncomplete':_0x294f07[_0xdc58('0x53')]['actionIncomplete'],'speech':_0x294f07[_0xdc58('0x53')][_0xdc58('0x56')]['speech'],'score':_0x294f07[_0xdc58('0x53')][_0xdc58('0x57')],'statusCode':_0x294f07[_0xdc58('0x58')][_0xdc58('0x59')],'endConversation':_0x294f07['result'][_0xdc58('0x5a')]['endConversation']||![],'isFallbackIntent':_0x294f07[_0xdc58('0x53')][_0xdc58('0x5a')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x1210dc,_0x8f53b8,_0x250bf2,_0x533b87,_0x342c30,_0x30f96d){var _0xe4ae01=_0x533b87[_0xdc58('0x5b')](/\\n/g,'\x0a');var _0x3ebd19={'credentials':{'private_key':_0xe4ae01,'client_email':_0x250bf2}};var _0x12f9cd=new dialogflow[(_0xdc58('0x5c'))](_0x3ebd19);var _0x192c4c=_0x12f9cd[_0xdc58('0x5d')](_0x8f53b8,md5(_0x1210dc));var _0x744c5b={'session':_0x192c4c,'queryInput':{'text':{'text':_0x342c30,'languageCode':_0x30f96d}}};return _0x12f9cd[_0xdc58('0x5e')](_0x744c5b)['then'](function(_0x41627f){if(_0x41627f&&_0x41627f['length']){logger[_0xdc58('0x18')]('Dialogflow\x20V2\x20response:',JSON[_0xdc58('0x3e')](_0x41627f));var _0x4a425f=_0x41627f[0x0];if(_0x4a425f){var _0x5ce950={'action':_0x4a425f['queryResult'][_0xdc58('0x55')],'allRequiredParamsPresent':_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x60')],'endConversation':_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x61')]&&_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x61')]['fields']?_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x61')]['fields'][_0xdc58('0x62')]['boolValue']:![],'fulfillmentText':_0x4a425f['queryResult'][_0xdc58('0x63')],'intentName':_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x64')][_0xdc58('0x4f')],'intentDisplayName':_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x64')][_0xdc58('0x65')],'isFallbackIntent':_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x64')]['isFallback'],'languageCode':_0x4a425f['queryResult'][_0xdc58('0x66')],'queryText':_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x67')],'responseId':_0x4a425f[_0xdc58('0x68')],'score':_0x4a425f['queryResult'][_0xdc58('0x69')],'speech':_0x4a425f[_0xdc58('0x5f')][_0xdc58('0x63')],'providerResponse':JSON[_0xdc58('0x3e')](_0x41627f)};return _0x5ce950;}}});};exports[_0xdc58('0x6a')]=function(_0x22bc34,_0x148a46,_0x721dd9,_0x3b5a41){return tilde['asr'](_0x22bc34,_0x148a46,_0x721dd9,_0x3b5a41)[_0xdc58('0x32')](function(_0x4fedb0){try{fs[_0xdc58('0x26')](_0x22bc34);}catch(_0x14e744){logger[_0xdc58('0x1b')](_0x14e744);}logger[_0xdc58('0x18')](_0xdc58('0x6b'),_0x4fedb0[_0xdc58('0x6c')]);logger['info'](_0xdc58('0x6d'),_0x4fedb0[_0xdc58('0x4b')]);return _0x4fedb0;});};exports[_0xdc58('0x6e')]=function(_0x550b43,_0x3ee5c1,_0x20c038,_0x26c0a8,_0x7c45fd,_0xe8262a){var _0x5c77b5=path['resolve'](__dirname,'tmp',rs[_0xdc58('0x34')](0x4)+'.mp3');var _0x56323;return aws[_0xdc58('0x6f')](_0x550b43,_0x3ee5c1,_0x20c038,_0x26c0a8,_0x7c45fd,_0xe8262a,_0x5c77b5)['then'](function(){_0x56323=path['resolve'](__dirname,_0xdc58('0x33'),rs[_0xdc58('0x34')](0x4)+'.wav');return convertFile(_0x5c77b5,_0x56323);})['then'](function(){try{fs[_0xdc58('0x26')](_0x5c77b5);fs['chmodSync'](_0x56323,'777');}catch(_0x142bcb){logger['error'](_0x142bcb);}return _0x56323[_0xdc58('0x28')]('.')[0x0];});};exports[_0xdc58('0x70')]=function(_0x2a2def,_0x1c12b9,_0x42c6e2,_0x43f5ea,_0x5eb506,_0x33d2a9){return aws[_0xdc58('0x71')](_0x2a2def,_0x1c12b9,_0x42c6e2,_0x43f5ea,_0x5eb506,_0x33d2a9)[_0xdc58('0x32')](function(_0x5c3468){logger[_0xdc58('0x18')](JSON[_0xdc58('0x3e')](_0x5c3468));return _0x5c3468;});};exports[_0xdc58('0x72')]=function(_0x47d250,_0x141aa8,_0x38348a,_0x2098ed){var _0xa5cca2=util[_0xdc58('0x73')](_0xdc58('0x74'),ISPEECH_API,_0x47d250,encodeURIComponent(_0x141aa8),_0x38348a,_0x2098ed);var _0x136c4a=path[_0xdc58('0x23')](__dirname,_0xdc58('0x33'),rs[_0xdc58('0x34')](0x4)+_0xdc58('0x35'));var _0x7295d4;return downloadFile(_0xa5cca2,_0x136c4a)[_0xdc58('0x32')](function(){_0x7295d4=path['resolve'](__dirname,'tmp',rs[_0xdc58('0x34')](0x4)+_0xdc58('0x24'));return convertFile(_0x136c4a,_0x7295d4);})[_0xdc58('0x32')](function(){try{fs[_0xdc58('0x26')](_0x136c4a);fs['chmodSync'](_0x7295d4,'777');}catch(_0x1d885d){logger[_0xdc58('0x1b')](_0x1d885d);}return _0x7295d4[_0xdc58('0x28')]('.')[0x0];});};exports['ispeechASR']=function(_0x2e53c8,_0xec9bd2,_0x279438,_0x534aaf){var _0x383cde=util[_0xdc58('0x73')](_0xdc58('0x75'),ISPEECH_API,_0xec9bd2,_0x279438,base64Encode(_0x2e53c8),_0x534aaf?util['format'](_0xdc58('0x76'),encodeURIComponent(_0x534aaf)):_0xdc58('0x77'));return uploadFile(_0x383cde)[_0xdc58('0x32')](function(_0x261580){return querystring[_0xdc58('0x9')](_0x261580);});};exports[_0xdc58('0x78')]=function(_0x125d16,_0x2c9607){return sestek[_0xdc58('0x79')](_0x125d16,_0x2c9607)[_0xdc58('0x32')](function(_0x1b642c){logger[_0xdc58('0x18')](JSON[_0xdc58('0x3e')](_0x1b642c));var _0x5f3ed7={'speech':_0x1b642c[_0xdc58('0x7a')],'action':_0x1b642c[_0xdc58('0x7b')]?_0x1b642c[_0xdc58('0x7b')][_0xdc58('0x7c')]:undefined,'actiondata':_0x1b642c[_0xdc58('0x7b')]?_0x1b642c['channelData']['CustomActionData']:undefined};if(_0x1b642c[_0xdc58('0x7b')]&&_0x1b642c['channelData'][_0xdc58('0x7d')]){return base64Decode(_0x1b642c[_0xdc58('0x7b')][_0xdc58('0x7d')][_0xdc58('0x7e')],path[_0xdc58('0x23')](__dirname,_0xdc58('0x33'),rs[_0xdc58('0x34')](0x4)+'.wav'))[_0xdc58('0x32')](function(_0xe660b){_0x5f3ed7[_0xdc58('0x7f')]=_0xe660b;return _0x5f3ed7;});}return _0x5f3ed7;});};exports[_0xdc58('0x80')]=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 cb30c37..c64ce88 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 _0x75f5=['exports','./nda'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x75f5,0x10f));var _0x575f=function(_0x1d8f23,_0x1d4573){_0x1d8f23=_0x1d8f23-0x0;var _0x9499d7=_0x75f5[_0x1d8f23];return _0x9499d7;};var nda=require(_0x575f('0x0'));module[_0x575f('0x1')]={'nda':nda}; \ No newline at end of file +var _0x9449=['./nda','exports'];(function(_0x69e5eb,_0x38a6fc){var _0x1ad29d=function(_0x3c351a){while(--_0x3c351a){_0x69e5eb['push'](_0x69e5eb['shift']());}};_0x1ad29d(++_0x38a6fc);}(_0x9449,0x1bc));var _0x9944=function(_0x3c5b75,_0x30bc0a){_0x3c5b75=_0x3c5b75-0x0;var _0x157e67=_0x9449[_0x3c5b75];return _0x157e67;};var nda=require(_0x9944('0x0'));module[_0x9944('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 d54e726..fa606ff 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 _0xdca3=['CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction'];(function(_0x3a09e6,_0x32bbf9){var _0x2fa6c0=function(_0xffe110){while(--_0xffe110){_0x3a09e6['push'](_0x3a09e6['shift']());}};_0x2fa6c0(++_0x32bbf9);}(_0xdca3,0x64));var _0x3dca=function(_0x1f5c93,_0x32c21){_0x1f5c93=_0x1f5c93-0x0;var _0x43329f=_0xdca3[_0x1f5c93];return _0x43329f;};'use strict';var rp=require(_0x3dca('0x0'));var url=require('url');var logger=require(_0x3dca('0x1'))(_0x3dca('0x2'));module[_0x3dca('0x3')]=function(_0x26df5e,_0x1754d1){var _0x19f703={'method':_0x3dca('0x4'),'uri':url[_0x3dca('0x5')](_0x1754d1[_0x3dca('0x6')],_0x3dca('0x7')),'form':{'grant_type':_0x3dca('0x8'),'username':_0x1754d1['username'],'password':_0x1754d1[_0x3dca('0x8')]},'json':!![]};return rp(_0x19f703)['then'](function(_0x57264a){var _0xdea879={'method':'POST','uri':url[_0x3dca('0x5')](_0x1754d1[_0x3dca('0x9')],_0x3dca('0xa')),'body':{'type':_0x1754d1[_0x3dca('0xb')]||'message','channelId':_0x3dca('0xc'),'conversation':{'id':_0x26df5e[_0x3dca('0xd')]},'from':{'id':_0x26df5e[_0x3dca('0xe')],'name':_0x26df5e[_0x3dca('0xf')]},'recipient':{'id':_0x26df5e[_0x3dca('0x10')],'name':_0x26df5e[_0x3dca('0x11')]},'text':_0x1754d1['text'],'channelData':{}},'headers':{'Authorization':_0x3dca('0x12')+_0x57264a['access_token']},'json':!![]};if(_0x1754d1['project']){_0xdea879[_0x3dca('0x13')][_0x3dca('0x14')][_0x3dca('0x15')]=_0x1754d1[_0x3dca('0x16')];}if(_0x1754d1[_0x3dca('0x17')]=='1'){_0xdea879[_0x3dca('0x13')][_0x3dca('0x14')][_0x3dca('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3dca('0x19')};}if(_0x1754d1[_0x3dca('0x1a')]){_0xdea879[_0x3dca('0x13')][_0x3dca('0x14')][_0x3dca('0x1b')]=_0x1754d1['custom_action'];if(_0x1754d1['custom_action_data']){_0xdea879[_0x3dca('0x13')][_0x3dca('0x14')][_0x3dca('0x1c')]=_0x1754d1[_0x3dca('0x1d')];}}logger[_0x3dca('0x1e')](JSON[_0x3dca('0x1f')](_0xdea879));return rp(_0xdea879);});}; \ No newline at end of file +var _0xf6fb=['access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','CustomAction','custom_action_data','info','stringify','../../../../../config/logger','agi','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','calleridname','dnid','text'];(function(_0x5e18c4,_0x58feda){var _0x23bb9a=function(_0x28d21a){while(--_0x28d21a){_0x5e18c4['push'](_0x5e18c4['shift']());}};_0x23bb9a(++_0x58feda);}(_0xf6fb,0x111));var _0xbf6f=function(_0x50caa0,_0x560e6a){_0x50caa0=_0x50caa0-0x0;var _0x497b81=_0xf6fb[_0x50caa0];return _0x497b81;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xbf6f('0x0'))(_0xbf6f('0x1'));module['exports']=function(_0x270dda,_0x7191f2){var _0x5709b7={'method':_0xbf6f('0x2'),'uri':url['resolve'](_0x7191f2[_0xbf6f('0x3')],_0xbf6f('0x4')),'form':{'grant_type':_0xbf6f('0x5'),'username':_0x7191f2[_0xbf6f('0x6')],'password':_0x7191f2[_0xbf6f('0x5')]},'json':!![]};return rp(_0x5709b7)[_0xbf6f('0x7')](function(_0x9d0c63){var _0x43d56b={'method':'POST','uri':url[_0xbf6f('0x8')](_0x7191f2[_0xbf6f('0x9')],_0xbf6f('0xa')),'body':{'type':_0x7191f2[_0xbf6f('0xb')]||_0xbf6f('0xc'),'channelId':'Nda','conversation':{'id':_0x270dda['uniqueid']},'from':{'id':_0x270dda[_0xbf6f('0xd')],'name':_0x270dda[_0xbf6f('0xe')]},'recipient':{'id':_0x270dda[_0xbf6f('0xf')],'name':_0x270dda['extension']},'text':_0x7191f2[_0xbf6f('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x9d0c63[_0xbf6f('0x11')]},'json':!![]};if(_0x7191f2[_0xbf6f('0x12')]){_0x43d56b[_0xbf6f('0x13')]['channelData'][_0xbf6f('0x14')]=_0x7191f2[_0xbf6f('0x12')];}if(_0x7191f2[_0xbf6f('0x15')]=='1'){_0x43d56b[_0xbf6f('0x13')][_0xbf6f('0x16')][_0xbf6f('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x7191f2[_0xbf6f('0x18')]){_0x43d56b[_0xbf6f('0x13')][_0xbf6f('0x16')][_0xbf6f('0x19')]=_0x7191f2[_0xbf6f('0x18')];if(_0x7191f2[_0xbf6f('0x1a')]){_0x43d56b[_0xbf6f('0x13')]['channelData']['CustomActionData']=_0x7191f2[_0xbf6f('0x1a')];}}logger[_0xbf6f('0x1b')](JSON[_0xbf6f('0x1c')](_0x43d56b));return rp(_0x43d56b);});}; \ 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 4020ff3..69c80be 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 _0x3cdf=['exports','./lib/api'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x3cdf,0xe1));var _0xf3cd=function(_0x2e0dca,_0x45a901){_0x2e0dca=_0x2e0dca-0x0;var _0x31605b=_0x3cdf[_0x2e0dca];return _0x31605b;};'use strict';var asr=require(_0xf3cd('0x0'));module[_0xf3cd('0x1')]=function(_0x13a69b,_0x5c7796,_0x12be06,_0x45460b){return asr(_0x13a69b,_0x5c7796,_0x12be06,_0x45460b);}; \ No newline at end of file +var _0x0bb4=['./lib/api','exports'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x0bb4,0x14c));var _0x40bb=function(_0x225006,_0x2ef300){_0x225006=_0x225006-0x0;var _0x63909a=_0x0bb4[_0x225006];return _0x63909a;};'use strict';var asr=require(_0x40bb('0x0'));module[_0x40bb('0x1')]=function(_0x302b7e,_0x37fe0e,_0x40d462,_0x39528b){return asr(_0x302b7e,_0x37fe0e,_0x40d462,_0x39528b);}; \ 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 91ac48b..ccb041a 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 _0x5191=['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','lodash','crypto','../../../../../../config/logger','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x3f2a70,_0x55a720){var _0x2f5b89=function(_0x29ef3a){while(--_0x29ef3a){_0x3f2a70['push'](_0x3f2a70['shift']());}};_0x2f5b89(++_0x55a720);}(_0x5191,0x12e));var _0x1519=function(_0x1da42f,_0x23dc53){_0x1da42f=_0x1da42f-0x0;var _0x458c83=_0x5191[_0x1da42f];return _0x458c83;};'use strict';var BPromise=require('bluebird');var _=require(_0x1519('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x1519('0x1'));var logger=require(_0x1519('0x2'))(_0x1519('0x3'));module['exports']=function(_0x1abe82,_0x38552c,_0x5725a0,_0x25a57e){return new BPromise(function(_0x3831eb,_0x3e4b96){logger['info'](_0x1519('0x4'),_0x25a57e||_0x1519('0x5'));var _0x3327b4=new WebSocket(_0x25a57e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1c70be='';var _0xd97851='0';var _0x22984f='1';var _0x2023e8='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x254e43(_0x1326fa){var _0x52856f=crypto[_0x1519('0x6')](_0x1519('0x7'));_0x52856f[_0x1519('0x8')](_0x1326fa);return _0x52856f[_0x1519('0x9')](_0x1519('0xa'));}function _0x51893e(){try{logger[_0x1519('0xb')](_0x1519('0xc'));var _0x902a91=moment()[_0x1519('0xd')]();var _0x398e70=_0x254e43(_0x902a91+_0x38552c+_0x5725a0);_0x3327b4[_0x1519('0xe')](JSON['stringify']({'appID':_0x38552c,'timestamp':_0x902a91,'appKey':_0x398e70}));var _0x454ad8=fs[_0x1519('0xf')](_0x1abe82);_0x454ad8['on'](_0x1519('0x10'),function(_0x46d685){_0x3327b4[_0x1519('0xe')](_0x46d685);});_0x454ad8['on'](_0x1519('0x11'),function(){_0x3327b4[_0x1519('0xe')](_0x1519('0x12'));});}catch(_0x429d87){logger[_0x1519('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x1519('0x14')](_0x429d87));_0x3327b4[_0x1519('0x15')]();}}function _0x23e5b7(_0x544868){try{if(_0x544868){var _0x283516=JSON[_0x1519('0x16')](_0x544868);switch(_0x283516[_0x1519('0x17')]){case 0x0:if(_0x283516[_0x1519('0x18')]){if(_0x283516[_0x1519('0x18')][_0x1519('0x19')]){logger['info'](_0x1519('0x1a'),JSON[_0x1519('0x14')](_0x283516[_0x1519('0x18')][_0x1519('0x1b')]));_0x1c70be=_0x283516[_0x1519('0x18')]['hypotheses'][0x0][_0x1519('0x1c')];_0xd97851=_0x283516[_0x1519('0x18')][_0x1519('0x1b')][0x0][_0x1519('0x1d')];_0x22984f='0';_0x2023e8='Success.';_0x3327b4[_0x1519('0x15')]();}}break;case 0x1:logger['info'](_0x1519('0x1e'));_0x22984f='1';_0x2023e8='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x1519('0xb')](_0x1519('0x1f'));_0x22984f='2';_0x2023e8=_0x1519('0x1f');break;case 0x9:logger[_0x1519('0xb')](_0x1519('0x20'));_0x22984f='9';_0x2023e8=_0x1519('0x20');break;case 0xa:logger['info']('Authentication\x20failed.');_0x22984f='10';_0x2023e8=_0x1519('0x21');break;case 0xb:logger[_0x1519('0xb')](_0x1519('0x22'));_0x22984f='11';_0x2023e8=_0x1519('0x22');}}}catch(_0x3b2dc0){logger['error'](_0x1519('0x23'),JSON[_0x1519('0x14')](_0x3b2dc0));_0x3327b4['terminate']();}}function _0x3fd393(){logger[_0x1519('0xb')](_0x1519('0x24'));_0x3831eb({'transcript':_0x1c70be,'confidence':_0xd97851,'status':_0x22984f,'status_message':_0x2023e8});}function _0x30e644(_0x19f8a8){logger['error'](_0x1519('0x25'));if(!_[_0x1519('0x26')](_0x19f8a8)){logger[_0x1519('0x13')](_[_0x1519('0x27')](_0x19f8a8)?JSON['stringify'](_0x19f8a8):_0x19f8a8);}}_0x3327b4['on'](_0x1519('0x28'),_0x51893e);_0x3327b4['on'](_0x1519('0x29'),_0x23e5b7);_0x3327b4['on'](_0x1519('0x11'),_0x3fd393);_0x3327b4['on']('error',_0x30e644);});}; \ No newline at end of file +var _0xef3d=['close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','data'];(function(_0x3e9d06,_0x30e68f){var _0x1f5e28=function(_0x5790f5){while(--_0x5790f5){_0x3e9d06['push'](_0x3e9d06['shift']());}};_0x1f5e28(++_0x30e68f);}(_0xef3d,0x8f));var _0xdef3=function(_0x37e4f4,_0x3aed17){_0x37e4f4=_0x37e4f4-0x0;var _0x2d7fbc=_0xef3d[_0x37e4f4];return _0x2d7fbc;};'use strict';var BPromise=require('bluebird');var _=require(_0xdef3('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xdef3('0x1'));var crypto=require('crypto');var logger=require(_0xdef3('0x2'))(_0xdef3('0x3'));module[_0xdef3('0x4')]=function(_0x2a9f09,_0x1f1744,_0x595d7c,_0x11a6d0){return new BPromise(function(_0x3803b9,_0x55345d){logger[_0xdef3('0x5')]('Tilde\x20URI',_0x11a6d0||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2378bc=new WebSocket(_0x11a6d0||_0xdef3('0x6'),{'perMessageDeflate':![]});var _0x1fd2e0='';var _0x5dd3b4='0';var _0x137e3a='1';var _0x3197ac=_0xdef3('0x7');function _0x3dd61e(_0x5e1eb3){var _0x5becb9=crypto[_0xdef3('0x8')](_0xdef3('0x9'));_0x5becb9[_0xdef3('0xa')](_0x5e1eb3);return _0x5becb9[_0xdef3('0xb')](_0xdef3('0xc'));}function _0x448363(){try{logger[_0xdef3('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x4e7e03=moment()[_0xdef3('0xd')]();var _0x400d19=_0x3dd61e(_0x4e7e03+_0x1f1744+_0x595d7c);_0x2378bc[_0xdef3('0xe')](JSON[_0xdef3('0xf')]({'appID':_0x1f1744,'timestamp':_0x4e7e03,'appKey':_0x400d19}));var _0x373abd=fs['createReadStream'](_0x2a9f09);_0x373abd['on'](_0xdef3('0x10'),function(_0x841a46){_0x2378bc[_0xdef3('0xe')](_0x841a46);});_0x373abd['on'](_0xdef3('0x11'),function(){_0x2378bc[_0xdef3('0xe')](_0xdef3('0x12'));});}catch(_0x679621){logger['error'](_0xdef3('0x13'),JSON['stringify'](_0x679621));_0x2378bc[_0xdef3('0x14')]();}}function _0x5e10e1(_0x1427e7){try{if(_0x1427e7){var _0x16d623=JSON[_0xdef3('0x15')](_0x1427e7);switch(_0x16d623[_0xdef3('0x16')]){case 0x0:if(_0x16d623[_0xdef3('0x17')]){if(_0x16d623[_0xdef3('0x17')][_0xdef3('0x18')]){logger[_0xdef3('0x5')](_0xdef3('0x19'),JSON[_0xdef3('0xf')](_0x16d623['result'][_0xdef3('0x1a')]));_0x1fd2e0=_0x16d623['result'][_0xdef3('0x1a')][0x0][_0xdef3('0x1b')];_0x5dd3b4=_0x16d623[_0xdef3('0x17')]['hypotheses'][0x0][_0xdef3('0x1c')];_0x137e3a='0';_0x3197ac=_0xdef3('0x1d');_0x2378bc[_0xdef3('0x14')]();}}break;case 0x1:logger['info'](_0xdef3('0x7'));_0x137e3a='1';_0x3197ac=_0xdef3('0x7');break;case 0x2:logger[_0xdef3('0x5')](_0xdef3('0x1e'));_0x137e3a='2';_0x3197ac=_0xdef3('0x1e');break;case 0x9:logger[_0xdef3('0x5')](_0xdef3('0x1f'));_0x137e3a='9';_0x3197ac=_0xdef3('0x1f');break;case 0xa:logger[_0xdef3('0x5')](_0xdef3('0x20'));_0x137e3a='10';_0x3197ac='Authentication\x20failed.';break;case 0xb:logger[_0xdef3('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x137e3a='11';_0x3197ac='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x488436){logger[_0xdef3('0x21')](_0xdef3('0x22'),JSON[_0xdef3('0xf')](_0x488436));_0x2378bc['terminate']();}}function _0x2e0c28(){logger[_0xdef3('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x3803b9({'transcript':_0x1fd2e0,'confidence':_0x5dd3b4,'status':_0x137e3a,'status_message':_0x3197ac});}function _0x3dfd32(_0x206078){logger[_0xdef3('0x21')](_0xdef3('0x23'));if(!_[_0xdef3('0x24')](_0x206078)){logger[_0xdef3('0x21')](_[_0xdef3('0x25')](_0x206078)?JSON[_0xdef3('0xf')](_0x206078):_0x206078);}}_0x2378bc['on'](_0xdef3('0x26'),_0x448363);_0x2378bc['on'](_0xdef3('0x27'),_0x5e10e1);_0x2378bc['on'](_0xdef3('0x11'),_0x2e0c28);_0x2378bc['on']('error',_0x3dfd32);});}; \ 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 cc97dc4..0d804b9 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 _0x7553=['./asr','exports'];(function(_0x2258c2,_0xf20066){var _0x5e6cf8=function(_0x449345){while(--_0x449345){_0x2258c2['push'](_0x2258c2['shift']());}};_0x5e6cf8(++_0xf20066);}(_0x7553,0x1bc));var _0x3755=function(_0x535345,_0x206b21){_0x535345=_0x535345-0x0;var _0x28c2b7=_0x7553[_0x535345];return _0x28c2b7;};var asr=require(_0x3755('0x0'));module[_0x3755('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7578=['./asr'];(function(_0x19fb21,_0x51b553){var _0x38525f=function(_0x4be6c7){while(--_0x4be6c7){_0x19fb21['push'](_0x19fb21['shift']());}};_0x38525f(++_0x51b553);}(_0x7578,0x19e));var _0x8757=function(_0x58ecf1,_0xa24fdd){_0x58ecf1=_0x58ecf1-0x0;var _0x4c0579=_0x7578[_0x58ecf1];return _0x4c0579;};var asr=require(_0x8757('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b382a3b..7a2d99c 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(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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 _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(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 0b49cbd..79a2edd 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 _0x5089=['getVariable','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','createSquareMessage','createCmContact','isEmpty','callback_','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentLogout','internal','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','POST','PUT','method','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','parse','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','replaceAllVariables','getAndSetVariable','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','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\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','no\x20key\x20configured','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','sendMail\x20message','smtpOptions','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','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','channel','mailRpc','prototype'];(function(_0x392a07,_0x203757){var _0x2133b1=function(_0x17f839){while(--_0x17f839){_0x392a07['push'](_0x392a07['shift']());}};_0x2133b1(++_0x203757);}(_0x5089,0x1bb));var _0x9508=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0x5089[_0x191c44];return _0x1086cd;};'use strict';var fs=require('fs');var util=require(_0x9508('0x0'));var _=require(_0x9508('0x1'));var sh=require('shelljs');var odbc=require(_0x9508('0x2'))();var rs=require(_0x9508('0x3'));var moment=require(_0x9508('0x4'));var Mustache=require(_0x9508('0x5'));var rp=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var scripts=require(_0x9508('0x8'));var FILES_PATH=_0x9508('0x9');var recursiveMapAttributes=[_0x9508('0xa'),'rawBody'];var verticesWithRetry=[_0x9508('0xb'),_0x9508('0xc'),'getsecretdigits'];var AGIVertices=function(_0x14dae7,_0x338897,_0x4f6720){this[_0x9508('0xd')]=_0x14dae7;this['rpc']=_0x338897;this[_0x9508('0xe')]=_0x4f6720;};AGIVertices[_0x9508('0xf')][_0x9508('0x10')]=function(_0x21f8c1,_0x839509){this[_0x9508('0x11')]['getVariableById'](_0x21f8c1)[_0x9508('0x12')](function(_0x507887){_0x839509(null,_0x507887?_0x507887[_0x9508('0x13')]:![]);})[_0x9508('0x14')](function(_0x554c90){_0x839509(_0x554c90);});};AGIVertices[_0x9508('0xf')][_0x9508('0x15')]=function(_0x10ceef,_0x4701de){this['rpc'][_0x9508('0x16')](_0x10ceef)[_0x9508('0x12')](function(_0x51c80b){_0x4701de(null,_0x51c80b?_0x51c80b[_0x9508('0x13')]:![]);})['catch'](function(_0x25d4d6){_0x4701de(_0x25d4d6);});};AGIVertices[_0x9508('0xf')][_0x9508('0x17')]=function(_0x255a03,_0x127340){this[_0x9508('0x11')][_0x9508('0x18')](_0x255a03)[_0x9508('0x12')](function(_0x5a303c){_0x127340(null,_0x5a303c?_0x5a303c[_0x9508('0x13')]:![]);})[_0x9508('0x14')](function(_0xfcc29d){_0x127340(_0xfcc29d);});};AGIVertices[_0x9508('0xf')][_0x9508('0x19')]=function(_0x22a9fe,_0x52e3c4){this['rpc'][_0x9508('0x1a')](_0x22a9fe)['then'](function(_0x2272e2){_0x52e3c4(null,_0x2272e2?_0x2272e2['dsn']:![]);})[_0x9508('0x14')](function(_0x22ff69){_0x52e3c4(_0x22ff69);});};AGIVertices[_0x9508('0xf')][_0x9508('0x1b')]=function(_0x1edf1b,_0x2f8106){this[_0x9508('0x11')]['getUserById'](_0x1edf1b)['then'](function(_0xd7b601){_0x2f8106(null,_0xd7b601?_0xd7b601[_0x9508('0x13')]:![]);})[_0x9508('0x14')](function(_0xf70830){_0x2f8106(_0xf70830);});};AGIVertices[_0x9508('0xf')][_0x9508('0x1c')]=function(_0x4b68e9,_0x5e9a80){this[_0x9508('0x11')]['getTrunkById'](_0x4b68e9)['then'](function(_0x1d4500){_0x5e9a80(null,_0x1d4500?_0x1d4500['name']:![]);})['catch'](function(_0x1c9b3e){_0x5e9a80(_0x1c9b3e);});};AGIVertices[_0x9508('0xf')]['getSound']=function(_0x49246b,_0x32b0dd){var _0x22b2e2=this;this[_0x9508('0x11')][_0x9508('0x1d')](_0x49246b)[_0x9508('0x12')](function(_0x15c32e){_0x32b0dd(null,_0x15c32e?_0x22b2e2[_0x9508('0x1e')](_0x15c32e[_0x9508('0x1f')]):![]);})[_0x9508('0x14')](function(_0x19a984){_0x32b0dd(_0x19a984);});};AGIVertices['prototype'][_0x9508('0x20')]=function(_0x3b894b,_0x2b3738){this['rpc'][_0x9508('0x21')](_0x3b894b)[_0x9508('0x12')](function(_0x5e1d31){_0x2b3738(null,_0x5e1d31?_0x5e1d31:![]);})[_0x9508('0x14')](function(_0x226645){_0x2b3738(_0x226645);});};AGIVertices['prototype'][_0x9508('0x22')]=function(_0x2fd00e,_0xb06b10,_0x36de9f){this['mailRpc']['sendMailMessage'](_0x2fd00e,_0xb06b10)[_0x9508('0x12')](function(){_0x36de9f(null);})[_0x9508('0x14')](function(_0x2677d6){_0x36de9f(_0x2677d6);});};AGIVertices['prototype']['getIntervals']=function(_0x301dd0,_0x14be59){this[_0x9508('0x11')][_0x9508('0x23')](_0x301dd0)[_0x9508('0x12')](function(_0x3f86d4){if(_0x3f86d4){if(_0x3f86d4[_0x9508('0x24')]){_0x14be59(null,[_0x3f86d4[_0x9508('0x25')]]);}else{_0x14be59(null,_[_0x9508('0x26')](_0x3f86d4[_0x9508('0x27')],'interval'));}}else{_0x14be59(null,![]);}})[_0x9508('0x14')](function(_0x27e248){_0x14be59(_0x27e248);});};AGIVertices['prototype'][_0x9508('0x1e')]=function(_0x42c23c){return util[_0x9508('0x28')](_0x9508('0x29'),FILES_PATH,_0x42c23c);};AGIVertices[_0x9508('0xf')][_0x9508('0x2a')]=function(_0x33e17c,_0x3700f1,_0xfb6676){odbc[_0x9508('0x2b')](_0x33e17c,function(_0x2a5d1b){if(_0x2a5d1b){logger['error'](_0x9508('0x2c'),_0x2a5d1b);_0xfb6676(_0x2a5d1b);}else{logger['info'](_0x9508('0x2d'));odbc[_0x9508('0x2e')](_0x3700f1,function(_0x23a8b6,_0x5644b6){if(_0x23a8b6){logger['info'](_0x9508('0x2f'),_0x3700f1);_0xfb6676(_0x23a8b6);}else{logger[_0x9508('0x30')](_0x9508('0x31'),_0x3700f1);odbc[_0x9508('0x32')](function(_0x4eb600){if(_0x4eb600){logger[_0x9508('0x33')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x4eb600);}_0xfb6676(null,_0x5644b6);});}});}});};AGIVertices[_0x9508('0xf')][_0x9508('0x34')]=function(_0x5205f8,_0x33e412){this[_0x9508('0x11')]['getSmsAccountById'](_0x5205f8)[_0x9508('0x12')](function(_0x1e6851){_0x33e412(null,_0x1e6851?_0x1e6851:![]);})[_0x9508('0x14')](function(_0x12fdc6){_0x33e412(_0x12fdc6);});};AGIVertices['prototype']['createSmsMessage']=function(_0xaf138f,_0x4ff354){this[_0x9508('0x11')][_0x9508('0x35')](_0xaf138f)[_0x9508('0x12')](function(_0x4215e9){_0x4ff354(null,_0x4215e9);})['catch'](function(_0x47e3a6){_0x4ff354(_0x47e3a6);});};AGIVertices['prototype'][_0x9508('0x36')]=function(_0x5e7fe3,_0x3f2fc1,_0x54e4bf){this[_0x9508('0x11')][_0x9508('0x36')]({'uniqueid':this[_0x9508('0xd')][_0x9508('0x37')],'node':_0x5e7fe3['label'],'application':_0x5e7fe3[_0x9508('0x38')],'data':_0x3f2fc1||null,'project_name':this[_0x9508('0xd')][_0x9508('0x39')],'callerid':this['channel'][_0x9508('0x3a')]})[_0x9508('0x12')](function(_0x560b9c){if(_0x54e4bf){_0x54e4bf(null,_0x560b9c);}})[_0x9508('0x14')](function(_0x50a4ba){if(_0x54e4bf){_0x54e4bf(_0x50a4ba);}});};AGIVertices[_0x9508('0xf')]['createSquareRecording']=function(_0x5b4888,_0x4194be,_0x168afb,_0x1936c8){this[_0x9508('0x11')][_0x9508('0x3b')]({'uniqueid':this[_0x9508('0xd')]['uniqueid'],'callerid':this[_0x9508('0xd')][_0x9508('0x3a')],'calleridname':this[_0x9508('0xd')]['calleridname'],'context':this[_0x9508('0xd')][_0x9508('0x3c')],'extension':this[_0x9508('0xd')][_0x9508('0x3d')],'priority':this['channel'][_0x9508('0x3e')],'accountcode':this['channel'][_0x9508('0x3f')],'dnid':this[_0x9508('0xd')]['dnid'],'projectName':this[_0x9508('0xd')][_0x9508('0x39')],'saveName':_0x4194be,'filename':_0x5b4888['file']||_0x4194be,'savePath':_0x168afb})[_0x9508('0x12')](function(_0x22306e){_0x1936c8(null,_0x22306e);})['catch'](function(_0x39215b){_0x1936c8(_0x39215b);});};AGIVertices['prototype'][_0x9508('0x40')]=function(_0x50df5e,_0x1e6c8c,_0x55a023,_0x49ac4f,_0x55a158){this['rpc'][_0x9508('0x40')]({'uniqueid':this[_0x9508('0xd')][_0x9508('0x37')],'body':_0x50df5e,'direction':_0x1e6c8c,'providerName':_0x55a023,'providerResponse':_0x49ac4f})[_0x9508('0x12')](function(_0x40e385){if(_0x55a158){_0x55a158(null,_0x40e385);}})[_0x9508('0x14')](function(_0x2b9854){if(_0x55a158){_0x55a158(_0x2b9854);}});};AGIVertices[_0x9508('0xf')][_0x9508('0x41')]=function(_0x5e4992,_0x3398d2){this[_0x9508('0x11')][_0x9508('0x41')]({'firstName':_[_0x9508('0x42')](_0x5e4992[_0x9508('0x13')])||_['isNil'](_0x5e4992['name'])?_0x9508('0x43')+Math['random']():_0x5e4992[_0x9508('0x13')],'lastName':_[_0x9508('0x42')](_0x5e4992['lastName'])||_[_0x9508('0x44')](_0x5e4992['lastName'])?null:_0x5e4992['lastName'],'phone':_0x5e4992[_0x9508('0x45')],'ListId':_0x5e4992[_0x9508('0x46')],'scheduledat':_0x5e4992['scheduledAt'],'callbackUniqueid':this[_0x9508('0xd')][_0x9508('0x37')],'tags':_0x9508('0x47'),'description':_0x9508('0x48')+_0x5e4992[_0x9508('0x49')][_0x9508('0x4a')](),'priority':_0x5e4992[_0x9508('0x4b')]})[_0x9508('0x12')](function(_0x367da4){_0x3398d2(null,_0x367da4);})[_0x9508('0x14')](function(_0x122934){_0x3398d2(_0x122934);});};AGIVertices[_0x9508('0xf')][_0x9508('0x4c')]=function(_0x2005f0,_0x4c7b6b){this[_0x9508('0x11')][_0x9508('0x4d')](_0x2005f0)['then'](function(_0x2573d1){_0x4c7b6b(null,_0x2573d1?_0x2573d1['name']:![]);})['catch'](function(_0x237cf9){_0x4c7b6b(_0x237cf9);});};AGIVertices[_0x9508('0xf')]['agentPause']=function(_0x199c2e,_0x198389,_0x553e6b){var _0x2d22dc={'role':_0x9508('0x4e')};_0x2d22dc[_0x199c2e]=this[_0x9508('0xd')]['callerid'];this[_0x9508('0x11')][_0x9508('0x4f')](_0x2d22dc,_0x198389,this[_0x9508('0xd')][_0x9508('0x37')])[_0x9508('0x12')](function(_0x34a4c5){_0x553e6b(null,_['isNil'](_0x34a4c5)?![]:!![]);})[_0x9508('0x14')](function(_0x460780){logger[_0x9508('0x33')](_0x460780);_0x553e6b(null,![]);});};AGIVertices[_0x9508('0xf')]['agentUnpause']=function(_0x2ff0bb,_0x5e2dab){var _0x314a07={'role':_0x9508('0x4e')};_0x314a07[_0x2ff0bb]=this['channel'][_0x9508('0x3a')];this[_0x9508('0x11')]['agentUnpause'](_0x314a07)[_0x9508('0x12')](function(_0x132e3f){_0x5e2dab(null,_[_0x9508('0x44')](_0x132e3f)?![]:!![]);})[_0x9508('0x14')](function(_0x5aa42b){logger[_0x9508('0x33')](_0x5aa42b);_0x5e2dab(null,![]);});};AGIVertices[_0x9508('0xf')][_0x9508('0x50')]=function(_0x468375,_0x27bae4){var _0x9a59f7={'role':_0x9508('0x4e')};_0x9a59f7[_0x468375]=this[_0x9508('0xd')]['callerid'];this[_0x9508('0x11')][_0x9508('0x50')](_0x9a59f7)[_0x9508('0x12')](function(_0x4fd9af){_0x27bae4(null,_[_0x9508('0x44')](_0x4fd9af)?![]:!![]);})['catch'](function(_0x3256e9){logger['error'](_0x3256e9);_0x27bae4(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x2c2cd8,_0x195be7){var _0x22c0c9={'role':'agent'};_0x22c0c9[_0x2c2cd8]=this[_0x9508('0xd')][_0x9508('0x3a')];var _0x3a092a=_0x2c2cd8!=_0x9508('0x51')?util[_0x9508('0x28')]('%s/%s@from-sip/n','LOCAL',this[_0x9508('0xd')][_0x9508('0x3a')]):undefined;this[_0x9508('0x11')][_0x9508('0x52')](_0x22c0c9,_0x3a092a)[_0x9508('0x12')](function(_0x3ec6b7){_0x195be7(null,_[_0x9508('0x44')](_0x3ec6b7)?![]:!![]);})[_0x9508('0x14')](function(_0x3e60d0){logger[_0x9508('0x33')](_0x3e60d0);_0x195be7(null,![]);});};AGIVertices[_0x9508('0xf')][_0x9508('0x53')]=function(_0x57e389,_0x520f72){sh[_0x9508('0x54')](_['trim'](_0x57e389),function(_0x3847ad,_0x47d7ff){var _0x4c89d2=_0x47d7ff[_0x9508('0x55')](/(\r\n|\n|\r)/gm,'');_0x520f72(null,_0x4c89d2);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x32da5f,_0x5f67d7){scripts[_0x9508('0x56')](_0x32da5f[_0x9508('0x57')],_0x32da5f[_0x9508('0x58')]||_0x9508('0x59'),_0x32da5f[_0x9508('0x59')],_0x32da5f[_0x9508('0x5a')]||_0x9508('0x5b'),_0x32da5f[_0x9508('0x5c')]||_0x9508('0x5d'),_0x32da5f[_0x9508('0x5e')]||_0x9508('0x5f'))[_0x9508('0x12')](function(_0x456828){_0x5f67d7(null,_0x456828);})['catch'](function(_0x2dc584){_0x5f67d7(_0x2dc584);});};AGIVertices['prototype'][_0x9508('0x60')]=function(_0x39618d,_0x42ab8e){scripts[_0x9508('0x60')](_0x39618d[_0x9508('0x59')],_0x39618d[_0x9508('0x61')]||'en',0x1)[_0x9508('0x12')](function(_0x2658e1){_0x42ab8e(null,_0x2658e1);})[_0x9508('0x14')](function(_0x18b441){_0x42ab8e(_0x18b441);});};AGIVertices[_0x9508('0xf')][_0x9508('0x62')]=function(_0x5d0d94,_0x2db0af){var _0x2020bd={'uri':_0x5d0d94[_0x9508('0x63')],'method':_0x5d0d94['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5d0d94['timeout'])===_0x9508('0x64')&&parseInt(_0x5d0d94[_0x9508('0x65')])>=0x1?parseInt(_0x5d0d94[_0x9508('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x9508('0x66')]([_0x9508('0x67'),_0x9508('0x68')],_0x2020bd[_0x9508('0x69')]['toUpperCase']())){try{_0x2020bd[_0x9508('0x6a')]=_0x5d0d94['rawBody']?JSON['parse'](_0x5d0d94[_0x9508('0x6b')]):{};}catch(_0x5b576a){logger[_0x9508('0x33')](_0x9508('0x6c'),_0x5b576a);}}try{_0x2020bd['headers']=_0x5d0d94[_0x9508('0xa')]?JSON['parse'](_0x5d0d94[_0x9508('0xa')]):{};}catch(_0x5d9dd2){logger[_0x9508('0x33')](_0x9508('0x6d'),_0x5d9dd2);}if(_0x5d0d94[_0x9508('0x6e')]){try{var _0x21c1b7=require(_0x5d0d94[_0x9508('0x6e')])[_0x9508('0x6f')](this,_0x2020bd);_0x2020bd[_0x9508('0x70')]=Mustache[_0x9508('0x71')](_0x5d0d94[_0x9508('0x63')],_0x21c1b7,{},['$$','$$']);if(_0x2020bd[_0x9508('0x72')]){_0x2020bd['headers']=JSON[_0x9508('0x73')](Mustache[_0x9508('0x71')](JSON[_0x9508('0x74')](_0x2020bd[_0x9508('0x72')]),_0x21c1b7,{},['$$','$$']));}if(_0x2020bd[_0x9508('0x6a')]){_0x2020bd[_0x9508('0x6a')]=JSON['parse'](Mustache['render'](JSON[_0x9508('0x74')](_0x2020bd[_0x9508('0x6a')]),_0x21c1b7,{},['$$','$$']));}}catch(_0x1ad750){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1ad750);}}rp(_0x2020bd)[_0x9508('0x12')](function(_0x525ce2){var _0x287a1b={'statusCode':_0x525ce2[_0x9508('0x75')]||0xc8,'statusMessage':_0x525ce2[_0x9508('0x76')]||'OK','headers':_0x525ce2['headers']||{},'body':_0x525ce2[_0x9508('0x6a')]||{}};_0x2db0af(null,_0x287a1b);})[_0x9508('0x14')](function(_0x212d04){var _0x3ea6e0={'statusCode':_0x212d04[_0x9508('0x75')]||0x1f4,'statusMessage':_0x212d04[_0x9508('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x212d04['options'][_0x9508('0x72')]||{},'body':_0x212d04[_0x9508('0x78')]['body']||{}};_0x2db0af(null,_0x3ea6e0);});};AGIVertices[_0x9508('0xf')][_0x9508('0x79')]=function(_0xdf4171,_0x4959a6){scripts['googleDialogflow'](this[_0x9508('0xd')]['uniqueid'],_0xdf4171[_0x9508('0x7a')],_0xdf4171[_0x9508('0x59')],_0xdf4171[_0x9508('0x7b')]||'en')[_0x9508('0x12')](function(_0x5af5e4){_0x4959a6(null,_0x5af5e4);})[_0x9508('0x14')](function(_0x178b03){_0x4959a6(_0x178b03);});};AGIVertices['prototype'][_0x9508('0x7c')]=function(_0x146d98,_0xa89fca){scripts['googleDialogflowV2'](this[_0x9508('0xd')]['uniqueid'],_0x146d98[_0x9508('0x7d')],_0x146d98[_0x9508('0x7e')],_0x146d98[_0x9508('0x7f')],_0x146d98[_0x9508('0x59')],_0x146d98[_0x9508('0x80')]||'en')[_0x9508('0x12')](function(_0x2f9f8d){_0xa89fca(null,_0x2f9f8d);})[_0x9508('0x14')](function(_0x234b3e){_0xa89fca(_0x234b3e);});};AGIVertices[_0x9508('0xf')][_0x9508('0x81')]=function(_0x2c271e,_0x33ff9c){scripts[_0x9508('0x81')](this[_0x9508('0xd')],_0x2c271e)[_0x9508('0x12')](function(_0x482b07){_0x33ff9c(null,_0x482b07);})[_0x9508('0x14')](function(_0x47cccc){_0x33ff9c(_0x47cccc);});};AGIVertices['prototype'][_0x9508('0x82')]=function(_0x3bb289,_0x1fa1e8){scripts['ispeechTTS'](_0x3bb289[_0x9508('0x7a')],_0x3bb289[_0x9508('0x59')],_0x3bb289[_0x9508('0x83')]||_0x9508('0x5b'),_0x3bb289[_0x9508('0x84')])[_0x9508('0x12')](function(_0x303d50){_0x1fa1e8(null,_0x303d50);})['catch'](function(_0x1368d2){_0x1fa1e8(_0x1368d2);});};AGIVertices['prototype'][_0x9508('0x85')]=function(_0x2db5ed,_0x1db47b,_0x3cfd6b){scripts[_0x9508('0x85')](_0x1db47b,_0x2db5ed[_0x9508('0x7a')],_0x2db5ed[_0x9508('0x86')]||_0x9508('0x5b'),this[_0x9508('0x87')](_0x2db5ed['model'])?_0x2db5ed[_0x9508('0x88')]:undefined)['then'](function(_0x55900d){_0x3cfd6b(null,_0x55900d);})[_0x9508('0x14')](function(_0x2851ba){_0x3cfd6b(_0x2851ba);});};AGIVertices[_0x9508('0xf')][_0x9508('0x89')]=function(_0x5e3e7a,_0x54e7e8){scripts[_0x9508('0x89')](_0x5e3e7a[_0x9508('0x8a')],_0x5e3e7a[_0x9508('0x8b')],_0x5e3e7a['aws_polly_region'],_0x5e3e7a[_0x9508('0x8c')]||'Amy',_0x5e3e7a['text'],_0x5e3e7a[_0x9508('0x8d')]||'text')[_0x9508('0x12')](function(_0x1d6547){_0x54e7e8(null,_0x1d6547);})[_0x9508('0x14')](function(_0x1d443a){_0x54e7e8(_0x1d443a);});};AGIVertices[_0x9508('0xf')][_0x9508('0x8e')]=function(_0x50ce8b,_0x4566ff){scripts[_0x9508('0x8e')](this['channel'][_0x9508('0x37')],_0x50ce8b['aws_access_key_id'],_0x50ce8b['aws_secret_access_key'],_0x50ce8b[_0x9508('0x8f')],_0x50ce8b[_0x9508('0x59')],_0x50ce8b[_0x9508('0x90')])[_0x9508('0x12')](function(_0x4c8bab){_0x4566ff(null,_0x4c8bab);})[_0x9508('0x14')](function(_0x3ae1a5){_0x4566ff(_0x3ae1a5);});};AGIVertices[_0x9508('0xf')][_0x9508('0x91')]=function(_0x5eeed0,_0x510ba6,_0x4ebc98){scripts[_0x9508('0x91')](_0x510ba6,_0x5eeed0[_0x9508('0x7a')],_0x5eeed0[_0x9508('0x92')]||_0x9508('0x5b'))[_0x9508('0x12')](function(_0x291240){_0x4ebc98(null,_0x291240);})[_0x9508('0x14')](function(_0x1ac4e2){_0x4ebc98(_0x1ac4e2);});};AGIVertices[_0x9508('0xf')][_0x9508('0x93')]=function(_0x21c8c9,_0x1d31e5,_0x721116){scripts[_0x9508('0x93')](_0x1d31e5,_0x21c8c9['appid'],_0x21c8c9[_0x9508('0x94')],_0x21c8c9['uri'])[_0x9508('0x12')](function(_0x4b7ba4){_0x721116(null,_0x4b7ba4);})[_0x9508('0x14')](function(_0x4477ee){_0x721116(_0x4477ee);});};AGIVertices[_0x9508('0xf')][_0x9508('0x95')]=function(_0x155d6d){var _0x25a599=_[_0x9508('0x66')](verticesWithRetry,_0x155d6d[_0x9508('0x38')])?_0x155d6d:_[_0x9508('0x96')](_0x155d6d);for(var _0x46bd70 in _0x25a599){if(_0x25a599[_0x9508('0x97')](_0x46bd70)){if(_0x25a599[_0x46bd70]&&_['isString'](_0x25a599[_0x46bd70])){if(_[_0x9508('0x66')](recursiveMapAttributes,_0x46bd70)){_0x25a599[_0x46bd70]=this[_0x9508('0x98')](_0x25a599[_0x46bd70]);}else{_0x25a599[_0x46bd70]=this['replaceAllVariables'](_0x25a599[_0x46bd70]);}}}}return _0x25a599;};AGIVertices[_0x9508('0xf')]['recursiveNodeIndex']=function(_0x41bcd9){for(var _0x1a0901 in _0x41bcd9){if(_0x41bcd9[_0x9508('0x97')](_0x1a0901)){if(_[_0x9508('0x99')](_0x41bcd9[_0x1a0901])){this[_0x9508('0x9a')](_0x41bcd9[_0x1a0901]);}else if(_[_0x9508('0x9b')](_0x41bcd9[_0x1a0901])){for(var _0x5293da=0x0;_0x5293da<_0x41bcd9[_0x1a0901][_0x9508('0x9c')];_0x5293da++){this['recursiveNodeIndex'](_0x41bcd9[_0x1a0901][_0x5293da]);}}else if(_[_0x9508('0x9d')](_0x41bcd9[_0x1a0901])){_0x41bcd9[_0x1a0901]=this['replaceAllVariables'](_0x41bcd9[_0x1a0901]);}}}};AGIVertices[_0x9508('0xf')][_0x9508('0x9e')]=function(_0x40cc62,_0xbeee60){for(var _0x2e2eb2 in _0x40cc62){if(_0x40cc62[_0x9508('0x97')](_0x2e2eb2)){if(_[_0x9508('0x99')](_0x40cc62[_0x2e2eb2])){if(!_[_0x9508('0x42')](_0x40cc62[_0x2e2eb2])){this[_0x9508('0x9e')](_0x40cc62[_0x2e2eb2],util[_0x9508('0x28')](_0x9508('0x9f'),_0xbeee60,_0x2e2eb2));}}else if(_[_0x9508('0x9b')](_0x40cc62[_0x2e2eb2])){for(var _0x3e8b0a=0x0;_0x3e8b0a<_0x40cc62[_0x2e2eb2]['length'];_0x3e8b0a++){this['saveRestApiResult'](_0x40cc62[_0x2e2eb2][_0x3e8b0a],util[_0x9508('0x28')]('%s.%s',_0xbeee60,_0x2e2eb2+'['+_0x3e8b0a+']'));}}else{if(!_['isNil'](_0x40cc62[_0x2e2eb2])){this['channel'][_0x9508('0xa0')](util[_0x9508('0x28')]('%s.%s',_0xbeee60,_0x2e2eb2),_0x40cc62[_0x2e2eb2]);}}}}};AGIVertices['prototype'][_0x9508('0x98')]=function(_0x230a76){try{var _0x58edee=JSON[_0x9508('0x73')](_0x230a76);this['recursiveNodeIndex'](_0x58edee);return JSON[_0x9508('0x74')](_0x58edee);}catch(_0x1127db){return this['replaceAllVariables'](_0x230a76);}};AGIVertices[_0x9508('0xf')]['replaceAllVariables']=function(_0x249476){var _0x979665=_0x249476[_0x9508('0xa1')]('{');for(var _0x3e35b8=0x1;_0x3e35b8<_0x979665['length'];_0x3e35b8+=0x1){var _0x380f11=_0x979665[_0x3e35b8]['split']('}');if(_0x380f11[_0x9508('0x9c')]>0x1){_0x249476=_0x249476[_0x9508('0xa2')]('{'+_0x380f11[0x0]+'}',this[_0x9508('0xd')][_0x9508('0x10')](_0x380f11[0x0])[_0x9508('0xa3')]||_0x380f11[0x0]);}}if(_0x979665[_0x9508('0x9c')]===0x1){return _0x249476[_0x9508('0x4a')]();}return this[_0x9508('0xa4')](_0x249476);};AGIVertices[_0x9508('0xf')][_0x9508('0xa5')]=function(_0x51b44c,_0x5ede0e){var _0x28cefb=this[_0x9508('0xd')][_0x9508('0x10')](_0x51b44c);if(_0x28cefb['result']===-0x1){return _0x28cefb;}logger[_0x9508('0x30')](util[_0x9508('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5ede0e,_0x28cefb[_0x9508('0xa3')]));return this[_0x9508('0xd')][_0x9508('0xa0')](_0x5ede0e,_0x28cefb[_0x9508('0xa3')]);};AGIVertices['prototype'][_0x9508('0x87')]=function(_0x4a2646){return _0x4a2646&&_0x4a2646!=='0'&&_0x4a2646!=='-1'&&_0x4a2646!=='';};AGIVertices['prototype']['maxRetry']=function(_0x106251){this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x106251,'-');_0x106251[_0x9508('0xa6')]=_0x106251[_0x9508('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9508('0xf')]['mrcpsynth']=function(_0x2802b4){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xa8'),_0x2802b4[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x2802b4['text'])){return this[_0x9508('0xd')]['noop'](_0x9508('0xaa'));}var _0xb79d84='\x22'+_0x2802b4[_0x9508('0x59')]+'\x22';if(this['isConfigured'](_0x2802b4[_0x9508('0x78')])){_0xb79d84+=','+_0x2802b4['options'];}var _0x5a4db4=this[_0x9508('0xd')][_0x9508('0x54')]('MRCPSynth',_0xb79d84);if(_0x5a4db4[_0x9508('0xab')]===-0x1){return _0x5a4db4;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xad'),_0xb79d84));};AGIVertices[_0x9508('0xf')][_0x9508('0xae')]=function(_0x119c3a){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xaf'),_0x119c3a[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x119c3a[_0x9508('0xb0')])){return this['channel'][_0x9508('0xac')](_0x9508('0xb1'));}var _0x3fd814=_0x119c3a[_0x9508('0xb0')];if(this['isConfigured'](_0x119c3a[_0x9508('0x78')])){_0x3fd814+=','+_0x119c3a[_0x9508('0x78')];}var _0x14314b=this[_0x9508('0xd')][_0x9508('0x54')](_0x9508('0xb2'),_0x3fd814);if(_0x14314b['result']===-0x1){return _0x14314b;}var _0x1fdf50=this[_0x9508('0xa5')](_0x9508('0xb3'),_0x9508('0xb4'));if(_0x1fdf50[_0x9508('0xab')]===-0x1){return _0x1fdf50;}var _0x49dbc6=this['getAndSetVariable'](_0x9508('0xb5'),_0x9508('0xb6'));if(_0x49dbc6[_0x9508('0xab')]===-0x1){return _0x49dbc6;}var _0xe77013=this[_0x9508('0xa5')](_0x9508('0xb7'),_0x9508('0xb8'));if(_0xe77013['result']===-0x1){return _0xe77013;}return this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3fd814));};AGIVertices[_0x9508('0xf')][_0x9508('0x7')]=function(_0x10beb2){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xb9'),_0x10beb2[_0x9508('0xa9')]));return this['channel'][_0x9508('0x7')]([_0x10beb2[_0x9508('0xba')],_0x10beb2['args']]);};AGIVertices[_0x9508('0xf')][_0x9508('0xbb')]=function(_0x19d8dd){logger['info'](util['format'](_0x9508('0xbc'),_0x19d8dd[_0x9508('0xa9')]));if(this[_0x9508('0x87')](_0x19d8dd['timeout'])){logger['info'](util[_0x9508('0x28')](_0x9508('0xbd'),_0x19d8dd[_0x9508('0x65')]));var _0x3ef7e3=this[_0x9508('0xd')][_0x9508('0xbe')](_0x19d8dd[_0x9508('0x65')]);if(_0x3ef7e3[_0x9508('0xab')]===-0x1){return _0x3ef7e3;}}return this[_0x9508('0xd')][_0x9508('0xbb')]();};AGIVertices[_0x9508('0xf')][_0x9508('0x47')]=function(_0xd931a4){logger['info'](util[_0x9508('0x28')](_0x9508('0xbf'),_0xd931a4['label']));if(!this[_0x9508('0x87')](_0xd931a4[_0x9508('0x46')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0xd931a4,'no\x20list\x20selected');}_0xd931a4[_0x9508('0x49')]=moment();if(this[_0x9508('0x87')](_0xd931a4['delay'])){_0xd931a4[_0x9508('0x49')]=moment()['add'](_0xd931a4[_0x9508('0xc0')],'minutes');}if(!this[_0x9508('0x87')](_0xd931a4[_0x9508('0x4b')])){_0xd931a4[_0x9508('0x4b')]=0x2;}this[_0x9508('0x41')][_0x9508('0x6f')](this,_0xd931a4);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xc1'),_0xd931a4[_0x9508('0x45')],_0xd931a4[_0x9508('0x46')],_0xd931a4[_0x9508('0x49')]));};AGIVertices['prototype'][_0x9508('0xc2')]=function(_0x1c19ef){logger[_0x9508('0x30')](util['format'](_0x9508('0xc3'),_0x1c19ef[_0x9508('0xa9')]));var _0x1d0e4c=this[_0x9508('0xd')][_0x9508('0x54')](_0x1c19ef['application'],_0x1c19ef[_0x9508('0x78')]);if(_0x1d0e4c[_0x9508('0xab')]===-0x1){return _0x1d0e4c;}return this[_0x9508('0xd')]['noop'](util['format'](_0x9508('0xc4'),_0x1c19ef[_0x9508('0xc5')],_0x1c19ef['options']));};AGIVertices[_0x9508('0xf')][_0x9508('0xc6')]=function(_0x24cfcd){logger['info'](util[_0x9508('0x28')](_0x9508('0xc7'),_0x24cfcd[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x24cfcd['text'])){return this['channel']['noop']('no\x20text\x20configured');}var _0x1a3a7d='\x22'+_0x24cfcd['text']+'\x22';if(this[_0x9508('0x87')](_0x24cfcd[_0x9508('0x78')])){_0x1a3a7d+=','+_0x24cfcd[_0x9508('0x78')];}var _0x423786=this[_0x9508('0xd')][_0x9508('0x54')]('MRCPSynth',_0x1a3a7d);if(_0x423786[_0x9508('0xab')]===-0x1){return _0x423786;}return this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xad'),_0x1a3a7d));};AGIVertices['prototype']['sestektts']=function(_0x36ece0){logger[_0x9508('0x30')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x36ece0[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x36ece0[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20text\x20configured');}var _0x1fb57c='\x22'+_0x36ece0[_0x9508('0x59')]+'\x22';if(this[_0x9508('0x87')](_0x36ece0[_0x9508('0x78')])){_0x1fb57c+=','+_0x36ece0['options'];}var _0x3a066f=this['channel'][_0x9508('0x54')](_0x9508('0xc8'),_0x1fb57c);if(_0x3a066f['result']===-0x1){return _0x3a066f;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xad'),_0x1fb57c));};AGIVertices[_0x9508('0xf')][_0x9508('0xc9')]=function(_0x1ea1b5){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1ea1b5['label']));if(!this[_0x9508('0x87')](_0x1ea1b5[_0x9508('0xb0')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x1fa662=_0x1ea1b5[_0x9508('0xb0')];if(this[_0x9508('0x87')](_0x1ea1b5[_0x9508('0x78')])){_0x1fa662+=','+_0x1ea1b5[_0x9508('0x78')];}var _0x230fdf=this['channel'][_0x9508('0x54')](_0x9508('0xb2'),_0x1fa662);if(_0x230fdf['result']===-0x1){return _0x230fdf;}var _0x1f9e4c=this['getAndSetVariable'](_0x9508('0xb3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1f9e4c[_0x9508('0xab')]===-0x1){return _0x1f9e4c;}var _0x3ca7b4=this[_0x9508('0xa5')](_0x9508('0xb5'),_0x9508('0xca'));if(_0x3ca7b4[_0x9508('0xab')]===-0x1){return _0x3ca7b4;}var _0x2ad943=this['getAndSetVariable'](_0x9508('0xb7'),_0x9508('0xcb'));if(_0x2ad943[_0x9508('0xab')]===-0x1){return _0x2ad943;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xcc'),_0x1fa662));};AGIVertices[_0x9508('0xf')]['sestekasr']=function(_0xfb0e8e){logger['info'](util['format'](_0x9508('0xcd'),_0xfb0e8e[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0xfb0e8e[_0x9508('0xb0')])){return this['channel'][_0x9508('0xac')](_0x9508('0xb1'));}var _0x3e1a1b=_0xfb0e8e[_0x9508('0xb0')];if(this[_0x9508('0x87')](_0xfb0e8e[_0x9508('0x78')])){_0x3e1a1b+=','+_0xfb0e8e[_0x9508('0x78')];}var _0x4aaca8=this['channel'][_0x9508('0x54')]('MRCPRecog',_0x3e1a1b);if(_0x4aaca8[_0x9508('0xab')]===-0x1){return _0x4aaca8;}var _0x4153b8=this[_0x9508('0xa5')](_0x9508('0xb3'),_0x9508('0xce'));if(_0x4153b8[_0x9508('0xab')]===-0x1){return _0x4153b8;}var _0x57ebdb=this[_0x9508('0xa5')](_0x9508('0xb5'),_0x9508('0xcf'));if(_0x57ebdb[_0x9508('0xab')]===-0x1){return _0x57ebdb;}var _0x318779=this[_0x9508('0xa5')](_0x9508('0xb7'),'SESTEK_ASR_INSTANCE');if(_0x318779[_0x9508('0xab')]===-0x1){return _0x318779;}return this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3e1a1b));};AGIVertices[_0x9508('0xf')]['database']=function(_0x6f2407){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xd0'),_0x6f2407[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x6f2407[_0x9508('0xd1')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x6f2407,_0x9508('0xd2'));}var _0x30884b=this[_0x9508('0x19')][_0x9508('0x6f')](this,_0x6f2407['odbc_id']);if(!_0x30884b){return this['channel']['error'](_0x6f2407,_0x9508('0xd3'));}if(!this[_0x9508('0x87')](_0x6f2407['query'])){return this[_0x9508('0xd')]['error'](_0x6f2407,'no\x20query\x20configured');}var _0x514173=_0x6f2407['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0xd4'),_0x514173));var _0x37043b=this['getQueryOdbc']['sync'](this,_0x30884b,_0x514173);this[_0x9508('0x36')]['sync'](this,_0x6f2407,_0x514173);if(!this[_0x9508('0x87')](_0x6f2407['variable_id'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xd5'));}var _0x178218=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x6f2407[_0x9508('0xd6')]);if(!_0x178218){return this[_0x9508('0xd')]['error'](_0x6f2407,'no\x20variable\x20found');}var _0x58c83b=this;_0x37043b[_0x9508('0xd7')](function(_0x5e0fe1,_0x25c003){Object[_0x9508('0xd8')](_0x5e0fe1)[_0x9508('0xd7')](function(_0x2264e7){_0x58c83b[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0xd9'),_0x178218,_0x25c003,_0x2264e7),_0x5e0fe1[_0x2264e7]);});});this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0xda'),_0x178218),_0x37043b[_0x9508('0x9c')]);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xdb'),_0x178218));};AGIVertices[_0x9508('0xf')][_0x9508('0xdc')]=function(_0x18f2cc){logger['debug'](util[_0x9508('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x18f2cc['label']));if(!this[_0x9508('0x87')](_0x18f2cc[_0x9508('0xdd')])){return this['channel'][_0x9508('0x33')](_0x18f2cc,_0x9508('0xde'));}var _0x336272=this[_0x9508('0x1b')][_0x9508('0x6f')](this,_0x18f2cc['sip_id']);if(!_0x336272){return this[_0x9508('0xd')]['error'](_0x18f2cc,_0x9508('0xdf'));}var _0x5e3e51=this[_0x9508('0xd')][_0x9508('0x54')]('DIAL',[util[_0x9508('0x28')](_0x9508('0xe0'),_0x336272),_0x18f2cc['timeout'],_0x18f2cc[_0x9508('0xe1')],_0x18f2cc['url']]);if(_0x5e3e51['result']===-0x1){return _0x5e3e51;}return this['channel'][_0x9508('0xac')](util[_0x9508('0x28')]('Executed\x20command\x20%s',_0x9508('0xe2')));};AGIVertices['prototype'][_0x9508('0xe3')]=function(_0x27562c){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xe4'),_0x27562c[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x27562c['key'])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20key\x20configured');}if(!this[_0x9508('0x87')](_0x27562c['text'])){return this[_0x9508('0xd')]['noop']('no\x20text\x20configured');}this[_0x9508('0xd')]['bot']=!![];this[_0x9508('0x36')](_0x27562c);this[_0x9508('0x40')](_0x27562c[_0x9508('0x59')],'in','','');this['channel']['noop'](util[_0x9508('0x28')]('Trying\x20Dialogflow:\x20%s',_0x27562c[_0x9508('0x59')]));var _0x1a9606=this[_0x9508('0x79')][_0x9508('0x6f')](this,_0x27562c);if(_0x1a9606){for(var _0x4c6d79 in _0x1a9606){if(_0x1a9606[_0x9508('0x97')](_0x4c6d79)){this['channel']['setVariable'](util['format'](_0x9508('0xe5'),_0x4c6d79[_0x9508('0xe6')]()),_0x1a9606[_0x4c6d79]);}}this['createSquareMessage'](_0x1a9606[_0x9508('0xe7')],'out',_0x9508('0xe3'),'');return this['channel']['noop'](util[_0x9508('0x28')](_0x9508('0xe8'),_0x1a9606[_0x9508('0xe7')]));}return this[_0x9508('0xd')][_0x9508('0x33')](_0x27562c,_0x9508('0xe9'));};AGIVertices[_0x9508('0xf')][_0x9508('0xea')]=function(_0x58d201){logger['info'](util[_0x9508('0x28')](_0x9508('0xeb'),_0x58d201[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x7d')])){return this[_0x9508('0xd')]['noop'](_0x9508('0xec'));}if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x7e')])){return this['channel'][_0x9508('0xac')](_0x9508('0xed'));}if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x7f')])){return this[_0x9508('0xd')]['noop'](_0x9508('0xee'));}if(!this['isConfigured'](_0x58d201[_0x9508('0x80')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xef'));}if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xf0')]=!![];this[_0x9508('0x36')](_0x58d201);this[_0x9508('0x40')](_0x58d201[_0x9508('0x59')],'in','','');this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x58d201['text']));var _0x4fd315=this[_0x9508('0x7c')][_0x9508('0x6f')](this,_0x58d201);if(_0x4fd315){for(var _0xa0cf80 in _0x4fd315){if(_0x4fd315[_0x9508('0x97')](_0xa0cf80)){if(_0xa0cf80!=='providerResponse'){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('DIALOGFLOW_%s',_0xa0cf80[_0x9508('0xe6')]()),_0x4fd315[_0xa0cf80]);}}}this['createSquareMessage'](_0x4fd315[_0x9508('0xe7')],_0x9508('0xf1'),'dialogflowV2',_0x4fd315[_0x9508('0xf2')]);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xf3'),_0x4fd315['speech']));}return this[_0x9508('0xd')]['error'](_0x58d201,_0x9508('0xf4'));};AGIVertices['prototype'][_0x9508('0xf5')]=function(_0x18b597){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x18b597[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x18b597[_0x9508('0xf6')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xf7'));}if(!this['isConfigured'](_0x18b597[_0x9508('0xf8')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xf9'));}if(!this[_0x9508('0x87')](_0x18b597[_0x9508('0xfa')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xfb'));}if(!this[_0x9508('0x87')](_0x18b597[_0x9508('0xfc')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xf0')]=!![];this[_0x9508('0x36')](_0x18b597);this['createSquareMessage'](_0x18b597['text'],'in','','');this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xfd'),_0x18b597[_0x9508('0x59')]));var _0x13b61e=this[_0x9508('0x81')][_0x9508('0x6f')](this,_0x18b597);if(_0x13b61e){for(var _0x43cc15 in _0x13b61e){if(_0x13b61e[_0x9508('0x97')](_0x43cc15)){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('SESTEK_NDA_%s',_0x43cc15[_0x9508('0xe6')]()),_0x13b61e[_0x43cc15]);}}this[_0x9508('0x40')](_0x13b61e[_0x9508('0xe7')],_0x9508('0xf1'),_0x9508('0xf5'),'');if(_0x13b61e[_0x9508('0xfe')]){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x13b61e[_0x9508('0xfe')]));var _0x1e4ad2=this[_0x9508('0xd')][_0x9508('0xff')](_0x13b61e[_0x9508('0xfe')]);try{fs[_0x9508('0x100')](_0x13b61e[_0x9508('0xfe')]+'.wav');}catch(_0x2ba82a){logger[_0x9508('0x33')](_0x2ba82a);}return _0x1e4ad2;}else{return this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x101'),_0x13b61e['speech']));}}return this['channel'][_0x9508('0x33')](_0x18b597,_0x9508('0x102'));};AGIVertices[_0x9508('0xf')][_0x9508('0x103')]=function(_0x16498b){logger[_0x9508('0x30')](util['format'](_0x9508('0x104'),_0x16498b[_0x9508('0xa9')]));return this['channel']['noop'](_0x9508('0x103'));};AGIVertices[_0x9508('0xf')][_0x9508('0x105')]=function(_0x327ecd){logger['info'](util[_0x9508('0x28')](_0x9508('0x106'),_0x327ecd[_0x9508('0xa9')]));var _0x59a048='';if(_0x327ecd[_0x9508('0x107')]){if(!this[_0x9508('0x87')](_0x327ecd[_0x9508('0x107')])){return this[_0x9508('0xd')]['error'](_0x327ecd,'no\x20trunk\x20selected');}else{var _0x1af797=parseInt(_0x327ecd[_0x9508('0x107')],0xa);if(isNaN(_0x1af797)){_0x59a048=_0x327ecd[_0x9508('0x107')];}else{_0x59a048=this[_0x9508('0x1c')]['sync'](this,_0x327ecd[_0x9508('0x107')]);if(!_0x59a048){return this[_0x9508('0xd')][_0x9508('0x33')](_0x327ecd,_0x9508('0x108'));}}}}else if(_0x327ecd[_0x9508('0x109')]){_0x59a048=_0x327ecd[_0x9508('0x109')];}else{return this[_0x9508('0xd')]['error'](_0x327ecd,_0x9508('0x10a'));}var _0x315832=this[_0x9508('0xd')]['exec']('DIAL',[util[_0x9508('0x28')](_0x9508('0x10b'),_0x59a048,_0x327ecd['phone']),_0x327ecd[_0x9508('0x65')],_0x327ecd['opts'],_0x327ecd[_0x9508('0x63')]]);if(_0x315832[_0x9508('0xab')]===-0x1){return _0x315832;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x10c'),_0x9508('0xe2')));};AGIVertices[_0x9508('0xf')]['finally']=function(_0xfaa587){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x10d'),_0xfaa587[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x10e'));};AGIVertices[_0x9508('0xf')]['getdigits']=function(_0x4f0416){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4f0416['label']));if(_0x4f0416[_0x9508('0xa6')]===0x0){return this[_0x9508('0xa7')](_0x4f0416);}_0x4f0416['retry']-=0x1;if(!this['isConfigured'](_0x4f0416[_0x9508('0x10f')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4f0416,_0x9508('0x110'));}var _0x22861c=this['getSound'][_0x9508('0x6f')](this,_0x4f0416[_0x9508('0x10f')]);if(!_0x22861c){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4f0416,_0x9508('0x111'));}if(!this[_0x9508('0x87')](_0x4f0416['variable_id'])){return this[_0x9508('0xd')][_0x9508('0x33')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x12d9b1=this['channel'][_0x9508('0x112')](_0x22861c,_0x4f0416['response'],_0x4f0416[_0x9508('0x113')]);var _0x517c68=_0x12d9b1['result']?_0x12d9b1['result'][_0x9508('0x4a')]():'';logger[_0x9508('0x30')]('test',JSON[_0x9508('0x74')](_0x12d9b1));if(_0x12d9b1['result']===-0x1){this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f0416,_0x517c68);return _0x12d9b1;}else if(_0x12d9b1[_0x9508('0xa3')]==='timeout'){_0x12d9b1[_0x9508('0xab')]=_0x517c68['length']>=parseInt(_0x4f0416['mindigit'])?'x':'i';}else{_0x12d9b1[_0x9508('0xab')]=_0x517c68[_0x9508('0x9c')]>=parseInt(_0x4f0416[_0x9508('0x114')])&&_0x517c68[_0x9508('0x9c')]<=parseInt(_0x4f0416[_0x9508('0x113')])?'x':'i';}var _0x5871b9=this['getVariable'][_0x9508('0x6f')](this,_0x4f0416[_0x9508('0xd6')]);if(!_0x5871b9){return this['channel'][_0x9508('0x33')](_0x4f0416,_0x9508('0x115'));}this[_0x9508('0xd')]['setVariable'](_0x5871b9,_0x517c68);if(this[_0x9508('0x87')](_0x4f0416[_0x9508('0x116')])){var _0x4e9dc4=parseInt(_0x4f0416[_0x9508('0x116')],0xa);var _0x4059cb=rs[_0x9508('0x117')]({'charset':'*','length':_0x4e9dc4});var _0x30a70f=_0x517c68[_0x9508('0x9c')];if(_0x30a70f>0x0){if(_0x30a70f>_0x4e9dc4){this['createSquareDetailsReport']['sync'](this,_0x4f0416,_0x4f0416[_0x9508('0x118')]===_0x9508('0x119')?_0x4059cb+_0x517c68[_0x9508('0x11a')](_0x4e9dc4):_0x517c68[_0x9508('0x11a')](0x0,_0x30a70f-_0x4e9dc4)+_0x4059cb);}else{this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f0416,rs['generate']({'charset':'*','length':_0x30a70f}));}}else{this[_0x9508('0x36')]['sync'](this,_0x4f0416,'');}}else{this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f0416,_0x517c68);}return _0x12d9b1;};AGIVertices[_0x9508('0xf')][_0x9508('0x11b')]=function(_0x58cf1c){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x58cf1c['label']));return this[_0x9508('0xc')](_0x58cf1c);};AGIVertices[_0x9508('0xf')][_0x9508('0x11c')]=function(_0x48d589){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x11d'),_0x48d589[_0x9508('0xa9')]));this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x48d589,_0x48d589['goalname']);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('GOAL\x20%s',_0x48d589['goalname']));};AGIVertices[_0x9508('0xf')][_0x9508('0x11e')]=function(_0x211f7e){logger[_0x9508('0x30')](util[_0x9508('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x211f7e['label']));if(!this[_0x9508('0x87')](_0x211f7e[_0x9508('0x8a')])||!this[_0x9508('0x87')](_0x211f7e['aws_secret_access_key'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x11f'));}if(!this['isConfigured'](_0x211f7e[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this['channel'][_0x9508('0xac')](util['format'](_0x9508('0x120'),_0x211f7e[_0x9508('0x59')]));var _0xf7cad5=this[_0x9508('0x89')][_0x9508('0x6f')](this,_0x211f7e);if(_0xf7cad5){this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x121'),_0xf7cad5));var _0x1d3059=this[_0x9508('0xd')][_0x9508('0xff')](_0xf7cad5);try{fs['unlink'](_0xf7cad5+'.wav');}catch(_0x5db5e6){logger[_0x9508('0x33')](_0x5db5e6);}return _0x1d3059;}return this[_0x9508('0xd')][_0x9508('0x33')](_0x211f7e,_0x9508('0x122'));};AGIVertices['prototype'][_0x9508('0x123')]=function(_0x2a5e13){logger['info'](util[_0x9508('0x28')](_0x9508('0x124'),_0x2a5e13['label']));if(!this[_0x9508('0x87')](_0x2a5e13['aws_access_key_id'])||!this[_0x9508('0x87')](_0x2a5e13[_0x9508('0x8b')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x11f'));}if(!this['isConfigured'](_0x2a5e13[_0x9508('0x90')])){return this[_0x9508('0xd')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x9508('0x87')](_0x2a5e13[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20text\x20configured');}this[_0x9508('0xd')][_0x9508('0xf0')]=!![];this[_0x9508('0x36')](_0x2a5e13);this[_0x9508('0x40')](_0x2a5e13[_0x9508('0x59')],'in','','');this['channel']['noop'](util[_0x9508('0x28')](_0x9508('0x125'),_0x2a5e13['text']));var _0x46620f=this[_0x9508('0x8e')][_0x9508('0x6f')](this,_0x2a5e13);if(_0x46620f){for(var _0x4f5418 in _0x46620f){if(_0x46620f[_0x9508('0x97')](_0x4f5418)&&_[_0x9508('0x9d')](_0x46620f[_0x4f5418])){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('AWS_LEX_%s',_0x4f5418['toUpperCase']()),_0x46620f[_0x4f5418]);}}if(_['isNil'](_0x46620f[_0x9508('0x77')])){return this['channel'][_0x9508('0xac')](_0x9508('0x126'));}else{this[_0x9508('0x40')](_0x46620f[_0x9508('0x77')],_0x9508('0xf1'),_0x9508('0x127'),'');return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x128'),_0x46620f[_0x9508('0x77')]));}}return this[_0x9508('0xd')][_0x9508('0x33')](_0x2a5e13,_0x9508('0x129'));};AGIVertices['prototype'][_0x9508('0x12a')]=function(_0x3f3715){logger[_0x9508('0x30')](util['format'](_0x9508('0x12b'),_0x3f3715['label'],_0x3f3715[_0x9508('0x65')]));if(!this[_0x9508('0x87')](_0x3f3715[_0x9508('0x7a')])){return this['channel'][_0x9508('0xac')]('no\x20key\x20configured');}var _0x91599b=_0x9508('0x12c');var _0x3e9ecf=util[_0x9508('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x9508('0x117')](0x4));var _0x180387=util[_0x9508('0x28')]('%s.%s',_0x3e9ecf,_0x91599b);var _0x514933=!![];if(_0x3f3715[_0x9508('0x12d')]==='NOBEEP'){_0x514933=![];}var _0x3e1b3b=this[_0x9508('0xd')][_0x9508('0x12e')](_0x3e9ecf,_0x91599b,_0x3f3715[_0x9508('0x12f')],_0x3f3715[_0x9508('0x65')],undefined,_0x514933);if(_0x3e1b3b[_0x9508('0xab')]!==-0x1){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x130'),_0x180387));var _0x66a2ec=this[_0x9508('0x91')][_0x9508('0x6f')](this,_0x3f3715,_0x180387);if(_0x66a2ec){for(var _0x6c43be in _0x66a2ec){if(_0x66a2ec[_0x9508('0x97')](_0x6c43be)){this['channel'][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x131'),_0x6c43be[_0x9508('0xe6')]()),_0x66a2ec[_0x6c43be]);}}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x9508('0x74')](_0x66a2ec)));}}return _0x3e1b3b;};AGIVertices[_0x9508('0xf')][_0x9508('0x132')]=function(_0x124303){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x124303[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x124303['appid'])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x124303[_0x9508('0x94')])){return this[_0x9508('0xd')]['noop'](_0x9508('0x133'));}var _0x220e1f='wav';var _0x946f0f=util[_0x9508('0x28')](_0x9508('0x134'),FILES_PATH,rs['generate'](0x4));var _0x4c620c=util[_0x9508('0x28')](_0x9508('0x9f'),_0x946f0f,_0x220e1f);var _0x60c722=!![];if(_0x124303[_0x9508('0x12d')]===_0x9508('0x135')){_0x60c722=![];}var _0x4a1f78=this[_0x9508('0xd')][_0x9508('0x12e')](_0x946f0f,_0x220e1f,_0x124303[_0x9508('0x12f')],_0x124303[_0x9508('0x65')],undefined,_0x60c722);if(_0x4a1f78[_0x9508('0xab')]!==-0x1){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x136'),_0x4c620c));var _0xa8ae21=this['tildeASR']['sync'](this,_0x124303,_0x4c620c);if(_0xa8ae21){for(var _0x541372 in _0xa8ae21){if(_0xa8ae21['hasOwnProperty'](_0x541372)){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x137'),_0x541372[_0x9508('0xe6')]()),_0xa8ae21[_0x541372]);}}return this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x138'),JSON['stringify'](_0xa8ae21)));}}return _0x4a1f78;};AGIVertices['prototype'][_0x9508('0x139')]=function(_0x36afbb){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x13a'),_0x36afbb['label']));return this[_0x9508('0xd')]['continueAt'](_0x36afbb['context'],_0x36afbb[_0x9508('0x3d')],_0x36afbb[_0x9508('0x3e')]);};AGIVertices['prototype'][_0x9508('0x13b')]=function(_0x18404e){logger[_0x9508('0x30')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x18404e[_0x9508('0xa9')]));if(!this['isConfigured'](_0x18404e[_0x9508('0x13c')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x18404e,_0x9508('0x13d'));}try{var _0x32acf7=eval(_0x18404e[_0x9508('0x13c')])?_0x9508('0x13e'):_0x9508('0x13f');this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x140'),_0x18404e['condition'],_0x32acf7));return{'code':0xc8,'result':_0x32acf7};}catch(_0x4bc03d){return{'code':0xc8,'result':_0x9508('0x13f')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x141')]=function(_0x4b9806){logger['info'](util[_0x9508('0x28')](_0x9508('0x142'),_0x4b9806[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x4b9806[_0x9508('0x143')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4b9806,_0x9508('0x144'));}var _0x5e14d2=this[_0x9508('0x145')][_0x9508('0x6f')](this,_0x4b9806['interval_id']);if(!_0x5e14d2){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4b9806,'no\x20intervals\x20found');}for(var _0x786bdf=0x0;_0x786bdf<_0x5e14d2[_0x9508('0x9c')];_0x786bdf+=0x1){var _0x7db152=this[_0x9508('0xd')][_0x9508('0x10')](util[_0x9508('0x28')](_0x9508('0x146'),_0x5e14d2[_0x786bdf]));if(_0x7db152[_0x9508('0xab')]===-0x1){return _0x7db152;}logger[_0x9508('0x30')](util[_0x9508('0x28')]('IFTIME\x20%s\x20%s',_0x5e14d2[_0x786bdf],_0x7db152[_0x9508('0xa3')]));if(_0x7db152[_0x9508('0xa3')]===_0x9508('0x13e')){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x147'),_0x5e14d2[_0x786bdf],'true'));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x147'),_0x5e14d2[_0x786bdf],_0x9508('0x13e')));return{'code':0xc8,'result':_0x9508('0x13e')};}else{logger['info'](util['format'](_0x9508('0x147'),_0x5e14d2[_0x786bdf],_0x9508('0x13f')));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x147'),_0x5e14d2[_0x786bdf],_0x9508('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x9508('0x148')]=function(_0x455508){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x149'),_0x455508['label']));return this[_0x9508('0xd')]['hangup']();};AGIVertices['prototype'][_0x9508('0x14a')]=function(_0x1ca3e5){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x14b'),_0x1ca3e5[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x1ca3e5[_0x9508('0x7a')])){return this['channel'][_0x9508('0xac')]('no\x20key\x20configured');}var _0x15b8d0='wav';var _0x42e701=util[_0x9508('0x28')](_0x9508('0x134'),FILES_PATH,rs[_0x9508('0x117')](0x4));var _0x8cdc4a=util[_0x9508('0x28')]('%s.%s',_0x42e701,_0x15b8d0);var _0x21a922=!![];if(_0x1ca3e5[_0x9508('0x12d')]===_0x9508('0x135')){_0x21a922=![];}var _0x38d7ec=this[_0x9508('0xd')][_0x9508('0x12e')](_0x42e701,_0x15b8d0,_0x1ca3e5['intKey'],_0x1ca3e5[_0x9508('0x65')],undefined,_0x21a922);if(_0x38d7ec[_0x9508('0xab')]!==-0x1){this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x14c'),_0x8cdc4a));var _0x3770ca=this[_0x9508('0x85')][_0x9508('0x6f')](this,_0x1ca3e5,_0x8cdc4a);if(_0x3770ca){for(var _0x6584b9 in _0x3770ca){if(_0x3770ca[_0x9508('0x97')](_0x6584b9)){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x14d'),_0x6584b9[_0x9508('0xe6')]()),_0x3770ca[_0x6584b9]);}}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0x9508('0x74')](_0x3770ca)));}}return _0x38d7ec;};AGIVertices[_0x9508('0xf')][_0x9508('0x14e')]=function(_0x16bd55){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x14f'),_0x16bd55['label']));if(!this[_0x9508('0x87')](_0x16bd55[_0x9508('0x7a')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x150'));}if(!this[_0x9508('0x87')](_0x16bd55['text'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x16bd55[_0x9508('0x59')]));var _0x189dac=this['ispeechTTS'][_0x9508('0x6f')](this,_0x16bd55);if(_0x189dac){this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x14c'),_0x189dac));var _0x4ab60e=this['channel'][_0x9508('0xff')](_0x189dac,_0x16bd55[_0x9508('0x12f')]);try{fs[_0x9508('0x100')](_0x189dac+_0x9508('0x151'));}catch(_0x4698ea){logger[_0x9508('0x33')](_0x4698ea);}return _0x4ab60e;}return this[_0x9508('0xd')][_0x9508('0x33')](_0x16bd55,_0x9508('0x152'));};AGIVertices[_0x9508('0xf')][_0x9508('0x153')]=function(_0x3b9af2){logger[_0x9508('0x30')](util['format'](_0x9508('0x154'),_0x3b9af2[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x3b9af2[_0x9508('0x155')])){return this[_0x9508('0xd')]['error'](_0x3b9af2,_0x9508('0x156'));}logger[_0x9508('0x30')](util[_0x9508('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9508('0xd')]['callerid'],_0x3b9af2[_0x9508('0x155')]));var _0x546c68=this[_0x9508('0x52')]['sync'](this,_0x3b9af2['findBy']);if(_0x546c68){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')]['callerid'],_0x3b9af2['findBy']));this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')]['callerid'],_0x3b9af2['findBy']));return{'code':0xc8,'result':_0x9508('0x158')};}else{logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x159'),this['channel']['callerid'],_0x3b9af2[_0x9508('0x155')]));this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0x159'),this['channel'][_0x9508('0x3a')],_0x3b9af2['findBy']));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x15b')]=function(_0x1fa941){logger['info'](util[_0x9508('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1fa941[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x1fa941[_0x9508('0x155')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x1fa941,'no\x20find\x20by\x20configured');}logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x15c'),this[_0x9508('0xd')]['callerid'],_0x1fa941[_0x9508('0x155')]));var _0x5e6175=this[_0x9508('0x50')][_0x9508('0x6f')](this,_0x1fa941['findBy']);if(_0x5e6175){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x157'),this['channel']['callerid'],_0x1fa941['findBy']));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')]['callerid'],_0x1fa941[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x158')};}else{logger[_0x9508('0x30')](util['format'](_0x9508('0x159'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x1fa941[_0x9508('0x155')]));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x159'),this['channel'][_0x9508('0x3a')],_0x1fa941['findBy']));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices['prototype'][_0x9508('0x15d')]=function(_0x54250d){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x15e'),_0x54250d['label']));if(!this[_0x9508('0x87')](_0x54250d['operation'])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x54250d,_0x9508('0x15f'));}this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x160'),_0x54250d[_0x9508('0x161')]));var _0x3e7a4a=eval(_0x54250d['operation']);if(!this[_0x9508('0x87')](_0x54250d['variable_id'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xd5'));}var _0x2db146=this['getVariable'][_0x9508('0x6f')](this,_0x54250d['variable_id']);if(!_0x2db146){return this[_0x9508('0xd')]['error'](_0x54250d,_0x9508('0x115'));}if(_[_0x9508('0x9b')](_0x3e7a4a)){var _0x36ae5a=this;_0x3e7a4a['forEach'](function(_0x3dc2bf,_0x1a24f8){_0x36ae5a['channel'][_0x9508('0xa0')](util[_0x9508('0x28')]('%s[%s]',_0x2db146,_0x1a24f8),_0x3dc2bf);});return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x162'),_0x2db146));}else{return this['channel']['setVariable'](_0x2db146,_0x3e7a4a);}};AGIVertices['prototype'][_0x9508('0xb')]=function(_0x3639a8){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x163'),_0x3639a8[_0x9508('0xa9')]));if(_0x3639a8[_0x9508('0xa6')]===0x0){return this['maxRetry'](_0x3639a8);}_0x3639a8[_0x9508('0xa6')]-=0x1;if(!this['isConfigured'](_0x3639a8['file_id'])){return this[_0x9508('0xd')]['error'](_0x3639a8,_0x9508('0x110'));}var _0x5925ed=this[_0x9508('0x164')]['sync'](this,_0x3639a8['file_id']);if(!_0x5925ed){return this[_0x9508('0xd')][_0x9508('0x33')](_0x3639a8,_0x9508('0x111'));}var _0x449173=this[_0x9508('0xd')][_0x9508('0x112')](_0x5925ed,_0x3639a8[_0x9508('0x165')],_0x3639a8[_0x9508('0x166')]);var _0x36b5db=_0x449173[_0x9508('0xab')];if(_0x449173[_0x9508('0xab')]===-0x1){this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x3639a8,'-1');return _0x449173;}else if(_0x449173[_0x9508('0xa3')]==='timeout'){_0x449173['result']=_0x449173[_0x9508('0xab')][_0x9508('0x9c')]>0x0?_0x449173[_0x9508('0xab')]:'t';}else if(_[_0x9508('0x42')](_0x449173[_0x9508('0xab')])){_0x449173[_0x9508('0xab')]='#';_0x36b5db='#';}if(!this[_0x9508('0x87')](_0x3639a8[_0x9508('0xd6')])){this['channel'][_0x9508('0xac')](_0x9508('0xd5'));}else{var _0xacb7bd=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x3639a8[_0x9508('0xd6')]);if(!_0xacb7bd){return this[_0x9508('0xd')][_0x9508('0x33')](_0x3639a8,_0x9508('0x115'));}this['channel'][_0x9508('0xa0')](_0xacb7bd,_0x36b5db);}this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x3639a8,_0x36b5db);return _0x449173;};AGIVertices['prototype'][_0x9508('0xac')]=function(_0x4487f6){logger[_0x9508('0x30')](util['format'](_0x9508('0x167'),_0x4487f6['label']));return this[_0x9508('0xd')][_0x9508('0xac')](_0x4487f6['output']||_0x4487f6[_0x9508('0xa9')]);};AGIVertices[_0x9508('0xf')]['pause']=function(_0x5580ea){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x168'),_0x5580ea[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x5580ea[_0x9508('0x155')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x5580ea,_0x9508('0x156'));}logger['info'](util['format'](_0x9508('0x15c'),this[_0x9508('0xd')]['callerid'],_0x5580ea['findBy']));var _0xebf2ed=this[_0x9508('0x4c')][_0x9508('0x6f')](this,_0x5580ea['pause_id']);var _0x3235c1=this[_0x9508('0x4f')]['sync'](this,_0x5580ea[_0x9508('0x155')],_0xebf2ed);if(_0x3235c1){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x5580ea[_0x9508('0x155')]));this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x5580ea[_0x9508('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x9508('0x159'),this[_0x9508('0xd')]['callerid'],_0x5580ea['findBy']));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x5580ea[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x169')]=function(_0x155f5e){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x16a'),_0x155f5e[_0x9508('0xa9')]));if(!this['isConfigured'](_0x155f5e[_0x9508('0x10f')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x155f5e,_0x9508('0x110'));}var _0x4a8ef8=this[_0x9508('0x164')][_0x9508('0x6f')](this,_0x155f5e[_0x9508('0x10f')]);if(!_0x4a8ef8){return this[_0x9508('0xd')][_0x9508('0x33')](_0x155f5e,'no\x20file\x20audio\x20found');}var _0x1c7b32=this[_0x9508('0xd')][_0x9508('0x54')]('PLAYBACK',[_0x4a8ef8,_0x155f5e[_0x9508('0xe1')]]);if(_0x1c7b32[_0x9508('0xab')]===-0x1){return _0x1c7b32;}return this['channel'][_0x9508('0xac')](util['format']('Executed\x20command\x20%s\x20%s',_0x9508('0x16b'),_0x4a8ef8));};AGIVertices[_0x9508('0xf')][_0x9508('0x16c')]=function(_0x33c3ff){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x33c3ff[_0x9508('0xa9')]));if(!this['isConfigured'](_0x33c3ff['queue_id'])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x33c3ff,'no\x20queue\x20selected');}var _0x1a8c8e='';var _0x4b582f=parseInt(_0x33c3ff[_0x9508('0x16d')],0xa);if(isNaN(_0x4b582f)){_0x1a8c8e=_0x33c3ff[_0x9508('0x16d')];}else{_0x1a8c8e=this[_0x9508('0x15')][_0x9508('0x6f')](this,_0x33c3ff[_0x9508('0x16d')]);if(!_0x1a8c8e){return this['channel']['error'](_0x33c3ff,_0x9508('0x16e'));}}var _0x2351e0='';if(this[_0x9508('0x87')](_0x33c3ff[_0x9508('0x10f')])){var _0x402567=this[_0x9508('0x164')]['sync'](this,_0x33c3ff[_0x9508('0x10f')]);if(_0x402567){_0x2351e0=_0x402567;}}this[_0x9508('0x36')]['sync'](this,_0x33c3ff,_0x1a8c8e);if(_0x33c3ff[_0x9508('0xe1')][_0x9508('0x16f')]('x')<0x0){_0x33c3ff[_0x9508('0xe1')]+='x';}if(_0x33c3ff[_0x9508('0xe1')]['indexOf']('X')<0x0){_0x33c3ff[_0x9508('0xe1')]+='X';}this[_0x9508('0xd')]['setVariable'](_0x9508('0x170'),_0x1a8c8e?_0x1a8c8e[_0x9508('0x171')]():'');var _0x40b50c=this[_0x9508('0xd')][_0x9508('0x54')](_0x9508('0x172'),[_0x1a8c8e,_0x33c3ff[_0x9508('0xe1')],_0x33c3ff[_0x9508('0x63')],_0x2351e0,_0x33c3ff[_0x9508('0x65')],_0x33c3ff[_0x9508('0x7')],_0x33c3ff[_0x9508('0x173')],_0x33c3ff[_0x9508('0x174')],'',_0x33c3ff[_0x9508('0x175')]]);if(_0x40b50c['result']===-0x1){return _0x40b50c;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xc4'),_0x9508('0x172'),_0x1a8c8e));};AGIVertices[_0x9508('0xf')][_0x9508('0x176')]=function(_0x59afdf){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x177'),_0x59afdf['label']));var _0x38c7ff=_0x59afdf['recordingFormat']||_0x9508('0x12c');var _0x230200=util[_0x9508('0x28')](_0x9508('0x178'),this[_0x9508('0xd')][_0x9508('0x37')],rs[_0x9508('0x117')](0x5));var _0x2ea77c=util[_0x9508('0x28')](_0x9508('0x179'),FILES_PATH,_0x230200,_0x38c7ff);var _0x7ef314=util['format'](_0x9508('0x134'),FILES_PATH,_0x230200);this['createSquareRecording']['sync'](this,_0x59afdf,_0x230200,_0x2ea77c);this['channel'][_0x9508('0xa0')](_0x9508('0x17a'),_0x230200);logger['info'](_0x9508('0x17b'),_0x7ef314,_0x38c7ff,_0x59afdf[_0x9508('0x17c')],_0x59afdf[_0x9508('0x65')]);return this['channel'][_0x9508('0x12e')](_0x7ef314,_0x38c7ff,_0x59afdf[_0x9508('0x17c')],_0x59afdf[_0x9508('0x65')],undefined,!![]);};AGIVertices['prototype'][_0x9508('0x17d')]=function(_0x354fb3){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x354fb3[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x354fb3[_0x9508('0x63')])){return this['channel'][_0x9508('0xac')](_0x9508('0x17e'));}var _0x39deef=this[_0x9508('0x62')][_0x9508('0x6f')](this,_0x354fb3);logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x17f'),util['inspect'](_0x39deef,{'showHidden':![],'depth':null})));if(!this[_0x9508('0x87')](_0x354fb3[_0x9508('0xd6')])){return this[_0x9508('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x500406=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x354fb3[_0x9508('0xd6')]);if(!_0x500406){return this[_0x9508('0xd')][_0x9508('0x33')](_0x354fb3,_0x9508('0x115'));}this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x180'),_0x500406),_0x39deef[_0x9508('0x75')]?_0x39deef[_0x9508('0x75')]:_0x9508('0x181'));this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('%s_STATUS_MESSAGE',_0x500406),_0x39deef[_0x9508('0x76')]?_0x39deef['statusMessage']:'OK');if(_0x39deef[_0x9508('0x6a')]){try{this['saveRestApiResult'](_0x39deef[_0x9508('0x6a')],_0x500406);}catch(_0x1da6be){logger[_0x9508('0x33')](util['format'](_0x9508('0x182'),_0x500406));}}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xdb'),_0x500406));};AGIVertices[_0x9508('0xf')][_0x9508('0x183')]=function(_0x2c2f09){logger[_0x9508('0x30')](util['format'](_0x9508('0x184'),_0x2c2f09[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0x185')](_0x2c2f09[_0x9508('0x186')][_0x9508('0x55')](/\s+/g,''),_0x2c2f09[_0x9508('0x17c')]);};AGIVertices[_0x9508('0xf')][_0x9508('0x187')]=function(_0x3efeeb){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x188'),_0x3efeeb[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0x189')](_0x3efeeb['number'][_0x9508('0x55')](/\s+/g,''),_0x3efeeb[_0x9508('0x17c')]);};AGIVertices[_0x9508('0xf')][_0x9508('0x18a')]=function(_0x3d6c3e){logger[_0x9508('0x30')](util['format'](_0x9508('0x18b'),_0x3d6c3e[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0x18c')](_0x3d6c3e[_0x9508('0x59')],_0x3d6c3e['escape_digits']);};AGIVertices[_0x9508('0xf')][_0x9508('0x18d')]=function(_0x2e0a23){logger['info'](util[_0x9508('0x28')](_0x9508('0x18e'),_0x2e0a23['label']));if(!this[_0x9508('0x87')](_0x2e0a23[_0x9508('0x18f')])){return this['channel'][_0x9508('0xac')]('no\x20mail\x20account\x20configured');}var _0x35d344=this[_0x9508('0x20')][_0x9508('0x6f')](this,_0x2e0a23['account_id']);if(!_0x35d344||!_0x35d344[_0x9508('0x190')]){return this['channel'][_0x9508('0x33')](_0x2e0a23,_0x9508('0x191'));}var _0x325e75={'from':util[_0x9508('0x28')](_0x9508('0x192'),_0x35d344['name'],_0x35d344[_0x9508('0x193')]||_0x35d344[_0x9508('0x190')][_0x9508('0x194')]),'to':_0x2e0a23['to']||'','cc':_0x2e0a23['cc']||'','bcc':_0x2e0a23['bcc']||'','subject':_0x2e0a23[_0x9508('0x195')],'html':_0x2e0a23[_0x9508('0x59')],'text':_0x2e0a23[_0x9508('0x59')]};if(this[_0x9508('0x87')](_0x2e0a23['template_id'])){}logger['debug'](_0x9508('0x196'),JSON[_0x9508('0x74')](_0x325e75));this['createSquareDetailsReport']['sync'](this,_0x2e0a23,_0x2e0a23[_0x9508('0x18f')]);this['channel'][_0x9508('0xac')](util[_0x9508('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x35d344['name']));this[_0x9508('0x22')]['sync'](this,_0x35d344[_0x9508('0x197')],_0x325e75);return this['channel'][_0x9508('0xac')](_0x9508('0x198'));};AGIVertices[_0x9508('0xf')][_0x9508('0x199')]=function(_0x511b55){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x19a'),_0x511b55['label']));return this[_0x9508('0xd')]['noop'](_0x9508('0x19b'));};AGIVertices[_0x9508('0xf')][_0x9508('0x19c')]=function(_0x49e69f){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x19d'),_0x49e69f[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x49e69f[_0x9508('0x19e')])){return this['channel'][_0x9508('0xac')](_0x9508('0x19f'));}var _0x2d6b6d=this[_0x9508('0x34')][_0x9508('0x6f')](this,_0x49e69f[_0x9508('0x19e')]);if(!_0x2d6b6d){return this[_0x9508('0xd')][_0x9508('0x33')](_0x49e69f,_0x9508('0x1a0'));}var _0x4aa0a7={'body':_0x49e69f[_0x9508('0x1a1')],'phone':_0x49e69f['to']||'','SmsAccountId':_0x2d6b6d['id']};logger['debug'](_0x9508('0x1a2'),JSON['stringify'](_0x4aa0a7));this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x49e69f,_0x49e69f[_0x9508('0x19e')]);this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1a3'),_0x2d6b6d[_0x9508('0x13')]));this[_0x9508('0x35')][_0x9508('0x6f')](this,_0x4aa0a7);return this[_0x9508('0xd')][_0x9508('0xac')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x9508('0x1a4')]=function(_0x5a45fd){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1a5'),_0x5a45fd[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x5a45fd[_0x9508('0xd6')])){return this['channel'][_0x9508('0x33')](_0x5a45fd,'no\x20variable\x20selected');}var _0x45d9fc=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x5a45fd[_0x9508('0xd6')]);if(!_0x45d9fc){return this[_0x9508('0xd')][_0x9508('0x33')](_0x5a45fd,'no\x20variable\x20found');}return this[_0x9508('0xd')][_0x9508('0xa0')](_0x45d9fc,_0x5a45fd[_0x9508('0x1a6')]);};AGIVertices[_0x9508('0xf')][_0x9508('0x1a7')]=function(_0x557984){logger[_0x9508('0x30')](util['format'](_0x9508('0x1a8'),_0x557984[_0x9508('0xa9')]));this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x1a9'));var _0x5ec6ff=this[_0x9508('0xd')][_0x9508('0x10')](_0x9508('0x1aa'));if(!_['isEmpty'](_0x5ec6ff['extra'])){this[_0x9508('0xd')][_0x9508('0x37')]=_0x5ec6ff[_0x9508('0xa3')];}if(_0x557984[_0x9508('0xbb')]===_0x9508('0x1ab')){this['channel'][_0x9508('0xac')](_0x9508('0x1ac'));return this[_0x9508('0xd')][_0x9508('0xbb')]();}return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x1ad'));};AGIVertices[_0x9508('0xf')][_0x9508('0x1ae')]=function(_0x378ba7){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1af'),_0x378ba7[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x378ba7['project_id'])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x378ba7,'no\x20subproject\x20selected');}var _0x4c372d=this[_0x9508('0x17')]['sync'](this,_0x378ba7[_0x9508('0x1b0')]);if(!this[_0x9508('0x87')](_0x4c372d)){return this[_0x9508('0xd')]['error'](_0x378ba7,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x378ba7[_0x9508('0x1b0')]));}if(_0x4c372d===this[_0x9508('0xd')][_0x9508('0x39')]){return this[_0x9508('0xd')][_0x9508('0x33')](_0x378ba7,_0x9508('0x1b1'));}this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x378ba7,_0x4c372d);var _0x2924b8=this['channel']['exec']('AGI',util[_0x9508('0x28')](_0x9508('0x1b2'),config[_0x9508('0x7')][_0x9508('0x1b3')]||_0x9508('0x1b4'),_0x4c372d,this[_0x9508('0xd')][_0x9508('0x39')]));if(_0x2924b8['result']===-0x1){return _0x2924b8;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('Executed\x20command\x20%s\x20%s','AGI',_0x4c372d));};AGIVertices[_0x9508('0xf')][_0x9508('0x1b5')]=function(_0x4f8b44){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4f8b44[_0x9508('0xa9')]));var _0x27f03c=this[_0x9508('0x53')][_0x9508('0x6f')](this,_0x4f8b44['command']);this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f8b44,_0x4f8b44[_0x9508('0xba')]);if(this['isConfigured'](_0x4f8b44['variable_id'])){var _0x8d34e=this[_0x9508('0x10')]['sync'](this,_0x4f8b44[_0x9508('0xd6')]);if(_0x8d34e){this[_0x9508('0xd')]['setVariable'](_0x8d34e,_0x27f03c);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4f8b44['command'],_0x8d34e));}}return this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x1b6'),_0x4f8b44[_0x9508('0xba')]));};AGIVertices[_0x9508('0xf')][_0x9508('0x1b7')]=function(_0x420550){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1b8'),_0x420550[_0x9508('0xa9')]));_0x420550[_0x9508('0x59')]=_0x420550['text'][_0x9508('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x420550[_0x9508('0x57')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x1b9'));}if(!this[_0x9508('0x87')](_0x420550[_0x9508('0x59')])){return this['channel'][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1ba'),_0x420550['text']));var _0x250d2e=this[_0x9508('0x56')][_0x9508('0x6f')](this,_0x420550);if(_0x250d2e){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1bb'),_0x250d2e));var _0xf486a1=this['channel']['streamFile'](_0x250d2e);try{fs[_0x9508('0x100')](_0x250d2e+_0x9508('0x151'));}catch(_0x181408){logger['error'](_0x181408);}return _0xf486a1;}return this[_0x9508('0xd')]['error'](_0x420550,_0x9508('0x1bc'));};AGIVertices[_0x9508('0xf')][_0x9508('0x1bd')]=function(_0x1c6a40){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1be'),_0x1c6a40[_0x9508('0xa9')]));_0x1c6a40['text']=_0x1c6a40[_0x9508('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9508('0x87')](_0x1c6a40[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x1c6a40[_0x9508('0x59')]));var _0x357dab=this[_0x9508('0x60')][_0x9508('0x6f')](this,_0x1c6a40);if(_0x357dab){this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1bf'),_0x357dab));var _0x3d43b8=this['channel']['streamFile'](_0x357dab);try{fs[_0x9508('0x100')](_0x357dab+_0x9508('0x151'));}catch(_0x22fba6){logger['error'](_0x22fba6);}return _0x3d43b8;}return this['channel'][_0x9508('0x33')](_0x1c6a40,_0x9508('0x1c0'));};AGIVertices[_0x9508('0xf')][_0x9508('0x1c1')]=function(_0x2c9dc6){logger['info'](util[_0x9508('0x28')](_0x9508('0x1c2'),_0x2c9dc6[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x2c9dc6[_0x9508('0x155')])){return this[_0x9508('0xd')]['error'](_0x2c9dc6,_0x9508('0x156'));}logger[_0x9508('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));var _0xc8432f=this[_0x9508('0x1c3')]['sync'](this,_0x2c9dc6[_0x9508('0x155')]);if(_0xc8432f){logger['info'](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this['channel']['callerid'],_0x2c9dc6[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x158')};}else{logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x159'),this['channel'][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0x159'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x1c4')]=function(_0x141dc0){logger[_0x9508('0x30')](util['format'](_0x9508('0x1c5'),_0x141dc0[_0x9508('0xa9')]));var _0x3436fd=this[_0x9508('0xd')][_0x9508('0x54')](_0x9508('0x1c6'),[_0x141dc0[_0x9508('0x1c7')],_0x141dc0['options']]);if(_0x3436fd[_0x9508('0xab')]===-0x1){return _0x3436fd;}return this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0xc4'),_0x9508('0x1c6'),_0x141dc0[_0x9508('0x1c7')]));};AGIVertices['prototype']['vswitch']=function(_0x887c22){logger['info'](util[_0x9508('0x28')](_0x9508('0x1c8'),_0x887c22[_0x9508('0xa9')]));if(!this['isConfigured'](_0x887c22['variable_id'])){return this['channel'][_0x9508('0x33')](_0x887c22,_0x9508('0x1c9'));}var _0x1b246b=this['getVariable']['sync'](this,_0x887c22['variable_id']);if(!_0x1b246b){return this['channel']['error'](_0x887c22,_0x9508('0x115'));}var _0x5daf6a=this[_0x9508('0xd')][_0x9508('0x10')](_0x1b246b);return{'code':0xc8,'result':_0x5daf6a[_0x9508('0xa3')]?_0x5daf6a[_0x9508('0xa3')]:'-'};};String[_0x9508('0xf')][_0x9508('0xa2')]=function(_0x3d08e2,_0x2d73d0){return this[_0x9508('0xa1')](_0x3d08e2)[_0x9508('0x1ca')](_0x2d73d0);};module['exports']=AGIVertices; \ No newline at end of file +var _0xe14d=['Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','exports','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','replace','googleCloudTTS','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','number','timeout','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','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','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes'];(function(_0x52ff94,_0x37e491){var _0x16fcdf=function(_0x1a4007){while(--_0x1a4007){_0x52ff94['push'](_0x52ff94['shift']());}};_0x16fcdf(++_0x37e491);}(_0xe14d,0x1ee));var _0xde14=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xe14d[_0x20c9b2];return _0x2c6030;};'use strict';var fs=require('fs');var util=require(_0xde14('0x0'));var _=require(_0xde14('0x1'));var sh=require(_0xde14('0x2'));var odbc=require(_0xde14('0x3'))();var rs=require('randomstring');var moment=require(_0xde14('0x4'));var Mustache=require(_0xde14('0x5'));var rp=require('request-promise');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var scripts=require(_0xde14('0x9'));var FILES_PATH=_0xde14('0xa');var recursiveMapAttributes=[_0xde14('0xb'),'rawBody'];var verticesWithRetry=['menu',_0xde14('0xc'),_0xde14('0xd')];var AGIVertices=function(_0x2b0e7c,_0x9f13dc,_0xb25b00){this[_0xde14('0xe')]=_0x2b0e7c;this[_0xde14('0xf')]=_0x9f13dc;this[_0xde14('0x10')]=_0xb25b00;};AGIVertices['prototype'][_0xde14('0x11')]=function(_0xe785fb,_0x417269){this[_0xde14('0xf')][_0xde14('0x12')](_0xe785fb)[_0xde14('0x13')](function(_0x1a1c32){_0x417269(null,_0x1a1c32?_0x1a1c32[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x29e3ca){_0x417269(_0x29e3ca);});};AGIVertices[_0xde14('0x16')][_0xde14('0x17')]=function(_0x3521d4,_0x281c54){this[_0xde14('0xf')]['getVoiceQueueById'](_0x3521d4)['then'](function(_0x23c878){_0x281c54(null,_0x23c878?_0x23c878[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x4c86ff){_0x281c54(_0x4c86ff);});};AGIVertices[_0xde14('0x16')][_0xde14('0x18')]=function(_0x257390,_0x31902a){this[_0xde14('0xf')][_0xde14('0x19')](_0x257390)[_0xde14('0x13')](function(_0x6f6eea){_0x31902a(null,_0x6f6eea?_0x6f6eea[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x590a8b){_0x31902a(_0x590a8b);});};AGIVertices[_0xde14('0x16')][_0xde14('0x1a')]=function(_0x2eb8a8,_0x44ce4c){this['rpc'][_0xde14('0x1b')](_0x2eb8a8)['then'](function(_0x45d101){_0x44ce4c(null,_0x45d101?_0x45d101['dsn']:![]);})[_0xde14('0x15')](function(_0x30fcf1){_0x44ce4c(_0x30fcf1);});};AGIVertices[_0xde14('0x16')][_0xde14('0x1c')]=function(_0x39bdc5,_0x11a4d9){this[_0xde14('0xf')][_0xde14('0x1d')](_0x39bdc5)[_0xde14('0x13')](function(_0x163b79){_0x11a4d9(null,_0x163b79?_0x163b79[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x8f8033){_0x11a4d9(_0x8f8033);});};AGIVertices['prototype'][_0xde14('0x1e')]=function(_0x3ce77c,_0x24a390){this[_0xde14('0xf')][_0xde14('0x1f')](_0x3ce77c)[_0xde14('0x13')](function(_0x310d75){_0x24a390(null,_0x310d75?_0x310d75[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x350a78){_0x24a390(_0x350a78);});};AGIVertices['prototype'][_0xde14('0x20')]=function(_0x1696ee,_0x3eaee5){var _0xf8279a=this;this['rpc'][_0xde14('0x21')](_0x1696ee)[_0xde14('0x13')](function(_0x30c4a8){_0x3eaee5(null,_0x30c4a8?_0xf8279a['getSoundPath'](_0x30c4a8[_0xde14('0x22')]):![]);})['catch'](function(_0x2760f9){_0x3eaee5(_0x2760f9);});};AGIVertices[_0xde14('0x16')][_0xde14('0x23')]=function(_0x1e7906,_0x2aca96){this[_0xde14('0xf')][_0xde14('0x24')](_0x1e7906)[_0xde14('0x13')](function(_0x4e7c5b){_0x2aca96(null,_0x4e7c5b?_0x4e7c5b:![]);})[_0xde14('0x15')](function(_0xbf49ac){_0x2aca96(_0xbf49ac);});};AGIVertices['prototype'][_0xde14('0x25')]=function(_0x4c9b15,_0x2e40ad,_0x44e88a){this[_0xde14('0x10')][_0xde14('0x25')](_0x4c9b15,_0x2e40ad)[_0xde14('0x13')](function(){_0x44e88a(null);})['catch'](function(_0x26dfa9){_0x44e88a(_0x26dfa9);});};AGIVertices[_0xde14('0x16')]['getIntervals']=function(_0x280238,_0x3c943b){this[_0xde14('0xf')][_0xde14('0x26')](_0x280238)[_0xde14('0x13')](function(_0xa41c1e){if(_0xa41c1e){if(_0xa41c1e[_0xde14('0x27')]){_0x3c943b(null,[_0xa41c1e[_0xde14('0x28')]]);}else{_0x3c943b(null,_[_0xde14('0x29')](_0xa41c1e['Intervals'],'interval'));}}else{_0x3c943b(null,![]);}})[_0xde14('0x15')](function(_0x403007){_0x3c943b(_0x403007);});};AGIVertices[_0xde14('0x16')][_0xde14('0x2a')]=function(_0x31cad4){return util[_0xde14('0x2b')](_0xde14('0x2c'),FILES_PATH,_0x31cad4);};AGIVertices[_0xde14('0x16')][_0xde14('0x2d')]=function(_0x4e33e0,_0x1854d3,_0x48c043){odbc['open'](_0x4e33e0,function(_0x4c1e37){if(_0x4c1e37){logger[_0xde14('0x2e')](_0xde14('0x2f'),_0x4c1e37);_0x48c043(_0x4c1e37);}else{logger[_0xde14('0x30')](_0xde14('0x31'));odbc[_0xde14('0x32')](_0x1854d3,function(_0x8b5bb4,_0x1e89b6){if(_0x8b5bb4){logger[_0xde14('0x30')]('Error\x20executing\x20query\x20%s',_0x1854d3);_0x48c043(_0x8b5bb4);}else{logger[_0xde14('0x30')](_0xde14('0x33'),_0x1854d3);odbc[_0xde14('0x34')](function(_0x2b3004){if(_0x2b3004){logger[_0xde14('0x2e')](_0xde14('0x35'),_0x2b3004);}_0x48c043(null,_0x1e89b6);});}});}});};AGIVertices[_0xde14('0x16')][_0xde14('0x36')]=function(_0x50db0d,_0x225164){this[_0xde14('0xf')][_0xde14('0x37')](_0x50db0d)[_0xde14('0x13')](function(_0x4f7141){_0x225164(null,_0x4f7141?_0x4f7141:![]);})['catch'](function(_0x75d4f1){_0x225164(_0x75d4f1);});};AGIVertices[_0xde14('0x16')][_0xde14('0x38')]=function(_0x171080,_0x401f7e){this['rpc'][_0xde14('0x38')](_0x171080)[_0xde14('0x13')](function(_0x1d3cc1){_0x401f7e(null,_0x1d3cc1);})['catch'](function(_0x46fb53){_0x401f7e(_0x46fb53);});};AGIVertices['prototype'][_0xde14('0x39')]=function(_0x51ace9,_0x102770,_0x117c64){this[_0xde14('0xf')][_0xde14('0x39')]({'uniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'node':_0x51ace9[_0xde14('0x3b')],'application':_0x51ace9[_0xde14('0x3c')],'data':_0x102770||null,'project_name':this['channel'][_0xde14('0x3d')],'callerid':this['channel'][_0xde14('0x3e')]})['then'](function(_0x214b14){if(_0x117c64){_0x117c64(null,_0x214b14);}})[_0xde14('0x15')](function(_0x437466){if(_0x117c64){_0x117c64(_0x437466);}});};AGIVertices[_0xde14('0x16')][_0xde14('0x3f')]=function(_0x138d36,_0x442b3c,_0x2aadcf,_0x4f1b43){this[_0xde14('0xf')][_0xde14('0x3f')]({'uniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'callerid':this['channel'][_0xde14('0x3e')],'calleridname':this[_0xde14('0xe')][_0xde14('0x40')],'context':this[_0xde14('0xe')][_0xde14('0x41')],'extension':this[_0xde14('0xe')]['extension'],'priority':this[_0xde14('0xe')]['priority'],'accountcode':this[_0xde14('0xe')][_0xde14('0x42')],'dnid':this['channel'][_0xde14('0x43')],'projectName':this[_0xde14('0xe')][_0xde14('0x3d')],'saveName':_0x442b3c,'filename':_0x138d36[_0xde14('0x44')]||_0x442b3c,'savePath':_0x2aadcf})[_0xde14('0x13')](function(_0x1c87e1){_0x4f1b43(null,_0x1c87e1);})[_0xde14('0x15')](function(_0x51f35f){_0x4f1b43(_0x51f35f);});};AGIVertices[_0xde14('0x16')]['createSquareMessage']=function(_0xfa80c8,_0x6aa9ab,_0x237be4,_0x235202,_0x2e6867){this[_0xde14('0xf')][_0xde14('0x45')]({'uniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'body':_0xfa80c8,'direction':_0x6aa9ab,'providerName':_0x237be4,'providerResponse':_0x235202})[_0xde14('0x13')](function(_0x5db8b5){if(_0x2e6867){_0x2e6867(null,_0x5db8b5);}})[_0xde14('0x15')](function(_0x1688c6){if(_0x2e6867){_0x2e6867(_0x1688c6);}});};AGIVertices[_0xde14('0x16')][_0xde14('0x46')]=function(_0x14b781,_0x4874ed){this[_0xde14('0xf')]['createCmContact']({'firstName':_[_0xde14('0x47')](_0x14b781[_0xde14('0x14')])||_[_0xde14('0x48')](_0x14b781[_0xde14('0x14')])?_0xde14('0x49')+Math['random']():_0x14b781['name'],'lastName':_[_0xde14('0x47')](_0x14b781['lastName'])||_[_0xde14('0x48')](_0x14b781[_0xde14('0x4a')])?null:_0x14b781[_0xde14('0x4a')],'phone':_0x14b781[_0xde14('0x4b')],'ListId':_0x14b781[_0xde14('0x4c')],'scheduledat':_0x14b781[_0xde14('0x4d')],'callbackUniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'tags':_0xde14('0x4e'),'description':'Callback\x20scheduled\x20at\x20'+_0x14b781[_0xde14('0x4d')][_0xde14('0x4f')](),'priority':_0x14b781[_0xde14('0x50')]})[_0xde14('0x13')](function(_0x249ccc){_0x4874ed(null,_0x249ccc);})['catch'](function(_0xb2d69c){_0x4874ed(_0xb2d69c);});};AGIVertices['prototype'][_0xde14('0x51')]=function(_0x27fb42,_0x2526ca){this[_0xde14('0xf')][_0xde14('0x52')](_0x27fb42)[_0xde14('0x13')](function(_0x27ab1a){_0x2526ca(null,_0x27ab1a?_0x27ab1a[_0xde14('0x14')]:![]);})['catch'](function(_0x5a2753){_0x2526ca(_0x5a2753);});};AGIVertices['prototype'][_0xde14('0x53')]=function(_0x508f25,_0x596cd3,_0xc10000){var _0x20fd21={'role':_0xde14('0x54')};_0x20fd21[_0x508f25]=this[_0xde14('0xe')][_0xde14('0x3e')];this[_0xde14('0xf')][_0xde14('0x53')](_0x20fd21,_0x596cd3,this[_0xde14('0xe')][_0xde14('0x3a')])['then'](function(_0x6be331){_0xc10000(null,_[_0xde14('0x48')](_0x6be331)?![]:!![]);})[_0xde14('0x15')](function(_0x524e98){logger[_0xde14('0x2e')](_0x524e98);_0xc10000(null,![]);});};AGIVertices['prototype'][_0xde14('0x55')]=function(_0x32bffd,_0x40ab83){var _0x18eaf0={'role':_0xde14('0x54')};_0x18eaf0[_0x32bffd]=this[_0xde14('0xe')][_0xde14('0x3e')];this['rpc'][_0xde14('0x55')](_0x18eaf0)[_0xde14('0x13')](function(_0x1a0bb1){_0x40ab83(null,_[_0xde14('0x48')](_0x1a0bb1)?![]:!![]);})[_0xde14('0x15')](function(_0x70a2e1){logger[_0xde14('0x2e')](_0x70a2e1);_0x40ab83(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x4563ba,_0x19a162){var _0x3d37cc={'role':'agent'};_0x3d37cc[_0x4563ba]=this[_0xde14('0xe')][_0xde14('0x3e')];this[_0xde14('0xf')][_0xde14('0x56')](_0x3d37cc)['then'](function(_0x567180){_0x19a162(null,_[_0xde14('0x48')](_0x567180)?![]:!![]);})[_0xde14('0x15')](function(_0x30f228){logger[_0xde14('0x2e')](_0x30f228);_0x19a162(null,![]);});};AGIVertices[_0xde14('0x16')][_0xde14('0x57')]=function(_0x1bfe9b,_0x3641e3){var _0x408e7f={'role':_0xde14('0x54')};_0x408e7f[_0x1bfe9b]=this[_0xde14('0xe')][_0xde14('0x3e')];var _0x1ff577=_0x1bfe9b!=_0xde14('0x58')?util[_0xde14('0x2b')](_0xde14('0x59'),_0xde14('0x5a'),this[_0xde14('0xe')][_0xde14('0x3e')]):undefined;this[_0xde14('0xf')][_0xde14('0x57')](_0x408e7f,_0x1ff577)[_0xde14('0x13')](function(_0xfe7fcd){_0x3641e3(null,_['isNil'](_0xfe7fcd)?![]:!![]);})[_0xde14('0x15')](function(_0x55ddcf){logger[_0xde14('0x2e')](_0x55ddcf);_0x3641e3(null,![]);});};AGIVertices['prototype'][_0xde14('0x5b')]=function(_0xfa9c8d,_0x3aaba2){sh['exec'](_['trim'](_0xfa9c8d),function(_0x23d3e1,_0x18abd0){var _0x217a3d=_0x18abd0[_0xde14('0x5c')](/(\r\n|\n|\r)/gm,'');_0x3aaba2(null,_0x217a3d);});};AGIVertices['prototype'][_0xde14('0x5d')]=function(_0x3b4bc8,_0xa853de){scripts['googleCloudTTS'](_0x3b4bc8['apiKey'],_0x3b4bc8['google_cloud_tts_text_type']||'text',_0x3b4bc8[_0xde14('0x5e')],_0x3b4bc8[_0xde14('0x5f')]||_0xde14('0x60'),_0x3b4bc8['ssmlGender']||_0xde14('0x61'),_0x3b4bc8[_0xde14('0x62')]||_0xde14('0x63'))[_0xde14('0x13')](function(_0x37c412){_0xa853de(null,_0x37c412);})[_0xde14('0x15')](function(_0x545784){_0xa853de(_0x545784);});};AGIVertices['prototype'][_0xde14('0x64')]=function(_0x4474c2,_0x54aaa2){scripts[_0xde14('0x64')](_0x4474c2[_0xde14('0x5e')],_0x4474c2[_0xde14('0x65')]||'en',0x1)[_0xde14('0x13')](function(_0x32f022){_0x54aaa2(null,_0x32f022);})[_0xde14('0x15')](function(_0x2540df){_0x54aaa2(_0x2540df);});};AGIVertices['prototype']['restAPI']=function(_0x4800bf,_0x5d9fa3){var _0x3dbda9={'uri':_0x4800bf[_0xde14('0x66')],'method':_0x4800bf['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4800bf['timeout'])===_0xde14('0x67')&&parseInt(_0x4800bf[_0xde14('0x68')])>=0x1?parseInt(_0x4800bf[_0xde14('0x68')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xde14('0x69'),_0xde14('0x6a')],_0x3dbda9['method'][_0xde14('0x6b')]())){try{_0x3dbda9[_0xde14('0x6c')]=_0x4800bf[_0xde14('0x6d')]?JSON[_0xde14('0x6e')](_0x4800bf['rawBody']):{};}catch(_0x19887c){logger['error'](_0xde14('0x6f'),_0x19887c);}}try{_0x3dbda9[_0xde14('0x70')]=_0x4800bf[_0xde14('0xb')]?JSON['parse'](_0x4800bf[_0xde14('0xb')]):{};}catch(_0x3af215){logger[_0xde14('0x2e')](_0xde14('0x71'),_0x3af215);}if(_0x4800bf[_0xde14('0x72')]){try{var _0x54890a=require(_0x4800bf['computedVariables'])[_0xde14('0x73')](this,_0x3dbda9);_0x3dbda9[_0xde14('0x74')]=Mustache[_0xde14('0x75')](_0x4800bf['url'],_0x54890a,{},['$$','$$']);if(_0x3dbda9[_0xde14('0x70')]){_0x3dbda9[_0xde14('0x70')]=JSON[_0xde14('0x6e')](Mustache[_0xde14('0x75')](JSON[_0xde14('0x76')](_0x3dbda9[_0xde14('0x70')]),_0x54890a,{},['$$','$$']));}if(_0x3dbda9[_0xde14('0x6c')]){_0x3dbda9['body']=JSON[_0xde14('0x6e')](Mustache[_0xde14('0x75')](JSON[_0xde14('0x76')](_0x3dbda9[_0xde14('0x6c')]),_0x54890a,{},['$$','$$']));}}catch(_0x22bfc9){logger[_0xde14('0x2e')](_0xde14('0x77'),_0x22bfc9);}}rp(_0x3dbda9)['then'](function(_0x26fd01){var _0x1bdeae={'statusCode':_0x26fd01['statusCode']||0xc8,'statusMessage':_0x26fd01[_0xde14('0x78')]||'OK','headers':_0x26fd01['headers']||{},'body':_0x26fd01[_0xde14('0x6c')]||{}};_0x5d9fa3(null,_0x1bdeae);})['catch'](function(_0xfa8121){var _0xffbdf1={'statusCode':_0xfa8121[_0xde14('0x79')]||0x1f4,'statusMessage':_0xfa8121[_0xde14('0x7a')]||_0xde14('0x7b'),'headers':_0xfa8121[_0xde14('0x7c')]['headers']||{},'body':_0xfa8121[_0xde14('0x7c')][_0xde14('0x6c')]||{}};_0x5d9fa3(null,_0xffbdf1);});};AGIVertices[_0xde14('0x16')]['googleDialogflow']=function(_0x2542e1,_0x46f946){scripts[_0xde14('0x7d')](this['channel'][_0xde14('0x3a')],_0x2542e1[_0xde14('0x7e')],_0x2542e1[_0xde14('0x5e')],_0x2542e1['dialogflow_language']||'en')['then'](function(_0x495741){_0x46f946(null,_0x495741);})['catch'](function(_0x381d6d){_0x46f946(_0x381d6d);});};AGIVertices[_0xde14('0x16')]['googleDialogflowV2']=function(_0x36da22,_0xe16364){scripts[_0xde14('0x7f')](this[_0xde14('0xe')][_0xde14('0x3a')],_0x36da22['dialogflowV2_project_id'],_0x36da22[_0xde14('0x80')],_0x36da22[_0xde14('0x81')],_0x36da22[_0xde14('0x5e')],_0x36da22[_0xde14('0x82')]||'en')[_0xde14('0x13')](function(_0x3f49ea){_0xe16364(null,_0x3f49ea);})[_0xde14('0x15')](function(_0x3fb180){_0xe16364(_0x3fb180);});};AGIVertices['prototype'][_0xde14('0x83')]=function(_0x3f180b,_0xd9a97){scripts[_0xde14('0x83')](this[_0xde14('0xe')],_0x3f180b)[_0xde14('0x13')](function(_0x4fb108){_0xd9a97(null,_0x4fb108);})[_0xde14('0x15')](function(_0x54ec08){_0xd9a97(_0x54ec08);});};AGIVertices[_0xde14('0x16')][_0xde14('0x84')]=function(_0x54522f,_0xe0f167){scripts[_0xde14('0x84')](_0x54522f[_0xde14('0x7e')],_0x54522f[_0xde14('0x5e')],_0x54522f[_0xde14('0x85')]||_0xde14('0x60'),_0x54522f[_0xde14('0x86')])[_0xde14('0x13')](function(_0x1a3513){_0xe0f167(null,_0x1a3513);})[_0xde14('0x15')](function(_0xdec1bd){_0xe0f167(_0xdec1bd);});};AGIVertices[_0xde14('0x16')][_0xde14('0x87')]=function(_0x5a6f35,_0x56eb76,_0x41b62a){scripts[_0xde14('0x87')](_0x56eb76,_0x5a6f35['key'],_0x5a6f35[_0xde14('0x88')]||_0xde14('0x60'),this[_0xde14('0x89')](_0x5a6f35[_0xde14('0x8a')])?_0x5a6f35[_0xde14('0x8a')]:undefined)[_0xde14('0x13')](function(_0x2eb881){_0x41b62a(null,_0x2eb881);})[_0xde14('0x15')](function(_0x339371){_0x41b62a(_0x339371);});};AGIVertices['prototype']['awsPolly']=function(_0x324e4f,_0x23f9d9){scripts['awsPolly'](_0x324e4f[_0xde14('0x8b')],_0x324e4f[_0xde14('0x8c')],_0x324e4f['aws_polly_region'],_0x324e4f[_0xde14('0x8d')]||_0xde14('0x8e'),_0x324e4f['text'],_0x324e4f[_0xde14('0x8f')]||'text')[_0xde14('0x13')](function(_0x3ce6b8){_0x23f9d9(null,_0x3ce6b8);})[_0xde14('0x15')](function(_0x1a2494){_0x23f9d9(_0x1a2494);});};AGIVertices['prototype'][_0xde14('0x90')]=function(_0x22ff35,_0x467470){scripts['awsLex'](this[_0xde14('0xe')][_0xde14('0x3a')],_0x22ff35[_0xde14('0x8b')],_0x22ff35[_0xde14('0x8c')],_0x22ff35['aws_lex_region'],_0x22ff35[_0xde14('0x5e')],_0x22ff35[_0xde14('0x91')])['then'](function(_0x44d201){_0x467470(null,_0x44d201);})[_0xde14('0x15')](function(_0x69c01f){_0x467470(_0x69c01f);});};AGIVertices[_0xde14('0x16')][_0xde14('0x92')]=function(_0x476463,_0x27167e,_0x2b36e5){scripts['googleASR'](_0x27167e,_0x476463[_0xde14('0x7e')],_0x476463[_0xde14('0x93')]||_0xde14('0x60'))[_0xde14('0x13')](function(_0x59c555){_0x2b36e5(null,_0x59c555);})['catch'](function(_0x5717e0){_0x2b36e5(_0x5717e0);});};AGIVertices['prototype'][_0xde14('0x94')]=function(_0xb621ab,_0x1517fe,_0x51f886){scripts['tildeASR'](_0x1517fe,_0xb621ab[_0xde14('0x95')],_0xb621ab['appsecret'],_0xb621ab['uri'])['then'](function(_0x58be49){_0x51f886(null,_0x58be49);})[_0xde14('0x15')](function(_0x54fbea){_0x51f886(_0x54fbea);});};AGIVertices['prototype']['clear']=function(_0x487260){var _0x235239=_[_0xde14('0x96')](verticesWithRetry,_0x487260[_0xde14('0x3c')])?_0x487260:_[_0xde14('0x97')](_0x487260);for(var _0x3a2d9c in _0x235239){if(_0x235239[_0xde14('0x98')](_0x3a2d9c)){if(_0x235239[_0x3a2d9c]&&_['isString'](_0x235239[_0x3a2d9c])){if(_[_0xde14('0x96')](recursiveMapAttributes,_0x3a2d9c)){_0x235239[_0x3a2d9c]=this[_0xde14('0x99')](_0x235239[_0x3a2d9c]);}else{_0x235239[_0x3a2d9c]=this[_0xde14('0x9a')](_0x235239[_0x3a2d9c]);}}}}return _0x235239;};AGIVertices[_0xde14('0x16')][_0xde14('0x9b')]=function(_0x17fc25){for(var _0x991f3d in _0x17fc25){if(_0x17fc25[_0xde14('0x98')](_0x991f3d)){if(_[_0xde14('0x9c')](_0x17fc25[_0x991f3d])){this[_0xde14('0x9b')](_0x17fc25[_0x991f3d]);}else if(_[_0xde14('0x9d')](_0x17fc25[_0x991f3d])){for(var _0xe62f70=0x0;_0xe62f70<_0x17fc25[_0x991f3d][_0xde14('0x9e')];_0xe62f70++){this[_0xde14('0x9b')](_0x17fc25[_0x991f3d][_0xe62f70]);}}else if(_[_0xde14('0x9f')](_0x17fc25[_0x991f3d])){_0x17fc25[_0x991f3d]=this['replaceAllVariables'](_0x17fc25[_0x991f3d]);}}}};AGIVertices[_0xde14('0x16')][_0xde14('0xa0')]=function(_0x2b6562,_0x788855){for(var _0xe37a8a in _0x2b6562){if(_0x2b6562[_0xde14('0x98')](_0xe37a8a)){if(_['isPlainObject'](_0x2b6562[_0xe37a8a])){if(!_[_0xde14('0x47')](_0x2b6562[_0xe37a8a])){this[_0xde14('0xa0')](_0x2b6562[_0xe37a8a],util[_0xde14('0x2b')](_0xde14('0xa1'),_0x788855,_0xe37a8a));}}else if(_['isArray'](_0x2b6562[_0xe37a8a])){for(var _0x485151=0x0;_0x485151<_0x2b6562[_0xe37a8a]['length'];_0x485151++){this[_0xde14('0xa0')](_0x2b6562[_0xe37a8a][_0x485151],util[_0xde14('0x2b')](_0xde14('0xa1'),_0x788855,_0xe37a8a+'['+_0x485151+']'));}}else{if(!_[_0xde14('0x48')](_0x2b6562[_0xe37a8a])){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0xa1'),_0x788855,_0xe37a8a),_0x2b6562[_0xe37a8a]);}}}}};AGIVertices[_0xde14('0x16')][_0xde14('0x99')]=function(_0xec6b8a){try{var _0xac2f9=JSON[_0xde14('0x6e')](_0xec6b8a);this[_0xde14('0x9b')](_0xac2f9);return JSON[_0xde14('0x76')](_0xac2f9);}catch(_0x36fefa){return this[_0xde14('0x9a')](_0xec6b8a);}};AGIVertices[_0xde14('0x16')]['replaceAllVariables']=function(_0x1ab722){var _0x52515f=_0x1ab722['split']('{');for(var _0x56a9d0=0x1;_0x56a9d0<_0x52515f['length'];_0x56a9d0+=0x1){var _0x1d95ff=_0x52515f[_0x56a9d0][_0xde14('0xa3')]('}');if(_0x1d95ff['length']>0x1){_0x1ab722=_0x1ab722[_0xde14('0xa4')]('{'+_0x1d95ff[0x0]+'}',this['channel'][_0xde14('0x11')](_0x1d95ff[0x0])[_0xde14('0xa5')]||_0x1d95ff[0x0]);}}if(_0x52515f['length']===0x1){return _0x1ab722[_0xde14('0x4f')]();}return this[_0xde14('0x9a')](_0x1ab722);};AGIVertices[_0xde14('0x16')][_0xde14('0xa6')]=function(_0x426727,_0x1db2f3){var _0x3bb899=this[_0xde14('0xe')][_0xde14('0x11')](_0x426727);if(_0x3bb899[_0xde14('0xa7')]===-0x1){return _0x3bb899;}logger[_0xde14('0x30')](util[_0xde14('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1db2f3,_0x3bb899[_0xde14('0xa5')]));return this['channel'][_0xde14('0xa2')](_0x1db2f3,_0x3bb899[_0xde14('0xa5')]);};AGIVertices[_0xde14('0x16')]['isConfigured']=function(_0x3d9ff9){return _0x3d9ff9&&_0x3d9ff9!=='0'&&_0x3d9ff9!=='-1'&&_0x3d9ff9!=='';};AGIVertices['prototype'][_0xde14('0xa8')]=function(_0x4bee01){this[_0xde14('0x39')][_0xde14('0x73')](this,_0x4bee01,'-');_0x4bee01[_0xde14('0xa9')]=_0x4bee01['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x3fb97c){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xaa'),_0x3fb97c['label']));if(!this[_0xde14('0x89')](_0x3fb97c[_0xde14('0x5e')])){return this['channel'][_0xde14('0xab')](_0xde14('0xac'));}var _0x4463ad='\x22'+_0x3fb97c[_0xde14('0x5e')]+'\x22';if(this[_0xde14('0x89')](_0x3fb97c[_0xde14('0x7c')])){_0x4463ad+=','+_0x3fb97c[_0xde14('0x7c')];}var _0x886c76=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xae'),_0x4463ad);if(_0x886c76[_0xde14('0xa7')]===-0x1){return _0x886c76;}return this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xaf'),_0x4463ad));};AGIVertices[_0xde14('0x16')]['mrcprecog']=function(_0x5b7a88){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xb0'),_0x5b7a88[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x5b7a88[_0xde14('0xb1')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20grammar\x20configured');}var _0x3ad8de=_0x5b7a88[_0xde14('0xb1')];if(this[_0xde14('0x89')](_0x5b7a88[_0xde14('0x7c')])){_0x3ad8de+=','+_0x5b7a88[_0xde14('0x7c')];}var _0x4ccf2e=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xb2'),_0x3ad8de);if(_0x4ccf2e[_0xde14('0xa7')]===-0x1){return _0x4ccf2e;}var _0x2e4340=this[_0xde14('0xa6')](_0xde14('0xb3'),_0xde14('0xb4'));if(_0x2e4340[_0xde14('0xa7')]===-0x1){return _0x2e4340;}var _0x3af55d=this[_0xde14('0xa6')]('RECOG_INPUT()',_0xde14('0xb5'));if(_0x3af55d[_0xde14('0xa7')]===-0x1){return _0x3af55d;}var _0x4cb4ad=this['getAndSetVariable'](_0xde14('0xb6'),_0xde14('0xb7'));if(_0x4cb4ad[_0xde14('0xa7')]===-0x1){return _0x4cb4ad;}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0xb8'),_0x3ad8de));};AGIVertices[_0xde14('0x16')][_0xde14('0x7')]=function(_0x44181b){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xb9'),_0x44181b[_0xde14('0x3b')]));return this[_0xde14('0xe')][_0xde14('0x7')]([_0x44181b[_0xde14('0xba')],_0x44181b[_0xde14('0xbb')]]);};AGIVertices[_0xde14('0x16')][_0xde14('0xbc')]=function(_0x646fa9){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xbd'),_0x646fa9['label']));if(this['isConfigured'](_0x646fa9[_0xde14('0x68')])){logger[_0xde14('0x30')](util['format'](_0xde14('0xbe'),_0x646fa9['timeout']));var _0x593e49=this[_0xde14('0xe')]['wait'](_0x646fa9[_0xde14('0x68')]);if(_0x593e49[_0xde14('0xa7')]===-0x1){return _0x593e49;}}return this[_0xde14('0xe')][_0xde14('0xbc')]();};AGIVertices['prototype'][_0xde14('0x4e')]=function(_0x4821){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4821[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x4821[_0xde14('0x4c')])){return this['channel'][_0xde14('0x2e')](_0x4821,_0xde14('0xbf'));}_0x4821['scheduledAt']=moment();if(this[_0xde14('0x89')](_0x4821['delay'])){_0x4821[_0xde14('0x4d')]=moment()['add'](_0x4821[_0xde14('0xc0')],_0xde14('0xc1'));}if(!this[_0xde14('0x89')](_0x4821['callback_priority'])){_0x4821[_0xde14('0x50')]=0x2;}this[_0xde14('0x46')][_0xde14('0x73')](this,_0x4821);return this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xc2'),_0x4821[_0xde14('0x4b')],_0x4821[_0xde14('0x4c')],_0x4821[_0xde14('0x4d')]));};AGIVertices['prototype'][_0xde14('0xc3')]=function(_0x11915d){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xc4'),_0x11915d[_0xde14('0x3b')]));var _0x19a4cc=this[_0xde14('0xe')][_0xde14('0xad')](_0x11915d[_0xde14('0xc5')],_0x11915d['options']);if(_0x19a4cc[_0xde14('0xa7')]===-0x1){return _0x19a4cc;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xc6'),_0x11915d[_0xde14('0xc5')],_0x11915d['options']));};AGIVertices[_0xde14('0x16')][_0xde14('0xc7')]=function(_0x24d95d){logger[_0xde14('0x30')](util['format'](_0xde14('0xc8'),_0x24d95d[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x24d95d[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}var _0x504dc3='\x22'+_0x24d95d['text']+'\x22';if(this['isConfigured'](_0x24d95d['options'])){_0x504dc3+=','+_0x24d95d[_0xde14('0x7c')];}var _0xd909e1=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xae'),_0x504dc3);if(_0xd909e1[_0xde14('0xa7')]===-0x1){return _0xd909e1;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xaf'),_0x504dc3));};AGIVertices[_0xde14('0x16')][_0xde14('0xc9')]=function(_0x32ee79){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xca'),_0x32ee79['label']));if(!this[_0xde14('0x89')](_0x32ee79[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}var _0x42641a='\x22'+_0x32ee79[_0xde14('0x5e')]+'\x22';if(this['isConfigured'](_0x32ee79['options'])){_0x42641a+=','+_0x32ee79['options'];}var _0x33275e=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xae'),_0x42641a);if(_0x33275e[_0xde14('0xa7')]===-0x1){return _0x33275e;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xaf'),_0x42641a));};AGIVertices[_0xde14('0x16')][_0xde14('0xcb')]=function(_0x28ccbe){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xcc'),_0x28ccbe[_0xde14('0x3b')]));if(!this['isConfigured'](_0x28ccbe['grammar'])){return this['channel'][_0xde14('0xab')](_0xde14('0xcd'));}var _0x38e36b=_0x28ccbe['grammar'];if(this[_0xde14('0x89')](_0x28ccbe[_0xde14('0x7c')])){_0x38e36b+=','+_0x28ccbe['options'];}var _0x2f3517=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xb2'),_0x38e36b);if(_0x2f3517[_0xde14('0xa7')]===-0x1){return _0x2f3517;}var _0x55de57=this[_0xde14('0xa6')](_0xde14('0xb3'),_0xde14('0xce'));if(_0x55de57[_0xde14('0xa7')]===-0x1){return _0x55de57;}var _0xb175c7=this[_0xde14('0xa6')](_0xde14('0xcf'),_0xde14('0xd0'));if(_0xb175c7[_0xde14('0xa7')]===-0x1){return _0xb175c7;}var _0x17e1ec=this[_0xde14('0xa6')]('RECOG_INSTANCE()',_0xde14('0xd1'));if(_0x17e1ec[_0xde14('0xa7')]===-0x1){return _0x17e1ec;}return this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xb8'),_0x38e36b));};AGIVertices['prototype'][_0xde14('0xd2')]=function(_0x561b66){logger['info'](util[_0xde14('0x2b')](_0xde14('0xd3'),_0x561b66[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x561b66[_0xde14('0xb1')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20grammar\x20configured');}var _0x539b35=_0x561b66[_0xde14('0xb1')];if(this['isConfigured'](_0x561b66[_0xde14('0x7c')])){_0x539b35+=','+_0x561b66[_0xde14('0x7c')];}var _0x54d129=this['channel'][_0xde14('0xad')]('MRCPRecog',_0x539b35);if(_0x54d129[_0xde14('0xa7')]===-0x1){return _0x54d129;}var _0x59bd39=this['getAndSetVariable'](_0xde14('0xb3'),'SESTEK_ASR_CONFIDENCE');if(_0x59bd39[_0xde14('0xa7')]===-0x1){return _0x59bd39;}var _0x24f9b2=this[_0xde14('0xa6')](_0xde14('0xcf'),_0xde14('0xd4'));if(_0x24f9b2[_0xde14('0xa7')]===-0x1){return _0x24f9b2;}var _0x195c0b=this[_0xde14('0xa6')](_0xde14('0xb6'),'SESTEK_ASR_INSTANCE');if(_0x195c0b[_0xde14('0xa7')]===-0x1){return _0x195c0b;}return this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xb8'),_0x539b35));};AGIVertices[_0xde14('0x16')][_0xde14('0xd5')]=function(_0x33f562){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x33f562[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x33f562['odbc_id'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,'no\x20database\x20selected');}var _0x58387a=this[_0xde14('0x1a')][_0xde14('0x73')](this,_0x33f562[_0xde14('0xd6')]);if(!_0x58387a){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,_0xde14('0xd7'));}if(!this['isConfigured'](_0x33f562[_0xde14('0x32')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,_0xde14('0xd8'));}var _0x20ad12=_0x33f562[_0xde14('0x32')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xd9'),_0x20ad12));var _0x1b39cf=this[_0xde14('0x2d')][_0xde14('0x73')](this,_0x58387a,_0x20ad12);this[_0xde14('0x39')][_0xde14('0x73')](this,_0x33f562,_0x20ad12);if(!this[_0xde14('0x89')](_0x33f562[_0xde14('0xda')])){return this['channel'][_0xde14('0xab')](_0xde14('0xdb'));}var _0x14b2ee=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x33f562[_0xde14('0xda')]);if(!_0x14b2ee){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,_0xde14('0xdc'));}var _0x2569f8=this;_0x1b39cf[_0xde14('0xdd')](function(_0x175a30,_0x4f0a67){Object[_0xde14('0xde')](_0x175a30)['forEach'](function(_0x113627){_0x2569f8[_0xde14('0xe')]['setVariable'](util['format'](_0xde14('0xdf'),_0x14b2ee,_0x4f0a67,_0x113627),_0x175a30[_0x113627]);});});this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0xe0'),_0x14b2ee),_0x1b39cf[_0xde14('0x9e')]);return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('variable\x20%s\x20set',_0x14b2ee));};AGIVertices[_0xde14('0x16')]['dial']=function(_0x39a7e7){logger[_0xde14('0xe1')](util[_0xde14('0x2b')](_0xde14('0xe2'),_0x39a7e7[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x39a7e7['sip_id'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x39a7e7,_0xde14('0xe3'));}var _0x1e1ae0=this[_0xde14('0x1c')]['sync'](this,_0x39a7e7[_0xde14('0xe4')]);if(!_0x1e1ae0){return this['channel']['error'](_0x39a7e7,_0xde14('0xe5'));}var _0x5263cc=this['channel'][_0xde14('0xad')]('DIAL',[util['format'](_0xde14('0xe6'),_0x1e1ae0),_0x39a7e7['timeout'],_0x39a7e7[_0xde14('0xe7')],_0x39a7e7[_0xde14('0x66')]]);if(_0x5263cc[_0xde14('0xa7')]===-0x1){return _0x5263cc;}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0xe8'),_0xde14('0xe9')));};AGIVertices[_0xde14('0x16')]['dialogflow']=function(_0x59640c){logger['info'](util['format'](_0xde14('0xea'),_0x59640c[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x59640c['key'])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xeb'));}if(!this['isConfigured'](_0x59640c[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x59640c);this['createSquareMessage'](_0x59640c[_0xde14('0x5e')],'in','','');this[_0xde14('0xe')]['noop'](util['format'](_0xde14('0xed'),_0x59640c[_0xde14('0x5e')]));var _0x2c9d93=this['googleDialogflow'][_0xde14('0x73')](this,_0x59640c);if(_0x2c9d93){for(var _0x3b750d in _0x2c9d93){if(_0x2c9d93[_0xde14('0x98')](_0x3b750d)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0xee'),_0x3b750d['toUpperCase']()),_0x2c9d93[_0x3b750d]);}}this[_0xde14('0x45')](_0x2c9d93[_0xde14('0xef')],_0xde14('0xf0'),'dialogflow','');return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xf1'),_0x2c9d93[_0xde14('0xef')]));}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x59640c,_0xde14('0xf2'));};AGIVertices[_0xde14('0x16')][_0xde14('0xf3')]=function(_0x2e6993){logger['info'](util[_0xde14('0x2b')](_0xde14('0xf4'),_0x2e6993[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x2e6993[_0xde14('0xf5')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xf6'));}if(!this[_0xde14('0x89')](_0x2e6993[_0xde14('0x80')])){return this['channel'][_0xde14('0xab')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x2e6993[_0xde14('0x81')])){return this['channel'][_0xde14('0xab')](_0xde14('0xf7'));}if(!this[_0xde14('0x89')](_0x2e6993[_0xde14('0x82')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20anguage\x20configured');}if(!this[_0xde14('0x89')](_0x2e6993['text'])){return this['channel'][_0xde14('0xab')]('no\x20text\x20configured');}this[_0xde14('0xe')][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x2e6993);this[_0xde14('0x45')](_0x2e6993[_0xde14('0x5e')],'in','','');this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('Trying\x20DialogflowV2:\x20%s',_0x2e6993[_0xde14('0x5e')]));var _0x5464b8=this[_0xde14('0x7f')][_0xde14('0x73')](this,_0x2e6993);if(_0x5464b8){for(var _0x12f579 in _0x5464b8){if(_0x5464b8[_0xde14('0x98')](_0x12f579)){if(_0x12f579!==_0xde14('0xf8')){this[_0xde14('0xe')][_0xde14('0xa2')](util['format'](_0xde14('0xee'),_0x12f579[_0xde14('0x6b')]()),_0x5464b8[_0x12f579]);}}}this[_0xde14('0x45')](_0x5464b8['speech'],_0xde14('0xf0'),'dialogflowV2',_0x5464b8['providerResponse']);return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xf9'),_0x5464b8[_0xde14('0xef')]));}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2e6993,_0xde14('0xfa'));};AGIVertices['prototype'][_0xde14('0xfb')]=function(_0x281010){logger['info'](util[_0xde14('0x2b')](_0xde14('0xfc'),_0x281010['label']));if(!this[_0xde14('0x89')](_0x281010[_0xde14('0xfd')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xde14('0x89')](_0x281010[_0xde14('0xfe')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xff'));}if(!this['isConfigured'](_0x281010[_0xde14('0x100')])){return this['channel'][_0xde14('0xab')](_0xde14('0x101'));}if(!this[_0xde14('0x89')](_0x281010[_0xde14('0x102')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this['channel'][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x281010);this['createSquareMessage'](_0x281010[_0xde14('0x5e')],'in','','');this['channel']['noop'](util[_0xde14('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x281010['text']));var _0x42137a=this[_0xde14('0x83')]['sync'](this,_0x281010);if(_0x42137a){for(var _0x1e4f3b in _0x42137a){if(_0x42137a[_0xde14('0x98')](_0x1e4f3b)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')]('SESTEK_NDA_%s',_0x1e4f3b['toUpperCase']()),_0x42137a[_0x1e4f3b]);}}this[_0xde14('0x45')](_0x42137a[_0xde14('0xef')],_0xde14('0xf0'),'sesteknda','');if(_0x42137a[_0xde14('0x103')]){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x104'),_0x42137a['audiofile']));var _0x533318=this[_0xde14('0xe')][_0xde14('0x105')](_0x42137a['audiofile']);try{fs['unlink'](_0x42137a[_0xde14('0x103')]+'.wav');}catch(_0x546b0f){logger[_0xde14('0x2e')](_0x546b0f);}return _0x533318;}else{return this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x106'),_0x42137a[_0xde14('0xef')]));}}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x281010,_0xde14('0x107'));};AGIVertices[_0xde14('0x16')][_0xde14('0x108')]=function(_0x989ec7){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x109'),_0x989ec7['label']));return this[_0xde14('0xe')][_0xde14('0xab')]('end');};AGIVertices[_0xde14('0x16')][_0xde14('0x10a')]=function(_0x44cc13){logger['info'](util[_0xde14('0x2b')](_0xde14('0x10b'),_0x44cc13['label']));var _0x3907f9='';if(_0x44cc13[_0xde14('0x10c')]){if(!this[_0xde14('0x89')](_0x44cc13[_0xde14('0x10c')])){return this['channel']['error'](_0x44cc13,_0xde14('0x10d'));}else{var _0x1dcbe7=parseInt(_0x44cc13[_0xde14('0x10c')],0xa);if(isNaN(_0x1dcbe7)){_0x3907f9=_0x44cc13[_0xde14('0x10c')];}else{_0x3907f9=this[_0xde14('0x1e')][_0xde14('0x73')](this,_0x44cc13[_0xde14('0x10c')]);if(!_0x3907f9){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x44cc13,_0xde14('0x10e'));}}}}else if(_0x44cc13[_0xde14('0x10f')]){_0x3907f9=_0x44cc13[_0xde14('0x10f')];}else{return this['channel'][_0xde14('0x2e')](_0x44cc13,'no\x20trunk\x20selected');}var _0x2d70ae=this['channel'][_0xde14('0xad')](_0xde14('0xe9'),[util[_0xde14('0x2b')](_0xde14('0x110'),_0x3907f9,_0x44cc13[_0xde14('0x4b')]),_0x44cc13[_0xde14('0x68')],_0x44cc13[_0xde14('0xe7')],_0x44cc13[_0xde14('0x66')]]);if(_0x2d70ae[_0xde14('0xa7')]===-0x1){return _0x2d70ae;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('Executed\x20command\x20%s',_0xde14('0xe9')));};AGIVertices[_0xde14('0x16')]['finally']=function(_0x20e2af){logger['info'](util['format'](_0xde14('0x111'),_0x20e2af[_0xde14('0x3b')]));return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x112'));};AGIVertices[_0xde14('0x16')][_0xde14('0xc')]=function(_0x17aec4){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x113'),_0x17aec4['label']));if(_0x17aec4[_0xde14('0xa9')]===0x0){return this[_0xde14('0xa8')](_0x17aec4);}_0x17aec4['retry']-=0x1;if(!this['isConfigured'](_0x17aec4[_0xde14('0x114')])){return this['channel']['error'](_0x17aec4,_0xde14('0x115'));}var _0x53371d=this[_0xde14('0x20')][_0xde14('0x73')](this,_0x17aec4[_0xde14('0x114')]);if(!_0x53371d){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x17aec4,_0xde14('0x116'));}if(!this[_0xde14('0x89')](_0x17aec4[_0xde14('0xda')])){return this['channel'][_0xde14('0x2e')](_0xde14('0xdb'));}var _0x3a4ed2=this['channel'][_0xde14('0x117')](_0x53371d,_0x17aec4[_0xde14('0x118')],_0x17aec4[_0xde14('0x119')]);var _0x40b765=_0x3a4ed2[_0xde14('0xa7')]?_0x3a4ed2[_0xde14('0xa7')]['toString']():'';logger[_0xde14('0x30')](_0xde14('0x11a'),JSON['stringify'](_0x3a4ed2));if(_0x3a4ed2[_0xde14('0xa7')]===-0x1){this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x17aec4,_0x40b765);return _0x3a4ed2;}else if(_0x3a4ed2[_0xde14('0xa5')]===_0xde14('0x68')){_0x3a4ed2[_0xde14('0xa7')]=_0x40b765[_0xde14('0x9e')]>=parseInt(_0x17aec4[_0xde14('0x11b')])?'x':'i';}else{_0x3a4ed2[_0xde14('0xa7')]=_0x40b765[_0xde14('0x9e')]>=parseInt(_0x17aec4[_0xde14('0x11b')])&&_0x40b765[_0xde14('0x9e')]<=parseInt(_0x17aec4['maxdigit'])?'x':'i';}var _0x45cfb0=this['getVariable']['sync'](this,_0x17aec4[_0xde14('0xda')]);if(!_0x45cfb0){return this[_0xde14('0xe')]['error'](_0x17aec4,_0xde14('0xdc'));}this[_0xde14('0xe')]['setVariable'](_0x45cfb0,_0x40b765);if(this[_0xde14('0x89')](_0x17aec4[_0xde14('0x11c')])){var _0x4ee79f=parseInt(_0x17aec4[_0xde14('0x11c')],0xa);var _0x437f1b=rs['generate']({'charset':'*','length':_0x4ee79f});var _0x4ad0ad=_0x40b765[_0xde14('0x9e')];if(_0x4ad0ad>0x0){if(_0x4ad0ad>_0x4ee79f){this['createSquareDetailsReport']['sync'](this,_0x17aec4,_0x17aec4[_0xde14('0x11d')]===_0xde14('0x11e')?_0x437f1b+_0x40b765[_0xde14('0x11f')](_0x4ee79f):_0x40b765[_0xde14('0x11f')](0x0,_0x4ad0ad-_0x4ee79f)+_0x437f1b);}else{this[_0xde14('0x39')][_0xde14('0x73')](this,_0x17aec4,rs[_0xde14('0x120')]({'charset':'*','length':_0x4ad0ad}));}}else{this[_0xde14('0x39')][_0xde14('0x73')](this,_0x17aec4,'');}}else{this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x17aec4,_0x40b765);}return _0x3a4ed2;};AGIVertices[_0xde14('0x16')][_0xde14('0xd')]=function(_0x34347e){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x121'),_0x34347e[_0xde14('0x3b')]));return this['getdigits'](_0x34347e);};AGIVertices['prototype'][_0xde14('0x122')]=function(_0xa77a11){logger[_0xde14('0x30')](util['format'](_0xde14('0x123'),_0xa77a11[_0xde14('0x3b')]));this[_0xde14('0x39')][_0xde14('0x73')](this,_0xa77a11,_0xa77a11['goalname']);return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x124'),_0xa77a11[_0xde14('0x125')]));};AGIVertices['prototype'][_0xde14('0x126')]=function(_0x188fec){logger['info'](util[_0xde14('0x2b')](_0xde14('0x127'),_0x188fec[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x188fec[_0xde14('0x8b')])||!this[_0xde14('0x89')](_0x188fec[_0xde14('0x8c')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x128'));}if(!this[_0xde14('0x89')](_0x188fec[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20text\x20configured');}this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x129'),_0x188fec['text']));var _0x4f226d=this[_0xde14('0x12a')]['sync'](this,_0x188fec);if(_0x4f226d){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x12b'),_0x4f226d));var _0x3a7af3=this[_0xde14('0xe')][_0xde14('0x105')](_0x4f226d);try{fs[_0xde14('0x12c')](_0x4f226d+_0xde14('0x12d'));}catch(_0x2a9b06){logger[_0xde14('0x2e')](_0x2a9b06);}return _0x3a7af3;}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x188fec,_0xde14('0x12e'));};AGIVertices['prototype'][_0xde14('0x12f')]=function(_0x2418aa){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2418aa['label']));if(!this[_0xde14('0x89')](_0x2418aa[_0xde14('0x8b')])||!this[_0xde14('0x89')](_0x2418aa[_0xde14('0x8c')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2418aa[_0xde14('0x91')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x130'));}if(!this[_0xde14('0x89')](_0x2418aa[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x2418aa);this[_0xde14('0x45')](_0x2418aa[_0xde14('0x5e')],'in','','');this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2418aa[_0xde14('0x5e')]));var _0xeccdec=this[_0xde14('0x90')][_0xde14('0x73')](this,_0x2418aa);if(_0xeccdec){for(var _0x35d2d1 in _0xeccdec){if(_0xeccdec[_0xde14('0x98')](_0x35d2d1)&&_[_0xde14('0x9f')](_0xeccdec[_0x35d2d1])){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')]('AWS_LEX_%s',_0x35d2d1[_0xde14('0x6b')]()),_0xeccdec[_0x35d2d1]);}}if(_[_0xde14('0x48')](_0xeccdec[_0xde14('0x7a')])){return this['channel']['noop'](_0xde14('0x131'));}else{this[_0xde14('0x45')](_0xeccdec[_0xde14('0x7a')],_0xde14('0xf0'),'amazonlex','');return this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x132'),_0xeccdec[_0xde14('0x7a')]));}}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2418aa,_0xde14('0x133'));};AGIVertices['prototype'][_0xde14('0x134')]=function(_0x23f836){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x135'),_0x23f836['label'],_0x23f836[_0xde14('0x68')]));if(!this[_0xde14('0x89')](_0x23f836[_0xde14('0x7e')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20key\x20configured');}var _0x414d78=_0xde14('0x136');var _0x535874=util[_0xde14('0x2b')](_0xde14('0x137'),FILES_PATH,rs[_0xde14('0x120')](0x4));var _0x4123ee=util['format'](_0xde14('0xa1'),_0x535874,_0x414d78);var _0x110ed9=!![];if(_0x23f836[_0xde14('0x138')]==='NOBEEP'){_0x110ed9=![];}var _0x5d1855=this[_0xde14('0xe')][_0xde14('0x139')](_0x535874,_0x414d78,_0x23f836[_0xde14('0x13a')],_0x23f836['timeout'],undefined,_0x110ed9);if(_0x5d1855[_0xde14('0xa7')]!==-0x1){this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x13b'),_0x4123ee));var _0x50fed2=this[_0xde14('0x92')][_0xde14('0x73')](this,_0x23f836,_0x4123ee);if(_0x50fed2){for(var _0x1bae5c in _0x50fed2){if(_0x50fed2[_0xde14('0x98')](_0x1bae5c)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0x13c'),_0x1bae5c['toUpperCase']()),_0x50fed2[_0x1bae5c]);}}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x50fed2)));}}return _0x5d1855;};AGIVertices[_0xde14('0x16')][_0xde14('0x13d')]=function(_0x27ad9f){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x13e'),_0x27ad9f[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x27ad9f[_0xde14('0x95')])){return this[_0xde14('0xe')]['noop'](_0xde14('0x13f'));}if(!this[_0xde14('0x89')](_0x27ad9f[_0xde14('0x140')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x141'));}var _0x2e92ca=_0xde14('0x136');var _0x40a040=util[_0xde14('0x2b')](_0xde14('0x137'),FILES_PATH,rs['generate'](0x4));var _0x369f0e=util[_0xde14('0x2b')](_0xde14('0xa1'),_0x40a040,_0x2e92ca);var _0x5eb127=!![];if(_0x27ad9f[_0xde14('0x138')]===_0xde14('0x142')){_0x5eb127=![];}var _0x456165=this[_0xde14('0xe')][_0xde14('0x139')](_0x40a040,_0x2e92ca,_0x27ad9f[_0xde14('0x13a')],_0x27ad9f[_0xde14('0x68')],undefined,_0x5eb127);if(_0x456165['result']!==-0x1){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x143'),_0x369f0e));var _0x1fe8b1=this['tildeASR']['sync'](this,_0x27ad9f,_0x369f0e);if(_0x1fe8b1){for(var _0x5a03a6 in _0x1fe8b1){if(_0x1fe8b1[_0xde14('0x98')](_0x5a03a6)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')]('TILDE_ASR_%s',_0x5a03a6[_0xde14('0x6b')]()),_0x1fe8b1[_0x5a03a6]);}}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x144'),JSON[_0xde14('0x76')](_0x1fe8b1)));}}return _0x456165;};AGIVertices[_0xde14('0x16')][_0xde14('0x145')]=function(_0x375d9f){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x146'),_0x375d9f[_0xde14('0x3b')]));return this[_0xde14('0xe')]['continueAt'](_0x375d9f[_0xde14('0x41')],_0x375d9f[_0xde14('0x147')],_0x375d9f[_0xde14('0x148')]);};AGIVertices[_0xde14('0x16')]['gotoif']=function(_0x45636b){logger['info'](util['format'](_0xde14('0x149'),_0x45636b['label']));if(!this[_0xde14('0x89')](_0x45636b[_0xde14('0x14a')])){return this[_0xde14('0xe')]['error'](_0x45636b,_0xde14('0x14b'));}try{var _0x4444a0=eval(_0x45636b[_0xde14('0x14a')])?_0xde14('0x14c'):'false';this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x14d'),_0x45636b['condition'],_0x4444a0));return{'code':0xc8,'result':_0x4444a0};}catch(_0x1475fa){return{'code':0xc8,'result':_0xde14('0x14e')};}};AGIVertices[_0xde14('0x16')][_0xde14('0x14f')]=function(_0xba6900){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x150'),_0xba6900[_0xde14('0x3b')]));if(!this['isConfigured'](_0xba6900[_0xde14('0x151')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0xba6900,_0xde14('0x152'));}var _0x39b35f=this[_0xde14('0x153')]['sync'](this,_0xba6900[_0xde14('0x151')]);if(!_0x39b35f){return this[_0xde14('0xe')]['error'](_0xba6900,_0xde14('0x154'));}for(var _0x3ccee7=0x0;_0x3ccee7<_0x39b35f[_0xde14('0x9e')];_0x3ccee7+=0x1){var _0x550992=this[_0xde14('0xe')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x39b35f[_0x3ccee7]));if(_0x550992[_0xde14('0xa7')]===-0x1){return _0x550992;}logger['info'](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],_0x550992['extra']));if(_0x550992['extra']===_0xde14('0x14c')){logger['info'](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],'true'));this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],'true'));return{'code':0xc8,'result':_0xde14('0x14c')};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')]('IFTIME\x20%s\x20%s',_0x39b35f[_0x3ccee7],'false'));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],_0xde14('0x14e')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xde14('0x16')][_0xde14('0x156')]=function(_0x1a3d33){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1a3d33[_0xde14('0x3b')]));return this[_0xde14('0xe')]['hangup']();};AGIVertices[_0xde14('0x16')][_0xde14('0x157')]=function(_0x1c0813){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1c0813[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x1c0813[_0xde14('0x7e')])){return this[_0xde14('0xe')]['noop'](_0xde14('0xeb'));}var _0x59be8a=_0xde14('0x136');var _0x2d91e5=util[_0xde14('0x2b')](_0xde14('0x137'),FILES_PATH,rs[_0xde14('0x120')](0x4));var _0x326ab6=util[_0xde14('0x2b')](_0xde14('0xa1'),_0x2d91e5,_0x59be8a);var _0x1637dd=!![];if(_0x1c0813[_0xde14('0x138')]===_0xde14('0x142')){_0x1637dd=![];}var _0x1b2501=this['channel'][_0xde14('0x139')](_0x2d91e5,_0x59be8a,_0x1c0813['intKey'],_0x1c0813[_0xde14('0x68')],undefined,_0x1637dd);if(_0x1b2501[_0xde14('0xa7')]!==-0x1){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('ispeech\x20%s\x20file\x20created',_0x326ab6));var _0x3c2f49=this[_0xde14('0x87')]['sync'](this,_0x1c0813,_0x326ab6);if(_0x3c2f49){for(var _0x3a9df8 in _0x3c2f49){if(_0x3c2f49['hasOwnProperty'](_0x3a9df8)){this['channel'][_0xde14('0xa2')](util['format'](_0xde14('0x158'),_0x3a9df8['toUpperCase']()),_0x3c2f49[_0x3a9df8]);}}return this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x159'),JSON[_0xde14('0x76')](_0x3c2f49)));}}return _0x1b2501;};AGIVertices[_0xde14('0x16')][_0xde14('0x15a')]=function(_0x19c9b0){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x15b'),_0x19c9b0[_0xde14('0x3b')]));if(!this['isConfigured'](_0x19c9b0[_0xde14('0x7e')])){return this['channel']['noop'](_0xde14('0xeb'));}if(!this['isConfigured'](_0x19c9b0['text'])){return this['channel'][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x19c9b0[_0xde14('0x5e')]));var _0x5cb1e5=this['ispeechTTS']['sync'](this,_0x19c9b0);if(_0x5cb1e5){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x15c'),_0x5cb1e5));var _0x4697f=this[_0xde14('0xe')][_0xde14('0x105')](_0x5cb1e5,_0x19c9b0[_0xde14('0x13a')]);try{fs[_0xde14('0x12c')](_0x5cb1e5+_0xde14('0x12d'));}catch(_0x47baf5){logger[_0xde14('0x2e')](_0x47baf5);}return _0x4697f;}return this['channel']['error'](_0x19c9b0,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xde14('0x16')][_0xde14('0x15d')]=function(_0x2b950f){logger['info'](util[_0xde14('0x2b')](_0xde14('0x15e'),_0x2b950f['label']));if(!this[_0xde14('0x89')](_0x2b950f['findBy'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2b950f,_0xde14('0x15f'));}logger[_0xde14('0x30')](util[_0xde14('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xde14('0xe')][_0xde14('0x3e')],_0x2b950f['findBy']));var _0x4f2a56=this[_0xde14('0x57')][_0xde14('0x73')](this,_0x2b950f[_0xde14('0x160')]);if(_0x4f2a56){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x161'),this[_0xde14('0xe')]['callerid'],_0x2b950f[_0xde14('0x160')]));this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x2b950f[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x162')};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x163'),this[_0xde14('0xe')]['callerid'],_0x2b950f[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x163'),this['channel'][_0xde14('0x3e')],_0x2b950f['findBy']));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices[_0xde14('0x16')][_0xde14('0x165')]=function(_0x15ce1e){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x15ce1e[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x15ce1e[_0xde14('0x160')])){return this['channel'][_0xde14('0x2e')](_0x15ce1e,_0xde14('0x15f'));}logger[_0xde14('0x30')](util[_0xde14('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));var _0x24d34c=this['agentLogout'][_0xde14('0x73')](this,_0x15ce1e[_0xde14('0x160')]);if(_0x24d34c){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));this[_0xde14('0xe')]['noop'](util['format'](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x162')};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x163'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x163'),this['channel'][_0xde14('0x3e')],_0x15ce1e['findBy']));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices[_0xde14('0x16')]['math']=function(_0x450446){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x166'),_0x450446[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x450446[_0xde14('0x167')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x450446,_0xde14('0x168'));}this['channel']['noop'](util['format'](_0xde14('0x169'),_0x450446['operation']));var _0x30596=eval(_0x450446[_0xde14('0x167')]);if(!this['isConfigured'](_0x450446['variable_id'])){return this[_0xde14('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5651bd=this[_0xde14('0x11')]['sync'](this,_0x450446['variable_id']);if(!_0x5651bd){return this['channel'][_0xde14('0x2e')](_0x450446,_0xde14('0xdc'));}if(_[_0xde14('0x9d')](_0x30596)){var _0x202b9b=this;_0x30596['forEach'](function(_0x51c122,_0x54f94a){_0x202b9b[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0x16a'),_0x5651bd,_0x54f94a),_0x51c122);});return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('variable\x20%s[key]\x20set',_0x5651bd));}else{return this[_0xde14('0xe')][_0xde14('0xa2')](_0x5651bd,_0x30596);}};AGIVertices['prototype']['menu']=function(_0x521c39){logger[_0xde14('0x30')](util['format'](_0xde14('0x16b'),_0x521c39[_0xde14('0x3b')]));if(_0x521c39[_0xde14('0xa9')]===0x0){return this[_0xde14('0xa8')](_0x521c39);}_0x521c39[_0xde14('0xa9')]-=0x1;if(!this[_0xde14('0x89')](_0x521c39[_0xde14('0x114')])){return this[_0xde14('0xe')]['error'](_0x521c39,_0xde14('0x115'));}var _0x57ee7c=this['getSound']['sync'](this,_0x521c39[_0xde14('0x114')]);if(!_0x57ee7c){return this['channel'][_0xde14('0x2e')](_0x521c39,'no\x20file\x20audio\x20found');}var _0x3946de=this[_0xde14('0xe')][_0xde14('0x117')](_0x57ee7c,_0x521c39[_0xde14('0x118')],_0x521c39['digit']);var _0x287cfd=_0x3946de[_0xde14('0xa7')];if(_0x3946de['result']===-0x1){this[_0xde14('0x39')]['sync'](this,_0x521c39,'-1');return _0x3946de;}else if(_0x3946de[_0xde14('0xa5')]==='timeout'){_0x3946de[_0xde14('0xa7')]=_0x3946de[_0xde14('0xa7')][_0xde14('0x9e')]>0x0?_0x3946de['result']:'t';}else if(_[_0xde14('0x47')](_0x3946de[_0xde14('0xa7')])){_0x3946de['result']='#';_0x287cfd='#';}if(!this['isConfigured'](_0x521c39[_0xde14('0xda')])){this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xdb'));}else{var _0x111280=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x521c39[_0xde14('0xda')]);if(!_0x111280){return this['channel']['error'](_0x521c39,'no\x20variable\x20found');}this[_0xde14('0xe')][_0xde14('0xa2')](_0x111280,_0x287cfd);}this[_0xde14('0x39')]['sync'](this,_0x521c39,_0x287cfd);return _0x3946de;};AGIVertices[_0xde14('0x16')][_0xde14('0xab')]=function(_0x3cd310){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x16c'),_0x3cd310[_0xde14('0x3b')]));return this['channel'][_0xde14('0xab')](_0x3cd310[_0xde14('0x16d')]||_0x3cd310[_0xde14('0x3b')]);};AGIVertices[_0xde14('0x16')]['pause']=function(_0x6ebe80){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x6ebe80['label']));if(!this['isConfigured'](_0x6ebe80[_0xde14('0x160')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x6ebe80,'no\x20find\x20by\x20configured');}logger['info'](util[_0xde14('0x2b')](_0xde14('0x16e'),this['channel']['callerid'],_0x6ebe80[_0xde14('0x160')]));var _0x8c0dbf=this[_0xde14('0x51')]['sync'](this,_0x6ebe80[_0xde14('0x16f')]);var _0x3b2938=this['agentPause']['sync'](this,_0x6ebe80[_0xde14('0x160')],_0x8c0dbf);if(_0x3b2938){logger['info'](util[_0xde14('0x2b')](_0xde14('0x161'),this[_0xde14('0xe')]['callerid'],_0x6ebe80[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xde14('0x3e')],_0x6ebe80[_0xde14('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x163'),this['channel'][_0xde14('0x3e')],_0x6ebe80[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x6ebe80[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices['prototype']['playback']=function(_0x1afe52){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x1afe52[_0xde14('0x3b')]));if(!this['isConfigured'](_0x1afe52[_0xde14('0x114')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1afe52,_0xde14('0x115'));}var _0x51758f=this[_0xde14('0x20')][_0xde14('0x73')](this,_0x1afe52[_0xde14('0x114')]);if(!_0x51758f){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1afe52,_0xde14('0x116'));}var _0x21d47f=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0x170'),[_0x51758f,_0x1afe52['opts']]);if(_0x21d47f[_0xde14('0xa7')]===-0x1){return _0x21d47f;}return this['channel']['noop'](util[_0xde14('0x2b')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x51758f));};AGIVertices[_0xde14('0x16')][_0xde14('0x171')]=function(_0x5a299e){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x172'),_0x5a299e[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x5a299e['queue_id'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x5a299e,_0xde14('0x173'));}var _0x343bf9='';var _0x2fb734=parseInt(_0x5a299e[_0xde14('0x174')],0xa);if(isNaN(_0x2fb734)){_0x343bf9=_0x5a299e[_0xde14('0x174')];}else{_0x343bf9=this[_0xde14('0x17')][_0xde14('0x73')](this,_0x5a299e['queue_id']);if(!_0x343bf9){return this['channel'][_0xde14('0x2e')](_0x5a299e,_0xde14('0x175'));}}var _0x333eb7='';if(this[_0xde14('0x89')](_0x5a299e[_0xde14('0x114')])){var _0x8642b3=this[_0xde14('0x20')][_0xde14('0x73')](this,_0x5a299e[_0xde14('0x114')]);if(_0x8642b3){_0x333eb7=_0x8642b3;}}this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x5a299e,_0x343bf9);if(_0x5a299e[_0xde14('0xe7')][_0xde14('0x176')]('x')<0x0){_0x5a299e['opts']+='x';}if(_0x5a299e[_0xde14('0xe7')][_0xde14('0x176')]('X')<0x0){_0x5a299e[_0xde14('0xe7')]+='X';}this[_0xde14('0xe')][_0xde14('0xa2')](_0xde14('0x177'),_0x343bf9?_0x343bf9[_0xde14('0x178')]():'');var _0x4dd128=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0x179'),[_0x343bf9,_0x5a299e[_0xde14('0xe7')],_0x5a299e[_0xde14('0x66')],_0x333eb7,_0x5a299e[_0xde14('0x68')],_0x5a299e[_0xde14('0x7')],_0x5a299e[_0xde14('0x17a')],_0x5a299e['gosub'],'',_0x5a299e[_0xde14('0x17b')]]);if(_0x4dd128[_0xde14('0xa7')]===-0x1){return _0x4dd128;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xc6'),_0xde14('0x179'),_0x343bf9));};AGIVertices[_0xde14('0x16')]['record']=function(_0x3b92a1){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x17c'),_0x3b92a1[_0xde14('0x3b')]));var _0x594776=_0x3b92a1['recordingFormat']||_0xde14('0x136');var _0x455e36=util[_0xde14('0x2b')](_0xde14('0x17d'),this['channel'][_0xde14('0x3a')],rs[_0xde14('0x120')](0x5));var _0x33be53=util['format'](_0xde14('0x17e'),FILES_PATH,_0x455e36,_0x594776);var _0x49207f=util[_0xde14('0x2b')]('%s/recordings/%s',FILES_PATH,_0x455e36);this[_0xde14('0x3f')]['sync'](this,_0x3b92a1,_0x455e36,_0x33be53);this[_0xde14('0xe')]['setVariable'](_0xde14('0x17f'),_0x455e36);logger[_0xde14('0x30')](_0xde14('0x180'),_0x49207f,_0x594776,_0x3b92a1[_0xde14('0x181')],_0x3b92a1[_0xde14('0x68')]);return this['channel'][_0xde14('0x139')](_0x49207f,_0x594776,_0x3b92a1[_0xde14('0x181')],_0x3b92a1[_0xde14('0x68')],undefined,!![]);};AGIVertices[_0xde14('0x16')]['restapi']=function(_0x2e918b){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x182'),_0x2e918b[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x2e918b[_0xde14('0x66')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x183'));}var _0x16f024=this['restAPI']['sync'](this,_0x2e918b);logger[_0xde14('0x30')](util['format'](_0xde14('0x184'),util[_0xde14('0x185')](_0x16f024,{'showHidden':![],'depth':null})));if(!this[_0xde14('0x89')](_0x2e918b[_0xde14('0xda')])){return this['channel']['noop'](_0xde14('0x186'));}var _0x16fb7e=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x2e918b[_0xde14('0xda')]);if(!_0x16fb7e){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2e918b,_0xde14('0xdc'));}this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0x187'),_0x16fb7e),_0x16f024['statusCode']?_0x16f024[_0xde14('0x79')]:_0xde14('0x188'));this['channel'][_0xde14('0xa2')](util[_0xde14('0x2b')]('%s_STATUS_MESSAGE',_0x16fb7e),_0x16f024['statusMessage']?_0x16f024[_0xde14('0x78')]:'OK');if(_0x16f024['body']){try{this[_0xde14('0xa0')](_0x16f024[_0xde14('0x6c')],_0x16fb7e);}catch(_0x1bcfe9){logger[_0xde14('0x2e')](util[_0xde14('0x2b')](_0xde14('0x189'),_0x16fb7e));}}return this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x18a'),_0x16fb7e));};AGIVertices[_0xde14('0x16')][_0xde14('0x18b')]=function(_0x393003){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x18c'),_0x393003['label']));return this[_0xde14('0xe')]['sayDigits'](_0x393003[_0xde14('0x18d')][_0xde14('0x5c')](/\s+/g,''),_0x393003[_0xde14('0x181')]);};AGIVertices[_0xde14('0x16')][_0xde14('0x18e')]=function(_0x469076){logger[_0xde14('0x30')](util['format'](_0xde14('0x18f'),_0x469076[_0xde14('0x3b')]));return this['channel']['sayNumber'](_0x469076[_0xde14('0x67')][_0xde14('0x5c')](/\s+/g,''),_0x469076[_0xde14('0x181')]);};AGIVertices[_0xde14('0x16')][_0xde14('0x190')]=function(_0x21b30c){logger['info'](util[_0xde14('0x2b')](_0xde14('0x191'),_0x21b30c[_0xde14('0x3b')]));return this['channel'][_0xde14('0x192')](_0x21b30c['text'],_0x21b30c[_0xde14('0x181')]);};AGIVertices[_0xde14('0x16')][_0xde14('0x193')]=function(_0x46811a){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x194'),_0x46811a[_0xde14('0x3b')]));if(!this['isConfigured'](_0x46811a[_0xde14('0x195')])){return this[_0xde14('0xe')]['noop'](_0xde14('0x196'));}var _0x587f65=this['getMailAccount'][_0xde14('0x73')](this,_0x46811a[_0xde14('0x195')]);if(!_0x587f65||!_0x587f65[_0xde14('0x197')]){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x46811a,'no\x20mail\x20account\x20found');}var _0x19e117={'from':util[_0xde14('0x2b')](_0xde14('0x198'),_0x587f65[_0xde14('0x14')],_0x587f65[_0xde14('0x199')]||_0x587f65[_0xde14('0x197')][_0xde14('0x19a')]),'to':_0x46811a['to']||'','cc':_0x46811a['cc']||'','bcc':_0x46811a[_0xde14('0x19b')]||'','subject':_0x46811a[_0xde14('0x19c')],'html':_0x46811a['text'],'text':_0x46811a['text']};if(this[_0xde14('0x89')](_0x46811a[_0xde14('0x19d')])){}logger['debug'](_0xde14('0x19e'),JSON['stringify'](_0x19e117));this[_0xde14('0x39')][_0xde14('0x73')](this,_0x46811a,_0x46811a[_0xde14('0x195')]);this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x19f'),_0x587f65[_0xde14('0x14')]));this['sendMailMessage'][_0xde14('0x73')](this,_0x587f65[_0xde14('0x1a0')],_0x19e117);return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1a1'));};AGIVertices[_0xde14('0x16')]['sendFax']=function(_0x8df4c6){logger['info'](util[_0xde14('0x2b')](_0xde14('0x1a2'),_0x8df4c6['label']));return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1a3'));};AGIVertices[_0xde14('0x16')][_0xde14('0x1a4')]=function(_0x7e6ec5){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x7e6ec5[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x7e6ec5['sms_account_id'])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1a5'));}var _0x6a02bb=this[_0xde14('0x36')][_0xde14('0x73')](this,_0x7e6ec5['sms_account_id']);if(!_0x6a02bb){return this[_0xde14('0xe')]['error'](_0x7e6ec5,_0xde14('0x1a6'));}var _0x1587a2={'body':_0x7e6ec5[_0xde14('0x1a7')],'phone':_0x7e6ec5['to']||'','SmsAccountId':_0x6a02bb['id']};logger['debug'](_0xde14('0x1a8'),JSON[_0xde14('0x76')](_0x1587a2));this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x7e6ec5,_0x7e6ec5[_0xde14('0x1a9')]);this['channel'][_0xde14('0xab')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x6a02bb[_0xde14('0x14')]));this[_0xde14('0x38')]['sync'](this,_0x1587a2);return this['channel'][_0xde14('0xab')](_0xde14('0x1aa'));};AGIVertices[_0xde14('0x16')][_0xde14('0x1ab')]=function(_0x3d7a0d){logger[_0xde14('0x30')](util['format'](_0xde14('0x1ac'),_0x3d7a0d[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x3d7a0d[_0xde14('0xda')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x3d7a0d,'no\x20variable\x20selected');}var _0x1ce2e1=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x3d7a0d[_0xde14('0xda')]);if(!_0x1ce2e1){return this[_0xde14('0xe')]['error'](_0x3d7a0d,_0xde14('0xdc'));}return this[_0xde14('0xe')][_0xde14('0xa2')](_0x1ce2e1,_0x3d7a0d['variable_value']);};AGIVertices[_0xde14('0x16')][_0xde14('0x1ad')]=function(_0x35f4ad){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x1ae'),_0x35f4ad['label']));this[_0xde14('0xe')]['noop'](_0xde14('0x1af'));var _0x58a34d=this[_0xde14('0xe')][_0xde14('0x11')](_0xde14('0x1b0'));if(!_[_0xde14('0x47')](_0x58a34d[_0xde14('0xa5')])){this[_0xde14('0xe')][_0xde14('0x3a')]=_0x58a34d[_0xde14('0xa5')];}if(_0x35f4ad[_0xde14('0xbc')]===_0xde14('0x1b1')){this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1b2'));return this[_0xde14('0xe')][_0xde14('0xbc')]();}return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1b3'));};AGIVertices[_0xde14('0x16')][_0xde14('0x1b4')]=function(_0x1671fc){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x1b5'),_0x1671fc['label']));if(!this[_0xde14('0x89')](_0x1671fc[_0xde14('0x1b6')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1671fc,'no\x20subproject\x20selected');}var _0x3c1f1b=this[_0xde14('0x18')][_0xde14('0x73')](this,_0x1671fc[_0xde14('0x1b6')]);if(!this['isConfigured'](_0x3c1f1b)){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1671fc,util[_0xde14('0x2b')](_0xde14('0x1b7'),_0x1671fc[_0xde14('0x1b6')]));}if(_0x3c1f1b===this[_0xde14('0xe')]['arg_1']){return this['channel'][_0xde14('0x2e')](_0x1671fc,_0xde14('0x1b8'));}this[_0xde14('0x39')][_0xde14('0x73')](this,_0x1671fc,_0x3c1f1b);var _0x3f55c3=this[_0xde14('0xe')][_0xde14('0xad')]('AGI',util['format'](_0xde14('0x1b9'),config[_0xde14('0x7')]['host']||_0xde14('0x1ba'),_0x3c1f1b,this[_0xde14('0xe')]['arg_1']));if(_0x3f55c3[_0xde14('0xa7')]===-0x1){return _0x3f55c3;}return this['channel'][_0xde14('0xab')](util['format']('Executed\x20command\x20%s\x20%s',_0xde14('0x1bb'),_0x3c1f1b));};AGIVertices[_0xde14('0x16')][_0xde14('0x1bc')]=function(_0x218678){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x1bd'),_0x218678[_0xde14('0x3b')]));var _0x1cfb4f=this[_0xde14('0x5b')][_0xde14('0x73')](this,_0x218678['command']);this[_0xde14('0x39')]['sync'](this,_0x218678,_0x218678[_0xde14('0xba')]);if(this[_0xde14('0x89')](_0x218678['variable_id'])){var _0x389d19=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x218678[_0xde14('0xda')]);if(_0x389d19){this[_0xde14('0xe')][_0xde14('0xa2')](_0x389d19,_0x1cfb4f);return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1be'),_0x218678[_0xde14('0xba')],_0x389d19));}}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x1bf'),_0x218678[_0xde14('0xba')]));};AGIVertices[_0xde14('0x16')]['google_cloud_tts']=function(_0x3145c2){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3145c2[_0xde14('0x3b')]));_0x3145c2[_0xde14('0x5e')]=_0x3145c2[_0xde14('0x5e')][_0xde14('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xde14('0x89')](_0x3145c2[_0xde14('0x1c0')])){return this['channel'][_0xde14('0xab')](_0xde14('0x1c1'));}if(!this[_0xde14('0x89')](_0x3145c2[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c2'),_0x3145c2[_0xde14('0x5e')]));var _0x396139=this[_0xde14('0x5d')][_0xde14('0x73')](this,_0x3145c2);if(_0x396139){this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c3'),_0x396139));var _0x1a3199=this[_0xde14('0xe')][_0xde14('0x105')](_0x396139);try{fs['unlink'](_0x396139+_0xde14('0x12d'));}catch(_0x3ab726){logger[_0xde14('0x2e')](_0x3ab726);}return _0x1a3199;}return this['channel']['error'](_0x3145c2,_0xde14('0x1c4'));};AGIVertices['prototype'][_0xde14('0x1c5')]=function(_0x5e0f1d){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5e0f1d[_0xde14('0x3b')]));_0x5e0f1d[_0xde14('0x5e')]=_0x5e0f1d[_0xde14('0x5e')][_0xde14('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xde14('0x89')](_0x5e0f1d[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c6'),_0x5e0f1d[_0xde14('0x5e')]));var _0x20c01f=this['googleTTS'][_0xde14('0x73')](this,_0x5e0f1d);if(_0x20c01f){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c7'),_0x20c01f));var _0x5a121f=this[_0xde14('0xe')][_0xde14('0x105')](_0x20c01f);try{fs[_0xde14('0x12c')](_0x20c01f+_0xde14('0x12d'));}catch(_0x482555){logger[_0xde14('0x2e')](_0x482555);}return _0x5a121f;}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x5e0f1d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['unpause']=function(_0x406e2d){logger['info'](util[_0xde14('0x2b')](_0xde14('0x1c8'),_0x406e2d['label']));if(!this[_0xde14('0x89')](_0x406e2d[_0xde14('0x160')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x406e2d,_0xde14('0x15f'));}logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x16e'),this[_0xde14('0xe')]['callerid'],_0x406e2d[_0xde14('0x160')]));var _0x310399=this[_0xde14('0x55')]['sync'](this,_0x406e2d[_0xde14('0x160')]);if(_0x310399){logger[_0xde14('0x30')](util['format'](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x406e2d[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x161'),this['channel']['callerid'],_0x406e2d[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x162')};}else{logger['info'](util['format'](_0xde14('0x163'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x406e2d[_0xde14('0x160')]));this[_0xde14('0xe')]['noop'](util['format'](_0xde14('0x163'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x406e2d[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices['prototype'][_0xde14('0x1c9')]=function(_0x21758d){logger[_0xde14('0x30')](util['format'](_0xde14('0x1ca'),_0x21758d[_0xde14('0x3b')]));var _0x4a1953=this['channel'][_0xde14('0xad')](_0xde14('0x1cb'),[_0x21758d['mailbox'],_0x21758d[_0xde14('0x7c')]]);if(_0x4a1953[_0xde14('0xa7')]===-0x1){return _0x4a1953;}return this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0xc6'),_0xde14('0x1cb'),_0x21758d[_0xde14('0x1cc')]));};AGIVertices[_0xde14('0x16')][_0xde14('0x1cd')]=function(_0x2ab908){logger[_0xde14('0x30')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2ab908[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x2ab908[_0xde14('0xda')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2ab908,_0xde14('0x1ce'));}var _0x1ba06c=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x2ab908['variable_id']);if(!_0x1ba06c){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2ab908,'no\x20variable\x20found');}var _0x4d2709=this[_0xde14('0xe')][_0xde14('0x11')](_0x1ba06c);return{'code':0xc8,'result':_0x4d2709[_0xde14('0xa5')]?_0x4d2709[_0xde14('0xa5')]:'-'};};String[_0xde14('0x16')]['replaceAll']=function(_0x3db640,_0x1cfd3c){return this[_0xde14('0xa3')](_0x3db640)['join'](_0x1cfd3c);};module[_0xde14('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 953e67f..5bf371e 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 _0xfe5b=['[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','prototype','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','finally','[ACW][START]\x20%s','getAgent','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xfe5b,0x1b8));var _0xbfe5=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xfe5b[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0xbfe5('0x0'));var moment=require('moment');var ami=require(_0xbfe5('0x1'));var logger=require(_0xbfe5('0x2'))(_0xbfe5('0x3'));var RpcUser=require(_0xbfe5('0x4'));var RpcVoiceAgentReport=require(_0xbfe5('0x5'));function Acw(_0x286e65){this[_0xbfe5('0x6')]=_0x286e65[_0xbfe5('0x6')];this[_0xbfe5('0x7')]=_0x286e65[_0xbfe5('0x7')];this[_0xbfe5('0x8')]=_0x286e65[_0xbfe5('0x8')];this[_0xbfe5('0x9')]={};ami['on'](_0xbfe5('0xa'),this[_0xbfe5('0xb')][_0xbfe5('0xc')](this));ami['on'](_0xbfe5('0xd'),this[_0xbfe5('0xe')][_0xbfe5('0xc')](this));ami['on']('hangup',this[_0xbfe5('0xf')][_0xbfe5('0xc')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xbfe5('0x10'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xbfe5('0x11'),this[_0xbfe5('0x12')][_0xbfe5('0xc')](this));ami['on'](_0xbfe5('0x13'),this[_0xbfe5('0x14')][_0xbfe5('0xc')](this));}function getDiff(_0xea1a82){var _0x1d6838=moment()[_0xbfe5('0x15')](0x0);var _0x13384=moment(_0xea1a82)[_0xbfe5('0x15')](0x0);return _0x1d6838['diff'](_0x13384,'seconds');}Acw[_0xbfe5('0x16')]['updateAcw']=function(_0x1556cb,_0x169603){var _0x493c2f=this;var _0x20f35f=getDiff(_0x493c2f['timers'][_0x1556cb][_0xbfe5('0x17')]);clearTimeout(_0x493c2f['timers'][_0x1556cb]['timer']);_0x493c2f['timers'][_0x1556cb][_0xbfe5('0x18')]=![];return RpcVoiceAgentReport[_0xbfe5('0x19')]({'acwtime':_0x20f35f},_0x493c2f[_0xbfe5('0x8')][_0x1556cb][_0xbfe5('0x1a')],_0x1556cb)[_0xbfe5('0x1b')](function(_0x479fd2){logger[_0xbfe5('0x1c')](_0xbfe5('0x1d'),_0x169603,_0x20f35f,_0x479fd2);})[_0xbfe5('0x1e')](function(_0xa02ca0){logger[_0xbfe5('0x1f')](_0xbfe5('0x20'),_0x169603,_0xa02ca0);})['finally'](function(){delete _0x493c2f[_0xbfe5('0x8')][_0x1556cb];});};Acw[_0xbfe5('0x16')][_0xbfe5('0x21')]=function(_0x1b68c7){try{var _0x42532f=this;var _0x381787=this[_0xbfe5('0x9')][_0x1b68c7]['interface'];var _0x597123=this[_0xbfe5('0x9')][_0x1b68c7][_0xbfe5('0x22')];var _0x489925=this['voiceQueues'][_0x597123];var _0x2af9d9=![];var _0x2b9a6c=_0xbfe5('0x23');if(_0x489925[_0xbfe5('0x24')]&&_0x489925['mandatoryDispositionPause']['name']){_0x2af9d9=!![];_0x2b9a6c=_0x489925[_0xbfe5('0x25')]['name'];}return ami[_0xbfe5('0x26')]({'action':_0xbfe5('0x27'),'interface':_0x381787,'paused':!![],'reason':_0x2b9a6c})[_0xbfe5('0x1b')](function(){if(_0x42532f['agents'][_0x381787]){return RpcUser['getAgent'](_0x42532f[_0xbfe5('0x7')][_0x381787]['id'])[_0xbfe5('0x1b')](function(_0x46740a){if(!_0x46740a||_0x46740a[_0xbfe5('0x28')]){logger[_0xbfe5('0x1c')](_0xbfe5('0x29'),_0x1b68c7,_0x381787,_0x597123);return;}logger[_0xbfe5('0x1c')](_0xbfe5('0x2a'),_0x1b68c7,_0x381787,_0x597123);var _0x4eed45=_0x42532f[_0xbfe5('0x9')][_0x1b68c7][_0xbfe5('0x2b')]&&_0x42532f[_0xbfe5('0x9')][_0x1b68c7][_0xbfe5('0x2c')]?_0x42532f[_0xbfe5('0x9')][_0x1b68c7][_0xbfe5('0x2c')]:_0x1b68c7;return RpcUser[_0xbfe5('0x2d')](_0x42532f['agents'][_0x381787],_0x2b9a6c,_0x4eed45)['then'](function(_0x2c338f){_0x42532f[_0xbfe5('0x6')][_0x597123][_0xbfe5('0x2e')]-=0x1;_0x42532f[_0xbfe5('0x6')][_0x597123]['paused']+=0x1;return _0x2c338f;});})['then'](function(_0x484e1f){if(_0x2af9d9||!_0x484e1f){return;}_0x42532f[_0xbfe5('0x8')][_0x381787]={};logger['info'](_0xbfe5('0x2f'),_0x1b68c7,_0x42532f[_0xbfe5('0x6')][_0x597123][_0xbfe5('0x30')],_0x381787,_0x597123);_0x42532f['timers'][_0x381787][_0xbfe5('0x18')]=setTimeout(_0x42532f[_0xbfe5('0x31')][_0xbfe5('0xc')](_0x42532f,_0x381787),_0x42532f[_0xbfe5('0x6')][_0x597123][_0xbfe5('0x30')]*0x3e8);_0x42532f[_0xbfe5('0x8')][_0x381787][_0xbfe5('0x17')]=moment()[_0xbfe5('0x32')](_0xbfe5('0x33'));_0x42532f[_0xbfe5('0x8')][_0x381787][_0xbfe5('0x1a')]=_0x1b68c7;_0x42532f['timers'][_0x381787][_0xbfe5('0x22')]=_0x597123;_0x42532f[_0xbfe5('0x8')][_0x381787][_0xbfe5('0x34')]=_0x42532f[_0xbfe5('0x34')][_0xbfe5('0xc')](_0x42532f,_0x381787,_0x1b68c7);});}})[_0xbfe5('0x1e')](function(){logger[_0xbfe5('0x1f')](_0xbfe5('0x2f'),_0x1b68c7,_0x42532f[_0xbfe5('0x6')][_0x597123][_0xbfe5('0x30')],_0x381787,_0x597123);})[_0xbfe5('0x35')](function(){delete _0x42532f['channels'][_0x1b68c7];});}catch(_0x2566fc){logger['error'](_0xbfe5('0x36'),_0x2566fc['message']);}};Acw[_0xbfe5('0x16')][_0xbfe5('0x31')]=function(_0xfb81d4){try{var _0x41d2e7=this;if(_0x41d2e7[_0xbfe5('0x8')][_0xfb81d4]){_0x41d2e7['timers'][_0xfb81d4][_0xbfe5('0x18')]=![];var _0x12bd66=_0x41d2e7[_0xbfe5('0x8')][_0xfb81d4][_0xbfe5('0x1a')];var _0x16c868=_0x41d2e7['timers'][_0xfb81d4][_0xbfe5('0x22')];var _0x3cd622=_0x41d2e7[_0xbfe5('0x6')][_0x16c868][_0xbfe5('0x30')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x12bd66,_0xfb81d4);RpcUser[_0xbfe5('0x37')](this[_0xbfe5('0x7')][_0xfb81d4]['id'])['then'](function(_0x3eaf26){if(_0x3eaf26['pauseType']===_0xbfe5('0x23')){return RpcUser[_0xbfe5('0x38')](_0x41d2e7['agents'][_0xfb81d4]);}});RpcVoiceAgentReport[_0xbfe5('0x19')]({'acwtime':_0x3cd622,'agentacw':!![]},_0x12bd66,_0xfb81d4)['then'](function(_0x3595a1){logger[_0xbfe5('0x1c')](_0xbfe5('0x1d'),_0x12bd66,_0x3cd622,_0x3595a1);})[_0xbfe5('0x1e')](function(_0x5cf96d){logger[_0xbfe5('0x1f')](_0xbfe5('0x20'),_0x12bd66,_0x5cf96d);});}else{logger[_0xbfe5('0x1f')](_0xbfe5('0x39'),_0xfb81d4);if(_0x41d2e7[_0xbfe5('0x8')]){logger[_0xbfe5('0x1c')](_0xbfe5('0x3a'),JSON[_0xbfe5('0x3b')](_0x41d2e7['timers']));}}}catch(_0xa74327){logger[_0xbfe5('0x1f')](_0xbfe5('0x3c'),_0xa74327[_0xbfe5('0x3d')]);}};Acw[_0xbfe5('0x16')][_0xbfe5('0xb')]=function(_0x4213c1){try{if(this[_0xbfe5('0x6')][_0x4213c1[_0xbfe5('0x22')]]&&(this['voiceQueues'][_0x4213c1['queue']][_0xbfe5('0x3')]||this[_0xbfe5('0x6')][_0x4213c1[_0xbfe5('0x22')]][_0xbfe5('0x24')])){if(this[_0xbfe5('0x7')][_0x4213c1['interface']]){this[_0xbfe5('0x9')][_0x4213c1[_0xbfe5('0x1a')]]={'queue':_0x4213c1[_0xbfe5('0x22')],'interface':_0x4213c1[_0xbfe5('0x3e')],'destlinkedid':_0x4213c1[_0xbfe5('0x2c')]};}}}catch(_0x3423d1){logger['error'](_0xbfe5('0x3f'),_0x3423d1[_0xbfe5('0x3d')]);}};Acw[_0xbfe5('0x16')][_0xbfe5('0x14')]=function(_0x3d0953){try{if(this[_0xbfe5('0x6')][_0x3d0953[_0xbfe5('0x22')]]&&(this['voiceQueues'][_0x3d0953[_0xbfe5('0x22')]][_0xbfe5('0x3')]||this[_0xbfe5('0x6')][_0x3d0953['queue']][_0xbfe5('0x24')])){if(this[_0xbfe5('0x7')][_0x3d0953['interface']]){this[_0xbfe5('0x9')][_0x3d0953['uniqueid']]={'queue':_0x3d0953['queue'],'interface':_0x3d0953[_0xbfe5('0x3e')]};}}}catch(_0x8ccb39){logger[_0xbfe5('0x1f')](_0xbfe5('0x40'),_0x8ccb39[_0xbfe5('0x3d')]);}};Acw[_0xbfe5('0x16')][_0xbfe5('0xe')]=function(_0x2d0adc){try{if(this[_0xbfe5('0x9')][_0x2d0adc[_0xbfe5('0x1a')]]&&_['isUndefined'](this[_0xbfe5('0x9')][_0x2d0adc[_0xbfe5('0x1a')]]['attended'])){logger[_0xbfe5('0x1c')](_0xbfe5('0x41'),_0x2d0adc[_0xbfe5('0x1a')]);this[_0xbfe5('0x21')](_0x2d0adc[_0xbfe5('0x1a')]);}else if(this[_0xbfe5('0x9')][_0x2d0adc[_0xbfe5('0x42')]]&&_['isUndefined'](this[_0xbfe5('0x9')][_0x2d0adc[_0xbfe5('0x42')]][_0xbfe5('0x2b')])){logger['info'](_0xbfe5('0x43'),_0x2d0adc[_0xbfe5('0x42')]);this['startAcw'](_0x2d0adc['linkedid']);}}catch(_0xe53c5f){logger[_0xbfe5('0x1f')](_0xbfe5('0x44'),_0xe53c5f[_0xbfe5('0x3d')]);}};Acw[_0xbfe5('0x16')][_0xbfe5('0xf')]=function(_0x5923d0){try{if(this[_0xbfe5('0x9')][_0x5923d0['uniqueid']]&&this[_0xbfe5('0x9')][_0x5923d0[_0xbfe5('0x1a')]][_0xbfe5('0x2b')]){logger[_0xbfe5('0x1c')](_0xbfe5('0x45'),_0x5923d0[_0xbfe5('0x1a')]);this[_0xbfe5('0x21')](_0x5923d0['uniqueid']);}else if(this[_0xbfe5('0x9')][_0x5923d0['linkedid']]&&this['channels'][_0x5923d0['linkedid']][_0xbfe5('0x2b')]){logger[_0xbfe5('0x1c')](_0xbfe5('0x46'),_0x5923d0[_0xbfe5('0x42')]);this[_0xbfe5('0x21')](_0x5923d0[_0xbfe5('0x42')]);}}catch(_0x515438){logger[_0xbfe5('0x1f')](_0xbfe5('0x47'),_0x515438[_0xbfe5('0x3d')]);}};Acw[_0xbfe5('0x16')]['syncAttendedTransfer']=function(_0x17f33c){try{if(!_[_0xbfe5('0x48')](this[_0xbfe5('0x9')][_0x17f33c[_0xbfe5('0x49')]])){this[_0xbfe5('0x21')](_0x17f33c[_0xbfe5('0x49')]);if(this[_0xbfe5('0x9')][_0x17f33c['secondtransfereruniqueid']]){this['channels'][_0x17f33c['secondtransfereruniqueid']][_0xbfe5('0x2b')]=!![];this[_0xbfe5('0x9')][_0x17f33c[_0xbfe5('0x4a')]]=this[_0xbfe5('0x9')][_0x17f33c[_0xbfe5('0x4b')]];delete this[_0xbfe5('0x9')][_0x17f33c[_0xbfe5('0x4b')]];}}else if(!_[_0xbfe5('0x48')](this[_0xbfe5('0x9')][_0x17f33c['transfertargetuniqueid']])){this['startAcw'](_0x17f33c[_0xbfe5('0x4a')]);if(this[_0xbfe5('0x9')][_0x17f33c[_0xbfe5('0x4c')]]){this['channels'][_0x17f33c[_0xbfe5('0x4c')]][_0xbfe5('0x2b')]=!![];this['channels'][_0x17f33c[_0xbfe5('0x49')]]=this[_0xbfe5('0x9')][_0x17f33c[_0xbfe5('0x4c')]];delete this[_0xbfe5('0x9')][_0x17f33c['origtransfereruniqueid']];}}}catch(_0xdcbd2e){logger[_0xbfe5('0x1f')](_0xbfe5('0x4d'),_0xdcbd2e[_0xbfe5('0x3d')]);}};Acw[_0xbfe5('0x16')][_0xbfe5('0x12')]=function(_0x2b3c6a){try{if(this['channels'][_0x2b3c6a[_0xbfe5('0x4e')]]){logger[_0xbfe5('0x1c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xbfe5('0x3b')](_0x2b3c6a[_0xbfe5('0x4e')]));this['startAcw'](_0x2b3c6a['transfereruniqueid']);}else if(this['channels'][_0x2b3c6a['transfererlinkedid']]){logger[_0xbfe5('0x1c')](_0xbfe5('0x4f'),JSON[_0xbfe5('0x3b')](_0x2b3c6a[_0xbfe5('0x50')]));this[_0xbfe5('0x21')](_0x2b3c6a['transfererlinkedid']);}}catch(_0xa25bf8){logger[_0xbfe5('0x1f')](_0xbfe5('0x51'),_0xa25bf8[_0xbfe5('0x3d')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x23d5c2){try{if(this[_0xbfe5('0x6')][_0x23d5c2['queue']]&&this[_0xbfe5('0x6')][_0x23d5c2[_0xbfe5('0x22')]]['autopause']===_0xbfe5('0x52')){if(this[_0xbfe5('0x7')][_0x23d5c2['interface']]){logger[_0xbfe5('0x1c')](_0xbfe5('0x53'),_0x23d5c2['uniqueid'],_0x23d5c2[_0xbfe5('0x3e')],_0x23d5c2[_0xbfe5('0x22')]);return RpcUser[_0xbfe5('0x2d')](this['agents'][_0x23d5c2[_0xbfe5('0x3e')]],'Auto-Pause',_0x23d5c2[_0xbfe5('0x1a')]);}}}catch(_0x1e21d2){logger['error'](_0xbfe5('0x54'),_0x1e21d2[_0xbfe5('0x3d')]);}};module['exports']=Acw; \ No newline at end of file +var _0x4367=['transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','mandatoryDisposition','destlinkedid','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4367,0x113));var _0x7436=function(_0x27b0fe,_0x1d2394){_0x27b0fe=_0x27b0fe-0x0;var _0x393919=_0x4367[_0x27b0fe];return _0x393919;};'use strict';var _=require(_0x7436('0x0'));var moment=require('moment');var ami=require(_0x7436('0x1'));var logger=require(_0x7436('0x2'))(_0x7436('0x3'));var RpcUser=require(_0x7436('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5db02a){this['voiceQueues']=_0x5db02a[_0x7436('0x5')];this[_0x7436('0x6')]=_0x5db02a[_0x7436('0x6')];this[_0x7436('0x7')]=_0x5db02a[_0x7436('0x7')];this[_0x7436('0x8')]={};ami['on']('agentconnect',this[_0x7436('0x9')][_0x7436('0xa')](this));ami['on'](_0x7436('0xb'),this[_0x7436('0xc')][_0x7436('0xa')](this));ami['on'](_0x7436('0xd'),this[_0x7436('0xe')][_0x7436('0xa')](this));ami['on']('agentringnoanswer',this[_0x7436('0xf')][_0x7436('0xa')](this));ami['on']('attendedtransfer',this[_0x7436('0x10')][_0x7436('0xa')](this));ami['on'](_0x7436('0x11'),this[_0x7436('0x12')][_0x7436('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x7436('0x13')][_0x7436('0xa')](this));}function getDiff(_0x21523f){var _0x141ac0=moment()[_0x7436('0x14')](0x0);var _0x1d2ea9=moment(_0x21523f)[_0x7436('0x14')](0x0);return _0x141ac0[_0x7436('0x15')](_0x1d2ea9,_0x7436('0x16'));}Acw[_0x7436('0x17')][_0x7436('0x18')]=function(_0x1ac567,_0x117ccb){var _0x417b9d=this;var _0x1c1150=getDiff(_0x417b9d[_0x7436('0x7')][_0x1ac567][_0x7436('0x19')]);clearTimeout(_0x417b9d[_0x7436('0x7')][_0x1ac567]['timer']);_0x417b9d['timers'][_0x1ac567]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x1c1150},_0x417b9d[_0x7436('0x7')][_0x1ac567]['uniqueid'],_0x1ac567)[_0x7436('0x1a')](function(_0x36687d){logger[_0x7436('0x1b')](_0x7436('0x1c'),_0x117ccb,_0x1c1150,_0x36687d);})[_0x7436('0x1d')](function(_0x8c1dda){logger[_0x7436('0x1e')]('[%s][UPDATE][ERRORS:%s]',_0x117ccb,_0x8c1dda);})[_0x7436('0x1f')](function(){delete _0x417b9d[_0x7436('0x7')][_0x1ac567];});};Acw['prototype'][_0x7436('0x20')]=function(_0x6d8f0d){try{var _0x3973cf=this;var _0x21cfdd=this[_0x7436('0x8')][_0x6d8f0d][_0x7436('0x21')];var _0x5aecc1=this[_0x7436('0x8')][_0x6d8f0d][_0x7436('0x22')];var _0x4ee6eb=this[_0x7436('0x5')][_0x5aecc1];var _0x5b59fe=![];var _0x1a2122=_0x7436('0x23');if(_0x4ee6eb['mandatoryDisposition']&&_0x4ee6eb[_0x7436('0x24')][_0x7436('0x25')]){_0x5b59fe=!![];_0x1a2122=_0x4ee6eb[_0x7436('0x24')]['name'];}return ami[_0x7436('0x26')]({'action':_0x7436('0x27'),'interface':_0x21cfdd,'paused':!![],'reason':_0x1a2122})[_0x7436('0x1a')](function(){if(_0x3973cf[_0x7436('0x6')][_0x21cfdd]){return RpcUser['getAgent'](_0x3973cf['agents'][_0x21cfdd]['id'])['then'](function(_0x334832){if(!_0x334832||_0x334832[_0x7436('0x28')]){logger['info'](_0x7436('0x29'),_0x6d8f0d,_0x21cfdd,_0x5aecc1);return;}logger[_0x7436('0x1b')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x6d8f0d,_0x21cfdd,_0x5aecc1);var _0x362121=_0x3973cf['channels'][_0x6d8f0d][_0x7436('0x2a')]&&_0x3973cf[_0x7436('0x8')][_0x6d8f0d]['destlinkedid']?_0x3973cf[_0x7436('0x8')][_0x6d8f0d]['destlinkedid']:_0x6d8f0d;return RpcUser[_0x7436('0x2b')](_0x3973cf[_0x7436('0x6')][_0x21cfdd],_0x1a2122,_0x362121)[_0x7436('0x1a')](function(_0x3df706){_0x3973cf['voiceQueues'][_0x5aecc1][_0x7436('0x2c')]-=0x1;_0x3973cf[_0x7436('0x5')][_0x5aecc1]['paused']+=0x1;return _0x3df706;});})[_0x7436('0x1a')](function(_0xbcbb35){if(_0x5b59fe||!_0xbcbb35){return;}_0x3973cf[_0x7436('0x7')][_0x21cfdd]={};logger[_0x7436('0x1b')](_0x7436('0x2d'),_0x6d8f0d,_0x3973cf[_0x7436('0x5')][_0x5aecc1][_0x7436('0x2e')],_0x21cfdd,_0x5aecc1);_0x3973cf['timers'][_0x21cfdd][_0x7436('0x2f')]=setTimeout(_0x3973cf[_0x7436('0x30')][_0x7436('0xa')](_0x3973cf,_0x21cfdd),_0x3973cf[_0x7436('0x5')][_0x5aecc1][_0x7436('0x2e')]*0x3e8);_0x3973cf[_0x7436('0x7')][_0x21cfdd][_0x7436('0x19')]=moment()[_0x7436('0x31')](_0x7436('0x32'));_0x3973cf[_0x7436('0x7')][_0x21cfdd][_0x7436('0x33')]=_0x6d8f0d;_0x3973cf['timers'][_0x21cfdd]['queue']=_0x5aecc1;_0x3973cf[_0x7436('0x7')][_0x21cfdd][_0x7436('0x18')]=_0x3973cf[_0x7436('0x18')][_0x7436('0xa')](_0x3973cf,_0x21cfdd,_0x6d8f0d);});}})[_0x7436('0x1d')](function(){logger[_0x7436('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x6d8f0d,_0x3973cf[_0x7436('0x5')][_0x5aecc1][_0x7436('0x2e')],_0x21cfdd,_0x5aecc1);})[_0x7436('0x1f')](function(){delete _0x3973cf[_0x7436('0x8')][_0x6d8f0d];});}catch(_0x3ec8c3){logger[_0x7436('0x1e')](_0x7436('0x34'),_0x3ec8c3['message']);}};Acw[_0x7436('0x17')][_0x7436('0x30')]=function(_0xff1529){try{var _0x1ecdfd=this;if(_0x1ecdfd[_0x7436('0x7')][_0xff1529]){_0x1ecdfd[_0x7436('0x7')][_0xff1529][_0x7436('0x2f')]=![];var _0xcaa372=_0x1ecdfd['timers'][_0xff1529][_0x7436('0x33')];var _0x14f289=_0x1ecdfd[_0x7436('0x7')][_0xff1529][_0x7436('0x22')];var _0x2d3305=_0x1ecdfd[_0x7436('0x5')][_0x14f289][_0x7436('0x2e')];logger[_0x7436('0x1b')](_0x7436('0x35'),_0xcaa372,_0xff1529);RpcUser[_0x7436('0x36')](this[_0x7436('0x6')][_0xff1529]['id'])[_0x7436('0x1a')](function(_0x24ac45){if(_0x24ac45[_0x7436('0x37')]==='ACW'){return RpcUser[_0x7436('0x38')](_0x1ecdfd['agents'][_0xff1529]);}});RpcVoiceAgentReport[_0x7436('0x39')]({'acwtime':_0x2d3305,'agentacw':!![]},_0xcaa372,_0xff1529)[_0x7436('0x1a')](function(_0x53b160){logger[_0x7436('0x1b')](_0x7436('0x1c'),_0xcaa372,_0x2d3305,_0x53b160);})[_0x7436('0x1d')](function(_0x5caca9){logger[_0x7436('0x1e')]('[%s][UPDATE][ERRORS:%s]',_0xcaa372,_0x5caca9);});}else{logger[_0x7436('0x1e')](_0x7436('0x3a'),_0xff1529);if(_0x1ecdfd[_0x7436('0x7')]){logger[_0x7436('0x1b')](_0x7436('0x3b'),JSON[_0x7436('0x3c')](_0x1ecdfd[_0x7436('0x7')]));}}}catch(_0x12e6a0){logger[_0x7436('0x1e')]('[ACW][STOP]\x20%s',_0x12e6a0[_0x7436('0x3d')]);}};Acw[_0x7436('0x17')][_0x7436('0x9')]=function(_0x2adf0e){try{if(this[_0x7436('0x5')][_0x2adf0e['queue']]&&(this[_0x7436('0x5')][_0x2adf0e[_0x7436('0x22')]][_0x7436('0x3')]||this[_0x7436('0x5')][_0x2adf0e[_0x7436('0x22')]][_0x7436('0x3e')])){if(this[_0x7436('0x6')][_0x2adf0e[_0x7436('0x21')]]){this['channels'][_0x2adf0e[_0x7436('0x33')]]={'queue':_0x2adf0e[_0x7436('0x22')],'interface':_0x2adf0e['interface'],'destlinkedid':_0x2adf0e[_0x7436('0x3f')]};}}}catch(_0x4f4b76){logger[_0x7436('0x1e')]('[ACW][syncAgentConnect]\x20%s',_0x4f4b76['message']);}};Acw[_0x7436('0x17')][_0x7436('0x13')]=function(_0x44ce36){try{if(this[_0x7436('0x5')][_0x44ce36[_0x7436('0x22')]]&&(this['voiceQueues'][_0x44ce36[_0x7436('0x22')]][_0x7436('0x3')]||this[_0x7436('0x5')][_0x44ce36[_0x7436('0x22')]][_0x7436('0x3e')])){if(this[_0x7436('0x6')][_0x44ce36[_0x7436('0x21')]]){this['channels'][_0x44ce36['uniqueid']]={'queue':_0x44ce36[_0x7436('0x22')],'interface':_0x44ce36['interface']};}}}catch(_0x5728c7){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x5728c7[_0x7436('0x3d')]);}};Acw[_0x7436('0x17')][_0x7436('0xc')]=function(_0x3919c7){try{if(this[_0x7436('0x8')][_0x3919c7[_0x7436('0x33')]]&&_[_0x7436('0x40')](this[_0x7436('0x8')][_0x3919c7[_0x7436('0x33')]][_0x7436('0x2a')])){logger[_0x7436('0x1b')]('[%s][HANGUP:UNIQUEID]',_0x3919c7[_0x7436('0x33')]);this[_0x7436('0x20')](_0x3919c7[_0x7436('0x33')]);}else if(this[_0x7436('0x8')][_0x3919c7['linkedid']]&&_[_0x7436('0x40')](this[_0x7436('0x8')][_0x3919c7[_0x7436('0x41')]][_0x7436('0x2a')])){logger[_0x7436('0x1b')](_0x7436('0x42'),_0x3919c7[_0x7436('0x41')]);this[_0x7436('0x20')](_0x3919c7[_0x7436('0x41')]);}}catch(_0x5a61ce){logger[_0x7436('0x1e')](_0x7436('0x43'),_0x5a61ce[_0x7436('0x3d')]);}};Acw[_0x7436('0x17')][_0x7436('0xe')]=function(_0x1effd4){try{if(this[_0x7436('0x8')][_0x1effd4[_0x7436('0x33')]]&&this[_0x7436('0x8')][_0x1effd4['uniqueid']][_0x7436('0x2a')]){logger[_0x7436('0x1b')](_0x7436('0x44'),_0x1effd4[_0x7436('0x33')]);this['startAcw'](_0x1effd4[_0x7436('0x33')]);}else if(this['channels'][_0x1effd4[_0x7436('0x41')]]&&this[_0x7436('0x8')][_0x1effd4[_0x7436('0x41')]][_0x7436('0x2a')]){logger[_0x7436('0x1b')](_0x7436('0x45'),_0x1effd4[_0x7436('0x41')]);this['startAcw'](_0x1effd4[_0x7436('0x41')]);}}catch(_0x521f11){logger[_0x7436('0x1e')](_0x7436('0x46'),_0x521f11['message']);}};Acw[_0x7436('0x17')]['syncAttendedTransfer']=function(_0x10f6d4){try{if(!_[_0x7436('0x47')](this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x48')]])){this[_0x7436('0x20')](_0x10f6d4['transfereeuniqueid']);if(this[_0x7436('0x8')][_0x10f6d4['secondtransfereruniqueid']]){this[_0x7436('0x8')][_0x10f6d4['secondtransfereruniqueid']][_0x7436('0x2a')]=!![];this['channels'][_0x10f6d4[_0x7436('0x49')]]=this[_0x7436('0x8')][_0x10f6d4['secondtransfereruniqueid']];delete this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x4a')]];}}else if(!_[_0x7436('0x47')](this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x49')]])){this[_0x7436('0x20')](_0x10f6d4[_0x7436('0x49')]);if(this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x4b')]]){this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x4b')]][_0x7436('0x2a')]=!![];this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x48')]]=this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x4b')]];delete this[_0x7436('0x8')][_0x10f6d4[_0x7436('0x4b')]];}}}catch(_0x51d13e){logger[_0x7436('0x1e')](_0x7436('0x4c'),_0x51d13e[_0x7436('0x3d')]);}};Acw['prototype'][_0x7436('0x12')]=function(_0x42ca2a){try{if(this['channels'][_0x42ca2a[_0x7436('0x4d')]]){logger['info'](_0x7436('0x4e'),JSON['stringify'](_0x42ca2a[_0x7436('0x4d')]));this[_0x7436('0x20')](_0x42ca2a[_0x7436('0x4d')]);}else if(this[_0x7436('0x8')][_0x42ca2a[_0x7436('0x4f')]]){logger['info'](_0x7436('0x50'),JSON['stringify'](_0x42ca2a['transfererlinkedid']));this[_0x7436('0x20')](_0x42ca2a[_0x7436('0x4f')]);}}catch(_0x174308){logger[_0x7436('0x1e')](_0x7436('0x51'),_0x174308[_0x7436('0x3d')]);}};Acw[_0x7436('0x17')]['syncAgentRingNoAnswer']=function(_0x432f0d){try{if(this[_0x7436('0x5')][_0x432f0d[_0x7436('0x22')]]&&this[_0x7436('0x5')][_0x432f0d['queue']][_0x7436('0x52')]==='all'){if(this[_0x7436('0x6')][_0x432f0d[_0x7436('0x21')]]){logger['info'](_0x7436('0x53'),_0x432f0d[_0x7436('0x33')],_0x432f0d[_0x7436('0x21')],_0x432f0d['queue']);return RpcUser[_0x7436('0x2b')](this[_0x7436('0x6')][_0x432f0d[_0x7436('0x21')]],_0x7436('0x54'),_0x432f0d[_0x7436('0x33')]);}}}catch(_0x4e5a7e){logger['error'](_0x7436('0x55'),_0x4e5a7e[_0x7436('0x3d')]);}};module[_0x7436('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index dcfc524..9fe4f59 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 _0xd6cc=['actionDeviceStateList','catch','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','port','asterisk','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','inspect','fullybooted','info','resolve','then'];(function(_0x24b73b,_0x2fb7fb){var _0x15cfbd=function(_0x5966c6){while(--_0x5966c6){_0x24b73b['push'](_0x24b73b['shift']());}};_0x15cfbd(++_0x2fb7fb);}(_0xd6cc,0x1d7));var _0xcd6c=function(_0x3418cf,_0x24b5b9){_0x3418cf=_0x3418cf-0x0;var _0x323adc=_0xd6cc[_0x3418cf];return _0x323adc;};'use strict';var Manager=require(_0xcd6c('0x0'));var BPromise=require(_0xcd6c('0x1'));var util=require('util');var logger=require(_0xcd6c('0x2'))(_0xcd6c('0x3'));var config=require(_0xcd6c('0x4'));var ami=new Manager(config['asterisk'][_0xcd6c('0x5')],config[_0xcd6c('0x6')]['ip'],config[_0xcd6c('0x6')]['username'],config[_0xcd6c('0x6')]['password'],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xcd6c('0x7')](ami[_0xcd6c('0x8')]);function error(_0x1af1cb){logger[_0xcd6c('0x9')](util[_0xcd6c('0xa')](_0xcd6c('0xb'),config[_0xcd6c('0x6')][_0xcd6c('0xc')],config['asterisk']['ip'],config[_0xcd6c('0x6')][_0xcd6c('0x5')],util['inspect'](_0x1af1cb,![],null)));}function close(){logger['error'](util[_0xcd6c('0xa')](_0xcd6c('0xd'),config[_0xcd6c('0x6')][_0xcd6c('0xc')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0xcd6c('0xe')]=function(){return function(){return ami['Action']({'action':_0xcd6c('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xcd6c('0x10')]({'action':_0xcd6c('0x11')});};};ami[_0xcd6c('0x12')]=function(){return function(){return ami[_0xcd6c('0x10')]({'action':_0xcd6c('0x13')});};};ami[_0xcd6c('0x14')]=function(){return function(){return ami[_0xcd6c('0x10')]({'action':_0xcd6c('0x15')});};};ami[_0xcd6c('0x16')]=function(){return function(){return ami[_0xcd6c('0x10')]({'action':_0xcd6c('0x17')});};};function connect(){logger['info'](util[_0xcd6c('0xa')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xcd6c('0x6')][_0xcd6c('0xc')],config[_0xcd6c('0x6')]['ip'],config['asterisk'][_0xcd6c('0x5')]));ami[_0xcd6c('0x18')](_0xcd6c('0x9'),error);ami[_0xcd6c('0x18')](_0xcd6c('0x19'),close);}ami['on'](_0xcd6c('0x1a'),connect);ami['on'](_0xcd6c('0x1b'),function(_0x2c55d8){logger['info'](util[_0xcd6c('0xa')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xcd6c('0xc')],config['asterisk']['ip'],config[_0xcd6c('0x6')][_0xcd6c('0x5')],util[_0xcd6c('0x1c')](_0x2c55d8,![],null)));});ami['on'](_0xcd6c('0x1d'),function(){logger[_0xcd6c('0x1e')](util[_0xcd6c('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xcd6c('0xc')],config[_0xcd6c('0x6')]['ip'],config['asterisk'][_0xcd6c('0x5')]));return Promise[_0xcd6c('0x1f')]()[_0xcd6c('0x20')](ami[_0xcd6c('0xe')]())[_0xcd6c('0x20')](ami[_0xcd6c('0x21')]())[_0xcd6c('0x20')](ami[_0xcd6c('0x12')]())[_0xcd6c('0x20')](ami[_0xcd6c('0x14')]())[_0xcd6c('0x20')](ami['actionCoreShowChannels']())[_0xcd6c('0x22')](function(_0x591a06){logger[_0xcd6c('0x9')]('[ami.js][fullybooted]',util[_0xcd6c('0x1c')](_0x591a06,{'showHidden':![],'depth':null}));});});ami[_0xcd6c('0x18')]('error',error);ami[_0xcd6c('0x18')]('close',close);module[_0xcd6c('0x23')]=ami; \ No newline at end of file +var _0xd8a7=['shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','[ami.js][fullybooted]','close','exports','util','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','once','connect'];(function(_0x38b64d,_0x25b5a9){var _0x18a3ce=function(_0x18182b){while(--_0x18182b){_0x38b64d['push'](_0x38b64d['shift']());}};_0x18a3ce(++_0x25b5a9);}(_0xd8a7,0x1b9));var _0x7d8a=function(_0x1db899,_0xf1a81d){_0x1db899=_0x1db899-0x0;var _0x989fa3=_0xd8a7[_0x1db899];return _0x989fa3;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x7d8a('0x0'));var logger=require('../../config/logger')(_0x7d8a('0x1'));var config=require(_0x7d8a('0x2'));var ami=new Manager(config[_0x7d8a('0x3')][_0x7d8a('0x4')],config[_0x7d8a('0x3')]['ip'],config[_0x7d8a('0x3')][_0x7d8a('0x5')],config[_0x7d8a('0x3')][_0x7d8a('0x6')],!![]);ami[_0x7d8a('0x7')]();ami[_0x7d8a('0x8')]=BPromise[_0x7d8a('0x9')](ami[_0x7d8a('0xa')]);function error(_0x2d7c1c){logger[_0x7d8a('0xb')](util[_0x7d8a('0xc')](_0x7d8a('0xd'),config[_0x7d8a('0x3')][_0x7d8a('0x5')],config[_0x7d8a('0x3')]['ip'],config['asterisk']['port'],util[_0x7d8a('0xe')](_0x2d7c1c,![],null)));}function close(){logger[_0x7d8a('0xb')](util['format'](_0x7d8a('0xf'),config[_0x7d8a('0x3')]['username'],config[_0x7d8a('0x3')]['ip'],config[_0x7d8a('0x3')][_0x7d8a('0x4')]));}ami[_0x7d8a('0x10')]=function(){return function(){return ami[_0x7d8a('0x8')]({'action':_0x7d8a('0x11')});};};ami[_0x7d8a('0x12')]=function(){return function(){return ami['Action']({'action':_0x7d8a('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x7d8a('0x8')]({'action':_0x7d8a('0x14')});};};ami[_0x7d8a('0x15')]=function(){return function(){return ami[_0x7d8a('0x8')]({'action':'queuesummary'});};};ami[_0x7d8a('0x16')]=function(){return function(){return ami[_0x7d8a('0x8')]({'action':_0x7d8a('0x17')});};};function connect(){logger[_0x7d8a('0x18')](util[_0x7d8a('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x7d8a('0x3')][_0x7d8a('0x5')],config['asterisk']['ip'],config[_0x7d8a('0x3')][_0x7d8a('0x4')]));ami[_0x7d8a('0x19')](_0x7d8a('0xb'),error);ami[_0x7d8a('0x19')]('close',close);}ami['on'](_0x7d8a('0x1a'),connect);ami['on'](_0x7d8a('0x1b'),function(_0x199566){logger[_0x7d8a('0x18')](util[_0x7d8a('0xc')](_0x7d8a('0x1c'),config['asterisk']['username'],config[_0x7d8a('0x3')]['ip'],config[_0x7d8a('0x3')][_0x7d8a('0x4')],util[_0x7d8a('0xe')](_0x199566,![],null)));});ami['on']('fullybooted',function(){logger[_0x7d8a('0x18')](util[_0x7d8a('0xc')](_0x7d8a('0x1d'),config[_0x7d8a('0x3')]['username'],config[_0x7d8a('0x3')]['ip'],config[_0x7d8a('0x3')]['port']));return Promise[_0x7d8a('0x1e')]()[_0x7d8a('0x1f')](ami[_0x7d8a('0x10')]())[_0x7d8a('0x1f')](ami[_0x7d8a('0x12')]())[_0x7d8a('0x1f')](ami[_0x7d8a('0x20')]())['then'](ami[_0x7d8a('0x15')]())[_0x7d8a('0x1f')](ami[_0x7d8a('0x16')]())['catch'](function(_0x49495b){logger['error'](_0x7d8a('0x21'),util[_0x7d8a('0xe')](_0x49495b,{'showHidden':![],'depth':null}));});});ami['once'](_0x7d8a('0xb'),error);ami[_0x7d8a('0x19')](_0x7d8a('0x22'),close);module[_0x7d8a('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6802d50..489ca05 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xe706,0xa3));var _0x6e70=function(_0xa861aa,_0x2895a4){_0xa861aa=_0xa861aa-0x0;var _0x1e34de=_0xe706[_0xa861aa];return _0x1e34de;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x53360d,_0x1f2dc4){var _0x5b86f7=function(_0x4fe27f){while(--_0x4fe27f){_0x53360d['push'](_0x53360d['shift']());}};_0x5b86f7(++_0x1f2dc4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x358347,_0x56e86b){_0x358347=_0x358347-0x0;var _0x13e7c4=_0xf4eb[_0x358347];return _0x13e7c4;};'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 91ad8b2..58e55ef 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 _0xd328=['predictive','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','OVERTIME_INTERVAL','Global:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','uniqueid','ivr','queue','YYYY-MM-DD\x20HH:mm:ss','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','moveContactManagedDialer','syncQueueCallerAbandon','updateOriginated','droptime','outboundDropCallsDayTimeout','Drop','TIMEOUT','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','additional','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','state','calleridname','calleridnum','createHistory','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','rescheduleContact','add','ContactId','[rescheduleContact][Abandoned]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','stateinterface','isNil','pick','paused','syncQueueStatusComplete','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','responsetime','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','membername','countmachineretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','countbusyretry','countcongestionretry','countnosuchnumberretry','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','[syncAgentComplete][createHistory]','[syncAgentComplete]','outboundUnknownCallsDay','running','isPreviewCampaign','statusMessage','available','inUse','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','Agent','handleIvr','actionOriginate','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','xcally-motion-dialer','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[syncAgentComplete][createHistory][0]','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','talking','getContactDialer','countReScheduled','ACTIVE','checkIsBlackList','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/hangup','env','XCALLY_IP_AGI','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','debug','startProgressive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','temp','message','contactsRescheduled','CAMPAIGN_STATUS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','[ifTime][Action]','Error','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','true','catch','content','all','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xd328,0x173));var _0x8d32=function(_0x18710a,_0x26d390){_0x18710a=_0x18710a-0x0;var _0x3388e=_0xd328[_0x18710a];return _0x3388e;};'use strict';var util=require(_0x8d32('0x0'));var _=require(_0x8d32('0x1'));var uuid=require(_0x8d32('0x2'));var moment=require(_0x8d32('0x3'));var rr=require('rr');var Redis=require(_0x8d32('0x4'));var utils=require(_0x8d32('0x5'));var hopperUtils=require(_0x8d32('0x6'));var ut=require(_0x8d32('0x7'));var config=require(_0x8d32('0x8'));var logger=require(_0x8d32('0x9'))(_0x8d32('0xa'));var loggerBooked=require(_0x8d32('0x9'))('booked');var loggerPredictive=require(_0x8d32('0x9'))('predictive');var loggerPredictiveCalls=require(_0x8d32('0x9'))(_0x8d32('0xb'));var loggerSyncQueueSummary=require(_0x8d32('0x9'))('syncQueueSummary');var ami=require('../ami');config['redis']=_[_0x8d32('0xc')](config[_0x8d32('0xd')],{'host':_0x8d32('0xe'),'port':0x18eb});var io=require(_0x8d32('0xf'))(new Redis(config[_0x8d32('0xd')]));var cmHopper=require(_0x8d32('0x10'));var voiceQueueRt=require(_0x8d32('0x11'));var RpcSetting=require(_0x8d32('0x12'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x8d32('0x13'));var Final=require(_0x8d32('0x14'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x8d32('0x15'));var ipAgi=process[_0x8d32('0x16')][_0x8d32('0x17')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8d32('0x18')]['enqueue']=function(_0x23e86e){this['tail']=this[_0x8d32('0x19')]?this[_0x8d32('0x19')][_0x8d32('0x1a')](_0x23e86e):_0x23e86e();};function Dialer(_0x160282,_0x3efc9f){this[_0x8d32('0x1b')]=new Sequence();this['preview']=_0x3efc9f;this[_0x8d32('0x1c')]=_0x160282[_0x8d32('0x1c')];this['campaigns']=_0x160282[_0x8d32('0x1d')];this[_0x8d32('0x1e')]=_0x160282[_0x8d32('0x1e')];this['trunks']=_0x160282[_0x8d32('0x1f')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x8d32('0x20')]={};this['actions']={};this[_0x8d32('0x21')]={};this[_0x8d32('0x22')]={};this[_0x8d32('0x23')]={};this[_0x8d32('0x24')]={};this[_0x8d32('0x25')]={};this[_0x8d32('0x26')]={};this[_0x8d32('0x27')]={};this['queueBookedRR']={};this[_0x8d32('0x28')]={};ami['on'](_0x8d32('0x29'),this['syncAgentConnect']['bind'](this));ami['on'](_0x8d32('0x2a'),this['syncQueueCallerAbandon'][_0x8d32('0x2b')](this));ami['on'](_0x8d32('0x2c'),this[_0x8d32('0x2d')][_0x8d32('0x2b')](this));ami['on'](_0x8d32('0x2e'),this[_0x8d32('0x2f')]['bind'](this));ami['on'](_0x8d32('0x30'),this[_0x8d32('0x31')][_0x8d32('0x2b')](this));ami['on'](_0x8d32('0x32'),this[_0x8d32('0x33')]['bind'](this));ami['on'](_0x8d32('0x34'),this['syncHangup']['bind'](this));ami['on'](_0x8d32('0x35'),this[_0x8d32('0x36')][_0x8d32('0x2b')](this));ami['on'](_0x8d32('0x37'),this[_0x8d32('0x38')][_0x8d32('0x2b')](this));ami['on'](_0x8d32('0x39'),this['syncQueueMember'][_0x8d32('0x2b')](this));ami['on'](_0x8d32('0x3a'),this['syncQueueStatusComplete'][_0x8d32('0x2b')](this));this[_0x8d32('0x3b')]();this[_0x8d32('0x3c')]();RpcSetting[_0x8d32('0x3d')]()[_0x8d32('0x3e')](function(_0x38b39a){previewRecallmeReminderInterval=_0x38b39a[_0x8d32('0x3f')];});}function isNotNull(_0x52de2a){return _0x52de2a!==null&&!_[_0x8d32('0x40')](_0x52de2a);}function msgResponse(_0x5a9917,_0x431a73,_0x6208ec){return{'action':_0x5a9917,'response':_0x431a73,'message':_0x6208ec,'stack':_0x6208ec};}function emit(_0x1d4d0a,_0x3a073f,_0xd97f3e){io['to'](_0x1d4d0a)[_0x8d32('0x41')](_0x3a073f,_0xd97f3e);}function emitOutboundVoiceQueueSummary(_0x49cd32){if(_0x49cd32[_0x8d32('0x42')]===_0x8d32('0x43')){logger['debug'](_0x8d32('0x44'),util[_0x8d32('0x45')](_0x49cd32,{'showHidden':![],'depth':null}));emit(util[_0x8d32('0x46')](_0x8d32('0x47'),_0x49cd32[_0x8d32('0x48')]),_0x8d32('0x49'),_0x49cd32);}}function checkGetDataPredictive(_0x33778c){if(isNotNull(_0x33778c)&&!_[_0x8d32('0x4a')](_0x33778c)){loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x4c'));loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x4d'),_0x33778c[_0x8d32('0x4e')]);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x4f'),_0x33778c[_0x8d32('0x50')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33778c[_0x8d32('0x51')]);loggerPredictive[_0x8d32('0x4b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33778c[_0x8d32('0x52')]);loggerPredictive['info'](_0x8d32('0x53'),_0x33778c[_0x8d32('0x54')]);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x55'),_0x33778c[_0x8d32('0x56')]);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x57'));if(_0x33778c[_0x8d32('0x4e')]>0x0){if(!_['isUndefined'](_0x33778c[_0x8d32('0x56')])&&_0x33778c[_0x8d32('0x56')]>0x0){return!![];}loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x58'));if(!_[_0x8d32('0x40')](_0x33778c[_0x8d32('0x54')])&&_0x33778c['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x8d32('0x4b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x59'));}}else{loggerPredictive[_0x8d32('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x49ea52){return function(_0x235bc6){loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x5a'));loggerPredictive[_0x8d32('0x4b')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x235bc6[_0x8d32('0x5b')]);loggerPredictive['info'](_0x8d32('0x5c'),_0x235bc6['erlangCallToSecond']);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x5d'),_0x235bc6[_0x8d32('0x5e')]);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x5f'),_0x235bc6[_0x8d32('0x60')]);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x5d'),_0x235bc6[_0x8d32('0x5e')]);loggerPredictive[_0x8d32('0x4b')]('---------------------------');_[_0x8d32('0x61')](_0x49ea52,_0x235bc6);};}function ifInterval(_0x4e25ed,_0x42744c){if(_['isUndefined'](_0x42744c)){return![];}return utils[_0x8d32('0x62')](undefined,_0x42744c)<_0x4e25ed*0x3c;}function clearPredictiveAttributes(_0xfc7cfa){if(_0xfc7cfa['startProgressive']){_0xfc7cfa['startProgressive']=undefined;loggerPredictive[_0x8d32('0x63')](_0xfc7cfa[_0x8d32('0x48')],_0x8d32('0x64'));}if(_0xfc7cfa[_0x8d32('0x24')]){_0xfc7cfa[_0x8d32('0x24')]=undefined;loggerPredictive['debug'](_0xfc7cfa['name'],'startPredictive\x20value\x20cleared');}if(_0xfc7cfa[_0x8d32('0x65')]){clearInterval(_0xfc7cfa[_0x8d32('0x65')]);_0xfc7cfa['handlePredictive']=undefined;loggerPredictive['debug'](_0xfc7cfa['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x5a7ef6,_0x2eee2b){return function(_0x1a7b69){loggerPredictive[_0x8d32('0x66')](_0x2eee2b[_0x8d32('0x48')],_0x5a7ef6);loggerPredictive['error'](_0x1a7b69[_0x8d32('0x67')]);clearPredictiveAttributes(_0x2eee2b);};}function loggerCatch(_0x4ee054){return function(_0x569f3d){logger[_0x8d32('0x66')](_0x4ee054,util[_0x8d32('0x45')](_0x569f3d,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4a4954,_0x2672f3,_0x47a7e4){return function(_0x2c0bb4){utils[_0x8d32('0x68')](_0x2672f3,_0x47a7e4,0x0);_0x2672f3[_0x8d32('0x69')]=0x0;logger[_0x8d32('0x66')](_0x4a4954,util['inspect'](_0x2c0bb4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x80041b){return function(_0xce2e92){if(isNotNull(_0xce2e92)&&isNotNull(_0xce2e92[0x0])){if(_0xce2e92[0x0]['contactsRescheduled']>0x0){_0x80041b[_0x8d32('0x6a')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger[_0x8d32('0x4b')]('[getContactDialer2][ReScheduled]'+_0x80041b[_0x8d32('0x48')],_0xce2e92[0x0][_0x8d32('0x6b')],'contacts');}else{_0x80041b[_0x8d32('0x6a')]=utils[_0x8d32('0x6c')]['NO_AVAILABLE_CONTACTS'];logger[_0x8d32('0x4b')](_0x8d32('0x6d')+_0x80041b[_0x8d32('0x48')]);}}};}function createObjHistory(_0x172b63,_0x5b2981,_0x3f0c7b,_0x1287f1,_0x4fa96a){_0x172b63[_0x8d32('0x6a')]=_0x3f0c7b;var _0x3fcc3f=new Action(_0x172b63,_0x5b2981);var _0xa9d61e=new History(_0x3fcc3f);_0xa9d61e['state']=_0x1287f1;_0xa9d61e[_0x8d32('0x6e')]=_0x4fa96a;_0xa9d61e[_0x8d32('0x6f')]=_0x3fcc3f[_0x8d32('0x70')];return _0xa9d61e;}function unlockQueueStatus(_0x313782,_0x52fa27){setTimeout(function(){if(_['isUndefined'](_0x313782[_0x8d32('0x71')])){loggerBooked['error'](_0x8d32('0x72'),_0x52fa27);}_0x313782['queueStatusComplete']=!![];loggerBooked[_0x8d32('0x4b')](_0x8d32('0x73'),_0x52fa27,JSON[_0x8d32('0x74')](_['pick'](_0x313782,[_0x8d32('0x48'),_0x8d32('0x71')])));},0x1f3);}function checkInterval(_0x25893d){return function(){if(!isNotNull(_0x25893d[_0x8d32('0x75')])){_0x25893d[_0x8d32('0x6a')]=utils[_0x8d32('0x6c')][_0x8d32('0x76')];throw _0x25893d[_0x8d32('0x48')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x25893d[_0x8d32('0x75')][_0x8d32('0x77')])){_0x25893d['message']=utils[_0x8d32('0x6c')]['NULL_INTERVAL'];throw _0x25893d[_0x8d32('0x48')]+_0x8d32('0x78');}if(!isNotNull(_[_0x8d32('0x4a')](_0x25893d[_0x8d32('0x75')][_0x8d32('0x77')]))){_0x25893d[_0x8d32('0x6a')]=utils[_0x8d32('0x6c')][_0x8d32('0x76')];throw _0x25893d[_0x8d32('0x48')]+_0x8d32('0x78');}};}function checkIsIVRCampaignActive(_0x5801ca){return function(){if(!utils[_0x8d32('0x79')](_0x5801ca)){_0x5801ca[_0x8d32('0x6a')]=utils['CAMPAIGN_STATUS'][_0x8d32('0x7a')];throw _0x5801ca[_0x8d32('0x48')]+_0x8d32('0x7b');}};}function emitCampaignSummary(_0x3bc385){if(utils[_0x8d32('0x7c')](_0x3bc385)){emit(util['format']('campaign:ivr:%s',_0x3bc385[_0x8d32('0x48')]),_0x8d32('0x7d'),_0x3bc385);}}function loggerCatchQueueSummary(_0x1bef83,_0x5396fe){return function(_0x5af2b5){clearPredictiveAttributes(_0x5396fe);emitCampaignSummary(_0x5396fe);loggerSyncQueueSummary['debug'](_0x1bef83,util[_0x8d32('0x45')](_0x5af2b5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3a8003){if(_0x3a8003[_0x8d32('0x7e')]){if(_0x3a8003[_0x8d32('0x7f')]===0x0){_0x3a8003[_0x8d32('0x7e')]=![];_0x3a8003['message']=utils[_0x8d32('0x6c')][_0x8d32('0x7a')];loggerSyncQueueSummary['debug'](_0x8d32('0x80'),_0x3a8003[_0x8d32('0x48')],_0x8d32('0x81'));}else{_0x3a8003[_0x8d32('0x6a')]=utils[_0x8d32('0x6c')]['DISACTIVED'];loggerSyncQueueSummary[_0x8d32('0x63')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3a8003[_0x8d32('0x48')],'is\x20disactive');}emitCampaignSummary(_0x3a8003);}}function myreject(_0x2f003d){return function(_0x394147){return _0x2f003d(msgResponse(_0x8d32('0x82'),_0x8d32('0x83'),JSON['stringify'](_0x394147)));};}Dialer[_0x8d32('0x18')]['isTrunkReachable']=function(_0x4fe5b1){return!_[_0x8d32('0x40')](_0x4fe5b1)&&_0x4fe5b1&&!_[_0x8d32('0x40')](_0x4fe5b1[_0x8d32('0x48')])&&!_[_0x8d32('0x40')](_0x4fe5b1['active'])&&_0x4fe5b1[_0x8d32('0x84')]&&(this[_0x8d32('0x1f')][util[_0x8d32('0x46')]('SIP/%s',_0x4fe5b1[_0x8d32('0x48')])][_0x8d32('0x85')]===_0x8d32('0x86')||this[_0x8d32('0x1f')][util['format'](_0x8d32('0x87'),_0x4fe5b1['name'])][_0x8d32('0x85')]===_0x8d32('0x88'));};Dialer[_0x8d32('0x18')][_0x8d32('0x89')]=function(_0x2edac8){var _0x737d64=this;return function(){if(!_0x737d64[_0x8d32('0x8a')](_0x2edac8[_0x8d32('0x8b')])){if(!_0x737d64[_0x8d32('0x8a')](_0x2edac8[_0x8d32('0x8c')])){_0x2edac8[_0x8d32('0x6a')]=utils[_0x8d32('0x6c')][_0x8d32('0x8d')];throw _0x2edac8['name']+_0x8d32('0x8e');}}};};Dialer[_0x8d32('0x18')][_0x8d32('0x8f')]=function(_0x13b2c4,_0x119284,_0x3d19f6,_0x3486ea){var _0x25499a=this;return function(){var _0x1eb14d=!![];return _0x25499a['ifTimeIvr'](_0x13b2c4,_0x119284,_0x3d19f6,_0x3486ea,_0x1eb14d);};};Dialer[_0x8d32('0x18')]['checkIfTimeIntervals']=function(_0x189950,_0x2923a3,_0x35ce24,_0xbad73d){var _0x24d5a8=this;return function(){var _0x19e849=![];return _0x24d5a8['ifTimeIvr'](_0x189950[_0x8d32('0x77')],_0x2923a3,_0x35ce24,_0xbad73d,_0x19e849);};};Dialer[_0x8d32('0x18')][_0x8d32('0x90')]=function(_0x33b0c9,_0x43ac53,_0x48797e,_0x41eb2e,_0x181488){var _0xe499bd=[];return new Promise(function(_0x1fbd3b,_0x3c14ff){if(!isNotNull(_0x33b0c9)){_0x41eb2e[_0x8d32('0x6a')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x3c14ff(msgResponse(_0x8d32('0x91'),_0x8d32('0x92'),_0x48797e+_0x8d32('0x93')));}if(_[_0x8d32('0x4a')](_0x33b0c9)){_0x41eb2e['message']=utils['CAMPAIGN_STATUS'][_0x8d32('0x94')];return _0x3c14ff(msgResponse(_0x8d32('0x91'),_0x8d32('0x92'),_0x48797e+_0x8d32('0x95')));}if(_0x43ac53&&_[_0x8d32('0x40')](config[_0x8d32('0x96')][_0x43ac53])){_0x41eb2e['message']=utils['CAMPAIGN_STATUS'][_0x8d32('0x97')];return _0x3c14ff(msgResponse('ifTime',_0x8d32('0x92'),_0x48797e+_0x8d32('0x98')+_0x43ac53));}if(_[_0x8d32('0x99')](_0x33b0c9)){for(var _0x421585=0x0;_0x421585<_0x33b0c9['length'];_0x421585+=0x1){_0xe499bd[_0x8d32('0x9a')](ami[_0x8d32('0x9b')]({'action':_0x8d32('0x9c'),'command':util['format'](_0x8d32('0x9d'),_0x33b0c9[_0x421585][_0x8d32('0x9e')],!_[_0x8d32('0x40')](config[_0x8d32('0x96')][_0x43ac53])?_0x43ac53:'')})['then'](function(_0x2700f5){return _0x2700f5['content']['indexOf'](_0x8d32('0x9f'))>=0x0;})[_0x8d32('0xa0')](myreject(_0x3c14ff)));}}else{_0xe499bd[_0x8d32('0x9a')](ami[_0x8d32('0x9b')]({'action':_0x8d32('0x9c'),'command':util[_0x8d32('0x46')]('iftime\x20%s,%s',_0x33b0c9,!_[_0x8d32('0x40')](config['timezones'][_0x43ac53])?_0x43ac53:'')})['then'](function(_0xe06c18){return _0xe06c18[_0x8d32('0xa1')]['indexOf'](_0x8d32('0x9f'))>=0x0;})[_0x8d32('0xa0')](myreject(_0x3c14ff)));}Promise[_0x8d32('0xa2')](_0xe499bd)[_0x8d32('0x3e')](function(_0x3c4980){var _0x47c62=_['some'](_0x3c4980);if(_0x47c62){return _0x1fbd3b(_0x47c62);}else{_0x41eb2e[_0x8d32('0x6a')]=_0x181488?utils[_0x8d32('0x6c')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x3c14ff(msgResponse(_0x8d32('0xa3'),_0x8d32('0x92'),'Global:\x20'+_0x181488+'\x20'+_0x48797e+_0x8d32('0xa4')+util['inspect'](_0x33b0c9,{'showHidden':![],'depth':null})+_0x8d32('0xa5')+_0x43ac53));}})[_0x8d32('0xa0')](function(_0x32b52f){return _0x3c14ff(msgResponse(_0x8d32('0x91'),'Failure',JSON[_0x8d32('0x74')](_0x32b52f)));});});};Dialer['prototype'][_0x8d32('0x3b')]=function(){var _0x511675=this;return cmHopper[_0x8d32('0xa6')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x511675[_0x8d32('0xa7')]();},0x3e8);});};Dialer['prototype'][_0x8d32('0xa7')]=function(){var _0x2d2ea5=this;var _0x4e0769;for(var _0x406c96 in this[_0x8d32('0x1d')]){if(typeof this[_0x8d32('0x1d')][_0x406c96]!==_0x8d32('0xa8')){_0x4e0769=this[_0x8d32('0x1d')][_0x406c96];if(utils[_0x8d32('0x7c')](_0x4e0769)&&utils['isIVRCampaignActive'](_0x4e0769)){_0x4e0769['sendMessageOneNotActive']=!![];Promise[_0x8d32('0xa9')]()[_0x8d32('0x3e')](checkIsIVRCampaignActive(_0x4e0769))[_0x8d32('0x3e')](checkInterval(_0x4e0769))[_0x8d32('0x3e')](_0x2d2ea5[_0x8d32('0x89')](_0x4e0769))[_0x8d32('0x3e')](_0x2d2ea5[_0x8d32('0x8f')](_0x4e0769[_0x8d32('0xaa')],_0x4e0769[_0x8d32('0xab')],_0x4e0769[_0x8d32('0x48')],_0x4e0769))['then'](_0x2d2ea5[_0x8d32('0xac')](_0x4e0769[_0x8d32('0x75')],_0x4e0769['dialTimezone'],_0x4e0769[_0x8d32('0x48')],_0x4e0769))['then'](_0x2d2ea5[_0x8d32('0xad')](_0x4e0769))[_0x8d32('0xa0')](loggerCatchQueueSummary(_0x8d32('0xae'),_0x4e0769));}else{notSendMessagesCampaign(_0x4e0769);}}}};Dialer[_0x8d32('0x18')][_0x8d32('0xaf')]=function(_0x353748){if(_0x353748[_0x8d32('0xb0')]!==_0x8d32('0xb1')){clearPredictiveAttributes(_0x353748);}switch(_0x353748['dialMethod']){case _0x8d32('0xb2'):this[_0x8d32('0xb3')](_0x353748,0x1);break;case _0x8d32('0xb4'):this[_0x8d32('0xb3')](_0x353748,_0x353748[_0x8d32('0xb5')]);break;case _0x8d32('0xb1'):this[_0x8d32('0xb1')](_0x353748);break;case _0x8d32('0xb6'):this[_0x8d32('0xb3')](_0x353748,0x1);break;default:logger['error'](_0x8d32('0xb7'),_0x353748[_0x8d32('0x48')],_0x8d32('0xb8'));}};Dialer[_0x8d32('0x18')][_0x8d32('0x91')]=function(_0x1eb083,_0x11c98b){var _0x3b3eef=_0x1eb083['dialTimezone'];var _0xe29a05=_0x11c98b?_0x1eb083[_0x8d32('0xaa')]:_0x1eb083[_0x8d32('0x75')]['Intervals'];logger['silly'](_0x8d32('0xb9'),_0xe29a05,_0x3b3eef,_0x1eb083[_0x8d32('0x48')],util[_0x8d32('0x46')](_0x8d32('0xba'),_0x1eb083[_0x8d32('0x48')],_0x1eb083['id']));var _0x358057=null;return Interval['intervalIftime'](_0xe29a05,_0x3b3eef)[_0x8d32('0x3e')](function(_0x382b46){if(_0x382b46===!![]){return _0x382b46;}else{_0x1eb083[_0x8d32('0x6a')]=_0x11c98b?utils[_0x8d32('0x6c')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x8d32('0x6c')][_0x8d32('0xbb')];_0x358057=msgResponse('[ifTime][promiseAll]',_0x8d32('0x92'),_0x8d32('0xbc')+_0x11c98b+'\x20'+_0x1eb083[_0x8d32('0x48')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x8d32('0x45')](_0xe29a05,{'showHidden':![],'depth':null})+_0x8d32('0xa5')+_0x3b3eef);}if(_0x358057!==null){logger[_0x8d32('0xbd')](_0x8d32('0xbe'),_0x358057);_0x358057[_0x8d32('0xbf')]=_0x11c98b;throw _0x358057;}})[_0x8d32('0xa0')](function(_0x15d3ad){logger[_0x8d32('0x66')](_0x8d32('0xc0'),_0x15d3ad);throw msgResponse(_0x8d32('0x82'),_0x8d32('0x83'),util[_0x8d32('0x45')](_0x15d3ad,{'showHidden':![],'depth':null}));});};Dialer[_0x8d32('0x18')][_0x8d32('0xc1')]=function(_0x3b398a){if(this[_0x8d32('0x1c')][_0x3b398a['queue']]){if(this[_0x8d32('0x22')][_0x3b398a[_0x8d32('0xc2')]]&&this[_0x8d32('0x22')][_0x3b398a[_0x8d32('0xc2')]][_0x8d32('0x42')]!==_0x8d32('0xc3')){this['updateOriginated'](this['voiceQueues'][_0x3b398a[_0x8d32('0xc4')]]);this[_0x8d32('0x22')][_0x3b398a[_0x8d32('0xc2')]]['answertime']=moment()[_0x8d32('0x46')](_0x8d32('0xc5'));}}};Dialer[_0x8d32('0x18')]['syncAgentComplete']=function(_0x2e17a8){var _0xc14bbd=this[_0x8d32('0x22')][_0x2e17a8[_0x8d32('0xc2')]];if(this[_0x8d32('0x1c')][_0x2e17a8[_0x8d32('0xc4')]]){if(_0xc14bbd&&_0xc14bbd['type']!==_0x8d32('0xc3')){delete this['uniqueId'][_0x2e17a8[_0x8d32('0xc2')]];this['voiceQueues'][_0x2e17a8[_0x8d32('0xc4')]]['outboundAnswerCallsDay']+=0x1;var _0x39e157=new AgentComplete(_0xc14bbd,_0x2e17a8);if(_0x2e17a8[_0x8d32('0xc6')]===_0x8d32('0xc7')){_0x39e157['agiafterat']=this[_0x8d32('0x1c')][_0x2e17a8[_0x8d32('0xc4')]][_0x8d32('0xc8')]&&this[_0x8d32('0x1c')][_0x2e17a8[_0x8d32('0xc4')]][_0x8d32('0xc9')]?moment()[_0x8d32('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x39e157)[_0x8d32('0xa0')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x8d32('0xca')](_0x39e157)[_0x8d32('0xa0')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x8d32('0xcb')]=function(_0x5a9623){var _0x101403=this[_0x8d32('0x22')][_0x5a9623[_0x8d32('0xc2')]];var _0x410530=this;var _0x46d296=![];var _0x4adf87;var _0xe8f060;if(this[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]]){if(_0x101403&&_0x101403['type']!==_0x8d32('0xc3')){delete this['uniqueId'][_0x5a9623[_0x8d32('0xc2')]];this[_0x8d32('0xcc')](this['voiceQueues'][_0x5a9623[_0x8d32('0xc4')]]);_0x101403['droptime']=moment()[_0x8d32('0x46')](_0x8d32('0xc5'));var _0x26fbba=new QueueCallerAbandon(_0x101403,_0x5a9623);if(utils[_0x8d32('0x62')](_0x101403[_0x8d32('0xcd')],_0x101403['responsetime'])>=_0x101403['dialQueueTimeout']){this[_0x8d32('0x1c')][_0x5a9623['queue']][_0x8d32('0x51')]+=0x1;this[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]][_0x8d32('0xce')]+=0x1;this[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x26fbba['state']=0xa;_0x26fbba[_0x8d32('0x6e')]=_0x8d32('0xcf');_0x26fbba['dropreason']=_0x8d32('0xd0');_0x26fbba[_0x8d32('0xd1')]=this[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]]['dialQueueProject2']?moment()['format'](_0x8d32('0xc5')):undefined;_0x26fbba[_0x8d32('0xd2')]+=0x1;_0x26fbba[_0x8d32('0xd3')]+=0x1;_0x4adf87=this['voiceQueues'][_0x5a9623[_0x8d32('0xc4')]][_0x8d32('0xd4')];_0xe8f060=this[_0x8d32('0x1c')][_0x5a9623['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x8d32('0xd5')](_0x26fbba,_0x26fbba['state'],_0x101403[_0x8d32('0xd6')])[_0x8d32('0x3e')](function(_0x1bb985){_0x46d296=_0x1bb985['additional']==0x1;if(_0x26fbba[_0x8d32('0xd2')]>=_0x410530[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]][_0x8d32('0xd7')]){_0x410530[_0x8d32('0xd8')](_0x26fbba,_0x1bb985[_0x8d32('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x26fbba[_0x8d32('0xd2')],'scheduledat':moment()['add'](_0x410530[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]]['dialDropRetryFrequency'],_0x8d32('0xda'))[_0x8d32('0x46')](_0x8d32('0xc5')),'ContactId':_0x101403['ContactId'],'ListId':_0x101403[_0x8d32('0xdb')],'VoiceQueueId':_0x101403[_0x8d32('0xdc')]||undefined,'CampaignId':_0x101403[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0xde')));var _0x28c2bd=new History(_0x26fbba);_0x28c2bd[_0x8d32('0xdf')]=0xa;_0x28c2bd[_0x8d32('0x6e')]=_0x8d32('0xcf');_0x28c2bd[_0x8d32('0x70')]=moment()[_0x8d32('0x46')](_0x8d32('0xc5'));_0x28c2bd[_0x8d32('0x6f')]=_0x28c2bd[_0x8d32('0x70')];_0x28c2bd[_0x8d32('0xe0')]=_0x26fbba[_0x8d32('0xe0')];_0x28c2bd['calleridnum']=_0x26fbba[_0x8d32('0xe1')];hopperUtils[_0x8d32('0xe2')](_0x28c2bd)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x46d296)hopperUtils[_0x8d32('0xe3')](_0x26fbba,_0x4adf87,_0xe8f060)[_0x8d32('0x3e')](function(){return 0x1;});});}else{this[_0x8d32('0x1c')][_0x5a9623['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x8d32('0x1c')][_0x5a9623['queue']][_0x8d32('0xe4')]+=0x1;_0x26fbba['state']=0xb;_0x26fbba[_0x8d32('0x6e')]=_0x8d32('0xe5');_0x26fbba[_0x8d32('0xe6')]=_0x8d32('0xe7');_0x26fbba[_0x8d32('0xe8')]+=0x1;_0x26fbba[_0x8d32('0xd3')]+=0x1;_0x4adf87=this[_0x8d32('0x1c')][_0x5a9623['queue']][_0x8d32('0xe9')];_0xe8f060=this[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]][_0x8d32('0xea')];hopperUtils[_0x8d32('0xd5')](_0x26fbba,_0x26fbba['state'],_0x101403['voiceQueue'])[_0x8d32('0x3e')](function(_0x5684e0){if(_0x26fbba['countabandonedretry']>=_0x410530[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]][_0x8d32('0xeb')]){_0x410530[_0x8d32('0xd8')](_0x26fbba,_0x5684e0[_0x8d32('0xd9')]);}else{hopperUtils[_0x8d32('0xec')]({'active':![],'countabandonedretry':_0x26fbba[_0x8d32('0xe8')],'scheduledat':moment()[_0x8d32('0xed')](_0x410530[_0x8d32('0x1c')][_0x5a9623[_0x8d32('0xc4')]][_0x8d32('0xe9')],_0x8d32('0xda'))[_0x8d32('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101403[_0x8d32('0xee')],'ListId':_0x101403['ListId'],'VoiceQueueId':_0x101403[_0x8d32('0xdc')]||undefined,'CampaignId':_0x101403[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0xef')));var _0x5cb79b=new History(_0x26fbba);_0x5cb79b['state']=0xb;_0x5cb79b[_0x8d32('0x6e')]=_0x8d32('0xe5');_0x5cb79b[_0x8d32('0x70')]=moment()[_0x8d32('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cb79b[_0x8d32('0x6f')]=_0x5cb79b[_0x8d32('0x70')];_0x5cb79b[_0x8d32('0xe0')]=_0x26fbba[_0x8d32('0xe0')];_0x5cb79b[_0x8d32('0xe1')]=_0x26fbba[_0x8d32('0xe1')];hopperUtils[_0x8d32('0xe2')](_0x5cb79b)[_0x8d32('0xa0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x8d32('0x3e')](function(){if(_0x46d296)hopperUtils[_0x8d32('0xe3')](_0x26fbba,_0x4adf87,_0xe8f060)[_0x8d32('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x8d32('0x18')]['syncNewExten']=function(_0x5d89c7){if(this[_0x8d32('0xf0')][_0x5d89c7[_0x8d32('0xc2')]]){this[_0x8d32('0xf0')][_0x5d89c7[_0x8d32('0xc2')]][_0x8d32('0xf1')]=_0x5d89c7['channel'];}if(this['uniqueId'][_0x5d89c7['uniqueid']]){this[_0x8d32('0x22')][_0x5d89c7[_0x8d32('0xc2')]][_0x8d32('0xf1')]=_0x5d89c7['channel'];}};Dialer['prototype'][_0x8d32('0xf2')]=function(_0x30a232){if(!this[_0x8d32('0xf0')][_0x30a232[_0x8d32('0xf3')]]){return;}var _0x37d071=this[_0x8d32('0x1c')][this[_0x8d32('0xf0')][_0x30a232[_0x8d32('0xf3')]]['queue']][_0x8d32('0xf4')]||_0x8d32('0xf5');if(_0x37d071===_0x8d32('0xf6')){if(this[_0x8d32('0xf0')][_0x30a232[_0x8d32('0xf3')]]&&_['isNil'](this[_0x8d32('0xf0')][_0x30a232['actionid']][_0x8d32('0xf7')])&&_0x30a232[_0x8d32('0x85')]==='1'&&_0x30a232['paused']==='0'){if(this[_0x8d32('0x1e')][_0x30a232[_0x8d32('0xf8')]]){if(!this[_0x8d32('0x1e')][_0x30a232[_0x8d32('0xf8')]][_0x8d32('0xf7')]){this[_0x8d32('0x1e')][_0x30a232['stateinterface']][_0x8d32('0xf7')]=!![];this[_0x8d32('0xf0')][_0x30a232[_0x8d32('0xf3')]][_0x8d32('0xf7')]=!![];this[_0x8d32('0xf0')][_0x30a232['actionid']][_0x8d32('0xf8')]=_0x30a232['stateinterface'];}}}}else if(_0x37d071==='rrmemory'){if(this['actions'][_0x30a232[_0x8d32('0xf3')]]){if(this['agents'][_0x30a232[_0x8d32('0xf8')]]){this[_0x8d32('0xf0')][_0x30a232[_0x8d32('0xf3')]]['stateinterface']=_0x30a232['stateinterface'];if(_[_0x8d32('0xf9')](this[_0x8d32('0x27')][this[_0x8d32('0xf0')][_0x30a232[_0x8d32('0xf3')]][_0x8d32('0xc4')]])){this[_0x8d32('0x27')][this[_0x8d32('0xf0')][_0x30a232['actionid']][_0x8d32('0xc4')]]=[];}this[_0x8d32('0x27')][this[_0x8d32('0xf0')][_0x30a232['actionid']]['queue']]['push'](_['merge'](_[_0x8d32('0xfa')](this[_0x8d32('0xf0')][_0x30a232[_0x8d32('0xf3')]],['idHopper',_0x8d32('0xf8')]),{'status':_0x30a232[_0x8d32('0x85')],'paused':_0x30a232[_0x8d32('0xfb')]}));}}}};Dialer[_0x8d32('0x18')][_0x8d32('0xfc')]=function(_0x27b453){if(!this[_0x8d32('0xf0')][_0x27b453['actionid']]){return;}var _0x1b3842=this;var _0x295d14=this[_0x8d32('0x1c')][this[_0x8d32('0xf0')][_0x27b453['actionid']][_0x8d32('0xc4')]];var _0x2c3264=_0x295d14['strategy']||_0x8d32('0xf5');if(_0x2c3264===_0x8d32('0xf6')){if(this['actions'][_0x27b453[_0x8d32('0xf3')]]&&this['actions'][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xf8')]){this[_0x8d32('0xfd')][_0x8d32('0xfe')](this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xff')],this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xf8')])[_0x8d32('0xa0')](function(_0x456b7d){logger[_0x8d32('0x66')](_0x8d32('0x100'),util[_0x8d32('0x45')](_0x456b7d,{'showHidden':![],'depth':null}));})[_0x8d32('0x1a')](function(){_0x1b3842[_0x8d32('0xcc')](_0x1b3842[_0x8d32('0x1c')][_0x1b3842[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xc4')]]);_0x1b3842['agents'][_0x1b3842[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xf8')]]['locked']=![];delete _0x1b3842[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]];unlockQueueStatus(_0x295d14);});}else{this[_0x8d32('0xcc')](this[_0x8d32('0x1c')][this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xee')],'ListId':this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xdb')],'VoiceQueueId':this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xdc')]||undefined,'CampaignId':this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]];unlockQueueStatus(_0x295d14);}}else if(_0x2c3264==='rrmemory'){var _0x543d3c;if(this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]]&&!_[_0x8d32('0x4a')](this['queueBooked'][this['actions'][_0x27b453[_0x8d32('0xf3')]]['queue']])){if(this[_0x8d32('0x101')][_0x1b3842['actions'][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xc4')]]){this['queueBookedRR'][_0x1b3842[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]]['queue']]=this[_0x8d32('0x101')][this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xc4')]]?this[_0x8d32('0x101')][this['actions'][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xc4')]]:this['queueBooked'][this['actions'][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xc4')]]?this['queueBooked'][this[_0x8d32('0xf0')][_0x27b453['actionid']][_0x8d32('0xc4')]][_0x8d32('0x102')]||0x0:0x0;}this[_0x8d32('0x27')][this['actions'][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xc4')]][_0x8d32('0x102')]=this[_0x8d32('0x101')][this[_0x8d32('0xf0')][_0x27b453[_0x8d32('0xf3')]][_0x8d32('0xc4')]];for(var _0x5b296b=0x0;_0x5b296b=_0x30a901[_0x8d32('0x124')]){_0x533871[_0x8d32('0x125')](_0xb15314,_0x37348c,_0x1e59ff,_0x8d32('0x126'));}else{if(_0xb15314[_0x8d32('0x121')]>=_0x30a901[_0x8d32('0x127')]){_0x533871[_0x8d32('0x128')](_0xb15314,_0x37348c,_0x1e59ff,_0x8d32('0x129'));}else{hopperUtils[_0x8d32('0xec')]({'active':![],'countmachineretry':_0xb15314[_0x8d32('0x121')],'scheduledat':moment()['add'](_0x30a901[_0x8d32('0x12a')],_0x8d32('0xda'))[_0x8d32('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb15314[_0x8d32('0xee')],'ListId':_0xb15314[_0x8d32('0xdb')],'VoiceQueueId':_0xb15314['VoiceQueueId']||undefined,'CampaignId':_0xb15314['CampaignId']||undefined})['catch'](loggerCatch(_0x8d32('0x12b')));_0x37348c({'reschedule':0x1});}}});}if(_0x39cf3a[_0x8d32('0x42')]===_0x8d32('0xc3')&&this[_0x8d32('0x1d')][_0x39cf3a[_0x8d32('0xc4')]][_0x8d32('0x112')]&&_0x3b9695[_0x8d32('0x113')]===_0x8d32('0x114')){delete this[_0x8d32('0x22')][_0x3b9695[_0x8d32('0xc2')]];this[_0x8d32('0xcc')](this[_0x8d32('0x1d')][_0x39cf3a[_0x8d32('0xc4')]]);_0x490e7d=new Hangup(_0x39cf3a,_0x3b9695);_0x490e7d[_0x8d32('0xdf')]=0x12;_0x490e7d[_0x8d32('0x6e')]=_0x8d32('0x117');_0x490e7d[_0x8d32('0x120')]='AMD';ami['emit'](_0x8d32('0x119'),ut['buildObj'](_0x490e7d,_0x8d32('0x11b')));this[_0x8d32('0x11c')](_0x490e7d,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x39cf3a[_0x8d32('0x42')]==='ivr'&&this['campaigns'][_0x39cf3a['queue']][_0x8d32('0x112')]&&_0x3b9695['value']===_0x8d32('0x11e')){return new Promise(function(_0x4073a6,_0x471237){delete _0x533871[_0x8d32('0x22')][_0x3b9695['uniqueid']];_0x533871[_0x8d32('0xcc')](_0x533871[_0x8d32('0x1d')][_0x39cf3a[_0x8d32('0xc4')]]);_0x533871[_0x8d32('0x1d')][_0x39cf3a[_0x8d32('0xc4')]]['outboundAnswerCallsDay']+=0x1;_0x533871[_0x8d32('0x1d')][_0x39cf3a[_0x8d32('0xc4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1ac780=_0x533871['campaigns'][_0x39cf3a[_0x8d32('0xc4')]];var _0x3fac59=new Hangup(_0x39cf3a,_0x3b9695);_0x3fac59['state']=0x13;_0x3fac59['statedesc']='Machine';_0x3fac59['membername']=_0x8d32('0x118');_0x3fac59['countmachineretry']+=0x1;_0x3fac59[_0x8d32('0xd3')]+=0x1;_0x3fac59['amd']=!![];ami[_0x8d32('0x41')](_0x8d32('0x119'),ut[_0x8d32('0x11a')](_0x3fac59,_0x8d32('0x11b')));hopperUtils[_0x8d32('0xe2')](_0x3fac59)[_0x8d32('0xa0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3fac59[_0x8d32('0x12c')]+_0x3fac59[_0x8d32('0x12d')]+_0x3fac59['countnoanswerretry']+_0x3fac59[_0x8d32('0x12e')]+_0x3fac59[_0x8d32('0xd2')]+_0x3fac59[_0x8d32('0xe8')]+_0x3fac59[_0x8d32('0x121')]+_0x3fac59['countagentrejectretry']>=_0x1ac780[_0x8d32('0x124')]){_0x533871[_0x8d32('0x125')](_0x3fac59,_0x4073a6,_0x471237,'reason19\x20machine....');}else{if(_0x3fac59[_0x8d32('0x121')]>=_0x1ac780[_0x8d32('0x127')]){_0x533871[_0x8d32('0x128')](_0x3fac59,_0x4073a6,_0x471237,_0x8d32('0x129'));}else{hopperUtils[_0x8d32('0xec')]({'active':![],'countmachineretry':_0x3fac59[_0x8d32('0x121')],'scheduledat':moment()[_0x8d32('0xed')](_0x1ac780[_0x8d32('0x12a')],_0x8d32('0xda'))[_0x8d32('0x46')](_0x8d32('0xc5')),'ContactId':_0x3fac59['ContactId'],'ListId':_0x3fac59[_0x8d32('0xdb')],'VoiceQueueId':_0x3fac59[_0x8d32('0xdc')]||undefined,'CampaignId':_0x3fac59['CampaignId']||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x12b')));_0x4073a6({'reschedule':0x1});}}});}}};Dialer[_0x8d32('0x18')][_0x8d32('0x12f')]=function(_0x3b4c95){var _0x77784c=this[_0x8d32('0x22')][_0x3b4c95['uniqueid']];var _0xaa9a5f;if(_0x77784c&&_0x77784c['type']===_0x8d32('0xc3')){delete this[_0x8d32('0x22')][_0x3b4c95['uniqueid']];this[_0x8d32('0xcc')](this[_0x8d32('0x1d')][_0x77784c[_0x8d32('0xc4')]]);this[_0x8d32('0x1d')][_0x77784c[_0x8d32('0xc4')]][_0x8d32('0x130')]+=0x1;_0xaa9a5f=new Hangup(_0x77784c,_0x3b4c95);hopperUtils[_0x8d32('0xe2')](_0xaa9a5f)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x131')));hopperUtils[_0x8d32('0xca')](_0xaa9a5f)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x132')));}if(_0x77784c&&_0x77784c['type']!==_0x8d32('0xc3')&&isNotNull(this[_0x8d32('0x1c')][_0x77784c[_0x8d32('0xc4')]][_0x8d32('0x133')])){delete this[_0x8d32('0x22')][_0x3b4c95[_0x8d32('0xc2')]];this[_0x8d32('0xcc')](this[_0x8d32('0x1c')][_0x77784c['queue']]);this['voiceQueues'][_0x77784c[_0x8d32('0xc4')]][_0x8d32('0x115')]+=0x1;this[_0x8d32('0x1c')][_0x77784c[_0x8d32('0xc4')]][_0x8d32('0x116')]+=0x1;_0xaa9a5f=new Hangup(_0x77784c,_0x3b4c95);_0xaa9a5f[_0x8d32('0xdf')]=0x10;_0xaa9a5f[_0x8d32('0x6e')]=_0x8d32('0x134');_0xaa9a5f[_0x8d32('0x120')]=_0x8d32('0x135');hopperUtils['createHistory'](_0xaa9a5f)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x131')));hopperUtils[_0x8d32('0xca')](_0xaa9a5f)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x132')));}if(_0x77784c&&_0x77784c[_0x8d32('0x42')]!=='ivr'&&!isNotNull(this[_0x8d32('0x1c')][_0x77784c[_0x8d32('0xc4')]][_0x8d32('0x133')])){if(_0x3b4c95[_0x8d32('0x136')]===_0x8d32('0x137')){delete this[_0x8d32('0x22')][_0x3b4c95[_0x8d32('0xc2')]];this['voiceQueues'][_0x77784c[_0x8d32('0xc4')]][_0x8d32('0x115')]+=0x1;const _0x1d9195=new AgentComplete(_0x77784c,_0x3b4c95);_0x1d9195[_0x8d32('0xdd')]=this[_0x8d32('0x1c')][_0x77784c[_0x8d32('0xc4')]]['id'];hopperUtils[_0x8d32('0xe2')](_0x1d9195)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x138')));hopperUtils[_0x8d32('0xca')](_0x1d9195)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x139')));}else{delete this[_0x8d32('0x22')][_0x3b4c95['uniqueid']];this[_0x8d32('0xcc')](this[_0x8d32('0x1c')][_0x77784c['queue']]);this[_0x8d32('0x1c')][_0x77784c[_0x8d32('0xc4')]][_0x8d32('0x13a')]+=0x1;_0xaa9a5f=new Hangup(_0x77784c,_0x3b4c95);_0xaa9a5f[_0x8d32('0xdf')]=0xc;_0xaa9a5f[_0x8d32('0x6e')]=_0x3b4c95['cause-txt'];_0xaa9a5f[_0x8d32('0x120')]='Unknow';hopperUtils[_0x8d32('0xe2')](_0xaa9a5f)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x131')));hopperUtils[_0x8d32('0xca')](_0xaa9a5f)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x132')));}}};Dialer['prototype'][_0x8d32('0x31')]=function(_0x425f89){var _0x3b3d67=this;if(!_0x3b3d67['queuesSummary'][_0x425f89['name']]){_0x3b3d67[_0x8d32('0x28')][_0x425f89[_0x8d32('0x48')]]={'running':![]};}else if(_0x3b3d67[_0x8d32('0x28')][_0x425f89['name']][_0x8d32('0x13b')]===!![]){return;}else if(_0x3b3d67[_0x8d32('0x28')][_0x425f89[_0x8d32('0x48')]][_0x8d32('0x13b')]===![]){_0x3b3d67[_0x8d32('0x28')][_0x425f89[_0x8d32('0x48')]][_0x8d32('0x13b')]=!![];}var _0x51995b=_0x3b3d67[_0x8d32('0x1c')][_0x425f89[_0x8d32('0x48')]];var _0x2d1177=_0x51995b['message']!==utils[_0x8d32('0x6c')][_0x8d32('0x7a')];var _0x2ed801=utils[_0x8d32('0x13c')](_0x51995b);_0x51995b[_0x8d32('0x13d')]=utils['getQueueCampaignStatusMessage'](_0x51995b,_0x3b3d67[_0x8d32('0x1f')]);Promise[_0x8d32('0xa9')]()[_0x8d32('0x3e')](function(){if(_0x51995b[_0x8d32('0x13d')]===utils[_0x8d32('0x6c')][_0x8d32('0x7a')]){if(_0x2d1177){clearPredictiveAttributes(_0x51995b);_0x425f89[_0x8d32('0x24')]=undefined;_0x425f89[_0x8d32('0x25')]=undefined;}if(_0x51995b[_0x8d32('0x13d')]===utils[_0x8d32('0x6c')][_0x8d32('0x7a')]){_0x425f89[_0x8d32('0x13e')]=0x0;_0x425f89[_0x8d32('0xfb')]=0x0;_0x425f89[_0x8d32('0x13f')]=0x0;_0x425f89['talking']=0x0;_0x425f89[_0x8d32('0x140')]=0x0;}}else if(_0x51995b[_0x8d32('0x13d')]===utils[_0x8d32('0x6c')]['ACTIVE']&&!_0x2ed801){return _0x3b3d67[_0x8d32('0x91')](_0x51995b,!![])['then'](function(){return _0x3b3d67['ifTime'](_0x51995b,![]);})[_0x8d32('0x3e')](function(){return _0x3b3d67['checkDialMethod'](_0x51995b);})[_0x8d32('0xa0')](function(_0x2f2466){loggerSyncQueueSummary['debug'](_0x8d32('0x141'),util[_0x8d32('0x45')](_0x2f2466,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x51995b);});}else{clearPredictiveAttributes(_0x51995b);}})[_0x8d32('0x3e')](function(){var _0x88f7=_0x425f89[_0x8d32('0x142')](_0x51995b);if(_0x88f7||_0x51995b[_0x8d32('0x143')]){_0x51995b[_0x8d32('0x143')]=![];_0x425f89[_0x8d32('0x144')](_0x51995b);Object['assign'](_0x51995b,_0x425f89);emitOutboundVoiceQueueSummary(_0x425f89);}_0x3b3d67['queuesSummary'][_0x51995b[_0x8d32('0x48')]][_0x8d32('0x13b')]=![];})['catch'](function(_0x9ecbf8){logger[_0x8d32('0x66')]('[syncQueueSummary]',util[_0x8d32('0x45')](_0x9ecbf8,{'showHidden':![],'depth':null}));_0x3b3d67[_0x8d32('0x28')][_0x51995b[_0x8d32('0x48')]][_0x8d32('0x13b')]=![];});};Dialer[_0x8d32('0x18')][_0x8d32('0x33')]=_[_0x8d32('0x145')](function(){var _0x33c04f=_[_0x8d32('0x146')](this[_0x8d32('0x1c')],function(_0x40e914){return _0x40e914[_0x8d32('0x147')];});var _0x354353=_[_0x8d32('0x146')](this[_0x8d32('0x1e')],function(_0x13ed7c){return _0x13ed7c[_0x8d32('0x148')]&&_0x13ed7c[_0x8d32('0x85')]===_0x8d32('0x86');});if(_0x33c04f['length']>0x0&&_0x354353[_0x8d32('0x103')]>0x0){return Promise['resolve']()[_0x8d32('0x3e')](cmHopper['handlePreviewRecallNotifications'](_[_0x8d32('0x149')](_0x33c04f,'id'),previewRecallmeReminderInterval,_['map'](_0x354353,'id')))[_0x8d32('0x3e')](function(_0x33e6dd){for(var _0x57b651=0x0;_0x57b651<_0x33e6dd[_0x8d32('0x103')];_0x57b651++){var _0x95a549=_0x33e6dd[_0x57b651]['Agent']['name'];if(_0x95a549)io['to'](util['format'](_0x8d32('0x14a'),_0x95a549))['emit'](_0x8d32('0x14b'),{'hopper':_0x33e6dd[_0x57b651]});}})['catch'](function(_0x405945){logger[_0x8d32('0x66')](_0x8d32('0x14c'),_0x405945);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8d32('0x18')][_0x8d32('0x3c')]=function(){var _0x4d9b89=this;setInterval(function(){_0x4d9b89[_0x8d32('0x14d')](_0x4d9b89[_0x8d32('0x22')],_0x8d32('0x14e'));_0x4d9b89['clearZombieChannels'](_0x4d9b89['actions'],_0x8d32('0x14f'));},0x32c8);};Dialer[_0x8d32('0x18')][_0x8d32('0x14d')]=function(_0x412ad9,_0xe12275){var _0x30563c=this;for(var _0x5465ae in _0x412ad9){if(typeof _0x412ad9[_0x5465ae]!==_0x8d32('0xa8')){this['sequence'][_0x8d32('0x150')](function(){if(!_[_0x8d32('0xf9')](_0x412ad9[_0x5465ae])){return ami[_0x8d32('0x9b')]({'action':_0x8d32('0x85'),'channel':_0x412ad9[_0x5465ae]['channel']})[_0x8d32('0xa0')](function(_0x5d360f){if(_0x5d360f['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x412ad9[_0x5465ae]&&_0x412ad9[_0x5465ae][_0x8d32('0x42')]!==_0x8d32('0xc3')){_0x30563c[_0x8d32('0xcc')](_0x30563c[_0x8d32('0x1c')][_0x412ad9[_0x5465ae][_0x8d32('0xc4')]]);logger[_0x8d32('0x66')](_0x8d32('0x151'),_0xe12275,_0x5465ae,_0x412ad9[_0x5465ae][_0x8d32('0xc4')]);delete _0x412ad9[_0x5465ae];}if(_0x412ad9[_0x5465ae]&&_0x412ad9[_0x5465ae]['type']===_0x8d32('0xc3')){_0x30563c[_0x8d32('0xcc')](_0x30563c[_0x8d32('0x1d')][_0x412ad9[_0x5465ae][_0x8d32('0xc4')]]);logger['error'](_0x8d32('0x152'),_0xe12275,_0x5465ae,_0x412ad9[_0x5465ae][_0x8d32('0xc4')]);delete _0x412ad9[_0x5465ae];}},0x2328);}});}});}}};Dialer[_0x8d32('0x18')][_0x8d32('0x153')]=function(_0x4230d2){return Promise[_0x8d32('0xa9')]()['then'](voiceQueueRt[_0x8d32('0x153')](_0x4230d2))[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x154')));};Dialer['prototype'][_0x8d32('0xcc')]=function(_0x4b86aa){if(!_[_0x8d32('0x40')](_0x4b86aa)&&_0x4b86aa!==null){if(typeof _0x4b86aa[_0x8d32('0x7f')]!=='undefined'){if(_0x4b86aa['originated']>0x0){_0x4b86aa['originated']-=0x1;}else{logger['error'](_0x8d32('0x155'));}}}else{logger[_0x8d32('0x66')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x8d32('0x18')]['loggerHandler']=function(_0x5de428,_0x11982b){var _0xd479ce=this;return function(_0x66fd40){_0xd479ce[_0x8d32('0xcc')](_0x11982b);logger[_0x8d32('0x66')](_0x5de428,util['inspect'](_0x66fd40,{'showHidden':![],'depth':null}));};};Dialer[_0x8d32('0x18')][_0x8d32('0x156')]=function(_0x35305d,_0x490824,_0x82fd7f){var _0x12103e={'state':0x19,'statedesc':_0x8d32('0x157')};this[_0x8d32('0xcc')](_0x490824);this[_0x8d32('0x11c')](_['merge'](_0x12103e,_[_0x8d32('0xfa')](_0x82fd7f,[_0x8d32('0xee'),_0x8d32('0xdb'),_0x8d32('0x158'),'VoiceQueueId',_0x8d32('0xdd')])),_0x8d32('0x159'),_0x8d32('0x15a'));logger[_0x8d32('0x66')](_0x35305d);};Dialer[_0x8d32('0x18')][_0x8d32('0x11c')]=function(_0x527c10,_0x3b3151,_0x5bfff2){hopperUtils[_0x8d32('0xe2')](_0x527c10)['catch'](loggerCatch(_0x3b3151));hopperUtils[_0x8d32('0xca')](_0x527c10)[_0x8d32('0xa0')](loggerCatch(_0x5bfff2));};Dialer[_0x8d32('0x18')][_0x8d32('0xd8')]=function(_0xc3c55f,_0x2fb1bd){hopperUtils['createHistory'](_0xc3c55f)[_0x8d32('0xa0')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2fb1bd==0x0){hopperUtils[_0x8d32('0xca')](_0xc3c55f)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x15b')));}};Dialer[_0x8d32('0x18')][_0x8d32('0x14c')]=function(_0x3100f4){return Promise[_0x8d32('0xa9')]()[_0x8d32('0x3e')](cmHopper[_0x8d32('0x15c')](_0x3100f4['id'],previewRecallmeReminderInterval))['then'](function(_0x2877cb){for(var _0x58efcb=0x0;_0x58efcb<_0x2877cb[_0x8d32('0x103')];_0x58efcb++){var _0x46e3f5=_0x2877cb[_0x58efcb][_0x8d32('0x15d')]['name'];if(_0x46e3f5)io['to'](util[_0x8d32('0x46')]('user:%s',_0x46e3f5))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x2877cb[_0x58efcb]});}})['catch'](function(){});};Dialer['prototype'][_0x8d32('0xad')]=function(_0x572447){var _0x5d115c=this;return function(){_0x5d115c[_0x8d32('0x15e')](_0x572447);};};Dialer['prototype'][_0x8d32('0x15f')]=function(_0xc06cce,_0x53ae6b){var _0x426383=this;var _0x51f094=uuid['v4']();this['actions'][_0x51f094]=new Action(_0xc06cce,_0x53ae6b,_0x51f094);return new Promise(function(_0x39100a,_0x21dede){if(_[_0x8d32('0x40')](_0xc06cce)&&typeof _0xc06cce!=='object'){return _0x21dede(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x53ae6b[_0x8d32('0x160')])||_0x53ae6b[_0x8d32('0x160')]===null){return _0x21dede(msgResponse(_0x8d32('0x161'),'Failure',_0x8d32('0x162')));}var _0x34550c={'XMD-CALLERID':_0x426383[_0x8d32('0xf0')][_0x51f094][_0x8d32('0x163')](),'XMD-AGI':_0xc06cce[_0x8d32('0x133')]?util[_0x8d32('0x46')](_0x8d32('0x164'),ipAgi,_0xc06cce[_0x8d32('0x133')]):_0x8d32('0x165'),'XMD-AGIAFTER':_0xc06cce[_0x8d32('0xc8')]?util[_0x8d32('0x46')]('\x22agi://%s/square,%s\x22',ipAgi,_0xc06cce['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x8d32('0x166')](_0xc06cce)?util[_0x8d32('0x46')](_0x8d32('0x167'),_0xc06cce[_0x8d32('0x48')],_0xc06cce[_0x8d32('0x168')]||'',_0xc06cce['dialAgiAfterHangupAgent']?'c':'',_0xc06cce[_0x8d32('0x169')]||0x3):'NONE','XMD-CONTACTID':_0x53ae6b[_0x8d32('0xee')],'XMD-CDRTYPE':_0x8d32('0xa'),'CALLERID(all)':_0x426383[_0x8d32('0xf0')][_0x51f094]['getCaller'](),'XMD-AMD':_0xc06cce[_0x8d32('0x112')]?'ACTIVE':_0x8d32('0x165'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xc06cce[_0x8d32('0x112')]){_0x34550c[_0x8d32('0x16a')]=_0xc06cce[_0x8d32('0x16b')]||0x9c4;_0x34550c[_0x8d32('0x16c')]=_0xc06cce[_0x8d32('0x16d')]||0x5dc;_0x34550c[_0x8d32('0x16e')]=_0xc06cce['dialAMDAfterGreetingSilence']||0x320;_0x34550c['XMD-AMDTOTALANALYSISTIME']=_0xc06cce[_0x8d32('0x16f')]||0x1388;_0x34550c['XMD-AMDMINWORDLENGTH']=_0xc06cce[_0x8d32('0x170')]||0x64;_0x34550c[_0x8d32('0x171')]=_0xc06cce[_0x8d32('0x172')]||0x32;_0x34550c[_0x8d32('0x173')]=_0xc06cce[_0x8d32('0x174')]||0x3;_0x34550c['XMD-AMDSILENCETHRESHOLD']=_0xc06cce[_0x8d32('0x175')]||0x100;_0x34550c[_0x8d32('0x176')]=_0xc06cce[_0x8d32('0x177')]||0x1388;}if(utils[_0x8d32('0x166')](_0xc06cce)){_0x34550c[_0x8d32('0x178')]=_0x53ae6b[_0x8d32('0xdc')];}else{_0x34550c[_0x8d32('0x179')]=_0x53ae6b[_0x8d32('0xdd')];}var _0x4e0471=utils['setXMDContactVariables'](_0x53ae6b[_0x8d32('0x17a')]);Object[_0x8d32('0x17b')](_0x34550c,_0x4e0471);var _0x11cd04=_0x426383[_0x8d32('0x8a')](_0xc06cce[_0x8d32('0x8b')])?utils[_0x8d32('0x17c')](_0xc06cce[_0x8d32('0x8b')][_0x8d32('0x17d')],_0xc06cce[_0x8d32('0x17e')],_0xc06cce['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x8d32('0x17f')](_0xc06cce[_0x8d32('0x180')],_0xc06cce[_0x8d32('0x181')]):_0xc06cce[_0x8d32('0x180')]):utils[_0x8d32('0x17c')](_[_0x8d32('0xf9')](_0xc06cce['TrunkBackup'])?_0xc06cce[_0x8d32('0x8b')][_0x8d32('0x17d')]:_0xc06cce[_0x8d32('0x8c')][_0x8d32('0x17d')],_0xc06cce[_0x8d32('0x17e')],_0xc06cce[_0x8d32('0x181')]>0x0?utils[_0x8d32('0x17f')](_0xc06cce[_0x8d32('0x180')],_0xc06cce[_0x8d32('0x181')]):_0xc06cce[_0x8d32('0x180')]);if(_0x11cd04){_0x34550c['XMD-ORIGINATECALLERIDNAME']=_0x426383['actions'][_0x51f094][_0x8d32('0x182')]=utils[_0x8d32('0x183')](_0x11cd04);_0x34550c['XMD-ORIGINATECALLERIDNUM']=_0x53ae6b[_0x8d32('0x160')];}_0xc06cce[_0x8d32('0x184')]=_0x34550c;return ami[_0x8d32('0x9b')]({'actionid':_0x51f094,'action':'originate','channel':_0x426383['isTrunkReachable'](_0xc06cce['Trunk'])?util[_0x8d32('0x46')](_0x8d32('0x185'),_0xc06cce['Trunk'][_0x8d32('0x48')],isNotNull(_0xc06cce[_0x8d32('0x186')])?_0xc06cce[_0x8d32('0x186')][_0x8d32('0x187')]()||'':'',_0xc06cce[_0x8d32('0x188')]>0x0?_0x53ae6b[_0x8d32('0x160')]['substring'](_0xc06cce[_0x8d32('0x188')]):_0x53ae6b[_0x8d32('0x160')]):util['format'](_0x8d32('0x185'),_['isNil'](_0xc06cce[_0x8d32('0x8c')])?_0xc06cce[_0x8d32('0x8b')][_0x8d32('0x48')]:_0xc06cce[_0x8d32('0x8c')][_0x8d32('0x48')],isNotNull(_0xc06cce[_0x8d32('0x186')])?_0xc06cce['dialPrefix'][_0x8d32('0x187')]()||'':'',_0xc06cce[_0x8d32('0x188')]>0x0?_0x53ae6b[_0x8d32('0x160')][_0x8d32('0x189')](_0xc06cce[_0x8d32('0x188')]):_0x53ae6b['phone']),'callerid':_0x11cd04,'Exten':_0x8d32('0x18a'),'Context':'from-sip','Priority':'1','variable':_0x34550c,'timeout':(_0xc06cce['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x51f094})[_0x8d32('0x3e')](function(_0x479e4f){return _0x39100a(_0x479e4f);})[_0x8d32('0xa0')](function(_0x14307f){_0xc06cce['outboundOriginateFailureCallsDay']+=0x1;var _0x57bc94=new History(_0x426383['actions'][_0x51f094]);logger[_0x8d32('0x66')](util[_0x8d32('0x46')]('[originateError]:\x20%s',JSON[_0x8d32('0x74')](_0x14307f)));_0x57bc94['state']=0xe;_0x57bc94[_0x8d32('0x6e')]=_0x8d32('0x18b');_0x57bc94['starttime']=moment()[_0x8d32('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x57bc94[_0x8d32('0x6f')]=_0x57bc94[_0x8d32('0x70')];hopperUtils['createHistory'](_0x57bc94)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x18c')));_0x426383[_0x8d32('0xca')](_0x57bc94)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x18c')))[_0x8d32('0x1a')](function(){delete _0x426383[_0x8d32('0xf0')][_0x51f094];return _0x21dede(msgResponse(_0x8d32('0x161'),'Error',_0x8d32('0x18d')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x4c4d69,_0x2fff08,_0xe24610){var _0x290881=new History(_0x2fff08);if(_0x290881[_0x8d32('0x12c')]+_0x290881[_0x8d32('0x12d')]+_0x290881[_0x8d32('0x122')]+_0x290881['countnosuchnumberretry']+_0x290881[_0x8d32('0xd2')]+_0x290881[_0x8d32('0xe8')]+_0x290881['countmachineretry']+_0x290881[_0x8d32('0x123')]>=_0xe24610[_0x8d32('0x124')]-0x1){return!![];}switch(_0x4c4d69){case 0x3:if(_0x290881['countnoanswerretry']>=_0xe24610[_0x8d32('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x290881[_0x8d32('0x122')]+=0x1,'scheduledat':moment()[_0x8d32('0xed')](_0xe24610['dialNoAnswerRetryFrequency'],_0x8d32('0xda'))[_0x8d32('0x46')](_0x8d32('0xc5')),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881['ListId'],'VoiceQueueId':_0x290881[_0x8d32('0xdc')]||undefined,'CampaignId':_0x290881[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x18f')));break;case 0x5:if(_0x290881[_0x8d32('0x12c')]>=_0xe24610[_0x8d32('0x190')]-0x1){return!![];}hopperUtils[_0x8d32('0xec')]({'active':![],'countbusyretry':_0x290881[_0x8d32('0x12c')]+=0x1,'scheduledat':moment()['add'](_0xe24610[_0x8d32('0x191')],'minutes')[_0x8d32('0x46')](_0x8d32('0xc5')),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881[_0x8d32('0xdb')],'VoiceQueueId':_0x290881[_0x8d32('0xdc')]||undefined,'CampaignId':_0x290881[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x192')));break;case 0x8:if(_0x290881[_0x8d32('0x12d')]>=_0xe24610[_0x8d32('0x193')]-0x1){return!![];}hopperUtils[_0x8d32('0xec')]({'active':![],'countcongestionretry':_0x290881[_0x8d32('0x12d')]+=0x1,'scheduledat':moment()[_0x8d32('0xed')](_0xe24610[_0x8d32('0x194')],_0x8d32('0xda'))[_0x8d32('0x46')](_0x8d32('0xc5')),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881[_0x8d32('0xdb')],'VoiceQueueId':_0x290881[_0x8d32('0xdc')]||undefined,'CampaignId':_0x290881[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x195')));break;case 0x0:if(_0x290881[_0x8d32('0x12e')]>=_0xe24610[_0x8d32('0x196')]-0x1){return!![];}else{hopperUtils[_0x8d32('0xec')]({'active':![],'countnosuchnumberretry':_0x290881[_0x8d32('0x12e')]+=0x1,'scheduledat':moment()[_0x8d32('0xed')](_0xe24610[_0x8d32('0x197')],_0x8d32('0xda'))['format'](_0x8d32('0xc5')),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881[_0x8d32('0xdb')],'VoiceQueueId':_0x290881['VoiceQueueId']||undefined,'CampaignId':_0x290881[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x290881['countdropretry']>=_0xe24610[_0x8d32('0xd7')]-0x1){return!![];}hopperUtils[_0x8d32('0xec')]({'active':![],'countdropretry':_0x290881[_0x8d32('0xd2')]+=0x1,'scheduledat':moment()[_0x8d32('0xed')](_0xe24610[_0x8d32('0xd4')],_0x8d32('0xda'))[_0x8d32('0x46')](_0x8d32('0xc5')),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881[_0x8d32('0xdb')],'VoiceQueueId':_0x290881[_0x8d32('0xdc')]||undefined,'CampaignId':_0x290881[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x290881[_0x8d32('0xe8')]>=_0xe24610[_0x8d32('0xeb')]-0x1){return!![];}hopperUtils[_0x8d32('0xec')]({'active':![],'countabandonedretry':_0x290881[_0x8d32('0xe8')]+=0x1,'scheduledat':moment()[_0x8d32('0xed')](_0xe24610[_0x8d32('0xe9')],_0x8d32('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881[_0x8d32('0xdb')],'VoiceQueueId':_0x290881['VoiceQueueId']||undefined,'CampaignId':_0x290881['CampaignId']||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0xef')));break;case 0x13:if(_0x290881[_0x8d32('0x121')]>=_0xe24610[_0x8d32('0x127')]-0x1){return!![];}hopperUtils[_0x8d32('0xec')]({'active':![],'countmachineretry':_0x290881['countmachineretry']+=0x1,'scheduledat':moment()[_0x8d32('0xed')](_0xe24610[_0x8d32('0x12a')],'minutes')[_0x8d32('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881[_0x8d32('0xdb')],'VoiceQueueId':_0x290881['VoiceQueueId']||undefined,'CampaignId':_0x290881[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x12b')));break;case 0x14:if(_0x290881[_0x8d32('0x123')]>=_0xe24610[_0x8d32('0x198')]-0x1){return!![];}hopperUtils[_0x8d32('0xec')]({'active':![],'countagentrejectretry':_0x290881[_0x8d32('0x123')]+=0x1,'scheduledat':moment()['add'](_0xe24610[_0x8d32('0x199')],'minutes')[_0x8d32('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x290881[_0x8d32('0xee')],'ListId':_0x290881['ListId'],'VoiceQueueId':_0x290881[_0x8d32('0xdc')]||undefined,'CampaignId':_0x290881['CampaignId']||undefined})[_0x8d32('0xa0')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x8d32('0x18')][_0x8d32('0x10e')]=function(_0xe6de23,_0x282b31,_0x27edca){var _0x4b6dc3=this;var _0xf94d27=new History(_0xe6de23);var _0x3be495=![];var _0x46a2ca;var _0x901e7b;return new Promise(function(_0x4588c4,_0x1c5333){if(_[_0x8d32('0x40')](_0x282b31)&&typeof _0x282b31!==_0x8d32('0x19a')){return _0x1c5333(msgResponse('[callProgressDetecting]',_0x8d32('0x92'),_0x8d32('0x19b')));}if(_[_0x8d32('0x40')](_0x27edca)&&typeof _0x27edca!==_0x8d32('0x19a')){return _0x1c5333(msgResponse(_0x8d32('0x19c'),_0x8d32('0x92'),'evt\x20is\x20undefine'));}hopperUtils[_0x8d32('0xd5')](_0xf94d27,_0x27edca[_0x8d32('0xc6')],_0x282b31)[_0x8d32('0x3e')](function(_0x5eba48){if(_0x5eba48[_0x8d32('0xd9')]==0x1)_0x3be495=!![];switch(_0x27edca[_0x8d32('0xc6')]){case'0':_0x282b31[_0x8d32('0x19d')]+=0x1;_0xf94d27[_0x8d32('0xdf')]=0x0;_0xf94d27[_0x8d32('0x6e')]=_0x8d32('0x19e');_0xf94d27[_0x8d32('0x12e')]+=0x1;_0xf94d27[_0x8d32('0xd3')]+=0x1;ami[_0x8d32('0x41')](_0x8d32('0x19f'),ut[_0x8d32('0x11a')](_0xe6de23,_0x8d32('0x1a0')));_0x46a2ca=_0x282b31['dialNoSuchNumberRetryFrequency'];_0x901e7b=_0x282b31[_0x8d32('0xea')];hopperUtils[_0x8d32('0xe2')](_0xf94d27)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x1a1')));if(_0x4b6dc3[_0x8d32('0x1a2')](0x0,_0xe6de23,_0x282b31)&&!_0x3be495){if(_0xf94d27['countnosuchnumberretry']>=_0x282b31['dialNoSuchNumberMaxRetry']){_0x4b6dc3[_0x8d32('0x128')](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1a3'));}else{_0x4b6dc3[_0x8d32('0x125')](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1a3'));}}break;case'3':_0x282b31[_0x8d32('0x1a4')]+=0x1;_0xf94d27[_0x8d32('0xdf')]=0x3;_0xf94d27[_0x8d32('0x6e')]=_0x8d32('0x1a5');_0xf94d27['countnoanswerretry']+=0x1;_0xf94d27['countglobal']+=0x1;var _0x4b5ced=ut[_0x8d32('0x1a6')](_0xe6de23,_0x282b31);ami[_0x8d32('0x41')]('custom:agentnoanswer',_0x4b5ced);_0x46a2ca=_0x282b31[_0x8d32('0x1a7')];_0x901e7b=_0x282b31[_0x8d32('0xea')];hopperUtils[_0x8d32('0xe2')](_0xf94d27)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x1a8')));if(_0x4b6dc3['checkRetriveMax'](0x3,_0xe6de23,_0x282b31)&&!_0x3be495){if(_0xf94d27[_0x8d32('0x122')]>=_0x282b31[_0x8d32('0x18e')]){_0x4b6dc3[_0x8d32('0x128')](_0xf94d27,_0x4588c4,_0x1c5333,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4b6dc3['stateGlobal'](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1a9'));}}break;case'5':_0x282b31['outboundBusyCallsDay']+=0x1;_0xf94d27[_0x8d32('0xdf')]=0x5;_0xf94d27[_0x8d32('0x6e')]=_0x8d32('0x1aa');_0xf94d27[_0x8d32('0x12c')]+=0x1;_0xf94d27[_0x8d32('0xd3')]+=0x1;ami[_0x8d32('0x41')](_0x8d32('0x1ab'),ut[_0x8d32('0x11a')](_0xe6de23,_0x8d32('0x1ac')));_0x46a2ca=_0x282b31[_0x8d32('0x191')];_0x901e7b=_0x282b31[_0x8d32('0xea')];hopperUtils[_0x8d32('0xe2')](_0xf94d27)[_0x8d32('0xa0')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4b6dc3[_0x8d32('0x1a2')](0x5,_0xe6de23,_0x282b31)&&!_0x3be495){if(_0xf94d27[_0x8d32('0x12c')]>=_0x282b31[_0x8d32('0x190')]){_0x4b6dc3[_0x8d32('0x128')](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1ad'));}else{_0x4b6dc3['stateGlobal'](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1ad'));}}break;case'8':_0x282b31[_0x8d32('0x1ae')]+=0x1;_0xf94d27[_0x8d32('0xdf')]=0x8;_0xf94d27[_0x8d32('0x6e')]=_0x8d32('0x1af');_0xf94d27[_0x8d32('0x12d')]+=0x1;_0xf94d27['countglobal']+=0x1;_0x46a2ca=_0x282b31['dialCongestionRetryFrequency'];_0x901e7b=_0x282b31[_0x8d32('0xea')];ami[_0x8d32('0x41')](_0x8d32('0x1b0'),ut[_0x8d32('0x11a')](_0xe6de23,'congestion'));hopperUtils[_0x8d32('0xe2')](_0xf94d27)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x1b1')));if(_0x4b6dc3['checkRetriveMax'](0x8,_0xe6de23,_0x282b31)&&!_0x3be495){if(_0xf94d27[_0x8d32('0x12d')]>=_0x282b31['dialCongestionMaxRetry']){_0x4b6dc3[_0x8d32('0x128')](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1b2'));}else{_0x4b6dc3['stateGlobal'](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1b2'));}}break;case'11':_0x282b31['outboundAbandonedCallsDay']+=0x1;_0xf94d27['state']=0xb;_0xf94d27[_0x8d32('0x6e')]=_0x8d32('0xe5');_0xf94d27[_0x8d32('0xe8')]+=0x1;_0xf94d27[_0x8d32('0xd3')]+=0x1;_0x46a2ca=_0x282b31[_0x8d32('0xe9')];_0x901e7b=_0x282b31[_0x8d32('0xea')];hopperUtils['createHistory'](_0xf94d27)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4b6dc3[_0x8d32('0x1a2')](0xb,_0xe6de23,_0x282b31)&&!_0x3be495){if(_0xf94d27[_0x8d32('0xe8')]>=_0x282b31[_0x8d32('0xeb')]){_0x4b6dc3[_0x8d32('0x128')](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1b3'));}else{_0x4b6dc3[_0x8d32('0x125')](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1b3'));}}break;case'20':_0x282b31['outboundRejectCallsDay']+=0x1;_0xf94d27[_0x8d32('0xdf')]=0x14;_0xf94d27[_0x8d32('0x6e')]=_0x8d32('0x1b4');_0xf94d27[_0x8d32('0x123')]+=0x1;_0xf94d27['countglobal']+=0x1;_0x46a2ca=_0x282b31[_0x8d32('0x199')];_0x901e7b=_0x282b31['callAdditionalPhoneAfterMin'];ami[_0x8d32('0x41')]('custom:agentreject',ut[_0x8d32('0x11a')](_0xe6de23,_0x8d32('0x1b5')));hopperUtils[_0x8d32('0xe2')](_0xf94d27)[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x1b6')));if(_0x4b6dc3[_0x8d32('0x1a2')](0x14,_0xe6de23,_0x282b31)&&!_0x3be495){if(_0xf94d27[_0x8d32('0x123')]>=_0x282b31[_0x8d32('0x198')]){_0x4b6dc3['createStateFinal'](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1b7'));}else{_0x4b6dc3[_0x8d32('0x125')](_0xf94d27,_0x4588c4,_0x1c5333,_0x8d32('0x1b7'));}}break;default:_0x282b31[_0x8d32('0x13a')]+=0x1;_0xf94d27[_0x8d32('0xdf')]=0xc;_0xf94d27[_0x8d32('0x6e')]=_0x27edca[_0x8d32('0xc6')];_0x46a2ca=_0x282b31['dialAgentRejectRetryFrequency'];_0x901e7b=_0x282b31[_0x8d32('0xea')];hopperUtils[_0x8d32('0xe2')](_0xf94d27)['catch'](loggerCatch(_0x8d32('0x1b8')));if(_0x4b6dc3[_0x8d32('0x1a2')](_0x27edca[_0x8d32('0xc6')],_0xe6de23,_0x282b31)&&!_0x3be495){if(_0xf94d27[_0x8d32('0x12c')]+_0xf94d27[_0x8d32('0x12d')]+_0xf94d27[_0x8d32('0x122')]+_0xf94d27[_0x8d32('0x12e')]+_0xf94d27['countdropretry']+_0xf94d27[_0x8d32('0xe8')]+_0xf94d27[_0x8d32('0x121')]+_0xf94d27[_0x8d32('0x123')]>=_0x282b31[_0x8d32('0x124')]){_0x4b6dc3[_0x8d32('0x125')](_0xf94d27,_0x4588c4,_0x1c5333,_0x27edca[_0x8d32('0xc6')]);}else{_0x4b6dc3[_0x8d32('0x128')](_0xf94d27,_0x4588c4,_0x1c5333,_0x27edca['reason']);}}}})['then'](function(){if(_0x3be495){hopperUtils['swapAdditionalPhones'](_0xf94d27,_0x46a2ca,_0x901e7b)[_0x8d32('0x3e')](function(){return _0x4588c4(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x405511,_0xe73000,_0x1c696c,_0x451a0d){var _0x10c42f=new Final(_0x405511);_0x10c42f[_0x8d32('0xdf')]=0xf;_0x10c42f[_0x8d32('0x6e')]=_0x8d32('0x1b9');this[_0x8d32('0x128')](_0x10c42f,_0xe73000,_0x1c696c,_0x451a0d);};Dialer[_0x8d32('0x18')]['createStateFinal']=function(_0x17f75b,_0x57274d,_0x41ce92,_0x180ac4){hopperUtils[_0x8d32('0xca')](_0x17f75b)[_0x8d32('0x3e')](function(){return _0x57274d(msgResponse('[callProgressDetecting]',_0x8d32('0x1ba'),_0x180ac4));})[_0x8d32('0xa0')](function(){return _0x41ce92(msgResponse(_0x8d32('0x1bb'),'Failure',_0x8d32('0x1bc')));});};Dialer[_0x8d32('0x18')]['predictive']=function(_0x5f374f){var _0xe292ca=_0x5f374f['dialPredictiveOptimizationPercentage']/0x64;var _0xb52374=_0x5f374f[_0x8d32('0xce')]/(_0x5f374f[_0x8d32('0xce')]+_0x5f374f[_0x8d32('0x115')]);var _0x4cf290=Math[_0x8d32('0x1bd')](_0x5f374f[_0x8d32('0x1be')]*(_0x5f374f[_0x8d32('0x1bf')]/0x64));var _0x53831a=Math[_0x8d32('0x1bd')](_0x5f374f[_0x8d32('0x1be')]*(_0x5f374f['predictiveIntervalMinThreshold']/0x64));var _0x4ed756=_0x5f374f['available']+_0x5f374f['talking'];var _0xaa1115=Math[_0x8d32('0x1c0')](_0x5f374f[_0x8d32('0x5b')]*_0x5f374f[_0x8d32('0x5e')]*_0x5f374f['predictiveIntervalHitRate']*_0x5f374f['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x5f374f[_0x8d32('0x25')])){if(!_['isUndefined'](_0x5f374f[_0x8d32('0x24')])){_0x5f374f['startPredictive']=undefined;loggerPredictive['error'](_0x8d32('0x1c1'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x5f374f['handlePredictive'])){loggerPredictive[_0x8d32('0x66')](_0x8d32('0x1c1'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5f374f['handlePredictive']);_0x5f374f[_0x8d32('0x65')]=undefined;}_0x5f374f[_0x8d32('0x25')]=moment()[_0x8d32('0x46')](_0x8d32('0xc5'));loggerPredictive[_0x8d32('0x4b')](_0x5f374f['name'],_0x8d32('0x1c2'),_0x5f374f[_0x8d32('0x25')]);this[_0x8d32('0xb3')](_0x5f374f,0x1);}else if(ifInterval(_0x5f374f['dialPredictiveInterval'],_0x5f374f[_0x8d32('0x25')])){this[_0x8d32('0xb3')](_0x5f374f,0x1);loggerPredictiveCalls[_0x8d32('0x4b')](_0x8d32('0x1c3'),_0x5f374f[_0x8d32('0x25')],_0x5f374f[_0x8d32('0x48')]);_0x5f374f[_0x8d32('0x5b')]=0x0;_0x5f374f['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xe292ca<_0xb52374&&_0x5f374f[_0x8d32('0x1c4')]===_0x8d32('0x1c5')){clearPredictiveAttributes(_0x5f374f);loggerPredictive[_0x8d32('0x4b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x8d32('0x1c6'),_0xb52374,_0x8d32('0x25'),_0x5f374f[_0x8d32('0x48')]);}else if(_0xaa1115<_0x5f374f[_0x8d32('0x1c7')]&&_0x5f374f[_0x8d32('0x1c4')]===_0x8d32('0x1c5')){clearPredictiveAttributes(_0x5f374f);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x1c8'),_0x8d32('0x1c9'),_0xaa1115,_0x8d32('0x1ca'),_0x5f374f['predictiveIntervalErlangCallsDroppedCalls'],_0x8d32('0x25'),_0x5f374f[_0x8d32('0x48')]);}else if(!ifInterval(_0x5f374f[_0x8d32('0x1cb')],_0x5f374f[_0x8d32('0x25')])&&_['isUndefined'](_0x5f374f[_0x8d32('0x24')])&&!_[_0x8d32('0x40')](_0x5f374f['startProgressive'])){_0x5f374f[_0x8d32('0x24')]=moment()['format'](_0x8d32('0xc5'));loggerPredictive[_0x8d32('0x4b')](_0x5f374f[_0x8d32('0x48')],_0x8d32('0x1cc'),_0x5f374f[_0x8d32('0x24')]);hopperUtils[_0x8d32('0x1cd')](_0x5f374f[_0x8d32('0x1cb')])[_0x8d32('0x3e')](this[_0x8d32('0x1ce')](_0x5f374f))[_0x8d32('0x3e')](mergeDataErlangB(_0x5f374f))[_0x8d32('0x3e')](this[_0x8d32('0x1cf')](_0x5f374f))[_0x8d32('0xa0')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5f374f));}else if(!ifInterval(_0x5f374f[_0x8d32('0x1cb')],_0x5f374f[_0x8d32('0x24')])){_0x5f374f[_0x8d32('0x1c7')]=0x0;_0x5f374f[_0x8d32('0x24')]=moment()['format'](_0x8d32('0xc5'));loggerPredictive['info'](_0x5f374f[_0x8d32('0x48')],_0x8d32('0x1d0'),_0x5f374f[_0x8d32('0x24')]);clearInterval(_0x5f374f[_0x8d32('0x65')]);_0x5f374f[_0x8d32('0x65')]=undefined;hopperUtils[_0x8d32('0x1cd')](_0x5f374f[_0x8d32('0x1cb')])[_0x8d32('0x3e')](this[_0x8d32('0x1ce')](_0x5f374f))['then'](mergeDataErlangB(_0x5f374f))[_0x8d32('0x3e')](this[_0x8d32('0x1cf')](_0x5f374f))[_0x8d32('0xa0')](loggerCatchPredictive(_0x8d32('0x1d1'),_0x5f374f));}else if(_0x5f374f[_0x8d32('0x1be')]&&_0x4ed756<_0x5f374f[_0x8d32('0x1be')]-_0x53831a){clearPredictiveAttributes(_0x5f374f);loggerPredictive[_0x8d32('0x4b')](_0x5f374f[_0x8d32('0x48')],_0x8d32('0x1d2'),_0x4ed756,_0x8d32('0x1d3'),_0x5f374f[_0x8d32('0x1be')],'-',_0x53831a,'=',_0x5f374f['predictiveIntervalAvailable']-_0x53831a,')');}else if(_0x5f374f[_0x8d32('0x1be')]&&_0x4ed756>_0x5f374f[_0x8d32('0x1be')]+_0x4cf290){clearPredictiveAttributes(_0x5f374f);loggerPredictive[_0x8d32('0x4b')](_0x5f374f[_0x8d32('0x48')],_0x8d32('0x1d2'),_0x4ed756,_0x8d32('0x1d4'),_0x5f374f[_0x8d32('0x1be')],'+',_0x4cf290,'=',_0x5f374f[_0x8d32('0x1be')]+_0x4cf290,')');}};Dialer[_0x8d32('0x18')][_0x8d32('0x1ce')]=function(_0x9faeb9){var _0x11b779=this;return function(_0x160011){return new Promise(function(_0x159bc5,_0x25a929){_[_0x8d32('0x61')](_0x9faeb9,_0x160011[0x0]);if(checkGetDataPredictive(_0x160011[0x0])){var _0x8ad88a=_0x9faeb9['predictiveIntervalAvailable']=_0x9faeb9['talking']+_0x9faeb9[_0x8d32('0x13e')];var _0x38ed1a=_0x9faeb9[_0x8d32('0x1cb')]*0x3c;var _0x390f85=_0x160011[0x0][_0x8d32('0x56')]+_0x160011[0x0][_0x8d32('0x54')];var _0x34965a=(_0x160011[0x0]['predictiveIntervalAnsweredCalls']+_0x160011[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x160011[0x0][_0x8d32('0x52')])/_0x160011[0x0]['predictiveIntervalTotalCalls'];_0x9faeb9[_0x8d32('0x1d5')]=_0x34965a>0x0?_0x34965a:0x1;switch(_0x9faeb9[_0x8d32('0x1c4')]){case'dropRate':var _0xbdebee=_0x9faeb9[_0x8d32('0x1d6')]/0x64;return _0x11b779[_0x8d32('0x1d7')](_0x8ad88a,_0x38ed1a,_0x390f85,_0x34965a,_0xbdebee)[_0x8d32('0x3e')](function(_0x138538){return _0x159bc5(_0x138538);});case'agentBusyFactor':var _0x34d8d7=_0x9faeb9[_0x8d32('0x1d6')]/0x64;return _0x11b779[_0x8d32('0x1d8')](_0x8ad88a,_0x38ed1a,_0x390f85,_0x34965a,_0x34d8d7)[_0x8d32('0x3e')](function(_0x18f4c5){return _0x159bc5(_0x18f4c5);});default:return _0x25a929(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x25a929(msgResponse(_0x8d32('0x1d9'),'Failure',_0x8d32('0x1da')));}});};};Dialer[_0x8d32('0x18')]['getDataPredictiveOld']=function(_0x4e1394){var _0x51fac1=this;return function(_0x17801a){return new Promise(function(_0xd5bb2d,_0x27dfd1){_[_0x8d32('0x61')](_0x4e1394,_0x17801a[0x0]);if(checkGetDataPredictive(_0x17801a[0x0])){loggerPredictive['info'](JSON[_0x8d32('0x74')](_0x17801a[0x0]));if(_0x4e1394['dialPredictiveOptimization']==='dropRate'){return _0x51fac1[_0x8d32('0x153')](_0x4e1394['id'])[_0x8d32('0x3e')](function(_0x1f72d6){var _0x32249e=_0x4e1394[_0x8d32('0x1db')]-_0x1f72d6[0x0][_0x8d32('0x1dc')];var _0x281dc6=_0x4e1394[_0x8d32('0x1cb')]*0x3c;var _0x4a3f50=_0x17801a[0x0][_0x8d32('0x56')]+_0x17801a[0x0][_0x8d32('0x54')];var _0x432e53=(_0x17801a[0x0][_0x8d32('0x50')]+_0x17801a[0x0][_0x8d32('0x51')]+_0x17801a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x17801a[0x0][_0x8d32('0x4e')];var _0x359324=_0x4e1394['dialPredictiveOptimizationPercentage']/0x64;_0x4e1394[_0x8d32('0x1dd')]=_0x1f72d6[0x0]['outboundQueuePauses']||0x0;_0x4e1394['predictiveIntervalHitRate']=_0x432e53>0x0?_0x432e53:0x1;return _0x51fac1[_0x8d32('0x1d7')](_0x32249e,_0x281dc6,_0x4a3f50,_0x432e53,_0x359324);})[_0x8d32('0x3e')](function(_0x120f95){return _0xd5bb2d(_0x120f95);})['catch'](function(_0x3e1927){return _0x27dfd1(msgResponse(_0x8d32('0x1de'),_0x8d32('0x92'),JSON[_0x8d32('0x74')](_0x3e1927)));});}if(_0x4e1394[_0x8d32('0x1c4')]===_0x8d32('0x1df')){return _0x51fac1[_0x8d32('0x153')](_0x4e1394['id'])['then'](function(_0x2b0928){var _0x1641e3=_0x4e1394[_0x8d32('0x1db')]-_0x2b0928[0x0]['outboundQueuePauses'];var _0x1640b6=_0x4e1394[_0x8d32('0x1cb')]*0x3c;var _0x5a2df7=_0x17801a[0x0][_0x8d32('0x56')]+_0x17801a[0x0][_0x8d32('0x54')];var _0x1b24d0=(_0x17801a[0x0]['predictiveIntervalAnsweredCalls']+_0x17801a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x17801a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x17801a[0x0][_0x8d32('0x4e')];var _0x37eba1=_0x4e1394['dialPredictiveOptimizationPercentage']/0x64;_0x4e1394[_0x8d32('0x1dd')]=_0x2b0928[0x0]['outboundQueuePauses']||0x0;_0x4e1394[_0x8d32('0x1d5')]=_0x1b24d0>0x0?_0x1b24d0:0x1;return _0x51fac1[_0x8d32('0x1d8')](_0x1641e3,_0x1640b6,_0x5a2df7,_0x1b24d0,_0x37eba1);})['then'](function(_0x5b0517){return _0xd5bb2d(_0x5b0517);})[_0x8d32('0xa0')](function(_0x177f7b){return _0x27dfd1(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x177f7b)));});}}else{return _0x27dfd1(msgResponse(_0x8d32('0x1d9'),_0x8d32('0x92'),_0x8d32('0x1da')));}});};};Dialer[_0x8d32('0x18')][_0x8d32('0x1cf')]=function(_0x4908bc){var _0x1bd942=this;return function(){var _0x168073=0x0;var _0x1d2d39=Math[_0x8d32('0x1c0')](_0x4908bc[_0x8d32('0x1e0')]*0x3e8);if(_0x1d2d39>0x0){_0x1d2d39=_0x1d2d39<0x64?0x64:_0x1d2d39;loggerPredictive[_0x8d32('0x4b')](_0x4908bc['name'],_0x8d32('0x1e1'),_0x1d2d39,_0x8d32('0x1e2'));_0x4908bc['handlePredictive']=setInterval(function(){_0x1bd942['handlePredictive'](_0x4908bc);loggerPredictiveCalls[_0x8d32('0x4b')](_0x8d32('0x1e3'),_0x168073+=0x1);},_0x1d2d39);}else{loggerPredictive['info'](_0x4908bc['name'],_0x8d32('0x1e4'));}};};Dialer[_0x8d32('0x18')][_0x8d32('0x1e5')]=function(_0x40c694,_0x4e4d5e){var _0x45afa0=this;return function(_0x3573d3){if(_['isEmpty'](_0x3573d3)){if(_[_0x8d32('0xf9')](_0x4e4d5e[_0x8d32('0x158')])||!_0x4e4d5e['recallme']){if(_0x40c694[_0x8d32('0xb0')]===_0x8d32('0xb6')){_0x40c694['queueStatusComplete']=_[_0x8d32('0x40')](_0x40c694[_0x8d32('0x71')])?!![]:_0x40c694[_0x8d32('0x71')];var _0x3a711d=uuid['v4']();_0x45afa0['actions'][_0x3a711d]=new Action(_0x40c694,_0x4e4d5e,_0x3a711d);loggerBooked['info'](_0x8d32('0x1e6'),_0x3a711d,_0x8d32('0x1e7'),JSON[_0x8d32('0x74')](_0x40c694[_0x8d32('0x71')]),_0x8d32('0x1e8'),_0x40c694['name']);if(_0x40c694[_0x8d32('0x71')]){_0x40c694['queueStatusComplete']=![];_0x45afa0[_0x8d32('0x27')][_0x45afa0['actions'][_0x3a711d]['queue']]=[];ami[_0x8d32('0x9b')]({'actionid':_0x3a711d,'action':'queuestatus','queue':_0x40c694['name']})[_0x8d32('0xa0')](function(){_0x45afa0['updateOriginated'](_0x40c694);hopperUtils[_0x8d32('0xec')]({'active':![],'ContactId':_0x45afa0['actions'][_0x3a711d][_0x8d32('0xee')],'ListId':_0x45afa0[_0x8d32('0xf0')][_0x3a711d][_0x8d32('0xdb')],'VoiceQueueId':_0x45afa0['actions'][_0x3a711d][_0x8d32('0xdc')]||undefined,'CampaignId':_0x45afa0[_0x8d32('0xf0')][_0x3a711d][_0x8d32('0xdd')]||undefined})['catch'](loggerCatch(_0x8d32('0x1e9')));delete _0x45afa0[_0x8d32('0xf0')][_0x3a711d];});}else{loggerBooked['info'](_0x8d32('0x1ea'),JSON[_0x8d32('0x74')](_0x40c694['queueStatusComplete']),'Queue:\x20',_0x40c694[_0x8d32('0x48')]);_0x45afa0[_0x8d32('0xcc')](_0x40c694);hopperUtils[_0x8d32('0xec')]({'active':![],'ContactId':_0x45afa0['actions'][_0x3a711d]['ContactId'],'ListId':_0x45afa0[_0x8d32('0xf0')][_0x3a711d][_0x8d32('0xdb')],'VoiceQueueId':_0x45afa0['actions'][_0x3a711d]['VoiceQueueId']||undefined,'CampaignId':_0x45afa0[_0x8d32('0xf0')][_0x3a711d]['CampaignId']||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x1e9')));delete _0x45afa0[_0x8d32('0xf0')][_0x3a711d];}}else{return _0x45afa0['actionOriginate'](_0x40c694,_0x4e4d5e);}}else{if(utils['getSeconds'](undefined,_0x4e4d5e['scheduledat'])<_0x40c694[_0x8d32('0x1eb')]*0x3c){if(_0x4e4d5e[_0x8d32('0x15d')]&&!_0x4e4d5e[_0x8d32('0x15d')][_0x8d32('0x1ec')]){_0x45afa0[_0x8d32('0xfd')][_0x8d32('0xfe')](_0x4e4d5e['id'])[_0x8d32('0x1a')](function(){_0x45afa0[_0x8d32('0xcc')](_0x40c694);});}else{hopperUtils['unlockContact']({'active':![]},_0x4e4d5e['id'],0x1)['finally'](function(){_0x45afa0[_0x8d32('0xcc')](_0x40c694);});}}else{_0x40c694[_0x8d32('0x1ed')]+=0x1;_0x45afa0[_0x8d32('0xcc')](_0x40c694);if(_0x40c694[_0x8d32('0x1ee')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e4d5e['ContactId'],'ListId':_0x4e4d5e[_0x8d32('0xdb')],'VoiceQueueId':_0x4e4d5e['VoiceQueueId']||undefined,'CampaignId':_0x4e4d5e[_0x8d32('0xdd')]||undefined})[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x1ef')));hopperUtils[_0x8d32('0xe2')](createObjHistory(_0x40c694,_0x4e4d5e,utils[_0x8d32('0x6c')][_0x8d32('0x1f0')],0x17,_0x8d32('0x1f1')))[_0x8d32('0xa0')](loggerCatch(_0x8d32('0x1f2')));}else{_0x45afa0[_0x8d32('0x11c')](createObjHistory(_0x40c694,_0x4e4d5e,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x8d32('0x1f3')),_0x8d32('0x1f4'),_0x8d32('0x1f5'));}}}}else{_0x40c694[_0x8d32('0x1f6')]+=0x1;_0x45afa0['saveInDb'](createObjHistory(_0x40c694,_0x4e4d5e,utils['CAMPAIGN_STATUS'][_0x8d32('0x1f7')],0xd,_0x8d32('0x1f8')),'[Originate][historyBlacklist]',_0x8d32('0x1f9'));throw _0x8d32('0x1fa');}};};Dialer[_0x8d32('0x18')][_0x8d32('0x15e')]=function(_0x5b990b){var _0x3929ec=this;var _0x1b9a9b=_0x5b990b[_0x8d32('0x1fb')]-_0x5b990b[_0x8d32('0x7f')];emitCampaignSummary(_0x5b990b);if(_0x1b9a9b>0x0&&_0x5b990b[_0x8d32('0x69')]==0x0){if(_0x1b9a9b>this[_0x8d32('0x1fc')]){_0x1b9a9b=this[_0x8d32('0x1fc')];}_0x5b990b[_0x8d32('0x69')]=0x1;hopperUtils[_0x8d32('0x1fd')](_0x5b990b,_0x1b9a9b)[_0x8d32('0x3e')](function(_0x3fae18){_0x5b990b['temp']=0x0;if(_0x3fae18){if(!utils[_0x8d32('0x1fe')](_0x3fae18)){_0x5b990b[_0x8d32('0x6a')]=utils[_0x8d32('0x6c')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x5b990b[_0x8d32('0x48')]);}else{_0x5b990b[_0x8d32('0x7f')]+=_0x3fae18[_0x8d32('0x103')];_0x5b990b['message']=utils[_0x8d32('0x6c')][_0x8d32('0x1ff')];for(var _0x1ee09f=0x0;_0x1ee09f<_0x3fae18[_0x8d32('0x103')];_0x1ee09f+=0x1){_0x5b990b[_0x8d32('0x200')]+=0x1;if(_['isNil'](_0x3fae18[_0x1ee09f])||_[_0x8d32('0xf9')](_0x3fae18[_0x1ee09f][_0x8d32('0x17a')])||_[_0x8d32('0xf9')](_0x3fae18[_0x1ee09f][_0x8d32('0x160')])){_0x3929ec[_0x8d32('0x156')]('[actionOriginate]\x20',_0x5b990b,_0x3fae18[_0x1ee09f]);}else{hopperUtils[_0x8d32('0x201')](_[_0x8d32('0xfa')](_0x3fae18[_0x1ee09f],[_0x8d32('0xdd'),'phone']))[_0x8d32('0x3e')](_0x3929ec['checkContactBlack'](_0x5b990b,_0x3fae18[_0x1ee09f]))[_0x8d32('0xa0')](_0x3929ec[_0x8d32('0x202')](_0x8d32('0x203'),_0x5b990b));}}}}})[_0x8d32('0xa0')](loggerGetContactDialer(_0x8d32('0x204'),_0x5b990b,_0x1b9a9b));}};Dialer[_0x8d32('0x18')]['handlePower']=function(_0x1c5a9a,_0x4e7a74){var _0x2e38c2=this;var _0xecb6df=[];if(_0x4e7a74<0x1||_0x1c5a9a['dialMethod']===_0x8d32('0xb6')){_0x4e7a74=0x1;}var _0x25b337=Math[_0x8d32('0x1c0')](_0x1c5a9a[_0x8d32('0x13e')]*_0x4e7a74)-_0x1c5a9a[_0x8d32('0x7f')];if(_0x1c5a9a[_0x8d32('0x205')]>0x0){var _0x406626=_0x1c5a9a[_0x8d32('0x205')]-_0x1c5a9a['originated']-_0x1c5a9a[_0x8d32('0x206')]-_0x1c5a9a[_0x8d32('0x140')];if(_0x25b337>_0x406626){_0x25b337=_0x406626;}}if(_0x25b337>0x0&&_0x1c5a9a[_0x8d32('0x69')]==0x0){if(_0x1c5a9a[_0x8d32('0xb0')]===_0x8d32('0xb6')){_0x25b337=0x1;}if(_0x25b337>this[_0x8d32('0x1fc')]){_0x25b337=this[_0x8d32('0x1fc')];}for(var _0x338300 in this[_0x8d32('0x1e')]){if(typeof this[_0x8d32('0x1e')][_0x338300]!==_0x8d32('0xa8')){if(this[_0x8d32('0x1e')][_0x338300]['state']==='not_inuse'&&this[_0x8d32('0x1e')][_0x338300][_0x8d32('0x85')]===_0x8d32('0x86')){_0xecb6df['push'](this[_0x8d32('0x1e')][_0x338300]['id']);}}}_0x1c5a9a[_0x8d32('0x69')]=0x1;hopperUtils[_0x8d32('0x207')](_0x1c5a9a,_0xecb6df,_0x25b337)[_0x8d32('0x3e')](function(_0x2d8b80){_0x1c5a9a['temp']=0x0;if(_0x2d8b80){if(!utils[_0x8d32('0x1fe')](_0x2d8b80)){hopperUtils[_0x8d32('0x208')](_0x1c5a9a)[_0x8d32('0x3e')](sendMessageReschedule(_0x1c5a9a))[_0x8d32('0xa0')](loggerCatch('[countReScheduled]\x20'));}else{_0x1c5a9a[_0x8d32('0x7f')]+=_0x2d8b80['length'];_0x1c5a9a[_0x8d32('0x6a')]=_0x1c5a9a['dialMethod']===_0x8d32('0xb6')?utils[_0x8d32('0x6c')][_0x8d32('0x209')]:utils[_0x8d32('0x6c')][_0x8d32('0x1ff')];for(var _0x643654=0x0;_0x643654<_0x2d8b80[_0x8d32('0x103')];_0x643654+=0x1){if(_['isNil'](_0x2d8b80[_0x643654])||_[_0x8d32('0xf9')](_0x2d8b80[_0x643654][_0x8d32('0x17a')])||_['isNil'](_0x2d8b80[_0x643654][_0x8d32('0x160')])){_0x2e38c2[_0x8d32('0x156')]('[actionOriginate]\x20',_0x1c5a9a,_0x2d8b80[_0x643654]);}else{hopperUtils[_0x8d32('0x20a')](_[_0x8d32('0xfa')](_0x2d8b80[_0x643654],[_0x8d32('0xdc'),_0x8d32('0x160')]))[_0x8d32('0x3e')](_0x2e38c2[_0x8d32('0x1e5')](_0x1c5a9a,_0x2d8b80[_0x643654]))[_0x8d32('0xa0')](_0x2e38c2[_0x8d32('0x202')](_0x8d32('0x20b'),_0x1c5a9a));}}}}})[_0x8d32('0xa0')](loggerGetContactDialer(_0x8d32('0x20c'),_0x1c5a9a,_0x25b337));}};Dialer[_0x8d32('0x18')]['handlePredictive']=function(_0x45f4c0){if(_0x45f4c0[_0x8d32('0x205')]>0x0){var _0x193974=_0x45f4c0[_0x8d32('0x205')]-_0x45f4c0['originated']-_0x45f4c0['talking'];if(_0x193974>0x0&&_0x45f4c0[_0x8d32('0x69')]==0x0){this[_0x8d32('0x20d')](_0x45f4c0);}else{loggerPredictiveCalls[_0x8d32('0x4b')](_0x8d32('0x20e'));}}else{this['tryOriginatePredictive'](_0x45f4c0);}};Dialer[_0x8d32('0x18')]['tryOriginatePredictive']=function(_0x547389){var _0x3e920c=this;var _0x27ca9f=[];_0x547389[_0x8d32('0x7f')]+=0x1;for(var _0x5786d2 in this[_0x8d32('0x1e')]){if(typeof this[_0x8d32('0x1e')][_0x5786d2]!==_0x8d32('0xa8')){if(this['agents'][_0x5786d2][_0x8d32('0xdf')]==='not_inuse'&&this['agents'][_0x5786d2]['status']===_0x8d32('0x86')){_0x27ca9f[_0x8d32('0x9a')](this[_0x8d32('0x1e')][_0x5786d2]['id']);}}}_0x547389[_0x8d32('0x69')]=0x1;return this[_0x8d32('0x207')](_0x547389['id'],_0x27ca9f,0x1,_0x547389['dialOrderByScheduledAt'],_0x547389)[_0x8d32('0x3e')](function(_0xad851d){_0x547389['temp']=0x1;if(_0xad851d){if(!utils[_0x8d32('0x1fe')](_0xad851d)){utils[_0x8d32('0x68')](_0x547389,0x1,0x0);return hopperUtils[_0x8d32('0x208')](_0x547389)['then'](sendMessageReschedule(_0x547389))['catch'](loggerCatch(_0x8d32('0x20f')));}else{_0x547389[_0x8d32('0x6a')]=utils[_0x8d32('0x6c')][_0x8d32('0x1ff')];if(_[_0x8d32('0xf9')](_0xad851d[0x0])||_[_0x8d32('0xf9')](_0xad851d[0x0][_0x8d32('0x17a')])||_[_0x8d32('0xf9')](_0xad851d[0x0][_0x8d32('0x160')])){_0x3e920c[_0x8d32('0x156')](_0x8d32('0x20b'),_0x547389,_0xad851d[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x8d32('0xfa')](_0xad851d[0x0],['VoiceQueueId',_0x8d32('0x160')]))[_0x8d32('0x3e')](_0x3e920c[_0x8d32('0x1e5')](_0x547389,_0xad851d[0x0]))[_0x8d32('0xa0')](_0x3e920c[_0x8d32('0x202')](_0x8d32('0x210'),_0x547389));}}}})['catch'](loggerGetContactDialer(_0x8d32('0x211'),_0x547389,0x1));};Dialer[_0x8d32('0x18')]['abandonmentRate']=function(_0x3e1318,_0x4b9dce,_0x5828d8,_0x43f119,_0x44cba5,_0x1d69c3){loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x212'));loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x213'),_0x3e1318);loggerPredictive[_0x8d32('0x4b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b9dce);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x214'),_0x5828d8);loggerPredictive[_0x8d32('0x4b')]('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',_0x43f119);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x215'),_0x44cba5);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x57'));return new Promise(function(_0x2d012a,_0x2d1c97){if(_0x3e1318<=0x0||isNaN(_0x3e1318)){return _0x2d1c97(msgResponse('[abandonmentRate]',_0x8d32('0x83'),'m\x20=\x20'+_0x3e1318));}if(_0x5828d8<=0x0||isNaN(_0x5828d8)){return _0x2d1c97(msgResponse(_0x8d32('0x216'),_0x8d32('0x83'),_0x8d32('0x217')+_0x5828d8));}if(_0x43f119<=0x0||isNaN(_0x43f119)){return _0x2d1c97(msgResponse(_0x8d32('0x216'),_0x8d32('0x83'),_0x8d32('0x218')+_0x43f119));}if(_0x4b9dce<=0x0||isNaN(_0x4b9dce)){return _0x2d1c97(msgResponse('[abandonmentRate]',_0x8d32('0x83'),_0x8d32('0x219')+_0x4b9dce));}if(_0x44cba5<=0x0||isNaN(_0x44cba5)){return _0x2d1c97(msgResponse('[abandonmentRate]',_0x8d32('0x83'),_0x8d32('0x21a')+_0x44cba5));}_0x1d69c3=_0x1d69c3||0x0;var _0x517749=0x1/_0x5828d8;var _0x16a16d=0x0;var _0x222975=0x0;var _0x22558a=0x0;var _0x36b461=0x0;for(var _0x52440c=0x0;_0x22558a<_0x44cba5;_0x52440c+=0x1){_0x222975=_0x52440c/_0x4b9dce;_0x16a16d=(_0x43f119*_0x222975+_0x1d69c3)/_0x517749;_0x22558a=utils['erlangb'](_0x16a16d,_0x3e1318);_0x36b461=_0x16a16d/_0x3e1318*(0x1-utils[_0x8d32('0x21b')](_0x16a16d,_0x3e1318));}return _0x2d012a({'erlangCalls':_0x52440c,'erlangCallToSecond':_0x4b9dce/_0x52440c,'erlangAbandonmentRate':_0x22558a,'erlangBusyFactor':_0x36b461});});};Dialer[_0x8d32('0x18')][_0x8d32('0x1d8')]=function(_0x54a541,_0x58a89f,_0x3914f7,_0x5297a2,_0x3d6c66,_0x24cfca){loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x21c'));loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x213'),_0x54a541);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x21d'),_0x58a89f);loggerPredictive[_0x8d32('0x4b')]('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',_0x3914f7);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x21e'),_0x5297a2);loggerPredictive['info'](_0x8d32('0x21f'),_0x3d6c66);loggerPredictive[_0x8d32('0x4b')](_0x8d32('0x57'));return new Promise(function(_0x3fe20e,_0x2b8c31){if(_0x54a541<=0x0||isNaN(_0x54a541)){return _0x2b8c31(msgResponse(_0x8d32('0x220'),_0x8d32('0x83'),_0x8d32('0x221')+_0x54a541));}if(_0x3914f7<=0x0||isNaN(_0x3914f7)){return _0x2b8c31(msgResponse(_0x8d32('0x220'),_0x8d32('0x83'),_0x8d32('0x217')+_0x3914f7));}if(_0x5297a2<=0x0||isNaN(_0x5297a2)){return _0x2b8c31(msgResponse(_0x8d32('0x220'),_0x8d32('0x83'),_0x8d32('0x218')+_0x5297a2));}if(_0x58a89f<=0x0||isNaN(_0x58a89f)){return _0x2b8c31(msgResponse(_0x8d32('0x220'),'Error','interval\x20=\x20'+_0x58a89f));}if(_0x3d6c66<=0x0||isNaN(_0x3d6c66)){return _0x2b8c31(msgResponse('[busyFactor]',_0x8d32('0x83'),_0x8d32('0x222')+_0x3d6c66));}_0x24cfca=_0x24cfca||0x0;var _0x524558=0x1/_0x3914f7;var _0x326fc0=0x0;var _0x4496fe=0x0;var _0x529306=0x0;var _0x59cb43=0x0;for(var _0x40c638=0x0;_0x59cb43<_0x3d6c66;_0x40c638+=0x1){_0x4496fe=_0x40c638/_0x58a89f;_0x326fc0=(_0x5297a2*_0x4496fe+_0x24cfca)/_0x524558;_0x529306=utils[_0x8d32('0x21b')](_0x326fc0,_0x54a541);_0x59cb43=_0x326fc0/_0x54a541*(0x1-utils[_0x8d32('0x21b')](_0x326fc0,_0x54a541));}return _0x3fe20e({'erlangCalls':_0x40c638,'erlangCallToSecond':_0x58a89f/_0x40c638,'erlangAbandonmentRate':_0x529306,'erlangBusyFactor':_0x59cb43});});};module[_0x8d32('0x223')]=Dialer; \ No newline at end of file +var _0x2834=['getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','AMD','buildObj','amd','saveInDb','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','membername','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','[syncHangupIvr]','[syncHangupIvr][createHistory]','cause-txt','syncQueueSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','length','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','NONE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','talking','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','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(','predictiveIntervalHitRate','dropRate','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','getSeconds','scheduledat','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','checkContactEmpty','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','dialOrderByScheduledAt','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/logger','dialer','booked','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','message','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','timezones','UNKNOWN_TIMEZONE','isArray','Action','command','iftime\x20%s,%s','interval','content','indexOf','catch','push','true','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','undefined','checkIfTime','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedMaxRetry','queueCallerAbandonCreateState','add','dialAbandonedRetryFrequency','minutes','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','run','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','preview','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse'];(function(_0x146183,_0x16c177){var _0x38255d=function(_0x33246c){while(--_0x33246c){_0x146183['push'](_0x146183['shift']());}};_0x38255d(++_0x16c177);}(_0x2834,0x111));var _0x4283=function(_0x27b7af,_0x37b718){_0x27b7af=_0x27b7af-0x0;var _0x5c8040=_0x2834[_0x27b7af];return _0x5c8040;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x4283('0x0'));var moment=require(_0x4283('0x1'));var rr=require('rr');var Redis=require(_0x4283('0x2'));var utils=require(_0x4283('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0x4283('0x4'));var config=require('../../../config/environment/');var logger=require(_0x4283('0x5'))(_0x4283('0x6'));var loggerBooked=require('../../../config/logger')(_0x4283('0x7'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x4283('0x5'))(_0x4283('0x8'));var loggerSyncQueueSummary=require(_0x4283('0x5'))('syncQueueSummary');var ami=require(_0x4283('0x9'));config['redis']=_[_0x4283('0xa')](config[_0x4283('0xb')],{'host':_0x4283('0xc'),'port':0x18eb});var io=require(_0x4283('0xd'))(new Redis(config[_0x4283('0xb')]));var cmHopper=require(_0x4283('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x4283('0xf'));var Interval=require(_0x4283('0x10'));var Action=require(_0x4283('0x11'));var History=require(_0x4283('0x12'));var Final=require(_0x4283('0x13'));var AgentComplete=require(_0x4283('0x14'));var QueueCallerAbandon=require(_0x4283('0x15'));var Hangup=require(_0x4283('0x16'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x4283('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4283('0x18')][_0x4283('0x19')]=function(_0x5d40d4){this[_0x4283('0x1a')]=this[_0x4283('0x1a')]?this[_0x4283('0x1a')][_0x4283('0x1b')](_0x5d40d4):_0x5d40d4();};function Dialer(_0x5d0209,_0xdc7b71){this[_0x4283('0x1c')]=new Sequence();this['preview']=_0xdc7b71;this[_0x4283('0x1d')]=_0x5d0209[_0x4283('0x1d')];this[_0x4283('0x1e')]=_0x5d0209['campaigns'];this[_0x4283('0x1f')]=_0x5d0209[_0x4283('0x1f')];this[_0x4283('0x20')]=_0x5d0209[_0x4283('0x20')];this[_0x4283('0x21')]=config['maxNumberOriginate']||0x2;this[_0x4283('0x22')]={};this[_0x4283('0x23')]={};this[_0x4283('0x24')]={};this[_0x4283('0x25')]={};this[_0x4283('0x26')]={};this['startPredictive']={};this[_0x4283('0x27')]={};this['ivrOriginated']={};this[_0x4283('0x28')]={};this[_0x4283('0x29')]={};this[_0x4283('0x2a')]={};ami['on'](_0x4283('0x2b'),this['syncAgentConnect'][_0x4283('0x2c')](this));ami['on']('queuecallerabandon',this[_0x4283('0x2d')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x4283('0x2c')](this));ami['on'](_0x4283('0x2e'),this[_0x4283('0x2f')][_0x4283('0x2c')](this));ami['on'](_0x4283('0x30'),this['syncQueueSummary']['bind'](this));ami['on'](_0x4283('0x31'),this['syncQueueSummaryComplete'][_0x4283('0x2c')](this));ami['on'](_0x4283('0x32'),this[_0x4283('0x33')][_0x4283('0x2c')](this));ami['on'](_0x4283('0x34'),this[_0x4283('0x35')][_0x4283('0x2c')](this));ami['on']('varset',this['syncVarSet'][_0x4283('0x2c')](this));ami['on']('queuemember',this[_0x4283('0x36')][_0x4283('0x2c')](this));ami['on'](_0x4283('0x37'),this[_0x4283('0x38')][_0x4283('0x2c')](this));this[_0x4283('0x39')]();this[_0x4283('0x3a')]();RpcSetting['getSettings']()[_0x4283('0x3b')](function(_0xfc892a){previewRecallmeReminderInterval=_0xfc892a[_0x4283('0x3c')];});}function isNotNull(_0x8f6ad6){return _0x8f6ad6!==null&&!_[_0x4283('0x3d')](_0x8f6ad6);}function msgResponse(_0x9bc022,_0xe93fab,_0x2e0a2c){return{'action':_0x9bc022,'response':_0xe93fab,'message':_0x2e0a2c,'stack':_0x2e0a2c};}function emit(_0x1b7361,_0xe69a9d,_0x3625a5){io['to'](_0x1b7361)[_0x4283('0x3e')](_0xe69a9d,_0x3625a5);}function emitOutboundVoiceQueueSummary(_0x3fbde2){if(_0x3fbde2[_0x4283('0x3f')]===_0x4283('0x40')){logger[_0x4283('0x41')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x4283('0x42')](_0x3fbde2,{'showHidden':![],'depth':null}));emit(util[_0x4283('0x43')](_0x4283('0x44'),_0x3fbde2[_0x4283('0x45')]),_0x4283('0x46'),_0x3fbde2);}}function checkGetDataPredictive(_0x5db939){if(isNotNull(_0x5db939)&&!_[_0x4283('0x47')](_0x5db939)){loggerPredictive[_0x4283('0x48')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x4283('0x48')](_0x4283('0x49'),_0x5db939[_0x4283('0x4a')]);loggerPredictive[_0x4283('0x48')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5db939[_0x4283('0x4b')]);loggerPredictive[_0x4283('0x48')](_0x4283('0x4c'),_0x5db939[_0x4283('0x4d')]);loggerPredictive[_0x4283('0x48')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5db939[_0x4283('0x4e')]);loggerPredictive[_0x4283('0x48')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5db939['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x4283('0x48')](_0x4283('0x4f'),_0x5db939[_0x4283('0x50')]);loggerPredictive[_0x4283('0x48')](_0x4283('0x51'));if(_0x5db939[_0x4283('0x4a')]>0x0){if(!_['isUndefined'](_0x5db939['predictiveIntervalAvgTalktime'])&&_0x5db939['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x4283('0x48')](_0x4283('0x52'));if(!_[_0x4283('0x3d')](_0x5db939[_0x4283('0x53')])&&_0x5db939[_0x4283('0x53')]>0x0){return!![];}loggerPredictive[_0x4283('0x48')](_0x4283('0x54'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x4283('0x48')](_0x4283('0x55'));}return![];}function mergeDataErlangB(_0x42f11f){return function(_0xcca9){loggerPredictive[_0x4283('0x48')](_0x4283('0x56'));loggerPredictive['info'](_0x4283('0x57'),_0xcca9[_0x4283('0x58')]);loggerPredictive[_0x4283('0x48')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xcca9[_0x4283('0x59')]);loggerPredictive[_0x4283('0x48')](_0x4283('0x5a'),_0xcca9[_0x4283('0x5b')]);loggerPredictive[_0x4283('0x48')](_0x4283('0x5c'),_0xcca9[_0x4283('0x5d')]);loggerPredictive['info'](_0x4283('0x5a'),_0xcca9[_0x4283('0x5b')]);loggerPredictive[_0x4283('0x48')](_0x4283('0x51'));_[_0x4283('0x5e')](_0x42f11f,_0xcca9);};}function ifInterval(_0x2a71fb,_0x17f359){if(_[_0x4283('0x3d')](_0x17f359)){return![];}return utils['getSeconds'](undefined,_0x17f359)<_0x2a71fb*0x3c;}function clearPredictiveAttributes(_0xf07ce0){if(_0xf07ce0[_0x4283('0x27')]){_0xf07ce0['startProgressive']=undefined;loggerPredictive[_0x4283('0x41')](_0xf07ce0[_0x4283('0x45')],_0x4283('0x5f'));}if(_0xf07ce0[_0x4283('0x60')]){_0xf07ce0['startPredictive']=undefined;loggerPredictive[_0x4283('0x41')](_0xf07ce0[_0x4283('0x45')],_0x4283('0x61'));}if(_0xf07ce0[_0x4283('0x62')]){clearInterval(_0xf07ce0['handlePredictive']);_0xf07ce0['handlePredictive']=undefined;loggerPredictive[_0x4283('0x41')](_0xf07ce0['name'],_0x4283('0x63'));}}function loggerCatchPredictive(_0x52e468,_0xe4429d){return function(_0x36cb66){loggerPredictive[_0x4283('0x64')](_0xe4429d['name'],_0x52e468);loggerPredictive[_0x4283('0x64')](_0x36cb66[_0x4283('0x65')]);clearPredictiveAttributes(_0xe4429d);};}function loggerCatch(_0x5bc639){return function(_0x5dd177){logger[_0x4283('0x64')](_0x5bc639,util['inspect'](_0x5dd177,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3dd582,_0xfe5007,_0x53f5a6){return function(_0x3d7f2a){utils[_0x4283('0x66')](_0xfe5007,_0x53f5a6,0x0);_0xfe5007['temp']=0x0;logger['error'](_0x3dd582,util[_0x4283('0x42')](_0x3d7f2a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1abc53){return function(_0x52c726){if(isNotNull(_0x52c726)&&isNotNull(_0x52c726[0x0])){if(_0x52c726[0x0]['contactsRescheduled']>0x0){_0x1abc53[_0x4283('0x67')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger['info'](_0x4283('0x68')+_0x1abc53[_0x4283('0x45')],_0x52c726[0x0][_0x4283('0x69')],_0x4283('0x6a'));}else{_0x1abc53[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x6c')];logger[_0x4283('0x48')](_0x4283('0x6d')+_0x1abc53[_0x4283('0x45')]);}}};}function createObjHistory(_0x3d899d,_0x483a1e,_0x375115,_0x160474,_0x23a1d3){_0x3d899d[_0x4283('0x67')]=_0x375115;var _0x365732=new Action(_0x3d899d,_0x483a1e);var _0x234e0a=new History(_0x365732);_0x234e0a[_0x4283('0x6e')]=_0x160474;_0x234e0a[_0x4283('0x6f')]=_0x23a1d3;_0x234e0a[_0x4283('0x70')]=_0x365732[_0x4283('0x71')];return _0x234e0a;}function unlockQueueStatus(_0x647920,_0x45231f){setTimeout(function(){if(_[_0x4283('0x3d')](_0x647920[_0x4283('0x72')])){loggerBooked[_0x4283('0x64')]('[unlockQueueStatus][undefined]',_0x45231f);}_0x647920[_0x4283('0x72')]=!![];loggerBooked[_0x4283('0x48')](_0x4283('0x73'),_0x45231f,JSON[_0x4283('0x74')](_[_0x4283('0x75')](_0x647920,[_0x4283('0x45'),_0x4283('0x72')])));},0x1f3);}function checkInterval(_0x5b2ce8){return function(){if(!isNotNull(_0x5b2ce8[_0x4283('0x76')])){_0x5b2ce8[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x77')];throw _0x5b2ce8['name']+_0x4283('0x78');}if(!isNotNull(_0x5b2ce8[_0x4283('0x76')][_0x4283('0x79')])){_0x5b2ce8[_0x4283('0x67')]=utils['CAMPAIGN_STATUS'][_0x4283('0x77')];throw _0x5b2ce8[_0x4283('0x45')]+_0x4283('0x78');}if(!isNotNull(_[_0x4283('0x47')](_0x5b2ce8[_0x4283('0x76')][_0x4283('0x79')]))){_0x5b2ce8[_0x4283('0x67')]=utils['CAMPAIGN_STATUS'][_0x4283('0x77')];throw _0x5b2ce8['name']+_0x4283('0x78');}};}function checkIsIVRCampaignActive(_0x2b24c1){return function(){if(!utils[_0x4283('0x7a')](_0x2b24c1)){_0x2b24c1[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x7b')];throw _0x2b24c1[_0x4283('0x45')]+_0x4283('0x7c');}};}function emitCampaignSummary(_0x4b7431){if(utils[_0x4283('0x7d')](_0x4b7431)){emit(util[_0x4283('0x43')]('campaign:ivr:%s',_0x4b7431[_0x4283('0x45')]),_0x4283('0x7e'),_0x4b7431);}}function loggerCatchQueueSummary(_0x188a4f,_0x2dc61a){return function(_0x336182){clearPredictiveAttributes(_0x2dc61a);emitCampaignSummary(_0x2dc61a);loggerSyncQueueSummary['debug'](_0x188a4f,util[_0x4283('0x42')](_0x336182,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x18c9e2){if(_0x18c9e2[_0x4283('0x7f')]){if(_0x18c9e2[_0x4283('0x80')]===0x0){_0x18c9e2[_0x4283('0x7f')]=![];_0x18c9e2[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x7b')];loggerSyncQueueSummary[_0x4283('0x41')](_0x4283('0x81'),_0x18c9e2[_0x4283('0x45')],'is\x20not\x20active');}else{_0x18c9e2['message']=utils[_0x4283('0x6b')][_0x4283('0x82')];loggerSyncQueueSummary[_0x4283('0x41')](_0x4283('0x81'),_0x18c9e2['name'],_0x4283('0x83'));}emitCampaignSummary(_0x18c9e2);}}function myreject(_0x576329){return function(_0xb14517){return _0x576329(msgResponse(_0x4283('0x84'),_0x4283('0x85'),JSON[_0x4283('0x74')](_0xb14517)));};}Dialer['prototype'][_0x4283('0x86')]=function(_0x8e295){return!_[_0x4283('0x3d')](_0x8e295)&&_0x8e295&&!_[_0x4283('0x3d')](_0x8e295[_0x4283('0x45')])&&!_['isUndefined'](_0x8e295['active'])&&_0x8e295[_0x4283('0x87')]&&(this[_0x4283('0x20')][util[_0x4283('0x43')]('SIP/%s',_0x8e295[_0x4283('0x45')])][_0x4283('0x88')]===_0x4283('0x89')||this['trunks'][util[_0x4283('0x43')](_0x4283('0x8a'),_0x8e295[_0x4283('0x45')])][_0x4283('0x88')]===_0x4283('0x8b'));};Dialer[_0x4283('0x18')][_0x4283('0x8c')]=function(_0x2bdfbf){var _0x3ba9d2=this;return function(){if(!_0x3ba9d2[_0x4283('0x86')](_0x2bdfbf[_0x4283('0x8d')])){if(!_0x3ba9d2[_0x4283('0x86')](_0x2bdfbf[_0x4283('0x8e')])){_0x2bdfbf[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x8f')];throw _0x2bdfbf[_0x4283('0x45')]+_0x4283('0x90');}}};};Dialer[_0x4283('0x18')]['checkIfTime']=function(_0x2185a4,_0x480f0a,_0x68b7a0,_0x2cd2f4){var _0x53c3a6=this;return function(){var _0x18a65b=!![];return _0x53c3a6[_0x4283('0x91')](_0x2185a4,_0x480f0a,_0x68b7a0,_0x2cd2f4,_0x18a65b);};};Dialer[_0x4283('0x18')][_0x4283('0x92')]=function(_0xd15233,_0x34a96e,_0x51354a,_0x320b76){var _0x34fda9=this;return function(){var _0x33dfbc=![];return _0x34fda9['ifTimeIvr'](_0xd15233[_0x4283('0x79')],_0x34a96e,_0x51354a,_0x320b76,_0x33dfbc);};};Dialer['prototype'][_0x4283('0x91')]=function(_0x172707,_0x38f129,_0x3dcffe,_0x429dea,_0x21442b){var _0x1bfdea=[];return new Promise(function(_0xeef5d1,_0x236ab4){if(!isNotNull(_0x172707)){_0x429dea[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x77')];return _0x236ab4(msgResponse('ifTime',_0x4283('0x93'),_0x3dcffe+_0x4283('0x94')));}if(_[_0x4283('0x47')](_0x172707)){_0x429dea[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x95')];return _0x236ab4(msgResponse(_0x4283('0x96'),_0x4283('0x93'),_0x3dcffe+'\x20Intervals\x20is\x20empty\x20'));}if(_0x38f129&&_[_0x4283('0x3d')](config[_0x4283('0x97')][_0x38f129])){_0x429dea['message']=utils[_0x4283('0x6b')][_0x4283('0x98')];return _0x236ab4(msgResponse(_0x4283('0x96'),_0x4283('0x93'),_0x3dcffe+'\x20Timezone\x20unknow\x20'+_0x38f129));}if(_[_0x4283('0x99')](_0x172707)){for(var _0x115fb2=0x0;_0x115fb2<_0x172707['length'];_0x115fb2+=0x1){_0x1bfdea['push'](ami[_0x4283('0x9a')]({'action':_0x4283('0x9b'),'command':util[_0x4283('0x43')](_0x4283('0x9c'),_0x172707[_0x115fb2][_0x4283('0x9d')],!_[_0x4283('0x3d')](config['timezones'][_0x38f129])?_0x38f129:'')})[_0x4283('0x3b')](function(_0x1645ca){return _0x1645ca[_0x4283('0x9e')][_0x4283('0x9f')]('true')>=0x0;})[_0x4283('0xa0')](myreject(_0x236ab4)));}}else{_0x1bfdea[_0x4283('0xa1')](ami[_0x4283('0x9a')]({'action':_0x4283('0x9b'),'command':util[_0x4283('0x43')](_0x4283('0x9c'),_0x172707,!_[_0x4283('0x3d')](config['timezones'][_0x38f129])?_0x38f129:'')})['then'](function(_0x89f4ab){return _0x89f4ab[_0x4283('0x9e')]['indexOf'](_0x4283('0xa2'))>=0x0;})[_0x4283('0xa0')](myreject(_0x236ab4)));}Promise[_0x4283('0xa3')](_0x1bfdea)['then'](function(_0x4c3b43){var _0x2a83d9=_[_0x4283('0xa4')](_0x4c3b43);if(_0x2a83d9){return _0xeef5d1(_0x2a83d9);}else{_0x429dea['message']=_0x21442b?utils[_0x4283('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x4283('0xa5')];return _0x236ab4(msgResponse(_0x4283('0xa6'),_0x4283('0x93'),_0x4283('0xa7')+_0x21442b+'\x20'+_0x3dcffe+_0x4283('0xa8')+util[_0x4283('0x42')](_0x172707,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x38f129));}})[_0x4283('0xa0')](function(_0x5983e7){return _0x236ab4(msgResponse(_0x4283('0x96'),_0x4283('0x93'),JSON[_0x4283('0x74')](_0x5983e7)));});});};Dialer[_0x4283('0x18')][_0x4283('0x39')]=function(){var _0x4846e5=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x4846e5[_0x4283('0xa9')]();},0x3e8);});};Dialer[_0x4283('0x18')][_0x4283('0xa9')]=function(){var _0x4a2799=this;var _0x484cb0;for(var _0x6ba747 in this[_0x4283('0x1e')]){if(typeof this[_0x4283('0x1e')][_0x6ba747]!==_0x4283('0xaa')){_0x484cb0=this[_0x4283('0x1e')][_0x6ba747];if(utils[_0x4283('0x7d')](_0x484cb0)&&utils[_0x4283('0x7a')](_0x484cb0)){_0x484cb0[_0x4283('0x7f')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x484cb0))[_0x4283('0x3b')](checkInterval(_0x484cb0))[_0x4283('0x3b')](_0x4a2799[_0x4283('0x8c')](_0x484cb0))[_0x4283('0x3b')](_0x4a2799[_0x4283('0xab')](_0x484cb0['dialGlobalInterval'],_0x484cb0[_0x4283('0xac')],_0x484cb0[_0x4283('0x45')],_0x484cb0))[_0x4283('0x3b')](_0x4a2799['checkIfTimeIntervals'](_0x484cb0[_0x4283('0x76')],_0x484cb0[_0x4283('0xac')],_0x484cb0[_0x4283('0x45')],_0x484cb0))[_0x4283('0x3b')](_0x4a2799['launchHandleIvr'](_0x484cb0))[_0x4283('0xa0')](loggerCatchQueueSummary(_0x4283('0xad'),_0x484cb0));}else{notSendMessagesCampaign(_0x484cb0);}}}};Dialer['prototype'][_0x4283('0xae')]=function(_0x23d254){if(_0x23d254[_0x4283('0xaf')]!==_0x4283('0xb0')){clearPredictiveAttributes(_0x23d254);}switch(_0x23d254[_0x4283('0xaf')]){case _0x4283('0xb1'):this[_0x4283('0xb2')](_0x23d254,0x1);break;case _0x4283('0xb3'):this[_0x4283('0xb2')](_0x23d254,_0x23d254['dialPowerLevel']);break;case _0x4283('0xb0'):this[_0x4283('0xb0')](_0x23d254);break;case _0x4283('0x7'):this['handlePower'](_0x23d254,0x1);break;default:logger[_0x4283('0x64')]('Queue',_0x23d254[_0x4283('0x45')],_0x4283('0xb4'));}};Dialer['prototype'][_0x4283('0x96')]=function(_0x40e088,_0x56d30a){var _0x26b230=_0x40e088[_0x4283('0xac')];var _0x36b53c=_0x56d30a?_0x40e088['dialGlobalInterval']:_0x40e088[_0x4283('0x76')]['Intervals'];logger[_0x4283('0xb5')](_0x4283('0xb6'),_0x36b53c,_0x26b230,_0x40e088[_0x4283('0x45')],util[_0x4283('0x43')]('Voice\x20Queue\x20%s\x20$s',_0x40e088[_0x4283('0x45')],_0x40e088['id']));var _0xefdadd=null;return Interval[_0x4283('0xb7')](_0x36b53c,_0x26b230)[_0x4283('0x3b')](function(_0x342534){if(_0x342534===!![]){return _0x342534;}else{_0x40e088['message']=_0x56d30a?utils[_0x4283('0x6b')][_0x4283('0xb8')]:utils['CAMPAIGN_STATUS'][_0x4283('0xa5')];_0xefdadd=msgResponse('[ifTime][promiseAll]',_0x4283('0x93'),_0x4283('0xa7')+_0x56d30a+'\x20'+_0x40e088[_0x4283('0x45')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x4283('0x42')](_0x36b53c,{'showHidden':![],'depth':null})+_0x4283('0xb9')+_0x26b230);}if(_0xefdadd!==null){logger[_0x4283('0xb5')](_0x4283('0xba'),_0xefdadd);_0xefdadd[_0x4283('0xbb')]=_0x56d30a;throw _0xefdadd;}})['catch'](function(_0x5eed82){logger[_0x4283('0x64')](_0x4283('0xbc'),_0x5eed82);throw msgResponse(_0x4283('0x84'),_0x4283('0x85'),util['inspect'](_0x5eed82,{'showHidden':![],'depth':null}));});};Dialer[_0x4283('0x18')][_0x4283('0xbd')]=function(_0x5dc1ed){if(this['voiceQueues'][_0x5dc1ed[_0x4283('0xbe')]]){if(this[_0x4283('0x25')][_0x5dc1ed[_0x4283('0xbf')]]&&this[_0x4283('0x25')][_0x5dc1ed[_0x4283('0xbf')]]['type']!==_0x4283('0xc0')){this[_0x4283('0xc1')](this[_0x4283('0x1d')][_0x5dc1ed['queue']]);this[_0x4283('0x25')][_0x5dc1ed[_0x4283('0xbf')]][_0x4283('0xc2')]=moment()['format'](_0x4283('0xc3'));}}};Dialer[_0x4283('0x18')][_0x4283('0x2f')]=function(_0x189058){var _0x38c9a2=this['uniqueId'][_0x189058[_0x4283('0xbf')]];if(this[_0x4283('0x1d')][_0x189058[_0x4283('0xbe')]]){if(_0x38c9a2&&_0x38c9a2[_0x4283('0x3f')]!==_0x4283('0xc0')){delete this[_0x4283('0x25')][_0x189058[_0x4283('0xbf')]];this['voiceQueues'][_0x189058[_0x4283('0xbe')]][_0x4283('0xc4')]+=0x1;var _0x594857=new AgentComplete(_0x38c9a2,_0x189058);if(_0x189058[_0x4283('0xc5')]===_0x4283('0xc6')){_0x594857['agiafterat']=this['voiceQueues'][_0x189058['queue']][_0x4283('0xc7')]&&this[_0x4283('0x1d')][_0x189058['queue']][_0x4283('0xc8')]?moment()[_0x4283('0x43')](_0x4283('0xc3')):undefined;}hopperUtils[_0x4283('0xc9')](_0x594857)[_0x4283('0xa0')](loggerCatch(_0x4283('0xca')));hopperUtils[_0x4283('0xcb')](_0x594857)[_0x4283('0xa0')](loggerCatch(_0x4283('0xcc')));}}};Dialer[_0x4283('0x18')]['syncQueueCallerAbandon']=function(_0x498ad9){var _0x63319b=this['uniqueId'][_0x498ad9['uniqueid']];var _0x1f2115=this;var _0x63056d=![];var _0x3a3793;var _0x35635d;if(this[_0x4283('0x1d')][_0x498ad9[_0x4283('0xbe')]]){if(_0x63319b&&_0x63319b[_0x4283('0x3f')]!==_0x4283('0xc0')){delete this[_0x4283('0x25')][_0x498ad9['uniqueid']];this[_0x4283('0xc1')](this[_0x4283('0x1d')][_0x498ad9[_0x4283('0xbe')]]);_0x63319b[_0x4283('0xcd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2a158d=new QueueCallerAbandon(_0x63319b,_0x498ad9);if(utils['getSeconds'](_0x63319b[_0x4283('0xcd')],_0x63319b[_0x4283('0xce')])>=_0x63319b[_0x4283('0xcf')]){this[_0x4283('0x1d')][_0x498ad9[_0x4283('0xbe')]][_0x4283('0x4d')]+=0x1;this[_0x4283('0x1d')][_0x498ad9[_0x4283('0xbe')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x498ad9[_0x4283('0xbe')]][_0x4283('0xd0')]+=0x1;_0x2a158d[_0x4283('0x6e')]=0xa;_0x2a158d[_0x4283('0x6f')]='Drop';_0x2a158d[_0x4283('0xd1')]=_0x4283('0xd2');_0x2a158d[_0x4283('0xd3')]=this[_0x4283('0x1d')][_0x498ad9['queue']][_0x4283('0xc7')]?moment()['format'](_0x4283('0xc3')):undefined;_0x2a158d[_0x4283('0xd4')]+=0x1;_0x2a158d[_0x4283('0xd5')]+=0x1;_0x3a3793=this[_0x4283('0x1d')][_0x498ad9[_0x4283('0xbe')]][_0x4283('0xd6')];_0x35635d=this['voiceQueues'][_0x498ad9[_0x4283('0xbe')]][_0x4283('0xd7')];hopperUtils['verifyAdditionalPhones'](_0x2a158d,_0x2a158d[_0x4283('0x6e')],_0x63319b[_0x4283('0xd8')])[_0x4283('0x3b')](function(_0x9d58e3){_0x63056d=_0x9d58e3[_0x4283('0xd9')]==0x1;if(_0x2a158d['countdropretry']>=_0x1f2115['voiceQueues'][_0x498ad9['queue']]['dialDropMaxRetry']){_0x1f2115['queueCallerAbandonCreateState'](_0x2a158d,_0x9d58e3[_0x4283('0xd9')]);}else{hopperUtils[_0x4283('0xda')]({'active':![],'countdropretry':_0x2a158d['countdropretry'],'scheduledat':moment()['add'](_0x1f2115[_0x4283('0x1d')][_0x498ad9['queue']]['dialDropRetryFrequency'],'minutes')[_0x4283('0x43')](_0x4283('0xc3')),'ContactId':_0x63319b[_0x4283('0xdb')],'ListId':_0x63319b[_0x4283('0xdc')],'VoiceQueueId':_0x63319b[_0x4283('0xdd')]||undefined,'CampaignId':_0x63319b[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0xdf')));var _0xe453ec=new History(_0x2a158d);_0xe453ec[_0x4283('0x6e')]=0xa;_0xe453ec[_0x4283('0x6f')]='Drop';_0xe453ec[_0x4283('0x71')]=moment()[_0x4283('0x43')](_0x4283('0xc3'));_0xe453ec[_0x4283('0x70')]=_0xe453ec[_0x4283('0x71')];_0xe453ec['calleridname']=_0x2a158d[_0x4283('0xe0')];_0xe453ec[_0x4283('0xe1')]=_0x2a158d['calleridnum'];hopperUtils[_0x4283('0xc9')](_0xe453ec)[_0x4283('0xa0')](loggerCatch(_0x4283('0xe2')));}})[_0x4283('0x3b')](function(){if(_0x63056d)hopperUtils[_0x4283('0xe3')](_0x2a158d,_0x3a3793,_0x35635d)[_0x4283('0x3b')](function(){return 0x1;});});}else{this[_0x4283('0x1d')][_0x498ad9[_0x4283('0xbe')]][_0x4283('0x4e')]+=0x1;this[_0x4283('0x1d')][_0x498ad9['queue']][_0x4283('0xe4')]+=0x1;_0x2a158d['state']=0xb;_0x2a158d['statedesc']=_0x4283('0xe5');_0x2a158d[_0x4283('0xd1')]='CALLEREXIT';_0x2a158d[_0x4283('0xe6')]+=0x1;_0x2a158d[_0x4283('0xd5')]+=0x1;_0x3a3793=this['voiceQueues'][_0x498ad9[_0x4283('0xbe')]]['dialAbandonedRetryFrequency'];_0x35635d=this[_0x4283('0x1d')][_0x498ad9[_0x4283('0xbe')]][_0x4283('0xd7')];hopperUtils['verifyAdditionalPhones'](_0x2a158d,_0x2a158d[_0x4283('0x6e')],_0x63319b[_0x4283('0xd8')])[_0x4283('0x3b')](function(_0x2880cd){if(_0x2a158d[_0x4283('0xe6')]>=_0x1f2115['voiceQueues'][_0x498ad9['queue']][_0x4283('0xe7')]){_0x1f2115[_0x4283('0xe8')](_0x2a158d,_0x2880cd[_0x4283('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2a158d[_0x4283('0xe6')],'scheduledat':moment()[_0x4283('0xe9')](_0x1f2115['voiceQueues'][_0x498ad9[_0x4283('0xbe')]][_0x4283('0xea')],_0x4283('0xeb'))[_0x4283('0x43')](_0x4283('0xc3')),'ContactId':_0x63319b['ContactId'],'ListId':_0x63319b[_0x4283('0xdc')],'VoiceQueueId':_0x63319b['VoiceQueueId']||undefined,'CampaignId':_0x63319b['CampaignId']||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0xec')));var _0x2b59e2=new History(_0x2a158d);_0x2b59e2[_0x4283('0x6e')]=0xb;_0x2b59e2['statedesc']='Abandoned';_0x2b59e2['starttime']=moment()[_0x4283('0x43')](_0x4283('0xc3'));_0x2b59e2['endtime']=_0x2b59e2[_0x4283('0x71')];_0x2b59e2[_0x4283('0xe0')]=_0x2a158d[_0x4283('0xe0')];_0x2b59e2['calleridnum']=_0x2a158d[_0x4283('0xe1')];hopperUtils[_0x4283('0xc9')](_0x2b59e2)[_0x4283('0xa0')](loggerCatch(_0x4283('0xed')));}})['then'](function(){if(_0x63056d)hopperUtils[_0x4283('0xe3')](_0x2a158d,_0x3a3793,_0x35635d)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x4283('0x35')]=function(_0x122471){if(this[_0x4283('0x23')][_0x122471['uniqueid']]){this[_0x4283('0x23')][_0x122471[_0x4283('0xbf')]][_0x4283('0xee')]=_0x122471[_0x4283('0xee')];}if(this['uniqueId'][_0x122471[_0x4283('0xbf')]]){this[_0x4283('0x25')][_0x122471[_0x4283('0xbf')]]['channel']=_0x122471[_0x4283('0xee')];}};Dialer[_0x4283('0x18')][_0x4283('0x36')]=function(_0x57e503){if(!this[_0x4283('0x23')][_0x57e503[_0x4283('0xef')]]){return;}var _0x1af2a1=this['voiceQueues'][this[_0x4283('0x23')][_0x57e503[_0x4283('0xef')]][_0x4283('0xbe')]][_0x4283('0xf0')]||_0x4283('0xf1');if(_0x1af2a1===_0x4283('0xf2')){if(this['actions'][_0x57e503[_0x4283('0xef')]]&&_[_0x4283('0xf3')](this[_0x4283('0x23')][_0x57e503[_0x4283('0xef')]][_0x4283('0xf4')])&&_0x57e503[_0x4283('0x88')]==='1'&&_0x57e503[_0x4283('0xf5')]==='0'){if(this[_0x4283('0x1f')][_0x57e503['stateinterface']]){if(!this[_0x4283('0x1f')][_0x57e503[_0x4283('0xf6')]]['locked']){this[_0x4283('0x1f')][_0x57e503['stateinterface']][_0x4283('0xf4')]=!![];this[_0x4283('0x23')][_0x57e503[_0x4283('0xef')]]['locked']=!![];this['actions'][_0x57e503[_0x4283('0xef')]][_0x4283('0xf6')]=_0x57e503[_0x4283('0xf6')];}}}}else if(_0x1af2a1===_0x4283('0xf1')){if(this['actions'][_0x57e503[_0x4283('0xef')]]){if(this[_0x4283('0x1f')][_0x57e503[_0x4283('0xf6')]]){this[_0x4283('0x23')][_0x57e503[_0x4283('0xef')]][_0x4283('0xf6')]=_0x57e503[_0x4283('0xf6')];if(_[_0x4283('0xf3')](this['queueBooked'][this[_0x4283('0x23')][_0x57e503[_0x4283('0xef')]][_0x4283('0xbe')]])){this[_0x4283('0x28')][this[_0x4283('0x23')][_0x57e503['actionid']][_0x4283('0xbe')]]=[];}this[_0x4283('0x28')][this['actions'][_0x57e503[_0x4283('0xef')]][_0x4283('0xbe')]][_0x4283('0xa1')](_[_0x4283('0x5e')](_[_0x4283('0x75')](this['actions'][_0x57e503[_0x4283('0xef')]],['idHopper',_0x4283('0xf6')]),{'status':_0x57e503[_0x4283('0x88')],'paused':_0x57e503[_0x4283('0xf5')]}));}}}};Dialer[_0x4283('0x18')][_0x4283('0x38')]=function(_0x57f3a2){if(!this['actions'][_0x57f3a2[_0x4283('0xef')]]){return;}var _0x3e8e3a=this;var _0x524118=this[_0x4283('0x1d')][this[_0x4283('0x23')][_0x57f3a2[_0x4283('0xef')]]['queue']];var _0x361557=_0x524118[_0x4283('0xf0')]||_0x4283('0xf1');if(_0x361557===_0x4283('0xf2')){if(this['actions'][_0x57f3a2[_0x4283('0xef')]]&&this[_0x4283('0x23')][_0x57f3a2['actionid']]['stateinterface']){this['preview'][_0x4283('0xf7')](this[_0x4283('0x23')][_0x57f3a2[_0x4283('0xef')]]['idHopper'],this[_0x4283('0x23')][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xf6')])['catch'](function(_0x53801f){logger[_0x4283('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x4283('0x42')](_0x53801f,{'showHidden':![],'depth':null}));})[_0x4283('0x1b')](function(){_0x3e8e3a[_0x4283('0xc1')](_0x3e8e3a[_0x4283('0x1d')][_0x3e8e3a[_0x4283('0x23')][_0x57f3a2['actionid']][_0x4283('0xbe')]]);_0x3e8e3a[_0x4283('0x1f')][_0x3e8e3a[_0x4283('0x23')][_0x57f3a2[_0x4283('0xef')]]['stateinterface']][_0x4283('0xf4')]=![];delete _0x3e8e3a[_0x4283('0x23')][_0x57f3a2['actionid']];unlockQueueStatus(_0x524118);});}else{this[_0x4283('0xc1')](this['voiceQueues'][this[_0x4283('0x23')][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xbe')]]);hopperUtils[_0x4283('0xda')]({'active':![],'ContactId':this[_0x4283('0x23')][_0x57f3a2['actionid']][_0x4283('0xdb')],'ListId':this[_0x4283('0x23')][_0x57f3a2['actionid']][_0x4283('0xdc')],'VoiceQueueId':this['actions'][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xdd')]||undefined,'CampaignId':this[_0x4283('0x23')][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x57f3a2[_0x4283('0xef')]];unlockQueueStatus(_0x524118);}}else if(_0x361557===_0x4283('0xf1')){var _0x46cf01;if(this['actions'][_0x57f3a2['actionid']]&&!_['isEmpty'](this[_0x4283('0x28')][this['actions'][_0x57f3a2[_0x4283('0xef')]]['queue']])){if(this[_0x4283('0x29')][_0x3e8e3a['actions'][_0x57f3a2['actionid']]['queue']]){this[_0x4283('0x29')][_0x3e8e3a[_0x4283('0x23')][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xbe')]]=this[_0x4283('0x29')][this['actions'][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xbe')]]?this[_0x4283('0x29')][this['actions'][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xbe')]]:this[_0x4283('0x28')][this[_0x4283('0x23')][_0x57f3a2['actionid']][_0x4283('0xbe')]]?this['queueBooked'][this['actions'][_0x57f3a2[_0x4283('0xef')]][_0x4283('0xbe')]]['_rr']||0x0:0x0;}this[_0x4283('0x28')][this['actions'][_0x57f3a2['actionid']]['queue']][_0x4283('0xf8')]=this[_0x4283('0x29')][this[_0x4283('0x23')][_0x57f3a2['actionid']][_0x4283('0xbe')]];for(var _0x9e11f7=0x0;_0x9e11f7=_0x281de3[_0x4283('0x11f')]){_0x291364[_0x4283('0x120')](_0x314437,_0x1f86c5,_0x930e27,_0x4283('0x121'));}else{if(_0x314437['countmachineretry']>=_0x281de3[_0x4283('0x122')]){_0x291364[_0x4283('0x123')](_0x314437,_0x1f86c5,_0x930e27,_0x4283('0x124'));}else{hopperUtils[_0x4283('0xda')]({'active':![],'countmachineretry':_0x314437[_0x4283('0x119')],'scheduledat':moment()['add'](_0x281de3[_0x4283('0x125')],_0x4283('0xeb'))[_0x4283('0x43')](_0x4283('0xc3')),'ContactId':_0x314437[_0x4283('0xdb')],'ListId':_0x314437[_0x4283('0xdc')],'VoiceQueueId':_0x314437[_0x4283('0xdd')]||undefined,'CampaignId':_0x314437[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0x126')));_0x1f86c5({'reschedule':0x1});}}});}if(_0x44c5da[_0x4283('0x3f')]===_0x4283('0xc0')&&this[_0x4283('0x1e')][_0x44c5da[_0x4283('0xbe')]][_0x4283('0x10f')]&&_0x2e1597[_0x4283('0x110')]===_0x4283('0x111')){delete this[_0x4283('0x25')][_0x2e1597['uniqueid']];this[_0x4283('0xc1')](this[_0x4283('0x1e')][_0x44c5da[_0x4283('0xbe')]]);_0x372ad1=new Hangup(_0x44c5da,_0x2e1597);_0x372ad1[_0x4283('0x6e')]=0x12;_0x372ad1[_0x4283('0x6f')]=_0x4283('0x127');_0x372ad1[_0x4283('0x128')]=_0x4283('0x113');ami[_0x4283('0x3e')](_0x4283('0x129'),ut[_0x4283('0x114')](_0x372ad1,_0x4283('0x115')));this[_0x4283('0x116')](_0x372ad1,_0x4283('0x12a'),_0x4283('0x12b'));}if(_0x44c5da[_0x4283('0x3f')]===_0x4283('0xc0')&&this[_0x4283('0x1e')][_0x44c5da['queue']][_0x4283('0x10f')]&&_0x2e1597['value']===_0x4283('0x117')){return new Promise(function(_0x2c4f6e,_0x131a72){delete _0x291364[_0x4283('0x25')][_0x2e1597[_0x4283('0xbf')]];_0x291364[_0x4283('0xc1')](_0x291364[_0x4283('0x1e')][_0x44c5da[_0x4283('0xbe')]]);_0x291364[_0x4283('0x1e')][_0x44c5da[_0x4283('0xbe')]][_0x4283('0xc4')]+=0x1;_0x291364['campaigns'][_0x44c5da[_0x4283('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x55ff53=_0x291364[_0x4283('0x1e')][_0x44c5da[_0x4283('0xbe')]];var _0xc4036c=new Hangup(_0x44c5da,_0x2e1597);_0xc4036c[_0x4283('0x6e')]=0x13;_0xc4036c[_0x4283('0x6f')]=_0x4283('0x118');_0xc4036c[_0x4283('0x128')]=_0x4283('0x113');_0xc4036c[_0x4283('0x119')]+=0x1;_0xc4036c[_0x4283('0xd5')]+=0x1;_0xc4036c[_0x4283('0x115')]=!![];ami[_0x4283('0x3e')](_0x4283('0x129'),ut[_0x4283('0x114')](_0xc4036c,_0x4283('0x115')));hopperUtils[_0x4283('0xc9')](_0xc4036c)[_0x4283('0xa0')](loggerCatch(_0x4283('0x11a')));if(_0xc4036c[_0x4283('0x12c')]+_0xc4036c[_0x4283('0x11b')]+_0xc4036c[_0x4283('0x11c')]+_0xc4036c['countnosuchnumberretry']+_0xc4036c['countdropretry']+_0xc4036c[_0x4283('0xe6')]+_0xc4036c[_0x4283('0x119')]+_0xc4036c['countagentrejectretry']>=_0x55ff53[_0x4283('0x11f')]){_0x291364['stateGlobal'](_0xc4036c,_0x2c4f6e,_0x131a72,'reason19\x20machine....');}else{if(_0xc4036c['countmachineretry']>=_0x55ff53[_0x4283('0x122')]){_0x291364['createStateFinal'](_0xc4036c,_0x2c4f6e,_0x131a72,'reason\x2019\x20machine....');}else{hopperUtils[_0x4283('0xda')]({'active':![],'countmachineretry':_0xc4036c[_0x4283('0x119')],'scheduledat':moment()['add'](_0x55ff53[_0x4283('0x125')],'minutes')[_0x4283('0x43')](_0x4283('0xc3')),'ContactId':_0xc4036c[_0x4283('0xdb')],'ListId':_0xc4036c['ListId'],'VoiceQueueId':_0xc4036c[_0x4283('0xdd')]||undefined,'CampaignId':_0xc4036c[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0x126')));_0x2c4f6e({'reschedule':0x1});}}});}}};Dialer[_0x4283('0x18')][_0x4283('0x33')]=function(_0xbe7905){var _0x334fa9=this[_0x4283('0x25')][_0xbe7905[_0x4283('0xbf')]];var _0x2fff44;if(_0x334fa9&&_0x334fa9[_0x4283('0x3f')]===_0x4283('0xc0')){delete this[_0x4283('0x25')][_0xbe7905[_0x4283('0xbf')]];this['updateOriginated'](this['campaigns'][_0x334fa9[_0x4283('0xbe')]]);this['campaigns'][_0x334fa9['queue']]['ivrAnswerCallsDay']+=0x1;_0x2fff44=new Hangup(_0x334fa9,_0xbe7905);hopperUtils[_0x4283('0xc9')](_0x2fff44)[_0x4283('0xa0')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x2fff44)[_0x4283('0xa0')](loggerCatch(_0x4283('0x12d')));}if(_0x334fa9&&_0x334fa9['type']!==_0x4283('0xc0')&&isNotNull(this[_0x4283('0x1d')][_0x334fa9[_0x4283('0xbe')]]['dialQueueProject'])){delete this['uniqueId'][_0xbe7905[_0x4283('0xbf')]];this['updateOriginated'](this[_0x4283('0x1d')][_0x334fa9[_0x4283('0xbe')]]);this['voiceQueues'][_0x334fa9[_0x4283('0xbe')]][_0x4283('0xc4')]+=0x1;this['voiceQueues'][_0x334fa9['queue']][_0x4283('0x112')]+=0x1;_0x2fff44=new Hangup(_0x334fa9,_0xbe7905);_0x2fff44[_0x4283('0x6e')]=0x10;_0x2fff44[_0x4283('0x6f')]='AnswerAGI';_0x2fff44[_0x4283('0x128')]='AGI';hopperUtils['createHistory'](_0x2fff44)[_0x4283('0xa0')](loggerCatch(_0x4283('0x12e')));hopperUtils[_0x4283('0xcb')](_0x2fff44)['catch'](loggerCatch(_0x4283('0x12d')));}if(_0x334fa9&&_0x334fa9[_0x4283('0x3f')]!==_0x4283('0xc0')&&!isNotNull(this[_0x4283('0x1d')][_0x334fa9[_0x4283('0xbe')]]['dialQueueProject'])){if(_0xbe7905['cause-txt']==='Normal\x20Clearing'){delete this[_0x4283('0x25')][_0xbe7905[_0x4283('0xbf')]];this[_0x4283('0x1d')][_0x334fa9[_0x4283('0xbe')]][_0x4283('0xc4')]+=0x1;const _0x162057=new AgentComplete(_0x334fa9,_0xbe7905);_0x162057['CampaignId']=this['voiceQueues'][_0x334fa9[_0x4283('0xbe')]]['id'];hopperUtils[_0x4283('0xc9')](_0x162057)[_0x4283('0xa0')](loggerCatch(_0x4283('0xca')));hopperUtils['moveContactManagedDialer'](_0x162057)[_0x4283('0xa0')](loggerCatch(_0x4283('0xcc')));}else{delete this['uniqueId'][_0xbe7905[_0x4283('0xbf')]];this['updateOriginated'](this[_0x4283('0x1d')][_0x334fa9[_0x4283('0xbe')]]);this['voiceQueues'][_0x334fa9['queue']]['outboundUnknownCallsDay']+=0x1;_0x2fff44=new Hangup(_0x334fa9,_0xbe7905);_0x2fff44['state']=0xc;_0x2fff44['statedesc']=_0xbe7905[_0x4283('0x12f')];_0x2fff44[_0x4283('0x128')]='Unknow';hopperUtils['createHistory'](_0x2fff44)[_0x4283('0xa0')](loggerCatch(_0x4283('0x12e')));hopperUtils['moveContactManagedDialer'](_0x2fff44)[_0x4283('0xa0')](loggerCatch('[syncHangupIvr]'));}}};Dialer[_0x4283('0x18')][_0x4283('0x130')]=function(_0x282f0a){var _0x3af7fd=this;if(!_0x3af7fd[_0x4283('0x2a')][_0x282f0a['name']]){_0x3af7fd[_0x4283('0x2a')][_0x282f0a[_0x4283('0x45')]]={'running':![]};}else if(_0x3af7fd[_0x4283('0x2a')][_0x282f0a['name']][_0x4283('0x131')]===!![]){return;}else if(_0x3af7fd[_0x4283('0x2a')][_0x282f0a[_0x4283('0x45')]][_0x4283('0x131')]===![]){_0x3af7fd[_0x4283('0x2a')][_0x282f0a['name']][_0x4283('0x131')]=!![];}var _0x159516=_0x3af7fd[_0x4283('0x1d')][_0x282f0a[_0x4283('0x45')]];var _0x3dc21b=_0x159516[_0x4283('0x67')]!==utils[_0x4283('0x6b')]['INACTIVE'];var _0x4c8251=utils[_0x4283('0x132')](_0x159516);_0x159516[_0x4283('0x133')]=utils[_0x4283('0x134')](_0x159516,_0x3af7fd[_0x4283('0x20')]);Promise[_0x4283('0x135')]()[_0x4283('0x3b')](function(){if(_0x159516[_0x4283('0x133')]===utils[_0x4283('0x6b')][_0x4283('0x7b')]){if(_0x3dc21b){clearPredictiveAttributes(_0x159516);_0x282f0a[_0x4283('0x60')]=undefined;_0x282f0a[_0x4283('0x27')]=undefined;}if(_0x159516[_0x4283('0x133')]===utils[_0x4283('0x6b')][_0x4283('0x7b')]){_0x282f0a[_0x4283('0x136')]=0x0;_0x282f0a[_0x4283('0xf5')]=0x0;_0x282f0a['inUse']=0x0;_0x282f0a['talking']=0x0;_0x282f0a[_0x4283('0x137')]=0x0;}}else if(_0x159516[_0x4283('0x133')]===utils[_0x4283('0x6b')][_0x4283('0x138')]&&!_0x4c8251){return _0x3af7fd[_0x4283('0x96')](_0x159516,!![])[_0x4283('0x3b')](function(){return _0x3af7fd[_0x4283('0x96')](_0x159516,![]);})[_0x4283('0x3b')](function(){return _0x3af7fd[_0x4283('0xae')](_0x159516);})[_0x4283('0xa0')](function(_0x49ab35){loggerSyncQueueSummary[_0x4283('0x41')](_0x4283('0x139'),util[_0x4283('0x42')](_0x49ab35,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x159516);});}else{clearPredictiveAttributes(_0x159516);}})[_0x4283('0x3b')](function(){var _0x63994a=_0x282f0a[_0x4283('0x13a')](_0x159516);if(_0x63994a||_0x159516[_0x4283('0x13b')]){_0x159516[_0x4283('0x13b')]=![];_0x282f0a[_0x4283('0x13c')](_0x159516);Object['assign'](_0x159516,_0x282f0a);emitOutboundVoiceQueueSummary(_0x282f0a);}_0x3af7fd[_0x4283('0x2a')][_0x159516[_0x4283('0x45')]][_0x4283('0x131')]=![];})[_0x4283('0xa0')](function(_0x2eca8d){logger['error']('[syncQueueSummary]',util['inspect'](_0x2eca8d,{'showHidden':![],'depth':null}));_0x3af7fd[_0x4283('0x2a')][_0x159516['name']][_0x4283('0x131')]=![];});};Dialer[_0x4283('0x18')]['syncQueueSummaryComplete']=_[_0x4283('0x13d')](function(){var _0x20effc=_[_0x4283('0x13e')](this[_0x4283('0x1d')],function(_0x3a4823){return _0x3a4823[_0x4283('0x13f')];});var _0xc357e3=_['filter'](this[_0x4283('0x1f')],function(_0x5a54fa){return _0x5a54fa['online']&&_0x5a54fa['status']===_0x4283('0x89');});if(_0x20effc[_0x4283('0x140')]>0x0&&_0xc357e3[_0x4283('0x140')]>0x0){return Promise[_0x4283('0x135')]()['then'](cmHopper[_0x4283('0x141')](_['map'](_0x20effc,'id'),previewRecallmeReminderInterval,_[_0x4283('0x142')](_0xc357e3,'id')))[_0x4283('0x3b')](function(_0x52fb2d){for(var _0x5592ec=0x0;_0x5592ec<_0x52fb2d[_0x4283('0x140')];_0x5592ec++){var _0x22ce5e=_0x52fb2d[_0x5592ec][_0x4283('0x143')][_0x4283('0x45')];if(_0x22ce5e)io['to'](util[_0x4283('0x43')](_0x4283('0x144'),_0x22ce5e))['emit'](_0x4283('0x145'),{'hopper':_0x52fb2d[_0x5592ec]});}})[_0x4283('0xa0')](function(_0x42d8f2){logger['error'](_0x4283('0x146'),_0x42d8f2);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4283('0x18')]['loopClearZombieChannels']=function(){var _0x45846f=this;setInterval(function(){_0x45846f[_0x4283('0x147')](_0x45846f['uniqueId'],_0x4283('0x148'));_0x45846f['clearZombieChannels'](_0x45846f[_0x4283('0x23')],_0x4283('0x149'));},0x32c8);};Dialer['prototype'][_0x4283('0x147')]=function(_0x56134c,_0x54458a){var _0x1e6c92=this;for(var _0x1dff7e in _0x56134c){if(typeof _0x56134c[_0x1dff7e]!==_0x4283('0xaa')){this[_0x4283('0x1c')][_0x4283('0x19')](function(){if(!_['isNil'](_0x56134c[_0x1dff7e])){return ami[_0x4283('0x9a')]({'action':_0x4283('0x88'),'channel':_0x56134c[_0x1dff7e][_0x4283('0xee')]})[_0x4283('0xa0')](function(_0x245705){if(_0x245705[_0x4283('0x67')]===_0x4283('0x14a')){setTimeout(function(){if(_0x56134c[_0x1dff7e]&&_0x56134c[_0x1dff7e][_0x4283('0x3f')]!==_0x4283('0xc0')){_0x1e6c92[_0x4283('0xc1')](_0x1e6c92[_0x4283('0x1d')][_0x56134c[_0x1dff7e]['queue']]);logger['error']('[Dialer][checkChannel]',_0x54458a,_0x1dff7e,_0x56134c[_0x1dff7e][_0x4283('0xbe')]);delete _0x56134c[_0x1dff7e];}if(_0x56134c[_0x1dff7e]&&_0x56134c[_0x1dff7e]['type']==='ivr'){_0x1e6c92[_0x4283('0xc1')](_0x1e6c92[_0x4283('0x1e')][_0x56134c[_0x1dff7e]['queue']]);logger[_0x4283('0x64')](_0x4283('0x14b'),_0x54458a,_0x1dff7e,_0x56134c[_0x1dff7e][_0x4283('0xbe')]);delete _0x56134c[_0x1dff7e];}},0x2328);}});}});}}};Dialer[_0x4283('0x18')][_0x4283('0x14c')]=function(_0x254027){return Promise[_0x4283('0x135')]()['then'](voiceQueueRt[_0x4283('0x14c')](_0x254027))[_0x4283('0xa0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x4283('0x18')][_0x4283('0xc1')]=function(_0x27c4c1){if(!_[_0x4283('0x3d')](_0x27c4c1)&&_0x27c4c1!==null){if(typeof _0x27c4c1[_0x4283('0x80')]!==_0x4283('0xaa')){if(_0x27c4c1['originated']>0x0){_0x27c4c1[_0x4283('0x80')]-=0x1;}else{logger[_0x4283('0x64')](_0x4283('0x14d'));}}}else{logger[_0x4283('0x64')](_0x4283('0x14e'));}};Dialer[_0x4283('0x18')][_0x4283('0x14f')]=function(_0x5ca08a,_0x5014f1){var _0x18d2e5=this;return function(_0x4cb2fe){_0x18d2e5[_0x4283('0xc1')](_0x5014f1);logger[_0x4283('0x64')](_0x5ca08a,util['inspect'](_0x4cb2fe,{'showHidden':![],'depth':null}));};};Dialer[_0x4283('0x18')][_0x4283('0x150')]=function(_0x2b6610,_0x4c8611,_0x49c3e0){var _0x3699c5={'state':0x19,'statedesc':_0x4283('0x151')};this[_0x4283('0xc1')](_0x4c8611);this[_0x4283('0x116')](_['merge'](_0x3699c5,_[_0x4283('0x75')](_0x49c3e0,['ContactId','ListId',_0x4283('0x152'),_0x4283('0xdd'),'CampaignId'])),_0x4283('0x153'),'[emptyContact]');logger[_0x4283('0x64')](_0x2b6610);};Dialer[_0x4283('0x18')]['saveInDb']=function(_0x3959e7,_0x22acef,_0x3d0609){hopperUtils[_0x4283('0xc9')](_0x3959e7)[_0x4283('0xa0')](loggerCatch(_0x22acef));hopperUtils[_0x4283('0xcb')](_0x3959e7)['catch'](loggerCatch(_0x3d0609));};Dialer['prototype'][_0x4283('0xe8')]=function(_0x1fe462,_0x38772e){hopperUtils[_0x4283('0xc9')](_0x1fe462)[_0x4283('0xa0')](loggerCatch(_0x4283('0xca')));if(_0x38772e==0x0){hopperUtils[_0x4283('0xcb')](_0x1fe462)[_0x4283('0xa0')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x4283('0x18')]['checkPreviewRecallReminder']=function(_0x1a3313){return Promise[_0x4283('0x135')]()[_0x4283('0x3b')](cmHopper['handlePreviewRecallNotifications'](_0x1a3313['id'],previewRecallmeReminderInterval))['then'](function(_0x3f5706){for(var _0x2b162a=0x0;_0x2b162a<_0x3f5706['length'];_0x2b162a++){var _0x753ac2=_0x3f5706[_0x2b162a][_0x4283('0x143')]['name'];if(_0x753ac2)io['to'](util['format']('user:%s',_0x753ac2))[_0x4283('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x3f5706[_0x2b162a]});}})[_0x4283('0xa0')](function(){});};Dialer[_0x4283('0x18')]['launchHandleIvr']=function(_0xa40f51){var _0xcd220f=this;return function(){_0xcd220f[_0x4283('0x154')](_0xa40f51);};};Dialer[_0x4283('0x18')]['actionOriginate']=function(_0x1c379b,_0x174de7){var _0x239dd2=this;var _0x368bc8=uuid['v4']();this[_0x4283('0x23')][_0x368bc8]=new Action(_0x1c379b,_0x174de7,_0x368bc8);return new Promise(function(_0xaec28a,_0x2add27){if(_['isUndefined'](_0x1c379b)&&typeof _0x1c379b!==_0x4283('0x155')){return _0x2add27(msgResponse(_0x4283('0x156'),_0x4283('0x93'),_0x4283('0x157')));}if(_[_0x4283('0x3d')](_0x174de7[_0x4283('0x158')])||_0x174de7[_0x4283('0x158')]===null){return _0x2add27(msgResponse(_0x4283('0x156'),_0x4283('0x93'),_0x4283('0x159')));}var _0x148730={'XMD-CALLERID':_0x239dd2[_0x4283('0x23')][_0x368bc8][_0x4283('0x15a')](),'XMD-AGI':_0x1c379b[_0x4283('0x15b')]?util[_0x4283('0x43')](_0x4283('0x15c'),ipAgi,_0x1c379b['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x1c379b['dialQueueProject2']?util[_0x4283('0x43')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1c379b[_0x4283('0xc7')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x1c379b)?util[_0x4283('0x43')](_0x4283('0x15d'),_0x1c379b[_0x4283('0x45')],_0x1c379b['dialQueueOptions']||'',_0x1c379b[_0x4283('0xc8')]?'c':'',_0x1c379b['dialQueueTimeout']||0x3):_0x4283('0x15e'),'XMD-CONTACTID':_0x174de7[_0x4283('0xdb')],'XMD-CDRTYPE':_0x4283('0x6'),'CALLERID(all)':_0x239dd2[_0x4283('0x23')][_0x368bc8][_0x4283('0x15a')](),'XMD-AMD':_0x1c379b[_0x4283('0x10f')]?_0x4283('0x138'):_0x4283('0x15e'),'XMD-DESTINATION':_0x4283('0x15f')};if(_0x1c379b[_0x4283('0x10f')]){_0x148730[_0x4283('0x160')]=_0x1c379b[_0x4283('0x161')]||0x9c4;_0x148730['XMD-AMDGREETING']=_0x1c379b[_0x4283('0x162')]||0x5dc;_0x148730[_0x4283('0x163')]=_0x1c379b[_0x4283('0x164')]||0x320;_0x148730[_0x4283('0x165')]=_0x1c379b[_0x4283('0x166')]||0x1388;_0x148730['XMD-AMDMINWORDLENGTH']=_0x1c379b[_0x4283('0x167')]||0x64;_0x148730['XMD-AMDBETWEENWORDSSILENCE']=_0x1c379b[_0x4283('0x168')]||0x32;_0x148730[_0x4283('0x169')]=_0x1c379b[_0x4283('0x16a')]||0x3;_0x148730[_0x4283('0x16b')]=_0x1c379b[_0x4283('0x16c')]||0x100;_0x148730['XMD-AMDMAXIMUMWORDLENGTH']=_0x1c379b[_0x4283('0x16d')]||0x1388;}if(utils['isOutboundQueue'](_0x1c379b)){_0x148730[_0x4283('0x16e')]=_0x174de7[_0x4283('0xdd')];}else{_0x148730[_0x4283('0x16f')]=_0x174de7['CampaignId'];}var _0x4f45b5=utils[_0x4283('0x170')](_0x174de7[_0x4283('0x171')]);Object[_0x4283('0x172')](_0x148730,_0x4f45b5);var _0xd2915f=_0x239dd2[_0x4283('0x86')](_0x1c379b[_0x4283('0x8d')])?utils[_0x4283('0x173')](_0x1c379b[_0x4283('0x8d')][_0x4283('0x174')],_0x1c379b[_0x4283('0x175')],_0x1c379b[_0x4283('0x176')]>0x0?utils[_0x4283('0x177')](_0x1c379b[_0x4283('0x178')],_0x1c379b[_0x4283('0x176')]):_0x1c379b[_0x4283('0x178')]):utils[_0x4283('0x173')](_['isNil'](_0x1c379b[_0x4283('0x8e')])?_0x1c379b[_0x4283('0x8d')][_0x4283('0x174')]:_0x1c379b[_0x4283('0x8e')]['callerid'],_0x1c379b['dialOriginateCallerIdName'],_0x1c379b[_0x4283('0x176')]>0x0?utils[_0x4283('0x177')](_0x1c379b['dialOriginateCallerIdNumber'],_0x1c379b[_0x4283('0x176')]):_0x1c379b[_0x4283('0x178')]);if(_0xd2915f){_0x148730[_0x4283('0x179')]=_0x239dd2[_0x4283('0x23')][_0x368bc8][_0x4283('0x17a')]=utils['extractCalleridName'](_0xd2915f);_0x148730['XMD-ORIGINATECALLERIDNUM']=_0x174de7[_0x4283('0x158')];}_0x1c379b[_0x4283('0x17b')]=_0x148730;return ami[_0x4283('0x9a')]({'actionid':_0x368bc8,'action':'originate','channel':_0x239dd2['isTrunkReachable'](_0x1c379b['Trunk'])?util['format'](_0x4283('0x17c'),_0x1c379b[_0x4283('0x8d')][_0x4283('0x45')],isNotNull(_0x1c379b['dialPrefix'])?_0x1c379b[_0x4283('0x17d')]['trim']()||'':'',_0x1c379b[_0x4283('0x17e')]>0x0?_0x174de7[_0x4283('0x158')][_0x4283('0x17f')](_0x1c379b[_0x4283('0x17e')]):_0x174de7['phone']):util[_0x4283('0x43')](_0x4283('0x17c'),_[_0x4283('0xf3')](_0x1c379b['TrunkBackup'])?_0x1c379b[_0x4283('0x8d')][_0x4283('0x45')]:_0x1c379b[_0x4283('0x8e')][_0x4283('0x45')],isNotNull(_0x1c379b[_0x4283('0x17d')])?_0x1c379b[_0x4283('0x17d')]['trim']()||'':'',_0x1c379b[_0x4283('0x17e')]>0x0?_0x174de7['phone']['substring'](_0x1c379b[_0x4283('0x17e')]):_0x174de7[_0x4283('0x158')]),'callerid':_0xd2915f,'Exten':'xcally-motion-dialer','Context':_0x4283('0x180'),'Priority':'1','variable':_0x148730,'timeout':(_0x1c379b[_0x4283('0x181')]||0x1e)*0x3e8,'async':!![],'channelid':_0x368bc8})[_0x4283('0x3b')](function(_0x2439bc){return _0xaec28a(_0x2439bc);})['catch'](function(_0x4a8892){_0x1c379b[_0x4283('0x182')]+=0x1;var _0x2f41df=new History(_0x239dd2[_0x4283('0x23')][_0x368bc8]);logger[_0x4283('0x64')](util[_0x4283('0x43')]('[originateError]:\x20%s',JSON[_0x4283('0x74')](_0x4a8892)));_0x2f41df[_0x4283('0x6e')]=0xe;_0x2f41df['statedesc']=_0x4283('0x183');_0x2f41df[_0x4283('0x71')]=moment()[_0x4283('0x43')](_0x4283('0xc3'));_0x2f41df[_0x4283('0x70')]=_0x2f41df['starttime'];hopperUtils[_0x4283('0xc9')](_0x2f41df)[_0x4283('0xa0')](loggerCatch(_0x4283('0x184')));_0x239dd2['moveContactManagedDialer'](_0x2f41df)[_0x4283('0xa0')](loggerCatch(_0x4283('0x184')))['finally'](function(){delete _0x239dd2[_0x4283('0x23')][_0x368bc8];return _0x2add27(msgResponse(_0x4283('0x156'),_0x4283('0x85'),_0x4283('0x185')));});});});};Dialer[_0x4283('0x18')][_0x4283('0x186')]=function(_0xece31f,_0xe06956,_0x14fe38){var _0x471a36=new History(_0xe06956);if(_0x471a36[_0x4283('0x12c')]+_0x471a36[_0x4283('0x11b')]+_0x471a36[_0x4283('0x11c')]+_0x471a36[_0x4283('0x11d')]+_0x471a36[_0x4283('0xd4')]+_0x471a36[_0x4283('0xe6')]+_0x471a36['countmachineretry']+_0x471a36[_0x4283('0x11e')]>=_0x14fe38[_0x4283('0x11f')]-0x1){return!![];}switch(_0xece31f){case 0x3:if(_0x471a36['countnoanswerretry']>=_0x14fe38[_0x4283('0x187')]-0x1){return!![];}hopperUtils[_0x4283('0xda')]({'active':![],'countnoanswerretry':_0x471a36[_0x4283('0x11c')]+=0x1,'scheduledat':moment()[_0x4283('0xe9')](_0x14fe38[_0x4283('0x188')],_0x4283('0xeb'))['format'](_0x4283('0xc3')),'ContactId':_0x471a36['ContactId'],'ListId':_0x471a36[_0x4283('0xdc')],'VoiceQueueId':_0x471a36[_0x4283('0xdd')]||undefined,'CampaignId':_0x471a36[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x471a36[_0x4283('0x12c')]>=_0x14fe38[_0x4283('0x189')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x471a36[_0x4283('0x12c')]+=0x1,'scheduledat':moment()[_0x4283('0xe9')](_0x14fe38[_0x4283('0x18a')],_0x4283('0xeb'))[_0x4283('0x43')](_0x4283('0xc3')),'ContactId':_0x471a36['ContactId'],'ListId':_0x471a36[_0x4283('0xdc')],'VoiceQueueId':_0x471a36['VoiceQueueId']||undefined,'CampaignId':_0x471a36[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x471a36[_0x4283('0x11b')]>=_0x14fe38['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x4283('0xda')]({'active':![],'countcongestionretry':_0x471a36[_0x4283('0x11b')]+=0x1,'scheduledat':moment()[_0x4283('0xe9')](_0x14fe38['dialCongestionRetryFrequency'],_0x4283('0xeb'))['format'](_0x4283('0xc3')),'ContactId':_0x471a36[_0x4283('0xdb')],'ListId':_0x471a36[_0x4283('0xdc')],'VoiceQueueId':_0x471a36[_0x4283('0xdd')]||undefined,'CampaignId':_0x471a36['CampaignId']||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0x18b')));break;case 0x0:if(_0x471a36[_0x4283('0x11d')]>=_0x14fe38[_0x4283('0x18c')]-0x1){return!![];}else{hopperUtils[_0x4283('0xda')]({'active':![],'countnosuchnumberretry':_0x471a36[_0x4283('0x11d')]+=0x1,'scheduledat':moment()['add'](_0x14fe38[_0x4283('0x18d')],_0x4283('0xeb'))[_0x4283('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x471a36[_0x4283('0xdb')],'ListId':_0x471a36[_0x4283('0xdc')],'VoiceQueueId':_0x471a36[_0x4283('0xdd')]||undefined,'CampaignId':_0x471a36[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0x18e')));}break;case 0xa:if(_0x471a36[_0x4283('0xd4')]>=_0x14fe38['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x4283('0xda')]({'active':![],'countdropretry':_0x471a36[_0x4283('0xd4')]+=0x1,'scheduledat':moment()[_0x4283('0xe9')](_0x14fe38['dialDropRetryFrequency'],_0x4283('0xeb'))[_0x4283('0x43')](_0x4283('0xc3')),'ContactId':_0x471a36[_0x4283('0xdb')],'ListId':_0x471a36[_0x4283('0xdc')],'VoiceQueueId':_0x471a36[_0x4283('0xdd')]||undefined,'CampaignId':_0x471a36[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0xdf')));break;case 0xb:if(_0x471a36[_0x4283('0xe6')]>=_0x14fe38[_0x4283('0xe7')]-0x1){return!![];}hopperUtils[_0x4283('0xda')]({'active':![],'countabandonedretry':_0x471a36[_0x4283('0xe6')]+=0x1,'scheduledat':moment()[_0x4283('0xe9')](_0x14fe38[_0x4283('0xea')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x471a36[_0x4283('0xdb')],'ListId':_0x471a36[_0x4283('0xdc')],'VoiceQueueId':_0x471a36[_0x4283('0xdd')]||undefined,'CampaignId':_0x471a36[_0x4283('0xde')]||undefined})['catch'](loggerCatch(_0x4283('0xec')));break;case 0x13:if(_0x471a36[_0x4283('0x119')]>=_0x14fe38['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x471a36[_0x4283('0x119')]+=0x1,'scheduledat':moment()[_0x4283('0xe9')](_0x14fe38[_0x4283('0x125')],_0x4283('0xeb'))[_0x4283('0x43')](_0x4283('0xc3')),'ContactId':_0x471a36[_0x4283('0xdb')],'ListId':_0x471a36['ListId'],'VoiceQueueId':_0x471a36['VoiceQueueId']||undefined,'CampaignId':_0x471a36[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0x126')));break;case 0x14:if(_0x471a36[_0x4283('0x11e')]>=_0x14fe38[_0x4283('0x18f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x471a36[_0x4283('0x11e')]+=0x1,'scheduledat':moment()[_0x4283('0xe9')](_0x14fe38[_0x4283('0x190')],_0x4283('0xeb'))['format'](_0x4283('0xc3')),'ContactId':_0x471a36['ContactId'],'ListId':_0x471a36[_0x4283('0xdc')],'VoiceQueueId':_0x471a36[_0x4283('0xdd')]||undefined,'CampaignId':_0x471a36[_0x4283('0xde')]||undefined})[_0x4283('0xa0')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x4283('0x18')][_0x4283('0x109')]=function(_0x40bde2,_0x14afd2,_0x2d48f9){var _0x4decfb=this;var _0x38c8ae=new History(_0x40bde2);var _0x1f6a69=![];var _0x2e4d73;var _0x5e8702;return new Promise(function(_0x8affba,_0x52d2cb){if(_[_0x4283('0x3d')](_0x14afd2)&&typeof _0x14afd2!==_0x4283('0x155')){return _0x52d2cb(msgResponse(_0x4283('0x191'),_0x4283('0x93'),_0x4283('0x192')));}if(_[_0x4283('0x3d')](_0x2d48f9)&&typeof _0x2d48f9!==_0x4283('0x155')){return _0x52d2cb(msgResponse(_0x4283('0x191'),_0x4283('0x93'),_0x4283('0x193')));}hopperUtils['verifyAdditionalPhones'](_0x38c8ae,_0x2d48f9['reason'],_0x14afd2)[_0x4283('0x3b')](function(_0x256ed2){if(_0x256ed2[_0x4283('0xd9')]==0x1)_0x1f6a69=!![];switch(_0x2d48f9['reason']){case'0':_0x14afd2[_0x4283('0x194')]+=0x1;_0x38c8ae[_0x4283('0x6e')]=0x0;_0x38c8ae['statedesc']=_0x4283('0x195');_0x38c8ae[_0x4283('0x11d')]+=0x1;_0x38c8ae[_0x4283('0xd5')]+=0x1;ami['emit'](_0x4283('0x196'),ut[_0x4283('0x114')](_0x40bde2,_0x4283('0x197')));_0x2e4d73=_0x14afd2[_0x4283('0x18d')];_0x5e8702=_0x14afd2['callAdditionalPhoneAfterMin'];hopperUtils[_0x4283('0xc9')](_0x38c8ae)[_0x4283('0xa0')](loggerCatch(_0x4283('0x11a')));if(_0x4decfb[_0x4283('0x186')](0x0,_0x40bde2,_0x14afd2)&&!_0x1f6a69){if(_0x38c8ae[_0x4283('0x11d')]>=_0x14afd2[_0x4283('0x18c')]){_0x4decfb[_0x4283('0x123')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x198'));}else{_0x4decfb[_0x4283('0x120')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x198'));}}break;case'3':_0x14afd2[_0x4283('0x199')]+=0x1;_0x38c8ae[_0x4283('0x6e')]=0x3;_0x38c8ae[_0x4283('0x6f')]='NoAnswer';_0x38c8ae['countnoanswerretry']+=0x1;_0x38c8ae[_0x4283('0xd5')]+=0x1;var _0x12f14b=ut[_0x4283('0x19a')](_0x40bde2,_0x14afd2);ami[_0x4283('0x3e')](_0x4283('0x19b'),_0x12f14b);_0x2e4d73=_0x14afd2['dialNoAnswerRetryFrequency'];_0x5e8702=_0x14afd2['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x38c8ae)[_0x4283('0xa0')](loggerCatch(_0x4283('0x19c')));if(_0x4decfb[_0x4283('0x186')](0x3,_0x40bde2,_0x14afd2)&&!_0x1f6a69){if(_0x38c8ae[_0x4283('0x11c')]>=_0x14afd2[_0x4283('0x187')]){_0x4decfb['createStateFinal'](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x19d'));}else{_0x4decfb['stateGlobal'](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x19d'));}}break;case'5':_0x14afd2[_0x4283('0x19e')]+=0x1;_0x38c8ae[_0x4283('0x6e')]=0x5;_0x38c8ae[_0x4283('0x6f')]='Busy';_0x38c8ae[_0x4283('0x12c')]+=0x1;_0x38c8ae[_0x4283('0xd5')]+=0x1;ami[_0x4283('0x3e')]('custom:agentbusy',ut[_0x4283('0x114')](_0x40bde2,_0x4283('0x19f')));_0x2e4d73=_0x14afd2[_0x4283('0x18a')];_0x5e8702=_0x14afd2[_0x4283('0xd7')];hopperUtils[_0x4283('0xc9')](_0x38c8ae)[_0x4283('0xa0')](loggerCatch(_0x4283('0x1a0')));if(_0x4decfb['checkRetriveMax'](0x5,_0x40bde2,_0x14afd2)&&!_0x1f6a69){if(_0x38c8ae[_0x4283('0x12c')]>=_0x14afd2[_0x4283('0x189')]){_0x4decfb[_0x4283('0x123')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x1a1'));}else{_0x4decfb[_0x4283('0x120')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x1a1'));}}break;case'8':_0x14afd2[_0x4283('0x1a2')]+=0x1;_0x38c8ae[_0x4283('0x6e')]=0x8;_0x38c8ae['statedesc']='Congestion';_0x38c8ae[_0x4283('0x11b')]+=0x1;_0x38c8ae[_0x4283('0xd5')]+=0x1;_0x2e4d73=_0x14afd2[_0x4283('0x1a3')];_0x5e8702=_0x14afd2[_0x4283('0xd7')];ami[_0x4283('0x3e')](_0x4283('0x1a4'),ut[_0x4283('0x114')](_0x40bde2,_0x4283('0x1a5')));hopperUtils[_0x4283('0xc9')](_0x38c8ae)[_0x4283('0xa0')](loggerCatch(_0x4283('0x1a6')));if(_0x4decfb['checkRetriveMax'](0x8,_0x40bde2,_0x14afd2)&&!_0x1f6a69){if(_0x38c8ae[_0x4283('0x11b')]>=_0x14afd2['dialCongestionMaxRetry']){_0x4decfb[_0x4283('0x123')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x1a7'));}else{_0x4decfb[_0x4283('0x120')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x1a7'));}}break;case'11':_0x14afd2['outboundAbandonedCallsDay']+=0x1;_0x38c8ae[_0x4283('0x6e')]=0xb;_0x38c8ae[_0x4283('0x6f')]='Abandoned';_0x38c8ae[_0x4283('0xe6')]+=0x1;_0x38c8ae['countglobal']+=0x1;_0x2e4d73=_0x14afd2[_0x4283('0xea')];_0x5e8702=_0x14afd2[_0x4283('0xd7')];hopperUtils[_0x4283('0xc9')](_0x38c8ae)[_0x4283('0xa0')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4decfb['checkRetriveMax'](0xb,_0x40bde2,_0x14afd2)&&!_0x1f6a69){if(_0x38c8ae[_0x4283('0xe6')]>=_0x14afd2[_0x4283('0xe7')]){_0x4decfb[_0x4283('0x123')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x1a8'));}else{_0x4decfb[_0x4283('0x120')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x1a8'));}}break;case'20':_0x14afd2[_0x4283('0x1a9')]+=0x1;_0x38c8ae[_0x4283('0x6e')]=0x14;_0x38c8ae[_0x4283('0x6f')]=_0x4283('0x1aa');_0x38c8ae[_0x4283('0x11e')]+=0x1;_0x38c8ae[_0x4283('0xd5')]+=0x1;_0x2e4d73=_0x14afd2[_0x4283('0x190')];_0x5e8702=_0x14afd2[_0x4283('0xd7')];ami[_0x4283('0x3e')](_0x4283('0x1ab'),ut['buildObj'](_0x40bde2,_0x4283('0x1ac')));hopperUtils[_0x4283('0xc9')](_0x38c8ae)[_0x4283('0xa0')](loggerCatch(_0x4283('0x1ad')));if(_0x4decfb['checkRetriveMax'](0x14,_0x40bde2,_0x14afd2)&&!_0x1f6a69){if(_0x38c8ae[_0x4283('0x11e')]>=_0x14afd2[_0x4283('0x18f')]){_0x4decfb[_0x4283('0x123')](_0x38c8ae,_0x8affba,_0x52d2cb,'reason\x2020\x20agentreject');}else{_0x4decfb[_0x4283('0x120')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x4283('0x1ae'));}}break;default:_0x14afd2[_0x4283('0x1af')]+=0x1;_0x38c8ae[_0x4283('0x6e')]=0xc;_0x38c8ae[_0x4283('0x6f')]=_0x2d48f9[_0x4283('0xc5')];_0x2e4d73=_0x14afd2[_0x4283('0x190')];_0x5e8702=_0x14afd2[_0x4283('0xd7')];hopperUtils[_0x4283('0xc9')](_0x38c8ae)['catch'](loggerCatch(_0x4283('0x1b0')));if(_0x4decfb[_0x4283('0x186')](_0x2d48f9[_0x4283('0xc5')],_0x40bde2,_0x14afd2)&&!_0x1f6a69){if(_0x38c8ae[_0x4283('0x12c')]+_0x38c8ae[_0x4283('0x11b')]+_0x38c8ae['countnoanswerretry']+_0x38c8ae[_0x4283('0x11d')]+_0x38c8ae[_0x4283('0xd4')]+_0x38c8ae[_0x4283('0xe6')]+_0x38c8ae[_0x4283('0x119')]+_0x38c8ae['countagentrejectretry']>=_0x14afd2[_0x4283('0x11f')]){_0x4decfb[_0x4283('0x120')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x2d48f9[_0x4283('0xc5')]);}else{_0x4decfb[_0x4283('0x123')](_0x38c8ae,_0x8affba,_0x52d2cb,_0x2d48f9[_0x4283('0xc5')]);}}}})[_0x4283('0x3b')](function(){if(_0x1f6a69){hopperUtils[_0x4283('0xe3')](_0x38c8ae,_0x2e4d73,_0x5e8702)['then'](function(){return _0x8affba(0x1);});}});});};Dialer['prototype'][_0x4283('0x120')]=function(_0x1e4475,_0x480491,_0x9f7c81,_0x1fc9d6){var _0x23a93d=new Final(_0x1e4475);_0x23a93d[_0x4283('0x6e')]=0xf;_0x23a93d[_0x4283('0x6f')]=_0x4283('0x1b1');this[_0x4283('0x123')](_0x23a93d,_0x480491,_0x9f7c81,_0x1fc9d6);};Dialer[_0x4283('0x18')]['createStateFinal']=function(_0x55acf0,_0x3f5313,_0x446a58,_0xf24843){hopperUtils[_0x4283('0xcb')](_0x55acf0)[_0x4283('0x3b')](function(){return _0x3f5313(msgResponse(_0x4283('0x191'),_0x4283('0x1b2'),_0xf24843));})[_0x4283('0xa0')](function(){return _0x446a58(msgResponse(_0x4283('0x1b3'),_0x4283('0x93'),_0x4283('0x1b4')));});};Dialer[_0x4283('0x18')][_0x4283('0xb0')]=function(_0x5b01df){var _0x572d85=_0x5b01df[_0x4283('0x1b5')]/0x64;var _0x1a92ac=_0x5b01df[_0x4283('0x1b6')]/(_0x5b01df[_0x4283('0x1b6')]+_0x5b01df[_0x4283('0xc4')]);var _0x34f981=Math['round'](_0x5b01df[_0x4283('0x1b7')]*(_0x5b01df[_0x4283('0x1b8')]/0x64));var _0x4723e7=Math[_0x4283('0x1b9')](_0x5b01df[_0x4283('0x1b7')]*(_0x5b01df[_0x4283('0x1ba')]/0x64));var _0x2e777b=_0x5b01df[_0x4283('0x136')]+_0x5b01df[_0x4283('0x1bb')];var _0x8d0d7a=Math[_0x4283('0x1bc')](_0x5b01df[_0x4283('0x58')]*_0x5b01df['erlangAbandonmentRate']*_0x5b01df['predictiveIntervalHitRate']*_0x5b01df[_0x4283('0x1bd')]);if(_[_0x4283('0x3d')](_0x5b01df[_0x4283('0x27')])){if(!_[_0x4283('0x3d')](_0x5b01df[_0x4283('0x60')])){_0x5b01df[_0x4283('0x60')]=undefined;loggerPredictive[_0x4283('0x64')](_0x4283('0x1be'),_0x4283('0x1bf'));}if(!_[_0x4283('0x3d')](_0x5b01df['handlePredictive'])){loggerPredictive[_0x4283('0x64')](_0x4283('0x1be'),_0x4283('0x1c0'));clearInterval(_0x5b01df[_0x4283('0x62')]);_0x5b01df[_0x4283('0x62')]=undefined;}_0x5b01df[_0x4283('0x27')]=moment()[_0x4283('0x43')](_0x4283('0xc3'));loggerPredictive[_0x4283('0x48')](_0x5b01df[_0x4283('0x45')],_0x4283('0x1c1'),_0x5b01df[_0x4283('0x27')]);this[_0x4283('0xb2')](_0x5b01df,0x1);}else if(ifInterval(_0x5b01df[_0x4283('0x1c2')],_0x5b01df[_0x4283('0x27')])){this[_0x4283('0xb2')](_0x5b01df,0x1);loggerPredictiveCalls['info'](_0x4283('0x1c3'),_0x5b01df['startProgressive'],_0x5b01df[_0x4283('0x45')]);_0x5b01df[_0x4283('0x58')]=0x0;_0x5b01df[_0x4283('0xd0')]=0x0;}else if(_0x572d85<_0x1a92ac&&_0x5b01df[_0x4283('0x1c4')]==='dropRate'){clearPredictiveAttributes(_0x5b01df);loggerPredictive['info'](_0x4283('0x1c5'),'Dropped\x20calls\x20day',_0x1a92ac,_0x4283('0x27'),_0x5b01df[_0x4283('0x45')]);}else if(_0x8d0d7a<_0x5b01df['predictiveIntervalErlangCallsDroppedCalls']&&_0x5b01df[_0x4283('0x1c4')]==='dropRate'){clearPredictiveAttributes(_0x5b01df);loggerPredictive[_0x4283('0x48')](_0x4283('0x1c6'),_0x4283('0x1c7'),_0x8d0d7a,'Drop\x20in\x20this\x20interval',_0x5b01df[_0x4283('0xd0')],_0x4283('0x27'),_0x5b01df[_0x4283('0x45')]);}else if(!ifInterval(_0x5b01df[_0x4283('0x1c2')],_0x5b01df['startProgressive'])&&_[_0x4283('0x3d')](_0x5b01df[_0x4283('0x60')])&&!_['isUndefined'](_0x5b01df[_0x4283('0x27')])){_0x5b01df['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4283('0x48')](_0x5b01df[_0x4283('0x45')],'started\x20in\x20predictive\x20at',_0x5b01df['startPredictive']);hopperUtils[_0x4283('0x1c8')](_0x5b01df['dialPredictiveInterval'])[_0x4283('0x3b')](this[_0x4283('0x1c9')](_0x5b01df))['then'](mergeDataErlangB(_0x5b01df))[_0x4283('0x3b')](this[_0x4283('0x1ca')](_0x5b01df))[_0x4283('0xa0')](loggerCatchPredictive(_0x4283('0x1cb'),_0x5b01df));}else if(!ifInterval(_0x5b01df[_0x4283('0x1c2')],_0x5b01df['startPredictive'])){_0x5b01df['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5b01df[_0x4283('0x60')]=moment()[_0x4283('0x43')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5b01df[_0x4283('0x45')],_0x4283('0x1cc'),_0x5b01df['startPredictive']);clearInterval(_0x5b01df[_0x4283('0x62')]);_0x5b01df[_0x4283('0x62')]=undefined;hopperUtils['avgHandleTime'](_0x5b01df[_0x4283('0x1c2')])[_0x4283('0x3b')](this[_0x4283('0x1c9')](_0x5b01df))[_0x4283('0x3b')](mergeDataErlangB(_0x5b01df))[_0x4283('0x3b')](this['startMethodPredictive'](_0x5b01df))[_0x4283('0xa0')](loggerCatchPredictive(_0x4283('0x1cd'),_0x5b01df));}else if(_0x5b01df[_0x4283('0x1b7')]&&_0x2e777b<_0x5b01df[_0x4283('0x1b7')]-_0x4723e7){clearPredictiveAttributes(_0x5b01df);loggerPredictive[_0x4283('0x48')](_0x5b01df[_0x4283('0x45')],_0x4283('0x1ce'),_0x2e777b,_0x4283('0x1cf'),_0x5b01df[_0x4283('0x1b7')],'-',_0x4723e7,'=',_0x5b01df['predictiveIntervalAvailable']-_0x4723e7,')');}else if(_0x5b01df[_0x4283('0x1b7')]&&_0x2e777b>_0x5b01df[_0x4283('0x1b7')]+_0x34f981){clearPredictiveAttributes(_0x5b01df);loggerPredictive['info'](_0x5b01df[_0x4283('0x45')],_0x4283('0x1ce'),_0x2e777b,_0x4283('0x1d0'),_0x5b01df[_0x4283('0x1b7')],'+',_0x34f981,'=',_0x5b01df[_0x4283('0x1b7')]+_0x34f981,')');}};Dialer['prototype'][_0x4283('0x1c9')]=function(_0x1df523){var _0x3ab2e4=this;return function(_0x409b95){return new Promise(function(_0xd47c94,_0x592136){_[_0x4283('0x5e')](_0x1df523,_0x409b95[0x0]);if(checkGetDataPredictive(_0x409b95[0x0])){var _0x2b83da=_0x1df523[_0x4283('0x1b7')]=_0x1df523[_0x4283('0x1bb')]+_0x1df523['available'];var _0x865006=_0x1df523[_0x4283('0x1c2')]*0x3c;var _0x3e4466=_0x409b95[0x0]['predictiveIntervalAvgTalktime']+_0x409b95[0x0]['predictiveIntervalAvgHoldtime'];var _0x3824e9=(_0x409b95[0x0][_0x4283('0x4b')]+_0x409b95[0x0][_0x4283('0x4d')]+_0x409b95[0x0][_0x4283('0x4e')])/_0x409b95[0x0][_0x4283('0x4a')];_0x1df523[_0x4283('0x1d1')]=_0x3824e9>0x0?_0x3824e9:0x1;switch(_0x1df523[_0x4283('0x1c4')]){case _0x4283('0x1d2'):var _0x1b8632=_0x1df523[_0x4283('0x1b5')]/0x64;return _0x3ab2e4[_0x4283('0x1d3')](_0x2b83da,_0x865006,_0x3e4466,_0x3824e9,_0x1b8632)[_0x4283('0x3b')](function(_0x92e9b7){return _0xd47c94(_0x92e9b7);});case _0x4283('0x1d4'):var _0x58addd=_0x1df523['dialPredictiveOptimizationPercentage']/0x64;return _0x3ab2e4['busyFactor'](_0x2b83da,_0x865006,_0x3e4466,_0x3824e9,_0x58addd)[_0x4283('0x3b')](function(_0x15febd){return _0xd47c94(_0x15febd);});default:return _0x592136(msgResponse(_0x4283('0x1d5'),'Failure','Unknown\x20Predictive'));}}else{return _0x592136(msgResponse(_0x4283('0x1d5'),'Failure',_0x4283('0x1d6')));}});};};Dialer[_0x4283('0x18')][_0x4283('0x1d7')]=function(_0x5b38c5){var _0x483e89=this;return function(_0x46eb6c){return new Promise(function(_0x308a42,_0x5025da){_[_0x4283('0x5e')](_0x5b38c5,_0x46eb6c[0x0]);if(checkGetDataPredictive(_0x46eb6c[0x0])){loggerPredictive[_0x4283('0x48')](JSON[_0x4283('0x74')](_0x46eb6c[0x0]));if(_0x5b38c5[_0x4283('0x1c4')]===_0x4283('0x1d2')){return _0x483e89[_0x4283('0x14c')](_0x5b38c5['id'])[_0x4283('0x3b')](function(_0x184d12){var _0x46d150=_0x5b38c5[_0x4283('0x1d8')]-_0x184d12[0x0][_0x4283('0x1d9')];var _0x33f59d=_0x5b38c5[_0x4283('0x1c2')]*0x3c;var _0x174832=_0x46eb6c[0x0]['predictiveIntervalAvgTalktime']+_0x46eb6c[0x0][_0x4283('0x53')];var _0x3c520a=(_0x46eb6c[0x0][_0x4283('0x4b')]+_0x46eb6c[0x0][_0x4283('0x4d')]+_0x46eb6c[0x0][_0x4283('0x4e')])/_0x46eb6c[0x0][_0x4283('0x4a')];var _0x48b4de=_0x5b38c5[_0x4283('0x1b5')]/0x64;_0x5b38c5[_0x4283('0x1da')]=_0x184d12[0x0][_0x4283('0x1d9')]||0x0;_0x5b38c5['predictiveIntervalHitRate']=_0x3c520a>0x0?_0x3c520a:0x1;return _0x483e89[_0x4283('0x1d3')](_0x46d150,_0x33f59d,_0x174832,_0x3c520a,_0x48b4de);})[_0x4283('0x3b')](function(_0x468d11){return _0x308a42(_0x468d11);})[_0x4283('0xa0')](function(_0x424459){return _0x5025da(msgResponse(_0x4283('0x1db'),'Failure',JSON[_0x4283('0x74')](_0x424459)));});}if(_0x5b38c5[_0x4283('0x1c4')]===_0x4283('0x1d4')){return _0x483e89[_0x4283('0x14c')](_0x5b38c5['id'])[_0x4283('0x3b')](function(_0x59661b){var _0xd9ac47=_0x5b38c5[_0x4283('0x1d8')]-_0x59661b[0x0][_0x4283('0x1d9')];var _0x60c4c8=_0x5b38c5[_0x4283('0x1c2')]*0x3c;var _0x50aecd=_0x46eb6c[0x0]['predictiveIntervalAvgTalktime']+_0x46eb6c[0x0][_0x4283('0x53')];var _0x1a6b8f=(_0x46eb6c[0x0][_0x4283('0x4b')]+_0x46eb6c[0x0][_0x4283('0x4d')]+_0x46eb6c[0x0][_0x4283('0x4e')])/_0x46eb6c[0x0][_0x4283('0x4a')];var _0x59f487=_0x5b38c5[_0x4283('0x1b5')]/0x64;_0x5b38c5[_0x4283('0x1da')]=_0x59661b[0x0][_0x4283('0x1d9')]||0x0;_0x5b38c5[_0x4283('0x1d1')]=_0x1a6b8f>0x0?_0x1a6b8f:0x1;return _0x483e89['busyFactor'](_0xd9ac47,_0x60c4c8,_0x50aecd,_0x1a6b8f,_0x59f487);})[_0x4283('0x3b')](function(_0x2e4d9c){return _0x308a42(_0x2e4d9c);})[_0x4283('0xa0')](function(_0x5aee88){return _0x5025da(msgResponse('[CatchErlangB]',_0x4283('0x93'),JSON[_0x4283('0x74')](_0x5aee88)));});}}else{return _0x5025da(msgResponse(_0x4283('0x1d5'),_0x4283('0x93'),_0x4283('0x1d6')));}});};};Dialer['prototype'][_0x4283('0x1ca')]=function(_0x466e2d){var _0x48b9bb=this;return function(){var _0x28bf30=0x0;var _0xe78bf3=Math[_0x4283('0x1bc')](_0x466e2d[_0x4283('0x59')]*0x3e8);if(_0xe78bf3>0x0){_0xe78bf3=_0xe78bf3<0x64?0x64:_0xe78bf3;loggerPredictive['info'](_0x466e2d[_0x4283('0x45')],'one\x20call\x20every:',_0xe78bf3,_0x4283('0x1dc'));_0x466e2d[_0x4283('0x62')]=setInterval(function(){_0x48b9bb[_0x4283('0x62')](_0x466e2d);loggerPredictiveCalls[_0x4283('0x48')](_0x4283('0x1dd'),_0x28bf30+=0x1);},_0xe78bf3);}else{loggerPredictive[_0x4283('0x48')](_0x466e2d['name'],_0x4283('0x1de'));}};};Dialer[_0x4283('0x18')][_0x4283('0x1df')]=function(_0xa27566,_0x549d28){var _0x522367=this;return function(_0x579be6){if(_[_0x4283('0x47')](_0x579be6)){if(_[_0x4283('0xf3')](_0x549d28[_0x4283('0x152')])||!_0x549d28['recallme']){if(_0xa27566[_0x4283('0xaf')]===_0x4283('0x7')){_0xa27566[_0x4283('0x72')]=_[_0x4283('0x3d')](_0xa27566['queueStatusComplete'])?!![]:_0xa27566['queueStatusComplete'];var _0x4fddfa=uuid['v4']();_0x522367[_0x4283('0x23')][_0x4fddfa]=new Action(_0xa27566,_0x549d28,_0x4fddfa);loggerBooked[_0x4283('0x48')](_0x4283('0x1e0'),_0x4fddfa,_0x4283('0x1e1'),JSON[_0x4283('0x74')](_0xa27566[_0x4283('0x72')]),'Queue:\x20',_0xa27566[_0x4283('0x45')]);if(_0xa27566[_0x4283('0x72')]){_0xa27566[_0x4283('0x72')]=![];_0x522367[_0x4283('0x28')][_0x522367[_0x4283('0x23')][_0x4fddfa][_0x4283('0xbe')]]=[];ami['Action']({'actionid':_0x4fddfa,'action':'queuestatus','queue':_0xa27566[_0x4283('0x45')]})[_0x4283('0xa0')](function(){_0x522367[_0x4283('0xc1')](_0xa27566);hopperUtils[_0x4283('0xda')]({'active':![],'ContactId':_0x522367[_0x4283('0x23')][_0x4fddfa][_0x4283('0xdb')],'ListId':_0x522367[_0x4283('0x23')][_0x4fddfa][_0x4283('0xdc')],'VoiceQueueId':_0x522367[_0x4283('0x23')][_0x4fddfa]['VoiceQueueId']||undefined,'CampaignId':_0x522367[_0x4283('0x23')][_0x4fddfa]['CampaignId']||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0x1e2')));delete _0x522367[_0x4283('0x23')][_0x4fddfa];});}else{loggerBooked[_0x4283('0x48')](_0x4283('0x1e3'),JSON[_0x4283('0x74')](_0xa27566[_0x4283('0x72')]),_0x4283('0x1e4'),_0xa27566['name']);_0x522367[_0x4283('0xc1')](_0xa27566);hopperUtils[_0x4283('0xda')]({'active':![],'ContactId':_0x522367[_0x4283('0x23')][_0x4fddfa]['ContactId'],'ListId':_0x522367[_0x4283('0x23')][_0x4fddfa][_0x4283('0xdc')],'VoiceQueueId':_0x522367[_0x4283('0x23')][_0x4fddfa]['VoiceQueueId']||undefined,'CampaignId':_0x522367[_0x4283('0x23')][_0x4fddfa]['CampaignId']||undefined})['catch'](loggerCatch(_0x4283('0x1e2')));delete _0x522367[_0x4283('0x23')][_0x4fddfa];}}else{return _0x522367[_0x4283('0x1e5')](_0xa27566,_0x549d28);}}else{if(utils[_0x4283('0x1e6')](undefined,_0x549d28[_0x4283('0x1e7')])<_0xa27566['dialRecallMeTimeout']*0x3c){if(_0x549d28[_0x4283('0x143')]&&!_0x549d28[_0x4283('0x143')][_0x4283('0x1e8')]){_0x522367[_0x4283('0xfe')][_0x4283('0xf7')](_0x549d28['id'])[_0x4283('0x1b')](function(){_0x522367[_0x4283('0xc1')](_0xa27566);});}else{hopperUtils['unlockContact']({'active':![]},_0x549d28['id'],0x1)['finally'](function(){_0x522367[_0x4283('0xc1')](_0xa27566);});}}else{_0xa27566[_0x4283('0x1e9')]+=0x1;_0x522367[_0x4283('0xc1')](_0xa27566);if(_0xa27566[_0x4283('0x1ea')]){hopperUtils[_0x4283('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x549d28[_0x4283('0xdb')],'ListId':_0x549d28[_0x4283('0xdc')],'VoiceQueueId':_0x549d28[_0x4283('0xdd')]||undefined,'CampaignId':_0x549d28['CampaignId']||undefined})[_0x4283('0xa0')](loggerCatch(_0x4283('0x1eb')));hopperUtils[_0x4283('0xc9')](createObjHistory(_0xa27566,_0x549d28,utils[_0x4283('0x6b')][_0x4283('0x1ec')],0x17,'RecallInQueue'))[_0x4283('0xa0')](loggerCatch(_0x4283('0x1ed')));}else{_0x522367[_0x4283('0x116')](createObjHistory(_0xa27566,_0x549d28,utils[_0x4283('0x6b')][_0x4283('0x1ee')],0x16,'RecallFailedTimeout'),_0x4283('0x1ef'),_0x4283('0x1f0'));}}}}else{_0xa27566[_0x4283('0x1f1')]+=0x1;_0x522367[_0x4283('0x116')](createObjHistory(_0xa27566,_0x549d28,utils[_0x4283('0x6b')][_0x4283('0x1f2')],0xd,'Blacklist'),_0x4283('0x1f3'),'[Originate][MoveBlacklist]');throw _0x4283('0x1f4');}};};Dialer[_0x4283('0x18')][_0x4283('0x154')]=function(_0x42e5a2){var _0x3f0c35=this;var _0x10cf27=_0x42e5a2[_0x4283('0x1f5')]-_0x42e5a2['originated'];emitCampaignSummary(_0x42e5a2);if(_0x10cf27>0x0&&_0x42e5a2[_0x4283('0x1f6')]==0x0){if(_0x10cf27>this[_0x4283('0x21')]){_0x10cf27=this[_0x4283('0x21')];}_0x42e5a2[_0x4283('0x1f6')]=0x1;hopperUtils[_0x4283('0x1f7')](_0x42e5a2,_0x10cf27)[_0x4283('0x3b')](function(_0x4df7b0){_0x42e5a2['temp']=0x0;if(_0x4df7b0){if(!utils['checkContactEmpty'](_0x4df7b0)){_0x42e5a2[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x6c')];logger['info']('[getContactCampaign2][Empty]'+_0x42e5a2[_0x4283('0x45')]);}else{_0x42e5a2['originated']+=_0x4df7b0[_0x4283('0x140')];_0x42e5a2[_0x4283('0x67')]=utils[_0x4283('0x6b')][_0x4283('0x1f8')];for(var _0x532bb9=0x0;_0x532bb9<_0x4df7b0[_0x4283('0x140')];_0x532bb9+=0x1){_0x42e5a2[_0x4283('0x1f9')]+=0x1;if(_['isNil'](_0x4df7b0[_0x532bb9])||_['isNil'](_0x4df7b0[_0x532bb9]['Contact'])||_[_0x4283('0xf3')](_0x4df7b0[_0x532bb9][_0x4283('0x158')])){_0x3f0c35[_0x4283('0x150')]('[actionOriginate]\x20',_0x42e5a2,_0x4df7b0[_0x532bb9]);}else{hopperUtils[_0x4283('0x1fa')](_[_0x4283('0x75')](_0x4df7b0[_0x532bb9],[_0x4283('0xde'),_0x4283('0x158')]))[_0x4283('0x3b')](_0x3f0c35[_0x4283('0x1df')](_0x42e5a2,_0x4df7b0[_0x532bb9]))[_0x4283('0xa0')](_0x3f0c35[_0x4283('0x14f')](_0x4283('0x1fb'),_0x42e5a2));}}}}})[_0x4283('0xa0')](loggerGetContactDialer('[getContactCampaign2]',_0x42e5a2,_0x10cf27));}};Dialer['prototype'][_0x4283('0xb2')]=function(_0x3d7fd9,_0x586627){var _0x2209a3=this;var _0x46bbc2=[];if(_0x586627<0x1||_0x3d7fd9[_0x4283('0xaf')]==='booked'){_0x586627=0x1;}var _0x5abc25=Math[_0x4283('0x1bc')](_0x3d7fd9[_0x4283('0x136')]*_0x586627)-_0x3d7fd9[_0x4283('0x80')];if(_0x3d7fd9[_0x4283('0x1fc')]>0x0){var _0xf73d0f=_0x3d7fd9[_0x4283('0x1fc')]-_0x3d7fd9[_0x4283('0x80')]-_0x3d7fd9[_0x4283('0x1bb')]-_0x3d7fd9[_0x4283('0x137')];if(_0x5abc25>_0xf73d0f){_0x5abc25=_0xf73d0f;}}if(_0x5abc25>0x0&&_0x3d7fd9[_0x4283('0x1f6')]==0x0){if(_0x3d7fd9[_0x4283('0xaf')]===_0x4283('0x7')){_0x5abc25=0x1;}if(_0x5abc25>this[_0x4283('0x21')]){_0x5abc25=this[_0x4283('0x21')];}for(var _0x472129 in this[_0x4283('0x1f')]){if(typeof this['agents'][_0x472129]!==_0x4283('0xaa')){if(this[_0x4283('0x1f')][_0x472129]['state']===_0x4283('0x1fd')&&this[_0x4283('0x1f')][_0x472129]['status']==='reachable'){_0x46bbc2[_0x4283('0xa1')](this['agents'][_0x472129]['id']);}}}_0x3d7fd9['temp']=0x1;hopperUtils[_0x4283('0x1fe')](_0x3d7fd9,_0x46bbc2,_0x5abc25)[_0x4283('0x3b')](function(_0x2ec5f9){_0x3d7fd9[_0x4283('0x1f6')]=0x0;if(_0x2ec5f9){if(!utils[_0x4283('0x1ff')](_0x2ec5f9)){hopperUtils['countReScheduled'](_0x3d7fd9)[_0x4283('0x3b')](sendMessageReschedule(_0x3d7fd9))[_0x4283('0xa0')](loggerCatch(_0x4283('0x200')));}else{_0x3d7fd9[_0x4283('0x80')]+=_0x2ec5f9[_0x4283('0x140')];_0x3d7fd9[_0x4283('0x67')]=_0x3d7fd9[_0x4283('0xaf')]===_0x4283('0x7')?utils['CAMPAIGN_STATUS'][_0x4283('0x138')]:utils[_0x4283('0x6b')][_0x4283('0x1f8')];for(var _0x538c1a=0x0;_0x538c1a<_0x2ec5f9[_0x4283('0x140')];_0x538c1a+=0x1){if(_[_0x4283('0xf3')](_0x2ec5f9[_0x538c1a])||_['isNil'](_0x2ec5f9[_0x538c1a][_0x4283('0x171')])||_[_0x4283('0xf3')](_0x2ec5f9[_0x538c1a][_0x4283('0x158')])){_0x2209a3[_0x4283('0x150')]('[actionOriginate]\x20',_0x3d7fd9,_0x2ec5f9[_0x538c1a]);}else{hopperUtils[_0x4283('0x201')](_[_0x4283('0x75')](_0x2ec5f9[_0x538c1a],[_0x4283('0xdd'),_0x4283('0x158')]))[_0x4283('0x3b')](_0x2209a3[_0x4283('0x1df')](_0x3d7fd9,_0x2ec5f9[_0x538c1a]))[_0x4283('0xa0')](_0x2209a3[_0x4283('0x14f')]('[actionOriginate]\x20',_0x3d7fd9));}}}}})['catch'](loggerGetContactDialer(_0x4283('0x202'),_0x3d7fd9,_0x5abc25));}};Dialer[_0x4283('0x18')]['handlePredictive']=function(_0x3b19e6){if(_0x3b19e6['dialLimitQueue']>0x0){var _0x3eb6d7=_0x3b19e6[_0x4283('0x1fc')]-_0x3b19e6[_0x4283('0x80')]-_0x3b19e6[_0x4283('0x1bb')];if(_0x3eb6d7>0x0&&_0x3b19e6[_0x4283('0x1f6')]==0x0){this[_0x4283('0x203')](_0x3b19e6);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x4283('0x203')](_0x3b19e6);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x340428){var _0x43ceab=this;var _0x352a6f=[];_0x340428[_0x4283('0x80')]+=0x1;for(var _0x1b9ae8 in this[_0x4283('0x1f')]){if(typeof this[_0x4283('0x1f')][_0x1b9ae8]!==_0x4283('0xaa')){if(this[_0x4283('0x1f')][_0x1b9ae8][_0x4283('0x6e')]===_0x4283('0x1fd')&&this['agents'][_0x1b9ae8][_0x4283('0x88')]===_0x4283('0x89')){_0x352a6f[_0x4283('0xa1')](this[_0x4283('0x1f')][_0x1b9ae8]['id']);}}}_0x340428[_0x4283('0x1f6')]=0x1;return this[_0x4283('0x1fe')](_0x340428['id'],_0x352a6f,0x1,_0x340428[_0x4283('0x204')],_0x340428)['then'](function(_0x35ed18){_0x340428[_0x4283('0x1f6')]=0x1;if(_0x35ed18){if(!utils[_0x4283('0x1ff')](_0x35ed18)){utils[_0x4283('0x66')](_0x340428,0x1,0x0);return hopperUtils[_0x4283('0x205')](_0x340428)[_0x4283('0x3b')](sendMessageReschedule(_0x340428))[_0x4283('0xa0')](loggerCatch(_0x4283('0x200')));}else{_0x340428['message']=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0x4283('0xf3')](_0x35ed18[0x0])||_[_0x4283('0xf3')](_0x35ed18[0x0]['Contact'])||_[_0x4283('0xf3')](_0x35ed18[0x0][_0x4283('0x158')])){_0x43ceab[_0x4283('0x150')]('[actionOriginate]\x20',_0x340428,_0x35ed18[0x0]);}else{return hopperUtils[_0x4283('0x201')](_[_0x4283('0x75')](_0x35ed18[0x0],['VoiceQueueId',_0x4283('0x158')]))[_0x4283('0x3b')](_0x43ceab[_0x4283('0x1df')](_0x340428,_0x35ed18[0x0]))[_0x4283('0xa0')](_0x43ceab['loggerHandler'](_0x4283('0x206'),_0x340428));}}}})['catch'](loggerGetContactDialer(_0x4283('0x207'),_0x340428,0x1));};Dialer[_0x4283('0x18')]['abandonmentRate']=function(_0x518d91,_0xee3f5e,_0x2967b8,_0x4d6162,_0x413533,_0x224f8f){loggerPredictive[_0x4283('0x48')](_0x4283('0x208'));loggerPredictive['info'](_0x4283('0x209'),_0x518d91);loggerPredictive['info'](_0x4283('0x20a'),_0xee3f5e);loggerPredictive[_0x4283('0x48')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2967b8);loggerPredictive[_0x4283('0x48')]('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',_0x4d6162);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x413533);loggerPredictive['info'](_0x4283('0x51'));return new Promise(function(_0x2d726f,_0x235415){if(_0x518d91<=0x0||isNaN(_0x518d91)){return _0x235415(msgResponse(_0x4283('0x20b'),_0x4283('0x85'),_0x4283('0x20c')+_0x518d91));}if(_0x2967b8<=0x0||isNaN(_0x2967b8)){return _0x235415(msgResponse('[abandonmentRate]',_0x4283('0x85'),'Ts\x20=\x20'+_0x2967b8));}if(_0x4d6162<=0x0||isNaN(_0x4d6162)){return _0x235415(msgResponse(_0x4283('0x20b'),_0x4283('0x85'),'p\x20=\x20'+_0x4d6162));}if(_0xee3f5e<=0x0||isNaN(_0xee3f5e)){return _0x235415(msgResponse(_0x4283('0x20b'),'Error',_0x4283('0x20d')+_0xee3f5e));}if(_0x413533<=0x0||isNaN(_0x413533)){return _0x235415(msgResponse(_0x4283('0x20b'),_0x4283('0x85'),_0x4283('0x20e')+_0x413533));}_0x224f8f=_0x224f8f||0x0;var _0x5d2a2a=0x1/_0x2967b8;var _0x5d8c8e=0x0;var _0x2b610b=0x0;var _0x4336ad=0x0;var _0x23d554=0x0;for(var _0x5bbf9b=0x0;_0x4336ad<_0x413533;_0x5bbf9b+=0x1){_0x2b610b=_0x5bbf9b/_0xee3f5e;_0x5d8c8e=(_0x4d6162*_0x2b610b+_0x224f8f)/_0x5d2a2a;_0x4336ad=utils[_0x4283('0x20f')](_0x5d8c8e,_0x518d91);_0x23d554=_0x5d8c8e/_0x518d91*(0x1-utils[_0x4283('0x20f')](_0x5d8c8e,_0x518d91));}return _0x2d726f({'erlangCalls':_0x5bbf9b,'erlangCallToSecond':_0xee3f5e/_0x5bbf9b,'erlangAbandonmentRate':_0x4336ad,'erlangBusyFactor':_0x23d554});});};Dialer['prototype'][_0x4283('0x210')]=function(_0x2a0b53,_0x324125,_0x2b440c,_0x192523,_0x2983f0,_0x2bf914){loggerPredictive[_0x4283('0x48')](_0x4283('0x211'));loggerPredictive[_0x4283('0x48')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a0b53);loggerPredictive[_0x4283('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x324125);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',_0x2b440c);loggerPredictive[_0x4283('0x48')](_0x4283('0x212'),_0x192523);loggerPredictive['info'](_0x4283('0x213'),_0x2983f0);loggerPredictive[_0x4283('0x48')](_0x4283('0x51'));return new Promise(function(_0x53d46f,_0x360e9b){if(_0x2a0b53<=0x0||isNaN(_0x2a0b53)){return _0x360e9b(msgResponse(_0x4283('0x214'),'Error',_0x4283('0x20c')+_0x2a0b53));}if(_0x2b440c<=0x0||isNaN(_0x2b440c)){return _0x360e9b(msgResponse(_0x4283('0x214'),'Error',_0x4283('0x215')+_0x2b440c));}if(_0x192523<=0x0||isNaN(_0x192523)){return _0x360e9b(msgResponse(_0x4283('0x214'),'Error','p\x20=\x20'+_0x192523));}if(_0x324125<=0x0||isNaN(_0x324125)){return _0x360e9b(msgResponse('[busyFactor]','Error',_0x4283('0x20d')+_0x324125));}if(_0x2983f0<=0x0||isNaN(_0x2983f0)){return _0x360e9b(msgResponse('[busyFactor]',_0x4283('0x85'),_0x4283('0x216')+_0x2983f0));}_0x2bf914=_0x2bf914||0x0;var _0x1d5f58=0x1/_0x2b440c;var _0x13970a=0x0;var _0x23e6da=0x0;var _0x5a6ea8=0x0;var _0x1bf111=0x0;for(var _0x41a0a4=0x0;_0x1bf111<_0x2983f0;_0x41a0a4+=0x1){_0x23e6da=_0x41a0a4/_0x324125;_0x13970a=(_0x192523*_0x23e6da+_0x2bf914)/_0x1d5f58;_0x5a6ea8=utils[_0x4283('0x20f')](_0x13970a,_0x2a0b53);_0x1bf111=_0x13970a/_0x2a0b53*(0x1-utils[_0x4283('0x20f')](_0x13970a,_0x2a0b53));}return _0x53d46f({'erlangCalls':_0x41a0a4,'erlangCallToSecond':_0x324125/_0x41a0a4,'erlangAbandonmentRate':_0x5a6ea8,'erlangBusyFactor':_0x1bf111});});};module[_0x4283('0x217')]=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 fbb2021..89c4d49 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 _0x3414=['format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','isNil','name','Contact','firstName','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime'];(function(_0x3b8631,_0x159763){var _0x452557=function(_0x15e9f8){while(--_0x15e9f8){_0x3b8631['push'](_0x3b8631['shift']());}};_0x452557(++_0x159763);}(_0x3414,0xea));var _0x4341=function(_0x5d06a9,_0x304a55){_0x5d06a9=_0x5d06a9-0x0;var _0x607055=_0x3414[_0x5d06a9];return _0x607055;};'use strict';var util=require(_0x4341('0x0'));var _=require(_0x4341('0x1'));var moment=require(_0x4341('0x2'));function checkNameSurname(_0x4c7e81,_0x5219e9,_0x26a6d2){var _0x223def='';if(!_['isNil'](_0x5219e9)&&_0x4341('0x3')===typeof _0x5219e9){_0x223def+=_0x5219e9;}if(!_[_0x4341('0x4')](_0x26a6d2)&&_0x4341('0x3')===typeof _0x26a6d2){_0x223def+='\x20'+_0x26a6d2;}if(_0x223def!==''){return _0x223def;}return _0x4c7e81;}function Action(_0xbec27d,_0x9934ea,_0x53be08){this['voiceQueue']=_0xbec27d;this['uniqueid']=_0x53be08||undefined;this[_0x4341('0x5')]=checkNameSurname(_0x9934ea[_0x4341('0x6')]['phone'],_0x9934ea[_0x4341('0x6')][_0x4341('0x7')],_0x9934ea[_0x4341('0x6')][_0x4341('0x8')]);this[_0x4341('0x9')]=_0x9934ea[_0x4341('0xa')];this['queue']=_0xbec27d['name'];this[_0x4341('0xb')]=_0x9934ea['active']||![];this[_0x4341('0xc')]=_0xbec27d[_0x4341('0xc')];this[_0x4341('0xd')]=_0xbec27d[_0x4341('0xd')]||0x3;this['scheduledat']=_0x9934ea[_0x4341('0xe')];this[_0x4341('0xf')]=_0x9934ea[_0x4341('0xf')];this[_0x4341('0x10')]=_0x9934ea[_0x4341('0x10')];this[_0x4341('0x11')]=_0x9934ea[_0x4341('0x11')];this[_0x4341('0x12')]=_0x9934ea[_0x4341('0x12')];this['countdropretry']=_0x9934ea['countdropretry'];this[_0x4341('0x13')]=_0x9934ea[_0x4341('0x13')];this[_0x4341('0x14')]=_0x9934ea[_0x4341('0x14')];this[_0x4341('0x15')]=_0x9934ea[_0x4341('0x15')];this[_0x4341('0x16')]=_0x9934ea[_0x4341('0x16')];this[_0x4341('0x17')]=_0x9934ea[_0x4341('0x17')];this[_0x4341('0x18')]=_0x9934ea[_0x4341('0x18')];this[_0x4341('0x19')]=_0x9934ea[_0x4341('0x19')];this[_0x4341('0x1a')]=_0x9934ea[_0x4341('0x1a')];this[_0x4341('0x1b')]=_0x9934ea['id'];this[_0x4341('0x1c')]=_0x9934ea['Contact'][_0x4341('0x7')]||'';this[_0x4341('0x1d')]=moment()[_0x4341('0x1e')](_0x4341('0x1f'));this['callback']=_0x9934ea[_0x4341('0x20')];this[_0x4341('0x21')]=_0x9934ea[_0x4341('0x21')];this[_0x4341('0x22')]=_0x9934ea[_0x4341('0x22')];this[_0x4341('0x23')]=_0x9934ea[_0x4341('0x23')];this['originatecalleridnum']='';this[_0x4341('0x24')]='';}Action[_0x4341('0x25')]['getCaller']=function(){return util['format'](_0x4341('0x26'),this['name'],this[_0x4341('0x27')][_0x4341('0x28')]>0x0?this[_0x4341('0x9')][_0x4341('0x29')](this[_0x4341('0x27')]['dialCutDigit']):this[_0x4341('0x9')]);};Action['prototype'][_0x4341('0x2a')]=function(){return this['queue'];};module[_0x4341('0x2b')]=Action; \ No newline at end of file +var _0x6400=['countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x4e27b8,_0x1dbabc){var _0x4fddc4=function(_0x2be9e4){while(--_0x2be9e4){_0x4e27b8['push'](_0x4e27b8['shift']());}};_0x4fddc4(++_0x1dbabc);}(_0x6400,0x1e4));var _0x0640=function(_0x5f1d74,_0x33e095){_0x5f1d74=_0x5f1d74-0x0;var _0xab75f5=_0x6400[_0x5f1d74];return _0xab75f5;};'use strict';var util=require(_0x0640('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x564c9a,_0x264017,_0x1ff607){var _0x133b26='';if(!_[_0x0640('0x1')](_0x264017)&&_0x0640('0x2')===typeof _0x264017){_0x133b26+=_0x264017;}if(!_[_0x0640('0x1')](_0x1ff607)&&_0x0640('0x2')===typeof _0x1ff607){_0x133b26+='\x20'+_0x1ff607;}if(_0x133b26!==''){return _0x133b26;}return _0x564c9a;}function Action(_0x29f6d3,_0x2b36a8,_0x32e3a3){this[_0x0640('0x3')]=_0x29f6d3;this[_0x0640('0x4')]=_0x32e3a3||undefined;this[_0x0640('0x5')]=checkNameSurname(_0x2b36a8[_0x0640('0x6')][_0x0640('0x7')],_0x2b36a8[_0x0640('0x6')][_0x0640('0x8')],_0x2b36a8[_0x0640('0x6')][_0x0640('0x9')]);this[_0x0640('0xa')]=_0x2b36a8[_0x0640('0x7')];this[_0x0640('0xb')]=_0x29f6d3['name'];this[_0x0640('0xc')]=_0x2b36a8[_0x0640('0xc')]||![];this[_0x0640('0xd')]=_0x29f6d3[_0x0640('0xd')];this[_0x0640('0xe')]=_0x29f6d3[_0x0640('0xe')]||0x3;this[_0x0640('0xf')]=_0x2b36a8[_0x0640('0xf')];this[_0x0640('0x10')]=_0x2b36a8[_0x0640('0x10')];this[_0x0640('0x11')]=_0x2b36a8['countcongestionretry'];this[_0x0640('0x12')]=_0x2b36a8['countnoanswerretry'];this[_0x0640('0x13')]=_0x2b36a8[_0x0640('0x13')];this['countdropretry']=_0x2b36a8[_0x0640('0x14')];this['countabandonedretry']=_0x2b36a8['countabandonedretry'];this[_0x0640('0x15')]=_0x2b36a8['countmachineretry'];this[_0x0640('0x16')]=_0x2b36a8['countagentrejectretry'];this[_0x0640('0x17')]=_0x2b36a8['ContactId'];this['ListId']=_0x2b36a8[_0x0640('0x18')];this['UserId']=_0x2b36a8['UserId'];this[_0x0640('0x19')]=_0x2b36a8[_0x0640('0x19')];this[_0x0640('0x1a')]=_0x2b36a8[_0x0640('0x1a')];this[_0x0640('0x1b')]=_0x2b36a8['id'];this['ContactFirstName']=_0x2b36a8[_0x0640('0x6')][_0x0640('0x8')]||'';this[_0x0640('0x1c')]=moment()[_0x0640('0x1d')](_0x0640('0x1e'));this[_0x0640('0x1f')]=_0x2b36a8['callback'];this[_0x0640('0x20')]=_0x2b36a8[_0x0640('0x20')];this[_0x0640('0x21')]=_0x2b36a8[_0x0640('0x21')];this[_0x0640('0x22')]=_0x2b36a8[_0x0640('0x22')];this[_0x0640('0x23')]='';this['originatecalleridname']='';}Action[_0x0640('0x24')][_0x0640('0x25')]=function(){return util[_0x0640('0x1d')](_0x0640('0x26'),this[_0x0640('0x5')],this['voiceQueue'][_0x0640('0x27')]>0x0?this[_0x0640('0xa')]['substring'](this['voiceQueue']['dialCutDigit']):this[_0x0640('0xa')]);};Action[_0x0640('0x24')][_0x0640('0x28')]=function(){return this[_0x0640('0xb')];};module[_0x0640('0x29')]=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 242d246..d649353 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 _0x79b4=['countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countmachineretry','countnosuchnumberretry','countdropretry'];(function(_0x3d9631,_0xf02284){var _0x3ff3f5=function(_0xb511a1){while(--_0xb511a1){_0x3d9631['push'](_0x3d9631['shift']());}};_0x3ff3f5(++_0xf02284);}(_0x79b4,0x1de));var _0x479b=function(_0x25eacb,_0x37dd8c){_0x25eacb=_0x25eacb-0x0;var _0x2d0787=_0x79b4[_0x25eacb];return _0x2d0787;};'use strict';var moment=require(_0x479b('0x0'));var utils=require(_0x479b('0x1'));function AgentComplete(_0x2f0704,_0x9cb5bf){this[_0x479b('0x2')]=0x4;this[_0x479b('0x3')]=_0x479b('0x4');this[_0x479b('0x5')]=_0x2f0704[_0x479b('0x5')];this['type']=_0x2f0704[_0x479b('0x6')];this[_0x479b('0x7')]=_0x2f0704[_0x479b('0x6')]===_0x479b('0x8')?_0x479b('0x9'):_0x2f0704[_0x479b('0x6')];this['countbusyretry']=_0x2f0704['countbusyretry'];this[_0x479b('0xa')]=_0x2f0704[_0x479b('0xa')];this[_0x479b('0xb')]=_0x2f0704[_0x479b('0xb')];this[_0x479b('0xc')]=_0x2f0704[_0x479b('0xd')]+_0x2f0704[_0x479b('0xa')]+_0x2f0704[_0x479b('0xb')]+_0x2f0704['countnosuchnumberretry']+_0x2f0704['countdropretry']+_0x2f0704['countabandonedretry']+_0x2f0704[_0x479b('0xe')]+_0x2f0704['countagentrejectretry'];this[_0x479b('0xf')]=_0x2f0704[_0x479b('0xf')];this[_0x479b('0x10')]=_0x2f0704[_0x479b('0x10')];this[_0x479b('0x11')]=_0x2f0704[_0x479b('0x11')];this['countmachineretry']=_0x2f0704[_0x479b('0xe')];this['countagentrejectretry']=_0x2f0704[_0x479b('0x12')];this[_0x479b('0x13')]=_0x9cb5bf[_0x479b('0x13')];this[_0x479b('0x14')]=_0x2f0704['name'];this[_0x479b('0x15')]=_0x2f0704['number'];this['starttime']=_0x2f0704[_0x479b('0x16')];this[_0x479b('0x17')]=_0x2f0704[_0x479b('0x17')];this[_0x479b('0x18')]=_0x2f0704[_0x479b('0x18')];this[_0x479b('0x19')]=moment()[_0x479b('0x1a')](_0x479b('0x1b'));this[_0x479b('0x1c')]=utils['getSeconds'](_0x2f0704[_0x479b('0x17')],_0x2f0704[_0x479b('0x16')]);this[_0x479b('0x1d')]=utils[_0x479b('0x1e')](_0x2f0704['answertime'],_0x2f0704[_0x479b('0x17')]);this['talktime']=utils[_0x479b('0x1e')](this[_0x479b('0x19')],_0x2f0704[_0x479b('0x18')]);this[_0x479b('0x9')]=_0x9cb5bf[_0x479b('0x9')];this[_0x479b('0x1f')]=_0x9cb5bf[_0x479b('0x1f')];this[_0x479b('0x20')]=_0x9cb5bf['reason'];this[_0x479b('0x21')]=_0x2f0704[_0x479b('0x21')];this[_0x479b('0x22')]=_0x2f0704[_0x479b('0x22')];this[_0x479b('0x23')]=_0x2f0704[_0x479b('0x23')];this['recallme']=_0x2f0704[_0x479b('0x24')];this[_0x479b('0x25')]=_0x2f0704[_0x479b('0x25')];this[_0x479b('0x26')]=_0x2f0704[_0x479b('0x26')];this[_0x479b('0x27')]=_0x2f0704[_0x479b('0x27')];this['VoiceQueueId']=_0x2f0704[_0x479b('0x28')];this[_0x479b('0x29')]=_0x2f0704['CampaignId'];this['originatecalleridnum']=_0x2f0704[_0x479b('0x2a')]||'';this[_0x479b('0x2b')]=_0x2f0704[_0x479b('0x2b')]||'';this['agiafterat']=_0x2f0704['agiafterat'];}module[_0x479b('0x2c')]=AgentComplete; \ No newline at end of file +var _0x6197=['uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','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','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x5416bc,_0x1c3a48){var _0x57b1de=function(_0xa9bfaa){while(--_0xa9bfaa){_0x5416bc['push'](_0x5416bc['shift']());}};_0x57b1de(++_0x1c3a48);}(_0x6197,0x7a));var _0x7619=function(_0xce7933,_0x4bd6e6){_0xce7933=_0xce7933-0x0;var _0x247ab5=_0x6197[_0xce7933];return _0x247ab5;};'use strict';var moment=require(_0x7619('0x0'));var utils=require(_0x7619('0x1'));function AgentComplete(_0x2ff9eb,_0x55dd8d){this[_0x7619('0x2')]=0x4;this[_0x7619('0x3')]=_0x7619('0x4');this[_0x7619('0x5')]=_0x2ff9eb['scheduledat'];this[_0x7619('0x6')]=_0x2ff9eb[_0x7619('0x6')];this[_0x7619('0x7')]=_0x2ff9eb[_0x7619('0x6')]===_0x7619('0x8')?_0x7619('0x9'):_0x2ff9eb[_0x7619('0x6')];this[_0x7619('0xa')]=_0x2ff9eb['countbusyretry'];this[_0x7619('0xb')]=_0x2ff9eb[_0x7619('0xb')];this[_0x7619('0xc')]=_0x2ff9eb[_0x7619('0xc')];this[_0x7619('0xd')]=_0x2ff9eb[_0x7619('0xa')]+_0x2ff9eb[_0x7619('0xb')]+_0x2ff9eb[_0x7619('0xc')]+_0x2ff9eb[_0x7619('0xe')]+_0x2ff9eb['countdropretry']+_0x2ff9eb[_0x7619('0xf')]+_0x2ff9eb[_0x7619('0x10')]+_0x2ff9eb[_0x7619('0x11')];this['countnosuchnumberretry']=_0x2ff9eb['countnosuchnumberretry'];this[_0x7619('0x12')]=_0x2ff9eb[_0x7619('0x12')];this['countabandonedretry']=_0x2ff9eb[_0x7619('0xf')];this[_0x7619('0x10')]=_0x2ff9eb[_0x7619('0x10')];this[_0x7619('0x11')]=_0x2ff9eb[_0x7619('0x11')];this['uniqueid']=_0x55dd8d[_0x7619('0x13')];this['calleridname']=_0x2ff9eb[_0x7619('0x14')];this[_0x7619('0x15')]=_0x2ff9eb[_0x7619('0x16')];this[_0x7619('0x17')]=_0x2ff9eb[_0x7619('0x17')];this[_0x7619('0x18')]=_0x2ff9eb['responsetime'];this[_0x7619('0x19')]=_0x2ff9eb['answertime'];this[_0x7619('0x1a')]=moment()[_0x7619('0x1b')](_0x7619('0x1c'));this[_0x7619('0x1d')]=utils[_0x7619('0x1e')](_0x2ff9eb['responsetime'],_0x2ff9eb[_0x7619('0x17')]);this[_0x7619('0x1f')]=utils[_0x7619('0x1e')](_0x2ff9eb[_0x7619('0x19')],_0x2ff9eb[_0x7619('0x18')]);this[_0x7619('0x20')]=utils[_0x7619('0x1e')](this[_0x7619('0x1a')],_0x2ff9eb[_0x7619('0x19')]);this[_0x7619('0x9')]=_0x55dd8d[_0x7619('0x9')];this[_0x7619('0x21')]=_0x55dd8d[_0x7619('0x21')];this[_0x7619('0x22')]=_0x55dd8d[_0x7619('0x22')];this['callback']=_0x2ff9eb['callback'];this[_0x7619('0x23')]=_0x2ff9eb[_0x7619('0x23')];this['callbackat']=_0x2ff9eb[_0x7619('0x24')];this[_0x7619('0x25')]=_0x2ff9eb[_0x7619('0x25')];this['ContactId']=_0x2ff9eb[_0x7619('0x26')];this[_0x7619('0x27')]=_0x2ff9eb['ListId'];this['UserId']=_0x2ff9eb[_0x7619('0x28')];this[_0x7619('0x29')]=_0x2ff9eb['VoiceQueueId'];this[_0x7619('0x2a')]=_0x2ff9eb[_0x7619('0x2a')];this[_0x7619('0x2b')]=_0x2ff9eb[_0x7619('0x2b')]||'';this[_0x7619('0x2c')]=_0x2ff9eb['originatecalleridname']||'';this[_0x7619('0x2d')]=_0x2ff9eb[_0x7619('0x2d')];}module[_0x7619('0x2e')]=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 7427d46..fb6e7d8 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 _0x230d=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x230d,0x105));var _0xd230=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x230d[_0xfae23b];return _0x200640;};'use strict';function Final(_0x372486){this[_0xd230('0x0')]=_0x372486[_0xd230('0x0')];this[_0xd230('0x1')]=_0x372486[_0xd230('0x1')];this[_0xd230('0x2')]=_0x372486[_0xd230('0x2')];this['campaigntype']=_0x372486[_0xd230('0x2')]==='outbound'?_0xd230('0x3'):_0x372486['type'];this[_0xd230('0x4')]=_0x372486[_0xd230('0x4')];this['countcongestionretry']=_0x372486[_0xd230('0x5')];this[_0xd230('0x6')]=_0x372486['countnoanswerretry'];this['countglobal']=_0x372486[_0xd230('0x4')]+_0x372486[_0xd230('0x5')]+_0x372486['countnoanswerretry']+_0x372486[_0xd230('0x7')]+_0x372486['countdropretry']+_0x372486[_0xd230('0x8')]+_0x372486[_0xd230('0x9')]+_0x372486['countagentrejectretry'];this[_0xd230('0x7')]=_0x372486[_0xd230('0x7')];this[_0xd230('0xa')]=_0x372486[_0xd230('0xa')];this[_0xd230('0x8')]=_0x372486['countabandonedretry'];this[_0xd230('0x9')]=_0x372486[_0xd230('0x9')];this['countagentrejectretry']=_0x372486[_0xd230('0xb')];this['queue']=_0x372486[_0xd230('0x3')];this[_0xd230('0xc')]=_0x372486[_0xd230('0xc')];this[_0xd230('0xd')]=_0x372486[_0xd230('0xd')];this['starttime']=_0x372486['starttime'];this[_0xd230('0xe')]=_0x372486[_0xd230('0xe')];this[_0xd230('0xf')]=_0x372486['responsetime'];this[_0xd230('0x10')]=_0x372486['ringtime']||0x0;this[_0xd230('0x11')]=_0x372486[_0xd230('0x11')]||0x0;this['talktime']=_0x372486[_0xd230('0x12')]||0x0;this[_0xd230('0x13')]=_0x372486[_0xd230('0x13')];this[_0xd230('0x14')]=_0x372486[_0xd230('0x14')];this[_0xd230('0x15')]=_0x372486[_0xd230('0x15')];this[_0xd230('0x16')]=_0x372486['recallme'];this[_0xd230('0x17')]=_0x372486[_0xd230('0x17')];this[_0xd230('0x18')]=_0x372486[_0xd230('0x18')];this[_0xd230('0x19')]=_0x372486[_0xd230('0x19')];this[_0xd230('0x1a')]=_0x372486[_0xd230('0x1a')];this[_0xd230('0x1b')]=_0x372486[_0xd230('0x1b')];this[_0xd230('0x1c')]=_0x372486[_0xd230('0x1c')]||'';this[_0xd230('0x1d')]=_0x372486[_0xd230('0x1d')]||'';this[_0xd230('0x1e')]=_0x372486[_0xd230('0x1e')];this['statedesc']=_0x372486[_0xd230('0x1f')];}module['exports']=Final; \ No newline at end of file +var _0xc943=['countdropretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0xc943,0x1b6));var _0x3c94=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0xc943[_0x4a45b4];return _0x1a99c9;};'use strict';function Final(_0x5f5357){this[_0x3c94('0x0')]=_0x5f5357['uniqueid'];this[_0x3c94('0x1')]=_0x5f5357[_0x3c94('0x1')];this[_0x3c94('0x2')]=_0x5f5357['type'];this['campaigntype']=_0x5f5357[_0x3c94('0x2')]===_0x3c94('0x3')?_0x3c94('0x4'):_0x5f5357[_0x3c94('0x2')];this[_0x3c94('0x5')]=_0x5f5357['countbusyretry'];this['countcongestionretry']=_0x5f5357['countcongestionretry'];this[_0x3c94('0x6')]=_0x5f5357[_0x3c94('0x6')];this[_0x3c94('0x7')]=_0x5f5357[_0x3c94('0x5')]+_0x5f5357[_0x3c94('0x8')]+_0x5f5357[_0x3c94('0x6')]+_0x5f5357[_0x3c94('0x9')]+_0x5f5357[_0x3c94('0xa')]+_0x5f5357[_0x3c94('0xb')]+_0x5f5357[_0x3c94('0xc')]+_0x5f5357['countagentrejectretry'];this[_0x3c94('0x9')]=_0x5f5357[_0x3c94('0x9')];this[_0x3c94('0xa')]=_0x5f5357['countdropretry'];this[_0x3c94('0xb')]=_0x5f5357[_0x3c94('0xb')];this[_0x3c94('0xc')]=_0x5f5357[_0x3c94('0xc')];this['countagentrejectretry']=_0x5f5357['countagentrejectretry'];this['queue']=_0x5f5357[_0x3c94('0x4')];this[_0x3c94('0xd')]=_0x5f5357[_0x3c94('0xd')];this[_0x3c94('0xe')]=_0x5f5357[_0x3c94('0xe')];this[_0x3c94('0xf')]=_0x5f5357['starttime'];this[_0x3c94('0x10')]=_0x5f5357[_0x3c94('0x10')];this[_0x3c94('0x11')]=_0x5f5357[_0x3c94('0x10')];this[_0x3c94('0x12')]=_0x5f5357['ringtime']||0x0;this['holdtime']=_0x5f5357[_0x3c94('0x13')]||0x0;this[_0x3c94('0x14')]=_0x5f5357[_0x3c94('0x14')]||0x0;this[_0x3c94('0x15')]=_0x5f5357[_0x3c94('0x15')];this[_0x3c94('0x16')]=_0x5f5357[_0x3c94('0x16')];this['callbackat']=_0x5f5357['callbackat'];this[_0x3c94('0x17')]=_0x5f5357[_0x3c94('0x17')];this[_0x3c94('0x18')]=_0x5f5357['ContactId'];this[_0x3c94('0x19')]=_0x5f5357[_0x3c94('0x19')];this['UserId']=_0x5f5357['UserId'];this['VoiceQueueId']=_0x5f5357['VoiceQueueId'];this[_0x3c94('0x1a')]=_0x5f5357[_0x3c94('0x1a')];this[_0x3c94('0x1b')]=_0x5f5357[_0x3c94('0x1b')]||'';this[_0x3c94('0x1c')]=_0x5f5357[_0x3c94('0x1c')]||'';this['state']=_0x5f5357[_0x3c94('0x1d')];this[_0x3c94('0x1e')]=_0x5f5357[_0x3c94('0x1e')];}module[_0x3c94('0x1f')]=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 ea371b2..712b908 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 _0x79d3=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','../utils','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x79d3,0x17b));var _0x379d=function(_0x554db0,_0x4eda6b){_0x554db0=_0x554db0-0x0;var _0x2ac209=_0x79d3[_0x554db0];return _0x2ac209;};'use strict';var moment=require('moment');var utils=require(_0x379d('0x0'));function Hangup(_0xe31eaf,_0x419fcb){this['state']=0x4;this['statedesc']=_0x379d('0x1');this[_0x379d('0x2')]=_0xe31eaf[_0x379d('0x2')];this[_0x379d('0x3')]=_0xe31eaf['type'];this[_0x379d('0x4')]=_0xe31eaf['type']===_0x379d('0x5')?_0x379d('0x6'):_0xe31eaf[_0x379d('0x3')];this[_0x379d('0x7')]=_0xe31eaf[_0x379d('0x7')]||![];this[_0x379d('0x8')]=_0xe31eaf[_0x379d('0x8')];this['countcongestionretry']=_0xe31eaf[_0x379d('0x9')];this['countnoanswerretry']=_0xe31eaf[_0x379d('0xa')];this['countglobal']=_0xe31eaf['countbusyretry']+_0xe31eaf[_0x379d('0x9')]+_0xe31eaf[_0x379d('0xa')]+_0xe31eaf[_0x379d('0xb')]+_0xe31eaf[_0x379d('0xc')]+_0xe31eaf[_0x379d('0xd')]+_0xe31eaf[_0x379d('0xe')]+_0xe31eaf[_0x379d('0xf')];this[_0x379d('0xb')]=_0xe31eaf['countnosuchnumberretry'];this['countdropretry']=_0xe31eaf[_0x379d('0xc')];this[_0x379d('0xd')]=_0xe31eaf[_0x379d('0xd')];this[_0x379d('0xe')]=_0xe31eaf['countmachineretry'];this[_0x379d('0xf')]=_0xe31eaf['countagentrejectretry'];this['uniqueid']=_0x419fcb[_0x379d('0x10')];this['calleridname']=_0xe31eaf[_0x379d('0x11')];this['calleridnum']=_0xe31eaf[_0x379d('0x12')];this[_0x379d('0x13')]=_0xe31eaf[_0x379d('0x13')];this[_0x379d('0x14')]=_0xe31eaf[_0x379d('0x14')];this['endtime']=moment()[_0x379d('0x15')](_0x379d('0x16'));this[_0x379d('0x17')]=utils[_0x379d('0x18')](_0xe31eaf[_0x379d('0x14')],_0xe31eaf['starttime']);this[_0x379d('0x19')]=0x0;this[_0x379d('0x1a')]=utils['getSeconds'](this[_0x379d('0x1b')],_0xe31eaf['responsetime']);this[_0x379d('0x6')]=_0xe31eaf[_0x379d('0x6')];this[_0x379d('0x1c')]=_0x379d('0x1d');this['reason']=_0x419fcb['cause-txt'];this[_0x379d('0x1e')]=_0xe31eaf['callback'];this[_0x379d('0x1f')]=_0xe31eaf[_0x379d('0x1f')];this[_0x379d('0x20')]=_0xe31eaf['callbackat'];this[_0x379d('0x21')]=_0xe31eaf[_0x379d('0x21')];this[_0x379d('0x22')]=_0xe31eaf['ContactId'];this[_0x379d('0x23')]=_0xe31eaf[_0x379d('0x23')];this[_0x379d('0x24')]=_0xe31eaf[_0x379d('0x24')];this[_0x379d('0x25')]=_0xe31eaf[_0x379d('0x25')];this[_0x379d('0x26')]=_0xe31eaf[_0x379d('0x26')];}module['exports']=Hangup; \ No newline at end of file +var _0xea6a=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','starttime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','talktime','endtime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xea6a,0x73));var _0xaea6=function(_0x4e9b29,_0x401fad){_0x4e9b29=_0x4e9b29-0x0;var _0x30db38=_0xea6a[_0x4e9b29];return _0x30db38;};'use strict';var moment=require(_0xaea6('0x0'));var utils=require('../utils');function Hangup(_0x32f0f7,_0x10a492){this[_0xaea6('0x1')]=0x4;this[_0xaea6('0x2')]=_0xaea6('0x3');this[_0xaea6('0x4')]=_0x32f0f7[_0xaea6('0x4')];this[_0xaea6('0x5')]=_0x32f0f7[_0xaea6('0x5')];this[_0xaea6('0x6')]=_0x32f0f7[_0xaea6('0x5')]===_0xaea6('0x7')?_0xaea6('0x8'):_0x32f0f7[_0xaea6('0x5')];this[_0xaea6('0x9')]=_0x32f0f7[_0xaea6('0x9')]||![];this[_0xaea6('0xa')]=_0x32f0f7[_0xaea6('0xa')];this[_0xaea6('0xb')]=_0x32f0f7[_0xaea6('0xb')];this['countnoanswerretry']=_0x32f0f7[_0xaea6('0xc')];this[_0xaea6('0xd')]=_0x32f0f7[_0xaea6('0xa')]+_0x32f0f7[_0xaea6('0xb')]+_0x32f0f7['countnoanswerretry']+_0x32f0f7[_0xaea6('0xe')]+_0x32f0f7[_0xaea6('0xf')]+_0x32f0f7[_0xaea6('0x10')]+_0x32f0f7['countmachineretry']+_0x32f0f7[_0xaea6('0x11')];this[_0xaea6('0xe')]=_0x32f0f7[_0xaea6('0xe')];this['countdropretry']=_0x32f0f7[_0xaea6('0xf')];this[_0xaea6('0x10')]=_0x32f0f7[_0xaea6('0x10')];this[_0xaea6('0x12')]=_0x32f0f7['countmachineretry'];this['countagentrejectretry']=_0x32f0f7[_0xaea6('0x11')];this[_0xaea6('0x13')]=_0x10a492[_0xaea6('0x13')];this['calleridname']=_0x32f0f7[_0xaea6('0x14')];this[_0xaea6('0x15')]=_0x32f0f7['number'];this[_0xaea6('0x16')]=_0x32f0f7[_0xaea6('0x16')];this['responsetime']=_0x32f0f7['responsetime'];this['endtime']=moment()[_0xaea6('0x17')](_0xaea6('0x18'));this[_0xaea6('0x19')]=utils[_0xaea6('0x1a')](_0x32f0f7[_0xaea6('0x1b')],_0x32f0f7['starttime']);this[_0xaea6('0x1c')]=0x0;this[_0xaea6('0x1d')]=utils[_0xaea6('0x1a')](this[_0xaea6('0x1e')],_0x32f0f7[_0xaea6('0x1b')]);this['queue']=_0x32f0f7['queue'];this['membername']=_0xaea6('0x1f');this[_0xaea6('0x20')]=_0x10a492['cause-txt'];this['callback']=_0x32f0f7[_0xaea6('0x21')];this[_0xaea6('0x22')]=_0x32f0f7[_0xaea6('0x22')];this['callbackat']=_0x32f0f7[_0xaea6('0x23')];this[_0xaea6('0x24')]=_0x32f0f7[_0xaea6('0x24')];this[_0xaea6('0x25')]=_0x32f0f7[_0xaea6('0x25')];this[_0xaea6('0x26')]=_0x32f0f7[_0xaea6('0x26')];this[_0xaea6('0x27')]=_0x32f0f7['UserId'];this[_0xaea6('0x28')]=_0x32f0f7[_0xaea6('0x28')];this[_0xaea6('0x29')]=_0x32f0f7[_0xaea6('0x29')];}module[_0xaea6('0x2a')]=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 144674b..37404cd 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 _0x069f=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback'];(function(_0x34f273,_0x37a8c3){var _0x1f2544=function(_0x1b9a6b){while(--_0x1b9a6b){_0x34f273['push'](_0x34f273['shift']());}};_0x1f2544(++_0x37a8c3);}(_0x069f,0x1b9));var _0xf069=function(_0x3657d9,_0x3de284){_0x3657d9=_0x3657d9-0x0;var _0x4e5b18=_0x069f[_0x3657d9];return _0x4e5b18;};'use strict';var utils=require(_0xf069('0x0'));function History(_0x46c166){this[_0xf069('0x1')]=_0x46c166['uniqueid'];this[_0xf069('0x2')]=_0x46c166[_0xf069('0x2')]||undefined;this[_0xf069('0x3')]=_0x46c166[_0xf069('0x3')];this[_0xf069('0x4')]=_0x46c166[_0xf069('0x3')]===_0xf069('0x5')?_0xf069('0x6'):_0x46c166[_0xf069('0x3')];this[_0xf069('0x7')]=_0x46c166[_0xf069('0x7')];this[_0xf069('0x8')]=_0x46c166[_0xf069('0x8')];this[_0xf069('0x9')]=_0x46c166[_0xf069('0x9')];this[_0xf069('0xa')]=_0x46c166[_0xf069('0x7')]+_0x46c166['countcongestionretry']+_0x46c166[_0xf069('0x9')]+_0x46c166['countnosuchnumberretry']+_0x46c166[_0xf069('0xb')]+_0x46c166[_0xf069('0xc')]+_0x46c166[_0xf069('0xd')]+_0x46c166[_0xf069('0xe')];this[_0xf069('0xf')]=_0x46c166[_0xf069('0xf')];this[_0xf069('0xb')]=_0x46c166['countdropretry'];this[_0xf069('0xc')]=_0x46c166[_0xf069('0xc')];this[_0xf069('0xd')]=_0x46c166['countmachineretry'];this['countagentrejectretry']=_0x46c166['countagentrejectretry'];this['queue']=_0x46c166['queue'];this['calleridname']=_0x46c166[_0xf069('0x10')];this[_0xf069('0x11')]=_0x46c166[_0xf069('0x12')];this[_0xf069('0x13')]=_0x46c166[_0xf069('0x13')];this['responsetime']=_0x46c166[_0xf069('0x14')];this[_0xf069('0x15')]=_0x46c166[_0xf069('0x14')];this[_0xf069('0x16')]=utils[_0xf069('0x17')](_0x46c166[_0xf069('0x14')],_0x46c166[_0xf069('0x13')]);this[_0xf069('0x18')]=0x0;this[_0xf069('0x19')]=0x0;this['callback']=_0x46c166[_0xf069('0x1a')];this['callbackuniqueid']=_0x46c166['callbackuniqueid'];this[_0xf069('0x1b')]=_0x46c166[_0xf069('0x1b')];this[_0xf069('0x1c')]=_0x46c166['recallme'];this[_0xf069('0x1d')]=_0x46c166[_0xf069('0x1d')];this[_0xf069('0x1e')]=_0x46c166['ListId'];this['UserId']=_0x46c166[_0xf069('0x1f')];this[_0xf069('0x20')]=_0x46c166[_0xf069('0x20')];this[_0xf069('0x21')]=_0x46c166['CampaignId'];this['originatecalleridnum']=_0x46c166[_0xf069('0x22')]||'';this[_0xf069('0x23')]=_0x46c166['originatecalleridname']||'';this[_0xf069('0x24')]=_0x46c166[_0xf069('0x24')];this[_0xf069('0x25')]=_0x46c166[_0xf069('0x25')];}module[_0xf069('0x26')]=History; \ No newline at end of file +var _0xa57c=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','number','starttime','responsetime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type'];(function(_0x129350,_0x39baaf){var _0x51d20c=function(_0x36f0b7){while(--_0x36f0b7){_0x129350['push'](_0x129350['shift']());}};_0x51d20c(++_0x39baaf);}(_0xa57c,0x1aa));var _0xca57=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa57c[_0x4a53d];return _0x27410e;};'use strict';var utils=require('../utils');function History(_0xe81906){this[_0xca57('0x0')]=_0xe81906['uniqueid'];this[_0xca57('0x1')]=_0xe81906['scheduledat']||undefined;this['type']=_0xe81906[_0xca57('0x2')];this[_0xca57('0x3')]=_0xe81906['type']===_0xca57('0x4')?_0xca57('0x5'):_0xe81906['type'];this['countbusyretry']=_0xe81906[_0xca57('0x6')];this[_0xca57('0x7')]=_0xe81906[_0xca57('0x7')];this[_0xca57('0x8')]=_0xe81906[_0xca57('0x8')];this[_0xca57('0x9')]=_0xe81906[_0xca57('0x6')]+_0xe81906['countcongestionretry']+_0xe81906[_0xca57('0x8')]+_0xe81906[_0xca57('0xa')]+_0xe81906[_0xca57('0xb')]+_0xe81906['countabandonedretry']+_0xe81906[_0xca57('0xc')]+_0xe81906[_0xca57('0xd')];this[_0xca57('0xa')]=_0xe81906[_0xca57('0xa')];this[_0xca57('0xb')]=_0xe81906[_0xca57('0xb')];this[_0xca57('0xe')]=_0xe81906[_0xca57('0xe')];this[_0xca57('0xc')]=_0xe81906['countmachineretry'];this[_0xca57('0xd')]=_0xe81906[_0xca57('0xd')];this['queue']=_0xe81906['queue'];this[_0xca57('0xf')]=_0xe81906['name'];this['calleridnum']=_0xe81906[_0xca57('0x10')];this[_0xca57('0x11')]=_0xe81906[_0xca57('0x11')];this['responsetime']=_0xe81906[_0xca57('0x12')];this['endtime']=_0xe81906[_0xca57('0x12')];this['ringtime']=utils['getSeconds'](_0xe81906[_0xca57('0x12')],_0xe81906[_0xca57('0x11')]);this[_0xca57('0x13')]=0x0;this['talktime']=0x0;this[_0xca57('0x14')]=_0xe81906[_0xca57('0x14')];this['callbackuniqueid']=_0xe81906[_0xca57('0x15')];this[_0xca57('0x16')]=_0xe81906[_0xca57('0x16')];this[_0xca57('0x17')]=_0xe81906[_0xca57('0x17')];this[_0xca57('0x18')]=_0xe81906[_0xca57('0x18')];this[_0xca57('0x19')]=_0xe81906[_0xca57('0x19')];this['UserId']=_0xe81906['UserId'];this[_0xca57('0x1a')]=_0xe81906[_0xca57('0x1a')];this[_0xca57('0x1b')]=_0xe81906[_0xca57('0x1b')];this[_0xca57('0x1c')]=_0xe81906[_0xca57('0x1c')]||'';this[_0xca57('0x1d')]=_0xe81906[_0xca57('0x1d')]||'';this[_0xca57('0x1e')]=_0xe81906[_0xca57('0x1e')];this[_0xca57('0x1f')]=_0xe81906[_0xca57('0x1f')];}module[_0xca57('0x20')]=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 ff84df5..2f54a96 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 _0xf992=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId'];(function(_0x353d36,_0x5a8444){var _0x4f77ea=function(_0x270646){while(--_0x270646){_0x353d36['push'](_0x353d36['shift']());}};_0x4f77ea(++_0x5a8444);}(_0xf992,0x125));var _0x2f99=function(_0x3582dc,_0x1eca15){_0x3582dc=_0x3582dc-0x0;var _0x22c528=_0xf992[_0x3582dc];return _0x22c528;};'use strict';var utils=require(_0x2f99('0x0'));function QueueCallerAbandon(_0x529153,_0x11fdd8){this[_0x2f99('0x1')]=_0x529153['scheduledat'];this[_0x2f99('0x2')]=_0x529153[_0x2f99('0x2')];this['campaigntype']=_0x529153['type']===_0x2f99('0x3')?_0x2f99('0x4'):_0x529153[_0x2f99('0x2')];this[_0x2f99('0x5')]=_0x529153['countbusyretry'];this[_0x2f99('0x6')]=_0x529153[_0x2f99('0x6')];this[_0x2f99('0x7')]=_0x529153[_0x2f99('0x7')];this[_0x2f99('0x8')]=_0x529153[_0x2f99('0x5')]+_0x529153['countcongestionretry']+_0x529153['countnoanswerretry']+_0x529153[_0x2f99('0x9')]+_0x529153[_0x2f99('0xa')]+_0x529153[_0x2f99('0xb')]+_0x529153[_0x2f99('0xc')]+_0x529153['countagentrejectretry'];this[_0x2f99('0x9')]=_0x529153[_0x2f99('0x9')];this[_0x2f99('0xa')]=_0x529153['countdropretry'];this['countabandonedretry']=_0x529153[_0x2f99('0xb')];this[_0x2f99('0xc')]=_0x529153['countmachineretry'];this['countagentrejectretry']=_0x529153[_0x2f99('0xd')];this[_0x2f99('0xe')]=_0x11fdd8[_0x2f99('0xe')];this['calleridname']=_0x529153[_0x2f99('0xf')];this[_0x2f99('0x10')]=_0x529153[_0x2f99('0x11')];this[_0x2f99('0x12')]=_0x529153[_0x2f99('0x12')];this[_0x2f99('0x13')]=_0x529153[_0x2f99('0x13')];this[_0x2f99('0x14')]=_0x529153['droptime'];this[_0x2f99('0x15')]=_0x529153[_0x2f99('0x15')];this[_0x2f99('0x16')]=this[_0x2f99('0x14')];this['ringtime']=utils['getSeconds'](_0x529153[_0x2f99('0x13')],_0x529153[_0x2f99('0x12')]);this[_0x2f99('0x17')]=utils[_0x2f99('0x18')](this[_0x2f99('0x14')],_0x529153[_0x2f99('0x13')]);this[_0x2f99('0x19')]=0x0;this[_0x2f99('0x4')]=_0x11fdd8[_0x2f99('0x4')];this[_0x2f99('0x1a')]=_0x11fdd8['connectedlinename'];this[_0x2f99('0x1b')]=_0x11fdd8[_0x2f99('0x1b')];this[_0x2f99('0x1c')]=_0x529153['callback'];this[_0x2f99('0x1d')]=_0x529153[_0x2f99('0x1d')];this['callbackat']=_0x529153[_0x2f99('0x1e')];this[_0x2f99('0x1f')]=_0x529153[_0x2f99('0x1f')];this[_0x2f99('0x20')]=_0x529153[_0x2f99('0x20')];this['ListId']=_0x529153['ListId'];this[_0x2f99('0x21')]=_0x529153[_0x2f99('0x21')];this[_0x2f99('0x22')]=_0x529153[_0x2f99('0x22')];this['CampaignId']=_0x529153[_0x2f99('0x23')];this[_0x2f99('0x24')]=_0x529153['originatecalleridnum']||'';this[_0x2f99('0x25')]=_0x529153[_0x2f99('0x25')]||'';this['agiafterat']=_0x529153[_0x2f99('0x26')];this[_0x2f99('0x27')]=_0x529153[_0x2f99('0x27')];this[_0x2f99('0x28')]=_0x529153[_0x2f99('0x28')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x4e6f=['originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x584486,_0x1b3bb6){var _0x399d0b=function(_0x208827){while(--_0x208827){_0x584486['push'](_0x584486['shift']());}};_0x399d0b(++_0x1b3bb6);}(_0x4e6f,0x1ea));var _0xf4e6=function(_0x3e5d81,_0x2f4f73){_0x3e5d81=_0x3e5d81-0x0;var _0x23d348=_0x4e6f[_0x3e5d81];return _0x23d348;};'use strict';var utils=require(_0xf4e6('0x0'));function QueueCallerAbandon(_0x4cc8ce,_0x288659){this['scheduledat']=_0x4cc8ce['scheduledat'];this['type']=_0x4cc8ce[_0xf4e6('0x1')];this[_0xf4e6('0x2')]=_0x4cc8ce[_0xf4e6('0x1')]===_0xf4e6('0x3')?_0xf4e6('0x4'):_0x4cc8ce[_0xf4e6('0x1')];this[_0xf4e6('0x5')]=_0x4cc8ce[_0xf4e6('0x5')];this[_0xf4e6('0x6')]=_0x4cc8ce[_0xf4e6('0x6')];this['countnoanswerretry']=_0x4cc8ce['countnoanswerretry'];this[_0xf4e6('0x7')]=_0x4cc8ce['countbusyretry']+_0x4cc8ce[_0xf4e6('0x6')]+_0x4cc8ce['countnoanswerretry']+_0x4cc8ce[_0xf4e6('0x8')]+_0x4cc8ce['countdropretry']+_0x4cc8ce['countabandonedretry']+_0x4cc8ce['countmachineretry']+_0x4cc8ce[_0xf4e6('0x9')];this[_0xf4e6('0x8')]=_0x4cc8ce[_0xf4e6('0x8')];this[_0xf4e6('0xa')]=_0x4cc8ce[_0xf4e6('0xa')];this[_0xf4e6('0xb')]=_0x4cc8ce[_0xf4e6('0xb')];this['countmachineretry']=_0x4cc8ce[_0xf4e6('0xc')];this[_0xf4e6('0x9')]=_0x4cc8ce[_0xf4e6('0x9')];this[_0xf4e6('0xd')]=_0x288659['uniqueid'];this[_0xf4e6('0xe')]=_0x4cc8ce[_0xf4e6('0xf')];this[_0xf4e6('0x10')]=_0x4cc8ce[_0xf4e6('0x11')];this[_0xf4e6('0x12')]=_0x4cc8ce[_0xf4e6('0x12')];this['responsetime']=_0x4cc8ce[_0xf4e6('0x13')];this[_0xf4e6('0x14')]=_0x4cc8ce[_0xf4e6('0x14')];this[_0xf4e6('0x15')]=_0x4cc8ce[_0xf4e6('0x15')];this[_0xf4e6('0x16')]=this[_0xf4e6('0x14')];this[_0xf4e6('0x17')]=utils[_0xf4e6('0x18')](_0x4cc8ce[_0xf4e6('0x13')],_0x4cc8ce[_0xf4e6('0x12')]);this[_0xf4e6('0x19')]=utils['getSeconds'](this['droptime'],_0x4cc8ce[_0xf4e6('0x13')]);this[_0xf4e6('0x1a')]=0x0;this[_0xf4e6('0x4')]=_0x288659[_0xf4e6('0x4')];this[_0xf4e6('0x1b')]=_0x288659[_0xf4e6('0x1c')];this['reason']=_0x288659[_0xf4e6('0x1d')];this['callback']=_0x4cc8ce[_0xf4e6('0x1e')];this[_0xf4e6('0x1f')]=_0x4cc8ce['callbackuniqueid'];this[_0xf4e6('0x20')]=_0x4cc8ce['callbackat'];this['recallme']=_0x4cc8ce['recallme'];this[_0xf4e6('0x21')]=_0x4cc8ce[_0xf4e6('0x21')];this[_0xf4e6('0x22')]=_0x4cc8ce[_0xf4e6('0x22')];this[_0xf4e6('0x23')]=_0x4cc8ce[_0xf4e6('0x23')];this['VoiceQueueId']=_0x4cc8ce[_0xf4e6('0x24')];this[_0xf4e6('0x25')]=_0x4cc8ce[_0xf4e6('0x25')];this['originatecalleridnum']=_0x4cc8ce[_0xf4e6('0x26')]||'';this[_0xf4e6('0x27')]=_0x4cc8ce['originatecalleridname']||'';this[_0xf4e6('0x28')]=_0x4cc8ce[_0xf4e6('0x28')];this['state']=_0x4cc8ce[_0xf4e6('0x29')];this['statedesc']=_0x4cc8ce[_0xf4e6('0x2a')];}module[_0xf4e6('0x2b')]=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 3e715d4..91651c2 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 _0x2675=['[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp'];(function(_0x20b126,_0x37f3dc){var _0xcc76c2=function(_0x1f5c88){while(--_0x1f5c88){_0x20b126['push'](_0x20b126['shift']());}};_0xcc76c2(++_0x37f3dc);}(_0x2675,0x75));var _0x5267=function(_0x49d94f,_0x3bf328){_0x49d94f=_0x49d94f-0x0;var _0x5d93a1=_0x2675[_0x49d94f];return _0x5d93a1;};'use strict';var util=require(_0x5267('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x5267('0x1'));var cmHopperBlack=require(_0x5267('0x2'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x4600fa){return util[_0x5267('0x3')](_0x4600fa,{'showHidden':![],'depth':null});}function getContactDialer(_0x4e2548,_0x328776,_0xf2b350){return cmHopper[_0x5267('0x4')](_0x4e2548['id'],_0x328776,_0xf2b350,_0x4e2548[_0x5267('0x5')])[_0x5267('0x6')](function(_0xc56cd5){_0x4e2548['temp']=0x0;logger[_0x5267('0x7')](_0x5267('0x8'),inspectError(_0xc56cd5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x799fcc,_0x5d6645){return cmHopper[_0x5267('0x9')](_0x799fcc['id'],_0x5d6645,_0x799fcc[_0x5267('0x5')])[_0x5267('0x6')](function(_0x534c2b){_0x799fcc[_0x5267('0xa')]=0x0;logger['error'](_0x5267('0xb'),inspectError(_0x534c2b));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x31ea34){return cmHopper[_0x5267('0xc')](_0x31ea34)[_0x5267('0x6')](function(_0x1f9be3){logger[_0x5267('0x7')](_0x5267('0xd'),inspectError(_0x1f9be3));});}exports[_0x5267('0xc')]=countReScheduled;function rescheduleContact(_0x36dc17){return cmHopper[_0x5267('0xe')](_0x36dc17)[_0x5267('0x6')](function(_0x16e5a7){logger[_0x5267('0x7')](_0x5267('0xf'),inspectError(_0x16e5a7));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x52e24e,_0xa593fb,_0x40d897){return cmHopper[_0x5267('0x10')](_0x52e24e,_0xa593fb,_0x40d897)[_0x5267('0x6')](function(_0x46b2c2){logger[_0x5267('0x7')](_0x5267('0x11'),inspectError(_0x46b2c2));});}exports[_0x5267('0x10')]=unlockContact;function moveContactManagedDialer(_0x15d81e){return cmHopper[_0x5267('0x12')](_0x15d81e)[_0x5267('0x6')](function(_0x1ab03){logger['error'](_0x5267('0x13'),inspectError(_0x1ab03));});}exports[_0x5267('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x5069e8){return cmHopperBlack[_0x5267('0x14')](_0x5069e8)['catch'](function(_0x1cf835){logger[_0x5267('0x7')](_0x5267('0x15'),inspectError(_0x1cf835));});}exports[_0x5267('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x5ca9c6){return cmHopperBlack['checkIsBlackListIvr'](_0x5ca9c6)[_0x5267('0x6')](function(_0x5aebdd){logger[_0x5267('0x7')](_0x5267('0x16'),inspectError(_0x5aebdd));});}exports[_0x5267('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x56dd95,_0x499f19,_0x5546e2){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x56dd95,_0x499f19,_0x5546e2)['catch'](function(_0x26c7f8){logger[_0x5267('0x7')](_0x5267('0x18'),inspectError(_0x26c7f8));});}exports[_0x5267('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x11c8ea,_0x40d1be,_0x126a97){return cmHopperAdditionalPhone[_0x5267('0x1a')](_0x11c8ea,_0x40d1be,_0x126a97)[_0x5267('0x6')](function(_0x59f112){logger['error'](_0x5267('0x1b'),inspectError(_0x59f112));});}exports[_0x5267('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x5abf95){return cmHopperHistory[_0x5267('0x1c')](_0x5abf95)['catch'](function(_0x4d7c2a){logger[_0x5267('0x7')](_0x5267('0x1d'),inspectError(_0x4d7c2a));});}exports[_0x5267('0x1c')]=avgHandleTime;function createHistory(_0x2d2ace){return cmHopperHistory[_0x5267('0x1e')](_0x2d2ace)['catch'](function(_0x5e87eb){logger[_0x5267('0x7')](_0x5267('0x1f'),inspectError(_0x5e87eb));});}exports[_0x5267('0x1e')]=createHistory; \ No newline at end of file +var _0xa456=['temp','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','catch'];(function(_0x5b4c10,_0x7f8fdc){var _0x47a997=function(_0x3504a1){while(--_0x3504a1){_0x5b4c10['push'](_0x5b4c10['shift']());}};_0x47a997(++_0x7f8fdc);}(_0xa456,0x142));var _0x6a45=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xa456[_0x1b6186];return _0x186121;};'use strict';var util=require(_0x6a45('0x0'));var logger=require(_0x6a45('0x1'))(_0x6a45('0x2'));var cmHopper=require(_0x6a45('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x6a45('0x4'));var cmHopperHistory=require(_0x6a45('0x5'));function inspectError(_0x3f7448){return util['inspect'](_0x3f7448,{'showHidden':![],'depth':null});}function getContactDialer(_0x1f0701,_0x40acad,_0x1e5882){return cmHopper[_0x6a45('0x6')](_0x1f0701['id'],_0x40acad,_0x1e5882,_0x1f0701['dialOrderByScheduledAt'])[_0x6a45('0x7')](function(_0x26bfc0){_0x1f0701[_0x6a45('0x8')]=0x0;logger[_0x6a45('0x9')](_0x6a45('0xa'),inspectError(_0x26bfc0));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x3a5c20,_0x517040){return cmHopper[_0x6a45('0xb')](_0x3a5c20['id'],_0x517040,_0x3a5c20[_0x6a45('0xc')])[_0x6a45('0x7')](function(_0x147679){_0x3a5c20[_0x6a45('0x8')]=0x0;logger['error']('[getContactDialerIvr]',inspectError(_0x147679));});}exports[_0x6a45('0xb')]=getContactDialerIvr;function countReScheduled(_0x465b59){return cmHopper['countReScheduled'](_0x465b59)['catch'](function(_0x511b92){logger[_0x6a45('0x9')](_0x6a45('0xd'),inspectError(_0x511b92));});}exports[_0x6a45('0xe')]=countReScheduled;function rescheduleContact(_0x3f01f6){return cmHopper[_0x6a45('0xf')](_0x3f01f6)['catch'](function(_0x563c3b){logger[_0x6a45('0x9')](_0x6a45('0x10'),inspectError(_0x563c3b));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x2c20db,_0x171176,_0x3fab82){return cmHopper[_0x6a45('0x11')](_0x2c20db,_0x171176,_0x3fab82)['catch'](function(_0x54507b){logger['error'](_0x6a45('0x12'),inspectError(_0x54507b));});}exports[_0x6a45('0x11')]=unlockContact;function moveContactManagedDialer(_0x360b7f){return cmHopper['moveContactManagedDialer'](_0x360b7f)[_0x6a45('0x7')](function(_0x102981){logger[_0x6a45('0x9')]('[moveContactManagedDialer]',inspectError(_0x102981));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x573453){return cmHopperBlack[_0x6a45('0x13')](_0x573453)[_0x6a45('0x7')](function(_0x5bdaef){logger[_0x6a45('0x9')](_0x6a45('0x14'),inspectError(_0x5bdaef));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4f7110){return cmHopperBlack[_0x6a45('0x15')](_0x4f7110)[_0x6a45('0x7')](function(_0x458b99){logger[_0x6a45('0x9')]('[checkIsBlackListIvr]',inspectError(_0x458b99));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3faae5,_0x59af4b,_0x11290c){return cmHopperAdditionalPhone[_0x6a45('0x16')](_0x3faae5,_0x59af4b,_0x11290c)[_0x6a45('0x7')](function(_0x3ad898){logger[_0x6a45('0x9')](_0x6a45('0x17'),inspectError(_0x3ad898));});}exports[_0x6a45('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x18a5b8,_0x1310d7,_0x46587a){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x18a5b8,_0x1310d7,_0x46587a)[_0x6a45('0x7')](function(_0x5a0389){logger[_0x6a45('0x9')](_0x6a45('0x18'),inspectError(_0x5a0389));});}exports[_0x6a45('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x2c7315){return cmHopperHistory[_0x6a45('0x1a')](_0x2c7315)['catch'](function(_0x2b8cc8){logger[_0x6a45('0x9')](_0x6a45('0x1b'),inspectError(_0x2b8cc8));});}exports[_0x6a45('0x1a')]=avgHandleTime;function createHistory(_0x8265d9){return cmHopperHistory[_0x6a45('0x1c')](_0x8265d9)[_0x6a45('0x7')](function(_0x313c13){logger['error'](_0x6a45('0x1d'),inspectError(_0x313c13));});}exports[_0x6a45('0x1c')]=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 a43c556..fc75613 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 _0x12ff=['extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','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','RECALLINQUEUE','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','match'];(function(_0x13bebc,_0x4851f4){var _0x34bc12=function(_0x1ac49c){while(--_0x1ac49c){_0x13bebc['push'](_0x13bebc['shift']());}};_0x34bc12(++_0x4851f4);}(_0x12ff,0x72));var _0xf12f=function(_0x581c60,_0x371c9c){_0x581c60=_0x581c60-0x0;var _0x131aaf=_0x12ff[_0x581c60];return _0x131aaf;};'use strict';var _=require(_0xf12f('0x0'));var moment=require(_0xf12f('0x1'));var util=require(_0xf12f('0x2'));var logger=require('../../../../config/logger')(_0xf12f('0x3'));var timezones=require(_0xf12f('0x4'))[_0xf12f('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xf12f('0x6'),'BLACKLIST':_0xf12f('0x7'),'CONTACTS_RESCHEDULED':_0xf12f('0x8'),'DEACTIVATED':_0xf12f('0x9'),'DISACTIVED':_0xf12f('0xa'),'EMPTY_INTERVAL':_0xf12f('0xb'),'INACTIVE':_0xf12f('0xc'),'NO_AGENTS_LOGGED':_0xf12f('0xd'),'NO_AVAILABLE_CONTACTS':_0xf12f('0xe'),'NULL_INTERVAL':_0xf12f('0xf'),'OVERTIME_INTERVAL':_0xf12f('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0xf12f('0x11'),'QUEUE_RECALL':_0xf12f('0x12'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xf12f('0x13'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xf12f('0x14')};exports[_0xf12f('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x30bb57){return _0x30bb57[_0xf12f('0x16')]==='preview';}exports[_0xf12f('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x479403){return _0x479403[_0xf12f('0x18')]===_0xf12f('0x19');}exports[_0xf12f('0x1a')]=isIVRCampaign;function isOutboundQueue(_0x136a08){return _0x136a08[_0xf12f('0x18')]===_0xf12f('0x1b');}exports[_0xf12f('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x407967){return _0x407967[_0xf12f('0x1d')];}exports[_0xf12f('0x1e')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1705f4){return _0x1705f4[_0xf12f('0x1f')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x5b9569,_0x2023e5){var _0x449f27=moment(_0x5b9569)[_0xf12f('0x20')](0x0);var _0x5a1c9e=moment(_0x2023e5)['milliseconds'](0x0);return _0x449f27[_0xf12f('0x21')](_0x5a1c9e,_0xf12f('0x22'));}exports[_0xf12f('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x93e25,_0x4b5d0a){var _0x3859be=![];var _0x53717f=_0x93e25[_0xf12f('0x16')]!==_0x4b5d0a[_0xf12f('0x16')]||_0x93e25[_0xf12f('0x1d')]!==_0x4b5d0a['dialActive']||_0x93e25['message']!==_0x4b5d0a['message'];var _0x21745b=_0x93e25[_0xf12f('0x24')]!==_0x4b5d0a[_0xf12f('0x24')]||_0x93e25[_0xf12f('0x25')]!==_0x4b5d0a[_0xf12f('0x25')]||_0x93e25[_0xf12f('0x26')]!==_0x4b5d0a['loggedInDb']||_0x93e25[_0xf12f('0x27')]!==_0x4b5d0a[_0xf12f('0x27')]||_0x93e25[_0xf12f('0x28')]!==_0x4b5d0a['talking']||_0x93e25[_0xf12f('0x29')]!==_0x4b5d0a[_0xf12f('0x29')]||_0x93e25[_0xf12f('0x2a')]!==_0x4b5d0a[_0xf12f('0x2a')]||_0x93e25[_0xf12f('0x2b')]!==_0x4b5d0a[_0xf12f('0x2b')]||_0x93e25[_0xf12f('0x2c')]!==_0x4b5d0a[_0xf12f('0x2c')];if(_0x93e25[_0xf12f('0x2d')]&&_0x4b5d0a[_0xf12f('0x2d')]){_0x3859be=_0x93e25[_0xf12f('0x2d')]['name']!==_0x4b5d0a['Trunk'][_0xf12f('0x2e')]||_0x93e25[_0xf12f('0x2d')][_0xf12f('0x1f')]!==_0x4b5d0a[_0xf12f('0x2d')]['active'];}return _0x53717f||_0x21745b||_0x3859be;}exports[_0xf12f('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1d9063){var _0x2b6918=null;var _0x244d86=_0x1d9063[_0xf12f('0x30')];if(_[_0xf12f('0x31')](_0x1d9063['dialGlobalInterval'])||_[_0xf12f('0x31')](_0x1d9063[_0xf12f('0x32')])||_['isNil'](_0x1d9063[_0xf12f('0x32')][_0xf12f('0x33')])){_0x2b6918=CAMPAIGN_STATUS[_0xf12f('0x34')];}else if(_[_0xf12f('0x35')](_0x1d9063['dialGlobalInterval'])||_['isEmpty'](_0x1d9063[_0xf12f('0x32')][_0xf12f('0x33')])){_0x2b6918=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x244d86&&!timezones[_0x244d86]){_0x2b6918=CAMPAIGN_STATUS[_0xf12f('0x36')];}return _0x2b6918;}function checkAnyValidTrunk(_0x515e5c,_0x115668){var _0x176981=null;var _0x23a0ca=_0xf12f('0x37');var _0x342f20=[_0xf12f('0x38'),_0xf12f('0x39')];var _0x3e1034=!![];if(_0x515e5c[_0xf12f('0x2d')]&&_0x515e5c['Trunk'][_0xf12f('0x1f')]){_0x23a0ca+=_0x515e5c['Trunk'][_0xf12f('0x2e')];_0x176981=_0x115668[_0x23a0ca];_0x3e1034=_0x342f20['includes'](_0x176981[_0xf12f('0x3a')]);}else if(_0x515e5c[_0xf12f('0x3b')]&&_0x515e5c['TrunkBackup']['active']){_0x23a0ca+=_0x515e5c['TrunkBackup'][_0xf12f('0x2e')];_0x176981=_0x115668[_0x23a0ca];_0x3e1034=_0x342f20['includes'](_0x176981['status']);}return _0x3e1034;}function getQueueCampaignStatusMessage(_0x3aaf87,_0x27a758){var _0x38e044=CAMPAIGN_STATUS[_0xf12f('0x6')];var _0x391964=isPreviewCampaign(_0x3aaf87);if(!isQueueCampaignActive(_0x3aaf87)){if(_0x391964){_0x38e044=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3aaf87[_0xf12f('0x2c')]===0x0&&_0x3aaf87['talking']===0x0&&_0x3aaf87[_0xf12f('0x2a')]===0x0&&(_0x3aaf87[_0xf12f('0x29')]||0x0)===0x0){_0x38e044=CAMPAIGN_STATUS[_0xf12f('0x3c')];}else{_0x38e044=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x3aaf87['loggedIn']===0x0){_0x38e044=CAMPAIGN_STATUS[_0xf12f('0x3d')];}else if(!checkAnyValidTrunk(_0x3aaf87,_0x27a758)){_0x38e044=CAMPAIGN_STATUS[_0xf12f('0x3e')];}else if(!isPreviewCampaign(_0x3aaf87)){var _0x35e5b2=checkAnyValidQueueCampaignInterval(_0x3aaf87);if(_0x35e5b2){_0x38e044=_0x35e5b2;}}return _0x38e044;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5cd8f1){var _0x555a12=CAMPAIGN_STATUS[_0xf12f('0x3f')];if(_0x5cd8f1[_0xf12f('0x2c')]===0x0&&_0x5cd8f1['talking']===0x0&&_0x5cd8f1[_0xf12f('0x2a')]===0x0&&(_0x5cd8f1[_0xf12f('0x29')]||0x0)===0x0){_0x555a12=CAMPAIGN_STATUS['INACTIVE'];}return _0x555a12;}exports[_0xf12f('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4d61e8){var _0xe4228c=_0x4d61e8[_0xf12f('0x41')](/"(.*?)"/);return _0xe4228c?_0xe4228c[0x1]:_0x4d61e8;}exports[_0xf12f('0x42')]=extractCalleridName;function getCallerId(_0x260422,_0x2ec34f,_0x226899){if(!_[_0xf12f('0x43')](_0x226899)&&typeof _0x226899==='string'&&!_['isEmpty'](_0x226899)){if(!_['isUndefined'](_0x2ec34f)&&typeof _0x2ec34f===_0xf12f('0x44')&&!_[_0xf12f('0x35')](_0x2ec34f)){return util[_0xf12f('0x45')](_0xf12f('0x46'),_0x2ec34f,_0x226899);}return util['format']('\x22%s\x22\x20<%s>',_0x226899,_0x226899);}if(!_['isUndefined'](_0x260422)&&typeof _0x260422===_0xf12f('0x44')&&!_[_0xf12f('0x35')](_0x260422)){return _0x260422;}return _0xf12f('0x47');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x3069dd,_0x514e0f){var _0x256929;var _0x4d00db;var _0x37510f;if(_0x514e0f<=0x0){_0x514e0f=0x1;}_0x256929=new RegExp(_0xf12f('0x48')+_0x514e0f+'}$');_0x4d00db=Math[_0xf12f('0x49')](0xa,_0x514e0f-0x1);_0x37510f=Math[_0xf12f('0x49')](0xa,_0x514e0f)-0x1;return util[_0xf12f('0x45')]('%s',_[_0xf12f('0x4a')](_0x3069dd,_0x256929,_[_0xf12f('0x4b')](_0x4d00db,_0x37510f)[_0xf12f('0x4c')]()));}exports[_0xf12f('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x30f7bb){if(_0x30f7bb[_0xf12f('0x2c')]&&_0x30f7bb[_0xf12f('0x2c')]>0x0){_0x30f7bb[_0xf12f('0x2c')]-=0x1;}else{logger[_0xf12f('0x4e')](_0xf12f('0x4f'));}}exports[_0xf12f('0x50')]=decrementOriginate;function checkContactEmpty(_0x1282a2){return _0x1282a2&&_0x1282a2[_0xf12f('0x51')]>0x0;}exports[_0xf12f('0x52')]=checkContactEmpty;function erlangb(_0x5d714b,_0x1c9a11){if(_0x1c9a11===0x0){return 0x0;}var _0x483fa1=0x1;for(var _0x5165b4=0x1;_0x5165b4<=_0x1c9a11;_0x5165b4+=0x1){_0x483fa1=0x1+_0x483fa1*_0x5165b4/_0x5d714b;}return 0x1/_0x483fa1;}exports[_0xf12f('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x929394,_0x293ed1,_0x56a886){if(_0x293ed1>_0x56a886){for(var _0x24f9be=0x0;_0x24f9be<_0x293ed1-_0x56a886;_0x24f9be+=0x1){decrementOriginate(_0x929394);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x55105b){var _0x333cbe={};var _0x25407a=['id',_0xf12f('0x54'),'tags','updatedAt'];const _0x574567=0xfa;if(_0x55105b){for(var _0x58d608 in _0x55105b){if(typeof _0x55105b[_0x58d608]!=='undefined'){if(!_[_0xf12f('0x31')](_0x55105b[_0x58d608])&&!_0x25407a['includes'](_0x58d608)){if(_0x58d608===_0xf12f('0x55')&&_0x55105b[_0x58d608][_0xf12f('0x51')]>_0x574567){_0x333cbe[_0xf12f('0x56')+_0x58d608[_0xf12f('0x57')]()]=_0x55105b[_0x58d608][_0xf12f('0x4c')]()[_0xf12f('0x58')](0x0,_0x574567);}else{_0x333cbe[_0xf12f('0x56')+_0x58d608[_0xf12f('0x57')]()]=_0x55105b[_0x58d608];}}}}}return _0x333cbe;}exports[_0xf12f('0x59')]=setXMDContactVariables; \ No newline at end of file +var _0x4fa9=['SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','pow','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','moment','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','outbound','isOutboundQueue','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x4fa9,0xc6));var _0x94fa=function(_0x1f9a8e,_0x435967){_0x1f9a8e=_0x1f9a8e-0x0;var _0x3bd851=_0x4fa9[_0x1f9a8e];return _0x3bd851;};'use strict';var _=require('lodash');var moment=require(_0x94fa('0x0'));var util=require('util');var logger=require(_0x94fa('0x1'))('dialer');var timezones=require(_0x94fa('0x2'))[_0x94fa('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x94fa('0x4'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x94fa('0x5'),'EMPTY_INTERVAL':_0x94fa('0x6'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x94fa('0x7'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x94fa('0x8'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x94fa('0x9'),'QUEUE_RECALL':_0x94fa('0xa'),'RECALL_TIMEOUT':_0x94fa('0xb'),'RUNNING':_0x94fa('0xc'),'UNKNOWN_TIMEZONE':_0x94fa('0xd'),'UNREACHABLE_TRUNK':_0x94fa('0xe')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x25b26c){return _0x25b26c[_0x94fa('0xf')]==='preview';}exports[_0x94fa('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x472f34){return _0x472f34[_0x94fa('0x11')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x24eaaf){return _0x24eaaf[_0x94fa('0x11')]===_0x94fa('0x12');}exports[_0x94fa('0x13')]=isOutboundQueue;function isQueueCampaignActive(_0x3cbff3){return _0x3cbff3['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x469e08){return _0x469e08['active'];}exports[_0x94fa('0x14')]=isIVRCampaignActive;function getSeconds(_0x57a2e5,_0x4b0e95){var _0x41b615=moment(_0x57a2e5)[_0x94fa('0x15')](0x0);var _0x289d05=moment(_0x4b0e95)['milliseconds'](0x0);return _0x41b615[_0x94fa('0x16')](_0x289d05,_0x94fa('0x17'));}exports[_0x94fa('0x18')]=getSeconds;function hasQueueCampaignDataChanged(_0x60f4e,_0x4f83a7){var _0x25fc9a=![];var _0x348714=_0x60f4e[_0x94fa('0xf')]!==_0x4f83a7['dialMethod']||_0x60f4e[_0x94fa('0x19')]!==_0x4f83a7['dialActive']||_0x60f4e[_0x94fa('0x1a')]!==_0x4f83a7[_0x94fa('0x1a')];var _0xae286b=_0x60f4e['available']!==_0x4f83a7[_0x94fa('0x1b')]||_0x60f4e[_0x94fa('0x1c')]!==_0x4f83a7[_0x94fa('0x1c')]||_0x60f4e[_0x94fa('0x1d')]!==_0x4f83a7[_0x94fa('0x1d')]||_0x60f4e[_0x94fa('0x1e')]!==_0x4f83a7[_0x94fa('0x1e')]||_0x60f4e['talking']!==_0x4f83a7[_0x94fa('0x1f')]||_0x60f4e[_0x94fa('0x20')]!==_0x4f83a7[_0x94fa('0x20')]||_0x60f4e[_0x94fa('0x21')]!==_0x4f83a7['waiting']||_0x60f4e[_0x94fa('0x22')]!==_0x4f83a7[_0x94fa('0x22')]||_0x60f4e[_0x94fa('0x23')]!==_0x4f83a7[_0x94fa('0x23')];if(_0x60f4e[_0x94fa('0x24')]&&_0x4f83a7['Trunk']){_0x25fc9a=_0x60f4e[_0x94fa('0x24')][_0x94fa('0x25')]!==_0x4f83a7[_0x94fa('0x24')]['name']||_0x60f4e[_0x94fa('0x24')][_0x94fa('0x26')]!==_0x4f83a7[_0x94fa('0x24')][_0x94fa('0x26')];}return _0x348714||_0xae286b||_0x25fc9a;}exports[_0x94fa('0x27')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x15b78d){var _0x148b1e=null;var _0x10c60a=_0x15b78d[_0x94fa('0x28')];if(_[_0x94fa('0x29')](_0x15b78d[_0x94fa('0x2a')])||_['isNil'](_0x15b78d[_0x94fa('0x2b')])||_[_0x94fa('0x29')](_0x15b78d[_0x94fa('0x2b')][_0x94fa('0x2c')])){_0x148b1e=CAMPAIGN_STATUS[_0x94fa('0x2d')];}else if(_[_0x94fa('0x2e')](_0x15b78d[_0x94fa('0x2a')])||_['isEmpty'](_0x15b78d[_0x94fa('0x2b')][_0x94fa('0x2c')])){_0x148b1e=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x10c60a&&!timezones[_0x10c60a]){_0x148b1e=CAMPAIGN_STATUS[_0x94fa('0x2f')];}return _0x148b1e;}function checkAnyValidTrunk(_0x13cb19,_0x5a5a5a){var _0x2ee257=null;var _0x38a5ef=_0x94fa('0x30');var _0x1e7c2d=[_0x94fa('0x31'),_0x94fa('0x32')];var _0x2ad0c0=!![];if(_0x13cb19[_0x94fa('0x24')]&&_0x13cb19[_0x94fa('0x24')]['active']){_0x38a5ef+=_0x13cb19[_0x94fa('0x24')][_0x94fa('0x25')];_0x2ee257=_0x5a5a5a[_0x38a5ef];_0x2ad0c0=_0x1e7c2d[_0x94fa('0x33')](_0x2ee257[_0x94fa('0x34')]);}else if(_0x13cb19[_0x94fa('0x35')]&&_0x13cb19[_0x94fa('0x35')][_0x94fa('0x26')]){_0x38a5ef+=_0x13cb19['TrunkBackup'][_0x94fa('0x25')];_0x2ee257=_0x5a5a5a[_0x38a5ef];_0x2ad0c0=_0x1e7c2d[_0x94fa('0x33')](_0x2ee257['status']);}return _0x2ad0c0;}function getQueueCampaignStatusMessage(_0x35eb90,_0x4270e0){var _0x1ce074=CAMPAIGN_STATUS[_0x94fa('0x4')];var _0x18fdcc=isPreviewCampaign(_0x35eb90);if(!isQueueCampaignActive(_0x35eb90)){if(_0x18fdcc){_0x1ce074=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x35eb90[_0x94fa('0x23')]===0x0&&_0x35eb90[_0x94fa('0x1f')]===0x0&&_0x35eb90[_0x94fa('0x21')]===0x0&&(_0x35eb90[_0x94fa('0x20')]||0x0)===0x0){_0x1ce074=CAMPAIGN_STATUS[_0x94fa('0x36')];}else{_0x1ce074=CAMPAIGN_STATUS[_0x94fa('0x37')];}}}else if(_0x35eb90['loggedIn']===0x0){_0x1ce074=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x35eb90,_0x4270e0)){_0x1ce074=CAMPAIGN_STATUS[_0x94fa('0x38')];}else if(!isPreviewCampaign(_0x35eb90)){var _0x33ea1a=checkAnyValidQueueCampaignInterval(_0x35eb90);if(_0x33ea1a){_0x1ce074=_0x33ea1a;}}return _0x1ce074;}exports[_0x94fa('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x14b768){var _0x1fb3a9=CAMPAIGN_STATUS[_0x94fa('0x37')];if(_0x14b768[_0x94fa('0x23')]===0x0&&_0x14b768[_0x94fa('0x1f')]===0x0&&_0x14b768[_0x94fa('0x21')]===0x0&&(_0x14b768[_0x94fa('0x20')]||0x0)===0x0){_0x1fb3a9=CAMPAIGN_STATUS[_0x94fa('0x36')];}return _0x1fb3a9;}exports[_0x94fa('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2b6e3b){var _0x106718=_0x2b6e3b[_0x94fa('0x3b')](/"(.*?)"/);return _0x106718?_0x106718[0x1]:_0x2b6e3b;}exports[_0x94fa('0x3c')]=extractCalleridName;function getCallerId(_0x24fc1c,_0x27b5c0,_0xe09b06){if(!_[_0x94fa('0x3d')](_0xe09b06)&&typeof _0xe09b06===_0x94fa('0x3e')&&!_[_0x94fa('0x2e')](_0xe09b06)){if(!_['isUndefined'](_0x27b5c0)&&typeof _0x27b5c0===_0x94fa('0x3e')&&!_[_0x94fa('0x2e')](_0x27b5c0)){return util[_0x94fa('0x3f')](_0x94fa('0x40'),_0x27b5c0,_0xe09b06);}return util[_0x94fa('0x3f')]('\x22%s\x22\x20<%s>',_0xe09b06,_0xe09b06);}if(!_['isUndefined'](_0x24fc1c)&&typeof _0x24fc1c==='string'&&!_[_0x94fa('0x2e')](_0x24fc1c)){return _0x24fc1c;}return'\x22\x22\x20<>';}exports[_0x94fa('0x41')]=getCallerId;function getCallerIdRandom(_0xdb3628,_0x4ef8eb){var _0x48e7d8;var _0x113be1;var _0x31d178;if(_0x4ef8eb<=0x0){_0x4ef8eb=0x1;}_0x48e7d8=new RegExp('\x5cw{0,'+_0x4ef8eb+'}$');_0x113be1=Math[_0x94fa('0x42')](0xa,_0x4ef8eb-0x1);_0x31d178=Math[_0x94fa('0x42')](0xa,_0x4ef8eb)-0x1;return util['format']('%s',_['replace'](_0xdb3628,_0x48e7d8,_['random'](_0x113be1,_0x31d178)[_0x94fa('0x43')]()));}exports[_0x94fa('0x44')]=getCallerIdRandom;function decrementOriginate(_0xd95b1f){if(_0xd95b1f[_0x94fa('0x23')]&&_0xd95b1f[_0x94fa('0x23')]>0x0){_0xd95b1f[_0x94fa('0x23')]-=0x1;}else{logger[_0x94fa('0x45')](_0x94fa('0x46'));}}exports[_0x94fa('0x47')]=decrementOriginate;function checkContactEmpty(_0xa2afb6){return _0xa2afb6&&_0xa2afb6[_0x94fa('0x48')]>0x0;}exports[_0x94fa('0x49')]=checkContactEmpty;function erlangb(_0x509f88,_0x39d5b5){if(_0x39d5b5===0x0){return 0x0;}var _0x161054=0x1;for(var _0x14a091=0x1;_0x14a091<=_0x39d5b5;_0x14a091+=0x1){_0x161054=0x1+_0x161054*_0x14a091/_0x509f88;}return 0x1/_0x161054;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x3995aa,_0x22d9ad,_0xead9ea){if(_0x22d9ad>_0xead9ea){for(var _0x253fee=0x0;_0x253fee<_0x22d9ad-_0xead9ea;_0x253fee+=0x1){decrementOriginate(_0x3995aa);}}}exports[_0x94fa('0x4a')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x13e1ce){var _0x3bbc2b={};var _0xd959f8=['id',_0x94fa('0x4b'),_0x94fa('0x4c'),_0x94fa('0x4d')];const _0x1fe134=0xfa;if(_0x13e1ce){for(var _0x5be5e3 in _0x13e1ce){if(typeof _0x13e1ce[_0x5be5e3]!==_0x94fa('0x4e')){if(!_['isNil'](_0x13e1ce[_0x5be5e3])&&!_0xd959f8[_0x94fa('0x33')](_0x5be5e3)){if(_0x5be5e3===_0x94fa('0x4f')&&_0x13e1ce[_0x5be5e3][_0x94fa('0x48')]>_0x1fe134){_0x3bbc2b[_0x94fa('0x50')+_0x5be5e3['toUpperCase']()]=_0x13e1ce[_0x5be5e3][_0x94fa('0x43')]()['substring'](0x0,_0x1fe134);}else{_0x3bbc2b[_0x94fa('0x50')+_0x5be5e3[_0x94fa('0x51')]()]=_0x13e1ce[_0x5be5e3];}}}}}return _0x3bbc2b;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f85c772..bb12f82 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(_0x264283,_0x44a9d4){var _0x33130d=function(_0xeed57c){while(--_0xeed57c){_0x264283['push'](_0x264283['shift']());}};_0x33130d(++_0x44a9d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x13080d,_0x5f1876){var _0x4f5705=function(_0x3e70d5){while(--_0x3e70d5){_0x13080d['push'](_0x13080d['shift']());}};_0x4f5705(++_0x5f1876);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 679bcce..6a1197e 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 _0x8ec0=['catch','\x20receiveFax\x20','merge','pick','response','update','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','message','[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','format','dir','Action','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','prototype','syncVarSet','value','channelstate','channelstatedesc','variable','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','application/pdf','then','notify','error','\x20notify\x20','stringify'];(function(_0x3657ed,_0x1a2122){var _0x199755=function(_0x3dd259){while(--_0x3dd259){_0x3657ed['push'](_0x3657ed['shift']());}};_0x199755(++_0x1a2122);}(_0x8ec0,0x9d));var _0x08ec=function(_0x4afa16,_0x12ecd0){_0x4afa16=_0x4afa16-0x0;var _0x1214c7=_0x8ec0[_0x4afa16];return _0x1214c7;};'use strict';var util=require('util');var _=require(_0x08ec('0x0'));var BPromise=require(_0x08ec('0x1'));var uuid=require(_0x08ec('0x2'));var moment=require('moment');var path=require(_0x08ec('0x3'));var tiff2pdf=require(_0x08ec('0x4'));var gs=require(_0x08ec('0x5'));var logger=require(_0x08ec('0x6'))(_0x08ec('0x7'));var ami=require(_0x08ec('0x8'));var rpcDb=require(_0x08ec('0x9'));var Channel=require(_0x08ec('0xa'));var ut=require(_0x08ec('0xb'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x08ec('0xc'));function Fax(_0x267077){this[_0x08ec('0xd')]={};this[_0x08ec('0xe')]=_0x267077['faxAccounts'];this[_0x08ec('0xf')]=_0x267077[_0x08ec('0xf')];this['actions']={};ami['on'](_0x08ec('0x10'),this[_0x08ec('0x11')][_0x08ec('0x12')](this));ami['on'](_0x08ec('0x13'),this['syncVarSet'][_0x08ec('0x12')](this));ami['on']('newstate',this[_0x08ec('0x14')]['bind'](this));ami['on'](_0x08ec('0x15'),this[_0x08ec('0x16')]['bind'](this));ami['on'](_0x08ec('0x17'),this[_0x08ec('0x18')][_0x08ec('0x12')](this));ami['on'](_0x08ec('0x19'),this[_0x08ec('0x1a')][_0x08ec('0x12')](this));ami['on'](_0x08ec('0x1b'),this[_0x08ec('0x1c')][_0x08ec('0x12')](this));ami['on']('originateresponse',this[_0x08ec('0x1d')][_0x08ec('0x12')](this));}Fax['prototype'][_0x08ec('0x11')]=function(_0x2fdb7d){if(_0x2fdb7d['context']==='from-voip-provider'){for(var _0x2142d5 in this['faxAccounts']){if(this[_0x08ec('0xe')][_0x08ec('0x1e')](_0x2142d5)){if(_0x2fdb7d[_0x08ec('0x1f')]===this['faxAccounts'][_0x2142d5]['localstationid']){this[_0x08ec('0xd')][_0x2fdb7d[_0x08ec('0x20')]]={};this['channels'][_0x2fdb7d[_0x08ec('0x20')]][_0x08ec('0x21')]=_0x2fdb7d[_0x08ec('0x21')];this[_0x08ec('0xd')][_0x2fdb7d[_0x08ec('0x20')]]['id']=this['faxAccounts'][_0x2142d5]['id'];this[_0x08ec('0xd')][_0x2fdb7d[_0x08ec('0x20')]]['name']=this['faxAccounts'][_0x2142d5][_0x08ec('0x22')];logger[_0x08ec('0x23')](_0x2fdb7d['uniqueid'],_0x08ec('0x24'));}}}}if(this[_0x08ec('0x25')][_0x2fdb7d[_0x08ec('0x20')]]){this[_0x08ec('0xd')][_0x2fdb7d[_0x08ec('0x20')]]={};this['channels'][_0x2fdb7d['uniqueid']]['channel']=_0x2fdb7d['channel'];logger[_0x08ec('0x23')](_0x2fdb7d[_0x08ec('0x20')],_0x08ec('0x24'));}};Fax[_0x08ec('0x26')][_0x08ec('0x27')]=function(_0x268a34){if(this['channels'][_0x268a34[_0x08ec('0x20')]]){for(var _0x183e16 in _0x268a34['variable']){if(_0x268a34['variable'][_0x08ec('0x1e')](_0x183e16)){this[_0x08ec('0xd')][_0x268a34[_0x08ec('0x20')]][_0x183e16]=_0x268a34[_0x08ec('0x28')];}}}};Fax[_0x08ec('0x26')][_0x08ec('0x14')]=function(_0x598e36){if(this[_0x08ec('0xd')][_0x598e36[_0x08ec('0x20')]]){this['channels'][_0x598e36[_0x08ec('0x20')]][_0x08ec('0x29')]=_0x598e36[_0x08ec('0x29')];this[_0x08ec('0xd')][_0x598e36[_0x08ec('0x20')]][_0x08ec('0x2a')]=_0x598e36['channelstatedesc'];}};Fax[_0x08ec('0x26')][_0x08ec('0x16')]=function(_0x16b098){if(this[_0x08ec('0xd')][_0x16b098[_0x08ec('0x20')]]){for(var _0x40ce25 in _0x16b098[_0x08ec('0x2b')]){if(_0x16b098['variable'][_0x08ec('0x1e')](_0x40ce25)){this[_0x08ec('0xd')][_0x16b098[_0x08ec('0x20')]][_0x40ce25]=_0x16b098[_0x08ec('0x28')];}}}};Fax[_0x08ec('0x26')][_0x08ec('0x18')]=function(_0x34b4aa){if(this['channels'][_0x34b4aa['uniqueid']]){this['channels'][_0x34b4aa[_0x08ec('0x20')]][_0x08ec('0x2c')]=_0x34b4aa['operation'];this[_0x08ec('0xd')][_0x34b4aa[_0x08ec('0x20')]][_0x08ec('0x2d')]=_0x34b4aa[_0x08ec('0x2d')];this['channels'][_0x34b4aa[_0x08ec('0x20')]][_0x08ec('0x2e')]=_0x34b4aa[_0x08ec('0x2e')];this[_0x08ec('0xd')][_0x34b4aa[_0x08ec('0x20')]][_0x08ec('0x2f')]=_0x34b4aa[_0x08ec('0x2f')];logger[_0x08ec('0x23')](_0x34b4aa[_0x08ec('0x20')],_0x08ec('0x30'));}};Fax['prototype'][_0x08ec('0x1a')]=function(_0x49ca96){var _0x260771=this;if(this[_0x08ec('0xd')][_0x49ca96['uniqueid']]){var _0x24689b=this['channels'][_0x49ca96['uniqueid']]['id'];this['channels'][_0x49ca96['uniqueid']][_0x08ec('0x31')]=_0x49ca96['remotestationid'];this[_0x08ec('0xd')][_0x49ca96[_0x08ec('0x20')]][_0x08ec('0x32')]=_0x49ca96['pagestransferred'];this[_0x08ec('0xd')][_0x49ca96['uniqueid']][_0x08ec('0x2e')]=_0x49ca96[_0x08ec('0x2e')];this[_0x08ec('0xd')][_0x49ca96[_0x08ec('0x20')]][_0x08ec('0x33')]=_0x49ca96[_0x08ec('0x33')];this[_0x08ec('0xd')][_0x49ca96[_0x08ec('0x20')]][_0x08ec('0x34')]=_0x49ca96[_0x08ec('0x34')];this[_0x08ec('0xd')][_0x49ca96[_0x08ec('0x20')]][_0x08ec('0x2f')]=_0x49ca96[_0x08ec('0x2f')];this[_0x08ec('0xd')][_0x49ca96[_0x08ec('0x20')]][_0x08ec('0x35')]=_0x49ca96[_0x08ec('0x35')];if(this[_0x08ec('0xd')][_0x49ca96[_0x08ec('0x20')]][_0x08ec('0x32')]>0x0){tiff2pdf(_0x49ca96['filename'],_0x08ec('0x36'),function(_0x4d5ce3){logger['info'](_0x49ca96[_0x08ec('0x20')],_0x08ec('0x37'),_0x4d5ce3['message']);attachment['create']({'name':path[_0x08ec('0x38')](_0x49ca96[_0x08ec('0x2f')])[_0x08ec('0x22')],'basename':path['parse'](_0x49ca96[_0x08ec('0x2f')])[_0x08ec('0x22')]+'.pdf','type':_0x08ec('0x39')})[_0x08ec('0x3a')](function(_0x4822ef){faxAccount[_0x08ec('0x3b')](_0x24689b,{'from':_0x49ca96[_0x08ec('0x35')],'mapKey':_0x08ec('0x7'),'body':path[_0x08ec('0x38')](_0x49ca96['filename'])[_0x08ec('0x22')]+'.pdf','AttachmentId':_0x4822ef['id']})['catch'](function(_0x415091){logger[_0x08ec('0x3c')](_0x49ca96[_0x08ec('0x20')],_0x08ec('0x3d'),JSON[_0x08ec('0x3e')](_0x415091));});})[_0x08ec('0x3f')](function(_0x21bdc6){logger[_0x08ec('0x3c')](_0x49ca96[_0x08ec('0x20')],_0x08ec('0x40'),JSON[_0x08ec('0x3e')](_0x21bdc6));});});}logger[_0x08ec('0x23')](_0x49ca96[_0x08ec('0x20')],_0x08ec('0x40'));}};Fax['prototype'][_0x08ec('0x1d')]=function(_0x32c119){if(this[_0x08ec('0x25')][_0x32c119[_0x08ec('0x20')]]){_[_0x08ec('0x41')](this[_0x08ec('0xd')][_0x32c119['uniqueid']],_[_0x08ec('0x42')](_0x32c119,[_0x08ec('0x43'),'reason']));}};function updateStatus(_0x4e7f2a){if(_0x4e7f2a['AttachmentId']){faxMessage[_0x08ec('0x44')](_0x4e7f2a[_0x08ec('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0xce2095){ut[_0x08ec('0x46')]('[Fax][Message][Error][Updated]',_0xce2095);})['catch'](function(_0x5b34ff){ut[_0x08ec('0x46')](_0x08ec('0x47'),_0x5b34ff);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x08ec('0x26')][_0x08ec('0x48')]=function(_0x131afa,_0x476d3a,_0x541e70){var _0x397749=this;var _0x32bf85={};if(_0x476d3a){_0x32bf85={'read':_0x476d3a};}else{_0x32bf85={'failMessage':_0x541e70};}if(this['actions'][_0x131afa][_0x08ec('0x45')]){faxMessage[_0x08ec('0x44')](this[_0x08ec('0x25')][_0x131afa]['AttachmentId'],_0x32bf85)['then'](function(_0x541420){ut[_0x08ec('0x46')](_0x08ec('0x49'),_0x541420);})[_0x08ec('0x3f')](function(_0x4419fd){ut[_0x08ec('0x46')](_0x08ec('0x4a'),_0x4419fd);})[_0x08ec('0x4b')](function(){delete _0x397749['channels'][_0x131afa];delete _0x397749['actions'][_0x131afa];});}else{ut[_0x08ec('0x46')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x131afa];delete this[_0x08ec('0x25')][_0x131afa];}};Fax[_0x08ec('0x26')][_0x08ec('0x1c')]=function(_0x277dba){var _0x57248b=this;if(this[_0x08ec('0xd')][_0x277dba[_0x08ec('0x20')]]){if(this['actions'][_0x277dba['uniqueid']]){this[_0x08ec('0xd')][_0x277dba[_0x08ec('0x20')]]['id']=this[_0x08ec('0x25')][_0x277dba['uniqueid']]['id'];this[_0x08ec('0xd')][_0x277dba[_0x08ec('0x20')]][_0x08ec('0x22')]=this['actions'][_0x277dba[_0x08ec('0x20')]][_0x08ec('0x22')];}logger['info'](_0x277dba['uniqueid'],this['actions'][_0x277dba[_0x08ec('0x20')]]?_0x08ec('0x4c'):'\x20hangup\x20faxRiceive\x20',JSON[_0x08ec('0x3e')](this[_0x08ec('0xd')][_0x277dba['uniqueid']]));if(this[_0x08ec('0x25')][_0x277dba[_0x08ec('0x20')]]){if(this['channels'][_0x277dba[_0x08ec('0x20')]]['faxpages']>0x0&&this['channels'][_0x277dba[_0x08ec('0x20')]][_0x08ec('0x17')]===_0x08ec('0x4d')){this[_0x08ec('0x48')](_0x277dba[_0x08ec('0x20')],!![]);}else{this[_0x08ec('0x48')](_0x277dba['uniqueid'],![],this[_0x08ec('0xd')][_0x277dba[_0x08ec('0x20')]][_0x08ec('0x4e')]?_0x08ec('0x4f')+this[_0x08ec('0xd')][_0x277dba['uniqueid']][_0x08ec('0x4e')]:_0x08ec('0x50'));}}}};Fax[_0x08ec('0x26')][_0x08ec('0x51')]=function(_0x1f80cc){var _0x18ea65=this;return new BPromise(function(_0x52f106,_0x38a7a1){_0x18ea65['execOriginate'](_0x1f80cc,_0x18ea65['faxAccounts'][_0x1f80cc[_0x08ec('0x52')]])['then'](function(_0x364464){ut[_0x08ec('0x46')]('[Fax][execOriginate][success]',_0x364464);_0x52f106(ut[_0x08ec('0x53')]('Fax\x20received'));})[_0x08ec('0x3f')](function(_0x25e94a){ut[_0x08ec('0x46')](_0x08ec('0x54'),_0x25e94a);updateStatus(_0x1f80cc);_0x38a7a1(ut['message'](_0x08ec('0x55')));});});};Fax[_0x08ec('0x26')][_0x08ec('0x56')]=function(_0x3e0b3f){var _0x588748=this;return new BPromise(function(_0x2160af,_0x2afe0d){var _0x41500f=_0x588748[_0x08ec('0x57')](_0x588748[_0x08ec('0xe')][_0x3e0b3f['FaxAccountId']][_0x08ec('0x58')],_0x3e0b3f);if(_0x41500f[_0x08ec('0x59')]){_0x2160af(ut[_0x08ec('0x53')](_0x08ec('0x5a')));}else{_0x2afe0d(ut[_0x08ec('0x53')](_0x41500f['message']));}});};function originate(_0x58f5e6,_0x3f5ea4,_0x266f80){return new BPromise(function(_0x47bfbb,_0x5a5846){if(_0x266f80){var _0x18f5f3=util['format'](_0x08ec('0x5b'),path['parse'](_0x58f5e6['path'])[_0x08ec('0x22')],_0x58f5e6[_0x08ec('0x3')]);gs['execute'](_0x18f5f3)[_0x08ec('0x3a')](function(){_0x58f5e6[_0x08ec('0x3')]=util[_0x08ec('0x5c')]('%s/%s.tif',path[_0x08ec('0x38')](_0x58f5e6['path'])[_0x08ec('0x5d')],path[_0x08ec('0x38')](_0x58f5e6[_0x08ec('0x3')])[_0x08ec('0x22')]);_0x3f5ea4['XMF-PATH']=_0x58f5e6[_0x08ec('0x3')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x08ec('0x5e')](ut['variablesAction'](_0x58f5e6,_0x3f5ea4))[_0x08ec('0x3a')](function(_0x9965ab){_0x47bfbb(_0x9965ab);})[_0x08ec('0x3f')](function(_0x5c4d24){_0x5a5846(_0x5c4d24);});})[_0x08ec('0x3f')](function(_0x3f4fca){_0x5a5846(_0x3f4fca);});}else{ami['Action'](ut['variablesAction'](_0x58f5e6,_0x3f5ea4))['then'](function(_0x20b62c){_0x47bfbb(_0x20b62c);})['catch'](function(_0x2444a2){_0x5a5846(_0x2444a2);});}});}Fax['prototype']['execOriginate']=function(_0x2598b5,_0x600c6){var _0x27f71d=this;return new BPromise(function(_0x57c312,_0x1264e6){var _0x2d4e84=uuid['v4']();var _0x245951=ut[_0x08ec('0x5f')](_0x2598b5,_0x600c6);_0x27f71d[_0x08ec('0x25')][_0x2d4e84]=new Action(_0x2d4e84,_0x600c6,_0x2598b5);var _0x133d1a=_0x27f71d[_0x08ec('0x25')][_0x2d4e84];if(path[_0x08ec('0x38')](_0x2598b5[_0x08ec('0x3')])[_0x08ec('0x60')]===_0x08ec('0x61')){originate(_0x133d1a,_0x245951,!![])[_0x08ec('0x3a')](function(_0x3b7b17){_0x57c312(_0x3b7b17);})[_0x08ec('0x3f')](function(_0x5b543c){_0x1264e6(_0x5b543c);});}else{originate(_0x133d1a,_0x245951,![])[_0x08ec('0x3a')](function(_0x37b688){_0x57c312(_0x37b688);})[_0x08ec('0x3f')](function(_0x433d59){_0x1264e6(_0x433d59);});}});};Fax['prototype'][_0x08ec('0x62')]=function(_0x317e19){return!_[_0x08ec('0x63')](_0x317e19)&&!_[_0x08ec('0x63')](_0x317e19[_0x08ec('0x22')])&&!_[_0x08ec('0x63')](_0x317e19[_0x08ec('0x64')])&&_0x317e19[_0x08ec('0x64')]&&!_[_0x08ec('0x63')](this['trunks'][util[_0x08ec('0x5c')](_0x08ec('0x65'),_0x317e19[_0x08ec('0x22')])])&&!_[_0x08ec('0x63')](this[_0x08ec('0xf')][util['format'](_0x08ec('0x65'),_0x317e19['name'])][_0x08ec('0x2d')])&&(this[_0x08ec('0xf')][util[_0x08ec('0x5c')](_0x08ec('0x65'),_0x317e19[_0x08ec('0x22')])][_0x08ec('0x2d')]==='reachable'||this[_0x08ec('0xf')][util[_0x08ec('0x5c')](_0x08ec('0x65'),_0x317e19['name'])][_0x08ec('0x2d')]===_0x08ec('0x66'));};Fax[_0x08ec('0x26')][_0x08ec('0x57')]=function(_0x5af101,_0x425e84){if(!this[_0x08ec('0x62')](_0x5af101)){ut['logger'](_0x08ec('0x67'),_[_0x08ec('0x63')](_0x5af101)?'':_0x5af101[_0x08ec('0x22')]+_0x08ec('0x68'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x08ec('0x63')](_0x425e84[_0x08ec('0x7')])){ut[_0x08ec('0x46')](_0x08ec('0x69'),JSON['stringify'](_0x425e84));return{'isValid':![],'message':_0x08ec('0x6a')};}if(_['isNil'](_0x425e84['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x08ec('0x3e')](_0x425e84));return{'isValid':![],'message':_0x08ec('0x6b')};}return{'isValid':!![],'message':_0x08ec('0x6c')};};module[_0x08ec('0x6d')]=Fax; \ No newline at end of file +var _0x6ff1=['[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','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','%s/%s.tif','Convert\x20pdf\x20to\x20tif','variablesAction','execOriginate','ext','isNil','active','SIP/%s','reachable','unmonitored','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','exports','moment','path','./util/gs','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','then','notify','fax','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','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','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received'];(function(_0x455ac0,_0x1d5f16){var _0xfb9257=function(_0x126d21){while(--_0x126d21){_0x455ac0['push'](_0x455ac0['shift']());}};_0xfb9257(++_0x1d5f16);}(_0x6ff1,0xfc));var _0x16ff=function(_0x218d60,_0x46bf0b){_0x218d60=_0x218d60-0x0;var _0x474243=_0x6ff1[_0x218d60];return _0x474243;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x16ff('0x0'));var path=require(_0x16ff('0x1'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x16ff('0x2'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require(_0x16ff('0x3'));var Channel=require(_0x16ff('0x4'));var ut=require(_0x16ff('0x5'));var Action=require('./action');var faxAccount=require(_0x16ff('0x6'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x16ff('0x7'));function Fax(_0x332464){this[_0x16ff('0x8')]={};this['faxAccounts']=_0x332464[_0x16ff('0x9')];this[_0x16ff('0xa')]=_0x332464[_0x16ff('0xa')];this[_0x16ff('0xb')]={};ami['on']('newchannel',this[_0x16ff('0xc')][_0x16ff('0xd')](this));ami['on'](_0x16ff('0xe'),this[_0x16ff('0xf')][_0x16ff('0xd')](this));ami['on']('newstate',this[_0x16ff('0x10')][_0x16ff('0xd')](this));ami['on']('newexten',this[_0x16ff('0x11')][_0x16ff('0xd')](this));ami['on'](_0x16ff('0x12'),this[_0x16ff('0x13')]['bind'](this));ami['on'](_0x16ff('0x14'),this[_0x16ff('0x15')][_0x16ff('0xd')](this));ami['on'](_0x16ff('0x16'),this[_0x16ff('0x17')]['bind'](this));ami['on'](_0x16ff('0x18'),this['syncOriginateResponse']['bind'](this));}Fax[_0x16ff('0x19')][_0x16ff('0xc')]=function(_0x1af4a9){if(_0x1af4a9[_0x16ff('0x1a')]===_0x16ff('0x1b')){for(var _0x5236f4 in this['faxAccounts']){if(this['faxAccounts'][_0x16ff('0x1c')](_0x5236f4)){if(_0x1af4a9[_0x16ff('0x1d')]===this[_0x16ff('0x9')][_0x5236f4]['localstationid']){this[_0x16ff('0x8')][_0x1af4a9[_0x16ff('0x1e')]]={};this[_0x16ff('0x8')][_0x1af4a9['uniqueid']][_0x16ff('0x1f')]=_0x1af4a9[_0x16ff('0x1f')];this[_0x16ff('0x8')][_0x1af4a9[_0x16ff('0x1e')]]['id']=this[_0x16ff('0x9')][_0x5236f4]['id'];this[_0x16ff('0x8')][_0x1af4a9[_0x16ff('0x1e')]][_0x16ff('0x20')]=this[_0x16ff('0x9')][_0x5236f4][_0x16ff('0x20')];logger[_0x16ff('0x21')](_0x1af4a9[_0x16ff('0x1e')],_0x16ff('0x22'));}}}}if(this['actions'][_0x1af4a9[_0x16ff('0x1e')]]){this[_0x16ff('0x8')][_0x1af4a9[_0x16ff('0x1e')]]={};this[_0x16ff('0x8')][_0x1af4a9[_0x16ff('0x1e')]][_0x16ff('0x1f')]=_0x1af4a9[_0x16ff('0x1f')];logger[_0x16ff('0x21')](_0x1af4a9['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x16ff('0x19')][_0x16ff('0xf')]=function(_0x158166){if(this[_0x16ff('0x8')][_0x158166['uniqueid']]){for(var _0x565b13 in _0x158166[_0x16ff('0x23')]){if(_0x158166[_0x16ff('0x23')][_0x16ff('0x1c')](_0x565b13)){this[_0x16ff('0x8')][_0x158166[_0x16ff('0x1e')]][_0x565b13]=_0x158166[_0x16ff('0x24')];}}}};Fax[_0x16ff('0x19')][_0x16ff('0x10')]=function(_0xc7c6a0){if(this[_0x16ff('0x8')][_0xc7c6a0['uniqueid']]){this[_0x16ff('0x8')][_0xc7c6a0['uniqueid']]['channelstate']=_0xc7c6a0[_0x16ff('0x25')];this[_0x16ff('0x8')][_0xc7c6a0[_0x16ff('0x1e')]]['channelstatedesc']=_0xc7c6a0[_0x16ff('0x26')];}};Fax[_0x16ff('0x19')]['syncNewExten']=function(_0x5babdd){if(this[_0x16ff('0x8')][_0x5babdd[_0x16ff('0x1e')]]){for(var _0x982ea2 in _0x5babdd['variable']){if(_0x5babdd[_0x16ff('0x23')][_0x16ff('0x1c')](_0x982ea2)){this[_0x16ff('0x8')][_0x5babdd[_0x16ff('0x1e')]][_0x982ea2]=_0x5babdd[_0x16ff('0x24')];}}}};Fax[_0x16ff('0x19')]['syncFaxStatus']=function(_0x133311){if(this['channels'][_0x133311['uniqueid']]){this[_0x16ff('0x8')][_0x133311[_0x16ff('0x1e')]]['operation']=_0x133311[_0x16ff('0x27')];this[_0x16ff('0x8')][_0x133311[_0x16ff('0x1e')]][_0x16ff('0x28')]=_0x133311[_0x16ff('0x28')];this[_0x16ff('0x8')][_0x133311[_0x16ff('0x1e')]][_0x16ff('0x29')]=_0x133311[_0x16ff('0x29')];this[_0x16ff('0x8')][_0x133311[_0x16ff('0x1e')]][_0x16ff('0x2a')]=_0x133311[_0x16ff('0x2a')];logger[_0x16ff('0x21')](_0x133311['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x16ff('0x19')][_0x16ff('0x15')]=function(_0x49b58f){var _0xed0a9d=this;if(this[_0x16ff('0x8')][_0x49b58f[_0x16ff('0x1e')]]){var _0x1f5474=this['channels'][_0x49b58f['uniqueid']]['id'];this[_0x16ff('0x8')][_0x49b58f[_0x16ff('0x1e')]][_0x16ff('0x2b')]=_0x49b58f['remotestationid'];this[_0x16ff('0x8')][_0x49b58f['uniqueid']][_0x16ff('0x2c')]=_0x49b58f[_0x16ff('0x2c')];this[_0x16ff('0x8')][_0x49b58f[_0x16ff('0x1e')]][_0x16ff('0x29')]=_0x49b58f[_0x16ff('0x29')];this[_0x16ff('0x8')][_0x49b58f[_0x16ff('0x1e')]]['resolution']=_0x49b58f[_0x16ff('0x2d')];this['channels'][_0x49b58f[_0x16ff('0x1e')]][_0x16ff('0x2e')]=_0x49b58f[_0x16ff('0x2e')];this[_0x16ff('0x8')][_0x49b58f[_0x16ff('0x1e')]][_0x16ff('0x2a')]=_0x49b58f[_0x16ff('0x2a')];this[_0x16ff('0x8')][_0x49b58f[_0x16ff('0x1e')]][_0x16ff('0x2f')]=_0x49b58f[_0x16ff('0x2f')];if(this['channels'][_0x49b58f[_0x16ff('0x1e')]][_0x16ff('0x2c')]>0x0){tiff2pdf(_0x49b58f[_0x16ff('0x2a')],_0x16ff('0x30'),function(_0x438fe7){logger[_0x16ff('0x21')](_0x49b58f[_0x16ff('0x1e')],'\x20result\x20conversion\x20file\x20',_0x438fe7[_0x16ff('0x31')]);attachment[_0x16ff('0x32')]({'name':path[_0x16ff('0x33')](_0x49b58f[_0x16ff('0x2a')])[_0x16ff('0x20')],'basename':path[_0x16ff('0x33')](_0x49b58f['filename'])['name']+'.pdf','type':'application/pdf'})[_0x16ff('0x34')](function(_0x383e45){faxAccount[_0x16ff('0x35')](_0x1f5474,{'from':_0x49b58f[_0x16ff('0x2f')],'mapKey':_0x16ff('0x36'),'body':path[_0x16ff('0x33')](_0x49b58f['filename'])[_0x16ff('0x20')]+_0x16ff('0x37'),'AttachmentId':_0x383e45['id']})[_0x16ff('0x38')](function(_0x338df6){logger[_0x16ff('0x39')](_0x49b58f['uniqueid'],_0x16ff('0x3a'),JSON[_0x16ff('0x3b')](_0x338df6));});})[_0x16ff('0x38')](function(_0x47b160){logger[_0x16ff('0x39')](_0x49b58f[_0x16ff('0x1e')],_0x16ff('0x3c'),JSON[_0x16ff('0x3b')](_0x47b160));});});}logger[_0x16ff('0x21')](_0x49b58f[_0x16ff('0x1e')],'\x20receiveFax\x20');}};Fax['prototype']['syncOriginateResponse']=function(_0x5b2a66){if(this[_0x16ff('0xb')][_0x5b2a66[_0x16ff('0x1e')]]){_[_0x16ff('0x3d')](this[_0x16ff('0x8')][_0x5b2a66['uniqueid']],_[_0x16ff('0x3e')](_0x5b2a66,[_0x16ff('0x3f'),_0x16ff('0x40')]));}};function updateStatus(_0x459283){if(_0x459283[_0x16ff('0x41')]){faxMessage[_0x16ff('0x42')](_0x459283[_0x16ff('0x41')],{'failMessage':_0x16ff('0x43')})[_0x16ff('0x34')](function(_0xd6e57b){ut[_0x16ff('0x44')](_0x16ff('0x45'),_0xd6e57b);})['catch'](function(_0x5674a1){ut[_0x16ff('0x44')](_0x16ff('0x46'),_0x5674a1);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x16ff('0x19')][_0x16ff('0x47')]=function(_0x252fd6,_0x2a1c24,_0x44001d){var _0x54207d=this;var _0x239c25={};if(_0x2a1c24){_0x239c25={'read':_0x2a1c24};}else{_0x239c25={'failMessage':_0x44001d};}if(this['actions'][_0x252fd6]['AttachmentId']){faxMessage[_0x16ff('0x42')](this['actions'][_0x252fd6]['AttachmentId'],_0x239c25)[_0x16ff('0x34')](function(_0x4e4a81){ut[_0x16ff('0x44')]('[Fax][Message][Updated]',_0x4e4a81);})[_0x16ff('0x38')](function(_0x2a64db){ut['logger'](_0x16ff('0x48'),_0x2a64db);})[_0x16ff('0x49')](function(){delete _0x54207d[_0x16ff('0x8')][_0x252fd6];delete _0x54207d[_0x16ff('0xb')][_0x252fd6];});}else{ut[_0x16ff('0x44')](_0x16ff('0x4a'));delete this[_0x16ff('0x8')][_0x252fd6];delete this[_0x16ff('0xb')][_0x252fd6];}};Fax[_0x16ff('0x19')][_0x16ff('0x17')]=function(_0xc558c4){var _0x2c78ac=this;if(this['channels'][_0xc558c4[_0x16ff('0x1e')]]){if(this[_0x16ff('0xb')][_0xc558c4[_0x16ff('0x1e')]]){this[_0x16ff('0x8')][_0xc558c4[_0x16ff('0x1e')]]['id']=this[_0x16ff('0xb')][_0xc558c4[_0x16ff('0x1e')]]['id'];this[_0x16ff('0x8')][_0xc558c4[_0x16ff('0x1e')]]['name']=this[_0x16ff('0xb')][_0xc558c4[_0x16ff('0x1e')]]['name'];}logger[_0x16ff('0x21')](_0xc558c4[_0x16ff('0x1e')],this['actions'][_0xc558c4[_0x16ff('0x1e')]]?_0x16ff('0x4b'):'\x20hangup\x20faxRiceive\x20',JSON[_0x16ff('0x3b')](this[_0x16ff('0x8')][_0xc558c4[_0x16ff('0x1e')]]));if(this[_0x16ff('0xb')][_0xc558c4['uniqueid']]){if(this[_0x16ff('0x8')][_0xc558c4[_0x16ff('0x1e')]]['faxpages']>0x0&&this[_0x16ff('0x8')][_0xc558c4[_0x16ff('0x1e')]][_0x16ff('0x12')]===_0x16ff('0x4c')){this[_0x16ff('0x47')](_0xc558c4[_0x16ff('0x1e')],!![]);}else{this[_0x16ff('0x47')](_0xc558c4[_0x16ff('0x1e')],![],this['channels'][_0xc558c4[_0x16ff('0x1e')]][_0x16ff('0x4d')]?_0x16ff('0x4e')+this['channels'][_0xc558c4[_0x16ff('0x1e')]][_0x16ff('0x4d')]:_0x16ff('0x4f'));}}}};Fax[_0x16ff('0x19')][_0x16ff('0x50')]=function(_0x3992af){var _0x15fed7=this;return new BPromise(function(_0x535029,_0x12ac3c){_0x15fed7['execOriginate'](_0x3992af,_0x15fed7['faxAccounts'][_0x3992af[_0x16ff('0x51')]])['then'](function(_0x5e6206){ut[_0x16ff('0x44')](_0x16ff('0x52'),_0x5e6206);_0x535029(ut[_0x16ff('0x31')](_0x16ff('0x53')));})[_0x16ff('0x38')](function(_0x36aaf4){ut[_0x16ff('0x44')](_0x16ff('0x54'),_0x36aaf4);updateStatus(_0x3992af);_0x12ac3c(ut[_0x16ff('0x31')](_0x16ff('0x55')));});});};Fax[_0x16ff('0x19')][_0x16ff('0x56')]=function(_0xc12cc9){var _0x23e1ba=this;return new BPromise(function(_0x3d5f03,_0x201045){var _0x39066b=_0x23e1ba[_0x16ff('0x57')](_0x23e1ba[_0x16ff('0x9')][_0xc12cc9[_0x16ff('0x51')]][_0x16ff('0x58')],_0xc12cc9);if(_0x39066b[_0x16ff('0x59')]){_0x3d5f03(ut['message'](_0x16ff('0x5a')));}else{_0x201045(ut['message'](_0x39066b[_0x16ff('0x31')]));}});};function originate(_0x2ab477,_0x15b0af,_0x3528db){return new BPromise(function(_0x35938a,_0x11dca4){if(_0x3528db){var _0x4c52d1=util[_0x16ff('0x5b')](_0x16ff('0x5c'),path[_0x16ff('0x33')](_0x2ab477[_0x16ff('0x1')])[_0x16ff('0x20')],_0x2ab477[_0x16ff('0x1')]);gs['execute'](_0x4c52d1)[_0x16ff('0x34')](function(){_0x2ab477['path']=util[_0x16ff('0x5b')](_0x16ff('0x5d'),path['parse'](_0x2ab477['path'])['dir'],path[_0x16ff('0x33')](_0x2ab477[_0x16ff('0x1')])[_0x16ff('0x20')]);_0x15b0af['XMF-PATH']=_0x2ab477[_0x16ff('0x1')];ut['logger'](_0x16ff('0x5e'),'');ami['Action'](ut[_0x16ff('0x5f')](_0x2ab477,_0x15b0af))['then'](function(_0x32b93c){_0x35938a(_0x32b93c);})[_0x16ff('0x38')](function(_0x5080da){_0x11dca4(_0x5080da);});})[_0x16ff('0x38')](function(_0x46bb10){_0x11dca4(_0x46bb10);});}else{ami['Action'](ut[_0x16ff('0x5f')](_0x2ab477,_0x15b0af))[_0x16ff('0x34')](function(_0x1239e3){_0x35938a(_0x1239e3);})['catch'](function(_0x436b4e){_0x11dca4(_0x436b4e);});}});}Fax['prototype'][_0x16ff('0x60')]=function(_0xbfe410,_0x2f827b){var _0x118eea=this;return new BPromise(function(_0x298796,_0x24f258){var _0x1aef61=uuid['v4']();var _0x5321a7=ut['addVariables'](_0xbfe410,_0x2f827b);_0x118eea[_0x16ff('0xb')][_0x1aef61]=new Action(_0x1aef61,_0x2f827b,_0xbfe410);var _0xc96abc=_0x118eea[_0x16ff('0xb')][_0x1aef61];if(path[_0x16ff('0x33')](_0xbfe410[_0x16ff('0x1')])[_0x16ff('0x61')]===_0x16ff('0x37')){originate(_0xc96abc,_0x5321a7,!![])[_0x16ff('0x34')](function(_0xa58196){_0x298796(_0xa58196);})[_0x16ff('0x38')](function(_0x3b8a13){_0x24f258(_0x3b8a13);});}else{originate(_0xc96abc,_0x5321a7,![])[_0x16ff('0x34')](function(_0x477f5){_0x298796(_0x477f5);})['catch'](function(_0x3975cf){_0x24f258(_0x3975cf);});}});};Fax[_0x16ff('0x19')]['isTrunkReachable']=function(_0x38a40a){return!_['isNil'](_0x38a40a)&&!_[_0x16ff('0x62')](_0x38a40a['name'])&&!_[_0x16ff('0x62')](_0x38a40a[_0x16ff('0x63')])&&_0x38a40a[_0x16ff('0x63')]&&!_[_0x16ff('0x62')](this['trunks'][util['format'](_0x16ff('0x64'),_0x38a40a[_0x16ff('0x20')])])&&!_[_0x16ff('0x62')](this[_0x16ff('0xa')][util[_0x16ff('0x5b')](_0x16ff('0x64'),_0x38a40a[_0x16ff('0x20')])][_0x16ff('0x28')])&&(this[_0x16ff('0xa')][util[_0x16ff('0x5b')](_0x16ff('0x64'),_0x38a40a[_0x16ff('0x20')])][_0x16ff('0x28')]===_0x16ff('0x65')||this[_0x16ff('0xa')][util[_0x16ff('0x5b')]('SIP/%s',_0x38a40a[_0x16ff('0x20')])]['status']===_0x16ff('0x66'));};Fax['prototype'][_0x16ff('0x57')]=function(_0x1e3fdf,_0xee6732){if(!this[_0x16ff('0x67')](_0x1e3fdf)){ut['logger'](_0x16ff('0x68'),_[_0x16ff('0x62')](_0x1e3fdf)?'':_0x1e3fdf['name']+_0x16ff('0x69'));return{'isValid':![],'message':_0x16ff('0x6a')};}if(_[_0x16ff('0x62')](_0xee6732['fax'])){ut[_0x16ff('0x44')](_0x16ff('0x6b'),JSON[_0x16ff('0x3b')](_0xee6732));return{'isValid':![],'message':_0x16ff('0x6c')};}if(_[_0x16ff('0x62')](_0xee6732[_0x16ff('0x1')])){ut[_0x16ff('0x44')](_0x16ff('0x6d'),JSON[_0x16ff('0x3b')](_0xee6732));return{'isValid':![],'message':_0x16ff('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x16ff('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 025a66c..1e3eb76 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 _0xb4f4=['resolve','then','notify','catch','bluebird','../../../config/logger','preview','lodash','error','inspect'];(function(_0x26b6fe,_0x4a15dc){var _0x2cefd4=function(_0x1d817f){while(--_0x1d817f){_0x26b6fe['push'](_0x26b6fe['shift']());}};_0x2cefd4(++_0x4a15dc);}(_0xb4f4,0x68));var _0x4b4f=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xb4f4[_0x17406a];return _0x1501ff;};'use strict';var util=require('util');var BPromise=require(_0x4b4f('0x0'));var logger=require(_0x4b4f('0x1'))(_0x4b4f('0x2'));var _=require(_0x4b4f('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5cd4fd){return function(_0x31ba84){logger[_0x4b4f('0x4')](_0x5cd4fd,util[_0x4b4f('0x5')](_0x31ba84,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x212f6c,_0x173bed){return BPromise[_0x4b4f('0x6')]()[_0x4b4f('0x7')](faxAccount[_0x4b4f('0x8')](_0x212f6c,_0x173bed))[_0x4b4f('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xdc6d=['error','inspect','notify','resolve','[Notify]\x20','preview','lodash','../rpc/faxAccount'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xdc6d,0x1cd));var _0xddc6=function(_0x1cc774,_0x50379b){_0x1cc774=_0x1cc774-0x0;var _0x57997a=_0xdc6d[_0x1cc774];return _0x57997a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xddc6('0x0'));var _=require(_0xddc6('0x1'));var faxAccount=require(_0xddc6('0x2'));function loggerCatch(_0x50771f){return function(_0x1dabf2){logger[_0xddc6('0x3')](_0x50771f,util[_0xddc6('0x4')](_0x1dabf2,{'showHidden':![],'depth':null}));};}exports[_0xddc6('0x5')]=function(_0x9221ac,_0x227a64){return BPromise[_0xddc6('0x6')]()['then'](faxAccount[_0xddc6('0x5')](_0x9221ac,_0x227a64))['catch'](loggerCatch(_0xddc6('0x7')));}; \ 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 ff72ef5..3918d38 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 _0xf2b7=['../../../../config/logger','fax','bluebird','child_process','exec','execute','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x104d06,_0x45acf9){var _0x220cd9=function(_0x1c0a30){while(--_0x1c0a30){_0x104d06['push'](_0x104d06['shift']());}};_0x220cd9(++_0x45acf9);}(_0xf2b7,0x87));var _0x7f2b=function(_0x550c4d,_0x430798){_0x550c4d=_0x550c4d-0x0;var _0x10077b=_0xf2b7[_0x550c4d];return _0x10077b;};'use strict';var util=require('util');var logger=require(_0x7f2b('0x0'))(_0x7f2b('0x1'));var BPromise=require(_0x7f2b('0x2'));var exec=require(_0x7f2b('0x3'))[_0x7f2b('0x4')];exports[_0x7f2b('0x5')]=function(_0x242820){return new BPromise(function(_0x4fb50d,_0x9bd128){exec(_0x242820,function(_0x51afd8,_0x14ca9a,_0x4a18e1){logger['info']('Exec\x20gs',_0x14ca9a);if(_0x51afd8){logger['info'](_0x7f2b('0x6'),_0x7f2b('0x7'),util[_0x7f2b('0x8')](_0x51afd8,{'showHidden':![],'depth':null}),_0x14ca9a,_0x4a18e1);_0x9bd128(_0x51afd8);}_0x4fb50d(_0x14ca9a);});});}; \ No newline at end of file +var _0x2257=['../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x2257,0xbd));var _0x7225=function(_0x2a1d82,_0x39bca0){_0x2a1d82=_0x2a1d82-0x0;var _0x161244=_0x2257[_0x2a1d82];return _0x161244;};'use strict';var util=require(_0x7225('0x0'));var logger=require(_0x7225('0x1'))(_0x7225('0x2'));var BPromise=require(_0x7225('0x3'));var exec=require(_0x7225('0x4'))[_0x7225('0x5')];exports[_0x7225('0x6')]=function(_0x1d4220){return new BPromise(function(_0x4b7500,_0x37c7b9){exec(_0x1d4220,function(_0x44db81,_0x532663,_0xe989c2){logger[_0x7225('0x7')](_0x7225('0x8'),_0x532663);if(_0x44db81){logger[_0x7225('0x7')](_0x7225('0x8'),_0x7225('0x9'),util['inspect'](_0x44db81,{'showHidden':![],'depth':null}),_0x532663,_0xe989c2);_0x37c7b9(_0x44db81);}_0x4b7500(_0x532663);});});}; \ 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 8ad5014..393413e 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 _0x9cea=['../../../../config/logger','message','info','inspect','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','lodash','moment'];(function(_0x1058ac,_0x62763e){var _0x101f1b=function(_0x41292d){while(--_0x41292d){_0x1058ac['push'](_0x1058ac['shift']());}};_0x101f1b(++_0x62763e);}(_0x9cea,0x9f));var _0xa9ce=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x9cea[_0x173441];return _0x2423a8;};'use strict';var util=require('util');var _=require(_0xa9ce('0x0'));var moment=require(_0xa9ce('0x1'));var logger=require(_0xa9ce('0x2'))('fax');exports[_0xa9ce('0x3')]=function(_0x2eec35){return{'message':_0x2eec35};};exports['logger']=function(_0x41f4a6,_0x269ac4){logger[_0xa9ce('0x4')](_0x41f4a6,util[_0xa9ce('0x5')](_0x269ac4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x15278e,_0x19c20c){var _0x31076c={'XMF-ECM':_0x19c20c['ecm'],'XMF-HEADERINFO':_0x19c20c['headerinfo'],'XMF-MINRATE':_0x19c20c[_0xa9ce('0x6')],'XMF-MAXRATE':_0x19c20c[_0xa9ce('0x7')],'XMF-MODEM':util[_0xa9ce('0x8')](_0xa9ce('0x9'),_0x19c20c[_0xa9ce('0xa')]),'XMF-GATEWAY':_0x19c20c[_0xa9ce('0xb')],'XMF-FAXDETECT':_0x19c20c[_0xa9ce('0xc')],'XMF-T38TIMEOUT':_0x19c20c[_0xa9ce('0xd')],'XMF-LOCALSTATIONID':_0x19c20c[_0xa9ce('0xe')],'XMF-PATH':_0x15278e[_0xa9ce('0xf')]};return _0x31076c;};exports['variablesAction']=function(_0x3cee65,_0x55636a){return{'actionid':_0x3cee65[_0xa9ce('0x10')],'action':_0xa9ce('0x11'),'channel':_0x3cee65[_0xa9ce('0x12')],'Exten':_0xa9ce('0x13'),'Context':_0xa9ce('0x14'),'Priority':'1','callerid':util['format'](_0xa9ce('0x15'),_0x3cee65[_0xa9ce('0x16')]?_0x3cee65[_0xa9ce('0x16')]:'',_0x3cee65[_0xa9ce('0xe')]),'variable':_0x55636a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3cee65['uniqueid']};}; \ No newline at end of file +var _0x1b6d=['t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway'];(function(_0x36e7ef,_0x2b60f0){var _0x2d31ea=function(_0x2583e9){while(--_0x2583e9){_0x36e7ef['push'](_0x36e7ef['shift']());}};_0x2d31ea(++_0x2b60f0);}(_0x1b6d,0x1eb));var _0xd1b6=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1b6d[_0x27af45];return _0x18df21;};'use strict';var util=require(_0xd1b6('0x0'));var _=require(_0xd1b6('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x28fb52){return{'message':_0x28fb52};};exports[_0xd1b6('0x2')]=function(_0x566fd4,_0x5133cf){logger[_0xd1b6('0x3')](_0x566fd4,util[_0xd1b6('0x4')](_0x5133cf,{'showHidden':![],'depth':null}));};exports[_0xd1b6('0x5')]=function(_0x1d738c,_0x54750e){var _0x52e4cc={'XMF-ECM':_0x54750e[_0xd1b6('0x6')],'XMF-HEADERINFO':_0x54750e[_0xd1b6('0x7')],'XMF-MINRATE':_0x54750e[_0xd1b6('0x8')],'XMF-MAXRATE':_0x54750e[_0xd1b6('0x9')],'XMF-MODEM':util[_0xd1b6('0xa')]('\x22%s\x22',_0x54750e[_0xd1b6('0xb')]),'XMF-GATEWAY':_0x54750e[_0xd1b6('0xc')],'XMF-FAXDETECT':_0x54750e['faxdetect'],'XMF-T38TIMEOUT':_0x54750e[_0xd1b6('0xd')],'XMF-LOCALSTATIONID':_0x54750e[_0xd1b6('0xe')],'XMF-PATH':_0x1d738c[_0xd1b6('0xf')]};return _0x52e4cc;};exports[_0xd1b6('0x10')]=function(_0x25eb8f,_0x42bde0){return{'actionid':_0x25eb8f[_0xd1b6('0x11')],'action':'originate','channel':_0x25eb8f[_0xd1b6('0x12')],'Exten':_0xd1b6('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0xd1b6('0xa')](_0xd1b6('0x14'),_0x25eb8f[_0xd1b6('0x7')]?_0x25eb8f[_0xd1b6('0x7')]:'',_0x25eb8f[_0xd1b6('0xe')]),'variable':_0x42bde0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x25eb8f[_0xd1b6('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d00bdc7..6728239 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 _0xc524=['getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','sync','error','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts'];(function(_0x4efe4b,_0x2af93c){var _0x63e206=function(_0x2d2844){while(--_0x2d2844){_0x4efe4b['push'](_0x4efe4b['shift']());}};_0x63e206(++_0x2af93c);}(_0xc524,0xe5));var _0x4c52=function(_0x135641,_0x3e6ad1){_0x135641=_0x135641-0x0;var _0x5a0e07=_0xc524[_0x135641];return _0x5a0e07;};'use strict';var util=require(_0x4c52('0x0'));var moment=require(_0x4c52('0x1'));var server=require(_0x4c52('0x2'));var Realtime=require(_0x4c52('0x3'));var Report=require(_0x4c52('0x4'));var Acw=require('./acw');var Trigger=require(_0x4c52('0x5'));var Dialer=require(_0x4c52('0x6'));var Preview=require(_0x4c52('0x7'));var Fax=require('./fax');var user=require(_0x4c52('0x8'));var voiceQueue=require(_0x4c52('0x9'));var voiceQueueReport=require(_0x4c52('0xa'));var voiceCallReport=require(_0x4c52('0xb'));var trunk=require(_0x4c52('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x4c52('0xd'));var cmHopperHistory=require(_0x4c52('0xe'));var campaign=require(_0x4c52('0xf'));var voiceExtension=require(_0x4c52('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x4c52('0x11'));var salesforce=require(_0x4c52('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x4c52('0x13'));var desk=require(_0x4c52('0x14'));var zoho=require(_0x4c52('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x4c52('0x16'));var servicenow=require(_0x4c52('0x17'));var dynamics365=require(_0x4c52('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x4c52('0x19'))(_0x4c52('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4c52('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x4c52('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4c52('0x1d')]()[_0x4c52('0x1e')](user[_0x4c52('0x1f')]())['then'](realtime[_0x4c52('0x20')]())[_0x4c52('0x1e')](user[_0x4c52('0x21')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x22')]())[_0x4c52('0x1e')](trunk['getTrunks']())['then'](realtime[_0x4c52('0x23')]())['then'](voiceQueue[_0x4c52('0x24')]())[_0x4c52('0x1e')](realtime['initVoiceQueues']())[_0x4c52('0x1e')](trigger['getTriggers']())[_0x4c52('0x1e')](realtime[_0x4c52('0x25')]())['then'](template['getTemplates']())['then'](realtime['initTemplates']())[_0x4c52('0x1e')](zendesk[_0x4c52('0x26')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x27')]())[_0x4c52('0x1e')](salesforce[_0x4c52('0x28')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x29')]())[_0x4c52('0x1e')](sugarcrm[_0x4c52('0x2a')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x2b')]())['then'](freshdesk[_0x4c52('0x2c')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x2d')]())[_0x4c52('0x1e')](desk['getDeskAccounts']())[_0x4c52('0x1e')](realtime[_0x4c52('0x2e')]())[_0x4c52('0x1e')](zoho[_0x4c52('0x2f')]())['then'](realtime[_0x4c52('0x30')]())[_0x4c52('0x1e')](vtiger[_0x4c52('0x31')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x32')]())['then'](freshsales[_0x4c52('0x33')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x34')]())[_0x4c52('0x1e')](servicenow['getServicenowAccounts']())['then'](realtime[_0x4c52('0x35')]())[_0x4c52('0x1e')](dynamics365[_0x4c52('0x36')]())[_0x4c52('0x1e')](realtime['initDynamics365Accounts']())[_0x4c52('0x1e')](campaign[_0x4c52('0x37')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x38')]())[_0x4c52('0x1e')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x4c52('0x39')]())[_0x4c52('0x1e')](faxAccount['getFaxAccounts']())[_0x4c52('0x1e')](realtime[_0x4c52('0x3a')]())[_0x4c52('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x4c52('0x1d')]()['then'](voiceQueueReport[_0x4c52('0x3b')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x3c')]())[_0x4c52('0x1e')](cmHopperHistory[_0x4c52('0x3d')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x3e')]())['then'](cmHopperHistory[_0x4c52('0x3f')]())[_0x4c52('0x1e')](realtime[_0x4c52('0x40')]())[_0x4c52('0x1e')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x4c52('0x41')]())[_0x4c52('0x42')](function(_0x4bc85a){logger['error']('[index.js][initParams]',util['inspect'](_0x4bc85a,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x4c52('0x1e')](function(){return initRealtime();})[_0x4c52('0x1e')](function(){return initParams();})[_0x4c52('0x1e')](function(){report[_0x4c52('0x43')]();setInterval(initRealtime,0x1388);})[_0x4c52('0x42')](function(_0x568c4d){logger[_0x4c52('0x44')]('[index.js][main]',util['inspect'](_0x568c4d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf55a=['getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0xf55a,0xd7));var _0xaf55=function(_0x37e687,_0x42b78c){_0x37e687=_0x37e687-0x0;var _0x2a0256=_0xf55a[_0x37e687];return _0x2a0256;};'use strict';var util=require(_0xaf55('0x0'));var moment=require(_0xaf55('0x1'));var server=require(_0xaf55('0x2'));var Realtime=require(_0xaf55('0x3'));var Report=require(_0xaf55('0x4'));var Acw=require(_0xaf55('0x5'));var Trigger=require(_0xaf55('0x6'));var Dialer=require(_0xaf55('0x7'));var Preview=require('./preview');var Fax=require(_0xaf55('0x8'));var user=require(_0xaf55('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xaf55('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xaf55('0xb'));var trigger=require(_0xaf55('0xc'));var template=require(_0xaf55('0xd'));var cmHopperHistory=require(_0xaf55('0xe'));var campaign=require(_0xaf55('0xf'));var voiceExtension=require(_0xaf55('0x10'));var faxAccount=require(_0xaf55('0x11'));var zendesk=require(_0xaf55('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xaf55('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xaf55('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xaf55('0x15'));var freshsales=require(_0xaf55('0x16'));var servicenow=require(_0xaf55('0x17'));var dynamics365=require(_0xaf55('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xaf55('0x19'))(_0xaf55('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xaf55('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xaf55('0x1c')](_0xaf55('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xaf55('0x1d')]()['then'](user[_0xaf55('0x1e')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x20')]())['then'](user[_0xaf55('0x21')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x22')]())['then'](trunk[_0xaf55('0x23')]())[_0xaf55('0x1f')](realtime['initTrunks']())[_0xaf55('0x1f')](voiceQueue[_0xaf55('0x24')]())[_0xaf55('0x1f')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0xaf55('0x1f')](realtime[_0xaf55('0x25')]())['then'](template[_0xaf55('0x26')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x27')]())['then'](zendesk['getZendeskAccounts']())['then'](realtime[_0xaf55('0x28')]())[_0xaf55('0x1f')](salesforce[_0xaf55('0x29')]())['then'](realtime[_0xaf55('0x2a')]())[_0xaf55('0x1f')](sugarcrm['getSugarcrmAccounts']())[_0xaf55('0x1f')](realtime[_0xaf55('0x2b')]())[_0xaf55('0x1f')](freshdesk[_0xaf55('0x2c')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x2d')]())[_0xaf55('0x1f')](desk[_0xaf55('0x2e')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x2f')]())[_0xaf55('0x1f')](zoho['getZohoAccounts']())['then'](realtime[_0xaf55('0x30')]())[_0xaf55('0x1f')](vtiger[_0xaf55('0x31')]())[_0xaf55('0x1f')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())[_0xaf55('0x1f')](realtime[_0xaf55('0x32')]())[_0xaf55('0x1f')](servicenow[_0xaf55('0x33')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x34')]())[_0xaf55('0x1f')](dynamics365['getDynamics365Accounts']())['then'](realtime['initDynamics365Accounts']())[_0xaf55('0x1f')](campaign[_0xaf55('0x35')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x36')]())[_0xaf55('0x1f')](voiceExtension['getVoiceExtensions']())[_0xaf55('0x1f')](realtime[_0xaf55('0x37')]())[_0xaf55('0x1f')](faxAccount['getFaxAccounts']())[_0xaf55('0x1f')](realtime[_0xaf55('0x38')]())[_0xaf55('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0xaf55('0x1d')]()[_0xaf55('0x1f')](voiceQueueReport[_0xaf55('0x39')]())[_0xaf55('0x1f')](realtime[_0xaf55('0x3a')]())[_0xaf55('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xaf55('0x3b')]())[_0xaf55('0x1f')](cmHopperHistory[_0xaf55('0x3c')]())[_0xaf55('0x1f')](realtime['initCampaignHopperHistory']())[_0xaf55('0x1f')](voiceCallReport[_0xaf55('0x3d')]())['then'](realtime['initVoiceCallReports']())[_0xaf55('0x3e')](function(_0x19ac18){logger[_0xaf55('0x3f')](_0xaf55('0x40'),util[_0xaf55('0x41')](_0x19ac18,{'showHidden':![],'depth':null}));});}function main(){return server[_0xaf55('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xaf55('0x43')]();setInterval(initRealtime,0x1388);})[_0xaf55('0x3e')](function(_0x3ea1ee){logger[_0xaf55('0x3f')]('[index.js][main]',util[_0xaf55('0x41')](_0x3ea1ee,{'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 4f0fb4a..b88b7b1 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 _0x6255=['talking','statePause','format','voiceStatusCallerIdNumber','onhold','stringify','emit','user:presence','exports','lodash','util','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6255,0x199));var _0x5625=function(_0x3c7152,_0x302b29){_0x3c7152=_0x3c7152-0x0;var _0x43aea5=_0x6255[_0x3c7152];return _0x43aea5;};'use strict';var _=require(_0x5625('0x0'));var util=require(_0x5625('0x1'));var moment=require(_0x5625('0x2'));var md5=require('md5');var Redis=require(_0x5625('0x3'));var config=require(_0x5625('0x4'));config['redis']=_[_0x5625('0x5')](config[_0x5625('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5625('0x7'))(new Redis(config[_0x5625('0x6')]));function Agent(_0x143cd0){this['id']=_0x143cd0['id']||0x0;this[_0x5625('0x8')]=_0x143cd0[_0x5625('0x8')]||'';this[_0x5625('0x9')]=_0x143cd0['email']||'';this[_0x5625('0xa')]=_0x143cd0[_0x5625('0xa')]||'';this[_0x5625('0xb')]=_0x143cd0[_0x5625('0xb')]||'';this[_0x5625('0xc')]=_0x5625('0xd');this[_0x5625('0xe')]=0x0;this[_0x5625('0xf')]=_0x5625('0xd');this[_0x5625('0x10')]='';this['phone']='';this[_0x5625('0x11')]='';this[_0x5625('0x12')]='';this['online']=_0x143cd0[_0x5625('0x13')]||![];this[_0x5625('0x14')]='unknown';this[_0x5625('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x5625('0x16')]='';this['onhold']=![];this[_0x5625('0x17')]=![];this[_0x5625('0x18')]='';}Agent[_0x5625('0x19')][_0x5625('0x1a')]=function(_0x8ff771){var _0x4b72f8;if(_0x8ff771&&_0x8ff771[_0x5625('0xc')]){_0x4b72f8=_0x8ff771['state'][_0x5625('0x1b')]();switch(_0x4b72f8){case _0x5625('0x1c'):_0x4b72f8=_0x5625('0x1d');break;case _0x5625('0x1e'):_0x4b72f8=_0x5625('0x1f');break;}}if(_0x4b72f8&&this['voiceStatus']!==_0x4b72f8||_0x8ff771[_0x5625('0x20')]){this[_0x5625('0x15')]=_['toNumber'](moment()[_0x5625('0x21')]('x'));}if(_0x4b72f8){this['voiceStatus']=_0x4b72f8;}var _0x3f3633={'id':this['id'],'name':this[_0x5625('0x8')],'email':this[_0x5625('0x9')],'accountcode':this[_0x5625('0xa')],'fullname':this[_0x5625('0xb')],'state':this[_0x5625('0xc')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x5625('0x10')],'online':this[_0x5625('0x13')],'voiceStatus':this[_0x5625('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x5625('0x22')],'voiceStatusQueue':this[_0x5625('0x16')],'interface':this[_0x5625('0x12')],'onhold':this[_0x5625('0x23')]};var _0x131301=md5(JSON[_0x5625('0x24')](_0x3f3633));if(this[_0x5625('0x18')]!==_0x131301){this[_0x5625('0x18')]=_0x131301;io['to'](util['format']('user:%s',_0x3f3633[_0x5625('0x8')]))[_0x5625('0x25')]('user:ami:update',_['omit'](_0x3f3633,['online']));io[_0x5625('0x25')](_0x5625('0x26'),_0x3f3633);}};module[_0x5625('0x27')]=Agent; \ No newline at end of file +var _0x4718=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','voiceStatus','statePause','toNumber','format','emit','user:ami:update','omit','user:presence','lodash','util','moment'];(function(_0x9289ef,_0x3781ba){var _0x55f620=function(_0x4db3c2){while(--_0x4db3c2){_0x9289ef['push'](_0x9289ef['shift']());}};_0x55f620(++_0x3781ba);}(_0x4718,0x18d));var _0x8471=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x4718[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x8471('0x0'));var util=require(_0x8471('0x1'));var moment=require(_0x8471('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x8471('0x3'));config[_0x8471('0x4')]=_[_0x8471('0x5')](config[_0x8471('0x4')],{'host':_0x8471('0x6'),'port':0x18eb});var io=require(_0x8471('0x7'))(new Redis(config[_0x8471('0x4')]));function Agent(_0x155fc9){this['id']=_0x155fc9['id']||0x0;this[_0x8471('0x8')]=_0x155fc9['name']||'';this[_0x8471('0x9')]=_0x155fc9[_0x8471('0x9')]||'';this[_0x8471('0xa')]=_0x155fc9[_0x8471('0xa')]||'';this[_0x8471('0xb')]=_0x155fc9[_0x8471('0xb')]||'';this[_0x8471('0xc')]=_0x8471('0xd');this[_0x8471('0xe')]=0x0;this[_0x8471('0xf')]=_0x8471('0xd');this[_0x8471('0x10')]='';this['phone']='';this[_0x8471('0x11')]='';this[_0x8471('0x12')]='';this[_0x8471('0x13')]=_0x155fc9[_0x8471('0x13')]||![];this['voiceStatus']='unknown';this[_0x8471('0x14')]=0x0;this[_0x8471('0x15')]='';this[_0x8471('0x16')]='';this[_0x8471('0x17')]=![];this[_0x8471('0x18')]=![];this[_0x8471('0x19')]='';}Agent[_0x8471('0x1a')][_0x8471('0x1b')]=function(_0x5aafa2){var _0x140155;if(_0x5aafa2&&_0x5aafa2[_0x8471('0xc')]){_0x140155=_0x5aafa2[_0x8471('0xc')][_0x8471('0x1c')]();switch(_0x140155){case'not_inuse':_0x140155=_0x8471('0x1d');break;case _0x8471('0x1e'):_0x140155=_0x8471('0x1f');break;}}if(_0x140155&&this[_0x8471('0x20')]!==_0x140155||_0x5aafa2[_0x8471('0x21')]){this[_0x8471('0x14')]=_[_0x8471('0x22')](moment()[_0x8471('0x23')]('x'));}if(_0x140155){this[_0x8471('0x20')]=_0x140155;}var _0x2b2391={'id':this['id'],'name':this['name'],'email':this[_0x8471('0x9')],'accountcode':this['accountcode'],'fullname':this[_0x8471('0xb')],'state':this[_0x8471('0xc')],'stateTime':this[_0x8471('0xe')],'status':this[_0x8471('0xf')],'address':this['address'],'online':this[_0x8471('0x13')],'voiceStatus':this[_0x8471('0x20')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x8471('0x16')],'interface':this[_0x8471('0x12')],'onhold':this[_0x8471('0x17')]};var _0x32d6f3=md5(JSON['stringify'](_0x2b2391));if(this[_0x8471('0x19')]!==_0x32d6f3){this[_0x8471('0x19')]=_0x32d6f3;io['to'](util[_0x8471('0x23')]('user:%s',_0x2b2391[_0x8471('0x8')]))[_0x8471('0x24')](_0x8471('0x25'),_[_0x8471('0x26')](_0x2b2391,[_0x8471('0x13')]));io[_0x8471('0x24')](_0x8471('0x27'),_0x2b2391);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b2e4bbb..578bbf2 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 _0x2dd8=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','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','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x4a1f8c,_0x4afb0a){var _0x399326=function(_0x2eb8ba){while(--_0x2eb8ba){_0x4a1f8c['push'](_0x4a1f8c['shift']());}};_0x399326(++_0x4afb0a);}(_0x2dd8,0xbe));var _0x82dd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dd8[_0x501510];return _0x1e6ee5;};'use strict';function Campaign(_0x22e01e){this['id']=_0x22e01e['id']||0x0;this[_0x82dd('0x0')]=_0x22e01e[_0x82dd('0x0')]||'';this[_0x82dd('0x1')]=_0x22e01e[_0x82dd('0x1')]||'campaign';this[_0x82dd('0x2')]=0x0;this[_0x82dd('0x3')]=0x0;this[_0x82dd('0x4')]=0x0;this[_0x82dd('0x5')]=0x0;this[_0x82dd('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x82dd('0x7')]=_0x22e01e[_0x82dd('0x7')];this[_0x82dd('0x8')]=_0x22e01e['limitCalls'];this[_0x82dd('0x9')]=_0x22e01e[_0x82dd('0x9')]||null;this['dialGlobalInterval']=_0x22e01e[_0x82dd('0xa')]?_0x22e01e[_0x82dd('0xa')]:null;this[_0x82dd('0xb')]=_0x22e01e[_0x82dd('0xb')];this['dialOriginateCallerIdNumber']=_0x22e01e[_0x82dd('0xc')];this['dialOriginateTimeout']=_0x22e01e[_0x82dd('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x22e01e[_0x82dd('0xe')];this[_0x82dd('0xf')]=_0x22e01e[_0x82dd('0xf')];this[_0x82dd('0x10')]=_0x22e01e[_0x82dd('0x10')];this[_0x82dd('0x11')]=_0x22e01e[_0x82dd('0x11')];this['dialNoAnswerMaxRetry']=_0x22e01e[_0x82dd('0x12')];this['dialNoAnswerRetryFrequency']=_0x22e01e[_0x82dd('0x13')];this[_0x82dd('0x14')]=_0x22e01e[_0x82dd('0x14')];this[_0x82dd('0x15')]=_0x22e01e[_0x82dd('0x15')]||0x3;this[_0x82dd('0x16')]=_0x22e01e[_0x82dd('0x16')]||0x96;this[_0x82dd('0x17')]=_0x22e01e[_0x82dd('0x17')]||0x3;this['dialDropRetryFrequency']=_0x22e01e[_0x82dd('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x22e01e[_0x82dd('0x19')]||0x3;this[_0x82dd('0x1a')]=_0x22e01e['dialAbandonedRetryFrequency']||0x96;this[_0x82dd('0x1b')]=_0x22e01e['dialMachineMaxRetry']||0x3;this[_0x82dd('0x1c')]=_0x22e01e[_0x82dd('0x1c')]||0x96;this[_0x82dd('0x1d')]=_0x22e01e[_0x82dd('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x22e01e[_0x82dd('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x22e01e[_0x82dd('0x1f')]||_0x82dd('0x20');this[_0x82dd('0x21')]=_0x22e01e[_0x82dd('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x22e01e[_0x82dd('0x22')]||undefined;this[_0x82dd('0x23')]=_0x22e01e['dialCutDigit']||undefined;this['TrunkBackup']=_0x22e01e['TrunkBackup']?_0x22e01e[_0x82dd('0x24')]:undefined;this['Trunk']=_0x22e01e[_0x82dd('0x25')]?_0x22e01e['Trunk']:undefined;this['Interval']=_0x22e01e[_0x82dd('0x26')]?_0x22e01e[_0x82dd('0x26')]:undefined;this[_0x82dd('0x27')]=_0x22e01e[_0x82dd('0x27')]?_0x22e01e['SquareProject']:undefined;this[_0x82dd('0x28')]=_0x22e01e[_0x82dd('0x27')]?_0x22e01e[_0x82dd('0x27')][_0x82dd('0x0')]:undefined;this[_0x82dd('0x29')]=_0x22e01e[_0x82dd('0x29')]||![];this[_0x82dd('0x2a')]=_0x22e01e['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x22e01e[_0x82dd('0x2b')];this[_0x82dd('0x2c')]=_0x22e01e[_0x82dd('0x2c')];this['dialAMDTotalAnalysisTime']=_0x22e01e['dialAMDTotalAnalysisTime'];this[_0x82dd('0x2d')]=_0x22e01e[_0x82dd('0x2d')];this[_0x82dd('0x2e')]=_0x22e01e['dialAMDBetweenWordsSilence'];this[_0x82dd('0x2f')]=_0x22e01e[_0x82dd('0x2f')];this[_0x82dd('0x30')]=_0x22e01e[_0x82dd('0x30')];this[_0x82dd('0x31')]=_0x22e01e[_0x82dd('0x31')];}module[_0x82dd('0x32')]=Campaign; \ No newline at end of file +var _0x7b33=['ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp'];(function(_0xe4f48c,_0x8c2b60){var _0x59456f=function(_0x4d5729){while(--_0x4d5729){_0xe4f48c['push'](_0xe4f48c['shift']());}};_0x59456f(++_0x8c2b60);}(_0x7b33,0x116));var _0x37b3=function(_0x98ad6,_0x4b9cbc){_0x98ad6=_0x98ad6-0x0;var _0x12a627=_0x7b33[_0x98ad6];return _0x12a627;};'use strict';function Campaign(_0x1407ba){this['id']=_0x1407ba['id']||0x0;this['name']=_0x1407ba[_0x37b3('0x0')]||'';this[_0x37b3('0x1')]=_0x1407ba[_0x37b3('0x1')]||'campaign';this[_0x37b3('0x2')]=0x0;this[_0x37b3('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x37b3('0x4')]=0x0;this[_0x37b3('0x5')]='';this[_0x37b3('0x6')]=!![];this['active']=_0x1407ba['active'];this['limitCalls']=_0x1407ba[_0x37b3('0x7')];this[_0x37b3('0x8')]=_0x1407ba[_0x37b3('0x8')]||null;this[_0x37b3('0x9')]=_0x1407ba['dialGlobalInterval']?_0x1407ba[_0x37b3('0x9')]:null;this[_0x37b3('0xa')]=_0x1407ba[_0x37b3('0xa')];this[_0x37b3('0xb')]=_0x1407ba[_0x37b3('0xb')];this['dialOriginateTimeout']=_0x1407ba['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x1407ba[_0x37b3('0xc')];this[_0x37b3('0xd')]=_0x1407ba[_0x37b3('0xd')];this[_0x37b3('0xe')]=_0x1407ba[_0x37b3('0xe')];this[_0x37b3('0xf')]=_0x1407ba[_0x37b3('0xf')];this[_0x37b3('0x10')]=_0x1407ba[_0x37b3('0x10')];this[_0x37b3('0x11')]=_0x1407ba['dialNoAnswerRetryFrequency'];this[_0x37b3('0x12')]=_0x1407ba[_0x37b3('0x12')];this[_0x37b3('0x13')]=_0x1407ba[_0x37b3('0x13')]||0x3;this[_0x37b3('0x14')]=_0x1407ba[_0x37b3('0x14')]||0x96;this[_0x37b3('0x15')]=_0x1407ba[_0x37b3('0x15')]||0x3;this[_0x37b3('0x16')]=_0x1407ba[_0x37b3('0x16')]||0x96;this[_0x37b3('0x17')]=_0x1407ba[_0x37b3('0x17')]||0x3;this[_0x37b3('0x18')]=_0x1407ba[_0x37b3('0x18')]||0x96;this[_0x37b3('0x19')]=_0x1407ba[_0x37b3('0x19')]||0x3;this[_0x37b3('0x1a')]=_0x1407ba[_0x37b3('0x1a')]||0x96;this[_0x37b3('0x1b')]=_0x1407ba[_0x37b3('0x1b')]||0x3;this[_0x37b3('0x1c')]=_0x1407ba[_0x37b3('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x1407ba[_0x37b3('0x1d')]||_0x37b3('0x1e');this[_0x37b3('0x1f')]=_0x1407ba[_0x37b3('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1407ba['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x1407ba[_0x37b3('0x20')]||undefined;this[_0x37b3('0x21')]=_0x1407ba[_0x37b3('0x21')]?_0x1407ba[_0x37b3('0x21')]:undefined;this[_0x37b3('0x22')]=_0x1407ba[_0x37b3('0x22')]?_0x1407ba[_0x37b3('0x22')]:undefined;this[_0x37b3('0x23')]=_0x1407ba['Interval']?_0x1407ba[_0x37b3('0x23')]:undefined;this[_0x37b3('0x24')]=_0x1407ba[_0x37b3('0x24')]?_0x1407ba[_0x37b3('0x24')]:undefined;this['dialQueueProject']=_0x1407ba[_0x37b3('0x24')]?_0x1407ba[_0x37b3('0x24')]['name']:undefined;this[_0x37b3('0x25')]=_0x1407ba['dialAMDActive']||![];this[_0x37b3('0x26')]=_0x1407ba[_0x37b3('0x26')];this[_0x37b3('0x27')]=_0x1407ba[_0x37b3('0x27')];this[_0x37b3('0x28')]=_0x1407ba[_0x37b3('0x28')];this[_0x37b3('0x29')]=_0x1407ba[_0x37b3('0x29')];this[_0x37b3('0x2a')]=_0x1407ba[_0x37b3('0x2a')];this[_0x37b3('0x2b')]=_0x1407ba[_0x37b3('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x1407ba['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1407ba[_0x37b3('0x2c')];this[_0x37b3('0x2d')]=_0x1407ba[_0x37b3('0x2d')];}module[_0x37b3('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c0754dc..6a2e295 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 _0x1956=['answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x1956,0x15c));var _0x6195=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x1956[_0x277107];return _0x1da046;};'use strict';function Channel(){this[_0x6195('0x0')]=null;this[_0x6195('0x1')]='';this[_0x6195('0x2')]='';this[_0x6195('0x3')]=0x0;this[_0x6195('0x4')]='';this[_0x6195('0x5')]=undefined;this[_0x6195('0x6')]=undefined;this['accountcode']=0x0;this[_0x6195('0x7')]='';this[_0x6195('0x8')]=0x0;this[_0x6195('0x9')]=0x0;this[_0x6195('0xa')]=0x0;this[_0x6195('0xb')]=![];this[_0x6195('0xc')]=null;this[_0x6195('0xd')]=null;this[_0x6195('0xe')]=![];this[_0x6195('0xf')]=![];this['lastapplication']='';this[_0x6195('0x10')]='';this[_0x6195('0x11')]=0x0;this[_0x6195('0x12')]=0x0;this[_0x6195('0x13')]=0x0;this[_0x6195('0x14')]=null;this['tag']=null;this[_0x6195('0x15')]=null;this[_0x6195('0x16')]=![];this['monitorFilename']=null;this[_0x6195('0x17')]=null;this[_0x6195('0x18')]=[];this[_0x6195('0x19')]=undefined;this[_0x6195('0x1a')]=undefined;this[_0x6195('0x1b')]=undefined;this[_0x6195('0x1c')]=0x0;}module[_0x6195('0x1d')]=Channel; \ No newline at end of file +var _0x431b=['calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','endtime','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel'];(function(_0x208e93,_0x486a87){var _0x4077e8=function(_0x478161){while(--_0x478161){_0x208e93['push'](_0x208e93['shift']());}};_0x4077e8(++_0x486a87);}(_0x431b,0x18d));var _0xb431=function(_0x4b38a,_0x45fdf7){_0x4b38a=_0x4b38a-0x0;var _0xf0592b=_0x431b[_0x4b38a];return _0xf0592b;};'use strict';function Channel(){this[_0xb431('0x0')]=null;this[_0xb431('0x1')]='';this[_0xb431('0x2')]='';this['calleridnum']=0x0;this[_0xb431('0x3')]='';this[_0xb431('0x4')]=undefined;this[_0xb431('0x5')]=undefined;this[_0xb431('0x6')]=0x0;this[_0xb431('0x7')]='';this[_0xb431('0x8')]=0x0;this[_0xb431('0x9')]=0x0;this['exten']=0x0;this[_0xb431('0xa')]=![];this['answertime']=null;this[_0xb431('0xb')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0xb431('0xc')]='';this['lastdata']='';this['duration']=0x0;this[_0xb431('0xd')]=0x0;this[_0xb431('0xe')]=0x0;this[_0xb431('0xf')]=null;this[_0xb431('0x10')]=null;this[_0xb431('0x11')]=null;this[_0xb431('0x12')]=![];this[_0xb431('0x13')]=null;this['queue']=null;this[_0xb431('0x14')]=[];this[_0xb431('0x15')]=undefined;this[_0xb431('0x16')]=undefined;this['transferType']=undefined;this[_0xb431('0x17')]=0x0;}module[_0xb431('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f749507..d437441 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 _0xb577=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x1e1af6,_0x42b93){var _0x8a25b0=function(_0x2d9f44){while(--_0x2d9f44){_0x1e1af6['push'](_0x1e1af6['shift']());}};_0x8a25b0(++_0x42b93);}(_0xb577,0x1c1));var _0x7b57=function(_0x1741c2,_0x22b19c){_0x1741c2=_0x1741c2-0x0;var _0x3ed7d=_0xb577[_0x1741c2];return _0x3ed7d;};'use strict';function DeskAccount(_0x5eccc9){this['id']=_0x5eccc9['id']||0x0;this['name']=_0x5eccc9[_0x7b57('0x0')]||'';this[_0x7b57('0x1')]=_0x5eccc9[_0x7b57('0x1')]||'';this[_0x7b57('0x2')]=_0x5eccc9[_0x7b57('0x2')]||'';this[_0x7b57('0x3')]=_0x5eccc9[_0x7b57('0x3')]||'';this[_0x7b57('0x4')]=_0x5eccc9[_0x7b57('0x4')]||'';this['consumerKey']=_0x5eccc9[_0x7b57('0x5')]||'';this[_0x7b57('0x6')]=_0x5eccc9[_0x7b57('0x6')]||'';this[_0x7b57('0x7')]=_0x5eccc9['token']||'';this[_0x7b57('0x8')]=_0x5eccc9[_0x7b57('0x8')]||'';this[_0x7b57('0x9')]=_0x5eccc9[_0x7b57('0x9')]||'';this['serverUrl']=_0x5eccc9[_0x7b57('0xa')]||'';this[_0x7b57('0xb')]=_0x5eccc9[_0x7b57('0xb')]||{};}module[_0x7b57('0xc')]=DeskAccount; \ No newline at end of file +var _0xc15a=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x2114f9,_0x432630){var _0x1559ce=function(_0x795ae9){while(--_0x795ae9){_0x2114f9['push'](_0x2114f9['shift']());}};_0x1559ce(++_0x432630);}(_0xc15a,0x130));var _0xac15=function(_0x3252cf,_0x344520){_0x3252cf=_0x3252cf-0x0;var _0x4e2968=_0xc15a[_0x3252cf];return _0x4e2968;};'use strict';function DeskAccount(_0x289d84){this['id']=_0x289d84['id']||0x0;this[_0xac15('0x0')]=_0x289d84[_0xac15('0x0')]||'';this[_0xac15('0x1')]=_0x289d84[_0xac15('0x1')]||'';this[_0xac15('0x2')]=_0x289d84[_0xac15('0x2')]||'';this[_0xac15('0x3')]=_0x289d84[_0xac15('0x3')]||'';this[_0xac15('0x4')]=_0x289d84[_0xac15('0x4')]||'';this['consumerKey']=_0x289d84[_0xac15('0x5')]||'';this[_0xac15('0x6')]=_0x289d84['consumerSecret']||'';this['token']=_0x289d84[_0xac15('0x7')]||'';this[_0xac15('0x8')]=_0x289d84['tokenSecret']||'';this[_0xac15('0x9')]=_0x289d84[_0xac15('0x9')]||'';this[_0xac15('0xa')]=_0x289d84[_0xac15('0xa')]||'';this[_0xac15('0xb')]=_0x289d84['Configurations']||{};}module[_0xac15('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5d36ece..5b97c98 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 _0x2229=['Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x4cdecc,_0x321d1a){var _0x3948a9=function(_0x2a247d){while(--_0x2a247d){_0x4cdecc['push'](_0x4cdecc['shift']());}};_0x3948a9(++_0x321d1a);}(_0x2229,0x87));var _0x9222=function(_0x4a60c2,_0x285d27){_0x4a60c2=_0x4a60c2-0x0;var _0x32a906=_0x2229[_0x4a60c2];return _0x32a906;};'use strict';function Dynamics365Account(_0xbfe15a){this['id']=_0xbfe15a['id']||0x0;this[_0x9222('0x0')]=_0xbfe15a['name']||'';this[_0x9222('0x1')]=_0xbfe15a[_0x9222('0x1')]||'';this[_0x9222('0x2')]=_0xbfe15a['password']||'';this[_0x9222('0x3')]=_0xbfe15a['remoteUri']||'';this[_0x9222('0x4')]=_0xbfe15a[_0x9222('0x4')]||'';this[_0x9222('0x5')]=_0xbfe15a[_0x9222('0x5')]||'';this['clientSecret']=_0xbfe15a[_0x9222('0x6')]||{};this['serverUrl']=_0xbfe15a[_0x9222('0x7')]||'';this['modernAuthentication']=_0xbfe15a[_0x9222('0x8')]||![];this['Configurations']=_0xbfe15a[_0x9222('0x9')]||{};this[_0x9222('0xa')]=_0xbfe15a[_0x9222('0xa')]||{};}module[_0x9222('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x9310=['CloudProvider','name','username','password','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9310,0x173));var _0x0931=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9310[_0x3b0731];return _0x4204d7;};'use strict';function Dynamics365Account(_0xe58d14){this['id']=_0xe58d14['id']||0x0;this['name']=_0xe58d14[_0x0931('0x0')]||'';this['username']=_0xe58d14[_0x0931('0x1')]||'';this[_0x0931('0x2')]=_0xe58d14['password']||'';this['remoteUri']=_0xe58d14['remoteUri']||'';this[_0x0931('0x3')]=_0xe58d14[_0x0931('0x3')]||'';this['clientId']=_0xe58d14[_0x0931('0x4')]||'';this[_0x0931('0x5')]=_0xe58d14['clientSecret']||{};this[_0x0931('0x6')]=_0xe58d14[_0x0931('0x6')]||'';this[_0x0931('0x7')]=_0xe58d14[_0x0931('0x7')]||![];this[_0x0931('0x8')]=_0xe58d14[_0x0931('0x8')]||{};this[_0x0931('0x9')]=_0xe58d14['CloudProvider']||{};}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 f59bdcb..63d329c 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 _0x1397=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x254d53,_0xe1ccfd){var _0x3794bd=function(_0x58636d){while(--_0x58636d){_0x254d53['push'](_0x254d53['shift']());}};_0x3794bd(++_0xe1ccfd);}(_0x1397,0xb5));var _0x7139=function(_0x56f0f8,_0x28d84a){_0x56f0f8=_0x56f0f8-0x0;var _0x29c23c=_0x1397[_0x56f0f8];return _0x29c23c;};'use strict';function FaxAccount(_0x2e2504){this['id']=_0x2e2504['id']||0x0;this[_0x7139('0x0')]=_0x2e2504['name']||'';this[_0x7139('0x1')]=_0x2e2504[_0x7139('0x1')];this[_0x7139('0x2')]=_0x2e2504[_0x7139('0x2')];this[_0x7139('0x3')]=_0x2e2504[_0x7139('0x3')];this['localstationid']=_0x2e2504[_0x7139('0x4')];this[_0x7139('0x5')]=_0x2e2504[_0x7139('0x5')]||0x960;this[_0x7139('0x6')]=_0x2e2504[_0x7139('0x6')]||0x3840;this['modem']=_0x2e2504['modem']||_0x7139('0x7');this['gateway']=_0x2e2504['gateway']||'no';this['faxdetect']=_0x2e2504['faxdetect']||'no';this[_0x7139('0x8')]=_0x2e2504[_0x7139('0x8')]||0x1388;this[_0x7139('0x9')]=_0x2e2504[_0x7139('0x9')]||_0x7139('0xa');this[_0x7139('0xb')]=_0x2e2504[_0x7139('0xb')]?_0x2e2504[_0x7139('0xb')]:undefined;this[_0x7139('0xc')]=_0x2e2504['ListId'];this[_0x7139('0xd')]=_0x2e2504['key'];}module[_0x7139('0xe')]=FaxAccount; \ No newline at end of file +var _0xf9d2=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','SIP','Trunk','ListId'];(function(_0x3c51d8,_0x42c35e){var _0x3fe52f=function(_0x564ab4){while(--_0x564ab4){_0x3c51d8['push'](_0x3c51d8['shift']());}};_0x3fe52f(++_0x42c35e);}(_0xf9d2,0x169));var _0x2f9d=function(_0x4bdc44,_0x4146e6){_0x4bdc44=_0x4bdc44-0x0;var _0x2c7278=_0xf9d2[_0x4bdc44];return _0x2c7278;};'use strict';function FaxAccount(_0x5b7509){this['id']=_0x5b7509['id']||0x0;this[_0x2f9d('0x0')]=_0x5b7509[_0x2f9d('0x0')]||'';this[_0x2f9d('0x1')]=_0x5b7509[_0x2f9d('0x1')];this[_0x2f9d('0x2')]=_0x5b7509[_0x2f9d('0x2')];this['headerinfo']=_0x5b7509[_0x2f9d('0x3')];this[_0x2f9d('0x4')]=_0x5b7509[_0x2f9d('0x4')];this[_0x2f9d('0x5')]=_0x5b7509[_0x2f9d('0x5')]||0x960;this[_0x2f9d('0x6')]=_0x5b7509[_0x2f9d('0x6')]||0x3840;this[_0x2f9d('0x7')]=_0x5b7509[_0x2f9d('0x7')]||'v17,v27,v29';this[_0x2f9d('0x8')]=_0x5b7509['gateway']||'no';this[_0x2f9d('0x9')]=_0x5b7509[_0x2f9d('0x9')]||'no';this[_0x2f9d('0xa')]=_0x5b7509[_0x2f9d('0xa')]||0x1388;this['tech']=_0x5b7509['tech']||_0x2f9d('0xb');this[_0x2f9d('0xc')]=_0x5b7509[_0x2f9d('0xc')]?_0x5b7509[_0x2f9d('0xc')]:undefined;this[_0x2f9d('0xd')]=_0x5b7509[_0x2f9d('0xd')];this[_0x2f9d('0xe')]=_0x5b7509[_0x2f9d('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 608d33b..b1c5f86 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 _0x1239=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x40c933,_0x34ed65){var _0x258cfe=function(_0x1d6c20){while(--_0x1d6c20){_0x40c933['push'](_0x40c933['shift']());}};_0x258cfe(++_0x34ed65);}(_0x1239,0x1ca));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';function FreshdeskAccount(_0x532d0e){this['id']=_0x532d0e['id']||0x0;this['name']=_0x532d0e[_0x9123('0x0')]||'';this[_0x9123('0x1')]=_0x532d0e[_0x9123('0x1')]||'';this[_0x9123('0x2')]=_0x532d0e[_0x9123('0x3')]||'';this[_0x9123('0x4')]=_0x532d0e['remoteUri']||'';this[_0x9123('0x5')]=_0x532d0e[_0x9123('0x5')]||'';this[_0x9123('0x6')]=_0x532d0e[_0x9123('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x1ee9=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x158430,_0x208671){var _0x37c35c=function(_0x46f465){while(--_0x46f465){_0x158430['push'](_0x158430['shift']());}};_0x37c35c(++_0x208671);}(_0x1ee9,0x6a));var _0x91ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ee9[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x3d515d){this['id']=_0x3d515d['id']||0x0;this[_0x91ee('0x0')]=_0x3d515d[_0x91ee('0x0')]||'';this[_0x91ee('0x1')]=_0x3d515d['username']||'';this['apiKey']=_0x3d515d[_0x91ee('0x2')]||'';this[_0x91ee('0x3')]=_0x3d515d[_0x91ee('0x3')]||'';this['serverUrl']=_0x3d515d[_0x91ee('0x4')]||'';this[_0x91ee('0x5')]=_0x3d515d[_0x91ee('0x5')]||{};}module[_0x91ee('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f68b190..66a0355 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 _0x2d17=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x2a2324,_0x47283a){var _0x1ba7fa=function(_0x9027c1){while(--_0x9027c1){_0x2a2324['push'](_0x2a2324['shift']());}};_0x1ba7fa(++_0x47283a);}(_0x2d17,0x17e));var _0x72d1=function(_0x69d8bb,_0x241a39){_0x69d8bb=_0x69d8bb-0x0;var _0x3dbb68=_0x2d17[_0x69d8bb];return _0x3dbb68;};'use strict';function FreshsalesAccount(_0x484ae9){this['id']=_0x484ae9['id']||0x0;this[_0x72d1('0x0')]=_0x484ae9['name']||'';this[_0x72d1('0x1')]=_0x484ae9[_0x72d1('0x1')]||'';this['apiKey']=_0x484ae9[_0x72d1('0x2')]||'';this[_0x72d1('0x3')]=_0x484ae9['remoteUri']||'';this[_0x72d1('0x4')]=_0x484ae9['serverUrl']||'';this[_0x72d1('0x5')]=_0x484ae9['Configurations']||{};}module[_0x72d1('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xd101=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd101,0xc1));var _0x1d10=function(_0x3c564e,_0x43380d){_0x3c564e=_0x3c564e-0x0;var _0x4af633=_0xd101[_0x3c564e];return _0x4af633;};'use strict';function FreshsalesAccount(_0x34b53f){this['id']=_0x34b53f['id']||0x0;this['name']=_0x34b53f[_0x1d10('0x0')]||'';this[_0x1d10('0x1')]=_0x34b53f[_0x1d10('0x1')]||'';this[_0x1d10('0x2')]=_0x34b53f[_0x1d10('0x3')]||'';this[_0x1d10('0x4')]=_0x34b53f[_0x1d10('0x4')]||'';this[_0x1d10('0x5')]=_0x34b53f['serverUrl']||'';this[_0x1d10('0x6')]=_0x34b53f[_0x1d10('0x6')]||{};}module[_0x1d10('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 936b2f0..bd1cb4c 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 _0x4461=['routealias','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice'];(function(_0x28f694,_0x2e58dc){var _0x40b606=function(_0x5e1de0){while(--_0x5e1de0){_0x28f694['push'](_0x28f694['shift']());}};_0x40b606(++_0x2e58dc);}(_0x4461,0x1cf));var _0x1446=function(_0x367759,_0x3ccdb9){_0x367759=_0x367759-0x0;var _0x3c8b9f=_0x4461[_0x367759];return _0x3c8b9f;};'use strict';function QueueReport(){this[_0x1446('0x0')]='inbound';this[_0x1446('0x1')]='';this[_0x1446('0x2')]='';this[_0x1446('0x3')]='';this[_0x1446('0x4')]='';this[_0x1446('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x1446('0x6')]=0x1;this[_0x1446('0x7')]=0x1;this[_0x1446('0x8')]=![];this[_0x1446('0x9')]=null;this['queuecallercomplete']=![];this[_0x1446('0xa')]=null;this[_0x1446('0xb')]=![];this[_0x1446('0xc')]=null;this[_0x1446('0xd')]=0x1;this['channel']='';this[_0x1446('0xe')]='';this['connectedlinename']='';this[_0x1446('0xf')]='';this[_0x1446('0x10')]='';this['exten']='';this[_0x1446('0x11')]='';this[_0x1446('0x12')]=0x0;this[_0x1446('0x13')]=![];this[_0x1446('0x14')]='';this[_0x1446('0x15')]=_0x1446('0x16');this[_0x1446('0x17')]=null;this[_0x1446('0x18')]=0x0;this[_0x1446('0x19')]={};}module[_0x1446('0x1a')]=QueueReport; \ No newline at end of file +var _0xa412=['holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority'];(function(_0xe85462,_0x3e1750){var _0x18886d=function(_0xd896e0){while(--_0xd896e0){_0xe85462['push'](_0xe85462['shift']());}};_0x18886d(++_0x3e1750);}(_0xa412,0x10e));var _0x2a41=function(_0x4fce86,_0x24a2a7){_0x4fce86=_0x4fce86-0x0;var _0x3fc5ef=_0xa412[_0x4fce86];return _0x3fc5ef;};'use strict';function QueueReport(){this[_0x2a41('0x0')]=_0x2a41('0x1');this[_0x2a41('0x2')]='';this[_0x2a41('0x3')]='';this[_0x2a41('0x4')]='';this[_0x2a41('0x5')]='';this[_0x2a41('0x6')]=null;this[_0x2a41('0x7')]=null;this[_0x2a41('0x8')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x2a41('0x9')]=null;this[_0x2a41('0xa')]=![];this[_0x2a41('0xb')]=null;this[_0x2a41('0xc')]=![];this[_0x2a41('0xd')]=null;this[_0x2a41('0xe')]=0x1;this[_0x2a41('0xf')]='';this[_0x2a41('0x10')]='';this[_0x2a41('0x11')]='';this['accountcode']='';this['context']='';this[_0x2a41('0x12')]='';this[_0x2a41('0x13')]='';this[_0x2a41('0x14')]=0x0;this[_0x2a41('0x15')]=![];this[_0x2a41('0x16')]='';this[_0x2a41('0x17')]=_0x2a41('0x18');this[_0x2a41('0x19')]=null;this[_0x2a41('0x1a')]=0x0;this[_0x2a41('0x1b')]={};}module[_0x2a41('0x1c')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 47ef71c..376755d 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 _0xe0e8=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x4a29c6,_0x4d7493){var _0x3b1a96=function(_0x35822e){while(--_0x35822e){_0x4a29c6['push'](_0x4a29c6['shift']());}};_0x3b1a96(++_0x4d7493);}(_0xe0e8,0x182));var _0x8e0e=function(_0x4cca4e,_0x582ff5){_0x4cca4e=_0x4cca4e-0x0;var _0x69f11f=_0xe0e8[_0x4cca4e];return _0x69f11f;};'use strict';function SalesforceAccount(_0x5c9f8c){this['id']=_0x5c9f8c['id']||0x0;this[_0x8e0e('0x0')]=_0x5c9f8c[_0x8e0e('0x0')]||'';this[_0x8e0e('0x1')]=_0x5c9f8c['username']||'';this[_0x8e0e('0x2')]=_0x5c9f8c[_0x8e0e('0x2')]||'';this[_0x8e0e('0x3')]=_0x5c9f8c[_0x8e0e('0x3')]||'';this[_0x8e0e('0x4')]=_0x5c9f8c[_0x8e0e('0x4')]||'';this[_0x8e0e('0x5')]=_0x5c9f8c['clientSecret']||'';this[_0x8e0e('0x6')]=_0x5c9f8c[_0x8e0e('0x6')]||'';this['type']=_0x5c9f8c[_0x8e0e('0x7')]||_0x8e0e('0x8');this[_0x8e0e('0x9')]=_0x5c9f8c[_0x8e0e('0x9')]||'';this[_0x8e0e('0xa')]=_0x5c9f8c[_0x8e0e('0xa')]||{};}module[_0x8e0e('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x8a5d=['remoteUri','password','clientId','clientSecret','type','integrationTab','Configurations','exports','name','username'];(function(_0x1ed1d8,_0x384889){var _0x4f145d=function(_0x1c3380){while(--_0x1c3380){_0x1ed1d8['push'](_0x1ed1d8['shift']());}};_0x4f145d(++_0x384889);}(_0x8a5d,0xbc));var _0xd8a5=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8a5d[_0x1deb03];return _0x189fe7;};'use strict';function SalesforceAccount(_0xc64230){this['id']=_0xc64230['id']||0x0;this['name']=_0xc64230[_0xd8a5('0x0')]||'';this[_0xd8a5('0x1')]=_0xc64230['username']||'';this[_0xd8a5('0x2')]=_0xc64230[_0xd8a5('0x2')]||'';this[_0xd8a5('0x3')]=_0xc64230[_0xd8a5('0x3')]||'';this['clientId']=_0xc64230[_0xd8a5('0x4')]||'';this['clientSecret']=_0xc64230[_0xd8a5('0x5')]||'';this['securityToken']=_0xc64230['securityToken']||'';this[_0xd8a5('0x6')]=_0xc64230['type']||_0xd8a5('0x7');this['serverUrl']=_0xc64230['serverUrl']||'';this['Configurations']=_0xc64230[_0xd8a5('0x8')]||{};}module[_0xd8a5('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d5bc7e8..7bf3fd5 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 _0x0e37=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x55ec67,_0x1c90d5){var _0x1350f6=function(_0x5ed223){while(--_0x5ed223){_0x55ec67['push'](_0x55ec67['shift']());}};_0x1350f6(++_0x1c90d5);}(_0x0e37,0xc6));var _0x70e3=function(_0x8bd38a,_0x56a6ca){_0x8bd38a=_0x8bd38a-0x0;var _0x3023c2=_0x0e37[_0x8bd38a];return _0x3023c2;};'use strict';function ServicenowAccount(_0x11fb75){this['id']=_0x11fb75['id']||0x0;this[_0x70e3('0x0')]=_0x11fb75['name']||'';this[_0x70e3('0x1')]=_0x11fb75[_0x70e3('0x1')]||'';this[_0x70e3('0x2')]=_0x11fb75['password']||'';this[_0x70e3('0x3')]=_0x11fb75[_0x70e3('0x3')]||'';this['serverUrl']=_0x11fb75[_0x70e3('0x4')]||'';this['Configurations']=_0x11fb75[_0x70e3('0x5')]||{};}module[_0x70e3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x4763=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3f6c5e,_0x534acf){var _0x37be1b=function(_0x57fb47){while(--_0x57fb47){_0x3f6c5e['push'](_0x3f6c5e['shift']());}};_0x37be1b(++_0x534acf);}(_0x4763,0x143));var _0x3476=function(_0x5bca5d,_0x4cf9fc){_0x5bca5d=_0x5bca5d-0x0;var _0x5d6eff=_0x4763[_0x5bca5d];return _0x5d6eff;};'use strict';function ServicenowAccount(_0x4107a4){this['id']=_0x4107a4['id']||0x0;this[_0x3476('0x0')]=_0x4107a4[_0x3476('0x0')]||'';this[_0x3476('0x1')]=_0x4107a4['username']||'';this['password']=_0x4107a4[_0x3476('0x2')]||'';this['remoteUri']=_0x4107a4[_0x3476('0x3')]||'';this['serverUrl']=_0x4107a4[_0x3476('0x4')]||'';this[_0x3476('0x5')]=_0x4107a4[_0x3476('0x5')]||{};}module[_0x3476('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 770375a..67f4136 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 _0x515e=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x31ee91,_0x272005){var _0x2e9410=function(_0x2b9826){while(--_0x2b9826){_0x31ee91['push'](_0x31ee91['shift']());}};_0x2e9410(++_0x272005);}(_0x515e,0xd3));var _0xe515=function(_0x275cbc,_0x2a2ed6){_0x275cbc=_0x275cbc-0x0;var _0xd4e2a8=_0x515e[_0x275cbc];return _0xd4e2a8;};'use strict';function SugarcrmAccount(_0x4abe95){this['id']=_0x4abe95['id']||0x0;this[_0xe515('0x0')]=_0x4abe95[_0xe515('0x0')]||'';this[_0xe515('0x1')]=_0x4abe95[_0xe515('0x1')]||'';this[_0xe515('0x2')]=_0x4abe95['password']||'';this[_0xe515('0x3')]=_0x4abe95[_0xe515('0x3')]||'';this[_0xe515('0x4')]=_0x4abe95[_0xe515('0x4')]||'';this[_0xe515('0x5')]=_0x4abe95[_0xe515('0x5')]||{};}module[_0xe515('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x489d=['Configurations','exports','name','password','serverUrl'];(function(_0x48e748,_0x190ac9){var _0x4e7123=function(_0x39f630){while(--_0x39f630){_0x48e748['push'](_0x48e748['shift']());}};_0x4e7123(++_0x190ac9);}(_0x489d,0x11a));var _0xd489=function(_0x3d754d,_0x71aad){_0x3d754d=_0x3d754d-0x0;var _0x59f912=_0x489d[_0x3d754d];return _0x59f912;};'use strict';function SugarcrmAccount(_0x34c6e2){this['id']=_0x34c6e2['id']||0x0;this[_0xd489('0x0')]=_0x34c6e2[_0xd489('0x0')]||'';this['username']=_0x34c6e2['username']||'';this[_0xd489('0x1')]=_0x34c6e2[_0xd489('0x1')]||'';this['remoteUri']=_0x34c6e2['remoteUri']||'';this[_0xd489('0x2')]=_0x34c6e2['serverUrl']||'';this['Configurations']=_0x34c6e2[_0xd489('0x3')]||{};}module[_0xd489('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 fe3219f..9c58a0f 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 _0x84ae=['accountcode','state','unknown','stateTime','status','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x84ae,0x101));var _0xe84a=function(_0x58053e,_0x5c5ba3){_0x58053e=_0x58053e-0x0;var _0x50f82c=_0x84ae[_0x58053e];return _0x50f82c;};'use strict';function Telephone(_0x9fde07){this['id']=_0x9fde07['id']||0x0;this[_0xe84a('0x0')]=_0x9fde07[_0xe84a('0x0')]||'';this[_0xe84a('0x1')]=_0x9fde07[_0xe84a('0x1')]||'';this[_0xe84a('0x2')]=_0xe84a('0x3');this[_0xe84a('0x4')]=0x0;this[_0xe84a('0x5')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xff83=['status','unknown','name','accountcode','stateTime'];(function(_0x925ed6,_0x43fb78){var _0x520c3b=function(_0x142cdd){while(--_0x142cdd){_0x925ed6['push'](_0x925ed6['shift']());}};_0x520c3b(++_0x43fb78);}(_0xff83,0x98));var _0x3ff8=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xff83[_0x297fd3];return _0x2af381;};'use strict';function Telephone(_0x31bac6){this['id']=_0x31bac6['id']||0x0;this[_0x3ff8('0x0')]=_0x31bac6[_0x3ff8('0x0')]||'';this[_0x3ff8('0x1')]=_0x31bac6[_0x3ff8('0x1')]||'';this['state']='unknown';this[_0x3ff8('0x2')]=0x0;this[_0x3ff8('0x3')]=_0x3ff8('0x4');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index e20d487..cb30254 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(_0x4d5aed,_0x1a756c){var _0x423838=function(_0x2c5cc5){while(--_0x2c5cc5){_0x4d5aed['push'](_0x4d5aed['shift']());}};_0x423838(++_0x1a756c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d2699,_0xbb63f2){_0x5d2699=_0x5d2699-0x0;var _0x2a2ee6=_0xb10b[_0x5d2699];return _0x2a2ee6;};'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 _0xb10b=['name','html'];(function(_0x158116,_0x58eac4){var _0x751a16=function(_0x1679df){while(--_0x1679df){_0x158116['push'](_0x158116['shift']());}};_0x751a16(++_0x58eac4);}(_0xb10b,0x12a));var _0xbb10=function(_0x460dae,_0x3a907f){_0x460dae=_0x460dae-0x0;var _0x36e6d0=_0xb10b[_0x460dae];return _0x36e6d0;};'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 diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 282ba9b..909f603 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1443dd,_0x2d5325){var _0x282579=function(_0x4bc663){while(--_0x4bc663){_0x1443dd['push'](_0x1443dd['shift']());}};_0x282579(++_0x2d5325);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xb29d95,_0x1e51d6){_0xb29d95=_0xb29d95-0x0;var _0x34e9b0=_0x9ffd[_0xb29d95];return _0x34e9b0;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x415cda,_0xf51216){var _0x2d549f=function(_0x102215){while(--_0x102215){_0x415cda['push'](_0x415cda['shift']());}};_0x2d549f(++_0xf51216);}(_0xb10b,0x12a));var _0xbb10=function(_0xdfcf22,_0x322509){_0xdfcf22=_0xdfcf22-0x0;var _0x59b62f=_0xb10b[_0xdfcf22];return _0x59b62f;};'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 22bc36b..c7c27a3 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 _0x127b=['refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','status','unknown','registry','indexOf','host','port'];(function(_0x412e51,_0xd6d8d5){var _0xc7aaf3=function(_0x5c762f){while(--_0x5c762f){_0x412e51['push'](_0x412e51['shift']());}};_0xc7aaf3(++_0xd6d8d5);}(_0x127b,0x1a9));var _0xb127=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x127b[_0x2c7618];return _0x5ce3f0;};'use strict';function Trunk(_0x389d99){this['id']=_0x389d99['id']||0x0;this[_0xb127('0x0')]=_0x389d99[_0xb127('0x0')]||![];this['name']=_0x389d99[_0xb127('0x1')]||'';this[_0xb127('0x2')]='unknown';this['stateTime']=0x0;this[_0xb127('0x3')]=_0xb127('0x4');this[_0xb127('0x5')]=_0x389d99['registry']&&_0x389d99[_0xb127('0x5')][_0xb127('0x6')](':')?_0x389d99[_0xb127('0x5')]['split'](':')[0x0]:'';this[_0xb127('0x7')]='';this[_0xb127('0x8')]='';this['domain']='';this['domainport']='';this[_0xb127('0x9')]='';this[_0xb127('0xa')]=_0xb127('0x4');this[_0xb127('0xb')]='';this[_0xb127('0xc')]='';this['defaultuser']=_0x389d99[_0xb127('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xff2a=['domainport','stateRegistry','address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain'];(function(_0x5d4938,_0x4802e6){var _0x37acbb=function(_0x262ad7){while(--_0x262ad7){_0x5d4938['push'](_0x5d4938['shift']());}};_0x37acbb(++_0x4802e6);}(_0xff2a,0x194));var _0xaff2=function(_0x18b9a8,_0x1770b6){_0x18b9a8=_0x18b9a8-0x0;var _0x4a0a8f=_0xff2a[_0x18b9a8];return _0x4a0a8f;};'use strict';function Trunk(_0x43a132){this['id']=_0x43a132['id']||0x0;this[_0xaff2('0x0')]=_0x43a132[_0xaff2('0x0')]||![];this['name']=_0x43a132[_0xaff2('0x1')]||'';this[_0xaff2('0x2')]=_0xaff2('0x3');this[_0xaff2('0x4')]=0x0;this[_0xaff2('0x5')]=_0xaff2('0x3');this[_0xaff2('0x6')]=_0x43a132[_0xaff2('0x6')]&&_0x43a132['registry'][_0xaff2('0x7')](':')?_0x43a132['registry'][_0xaff2('0x8')](':')[0x0]:'';this[_0xaff2('0x9')]='';this[_0xaff2('0xa')]='';this[_0xaff2('0xb')]='';this[_0xaff2('0xc')]='';this['refresh']='';this[_0xaff2('0xd')]='unknown';this['registrationtime']='';this[_0xaff2('0xe')]='';this['defaultuser']=_0x43a132['defaultuser']||'';}module[_0xaff2('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0d6bf8c..7b040ce 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 _0x2255=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x1ba477,_0x481b45){var _0x2a4d3a=function(_0x5ad123){while(--_0x5ad123){_0x1ba477['push'](_0x1ba477['shift']());}};_0x2a4d3a(++_0x481b45);}(_0x2255,0x187));var _0x5225=function(_0x1b9d4b,_0x4bd421){_0x1b9d4b=_0x1b9d4b-0x0;var _0x1d9dd7=_0x2255[_0x1b9d4b];return _0x1d9dd7;};'use strict';function voiceExtension(_0x2894c8){this['id']=_0x2894c8['id']||0x0;this[_0x5225('0x0')]=_0x2894c8[_0x5225('0x0')]||'';this[_0x5225('0x1')]=_0x2894c8['recordingFormat']||_0x5225('0x2');this[_0x5225('0x3')]=_0x2894c8[_0x5225('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xeb3e=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0xeb3e,0x1d1));var _0xeeb3=function(_0x387e38,_0x55f6e0){_0x387e38=_0x387e38-0x0;var _0x38a45c=_0xeb3e[_0x387e38];return _0x38a45c;};'use strict';function voiceExtension(_0x2adc0d){this['id']=_0x2adc0d['id']||0x0;this[_0xeeb3('0x0')]=_0x2adc0d[_0xeeb3('0x0')]||'';this[_0xeeb3('0x1')]=_0x2adc0d['recordingFormat']||'none';this[_0xeeb3('0x2')]=_0x2adc0d[_0xeeb3('0x2')]||![];}module[_0xeeb3('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 17da434..d4de953 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 _0x077e=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumBillable','abandoned','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0xf9d07d,_0x3c0fe8){var _0x8f6683=function(_0x2fc7b3){while(--_0x2fc7b3){_0xf9d07d['push'](_0xf9d07d['shift']());}};_0x8f6683(++_0x3c0fe8);}(_0x077e,0x14a));var _0xe077=function(_0x3b927d,_0x5172a2){_0x3b927d=_0x3b927d-0x0;var _0x32af9d=_0x077e[_0x3b927d];return _0x32af9d;};'use strict';var monitorFormat={'wav':_0xe077('0x0'),'wav49':_0xe077('0x1'),'gsm':_0xe077('0x2')};var strategy={'fewestcalls':_0xe077('0x3'),'leastrecent':'leastrecent','linear':_0xe077('0x4'),'random':_0xe077('0x5'),'ringall':_0xe077('0x6'),'rr':'roundrobin','rrmemory':_0xe077('0x7'),'rrordered':_0xe077('0x8'),'wrandom':_0xe077('0x9')};function VoiceQueue(_0xe4430c){this['id']=_0xe4430c['id']||0x0;this[_0xe077('0xa')]=_0xe4430c[_0xe077('0xa')]||'';this[_0xe077('0xb')]=_0xe4430c[_0xe077('0xb')]||'';this[_0xe077('0xc')]=_0xe4430c[_0xe077('0xc')]||_0xe077('0xd');this[_0xe077('0xe')]=0x0;this['total']=0x0;this[_0xe077('0xf')]=0x0;this[_0xe077('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0xe077('0x11')]=0x0;this['unmanaged']=0x0;this[_0xe077('0x12')]=0x0;this['available']=0x0;this[_0xe077('0x13')]=0x0;this[_0xe077('0x14')]=0x0;this[_0xe077('0x15')]=0x0;this[_0xe077('0x16')]=0x0;this[_0xe077('0x17')]=0x0;this[_0xe077('0x18')]=0x0;this[_0xe077('0x19')]=0x0;this[_0xe077('0x1a')]=0x0;this[_0xe077('0x1b')]=0x0;this[_0xe077('0x1c')]=0x0;this[_0xe077('0x1d')]=0x0;this['unknown']=0x0;this[_0xe077('0x1e')]=_0xe4430c[_0xe077('0x1e')]||![];this['acwTimeout']=_0xe4430c['acwTimeout']||0xa;this['autopause']=_0xe4430c[_0xe077('0x1f')]||'no';this[_0xe077('0x20')]=!![];this[_0xe077('0x21')]='';this[_0xe077('0x22')]='';this[_0xe077('0x23')]=0x0;this[_0xe077('0x24')]=0x0;this[_0xe077('0x25')]=_0xe4430c[_0xe077('0x25')]||null;this[_0xe077('0x26')]=_0xe4430c[_0xe077('0x26')]?_0xe4430c['dialGlobalInterval']:null;this[_0xe077('0x27')]=_0xe4430c[_0xe077('0x27')];this[_0xe077('0x28')]=_0xe4430c['dialMethod']||_0xe077('0x29');this['dialLimitChannel']=_0xe4430c[_0xe077('0x2a')]||0x0;this[_0xe077('0x2b')]=_0xe4430c[_0xe077('0x2b')]||0x0;this['dialPowerLevel']=_0xe4430c[_0xe077('0x2c')]||0x1;this[_0xe077('0x2d')]=_0xe4430c[_0xe077('0x2d')]||_0xe077('0x2e');this[_0xe077('0x2f')]=_0xe4430c[_0xe077('0x2f')]||0.03;this[_0xe077('0x30')]=_0xe4430c[_0xe077('0x30')]||0x258;this[_0xe077('0x31')]=_0xe4430c['dialOriginateCallerIdName']||_0xe077('0x32');this[_0xe077('0x33')]=_0xe4430c['dialOriginateCallerIdNumber']||_0xe077('0x32');this[_0xe077('0x34')]=_0xe4430c[_0xe077('0x34')]||0x1e;this[_0xe077('0x35')]=_0xe4430c[_0xe077('0x35')]||_0xe077('0x36');this[_0xe077('0x37')]=_0xe4430c[_0xe077('0x37')]||0x3;this['dialQueueProject']=_0xe4430c[_0xe077('0x38')]||undefined;this[_0xe077('0x39')]=_0xe4430c[_0xe077('0x39')]||0x3;this[_0xe077('0x3a')]=_0xe4430c[_0xe077('0x3a')]||0x96;this[_0xe077('0x3b')]=_0xe4430c[_0xe077('0x3b')]||0x3;this[_0xe077('0x3c')]=_0xe4430c[_0xe077('0x3c')]||0x96;this[_0xe077('0x3d')]=_0xe4430c[_0xe077('0x3d')]||0x3;this[_0xe077('0x3e')]=_0xe4430c[_0xe077('0x3e')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xe4430c[_0xe077('0x3f')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xe4430c[_0xe077('0x40')]||0x96;this[_0xe077('0x41')]=_0xe4430c[_0xe077('0x41')]||0x3;this['dialDropRetryFrequency']=_0xe4430c[_0xe077('0x42')]||0x96;this[_0xe077('0x43')]=_0xe4430c[_0xe077('0x43')]||0x3;this[_0xe077('0x44')]=_0xe4430c[_0xe077('0x44')]||0x96;this[_0xe077('0x45')]=_0xe4430c[_0xe077('0x45')]||0x3;this[_0xe077('0x46')]=_0xe4430c[_0xe077('0x46')]||0x96;this[_0xe077('0x47')]=_0xe4430c[_0xe077('0x47')]||0x3;this[_0xe077('0x48')]=_0xe4430c[_0xe077('0x48')]||0x96;this[_0xe077('0x49')]=_0xe4430c[_0xe077('0x49')]||0x3;this['dialGlobalMaxRetry']=_0xe4430c['dialGlobalMaxRetry']||0x4;this[_0xe077('0x4a')]=_0xe4430c[_0xe077('0x4a')]?_0xe4430c['Trunk']:undefined;this['TrunkBackup']=_0xe4430c[_0xe077('0x4b')]?_0xe4430c[_0xe077('0x4b')]:undefined;this[_0xe077('0x4c')]=_0xe4430c[_0xe077('0x4c')]||undefined;this['Interval']=_0xe4430c['Interval']?_0xe4430c[_0xe077('0x4d')]:undefined;this[_0xe077('0x4e')]=_0xe4430c[_0xe077('0x4e')]||_0xe077('0x4f');this[_0xe077('0x50')]=_0xe4430c['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xe077('0x51')]=_0xe4430c['dialCutDigit']||undefined;this['strategy']=strategy[_0xe4430c[_0xe077('0x52')]];this[_0xe077('0x53')]=!![];this[_0xe077('0x54')]=_0xe4430c[_0xe077('0x54')]||![];this[_0xe077('0x55')]=_0xe4430c['dialAMDInitialSilence'];this[_0xe077('0x56')]=_0xe4430c[_0xe077('0x56')];this['dialAMDAfterGreetingSilence']=_0xe4430c[_0xe077('0x57')];this['dialAMDTotalAnalysisTime']=_0xe4430c['dialAMDTotalAnalysisTime'];this[_0xe077('0x58')]=_0xe4430c['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0xe4430c[_0xe077('0x59')];this[_0xe077('0x5a')]=_0xe4430c['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0xe4430c[_0xe077('0x5b')];this[_0xe077('0x5c')]=_0xe4430c['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xe077('0x5d')]=0x0;this[_0xe077('0x5e')]=_0xe4430c[_0xe077('0x5e')];this[_0xe077('0x5f')]=0x0;this[_0xe077('0x60')]=0x0;this[_0xe077('0x61')]=0x0;this[_0xe077('0x62')]=0x0;this[_0xe077('0x63')]=0x0;this[_0xe077('0x64')]=0x0;this[_0xe077('0x65')]=0x0;this[_0xe077('0x66')]=0x0;this[_0xe077('0x67')]=0x0;this[_0xe077('0x68')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xe077('0x69')]=0x0;this[_0xe077('0x6a')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xe077('0x6b')]=undefined;this[_0xe077('0x6c')]=undefined;this[_0xe077('0x6d')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xe077('0x6e')]=0x0;this[_0xe077('0x6f')]=0x0;this[_0xe077('0x70')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xe077('0x71')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xe077('0x72')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0xe4430c[_0xe077('0x73')]||0x14;this['predictiveIntervalMinThreshold']=_0xe4430c[_0xe077('0x73')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xe077('0x74')]=0x1;this[_0xe077('0x75')]=0x0;this[_0xe077('0x76')]=0x0;this[_0xe077('0x77')]=0x0;this[_0xe077('0x78')]=0x0;this[_0xe077('0x79')]=_0xe4430c['dialRecallMeTimeout']||0x1e;this[_0xe077('0x7a')]=_0xe4430c[_0xe077('0x7a')]||![];this[_0xe077('0x7b')]=!!_0xe4430c[_0xe077('0x7b')]||![];this[_0xe077('0x7c')]=!!_0xe4430c['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0xe4430c[_0xe077('0x7d')]||undefined;this[_0xe077('0x7e')]=_0xe4430c[_0xe077('0x7e')]||![];this['dialAgiAfterHangupAgent']=_0xe4430c[_0xe077('0x7f')]||![];this[_0xe077('0xb')]=monitorFormat[_0xe4430c[_0xe077('0xb')]]?monitorFormat[_0xe4430c[_0xe077('0xb')]]:undefined;this[_0xe077('0x80')]=_0xe4430c[_0xe077('0x80')]||![];this[_0xe077('0x81')]=_0xe4430c[_0xe077('0x81')]?_0xe4430c[_0xe077('0x81')]:undefined;this[_0xe077('0x82')]=![];}module[_0xe077('0x83')]=VoiceQueue; \ No newline at end of file +var _0x58e6=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','acw','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x21816f,_0xa7457f){var _0x349acb=function(_0x5c14d4){while(--_0x5c14d4){_0x21816f['push'](_0x21816f['shift']());}};_0x349acb(++_0xa7457f);}(_0x58e6,0x1c2));var _0x658e=function(_0x7782a,_0x1bd90b){_0x7782a=_0x7782a-0x0;var _0x55eec6=_0x58e6[_0x7782a];return _0x55eec6;};'use strict';var monitorFormat={'wav':_0x658e('0x0'),'wav49':_0x658e('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0x658e('0x2'),'random':'random','ringall':_0x658e('0x3'),'rr':_0x658e('0x4'),'rrmemory':_0x658e('0x5'),'rrordered':_0x658e('0x6'),'wrandom':_0x658e('0x7')};function VoiceQueue(_0x2add44){this['id']=_0x2add44['id']||0x0;this[_0x658e('0x8')]=_0x2add44['name']||'';this['monitor_format']=_0x2add44[_0x658e('0x9')]||'';this[_0x658e('0xa')]=_0x2add44[_0x658e('0xa')]||'inbound';this[_0x658e('0xb')]=0x0;this[_0x658e('0xc')]=0x0;this[_0x658e('0xd')]=0x0;this[_0x658e('0xe')]=0x0;this[_0x658e('0xf')]=0x0;this[_0x658e('0x10')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x658e('0x11')]=0x0;this[_0x658e('0x12')]=0x0;this[_0x658e('0x13')]=0x0;this[_0x658e('0x14')]=0x0;this[_0x658e('0x15')]=0x0;this[_0x658e('0x16')]=0x0;this[_0x658e('0x17')]=0x0;this['paused']=0x0;this[_0x658e('0x18')]=0x0;this[_0x658e('0x19')]=0x0;this[_0x658e('0x1a')]=0x0;this[_0x658e('0x1b')]=0x0;this['unknown']=0x0;this[_0x658e('0x1c')]=_0x2add44[_0x658e('0x1c')]||![];this['acwTimeout']=_0x2add44['acwTimeout']||0xa;this[_0x658e('0x1d')]=_0x2add44[_0x658e('0x1d')]||'no';this[_0x658e('0x1e')]=!![];this['message']='';this[_0x658e('0x1f')]='';this['originated']=0x0;this[_0x658e('0x20')]=0x0;this[_0x658e('0x21')]=_0x2add44[_0x658e('0x21')]||null;this[_0x658e('0x22')]=_0x2add44[_0x658e('0x22')]?_0x2add44[_0x658e('0x22')]:null;this['dialActive']=_0x2add44[_0x658e('0x23')];this[_0x658e('0x24')]=_0x2add44[_0x658e('0x24')]||_0x658e('0x25');this[_0x658e('0x26')]=_0x2add44['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x2add44[_0x658e('0x27')]||0x0;this[_0x658e('0x28')]=_0x2add44['dialPowerLevel']||0x1;this[_0x658e('0x29')]=_0x2add44[_0x658e('0x29')]||_0x658e('0x2a');this[_0x658e('0x2b')]=_0x2add44['dialPredictiveOptimizationPercentage']||0.03;this[_0x658e('0x2c')]=_0x2add44[_0x658e('0x2c')]||0x258;this[_0x658e('0x2d')]=_0x2add44[_0x658e('0x2d')]||_0x658e('0x2e');this[_0x658e('0x2f')]=_0x2add44[_0x658e('0x2f')]||_0x658e('0x2e');this[_0x658e('0x30')]=_0x2add44[_0x658e('0x30')]||0x1e;this[_0x658e('0x31')]=_0x2add44['dialQueueOptions']||_0x658e('0x32');this[_0x658e('0x33')]=_0x2add44['dialQueueTimeout']||0x3;this[_0x658e('0x34')]=_0x2add44[_0x658e('0x34')]||undefined;this[_0x658e('0x35')]=_0x2add44[_0x658e('0x35')]||0x3;this[_0x658e('0x36')]=_0x2add44[_0x658e('0x36')]||0x96;this[_0x658e('0x37')]=_0x2add44['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x2add44[_0x658e('0x38')]||0x96;this[_0x658e('0x39')]=_0x2add44[_0x658e('0x39')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2add44[_0x658e('0x3a')]||0x96;this[_0x658e('0x3b')]=_0x2add44[_0x658e('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2add44['dialNoSuchNumberRetryFrequency']||0x96;this[_0x658e('0x3c')]=_0x2add44['dialDropMaxRetry']||0x3;this[_0x658e('0x3d')]=_0x2add44[_0x658e('0x3d')]||0x96;this[_0x658e('0x3e')]=_0x2add44[_0x658e('0x3e')]||0x3;this[_0x658e('0x3f')]=_0x2add44[_0x658e('0x3f')]||0x96;this[_0x658e('0x40')]=_0x2add44['dialMachineMaxRetry']||0x3;this[_0x658e('0x41')]=_0x2add44['dialMachineRetryFrequency']||0x96;this[_0x658e('0x42')]=_0x2add44[_0x658e('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2add44[_0x658e('0x43')]||0x96;this[_0x658e('0x44')]=_0x2add44[_0x658e('0x44')]||0x3;this[_0x658e('0x45')]=_0x2add44['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x2add44[_0x658e('0x46')]?_0x2add44[_0x658e('0x46')]:undefined;this['TrunkBackup']=_0x2add44['TrunkBackup']?_0x2add44[_0x658e('0x47')]:undefined;this['dialPrefix']=_0x2add44[_0x658e('0x48')]||undefined;this[_0x658e('0x49')]=_0x2add44[_0x658e('0x49')]?_0x2add44['Interval']:undefined;this['dialOrderByScheduledAt']=_0x2add44[_0x658e('0x4a')]||'DESC';this[_0x658e('0x4b')]=_0x2add44[_0x658e('0x4b')]||undefined;this[_0x658e('0x4c')]=_0x2add44[_0x658e('0x4c')]||undefined;this[_0x658e('0x4d')]=strategy[_0x2add44[_0x658e('0x4d')]];this[_0x658e('0x4e')]=!![];this[_0x658e('0x4f')]=_0x2add44['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2add44[_0x658e('0x50')];this[_0x658e('0x51')]=_0x2add44['dialAMDGreeting'];this[_0x658e('0x52')]=_0x2add44[_0x658e('0x52')];this[_0x658e('0x53')]=_0x2add44['dialAMDTotalAnalysisTime'];this[_0x658e('0x54')]=_0x2add44['dialAMDMinWordLength'];this[_0x658e('0x55')]=_0x2add44[_0x658e('0x55')];this[_0x658e('0x56')]=_0x2add44[_0x658e('0x56')];this[_0x658e('0x57')]=_0x2add44[_0x658e('0x57')];this[_0x658e('0x58')]=_0x2add44['dialAMDMaximumWordLength'];this[_0x658e('0x59')]=0x0;this['pTalking']=0x0;this['timeout']=_0x2add44[_0x658e('0x5a')];this[_0x658e('0x5b')]=0x0;this[_0x658e('0x5c')]=0x0;this[_0x658e('0x5d')]=0x0;this[_0x658e('0x5e')]=0x0;this[_0x658e('0x5f')]=0x0;this[_0x658e('0x60')]=0x0;this[_0x658e('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x658e('0x62')]=0x0;this[_0x658e('0x63')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x658e('0x64')]=0x0;this[_0x658e('0x65')]=0x0;this[_0x658e('0x66')]=0x0;this['startProgressive']=undefined;this[_0x658e('0x67')]=undefined;this[_0x658e('0x68')]=undefined;this[_0x658e('0x69')]=1.05;this[_0x658e('0x6a')]=0x0;this[_0x658e('0x6b')]=0x0;this[_0x658e('0x6c')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x658e('0x6d')]=0x0;this[_0x658e('0x6e')]=_0x2add44[_0x658e('0x6f')]||0x14;this[_0x658e('0x70')]=_0x2add44[_0x658e('0x6f')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x658e('0x71')]=0x0;this[_0x658e('0x72')]=0x1;this[_0x658e('0x73')]=0x0;this['erlangCallToSecond']=0x0;this[_0x658e('0x74')]=0x0;this[_0x658e('0x75')]=0x0;this[_0x658e('0x76')]=_0x2add44[_0x658e('0x76')]||0x1e;this[_0x658e('0x77')]=_0x2add44[_0x658e('0x77')]||![];this[_0x658e('0x78')]=!!_0x2add44[_0x658e('0x78')]||![];this['dialPreviewRecallmeReminder']=!!_0x2add44[_0x658e('0x79')]||![];this[_0x658e('0x7a')]=_0x2add44['dialQueueProject2']||undefined;this[_0x658e('0x7b')]=_0x2add44['dialAgiAfterHangupClient']||![];this[_0x658e('0x7c')]=_0x2add44[_0x658e('0x7c')]||![];this['monitor_format']=monitorFormat[_0x2add44[_0x658e('0x9')]]?monitorFormat[_0x2add44['monitor_format']]:undefined;this[_0x658e('0x7d')]=_0x2add44[_0x658e('0x7d')]||![];this['mandatoryDispositionPause']=_0x2add44['mandatoryDispositionPause']?_0x2add44[_0x658e('0x7e')]:undefined;this[_0x658e('0x7f')]=![];}module[_0x658e('0x80')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index bcbf4a7..a18f98e 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 _0xe914=['outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','length','online','incall','includes','booked','keys','dialer','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','outboundRejectCallsDay','available','loggedIn','paused','ringing','talking','waiting','answered','loggedInDb','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xe914,0x7f));var _0x4e91=function(_0x5f1d09,_0x18587c){_0x5f1d09=_0x5f1d09-0x0;var _0x4008b1=_0xe914[_0x5f1d09];return _0x4008b1;};'use strict';var INBOUND_COUNTERS=[_0x4e91('0x0'),_0x4e91('0x1'),'loggedInDb',_0x4e91('0x2'),_0x4e91('0x3'),_0x4e91('0x4'),_0x4e91('0x5')];var OUTBOUND_COUNTERS=[_0x4e91('0x0'),_0x4e91('0x6'),'inUse',_0x4e91('0x1'),_0x4e91('0x7'),'originated',_0x4e91('0x8'),_0x4e91('0x9'),_0x4e91('0xa'),_0x4e91('0xb'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0x4e91('0xc'),'outboundReCallsDay','outboundRejectCallsDay',_0x4e91('0xd'),_0x4e91('0x2'),_0x4e91('0xe'),_0x4e91('0x4'),'sumBillable',_0x4e91('0xf'),_0x4e91('0x10'),_0x4e91('0x5')];function VoiceQueueSummary(_0x559670){this['id']=_0x559670['id'];this[_0x4e91('0x11')]=_0x559670[_0x4e91('0x11')];this[_0x4e91('0x12')]=_0x559670[_0x4e91('0x12')];this[_0x4e91('0x13')]=_0x559670[_0x4e91('0x13')]||0x0;this[_0x4e91('0x6')]=_0x559670[_0x4e91('0x6')]||0x0;this[_0x4e91('0x0')]=_0x559670['available']||0x0;this[_0x4e91('0x14')]=_0x559670[_0x4e91('0x14')]||0x0;this[_0x4e91('0x15')]=_0x559670['inUse']||0x0;this[_0x4e91('0x16')]=_0x559670[_0x4e91('0x16')]||0x0;this[_0x4e91('0x1')]=_0x559670[_0x4e91('0x1')]||0x0;this[_0x4e91('0x7')]=_0x559670[_0x4e91('0x7')]||0x0;this[_0x4e91('0x17')]=_0x559670[_0x4e91('0x17')]||0x0;this['notInUse']=_0x559670[_0x4e91('0x18')]||0x0;this[_0x4e91('0x2')]=_0x559670[_0x4e91('0x2')]||0x0;this['ringing']=_0x559670[_0x4e91('0x3')]||0x0;this[_0x4e91('0x19')]=_0x559670['ringInUse'];this[_0x4e91('0x1a')]=_0x559670[_0x4e91('0x1a')];this['sumDuration']=_0x559670[_0x4e91('0xf')];this[_0x4e91('0x1b')]=_0x559670[_0x4e91('0x1b')]||0x0;this['talking']=_0x559670[_0x4e91('0x4')]||0x0;this['total']=_0x559670[_0x4e91('0x10')]||0x0;this[_0x4e91('0x1c')]=_0x559670[_0x4e91('0x1c')];this[_0x4e91('0x1d')]=_0x559670['unavailable']||0x0;this[_0x4e91('0x1e')]=_0x559670['unknown']||0x0;this[_0x4e91('0x1f')]=_0x559670['unmanaged']||0x0;this[_0x4e91('0x5')]=_0x559670['waiting']||0x0;if(_0x559670[_0x4e91('0x1c')]===_0x4e91('0x20')){this[_0x4e91('0xe')]=_0x559670['pTalking']||0x0;this[_0x4e91('0x21')]=_0x559670[_0x4e91('0x21')];this['dialMethod']=_0x559670[_0x4e91('0x22')];this[_0x4e91('0x23')]=_0x559670[_0x4e91('0x23')];this[_0x4e91('0x24')]=_0x559670[_0x4e91('0x24')];this[_0x4e91('0x25')]=_0x559670[_0x4e91('0x25')];this[_0x4e91('0x26')]=_0x559670['dialPrefix'];this['temp']=_0x559670['temp'];this[_0x4e91('0x27')]=_0x559670[_0x4e91('0x27')];this['outboundAnswerCallsDay']=_0x559670[_0x4e91('0x9')];this['outboundBlacklistCallsDay']=_0x559670['outboundBlacklistCallsDay'];this[_0x4e91('0xb')]=_0x559670[_0x4e91('0xb')];this[_0x4e91('0x28')]=_0x559670[_0x4e91('0x28')];this[_0x4e91('0x29')]=_0x559670[_0x4e91('0x29')];this['outboundDropCallsDayCallersExit']=_0x559670['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x559670[_0x4e91('0x2a')];this[_0x4e91('0x2b')]=_0x559670['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x559670['outboundNoSuchCallsDay'];this[_0x4e91('0x2c')]=_0x559670[_0x4e91('0x2c')];this[_0x4e91('0x2d')]=_0x559670[_0x4e91('0x2d')];this['outboundRejectCallsDay']=_0x559670['outboundRejectCallsDay'];this[_0x4e91('0xd')]=_0x559670[_0x4e91('0xd')];this[_0x4e91('0x2e')]=_0x559670[_0x4e91('0x2e')];this[_0x4e91('0x2f')]=_0x559670[_0x4e91('0x2f')];this[_0x4e91('0x30')]=_0x559670[_0x4e91('0x30')];this[_0x4e91('0x31')]=_0x559670[_0x4e91('0x31')];this[_0x4e91('0x32')]=_0x559670['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x559670[_0x4e91('0x33')];this[_0x4e91('0x34')]=_0x559670[_0x4e91('0x34')];this[_0x4e91('0x35')]=_0x559670[_0x4e91('0x35')];this[_0x4e91('0x36')]=_0x559670[_0x4e91('0x36')];this['predictiveIntervalPauses']=_0x559670[_0x4e91('0x37')];this['predictiveIntervalAvailable']=_0x559670['predictiveIntervalAvailable'];this[_0x4e91('0x38')]=_0x559670['predictiveIntervalTotalCalls'];this[_0x4e91('0x39')]=_0x559670[_0x4e91('0x39')];this[_0x4e91('0x3a')]=_0x559670[_0x4e91('0x3a')];this[_0x4e91('0x3b')]=_0x559670[_0x4e91('0x3b')];this[_0x4e91('0x3c')]=_0x559670[_0x4e91('0x3c')];this[_0x4e91('0x3d')]=_0x559670[_0x4e91('0x3d')];this[_0x4e91('0x3e')]=_0x559670[_0x4e91('0x3e')];this[_0x4e91('0x3f')]=_0x559670[_0x4e91('0x3f')];this['message']=_0x559670[_0x4e91('0x40')];this[_0x4e91('0x41')]=_0x559670[_0x4e91('0x41')];}if(_0x559670[_0x4e91('0x42')]){this[_0x4e91('0x42')]={'id':_0x559670[_0x4e91('0x42')]['id'],'name':_0x559670[_0x4e91('0x42')][_0x4e91('0x11')],'active':_0x559670[_0x4e91('0x42')]['active'],'callerid':_0x559670[_0x4e91('0x42')][_0x4e91('0x43')]};}}VoiceQueueSummary[_0x4e91('0x44')]['createReport']=function(_0x53801e,_0x1ea0fa,_0x557cc1,_0x227af4){this[_0x4e91('0x7')]=0x0;this[_0x4e91('0x4')]=0x0;this[_0x4e91('0x2')]=0x0;this[_0x4e91('0x1e')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x4e91('0x16')]=0x0;this[_0x4e91('0x1d')]=0x0;this[_0x4e91('0x3')]=0x0;this[_0x4e91('0x19')]=0x0;this[_0x4e91('0x17')]=0x0;if(_0x557cc1){if(_0x557cc1['available']){this[_0x4e91('0x0')]=Number(_0x557cc1[_0x4e91('0x0')]);}if(_0x557cc1[_0x4e91('0x45')]){this[_0x4e91('0x1')]=Number(_0x557cc1[_0x4e91('0x45')]);}if(_0x557cc1[_0x4e91('0x46')]){this[_0x4e91('0x5')]=Number(_0x557cc1[_0x4e91('0x46')]);}}for(var _0xd653f8=0x0;_0xd653f8<_0x53801e[_0x4e91('0x47')];_0xd653f8++){var _0x3e6efe=_0x1ea0fa['SIP/'+_0x53801e[_0xd653f8][_0x4e91('0x11')]];if(_0x3e6efe&&_0x3e6efe[_0x4e91('0x48')]){this['loggedInDb']+=0x1;}if(_0x53801e[_0xd653f8][_0x4e91('0x49')]==='1'){this[_0x4e91('0x4')]+=0x1;}if(_0x53801e[_0xd653f8][_0x4e91('0x2')]==='1'&&!['2','7','8'][_0x4e91('0x4a')](_0x53801e[_0xd653f8]['status'])){this['paused']+=0x1;}switch(_0x53801e[_0xd653f8]['status']){case'0':this[_0x4e91('0x1e')]+=0x1;break;case'1':this[_0x4e91('0x18')]+=0x1;break;case'2':this[_0x4e91('0x15')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x4e91('0x16')]+=0x1;break;case'5':this[_0x4e91('0x1d')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x4e91('0x17')]+=0x1;break;}}if(this[_0x4e91('0x22')]===_0x4e91('0x4b')){var _0x482681=Object[_0x4e91('0x4c')](_0x227af4);for(var _0x2c401d=0x0;_0x2c401d<_0x482681[_0x4e91('0x47')];_0x2c401d++){var _0x10e9de=_0x482681[_0x2c401d];var _0xdae951=_0x227af4[_0x10e9de];if(_0xdae951['queue']===this[_0x4e91('0x11')]&&_0xdae951[_0x4e91('0x1c')]===_0x4e91('0x4d')&&_0xdae951['exten']==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0x4e91('0x4')]>this['inUse']){this[_0x4e91('0x4')]=this[_0x4e91('0x15')];}this[_0x4e91('0xe')]=0x0;}return this;};VoiceQueueSummary[_0x4e91('0x44')][_0x4e91('0x4e')]=function(_0x3b37e0){var _0x2fb077=![];if(_0x3b37e0){_0x2fb077=INBOUND_COUNTERS[_0x4e91('0x4f')](function(_0x30dba2){return this[_0x30dba2]!==_0x3b37e0[_0x30dba2];},this);}return _0x2fb077;};VoiceQueueSummary[_0x4e91('0x44')][_0x4e91('0x50')]=function(_0x37635b){var _0x249dba=![];var _0x2ad7e4=![];var _0x38d81b=![];if(_0x37635b){_0x249dba=this['dialMethod']!==_0x37635b[_0x4e91('0x22')]||this[_0x4e91('0x21')]!==_0x37635b[_0x4e91('0x21')]||this[_0x4e91('0x40')]!==_0x37635b[_0x4e91('0x40')]||this[_0x4e91('0x41')]!==_0x37635b[_0x4e91('0x41')];_0x2ad7e4=OUTBOUND_COUNTERS[_0x4e91('0x4f')](function(_0x4465f5){return this[_0x4465f5]!==_0x37635b[_0x4465f5];},this);if(this['Trunk']&&_0x37635b[_0x4e91('0x42')]){_0x38d81b=this[_0x4e91('0x42')][_0x4e91('0x11')]!==_0x37635b[_0x4e91('0x42')]['name']||this[_0x4e91('0x42')]['active']!==_0x37635b[_0x4e91('0x42')][_0x4e91('0x51')];}}return _0x249dba||_0x2ad7e4||_0x38d81b;};VoiceQueueSummary['prototype'][_0x4e91('0x52')]=function(_0x5f5d2e){this[_0x4e91('0x6')]=_0x5f5d2e[_0x4e91('0x6')];this['message']=_0x5f5d2e[_0x4e91('0x40')];this[_0x4e91('0x41')]=_0x5f5d2e[_0x4e91('0x41')];this[_0x4e91('0x39')]=_0x5f5d2e['originated'];this[_0x4e91('0x8')]=_0x5f5d2e['outboundAbandonedCallsDay'];this[_0x4e91('0x9')]=_0x5f5d2e[_0x4e91('0x9')];this[_0x4e91('0xa')]=_0x5f5d2e[_0x4e91('0xa')];this[_0x4e91('0xb')]=_0x5f5d2e['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x5f5d2e[_0x4e91('0x28')];this[_0x4e91('0x2b')]=_0x5f5d2e[_0x4e91('0x2b')];this[_0x4e91('0xc')]=_0x5f5d2e[_0x4e91('0xc')];this['outboundReCallsDay']=_0x5f5d2e[_0x4e91('0x2d')];this[_0x4e91('0x53')]=_0x5f5d2e['outboundRejectCallsDay'];this[_0x4e91('0xd')]=_0x5f5d2e[_0x4e91('0xd')];this[_0x4e91('0x1a')]=_0x5f5d2e[_0x4e91('0x1a')];this['sumDuration']=_0x5f5d2e[_0x4e91('0xf')];this[_0x4e91('0x10')]=_0x5f5d2e[_0x4e91('0x10')];if(this['dialMethod']==='preview'){this[_0x4e91('0xe')]=_0x5f5d2e[_0x4e91('0xe')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x0ec6=['unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','statusMessage','Trunk','active','callerid','prototype','unavailable','loggedin','callers','length','SIP/','name','online','incall','status','booked','keys','queue','dialer','exten','some','updateReportFromOutboundQueue','preview','exports','available','paused','ringing','talking','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','type','unknown'];(function(_0x1be8f4,_0x52aa07){var _0x33c64a=function(_0x1b6e92){while(--_0x1b6e92){_0x1be8f4['push'](_0x1be8f4['shift']());}};_0x33c64a(++_0x52aa07);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x1c8123,_0x37a312){_0x1c8123=_0x1c8123-0x0;var _0x5f3722=_0x0ec6[_0x1c8123];return _0x5f3722;};'use strict';var INBOUND_COUNTERS=[_0x60ec('0x0'),'loggedIn','loggedInDb',_0x60ec('0x1'),_0x60ec('0x2'),_0x60ec('0x3'),_0x60ec('0x4')];var OUTBOUND_COUNTERS=[_0x60ec('0x0'),_0x60ec('0x5'),_0x60ec('0x6'),'loggedIn',_0x60ec('0x7'),_0x60ec('0x8'),_0x60ec('0x9'),_0x60ec('0xa'),'outboundBlacklistCallsDay',_0x60ec('0xb'),'outboundCongestionCallsDay',_0x60ec('0xc'),_0x60ec('0xd'),_0x60ec('0xe'),_0x60ec('0xf'),_0x60ec('0x10'),_0x60ec('0x1'),'pTalking','talking',_0x60ec('0x11'),_0x60ec('0x12'),_0x60ec('0x13'),_0x60ec('0x4')];function VoiceQueueSummary(_0x10ec80){this['id']=_0x10ec80['id'];this['name']=_0x10ec80['name'];this[_0x60ec('0x14')]=_0x10ec80[_0x60ec('0x14')];this[_0x60ec('0x15')]=_0x10ec80[_0x60ec('0x15')]||0x0;this[_0x60ec('0x5')]=_0x10ec80['answered']||0x0;this[_0x60ec('0x0')]=_0x10ec80[_0x60ec('0x0')]||0x0;this[_0x60ec('0x16')]=_0x10ec80[_0x60ec('0x16')]||0x0;this[_0x60ec('0x6')]=_0x10ec80[_0x60ec('0x6')]||0x0;this[_0x60ec('0x17')]=_0x10ec80[_0x60ec('0x17')]||0x0;this[_0x60ec('0x18')]=_0x10ec80['loggedIn']||0x0;this[_0x60ec('0x7')]=_0x10ec80[_0x60ec('0x7')]||0x0;this[_0x60ec('0x19')]=_0x10ec80[_0x60ec('0x19')]||0x0;this[_0x60ec('0x1a')]=_0x10ec80[_0x60ec('0x1a')]||0x0;this[_0x60ec('0x1')]=_0x10ec80[_0x60ec('0x1')]||0x0;this[_0x60ec('0x2')]=_0x10ec80[_0x60ec('0x2')]||0x0;this[_0x60ec('0x1b')]=_0x10ec80[_0x60ec('0x1b')];this['sumBillable']=_0x10ec80[_0x60ec('0x11')];this[_0x60ec('0x12')]=_0x10ec80[_0x60ec('0x12')];this[_0x60ec('0x1c')]=_0x10ec80['sumHoldTime']||0x0;this[_0x60ec('0x3')]=_0x10ec80[_0x60ec('0x3')]||0x0;this[_0x60ec('0x13')]=_0x10ec80[_0x60ec('0x13')]||0x0;this[_0x60ec('0x1d')]=_0x10ec80[_0x60ec('0x1d')];this['unavailable']=_0x10ec80['unavailable']||0x0;this['unknown']=_0x10ec80[_0x60ec('0x1e')]||0x0;this[_0x60ec('0x1f')]=_0x10ec80[_0x60ec('0x1f')]||0x0;this[_0x60ec('0x4')]=_0x10ec80['waiting']||0x0;if(_0x10ec80['type']==='outbound'){this['pTalking']=_0x10ec80[_0x60ec('0x20')]||0x0;this[_0x60ec('0x21')]=_0x10ec80[_0x60ec('0x21')];this[_0x60ec('0x22')]=_0x10ec80[_0x60ec('0x22')];this[_0x60ec('0x23')]=_0x10ec80[_0x60ec('0x23')];this[_0x60ec('0x24')]=_0x10ec80[_0x60ec('0x24')];this['dialOriginateTimeout']=_0x10ec80[_0x60ec('0x25')];this[_0x60ec('0x26')]=_0x10ec80[_0x60ec('0x26')];this[_0x60ec('0x27')]=_0x10ec80[_0x60ec('0x27')];this[_0x60ec('0x28')]=_0x10ec80[_0x60ec('0x28')];this[_0x60ec('0xa')]=_0x10ec80[_0x60ec('0xa')];this[_0x60ec('0x29')]=_0x10ec80['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x10ec80[_0x60ec('0xb')];this[_0x60ec('0x2a')]=_0x10ec80['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x10ec80[_0x60ec('0x2b')];this['outboundDropCallsDayCallersExit']=_0x10ec80[_0x60ec('0x2c')];this[_0x60ec('0x2d')]=_0x10ec80[_0x60ec('0x2d')];this[_0x60ec('0xc')]=_0x10ec80[_0x60ec('0xc')];this['outboundNoSuchCallsDay']=_0x10ec80[_0x60ec('0xd')];this[_0x60ec('0x2e')]=_0x10ec80[_0x60ec('0x2e')];this[_0x60ec('0xe')]=_0x10ec80[_0x60ec('0xe')];this[_0x60ec('0xf')]=_0x10ec80['outboundRejectCallsDay'];this[_0x60ec('0x10')]=_0x10ec80[_0x60ec('0x10')];this['predictiveIntervalAnsweredCalls']=_0x10ec80[_0x60ec('0x2f')];this[_0x60ec('0x30')]=_0x10ec80[_0x60ec('0x30')];this[_0x60ec('0x31')]=_0x10ec80['predictiveIntervalAvgTalktime'];this[_0x60ec('0x32')]=_0x10ec80[_0x60ec('0x32')];this[_0x60ec('0x33')]=_0x10ec80[_0x60ec('0x33')];this[_0x60ec('0x34')]=_0x10ec80[_0x60ec('0x34')];this[_0x60ec('0x35')]=_0x10ec80[_0x60ec('0x35')];this[_0x60ec('0x36')]=_0x10ec80[_0x60ec('0x36')];this[_0x60ec('0x37')]=_0x10ec80[_0x60ec('0x37')];this[_0x60ec('0x38')]=_0x10ec80[_0x60ec('0x38')];this[_0x60ec('0x39')]=_0x10ec80[_0x60ec('0x39')];this[_0x60ec('0x3a')]=_0x10ec80['predictiveIntervalTotalCalls'];this[_0x60ec('0x8')]=_0x10ec80[_0x60ec('0x8')];this['erlangCalls']=_0x10ec80[_0x60ec('0x3b')];this['erlangCallToSecond']=_0x10ec80[_0x60ec('0x3c')];this[_0x60ec('0x3d')]=_0x10ec80[_0x60ec('0x3d')];this[_0x60ec('0x3e')]=_0x10ec80[_0x60ec('0x3e')];this[_0x60ec('0x3f')]=_0x10ec80[_0x60ec('0x3f')];this['startProgressive']=_0x10ec80['startProgressive'];this['message']=_0x10ec80[_0x60ec('0x40')];this['statusMessage']=_0x10ec80[_0x60ec('0x41')];}if(_0x10ec80[_0x60ec('0x42')]){this['Trunk']={'id':_0x10ec80[_0x60ec('0x42')]['id'],'name':_0x10ec80['Trunk']['name'],'active':_0x10ec80['Trunk'][_0x60ec('0x43')],'callerid':_0x10ec80[_0x60ec('0x42')][_0x60ec('0x44')]};}}VoiceQueueSummary[_0x60ec('0x45')]['createReport']=function(_0x3bb831,_0x1bee8d,_0xdaf11b,_0x2de1d6){this[_0x60ec('0x7')]=0x0;this[_0x60ec('0x3')]=0x0;this[_0x60ec('0x1')]=0x0;this[_0x60ec('0x1e')]=0x0;this[_0x60ec('0x1a')]=0x0;this[_0x60ec('0x6')]=0x0;this[_0x60ec('0x16')]=0x0;this[_0x60ec('0x17')]=0x0;this[_0x60ec('0x46')]=0x0;this[_0x60ec('0x2')]=0x0;this['ringInUse']=0x0;this[_0x60ec('0x19')]=0x0;if(_0xdaf11b){if(_0xdaf11b[_0x60ec('0x0')]){this['available']=Number(_0xdaf11b[_0x60ec('0x0')]);}if(_0xdaf11b['loggedin']){this[_0x60ec('0x18')]=Number(_0xdaf11b[_0x60ec('0x47')]);}if(_0xdaf11b[_0x60ec('0x48')]){this[_0x60ec('0x4')]=Number(_0xdaf11b[_0x60ec('0x48')]);}}for(var _0x52a668=0x0;_0x52a668<_0x3bb831[_0x60ec('0x49')];_0x52a668++){var _0x5bb833=_0x1bee8d[_0x60ec('0x4a')+_0x3bb831[_0x52a668][_0x60ec('0x4b')]];if(_0x5bb833&&_0x5bb833[_0x60ec('0x4c')]){this[_0x60ec('0x7')]+=0x1;}if(_0x3bb831[_0x52a668][_0x60ec('0x4d')]==='1'){this['talking']+=0x1;}if(_0x3bb831[_0x52a668][_0x60ec('0x1')]==='1'&&!['2','7','8']['includes'](_0x3bb831[_0x52a668][_0x60ec('0x4e')])){this[_0x60ec('0x1')]+=0x1;}switch(_0x3bb831[_0x52a668]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x60ec('0x1a')]+=0x1;break;case'2':this[_0x60ec('0x6')]+=0x1;break;case'3':this[_0x60ec('0x16')]+=0x1;break;case'4':this[_0x60ec('0x17')]+=0x1;break;case'5':this[_0x60ec('0x46')]+=0x1;break;case'6':this[_0x60ec('0x2')]+=0x1;break;case'7':this[_0x60ec('0x1b')]+=0x1;break;case'8':this[_0x60ec('0x19')]+=0x1;break;}}if(this[_0x60ec('0x22')]===_0x60ec('0x4f')){var _0xc3c51d=Object[_0x60ec('0x50')](_0x2de1d6);for(var _0x43bfcf=0x0;_0x43bfcf<_0xc3c51d[_0x60ec('0x49')];_0x43bfcf++){var _0x327401=_0xc3c51d[_0x43bfcf];var _0x4f6653=_0x2de1d6[_0x327401];if(_0x4f6653[_0x60ec('0x51')]===this[_0x60ec('0x4b')]&&_0x4f6653[_0x60ec('0x1d')]===_0x60ec('0x52')&&_0x4f6653[_0x60ec('0x53')]==='xcally-motion-preview'){this[_0x60ec('0x3')]+=0x1;}}if(this['talking']>this[_0x60ec('0x6')]){this[_0x60ec('0x3')]=this['inUse'];}this[_0x60ec('0x20')]=0x0;}return this;};VoiceQueueSummary[_0x60ec('0x45')]['compareToInboundQueue']=function(_0x572450){var _0x17f085=![];if(_0x572450){_0x17f085=INBOUND_COUNTERS['some'](function(_0x4a5c57){return this[_0x4a5c57]!==_0x572450[_0x4a5c57];},this);}return _0x17f085;};VoiceQueueSummary[_0x60ec('0x45')]['compareToOutboundQueue']=function(_0x31aa1b){var _0x41a87f=![];var _0x4874f0=![];var _0x2af33e=![];if(_0x31aa1b){_0x41a87f=this[_0x60ec('0x22')]!==_0x31aa1b[_0x60ec('0x22')]||this['dialActive']!==_0x31aa1b[_0x60ec('0x21')]||this[_0x60ec('0x40')]!==_0x31aa1b[_0x60ec('0x40')]||this[_0x60ec('0x41')]!==_0x31aa1b[_0x60ec('0x41')];_0x4874f0=OUTBOUND_COUNTERS[_0x60ec('0x54')](function(_0x33458c){return this[_0x33458c]!==_0x31aa1b[_0x33458c];},this);if(this[_0x60ec('0x42')]&&_0x31aa1b['Trunk']){_0x2af33e=this[_0x60ec('0x42')][_0x60ec('0x4b')]!==_0x31aa1b[_0x60ec('0x42')][_0x60ec('0x4b')]||this['Trunk'][_0x60ec('0x43')]!==_0x31aa1b[_0x60ec('0x42')][_0x60ec('0x43')];}}return _0x41a87f||_0x4874f0||_0x2af33e;};VoiceQueueSummary['prototype'][_0x60ec('0x55')]=function(_0x3c233e){this[_0x60ec('0x5')]=_0x3c233e[_0x60ec('0x5')];this['message']=_0x3c233e[_0x60ec('0x40')];this['statusMessage']=_0x3c233e[_0x60ec('0x41')];this['originated']=_0x3c233e['originated'];this[_0x60ec('0x9')]=_0x3c233e[_0x60ec('0x9')];this['outboundAnswerCallsDay']=_0x3c233e[_0x60ec('0xa')];this[_0x60ec('0x29')]=_0x3c233e[_0x60ec('0x29')];this[_0x60ec('0xb')]=_0x3c233e[_0x60ec('0xb')];this[_0x60ec('0x2a')]=_0x3c233e[_0x60ec('0x2a')];this['outboundNoAnswerCallsDay']=_0x3c233e['outboundNoAnswerCallsDay'];this[_0x60ec('0xd')]=_0x3c233e[_0x60ec('0xd')];this[_0x60ec('0xe')]=_0x3c233e['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x3c233e[_0x60ec('0xf')];this['outboundUnknownCallsDay']=_0x3c233e[_0x60ec('0x10')];this[_0x60ec('0x11')]=_0x3c233e[_0x60ec('0x11')];this[_0x60ec('0x12')]=_0x3c233e[_0x60ec('0x12')];this[_0x60ec('0x13')]=_0x3c233e['total'];if(this[_0x60ec('0x22')]===_0x60ec('0x56')){this['pTalking']=_0x3c233e['pTalking'];}};module[_0x60ec('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7af32b5..952a9e3 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 _0x4d49=['exports','username','accessKey','serverUrl','Configurations'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x4d49,0x137));var _0x94d4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4d49[_0x1facfa];return _0x9ec701;};'use strict';function VtigerAccount(_0x2cd164){this['id']=_0x2cd164['id']||0x0;this['name']=_0x2cd164['name']||'';this[_0x94d4('0x0')]=_0x2cd164[_0x94d4('0x0')]||'';this[_0x94d4('0x1')]=_0x2cd164[_0x94d4('0x1')]||'';this['remoteUri']=_0x2cd164['remoteUri']||'';this[_0x94d4('0x2')]=_0x2cd164[_0x94d4('0x2')]||'';this[_0x94d4('0x3')]=_0x2cd164[_0x94d4('0x3')]||{};}module[_0x94d4('0x4')]=VtigerAccount; \ No newline at end of file +var _0x96f8=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x96f8,0x15c));var _0x896f=function(_0x126087,_0x272d31){_0x126087=_0x126087-0x0;var _0x319244=_0x96f8[_0x126087];return _0x319244;};'use strict';function VtigerAccount(_0x557a55){this['id']=_0x557a55['id']||0x0;this[_0x896f('0x0')]=_0x557a55['name']||'';this[_0x896f('0x1')]=_0x557a55['username']||'';this[_0x896f('0x2')]=_0x557a55['accessKey']||'';this[_0x896f('0x3')]=_0x557a55[_0x896f('0x3')]||'';this[_0x896f('0x4')]=_0x557a55[_0x896f('0x4')]||'';this[_0x896f('0x5')]=_0x557a55[_0x896f('0x5')]||{};}module[_0x896f('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 908d66c..7929db1 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 _0x4597=['remoteUri','authType','type','serverUrl','Configurations','exports','name','username','password'];(function(_0x3361ae,_0x4cc734){var _0xf445fc=function(_0x271b0c){while(--_0x271b0c){_0x3361ae['push'](_0x3361ae['shift']());}};_0xf445fc(++_0x4cc734);}(_0x4597,0x7b));var _0x7459=function(_0x385b7b,_0x33e9d0){_0x385b7b=_0x385b7b-0x0;var _0x704997=_0x4597[_0x385b7b];return _0x704997;};'use strict';function ZendeskAccount(_0x26c3c2){this['id']=_0x26c3c2['id']||0x0;this[_0x7459('0x0')]=_0x26c3c2[_0x7459('0x0')]||'';this[_0x7459('0x1')]=_0x26c3c2['username']||'';this['password']=_0x26c3c2[_0x7459('0x2')]||'';this['token']=_0x26c3c2['token']||'';this['remoteUri']=_0x26c3c2[_0x7459('0x3')]||'';this[_0x7459('0x4')]=_0x26c3c2[_0x7459('0x4')]||'';this[_0x7459('0x5')]=_0x26c3c2['type']||'integrationTab';this['serverUrl']=_0x26c3c2[_0x7459('0x6')]||'';this['Configurations']=_0x26c3c2[_0x7459('0x7')]||{};}module[_0x7459('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x715f=['type','integrationTab','serverUrl','exports','name','username','password','token','remoteUri','authType'];(function(_0x5ac45b,_0x5b1f51){var _0x67fb=function(_0x48b5fc){while(--_0x48b5fc){_0x5ac45b['push'](_0x5ac45b['shift']());}};_0x67fb(++_0x5b1f51);}(_0x715f,0x1ee));var _0xf715=function(_0x4e4505,_0x53320d){_0x4e4505=_0x4e4505-0x0;var _0x5ba35d=_0x715f[_0x4e4505];return _0x5ba35d;};'use strict';function ZendeskAccount(_0xde7c3e){this['id']=_0xde7c3e['id']||0x0;this[_0xf715('0x0')]=_0xde7c3e[_0xf715('0x0')]||'';this[_0xf715('0x1')]=_0xde7c3e[_0xf715('0x1')]||'';this[_0xf715('0x2')]=_0xde7c3e[_0xf715('0x2')]||'';this[_0xf715('0x3')]=_0xde7c3e[_0xf715('0x3')]||'';this[_0xf715('0x4')]=_0xde7c3e['remoteUri']||'';this[_0xf715('0x5')]=_0xde7c3e[_0xf715('0x5')]||'';this[_0xf715('0x6')]=_0xde7c3e[_0xf715('0x6')]||_0xf715('0x7');this[_0xf715('0x8')]=_0xde7c3e['serverUrl']||'';this['Configurations']=_0xde7c3e['Configurations']||{};}module[_0xf715('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 826d6c3..339803e 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 _0xb041=['refreshToken','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0xb041,0x142));var _0x1b04=function(_0x4cb6dd,_0x58a188){_0x4cb6dd=_0x4cb6dd-0x0;var _0x5baced=_0xb041[_0x4cb6dd];return _0x5baced;};'use strict';function ZohoAccount(_0x33e1fe){this['id']=_0x33e1fe['id']||0x0;this[_0x1b04('0x0')]=_0x33e1fe[_0x1b04('0x0')]||'';this['description']=_0x33e1fe[_0x1b04('0x1')]||'';this[_0x1b04('0x2')]=_0x33e1fe[_0x1b04('0x2')]||'';this[_0x1b04('0x3')]=_0x33e1fe[_0x1b04('0x3')]||'';this[_0x1b04('0x4')]=_0x33e1fe[_0x1b04('0x4')]||'';this[_0x1b04('0x5')]=_0x33e1fe[_0x1b04('0x5')]||'';this[_0x1b04('0x6')]=_0x33e1fe[_0x1b04('0x6')]||'';this[_0x1b04('0x7')]=_0x33e1fe[_0x1b04('0x7')]||'';this['refreshToken']=_0x33e1fe[_0x1b04('0x8')]||'';this['Configurations']=_0x33e1fe['Configurations']||{};}module[_0x1b04('0x9')]=ZohoAccount; \ No newline at end of file +var _0xc7c9=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x54cb1a,_0x5ca2fc){var _0x217c35=function(_0x27fca2){while(--_0x27fca2){_0x54cb1a['push'](_0x54cb1a['shift']());}};_0x217c35(++_0x5ca2fc);}(_0xc7c9,0x193));var _0x9c7c=function(_0x194f35,_0x10192f){_0x194f35=_0x194f35-0x0;var _0x25fa1a=_0xc7c9[_0x194f35];return _0x25fa1a;};'use strict';function ZohoAccount(_0x1113ef){this['id']=_0x1113ef['id']||0x0;this['name']=_0x1113ef[_0x9c7c('0x0')]||'';this[_0x9c7c('0x1')]=_0x1113ef[_0x9c7c('0x1')]||'';this[_0x9c7c('0x2')]=_0x1113ef[_0x9c7c('0x2')]||'';this[_0x9c7c('0x3')]=_0x1113ef['zone']||'';this['clientId']=_0x1113ef[_0x9c7c('0x4')]||'';this['clientSecret']=_0x1113ef[_0x9c7c('0x5')]||'';this[_0x9c7c('0x6')]=_0x1113ef[_0x9c7c('0x6')]||'';this[_0x9c7c('0x7')]=_0x1113ef['code']||'';this[_0x9c7c('0x8')]=_0x1113ef[_0x9c7c('0x8')]||'';this[_0x9c7c('0x9')]=_0x1113ef[_0x9c7c('0x9')]||{};}module[_0x9c7c('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index b51ccf7..e2b6496 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 _0xe511=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','lodash','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x47a111,_0x167e06){var _0x32d643=function(_0x1e4b7a){while(--_0x1e4b7a){_0x47a111['push'](_0x47a111['shift']());}};_0x32d643(++_0x167e06);}(_0xe511,0x16f));var _0x1e51=function(_0x76289d,_0x49a654){_0x76289d=_0x76289d-0x0;var _0x2968d4=_0xe511[_0x76289d];return _0x2968d4;};'use strict';var util=require(_0x1e51('0x0'));var _=require(_0x1e51('0x1'));var moment=require('moment');function checkNameSurname(_0x2a5905,_0x5b9e45,_0x253e96){var _0xb75a96='';if(!_['isNil'](_0x5b9e45)&&_0x1e51('0x2')===typeof _0x5b9e45){_0xb75a96+=_0x5b9e45;}if(!_[_0x1e51('0x3')](_0x253e96)&&_0x1e51('0x2')===typeof _0x253e96){_0xb75a96+='\x20'+_0x253e96;}if(_0xb75a96!==''){return _0xb75a96;}return _0x2a5905;}function Action(_0x16ec99,_0x480cca,_0x26b22c,_0x21ed6b,_0x5c4590){this['uniqueid']=_0x26b22c||undefined;this[_0x1e51('0x4')]=_0x16ec99['id'];this[_0x1e51('0x5')]=_0x480cca['name'];this['type']=_0x480cca[_0x1e51('0x6')];this[_0x1e51('0x7')]=_0x1e51('0x5');this[_0x1e51('0x8')]=![];this[_0x1e51('0x9')]=_[_0x1e51('0x3')](_0x16ec99['Agent'])?undefined:_0x16ec99[_0x1e51('0xa')][_0x1e51('0xb')];this[_0x1e51('0xc')]=this[_0x1e51('0x9')]?util[_0x1e51('0xd')](_0x1e51('0xe'),this['membername']):_0x21ed6b||undefined;this[_0x1e51('0xf')]=checkNameSurname(_0x16ec99[_0x1e51('0x10')][_0x1e51('0x11')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x12')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x13')]);this[_0x1e51('0x14')]=_0x16ec99[_0x1e51('0x14')]||![];this[_0x1e51('0x15')]=_0x16ec99['phone'];this[_0x1e51('0x16')]=_0x16ec99[_0x1e51('0x16')];this[_0x1e51('0x17')]=_0x16ec99['countbusyretry']||0x0;this[_0x1e51('0x18')]=_0x16ec99['countcongestionretry']||0x0;this['countnoanswerretry']=_0x16ec99[_0x1e51('0x19')]||0x0;this[_0x1e51('0x1a')]=(_0x16ec99[_0x1e51('0x17')]||0x0)+(_0x16ec99[_0x1e51('0x18')]||0x0)+(_0x16ec99[_0x1e51('0x19')]||0x0)+(_0x16ec99[_0x1e51('0x1b')]||0x0)+(_0x16ec99['countdropretry']||0x0)+(_0x16ec99[_0x1e51('0x1c')]||0x0)+(_0x16ec99['countmachineretry']||0x0)+(_0x16ec99[_0x1e51('0x1d')]||0x0);this[_0x1e51('0x1b')]=_0x16ec99[_0x1e51('0x1b')]||0x0;this[_0x1e51('0x1e')]=_0x16ec99['countdropretry']||0x0;this['countabandonedretry']=_0x16ec99['countabandonedretry']||0x0;this['countmachineretry']=_0x16ec99[_0x1e51('0x1f')]||0x0;this['countagentrejectretry']=_0x16ec99[_0x1e51('0x1d')]||0x0;this[_0x1e51('0x20')]=_0x16ec99[_0x1e51('0x20')];this[_0x1e51('0x21')]=_0x16ec99[_0x1e51('0x21')];this[_0x1e51('0x22')]=_0x16ec99[_0x1e51('0x22')];this[_0x1e51('0x23')]=_0x16ec99['recallme'];this['ContactId']=_0x16ec99[_0x1e51('0x24')];this[_0x1e51('0x25')]=_0x16ec99[_0x1e51('0x25')];this[_0x1e51('0x26')]=_['isNil'](_0x16ec99['Agent'])?_0x16ec99['UserId']:_0x16ec99[_0x1e51('0xa')]['id'];this[_0x1e51('0x27')]=_0x16ec99[_0x1e51('0x27')];this['originatecalleridnum']='';this[_0x1e51('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x1e51('0xd')]('\x22%s\x22\x20<%s>',this[_0x1e51('0xf')],this[_0x1e51('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0xbbbc=['idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','string','isNil','uniqueid'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x29165d,_0x221063){_0x29165d=_0x29165d-0x0;var _0x3dd8f9=_0xbbbc[_0x29165d];return _0x3dd8f9;};'use strict';var util=require(_0xcbbb('0x0'));var _=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));function checkNameSurname(_0x4538f9,_0x3ec75b,_0x3e91a2){var _0x464b75='';if(!_['isNil'](_0x3ec75b)&&_0xcbbb('0x3')===typeof _0x3ec75b){_0x464b75+=_0x3ec75b;}if(!_[_0xcbbb('0x4')](_0x3e91a2)&&_0xcbbb('0x3')===typeof _0x3e91a2){_0x464b75+='\x20'+_0x3e91a2;}if(_0x464b75!==''){return _0x464b75;}return _0x4538f9;}function Action(_0x3ccbf6,_0x43ff05,_0x4978a9,_0x388197,_0x1796b4){this[_0xcbbb('0x5')]=_0x4978a9||undefined;this[_0xcbbb('0x6')]=_0x3ccbf6['id'];this[_0xcbbb('0x7')]=_0x43ff05[_0xcbbb('0x8')];this[_0xcbbb('0x9')]=_0x43ff05['type'];this[_0xcbbb('0xa')]='queue';this['dialAnswer']=![];this[_0xcbbb('0xb')]=_['isNil'](_0x3ccbf6[_0xcbbb('0xc')])?undefined:_0x3ccbf6['Agent'][_0xcbbb('0x8')];this[_0xcbbb('0xd')]=this['membername']?util[_0xcbbb('0xe')]('SIP/%s',this[_0xcbbb('0xb')]):_0x388197||undefined;this['calleridname']=checkNameSurname(_0x3ccbf6[_0xcbbb('0xf')][_0xcbbb('0x10')],_0x3ccbf6[_0xcbbb('0xf')]['firstName'],_0x3ccbf6[_0xcbbb('0xf')][_0xcbbb('0x11')]);this[_0xcbbb('0x12')]=_0x3ccbf6[_0xcbbb('0x12')]||![];this['calleridnum']=_0x3ccbf6['phone'];this[_0xcbbb('0x13')]=_0x3ccbf6[_0xcbbb('0x13')];this[_0xcbbb('0x14')]=_0x3ccbf6[_0xcbbb('0x14')]||0x0;this['countcongestionretry']=_0x3ccbf6[_0xcbbb('0x15')]||0x0;this['countnoanswerretry']=_0x3ccbf6[_0xcbbb('0x16')]||0x0;this[_0xcbbb('0x17')]=(_0x3ccbf6[_0xcbbb('0x14')]||0x0)+(_0x3ccbf6['countcongestionretry']||0x0)+(_0x3ccbf6['countnoanswerretry']||0x0)+(_0x3ccbf6['countnosuchnumberretry']||0x0)+(_0x3ccbf6[_0xcbbb('0x18')]||0x0)+(_0x3ccbf6[_0xcbbb('0x19')]||0x0)+(_0x3ccbf6[_0xcbbb('0x1a')]||0x0)+(_0x3ccbf6[_0xcbbb('0x1b')]||0x0);this[_0xcbbb('0x1c')]=_0x3ccbf6[_0xcbbb('0x1c')]||0x0;this[_0xcbbb('0x18')]=_0x3ccbf6[_0xcbbb('0x18')]||0x0;this[_0xcbbb('0x19')]=_0x3ccbf6[_0xcbbb('0x19')]||0x0;this['countmachineretry']=_0x3ccbf6[_0xcbbb('0x1a')]||0x0;this[_0xcbbb('0x1b')]=_0x3ccbf6[_0xcbbb('0x1b')]||0x0;this[_0xcbbb('0x1d')]=_0x3ccbf6[_0xcbbb('0x1d')];this[_0xcbbb('0x1e')]=_0x3ccbf6[_0xcbbb('0x1e')];this[_0xcbbb('0x1f')]=_0x3ccbf6[_0xcbbb('0x1f')];this['recallme']=_0x3ccbf6[_0xcbbb('0x20')];this[_0xcbbb('0x21')]=_0x3ccbf6['ContactId'];this[_0xcbbb('0x22')]=_0x3ccbf6['ListId'];this['UserId']=_[_0xcbbb('0x4')](_0x3ccbf6[_0xcbbb('0xc')])?_0x3ccbf6['UserId']:_0x3ccbf6['Agent']['id'];this['VoiceQueueId']=_0x3ccbf6[_0xcbbb('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xcbbb('0x24')][_0xcbbb('0x25')]=function(){return util[_0xcbbb('0xe')](_0xcbbb('0x26'),this[_0xcbbb('0x27')],this[_0xcbbb('0x28')]);};module[_0xcbbb('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 16ffc9e..26db0d6 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x3dc7f5,_0xc082af){var _0x5906c5=function(_0x32994e){while(--_0x32994e){_0x3dc7f5['push'](_0x3dc7f5['shift']());}};_0x5906c5(++_0xc082af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x4491e8,_0x53a72e){var _0x3f4930=function(_0x1cc640){while(--_0x1cc640){_0x4491e8['push'](_0x4491e8['shift']());}};_0x3f4930(++_0x53a72e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index dade053..dceb53c 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 _0x2b3d=['queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x2b3d,0x124));var _0xd2b3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2b3d[_0x42cae2];return _0x5f256f;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xd2b3('0x0'))(_0xd2b3('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xd2b3('0x2'));var cmHopperBlack=require(_0xd2b3('0x3'));var agentReportPreview=require(_0xd2b3('0x4'));var voiceQueueReport=require(_0xd2b3('0x5'));function loggerCatch(_0x1894cb){return function(_0x2ecd03){logger[_0xd2b3('0x6')](_0x1894cb,util[_0xd2b3('0x7')](_0x2ecd03,{'showHidden':![],'depth':null}));};}function create(_0x484da4){return cmHopperHistory[_0xd2b3('0x8')](_0x484da4)['catch'](loggerCatch(_0xd2b3('0x9')));}function createAgent(_0x1c638b){return BPromise[_0xd2b3('0xa')]()[_0xd2b3('0xb')](agentReportPreview[_0xd2b3('0x8')](_0x1c638b))[_0xd2b3('0xc')](loggerCatch(_0xd2b3('0x9')));}function moveContact(_0x49f4d5){return cmHopper['moveContactManagedDialer'](_0x49f4d5,!![])[_0xd2b3('0xc')](loggerCatch(_0xd2b3('0xd')));}exports[_0xd2b3('0xe')]=function(_0x165738){return cmHopperBlack['checkIsBlackList'](_0x165738)[_0xd2b3('0xc')](loggerCatch(_0xd2b3('0xf')));};exports[_0xd2b3('0x10')]=function(_0x3894f3){return BPromise[_0xd2b3('0xa')]()[_0xd2b3('0xb')](cmHopper[_0xd2b3('0x10')](_0x3894f3))[_0xd2b3('0xc')](loggerCatch(_0xd2b3('0x11')));};exports[_0xd2b3('0x8')]=function(_0x3215dd,_0x2d4d83){create(_0x3215dd)[_0xd2b3('0xc')](loggerCatch(_0x2d4d83));moveContact(_0x3215dd)[_0xd2b3('0xc')](loggerCatch(_0x2d4d83));};exports[_0xd2b3('0x12')]=function(_0x49e36f,_0x2ff3a9){createAgent(_0x49e36f)[_0xd2b3('0xc')](loggerCatch(_0x2ff3a9));};exports['createCustomerHistory']=function(_0x4b7311,_0x3f203a){create(_0x4b7311)['catch'](loggerCatch(_0x3f203a));};exports[_0xd2b3('0x13')]=function(_0x519f61,_0x23fbdd){moveContact(_0x519f61)[_0xd2b3('0xc')](loggerCatch(_0x23fbdd));};exports[_0xd2b3('0x14')]=function(_0x3d5144,_0x11c362,_0x169f14){if(_0x11c362){_0x3d5144[_0xd2b3('0x15')]=null;}if(_0x169f14){_0x3d5144[_0xd2b3('0x16')]=![];}return cmHopper[_0xd2b3('0x14')](_0x3d5144)[_0xd2b3('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xd2b3('0x17')]=function(_0x5a549b){return cmHopper[_0xd2b3('0x17')](_0x5a549b)['catch'](loggerCatch(_0xd2b3('0x18')));};exports[_0xd2b3('0x19')]=function(_0xc5dc39){return cmHopper[_0xd2b3('0x19')]({'UserId':null},_0xc5dc39,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xd2b3('0x1a')]=function(_0x37b0e5){return cmHopper['unlockContact']({'active':![]},_0x37b0e5,0x1)[_0xd2b3('0xc')](loggerCatch(_0xd2b3('0x1b')));};exports[_0xd2b3('0x1c')]=function(_0x575a63){var _0x2dc637={};_0x2dc637[_0xd2b3('0x1d')]=_0x575a63[_0xd2b3('0x1d')];_0x2dc637[_0xd2b3('0x1e')]=_0x575a63['uniqueid'];_0x2dc637[_0xd2b3('0x1f')]=_0x575a63[_0xd2b3('0x1f')];_0x2dc637[_0xd2b3('0x20')]=_0x575a63[_0xd2b3('0x20')];_0x2dc637[_0xd2b3('0x21')]=_0x575a63[_0xd2b3('0x21')];_0x2dc637[_0xd2b3('0x22')]=_0x575a63['answertime'];_0x2dc637[_0xd2b3('0x23')]=_0x575a63[_0xd2b3('0x24')];_0x2dc637[_0xd2b3('0x25')]=0x1;_0x2dc637[_0xd2b3('0x26')]=_0x575a63[_0xd2b3('0x27')];_0x2dc637[_0xd2b3('0x28')]=_0x575a63[_0xd2b3('0x29')];_0x2dc637[_0xd2b3('0x2a')]='from-sip';_0x2dc637[_0xd2b3('0x2b')]=_0xd2b3('0x2c');_0x2dc637[_0xd2b3('0x2d')]=0x0;_0x2dc637[_0xd2b3('0x2e')]=0x1;_0x2dc637[_0xd2b3('0x2f')]=_0x575a63['membername'];_0x2dc637[_0xd2b3('0x30')]=_0xd2b3('0x31');return BPromise[_0xd2b3('0xa')]()['then'](voiceQueueReport[_0xd2b3('0x32')](_0x2dc637))[_0xd2b3('0xc')](loggerCatch(_0xd2b3('0x33')));};exports[_0xd2b3('0x34')]=function(_0x350853,_0x18cd54){return BPromise[_0xd2b3('0xa')]()[_0xd2b3('0xb')](cmHopper[_0xd2b3('0x34')](_0x350853,_0x18cd54))['catch'](loggerCatch(_0xd2b3('0x35')));};exports['rescheduleContactInQueue']=function(_0x3c4660){return cmHopper[_0xd2b3('0x14')](_0x3c4660,!![],!![])['catch'](loggerCatch(_0xd2b3('0x36')));}; \ No newline at end of file +var _0x82db=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','resolve','create','[voiceQueueReport]\x20','getContactRecallMe'];(function(_0x1d3e1a,_0xdd175f){var _0x5741ec=function(_0x986fb7){while(--_0x986fb7){_0x1d3e1a['push'](_0x1d3e1a['shift']());}};_0x5741ec(++_0xdd175f);}(_0x82db,0x1df));var _0xb82d=function(_0x448279,_0x23a89d){_0x448279=_0x448279-0x0;var _0x44e688=_0x82db[_0x448279];return _0x44e688;};'use strict';var util=require('util');var BPromise=require(_0xb82d('0x0'));var logger=require(_0xb82d('0x1'))(_0xb82d('0x2'));var cmHopper=require(_0xb82d('0x3'));var cmHopperHistory=require(_0xb82d('0x4'));var cmHopperBlack=require(_0xb82d('0x5'));var agentReportPreview=require(_0xb82d('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x427a5b){return function(_0x5b3f7e){logger[_0xb82d('0x7')](_0x427a5b,util[_0xb82d('0x8')](_0x5b3f7e,{'showHidden':![],'depth':null}));};}function create(_0x3db2a5){return cmHopperHistory[_0xb82d('0x9')](_0x3db2a5)[_0xb82d('0xa')](loggerCatch(_0xb82d('0xb')));}function createAgent(_0x332454){return BPromise['resolve']()['then'](agentReportPreview[_0xb82d('0x9')](_0x332454))['catch'](loggerCatch(_0xb82d('0xb')));}function moveContact(_0xeee9d7){return cmHopper[_0xb82d('0xc')](_0xeee9d7,!![])[_0xb82d('0xa')](loggerCatch(_0xb82d('0xd')));}exports[_0xb82d('0xe')]=function(_0x3888a2){return cmHopperBlack[_0xb82d('0xe')](_0x3888a2)['catch'](loggerCatch(_0xb82d('0xf')));};exports[_0xb82d('0x10')]=function(_0x344062){return BPromise['resolve']()[_0xb82d('0x11')](cmHopper[_0xb82d('0x10')](_0x344062))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xb82d('0x9')]=function(_0x22fe79,_0x41d992){create(_0x22fe79)['catch'](loggerCatch(_0x41d992));moveContact(_0x22fe79)[_0xb82d('0xa')](loggerCatch(_0x41d992));};exports[_0xb82d('0x12')]=function(_0x11c881,_0x9d66cb){createAgent(_0x11c881)['catch'](loggerCatch(_0x9d66cb));};exports['createCustomerHistory']=function(_0x8a5795,_0x201763){create(_0x8a5795)[_0xb82d('0xa')](loggerCatch(_0x201763));};exports[_0xb82d('0x13')]=function(_0xa3a3eb,_0x2ba207){moveContact(_0xa3a3eb)[_0xb82d('0xa')](loggerCatch(_0x2ba207));};exports[_0xb82d('0x14')]=function(_0x1775da,_0x3ddfb9,_0x83c736){if(_0x3ddfb9){_0x1775da[_0xb82d('0x15')]=null;}if(_0x83c736){_0x1775da[_0xb82d('0x16')]=![];}return cmHopper['rescheduleContact'](_0x1775da)[_0xb82d('0xa')](loggerCatch(_0xb82d('0x17')));};exports[_0xb82d('0x18')]=function(_0x450ea4){return cmHopper[_0xb82d('0x18')](_0x450ea4)[_0xb82d('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x491eb0){return cmHopper[_0xb82d('0x19')]({'UserId':null},_0x491eb0,0x1)[_0xb82d('0xa')](loggerCatch(_0xb82d('0x1a')));};exports[_0xb82d('0x1b')]=function(_0x33def5){return cmHopper[_0xb82d('0x19')]({'active':![]},_0x33def5,0x1)[_0xb82d('0xa')](loggerCatch('[activeContact]\x20'));};exports[_0xb82d('0x1c')]=function(_0x52e6bc){var _0x36cb47={};_0x36cb47['type']=_0x52e6bc[_0xb82d('0x1d')];_0x36cb47['uniqueid']=_0x52e6bc['uniqueid'];_0x36cb47['calleridnum']=_0x52e6bc[_0xb82d('0x1e')];_0x36cb47[_0xb82d('0x1f')]=_0x52e6bc['calleridname'];_0x36cb47[_0xb82d('0x20')]=_0x52e6bc[_0xb82d('0x20')];_0x36cb47['queuecallerjoinAt']=_0x52e6bc[_0xb82d('0x21')];_0x36cb47[_0xb82d('0x22')]=_0x52e6bc[_0xb82d('0x21')];_0x36cb47[_0xb82d('0x23')]=0x1;_0x36cb47[_0xb82d('0x24')]=_0x52e6bc[_0xb82d('0x25')];_0x36cb47[_0xb82d('0x26')]=_0x52e6bc[_0xb82d('0x27')];_0x36cb47[_0xb82d('0x28')]=_0xb82d('0x29');_0x36cb47[_0xb82d('0x2a')]=_0xb82d('0x2b');_0x36cb47[_0xb82d('0x2c')]=0x0;_0x36cb47[_0xb82d('0x2d')]=0x1;_0x36cb47['lastAssignedTo']=_0x52e6bc[_0xb82d('0x27')];_0x36cb47[_0xb82d('0x2e')]='COMPLETED';return BPromise[_0xb82d('0x2f')]()['then'](voiceQueueReport[_0xb82d('0x30')](_0x36cb47))[_0xb82d('0xa')](loggerCatch(_0xb82d('0x31')));};exports[_0xb82d('0x32')]=function(_0x3ab4cd,_0x140fb0){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x3ab4cd,_0x140fb0))[_0xb82d('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xb82d('0x33')]=function(_0x31de96){return cmHopper[_0xb82d('0x14')](_0x31de96,!![],!![])[_0xb82d('0xa')](loggerCatch(_0xb82d('0x34')));}; \ 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 f67251f..c441f24 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 _0x694a=['agentReadyId','not_inuse','status','reachable','milliseconds','diff','createBody','campaigntype','dialAnswer','active','calleridnum','countbusyretry','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','logCustomer','getSeconds','talktime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','scheduledat','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','buildObj'];(function(_0x122efd,_0x59fcc9){var _0x40eecf=function(_0x463ffa){while(--_0x463ffa){_0x122efd['push'](_0x122efd['shift']());}};_0x40eecf(++_0x59fcc9);}(_0x694a,0xbc));var _0xa694=function(_0x314148,_0x50e34b){_0x314148=_0x314148-0x0;var _0x5703c4=_0x694a[_0x314148];return _0x5703c4;};'use strict';var util=require(_0xa694('0x0'));var _=require(_0xa694('0x1'));var moment=require(_0xa694('0x2'));var logger=require(_0xa694('0x3'))('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0xa694('0x4');var utils=require(_0xa694('0x5'));exports[_0xa694('0x6')]=function(_0x54123a){return function(_0x3f544d){logger[_0xa694('0x7')](_0x54123a,util[_0xa694('0x8')](_0x3f544d,{'showHidden':![],'depth':null}));};};exports[_0xa694('0x9')]=function(_0x3aa2f2,_0x468a90){logger[_0xa694('0xa')](_0x3aa2f2,util[_0xa694('0x8')](_0x468a90,{'showHidden':![],'depth':null}));};exports[_0xa694('0xb')]=function(_0x4e7cd6,_0x35423f){logger['error'](_0x4e7cd6,util['inspect'](_0x35423f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x45f656){return function(_0x2cc9e9){logger['info'](_0x45f656,util[_0xa694('0x8')](_0x2cc9e9,{'showHidden':![],'depth':null}));};};exports[_0xa694('0xc')]=function(_0x1d37e5,_0x3ad279,_0x489a7e){return{'message':_0x1d37e5,'unlock':_0x3ad279,'active':_0x489a7e};};exports[_0xa694('0xd')]=function(_0x2ff637,_0x31fb5b,_0x4aa17b){if(!_[_0xa694('0xe')](_0x4aa17b)&&_0xa694('0xf')===typeof _0x4aa17b&&!_[_0xa694('0x10')](_0x4aa17b)){if(!_[_0xa694('0xe')](_0x31fb5b)&&_0xa694('0xf')===typeof _0x31fb5b&&!_[_0xa694('0x10')](_0x31fb5b)){return util[_0xa694('0x11')]('\x22%s\x22\x20<%s>',_0x31fb5b,_0x4aa17b);}return util['format'](_0xa694('0x12'),_0x4aa17b,_0x4aa17b);}if(!_[_0xa694('0xe')](_0x2ff637)&&_0xa694('0xf')===typeof _0x2ff637&&!_['isEmpty'](_0x2ff637)){return _0x2ff637;}return _0xa694('0x13');};exports[_0xa694('0x14')]=function(_0x3f25b7){if(_[_0xa694('0x15')](_0x3f25b7)){return![];}return _0x3f25b7;};exports[_0xa694('0x16')]=function(_0x4fddf2,_0x38e78d,_0x38d889,_0x265aa6,_0x4713a3,_0x1acf8b){var _0x1fc76b={'XMD-QUEUE':_0x38e78d[_0xa694('0x17')]?_0x38e78d[_0xa694('0x17')][_0xa694('0x18')]:'','XMD-CALLERID':_0x265aa6,'XMD-CALLERID-PREVIEW':_0x1acf8b?util['format']('\x22%s\x22\x20<%s>',_0x1acf8b[_0xa694('0x19')],_0x1acf8b['calleridnum']):_0x265aa6,'XMD-DIALID':_0x4713a3,'XMD-CONTACTID':_0x38e78d[_0xa694('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x265aa6,'XMD-VOICEQUEUEID':_0x38e78d['VoiceQueueId'],'XMD-DIALCHANNEL':_0x38d889,'XMD-DIALTIMEOUT':_0x4fddf2[_0xa694('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xa694('0x11')](_0xa694('0x1c'),_0x4fddf2[_0xa694('0x1d')]?'g':'',_['isEmpty'](_0x4fddf2[_0xa694('0x1e')])?'':_0xa694('0x1f')),'XMD-DIALURL':_0x4fddf2[_0xa694('0x20')]||'','XMD-AGI':_0x4fddf2['dialQueueProject']?util['format'](_0xa694('0x21'),ipAgi,_0x4fddf2[_0xa694('0x22')]):_0xa694('0x23'),'XMD-AGIAFTER':_0x4fddf2['dialQueueProject2']?util[_0xa694('0x11')](_0xa694('0x21'),ipAgi,_0x4fddf2[_0xa694('0x1d')]):_0xa694('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1acf8b?_0x1acf8b[_0xa694('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x1acf8b?_0x1acf8b[_0xa694('0x25')]:'','XMD-DESTINATION':_0xa694('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xa694('0x10')](_0x4fddf2[_0xa694('0x1e')])){_0x1fc76b[util['format']('%s',_0xa694('0x27'))]=_0x4fddf2['monitor_format'];_0x1fc76b[util[_0xa694('0x11')]('%s',_0xa694('0x28'))]=_0x4713a3;}return _0x1fc76b;};exports['toLowerVariables']=function(_0x5b9e6c){var _0xfb8204={};for(var _0xe8f30a in _0x5b9e6c){if(_0x5b9e6c[_0xa694('0x29')](_0xe8f30a)){_0xfb8204[util[_0xa694('0x11')]('%s',_[_0xa694('0x2a')](_0xe8f30a))]=_0x5b9e6c[_0xe8f30a];}}return{'variables':_0xfb8204};};exports['updateOriginated']=function(_0x5a0732,_0x282864){if(!_[_0xa694('0x15')](_0x5a0732)){if(_0x5a0732['hasOwnProperty']('originated')){if(_0x5a0732[_0xa694('0x2b')]>0x0){_0x5a0732[_0xa694('0x2b')]-=0x1;}else{logger['error'](_0xa694('0x2c'),_0x282864);}}}else{logger[_0xa694('0x7')](_0xa694('0x2d'),_0x282864);}};exports[_0xa694('0x2e')]=function(_0x257c08){var _0x16c0c5=moment()['format'](_0xa694('0x2f'));_0x257c08[_0xa694('0x30')]=0xd;_0x257c08[_0xa694('0x31')]=_0xa694('0x32');_0x257c08[_0xa694('0x33')]=_0x16c0c5;_0x257c08[_0xa694('0x34')]=_0x16c0c5;_0x257c08[_0xa694('0x35')]=_0x16c0c5;};exports[_0xa694('0x36')]=function(_0x2bcda1,_0x4fd1e0,_0x1f3586){var _0x4b5d0c=moment()[_0xa694('0x11')](_0xa694('0x2f'));_0x2bcda1['state']=_0x4fd1e0;_0x2bcda1[_0xa694('0x31')]=_0x1f3586;_0x2bcda1['responsetime']=_0x4b5d0c;_0x2bcda1[_0xa694('0x37')]=utils['getSeconds'](_0x2bcda1[_0xa694('0x34')],_0x2bcda1[_0xa694('0x33')]);};exports['logLookAgent']=function(_0x5c0c3d,_0x3b2559,_0x420dc4){_0x5c0c3d[_0xa694('0x38')]=_0x3b2559;_0x5c0c3d[_0xa694('0x39')]=_0x420dc4;};exports[_0xa694('0x3a')]=function(_0x1bda5d,_0x136e6d,_0x3fcf21){var _0x5b927f=moment()['format'](_0xa694('0x2f'));_0x1bda5d[_0xa694('0x30')]=_0x136e6d;_0x1bda5d['statedesc']=_0x3fcf21;_0x1bda5d[_0xa694('0x34')]=_0x1bda5d['responsetime']?_0x1bda5d[_0xa694('0x34')]:_0x5b927f;_0x1bda5d[_0xa694('0x35')]=_0x1bda5d[_0xa694('0x35')]?_0x1bda5d[_0xa694('0x35')]:_0x5b927f;_0x1bda5d[_0xa694('0x37')]=utils[_0xa694('0x3b')](_0x1bda5d[_0xa694('0x34')]||0x0,_0x1bda5d['starttime']||0x0);_0x1bda5d[_0xa694('0x3c')]=_0x1bda5d['answertime']?utils[_0xa694('0x3b')](_0x1bda5d[_0xa694('0x35')],_0x1bda5d['answertime']):0x0;};exports[_0xa694('0x3d')]=function(_0x559d7c){return _0x559d7c===_0xa694('0x3e');};exports[_0xa694('0x3f')]=function(_0x5c248a,_0x13584f,_0x478082,_0x374bf6,_0x232189){var _0x3e647d=_0x374bf6?_0xa694('0x40'):_0x5c248a[_0xa694('0x19')];_0x3e647d=_0x232189?_0xa694('0x41'):_0x3e647d;return{'actionid':_0x5c248a[_0xa694('0x42')],'action':'originate','channel':_0x5c248a[_0xa694('0x43')],'callerid':util[_0xa694('0x11')](_0xa694('0x12'),_0x3e647d,_0x5c248a['calleridnum']),'Exten':_0xa694('0x26'),'Context':_0xa694('0x44'),'Priority':'1','variable':_0x478082,'timeout':(_0x13584f[_0xa694('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5c248a[_0xa694('0x42')]};};exports[_0xa694('0x46')]=function(_0xafa6d7){return _0xafa6d7['countbusyretry']+_0xafa6d7[_0xa694('0x47')]+_0xafa6d7[_0xa694('0x48')]+_0xafa6d7[_0xa694('0x49')]+_0xafa6d7[_0xa694('0x4a')];};exports['cloneAction']=function(_0x145715){var _0x1aa2c1=_['clone'](_0x145715);_0x1aa2c1[_0xa694('0x30')]=0xf;_0x1aa2c1[_0xa694('0x31')]=_0xa694('0x4b');return _0x1aa2c1;};exports[_0xa694('0x4c')]=function(_0x1c1536,_0x2c0c88,_0x50b9af){var _0xac4604={};_0xac4604[_0x2c0c88]=_0x1c1536[_0x2c0c88];_0xac4604['active']=![];_0xac4604[_0xa694('0x4d')]=moment()[_0xa694('0x4e')](_0x50b9af,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0xac4604[_0xa694('0x1a')]=_0x1c1536[_0xa694('0x1a')];_0xac4604[_0xa694('0x4f')]=_0x1c1536[_0xa694('0x4f')];_0xac4604[_0xa694('0x50')]=_0x1c1536[_0xa694('0x50')]||undefined;return _0xac4604;};exports[_0xa694('0x51')]=function(_0xb79e77,_0x5811e8){if(!_['isNil'](_0xb79e77)){if(_0xb79e77[_0xa694('0x52')]>0x0){_0xb79e77[_0xa694('0x52')]-=0x1;}else{logger['error'](_0x5811e8,_0xa694('0x53'));}}else{logger[_0xa694('0x7')](_0x5811e8,_0xa694('0x54'));}};exports[_0xa694('0x55')]=function(_0x1c610d){if(_0x1c610d<=0x0){return!![];}return![];};function buildObj(_0x6c7308,_0x3c64d5,_0x4595de){_0x6c7308[_0xa694('0x56')]=_0x3c64d5;_0x6c7308[_0xa694('0x18')]=_0x6c7308[_0xa694('0x57')];_0x6c7308[_0xa694('0x58')]=_0x6c7308[_0xa694('0x43')];_0x6c7308[_0xa694('0x59')]=_0xa694('0x5a');if(_0x4595de){_0x6c7308['mandatoryDisposition']=_0x4595de['mandatoryDisposition'];}return _0x6c7308;}exports[_0xa694('0x5b')]=buildObj;exports[_0xa694('0x5c')]=function(_0x3f4025){var _0xd9e38d=[];for(var _0x473573 in _0x3f4025){if(_0x3f4025['hasOwnProperty'](_0x473573)){if(!_[_0xa694('0x15')](_0x3f4025[_0x473573])&&_0x3f4025[_0x473573][_0xa694('0x30')]===_0xa694('0x5d')&&_0x3f4025[_0x473573][_0xa694('0x5e')]===_0xa694('0x5f')){_0xd9e38d['push'](_0x3f4025[_0x473573]['id']);}}}return _0xd9e38d;};exports['getDiff']=function(_0x20d6c3){var _0x3beed4=moment()[_0xa694('0x60')](0x0);var _0xb877a8=moment(_0x20d6c3)['milliseconds'](0x0);return _0x3beed4[_0xa694('0x61')](_0xb877a8,'seconds');};exports[_0xa694('0x62')]=function(_0x45d475){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x45d475[_0xa694('0x1a')],'ListId':_0x45d475[_0xa694('0x4f')],'VoiceQueueId':_0x45d475['VoiceQueueId']||undefined,'CampaignId':_0x45d475['CampaignId']||undefined};};exports['filterKey']=function(_0x14ffb3){if(_0x14ffb3===_0xa694('0x42')||_0x14ffb3==='idContact'||_0x14ffb3===_0xa694('0x57')||_0x14ffb3==='type'||_0x14ffb3===_0xa694('0x63')||_0x14ffb3===_0xa694('0x64')||_0x14ffb3===_0xa694('0x38')||_0x14ffb3==='channelAgent'||_0x14ffb3===_0xa694('0x19')||_0x14ffb3===_0xa694('0x65')||_0x14ffb3===_0xa694('0x66')||_0x14ffb3===_0xa694('0x4d')||_0x14ffb3===_0xa694('0x67')||_0x14ffb3===_0xa694('0x47')||_0x14ffb3==='countnoanswerretry'||_0x14ffb3===_0xa694('0x68')||_0x14ffb3==='callback'||_0x14ffb3===_0xa694('0x69')||_0x14ffb3===_0xa694('0x6a')||_0x14ffb3==='recallme'||_0x14ffb3===_0xa694('0x1a')||_0x14ffb3===_0xa694('0x4f')||_0x14ffb3===_0xa694('0x39')||_0x14ffb3==='VoiceQueueId'||_0x14ffb3===_0xa694('0x6b')||_0x14ffb3===_0xa694('0x6c')||_0x14ffb3===_0xa694('0x6d')||_0x14ffb3===_0xa694('0x6e')||_0x14ffb3===_0xa694('0x6f')||_0x14ffb3===_0xa694('0x70')||_0x14ffb3===_0xa694('0x71')||_0x14ffb3===_0xa694('0x72')||_0x14ffb3===_0xa694('0x73')||_0x14ffb3===_0xa694('0x74')||_0x14ffb3===_0xa694('0x75')||_0x14ffb3===_0xa694('0x76')||_0x14ffb3===_0xa694('0x77')||_0x14ffb3===_0xa694('0x78')||_0x14ffb3===_0xa694('0x79')||_0x14ffb3===_0xa694('0x7a')||_0x14ffb3===_0xa694('0x7b')||_0x14ffb3===_0xa694('0x7c')||_0x14ffb3===_0xa694('0x7d')||_0x14ffb3===_0xa694('0x7e')||_0x14ffb3===_0xa694('0x7f')||_0x14ffb3==='rtpaudioqosrtt'||_0x14ffb3===_0xa694('0x80')||_0x14ffb3===_0xa694('0x7a')||_0x14ffb3===_0xa694('0x7b')||_0x14ffb3===_0xa694('0x7c')||_0x14ffb3===_0xa694('0x7d')||_0x14ffb3===_0xa694('0x7e')||_0x14ffb3==='rtpaudioqoslossbridged'||_0x14ffb3==='rtpaudioqosrtt'||_0x14ffb3===_0xa694('0x80')||_0x14ffb3==='bridgepeer'||_0x14ffb3===_0xa694('0x81')||_0x14ffb3===_0xa694('0x30')||_0x14ffb3===_0xa694('0x31')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x34cc57,_0x54f89e){var _0x3d803b,_0x73e0a1,_0xdfa0ce;if(_0x54f89e<=0x0){_0x54f89e=0x1;}_0x3d803b=new RegExp(_0xa694('0x82')+_0x54f89e+'}$');_0x73e0a1=Math['pow'](0xa,_0x54f89e-0x1);_0xdfa0ce=Math[_0xa694('0x83')](0xa,_0x54f89e)-0x1;return util[_0xa694('0x11')]('%s',_[_0xa694('0x84')](_0x34cc57,_0x3d803b,_[_0xa694('0x85')](_0x73e0a1,_0xdfa0ce)));};exports['extractCalleridName']=function(_0x542e16){var _0x4ccd5a=_0x542e16[_0xa694('0x86')](/"(.*?)"/);return _0x4ccd5a?_0x4ccd5a[0x1]:_0x542e16;};exports['extractCalleridNumber']=function(_0xc33cbb){var _0x333bd7=_0xc33cbb[_0xa694('0x86')](/<(.*?)>/);return _0x333bd7?_0x333bd7[0x1]:_0xc33cbb;};function buildNoAnswerEventPayload(_0x417b51,_0x3e0def){var _0x4cd5ee=buildObj(_0x417b51,_0xa694('0x87'));if(!_['isEmpty'](_0x3e0def[_0xa694('0x88')])){Object[_0xa694('0x89')](_0x3e0def[_0xa694('0x88')])[_0xa694('0x8a')](function(_0x212d3c){_0x4cd5ee[_0x212d3c['toLowerCase']()]=_0x3e0def[_0xa694('0x88')][_0x212d3c];});}return _0x4cd5ee;}exports[_0xa694('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x25f2=['toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','logCustomer','answertime','isFailure','Failure','variablesAction','uniqueid','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','interface','channelAgent','motionChannel','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','queue','campaigntype','dialAnswer','scheduledat','callback','callbackuniqueid','callbackat','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','variables'];(function(_0x2ab315,_0x3b6626){var _0x1ee933=function(_0x2f445b){while(--_0x2f445b){_0x2ab315['push'](_0x2ab315['shift']());}};_0x1ee933(++_0x3b6626);}(_0x25f2,0x197));var _0x225f=function(_0x4b205b,_0x2fc87c){_0x4b205b=_0x4b205b-0x0;var _0x153cba=_0x25f2[_0x4b205b];return _0x153cba;};'use strict';var util=require(_0x225f('0x0'));var _=require(_0x225f('0x1'));var moment=require(_0x225f('0x2'));var logger=require(_0x225f('0x3'))(_0x225f('0x4'));var ipAgi=process['env'][_0x225f('0x5')]||_0x225f('0x6');var utils=require(_0x225f('0x7'));exports[_0x225f('0x8')]=function(_0x7b7d54){return function(_0x358daf){logger[_0x225f('0x9')](_0x7b7d54,util[_0x225f('0xa')](_0x358daf,{'showHidden':![],'depth':null}));};};exports[_0x225f('0xb')]=function(_0x4bf1e1,_0x2d6296){logger[_0x225f('0xc')](_0x4bf1e1,util[_0x225f('0xa')](_0x2d6296,{'showHidden':![],'depth':null}));};exports[_0x225f('0xd')]=function(_0x440b84,_0x540f44){logger[_0x225f('0x9')](_0x440b84,util['inspect'](_0x540f44,{'showHidden':![],'depth':null}));};exports[_0x225f('0xe')]=function(_0x5c8aec){return function(_0x2f4972){logger[_0x225f('0xc')](_0x5c8aec,util[_0x225f('0xa')](_0x2f4972,{'showHidden':![],'depth':null}));};};exports[_0x225f('0xf')]=function(_0x55acb3,_0x2a5fe2,_0x31a473){return{'message':_0x55acb3,'unlock':_0x2a5fe2,'active':_0x31a473};};exports[_0x225f('0x10')]=function(_0x3356ae,_0x1cd7a0,_0x500e45){if(!_['isUndefined'](_0x500e45)&&_0x225f('0x11')===typeof _0x500e45&&!_[_0x225f('0x12')](_0x500e45)){if(!_[_0x225f('0x13')](_0x1cd7a0)&&'string'===typeof _0x1cd7a0&&!_[_0x225f('0x12')](_0x1cd7a0)){return util[_0x225f('0x14')]('\x22%s\x22\x20<%s>',_0x1cd7a0,_0x500e45);}return util['format'](_0x225f('0x15'),_0x500e45,_0x500e45);}if(!_['isUndefined'](_0x3356ae)&&'string'===typeof _0x3356ae&&!_[_0x225f('0x12')](_0x3356ae)){return _0x3356ae;}return'\x22\x22\x20<>';};exports[_0x225f('0x16')]=function(_0x3553a3){if(_[_0x225f('0x17')](_0x3553a3)){return![];}return _0x3553a3;};exports[_0x225f('0x18')]=function(_0x14502b,_0x12579b,_0x1b9c6c,_0x3b6626,_0x4bfc14,_0x27d1ab){var _0x4f6c59={'XMD-QUEUE':_0x12579b['Queue']?_0x12579b['Queue'][_0x225f('0x19')]:'','XMD-CALLERID':_0x3b6626,'XMD-CALLERID-PREVIEW':_0x27d1ab?util[_0x225f('0x14')](_0x225f('0x15'),_0x27d1ab[_0x225f('0x1a')],_0x27d1ab[_0x225f('0x1b')]):_0x3b6626,'XMD-DIALID':_0x4bfc14,'XMD-CONTACTID':_0x12579b[_0x225f('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3b6626,'XMD-VOICEQUEUEID':_0x12579b[_0x225f('0x1d')],'XMD-DIALCHANNEL':_0x1b9c6c,'XMD-DIALTIMEOUT':_0x14502b[_0x225f('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x225f('0x1f'),_0x14502b[_0x225f('0x20')]?'g':'',_[_0x225f('0x12')](_0x14502b[_0x225f('0x21')])?'':_0x225f('0x22')),'XMD-DIALURL':_0x14502b[_0x225f('0x23')]||'','XMD-AGI':_0x14502b[_0x225f('0x24')]?util[_0x225f('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x14502b[_0x225f('0x24')]):_0x225f('0x25'),'XMD-AGIAFTER':_0x14502b['dialQueueProject2']?util[_0x225f('0x14')](_0x225f('0x26'),ipAgi,_0x14502b['dialQueueProject2']):_0x225f('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x27d1ab?_0x27d1ab[_0x225f('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x27d1ab?_0x27d1ab[_0x225f('0x28')]:'','XMD-DESTINATION':_0x225f('0x29'),'SIPADDHEADER':_0x225f('0x2a')};if(!_['isEmpty'](_0x14502b['monitor_format'])){_0x4f6c59[util[_0x225f('0x14')]('%s',_0x225f('0x2b'))]=_0x14502b[_0x225f('0x21')];_0x4f6c59[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4bfc14;}return _0x4f6c59;};exports['toLowerVariables']=function(_0x47c366){var _0xaab44c={};for(var _0x184f72 in _0x47c366){if(_0x47c366[_0x225f('0x2c')](_0x184f72)){_0xaab44c[util[_0x225f('0x14')]('%s',_[_0x225f('0x2d')](_0x184f72))]=_0x47c366[_0x184f72];}}return{'variables':_0xaab44c};};exports[_0x225f('0x2e')]=function(_0x408fd8,_0xade791){if(!_[_0x225f('0x17')](_0x408fd8)){if(_0x408fd8['hasOwnProperty'](_0x225f('0x2f'))){if(_0x408fd8[_0x225f('0x2f')]>0x0){_0x408fd8[_0x225f('0x2f')]-=0x1;}else{logger['error'](_0x225f('0x30'),_0xade791);}}}else{logger[_0x225f('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0xade791);}};exports[_0x225f('0x31')]=function(_0x44508a){var _0x55e5d1=moment()[_0x225f('0x14')](_0x225f('0x32'));_0x44508a[_0x225f('0x33')]=0xd;_0x44508a[_0x225f('0x34')]=_0x225f('0x35');_0x44508a[_0x225f('0x36')]=_0x55e5d1;_0x44508a[_0x225f('0x37')]=_0x55e5d1;_0x44508a[_0x225f('0x38')]=_0x55e5d1;};exports[_0x225f('0x39')]=function(_0x20ed06,_0x2abb5e,_0x49a5cb){var _0x496b2c=moment()[_0x225f('0x14')](_0x225f('0x32'));_0x20ed06['state']=_0x2abb5e;_0x20ed06[_0x225f('0x34')]=_0x49a5cb;_0x20ed06[_0x225f('0x37')]=_0x496b2c;_0x20ed06[_0x225f('0x3a')]=utils[_0x225f('0x3b')](_0x20ed06[_0x225f('0x37')],_0x20ed06[_0x225f('0x36')]);};exports[_0x225f('0x3c')]=function(_0x472d7d,_0x4450d0,_0x23cbbd){_0x472d7d[_0x225f('0x3d')]=_0x4450d0;_0x472d7d['UserId']=_0x23cbbd;};exports[_0x225f('0x3e')]=function(_0x550dbd,_0x4d28f9,_0x141681){var _0x5df6c4=moment()[_0x225f('0x14')](_0x225f('0x32'));_0x550dbd[_0x225f('0x33')]=_0x4d28f9;_0x550dbd[_0x225f('0x34')]=_0x141681;_0x550dbd[_0x225f('0x37')]=_0x550dbd[_0x225f('0x37')]?_0x550dbd[_0x225f('0x37')]:_0x5df6c4;_0x550dbd[_0x225f('0x38')]=_0x550dbd['endtime']?_0x550dbd[_0x225f('0x38')]:_0x5df6c4;_0x550dbd[_0x225f('0x3a')]=utils[_0x225f('0x3b')](_0x550dbd[_0x225f('0x37')]||0x0,_0x550dbd[_0x225f('0x36')]||0x0);_0x550dbd['talktime']=_0x550dbd[_0x225f('0x3f')]?utils['getSeconds'](_0x550dbd['endtime'],_0x550dbd[_0x225f('0x3f')]):0x0;};exports[_0x225f('0x40')]=function(_0x51b4e5){return _0x51b4e5===_0x225f('0x41');};exports[_0x225f('0x42')]=function(_0x772a17,_0xbe743,_0xb8f3a1,_0xb472fd,_0x4eff88){var _0x4f366d=_0xb472fd?'RECALL':_0x772a17[_0x225f('0x1a')];_0x4f366d=_0x4eff88?'BOOKED':_0x4f366d;return{'actionid':_0x772a17[_0x225f('0x43')],'action':'originate','channel':_0x772a17['channelAgent'],'callerid':util['format'](_0x225f('0x15'),_0x4f366d,_0x772a17[_0x225f('0x1b')]),'Exten':_0x225f('0x29'),'Context':'from-sip','Priority':'1','variable':_0xb8f3a1,'timeout':(_0xbe743[_0x225f('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x772a17[_0x225f('0x43')]};};exports[_0x225f('0x45')]=function(_0x103c59){return _0x103c59['countbusyretry']+_0x103c59[_0x225f('0x46')]+_0x103c59[_0x225f('0x47')]+_0x103c59[_0x225f('0x48')]+_0x103c59[_0x225f('0x49')];};exports[_0x225f('0x4a')]=function(_0x584907){var _0x41d488=_['clone'](_0x584907);_0x41d488[_0x225f('0x33')]=0xf;_0x41d488[_0x225f('0x34')]=_0x225f('0x4b');return _0x41d488;};exports[_0x225f('0x4c')]=function(_0x355c8a,_0x543ec9,_0x1f5f3c){var _0x1df2d6={};_0x1df2d6[_0x543ec9]=_0x355c8a[_0x543ec9];_0x1df2d6[_0x225f('0x4d')]=![];_0x1df2d6['scheduledat']=moment()['add'](_0x1f5f3c,_0x225f('0x4e'))['format'](_0x225f('0x32'));_0x1df2d6['ContactId']=_0x355c8a[_0x225f('0x1c')];_0x1df2d6[_0x225f('0x4f')]=_0x355c8a[_0x225f('0x4f')];_0x1df2d6[_0x225f('0x1d')]=_0x355c8a[_0x225f('0x1d')]||undefined;return _0x1df2d6;};exports[_0x225f('0x50')]=function(_0x68f760,_0xb651f){if(!_['isNil'](_0x68f760)){if(_0x68f760[_0x225f('0x51')]>0x0){_0x68f760[_0x225f('0x51')]-=0x1;}else{logger['error'](_0xb651f,_0x225f('0x52'));}}else{logger[_0x225f('0x9')](_0xb651f,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x225f('0x53')]=function(_0x3a8309){if(_0x3a8309<=0x0){return!![];}return![];};function buildObj(_0x1c7b5e,_0x424a32,_0x5740c6){_0x1c7b5e[_0x225f('0x54')]=_0x424a32;_0x1c7b5e[_0x225f('0x19')]=_0x1c7b5e['queue'];_0x1c7b5e[_0x225f('0x55')]=_0x1c7b5e[_0x225f('0x56')];_0x1c7b5e[_0x225f('0x57')]='voice';if(_0x5740c6){_0x1c7b5e[_0x225f('0x58')]=_0x5740c6['mandatoryDisposition'];}return _0x1c7b5e;}exports[_0x225f('0x59')]=buildObj;exports[_0x225f('0x5a')]=function(_0x1e1f2e){var _0x53b4d3=[];for(var _0x253ad5 in _0x1e1f2e){if(_0x1e1f2e[_0x225f('0x2c')](_0x253ad5)){if(!_[_0x225f('0x17')](_0x1e1f2e[_0x253ad5])&&_0x1e1f2e[_0x253ad5][_0x225f('0x33')]==='not_inuse'&&_0x1e1f2e[_0x253ad5][_0x225f('0x5b')]===_0x225f('0x5c')){_0x53b4d3[_0x225f('0x5d')](_0x1e1f2e[_0x253ad5]['id']);}}}return _0x53b4d3;};exports[_0x225f('0x5e')]=function(_0x5c5508){var _0x1c6c97=moment()[_0x225f('0x5f')](0x0);var _0x59e9ee=moment(_0x5c5508)[_0x225f('0x5f')](0x0);return _0x1c6c97[_0x225f('0x60')](_0x59e9ee,'seconds');};exports['createBody']=function(_0xb1441c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xb1441c[_0x225f('0x1c')],'ListId':_0xb1441c[_0x225f('0x4f')],'VoiceQueueId':_0xb1441c[_0x225f('0x1d')]||undefined,'CampaignId':_0xb1441c['CampaignId']||undefined};};exports['filterKey']=function(_0x4b67fc){if(_0x4b67fc===_0x225f('0x43')||_0x4b67fc==='idContact'||_0x4b67fc===_0x225f('0x61')||_0x4b67fc==='type'||_0x4b67fc===_0x225f('0x62')||_0x4b67fc===_0x225f('0x63')||_0x4b67fc===_0x225f('0x3d')||_0x4b67fc==='channelAgent'||_0x4b67fc===_0x225f('0x1a')||_0x4b67fc===_0x225f('0x4d')||_0x4b67fc===_0x225f('0x1b')||_0x4b67fc===_0x225f('0x64')||_0x4b67fc==='countbusyretry'||_0x4b67fc==='countcongestionretry'||_0x4b67fc===_0x225f('0x47')||_0x4b67fc==='countglobal'||_0x4b67fc===_0x225f('0x65')||_0x4b67fc===_0x225f('0x66')||_0x4b67fc===_0x225f('0x67')||_0x4b67fc==='recallme'||_0x4b67fc===_0x225f('0x1c')||_0x4b67fc==='ListId'||_0x4b67fc===_0x225f('0x68')||_0x4b67fc==='VoiceQueueId'||_0x4b67fc===_0x225f('0x69')||_0x4b67fc===_0x225f('0x6a')||_0x4b67fc==='xmd-queue'||_0x4b67fc===_0x225f('0x6b')||_0x4b67fc===_0x225f('0x6c')||_0x4b67fc===_0x225f('0x6d')||_0x4b67fc===_0x225f('0x6e')||_0x4b67fc===_0x225f('0x6f')||_0x4b67fc===_0x225f('0x70')||_0x4b67fc===_0x225f('0x71')||_0x4b67fc==='xmd-contactid'||_0x4b67fc===_0x225f('0x72')||_0x4b67fc==='xmd-callerid'||_0x4b67fc===_0x225f('0x73')||_0x4b67fc===_0x225f('0x74')||_0x4b67fc===_0x225f('0x75')||_0x4b67fc===_0x225f('0x76')||_0x4b67fc===_0x225f('0x77')||_0x4b67fc===_0x225f('0x78')||_0x4b67fc==='rtpaudioqosloss'||_0x4b67fc==='rtpaudioqoslossbridged'||_0x4b67fc===_0x225f('0x79')||_0x4b67fc===_0x225f('0x7a')||_0x4b67fc===_0x225f('0x75')||_0x4b67fc==='rtpaudioqosbridged'||_0x4b67fc==='rtpaudioqosjitter'||_0x4b67fc==='rtpaudioqosjitterbridged'||_0x4b67fc===_0x225f('0x7b')||_0x4b67fc===_0x225f('0x7c')||_0x4b67fc===_0x225f('0x79')||_0x4b67fc===_0x225f('0x7a')||_0x4b67fc===_0x225f('0x7d')||_0x4b67fc==='bridgepvtcallid'||_0x4b67fc===_0x225f('0x33')||_0x4b67fc===_0x225f('0x34')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3d4a8a,_0x37748f){var _0x90c78a,_0x326b9c,_0x13a73a;if(_0x37748f<=0x0){_0x37748f=0x1;}_0x90c78a=new RegExp(_0x225f('0x7e')+_0x37748f+'}$');_0x326b9c=Math[_0x225f('0x7f')](0xa,_0x37748f-0x1);_0x13a73a=Math['pow'](0xa,_0x37748f)-0x1;return util[_0x225f('0x14')]('%s',_[_0x225f('0x80')](_0x3d4a8a,_0x90c78a,_[_0x225f('0x81')](_0x326b9c,_0x13a73a)));};exports['extractCalleridName']=function(_0x42a3e6){var _0x45f251=_0x42a3e6[_0x225f('0x82')](/"(.*?)"/);return _0x45f251?_0x45f251[0x1]:_0x42a3e6;};exports[_0x225f('0x83')]=function(_0x438933){var _0x4ffab2=_0x438933[_0x225f('0x82')](/<(.*?)>/);return _0x4ffab2?_0x4ffab2[0x1]:_0x438933;};function buildNoAnswerEventPayload(_0x24c419,_0xae761){var _0x5b7c6f=buildObj(_0x24c419,'noanswer');if(!_[_0x225f('0x12')](_0xae761['variables'])){Object['keys'](_0xae761[_0x225f('0x84')])['forEach'](function(_0x15317f){_0x5b7c6f[_0x15317f[_0x225f('0x85')]()]=_0xae761[_0x225f('0x84')][_0x15317f];});}return _0x5b7c6f;}exports[_0x225f('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 82adbea..a762cff 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 _0x8890=['reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string','boolean','queueremove','queuepause'];(function(_0x3c0cd6,_0x5ba428){var _0x4381ec=function(_0x2ab4b3){while(--_0x2ab4b3){_0x3c0cd6['push'](_0x3c0cd6['shift']());}};_0x4381ec(++_0x5ba428);}(_0x8890,0x9b));var _0x0889=function(_0xbadc37,_0x3b1521){_0xbadc37=_0xbadc37-0x0;var _0x185db6=_0x8890[_0xbadc37];return _0x185db6;};'use strict';exports[_0x0889('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0889('0x1'),'required':!![]},'membername':{'type':_0x0889('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x0889('0x2'),'required':![]}};exports[_0x0889('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0889('0x1'),'required':!![]}};exports[_0x0889('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x0889('0x1'),'required':![]}};exports[_0x0889('0x5')]={'module':{'type':_0x0889('0x1'),'required':![]}};exports[_0x0889('0x6')]={'uniqueid':{'type':_0x0889('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x0889('0x1'),'required':!![]},'filename':{'type':_0x0889('0x1')},'format':{'type':_0x0889('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x0889('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0889('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x0889('0x1')}}; \ No newline at end of file +var _0x6c25=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x31d0c8,_0x4a2e37){var _0x41a548=function(_0x54a29d){while(--_0x54a29d){_0x31d0c8['push'](_0x31d0c8['shift']());}};_0x41a548(++_0x4a2e37);}(_0x6c25,0x143));var _0x56c2=function(_0x5e25f7,_0x39298c){_0x5e25f7=_0x5e25f7-0x0;var _0x1ae051=_0x6c25[_0x5e25f7];return _0x1ae051;};'use strict';exports['queueadd']={'queue':{'type':_0x56c2('0x0'),'required':!![]},'interface':{'type':_0x56c2('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x56c2('0x1'),'required':![]},'paused':{'type':_0x56c2('0x2'),'required':![]}};exports[_0x56c2('0x3')]={'queue':{'type':_0x56c2('0x0'),'required':!![]},'interface':{'type':_0x56c2('0x0'),'required':!![]}};exports[_0x56c2('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x56c2('0x0'),'required':![]}};exports[_0x56c2('0x5')]={'module':{'type':'string','required':![]}};exports[_0x56c2('0x6')]={'uniqueid':{'type':_0x56c2('0x0'),'required':!![]}};exports[_0x56c2('0x7')]={'uniqueid':{'type':_0x56c2('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x56c2('0x0')},'mixmonitorid':{'type':_0x56c2('0x0')}};exports[_0x56c2('0x8')]={'uniqueid':{'type':_0x56c2('0x0'),'required':!![]}};exports[_0x56c2('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x56c2('0x0'),'required':!![]},'context':{'type':_0x56c2('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7d780c5..f78fcf3 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(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0b0e,0x187));var _0xe0b0=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x0b0e[_0x15ea09];return _0x3e9c78;};'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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x0b0e[_0x3aaf0a];return _0x33e6bc;};'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 diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 51e4794..2eef465 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 _0xa49b=['mergeDBDataToRealtime','assign'];(function(_0x5e2217,_0x597085){var _0x146245=function(_0x2ca2a1){while(--_0x2ca2a1){_0x5e2217['push'](_0x5e2217['shift']());}};_0x146245(++_0x597085);}(_0xa49b,0xab));var _0xba49=function(_0x170bf0,_0x5bf408){_0x170bf0=_0x170bf0-0x0;var _0x48342f=_0xa49b[_0x170bf0];return _0x48342f;};'use strict';function mergeDBDataToRealtime(_0x4b9952,_0x1939cf){var _0x89aaba=Object[_0xba49('0x0')]({},_0x4b9952);for(var _0x2f2722 in _0x1939cf){if(_0x89aaba['hasOwnProperty'](_0x2f2722)){_0x89aaba[_0x2f2722]=_0x1939cf[_0x2f2722];}}return _0x89aaba;}exports[_0xba49('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x8b62=['assign'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x8b62,0xd1));var _0x28b6=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x8b62[_0x2064e5];return _0x21a233;};'use strict';function mergeDBDataToRealtime(_0x469ce6,_0x13656c){var _0x5e376b=Object[_0x28b6('0x0')]({},_0x469ce6);for(var _0x3af8d9 in _0x13656c){if(_0x5e376b['hasOwnProperty'](_0x3af8d9)){_0x5e376b[_0x3af8d9]=_0x13656c[_0x3af8d9];}}return _0x5e376b;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4d6ec1d..d65c5b3 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 _0xa08a=['calleridnum','channel','callerid','calleridpreview','disposition','ANSWERED','calleridname','transfers','transfereelinkedid','uniqueid','blindTransfer','linkedid','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','originatecalleridnum','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','bind','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','voiceQueueReport','connectedlinenum','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','split','outbound','internal','destination','type','lastapplication','queue','lastdata','context','from-sip','xcally-motion-preview'];(function(_0x30b046,_0x126bc2){var _0x24eda7=function(_0x382847){while(--_0x382847){_0x30b046['push'](_0x30b046['shift']());}};_0x24eda7(++_0x126bc2);}(_0xa08a,0x1dd));var _0xaa08=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0xa08a[_0x3beea0];return _0x314eb1;};'use strict';var _=require(_0xaa08('0x0'));var moment=require('moment');var util=require(_0xaa08('0x1'));var config=require(_0xaa08('0x2'));var ami=require(_0xaa08('0x3'));var RpcVoiceAgentReport=require(_0xaa08('0x4'));var RpcVoiceCallReport=require(_0xaa08('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xaa08('0x6'));var RpcVoiceRecording=require(_0xaa08('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xaa08('0x8'));var VoiceCallReport=require(_0xaa08('0x9'));var VoiceAgentReport=require(_0xaa08('0xa'));var VoiceDialReport=require(_0xaa08('0xb'));var UserReport=require(_0xaa08('0xc'));function Report(_0x58d5d5){this[_0xaa08('0xd')]=_0x58d5d5;this[_0xaa08('0xe')]=_0x58d5d5['agents'];this['telephones']=_0x58d5d5[_0xaa08('0xf')];}Report[_0xaa08('0x10')][_0xaa08('0x11')]=function(_0x49d4d1){var _0x31c940=new VoiceQueueReport(this[_0xaa08('0xd')]);var _0x3cb1bf=new VoiceAgentReport(this[_0xaa08('0xd')]);var _0x59b5a0=new VoiceDialReport(this['realtime']);var _0xdda0fb=new VoiceCallReport(this[_0xaa08('0xd')]);var _0x5c9d00=new UserReport(this[_0xaa08('0xd')]);if(config[_0xaa08('0x12')]&&config[_0xaa08('0x12')]['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0xaa08('0x13'),this[_0xaa08('0x14')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0xaa08('0x15')]['bind'](this));ami['on'](_0xaa08('0x16'),this['blindTransfer'][_0xaa08('0x17')](this));ami['on'](_0xaa08('0x18'),this[_0xaa08('0x19')]['bind'](this));}};Report['prototype'][_0xaa08('0x1a')]=function(_0x12f751){var _0x14e1d9;_0x14e1d9=_[_0xaa08('0x1b')](this[_0xaa08('0xe')],function(_0x34b5a2){return _0x34b5a2[_0xaa08('0x1c')]==_0x12f751||_0x34b5a2[_0xaa08('0x1d')]==_0x12f751;});if(_[_0xaa08('0x1e')](_0x14e1d9)){var _0x13ead3=_[_0xaa08('0x1b')](this[_0xaa08('0xf')],function(_0x1ba3c5){return _0x1ba3c5['accountcode']==_0x12f751||_0x1ba3c5['name']==_0x12f751;});if(_0x13ead3){_0x14e1d9=_['find'](this[_0xaa08('0xe')],function(_0x527652){return _0x527652['interface']==util[_0xaa08('0x1f')](_0xaa08('0x20'),_0x13ead3[_0xaa08('0x1d')]);});}}return _0x14e1d9;};Report[_0xaa08('0x10')][_0xaa08('0x21')]=function(_0x2e0a4e){for(var _0x116f11=0x0;_0x116f11<_0x2e0a4e['length'];_0x116f11+=0x1){var _0x5507a6=this[_0xaa08('0x1a')](_0x2e0a4e[_0x116f11][_0xaa08('0x22')]);if(_0x5507a6){_0x2e0a4e[_0x116f11][_0xaa08('0x1c')]=_0x5507a6[_0xaa08('0x1c')];_0x2e0a4e[_0x116f11]['assigned']=!![];_0x2e0a4e[_0x116f11]['lastAssignedTo']=_0x5507a6['name'];_0x2e0a4e[_0x116f11][_0xaa08('0x23')]=_[_0xaa08('0x1e')](_0x5507a6[_0xaa08('0x23')])?util[_0xaa08('0x1f')]('SIP/%s',_0x5507a6[_0xaa08('0x1d')]):_0x5507a6[_0xaa08('0x23')];if(_0x2e0a4e[_0x116f11][_0xaa08('0x24')]){_0x2e0a4e[_0x116f11][_0xaa08('0x25')]=moment()[_0xaa08('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2e0a4e[_0x116f11][_0xaa08('0x26')]){_0x2e0a4e[_0x116f11][_0xaa08('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xaa08('0x21')](_0x2e0a4e[_0x116f11]);}RpcVoiceQueueReport[_0xaa08('0x28')](_0x2e0a4e[_0x116f11]);}};function extractCalleridNumber(_0x2c7bee){var _0x58c141=_0x2c7bee[_0xaa08('0x29')](/<(.*?)>/);return _0x58c141?_0x58c141[0x1]:_0x2c7bee;}Report[_0xaa08('0x10')][_0xaa08('0x2a')]=function(_0x4043cf){for(var _0x256a84=0x0;_0x256a84',_0x2e27ba[_0xaa08('0x3f')],_0x2e27ba[_0xaa08('0x39')]);}if(RpcVoiceTransferReport[_0xaa08('0x40')][_0x2e27ba['linkedid']]){var _0x4c69e7=RpcVoiceTransferReport['transfers'][_0x2e27ba['linkedid']];_0x4c69e7[_0xaa08('0x41')]=_0x2e27ba[_0xaa08('0x42')];RpcVoiceTransferReport[_0xaa08('0x43')](_0x4c69e7);delete RpcVoiceTransferReport[_0xaa08('0x40')][_0x2e27ba[_0xaa08('0x44')]];}if(_['isNil'](_0x2e27ba[_0xaa08('0x32')])){_0x2e27ba[_0xaa08('0x32')]=this[_0xaa08('0x2d')](_0x2e27ba);}if(_[_0xaa08('0x1e')](_0x2e27ba['UserId'])){var _0x43113b=_0x2e27ba[_0xaa08('0x3a')][_0xaa08('0x2e')]('-')[0x0];var _0x23d1a6=this[_0xaa08('0xe')][_0x43113b];if(!_0x23d1a6)_0x23d1a6=this[_0xaa08('0x2a')](_0x2e27ba[_0xaa08('0x1c')]);if(_0x23d1a6){_0x2e27ba['UserId']=_0x23d1a6['id'];_0x2e27ba['membername']=_0x23d1a6[_0xaa08('0x1d')];}}RpcVoiceCallReport[_0xaa08('0x28')](_0x2e27ba);if(_0x2e27ba[_0xaa08('0x45')]){for(var _0x1f1397=0x0;_0x1f1397<_0x2e27ba[_0xaa08('0x46')]['length'];_0x1f1397+=0x1){_0x2e27ba[_0xaa08('0x47')]=_0x2e27ba[_0xaa08('0x46')][_0x1f1397][_0xaa08('0x48')];_0x2e27ba['createdAt']=_0x2e27ba[_0xaa08('0x46')][_0x1f1397][_0xaa08('0x49')];if(_0x2e27ba[_0xaa08('0x4a')]=='xcally-motion-preview'){_0x2e27ba[_0xaa08('0x39')]=_0x2e27ba[_0xaa08('0x22')];_0x2e27ba[_0xaa08('0x3f')]=_0x2e27ba[_0xaa08('0x4b')];_0x2e27ba[_0xaa08('0x22')]=_0x2e27ba[_0xaa08('0x1c')];_0x2e27ba[_0xaa08('0x4b')]=_0x2e27ba[_0xaa08('0x4c')];_0x2e27ba[_0xaa08('0x4a')]=_0x2e27ba[_0xaa08('0x4d')];}else if(_0x2e27ba[_0xaa08('0x4a')]==_0xaa08('0x4e')){_0x2e27ba['calleridnum']=_0x2e27ba['destination'];_0x2e27ba[_0xaa08('0x4a')]=_0x2e27ba['originatecalleridnum'];}RpcVoiceRecording[_0xaa08('0x28')](_0x2e27ba);}}};Report[_0xaa08('0x10')]['voiceAgentReport']=function(_0x54a922){if(_[_0xaa08('0x4f')](_0x54a922)){_0x54a922[_0xaa08('0x50')](function(_0x3aab16){RpcVoiceAgentReport[_0xaa08('0x28')](_0x3aab16);});}else{RpcVoiceAgentReport[_0xaa08('0x28')](_0x54a922);}};Report['prototype'][_0xaa08('0x15')]=function(_0x5d3c5b){RpcVoiceDialReport[_0xaa08('0x28')](_0x5d3c5b);var _0x9085c3;var _0x1d0285;var _0x170468=_0x5d3c5b[_0xaa08('0x3a')];if(_[_0xaa08('0x51')](_0x170468,_0xaa08('0x52'))){_0x1d0285=_0x170468[_0xaa08('0x53')](_0x170468[_0xaa08('0x54')]('/')+0x1,_0x170468[_0xaa08('0x54')]('@'));_0x9085c3=_['find'](this[_0xaa08('0xe')],function(_0x42bf80){return _0x42bf80[_0xaa08('0x55')]==_0x1d0285||_0x42bf80[_0xaa08('0x56')]==_0x1d0285||_0x42bf80[_0xaa08('0x1c')]==_0x1d0285;});}else{_0x1d0285=_0x170468[_0xaa08('0x53')](_0x170468[_0xaa08('0x54')]('/')+0x1,_0x170468[_0xaa08('0x57')]('-'));_0x9085c3=this['findAgent'](_0x1d0285);}if(_0x9085c3){_0x5d3c5b[_0xaa08('0x23')]=_[_0xaa08('0x1e')](_0x9085c3[_0xaa08('0x23')])?util[_0xaa08('0x1f')](_0xaa08('0x20'),_0x9085c3[_0xaa08('0x1d')]):_0x9085c3[_0xaa08('0x23')];_0x5d3c5b[_0xaa08('0x4c')]=_0x9085c3['name'];_0x5d3c5b[_0xaa08('0x1c')]=_0x9085c3[_0xaa08('0x1c')];RpcMemberReport[_0xaa08('0x15')](_0x5d3c5b);}};Report[_0xaa08('0x10')][_0xaa08('0x43')]=function(_0x3e2ec1){RpcVoiceTransferReport[_0xaa08('0x40')][_0x3e2ec1[_0xaa08('0x58')]]=_0x3e2ec1;};Report[_0xaa08('0x10')][_0xaa08('0x19')]=function(_0x255a5b){RpcVoiceTransferReport['attendedTransfer'](_0x255a5b);};module['exports']=Report; \ No newline at end of file +var _0x37ac=['lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','getCallType','UserId','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','originatecalleridnum','forEach','startsWith','Local','indexOf','mobile','phone','substring','blindTransfer','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','voiceQueueReport','length','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','keys','channel','split','getAgentByInternal','calleridnum','outbound','internal','voiceCallReport','destination','dialer'];(function(_0x46d2ac,_0x4e71a7){var _0x153b36=function(_0x56a47c){while(--_0x56a47c){_0x46d2ac['push'](_0x46d2ac['shift']());}};_0x153b36(++_0x4e71a7);}(_0x37ac,0x8d));var _0xc37a=function(_0xdd209,_0x53e6e3){_0xdd209=_0xdd209-0x0;var _0x4d4aac=_0x37ac[_0xdd209];return _0x4d4aac;};'use strict';var _=require(_0xc37a('0x0'));var moment=require('moment');var util=require(_0xc37a('0x1'));var config=require(_0xc37a('0x2'));var ami=require(_0xc37a('0x3'));var RpcVoiceAgentReport=require(_0xc37a('0x4'));var RpcVoiceCallReport=require(_0xc37a('0x5'));var RpcVoiceDialReport=require(_0xc37a('0x6'));var RpcMemberReport=require(_0xc37a('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xc37a('0x8'));var RpcVoiceTransferReport=require(_0xc37a('0x9'));var VoiceQueueReport=require(_0xc37a('0xa'));var VoiceCallReport=require(_0xc37a('0xb'));var VoiceAgentReport=require(_0xc37a('0xc'));var VoiceDialReport=require(_0xc37a('0xd'));var UserReport=require(_0xc37a('0xe'));function Report(_0x56f84e){this[_0xc37a('0xf')]=_0x56f84e;this[_0xc37a('0x10')]=_0x56f84e[_0xc37a('0x10')];this['telephones']=_0x56f84e[_0xc37a('0x11')];}Report[_0xc37a('0x12')]['sync']=function(_0x457281){var _0x393181=new VoiceQueueReport(this[_0xc37a('0xf')]);var _0x281a20=new VoiceAgentReport(this[_0xc37a('0xf')]);var _0x4b457f=new VoiceDialReport(this['realtime']);var _0x4f93aa=new VoiceCallReport(this[_0xc37a('0xf')]);var _0x2d002b=new UserReport(this[_0xc37a('0xf')]);if(config['xdr']&&config[_0xc37a('0x13')][_0xc37a('0x14')]){ami['on'](_0xc37a('0x15'),this['voiceQueueReport'][_0xc37a('0x16')](this));ami['on'](_0xc37a('0x17'),this['voiceCallReport']['bind'](this));ami['on'](_0xc37a('0x18'),this[_0xc37a('0x19')][_0xc37a('0x16')](this));ami['on'](_0xc37a('0x1a'),this[_0xc37a('0x1b')][_0xc37a('0x16')](this));ami['on'](_0xc37a('0x1c'),this['blindTransfer'][_0xc37a('0x16')](this));ami['on'](_0xc37a('0x1d'),this[_0xc37a('0x1e')][_0xc37a('0x16')](this));}};Report[_0xc37a('0x12')][_0xc37a('0x1f')]=function(_0x305019){var _0xe473ac;_0xe473ac=_[_0xc37a('0x20')](this[_0xc37a('0x10')],function(_0x50042a){return _0x50042a['accountcode']==_0x305019||_0x50042a[_0xc37a('0x21')]==_0x305019;});if(_[_0xc37a('0x22')](_0xe473ac)){var _0x468ed2=_[_0xc37a('0x20')](this['telephones'],function(_0x2ab384){return _0x2ab384[_0xc37a('0x23')]==_0x305019||_0x2ab384[_0xc37a('0x21')]==_0x305019;});if(_0x468ed2){_0xe473ac=_[_0xc37a('0x20')](this['agents'],function(_0x1df30e){return _0x1df30e[_0xc37a('0x24')]==util[_0xc37a('0x25')]('SIP/%s',_0x468ed2[_0xc37a('0x21')]);});}}return _0xe473ac;};Report[_0xc37a('0x12')][_0xc37a('0x26')]=function(_0x11daf9){for(var _0x5e1ba6=0x0;_0x5e1ba6<_0x11daf9[_0xc37a('0x27')];_0x5e1ba6+=0x1){var _0x1715fe=this[_0xc37a('0x1f')](_0x11daf9[_0x5e1ba6]['connectedlinenum']);if(_0x1715fe){_0x11daf9[_0x5e1ba6][_0xc37a('0x23')]=_0x1715fe['accountcode'];_0x11daf9[_0x5e1ba6][_0xc37a('0x28')]=!![];_0x11daf9[_0x5e1ba6][_0xc37a('0x29')]=_0x1715fe[_0xc37a('0x21')];_0x11daf9[_0x5e1ba6]['interface']=_['isNil'](_0x1715fe[_0xc37a('0x24')])?util[_0xc37a('0x25')](_0xc37a('0x2a'),_0x1715fe['name']):_0x1715fe['interface'];if(_0x11daf9[_0x5e1ba6][_0xc37a('0x2b')]){_0x11daf9[_0x5e1ba6]['queuecallercompleteAt']=moment()[_0xc37a('0x25')](_0xc37a('0x2c'));}if(_0x11daf9[_0x5e1ba6]['queuecallerexit']){_0x11daf9[_0x5e1ba6][_0xc37a('0x2d')]=moment()[_0xc37a('0x25')](_0xc37a('0x2c'));}RpcMemberReport[_0xc37a('0x26')](_0x11daf9[_0x5e1ba6]);}RpcVoiceQueueReport[_0xc37a('0x2e')](_0x11daf9[_0x5e1ba6]);}};function extractCalleridNumber(_0x4374d4){var _0x1dae70=_0x4374d4['match'](/<(.*?)>/);return _0x1dae70?_0x1dae70[0x1]:_0x4374d4;}Report[_0xc37a('0x12')]['getAgentByInternal']=function(_0x32acb2){for(var _0x4c860b=0x0;_0x4c860b0x0?!![]:![];if(!_0x337fac){return this[_0xec39('0x1b')](this[_0xec39('0x15')][_0xec39('0x6f')]);}};VoiceQueueReport[_0xec39('0xb')][_0xec39('0x1d')]=function(_0x105700){var _0x1c2453=this[_0xec39('0x15')]['id'];if(this[_0xec39('0x15')]['queuestatus'][_0x1c2453]&&this[_0xec39('0x15')][_0xec39('0x66')][_0x1c2453][_0x105700[_0xec39('0x65')]]){this[_0xec39('0x15')][_0xec39('0x66')][_0x1c2453][_0x105700[_0xec39('0x65')]][_0xec39('0x10')][_0xec39('0x70')](_0x105700);}};VoiceQueueReport[_0xec39('0xb')][_0xec39('0x18')]=function(_0x181ab3){var _0x3818d7=this;try{if(this[_0xec39('0x5f')](_0x181ab3)&&this[_0xec39('0x5f')](_0x181ab3['queue'])){logger[_0xec39('0x4e')](_0xec39('0x71'),util[_0xec39('0x48')](_0x181ab3,{'showHidden':![],'depth':null}));var _0x129f30=this[_0xec39('0x13')][_0x181ab3[_0xec39('0x51')]];if(_0x129f30){logger['debug'](_0xec39('0x72'),_0x129f30[_0xec39('0x5e')]);this[_0xec39('0x15')][_0xec39('0x60')][_0x129f30['name']]={'summaryEvent':_0x181ab3};this['summary']['statusRequests']+=0x1;return ami['Action']({'action':_0xec39('0x66'),'queue':_0x129f30[_0xec39('0x5e')]})[_0xec39('0x64')](function(_0x372fbb){if(!_0x3818d7[_0xec39('0x15')][_0xec39('0x66')][_0x181ab3[_0xec39('0x65')]]){_0x3818d7[_0xec39('0x15')]['queuestatus'][_0x181ab3[_0xec39('0x65')]]={};}_0x3818d7[_0xec39('0x15')][_0xec39('0x66')][_0x181ab3[_0xec39('0x65')]][_0x372fbb[_0xec39('0x65')]]={'queue':_0x129f30[_0xec39('0x5e')],'agents':[]};})[_0xec39('0x61')](function(_0x1010b6){throw _0x1010b6;});}}}catch(_0x599395){logger[_0xec39('0x46')](_0xec39('0x73'),util[_0xec39('0x48')](_0x599395,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec39('0xb')]['syncQueueSummaryComplete']=function(_0x28b23b){if(this[_0xec39('0x15')]['statusRequests']>0x0){this[_0xec39('0x15')][_0xec39('0x6f')]=_0x28b23b;return;}logger[_0xec39('0x4e')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xec39('0x48')](_0x28b23b,{'showHidden':![],'depth':null}));this[_0xec39('0x15')]=initializeSummary();ami[_0xec39('0x4d')](_0xec39('0x74'),{});};VoiceQueueReport[_0xec39('0xb')][_0xec39('0x1f')]=function(_0x100138){try{if(this[_0xec39('0x5f')](_0x100138)){logger[_0xec39('0x4e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x100138[_0xec39('0x4f')],util[_0xec39('0x48')](_0x100138,{'showHidden':![],'depth':null}));if(_[_0xec39('0x75')](this[_0xec39('0x45')][_0x100138[_0xec39('0x4f')]])){this['queueReports'][_0x100138[_0xec39('0x4f')]]=[];}if(_[_0xec39('0x75')](this[_0xec39('0x11')][_0x100138[_0xec39('0x4f')]])){this[_0xec39('0x11')][_0x100138[_0xec39('0x4f')]]={};}var _0x15adad=new QueueReport();_0x15adad[_0xec39('0x51')]=_0x100138[_0xec39('0x51')];_0x15adad[_0xec39('0x5b')]=this['voiceQueues'][_0x15adad[_0xec39('0x51')]]&&this[_0xec39('0x13')][_0x15adad[_0xec39('0x51')]][_0xec39('0x5b')]?this[_0xec39('0x13')][_0x15adad[_0xec39('0x51')]][_0xec39('0x5b')]||_0xec39('0x5c'):_0xec39('0x5c');_0x15adad['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15adad['position']=_0x100138[_0xec39('0x76')];_0x15adad[_0xec39('0x77')]=_0x100138['count'];_0x15adad[_0xec39('0x4f')]=_0x100138[_0xec39('0x4f')];_0x15adad[_0xec39('0x78')]=this[_0xec39('0x11')][_0x100138[_0xec39('0x4f')]][_0xec39('0x78')];logger[_0xec39('0x79')](_0xec39('0x7a'),_0x15adad['queue'],_0x15adad[_0xec39('0x5b')]);Object[_0xec39('0x6b')](_0x15adad,_[_0xec39('0x7b')](_0x100138,_['keys'](_0x15adad)));this['queueReports'][_0x100138[_0xec39('0x4f')]][_0xec39('0x70')](_0x15adad);this[_0xec39('0x11')][_0x100138[_0xec39('0x4f')]]=_0x15adad;this[_0xec39('0x7c')](_0x15adad,_0xec39('0x7d'));}}catch(_0x2468f7){logger[_0xec39('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x100138['uniqueid'],util[_0xec39('0x48')](_0x2468f7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec39('0xb')][_0xec39('0x21')]=function(_0x408e7f){try{if(this[_0xec39('0x5f')](_0x408e7f)){logger['debug'](_0xec39('0x7e'),_0x408e7f['uniqueid'],util[_0xec39('0x48')](_0x408e7f,{'showHidden':![],'depth':null}));if(this[_0xec39('0x45')][_0x408e7f['uniqueid']]){var _0x185c8e=_['last'](this['queueReports'][_0x408e7f[_0xec39('0x4f')]]);_0x185c8e[_0xec39('0x3a')]=![];_0x185c8e[_0xec39('0x7f')]=null;_0x185c8e[_0xec39('0x80')]=_0x408e7f[_0xec39('0x80')];_0x185c8e[_0xec39('0x81')]=_0x408e7f[_0xec39('0x81')];_0x185c8e['queuecallerabandon']=!![];_0x185c8e[_0xec39('0x82')]=moment()['format'](_0xec39('0x83'));_0x185c8e[_0xec39('0x57')]=_0xec39('0x84');_0x185c8e['lastAssignedTo']=null;logger[_0xec39('0x79')](_0xec39('0x85'),_0x185c8e[_0xec39('0x51')],_0x185c8e[_0xec39('0x5b')]);this[_0xec39('0x11')][_0x408e7f['uniqueid']]=_0x185c8e;this[_0xec39('0x54')](_0x185c8e,'queuecallerabandon');}}}catch(_0x4feedd){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x408e7f[_0xec39('0x4f')],util[_0xec39('0x48')](_0x4feedd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec39('0xb')][_0xec39('0x86')]=function(_0x2c2e89){try{if(this[_0xec39('0x5f')](_0x2c2e89)){logger['debug'](_0xec39('0x87'),_0x2c2e89[_0xec39('0x4f')],util[_0xec39('0x48')](_0x2c2e89,{'showHidden':![],'depth':null}));if(this[_0xec39('0x45')][_0x2c2e89[_0xec39('0x4f')]]){var _0x197d71=_['last'](this['queueReports'][_0x2c2e89[_0xec39('0x4f')]]);_0x197d71['queuecallerleaveAt']=moment()[_0xec39('0x59')](_0xec39('0x83'));_0x197d71[_0xec39('0x88')]=_0x2c2e89['connectedlinenum'];_0x197d71['connectedlinename']=_0x2c2e89[_0xec39('0x89')];logger[_0xec39('0x79')](_0xec39('0x8a'),_0x197d71[_0xec39('0x51')],_0x197d71[_0xec39('0x5b')],_0x2c2e89['connectedlinenum'],_0x2c2e89['connectedlinename']);this[_0xec39('0x11')][_0x2c2e89[_0xec39('0x4f')]]=_0x197d71;this[_0xec39('0x7c')](_0x197d71,_0xec39('0x22'));}}}catch(_0x542d1d){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x2c2e89[_0xec39('0x4f')],util[_0xec39('0x48')](_0x542d1d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec39('0xb')]['syncAgentConnect']=function(_0x527367){try{if(this['isNotNull'](_0x527367)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x527367[_0xec39('0x4f')],util[_0xec39('0x48')](_0x527367,{'showHidden':![],'depth':null}));if(this[_0xec39('0x45')][_0x527367['uniqueid']]){var _0x52f29a=_[_0xec39('0x8b')](this['queueReports'][_0x527367[_0xec39('0x4f')]]);_0x52f29a['queuecallercomplete']=!![];_0x52f29a['queuecallerexitreason']=_0xec39('0x8c');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x52f29a['queue'],_0x52f29a[_0xec39('0x5b')]);}}}catch(_0x1aa2f1){logger[_0xec39('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x527367[_0xec39('0x4f')],util[_0xec39('0x48')](_0x1aa2f1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x24cfdf){try{if(this[_0xec39('0x5f')](_0x24cfdf)){logger[_0xec39('0x4e')](_0xec39('0x8d'),_0x24cfdf[_0xec39('0x4f')],util['inspect'](_0x24cfdf,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x24cfdf['uniqueid']]){var _0x5b7493=_[_0xec39('0x8b')](this[_0xec39('0x45')][_0x24cfdf[_0xec39('0x4f')]]);_0x5b7493[_0xec39('0x20')]=![];_0x5b7493['queuecallerabandonAt']=null;_0x5b7493[_0xec39('0x8e')]=!![];_0x5b7493['lastAssignedTo']=_0x24cfdf['membername'];_0x5b7493[_0xec39('0x80')]=_0x24cfdf['holdtime'];_0x5b7493[_0xec39('0x3a')]=!![];_0x5b7493[_0xec39('0x8f')]=![];_0x5b7493[_0xec39('0x90')]=null;if(!_0x5b7493[_0xec39('0x91')]){if(_0x24cfdf[_0xec39('0x92')]==_0xec39('0x91')){_0x5b7493[_0xec39('0x57')]=_0xec39('0x93');logger[_0xec39('0x79')](_0xec39('0x94'),_0x5b7493['queue'],_0x5b7493[_0xec39('0x5b')]);}else{if(_[_0xec39('0x95')](_0x24cfdf[_0xec39('0x41')]['toLowerCase'](),_0xec39('0x96'))){if(this[_0xec39('0x45')][_0x24cfdf[_0xec39('0x97')]]){var _0x56c57b=_['last'](this[_0xec39('0x45')][_0x24cfdf[_0xec39('0x97')]]);_0x56c57b['queuecallercomplete']=![];_0x56c57b[_0xec39('0x8f')]=!![];_0x56c57b['queuecallerexitAt']=moment(_0x5b7493[_0xec39('0x98')])[_0xec39('0x99')](_0x24cfdf['holdtime'],_0xec39('0x9a'))['format'](_0xec39('0x83'));_0x56c57b[_0xec39('0x57')]=_0xec39('0x9b');_0x56c57b[_0xec39('0x91')]=!![];_0x56c57b['transfertype']=_0xec39('0x9c');_0x56c57b[_0xec39('0x9d')]=_0x24cfdf[_0xec39('0x9e')];_0x56c57b[_0xec39('0x9f')]=_0x24cfdf[_0xec39('0x4f')];logger[_0xec39('0x79')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x56c57b[_0xec39('0x51')],_0x56c57b['type']);var _0x4a2002=this[_0xec39('0x45')][_0x24cfdf[_0xec39('0x97')]];this[_0xec39('0x45')][_0x24cfdf[_0xec39('0x97')]]=this[_0xec39('0x45')][_0x24cfdf[_0xec39('0x4f')]];this[_0xec39('0x45')][_0x24cfdf[_0xec39('0x4f')]]=_0x4a2002;}}else{_0x5b7493[_0xec39('0x57')]=_0xec39('0xa0')+_0x24cfdf['reason'][_0xec39('0xa1')]();logger[_0xec39('0x79')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5b7493[_0xec39('0x51')],_0x5b7493['type'],_0x5b7493['queuecallerexitreason']);}}}this[_0xec39('0x11')][_0x24cfdf[_0xec39('0x4f')]]=_0x5b7493;}}}catch(_0x143546){logger[_0xec39('0x46')](_0xec39('0x8d'),_0x24cfdf[_0xec39('0x4f')],util['inspect'](_0x143546,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec39('0xb')][_0xec39('0x27')]=function(_0x76f1eb){try{if(this['isNotNull'](_0x76f1eb)){logger['debug'](_0xec39('0xa2'),_0x76f1eb['uniqueid'],util[_0xec39('0x48')](_0x76f1eb,{'showHidden':![],'depth':null}));this[_0xec39('0xa3')](_0x76f1eb[_0xec39('0x4f')],_[_0xec39('0xa4')](_0x76f1eb[_0xec39('0xa5')])[0x0],_0x76f1eb['value']);if(this[_0xec39('0x45')][_0x76f1eb[_0xec39('0x4f')]]){var _0x269b6d=_[_0xec39('0x8b')](this['queueReports'][_0x76f1eb[_0xec39('0x4f')]]);if(_0x269b6d){if(this[_0xec39('0x5f')](_0x76f1eb[_0xec39('0xa5')])&&this[_0xec39('0x5f')](_0x76f1eb['variable'][_0xec39('0x66')])){switch(_0x76f1eb[_0xec39('0xa6')]){case _0xec39('0xa7'):_0x269b6d[_0xec39('0x8f')]=![];_0x269b6d[_0xec39('0x90')]=null;break;case _0xec39('0xa8'):_0x269b6d[_0xec39('0xa9')]=_0xec39('0xaa');_0x269b6d[_0xec39('0x8f')]=!![];_0x269b6d[_0xec39('0x90')]=moment()[_0xec39('0x59')](_0xec39('0x83'));_0x269b6d['queuecallerleaveAt']=moment()[_0xec39('0x59')](_0xec39('0x83'));logger[_0xec39('0x4e')](_0xec39('0xab'),_0x76f1eb[_0xec39('0x4f')],util[_0xec39('0x48')](_0x269b6d,{'showHidden':![],'depth':null}));ami[_0xec39('0x4d')](_0xec39('0xac'),_0x269b6d);break;default:_0x269b6d[_0xec39('0x8f')]=!![];_0x269b6d[_0xec39('0x90')]=moment()['format'](_0xec39('0x83'));_0x269b6d['queuecallerleaveAt']=moment()[_0xec39('0x59')]('YYYY-MM-DD\x20HH:mm:ss');}_0x269b6d['queuecallerabandon']=![];_0x269b6d['queuecallerabandonAt']=null;_0x269b6d[_0xec39('0x57')]=_0x76f1eb[_0xec39('0xa6')];this[_0xec39('0x11')][_0x76f1eb[_0xec39('0x4f')]]=_0x269b6d;this[_0xec39('0x54')](_0x269b6d,_0xec39('0xad'));}else if(this[_0xec39('0x5f')](_0x76f1eb[_0xec39('0xa5')])&&this[_0xec39('0x5f')](_0x76f1eb[_0xec39('0xa5')][_0xec39('0xae')])){if(!_0x269b6d[_0xec39('0x20')]){_0x269b6d[_0xec39('0x8f')]=!![];_0x269b6d['queuecallerexitAt']=moment()[_0xec39('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x269b6d['queuecallerexitreason']=_0xec39('0xaf');_0x269b6d[_0xec39('0xb0')]=moment()[_0xec39('0x59')](_0xec39('0x83'));this[_0xec39('0x11')][_0x76f1eb['uniqueid']]=_0x269b6d;}}logger[_0xec39('0x79')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x76f1eb[_0xec39('0x4f')],_0x269b6d[_0xec39('0x51')],_0x269b6d[_0xec39('0x5b')],_[_0xec39('0xa4')](_0x76f1eb[_0xec39('0xa5')])[0x0],_0x76f1eb['value']);_0x269b6d[_0xec39('0x16')]=this[_0xec39('0x16')][_0x76f1eb[_0xec39('0x4f')]];}}}}catch(_0x5e1dad){logger[_0xec39('0x46')](_0xec39('0xa2'),_0x76f1eb[_0xec39('0x4f')],util[_0xec39('0x48')](_0x5e1dad,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x373113,_0x29fc2f,_0x2f0d94){var _0x1b06f5=[_0xec39('0xb1'),'rtpaudioqosbridged',_0xec39('0xb2'),_0xec39('0xb3'),_0xec39('0xb4'),_0xec39('0xb5'),'rtpaudioqosrtt',_0xec39('0xb6'),_0xec39('0xb7'),_0xec39('0xb8'),_0xec39('0xb9'),_0xec39('0xba'),_0xec39('0xbb'),_0xec39('0xbc'),_0xec39('0xbd'),'memberlastcall',_0xec39('0xbe'),'memberpenalty',_0xec39('0xbf')];if(!_[_0xec39('0x3e')](_0x29fc2f)&&!_[_0xec39('0xc0')](_0x1b06f5,_0x29fc2f)){if(_['isUndefined'](this[_0xec39('0x16')][_0x373113])){this['variables'][_0x373113]={};}this[_0xec39('0x16')][_0x373113][_0x29fc2f]=_0x2f0d94;}};VoiceQueueReport[_0xec39('0xb')][_0xec39('0xc1')]=function(_0x3e932a,_0x5b30de,_0x4e0f45){try{var _0x38c6c0={};if(this[_0xec39('0x45')][_0x3e932a]){for(var _0x5d4066=0x0;_0x5d40660x0?!![]:![];if(!_0x326618){return this['syncQueueSummaryComplete'](this['summary'][_0x3646('0x70')]);}};VoiceQueueReport[_0x3646('0xd')][_0x3646('0x1f')]=function(_0x588f93){var _0x1abe7e=this[_0x3646('0x18')]['id'];if(this['summary']['queuestatus'][_0x1abe7e]&&this['summary'][_0x3646('0x6d')][_0x1abe7e][_0x588f93[_0x3646('0x64')]]){this['summary'][_0x3646('0x6d')][_0x1abe7e][_0x588f93['actionid']][_0x3646('0x14')][_0x3646('0x71')](_0x588f93);}};VoiceQueueReport[_0x3646('0xd')]['syncQueueSummary']=function(_0x56e4e6){var _0x2806e6=this;try{if(this[_0x3646('0x5b')](_0x56e4e6)&&this[_0x3646('0x5b')](_0x56e4e6[_0x3646('0x54')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x3646('0x42')](_0x56e4e6,{'showHidden':![],'depth':null}));var _0x30c327=this[_0x3646('0x16')][_0x56e4e6[_0x3646('0x54')]];if(_0x30c327){logger[_0x3646('0x51')](_0x3646('0x72'),_0x30c327[_0x3646('0x67')]);this[_0x3646('0x18')]['queues'][_0x30c327[_0x3646('0x67')]]={'summaryEvent':_0x56e4e6};this[_0x3646('0x18')]['statusRequests']+=0x1;return ami[_0x3646('0x5d')]({'action':'queuestatus','queue':_0x30c327[_0x3646('0x67')]})['then'](function(_0x48a13f){if(!_0x2806e6['summary'][_0x3646('0x6d')][_0x56e4e6[_0x3646('0x64')]]){_0x2806e6[_0x3646('0x18')][_0x3646('0x6d')][_0x56e4e6[_0x3646('0x64')]]={};}_0x2806e6['summary'][_0x3646('0x6d')][_0x56e4e6[_0x3646('0x64')]][_0x48a13f[_0x3646('0x64')]]={'queue':_0x30c327[_0x3646('0x67')],'agents':[]};})[_0x3646('0x5f')](function(_0x479bcf){throw _0x479bcf;});}}}catch(_0x25a7a5){logger['error'](_0x3646('0x65'),util['inspect'](_0x25a7a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3646('0xd')]['syncQueueSummaryComplete']=function(_0x4ce211){if(this[_0x3646('0x18')][_0x3646('0x6f')]>0x0){this['summary'][_0x3646('0x70')]=_0x4ce211;return;}logger['debug'](_0x3646('0x73'),util[_0x3646('0x42')](_0x4ce211,{'showHidden':![],'depth':null}));this[_0x3646('0x18')]=initializeSummary();ami['emit'](_0x3646('0x74'),{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x121a15){try{if(this['isNotNull'](_0x121a15)){logger[_0x3646('0x51')](_0x3646('0x75'),_0x121a15['uniqueid'],util['inspect'](_0x121a15,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3646('0x12')][_0x121a15[_0x3646('0x4d')]])){this[_0x3646('0x12')][_0x121a15[_0x3646('0x4d')]]=[];}if(_[_0x3646('0x5c')](this[_0x3646('0x3d')][_0x121a15['uniqueid']])){this[_0x3646('0x3d')][_0x121a15['uniqueid']]={};}var _0x42bd5b=new QueueReport();_0x42bd5b[_0x3646('0x54')]=_0x121a15[_0x3646('0x54')];_0x42bd5b['type']=this[_0x3646('0x16')][_0x42bd5b[_0x3646('0x54')]]&&this['voiceQueues'][_0x42bd5b[_0x3646('0x54')]][_0x3646('0x57')]?this[_0x3646('0x16')][_0x42bd5b[_0x3646('0x54')]][_0x3646('0x57')]||_0x3646('0x58'):_0x3646('0x58');_0x42bd5b[_0x3646('0x76')]=moment()[_0x3646('0x4e')](_0x3646('0x77'));_0x42bd5b[_0x3646('0x78')]=_0x121a15[_0x3646('0x78')];_0x42bd5b['count']=_0x121a15[_0x3646('0x79')];_0x42bd5b[_0x3646('0x4d')]=_0x121a15[_0x3646('0x4d')];_0x42bd5b[_0x3646('0x7a')]=this['channels'][_0x121a15[_0x3646('0x4d')]][_0x3646('0x7a')];logger['info'](_0x3646('0x7b'),_0x42bd5b['queue'],_0x42bd5b[_0x3646('0x57')]);Object['assign'](_0x42bd5b,_['pick'](_0x121a15,_['keys'](_0x42bd5b)));this['queueReports'][_0x121a15[_0x3646('0x4d')]]['push'](_0x42bd5b);this[_0x3646('0x3d')][_0x121a15['uniqueid']]=_0x42bd5b;this['emitVoiceQueueChannelSave'](_0x42bd5b,_0x3646('0x21'));}}catch(_0x50359c){logger[_0x3646('0x43')](_0x3646('0x75'),_0x121a15[_0x3646('0x4d')],util[_0x3646('0x42')](_0x50359c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3646('0xd')]['syncQueueCallerAbandon']=function(_0x66836c){try{if(this['isNotNull'](_0x66836c)){logger[_0x3646('0x51')](_0x3646('0x7c'),_0x66836c['uniqueid'],util[_0x3646('0x42')](_0x66836c,{'showHidden':![],'depth':null}));if(this[_0x3646('0x12')][_0x66836c[_0x3646('0x4d')]]){var _0x2c5ea7=_[_0x3646('0x7d')](this[_0x3646('0x12')][_0x66836c['uniqueid']]);_0x2c5ea7['queuecallercomplete']=![];_0x2c5ea7['queuecallercompleteAt']=null;_0x2c5ea7[_0x3646('0x7e')]=_0x66836c['holdtime'];_0x2c5ea7[_0x3646('0x7f')]=_0x66836c[_0x3646('0x7f')];_0x2c5ea7['queuecallerabandon']=!![];_0x2c5ea7[_0x3646('0x80')]=moment()[_0x3646('0x4e')](_0x3646('0x77'));_0x2c5ea7['queuecallerexitreason']='ABANDONED';_0x2c5ea7[_0x3646('0x81')]=null;logger[_0x3646('0x82')](_0x3646('0x83'),_0x2c5ea7[_0x3646('0x54')],_0x2c5ea7[_0x3646('0x57')]);this[_0x3646('0x3d')][_0x66836c[_0x3646('0x4d')]]=_0x2c5ea7;this[_0x3646('0x48')](_0x2c5ea7,'queuecallerabandon');}}}catch(_0x2ae79b){logger[_0x3646('0x43')](_0x3646('0x7c'),_0x66836c['uniqueid'],util[_0x3646('0x42')](_0x2ae79b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3646('0xd')][_0x3646('0x84')]=function(_0x3acf8c){try{if(this[_0x3646('0x5b')](_0x3acf8c)){logger[_0x3646('0x51')](_0x3646('0x85'),_0x3acf8c[_0x3646('0x4d')],util['inspect'](_0x3acf8c,{'showHidden':![],'depth':null}));if(this[_0x3646('0x12')][_0x3acf8c['uniqueid']]){var _0x230867=_['last'](this[_0x3646('0x12')][_0x3acf8c[_0x3646('0x4d')]]);_0x230867[_0x3646('0x86')]=moment()[_0x3646('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x230867[_0x3646('0x87')]=_0x3acf8c['connectedlinenum'];_0x230867[_0x3646('0x88')]=_0x3acf8c[_0x3646('0x88')];logger['info'](_0x3646('0x89'),_0x230867[_0x3646('0x54')],_0x230867['type'],_0x3acf8c[_0x3646('0x87')],_0x3acf8c[_0x3646('0x88')]);this['channels'][_0x3acf8c['uniqueid']]=_0x230867;this[_0x3646('0x4b')](_0x230867,_0x3646('0x8a'));}}}catch(_0x1615fa){logger[_0x3646('0x43')]('[%s][voiceQueueReport][queuecallerleave]',_0x3acf8c[_0x3646('0x4d')],util[_0x3646('0x42')](_0x1615fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3646('0x25')]=function(_0x3de1ca){try{if(this[_0x3646('0x5b')](_0x3de1ca)){logger[_0x3646('0x51')]('[%s][voiceQueueReport][agentconnect]',_0x3de1ca[_0x3646('0x4d')],util['inspect'](_0x3de1ca,{'showHidden':![],'depth':null}));if(this[_0x3646('0x12')][_0x3de1ca[_0x3646('0x4d')]]){var _0x3e2ff1=_[_0x3646('0x7d')](this[_0x3646('0x12')][_0x3de1ca[_0x3646('0x4d')]]);_0x3e2ff1[_0x3646('0x3b')]=!![];_0x3e2ff1['queuecallerexitreason']='COMPLETEDBYAGENT';logger['info'](_0x3646('0x8b'),_0x3e2ff1['queue'],_0x3e2ff1[_0x3646('0x57')]);}}}catch(_0x5ca844){logger['error'](_0x3646('0x8c'),_0x3de1ca[_0x3646('0x4d')],util[_0x3646('0x42')](_0x5ca844,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3646('0xd')]['syncAgentComplete']=function(_0x22071c){try{if(this[_0x3646('0x5b')](_0x22071c)){logger[_0x3646('0x51')](_0x3646('0x8d'),_0x22071c[_0x3646('0x4d')],util['inspect'](_0x22071c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x22071c[_0x3646('0x4d')]]){var _0x26dfc3=_[_0x3646('0x7d')](this[_0x3646('0x12')][_0x22071c['uniqueid']]);_0x26dfc3[_0x3646('0x3a')]=![];_0x26dfc3[_0x3646('0x80')]=null;_0x26dfc3[_0x3646('0x8e')]=!![];_0x26dfc3['lastAssignedTo']=_0x22071c[_0x3646('0x8f')];_0x26dfc3[_0x3646('0x7e')]=_0x22071c['holdtime'];_0x26dfc3[_0x3646('0x3b')]=!![];_0x26dfc3[_0x3646('0x90')]=![];_0x26dfc3[_0x3646('0x91')]=null;if(!_0x26dfc3['transfer']){if(_0x22071c['reason']=='transfer'){_0x26dfc3[_0x3646('0x92')]='COMPLETED';logger['info'](_0x3646('0x93'),_0x26dfc3[_0x3646('0x54')],_0x26dfc3[_0x3646('0x57')]);}else{if(_[_0x3646('0x94')](_0x22071c[_0x3646('0x95')]['toLowerCase'](),_0x3646('0x96'))){if(this['queueReports'][_0x22071c['linkedid']]){var _0x5689eb=_[_0x3646('0x7d')](this[_0x3646('0x12')][_0x22071c['linkedid']]);_0x5689eb[_0x3646('0x3b')]=![];_0x5689eb[_0x3646('0x90')]=!![];_0x5689eb[_0x3646('0x91')]=moment(_0x26dfc3[_0x3646('0x76')])['add'](_0x22071c[_0x3646('0x7e')],_0x3646('0x97'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5689eb['queuecallerexitreason']='FORWARDTRANSFER';_0x5689eb[_0x3646('0x98')]=!![];_0x5689eb['transfertype']=_0x3646('0x99');_0x5689eb['transferexten']=_0x22071c[_0x3646('0x9a')];_0x5689eb[_0x3646('0x9b')]=_0x22071c[_0x3646('0x4d')];logger[_0x3646('0x82')](_0x3646('0x9c'),_0x5689eb['queue'],_0x5689eb[_0x3646('0x57')]);var _0x226e44=this[_0x3646('0x12')][_0x22071c[_0x3646('0x9d')]];this['queueReports'][_0x22071c[_0x3646('0x9d')]]=this[_0x3646('0x12')][_0x22071c[_0x3646('0x4d')]];this[_0x3646('0x12')][_0x22071c['uniqueid']]=_0x226e44;}}else{_0x26dfc3[_0x3646('0x92')]=_0x3646('0x9e')+_0x22071c[_0x3646('0x9f')]['toUpperCase']();logger[_0x3646('0x82')](_0x3646('0xa0'),_0x26dfc3[_0x3646('0x54')],_0x26dfc3['type'],_0x26dfc3[_0x3646('0x92')]);}}}this[_0x3646('0x3d')][_0x22071c[_0x3646('0x4d')]]=_0x26dfc3;}}}catch(_0x123189){logger[_0x3646('0x43')](_0x3646('0x8d'),_0x22071c[_0x3646('0x4d')],util[_0x3646('0x42')](_0x123189,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3646('0xd')]['syncVarSet']=function(_0x5e7740){try{if(this['isNotNull'](_0x5e7740)){logger[_0x3646('0x51')]('[%s][voiceQueueReport][varset]',_0x5e7740[_0x3646('0x4d')],util[_0x3646('0x42')](_0x5e7740,{'showHidden':![],'depth':null}));this['addVariable'](_0x5e7740[_0x3646('0x4d')],_['keys'](_0x5e7740['variable'])[0x0],_0x5e7740[_0x3646('0xa1')]);if(this['queueReports'][_0x5e7740[_0x3646('0x4d')]]){var _0x5d2a79=_['last'](this[_0x3646('0x12')][_0x5e7740['uniqueid']]);if(_0x5d2a79){if(this[_0x3646('0x5b')](_0x5e7740['variable'])&&this[_0x3646('0x5b')](_0x5e7740[_0x3646('0xa2')][_0x3646('0x6d')])){switch(_0x5e7740[_0x3646('0xa1')]){case _0x3646('0xa3'):_0x5d2a79[_0x3646('0x90')]=![];_0x5d2a79[_0x3646('0x91')]=null;break;case _0x3646('0xa4'):_0x5d2a79['lastevent']='timeout';_0x5d2a79[_0x3646('0x90')]=!![];_0x5d2a79[_0x3646('0x91')]=moment()[_0x3646('0x4e')](_0x3646('0x77'));_0x5d2a79[_0x3646('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x3646('0xa5'),_0x5e7740[_0x3646('0x4d')],util[_0x3646('0x42')](_0x5d2a79,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x5d2a79);break;default:_0x5d2a79[_0x3646('0x90')]=!![];_0x5d2a79[_0x3646('0x91')]=moment()[_0x3646('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d2a79[_0x3646('0x86')]=moment()['format'](_0x3646('0x77'));}_0x5d2a79[_0x3646('0x3a')]=![];_0x5d2a79[_0x3646('0x80')]=null;_0x5d2a79[_0x3646('0x92')]=_0x5e7740[_0x3646('0xa1')];this[_0x3646('0x3d')][_0x5e7740['uniqueid']]=_0x5d2a79;this[_0x3646('0x48')](_0x5d2a79,_0x3646('0x26'));}else if(this[_0x3646('0x5b')](_0x5e7740[_0x3646('0xa2')])&&this['isNotNull'](_0x5e7740['variable']['queueposition'])){if(!_0x5d2a79[_0x3646('0x3a')]){_0x5d2a79[_0x3646('0x90')]=!![];_0x5d2a79[_0x3646('0x91')]=moment()['format'](_0x3646('0x77'));_0x5d2a79[_0x3646('0x92')]=_0x3646('0xa6');_0x5d2a79[_0x3646('0x86')]=moment()[_0x3646('0x4e')](_0x3646('0x77'));this['channels'][_0x5e7740[_0x3646('0x4d')]]=_0x5d2a79;}}logger[_0x3646('0x82')](_0x3646('0xa7'),_0x5e7740[_0x3646('0x4d')],_0x5d2a79[_0x3646('0x54')],_0x5d2a79['type'],_[_0x3646('0xa8')](_0x5e7740['variable'])[0x0],_0x5e7740['value']);_0x5d2a79[_0x3646('0x19')]=this['variables'][_0x5e7740['uniqueid']];}}}}catch(_0x4856b6){logger[_0x3646('0x43')](_0x3646('0xa9'),_0x5e7740[_0x3646('0x4d')],util[_0x3646('0x42')](_0x4856b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3646('0xaa')]=function(_0x40d8d8,_0x38393d,_0x39ecc6){var _0x65ce4f=[_0x3646('0xab'),_0x3646('0xac'),'rtpaudioqosjitter',_0x3646('0xad'),_0x3646('0xae'),_0x3646('0xaf'),'rtpaudioqosrtt',_0x3646('0xb0'),_0x3646('0xb1'),'sipuri',_0x3646('0xb2'),_0x3646('0xb3'),_0x3646('0xb4'),'memberdynamic',_0x3646('0xb5'),_0x3646('0xb6'),_0x3646('0x8f'),'memberpenalty',_0x3646('0xb7')];if(!_[_0x3646('0x3f')](_0x38393d)&&!_['includes'](_0x65ce4f,_0x38393d)){if(_[_0x3646('0x5c')](this[_0x3646('0x19')][_0x40d8d8])){this[_0x3646('0x19')][_0x40d8d8]={};}this[_0x3646('0x19')][_0x40d8d8][_0x38393d]=_0x39ecc6;}};VoiceQueueReport[_0x3646('0xd')]['handleHangup']=function(_0x481415,_0x532024,_0x180d80){try{var _0x523d23={};if(this[_0x3646('0x12')][_0x481415]){for(var _0x17ebcd=0x0;_0x17ebcd=0x0?moment(_0x2f9545[_0x88b1('0x18')])['diff'](_0x2f9545[_0x88b1('0x17')],_0x88b1('0xd')):null,'data1':_0x88b1('0x19'),'data2':_0x2f9545[_0x88b1('0x12')],'data3':_0x2f9545[_0x88b1('0x10')],'data4':_0x2f9545[_0x88b1('0x1a')]||null,'role':_0x88b1('0x1b'),'internal':_0x2f9545[_0x88b1('0x12')]?_[_0x88b1('0x13')](_0x2f9545[_0x88b1('0x12')]):undefined,'uniqueid':_0x2f9545[_0x88b1('0x1c')]},'log':_0x88b1('0x7')});}; \ No newline at end of file +var _0xd28f=['calleridnum','exten','queue','agent','accountcode','CreateMemberReport','Request','voice','membername','starttime','endtime','dialstring','uniqueid','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound'];(function(_0xad3844,_0x476cc3){var _0x64031c=function(_0x28c5b3){while(--_0x28c5b3){_0xad3844['push'](_0xad3844['shift']());}};_0x64031c(++_0x476cc3);}(_0xd28f,0x151));var _0xfd28=function(_0xefc71,_0x204be9){_0xefc71=_0xefc71-0x0;var _0x34c1c7=_0xd28f[_0xefc71];return _0x34c1c7;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xfd28('0x0'));var client=require(_0xfd28('0x1'));exports[_0xfd28('0x2')]=function(_0x2a648b){var _0x53b25b=_0x2a648b[_0xfd28('0x3')]||_0x2a648b[_0xfd28('0x4')];return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x2a648b[_0xfd28('0x5')],'interface':_[_0xfd28('0x6')](_0x2a648b[_0xfd28('0x7')])?util['format'](_0xfd28('0x8'),_0x2a648b['lastAssignedTo']):_0x2a648b[_0xfd28('0x7')],'type':_0xfd28('0x9'),'enterAt':_0x2a648b[_0xfd28('0xa')],'exitAt':_0x53b25b,'duration':moment(_0x53b25b)[_0xfd28('0xb')](_0x2a648b[_0xfd28('0xa')],_0xfd28('0xc')),'data1':_0xfd28('0xd'),'data2':_0x2a648b[_0xfd28('0xe')],'data3':_0x2a648b[_0xfd28('0xf')],'data4':null,'data5':_0x2a648b[_0xfd28('0x10')],'role':_0xfd28('0x11'),'internal':_0x2a648b['accountcode']?_['toNumber'](_0x2a648b[_0xfd28('0x12')]):undefined,'uniqueid':_0x2a648b['uniqueid']},'log':_0xfd28('0x13')});};exports['voiceDialReport']=function(_0x131f43){return client[_0xfd28('0x14')]('CreateMemberReport',{'body':{'channel':_0xfd28('0x15'),'membername':_0x131f43[_0xfd28('0x16')],'interface':_0x131f43[_0xfd28('0x7')],'type':_0xfd28('0x9'),'enterAt':_0x131f43[_0xfd28('0x17')],'exitAt':_0x131f43[_0xfd28('0x18')],'duration':moment(_0x131f43[_0xfd28('0x18')])[_0xfd28('0xb')](_0x131f43[_0xfd28('0x17')],'seconds')>=0x0?moment(_0x131f43[_0xfd28('0x18')])['diff'](_0x131f43[_0xfd28('0x17')],_0xfd28('0xc')):null,'data1':'outbound','data2':_0x131f43[_0xfd28('0x12')],'data3':_0x131f43[_0xfd28('0xf')],'data4':_0x131f43[_0xfd28('0x19')]||null,'role':_0xfd28('0x11'),'internal':_0x131f43[_0xfd28('0x12')]?_['toNumber'](_0x131f43[_0xfd28('0x12')]):undefined,'uniqueid':_0x131f43[_0xfd28('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 07e34f0..f6eb055 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 _0xe896=['getSettings','Request','stopRecordingOnTransfer','../client'];(function(_0x48a7b0,_0x2f7b62){var _0x51eec1=function(_0x350646){while(--_0x350646){_0x48a7b0['push'](_0x48a7b0['shift']());}};_0x51eec1(++_0x2f7b62);}(_0xe896,0x15f));var _0x6e89=function(_0x2ceb84,_0x3316f3){_0x2ceb84=_0x2ceb84-0x0;var _0x597a33=_0xe896[_0x2ceb84];return _0x597a33;};'use strict';var client=require(_0x6e89('0x0'));exports[_0x6e89('0x1')]=function(){return client[_0x6e89('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6e89('0x3'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0xb875=['stopRecordingOnTransfer','GetSettings','../client'];(function(_0x2a053e,_0x5e5b6d){var _0x177a02=function(_0x2232d1){while(--_0x2232d1){_0x2a053e['push'](_0x2a053e['shift']());}};_0x177a02(++_0x5e5b6d);}(_0xb875,0x167));var _0x5b87=function(_0x28e286,_0x10abcd){_0x28e286=_0x28e286-0x0;var _0xfc8d38=_0xb875[_0x28e286];return _0xfc8d38;};'use strict';var client=require(_0x5b87('0x0'));exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5b87('0x1'),'previewRecallmeReminderInterval']},'log':_0x5b87('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 85323a1..0e79d4c 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 _0xd920=['Request','GetTemplate','name','html','getTemplates'];(function(_0x4b9a1c,_0x76006b){var _0x4f0c6c=function(_0x4c6dfc){while(--_0x4c6dfc){_0x4b9a1c['push'](_0x4b9a1c['shift']());}};_0x4f0c6c(++_0x76006b);}(_0xd920,0x1ee));var _0x0d92=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0xd920[_0x55969b];return _0x3d7fc1;};'use strict';var client=require('../client');exports[_0x0d92('0x0')]=function(_0x27622f){return function(_0x9075ef){return client[_0x0d92('0x1')](_0x0d92('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0d92('0x3'),_0x0d92('0x4')]},'log':_0x0d92('0x2')});};}; \ No newline at end of file +var _0x5755=['GetTemplate','name','html','getTemplates'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5755,0x8f));var _0x5575=function(_0x11d7c6,_0x1403f9){_0x11d7c6=_0x11d7c6-0x0;var _0x497472=_0x5755[_0x11d7c6];return _0x497472;};'use strict';var client=require('../client');exports[_0x5575('0x0')]=function(_0x4057a1){return function(_0x8b98a6){return client['Request'](_0x5575('0x1'),{'options':{'raw':!![],'attributes':['id',_0x5575('0x2'),_0x5575('0x3')]},'log':_0x5575('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ca977df..4c6bc23 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 _0x4ec2=['operator','Action','Actions','action','data2','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','value','AnyConditions'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x4ec2,0x1c9));var _0x24ec=function(_0x34bdb3,_0x6bc968){_0x34bdb3=_0x34bdb3-0x0;var _0x355523=_0x4ec2[_0x34bdb3];return _0x355523;};'use strict';var client=require(_0x24ec('0x0'));exports[_0x24ec('0x1')]=function(_0x440204){return function(_0x492b9c){return client[_0x24ec('0x2')](_0x24ec('0x3'),{'options':{'raw':![],'attributes':['id',_0x24ec('0x4'),_0x24ec('0x5'),_0x24ec('0x6')],'include':[{'model':_0x24ec('0x7'),'as':_0x24ec('0x8'),'attributes':['id','field','operator',_0x24ec('0x9')]},{'model':_0x24ec('0x7'),'as':_0x24ec('0xa'),'attributes':['id','field',_0x24ec('0xb'),'value']},{'model':_0x24ec('0xc'),'as':_0x24ec('0xd'),'attributes':['id',_0x24ec('0xe'),'data1',_0x24ec('0xf'),'data3','data4','data5',_0x24ec('0x10'),_0x24ec('0x11')]}]},'log':_0x24ec('0x3')});};}; \ No newline at end of file +var _0x0122=['Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','getTriggers','Request','GetTrigger','channel','status'];(function(_0x402950,_0x52d699){var _0x643b00=function(_0x40124d){while(--_0x40124d){_0x402950['push'](_0x402950['shift']());}};_0x643b00(++_0x52d699);}(_0x0122,0x1c9));var _0x2012=function(_0x37e44a,_0x1d29e0){_0x37e44a=_0x37e44a-0x0;var _0x2e5ca8=_0x0122[_0x37e44a];return _0x2e5ca8;};'use strict';var client=require('../client');exports[_0x2012('0x0')]=function(_0x25a228){return function(_0x21ea38){return client[_0x2012('0x1')](_0x2012('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x2012('0x3'),_0x2012('0x4')],'include':[{'model':_0x2012('0x5'),'as':_0x2012('0x6'),'attributes':['id',_0x2012('0x7'),_0x2012('0x8'),_0x2012('0x9')]},{'model':_0x2012('0x5'),'as':_0x2012('0xa'),'attributes':['id',_0x2012('0x7'),_0x2012('0x8'),'value']},{'model':_0x2012('0xb'),'as':_0x2012('0xc'),'attributes':['id',_0x2012('0xd'),_0x2012('0xe'),_0x2012('0xf'),_0x2012('0x10'),_0x2012('0x11'),_0x2012('0x12'),_0x2012('0x13'),_0x2012('0x14')]}]},'log':_0x2012('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index bec6912..1204ea0 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 _0x3aa2=['registry','getTrunks','GetTrunk'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3aa2,0xd3));var _0x23aa=function(_0x4fecb6,_0x45ed64){_0x4fecb6=_0x4fecb6-0x0;var _0xa9a47=_0x3aa2[_0x4fecb6];return _0xa9a47;};'use strict';var client=require('../client');exports[_0x23aa('0x0')]=function(_0x6274cd){return function(_0x132d0c){return client['Request'](_0x23aa('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x23aa('0x2'),'defaultuser']},'log':_0x23aa('0x1')});};}; \ No newline at end of file +var _0x49c0=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x1db09c,_0x5768e4){var _0x5721e5=function(_0x734930){while(--_0x734930){_0x1db09c['push'](_0x1db09c['shift']());}};_0x5721e5(++_0x5768e4);}(_0x49c0,0x188));var _0x049c=function(_0x4a0b54,_0x3c179f){_0x4a0b54=_0x4a0b54-0x0;var _0x542e59=_0x49c0[_0x4a0b54];return _0x542e59;};'use strict';var client=require(_0x049c('0x0'));exports[_0x049c('0x1')]=function(_0x165e8e){return function(_0x1a6f8b){return client[_0x049c('0x2')](_0x049c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x049c('0x4'),_0x049c('0x5'),_0x049c('0x6')]},'log':_0x049c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ba6cd01..a70fd2b 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x28b4cd,_0x573ff1){var _0x4229cc=function(_0x2ba663){while(--_0x2ba663){_0x28b4cd['push'](_0x28b4cd['shift']());}};_0x4229cc(++_0x573ff1);}(_0x34e8,0x12c));var _0x834e=function(_0x282834,_0x5f57c8){_0x282834=_0x282834-0x0;var _0x2aba99=_0x34e8[_0x282834];return _0x2aba99;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x7ae99e,_0x2b6c32){var _0x2cccf4=function(_0x2b16f){while(--_0x2b16f){_0x7ae99e['push'](_0x7ae99e['shift']());}};_0x2cccf4(++_0x2b6c32);}(_0x34e8,0x12c));var _0x834e=function(_0x1d7958,_0x19724f){_0x1d7958=_0x1d7958-0x0;var _0x1c3ad1=_0x34e8[_0x1d7958];return _0x1c3ad1;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a898f5c..627d524 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 _0x48a2=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x4aa02d,_0x3a1bec){var _0xaf9d0c=function(_0x27c9b9){while(--_0x27c9b9){_0x4aa02d['push'](_0x4aa02d['shift']());}};_0xaf9d0c(++_0x3a1bec);}(_0x48a2,0x109));var _0x248a=function(_0x8a912d,_0x53c52b){_0x8a912d=_0x8a912d-0x0;var _0x4fb44b=_0x48a2[_0x8a912d];return _0x4fb44b;};'use strict';var client=require(_0x248a('0x0'));exports[_0x248a('0x1')]=function(_0x31adcc){return client[_0x248a('0x2')](_0x248a('0x3'),{'body':_0x31adcc,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x3c9038,_0x1480da,_0x3a7256){return client['Request'](_0x248a('0x4'),{'body':_0x3c9038,'options':{'where':{'uniqueid':_0x1480da,'interface':_0x3a7256,'agentcomplete':!![]}},'log':_0x248a('0x4')});}; \ No newline at end of file +var _0x782e=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x782e,0x18f));var _0xe782=function(_0x3c553e,_0x381b12){_0x3c553e=_0x3c553e-0x0;var _0xef9a34=_0x782e[_0x3c553e];return _0xef9a34;};'use strict';var client=require(_0xe782('0x0'));exports['create']=function(_0x3e5b06){return client['Request']('CreateVoiceAgentReport',{'body':_0x3e5b06,'log':_0xe782('0x1')});};exports[_0xe782('0x2')]=function(_0x3ccd84,_0x1fb377,_0x3d8504){return client[_0xe782('0x3')](_0xe782('0x4'),{'body':_0x3ccd84,'options':{'where':{'uniqueid':_0x1fb377,'interface':_0x3d8504,'agentcomplete':!![]}},'log':_0xe782('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2015e29..d15dd88 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 _0xed57=['type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1c2e36,_0xa47e1d){var _0x262a3a=function(_0x579c09){while(--_0x579c09){_0x1c2e36['push'](_0x1c2e36['shift']());}};_0x262a3a(++_0xa47e1d);}(_0xed57,0xd5));var _0x7ed5=function(_0x5ac0fd,_0x4c1347){_0x5ac0fd=_0x5ac0fd-0x0;var _0x56f6db=_0xed57[_0x5ac0fd];return _0x56f6db;};'use strict';var moment=require(_0x7ed5('0x0'));var util=require(_0x7ed5('0x1'));var _=require(_0x7ed5('0x2'));var client=require(_0x7ed5('0x3'));exports[_0x7ed5('0x4')]=function(_0x575823){return client[_0x7ed5('0x5')](_0x7ed5('0x6'),{'body':_[_0x7ed5('0x7')](_0x575823,{'source':_0x575823['calleridnum'],'destinationcontext':_0x575823[_0x7ed5('0x8')],'callerid':_0x575823[_0x7ed5('0x9')],'amaflags':_0x7ed5('0xa')}),'log':_0x7ed5('0x6')});};exports[_0x7ed5('0xb')]=function(){return function(){return client[_0x7ed5('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x7ed5('0xc'))[_0x7ed5('0xd')](_0x7ed5('0xe')),moment()['endOf'](_0x7ed5('0xc'))['format'](_0x7ed5('0xe'))]}},'attributes':[_0x7ed5('0xf'),'disposition',_0x7ed5('0x10'),_0x7ed5('0x11')]},'log':_0x7ed5('0x12')});};}; \ No newline at end of file +var _0x391f=['lodash','create','Request','CreateVoiceCallReport','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x5c52a3,_0x13c8d5){var _0x5537b9=function(_0x469e93){while(--_0x469e93){_0x5c52a3['push'](_0x5c52a3['shift']());}};_0x5537b9(++_0x13c8d5);}(_0x391f,0x18d));var _0xf391=function(_0x11bd6f,_0x4548a0){_0x11bd6f=_0x11bd6f-0x0;var _0xb746e=_0x391f[_0x11bd6f];return _0xb746e;};'use strict';var moment=require(_0xf391('0x0'));var util=require(_0xf391('0x1'));var _=require(_0xf391('0x2'));var client=require('../client');exports[_0xf391('0x3')]=function(_0x5cfc3f){return client[_0xf391('0x4')](_0xf391('0x5'),{'body':_['merge'](_0x5cfc3f,{'source':_0x5cfc3f[_0xf391('0x6')],'destinationcontext':_0x5cfc3f['context'],'callerid':_0x5cfc3f[_0xf391('0x7')],'amaflags':_0xf391('0x8')}),'log':_0xf391('0x5')});};exports[_0xf391('0x9')]=function(){return function(){return client[_0xf391('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xf391('0xa')],'createdAt':{'$between':[moment()[_0xf391('0xb')](_0xf391('0xc'))['format'](_0xf391('0xd')),moment()[_0xf391('0xe')](_0xf391('0xc'))[_0xf391('0xf')](_0xf391('0xd'))]}},'attributes':[_0xf391('0x10'),_0xf391('0x11'),_0xf391('0x12'),_0xf391('0x13')]},'log':_0xf391('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index ce98b78..a17bed0 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 _0x3ea1=['create','Request','CreateVoiceDialReport','../client'];(function(_0xffb539,_0x587d42){var _0x5c9e30=function(_0x1a8625){while(--_0x1a8625){_0xffb539['push'](_0xffb539['shift']());}};_0x5c9e30(++_0x587d42);}(_0x3ea1,0x83));var _0x13ea=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0x3ea1[_0x599c94];return _0x34e215;};'use strict';var client=require(_0x13ea('0x0'));exports[_0x13ea('0x1')]=function(_0x3bb0a5){return client[_0x13ea('0x2')]('CreateVoiceDialReport',{'body':_0x3bb0a5,'log':_0x13ea('0x3')});}; \ No newline at end of file +var _0x1c3b=['CreateVoiceDialReport','create','Request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1c3b,0x17b));var _0xb1c3=function(_0x17e48e,_0x114099){_0x17e48e=_0x17e48e-0x0;var _0x219cdc=_0x1c3b[_0x17e48e];return _0x219cdc;};'use strict';var client=require('../client');exports[_0xb1c3('0x0')]=function(_0x709e09){return client[_0xb1c3('0x1')]('CreateVoiceDialReport',{'body':_0x709e09,'log':_0xb1c3('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 86adb27..6a42c9e 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 _0x235a=['getVoiceExtensions','Request','exten','../client'];(function(_0x2b5309,_0x27c8bd){var _0x43f334=function(_0x51bcc0){while(--_0x51bcc0){_0x2b5309['push'](_0x2b5309['shift']());}};_0x43f334(++_0x27c8bd);}(_0x235a,0x1ef));var _0xa235=function(_0x54f807,_0x111551){_0x54f807=_0x54f807-0x0;var _0x198ef0=_0x235a[_0x54f807];return _0x198ef0;};'use strict';var client=require(_0xa235('0x0'));exports[_0xa235('0x1')]=function(){return function(){return client[_0xa235('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa235('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xa235('0x1')});};}; \ No newline at end of file +var _0xa1fd=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x1bc59a,_0x22d2c3){_0x1bc59a=_0x1bc59a-0x0;var _0x3ab7a4=_0xa1fd[_0x1bc59a];return _0x3ab7a4;};'use strict';var client=require(_0xda1f('0x0'));exports[_0xda1f('0x1')]=function(){return function(){return client[_0xda1f('0x2')](_0xda1f('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xda1f('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xda1f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 12dbbf3..0e28fd9 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 _0x9cc7=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage'];(function(_0x4bc6c1,_0x3f2302){var _0x234ce4=function(_0x22bbab){while(--_0x22bbab){_0x4bc6c1['push'](_0x4bc6c1['shift']());}};_0x234ce4(++_0x3f2302);}(_0x9cc7,0x64));var _0x79cc=function(_0x2a6571,_0xf1567c){_0x2a6571=_0x2a6571-0x0;var _0xdf7731=_0x9cc7[_0x2a6571];return _0xdf7731;};'use strict';var client=require(_0x79cc('0x0'));exports[_0x79cc('0x1')]=function(){return function(){return client['Request'](_0x79cc('0x2'),{'options':{'raw':![],'attributes':['id',_0x79cc('0x3'),'acw',_0x79cc('0x4'),_0x79cc('0x5'),_0x79cc('0x6'),_0x79cc('0x7'),'dialActive','dialMethod',_0x79cc('0x8'),'dialLimitQueue',_0x79cc('0x9'),_0x79cc('0xa'),_0x79cc('0xb'),'dialPredictiveInterval',_0x79cc('0xc'),_0x79cc('0xd'),_0x79cc('0xe'),_0x79cc('0xf'),_0x79cc('0x10'),_0x79cc('0x11'),'dialCongestionMaxRetry',_0x79cc('0x12'),_0x79cc('0x13'),'dialBusyRetryFrequency',_0x79cc('0x14'),_0x79cc('0x15'),_0x79cc('0x16'),_0x79cc('0x17'),_0x79cc('0x18'),_0x79cc('0x19'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0x79cc('0x1a'),_0x79cc('0x1b'),'dialAMDTotalAnalysisTime',_0x79cc('0x1c'),_0x79cc('0x1d'),_0x79cc('0x1e'),'dialAMDSilenceThreshold',_0x79cc('0x1f'),'timeout',_0x79cc('0x20'),_0x79cc('0x21'),'dialOrderByScheduledAt',_0x79cc('0x22'),_0x79cc('0x23'),'dialQueueProject2',_0x79cc('0x6'),_0x79cc('0x24'),_0x79cc('0x25'),'dialCutDigit',_0x79cc('0x26'),_0x79cc('0x27'),_0x79cc('0x28'),'dialDropRetryFrequency',_0x79cc('0x29'),_0x79cc('0x2a'),_0x79cc('0x2b'),_0x79cc('0x2c'),_0x79cc('0x2d'),_0x79cc('0x2e'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x79cc('0x2f'),'dialPreviewAutoRecallMe',_0x79cc('0x30')],'include':[{'model':_0x79cc('0x31'),'as':_0x79cc('0x31'),'attributes':['id','name',_0x79cc('0x32'),_0x79cc('0x33')]},{'model':_0x79cc('0x34'),'as':'mandatoryDispositionPause','attributes':['id',_0x79cc('0x3')]},{'model':_0x79cc('0x31'),'as':'TrunkBackup','attributes':['id',_0x79cc('0x3'),_0x79cc('0x32'),_0x79cc('0x33')]},{'model':_0x79cc('0x35'),'as':'Interval','attributes':['id',_0x79cc('0x3')],'include':[{'model':'Interval','as':_0x79cc('0x36'),'attributes':['id',_0x79cc('0x3'),_0x79cc('0x37')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xfd4b=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue'];(function(_0x42de15,_0x3e98ae){var _0x22d5f9=function(_0x1fb3d7){while(--_0x1fb3d7){_0x42de15['push'](_0x42de15['shift']());}};_0x22d5f9(++_0x3e98ae);}(_0xfd4b,0x6a));var _0xbfd4=function(_0x3f9391,_0x6aa952){_0x3f9391=_0x3f9391-0x0;var _0x38cbd6=_0xfd4b[_0x3f9391];return _0x38cbd6;};'use strict';var client=require(_0xbfd4('0x0'));exports[_0xbfd4('0x1')]=function(){return function(){return client[_0xbfd4('0x2')](_0xbfd4('0x3'),{'options':{'raw':![],'attributes':['id',_0xbfd4('0x4'),'acw','acwTimeout',_0xbfd4('0x5'),_0xbfd4('0x6'),_0xbfd4('0x7'),_0xbfd4('0x8'),_0xbfd4('0x9'),_0xbfd4('0xa'),_0xbfd4('0xb'),'dialPowerLevel','dialPredictiveOptimization',_0xbfd4('0xc'),_0xbfd4('0xd'),'dialOriginateCallerIdName',_0xbfd4('0xe'),'dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency',_0xbfd4('0xf'),_0xbfd4('0x10'),_0xbfd4('0x11'),_0xbfd4('0x12'),_0xbfd4('0x13'),_0xbfd4('0x14'),_0xbfd4('0x15'),_0xbfd4('0x16'),'dialCheckDuplicateType',_0xbfd4('0x17'),_0xbfd4('0x18'),'dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0xbfd4('0x19'),_0xbfd4('0x1a'),_0xbfd4('0x1b'),_0xbfd4('0x1c'),_0xbfd4('0x1d'),_0xbfd4('0x1e'),'dialRecallMeTimeout',_0xbfd4('0x1f'),_0xbfd4('0x20'),_0xbfd4('0x21'),_0xbfd4('0x22'),'dialQueueProject2',_0xbfd4('0x6'),_0xbfd4('0x23'),_0xbfd4('0x24'),_0xbfd4('0x25'),_0xbfd4('0x26'),_0xbfd4('0x27'),_0xbfd4('0x28'),_0xbfd4('0x29'),_0xbfd4('0x2a'),'dialAbandonedRetryFrequency',_0xbfd4('0x2b'),_0xbfd4('0x2c'),_0xbfd4('0x2d'),'dialAgentRejectRetryFrequency',_0xbfd4('0x2e'),_0xbfd4('0x2f'),_0xbfd4('0x30'),'dialPreviewAutoRecallMe',_0xbfd4('0x31')],'include':[{'model':_0xbfd4('0x32'),'as':_0xbfd4('0x32'),'attributes':['id',_0xbfd4('0x4'),_0xbfd4('0x33'),_0xbfd4('0x34')]},{'model':_0xbfd4('0x35'),'as':_0xbfd4('0x36'),'attributes':['id',_0xbfd4('0x4')]},{'model':_0xbfd4('0x32'),'as':_0xbfd4('0x37'),'attributes':['id','name',_0xbfd4('0x33'),'active']},{'model':_0xbfd4('0x38'),'as':'Interval','attributes':['id',_0xbfd4('0x4')],'include':[{'model':_0xbfd4('0x38'),'as':_0xbfd4('0x39'),'attributes':['id',_0xbfd4('0x4'),_0xbfd4('0x3a')]}]}]},'log':_0xbfd4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 76365ac..21bdf64 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(_0x22844a,_0x40508b){var _0x4e706c=function(_0x52b2ca){while(--_0x52b2ca){_0x22844a['push'](_0x22844a['shift']());}};_0x4e706c(++_0x40508b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x5dda82,_0x24bc07){var _0x643747=function(_0x39e45f){while(--_0x39e45f){_0x5dda82['push'](_0x5dda82['shift']());}};_0x643747(++_0x24bc07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 4482a00..cef01a2 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 _0xce2b=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x38d240,_0x12b9bc){var _0x3c9c1b=function(_0x2274d4){while(--_0x2274d4){_0x38d240['push'](_0x38d240['shift']());}};_0x3c9c1b(++_0x12b9bc);}(_0xce2b,0x163));var _0xbce2=function(_0x5dda44,_0x40b720){_0x5dda44=_0x5dda44-0x0;var _0x25506a=_0xce2b[_0x5dda44];return _0x25506a;};'use strict';var client=require(_0xbce2('0x0'));exports[_0xbce2('0x1')]=function(_0xb69736){return function(){return client['Request'](_0xbce2('0x2'),{'options':{'where':{'VoiceQueueId':_0xb69736,'paused':!![]},'raw':!![]},'log':_0xbce2('0x1')});};}; \ No newline at end of file +var _0x832d=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x242c5c,_0x4592c2){var _0x48431e=function(_0x226c6c){while(--_0x226c6c){_0x242c5c['push'](_0x242c5c['shift']());}};_0x48431e(++_0x4592c2);}(_0x832d,0xa3));var _0xd832=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x832d[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0xd832('0x0'));exports[_0xd832('0x1')]=function(_0x32bd53){return function(){return client[_0xd832('0x2')](_0xd832('0x3'),{'options':{'where':{'VoiceQueueId':_0x32bd53,'paused':!![]},'raw':!![]},'log':_0xd832('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 82291a2..7aad548 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x373522,_0x497f77){var _0x14ff8e=function(_0x5309c8){while(--_0x5309c8){_0x373522['push'](_0x373522['shift']());}};_0x14ff8e(++_0x497f77);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x5e28eb,_0x2a6455){var _0x5be465=function(_0x4e3af9){while(--_0x4e3af9){_0x5e28eb['push'](_0x5e28eb['shift']());}};_0x5be465(++_0x2a6455);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 49291d0..9f235af 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 _0x449e=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetlinkedid','origtransfererexten','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x27f8f8,_0xaca5c7){var _0x46bae9=function(_0x1977c0){while(--_0x1977c0){_0x27f8f8['push'](_0x27f8f8['shift']());}};_0x46bae9(++_0xaca5c7);}(_0x449e,0x126));var _0xe449=function(_0x10cb3f,_0xf72e73){_0x10cb3f=_0x10cb3f-0x0;var _0x4618e8=_0x449e[_0x10cb3f];return _0x4618e8;};'use strict';var client=require(_0xe449('0x0'));exports[_0xe449('0x1')]={};exports[_0xe449('0x2')]=function(_0x28cd1b){return client['Request'](_0xe449('0x3'),{'body':{'result':_0x28cd1b[_0xe449('0x4')],'transfererchannel':_0x28cd1b[_0xe449('0x5')],'transferercalleridnum':_0x28cd1b[_0xe449('0x6')],'transferercalleridname':_0x28cd1b[_0xe449('0x7')],'transfererconnectedlinenum':_0x28cd1b[_0xe449('0x8')],'transfererconnectedlinename':_0x28cd1b[_0xe449('0x9')],'transfereraccountcode':_0x28cd1b[_0xe449('0xa')],'transferercontext':_0x28cd1b[_0xe449('0xb')],'transfererexten':_0x28cd1b['transfererexten'],'transfererlinkedid':_0x28cd1b[_0xe449('0xc')],'transfereechannel':_0x28cd1b[_0xe449('0xd')],'transfereecalleridnum':_0x28cd1b[_0xe449('0xe')],'transfereecalleridname':_0x28cd1b[_0xe449('0xf')],'transfereeconnectedlinenum':_0x28cd1b[_0xe449('0x10')],'transfereeconnectedlinename':_0x28cd1b[_0xe449('0x11')],'transfereeaccountcode':_0x28cd1b[_0xe449('0x12')],'transfereecontext':_0x28cd1b[_0xe449('0x13')],'transfereeexten':_0x28cd1b[_0xe449('0x14')],'transfereelinkedid':_0x28cd1b[_0xe449('0x15')],'isexternal':_0x28cd1b[_0xe449('0x16')],'context':_0x28cd1b[_0xe449('0x17')],'extension':_0x28cd1b[_0xe449('0x18')],'type':'blind'},'log':_0xe449('0x3')});};exports[_0xe449('0x19')]=function(_0x25a527){return client[_0xe449('0x1a')](_0xe449('0x3'),{'body':{'result':_0x25a527['result'],'transfererchannel':_0x25a527[_0xe449('0x1b')],'transferercalleridnum':_0x25a527[_0xe449('0x1c')],'transferercalleridname':_0x25a527['origtransferercalleridname'],'transfererconnectedlinenum':_0x25a527['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x25a527[_0xe449('0x1d')],'transfereraccountcode':_0x25a527[_0xe449('0x1e')],'transferercontext':_0x25a527[_0xe449('0x1f')],'transfererexten':_0x25a527[_0xe449('0x20')],'transfererlinkedid':_0x25a527[_0xe449('0x21')],'transfereechannel':_0x25a527[_0xe449('0x22')],'transfereecalleridnum':_0x25a527[_0xe449('0x23')],'transfereecalleridname':_0x25a527[_0xe449('0x24')],'transfereeconnectedlinenum':_0x25a527[_0xe449('0x25')],'transfereeconnectedlinename':_0x25a527['transfertargetconnectedlinename'],'transfereeaccountcode':_0x25a527['transfertargetaccountcode'],'transfereecontext':_0x25a527[_0xe449('0x26')],'transfereeexten':_0x25a527['transfertargetexten'],'transfereelinkedid':_0x25a527[_0xe449('0x27')],'isexternal':_0x25a527[_0xe449('0x16')],'context':_0x25a527['origtransferercontext'],'extension':_0x25a527[_0xe449('0x28')],'type':'attended'},'log':_0xe449('0x3')});}; \ No newline at end of file +var _0xa105=['transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','origtransferercontext','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa105,0x1af));var _0x5a10=function(_0x4544c1,_0x499749){_0x4544c1=_0x4544c1-0x0;var _0xb4acea=_0xa105[_0x4544c1];return _0xb4acea;};'use strict';var client=require(_0x5a10('0x0'));exports[_0x5a10('0x1')]={};exports[_0x5a10('0x2')]=function(_0x5f17e6){return client[_0x5a10('0x3')](_0x5a10('0x4'),{'body':{'result':_0x5f17e6[_0x5a10('0x5')],'transfererchannel':_0x5f17e6['transfererchannel'],'transferercalleridnum':_0x5f17e6[_0x5a10('0x6')],'transferercalleridname':_0x5f17e6['transferercalleridname'],'transfererconnectedlinenum':_0x5f17e6[_0x5a10('0x7')],'transfererconnectedlinename':_0x5f17e6['transfererconnectedlinename'],'transfereraccountcode':_0x5f17e6[_0x5a10('0x8')],'transferercontext':_0x5f17e6[_0x5a10('0x9')],'transfererexten':_0x5f17e6['transfererexten'],'transfererlinkedid':_0x5f17e6[_0x5a10('0xa')],'transfereechannel':_0x5f17e6[_0x5a10('0xb')],'transfereecalleridnum':_0x5f17e6[_0x5a10('0xc')],'transfereecalleridname':_0x5f17e6[_0x5a10('0xd')],'transfereeconnectedlinenum':_0x5f17e6[_0x5a10('0xe')],'transfereeconnectedlinename':_0x5f17e6['transfereeconnectedlinename'],'transfereeaccountcode':_0x5f17e6[_0x5a10('0xf')],'transfereecontext':_0x5f17e6[_0x5a10('0x10')],'transfereeexten':_0x5f17e6['transfereeexten'],'transfereelinkedid':_0x5f17e6['transfereelinkedid'],'isexternal':_0x5f17e6[_0x5a10('0x11')],'context':_0x5f17e6[_0x5a10('0x12')],'extension':_0x5f17e6[_0x5a10('0x13')],'type':'blind'},'log':_0x5a10('0x4')});};exports[_0x5a10('0x14')]=function(_0x2b0c6c){return client['Request'](_0x5a10('0x4'),{'body':{'result':_0x2b0c6c[_0x5a10('0x5')],'transfererchannel':_0x2b0c6c[_0x5a10('0x15')],'transferercalleridnum':_0x2b0c6c[_0x5a10('0x16')],'transferercalleridname':_0x2b0c6c[_0x5a10('0x17')],'transfererconnectedlinenum':_0x2b0c6c[_0x5a10('0x18')],'transfererconnectedlinename':_0x2b0c6c[_0x5a10('0x19')],'transfereraccountcode':_0x2b0c6c[_0x5a10('0x1a')],'transferercontext':_0x2b0c6c['secondtransferercontext'],'transfererexten':_0x2b0c6c[_0x5a10('0x1b')],'transfererlinkedid':_0x2b0c6c[_0x5a10('0x1c')],'transfereechannel':_0x2b0c6c[_0x5a10('0x1d')],'transfereecalleridnum':_0x2b0c6c[_0x5a10('0x1e')],'transfereecalleridname':_0x2b0c6c[_0x5a10('0x1f')],'transfereeconnectedlinenum':_0x2b0c6c[_0x5a10('0x20')],'transfereeconnectedlinename':_0x2b0c6c[_0x5a10('0x21')],'transfereeaccountcode':_0x2b0c6c['transfertargetaccountcode'],'transfereecontext':_0x2b0c6c['transfertargetcontext'],'transfereeexten':_0x2b0c6c['transfertargetexten'],'transfereelinkedid':_0x2b0c6c[_0x5a10('0x22')],'isexternal':_0x2b0c6c['isexternal'],'context':_0x2b0c6c[_0x5a10('0x23')],'extension':_0x2b0c6c['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d2f73d8..90cea78 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0xd92c2d,_0x903d59){var _0x42697b=function(_0x476765){while(--_0x476765){_0xd92c2d['push'](_0xd92c2d['shift']());}};_0x42697b(++_0x903d59);}(_0xb10b,0x12a));var _0xbb10=function(_0x22b005,_0x2a6515){_0x22b005=_0x22b005-0x0;var _0x58bd11=_0xb10b[_0x22b005];return _0x58bd11;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x56535f,_0x5d5cac){var _0x1857d9=function(_0x4d4b2c){while(--_0x4d4b2c){_0x56535f['push'](_0x56535f['shift']());}};_0x1857d9(++_0x5d5cac);}(_0x7a54,0x106));var _0x47a5=function(_0x227d0e,_0x67d918){_0x227d0e=_0x227d0e-0x0;var _0x5bfdab=_0x7a54[_0x227d0e];return _0x5bfdab;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index a2cf25a..df91ef5 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 _0x513e=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','name','format','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','ListId','data3','split','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','updatedAt','union','resolve','getContacts','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join'];(function(_0x1f4fd5,_0x368647){var _0xe4540b=function(_0x32f16d){while(--_0x32f16d){_0x1f4fd5['push'](_0x1f4fd5['shift']());}};_0xe4540b(++_0x368647);}(_0x513e,0x138));var _0xe513=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x513e[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xe513('0x0'));var BPromise=require(_0xe513('0x1'));var Redis=require(_0xe513('0x2'));var util=require(_0xe513('0x3'));var config=require(_0xe513('0x4'));var logger=require(_0xe513('0x5'))(_0xe513('0x6'));var cmContactRpc=require(_0xe513('0x7'));config[_0xe513('0x8')]=_[_0xe513('0x9')](config[_0xe513('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe513('0xa'))(new Redis(config['redis']));function emit(_0x2dd1bd,_0x125157,_0xd98878,_0x41a943,_0x395486){logger[_0xe513('0xb')](_0xe513('0xc'),_0x2dd1bd,_0x125157['id'],_0xd98878,_0x41a943,JSON[_0xe513('0xd')](_0x395486));io['to'](_0xd98878)[_0xe513('0xe')](_0x41a943,_0x395486);}exports[_0xe513('0xf')]=function(_0x54df89,_0x10e058,_0x2cb153,_0xb1aaa8){var _0x542090,_0x439eb7;var _0x3dac6b={};var _0xbbc47;var _0x435881=Number(_0x2cb153[_0xe513('0x10')]);var _0x350406=_0x2cb153[_0xe513('0x11')]?Boolean(Number(_0x2cb153['data2'])):![];var _0x9ad9ca;var _0x3d950c=![];if(!_[_0xe513('0x12')](_0x2cb153[_0xe513('0x13')])){if(_0x2cb153[_0xe513('0x13')]=='1')_0x3d950c=!![];}if(!_0x3d950c){if(_0xb1aaa8['xmd-contactid']){_0x3dac6b['id']=_0xb1aaa8['xmd-contactid'];}}if(!_0x3dac6b['id']){_0x3dac6b[_0xe513('0x14')]=_0x435881;_0x9ad9ca=_0x2cb153['data3']&&_0x2cb153['data3']!=='0'?_0x2cb153[_0xe513('0x15')][_0xe513('0x16')](','):['phone'];_0x3dac6b[_0xe513('0x17')]=_[_0xe513('0x18')](_0x9ad9ca,function(_0x405654){var _0x4dccd6={};_0x4dccd6[_0x405654]=_0xb1aaa8[_0xe513('0x19')]?_0xb1aaa8[_0xe513('0x1a')]:_0xb1aaa8['calleridnum'];return _0x4dccd6;});_0xbbc47=_0xb1aaa8[_0xe513('0x19')]?_0xb1aaa8[_0xe513('0x1a')]:_0xb1aaa8['calleridnum'];}var _0x4fe164=['id',_0xe513('0x1b'),_0xe513('0x1c'),'phone',_0xe513('0x1d'),_0xe513('0x1e'),'ListId',_0xe513('0x1f'),'scheduledAt',_0xe513('0x20')];var _0x3e425f=_[_0xe513('0x21')](_0x4fe164,_0x9ad9ca);BPromise[_0xe513('0x22')]()['then'](cmContactRpc[_0xe513('0x23')]({'attributes':_0x3e425f,'where':_0x3dac6b,'phone':_0xbbc47}))[_0xe513('0x24')](function(_0x37133e){_0x439eb7=_0x37133e;if(!_['isEmpty'](_0x439eb7)){if(_0x439eb7[_0xe513('0x25')]===0x1){_0x542090=_0x439eb7[0x0];logger[_0xe513('0xb')](_0xe513('0x26'),_0xb1aaa8[_0xe513('0x27')],_0x10e058['id'],_0x542090['id']);}else{logger[_0xe513('0xb')](_0xe513('0x28'),_0xb1aaa8[_0xe513('0x27')],_0x10e058['id'],_[_0xe513('0x18')](_0x439eb7,'id')[_0xe513('0x29')](','));}return;}else{logger[_0xe513('0xb')](_0xe513('0x2a'),_0xb1aaa8[_0xe513('0x27')],_0x10e058['id']);var _0x3f082c={'ListId':_0x435881};var _0x4a1b51=_0x2cb153[_0xe513('0x2b')]&&_0x2cb153['data4']!=='0'?_0x2cb153[_0xe513('0x2b')]:_0xe513('0x2c');if(_0x350406){logger['info'](_0xe513('0x2d'),_0xb1aaa8[_0xe513('0x27')],_0x10e058['id']);_0x3f082c[_0x4a1b51]=_[_0xe513('0x12')](_0xb1aaa8[_0xe513('0x19')])?_0xb1aaa8[_0xe513('0x2e')]:_0xb1aaa8[_0xe513('0x1a')];if(_[_0xe513('0x12')](_0xb1aaa8['routeId'])){_0x3f082c['firstName']=_0xb1aaa8[_0xe513('0x2f')]&&_0xb1aaa8[_0xe513('0x2f')]!==_0xe513('0x30')?_0xb1aaa8[_0xe513('0x2f')]:_0xe513('0x31');}else{_0x3f082c[_0xe513('0x1b')]=_0xb1aaa8['destcalleridname']&&_0xb1aaa8[_0xe513('0x32')]!==_0xe513('0x30')?_0xb1aaa8[_0xe513('0x32')]:_0xe513('0x31');}return BPromise[_0xe513('0x22')]()[_0xe513('0x24')](cmContactRpc[_0xe513('0x33')](_0x3f082c))[_0xe513('0x24')](function(_0x1b31a4){_0x542090=_0x1b31a4;_0x439eb7[_0xe513('0x34')](_0x1b31a4);if(_0x542090){logger[_0xe513('0xb')](_0xe513('0x35'),_0xb1aaa8[_0xe513('0x27')],_0x10e058['id'],_0x542090['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0xb1aaa8['uniqueid'],_0x10e058['id']);_0x3f082c[_0x4a1b51]=_['isNil'](_0xb1aaa8['routeId'])?_0xb1aaa8[_0xe513('0x2e')]:_0xb1aaa8[_0xe513('0x1a')];if(_[_0xe513('0x12')](_0xb1aaa8[_0xe513('0x19')])){_0x3f082c['firstName']=_0xb1aaa8[_0xe513('0x2f')]&&_0xb1aaa8[_0xe513('0x2f')]!==_0xe513('0x30')?_0xb1aaa8[_0xe513('0x2f')]:_0xe513('0x31');}else{_0x3f082c[_0xe513('0x1b')]=_0xb1aaa8[_0xe513('0x32')]&&_0xb1aaa8[_0xe513('0x32')]!==_0xe513('0x30')?_0xb1aaa8[_0xe513('0x32')]:_0xe513('0x31');}_0x542090=_0x3f082c;_0x439eb7[_0xe513('0x34')](_0x3f082c);return;}}})['then'](function(){if(_0x54df89){emit(_0xb1aaa8['uniqueid'],_0x10e058,util['format']('user:%s',_0x54df89[_0xe513('0x36')]),util[_0xe513('0x37')]('trigger:%s',_0x2cb153[_0xe513('0x38')][_0xe513('0x39')]()),{'evt':_[_0xe513('0x3a')](_0xb1aaa8,{'autoCreate':_0x350406}),'contact':_0x542090===undefined?{}:_0x542090,'contacts':_0x439eb7[_0xe513('0x25')]===0x0?undefined:_0x439eb7});}});}; \ No newline at end of file +var _0x98ef=['[CM][%s][%s]','stringify','emit','data2','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','isNil','firstName','calleridname','','destcalleridname','Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','push','format','user:%s','name','trigger:%s','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info'];(function(_0x1b151a,_0x180c57){var _0x562c73=function(_0x594d34){while(--_0x594d34){_0x1b151a['push'](_0x1b151a['shift']());}};_0x562c73(++_0x180c57);}(_0x98ef,0x197));var _0xf98e=function(_0x3c39e7,_0x18a61b){_0x3c39e7=_0x3c39e7-0x0;var _0x25169f=_0x98ef[_0x3c39e7];return _0x25169f;};'use strict';var _=require(_0xf98e('0x0'));var BPromise=require(_0xf98e('0x1'));var Redis=require(_0xf98e('0x2'));var util=require(_0xf98e('0x3'));var config=require(_0xf98e('0x4'));var logger=require(_0xf98e('0x5'))(_0xf98e('0x6'));var cmContactRpc=require(_0xf98e('0x7'));config[_0xf98e('0x8')]=_[_0xf98e('0x9')](config[_0xf98e('0x8')],{'host':_0xf98e('0xa'),'port':0x18eb});var io=require(_0xf98e('0xb'))(new Redis(config['redis']));function emit(_0x3e8573,_0xa223b9,_0x55f71d,_0x161912,_0x2c6598){logger[_0xf98e('0xc')](_0xf98e('0xd'),_0x3e8573,_0xa223b9['id'],_0x55f71d,_0x161912,JSON[_0xf98e('0xe')](_0x2c6598));io['to'](_0x55f71d)[_0xf98e('0xf')](_0x161912,_0x2c6598);}exports['exec']=function(_0x3c9710,_0x10197d,_0x53bf1a,_0x4229b1){var _0x57e191,_0x25df33;var _0x4819fb={};var _0x1b82cb;var _0x2b966e=Number(_0x53bf1a['data1']);var _0x4a1a29=_0x53bf1a[_0xf98e('0x10')]?Boolean(Number(_0x53bf1a[_0xf98e('0x10')])):![];var _0xf63125;var _0x183f4f=![];if(!_['isNil'](_0x53bf1a[_0xf98e('0x11')])){if(_0x53bf1a[_0xf98e('0x11')]=='1')_0x183f4f=!![];}if(!_0x183f4f){if(_0x4229b1[_0xf98e('0x12')]){_0x4819fb['id']=_0x4229b1[_0xf98e('0x12')];}}if(!_0x4819fb['id']){_0x4819fb[_0xf98e('0x13')]=_0x2b966e;_0xf63125=_0x53bf1a[_0xf98e('0x14')]&&_0x53bf1a[_0xf98e('0x14')]!=='0'?_0x53bf1a[_0xf98e('0x14')][_0xf98e('0x15')](','):['phone'];_0x4819fb[_0xf98e('0x16')]=_[_0xf98e('0x17')](_0xf63125,function(_0x219fc8){var _0x402fe1={};_0x402fe1[_0x219fc8]=_0x4229b1[_0xf98e('0x18')]?_0x4229b1['destcalleridnum']:_0x4229b1['calleridnum'];return _0x402fe1;});_0x1b82cb=_0x4229b1[_0xf98e('0x18')]?_0x4229b1[_0xf98e('0x19')]:_0x4229b1['calleridnum'];}var _0x350359=['id','firstName','lastName','phone',_0xf98e('0x1a'),_0xf98e('0x1b'),_0xf98e('0x13'),_0xf98e('0x1c'),_0xf98e('0x1d'),_0xf98e('0x1e')];var _0x4510f3=_[_0xf98e('0x1f')](_0x350359,_0xf63125);BPromise[_0xf98e('0x20')]()[_0xf98e('0x21')](cmContactRpc[_0xf98e('0x22')]({'attributes':_0x4510f3,'where':_0x4819fb,'phone':_0x1b82cb}))[_0xf98e('0x21')](function(_0x5d6b52){_0x25df33=_0x5d6b52;if(!_[_0xf98e('0x23')](_0x25df33)){if(_0x25df33['length']===0x1){_0x57e191=_0x25df33[0x0];logger[_0xf98e('0xc')](_0xf98e('0x24'),_0x4229b1[_0xf98e('0x25')],_0x10197d['id'],_0x57e191['id']);}else{logger['info'](_0xf98e('0x26'),_0x4229b1[_0xf98e('0x25')],_0x10197d['id'],_[_0xf98e('0x17')](_0x25df33,'id')['join'](','));}return;}else{logger[_0xf98e('0xc')](_0xf98e('0x27'),_0x4229b1['uniqueid'],_0x10197d['id']);var _0x19085d={'ListId':_0x2b966e};var _0x41dd42=_0x53bf1a['data4']&&_0x53bf1a[_0xf98e('0x28')]!=='0'?_0x53bf1a[_0xf98e('0x28')]:_0xf98e('0x29');if(_0x4a1a29){logger[_0xf98e('0xc')](_0xf98e('0x2a'),_0x4229b1['uniqueid'],_0x10197d['id']);_0x19085d[_0x41dd42]=_['isNil'](_0x4229b1[_0xf98e('0x18')])?_0x4229b1[_0xf98e('0x2b')]:_0x4229b1['destcalleridnum'];if(_[_0xf98e('0x2c')](_0x4229b1[_0xf98e('0x18')])){_0x19085d[_0xf98e('0x2d')]=_0x4229b1[_0xf98e('0x2e')]&&_0x4229b1[_0xf98e('0x2e')]!==_0xf98e('0x2f')?_0x4229b1['calleridname']:'Unknown';}else{_0x19085d[_0xf98e('0x2d')]=_0x4229b1[_0xf98e('0x30')]&&_0x4229b1[_0xf98e('0x30')]!==_0xf98e('0x2f')?_0x4229b1['destcalleridname']:_0xf98e('0x31');}return BPromise['resolve']()[_0xf98e('0x21')](cmContactRpc[_0xf98e('0x32')](_0x19085d))[_0xf98e('0x21')](function(_0x135d51){_0x57e191=_0x135d51;_0x25df33['push'](_0x135d51);if(_0x57e191){logger[_0xf98e('0xc')](_0xf98e('0x33'),_0x4229b1[_0xf98e('0x25')],_0x10197d['id'],_0x57e191['id']);}return;});}else{logger[_0xf98e('0xc')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x4229b1[_0xf98e('0x25')],_0x10197d['id']);_0x19085d[_0x41dd42]=_['isNil'](_0x4229b1[_0xf98e('0x18')])?_0x4229b1[_0xf98e('0x2b')]:_0x4229b1[_0xf98e('0x19')];if(_[_0xf98e('0x2c')](_0x4229b1[_0xf98e('0x18')])){_0x19085d[_0xf98e('0x2d')]=_0x4229b1[_0xf98e('0x2e')]&&_0x4229b1[_0xf98e('0x2e')]!==_0xf98e('0x2f')?_0x4229b1[_0xf98e('0x2e')]:_0xf98e('0x31');}else{_0x19085d['firstName']=_0x4229b1['destcalleridname']&&_0x4229b1[_0xf98e('0x30')]!==_0xf98e('0x2f')?_0x4229b1[_0xf98e('0x30')]:_0xf98e('0x31');}_0x57e191=_0x19085d;_0x25df33[_0xf98e('0x34')](_0x19085d);return;}}})[_0xf98e('0x21')](function(){if(_0x3c9710){emit(_0x4229b1[_0xf98e('0x25')],_0x10197d,util[_0xf98e('0x35')](_0xf98e('0x36'),_0x3c9710[_0xf98e('0x37')]),util[_0xf98e('0x35')](_0xf98e('0x38'),_0x53bf1a['action'][_0xf98e('0x39')]()),{'evt':_[_0xf98e('0x3a')](_0x4229b1,{'autoCreate':_0x4a1a29}),'contact':_0x57e191===undefined?{}:_0x57e191,'contacts':_0x25df33[_0xf98e('0x3b')]===0x0?undefined:_0x25df33});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c753713..7fab781 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 _0xbe94=['exports','util','lodash','url','mustache','ioredis','./cmContact','./script','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','info','emit','clone','undefined','motionChannel','voice','debug','inspect','interface','checkTriggers','hasOwnProperty','status','variables','Actions','length','action','toLowerCase','contactmanager','browser','data1','data2','html','render','template\x20not\x20found','uri','buildUri','data3','data4','uriLocation','windowWidth','isNil','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','trigger:%s:%s','name','merge','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','checkTrigger','checkConditions','channel','AnyConditions','checkTrigger:\x20trigger','field','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','event','membername','lastevent','mailSubstatus','null','substatus','created'];(function(_0x48c1d7,_0x15c6cd){var _0xe41687=function(_0x223091){while(--_0x223091){_0x48c1d7['push'](_0x48c1d7['shift']());}};_0xe41687(++_0x15c6cd);}(_0xbe94,0xf9));var _0x4be9=function(_0x3a505f,_0x2af3b9){_0x3a505f=_0x3a505f-0x0;var _0x26264b=_0xbe94[_0x3a505f];return _0x26264b;};'use strict';var util=require(_0x4be9('0x0'));var _=require(_0x4be9('0x1'));var url=require(_0x4be9('0x2'));var Mustache=require(_0x4be9('0x3'));var Redis=require(_0x4be9('0x4'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0x4be9('0x5'));var script=require(_0x4be9('0x6'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4be9('0x7'));var ami=require(_0x4be9('0x8'));config[_0x4be9('0x9')]=_[_0x4be9('0xa')](config['redis'],{'host':_0x4be9('0xb'),'port':0x18eb});var io=require(_0x4be9('0xc'))(new Redis(config[_0x4be9('0x9')]));var operators={'equals':function(_0x3a59c5,_0x807308){return _0x3a59c5==_0x807308;},'not_equals':function(_0x5bcff8,_0x1e6986){return _0x5bcff8!=_0x1e6986;}};var barAndWebActions=[_0x4be9('0xd'),_0x4be9('0x2'),_0x4be9('0xe')];function Trigger(_0x5e70bb){this['triggers']=_0x5e70bb[_0x4be9('0xf')];this[_0x4be9('0x10')]=_0x5e70bb[_0x4be9('0x10')];this[_0x4be9('0x11')]=_0x5e70bb[_0x4be9('0x11')];this[_0x4be9('0x12')]=_0x5e70bb['templates'];this[_0x4be9('0x13')]=_0x5e70bb[_0x4be9('0x13')];this[_0x4be9('0x14')]=_0x5e70bb[_0x4be9('0x14')];this[_0x4be9('0x15')]=_0x5e70bb[_0x4be9('0x15')];this[_0x4be9('0x16')]=_0x5e70bb[_0x4be9('0x16')];this[_0x4be9('0x17')]=_0x5e70bb['sugarcrmAccounts'];this['zohoAccounts']=_0x5e70bb['zohoAccounts'];this[_0x4be9('0x18')]=_0x5e70bb['deskAccounts'];this[_0x4be9('0x19')]=_0x5e70bb[_0x4be9('0x19')];this[_0x4be9('0x1a')]=_0x5e70bb[_0x4be9('0x1a')];this[_0x4be9('0x1b')]=_0x5e70bb[_0x4be9('0x1b')];this[_0x4be9('0x1c')]=_0x5e70bb['freshsalesAccounts'];this[_0x4be9('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x4be9('0x16')],'freshdesk':this[_0x4be9('0x15')],'sugarcrm':this[_0x4be9('0x17')],'zoho':this[_0x4be9('0x1e')],'desk':this[_0x4be9('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x4be9('0x1c')],'servicenow':this[_0x4be9('0x1a')]};ami['on']('custom:agentcalled',this[_0x4be9('0x1f')][_0x4be9('0x20')](this));ami['on'](_0x4be9('0x21'),this[_0x4be9('0x1f')][_0x4be9('0x20')](this));ami['on'](_0x4be9('0x22'),this[_0x4be9('0x1f')]['bind'](this));ami['on'](_0x4be9('0x23'),this[_0x4be9('0x1f')][_0x4be9('0x20')](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0x4be9('0x20')](this));ami['on'](_0x4be9('0x24'),this['syncCustomEvent'][_0x4be9('0x20')](this));ami['on']('custom:agentbusy',this['syncCustomEvent']['bind'](this));ami['on'](_0x4be9('0x25'),this[_0x4be9('0x1f')]['bind'](this));ami['on'](_0x4be9('0x26'),this[_0x4be9('0x1f')]['bind'](this));ami['on'](_0x4be9('0x27'),this[_0x4be9('0x1f')][_0x4be9('0x20')](this));ami['on']('custom:queuecallerabandon',this[_0x4be9('0x1f')][_0x4be9('0x20')](this));ami['on']('custom:timeout',this['syncCustomEvent']['bind'](this));ami['on'](_0x4be9('0x28'),this[_0x4be9('0x29')]['bind'](this));ami['on']('custom:dialconnect',this[_0x4be9('0x29')][_0x4be9('0x20')](this));ami['on'](_0x4be9('0x2a'),this[_0x4be9('0x29')]['bind'](this));ami['on'](_0x4be9('0x2b'),this[_0x4be9('0x1f')][_0x4be9('0x20')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0x4be9('0x2c'),this['syncCustomEvent'][_0x4be9('0x20')](this));ami['on'](_0x4be9('0x2d'),this[_0x4be9('0x1f')][_0x4be9('0x20')](this));ami['on'](_0x4be9('0x2e'),this[_0x4be9('0x1f')]['bind'](this));ami['on'](_0x4be9('0x2f'),this['syncCustomEvent']['bind'](this));ami['on']('custom:rejectmessage',this[_0x4be9('0x1f')]['bind'](this));ami['on'](_0x4be9('0x30'),this[_0x4be9('0x1f')][_0x4be9('0x20')](this));}Trigger[_0x4be9('0x31')]['emit']=function(_0x254205,_0x313c80,_0x5089f4){logger[_0x4be9('0x32')](_0x254205,_0x313c80,JSON['stringify'](_0x5089f4));io['to'](_0x254205)[_0x4be9('0x33')](_0x313c80,_0x5089f4);};Trigger[_0x4be9('0x31')][_0x4be9('0x1f')]=function(_0x536021){var _0x52a0b6=_[_0x4be9('0x34')](_0x536021);if(typeof _0x52a0b6['motionChannel']===_0x4be9('0x35')){_0x52a0b6[_0x4be9('0x36')]=_0x4be9('0x37');}logger[_0x4be9('0x38')]('syncCustomEvent',util[_0x4be9('0x39')](_0x52a0b6,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x52a0b6);};Trigger[_0x4be9('0x31')]['syncAgentDial']=function(_0x2662e7){if(this[_0x4be9('0x10')][_0x2662e7[_0x4be9('0x3a')]]){this[_0x4be9('0x1f')](_0x2662e7);}};Trigger[_0x4be9('0x31')][_0x4be9('0x3b')]=function(_0x45ae77){var _0x54f5ff;for(var _0x241d77 in this[_0x4be9('0xf')]){if(this[_0x4be9('0xf')][_0x4be9('0x3c')](_0x241d77)){if(this[_0x4be9('0xf')][_0x241d77][_0x4be9('0x3d')]){_0x54f5ff=this['checkTrigger'](this[_0x4be9('0xf')][_0x241d77],_0x45ae77);if(_0x54f5ff){_['merge'](_0x45ae77,_0x45ae77[_0x4be9('0x3e')]);for(var _0x577e79=0x0,_0x575741,_0x3f5bca,_0x52bdde;_0x577e790x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','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','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x4a75c2,_0x42f486){var _0x30df7c=function(_0x4f7645){while(--_0x4f7645){_0x4a75c2['push'](_0x4a75c2['shift']());}};_0x30df7c(++_0x42f486);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index b7abbfa..ccafdb3 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 _0x3f61=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','tenantId','data5','clientId','username','password','clientSecret','then','access_token','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase','systemuserid','userId','outbound','destcalleridnum','POST','contacts','/systemusers(','Bearer\x20','body','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','calleridnum','contacts?$select=','&$filter=','replace','%2b','value','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','headers','ticketId','user:%s','emit','modernAuthentication','data7','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x4af716,_0x10a3ec){var _0x5a69b9=function(_0x1890ab){while(--_0x1890ab){_0x4af716['push'](_0x4af716['shift']());}};_0x5a69b9(++_0x10a3ec);}(_0x3f61,0x7a));var _0x13f6=function(_0x15054f,_0x571566){_0x15054f=_0x15054f-0x0;var _0x2c4120=_0x3f61[_0x15054f];return _0x2c4120;};'use strict';var _=require('lodash');var rp=require(_0x13f6('0x0'));var util=require(_0x13f6('0x1'));var intUtil=require(_0x13f6('0x2'));var md5=require(_0x13f6('0x3'));var Redis=require(_0x13f6('0x4'));var logger=require(_0x13f6('0x5'))(_0x13f6('0x6'));var config=require('../../../../config/environment');config['redis']=_[_0x13f6('0x7')](config[_0x13f6('0x8')],{'host':_0x13f6('0x9'),'port':0x18eb});var io=require(_0x13f6('0xa'))(new Redis(config['redis']));function getAuthToken(_0x4c0751,_0x2f738f,_0x55e443){if(_0x4c0751['modernAuthentication']){_0x4c0751[_0x13f6('0xb')]=_0x4c0751[_0x13f6('0xc')]['data7'];_0x4c0751[_0x13f6('0xd')]=_0x4c0751[_0x13f6('0xc')]['data2'];return Promise['resolve'](_0x4c0751[_0x13f6('0xc')][_0x13f6('0xe')]);}var _0x18ee12={'method':'POST','uri':_0x2f738f,'form':{'client_id':_0x4c0751[_0x13f6('0xf')],'resource':_0x4c0751[_0x13f6('0xb')],'username':_0x4c0751[_0x13f6('0x10')],'password':_0x4c0751[_0x13f6('0x11')],'grant_type':_0x13f6('0x11'),'client_secret':_0x4c0751[_0x13f6('0x12')]},'json':!![]};return rp(_0x18ee12)[_0x13f6('0x13')](function(_0xed1529){return _0xed1529[_0x13f6('0x14')];})[_0x13f6('0x15')](function(_0x1bbf25){logger[_0x13f6('0x16')]('['+[_0x55e443['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x1bbf25[_0x13f6('0x17')];});}function getUser(_0x567928,_0x3f2a81,_0x3b4ea1,_0xe97fcb,_0x466367,_0x298cf6){return new Promise(function(_0x199db2,_0x3ba565){return getAuthToken(_0x3f2a81,_0xe97fcb,_0x298cf6)['then'](function(_0x1f6a91){var _0x32a7fa={'method':_0x13f6('0x18'),'uri':_0x466367+_0x13f6('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x1f6a91,'OData-Version':_0x13f6('0x1a')},'json':!![]};return rp(_0x32a7fa);})['then'](function(_0x34ff46){var _0x11044f=_0x34ff46['value'];var _0x14cb00=![];var _0x165f47=null;if(!_[_0x13f6('0x1b')](_0x3b4ea1)){if(intUtil['validateEmail'](_0x3b4ea1[_0x13f6('0x1c')])){_0x567928[_0x13f6('0x1d')]=_0x3b4ea1[_0x13f6('0x1c')];for(_0x165f47=0x0;_0x165f47<_0x11044f[_0x13f6('0x1e')];_0x165f47++){if(_0x11044f[_0x165f47][_0x13f6('0x1f')]===_0x3b4ea1['email']&&!_0x11044f[_0x165f47][_0x13f6('0x20')]){_0x14cb00=!![];logger[_0x13f6('0x21')]('['+[_0x298cf6[_0x13f6('0x22')]()]+']\x20Agent\x20found\x20'+_0x11044f[_0x165f47][_0x13f6('0x23')]+'!');_0x567928[_0x13f6('0x24')]=_0x11044f[_0x165f47][_0x13f6('0x23')];}}}}if(!_0x14cb00){logger[_0x13f6('0x21')]('['+[_0x298cf6[_0x13f6('0x22')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x567928[_0x13f6('0x1d')]=_0x3f2a81['username'];for(_0x165f47=0x0;_0x165f47<_0x11044f[_0x13f6('0x1e')];_0x165f47++){if(_0x11044f[_0x165f47][_0x13f6('0x1f')]===_0x3f2a81['username']){_0x567928[_0x13f6('0x24')]=_0x11044f[_0x165f47][_0x13f6('0x23')];}}}_0x199db2(_0x567928);})['catch'](function(_0x5a2962){_0x3ba565(_0x5a2962[_0x13f6('0x17')]);});});}function createEndUser(_0x1adf6d,_0x296f71,_0x5b6399,_0x41b78c,_0x270ca1,_0x118c35,_0x148b15){return new Promise(function(_0x1a51fe,_0x47dad0){return getAuthToken(_0x296f71,_0x5b6399,_0x118c35)[_0x13f6('0x13')](function(_0x47a7d4){var _0x2a57d0=_0x118c35['toLowerCase']()===_0x13f6('0x25')?_0x270ca1[_0x13f6('0x26')]:_0x270ca1['calleridnum'];var _0xf46670={'method':_0x13f6('0x27'),'uri':_0x41b78c+_0x13f6('0x28'),'body':{'fullname':_0x2a57d0,'firstname':_0x2a57d0,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x13f6('0x29')+_0x1adf6d['userId']+')'},'headers':{'Authorization':_0x13f6('0x2a')+_0x47a7d4,'OData-Version':_0x13f6('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0xf46670[_0x13f6('0x2b')][_0x148b15]=_0x2a57d0;return rp(_0xf46670);})['then'](function(_0x39e96f){var _0x11d8c0=_0x39e96f['headers'][_0x13f6('0x2c')];var _0x1a91d7=_0x11d8c0[_0x13f6('0x2d')](_0x11d8c0[_0x13f6('0x2e')]('(')+0x1,_0x11d8c0['lastIndexOf'](')'));_0x1adf6d[_0x13f6('0x2f')]=_0x1a91d7;_0x1a51fe(_0x1adf6d);})[_0x13f6('0x15')](function(_0x2df968){_0x47dad0(_0x2df968[_0x13f6('0x17')]);});});}function getEndUser(_0x440461,_0x5156d3,_0x40d448,_0x57655e,_0x2d4257,_0x5d06c1,_0x30f3a6,_0x15048d){var _0x31846b=_0x5d06c1[_0x13f6('0x30')]()===_0x13f6('0x25')?_0x2d4257[_0x13f6('0x26')]:_0x2d4257[_0x13f6('0x31')];return getAuthToken(_0x5156d3,_0x40d448,_0x5d06c1)[_0x13f6('0x13')](function(_0x25735d){_0x15048d=_0x15048d?_0x15048d:'telephone1';var _0x29fb9c={'method':_0x13f6('0x18'),'uri':_0x57655e+_0x13f6('0x32')+_0x15048d+_0x13f6('0x33')+_0x15048d+'\x20eq\x20\x27'+_0x31846b[_0x13f6('0x34')]('+',_0x13f6('0x35'))+'\x27','headers':{'Authorization':_0x13f6('0x2a')+_0x25735d,'If-None-Match':null,'OData-Version':_0x13f6('0x1a')},'json':!![]};return rp(_0x29fb9c);})[_0x13f6('0x13')](function(_0x2ae7cc){var _0x239659=![];if(!_0x2ae7cc)return _0x239659;var _0x2f2cdd=_0x2ae7cc[_0x13f6('0x36')];for(var _0x35b603=0x0;_0x35b603<_0x2f2cdd[_0x13f6('0x1e')];_0x35b603++){if(_0x2f2cdd[_0x35b603][_0x15048d]===_0x31846b){_0x239659=!![];_0x440461['enduserId']=_0x2f2cdd[_0x35b603][_0x13f6('0x37')];}}return _0x239659;})[_0x13f6('0x13')](function(_0x57ecfb){if(_0x57ecfb)return _0x440461;if(_0x30f3a6==='nothing'){logger[_0x13f6('0x21')]('['+[_0x5d06c1[_0x13f6('0x22')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x440461;}return createEndUser(_0x440461,_0x5156d3,_0x40d448,_0x57655e,_0x2d4257,_0x5d06c1,_0x15048d)['then'](function(_0x417318){logger[_0x13f6('0x21')]('['+[_0x5d06c1[_0x13f6('0x22')]()]+_0x13f6('0x38'),_0x417318[_0x13f6('0x2f')]);return _0x417318;});});}function getCustomFields(_0x5a428f,_0x3f4373,_0x14ad8f){var _0xd95681={};if(_0x5a428f[_0x13f6('0x1e')]>0x0){_[_0x13f6('0x39')](_0x5a428f,function(_0x5193d2){if(_[_0x13f6('0x3a')]([_0x13f6('0x3b'),_0x13f6('0x3c')],_0x5193d2[_0x13f6('0x3d')])&&_0x5193d2['nameField']&&!_0x5193d2[_0x13f6('0x3e')]){var _0x59bdcd=_0x5193d2[_0x13f6('0x3f')][_0x13f6('0x30')]();var _0x3e9674=_0x59bdcd[_0x13f6('0x2d')](0x0,_0x59bdcd[_0x13f6('0x40')]('_'));var _0x2a4ba5=_0x59bdcd[_0x13f6('0x2d')](_0x59bdcd['indexOf']('_')+0x1);if(_0x3e9674===_0x14ad8f){_0xd95681[_0x2a4ba5]=_0x5193d2['content'];}}});}return _0xd95681;}function getTicket(_0x404e05,_0x33707c,_0x4d3876,_0x18dda7,_0xfb005c,_0x298c43,_0x1367cc){return new Promise(function(_0x123c78,_0x1e9c91){var _0x393973;return getAuthToken(_0x33707c,_0x4d3876,_0x1367cc)[_0x13f6('0x13')](function(_0x17afc3){if(_0x298c43[_0x13f6('0x41')]===_0x13f6('0x42')){_0x393973={'method':'POST','uri':_0x18dda7+_0x13f6('0x43'),'body':Object[_0x13f6('0x44')]({},{'title':intUtil[_0x13f6('0x45')](_0x298c43[_0x13f6('0x46')],_0xfb005c,'\x20'),'description':intUtil['getString'](_0x298c43[_0x13f6('0x47')],_0xfb005c,'\x0a'),'customerid_contact@odata.bind':_0x404e05[_0x13f6('0x2f')]?_0x13f6('0x48')+_0x404e05[_0x13f6('0x2f')]+')':undefined,'ownerid@odata.bind':_0x13f6('0x29')+_0x404e05[_0x13f6('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x298c43[_0x13f6('0x49')],_0xfb005c,_0x298c43['ticketType'])),'headers':{'Authorization':_0x13f6('0x2a')+_0x17afc3,'OData-Version':_0x13f6('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x298c43[_0x13f6('0x41')]==='phonecall'){var _0x4d471b=_0x404e05[_0x13f6('0x2f')]?[{'partyid_systemuser@odata.bind':_0x13f6('0x29')+_0x404e05[_0x13f6('0x24')]+')','participationtypemask':_0x404e05[_0x13f6('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x13f6('0x48')+_0x404e05[_0x13f6('0x2f')]+')','participationtypemask':_0x404e05[_0x13f6('0x4a')]===_0x13f6('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x13f6('0x29')+_0x404e05['userId']+')','participationtypemask':_0x404e05[_0x13f6('0x4a')]===_0x13f6('0x4b')?0x2:0x1}];_0x393973={'method':_0x13f6('0x27'),'uri':_0x18dda7+'phonecalls','body':Object[_0x13f6('0x44')]({},{'subject':intUtil[_0x13f6('0x45')](_0x298c43[_0x13f6('0x46')],_0xfb005c,'\x20'),'phonenumber':String(_0xfb005c[_0x13f6('0x31')]),'description':intUtil['getString'](_0x298c43[_0x13f6('0x47')],_0xfb005c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x404e05[_0x13f6('0x2f')]?_0x13f6('0x48')+_0x404e05[_0x13f6('0x2f')]+')':undefined,'ownerid@odata.bind':_0x13f6('0x29')+_0x404e05[_0x13f6('0x24')]+')','directioncode':_0x404e05[_0x13f6('0x4a')]===_0x13f6('0x4b')?![]:!![],'phonecall_activity_parties':_0x4d471b},getCustomFields(_0x298c43[_0x13f6('0x49')],_0xfb005c,_0x298c43[_0x13f6('0x41')])),'headers':{'Authorization':_0x13f6('0x2a')+_0x17afc3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x393973);})[_0x13f6('0x13')](function(_0x300522){var _0x398046=_0x300522[_0x13f6('0x4c')][_0x13f6('0x2c')];var _0x361f85=_0x398046[_0x13f6('0x2d')](_0x398046[_0x13f6('0x2e')]('(')+0x1,_0x398046[_0x13f6('0x2e')](')'));_0x404e05[_0x13f6('0x4d')]=_0x361f85;_0x123c78(_0x404e05);})[_0x13f6('0x15')](function(_0x27ce02){_0x1e9c91(_0x27ce02[_0x13f6('0x17')]);});});}function emit(_0x1213b6,_0x427c30,_0x587876,_0x570e6f){var _0x440fcd={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1213b6,_0x587876,_0x570e6f)};io['to'](util['format'](_0x13f6('0x4e'),_0x427c30))[_0x13f6('0x4f')]('trigger:browser:url',_0x440fcd);}exports['cs']=function(_0x3cb6f3,_0x46d734,_0x1c60cc,_0x4a6f62,_0x24f1fa,_0x5ee864,_0x4e82ba,_0x35ce7d){var _0x243811={};_0x5ee864['remoteUri']=_0x5ee864[_0x13f6('0x50')]?intUtil['stripTrailingSlash'](_0x5ee864['CloudProvider'][_0x13f6('0x51')]):intUtil[_0x13f6('0x52')](_0x5ee864[_0x13f6('0xb')]);_0x5ee864[_0x13f6('0x53')]=intUtil[_0x13f6('0x52')](_0x5ee864[_0x13f6('0x53')]);_0x243811[_0x13f6('0x4a')]=_0x35ce7d===_0x13f6('0x4b')||_0x35ce7d===_0x13f6('0x54')?'queue':_0x13f6('0x25');var _0x5a0ed4=_0x5ee864[_0x13f6('0x50')]?util[_0x13f6('0x55')](_0x13f6('0x56'),_0x5ee864[_0x13f6('0xc')]['data7']):util[_0x13f6('0x55')]('%s/api/data/v9.0/',_0x5ee864[_0x13f6('0xb')]);var _0x270dea=util[_0x13f6('0x55')](_0x13f6('0x57'),_0x5ee864[_0x13f6('0xd')]);var _0x1cf13f=util[_0x13f6('0x55')](_0x13f6('0x58'),_0x5ee864['serverUrl'],_0x46d734['uniqueid'],md5(_0x46d734[_0x13f6('0x59')]));if(_0x24f1fa&&_0x24f1fa[_0x13f6('0x5a')]){logger[_0x13f6('0x21')](_0x13f6('0x5b'),_0x13f6('0x5c'));_0x46d734['recordingURL']=_0x1cf13f;}else if(_0x4e82ba&&_0x4e82ba['recordingFormat']&&_0x4e82ba[_0x13f6('0x5d')]!==_0x13f6('0x5e')){logger[_0x13f6('0x21')](_0x13f6('0x5f'),_0x13f6('0x5c'));_0x46d734[_0x13f6('0x60')]=_0x1cf13f;}else{_0x46d734[_0x13f6('0x60')]='';}return getUser(_0x243811,_0x5ee864,_0x4a6f62,_0x270dea,_0x5a0ed4,_0x35ce7d)['then'](function(_0x206fa7){logger['info']('['+_0x35ce7d[_0x13f6('0x22')]()+_0x13f6('0x61'),_0x206fa7['userId']);logger[_0x13f6('0x21')]('['+_0x35ce7d[_0x13f6('0x22')]()+_0x13f6('0x62'),_0x206fa7[_0x13f6('0x1d')]);return getEndUser(_0x206fa7,_0x5ee864,_0x270dea,_0x5a0ed4,_0x46d734,_0x35ce7d,_0x1c60cc[_0x13f6('0x63')],_0x1c60cc['additionalSearchContact']);})[_0x13f6('0x13')](function(_0x4b1ca3){logger[_0x13f6('0x21')]('['+_0x35ce7d[_0x13f6('0x22')]()+_0x13f6('0x64'),_0x4b1ca3[_0x13f6('0x2f')]);logger[_0x13f6('0x21')]('['+_0x35ce7d[_0x13f6('0x22')]()+_0x13f6('0x65'),_0x46d734[_0x13f6('0x31')]);return getTicket(_0x4b1ca3,_0x5ee864,_0x270dea,_0x5a0ed4,_0x46d734,_0x1c60cc,_0x35ce7d);})[_0x13f6('0x13')](function(_0x20d670){logger[_0x13f6('0x21')](util['format']('['+_0x35ce7d[_0x13f6('0x22')]()+_0x13f6('0x66'),_0x1c60cc[_0x13f6('0x41')],_0x20d670[_0x13f6('0x4d')]));logger[_0x13f6('0x21')](util['format']('['+_0x35ce7d[_0x13f6('0x22')]()+_0x13f6('0x67'),_0x35ce7d));if(_0x35ce7d!=='unmanaged'&&_0x1c60cc[_0x13f6('0x68')]){logger[_0x13f6('0x21')]('['+_0x35ce7d[_0x13f6('0x22')]()+']',_0x13f6('0x69'));emit(_0x5ee864[_0x13f6('0xb')],_0x4a6f62['name'],_0x1c60cc[_0x13f6('0x41')],_0x20d670[_0x13f6('0x4d')]);}})['catch'](function(_0x40e8f8){logger[_0x13f6('0x16')]('['+_0x35ce7d[_0x13f6('0x22')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x40e8f8[_0x13f6('0x17')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x40e8f8);});}; \ No newline at end of file +var _0x50af=['indexOf','ticketType','incident','getString','Subjects','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','assign','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data5','POST','username','password','then','access_token','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','enduserId','telephone1','&$filter=','\x20eq\x20\x27','contactid','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','type','nameField','customField'];(function(_0x1ac121,_0x5d384b){var _0x47bf49=function(_0x2a901f){while(--_0x2a901f){_0x1ac121['push'](_0x1ac121['shift']());}};_0x47bf49(++_0x5d384b);}(_0x50af,0x85));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require('util');var intUtil=require(_0xf50a('0x0'));var md5=require(_0xf50a('0x1'));var Redis=require(_0xf50a('0x2'));var logger=require(_0xf50a('0x3'))(_0xf50a('0x4'));var config=require(_0xf50a('0x5'));config[_0xf50a('0x6')]=_[_0xf50a('0x7')](config[_0xf50a('0x6')],{'host':_0xf50a('0x8'),'port':0x18eb});var io=require(_0xf50a('0x9'))(new Redis(config['redis']));function getAuthToken(_0x42cccd,_0x30d473,_0x4df8ca){if(_0x42cccd[_0xf50a('0xa')]){_0x42cccd[_0xf50a('0xb')]=_0x42cccd[_0xf50a('0xc')][_0xf50a('0xd')];_0x42cccd['tenantId']=_0x42cccd[_0xf50a('0xc')]['data2'];return Promise['resolve'](_0x42cccd['CloudProvider'][_0xf50a('0xe')]);}var _0x7de4b8={'method':_0xf50a('0xf'),'uri':_0x30d473,'form':{'client_id':_0x42cccd['clientId'],'resource':_0x42cccd[_0xf50a('0xb')],'username':_0x42cccd[_0xf50a('0x10')],'password':_0x42cccd[_0xf50a('0x11')],'grant_type':_0xf50a('0x11'),'client_secret':_0x42cccd['clientSecret']},'json':!![]};return rp(_0x7de4b8)[_0xf50a('0x12')](function(_0x1df024){return _0x1df024[_0xf50a('0x13')];})[_0xf50a('0x14')](function(_0x22cf43){logger['error']('['+[_0x4df8ca[_0xf50a('0x15')]()]+']\x20Wrong\x20credentials!');return _0x22cf43[_0xf50a('0x16')];});}function getUser(_0xb75c72,_0x4a4037,_0x58f1f2,_0x5c8a20,_0x2b6348,_0x314ad5){return new Promise(function(_0x2bc514,_0x322113){return getAuthToken(_0x4a4037,_0x5c8a20,_0x314ad5)['then'](function(_0x3bd39e){var _0x1d38f6={'method':_0xf50a('0x17'),'uri':_0x2b6348+_0xf50a('0x18'),'headers':{'Authorization':_0xf50a('0x19')+_0x3bd39e,'OData-Version':_0xf50a('0x1a')},'json':!![]};return rp(_0x1d38f6);})['then'](function(_0x1b24a7){var _0x20f793=_0x1b24a7[_0xf50a('0x1b')];var _0xab358b=![];var _0x552672=null;if(!_[_0xf50a('0x1c')](_0x58f1f2)){if(intUtil[_0xf50a('0x1d')](_0x58f1f2[_0xf50a('0x1e')])){_0xb75c72['userEmail']=_0x58f1f2[_0xf50a('0x1e')];for(_0x552672=0x0;_0x552672<_0x20f793[_0xf50a('0x1f')];_0x552672++){if(_0x20f793[_0x552672][_0xf50a('0x20')]===_0x58f1f2[_0xf50a('0x1e')]&&!_0x20f793[_0x552672][_0xf50a('0x21')]){_0xab358b=!![];logger['info']('['+[_0x314ad5[_0xf50a('0x15')]()]+_0xf50a('0x22')+_0x20f793[_0x552672][_0xf50a('0x23')]+'!');_0xb75c72[_0xf50a('0x24')]=_0x20f793[_0x552672][_0xf50a('0x23')];}}}}if(!_0xab358b){logger['info']('['+[_0x314ad5[_0xf50a('0x15')]()]+_0xf50a('0x25'));_0xb75c72[_0xf50a('0x26')]=_0x4a4037['username'];for(_0x552672=0x0;_0x552672<_0x20f793['length'];_0x552672++){if(_0x20f793[_0x552672][_0xf50a('0x20')]===_0x4a4037[_0xf50a('0x10')]){_0xb75c72['userId']=_0x20f793[_0x552672][_0xf50a('0x23')];}}}_0x2bc514(_0xb75c72);})['catch'](function(_0x36e9d7){_0x322113(_0x36e9d7[_0xf50a('0x16')]);});});}function createEndUser(_0x32364d,_0xe65832,_0xbbdc00,_0x31d69b,_0x4d5254,_0x350f46,_0x520711){return new Promise(function(_0x4a5dce,_0x2586d3){return getAuthToken(_0xe65832,_0xbbdc00,_0x350f46)['then'](function(_0x1b9116){var _0x515197=_0x350f46[_0xf50a('0x27')]()===_0xf50a('0x28')?_0x4d5254[_0xf50a('0x29')]:_0x4d5254[_0xf50a('0x2a')];var _0x4df383={'method':'POST','uri':_0x31d69b+'contacts','body':{'fullname':_0x515197,'firstname':_0x515197,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf50a('0x2b')+_0x32364d[_0xf50a('0x24')]+')'},'headers':{'Authorization':_0xf50a('0x19')+_0x1b9116,'OData-Version':_0xf50a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x4df383[_0xf50a('0x2c')][_0x520711]=_0x515197;return rp(_0x4df383);})[_0xf50a('0x12')](function(_0x43477c){var _0x37dcf3=_0x43477c[_0xf50a('0x2d')][_0xf50a('0x2e')];var _0xee5b6=_0x37dcf3[_0xf50a('0x2f')](_0x37dcf3['lastIndexOf']('(')+0x1,_0x37dcf3['lastIndexOf'](')'));_0x32364d[_0xf50a('0x30')]=_0xee5b6;_0x4a5dce(_0x32364d);})[_0xf50a('0x14')](function(_0x34ab7c){_0x2586d3(_0x34ab7c['message']);});});}function getEndUser(_0x3fa709,_0x483ef3,_0x58d46a,_0x1ed3a1,_0x3f7a9f,_0x316348,_0x459b79,_0x4f6f86){var _0x51e89f=_0x316348['toLowerCase']()===_0xf50a('0x28')?_0x3f7a9f[_0xf50a('0x29')]:_0x3f7a9f[_0xf50a('0x2a')];return getAuthToken(_0x483ef3,_0x58d46a,_0x316348)[_0xf50a('0x12')](function(_0x290b5c){_0x4f6f86=_0x4f6f86?_0x4f6f86:_0xf50a('0x31');var _0x5c3c29={'method':'GET','uri':_0x1ed3a1+'contacts?$select='+_0x4f6f86+_0xf50a('0x32')+_0x4f6f86+_0xf50a('0x33')+_0x51e89f['replace']('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x290b5c,'If-None-Match':null,'OData-Version':_0xf50a('0x1a')},'json':!![]};return rp(_0x5c3c29);})[_0xf50a('0x12')](function(_0x42a860){var _0x299760=![];if(!_0x42a860)return _0x299760;var _0x33e21f=_0x42a860[_0xf50a('0x1b')];for(var _0x33af3b=0x0;_0x33af3b<_0x33e21f[_0xf50a('0x1f')];_0x33af3b++){if(_0x33e21f[_0x33af3b][_0x4f6f86]===_0x51e89f){_0x299760=!![];_0x3fa709[_0xf50a('0x30')]=_0x33e21f[_0x33af3b][_0xf50a('0x34')];}}return _0x299760;})['then'](function(_0x21279b){if(_0x21279b)return _0x3fa709;if(_0x459b79===_0xf50a('0x35')){logger[_0xf50a('0x36')]('['+[_0x316348['toUpperCase']()]+_0xf50a('0x37'));return _0x3fa709;}return createEndUser(_0x3fa709,_0x483ef3,_0x58d46a,_0x1ed3a1,_0x3f7a9f,_0x316348,_0x4f6f86)[_0xf50a('0x12')](function(_0x2991e7){logger[_0xf50a('0x36')]('['+[_0x316348[_0xf50a('0x15')]()]+']\x20Enduser\x20created!',_0x2991e7[_0xf50a('0x30')]);return _0x2991e7;});});}function getCustomFields(_0x3def10,_0x40bec6,_0x2ee4f7){var _0x4bf83f={};if(_0x3def10[_0xf50a('0x1f')]>0x0){_[_0xf50a('0x38')](_0x3def10,function(_0x1186a2){if(_['includes']([_0xf50a('0x39'),'picklist'],_0x1186a2[_0xf50a('0x3a')])&&_0x1186a2[_0xf50a('0x3b')]&&!_0x1186a2[_0xf50a('0x3c')]){var _0x33d9c7=_0x1186a2['idField']['toLowerCase']();var _0x765062=_0x33d9c7[_0xf50a('0x2f')](0x0,_0x33d9c7[_0xf50a('0x3d')]('_'));var _0x48c9b0=_0x33d9c7[_0xf50a('0x2f')](_0x33d9c7[_0xf50a('0x3d')]('_')+0x1);if(_0x765062===_0x2ee4f7){_0x4bf83f[_0x48c9b0]=_0x1186a2['content'];}}});}return _0x4bf83f;}function getTicket(_0xbd97d7,_0x2dafdb,_0x2bab5a,_0x4d4787,_0x502c38,_0x177230,_0x17e19d){return new Promise(function(_0x4a7f55,_0x29bb9d){var _0x57a00e;return getAuthToken(_0x2dafdb,_0x2bab5a,_0x17e19d)[_0xf50a('0x12')](function(_0x4a5ddd){if(_0x177230[_0xf50a('0x3e')]===_0xf50a('0x3f')){_0x57a00e={'method':_0xf50a('0xf'),'uri':_0x4d4787+'incidents','body':Object['assign']({},{'title':intUtil[_0xf50a('0x40')](_0x177230[_0xf50a('0x41')],_0x502c38,'\x20'),'description':intUtil[_0xf50a('0x40')](_0x177230[_0xf50a('0x42')],_0x502c38,'\x0a'),'customerid_contact@odata.bind':_0xbd97d7[_0xf50a('0x30')]?'/contacts('+_0xbd97d7[_0xf50a('0x30')]+')':undefined,'ownerid@odata.bind':_0xf50a('0x2b')+_0xbd97d7[_0xf50a('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x177230[_0xf50a('0x43')],_0x502c38,_0x177230[_0xf50a('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x4a5ddd,'OData-Version':_0xf50a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x177230[_0xf50a('0x3e')]===_0xf50a('0x44')){var _0x511736=_0xbd97d7[_0xf50a('0x30')]?[{'partyid_systemuser@odata.bind':_0xf50a('0x2b')+_0xbd97d7['userId']+')','participationtypemask':_0xbd97d7[_0xf50a('0x45')]===_0xf50a('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xf50a('0x47')+_0xbd97d7[_0xf50a('0x30')]+')','participationtypemask':_0xbd97d7[_0xf50a('0x45')]===_0xf50a('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf50a('0x2b')+_0xbd97d7['userId']+')','participationtypemask':_0xbd97d7[_0xf50a('0x45')]===_0xf50a('0x46')?0x2:0x1}];_0x57a00e={'method':_0xf50a('0xf'),'uri':_0x4d4787+'phonecalls','body':Object[_0xf50a('0x48')]({},{'subject':intUtil[_0xf50a('0x40')](_0x177230[_0xf50a('0x41')],_0x502c38,'\x20'),'phonenumber':String(_0x502c38[_0xf50a('0x2a')]),'description':intUtil[_0xf50a('0x40')](_0x177230[_0xf50a('0x42')],_0x502c38,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbd97d7['enduserId']?'/contacts('+_0xbd97d7[_0xf50a('0x30')]+')':undefined,'ownerid@odata.bind':_0xf50a('0x2b')+_0xbd97d7[_0xf50a('0x24')]+')','directioncode':_0xbd97d7[_0xf50a('0x45')]===_0xf50a('0x46')?![]:!![],'phonecall_activity_parties':_0x511736},getCustomFields(_0x177230[_0xf50a('0x43')],_0x502c38,_0x177230[_0xf50a('0x3e')])),'headers':{'Authorization':_0xf50a('0x19')+_0x4a5ddd,'OData-Version':_0xf50a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x57a00e);})[_0xf50a('0x12')](function(_0x4365bb){var _0x2d7caf=_0x4365bb[_0xf50a('0x2d')]['odata-entityid'];var _0x30896b=_0x2d7caf['substring'](_0x2d7caf['lastIndexOf']('(')+0x1,_0x2d7caf[_0xf50a('0x49')](')'));_0xbd97d7[_0xf50a('0x4a')]=_0x30896b;_0x4a7f55(_0xbd97d7);})[_0xf50a('0x14')](function(_0x5dff81){_0x29bb9d(_0x5dff81[_0xf50a('0x16')]);});});}function emit(_0x196335,_0x159901,_0xd8dba5,_0x15897b){var _0x82b694={'uri':util[_0xf50a('0x4b')](_0xf50a('0x4c'),_0x196335,_0xd8dba5,_0x15897b)};io['to'](util[_0xf50a('0x4b')]('user:%s',_0x159901))['emit'](_0xf50a('0x4d'),_0x82b694);}exports['cs']=function(_0x5232ad,_0x71a580,_0x3b16af,_0x1d8b04,_0x3406dd,_0x105453,_0x1e8d21,_0x27c066){var _0x2a77e9={};_0x105453['remoteUri']=_0x105453[_0xf50a('0xa')]?intUtil[_0xf50a('0x4e')](_0x105453[_0xf50a('0xc')]['data7']):intUtil[_0xf50a('0x4e')](_0x105453[_0xf50a('0xb')]);_0x105453[_0xf50a('0x4f')]=intUtil[_0xf50a('0x4e')](_0x105453[_0xf50a('0x4f')]);_0x2a77e9[_0xf50a('0x45')]=_0x27c066===_0xf50a('0x46')||_0x27c066===_0xf50a('0x50')?_0xf50a('0x46'):_0xf50a('0x28');var _0x294a2e=_0x105453['modernAuthentication']?util[_0xf50a('0x4b')]('%s/api/data/v9.0/',_0x105453[_0xf50a('0xc')]['data7']):util['format'](_0xf50a('0x51'),_0x105453['remoteUri']);var _0x2925fd=util[_0xf50a('0x4b')](_0xf50a('0x52'),_0x105453[_0xf50a('0x53')]);var _0xe6cf50=util[_0xf50a('0x4b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x105453[_0xf50a('0x4f')],_0x71a580[_0xf50a('0x54')],md5(_0x71a580['uniqueid']));if(_0x3406dd&&_0x3406dd['monitor_format']){logger[_0xf50a('0x36')]('[QUEUE]',_0xf50a('0x55'));_0x71a580['recordingURL']=_0xe6cf50;}else if(_0x1e8d21&&_0x1e8d21[_0xf50a('0x56')]&&_0x1e8d21[_0xf50a('0x56')]!=='none'){logger['info'](_0xf50a('0x57'),_0xf50a('0x55'));_0x71a580[_0xf50a('0x58')]=_0xe6cf50;}else{_0x71a580[_0xf50a('0x58')]='';}return getUser(_0x2a77e9,_0x105453,_0x1d8b04,_0x2925fd,_0x294a2e,_0x27c066)['then'](function(_0x3d920f){logger['info']('['+_0x27c066['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x3d920f['userId']);logger['info']('['+_0x27c066[_0xf50a('0x15')]()+']\x20The\x20User\x20email\x20is:',_0x3d920f['userEmail']);return getEndUser(_0x3d920f,_0x105453,_0x2925fd,_0x294a2e,_0x71a580,_0x27c066,_0x3b16af[_0xf50a('0x59')],_0x3b16af['additionalSearchContact']);})[_0xf50a('0x12')](function(_0x51d8e1){logger['info']('['+_0x27c066[_0xf50a('0x15')]()+_0xf50a('0x5a'),_0x51d8e1[_0xf50a('0x30')]);logger[_0xf50a('0x36')]('['+_0x27c066[_0xf50a('0x15')]()+_0xf50a('0x5b'),_0x71a580[_0xf50a('0x2a')]);return getTicket(_0x51d8e1,_0x105453,_0x2925fd,_0x294a2e,_0x71a580,_0x3b16af,_0x27c066);})[_0xf50a('0x12')](function(_0x1d0344){logger['info'](util[_0xf50a('0x4b')]('['+_0x27c066['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3b16af[_0xf50a('0x3e')],_0x1d0344[_0xf50a('0x4a')]));logger[_0xf50a('0x36')](util['format']('['+_0x27c066[_0xf50a('0x15')]()+']\x20Call\x20direction:\x20%s',_0x27c066));if(_0x27c066!==_0xf50a('0x50')&&_0x3b16af[_0xf50a('0x5c')]){logger['info']('['+_0x27c066[_0xf50a('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x105453['remoteUri'],_0x1d8b04[_0xf50a('0x5d')],_0x3b16af['ticketType'],_0x1d0344['ticketId']);}})['catch'](function(_0x349346){logger[_0xf50a('0x5e')]('['+_0x27c066[_0xf50a('0x15')]()+_0xf50a('0x5f'),_0x349346[_0xf50a('0x16')]);console[_0xf50a('0x5e')](_0xf50a('0x60'),_0x349346);});}; \ 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 7f4e523..97a6785 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 _0xf7aa=['md5','util','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','customField','nameField','toLowerCase','content','toString','includes','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','trigger:browser:url','catch','toUpperCase','lastevent','lodash','request-promise'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xf7aa,0x1d4));var _0xaf7a=function(_0x146b91,_0x339fb2){_0x146b91=_0x146b91-0x0;var _0x55f7a3=_0xf7aa[_0x146b91];return _0x55f7a3;};'use strict';var _=require(_0xaf7a('0x0'));var rp=require(_0xaf7a('0x1'));var md5=require(_0xaf7a('0x2'));var util=require(_0xaf7a('0x3'));var Redis=require('ioredis');var intUtil=require(_0xaf7a('0x4'));var config=require('../../../../config/environment');var logger=require(_0xaf7a('0x5'))('freshdesk');config[_0xaf7a('0x6')]=_[_0xaf7a('0x7')](config[_0xaf7a('0x6')],{'host':_0xaf7a('0x8'),'port':0x18eb});var io=require(_0xaf7a('0x9'))(new Redis(config[_0xaf7a('0x6')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x191ddd,_0x3430be,_0x3ff6c0){io['to'](_0x191ddd)[_0xaf7a('0xa')](_0x3430be,_0x3ff6c0);}function getTicket(_0x1125a0,_0x19e91b,_0x21c39f,_0x51e410,_0x41fd80){logger[_0xaf7a('0xb')](_0xaf7a('0xc'));var _0x36e38e=_[_0xaf7a('0xd')]({'responder_id':_0x19e91b['id'],'requester_id':_0x21c39f['id'],'name':util[_0xaf7a('0xe')]('Caller\x20-\x20%s',_0x41fd80['calleridname']),'phone':_0x41fd80['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xaf7a('0xf')](_0x51e410[_0xaf7a('0x10')],_0x41fd80,'\x20'),'description':intUtil[_0xaf7a('0xf')](_0x51e410[_0xaf7a('0x11')],_0x41fd80,_0xaf7a('0x12')),'tags':getTags(_0x51e410['Tags'],_0xaf7a('0x13'))},getCustomFields(_0x51e410[_0xaf7a('0x14')],_0x41fd80));_0x36e38e[_0xaf7a('0x15')]=_[_0xaf7a('0x16')](_[_0xaf7a('0x17')](_0x36e38e[_0xaf7a('0x15')],'id'),_0xaf7a('0x18'));return request({'uri':util[_0xaf7a('0xe')](_0xaf7a('0x19'),_0x1125a0[_0xaf7a('0x1a')]),'method':'POST','body':_0x36e38e})['then'](function(_0x3685a1){logger[_0xaf7a('0xb')](_0xaf7a('0x1b'));return _0x3685a1;});}function getUser(_0x2bcac4,_0xe62635){if(intUtil[_0xaf7a('0x1c')](_0xe62635)){return request({'uri':util['format'](_0xaf7a('0x1d'),_0x2bcac4[_0xaf7a('0x1a')]),'qs':{'email':_0xe62635}})[_0xaf7a('0x1e')](function(_0x5651b4){if(_0x5651b4[_0xaf7a('0x1f')]){logger[_0xaf7a('0xb')](_0xaf7a('0x20'));return _[_0xaf7a('0x21')](_0x5651b4,function(_0x15a2d7){return _0x15a2d7[_0xaf7a('0x22')][_0xaf7a('0x23')]===_0xe62635;});}else{logger[_0xaf7a('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaf7a('0xe')](_0xaf7a('0x24'),_0x2bcac4['remoteUri'])})[_0xaf7a('0x1e')](function(_0xe7810f){logger[_0xaf7a('0xb')](_0xaf7a('0x25'));return _0xe7810f;});}});}else{logger[_0xaf7a('0xb')](_0xaf7a('0x26'));return request({'uri':util[_0xaf7a('0xe')]('%s/api/v2/agents/me',_0x2bcac4[_0xaf7a('0x1a')])})[_0xaf7a('0x1e')](function(_0x56511f){logger[_0xaf7a('0xb')]('Admin\x20account\x20selected.');return _0x56511f;});}}function getEndUser(_0x4362d9,_0x5bc98a,_0x4eda6f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4eda6f);return request({'uri':util[_0xaf7a('0xe')](_0xaf7a('0x27'),_0x4362d9[_0xaf7a('0x1a')]),'qs':{'phone':_0x4eda6f}})[_0xaf7a('0x1e')](function(_0x5ad7b2){if(_0x5ad7b2['length']){logger[_0xaf7a('0xb')](_0xaf7a('0x28'));return _[_0xaf7a('0x21')](_0x5ad7b2,{'phone':_0x4eda6f});}else{logger[_0xaf7a('0xb')](_0xaf7a('0x29'));return request({'uri':util[_0xaf7a('0xe')]('%s/api/v2/contacts',_0x4362d9[_0xaf7a('0x1a')]),'method':'POST','body':{'name':_0x5bc98a,'phone':_0x4eda6f}})[_0xaf7a('0x1e')](function(_0x1ace69){logger[_0xaf7a('0xb')](_0xaf7a('0x2a'));return _0x1ace69;});}});}function getAuth(_0xa857b){return util[_0xaf7a('0xe')](_0xaf7a('0x2b'),new Buffer(_0xa857b[_0xaf7a('0x2c')]+':X')['toString'](_0xaf7a('0x2d')));}function request(_0x39d618){logger[_0xaf7a('0x2e')](_0xaf7a('0x2f'),JSON[_0xaf7a('0x30')](_0x39d618));return rp(_['defaults'](_0x39d618,{'method':_0xaf7a('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x3f8841,_0x42de9b){var _0x47727a=[];if(_0x3f8841&&_0x3f8841[_0xaf7a('0x1f')]>0x0){_0x47727a=_[_0xaf7a('0x32')](_0x3f8841,_0x42de9b);}return _0x47727a;}function getCustomFields(_0x3b454f,_0x3267f8){var _0x4f0421=[];var _0x2e1554={'custom_fields':[]};if(_0x3b454f['length']>0x0){_[_0xaf7a('0x33')](_0x3b454f,function(_0x1c07ed){if(_['includes']([_0xaf7a('0x34'),_0xaf7a('0x35')],_0x1c07ed[_0xaf7a('0x36')])&&_0x1c07ed['nameField']&&!_0x1c07ed[_0xaf7a('0x37')]){_0x2e1554[_0x1c07ed[_0xaf7a('0x38')][_0xaf7a('0x39')]()]=_0x1c07ed[_0xaf7a('0x3a')][_0xaf7a('0x3b')]();}else if(_[_0xaf7a('0x3c')](['string',_0xaf7a('0x35')],_0x1c07ed['type'])&&_0x1c07ed[_0xaf7a('0x3d')]&&_0x1c07ed[_0xaf7a('0x37')]){_0x2e1554[_0xaf7a('0x15')][_0xaf7a('0x3e')]({'id':_0x1c07ed[_0xaf7a('0x3d')],'value':_0x1c07ed[_0xaf7a('0x3a')][_0xaf7a('0x3b')]()});}else if(_0x1c07ed['type']===_0xaf7a('0x3f')&&_0x1c07ed[_0xaf7a('0x40')]&&_0x1c07ed[_0xaf7a('0x3d')]&&_0x1c07ed[_0xaf7a('0x37')]){_0x3267f8[_0x1c07ed[_0xaf7a('0x40')]]&&_0x2e1554['custom_fields'][_0xaf7a('0x3e')]({'id':_0x1c07ed[_0xaf7a('0x3d')],'value':_0x3267f8[_0x1c07ed[_0xaf7a('0x40')]][_0xaf7a('0x3b')]()});}else if(_0x1c07ed['type']===_0xaf7a('0x41')&&_0x1c07ed[_0xaf7a('0x42')]&&_0x1c07ed[_0xaf7a('0x42')][_0xaf7a('0x13')]&&_0x1c07ed[_0xaf7a('0x3d')]&&_0x1c07ed['customField']){_0x3267f8[_0x1c07ed[_0xaf7a('0x42')][_0xaf7a('0x13')][_0xaf7a('0x39')]()]&&_0x2e1554[_0xaf7a('0x15')][_0xaf7a('0x3e')]({'id':_0x1c07ed[_0xaf7a('0x3d')],'value':_0x3267f8[_0x1c07ed[_0xaf7a('0x42')]['name'][_0xaf7a('0x39')]()]['toString']()});}});}return _0x2e1554;}exports[_0xaf7a('0x43')]=function(_0x3c0808,_0x1628cd,_0x4523ca,_0x281fd8,_0x5eb0a5,_0x3848bd){var _0x53b4e5,_0x5a37e1;_0x3848bd[_0xaf7a('0x1a')]=intUtil[_0xaf7a('0x44')](_0x3848bd['remoteUri']);_0x3848bd[_0xaf7a('0x45')]=intUtil[_0xaf7a('0x44')](_0x3848bd[_0xaf7a('0x45')]);if(_0x5eb0a5&&_0x5eb0a5[_0xaf7a('0x46')]){logger[_0xaf7a('0xb')]('[QUEUE]',_0xaf7a('0x47'));_0x1628cd[_0xaf7a('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3848bd['serverUrl'],_0x1628cd[_0xaf7a('0x49')],md5(_0x1628cd[_0xaf7a('0x49')]));}else{_0x1628cd[_0xaf7a('0x48')]='';}headers['Authorization']=getAuth(_0x3848bd);return getUser(_0x3848bd,_0x281fd8[_0xaf7a('0x23')])[_0xaf7a('0x1e')](function(_0xd86cf2){_0x53b4e5=_0xd86cf2;logger[_0xaf7a('0xb')](_0xaf7a('0x4a'),_0x53b4e5['id']);return getEndUser(_0x3848bd,_0x1628cd[_0xaf7a('0x4b')],_0x1628cd[_0xaf7a('0x4c')]);})[_0xaf7a('0x1e')](function(_0x34ef15){_0x5a37e1=_0x34ef15;logger[_0xaf7a('0xb')](_0xaf7a('0x4d'),_0x5a37e1['id']);return getTicket(_0x3848bd,_0x53b4e5,_0x5a37e1,_0x4523ca,_0x1628cd);})['then'](function(_0x3273bd){if(_0x3273bd&&_0x3273bd['id']){logger[_0xaf7a('0xb')](_0xaf7a('0x1b'));logger[_0xaf7a('0xb')](_0xaf7a('0x4e'),_0x3273bd['id']);logger['info'](_0xaf7a('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaf7a('0xe')](_0xaf7a('0x50'),_0x281fd8[_0xaf7a('0x13')]),'trigger:browser:url',{'uri':util[_0xaf7a('0xe')](_0xaf7a('0x51'),_0x3848bd[_0xaf7a('0x1a')],_0x3273bd['id'])});}})['catch'](function(_0x181ab1){logger[_0xaf7a('0x52')](_0xaf7a('0x4f'),JSON[_0xaf7a('0x30')](_0x181ab1));});};exports[_0xaf7a('0x53')]=function(_0x5996ec,_0x136eb4,_0x4382f3,_0x35da4c,_0x3a6b43,_0x5b532a,_0x38d4a4){var _0x1008e0,_0x5a810a;_0x5b532a[_0xaf7a('0x1a')]=intUtil['stripTrailingSlash'](_0x5b532a['remoteUri']);_0x5b532a[_0xaf7a('0x45')]=intUtil[_0xaf7a('0x44')](_0x5b532a[_0xaf7a('0x45')]);if(_0x38d4a4&&_0x38d4a4[_0xaf7a('0x54')]&&_0x38d4a4[_0xaf7a('0x54')]!==_0xaf7a('0x55')){logger[_0xaf7a('0xb')](_0xaf7a('0x56'),'Recording\x20is\x20enabled!');_0x136eb4[_0xaf7a('0x48')]=util['format'](_0xaf7a('0x57'),_0x5b532a[_0xaf7a('0x45')],_0x136eb4[_0xaf7a('0x49')],md5(_0x136eb4[_0xaf7a('0x49')]));}headers[_0xaf7a('0x58')]=getAuth(_0x5b532a);return getUser(_0x5b532a,_0x35da4c[_0xaf7a('0x23')])[_0xaf7a('0x1e')](function(_0x31b158){_0x1008e0=_0x31b158;logger[_0xaf7a('0xb')](_0xaf7a('0x4a'),_0x1008e0['id']);return getEndUser(_0x5b532a,_0x136eb4['destcalleridname'],_0x136eb4[_0xaf7a('0x59')]);})[_0xaf7a('0x1e')](function(_0x2ef53e){_0x5a810a=_0x2ef53e;logger[_0xaf7a('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5a810a['id']);return getTicket(_0x5b532a,_0x1008e0,_0x5a810a,_0x4382f3,_0x136eb4);})[_0xaf7a('0x1e')](function(_0x27ffd0){if(_0x27ffd0&&_0x27ffd0['id']){logger['info'](_0xaf7a('0x1b'));logger['info'](_0xaf7a('0x4e'),_0x27ffd0['id']);logger[_0xaf7a('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaf7a('0xe')](_0xaf7a('0x50'),_0x35da4c['name']),_0xaf7a('0x5a'),{'uri':util[_0xaf7a('0xe')](_0xaf7a('0x51'),_0x5b532a[_0xaf7a('0x1a')],_0x27ffd0['id'])});}})[_0xaf7a('0x5b')](function(_0x3a4c76){logger[_0xaf7a('0x52')](_0xaf7a('0x56'),JSON[_0xaf7a('0x30')](_0x3a4c76));});};exports['unmanaged']=function(_0x3278cd,_0x258ad4,_0x4110c0,_0x5b983d,_0x4aedef,_0x5b367a){var _0x4e4c10,_0x529fd6;_0x5b367a['remoteUri']=intUtil[_0xaf7a('0x44')](_0x5b367a[_0xaf7a('0x1a')]);_0x5b367a[_0xaf7a('0x45')]=intUtil[_0xaf7a('0x44')](_0x5b367a[_0xaf7a('0x45')]);if(_0x4aedef&&_0x4aedef[_0xaf7a('0x46')]){logger[_0xaf7a('0xb')]('['+_0x258ad4['lastevent'][_0xaf7a('0x5c')]()+']',_0xaf7a('0x47'));_0x258ad4[_0xaf7a('0x48')]=util[_0xaf7a('0xe')](_0xaf7a('0x57'),_0x5b367a[_0xaf7a('0x45')],_0x258ad4[_0xaf7a('0x49')],md5(_0x258ad4[_0xaf7a('0x49')]));}else{_0x258ad4[_0xaf7a('0x48')]='';}headers['Authorization']=getAuth(_0x5b367a);return getUser(_0x5b367a,'')[_0xaf7a('0x1e')](function(_0x4268c4){_0x4e4c10=_0x4268c4;logger[_0xaf7a('0xb')]('The\x20User\x20ID\x20is:',_0x4e4c10['id']);return getEndUser(_0x5b367a,_0x258ad4[_0xaf7a('0x4b')],_0x258ad4[_0xaf7a('0x4c')]);})[_0xaf7a('0x1e')](function(_0x5b23be){_0x529fd6=_0x5b23be;logger['info'](_0xaf7a('0x4d'),_0x529fd6['id']);return getTicket(_0x5b367a,_0x4e4c10,_0x529fd6,_0x4110c0,_0x258ad4);})['then'](function(_0x1c8626){if(_0x1c8626){logger[_0xaf7a('0xb')]('Ticket\x20created!');logger[_0xaf7a('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1c8626['id']);}})['catch'](function(_0x1c3edc){logger[_0xaf7a('0x52')]('['+_0x258ad4[_0xaf7a('0x5d')][_0xaf7a('0x5c')]()+']',JSON[_0xaf7a('0x30')](_0x1c3edc));});}; \ No newline at end of file +var _0x906b=['Variable','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','stripTrailingSlash','serverUrl','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','The\x20Enduser\x20ID\x20is:','trigger:browser:url','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','push','variableName','customVariable'];(function(_0x1b5dac,_0xcb846e){var _0x233383=function(_0x1a014){while(--_0x1a014){_0x1b5dac['push'](_0x1b5dac['shift']());}};_0x233383(++_0xcb846e);}(_0x906b,0x1e2));var _0xb906=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x906b[_0x5d1044];return _0x3cd90e;};'use strict';var _=require(_0xb906('0x0'));var rp=require('request-promise');var md5=require(_0xb906('0x1'));var util=require(_0xb906('0x2'));var Redis=require(_0xb906('0x3'));var intUtil=require(_0xb906('0x4'));var config=require(_0xb906('0x5'));var logger=require(_0xb906('0x6'))(_0xb906('0x7'));config[_0xb906('0x8')]=_[_0xb906('0x9')](config[_0xb906('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xb906('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xb906('0xb')};function emit(_0x5e391b,_0x41bdf4,_0x4445e0){io['to'](_0x5e391b)[_0xb906('0xc')](_0x41bdf4,_0x4445e0);}function getTicket(_0xbee842,_0x188a96,_0x288c88,_0x3ef520,_0x4016a8){logger[_0xb906('0xd')](_0xb906('0xe'));var _0x9c73d=_[_0xb906('0xf')]({'responder_id':_0x188a96['id'],'requester_id':_0x288c88['id'],'name':util[_0xb906('0x10')]('Caller\x20-\x20%s',_0x4016a8[_0xb906('0x11')]),'phone':_0x4016a8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb906('0x12')](_0x3ef520['Subjects'],_0x4016a8,'\x20'),'description':intUtil[_0xb906('0x12')](_0x3ef520[_0xb906('0x13')],_0x4016a8,_0xb906('0x14')),'tags':getTags(_0x3ef520[_0xb906('0x15')],_0xb906('0x16'))},getCustomFields(_0x3ef520[_0xb906('0x17')],_0x4016a8));_0x9c73d['custom_fields']=_[_0xb906('0x18')](_[_0xb906('0x19')](_0x9c73d[_0xb906('0x1a')],'id'),'value');return request({'uri':util['format'](_0xb906('0x1b'),_0xbee842[_0xb906('0x1c')]),'method':_0xb906('0x1d'),'body':_0x9c73d})[_0xb906('0x1e')](function(_0x410f18){logger[_0xb906('0xd')](_0xb906('0x1f'));return _0x410f18;});}function getUser(_0x1227eb,_0x42e232){if(intUtil[_0xb906('0x20')](_0x42e232)){return request({'uri':util['format']('%s/api/v2/agents',_0x1227eb[_0xb906('0x1c')]),'qs':{'email':_0x42e232}})[_0xb906('0x1e')](function(_0xd0ec21){if(_0xd0ec21[_0xb906('0x21')]){logger['info'](_0xb906('0x22'));return _[_0xb906('0x23')](_0xd0ec21,function(_0x1ab750){return _0x1ab750[_0xb906('0x24')][_0xb906('0x25')]===_0x42e232;});}else{logger[_0xb906('0xd')](_0xb906('0x26'));return request({'uri':util[_0xb906('0x10')]('%s/api/v2/agents/me',_0x1227eb[_0xb906('0x1c')])})[_0xb906('0x1e')](function(_0x4d9249){logger[_0xb906('0xd')]('Admin\x20account\x20selected.');return _0x4d9249;});}});}else{logger['info'](_0xb906('0x27'));return request({'uri':util[_0xb906('0x10')](_0xb906('0x28'),_0x1227eb[_0xb906('0x1c')])})[_0xb906('0x1e')](function(_0x55d5c9){logger[_0xb906('0xd')]('Admin\x20account\x20selected.');return _0x55d5c9;});}}function getEndUser(_0x5278fd,_0x400df0,_0x429022){logger[_0xb906('0xd')]('Searching\x20enduser\x20with\x20phone',_0x429022);return request({'uri':util[_0xb906('0x10')](_0xb906('0x29'),_0x5278fd[_0xb906('0x1c')]),'qs':{'phone':_0x429022}})[_0xb906('0x1e')](function(_0x4542ab){if(_0x4542ab[_0xb906('0x21')]){logger[_0xb906('0xd')]('Enduser\x20found!');return _[_0xb906('0x23')](_0x4542ab,{'phone':_0x429022});}else{logger[_0xb906('0xd')](_0xb906('0x2a'));return request({'uri':util[_0xb906('0x10')](_0xb906('0x29'),_0x5278fd['remoteUri']),'method':_0xb906('0x1d'),'body':{'name':_0x400df0,'phone':_0x429022}})[_0xb906('0x1e')](function(_0xd13c2f){logger[_0xb906('0xd')]('Enduser\x20created.');return _0xd13c2f;});}});}function getAuth(_0x1e16ba){return util['format'](_0xb906('0x2b'),new Buffer(_0x1e16ba[_0xb906('0x2c')]+':X')[_0xb906('0x2d')](_0xb906('0x2e')));}function request(_0x40d210){logger[_0xb906('0x2f')](_0xb906('0x30'),JSON[_0xb906('0x31')](_0x40d210));return rp(_['defaults'](_0x40d210,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x19a195,_0x275a9d){var _0x1a7bea=[];if(_0x19a195&&_0x19a195[_0xb906('0x21')]>0x0){_0x1a7bea=_[_0xb906('0x32')](_0x19a195,_0x275a9d);}return _0x1a7bea;}function getCustomFields(_0x384409,_0x49d5a5){var _0x39f568=[];var _0x5a31af={'custom_fields':[]};if(_0x384409['length']>0x0){_[_0xb906('0x33')](_0x384409,function(_0x2a5343){if(_['includes']([_0xb906('0x34'),_0xb906('0x35')],_0x2a5343[_0xb906('0x36')])&&_0x2a5343[_0xb906('0x37')]&&!_0x2a5343[_0xb906('0x38')]){_0x5a31af[_0x2a5343['nameField'][_0xb906('0x39')]()]=_0x2a5343[_0xb906('0x3a')][_0xb906('0x2d')]();}else if(_[_0xb906('0x3b')](['string','picklist'],_0x2a5343['type'])&&_0x2a5343[_0xb906('0x3c')]&&_0x2a5343[_0xb906('0x38')]){_0x5a31af[_0xb906('0x1a')][_0xb906('0x3d')]({'id':_0x2a5343[_0xb906('0x3c')],'value':_0x2a5343[_0xb906('0x3a')][_0xb906('0x2d')]()});}else if(_0x2a5343[_0xb906('0x36')]==='variable'&&_0x2a5343[_0xb906('0x3e')]&&_0x2a5343[_0xb906('0x3c')]&&_0x2a5343['customField']){_0x49d5a5[_0x2a5343['variableName']]&&_0x5a31af[_0xb906('0x1a')][_0xb906('0x3d')]({'id':_0x2a5343[_0xb906('0x3c')],'value':_0x49d5a5[_0x2a5343[_0xb906('0x3e')]][_0xb906('0x2d')]()});}else if(_0x2a5343[_0xb906('0x36')]===_0xb906('0x3f')&&_0x2a5343[_0xb906('0x40')]&&_0x2a5343['Variable'][_0xb906('0x16')]&&_0x2a5343[_0xb906('0x3c')]&&_0x2a5343[_0xb906('0x38')]){_0x49d5a5[_0x2a5343[_0xb906('0x40')][_0xb906('0x16')]['toLowerCase']()]&&_0x5a31af[_0xb906('0x1a')]['push']({'id':_0x2a5343[_0xb906('0x3c')],'value':_0x49d5a5[_0x2a5343[_0xb906('0x40')][_0xb906('0x16')][_0xb906('0x39')]()][_0xb906('0x2d')]()});}});}return _0x5a31af;}exports[_0xb906('0x41')]=function(_0x32beff,_0x31eb30,_0x51bc71,_0x31e09c,_0x547732,_0x70e1f6){var _0x2d9b91,_0xa72873;_0x70e1f6[_0xb906('0x1c')]=intUtil['stripTrailingSlash'](_0x70e1f6[_0xb906('0x1c')]);_0x70e1f6['serverUrl']=intUtil['stripTrailingSlash'](_0x70e1f6['serverUrl']);if(_0x547732&&_0x547732[_0xb906('0x42')]){logger[_0xb906('0xd')](_0xb906('0x43'),_0xb906('0x44'));_0x31eb30['recordingURL']=util[_0xb906('0x10')](_0xb906('0x45'),_0x70e1f6['serverUrl'],_0x31eb30[_0xb906('0x46')],md5(_0x31eb30[_0xb906('0x46')]));}else{_0x31eb30['recordingURL']='';}headers[_0xb906('0x47')]=getAuth(_0x70e1f6);return getUser(_0x70e1f6,_0x31e09c[_0xb906('0x25')])[_0xb906('0x1e')](function(_0x38b7f8){_0x2d9b91=_0x38b7f8;logger[_0xb906('0xd')](_0xb906('0x48'),_0x2d9b91['id']);return getEndUser(_0x70e1f6,_0x31eb30['calleridname'],_0x31eb30[_0xb906('0x49')]);})[_0xb906('0x1e')](function(_0xf3dbd7){_0xa72873=_0xf3dbd7;logger[_0xb906('0xd')]('The\x20Enduser\x20ID\x20is:',_0xa72873['id']);return getTicket(_0x70e1f6,_0x2d9b91,_0xa72873,_0x51bc71,_0x31eb30);})[_0xb906('0x1e')](function(_0x4be1ea){if(_0x4be1ea&&_0x4be1ea['id']){logger[_0xb906('0xd')](_0xb906('0x1f'));logger[_0xb906('0xd')](_0xb906('0x4a'),_0x4be1ea['id']);logger[_0xb906('0xd')]('[QUEUE]',_0xb906('0x4b'));emit(util['format'](_0xb906('0x4c'),_0x31e09c['name']),'trigger:browser:url',{'uri':util['format'](_0xb906('0x4d'),_0x70e1f6[_0xb906('0x1c')],_0x4be1ea['id'])});}})[_0xb906('0x4e')](function(_0x14b2f1){logger[_0xb906('0x4f')](_0xb906('0x43'),JSON[_0xb906('0x31')](_0x14b2f1));});};exports['outbound']=function(_0x347c16,_0x307691,_0x281783,_0x28a3e5,_0xad6467,_0x1b801c,_0x2f6fe6){var _0x455205,_0x4b2061;_0x1b801c['remoteUri']=intUtil[_0xb906('0x50')](_0x1b801c[_0xb906('0x1c')]);_0x1b801c[_0xb906('0x51')]=intUtil[_0xb906('0x50')](_0x1b801c[_0xb906('0x51')]);if(_0x2f6fe6&&_0x2f6fe6['recordingFormat']&&_0x2f6fe6[_0xb906('0x52')]!==_0xb906('0x53')){logger['info'](_0xb906('0x54'),_0xb906('0x44'));_0x307691[_0xb906('0x55')]=util[_0xb906('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b801c[_0xb906('0x51')],_0x307691[_0xb906('0x46')],md5(_0x307691['uniqueid']));}headers[_0xb906('0x47')]=getAuth(_0x1b801c);return getUser(_0x1b801c,_0x28a3e5['email'])['then'](function(_0x26ab49){_0x455205=_0x26ab49;logger[_0xb906('0xd')]('The\x20User\x20ID\x20is:',_0x455205['id']);return getEndUser(_0x1b801c,_0x307691[_0xb906('0x56')],_0x307691['destcalleridnum']);})[_0xb906('0x1e')](function(_0x359dca){_0x4b2061=_0x359dca;logger['info'](_0xb906('0x57'),_0x4b2061['id']);return getTicket(_0x1b801c,_0x455205,_0x4b2061,_0x281783,_0x307691);})[_0xb906('0x1e')](function(_0x38d61c){if(_0x38d61c&&_0x38d61c['id']){logger['info'](_0xb906('0x1f'));logger[_0xb906('0xd')](_0xb906('0x4a'),_0x38d61c['id']);logger['info'](_0xb906('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb906('0x4c'),_0x28a3e5[_0xb906('0x16')]),_0xb906('0x58'),{'uri':util[_0xb906('0x10')](_0xb906('0x4d'),_0x1b801c['remoteUri'],_0x38d61c['id'])});}})[_0xb906('0x4e')](function(_0x31ec9d){logger['error'](_0xb906('0x54'),JSON['stringify'](_0x31ec9d));});};exports['unmanaged']=function(_0x421bc2,_0x2baf8b,_0x21f5b6,_0x5a7e48,_0x260c42,_0x5ed247){var _0x30ef24,_0xf6fd8e;_0x5ed247[_0xb906('0x1c')]=intUtil[_0xb906('0x50')](_0x5ed247[_0xb906('0x1c')]);_0x5ed247[_0xb906('0x51')]=intUtil[_0xb906('0x50')](_0x5ed247[_0xb906('0x51')]);if(_0x260c42&&_0x260c42[_0xb906('0x42')]){logger[_0xb906('0xd')]('['+_0x2baf8b[_0xb906('0x59')][_0xb906('0x5a')]()+']','Recording\x20is\x20enabled!');_0x2baf8b[_0xb906('0x55')]=util[_0xb906('0x10')](_0xb906('0x45'),_0x5ed247[_0xb906('0x51')],_0x2baf8b[_0xb906('0x46')],md5(_0x2baf8b[_0xb906('0x46')]));}else{_0x2baf8b[_0xb906('0x55')]='';}headers[_0xb906('0x47')]=getAuth(_0x5ed247);return getUser(_0x5ed247,'')[_0xb906('0x1e')](function(_0x2dc784){_0x30ef24=_0x2dc784;logger[_0xb906('0xd')](_0xb906('0x48'),_0x30ef24['id']);return getEndUser(_0x5ed247,_0x2baf8b[_0xb906('0x11')],_0x2baf8b[_0xb906('0x49')]);})[_0xb906('0x1e')](function(_0x434368){_0xf6fd8e=_0x434368;logger['info'](_0xb906('0x57'),_0xf6fd8e['id']);return getTicket(_0x5ed247,_0x30ef24,_0xf6fd8e,_0x21f5b6,_0x2baf8b);})[_0xb906('0x1e')](function(_0x134ae3){if(_0x134ae3){logger[_0xb906('0xd')](_0xb906('0x1f'));logger[_0xb906('0xd')]('The\x20Ticket\x20ID\x20is:',_0x134ae3['id']);}})[_0xb906('0x4e')](function(_0xdd3cdb){logger[_0xb906('0x4f')]('['+_0x2baf8b[_0xb906('0x59')]['toUpperCase']()+']',JSON[_0xb906('0x31')](_0xdd3cdb));});}; \ 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 9bd87af..de5c7a5 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 _0x35b0=['endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','ticketId','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','users','Getting\x20user\x20with\x20email','agentEmail','email','User\x20found:','userId','Admin\x20selected','userEmail','adminEmail','GET','/api/lookup?q=','&f=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0x35b0,0x11e));var _0x035b=function(_0x575fd2,_0x48ba11){_0x575fd2=_0x575fd2-0x0;var _0x1bfd4f=_0x35b0[_0x575fd2];return _0x1bfd4f;};'use strict';var _=require(_0x035b('0x0'));var rp=require(_0x035b('0x1'));var md5=require('md5');var util=require(_0x035b('0x2'));var moment=require(_0x035b('0x3'));var Promise=require(_0x035b('0x4'));var Redis=require(_0x035b('0x5'));var intUtil=require(_0x035b('0x6'));var config=require(_0x035b('0x7'));var logger=require(_0x035b('0x8'))('freshsales');config[_0x035b('0x9')]=_['defaults'](config[_0x035b('0x9')],{'host':_0x035b('0xa'),'port':0x18eb});var io=require(_0x035b('0xb'))(new Redis(config['redis']));function getAdminId(_0x4c6de1,_0xdeaaf,_0x50a80c,_0x510301){return new Promise(function(_0x5b31f9,_0x45ea9f){var _0x160bec=![];var _0x375687={'method':'GET','uri':_0x510301+_0x035b('0xc'),'json':!![]};_0x375687[_0x035b('0xd')]=_0x50a80c;logger[_0x035b('0xe')](_0x035b('0xf'));return rp(_0x375687)[_0x035b('0x10')](function(_0x26004a){if(_0x26004a){var _0x2bf0c3=_0x26004a['users'];var _0x6aaece=null;for(_0x6aaece=0x0;_0x6aaece<_0x2bf0c3[_0x035b('0x11')];_0x6aaece++){if(_0x2bf0c3[_0x6aaece]['email']===_0x4c6de1['adminEmail']){_0x4c6de1[_0x035b('0x12')]=_0x2bf0c3[_0x6aaece]['id'];_0x160bec=!![];}}if(_0x160bec){logger[_0x035b('0xe')](_0x035b('0x13'),_0x4c6de1['adminId']);_0x5b31f9(_0x4c6de1);}else{_0x45ea9f({'statusCode':0x194,'message':_0x035b('0x14')});}}else{_0x45ea9f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x035b('0x15')](function(_0x140ce5){logger[_0x035b('0x16')]('['+[_0xdeaaf[_0x035b('0x17')]()]+']',_0x140ce5[_0x035b('0x18')]);_0x45ea9f(_0x140ce5);});});}function getUser(_0x5d575b,_0x1e030b,_0x4f7cd6){return function(_0x4f5c34){return new Promise(function(_0x15c353,_0x3a21c6){var _0x3ac1f8={'method':'GET','uri':_0x4f7cd6+_0x035b('0xc'),'json':!![]};_0x3ac1f8[_0x035b('0xd')]=_0x1e030b;logger[_0x035b('0xe')]('Getting\x20user\x20list');return rp(_0x3ac1f8)[_0x035b('0x10')](function(_0x1590dc){if(_0x1590dc){var _0x3f96f2=_0x1590dc[_0x035b('0x19')];var _0x4744a9=![];var _0x56bb8b=null;if(_0x4f5c34['agentEmail']!==null){logger[_0x035b('0xe')](_0x035b('0x1a'),_0x4f5c34[_0x035b('0x1b')]);_0x4f5c34['userEmail']=_0x4f5c34[_0x035b('0x1b')];for(_0x56bb8b=0x0;_0x56bb8b<_0x3f96f2[_0x035b('0x11')];_0x56bb8b++){if(_0x3f96f2[_0x56bb8b][_0x035b('0x1c')]===_0x4f5c34[_0x035b('0x1b')]){_0x4744a9=!![];_0x4f5c34['userId']=_0x3f96f2[_0x56bb8b]['id'];logger['info'](_0x035b('0x1d'),_0x4f5c34[_0x035b('0x1e')]);}}}if(!_0x4744a9){logger['info'](_0x035b('0x1f'));_0x4f5c34[_0x035b('0x20')]=_0x4f5c34[_0x035b('0x21')];_0x4f5c34[_0x035b('0x1e')]=_0x4f5c34[_0x035b('0x12')];_0x4744a9=!![];}if(_0x4744a9){_0x15c353(_0x4f5c34);}else{_0x3a21c6({'statusCode':0x194,'message':_0x035b('0x14')});}}else{_0x3a21c6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x035b('0x15')](function(_0x289eb3){logger[_0x035b('0x16')]('['+[_0x5d575b[_0x035b('0x17')]()]+']',_0x289eb3[_0x035b('0x18')]);_0x3a21c6(_0x289eb3);});});};}function searchContact(_0x17e58c,_0x21ab31,_0x23bbd8,_0x209ab1){return new Promise(function(_0x4218ca,_0x5f05e0){var _0x161666={'method':_0x035b('0x22'),'headers':_0x21ab31,'uri':_0x17e58c+_0x035b('0x23')+_0x209ab1+_0x035b('0x24')+_0x23bbd8+'&entities=contact','json':!![]};rp(_0x161666)[_0x035b('0x10')](function(_0x97662d){var _0x2beb93=_[_0x035b('0x25')](_0x97662d[_0x035b('0x26')]['contacts'],[_0x23bbd8,_0x209ab1]);_0x4218ca(_0x2beb93);})['catch'](function(_0x1e6d23){_0x5f05e0(_0x1e6d23);});});}function getEndUser(_0x13f3d2,_0x949f17,_0x57c4c0){return function(_0x51aa18){return new Promise(function(_0x44fef6,_0x1b775e){logger['info'](util['format'](_0x035b('0x27'),_0x51aa18[_0x035b('0x28')]));searchContact(_0x57c4c0,_0x949f17,'mobile_number',_0x51aa18[_0x035b('0x28')])[_0x035b('0x10')](function(_0x43bd6b){if(_0x43bd6b){_0x51aa18['endUserId']=_0x43bd6b['id'];logger[_0x035b('0xe')](_0x035b('0x29'),_0x51aa18[_0x035b('0x2a')]);return _0x44fef6(_0x51aa18);}searchContact(_0x57c4c0,_0x949f17,_0x035b('0x2b'),_0x51aa18[_0x035b('0x28')])['then'](function(_0x34fe9a){if(_0x34fe9a){_0x51aa18['endUserId']=_0x34fe9a['id'];logger[_0x035b('0xe')](_0x035b('0x2c'),_0x51aa18[_0x035b('0x2a')]);return _0x44fef6(_0x51aa18);}createEndUser(_0x51aa18,_0x13f3d2,_0x949f17,_0x57c4c0)['then'](function(_0x57a488){logger[_0x035b('0xe')](_0x035b('0x2d'),_0x57a488[_0x035b('0x2a')]);return _0x44fef6(_0x57a488);});});})[_0x035b('0x15')](function(_0x56a5e7){_0x1b775e(_0x56a5e7);});});};}function createEndUser(_0x866a67,_0x30dac7,_0x361d27,_0x27820a){return new Promise(function(_0x295902,_0x1d4afd){var _0xf2ddb1=moment();var _0x528e1c={'method':_0x035b('0x2e'),'uri':_0x27820a+_0x035b('0x2f'),'body':{'contact':{'last_name':_0x866a67['contactNumber'],'work_number':_0x866a67['contactNumber'],'mobile_number':_0x866a67[_0x035b('0x28')],'owner_id':_0x866a67[_0x035b('0x1e')],'created_at':_0xf2ddb1[_0x035b('0x30')](_0x035b('0x31'))}},'json':!![]};_0x528e1c[_0x035b('0xd')]=_0x361d27;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x528e1c)[_0x035b('0x10')](function(_0x59da5){_0x866a67[_0x035b('0x2a')]=_0x59da5[_0x035b('0x32')]['id'];_0x295902(_0x866a67);})[_0x035b('0x15')](function(_0xa4f3f6){logger[_0x035b('0x16')]('['+[_0x30dac7[_0x035b('0x17')]()]+']',_0xa4f3f6[_0x035b('0x18')]);_0x1d4afd(_0xa4f3f6['message']);});});}function getTicket(_0x4c3da4,_0x19a453,_0x4df599,_0x141a37,_0x38360e){return function(_0x16bcb6){logger['info'](_0x035b('0x33'));return new Promise(function(_0x24de4a,_0x425ae1){var _0x3bbf34=moment();var _0x454da9={'method':_0x035b('0x2e'),'uri':_0x4df599+_0x035b('0x34'),'body':{'title':intUtil['getString'](_0x141a37['Subjects'],_0x38360e,'\x20'),'description':intUtil[_0x035b('0x35')](_0x141a37[_0x035b('0x36')],_0x38360e,'\x0a'),'owner_id':_0x16bcb6['userId'],'creater_id':_0x16bcb6[_0x035b('0x12')],'targetable_id':_0x16bcb6[_0x035b('0x2a')],'targetable_type':_0x035b('0x37'),'created_at':_0x3bbf34[_0x035b('0x30')](_0x035b('0x31')),'due_date':_0x3bbf34['add'](0x1e,'m')[_0x035b('0x30')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x454da9[_0x035b('0xd')]=_0x19a453;return rp(_0x454da9)[_0x035b('0x10')](function(_0x4854bb){_0x16bcb6[_0x035b('0x38')]=_0x4854bb['task']['id'];logger[_0x035b('0xe')](_0x035b('0x39'),_0x16bcb6[_0x035b('0x38')]);_0x24de4a(_0x16bcb6);})[_0x035b('0x15')](function(_0x587e6f){logger[_0x035b('0x16')]('['+[_0x4c3da4['toUpperCase']()]+']',_0x587e6f[_0x035b('0x18')]);_0x425ae1(_0x587e6f['message']);});});};}function emit(_0xf0699,_0x228398,_0x1ef224){var _0x11a971={'uri':_0xf0699+'/contacts/'+_0x1ef224};io['to'](util[_0x035b('0x30')](_0x035b('0x3a'),_0x228398))['emit'](_0x035b('0x3b'),_0x11a971);}exports['cs']=function(_0x2ded6e,_0x5370de,_0x43df42,_0x4f2dcf,_0x5eaa13,_0x9fe380,_0x2a15d0,_0x1e836e){var _0x3454d7={};var _0x582094={'Authorization':_0x035b('0x3c')+_0x9fe380[_0x035b('0x3d')]};_0x9fe380[_0x035b('0x3e')]=intUtil[_0x035b('0x3f')](_0x9fe380[_0x035b('0x3e')]);_0x9fe380[_0x035b('0x40')]=intUtil[_0x035b('0x3f')](_0x9fe380[_0x035b('0x40')]);var _0x485972=_0x9fe380[_0x035b('0x3e')];_0x3454d7[_0x035b('0x21')]=_0x9fe380[_0x035b('0x41')];_0x3454d7['contactNumber']=_0x1e836e[_0x035b('0x42')]()==='outbound'?_0x5370de[_0x035b('0x43')]:_0x5370de[_0x035b('0x44')];_0x3454d7[_0x035b('0x45')]=_0x1e836e==='queue'||_0x1e836e===_0x035b('0x46')?'queue':'outbound';if(_0x4f2dcf){_0x3454d7[_0x035b('0x1b')]=_0x4f2dcf[_0x035b('0x1c')];}var _0x25d1bf=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9fe380['serverUrl'],_0x5370de[_0x035b('0x47')],md5(_0x5370de['uniqueid']));if(_0x5eaa13&&_0x5eaa13[_0x035b('0x48')]){logger['info'](_0x035b('0x49'),_0x035b('0x4a'));_0x5370de[_0x035b('0x4b')]=_0x25d1bf;}else if(_0x2a15d0&&_0x2a15d0[_0x035b('0x4c')]&&_0x2a15d0[_0x035b('0x4c')]!=='none'){logger[_0x035b('0xe')]('[OUTBOUND]',_0x035b('0x4a'));_0x5370de[_0x035b('0x4b')]=_0x25d1bf;}else{_0x5370de[_0x035b('0x4b')]='';}return getAdminId(_0x3454d7,_0x1e836e,_0x582094,_0x485972)['then'](getUser(_0x1e836e,_0x582094,_0x485972))[_0x035b('0x10')](getEndUser(_0x1e836e,_0x582094,_0x485972))[_0x035b('0x10')](getTicket(_0x1e836e,_0x582094,_0x485972,_0x43df42,_0x5370de))[_0x035b('0x10')](function(_0xb168dd){logger[_0x035b('0xe')](util[_0x035b('0x30')](_0x035b('0x4d'),_0xb168dd[_0x035b('0x38')]));if(_0x1e836e!==_0x035b('0x46')){logger[_0x035b('0xe')]('['+[_0x1e836e[_0x035b('0x17')]()]+']',_0x035b('0x4e'));emit(_0x485972,_0x4f2dcf[_0x035b('0x4f')],_0xb168dd[_0x035b('0x2a')]);}})[_0x035b('0x15')](function(_0x1bd25b){logger['error']('['+[_0x1e836e[_0x035b('0x17')]()]+_0x035b('0x50'),util[_0x035b('0x51')](_0x1bd25b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3af4=['defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','message','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis'];(function(_0x1adad9,_0x2459d7){var _0x400ff8=function(_0x58dcee){while(--_0x58dcee){_0x1adad9['push'](_0x1adad9['shift']());}};_0x400ff8(++_0x2459d7);}(_0x3af4,0xf6));var _0x43af=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x3af4[_0x455c6c];return _0x488242;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x43af('0x0'));var util=require(_0x43af('0x1'));var moment=require(_0x43af('0x2'));var Promise=require(_0x43af('0x3'));var Redis=require(_0x43af('0x4'));var intUtil=require(_0x43af('0x5'));var config=require(_0x43af('0x6'));var logger=require('../../../../config/logger')(_0x43af('0x7'));config[_0x43af('0x8')]=_[_0x43af('0x9')](config[_0x43af('0x8')],{'host':_0x43af('0xa'),'port':0x18eb});var io=require(_0x43af('0xb'))(new Redis(config[_0x43af('0x8')]));function getAdminId(_0x5284d7,_0x2c2230,_0x11e432,_0x16a96d){return new Promise(function(_0x176ff6,_0x5ead71){var _0x4c53d4=![];var _0x1a08ea={'method':_0x43af('0xc'),'uri':_0x16a96d+_0x43af('0xd'),'json':!![]};_0x1a08ea[_0x43af('0xe')]=_0x11e432;logger[_0x43af('0xf')](_0x43af('0x10'));return rp(_0x1a08ea)[_0x43af('0x11')](function(_0xf50bb7){if(_0xf50bb7){var _0x44610a=_0xf50bb7['users'];var _0x9e7fd7=null;for(_0x9e7fd7=0x0;_0x9e7fd7<_0x44610a[_0x43af('0x12')];_0x9e7fd7++){if(_0x44610a[_0x9e7fd7][_0x43af('0x13')]===_0x5284d7['adminEmail']){_0x5284d7[_0x43af('0x14')]=_0x44610a[_0x9e7fd7]['id'];_0x4c53d4=!![];}}if(_0x4c53d4){logger['info']('Admin\x20found:',_0x5284d7[_0x43af('0x14')]);_0x176ff6(_0x5284d7);}else{_0x5ead71({'statusCode':0x194,'message':_0x43af('0x15')});}}else{_0x5ead71({'statusCode':0x194,'message':_0x43af('0x15')});}})[_0x43af('0x16')](function(_0x291cba){logger[_0x43af('0x17')]('['+[_0x2c2230[_0x43af('0x18')]()]+']',_0x291cba['message']);_0x5ead71(_0x291cba);});});}function getUser(_0x578c44,_0x2d08a0,_0x149f59){return function(_0x1a97cb){return new Promise(function(_0x3ec4ac,_0x42e71a){var _0x5aa43b={'method':_0x43af('0xc'),'uri':_0x149f59+_0x43af('0xd'),'json':!![]};_0x5aa43b['headers']=_0x2d08a0;logger['info'](_0x43af('0x19'));return rp(_0x5aa43b)[_0x43af('0x11')](function(_0xb8f062){if(_0xb8f062){var _0x54cf1e=_0xb8f062[_0x43af('0x1a')];var _0x21a4d7=![];var _0x1a7238=null;if(_0x1a97cb[_0x43af('0x1b')]!==null){logger['info'](_0x43af('0x1c'),_0x1a97cb[_0x43af('0x1b')]);_0x1a97cb[_0x43af('0x1d')]=_0x1a97cb[_0x43af('0x1b')];for(_0x1a7238=0x0;_0x1a7238<_0x54cf1e[_0x43af('0x12')];_0x1a7238++){if(_0x54cf1e[_0x1a7238][_0x43af('0x13')]===_0x1a97cb[_0x43af('0x1b')]){_0x21a4d7=!![];_0x1a97cb[_0x43af('0x1e')]=_0x54cf1e[_0x1a7238]['id'];logger[_0x43af('0xf')](_0x43af('0x1f'),_0x1a97cb['userId']);}}}if(!_0x21a4d7){logger['info'](_0x43af('0x20'));_0x1a97cb[_0x43af('0x1d')]=_0x1a97cb[_0x43af('0x21')];_0x1a97cb[_0x43af('0x1e')]=_0x1a97cb[_0x43af('0x14')];_0x21a4d7=!![];}if(_0x21a4d7){_0x3ec4ac(_0x1a97cb);}else{_0x42e71a({'statusCode':0x194,'message':_0x43af('0x15')});}}else{_0x42e71a({'statusCode':0x194,'message':_0x43af('0x15')});}})[_0x43af('0x16')](function(_0x130f48){logger[_0x43af('0x17')]('['+[_0x578c44[_0x43af('0x18')]()]+']',_0x130f48[_0x43af('0x22')]);_0x42e71a(_0x130f48);});});};}function searchContact(_0x21da45,_0x2513f3,_0x2e8d1c,_0x36a61c){return new Promise(function(_0x5eb8e1,_0x73302c){var _0x391f3f={'method':_0x43af('0xc'),'headers':_0x2513f3,'uri':_0x21da45+_0x43af('0x23')+_0x36a61c+'&f='+_0x2e8d1c+_0x43af('0x24'),'json':!![]};rp(_0x391f3f)[_0x43af('0x11')](function(_0xa671fd){var _0x34fe25=_['find'](_0xa671fd[_0x43af('0x25')][_0x43af('0x25')],[_0x2e8d1c,_0x36a61c]);_0x5eb8e1(_0x34fe25);})[_0x43af('0x16')](function(_0xf2fbee){_0x73302c(_0xf2fbee);});});}function getEndUser(_0x2b7332,_0x2992a4,_0x38b82d){return function(_0x3a037c){return new Promise(function(_0x275282,_0x5198b7){logger[_0x43af('0xf')](util[_0x43af('0x26')](_0x43af('0x27'),_0x3a037c[_0x43af('0x28')]));searchContact(_0x38b82d,_0x2992a4,_0x43af('0x29'),_0x3a037c[_0x43af('0x28')])[_0x43af('0x11')](function(_0x2e8c1c){if(_0x2e8c1c){_0x3a037c[_0x43af('0x2a')]=_0x2e8c1c['id'];logger[_0x43af('0xf')](_0x43af('0x2b'),_0x3a037c[_0x43af('0x2a')]);return _0x275282(_0x3a037c);}searchContact(_0x38b82d,_0x2992a4,_0x43af('0x2c'),_0x3a037c[_0x43af('0x28')])['then'](function(_0x5bf140){if(_0x5bf140){_0x3a037c[_0x43af('0x2a')]=_0x5bf140['id'];logger[_0x43af('0xf')]('Contact\x20found\x20work_number:',_0x3a037c[_0x43af('0x2a')]);return _0x275282(_0x3a037c);}createEndUser(_0x3a037c,_0x2b7332,_0x2992a4,_0x38b82d)[_0x43af('0x11')](function(_0x248cba){logger[_0x43af('0xf')](_0x43af('0x2d'),_0x248cba['endUserId']);return _0x275282(_0x248cba);});});})[_0x43af('0x16')](function(_0x1e7bc2){_0x5198b7(_0x1e7bc2);});});};}function createEndUser(_0x809304,_0x40b9a2,_0x21b37c,_0x21a2f7){return new Promise(function(_0x47d9ac,_0x211c51){var _0x125ee5=moment();var _0x115666={'method':_0x43af('0x2e'),'uri':_0x21a2f7+'/api/contacts','body':{'contact':{'last_name':_0x809304[_0x43af('0x28')],'work_number':_0x809304[_0x43af('0x28')],'mobile_number':_0x809304[_0x43af('0x28')],'owner_id':_0x809304[_0x43af('0x1e')],'created_at':_0x125ee5[_0x43af('0x26')](_0x43af('0x2f'))}},'json':!![]};_0x115666[_0x43af('0xe')]=_0x21b37c;logger[_0x43af('0xf')](_0x43af('0x30'));return rp(_0x115666)[_0x43af('0x11')](function(_0x402b12){_0x809304['endUserId']=_0x402b12[_0x43af('0x31')]['id'];_0x47d9ac(_0x809304);})[_0x43af('0x16')](function(_0x2a32f0){logger[_0x43af('0x17')]('['+[_0x40b9a2[_0x43af('0x18')]()]+']',_0x2a32f0[_0x43af('0x22')]);_0x211c51(_0x2a32f0['message']);});});}function getTicket(_0x4989f5,_0x5dea0a,_0x5f061c,_0x55e5b0,_0x395236){return function(_0x421b5f){logger[_0x43af('0xf')](_0x43af('0x32'));return new Promise(function(_0x23b449,_0xcbd302){var _0x5cf0ee=moment();var _0x4d48b4={'method':_0x43af('0x2e'),'uri':_0x5f061c+'/api/tasks','body':{'title':intUtil['getString'](_0x55e5b0[_0x43af('0x33')],_0x395236,'\x20'),'description':intUtil[_0x43af('0x34')](_0x55e5b0[_0x43af('0x35')],_0x395236,'\x0a'),'owner_id':_0x421b5f['userId'],'creater_id':_0x421b5f[_0x43af('0x14')],'targetable_id':_0x421b5f[_0x43af('0x2a')],'targetable_type':_0x43af('0x36'),'created_at':_0x5cf0ee['format'](_0x43af('0x2f')),'due_date':_0x5cf0ee[_0x43af('0x37')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4d48b4['headers']=_0x5dea0a;return rp(_0x4d48b4)[_0x43af('0x11')](function(_0x72600c){_0x421b5f[_0x43af('0x38')]=_0x72600c[_0x43af('0x39')]['id'];logger[_0x43af('0xf')](_0x43af('0x3a'),_0x421b5f[_0x43af('0x38')]);_0x23b449(_0x421b5f);})['catch'](function(_0x14142c){logger[_0x43af('0x17')]('['+[_0x4989f5['toUpperCase']()]+']',_0x14142c['message']);_0xcbd302(_0x14142c[_0x43af('0x22')]);});});};}function emit(_0x2d4d8a,_0x3427b2,_0x4061d3){var _0x57722b={'uri':_0x2d4d8a+_0x43af('0x3b')+_0x4061d3};io['to'](util[_0x43af('0x26')](_0x43af('0x3c'),_0x3427b2))['emit'](_0x43af('0x3d'),_0x57722b);}exports['cs']=function(_0x48ecf9,_0x58df14,_0x4a1eff,_0x56753f,_0x48e461,_0x179d8f,_0x3166ee,_0x383aef){var _0x383a40={};var _0xb8c67e={'Authorization':_0x43af('0x3e')+_0x179d8f[_0x43af('0x3f')]};_0x179d8f[_0x43af('0x40')]=intUtil[_0x43af('0x41')](_0x179d8f[_0x43af('0x40')]);_0x179d8f[_0x43af('0x42')]=intUtil[_0x43af('0x41')](_0x179d8f[_0x43af('0x42')]);var _0x314cd0=_0x179d8f['remoteUri'];_0x383a40['adminEmail']=_0x179d8f['username'];_0x383a40[_0x43af('0x28')]=_0x383aef['toLowerCase']()===_0x43af('0x43')?_0x58df14[_0x43af('0x44')]:_0x58df14[_0x43af('0x45')];_0x383a40[_0x43af('0x46')]=_0x383aef===_0x43af('0x47')||_0x383aef===_0x43af('0x48')?_0x43af('0x47'):_0x43af('0x43');if(_0x56753f){_0x383a40[_0x43af('0x1b')]=_0x56753f[_0x43af('0x13')];}var _0x41942b=util[_0x43af('0x26')](_0x43af('0x49'),_0x179d8f['serverUrl'],_0x58df14[_0x43af('0x4a')],md5(_0x58df14['uniqueid']));if(_0x48e461&&_0x48e461['monitor_format']){logger[_0x43af('0xf')](_0x43af('0x4b'),_0x43af('0x4c'));_0x58df14[_0x43af('0x4d')]=_0x41942b;}else if(_0x3166ee&&_0x3166ee[_0x43af('0x4e')]&&_0x3166ee['recordingFormat']!==_0x43af('0x4f')){logger[_0x43af('0xf')](_0x43af('0x50'),'Recording\x20is\x20enabled!');_0x58df14['recordingURL']=_0x41942b;}else{_0x58df14['recordingURL']='';}return getAdminId(_0x383a40,_0x383aef,_0xb8c67e,_0x314cd0)[_0x43af('0x11')](getUser(_0x383aef,_0xb8c67e,_0x314cd0))[_0x43af('0x11')](getEndUser(_0x383aef,_0xb8c67e,_0x314cd0))[_0x43af('0x11')](getTicket(_0x383aef,_0xb8c67e,_0x314cd0,_0x4a1eff,_0x58df14))[_0x43af('0x11')](function(_0x145af5){logger[_0x43af('0xf')](util[_0x43af('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0x145af5[_0x43af('0x38')]));if(_0x383aef!==_0x43af('0x48')){logger['info']('['+[_0x383aef[_0x43af('0x18')]()]+']',_0x43af('0x51'));emit(_0x314cd0,_0x56753f[_0x43af('0x52')],_0x145af5[_0x43af('0x2a')]);}})[_0x43af('0x16')](function(_0xe67ee8){logger[_0x43af('0x17')]('['+[_0x383aef[_0x43af('0x18')]()]+_0x43af('0x53'),util[_0x43af('0x54')](_0xe67ee8,{'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 b357a16..ba51984 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 _0xd6fc=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','freshsales','servicenow','exec','data1','toLowerCase','data2','Configurations','data3','queue','outbound','log','unmanaged','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x1e0846,_0x4aea1b){var _0x57e5d7=function(_0x2f9fb3){while(--_0x2f9fb3){_0x1e0846['push'](_0x1e0846['shift']());}};_0x57e5d7(++_0x4aea1b);}(_0xd6fc,0x95));var _0xcd6f=function(_0x12aa2c,_0x5513cf){_0x12aa2c=_0x12aa2c-0x0;var _0x4f7328=_0xd6fc[_0x12aa2c];return _0x4f7328;};'use strict';var _=require(_0xcd6f('0x0'));var util=require(_0xcd6f('0x1'));var zendesk=require(_0xcd6f('0x2'));var salesforce=require(_0xcd6f('0x3'));var sugarcrm=require(_0xcd6f('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xcd6f('0x5'));var desk=require(_0xcd6f('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0xcd6f('0x7'));var dynamics365=require(_0xcd6f('0x8'));var freshsales=require(_0xcd6f('0x9'));var integrations=[_0xcd6f('0xa'),_0xcd6f('0xb'),_0xcd6f('0xc'),_0xcd6f('0xd'),_0xcd6f('0xe'),_0xcd6f('0xf'),'vtiger','dynamics365',_0xcd6f('0x10'),_0xcd6f('0x11')];exports[_0xcd6f('0x12')]=function(_0x2e4ae9,_0x55cf77,_0x3153bd,_0x52916f,_0x44932e,_0x41da8b){if(_0x3153bd){if(_['includes'](integrations,_0x2e4ae9[_0xcd6f('0x13')][_0xcd6f('0x14')]())){try{var _0x249271=null;var _0x47c485='';var _0x4122d2=_0x3153bd[_0x2e4ae9['data1'][_0xcd6f('0x14')]()];if(_0x4122d2){var _0x261873=_0x4122d2[_0x2e4ae9[_0xcd6f('0x15')]];if(_0x261873){var _0x3ab77e=_['find'](_0x261873[_0xcd6f('0x16')],{'id':parseInt(_0x2e4ae9[_0xcd6f('0x17')],0xa)});if(_0x3ab77e){if(_0x52916f){if(_0x44932e&&_0x55cf77[_0xcd6f('0x18')]){_0x47c485=_0xcd6f('0x18');}else if(_0x55cf77['routeId']){_0x47c485=_0xcd6f('0x19');}else{console[_0xcd6f('0x1a')]('EVENT\x20UNKNOWN',_0x55cf77);}}else{_0x47c485=_0xcd6f('0x1b');}switch(_0x2e4ae9[_0xcd6f('0x13')]['toLowerCase']()){case'zendesk':zendesk[_0x47c485](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b);break;case _0xcd6f('0xb'):salesforce[_0x47c485](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b);break;case _0xcd6f('0xc'):sugarcrm[_0x47c485](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b);break;case _0xcd6f('0xd'):freshdesk[_0x47c485](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b);break;case'zoho':zoho[_0x47c485](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b);break;case _0xcd6f('0xf'):desk[_0x47c485](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b);break;case _0xcd6f('0x1c'):vtiger[_0x47c485](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b);break;case _0xcd6f('0x10'):freshsales['cs'](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b,_0x47c485);break;case _0xcd6f('0x11'):servicenow['cs'](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b,_0x47c485);break;case _0xcd6f('0x1d'):dynamics365['cs'](_0x2e4ae9,_0x55cf77,_0x3ab77e,_0x52916f,_0x44932e,_0x261873,_0x41da8b,_0x47c485);break;default:console[_0xcd6f('0x1a')](_0xcd6f('0x1e'));}}else{_0x249271=require(_0xcd6f('0x1f'))(_0x2e4ae9[_0xcd6f('0x13')][_0xcd6f('0x14')]());_0x249271[_0xcd6f('0x20')](_0xcd6f('0x21'),util[_0xcd6f('0x22')](_0xcd6f('0x23'),_0x2e4ae9['data1']['toLowerCase'](),_0x2e4ae9[_0xcd6f('0x17')]));}}else{_0x249271=require(_0xcd6f('0x1f'))(_0x2e4ae9[_0xcd6f('0x13')][_0xcd6f('0x14')]());_0x249271['error'](_0xcd6f('0x21'),util[_0xcd6f('0x22')](_0xcd6f('0x24'),_0x2e4ae9[_0xcd6f('0x13')][_0xcd6f('0x14')](),_0x2e4ae9['data2']));}}else{}}catch(_0x1e1534){console['error'](_0x1e1534);}}}}; \ No newline at end of file +var _0x16bd=['servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','../../../../config/logger','error','[EXEC]','format','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales'];(function(_0x1f3895,_0x399256){var _0x153aba=function(_0x1fd228){while(--_0x1fd228){_0x1f3895['push'](_0x1f3895['shift']());}};_0x153aba(++_0x399256);}(_0x16bd,0x170));var _0xd16b=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x16bd[_0x2f3d29];return _0x53d69d;};'use strict';var _=require('lodash');var util=require(_0xd16b('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0xd16b('0x1'));var sugarcrm=require(_0xd16b('0x2'));var freshdesk=require(_0xd16b('0x3'));var zoho=require(_0xd16b('0x4'));var desk=require(_0xd16b('0x5'));var vtiger=require(_0xd16b('0x6'));var servicenow=require(_0xd16b('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xd16b('0x8'));var integrations=[_0xd16b('0x9'),_0xd16b('0xa'),_0xd16b('0xb'),_0xd16b('0xc'),'zoho',_0xd16b('0xd'),_0xd16b('0xe'),_0xd16b('0xf'),_0xd16b('0x10'),_0xd16b('0x11')];exports[_0xd16b('0x12')]=function(_0x53ecc7,_0x240b63,_0x4da048,_0x4b0e6a,_0x51349a,_0x50d259){if(_0x4da048){if(_['includes'](integrations,_0x53ecc7[_0xd16b('0x13')][_0xd16b('0x14')]())){try{var _0x2e976a=null;var _0x7e8145='';var _0x280599=_0x4da048[_0x53ecc7[_0xd16b('0x13')]['toLowerCase']()];if(_0x280599){var _0x23ccbe=_0x280599[_0x53ecc7[_0xd16b('0x15')]];if(_0x23ccbe){var _0x23bced=_[_0xd16b('0x16')](_0x23ccbe[_0xd16b('0x17')],{'id':parseInt(_0x53ecc7[_0xd16b('0x18')],0xa)});if(_0x23bced){if(_0x4b0e6a){if(_0x51349a&&_0x240b63[_0xd16b('0x19')]){_0x7e8145=_0xd16b('0x19');}else if(_0x240b63[_0xd16b('0x1a')]){_0x7e8145=_0xd16b('0x1b');}else{console[_0xd16b('0x1c')](_0xd16b('0x1d'),_0x240b63);}}else{_0x7e8145=_0xd16b('0x1e');}switch(_0x53ecc7[_0xd16b('0x13')][_0xd16b('0x14')]()){case _0xd16b('0x9'):zendesk[_0x7e8145](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259);break;case'salesforce':salesforce[_0x7e8145](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259);break;case'sugarcrm':sugarcrm[_0x7e8145](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259);break;case _0xd16b('0xc'):freshdesk[_0x7e8145](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259);break;case'zoho':zoho[_0x7e8145](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259);break;case _0xd16b('0xd'):desk[_0x7e8145](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259);break;case _0xd16b('0xe'):vtiger[_0x7e8145](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259);break;case'freshsales':freshsales['cs'](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259,_0x7e8145);break;case _0xd16b('0x11'):servicenow['cs'](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259,_0x7e8145);break;case _0xd16b('0xf'):dynamics365['cs'](_0x53ecc7,_0x240b63,_0x23bced,_0x4b0e6a,_0x51349a,_0x23ccbe,_0x50d259,_0x7e8145);break;default:console['log']('unknown\x20integration');}}else{_0x2e976a=require(_0xd16b('0x1f'))(_0x53ecc7[_0xd16b('0x13')][_0xd16b('0x14')]());_0x2e976a[_0xd16b('0x20')](_0xd16b('0x21'),util[_0xd16b('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x53ecc7[_0xd16b('0x13')][_0xd16b('0x14')](),_0x53ecc7[_0xd16b('0x18')]));}}else{_0x2e976a=require(_0xd16b('0x1f'))(_0x53ecc7['data1'][_0xd16b('0x14')]());_0x2e976a[_0xd16b('0x20')](_0xd16b('0x21'),util[_0xd16b('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x53ecc7[_0xd16b('0x13')][_0xd16b('0x14')](),_0x53ecc7[_0xd16b('0x15')]));}}else{}}catch(_0x580abb){console[_0xd16b('0x20')](_0x580abb);}}}}; \ 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 3f727ca..fe442ea 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 _0xd0da=['Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','catch','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','socket.io-emitter','Subjects','getString','Descriptions','ticketType','Task','utc','IsReminderSet','endUserType','contact','WhoId','account','WhatId','ContactId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','User','execute','then','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','info','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','merge','Contact','cloneDeep','additionalSearchLead','Lead','find','account_contact_lead','$or','Account','length','additionalSearchContact','additionalSearchAccount','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found'];(function(_0x2fc130,_0x1e4dc0){var _0xd5a6d1=function(_0x1375f8){while(--_0x1375f8){_0x2fc130['push'](_0x2fc130['shift']());}};_0xd5a6d1(++_0x1e4dc0);}(_0xd0da,0x133));var _0xad0d=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xd0da[_0x1d87fc];return _0x492b56;};'use strict';var _=require('lodash');var rp=require(_0xad0d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xad0d('0x1'));var jsforce=require('jsforce');var util=require(_0xad0d('0x2'));var Redis=require(_0xad0d('0x3'));var intUtil=require(_0xad0d('0x4'));var config=require(_0xad0d('0x5'));var logger=require(_0xad0d('0x6'))(_0xad0d('0x7'));config['redis']=_[_0xad0d('0x8')](config[_0xad0d('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xad0d('0xa'))(new Redis(config[_0xad0d('0x9')]));function emit(_0x41b319,_0x3fb522,_0x3f26b4){io['to'](_0x41b319)['emit'](_0x3fb522,_0x3f26b4);}function getTicket(_0x36a333,_0x3d830d,_0x5ec5,_0x1a2b9c,_0x337201,_0x40bb3d,_0x2c3f8c,_0x4df074){var _0x42b62a=Object['assign']({},{'OwnerId':_0x3d830d['id'],'Subject':intUtil['getString'](_0x1a2b9c[_0xad0d('0xb')],_0x337201,'\x20'),'Description':intUtil[_0xad0d('0xc')](_0x1a2b9c[_0xad0d('0xd')],_0x337201,'\x0a')},getCustomFields(_0x40bb3d,_0x337201));if(_0x5ec5){if(_0x1a2b9c[_0xad0d('0xe')]===_0xad0d('0xf')){_0x42b62a['ActivityDate']=moment[_0xad0d('0x10')]();_0x42b62a[_0xad0d('0x11')]=![];_0x42b62a['IsRecurrence']=![];if(_0x5ec5[_0xad0d('0x12')]===_0xad0d('0x13')||_0x5ec5[_0xad0d('0x12')]==='lead'){_0x42b62a[_0xad0d('0x14')]=_0x5ec5['id'];}else if(_0x5ec5['endUserType']===_0xad0d('0x15')){_0x42b62a[_0xad0d('0x16')]=_0x5ec5['id'];}}else if(_0x1a2b9c[_0xad0d('0xe')]==='Case'){if(_0x5ec5[_0xad0d('0x12')]===_0xad0d('0x13')){_0x42b62a[_0xad0d('0x17')]=_0x5ec5['id'];}else if(_0x5ec5[_0xad0d('0x12')]===_0xad0d('0x15')){_0x42b62a['AccountId']=_0x5ec5['id'];}else if(_0x5ec5['endUserType']===_0xad0d('0x18')&&_0x1a2b9c[_0xad0d('0x19')]){_0x42b62a[_0x1a2b9c[_0xad0d('0x19')]]=_0x5ec5['id'];}else{logger['info'](_0xad0d('0x1a'));}}}return _0x2c3f8c['sobject'](_0x1a2b9c[_0xad0d('0xe')])[_0xad0d('0x1b')](_0x42b62a);}function getUser(_0x4404f3,_0x11c44d,_0x1f65d5){if(!_[_0xad0d('0x1c')](_0x11c44d)&&intUtil['validateEmail'](_0x11c44d)){var _0x43fe77={'Email':_0x11c44d};var _0x3f2ee4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1f65d5[_0xad0d('0x1d')](_0xad0d('0x1e'))['find'](_0x43fe77,_0x3f2ee4)[_0xad0d('0x1f')]()[_0xad0d('0x20')](function(_0x22e27f){if(_0x22e27f['length']){var _0x4b7e96=_['find'](_0x22e27f,function(_0x2aa4fd){return _0x2aa4fd[_0xad0d('0x21')]===_0x11c44d;});if(_0x4b7e96){logger['info']('Agent\x20%s\x20found.',_0x11c44d);return BPromise[_0xad0d('0x22')]({'id':_0x4b7e96['Id'],'name':_0x4b7e96[_0xad0d('0x23')]});}}else{logger['info'](_0xad0d('0x24'),_0x11c44d);return _0x1f65d5['identity']()[_0xad0d('0x20')](function(_0x27663c){return BPromise['resolve']({'id':_0x27663c[_0xad0d('0x25')],'name':_0x27663c['display_name']});});}});}else{logger[_0xad0d('0x26')](_0xad0d('0x24'),_0x11c44d);return _0x1f65d5['identity']()[_0xad0d('0x20')](function(_0x517dd0){return BPromise['resolve']({'id':_0x517dd0[_0xad0d('0x25')],'name':_0x517dd0['display_name']});});}}function getEndUser(_0x30f07f,_0x16b74c,_0x2cdf60,_0x144c70,_0x4440c1){var _0x5271c8={'$or':{'Phone':_0x144c70}};var _0x1dc527={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xad0d('0x22')]()[_0xad0d('0x20')](function(){logger[_0xad0d('0x26')](_0xad0d('0x27'),_0x144c70,_0x16b74c[_0xad0d('0x28')]);switch(_0x16b74c['moduleSearch']){case _0xad0d('0x29'):var _0xf04904=_['cloneDeep'](_0x5271c8);if(_0x16b74c['additionalSearchContact']){var _0x256dee={};_0x256dee[_0x16b74c['additionalSearchContact']]=_0x144c70;_[_0xad0d('0x2a')](_0xf04904['$or'],_0x256dee);}return _0x4440c1['sobject'](_0xad0d('0x2b'))['find'](_0xf04904,_0x1dc527)[_0xad0d('0x1f')]()[_0xad0d('0x20')](function(_0x283fb5){if(_0x283fb5&&_0x283fb5['length']){return _0x283fb5;}else{var _0x595c9=_[_0xad0d('0x2c')](_0x5271c8);if(_0x16b74c[_0xad0d('0x2d')]){var _0xd1abd2={};_0xd1abd2[_0x16b74c[_0xad0d('0x2d')]]=_0x144c70;_['merge'](_0x595c9['$or'],_0xd1abd2);}return _0x4440c1[_0xad0d('0x1d')](_0xad0d('0x2e'))[_0xad0d('0x2f')](_0x595c9,_0x1dc527);}});case _0xad0d('0x30'):var _0x5cf46d=_[_0xad0d('0x2c')](_0x5271c8);if(_0x16b74c['additionalSearchAccount']){var _0x256dee={};_0x256dee[_0x16b74c['additionalSearchAccount']]=_0x144c70;_['merge'](_0x5cf46d[_0xad0d('0x31')],_0x256dee);}return _0x4440c1[_0xad0d('0x1d')](_0xad0d('0x32'))[_0xad0d('0x2f')](_0x5cf46d,_0x1dc527)[_0xad0d('0x1f')]()['then'](function(_0x448b3b){if(_0x448b3b&&_0x448b3b[_0xad0d('0x33')]){return _0x448b3b;}else{var _0x3c8791=_['cloneDeep'](_0x5271c8);if(_0x16b74c[_0xad0d('0x34')]){var _0x30e799={};_0x30e799[_0x16b74c[_0xad0d('0x34')]]=_0x144c70;_['merge'](_0x3c8791[_0xad0d('0x31')],_0x30e799);}return _0x4440c1[_0xad0d('0x1d')](_0xad0d('0x2b'))[_0xad0d('0x2f')](_0x3c8791,_0x1dc527)['then'](function(_0x1cfca2){if(_0x1cfca2&&_0x1cfca2['length']){return _0x1cfca2;}else{var _0xc1dc88=_[_0xad0d('0x2c')](_0x5271c8);if(_0x16b74c[_0xad0d('0x2d')]){var _0x2732dc={};_0x2732dc[_0x16b74c[_0xad0d('0x2d')]]=_0x144c70;_[_0xad0d('0x2a')](_0xc1dc88[_0xad0d('0x31')],_0x2732dc);}return _0x4440c1[_0xad0d('0x1d')](_0xad0d('0x2e'))[_0xad0d('0x2f')](_0xc1dc88,_0x1dc527);}});}});case _0xad0d('0x13'):var _0xf04904=_['cloneDeep'](_0x5271c8);if(_0x16b74c[_0xad0d('0x34')]){var _0x256dee={};_0x256dee[_0x16b74c[_0xad0d('0x34')]]=_0x144c70;_[_0xad0d('0x2a')](_0xf04904[_0xad0d('0x31')],_0x256dee);}return _0x4440c1[_0xad0d('0x1d')](_0xad0d('0x2b'))[_0xad0d('0x2f')](_0xf04904,_0x1dc527)['execute']();case _0xad0d('0x18'):var _0x1436f3=_[_0xad0d('0x2c')](_0x5271c8);if(_0x16b74c[_0xad0d('0x2d')]){var _0x256dee={};_0x256dee[_0x16b74c[_0xad0d('0x2d')]]=_0x144c70;_[_0xad0d('0x2a')](_0x1436f3[_0xad0d('0x31')],_0x256dee);}return _0x4440c1['sobject'](_0xad0d('0x2e'))[_0xad0d('0x2f')](_0x1436f3,_0x1dc527);case _0xad0d('0x15'):var _0x5cf46d=_[_0xad0d('0x2c')](_0x5271c8);if(_0x16b74c[_0xad0d('0x35')]){var _0x256dee={};_0x256dee[_0x16b74c['additionalSearchAccount']]=_0x144c70;_[_0xad0d('0x2a')](_0x5cf46d['$or'],_0x256dee);}return _0x4440c1['sobject'](_0xad0d('0x32'))['find'](_0x5cf46d,_0x1dc527);default:return null;}})[_0xad0d('0x20')](function(_0x44bb11){if(_0x44bb11&&_0x44bb11['length']){var _0x169771=_[_0xad0d('0x36')](_0x44bb11);if(_0x169771){return BPromise[_0xad0d('0x22')]({'id':_0x169771['Id'],'name':_0x169771[_0xad0d('0x23')],'phone':_0x169771['Phone'],'endUserType':_0x169771[_0xad0d('0x37')][_0xad0d('0x38')][_0xad0d('0x39')]()});}}})[_0xad0d('0x20')](function(_0x57e457){if(_0x57e457){logger[_0xad0d('0x26')](_0xad0d('0x3a'),_0x57e457[_0xad0d('0x12')],_0x144c70);return BPromise[_0xad0d('0x22')](_0x57e457);}else{logger[_0xad0d('0x26')](_0xad0d('0x3b'),_0x144c70);var _0x2d3424={'Phone':_0x144c70};if(_0x16b74c[_0xad0d('0x3c')]){if(_0x16b74c[_0xad0d('0x3c')]===_0xad0d('0x13')){logger[_0xad0d('0x26')](_0xad0d('0x3d'),_0x144c70,_0x16b74c[_0xad0d('0x3c')]);_0x2d3424[_0xad0d('0x3e')]=_0x2cdf60!==_0xad0d('0x3f')?_0x2cdf60:util[_0xad0d('0x40')](_0xad0d('0x41'),_0x144c70);}else if(_0x16b74c[_0xad0d('0x3c')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x144c70,_0x16b74c['moduleCreate']);_0x2d3424[_0xad0d('0x3e')]=_0x2cdf60!==_0xad0d('0x3f')?_0x2cdf60:util['format'](_0xad0d('0x41'),_0x144c70);_0x2d3424[_0xad0d('0x42')]='No\x20Company';}else if(_0x16b74c[_0xad0d('0x3c')]===_0xad0d('0x15')){logger[_0xad0d('0x26')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x144c70,_0x16b74c['moduleCreate']);_0x2d3424[_0xad0d('0x23')]=_0x2cdf60!==_0xad0d('0x3f')?_0x2cdf60:util[_0xad0d('0x40')]('Caller\x20-\x20%s',_0x144c70);}else{return null;}}return _0x4440c1[_0xad0d('0x1d')](_['upperFirst'](_0x16b74c['moduleCreate']))[_0xad0d('0x1b')](_0x2d3424)[_0xad0d('0x20')](function(_0x39fbe8){return BPromise[_0xad0d('0x22')]({'id':_0x39fbe8['id'],'endUserType':_0x16b74c['moduleCreate']});});}});}function getCustomFields(_0x569011,_0x2c0cfc){var _0x19d7cb={};if(_0x569011[_0xad0d('0x33')]>0x0){_[_0xad0d('0x43')](_0x569011,function(_0x48e07e){if(_[_0xad0d('0x44')]([_0xad0d('0x45'),_0xad0d('0x46')],_0x48e07e[_0xad0d('0x38')])&&_0x48e07e[_0xad0d('0x47')]){_0x19d7cb[_0x48e07e[_0xad0d('0x47')]]=_0x48e07e[_0xad0d('0x48')][_0xad0d('0x49')]();}else if(_0x48e07e['type']===_0xad0d('0x4a')&&_0x48e07e[_0xad0d('0x4b')]&&_0x48e07e[_0xad0d('0x47')]){_0x2c0cfc[_0x48e07e[_0xad0d('0x4b')]]&&(_0x19d7cb[_0x48e07e[_0xad0d('0x47')]]=_0x2c0cfc[_0x48e07e['variableName']][_0xad0d('0x49')]());}else if(_0x48e07e['type']===_0xad0d('0x4c')&&_0x48e07e['Variable']&&_0x48e07e[_0xad0d('0x4d')]['name']&&_0x48e07e[_0xad0d('0x47')]){_0x2c0cfc[_0x48e07e['Variable'][_0xad0d('0x4e')]['toLowerCase']()]&&(_0x19d7cb[_0x48e07e[_0xad0d('0x47')]]=_0x2c0cfc[_0x48e07e[_0xad0d('0x4d')][_0xad0d('0x4e')][_0xad0d('0x39')]()][_0xad0d('0x49')]());}});}return _0x19d7cb;}function getConnection(_0x2da2b2){var _0x2f86ce=_0x2da2b2['password'][_0xad0d('0x4f')](_0x2da2b2[_0xad0d('0x50')]);var _0x5524f0=new jsforce[(_0xad0d('0x51'))]({'oauth2':{'loginUrl':_0x2da2b2[_0xad0d('0x52')]||_0xad0d('0x53'),'clientId':_0x2da2b2[_0xad0d('0x54')],'clientSecret':_0x2da2b2[_0xad0d('0x55')]}});return _0x5524f0['login'](_0x2da2b2[_0xad0d('0x56')],_0x2f86ce)['then'](function(){logger[_0xad0d('0x26')](_0xad0d('0x57'));return _0x5524f0;});}exports[_0xad0d('0x58')]=function(_0x5f2311,_0xbbcba3,_0x12c18f,_0x31acfd,_0x5172a5,_0x2facb0){var _0x56ecf8,_0x204725,_0x46d350,_0x3abc76;_0x2facb0['serverUrl']=intUtil[_0xad0d('0x59')](_0x2facb0['serverUrl']);_0x2facb0[_0xad0d('0x52')]=intUtil[_0xad0d('0x59')](_0x2facb0['remoteUri']);if(_0x5172a5&&_0x5172a5[_0xad0d('0x5a')]){logger[_0xad0d('0x26')](_0xad0d('0x5b'),_0xad0d('0x5c'));_0xbbcba3[_0xad0d('0x5d')]=util['format'](_0xad0d('0x5e'),_0x2facb0['serverUrl'],_0xbbcba3[_0xad0d('0x5f')],md5(_0xbbcba3['uniqueid']));}else{_0xbbcba3[_0xad0d('0x5d')]='';}return getConnection(_0x2facb0)['then'](function(_0x977da6){_0x3abc76=_0x977da6;return getUser(_0x2facb0,_0x31acfd[_0xad0d('0x60')],_0x3abc76);})[_0xad0d('0x20')](function(_0x11d7b0){_0x56ecf8=_0x11d7b0;return getEndUser(_0x2facb0,_0x12c18f,_0xbbcba3[_0xad0d('0x61')],_0xbbcba3[_0xad0d('0x62')],_0x3abc76);})[_0xad0d('0x20')](function(_0x11fe5a){_0x204725=_0x11fe5a;return getTicket(_0x2facb0,_0x56ecf8,_0x204725,_0x12c18f,_0xbbcba3,_0x12c18f[_0xad0d('0x63')],_0x3abc76,_0xad0d('0x58'));})[_0xad0d('0x20')](function(_0x291005){_0x46d350=_0x291005;logger['info'](_0xad0d('0x64'),_0x46d350['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x46d350['id'],_0x31acfd[_0xad0d('0x4e')],_0x2facb0[_0xad0d('0x38')]);switch(_0x2facb0['type']){case _0xad0d('0x65'):emit(util[_0xad0d('0x40')](_0xad0d('0x66'),_0x31acfd['name']),_0xad0d('0x67'),{'recordId':_0x46d350['id']});break;case _0xad0d('0x68'):emit(util['format'](_0xad0d('0x66'),_0x31acfd['name']),_0xad0d('0x69'),{'uri':util[_0xad0d('0x40')]('%s/%s/e',_0x3abc76[_0xad0d('0x6a')],_0x46d350['id'])});break;default:logger[_0xad0d('0x6b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xad0d('0x6c')](function(_0x8a83a8){logger[_0xad0d('0x6b')]('[QUEUE]',_0x8a83a8);});};exports[_0xad0d('0x6d')]=function(_0x22c2ad,_0x1427d1,_0x387b1d,_0x2c7df4,_0x171b7a,_0x2b32e3,_0x1558bf){var _0x384b9e,_0x3219f0,_0x45307e,_0x946044;_0x2b32e3[_0xad0d('0x6e')]=intUtil[_0xad0d('0x59')](_0x2b32e3[_0xad0d('0x6e')]);_0x2b32e3[_0xad0d('0x52')]=intUtil[_0xad0d('0x59')](_0x2b32e3['remoteUri']);if(_0x1558bf&&_0x1558bf[_0xad0d('0x6f')]&&_0x1558bf[_0xad0d('0x6f')]!==_0xad0d('0x70')){logger['info'](_0xad0d('0x71'),_0xad0d('0x5c'));_0x1427d1[_0xad0d('0x5d')]=util[_0xad0d('0x40')](_0xad0d('0x5e'),_0x2b32e3[_0xad0d('0x6e')],_0x1427d1[_0xad0d('0x5f')],md5(_0x1427d1['uniqueid']));}return getConnection(_0x2b32e3)[_0xad0d('0x20')](function(_0x56814c){_0x946044=_0x56814c;return getUser(_0x2b32e3,_0x2c7df4['email'],_0x946044);})[_0xad0d('0x20')](function(_0x4405f8){_0x384b9e=_0x4405f8;return getEndUser(_0x2b32e3,_0x387b1d,_0x1427d1[_0xad0d('0x72')],_0x1427d1[_0xad0d('0x73')],_0x946044);})[_0xad0d('0x20')](function(_0x513fe2){_0x3219f0=_0x513fe2;return getTicket(_0x2b32e3,_0x384b9e,_0x3219f0,_0x387b1d,_0x1427d1,_0x387b1d[_0xad0d('0x63')],_0x946044,_0xad0d('0x6d'));})['then'](function(_0x1d03cf){_0x45307e=_0x1d03cf;logger[_0xad0d('0x26')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x45307e['id']);logger[_0xad0d('0x26')](_0xad0d('0x74'),_0x45307e['id'],_0x2c7df4[_0xad0d('0x4e')],_0x2b32e3[_0xad0d('0x38')]);switch(_0x2b32e3['type']){case _0xad0d('0x65'):emit(util[_0xad0d('0x40')](_0xad0d('0x66'),_0x2c7df4[_0xad0d('0x4e')]),_0xad0d('0x67'),{'recordId':_0x45307e['id']});break;case _0xad0d('0x68'):emit(util[_0xad0d('0x40')](_0xad0d('0x66'),_0x2c7df4[_0xad0d('0x4e')]),'trigger:browser:url',{'uri':util[_0xad0d('0x40')]('%s/%s/e',_0x946044['instanceUrl'],_0x45307e['id'])});break;default:logger[_0xad0d('0x6b')](_0xad0d('0x71'),_0xad0d('0x75'));}})[_0xad0d('0x6c')](function(_0x2de089){logger[_0xad0d('0x6b')](_0xad0d('0x71'),_0x2de089);});};exports[_0xad0d('0x76')]=function(_0x1b8f95,_0x31ed8a,_0x215aa0,_0x4a8ae2,_0x25fd33,_0x4eb193){var _0x572d76,_0x5bc8a9,_0x5c14ef,_0x284ddd;_0x4eb193[_0xad0d('0x6e')]=intUtil[_0xad0d('0x59')](_0x4eb193[_0xad0d('0x6e')]);_0x4eb193[_0xad0d('0x52')]=intUtil[_0xad0d('0x59')](_0x4eb193[_0xad0d('0x52')]);if(_0x25fd33&&_0x25fd33['monitor_format']){logger[_0xad0d('0x26')]('['+_0x31ed8a['lastevent'][_0xad0d('0x77')]()+']',_0xad0d('0x5c'));_0x31ed8a[_0xad0d('0x5d')]=util[_0xad0d('0x40')](_0xad0d('0x5e'),_0x4eb193['serverUrl'],_0x31ed8a[_0xad0d('0x5f')],md5(_0x31ed8a[_0xad0d('0x5f')]));}else{_0x31ed8a[_0xad0d('0x5d')]='';}return getConnection(_0x4eb193)[_0xad0d('0x20')](function(_0xba0eb4){_0x284ddd=_0xba0eb4;if(!_[_0xad0d('0x1c')](_0x4a8ae2)){return getUser(_0x4eb193,_0x4a8ae2[_0xad0d('0x4e')],_0x284ddd);}else{return getUser(_0x4eb193,null,_0x284ddd);}})[_0xad0d('0x20')](function(_0x2dc5c6){_0x572d76=_0x2dc5c6;return getEndUser(_0x4eb193,_0x215aa0,_0x31ed8a['calleridname'],_0x31ed8a[_0xad0d('0x62')],_0x284ddd);})[_0xad0d('0x20')](function(_0xb9ac19){_0x5bc8a9=_0xb9ac19;return getTicket(_0x4eb193,_0x572d76,_0x5bc8a9,_0x215aa0,_0x31ed8a,_0x215aa0[_0xad0d('0x63')],_0x284ddd);})['then'](function(_0xf44ddb){_0x5c14ef=_0xf44ddb;logger['info']('['+_0x31ed8a['lastevent']['toUpperCase']()+_0xad0d('0x78'),_0x5c14ef['id']);logger[_0xad0d('0x26')]('['+_0x31ed8a['lastevent'][_0xad0d('0x77')]()+']\x20Integration\x20account\x20type\x20%s.',_0x4eb193['type']);})[_0xad0d('0x6c')](function(_0x5031ac){logger['error']('['+_0x31ed8a[_0xad0d('0x79')][_0xad0d('0x77')]()+']',_0x5031ac);});}; \ No newline at end of file +var _0x60dc=['contact','lead','WhoId','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','sobject','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','merge','first','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','idField','content','toString','variable','variableName','type','customVariable','Variable','name','password','concat','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','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','instanceUrl','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','%s/%s/e','error','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType'];(function(_0x3fa6a6,_0x310a65){var _0x2e0762=function(_0x2a148b){while(--_0x2a148b){_0x3fa6a6['push'](_0x3fa6a6['shift']());}};_0x2e0762(++_0x310a65);}(_0x60dc,0x173));var _0xc60d=function(_0x80a1c7,_0x2e1d52){_0x80a1c7=_0x80a1c7-0x0;var _0x261f1d=_0x60dc[_0x80a1c7];return _0x261f1d;};'use strict';var _=require('lodash');var rp=require(_0xc60d('0x0'));var moment=require(_0xc60d('0x1'));var BPromise=require(_0xc60d('0x2'));var md5=require(_0xc60d('0x3'));var jsforce=require(_0xc60d('0x4'));var util=require(_0xc60d('0x5'));var Redis=require(_0xc60d('0x6'));var intUtil=require(_0xc60d('0x7'));var config=require('../../../../config/environment');var logger=require(_0xc60d('0x8'))('salesforce');config[_0xc60d('0x9')]=_[_0xc60d('0xa')](config[_0xc60d('0x9')],{'host':_0xc60d('0xb'),'port':0x18eb});var io=require(_0xc60d('0xc'))(new Redis(config[_0xc60d('0x9')]));function emit(_0x8800f6,_0x4c6d31,_0x560cee){io['to'](_0x8800f6)[_0xc60d('0xd')](_0x4c6d31,_0x560cee);}function getTicket(_0x99c4d9,_0x59e409,_0x5ef675,_0x2faa25,_0x5e33d3,_0x39f627,_0x3ed091,_0x5a126b){var _0x26723e=Object['assign']({},{'OwnerId':_0x59e409['id'],'Subject':intUtil[_0xc60d('0xe')](_0x2faa25['Subjects'],_0x5e33d3,'\x20'),'Description':intUtil['getString'](_0x2faa25[_0xc60d('0xf')],_0x5e33d3,'\x0a')},getCustomFields(_0x39f627,_0x5e33d3));if(_0x5ef675){if(_0x2faa25[_0xc60d('0x10')]===_0xc60d('0x11')){_0x26723e[_0xc60d('0x12')]=moment[_0xc60d('0x13')]();_0x26723e['IsReminderSet']=![];_0x26723e[_0xc60d('0x14')]=![];if(_0x5ef675[_0xc60d('0x15')]===_0xc60d('0x16')||_0x5ef675[_0xc60d('0x15')]===_0xc60d('0x17')){_0x26723e[_0xc60d('0x18')]=_0x5ef675['id'];}else if(_0x5ef675[_0xc60d('0x15')]===_0xc60d('0x19')){_0x26723e[_0xc60d('0x1a')]=_0x5ef675['id'];}}else if(_0x2faa25[_0xc60d('0x10')]===_0xc60d('0x1b')){if(_0x5ef675[_0xc60d('0x15')]===_0xc60d('0x16')){_0x26723e['ContactId']=_0x5ef675['id'];}else if(_0x5ef675[_0xc60d('0x15')]===_0xc60d('0x19')){_0x26723e[_0xc60d('0x1c')]=_0x5ef675['id'];}else if(_0x5ef675[_0xc60d('0x15')]===_0xc60d('0x17')&&_0x2faa25['leadId']){_0x26723e[_0x2faa25[_0xc60d('0x1d')]]=_0x5ef675['id'];}else{logger[_0xc60d('0x1e')](_0xc60d('0x1f'));}}}return _0x3ed091['sobject'](_0x2faa25[_0xc60d('0x10')])[_0xc60d('0x20')](_0x26723e);}function getUser(_0x1a29c5,_0x1224e4,_0x4e773b){if(!_['isNil'](_0x1224e4)&&intUtil[_0xc60d('0x21')](_0x1224e4)){var _0x5b3e26={'Email':_0x1224e4};var _0x4c8115={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4e773b['sobject'](_0xc60d('0x22'))[_0xc60d('0x23')](_0x5b3e26,_0x4c8115)[_0xc60d('0x24')]()[_0xc60d('0x25')](function(_0x1bdd57){if(_0x1bdd57['length']){var _0x35df20=_[_0xc60d('0x23')](_0x1bdd57,function(_0x8663fe){return _0x8663fe[_0xc60d('0x26')]===_0x1224e4;});if(_0x35df20){logger[_0xc60d('0x1e')](_0xc60d('0x27'),_0x1224e4);return BPromise['resolve']({'id':_0x35df20['Id'],'name':_0x35df20[_0xc60d('0x28')]});}}else{logger['info'](_0xc60d('0x29'),_0x1224e4);return _0x4e773b[_0xc60d('0x2a')]()['then'](function(_0x284e6b){return BPromise[_0xc60d('0x2b')]({'id':_0x284e6b[_0xc60d('0x2c')],'name':_0x284e6b[_0xc60d('0x2d')]});});}});}else{logger[_0xc60d('0x1e')](_0xc60d('0x29'),_0x1224e4);return _0x4e773b[_0xc60d('0x2a')]()[_0xc60d('0x25')](function(_0x45fdda){return BPromise[_0xc60d('0x2b')]({'id':_0x45fdda[_0xc60d('0x2c')],'name':_0x45fdda[_0xc60d('0x2d')]});});}}function getEndUser(_0x490e8b,_0x1e5517,_0x13af6a,_0x251755,_0x26c28c){var _0x5f0849={'$or':{'Phone':_0x251755}};var _0x38d73a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xc60d('0x25')](function(){logger[_0xc60d('0x1e')](_0xc60d('0x2e'),_0x251755,_0x1e5517[_0xc60d('0x2f')]);switch(_0x1e5517[_0xc60d('0x2f')]){case _0xc60d('0x30'):var _0x23e844=_[_0xc60d('0x31')](_0x5f0849);if(_0x1e5517[_0xc60d('0x32')]){var _0x44e080={};_0x44e080[_0x1e5517[_0xc60d('0x32')]]=_0x251755;_['merge'](_0x23e844[_0xc60d('0x33')],_0x44e080);}return _0x26c28c[_0xc60d('0x34')](_0xc60d('0x35'))['find'](_0x23e844,_0x38d73a)[_0xc60d('0x24')]()['then'](function(_0x1d2555){if(_0x1d2555&&_0x1d2555[_0xc60d('0x36')]){return _0x1d2555;}else{var _0x21aeb2=_[_0xc60d('0x31')](_0x5f0849);if(_0x1e5517['additionalSearchLead']){var _0x4d9a89={};_0x4d9a89[_0x1e5517[_0xc60d('0x37')]]=_0x251755;_['merge'](_0x21aeb2[_0xc60d('0x33')],_0x4d9a89);}return _0x26c28c[_0xc60d('0x34')](_0xc60d('0x38'))['find'](_0x21aeb2,_0x38d73a);}});case _0xc60d('0x39'):var _0x1fa7a0=_['cloneDeep'](_0x5f0849);if(_0x1e5517[_0xc60d('0x3a')]){var _0x44e080={};_0x44e080[_0x1e5517[_0xc60d('0x3a')]]=_0x251755;_['merge'](_0x1fa7a0[_0xc60d('0x33')],_0x44e080);}return _0x26c28c[_0xc60d('0x34')](_0xc60d('0x3b'))[_0xc60d('0x23')](_0x1fa7a0,_0x38d73a)[_0xc60d('0x24')]()['then'](function(_0x30ca20){if(_0x30ca20&&_0x30ca20[_0xc60d('0x36')]){return _0x30ca20;}else{var _0x26bca9=_[_0xc60d('0x31')](_0x5f0849);if(_0x1e5517[_0xc60d('0x32')]){var _0x1f6b86={};_0x1f6b86[_0x1e5517['additionalSearchContact']]=_0x251755;_[_0xc60d('0x3c')](_0x26bca9[_0xc60d('0x33')],_0x1f6b86);}return _0x26c28c[_0xc60d('0x34')](_0xc60d('0x35'))['find'](_0x26bca9,_0x38d73a)[_0xc60d('0x25')](function(_0x5b9a63){if(_0x5b9a63&&_0x5b9a63[_0xc60d('0x36')]){return _0x5b9a63;}else{var _0x2ca3be=_[_0xc60d('0x31')](_0x5f0849);if(_0x1e5517[_0xc60d('0x37')]){var _0x2401f0={};_0x2401f0[_0x1e5517[_0xc60d('0x37')]]=_0x251755;_[_0xc60d('0x3c')](_0x2ca3be[_0xc60d('0x33')],_0x2401f0);}return _0x26c28c[_0xc60d('0x34')]('Lead')[_0xc60d('0x23')](_0x2ca3be,_0x38d73a);}});}});case'contact':var _0x23e844=_['cloneDeep'](_0x5f0849);if(_0x1e5517[_0xc60d('0x32')]){var _0x44e080={};_0x44e080[_0x1e5517['additionalSearchContact']]=_0x251755;_[_0xc60d('0x3c')](_0x23e844[_0xc60d('0x33')],_0x44e080);}return _0x26c28c[_0xc60d('0x34')](_0xc60d('0x35'))[_0xc60d('0x23')](_0x23e844,_0x38d73a)[_0xc60d('0x24')]();case _0xc60d('0x17'):var _0x58b3ba=_[_0xc60d('0x31')](_0x5f0849);if(_0x1e5517[_0xc60d('0x37')]){var _0x44e080={};_0x44e080[_0x1e5517[_0xc60d('0x37')]]=_0x251755;_[_0xc60d('0x3c')](_0x58b3ba[_0xc60d('0x33')],_0x44e080);}return _0x26c28c[_0xc60d('0x34')](_0xc60d('0x38'))[_0xc60d('0x23')](_0x58b3ba,_0x38d73a);case _0xc60d('0x19'):var _0x1fa7a0=_['cloneDeep'](_0x5f0849);if(_0x1e5517[_0xc60d('0x3a')]){var _0x44e080={};_0x44e080[_0x1e5517[_0xc60d('0x3a')]]=_0x251755;_[_0xc60d('0x3c')](_0x1fa7a0[_0xc60d('0x33')],_0x44e080);}return _0x26c28c[_0xc60d('0x34')]('Account')['find'](_0x1fa7a0,_0x38d73a);default:return null;}})[_0xc60d('0x25')](function(_0x51a4ef){if(_0x51a4ef&&_0x51a4ef[_0xc60d('0x36')]){var _0x3cee76=_[_0xc60d('0x3d')](_0x51a4ef);if(_0x3cee76){return BPromise[_0xc60d('0x2b')]({'id':_0x3cee76['Id'],'name':_0x3cee76[_0xc60d('0x28')],'phone':_0x3cee76[_0xc60d('0x3e')],'endUserType':_0x3cee76['attributes']['type'][_0xc60d('0x3f')]()});}}})['then'](function(_0x2a0bcc){if(_0x2a0bcc){logger[_0xc60d('0x1e')](_0xc60d('0x40'),_0x2a0bcc[_0xc60d('0x15')],_0x251755);return BPromise[_0xc60d('0x2b')](_0x2a0bcc);}else{logger[_0xc60d('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x251755);var _0x3bb4f3={'Phone':_0x251755};if(_0x1e5517['moduleCreate']){if(_0x1e5517[_0xc60d('0x41')]===_0xc60d('0x16')){logger[_0xc60d('0x1e')](_0xc60d('0x42'),_0x251755,_0x1e5517[_0xc60d('0x41')]);_0x3bb4f3[_0xc60d('0x43')]=_0x13af6a!==_0xc60d('0x44')?_0x13af6a:util[_0xc60d('0x45')](_0xc60d('0x46'),_0x251755);}else if(_0x1e5517[_0xc60d('0x41')]===_0xc60d('0x17')){logger[_0xc60d('0x1e')](_0xc60d('0x42'),_0x251755,_0x1e5517['moduleCreate']);_0x3bb4f3[_0xc60d('0x43')]=_0x13af6a!==_0xc60d('0x44')?_0x13af6a:util[_0xc60d('0x45')](_0xc60d('0x46'),_0x251755);_0x3bb4f3[_0xc60d('0x47')]='No\x20Company';}else if(_0x1e5517[_0xc60d('0x41')]===_0xc60d('0x19')){logger[_0xc60d('0x1e')](_0xc60d('0x42'),_0x251755,_0x1e5517[_0xc60d('0x41')]);_0x3bb4f3[_0xc60d('0x28')]=_0x13af6a!==_0xc60d('0x44')?_0x13af6a:util[_0xc60d('0x45')](_0xc60d('0x46'),_0x251755);}else{return null;}}return _0x26c28c[_0xc60d('0x34')](_[_0xc60d('0x48')](_0x1e5517['moduleCreate']))['create'](_0x3bb4f3)[_0xc60d('0x25')](function(_0x510e30){return BPromise[_0xc60d('0x2b')]({'id':_0x510e30['id'],'endUserType':_0x1e5517[_0xc60d('0x41')]});});}});}function getCustomFields(_0x14a1d8,_0x30ab81){var _0x1296ea={};if(_0x14a1d8[_0xc60d('0x36')]>0x0){_[_0xc60d('0x49')](_0x14a1d8,function(_0x5e8581){if(_[_0xc60d('0x4a')](['string','picklist'],_0x5e8581['type'])&&_0x5e8581[_0xc60d('0x4b')]){_0x1296ea[_0x5e8581[_0xc60d('0x4b')]]=_0x5e8581[_0xc60d('0x4c')][_0xc60d('0x4d')]();}else if(_0x5e8581['type']===_0xc60d('0x4e')&&_0x5e8581[_0xc60d('0x4f')]&&_0x5e8581[_0xc60d('0x4b')]){_0x30ab81[_0x5e8581['variableName']]&&(_0x1296ea[_0x5e8581[_0xc60d('0x4b')]]=_0x30ab81[_0x5e8581[_0xc60d('0x4f')]][_0xc60d('0x4d')]());}else if(_0x5e8581[_0xc60d('0x50')]===_0xc60d('0x51')&&_0x5e8581[_0xc60d('0x52')]&&_0x5e8581[_0xc60d('0x52')]['name']&&_0x5e8581[_0xc60d('0x4b')]){_0x30ab81[_0x5e8581[_0xc60d('0x52')][_0xc60d('0x53')][_0xc60d('0x3f')]()]&&(_0x1296ea[_0x5e8581[_0xc60d('0x4b')]]=_0x30ab81[_0x5e8581[_0xc60d('0x52')][_0xc60d('0x53')][_0xc60d('0x3f')]()][_0xc60d('0x4d')]());}});}return _0x1296ea;}function getConnection(_0x1afeb2){var _0x258afd=_0x1afeb2[_0xc60d('0x54')][_0xc60d('0x55')](_0x1afeb2['securityToken']);var _0xfd6c54=new jsforce[(_0xc60d('0x56'))]({'oauth2':{'loginUrl':_0x1afeb2[_0xc60d('0x57')]||'https://login.salesforce.com','clientId':_0x1afeb2[_0xc60d('0x58')],'clientSecret':_0x1afeb2[_0xc60d('0x59')]}});return _0xfd6c54[_0xc60d('0x5a')](_0x1afeb2[_0xc60d('0x5b')],_0x258afd)['then'](function(){logger['info'](_0xc60d('0x5c'));return _0xfd6c54;});}exports[_0xc60d('0x5d')]=function(_0x11c9a1,_0x5156bb,_0x2e20c0,_0x58fda7,_0x197275,_0x7419d1){var _0x599ed1,_0x9dbf79,_0x3ae261,_0x503240;_0x7419d1[_0xc60d('0x5e')]=intUtil['stripTrailingSlash'](_0x7419d1[_0xc60d('0x5e')]);_0x7419d1[_0xc60d('0x57')]=intUtil[_0xc60d('0x5f')](_0x7419d1[_0xc60d('0x57')]);if(_0x197275&&_0x197275[_0xc60d('0x60')]){logger[_0xc60d('0x1e')](_0xc60d('0x61'),_0xc60d('0x62'));_0x5156bb['recordingURL']=util[_0xc60d('0x45')](_0xc60d('0x63'),_0x7419d1[_0xc60d('0x5e')],_0x5156bb[_0xc60d('0x64')],md5(_0x5156bb[_0xc60d('0x64')]));}else{_0x5156bb[_0xc60d('0x65')]='';}return getConnection(_0x7419d1)[_0xc60d('0x25')](function(_0x533c31){_0x503240=_0x533c31;return getUser(_0x7419d1,_0x58fda7[_0xc60d('0x66')],_0x503240);})[_0xc60d('0x25')](function(_0x41e66e){_0x599ed1=_0x41e66e;return getEndUser(_0x7419d1,_0x2e20c0,_0x5156bb[_0xc60d('0x67')],_0x5156bb[_0xc60d('0x68')],_0x503240);})['then'](function(_0x1cd09d){_0x9dbf79=_0x1cd09d;return getTicket(_0x7419d1,_0x599ed1,_0x9dbf79,_0x2e20c0,_0x5156bb,_0x2e20c0[_0xc60d('0x69')],_0x503240,_0xc60d('0x5d'));})[_0xc60d('0x25')](function(_0x1476b3){_0x3ae261=_0x1476b3;logger[_0xc60d('0x1e')](_0xc60d('0x6a'),_0x3ae261['id']);logger[_0xc60d('0x1e')](_0xc60d('0x6b'),_0x3ae261['id'],_0x58fda7[_0xc60d('0x53')],_0x7419d1['type']);switch(_0x7419d1[_0xc60d('0x50')]){case _0xc60d('0x6c'):emit(util[_0xc60d('0x45')](_0xc60d('0x6d'),_0x58fda7['name']),_0xc60d('0x6e'),{'recordId':_0x3ae261['id']});break;case _0xc60d('0x6f'):emit(util[_0xc60d('0x45')](_0xc60d('0x6d'),_0x58fda7[_0xc60d('0x53')]),'trigger:browser:url',{'uri':util[_0xc60d('0x45')]('%s/%s/e',_0x503240[_0xc60d('0x70')],_0x3ae261['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x148614){logger['error'](_0xc60d('0x61'),_0x148614);});};exports[_0xc60d('0x71')]=function(_0x1e59bb,_0x21ded7,_0x17b7d1,_0x4856d5,_0x4f6d92,_0x251fd7,_0x236ebf){var _0x6f8341,_0x590deb,_0x4b720c,_0x57fc01;_0x251fd7[_0xc60d('0x5e')]=intUtil[_0xc60d('0x5f')](_0x251fd7[_0xc60d('0x5e')]);_0x251fd7['remoteUri']=intUtil['stripTrailingSlash'](_0x251fd7[_0xc60d('0x57')]);if(_0x236ebf&&_0x236ebf[_0xc60d('0x72')]&&_0x236ebf['recordingFormat']!=='none'){logger[_0xc60d('0x1e')](_0xc60d('0x73'),'Recording\x20is\x20enabled!');_0x21ded7[_0xc60d('0x65')]=util['format'](_0xc60d('0x63'),_0x251fd7[_0xc60d('0x5e')],_0x21ded7['uniqueid'],md5(_0x21ded7[_0xc60d('0x64')]));}return getConnection(_0x251fd7)[_0xc60d('0x25')](function(_0x4296bc){_0x57fc01=_0x4296bc;return getUser(_0x251fd7,_0x4856d5['email'],_0x57fc01);})[_0xc60d('0x25')](function(_0x4740ec){_0x6f8341=_0x4740ec;return getEndUser(_0x251fd7,_0x17b7d1,_0x21ded7[_0xc60d('0x74')],_0x21ded7[_0xc60d('0x75')],_0x57fc01);})[_0xc60d('0x25')](function(_0x5c3549){_0x590deb=_0x5c3549;return getTicket(_0x251fd7,_0x6f8341,_0x590deb,_0x17b7d1,_0x21ded7,_0x17b7d1[_0xc60d('0x69')],_0x57fc01,'outbound');})[_0xc60d('0x25')](function(_0x1ac70a){_0x4b720c=_0x1ac70a;logger['info'](_0xc60d('0x76'),_0x4b720c['id']);logger[_0xc60d('0x1e')](_0xc60d('0x77'),_0x4b720c['id'],_0x4856d5[_0xc60d('0x53')],_0x251fd7[_0xc60d('0x50')]);switch(_0x251fd7['type']){case _0xc60d('0x6c'):emit(util[_0xc60d('0x45')](_0xc60d('0x6d'),_0x4856d5[_0xc60d('0x53')]),_0xc60d('0x6e'),{'recordId':_0x4b720c['id']});break;case _0xc60d('0x6f'):emit(util['format'](_0xc60d('0x6d'),_0x4856d5[_0xc60d('0x53')]),_0xc60d('0x78'),{'uri':util[_0xc60d('0x45')](_0xc60d('0x79'),_0x57fc01[_0xc60d('0x70')],_0x4b720c['id'])});break;default:logger[_0xc60d('0x7a')](_0xc60d('0x73'),_0xc60d('0x7b'));}})[_0xc60d('0x7c')](function(_0x2c60e0){logger[_0xc60d('0x7a')](_0xc60d('0x73'),_0x2c60e0);});};exports[_0xc60d('0x7d')]=function(_0x3d060c,_0x16170d,_0x384adb,_0x35cad9,_0x1521a2,_0x424ed0){var _0x59d429,_0x58774b,_0x364dc4,_0x36e59e;_0x424ed0[_0xc60d('0x5e')]=intUtil[_0xc60d('0x5f')](_0x424ed0[_0xc60d('0x5e')]);_0x424ed0[_0xc60d('0x57')]=intUtil['stripTrailingSlash'](_0x424ed0[_0xc60d('0x57')]);if(_0x1521a2&&_0x1521a2[_0xc60d('0x60')]){logger[_0xc60d('0x1e')]('['+_0x16170d[_0xc60d('0x7e')][_0xc60d('0x7f')]()+']',_0xc60d('0x62'));_0x16170d[_0xc60d('0x65')]=util[_0xc60d('0x45')](_0xc60d('0x63'),_0x424ed0[_0xc60d('0x5e')],_0x16170d[_0xc60d('0x64')],md5(_0x16170d[_0xc60d('0x64')]));}else{_0x16170d[_0xc60d('0x65')]='';}return getConnection(_0x424ed0)[_0xc60d('0x25')](function(_0x1aa92b){_0x36e59e=_0x1aa92b;if(!_[_0xc60d('0x80')](_0x35cad9)){return getUser(_0x424ed0,_0x35cad9[_0xc60d('0x53')],_0x36e59e);}else{return getUser(_0x424ed0,null,_0x36e59e);}})[_0xc60d('0x25')](function(_0x15cb85){_0x59d429=_0x15cb85;return getEndUser(_0x424ed0,_0x384adb,_0x16170d[_0xc60d('0x67')],_0x16170d[_0xc60d('0x68')],_0x36e59e);})[_0xc60d('0x25')](function(_0x3d1ff3){_0x58774b=_0x3d1ff3;return getTicket(_0x424ed0,_0x59d429,_0x58774b,_0x384adb,_0x16170d,_0x384adb[_0xc60d('0x69')],_0x36e59e);})['then'](function(_0xd2af72){_0x364dc4=_0xd2af72;logger[_0xc60d('0x1e')]('['+_0x16170d[_0xc60d('0x7e')][_0xc60d('0x7f')]()+_0xc60d('0x81'),_0x364dc4['id']);logger[_0xc60d('0x1e')]('['+_0x16170d[_0xc60d('0x7e')][_0xc60d('0x7f')]()+_0xc60d('0x82'),_0x424ed0[_0xc60d('0x50')]);})[_0xc60d('0x7c')](function(_0x3b34a1){logger[_0xc60d('0x7a')]('['+_0x16170d[_0xc60d('0x7e')][_0xc60d('0x7f')]()+']',_0x3b34a1);});}; \ 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 3b50af3..725e878 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 _0xbb32=['util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','sys_id','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','nameField','customField','toLowerCase','content','toString','string','picklist','type','variable','variableName','idField','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise'];(function(_0x10b332,_0x3ebf4a){var _0x1519e=function(_0x4e484e){while(--_0x4e484e){_0x10b332['push'](_0x10b332['shift']());}};_0x1519e(++_0x3ebf4a);}(_0xbb32,0x1b9));var _0x2bb3=function(_0x282ff9,_0x268bfe){_0x282ff9=_0x282ff9-0x0;var _0x542612=_0xbb32[_0x282ff9];return _0x542612;};'use strict';var _=require(_0x2bb3('0x0'));var Promise=require(_0x2bb3('0x1'));var rp=require(_0x2bb3('0x2'));var util=require(_0x2bb3('0x3'));var md5=require(_0x2bb3('0x4'));var Redis=require('ioredis');var intUtil=require(_0x2bb3('0x5'));var config=require(_0x2bb3('0x6'));var logger=require(_0x2bb3('0x7'))(_0x2bb3('0x8'));config['redis']=_['defaults'](config[_0x2bb3('0x9')],{'host':_0x2bb3('0xa'),'port':0x18eb});var io=require(_0x2bb3('0xb'))(new Redis(config[_0x2bb3('0x9')]));function getAdminUser(_0x5b24b7,_0x2a74b8,_0x52e423,_0x585712,_0x122342,_0x538b49){return new Promise(function(_0x25f6e7,_0x5cdc03){var _0xb5522b={'method':_0x2bb3('0xc'),'uri':_0x585712+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x122342+'&'+_0x538b49,'auth':_0x2a74b8,'json':!![]};return rp(_0xb5522b)['then'](function(_0x4387e9){if(_0x4387e9[_0x2bb3('0xd')][_0x2bb3('0xe')]>0x0){_0x52e423[_0x2bb3('0xf')]=_0x4387e9[_0x2bb3('0xd')][0x0]['sys_id'];}logger[_0x2bb3('0x10')]('['+[_0x5b24b7[_0x2bb3('0x11')]()]+_0x2bb3('0x12'),_0x52e423);_0x25f6e7(_0x52e423);})[_0x2bb3('0x13')](function(_0x594e51){logger[_0x2bb3('0x14')]('['+[_0x5b24b7['toUpperCase']()]+']',_0x594e51[_0x2bb3('0x15')]);_0x5cdc03(_0x594e51[_0x2bb3('0x15')]);});});}function getUser(_0x481313,_0x5c2c7e,_0x4142ff,_0x1d77d0,_0x14315a){return function(_0x44e2b2){logger[_0x2bb3('0x10')]('['+[_0x481313[_0x2bb3('0x11')]()]+_0x2bb3('0x16'),_0x44e2b2);return new Promise(function(_0x263274,_0x49027a){if(intUtil[_0x2bb3('0x17')](_0x44e2b2[_0x2bb3('0x18')])){var _0x40f855={'method':_0x2bb3('0xc'),'uri':_0x4142ff+'sys_user?sysparm_query=email%3D'+_0x44e2b2[_0x2bb3('0x18')]+'&'+_0x1d77d0+'&'+_0x14315a,'auth':_0x5c2c7e,'json':!![]};logger[_0x2bb3('0x10')]('['+[_0x481313['toUpperCase']()]+_0x2bb3('0x19'),_0x40f855);return rp(_0x40f855)['then'](function(_0x3674a6){logger[_0x2bb3('0x10')]('['+[_0x481313['toUpperCase']()]+_0x2bb3('0x1a'),_0x3674a6);if(_0x3674a6[_0x2bb3('0xd')][_0x2bb3('0xe')]>0x0&&String(_0x3674a6[_0x2bb3('0xd')][0x0][_0x2bb3('0x1b')])===_0x2bb3('0x1c')){_0x44e2b2['userId']=_0x3674a6['result'][0x0][_0x2bb3('0x1d')];}else{_0x44e2b2[_0x2bb3('0x1e')]=_0x44e2b2['adminId'];_0x44e2b2[_0x2bb3('0x18')]=_0x44e2b2[_0x2bb3('0x1f')];}logger[_0x2bb3('0x10')]('['+[_0x481313[_0x2bb3('0x11')]()]+'],\x20getUser\x20crm',_0x44e2b2);_0x263274(_0x44e2b2);})[_0x2bb3('0x13')](function(_0x15d163){logger[_0x2bb3('0x14')]('['+[_0x481313['toUpperCase']()]+']',_0x15d163[_0x2bb3('0x15')]);_0x49027a(_0x15d163[_0x2bb3('0x15')]);});}else{logger[_0x2bb3('0x10')]('['+[_0x481313[_0x2bb3('0x11')]()]+_0x2bb3('0x20'));_0x44e2b2[_0x2bb3('0x1e')]=_0x44e2b2[_0x2bb3('0xf')];_0x44e2b2[_0x2bb3('0x18')]=_0x44e2b2[_0x2bb3('0x1f')];_0x263274(_0x44e2b2);}});};}function createEndUser(_0x57226b,_0x5109b2,_0x101b6e,_0x17ac0f,_0x9e7390){logger['info']('['+[_0x57226b[_0x2bb3('0x11')]()]+_0x2bb3('0x21'),_0x101b6e);return new Promise(function(_0x3a84c0,_0x2344f2){var _0x1e69f2={'method':'POST','uri':_0x17ac0f+_0x2bb3('0x22')+_0x9e7390,'body':{'user_name':_0x101b6e[_0x2bb3('0x23')],'roles':_0x2bb3('0x24'),'first_name':_0x101b6e[_0x2bb3('0x23')],'active':_0x2bb3('0x1c'),'date_format':_0x2bb3('0x25'),'phone':_0x101b6e[_0x2bb3('0x23')]},'auth':_0x5109b2,'json':!![]};return rp(_0x1e69f2)[_0x2bb3('0x26')](function(_0x2990ac){logger['info']('['+[_0x57226b[_0x2bb3('0x11')]()]+_0x2bb3('0x27'),_0x2990ac[_0x2bb3('0xd')]);_0x101b6e[_0x2bb3('0x28')]=_0x2990ac[_0x2bb3('0xd')]['sys_id'];_0x3a84c0(_0x101b6e);})[_0x2bb3('0x13')](function(_0x4e9657){logger[_0x2bb3('0x14')]('['+[_0x57226b[_0x2bb3('0x11')]()]+']',_0x4e9657['message']);_0x2344f2(_0x4e9657[_0x2bb3('0x15')]);});});}function getEndUser(_0x4cca1,_0x4fdeb5,_0x59c8ee,_0x3b4287,_0x2541fa){return function(_0x35517b){logger['info']('['+[_0x4cca1[_0x2bb3('0x11')]()]+_0x2bb3('0x29'),_0x35517b);return new Promise(function(_0xd7f634,_0x46025a){var _0x564211={'method':_0x2bb3('0xc'),'uri':_0x59c8ee+_0x2bb3('0x2a')+_0x35517b[_0x2bb3('0x23')]+'&'+_0x3b4287+'&'+_0x2541fa,'auth':_0x4fdeb5,'json':!![]};return rp(_0x564211)[_0x2bb3('0x26')](function(_0x595fab){if(_0x595fab[_0x2bb3('0xd')][_0x2bb3('0xe')]>0x0){_0x35517b[_0x2bb3('0x28')]=_0x595fab['result'][0x0]['sys_id'];logger['info']('['+[_0x4cca1['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x35517b);_0xd7f634(_0x35517b);}else{return createEndUser(_0x4cca1,_0x4fdeb5,_0x35517b,_0x59c8ee,_0x3b4287)[_0x2bb3('0x26')](function(_0x164cb2){logger[_0x2bb3('0x10')]('['+[_0x4cca1['toUpperCase']()]+_0x2bb3('0x2b'),_0x164cb2);_0xd7f634(_0x164cb2);});}})[_0x2bb3('0x13')](function(_0x329b4a){logger[_0x2bb3('0x14')]('['+[_0x4cca1[_0x2bb3('0x11')]()]+']',_0x329b4a[_0x2bb3('0x15')]);_0x46025a(_0x329b4a[_0x2bb3('0x15')]);});});};}function getCustomFields(_0x5384a1,_0x25d1e9){var _0x5f2c53={};if(_0x5384a1['length']>0x0){_[_0x2bb3('0x2c')](_0x5384a1,function(_0xded5c7){if(_[_0x2bb3('0x2d')](['string','picklist'],_0xded5c7['type'])&&_0xded5c7[_0x2bb3('0x2e')]&&!_0xded5c7[_0x2bb3('0x2f')]){_0x5f2c53[_0xded5c7[_0x2bb3('0x2e')][_0x2bb3('0x30')]()]=_0xded5c7[_0x2bb3('0x31')][_0x2bb3('0x32')]();}else if(_[_0x2bb3('0x2d')]([_0x2bb3('0x33'),_0x2bb3('0x34')],_0xded5c7[_0x2bb3('0x35')])&&_0xded5c7['idField']&&_0xded5c7[_0x2bb3('0x2f')]){_0x5f2c53[_0xded5c7['idField'][_0x2bb3('0x30')]()]=_0xded5c7['content'][_0x2bb3('0x32')]();}else if(_0xded5c7['type']===_0x2bb3('0x36')&&_0xded5c7[_0x2bb3('0x37')]&&_0xded5c7['idField']&&_0xded5c7[_0x2bb3('0x2f')]){_0x5f2c53[_0xded5c7[_0x2bb3('0x38')][_0x2bb3('0x30')]()]=_0x25d1e9[_0xded5c7[_0x2bb3('0x37')]][_0x2bb3('0x32')]();}else if(_0xded5c7[_0x2bb3('0x35')]==='customVariable'&&_0xded5c7[_0x2bb3('0x39')]&&_0xded5c7[_0x2bb3('0x39')][_0x2bb3('0x3a')]&&_0xded5c7[_0x2bb3('0x38')]&&_0xded5c7[_0x2bb3('0x2f')]){_0x5f2c53[_0xded5c7[_0x2bb3('0x38')]['toLowerCase']()]=_0x25d1e9[_0xded5c7[_0x2bb3('0x39')]['name'][_0x2bb3('0x30')]()][_0x2bb3('0x32')]();}});}return _0x5f2c53;}function getTicket(_0x1969a8,_0x15aec0,_0x317f27,_0x59b059,_0x5f02bc,_0x3e050c){return function(_0x40645f){logger['info']('['+[_0x1969a8[_0x2bb3('0x11')]()]+_0x2bb3('0x3b'),_0x40645f);return new Promise(function(_0x21b63f,_0x13f950){var _0x1dd44f=_0x1969a8[_0x2bb3('0x30')]()===_0x2bb3('0x3c')?_0x40645f[_0x2bb3('0x1e')]:_0x40645f[_0x2bb3('0x28')];var _0x8a603b={'method':_0x2bb3('0x3d'),'uri':_0x317f27+_0x2bb3('0x3e')+'?'+_0x3e050c,'body':Object['assign']({},{'active':_0x2bb3('0x1c'),'caller_id':_0x1dd44f,'assigned_to':_0x40645f['userId'],'short_description':intUtil[_0x2bb3('0x3f')](_0x59b059['Subjects'],_0x5f02bc,'\x20'),'description':intUtil[_0x2bb3('0x3f')](_0x59b059[_0x2bb3('0x40')],_0x5f02bc,'\x0a')},getCustomFields(_0x59b059['Fields'],_0x5f02bc)),'auth':_0x15aec0,'json':!![]};return rp(_0x8a603b)['then'](function(_0x8ca315){logger[_0x2bb3('0x10')]('['+[_0x1969a8[_0x2bb3('0x11')]()]+_0x2bb3('0x41'),_0x8ca315[_0x2bb3('0xd')]);_0x40645f[_0x2bb3('0x42')]=_0x8ca315[_0x2bb3('0xd')][_0x2bb3('0x1d')];_0x40645f[_0x2bb3('0x43')]=_0x8ca315['result'][_0x2bb3('0x44')];logger[_0x2bb3('0x10')]('['+[_0x1969a8[_0x2bb3('0x11')]()]+_0x2bb3('0x45'),_0x40645f);_0x21b63f(_0x40645f);})[_0x2bb3('0x13')](function(_0x499df0){logger['error']('['+[_0x1969a8[_0x2bb3('0x11')]()]+']',_0x499df0[_0x2bb3('0x15')]);_0x13f950(_0x499df0[_0x2bb3('0x15')]);});});};}function createRemoteTag(_0x1d2f73,_0x1481b7,_0x4270b4,_0x315f94){return new Promise(function(_0x1fcbaf,_0x19f0a5){var _0x4a2014={'method':_0x2bb3('0x3d'),'uri':_0x4270b4+_0x2bb3('0x46')+'?'+_0x315f94,'body':{'short_description':_0x1d2f73,'global':!![],'active':!![],'name':_0x1d2f73},'auth':_0x1481b7,'json':!![]};return rp(_0x4a2014)[_0x2bb3('0x26')](function(_0x4aee3c){var _0x2cef1f=_0x4aee3c[_0x2bb3('0xd')][_0x2bb3('0x1d')];_0x1fcbaf(_0x2cef1f);});});}function getRemoteTag(_0x49afb4,_0x2eb3fe,_0x365987,_0x68d584,_0x3ffc9d){return new Promise(function(_0x18da2d,_0x6c9bd8){var _0x424842={'method':'GET','uri':_0x365987+_0x2bb3('0x46')+_0x2bb3('0x47')+_0x49afb4+'&'+_0x68d584,'auth':_0x2eb3fe,'json':!![]};return rp(_0x424842)[_0x2bb3('0x26')](function(_0x16566e){if(_0x16566e[_0x2bb3('0xd')]['length']>0x0){var _0x418162=_0x16566e[_0x2bb3('0xd')][0x0][_0x2bb3('0x1d')];_0x18da2d(_0x418162);}else{return createRemoteTag(_0x49afb4,_0x2eb3fe,_0x365987,_0x68d584)[_0x2bb3('0x26')](function(_0xe593c1){_0x18da2d(_0xe593c1);});}});});}function assignTagToIncident(_0x51af2e,_0x22078e,_0x24d0c4,_0x33f7f6,_0x1d6e52){return new Promise(function(_0x1436b9,_0x524e04){var _0x5a7982={'method':_0x2bb3('0x3d'),'uri':_0x24d0c4+_0x2bb3('0x48')+'?'+_0x1d6e52,'body':{'label':_0x51af2e,'table':_0x2bb3('0x3e'),'id_type':_0x2bb3('0x49'),'table_key':_0x33f7f6[_0x2bb3('0x42')],'title':'Incident\x20-\x20'+_0x33f7f6[_0x2bb3('0x43')],'id_display':_0x33f7f6['ticketNumber']},'auth':_0x22078e,'json':!![]};return rp(_0x5a7982)[_0x2bb3('0x26')](function(_0x53df09){_0x1436b9();})[_0x2bb3('0x13')](function(){_0x1436b9();});});}function manageTags(_0x5d6adf,_0x116c39,_0x21cb4a,_0x81932c,_0x27b675,_0x4e1595,_0x366027){return new Promise(function(_0x89ba2,_0x3dcbb6){var _0x581b06=[];_0x116c39['forEach'](function(_0x26c5e9){_0x581b06[_0x2bb3('0x4a')](getRemoteTag(_0x26c5e9,_0x21cb4a,_0x81932c,_0x4e1595,_0x366027));});return Promise[_0x2bb3('0x4b')](_0x581b06)[_0x2bb3('0x26')](function(_0x475598){if(_0x475598[_0x2bb3('0xe')]){logger[_0x2bb3('0x10')]('['+[_0x5d6adf[_0x2bb3('0x11')]()]+_0x2bb3('0x4c'),_0x475598);var _0x36083e=[];_0x475598[_0x2bb3('0x2c')](function(_0x57f77f){_0x36083e[_0x2bb3('0x4a')](assignTagToIncident(_0x57f77f,_0x21cb4a,_0x81932c,_0x27b675,_0x4e1595));});return Promise['all'](_0x36083e)[_0x2bb3('0x26')](function(){_0x89ba2();})['catch'](function(){_0x89ba2();});}else{_0x89ba2();}});});}function getTags(_0x5ec5fb,_0x38421b,_0x1384aa,_0x35a741,_0x4ae83b,_0x110295){return function(_0x5e2e72){return new Promise(function(_0x1cc5bd,_0x5c6737){var _0x22bb87=[];var _0x3b9142=_0x35a741[_0x2bb3('0x4d')];if(_0x3b9142&&_0x3b9142[_0x2bb3('0xe')]>0x0){_0x22bb87=_[_0x2bb3('0x4e')](_0x3b9142,_0x2bb3('0x3a'));}if(_0x22bb87['length']>0x0){return manageTags(_0x5ec5fb,_0x22bb87,_0x38421b,_0x1384aa,_0x5e2e72,_0x4ae83b,_0x110295)[_0x2bb3('0x26')](function(){_0x1cc5bd(_0x5e2e72);});}else{_0x1cc5bd(_0x5e2e72);}});};}function emit(_0x258b06,_0x33839d,_0x4fef5b){var _0x4b869a=_0x2bb3('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x2bb3('0x50')+_0x2bb3('0x51');var _0x452822={'uri':_0x258b06+_0x2bb3('0x52')+_0x4fef5b+_0x4b869a};io['to'](util[_0x2bb3('0x53')](_0x2bb3('0x54'),_0x33839d))[_0x2bb3('0x55')](_0x2bb3('0x56'),_0x452822);}exports['cs']=function(_0xb8d51d,_0x4bba87,_0x266b69,_0x422f2d,_0x2bcba6,_0x2092d2,_0x4acb7d,_0x4caa8b){var _0x1ea53b={};var _0x2c2a0c={'user':_0x2092d2[_0x2bb3('0x57')],'pass':_0x2092d2[_0x2bb3('0x58')]};var _0x16f344=_0x2bb3('0x59');var _0x13e70d=_0x2bb3('0x5a');_0x2092d2[_0x2bb3('0x5b')]=intUtil['stripTrailingSlash'](_0x2092d2['remoteUri']);_0x2092d2[_0x2bb3('0x5c')]=intUtil[_0x2bb3('0x5d')](_0x2092d2[_0x2bb3('0x5c')]);var _0x43b5a6=util[_0x2bb3('0x53')]('%s/api/now/table/',_0x2092d2[_0x2bb3('0x5b')]);_0x1ea53b[_0x2bb3('0x18')]=!_[_0x2bb3('0x5e')](_0x422f2d)?_0x422f2d['email']:null;_0x1ea53b[_0x2bb3('0x1f')]=_0x2092d2[_0x2bb3('0x5f')];_0x1ea53b[_0x2bb3('0x23')]=_0x4caa8b['toLowerCase']()===_0x2bb3('0x3c')?_0x4bba87['destcalleridnum']:_0x4bba87[_0x2bb3('0x60')];_0x1ea53b[_0x2bb3('0x61')]=_0x4caa8b===_0x2bb3('0x62')||_0x4caa8b===_0x2bb3('0x63')?'queue':_0x2bb3('0x3c');var _0x533c86=util[_0x2bb3('0x53')](_0x2bb3('0x64'),_0x2092d2[_0x2bb3('0x5c')],_0x4bba87[_0x2bb3('0x65')],md5(_0x4bba87[_0x2bb3('0x65')]));if(_0x2bcba6&&_0x2bcba6[_0x2bb3('0x66')]){logger[_0x2bb3('0x10')](_0x2bb3('0x67'),'Recording\x20is\x20enabled!');_0x4bba87[_0x2bb3('0x68')]=_0x533c86;}else if(_0x4acb7d&&_0x4acb7d['recordingFormat']&&_0x4acb7d[_0x2bb3('0x69')]!==_0x2bb3('0x6a')){logger['info'](_0x2bb3('0x6b'),'Recording\x20is\x20enabled!');_0x4bba87[_0x2bb3('0x68')]=_0x533c86;}else{_0x4bba87[_0x2bb3('0x68')]='';}return getAdminUser(_0x4caa8b,_0x2c2a0c,_0x1ea53b,_0x43b5a6,_0x13e70d,_0x16f344)[_0x2bb3('0x26')](getUser(_0x4caa8b,_0x2c2a0c,_0x43b5a6,_0x13e70d,_0x16f344))['then'](getEndUser(_0x4caa8b,_0x2c2a0c,_0x43b5a6,_0x13e70d,_0x16f344))[_0x2bb3('0x26')](getTicket(_0x4caa8b,_0x2c2a0c,_0x43b5a6,_0x266b69,_0x4bba87,_0x13e70d))[_0x2bb3('0x26')](function(_0x3cc387){logger[_0x2bb3('0x10')](util[_0x2bb3('0x53')](_0x2bb3('0x6c'),_0x3cc387[_0x2bb3('0x42')]));logger['info'](util[_0x2bb3('0x53')](_0x2bb3('0x6d'),_0x4caa8b));if(_0x4caa8b!==_0x2bb3('0x63')){logger[_0x2bb3('0x10')]('['+[_0x4caa8b[_0x2bb3('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2092d2['remoteUri'],_0x422f2d[_0x2bb3('0x3a')],_0x3cc387[_0x2bb3('0x42')]);}})[_0x2bb3('0x13')](function(_0x34211d){logger[_0x2bb3('0x14')]('['+[_0x4caa8b[_0x2bb3('0x11')]()]+_0x2bb3('0x6e'),util['inspect'](_0x34211d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2c27=[']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','type','nameField','customField','string','idField','toLowerCase','content','variableName','customVariable','Variable','name','endUserId','assign','getString','Descriptions','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','all','forEach','push','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','emit','trigger:browser:url','password','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','adminEmail','destcalleridnum','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','],\x20getUser\x20crm'];(function(_0x14c9e8,_0x1d356b){var _0x208e67=function(_0x57ca68){while(--_0x57ca68){_0x14c9e8['push'](_0x14c9e8['shift']());}};_0x208e67(++_0x1d356b);}(_0x2c27,0xa8));var _0x72c2=function(_0xaf4e91,_0x4f6a10){_0xaf4e91=_0xaf4e91-0x0;var _0x410dbb=_0x2c27[_0xaf4e91];return _0x410dbb;};'use strict';var _=require(_0x72c2('0x0'));var Promise=require(_0x72c2('0x1'));var rp=require(_0x72c2('0x2'));var util=require('util');var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x72c2('0x3'));var config=require(_0x72c2('0x4'));var logger=require(_0x72c2('0x5'))(_0x72c2('0x6'));config[_0x72c2('0x7')]=_[_0x72c2('0x8')](config[_0x72c2('0x7')],{'host':_0x72c2('0x9'),'port':0x18eb});var io=require(_0x72c2('0xa'))(new Redis(config[_0x72c2('0x7')]));function getAdminUser(_0x4d91b1,_0x121d9a,_0x34df8c,_0x3679a1,_0x101e41,_0x2680d4){return new Promise(function(_0x42458d,_0x4713a1){var _0x4f14ce={'method':_0x72c2('0xb'),'uri':_0x3679a1+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x101e41+'&'+_0x2680d4,'auth':_0x121d9a,'json':!![]};return rp(_0x4f14ce)['then'](function(_0x4320ba){if(_0x4320ba['result'][_0x72c2('0xc')]>0x0){_0x34df8c[_0x72c2('0xd')]=_0x4320ba[_0x72c2('0xe')][0x0][_0x72c2('0xf')];}logger[_0x72c2('0x10')]('['+[_0x4d91b1[_0x72c2('0x11')]()]+_0x72c2('0x12'),_0x34df8c);_0x42458d(_0x34df8c);})[_0x72c2('0x13')](function(_0x50efae){logger[_0x72c2('0x14')]('['+[_0x4d91b1[_0x72c2('0x11')]()]+']',_0x50efae[_0x72c2('0x15')]);_0x4713a1(_0x50efae[_0x72c2('0x15')]);});});}function getUser(_0x359b81,_0x201e72,_0x5daf10,_0x5d552d,_0x51dc5b){return function(_0x1e6d03){logger['info']('['+[_0x359b81[_0x72c2('0x11')]()]+_0x72c2('0x16'),_0x1e6d03);return new Promise(function(_0x4b537a,_0x5d0d61){if(intUtil[_0x72c2('0x17')](_0x1e6d03[_0x72c2('0x18')])){var _0x51fcc6={'method':_0x72c2('0xb'),'uri':_0x5daf10+_0x72c2('0x19')+_0x1e6d03[_0x72c2('0x18')]+'&'+_0x5d552d+'&'+_0x51dc5b,'auth':_0x201e72,'json':!![]};logger['info']('['+[_0x359b81[_0x72c2('0x11')]()]+_0x72c2('0x1a'),_0x51fcc6);return rp(_0x51fcc6)[_0x72c2('0x1b')](function(_0x290374){logger[_0x72c2('0x10')]('['+[_0x359b81[_0x72c2('0x11')]()]+_0x72c2('0x1c'),_0x290374);if(_0x290374[_0x72c2('0xe')]['length']>0x0&&String(_0x290374['result'][0x0]['active'])===_0x72c2('0x1d')){_0x1e6d03['userId']=_0x290374[_0x72c2('0xe')][0x0][_0x72c2('0xf')];}else{_0x1e6d03[_0x72c2('0x1e')]=_0x1e6d03[_0x72c2('0xd')];_0x1e6d03[_0x72c2('0x18')]=_0x1e6d03['adminEmail'];}logger[_0x72c2('0x10')]('['+[_0x359b81[_0x72c2('0x11')]()]+_0x72c2('0x1f'),_0x1e6d03);_0x4b537a(_0x1e6d03);})[_0x72c2('0x13')](function(_0x3e0063){logger['error']('['+[_0x359b81[_0x72c2('0x11')]()]+']',_0x3e0063[_0x72c2('0x15')]);_0x5d0d61(_0x3e0063[_0x72c2('0x15')]);});}else{logger[_0x72c2('0x10')]('['+[_0x359b81['toUpperCase']()]+_0x72c2('0x20'));_0x1e6d03[_0x72c2('0x1e')]=_0x1e6d03[_0x72c2('0xd')];_0x1e6d03['userEmail']=_0x1e6d03['adminEmail'];_0x4b537a(_0x1e6d03);}});};}function createEndUser(_0x3392f3,_0x67ae9d,_0x1735aa,_0x16a93c,_0x11c0dd){logger[_0x72c2('0x10')]('['+[_0x3392f3['toUpperCase']()]+_0x72c2('0x21'),_0x1735aa);return new Promise(function(_0x138234,_0x43ebf4){var _0x4794ca={'method':_0x72c2('0x22'),'uri':_0x16a93c+_0x72c2('0x23')+_0x11c0dd,'body':{'user_name':_0x1735aa[_0x72c2('0x24')],'roles':_0x72c2('0x25'),'first_name':_0x1735aa[_0x72c2('0x24')],'active':_0x72c2('0x1d'),'date_format':_0x72c2('0x26'),'phone':_0x1735aa[_0x72c2('0x24')]},'auth':_0x67ae9d,'json':!![]};return rp(_0x4794ca)[_0x72c2('0x1b')](function(_0x15a6f4){logger[_0x72c2('0x10')]('['+[_0x3392f3[_0x72c2('0x11')]()]+_0x72c2('0x27'),_0x15a6f4[_0x72c2('0xe')]);_0x1735aa['endUserId']=_0x15a6f4[_0x72c2('0xe')][_0x72c2('0xf')];_0x138234(_0x1735aa);})[_0x72c2('0x13')](function(_0x105e53){logger[_0x72c2('0x14')]('['+[_0x3392f3['toUpperCase']()]+']',_0x105e53[_0x72c2('0x15')]);_0x43ebf4(_0x105e53[_0x72c2('0x15')]);});});}function getEndUser(_0x21afd2,_0x4415c2,_0x225b93,_0x9d9f0,_0x5218f0){return function(_0x427fc7){logger[_0x72c2('0x10')]('['+[_0x21afd2['toUpperCase']()]+_0x72c2('0x28'),_0x427fc7);return new Promise(function(_0x26317c,_0x4958aa){var _0x2ae4b6={'method':_0x72c2('0xb'),'uri':_0x225b93+_0x72c2('0x29')+_0x427fc7['endUserNumber']+'&'+_0x9d9f0+'&'+_0x5218f0,'auth':_0x4415c2,'json':!![]};return rp(_0x2ae4b6)[_0x72c2('0x1b')](function(_0x2e357a){if(_0x2e357a[_0x72c2('0xe')][_0x72c2('0xc')]>0x0){_0x427fc7['endUserId']=_0x2e357a[_0x72c2('0xe')][0x0]['sys_id'];logger['info']('['+[_0x21afd2['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x427fc7);_0x26317c(_0x427fc7);}else{return createEndUser(_0x21afd2,_0x4415c2,_0x427fc7,_0x225b93,_0x9d9f0)[_0x72c2('0x1b')](function(_0x32b91b){logger[_0x72c2('0x10')]('['+[_0x21afd2[_0x72c2('0x11')]()]+_0x72c2('0x2a'),_0x32b91b);_0x26317c(_0x32b91b);});}})[_0x72c2('0x13')](function(_0x451c55){logger[_0x72c2('0x14')]('['+[_0x21afd2[_0x72c2('0x11')]()]+']',_0x451c55[_0x72c2('0x15')]);_0x4958aa(_0x451c55[_0x72c2('0x15')]);});});};}function getCustomFields(_0x16dc4b,_0x3033ad){var _0x394b03={};if(_0x16dc4b['length']>0x0){_['forEach'](_0x16dc4b,function(_0x425034){if(_[_0x72c2('0x2b')](['string','picklist'],_0x425034[_0x72c2('0x2c')])&&_0x425034[_0x72c2('0x2d')]&&!_0x425034[_0x72c2('0x2e')]){_0x394b03[_0x425034[_0x72c2('0x2d')]['toLowerCase']()]=_0x425034['content']['toString']();}else if(_['includes']([_0x72c2('0x2f'),'picklist'],_0x425034[_0x72c2('0x2c')])&&_0x425034['idField']&&_0x425034[_0x72c2('0x2e')]){_0x394b03[_0x425034[_0x72c2('0x30')][_0x72c2('0x31')]()]=_0x425034[_0x72c2('0x32')]['toString']();}else if(_0x425034['type']==='variable'&&_0x425034[_0x72c2('0x33')]&&_0x425034[_0x72c2('0x30')]&&_0x425034[_0x72c2('0x2e')]){_0x394b03[_0x425034[_0x72c2('0x30')][_0x72c2('0x31')]()]=_0x3033ad[_0x425034[_0x72c2('0x33')]]['toString']();}else if(_0x425034[_0x72c2('0x2c')]===_0x72c2('0x34')&&_0x425034['Variable']&&_0x425034[_0x72c2('0x35')][_0x72c2('0x36')]&&_0x425034['idField']&&_0x425034[_0x72c2('0x2e')]){_0x394b03[_0x425034[_0x72c2('0x30')][_0x72c2('0x31')]()]=_0x3033ad[_0x425034[_0x72c2('0x35')][_0x72c2('0x36')][_0x72c2('0x31')]()]['toString']();}});}return _0x394b03;}function getTicket(_0x41aca0,_0x5208ac,_0x3481e2,_0x19e8dc,_0x5022f9,_0x226fd7){return function(_0x2f09d0){logger[_0x72c2('0x10')]('['+[_0x41aca0[_0x72c2('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x2f09d0);return new Promise(function(_0x9a64ee,_0x2d4e19){var _0x3a096c=_0x41aca0[_0x72c2('0x31')]()==='outbound'?_0x2f09d0[_0x72c2('0x1e')]:_0x2f09d0[_0x72c2('0x37')];var _0x4f156e={'method':_0x72c2('0x22'),'uri':_0x3481e2+'incident'+'?'+_0x226fd7,'body':Object[_0x72c2('0x38')]({},{'active':_0x72c2('0x1d'),'caller_id':_0x3a096c,'assigned_to':_0x2f09d0[_0x72c2('0x1e')],'short_description':intUtil[_0x72c2('0x39')](_0x19e8dc['Subjects'],_0x5022f9,'\x20'),'description':intUtil[_0x72c2('0x39')](_0x19e8dc[_0x72c2('0x3a')],_0x5022f9,'\x0a')},getCustomFields(_0x19e8dc['Fields'],_0x5022f9)),'auth':_0x5208ac,'json':!![]};return rp(_0x4f156e)['then'](function(_0x40ae6e){logger[_0x72c2('0x10')]('['+[_0x41aca0[_0x72c2('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x40ae6e[_0x72c2('0xe')]);_0x2f09d0['ticketId']=_0x40ae6e[_0x72c2('0xe')]['sys_id'];_0x2f09d0[_0x72c2('0x3b')]=_0x40ae6e[_0x72c2('0xe')]['number'];logger['info']('['+[_0x41aca0[_0x72c2('0x11')]()]+_0x72c2('0x3c'),_0x2f09d0);_0x9a64ee(_0x2f09d0);})[_0x72c2('0x13')](function(_0x56cb0f){logger[_0x72c2('0x14')]('['+[_0x41aca0[_0x72c2('0x11')]()]+']',_0x56cb0f[_0x72c2('0x15')]);_0x2d4e19(_0x56cb0f[_0x72c2('0x15')]);});});};}function createRemoteTag(_0x1a5483,_0x2ba0a8,_0x445917,_0x1e4e7e){return new Promise(function(_0x34b173,_0x45c71a){var _0x347d9c={'method':_0x72c2('0x22'),'uri':_0x445917+_0x72c2('0x3d')+'?'+_0x1e4e7e,'body':{'short_description':_0x1a5483,'global':!![],'active':!![],'name':_0x1a5483},'auth':_0x2ba0a8,'json':!![]};return rp(_0x347d9c)[_0x72c2('0x1b')](function(_0x2677e1){var _0x4faa3e=_0x2677e1[_0x72c2('0xe')][_0x72c2('0xf')];_0x34b173(_0x4faa3e);});});}function getRemoteTag(_0x5c335f,_0x23ee25,_0x1897fb,_0x2e4fff,_0x128f82){return new Promise(function(_0x35bbbb,_0x4130d1){var _0x599202={'method':'GET','uri':_0x1897fb+'label'+_0x72c2('0x3e')+_0x5c335f+'&'+_0x2e4fff,'auth':_0x23ee25,'json':!![]};return rp(_0x599202)[_0x72c2('0x1b')](function(_0x3b55c1){if(_0x3b55c1[_0x72c2('0xe')][_0x72c2('0xc')]>0x0){var _0x28353a=_0x3b55c1[_0x72c2('0xe')][0x0][_0x72c2('0xf')];_0x35bbbb(_0x28353a);}else{return createRemoteTag(_0x5c335f,_0x23ee25,_0x1897fb,_0x2e4fff)[_0x72c2('0x1b')](function(_0x357c15){_0x35bbbb(_0x357c15);});}});});}function assignTagToIncident(_0x29e073,_0x173607,_0x352802,_0x328c63,_0x5504c1){return new Promise(function(_0x51ff79,_0x149933){var _0x922bdb={'method':'POST','uri':_0x352802+_0x72c2('0x3f')+'?'+_0x5504c1,'body':{'label':_0x29e073,'table':'incident','id_type':_0x72c2('0x40'),'table_key':_0x328c63['ticketId'],'title':'Incident\x20-\x20'+_0x328c63[_0x72c2('0x3b')],'id_display':_0x328c63[_0x72c2('0x3b')]},'auth':_0x173607,'json':!![]};return rp(_0x922bdb)['then'](function(_0x311c32){_0x51ff79();})['catch'](function(){_0x51ff79();});});}function manageTags(_0x229617,_0x426cbc,_0x99e539,_0x1e2bc2,_0x213778,_0x1ada3d,_0x4b8fc8){return new Promise(function(_0x31a9d2,_0x52f31c){var _0x45ad66=[];_0x426cbc['forEach'](function(_0x5d5c87){_0x45ad66['push'](getRemoteTag(_0x5d5c87,_0x99e539,_0x1e2bc2,_0x1ada3d,_0x4b8fc8));});return Promise[_0x72c2('0x41')](_0x45ad66)[_0x72c2('0x1b')](function(_0x38b12a){if(_0x38b12a[_0x72c2('0xc')]){logger['info']('['+[_0x229617[_0x72c2('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x38b12a);var _0x5b9926=[];_0x38b12a[_0x72c2('0x42')](function(_0x30a8c1){_0x5b9926[_0x72c2('0x43')](assignTagToIncident(_0x30a8c1,_0x99e539,_0x1e2bc2,_0x213778,_0x1ada3d));});return Promise[_0x72c2('0x41')](_0x5b9926)[_0x72c2('0x1b')](function(){_0x31a9d2();})['catch'](function(){_0x31a9d2();});}else{_0x31a9d2();}});});}function getTags(_0x4a62a9,_0x13e61a,_0x4ffe41,_0x1ea0fb,_0x478073,_0x2f4ecf){return function(_0xc07efe){return new Promise(function(_0x444f9d,_0xa58adb){var _0x1caffb=[];var _0x75ffb8=_0x1ea0fb[_0x72c2('0x44')];if(_0x75ffb8&&_0x75ffb8[_0x72c2('0xc')]>0x0){_0x1caffb=_['map'](_0x75ffb8,_0x72c2('0x36'));}if(_0x1caffb[_0x72c2('0xc')]>0x0){return manageTags(_0x4a62a9,_0x1caffb,_0x13e61a,_0x4ffe41,_0xc07efe,_0x478073,_0x2f4ecf)['then'](function(){_0x444f9d(_0xc07efe);});}else{_0x444f9d(_0xc07efe);}});};}function emit(_0x492e9b,_0x5a6fcd,_0x3f0c19){var _0x251c19=_0x72c2('0x45')+_0x72c2('0x46')+_0x72c2('0x47')+'%255EORDERBYDESCnumber';var _0xf60ed7={'uri':_0x492e9b+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3f0c19+_0x251c19};io['to'](util['format']('user:%s',_0x5a6fcd))[_0x72c2('0x48')](_0x72c2('0x49'),_0xf60ed7);}exports['cs']=function(_0x205e7d,_0x3d1f92,_0x297609,_0x248330,_0x39b8de,_0x63537d,_0x2ef289,_0x2248c3){var _0x31ef73={};var _0x2ba8ed={'user':_0x63537d['username'],'pass':_0x63537d[_0x72c2('0x4a')]};var _0x589707='sysparm_limit=1';var _0x264f6d='sysparm_display_value=true';_0x63537d['remoteUri']=intUtil['stripTrailingSlash'](_0x63537d[_0x72c2('0x4b')]);_0x63537d[_0x72c2('0x4c')]=intUtil[_0x72c2('0x4d')](_0x63537d[_0x72c2('0x4c')]);var _0x3d93c6=util[_0x72c2('0x4e')](_0x72c2('0x4f'),_0x63537d[_0x72c2('0x4b')]);_0x31ef73[_0x72c2('0x18')]=!_[_0x72c2('0x50')](_0x248330)?_0x248330[_0x72c2('0x51')]:null;_0x31ef73[_0x72c2('0x52')]=_0x63537d[_0x72c2('0x51')];_0x31ef73[_0x72c2('0x24')]=_0x2248c3[_0x72c2('0x31')]()==='outbound'?_0x3d1f92[_0x72c2('0x53')]:_0x3d1f92[_0x72c2('0x54')];_0x31ef73['callDirection']=_0x2248c3===_0x72c2('0x55')||_0x2248c3===_0x72c2('0x56')?'queue':_0x72c2('0x57');var _0x194cdb=util['format'](_0x72c2('0x58'),_0x63537d[_0x72c2('0x4c')],_0x3d1f92[_0x72c2('0x59')],md5(_0x3d1f92['uniqueid']));if(_0x39b8de&&_0x39b8de[_0x72c2('0x5a')]){logger['info'](_0x72c2('0x5b'),_0x72c2('0x5c'));_0x3d1f92['recordingURL']=_0x194cdb;}else if(_0x2ef289&&_0x2ef289[_0x72c2('0x5d')]&&_0x2ef289[_0x72c2('0x5d')]!==_0x72c2('0x5e')){logger[_0x72c2('0x10')](_0x72c2('0x5f'),_0x72c2('0x5c'));_0x3d1f92[_0x72c2('0x60')]=_0x194cdb;}else{_0x3d1f92[_0x72c2('0x60')]='';}return getAdminUser(_0x2248c3,_0x2ba8ed,_0x31ef73,_0x3d93c6,_0x264f6d,_0x589707)[_0x72c2('0x1b')](getUser(_0x2248c3,_0x2ba8ed,_0x3d93c6,_0x264f6d,_0x589707))[_0x72c2('0x1b')](getEndUser(_0x2248c3,_0x2ba8ed,_0x3d93c6,_0x264f6d,_0x589707))[_0x72c2('0x1b')](getTicket(_0x2248c3,_0x2ba8ed,_0x3d93c6,_0x297609,_0x3d1f92,_0x264f6d))[_0x72c2('0x1b')](function(_0x4082c9){logger['info'](util[_0x72c2('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4082c9[_0x72c2('0x61')]));logger[_0x72c2('0x10')](util[_0x72c2('0x4e')]('call\x20direction:\x20%s',_0x2248c3));if(_0x2248c3!==_0x72c2('0x56')){logger[_0x72c2('0x10')]('['+[_0x2248c3[_0x72c2('0x11')]()]+']',_0x72c2('0x62'));emit(_0x63537d[_0x72c2('0x4b')],_0x248330[_0x72c2('0x36')],_0x4082c9['ticketId']);}})[_0x72c2('0x13')](function(_0x9a3d1c){logger[_0x72c2('0x14')]('['+[_0x2248c3['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x72c2('0x63')](_0x9a3d1c,{'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 f8e9825..118374f 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 _0x7471=['parent_type','direction','length','forEach','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','phone_home','Enduser\x20created.','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','idField','custom_fields','content','variableName','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','users','charAt','error','unmanaged','lastevent','calleridname','toUpperCase','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','info','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes'];(function(_0x4d8961,_0x335a9b){var _0x31bbf0=function(_0x111989){while(--_0x111989){_0x4d8961['push'](_0x4d8961['shift']());}};_0x31bbf0(++_0x335a9b);}(_0x7471,0xdb));var _0x1747=function(_0x4e67cc,_0x89bb8){_0x4e67cc=_0x4e67cc-0x0;var _0x2a3529=_0x7471[_0x4e67cc];return _0x2a3529;};'use strict';var _=require(_0x1747('0x0'));var rp=require('request-promise');var BPromise=require(_0x1747('0x1'));var md5=require('md5');var util=require(_0x1747('0x2'));var Redis=require(_0x1747('0x3'));var intUtil=require(_0x1747('0x4'));var config=require(_0x1747('0x5'));var logger=require(_0x1747('0x6'))('sugarcrm');config[_0x1747('0x7')]=_[_0x1747('0x8')](config['redis'],{'host':_0x1747('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x290fee,_0x33510a,_0x4e62cd){io['to'](_0x290fee)['emit'](_0x33510a,_0x4e62cd);}function getTicket(_0x1e0e16,_0x54b5dd,_0x22d83a,_0x233fdc,_0x5f2028,_0x4ae846,_0x23c1f2,_0x593907){logger[_0x1747('0xa')](_0x1747('0xb'));var _0x5e724d=new Date();var _0x366c58=[{'name':'name','value':intUtil['getString'](_0x233fdc[_0x1747('0xc')],_0x5f2028,'\x20')},{'name':_0x1747('0xd'),'value':_0x54b5dd['id']},{'name':_0x1747('0xe'),'value':_0x54b5dd['id']},{'name':_0x1747('0xf'),'value':intUtil[_0x1747('0x10')](_0x233fdc[_0x1747('0x11')],_0x5f2028,'\x0a')},{'name':'date_start','value':_0x5e724d[_0x1747('0x12')]()[_0x1747('0x13')](0x0,0x13)[_0x1747('0x14')]('T','\x20')},{'name':_0x1747('0x15'),'value':'0'},{'name':_0x1747('0x16'),'value':'15'},{'name':'parent_id','value':_0x22d83a['id']},{'name':_0x1747('0x17'),'value':'Contacts'},{'name':'parent_name','value':_0x22d83a['name']},{'name':_0x1747('0x18'),'value':_0x593907}];if(_0x4ae846[_0x1747('0x19')]){_[_0x1747('0x1a')](_0x4ae846,function(_0x54157b){if(_0x5f2028[_0x54157b['variableName']]){_0x366c58[_0x1747('0x1b')]({'name':_0x54157b['idField'],'value':_0x5f2028[_0x54157b['variableName']]});}});}return request({'form':{'method':_0x1747('0x1c'),'input_type':'JSON','response_type':_0x1747('0x1d'),'rest_data':JSON[_0x1747('0x1e')]({'session':_0x23c1f2['id'],'module_name':_0x1747('0x1f'),'name_value_list':_0x366c58})}});}function getAuth(_0x38d088){return util[_0x1747('0x20')](_0x1747('0x21'),new Buffer(_0x38d088[_0x1747('0x22')]+':X')[_0x1747('0x23')](_0x1747('0x24')));}function getServerInfo(_0xb28de){return request({'form':{'method':_0x1747('0x25'),'input_type':_0x1747('0x1d'),'response_type':_0x1747('0x1d'),'rest_data':JSON[_0x1747('0x1e')]({'session':_0xb28de['id']})}});}function getUser(_0x251ade,_0x2b545c,_0x2aab29){if(!_[_0x1747('0x26')](_0x2b545c)){logger[_0x1747('0xa')](_0x1747('0x27'),_0x2b545c);return request({'form':{'method':'get_entry_list','input_type':_0x1747('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2aab29['id'],'module_name':_0x1747('0x28'),'query':util[_0x1747('0x20')](_0x1747('0x29'),_0x2b545c),'order_by':'','offset':'0','select_fields':['id',_0x1747('0x2a'),_0x1747('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5da49b){if(_0x5da49b[_0x1747('0x2c')][_0x1747('0x19')]){var _0x46f467=_[_0x1747('0x2d')](_0x5da49b[_0x1747('0x2c')],function(_0x365859){return _0x365859[_0x1747('0x2e')][_0x1747('0x2b')][_0x1747('0x2f')]===_0x2b545c;});if(_0x46f467){logger[_0x1747('0xa')](_0x1747('0x30'));return BPromise[_0x1747('0x31')]({'id':_0x46f467[_0x1747('0x2e')]['id']['value'],'name':_0x46f467[_0x1747('0x2e')][_0x1747('0x2a')][_0x1747('0x2f')]});}}logger[_0x1747('0xa')](_0x1747('0x32'));return BPromise['resolve']({'id':_0x2aab29[_0x1747('0x2e')][_0x1747('0x33')]['value'],'name':_0x2aab29[_0x1747('0x2e')][_0x1747('0x2b')]['value']});});}else{logger[_0x1747('0xa')](_0x1747('0x34'));return BPromise[_0x1747('0x31')]({'id':_0x2aab29['name_value_list'][_0x1747('0x33')][_0x1747('0x2f')],'name':_0x2aab29['name_value_list'][_0x1747('0x2b')]['value']});}}function getEndUser(_0x14c0f1,_0x3bb112,_0x2afa3d,_0x4463d1){logger[_0x1747('0xa')]('Searching\x20enduser\x20with\x20phone',_0x2afa3d);return request({'form':{'method':_0x1747('0x35'),'input_type':_0x1747('0x1d'),'response_type':_0x1747('0x1d'),'rest_data':JSON[_0x1747('0x1e')]({'session':_0x4463d1['id'],'module_name':_0x1747('0x36'),'query':util[_0x1747('0x20')](_0x1747('0x37'),_0x2afa3d),'order_by':'','offset':'0','select_fields':['id',_0x1747('0x2a'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1747('0x38')](function(_0x2b0a07){if(_0x2b0a07[_0x1747('0x2c')]['length']){var _0x4ac211=_[_0x1747('0x2d')](_0x2b0a07[_0x1747('0x2c')],function(_0x18a151){return _0x18a151[_0x1747('0x2e')]['phone_home'][_0x1747('0x2f')]===_0x2afa3d;});if(_0x4ac211){logger[_0x1747('0xa')](_0x1747('0x39'));return BPromise[_0x1747('0x31')]({'id':_0x4ac211['name_value_list']['id'][_0x1747('0x2f')],'name':_0x4ac211[_0x1747('0x2e')][_0x1747('0x2a')][_0x1747('0x2f')],'phone':_0x4ac211['name_value_list']['phone_home'][_0x1747('0x2f')]});}}else{logger[_0x1747('0xa')](_0x1747('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x1747('0x1d'),'response_type':_0x1747('0x1d'),'rest_data':JSON[_0x1747('0x1e')]({'session':_0x4463d1['id'],'module_name':_0x1747('0x36'),'name_value_list':[{'name':_0x1747('0x3b'),'value':_0x3bb112!==_0x1747('0x3c')?_0x3bb112:util[_0x1747('0x20')](_0x1747('0x3d'),_0x2afa3d)},{'name':_0x1747('0x3e'),'value':_0x2afa3d}]})}})[_0x1747('0x38')](function(_0x25c5da){logger['info'](_0x1747('0x3f'));return BPromise[_0x1747('0x31')]({'id':_0x25c5da['id'],'name':_0x25c5da['entry_list']['first_name']['value'],'phone':_0x25c5da['entry_list'][_0x1747('0x3e')][_0x1747('0x2f')]});});}});}function request(_0x22e341){logger['debug'](_0x1747('0x40'),JSON[_0x1747('0x1e')](_0x22e341));return rp(_[_0x1747('0x41')](def,_0x22e341));}function getTags(_0x6b7163,_0x266b21){var _0x26b44b=[];if(_0x6b7163&&_0x6b7163[_0x1747('0x19')]>0x0){_0x26b44b=_[_0x1747('0x42')](_0x6b7163,_0x266b21);}return _0x26b44b;}function getCustomFields(_0x437cd0,_0x29f6f2){var _0xdc89e3=[];var _0x4c80ba={'custom_fields':[]};if(_0x437cd0[_0x1747('0x19')]>0x0){_[_0x1747('0x1a')](_0x437cd0,function(_0x25cdfa){if(_0x25cdfa[_0x1747('0x43')]===_0x1747('0x44')&&_0x25cdfa['nameField']&&!_0x25cdfa[_0x1747('0x45')]){_0x4c80ba[_0x25cdfa[_0x1747('0x46')][_0x1747('0x47')]()]=_0x25cdfa['content']['toString']();}else if(_0x25cdfa[_0x1747('0x43')]===_0x1747('0x44')&&_0x25cdfa[_0x1747('0x48')]&&_0x25cdfa[_0x1747('0x45')]){_0x4c80ba[_0x1747('0x49')][_0x1747('0x1b')]({'id':_0x25cdfa[_0x1747('0x48')],'value':_0x25cdfa[_0x1747('0x4a')][_0x1747('0x23')]()});}else if(_0x25cdfa[_0x1747('0x43')]==='variable'&&_0x25cdfa['variableName']&&_0x25cdfa[_0x1747('0x48')]&&_0x25cdfa[_0x1747('0x45')]){_0x29f6f2[_0x25cdfa[_0x1747('0x4b')]]&&_0x4c80ba[_0x1747('0x49')][_0x1747('0x1b')]({'id':_0x25cdfa[_0x1747('0x48')],'value':_0x29f6f2[_0x25cdfa[_0x1747('0x4b')]][_0x1747('0x23')]()});}else if(_0x25cdfa[_0x1747('0x43')]===_0x1747('0x4c')&&_0x25cdfa['Variable']&&_0x25cdfa[_0x1747('0x4d')]['name']&&_0x25cdfa[_0x1747('0x48')]&&_0x25cdfa[_0x1747('0x45')]){_0x29f6f2[_0x25cdfa[_0x1747('0x4d')][_0x1747('0x2a')][_0x1747('0x47')]()]&&_0x4c80ba['custom_fields'][_0x1747('0x1b')]({'id':_0x25cdfa['idField'],'value':_0x29f6f2[_0x25cdfa[_0x1747('0x4d')][_0x1747('0x2a')][_0x1747('0x47')]()][_0x1747('0x23')]()});}});}return _0x4c80ba;}function getConnection(_0x2f4ed7){return request({'method':_0x1747('0x4e'),'form':{'method':_0x1747('0x4f'),'input_type':_0x1747('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2f4ed7[_0x1747('0x50')],'password':_0x2f4ed7[_0x1747('0x51')],'encryption':'PLAIN'},'application':_0x1747('0x52')})}})[_0x1747('0x38')](function(_0x57b4e4){var _0x22d2ed=_0x57b4e4;if(_0x22d2ed['id']){def[_0x1747('0x53')]=_0x22d2ed['id'];return BPromise[_0x1747('0x31')](_0x22d2ed);}else{throw new Error(util[_0x1747('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x2f4ed7['id']));}});}function setRelationship(_0x361823,_0x303d74,_0x5ce543,_0x25a857){return request({'form':{'method':_0x1747('0x54'),'input_type':'JSON','response_type':_0x1747('0x1d'),'rest_data':JSON[_0x1747('0x1e')]({'session':_0x361823['id'],'module_name':_0x1747('0x1f'),'module_id':_0x5ce543['id'],'link_field_name':_0x25a857,'related_ids':[_0x303d74['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2d5cbc,_0xb5e00d,_0x4e89c4,_0x4ef07f,_0x23b465,_0x110be5){var _0x21114b,_0x72e6ba,_0x52752a,_0x2b3818;_0x110be5[_0x1747('0x55')]=intUtil[_0x1747('0x56')](_0x110be5['remoteUri']);_0x110be5[_0x1747('0x57')]=intUtil[_0x1747('0x56')](_0x110be5[_0x1747('0x57')]);def[_0x1747('0x58')]=util[_0x1747('0x20')](_0x1747('0x59'),_0x110be5[_0x1747('0x55')]);if(_0x23b465&&_0x23b465[_0x1747('0x5a')]){logger[_0x1747('0xa')](_0x1747('0x5b'),_0x1747('0x5c'));_0xb5e00d[_0x1747('0x5d')]=util[_0x1747('0x20')](_0x1747('0x5e'),_0x110be5['serverUrl'],_0xb5e00d[_0x1747('0x5f')],md5(_0xb5e00d['uniqueid']));}else{_0xb5e00d['recordingURL']='';}return getConnection(_0x110be5)[_0x1747('0x38')](function(_0xc96fec){_0x2b3818=_0xc96fec;return getUser(_0x110be5,_0x4ef07f['name'],_0x2b3818);})[_0x1747('0x38')](function(_0x147a97){_0x21114b=_0x147a97;logger[_0x1747('0xa')](_0x1747('0x60'),_0x21114b['id']);return getEndUser(_0x110be5,_0xb5e00d['calleridname'],_0xb5e00d['calleridnum'],_0x2b3818);})[_0x1747('0x38')](function(_0x57ad3e){_0x72e6ba=_0x57ad3e;logger[_0x1747('0xa')](_0x1747('0x61'),_0x72e6ba['id']);return getTicket(_0x110be5,_0x21114b,_0x72e6ba,_0x4e89c4,_0xb5e00d,_0x4e89c4['Fields'],_0x2b3818,_0x1747('0x62'));})[_0x1747('0x38')](function(_0x3248b9){_0x52752a=_0x3248b9;logger[_0x1747('0xa')](_0x1747('0x63'));logger[_0x1747('0xa')](_0x1747('0x64'),_0x52752a['id']);return setRelationship(_0x2b3818,_0x21114b,_0x52752a,'users');})[_0x1747('0x38')](function(){return setRelationship(_0x2b3818,_0x72e6ba,_0x52752a,_0x1747('0x65'));})[_0x1747('0x38')](function(){return getServerInfo(_0x2b3818);})[_0x1747('0x38')](function(_0xbe313a){var _0x15f978=parseInt(_0xbe313a[_0x1747('0x66')]['charAt'](0x0));var _0xe4425e=util[_0x1747('0x20')](_0x1747('0x67'),_0x110be5[_0x1747('0x55')],_0x52752a['id']);if(_0x15f978>0x6){_0xe4425e=util[_0x1747('0x20')](_0x1747('0x68'),_0x110be5['remoteUri'],_0x52752a['id']);}logger['info'](_0x1747('0x5b'),_0x1747('0x69'));emit(util[_0x1747('0x20')]('user:%s',_0x4ef07f['name']),_0x1747('0x6a'),{'uri':_0xe4425e});})[_0x1747('0x6b')](function(_0x197a93){logger['error'](_0x1747('0x5b'),JSON[_0x1747('0x1e')](_0x197a93));});};exports[_0x1747('0x6c')]=function(_0x4a8b64,_0x559f75,_0x108ede,_0x515bb6,_0x56ccdc,_0x5849c8,_0x1f6b96){var _0x45e11c,_0x24f3cd,_0x2d8e71,_0x56a0f6;_0x5849c8[_0x1747('0x55')]=intUtil[_0x1747('0x56')](_0x5849c8[_0x1747('0x55')]);_0x5849c8[_0x1747('0x57')]=intUtil['stripTrailingSlash'](_0x5849c8[_0x1747('0x57')]);def[_0x1747('0x58')]=util[_0x1747('0x20')](_0x1747('0x59'),_0x5849c8[_0x1747('0x55')]);if(_0x1f6b96&&_0x1f6b96[_0x1747('0x6d')]&&_0x1f6b96['recordingFormat']!==_0x1747('0x6e')){logger['info']('[OUTBOUND]',_0x1747('0x5c'));_0x559f75[_0x1747('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5849c8[_0x1747('0x57')],_0x559f75[_0x1747('0x5f')],md5(_0x559f75[_0x1747('0x5f')]));}return getConnection(_0x5849c8)[_0x1747('0x38')](function(_0xb5b00){_0x56a0f6=_0xb5b00;return getUser(_0x5849c8,_0x515bb6[_0x1747('0x2a')],_0x56a0f6);})[_0x1747('0x38')](function(_0xb2a237){_0x45e11c=_0xb2a237;logger['info'](_0x1747('0x60'),_0x45e11c['id']);return getEndUser(_0x5849c8,_0x559f75[_0x1747('0x6f')],_0x559f75[_0x1747('0x70')],_0x56a0f6);})[_0x1747('0x38')](function(_0x33c0aa){_0x24f3cd=_0x33c0aa;logger['info']('The\x20Enduser\x20ID\x20is:',_0x24f3cd['id']);return getTicket(_0x5849c8,_0x45e11c,_0x24f3cd,_0x108ede,_0x559f75,_0x108ede['Fields'],_0x56a0f6,_0x1747('0x71'));})[_0x1747('0x38')](function(_0x31ca22){_0x2d8e71=_0x31ca22;logger[_0x1747('0xa')](_0x1747('0x63'));logger[_0x1747('0xa')](_0x1747('0x64'),_0x2d8e71['id']);return setRelationship(_0x56a0f6,_0x45e11c,_0x2d8e71,_0x1747('0x72'));})[_0x1747('0x38')](function(){return setRelationship(_0x56a0f6,_0x24f3cd,_0x2d8e71,_0x1747('0x65'));})['then'](function(){return getServerInfo(_0x56a0f6);})['then'](function(_0x31a1b8){var _0x1017a1=parseInt(_0x31a1b8['version'][_0x1747('0x73')](0x0));var _0x136b83=util[_0x1747('0x20')](_0x1747('0x67'),_0x5849c8[_0x1747('0x55')],_0x2d8e71['id']);if(_0x1017a1>0x6){_0x136b83=util['format'](_0x1747('0x68'),_0x5849c8['remoteUri'],_0x2d8e71['id']);}logger[_0x1747('0xa')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1747('0x20')]('user:%s',_0x515bb6[_0x1747('0x2a')]),'trigger:browser:url',{'uri':_0x136b83});})['catch'](function(_0x5a9619){logger[_0x1747('0x74')]('[OUTBOUND]',JSON[_0x1747('0x1e')](_0x5a9619));});};exports[_0x1747('0x75')]=function(_0x1e227a,_0x5c930e,_0x4fddb9,_0x55e5f5,_0xbe2898,_0x2e6bd4){var _0x2c20a3,_0x2ace9b,_0x528209,_0x2a47c2;_0x2e6bd4[_0x1747('0x55')]=intUtil[_0x1747('0x56')](_0x2e6bd4[_0x1747('0x55')]);_0x2e6bd4['serverUrl']=intUtil[_0x1747('0x56')](_0x2e6bd4[_0x1747('0x57')]);def[_0x1747('0x58')]=util[_0x1747('0x20')]('%s/service/v4_1/rest.php',_0x2e6bd4['remoteUri']);if(_0xbe2898&&_0xbe2898[_0x1747('0x5a')]){logger[_0x1747('0xa')]('['+_0x5c930e[_0x1747('0x76')]['toUpperCase']()+']',_0x1747('0x5c'));_0x5c930e[_0x1747('0x5d')]=util[_0x1747('0x20')](_0x1747('0x5e'),_0x2e6bd4['serverUrl'],_0x5c930e['uniqueid'],md5(_0x5c930e[_0x1747('0x5f')]));}else{_0x5c930e[_0x1747('0x5d')]='';}return getConnection(_0x2e6bd4)[_0x1747('0x38')](function(_0x37776f){_0x2a47c2=_0x37776f;if(!_[_0x1747('0x26')](_0x55e5f5)){return getUser(_0x2e6bd4,_0x55e5f5['name'],_0x2a47c2);}else{return getUser(_0x2e6bd4,null,_0x2a47c2);}})[_0x1747('0x38')](function(_0x37d4f4){_0x2c20a3=_0x37d4f4;logger[_0x1747('0xa')]('The\x20User\x20ID\x20is:',_0x2c20a3['id']);return getEndUser(_0x2e6bd4,_0x5c930e[_0x1747('0x77')],_0x5c930e['calleridnum'],_0x2a47c2);})[_0x1747('0x38')](function(_0x106126){_0x2ace9b=_0x106126;logger[_0x1747('0xa')](_0x1747('0x61'),_0x2ace9b['id']);return getTicket(_0x2e6bd4,_0x2c20a3,_0x2ace9b,_0x4fddb9,_0x5c930e,_0x4fddb9['Fields'],_0x2a47c2,_0x1747('0x62'));})[_0x1747('0x38')](function(_0x28153e){_0x528209=_0x28153e;logger[_0x1747('0xa')]('Ticket\x20created!');logger['info'](_0x1747('0x64'),_0x528209['id']);return setRelationship(_0x2a47c2,_0x2c20a3,_0x528209,'users');})[_0x1747('0x38')](function(){return setRelationship(_0x2a47c2,_0x2ace9b,_0x528209,_0x1747('0x65'));})[_0x1747('0x38')](function(){return getServerInfo(_0x2a47c2);})[_0x1747('0x6b')](function(_0x364574){logger[_0x1747('0x74')]('['+_0x5c930e[_0x1747('0x76')][_0x1747('0x78')]()+']',JSON[_0x1747('0x1e')](_0x364574));});}; \ No newline at end of file +var _0x19d4=['version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','trigger:browser:url','lastevent','calleridnum','Inbound','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','created_by','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','push','idField','variableName','JSON','stringify','Calls','format','toString','base64','get_server_info','isNil','info','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','find','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','POST','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts'];(function(_0x55f140,_0x4a5d2e){var _0x33a112=function(_0x1b4c18){while(--_0x1b4c18){_0x55f140['push'](_0x55f140['shift']());}};_0x33a112(++_0x4a5d2e);}(_0x19d4,0x107));var _0x419d=function(_0x1a8254,_0x54eeb2){_0x1a8254=_0x1a8254-0x0;var _0x537eee=_0x19d4[_0x1a8254];return _0x537eee;};'use strict';var _=require(_0x419d('0x0'));var rp=require(_0x419d('0x1'));var BPromise=require(_0x419d('0x2'));var md5=require(_0x419d('0x3'));var util=require(_0x419d('0x4'));var Redis=require(_0x419d('0x5'));var intUtil=require(_0x419d('0x6'));var config=require(_0x419d('0x7'));var logger=require(_0x419d('0x8'))(_0x419d('0x9'));config[_0x419d('0xa')]=_[_0x419d('0xb')](config['redis'],{'host':_0x419d('0xc'),'port':0x18eb});var io=require(_0x419d('0xd'))(new Redis(config[_0x419d('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x4827d7,_0x2490a7,_0x5ddd25){io['to'](_0x4827d7)[_0x419d('0xe')](_0x2490a7,_0x5ddd25);}function getTicket(_0x5f4e5b,_0x3d3cff,_0x3315f4,_0x5ce58b,_0x363c2d,_0x2342fa,_0x1a4c01,_0x504424){logger['info'](_0x419d('0xf'));var _0x90774c=new Date();var _0x5b168d=[{'name':_0x419d('0x10'),'value':intUtil['getString'](_0x5ce58b['Subjects'],_0x363c2d,'\x20')},{'name':'assigned_user_id','value':_0x3d3cff['id']},{'name':_0x419d('0x11'),'value':_0x3d3cff['id']},{'name':_0x419d('0x12'),'value':intUtil['getString'](_0x5ce58b['Descriptions'],_0x363c2d,'\x0a')},{'name':_0x419d('0x13'),'value':_0x90774c[_0x419d('0x14')]()[_0x419d('0x15')](0x0,0x13)[_0x419d('0x16')]('T','\x20')},{'name':_0x419d('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x419d('0x18'),'value':_0x3315f4['id']},{'name':_0x419d('0x19'),'value':_0x419d('0x1a')},{'name':_0x419d('0x1b'),'value':_0x3315f4[_0x419d('0x10')]},{'name':_0x419d('0x1c'),'value':_0x504424}];if(_0x2342fa[_0x419d('0x1d')]){_['forEach'](_0x2342fa,function(_0x4d8d13){if(_0x363c2d[_0x4d8d13['variableName']]){_0x5b168d[_0x419d('0x1e')]({'name':_0x4d8d13[_0x419d('0x1f')],'value':_0x363c2d[_0x4d8d13[_0x419d('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x419d('0x21'),'response_type':_0x419d('0x21'),'rest_data':JSON[_0x419d('0x22')]({'session':_0x1a4c01['id'],'module_name':_0x419d('0x23'),'name_value_list':_0x5b168d})}});}function getAuth(_0xb15613){return util[_0x419d('0x24')]('Basic\x20%s',new Buffer(_0xb15613['apiKey']+':X')[_0x419d('0x25')](_0x419d('0x26')));}function getServerInfo(_0x579782){return request({'form':{'method':_0x419d('0x27'),'input_type':'JSON','response_type':_0x419d('0x21'),'rest_data':JSON[_0x419d('0x22')]({'session':_0x579782['id']})}});}function getUser(_0x5076f5,_0x39d685,_0x511142){if(!_[_0x419d('0x28')](_0x39d685)){logger[_0x419d('0x29')]('Getting\x20agent\x20with\x20name',_0x39d685);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x419d('0x21'),'rest_data':JSON[_0x419d('0x22')]({'session':_0x511142['id'],'module_name':'Employees','query':util[_0x419d('0x24')](_0x419d('0x2a'),_0x39d685),'order_by':'','offset':'0','select_fields':['id','name',_0x419d('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x419d('0x2c')](function(_0x5136af){if(_0x5136af[_0x419d('0x2d')]['length']){var _0x38897f=_['find'](_0x5136af[_0x419d('0x2d')],function(_0x1591e4){return _0x1591e4['name_value_list'][_0x419d('0x2b')][_0x419d('0x2e')]===_0x39d685;});if(_0x38897f){logger['info']('Agent\x20found!');return BPromise[_0x419d('0x2f')]({'id':_0x38897f[_0x419d('0x30')]['id'][_0x419d('0x2e')],'name':_0x38897f[_0x419d('0x30')][_0x419d('0x10')][_0x419d('0x2e')]});}}logger[_0x419d('0x29')](_0x419d('0x31'));return BPromise[_0x419d('0x2f')]({'id':_0x511142[_0x419d('0x30')][_0x419d('0x32')]['value'],'name':_0x511142['name_value_list'][_0x419d('0x2b')]['value']});});}else{logger[_0x419d('0x29')](_0x419d('0x33'));return BPromise[_0x419d('0x2f')]({'id':_0x511142[_0x419d('0x30')][_0x419d('0x32')][_0x419d('0x2e')],'name':_0x511142[_0x419d('0x30')][_0x419d('0x2b')][_0x419d('0x2e')]});}}function getEndUser(_0x7b5352,_0x4ab7de,_0x20d5be,_0x1e93e7){logger['info'](_0x419d('0x34'),_0x20d5be);return request({'form':{'method':_0x419d('0x35'),'input_type':_0x419d('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1e93e7['id'],'module_name':_0x419d('0x1a'),'query':util[_0x419d('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x20d5be),'order_by':'','offset':'0','select_fields':['id',_0x419d('0x10'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x419d('0x2c')](function(_0x547c71){if(_0x547c71[_0x419d('0x2d')]['length']){var _0x4fb68a=_[_0x419d('0x36')](_0x547c71[_0x419d('0x2d')],function(_0x20a1ec){return _0x20a1ec[_0x419d('0x30')]['phone_home'][_0x419d('0x2e')]===_0x20d5be;});if(_0x4fb68a){logger[_0x419d('0x29')]('Enduser\x20found!');return BPromise[_0x419d('0x2f')]({'id':_0x4fb68a['name_value_list']['id'][_0x419d('0x2e')],'name':_0x4fb68a[_0x419d('0x30')]['name'][_0x419d('0x2e')],'phone':_0x4fb68a['name_value_list'][_0x419d('0x37')][_0x419d('0x2e')]});}}else{logger[_0x419d('0x29')](_0x419d('0x38'));return request({'form':{'method':'set_entry','input_type':_0x419d('0x21'),'response_type':_0x419d('0x21'),'rest_data':JSON[_0x419d('0x22')]({'session':_0x1e93e7['id'],'module_name':_0x419d('0x1a'),'name_value_list':[{'name':_0x419d('0x39'),'value':_0x4ab7de!==_0x419d('0x3a')?_0x4ab7de:util[_0x419d('0x24')](_0x419d('0x3b'),_0x20d5be)},{'name':_0x419d('0x37'),'value':_0x20d5be}]})}})['then'](function(_0x502b5c){logger[_0x419d('0x29')](_0x419d('0x3c'));return BPromise[_0x419d('0x2f')]({'id':_0x502b5c['id'],'name':_0x502b5c[_0x419d('0x2d')]['first_name'][_0x419d('0x2e')],'phone':_0x502b5c[_0x419d('0x2d')]['phone_home'][_0x419d('0x2e')]});});}});}function request(_0x2281eb){logger[_0x419d('0x3d')](_0x419d('0x3e'),JSON[_0x419d('0x22')](_0x2281eb));return rp(_[_0x419d('0x3f')](def,_0x2281eb));}function getTags(_0x178e3b,_0x58e314){var _0x27ed5c=[];if(_0x178e3b&&_0x178e3b[_0x419d('0x1d')]>0x0){_0x27ed5c=_[_0x419d('0x40')](_0x178e3b,_0x58e314);}return _0x27ed5c;}function getCustomFields(_0x3b3f43,_0x14e4b4){var _0x2a1f45=[];var _0x224d75={'custom_fields':[]};if(_0x3b3f43[_0x419d('0x1d')]>0x0){_['forEach'](_0x3b3f43,function(_0x29f209){if(_0x29f209[_0x419d('0x41')]===_0x419d('0x42')&&_0x29f209[_0x419d('0x43')]&&!_0x29f209[_0x419d('0x44')]){_0x224d75[_0x29f209['nameField'][_0x419d('0x45')]()]=_0x29f209[_0x419d('0x46')][_0x419d('0x25')]();}else if(_0x29f209['type']===_0x419d('0x42')&&_0x29f209[_0x419d('0x1f')]&&_0x29f209[_0x419d('0x44')]){_0x224d75[_0x419d('0x47')][_0x419d('0x1e')]({'id':_0x29f209[_0x419d('0x1f')],'value':_0x29f209['content'][_0x419d('0x25')]()});}else if(_0x29f209['type']===_0x419d('0x48')&&_0x29f209[_0x419d('0x20')]&&_0x29f209[_0x419d('0x1f')]&&_0x29f209['customField']){_0x14e4b4[_0x29f209[_0x419d('0x20')]]&&_0x224d75[_0x419d('0x47')][_0x419d('0x1e')]({'id':_0x29f209[_0x419d('0x1f')],'value':_0x14e4b4[_0x29f209['variableName']][_0x419d('0x25')]()});}else if(_0x29f209[_0x419d('0x41')]===_0x419d('0x49')&&_0x29f209['Variable']&&_0x29f209[_0x419d('0x4a')][_0x419d('0x10')]&&_0x29f209[_0x419d('0x1f')]&&_0x29f209[_0x419d('0x44')]){_0x14e4b4[_0x29f209[_0x419d('0x4a')][_0x419d('0x10')][_0x419d('0x45')]()]&&_0x224d75[_0x419d('0x47')][_0x419d('0x1e')]({'id':_0x29f209['idField'],'value':_0x14e4b4[_0x29f209[_0x419d('0x4a')][_0x419d('0x10')]['toLowerCase']()]['toString']()});}});}return _0x224d75;}function getConnection(_0x16a3ed){return request({'method':_0x419d('0x4b'),'form':{'method':_0x419d('0x4c'),'input_type':_0x419d('0x21'),'response_type':_0x419d('0x21'),'rest_data':JSON[_0x419d('0x22')]({'user_auth':{'user_name':_0x16a3ed[_0x419d('0x4d')],'password':_0x16a3ed['password'],'encryption':_0x419d('0x4e')},'application':_0x419d('0x4f')})}})[_0x419d('0x2c')](function(_0x27f0fa){var _0x17288b=_0x27f0fa;if(_0x17288b['id']){def[_0x419d('0x50')]=_0x17288b['id'];return BPromise[_0x419d('0x2f')](_0x17288b);}else{throw new Error(util[_0x419d('0x24')](_0x419d('0x51'),_0x16a3ed['id']));}});}function setRelationship(_0x58c904,_0x339225,_0x41b0c7,_0x47b289){return request({'form':{'method':_0x419d('0x52'),'input_type':'JSON','response_type':_0x419d('0x21'),'rest_data':JSON[_0x419d('0x22')]({'session':_0x58c904['id'],'module_name':_0x419d('0x23'),'module_id':_0x41b0c7['id'],'link_field_name':_0x47b289,'related_ids':[_0x339225['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x47fc6b,_0xd3b511,_0x4fdff5,_0x4f6072,_0x251a39,_0x552f0c){var _0x437e45,_0x214cdd,_0x5a38a7,_0x30106f;_0x552f0c['remoteUri']=intUtil[_0x419d('0x53')](_0x552f0c[_0x419d('0x54')]);_0x552f0c[_0x419d('0x55')]=intUtil[_0x419d('0x53')](_0x552f0c[_0x419d('0x55')]);def['uri']=util['format'](_0x419d('0x56'),_0x552f0c[_0x419d('0x54')]);if(_0x251a39&&_0x251a39[_0x419d('0x57')]){logger[_0x419d('0x29')]('[QUEUE]',_0x419d('0x58'));_0xd3b511[_0x419d('0x59')]=util[_0x419d('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x552f0c[_0x419d('0x55')],_0xd3b511['uniqueid'],md5(_0xd3b511[_0x419d('0x5a')]));}else{_0xd3b511[_0x419d('0x59')]='';}return getConnection(_0x552f0c)[_0x419d('0x2c')](function(_0x78305d){_0x30106f=_0x78305d;return getUser(_0x552f0c,_0x4f6072[_0x419d('0x10')],_0x30106f);})[_0x419d('0x2c')](function(_0x3c749c){_0x437e45=_0x3c749c;logger['info']('The\x20User\x20ID\x20is:',_0x437e45['id']);return getEndUser(_0x552f0c,_0xd3b511[_0x419d('0x5b')],_0xd3b511['calleridnum'],_0x30106f);})[_0x419d('0x2c')](function(_0x3fbcb4){_0x214cdd=_0x3fbcb4;logger[_0x419d('0x29')]('The\x20Enduser\x20ID\x20is:',_0x214cdd['id']);return getTicket(_0x552f0c,_0x437e45,_0x214cdd,_0x4fdff5,_0xd3b511,_0x4fdff5[_0x419d('0x5c')],_0x30106f,'Inbound');})['then'](function(_0x175720){_0x5a38a7=_0x175720;logger[_0x419d('0x29')](_0x419d('0x5d'));logger[_0x419d('0x29')](_0x419d('0x5e'),_0x5a38a7['id']);return setRelationship(_0x30106f,_0x437e45,_0x5a38a7,_0x419d('0x5f'));})['then'](function(){return setRelationship(_0x30106f,_0x214cdd,_0x5a38a7,_0x419d('0x60'));})[_0x419d('0x2c')](function(){return getServerInfo(_0x30106f);})[_0x419d('0x2c')](function(_0x41da39){var _0xcbc978=parseInt(_0x41da39[_0x419d('0x61')][_0x419d('0x62')](0x0));var _0x5df3d8=util[_0x419d('0x24')](_0x419d('0x63'),_0x552f0c['remoteUri'],_0x5a38a7['id']);if(_0xcbc978>0x6){_0x5df3d8=util[_0x419d('0x24')](_0x419d('0x64'),_0x552f0c[_0x419d('0x54')],_0x5a38a7['id']);}logger['info'](_0x419d('0x65'),_0x419d('0x66'));emit(util['format'](_0x419d('0x67'),_0x4f6072['name']),'trigger:browser:url',{'uri':_0x5df3d8});})[_0x419d('0x68')](function(_0x3b991c){logger[_0x419d('0x69')](_0x419d('0x65'),JSON[_0x419d('0x22')](_0x3b991c));});};exports[_0x419d('0x6a')]=function(_0x433f41,_0x2611a4,_0x2af929,_0x24b97b,_0x23944d,_0x414fce,_0xbccdde){var _0x29ea53,_0x38b9aa,_0x245018,_0xea5d2;_0x414fce[_0x419d('0x54')]=intUtil[_0x419d('0x53')](_0x414fce[_0x419d('0x54')]);_0x414fce[_0x419d('0x55')]=intUtil[_0x419d('0x53')](_0x414fce[_0x419d('0x55')]);def[_0x419d('0x6b')]=util[_0x419d('0x24')](_0x419d('0x56'),_0x414fce[_0x419d('0x54')]);if(_0xbccdde&&_0xbccdde[_0x419d('0x6c')]&&_0xbccdde[_0x419d('0x6c')]!==_0x419d('0x6d')){logger[_0x419d('0x29')](_0x419d('0x6e'),_0x419d('0x58'));_0x2611a4[_0x419d('0x59')]=util[_0x419d('0x24')](_0x419d('0x6f'),_0x414fce[_0x419d('0x55')],_0x2611a4['uniqueid'],md5(_0x2611a4[_0x419d('0x5a')]));}return getConnection(_0x414fce)[_0x419d('0x2c')](function(_0x7d92fb){_0xea5d2=_0x7d92fb;return getUser(_0x414fce,_0x24b97b['name'],_0xea5d2);})[_0x419d('0x2c')](function(_0x2edd3d){_0x29ea53=_0x2edd3d;logger[_0x419d('0x29')](_0x419d('0x70'),_0x29ea53['id']);return getEndUser(_0x414fce,_0x2611a4[_0x419d('0x71')],_0x2611a4['destcalleridnum'],_0xea5d2);})[_0x419d('0x2c')](function(_0x2c627b){_0x38b9aa=_0x2c627b;logger['info'](_0x419d('0x72'),_0x38b9aa['id']);return getTicket(_0x414fce,_0x29ea53,_0x38b9aa,_0x2af929,_0x2611a4,_0x2af929['Fields'],_0xea5d2,'Outbound');})[_0x419d('0x2c')](function(_0x5d347c){_0x245018=_0x5d347c;logger['info'](_0x419d('0x5d'));logger[_0x419d('0x29')](_0x419d('0x5e'),_0x245018['id']);return setRelationship(_0xea5d2,_0x29ea53,_0x245018,'users');})[_0x419d('0x2c')](function(){return setRelationship(_0xea5d2,_0x38b9aa,_0x245018,'contacts');})[_0x419d('0x2c')](function(){return getServerInfo(_0xea5d2);})['then'](function(_0x597a71){var _0x2eeb34=parseInt(_0x597a71[_0x419d('0x61')]['charAt'](0x0));var _0x52975c=util[_0x419d('0x24')](_0x419d('0x63'),_0x414fce[_0x419d('0x54')],_0x245018['id']);if(_0x2eeb34>0x6){_0x52975c=util['format'](_0x419d('0x64'),_0x414fce[_0x419d('0x54')],_0x245018['id']);}logger[_0x419d('0x29')](_0x419d('0x6e'),_0x419d('0x66'));emit(util['format']('user:%s',_0x24b97b[_0x419d('0x10')]),_0x419d('0x73'),{'uri':_0x52975c});})['catch'](function(_0x468d8f){logger[_0x419d('0x69')](_0x419d('0x6e'),JSON[_0x419d('0x22')](_0x468d8f));});};exports['unmanaged']=function(_0x83a5a3,_0x3dac9c,_0x504b68,_0x1eb106,_0x36db71,_0xd414b8){var _0x24c635,_0x5a8cbb,_0x450299,_0x529cc3;_0xd414b8['remoteUri']=intUtil[_0x419d('0x53')](_0xd414b8[_0x419d('0x54')]);_0xd414b8[_0x419d('0x55')]=intUtil['stripTrailingSlash'](_0xd414b8[_0x419d('0x55')]);def[_0x419d('0x6b')]=util['format']('%s/service/v4_1/rest.php',_0xd414b8[_0x419d('0x54')]);if(_0x36db71&&_0x36db71[_0x419d('0x57')]){logger[_0x419d('0x29')]('['+_0x3dac9c[_0x419d('0x74')]['toUpperCase']()+']',_0x419d('0x58'));_0x3dac9c[_0x419d('0x59')]=util['format'](_0x419d('0x6f'),_0xd414b8[_0x419d('0x55')],_0x3dac9c[_0x419d('0x5a')],md5(_0x3dac9c[_0x419d('0x5a')]));}else{_0x3dac9c[_0x419d('0x59')]='';}return getConnection(_0xd414b8)[_0x419d('0x2c')](function(_0x4c6b43){_0x529cc3=_0x4c6b43;if(!_[_0x419d('0x28')](_0x1eb106)){return getUser(_0xd414b8,_0x1eb106['name'],_0x529cc3);}else{return getUser(_0xd414b8,null,_0x529cc3);}})['then'](function(_0x2eb7fa){_0x24c635=_0x2eb7fa;logger[_0x419d('0x29')](_0x419d('0x70'),_0x24c635['id']);return getEndUser(_0xd414b8,_0x3dac9c['calleridname'],_0x3dac9c[_0x419d('0x75')],_0x529cc3);})[_0x419d('0x2c')](function(_0x1081c3){_0x5a8cbb=_0x1081c3;logger[_0x419d('0x29')](_0x419d('0x72'),_0x5a8cbb['id']);return getTicket(_0xd414b8,_0x24c635,_0x5a8cbb,_0x504b68,_0x3dac9c,_0x504b68['Fields'],_0x529cc3,_0x419d('0x76'));})[_0x419d('0x2c')](function(_0x83ae4b){_0x450299=_0x83ae4b;logger['info'](_0x419d('0x5d'));logger['info'](_0x419d('0x5e'),_0x450299['id']);return setRelationship(_0x529cc3,_0x24c635,_0x450299,_0x419d('0x5f'));})[_0x419d('0x2c')](function(){return setRelationship(_0x529cc3,_0x5a8cbb,_0x450299,_0x419d('0x60'));})[_0x419d('0x2c')](function(){return getServerInfo(_0x529cc3);})['catch'](function(_0x20d1ae){logger[_0x419d('0x69')]('['+_0x3dac9c[_0x419d('0x74')][_0x419d('0x77')]()+']',JSON[_0x419d('0x22')](_0x20d1ae));});}; \ 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 dffe2f5..f8ffab8 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 _0x2651=['keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','lastIndexOf','isNil','test','lodash','getString','sortBy','length','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x4c7be4,_0x3e314b){var _0x39e2d1=function(_0x4da425){while(--_0x4da425){_0x4c7be4['push'](_0x4c7be4['shift']());}};_0x39e2d1(++_0x3e314b);}(_0x2651,0xc1));var _0x1265=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x2651[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x1265('0x0'));var util=require('util');exports[_0x1265('0x1')]=function(_0x3ad127,_0x1fbf48,_0x41236a){var _0x2fc638=[];if(_0x3ad127['length']>0x0){var _0x447294=_[_0x1265('0x2')](_0x3ad127,['id']);for(var _0x51ea1c=0x0;_0x51ea1c<_0x447294[_0x1265('0x3')];_0x51ea1c++){var _0xdea988=_0x447294[_0x51ea1c];if(_0xdea988[_0x1265('0x4')]==='string'){_0x2fc638[_0x1265('0x5')](_0xdea988[_0x1265('0x6')]);}else if(_0xdea988[_0x1265('0x4')]===_0x1265('0x7')&&_0xdea988['variableName']){_0x1fbf48[_0xdea988[_0x1265('0x8')]]&&_0x2fc638[_0x1265('0x5')](_0x1fbf48[_0xdea988[_0x1265('0x8')]][_0x1265('0x9')]());}else if(_0xdea988[_0x1265('0x4')]===_0x1265('0xa')&&_0xdea988['Variable']&&_0xdea988[_0x1265('0xb')][_0x1265('0xc')]){_0x1fbf48[_0xdea988[_0x1265('0xb')][_0x1265('0xc')]['toLowerCase']()]&&_0x2fc638['push'](_0x1fbf48[_0xdea988[_0x1265('0xb')][_0x1265('0xc')][_0x1265('0xd')]()][_0x1265('0x9')]());}else if(_0xdea988['type']===_0x1265('0xe')){if(_0xdea988[_0x1265('0xf')]===_0x1265('0x10')&&_0xdea988[_0x1265('0x11')]){_0x2fc638['push'](util[_0x1265('0x12')](_0x1265('0x13'),_0xdea988[_0x1265('0x11')],_0xdea988[_0x1265('0x14')]));}else if(_0xdea988[_0x1265('0xf')]==='variable'&&_0xdea988[_0x1265('0x8')]&&_0xdea988[_0x1265('0x11')]){_0x1fbf48[_0xdea988['variableName']]&&_0x2fc638[_0x1265('0x5')](util[_0x1265('0x12')](_0x1265('0x13'),_0xdea988[_0x1265('0x11')],_0x1fbf48[_0xdea988[_0x1265('0x8')]]));}else if(_0xdea988['keyType']===_0x1265('0xa')&&_0xdea988[_0x1265('0xb')]&&_0xdea988[_0x1265('0xb')][_0x1265('0xc')]&&_0xdea988[_0x1265('0x11')]){_0x1fbf48[_0xdea988[_0x1265('0xb')][_0x1265('0xc')][_0x1265('0xd')]()]&&_0x2fc638['push'](util['format'](_0x1265('0x13'),_0xdea988['key'],_0x1fbf48[_0xdea988[_0x1265('0xb')][_0x1265('0xc')][_0x1265('0xd')]()]));}}}}return _0x2fc638[_0x1265('0x15')](_0x41236a);};exports[_0x1265('0x16')]=function(_0xec8f9b){var _0x4c7106=_0xec8f9b['slice'](-0x1);if(_0x4c7106==='/'){_0xec8f9b=_0xec8f9b['substring'](0x0,_0xec8f9b[_0x1265('0x17')](_0x4c7106));}return _0xec8f9b;};exports['validateEmail']=function(_0xd0b349){if(!_[_0x1265('0x18')](_0xd0b349)&&_0xd0b349!==''){var _0xd7c036=/^(([^<>()\[\]\\.,;:\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 _0xd7c036[_0x1265('0x19')](String(_0xd0b349)[_0x1265('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xe46b=['length','sortBy','type','string','content','variableName','customVariable','Variable','name','toLowerCase','push','keyValue','keyType','key','keyContent','variable','format','%s:\x20%s','substring','lastIndexOf','validateEmail','test','lodash','util'];(function(_0x2679a3,_0x5ebce8){var _0x2df3d8=function(_0x4c612b){while(--_0x4c612b){_0x2679a3['push'](_0x2679a3['shift']());}};_0x2df3d8(++_0x5ebce8);}(_0xe46b,0x76));var _0xbe46=function(_0x46c0e9,_0x36d816){_0x46c0e9=_0x46c0e9-0x0;var _0x20f897=_0xe46b[_0x46c0e9];return _0x20f897;};'use strict';var _=require(_0xbe46('0x0'));var util=require(_0xbe46('0x1'));exports['getString']=function(_0x368c55,_0x4e2275,_0x4c8627){var _0x52517a=[];if(_0x368c55[_0xbe46('0x2')]>0x0){var _0x2210c4=_[_0xbe46('0x3')](_0x368c55,['id']);for(var _0x47fd5f=0x0;_0x47fd5f<_0x2210c4[_0xbe46('0x2')];_0x47fd5f++){var _0x26ceca=_0x2210c4[_0x47fd5f];if(_0x26ceca[_0xbe46('0x4')]===_0xbe46('0x5')){_0x52517a['push'](_0x26ceca[_0xbe46('0x6')]);}else if(_0x26ceca['type']==='variable'&&_0x26ceca[_0xbe46('0x7')]){_0x4e2275[_0x26ceca[_0xbe46('0x7')]]&&_0x52517a['push'](_0x4e2275[_0x26ceca['variableName']]['toString']());}else if(_0x26ceca[_0xbe46('0x4')]===_0xbe46('0x8')&&_0x26ceca[_0xbe46('0x9')]&&_0x26ceca[_0xbe46('0x9')][_0xbe46('0xa')]){_0x4e2275[_0x26ceca['Variable'][_0xbe46('0xa')][_0xbe46('0xb')]()]&&_0x52517a[_0xbe46('0xc')](_0x4e2275[_0x26ceca[_0xbe46('0x9')][_0xbe46('0xa')][_0xbe46('0xb')]()]['toString']());}else if(_0x26ceca[_0xbe46('0x4')]===_0xbe46('0xd')){if(_0x26ceca[_0xbe46('0xe')]===_0xbe46('0x5')&&_0x26ceca[_0xbe46('0xf')]){_0x52517a[_0xbe46('0xc')](util['format']('%s:\x20%s',_0x26ceca['key'],_0x26ceca[_0xbe46('0x10')]));}else if(_0x26ceca[_0xbe46('0xe')]===_0xbe46('0x11')&&_0x26ceca[_0xbe46('0x7')]&&_0x26ceca[_0xbe46('0xf')]){_0x4e2275[_0x26ceca[_0xbe46('0x7')]]&&_0x52517a[_0xbe46('0xc')](util[_0xbe46('0x12')]('%s:\x20%s',_0x26ceca[_0xbe46('0xf')],_0x4e2275[_0x26ceca[_0xbe46('0x7')]]));}else if(_0x26ceca[_0xbe46('0xe')]==='customVariable'&&_0x26ceca[_0xbe46('0x9')]&&_0x26ceca[_0xbe46('0x9')][_0xbe46('0xa')]&&_0x26ceca[_0xbe46('0xf')]){_0x4e2275[_0x26ceca['Variable']['name']['toLowerCase']()]&&_0x52517a[_0xbe46('0xc')](util['format'](_0xbe46('0x13'),_0x26ceca['key'],_0x4e2275[_0x26ceca[_0xbe46('0x9')][_0xbe46('0xa')]['toLowerCase']()]));}}}}return _0x52517a['join'](_0x4c8627);};exports['stripTrailingSlash']=function(_0x34cabd){var _0x165cfe=_0x34cabd['slice'](-0x1);if(_0x165cfe==='/'){_0x34cabd=_0x34cabd[_0xbe46('0x14')](0x0,_0x34cabd[_0xbe46('0x15')](_0x165cfe));}return _0x34cabd;};exports[_0xbe46('0x16')]=function(_0x262cae){if(!_['isNil'](_0x262cae)&&_0x262cae!==''){var _0x3f5eca=/^(([^<>()\[\]\\.,;:\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 _0x3f5eca[_0xbe46('0x17')](String(_0x262cae)[_0xbe46('0xb')]());}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 55c72be..ef13003 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x56cdc6,_0x50ba73){var _0x2dba5a=function(_0x44f255){while(--_0x44f255){_0x56cdc6['push'](_0x56cdc6['shift']());}};_0x2dba5a(++_0x50ba73);}(_0xe706,0xa3));var _0x6e70=function(_0x1f1bf8,_0x48c57d){_0x1f1bf8=_0x1f1bf8-0x0;var _0xcefd99=_0xe706[_0x1f1bf8];return _0xcefd99;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x13baf8,_0x3c906a){var _0x5545d1=function(_0xa738e4){while(--_0xa738e4){_0x13baf8['push'](_0x13baf8['shift']());}};_0x5545d1(++_0x3c906a);}(_0xe706,0xa3));var _0x6e70=function(_0x1b40b5,_0x25e063){_0x1b40b5=_0x1b40b5-0x0;var _0x5f0a6e=_0xe706[_0x1b40b5];return _0x5f0a6e;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4b37c7e..dedcf9c 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 _0xb05e=['toLowerCase','includes','custom_fields','idField','content','toString','type','variable','variableName','push','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:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/agent/tickets/%s','catch','inspect','toUpperCase','calleridname','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','%s:%s','username','password','authType','token','%s/token:%s','base64','stringify','GET','map','forEach','string','picklist','customField','nameField'];(function(_0xcd5094,_0x4cffa4){var _0x54ba35=function(_0x2bfe43){while(--_0x2bfe43){_0xcd5094['push'](_0xcd5094['shift']());}};_0x54ba35(++_0x4cffa4);}(_0xb05e,0x109));var _0xeb05=function(_0x31a70d,_0x1cdbac){_0x31a70d=_0x31a70d-0x0;var _0x57b422=_0xb05e[_0x31a70d];return _0x57b422;};'use strict';var _=require(_0xeb05('0x0'));var rp=require(_0xeb05('0x1'));var md5=require(_0xeb05('0x2'));var util=require(_0xeb05('0x3'));var Redis=require('ioredis');var intUtil=require(_0xeb05('0x4'));var config=require('../../../../config/environment');var logger=require(_0xeb05('0x5'))('zendesk');config['redis']=_[_0xeb05('0x6')](config[_0xeb05('0x7')],{'host':_0xeb05('0x8'),'port':0x18eb});var io=require(_0xeb05('0x9'))(new Redis(config[_0xeb05('0x7')]));function emit(_0x5b9147,_0x47853,_0x33989e){io['to'](_0x5b9147)[_0xeb05('0xa')](_0x47853,_0x33989e);}var headers={'Content-Type':_0xeb05('0xb'),'Accept':_0xeb05('0xb')};function getTicket(_0x1bf19d,_0x86f753,_0x399c1c,_0x19340e,_0x16bab9){logger[_0xeb05('0xc')](_0xeb05('0xd'));return request({'uri':util[_0xeb05('0xe')](_0xeb05('0xf'),_0x1bf19d[_0xeb05('0x10')]),'method':_0xeb05('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x399c1c['id'],'submitter_id':_0x86f753?_0x86f753['id']:undefined,'assignee_id':_0x86f753?_0x86f753['id']:undefined,'tags':getTags(_0x19340e[_0xeb05('0x12')],_0xeb05('0x13')),'subject':intUtil[_0xeb05('0x14')](_0x19340e[_0xeb05('0x15')],_0x16bab9,'\x20'),'description':intUtil['getString'](_0x19340e[_0xeb05('0x16')],_0x16bab9,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x19340e[_0xeb05('0x16')],_0x16bab9,'\x0a')}},getCustomFields(_0x19340e[_0xeb05('0x17')],_0x16bab9))}})[_0xeb05('0x18')](function(_0x3538da){logger[_0xeb05('0xc')](_0xeb05('0x19'));return _0x3538da[_0xeb05('0x1a')];});}function getUser(_0x52fad4,_0x10b093){if(intUtil[_0xeb05('0x1b')](_0x10b093)){logger[_0xeb05('0xc')](_0xeb05('0x1c'),_0x10b093);return request({'uri':util['format'](_0xeb05('0x1d'),_0x52fad4[_0xeb05('0x10')]),'qs':{'query':util[_0xeb05('0xe')](_0xeb05('0x1e'),_0x10b093)}})[_0xeb05('0x18')](function(_0x43137b){if(_0x43137b[_0xeb05('0x1f')]){logger[_0xeb05('0xc')]('Agent\x20found!');return _[_0xeb05('0x20')](_0x43137b[_0xeb05('0x21')],{'email':_0x10b093,'role':_0xeb05('0x22')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xeb05('0xe')](_0xeb05('0x23'),_0x52fad4[_0xeb05('0x10')])})[_0xeb05('0x18')](function(_0x519b3b){logger[_0xeb05('0xc')](_0xeb05('0x24'));return _0x519b3b['user'];});}});}else{logger['info'](_0xeb05('0x25'));return request({'uri':util[_0xeb05('0xe')]('%s/users/me.json',_0x52fad4[_0xeb05('0x10')])})[_0xeb05('0x18')](function(_0x387db7){logger[_0xeb05('0xc')](_0xeb05('0x24'));return _0x387db7[_0xeb05('0x26')];});}}function getEndUser(_0x187e5b,_0x16aaaa,_0x5b61c3){logger[_0xeb05('0xc')](_0xeb05('0x27'),_0x5b61c3);return request({'uri':util['format']('%s/search.json',_0x187e5b[_0xeb05('0x10')]),'qs':{'query':util[_0xeb05('0xe')](_0xeb05('0x28'),_0x5b61c3)}})[_0xeb05('0x18')](function(_0x1d42c2){var _0x4521a5;if(_0x1d42c2['results'][_0xeb05('0x29')]){_0x1d42c2[_0xeb05('0x21')]=_['filter'](_0x1d42c2[_0xeb05('0x21')],{'suspended':![],'role':_0xeb05('0x2a')});if(_0x1d42c2[_0xeb05('0x21')][_0xeb05('0x29')]){_0x4521a5=_['first'](_0x1d42c2[_0xeb05('0x21')]);}}if(_0x4521a5){logger[_0xeb05('0xc')](_0xeb05('0x2b'));return _0x4521a5;}else{logger[_0xeb05('0xc')](_0xeb05('0x2c'));return request({'uri':util[_0xeb05('0xe')](_0xeb05('0x2d'),_0x187e5b[_0xeb05('0x10')]),'method':_0xeb05('0x11'),'body':{'user':{'role':_0xeb05('0x2a'),'name':util['format'](_0xeb05('0x2e'),_0x16aaaa||_0x5b61c3),'phone':_0x5b61c3}}})[_0xeb05('0x18')](function(_0x1e58e0){logger['info']('Enduser\x20created.');return _0x1e58e0[_0xeb05('0x26')];});}});}function getAuth(_0x7a42a9){var _0x2feb3c;if(_0x7a42a9['authType']==='password'){_0x2feb3c=util[_0xeb05('0xe')](_0xeb05('0x2f'),_0x7a42a9[_0xeb05('0x30')],_0x7a42a9[_0xeb05('0x31')]);}else if(_0x7a42a9[_0xeb05('0x32')]===_0xeb05('0x33')){_0x2feb3c=util[_0xeb05('0xe')](_0xeb05('0x34'),_0x7a42a9[_0xeb05('0x30')],_0x7a42a9[_0xeb05('0x33')]);}return util['format']('Basic\x20%s',new Buffer(_0x2feb3c)['toString'](_0xeb05('0x35')));}function request(_0x5b3bb5){logger['debug']('[HTTP]',JSON[_0xeb05('0x36')](_0x5b3bb5));return rp(_[_0xeb05('0x6')](_0x5b3bb5,{'method':_0xeb05('0x37'),'headers':headers,'json':!![]}));}function getTags(_0xfeef9a,_0x3e4e02){var _0x49292b=[];if(_0xfeef9a&&_0xfeef9a['length']>0x0){_0x49292b=_[_0xeb05('0x38')](_0xfeef9a,_0x3e4e02);}return _0x49292b;}function getCustomFields(_0x100dbc,_0x129ab4){var _0x4f9da7=[];var _0x154ae9={'custom_fields':[]};if(_0x100dbc[_0xeb05('0x29')]>0x0){_[_0xeb05('0x39')](_0x100dbc,function(_0x3e2861){if(_['includes']([_0xeb05('0x3a'),_0xeb05('0x3b')],_0x3e2861['type'])&&_0x3e2861['nameField']&&!_0x3e2861[_0xeb05('0x3c')]){_0x154ae9[_0x3e2861[_0xeb05('0x3d')][_0xeb05('0x3e')]()]=_0x3e2861['content']['toString']();}else if(_[_0xeb05('0x3f')]([_0xeb05('0x3a'),_0xeb05('0x3b')],_0x3e2861['type'])&&_0x3e2861['idField']&&_0x3e2861[_0xeb05('0x3c')]){_0x154ae9[_0xeb05('0x40')]['push']({'id':_0x3e2861[_0xeb05('0x41')],'value':_0x3e2861[_0xeb05('0x42')][_0xeb05('0x43')]()});}else if(_0x3e2861[_0xeb05('0x44')]===_0xeb05('0x45')&&_0x3e2861[_0xeb05('0x46')]&&_0x3e2861['idField']&&_0x3e2861[_0xeb05('0x3c')]){_0x129ab4[_0x3e2861[_0xeb05('0x46')]]&&_0x154ae9[_0xeb05('0x40')][_0xeb05('0x47')]({'id':_0x3e2861[_0xeb05('0x41')],'value':_0x129ab4[_0x3e2861[_0xeb05('0x46')]][_0xeb05('0x43')]()});}else if(_0x3e2861[_0xeb05('0x44')]==='customVariable'&&_0x3e2861[_0xeb05('0x48')]&&_0x3e2861[_0xeb05('0x48')][_0xeb05('0x13')]&&_0x3e2861['idField']&&_0x3e2861[_0xeb05('0x3c')]){_0x129ab4[_0x3e2861[_0xeb05('0x48')][_0xeb05('0x13')][_0xeb05('0x3e')]()]&&_0x154ae9[_0xeb05('0x40')][_0xeb05('0x47')]({'id':_0x3e2861[_0xeb05('0x41')],'value':_0x129ab4[_0x3e2861[_0xeb05('0x48')][_0xeb05('0x13')]['toLowerCase']()][_0xeb05('0x43')]()});}});}return _0x154ae9;}exports[_0xeb05('0x49')]=function(_0x47f627,_0x35ae55,_0x4e58ed,_0x3acec2,_0xe84f69,_0x11f151){var _0x1495db,_0x584f67;_0x11f151[_0xeb05('0x10')]=intUtil[_0xeb05('0x4a')](_0x11f151[_0xeb05('0x10')]);_0x11f151[_0xeb05('0x4b')]=intUtil['stripTrailingSlash'](_0x11f151[_0xeb05('0x4b')]);if(_0xe84f69&&_0xe84f69[_0xeb05('0x4c')]){logger[_0xeb05('0xc')](_0xeb05('0x4d'),_0xeb05('0x4e'));_0x35ae55[_0xeb05('0x4f')]=util[_0xeb05('0xe')](_0xeb05('0x50'),_0x11f151[_0xeb05('0x4b')],_0x35ae55[_0xeb05('0x51')],md5(_0x35ae55['uniqueid']));}else{_0x35ae55['recordingURL']='';}headers[_0xeb05('0x52')]=getAuth(_0x11f151);return getUser(_0x11f151,_0x3acec2[_0xeb05('0x53')])[_0xeb05('0x18')](function(_0x475545){_0x1495db=_0x475545;logger[_0xeb05('0xc')](_0xeb05('0x54'),_0x1495db['id']);return getEndUser(_0x11f151,_0x35ae55['calleridname'],_0x35ae55['calleridnum']);})[_0xeb05('0x18')](function(_0x2eaca6){_0x584f67=_0x2eaca6;logger[_0xeb05('0xc')](_0xeb05('0x55'),_0x584f67['id']);return getTicket(_0x11f151,_0x1495db,_0x584f67,_0x4e58ed,_0x35ae55);})['then'](function(_0x52083b){if(_0x52083b){logger[_0xeb05('0xc')]('The\x20Ticket\x20ID\x20is:',_0x52083b['id']);switch(_0x11f151['type']){case'integrationTab':logger[_0xeb05('0xc')](_0xeb05('0x4d'),_0xeb05('0x56'));return request({'uri':util[_0xeb05('0xe')](_0xeb05('0x57'),_0x11f151['remoteUri'],_0x1495db['id'],_0x52083b['id']),'method':_0xeb05('0x11')});case'newTab':logger[_0xeb05('0xc')](_0xeb05('0x4d'),_0xeb05('0x58'));emit(util['format'](_0xeb05('0x59'),_0x3acec2['name']),_0xeb05('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x11f151[_0xeb05('0x10')][_0xeb05('0x5b')](_0xeb05('0x5c'),''),_0x52083b['id'])});break;default:logger['error']('[QUEUE]',_0xeb05('0x5d'));}}})['catch'](function(_0x2afb96){logger[_0xeb05('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2afb96,{'showHidden':!![],'depth':null}));});};exports[_0xeb05('0x5f')]=function(_0x177d02,_0x597248,_0x47b19d,_0x22debf,_0x3d7d06,_0x4d5f05,_0x396f81){var _0x5e9468,_0x459e7f;_0x4d5f05[_0xeb05('0x10')]=intUtil[_0xeb05('0x4a')](_0x4d5f05[_0xeb05('0x10')]);_0x4d5f05[_0xeb05('0x4b')]=intUtil['stripTrailingSlash'](_0x4d5f05[_0xeb05('0x4b')]);if(_0x396f81&&_0x396f81[_0xeb05('0x60')]&&_0x396f81[_0xeb05('0x60')]!=='none'){logger[_0xeb05('0xc')](_0xeb05('0x61'),_0xeb05('0x4e'));_0x597248[_0xeb05('0x4f')]=util[_0xeb05('0xe')](_0xeb05('0x50'),_0x4d5f05['serverUrl'],_0x597248[_0xeb05('0x51')],md5(_0x597248[_0xeb05('0x51')]));}headers['Authorization']=getAuth(_0x4d5f05);return getUser(_0x4d5f05,_0x22debf[_0xeb05('0x53')])['then'](function(_0x2d04f3){_0x5e9468=_0x2d04f3;logger[_0xeb05('0xc')]('The\x20User\x20ID\x20is:',_0x5e9468['id']);return getEndUser(_0x4d5f05,_0x597248['destcalleridname'],_0x597248[_0xeb05('0x62')]);})[_0xeb05('0x18')](function(_0x1619a9){_0x459e7f=_0x1619a9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x459e7f['id']);return getTicket(_0x4d5f05,_0x5e9468,_0x459e7f,_0x47b19d,_0x597248);})[_0xeb05('0x18')](function(_0x533388){if(_0x533388){logger['info'](_0xeb05('0x63'),_0x533388['id']);switch(_0x4d5f05[_0xeb05('0x44')]){case _0xeb05('0x64'):logger[_0xeb05('0xc')](_0xeb05('0x61'),_0xeb05('0x56'));return request({'uri':util[_0xeb05('0xe')](_0xeb05('0x57'),_0x4d5f05['remoteUri'],_0x5e9468['id'],_0x533388['id']),'method':_0xeb05('0x11')});case'newTab':logger[_0xeb05('0xc')](_0xeb05('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xeb05('0xe')]('user:%s',_0x22debf[_0xeb05('0x13')]),_0xeb05('0x5a'),{'uri':util['format'](_0xeb05('0x65'),_0x4d5f05[_0xeb05('0x10')]['replace'](_0xeb05('0x5c'),''),_0x533388['id'])});break;default:logger[_0xeb05('0x5e')](_0xeb05('0x61'),_0xeb05('0x5d'));}}})[_0xeb05('0x66')](function(_0x3386a){logger[_0xeb05('0x5e')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xeb05('0x67')](_0x3386a,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x188fa7,_0x2e4d64,_0x2bde1c,_0x329960,_0x5acfc7,_0x158061){var _0x4ed82a,_0x144d04;_0x158061[_0xeb05('0x10')]=intUtil['stripTrailingSlash'](_0x158061[_0xeb05('0x10')]);_0x158061[_0xeb05('0x4b')]=intUtil[_0xeb05('0x4a')](_0x158061['serverUrl']);if(_0x5acfc7&&_0x5acfc7[_0xeb05('0x4c')]){logger['info']('['+_0x2e4d64['lastevent'][_0xeb05('0x68')]()+']',_0xeb05('0x4e'));_0x2e4d64[_0xeb05('0x4f')]=util[_0xeb05('0xe')](_0xeb05('0x50'),_0x158061[_0xeb05('0x4b')],_0x2e4d64[_0xeb05('0x51')],md5(_0x2e4d64[_0xeb05('0x51')]));}else{_0x2e4d64[_0xeb05('0x4f')]='';}headers[_0xeb05('0x52')]=getAuth(_0x158061);return getUser(_0x158061)[_0xeb05('0x18')](function(_0x3e4251){_0x4ed82a=_0x3e4251;logger[_0xeb05('0xc')](_0xeb05('0x54'),_0x4ed82a['id']);return getEndUser(_0x158061,_0x2e4d64[_0xeb05('0x69')],_0x2e4d64[_0xeb05('0x6a')]);})[_0xeb05('0x18')](function(_0x198afd){_0x144d04=_0x198afd;logger[_0xeb05('0xc')](_0xeb05('0x55'),_0x144d04['id']);return getTicket(_0x158061,_0x4ed82a,_0x144d04,_0x2bde1c,_0x2e4d64);})['then'](function(_0xb1d7){if(_0xb1d7){logger[_0xeb05('0xc')](_0xeb05('0x63'),_0xb1d7['id']);}})[_0xeb05('0x66')](function(_0x2e7c5c){logger[_0xeb05('0x5e')]('['+_0x2e4d64[_0xeb05('0x6b')][_0xeb05('0x68')]()+']'+_0xeb05('0x6c'),util[_0xeb05('0x67')](_0x2e7c5c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd6a0=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]','POST','newTab','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','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','results','end-user','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','stringify','defaults','GET','map','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json'];(function(_0x3d675a,_0x1e141e){var _0x43399e=function(_0x1c10a0){while(--_0x1c10a0){_0x3d675a['push'](_0x3d675a['shift']());}};_0x43399e(++_0x1e141e);}(_0xd6a0,0x164));var _0x0d6a=function(_0x22645d,_0x30cf98){_0x22645d=_0x22645d-0x0;var _0x548ee5=_0xd6a0[_0x22645d];return _0x548ee5;};'use strict';var _=require('lodash');var rp=require(_0x0d6a('0x0'));var md5=require(_0x0d6a('0x1'));var util=require(_0x0d6a('0x2'));var Redis=require(_0x0d6a('0x3'));var intUtil=require(_0x0d6a('0x4'));var config=require(_0x0d6a('0x5'));var logger=require(_0x0d6a('0x6'))(_0x0d6a('0x7'));config[_0x0d6a('0x8')]=_['defaults'](config['redis'],{'host':_0x0d6a('0x9'),'port':0x18eb});var io=require(_0x0d6a('0xa'))(new Redis(config[_0x0d6a('0x8')]));function emit(_0x457126,_0x1fbf12,_0x44baa6){io['to'](_0x457126)['emit'](_0x1fbf12,_0x44baa6);}var headers={'Content-Type':_0x0d6a('0xb'),'Accept':'application/json'};function getTicket(_0x481db7,_0x5cce3a,_0xd0a30a,_0xbe7a23,_0x3e095f){logger[_0x0d6a('0xc')](_0x0d6a('0xd'));return request({'uri':util['format'](_0x0d6a('0xe'),_0x481db7['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0xd0a30a['id'],'submitter_id':_0x5cce3a?_0x5cce3a['id']:undefined,'assignee_id':_0x5cce3a?_0x5cce3a['id']:undefined,'tags':getTags(_0xbe7a23['Tags'],_0x0d6a('0xf')),'subject':intUtil[_0x0d6a('0x10')](_0xbe7a23[_0x0d6a('0x11')],_0x3e095f,'\x20'),'description':intUtil[_0x0d6a('0x10')](_0xbe7a23[_0x0d6a('0x12')],_0x3e095f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xbe7a23['Descriptions'],_0x3e095f,'\x0a')}},getCustomFields(_0xbe7a23[_0x0d6a('0x13')],_0x3e095f))}})[_0x0d6a('0x14')](function(_0x1b7339){logger[_0x0d6a('0xc')]('Ticket\x20created!');return _0x1b7339[_0x0d6a('0x15')];});}function getUser(_0x4b7c06,_0x5e7004){if(intUtil[_0x0d6a('0x16')](_0x5e7004)){logger[_0x0d6a('0xc')]('Getting\x20agent\x20with\x20email',_0x5e7004);return request({'uri':util[_0x0d6a('0x17')](_0x0d6a('0x18'),_0x4b7c06[_0x0d6a('0x19')]),'qs':{'query':util['format'](_0x0d6a('0x1a'),_0x5e7004)}})['then'](function(_0x452b19){if(_0x452b19[_0x0d6a('0x1b')]){logger['info']('Agent\x20found!');return _[_0x0d6a('0x1c')](_0x452b19['results'],{'email':_0x5e7004,'role':_0x0d6a('0x1d')});}else{logger[_0x0d6a('0xc')](_0x0d6a('0x1e'));return request({'uri':util['format'](_0x0d6a('0x1f'),_0x4b7c06[_0x0d6a('0x19')])})[_0x0d6a('0x14')](function(_0x595b25){logger[_0x0d6a('0xc')](_0x0d6a('0x20'));return _0x595b25[_0x0d6a('0x21')];});}});}else{logger[_0x0d6a('0xc')](_0x0d6a('0x1e'));return request({'uri':util[_0x0d6a('0x17')](_0x0d6a('0x1f'),_0x4b7c06['remoteUri'])})[_0x0d6a('0x14')](function(_0x443dbf){logger['info'](_0x0d6a('0x20'));return _0x443dbf[_0x0d6a('0x21')];});}}function getEndUser(_0x4e6632,_0x482200,_0x4722ab){logger['info'](_0x0d6a('0x22'),_0x4722ab);return request({'uri':util['format']('%s/search.json',_0x4e6632[_0x0d6a('0x19')]),'qs':{'query':util[_0x0d6a('0x17')](_0x0d6a('0x23'),_0x4722ab)}})['then'](function(_0x359ab5){var _0x136509;if(_0x359ab5[_0x0d6a('0x24')]['length']){_0x359ab5['results']=_['filter'](_0x359ab5['results'],{'suspended':![],'role':_0x0d6a('0x25')});if(_0x359ab5[_0x0d6a('0x24')]['length']){_0x136509=_['first'](_0x359ab5[_0x0d6a('0x24')]);}}if(_0x136509){logger['info'](_0x0d6a('0x26'));return _0x136509;}else{logger[_0x0d6a('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x0d6a('0x17')](_0x0d6a('0x27'),_0x4e6632[_0x0d6a('0x19')]),'method':'POST','body':{'user':{'role':_0x0d6a('0x25'),'name':util[_0x0d6a('0x17')](_0x0d6a('0x28'),_0x482200||_0x4722ab),'phone':_0x4722ab}}})[_0x0d6a('0x14')](function(_0x388519){logger[_0x0d6a('0xc')](_0x0d6a('0x29'));return _0x388519[_0x0d6a('0x21')];});}});}function getAuth(_0x244be2){var _0x49abfc;if(_0x244be2[_0x0d6a('0x2a')]===_0x0d6a('0x2b')){_0x49abfc=util[_0x0d6a('0x17')](_0x0d6a('0x2c'),_0x244be2[_0x0d6a('0x2d')],_0x244be2[_0x0d6a('0x2b')]);}else if(_0x244be2[_0x0d6a('0x2a')]===_0x0d6a('0x2e')){_0x49abfc=util['format'](_0x0d6a('0x2f'),_0x244be2[_0x0d6a('0x2d')],_0x244be2[_0x0d6a('0x2e')]);}return util[_0x0d6a('0x17')]('Basic\x20%s',new Buffer(_0x49abfc)[_0x0d6a('0x30')](_0x0d6a('0x31')));}function request(_0x601a20){logger[_0x0d6a('0x32')]('[HTTP]',JSON[_0x0d6a('0x33')](_0x601a20));return rp(_[_0x0d6a('0x34')](_0x601a20,{'method':_0x0d6a('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x5ba255,_0x37ca82){var _0x1f9184=[];if(_0x5ba255&&_0x5ba255['length']>0x0){_0x1f9184=_[_0x0d6a('0x36')](_0x5ba255,_0x37ca82);}return _0x1f9184;}function getCustomFields(_0x372db3,_0x1b4535){var _0xff144a=[];var _0x20a892={'custom_fields':[]};if(_0x372db3['length']>0x0){_['forEach'](_0x372db3,function(_0x4379ad){if(_[_0x0d6a('0x37')]([_0x0d6a('0x38'),'picklist'],_0x4379ad[_0x0d6a('0x39')])&&_0x4379ad[_0x0d6a('0x3a')]&&!_0x4379ad[_0x0d6a('0x3b')]){_0x20a892[_0x4379ad[_0x0d6a('0x3a')][_0x0d6a('0x3c')]()]=_0x4379ad[_0x0d6a('0x3d')][_0x0d6a('0x30')]();}else if(_['includes']([_0x0d6a('0x38'),_0x0d6a('0x3e')],_0x4379ad['type'])&&_0x4379ad[_0x0d6a('0x3f')]&&_0x4379ad[_0x0d6a('0x3b')]){_0x20a892[_0x0d6a('0x40')][_0x0d6a('0x41')]({'id':_0x4379ad[_0x0d6a('0x3f')],'value':_0x4379ad[_0x0d6a('0x3d')]['toString']()});}else if(_0x4379ad[_0x0d6a('0x39')]===_0x0d6a('0x42')&&_0x4379ad[_0x0d6a('0x43')]&&_0x4379ad['idField']&&_0x4379ad[_0x0d6a('0x3b')]){_0x1b4535[_0x4379ad[_0x0d6a('0x43')]]&&_0x20a892['custom_fields'][_0x0d6a('0x41')]({'id':_0x4379ad[_0x0d6a('0x3f')],'value':_0x1b4535[_0x4379ad[_0x0d6a('0x43')]][_0x0d6a('0x30')]()});}else if(_0x4379ad[_0x0d6a('0x39')]==='customVariable'&&_0x4379ad['Variable']&&_0x4379ad[_0x0d6a('0x44')][_0x0d6a('0xf')]&&_0x4379ad[_0x0d6a('0x3f')]&&_0x4379ad[_0x0d6a('0x3b')]){_0x1b4535[_0x4379ad['Variable'][_0x0d6a('0xf')][_0x0d6a('0x3c')]()]&&_0x20a892['custom_fields'][_0x0d6a('0x41')]({'id':_0x4379ad['idField'],'value':_0x1b4535[_0x4379ad[_0x0d6a('0x44')][_0x0d6a('0xf')][_0x0d6a('0x3c')]()][_0x0d6a('0x30')]()});}});}return _0x20a892;}exports[_0x0d6a('0x45')]=function(_0x7ad97,_0x43f726,_0x54320a,_0x953f3a,_0x4b2c70,_0x2d353e){var _0x5f00a6,_0x38db4b;_0x2d353e['remoteUri']=intUtil[_0x0d6a('0x46')](_0x2d353e['remoteUri']);_0x2d353e['serverUrl']=intUtil[_0x0d6a('0x46')](_0x2d353e[_0x0d6a('0x47')]);if(_0x4b2c70&&_0x4b2c70[_0x0d6a('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x43f726['recordingURL']=util[_0x0d6a('0x17')](_0x0d6a('0x49'),_0x2d353e['serverUrl'],_0x43f726[_0x0d6a('0x4a')],md5(_0x43f726['uniqueid']));}else{_0x43f726['recordingURL']='';}headers[_0x0d6a('0x4b')]=getAuth(_0x2d353e);return getUser(_0x2d353e,_0x953f3a[_0x0d6a('0x4c')])[_0x0d6a('0x14')](function(_0x515b1e){_0x5f00a6=_0x515b1e;logger[_0x0d6a('0xc')](_0x0d6a('0x4d'),_0x5f00a6['id']);return getEndUser(_0x2d353e,_0x43f726['calleridname'],_0x43f726['calleridnum']);})[_0x0d6a('0x14')](function(_0x21738a){_0x38db4b=_0x21738a;logger[_0x0d6a('0xc')](_0x0d6a('0x4e'),_0x38db4b['id']);return getTicket(_0x2d353e,_0x5f00a6,_0x38db4b,_0x54320a,_0x43f726);})[_0x0d6a('0x14')](function(_0xd91c74){if(_0xd91c74){logger[_0x0d6a('0xc')](_0x0d6a('0x4f'),_0xd91c74['id']);switch(_0x2d353e[_0x0d6a('0x39')]){case _0x0d6a('0x50'):logger[_0x0d6a('0xc')](_0x0d6a('0x51'),_0x0d6a('0x52'));return request({'uri':util['format'](_0x0d6a('0x53'),_0x2d353e[_0x0d6a('0x19')],_0x5f00a6['id'],_0xd91c74['id']),'method':'POST'});case'newTab':logger['info'](_0x0d6a('0x51'),_0x0d6a('0x54'));emit(util[_0x0d6a('0x17')](_0x0d6a('0x55'),_0x953f3a[_0x0d6a('0xf')]),_0x0d6a('0x56'),{'uri':util[_0x0d6a('0x17')](_0x0d6a('0x57'),_0x2d353e[_0x0d6a('0x19')][_0x0d6a('0x58')](_0x0d6a('0x59'),''),_0xd91c74['id'])});break;default:logger[_0x0d6a('0x5a')](_0x0d6a('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0d6a('0x5b')](function(_0x4e8208){logger[_0x0d6a('0x5a')](_0x0d6a('0x5c'),util[_0x0d6a('0x5d')](_0x4e8208,{'showHidden':!![],'depth':null}));});};exports[_0x0d6a('0x5e')]=function(_0x31563c,_0x151c97,_0x17a397,_0x11cf21,_0x271de2,_0x34919e,_0x32f6b5){var _0x2c4937,_0x4f56b1;_0x34919e[_0x0d6a('0x19')]=intUtil['stripTrailingSlash'](_0x34919e[_0x0d6a('0x19')]);_0x34919e[_0x0d6a('0x47')]=intUtil[_0x0d6a('0x46')](_0x34919e[_0x0d6a('0x47')]);if(_0x32f6b5&&_0x32f6b5[_0x0d6a('0x5f')]&&_0x32f6b5['recordingFormat']!==_0x0d6a('0x60')){logger[_0x0d6a('0xc')]('[OUTBOUND]',_0x0d6a('0x61'));_0x151c97[_0x0d6a('0x62')]=util['format'](_0x0d6a('0x49'),_0x34919e[_0x0d6a('0x47')],_0x151c97[_0x0d6a('0x4a')],md5(_0x151c97[_0x0d6a('0x4a')]));}headers['Authorization']=getAuth(_0x34919e);return getUser(_0x34919e,_0x11cf21[_0x0d6a('0x4c')])[_0x0d6a('0x14')](function(_0x49fa62){_0x2c4937=_0x49fa62;logger['info'](_0x0d6a('0x4d'),_0x2c4937['id']);return getEndUser(_0x34919e,_0x151c97[_0x0d6a('0x63')],_0x151c97[_0x0d6a('0x64')]);})[_0x0d6a('0x14')](function(_0x32cdd7){_0x4f56b1=_0x32cdd7;logger[_0x0d6a('0xc')](_0x0d6a('0x4e'),_0x4f56b1['id']);return getTicket(_0x34919e,_0x2c4937,_0x4f56b1,_0x17a397,_0x151c97);})[_0x0d6a('0x14')](function(_0x4d598a){if(_0x4d598a){logger['info'](_0x0d6a('0x4f'),_0x4d598a['id']);switch(_0x34919e['type']){case'integrationTab':logger[_0x0d6a('0xc')](_0x0d6a('0x65'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0d6a('0x17')](_0x0d6a('0x53'),_0x34919e[_0x0d6a('0x19')],_0x2c4937['id'],_0x4d598a['id']),'method':_0x0d6a('0x66')});case _0x0d6a('0x67'):logger[_0x0d6a('0xc')]('[OUTBOUND]',_0x0d6a('0x54'));emit(util[_0x0d6a('0x17')]('user:%s',_0x11cf21[_0x0d6a('0xf')]),'trigger:browser:url',{'uri':util['format'](_0x0d6a('0x57'),_0x34919e[_0x0d6a('0x19')][_0x0d6a('0x58')](_0x0d6a('0x59'),''),_0x4d598a['id'])});break;default:logger[_0x0d6a('0x5a')](_0x0d6a('0x65'),_0x0d6a('0x68'));}}})[_0x0d6a('0x5b')](function(_0x26c32c){logger[_0x0d6a('0x5a')](_0x0d6a('0x69'),util[_0x0d6a('0x5d')](_0x26c32c,{'showHidden':!![],'depth':null}));});};exports[_0x0d6a('0x6a')]=function(_0x54589e,_0x36ba67,_0xc9edec,_0x464ec1,_0x443ab9,_0x2c3a3d){var _0x32cd82,_0x6d12b3;_0x2c3a3d[_0x0d6a('0x19')]=intUtil['stripTrailingSlash'](_0x2c3a3d[_0x0d6a('0x19')]);_0x2c3a3d[_0x0d6a('0x47')]=intUtil[_0x0d6a('0x46')](_0x2c3a3d[_0x0d6a('0x47')]);if(_0x443ab9&&_0x443ab9['monitor_format']){logger['info']('['+_0x36ba67[_0x0d6a('0x6b')][_0x0d6a('0x6c')]()+']',_0x0d6a('0x61'));_0x36ba67[_0x0d6a('0x62')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c3a3d[_0x0d6a('0x47')],_0x36ba67[_0x0d6a('0x4a')],md5(_0x36ba67[_0x0d6a('0x4a')]));}else{_0x36ba67[_0x0d6a('0x62')]='';}headers['Authorization']=getAuth(_0x2c3a3d);return getUser(_0x2c3a3d)[_0x0d6a('0x14')](function(_0x5533b2){_0x32cd82=_0x5533b2;logger['info'](_0x0d6a('0x4d'),_0x32cd82['id']);return getEndUser(_0x2c3a3d,_0x36ba67[_0x0d6a('0x6d')],_0x36ba67['calleridnum']);})[_0x0d6a('0x14')](function(_0x4845d7){_0x6d12b3=_0x4845d7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x6d12b3['id']);return getTicket(_0x2c3a3d,_0x32cd82,_0x6d12b3,_0xc9edec,_0x36ba67);})['then'](function(_0x32bd23){if(_0x32bd23){logger[_0x0d6a('0xc')](_0x0d6a('0x4f'),_0x32bd23['id']);}})[_0x0d6a('0x5b')](function(_0x2533c8){logger[_0x0d6a('0x5a')]('['+_0x36ba67[_0x0d6a('0x6b')][_0x0d6a('0x6c')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x0d6a('0x5d')](_0x2533c8,{'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 d7e958c..ac93ca7 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 _0x0e7a=['info','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','Call\x20created!','stack','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','debug','stringify','length','forEach','includes','string','picklist','idField','content','toString','variableName','type','Variable','name','toLowerCase','indexOf','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.eu','POST','refreshToken','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','isArrayLikeObject','findIndex','email'];(function(_0x1e5354,_0x309302){var _0x21b00f=function(_0x3073b6){while(--_0x3073b6){_0x1e5354['push'](_0x1e5354['shift']());}};_0x21b00f(++_0x309302);}(_0x0e7a,0xff));var _0xa0e7=function(_0x5712fa,_0x3b7818){_0x5712fa=_0x5712fa-0x0;var _0x3d7e1b=_0x0e7a[_0x5712fa];return _0x3d7e1b;};'use strict';var _=require(_0xa0e7('0x0'));var rp=require(_0xa0e7('0x1'));var md5=require(_0xa0e7('0x2'));var util=require(_0xa0e7('0x3'));var intUtil=require('./util');var moment=require(_0xa0e7('0x4'));var Redis=require(_0xa0e7('0x5'));var BPromise=require(_0xa0e7('0x6'));var config=require(_0xa0e7('0x7'));var logger=require(_0xa0e7('0x8'))('zoho');config[_0xa0e7('0x9')]=_[_0xa0e7('0xa')](config[_0xa0e7('0x9')],{'host':_0xa0e7('0xb'),'port':0x18eb});var io=require(_0xa0e7('0xc'))(new Redis(config[_0xa0e7('0x9')]));function emit(_0x3a1986,_0x4f7a98,_0xef8303){io['to'](_0x3a1986)['emit'](_0x4f7a98,_0xef8303);}function request(_0xdab967){logger[_0xa0e7('0xd')]('[HTTP]',JSON[_0xa0e7('0xe')](_0xdab967));return rp(_0xdab967);}function getCustomFields(_0x16c2c6,_0x34b958){var _0x11cd0d={};if(_0x16c2c6[_0xa0e7('0xf')]>0x0){_[_0xa0e7('0x10')](_0x16c2c6,function(_0x35964c){if(_[_0xa0e7('0x11')]([_0xa0e7('0x12'),_0xa0e7('0x13')],_0x35964c['type'])&&_0x35964c[_0xa0e7('0x14')]){_0x11cd0d[_0x35964c[_0xa0e7('0x14')]]=_0x35964c[_0xa0e7('0x15')][_0xa0e7('0x16')]();}else if(_0x35964c['type']==='variable'&&_0x35964c[_0xa0e7('0x17')]&&_0x35964c[_0xa0e7('0x14')]&&_0x34b958[_0x35964c[_0xa0e7('0x17')]]){_0x11cd0d[_0x35964c[_0xa0e7('0x14')]]=_0x34b958[_0x35964c[_0xa0e7('0x17')]][_0xa0e7('0x16')]();}else if(_0x35964c[_0xa0e7('0x18')]==='customVariable'&&_0x35964c[_0xa0e7('0x19')]&&_0x35964c['Variable'][_0xa0e7('0x1a')]&&_0x35964c['idField']&&_0x34b958[_0x35964c['Variable'][_0xa0e7('0x1a')][_0xa0e7('0x1b')]()]){_0x11cd0d[_0x35964c[_0xa0e7('0x14')]]=_0x34b958[_0x35964c[_0xa0e7('0x19')][_0xa0e7('0x1a')][_0xa0e7('0x1b')]()][_0xa0e7('0x16')]();}});}return _0x11cd0d;}function getName(_0x47a7e5){if(_0x47a7e5[_0xa0e7('0x1c')]('\x20')>0x0){var _0x1b965a=_0x47a7e5['split'](/ (.+)/);if(_0x1b965a[0x1]){return _0x1b965a;}}return[_0x47a7e5,_0x47a7e5];}var accountsTokens={};function getAccessToken(_0x45affa){return new Promise(function(_0x277f66,_0x1c4712){if(!_[_0xa0e7('0x1d')](accountsTokens[_0x45affa['id']])&&!_[_0xa0e7('0x1d')](accountsTokens[_0x45affa['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x45affa['id']][_0xa0e7('0x1e')])){_0x277f66(accountsTokens[_0x45affa['id']][_0xa0e7('0x1f')]);}}var _0x12f261;switch(_0x45affa[_0xa0e7('0x20')]){case'US':_0x12f261=_0xa0e7('0x21');break;case'AU':_0x12f261='https://accounts.zoho.com.au';break;case'EU':_0x12f261=_0xa0e7('0x22');break;case'IN':_0x12f261='https://accounts.zoho.in';break;case'CN':_0x12f261='https://accounts.zoho.com.cn';break;default:_0x12f261=_0xa0e7('0x22');break;}var _0x38578f={'method':_0xa0e7('0x23'),'uri':_0x12f261+'/oauth/v2/token','qs':{'refresh_token':_0x45affa[_0xa0e7('0x24')],'client_id':_0x45affa['clientId'],'client_secret':_0x45affa['clientSecret'],'grant_type':_0xa0e7('0x25')},'json':!![]};return rp(_0x38578f)['then'](function(_0x1d0ac4){accountsTokens[_0x45affa['id']]={'access_token':_0x1d0ac4[_0xa0e7('0x1f')],'expires_in':moment()[_0xa0e7('0x26')](_0x1d0ac4[_0xa0e7('0x1e')],'seconds')};_0x277f66(_0x1d0ac4['access_token']);})[_0xa0e7('0x27')](function(_0x3f6b31){logger[_0xa0e7('0x28')](_0xa0e7('0x29'),_0x3f6b31['stack']);_0x1c4712(_0x3f6b31);});});}function getUser(_0x415084,_0x5bf934,_0xf7bf8,_0x3ef406){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format'](_0xa0e7('0x2a'),_0x5bf934),'qs':{'type':_0xa0e7('0x2b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x415084},'json':!![]})[_0xa0e7('0x2c')](function(_0xf0715a){if(_0xf0715a[_0xa0e7('0x2d')]){var _0x597565=-0x1;if(_[_0xa0e7('0x2e')](_0xf0715a[_0xa0e7('0x2d')])){if(!_['isNil'](_0x3ef406)){_0x597565=_[_0xa0e7('0x2f')](_0xf0715a[_0xa0e7('0x2d')],function(_0x53ad97){return _0x53ad97[_0xa0e7('0x30')]===_0x3ef406;});}if(_0x597565>=0x0){logger[_0xa0e7('0x31')]('Agent\x20found!');}else{logger[_0xa0e7('0x31')]('Using\x20the\x20admin\x20account!');_0x597565=_[_0xa0e7('0x2f')](_0xf0715a[_0xa0e7('0x2d')],function(_0x1fedc3){return _0x1fedc3[_0xa0e7('0x32')][_0xa0e7('0x1a')]===_0xa0e7('0x33');});}return _0xf0715a[_0xa0e7('0x2d')][_0x597565];}else{if(_0xf0715a[_0xa0e7('0x34')][_0xa0e7('0x32')][_0xa0e7('0x1a')]===_0xa0e7('0x33')){logger['info'](_0xa0e7('0x35'));user=_0xf0715a[_0xa0e7('0x34')];return user;}else{logger['error'](_0xa0e7('0x36'),JSON[_0xa0e7('0xe')](_0xf0715a));throw new Error(_0xa0e7('0x37')+JSON[_0xa0e7('0xe')](_0xf0715a));}}}else{logger[_0xa0e7('0x28')]('The\x20failing\x20result\x20is',JSON[_0xa0e7('0xe')](_0xf0715a));throw new Error(_0xa0e7('0x37')+JSON[_0xa0e7('0xe')](_0xf0715a));}})[_0xa0e7('0x27')](function(_0x13cd0b){console['error'](_0x13cd0b);});}function getZohoUser(_0x424bf7,_0x3cb5cf){return new BPromise(function(_0x23d0ff,_0x6bc09b){request(_0x424bf7)[_0xa0e7('0x2c')](function(_0x196085){var _0x3f34a5=null;if(_0x196085){_0x3f34a5=_0x196085[_0xa0e7('0x38')][0x0];_0x3f34a5[_0xa0e7('0x39')]=_0x3cb5cf;}_0x23d0ff(_0x3f34a5);})[_0xa0e7('0x27')](function(_0x100cb3){_0x6bc09b(_0x100cb3);});});}function createEndUser(_0xd6fc05,_0x3bc34a,_0x2ef3ff,_0x4dbdd4,_0x4de036,_0xd21d66){var _0x2ef3ff=getName(_0x2ef3ff);return request({'method':_0xa0e7('0x23'),'uri':_0xa0e7('0x3a')+_0x3bc34a+_0xa0e7('0x3b')+_[_0xa0e7('0x3c')](_0xd21d66[_0xa0e7('0x3d')])+'s','body':{'data':[{'Last_Name':_0x2ef3ff[0x1],'First_Name':_0x2ef3ff[0x0],'Phone':_0x4dbdd4,'Owner':{'name':!_[_0xa0e7('0x1d')](_0x4de036[_0xa0e7('0x3e')]['name'])?_0x4de036[_0xa0e7('0x3e')]['name']:!_[_0xa0e7('0x1d')](_0x4de036[_0xa0e7('0x3f')])?_0x4de036[_0xa0e7('0x3f')]+'\x20'+_0x4de036['last_name']:_0x4de036[_0xa0e7('0x40')],'id':_0x4de036['id']}}]},'headers':{'Authorization':_0xa0e7('0x41')+_0xd6fc05},'json':!![]})[_0xa0e7('0x2c')](function(_0x2cb24c){if(_0x2cb24c&&_0x2cb24c[_0xa0e7('0x38')][0x0][_0xa0e7('0x42')]===_0xa0e7('0x43')){var _0x559757=_0x2cb24c['data'][0x0][_0xa0e7('0x44')];_0x559757[_0xa0e7('0x39')]=_[_0xa0e7('0x3c')](_0xd21d66[_0xa0e7('0x3d')])+'s';return _0x559757;}logger[_0xa0e7('0x28')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xa0e7('0x45')+JSON[_0xa0e7('0xe')](data));})[_0xa0e7('0x27')](function(_0x1a753f){console[_0xa0e7('0x46')](_0xa0e7('0x47'),_0x1a753f);});}function getEndUser(_0x1f83d7,_0x2087f3,_0x1ae249,_0x2590e9,_0x595d8b,_0x3a419e,_0x238b8f){var _0x5715a2={'method':_0xa0e7('0x48'),'uri':'','headers':{'Authorization':_0xa0e7('0x41')+_0x1f83d7},'json':!![]};switch(_0x238b8f[_0xa0e7('0x49')]){case _0xa0e7('0x4a'):_0x5715a2['uri']=_0xa0e7('0x3a')+_0x2087f3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x595d8b+'))';return getZohoUser(_0x5715a2,'Contacts')[_0xa0e7('0x2c')](function(_0x43b2d5){if(_0x43b2d5)return _0x43b2d5;_0x5715a2['uri']=_0xa0e7('0x3a')+_0x2087f3+_0xa0e7('0x4b')+_0x595d8b+'))';return getZohoUser(_0x5715a2,_0xa0e7('0x4c'))[_0xa0e7('0x2c')](function(_0x151c46){if(_0x151c46)return _0x151c46;if(_0x238b8f['moduleCreate']!=_0xa0e7('0x4d')){return createEndUser(_0x1f83d7,_0x2087f3,_0x2590e9,_0x595d8b,_0x3a419e,_0x238b8f);}else{return{};}});});break;case'contact':_0x5715a2['uri']=_0xa0e7('0x3a')+_0x2087f3+_0xa0e7('0x4e')+_0x595d8b+'))';return getZohoUser(_0x5715a2,_0xa0e7('0x4f'))[_0xa0e7('0x2c')](function(_0x240dd1){if(_0x240dd1)return _0x240dd1;if(_0x238b8f[_0xa0e7('0x3d')]!='nothing'){return createEndUser(_0x1f83d7,_0x2087f3,_0x2590e9,_0x595d8b,_0x3a419e,_0x238b8f);}else{return{};}});break;case'lead':_0x5715a2[_0xa0e7('0x50')]=_0xa0e7('0x3a')+_0x2087f3+_0xa0e7('0x4b')+_0x595d8b+'))';return getZohoUser(_0x5715a2,_0xa0e7('0x4c'))[_0xa0e7('0x2c')](function(_0x270e11){if(_0x270e11)return _0x270e11;if(_0x238b8f[_0xa0e7('0x3d')]!=_0xa0e7('0x4d')){return createEndUser(_0x1f83d7,_0x2087f3,_0x2590e9,_0x595d8b,_0x3a419e,_0x238b8f);}else{return{};}});break;}}function getCall(_0x52f9d6,_0x13c41a,_0x43d411,_0x2c3cab,_0x389a3f,_0x3e148f,_0x2527e8,_0x486517){logger[_0xa0e7('0x31')](_0xa0e7('0x51'));var _0x26421f={};_0x26421f[_0xa0e7('0x52')]={'name':!_['isNil'](_0x2c3cab[_0xa0e7('0x3e')][_0xa0e7('0x1a')])&&!_[_0xa0e7('0x1d')](_0x2c3cab[_0xa0e7('0x32')]['name'])&&_0x2c3cab[_0xa0e7('0x32')]['name']==='administrator'?_0x2c3cab['role']['name']:!_[_0xa0e7('0x1d')](_0x2c3cab['first_name'])?_0x2c3cab[_0xa0e7('0x3f')]+'\x20'+_0x2c3cab[_0xa0e7('0x40')]:_0x2c3cab[_0xa0e7('0x40')],'id':_0x2c3cab['id']};_0x26421f[_0xa0e7('0x53')]=intUtil[_0xa0e7('0x54')](_0x3e148f[_0xa0e7('0x55')],_0x2527e8,'\x20');_0x26421f[_0xa0e7('0x56')]=intUtil[_0xa0e7('0x54')](_0x3e148f[_0xa0e7('0x57')],_0x2527e8,'\x0a');if(_0x389a3f[_0xa0e7('0x39')]===_0xa0e7('0x4f')){_0x26421f[_0xa0e7('0x58')]={'name':!_['isNil'](_0x389a3f[_0xa0e7('0x59')])?_0x389a3f[_0xa0e7('0x59')]:!_['isNil'](_0x389a3f['First_Name'])?_0x389a3f[_0xa0e7('0x5a')]+'\x20'+_0x389a3f[_0xa0e7('0x5b')]:_0x389a3f[_0xa0e7('0x5b')],'id':_0x389a3f['id']};}if(_0x389a3f[_0xa0e7('0x39')]===_0xa0e7('0x4c')){_0x26421f[_0xa0e7('0x5c')]={'name':!_['isNil'](_0x389a3f[_0xa0e7('0x59')])?_0x389a3f[_0xa0e7('0x59')]:!_['isNil'](_0x389a3f[_0xa0e7('0x5a')])?_0x389a3f['First_Name']+'\x20'+_0x389a3f['Last_Name']:_0x389a3f[_0xa0e7('0x5b')],'id':_0x389a3f['id']};_0x26421f['$se_module']=_[_0xa0e7('0x3c')](_0x389a3f['enduserType']);}if(_0x2527e8[_0xa0e7('0x5d')]){_0x26421f[_0xa0e7('0x5e')]=moment[_0xa0e7('0x5f')](parseInt(_0x2527e8[_0xa0e7('0x5d')])*0x3e8)[_0xa0e7('0x60')](_0xa0e7('0x61'));}else if(_0x2527e8[_0xa0e7('0x62')]&&_0x2527e8[_0xa0e7('0x63')]){_0x26421f[_0xa0e7('0x5e')]=moment[_0xa0e7('0x5f')](moment(_0x2527e8[_0xa0e7('0x63')],_0xa0e7('0x64'))['diff'](moment(_0x2527e8['starttime'],_0xa0e7('0x64'))))[_0xa0e7('0x60')]('mm:ss');}switch(_0x2527e8[_0xa0e7('0x65')]){case _0xa0e7('0x66'):_0x26421f['Call_Result']=_0xa0e7('0x67');break;case _0xa0e7('0x68'):case _0xa0e7('0x69'):_0x26421f[_0xa0e7('0x6a')]=_0xa0e7('0x6b');break;case _0xa0e7('0x6c'):_0x26421f[_0xa0e7('0x6a')]=_0xa0e7('0x6d');break;case _0xa0e7('0x6e'):_0x26421f[_0xa0e7('0x6a')]=_0xa0e7('0x6f');break;case _0xa0e7('0x70'):_0x26421f['Call_Result']='Timeout';default:}_0x26421f[_0xa0e7('0x71')]=(_0x486517==='outbound'?moment(_0x2527e8['starttime'])['format'](_0xa0e7('0x64')):moment(_0x2527e8[_0xa0e7('0x72')])[_0xa0e7('0x60')](_0xa0e7('0x64')))||moment()['format'](_0xa0e7('0x64'));_0x26421f[_0xa0e7('0x73')]=_0x486517||'Inbound';_0x26421f=_['merge'](_0x26421f,getCustomFields(_0x3e148f[_0xa0e7('0x74')],_0x2527e8));return request({'method':_0xa0e7('0x23'),'uri':_0xa0e7('0x3a')+_0x13c41a+_0xa0e7('0x75'),'headers':{'Authorization':_0xa0e7('0x41')+_0x52f9d6},'body':{'data':[_0x26421f]},'json':!![]})[_0xa0e7('0x2c')](function(_0x236cac){if(_0x236cac&&_0x236cac[_0xa0e7('0x38')][0x0][_0xa0e7('0x42')]===_0xa0e7('0x43')){logger[_0xa0e7('0x31')](_0xa0e7('0x76'));return{'id':_0x236cac[_0xa0e7('0x38')][0x0][_0xa0e7('0x44')]['id']};}})[_0xa0e7('0x27')](function(_0x35f94e){logger[_0xa0e7('0x31')]('err',_0x35f94e[_0xa0e7('0x77')]);console[_0xa0e7('0x46')](_0xa0e7('0x78'),_0x35f94e);});}exports[_0xa0e7('0x79')]=function(_0x2ba8df,_0x398b50,_0x537fff,_0x4238e0,_0x116560,_0x254882){var _0x55e466,_0x4f3194,_0x35937b;_0x254882['host']=intUtil[_0xa0e7('0x7a')](_0x254882[_0xa0e7('0x7b')]);_0x254882[_0xa0e7('0x7c')]=intUtil[_0xa0e7('0x7a')](_0x254882[_0xa0e7('0x7c')]);if(_0x116560&&_0x116560[_0xa0e7('0x7d')]){logger[_0xa0e7('0x31')](_0xa0e7('0x7e'),_0xa0e7('0x7f'));_0x398b50['recordingURL']=_0x254882[_0xa0e7('0x7c')]+'/api/voice/recordings/'+_0x398b50[_0xa0e7('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x398b50[_0xa0e7('0x80')]);}else{_0x398b50[_0xa0e7('0x81')]='';}var _0x5b3cf6=_0x254882[_0xa0e7('0x7b')]===_0xa0e7('0x82')?'eu':_0xa0e7('0x83');return getAccessToken(_0x254882)[_0xa0e7('0x2c')](function(_0x3d5c4e){_0x35937b=_0x3d5c4e;return getUser(_0x35937b,_0x5b3cf6,_0x254882,_0x4238e0[_0xa0e7('0x30')]);})[_0xa0e7('0x2c')](function(_0x4d2cc6){_0x55e466=_0x4d2cc6;logger[_0xa0e7('0x31')](_0xa0e7('0x84'),_0x55e466['id']);return getEndUser(_0x35937b,_0x5b3cf6,_0x254882,_0x398b50[_0xa0e7('0x85')],_0x398b50[_0xa0e7('0x86')],_0x55e466,_0x537fff);})[_0xa0e7('0x2c')](function(_0x4a0e93){_0x4f3194=_0x4a0e93;return getCall(_0x35937b,_0x5b3cf6,_0x254882,_0x55e466,_0x4f3194,_0x537fff,_0x398b50,_0xa0e7('0x87'));})[_0xa0e7('0x2c')](function(_0x395ff6){if(_0x395ff6){logger[_0xa0e7('0x31')](_0xa0e7('0x88'),_0x395ff6['id']);logger[_0xa0e7('0x31')]('[QUEUE]',_0xa0e7('0x89'));emit(util[_0xa0e7('0x60')](_0xa0e7('0x8a'),_0x4238e0[_0xa0e7('0x1a')]),_0xa0e7('0x8b'),{'uri':_0xa0e7('0x8c')+_0x254882[_0xa0e7('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x395ff6['id']});}})['catch'](function(_0x477a26){logger[_0xa0e7('0x28')](_0xa0e7('0x7e'),JSON[_0xa0e7('0xe')](_0x477a26));});};exports[_0xa0e7('0x8d')]=function(_0x4b5b69,_0x3fa25b,_0x4074ba,_0xb882f8,_0x9128ee,_0x3c944c,_0x247181){var _0x2f39e0,_0x56504b,_0xe7d7db;_0x3c944c[_0xa0e7('0x7b')]=intUtil[_0xa0e7('0x7a')](_0x3c944c['host']);_0x3c944c[_0xa0e7('0x7c')]=intUtil[_0xa0e7('0x7a')](_0x3c944c['serverUrl']);if(_0x247181&&_0x247181[_0xa0e7('0x8e')]&&_0x247181[_0xa0e7('0x8e')]!==_0xa0e7('0x8f')){logger['info'](_0xa0e7('0x90'),'Recording\x20is\x20enabled!');_0x3fa25b['recordingURL']=_0x3c944c[_0xa0e7('0x7c')]+_0xa0e7('0x91')+_0x3fa25b[_0xa0e7('0x80')]+_0xa0e7('0x92')+md5(_0x3fa25b['uniqueid']);}var _0xdfc26e=_0x3c944c['host']==='zoho.eu'?'eu':_0xa0e7('0x83');return getAccessToken(_0x3c944c)[_0xa0e7('0x2c')](function(_0x128b1d){_0xe7d7db=_0x128b1d;return getUser(_0xe7d7db,_0xdfc26e,_0x3c944c,_0xb882f8[_0xa0e7('0x30')]);})[_0xa0e7('0x2c')](function(_0x3be884){_0x2f39e0=_0x3be884;logger[_0xa0e7('0x31')](_0xa0e7('0x84'),_0x2f39e0['id']);return getEndUser(_0xe7d7db,_0xdfc26e,_0x3c944c,_0x3fa25b[_0xa0e7('0x93')],_0x3fa25b[_0xa0e7('0x94')],_0x2f39e0,_0x4074ba);})[_0xa0e7('0x2c')](function(_0x2cd46d){_0x56504b=_0x2cd46d;return getCall(_0xe7d7db,_0xdfc26e,_0x3c944c,_0x2f39e0,_0x56504b,_0x4074ba,_0x3fa25b,_0xa0e7('0x95'));})[_0xa0e7('0x2c')](function(_0x3fd83f){if(_0x3fd83f){logger[_0xa0e7('0x31')]('The\x20Call\x20ID\x20is:',_0x3fd83f['id']);logger[_0xa0e7('0x31')]('[OUTBOUND]',_0xa0e7('0x89'));emit(util[_0xa0e7('0x60')](_0xa0e7('0x8a'),_0xb882f8[_0xa0e7('0x1a')]),_0xa0e7('0x8b'),{'uri':_0xa0e7('0x8c')+_0x3c944c[_0xa0e7('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3fd83f['id']});}})[_0xa0e7('0x27')](function(_0x5ac77c){logger['error'](_0xa0e7('0x90'),JSON[_0xa0e7('0xe')](_0x5ac77c));});};exports[_0xa0e7('0x96')]=function(_0x95f2a5,_0x3f1fe3,_0x58b56e,_0x48e9b9,_0x2ef64f,_0x537767){var _0x58adc1,_0x1fe9e8,_0x591a2e;_0x537767[_0xa0e7('0x7b')]=intUtil[_0xa0e7('0x7a')](_0x537767['host']);_0x537767[_0xa0e7('0x7c')]=intUtil[_0xa0e7('0x7a')](_0x537767[_0xa0e7('0x7c')]);if(_0x2ef64f&&_0x2ef64f[_0xa0e7('0x7d')]){logger[_0xa0e7('0x31')]('['+_0x3f1fe3['lastevent']['toUpperCase']()+']',_0xa0e7('0x7f'));_0x3f1fe3[_0xa0e7('0x81')]=_0x537767[_0xa0e7('0x7c')]+_0xa0e7('0x91')+_0x3f1fe3[_0xa0e7('0x80')]+_0xa0e7('0x92')+md5(_0x3f1fe3[_0xa0e7('0x80')]);}else{_0x3f1fe3[_0xa0e7('0x81')]='';}var _0x3e6344=_0x537767[_0xa0e7('0x7b')]===_0xa0e7('0x82')?'eu':_0xa0e7('0x83');return getAccessToken(_0x537767)[_0xa0e7('0x2c')](function(_0x3a2084){_0x591a2e=_0x3a2084;return getUser(_0x591a2e,_0x3e6344,_0x537767);})[_0xa0e7('0x2c')](function(_0x2c2a12){_0x58adc1=_0x2c2a12;logger['info'](_0xa0e7('0x84'),_0x58adc1['id']);return getEndUser(_0x591a2e,_0x3e6344,_0x537767,_0x3f1fe3['calleridname'],_0x3f1fe3[_0xa0e7('0x86')],_0x58adc1,_0x58b56e);})[_0xa0e7('0x2c')](function(_0x1ae460){_0x1fe9e8=_0x1ae460;return getCall(_0x591a2e,_0x3e6344,_0x537767,_0x58adc1,_0x1fe9e8,_0x58b56e,_0x3f1fe3,'Inbound');})[_0xa0e7('0x2c')](function(_0x5f0d9e){if(_0x5f0d9e){logger[_0xa0e7('0x31')](_0xa0e7('0x88'),_0x5f0d9e['id']);}})[_0xa0e7('0x27')](function(_0x4658c5){logger['error']('['+_0x3f1fe3[_0xa0e7('0x65')][_0xa0e7('0x97')]()+']',JSON[_0xa0e7('0xe')](_0x4658c5));});}; \ No newline at end of file +var _0xa3df=['md5','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','access_token','add','seconds','catch','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','findIndex','users','email','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','merge','POST','/crm/v2/Calls','code','SUCCESS','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','com','destcalleridname','destcalleridnum','Outbound','user:%s','https://crm.','toUpperCase','lodash'];(function(_0x5efd76,_0x2ee2d0){var _0x442eac=function(_0x219d00){while(--_0x219d00){_0x5efd76['push'](_0x5efd76['shift']());}};_0x442eac(++_0x2ee2d0);}(_0xa3df,0x1c7));var _0xfa3d=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xa3df[_0x46361e];return _0x14e302;};'use strict';var _=require(_0xfa3d('0x0'));var rp=require('request-promise');var md5=require(_0xfa3d('0x1'));var util=require(_0xfa3d('0x2'));var intUtil=require(_0xfa3d('0x3'));var moment=require(_0xfa3d('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xfa3d('0x5'));var logger=require(_0xfa3d('0x6'))(_0xfa3d('0x7'));config[_0xfa3d('0x8')]=_[_0xfa3d('0x9')](config[_0xfa3d('0x8')],{'host':_0xfa3d('0xa'),'port':0x18eb});var io=require(_0xfa3d('0xb'))(new Redis(config[_0xfa3d('0x8')]));function emit(_0x1fab4d,_0x2cd779,_0x9c5dbb){io['to'](_0x1fab4d)[_0xfa3d('0xc')](_0x2cd779,_0x9c5dbb);}function request(_0x546b78){logger[_0xfa3d('0xd')]('[HTTP]',JSON[_0xfa3d('0xe')](_0x546b78));return rp(_0x546b78);}function getCustomFields(_0x22c704,_0x4ba693){var _0x5608ed={};if(_0x22c704[_0xfa3d('0xf')]>0x0){_[_0xfa3d('0x10')](_0x22c704,function(_0x123cc9){if(_[_0xfa3d('0x11')](['string',_0xfa3d('0x12')],_0x123cc9[_0xfa3d('0x13')])&&_0x123cc9[_0xfa3d('0x14')]){_0x5608ed[_0x123cc9['idField']]=_0x123cc9[_0xfa3d('0x15')][_0xfa3d('0x16')]();}else if(_0x123cc9['type']==='variable'&&_0x123cc9['variableName']&&_0x123cc9[_0xfa3d('0x14')]&&_0x4ba693[_0x123cc9[_0xfa3d('0x17')]]){_0x5608ed[_0x123cc9[_0xfa3d('0x14')]]=_0x4ba693[_0x123cc9[_0xfa3d('0x17')]][_0xfa3d('0x16')]();}else if(_0x123cc9['type']===_0xfa3d('0x18')&&_0x123cc9[_0xfa3d('0x19')]&&_0x123cc9[_0xfa3d('0x19')]['name']&&_0x123cc9[_0xfa3d('0x14')]&&_0x4ba693[_0x123cc9[_0xfa3d('0x19')]['name'][_0xfa3d('0x1a')]()]){_0x5608ed[_0x123cc9[_0xfa3d('0x14')]]=_0x4ba693[_0x123cc9[_0xfa3d('0x19')][_0xfa3d('0x1b')][_0xfa3d('0x1a')]()][_0xfa3d('0x16')]();}});}return _0x5608ed;}function getName(_0x533553){if(_0x533553[_0xfa3d('0x1c')]('\x20')>0x0){var _0x3523d7=_0x533553[_0xfa3d('0x1d')](/ (.+)/);if(_0x3523d7[0x1]){return _0x3523d7;}}return[_0x533553,_0x533553];}var accountsTokens={};function getAccessToken(_0x4bcfc3){return new Promise(function(_0x4b986b,_0x58e48d){if(!_[_0xfa3d('0x1e')](accountsTokens[_0x4bcfc3['id']])&&!_[_0xfa3d('0x1e')](accountsTokens[_0x4bcfc3['id']]['access_token'])){if(moment()[_0xfa3d('0x1f')](accountsTokens[_0x4bcfc3['id']][_0xfa3d('0x20')])){_0x4b986b(accountsTokens[_0x4bcfc3['id']]['access_token']);}}var _0xa5acf8;switch(_0x4bcfc3[_0xfa3d('0x21')]){case'US':_0xa5acf8=_0xfa3d('0x22');break;case'AU':_0xa5acf8='https://accounts.zoho.com.au';break;case'EU':_0xa5acf8=_0xfa3d('0x23');break;case'IN':_0xa5acf8='https://accounts.zoho.in';break;case'CN':_0xa5acf8='https://accounts.zoho.com.cn';break;default:_0xa5acf8=_0xfa3d('0x23');break;}var _0xe18ace={'method':'POST','uri':_0xa5acf8+_0xfa3d('0x24'),'qs':{'refresh_token':_0x4bcfc3[_0xfa3d('0x25')],'client_id':_0x4bcfc3[_0xfa3d('0x26')],'client_secret':_0x4bcfc3[_0xfa3d('0x27')],'grant_type':_0xfa3d('0x28')},'json':!![]};return rp(_0xe18ace)[_0xfa3d('0x29')](function(_0x4ac310){accountsTokens[_0x4bcfc3['id']]={'access_token':_0x4ac310[_0xfa3d('0x2a')],'expires_in':moment()[_0xfa3d('0x2b')](_0x4ac310[_0xfa3d('0x20')],_0xfa3d('0x2c'))};_0x4b986b(_0x4ac310[_0xfa3d('0x2a')]);})[_0xfa3d('0x2d')](function(_0x411acd){logger['error']('Failing\x20creating\x20the\x20access_token',_0x411acd[_0xfa3d('0x2e')]);_0x58e48d(_0x411acd);});});}function getUser(_0x1211a6,_0x115423,_0x49f911,_0x1d06c6){logger[_0xfa3d('0x2f')](_0xfa3d('0x30'));return request({'method':_0xfa3d('0x31'),'uri':util[_0xfa3d('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x115423),'qs':{'type':_0xfa3d('0x33')},'headers':{'Authorization':_0xfa3d('0x34')+_0x1211a6},'json':!![]})[_0xfa3d('0x29')](function(_0x39c3e5){if(_0x39c3e5['users']){var _0x13c144=-0x1;if(_['isArrayLikeObject'](_0x39c3e5['users'])){if(!_[_0xfa3d('0x1e')](_0x1d06c6)){_0x13c144=_[_0xfa3d('0x35')](_0x39c3e5[_0xfa3d('0x36')],function(_0x6b8ad7){return _0x6b8ad7[_0xfa3d('0x37')]===_0x1d06c6;});}if(_0x13c144>=0x0){logger[_0xfa3d('0x2f')]('Agent\x20found!');}else{logger[_0xfa3d('0x2f')](_0xfa3d('0x38'));_0x13c144=_[_0xfa3d('0x35')](_0x39c3e5['users'],function(_0x169cb1){return _0x169cb1['profile']['name']===_0xfa3d('0x39');});}return _0x39c3e5[_0xfa3d('0x36')][_0x13c144];}else{if(_0x39c3e5[_0xfa3d('0x3a')][_0xfa3d('0x3b')][_0xfa3d('0x1b')]===_0xfa3d('0x39')){logger[_0xfa3d('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x39c3e5[_0xfa3d('0x3a')];return user;}else{logger['error'](_0xfa3d('0x3c'),JSON[_0xfa3d('0xe')](_0x39c3e5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfa3d('0xe')](_0x39c3e5));}}}else{logger[_0xfa3d('0x3d')](_0xfa3d('0x3c'),JSON[_0xfa3d('0xe')](_0x39c3e5));throw new Error(_0xfa3d('0x3e')+JSON[_0xfa3d('0xe')](_0x39c3e5));}})[_0xfa3d('0x2d')](function(_0x4dddbd){console[_0xfa3d('0x3d')](_0x4dddbd);});}function getZohoUser(_0x2785e3,_0x12bd32){return new BPromise(function(_0x203b3e,_0x9ca477){request(_0x2785e3)[_0xfa3d('0x29')](function(_0x1db9a7){var _0x15ff62=null;if(_0x1db9a7){_0x15ff62=_0x1db9a7[_0xfa3d('0x3f')][0x0];_0x15ff62[_0xfa3d('0x40')]=_0x12bd32;}_0x203b3e(_0x15ff62);})[_0xfa3d('0x2d')](function(_0x382df7){_0x9ca477(_0x382df7);});});}function createEndUser(_0x5f1e17,_0x3cee47,_0x218d8a,_0x2dc227,_0x13e9ae,_0x588a7c){var _0x218d8a=getName(_0x218d8a);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x3cee47+_0xfa3d('0x41')+_[_0xfa3d('0x42')](_0x588a7c[_0xfa3d('0x43')])+'s','body':{'data':[{'Last_Name':_0x218d8a[0x1],'First_Name':_0x218d8a[0x0],'Phone':_0x2dc227,'Owner':{'name':!_[_0xfa3d('0x1e')](_0x13e9ae[_0xfa3d('0x44')][_0xfa3d('0x1b')])?_0x13e9ae['role']['name']:!_['isNil'](_0x13e9ae[_0xfa3d('0x45')])?_0x13e9ae[_0xfa3d('0x45')]+'\x20'+_0x13e9ae[_0xfa3d('0x46')]:_0x13e9ae['last_name'],'id':_0x13e9ae['id']}}]},'headers':{'Authorization':_0xfa3d('0x34')+_0x5f1e17},'json':!![]})['then'](function(_0x2ab57a){if(_0x2ab57a&&_0x2ab57a['data'][0x0]['code']==='SUCCESS'){var _0x557fdb=_0x2ab57a[_0xfa3d('0x3f')][0x0][_0xfa3d('0x47')];_0x557fdb[_0xfa3d('0x40')]=_['startCase'](_0x588a7c['moduleCreate'])+'s';return _0x557fdb;}logger[_0xfa3d('0x3d')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xfa3d('0x48')+JSON['stringify'](data));})[_0xfa3d('0x2d')](function(_0x1c80c9){console[_0xfa3d('0x49')](_0xfa3d('0x4a'),_0x1c80c9);});}function getEndUser(_0x4b9831,_0x5230a5,_0x3c769d,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3){var _0x25f032={'method':_0xfa3d('0x31'),'uri':'','headers':{'Authorization':_0xfa3d('0x34')+_0x4b9831},'json':!![]};switch(_0x12adc3['moduleSearch']){case _0xfa3d('0x4b'):_0x25f032[_0xfa3d('0x4c')]=_0xfa3d('0x4d')+_0x5230a5+_0xfa3d('0x4e')+_0x22abdb+'))';return getZohoUser(_0x25f032,_0xfa3d('0x4f'))[_0xfa3d('0x29')](function(_0x5b1b73){if(_0x5b1b73)return _0x5b1b73;_0x25f032['uri']=_0xfa3d('0x4d')+_0x5230a5+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x22abdb+'))';return getZohoUser(_0x25f032,_0xfa3d('0x50'))[_0xfa3d('0x29')](function(_0x24b48d){if(_0x24b48d)return _0x24b48d;if(_0x12adc3[_0xfa3d('0x43')]!=_0xfa3d('0x51')){return createEndUser(_0x4b9831,_0x5230a5,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3);}else{return{};}});});break;case'contact':_0x25f032[_0xfa3d('0x4c')]='https://www.zohoapis.'+_0x5230a5+_0xfa3d('0x4e')+_0x22abdb+'))';return getZohoUser(_0x25f032,'Contacts')[_0xfa3d('0x29')](function(_0x73101e){if(_0x73101e)return _0x73101e;if(_0x12adc3[_0xfa3d('0x43')]!=_0xfa3d('0x51')){return createEndUser(_0x4b9831,_0x5230a5,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3);}else{return{};}});break;case _0xfa3d('0x52'):_0x25f032[_0xfa3d('0x4c')]='https://www.zohoapis.'+_0x5230a5+_0xfa3d('0x53')+_0x22abdb+'))';return getZohoUser(_0x25f032,_0xfa3d('0x50'))[_0xfa3d('0x29')](function(_0x3d09e8){if(_0x3d09e8)return _0x3d09e8;if(_0x12adc3[_0xfa3d('0x43')]!=_0xfa3d('0x51')){return createEndUser(_0x4b9831,_0x5230a5,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3);}else{return{};}});break;}}function getCall(_0x568f83,_0x3516af,_0x801014,_0x19c1a4,_0x216f54,_0xd697af,_0x4588c2,_0x5b9560){logger['info'](_0xfa3d('0x54'));var _0x269cec={};_0x269cec[_0xfa3d('0x55')]={'name':!_[_0xfa3d('0x1e')](_0x19c1a4[_0xfa3d('0x44')][_0xfa3d('0x1b')])&&!_[_0xfa3d('0x1e')](_0x19c1a4[_0xfa3d('0x3b')][_0xfa3d('0x1b')])&&_0x19c1a4[_0xfa3d('0x3b')][_0xfa3d('0x1b')]===_0xfa3d('0x56')?_0x19c1a4[_0xfa3d('0x44')][_0xfa3d('0x1b')]:!_[_0xfa3d('0x1e')](_0x19c1a4[_0xfa3d('0x45')])?_0x19c1a4[_0xfa3d('0x45')]+'\x20'+_0x19c1a4['last_name']:_0x19c1a4['last_name'],'id':_0x19c1a4['id']};_0x269cec[_0xfa3d('0x57')]=intUtil[_0xfa3d('0x58')](_0xd697af[_0xfa3d('0x59')],_0x4588c2,'\x20');_0x269cec['Description']=intUtil[_0xfa3d('0x58')](_0xd697af[_0xfa3d('0x5a')],_0x4588c2,'\x0a');if(_0x216f54[_0xfa3d('0x40')]===_0xfa3d('0x4f')){_0x269cec[_0xfa3d('0x5b')]={'name':!_['isNil'](_0x216f54[_0xfa3d('0x5c')])?_0x216f54[_0xfa3d('0x5c')]:!_[_0xfa3d('0x1e')](_0x216f54[_0xfa3d('0x5d')])?_0x216f54['First_Name']+'\x20'+_0x216f54[_0xfa3d('0x5e')]:_0x216f54[_0xfa3d('0x5e')],'id':_0x216f54['id']};}if(_0x216f54[_0xfa3d('0x40')]===_0xfa3d('0x50')){_0x269cec[_0xfa3d('0x5f')]={'name':!_[_0xfa3d('0x1e')](_0x216f54[_0xfa3d('0x5c')])?_0x216f54['Full_Name']:!_[_0xfa3d('0x1e')](_0x216f54['First_Name'])?_0x216f54['First_Name']+'\x20'+_0x216f54['Last_Name']:_0x216f54[_0xfa3d('0x5e')],'id':_0x216f54['id']};_0x269cec[_0xfa3d('0x60')]=_['startCase'](_0x216f54['enduserType']);}if(_0x4588c2[_0xfa3d('0x61')]){_0x269cec['Call_Duration']=moment[_0xfa3d('0x62')](parseInt(_0x4588c2[_0xfa3d('0x61')])*0x3e8)[_0xfa3d('0x32')](_0xfa3d('0x63'));}else if(_0x4588c2['answertime']&&_0x4588c2[_0xfa3d('0x64')]){_0x269cec['Call_Duration']=moment[_0xfa3d('0x62')](moment(_0x4588c2[_0xfa3d('0x64')],_0xfa3d('0x65'))['diff'](moment(_0x4588c2['starttime'],_0xfa3d('0x65'))))[_0xfa3d('0x32')](_0xfa3d('0x63'));}switch(_0x4588c2[_0xfa3d('0x66')]){case _0xfa3d('0x67'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x69');break;case _0xfa3d('0x6a'):case'connect':_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x6b');break;case _0xfa3d('0x6c'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x6d');break;case _0xfa3d('0x6e'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x6f');break;case _0xfa3d('0x70'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x71');default:}_0x269cec[_0xfa3d('0x72')]=(_0x5b9560===_0xfa3d('0x73')?moment(_0x4588c2[_0xfa3d('0x74')])['format'](_0xfa3d('0x65')):moment(_0x4588c2[_0xfa3d('0x75')])[_0xfa3d('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xfa3d('0x32')](_0xfa3d('0x65'));_0x269cec['Call_Type']=_0x5b9560||'Inbound';_0x269cec=_[_0xfa3d('0x76')](_0x269cec,getCustomFields(_0xd697af['Fields'],_0x4588c2));return request({'method':_0xfa3d('0x77'),'uri':_0xfa3d('0x4d')+_0x3516af+_0xfa3d('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x568f83},'body':{'data':[_0x269cec]},'json':!![]})[_0xfa3d('0x29')](function(_0xb7a512){if(_0xb7a512&&_0xb7a512[_0xfa3d('0x3f')][0x0][_0xfa3d('0x79')]===_0xfa3d('0x7a')){logger[_0xfa3d('0x2f')](_0xfa3d('0x7b'));return{'id':_0xb7a512[_0xfa3d('0x3f')][0x0][_0xfa3d('0x47')]['id']};}})[_0xfa3d('0x2d')](function(_0x78b488){logger[_0xfa3d('0x2f')](_0xfa3d('0x7c'),_0x78b488[_0xfa3d('0x2e')]);console[_0xfa3d('0x49')](_0xfa3d('0x7c'),_0x78b488);});}exports[_0xfa3d('0x7d')]=function(_0x188110,_0x20955d,_0x200ae7,_0x1ebe51,_0x1b4678,_0x20c7d5){var _0x3423ca,_0x347fec,_0x139d8c;_0x20c7d5['host']=intUtil[_0xfa3d('0x7e')](_0x20c7d5[_0xfa3d('0x7f')]);_0x20c7d5[_0xfa3d('0x80')]=intUtil[_0xfa3d('0x7e')](_0x20c7d5[_0xfa3d('0x80')]);if(_0x1b4678&&_0x1b4678[_0xfa3d('0x81')]){logger[_0xfa3d('0x2f')]('[QUEUE]',_0xfa3d('0x82'));_0x20955d[_0xfa3d('0x83')]=_0x20c7d5[_0xfa3d('0x80')]+_0xfa3d('0x84')+_0x20955d[_0xfa3d('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x20955d[_0xfa3d('0x85')]);}else{_0x20955d[_0xfa3d('0x83')]='';}var _0x1a4056=_0x20c7d5[_0xfa3d('0x7f')]===_0xfa3d('0x86')?'eu':'com';return getAccessToken(_0x20c7d5)[_0xfa3d('0x29')](function(_0x34ffad){_0x139d8c=_0x34ffad;return getUser(_0x139d8c,_0x1a4056,_0x20c7d5,_0x1ebe51[_0xfa3d('0x37')]);})[_0xfa3d('0x29')](function(_0x47e85c){_0x3423ca=_0x47e85c;logger[_0xfa3d('0x2f')](_0xfa3d('0x87'),_0x3423ca['id']);return getEndUser(_0x139d8c,_0x1a4056,_0x20c7d5,_0x20955d[_0xfa3d('0x88')],_0x20955d[_0xfa3d('0x89')],_0x3423ca,_0x200ae7);})[_0xfa3d('0x29')](function(_0x48e992){_0x347fec=_0x48e992;return getCall(_0x139d8c,_0x1a4056,_0x20c7d5,_0x3423ca,_0x347fec,_0x200ae7,_0x20955d,_0xfa3d('0x8a'));})[_0xfa3d('0x29')](function(_0x35bf44){if(_0x35bf44){logger[_0xfa3d('0x2f')](_0xfa3d('0x8b'),_0x35bf44['id']);logger[_0xfa3d('0x2f')](_0xfa3d('0x8c'),_0xfa3d('0x8d'));emit(util['format']('user:%s',_0x1ebe51[_0xfa3d('0x1b')]),'trigger:browser:url',{'uri':'https://crm.'+_0x20c7d5['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x35bf44['id']});}})[_0xfa3d('0x2d')](function(_0x5bf258){logger[_0xfa3d('0x3d')](_0xfa3d('0x8c'),JSON[_0xfa3d('0xe')](_0x5bf258));});};exports[_0xfa3d('0x73')]=function(_0x1a7e58,_0x3083d7,_0x5687ba,_0x20356f,_0x96ad11,_0x312723,_0x3ab08e){var _0x1a8f56,_0xcfdeaa,_0x4333ea;_0x312723[_0xfa3d('0x7f')]=intUtil[_0xfa3d('0x7e')](_0x312723[_0xfa3d('0x7f')]);_0x312723[_0xfa3d('0x80')]=intUtil[_0xfa3d('0x7e')](_0x312723[_0xfa3d('0x80')]);if(_0x3ab08e&&_0x3ab08e[_0xfa3d('0x8e')]&&_0x3ab08e[_0xfa3d('0x8e')]!=='none'){logger[_0xfa3d('0x2f')](_0xfa3d('0x8f'),_0xfa3d('0x82'));_0x3083d7['recordingURL']=_0x312723[_0xfa3d('0x80')]+_0xfa3d('0x84')+_0x3083d7[_0xfa3d('0x85')]+_0xfa3d('0x90')+md5(_0x3083d7[_0xfa3d('0x85')]);}var _0xec8610=_0x312723[_0xfa3d('0x7f')]===_0xfa3d('0x86')?'eu':_0xfa3d('0x91');return getAccessToken(_0x312723)[_0xfa3d('0x29')](function(_0x1c849f){_0x4333ea=_0x1c849f;return getUser(_0x4333ea,_0xec8610,_0x312723,_0x20356f[_0xfa3d('0x37')]);})['then'](function(_0x4dbb5f){_0x1a8f56=_0x4dbb5f;logger[_0xfa3d('0x2f')](_0xfa3d('0x87'),_0x1a8f56['id']);return getEndUser(_0x4333ea,_0xec8610,_0x312723,_0x3083d7[_0xfa3d('0x92')],_0x3083d7[_0xfa3d('0x93')],_0x1a8f56,_0x5687ba);})[_0xfa3d('0x29')](function(_0x3980ea){_0xcfdeaa=_0x3980ea;return getCall(_0x4333ea,_0xec8610,_0x312723,_0x1a8f56,_0xcfdeaa,_0x5687ba,_0x3083d7,_0xfa3d('0x94'));})[_0xfa3d('0x29')](function(_0x3491fd){if(_0x3491fd){logger['info']('The\x20Call\x20ID\x20is:',_0x3491fd['id']);logger[_0xfa3d('0x2f')](_0xfa3d('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfa3d('0x32')](_0xfa3d('0x95'),_0x20356f['name']),'trigger:browser:url',{'uri':_0xfa3d('0x96')+_0x312723[_0xfa3d('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3491fd['id']});}})[_0xfa3d('0x2d')](function(_0x5ed9be){logger['error']('[OUTBOUND]',JSON[_0xfa3d('0xe')](_0x5ed9be));});};exports['unmanaged']=function(_0x5b326e,_0x556167,_0x4b349c,_0x13ffdd,_0x1ccd5e,_0x378a42){var _0x19a3b1,_0x3d8756,_0x1ee0e9;_0x378a42['host']=intUtil[_0xfa3d('0x7e')](_0x378a42[_0xfa3d('0x7f')]);_0x378a42['serverUrl']=intUtil[_0xfa3d('0x7e')](_0x378a42[_0xfa3d('0x80')]);if(_0x1ccd5e&&_0x1ccd5e['monitor_format']){logger[_0xfa3d('0x2f')]('['+_0x556167[_0xfa3d('0x66')][_0xfa3d('0x97')]()+']',_0xfa3d('0x82'));_0x556167[_0xfa3d('0x83')]=_0x378a42[_0xfa3d('0x80')]+_0xfa3d('0x84')+_0x556167['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x556167[_0xfa3d('0x85')]);}else{_0x556167[_0xfa3d('0x83')]='';}var _0x3bd4b5=_0x378a42[_0xfa3d('0x7f')]===_0xfa3d('0x86')?'eu':_0xfa3d('0x91');return getAccessToken(_0x378a42)[_0xfa3d('0x29')](function(_0x358535){_0x1ee0e9=_0x358535;return getUser(_0x1ee0e9,_0x3bd4b5,_0x378a42);})[_0xfa3d('0x29')](function(_0x227191){_0x19a3b1=_0x227191;logger[_0xfa3d('0x2f')](_0xfa3d('0x87'),_0x19a3b1['id']);return getEndUser(_0x1ee0e9,_0x3bd4b5,_0x378a42,_0x556167['calleridname'],_0x556167[_0xfa3d('0x89')],_0x19a3b1,_0x4b349c);})[_0xfa3d('0x29')](function(_0x48003d){_0x3d8756=_0x48003d;return getCall(_0x1ee0e9,_0x3bd4b5,_0x378a42,_0x19a3b1,_0x3d8756,_0x4b349c,_0x556167,'Inbound');})[_0xfa3d('0x29')](function(_0x19902c){if(_0x19902c){logger[_0xfa3d('0x2f')](_0xfa3d('0x8b'),_0x19902c['id']);}})[_0xfa3d('0x2d')](function(_0x4d78bc){logger[_0xfa3d('0x3d')]('['+_0x556167[_0xfa3d('0x66')][_0xfa3d('0x97')]()+']',JSON['stringify'](_0x4d78bc));});}; \ 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 9a87525..3e450a8 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 _0x5040=['trigger','data2','Script','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','../../../../config/logger'];(function(_0x3c542d,_0x32df6a){var _0x4f58f9=function(_0x4cb103){while(--_0x4cb103){_0x3c542d['push'](_0x3c542d['shift']());}};_0x4f58f9(++_0x32df6a);}(_0x5040,0x76));var _0x0504=function(_0x52f095,_0x579d0d){_0x52f095=_0x52f095-0x0;var _0x575577=_0x5040[_0x52f095];return _0x575577;};'use strict';var util=require(_0x0504('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x0504('0x1'))(_0x0504('0x2'));exports['exec']=function(_0x3e1eab,_0x273139){var _0x4c652b=_0x3e1eab[_0x0504('0x3')]?_0x3e1eab[_0x0504('0x3')]:_0x0504('0x4');var _0xfcad96=_0x3e1eab[_0x0504('0x5')]?Mustache['render'](_0x3e1eab[_0x0504('0x5')],_0x273139):_0x273139;sh[_0x0504('0x6')](_0xfcad96,function(_0x3a2209,_0x3e9cf9,_0x222e56){if(_0x3a2209!==0x0){logger[_0x0504('0x7')](util[_0x0504('0x8')](_0x0504('0x9'),_0x4c652b,_0xfcad96,_0x3a2209,_0x222e56));}else{logger[_0x0504('0xa')](util[_0x0504('0x8')](_0x0504('0xb'),_0x4c652b,_0xfcad96,_0x3e9cf9));}});}; \ No newline at end of file +var _0x8332=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','render','data3','format'];(function(_0x4a2c09,_0x32a4c6){var _0x506b25=function(_0x3a716a){while(--_0x3a716a){_0x4a2c09['push'](_0x4a2c09['shift']());}};_0x506b25(++_0x32a4c6);}(_0x8332,0x1f0));var _0x2833=function(_0x298d99,_0x37ae91){_0x298d99=_0x298d99-0x0;var _0x15401a=_0x8332[_0x298d99];return _0x15401a;};'use strict';var util=require(_0x2833('0x0'));var sh=require(_0x2833('0x1'));var Mustache=require(_0x2833('0x2'));var logger=require(_0x2833('0x3'))(_0x2833('0x4'));exports[_0x2833('0x5')]=function(_0x34797c,_0x1ac812){var _0x498ed0=_0x34797c[_0x2833('0x6')]?_0x34797c[_0x2833('0x6')]:_0x2833('0x7');var _0x992436=_0x34797c['data3']?Mustache[_0x2833('0x8')](_0x34797c[_0x2833('0x9')],_0x1ac812):_0x1ac812;sh[_0x2833('0x5')](_0x992436,function(_0xef3db7,_0x1f0c68,_0x46577c){if(_0xef3db7!==0x0){logger['error'](util[_0x2833('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x498ed0,_0x992436,_0xef3db7,_0x46577c));}else{logger[_0x2833('0xb')](util[_0x2833('0xa')](_0x2833('0xc'),_0x498ed0,_0x992436,_0x1f0c68));}});}; \ 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 3ba3f65..c507666 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 _0x7e75=['parse','render','error','stack','GET','POST','PUT','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','isNil',',\x20request\x20body:\x20','%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','name','message','util','lodash','mustache','trigger','data1','toUpperCase','data5','number','data6'];(function(_0x232e85,_0x300cf4){var _0x4618ae=function(_0x55e2d8){while(--_0x55e2d8){_0x232e85['push'](_0x232e85['shift']());}};_0x4618ae(++_0x300cf4);}(_0x7e75,0xf7));var _0x57e7=function(_0x444d90,_0x11c679){_0x444d90=_0x444d90-0x0;var _0x3a8344=_0x7e75[_0x444d90];return _0x3a8344;};'use strict';var rp=require('request-promise');var util=require(_0x57e7('0x0'));var _=require(_0x57e7('0x1'));var Mustache=require(_0x57e7('0x2'));var logger=require('../../../../config/logger')(_0x57e7('0x3'));exports['exec']=function(_0xbfbd62,_0x5a0455){var _0x325249,_0x1f78d0;var _0x268b87={'method':_0xbfbd62[_0x57e7('0x4')][_0x57e7('0x5')](),'uri':Mustache['render'](_0xbfbd62['data2'],_0x5a0455),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xbfbd62[_0x57e7('0x6')])===_0x57e7('0x7')&&parseInt(_0xbfbd62[_0x57e7('0x6')])>=0x1&&parseInt(_0xbfbd62['data5'])<=0xa?parseInt(_0xbfbd62['data5'])*0x3e8:0x5*0x3e8};try{_0x268b87['headers']=_0xbfbd62[_0x57e7('0x8')]?JSON[_0x57e7('0x9')](Mustache[_0x57e7('0xa')](_0xbfbd62[_0x57e7('0x8')],_0x5a0455)):{};}catch(_0x168e3f){logger[_0x57e7('0xb')](_0x168e3f[_0x57e7('0xc')]);}switch(_0xbfbd62[_0x57e7('0x4')]['toUpperCase']()){case _0x57e7('0xd'):case'DELETE':_0x325249=null;_0x268b87['qs']=_0x5a0455;break;case _0x57e7('0xe'):case _0x57e7('0xf'):if(_0xbfbd62[_0x57e7('0x10')]){try{_0x325249=JSON[_0x57e7('0x9')](Mustache[_0x57e7('0xa')](_0xbfbd62[_0x57e7('0x10')],_0x5a0455));_0x268b87[_0x57e7('0x11')]=_0x325249;}catch(_0x1e5284){logger[_0x57e7('0xb')](_0x1e5284[_0x57e7('0xc')]);logger[_0x57e7('0xb')](_0x57e7('0x12'));}}else{_0x325249=_0x5a0455;_0x268b87[_0x57e7('0x11')]=_0x325249;}break;}logger[_0x57e7('0x13')](util[_0x57e7('0x14')](_0x57e7('0x15'),_0xbfbd62['data1'],_0xbfbd62[_0x57e7('0x16')],JSON[_0x57e7('0x17')](_0x268b87)));rp(_0x268b87)[_0x57e7('0x18')](function(_0x4f7529){_0x325249=!_[_0x57e7('0x19')](_0x325249)?_0x57e7('0x1a')+_0x325249:'';_0x1f78d0=typeof _0x4f7529[_0x57e7('0x11')]==='object'?JSON[_0x57e7('0x17')](_0x4f7529[_0x57e7('0x11')]):_0x4f7529[_0x57e7('0x11')];logger[_0x57e7('0x13')](util['format'](_0x57e7('0x1b'),_0xbfbd62['data1'],_0xbfbd62[_0x57e7('0x16')],_0x4f7529[_0x57e7('0x1c')],_0x1f78d0));})['catch'](function(_0xe89c4a){logger['error'](util[_0x57e7('0x14')](_0x57e7('0x1d'),_0xbfbd62[_0x57e7('0x4')],_0xbfbd62[_0x57e7('0x16')],_0xe89c4a[_0x57e7('0x1c')],_0xe89c4a[_0x57e7('0x1e')],_0xe89c4a[_0x57e7('0x1f')]));});}; \ No newline at end of file +var _0xc4cb=['request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','render','data2','data5','number','headers','data6','error','stack','toUpperCase','GET','POST','PUT','data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc4cb,0x154));var _0xbc4c=function(_0x3c25d7,_0x50ebd0){_0x3c25d7=_0x3c25d7-0x0;var _0xd8d3a6=_0xc4cb[_0x3c25d7];return _0xd8d3a6;};'use strict';var rp=require(_0xbc4c('0x0'));var util=require(_0xbc4c('0x1'));var _=require(_0xbc4c('0x2'));var Mustache=require(_0xbc4c('0x3'));var logger=require(_0xbc4c('0x4'))('trigger');exports[_0xbc4c('0x5')]=function(_0x5e37a1,_0x4be6bb){var _0x1069f4,_0xeda992;var _0x5ac82b={'method':_0x5e37a1[_0xbc4c('0x6')]['toUpperCase'](),'uri':Mustache[_0xbc4c('0x7')](_0x5e37a1[_0xbc4c('0x8')],_0x4be6bb),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5e37a1[_0xbc4c('0x9')])===_0xbc4c('0xa')&&parseInt(_0x5e37a1[_0xbc4c('0x9')])>=0x1&&parseInt(_0x5e37a1[_0xbc4c('0x9')])<=0xa?parseInt(_0x5e37a1[_0xbc4c('0x9')])*0x3e8:0x5*0x3e8};try{_0x5ac82b[_0xbc4c('0xb')]=_0x5e37a1[_0xbc4c('0xc')]?JSON['parse'](Mustache[_0xbc4c('0x7')](_0x5e37a1[_0xbc4c('0xc')],_0x4be6bb)):{};}catch(_0xb14100){logger[_0xbc4c('0xd')](_0xb14100[_0xbc4c('0xe')]);}switch(_0x5e37a1[_0xbc4c('0x6')][_0xbc4c('0xf')]()){case _0xbc4c('0x10'):case'DELETE':_0x1069f4=null;_0x5ac82b['qs']=_0x4be6bb;break;case _0xbc4c('0x11'):case _0xbc4c('0x12'):if(_0x5e37a1[_0xbc4c('0x13')]){try{_0x1069f4=JSON[_0xbc4c('0x14')](Mustache[_0xbc4c('0x7')](_0x5e37a1[_0xbc4c('0x13')],_0x4be6bb));_0x5ac82b['body']=_0x1069f4;}catch(_0x4f1905){logger['error'](_0x4f1905[_0xbc4c('0xe')]);logger[_0xbc4c('0xd')](_0xbc4c('0x15'));}}else{_0x1069f4=_0x4be6bb;_0x5ac82b[_0xbc4c('0x16')]=_0x1069f4;}break;}logger['info'](util[_0xbc4c('0x17')](_0xbc4c('0x18'),_0x5e37a1['data1'],_0x5e37a1[_0xbc4c('0x8')],JSON[_0xbc4c('0x19')](_0x5ac82b)));rp(_0x5ac82b)['then'](function(_0x100d4c){_0x1069f4=!_[_0xbc4c('0x1a')](_0x1069f4)?_0xbc4c('0x1b')+_0x1069f4:'';_0xeda992=typeof _0x100d4c[_0xbc4c('0x16')]===_0xbc4c('0x1c')?JSON[_0xbc4c('0x19')](_0x100d4c[_0xbc4c('0x16')]):_0x100d4c[_0xbc4c('0x16')];logger[_0xbc4c('0x1d')](util[_0xbc4c('0x17')](_0xbc4c('0x1e'),_0x5e37a1[_0xbc4c('0x6')],_0x5e37a1['data2'],_0x100d4c[_0xbc4c('0x1f')],_0xeda992));})[_0xbc4c('0x20')](function(_0x40ff21){logger[_0xbc4c('0xd')](util[_0xbc4c('0x17')](_0xbc4c('0x21'),_0x5e37a1[_0xbc4c('0x6')],_0x5e37a1[_0xbc4c('0x8')],_0x40ff21[_0xbc4c('0x1f')],_0x40ff21['name'],_0x40ff21['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e482b17..80f674a 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 _0xb022=['error','message','result','catch','exports','jayson/promise','../../config/logger','client','Request','request','then','debug','rpc','routing'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xb022,0x10f));var _0x2b02=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb022[_0x19e35c];return _0x3e1fe8;};'use strict';var jayson=require(_0x2b02('0x0'));var BPromise=require('bluebird');var logger=require(_0x2b02('0x1'))('routing');var client=jayson[_0x2b02('0x2')]['http']({'port':0x2329});client[_0x2b02('0x3')]=function(_0x5f553f,_0x2b749f){return new BPromise(function(_0x1e98c3,_0x3fd0a3){return client[_0x2b02('0x4')](_0x5f553f,_0x2b749f)[_0x2b02('0x5')](function(_0x1d1c04){logger[_0x2b02('0x6')](_0x2b02('0x7'),_0x2b02('0x8'),_0x5f553f,_0x2b749f,_0x1d1c04);if(_0x1d1c04[_0x2b02('0x9')]){logger['error'](_0x2b02('0x7'),_0x2b02('0x8'),_0x5f553f,_0x1d1c04[_0x2b02('0x9')][_0x2b02('0xa')],_0x2b749f);return _0x3fd0a3(_0x1d1c04[_0x2b02('0x9')][_0x2b02('0xa')]);}else{return _0x1e98c3(_0x1d1c04[_0x2b02('0xb')]);}})[_0x2b02('0xc')](function(_0x1536ff){logger[_0x2b02('0x9')](_0x2b02('0x7'),_0x2b02('0x8'),_0x5f553f,_0x1536ff,_0x2b749f);return _0x3fd0a3(_0x1536ff);});});};module[_0x2b02('0xd')]=client; \ No newline at end of file +var _0x6ff5=['http','rpc','message','result','catch','error','exports','../../config/logger','routing','client'];(function(_0x12789c,_0xefa52){var _0x3e3c5b=function(_0x204481){while(--_0x204481){_0x12789c['push'](_0x12789c['shift']());}};_0x3e3c5b(++_0xefa52);}(_0x6ff5,0xbb));var _0x56ff=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6ff5[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x56ff('0x0'))(_0x56ff('0x1'));var client=jayson[_0x56ff('0x2')][_0x56ff('0x3')]({'port':0x2329});client['Request']=function(_0x5be209,_0x111796){return new BPromise(function(_0x39307b,_0x1e0547){return client['request'](_0x5be209,_0x111796)['then'](function(_0xd024d){logger['debug'](_0x56ff('0x4'),'routing',_0x5be209,_0x111796,_0xd024d);if(_0xd024d['error']){logger['error']('rpc','routing',_0x5be209,_0xd024d['error'][_0x56ff('0x5')],_0x111796);return _0x1e0547(_0xd024d['error']['message']);}else{return _0x39307b(_0xd024d[_0x56ff('0x6')]);}})[_0x56ff('0x7')](function(_0x87f42e){logger[_0x56ff('0x8')]('rpc',_0x56ff('0x1'),_0x5be209,_0x87f42e,_0x111796);return _0x1e0547(_0x87f42e);});});};module[_0x56ff('0x9')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d61d9d7..b48eba3 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 _0xf97a=['refresh','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x1bef4e,_0x48553b){var _0x4491da=function(_0x75dc1a){while(--_0x75dc1a){_0x1bef4e['push'](_0x1bef4e['shift']());}};_0x4491da(++_0x48553b);}(_0xf97a,0x1ba));var _0xaf97=function(_0xcb2d98,_0xf99870){_0xcb2d98=_0xcb2d98-0x0;var _0x469632=_0xf97a[_0xcb2d98];return _0x469632;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xaf97('0x0'));var mailAccount=require(_0xaf97('0x1'));var setting=require('./rpc/setting');var logger=require(_0xaf97('0x2'))(_0xaf97('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xaf97('0x4')]()[_0xaf97('0x5')](mailAccount[_0xaf97('0x6')]())[_0xaf97('0x5')](realtime[_0xaf97('0x7')]())[_0xaf97('0x5')](function(){email[_0xaf97('0x8')](realtime[_0xaf97('0x9')]);return realtime;});}function main(){return server[_0xaf97('0xa')](realtime,email)[_0xaf97('0x5')](function(){return initRealtime();})[_0xaf97('0x5')](function(){return setting['getSettings']();})['then'](function(_0x4a7b8d){return setInterval(initRealtime,_0x4a7b8d[_0xaf97('0xb')]*0x3e8);})[_0xaf97('0xc')](function(_0x4ac9e1){logger[_0xaf97('0xd')](_0xaf97('0xe'),_0x4ac9e1);});}main(); \ No newline at end of file +var _0xd897=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x1ab1a4,_0x3b1c47){var _0x1e9675=function(_0x8d7bf6){while(--_0x8d7bf6){_0x1ab1a4['push'](_0x1ab1a4['shift']());}};_0x1e9675(++_0x3b1c47);}(_0xd897,0x157));var _0x7d89=function(_0x5df015,_0x1f509d){_0x5df015=_0x5df015-0x0;var _0x27964b=_0xd897[_0x5df015];return _0x27964b;};'use strict';var server=require(_0x7d89('0x0'));var Realtime=require(_0x7d89('0x1'));var EmailChannel=require(_0x7d89('0x2'));var mailAccount=require(_0x7d89('0x3'));var setting=require(_0x7d89('0x4'));var logger=require(_0x7d89('0x5'))(_0x7d89('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7d89('0x7')]()[_0x7d89('0x8')](mailAccount['getMailAccounts']())[_0x7d89('0x8')](realtime[_0x7d89('0x9')]())[_0x7d89('0x8')](function(){email['refresh'](realtime[_0x7d89('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x7d89('0x8')](function(){return setting['getSettings']();})[_0x7d89('0x8')](function(_0x45a065){return setInterval(initRealtime,_0x45a065[_0x7d89('0xb')]*0x3e8);})[_0x7d89('0xc')](function(_0x434ac7){logger[_0x7d89('0xd')](_0x7d89('0xe'),_0x434ac7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index be88607..5520f64 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 _0x740c=['messages','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','info','mailAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','mailAccount:update','refresh','service','provider','imapAccounts','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','error','disabled','connected'];(function(_0x3395c1,_0x3e0f36){var _0x25faab=function(_0x303759){while(--_0x303759){_0x3395c1['push'](_0x3395c1['shift']());}};_0x25faab(++_0x3e0f36);}(_0x740c,0xe0));var _0xc740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc740('0x0'));var moment=require('moment');var BPromise=require(_0xc740('0x1'));var md5=require(_0xc740('0x2'));var Redis=require(_0xc740('0x3'));var config=require('../../../config/environment');var logger=require(_0xc740('0x4'))(_0xc740('0x5'));config[_0xc740('0x6')]=_[_0xc740('0x7')](config[_0xc740('0x6')],{'host':_0xc740('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xc740('0x9'));var EmailSmtp=require(_0xc740('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x488e43){logger[_0xc740('0xb')]('start\x20email\x20channel');this['mailAccounts']=_0x488e43[_0xc740('0xc')];this['imapAccounts']={};this[_0xc740('0xd')]=new EmailSmtp();}EmailChannel[_0xc740('0xe')][_0xc740('0xf')]=function(_0xe18e1a){var _0x467031=this[_0xc740('0xc')][_0xe18e1a];var _0xb090c2={'id':_0x467031['id'],'name':_0x467031[_0xc740('0x10')],'key':_0x467031['key'],'active':_0x467031[_0xc740('0x11')],'Imap':{'status':_0x467031[_0xc740('0x12')][_0xc740('0x13')],'messageStatus':_0x467031[_0xc740('0x12')][_0xc740('0x14')],'total':_0x467031[_0xc740('0x12')][_0xc740('0x15')]}};if(_[_0xc740('0x16')](md5Accounts[_0xe18e1a])){md5Accounts[_0xe18e1a]={};}var _0x5e7da=md5(JSON['stringify'](_0xb090c2));if(md5Accounts[_0xe18e1a][_0xc740('0x2')]!==_0x5e7da){md5Accounts[_0xe18e1a]['md5']=_0x5e7da;io[_0xc740('0xf')](_0xc740('0x17'),_0xb090c2);}};EmailChannel[_0xc740('0xe')][_0xc740('0x18')]=function(_0x48fbf4){for(var _0xa44ece in _0x48fbf4){if(_0x48fbf4['hasOwnProperty'](_0xa44ece)){if(_0x48fbf4[_0xa44ece][_0xc740('0x12')]&&_0x48fbf4[_0xa44ece][_0xc740('0x11')]){var _0x536119=_0x48fbf4[_0xa44ece][_0xc740('0x12')];if(!_0x536119[_0xc740('0x19')]&&_0x48fbf4[_0xa44ece]['provider']!=='custom')_0x536119['service']=_0x48fbf4[_0xa44ece][_0xc740('0x1a')];if(!this[_0xc740('0x1b')][_0xc740('0x1c')](_0x536119['id'])){this[_0xc740('0x1b')][_0x536119['id']]=new EmailImap(_0x536119,_0x48fbf4[_0xa44ece][_0xc740('0x5')]);this[_0xc740('0x1b')][_0x536119['id']]['on']('box',this[_0xc740('0x1d')][_0xc740('0x1e')](this,_0xa44ece));this['imapAccounts'][_0x536119['id']]['on'](_0xc740('0x5'),this[_0xc740('0x1f')][_0xc740('0x1e')](this,_0xa44ece));this[_0xc740('0x1b')][_0x536119['id']]['on'](_0xc740('0x20'),this['handleImapEnd'][_0xc740('0x1e')](this,_0xa44ece));this[_0xc740('0x1b')][_0x536119['id']]['on'](_0xc740('0x21'),this['handleImapError'][_0xc740('0x1e')](this,_0xa44ece));}}else{if(_[_0xc740('0x16')](this[_0xc740('0xc')][_0xa44ece][_0xc740('0x12')])){this['mailAccounts'][_0xa44ece][_0xc740('0x12')]={};}this[_0xc740('0xc')][_0xa44ece]['Imap']['status']=_0xc740('0x22');this[_0xc740('0xc')][_0xa44ece]['Imap']['messageStatus']='';this['emit'](_0xa44ece);}}}};EmailChannel['prototype'][_0xc740('0x1d')]=function(_0x2f7f1f,_0x598943){if(this[_0xc740('0xc')][_0x2f7f1f]){this[_0xc740('0xc')][_0x2f7f1f][_0xc740('0x12')][_0xc740('0x13')]=_0xc740('0x23');this['mailAccounts'][_0x2f7f1f][_0xc740('0x12')][_0xc740('0x14')]=_0x598943[_0xc740('0x10')];if(_0x598943[_0xc740('0x24')]){this['mailAccounts'][_0x2f7f1f][_0xc740('0x12')]['total']=_0x598943[_0xc740('0x24')][_0xc740('0x15')];}return this[_0xc740('0xf')](_0x2f7f1f);}};EmailChannel[_0xc740('0xe')][_0xc740('0x1f')]=function(_0x39758a,_0x178930){logger[_0xc740('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x178930[_0xc740('0x25')],_0x178930[_0xc740('0x26')],_0x178930[_0xc740('0x27')],_0x39758a);if(this[_0xc740('0xc')][_0x39758a]){return mailAccount[_0xc740('0x28')](_0x39758a,_0x178930)[_0xc740('0x29')](function(_0x57b8a7){if(_0x57b8a7){logger[_0xc740('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0xc740('0x2a')](function(_0x2f0e35){logger[_0xc740('0x21')](_0xc740('0x2b'),JSON['stringify'](_0x2f0e35));});}};EmailChannel[_0xc740('0xe')]['handleImapEnd']=function(_0x4f5d84){if(this[_0xc740('0xc')][_0x4f5d84]&&this['mailAccounts'][_0x4f5d84][_0xc740('0x12')]){if(this[_0xc740('0x1b')][this[_0xc740('0xc')][_0x4f5d84][_0xc740('0x12')]['id']]){delete this[_0xc740('0x1b')][this[_0xc740('0xc')][_0x4f5d84][_0xc740('0x12')]['id']];}this['mailAccounts'][_0x4f5d84][_0xc740('0x12')][_0xc740('0x2c')]=moment();this[_0xc740('0xf')](_0x4f5d84);}};EmailChannel[_0xc740('0xe')][_0xc740('0x2d')]=function(_0x4f436c,_0x49cc6e){if(this[_0xc740('0xc')][_0x4f436c]){this[_0xc740('0xc')][_0x4f436c][_0xc740('0x12')]['status']='error';this[_0xc740('0xc')][_0x4f436c][_0xc740('0x12')][_0xc740('0x14')]=_0x49cc6e;return this[_0xc740('0xf')](_0x4f436c);}};EmailChannel[_0xc740('0xe')][_0xc740('0x2e')]=function(_0x385c79,_0x3edef9){return this[_0xc740('0xd')][_0xc740('0x2f')](_0x385c79,_0x3edef9);};EmailChannel[_0xc740('0xe')][_0xc740('0x30')]=function(_0x396923){var _0x33fc95=this;if(this[_0xc740('0xc')][_0x396923['id']]){if(_[_0xc740('0x16')](this[_0xc740('0xc')][_0x396923['id']][_0xc740('0x31')])){this[_0xc740('0xc')][_0x396923['id']]['Smtp']={};}this['mailAccounts'][_0x396923['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x91445f,_0x1aa54f){return _0x33fc95[_0xc740('0xd')][_0xc740('0x32')](_0x396923)[_0xc740('0x29')](function(_0x3be9b1){_0x33fc95[_0xc740('0xc')][_0x396923['id']][_0xc740('0x31')][_0xc740('0x13')]=_0xc740('0x33');_0x33fc95[_0xc740('0xc')][_0x396923['id']][_0xc740('0x31')]['messageStatus']='';_0x33fc95[_0xc740('0xf')](_0x396923['id']);_0x91445f(_0x3be9b1);})[_0xc740('0x2a')](function(_0x60e7eb){_0x33fc95['mailAccounts'][_0x396923['id']]['Smtp'][_0xc740('0x13')]='error';_0x33fc95['mailAccounts'][_0x396923['id']][_0xc740('0x31')][_0xc740('0x14')]=_0x60e7eb;_0x33fc95[_0xc740('0xf')](_0x396923['id']);_0x1aa54f(_0x60e7eb);});});}return this[_0xc740('0xd')][_0xc740('0x32')](_0x396923);};module['exports']=EmailChannel; \ No newline at end of file +var _0x6621=['handleImapEnd','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','handleImapBox','bind','handleImapEmail','end','error','handleImapError','isNil','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6621,0x15e));var _0x1662=function(_0x47888a,_0x7d2f3a){_0x47888a=_0x47888a-0x0;var _0x2b15a4=_0x6621[_0x47888a];return _0x2b15a4;};'use strict';var _=require(_0x1662('0x0'));var moment=require(_0x1662('0x1'));var BPromise=require(_0x1662('0x2'));var md5=require(_0x1662('0x3'));var Redis=require(_0x1662('0x4'));var config=require(_0x1662('0x5'));var logger=require('../../../config/logger')(_0x1662('0x6'));config['redis']=_['defaults'](config[_0x1662('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1662('0x8'))(new Redis(config[_0x1662('0x7')]));var EmailImap=require(_0x1662('0x9'));var EmailSmtp=require(_0x1662('0xa'));var mailAccount=require(_0x1662('0xb'));var md5Accounts={};function EmailChannel(_0x4c7b95){logger[_0x1662('0xc')](_0x1662('0xd'));this[_0x1662('0xe')]=_0x4c7b95[_0x1662('0xe')];this[_0x1662('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x1662('0x10')][_0x1662('0x11')]=function(_0x5dd77a){var _0x67693b=this['mailAccounts'][_0x5dd77a];var _0x53ee00={'id':_0x67693b['id'],'name':_0x67693b[_0x1662('0x12')],'key':_0x67693b[_0x1662('0x13')],'active':_0x67693b[_0x1662('0x14')],'Imap':{'status':_0x67693b[_0x1662('0x15')][_0x1662('0x16')],'messageStatus':_0x67693b['Imap'][_0x1662('0x17')],'total':_0x67693b[_0x1662('0x15')][_0x1662('0x18')]}};if(_['isNil'](md5Accounts[_0x5dd77a])){md5Accounts[_0x5dd77a]={};}var _0x49c696=md5(JSON['stringify'](_0x53ee00));if(md5Accounts[_0x5dd77a][_0x1662('0x3')]!==_0x49c696){md5Accounts[_0x5dd77a][_0x1662('0x3')]=_0x49c696;io[_0x1662('0x11')](_0x1662('0x19'),_0x53ee00);}};EmailChannel['prototype'][_0x1662('0x1a')]=function(_0x5caf1e){for(var _0x3351a1 in _0x5caf1e){if(_0x5caf1e[_0x1662('0x1b')](_0x3351a1)){if(_0x5caf1e[_0x3351a1][_0x1662('0x15')]&&_0x5caf1e[_0x3351a1]['active']){var _0x2236d7=_0x5caf1e[_0x3351a1][_0x1662('0x15')];if(!_0x2236d7[_0x1662('0x1c')]&&_0x5caf1e[_0x3351a1]['provider']!==_0x1662('0x1d'))_0x2236d7[_0x1662('0x1c')]=_0x5caf1e[_0x3351a1][_0x1662('0x1e')];if(!this[_0x1662('0xf')][_0x1662('0x1b')](_0x2236d7['id'])){this[_0x1662('0xf')][_0x2236d7['id']]=new EmailImap(_0x2236d7,_0x5caf1e[_0x3351a1][_0x1662('0x6')]);this[_0x1662('0xf')][_0x2236d7['id']]['on']('box',this[_0x1662('0x1f')][_0x1662('0x20')](this,_0x3351a1));this[_0x1662('0xf')][_0x2236d7['id']]['on'](_0x1662('0x6'),this[_0x1662('0x21')][_0x1662('0x20')](this,_0x3351a1));this[_0x1662('0xf')][_0x2236d7['id']]['on'](_0x1662('0x22'),this['handleImapEnd'][_0x1662('0x20')](this,_0x3351a1));this['imapAccounts'][_0x2236d7['id']]['on'](_0x1662('0x23'),this[_0x1662('0x24')][_0x1662('0x20')](this,_0x3351a1));}}else{if(_[_0x1662('0x25')](this[_0x1662('0xe')][_0x3351a1][_0x1662('0x15')])){this['mailAccounts'][_0x3351a1][_0x1662('0x15')]={};}this['mailAccounts'][_0x3351a1][_0x1662('0x15')][_0x1662('0x16')]='disabled';this[_0x1662('0xe')][_0x3351a1][_0x1662('0x15')]['messageStatus']='';this[_0x1662('0x11')](_0x3351a1);}}}};EmailChannel[_0x1662('0x10')][_0x1662('0x1f')]=function(_0x567296,_0x563bec){if(this['mailAccounts'][_0x567296]){this['mailAccounts'][_0x567296][_0x1662('0x15')][_0x1662('0x16')]=_0x1662('0x26');this[_0x1662('0xe')][_0x567296][_0x1662('0x15')][_0x1662('0x17')]=_0x563bec['name'];if(_0x563bec[_0x1662('0x27')]){this[_0x1662('0xe')][_0x567296][_0x1662('0x15')]['total']=_0x563bec[_0x1662('0x27')][_0x1662('0x18')];}return this[_0x1662('0x11')](_0x567296);}};EmailChannel['prototype'][_0x1662('0x21')]=function(_0x3cc0ef,_0x5d1383){logger[_0x1662('0xc')](_0x1662('0x28'),_0x5d1383[_0x1662('0x29')],_0x5d1383[_0x1662('0x2a')],_0x5d1383[_0x1662('0x2b')],_0x3cc0ef);if(this[_0x1662('0xe')][_0x3cc0ef]){return mailAccount['notify'](_0x3cc0ef,_0x5d1383)[_0x1662('0x2c')](function(_0x3c46d0){if(_0x3c46d0){logger[_0x1662('0xc')](_0x1662('0x2d'));}})[_0x1662('0x2e')](function(_0x5bd0e4){logger[_0x1662('0x23')](_0x1662('0x2f'),JSON[_0x1662('0x30')](_0x5bd0e4));});}};EmailChannel[_0x1662('0x10')][_0x1662('0x31')]=function(_0xaac58b){if(this[_0x1662('0xe')][_0xaac58b]&&this[_0x1662('0xe')][_0xaac58b][_0x1662('0x15')]){if(this[_0x1662('0xf')][this[_0x1662('0xe')][_0xaac58b][_0x1662('0x15')]['id']]){delete this[_0x1662('0xf')][this[_0x1662('0xe')][_0xaac58b]['Imap']['id']];}this['mailAccounts'][_0xaac58b][_0x1662('0x15')][_0x1662('0x32')]=moment();this[_0x1662('0x11')](_0xaac58b);}};EmailChannel['prototype'][_0x1662('0x24')]=function(_0x483d11,_0x3d61b1){if(this[_0x1662('0xe')][_0x483d11]){this['mailAccounts'][_0x483d11]['Imap'][_0x1662('0x16')]=_0x1662('0x23');this[_0x1662('0xe')][_0x483d11][_0x1662('0x15')][_0x1662('0x17')]=_0x3d61b1;return this[_0x1662('0x11')](_0x483d11);}};EmailChannel[_0x1662('0x10')][_0x1662('0x33')]=function(_0x34d184,_0x65ed4a){return this[_0x1662('0x34')][_0x1662('0x35')](_0x34d184,_0x65ed4a);};EmailChannel['prototype'][_0x1662('0x36')]=function(_0x355342){var _0x437e3f=this;if(this[_0x1662('0xe')][_0x355342['id']]){if(_[_0x1662('0x25')](this['mailAccounts'][_0x355342['id']][_0x1662('0x37')])){this[_0x1662('0xe')][_0x355342['id']][_0x1662('0x37')]={};}this['mailAccounts'][_0x355342['id']][_0x1662('0x37')]['lastSync']=moment();return new BPromise(function(_0x5c9a6f,_0x563e36){return _0x437e3f[_0x1662('0x34')][_0x1662('0x38')](_0x355342)['then'](function(_0x444fdb){_0x437e3f[_0x1662('0xe')][_0x355342['id']][_0x1662('0x37')]['status']='verified';_0x437e3f['mailAccounts'][_0x355342['id']][_0x1662('0x37')][_0x1662('0x17')]='';_0x437e3f[_0x1662('0x11')](_0x355342['id']);_0x5c9a6f(_0x444fdb);})['catch'](function(_0x19a2c5){_0x437e3f['mailAccounts'][_0x355342['id']][_0x1662('0x37')][_0x1662('0x16')]=_0x1662('0x23');_0x437e3f[_0x1662('0xe')][_0x355342['id']][_0x1662('0x37')][_0x1662('0x17')]=_0x19a2c5;_0x437e3f[_0x1662('0x11')](_0x355342['id']);_0x563e36(_0x19a2c5);});});}return this[_0x1662('0x34')][_0x1662('0x38')](_0x355342);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index aedc479..668c23b 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 _0xb19e=['required','openBox','handleOpenBox','emit','handleCloseBox','readUnseen','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','lodash','util','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls'];(function(_0x71680e,_0x1fc38e){var _0x5cbf9f=function(_0x11010a){while(--_0x11010a){_0x71680e['push'](_0x71680e['shift']());}};_0x5cbf9f(++_0x1fc38e);}(_0xb19e,0x92));var _0xeb19=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xb19e[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0xeb19('0x0'));var util=require(_0xeb19('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0xeb19('0x2')];var Iconv=require(_0xeb19('0x3'))[_0xeb19('0x4')];var EventEmitter=require(_0xeb19('0x5'))['EventEmitter'];var utils=require(_0xeb19('0x6'));var logger=require(_0xeb19('0x7'))(_0xeb19('0x8'));function EmailImap(_0x5ba457,_0x5db780){this[_0xeb19('0x9')]=_0x5ba457['mailbox'];this[_0xeb19('0xa')]=this[_0xeb19('0xb')](_0x5ba457,_0x5db780);this[_0xeb19('0xc')]=new Imap(this[_0xeb19('0xa')]);this['imap'][_0xeb19('0xd')]('ready',this[_0xeb19('0xe')][_0xeb19('0xf')](this));this[_0xeb19('0xc')]['once'](_0xeb19('0x10'),this[_0xeb19('0x11')][_0xeb19('0xf')](this));this[_0xeb19('0xc')]['on'](_0xeb19('0x12'),this[_0xeb19('0x13')][_0xeb19('0xf')](this));this[_0xeb19('0xc')]['connect']();}util[_0xeb19('0x14')](EmailImap,EventEmitter);EmailImap[_0xeb19('0x15')][_0xeb19('0xb')]=function(_0x7c93fd,_0x1f2065){var _0x282820={'connTimeout':_0x7c93fd[_0xeb19('0x16')]?_0x7c93fd[_0xeb19('0x16')]*0x3e8:0x2710,'authTimeout':_0x7c93fd[_0xeb19('0x17')]?_0x7c93fd['authTimeout']*0x3e8:0x1388};if(_0x7c93fd[_0xeb19('0x18')]){_0x282820[_0xeb19('0x19')]=_0x7c93fd[_0xeb19('0x19')];if(_0x7c93fd[_0xeb19('0x1a')]){_0x282820[_0xeb19('0x1b')]=utils[_0xeb19('0x1c')](_0x7c93fd[_0xeb19('0x1d')][_0xeb19('0x1e')],_0x7c93fd[_0xeb19('0x19')]);}else{_0x282820[_0xeb19('0x1f')]=_0x7c93fd[_0xeb19('0x1f')];}}else{if(_0x7c93fd[_0xeb19('0x20')]){_0x282820['user']=_0x7c93fd['user'];_0x282820[_0xeb19('0x1f')]=_0x7c93fd[_0xeb19('0x1f')];}}_0x282820[_0xeb19('0x8')]=_0x1f2065||_0x7c93fd['user']||'anonymous@xcally.com';_0x282820['host']=_0x7c93fd[_0xeb19('0x21')];_0x282820['port']=_0x7c93fd[_0xeb19('0x22')]||0x3e1;if(_0x7c93fd['tls']){_0x282820[_0xeb19('0x23')]=!![];}else{_0x282820[_0xeb19('0x23')]=![];_0x282820[_0xeb19('0x24')]=_0xeb19('0x25');}return _0x282820;};EmailImap['prototype']['handleReady']=function(){this[_0xeb19('0xc')][_0xeb19('0x26')](this[_0xeb19('0x9')],![],this['handleOpenBox'][_0xeb19('0xf')](this));};EmailImap['prototype'][_0xeb19('0x27')]=function(_0x18d818,_0x9cf71c){if(_0x18d818){this['handleError'](_0x18d818,!![]);}else{this[_0xeb19('0x28')]('box',_0x9cf71c);this['readUnseen']();}};EmailImap['prototype'][_0xeb19('0x29')]=function(_0x5a033b){if(_0x5a033b){this[_0xeb19('0x13')](_0x5a033b,!![]);}else{this[_0xeb19('0xc')][_0xeb19('0x10')]();}};EmailImap['prototype'][_0xeb19('0x2a')]=function(){this['imap']['search']([_0xeb19('0x2b')],this[_0xeb19('0x2c')][_0xeb19('0xf')](this));};EmailImap['prototype'][_0xeb19('0x2c')]=function(_0x57e20c,_0x3facc3){if(_0x57e20c){this[_0xeb19('0x13')](_0x57e20c,!![]);}else{if(_0x3facc3['length']){try{var _0x298508=this[_0xeb19('0xc')][_0xeb19('0x2d')](_0x3facc3,{'bodies':'','markSeen':!![]});_0x298508['on'](_0xeb19('0x2e'),this[_0xeb19('0x2f')][_0xeb19('0xf')](this));_0x298508['once'](_0xeb19('0x12'),this[_0xeb19('0x30')][_0xeb19('0xf')](this));_0x298508[_0xeb19('0xd')](_0xeb19('0x10'),this[_0xeb19('0x31')][_0xeb19('0xf')](this));}catch(_0x53c825){logger[_0xeb19('0x12')](_0x53c825);}}else{this['imap'][_0xeb19('0x32')](!![],this[_0xeb19('0x29')][_0xeb19('0xf')](this));}}};EmailImap['prototype'][_0xeb19('0x2f')]=function(_0x5c5160){_0x5c5160['on'](_0xeb19('0x33'),this[_0xeb19('0x34')][_0xeb19('0xf')](this));_0x5c5160['once']('attributes',this[_0xeb19('0x35')]['bind'](this));_0x5c5160[_0xeb19('0xd')](_0xeb19('0x10'),this[_0xeb19('0x36')]['bind'](this));};EmailImap[_0xeb19('0x15')][_0xeb19('0x34')]=function(_0x5b1f55){simpleParser(_0x5b1f55,{'Iconv':Iconv},this['handleSimpleParser'][_0xeb19('0xf')](this));};EmailImap['prototype'][_0xeb19('0x35')]=function(){};EmailImap[_0xeb19('0x15')][_0xeb19('0x36')]=function(){};EmailImap['prototype'][_0xeb19('0x37')]=function(_0x43e45d,_0x3a168d){if(_0x43e45d){logger[_0xeb19('0x12')](_0x43e45d);}else{var _0x25e5f3=this;utils[_0xeb19('0x38')](this[_0xeb19('0xa')],_0x3a168d,function(_0x4e28e1){_0x25e5f3[_0xeb19('0x28')](_0xeb19('0x8'),_0x4e28e1);});}};EmailImap[_0xeb19('0x15')][_0xeb19('0x31')]=function(){this[_0xeb19('0xc')][_0xeb19('0x32')](!![],this[_0xeb19('0x29')]['bind'](this));};EmailImap[_0xeb19('0x15')][_0xeb19('0x30')]=function(_0x2095dc){this[_0xeb19('0x13')](_0x2095dc);this['imap'][_0xeb19('0x32')](!![],this[_0xeb19('0x29')]['bind'](this));};EmailImap[_0xeb19('0x15')][_0xeb19('0x11')]=function(){this[_0xeb19('0x28')](_0xeb19('0x10'));};EmailImap[_0xeb19('0x15')][_0xeb19('0x13')]=function(_0x522a5f,_0x394d4a){logger[_0xeb19('0x12')]('handleError',this['account'][_0xeb19('0x8')],JSON[_0xeb19('0x39')](_0x522a5f));var _0x4d4b91='';if(_0x522a5f){if(_0x522a5f['textCode']){_0x4d4b91=_0x522a5f[_0xeb19('0x3a')];}else{for(var _0x2a0665 in _0x522a5f){if(_0x522a5f['hasOwnProperty'](_0x2a0665)){_0x4d4b91+=_[_0xeb19('0x3b')](_0x2a0665)+':\x20'+_0x522a5f[_0x2a0665]+'\x0a';}}}}if(_0x394d4a){this[_0xeb19('0xc')]['end']();}else{this[_0xeb19('0x28')](_0xeb19('0x12'),_0x4d4b91);this['emit'](_0xeb19('0x10'));}};module[_0xeb19('0x3c')]=EmailImap; \ No newline at end of file +var _0xc5f3=['handleOpenBox','prototype','handleError','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','Iconv','EventEmitter','./utils','../../../config/logger','email','getAccount','account','once','handleReady','end','bind','error','connect','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox'];(function(_0x5be72d,_0x1a3f83){var _0x2f7e97=function(_0x3450a9){while(--_0x3450a9){_0x5be72d['push'](_0x5be72d['shift']());}};_0x2f7e97(++_0x1a3f83);}(_0xc5f3,0x140));var _0x3c5f=function(_0x2872b0,_0x4b0855){_0x2872b0=_0x2872b0-0x0;var _0x58b379=_0xc5f3[_0x2872b0];return _0x58b379;};'use strict';var _=require(_0x3c5f('0x0'));var util=require(_0x3c5f('0x1'));var Imap=require(_0x3c5f('0x2'));var simpleParser=require(_0x3c5f('0x3'))['simpleParser'];var Iconv=require('iconv')[_0x3c5f('0x4')];var EventEmitter=require('events')[_0x3c5f('0x5')];var utils=require(_0x3c5f('0x6'));var logger=require(_0x3c5f('0x7'))(_0x3c5f('0x8'));function EmailImap(_0x1f7ede,_0x2891c3){this['mailbox']=_0x1f7ede['mailbox'];this['account']=this[_0x3c5f('0x9')](_0x1f7ede,_0x2891c3);this[_0x3c5f('0x2')]=new Imap(this[_0x3c5f('0xa')]);this['imap'][_0x3c5f('0xb')]('ready',this[_0x3c5f('0xc')]['bind'](this));this[_0x3c5f('0x2')]['once'](_0x3c5f('0xd'),this['handleEnd'][_0x3c5f('0xe')](this));this[_0x3c5f('0x2')]['on'](_0x3c5f('0xf'),this['handleError'][_0x3c5f('0xe')](this));this[_0x3c5f('0x2')][_0x3c5f('0x10')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x3c5f('0x9')]=function(_0x169e75,_0x472156){var _0x3377cf={'connTimeout':_0x169e75[_0x3c5f('0x11')]?_0x169e75[_0x3c5f('0x11')]*0x3e8:0x2710,'authTimeout':_0x169e75['authTimeout']?_0x169e75[_0x3c5f('0x12')]*0x3e8:0x1388};if(_0x169e75[_0x3c5f('0x13')]){_0x3377cf[_0x3c5f('0x14')]=_0x169e75['user'];if(_0x169e75[_0x3c5f('0x15')]){_0x3377cf[_0x3c5f('0x16')]=utils[_0x3c5f('0x17')](_0x169e75[_0x3c5f('0x18')]['data5'],_0x169e75['user']);}else{_0x3377cf[_0x3c5f('0x19')]=_0x169e75['password'];}}else{if(_0x169e75[_0x3c5f('0x1a')]){_0x3377cf[_0x3c5f('0x14')]=_0x169e75['user'];_0x3377cf[_0x3c5f('0x19')]=_0x169e75[_0x3c5f('0x19')];}}_0x3377cf['email']=_0x472156||_0x169e75['user']||_0x3c5f('0x1b');_0x3377cf[_0x3c5f('0x1c')]=_0x169e75[_0x3c5f('0x1c')];_0x3377cf[_0x3c5f('0x1d')]=_0x169e75[_0x3c5f('0x1d')]||0x3e1;if(_0x169e75['tls']){_0x3377cf[_0x3c5f('0x1e')]=!![];}else{_0x3377cf['tls']=![];_0x3377cf[_0x3c5f('0x1f')]=_0x3c5f('0x20');}return _0x3377cf;};EmailImap['prototype'][_0x3c5f('0xc')]=function(){this[_0x3c5f('0x2')][_0x3c5f('0x21')](this['mailbox'],![],this[_0x3c5f('0x22')]['bind'](this));};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x22')]=function(_0x4e9eb6,_0x2a0a1e){if(_0x4e9eb6){this[_0x3c5f('0x24')](_0x4e9eb6,!![]);}else{this[_0x3c5f('0x25')](_0x3c5f('0x26'),_0x2a0a1e);this[_0x3c5f('0x27')]();}};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x28')]=function(_0xf5074d){if(_0xf5074d){this[_0x3c5f('0x24')](_0xf5074d,!![]);}else{this[_0x3c5f('0x2')][_0x3c5f('0xd')]();}};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x27')]=function(){this[_0x3c5f('0x2')]['search']([_0x3c5f('0x29')],this[_0x3c5f('0x2a')]['bind'](this));};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x2a')]=function(_0x3f334d,_0x518c32){if(_0x3f334d){this[_0x3c5f('0x24')](_0x3f334d,!![]);}else{if(_0x518c32['length']){try{var _0x457135=this[_0x3c5f('0x2')][_0x3c5f('0x2b')](_0x518c32,{'bodies':'','markSeen':!![]});_0x457135['on'](_0x3c5f('0x2c'),this[_0x3c5f('0x2d')]['bind'](this));_0x457135[_0x3c5f('0xb')](_0x3c5f('0xf'),this[_0x3c5f('0x2e')][_0x3c5f('0xe')](this));_0x457135[_0x3c5f('0xb')]('end',this[_0x3c5f('0x2f')][_0x3c5f('0xe')](this));}catch(_0x153249){logger['error'](_0x153249);}}else{this['imap'][_0x3c5f('0x30')](!![],this[_0x3c5f('0x28')][_0x3c5f('0xe')](this));}}};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x2d')]=function(_0x5c96bb){_0x5c96bb['on'](_0x3c5f('0x31'),this['handleMessageBody'][_0x3c5f('0xe')](this));_0x5c96bb[_0x3c5f('0xb')](_0x3c5f('0x32'),this[_0x3c5f('0x33')][_0x3c5f('0xe')](this));_0x5c96bb[_0x3c5f('0xb')]('end',this[_0x3c5f('0x34')][_0x3c5f('0xe')](this));};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x35')]=function(_0x18dce0){simpleParser(_0x18dce0,{'Iconv':Iconv},this[_0x3c5f('0x36')]['bind'](this));};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x33')]=function(){};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x34')]=function(){};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x36')]=function(_0xf821a8,_0x452b74){if(_0xf821a8){logger[_0x3c5f('0xf')](_0xf821a8);}else{var _0x2fc991=this;utils['parser'](this[_0x3c5f('0xa')],_0x452b74,function(_0xdc7c53){_0x2fc991[_0x3c5f('0x25')]('email',_0xdc7c53);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x3c5f('0x2')][_0x3c5f('0x30')](!![],this[_0x3c5f('0x28')]['bind'](this));};EmailImap[_0x3c5f('0x23')]['handleFetchError']=function(_0x2d1d57){this[_0x3c5f('0x24')](_0x2d1d57);this[_0x3c5f('0x2')]['closeBox'](!![],this[_0x3c5f('0x28')]['bind'](this));};EmailImap[_0x3c5f('0x23')]['handleEnd']=function(){this[_0x3c5f('0x25')]('end');};EmailImap[_0x3c5f('0x23')][_0x3c5f('0x24')]=function(_0x3dd29d,_0x17a848){logger[_0x3c5f('0xf')](_0x3c5f('0x24'),this[_0x3c5f('0xa')][_0x3c5f('0x8')],JSON[_0x3c5f('0x37')](_0x3dd29d));var _0x33ac3b='';if(_0x3dd29d){if(_0x3dd29d[_0x3c5f('0x38')]){_0x33ac3b=_0x3dd29d[_0x3c5f('0x38')];}else{for(var _0x29d021 in _0x3dd29d){if(_0x3dd29d['hasOwnProperty'](_0x29d021)){_0x33ac3b+=_[_0x3c5f('0x39')](_0x29d021)+':\x20'+_0x3dd29d[_0x29d021]+'\x0a';}}}}if(_0x17a848){this[_0x3c5f('0x2')][_0x3c5f('0xd')]();}else{this[_0x3c5f('0x25')](_0x3c5f('0xf'),_0x33ac3b);this[_0x3c5f('0x25')](_0x3c5f('0xd'));}};module[_0x3c5f('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 afe496a..213c37a 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 _0xd234=['sendMail','toString','prototype','verify','createTransport','exports','nodemailer','nodemailer-plugin-inline-base64','use','compile'];(function(_0x316105,_0x5a24cd){var _0xb0b187=function(_0x28fb48){while(--_0x28fb48){_0x316105['push'](_0x316105['shift']());}};_0xb0b187(++_0x5a24cd);}(_0xd234,0x114));var _0x4d23=function(_0x3b1e53,_0x24b184){_0x3b1e53=_0x3b1e53-0x0;var _0x5dbcf0=_0xd234[_0x3b1e53];return _0x5dbcf0;};'use strict';var nodemailer=require(_0x4d23('0x0'));var inlineBase64=require(_0x4d23('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x4e803f,_0x57f4f8){return new Promise(function(_0x34f738,_0x52fc8e){var _0x27b48a=nodemailer['createTransport'](_0x4e803f);_0x27b48a[_0x4d23('0x2')](_0x4d23('0x3'),inlineBase64());_0x27b48a[_0x4d23('0x4')](_0x57f4f8,function(_0x3b81cd,_0x530201){if(_0x3b81cd){_0x52fc8e(_0x3b81cd[_0x4d23('0x5')]());}else{_0x34f738(_0x530201);}});});};EmailSmtp[_0x4d23('0x6')][_0x4d23('0x7')]=function(_0x1b122b){return new Promise(function(_0x482589,_0x2a1fbc){var _0x52ff1e=nodemailer[_0x4d23('0x8')](_0x1b122b);_0x52ff1e['verify'](function(_0x244d58,_0xce6d63){if(_0x244d58){_0x2a1fbc(_0x244d58[_0x4d23('0x5')]());}else{if(_0xce6d63){_0x482589(_0xce6d63);}else{_0x2a1fbc('Not\x20verifired');}}});});};module[_0x4d23('0x9')]=EmailSmtp; \ No newline at end of file +var _0x7956=['prototype','send','createTransport','sendMail','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x48da8f,_0x53a909){var _0x44c4bd=function(_0x5d71f0){while(--_0x5d71f0){_0x48da8f['push'](_0x48da8f['shift']());}};_0x44c4bd(++_0x53a909);}(_0x7956,0x1de));var _0x6795=function(_0x356c60,_0x2c7026){_0x356c60=_0x356c60-0x0;var _0xf431c=_0x7956[_0x356c60];return _0xf431c;};'use strict';var nodemailer=require(_0x6795('0x0'));var inlineBase64=require(_0x6795('0x1'));function EmailSmtp(){}EmailSmtp[_0x6795('0x2')][_0x6795('0x3')]=function(_0x42b1a0,_0x54e40b){return new Promise(function(_0x1787d9,_0x282e1d){var _0x2d6a04=nodemailer[_0x6795('0x4')](_0x42b1a0);_0x2d6a04['use']('compile',inlineBase64());_0x2d6a04[_0x6795('0x5')](_0x54e40b,function(_0x275504,_0x4b82f3){if(_0x275504){_0x282e1d(_0x275504['toString']());}else{_0x1787d9(_0x4b82f3);}});});};EmailSmtp['prototype']['verify']=function(_0x10f9c7){return new Promise(function(_0x499710,_0x19bb15){var _0x4bc2e2=nodemailer[_0x6795('0x4')](_0x10f9c7);_0x4bc2e2[_0x6795('0x6')](function(_0x24450a,_0x3bb4d4){if(_0x24450a){_0x19bb15(_0x24450a['toString']());}else{if(_0x3bb4d4){_0x499710(_0x3bb4d4);}else{_0x19bb15(_0x6795('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 19e1af7..68d2e7f 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 _0x80a1=['format','%s-%s','now','server/files/attachments/','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','subject','messageId','inReplyTo','filter','info','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split','slice','join','length','pop','isEmpty','html','test','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','email','includes','bcc','attachments','attach','attachment','attachment-'];(function(_0x33ad45,_0x5c9ca4){var _0x4508d7=function(_0x5efbb5){while(--_0x5efbb5){_0x33ad45['push'](_0x33ad45['shift']());}};_0x4508d7(++_0x5c9ca4);}(_0x80a1,0x185));var _0x180a=function(_0x23c20b,_0x51a195){_0x23c20b=_0x23c20b-0x0;var _0x39cd83=_0x80a1[_0x23c20b];return _0x39cd83;};'use strict';var _=require(_0x180a('0x0'));var moment=require(_0x180a('0x1'));var random=require(_0x180a('0x2'));var fs=require('fs');var path=require(_0x180a('0x3'));var util=require(_0x180a('0x4'));var tnef=require(_0x180a('0x5'));var logger=require(_0x180a('0x6'))('email');var config=require(_0x180a('0x7'));function getAddress(_0x1de20f){var _0xa44443=_[_0x180a('0x8')](_0x1de20f[_0x180a('0x9')]);return _0xa44443&&_0xa44443[_0x180a('0xa')]?_0xa44443['address']:'anonymous'+random[_0x180a('0xb')](0x6)+_0x180a('0xc');}function getFirstName(_0x377aee){var _0x4a59ab=_[_0x180a('0x8')](_0x377aee[_0x180a('0x9')]);if(_0x4a59ab&&_0x4a59ab[_0x180a('0xd')]){if(_0x4a59ab[_0x180a('0xd')]==_0x4a59ab[_0x180a('0xa')]){return _0x4a59ab[_0x180a('0xd')][_0x180a('0xe')](0x0,_0x4a59ab[_0x180a('0xd')][_0x180a('0xf')]('@'));}var _0x3d17e8=_0x4a59ab[_0x180a('0xd')][_0x180a('0x10')](/\s+/);return _0x3d17e8['length']>0x1?_0x3d17e8[_0x180a('0x11')](0x0,-0x1)[_0x180a('0x12')]('\x20'):_0x4a59ab[_0x180a('0xd')];}return'Anonymous';}function getLastName(_0x82d3d5){var _0xd9bf49=_[_0x180a('0x8')](_0x82d3d5[_0x180a('0x9')]);if(_0xd9bf49&&_0xd9bf49[_0x180a('0xd')]){var _0x53b0f8=_0xd9bf49[_0x180a('0xd')]['split'](/\s+/);return _0x53b0f8[_0x180a('0x13')]>0x1?_0x53b0f8[_0x180a('0x14')]():'';}return'';}function getMails(_0x2ed1ab,_0x7ee3a0){var _0x9553db='';for(var _0x33610c=0x0;_0x33610c<_0x7ee3a0[_0x180a('0x9')][_0x180a('0x13')];_0x33610c+=0x1){if(_0x7ee3a0['value'][_0x33610c][_0x180a('0xa')]!==_0x2ed1ab){if(!_[_0x180a('0x15')](_0x9553db)){_0x9553db+=',';}_0x9553db+=_0x7ee3a0[_0x180a('0x9')][_0x33610c][_0x180a('0xd')]||_0x7ee3a0[_0x180a('0x9')][_0x33610c][_0x180a('0xa')]||'';_0x9553db+='\x20<';_0x9553db+=_0x7ee3a0[_0x180a('0x9')][_0x33610c][_0x180a('0xa')]?_0x7ee3a0[_0x180a('0x9')][_0x33610c][_0x180a('0xa')]:'anonymous'+random[_0x180a('0xb')](0x6)+_0x180a('0xc');_0x9553db+='>';}}return _0x9553db;}function parseEmail(_0x56b91c,_0x52a7ca,_0x360908){if(_0x52a7ca[_0x180a('0x16')]){var _0x475531=/)<[^<]*)*<\/script>/gi;while(_0x475531[_0x180a('0x17')](_0x52a7ca[_0x180a('0x16')])){_0x52a7ca['html']=_0x52a7ca['html']['replace'](_0x475531,'');}if(_0x52a7ca[_0x180a('0x16')]['includes'](_0x180a('0x18'))){var _0x1acc29=[];_0x52a7ca['attachments'][_0x180a('0x19')](_0x4fec98=>{_0x1acc29['push'](_0x4fec98[_0x180a('0x1a')]);});var _0x5c0a6f=/]+>/g;var _0x2921b8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3eeab6=_0x52a7ca['html'][_0x180a('0x1b')](_0x2921b8,_0x180a('0x1c'));var _0x5e27ab=_0x3eeab6[_0x180a('0x1b')](_0x5c0a6f,_0x180a('0x1d'));for(let _0x5d9118=0x0;_0x5d9118<_0x1acc29[_0x180a('0x13')];_0x5d9118++){var _0x47e949=_0x5e27ab[_0x180a('0x1b')](_0x180a('0x1d'),_0x180a('0x1e')+_0x1acc29[_0x5d9118]+_0x180a('0x1f'));_0x5e27ab=_0x47e949;}_0x52a7ca[_0x180a('0x16')]=_0x5e27ab;}_0x360908['body']=_0x52a7ca['html'];}else{_0x360908[_0x180a('0x20')]=_0x52a7ca[_0x180a('0x21')];}if(_0x360908[_0x180a('0x20')]){_0x360908[_0x180a('0x20')]=_0x360908[_0x180a('0x20')]['replace'](/0x0){var _0x26b23d=[_0x180a('0x33'),_0x180a('0x34'),_0x180a('0x35')];for(var _0x308cfe=0x0;_0x308cfe<_0x52a7ca[_0x180a('0x32')][_0x180a('0x13')];_0x308cfe++){var _0x35fea0=_['indexOf'](_0x26b23d,_0x52a7ca['headerLines'][_0x308cfe][_0x180a('0x36')]);if(_0x35fea0>=0x0){_0x360908['isAutoreply']=!![];}}}return _0x360908;}exports[_0x180a('0x37')]=function(_0x1c6a9d,_0x21806c,_0x165730){var _0x42122c={'from':getAddress(_0x21806c[_0x180a('0x38')]),'firstName':getFirstName(_0x21806c[_0x180a('0x38')]),'lastName':getLastName(_0x21806c[_0x180a('0x38')]),'mapKey':'email','message':{'from':getMails(_0x1c6a9d[_0x180a('0x24')],_0x21806c[_0x180a('0x38')]),'to':_0x1c6a9d['email'],'cc':'','subject':_0x21806c[_0x180a('0x39')]||'','messageId':_0x21806c[_0x180a('0x3a')],'inReplyTo':_0x21806c[_0x180a('0x3b')],'sentAt':moment(_0x21806c['date'])[_0x180a('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x21806c[_0x180a('0x16')]&&!_0x21806c[_0x180a('0x21')]){var _0x164477=_[_0x180a('0x3c')](_0x21806c[_0x180a('0x27')],{'contentType':'application/ms-tnef'});if(_0x164477['length']){logger[_0x180a('0x3d')](util[_0x180a('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x21806c['messageId']));tnef['parseBuffer'](_[_0x180a('0x3e')](_0x164477)['content'],function(_0x21c3b8,_0x2c4bf9){if(_0x2c4bf9){_0x21806c['html']=_0x2c4bf9['BodyHTML']||_0x180a('0x3f');if(_0x2c4bf9[_0x180a('0x40')]){for(var _0x59d1f7=0x0;_0x59d1f7<_0x2c4bf9['Attachments'][_0x180a('0x13')];_0x59d1f7++){var _0x20af02=_0x2c4bf9[_0x180a('0x40')][_0x59d1f7];_0x42122c[_0x180a('0x22')][_0x180a('0x27')]['push']({'filename':_0x20af02[_0x180a('0x41')],'content':Buffer[_0x180a('0x38')](_0x20af02[_0x180a('0x42')])});}}}_0x165730(parseEmail(_0x1c6a9d,_0x21806c,_0x42122c));});}else{_0x21806c[_0x180a('0x16')]=_0x180a('0x3f');_0x165730(parseEmail(_0x1c6a9d,_0x21806c,_0x42122c));}}else{_0x165730(parseEmail(_0x1c6a9d,_0x21806c,_0x42122c));}};exports[_0x180a('0x43')]=function(_0x50dcde,_0x3cb53b){var _0x11000d=[_0x180a('0x44')+(_0x3cb53b||''),_0x180a('0x45')+_0x50dcde,'',''];return Buffer[_0x180a('0x38')](_0x11000d[_0x180a('0x12')](''),_0x180a('0x46'))[_0x180a('0x47')]('base64');}; \ No newline at end of file +var _0xbe77=['Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','randomstring','path','util','node-tnef','email','value','address','anonymous','generate','@xcally.com','head','name','indexOf','split','length','join','Anonymous','pop','html','test','replace','includes','attachments','forEach','filename','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml'];(function(_0x1b41e1,_0x52d286){var _0x35279d=function(_0x585ae1){while(--_0x585ae1){_0x1b41e1['push'](_0x1b41e1['shift']());}};_0x35279d(++_0x52d286);}(_0xbe77,0x14e));var _0x7be7=function(_0x22bd55,_0x253d99){_0x22bd55=_0x22bd55-0x0;var _0x529e6d=_0xbe77[_0x22bd55];return _0x529e6d;};'use strict';var _=require(_0x7be7('0x0'));var moment=require('moment');var random=require(_0x7be7('0x1'));var fs=require('fs');var path=require(_0x7be7('0x2'));var util=require(_0x7be7('0x3'));var tnef=require(_0x7be7('0x4'));var logger=require('../../../config/logger')(_0x7be7('0x5'));var config=require('../../../config/environment');function getAddress(_0x38de4e){var _0x188e30=_['head'](_0x38de4e[_0x7be7('0x6')]);return _0x188e30&&_0x188e30[_0x7be7('0x7')]?_0x188e30[_0x7be7('0x7')]:_0x7be7('0x8')+random[_0x7be7('0x9')](0x6)+_0x7be7('0xa');}function getFirstName(_0x33034c){var _0x4ede00=_[_0x7be7('0xb')](_0x33034c[_0x7be7('0x6')]);if(_0x4ede00&&_0x4ede00[_0x7be7('0xc')]){if(_0x4ede00[_0x7be7('0xc')]==_0x4ede00[_0x7be7('0x7')]){return _0x4ede00['name']['substring'](0x0,_0x4ede00[_0x7be7('0xc')][_0x7be7('0xd')]('@'));}var _0x3dfd7d=_0x4ede00[_0x7be7('0xc')][_0x7be7('0xe')](/\s+/);return _0x3dfd7d[_0x7be7('0xf')]>0x1?_0x3dfd7d['slice'](0x0,-0x1)[_0x7be7('0x10')]('\x20'):_0x4ede00[_0x7be7('0xc')];}return _0x7be7('0x11');}function getLastName(_0x2ed08d){var _0x1196d9=_[_0x7be7('0xb')](_0x2ed08d['value']);if(_0x1196d9&&_0x1196d9['name']){var _0x43d2fb=_0x1196d9[_0x7be7('0xc')]['split'](/\s+/);return _0x43d2fb[_0x7be7('0xf')]>0x1?_0x43d2fb[_0x7be7('0x12')]():'';}return'';}function getMails(_0x4ead22,_0xd09bc){var _0x7be6fd='';for(var _0x5581a5=0x0;_0x5581a5<_0xd09bc[_0x7be7('0x6')][_0x7be7('0xf')];_0x5581a5+=0x1){if(_0xd09bc['value'][_0x5581a5]['address']!==_0x4ead22){if(!_['isEmpty'](_0x7be6fd)){_0x7be6fd+=',';}_0x7be6fd+=_0xd09bc[_0x7be7('0x6')][_0x5581a5][_0x7be7('0xc')]||_0xd09bc[_0x7be7('0x6')][_0x5581a5][_0x7be7('0x7')]||'';_0x7be6fd+='\x20<';_0x7be6fd+=_0xd09bc[_0x7be7('0x6')][_0x5581a5]['address']?_0xd09bc[_0x7be7('0x6')][_0x5581a5][_0x7be7('0x7')]:_0x7be7('0x8')+random[_0x7be7('0x9')](0x6)+'@xcally.com';_0x7be6fd+='>';}}return _0x7be6fd;}function parseEmail(_0x3659df,_0x3ad305,_0x148c7d){if(_0x3ad305[_0x7be7('0x13')]){var _0xd50312=/)<[^<]*)*<\/script>/gi;while(_0xd50312[_0x7be7('0x14')](_0x3ad305[_0x7be7('0x13')])){_0x3ad305['html']=_0x3ad305['html'][_0x7be7('0x15')](_0xd50312,'');}if(_0x3ad305[_0x7be7('0x13')][_0x7be7('0x16')]('{_0x1b5748['push'](_0x56e785[_0x7be7('0x19')]);});var _0xc9a2f0=/]+>/g;var _0x38b572=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5186f4=_0x3ad305[_0x7be7('0x13')][_0x7be7('0x15')](_0x38b572,_0x7be7('0x1a'));var _0x33aded=_0x5186f4[_0x7be7('0x15')](_0xc9a2f0,_0x7be7('0x1b'));for(let _0xe239a4=0x0;_0xe239a4<_0x1b5748[_0x7be7('0xf')];_0xe239a4++){var _0x1f6787=_0x33aded[_0x7be7('0x15')](_0x7be7('0x1b'),_0x7be7('0x1c')+_0x1b5748[_0xe239a4]+'\x20]');_0x33aded=_0x1f6787;}_0x3ad305[_0x7be7('0x13')]=_0x33aded;}_0x148c7d[_0x7be7('0x1d')]=_0x3ad305[_0x7be7('0x13')];}else{_0x148c7d[_0x7be7('0x1d')]=_0x3ad305[_0x7be7('0x1e')];}if(_0x148c7d['body']){_0x148c7d[_0x7be7('0x1d')]=_0x148c7d[_0x7be7('0x1d')][_0x7be7('0x15')](/0x0){var _0x283ed9=[_0x7be7('0x2f'),_0x7be7('0x30'),_0x7be7('0x31')];for(var _0x1bbc9a=0x0;_0x1bbc9a<_0x3ad305[_0x7be7('0x2e')][_0x7be7('0xf')];_0x1bbc9a++){var _0x324cf6=_[_0x7be7('0xd')](_0x283ed9,_0x3ad305['headerLines'][_0x1bbc9a][_0x7be7('0x32')]);if(_0x324cf6>=0x0){_0x148c7d[_0x7be7('0x33')]=!![];}}}return _0x148c7d;}exports[_0x7be7('0x34')]=function(_0xd6a4dd,_0x33659b,_0x5a9b62){var _0x4cc61b={'from':getAddress(_0x33659b[_0x7be7('0x35')]),'firstName':getFirstName(_0x33659b['from']),'lastName':getLastName(_0x33659b['from']),'mapKey':'email','message':{'from':getMails(_0xd6a4dd[_0x7be7('0x5')],_0x33659b[_0x7be7('0x35')]),'to':_0xd6a4dd[_0x7be7('0x5')],'cc':'','subject':_0x33659b['subject']||'','messageId':_0x33659b[_0x7be7('0x36')],'inReplyTo':_0x33659b[_0x7be7('0x37')],'sentAt':moment(_0x33659b[_0x7be7('0x38')])[_0x7be7('0x27')](_0x7be7('0x39')),'attach':![],'attachments':[]}};if(!_0x33659b['html']&&!_0x33659b[_0x7be7('0x1e')]){var _0x3e5233=_[_0x7be7('0x3a')](_0x33659b[_0x7be7('0x17')],{'contentType':_0x7be7('0x3b')});if(_0x3e5233[_0x7be7('0xf')]){logger[_0x7be7('0x3c')](util['format'](_0x7be7('0x3d'),_0x33659b[_0x7be7('0x36')]));tnef[_0x7be7('0x3e')](_[_0x7be7('0x3f')](_0x3e5233)['content'],function(_0x1fd732,_0xe0c041){if(_0xe0c041){_0x33659b[_0x7be7('0x13')]=_0xe0c041[_0x7be7('0x40')]||_0x7be7('0x41');if(_0xe0c041['Attachments']){for(var _0x1f8ff5=0x0;_0x1f8ff5<_0xe0c041[_0x7be7('0x42')]['length'];_0x1f8ff5++){var _0x253066=_0xe0c041[_0x7be7('0x42')][_0x1f8ff5];_0x4cc61b['message'][_0x7be7('0x17')][_0x7be7('0x2c')]({'filename':_0x253066['Title'],'content':Buffer[_0x7be7('0x35')](_0x253066[_0x7be7('0x43')])});}}}_0x5a9b62(parseEmail(_0xd6a4dd,_0x33659b,_0x4cc61b));});}else{_0x33659b['html']=_0x7be7('0x41');_0x5a9b62(parseEmail(_0xd6a4dd,_0x33659b,_0x4cc61b));}}else{_0x5a9b62(parseEmail(_0xd6a4dd,_0x33659b,_0x4cc61b));}};exports[_0x7be7('0x44')]=function(_0x513394,_0x1f71d6){var _0x50b26d=[_0x7be7('0x45')+(_0x1f71d6||''),_0x7be7('0x46')+_0x513394,'',''];return Buffer[_0x7be7('0x35')](_0x50b26d['join'](''),'utf-8')[_0x7be7('0x47')](_0x7be7('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b5f7fb6..803a354 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 _0xbe3c=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x2a1583,_0x1156d6){var _0x542a44=function(_0x41d8d1){while(--_0x41d8d1){_0x2a1583['push'](_0x2a1583['shift']());}};_0x542a44(++_0x1156d6);}(_0xbe3c,0xbf));var _0xcbe3=function(_0x4ff443,_0x5e1148){_0x4ff443=_0x4ff443-0x0;var _0x12832a=_0xbe3c[_0x4ff443];return _0x12832a;};'use strict';var _=require(_0xcbe3('0x0'));function MailAccount(_0x35218f){this['id']=_0x35218f['id']||0x0;this[_0xcbe3('0x1')]=_0x35218f[_0xcbe3('0x1')]||_0xcbe3('0x2');this['key']=_0x35218f[_0xcbe3('0x3')]||_0xcbe3('0x4');this[_0xcbe3('0x5')]=_0x35218f['active']||![];this[_0xcbe3('0x6')]=_0x35218f[_0xcbe3('0x6')]||[];this[_0xcbe3('0x7')]=_0x35218f[_0xcbe3('0x7')]||[];}module[_0xcbe3('0x8')]=MailAccount; \ No newline at end of file +var _0xf3d8=['lodash','name','Service','key','SERV','active','Smtp','exports'];(function(_0x4970d6,_0x2e6b07){var _0x2857f3=function(_0x447128){while(--_0x447128){_0x4970d6['push'](_0x4970d6['shift']());}};_0x2857f3(++_0x2e6b07);}(_0xf3d8,0xc0));var _0x8f3d=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf3d8[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x8f3d('0x0'));function MailAccount(_0x24be4b){this['id']=_0x24be4b['id']||0x0;this['name']=_0x24be4b[_0x8f3d('0x1')]||_0x8f3d('0x2');this[_0x8f3d('0x3')]=_0x24be4b[_0x8f3d('0x3')]||_0x8f3d('0x4');this[_0x8f3d('0x5')]=_0x24be4b[_0x8f3d('0x5')]||![];this['Imap']=_0x24be4b['Imap']||[];this['Smtp']=_0x24be4b[_0x8f3d('0x6')]||[];}module[_0x8f3d('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 df4e7e0..133440e 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 _0x2568=['../model/mailAccount','mailAccounts','hasOwnProperty','initMailAccounts','length','isUndefined','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2568,0x110));var _0x8256=function(_0x18198b,_0x20dca6){_0x18198b=_0x18198b-0x0;var _0x1400ff=_0x2568[_0x18198b];return _0x1400ff;};'use strict';var _=require(_0x8256('0x0'));var MailAccount=require(_0x8256('0x1'));var Realtime=function(){this[_0x8256('0x2')]={};};function freeIsNotKey(_0xe20d24,_0x42e665,_0x7faacf){var _0x238cda=_['mapKeys'](_0xe20d24,function(_0x1ad28a,_0x47b0ad){return _0x1ad28a[_0x7faacf];});for(var _0x8124cc in _0x42e665){if(_0x42e665['hasOwnProperty'](_0x8124cc)){if(!_0x238cda[_0x8124cc]){delete _0x42e665[_0x8124cc];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x102cd6,_0x1d417e){for(var _0x1ee667 in _0x1d417e){if(_0x102cd6[_0x8256('0x3')](_0x1ee667)){_0x102cd6[_0x1ee667]=_0x1d417e[_0x1ee667];}}};Realtime['prototype'][_0x8256('0x4')]=function(){var _0x43b8e3=this;return function(_0x18dd76){if(_0x18dd76){freeIsNotKey(_0x18dd76,_0x43b8e3[_0x8256('0x2')],'id');for(var _0x15359c=0x0,_0x3b31c7={},_0x1fb455={};_0x15359c<_0x18dd76[_0x8256('0x5')];_0x15359c+=0x1){_0x3b31c7=_0x18dd76[_0x15359c];if(_[_0x8256('0x6')](_0x43b8e3['mailAccounts'][_0x3b31c7['id']])){_0x43b8e3[_0x8256('0x2')][_0x3b31c7['id']]=new MailAccount(_0x3b31c7);}else{_['merge'](_0x43b8e3[_0x8256('0x2')][_0x3b31c7['id']],_0x3b31c7);}}}return _0x43b8e3[_0x8256('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x62bf=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','exports','lodash'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x62bf,0x83));var _0xf62b=function(_0x5bca2a,_0x15b4ae){_0x5bca2a=_0x5bca2a-0x0;var _0x11b5b6=_0x62bf[_0x5bca2a];return _0x11b5b6;};'use strict';var _=require(_0xf62b('0x0'));var MailAccount=require(_0xf62b('0x1'));var Realtime=function(){this[_0xf62b('0x2')]={};};function freeIsNotKey(_0x4f336a,_0x1c2ace,_0x26dd17){var _0x2d517b=_[_0xf62b('0x3')](_0x4f336a,function(_0x5f5636,_0x54cd0c){return _0x5f5636[_0x26dd17];});for(var _0x5c6541 in _0x1c2ace){if(_0x1c2ace[_0xf62b('0x4')](_0x5c6541)){if(!_0x2d517b[_0x5c6541]){delete _0x1c2ace[_0x5c6541];}}}}Realtime[_0xf62b('0x5')][_0xf62b('0x6')]=function(_0xaf87eb,_0x1b610d){for(var _0x1fc171 in _0x1b610d){if(_0xaf87eb[_0xf62b('0x4')](_0x1fc171)){_0xaf87eb[_0x1fc171]=_0x1b610d[_0x1fc171];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x238a2a=this;return function(_0x202d5f){if(_0x202d5f){freeIsNotKey(_0x202d5f,_0x238a2a[_0xf62b('0x2')],'id');for(var _0x57c433=0x0,_0x3d5ffc={},_0x1f0806={};_0x57c433<_0x202d5f[_0xf62b('0x7')];_0x57c433+=0x1){_0x3d5ffc=_0x202d5f[_0x57c433];if(_[_0xf62b('0x8')](_0x238a2a['mailAccounts'][_0x3d5ffc['id']])){_0x238a2a[_0xf62b('0x2')][_0x3d5ffc['id']]=new MailAccount(_0x3d5ffc);}else{_[_0xf62b('0x9')](_0x238a2a['mailAccounts'][_0x3d5ffc['id']],_0x3d5ffc);}}}return _0x238a2a[_0xf62b('0x2')];};};module[_0xf62b('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 09aaa7d..ea5d161 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 _0xb0e5=['MailServerOut','Smtp','getMailAccount','notify','../client','getMailAccounts','Request','GetMailAccount','name','email','key','TemplateId','MailServerIn','service','type','data5','CloudProvider'];(function(_0x1720f6,_0x5e9128){var _0x46e9fd=function(_0x4e3c53){while(--_0x4e3c53){_0x1720f6['push'](_0x1720f6['shift']());}};_0x46e9fd(++_0x5e9128);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x3e98d1,_0x45e559){_0x3e98d1=_0x3e98d1-0x0;var _0x2fcfb0=_0xb0e5[_0x3e98d1];return _0x2fcfb0;};'use strict';var client=require(_0x5b0e('0x0'));exports[_0x5b0e('0x1')]=function(){return function(){return client[_0x5b0e('0x2')](_0x5b0e('0x3'),{'options':{'attributes':['id',_0x5b0e('0x4'),'provider','service',_0x5b0e('0x5'),'active',_0x5b0e('0x6'),'ListId',_0x5b0e('0x7')],'raw':![],'include':[{'model':_0x5b0e('0x8'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x5b0e('0x4'),_0x5b0e('0x9'),_0x5b0e('0xa'),_0x5b0e('0xb')],'as':_0x5b0e('0xc')}]},{'model':_0x5b0e('0xd'),'as':_0x5b0e('0xe'),'include':[{'model':_0x5b0e('0xc'),'attributes':['id',_0x5b0e('0x4'),'service',_0x5b0e('0xa'),'data5'],'as':'CloudProvider'}]}]},'log':_0x5b0e('0xf')});};};exports[_0x5b0e('0x10')]=function(_0x3d0b5e,_0x526ad2){return client[_0x5b0e('0x2')]('NotifyMailAccount',{'account':{'id':_0x3d0b5e},'body':_0x526ad2,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x6299=['CloudProvider','data5','notify','NotifyMailAccount','Request','GetMailAccount','name','provider','service','email','key','ListId','TemplateId','MailServerIn','Imap','type','Smtp'];(function(_0x3c8ba9,_0x5c456c){var _0x392745=function(_0xd79d24){while(--_0xd79d24){_0x3c8ba9['push'](_0x3c8ba9['shift']());}};_0x392745(++_0x5c456c);}(_0x6299,0x169));var _0x9629=function(_0xd5ebca,_0x39fdcc){_0xd5ebca=_0xd5ebca-0x0;var _0x55fd38=_0x6299[_0xd5ebca];return _0x55fd38;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x9629('0x0')](_0x9629('0x1'),{'options':{'attributes':['id',_0x9629('0x2'),_0x9629('0x3'),_0x9629('0x4'),_0x9629('0x5'),'active',_0x9629('0x6'),_0x9629('0x7'),_0x9629('0x8')],'raw':![],'include':[{'model':_0x9629('0x9'),'as':_0x9629('0xa'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x9629('0x4'),_0x9629('0xb'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0x9629('0xc'),'include':[{'model':_0x9629('0xd'),'attributes':['id',_0x9629('0x2'),'service',_0x9629('0xb'),_0x9629('0xe')],'as':_0x9629('0xd')}]}]},'log':'getMailAccount'});};};exports[_0x9629('0xf')]=function(_0x2ef67f,_0xd4ddd9){return client[_0x9629('0x0')](_0x9629('0x10'),{'account':{'id':_0x2ef67f},'body':_0xd4ddd9,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7e0fb9b..48bc980 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 _0x74ce=['../client','getSettings','Request','GetSettings'];(function(_0x3f31a5,_0x526752){var _0x5e27e0=function(_0xd3b2ce){while(--_0xd3b2ce){_0x3f31a5['push'](_0x3f31a5['shift']());}};_0x5e27e0(++_0x526752);}(_0x74ce,0x178));var _0xe74c=function(_0x2f34b6,_0x201448){_0x2f34b6=_0x2f34b6-0x0;var _0x1aad52=_0x74ce[_0x2f34b6];return _0x1aad52;};'use strict';var client=require(_0xe74c('0x0'));exports[_0xe74c('0x1')]=function(){return client[_0xe74c('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe74c('0x3')});}; \ No newline at end of file +var _0xb9f1=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x53a3d9,_0x581974){var _0x3b80bb=function(_0x103f41){while(--_0x103f41){_0x53a3d9['push'](_0x53a3d9['shift']());}};_0x3b80bb(++_0x581974);}(_0xb9f1,0x96));var _0x1b9f=function(_0x5a1714,_0x5caf51){_0x5a1714=_0x5a1714-0x0;var _0x1c1787=_0xb9f1[_0x5a1714];return _0x1c1787;};'use strict';var client=require(_0x1b9f('0x0'));exports[_0x1b9f('0x1')]=function(){return client[_0x1b9f('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1b9f('0x3')]},'log':_0x1b9f('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a6357a1..b056aeb 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 3147342..e341875 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 _0x394e=['localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x394e,0x1a9));var _0xe394=function(_0x2fbb45,_0x1b2c7f){_0x2fbb45=_0x2fbb45-0x0;var _0x526325=_0x394e[_0x2fbb45];return _0x526325;};'use strict';var _=require(_0xe394('0x0'));var http=require(_0xe394('0x1'));var express=require(_0xe394('0x2'));var sticky=require('sticky-session');var Redis=require(_0xe394('0x3'));var config=require(_0xe394('0x4'));var app=express();var server=http[_0xe394('0x5')](app);server[_0xe394('0x6')]=0xdbba0;if(sticky[_0xe394('0x7')](server,config[_0xe394('0x8')])){var socketio=require(_0xe394('0x9'))(server,{'transports':['websocket',_0xe394('0xa')]});config[_0xe394('0xb')]=_['defaults'](config[_0xe394('0xb')],{'host':_0xe394('0xc'),'port':0x18eb});socketio[_0xe394('0xd')](require(_0xe394('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xe394('0xb')])}));require(_0xe394('0xf'))[_0xe394('0x10')]();require(_0xe394('0x11'))[_0xe394('0x10')](socketio);require('../../config/express')[_0xe394('0x10')](app);require(_0xe394('0x12'))['default'](app);}else{server[_0xe394('0x13')]('listening',function(){console[_0xe394('0x14')](_0xe394('0x15'),config[_0xe394('0x8')]);});}exports=module[_0xe394('0x16')]=app; \ No newline at end of file +var _0xc5b8=['../../config/socketio','../../config/express','../../routes','once','listening','log','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','listen','port','socket.io','redis','localhost','socket.io-redis','../../config/triggers','default'];(function(_0x34e106,_0x91d313){var _0x23a796=function(_0x288d36){while(--_0x288d36){_0x34e106['push'](_0x34e106['shift']());}};_0x23a796(++_0x91d313);}(_0xc5b8,0x1ea));var _0x8c5b=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xc5b8[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0x8c5b('0x0'));var http=require(_0x8c5b('0x1'));var express=require(_0x8c5b('0x2'));var sticky=require(_0x8c5b('0x3'));var Redis=require(_0x8c5b('0x4'));var config=require(_0x8c5b('0x5'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x8c5b('0x6')](server,config[_0x8c5b('0x7')])){var socketio=require(_0x8c5b('0x8'))(server,{'transports':['websocket','polling']});config[_0x8c5b('0x9')]=_['defaults'](config['redis'],{'host':_0x8c5b('0xa'),'port':0x18eb});socketio['adapter'](require(_0x8c5b('0xb'))({'pubClient':new Redis(config[_0x8c5b('0x9')]),'subClient':new Redis(config[_0x8c5b('0x9')])}));require(_0x8c5b('0xc'))[_0x8c5b('0xd')]();require(_0x8c5b('0xe'))['default'](socketio);require(_0x8c5b('0xf'))[_0x8c5b('0xd')](app);require(_0x8c5b('0x10'))['default'](app);}else{server[_0x8c5b('0x11')](_0x8c5b('0x12'),function(){console[_0x8c5b('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x8c5b('0x7')]);});}exports=module[_0x8c5b('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index dd1920b..1d126bd 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 _0x57d4=['Request','request','then','routing','error','rpc','message','result','exports','bluebird','../../config/logger','client'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x57d4,0x75));var _0x457d=function(_0x38c16d,_0x12c7a3){_0x38c16d=_0x38c16d-0x0;var _0x20d775=_0x57d4[_0x38c16d];return _0x20d775;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x457d('0x0'));var logger=require(_0x457d('0x1'))('routing');var client=jayson[_0x457d('0x2')]['http']({'port':0x2329});client[_0x457d('0x3')]=function(_0x31c2c9,_0x3ea8b7){return new BPromise(function(_0x189d7c,_0x4fde7c){return client[_0x457d('0x4')](_0x31c2c9,_0x3ea8b7)[_0x457d('0x5')](function(_0x6b36){logger['debug']('rpc',_0x457d('0x6'),_0x31c2c9,_0x3ea8b7,_0x6b36);if(_0x6b36['error']){logger[_0x457d('0x7')](_0x457d('0x8'),_0x457d('0x6'),_0x31c2c9,_0x6b36[_0x457d('0x7')][_0x457d('0x9')],_0x3ea8b7);return _0x4fde7c(_0x6b36[_0x457d('0x7')][_0x457d('0x9')]);}else{return _0x189d7c(_0x6b36[_0x457d('0xa')]);}})['catch'](function(_0x27f12d){logger[_0x457d('0x7')](_0x457d('0x8'),_0x457d('0x6'),_0x31c2c9,_0x27f12d,_0x3ea8b7);return _0x4fde7c(_0x27f12d);});});};module[_0x457d('0xb')]=client; \ No newline at end of file +var _0x80bd=['error','message','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','debug','rpc','routing'];(function(_0x50ac27,_0x1306e3){var _0x45f86a=function(_0x512a96){while(--_0x512a96){_0x50ac27['push'](_0x50ac27['shift']());}};_0x45f86a(++_0x1306e3);}(_0x80bd,0x78));var _0xd80b=function(_0x151457,_0x3e5560){_0x151457=_0x151457-0x0;var _0x36a3f1=_0x80bd[_0x151457];return _0x36a3f1;};'use strict';var jayson=require(_0xd80b('0x0'));var BPromise=require(_0xd80b('0x1'));var logger=require(_0xd80b('0x2'))('routing');var client=jayson[_0xd80b('0x3')][_0xd80b('0x4')]({'port':0x2329});client[_0xd80b('0x5')]=function(_0x441079,_0x55c2ac){return new BPromise(function(_0x3c3435,_0x53ec25){return client[_0xd80b('0x6')](_0x441079,_0x55c2ac)['then'](function(_0x1c0569){logger[_0xd80b('0x7')](_0xd80b('0x8'),_0xd80b('0x9'),_0x441079,_0x55c2ac,_0x1c0569);if(_0x1c0569[_0xd80b('0xa')]){logger[_0xd80b('0xa')](_0xd80b('0x8'),'routing',_0x441079,_0x1c0569[_0xd80b('0xa')][_0xd80b('0xb')],_0x55c2ac);return _0x53ec25(_0x1c0569[_0xd80b('0xa')][_0xd80b('0xb')]);}else{return _0x3c3435(_0x1c0569['result']);}})['catch'](function(_0x170273){logger['error']('rpc',_0xd80b('0x9'),_0x441079,_0x170273,_0x55c2ac);return _0x53ec25(_0x170273);});});};module[_0xd80b('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 01051c4..b3aa056 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 _0x84b4=['initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues'];(function(_0x550a09,_0x54b8dc){var _0x4ca9cd=function(_0x233661){while(--_0x233661){_0x550a09['push'](_0x550a09['shift']());}};_0x4ca9cd(++_0x54b8dc);}(_0x84b4,0x104));var _0x484b=function(_0x3e3217,_0x518c13){_0x3e3217=_0x3e3217-0x0;var _0x425fac=_0x84b4[_0x3e3217];return _0x425fac;};'use strict';var BPromise=require(_0x484b('0x0'));var server=require('./server');var Realtime=require(_0x484b('0x1'));var user=require(_0x484b('0x2'));var interval=require(_0x484b('0x3'));var openchannelQueue=require(_0x484b('0x4'));var chatQueue=require(_0x484b('0x5'));var smsQueue=require(_0x484b('0x6'));var mailQueue=require(_0x484b('0x7'));var faxQueue=require(_0x484b('0x8'));var whatsappQueue=require(_0x484b('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x484b('0xa')]()[_0x484b('0xb')](user[_0x484b('0xc')]())[_0x484b('0xb')](realtime[_0x484b('0xd')]())['then'](interval[_0x484b('0xe')]())[_0x484b('0xb')](realtime[_0x484b('0xf')]())[_0x484b('0xb')](openchannelQueue[_0x484b('0x10')]())['then'](realtime[_0x484b('0x11')]())[_0x484b('0xb')](chatQueue['getChatQueues']())['then'](realtime[_0x484b('0x12')]())[_0x484b('0xb')](smsQueue[_0x484b('0x13')]())[_0x484b('0xb')](realtime[_0x484b('0x14')]())['then'](mailQueue[_0x484b('0x15')]())['then'](realtime[_0x484b('0x16')]())['then'](faxQueue['getFaxQueues']())[_0x484b('0xb')](realtime[_0x484b('0x17')]())[_0x484b('0xb')](whatsappQueue[_0x484b('0x18')]())[_0x484b('0xb')](realtime[_0x484b('0x19')]())['then'](function(){return realtime;});}function main(){return server[_0x484b('0x1a')](realtime)['then'](function(_0xd223a8){return initRealtime();})[_0x484b('0xb')](function(_0x168b2d){return setInterval(initRealtime,0x1388);})[_0x484b('0x1b')](function(_0x209d04){console['log'](_0x209d04);});}main(); \ No newline at end of file +var _0xde8d=['getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xde8d,0x1d4));var _0xdde8=function(_0x1eed00,_0x3f65a1){_0x1eed00=_0x1eed00-0x0;var _0x3e0b7c=_0xde8d[_0x1eed00];return _0x3e0b7c;};'use strict';var BPromise=require(_0xdde8('0x0'));var server=require(_0xdde8('0x1'));var Realtime=require(_0xdde8('0x2'));var user=require(_0xdde8('0x3'));var interval=require(_0xdde8('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xdde8('0x5'));var smsQueue=require(_0xdde8('0x6'));var mailQueue=require(_0xdde8('0x7'));var faxQueue=require(_0xdde8('0x8'));var whatsappQueue=require(_0xdde8('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xdde8('0xa')]()[_0xdde8('0xb')](user[_0xdde8('0xc')]())[_0xdde8('0xb')](realtime[_0xdde8('0xd')]())['then'](interval[_0xdde8('0xe')]())['then'](realtime[_0xdde8('0xf')]())['then'](openchannelQueue[_0xdde8('0x10')]())[_0xdde8('0xb')](realtime[_0xdde8('0x11')]())[_0xdde8('0xb')](chatQueue[_0xdde8('0x12')]())['then'](realtime['initChatQueues']())['then'](smsQueue[_0xdde8('0x13')]())[_0xdde8('0xb')](realtime[_0xdde8('0x14')]())[_0xdde8('0xb')](mailQueue[_0xdde8('0x15')]())[_0xdde8('0xb')](realtime[_0xdde8('0x16')]())[_0xdde8('0xb')](faxQueue['getFaxQueues']())['then'](realtime[_0xdde8('0x17')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xdde8('0xb')](realtime[_0xdde8('0x18')]())[_0xdde8('0xb')](function(){return realtime;});}function main(){return server[_0xdde8('0x19')](realtime)[_0xdde8('0xb')](function(_0x49e206){return initRealtime();})[_0xdde8('0xb')](function(_0x409840){return setInterval(initRealtime,0x1388);})[_0xdde8('0x1a')](function(_0x2ce50a){console['log'](_0x2ce50a);});}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 39da235..6751f41 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x34d103,_0x362659){var _0x5a975d=function(_0x5cfaa0){while(--_0x5cfaa0){_0x34d103['push'](_0x34d103['shift']());}};_0x5a975d(++_0x362659);}(_0x5fc3,0xa8));var _0x35fc=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x5fc3[_0x329437];return _0x3789d9;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x2615b7,_0x28e0e2){var _0x29f0a0=function(_0x4fc744){while(--_0x4fc744){_0x2615b7['push'](_0x2615b7['shift']());}};_0x29f0a0(++_0x28e0e2);}(_0xe14b,0x93));var _0xbe14=function(_0x131c01,_0x58f223){_0x131c01=_0x131c01-0x0;var _0x29648c=_0xe14b[_0x131c01];return _0x29648c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4a9ac8a..c074e66 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 _0xa571=['catch','sendMailMessage','SendMail','bluebird','client','http','request','then','error','message','result'];(function(_0x4549ce,_0x5e0e98){var _0x260434=function(_0x8031ce){while(--_0x8031ce){_0x4549ce['push'](_0x4549ce['shift']());}};_0x260434(++_0x5e0e98);}(_0xa571,0x71));var _0x1a57=function(_0xb3beb1,_0x4a5118){_0xb3beb1=_0xb3beb1-0x0;var _0xd1f8e9=_0xa571[_0xb3beb1];return _0xd1f8e9;};'use strict';var BPromise=require(_0x1a57('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x1a57('0x1')][_0x1a57('0x2')]({'port':0x232b});function request(_0x4a94f1,_0x1ae4f4){return new BPromise(function(_0x1155e6,_0x2ca8ef){return client[_0x1a57('0x3')](_0x4a94f1,_0x1ae4f4)[_0x1a57('0x4')](function(_0x428e04){if(_0x428e04[_0x1a57('0x5')]){return _0x2ca8ef(_0x428e04[_0x1a57('0x5')][_0x1a57('0x6')]);}else{return _0x1155e6(_0x428e04[_0x1a57('0x7')]);}})[_0x1a57('0x8')](function(_0x283178){return _0x2ca8ef(_0x283178);});});}exports[_0x1a57('0x9')]=function(_0x1e3c01,_0x14340d){return request(_0x1a57('0xa'),{'account':_0x1e3c01,'message':_0x14340d});}; \ No newline at end of file +var _0xa52e=['http','request','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0xa52e,0x1ca));var _0xea52=function(_0x3c8006,_0x547e62){_0x3c8006=_0x3c8006-0x0;var _0x4e2bb2=_0xa52e[_0x3c8006];return _0x4e2bb2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xea52('0x0'));var client=jayson[_0xea52('0x1')][_0xea52('0x2')]({'port':0x232b});function request(_0x22ad9f,_0x29e17b){return new BPromise(function(_0x1e917c,_0x373df2){return client[_0xea52('0x3')](_0x22ad9f,_0x29e17b)['then'](function(_0x182a80){if(_0x182a80[_0xea52('0x4')]){return _0x373df2(_0x182a80[_0xea52('0x4')][_0xea52('0x5')]);}else{return _0x1e917c(_0x182a80[_0xea52('0x6')]);}})[_0xea52('0x7')](function(_0x3fce0d){return _0x373df2(_0x3fce0d);});});}exports[_0xea52('0x8')]=function(_0x1589f7,_0x563a36){return request(_0xea52('0x9'),{'account':_0x1589f7,'message':_0x563a36});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 56ebd42..f24d40a 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 _0xfcbb=['exports','lodash','md5','moment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','openchannelCurrentCapacity','chatWaitingInteractions','omit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x267763,_0x39581d){_0x267763=_0x267763-0x0;var _0x2e7178=_0xfcbb[_0x267763];return _0x2e7178;};'use strict';var _=require(_0xbfcb('0x0'));var md5=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xbfcb('0x3')]=_[_0xbfcb('0x4')](config[_0xbfcb('0x3')],{'host':_0xbfcb('0x5'),'port':0x18eb});var io=require(_0xbfcb('0x6'))(new Redis(config['redis']));function Agent(_0x5201d3){this['id']=_0x5201d3['id']||0x0;this[_0xbfcb('0x7')]=_0x5201d3[_0xbfcb('0x7')]||'';this[_0xbfcb('0x8')]=_0x5201d3[_0xbfcb('0x8')]||!![];this[_0xbfcb('0x9')]=_0x5201d3[_0xbfcb('0x9')]||![];this[_0xbfcb('0xa')]=_0x5201d3['chatPause']||![];this[_0xbfcb('0xb')]=_0x5201d3[_0xbfcb('0xb')]||![];this[_0xbfcb('0xc')]=_0x5201d3['faxPause']||![];this[_0xbfcb('0xd')]=_0x5201d3[_0xbfcb('0xd')]||![];this[_0xbfcb('0xe')]=_0x5201d3[_0xbfcb('0xe')]||![];this[_0xbfcb('0xf')]=_0xbfcb('0x10');this['chatStatusTime']=0x0;this[_0xbfcb('0x11')]=_0x5201d3[_0xbfcb('0x11')]||0x0;this[_0xbfcb('0x12')]=0x0;this[_0xbfcb('0x13')]='unknown';this[_0xbfcb('0x14')]=0x0;this['mailCapacity']=_0x5201d3[_0xbfcb('0x15')]||0x0;this[_0xbfcb('0x16')]=0x0;this[_0xbfcb('0x17')]=_0xbfcb('0x10');this[_0xbfcb('0x18')]=0x0;this[_0xbfcb('0x19')]=_0x5201d3[_0xbfcb('0x19')]||0x0;this[_0xbfcb('0x1a')]=0x0;this[_0xbfcb('0x1b')]=_0xbfcb('0x10');this[_0xbfcb('0x1c')]=0x0;this[_0xbfcb('0x1d')]=_0x5201d3[_0xbfcb('0x1d')]||0x0;this[_0xbfcb('0x1e')]=0x0;this[_0xbfcb('0x1f')]=_0xbfcb('0x10');this[_0xbfcb('0x20')]=0x0;this[_0xbfcb('0x21')]=_0x5201d3[_0xbfcb('0x21')]||0x0;this[_0xbfcb('0x22')]=0x0;this[_0xbfcb('0x23')]=_0xbfcb('0x10');this['openchannelStatusTime']=0x0;this[_0xbfcb('0x24')]=_0x5201d3[_0xbfcb('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xbfcb('0x25')]=![];this[_0xbfcb('0x26')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0xbfcb('0x27')]={};this[_0xbfcb('0x28')]={};this[_0xbfcb('0x29')]={};this[_0xbfcb('0x2a')]={};this[_0xbfcb('0x2b')]={};this['updateRealtime']();}Agent[_0xbfcb('0x2c')][_0xbfcb('0x2d')]=function(_0x2d9288){if(this[_0x2d9288+_0xbfcb('0x2e')]>0x0){if(this[_0x2d9288+_0xbfcb('0x2f')]>0x0&&this[_0x2d9288+_0xbfcb('0x2e')]>=this[_0x2d9288+_0xbfcb('0x2f')]){return _0xbfcb('0x30');}else{return _0xbfcb('0x31');}}else{return _0xbfcb('0x32');}};Agent[_0xbfcb('0x2c')][_0xbfcb('0x33')]=function(){var _0x3ef71c=[_0xbfcb('0x34'),_0xbfcb('0x35'),_0xbfcb('0x36'),'fax',_0xbfcb('0x37'),_0xbfcb('0x38')];for(var _0x4cf7ca=0x0;_0x4cf7ca<_0x3ef71c[_0xbfcb('0x39')];_0x4cf7ca+=0x1){var _0x15197b=this[_0xbfcb('0x2d')](_0x3ef71c[_0x4cf7ca]);if(this[_0x3ef71c[_0x4cf7ca]+_0xbfcb('0x3a')]!==_0x15197b){this[_0x3ef71c[_0x4cf7ca]+_0xbfcb('0x3b')]=_[_0xbfcb('0x3c')](moment()[_0xbfcb('0x3d')]('x'));}this[_0x3ef71c[_0x4cf7ca]+_0xbfcb('0x3a')]=_0x15197b;}var _0x434764={'id':this['id'],'name':this[_0xbfcb('0x7')],'online':this['online'],'voicePause':this[_0xbfcb('0x9')],'chatPause':this[_0xbfcb('0xa')],'mailPause':this[_0xbfcb('0xb')],'smsPause':this[_0xbfcb('0xd')],'faxPause':this[_0xbfcb('0xc')],'openchannelPause':this[_0xbfcb('0xe')],'chatStatus':this[_0xbfcb('0xf')],'chatStatusTime':this[_0xbfcb('0x3e')],'chatCapacity':this[_0xbfcb('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xbfcb('0x13')],'mailStatusTime':this[_0xbfcb('0x14')],'mailCapacity':this[_0xbfcb('0x15')],'mailCurrentCapacity':this[_0xbfcb('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xbfcb('0x19')],'faxCurrentCapacity':this[_0xbfcb('0x1a')],'smsStatus':this[_0xbfcb('0x1b')],'smsStatusTime':this[_0xbfcb('0x1c')],'smsCapacity':this[_0xbfcb('0x1d')],'smsCurrentCapacity':this[_0xbfcb('0x1e')],'whatsappStatus':this[_0xbfcb('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xbfcb('0x23')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xbfcb('0x24')],'openchannelCurrentCapacity':this[_0xbfcb('0x3f')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xbfcb('0x40')],'faxWaitingInteractions':this[_0xbfcb('0x27')],'mailWaitingInteractions':this[_0xbfcb('0x28')],'openchannelWaitingInteractions':this[_0xbfcb('0x29')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xbfcb('0x2b')]};var _0xf35aa5=md5(JSON['stringify'](_0x434764));if(this['md5']!==_0xf35aa5){this[_0xbfcb('0x1')]=_0xf35aa5;io['emit']('user:routing:update',_[_0xbfcb('0x41')](_0x434764,[_0xbfcb('0x8')]));}};module[_0xbfcb('0x42')]=Agent; \ No newline at end of file +var _0x6343=['chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','md5','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','whatsapp','getChannelStatus','StatusTime','toNumber','smsPause','chatStatus','faxCurrentCapacity','smsCurrentCapacity','whatsappStatusTime','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','whatsappWaitingInteractions','emit','user:routing:update','exports','moment','ioredis','localhost','socket.io-emitter','name','online','chatPause','mailPause','faxPause','openchannelPause','unknown','chatStatusTime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6343,0x168));var _0x3634=function(_0x173de2,_0x1b1f6a){_0x173de2=_0x173de2-0x0;var _0x528abe=_0x6343[_0x173de2];return _0x528abe;};'use strict';var _=require('lodash');var md5=require('md5');var moment=require(_0x3634('0x0'));var Redis=require(_0x3634('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0x3634('0x2'),'port':0x18eb});var io=require(_0x3634('0x3'))(new Redis(config['redis']));function Agent(_0x247964){this['id']=_0x247964['id']||0x0;this[_0x3634('0x4')]=_0x247964['name']||'';this[_0x3634('0x5')]=_0x247964[_0x3634('0x5')]||!![];this['voicePause']=_0x247964['voicePause']||![];this[_0x3634('0x6')]=_0x247964[_0x3634('0x6')]||![];this[_0x3634('0x7')]=_0x247964[_0x3634('0x7')]||![];this[_0x3634('0x8')]=_0x247964[_0x3634('0x8')]||![];this['smsPause']=_0x247964['smsPause']||![];this[_0x3634('0x9')]=_0x247964[_0x3634('0x9')]||![];this['chatStatus']=_0x3634('0xa');this[_0x3634('0xb')]=0x0;this[_0x3634('0xc')]=_0x247964[_0x3634('0xc')]||0x0;this[_0x3634('0xd')]=0x0;this[_0x3634('0xe')]=_0x3634('0xa');this[_0x3634('0xf')]=0x0;this[_0x3634('0x10')]=_0x247964[_0x3634('0x10')]||0x0;this[_0x3634('0x11')]=0x0;this[_0x3634('0x12')]=_0x3634('0xa');this[_0x3634('0x13')]=0x0;this['faxCapacity']=_0x247964[_0x3634('0x14')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x3634('0x15')]=_0x3634('0xa');this[_0x3634('0x16')]=0x0;this[_0x3634('0x17')]=_0x247964[_0x3634('0x17')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x3634('0x18')]='unknown';this['whatsappStatusTime']=0x0;this[_0x3634('0x19')]=_0x247964['whatsappCapacity']||0x0;this[_0x3634('0x1a')]=0x0;this[_0x3634('0x1b')]=_0x3634('0xa');this['openchannelStatusTime']=0x0;this[_0x3634('0x1c')]=_0x247964[_0x3634('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x3634('0x1d')]=![];this['busyQueue']=undefined;this[_0x3634('0x1e')]='';this[_0x3634('0x1f')]={};this['faxWaitingInteractions']={};this[_0x3634('0x20')]={};this[_0x3634('0x21')]={};this[_0x3634('0x22')]={};this['whatsappWaitingInteractions']={};this[_0x3634('0x23')]();}Agent[_0x3634('0x24')]['getChannelStatus']=function(_0x3936ee){if(this[_0x3936ee+'CurrentCapacity']>0x0){if(this[_0x3936ee+'Capacity']>0x0&&this[_0x3936ee+_0x3634('0x25')]>=this[_0x3936ee+_0x3634('0x26')]){return'maxcapacity';}else{return _0x3634('0x27');}}else{return _0x3634('0x28');}};Agent[_0x3634('0x24')][_0x3634('0x23')]=function(){var _0x363ca2=[_0x3634('0x29'),_0x3634('0x2a'),_0x3634('0x2b'),_0x3634('0x2c'),'sms',_0x3634('0x2d')];for(var _0x552cc3=0x0;_0x552cc3<_0x363ca2['length'];_0x552cc3+=0x1){var _0x59f481=this[_0x3634('0x2e')](_0x363ca2[_0x552cc3]);if(this[_0x363ca2[_0x552cc3]+'Status']!==_0x59f481){this[_0x363ca2[_0x552cc3]+_0x3634('0x2f')]=_[_0x3634('0x30')](moment()['format']('x'));}this[_0x363ca2[_0x552cc3]+'Status']=_0x59f481;}var _0x282f73={'id':this['id'],'name':this['name'],'online':this[_0x3634('0x5')],'voicePause':this['voicePause'],'chatPause':this[_0x3634('0x6')],'mailPause':this[_0x3634('0x7')],'smsPause':this[_0x3634('0x31')],'faxPause':this[_0x3634('0x8')],'openchannelPause':this[_0x3634('0x9')],'chatStatus':this[_0x3634('0x32')],'chatStatusTime':this[_0x3634('0xb')],'chatCapacity':this[_0x3634('0xc')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x3634('0x10')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x3634('0x12')],'faxStatusTime':this[_0x3634('0x13')],'faxCapacity':this[_0x3634('0x14')],'faxCurrentCapacity':this[_0x3634('0x33')],'smsStatus':this[_0x3634('0x15')],'smsStatusTime':this[_0x3634('0x16')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x3634('0x34')],'whatsappStatus':this[_0x3634('0x18')],'whatsappStatusTime':this[_0x3634('0x35')],'whatsappCapacity':this[_0x3634('0x19')],'whatsappCurrentCapacity':this[_0x3634('0x1a')],'openchannelStatus':this[_0x3634('0x1b')],'openchannelStatusTime':this[_0x3634('0x36')],'openchannelCapacity':this[_0x3634('0x1c')],'openchannelCurrentCapacity':this[_0x3634('0x37')],'busy':this['busy'],'busyQueue':this[_0x3634('0x38')],'chatWaitingInteractions':this[_0x3634('0x1f')],'faxWaitingInteractions':this[_0x3634('0x39')],'mailWaitingInteractions':this[_0x3634('0x20')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x3634('0x22')],'whatsappWaitingInteractions':this[_0x3634('0x3a')]};var _0x22d091=md5(JSON['stringify'](_0x282f73));if(this['md5']!==_0x22d091){this['md5']=_0x22d091;io[_0x3634('0x3b')](_0x3634('0x3c'),_['omit'](_0x282f73,[_0x3634('0x5')]));}};module[_0x3634('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fd4fad6..416a5d1 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 _0x17b6=['name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','length','online','paused','available','stringify','format','emit','chat_queue:save','lodash','util','ioredis','../../../config/environment','redis'];(function(_0x146cb9,_0x349d0b){var _0x2dbc9a=function(_0x2917ac){while(--_0x2917ac){_0x146cb9['push'](_0x146cb9['shift']());}};_0x2dbc9a(++_0x349d0b);}(_0x17b6,0x97));var _0x617b=function(_0x183d41,_0x1aebd7){_0x183d41=_0x183d41-0x0;var _0x4f0939=_0x17b6[_0x183d41];return _0x4f0939;};'use strict';var _=require(_0x617b('0x0'));var md5=require('md5');var util=require(_0x617b('0x1'));var Redis=require(_0x617b('0x2'));var config=require(_0x617b('0x3'));config[_0x617b('0x4')]=_['defaults'](config[_0x617b('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x617b('0x4')]));function ChatQueue(_0x27a345){this['id']=_0x27a345['id']||0x0;this[_0x617b('0x5')]=_0x27a345['name']||'';this[_0x617b('0x6')]=_0x27a345[_0x617b('0x6')]||0xa;this['strategy']=_0x27a345[_0x617b('0x7')]||_0x617b('0x8');this[_0x617b('0x9')]=_0x27a345[_0x617b('0x9')];this['mapAgentsId']={};this[_0x617b('0xa')]=0x0;this[_0x617b('0xb')]='';this[_0x617b('0xc')]();this['updateRealtime']();}ChatQueue[_0x617b('0xd')][_0x617b('0xc')]=function(){var _0x8aa1d6=this[_0x617b('0xe')][_0x617b('0xf')];this[_0x617b('0xe')]=_['map'](this['Agents'],'id');this[_0x617b('0xe')][_0x617b('0xf')]=_0x8aa1d6;};ChatQueue[_0x617b('0xd')][_0x617b('0x10')]=function(){this[_0x617b('0x11')]=0x0;this['paused']=0x0;for(var _0x374426=0x0;_0x374426=0x0?this[_0x617b('0x15')]:0x0;var _0x2178a0={'id':this['id'],'available':this[_0x617b('0x15')],'loggedIn':this[_0x617b('0x11')],'name':this[_0x617b('0x5')],'paused':this[_0x617b('0x14')],'waiting':this[_0x617b('0xa')]};var _0x128f25=md5(JSON[_0x617b('0x16')](_0x2178a0));if(this[_0x617b('0xb')]!==_0x128f25){this[_0x617b('0xb')]=_0x128f25;io['to'](util[_0x617b('0x17')]('chat:queue:%s',_0x2178a0[_0x617b('0x5')]))[_0x617b('0x18')](_0x617b('0x19'),_0x2178a0);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x1763=['ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','name','timeout','strategy','updateRouting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','length','online','available','paused','waiting','format','chat:queue:%s','chat_queue:save','lodash','md5','util'];(function(_0x3847fd,_0x50da58){var _0x48139e=function(_0x167747){while(--_0x167747){_0x3847fd['push'](_0x3847fd['shift']());}};_0x48139e(++_0x50da58);}(_0x1763,0xd5));var _0x3176=function(_0x4d7285,_0x49c65f){_0x4d7285=_0x4d7285-0x0;var _0x2dac6c=_0x1763[_0x4d7285];return _0x2dac6c;};'use strict';var _=require(_0x3176('0x0'));var md5=require(_0x3176('0x1'));var util=require(_0x3176('0x2'));var Redis=require(_0x3176('0x3'));var config=require(_0x3176('0x4'));config['redis']=_[_0x3176('0x5')](config['redis'],{'host':_0x3176('0x6'),'port':0x18eb});var io=require(_0x3176('0x7'))(new Redis(config['redis']));function ChatQueue(_0x1c2609){this['id']=_0x1c2609['id']||0x0;this[_0x3176('0x8')]=_0x1c2609[_0x3176('0x8')]||'';this[_0x3176('0x9')]=_0x1c2609[_0x3176('0x9')]||0xa;this[_0x3176('0xa')]=_0x1c2609[_0x3176('0xa')]||'beepall';this['Agents']=_0x1c2609['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x3176('0xb')]();this[_0x3176('0xc')]();}ChatQueue['prototype'][_0x3176('0xb')]=function(){var _0xcb3318=this[_0x3176('0xd')][_0x3176('0xe')];this[_0x3176('0xd')]=_[_0x3176('0xf')](this[_0x3176('0x10')],'id');this[_0x3176('0xd')][_0x3176('0xe')]=_0xcb3318;};ChatQueue[_0x3176('0x11')][_0x3176('0xc')]=function(){this[_0x3176('0x12')]=0x0;this['paused']=0x0;for(var _0x176614=0x0;_0x176614=0x0?this[_0x3176('0x15')]:0x0;var _0x374a7d={'id':this['id'],'available':this[_0x3176('0x15')],'loggedIn':this[_0x3176('0x12')],'name':this['name'],'paused':this[_0x3176('0x16')],'waiting':this[_0x3176('0x17')]};var _0x5811e2=md5(JSON['stringify'](_0x374a7d));if(this['md5']!==_0x5811e2){this[_0x3176('0x1')]=_0x5811e2;io['to'](util[_0x3176('0x18')](_0x3176('0x19'),_0x374a7d[_0x3176('0x8')]))['emit'](_0x3176('0x1a'),_0x374a7d);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 08525c4..ff00b6b 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 _0x2939=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','emit','fax_queue:save','exports'];(function(_0x25307b,_0xdb1782){var _0x2642f7=function(_0x51cc2b){while(--_0x51cc2b){_0x25307b['push'](_0x25307b['shift']());}};_0x2642f7(++_0xdb1782);}(_0x2939,0x78));var _0x9293=function(_0x38674e,_0x170f1e){_0x38674e=_0x38674e-0x0;var _0x282a8a=_0x2939[_0x38674e];return _0x282a8a;};'use strict';var _=require(_0x9293('0x0'));var md5=require(_0x9293('0x1'));var util=require(_0x9293('0x2'));var Redis=require(_0x9293('0x3'));var config=require(_0x9293('0x4'));config[_0x9293('0x5')]=_[_0x9293('0x6')](config[_0x9293('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9293('0x7'))(new Redis(config[_0x9293('0x5')]));function FaxQueue(_0x5f2a12){this['id']=_0x5f2a12['id']||0x0;this[_0x9293('0x8')]=_0x5f2a12['name']||'';this[_0x9293('0x9')]=_0x5f2a12['timeout']||0xa;this[_0x9293('0xa')]=_0x5f2a12['strategy']||_0x9293('0xb');this[_0x9293('0xc')]=_0x5f2a12[_0x9293('0xc')];this[_0x9293('0xd')]={};this[_0x9293('0xe')]=0x0;this[_0x9293('0x1')]='';this[_0x9293('0xf')]();this[_0x9293('0x10')]();}FaxQueue[_0x9293('0x11')][_0x9293('0xf')]=function(){var _0x2cb534=this[_0x9293('0xd')][_0x9293('0x12')];this['mapAgentsId']=_['map'](this[_0x9293('0xc')],'id');this[_0x9293('0xd')]['_rr']=_0x2cb534;};FaxQueue[_0x9293('0x11')][_0x9293('0x10')]=function(){this[_0x9293('0x13')]=0x0;this[_0x9293('0x14')]=0x0;for(var _0x5412fb=0x0;_0x5412fb=0x0?this[_0x9293('0x18')]:0x0;var _0xec70d8={'id':this['id'],'available':this[_0x9293('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x9293('0x14')],'waiting':this['waiting']};var _0x10cf49=md5(JSON[_0x9293('0x19')](_0xec70d8));if(this[_0x9293('0x1')]!==_0x10cf49){this[_0x9293('0x1')]=_0x10cf49;io['to'](util[_0x9293('0x1a')]('fax:queue:%s',_0xec70d8[_0x9293('0x8')]))[_0x9293('0x1b')](_0x9293('0x1c'),_0xec70d8);}};module[_0x9293('0x1d')]=FaxQueue; \ No newline at end of file +var _0x8a2c=['beepall','Agents','mapAgentsId','waiting','md5','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','available','name','stringify','format','fax:queue:%s','emit','exports','lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy'];(function(_0x3e950d,_0x59ee71){var _0x37c1eb=function(_0x4ca829){while(--_0x4ca829){_0x3e950d['push'](_0x3e950d['shift']());}};_0x37c1eb(++_0x59ee71);}(_0x8a2c,0x12c));var _0xc8a2=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x8a2c[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xc8a2('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0xc8a2('0x1'));config[_0xc8a2('0x2')]=_[_0xc8a2('0x3')](config[_0xc8a2('0x2')],{'host':_0xc8a2('0x4'),'port':0x18eb});var io=require(_0xc8a2('0x5'))(new Redis(config[_0xc8a2('0x2')]));function FaxQueue(_0x37ae13){this['id']=_0x37ae13['id']||0x0;this['name']=_0x37ae13['name']||'';this[_0xc8a2('0x6')]=_0x37ae13['timeout']||0xa;this[_0xc8a2('0x7')]=_0x37ae13[_0xc8a2('0x7')]||_0xc8a2('0x8');this[_0xc8a2('0x9')]=_0x37ae13[_0xc8a2('0x9')];this[_0xc8a2('0xa')]={};this[_0xc8a2('0xb')]=0x0;this[_0xc8a2('0xc')]='';this[_0xc8a2('0xd')]();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x32ecfc=this[_0xc8a2('0xa')][_0xc8a2('0xe')];this[_0xc8a2('0xa')]=_[_0xc8a2('0xf')](this['Agents'],'id');this[_0xc8a2('0xa')][_0xc8a2('0xe')]=_0x32ecfc;};FaxQueue[_0xc8a2('0x10')][_0xc8a2('0x11')]=function(){this[_0xc8a2('0x12')]=0x0;this[_0xc8a2('0x13')]=0x0;for(var _0x2eb6ee=0x0;_0x2eb6ee=0x0?this['available']:0x0;var _0x78b2a7={'id':this['id'],'available':this[_0xc8a2('0x15')],'loggedIn':this[_0xc8a2('0x12')],'name':this[_0xc8a2('0x16')],'paused':this[_0xc8a2('0x13')],'waiting':this[_0xc8a2('0xb')]};var _0x537f95=md5(JSON[_0xc8a2('0x17')](_0x78b2a7));if(this[_0xc8a2('0xc')]!==_0x537f95){this['md5']=_0x537f95;io['to'](util[_0xc8a2('0x18')](_0xc8a2('0x19'),_0x78b2a7[_0xc8a2('0x16')]))[_0xc8a2('0x1a')]('fax_queue:save',_0x78b2a7);}};module[_0xc8a2('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 3e170b4..9fb9f41 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 _0xaff6=['exports','name'];(function(_0x229cc8,_0x5cad95){var _0x1f5a1f=function(_0xfc7f11){while(--_0xfc7f11){_0x229cc8['push'](_0x229cc8['shift']());}};_0x1f5a1f(++_0x5cad95);}(_0xaff6,0xd9));var _0x6aff=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xaff6[_0x154983];return _0x3d1243;};'use strict';function Interval(_0xc9b69){this['id']=_0xc9b69['id']||0x0;this[_0x6aff('0x0')]=_0xc9b69['name']||'';this['Intervals']=_0xc9b69['Intervals']||{};}module[_0x6aff('0x1')]=Interval; \ No newline at end of file +var _0x8838=['Intervals','exports','name'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x8838,0x137));var _0x8883=function(_0x37d5a1,_0x30bf5b){_0x37d5a1=_0x37d5a1-0x0;var _0x54fefe=_0x8838[_0x37d5a1];return _0x54fefe;};'use strict';function Interval(_0x337702){this['id']=_0x337702['id']||0x0;this[_0x8883('0x0')]=_0x337702['name']||'';this[_0x8883('0x1')]=_0x337702[_0x8883('0x1')]||{};}module[_0x8883('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 79ab424..8aa68ac 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 _0xa38c=['updateRouting','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xa38c,0x1b3));var _0xca38=function(_0x4fcb0f,_0x5e8627){_0x4fcb0f=_0x4fcb0f-0x0;var _0xf9107d=_0xa38c[_0x4fcb0f];return _0xf9107d;};'use strict';var _=require(_0xca38('0x0'));var md5=require(_0xca38('0x1'));var util=require(_0xca38('0x2'));var Redis=require(_0xca38('0x3'));var config=require('../../../config/environment');config[_0xca38('0x4')]=_[_0xca38('0x5')](config[_0xca38('0x4')],{'host':_0xca38('0x6'),'port':0x18eb});var io=require(_0xca38('0x7'))(new Redis(config[_0xca38('0x4')]));function MailQueue(_0x110813){this['id']=_0x110813['id']||0x0;this['name']=_0x110813[_0xca38('0x8')]||'';this['timeout']=_0x110813[_0xca38('0x9')]||0xa;this[_0xca38('0xa')]=_0x110813[_0xca38('0xa')]||_0xca38('0xb');this[_0xca38('0xc')]=_0x110813[_0xca38('0xc')];this['mapAgentsId']={};this[_0xca38('0xd')]=0x0;this[_0xca38('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xca38('0xe')][_0xca38('0xf')]=function(){var _0x3fa4c0=this[_0xca38('0x10')]['_rr'];this[_0xca38('0x10')]=_[_0xca38('0x11')](this['Agents'],'id');this['mapAgentsId'][_0xca38('0x12')]=_0x3fa4c0;};MailQueue[_0xca38('0xe')][_0xca38('0x13')]=function(){this[_0xca38('0x14')]=0x0;this[_0xca38('0x15')]=0x0;for(var _0x4042e9=0x0;_0x4042e9=0x0?this[_0xca38('0x18')]:0x0;var _0x1f5fda={'id':this['id'],'available':this[_0xca38('0x18')],'loggedIn':this[_0xca38('0x14')],'name':this[_0xca38('0x8')],'paused':this[_0xca38('0x15')],'waiting':this['waiting']};var _0x454eed=md5(JSON[_0xca38('0x19')](_0x1f5fda));if(this[_0xca38('0x1')]!==_0x454eed){this[_0xca38('0x1')]=_0x454eed;io['to'](util[_0xca38('0x1a')](_0xca38('0x1b'),_0x1f5fda[_0xca38('0x8')]))['emit'](_0xca38('0x1c'),_0x1f5fda);}};module[_0xca38('0x1d')]=MailQueue; \ No newline at end of file +var _0x0085=['lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','available','format','mail:queue:%s','emit','mail_queue:save','exports'];(function(_0x2854c4,_0x3dc2d0){var _0x5c8205=function(_0x4e8570){while(--_0x4e8570){_0x2854c4['push'](_0x2854c4['shift']());}};_0x5c8205(++_0x3dc2d0);}(_0x0085,0xb4));var _0x5008=function(_0x1598fb,_0x29645f){_0x1598fb=_0x1598fb-0x0;var _0x4fae38=_0x0085[_0x1598fb];return _0x4fae38;};'use strict';var _=require(_0x5008('0x0'));var md5=require(_0x5008('0x1'));var util=require('util');var Redis=require(_0x5008('0x2'));var config=require(_0x5008('0x3'));config['redis']=_[_0x5008('0x4')](config[_0x5008('0x5')],{'host':_0x5008('0x6'),'port':0x18eb});var io=require(_0x5008('0x7'))(new Redis(config[_0x5008('0x5')]));function MailQueue(_0x3522cb){this['id']=_0x3522cb['id']||0x0;this[_0x5008('0x8')]=_0x3522cb[_0x5008('0x8')]||'';this[_0x5008('0x9')]=_0x3522cb[_0x5008('0x9')]||0xa;this[_0x5008('0xa')]=_0x3522cb['strategy']||_0x5008('0xb');this['Agents']=_0x3522cb[_0x5008('0xc')];this[_0x5008('0xd')]={};this[_0x5008('0xe')]=0x0;this[_0x5008('0x1')]='';this['updateRouting']();this[_0x5008('0xf')]();}MailQueue[_0x5008('0x10')][_0x5008('0x11')]=function(){var _0x380382=this['mapAgentsId']['_rr'];this[_0x5008('0xd')]=_[_0x5008('0x12')](this[_0x5008('0xc')],'id');this[_0x5008('0xd')][_0x5008('0x13')]=_0x380382;};MailQueue[_0x5008('0x10')][_0x5008('0xf')]=function(){this[_0x5008('0x14')]=0x0;this[_0x5008('0x15')]=0x0;for(var _0x245711=0x0;_0x245711=0x0?this[_0x5008('0x18')]:0x0;var _0x338941={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5008('0x14')],'name':this[_0x5008('0x8')],'paused':this[_0x5008('0x15')],'waiting':this[_0x5008('0xe')]};var _0x169121=md5(JSON['stringify'](_0x338941));if(this['md5']!==_0x169121){this[_0x5008('0x1')]=_0x169121;io['to'](util[_0x5008('0x19')](_0x5008('0x1a'),_0x338941['name']))[_0x5008('0x1b')](_0x5008('0x1c'),_0x338941);}};module[_0x5008('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 8f274e1..c23c413 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x7a54,0x106));var _0x47a5=function(_0x100acf,_0x2288df){_0x100acf=_0x100acf-0x0;var _0x4f435a=_0x7a54[_0x100acf];return _0x4f435a;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f5bbc3e..ab936a2 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 _0x26c2=['format','emit','sms_queue:save','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','smsPause','available','waiting','stringify'];(function(_0x3466f2,_0x40feab){var _0x569ca2=function(_0x46b750){while(--_0x46b750){_0x3466f2['push'](_0x3466f2['shift']());}};_0x569ca2(++_0x40feab);}(_0x26c2,0x130));var _0x226c=function(_0x33afbe,_0xf0e2cd){_0x33afbe=_0x33afbe-0x0;var _0x55dc2c=_0x26c2[_0x33afbe];return _0x55dc2c;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x226c('0x0'));var config=require(_0x226c('0x1'));config[_0x226c('0x2')]=_[_0x226c('0x3')](config['redis'],{'host':_0x226c('0x4'),'port':0x18eb});var io=require(_0x226c('0x5'))(new Redis(config['redis']));function SmsQueue(_0x1719ed){this['id']=_0x1719ed['id']||0x0;this[_0x226c('0x6')]=_0x1719ed[_0x226c('0x6')]||'';this[_0x226c('0x7')]=_0x1719ed[_0x226c('0x7')]||0xa;this['strategy']=_0x1719ed[_0x226c('0x8')]||_0x226c('0x9');this[_0x226c('0xa')]=_0x1719ed[_0x226c('0xa')];this[_0x226c('0xb')]={};this['waiting']=0x0;this[_0x226c('0xc')]='';this[_0x226c('0xd')]();this['updateRealtime']();}SmsQueue['prototype'][_0x226c('0xd')]=function(){var _0x1a5961=this[_0x226c('0xb')][_0x226c('0xe')];this[_0x226c('0xb')]=_[_0x226c('0xf')](this[_0x226c('0xa')],'id');this['mapAgentsId']['_rr']=_0x1a5961;};SmsQueue[_0x226c('0x10')][_0x226c('0x11')]=function(){this[_0x226c('0x12')]=0x0;this[_0x226c('0x13')]=0x0;for(var _0x4eb557=0x0;_0x4eb557=0x0?this['available']:0x0;var _0x36fa74={'id':this['id'],'available':this[_0x226c('0x17')],'loggedIn':this[_0x226c('0x12')],'name':this[_0x226c('0x6')],'paused':this['paused'],'waiting':this[_0x226c('0x18')]};var _0xb6417f=md5(JSON[_0x226c('0x19')](_0x36fa74));if(this[_0x226c('0xc')]!==_0xb6417f){this[_0x226c('0xc')]=_0xb6417f;io['to'](util[_0x226c('0x1a')]('sms:queue:%s',_0x36fa74[_0x226c('0x6')]))[_0x226c('0x1b')](_0x226c('0x1c'),_0x36fa74);}};module[_0x226c('0x1d')]=SmsQueue; \ No newline at end of file +var _0x826a=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','paused','online','smsPause','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','ioredis','redis','defaults','localhost','name'];(function(_0x48960d,_0x2f9d59){var _0x2f15d6=function(_0x3866a9){while(--_0x3866a9){_0x48960d['push'](_0x48960d['shift']());}};_0x2f15d6(++_0x2f9d59);}(_0x826a,0x1aa));var _0xa826=function(_0x399382,_0x45a8f6){_0x399382=_0x399382-0x0;var _0x495861=_0x826a[_0x399382];return _0x495861;};'use strict';var _=require('lodash');var md5=require(_0xa826('0x0'));var util=require('util');var Redis=require(_0xa826('0x1'));var config=require('../../../config/environment');config[_0xa826('0x2')]=_[_0xa826('0x3')](config[_0xa826('0x2')],{'host':_0xa826('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa826('0x2')]));function SmsQueue(_0x15f777){this['id']=_0x15f777['id']||0x0;this[_0xa826('0x5')]=_0x15f777[_0xa826('0x5')]||'';this[_0xa826('0x6')]=_0x15f777[_0xa826('0x6')]||0xa;this[_0xa826('0x7')]=_0x15f777[_0xa826('0x7')]||_0xa826('0x8');this[_0xa826('0x9')]=_0x15f777[_0xa826('0x9')];this[_0xa826('0xa')]={};this[_0xa826('0xb')]=0x0;this[_0xa826('0x0')]='';this[_0xa826('0xc')]();this[_0xa826('0xd')]();}SmsQueue['prototype'][_0xa826('0xc')]=function(){var _0x4b4caf=this[_0xa826('0xa')][_0xa826('0xe')];this[_0xa826('0xa')]=_[_0xa826('0xf')](this[_0xa826('0x9')],'id');this[_0xa826('0xa')][_0xa826('0xe')]=_0x4b4caf;};SmsQueue['prototype'][_0xa826('0xd')]=function(){this['loggedIn']=0x0;this[_0xa826('0x10')]=0x0;for(var _0x41c0c2=0x0;_0x41c0c2=0x0?this[_0xa826('0x13')]:0x0;var _0x90486c={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa826('0x14')],'name':this[_0xa826('0x5')],'paused':this[_0xa826('0x10')],'waiting':this['waiting']};var _0x5d8161=md5(JSON[_0xa826('0x15')](_0x90486c));if(this[_0xa826('0x0')]!==_0x5d8161){this[_0xa826('0x0')]=_0x5d8161;io['to'](util[_0xa826('0x16')](_0xa826('0x17'),_0x90486c['name']))[_0xa826('0x18')](_0xa826('0x19'),_0x90486c);}};module[_0xa826('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index c4c2fc6..341a38b 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 _0xcbc8=['updateRouting','updateRealtime','_rr','prototype','paused','length','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x42646c,_0x36bcc5){var _0xe7748a=function(_0x48bc48){while(--_0x48bc48){_0x42646c['push'](_0x42646c['shift']());}};_0xe7748a(++_0x36bcc5);}(_0xcbc8,0x196));var _0x8cbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbc8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8cbc('0x0'));var md5=require(_0x8cbc('0x1'));var util=require(_0x8cbc('0x2'));var Redis=require(_0x8cbc('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x8cbc('0x4')](config[_0x8cbc('0x5')],{'host':_0x8cbc('0x6'),'port':0x18eb});var io=require(_0x8cbc('0x7'))(new Redis(config[_0x8cbc('0x5')]));function WhatsappQueue(_0x346a5c){this['id']=_0x346a5c['id']||0x0;this[_0x8cbc('0x8')]=_0x346a5c[_0x8cbc('0x8')]||'';this[_0x8cbc('0x9')]=_0x346a5c[_0x8cbc('0x9')]||0xa;this['strategy']=_0x346a5c[_0x8cbc('0xa')]||'beepall';this[_0x8cbc('0xb')]=_0x346a5c[_0x8cbc('0xb')];this[_0x8cbc('0xc')]={};this[_0x8cbc('0xd')]=0x0;this[_0x8cbc('0x1')]='';this[_0x8cbc('0xe')]();this[_0x8cbc('0xf')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x316f46=this[_0x8cbc('0xc')][_0x8cbc('0x10')];this[_0x8cbc('0xc')]=_['map'](this[_0x8cbc('0xb')],'id');this[_0x8cbc('0xc')][_0x8cbc('0x10')]=_0x316f46;};WhatsappQueue[_0x8cbc('0x11')][_0x8cbc('0xf')]=function(){this['loggedIn']=0x0;this[_0x8cbc('0x12')]=0x0;for(var _0x1c3f03=0x0;_0x1c3f03=0x0?this[_0x8cbc('0x17')]:0x0;var _0x36a6b9={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8cbc('0x15')],'name':this[_0x8cbc('0x8')],'paused':this[_0x8cbc('0x12')],'waiting':this[_0x8cbc('0xd')]};var _0x56bb4e=md5(JSON[_0x8cbc('0x18')](_0x36a6b9));if(this[_0x8cbc('0x1')]!==_0x56bb4e){this[_0x8cbc('0x1')]=_0x56bb4e;io['to'](util['format'](_0x8cbc('0x19'),_0x36a6b9[_0x8cbc('0x8')]))[_0x8cbc('0x1a')](_0x8cbc('0x1b'),_0x36a6b9);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xde5d=['timeout','beepall','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','prototype','length','online','whatsappPause','available','loggedIn','paused','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x292bcc,_0x334625){var _0x53b6d4=function(_0x9efacd){while(--_0x9efacd){_0x292bcc['push'](_0x292bcc['shift']());}};_0x53b6d4(++_0x334625);}(_0xde5d,0x1e7));var _0xdde5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xde5d[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xdde5('0x0'));var md5=require(_0xdde5('0x1'));var util=require(_0xdde5('0x2'));var Redis=require(_0xdde5('0x3'));var config=require(_0xdde5('0x4'));config[_0xdde5('0x5')]=_['defaults'](config[_0xdde5('0x5')],{'host':_0xdde5('0x6'),'port':0x18eb});var io=require(_0xdde5('0x7'))(new Redis(config[_0xdde5('0x5')]));function WhatsappQueue(_0x492ab9){this['id']=_0x492ab9['id']||0x0;this['name']=_0x492ab9[_0xdde5('0x8')]||'';this[_0xdde5('0x9')]=_0x492ab9[_0xdde5('0x9')]||0xa;this['strategy']=_0x492ab9['strategy']||_0xdde5('0xa');this['Agents']=_0x492ab9[_0xdde5('0xb')];this[_0xdde5('0xc')]={};this['waiting']=0x0;this[_0xdde5('0x1')]='';this['updateRouting']();this[_0xdde5('0xd')]();}WhatsappQueue['prototype'][_0xdde5('0xe')]=function(){var _0x3279b8=this['mapAgentsId'][_0xdde5('0xf')];this[_0xdde5('0xc')]=_[_0xdde5('0x10')](this[_0xdde5('0xb')],'id');this['mapAgentsId'][_0xdde5('0xf')]=_0x3279b8;};WhatsappQueue[_0xdde5('0x11')][_0xdde5('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x122c92=0x0;_0x122c92=0x0?this[_0xdde5('0x15')]:0x0;var _0x118619={'id':this['id'],'available':this[_0xdde5('0x15')],'loggedIn':this[_0xdde5('0x16')],'name':this[_0xdde5('0x8')],'paused':this[_0xdde5('0x17')],'waiting':this[_0xdde5('0x18')]};var _0xd8d0fe=md5(JSON[_0xdde5('0x19')](_0x118619));if(this[_0xdde5('0x1')]!==_0xd8d0fe){this[_0xdde5('0x1')]=_0xd8d0fe;io['to'](util[_0xdde5('0x1a')](_0xdde5('0x1b'),_0x118619['name']))[_0xdde5('0x1c')](_0xdde5('0x1d'),_0x118619);}};module[_0xdde5('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index abe252d..ba6c2cc 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(_0x4db47f,_0x1020d4){var _0x755f4=function(_0x3632ab){while(--_0x3632ab){_0x4db47f['push'](_0x4db47f['shift']());}};_0x755f4(++_0x1020d4);}(_0xb10b,0x12a));var _0xbb10=function(_0x189b3b,_0x484de8){_0x189b3b=_0x189b3b-0x0;var _0x7c4721=_0xb10b[_0x189b3b];return _0x7c4721;};'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 _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(_0xa0ffc,_0x4cf303){var _0xd2d414=function(_0x116fc0){while(--_0x116fc0){_0xa0ffc['push'](_0xa0ffc['shift']());}};_0xd2d414(++_0x4cf303);}(_0xb10b,0x12a));var _0xbb10=function(_0x5dc6e8,_0x1ed7cc){_0x5dc6e8=_0x5dc6e8-0x0;var _0x2cb306=_0xb10b[_0x5dc6e8];return _0x2cb306;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index aaeebbd..50419dc 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 _0x4730=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x324f7f,_0x34504f){var _0x56e96d=function(_0x37d6bb){while(--_0x37d6bb){_0x324f7f['push'](_0x324f7f['shift']());}};_0x56e96d(++_0x34504f);}(_0x4730,0xa4));var _0x0473=function(_0x371b29,_0x2d33ed){_0x371b29=_0x371b29-0x0;var _0x434d79=_0x4730[_0x371b29];return _0x434d79;};'use strict';var client=require(_0x0473('0x0'));exports[_0x0473('0x1')]=function(_0x398b7c,_0x81dc84){return client[_0x0473('0x2')](_0x0473('0x3'),{'body':_0x81dc84,'options':{'where':{'id':_0x398b7c}},'log':_0x0473('0x4')});};exports[_0x0473('0x5')]=function(_0x353418,_0x4b929f){return client[_0x0473('0x2')](_0x0473('0x6'),{'body':_0x4b929f,'options':{'where':{'id':_0x353418}},'log':_0x0473('0x7')});}; \ No newline at end of file +var _0xa7a1=['AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction','addTags','Request'];(function(_0x4330ec,_0x3f4522){var _0x5aa853=function(_0x2fa315){while(--_0x2fa315){_0x4330ec['push'](_0x4330ec['shift']());}};_0x5aa853(++_0x3f4522);}(_0xa7a1,0x1d6));var _0x1a7a=function(_0x37aed4,_0x254b7d){_0x37aed4=_0x37aed4-0x0;var _0x1ec4f3=_0xa7a1[_0x37aed4];return _0x1ec4f3;};'use strict';var client=require('../client');exports[_0x1a7a('0x0')]=function(_0x2be796,_0x306d4b){return client['Request'](_0x1a7a('0x1'),{'body':_0x306d4b,'options':{'where':{'id':_0x2be796}},'log':'updateChatInteraction'});};exports[_0x1a7a('0x2')]=function(_0x16390d,_0xdaa3dd){return client[_0x1a7a('0x3')](_0x1a7a('0x4'),{'body':_0xdaa3dd,'options':{'where':{'id':_0x16390d}},'log':_0x1a7a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 19d6fb8..ef8976e 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 _0xb37b=['CreateChatMessage','../client','create','Request'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xb37b,0x1dd));var _0xbb37=function(_0xd93df9,_0x58284c){_0xd93df9=_0xd93df9-0x0;var _0x4b3d1d=_0xb37b[_0xd93df9];return _0x4b3d1d;};'use strict';var client=require(_0xbb37('0x0'));exports[_0xbb37('0x1')]=function(_0x5ce0d4){return client[_0xbb37('0x2')](_0xbb37('0x3'),{'body':_0x5ce0d4,'log':'createChatMessage'});}; \ No newline at end of file +var _0x6e5c=['createChatMessage','../client','create','Request'];(function(_0x1be385,_0x1f9349){var _0x103569=function(_0x212026){while(--_0x212026){_0x1be385['push'](_0x1be385['shift']());}};_0x103569(++_0x1f9349);}(_0x6e5c,0x8d));var _0xc6e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e5c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc6e5('0x0'));exports[_0xc6e5('0x1')]=function(_0x3d0c3b){return client[_0xc6e5('0x2')]('CreateChatMessage',{'body':_0x3d0c3b,'log':_0xc6e5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 51dd64d..ff900bb 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 _0x1a8f=['Request','GetChatQueue','name','timeout','strategy','chatPause','getChatQueues','../client'];(function(_0x2faeaa,_0x42e74d){var _0x142ffe=function(_0xfe122e){while(--_0xfe122e){_0x2faeaa['push'](_0x2faeaa['shift']());}};_0x142ffe(++_0x42e74d);}(_0x1a8f,0x87));var _0xf1a8=function(_0x4032e3,_0x6d6449){_0x4032e3=_0x4032e3-0x0;var _0x34f51a=_0x1a8f[_0x4032e3];return _0x34f51a;};'use strict';var client=require(_0xf1a8('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xf1a8('0x1')](_0xf1a8('0x2'),{'options':{'raw':![],'attributes':['id',_0xf1a8('0x3'),_0xf1a8('0x4'),_0xf1a8('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xf1a8('0x6')]}]},'log':_0xf1a8('0x7')});};}; \ No newline at end of file +var _0xf88f=['Agents','online','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x1b47b3,_0x4bcb96){var _0x151f28=function(_0x4b5a5b){while(--_0x4b5a5b){_0x1b47b3['push'](_0x1b47b3['shift']());}};_0x151f28(++_0x4bcb96);}(_0xf88f,0x1bb));var _0xff88=function(_0x45c6ff,_0xd54c98){_0x45c6ff=_0x45c6ff-0x0;var _0x59d6c5=_0xf88f[_0x45c6ff];return _0x59d6c5;};'use strict';var client=require(_0xff88('0x0'));exports[_0xff88('0x1')]=function(){return function(){return client[_0xff88('0x2')](_0xff88('0x3'),{'options':{'raw':![],'attributes':['id',_0xff88('0x4'),_0xff88('0x5'),_0xff88('0x6')],'include':[{'model':'User','as':_0xff88('0x7'),'attributes':['id',_0xff88('0x4'),_0xff88('0x8'),'chatPause']}]},'log':_0xff88('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index a640f56..6963e3b 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 _0x0207=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','create'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x0207,0x162));var _0x7020=function(_0x2ea9b5,_0x5c0e88){_0x2ea9b5=_0x2ea9b5-0x0;var _0x1b8dab=_0x0207[_0x2ea9b5];return _0x1b8dab;};'use strict';var client=require('../client');exports[_0x7020('0x0')]=function(_0x4a5f80){return client['Request'](_0x7020('0x1'),{'body':_0x4a5f80,'log':_0x7020('0x1')});};exports[_0x7020('0x2')]=function(_0x15db09,_0x2e62fd){return client[_0x7020('0x3')](_0x7020('0x4'),{'body':_0x2e62fd,'options':{'where':{'uniqueid':_0x15db09},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x3dd5=['../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x5a459e,_0x5573e9){var _0x545aec=function(_0x1c6b84){while(--_0x1c6b84){_0x5a459e['push'](_0x5a459e['shift']());}};_0x545aec(++_0x5573e9);}(_0x3dd5,0x73));var _0x53dd=function(_0x1d6590,_0x41a973){_0x1d6590=_0x1d6590-0x0;var _0x53f9b5=_0x3dd5[_0x1d6590];return _0x53f9b5;};'use strict';var client=require(_0x53dd('0x0'));exports['create']=function(_0x46325c){return client[_0x53dd('0x1')](_0x53dd('0x2'),{'body':_0x46325c,'log':_0x53dd('0x2')});};exports[_0x53dd('0x3')]=function(_0x455417,_0x2ac886){return client[_0x53dd('0x1')](_0x53dd('0x4'),{'body':_0x2ac886,'options':{'where':{'uniqueid':_0x455417},'order':[['id','DESC']],'limit':0x1},'log':_0x53dd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c0d1df4..3a05908 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(_0x43b88c,_0x46fb04){var _0x407299=function(_0x16dcd3){while(--_0x16dcd3){_0x43b88c['push'](_0x43b88c['shift']());}};_0x407299(++_0x46fb04);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x7a54,0x106));var _0x47a5=function(_0x9d9157,_0x3672e2){_0x9d9157=_0x9d9157-0x0;var _0xa61b79=_0x7a54[_0x9d9157];return _0xa61b79;};'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 6211ddc..cab6669 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 _0x6ac6=['create','Request','CreateFaxMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ac6,0xe3));var _0x66ac=function(_0x485d07,_0x1a6a6b){_0x485d07=_0x485d07-0x0;var _0x3307a7=_0x6ac6[_0x485d07];return _0x3307a7;};'use strict';var client=require(_0x66ac('0x0'));exports[_0x66ac('0x1')]=function(_0x17f51b){return client[_0x66ac('0x2')](_0x66ac('0x3'),{'body':_0x17f51b,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x79ac=['Request','CreateFaxMessage','../client','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x79ac,0x172));var _0xc79a=function(_0x4c3b3b,_0xbf6c8){_0x4c3b3b=_0x4c3b3b-0x0;var _0x3cc11b=_0x79ac[_0x4c3b3b];return _0x3cc11b;};'use strict';var client=require(_0xc79a('0x0'));exports[_0xc79a('0x1')]=function(_0x37e678){return client[_0xc79a('0x2')](_0xc79a('0x3'),{'body':_0x37e678,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index e48dddf..51c9b80 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 _0xe36a=['User','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','strategy'];(function(_0x42c793,_0x82a277){var _0x4ec0d5=function(_0x1c6e67){while(--_0x1c6e67){_0x42c793['push'](_0x42c793['shift']());}};_0x4ec0d5(++_0x82a277);}(_0xe36a,0x108));var _0xae36=function(_0xbfbef0,_0x218b21){_0xbfbef0=_0xbfbef0-0x0;var _0x3fdf6f=_0xe36a[_0xbfbef0];return _0x3fdf6f;};'use strict';var client=require(_0xae36('0x0'));exports[_0xae36('0x1')]=function(){return function(){return client[_0xae36('0x2')](_0xae36('0x3'),{'options':{'raw':![],'attributes':['id',_0xae36('0x4'),'timeout',_0xae36('0x5')],'include':[{'model':_0xae36('0x6'),'as':'Agents','attributes':['id',_0xae36('0x4'),_0xae36('0x7'),_0xae36('0x8')]}]},'log':_0xae36('0x1')});};}; \ No newline at end of file +var _0xc766=['name','timeout','User','online','getFaxQueues','../client','Request'];(function(_0xd440b9,_0x5ec86a){var _0x4b0cbc=function(_0x129c4d){while(--_0x129c4d){_0xd440b9['push'](_0xd440b9['shift']());}};_0x4b0cbc(++_0x5ec86a);}(_0xc766,0x6e));var _0x6c76=function(_0x5d3591,_0x574d3f){_0x5d3591=_0x5d3591-0x0;var _0x55208f=_0xc766[_0x5d3591];return _0x55208f;};'use strict';var client=require(_0x6c76('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x6c76('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x6c76('0x2'),_0x6c76('0x3'),'strategy'],'include':[{'model':_0x6c76('0x4'),'as':'Agents','attributes':['id',_0x6c76('0x2'),_0x6c76('0x5'),'faxPause']}]},'log':_0x6c76('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f74b25c..a2a915c 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 _0xe3ec=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x791545,_0x4c2098){var _0x14a7e6=function(_0x22563b){while(--_0x22563b){_0x791545['push'](_0x791545['shift']());}};_0x14a7e6(++_0x4c2098);}(_0xe3ec,0x154));var _0xce3e=function(_0x50daad,_0x35a772){_0x50daad=_0x50daad-0x0;var _0x3c2d72=_0xe3ec[_0x50daad];return _0x3c2d72;};'use strict';var client=require(_0xce3e('0x0'));exports['create']=function(_0x489dcb){return client[_0xce3e('0x1')](_0xce3e('0x2'),{'body':_0x489dcb,'log':'CreateFaxQueueReport'});};exports[_0xce3e('0x3')]=function(_0x2edd2e,_0x202fee){return client[_0xce3e('0x1')](_0xce3e('0x4'),{'body':_0x202fee,'options':{'where':{'uniqueid':_0x2edd2e},'order':[['id',_0xce3e('0x5')]],'limit':0x1},'log':_0xce3e('0x4')});}; \ No newline at end of file +var _0x085e=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x327002,_0x13842b){var _0x49a7dd=function(_0x47fef3){while(--_0x47fef3){_0x327002['push'](_0x327002['shift']());}};_0x49a7dd(++_0x13842b);}(_0x085e,0x1bb));var _0xe085=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x085e[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0xe085('0x0')]=function(_0x5a411b){return client[_0xe085('0x1')](_0xe085('0x2'),{'body':_0x5a411b,'log':_0xe085('0x2')});};exports[_0xe085('0x3')]=function(_0x93ee00,_0x42557e){return client[_0xe085('0x1')](_0xe085('0x4'),{'body':_0x42557e,'options':{'where':{'uniqueid':_0x93ee00},'order':[['id',_0xe085('0x5')]],'limit':0x1},'log':_0xe085('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 81f76c3..45768e4 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 _0xdb38=['interval','getIntervals','Request','name','Intervals'];(function(_0x326558,_0x4a22a1){var _0x5cd3a0=function(_0x412b66){while(--_0x412b66){_0x326558['push'](_0x326558['shift']());}};_0x5cd3a0(++_0x4a22a1);}(_0xdb38,0xe7));var _0x8db3=function(_0x7f16d2,_0x542ecf){_0x7f16d2=_0x7f16d2-0x0;var _0x42ad6a=_0xdb38[_0x7f16d2];return _0x42ad6a;};'use strict';var client=require('../client');exports[_0x8db3('0x0')]=function(){return function(){return client[_0x8db3('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8db3('0x2')],'include':[{'model':'Interval','as':_0x8db3('0x3'),'attributes':['id',_0x8db3('0x2'),_0x8db3('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x0ca8=['Request','name','Intervals','interval','getIntervals','../client'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x0ca8,0xfb));var _0x80ca=function(_0x420b98,_0x8facfe){_0x420b98=_0x420b98-0x0;var _0x14b8f4=_0x0ca8[_0x420b98];return _0x14b8f4;};'use strict';var client=require(_0x80ca('0x0'));exports['getIntervals']=function(){return function(){return client[_0x80ca('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x80ca('0x2')],'include':[{'model':'Interval','as':_0x80ca('0x3'),'attributes':['id',_0x80ca('0x2'),_0x80ca('0x4')]}]},'log':_0x80ca('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 880d6e2..f33ae4b 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 _0x4888=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x20cdb5,_0x2a0714){var _0x32b9e7=function(_0x3fb0f5){while(--_0x3fb0f5){_0x20cdb5['push'](_0x20cdb5['shift']());}};_0x32b9e7(++_0x2a0714);}(_0x4888,0x198));var _0x8488=function(_0x1b0dd3,_0x510b79){_0x1b0dd3=_0x1b0dd3-0x0;var _0x31b5da=_0x4888[_0x1b0dd3];return _0x31b5da;};'use strict';var client=require('../client');exports[_0x8488('0x0')]=function(_0x1f0e53,_0x2af900){return client[_0x8488('0x1')](_0x8488('0x2'),{'body':_0x2af900,'options':{'where':{'id':_0x1f0e53}},'log':_0x8488('0x3')});};exports[_0x8488('0x4')]=function(_0x571e4b,_0x267093){return client[_0x8488('0x1')](_0x8488('0x5'),{'body':_0x267093,'options':{'where':{'id':_0x571e4b}},'log':_0x8488('0x6')});}; \ No newline at end of file +var _0xb44a=['AddTagsToMailInteraction','addTagsToChatInteraction','Request','addTags'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xb44a,0x1c2));var _0xab44=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0xb44a[_0x3cae69];return _0x3128eb;};'use strict';var client=require('../client');exports['update']=function(_0x93bb2f,_0x492c1a){return client[_0xab44('0x0')]('UpdateMailInteraction',{'body':_0x492c1a,'options':{'where':{'id':_0x93bb2f}},'log':'updateMailInteraction'});};exports[_0xab44('0x1')]=function(_0x5c93b4,_0x1b9e05){return client[_0xab44('0x0')](_0xab44('0x2'),{'body':_0x1b9e05,'options':{'where':{'id':_0x5c93b4}},'log':_0xab44('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b62cd81..00e3f9f 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 _0xf27c=['createMailMessage','../client','create','Request'];(function(_0x3b6d60,_0xfb23be){var _0x54beb5=function(_0x28a234){while(--_0x28a234){_0x3b6d60['push'](_0x3b6d60['shift']());}};_0x54beb5(++_0xfb23be);}(_0xf27c,0x155));var _0xcf27=function(_0xcd9a05,_0x3d7f5e){_0xcd9a05=_0xcd9a05-0x0;var _0x216942=_0xf27c[_0xcd9a05];return _0x216942;};'use strict';var client=require(_0xcf27('0x0'));exports[_0xcf27('0x1')]=function(_0x2a2601){return client[_0xcf27('0x2')]('CreateMailMessage',{'body':_0x2a2601,'log':_0xcf27('0x3')});}; \ No newline at end of file +var _0x2a4f=['Request','../client','create'];(function(_0x30a40b,_0x96941c){var _0x2772ef=function(_0x705c21){while(--_0x705c21){_0x30a40b['push'](_0x30a40b['shift']());}};_0x2772ef(++_0x96941c);}(_0x2a4f,0x130));var _0xf2a4=function(_0x4651bd,_0x12a42f){_0x4651bd=_0x4651bd-0x0;var _0xdf510d=_0x2a4f[_0x4651bd];return _0xdf510d;};'use strict';var client=require(_0xf2a4('0x0'));exports[_0xf2a4('0x1')]=function(_0x21dbb1){return client[_0xf2a4('0x2')]('CreateMailMessage',{'body':_0x21dbb1,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a148404..361d832 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 _0x1b38=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','mailPause','../client'];(function(_0x56e902,_0x5aa67e){var _0x826c44=function(_0xc51336){while(--_0xc51336){_0x56e902['push'](_0x56e902['shift']());}};_0x826c44(++_0x5aa67e);}(_0x1b38,0x95));var _0x81b3=function(_0x19d19c,_0x1f05da){_0x19d19c=_0x19d19c-0x0;var _0x849751=_0x1b38[_0x19d19c];return _0x849751;};'use strict';var client=require(_0x81b3('0x0'));exports[_0x81b3('0x1')]=function(){return function(){return client[_0x81b3('0x2')](_0x81b3('0x3'),{'options':{'raw':![],'attributes':['id',_0x81b3('0x4'),_0x81b3('0x5'),_0x81b3('0x6')],'include':[{'model':_0x81b3('0x7'),'as':_0x81b3('0x8'),'attributes':['id',_0x81b3('0x4'),'online',_0x81b3('0x9')]}]},'log':_0x81b3('0x1')});};}; \ No newline at end of file +var _0x9a1f=['strategy','User','Agents','name','online','getMailQueues','../client','Request','timeout'];(function(_0x22962d,_0x40fea9){var _0x3ed981=function(_0x153497){while(--_0x153497){_0x22962d['push'](_0x22962d['shift']());}};_0x3ed981(++_0x40fea9);}(_0x9a1f,0xde));var _0xf9a1=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x9a1f[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0xf9a1('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xf9a1('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xf9a1('0x2'),_0xf9a1('0x3')],'include':[{'model':_0xf9a1('0x4'),'as':_0xf9a1('0x5'),'attributes':['id',_0xf9a1('0x6'),_0xf9a1('0x7'),'mailPause']}]},'log':_0xf9a1('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9cd0e32..9827192 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 _0xbff5=['update','DESC','UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport'];(function(_0x4a06ec,_0x34c102){var _0x2acc36=function(_0x14a411){while(--_0x14a411){_0x4a06ec['push'](_0x4a06ec['shift']());}};_0x2acc36(++_0x34c102);}(_0xbff5,0x1bc));var _0x5bff=function(_0x5dd53c,_0x469245){_0x5dd53c=_0x5dd53c-0x0;var _0x13503d=_0xbff5[_0x5dd53c];return _0x13503d;};'use strict';var client=require(_0x5bff('0x0'));exports[_0x5bff('0x1')]=function(_0xd96d55){return client[_0x5bff('0x2')](_0x5bff('0x3'),{'body':_0xd96d55,'log':_0x5bff('0x3')});};exports[_0x5bff('0x4')]=function(_0x4dccf3,_0x3868ae){return client['Request']('UpdateMailQueueReport',{'body':_0x3868ae,'options':{'where':{'uniqueid':_0x4dccf3},'order':[['id',_0x5bff('0x5')]],'limit':0x1},'log':_0x5bff('0x6')});}; \ No newline at end of file +var _0x22be=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','Request'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x22be,0x88));var _0xe22b=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x22be[_0x46f1a6];return _0x38429a;};'use strict';var client=require(_0xe22b('0x0'));exports['create']=function(_0x52e3f4){return client[_0xe22b('0x1')]('CreateMailQueueReport',{'body':_0x52e3f4,'log':_0xe22b('0x2')});};exports[_0xe22b('0x3')]=function(_0x8dfef4,_0x11832f){return client[_0xe22b('0x1')](_0xe22b('0x4'),{'body':_0x11832f,'options':{'where':{'uniqueid':_0x8dfef4},'order':[['id',_0xe22b('0x5')]],'limit':0x1},'log':_0xe22b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 861970d..f6385e0 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 _0x1a90=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction'];(function(_0x433cfe,_0x47ce1e){var _0x1843a8=function(_0x3685bb){while(--_0x3685bb){_0x433cfe['push'](_0x433cfe['shift']());}};_0x1843a8(++_0x47ce1e);}(_0x1a90,0x165));var _0x01a9=function(_0x5757cf,_0x303a83){_0x5757cf=_0x5757cf-0x0;var _0x2e2732=_0x1a90[_0x5757cf];return _0x2e2732;};'use strict';var client=require(_0x01a9('0x0'));exports['update']=function(_0x566283,_0x41bcc3){return client[_0x01a9('0x1')](_0x01a9('0x2'),{'body':_0x41bcc3,'options':{'where':{'id':_0x566283}},'log':_0x01a9('0x3')});};exports[_0x01a9('0x4')]=function(_0x19632f,_0xb5cbcd){return client[_0x01a9('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0xb5cbcd,'options':{'where':{'id':_0x19632f}},'log':_0x01a9('0x5')});}; \ No newline at end of file +var _0xd750=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x513f04,_0x979225){var _0x4498f2=function(_0x462429){while(--_0x462429){_0x513f04['push'](_0x513f04['shift']());}};_0x4498f2(++_0x979225);}(_0xd750,0xdc));var _0x0d75=function(_0x53be66,_0x9ec3be){_0x53be66=_0x53be66-0x0;var _0x9e5520=_0xd750[_0x53be66];return _0x9e5520;};'use strict';var client=require(_0x0d75('0x0'));exports[_0x0d75('0x1')]=function(_0x4665a5,_0x30ab36){return client[_0x0d75('0x2')]('UpdateOpenchannelInteraction',{'body':_0x30ab36,'options':{'where':{'id':_0x4665a5}},'log':_0x0d75('0x3')});};exports[_0x0d75('0x4')]=function(_0x4bd665,_0x436d95){return client[_0x0d75('0x2')](_0x0d75('0x5'),{'body':_0x436d95,'options':{'where':{'id':_0x4bd665}},'log':_0x0d75('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index efcf041..75436be 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 _0xc5c2=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x4ec620,_0xb0f633){var _0x341ad0=function(_0x54cca4){while(--_0x54cca4){_0x4ec620['push'](_0x4ec620['shift']());}};_0x341ad0(++_0xb0f633);}(_0xc5c2,0x18d));var _0x2c5c=function(_0x12d7f4,_0x1c0317){_0x12d7f4=_0x12d7f4-0x0;var _0x1027b0=_0xc5c2[_0x12d7f4];return _0x1027b0;};'use strict';var client=require('../client');exports['create']=function(_0x162356){return client[_0x2c5c('0x0')](_0x2c5c('0x1'),{'body':_0x162356,'log':_0x2c5c('0x2')});}; \ No newline at end of file +var _0xd8a6=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0xd8a6,0x10a));var _0x6d8a=function(_0x3a43e5,_0x3f647a){_0x3a43e5=_0x3a43e5-0x0;var _0x3fefdb=_0xd8a6[_0x3a43e5];return _0x3fefdb;};'use strict';var client=require(_0x6d8a('0x0'));exports[_0x6d8a('0x1')]=function(_0x477bae){return client[_0x6d8a('0x2')](_0x6d8a('0x3'),{'body':_0x477bae,'log':_0x6d8a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index bda86df..6e699dd 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 _0xd606=['openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online'];(function(_0x501c00,_0x1dc98b){var _0x5ad836=function(_0x21299f){while(--_0x21299f){_0x501c00['push'](_0x501c00['shift']());}};_0x5ad836(++_0x1dc98b);}(_0xd606,0x120));var _0x6d60=function(_0x1238d1,_0x3fedc4){_0x1238d1=_0x1238d1-0x0;var _0x1e3f40=_0xd606[_0x1238d1];return _0x1e3f40;};'use strict';var client=require(_0x6d60('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x6d60('0x1')](_0x6d60('0x2'),{'options':{'raw':![],'attributes':['id',_0x6d60('0x3'),_0x6d60('0x4'),_0x6d60('0x5')],'include':[{'model':_0x6d60('0x6'),'as':_0x6d60('0x7'),'attributes':['id',_0x6d60('0x3'),_0x6d60('0x8'),_0x6d60('0x9')]}]},'log':_0x6d60('0xa')});};}; \ No newline at end of file +var _0xb92b=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','online'];(function(_0x548483,_0x5e53ab){var _0x53afbd=function(_0x4c9f9c){while(--_0x4c9f9c){_0x548483['push'](_0x548483['shift']());}};_0x53afbd(++_0x5e53ab);}(_0xb92b,0x90));var _0xbb92=function(_0x3dbbba,_0x305966){_0x3dbbba=_0x3dbbba-0x0;var _0x2f2958=_0xb92b[_0x3dbbba];return _0x2f2958;};'use strict';var client=require(_0xbb92('0x0'));exports[_0xbb92('0x1')]=function(){return function(){return client[_0xbb92('0x2')](_0xbb92('0x3'),{'options':{'raw':![],'attributes':['id',_0xbb92('0x4'),_0xbb92('0x5'),'strategy'],'include':[{'model':_0xbb92('0x6'),'as':'Agents','attributes':['id',_0xbb92('0x4'),_0xbb92('0x7'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2702af4..18ac4c9 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 _0x4fe9=['../client','Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport'];(function(_0x5660d5,_0x235c27){var _0x2a144d=function(_0x54fb3f){while(--_0x54fb3f){_0x5660d5['push'](_0x5660d5['shift']());}};_0x2a144d(++_0x235c27);}(_0x4fe9,0x90));var _0x94fe=function(_0x32f7a0,_0x5577fd){_0x32f7a0=_0x32f7a0-0x0;var _0x490782=_0x4fe9[_0x32f7a0];return _0x490782;};'use strict';var client=require(_0x94fe('0x0'));exports['create']=function(_0x3e18ae){return client[_0x94fe('0x1')](_0x94fe('0x2'),{'body':_0x3e18ae,'log':_0x94fe('0x2')});};exports[_0x94fe('0x3')]=function(_0x40f8da,_0x2f5211){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x2f5211,'options':{'where':{'uniqueid':_0x40f8da},'order':[['id',_0x94fe('0x4')]],'limit':0x1},'log':_0x94fe('0x5')});}; \ No newline at end of file +var _0x7275=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','../client'];(function(_0x84228a,_0x208d80){var _0x34b2ba=function(_0x15c49a){while(--_0x15c49a){_0x84228a['push'](_0x84228a['shift']());}};_0x34b2ba(++_0x208d80);}(_0x7275,0x143));var _0x5727=function(_0x2655a6,_0x1f1920){_0x2655a6=_0x2655a6-0x0;var _0x384a51=_0x7275[_0x2655a6];return _0x384a51;};'use strict';var client=require(_0x5727('0x0'));exports[_0x5727('0x1')]=function(_0x34efb2){return client['Request'](_0x5727('0x2'),{'body':_0x34efb2,'log':'CreateOpenchannelQueueReport'});};exports[_0x5727('0x3')]=function(_0x35e38f,_0x5c21b3){return client[_0x5727('0x4')](_0x5727('0x5'),{'body':_0x5c21b3,'options':{'where':{'uniqueid':_0x35e38f},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 6d0a31b..8dbd81e 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 _0x004c=['../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request','addTagsToSmsInteraction'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x004c,0x85));var _0xc004=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x004c[_0x11c573];return _0x6b72de;};'use strict';var client=require(_0xc004('0x0'));exports[_0xc004('0x1')]=function(_0x3fa239,_0x2cf6a8){return client['Request'](_0xc004('0x2'),{'body':_0x2cf6a8,'options':{'where':{'id':_0x3fa239}},'log':_0xc004('0x3')});};exports[_0xc004('0x4')]=function(_0x38a8b9,_0x571646){return client[_0xc004('0x5')]('AddTagsToSmsInteraction',{'body':_0x571646,'options':{'where':{'id':_0x38a8b9}},'log':_0xc004('0x6')});}; \ No newline at end of file +var _0xa1a5=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x3e0bea,_0x10b049){_0x3e0bea=_0x3e0bea-0x0;var _0x3c9a58=_0xa1a5[_0x3e0bea];return _0x3c9a58;};'use strict';var client=require(_0x5a1a('0x0'));exports['update']=function(_0xe8a51b,_0x47102b){return client[_0x5a1a('0x1')](_0x5a1a('0x2'),{'body':_0x47102b,'options':{'where':{'id':_0xe8a51b}},'log':_0x5a1a('0x3')});};exports['addTags']=function(_0x3d3652,_0x12138d){return client[_0x5a1a('0x1')](_0x5a1a('0x4'),{'body':_0x12138d,'options':{'where':{'id':_0x3d3652}},'log':_0x5a1a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 312cfbe..0f7e063 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 _0xeee6=['CreateSmsMessage','../client','create'];(function(_0x13c391,_0x147226){var _0x14d618=function(_0x375bb8){while(--_0x375bb8){_0x13c391['push'](_0x13c391['shift']());}};_0x14d618(++_0x147226);}(_0xeee6,0x121));var _0x6eee=function(_0x52aace,_0x90caaf){_0x52aace=_0x52aace-0x0;var _0x40e019=_0xeee6[_0x52aace];return _0x40e019;};'use strict';var client=require(_0x6eee('0x0'));exports[_0x6eee('0x1')]=function(_0x3e8729){return client['Request'](_0x6eee('0x2'),{'body':_0x3e8729,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x3a5a=['CreateSmsMessage','createSmsMessage','create'];(function(_0x1f3b0d,_0x4f638b){var _0x43d603=function(_0x45a327){while(--_0x45a327){_0x1f3b0d['push'](_0x1f3b0d['shift']());}};_0x43d603(++_0x4f638b);}(_0x3a5a,0x1e8));var _0xa3a5=function(_0xa75c23,_0x5131c0){_0xa75c23=_0xa75c23-0x0;var _0x3a07c8=_0x3a5a[_0xa75c23];return _0x3a07c8;};'use strict';var client=require('../client');exports[_0xa3a5('0x0')]=function(_0x2e64ec){return client['Request'](_0xa3a5('0x1'),{'body':_0x2e64ec,'log':_0xa3a5('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index b4ffdff..5e2c418 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x11e935,_0x2e932d){var _0x456bbe=function(_0x175186){while(--_0x175186){_0x11e935['push'](_0x11e935['shift']());}};_0x456bbe(++_0x2e932d);}(_0xe706,0xa3));var _0x6e70=function(_0x4259a3,_0x2f9e82){_0x4259a3=_0x4259a3-0x0;var _0x5dfed4=_0xe706[_0x4259a3];return _0x5dfed4;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x460313,_0x14b8c4){var _0x300b47=function(_0x422377){while(--_0x422377){_0x460313['push'](_0x460313['shift']());}};_0x300b47(++_0x14b8c4);}(_0x70e0,0x17b));var _0x070e=function(_0x97f64,_0x5d927e){_0x97f64=_0x97f64-0x0;var _0x15fd8a=_0x70e0[_0x97f64];return _0x15fd8a;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6f568a8..d294ba6 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x5502d8,_0x3266f4){var _0x3a510c=function(_0x5d2001){while(--_0x5d2001){_0x5502d8['push'](_0x5502d8['shift']());}};_0x3a510c(++_0x3266f4);}(_0x3e74,0x175));var _0x43e7=function(_0x2890ad,_0x39eb3c){_0x2890ad=_0x2890ad-0x0;var _0x3cbedd=_0x3e74[_0x2890ad];return _0x3cbedd;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x111ccf,_0x250082){var _0x461f2a=function(_0x29ea0b){while(--_0x29ea0b){_0x111ccf['push'](_0x111ccf['shift']());}};_0x461f2a(++_0x250082);}(_0x70e0,0x17b));var _0x070e=function(_0xc43253,_0x155a9c){_0xc43253=_0xc43253-0x0;var _0x4c25f9=_0x70e0[_0xc43253];return _0x4c25f9;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index bbdcead..6e08acb 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(_0x44878d,_0x48db95){var _0x37ec37=function(_0x111e9c){while(--_0x111e9c){_0x44878d['push'](_0x44878d['shift']());}};_0x37ec37(++_0x48db95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x460877,_0x5ad61e){var _0x3a9934=function(_0x3f8c67){while(--_0x3f8c67){_0x460877['push'](_0x460877['shift']());}};_0x3a9934(++_0x5ad61e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 82146ff..6083680 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 _0x1623=['updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x1623,0xab));var _0x3162=function(_0x2f1f40,_0x29f142){_0x2f1f40=_0x2f1f40-0x0;var _0x2ca0a3=_0x1623[_0x2f1f40];return _0x2ca0a3;};'use strict';var client=require(_0x3162('0x0'));exports['update']=function(_0x5b17d4,_0x311951){return client[_0x3162('0x1')](_0x3162('0x2'),{'body':_0x311951,'options':{'where':{'id':_0x5b17d4}},'log':_0x3162('0x3')});};exports[_0x3162('0x4')]=function(_0x4ce2bd,_0x5d49d0){return client[_0x3162('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x5d49d0,'options':{'where':{'id':_0x4ce2bd}},'log':_0x3162('0x5')});}; \ No newline at end of file +var _0xee87=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','update'];(function(_0x522050,_0x3d6191){var _0x5a65ec=function(_0x14c0f8){while(--_0x14c0f8){_0x522050['push'](_0x522050['shift']());}};_0x5a65ec(++_0x3d6191);}(_0xee87,0x10d));var _0x7ee8=function(_0x37a323,_0x5179b8){_0x37a323=_0x37a323-0x0;var _0x517a6a=_0xee87[_0x37a323];return _0x517a6a;};'use strict';var client=require('../client');exports[_0x7ee8('0x0')]=function(_0x2657ca,_0xea9501){return client[_0x7ee8('0x1')](_0x7ee8('0x2'),{'body':_0xea9501,'options':{'where':{'id':_0x2657ca}},'log':_0x7ee8('0x3')});};exports[_0x7ee8('0x4')]=function(_0x2f1867,_0x32466c){return client[_0x7ee8('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x32466c,'options':{'where':{'id':_0x2f1867}},'log':_0x7ee8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 051f436..cea4122 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 _0xf401=['Request','CreateWhatsappMessage','../client'];(function(_0x150654,_0x22e377){var _0x28dbee=function(_0x31703f){while(--_0x31703f){_0x150654['push'](_0x150654['shift']());}};_0x28dbee(++_0x22e377);}(_0xf401,0x1df));var _0x1f40=function(_0x5d78bf,_0x3c7bd7){_0x5d78bf=_0x5d78bf-0x0;var _0x7c07d4=_0xf401[_0x5d78bf];return _0x7c07d4;};'use strict';var client=require(_0x1f40('0x0'));exports['create']=function(_0x7a2ad6){return client[_0x1f40('0x1')](_0x1f40('0x2'),{'body':_0x7a2ad6,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xfd7d=['Request','CreateWhatsappMessage','../client'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0xfd7d,0x1b2));var _0xdfd7=function(_0x457bf8,_0x209a0a){_0x457bf8=_0x457bf8-0x0;var _0x919f94=_0xfd7d[_0x457bf8];return _0x919f94;};'use strict';var client=require(_0xdfd7('0x0'));exports['create']=function(_0xf99958){return client[_0xdfd7('0x1')](_0xdfd7('0x2'),{'body':_0xf99958,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3c7f993..c5db0ee 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 _0x8b2c=['GetWhatsappQueue','name','strategy','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x1e2072,_0xe3cc90){var _0x22956b=function(_0x118dcf){while(--_0x118dcf){_0x1e2072['push'](_0x1e2072['shift']());}};_0x22956b(++_0xe3cc90);}(_0x8b2c,0x19b));var _0xc8b2=function(_0x15e62a,_0x73cd0d){_0x15e62a=_0x15e62a-0x0;var _0x281df9=_0x8b2c[_0x15e62a];return _0x281df9;};'use strict';var client=require(_0xc8b2('0x0'));exports[_0xc8b2('0x1')]=function(){return function(){return client[_0xc8b2('0x2')](_0xc8b2('0x3'),{'options':{'raw':![],'attributes':['id',_0xc8b2('0x4'),'timeout',_0xc8b2('0x5')],'include':[{'model':'User','as':_0xc8b2('0x6'),'attributes':['id','name',_0xc8b2('0x7'),_0xc8b2('0x8')]}]},'log':_0xc8b2('0x1')});};}; \ No newline at end of file +var _0xe5a8=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xe5a8,0x8b));var _0x8e5a=function(_0x102dfd,_0x477ec8){_0x102dfd=_0x102dfd-0x0;var _0x2fb88d=_0xe5a8[_0x102dfd];return _0x2fb88d;};'use strict';var client=require('../client');exports[_0x8e5a('0x0')]=function(){return function(){return client[_0x8e5a('0x1')](_0x8e5a('0x2'),{'options':{'raw':![],'attributes':['id',_0x8e5a('0x3'),_0x8e5a('0x4'),_0x8e5a('0x5')],'include':[{'model':_0x8e5a('0x6'),'as':_0x8e5a('0x7'),'attributes':['id',_0x8e5a('0x3'),_0x8e5a('0x8'),_0x8e5a('0x9')]}]},'log':_0x8e5a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0a9f060..24d9a6a 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 _0x8bd2=['Request','UpdateWhatsappQueueReport','DESC','create','CreateWhatsappQueueReport','update'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x8bd2,0xb7));var _0x28bd=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x8bd2[_0x3c2b2e];return _0x27a338;};'use strict';var client=require('../client');exports[_0x28bd('0x0')]=function(_0x19983d){return client['Request'](_0x28bd('0x1'),{'body':_0x19983d,'log':_0x28bd('0x1')});};exports[_0x28bd('0x2')]=function(_0x2274f4,_0x5908ee){return client[_0x28bd('0x3')](_0x28bd('0x4'),{'body':_0x5908ee,'options':{'where':{'uniqueid':_0x2274f4},'order':[['id',_0x28bd('0x5')]],'limit':0x1},'log':_0x28bd('0x4')});}; \ No newline at end of file +var _0x9c52=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x88fb3f,_0x3abf8a){var _0x5e8997=function(_0x23f534){while(--_0x23f534){_0x88fb3f['push'](_0x88fb3f['shift']());}};_0x5e8997(++_0x3abf8a);}(_0x9c52,0x1ea));var _0x29c5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c52[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports['create']=function(_0x4f5006){return client[_0x29c5('0x0')]('CreateWhatsappQueueReport',{'body':_0x4f5006,'log':_0x29c5('0x1')});};exports[_0x29c5('0x2')]=function(_0x233622,_0x5ac168){return client[_0x29c5('0x0')](_0x29c5('0x3'),{'body':_0x5ac168,'options':{'where':{'uniqueid':_0x233622},'order':[['id',_0x29c5('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index ddddeca..d86be4b 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 _0xff5b=['end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','util','../../../../config/logger','string','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','error','[%s][AGENT]\x20%s','map','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules'];(function(_0x3e3faa,_0x4c84ab){var _0x4b10bb=function(_0x4a6224){while(--_0x4a6224){_0x3e3faa['push'](_0x3e3faa['shift']());}};_0x4b10bb(++_0x4c84ab);}(_0xff5b,0x1e8));var _0xbff5=function(_0x349a72,_0x306ff4){_0x349a72=_0x349a72-0x0;var _0x9fb112=_0xff5b[_0x349a72];return _0x9fb112;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xbff5('0x0'));var seqqueue=require('seq-queue');var logger=require(_0xbff5('0x1'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xbff5('0x2'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xbff5('0x3'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x867f7a,_0x206e16,_0x4735e2){return logger[_0xbff5('0x4')](util[_0xbff5('0x5')](_0xbff5('0x6'),_0x867f7a,_0x206e16[_0xbff5('0x7')],_0x4735e2));}function handleFindAgent(_0x1ab20a){return function(_0x4a30be){return _0x4a30be[_0xbff5('0x7')][_0xbff5('0x8')]()===_0x1ab20a[_0xbff5('0x8')]();};}exports['consequence']=function(_0x3b3639,_0x1843a0,_0xaad5b0,_0x8a1b4d){return function(_0x3832e2){try{var _0xc134e6={'name':_0x1843a0[0x0],'timeout':_0x1843a0[0x1]};var _0x44bc48=queue[_0xbff5('0x9')](_0xc134e6,{'typecast':!![]});if(_0x44bc48['length']){logger[_0xbff5('0xa')](_0xbff5('0xb'),_0x3b3639,_[_0xbff5('0xc')](_0x44bc48,'message')[_0xbff5('0xd')](',\x20'));_0x3832e2[_0xbff5('0xe')]();}else{var _0x40373c=_[_0xbff5('0xf')](_0xaad5b0['agents'],handleFindAgent(_0xc134e6[_0xbff5('0x7')]));if(_0x40373c){var _0x505b05=(_0xc134e6[_0xbff5('0x10')]||0xa)*0x3e8;var _0x4ca607,_0x28448b;var _0x3e49b9=seqqueue[_0xbff5('0x11')](_0x505b05);_0x3e49b9['id']=_0x3b3639;_0x3e49b9[_0xbff5('0x12')]=_0x505b05;_0x3e49b9['channel']=_0x8a1b4d[_0xbff5('0x13')];writeLog(_0x3b3639,_0x40373c,util[_0xbff5('0x5')](_0xbff5('0x14'),_0x505b05));_0xaad5b0[_0xbff5('0x15')][_0x3b3639]['on'](_0xbff5('0x16'),function(){logger[_0xbff5('0x4')](_0xbff5('0x17'),_0x3b3639);clearTimeout(_0x28448b);_0x28448b=undefined;_0x3e49b9['close']();if(_0xaad5b0[_0xbff5('0x15')][_0x3b3639]){delete _0xaad5b0[_0xbff5('0x15')][_0x3b3639];}_0x3832e2[_0xbff5('0xe')]();});_0xaad5b0[_0xbff5('0x15')][_0x3b3639]['on'](_0xbff5('0x18'),function(){if(_0xaad5b0['rules'][_0x3b3639]){delete _0xaad5b0[_0xbff5('0x15')][_0x3b3639];}});_0x28448b=setTimeout(function(){logger[_0xbff5('0x4')](_0xbff5('0x19'),_0x3b3639);clearTimeout(_0x28448b);_0x3e49b9[_0xbff5('0x1a')]();_0x3832e2['next']();},_0x505b05);strategy['agent'](_0x3e49b9,_0x40373c,_0xaad5b0,_0x8a1b4d);}else{logger[_0xbff5('0xa')](_0xbff5('0x1b'),_0x3b3639,_0xc134e6['name']);_0x3832e2['stop']();}}}catch(_0x22f9b4){console[_0xbff5('0x1c')](_0x22f9b4);logger[_0xbff5('0xa')]('[%s][QUEUE]\x20%s',_0x3b3639,_0x22f9b4[_0xbff5('0x1d')]);_0x3832e2[_0xbff5('0xe')]();}};}; \ No newline at end of file +var _0x06eb=['name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','agent','error','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x35e80f,_0x4cf980){var _0x40fd0e=function(_0x2352ba){while(--_0x2352ba){_0x35e80f['push'](_0x35e80f['shift']());}};_0x40fd0e(++_0x4cf980);}(_0x06eb,0x1c8));var _0xb06e=function(_0x10c8af,_0x54877d){_0x10c8af=_0x10c8af-0x0;var _0x182024=_0x06eb[_0x10c8af];return _0x182024;};'use strict';var schema=require(_0xb06e('0x0'));var _=require(_0xb06e('0x1'));var util=require(_0xb06e('0x2'));var seqqueue=require(_0xb06e('0x3'));var logger=require(_0xb06e('0x4'))(_0xb06e('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xb06e('0x6'),'required':!![],'message':_0xb06e('0x7')},'timeout':{'type':_0xb06e('0x8'),'message':_0xb06e('0x9')}});function writeLog(_0x339e03,_0x15849a,_0x1ecd4b){return logger[_0xb06e('0xa')](util[_0xb06e('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x339e03,_0x15849a[_0xb06e('0xc')],_0x1ecd4b));}function handleFindAgent(_0xe22e3e){return function(_0xb3ce2a){return _0xb3ce2a[_0xb06e('0xc')][_0xb06e('0xd')]()===_0xe22e3e[_0xb06e('0xd')]();};}exports['consequence']=function(_0x555785,_0x4554e5,_0x5428b5,_0x145f7e){return function(_0x57a895){try{var _0x224037={'name':_0x4554e5[0x0],'timeout':_0x4554e5[0x1]};var _0x4dc2a7=queue[_0xb06e('0x0')](_0x224037,{'typecast':!![]});if(_0x4dc2a7[_0xb06e('0xe')]){logger['error'](_0xb06e('0xf'),_0x555785,_[_0xb06e('0x10')](_0x4dc2a7,_0xb06e('0x11'))[_0xb06e('0x12')](',\x20'));_0x57a895['stop']();}else{var _0x44d2f8=_[_0xb06e('0x13')](_0x5428b5[_0xb06e('0x14')],handleFindAgent(_0x224037[_0xb06e('0xc')]));if(_0x44d2f8){var _0x56f111=(_0x224037[_0xb06e('0x15')]||0xa)*0x3e8;var _0x42acdb,_0x1f70f1;var _0x36aae1=seqqueue[_0xb06e('0x16')](_0x56f111);_0x36aae1['id']=_0x555785;_0x36aae1[_0xb06e('0x17')]=_0x56f111;_0x36aae1[_0xb06e('0x18')]=_0x145f7e[_0xb06e('0x18')];writeLog(_0x555785,_0x44d2f8,util['format'](_0xb06e('0x19'),_0x56f111));_0x5428b5[_0xb06e('0x1a')][_0x555785]['on']('end',function(){logger[_0xb06e('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x555785);clearTimeout(_0x1f70f1);_0x1f70f1=undefined;_0x36aae1['close']();if(_0x5428b5[_0xb06e('0x1a')][_0x555785]){delete _0x5428b5[_0xb06e('0x1a')][_0x555785];}_0x57a895[_0xb06e('0x1b')]();});_0x5428b5[_0xb06e('0x1a')][_0x555785]['on'](_0xb06e('0x1c'),function(){if(_0x5428b5[_0xb06e('0x1a')][_0x555785]){delete _0x5428b5[_0xb06e('0x1a')][_0x555785];}});_0x1f70f1=setTimeout(function(){logger[_0xb06e('0xa')](_0xb06e('0x1d'),_0x555785);clearTimeout(_0x1f70f1);_0x36aae1[_0xb06e('0x1e')]();_0x57a895['next']();},_0x56f111);strategy[_0xb06e('0x1f')](_0x36aae1,_0x44d2f8,_0x5428b5,_0x145f7e);}else{logger[_0xb06e('0x20')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x555785,_0x224037['name']);_0x57a895[_0xb06e('0x1b')]();}}}catch(_0x46a033){console[_0xb06e('0x21')](_0x46a033);logger[_0xb06e('0x20')](_0xb06e('0x22'),_0x555785,_0x46a033[_0xb06e('0x23')]);_0x57a895[_0xb06e('0x1b')]();}};}; \ 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 8c94d4a..7dd3149 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 _0x3d5f=['ChatWebsiteId','account','AccountId','InteractionId','isEmpty','Message','then','info','[%s][AMAZONLEX]\x20%s','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','toString','postText','body','amazonlex','providerResponse','dialogState','Failed','stringify','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','chat'];(function(_0x407fcd,_0x34326e){var _0x3cc78a=function(_0x3115f7){while(--_0x3115f7){_0x407fcd['push'](_0x407fcd['shift']());}};_0x3cc78a(++_0x34326e);}(_0x3d5f,0x14c));var _0xf3d5=function(_0x5dc5c6,_0x38366b){_0x5dc5c6=_0x5dc5c6-0x0;var _0x11f053=_0x3d5f[_0x5dc5c6];return _0x11f053;};'use strict';var _=require(_0xf3d5('0x0'));var moment=require('moment');var AWS=require(_0xf3d5('0x1'));var utils=require(_0xf3d5('0x2'));var logger=require(_0xf3d5('0x3'))(_0xf3d5('0x4'));var rpc={'chatMessage':require(_0xf3d5('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf3d5('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf3d5('0x7')),'whatsappMessage':require(_0xf3d5('0x8'))};exports[_0xf3d5('0x9')]=function(_0x11aeaf,_0x26f160){return function(_0x194a38){try{if(!_['isNil'](this[_0xf3d5('0xa')][_0xf3d5('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x11aeaf,_0xf3d5('0xc'));return _0x194a38[_0xf3d5('0xd')]();}var _0x354428={'ContactId':this[_0xf3d5('0xe')]['id'],'sentAt':moment()[_0xf3d5('0xf')](_0xf3d5('0x10')),'direction':'out'};if(this['channel']===_0xf3d5('0x11')||this[_0xf3d5('0x12')]==='whatsapp'){_0x354428['phone']=this['interaction']['phone'];}var _0x42c91f=this[_0xf3d5('0x12')];if(_0x42c91f===_0xf3d5('0x13')){_0x354428[_0xf3d5('0x14')]=this[_0xf3d5('0x15')]['id'];}else{_0x354428[_['upperFirst'](_0x42c91f)+_0xf3d5('0x16')]=this[_0xf3d5('0x15')]['id'];}_0x354428[_['upperFirst'](_0x42c91f)+_0xf3d5('0x17')]=this['interaction']['id'];if(this[_0xf3d5('0xa')]['created']){var _0x32fd7a=_0x26f160[0x4];if(!_[_0xf3d5('0x18')](_0x32fd7a)){_0x354428['body']=utils['getMustacheRender'](_0x32fd7a,this);return rpc[_0x42c91f+_0xf3d5('0x19')]['create'](_0x354428)[_0xf3d5('0x1a')](function(_0x445202){logger[_0xf3d5('0x1b')](_0xf3d5('0x1c'),_0x11aeaf,_0x354428['body']);})[_0xf3d5('0x1d')](function(_0x3f2e03){logger[_0xf3d5('0x1e')](_0xf3d5('0x1c'),_0x11aeaf,JSON['stringify'](_0x3f2e03));})[_0xf3d5('0x1f')](function(){logger['info'](_0xf3d5('0x20'),_0x11aeaf);_0x194a38[_0xf3d5('0x21')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x11aeaf);_0x194a38[_0xf3d5('0x21')]();}}else{var _0x525171=this;var _0xdd27f2=new AWS[(_0xf3d5('0x22'))]({'accessKeyId':_0x26f160[0x0],'secretAccessKey':_0x26f160[0x1],'region':_0x26f160[0x2]});var _0x13071c={'botAlias':'$LATEST','botName':_0x26f160[0x3],'inputText':this[_0xf3d5('0x23')]['body'],'userId':this[_0xf3d5('0x12')]+':'+this[_0xf3d5('0xa')]['id'][_0xf3d5('0x24')]()};_0xdd27f2[_0xf3d5('0x25')](_0x13071c,function(_0x1e83cc,_0x2e3733){if(_0x1e83cc){logger[_0xf3d5('0x1e')](_0xf3d5('0x1c'),_0x11aeaf,_0x1e83cc[_0xf3d5('0x23')]);_0x194a38['next']();}else if(_0x2e3733&&_0x2e3733[_0xf3d5('0x23')]){_0x525171[_0xf3d5('0x26')][_0xf3d5('0x27')]=_0x2e3733;_0x354428['body']=_0x2e3733[_0xf3d5('0x23')];_0x354428['providerName']=_0xf3d5('0x27');_0x354428[_0xf3d5('0x28')]=JSON['stringify'](_0x2e3733);return rpc[_0x42c91f+_0xf3d5('0x19')]['create'](_0x354428)[_0xf3d5('0x1a')](function(_0x1811c7){logger[_0xf3d5('0x1b')](_0xf3d5('0x1c'),_0x11aeaf,_0x354428[_0xf3d5('0x26')]);if(_0x2e3733[_0xf3d5('0x29')]==_0xf3d5('0x2a')){_0x194a38[_0xf3d5('0xd')]();}else{_0x194a38[_0xf3d5('0x21')]();}})[_0xf3d5('0x1d')](function(_0x4d4843){logger[_0xf3d5('0x1e')](_0xf3d5('0x1c'),_0x11aeaf,JSON['stringify'](_0x4d4843));_0x194a38[_0xf3d5('0xd')]();});}else{_0x194a38[_0xf3d5('0xd')]();}});}}catch(_0x3b9367){logger[_0xf3d5('0x1e')](_0xf3d5('0x1c'),_0x11aeaf,JSON[_0xf3d5('0x2b')](_0x3b9367));_0x194a38[_0xf3d5('0x21')]();}};}; \ No newline at end of file +var _0x50f7=['getMustacheRender','Message','create','then','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','error','next','amazonlex','providerName','providerResponse','stringify','Failed','lodash','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body'];(function(_0xab009f,_0x9807ea){var _0x14713c=function(_0x7cd827){while(--_0x7cd827){_0xab009f['push'](_0xab009f['shift']());}};_0x14713c(++_0x9807ea);}(_0x50f7,0xa7));var _0x750f=function(_0x5bd343,_0x599341){_0x5bd343=_0x5bd343-0x0;var _0x4f1545=_0x50f7[_0x5bd343];return _0x4f1545;};'use strict';var _=require(_0x750f('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x750f('0x1'));var logger=require('../../../../config/logger')(_0x750f('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x750f('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x750f('0x4')),'faxMessage':require(_0x750f('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x750f('0x6')]=function(_0x502662,_0x298207){return function(_0x4d3d70){try{if(!_[_0x750f('0x7')](this[_0x750f('0x8')][_0x750f('0x9')])){logger[_0x750f('0xa')](_0x750f('0xb'),_0x502662,_0x750f('0xc'));return _0x4d3d70['next']();}var _0x606567={'ContactId':this[_0x750f('0xd')]['id'],'sentAt':moment()[_0x750f('0xe')](_0x750f('0xf')),'direction':'out'};if(this['channel']===_0x750f('0x10')||this['channel']===_0x750f('0x11')){_0x606567[_0x750f('0x12')]=this[_0x750f('0x8')][_0x750f('0x12')];}var _0x207f04=this[_0x750f('0x13')];if(_0x207f04===_0x750f('0x14')){_0x606567[_0x750f('0x15')]=this['account']['id'];}else{_0x606567[_[_0x750f('0x16')](_0x207f04)+_0x750f('0x17')]=this[_0x750f('0x18')]['id'];}_0x606567[_[_0x750f('0x16')](_0x207f04)+_0x750f('0x19')]=this[_0x750f('0x8')]['id'];if(this[_0x750f('0x8')][_0x750f('0x1a')]){var _0x14ead3=_0x298207[0x4];if(!_[_0x750f('0x1b')](_0x14ead3)){_0x606567[_0x750f('0x1c')]=utils[_0x750f('0x1d')](_0x14ead3,this);return rpc[_0x207f04+_0x750f('0x1e')][_0x750f('0x1f')](_0x606567)[_0x750f('0x20')](function(_0x5d1974){logger[_0x750f('0xa')](_0x750f('0xb'),_0x502662,_0x606567[_0x750f('0x1c')]);})[_0x750f('0x21')](function(_0x673640){logger['error']('[%s][AMAZONLEX]\x20%s',_0x502662,JSON['stringify'](_0x673640));})[_0x750f('0x22')](function(){logger[_0x750f('0xa')](_0x750f('0x23'),_0x502662);_0x4d3d70[_0x750f('0x24')]();});}else{logger[_0x750f('0xa')](_0x750f('0x25'),_0x502662);_0x4d3d70[_0x750f('0x24')]();}}else{var _0x1189fe=this;var _0x229bad=new AWS['LexRuntime']({'accessKeyId':_0x298207[0x0],'secretAccessKey':_0x298207[0x1],'region':_0x298207[0x2]});var _0x4a1aa1={'botAlias':_0x750f('0x26'),'botName':_0x298207[0x3],'inputText':this[_0x750f('0x27')][_0x750f('0x1c')],'userId':this[_0x750f('0x13')]+':'+this[_0x750f('0x8')]['id'][_0x750f('0x28')]()};_0x229bad[_0x750f('0x29')](_0x4a1aa1,function(_0x254ff8,_0x5ba779){if(_0x254ff8){logger[_0x750f('0x2a')](_0x750f('0xb'),_0x502662,_0x254ff8[_0x750f('0x27')]);_0x4d3d70[_0x750f('0x2b')]();}else if(_0x5ba779&&_0x5ba779[_0x750f('0x27')]){_0x1189fe[_0x750f('0x1c')][_0x750f('0x2c')]=_0x5ba779;_0x606567[_0x750f('0x1c')]=_0x5ba779[_0x750f('0x27')];_0x606567[_0x750f('0x2d')]='amazonlex';_0x606567[_0x750f('0x2e')]=JSON[_0x750f('0x2f')](_0x5ba779);return rpc[_0x207f04+'Message']['create'](_0x606567)[_0x750f('0x20')](function(_0x26f56e){logger['info']('[%s][AMAZONLEX]\x20%s',_0x502662,_0x606567[_0x750f('0x1c')]);if(_0x5ba779['dialogState']==_0x750f('0x30')){_0x4d3d70[_0x750f('0x2b')]();}else{_0x4d3d70['stop']();}})[_0x750f('0x21')](function(_0x5868dd){logger['error']('[%s][AMAZONLEX]\x20%s',_0x502662,JSON[_0x750f('0x2f')](_0x5868dd));_0x4d3d70[_0x750f('0x2b')]();});}else{_0x4d3d70[_0x750f('0x2b')]();}});}}catch(_0x11a4f0){logger['error'](_0x750f('0xb'),_0x502662,JSON['stringify'](_0x11a4f0));_0x4d3d70['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 7591e78..028a988 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 _0xb841=['ChatWebsiteId','account','upperFirst','InteractionId','Message','inReplyTo','messageId','html','','replace','','All','auto_reply','sendMailMessage','smtpOptions','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','update','stop','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat'];(function(_0x2e6c75,_0x1bdbb7){var _0x13a9ea=function(_0x6ad297){while(--_0x6ad297){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x13a9ea(++_0x1bdbb7);}(_0xb841,0xe4));var _0x1b84=function(_0x131e95,_0x46c5c9){_0x131e95=_0x131e95-0x0;var _0x2b1cf=_0xb841[_0x131e95];return _0x2b1cf;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x1b84('0x0'));var logger=require(_0x1b84('0x1'))('routing');var rpc={'chatMessage':require(_0x1b84('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1b84('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1b84('0x4')),'whatsappMessage':require(_0x1b84('0x5')),'chatInteraction':require(_0x1b84('0x6')),'openchannelInteraction':require(_0x1b84('0x7')),'mailInteraction':require(_0x1b84('0x8')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1b84('0x9'))};var mailRpc=require(_0x1b84('0xa'));exports[_0x1b84('0xb')]=function(_0xdcf386,_0x4beca9,_0x4ee04e,_0x34e24b){return function(_0x45a5b6){try{var _0x2306cd=this[_0x1b84('0xc')];if(_0x2306cd===_0x1b84('0xd')&&_0x34e24b['body'][_0x1b84('0xe')]){logger['info'](_0x1b84('0xf'),_0xdcf386,_0x1b84('0x10'));return _0x45a5b6[_0x1b84('0x11')]();}if(_0x4beca9[0x0]==='1'&&(_['isNil'](this[_0x1b84('0x12')][_0x1b84('0x13')])||!this['interaction']['created'])){logger[_0x1b84('0x14')]('[%s][AUTOREPLY]\x20%s',_0xdcf386,_0x1b84('0x15'));return _0x45a5b6[_0x1b84('0x11')]();}if(_0x4beca9[0x0]==='2'&&this[_0x1b84('0x12')]['autoreplyExecuted']){logger[_0x1b84('0x14')](_0x1b84('0x16'),_0xdcf386,_0x1b84('0x17'));return _0x45a5b6[_0x1b84('0x11')]();}var _0x174351={'ContactId':this[_0x1b84('0x18')]['id'],'sentAt':moment()[_0x1b84('0x19')](_0x1b84('0x1a')),'direction':'out'};if(this[_0x1b84('0xc')]===_0x1b84('0xd')){_0x174351[_0x1b84('0x1b')]=utils[_0x1b84('0x1c')](_0x4beca9[0x2],this);}else{_0x174351[_0x1b84('0x1b')]=utils[_0x1b84('0x1c')](_0x4beca9[0x1],this);}if(this[_0x1b84('0x1d')]){_0x174351['to']=this[_0x1b84('0x1d')][_0x1b84('0x1e')]||'';if(this[_0x1b84('0xc')]===_0x1b84('0xd')&&_0x4beca9[0x1]==='1'){_0x174351['cc']=this['message']['cc']||'';}_0x174351[_0x1b84('0x1e')]=this[_0x1b84('0x1d')]['to']||'';_0x174351[_0x1b84('0x1f')]=this[_0x1b84('0x1d')][_0x1b84('0x1f')]||'';_0x174351['read']=!![];if(this[_0x1b84('0x1d')][_0x1b84('0x20')]){_0x174351['subject']='';_0x174351[_0x1b84('0x20')]+=_[_0x1b84('0x21')](this[_0x1b84('0x1d')][_0x1b84('0x20')],_0x1b84('0x22'))?'':'Re:\x20';_0x174351[_0x1b84('0x20')]+=this[_0x1b84('0x1d')][_0x1b84('0x20')];}}if(this[_0x1b84('0xc')]===_0x1b84('0x23')){_0x174351[_0x1b84('0x24')]=this[_0x1b84('0x25')]['id'];}else{_0x174351[_[_0x1b84('0x26')](this[_0x1b84('0xc')])+'AccountId']=this[_0x1b84('0x25')]['id'];}_0x174351[_[_0x1b84('0x26')](this['channel'])+_0x1b84('0x27')]=this[_0x1b84('0x12')]['id'];var _0x3a92a4=this['interaction'];if(rpc[this[_0x1b84('0xc')]+_0x1b84('0x28')]){if(this[_0x1b84('0xc')]===_0x1b84('0xd')){_0x174351[_0x1b84('0x29')]=this[_0x1b84('0x1d')][_0x1b84('0x2a')];_0x174351[_0x1b84('0x2b')]=_0x1b84('0x2c')+_[_0x1b84('0x2d')](_0x174351[_0x1b84('0x1b')],_0x1b84('0x2e'),_0x1b84('0x2f'))+_0x1b84('0x30');_0x174351['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x1b84('0x31'),'Precedence':_0x1b84('0x32')};return mailRpc[_0x1b84('0x33')](this['account'][_0x1b84('0x34')],_0x174351)[_0x1b84('0x35')](function(_0x42efd4){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xdcf386);_0x174351['messageId']=_0x42efd4[_0x1b84('0x1d')]['messageId'];return rpc[_0x2306cd+_0x1b84('0x28')]['create'](_0x174351);})[_0x1b84('0x35')](function(_0x342265){logger[_0x1b84('0x14')](_0x1b84('0xf'),_0xdcf386,JSON[_0x1b84('0x36')](_0x342265));})[_0x1b84('0x37')](function(_0x22c05a){logger[_0x1b84('0x38')](_0x1b84('0x39'),_0xdcf386,JSON[_0x1b84('0x36')](_0x22c05a));})[_0x1b84('0x3a')](function(){Promise[_0x1b84('0x3b')]()['then'](function(){if(_0x4beca9[0x0]!=='2'||_0x3a92a4[_0x1b84('0x3c')])return;return rpc[_0x2306cd+_0x1b84('0x3d')]['update'](_0x3a92a4['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3eb6ff){logger[_0x1b84('0x14')](_0x1b84('0x16'),_0xdcf386,JSON['stringify'](_0x3eb6ff));})['catch'](function(_0x21013e){logger['error'](_0x1b84('0x3e'),_0xdcf386,JSON[_0x1b84('0x36')](_0x21013e));});})[_0x1b84('0x35')](function(){_0x45a5b6[_0x1b84('0x11')]();});});}else{return rpc[this['channel']+'Message'][_0x1b84('0x3f')](_0x174351)['then'](function(){logger[_0x1b84('0x14')](_0x1b84('0xf'),_0xdcf386,_0x174351[_0x1b84('0x1b')]);})['catch'](function(_0xd3a754){logger[_0x1b84('0x38')]('[%s][AUTOREPLY]\x20%s',_0xdcf386,JSON[_0x1b84('0x36')](_0xd3a754));})[_0x1b84('0x3a')](function(){Promise['resolve']()[_0x1b84('0x35')](function(){if(_0x4beca9[0x0]!=='2'||_0x3a92a4[_0x1b84('0x3c')])return;return rpc[_0x2306cd+'Interaction'][_0x1b84('0x40')](_0x3a92a4['id'],{'autoreplyExecuted':!![]})[_0x1b84('0x35')](function(_0x7d5e82){logger['info'](_0x1b84('0x16'),_0xdcf386,JSON['stringify'](_0x7d5e82));})[_0x1b84('0x37')](function(_0x23bf81){logger[_0x1b84('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xdcf386,JSON[_0x1b84('0x36')](_0x23bf81));});})[_0x1b84('0x35')](function(){_0x45a5b6['next']();});});}}}catch(_0x55944d){logger['error'](_0x1b84('0xf'),_0xdcf386,JSON[_0x1b84('0x36')](_0x55944d));_0x45a5b6[_0x1b84('0x41')]();}};}; \ No newline at end of file +var _0x980f=['mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','info','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','from','message','phone','read','subject','Re:\x20','chat','ChatWebsiteId','upperFirst','InteractionId','Message','html','','';_0x25e829[_0xf980('0x2f')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xf980('0x30'),'Precedence':_0xf980('0x31')};return mailRpc[_0xf980('0x32')](this[_0xf980('0x33')]['smtpOptions'],_0x25e829)[_0xf980('0x34')](function(_0x45d3af){logger[_0xf980('0x18')](_0xf980('0x35'),_0x966e51);_0x25e829[_0xf980('0x36')]=_0x45d3af[_0xf980('0x21')][_0xf980('0x36')];return rpc[_0x63140+_0xf980('0x2a')][_0xf980('0x37')](_0x25e829);})[_0xf980('0x34')](function(_0x155e23){logger[_0xf980('0x18')](_0xf980('0x13'),_0x966e51,JSON[_0xf980('0x38')](_0x155e23));})[_0xf980('0x39')](function(_0x4f3fd0){logger[_0xf980('0x3a')](_0xf980('0x3b'),_0x966e51,JSON[_0xf980('0x38')](_0x4f3fd0));})[_0xf980('0x3c')](function(){Promise[_0xf980('0x3d')]()['then'](function(){if(_0x4316b6[0x0]!=='2'||_0x4cb0c8[_0xf980('0x3e')])return;return rpc[_0x63140+_0xf980('0x3f')]['update'](_0x4cb0c8['id'],{'autoreplyExecuted':!![]})[_0xf980('0x34')](function(_0xd6e77a){logger[_0xf980('0x18')](_0xf980('0x40'),_0x966e51,JSON[_0xf980('0x38')](_0xd6e77a));})[_0xf980('0x39')](function(_0x3e3921){logger[_0xf980('0x3a')](_0xf980('0x41'),_0x966e51,JSON[_0xf980('0x38')](_0x3e3921));});})[_0xf980('0x34')](function(){_0x58a4e9[_0xf980('0x15')]();});});}else{return rpc[this['channel']+_0xf980('0x2a')][_0xf980('0x37')](_0x25e829)[_0xf980('0x34')](function(){logger['info'](_0xf980('0x13'),_0x966e51,_0x25e829['body']);})['catch'](function(_0xe6c0ad){logger[_0xf980('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x966e51,JSON[_0xf980('0x38')](_0xe6c0ad));})[_0xf980('0x3c')](function(){Promise[_0xf980('0x3d')]()[_0xf980('0x34')](function(){if(_0x4316b6[0x0]!=='2'||_0x4cb0c8[_0xf980('0x3e')])return;return rpc[_0x63140+'Interaction'][_0xf980('0x42')](_0x4cb0c8['id'],{'autoreplyExecuted':!![]})[_0xf980('0x34')](function(_0x199e44){logger[_0xf980('0x18')](_0xf980('0x40'),_0x966e51,JSON[_0xf980('0x38')](_0x199e44));})['catch'](function(_0x5e7413){logger['error'](_0xf980('0x41'),_0x966e51,JSON[_0xf980('0x38')](_0x5e7413));});})[_0xf980('0x34')](function(){_0x58a4e9[_0xf980('0x15')]();});});}}}catch(_0x51a69b){logger[_0xf980('0x3a')](_0xf980('0x13'),_0x966e51,JSON[_0xf980('0x38')](_0x51a69b));_0x58a4e9[_0xf980('0x43')]();}};}; \ 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 f6bc16f..502d797 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 _0x4fb6=['update','interaction','then','info','error','[%s][CLOSE]\x20%s','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction'];(function(_0x5eee46,_0x1bc4e0){var _0x93390c=function(_0x3492b7){while(--_0x3492b7){_0x5eee46['push'](_0x5eee46['shift']());}};_0x93390c(++_0x1bc4e0);}(_0x4fb6,0xe4));var _0x64fb=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x4fb6[_0x1a9204];return _0x17ca68;};'use strict';var moment=require('moment');var logger=require(_0x64fb('0x0'))(_0x64fb('0x1'));var rpc={'chatInteraction':require(_0x64fb('0x2')),'openchannelInteraction':require(_0x64fb('0x3')),'smsInteraction':require(_0x64fb('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x64fb('0x5')),'whatsappInteraction':require(_0x64fb('0x6'))};exports[_0x64fb('0x7')]=function(_0x120885,_0x312bd0,_0x2c9ee6,_0xf401c4){return function(_0x4387be){try{logger['info'](_0x64fb('0x8'),_0x120885,_0x312bd0[0x0]);var _0x40cba1={'closed':0x1,'closedAt':moment()['format'](_0x64fb('0x9')),'closeReason':'system','disposition':_0x312bd0[0x0]};if(rpc[_0xf401c4[_0x64fb('0xa')]+_0x64fb('0xb')]){rpc[_0xf401c4[_0x64fb('0xa')]+_0x64fb('0xb')][_0x64fb('0xc')](_0xf401c4[_0x64fb('0xd')]['id'],_0x40cba1)[_0x64fb('0xe')](function(_0x5d06b3){logger[_0x64fb('0xf')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x120885,_0xf401c4['interaction']['id']);})['catch'](function(_0x835a2c){logger[_0x64fb('0x10')](_0x64fb('0x11'),_0x120885,JSON['stringify'](_0x835a2c));})[_0x64fb('0x12')](function(){_0x4387be['stop']();});}}catch(_0x2b61e9){logger[_0x64fb('0x10')](_0x64fb('0x11'),_0x120885,JSON['stringify'](_0x2b61e9));_0x4387be[_0x64fb('0x13')]();}};}; \ No newline at end of file +var _0xb21d=['stringify','moment','../../../../config/logger','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb21d,0x1e4));var _0xdb21=function(_0x437dae,_0xe45ee4){_0x437dae=_0x437dae-0x0;var _0x436ade=_0xb21d[_0x437dae];return _0x436ade;};'use strict';var moment=require(_0xdb21('0x0'));var logger=require(_0xdb21('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xdb21('0x2')),'smsInteraction':require(_0xdb21('0x3')),'mailInteraction':require(_0xdb21('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xdb21('0x5'))};exports[_0xdb21('0x6')]=function(_0x44cdfb,_0x2e2771,_0x3702a9,_0x458159){return function(_0x414eb1){try{logger[_0xdb21('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x44cdfb,_0x2e2771[0x0]);var _0x5086b2={'closed':0x1,'closedAt':moment()[_0xdb21('0x8')](_0xdb21('0x9')),'closeReason':_0xdb21('0xa'),'disposition':_0x2e2771[0x0]};if(rpc[_0x458159[_0xdb21('0xb')]+_0xdb21('0xc')]){rpc[_0x458159['channel']+_0xdb21('0xc')][_0xdb21('0xd')](_0x458159[_0xdb21('0xe')]['id'],_0x5086b2)[_0xdb21('0xf')](function(_0x2b3d51){logger[_0xdb21('0x7')](_0xdb21('0x10'),_0x44cdfb,_0x458159[_0xdb21('0xe')]['id']);})[_0xdb21('0x11')](function(_0x4e57c0){logger[_0xdb21('0x12')](_0xdb21('0x13'),_0x44cdfb,JSON['stringify'](_0x4e57c0));})[_0xdb21('0x14')](function(){_0x414eb1[_0xdb21('0x15')]();});}}catch(_0x254d0a){logger['error'](_0xdb21('0x13'),_0x44cdfb,JSON[_0xdb21('0x16')](_0x254d0a));_0x414eb1['stop']();}};}; \ 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 8a8ee7b..1c251fc 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 _0x9d5c=['error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','dialogflow','result','fulfillment','speech','providerResponse','Message','metadata','endConversation','next','catch','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','body'];(function(_0x5cdf2c,_0x43f629){var _0x13924a=function(_0x2494f5){while(--_0x2494f5){_0x5cdf2c['push'](_0x5cdf2c['shift']());}};_0x13924a(++_0x43f629);}(_0x9d5c,0x98));var _0xc9d5=function(_0x33caef,_0x1b94c7){_0x33caef=_0x33caef-0x0;var _0x4ba079=_0x9d5c[_0x33caef];return _0x4ba079;};'use strict';var _=require(_0xc9d5('0x0'));var moment=require('moment');var apiai=require(_0xc9d5('0x1'));var md5=require(_0xc9d5('0x2'));var utils=require('./utils');var logger=require(_0xc9d5('0x3'))(_0xc9d5('0x4'));var rpc={'chatMessage':require(_0xc9d5('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc9d5('0x6')),'smsMessage':require(_0xc9d5('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc9d5('0x8'))};exports[_0xc9d5('0x9')]=function(_0x1a91f5,_0x955d2d){return function(_0x2edfbc){try{if(!_[_0xc9d5('0xa')](this[_0xc9d5('0xb')][_0xc9d5('0xc')])){logger[_0xc9d5('0xd')](_0xc9d5('0xe'),_0x1a91f5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2edfbc['next']();}var _0x53816b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc9d5('0xf')](_0xc9d5('0x10')),'direction':_0xc9d5('0x11')};if(this[_0xc9d5('0x12')]===_0xc9d5('0x13')||this[_0xc9d5('0x12')]===_0xc9d5('0x14')){_0x53816b['phone']=this['interaction']['phone'];}var _0x2c40c2=this[_0xc9d5('0x12')];if(_0x2c40c2===_0xc9d5('0x15')){_0x53816b[_0xc9d5('0x16')]=this['account']['id'];}else{_0x53816b[_[_0xc9d5('0x17')](_0x2c40c2)+_0xc9d5('0x18')]=this['account']['id'];}_0x53816b[_[_0xc9d5('0x17')](_0x2c40c2)+_0xc9d5('0x19')]=this['interaction']['id'];if(this['interaction'][_0xc9d5('0x1a')]){var _0x7d5471=_0x955d2d[0x2];if(!_[_0xc9d5('0x1b')](_0x7d5471)){_0x53816b['body']=utils[_0xc9d5('0x1c')](_0x7d5471,this);return rpc[_0x2c40c2+'Message'][_0xc9d5('0x1d')](_0x53816b)[_0xc9d5('0x1e')](function(_0x3105d2){logger[_0xc9d5('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x1a91f5,_0x53816b[_0xc9d5('0x1f')]);})['catch'](function(_0x4431d2){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x4431d2));})['finally'](function(){logger[_0xc9d5('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1a91f5);_0x2edfbc['stop']();});}else{logger[_0xc9d5('0xd')](_0xc9d5('0x22'),_0x1a91f5);_0x2edfbc[_0xc9d5('0x23')]();}}else{var _0x7ce117=this;var _0x1447c9=apiai(_0x955d2d[0x0],{'language':_0x955d2d[0x1]||'en'});return _0x1447c9['textRequest'](this['message'][_0xc9d5('0x1f')],{'sessionId':md5(this[_0xc9d5('0xb')]['id'])})[_0xc9d5('0x1e')](function(_0x1424c9){_0x7ce117[_0xc9d5('0x1f')][_0xc9d5('0x24')]=_0x1424c9;_0x53816b[_0xc9d5('0x1f')]=_0x1424c9[_0xc9d5('0x25')][_0xc9d5('0x26')][_0xc9d5('0x27')];_0x53816b['providerName']=_0xc9d5('0x24');_0x53816b[_0xc9d5('0x28')]=JSON[_0xc9d5('0x21')](_0x1424c9);return rpc[_0x2c40c2+_0xc9d5('0x29')][_0xc9d5('0x1d')](_0x53816b)[_0xc9d5('0x1e')](function(_0x41a5d7){logger['info'](_0xc9d5('0xe'),_0x1a91f5,_0x53816b[_0xc9d5('0x1f')]);if(_0x1424c9['result'][_0xc9d5('0x2a')][_0xc9d5('0x2b')]){_0x2edfbc[_0xc9d5('0x2c')]();}else{_0x2edfbc[_0xc9d5('0x23')]();}})[_0xc9d5('0x2d')](function(_0x3ab4bc){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x3ab4bc));_0x2edfbc['next']();});})[_0xc9d5('0x2d')](function(_0x41d217){logger[_0xc9d5('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x1a91f5,_0x41d217['message']);_0x2edfbc['next']();});}}catch(_0x58991f){logger[_0xc9d5('0x20')](_0xc9d5('0xe'),_0x1a91f5,JSON[_0xc9d5('0x21')](_0x58991f));_0x2edfbc[_0xc9d5('0x23')]();}};}; \ No newline at end of file +var _0x4da5=['interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','Message','create','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','stringify','message','next','moment','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x4da5,0x1b7));var _0x54da=function(_0x4cc80c,_0x498c36){_0x4cc80c=_0x4cc80c-0x0;var _0x380d35=_0x4da5[_0x4cc80c];return _0x380d35;};'use strict';var _=require('lodash');var moment=require(_0x54da('0x0'));var apiai=require(_0x54da('0x1'));var md5=require(_0x54da('0x2'));var utils=require('./utils');var logger=require(_0x54da('0x3'))('routing');var rpc={'chatMessage':require(_0x54da('0x4')),'openchannelMessage':require(_0x54da('0x5')),'mailMessage':require(_0x54da('0x6')),'smsMessage':require(_0x54da('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x54da('0x8'))};exports[_0x54da('0x9')]=function(_0x259062,_0x1b2b5c){return function(_0x2fe7cc){try{if(!_[_0x54da('0xa')](this[_0x54da('0xb')]['UserId'])){logger[_0x54da('0xc')](_0x54da('0xd'),_0x259062,_0x54da('0xe'));return _0x2fe7cc['next']();}var _0x270a06={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x54da('0xf')),'direction':_0x54da('0x10')};if(this[_0x54da('0x11')]===_0x54da('0x12')||this[_0x54da('0x11')]===_0x54da('0x13')){_0x270a06[_0x54da('0x14')]=this[_0x54da('0xb')][_0x54da('0x14')];}var _0x1ff5fc=this[_0x54da('0x11')];if(_0x1ff5fc===_0x54da('0x15')){_0x270a06[_0x54da('0x16')]=this['account']['id'];}else{_0x270a06[_[_0x54da('0x17')](_0x1ff5fc)+_0x54da('0x18')]=this[_0x54da('0x19')]['id'];}_0x270a06[_[_0x54da('0x17')](_0x1ff5fc)+'InteractionId']=this[_0x54da('0xb')]['id'];if(this[_0x54da('0xb')][_0x54da('0x1a')]){var _0x25261c=_0x1b2b5c[0x2];if(!_[_0x54da('0x1b')](_0x25261c)){_0x270a06[_0x54da('0x1c')]=utils['getMustacheRender'](_0x25261c,this);return rpc[_0x1ff5fc+_0x54da('0x1d')][_0x54da('0x1e')](_0x270a06)['then'](function(_0x2cad22){logger[_0x54da('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x259062,_0x270a06['body']);})[_0x54da('0x1f')](function(_0x5d9ba2){logger[_0x54da('0x20')](_0x54da('0xd'),_0x259062,JSON['stringify'](_0x5d9ba2));})[_0x54da('0x21')](function(){logger[_0x54da('0xc')](_0x54da('0x22'),_0x259062);_0x2fe7cc[_0x54da('0x23')]();});}else{logger[_0x54da('0xc')](_0x54da('0x24'),_0x259062);_0x2fe7cc[_0x54da('0x23')]();}}else{var _0x415598=this;var _0x340d26=apiai(_0x1b2b5c[0x0],{'language':_0x1b2b5c[0x1]||'en'});return _0x340d26[_0x54da('0x25')](this['message'][_0x54da('0x1c')],{'sessionId':md5(this[_0x54da('0xb')]['id'])})[_0x54da('0x26')](function(_0x3d062b){_0x415598[_0x54da('0x1c')][_0x54da('0x27')]=_0x3d062b;_0x270a06['body']=_0x3d062b[_0x54da('0x28')][_0x54da('0x29')][_0x54da('0x2a')];_0x270a06[_0x54da('0x2b')]=_0x54da('0x27');_0x270a06[_0x54da('0x2c')]=JSON['stringify'](_0x3d062b);return rpc[_0x1ff5fc+_0x54da('0x1d')]['create'](_0x270a06)[_0x54da('0x26')](function(_0x39c306){logger[_0x54da('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x259062,_0x270a06['body']);if(_0x3d062b[_0x54da('0x28')][_0x54da('0x2d')][_0x54da('0x2e')]){_0x2fe7cc['next']();}else{_0x2fe7cc[_0x54da('0x23')]();}})[_0x54da('0x1f')](function(_0x56942a){logger[_0x54da('0x20')](_0x54da('0xd'),_0x259062,JSON[_0x54da('0x2f')](_0x56942a));_0x2fe7cc['next']();});})['catch'](function(_0x21784e){logger['error'](_0x54da('0xd'),_0x259062,_0x21784e[_0x54da('0x30')]);_0x2fe7cc[_0x54da('0x31')]();});}}catch(_0x23b48e){logger[_0x54da('0x20')](_0x54da('0xd'),_0x259062,JSON[_0x54da('0x2f')](_0x23b48e));_0x2fe7cc[_0x54da('0x23')]();}};}; \ 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 af578ec..0d8d94e 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 _0x5d46=['interaction','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','then','catch','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','message','detectIntent','dialogflowV2','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','queryResult','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','length','fulfillmentText','push','all','next','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','sms','whatsapp','phone'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0x5d46,0x10c));var _0x65d4=function(_0x194db3,_0x103c6c){_0x194db3=_0x194db3-0x0;var _0x4e7a5b=_0x5d46[_0x194db3];return _0x4e7a5b;};'use strict';var _=require(_0x65d4('0x0'));var dialogflow=require(_0x65d4('0x1'));var md5=require(_0x65d4('0x2'));var moment=require('moment');var Promise=require(_0x65d4('0x3'));var logger=require(_0x65d4('0x4'))(_0x65d4('0x5'));var utils=require(_0x65d4('0x6'));var rpc={'chatMessage':require(_0x65d4('0x7')),'openchannelMessage':require(_0x65d4('0x8')),'mailMessage':require(_0x65d4('0x9')),'smsMessage':require(_0x65d4('0xa')),'faxMessage':require(_0x65d4('0xb')),'whatsappMessage':require(_0x65d4('0xc'))};function createMessage(_0x1469f3,_0x49d698,_0x4ae100,_0x159c8f){return new Promise(function(_0x48c50e,_0x250640){var _0x5c5e3a=_[_0x65d4('0xd')](_0x4ae100);_0x5c5e3a[_0x65d4('0xe')]=_0x159c8f;return rpc[_0x49d698+_0x65d4('0xf')][_0x65d4('0x10')](_0x5c5e3a)['then'](function(){logger[_0x65d4('0x11')](_0x65d4('0x12'),_0x1469f3,_0x5c5e3a['body']);_0x48c50e();})['catch'](function(_0x59aac6){logger[_0x65d4('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x1469f3,JSON[_0x65d4('0x14')](_0x59aac6));_0x250640(_0x59aac6);});});}exports[_0x65d4('0x15')]=function(_0x32a053,_0x2d531f){return function(_0x37d984){try{if(!_[_0x65d4('0x16')](this['interaction'][_0x65d4('0x17')])){logger['info'](_0x65d4('0x12'),_0x32a053,_0x65d4('0x18'));return _0x37d984['next']();}var _0x5ec7a5={'ContactId':this[_0x65d4('0x19')]['id'],'sentAt':moment()[_0x65d4('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x65d4('0x1b')};if(this[_0x65d4('0x1c')]===_0x65d4('0x1d')||this[_0x65d4('0x1c')]===_0x65d4('0x1e')){_0x5ec7a5[_0x65d4('0x1f')]=this[_0x65d4('0x20')]['phone'];}var _0x107cce=this[_0x65d4('0x1c')];if(_0x107cce===_0x65d4('0x21')){_0x5ec7a5['ChatWebsiteId']=this[_0x65d4('0x22')]['id'];}else{_0x5ec7a5[_[_0x65d4('0x23')](_0x107cce)+_0x65d4('0x24')]=this[_0x65d4('0x22')]['id'];}_0x5ec7a5[_[_0x65d4('0x23')](_0x107cce)+_0x65d4('0x25')]=this[_0x65d4('0x20')]['id'];if(this[_0x65d4('0x20')][_0x65d4('0x26')]){var _0x304638=_0x2d531f[0x4];if(!_[_0x65d4('0x27')](_0x304638)){_0x5ec7a5[_0x65d4('0xe')]=utils[_0x65d4('0x28')](_0x304638,this);return rpc[_0x107cce+'Message'][_0x65d4('0x10')](_0x5ec7a5)[_0x65d4('0x29')](function(_0x3509eb){logger['info'](_0x65d4('0x12'),_0x32a053,_0x5ec7a5['body']);})[_0x65d4('0x2a')](function(_0x11c100){logger[_0x65d4('0x13')](_0x65d4('0x12'),_0x32a053,JSON[_0x65d4('0x14')](_0x11c100));})['finally'](function(){logger[_0x65d4('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x32a053);_0x37d984[_0x65d4('0x2b')]();});}else{logger['info'](_0x65d4('0x2c'),_0x32a053);_0x37d984[_0x65d4('0x2b')]();}}else{var _0x5a8fbf=this;var _0x7a730f=_0x2d531f[0x2]['replace'](/\\n/g,'\x0a');var _0x9d2c5e={'credentials':{'private_key':_0x7a730f,'client_email':_0x2d531f[0x1]}};var _0x15662d=new dialogflow['SessionsClient'](_0x9d2c5e);var _0x114853=_0x15662d[_0x65d4('0x2d')](_0x2d531f[0x0],md5(_0x5a8fbf[_0x65d4('0x20')]['id']));var _0x3f6542={'session':_0x114853,'queryInput':{'text':{'text':_0x5a8fbf[_0x65d4('0x2e')][_0x65d4('0xe')],'languageCode':_0x2d531f[0x3]||'en'}}};return _0x15662d[_0x65d4('0x2f')](_0x3f6542)['then'](function(_0x43988d){if(_0x43988d&&_0x43988d['length']){_0x5a8fbf[_0x65d4('0xe')][_0x65d4('0x30')]=_0x43988d;var _0x2c3576=_0x43988d[0x0];var _0x49bf6d=_0x2c3576['queryResult'][_0x65d4('0x31')]&&_0x2c3576['queryResult'][_0x65d4('0x31')][_0x65d4('0x32')]?_0x2c3576['queryResult']['diagnosticInfo'][_0x65d4('0x32')][_0x65d4('0x33')]['boolValue']:![];_0x5a8fbf[_0x65d4('0xe')][_0x65d4('0x34')]=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x36')];_0x5a8fbf[_0x65d4('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x37')];_0x5a8fbf[_0x65d4('0xe')][_0x65d4('0x38')]=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x31')]&&_0x2c3576[_0x65d4('0x35')][_0x65d4('0x31')][_0x65d4('0x32')]?_0x2c3576[_0x65d4('0x35')][_0x65d4('0x31')][_0x65d4('0x32')][_0x65d4('0x33')][_0x65d4('0x39')]:![];_0x5a8fbf['body']['DIALOGFLOWV2_INTENTNAME']=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x3a')][_0x65d4('0x3b')];_0x5a8fbf[_0x65d4('0xe')][_0x65d4('0x3c')]=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x3a')][_0x65d4('0x3d')];_0x5a8fbf[_0x65d4('0xe')][_0x65d4('0x3e')]=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x3a')][_0x65d4('0x3f')];_0x5a8fbf[_0x65d4('0xe')][_0x65d4('0x40')]=_0x2c3576['queryResult']['languageCode'];_0x5a8fbf['body']['DIALOGFLOWV2_QUERYTEXT']=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x41')];_0x5a8fbf[_0x65d4('0xe')][_0x65d4('0x42')]=_0x2c3576[_0x65d4('0x35')][_0x65d4('0x43')];_0x5ec7a5['providerName']='dialogflowV2';_0x5ec7a5[_0x65d4('0x44')]=JSON[_0x65d4('0x14')](_0x43988d);var _0x55e5e6=[];for(var _0xd55cf4=0x0;_0xd55cf4<_0x43988d[_0x65d4('0x45')];_0xd55cf4++){var _0x1d026a=_0x43988d[_0xd55cf4];if(_0x1d026a&&_0x1d026a[_0x65d4('0x35')]&&_0x1d026a[_0x65d4('0x35')][_0x65d4('0x46')]){_0x55e5e6[_0x65d4('0x47')](createMessage(_0x32a053,_0x107cce,_0x5ec7a5,_0x1d026a[_0x65d4('0x35')][_0x65d4('0x46')]));}}return Promise[_0x65d4('0x48')](_0x55e5e6)[_0x65d4('0x29')](function(){if(_0x49bf6d){_0x37d984[_0x65d4('0x49')]();}else{_0x37d984[_0x65d4('0x2b')]();}})[_0x65d4('0x2a')](function(_0x91ae26){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x32a053,JSON['stringify'](_0x91ae26));_0x37d984['next']();});}})[_0x65d4('0x2a')](function(_0x588847){logger[_0x65d4('0x13')](_0x65d4('0x12'),_0x32a053,_0x588847['message'],_0x588847[_0x65d4('0x4a')]);_0x37d984[_0x65d4('0x49')]();});}}catch(_0x5bf7d9){logger[_0x65d4('0x13')](_0x65d4('0x12'),_0x32a053,JSON[_0x65d4('0x14')](_0x5bf7d9));_0x37d984[_0x65d4('0x2b')]();}};}; \ No newline at end of file +var _0x8110=['create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','isNil','interaction','UserId','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','upperFirst','getMustacheRender','Message','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','sessionPath','message','queryResult','diagnosticInfo','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','providerResponse','length','fulfillmentText','push','all','next','catch','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','./utils','../../rpc/mailMessage','../../rpc/smsMessage','clone','body'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x8110,0xaa));var _0x0811=function(_0x3aef76,_0x4012b0){_0x3aef76=_0x3aef76-0x0;var _0x489208=_0x8110[_0x3aef76];return _0x489208;};'use strict';var _=require(_0x0811('0x0'));var dialogflow=require(_0x0811('0x1'));var md5=require(_0x0811('0x2'));var moment=require('moment');var Promise=require(_0x0811('0x3'));var logger=require(_0x0811('0x4'))('routing');var utils=require(_0x0811('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0811('0x6')),'smsMessage':require(_0x0811('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1781de,_0xe65f88,_0x4868c4,_0x537fe9){return new Promise(function(_0x11736d,_0x33293f){var _0x1cddd6=_[_0x0811('0x8')](_0x4868c4);_0x1cddd6[_0x0811('0x9')]=_0x537fe9;return rpc[_0xe65f88+'Message'][_0x0811('0xa')](_0x1cddd6)[_0x0811('0xb')](function(){logger[_0x0811('0xc')](_0x0811('0xd'),_0x1781de,_0x1cddd6['body']);_0x11736d();})['catch'](function(_0x16e5ab){logger[_0x0811('0xe')](_0x0811('0xd'),_0x1781de,JSON[_0x0811('0xf')](_0x16e5ab));_0x33293f(_0x16e5ab);});});}exports['consequence']=function(_0x4000b1,_0x5ba333){return function(_0x5367c1){try{if(!_[_0x0811('0x10')](this[_0x0811('0x11')][_0x0811('0x12')])){logger[_0x0811('0xc')](_0x0811('0xd'),_0x4000b1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5367c1['next']();}var _0x2e4722={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0811('0x13')](_0x0811('0x14')),'direction':'out'};if(this[_0x0811('0x15')]==='sms'||this[_0x0811('0x15')]==='whatsapp'){_0x2e4722[_0x0811('0x16')]=this[_0x0811('0x11')][_0x0811('0x16')];}var _0x4aaeb8=this[_0x0811('0x15')];if(_0x4aaeb8===_0x0811('0x17')){_0x2e4722[_0x0811('0x18')]=this['account']['id'];}else{_0x2e4722[_[_0x0811('0x19')](_0x4aaeb8)+'AccountId']=this['account']['id'];}_0x2e4722[_[_0x0811('0x19')](_0x4aaeb8)+'InteractionId']=this['interaction']['id'];if(this[_0x0811('0x11')]['created']){var _0x3fa08a=_0x5ba333[0x4];if(!_['isEmpty'](_0x3fa08a)){_0x2e4722[_0x0811('0x9')]=utils[_0x0811('0x1a')](_0x3fa08a,this);return rpc[_0x4aaeb8+_0x0811('0x1b')][_0x0811('0xa')](_0x2e4722)[_0x0811('0xb')](function(_0x9201c5){logger[_0x0811('0xc')](_0x0811('0xd'),_0x4000b1,_0x2e4722[_0x0811('0x9')]);})['catch'](function(_0x5e1861){logger['error'](_0x0811('0xd'),_0x4000b1,JSON[_0x0811('0xf')](_0x5e1861));})['finally'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4000b1);_0x5367c1['stop']();});}else{logger[_0x0811('0xc')](_0x0811('0x1c'),_0x4000b1);_0x5367c1[_0x0811('0x1d')]();}}else{var _0x1b64b0=this;var _0x23618a=_0x5ba333[0x2][_0x0811('0x1e')](/\\n/g,'\x0a');var _0x5b9d26={'credentials':{'private_key':_0x23618a,'client_email':_0x5ba333[0x1]}};var _0x5aa8bc=new dialogflow['SessionsClient'](_0x5b9d26);var _0x5c54f9=_0x5aa8bc[_0x0811('0x1f')](_0x5ba333[0x0],md5(_0x1b64b0['interaction']['id']));var _0x56fb7b={'session':_0x5c54f9,'queryInput':{'text':{'text':_0x1b64b0[_0x0811('0x20')][_0x0811('0x9')],'languageCode':_0x5ba333[0x3]||'en'}}};return _0x5aa8bc['detectIntent'](_0x56fb7b)[_0x0811('0xb')](function(_0xecf7db){if(_0xecf7db&&_0xecf7db['length']){_0x1b64b0[_0x0811('0x9')]['dialogflowV2']=_0xecf7db;var _0x15c8da=_0xecf7db[0x0];var _0x5a1442=_0x15c8da[_0x0811('0x21')][_0x0811('0x22')]&&_0x15c8da['queryResult'][_0x0811('0x22')]['fields']?_0x15c8da['queryResult'][_0x0811('0x22')]['fields']['end_conversation'][_0x0811('0x23')]:![];_0x1b64b0[_0x0811('0x9')]['DIALOGFLOWV2_ACTION']=_0x15c8da['queryResult']['action'];_0x1b64b0[_0x0811('0x9')][_0x0811('0x24')]=_0x15c8da[_0x0811('0x21')][_0x0811('0x25')];_0x1b64b0['body'][_0x0811('0x26')]=_0x15c8da['queryResult'][_0x0811('0x22')]&&_0x15c8da[_0x0811('0x21')][_0x0811('0x22')][_0x0811('0x27')]?_0x15c8da[_0x0811('0x21')][_0x0811('0x22')][_0x0811('0x27')]['end_conversation'][_0x0811('0x23')]:![];_0x1b64b0[_0x0811('0x9')][_0x0811('0x28')]=_0x15c8da[_0x0811('0x21')]['intent'][_0x0811('0x29')];_0x1b64b0[_0x0811('0x9')][_0x0811('0x2a')]=_0x15c8da[_0x0811('0x21')][_0x0811('0x2b')][_0x0811('0x2c')];_0x1b64b0[_0x0811('0x9')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x15c8da['queryResult'][_0x0811('0x2b')][_0x0811('0x2d')];_0x1b64b0[_0x0811('0x9')][_0x0811('0x2e')]=_0x15c8da[_0x0811('0x21')][_0x0811('0x2f')];_0x1b64b0[_0x0811('0x9')]['DIALOGFLOWV2_QUERYTEXT']=_0x15c8da[_0x0811('0x21')][_0x0811('0x30')];_0x1b64b0[_0x0811('0x9')][_0x0811('0x31')]=_0x15c8da[_0x0811('0x21')]['intentDetectionConfidence'];_0x2e4722[_0x0811('0x32')]=_0x0811('0x33');_0x2e4722[_0x0811('0x34')]=JSON[_0x0811('0xf')](_0xecf7db);var _0x1a9cea=[];for(var _0x41c961=0x0;_0x41c961<_0xecf7db[_0x0811('0x35')];_0x41c961++){var _0x4f81ca=_0xecf7db[_0x41c961];if(_0x4f81ca&&_0x4f81ca[_0x0811('0x21')]&&_0x4f81ca[_0x0811('0x21')][_0x0811('0x36')]){_0x1a9cea[_0x0811('0x37')](createMessage(_0x4000b1,_0x4aaeb8,_0x2e4722,_0x4f81ca['queryResult'][_0x0811('0x36')]));}}return Promise[_0x0811('0x38')](_0x1a9cea)[_0x0811('0xb')](function(){if(_0x5a1442){_0x5367c1['next']();}else{_0x5367c1[_0x0811('0x1d')]();}})['catch'](function(_0x14d90f){logger['error'](_0x0811('0xd'),_0x4000b1,JSON[_0x0811('0xf')](_0x14d90f));_0x5367c1[_0x0811('0x39')]();});}})[_0x0811('0x3a')](function(_0x4ecf12){logger[_0x0811('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x4000b1,_0x4ecf12[_0x0811('0x20')],_0x4ecf12[_0x0811('0x3b')]);_0x5367c1[_0x0811('0x39')]();});}}catch(_0x410a2d){logger[_0x0811('0xe')](_0x0811('0xd'),_0x4000b1,JSON[_0x0811('0xf')](_0x410a2d));_0x5367c1[_0x0811('0x1d')]();}};}; \ 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 d8eaf39..053eac1 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 _0xda91=['[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error'];(function(_0x2cebbe,_0x963f13){var _0x4fb79a=function(_0x22adfc){while(--_0x22adfc){_0x2cebbe['push'](_0x2cebbe['shift']());}};_0x4fb79a(++_0x963f13);}(_0xda91,0x72));var _0x1da9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xda91[_0x502c7d];return _0x30b7ed;};'use strict';var schema=require(_0x1da9('0x0'));var _=require('lodash');var htmlToText=require(_0x1da9('0x1'));var utils=require(_0x1da9('0x2'));var logger=require(_0x1da9('0x3'))(_0x1da9('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x1da9('0x5'),'message':_0x1da9('0x6')},'priorityFalse':{'type':_0x1da9('0x5'),'message':_0x1da9('0x7')}});exports[_0x1da9('0x8')]=function(_0x435d64,_0x1b135f){return function(_0x54a413){try{var _0x5053a9={'condition':htmlToText[_0x1da9('0x9')](utils['getMustacheRender'](_0x1b135f[0x0],this),{'wordwrap':![]})[_0x1da9('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1b135f[0x1],'priorityFalse':_0x1b135f[0x2]};var _0x11ecd7=gotoif['validate'](_0x5053a9,{'typecast':!![]});if(_0x11ecd7[_0x1da9('0xb')]){logger['error']('[%s][GOTOIF]\x20%s',_0x435d64,_[_0x1da9('0xc')](_0x11ecd7,_0x1da9('0xd'))[_0x1da9('0xe')](',\x20'));_0x54a413[_0x1da9('0xf')]();}else{try{var _0x812fe3=eval('('+_0x5053a9[_0x1da9('0x10')]+')');var _0x4ac870=_0x812fe3?_0x5053a9[_0x1da9('0x11')]:_0x5053a9[_0x1da9('0x12')];logger[_0x1da9('0x13')](_0x1da9('0x14'),_0x435d64,_0x5053a9[_0x1da9('0x10')],_0x812fe3,_0x4ac870||_0x1da9('0x15'));if(_0x4ac870){var _0x10cf93=_['findIndex'](_0x54a413[_0x1da9('0x16')](),{'p':_0x4ac870});if(_0x10cf93>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x435d64,_0x4ac870||'next',_0x10cf93);_0x54a413['next'](_0x10cf93);}else{logger[_0x1da9('0x13')](_0x1da9('0x17'),_0x435d64,_0x4ac870||_0x1da9('0x15'));_0x54a413[_0x1da9('0xf')]();}}else{_0x54a413[_0x1da9('0x15')]();}}catch(_0x153467){logger['error'](_0x1da9('0x18'),_0x435d64,_0x153467[_0x1da9('0xd')]);_0x54a413[_0x1da9('0xf')]();}}}catch(_0x3d7985){logger[_0x1da9('0x19')](_0x1da9('0x1a'),_0x435d64,JSON[_0x1da9('0x1b')](_0x3d7985));_0x54a413[_0x1da9('0xf')]();}};}; \ No newline at end of file +var _0x2c57=['lodash','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','map','message','join','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20%s','stringify','validate'];(function(_0x19b69b,_0xc05aec){var _0x1e7b95=function(_0x35644f){while(--_0x35644f){_0x19b69b['push'](_0x19b69b['shift']());}};_0x1e7b95(++_0xc05aec);}(_0x2c57,0xfb));var _0x72c5=function(_0x4c5f2e,_0x1fb14d){_0x4c5f2e=_0x4c5f2e-0x0;var _0x2de143=_0x2c57[_0x4c5f2e];return _0x2de143;};'use strict';var schema=require(_0x72c5('0x0'));var _=require(_0x72c5('0x1'));var htmlToText=require(_0x72c5('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x72c5('0x3'));var gotoif=schema({'condition':{'type':_0x72c5('0x4'),'required':!![],'message':_0x72c5('0x5')},'priorityTrue':{'type':_0x72c5('0x6'),'message':_0x72c5('0x7')},'priorityFalse':{'type':_0x72c5('0x6'),'message':_0x72c5('0x8')}});exports[_0x72c5('0x9')]=function(_0xe59d03,_0x4f5c9e){return function(_0x79a2d4){try{var _0x3794ca={'condition':htmlToText[_0x72c5('0xa')](utils[_0x72c5('0xb')](_0x4f5c9e[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4f5c9e[0x1],'priorityFalse':_0x4f5c9e[0x2]};var _0x4699e4=gotoif[_0x72c5('0x0')](_0x3794ca,{'typecast':!![]});if(_0x4699e4[_0x72c5('0xc')]){logger[_0x72c5('0xd')]('[%s][GOTOIF]\x20%s',_0xe59d03,_[_0x72c5('0xe')](_0x4699e4,_0x72c5('0xf'))[_0x72c5('0x10')](',\x20'));_0x79a2d4['stop']();}else{try{var _0x418d6a=eval('('+_0x3794ca[_0x72c5('0x11')]+')');var _0x20cef6=_0x418d6a?_0x3794ca[_0x72c5('0x12')]:_0x3794ca['priorityFalse'];logger[_0x72c5('0x13')](_0x72c5('0x14'),_0xe59d03,_0x3794ca[_0x72c5('0x11')],_0x418d6a,_0x20cef6||_0x72c5('0x15'));if(_0x20cef6){var _0x50173b=_[_0x72c5('0x16')](_0x79a2d4[_0x72c5('0x17')](),{'p':_0x20cef6});if(_0x50173b>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xe59d03,_0x20cef6||_0x72c5('0x15'),_0x50173b);_0x79a2d4[_0x72c5('0x15')](_0x50173b);}else{logger[_0x72c5('0x13')](_0x72c5('0x18'),_0xe59d03,_0x20cef6||_0x72c5('0x15'));_0x79a2d4[_0x72c5('0x19')]();}}else{_0x79a2d4[_0x72c5('0x15')]();}}catch(_0x47e644){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0xe59d03,_0x47e644['message']);_0x79a2d4[_0x72c5('0x19')]();}}}catch(_0x3730d4){logger[_0x72c5('0xd')](_0x72c5('0x1a'),_0xe59d03,JSON[_0x72c5('0x1b')](_0x3730d4));_0x79a2d4[_0x72c5('0x19')]();}};}; \ 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 c05b02e..6311e30 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 _0xc988=['info','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','join','stop'];(function(_0x5aaf93,_0x5c0001){var _0x17d307=function(_0x21d77a){while(--_0x21d77a){_0x5aaf93['push'](_0x5aaf93['shift']());}};_0x17d307(++_0x5c0001);}(_0xc988,0x1d4));var _0x8c98=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xc988[_0x46d0c9];return _0x174506;};'use strict';var schema=require(_0x8c98('0x0'));var _=require('lodash');var logger=require(_0x8c98('0x1'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x8c98('0x2')}});exports['consequence']=function(_0x84342e,_0x4b596){return function(_0x28d33d){try{var _0x3b6f40={'priority':_0x4b596[0x0]};var _0x359407=gotop[_0x8c98('0x0')](_0x3b6f40,{'typecast':!![]});if(_0x359407[_0x8c98('0x3')]){logger[_0x8c98('0x4')](_0x8c98('0x5'),_0x84342e,_['map'](_0x359407,'message')[_0x8c98('0x6')](',\x20'));_0x28d33d[_0x8c98('0x7')]();}else{logger[_0x8c98('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x84342e,_0x3b6f40['priority']);if(_0x3b6f40[_0x8c98('0x9')]){var _0x4afbd5=_['findIndex'](_0x28d33d[_0x8c98('0xa')](),{'p':_0x3b6f40[_0x8c98('0x9')]});if(_0x4afbd5>=0x0){logger[_0x8c98('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x84342e,_0x3b6f40[_0x8c98('0x9')]||_0x8c98('0xb'),_0x4afbd5);_0x28d33d['next'](_0x4afbd5);}else{logger[_0x8c98('0x8')](_0x8c98('0xc'),_0x84342e,_0x3b6f40[_0x8c98('0x9')]||'next');_0x28d33d['stop']();}}else{_0x28d33d[_0x8c98('0xb')]();}}}catch(_0x22b0db){logger[_0x8c98('0x4')]('[%s][GOTOP]\x20%s',_0x84342e,JSON[_0x8c98('0xd')](_0x22b0db));_0x28d33d['stop']();}};}; \ No newline at end of file +var _0xd7fe=['map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','routing','consequence','length','error'];(function(_0x112919,_0x5d94a6){var _0x3b31e2=function(_0x5b2ac1){while(--_0x5b2ac1){_0x112919['push'](_0x112919['shift']());}};_0x3b31e2(++_0x5d94a6);}(_0xd7fe,0x82));var _0xed7f=function(_0x453bb4,_0x1bfec8){_0x453bb4=_0x453bb4-0x0;var _0x4fcf64=_0xd7fe[_0x453bb4];return _0x4fcf64;};'use strict';var schema=require(_0xed7f('0x0'));var _=require('lodash');var logger=require(_0xed7f('0x1'))(_0xed7f('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xed7f('0x3')]=function(_0x425940,_0x28b76a){return function(_0x2fc963){try{var _0x164674={'priority':_0x28b76a[0x0]};var _0x3afc96=gotop['validate'](_0x164674,{'typecast':!![]});if(_0x3afc96[_0xed7f('0x4')]){logger[_0xed7f('0x5')]('[%s][GOTOP]\x20%s',_0x425940,_[_0xed7f('0x6')](_0x3afc96,_0xed7f('0x7'))[_0xed7f('0x8')](',\x20'));_0x2fc963[_0xed7f('0x9')]();}else{logger[_0xed7f('0xa')](_0xed7f('0xb'),_0x425940,_0x164674[_0xed7f('0xc')]);if(_0x164674['priority']){var _0xf98f42=_['findIndex'](_0x2fc963['rules'](),{'p':_0x164674[_0xed7f('0xc')]});if(_0xf98f42>=0x0){logger[_0xed7f('0xa')](_0xed7f('0xd'),_0x425940,_0x164674['priority']||'next',_0xf98f42);_0x2fc963['next'](_0xf98f42);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x425940,_0x164674[_0xed7f('0xc')]||_0xed7f('0xe'));_0x2fc963['stop']();}}else{_0x2fc963[_0xed7f('0xe')]();}}}catch(_0x4d324d){logger[_0xed7f('0x5')](_0xed7f('0xf'),_0x425940,JSON[_0xed7f('0x10')](_0x4d324d));_0x2fc963[_0xed7f('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 3730f37..249d165 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 _0xa6ea=['Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xa6ea,0x122));var _0xaa6e=function(_0x459c7b,_0x1b4508){_0x459c7b=_0x459c7b-0x0;var _0x5e04f1=_0xa6ea[_0x459c7b];return _0x5e04f1;};'use strict';var _=require(_0xaa6e('0x0'));var utils=require(_0xaa6e('0x1'));var logger=require(_0xaa6e('0x2'))(_0xaa6e('0x3'));var rpc={'chatMessage':require(_0xaa6e('0x4')),'openchannelMessage':require(_0xaa6e('0x5')),'mailMessage':require(_0xaa6e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaa6e('0x7')),'whatsappMessage':require(_0xaa6e('0x8'))};exports[_0xaa6e('0x9')]=function(_0x37b6ee,_0xb01d1d){return function(_0x53d333){try{var _0x543fc1={'body':utils[_0xaa6e('0xa')](_0xb01d1d[0x0],this),'ContactId':this[_0xaa6e('0xb')]['id']};if(this[_0xaa6e('0xc')]===_0xaa6e('0xd')){_0x543fc1[_0xaa6e('0xe')]=this[_0xaa6e('0xf')]['id'];}else{_0x543fc1[_[_0xaa6e('0x10')](this['channel'])+_0xaa6e('0x11')]=this['account']['id'];}_0x543fc1[_['upperFirst'](this[_0xaa6e('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xaa6e('0xc')]+_0xaa6e('0x12')]){return rpc[this['channel']+_0xaa6e('0x12')]['create'](_0x543fc1)[_0xaa6e('0x13')](function(_0x234bc8){logger[_0xaa6e('0x14')](_0xaa6e('0x15'),_0x37b6ee,_0x543fc1[_0xaa6e('0x16')]);_0x53d333[_0xaa6e('0x17')]();})[_0xaa6e('0x18')](function(_0x1da120){logger[_0xaa6e('0x19')]('[%s][MESSAGE]\x20%s',_0x37b6ee,JSON[_0xaa6e('0x1a')](_0x1da120));_0x53d333[_0xaa6e('0x1b')]();});}}catch(_0x22b001){logger['error'](_0xaa6e('0x15'),_0x37b6ee,JSON[_0xaa6e('0x1a')](_0x22b001));_0x53d333[_0xaa6e('0x1b')]();}};}; \ No newline at end of file +var _0x7177=['AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x7177,0x101));var _0x7717=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x7177[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x7717('0x0'));var utils=require('./utils');var logger=require(_0x7717('0x1'))('routing');var rpc={'chatMessage':require(_0x7717('0x2')),'openchannelMessage':require(_0x7717('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7717('0x4')),'faxMessage':require(_0x7717('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7717('0x6')]=function(_0xb1b562,_0x40e3ec){return function(_0x20ca81){try{var _0xe3d36b={'body':utils[_0x7717('0x7')](_0x40e3ec[0x0],this),'ContactId':this[_0x7717('0x8')]['id']};if(this[_0x7717('0x9')]===_0x7717('0xa')){_0xe3d36b[_0x7717('0xb')]=this[_0x7717('0xc')]['id'];}else{_0xe3d36b[_['upperFirst'](this[_0x7717('0x9')])+_0x7717('0xd')]=this['account']['id'];}_0xe3d36b[_[_0x7717('0xe')](this['channel'])+_0x7717('0xf')]=this[_0x7717('0x10')]['id'];if(rpc[this[_0x7717('0x9')]+_0x7717('0x11')]){return rpc[this[_0x7717('0x9')]+'Message'][_0x7717('0x12')](_0xe3d36b)[_0x7717('0x13')](function(_0x24da26){logger[_0x7717('0x14')](_0x7717('0x15'),_0xb1b562,_0xe3d36b[_0x7717('0x16')]);_0x20ca81[_0x7717('0x17')]();})['catch'](function(_0xcb6d5c){logger[_0x7717('0x18')](_0x7717('0x15'),_0xb1b562,JSON[_0x7717('0x19')](_0xcb6d5c));_0x20ca81[_0x7717('0x1a')]();});}}catch(_0x782bd0){logger[_0x7717('0x18')]('[%s][MESSAGE]\x20%s',_0xb1b562,JSON['stringify'](_0x782bd0));_0x20ca81[_0x7717('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 83a6048..3debf9e 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 _0xcacd=['info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','routing','consequence'];(function(_0x4a5948,_0x419e87){var _0x406499=function(_0x4dcb00){while(--_0x4dcb00){_0x4a5948['push'](_0x4a5948['shift']());}};_0x406499(++_0x419e87);}(_0xcacd,0x1f1));var _0xdcac=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcacd[_0x167cc1];return _0x10bc4b;};'use strict';var utils=require('./utils');var logger=require(_0xdcac('0x0'))(_0xdcac('0x1'));exports[_0xdcac('0x2')]=function(_0x17e19f,_0x514d71){return function(_0x1d75fc){try{logger[_0xdcac('0x3')]('[%s][NOOP]\x20%s',_0x17e19f,utils[_0xdcac('0x4')](_0x514d71[0x0],this));_0x1d75fc[_0xdcac('0x5')]();}catch(_0x24833e){logger[_0xdcac('0x6')](_0xdcac('0x7'),_0x17e19f,JSON[_0xdcac('0x8')](_0x24833e));_0x1d75fc[_0xdcac('0x9')]();}};}; \ No newline at end of file +var _0xb4b9=['info','next','error','stringify','stop','routing','consequence'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb4b9,0x1da));var _0x9b4b=function(_0x4786cb,_0x5ba08d){_0x4786cb=_0x4786cb-0x0;var _0x1c5180=_0xb4b9[_0x4786cb];return _0x1c5180;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x9b4b('0x0'));exports[_0x9b4b('0x1')]=function(_0x32ee42,_0x5ea278){return function(_0x1bc9f4){try{logger[_0x9b4b('0x2')]('[%s][NOOP]\x20%s',_0x32ee42,utils['getMustacheRender'](_0x5ea278[0x0],this));_0x1bc9f4[_0x9b4b('0x3')]();}catch(_0x44f26b){logger[_0x9b4b('0x4')]('[%s][NOOP]\x20%s',_0x32ee42,JSON[_0x9b4b('0x5')](_0x44f26b));_0x1bc9f4[_0x9b4b('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 79d37ea..044b30b 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 _0xd509=['contact','list','channel','interaction','MessageId','upperFirst','chat','AccountId','WebsiteId','name','message','QueueReport','create','error','YYYY-MM-DD\x20HH:mm:ss','info','Interaction','update','then','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','stop','Queues','timeout','createQueue','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x26667a,_0x69076e){var _0x1d2d3b=function(_0x3c80b7){while(--_0x3c80b7){_0x26667a['push'](_0x26667a['shift']());}};_0x1d2d3b(++_0x69076e);}(_0xd509,0x80));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require(_0x9d50('0x0'));var util=require(_0x9d50('0x1'));var seqqueue=require(_0x9d50('0x2'));var moment=require(_0x9d50('0x3'));var Redis=require('ioredis');var config=require(_0x9d50('0x4'));var logger=require(_0x9d50('0x5'))('routing');var strategy=require(_0x9d50('0x6'));config['redis']=_[_0x9d50('0x7')](config[_0x9d50('0x8')],{'host':_0x9d50('0x9'),'port':0x18eb});var io=require(_0x9d50('0xa'))(new Redis(config[_0x9d50('0x8')]));var attributes=['id',_0x9d50('0xb'),_0x9d50('0xc'),_0x9d50('0xd'),_0x9d50('0xe'),_0x9d50('0xf')];function emit(_0x2ee6c0,_0x2e6bc6,_0x3fe9ac){io['to'](_0x2ee6c0)[_0x9d50('0x10')](_0x2e6bc6,_0x3fe9ac);}function emitChannelQueueInteraction(_0xb98262,_0x436990,_0x3b7b01,_0xf7c670,_0x57167a,_0x2f2818,_0x49ebe4,_0x32e7af){var _0x569965=_[_0x9d50('0x11')](_0x3b7b01);_0x569965[_0x9d50('0xb')]=_0x32e7af;_0x569965[_0x9d50('0xd')]=_0x436990;_0x569965['account']=_0xf7c670;_0x569965['id']=_0x57167a;if(_0x2f2818){attributes[_0x9d50('0x12')](_[_0x9d50('0x13')](_0xb98262)+_0x9d50('0x14'));_0x49ebe4[util[_0x9d50('0x15')](_0x9d50('0x16'),_0xb98262)][_0x57167a]=_[_0x9d50('0x17')](_0x569965,attributes);}else{delete _0x49ebe4[util[_0x9d50('0x15')](_0x9d50('0x16'),_0xb98262)][_0x57167a];}emit(util[_0x9d50('0x15')]('%s:queue:%s',_0xb98262,_0x436990),util['format'](_0x9d50('0x18'),_0xb98262,_0x2f2818?_0x9d50('0x19'):_0x9d50('0x1a')),_[_0x9d50('0x17')](_0x569965,attributes));}var rpc={'openchannelQueueReport':require(_0x9d50('0x1b')),'mailQueueReport':require(_0x9d50('0x1c')),'chatQueueReport':require(_0x9d50('0x1d')),'smsQueueReport':require(_0x9d50('0x1e')),'faxQueueReport':require(_0x9d50('0x1f')),'whatsappQueueReport':require(_0x9d50('0x20')),'chatInteraction':require(_0x9d50('0x21')),'faxInteraction':require(_0x9d50('0x22')),'mailInteraction':require(_0x9d50('0x23')),'openchannelInteraction':require(_0x9d50('0x24')),'smsInteraction':require(_0x9d50('0x25')),'whatsappInteraction':require(_0x9d50('0x26'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x9d50('0x27')},'timeout':{'type':_0x9d50('0x28'),'message':_0x9d50('0x29')}});function startRouting(_0x3d176b,_0x35f61e,_0x3521b8,_0x46070d){if(_0x3d176b&&_0x35f61e&&_0x3521b8){_0x35f61e[_0x9d50('0x2a')]+=0x1;var _0xb96a4f={'uniqueid':_0x3d176b,'from':_0x3521b8[_0x9d50('0x2b')]?_0x3521b8[_0x9d50('0x2b')][_0x9d50('0xe')]:'','joinAt':moment()[_0x9d50('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3521b8[_0x9d50('0x2c')]?_0x3521b8[_0x9d50('0x2c')]['id']:null,'ListId':_0x3521b8[_0x9d50('0x2d')]?_0x3521b8[_0x9d50('0x2d')]['id']:null};_0xb96a4f[_['upperFirst'](_0x3521b8[_0x9d50('0x2e')])+'QueueId']=_0x35f61e['id']||null;_0xb96a4f[_['upperFirst'](_0x3521b8[_0x9d50('0x2e')])+_0x9d50('0x14')]=_0x3521b8[_0x9d50('0x2f')]?_0x3521b8[_0x9d50('0x2f')]['id']:null;_0xb96a4f[_['upperFirst'](_0x3521b8[_0x9d50('0x2e')])+_0x9d50('0x30')]=_0x3521b8['message']?_0x3521b8['message']['id']:null;_0xb96a4f[_[_0x9d50('0x31')](_0x3521b8[_0x9d50('0x2e')])+(_0x3521b8[_0x9d50('0x2e')]!==_0x9d50('0x32')?_0x9d50('0x33'):_0x9d50('0x34'))]=_0x3521b8[_0x9d50('0xc')]?_0x3521b8[_0x9d50('0xc')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x3d176b,_0x35f61e[_0x9d50('0x35')]));emitChannelQueueInteraction(_0x3521b8['channel'],_0x35f61e['name'],_0xb96a4f,_0x3521b8[_0x9d50('0xc')]['name'],_0x3521b8[_0x9d50('0x36')]['id'],!![],_0x46070d,_0x35f61e['id']);if(rpc[_0x3521b8[_0x9d50('0x2e')]+'QueueReport']){return rpc[_0x3521b8[_0x9d50('0x2e')]+_0x9d50('0x37')][_0x9d50('0x38')](_0xb96a4f)['catch'](function(_0x2103e3){logger[_0x9d50('0x39')]('create\x20queue\x20report',_0x2103e3);});}}}function stopRouting(_0x3d3c88,_0x3ebeae,_0x17a965,_0x212013){if(_0x3d3c88&&_0x3ebeae){_0x3ebeae[_0x9d50('0x2a')]-=0x1;var _0x172597={'leaveAt':moment()[_0x9d50('0x15')](_0x9d50('0x3a')),'acceptAt':moment()[_0x9d50('0x15')](_0x9d50('0x3a')),'reason':'accepted'};logger[_0x9d50('0x3b')](util[_0x9d50('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x3d3c88,_0x3ebeae[_0x9d50('0x35')]));emitChannelQueueInteraction(_0x17a965[_0x9d50('0x2e')],_0x3ebeae[_0x9d50('0x35')],_0x17a965[_0x9d50('0x2b')],_0x17a965['account'][_0x9d50('0x35')],_0x17a965[_0x9d50('0x36')]['id'],![],_0x212013,_0x3ebeae['id']);return rpc[_0x17a965['channel']+_0x9d50('0x3c')][_0x9d50('0x3d')](_0x17a965['interaction']['id'],{'queueId':_0x3ebeae['id']})[_0x9d50('0x3e')](function(){if(rpc[_0x17a965[_0x9d50('0x2e')]+'QueueReport']){return rpc[_0x17a965[_0x9d50('0x2e')]+'QueueReport'][_0x9d50('0x3d')](_0x3d3c88,_0x172597)[_0x9d50('0x3f')](function(_0x404d75){logger[_0x9d50('0x39')](_0x9d50('0x40'),_0x404d75);});}});}}function endRouting(_0x5c4bd7,_0x3f22e1,_0x537bc8,_0x2bd567){if(_0x5c4bd7&&_0x3f22e1){_0x3f22e1['waiting']-=0x1;var _0x271273={'leaveAt':moment()['format'](_0x9d50('0x3a')),'exitAt':moment()[_0x9d50('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x9d50('0x3b')](util[_0x9d50('0x15')](_0x9d50('0x41'),_0x5c4bd7,_0x3f22e1[_0x9d50('0x35')]));emitChannelQueueInteraction(_0x537bc8[_0x9d50('0x2e')],_0x3f22e1[_0x9d50('0x35')],_0x537bc8['body'],_0x537bc8[_0x9d50('0xc')]['name'],_0x537bc8[_0x9d50('0x36')]['id'],![],_0x2bd567);if(rpc[_0x537bc8[_0x9d50('0x2e')]+_0x9d50('0x37')]){return rpc[_0x537bc8['channel']+_0x9d50('0x37')][_0x9d50('0x3d')](_0x5c4bd7,_0x271273)['catch'](function(_0x3cf4ee){logger[_0x9d50('0x39')]('update\x20queue\x20report',_0x3cf4ee);});}}}function handleFindQueue(_0x1bd3c6){return function(_0x5c85a4){return _0x5c85a4[_0x9d50('0x35')][_0x9d50('0x42')]()===_0x1bd3c6[_0x9d50('0x42')]();};}exports[_0x9d50('0x43')]=function(_0x143297,_0x1bd653,_0x5708b6,_0x38448f){return function(_0xb45eb7){try{var _0x306a96={'name':_0x1bd653[0x0],'timeout':_0x1bd653[0x1]};var _0x2e0578=queue[_0x9d50('0x44')](_0x306a96,{'typecast':!![]});if(_0x2e0578[_0x9d50('0x45')]){logger[_0x9d50('0x39')](_0x9d50('0x46'),_0x143297,_['map'](_0x2e0578,'message')['join'](',\x20'));_0xb45eb7[_0x9d50('0x47')]();}else{var _0x5d6f58=_['find'](_0x5708b6[_0x38448f[_0x9d50('0x2e')]+_0x9d50('0x48')],handleFindQueue(_0x306a96[_0x9d50('0x35')]));if(_0x5d6f58){startRouting(_0x143297,_0x5d6f58,_0x38448f,_0x5708b6);var _0x52b606=(_0x5d6f58[_0x9d50('0x49')]||0xa)*0x3e8;var _0x479837=(_0x306a96['timeout']||0x14)*0x3e8;var _0x1c41fb;if(_0x52b606>_0x479837){_0x479837=_0x52b606;}var _0x5ec5a2=seqqueue[_0x9d50('0x4a')](_0x52b606);_0x5ec5a2['id']=_0x143297;_0x5ec5a2[_0x9d50('0x4b')]=_0x52b606;_0x5ec5a2['qtimeout']=_0x479837;_0x5ec5a2[_0x9d50('0x2e')]=_0x38448f[_0x9d50('0x2e')];_0x5708b6[_0x9d50('0x4c')][_0x143297]['on']('end',function(){logger[_0x9d50('0x3b')](_0x9d50('0x4d'),_0x143297);stopRouting(_0x143297,_0x5d6f58,_0x38448f,_0x5708b6);clearTimeout(_0x1c41fb);_0x1c41fb=undefined;_0x5ec5a2[_0x9d50('0x4e')](!![]);if(_0x5708b6['rules'][_0x143297]){delete _0x5708b6[_0x9d50('0x4c')][_0x143297];}_0xb45eb7['stop']();});_0x5708b6[_0x9d50('0x4c')][_0x143297]['on'](_0x9d50('0x4f'),function(){if(_0x5708b6['rules'][_0x143297]){delete _0x5708b6['rules'][_0x143297];}});_0x1c41fb=setTimeout(function(){logger[_0x9d50('0x3b')](_0x9d50('0x50'),_0x143297);endRouting(_0x143297,_0x5d6f58,_0x38448f,_0x5708b6);clearTimeout(_0x1c41fb);_0x5ec5a2['close'](!![]);_0xb45eb7[_0x9d50('0x51')]();},_0x479837);switch(_0x5d6f58[_0x9d50('0x52')]){case _0x9d50('0x53'):strategy[_0x9d50('0x53')](_0x5ec5a2,_0x5d6f58,_0x5708b6,_0x38448f);break;default:strategy[_0x9d50('0x54')](_0x5ec5a2,_0x5d6f58,_0x5708b6,_0x38448f);}}else{logger[_0x9d50('0x39')](_0x9d50('0x55'),_0x143297,_0x306a96[_0x9d50('0x35')]);_0xb45eb7[_0x9d50('0x47')]();}}}catch(_0x193ebf){logger[_0x9d50('0x39')]('[%s][QUEUE]\x20%s',_0x143297,_0x193ebf['stack']);_0xb45eb7['stop']();}};}; \ No newline at end of file +var _0xba44=['push','capitalize','InteractionId','format','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','[%s][STOP:QUEUE][NAME:%s]','update','then','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','Queues','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment','ioredis','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xba44,0x189));var _0x4ba4=function(_0x32cbf2,_0x10ecc1){_0x32cbf2=_0x32cbf2-0x0;var _0x399962=_0xba44[_0x32cbf2];return _0x399962;};'use strict';var schema=require('validate');var _=require(_0x4ba4('0x0'));var util=require(_0x4ba4('0x1'));var seqqueue=require(_0x4ba4('0x2'));var moment=require(_0x4ba4('0x3'));var Redis=require(_0x4ba4('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4ba4('0x5'));var strategy=require(_0x4ba4('0x6'));config[_0x4ba4('0x7')]=_['defaults'](config[_0x4ba4('0x7')],{'host':_0x4ba4('0x8'),'port':0x18eb});var io=require(_0x4ba4('0x9'))(new Redis(config[_0x4ba4('0x7')]));var attributes=['id',_0x4ba4('0xa'),_0x4ba4('0xb'),_0x4ba4('0xc'),_0x4ba4('0xd'),_0x4ba4('0xe')];function emit(_0x47a2ed,_0x3a7e65,_0x10e5e5){io['to'](_0x47a2ed)[_0x4ba4('0xf')](_0x3a7e65,_0x10e5e5);}function emitChannelQueueInteraction(_0x455abc,_0x4f7b45,_0x3c3618,_0x3cf37b,_0x100aa4,_0x40fd27,_0x264071,_0x4d325d){var _0x20e018=_[_0x4ba4('0x10')](_0x3c3618);_0x20e018['queue_id']=_0x4d325d;_0x20e018[_0x4ba4('0xc')]=_0x4f7b45;_0x20e018[_0x4ba4('0xb')]=_0x3cf37b;_0x20e018['id']=_0x100aa4;if(_0x40fd27){attributes[_0x4ba4('0x11')](_[_0x4ba4('0x12')](_0x455abc)+_0x4ba4('0x13'));_0x264071[util[_0x4ba4('0x14')]('%sQueuesWaitingInteractions',_0x455abc)][_0x100aa4]=_['pick'](_0x20e018,attributes);}else{delete _0x264071[util[_0x4ba4('0x14')]('%sQueuesWaitingInteractions',_0x455abc)][_0x100aa4];}emit(util['format'](_0x4ba4('0x15'),_0x455abc,_0x4f7b45),util[_0x4ba4('0x14')]('%s_queue_waiting_interaction:%s',_0x455abc,_0x40fd27?_0x4ba4('0x16'):_0x4ba4('0x17')),_[_0x4ba4('0x18')](_0x20e018,attributes));}var rpc={'openchannelQueueReport':require(_0x4ba4('0x19')),'mailQueueReport':require(_0x4ba4('0x1a')),'chatQueueReport':require(_0x4ba4('0x1b')),'smsQueueReport':require(_0x4ba4('0x1c')),'faxQueueReport':require(_0x4ba4('0x1d')),'whatsappQueueReport':require(_0x4ba4('0x1e')),'chatInteraction':require(_0x4ba4('0x1f')),'faxInteraction':require(_0x4ba4('0x20')),'mailInteraction':require(_0x4ba4('0x21')),'openchannelInteraction':require(_0x4ba4('0x22')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x4ba4('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x4ba4('0x24')},'timeout':{'type':_0x4ba4('0x25'),'message':_0x4ba4('0x26')}});function startRouting(_0x558c77,_0x8f9b1c,_0x5979cd,_0x28a89b){if(_0x558c77&&_0x8f9b1c&&_0x5979cd){_0x8f9b1c[_0x4ba4('0x27')]+=0x1;var _0x2e3e69={'uniqueid':_0x558c77,'from':_0x5979cd[_0x4ba4('0x28')]?_0x5979cd[_0x4ba4('0x28')][_0x4ba4('0xd')]:'','joinAt':moment()[_0x4ba4('0x14')](_0x4ba4('0x29')),'ContactId':_0x5979cd[_0x4ba4('0x2a')]?_0x5979cd[_0x4ba4('0x2a')]['id']:null,'ListId':_0x5979cd['list']?_0x5979cd['list']['id']:null};_0x2e3e69[_[_0x4ba4('0x2b')](_0x5979cd[_0x4ba4('0x2c')])+'QueueId']=_0x8f9b1c['id']||null;_0x2e3e69[_['upperFirst'](_0x5979cd[_0x4ba4('0x2c')])+'InteractionId']=_0x5979cd[_0x4ba4('0x2d')]?_0x5979cd[_0x4ba4('0x2d')]['id']:null;_0x2e3e69[_[_0x4ba4('0x2b')](_0x5979cd[_0x4ba4('0x2c')])+_0x4ba4('0x2e')]=_0x5979cd[_0x4ba4('0x2f')]?_0x5979cd['message']['id']:null;_0x2e3e69[_[_0x4ba4('0x2b')](_0x5979cd[_0x4ba4('0x2c')])+(_0x5979cd[_0x4ba4('0x2c')]!==_0x4ba4('0x30')?_0x4ba4('0x31'):_0x4ba4('0x32'))]=_0x5979cd[_0x4ba4('0xb')]?_0x5979cd[_0x4ba4('0xb')]['id']:null;logger[_0x4ba4('0x33')](util[_0x4ba4('0x14')](_0x4ba4('0x34'),_0x558c77,_0x8f9b1c[_0x4ba4('0x35')]));emitChannelQueueInteraction(_0x5979cd[_0x4ba4('0x2c')],_0x8f9b1c[_0x4ba4('0x35')],_0x2e3e69,_0x5979cd[_0x4ba4('0xb')]['name'],_0x5979cd[_0x4ba4('0x2f')]['id'],!![],_0x28a89b,_0x8f9b1c['id']);if(rpc[_0x5979cd[_0x4ba4('0x2c')]+'QueueReport']){return rpc[_0x5979cd[_0x4ba4('0x2c')]+_0x4ba4('0x36')][_0x4ba4('0x37')](_0x2e3e69)['catch'](function(_0x496718){logger['error']('create\x20queue\x20report',_0x496718);});}}}function stopRouting(_0x5550f5,_0x5e35a0,_0x852dd7,_0x3d79de){if(_0x5550f5&&_0x5e35a0){_0x5e35a0[_0x4ba4('0x27')]-=0x1;var _0x511dfa={'leaveAt':moment()[_0x4ba4('0x14')](_0x4ba4('0x29')),'acceptAt':moment()[_0x4ba4('0x14')](_0x4ba4('0x29')),'reason':'accepted'};logger[_0x4ba4('0x33')](util[_0x4ba4('0x14')](_0x4ba4('0x38'),_0x5550f5,_0x5e35a0[_0x4ba4('0x35')]));emitChannelQueueInteraction(_0x852dd7[_0x4ba4('0x2c')],_0x5e35a0['name'],_0x852dd7[_0x4ba4('0x28')],_0x852dd7[_0x4ba4('0xb')][_0x4ba4('0x35')],_0x852dd7[_0x4ba4('0x2f')]['id'],![],_0x3d79de,_0x5e35a0['id']);return rpc[_0x852dd7[_0x4ba4('0x2c')]+'Interaction'][_0x4ba4('0x39')](_0x852dd7[_0x4ba4('0x2d')]['id'],{'queueId':_0x5e35a0['id']})[_0x4ba4('0x3a')](function(){if(rpc[_0x852dd7[_0x4ba4('0x2c')]+_0x4ba4('0x36')]){return rpc[_0x852dd7[_0x4ba4('0x2c')]+_0x4ba4('0x36')][_0x4ba4('0x39')](_0x5550f5,_0x511dfa)[_0x4ba4('0x3b')](function(_0x24e1fc){logger[_0x4ba4('0x3c')](_0x4ba4('0x3d'),_0x24e1fc);});}});}}function endRouting(_0x5011fc,_0xafc5f2,_0x56923f,_0x216f35){if(_0x5011fc&&_0xafc5f2){_0xafc5f2[_0x4ba4('0x27')]-=0x1;var _0xe6009a={'leaveAt':moment()[_0x4ba4('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x4ba4('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x4ba4('0x3e')};logger[_0x4ba4('0x33')](util[_0x4ba4('0x14')](_0x4ba4('0x3f'),_0x5011fc,_0xafc5f2[_0x4ba4('0x35')]));emitChannelQueueInteraction(_0x56923f['channel'],_0xafc5f2['name'],_0x56923f[_0x4ba4('0x28')],_0x56923f[_0x4ba4('0xb')]['name'],_0x56923f[_0x4ba4('0x2f')]['id'],![],_0x216f35);if(rpc[_0x56923f[_0x4ba4('0x2c')]+_0x4ba4('0x36')]){return rpc[_0x56923f[_0x4ba4('0x2c')]+_0x4ba4('0x36')][_0x4ba4('0x39')](_0x5011fc,_0xe6009a)[_0x4ba4('0x3b')](function(_0x3a3aaa){logger[_0x4ba4('0x3c')]('update\x20queue\x20report',_0x3a3aaa);});}}}function handleFindQueue(_0x180b6a){return function(_0x1c3b90){return _0x1c3b90[_0x4ba4('0x35')][_0x4ba4('0x40')]()===_0x180b6a[_0x4ba4('0x40')]();};}exports['consequence']=function(_0x3251cf,_0x2ea0e2,_0x346d00,_0x576d96){return function(_0x567f29){try{var _0x493f64={'name':_0x2ea0e2[0x0],'timeout':_0x2ea0e2[0x1]};var _0x160c72=queue['validate'](_0x493f64,{'typecast':!![]});if(_0x160c72[_0x4ba4('0x41')]){logger['error'](_0x4ba4('0x42'),_0x3251cf,_['map'](_0x160c72,_0x4ba4('0x2f'))[_0x4ba4('0x43')](',\x20'));_0x567f29[_0x4ba4('0x44')]();}else{var _0x43e6e5=_['find'](_0x346d00[_0x576d96['channel']+_0x4ba4('0x45')],handleFindQueue(_0x493f64[_0x4ba4('0x35')]));if(_0x43e6e5){startRouting(_0x3251cf,_0x43e6e5,_0x576d96,_0x346d00);var _0x1a2bd3=(_0x43e6e5[_0x4ba4('0x3e')]||0xa)*0x3e8;var _0x1002f4=(_0x493f64['timeout']||0x14)*0x3e8;var _0x241086;if(_0x1a2bd3>_0x1002f4){_0x1002f4=_0x1a2bd3;}var _0x34d6e1=seqqueue['createQueue'](_0x1a2bd3);_0x34d6e1['id']=_0x3251cf;_0x34d6e1[_0x4ba4('0x46')]=_0x1a2bd3;_0x34d6e1[_0x4ba4('0x47')]=_0x1002f4;_0x34d6e1[_0x4ba4('0x2c')]=_0x576d96['channel'];_0x346d00[_0x4ba4('0x48')][_0x3251cf]['on'](_0x4ba4('0x49'),function(){logger[_0x4ba4('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3251cf);stopRouting(_0x3251cf,_0x43e6e5,_0x576d96,_0x346d00);clearTimeout(_0x241086);_0x241086=undefined;_0x34d6e1[_0x4ba4('0x4a')](!![]);if(_0x346d00[_0x4ba4('0x48')][_0x3251cf]){delete _0x346d00[_0x4ba4('0x48')][_0x3251cf];}_0x567f29['stop']();});_0x346d00['rules'][_0x3251cf]['on'](_0x4ba4('0x4b'),function(){if(_0x346d00[_0x4ba4('0x48')][_0x3251cf]){delete _0x346d00['rules'][_0x3251cf];}});_0x241086=setTimeout(function(){logger[_0x4ba4('0x33')](_0x4ba4('0x4c'),_0x3251cf);endRouting(_0x3251cf,_0x43e6e5,_0x576d96,_0x346d00);clearTimeout(_0x241086);_0x34d6e1[_0x4ba4('0x4a')](!![]);_0x567f29[_0x4ba4('0x4d')]();},_0x1002f4);switch(_0x43e6e5[_0x4ba4('0x4e')]){case'rrmemory':strategy['rrmemory'](_0x34d6e1,_0x43e6e5,_0x346d00,_0x576d96);break;default:strategy[_0x4ba4('0x4f')](_0x34d6e1,_0x43e6e5,_0x346d00,_0x576d96);}}else{logger[_0x4ba4('0x3c')](_0x4ba4('0x50'),_0x3251cf,_0x493f64['name']);_0x567f29[_0x4ba4('0x44')]();}}}catch(_0x57fbc2){logger['error'](_0x4ba4('0x42'),_0x3251cf,_0x57fbc2[_0x4ba4('0x51')]);_0x567f29[_0x4ba4('0x44')]();}};}; \ 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 31f05c7..99ff1e9 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(_0x1597cb,_0x33d3c4){var _0x50e941=function(_0x3f382f){while(--_0x3f382f){_0x1597cb['push'](_0x1597cb['shift']());}};_0x50e941(++_0x33d3c4);}(_0x5089,0x1bb));var _0x9508=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x5089[_0x11ca63];return _0x41f1f6;};'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 _0x04de=['uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','forcedOwnership','isAgentAvailable','realtime','channel','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','busyQueue','removeWaitingNotification','exports','lodash'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x04de,0x107));var _0xe04d=function(_0x234a86,_0x1d4757){_0x234a86=_0x234a86-0x0;var _0x4175de=_0x04de[_0x234a86];return _0x4175de;};'use strict';var _=require(_0xe04d('0x0'));var uuid=require(_0xe04d('0x1'));var util=require(_0xe04d('0x2'));var logger=require(_0xe04d('0x3'))(_0xe04d('0x4'));var Agent=function(_0x28f63f,_0x1113af,_0x43c4b1,_0x2593a4){this[_0xe04d('0x5')]=uuid['v4']();this[_0xe04d('0x6')]=_0x28f63f;this['agent']=_0x1113af;this['realtime']=_0x43c4b1;this['routing']=_0x2593a4;this['squeue'][_0xe04d('0x7')](this[_0xe04d('0x8')][_0xe04d('0x9')](this),this[_0xe04d('0xa')][_0xe04d('0x9')](this));this[_0xe04d('0x6')]['on'](_0xe04d('0xb'),this[_0xe04d('0xa')]['bind'](this));this[_0xe04d('0x6')]['on'](_0xe04d('0xc'),this[_0xe04d('0xd')][_0xe04d('0x9')](this));};Agent[_0xe04d('0xe')][_0xe04d('0x7')]=function(){this[_0xe04d('0x6')][_0xe04d('0x7')](this[_0xe04d('0x8')]['bind'](this),this[_0xe04d('0xa')][_0xe04d('0x9')](this));};Agent[_0xe04d('0xe')][_0xe04d('0xd')]=function(){this[_0xe04d('0xa')](!![]);};Agent[_0xe04d('0xe')][_0xe04d('0x8')]=function(){logger[_0xe04d('0xf')](_0xe04d('0x10'),this[_0xe04d('0x6')]['id'],this[_0xe04d('0x11')]['id']);if(_[_0xe04d('0x12')](this['realtime'][_0xe04d('0x13')][this['agent']['id']])){logger[_0xe04d('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe04d('0x6')]['id'],this[_0xe04d('0x11')]['id']);setTimeout(this[_0xe04d('0x7')][_0xe04d('0x9')](this),0x3e8);}else{if(this[_0xe04d('0x4')][_0xe04d('0x14')]||util[_0xe04d('0x15')](this[_0xe04d('0x6')]['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],this[_0xe04d('0x6')][_0xe04d('0x17')],![])){this[_0xe04d('0x16')][_0xe04d('0x13')][this[_0xe04d('0x11')]['id']]['busy']=!![];this[_0xe04d('0x16')][_0xe04d('0x13')][this['agent']['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this[_0xe04d('0x16')],this['routing'],this['agent'],this[_0xe04d('0x6')][_0xe04d('0x17')]);util['showNotification'](this[_0xe04d('0x5')],this['squeue']['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],null,this[_0xe04d('0x4')]);util[_0xe04d('0x18')](this[_0xe04d('0x6')]['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],_0xe04d('0x19')+(this[_0xe04d('0x4')][_0xe04d('0x14')]?':FORCED':''));}else{logger[_0xe04d('0xf')](_0xe04d('0x1a'),this[_0xe04d('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xe04d('0x7')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x25299b){if(_[_0xe04d('0x12')](this['realtime']['agents'][this[_0xe04d('0x11')]['id']])){return logger[_0xe04d('0xf')](_0xe04d('0x1b'),this['squeue']['id'],this[_0xe04d('0x11')]['id']);}else{logger[_0xe04d('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe04d('0x6')]['id'],this['agent']['id']);util[_0xe04d('0x1c')](this[_0xe04d('0x5')],this['squeue']['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],null,this[_0xe04d('0x4')]);this[_0xe04d('0x16')][_0xe04d('0x13')][this[_0xe04d('0x11')]['id']][_0xe04d('0x1d')]=![];this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']][_0xe04d('0x1e')]=undefined;util[_0xe04d('0x1f')](this[_0xe04d('0x16')],this[_0xe04d('0x4')],this[_0xe04d('0x11')],this[_0xe04d('0x6')][_0xe04d('0x17')]);util[_0xe04d('0x18')](this['squeue']['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],_0x25299b?'STOP':'TIMEOUT');}if(!_0x25299b){setTimeout(this[_0xe04d('0x7')][_0xe04d('0x9')](this),0x3e8);}};function agent(_0x261116,_0x2ad374,_0x56e74d,_0xa202ee){return new Agent(_0x261116,_0x2ad374,_0x56e74d,_0xa202ee);}module[_0xe04d('0x20')]=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 6b8b0ee..924d2d1 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 _0xbe05=['notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xbe05,0x65));var _0x5be0=function(_0x4d6d13,_0x3ea4a8){_0x4d6d13=_0x4d6d13-0x0;var _0x29b6cd=_0xbe05[_0x4d6d13];return _0x29b6cd;};'use strict';var _=require(_0x5be0('0x0'));var uuid=require('uuid');var util=require(_0x5be0('0x1'));var logger=require(_0x5be0('0x2'))(_0x5be0('0x3'));var Beepall=function(_0x215d8b,_0xf3ecb9,_0x3d6d34,_0x1bbadd){this[_0x5be0('0x4')]=uuid['v4']();this['squeue']=_0x215d8b;this['queue']=_0xf3ecb9;this[_0x5be0('0x5')]=_0x3d6d34;this['routing']=_0x1bbadd;this[_0x5be0('0x6')][_0x5be0('0x7')](this[_0x5be0('0x8')][_0x5be0('0x9')](this),this[_0x5be0('0xa')][_0x5be0('0x9')](this));this[_0x5be0('0x6')]['on'](_0x5be0('0xb'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x5be0('0xc'),this[_0x5be0('0xd')][_0x5be0('0x9')](this));};Beepall['prototype']['push']=function(){this[_0x5be0('0x6')][_0x5be0('0x7')](this['handleRun'][_0x5be0('0x9')](this),this['handleTimeout'][_0x5be0('0x9')](this));};Beepall[_0x5be0('0xe')][_0x5be0('0xd')]=function(){this[_0x5be0('0xa')](!![]);};Beepall[_0x5be0('0xe')][_0x5be0('0x8')]=function(){var _0xe26ba0=!![];if(!_[_0x5be0('0xf')](this[_0x5be0('0x10')])&&!_[_0x5be0('0xf')](this[_0x5be0('0x10')][_0x5be0('0x11')])&&this['queue'][_0x5be0('0x11')]['length']>0x0){for(var _0x1de718=0x0,_0x40f344;_0x1de7180x0){for(var _0xd8e928=0x0,_0x241c95;_0xd8e9280x0&&_0x486e3c[_0x3586b1+'CurrentCapacity']>=_0x486e3c[_0x3586b1+'Capacity']){writeLog(_0x39c586,_0x486e3c,_0x3586b1[_0xb22a('0x24')]()+_0xb22a('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x3b8f4a,_0x4c0bf8,_0x25f1ec,_0x18956b,_0x53bf5f){return sendNotification(!![],_0x3b8f4a,_0x4c0bf8,_0x25f1ec,_0x18956b,_0x53bf5f);};exports[_0xb22a('0x26')]=function(_0xe940a3,_0x246e02,_0x3c7f67,_0x45084e,_0x480cce){return sendNotification(![],_0xe940a3,_0x246e02,_0x3c7f67,_0x45084e,_0x480cce);};exports['checkWaitingNotifications']=function(_0x317b48,_0x1fc24e,_0x48590b){var _0x7bc169=_0x1fc24e[_0xb22a('0x27')][_0xb22a('0x28')];if(!_0x7bc169&&_0x48590b){_0x7bc169=_0x48590b['id'];}var _0x33fd91=_[_0xb22a('0x29')](_0x317b48[_0x1fc24e['channel']+_0xb22a('0x2a')],function(_0x3ac208){var _0x89ef57=_[_0xb22a('0x2b')](_0x1fc24e[_0xb22a('0x2c')])+'InteractionId';return _0x3ac208[_0x89ef57]===_0x1fc24e[_0xb22a('0x27')]['id'];});if(!_0x33fd91&&_0x7bc169&&_0x317b48[_0xb22a('0x2d')][_0x7bc169]){_0x33fd91=_[_0xb22a('0x29')](_0x317b48[_0xb22a('0x2d')][_0x7bc169][_0x1fc24e['channel']+_0xb22a('0x2e')],function(_0x58190f){return _0x58190f['id']===_0x1fc24e['interaction']['id'];});}return _0x33fd91;};exports[_0xb22a('0x2f')]=function(_0x1fb9d8,_0x5f275f,_0x9d26ad,_0x261a42){if(_0x9d26ad&&_0x9d26ad['id']&&_0x1fb9d8[_0xb22a('0x2d')]&&_0x1fb9d8[_0xb22a('0x2d')][_0x9d26ad['id']]){_0x1fb9d8[_0xb22a('0x2d')][_0x9d26ad['id']][_0x261a42+_0xb22a('0x2e')][_0x5f275f[_0xb22a('0x30')]['id']]={'id':_0x5f275f['interaction']['id']};}};exports[_0xb22a('0x31')]=function(_0x1ace5e,_0x715e7d,_0x1d3d6e,_0x2de1b8){if(_0x1d3d6e&&_0x1d3d6e['id']&&_0x1ace5e['agents']&&_0x1ace5e[_0xb22a('0x2d')][_0x1d3d6e['id']]){delete _0x1ace5e[_0xb22a('0x2d')][_0x1d3d6e['id']][_0x2de1b8+_0xb22a('0x2e')][_0x715e7d[_0xb22a('0x30')]['id']];}};exports[_0xb22a('0x32')]=writeLog; \ No newline at end of file +var _0x2028=['../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','name','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','checkWaitingNotifications','interaction','some','QueuesWaitingInteractions','capitalize','channel','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x2028,0x64));var _0x8202=function(_0x5ea426,_0x55f3da){_0x5ea426=_0x5ea426-0x0;var _0x1656fd=_0x2028[_0x5ea426];return _0x1656fd;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x8202('0x0'));var Redis=require(_0x8202('0x1'));var config=require(_0x8202('0x2'));var logger=require('../../../../../config/logger')(_0x8202('0x3'));config[_0x8202('0x4')]=_[_0x8202('0x5')](config['redis'],{'host':_0x8202('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8202('0x4')]));function sendNotification(_0x86e6d8,_0x4382f2,_0x170fb4,_0x5a2b9d,_0xe5773d,_0xaf3ee7){var _0x37a3b1=_0xaf3ee7||{};var _0x234613=_0x170fb4[_0x8202('0x7')]('.');var _0x2240e8={'uniqueid':_0x4382f2,'channel':_0x234613[0x0],'id':_0x234613[0x1],'title':_0x234613[0x0]+_0x8202('0x8'),'interactionId':_0x234613[0x2],'queue':_0xe5773d?_0xe5773d['name']:null,'sound':_0x37a3b1[_0x8202('0x9')][_0x8202('0xa')],'shake':_0x37a3b1[_0x8202('0x9')][_0x8202('0xb')]};try{if(!_0x37a3b1[_0x8202('0xc')]){_0x37a3b1[_0x8202('0xc')]={};}if(_0xe5773d){_0x37a3b1[_0x8202('0xc')][_0x8202('0xd')]=_0xe5773d;}else if(_0x37a3b1[_0x8202('0xc')][_0x8202('0xd')]){delete _0x37a3b1[_0x8202('0xc')][_0x8202('0xd')];}_0x2240e8[_0x8202('0xe')]=utils[_0x8202('0xf')](_0x37a3b1[_0x8202('0x9')][_0x8202('0x10')],_0x37a3b1);}catch(_0x3b08ed){_0x2240e8['msg']=_0x8202('0x11');logger[_0x8202('0x12')](util[_0x8202('0x13')](_0x8202('0x14'),_0x4382f2,_0x3b08ed[_0x8202('0x15')]));}io['to'](util[_0x8202('0x13')](_0x8202('0x16'),_0x5a2b9d['name']))['emit'](util[_0x8202('0x13')]('notification:%s',_0x86e6d8?'save':_0x8202('0x17')),_0x2240e8);}function writeLog(_0x4a352b,_0x5dd8a4,_0x149121){return logger['debug'](util[_0x8202('0x13')](_0x8202('0x18'),_0x4a352b,_0x5dd8a4[_0x8202('0x19')],_0x149121));}exports[_0x8202('0x1a')]=function(_0x322c6f,_0x57472f,_0x1725a0,_0x525a3a){if(_0x57472f[_0x8202('0x1b')]){writeLog(_0x322c6f,_0x57472f,_0x8202('0x1c'));return![];}if(!_0x57472f[_0x8202('0x1d')]){writeLog(_0x322c6f,_0x57472f,_0x8202('0x1e'));return![];}if(_0x57472f[_0x1725a0+_0x8202('0x1f')]){writeLog(_0x322c6f,_0x57472f,_0x8202('0x20'));return![];}if(_0x525a3a&&_0x57472f['hasOwnProperty'](_0x1725a0+_0x8202('0x21'))&&_0x57472f[_0x8202('0x22')](_0x1725a0+_0x8202('0x23'))){if(_0x57472f[_0x1725a0+_0x8202('0x21')]>0x0&&_0x57472f[_0x1725a0+_0x8202('0x23')]>=_0x57472f[_0x1725a0+_0x8202('0x21')]){writeLog(_0x322c6f,_0x57472f,_0x1725a0[_0x8202('0x24')]()+_0x8202('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x3fac22,_0x3ac9a2,_0x1c5794,_0x18f928,_0x2b5c18){return sendNotification(!![],_0x3fac22,_0x3ac9a2,_0x1c5794,_0x18f928,_0x2b5c18);};exports['hideNotification']=function(_0x26c256,_0x53c2b6,_0x249a45,_0x53fb03,_0x5efba7){return sendNotification(![],_0x26c256,_0x53c2b6,_0x249a45,_0x53fb03,_0x5efba7);};exports[_0x8202('0x26')]=function(_0x5c1da8,_0x6be059,_0x2b2f71){var _0x29e60c=_0x6be059[_0x8202('0x27')]['UserId'];if(!_0x29e60c&&_0x2b2f71){_0x29e60c=_0x2b2f71['id'];}var _0x54bddf=_[_0x8202('0x28')](_0x5c1da8[_0x6be059['channel']+_0x8202('0x29')],function(_0x3a04c6){var _0x609865=_[_0x8202('0x2a')](_0x6be059[_0x8202('0x2b')])+_0x8202('0x2c');return _0x3a04c6[_0x609865]===_0x6be059[_0x8202('0x27')]['id'];});if(!_0x54bddf&&_0x29e60c&&_0x5c1da8['agents'][_0x29e60c]){_0x54bddf=_[_0x8202('0x28')](_0x5c1da8['agents'][_0x29e60c][_0x6be059[_0x8202('0x2b')]+_0x8202('0x2d')],function(_0x28fb2d){return _0x28fb2d['id']===_0x6be059[_0x8202('0x27')]['id'];});}return _0x54bddf;};exports[_0x8202('0x2e')]=function(_0x569ebf,_0x5068be,_0x348248,_0x362221){if(_0x348248&&_0x348248['id']&&_0x569ebf[_0x8202('0x2f')]&&_0x569ebf['agents'][_0x348248['id']]){_0x569ebf[_0x8202('0x2f')][_0x348248['id']][_0x362221+_0x8202('0x2d')][_0x5068be[_0x8202('0x15')]['id']]={'id':_0x5068be[_0x8202('0x27')]['id']};}};exports[_0x8202('0x30')]=function(_0x585762,_0x40e274,_0x4281d7,_0x470c06){if(_0x4281d7&&_0x4281d7['id']&&_0x585762[_0x8202('0x2f')]&&_0x585762[_0x8202('0x2f')][_0x4281d7['id']]){delete _0x585762[_0x8202('0x2f')][_0x4281d7['id']][_0x470c06+_0x8202('0x2d')][_0x40e274[_0x8202('0x15')]['id']];}};exports[_0x8202('0x31')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index c1cddd3..b748acb 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 _0xae5e=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xae5e,0x1d2));var _0xeae5=function(_0x55d83c,_0xb0a29){_0x55d83c=_0x55d83c-0x0;var _0x404671=_0xae5e[_0x55d83c];return _0x404671;};'use strict';var schema=require(_0xeae5('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0xeae5('0x1'));var logger=require(_0xeae5('0x2'))(_0xeae5('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xeae5('0x4')}});exports['consequence']=function(_0xefba31,_0x53d165){return function(_0x46515e){try{var _0x2b2391={'command':_0x53d165[0x0]};var _0x4728dd=system[_0xeae5('0x0')](_0x2b2391,{'typecast':!![]});if(_0x4728dd[_0xeae5('0x5')]){logger['error'](_0xeae5('0x6'),_0xefba31,_[_0xeae5('0x7')](_0x4728dd,'message')[_0xeae5('0x8')](',\x20'));logger[_0xeae5('0x9')](_0xeae5('0xa'),_0xefba31);_0x46515e[_0xeae5('0xb')]();}else{var _0x3d3e4e=this;var _0x118706=utils[_0xeae5('0xc')](_0x53d165[0x0],this);logger[_0xeae5('0x9')](_0xeae5('0xd'),_0xefba31,_0x118706);sh[_0xeae5('0xe')](_['trim'](_0x118706),function(_0x93ce8,_0x4c1bc7){logger[_0xeae5('0x9')](_0xeae5('0xf'),_0xefba31,_0x93ce8);if(_0x93ce8==0x0){var _0x2cdbc4=_0x4c1bc7['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xeae5('0x10')](_0x53d165[0x1])||_[_0xeae5('0x11')](_0x53d165[0x1])){logger['info'](_0xeae5('0x12'),_0xefba31);_0x3d3e4e[_0xeae5('0x13')][_0x53d165[0x1]]=_0x2cdbc4;}else{logger[_0xeae5('0x9')](_0xeae5('0x14'),_0xefba31,_0x53d165[0x1],_0x2cdbc4);_0x3d3e4e[_0xeae5('0x13')][_0x53d165[0x1]]=_0x2cdbc4;}}_0x46515e[_0xeae5('0xb')]();});}}catch(_0x734fc0){logger['error']('[%s][SYSTEM]\x20%s',_0xefba31,_[_0xeae5('0x15')](_0x734fc0)?JSON[_0xeae5('0x16')](_0x734fc0):_0x734fc0);logger[_0xeae5('0x9')](_0xeae5('0xa'),_0xefba31);_0x46515e[_0xeae5('0xb')]();}};}; \ No newline at end of file +var _0xf65f=['lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','shelljs'];(function(_0x48382d,_0x3cdb87){var _0x2ddf03=function(_0x441002){while(--_0x441002){_0x48382d['push'](_0x48382d['shift']());}};_0x2ddf03(++_0x3cdb87);}(_0xf65f,0xe0));var _0xff65=function(_0x32f78b,_0x178f58){_0x32f78b=_0x32f78b-0x0;var _0x51d847=_0xf65f[_0x32f78b];return _0x51d847;};'use strict';var schema=require('validate');var sh=require(_0xff65('0x0'));var _=require(_0xff65('0x1'));var utils=require(_0xff65('0x2'));var logger=require(_0xff65('0x3'))(_0xff65('0x4'));var system=schema({'command':{'type':_0xff65('0x5'),'required':!![],'message':_0xff65('0x6')}});exports[_0xff65('0x7')]=function(_0x53461b,_0x4f7dee){return function(_0x492ef0){try{var _0x541913={'command':_0x4f7dee[0x0]};var _0x7acefd=system[_0xff65('0x8')](_0x541913,{'typecast':!![]});if(_0x7acefd['length']){logger[_0xff65('0x9')](_0xff65('0xa'),_0x53461b,_[_0xff65('0xb')](_0x7acefd,'message')[_0xff65('0xc')](',\x20'));logger[_0xff65('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x53461b);_0x492ef0[_0xff65('0xe')]();}else{var _0x490228=this;var _0x47c891=utils[_0xff65('0xf')](_0x4f7dee[0x0],this);logger[_0xff65('0xd')](_0xff65('0x10'),_0x53461b,_0x47c891);sh[_0xff65('0x11')](_['trim'](_0x47c891),function(_0x4b68cf,_0x3df2b1){logger['info'](_0xff65('0x12'),_0x53461b,_0x4b68cf);if(_0x4b68cf==0x0){var _0x128ad9=_0x3df2b1['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xff65('0x13')](_0x4f7dee[0x1])||_['isEmpty'](_0x4f7dee[0x1])){logger['info'](_0xff65('0x14'),_0x53461b);_0x490228['body'][_0x4f7dee[0x1]]=_0x128ad9;}else{logger[_0xff65('0xd')](_0xff65('0x15'),_0x53461b,_0x4f7dee[0x1],_0x128ad9);_0x490228[_0xff65('0x16')][_0x4f7dee[0x1]]=_0x128ad9;}}_0x492ef0[_0xff65('0xe')]();});}}catch(_0x332c80){logger[_0xff65('0x9')](_0xff65('0xa'),_0x53461b,_[_0xff65('0x17')](_0x332c80)?JSON[_0xff65('0x18')](_0x332c80):_0x332c80);logger[_0xff65('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x53461b);_0x492ef0[_0xff65('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 b38675b..49ec2ab 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 _0x51e3=['next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x51e3,0x1d6));var _0x351e=function(_0x2c1ed4,_0x5b93e7){_0x2c1ed4=_0x2c1ed4-0x0;var _0x5cf40d=_0x51e3[_0x2c1ed4];return _0x5cf40d;};'use strict';var schema=require(_0x351e('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x351e('0x1')),'openchannelInteraction':require(_0x351e('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x351e('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x351e('0x4'))};var logger=require(_0x351e('0x5'))(_0x351e('0x6'));var tag=schema({'tag':{'type':_0x351e('0x7'),'required':!![],'message':_0x351e('0x8')}});exports[_0x351e('0x9')]=function(_0x4321d1,_0x2c5172,_0xb0e2d2,_0x34c62b){return function(_0x59a165){try{var _0x436855={'tag':_0x2c5172[0x0]};var _0x170add=tag[_0x351e('0x0')](_0x436855,{'typecast':!![]});if(_0x170add['length']){logger[_0x351e('0xa')](_0x351e('0xb'),_0x4321d1,_[_0x351e('0xc')](_0x170add,_0x351e('0xd'))[_0x351e('0xe')](',\x20'));logger['info'](_0x351e('0xf'),_0x4321d1);_0x59a165[_0x351e('0x10')]();}else{var _0x44b971={'ids':[_0x2c5172[0x0]]};if(rpc[_0x34c62b[_0x351e('0x11')]+_0x351e('0x12')]){rpc[_0x34c62b[_0x351e('0x11')]+_0x351e('0x12')][_0x351e('0x13')](_0x34c62b[_0x351e('0x14')]['id'],_0x44b971)[_0x351e('0x15')](function(_0x2c530d){logger[_0x351e('0x16')](_0x351e('0x17'),_0x4321d1,_0x2c5172[0x1],_0x34c62b[_0x351e('0x11')],_0x34c62b['interaction']['id']);})[_0x351e('0x18')](function(_0x2e7408){logger['error'](_0x351e('0xb'),_0x4321d1,JSON[_0x351e('0x19')](_0x2e7408));logger[_0x351e('0x16')](_0x351e('0xf'),_0x4321d1);})[_0x351e('0x1a')](function(){_0x59a165[_0x351e('0x10')]();});}}}catch(_0x42a0e1){logger[_0x351e('0xa')]('[%s][TAG]\x20%s',_0x4321d1,_['isObject'](_0x42a0e1)?JSON['stringify'](_0x42a0e1):_0x42a0e1);logger[_0x351e('0x16')](_0x351e('0xf'),_0x4321d1);_0x59a165['next']();}};}; \ No newline at end of file +var _0xd88d=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','next','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x21f108,_0x494575){var _0x4e28b6=function(_0x11ecb0){while(--_0x11ecb0){_0x21f108['push'](_0x21f108['shift']());}};_0x4e28b6(++_0x494575);}(_0xd88d,0x1cd));var _0xdd88=function(_0x27af50,_0x2e4b01){_0x27af50=_0x27af50-0x0;var _0x5925f4=_0xd88d[_0x27af50];return _0x5925f4;};'use strict';var schema=require(_0xdd88('0x0'));var _=require(_0xdd88('0x1'));var rpc={'chatInteraction':require(_0xdd88('0x2')),'openchannelInteraction':require(_0xdd88('0x3')),'smsInteraction':require(_0xdd88('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xdd88('0x5'))};var logger=require(_0xdd88('0x6'))('routing');var tag=schema({'tag':{'type':_0xdd88('0x7'),'required':!![],'message':_0xdd88('0x8')}});exports[_0xdd88('0x9')]=function(_0x404b3f,_0x41a7af,_0x150ae9,_0x2e8f54){return function(_0x4c789b){try{var _0x499c4f={'tag':_0x41a7af[0x0]};var _0x136bee=tag[_0xdd88('0x0')](_0x499c4f,{'typecast':!![]});if(_0x136bee[_0xdd88('0xa')]){logger[_0xdd88('0xb')](_0xdd88('0xc'),_0x404b3f,_[_0xdd88('0xd')](_0x136bee,'message')['join'](',\x20'));logger['info'](_0xdd88('0xe'),_0x404b3f);_0x4c789b['next']();}else{var _0x5c53c5={'ids':[_0x41a7af[0x0]]};if(rpc[_0x2e8f54[_0xdd88('0xf')]+_0xdd88('0x10')]){rpc[_0x2e8f54[_0xdd88('0xf')]+'Interaction'][_0xdd88('0x11')](_0x2e8f54[_0xdd88('0x12')]['id'],_0x5c53c5)[_0xdd88('0x13')](function(_0x5b5ec2){logger[_0xdd88('0x14')](_0xdd88('0x15'),_0x404b3f,_0x41a7af[0x1],_0x2e8f54[_0xdd88('0xf')],_0x2e8f54[_0xdd88('0x12')]['id']);})[_0xdd88('0x16')](function(_0x374131){logger[_0xdd88('0xb')](_0xdd88('0xc'),_0x404b3f,JSON['stringify'](_0x374131));logger['info'](_0xdd88('0xe'),_0x404b3f);})['finally'](function(){_0x4c789b[_0xdd88('0x17')]();});}}}catch(_0x269cc4){logger[_0xdd88('0xb')]('[%s][TAG]\x20%s',_0x404b3f,_[_0xdd88('0x18')](_0x269cc4)?JSON[_0xdd88('0x19')](_0x269cc4):_0x269cc4);logger['info'](_0xdd88('0xe'),_0x404b3f);_0x4c789b[_0xdd88('0x17')]();}};}; \ 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 e7f8cc1..a793ebb 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 _0x29d4=['title','jsonrpc','2.0','login','stringify','utf8','POST','application/json-rpc','then','result','logged','channelId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params='];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x29d4,0xef));var _0x429d=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x29d4[_0x9aada2];return _0x196dff;};'use strict';var rp=require('request-promise');var logger=require(_0x429d('0x0'))(_0x429d('0x1'));var _=require('lodash');var arr=[];exports[_0x429d('0x2')]=function(_0x879166,_0x4b5a5b){return function(_0x3313c7){var _0x2c9c99=_0x4b5a5b[0xa];var _0x56f910=_0x4b5a5b[0xb];var _0x5775fb=_0x4b5a5b[0xc];var _0x285769=_0x4b5a5b[0xd];var _0x7adf95=_0x4b5a5b[0xe];var _0x2e01e0=_0x4b5a5b[0xf]['replace'](/\n/g,_0x429d('0x3'));var _0x30be43=_0x4b5a5b[0x10][_0x429d('0x4')](/\n/g,'\x20');if(!arr[_0x429d('0x5')](_0x56f910)){arr[_0x429d('0x6')](_0x56f910);var _0x21032d=_0x4b5a5b[0x3];var _0x214854=_0x4b5a5b[0x4];var _0x45ea84=_0x4b5a5b[0x1];var _0xa73e9f=_0x4b5a5b[0x0];var _0x5bd12a={};_0x5bd12a[_0x429d('0x7')]=_0x4b5a5b[0x8]+_0x429d('0x8')+_0x5775fb+'|'+_0x2c9c99+'|'+_0x285769+'|'+_0x56f910+'|'+_0x7adf95;_0x5bd12a['urlOnRing']=_0x4b5a5b[0x7]+_0x429d('0x8')+_0x5775fb+'|'+_0x2c9c99+'|'+_0x285769+'|'+_0x56f910+'|'+_0x7adf95+'|'+_0x2e01e0+'|'+_0x30be43;_0x5bd12a[_0x429d('0x9')]=_0x4b5a5b[0x9];var _0x10d086={};_0x10d086[_0x429d('0xa')]=_0x429d('0xb');_0x10d086['method']=_0x429d('0xc');var _0x16cc31=[];_0x16cc31[_0x429d('0x6')](_0x4b5a5b[0x2]);_0x16cc31['push'](_0x4b5a5b[0x5]);_0x16cc31['push'](_0x4b5a5b[0x6]);_0x10d086['params']=_0x16cc31;_0x10d086['id']=0x1;var _0x15df6b=JSON[_0x429d('0xd')](_0x10d086);var _0x5d99a3={'encoding':_0x429d('0xe'),'method':_0x429d('0xf'),'timeout':0x2710,'url':_0x21032d,'headers':{'Content-Type':_0x429d('0x10')},'body':_0x15df6b};return rp(_0x5d99a3)[_0x429d('0x11')](function(_0x230128){const _0x4f2739=JSON['parse'](_0x230128);if(!_0x4f2739[_0x429d('0x12')][_0x429d('0x13')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x2c3516=_0x56f910;var _0x25abf7=_0x429d('0x14')+_0x45ea84+'&serviceId='+_0xa73e9f+_0x429d('0x15')+_0x2c3516+_0x429d('0x16')+JSON[_0x429d('0xd')](_0x5bd12a);var _0x3e6f87=_0x214854+'?'+_0x25abf7;return rp(_0x3e6f87);})['then'](function(_0x587bff){logger['info'](_0x429d('0x17'),_0x879166,_0x587bff);_0x3313c7[_0x429d('0x18')]();})[_0x429d('0x19')](function(_0x56644c){logger[_0x429d('0x1a')]('[%s][TVOX]\x20%s',_0x879166,_[_0x429d('0x1b')](_0x56644c)?JSON['stringify'](_0x56644c):_0x56644c);_0x3313c7[_0x429d('0x18')]();});}else{logger[_0x429d('0x1c')](_0x429d('0x1d'),_0x879166);_0x3313c7[_0x429d('0x1e')]();}};}; \ No newline at end of file +var _0x0e9b=['params','stringify','POST','application/json-rpc','parse','result','logged','channelId=','&sessionId=','&data=','then','stop','catch','[%s][TVOX]\x20%s','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','login'];(function(_0x3dde84,_0x37fd88){var _0x80561f=function(_0x45607c){while(--_0x45607c){_0x3dde84['push'](_0x3dde84['shift']());}};_0x80561f(++_0x37fd88);}(_0x0e9b,0x11d));var _0xb0e9=function(_0x308c23,_0x15b7b9){_0x308c23=_0x308c23-0x0;var _0x4af40a=_0x0e9b[_0x308c23];return _0x4af40a;};'use strict';var rp=require(_0xb0e9('0x0'));var logger=require(_0xb0e9('0x1'))(_0xb0e9('0x2'));var _=require(_0xb0e9('0x3'));var arr=[];exports[_0xb0e9('0x4')]=function(_0x4dff15,_0x23e916){return function(_0x142814){var _0x520499=_0x23e916[0xa];var _0x5495b4=_0x23e916[0xb];var _0x4499f0=_0x23e916[0xc];var _0x43817a=_0x23e916[0xd];var _0x1e78b1=_0x23e916[0xe];var _0x5ad754=_0x23e916[0xf][_0xb0e9('0x5')](/\n/g,_0xb0e9('0x6'));var _0x3dc8c4=_0x23e916[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xb0e9('0x7')](_0x5495b4)){arr[_0xb0e9('0x8')](_0x5495b4);var _0x51de51=_0x23e916[0x3];var _0x3f145b=_0x23e916[0x4];var _0x287260=_0x23e916[0x1];var _0x3ab637=_0x23e916[0x0];var _0x2e56e6={};_0x2e56e6[_0xb0e9('0x9')]=_0x23e916[0x8]+_0xb0e9('0xa')+_0x4499f0+'|'+_0x520499+'|'+_0x43817a+'|'+_0x5495b4+'|'+_0x1e78b1;_0x2e56e6[_0xb0e9('0xb')]=_0x23e916[0x7]+_0xb0e9('0xa')+_0x4499f0+'|'+_0x520499+'|'+_0x43817a+'|'+_0x5495b4+'|'+_0x1e78b1+'|'+_0x5ad754+'|'+_0x3dc8c4;_0x2e56e6[_0xb0e9('0xc')]=_0x23e916[0x9];var _0x18e433={};_0x18e433['jsonrpc']=_0xb0e9('0xd');_0x18e433['method']=_0xb0e9('0xe');var _0xa242f8=[];_0xa242f8[_0xb0e9('0x8')](_0x23e916[0x2]);_0xa242f8[_0xb0e9('0x8')](_0x23e916[0x5]);_0xa242f8[_0xb0e9('0x8')](_0x23e916[0x6]);_0x18e433[_0xb0e9('0xf')]=_0xa242f8;_0x18e433['id']=0x1;var _0x231718=JSON[_0xb0e9('0x10')](_0x18e433);var _0x5678fa={'encoding':'utf8','method':_0xb0e9('0x11'),'timeout':0x2710,'url':_0x51de51,'headers':{'Content-Type':_0xb0e9('0x12')},'body':_0x231718};return rp(_0x5678fa)['then'](function(_0x1711e9){const _0x2680b8=JSON[_0xb0e9('0x13')](_0x1711e9);if(!_0x2680b8[_0xb0e9('0x14')][_0xb0e9('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x4ac6e4=_0x5495b4;var _0x5b859c=_0xb0e9('0x16')+_0x287260+'&serviceId='+_0x3ab637+_0xb0e9('0x17')+_0x4ac6e4+_0xb0e9('0x18')+JSON[_0xb0e9('0x10')](_0x2e56e6);var _0x4ac393=_0x3f145b+'?'+_0x5b859c;return rp(_0x4ac393);})[_0xb0e9('0x19')](function(_0x4803b4){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4dff15,_0x4803b4);_0x142814[_0xb0e9('0x1a')]();})[_0xb0e9('0x1b')](function(_0x1d559d){logger['error'](_0xb0e9('0x1c'),_0x4dff15,_['isObject'](_0x1d559d)?JSON['stringify'](_0x1d559d):_0x1d559d);_0x142814[_0xb0e9('0x1a')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x4dff15);_0x142814[_0xb0e9('0x1d')]();}};}; \ 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 b3e5bea..7d36e96 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x388526,_0x1dba9d){var _0x2e76b0=function(_0x2a450a){while(--_0x2a450a){_0x388526['push'](_0x388526['shift']());}};_0x2e76b0(++_0x1dba9d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2cf233,_0x412d6b){var _0x2a829c=function(_0x364d67){while(--_0x364d67){_0x2cf233['push'](_0x2cf233['shift']());}};_0x2a829c(++_0x412d6b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7271b92..69beeab 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 _0xdadc=['waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','isArray','applications','length','existsSync','app','.js','toLowerCase','split','push','slice','dialogflow','appdata','join','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','emit','Skipped\x20routing\x20for\x20%s','stack','agent','agents','end','QueueReport','update','catch','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues','available','loggedIn','name','paused'];(function(_0x3120e6,_0x324456){var _0x5b739f=function(_0x2e03ab){while(--_0x2e03ab){_0x3120e6['push'](_0x3120e6['shift']());}};_0x5b739f(++_0x324456);}(_0xdadc,0x75));var _0xcdad=function(_0x4f9210,_0x41006d){_0x4f9210=_0x4f9210-0x0;var _0x9b4dc5=_0xdadc[_0x4f9210];return _0x9b4dc5;};'use strict';var _=require(_0xcdad('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xcdad('0x1'));var BPromise=require(_0xcdad('0x2'));var utils=require(_0xcdad('0x3'));var sUtils=require(_0xcdad('0x4'));var logger=require(_0xcdad('0x5'))(_0xcdad('0x6'));var rpc={'openchannelQueueReport':require(_0xcdad('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xcdad('0x8')),'smsQueueReport':require(_0xcdad('0x9')),'faxQueueReport':require(_0xcdad('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0xe8e0c6,_0x12f7f7,_0x1e5607){return util['format'](_0xcdad('0xb'),_0xe8e0c6,_0x12f7f7||0x0,_0x1e5607||0x0);}function getIntervals(_0x194878,_0x31b674){var _0x523085=[];if(!_['isNil'](_0x31b674['IntervalId'])&&!_[_0xcdad('0xc')](_0x194878[_0x31b674[_0xcdad('0xd')]])&&!_[_0xcdad('0xc')](_0x194878[_0x31b674[_0xcdad('0xd')]][_0xcdad('0xe')])){_0x523085=_[_0xcdad('0xf')](_0x194878[_0x31b674[_0xcdad('0xd')]][_0xcdad('0xe')],'interval');}else if(!_['isNil'](_0x31b674[_0xcdad('0x10')])){_0x523085=[_0x31b674[_0xcdad('0x10')]];}return _0x523085;}exports['listen']=function(_0x477d12){_0x477d12[_0xcdad('0x11')]={};return new BPromise(function(_0x1df46e,_0x419589){var _0xc9a15e={'Start':function(_0xdddda5){var _0x1b7cab=this;return new Promise(function(_0x53eb63,_0x54b2fe){if(_0xdddda5){try{var _0x541a28=[];var _0x2b41b3=getId(_0xdddda5[_0xcdad('0x12')],_0xdddda5['message']?_0xdddda5[_0xcdad('0x13')]['id']:0x0,_0xdddda5['interaction']?_0xdddda5[_0xcdad('0x14')]['id']:0x0);var _0x3eb574=sUtils[_0xcdad('0x15')](_0x477d12,_0xdddda5);if(_0xdddda5[_0xcdad('0x16')]||!_0x3eb574&&_0xdddda5['applications']&&_[_0xcdad('0x17')](_0xdddda5[_0xcdad('0x18')])&&_0xdddda5[_0xcdad('0x18')][_0xcdad('0x19')]){for(var _0x26c7af=0x0;_0x26c7af<_0xdddda5[_0xcdad('0x18')][_0xcdad('0x19')];_0x26c7af+=0x1){var _0x496b99=_0xdddda5[_0xcdad('0x18')][_0x26c7af];if(fs[_0xcdad('0x1a')](path['join'](__dirname,_0xcdad('0x18'),_0x496b99[_0xcdad('0x1b')]+_0xcdad('0x1c')))){var _0x163896=[];switch(_0x496b99[_0xcdad('0x1b')][_0xcdad('0x1d')]()){case'autoreply':var _0x26005e=_0x496b99['appdata'][_0xcdad('0x1e')](',');if(_0xdddda5[_0xcdad('0x12')]==='mail'){_0x163896[_0xcdad('0x1f')](_0x26005e[0x0]);_0x163896[_0xcdad('0x1f')](_0x26005e[0x1]);_0x163896[_0xcdad('0x1f')](_0x26005e[_0xcdad('0x20')](0x2,_0x26005e[_0xcdad('0x19')])['join'](','));}else{_0x163896['push'](_0x26005e[0x0]);_0x163896[_0xcdad('0x1f')](_0x26005e[_0xcdad('0x20')](0x1,_0x26005e['length'])['join'](','));}break;case _0xcdad('0x21'):var _0x3ff588=_0x496b99[_0xcdad('0x22')]['split'](',');_0x163896[_0xcdad('0x1f')](_0x3ff588[0x0]);_0x163896[_0xcdad('0x1f')](_0x3ff588[0x1]);_0x163896[_0xcdad('0x1f')](_0x3ff588[_0xcdad('0x20')](0x2,_0x3ff588[_0xcdad('0x19')])[_0xcdad('0x23')](','));break;case _0xcdad('0x24'):var _0x2f02ca=_0x496b99[_0xcdad('0x22')][_0xcdad('0x1e')](',');_0x163896[_0xcdad('0x1f')](_0x2f02ca[0x0]);_0x163896[_0xcdad('0x1f')](_0x2f02ca[0x1]);_0x163896['push'](_0x2f02ca[0x2]);_0x163896[_0xcdad('0x1f')](_0x2f02ca[0x3]);_0x163896[_0xcdad('0x1f')](_0x2f02ca['slice'](0x4,_0x2f02ca['length'])[_0xcdad('0x23')](','));break;case _0xcdad('0x25'):var _0x3e8cc5=_0x496b99['appdata'][_0xcdad('0x1e')](',');_0x163896[_0xcdad('0x1f')](_0x3e8cc5[0x0]);_0x163896[_0xcdad('0x1f')](_0x3e8cc5[0x1]);_0x163896[_0xcdad('0x1f')](_0x3e8cc5[0x2]);_0x163896['push'](_0x3e8cc5[0x3]);_0x163896[_0xcdad('0x1f')](_0x3e8cc5[_0xcdad('0x20')](0x4,_0x3e8cc5['length'])['join'](','));break;case _0xcdad('0x13'):_0x163896[_0xcdad('0x1f')](_0x496b99[_0xcdad('0x22')]);break;case _0xcdad('0x26'):_0x163896['push'](_0x496b99['TagId']);_0x163896['push'](_0x496b99[_0xcdad('0x22')]);break;case _0xcdad('0x27'):var _0x24e9a3=utils[_0xcdad('0x28')](_0xdddda5[_0xcdad('0x29')][_0xcdad('0x2a')],_0xdddda5);var _0x28ab33=_0x496b99['appdata'][_0xcdad('0x1e')](',');_0x163896[_0xcdad('0x1f')](_0x28ab33[0x0]);_0x163896[_0xcdad('0x1f')](_0x28ab33[0x1]);_0x163896['push'](_0x28ab33[0x2]);_0x163896[_0xcdad('0x1f')](_0x28ab33[0x3]);_0x163896['push'](_0x28ab33[0x4]);_0x163896['push'](_0x28ab33[0x5]);_0x163896[_0xcdad('0x1f')](_0x28ab33[0x6]);_0x163896[_0xcdad('0x1f')](_0x28ab33[0x7]);_0x163896[_0xcdad('0x1f')](_0x28ab33[0x8]);_0x163896['push'](_0x28ab33[0x9]);_0x163896[_0xcdad('0x1f')](_0x28ab33[0xa]);_0x163896[_0xcdad('0x1f')](_0xdddda5['interaction']['id']);_0x163896['push'](_0xdddda5['message']['id']);_0x163896[_0xcdad('0x1f')](_0x496b99[_0xcdad('0x2b')]);_0x163896[_0xcdad('0x1f')](_0xdddda5[_0xcdad('0x14')][_0xcdad('0x2c')]);_0x163896['push'](_0xdddda5[_0xcdad('0x2d')]['body']);_0x163896[_0xcdad('0x1f')](_0x24e9a3);break;default:_0x163896=_[_0xcdad('0xc')](_0x496b99['appdata'])?[]:_0x496b99[_0xcdad('0x22')][_0xcdad('0x1e')](',');}var _0x1a8708={'id':util[_0xcdad('0x2e')](_0xcdad('0x2f'),_0x2b41b3,_0x496b99['id'],_0x496b99[_0xcdad('0x1b')]),'condition':require(_0xcdad('0x30'))[_0xcdad('0x31')](_0x2b41b3,getIntervals(_0x477d12[_0xcdad('0x32')],_0x496b99),_0x477d12),'consequence':require(_0xcdad('0x33')+_0x496b99[_0xcdad('0x1b')])['consequence'](_0x2b41b3,_0x163896,_0x477d12,_0xdddda5),'p':_0x496b99[_0xcdad('0x34')]||0x0};logger[_0xcdad('0x35')](_0xcdad('0x36'),_0x1a8708['id'],_0xcdad('0x37'),getIntervals(_0x477d12[_0xcdad('0x32')],_0x496b99)[_0xcdad('0x23')]('\x20|\x20'));_0x541a28['push'](_0x1a8708);}else{logger[_0xcdad('0x38')](_0xcdad('0x39'),path['join'](__dirname,_0xcdad('0x18'),_0x496b99[_0xcdad('0x1b')]+_0xcdad('0x1c')));}}_0x477d12[_0xcdad('0x11')][_0x2b41b3]=new RuleEngine(_0x541a28);_0x477d12[_0xcdad('0x11')][_0x2b41b3][_0xcdad('0x3a')](_0xdddda5,function(_0x39a805){logger[_0xcdad('0x35')]('Applications\x20executed',JSON[_0xcdad('0x3b')](_0x39a805['matchPath']));if(_0x477d12[_0xcdad('0x11')][_0x2b41b3]){_0x477d12[_0xcdad('0x11')][_0x2b41b3][_0xcdad('0x3c')]('complete');}});return _0x53eb63({'code':0xc8,'message':_0xdddda5});}else{if(_0x3eb574){logger['info'](util[_0xcdad('0x2e')](_0xcdad('0x3d'),_0x2b41b3));}else{logger[_0xcdad('0x35')]('No\x20applications\x20to\x20execute');}return _0x53eb63({'code':0xc8,'message':_0xdddda5});}}catch(_0x434e74){logger[_0xcdad('0x38')](_0x434e74[_0xcdad('0x3e')]);return _0x54b2fe(_0x1b7cab[_0xcdad('0x38')](0x1f4,_0x434e74));}}return _0x54b2fe('routing\x20is\x20empty');});},'AcceptMessage':function(_0x3e77d7){var _0x2a67cb=this;return new Promise(function(_0x915121,_0x19ea59){if(_0x3e77d7['agent']&&_0x3e77d7[_0xcdad('0x3f')]['id']){if(_0x477d12[_0xcdad('0x40')][_0x3e77d7[_0xcdad('0x3f')]['id']]){_0x477d12['agents'][_0x3e77d7[_0xcdad('0x3f')]['id']]['busy']=![];_0x477d12[_0xcdad('0x40')][_0x3e77d7['agent']['id']]['busyQueue']=undefined;}}if(_0x3e77d7[_0xcdad('0x13')]&&_0x3e77d7['message']['id']){try{var _0x551fa3=getId(_0x3e77d7[_0xcdad('0x12')],_0x3e77d7[_0xcdad('0x13')]?_0x3e77d7[_0xcdad('0x13')]['id']:0x0,_0x3e77d7[_0xcdad('0x14')]?_0x3e77d7[_0xcdad('0x14')]['id']:0x0);if(_0x477d12[_0xcdad('0x11')][_0x551fa3]){_0x477d12[_0xcdad('0x11')][_0x551fa3][_0xcdad('0x3c')](_0xcdad('0x41'));if(rpc[_0x3e77d7[_0xcdad('0x12')]+_0xcdad('0x42')]){rpc[_0x3e77d7['channel']+_0xcdad('0x42')][_0xcdad('0x43')](_0x551fa3,{'UserId':_0x3e77d7[_0xcdad('0x13')]['UserId']})[_0xcdad('0x44')](function(){logger[_0xcdad('0x38')]('error\x20update\x20queue\x20report');});}}return _0x915121({'code':0xc8,'message':_0x3e77d7});}catch(_0x57440a){logger[_0xcdad('0x38')](_0x57440a[_0xcdad('0x3e')]);return _0x19ea59(_0x2a67cb[_0xcdad('0x38')](0x1f4,_0x57440a));}}logger[_0xcdad('0x38')](_0xcdad('0x45'));return _0x19ea59(_0x2a67cb[_0xcdad('0x38')](0x1f4,_0xcdad('0x45')));});},'RejectMessage':function(_0x1e918a){var _0x189da7=this;return new Promise(function(_0x5d6603,_0x2c35b3){if(_0x1e918a[_0xcdad('0x3f')]&&_0x1e918a['agent']['id']){try{if(_0x477d12['agents'][_0x1e918a['agent']['id']]){_0x477d12[_0xcdad('0x40')][_0x1e918a['agent']['id']][_0xcdad('0x46')]=![];_0x477d12[_0xcdad('0x40')][_0x1e918a['agent']['id']]['busyQueue']=undefined;}return _0x5d6603({'code':0xc8,'message':_0x1e918a});}catch(_0x2a4fce){logger[_0xcdad('0x38')](_0x2a4fce[_0xcdad('0x3e')]);return _0x2c35b3(_0x189da7[_0xcdad('0x38')](0x1f4,_0x2a4fce));}}logger[_0xcdad('0x38')]('message\x20is\x20empty');return _0x2c35b3(_0x189da7[_0xcdad('0x38')](0x1f4,_0xcdad('0x45')));});},'AbandonInteraction':function(_0x2f507f){var _0x1c14d1=this;return new Promise(function(_0x390380,_0x323592){if(_0x2f507f[_0xcdad('0x12')]&&_0x2f507f['interaction']&&_0x2f507f[_0xcdad('0x14')]['id']){try{var _0x9a95cc=getId(_0x2f507f[_0xcdad('0x12')],_0x2f507f[_0xcdad('0x13')]?_0x2f507f['message']['id']:0x0,_0x2f507f[_0xcdad('0x14')]?_0x2f507f[_0xcdad('0x14')]['id']:0x0);if(_0x477d12[_0xcdad('0x11')][_0x9a95cc]){_0x477d12[_0xcdad('0x11')][_0x9a95cc]['emit'](_0xcdad('0x41'));}return _0x390380({'code':0xc8,'message':_0x2f507f});}catch(_0x677ef0){logger[_0xcdad('0x38')](_0x677ef0[_0xcdad('0x3e')]);return _0x323592(_0x1c14d1['error'](0x1f4,_0x677ef0));}}logger[_0xcdad('0x38')](_0xcdad('0x45'));return _0x323592(_0x1c14d1['error'](0x1f4,_0xcdad('0x45')));});},'AgentCapacity':function(_0x5c347d){var _0x20a3f4=this;return new Promise(function(_0x3a118c,_0x5e9d07){if(_0x477d12[_0xcdad('0x40')][_0xcdad('0x47')](_0x5c347d['id'])){for(var _0x3d5c64 in _0x5c347d[_0xcdad('0x48')]){if(_0x5c347d[_0xcdad('0x48')][_0xcdad('0x47')](_0x3d5c64)){if(_0x477d12[_0xcdad('0x40')][_0x5c347d['id']][_0xcdad('0x47')](_0x3d5c64+_0xcdad('0x49'))){_0x477d12[_0xcdad('0x40')][_0x5c347d['id']][_0x3d5c64+_0xcdad('0x49')]=parseInt(_0x5c347d[_0xcdad('0x48')][_0x3d5c64],0xa);}}}_0x477d12[_0xcdad('0x40')][_0x5c347d['id']][_0xcdad('0x4a')]();return _0x3a118c({'code':0xc8,'message':_0x477d12[_0xcdad('0x40')][_0x5c347d['id']]});}else{return _0x5e9d07(_0x20a3f4['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1aca0c){return new Promise(function(_0x20f430){var _0xe4a0cb=_['values'](_0x477d12[_0xcdad('0x40')]);if(_0x1aca0c&&_0x1aca0c['id']){var _0x271ff6=_[_0xcdad('0x4b')](_0xe4a0cb,function(_0xb5db02){return _0xb5db02['id']===_0x1aca0c['id'];});_0x20f430(_0x271ff6);}else{_0x20f430({'count':_0xe4a0cb[_0xcdad('0x19')],'rows':_0xe4a0cb});}});},'ChatQueues':function(){return new Promise(function(_0x13bcca){var _0x3e6adb=[];for(var _0x505e81 in _0x477d12[_0xcdad('0x4c')]){if(_0x477d12[_0xcdad('0x4c')][_0xcdad('0x47')](_0x505e81)){var _0x393207=_0x477d12['chatQueues'][_0x505e81];var _0x3bbf0b={'id':_0x393207['id'],'available':_0x393207[_0xcdad('0x4d')],'loggedIn':_0x393207[_0xcdad('0x4e')],'name':_0x393207[_0xcdad('0x4f')],'paused':_0x393207[_0xcdad('0x50')],'waiting':_0x393207[_0xcdad('0x51')]};_0x3e6adb[_0xcdad('0x1f')](_0x3bbf0b);}}_0x13bcca({'count':_0x3e6adb[_0xcdad('0x19')],'rows':_0x3e6adb});});},'MailQueues':function(){return new Promise(function(_0x46a387){var _0x5d4357=[];for(var _0x580852 in _0x477d12['mailQueues']){if(_0x477d12[_0xcdad('0x52')][_0xcdad('0x47')](_0x580852)){var _0x235cf7=_0x477d12[_0xcdad('0x52')][_0x580852];var _0x1ff54a={'id':_0x235cf7['id'],'available':_0x235cf7[_0xcdad('0x4d')],'loggedIn':_0x235cf7[_0xcdad('0x4e')],'name':_0x235cf7[_0xcdad('0x4f')],'paused':_0x235cf7[_0xcdad('0x50')],'waiting':_0x235cf7[_0xcdad('0x51')]};_0x5d4357[_0xcdad('0x1f')](_0x1ff54a);}}_0x46a387({'count':_0x5d4357[_0xcdad('0x19')],'rows':_0x5d4357});});},'OpenchannelQueues':function(){return new Promise(function(_0x86f6f0){var _0x391b64=[];for(var _0x502a70 in _0x477d12['openchannelQueues']){if(_0x477d12[_0xcdad('0x53')][_0xcdad('0x47')](_0x502a70)){var _0x37abf1=_0x477d12['openchannelQueues'][_0x502a70];var _0x2e2979={'id':_0x37abf1['id'],'available':_0x37abf1[_0xcdad('0x4d')],'loggedIn':_0x37abf1[_0xcdad('0x4e')],'name':_0x37abf1[_0xcdad('0x4f')],'paused':_0x37abf1[_0xcdad('0x50')],'waiting':_0x37abf1[_0xcdad('0x51')]};_0x391b64[_0xcdad('0x1f')](_0x2e2979);}}_0x86f6f0({'count':_0x391b64[_0xcdad('0x19')],'rows':_0x391b64});});},'SmsQueues':function(){return new Promise(function(_0x3dbafa){var _0x49bfd1=[];for(var _0x2c2f0e in _0x477d12['smsQueues']){if(_0x477d12[_0xcdad('0x54')][_0xcdad('0x47')](_0x2c2f0e)){var _0x292c89=_0x477d12[_0xcdad('0x54')][_0x2c2f0e];var _0x2c6c04={'id':_0x292c89['id'],'available':_0x292c89[_0xcdad('0x4d')],'loggedIn':_0x292c89['loggedIn'],'name':_0x292c89[_0xcdad('0x4f')],'paused':_0x292c89[_0xcdad('0x50')],'waiting':_0x292c89[_0xcdad('0x51')]};_0x49bfd1['push'](_0x2c6c04);}}_0x3dbafa({'count':_0x49bfd1[_0xcdad('0x19')],'rows':_0x49bfd1});});},'FaxQueues':function(){return new Promise(function(_0x3ff673){var _0x5688e9=[];for(var _0x38d0d6 in _0x477d12['faxQueues']){if(_0x477d12[_0xcdad('0x55')][_0xcdad('0x47')](_0x38d0d6)){var _0x5e1c02=_0x477d12[_0xcdad('0x55')][_0x38d0d6];var _0x2d68ad={'id':_0x5e1c02['id'],'available':_0x5e1c02[_0xcdad('0x4d')],'loggedIn':_0x5e1c02[_0xcdad('0x4e')],'name':_0x5e1c02['name'],'paused':_0x5e1c02[_0xcdad('0x50')],'waiting':_0x5e1c02[_0xcdad('0x51')]};_0x5688e9[_0xcdad('0x1f')](_0x2d68ad);}}_0x3ff673({'count':_0x5688e9[_0xcdad('0x19')],'rows':_0x5688e9});});},'WhatsappQueues':function(){return new Promise(function(_0x1bbf3f){var _0x345ced=[];for(var _0x13de84 in _0x477d12[_0xcdad('0x56')]){if(_0x477d12[_0xcdad('0x56')][_0xcdad('0x47')](_0x13de84)){var _0x44a43b=_0x477d12[_0xcdad('0x56')][_0x13de84];var _0x2982e0={'id':_0x44a43b['id'],'available':_0x44a43b[_0xcdad('0x4d')],'loggedIn':_0x44a43b[_0xcdad('0x4e')],'name':_0x44a43b[_0xcdad('0x4f')],'paused':_0x44a43b[_0xcdad('0x50')],'waiting':_0x44a43b[_0xcdad('0x51')]};_0x345ced[_0xcdad('0x1f')](_0x2982e0);}}_0x1bbf3f({'count':_0x345ced[_0xcdad('0x19')],'rows':_0x345ced});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1e3e68){var _0x4a4c19=_['values'](_0x477d12[_0xcdad('0x57')]);_0x1e3e68({'count':_0x4a4c19[_0xcdad('0x19')],'rows':_0x4a4c19});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x45aebc){var _0x586fa8=_[_0xcdad('0x58')](_0x477d12['mailQueuesWaitingInteractions']);_0x45aebc({'count':_0x586fa8['length'],'rows':_0x586fa8});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1b6c02){var _0x125f2d=_[_0xcdad('0x58')](_0x477d12[_0xcdad('0x59')]);_0x1b6c02({'count':_0x125f2d[_0xcdad('0x19')],'rows':_0x125f2d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x10b948){var _0x569c4a=_[_0xcdad('0x58')](_0x477d12['smsQueuesWaitingInteractions']);_0x10b948({'count':_0x569c4a[_0xcdad('0x19')],'rows':_0x569c4a});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x18a796){var _0x1edfce=_[_0xcdad('0x58')](_0x477d12[_0xcdad('0x5a')]);_0x18a796({'count':_0x1edfce[_0xcdad('0x19')],'rows':_0x1edfce});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3ba0b5){var _0x4d1863=_[_0xcdad('0x58')](_0x477d12[_0xcdad('0x5b')]);_0x3ba0b5({'count':_0x4d1863['length'],'rows':_0x4d1863});});}};var _0x8f710b=jayson[_0xcdad('0x5c')](_0xc9a15e)[_0xcdad('0x5d')]();_0x8f710b['on']('error',function(_0x43e5e4){logger[_0xcdad('0x38')](JSON['stringify'](_0x43e5e4));return _0x419589(_0x43e5e4);});_0x8f710b[_0xcdad('0x5e')](0x232c,_0xcdad('0x5f'),function(){console[_0xcdad('0x60')](_0xcdad('0x61'),0x232c);return _0x1df46e(_0xcdad('0x62')+0x232c);});});}; \ No newline at end of file +var _0x853e=['util','jayson/promise','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','getMustacheRender','account','notificationTemplate','ContactId','body','condition','intervals','./applications/','consequence','priority','info','on\x20interval','error','.js','rules','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agents','agent','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','capacity','hasOwnProperty','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:'];(function(_0x4f7bdb,_0x2520cf){var _0x32d063=function(_0x613476){while(--_0x613476){_0x4f7bdb['push'](_0x4f7bdb['shift']());}};_0x32d063(++_0x2520cf);}(_0x853e,0x1ea));var _0xe853=function(_0x2d630f,_0x28c4ac){_0x2d630f=_0x2d630f-0x0;var _0x15b711=_0x853e[_0x2d630f];return _0x15b711;};'use strict';var _=require('lodash');var util=require(_0xe853('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0xe853('0x1'));var BPromise=require('bluebird');var utils=require(_0xe853('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0xe853('0x3'))(_0xe853('0x4'));var rpc={'openchannelQueueReport':require(_0xe853('0x5')),'mailQueueReport':require(_0xe853('0x6')),'chatQueueReport':require(_0xe853('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe853('0x8')),'whatsappQueueReport':require(_0xe853('0x9'))};var RuleEngine=require(_0xe853('0xa'));function getId(_0x25e6e1,_0xe3d468,_0x36d502){return util[_0xe853('0xb')](_0xe853('0xc'),_0x25e6e1,_0xe3d468||0x0,_0x36d502||0x0);}function getIntervals(_0x213f17,_0x15bfe2){var _0x478b19=[];if(!_['isNil'](_0x15bfe2['IntervalId'])&&!_[_0xe853('0xd')](_0x213f17[_0x15bfe2['IntervalId']])&&!_['isNil'](_0x213f17[_0x15bfe2[_0xe853('0xe')]][_0xe853('0xf')])){_0x478b19=_[_0xe853('0x10')](_0x213f17[_0x15bfe2['IntervalId']][_0xe853('0xf')],_0xe853('0x11'));}else if(!_[_0xe853('0xd')](_0x15bfe2[_0xe853('0x11')])){_0x478b19=[_0x15bfe2[_0xe853('0x11')]];}return _0x478b19;}exports[_0xe853('0x12')]=function(_0x1ebf13){_0x1ebf13['rules']={};return new BPromise(function(_0x4b8e2c,_0x5db22d){var _0x552812={'Start':function(_0x156940){var _0x3840b5=this;return new Promise(function(_0x41c489,_0x11e4a0){if(_0x156940){try{var _0x21c5f0=[];var _0x9309a5=getId(_0x156940[_0xe853('0x13')],_0x156940[_0xe853('0x14')]?_0x156940[_0xe853('0x14')]['id']:0x0,_0x156940[_0xe853('0x15')]?_0x156940[_0xe853('0x15')]['id']:0x0);var _0x1d2526=sUtils[_0xe853('0x16')](_0x1ebf13,_0x156940);if(_0x156940[_0xe853('0x17')]||!_0x1d2526&&_0x156940[_0xe853('0x18')]&&_[_0xe853('0x19')](_0x156940['applications'])&&_0x156940[_0xe853('0x18')][_0xe853('0x1a')]){for(var _0x386225=0x0;_0x386225<_0x156940[_0xe853('0x18')][_0xe853('0x1a')];_0x386225+=0x1){var _0x1ade8a=_0x156940[_0xe853('0x18')][_0x386225];if(fs[_0xe853('0x1b')](path[_0xe853('0x1c')](__dirname,_0xe853('0x18'),_0x1ade8a[_0xe853('0x1d')]+'.js'))){var _0x110362=[];switch(_0x1ade8a[_0xe853('0x1d')][_0xe853('0x1e')]()){case _0xe853('0x1f'):var _0x1af209=_0x1ade8a[_0xe853('0x20')][_0xe853('0x21')](',');if(_0x156940[_0xe853('0x13')]==='mail'){_0x110362[_0xe853('0x22')](_0x1af209[0x0]);_0x110362[_0xe853('0x22')](_0x1af209[0x1]);_0x110362[_0xe853('0x22')](_0x1af209[_0xe853('0x23')](0x2,_0x1af209[_0xe853('0x1a')])['join'](','));}else{_0x110362[_0xe853('0x22')](_0x1af209[0x0]);_0x110362[_0xe853('0x22')](_0x1af209['slice'](0x1,_0x1af209[_0xe853('0x1a')])['join'](','));}break;case _0xe853('0x24'):var _0x545738=_0x1ade8a['appdata'][_0xe853('0x21')](',');_0x110362[_0xe853('0x22')](_0x545738[0x0]);_0x110362[_0xe853('0x22')](_0x545738[0x1]);_0x110362[_0xe853('0x22')](_0x545738[_0xe853('0x23')](0x2,_0x545738[_0xe853('0x1a')])[_0xe853('0x1c')](','));break;case _0xe853('0x25'):var _0x204a5a=_0x1ade8a[_0xe853('0x20')][_0xe853('0x21')](',');_0x110362['push'](_0x204a5a[0x0]);_0x110362[_0xe853('0x22')](_0x204a5a[0x1]);_0x110362[_0xe853('0x22')](_0x204a5a[0x2]);_0x110362['push'](_0x204a5a[0x3]);_0x110362[_0xe853('0x22')](_0x204a5a['slice'](0x4,_0x204a5a[_0xe853('0x1a')])[_0xe853('0x1c')](','));break;case _0xe853('0x26'):var _0x4e8fe0=_0x1ade8a[_0xe853('0x20')][_0xe853('0x21')](',');_0x110362[_0xe853('0x22')](_0x4e8fe0[0x0]);_0x110362[_0xe853('0x22')](_0x4e8fe0[0x1]);_0x110362[_0xe853('0x22')](_0x4e8fe0[0x2]);_0x110362[_0xe853('0x22')](_0x4e8fe0[0x3]);_0x110362[_0xe853('0x22')](_0x4e8fe0[_0xe853('0x23')](0x4,_0x4e8fe0[_0xe853('0x1a')])[_0xe853('0x1c')](','));break;case _0xe853('0x14'):_0x110362['push'](_0x1ade8a[_0xe853('0x20')]);break;case'tag':_0x110362[_0xe853('0x22')](_0x1ade8a[_0xe853('0x27')]);_0x110362[_0xe853('0x22')](_0x1ade8a[_0xe853('0x20')]);break;case'tvox':var _0x37c67c=utils[_0xe853('0x28')](_0x156940[_0xe853('0x29')][_0xe853('0x2a')],_0x156940);var _0x3f794b=_0x1ade8a[_0xe853('0x20')]['split'](',');_0x110362[_0xe853('0x22')](_0x3f794b[0x0]);_0x110362[_0xe853('0x22')](_0x3f794b[0x1]);_0x110362[_0xe853('0x22')](_0x3f794b[0x2]);_0x110362[_0xe853('0x22')](_0x3f794b[0x3]);_0x110362[_0xe853('0x22')](_0x3f794b[0x4]);_0x110362[_0xe853('0x22')](_0x3f794b[0x5]);_0x110362[_0xe853('0x22')](_0x3f794b[0x6]);_0x110362[_0xe853('0x22')](_0x3f794b[0x7]);_0x110362[_0xe853('0x22')](_0x3f794b[0x8]);_0x110362['push'](_0x3f794b[0x9]);_0x110362['push'](_0x3f794b[0xa]);_0x110362[_0xe853('0x22')](_0x156940[_0xe853('0x15')]['id']);_0x110362[_0xe853('0x22')](_0x156940['message']['id']);_0x110362[_0xe853('0x22')](_0x1ade8a['ChatWebsiteId']);_0x110362['push'](_0x156940['interaction'][_0xe853('0x2b')]);_0x110362[_0xe853('0x22')](_0x156940[_0xe853('0x2c')]['body']);_0x110362[_0xe853('0x22')](_0x37c67c);break;default:_0x110362=_[_0xe853('0xd')](_0x1ade8a[_0xe853('0x20')])?[]:_0x1ade8a[_0xe853('0x20')][_0xe853('0x21')](',');}var _0x9fca20={'id':util['format']('%s:%s:%s',_0x9309a5,_0x1ade8a['id'],_0x1ade8a[_0xe853('0x1d')]),'condition':require('./interval')[_0xe853('0x2d')](_0x9309a5,getIntervals(_0x1ebf13[_0xe853('0x2e')],_0x1ade8a),_0x1ebf13),'consequence':require(_0xe853('0x2f')+_0x1ade8a[_0xe853('0x1d')])[_0xe853('0x30')](_0x9309a5,_0x110362,_0x1ebf13,_0x156940),'p':_0x1ade8a[_0xe853('0x31')]||0x0};logger[_0xe853('0x32')]('Push\x20new\x20rule',_0x9fca20['id'],_0xe853('0x33'),getIntervals(_0x1ebf13[_0xe853('0x2e')],_0x1ade8a)[_0xe853('0x1c')]('\x20|\x20'));_0x21c5f0[_0xe853('0x22')](_0x9fca20);}else{logger[_0xe853('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xe853('0x1c')](__dirname,_0xe853('0x18'),_0x1ade8a['app']+_0xe853('0x35')));}}_0x1ebf13[_0xe853('0x36')][_0x9309a5]=new RuleEngine(_0x21c5f0);_0x1ebf13[_0xe853('0x36')][_0x9309a5][_0xe853('0x37')](_0x156940,function(_0x4c697e){logger[_0xe853('0x32')]('Applications\x20executed',JSON[_0xe853('0x38')](_0x4c697e[_0xe853('0x39')]));if(_0x1ebf13[_0xe853('0x36')][_0x9309a5]){_0x1ebf13['rules'][_0x9309a5][_0xe853('0x3a')](_0xe853('0x3b'));}});return _0x41c489({'code':0xc8,'message':_0x156940});}else{if(_0x1d2526){logger['info'](util[_0xe853('0xb')]('Skipped\x20routing\x20for\x20%s',_0x9309a5));}else{logger[_0xe853('0x32')](_0xe853('0x3c'));}return _0x41c489({'code':0xc8,'message':_0x156940});}}catch(_0x34b5fb){logger[_0xe853('0x34')](_0x34b5fb['stack']);return _0x11e4a0(_0x3840b5['error'](0x1f4,_0x34b5fb));}}return _0x11e4a0(_0xe853('0x3d'));});},'AcceptMessage':function(_0x176dc8){var _0x4a2f33=this;return new Promise(function(_0x3447e3,_0x26b40b){if(_0x176dc8['agent']&&_0x176dc8['agent']['id']){if(_0x1ebf13[_0xe853('0x3e')][_0x176dc8[_0xe853('0x3f')]['id']]){_0x1ebf13[_0xe853('0x3e')][_0x176dc8[_0xe853('0x3f')]['id']][_0xe853('0x40')]=![];_0x1ebf13[_0xe853('0x3e')][_0x176dc8[_0xe853('0x3f')]['id']][_0xe853('0x41')]=undefined;}}if(_0x176dc8[_0xe853('0x14')]&&_0x176dc8[_0xe853('0x14')]['id']){try{var _0x4e493e=getId(_0x176dc8['channel'],_0x176dc8[_0xe853('0x14')]?_0x176dc8[_0xe853('0x14')]['id']:0x0,_0x176dc8['interaction']?_0x176dc8[_0xe853('0x15')]['id']:0x0);if(_0x1ebf13[_0xe853('0x36')][_0x4e493e]){_0x1ebf13['rules'][_0x4e493e][_0xe853('0x3a')](_0xe853('0x42'));if(rpc[_0x176dc8[_0xe853('0x13')]+'QueueReport']){rpc[_0x176dc8[_0xe853('0x13')]+_0xe853('0x43')]['update'](_0x4e493e,{'UserId':_0x176dc8[_0xe853('0x14')][_0xe853('0x44')]})[_0xe853('0x45')](function(){logger[_0xe853('0x34')](_0xe853('0x46'));});}}return _0x3447e3({'code':0xc8,'message':_0x176dc8});}catch(_0x29933f){logger[_0xe853('0x34')](_0x29933f[_0xe853('0x47')]);return _0x26b40b(_0x4a2f33['error'](0x1f4,_0x29933f));}}logger[_0xe853('0x34')](_0xe853('0x48'));return _0x26b40b(_0x4a2f33[_0xe853('0x34')](0x1f4,_0xe853('0x48')));});},'RejectMessage':function(_0x293f8f){var _0x251797=this;return new Promise(function(_0x313fcd,_0x98bbc){if(_0x293f8f[_0xe853('0x3f')]&&_0x293f8f[_0xe853('0x3f')]['id']){try{if(_0x1ebf13[_0xe853('0x3e')][_0x293f8f[_0xe853('0x3f')]['id']]){_0x1ebf13[_0xe853('0x3e')][_0x293f8f[_0xe853('0x3f')]['id']][_0xe853('0x40')]=![];_0x1ebf13[_0xe853('0x3e')][_0x293f8f['agent']['id']][_0xe853('0x41')]=undefined;}return _0x313fcd({'code':0xc8,'message':_0x293f8f});}catch(_0x52f84d){logger[_0xe853('0x34')](_0x52f84d[_0xe853('0x47')]);return _0x98bbc(_0x251797[_0xe853('0x34')](0x1f4,_0x52f84d));}}logger['error'](_0xe853('0x48'));return _0x98bbc(_0x251797[_0xe853('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x57d1b4){var _0x35f431=this;return new Promise(function(_0x2bfdc7,_0x521f55){if(_0x57d1b4[_0xe853('0x13')]&&_0x57d1b4[_0xe853('0x15')]&&_0x57d1b4[_0xe853('0x15')]['id']){try{var _0x256dec=getId(_0x57d1b4[_0xe853('0x13')],_0x57d1b4[_0xe853('0x14')]?_0x57d1b4[_0xe853('0x14')]['id']:0x0,_0x57d1b4['interaction']?_0x57d1b4[_0xe853('0x15')]['id']:0x0);if(_0x1ebf13[_0xe853('0x36')][_0x256dec]){_0x1ebf13[_0xe853('0x36')][_0x256dec][_0xe853('0x3a')](_0xe853('0x42'));}return _0x2bfdc7({'code':0xc8,'message':_0x57d1b4});}catch(_0x5a5958){logger['error'](_0x5a5958[_0xe853('0x47')]);return _0x521f55(_0x35f431[_0xe853('0x34')](0x1f4,_0x5a5958));}}logger[_0xe853('0x34')](_0xe853('0x48'));return _0x521f55(_0x35f431[_0xe853('0x34')](0x1f4,_0xe853('0x48')));});},'AgentCapacity':function(_0x4f18ec){var _0x300587=this;return new Promise(function(_0x54b058,_0x444e1f){if(_0x1ebf13[_0xe853('0x3e')]['hasOwnProperty'](_0x4f18ec['id'])){for(var _0x2cfc27 in _0x4f18ec[_0xe853('0x49')]){if(_0x4f18ec['capacity'][_0xe853('0x4a')](_0x2cfc27)){if(_0x1ebf13[_0xe853('0x3e')][_0x4f18ec['id']][_0xe853('0x4a')](_0x2cfc27+'CurrentCapacity')){_0x1ebf13['agents'][_0x4f18ec['id']][_0x2cfc27+'CurrentCapacity']=parseInt(_0x4f18ec[_0xe853('0x49')][_0x2cfc27],0xa);}}}_0x1ebf13[_0xe853('0x3e')][_0x4f18ec['id']][_0xe853('0x4b')]();return _0x54b058({'code':0xc8,'message':_0x1ebf13[_0xe853('0x3e')][_0x4f18ec['id']]});}else{return _0x444e1f(_0x300587[_0xe853('0x34')](0x1f4,_0xe853('0x4c')));}});},'Agents':function(_0x3dd9b2){return new Promise(function(_0x3ce284){var _0x26f65e=_[_0xe853('0x4d')](_0x1ebf13['agents']);if(_0x3dd9b2&&_0x3dd9b2['id']){var _0xe0dca=_[_0xe853('0x4e')](_0x26f65e,function(_0xf23f90){return _0xf23f90['id']===_0x3dd9b2['id'];});_0x3ce284(_0xe0dca);}else{_0x3ce284({'count':_0x26f65e['length'],'rows':_0x26f65e});}});},'ChatQueues':function(){return new Promise(function(_0x3d35a8){var _0x3416ae=[];for(var _0x45c966 in _0x1ebf13[_0xe853('0x4f')]){if(_0x1ebf13[_0xe853('0x4f')][_0xe853('0x4a')](_0x45c966)){var _0x33493d=_0x1ebf13['chatQueues'][_0x45c966];var _0x4f8699={'id':_0x33493d['id'],'available':_0x33493d[_0xe853('0x50')],'loggedIn':_0x33493d[_0xe853('0x51')],'name':_0x33493d[_0xe853('0x52')],'paused':_0x33493d[_0xe853('0x53')],'waiting':_0x33493d[_0xe853('0x54')]};_0x3416ae[_0xe853('0x22')](_0x4f8699);}}_0x3d35a8({'count':_0x3416ae[_0xe853('0x1a')],'rows':_0x3416ae});});},'MailQueues':function(){return new Promise(function(_0x43aaec){var _0x4f914d=[];for(var _0x7e9300 in _0x1ebf13[_0xe853('0x55')]){if(_0x1ebf13['mailQueues'][_0xe853('0x4a')](_0x7e9300)){var _0x48e561=_0x1ebf13[_0xe853('0x55')][_0x7e9300];var _0x59b2e8={'id':_0x48e561['id'],'available':_0x48e561['available'],'loggedIn':_0x48e561[_0xe853('0x51')],'name':_0x48e561['name'],'paused':_0x48e561[_0xe853('0x53')],'waiting':_0x48e561['waiting']};_0x4f914d['push'](_0x59b2e8);}}_0x43aaec({'count':_0x4f914d[_0xe853('0x1a')],'rows':_0x4f914d});});},'OpenchannelQueues':function(){return new Promise(function(_0x10da7a){var _0x2a9f4b=[];for(var _0x3a6121 in _0x1ebf13['openchannelQueues']){if(_0x1ebf13['openchannelQueues'][_0xe853('0x4a')](_0x3a6121)){var _0x4dd074=_0x1ebf13[_0xe853('0x56')][_0x3a6121];var _0x4c85c0={'id':_0x4dd074['id'],'available':_0x4dd074[_0xe853('0x50')],'loggedIn':_0x4dd074[_0xe853('0x51')],'name':_0x4dd074[_0xe853('0x52')],'paused':_0x4dd074[_0xe853('0x53')],'waiting':_0x4dd074[_0xe853('0x54')]};_0x2a9f4b['push'](_0x4c85c0);}}_0x10da7a({'count':_0x2a9f4b[_0xe853('0x1a')],'rows':_0x2a9f4b});});},'SmsQueues':function(){return new Promise(function(_0x739460){var _0x337690=[];for(var _0x32a7a0 in _0x1ebf13[_0xe853('0x57')]){if(_0x1ebf13['smsQueues'][_0xe853('0x4a')](_0x32a7a0)){var _0x2a1397=_0x1ebf13['smsQueues'][_0x32a7a0];var _0x40b6b5={'id':_0x2a1397['id'],'available':_0x2a1397[_0xe853('0x50')],'loggedIn':_0x2a1397[_0xe853('0x51')],'name':_0x2a1397[_0xe853('0x52')],'paused':_0x2a1397[_0xe853('0x53')],'waiting':_0x2a1397[_0xe853('0x54')]};_0x337690['push'](_0x40b6b5);}}_0x739460({'count':_0x337690[_0xe853('0x1a')],'rows':_0x337690});});},'FaxQueues':function(){return new Promise(function(_0x159f0f){var _0x22c966=[];for(var _0x20a6e4 in _0x1ebf13['faxQueues']){if(_0x1ebf13[_0xe853('0x58')][_0xe853('0x4a')](_0x20a6e4)){var _0x49383c=_0x1ebf13[_0xe853('0x58')][_0x20a6e4];var _0x47efb0={'id':_0x49383c['id'],'available':_0x49383c[_0xe853('0x50')],'loggedIn':_0x49383c[_0xe853('0x51')],'name':_0x49383c[_0xe853('0x52')],'paused':_0x49383c['paused'],'waiting':_0x49383c[_0xe853('0x54')]};_0x22c966[_0xe853('0x22')](_0x47efb0);}}_0x159f0f({'count':_0x22c966[_0xe853('0x1a')],'rows':_0x22c966});});},'WhatsappQueues':function(){return new Promise(function(_0x5a6ae0){var _0x2ec5cb=[];for(var _0x3bef8e in _0x1ebf13[_0xe853('0x59')]){if(_0x1ebf13[_0xe853('0x59')][_0xe853('0x4a')](_0x3bef8e)){var _0x209f25=_0x1ebf13[_0xe853('0x59')][_0x3bef8e];var _0x5094ce={'id':_0x209f25['id'],'available':_0x209f25[_0xe853('0x50')],'loggedIn':_0x209f25[_0xe853('0x51')],'name':_0x209f25['name'],'paused':_0x209f25['paused'],'waiting':_0x209f25[_0xe853('0x54')]};_0x2ec5cb[_0xe853('0x22')](_0x5094ce);}}_0x5a6ae0({'count':_0x2ec5cb[_0xe853('0x1a')],'rows':_0x2ec5cb});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2e80da){var _0xf8982c=_['values'](_0x1ebf13[_0xe853('0x5a')]);_0x2e80da({'count':_0xf8982c[_0xe853('0x1a')],'rows':_0xf8982c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xaba470){var _0x548f7a=_['values'](_0x1ebf13['mailQueuesWaitingInteractions']);_0xaba470({'count':_0x548f7a[_0xe853('0x1a')],'rows':_0x548f7a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x50b110){var _0x2b3883=_[_0xe853('0x4d')](_0x1ebf13['openchannelQueuesWaitingInteractions']);_0x50b110({'count':_0x2b3883[_0xe853('0x1a')],'rows':_0x2b3883});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4d0fc7){var _0x8e2216=_[_0xe853('0x4d')](_0x1ebf13[_0xe853('0x5b')]);_0x4d0fc7({'count':_0x8e2216['length'],'rows':_0x8e2216});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4263ff){var _0x26a240=_[_0xe853('0x4d')](_0x1ebf13[_0xe853('0x5c')]);_0x4263ff({'count':_0x26a240[_0xe853('0x1a')],'rows':_0x26a240});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5e7a13){var _0x3f18c4=_[_0xe853('0x4d')](_0x1ebf13[_0xe853('0x5d')]);_0x5e7a13({'count':_0x3f18c4[_0xe853('0x1a')],'rows':_0x3f18c4});});}};var _0x362f01=jayson[_0xe853('0x5e')](_0x552812)[_0xe853('0x5f')]();_0x362f01['on']('error',function(_0x270595){logger[_0xe853('0x34')](JSON[_0xe853('0x38')](_0x270595));return _0x5db22d(_0x270595);});_0x362f01[_0xe853('0x12')](0x232c,_0xe853('0x60'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x4b8e2c(_0xe853('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8dd2468..ffcce08 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 _0x34b5=['result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','message','catch','all','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x34b5,0x1b6));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x534b('0x0'));var BPromise=require(_0x534b('0x1'));var jayson=require(_0x534b('0x2'));var _=require(_0x534b('0x3'));var logger=require(_0x534b('0x4'))(_0x534b('0x5'));var client=jayson['client'][_0x534b('0x6')]({'port':0x232a});function request(_0x5639c4,_0x5c84dd){return new BPromise(function(_0xeeb0f,_0x52697a){return client[_0x534b('0x7')](_0x5639c4,_0x5c84dd)[_0x534b('0x8')](function(_0x440b5c){if(_0x440b5c[_0x534b('0x9')]){return _0x52697a(_0x440b5c[_0x534b('0x9')]['message']);}else{return _0xeeb0f(_0x440b5c[_0x534b('0xa')]);}})['catch'](function(_0x4beeee){return _0x52697a(_0x4beeee);});});}exports[_0x534b('0xb')]=function(_0x4fe9a4,_0x1d881a,_0x78daf4){return function(_0x236bbe){if(_0x78daf4[_0x534b('0xc')]&&!_0x78daf4[_0x534b('0xc')][_0x4fe9a4]){logger[_0x534b('0xd')](_0x534b('0xe'),_0x4fe9a4);return _0x236bbe['stop']();}var _0x5401ef=[];for(var _0x45a4ce=0x0;_0x45a4ce<_0x1d881a[_0x534b('0xf')];_0x45a4ce+=0x1){_0x5401ef[_0x534b('0x10')](request('Command',{'command':util[_0x534b('0x11')]('iftime\x20%s',_0x1d881a[_0x45a4ce])})[_0x534b('0x8')](function(_0x26638f){return _0x26638f&&_0x26638f[_0x534b('0x12')]&&_0x26638f[_0x534b('0x12')]['indexOf']('true')>=0x0?!![]:![];})[_0x534b('0x13')](function(){logger[_0x534b('0x9')]('[%s][INTERVAL]\x20%s',_0x4fe9a4,_0x1d881a[_0x45a4ce]);}));}BPromise[_0x534b('0x14')](_0x5401ef)[_0x534b('0x8')](function(_0x214dc9){var _0x46b9fc=_[_0x534b('0x15')](_0x214dc9);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x4fe9a4,_0x1d881a[_0x534b('0x16')](_0x534b('0x17')),_0x46b9fc);_0x236bbe[_0x534b('0x18')](_0x46b9fc);})['catch'](function(_0x3d8756){logger[_0x534b('0x9')](_0x534b('0x19'),_0x4fe9a4,_0x1d881a[_0x534b('0x16')](_0x534b('0x17')),_0x3d8756[_0x534b('0x1a')]);_0x236bbe[_0x534b('0x1b')]();});};}; \ No newline at end of file +var _0x744f=['info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','jayson/promise','lodash','../../../config/logger','routing','client','request','then','message','result','catch','rules','stop','length','push','format','iftime\x20%s','all','some'];(function(_0x216bda,_0x103366){var _0x176777=function(_0x2a75aa){while(--_0x2a75aa){_0x216bda['push'](_0x216bda['shift']());}};_0x176777(++_0x103366);}(_0x744f,0x10e));var _0xf744=function(_0x5463e4,_0x2adedf){_0x5463e4=_0x5463e4-0x0;var _0x2f8334=_0x744f[_0x5463e4];return _0x2f8334;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xf744('0x0'));var _=require(_0xf744('0x1'));var logger=require(_0xf744('0x2'))(_0xf744('0x3'));var client=jayson[_0xf744('0x4')]['http']({'port':0x232a});function request(_0x817a45,_0x4513a0){return new BPromise(function(_0xdc004e,_0x2a0003){return client[_0xf744('0x5')](_0x817a45,_0x4513a0)[_0xf744('0x6')](function(_0x980e06){if(_0x980e06['error']){return _0x2a0003(_0x980e06['error'][_0xf744('0x7')]);}else{return _0xdc004e(_0x980e06[_0xf744('0x8')]);}})[_0xf744('0x9')](function(_0x52b943){return _0x2a0003(_0x52b943);});});}exports['condition']=function(_0x30387b,_0x1719ca,_0x258367){return function(_0x11641d){if(_0x258367[_0xf744('0xa')]&&!_0x258367['rules'][_0x30387b]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x30387b);return _0x11641d[_0xf744('0xb')]();}var _0x44b7f8=[];for(var _0x58da34=0x0;_0x58da34<_0x1719ca[_0xf744('0xc')];_0x58da34+=0x1){_0x44b7f8[_0xf744('0xd')](request('Command',{'command':util[_0xf744('0xe')](_0xf744('0xf'),_0x1719ca[_0x58da34])})['then'](function(_0x5b36b0){return _0x5b36b0&&_0x5b36b0[_0xf744('0x7')]&&_0x5b36b0[_0xf744('0x7')]['indexOf']('true')>=0x0?!![]:![];})[_0xf744('0x9')](function(){logger['error']('[%s][INTERVAL]\x20%s',_0x30387b,_0x1719ca[_0x58da34]);}));}BPromise[_0xf744('0x10')](_0x44b7f8)[_0xf744('0x6')](function(_0x515bd1){var _0x6c3d19=_[_0xf744('0x11')](_0x515bd1);logger[_0xf744('0x12')](_0xf744('0x13'),_0x30387b,_0x1719ca[_0xf744('0x14')](_0xf744('0x15')),_0x6c3d19);_0x11641d[_0xf744('0x16')](_0x6c3d19);})[_0xf744('0x9')](function(_0x42c9f3){logger['error'](_0xf744('0x13'),_0x30387b,_0x1719ca[_0xf744('0x14')](_0xf744('0x15')),_0x42c9f3[_0xf744('0x17')]);_0x11641d[_0xf744('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b5fc058..1bdc64f 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 _0xb7e7=['answeredelsewheremembername','agentcomplete','[%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','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','./utils','format','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime','ringtime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere'];(function(_0x590506,_0x15243){var _0x34ca29=function(_0x4589fa){while(--_0x4589fa){_0x590506['push'](_0x590506['shift']());}};_0x34ca29(++_0x15243);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb7e7[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var utils=require(_0x7b7e('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x518dc6,_0x1b7cc7){utils['info'](util[_0x7b7e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x518dc6[_0x7b7e('0x3')],_0x518dc6[_0x7b7e('0x4')],_0x518dc6[_0x7b7e('0x5')],_0x518dc6['membername'],_0x518dc6['interface'],_0x518dc6[_0x7b7e('0x6')],_0x518dc6[_0x7b7e('0x7')],_0x518dc6[_0x7b7e('0x8')]));if(_0x518dc6['queue']){utils[_0x7b7e('0x9')](_0x518dc6[_0x7b7e('0x5')])[_0x7b7e('0xa')](function(_0x1647e5){if(_0x1647e5){_0x518dc6[_0x7b7e('0xb')]=_0x1647e5[_0x7b7e('0xb')];_0x518dc6[_0x7b7e('0xc')]=_0x518dc6['agentcomplete']?_0x1647e5[_0x7b7e('0xd')]:![];_0x518dc6[_0x7b7e('0xe')]=_0x518dc6[_0x7b7e('0xc')]?_0x1647e5[_0x7b7e('0xf')]:0x0;}utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);});}else{utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);}if(_0x1b7cc7){delete transfers[_0x518dc6[_0x7b7e('0x3')]];}else{delete agents[_0x518dc6['destuniqueid']];}}exports[_0x7b7e('0x12')]=function(_0x430eab){try{utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][agentcalled]',_0x430eab['uniqueid']),_0x430eab);agents[_0x430eab[_0x7b7e('0x13')]]=_0x430eab;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();agents[_0x430eab[_0x7b7e('0x13')]]['lastevent']='called';agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x7')]=null;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x16')]=null;utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x18'),_0x430eab[_0x7b7e('0x3')],agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x430eab[_0x7b7e('0x13')]));}catch(_0x14f4fe){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x1b'),_0x430eab[_0x7b7e('0x3')]),_0x14f4fe);}};exports[_0x7b7e('0x1c')]=function(_0x49eddb){try{if(!_[_0x7b7e('0x1d')](agents[_0x49eddb[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util['format'](_0x7b7e('0x1f'),_0x49eddb[_0x7b7e('0x3')]),_0x49eddb);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x20'),_0x49eddb[_0x7b7e('0x3')],agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x49eddb['destuniqueid']));agents[_0x49eddb['destuniqueid']]['agentringnoanswer']=!![];agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();agents[_0x49eddb['destuniqueid']]['lastevent']='timeout';agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x7b7e('0x23');agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x49eddb['ringtime']?parseInt(_0x49eddb[_0x7b7e('0x25')])/0x3e8:0x0;agents[_0x49eddb[_0x7b7e('0x13')]]['talktime']=0x0;unanswered['push'](_0x49eddb['destuniqueid']);}}catch(_0x12ef0b){utils[_0x7b7e('0x1a')](util['format'](_0x7b7e('0x1f'),_0x49eddb['uniqueid']),_0x12ef0b);}};exports[_0x7b7e('0x26')]=function(_0xb9b6bf){try{_[_0x7b7e('0x27')](agents,function(_0x5515ca,_0x3960b8){if(_0x5515ca[_0x7b7e('0x3')]==_0xb9b6bf[_0x7b7e('0x3')]&&!_[_0x7b7e('0x28')](unanswered,_0x5515ca[_0x7b7e('0x13')])){utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][queuecallerabandon]',_0xb9b6bf[_0x7b7e('0x3')]),_0xb9b6bf);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x29'),_0xb9b6bf[_0x7b7e('0x3')],_0x5515ca[_0x7b7e('0x19')],_0x5515ca[_0x7b7e('0x13')]));_0x5515ca['agentringnoanswer']=!![];_0x5515ca['agentringnoanswerAt']=utils[_0x7b7e('0x15')]();_0x5515ca[_0x7b7e('0x8')]='abandoned';_0x5515ca[_0x7b7e('0x22')]=_0x7b7e('0x2a');_0x5515ca[_0x7b7e('0x24')]=_0xb9b6bf['holdtime'];_0x5515ca[_0x7b7e('0x2b')]=0x0;writeDB(_0x5515ca);}});}catch(_0x256908){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x2c'),_0xb9b6bf[_0x7b7e('0x3')]),_0x256908);}};exports[_0x7b7e('0x2d')]=function(_0x202f04){try{if(agents[_0x202f04[_0x7b7e('0x13')]]){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x2e'),_0x202f04[_0x7b7e('0x3')]),_0x202f04);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x2f'),_0x202f04['uniqueid'],agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x202f04[_0x7b7e('0x13')]));agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x7')]=_0x202f04[_0x7b7e('0x7')];agents[_0x202f04[_0x7b7e('0x13')]]['connectedlinename']=_0x202f04[_0x7b7e('0x16')];agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];agents[_0x202f04['destuniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x31');_[_0x7b7e('0x27')](agents,function(_0x5c58c0,_0x4a2888){if(_0x5c58c0[_0x7b7e('0x13')]!=_0x202f04['destuniqueid']&&_0x5c58c0[_0x7b7e('0x3')]==_0x202f04[_0x7b7e('0x3')]){_0x5c58c0['talktime']=0x0;_0x5c58c0[_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];_0x5c58c0[_0x7b7e('0x1c')]=!![];_0x5c58c0[_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();_0x5c58c0[_0x7b7e('0x8')]=_0x7b7e('0x32');_0x5c58c0[_0x7b7e('0x22')]=_0x7b7e('0x32');_0x5c58c0['answeredelsewheredestinationuniqueid']=_0x202f04['destuniqueid'];_0x5c58c0[_0x7b7e('0x33')]=_0x202f04['membername'];writeDB(_0x5c58c0);}});}}catch(_0x41c8a6){utils['error'](util['format'](_0x7b7e('0x2e'),_0x202f04['uniqueid']),_0x41c8a6);}};exports[_0x7b7e('0x34')]=function(_0x52051c){try{if(!_[_0x7b7e('0x1d')](agents[_0x52051c[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')]('[%s][agents][agentcomplete]',_0x52051c[_0x7b7e('0x3')]),_0x52051c);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x35'),_0x52051c[_0x7b7e('0x3')],agents[_0x52051c[_0x7b7e('0x13')]]['membername'],_0x52051c['destuniqueid']));agents[_0x52051c['destuniqueid']][_0x7b7e('0x34')]=!![];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x2b')]=utils['diffTime'](agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')],agents[_0x52051c['destuniqueid']]['agentconnectAt']);agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x52051c[_0x7b7e('0x22')];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x8')]=_0x7b7e('0x37');writeDB(agents[_0x52051c['destuniqueid']]);}}catch(_0x2673eb){utils['error'](util[_0x7b7e('0x2')](_0x7b7e('0x38'),_0x52051c[_0x7b7e('0x3')]),_0x2673eb);}};exports[_0x7b7e('0x39')]=function(_0x58e4e6){try{if(!_[_0x7b7e('0x1d')](agents[_0x58e4e6[_0x7b7e('0x3a')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6['uniqueid']),_0x58e4e6);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x3c'),_0x58e4e6[_0x7b7e('0x3')],agents[_0x58e4e6[_0x7b7e('0x3a')]]['membername'],agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3')]));agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3d')]=!![];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3e')]=_0x7b7e('0x3f');agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x40')]=_0x58e4e6['extension'];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x41')]=agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x3')];}}catch(_0x44e3a0){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6[_0x7b7e('0x3')]),_0x44e3a0);}};exports[_0x7b7e('0x42')]=function(_0x5f15ce){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x5f15ce);if(_0x5f15ce['origtransfereruniqueid']==_0x5f15ce['origtransfererlinkedid']){if(!_['isNil'](agents[_0x5f15ce[_0x7b7e('0x45')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5f15ce['origtransfereruniqueid'],agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x19')]));agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x40')]=_0x5f15ce['origtransfererexten'];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x41')]=_0x5f15ce[_0x7b7e('0x44')];}if(_0x5f15ce[_0x7b7e('0x46')]&&agents[_0x5f15ce[_0x7b7e('0x46')]]){agents[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x46')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfereeuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x6')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x49')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x2;}}else if(_0x5f15ce[_0x7b7e('0x45')]==_0x5f15ce['secondtransfererlinkedid']){if(!_[_0x7b7e('0x1d')](agents[_0x5f15ce[_0x7b7e('0x44')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x4a'),_0x5f15ce[_0x7b7e('0x44')],agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x19')]));agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x40')]=_0x5f15ce[_0x7b7e('0x4b')];agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x41')]=_0x5f15ce['secondtransfereruniqueid'];}if(_0x5f15ce[_0x7b7e('0x4c')]&&agents[_0x5f15ce[_0x7b7e('0x4c')]]){agents[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x4c')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfertargetuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x4c')]]['calleridnum']=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce['transfertargetuniqueid']][_0x7b7e('0x49')]=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentcalledAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentconnectAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x2;}}}catch(_0x2147d9){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x2147d9);}};exports['hangup']=function(_0x59ecf9){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9[_0x7b7e('0x3')]),_0x59ecf9);if(agents[_0x59ecf9[_0x7b7e('0x3')]]&&agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]==='timeout'){if(_0x59ecf9[_0x7b7e('0x4e')]==='21'){agents[_0x59ecf9[_0x7b7e('0x3')]]['reason']=_0x7b7e('0x4f');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x4f');}utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]]['reason'],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);var _0x122053=unanswered[_0x7b7e('0x51')](_0x59ecf9[_0x7b7e('0x3')]);if(_0x122053>-0x1){unanswered[_0x7b7e('0x52')](_0x122053,0x1);}}if(transfers[_0x59ecf9['uniqueid']]){transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x34')]=!![];transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt']=utils[_0x7b7e('0x15')]();transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt'],transfers[_0x59ecf9['uniqueid']]['agentconnectAt']);transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=_0x7b7e('0x54');transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x22')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(transfers[_0x59ecf9[_0x7b7e('0x3')]],!![]);}if(agents[_0x59ecf9['uniqueid']]&&agents[_0x59ecf9['uniqueid']][_0x7b7e('0x30')]){agents[_0x59ecf9['uniqueid']][_0x7b7e('0x34')]=!![];agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x59ecf9['uniqueid']][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x30')]);agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x3d')]?_0x7b7e('0x3d'):_0x7b7e('0x54');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')],agents[_0x59ecf9[_0x7b7e('0x3')]]['lastevent']));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);}}catch(_0x3880be){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9['uniqueid']),_0x3880be);}}; \ No newline at end of file +var _0x69d3=['isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','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','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','uniqueid','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','called','connectedlinename','error','agentringnoanswer'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x69d3,0xda));var _0x369d=function(_0x593c9a,_0x444a1e){_0x593c9a=_0x593c9a-0x0;var _0x2bb253=_0x69d3[_0x593c9a];return _0x2bb253;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var utils=require(_0x369d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52c3ba,_0x47591f){utils[_0x369d('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52c3ba[_0x369d('0x4')],_0x52c3ba['channel'],_0x52c3ba['queue'],_0x52c3ba[_0x369d('0x5')],_0x52c3ba[_0x369d('0x6')],_0x52c3ba[_0x369d('0x7')],_0x52c3ba[_0x369d('0x8')],_0x52c3ba[_0x369d('0x9')]));if(_0x52c3ba[_0x369d('0xa')]){utils[_0x369d('0xb')](_0x52c3ba[_0x369d('0xa')])[_0x369d('0xc')](function(_0x580727){if(_0x580727){_0x52c3ba['type']=_0x580727[_0x369d('0xd')];_0x52c3ba[_0x369d('0xe')]=_0x52c3ba[_0x369d('0xf')]?_0x580727[_0x369d('0x10')]:![];_0x52c3ba['acwtime']=_0x52c3ba['agentacw']?_0x580727[_0x369d('0x11')]:0x0;}utils[_0x369d('0x12')](_0x369d('0x13'),_0x52c3ba);});}else{utils[_0x369d('0x12')](_0x369d('0x13'),_0x52c3ba);}if(_0x47591f){delete transfers[_0x52c3ba[_0x369d('0x4')]];}else{delete agents[_0x52c3ba['destuniqueid']];}}exports[_0x369d('0x14')]=function(_0x9d016){try{utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x17'),_0x9d016['uniqueid']),_0x9d016);agents[_0x9d016['destuniqueid']]=_0x9d016;agents[_0x9d016['destuniqueid']][_0x369d('0x18')]=utils[_0x369d('0x19')]();agents[_0x9d016[_0x369d('0x1a')]]['lastevent']=_0x369d('0x1b');agents[_0x9d016[_0x369d('0x1a')]][_0x369d('0x8')]=null;agents[_0x9d016['destuniqueid']][_0x369d('0x1c')]=null;utils[_0x369d('0x3')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x9d016['uniqueid'],agents[_0x9d016[_0x369d('0x1a')]][_0x369d('0x5')],_0x9d016[_0x369d('0x1a')]));}catch(_0x4ddcb2){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x17'),_0x9d016[_0x369d('0x4')]),_0x4ddcb2);}};exports[_0x369d('0x1e')]=function(_0x538ca4){try{if(!_[_0x369d('0x1f')](agents[_0x538ca4[_0x369d('0x1a')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x20'),_0x538ca4[_0x369d('0x4')]),_0x538ca4);utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x538ca4['uniqueid'],agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x5')],_0x538ca4[_0x369d('0x1a')]));agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x1e')]=!![];agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x21')]=utils['now']();agents[_0x538ca4['destuniqueid']][_0x369d('0x9')]=_0x369d('0x22');agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x23')]=_0x369d('0x22');agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x24')]=_0x538ca4['ringtime']?parseInt(_0x538ca4[_0x369d('0x25')])/0x3e8:0x0;agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x26')]=0x0;unanswered[_0x369d('0x27')](_0x538ca4[_0x369d('0x1a')]);}}catch(_0x41367a){utils[_0x369d('0x1d')](util['format'](_0x369d('0x20'),_0x538ca4['uniqueid']),_0x41367a);}};exports['queuecallerabandon']=function(_0x38feda){try{_[_0x369d('0x28')](agents,function(_0x5844c7,_0x104540){if(_0x5844c7['uniqueid']==_0x38feda[_0x369d('0x4')]&&!_[_0x369d('0x29')](unanswered,_0x5844c7[_0x369d('0x1a')])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x2a'),_0x38feda[_0x369d('0x4')]),_0x38feda);utils['info'](util[_0x369d('0x16')](_0x369d('0x2b'),_0x38feda[_0x369d('0x4')],_0x5844c7[_0x369d('0x5')],_0x5844c7[_0x369d('0x1a')]));_0x5844c7[_0x369d('0x1e')]=!![];_0x5844c7[_0x369d('0x21')]=utils[_0x369d('0x19')]();_0x5844c7['lastevent']=_0x369d('0x2c');_0x5844c7[_0x369d('0x23')]=_0x369d('0x2c');_0x5844c7[_0x369d('0x24')]=_0x38feda[_0x369d('0x24')];_0x5844c7['talktime']=0x0;writeDB(_0x5844c7);}});}catch(_0x35f326){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x2a'),_0x38feda[_0x369d('0x4')]),_0x35f326);}};exports[_0x369d('0x2d')]=function(_0x50c033){try{if(agents[_0x50c033[_0x369d('0x1a')]]){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x2e'),_0x50c033[_0x369d('0x4')]),_0x50c033);utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x2f'),_0x50c033[_0x369d('0x4')],agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x5')],_0x50c033[_0x369d('0x1a')]));agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x30')]=utils[_0x369d('0x19')]();agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x8')]=_0x50c033[_0x369d('0x8')];agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x1c')]=_0x50c033[_0x369d('0x1c')];agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x24')]=_0x50c033[_0x369d('0x25')];agents[_0x50c033['destuniqueid']]['lastevent']=_0x369d('0x31');_[_0x369d('0x28')](agents,function(_0x8a1ef5,_0x401bc7){if(_0x8a1ef5[_0x369d('0x1a')]!=_0x50c033[_0x369d('0x1a')]&&_0x8a1ef5[_0x369d('0x4')]==_0x50c033[_0x369d('0x4')]){_0x8a1ef5[_0x369d('0x26')]=0x0;_0x8a1ef5['holdtime']=_0x50c033[_0x369d('0x25')];_0x8a1ef5[_0x369d('0x1e')]=!![];_0x8a1ef5[_0x369d('0x21')]=utils[_0x369d('0x19')]();_0x8a1ef5[_0x369d('0x9')]=_0x369d('0x32');_0x8a1ef5[_0x369d('0x23')]=_0x369d('0x32');_0x8a1ef5['answeredelsewheredestinationuniqueid']=_0x50c033['destuniqueid'];_0x8a1ef5[_0x369d('0x33')]=_0x50c033[_0x369d('0x5')];writeDB(_0x8a1ef5);}});}}catch(_0x30909a){utils['error'](util['format']('[%s][agents][agentconnect]',_0x50c033[_0x369d('0x4')]),_0x30909a);}};exports[_0x369d('0xf')]=function(_0x55dfde){try{if(!_[_0x369d('0x1f')](agents[_0x55dfde[_0x369d('0x1a')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')]('[%s][agents][agentcomplete]',_0x55dfde[_0x369d('0x4')]),_0x55dfde);utils['info'](util[_0x369d('0x16')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x55dfde[_0x369d('0x4')],agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x5')],_0x55dfde['destuniqueid']));agents[_0x55dfde['destuniqueid']][_0x369d('0xf')]=!![];agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x34')]=utils['now']();agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x26')]=utils[_0x369d('0x35')](agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x34')],agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x30')]);agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x23')]=_0x55dfde['reason'];agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x9')]=_0x369d('0x36');writeDB(agents[_0x55dfde[_0x369d('0x1a')]]);}}catch(_0x27e2c7){utils[_0x369d('0x1d')](util['format'](_0x369d('0x37'),_0x55dfde[_0x369d('0x4')]),_0x27e2c7);}};exports[_0x369d('0x38')]=function(_0x44a357){try{if(!_[_0x369d('0x1f')](agents[_0x44a357[_0x369d('0x39')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x3a'),_0x44a357[_0x369d('0x4')]),_0x44a357);utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x44a357[_0x369d('0x4')],agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x5')],agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x4')]));agents[_0x44a357['transfereruniqueid']][_0x369d('0x3b')]=!![];agents[_0x44a357['transfereruniqueid']][_0x369d('0x3c')]=_0x369d('0x3d');agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x3e')]=_0x44a357[_0x369d('0x3f')];agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x40')]=agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x4')];}}catch(_0x9f1544){utils['error'](util['format'](_0x369d('0x3a'),_0x44a357[_0x369d('0x4')]),_0x9f1544);}};exports[_0x369d('0x41')]=function(_0x4226de){try{utils[_0x369d('0x15')](util['format']('[%s][agents][attendedtransfer]',_0x4226de[_0x369d('0x42')]),_0x4226de);if(_0x4226de[_0x369d('0x42')]==_0x4226de['origtransfererlinkedid']){if(!_[_0x369d('0x1f')](agents[_0x4226de['secondtransfereruniqueid']])){utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x43'),_0x4226de['origtransfereruniqueid'],agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x5')]));agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x3b')]=!![];agents[_0x4226de['secondtransfereruniqueid']]['transfertype']=_0x369d('0x45');agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x3e')]=_0x4226de['origtransfererexten'];agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x40')]=_0x4226de[_0x369d('0x42')];}if(_0x4226de['transfereeuniqueid']&&agents[_0x4226de['transfereeuniqueid']]){agents[_0x4226de[_0x369d('0x46')]][_0x369d('0x47')]=0x1;transfers[_0x4226de[_0x369d('0x46')]]=_[_0x369d('0x48')](agents[_0x4226de['transfereeuniqueid']]);transfers[_0x4226de[_0x369d('0x46')]][_0x369d('0x7')]=agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x7')];transfers[_0x4226de[_0x369d('0x46')]]['calleridname']=agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x49')];transfers[_0x4226de[_0x369d('0x46')]]['agentcalledAt']=utils[_0x369d('0x19')]();transfers[_0x4226de['transfereeuniqueid']][_0x369d('0x30')]=utils['now']();transfers[_0x4226de['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x4226de['transfereeuniqueid']][_0x369d('0x47')]=0x2;}}else if(_0x4226de['secondtransfereruniqueid']==_0x4226de[_0x369d('0x4a')]){if(!_['isNil'](agents[_0x4226de[_0x369d('0x42')]])){utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x4226de[_0x369d('0x42')],agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x5')]));agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x3b')]=!![];agents[_0x4226de[_0x369d('0x42')]]['transfertype']=_0x369d('0x45');agents[_0x4226de['origtransfereruniqueid']]['transferexten']=_0x4226de['secondtransfererexten'];agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x40')]=_0x4226de[_0x369d('0x44')];}if(_0x4226de[_0x369d('0x4b')]&&agents[_0x4226de[_0x369d('0x4b')]]){agents[_0x4226de[_0x369d('0x4b')]][_0x369d('0x47')]=0x1;transfers[_0x4226de[_0x369d('0x4b')]]=_[_0x369d('0x48')](agents[_0x4226de[_0x369d('0x4b')]]);transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x7')]=agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x7')];transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x49')]=agents[_0x4226de['origtransfereruniqueid']][_0x369d('0x49')];transfers[_0x4226de['transfertargetuniqueid']][_0x369d('0x18')]=utils[_0x369d('0x19')]();transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x30')]=utils[_0x369d('0x19')]();transfers[_0x4226de['transfertargetuniqueid']][_0x369d('0x24')]=0x0;transfers[_0x4226de['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x3ee715){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x4c'),_0x4226de[_0x369d('0x42')]),_0x3ee715);}};exports[_0x369d('0x4d')]=function(_0x341d93){try{utils[_0x369d('0x15')](util['format'](_0x369d('0x4e'),_0x341d93[_0x369d('0x4')]),_0x341d93);if(agents[_0x341d93['uniqueid']]&&agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')]===_0x369d('0x22')){if(_0x341d93['cause']==='21'){agents[_0x341d93[_0x369d('0x4')]]['reason']=_0x369d('0x4f');agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x9')]=_0x369d('0x4f');}utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x50'),_0x341d93['uniqueid'],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x5')],agents[_0x341d93['uniqueid']][_0x369d('0x23')],agents[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(agents[_0x341d93[_0x369d('0x4')]]);var _0x2b7897=unanswered['indexOf'](_0x341d93[_0x369d('0x4')]);if(_0x2b7897>-0x1){unanswered[_0x369d('0x51')](_0x2b7897,0x1);}}if(transfers[_0x341d93['uniqueid']]){transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0xf')]=!![];transfers[_0x341d93[_0x369d('0x4')]]['agentcompleteAt']=utils[_0x369d('0x19')]();transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x26')]=utils[_0x369d('0x35')](transfers[_0x341d93[_0x369d('0x4')]]['agentcompleteAt'],transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x30')]);transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')]=_0x369d('0x52');transfers[_0x341d93['uniqueid']]['lastevent']=_0x369d('0x36');utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x50'),_0x341d93[_0x369d('0x4')],transfers[_0x341d93[_0x369d('0x4')]]['membername'],transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')],transfers[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(transfers[_0x341d93['uniqueid']],!![]);}if(agents[_0x341d93[_0x369d('0x4')]]&&agents[_0x341d93['uniqueid']][_0x369d('0x30')]){agents[_0x341d93[_0x369d('0x4')]]['agentcomplete']=!![];agents[_0x341d93[_0x369d('0x4')]]['agentcompleteAt']=utils[_0x369d('0x19')]();agents[_0x341d93['uniqueid']]['talktime']=utils[_0x369d('0x35')](agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x34')],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x30')]);agents[_0x341d93['uniqueid']][_0x369d('0x23')]=agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x3b')]?_0x369d('0x3b'):_0x369d('0x52');agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x9')]=_0x369d('0x36');utils[_0x369d('0x3')](util['format'](_0x369d('0x50'),_0x341d93[_0x369d('0x4')],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x5')],agents[_0x341d93['uniqueid']][_0x369d('0x23')],agents[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(agents[_0x341d93[_0x369d('0x4')]]);}}catch(_0x34a225){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x4e'),_0x341d93[_0x369d('0x4')]),_0x34a225);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 27929e9..17e7ef2 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 _0x7854=['musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED','info','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart'];(function(_0xdfd8da,_0x27e19f){var _0x21aa74=function(_0x2a5e09){while(--_0x2a5e09){_0xdfd8da['push'](_0xdfd8da['shift']());}};_0x21aa74(++_0x27e19f);}(_0x7854,0x97));var _0x4785=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x7854[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x4785('0x0'));var util=require('util');var utils=require(_0x4785('0x1'));var dispositions=['NO\x20ANSWER',_0x4785('0x2'),_0x4785('0x2'),'NO\x20ANSWER',_0x4785('0x3'),_0x4785('0x3'),_0x4785('0x4'),'BUSY',_0x4785('0x2'),_0x4785('0x2'),_0x4785('0x2')];var channels={};function writeDB(_0x28da59){utils[_0x4785('0x5')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x28da59[_0x4785('0x6')],_0x28da59[_0x4785('0x7')],_0x28da59['queue'],_0x28da59[_0x4785('0x8')],_0x28da59['interface'],_0x28da59[_0x4785('0x9')],_0x28da59[_0x4785('0xa')],_0x28da59[_0x4785('0xb')]));if(_0x28da59[_0x4785('0xc')]){utils[_0x4785('0xd')](_0x28da59['accountcode'])[_0x4785('0xe')](function(_0x5bad02){if(_0x5bad02){_0x28da59[_0x4785('0xf')]=_0x5bad02['id'];}utils['request']('CreateVoiceCallReport',_0x28da59);});}else{utils[_0x4785('0x10')](_0x4785('0x11'),_0x28da59);}if(channels[_0x28da59[_0x4785('0x6')]]){delete channels[_0x28da59[_0x4785('0x6')]];}}exports[_0x4785('0x12')]=function(_0x19c49e){try{utils[_0x4785('0x13')](util['format'](_0x4785('0x14'),_0x19c49e[_0x4785('0x6')]),_0x19c49e);if(_0x19c49e[_0x4785('0x6')]==_0x19c49e[_0x4785('0x15')]&&_0x19c49e[_0x4785('0x7')]!=_0x4785('0x16')){utils['info'](util[_0x4785('0x17')](_0x4785('0x18'),_0x19c49e['uniqueid'],_0x19c49e[_0x4785('0x19')],_0x19c49e[_0x4785('0x1a')]));channels[_0x19c49e[_0x4785('0x6')]]={'uniqueid':_0x19c49e[_0x4785('0x6')],'accountcode':_0x19c49e[_0x4785('0xc')],'source':_0x19c49e[_0x4785('0x9')],'destination':_0x19c49e[_0x4785('0x1a')],'destinationcontext':_0x19c49e[_0x4785('0x19')],'channel':_0x19c49e[_0x4785('0x7')],'starttime':utils[_0x4785('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4785('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x2e3d46){utils[_0x4785('0x1c')](util[_0x4785('0x17')]('[%s][calls][newchannel]',_0x19c49e['uniqueid']),_0x2e3d46);}};exports['newstate']=function(_0x4c8483){try{utils['debug'](util[_0x4785('0x17')](_0x4785('0x1d'),_0x4c8483[_0x4785('0x6')]),_0x4c8483);if(!_[_0x4785('0x1e')](channels[_0x4c8483[_0x4785('0x6')]])&&_0x4c8483['channelstate']==0x6){utils['info'](util['format'](_0x4785('0x1f'),_0x4c8483[_0x4785('0x6')],_0x4c8483['context'],_0x4c8483[_0x4785('0x7')]));if(_[_0x4785('0x1e')](channels[_0x4c8483['uniqueid']][_0x4785('0x20')])){channels[_0x4c8483[_0x4785('0x6')]][_0x4785('0x20')]=utils['now']();}}else if(!_[_0x4785('0x1e')](channels[_0x4c8483[_0x4785('0x15')]])&&_0x4c8483[_0x4785('0x21')]==0x6&&_0x4c8483['context']!=_0x4785('0x22')){utils['info'](util['format'](_0x4785('0x23'),_0x4c8483[_0x4785('0x6')],_0x4c8483[_0x4785('0x15')],_0x4c8483['context'],_0x4c8483[_0x4785('0x7')]));channels[_0x4c8483[_0x4785('0x15')]][_0x4785('0xc')]=_0x4c8483[_0x4785('0xc')];channels[_0x4c8483[_0x4785('0x15')]][_0x4785('0x24')]=_0x4c8483[_0x4785('0x7')];if(_[_0x4785('0x1e')](channels[_0x4c8483[_0x4785('0x15')]][_0x4785('0x25')])){channels[_0x4c8483[_0x4785('0x15')]]['answertime']=utils[_0x4785('0x1b')]();}channels[_0x4c8483[_0x4785('0x15')]][_0x4785('0x26')]=dispositions[_[_0x4785('0x27')](_0x4c8483[_0x4785('0x21')])]||'ANSWERED';}}catch(_0x4c1bfa){utils[_0x4785('0x1c')](util['format'](_0x4785('0x1d'),_0x4c8483['uniqueid']),_0x4c1bfa);}};exports['hangup']=function(_0x4a944a){try{if(!_[_0x4785('0x1e')](channels[_0x4a944a['uniqueid']])){utils[_0x4785('0x13')](util[_0x4785('0x17')](_0x4785('0x28'),_0x4a944a['uniqueid']),_0x4a944a);if(_[_0x4785('0x1e')](channels[_0x4a944a['uniqueid']][_0x4785('0x29')])){channels[_0x4a944a[_0x4785('0x6')]][_0x4785('0x29')]=_0x4a944a[_0x4785('0x2a')]+'\x20<'+_0x4a944a['calleridnum']+'>';}utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x2b'),_0x4a944a['uniqueid'],channels[_0x4a944a['uniqueid']][_0x4785('0x29')],_0x4a944a['cause-txt']));channels[_0x4a944a[_0x4785('0x6')]][_0x4785('0x2c')]=utils[_0x4785('0x1b')]();channels[_0x4a944a[_0x4785('0x6')]]['duration']=utils[_0x4785('0x2d')](channels[_0x4a944a[_0x4785('0x6')]][_0x4785('0x2c')],channels[_0x4a944a['uniqueid']]['starttime']);channels[_0x4a944a['uniqueid']][_0x4785('0x2e')]=channels[_0x4a944a['uniqueid']][_0x4785('0x25')]?utils[_0x4785('0x2d')](channels[_0x4a944a[_0x4785('0x6')]]['endtime'],channels[_0x4a944a[_0x4785('0x6')]][_0x4785('0x25')]):0x0;writeDB(channels[_0x4a944a[_0x4785('0x6')]]);}}catch(_0x365c00){utils[_0x4785('0x1c')](util[_0x4785('0x17')](_0x4785('0x28'),_0x4a944a[_0x4785('0x6')]),_0x365c00);}};exports[_0x4785('0x2f')]=function(_0x389c46){try{if(!_['isNil'](channels[_0x389c46[_0x4785('0x30')]])){utils[_0x4785('0x13')](util[_0x4785('0x17')](_0x4785('0x31'),_0x389c46['origtransfereruniqueid']),_0x389c46);if(channels[_0x389c46[_0x4785('0x30')]]['channel']==_0x389c46['transfereechannel']){utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x32'),_0x389c46[_0x4785('0x33')],_0x389c46[_0x4785('0x30')],_0x389c46[_0x4785('0x34')]));channels[_0x389c46['localtwolinkedid']][_0x4785('0x24')]=_0x389c46[_0x4785('0x34')];channels[_0x389c46[_0x4785('0x30')]][_0x4785('0x35')]=_0x4785('0x36');}else if(channels[_0x389c46[_0x4785('0x30')]]['channel']=_0x389c46['transfertargetchannel']){utils[_0x4785('0x5')](util['format'](_0x4785('0x32'),_0x389c46[_0x4785('0x33')],_0x389c46[_0x4785('0x30')],_0x389c46[_0x4785('0x37')]));channels[_0x389c46['localtwolinkedid']][_0x4785('0x24')]=_0x389c46[_0x4785('0x37')];channels[_0x389c46['localtwolinkedid']][_0x4785('0x35')]=_0x4785('0x36');}}}catch(_0x4c84dc){utils[_0x4785('0x1c')](util['format'](_0x4785('0x31'),_0x389c46[_0x4785('0x33')]),_0x4c84dc);}};exports[_0x4785('0x38')]=function(_0x1eb5c5){try{if(!_[_0x4785('0x1e')](channels[_0x1eb5c5[_0x4785('0x6')]])){utils[_0x4785('0x13')](util['format']('[%s][calls][musiconholdstart]',_0x1eb5c5[_0x4785('0x6')]),_0x1eb5c5);channels[_0x1eb5c5['uniqueid']][_0x4785('0x39')]=utils[_0x4785('0x1b')]();utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x3a'),_0x1eb5c5[_0x4785('0x6')],channels[_0x1eb5c5[_0x4785('0x6')]][_0x4785('0x39')]));}}catch(_0x10694b){utils['error'](util['format'](_0x4785('0x3b'),_0x1eb5c5['uniqueid']),_0x10694b);}};exports[_0x4785('0x3c')]=function(_0x5aa210){try{if(!_['isNil'](channels[_0x5aa210[_0x4785('0x6')]])){utils[_0x4785('0x13')](util[_0x4785('0x17')](_0x4785('0x3d'),_0x5aa210[_0x4785('0x6')]),_0x5aa210);if(!_[_0x4785('0x1e')](channels[_0x5aa210[_0x4785('0x6')]]['musiconholdstartAt'])){channels[_0x5aa210[_0x4785('0x6')]]['mohtime']+=utils[_0x4785('0x2d')](utils[_0x4785('0x1b')](),channels[_0x5aa210[_0x4785('0x6')]][_0x4785('0x39')]);utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x3e'),_0x5aa210['uniqueid'],channels[_0x5aa210[_0x4785('0x6')]][_0x4785('0x3f')]));delete channels[_0x5aa210[_0x4785('0x6')]][_0x4785('0x39')];}}}catch(_0x139fa0){utils[_0x4785('0x1c')](util[_0x4785('0x17')](_0x4785('0x3d'),_0x5aa210[_0x4785('0x6')]),_0x139fa0);}};exports[_0x4785('0x40')]=function(_0x15a07d){try{if(!_['isNil'](channels[_0x15a07d[_0x4785('0x6')]])){utils[_0x4785('0x13')](util[_0x4785('0x17')](_0x4785('0x41'),_0x15a07d[_0x4785('0x6')]),_0x15a07d);if(!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')]['xmd-originatecalleridnum'])){utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x43'),_0x15a07d[_0x4785('0x6')],_0x15a07d[_0x4785('0x44')]));channels[_0x15a07d['uniqueid']][_0x4785('0x45')]=_0x15a07d[_0x4785('0x44')];}if(!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')][_0x4785('0x46')])){utils['info'](util[_0x4785('0x17')](_0x4785('0x47'),_0x15a07d['uniqueid'],_0x15a07d[_0x4785('0x44')]));channels[_0x15a07d[_0x4785('0x6')]][_0x4785('0x48')]=_0x15a07d[_0x4785('0x44')];channels[_0x15a07d[_0x4785('0x6')]][_0x4785('0x29')]='\x22'+_0x15a07d[_0x4785('0x44')]+_0x4785('0x49')+_0x15a07d[_0x4785('0x44')]+'>';}if(!_['isNil'](_0x15a07d['variable'][_0x4785('0x4a')])||!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')]['xmd-callerid'])){utils[_0x4785('0x5')](util['format'](_0x4785('0x4b'),_0x15a07d[_0x4785('0x6')],!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')][_0x4785('0x4a')])?'xmd-callerid-preview':_0x4785('0x4c'),_0x15a07d[_0x4785('0x44')]));channels[_0x15a07d['uniqueid']][_0x4785('0x29')]=_0x15a07d[_0x4785('0x44')];}if(!_[_0x4785('0x1e')](_0x15a07d['variable'][_0x4785('0x4d')])||!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')][_0x4785('0x4e')])){utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x4b'),_0x15a07d[_0x4785('0x6')],!_[_0x4785('0x1e')](_0x15a07d['variable'][_0x4785('0x4d')])?_0x4785('0x4d'):'xmcs-queue',_0x15a07d['value']));channels[_0x15a07d[_0x4785('0x6')]]['lastapplication']=_0x4785('0x4f');channels[_0x15a07d[_0x4785('0x6')]][_0x4785('0x50')]=_0x15a07d[_0x4785('0x44')];channels[_0x15a07d['uniqueid']][_0x4785('0x51')]=!![];}if(!_['isNil'](_0x15a07d[_0x4785('0x42')]['xmd-contactid'])){utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x52'),_0x15a07d[_0x4785('0x6')],_0x15a07d[_0x4785('0x44')]));channels[_0x15a07d['uniqueid']][_0x4785('0x53')]=_0x15a07d[_0x4785('0x44')];}if(!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')][_0x4785('0x54')])){utils[_0x4785('0x5')](util[_0x4785('0x17')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x15a07d[_0x4785('0x6')],_0x15a07d['value']));channels[_0x15a07d[_0x4785('0x6')]][_0x4785('0x55')]=_0x15a07d[_0x4785('0x44')];}if(!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')]['outboundrouteid'])){utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x56'),_0x15a07d[_0x4785('0x6')],_0x15a07d['value']));channels[_0x15a07d[_0x4785('0x6')]]['routeid']=_0x15a07d['value'];}if(!_[_0x4785('0x1e')](_0x15a07d[_0x4785('0x42')][_0x4785('0x57')])){utils['info'](util['format'](_0x4785('0x58'),_0x15a07d[_0x4785('0x6')],_0x15a07d[_0x4785('0x44')]));channels[_0x15a07d[_0x4785('0x6')]][_0x4785('0x57')]=_0x15a07d['value'];}}}catch(_0x238fb2){utils[_0x4785('0x1c')](util[_0x4785('0x17')](_0x4785('0x41'),_0x15a07d['uniqueid']),_0x238fb2);}};exports['newexten']=function(_0x38067d){try{if(!_[_0x4785('0x1e')](channels[_0x38067d[_0x4785('0x6')]])){utils['debug'](util[_0x4785('0x17')](_0x4785('0x59'),_0x38067d['uniqueid']),_0x38067d);utils[_0x4785('0x5')](util[_0x4785('0x17')](_0x4785('0x5a'),_0x38067d[_0x4785('0x6')],_0x38067d[_0x4785('0x5b')],_0x38067d[_0x4785('0x5c')]));if(_0x38067d[_0x4785('0x5b')]['toLowerCase']()==_0x4785('0x5d')&&_[_0x4785('0x5e')](_0x38067d[_0x4785('0x5c')][_0x4785('0x5f')](),_0x4785('0x60'))){var _0x2a3085=_0x38067d[_0x4785('0x5c')][_0x4785('0x61')]('=');var _0x17dfb9=_0x2a3085[0x0][_0x4785('0x62')](_0x2a3085[0x0][_0x4785('0x63')]('(')+0x1,_0x2a3085[0x0][_0x4785('0x63')](')'));var _0x34a2b2=_0x2a3085[0x1];channels[_0x38067d[_0x4785('0x6')]][_0x17dfb9]=_0x34a2b2;}if(!_[_0x4785('0x64')](['hangup',_0x4785('0x65'),_0x4785('0x66'),_0x4785('0x5d'),_0x4785('0x67')],_0x38067d['application'][_0x4785('0x5f')]())){channels[_0x38067d[_0x4785('0x6')]]['lastapplication']=_0x38067d['application'];channels[_0x38067d[_0x4785('0x6')]][_0x4785('0x50')]=_0x38067d[_0x4785('0x5c')];}}}catch(_0x1d18c1){utils['error'](util[_0x4785('0x17')]('[%s][calls][newexten]',_0x38067d[_0x4785('0x6')]),_0x1d18c1);}}; \ No newline at end of file +var _0xe590=['ANSWERED','BUSY','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','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','variable','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER'];(function(_0x51dbe6,_0x168883){var _0x3767a1=function(_0x16b161){while(--_0x16b161){_0x51dbe6['push'](_0x51dbe6['shift']());}};_0x3767a1(++_0x168883);}(_0xe590,0x148));var _0x0e59=function(_0x61aaa5,_0x43362d){_0x61aaa5=_0x61aaa5-0x0;var _0x340eee=_0xe590[_0x61aaa5];return _0x340eee;};'use strict';var _=require(_0x0e59('0x0'));var util=require(_0x0e59('0x1'));var utils=require(_0x0e59('0x2'));var dispositions=['NO\x20ANSWER',_0x0e59('0x3'),_0x0e59('0x3'),_0x0e59('0x4'),_0x0e59('0x4'),'NO\x20ANSWER',_0x0e59('0x5'),_0x0e59('0x6'),_0x0e59('0x3'),_0x0e59('0x3'),_0x0e59('0x3')];var channels={};function writeDB(_0x39988c){utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x9'),_0x39988c['uniqueid'],_0x39988c[_0x0e59('0xa')],_0x39988c[_0x0e59('0xb')],_0x39988c[_0x0e59('0xc')],_0x39988c[_0x0e59('0xd')],_0x39988c[_0x0e59('0xe')],_0x39988c[_0x0e59('0xf')],_0x39988c[_0x0e59('0x10')]));if(_0x39988c[_0x0e59('0x11')]){utils[_0x0e59('0x12')](_0x39988c[_0x0e59('0x11')])[_0x0e59('0x13')](function(_0x365339){if(_0x365339){_0x39988c[_0x0e59('0x14')]=_0x365339['id'];}utils['request'](_0x0e59('0x15'),_0x39988c);});}else{utils[_0x0e59('0x16')](_0x0e59('0x15'),_0x39988c);}if(channels[_0x39988c[_0x0e59('0x17')]]){delete channels[_0x39988c[_0x0e59('0x17')]];}}exports[_0x0e59('0x18')]=function(_0x232e8e){try{utils[_0x0e59('0x19')](util['format'](_0x0e59('0x1a'),_0x232e8e['uniqueid']),_0x232e8e);if(_0x232e8e[_0x0e59('0x17')]==_0x232e8e[_0x0e59('0x1b')]&&_0x232e8e[_0x0e59('0xa')]!=_0x0e59('0x1c')){utils['info'](util[_0x0e59('0x8')](_0x0e59('0x1d'),_0x232e8e[_0x0e59('0x17')],_0x232e8e['context'],_0x232e8e[_0x0e59('0x1e')]));channels[_0x232e8e[_0x0e59('0x17')]]={'uniqueid':_0x232e8e[_0x0e59('0x17')],'accountcode':_0x232e8e[_0x0e59('0x11')],'source':_0x232e8e[_0x0e59('0xe')],'destination':_0x232e8e[_0x0e59('0x1e')],'destinationcontext':_0x232e8e[_0x0e59('0x1f')],'channel':_0x232e8e[_0x0e59('0xa')],'starttime':utils[_0x0e59('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0e59('0x4'),'amaflags':_0x0e59('0x21')};}}catch(_0x25e80e){utils[_0x0e59('0x22')](util['format'](_0x0e59('0x1a'),_0x232e8e[_0x0e59('0x17')]),_0x25e80e);}};exports[_0x0e59('0x23')]=function(_0x6d7964){try{utils[_0x0e59('0x19')](util[_0x0e59('0x8')](_0x0e59('0x24'),_0x6d7964[_0x0e59('0x17')]),_0x6d7964);if(!_[_0x0e59('0x25')](channels[_0x6d7964[_0x0e59('0x17')]])&&_0x6d7964['channelstate']==0x6){utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x26'),_0x6d7964['uniqueid'],_0x6d7964[_0x0e59('0x1f')],_0x6d7964[_0x0e59('0xa')]));if(_['isNil'](channels[_0x6d7964['uniqueid']]['systemanswertime'])){channels[_0x6d7964['uniqueid']][_0x0e59('0x27')]=utils[_0x0e59('0x20')]();}}else if(!_['isNil'](channels[_0x6d7964[_0x0e59('0x1b')]])&&_0x6d7964[_0x0e59('0x28')]==0x6&&_0x6d7964[_0x0e59('0x1f')]!=_0x0e59('0x29')){utils[_0x0e59('0x7')](util['format'](_0x0e59('0x2a'),_0x6d7964['uniqueid'],_0x6d7964[_0x0e59('0x1b')],_0x6d7964[_0x0e59('0x1f')],_0x6d7964[_0x0e59('0xa')]));channels[_0x6d7964['linkedid']][_0x0e59('0x11')]=_0x6d7964[_0x0e59('0x11')];channels[_0x6d7964[_0x0e59('0x1b')]][_0x0e59('0x2b')]=_0x6d7964[_0x0e59('0xa')];if(_[_0x0e59('0x25')](channels[_0x6d7964[_0x0e59('0x1b')]][_0x0e59('0x2c')])){channels[_0x6d7964[_0x0e59('0x1b')]][_0x0e59('0x2c')]=utils[_0x0e59('0x20')]();}channels[_0x6d7964[_0x0e59('0x1b')]][_0x0e59('0x2d')]=dispositions[_[_0x0e59('0x2e')](_0x6d7964[_0x0e59('0x28')])]||_0x0e59('0x5');}}catch(_0x54436c){utils[_0x0e59('0x22')](util[_0x0e59('0x8')](_0x0e59('0x24'),_0x6d7964[_0x0e59('0x17')]),_0x54436c);}};exports['hangup']=function(_0x50e24b){try{if(!_[_0x0e59('0x25')](channels[_0x50e24b['uniqueid']])){utils[_0x0e59('0x19')](util[_0x0e59('0x8')](_0x0e59('0x2f'),_0x50e24b[_0x0e59('0x17')]),_0x50e24b);if(_[_0x0e59('0x25')](channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x30')])){channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x30')]=_0x50e24b[_0x0e59('0x31')]+'\x20<'+_0x50e24b[_0x0e59('0xe')]+'>';}utils[_0x0e59('0x7')](util[_0x0e59('0x8')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x50e24b[_0x0e59('0x17')],channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x30')],_0x50e24b['cause-txt']));channels[_0x50e24b['uniqueid']][_0x0e59('0x32')]=utils['now']();channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x33')]=utils[_0x0e59('0x34')](channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x32')],channels[_0x50e24b['uniqueid']]['starttime']);channels[_0x50e24b[_0x0e59('0x17')]]['billableseconds']=channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x2c')]?utils[_0x0e59('0x34')](channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x32')],channels[_0x50e24b[_0x0e59('0x17')]][_0x0e59('0x2c')]):0x0;writeDB(channels[_0x50e24b[_0x0e59('0x17')]]);}}catch(_0x3ca719){utils['error'](util[_0x0e59('0x8')](_0x0e59('0x2f'),_0x50e24b[_0x0e59('0x17')]),_0x3ca719);}};exports[_0x0e59('0x35')]=function(_0x26d042){try{if(!_['isNil'](channels[_0x26d042[_0x0e59('0x36')]])){utils[_0x0e59('0x19')](util[_0x0e59('0x8')](_0x0e59('0x37'),_0x26d042[_0x0e59('0x38')]),_0x26d042);if(channels[_0x26d042[_0x0e59('0x36')]]['channel']==_0x26d042['transfereechannel']){utils[_0x0e59('0x7')](util['format'](_0x0e59('0x39'),_0x26d042['origtransfereruniqueid'],_0x26d042['localtwolinkedid'],_0x26d042[_0x0e59('0x3a')]));channels[_0x26d042[_0x0e59('0x36')]][_0x0e59('0x2b')]=_0x26d042[_0x0e59('0x3a')];channels[_0x26d042[_0x0e59('0x36')]][_0x0e59('0x3b')]='_attended';}else if(channels[_0x26d042['localtwolinkedid']][_0x0e59('0xa')]=_0x26d042[_0x0e59('0x3c')]){utils['info'](util[_0x0e59('0x8')](_0x0e59('0x39'),_0x26d042[_0x0e59('0x38')],_0x26d042[_0x0e59('0x36')],_0x26d042[_0x0e59('0x3d')]));channels[_0x26d042[_0x0e59('0x36')]]['destinationchannel']=_0x26d042[_0x0e59('0x3d')];channels[_0x26d042[_0x0e59('0x36')]][_0x0e59('0x3b')]=_0x0e59('0x3e');}}}catch(_0x4ca2ba){utils[_0x0e59('0x22')](util[_0x0e59('0x8')](_0x0e59('0x37'),_0x26d042[_0x0e59('0x38')]),_0x4ca2ba);}};exports[_0x0e59('0x3f')]=function(_0x4f0156){try{if(!_[_0x0e59('0x25')](channels[_0x4f0156[_0x0e59('0x17')]])){utils['debug'](util[_0x0e59('0x8')](_0x0e59('0x40'),_0x4f0156[_0x0e59('0x17')]),_0x4f0156);channels[_0x4f0156[_0x0e59('0x17')]][_0x0e59('0x41')]=utils[_0x0e59('0x20')]();utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x42'),_0x4f0156[_0x0e59('0x17')],channels[_0x4f0156['uniqueid']][_0x0e59('0x41')]));}}catch(_0x5e2206){utils['error'](util['format'](_0x0e59('0x40'),_0x4f0156[_0x0e59('0x17')]),_0x5e2206);}};exports[_0x0e59('0x43')]=function(_0x5ba762){try{if(!_[_0x0e59('0x25')](channels[_0x5ba762[_0x0e59('0x17')]])){utils[_0x0e59('0x19')](util[_0x0e59('0x8')](_0x0e59('0x44'),_0x5ba762['uniqueid']),_0x5ba762);if(!_[_0x0e59('0x25')](channels[_0x5ba762[_0x0e59('0x17')]][_0x0e59('0x41')])){channels[_0x5ba762[_0x0e59('0x17')]][_0x0e59('0x45')]+=utils[_0x0e59('0x34')](utils[_0x0e59('0x20')](),channels[_0x5ba762[_0x0e59('0x17')]][_0x0e59('0x41')]);utils[_0x0e59('0x7')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5ba762[_0x0e59('0x17')],channels[_0x5ba762[_0x0e59('0x17')]][_0x0e59('0x45')]));delete channels[_0x5ba762[_0x0e59('0x17')]][_0x0e59('0x41')];}}}catch(_0x138d49){utils[_0x0e59('0x22')](util[_0x0e59('0x8')](_0x0e59('0x44'),_0x5ba762[_0x0e59('0x17')]),_0x138d49);}};exports['varset']=function(_0x52e0dc){try{if(!_['isNil'](channels[_0x52e0dc[_0x0e59('0x17')]])){utils[_0x0e59('0x19')](util['format']('[%s][calls][varset]',_0x52e0dc[_0x0e59('0x17')]),_0x52e0dc);if(!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')]['xmd-originatecalleridnum'])){utils[_0x0e59('0x7')](util[_0x0e59('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x52e0dc[_0x0e59('0x17')],_0x52e0dc['value']));channels[_0x52e0dc[_0x0e59('0x17')]][_0x0e59('0x47')]=_0x52e0dc[_0x0e59('0x48')];}if(!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x49')])){utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x4a'),_0x52e0dc['uniqueid'],_0x52e0dc[_0x0e59('0x48')]));channels[_0x52e0dc[_0x0e59('0x17')]][_0x0e59('0x4b')]=_0x52e0dc['value'];channels[_0x52e0dc['uniqueid']][_0x0e59('0x30')]='\x22'+_0x52e0dc[_0x0e59('0x48')]+_0x0e59('0x4c')+_0x52e0dc[_0x0e59('0x48')]+'>';}if(!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x4d')])||!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')]['xmd-callerid'])){utils['info'](util['format'](_0x0e59('0x4e'),_0x52e0dc[_0x0e59('0x17')],!_[_0x0e59('0x25')](_0x52e0dc['variable'][_0x0e59('0x4d')])?_0x0e59('0x4d'):_0x0e59('0x4f'),_0x52e0dc[_0x0e59('0x48')]));channels[_0x52e0dc['uniqueid']][_0x0e59('0x30')]=_0x52e0dc[_0x0e59('0x48')];}if(!_['isNil'](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x50')])||!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x51')])){utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x4e'),_0x52e0dc[_0x0e59('0x17')],!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x50')])?'xmd-queue':_0x0e59('0x51'),_0x52e0dc[_0x0e59('0x48')]));channels[_0x52e0dc['uniqueid']][_0x0e59('0x52')]=_0x0e59('0x53');channels[_0x52e0dc[_0x0e59('0x17')]][_0x0e59('0x54')]=_0x52e0dc[_0x0e59('0x48')];channels[_0x52e0dc[_0x0e59('0x17')]][_0x0e59('0xb')]=!![];}if(!_['isNil'](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x55')])){utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x56'),_0x52e0dc['uniqueid'],_0x52e0dc[_0x0e59('0x48')]));channels[_0x52e0dc['uniqueid']]['ContactId']=_0x52e0dc[_0x0e59('0x48')];}if(!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')]['xmd-cdrtype'])){utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x57'),_0x52e0dc[_0x0e59('0x17')],_0x52e0dc[_0x0e59('0x48')]));channels[_0x52e0dc[_0x0e59('0x17')]][_0x0e59('0x58')]=_0x52e0dc[_0x0e59('0x48')];}if(!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x59')])){utils['info'](util['format'](_0x0e59('0x5a'),_0x52e0dc[_0x0e59('0x17')],_0x52e0dc[_0x0e59('0x48')]));channels[_0x52e0dc[_0x0e59('0x17')]][_0x0e59('0x5b')]=_0x52e0dc['value'];}if(!_[_0x0e59('0x25')](_0x52e0dc[_0x0e59('0x46')][_0x0e59('0x5c')])){utils[_0x0e59('0x7')](util[_0x0e59('0x8')](_0x0e59('0x5d'),_0x52e0dc[_0x0e59('0x17')],_0x52e0dc[_0x0e59('0x48')]));channels[_0x52e0dc[_0x0e59('0x17')]][_0x0e59('0x5c')]=_0x52e0dc[_0x0e59('0x48')];}}}catch(_0x4071fe){utils[_0x0e59('0x22')](util[_0x0e59('0x8')](_0x0e59('0x5e'),_0x52e0dc[_0x0e59('0x17')]),_0x4071fe);}};exports[_0x0e59('0x5f')]=function(_0x107af4){try{if(!_['isNil'](channels[_0x107af4[_0x0e59('0x17')]])){utils[_0x0e59('0x19')](util['format'](_0x0e59('0x60'),_0x107af4[_0x0e59('0x17')]),_0x107af4);utils['info'](util[_0x0e59('0x8')](_0x0e59('0x61'),_0x107af4[_0x0e59('0x17')],_0x107af4[_0x0e59('0x62')],_0x107af4[_0x0e59('0x63')]));if(_0x107af4[_0x0e59('0x62')]['toLowerCase']()==_0x0e59('0x64')&&_[_0x0e59('0x65')](_0x107af4['appdata'][_0x0e59('0x66')](),_0x0e59('0x67'))){var _0x4d8c16=_0x107af4[_0x0e59('0x63')][_0x0e59('0x68')]('=');var _0x346896=_0x4d8c16[0x0]['substring'](_0x4d8c16[0x0]['lastIndexOf']('(')+0x1,_0x4d8c16[0x0][_0x0e59('0x69')](')'));var _0x1a345e=_0x4d8c16[0x1];channels[_0x107af4[_0x0e59('0x17')]][_0x346896]=_0x1a345e;}if(!_[_0x0e59('0x6a')]([_0x0e59('0x6b'),_0x0e59('0x6c'),_0x0e59('0x6d'),_0x0e59('0x64'),_0x0e59('0x6e')],_0x107af4['application']['toLowerCase']())){channels[_0x107af4[_0x0e59('0x17')]][_0x0e59('0x52')]=_0x107af4[_0x0e59('0x62')];channels[_0x107af4[_0x0e59('0x17')]][_0x0e59('0x54')]=_0x107af4[_0x0e59('0x63')];}}}catch(_0x3b2364){utils[_0x0e59('0x22')](util[_0x0e59('0x8')](_0x0e59('0x60'),_0x107af4[_0x0e59('0x17')]),_0x3b2364);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 40fdd6d..e929e9d 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 _0xa33a=['error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted'];(function(_0x1f6db5,_0x403788){var _0x24c2af=function(_0x8271c8){while(--_0x8271c8){_0x1f6db5['push'](_0x1f6db5['shift']());}};_0x24c2af(++_0x403788);}(_0xa33a,0x1e1));var _0xaa33=function(_0x198fce,_0x37df8f){_0x198fce=_0x198fce-0x0;var _0x139868=_0xa33a[_0x198fce];return _0x139868;};'use strict';var utils=require('./utils');exports[_0xaa33('0x0')]=function(){utils[_0xaa33('0x1')](_0xaa33('0x2'));};exports['shutdown']=function(){utils[_0xaa33('0x1')](_0xaa33('0x3'));};exports[_0xaa33('0x4')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x460975){utils[_0xaa33('0x5')]('[core]\x20error',_0x460975);};exports[_0xaa33('0x6')]=function(){utils[_0xaa33('0x1')](_0xaa33('0x7'));};exports[_0xaa33('0x8')]=function(_0x55df32){}; \ No newline at end of file +var _0x53fc=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x53fc,0x1de));var _0xc53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fc[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require('./utils');exports[_0xc53f('0x0')]=function(){utils[_0xc53f('0x1')](_0xc53f('0x2'));};exports[_0xc53f('0x3')]=function(){utils['info'](_0xc53f('0x4'));};exports[_0xc53f('0x5')]=function(){utils['info'](_0xc53f('0x6'));};exports[_0xc53f('0x7')]=function(_0x48dded){utils[_0xc53f('0x7')](_0xc53f('0x8'),_0x48dded);};exports[_0xc53f('0x9')]=function(){utils[_0xc53f('0x1')](_0xc53f('0xa'));};exports[_0xc53f('0xb')]=function(_0x11ffa8){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0c5a066..588c4cb 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 _0xce72=['dialstatus','request','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][hangup]','cause-txt','complete','endtime','billableseconds','diffTime','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum'];(function(_0x31cc6e,_0x4da430){var _0x39a234=function(_0x3fe7cd){while(--_0x3fe7cd){_0x31cc6e['push'](_0x31cc6e['shift']());}};_0x39a234(++_0x4da430);}(_0xce72,0xd8));var _0x2ce7=function(_0x397261,_0xff6699){_0x397261=_0x397261-0x0;var _0x3c4fde=_0xce72[_0x397261];return _0x3c4fde;};'use strict';var _=require('lodash');var util=require(_0x2ce7('0x0'));var utils=require(_0x2ce7('0x1'));var dials={};function writeDB(_0x41ea12){utils['info'](util[_0x2ce7('0x2')](_0x2ce7('0x3'),_0x41ea12[_0x2ce7('0x4')],_0x41ea12[_0x2ce7('0x5')],_0x41ea12[_0x2ce7('0x6')],_0x41ea12[_0x2ce7('0x7')],_0x41ea12[_0x2ce7('0x8')],_0x41ea12[_0x2ce7('0x9')]));utils[_0x2ce7('0xa')]('CreateVoiceDialReport',_0x41ea12);delete dials[_0x41ea12[_0x2ce7('0x4')]];}exports[_0x2ce7('0xb')]=function(_0x294a5d){try{utils[_0x2ce7('0xc')](util[_0x2ce7('0x2')](_0x2ce7('0xd'),_0x294a5d[_0x2ce7('0x4')]),_0x294a5d);utils[_0x2ce7('0xe')](util['format'](_0x2ce7('0xf'),_0x294a5d[_0x2ce7('0x4')],_0x294a5d[_0x2ce7('0x10')],_0x294a5d[_0x2ce7('0x11')]));if(_0x294a5d[_0x2ce7('0x10')][_0x2ce7('0x12')]()==_0x2ce7('0x13')&&_[_0x2ce7('0x14')](_0x294a5d[_0x2ce7('0x11')]['toLowerCase'](),_0x2ce7('0x15'))){var _0x290132=_0x294a5d['appdata'][_0x2ce7('0x16')]('=');dials[_0x294a5d[_0x2ce7('0x4')]]={'routeId':_0x290132[0x1]};}}catch(_0x268114){utils[_0x2ce7('0x17')](util[_0x2ce7('0x2')]('[%s][dials][newexten]',_0x294a5d[_0x2ce7('0x4')]),_0x268114);}};exports['varset']=function(_0x4c8497){try{utils[_0x2ce7('0xc')](util[_0x2ce7('0x2')](_0x2ce7('0x18'),_0x4c8497[_0x2ce7('0x4')]),_0x4c8497);if(!_[_0x2ce7('0x19')](_0x4c8497['variable']['outboundrouteid'])){utils[_0x2ce7('0xe')](util['format'](_0x2ce7('0x1a'),_0x4c8497[_0x2ce7('0x4')],_0x4c8497['value']));dials[_0x4c8497[_0x2ce7('0x4')]]={'routeId':_0x4c8497[_0x2ce7('0x1b')]};}}catch(_0x360d45){utils[_0x2ce7('0x17')](util[_0x2ce7('0x2')](_0x2ce7('0x18'),_0x4c8497[_0x2ce7('0x4')]),_0x360d45);}};exports['dialbegin']=function(_0x5c506e){try{if(!_['isNil'](dials[_0x5c506e[_0x2ce7('0x4')]])){utils[_0x2ce7('0xc')](util[_0x2ce7('0x2')]('[%s][dials][dialbegin]',_0x5c506e[_0x2ce7('0x4')]),_0x5c506e);dials[_0x5c506e[_0x2ce7('0x4')]]=_[_0x2ce7('0x1c')](dials[_0x5c506e['uniqueid']],_0x5c506e);dials[_0x5c506e[_0x2ce7('0x4')]][_0x2ce7('0x1d')]=utils[_0x2ce7('0x1e')]();dials[_0x5c506e[_0x2ce7('0x4')]][_0x2ce7('0x1f')]=_0x2ce7('0x20');utils[_0x2ce7('0xe')](util[_0x2ce7('0x2')](_0x2ce7('0x21'),_0x5c506e['uniqueid'],dials[_0x5c506e[_0x2ce7('0x4')]][_0x2ce7('0x1d')]));}}catch(_0x3ac4f4){utils[_0x2ce7('0x17')](util['format'](_0x2ce7('0x22'),_0x5c506e['uniqueid']),_0x3ac4f4);}};exports['dialend']=function(_0xe31e3d){try{if(!_[_0x2ce7('0x19')](dials[_0xe31e3d[_0x2ce7('0x4')]])){utils[_0x2ce7('0xc')](util[_0x2ce7('0x2')](_0x2ce7('0x23'),_0xe31e3d[_0x2ce7('0x4')]),_0xe31e3d);dials[_0xe31e3d[_0x2ce7('0x4')]][_0x2ce7('0x9')]=_0xe31e3d['dialstatus'];if(_0xe31e3d[_0x2ce7('0x9')]==_0x2ce7('0x24')){dials[_0xe31e3d[_0x2ce7('0x4')]]=_['assign'](dials[_0xe31e3d[_0x2ce7('0x4')]],_0xe31e3d);dials[_0xe31e3d[_0x2ce7('0x4')]][_0x2ce7('0x25')]=utils['now']();dials[_0xe31e3d[_0x2ce7('0x4')]][_0x2ce7('0x1f')]=_0x2ce7('0x26');utils[_0x2ce7('0xe')](util[_0x2ce7('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0xe31e3d[_0x2ce7('0x4')],_0xe31e3d[_0x2ce7('0x9')],dials[_0xe31e3d[_0x2ce7('0x4')]][_0x2ce7('0x25')]));}else{utils[_0x2ce7('0xe')](util[_0x2ce7('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0xe31e3d['uniqueid'],_0xe31e3d[_0x2ce7('0x9')]));}}}catch(_0x28488e){utils[_0x2ce7('0x17')](util[_0x2ce7('0x2')]('[%s][dials][dialend]',_0xe31e3d['uniqueid']),_0x28488e);}};exports['hangup']=function(_0x31b798){try{if(!_[_0x2ce7('0x19')](dials[_0x31b798[_0x2ce7('0x4')]])){utils['debug'](util[_0x2ce7('0x2')](_0x2ce7('0x27'),_0x31b798['uniqueid']),_0x31b798);utils[_0x2ce7('0xe')](util[_0x2ce7('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x31b798['uniqueid'],_0x31b798['calleridnum'],_0x31b798['calleridname'],_0x31b798[_0x2ce7('0x28')]));dials[_0x31b798[_0x2ce7('0x4')]]=_['assign'](dials[_0x31b798[_0x2ce7('0x4')]],{'endtime':utils[_0x2ce7('0x1e')](),'lastevent':_0x2ce7('0x29')});dials[_0x31b798[_0x2ce7('0x4')]]['duration']=utils['diffTime'](dials[_0x31b798['uniqueid']]['endtime'],dials[_0x31b798[_0x2ce7('0x4')]][_0x2ce7('0x1d')]);dials[_0x31b798[_0x2ce7('0x4')]]['holdtime']=utils['diffTime'](dials[_0x31b798[_0x2ce7('0x4')]]['answertime']||dials[_0x31b798[_0x2ce7('0x4')]][_0x2ce7('0x2a')],dials[_0x31b798[_0x2ce7('0x4')]][_0x2ce7('0x1d')]);dials[_0x31b798[_0x2ce7('0x4')]][_0x2ce7('0x2b')]=dials[_0x31b798[_0x2ce7('0x4')]]['answertime']?utils[_0x2ce7('0x2c')](dials[_0x31b798[_0x2ce7('0x4')]][_0x2ce7('0x2a')],dials[_0x31b798['uniqueid']][_0x2ce7('0x25')]):0x0;writeDB(dials[_0x31b798[_0x2ce7('0x4')]]);}}catch(_0x438e28){utils['error'](util[_0x2ce7('0x2')](_0x2ce7('0x27'),_0x31b798[_0x2ce7('0x4')]),_0x438e28);}}; \ No newline at end of file +var _0x0a32=['[%s][dials][hangup]','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','appdata','toLowerCase','set','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','now','called','error','dialend','ANSWER','assign','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','billableseconds'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0x0a32,0xf6));var _0x20a3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0a32[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x20a3('0x0'));var util=require('util');var utils=require(_0x20a3('0x1'));var dials={};function writeDB(_0xe680f3){utils[_0x20a3('0x2')](util[_0x20a3('0x3')](_0x20a3('0x4'),_0xe680f3['uniqueid'],_0xe680f3[_0x20a3('0x5')],_0xe680f3['dialstring'],_0xe680f3[_0x20a3('0x6')],_0xe680f3[_0x20a3('0x7')],_0xe680f3[_0x20a3('0x8')]));utils['request'](_0x20a3('0x9'),_0xe680f3);delete dials[_0xe680f3['uniqueid']];}exports[_0x20a3('0xa')]=function(_0x579446){try{utils[_0x20a3('0xb')](util[_0x20a3('0x3')](_0x20a3('0xc'),_0x579446[_0x20a3('0xd')]),_0x579446);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x579446[_0x20a3('0xd')],_0x579446['application'],_0x579446[_0x20a3('0xe')]));if(_0x579446['application'][_0x20a3('0xf')]()==_0x20a3('0x10')&&_['startsWith'](_0x579446[_0x20a3('0xe')][_0x20a3('0xf')](),_0x20a3('0x11'))){var _0x1af6ee=_0x579446[_0x20a3('0xe')][_0x20a3('0x12')]('=');dials[_0x579446[_0x20a3('0xd')]]={'routeId':_0x1af6ee[0x1]};}}catch(_0x2d4660){utils['error'](util['format']('[%s][dials][newexten]',_0x579446[_0x20a3('0xd')]),_0x2d4660);}};exports[_0x20a3('0x13')]=function(_0x47b440){try{utils[_0x20a3('0xb')](util[_0x20a3('0x3')](_0x20a3('0x14'),_0x47b440[_0x20a3('0xd')]),_0x47b440);if(!_[_0x20a3('0x15')](_0x47b440[_0x20a3('0x16')][_0x20a3('0x17')])){utils[_0x20a3('0x2')](util[_0x20a3('0x3')](_0x20a3('0x18'),_0x47b440[_0x20a3('0xd')],_0x47b440[_0x20a3('0x19')]));dials[_0x47b440[_0x20a3('0xd')]]={'routeId':_0x47b440[_0x20a3('0x19')]};}}catch(_0x2d1328){utils['error'](util[_0x20a3('0x3')](_0x20a3('0x14'),_0x47b440[_0x20a3('0xd')]),_0x2d1328);}};exports[_0x20a3('0x1a')]=function(_0x1f4bee){try{if(!_[_0x20a3('0x15')](dials[_0x1f4bee[_0x20a3('0xd')]])){utils['debug'](util['format']('[%s][dials][dialbegin]',_0x1f4bee['uniqueid']),_0x1f4bee);dials[_0x1f4bee['uniqueid']]=_['assign'](dials[_0x1f4bee[_0x20a3('0xd')]],_0x1f4bee);dials[_0x1f4bee[_0x20a3('0xd')]][_0x20a3('0x1b')]=utils[_0x20a3('0x1c')]();dials[_0x1f4bee['uniqueid']]['lastevent']=_0x20a3('0x1d');utils['info'](util[_0x20a3('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1f4bee[_0x20a3('0xd')],dials[_0x1f4bee[_0x20a3('0xd')]][_0x20a3('0x1b')]));}}catch(_0x637507){utils[_0x20a3('0x1e')](util[_0x20a3('0x3')]('[%s][dials][dialbegin]',_0x1f4bee[_0x20a3('0xd')]),_0x637507);}};exports[_0x20a3('0x1f')]=function(_0x34f542){try{if(!_[_0x20a3('0x15')](dials[_0x34f542[_0x20a3('0xd')]])){utils['debug'](util[_0x20a3('0x3')]('[%s][dials][dialend]',_0x34f542[_0x20a3('0xd')]),_0x34f542);dials[_0x34f542[_0x20a3('0xd')]][_0x20a3('0x8')]=_0x34f542['dialstatus'];if(_0x34f542[_0x20a3('0x8')]==_0x20a3('0x20')){dials[_0x34f542['uniqueid']]=_[_0x20a3('0x21')](dials[_0x34f542[_0x20a3('0xd')]],_0x34f542);dials[_0x34f542[_0x20a3('0xd')]][_0x20a3('0x22')]=utils[_0x20a3('0x1c')]();dials[_0x34f542[_0x20a3('0xd')]][_0x20a3('0x23')]=_0x20a3('0x24');utils[_0x20a3('0x2')](util[_0x20a3('0x3')](_0x20a3('0x25'),_0x34f542[_0x20a3('0xd')],_0x34f542[_0x20a3('0x8')],dials[_0x34f542['uniqueid']][_0x20a3('0x22')]));}else{utils[_0x20a3('0x2')](util['format'](_0x20a3('0x26'),_0x34f542[_0x20a3('0xd')],_0x34f542[_0x20a3('0x8')]));}}}catch(_0x5d4470){utils[_0x20a3('0x1e')](util[_0x20a3('0x3')](_0x20a3('0x27'),_0x34f542[_0x20a3('0xd')]),_0x5d4470);}};exports[_0x20a3('0x28')]=function(_0x4e9093){try{if(!_[_0x20a3('0x15')](dials[_0x4e9093[_0x20a3('0xd')]])){utils['debug'](util[_0x20a3('0x3')]('[%s][dials][hangup]',_0x4e9093['uniqueid']),_0x4e9093);utils[_0x20a3('0x2')](util[_0x20a3('0x3')](_0x20a3('0x29'),_0x4e9093[_0x20a3('0xd')],_0x4e9093['calleridnum'],_0x4e9093[_0x20a3('0x2a')],_0x4e9093[_0x20a3('0x2b')]));dials[_0x4e9093['uniqueid']]=_['assign'](dials[_0x4e9093[_0x20a3('0xd')]],{'endtime':utils[_0x20a3('0x1c')](),'lastevent':_0x20a3('0x2c')});dials[_0x4e9093[_0x20a3('0xd')]]['duration']=utils[_0x20a3('0x2d')](dials[_0x4e9093[_0x20a3('0xd')]][_0x20a3('0x2e')],dials[_0x4e9093['uniqueid']]['starttime']);dials[_0x4e9093[_0x20a3('0xd')]]['holdtime']=utils[_0x20a3('0x2d')](dials[_0x4e9093[_0x20a3('0xd')]][_0x20a3('0x22')]||dials[_0x4e9093[_0x20a3('0xd')]][_0x20a3('0x2e')],dials[_0x4e9093[_0x20a3('0xd')]][_0x20a3('0x1b')]);dials[_0x4e9093['uniqueid']][_0x20a3('0x2f')]=dials[_0x4e9093[_0x20a3('0xd')]][_0x20a3('0x22')]?utils['diffTime'](dials[_0x4e9093[_0x20a3('0xd')]][_0x20a3('0x2e')],dials[_0x4e9093[_0x20a3('0xd')]][_0x20a3('0x22')]):0x0;writeDB(dials[_0x4e9093['uniqueid']]);}}catch(_0x28ed04){utils[_0x20a3('0x1e')](util[_0x20a3('0x3')](_0x20a3('0x30'),_0x4e9093[_0x20a3('0xd')]),_0x28ed04);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 615e4ec..2e5116e 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 _0x8ffa=['./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','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]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr','disabled','env','production','local','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller'];(function(_0x1df160,_0x2bde77){var _0x1c1317=function(_0x134d16){while(--_0x134d16){_0x1df160['push'](_0x1df160['shift']());}};_0x1c1317(++_0x2bde77);}(_0x8ffa,0x150));var _0xa8ff=function(_0x3abeea,_0x5d5472){_0x3abeea=_0x3abeea-0x0;var _0x54c5a6=_0x8ffa[_0x3abeea];return _0x54c5a6;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xa8ff('0x0'));var util=require(_0xa8ff('0x1'));var isXDREnabled=config[_0xa8ff('0x2')]&&config[_0xa8ff('0x2')][_0xa8ff('0x3')]?!config[_0xa8ff('0x2')]['disabled']:!![];var isProduction=config[_0xa8ff('0x4')]===_0xa8ff('0x5')||![];var isLocalAsterisk=config[_0xa8ff('0x2')]&&config[_0xa8ff('0x2')][_0xa8ff('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xa8ff('0x7')]['port'],config[_0xa8ff('0x7')]['ip'],config[_0xa8ff('0x7')]['username'],config[_0xa8ff('0x7')][_0xa8ff('0x8')],!![]);ami[_0xa8ff('0x9')]();if(!isXDREnabled){utils[_0xa8ff('0xa')](_0xa8ff('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xa8ff('0xa')](_0xa8ff('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0xa8ff('0xd'));var queues=require('./queues.controller');var recordings=require(_0xa8ff('0xe'));var members=require(_0xa8ff('0xf'));var dials=require(_0xa8ff('0x10'));var transfers=require(_0xa8ff('0x11'));var core=require(_0xa8ff('0x12'));ami['on']('connect',core[_0xa8ff('0x13')]);ami['on'](_0xa8ff('0x14'),core[_0xa8ff('0x14')]);ami['on'](_0xa8ff('0x15'),core['fullybooted']);ami['on'](_0xa8ff('0x16'),core[_0xa8ff('0x16')]);ami['on'](_0xa8ff('0x17'),core['close']);ami['on'](_0xa8ff('0x18'),core[_0xa8ff('0x18')]);ami['on'](_0xa8ff('0x19'),function(_0xbc47f4){try{utils['debug'](util[_0xa8ff('0x1a')]('[%s][index][devicestatechange]',_0xbc47f4['device']),_0xbc47f4);members[_0xa8ff('0x19')](_0xbc47f4);}catch(_0x5e5452){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x1b'),_0xbc47f4[_0xa8ff('0x1c')]),_0x5e5452);}});ami['on'](_0xa8ff('0x1d'),function(_0x33f7b2){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')]('[%s][index][agentcalled]',_0x33f7b2['uniqueid']),_0x33f7b2);agents[_0xa8ff('0x1d')](_0x33f7b2);}catch(_0xa18a79){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x1f'),_0x33f7b2[_0xa8ff('0x20')]),_0xa18a79);}});ami['on'](_0xa8ff('0x21'),function(_0x4761a6){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')](_0xa8ff('0x22'),_0x4761a6[_0xa8ff('0x20')]),_0x4761a6);agents[_0xa8ff('0x21')](_0x4761a6);}catch(_0x4ae231){utils['error'](util[_0xa8ff('0x1a')](_0xa8ff('0x22'),_0x4761a6[_0xa8ff('0x20')]),_0x4ae231);}});ami['on']('agentconnect',function(_0x5e883c){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')](_0xa8ff('0x23'),_0x5e883c[_0xa8ff('0x20')]),_0x5e883c);agents[_0xa8ff('0x24')](_0x5e883c);queues['agentconnect'](_0x5e883c);}catch(_0x5b2d5e){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x23'),_0x5e883c[_0xa8ff('0x20')]),_0x5b2d5e);}});ami['on']('agentcomplete',function(_0x10ed17){try{utils['debug'](util[_0xa8ff('0x1a')](_0xa8ff('0x25'),_0x10ed17['uniqueid']),_0x10ed17);agents['agentcomplete'](_0x10ed17);queues[_0xa8ff('0x26')](_0x10ed17);members[_0xa8ff('0x26')](_0x10ed17);}catch(_0x3771c0){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x25'),_0x10ed17[_0xa8ff('0x20')]),_0x3771c0);}});ami['on'](_0xa8ff('0x27'),function(_0x599fa){try{utils[_0xa8ff('0x1e')](util['format'](_0xa8ff('0x28'),_0x599fa[_0xa8ff('0x20')]),_0x599fa);agents[_0xa8ff('0x27')](_0x599fa);queues[_0xa8ff('0x27')](_0x599fa);}catch(_0x5ef275){utils['error'](util[_0xa8ff('0x1a')](_0xa8ff('0x28'),_0x599fa['uniqueid']),_0x5ef275);}});ami['on'](_0xa8ff('0x29'),function(_0x5a4102){try{utils['debug'](util[_0xa8ff('0x1a')](_0xa8ff('0x2a'),_0x5a4102[_0xa8ff('0x20')]),_0x5a4102);queues[_0xa8ff('0x29')](_0x5a4102);recordings['queuecallerjoin'](_0x5a4102);}catch(_0x43d74b){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x2a'),_0x5a4102['uniqueid']),_0x43d74b);}});ami['on'](_0xa8ff('0x2b'),function(_0x4af85e){try{utils['debug'](util[_0xa8ff('0x1a')]('[%s][index][queuecallerleave]',_0x4af85e[_0xa8ff('0x20')]),_0x4af85e);queues[_0xa8ff('0x2b')](_0x4af85e);}catch(_0x3d9ca5){utils['error'](util['format'](_0xa8ff('0x2c'),_0x4af85e['uniqueid']),_0x3d9ca5);}});ami['on'](_0xa8ff('0x2d'),function(_0x1baaa4){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')](_0xa8ff('0x2e'),_0x1baaa4[_0xa8ff('0x20')]),_0x1baaa4);queues[_0xa8ff('0x2d')](_0x1baaa4);calls[_0xa8ff('0x2d')](_0x1baaa4);}catch(_0x19ea6d){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')]('[%s][index][musiconholdstart]',_0x1baaa4['uniqueid']),_0x19ea6d);}});ami['on'](_0xa8ff('0x2f'),function(_0x4ba5fc){try{utils['debug'](util[_0xa8ff('0x1a')]('[%s][index][musiconholdstop]',_0x4ba5fc[_0xa8ff('0x20')]),_0x4ba5fc);queues[_0xa8ff('0x2f')](_0x4ba5fc);calls[_0xa8ff('0x2f')](_0x4ba5fc);}catch(_0x34e98c){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x30'),_0x4ba5fc[_0xa8ff('0x20')]),_0x34e98c);}});ami['on'](_0xa8ff('0x31'),function(_0x571d10){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')]('[%s][index][newstate]',_0x571d10[_0xa8ff('0x20')]),_0x571d10);calls[_0xa8ff('0x31')](_0x571d10);recordings[_0xa8ff('0x31')](_0x571d10);}catch(_0x1c293a){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x32'),_0x571d10['uniqueid']),_0x1c293a);}});ami['on'](_0xa8ff('0x33'),function(_0x4e10de){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')](_0xa8ff('0x34'),_0x4e10de[_0xa8ff('0x20')]),_0x4e10de);calls[_0xa8ff('0x33')](_0x4e10de);recordings['hangup'](_0x4e10de);dials['hangup'](_0x4e10de);agents[_0xa8ff('0x33')](_0x4e10de);queues[_0xa8ff('0x33')](_0x4e10de);}catch(_0x4d9f21){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x34'),_0x4e10de[_0xa8ff('0x20')]),_0x4d9f21);}});ami['on']('cdr',function(_0x26bd45){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')](_0xa8ff('0x35'),_0x26bd45[_0xa8ff('0x20')]),_0x26bd45);members[_0xa8ff('0x36')](_0x26bd45);}catch(_0x42edc2){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')]('[%s][index][cdr]',_0x26bd45[_0xa8ff('0x20')]),_0x42edc2);}});ami['on'](_0xa8ff('0x37'),function(_0x53c92f){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')](_0xa8ff('0x38'),_0x53c92f['uniqueid']),_0x53c92f);queues[_0xa8ff('0x37')](_0x53c92f);agents['blindtransfer'](_0x53c92f);transfers['blindtransfer'](_0x53c92f);}catch(_0x232898){utils[_0xa8ff('0x16')](util['format']('[%s][index][blindtransfer]',_0x53c92f[_0xa8ff('0x20')]),_0x232898);}});ami['on'](_0xa8ff('0x39'),function(_0x1fd1c7){try{utils['debug'](util[_0xa8ff('0x1a')](_0xa8ff('0x3a'),_0x1fd1c7[_0xa8ff('0x3b')]),_0x1fd1c7);queues[_0xa8ff('0x39')](_0x1fd1c7);transfers[_0xa8ff('0x39')](_0x1fd1c7);agents[_0xa8ff('0x39')](_0x1fd1c7);calls[_0xa8ff('0x39')](_0x1fd1c7);}catch(_0x439c6e){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x3a'),_0x1fd1c7[_0xa8ff('0x3b')]),_0x439c6e);}});ami['on'](_0xa8ff('0x3c'),function(_0x594dee){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')](_0xa8ff('0x3d'),_0x594dee[_0xa8ff('0x20')]),_0x594dee);queues['varset'](_0x594dee);recordings[_0xa8ff('0x3c')](_0x594dee);calls[_0xa8ff('0x3c')](_0x594dee);dials[_0xa8ff('0x3c')](_0x594dee);}catch(_0x2ebc9f){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')]('[%s][index][varset]',_0x594dee[_0xa8ff('0x20')]),_0x2ebc9f);}});ami['on']('newexten',function(_0x2395f4){try{utils[_0xa8ff('0x1e')](util['format'](_0xa8ff('0x3e'),_0x2395f4[_0xa8ff('0x20')]),_0x2395f4);calls[_0xa8ff('0x3f')](_0x2395f4);recordings['newexten'](_0x2395f4);dials[_0xa8ff('0x3f')](_0x2395f4);}catch(_0xadaccf){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x3e'),_0x2395f4[_0xa8ff('0x20')]),_0xadaccf);}});ami['on'](_0xa8ff('0x40'),function(_0x3548f1){try{utils['debug'](util['format'](_0xa8ff('0x41'),_0x3548f1['uniqueid']),_0x3548f1);calls[_0xa8ff('0x40')](_0x3548f1);recordings[_0xa8ff('0x40')](_0x3548f1);}catch(_0x108351){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')]('[%s][index][newchannel]',_0x3548f1[_0xa8ff('0x20')]),_0x108351);}});ami['on']('dialbegin',function(_0x217059){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')]('[%s][index][dialbegin]',_0x217059[_0xa8ff('0x20')]),_0x217059);dials[_0xa8ff('0x42')](_0x217059);}catch(_0xe2a8b4){utils[_0xa8ff('0x16')](util['format'](_0xa8ff('0x43'),_0x217059[_0xa8ff('0x20')]),_0xe2a8b4);}});ami['on'](_0xa8ff('0x44'),function(_0x10b7f5){try{utils[_0xa8ff('0x1e')](util[_0xa8ff('0x1a')]('[%s][index][dialend]',_0x10b7f5[_0xa8ff('0x20')]),_0x10b7f5);dials[_0xa8ff('0x44')](_0x10b7f5);}catch(_0x295b14){utils[_0xa8ff('0x16')](util[_0xa8ff('0x1a')](_0xa8ff('0x45'),_0x10b7f5[_0xa8ff('0x20')]),_0x295b14);}});} \ No newline at end of file +var _0x81af=['local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','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','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env','production'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x81af,0x106));var _0xf81a=function(_0x1c6270,_0x666f6a){_0x1c6270=_0x1c6270-0x0;var _0x4ca7ab=_0x81af[_0x1c6270];return _0x4ca7ab;};var AsteriskManager=require(_0xf81a('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xf81a('0x1'));var isXDREnabled=config[_0xf81a('0x2')]&&config['xdr']['disabled']?!config[_0xf81a('0x2')][_0xf81a('0x3')]:!![];var isProduction=config[_0xf81a('0x4')]===_0xf81a('0x5')||![];var isLocalAsterisk=config[_0xf81a('0x2')]&&config[_0xf81a('0x2')][_0xf81a('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xf81a('0x7')][_0xf81a('0x8')],config['asterisk']['ip'],config[_0xf81a('0x7')][_0xf81a('0x9')],config[_0xf81a('0x7')][_0xf81a('0xa')],!![]);ami[_0xf81a('0xb')]();if(!isXDREnabled){utils[_0xf81a('0xc')](_0xf81a('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xf81a('0xc')](_0xf81a('0xe'));}else{var agents=require(_0xf81a('0xf'));var calls=require(_0xf81a('0x10'));var queues=require(_0xf81a('0x11'));var recordings=require('./recordings.controller');var members=require(_0xf81a('0x12'));var dials=require('./dials.controller');var transfers=require(_0xf81a('0x13'));var core=require(_0xf81a('0x14'));ami['on'](_0xf81a('0x15'),core[_0xf81a('0x15')]);ami['on'](_0xf81a('0x16'),core[_0xf81a('0x16')]);ami['on'](_0xf81a('0x17'),core[_0xf81a('0x17')]);ami['on'](_0xf81a('0x18'),core[_0xf81a('0x18')]);ami['on'](_0xf81a('0x19'),core[_0xf81a('0x19')]);ami['on'](_0xf81a('0x1a'),core[_0xf81a('0x1a')]);ami['on'](_0xf81a('0x1b'),function(_0x18ecee){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x1e'),_0x18ecee[_0xf81a('0x1f')]),_0x18ecee);members[_0xf81a('0x1b')](_0x18ecee);}catch(_0x53e5ec){utils['error'](util[_0xf81a('0x1d')](_0xf81a('0x1e'),_0x18ecee['device']),_0x53e5ec);}});ami['on']('agentcalled',function(_0x21662f){try{utils[_0xf81a('0x1c')](util['format'](_0xf81a('0x20'),_0x21662f[_0xf81a('0x21')]),_0x21662f);agents[_0xf81a('0x22')](_0x21662f);}catch(_0x1e6159){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')](_0xf81a('0x20'),_0x21662f[_0xf81a('0x21')]),_0x1e6159);}});ami['on']('agentringnoanswer',function(_0x4ccd7e){try{utils[_0xf81a('0x1c')](util['format']('[%s][index][agentringnoanswer]',_0x4ccd7e['uniqueid']),_0x4ccd7e);agents['agentringnoanswer'](_0x4ccd7e);}catch(_0x265a5e){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')]('[%s][index][agentringnoanswer]',_0x4ccd7e[_0xf81a('0x21')]),_0x265a5e);}});ami['on'](_0xf81a('0x23'),function(_0x47c784){try{utils[_0xf81a('0x1c')](util['format'](_0xf81a('0x24'),_0x47c784[_0xf81a('0x21')]),_0x47c784);agents[_0xf81a('0x23')](_0x47c784);queues[_0xf81a('0x23')](_0x47c784);}catch(_0x2356c0){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')](_0xf81a('0x24'),_0x47c784[_0xf81a('0x21')]),_0x2356c0);}});ami['on'](_0xf81a('0x25'),function(_0x28fcc4){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x26'),_0x28fcc4[_0xf81a('0x21')]),_0x28fcc4);agents[_0xf81a('0x25')](_0x28fcc4);queues[_0xf81a('0x25')](_0x28fcc4);members['agentcomplete'](_0x28fcc4);}catch(_0x131d51){utils['error'](util[_0xf81a('0x1d')]('[%s][index][agentcomplete]',_0x28fcc4[_0xf81a('0x21')]),_0x131d51);}});ami['on']('queuecallerabandon',function(_0x5b1d03){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x27'),_0x5b1d03[_0xf81a('0x21')]),_0x5b1d03);agents[_0xf81a('0x28')](_0x5b1d03);queues[_0xf81a('0x28')](_0x5b1d03);}catch(_0x171241){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')](_0xf81a('0x27'),_0x5b1d03[_0xf81a('0x21')]),_0x171241);}});ami['on'](_0xf81a('0x29'),function(_0x4be92c){try{utils['debug'](util['format'](_0xf81a('0x2a'),_0x4be92c['uniqueid']),_0x4be92c);queues[_0xf81a('0x29')](_0x4be92c);recordings[_0xf81a('0x29')](_0x4be92c);}catch(_0x5491b8){utils[_0xf81a('0x18')](util['format'](_0xf81a('0x2a'),_0x4be92c['uniqueid']),_0x5491b8);}});ami['on'](_0xf81a('0x2b'),function(_0xb614d1){try{utils['debug'](util[_0xf81a('0x1d')](_0xf81a('0x2c'),_0xb614d1[_0xf81a('0x21')]),_0xb614d1);queues[_0xf81a('0x2b')](_0xb614d1);}catch(_0x65993e){utils[_0xf81a('0x18')](util['format']('[%s][index][queuecallerleave]',_0xb614d1[_0xf81a('0x21')]),_0x65993e);}});ami['on'](_0xf81a('0x2d'),function(_0x174ef8){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x2e'),_0x174ef8['uniqueid']),_0x174ef8);queues[_0xf81a('0x2d')](_0x174ef8);calls[_0xf81a('0x2d')](_0x174ef8);}catch(_0x345983){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')]('[%s][index][musiconholdstart]',_0x174ef8[_0xf81a('0x21')]),_0x345983);}});ami['on'](_0xf81a('0x2f'),function(_0x28c85c){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')]('[%s][index][musiconholdstop]',_0x28c85c['uniqueid']),_0x28c85c);queues['musiconholdstop'](_0x28c85c);calls[_0xf81a('0x2f')](_0x28c85c);}catch(_0x500e9a){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')](_0xf81a('0x30'),_0x28c85c[_0xf81a('0x21')]),_0x500e9a);}});ami['on'](_0xf81a('0x31'),function(_0x72e73c){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x32'),_0x72e73c[_0xf81a('0x21')]),_0x72e73c);calls[_0xf81a('0x31')](_0x72e73c);recordings['newstate'](_0x72e73c);}catch(_0x32d4ba){utils['error'](util[_0xf81a('0x1d')](_0xf81a('0x32'),_0x72e73c[_0xf81a('0x21')]),_0x32d4ba);}});ami['on'](_0xf81a('0x33'),function(_0x5271a8){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x34'),_0x5271a8[_0xf81a('0x21')]),_0x5271a8);calls[_0xf81a('0x33')](_0x5271a8);recordings[_0xf81a('0x33')](_0x5271a8);dials[_0xf81a('0x33')](_0x5271a8);agents[_0xf81a('0x33')](_0x5271a8);queues[_0xf81a('0x33')](_0x5271a8);}catch(_0x2a8447){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')](_0xf81a('0x34'),_0x5271a8[_0xf81a('0x21')]),_0x2a8447);}});ami['on'](_0xf81a('0x35'),function(_0x1b851b){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')]('[%s][index][cdr]',_0x1b851b[_0xf81a('0x21')]),_0x1b851b);members[_0xf81a('0x35')](_0x1b851b);}catch(_0x11b813){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')]('[%s][index][cdr]',_0x1b851b[_0xf81a('0x21')]),_0x11b813);}});ami['on'](_0xf81a('0x36'),function(_0x2bf0de){try{utils[_0xf81a('0x1c')](util['format'](_0xf81a('0x37'),_0x2bf0de[_0xf81a('0x21')]),_0x2bf0de);queues[_0xf81a('0x36')](_0x2bf0de);agents['blindtransfer'](_0x2bf0de);transfers[_0xf81a('0x36')](_0x2bf0de);}catch(_0x57d72f){utils['error'](util[_0xf81a('0x1d')](_0xf81a('0x37'),_0x2bf0de[_0xf81a('0x21')]),_0x57d72f);}});ami['on']('attendedtransfer',function(_0x911f66){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x38'),_0x911f66[_0xf81a('0x39')]),_0x911f66);queues[_0xf81a('0x3a')](_0x911f66);transfers[_0xf81a('0x3a')](_0x911f66);agents[_0xf81a('0x3a')](_0x911f66);calls[_0xf81a('0x3a')](_0x911f66);}catch(_0x57263d){utils[_0xf81a('0x18')](util['format'](_0xf81a('0x38'),_0x911f66[_0xf81a('0x39')]),_0x57263d);}});ami['on'](_0xf81a('0x3b'),function(_0x5a3aff){try{utils[_0xf81a('0x1c')](util['format']('[%s][index][varset]',_0x5a3aff[_0xf81a('0x21')]),_0x5a3aff);queues['varset'](_0x5a3aff);recordings['varset'](_0x5a3aff);calls[_0xf81a('0x3b')](_0x5a3aff);dials[_0xf81a('0x3b')](_0x5a3aff);}catch(_0x1b0e34){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')]('[%s][index][varset]',_0x5a3aff[_0xf81a('0x21')]),_0x1b0e34);}});ami['on']('newexten',function(_0x32f9cc){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')]('[%s][index][newexten]',_0x32f9cc[_0xf81a('0x21')]),_0x32f9cc);calls[_0xf81a('0x3c')](_0x32f9cc);recordings[_0xf81a('0x3c')](_0x32f9cc);dials[_0xf81a('0x3c')](_0x32f9cc);}catch(_0x646632){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')]('[%s][index][newexten]',_0x32f9cc[_0xf81a('0x21')]),_0x646632);}});ami['on'](_0xf81a('0x3d'),function(_0x23298a){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x3e'),_0x23298a[_0xf81a('0x21')]),_0x23298a);calls[_0xf81a('0x3d')](_0x23298a);recordings[_0xf81a('0x3d')](_0x23298a);}catch(_0x1c89cb){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')](_0xf81a('0x3e'),_0x23298a[_0xf81a('0x21')]),_0x1c89cb);}});ami['on']('dialbegin',function(_0x1af307){try{utils['debug'](util['format'](_0xf81a('0x3f'),_0x1af307[_0xf81a('0x21')]),_0x1af307);dials['dialbegin'](_0x1af307);}catch(_0x235d7a){utils[_0xf81a('0x18')](util[_0xf81a('0x1d')](_0xf81a('0x40'),_0x1af307[_0xf81a('0x21')]),_0x235d7a);}});ami['on'](_0xf81a('0x41'),function(_0x2cef91){try{utils[_0xf81a('0x1c')](util[_0xf81a('0x1d')](_0xf81a('0x42'),_0x2cef91[_0xf81a('0x21')]),_0x2cef91);dials['dialend'](_0x2cef91);}catch(_0x265b2e){utils['error'](util[_0xf81a('0x1d')](_0xf81a('0x42'),_0x2cef91[_0xf81a('0x21')]),_0x265b2e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 06789e4..9969856 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 _0x914c=['[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','split','data1','type','source','destination','data3','exitAt','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','then','request','CreateMemberReport','getUserByName','name','internal','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','diffTime','agentcomplete','[%s][members][agentcomplete]'];(function(_0x47712e,_0xcdea4){var _0x46b9cc=function(_0x5c29e8){while(--_0x5c29e8){_0x47712e['push'](_0x47712e['shift']());}};_0x46b9cc(++_0xcdea4);}(_0x914c,0x122));var _0xc914=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x914c[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xc914('0x0'));var util=require(_0xc914('0x1'));var utils=require(_0xc914('0x2'));var members={};var exclude=[_0xc914('0x3'),_0xc914('0x4')];function writeDB(_0xd992ca){utils[_0xc914('0x5')](util[_0xc914('0x6')](_0xc914('0x7'),_0xd992ca[_0xc914('0x8')],_0xd992ca[_0xc914('0x9')],_0xd992ca['channel'],_0xd992ca[_0xc914('0xa')],_0xd992ca[_0xc914('0xb')],_0xd992ca['type']));if(_0xd992ca[_0xc914('0x9')]){utils['getUserByInterface'](_0xd992ca[_0xc914('0x9')])[_0xc914('0xc')](function(_0x453362){if(_0x453362){_0xd992ca[_0xc914('0xb')]=_0x453362['name'];_0xd992ca['internal']=_0x453362['internal'];utils[_0xc914('0xd')](_0xc914('0xe'),_0xd992ca);}else{utils[_0xc914('0xf')](_0xd992ca['interface']['split']('/')[0x1])[_0xc914('0xc')](function(_0x438aa5){if(_0x438aa5){_0xd992ca[_0xc914('0xb')]=_0x438aa5[_0xc914('0x10')];_0xd992ca['internal']=_0x438aa5[_0xc914('0x11')];utils[_0xc914('0xd')]('CreateMemberReport',_0xd992ca);}});}})[_0xc914('0x12')](function(_0x22bd8a){utils[_0xc914('0x13')](util[_0xc914('0x6')](_0xc914('0x14'),_0xd992ca['uniqueid']),_0x22bd8a);});}delete members[_0xd992ca[_0xc914('0x9')]];}function startsWith(_0x241588,_0x109109){return _[_0xc914('0x15')](_0x241588,function(_0x243ed7){return _[_0xc914('0x16')](_0x109109,_0x243ed7);});}exports[_0xc914('0x17')]=function(_0x5b9e53){try{utils[_0xc914('0x18')](util[_0xc914('0x6')](_0xc914('0x19'),members[_0x5b9e53[_0xc914('0x1a')]]?members[_0x5b9e53[_0xc914('0x1a')]][_0xc914('0x8')]:_0x5b9e53[_0xc914('0x1a')]),_0x5b9e53);utils[_0xc914('0x5')](util[_0xc914('0x6')](_0xc914('0x1b'),members[_0x5b9e53['device']]?members[_0x5b9e53[_0xc914('0x1a')]][_0xc914('0x8')]:_0x5b9e53[_0xc914('0x1a')],_0x5b9e53[_0xc914('0x1c')],_0x5b9e53[_0xc914('0x1a')]));switch(_0x5b9e53[_0xc914('0x1c')]){case _0xc914('0x1d'):case _0xc914('0x1e'):if(!startsWith(exclude,_0x5b9e53[_0xc914('0x1a')])){members[_0x5b9e53[_0xc914('0x1a')]]={'channel':_0xc914('0x1f'),'interface':_0x5b9e53['device'],'type':_0xc914('0x20'),'enterAt':utils[_0xc914('0x21')](),'role':_0xc914('0x22')};}break;case _0xc914('0x23'):if(!_[_0xc914('0x24')](members[_0x5b9e53['device']])){members[_0x5b9e53[_0xc914('0x1a')]]['exitAt']=utils['now']();members[_0x5b9e53['device']]['duration']=utils[_0xc914('0x25')](members[_0x5b9e53[_0xc914('0x1a')]]['exitAt'],members[_0x5b9e53[_0xc914('0x1a')]]['enterAt']);if(members[_0x5b9e53['device']][_0xc914('0x8')]){writeDB(members[_0x5b9e53[_0xc914('0x1a')]]);}}break;default:break;}}catch(_0xb00998){utils[_0xc914('0x13')](util[_0xc914('0x6')]('[%s][members][devicestatechange]',members[_0x5b9e53[_0xc914('0x1a')]]?members[_0x5b9e53[_0xc914('0x1a')]][_0xc914('0x8')]:_0x5b9e53[_0xc914('0x1a')]),_0xb00998);}};exports[_0xc914('0x26')]=function(_0x126201){try{if(!_[_0xc914('0x24')](members[_0x126201[_0xc914('0x9')]])){utils[_0xc914('0x18')](util[_0xc914('0x6')](_0xc914('0x27'),_0x126201[_0xc914('0x8')]),_0x126201);utils['info'](util[_0xc914('0x6')](_0xc914('0x28'),_0x126201[_0xc914('0x8')],_0x126201[_0xc914('0x9')],_0x126201[_0xc914('0x29')]));members[_0x126201[_0xc914('0x9')]]=_[_0xc914('0x2a')](members[_0x126201[_0xc914('0x9')]],{'data4':_0x126201[_0xc914('0x29')],'uniqueid':_0x126201[_0xc914('0x8')]});}}catch(_0x121a64){utils[_0xc914('0x13')](util[_0xc914('0x6')](_0xc914('0x27'),_0x126201[_0xc914('0x8')]),_0x121a64);}};exports[_0xc914('0x2b')]=function(_0x3e445d){try{utils['debug'](util[_0xc914('0x6')]('[%s][members][cdr]',_0x3e445d[_0xc914('0x8')]),_0x3e445d);if(_0x3e445d[_0xc914('0x2c')]){var _0x18b36f=_0x3e445d[_0xc914('0x2c')][_0xc914('0x2d')]('-')[0x0];if(!_[_0xc914('0x24')](members[_0x18b36f])){members[_0x18b36f]=_['assign'](members[_0x18b36f],{'data1':members[_0x18b36f][_0xc914('0x2e')]||_0x3e445d[_0xc914('0x2f')],'data2':members[_0x18b36f][_0xc914('0xa')]||_0x3e445d[_0xc914('0x30')],'data3':members[_0x18b36f]['data3']||_0x3e445d[_0xc914('0x31')],'uniqueid':members[_0x18b36f][_0xc914('0x8')]||_0x3e445d[_0xc914('0x8')]});utils[_0xc914('0x5')](util[_0xc914('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3e445d['uniqueid'],members[_0x18b36f]['data1'],members[_0x18b36f]['data2'],members[_0x18b36f][_0xc914('0x32')]));if(members[_0x18b36f][_0xc914('0x33')]){writeDB(members[_0x18b36f]);}}}if(_0x3e445d[_0xc914('0x34')]){var _0x325c0a=_0x3e445d[_0xc914('0x34')][_0xc914('0x2d')]('-')[0x0];if(!_['isNil'](members[_0x325c0a])){members[_0x325c0a]=_[_0xc914('0x2a')](members[_0x325c0a],{'data1':members[_0x325c0a][_0xc914('0x2e')]||_0x3e445d[_0xc914('0x2f')],'data2':members[_0x325c0a]['data2']||_0x3e445d['source'],'data3':members[_0x325c0a]['data3']||_0x3e445d[_0xc914('0x31')],'uniqueid':members[_0x325c0a][_0xc914('0x8')]||_0x3e445d['uniqueid']});utils[_0xc914('0x5')](util['format'](_0xc914('0x35'),_0x3e445d[_0xc914('0x8')],members[_0x325c0a][_0xc914('0x2e')],members[_0x325c0a][_0xc914('0xa')],members[_0x325c0a][_0xc914('0x32')]));if(members[_0x325c0a][_0xc914('0x33')]){writeDB(members[_0x325c0a]);}}}}catch(_0x6cc3eb){utils[_0xc914('0x13')](util[_0xc914('0x6')](_0xc914('0x36'),_0x3e445d['uniqueid']),_0x6cc3eb);}}; \ No newline at end of file +var _0xcc36=['data2','type','interface','then','name','internal','CreateMemberReport','getUserByName','split','membername','request','error','[%s][members][writeDB]','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xcc36,0x1a6));var _0x6cc3=function(_0x1da646,_0x2095ba){_0x1da646=_0x1da646-0x0;var _0x170282=_0xcc36[_0x1da646];return _0x170282;};'use strict';var _=require(_0x6cc3('0x0'));var util=require(_0x6cc3('0x1'));var utils=require(_0x6cc3('0x2'));var members={};var exclude=[_0x6cc3('0x3'),_0x6cc3('0x4')];function writeDB(_0x1519d6){utils[_0x6cc3('0x5')](util[_0x6cc3('0x6')](_0x6cc3('0x7'),_0x1519d6[_0x6cc3('0x8')],_0x1519d6['interface'],_0x1519d6[_0x6cc3('0x9')],_0x1519d6[_0x6cc3('0xa')],_0x1519d6['membername'],_0x1519d6[_0x6cc3('0xb')]));if(_0x1519d6[_0x6cc3('0xc')]){utils['getUserByInterface'](_0x1519d6[_0x6cc3('0xc')])[_0x6cc3('0xd')](function(_0x3c79eb){if(_0x3c79eb){_0x1519d6['membername']=_0x3c79eb[_0x6cc3('0xe')];_0x1519d6[_0x6cc3('0xf')]=_0x3c79eb['internal'];utils['request'](_0x6cc3('0x10'),_0x1519d6);}else{utils[_0x6cc3('0x11')](_0x1519d6['interface'][_0x6cc3('0x12')]('/')[0x1])['then'](function(_0x2cfa5e){if(_0x2cfa5e){_0x1519d6[_0x6cc3('0x13')]=_0x2cfa5e['name'];_0x1519d6['internal']=_0x2cfa5e[_0x6cc3('0xf')];utils[_0x6cc3('0x14')]('CreateMemberReport',_0x1519d6);}});}})['catch'](function(_0x1f8c2d){utils[_0x6cc3('0x15')](util[_0x6cc3('0x6')](_0x6cc3('0x16'),_0x1519d6['uniqueid']),_0x1f8c2d);});}delete members[_0x1519d6[_0x6cc3('0xc')]];}function startsWith(_0x2e315e,_0x4e9b34){return _['some'](_0x2e315e,function(_0x26fe64){return _['startsWith'](_0x4e9b34,_0x26fe64);});}exports['devicestatechange']=function(_0x4f4f5b){try{utils[_0x6cc3('0x17')](util[_0x6cc3('0x6')](_0x6cc3('0x18'),members[_0x4f4f5b['device']]?members[_0x4f4f5b[_0x6cc3('0x19')]]['uniqueid']:_0x4f4f5b['device']),_0x4f4f5b);utils[_0x6cc3('0x5')](util['format'](_0x6cc3('0x1a'),members[_0x4f4f5b[_0x6cc3('0x19')]]?members[_0x4f4f5b['device']][_0x6cc3('0x8')]:_0x4f4f5b['device'],_0x4f4f5b[_0x6cc3('0x1b')],_0x4f4f5b[_0x6cc3('0x19')]));switch(_0x4f4f5b['state']){case _0x6cc3('0x1c'):case'BUSY':if(!startsWith(exclude,_0x4f4f5b['device'])){members[_0x4f4f5b[_0x6cc3('0x19')]]={'channel':'voice','interface':_0x4f4f5b[_0x6cc3('0x19')],'type':_0x6cc3('0x1d'),'enterAt':utils[_0x6cc3('0x1e')](),'role':_0x6cc3('0x1f')};}break;case _0x6cc3('0x20'):if(!_[_0x6cc3('0x21')](members[_0x4f4f5b[_0x6cc3('0x19')]])){members[_0x4f4f5b['device']][_0x6cc3('0x22')]=utils[_0x6cc3('0x1e')]();members[_0x4f4f5b[_0x6cc3('0x19')]][_0x6cc3('0x23')]=utils[_0x6cc3('0x24')](members[_0x4f4f5b[_0x6cc3('0x19')]][_0x6cc3('0x22')],members[_0x4f4f5b['device']][_0x6cc3('0x25')]);if(members[_0x4f4f5b['device']][_0x6cc3('0x8')]){writeDB(members[_0x4f4f5b[_0x6cc3('0x19')]]);}}break;default:break;}}catch(_0x554519){utils[_0x6cc3('0x15')](util[_0x6cc3('0x6')](_0x6cc3('0x18'),members[_0x4f4f5b['device']]?members[_0x4f4f5b[_0x6cc3('0x19')]][_0x6cc3('0x8')]:_0x4f4f5b[_0x6cc3('0x19')]),_0x554519);}};exports['agentcomplete']=function(_0x4a031d){try{if(!_['isNil'](members[_0x4a031d['interface']])){utils['debug'](util[_0x6cc3('0x6')](_0x6cc3('0x26'),_0x4a031d[_0x6cc3('0x8')]),_0x4a031d);utils[_0x6cc3('0x5')](util[_0x6cc3('0x6')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x4a031d['uniqueid'],_0x4a031d[_0x6cc3('0xc')],_0x4a031d[_0x6cc3('0x27')]));members[_0x4a031d[_0x6cc3('0xc')]]=_[_0x6cc3('0x28')](members[_0x4a031d[_0x6cc3('0xc')]],{'data4':_0x4a031d[_0x6cc3('0x27')],'uniqueid':_0x4a031d[_0x6cc3('0x8')]});}}catch(_0x108d07){utils[_0x6cc3('0x15')](util[_0x6cc3('0x6')](_0x6cc3('0x26'),_0x4a031d[_0x6cc3('0x8')]),_0x108d07);}};exports['cdr']=function(_0x1bc341){try{utils[_0x6cc3('0x17')](util[_0x6cc3('0x6')](_0x6cc3('0x29'),_0x1bc341[_0x6cc3('0x8')]),_0x1bc341);if(_0x1bc341['channel']){var _0x5a318f=_0x1bc341['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x5a318f])){members[_0x5a318f]=_[_0x6cc3('0x28')](members[_0x5a318f],{'data1':members[_0x5a318f][_0x6cc3('0x2a')]||_0x1bc341[_0x6cc3('0xb')],'data2':members[_0x5a318f][_0x6cc3('0xa')]||_0x1bc341[_0x6cc3('0x2b')],'data3':members[_0x5a318f][_0x6cc3('0x2c')]||_0x1bc341[_0x6cc3('0x2d')],'uniqueid':members[_0x5a318f][_0x6cc3('0x8')]||_0x1bc341[_0x6cc3('0x8')]});utils[_0x6cc3('0x5')](util[_0x6cc3('0x6')](_0x6cc3('0x2e'),_0x1bc341[_0x6cc3('0x8')],members[_0x5a318f][_0x6cc3('0x2a')],members[_0x5a318f][_0x6cc3('0xa')],members[_0x5a318f]['data3']));if(members[_0x5a318f][_0x6cc3('0x22')]){writeDB(members[_0x5a318f]);}}}if(_0x1bc341['destinationchannel']){var _0x3c9e89=_0x1bc341[_0x6cc3('0x2f')]['split']('-')[0x0];if(!_['isNil'](members[_0x3c9e89])){members[_0x3c9e89]=_[_0x6cc3('0x28')](members[_0x3c9e89],{'data1':members[_0x3c9e89]['data1']||_0x1bc341['type'],'data2':members[_0x3c9e89][_0x6cc3('0xa')]||_0x1bc341[_0x6cc3('0x2b')],'data3':members[_0x3c9e89]['data3']||_0x1bc341['destination'],'uniqueid':members[_0x3c9e89]['uniqueid']||_0x1bc341[_0x6cc3('0x8')]});utils[_0x6cc3('0x5')](util[_0x6cc3('0x6')](_0x6cc3('0x2e'),_0x1bc341[_0x6cc3('0x8')],members[_0x3c9e89]['data1'],members[_0x3c9e89]['data2'],members[_0x3c9e89]['data3']));if(members[_0x3c9e89][_0x6cc3('0x22')]){writeDB(members[_0x3c9e89]);}}}}catch(_0x3e2c91){utils[_0x6cc3('0x15')](util[_0x6cc3('0x6')](_0x6cc3('0x29'),_0x1bc341[_0x6cc3('0x8')]),_0x3e2c91);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c892428..a867041 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 _0xb339=['agentcomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','mohtime','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','value','CONTINUE','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentconnect]'];(function(_0x4a464e,_0x250abf){var _0x54d070=function(_0xf56d7){while(--_0xf56d7){_0x4a464e['push'](_0x4a464e['shift']());}};_0x54d070(++_0x250abf);}(_0xb339,0x15a));var _0x9b33=function(_0x5645ad,_0x580ea3){_0x5645ad=_0x5645ad-0x0;var _0x17d292=_0xb339[_0x5645ad];return _0x17d292;};'use strict';var _=require(_0x9b33('0x0'));var util=require('util');var utils=require(_0x9b33('0x1'));var queues={};function writeDB(_0x4da4f1){utils['info'](util[_0x9b33('0x2')](_0x9b33('0x3'),_0x4da4f1[_0x9b33('0x4')],_0x4da4f1[_0x9b33('0x5')],_0x4da4f1['queue'],_0x4da4f1[_0x9b33('0x6')],_0x4da4f1[_0x9b33('0x7')],_0x4da4f1[_0x9b33('0x8')],_0x4da4f1[_0x9b33('0x9')]));if(_0x4da4f1[_0x9b33('0xa')]){utils['getVoiceQueueByName'](_0x4da4f1[_0x9b33('0xa')])[_0x9b33('0xb')](function(_0xe41379){if(_0xe41379){_0x4da4f1[_0x9b33('0xc')]=_0xe41379[_0x9b33('0xc')];}utils[_0x9b33('0xd')]('CreateVoiceQueueReport',_0x4da4f1);});}else{utils[_0x9b33('0xd')](_0x9b33('0xe'),_0x4da4f1);}if(_0x4da4f1['transfereduniqueid']){delete queues[_0x4da4f1[_0x9b33('0xf')]];}else{delete queues[_0x4da4f1[_0x9b33('0x4')]];}}exports[_0x9b33('0x10')]=function(_0x4929cf){try{utils[_0x9b33('0x11')](util[_0x9b33('0x2')](_0x9b33('0x12'),_0x4929cf[_0x9b33('0x4')]),_0x4929cf);utils[_0x9b33('0x13')](util['format'](_0x9b33('0x14'),_0x4929cf['uniqueid'],_0x4929cf[_0x9b33('0xa')],_0x4929cf[_0x9b33('0x15')]));queues[_0x4929cf['uniqueid']]=_[_0x9b33('0x16')](_0x4929cf,{'originalposition':_0x4929cf['position'],'queuecallerjoinAt':utils[_0x9b33('0x17')](),'mohtime':0x0});}catch(_0x2337e8){utils['error'](util[_0x9b33('0x2')](_0x9b33('0x12'),_0x4929cf[_0x9b33('0x4')]),_0x2337e8);}};exports[_0x9b33('0x18')]=function(_0x1d261d){try{if(!_[_0x9b33('0x19')](queues[_0x1d261d['uniqueid']])){utils['debug'](util[_0x9b33('0x2')](_0x9b33('0x1a'),_0x1d261d[_0x9b33('0x4')]),_0x1d261d);if(queues[_0x1d261d[_0x9b33('0x4')]]['queuecallerleaveAt']){if(!queues[_0x1d261d[_0x9b33('0x4')]]['queuecallerabandon']&&!queues[_0x1d261d[_0x9b33('0x4')]]['queuecallerexit']){queues[_0x1d261d['uniqueid']][_0x9b33('0x1b')]=!![];queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0x1c')]=utils['now']();queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0x9')]=_0x9b33('0x1d');}utils[_0x9b33('0x13')](util[_0x9b33('0x2')](_0x9b33('0x1e'),_0x1d261d['uniqueid'],queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0x1f')],queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0x9')]));writeDB(queues[_0x1d261d[_0x9b33('0x4')]]);}else if(queues[_0x1d261d['uniqueid']][_0x9b33('0xf')]){utils[_0x9b33('0x13')](util['format'](_0x9b33('0x20'),_0x1d261d[_0x9b33('0x4')],queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0x1f')],queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0xf')]));queues[queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0xf')]]=queues[_0x1d261d['uniqueid']];queues[queues[_0x1d261d[_0x9b33('0x4')]][_0x9b33('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x1d261d[_0x9b33('0x4')]];}}}catch(_0x1c2703){utils['error'](util['format'](_0x9b33('0x1a'),_0x1d261d[_0x9b33('0x4')]),_0x1c2703);}};exports[_0x9b33('0x21')]=function(_0xc81ca7){try{utils[_0x9b33('0x11')](util[_0x9b33('0x2')](_0x9b33('0x22'),_0xc81ca7['uniqueid']),_0xc81ca7);if(!_[_0x9b33('0x19')](_0xc81ca7[_0x9b33('0x23')]['queuestatus'])&&_0xc81ca7[_0x9b33('0x24')]['toUpperCase']()!==_0x9b33('0x25')){if(!_['isNil'](queues[_0xc81ca7[_0x9b33('0x4')]])){queues[_0xc81ca7[_0x9b33('0x4')]]['queuecallerabandon']=![];queues[_0xc81ca7['uniqueid']]['queuecallerabandonAt']=null;queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x26')]=!![];queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x27')]=utils[_0x9b33('0x17')]();queues[_0xc81ca7[_0x9b33('0x4')]]['queuecallerexitreason']=_0xc81ca7[_0x9b33('0x24')][_0x9b33('0x28')]();utils[_0x9b33('0x13')](util[_0x9b33('0x2')](_0x9b33('0x29'),_0xc81ca7[_0x9b33('0x4')],queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x1f')],_0xc81ca7[_0x9b33('0x24')],queues[_0xc81ca7['uniqueid']][_0x9b33('0x9')]));writeDB(queues[_0xc81ca7[_0x9b33('0x4')]]);}}else if(!_['isNil'](_0xc81ca7[_0x9b33('0x23')][_0x9b33('0x2a')])){if(!_[_0x9b33('0x19')](queues[_0xc81ca7[_0x9b33('0x4')]])&&!queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x2b')]){queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x2b')]=![];queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x2c')]=null;queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x26')]=!![];queues[_0xc81ca7[_0x9b33('0x4')]]['queuecallerexitAt']=utils[_0x9b33('0x17')]();queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x9')]=_0x9b33('0x2d');utils[_0x9b33('0x13')](util['format'](_0x9b33('0x2e'),_0xc81ca7['uniqueid'],queues[_0xc81ca7['uniqueid']][_0x9b33('0x1f')],_0xc81ca7[_0x9b33('0x24')],queues[_0xc81ca7[_0x9b33('0x4')]][_0x9b33('0x9')]));}}}catch(_0x119ae3){utils[_0x9b33('0x2f')](util['format'](_0x9b33('0x22'),_0xc81ca7[_0x9b33('0x4')]),_0x119ae3);}};exports[_0x9b33('0x2b')]=function(_0x417451){try{if(!_[_0x9b33('0x19')](queues[_0x417451['uniqueid']])){utils['debug'](util[_0x9b33('0x2')](_0x9b33('0x30'),_0x417451[_0x9b33('0x4')]),_0x417451);queues[_0x417451['uniqueid']][_0x9b33('0x26')]=![];queues[_0x417451[_0x9b33('0x4')]][_0x9b33('0x27')]=null;queues[_0x417451['uniqueid']][_0x9b33('0x2b')]=!![];queues[_0x417451[_0x9b33('0x4')]][_0x9b33('0x2c')]=utils[_0x9b33('0x17')]();queues[_0x417451[_0x9b33('0x4')]][_0x9b33('0x9')]='ABANDONED';utils[_0x9b33('0x13')](util[_0x9b33('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x417451[_0x9b33('0x4')],queues[_0x417451[_0x9b33('0x4')]][_0x9b33('0x1f')],queues[_0x417451[_0x9b33('0x4')]][_0x9b33('0x9')]));}}catch(_0x2db6a5){utils[_0x9b33('0x2f')](util[_0x9b33('0x2')](_0x9b33('0x30'),_0x417451[_0x9b33('0x4')]),_0x2db6a5);}};exports['queuecallerleave']=function(_0x278970){try{if(!_[_0x9b33('0x19')](queues[_0x278970[_0x9b33('0x4')]])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x278970[_0x9b33('0x4')]),_0x278970);utils[_0x9b33('0x13')](util[_0x9b33('0x2')](_0x9b33('0x31'),_0x278970[_0x9b33('0x4')],queues[_0x278970['uniqueid']][_0x9b33('0x1f')],_0x278970[_0x9b33('0x32')],_0x278970[_0x9b33('0x33')]));queues[_0x278970['uniqueid']]['queuecallerleave']=!![];queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x34')]=utils['now']();queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x35')]=utils[_0x9b33('0x36')](queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x34')],queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x37')]);queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x15')]=_0x278970[_0x9b33('0x15')];queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x38')]=_0x278970[_0x9b33('0x38')];queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x32')]=_0x278970[_0x9b33('0x32')];queues[_0x278970[_0x9b33('0x4')]][_0x9b33('0x33')]=_0x278970[_0x9b33('0x33')];}}catch(_0x46d5c1){utils[_0x9b33('0x2f')](util[_0x9b33('0x2')]('[%s][queues][queuecallerleave]',_0x278970['uniqueid']),_0x46d5c1);}};exports['agentconnect']=function(_0x410e8c){try{if(!_[_0x9b33('0x19')](queues[_0x410e8c[_0x9b33('0x4')]])){utils['debug'](util[_0x9b33('0x2')]('[%s][queues][agentconnect]',_0x410e8c[_0x9b33('0x4')]),_0x410e8c);utils[_0x9b33('0x13')](util[_0x9b33('0x2')](_0x9b33('0x39'),_0x410e8c[_0x9b33('0x4')],queues[_0x410e8c['uniqueid']][_0x9b33('0x1f')],_0x410e8c[_0x9b33('0x3a')],_0x410e8c['destaccountcode']));queues[_0x410e8c[_0x9b33('0x4')]][_0x9b33('0x2b')]=![];queues[_0x410e8c[_0x9b33('0x4')]][_0x9b33('0x2b')]=![];queues[_0x410e8c['uniqueid']][_0x9b33('0x2c')]=null;queues[_0x410e8c[_0x9b33('0x4')]][_0x9b33('0x26')]=![];queues[_0x410e8c[_0x9b33('0x4')]][_0x9b33('0x9')]=null;queues[_0x410e8c[_0x9b33('0x4')]][_0x9b33('0x27')]=null;queues[_0x410e8c['uniqueid']][_0x9b33('0x3b')]=!![];queues[_0x410e8c[_0x9b33('0x4')]][_0x9b33('0x8')]=_0x410e8c[_0x9b33('0x3c')];queues[_0x410e8c[_0x9b33('0x4')]][_0x9b33('0x6')]=_0x410e8c[_0x9b33('0x3a')];}}catch(_0x3c4308){utils[_0x9b33('0x2f')](util[_0x9b33('0x2')](_0x9b33('0x3d'),_0x410e8c[_0x9b33('0x4')]),_0x3c4308);}};exports[_0x9b33('0x3e')]=function(_0x2293df){try{if(!_['isNil'](queues[_0x2293df[_0x9b33('0x4')]])){if(queues[_0x2293df[_0x9b33('0x4')]]['queuecallerleaveAt']){utils[_0x9b33('0x11')](util['format']('[%s][queues][agentcomplete]',_0x2293df[_0x9b33('0x4')]),_0x2293df);queues[_0x2293df['uniqueid']][_0x9b33('0x2b')]=![];queues[_0x2293df['uniqueid']]['queuecallerabandon']=![];queues[_0x2293df['uniqueid']][_0x9b33('0x2c')]=null;queues[_0x2293df[_0x9b33('0x4')]][_0x9b33('0x26')]=![];queues[_0x2293df['uniqueid']][_0x9b33('0x27')]=null;queues[_0x2293df['uniqueid']]['assigned']=!![];queues[_0x2293df['uniqueid']][_0x9b33('0x6')]=_0x2293df[_0x9b33('0x3a')];queues[_0x2293df[_0x9b33('0x4')]]['queuecallercomplete']=!![];queues[_0x2293df[_0x9b33('0x4')]]['queuecallercompleteAt']=utils['now']();if(_0x2293df[_0x9b33('0x3f')]==_0x9b33('0x40')){if(!queues[_0x2293df['uniqueid']][_0x9b33('0x40')]){queues[_0x2293df[_0x9b33('0x4')]][_0x9b33('0x9')]='TRANSFER';}}else{queues[_0x2293df[_0x9b33('0x4')]][_0x9b33('0x9')]=_0x9b33('0x41')+_0x2293df['reason'][_0x9b33('0x28')]();}utils[_0x9b33('0x13')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2293df[_0x9b33('0x4')],queues[_0x2293df[_0x9b33('0x4')]][_0x9b33('0x1f')],_0x2293df[_0x9b33('0x3a')],queues[_0x2293df['uniqueid']][_0x9b33('0x9')]));writeDB(queues[_0x2293df[_0x9b33('0x4')]]);}}}catch(_0x4f0b94){utils[_0x9b33('0x2f')](util[_0x9b33('0x2')](_0x9b33('0x42'),_0x2293df['uniqueid']),_0x4f0b94);}};exports[_0x9b33('0x43')]=function(_0x124ab5){try{if(!_[_0x9b33('0x19')](queues[_0x124ab5[_0x9b33('0x44')]])){utils['debug'](util[_0x9b33('0x2')](_0x9b33('0x45'),_0x124ab5[_0x9b33('0x4')]),_0x124ab5);queues[_0x124ab5['transfereeuniqueid']]['transfer']=!![];queues[_0x124ab5[_0x9b33('0x44')]][_0x9b33('0x46')]=_0x9b33('0x47');queues[_0x124ab5['transfereeuniqueid']]['transferexten']=_0x124ab5[_0x9b33('0x48')];queues[_0x124ab5[_0x9b33('0x44')]]['transferuniqueid']=_0x124ab5[_0x9b33('0x44')];queues[_0x124ab5[_0x9b33('0x44')]][_0x9b33('0x9')]=_0x9b33('0x49');utils[_0x9b33('0x13')](util[_0x9b33('0x2')](_0x9b33('0x4a'),_0x124ab5['uniqueid'],queues[_0x124ab5[_0x9b33('0x44')]][_0x9b33('0x1f')],_0x124ab5[_0x9b33('0x44')],_0x124ab5[_0x9b33('0x48')]));}}catch(_0x32cf42){utils[_0x9b33('0x2f')](util[_0x9b33('0x2')]('[%s][queues][blindtransfer]',_0x124ab5[_0x9b33('0x4')]),_0x32cf42);}};exports[_0x9b33('0x4b')]=function(_0x568bab){try{utils[_0x9b33('0x11')](util[_0x9b33('0x2')](_0x9b33('0x4c'),_0x568bab['origtransfereruniqueid']),_0x568bab);if(_0x568bab[_0x9b33('0x4d')]==_0x568bab[_0x9b33('0x4e')]){if(!_[_0x9b33('0x19')](queues[_0x568bab[_0x9b33('0x4f')]])){utils[_0x9b33('0x13')](util[_0x9b33('0x2')](_0x9b33('0x50'),_0x568bab[_0x9b33('0x4d')],queues[_0x568bab['secondtransfererlinkedid']]['name'],_0x568bab[_0x9b33('0x51')]));queues[_0x568bab['secondtransfererlinkedid']]['transfer']=!![];queues[_0x568bab[_0x9b33('0x4f')]]['transfertype']=_0x9b33('0x52');queues[_0x568bab[_0x9b33('0x4f')]][_0x9b33('0x53')]=_0x568bab[_0x9b33('0x51')];queues[_0x568bab[_0x9b33('0x4f')]][_0x9b33('0x54')]=_0x568bab[_0x9b33('0x4d')];queues[_0x568bab[_0x9b33('0x4f')]][_0x9b33('0x9')]=_0x9b33('0x55');}if(!_[_0x9b33('0x19')](queues[_0x568bab[_0x9b33('0x4e')]])){if(_0x568bab[_0x9b33('0x56')]&&queues[_0x568bab[_0x9b33('0x56')]]){queues[_0x568bab[_0x9b33('0x56')]][_0x9b33('0x57')]=0x1;queues[_0x568bab['transfereeuniqueid']]=_['clone'](queues[_0x568bab['transfereelinkedid']]);queues[_0x568bab['transfereeuniqueid']][_0x9b33('0xf')]=_0x568bab[_0x9b33('0x58')];queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x57')]=0x2;queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x7')]=queues[_0x568bab[_0x9b33('0x4f')]]['calleridnum'];queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x59')]=queues[_0x568bab[_0x9b33('0x4f')]][_0x9b33('0x59')];queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x37')]=utils[_0x9b33('0x17')]();queues[_0x568bab['transfereeuniqueid']][_0x9b33('0x34')]=utils['now']();queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x35')]=0x0;queues[_0x568bab['transfereeuniqueid']]['mohtime']=0x0;utils[_0x9b33('0x13')](util[_0x9b33('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x568bab[_0x9b33('0x4d')],queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x1f')],queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x7')],queues[_0x568bab[_0x9b33('0x44')]][_0x9b33('0x59')]));}else{utils[_0x9b33('0x13')](util['format'](_0x9b33('0x5a'),_0x568bab[_0x9b33('0x4d')],queues[_0x568bab[_0x9b33('0x4e')]][_0x9b33('0x1f')],_0x568bab['secondtransfererlinkedid']));queues[_0x568bab[_0x9b33('0x4e')]][_0x9b33('0xf')]=_0x568bab['secondtransfererlinkedid'];}}}else if(_0x568bab[_0x9b33('0x5b')]==_0x568bab[_0x9b33('0x4f')]){if(!_['isNil'](queues[_0x568bab[_0x9b33('0x4e')]])){utils['info'](util['format'](_0x9b33('0x5c'),_0x568bab['origtransfereruniqueid'],queues[_0x568bab['origtransfererlinkedid']][_0x9b33('0x1f')],_0x568bab[_0x9b33('0x5b')],_0x568bab[_0x9b33('0x5d')]));queues[_0x568bab['origtransfererlinkedid']][_0x9b33('0x40')]=!![];queues[_0x568bab['origtransfererlinkedid']][_0x9b33('0x46')]='ATTENDED';queues[_0x568bab[_0x9b33('0x4e')]][_0x9b33('0x53')]=_0x568bab[_0x9b33('0x5d')];queues[_0x568bab[_0x9b33('0x4e')]]['transferuniqueid']=_0x568bab['secondtransfereruniqueid'];queues[_0x568bab['origtransfererlinkedid']][_0x9b33('0x9')]=_0x9b33('0x55');}if(!_['isNil'](queues[_0x568bab[_0x9b33('0x4f')]])){if(_0x568bab[_0x9b33('0x5e')]&&queues[_0x568bab[_0x9b33('0x5e')]]){queues[_0x568bab[_0x9b33('0x5e')]][_0x9b33('0x57')]=0x1;queues[_0x568bab['transfertargetuniqueid']]=_[_0x9b33('0x5f')](queues[_0x568bab[_0x9b33('0x5e')]]);queues[_0x568bab['transfertargetuniqueid']][_0x9b33('0xf')]=_0x568bab['transfertargetuniqueid'];queues[_0x568bab[_0x9b33('0x58')]]['queuecallerenterreason']=0x2;queues[_0x568bab[_0x9b33('0x58')]]['calleridnum']=queues[_0x568bab[_0x9b33('0x4e')]][_0x9b33('0x7')];queues[_0x568bab[_0x9b33('0x58')]][_0x9b33('0x59')]=queues[_0x568bab[_0x9b33('0x4e')]][_0x9b33('0x59')];queues[_0x568bab[_0x9b33('0x58')]]['queuecallerjoinAt']=utils[_0x9b33('0x17')]();queues[_0x568bab[_0x9b33('0x58')]]['queuecallerleaveAt']=utils['now']();queues[_0x568bab[_0x9b33('0x58')]][_0x9b33('0x35')]=0x0;queues[_0x568bab[_0x9b33('0x58')]][_0x9b33('0x60')]=0x0;utils[_0x9b33('0x13')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x568bab[_0x9b33('0x4d')],queues[_0x568bab[_0x9b33('0x58')]][_0x9b33('0x1f')],queues[_0x568bab[_0x9b33('0x58')]][_0x9b33('0xf')],queues[_0x568bab[_0x9b33('0x58')]][_0x9b33('0x7')],queues[_0x568bab[_0x9b33('0x58')]][_0x9b33('0x59')]));}else{utils[_0x9b33('0x13')](util[_0x9b33('0x2')](_0x9b33('0x5a'),_0x568bab['origtransfereruniqueid'],queues[_0x568bab[_0x9b33('0x4f')]][_0x9b33('0x1f')],_0x568bab[_0x9b33('0x4e')]));queues[_0x568bab[_0x9b33('0x4f')]][_0x9b33('0xf')]=_0x568bab[_0x9b33('0x4e')];}}}}catch(_0x8c108a){utils['error'](util[_0x9b33('0x2')](_0x9b33('0x4c'),_0x568bab[_0x9b33('0x4d')]),_0x8c108a);}};exports['musiconholdstart']=function(_0x1b5761){try{if(!_['isNil'](queues[_0x1b5761['uniqueid']])){utils[_0x9b33('0x11')](util[_0x9b33('0x2')](_0x9b33('0x61'),_0x1b5761[_0x9b33('0x4')]),_0x1b5761);queues[_0x1b5761[_0x9b33('0x4')]][_0x9b33('0x62')]=utils[_0x9b33('0x17')]();utils[_0x9b33('0x13')](util['format'](_0x9b33('0x63'),_0x1b5761['uniqueid'],queues[_0x1b5761[_0x9b33('0x4')]][_0x9b33('0x1f')],queues[_0x1b5761[_0x9b33('0x4')]][_0x9b33('0x62')]));}}catch(_0x41d237){utils['error'](util[_0x9b33('0x2')](_0x9b33('0x61'),_0x1b5761['uniqueid']),_0x41d237);}};exports[_0x9b33('0x64')]=function(_0x36d235){try{if(!_[_0x9b33('0x19')](queues[_0x36d235['uniqueid']])){if(!_['isNil'](queues[_0x36d235[_0x9b33('0x4')]][_0x9b33('0x62')])){utils[_0x9b33('0x11')](util[_0x9b33('0x2')](_0x9b33('0x65'),_0x36d235[_0x9b33('0x4')]),_0x36d235);queues[_0x36d235['uniqueid']][_0x9b33('0x60')]+=utils['diffTime'](utils[_0x9b33('0x17')](),queues[_0x36d235['uniqueid']][_0x9b33('0x62')]);utils['info'](util[_0x9b33('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x36d235['uniqueid'],queues[_0x36d235[_0x9b33('0x4')]][_0x9b33('0x1f')],queues[_0x36d235[_0x9b33('0x4')]][_0x9b33('0x60')]));delete queues[_0x36d235['uniqueid']][_0x9b33('0x62')];}}}catch(_0x565613){utils[_0x9b33('0x2f')](util[_0x9b33('0x2')](_0x9b33('0x65'),_0x36d235[_0x9b33('0x4')]),_0x565613);}}; \ No newline at end of file +var _0x5068=['queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','value','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5068,0x181));var _0x8506=function(_0x4de9e1,_0x49da18){_0x4de9e1=_0x4de9e1-0x0;var _0x214b06=_0x5068[_0x4de9e1];return _0x214b06;};'use strict';var _=require(_0x8506('0x0'));var util=require(_0x8506('0x1'));var utils=require(_0x8506('0x2'));var queues={};function writeDB(_0x46581){utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x5'),_0x46581[_0x8506('0x6')],_0x46581[_0x8506('0x7')],_0x46581[_0x8506('0x8')],_0x46581[_0x8506('0x9')],_0x46581[_0x8506('0xa')],_0x46581[_0x8506('0xb')],_0x46581[_0x8506('0xc')]));if(_0x46581[_0x8506('0x8')]){utils[_0x8506('0xd')](_0x46581[_0x8506('0x8')])['then'](function(_0x2d8ce3){if(_0x2d8ce3){_0x46581[_0x8506('0xe')]=_0x2d8ce3[_0x8506('0xe')];}utils['request'](_0x8506('0xf'),_0x46581);});}else{utils[_0x8506('0x10')]('CreateVoiceQueueReport',_0x46581);}if(_0x46581['transfereduniqueid']){delete queues[_0x46581[_0x8506('0x11')]];}else{delete queues[_0x46581[_0x8506('0x6')]];}}exports[_0x8506('0x12')]=function(_0x24ed72){try{utils[_0x8506('0x13')](util[_0x8506('0x4')]('[%s][queues][queuecallerjoin]',_0x24ed72[_0x8506('0x6')]),_0x24ed72);utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x14'),_0x24ed72[_0x8506('0x6')],_0x24ed72[_0x8506('0x8')],_0x24ed72[_0x8506('0x15')]));queues[_0x24ed72[_0x8506('0x6')]]=_['assign'](_0x24ed72,{'originalposition':_0x24ed72[_0x8506('0x15')],'queuecallerjoinAt':utils[_0x8506('0x16')](),'mohtime':0x0});}catch(_0x59b402){utils[_0x8506('0x17')](util[_0x8506('0x4')]('[%s][queues][queuecallerjoin]',_0x24ed72[_0x8506('0x6')]),_0x59b402);}};exports['hangup']=function(_0x3ead67){try{if(!_[_0x8506('0x18')](queues[_0x3ead67['uniqueid']])){utils[_0x8506('0x13')](util[_0x8506('0x4')](_0x8506('0x19'),_0x3ead67['uniqueid']),_0x3ead67);if(queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0x1a')]){if(!queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0x1b')]&&!queues[_0x3ead67['uniqueid']]['queuecallerexit']){queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0x1c')]=!![];queues[_0x3ead67['uniqueid']]['queuecallercompleteAt']=utils[_0x8506('0x16')]();queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0xc')]=_0x8506('0x1d');}utils[_0x8506('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x3ead67[_0x8506('0x6')],queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0x1e')],queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0xc')]));writeDB(queues[_0x3ead67[_0x8506('0x6')]]);}else if(queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0x11')]){utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x1f'),_0x3ead67[_0x8506('0x6')],queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0x1e')],queues[_0x3ead67['uniqueid']]['transfereduniqueid']));queues[queues[_0x3ead67[_0x8506('0x6')]]['transfereduniqueid']]=queues[_0x3ead67['uniqueid']];queues[queues[_0x3ead67[_0x8506('0x6')]][_0x8506('0x11')]][_0x8506('0x20')]=0x2;delete queues[_0x3ead67['uniqueid']];}}}catch(_0x5bae57){utils[_0x8506('0x17')](util[_0x8506('0x4')](_0x8506('0x19'),_0x3ead67[_0x8506('0x6')]),_0x5bae57);}};exports[_0x8506('0x21')]=function(_0x560bcf){try{utils[_0x8506('0x13')](util[_0x8506('0x4')](_0x8506('0x22'),_0x560bcf[_0x8506('0x6')]),_0x560bcf);if(!_['isNil'](_0x560bcf[_0x8506('0x23')]['queuestatus'])&&_0x560bcf['value'][_0x8506('0x24')]()!==_0x8506('0x25')){if(!_['isNil'](queues[_0x560bcf['uniqueid']])){queues[_0x560bcf[_0x8506('0x6')]]['queuecallerabandon']=![];queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x26')]=null;queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x27')]=!![];queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x28')]=utils[_0x8506('0x16')]();queues[_0x560bcf[_0x8506('0x6')]]['queuecallerexitreason']=_0x560bcf['value']['toUpperCase']();utils[_0x8506('0x3')](util['format'](_0x8506('0x29'),_0x560bcf[_0x8506('0x6')],queues[_0x560bcf[_0x8506('0x6')]]['name'],_0x560bcf['value'],queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0xc')]));writeDB(queues[_0x560bcf[_0x8506('0x6')]]);}}else if(!_[_0x8506('0x18')](_0x560bcf[_0x8506('0x23')][_0x8506('0x2a')])){if(!_[_0x8506('0x18')](queues[_0x560bcf[_0x8506('0x6')]])&&!queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x1b')]){queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x1b')]=![];queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x26')]=null;queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x27')]=!![];queues[_0x560bcf['uniqueid']][_0x8506('0x28')]=utils[_0x8506('0x16')]();queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0xc')]=_0x8506('0x2b');utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x2c'),_0x560bcf[_0x8506('0x6')],queues[_0x560bcf[_0x8506('0x6')]][_0x8506('0x1e')],_0x560bcf[_0x8506('0x2d')],queues[_0x560bcf[_0x8506('0x6')]]['queuecallerexitreason']));}}}catch(_0x3411ee){utils[_0x8506('0x17')](util[_0x8506('0x4')](_0x8506('0x22'),_0x560bcf[_0x8506('0x6')]),_0x3411ee);}};exports[_0x8506('0x1b')]=function(_0x166a5f){try{if(!_['isNil'](queues[_0x166a5f[_0x8506('0x6')]])){utils[_0x8506('0x13')](util[_0x8506('0x4')](_0x8506('0x2e'),_0x166a5f['uniqueid']),_0x166a5f);queues[_0x166a5f[_0x8506('0x6')]][_0x8506('0x27')]=![];queues[_0x166a5f['uniqueid']][_0x8506('0x28')]=null;queues[_0x166a5f[_0x8506('0x6')]]['queuecallerabandon']=!![];queues[_0x166a5f[_0x8506('0x6')]][_0x8506('0x26')]=utils[_0x8506('0x16')]();queues[_0x166a5f['uniqueid']]['queuecallerexitreason']='ABANDONED';utils[_0x8506('0x3')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x166a5f[_0x8506('0x6')],queues[_0x166a5f[_0x8506('0x6')]][_0x8506('0x1e')],queues[_0x166a5f['uniqueid']][_0x8506('0xc')]));}}catch(_0x8ad3cf){utils['error'](util[_0x8506('0x4')]('[%s][queues][queuecallerabandon]',_0x166a5f[_0x8506('0x6')]),_0x8ad3cf);}};exports[_0x8506('0x2f')]=function(_0x2cfb04){try{if(!_['isNil'](queues[_0x2cfb04[_0x8506('0x6')]])){utils[_0x8506('0x13')](util[_0x8506('0x4')](_0x8506('0x30'),_0x2cfb04['uniqueid']),_0x2cfb04);utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x31'),_0x2cfb04[_0x8506('0x6')],queues[_0x2cfb04[_0x8506('0x6')]]['name'],_0x2cfb04[_0x8506('0x32')],_0x2cfb04[_0x8506('0x33')]));queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x2f')]=!![];queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x1a')]=utils[_0x8506('0x16')]();queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x34')]=utils[_0x8506('0x35')](queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x1a')],queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x36')]);queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x15')]=_0x2cfb04['position'];queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x37')]=_0x2cfb04['count'];queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x32')]=_0x2cfb04['connectedlinenum'];queues[_0x2cfb04[_0x8506('0x6')]][_0x8506('0x33')]=_0x2cfb04[_0x8506('0x33')];}}catch(_0x379c1f){utils[_0x8506('0x17')](util[_0x8506('0x4')](_0x8506('0x30'),_0x2cfb04['uniqueid']),_0x379c1f);}};exports[_0x8506('0x38')]=function(_0x2e9543){try{if(!_['isNil'](queues[_0x2e9543['uniqueid']])){utils[_0x8506('0x13')](util[_0x8506('0x4')](_0x8506('0x39'),_0x2e9543['uniqueid']),_0x2e9543);utils[_0x8506('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x2e9543[_0x8506('0x6')],queues[_0x2e9543[_0x8506('0x6')]]['name'],_0x2e9543[_0x8506('0x3a')],_0x2e9543[_0x8506('0x3b')]));queues[_0x2e9543[_0x8506('0x6')]][_0x8506('0x1b')]=![];queues[_0x2e9543['uniqueid']][_0x8506('0x1b')]=![];queues[_0x2e9543[_0x8506('0x6')]][_0x8506('0x26')]=null;queues[_0x2e9543['uniqueid']][_0x8506('0x27')]=![];queues[_0x2e9543[_0x8506('0x6')]][_0x8506('0xc')]=null;queues[_0x2e9543['uniqueid']][_0x8506('0x28')]=null;queues[_0x2e9543[_0x8506('0x6')]][_0x8506('0x3c')]=!![];queues[_0x2e9543[_0x8506('0x6')]][_0x8506('0xb')]=_0x2e9543[_0x8506('0x3b')];queues[_0x2e9543[_0x8506('0x6')]][_0x8506('0x9')]=_0x2e9543['membername'];}}catch(_0x54f0ce){utils[_0x8506('0x17')](util['format'](_0x8506('0x39'),_0x2e9543[_0x8506('0x6')]),_0x54f0ce);}};exports[_0x8506('0x3d')]=function(_0x48fcbe){try{if(!_[_0x8506('0x18')](queues[_0x48fcbe[_0x8506('0x6')]])){if(queues[_0x48fcbe[_0x8506('0x6')]][_0x8506('0x1a')]){utils[_0x8506('0x13')](util[_0x8506('0x4')](_0x8506('0x3e'),_0x48fcbe[_0x8506('0x6')]),_0x48fcbe);queues[_0x48fcbe[_0x8506('0x6')]][_0x8506('0x1b')]=![];queues[_0x48fcbe['uniqueid']][_0x8506('0x1b')]=![];queues[_0x48fcbe[_0x8506('0x6')]]['queuecallerabandonAt']=null;queues[_0x48fcbe[_0x8506('0x6')]][_0x8506('0x27')]=![];queues[_0x48fcbe[_0x8506('0x6')]][_0x8506('0x28')]=null;queues[_0x48fcbe[_0x8506('0x6')]][_0x8506('0x3c')]=!![];queues[_0x48fcbe['uniqueid']]['lastAssignedTo']=_0x48fcbe[_0x8506('0x3a')];queues[_0x48fcbe[_0x8506('0x6')]]['queuecallercomplete']=!![];queues[_0x48fcbe[_0x8506('0x6')]]['queuecallercompleteAt']=utils[_0x8506('0x16')]();if(_0x48fcbe['reason']==_0x8506('0x3f')){if(!queues[_0x48fcbe[_0x8506('0x6')]]['transfer']){queues[_0x48fcbe[_0x8506('0x6')]][_0x8506('0xc')]=_0x8506('0x40');}}else{queues[_0x48fcbe[_0x8506('0x6')]][_0x8506('0xc')]=_0x8506('0x41')+_0x48fcbe[_0x8506('0x42')]['toUpperCase']();}utils['info'](util[_0x8506('0x4')](_0x8506('0x43'),_0x48fcbe[_0x8506('0x6')],queues[_0x48fcbe[_0x8506('0x6')]]['name'],_0x48fcbe['membername'],queues[_0x48fcbe['uniqueid']][_0x8506('0xc')]));writeDB(queues[_0x48fcbe[_0x8506('0x6')]]);}}}catch(_0x46d959){utils[_0x8506('0x17')](util[_0x8506('0x4')](_0x8506('0x3e'),_0x48fcbe['uniqueid']),_0x46d959);}};exports[_0x8506('0x44')]=function(_0x4d03bc){try{if(!_['isNil'](queues[_0x4d03bc[_0x8506('0x45')]])){utils['debug'](util[_0x8506('0x4')](_0x8506('0x46'),_0x4d03bc[_0x8506('0x6')]),_0x4d03bc);queues[_0x4d03bc[_0x8506('0x45')]][_0x8506('0x3f')]=!![];queues[_0x4d03bc['transfereeuniqueid']][_0x8506('0x47')]='BLIND';queues[_0x4d03bc[_0x8506('0x45')]][_0x8506('0x48')]=_0x4d03bc['extension'];queues[_0x4d03bc[_0x8506('0x45')]][_0x8506('0x49')]=_0x4d03bc['transfereeuniqueid'];queues[_0x4d03bc['transfereeuniqueid']][_0x8506('0xc')]=_0x8506('0x4a');utils['info'](util[_0x8506('0x4')](_0x8506('0x4b'),_0x4d03bc[_0x8506('0x6')],queues[_0x4d03bc['transfereeuniqueid']][_0x8506('0x1e')],_0x4d03bc['transfereeuniqueid'],_0x4d03bc[_0x8506('0x4c')]));}}catch(_0x5b1341){utils[_0x8506('0x17')](util['format'](_0x8506('0x46'),_0x4d03bc[_0x8506('0x6')]),_0x5b1341);}};exports[_0x8506('0x4d')]=function(_0x5e1e03){try{utils[_0x8506('0x13')](util[_0x8506('0x4')](_0x8506('0x4e'),_0x5e1e03[_0x8506('0x4f')]),_0x5e1e03);if(_0x5e1e03[_0x8506('0x4f')]==_0x5e1e03[_0x8506('0x50')]){if(!_[_0x8506('0x18')](queues[_0x5e1e03[_0x8506('0x51')]])){utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x52'),_0x5e1e03['origtransfereruniqueid'],queues[_0x5e1e03[_0x8506('0x51')]]['name'],_0x5e1e03[_0x8506('0x53')]));queues[_0x5e1e03[_0x8506('0x51')]][_0x8506('0x3f')]=!![];queues[_0x5e1e03[_0x8506('0x51')]][_0x8506('0x47')]=_0x8506('0x54');queues[_0x5e1e03['secondtransfererlinkedid']]['transferexten']=_0x5e1e03[_0x8506('0x53')];queues[_0x5e1e03['secondtransfererlinkedid']][_0x8506('0x49')]=_0x5e1e03['origtransfereruniqueid'];queues[_0x5e1e03[_0x8506('0x51')]][_0x8506('0xc')]='ATTENDEDTRANSFER';}if(!_[_0x8506('0x18')](queues[_0x5e1e03[_0x8506('0x50')]])){if(_0x5e1e03[_0x8506('0x55')]&&queues[_0x5e1e03[_0x8506('0x55')]]){queues[_0x5e1e03[_0x8506('0x55')]]['queuecallerenterreason']=0x1;queues[_0x5e1e03[_0x8506('0x45')]]=_[_0x8506('0x56')](queues[_0x5e1e03[_0x8506('0x55')]]);queues[_0x5e1e03[_0x8506('0x45')]]['transfereduniqueid']=_0x5e1e03['transfertargetuniqueid'];queues[_0x5e1e03[_0x8506('0x45')]][_0x8506('0x20')]=0x2;queues[_0x5e1e03[_0x8506('0x45')]][_0x8506('0xa')]=queues[_0x5e1e03[_0x8506('0x51')]]['calleridnum'];queues[_0x5e1e03[_0x8506('0x45')]][_0x8506('0x57')]=queues[_0x5e1e03['secondtransfererlinkedid']][_0x8506('0x57')];queues[_0x5e1e03[_0x8506('0x45')]][_0x8506('0x36')]=utils['now']();queues[_0x5e1e03[_0x8506('0x45')]][_0x8506('0x1a')]=utils['now']();queues[_0x5e1e03['transfereeuniqueid']][_0x8506('0x34')]=0x0;queues[_0x5e1e03[_0x8506('0x45')]]['mohtime']=0x0;utils[_0x8506('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5e1e03['origtransfereruniqueid'],queues[_0x5e1e03[_0x8506('0x45')]]['name'],queues[_0x5e1e03[_0x8506('0x45')]][_0x8506('0xa')],queues[_0x5e1e03[_0x8506('0x45')]][_0x8506('0x57')]));}else{utils[_0x8506('0x3')](util['format'](_0x8506('0x58'),_0x5e1e03[_0x8506('0x4f')],queues[_0x5e1e03[_0x8506('0x50')]]['name'],_0x5e1e03[_0x8506('0x51')]));queues[_0x5e1e03[_0x8506('0x50')]][_0x8506('0x11')]=_0x5e1e03['secondtransfererlinkedid'];}}}else if(_0x5e1e03[_0x8506('0x59')]==_0x5e1e03[_0x8506('0x51')]){if(!_[_0x8506('0x18')](queues[_0x5e1e03[_0x8506('0x50')]])){utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x5a'),_0x5e1e03[_0x8506('0x4f')],queues[_0x5e1e03[_0x8506('0x50')]]['name'],_0x5e1e03['secondtransfereruniqueid'],_0x5e1e03['secondtransfererexten']));queues[_0x5e1e03[_0x8506('0x50')]][_0x8506('0x3f')]=!![];queues[_0x5e1e03[_0x8506('0x50')]]['transfertype']=_0x8506('0x54');queues[_0x5e1e03[_0x8506('0x50')]][_0x8506('0x48')]=_0x5e1e03[_0x8506('0x5b')];queues[_0x5e1e03['origtransfererlinkedid']][_0x8506('0x49')]=_0x5e1e03[_0x8506('0x59')];queues[_0x5e1e03['origtransfererlinkedid']][_0x8506('0xc')]=_0x8506('0x5c');}if(!_['isNil'](queues[_0x5e1e03[_0x8506('0x51')]])){if(_0x5e1e03[_0x8506('0x5d')]&&queues[_0x5e1e03[_0x8506('0x5d')]]){queues[_0x5e1e03[_0x8506('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x5e1e03['transfertargetuniqueid']]=_[_0x8506('0x56')](queues[_0x5e1e03[_0x8506('0x5d')]]);queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0x11')]=_0x5e1e03[_0x8506('0x5e')];queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0x20')]=0x2;queues[_0x5e1e03['transfertargetuniqueid']]['calleridnum']=queues[_0x5e1e03[_0x8506('0x50')]][_0x8506('0xa')];queues[_0x5e1e03[_0x8506('0x5e')]]['calleridname']=queues[_0x5e1e03[_0x8506('0x50')]]['calleridname'];queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0x36')]=utils[_0x8506('0x16')]();queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0x1a')]=utils[_0x8506('0x16')]();queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0x34')]=0x0;queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0x5f')]=0x0;utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x60'),_0x5e1e03[_0x8506('0x4f')],queues[_0x5e1e03[_0x8506('0x5e')]]['name'],queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0x11')],queues[_0x5e1e03[_0x8506('0x5e')]][_0x8506('0xa')],queues[_0x5e1e03[_0x8506('0x5e')]]['calleridname']));}else{utils[_0x8506('0x3')](util[_0x8506('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5e1e03[_0x8506('0x4f')],queues[_0x5e1e03[_0x8506('0x51')]]['name'],_0x5e1e03[_0x8506('0x50')]));queues[_0x5e1e03[_0x8506('0x51')]][_0x8506('0x11')]=_0x5e1e03[_0x8506('0x50')];}}}}catch(_0x5d1e54){utils[_0x8506('0x17')](util[_0x8506('0x4')](_0x8506('0x4e'),_0x5e1e03['origtransfereruniqueid']),_0x5d1e54);}};exports[_0x8506('0x61')]=function(_0x321010){try{if(!_[_0x8506('0x18')](queues[_0x321010[_0x8506('0x6')]])){utils['debug'](util[_0x8506('0x4')](_0x8506('0x62'),_0x321010[_0x8506('0x6')]),_0x321010);queues[_0x321010[_0x8506('0x6')]][_0x8506('0x63')]=utils[_0x8506('0x16')]();utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x64'),_0x321010[_0x8506('0x6')],queues[_0x321010['uniqueid']]['name'],queues[_0x321010[_0x8506('0x6')]][_0x8506('0x63')]));}}catch(_0x1b6b2b){utils[_0x8506('0x17')](util[_0x8506('0x4')]('[%s][queues][musiconholdstart]',_0x321010['uniqueid']),_0x1b6b2b);}};exports[_0x8506('0x65')]=function(_0x4236c4){try{if(!_[_0x8506('0x18')](queues[_0x4236c4[_0x8506('0x6')]])){if(!_[_0x8506('0x18')](queues[_0x4236c4[_0x8506('0x6')]]['musiconholdstartAt'])){utils['debug'](util[_0x8506('0x4')]('[%s][queues][musiconholdstop]',_0x4236c4[_0x8506('0x6')]),_0x4236c4);queues[_0x4236c4['uniqueid']][_0x8506('0x5f')]+=utils['diffTime'](utils['now'](),queues[_0x4236c4[_0x8506('0x6')]][_0x8506('0x63')]);utils[_0x8506('0x3')](util[_0x8506('0x4')](_0x8506('0x66'),_0x4236c4[_0x8506('0x6')],queues[_0x4236c4[_0x8506('0x6')]][_0x8506('0x1e')],queues[_0x4236c4['uniqueid']][_0x8506('0x5f')]));delete queues[_0x4236c4['uniqueid']][_0x8506('0x63')];}}}catch(_0x325c5c){utils[_0x8506('0x17')](util[_0x8506('0x4')]('[%s][queues][musiconholdstop]',_0x4236c4['uniqueid']),_0x325c5c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 9b4c70c..bafa661 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 _0x3c44=['[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','request','CreateVoiceRecording','newchannel','debug','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','hangup'];(function(_0xaf99c9,_0x36e1fc){var _0x23879d=function(_0x30cf03){while(--_0x30cf03){_0xaf99c9['push'](_0xaf99c9['shift']());}};_0x23879d(++_0x36e1fc);}(_0x3c44,0x12a));var _0x43c4=function(_0xcfd65a,_0xbc65c8){_0xcfd65a=_0xcfd65a-0x0;var _0x58370b=_0x3c44[_0xcfd65a];return _0x58370b;};'use strict';var _=require(_0x43c4('0x0'));var util=require(_0x43c4('0x1'));var utils=require(_0x43c4('0x2'));var recordings={};function writeDB(_0x379c9c){utils[_0x43c4('0x3')](util['format'](_0x43c4('0x4'),_0x379c9c[_0x43c4('0x5')]));if(_0x379c9c['accountcode']){utils['getUserByInternal'](_0x379c9c[_0x43c4('0x6')])[_0x43c4('0x7')](function(_0x5e2d29){if(_0x5e2d29){_0x379c9c[_0x43c4('0x8')]=_0x5e2d29[_0x43c4('0x9')];_0x379c9c['UserId']=_0x5e2d29['id'];}utils[_0x43c4('0xa')](_0x43c4('0xb'),_0x379c9c);});}else{utils[_0x43c4('0xa')](_0x43c4('0xb'),_0x379c9c);}}exports[_0x43c4('0xc')]=function(_0x337f24){try{utils[_0x43c4('0xd')](util['format']('[%s][recordings][newchannel]',_0x337f24[_0x43c4('0x5')]),_0x337f24);if(_0x337f24['uniqueid']==_0x337f24[_0x43c4('0xe')]){utils[_0x43c4('0x3')](util[_0x43c4('0xf')](_0x43c4('0x10'),_0x337f24[_0x43c4('0x5')],_0x337f24['context'],_0x337f24['exten']));recordings[_0x337f24[_0x43c4('0x5')]]={'uniqueid':_0x337f24['uniqueid'],'accountcode':_0x337f24['accountcode'],'exten':_0x337f24[_0x43c4('0x11')],'context':_0x337f24[_0x43c4('0x12')],'channel':_0x337f24[_0x43c4('0x13')],'monitors':[]};}}catch(_0x1972c9){utils[_0x43c4('0x14')](util['format'](_0x43c4('0x15'),_0x337f24[_0x43c4('0x5')]),_0x1972c9);}};exports[_0x43c4('0x16')]=function(_0x537a77){try{utils[_0x43c4('0xd')](util[_0x43c4('0xf')](_0x43c4('0x17'),_0x537a77[_0x43c4('0x5')]),_0x537a77);if(!_[_0x43c4('0x18')](recordings[_0x537a77[_0x43c4('0x5')]])&&_0x537a77[_0x43c4('0x19')]==0x6){utils[_0x43c4('0x3')](util[_0x43c4('0xf')](_0x43c4('0x1a'),_0x537a77[_0x43c4('0x5')],_0x537a77[_0x43c4('0x12')],_0x537a77['channel']));}else if(!_[_0x43c4('0x18')](recordings[_0x537a77[_0x43c4('0xe')]])&&_0x537a77['channelstate']==0x6&&_0x537a77[_0x43c4('0x12')]!=_0x43c4('0x1b')){utils[_0x43c4('0x3')](util[_0x43c4('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x537a77[_0x43c4('0x5')],_0x537a77['linkedid'],_0x537a77['context'],_0x537a77[_0x43c4('0x13')]));recordings[_0x537a77['linkedid']]['accountcode']=_0x537a77[_0x43c4('0x6')];}}catch(_0x17baf4){utils[_0x43c4('0x14')](util[_0x43c4('0xf')](_0x43c4('0x17'),_0x537a77[_0x43c4('0x5')]),_0x17baf4);}};exports[_0x43c4('0x1c')]=function(_0x1c40b4){try{if(!_['isNil'](_0x1c40b4['variable'])&&!_[_0x43c4('0x18')](_0x1c40b4[_0x43c4('0x1d')][_0x43c4('0x1e')])){utils[_0x43c4('0xd')](util[_0x43c4('0xf')](_0x43c4('0x1f'),_0x1c40b4[_0x43c4('0x5')]),_0x1c40b4);utils[_0x43c4('0x3')](util['format'](_0x43c4('0x20'),_0x1c40b4[_0x43c4('0x5')],_0x1c40b4[_0x43c4('0x1d')],_0x1c40b4[_0x43c4('0x21')]));if(_[_0x43c4('0x22')](_0x1c40b4[_0x43c4('0x21')],'.wav49')){_0x1c40b4['value']=_0x1c40b4[_0x43c4('0x21')][_0x43c4('0x23')](_0x43c4('0x24'),_0x43c4('0x25'));}if(recordings[_0x1c40b4['linkedid']]){var _0x316303=_[_0x43c4('0x26')](recordings[_0x1c40b4[_0x43c4('0xe')]][_0x43c4('0x27')],{'value':_0x1c40b4[_0x43c4('0x21')]});if(_[_0x43c4('0x18')](_0x316303)){recordings[_0x1c40b4['linkedid']][_0x43c4('0x27')][_0x43c4('0x28')]({'value':_0x1c40b4[_0x43c4('0x21')]});}}}}catch(_0x34a6bb){utils[_0x43c4('0x14')](util['format'](_0x43c4('0x1f'),_0x1c40b4['uniqueid']),_0x34a6bb);}};exports[_0x43c4('0x29')]=function(_0x28f9bd){try{if(!_[_0x43c4('0x18')](recordings[_0x28f9bd[_0x43c4('0x5')]])){utils['debug'](util[_0x43c4('0xf')](_0x43c4('0x2a'),_0x28f9bd[_0x43c4('0x5')]),_0x28f9bd);utils[_0x43c4('0x3')](util[_0x43c4('0xf')](_0x43c4('0x2b'),_0x28f9bd['uniqueid'],_0x28f9bd[_0x43c4('0x2c')],_0x28f9bd['calleridname'],_0x28f9bd[_0x43c4('0x2d')]));recordings[_0x28f9bd[_0x43c4('0x5')]][_0x43c4('0x2c')]=_0x28f9bd['calleridnum'];recordings[_0x28f9bd[_0x43c4('0x5')]][_0x43c4('0x2e')]=_0x28f9bd[_0x43c4('0x2e')];recordings[_0x28f9bd[_0x43c4('0x5')]][_0x43c4('0x2f')]=_0x28f9bd['connectedlinenum'];recordings[_0x28f9bd['uniqueid']][_0x43c4('0x30')]=_0x28f9bd[_0x43c4('0x30')];if(recordings[_0x28f9bd['uniqueid']][_0x43c4('0x31')]==_0x43c4('0x32')&&recordings[_0x28f9bd[_0x43c4('0x5')]][_0x43c4('0x6')]){recordings[_0x28f9bd[_0x43c4('0x5')]][_0x43c4('0x2f')]=recordings[_0x28f9bd[_0x43c4('0x5')]][_0x43c4('0x6')];recordings[_0x28f9bd['uniqueid']][_0x43c4('0x30')]='';}recordings[_0x28f9bd[_0x43c4('0x5')]][_0x43c4('0x27')]['forEach'](function(_0x11b23f){var _0x1e0420=_[_0x43c4('0x33')](recordings[_0x28f9bd[_0x43c4('0x5')]]);_0x1e0420[_0x43c4('0x21')]=_0x11b23f[_0x43c4('0x21')];writeDB(_0x1e0420);});delete recordings[_0x28f9bd['uniqueid']];}}catch(_0x5782f5){utils[_0x43c4('0x14')](util['format'](_0x43c4('0x2a'),_0x28f9bd[_0x43c4('0x5')]),_0x5782f5);}};exports[_0x43c4('0x34')]=function(_0x1c2283){try{if(!_['isNil'](recordings[_0x1c2283[_0x43c4('0x5')]])){utils[_0x43c4('0xd')](util[_0x43c4('0xf')](_0x43c4('0x35'),_0x1c2283['uniqueid']),_0x1c2283);utils['info'](util[_0x43c4('0xf')](_0x43c4('0x36'),_0x1c2283[_0x43c4('0x5')],_0x1c2283['application'],_0x1c2283[_0x43c4('0x37')]));if(_0x1c2283[_0x43c4('0x38')][_0x43c4('0x39')]()==_0x43c4('0x3a')&&_[_0x43c4('0x3b')](_0x1c2283[_0x43c4('0x37')][_0x43c4('0x39')](),_0x43c4('0x3c'))){var _0xdecb50=_0x1c2283[_0x43c4('0x37')][_0x43c4('0x3d')]('=');var _0x334ed2=_0xdecb50[0x0][_0x43c4('0x3e')](_0xdecb50[0x0]['lastIndexOf']('(')+0x1,_0xdecb50[0x0][_0x43c4('0x3f')](')'));var _0x17fcc6=_0xdecb50[0x1];recordings[_0x1c2283[_0x43c4('0x5')]][_0x334ed2]=_0x17fcc6;}}}catch(_0x38b4ba){utils[_0x43c4('0x14')](util[_0x43c4('0xf')]('[%s][recordings][newexten]',_0x1c2283[_0x43c4('0x5')]),_0x38b4ba);}};exports[_0x43c4('0x40')]=function(_0x576874){try{if(!_[_0x43c4('0x18')](recordings[_0x576874[_0x43c4('0x5')]])){utils[_0x43c4('0xd')](util[_0x43c4('0xf')]('[%s][recordings][queuecallerjoin]',_0x576874['uniqueid']),_0x576874);utils['info'](util[_0x43c4('0xf')](_0x43c4('0x41'),_0x576874['uniqueid'],_0x576874['queue']));recordings[_0x576874[_0x43c4('0x5')]]['queue']=_0x576874[_0x43c4('0x42')];}}catch(_0x1f704f){utils[_0x43c4('0x14')](util['format'](_0x43c4('0x43'),_0x576874['uniqueid']),_0x1f704f);}}; \ No newline at end of file +var _0x5001=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','endsWith','replace','.wav49','find','monitors','push','calleridnum','calleridname','cause-txt','connectedlinename','type','outbound','connectedlinenum','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','name','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5001,0xd0));var _0x1500=function(_0x22c355,_0x3065ea){_0x22c355=_0x22c355-0x0;var _0x398155=_0x5001[_0x22c355];return _0x398155;};'use strict';var _=require('lodash');var util=require(_0x1500('0x0'));var utils=require(_0x1500('0x1'));var recordings={};function writeDB(_0x180f8e){utils[_0x1500('0x2')](util[_0x1500('0x3')](_0x1500('0x4'),_0x180f8e[_0x1500('0x5')]));if(_0x180f8e[_0x1500('0x6')]){utils['getUserByInternal'](_0x180f8e[_0x1500('0x6')])[_0x1500('0x7')](function(_0x209467){if(_0x209467){_0x180f8e['membername']=_0x209467[_0x1500('0x8')];_0x180f8e['UserId']=_0x209467['id'];}utils[_0x1500('0x9')](_0x1500('0xa'),_0x180f8e);});}else{utils['request'](_0x1500('0xa'),_0x180f8e);}}exports['newchannel']=function(_0x5e258b){try{utils[_0x1500('0xb')](util['format']('[%s][recordings][newchannel]',_0x5e258b[_0x1500('0x5')]),_0x5e258b);if(_0x5e258b['uniqueid']==_0x5e258b[_0x1500('0xc')]){utils[_0x1500('0x2')](util[_0x1500('0x3')](_0x1500('0xd'),_0x5e258b['uniqueid'],_0x5e258b[_0x1500('0xe')],_0x5e258b[_0x1500('0xf')]));recordings[_0x5e258b[_0x1500('0x5')]]={'uniqueid':_0x5e258b[_0x1500('0x5')],'accountcode':_0x5e258b[_0x1500('0x6')],'exten':_0x5e258b[_0x1500('0xf')],'context':_0x5e258b[_0x1500('0xe')],'channel':_0x5e258b[_0x1500('0x10')],'monitors':[]};}}catch(_0x3f2481){utils[_0x1500('0x11')](util['format']('[%s][recordings][newchannel]',_0x5e258b['uniqueid']),_0x3f2481);}};exports['newstate']=function(_0x5b6e46){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x5b6e46[_0x1500('0x5')]),_0x5b6e46);if(!_[_0x1500('0x12')](recordings[_0x5b6e46['uniqueid']])&&_0x5b6e46[_0x1500('0x13')]==0x6){utils[_0x1500('0x2')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x5b6e46[_0x1500('0x5')],_0x5b6e46[_0x1500('0xe')],_0x5b6e46[_0x1500('0x10')]));}else if(!_[_0x1500('0x12')](recordings[_0x5b6e46[_0x1500('0xc')]])&&_0x5b6e46['channelstate']==0x6&&_0x5b6e46['context']!=_0x1500('0x14')){utils['info'](util[_0x1500('0x3')](_0x1500('0x15'),_0x5b6e46['uniqueid'],_0x5b6e46[_0x1500('0xc')],_0x5b6e46['context'],_0x5b6e46[_0x1500('0x10')]));recordings[_0x5b6e46[_0x1500('0xc')]][_0x1500('0x6')]=_0x5b6e46[_0x1500('0x6')];}}catch(_0x1e1809){utils[_0x1500('0x11')](util[_0x1500('0x3')](_0x1500('0x16'),_0x5b6e46['uniqueid']),_0x1e1809);}};exports[_0x1500('0x17')]=function(_0x15c679){try{if(!_['isNil'](_0x15c679['variable'])&&!_['isNil'](_0x15c679['variable']['mixmonitor_filename'])){utils[_0x1500('0xb')](util[_0x1500('0x3')](_0x1500('0x18'),_0x15c679[_0x1500('0x5')]),_0x15c679);utils['info'](util[_0x1500('0x3')](_0x1500('0x19'),_0x15c679[_0x1500('0x5')],_0x15c679[_0x1500('0x1a')],_0x15c679[_0x1500('0x1b')]));if(_[_0x1500('0x1c')](_0x15c679[_0x1500('0x1b')],'.wav49')){_0x15c679[_0x1500('0x1b')]=_0x15c679[_0x1500('0x1b')][_0x1500('0x1d')](_0x1500('0x1e'),'.WAV');}if(recordings[_0x15c679['linkedid']]){var _0x240de5=_[_0x1500('0x1f')](recordings[_0x15c679[_0x1500('0xc')]][_0x1500('0x20')],{'value':_0x15c679[_0x1500('0x1b')]});if(_[_0x1500('0x12')](_0x240de5)){recordings[_0x15c679[_0x1500('0xc')]][_0x1500('0x20')][_0x1500('0x21')]({'value':_0x15c679[_0x1500('0x1b')]});}}}}catch(_0x45f602){utils[_0x1500('0x11')](util['format']('[%s][recordings][varset]',_0x15c679[_0x1500('0x5')]),_0x45f602);}};exports['hangup']=function(_0x169294){try{if(!_[_0x1500('0x12')](recordings[_0x169294['uniqueid']])){utils['debug'](util[_0x1500('0x3')]('[%s][recordings][hangup]',_0x169294['uniqueid']),_0x169294);utils[_0x1500('0x2')](util[_0x1500('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x169294[_0x1500('0x5')],_0x169294[_0x1500('0x22')],_0x169294[_0x1500('0x23')],_0x169294[_0x1500('0x24')]));recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x22')]=_0x169294['calleridnum'];recordings[_0x169294['uniqueid']][_0x1500('0x23')]=_0x169294[_0x1500('0x23')];recordings[_0x169294[_0x1500('0x5')]]['connectedlinenum']=_0x169294['connectedlinenum'];recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x25')]=_0x169294[_0x1500('0x25')];if(recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x26')]==_0x1500('0x27')&&recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x6')]){recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x28')]=recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x6')];recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x25')]='';}recordings[_0x169294[_0x1500('0x5')]][_0x1500('0x20')][_0x1500('0x29')](function(_0x3b15a8){var _0x10da6a=_[_0x1500('0x2a')](recordings[_0x169294[_0x1500('0x5')]]);_0x10da6a['value']=_0x3b15a8[_0x1500('0x1b')];writeDB(_0x10da6a);});delete recordings[_0x169294[_0x1500('0x5')]];}}catch(_0x5ab5c2){utils[_0x1500('0x11')](util[_0x1500('0x3')]('[%s][recordings][hangup]',_0x169294['uniqueid']),_0x5ab5c2);}};exports[_0x1500('0x2b')]=function(_0x1f74ab){try{if(!_[_0x1500('0x12')](recordings[_0x1f74ab['uniqueid']])){utils['debug'](util[_0x1500('0x3')](_0x1500('0x2c'),_0x1f74ab[_0x1500('0x5')]),_0x1f74ab);utils[_0x1500('0x2')](util[_0x1500('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1f74ab[_0x1500('0x5')],_0x1f74ab[_0x1500('0x2d')],_0x1f74ab[_0x1500('0x2e')]));if(_0x1f74ab[_0x1500('0x2d')][_0x1500('0x2f')]()==_0x1500('0x30')&&_[_0x1500('0x31')](_0x1f74ab['appdata'][_0x1500('0x2f')](),_0x1500('0x32'))){var _0x39a4df=_0x1f74ab[_0x1500('0x2e')][_0x1500('0x33')]('=');var _0x26cd3b=_0x39a4df[0x0][_0x1500('0x34')](_0x39a4df[0x0][_0x1500('0x35')]('(')+0x1,_0x39a4df[0x0][_0x1500('0x35')](')'));var _0x24518b=_0x39a4df[0x1];recordings[_0x1f74ab[_0x1500('0x5')]][_0x26cd3b]=_0x24518b;}}}catch(_0x29ad8e){utils[_0x1500('0x11')](util['format'](_0x1500('0x2c'),_0x1f74ab['uniqueid']),_0x29ad8e);}};exports[_0x1500('0x36')]=function(_0x41d83a){try{if(!_['isNil'](recordings[_0x41d83a[_0x1500('0x5')]])){utils[_0x1500('0xb')](util[_0x1500('0x3')](_0x1500('0x37'),_0x41d83a[_0x1500('0x5')]),_0x41d83a);utils[_0x1500('0x2')](util[_0x1500('0x3')](_0x1500('0x38'),_0x41d83a[_0x1500('0x5')],_0x41d83a['queue']));recordings[_0x41d83a[_0x1500('0x5')]][_0x1500('0x39')]=_0x41d83a['queue'];}}catch(_0x53c29a){utils[_0x1500('0x11')](util['format']('[%s][recordings][queuecallerjoin]',_0x41d83a[_0x1500('0x5')]),_0x53c29a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 07e29fa..f1d5320 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 _0x41ef=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x2419a6,_0x13b170){var _0x41590f=function(_0x25780f){while(--_0x25780f){_0x2419a6['push'](_0x2419a6['shift']());}};_0x41590f(++_0x13b170);}(_0x41ef,0x6a));var _0xf41e=function(_0x1b15b4,_0x4b5d7c){_0x1b15b4=_0x1b15b4-0x0;var _0x10d385=_0x41ef[_0x1b15b4];return _0x10d385;};'use strict';var _=require('lodash');var util=require(_0xf41e('0x0'));var utils=require(_0xf41e('0x1'));function writeDB(_0x14e2b7){utils[_0xf41e('0x2')](util['format'](_0xf41e('0x3'),_0x14e2b7[_0xf41e('0x4')]===_0xf41e('0x5')?_0x14e2b7[_0xf41e('0x6')]:_0x14e2b7[_0xf41e('0x7')],_0x14e2b7[_0xf41e('0x4')]));utils[_0xf41e('0x8')](_0xf41e('0x9'),_0x14e2b7);}exports[_0xf41e('0xa')]=function(_0x4927d4){try{utils[_0xf41e('0xb')](util[_0xf41e('0xc')](_0xf41e('0xd'),_0x4927d4[_0xf41e('0x7')]),_0x4927d4);utils[_0xf41e('0x2')](util[_0xf41e('0xc')](_0xf41e('0xe'),_0x4927d4[_0xf41e('0x7')],_0x4927d4[_0xf41e('0xf')],_0x4927d4[_0xf41e('0x10')],_0x4927d4[_0xf41e('0x11')],_0x4927d4[_0xf41e('0x12')]));_0x4927d4['type']=_0xf41e('0x13');writeDB(_0x4927d4);}catch(_0x4ef667){utils[_0xf41e('0x14')](util[_0xf41e('0xc')]('[%s][transfers][blindtransfer]',_0x4927d4[_0xf41e('0x7')]),_0x4ef667);}};exports[_0xf41e('0x15')]=function(_0x57b246){try{utils['debug'](util[_0xf41e('0xc')](_0xf41e('0x16'),_0x57b246[_0xf41e('0x6')]),_0x57b246);utils['info'](util['format'](_0xf41e('0x17'),_0x57b246['origtransfereruniqueid'],_0x57b246[_0xf41e('0x18')],_0x57b246[_0xf41e('0x19')],_0x57b246[_0xf41e('0x1a')],_0x57b246['transfertargetcalleridname']));_0x57b246=_[_0xf41e('0x1b')](_0x57b246,{'transfererchannel':_0x57b246[_0xf41e('0x1c')],'transferercalleridnum':_0x57b246[_0xf41e('0x18')],'transferercalleridname':_0x57b246[_0xf41e('0x19')],'transfererconnectedlinenum':_0x57b246[_0xf41e('0x1d')],'transfererconnectedlinename':_0x57b246[_0xf41e('0x1e')],'transfereraccountcode':_0x57b246[_0xf41e('0x1f')],'transferercontext':_0x57b246[_0xf41e('0x20')],'transfererexten':_0x57b246[_0xf41e('0x21')],'transfererlinkedid':_0x57b246[_0xf41e('0x22')],'context':_0x57b246[_0xf41e('0x23')],'extension':_0x57b246[_0xf41e('0x24')],'type':'attended'});if(_[_0xf41e('0x25')](_0x57b246[_0xf41e('0x26')])){_0x57b246=_[_0xf41e('0x1b')](_0x57b246,{'transfereechannel':_0x57b246['transfertargetchannel'],'transfereecalleridnum':_0x57b246[_0xf41e('0x1a')],'transfereecalleridname':_0x57b246[_0xf41e('0x27')],'transfereeconnectedlinenum':_0x57b246[_0xf41e('0x28')],'transfereeconnectedlinename':_0x57b246[_0xf41e('0x29')],'transfereeaccountcode':_0x57b246[_0xf41e('0x2a')],'transfereecontext':_0x57b246[_0xf41e('0x2b')],'transfereeexten':_0x57b246[_0xf41e('0x2c')],'transfereelinkedid':_0x57b246[_0xf41e('0x2d')]});}writeDB(_0x57b246);}catch(_0x3b903c){utils[_0xf41e('0x14')](util[_0xf41e('0xc')](_0xf41e('0x16'),_0x57b246['origtransfereruniqueid']),_0x3b903c);}}; \ No newline at end of file +var _0xcd23=['transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetcalleridnum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum'];(function(_0x2d9799,_0x310cde){var _0x136fc4=function(_0x12823d){while(--_0x12823d){_0x2d9799['push'](_0x2d9799['shift']());}};_0x136fc4(++_0x310cde);}(_0xcd23,0x181));var _0x3cd2=function(_0x442d24,_0x5a58e7){_0x442d24=_0x442d24-0x0;var _0x40fe32=_0xcd23[_0x442d24];return _0x40fe32;};'use strict';var _=require(_0x3cd2('0x0'));var util=require(_0x3cd2('0x1'));var utils=require('./utils');function writeDB(_0x2ad87c){utils[_0x3cd2('0x2')](util[_0x3cd2('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x2ad87c['type']==='attended'?_0x2ad87c['origtransfereruniqueid']:_0x2ad87c[_0x3cd2('0x4')],_0x2ad87c[_0x3cd2('0x5')]));utils[_0x3cd2('0x6')](_0x3cd2('0x7'),_0x2ad87c);}exports[_0x3cd2('0x8')]=function(_0x1ae357){try{utils[_0x3cd2('0x9')](util[_0x3cd2('0x3')](_0x3cd2('0xa'),_0x1ae357[_0x3cd2('0x4')]),_0x1ae357);utils[_0x3cd2('0x2')](util[_0x3cd2('0x3')](_0x3cd2('0xb'),_0x1ae357[_0x3cd2('0x4')],_0x1ae357[_0x3cd2('0xc')],_0x1ae357[_0x3cd2('0xd')],_0x1ae357[_0x3cd2('0xe')],_0x1ae357[_0x3cd2('0xf')]));_0x1ae357[_0x3cd2('0x5')]=_0x3cd2('0x10');writeDB(_0x1ae357);}catch(_0x43aeae){utils[_0x3cd2('0x11')](util['format'](_0x3cd2('0xa'),_0x1ae357[_0x3cd2('0x4')]),_0x43aeae);}};exports[_0x3cd2('0x12')]=function(_0x561912){try{utils[_0x3cd2('0x9')](util['format'](_0x3cd2('0x13'),_0x561912[_0x3cd2('0x14')]),_0x561912);utils[_0x3cd2('0x2')](util[_0x3cd2('0x3')](_0x3cd2('0x15'),_0x561912['origtransfereruniqueid'],_0x561912['origtransferercalleridnum'],_0x561912['origtransferercalleridname'],_0x561912['transfertargetcalleridnum'],_0x561912[_0x3cd2('0x16')]));_0x561912=_[_0x3cd2('0x17')](_0x561912,{'transfererchannel':_0x561912[_0x3cd2('0x18')],'transferercalleridnum':_0x561912[_0x3cd2('0x19')],'transferercalleridname':_0x561912[_0x3cd2('0x1a')],'transfererconnectedlinenum':_0x561912['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x561912[_0x3cd2('0x1b')],'transfereraccountcode':_0x561912[_0x3cd2('0x1c')],'transferercontext':_0x561912[_0x3cd2('0x1d')],'transfererexten':_0x561912[_0x3cd2('0x1e')],'transfererlinkedid':_0x561912[_0x3cd2('0x1f')],'context':_0x561912[_0x3cd2('0x20')],'extension':_0x561912['origtransfererexten'],'type':'attended'});if(_[_0x3cd2('0x21')](_0x561912[_0x3cd2('0x22')])){_0x561912=_['assign'](_0x561912,{'transfereechannel':_0x561912['transfertargetchannel'],'transfereecalleridnum':_0x561912[_0x3cd2('0x23')],'transfereecalleridname':_0x561912['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x561912['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x561912['transfertargetconnectedlinename'],'transfereeaccountcode':_0x561912[_0x3cd2('0x24')],'transfereecontext':_0x561912[_0x3cd2('0x25')],'transfereeexten':_0x561912[_0x3cd2('0x26')],'transfereelinkedid':_0x561912[_0x3cd2('0x27')]});}writeDB(_0x561912);}catch(_0x52c56d){utils['error'](util[_0x3cd2('0x3')]('[%s][transfers][attendedtransfer]',_0x561912[_0x3cd2('0x14')]),_0x52c56d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index da630f6..1f14201 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 _0x50a1=['diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','inspect','debug','error','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','[utils][getUserByName]','getVoiceQueueByName','request','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','format','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime'];(function(_0x4f0cd0,_0x603ad6){var _0x18205e=function(_0x3941ac){while(--_0x3941ac){_0x4f0cd0['push'](_0x4f0cd0['shift']());}};_0x18205e(++_0x603ad6);}(_0x50a1,0x9a));var _0x150a=function(_0xbcb407,_0x108738){_0xbcb407=_0xbcb407-0x0;var _0x5ccca8=_0x50a1[_0xbcb407];return _0x5ccca8;};'use strict';var BPromise=require(_0x150a('0x0'));var jayson=require(_0x150a('0x1'));var moment=require(_0x150a('0x2'));var util=require(_0x150a('0x3'));var client=jayson[_0x150a('0x4')]['http']({'port':0x2329});var logger=require(_0x150a('0x5'))(_0x150a('0x6'));exports[_0x150a('0x7')]=function(_0x4e8a1a,_0x10182e){logger[_0x150a('0x7')](_0x4e8a1a,_0x10182e?util[_0x150a('0x8')](_0x10182e,{'showHidden':![],'depth':null}):'');};exports[_0x150a('0x9')]=function(_0x52b124,_0x393022){logger[_0x150a('0x9')](_0x52b124,_0x393022?util[_0x150a('0x8')](_0x393022,{'showHidden':![],'depth':null}):'');};exports[_0x150a('0xa')]=function(_0x553c6a,_0x98416a){logger[_0x150a('0xa')](_0x553c6a,_0x98416a?util['inspect'](_0x98416a,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x555c7f,_0x2d1d5c){return client['request'](_0x555c7f,{'body':_0x2d1d5c})['then'](function(_0x5e47ad){logger[_0x150a('0x9')](_0x150a('0xb'),_0x555c7f,_0x5e47ad?util[_0x150a('0x8')](_0x5e47ad,{'showHidden':![],'depth':null}):'');})[_0x150a('0xc')](function(_0x263177){logger['error']('[utils][request]\x20name:%s',_0x555c7f,_0x263177?util['inspect'](_0x263177,{'showHidden':![],'depth':null}):'');});};function getUser(_0x41051c){return client['request'](_0x150a('0xd'),{'options':{'raw':!![],'attributes':['id',_0x150a('0xe'),'name',_0x150a('0xf')],'where':_0x41051c,'limit':0x1}})['then'](function(_0x3b16a0){logger[_0x150a('0x9')](_0x150a('0x10'),JSON['stringify'](_0x41051c),_0x3b16a0?util[_0x150a('0x8')](_0x3b16a0,{'showHidden':![],'depth':null}):'');return _0x3b16a0[_0x150a('0x11')][_0x150a('0x12')]?_0x3b16a0[_0x150a('0x11')][0x0]:null;});}exports[_0x150a('0x13')]=function(_0x178197){return new BPromise(function(_0x13e4a5,_0x5a977f){if(_0x178197){return getUser({'internal':_0x178197})[_0x150a('0x14')](function(_0x3bd70f){logger[_0x150a('0x7')](_0x150a('0x15'),_0x178197,_0x3bd70f?'found':_0x150a('0x16'));return _0x13e4a5(_0x3bd70f);})[_0x150a('0xc')](function(_0x1cc2de){logger[_0x150a('0xa')](_0x150a('0x17'),_0x1cc2de?util['inspect'](_0x1cc2de,{'showHidden':![],'depth':null}):'');return _0x13e4a5(null);});}return _0x13e4a5(null);});};exports[_0x150a('0x18')]=function(_0x15d43e){return new BPromise(function(_0xc8cd0,_0x333f7a){if(_0x15d43e){return getUser({'interface':_0x15d43e})[_0x150a('0x14')](function(_0x5f396c){logger[_0x150a('0x7')](_0x150a('0x19'),_0x15d43e,_0x5f396c?'found':'notfound');return _0xc8cd0(_0x5f396c);})['catch'](function(_0x10ea91){logger[_0x150a('0xa')](_0x150a('0x1a'),_0x10ea91?util['inspect'](_0x10ea91,{'showHidden':![],'depth':null}):'');return _0xc8cd0(null);});}return _0xc8cd0(null);});};exports[_0x150a('0x1b')]=function(_0x343bf4){return new BPromise(function(_0x37ae78,_0x116309){if(_0x343bf4){return getUser({'name':_0x343bf4})['then'](function(_0x39a0d7){logger[_0x150a('0x7')](_0x150a('0x1c'),_0x343bf4,_0x39a0d7?_0x150a('0x1d'):_0x150a('0x16'));return _0x37ae78(_0x39a0d7);})[_0x150a('0xc')](function(_0x33cca8){logger['error'](_0x150a('0x1e'),_0x33cca8?util[_0x150a('0x8')](_0x33cca8,{'showHidden':![],'depth':null}):'');return _0x37ae78(null);});}return _0x37ae78(null);});};exports[_0x150a('0x1f')]=function(_0x2d6207){return new BPromise(function(_0x439309,_0x2fb206){if(_0x2d6207){return client[_0x150a('0x20')](_0x150a('0x21'),{'options':{'raw':!![],'attributes':['id',_0x150a('0x22'),_0x150a('0x23'),_0x150a('0x24'),_0x150a('0x25')],'where':{'name':_0x2d6207},'limit':0x1}})[_0x150a('0x14')](function(_0x40234d){logger[_0x150a('0x9')](_0x150a('0x26'),_0x2d6207,_0x40234d?util['inspect'](_0x40234d,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2d6207,_0x40234d?_0x150a('0x1d'):_0x150a('0x16'));return _0x439309(_0x40234d[_0x150a('0x11')][_0x150a('0x12')]?_0x40234d[_0x150a('0x11')][0x0]:null);})[_0x150a('0xc')](function(_0x4ca707){logger[_0x150a('0xa')]('[utils][getVoiceQueueByName]',_0x4ca707?util[_0x150a('0x8')](_0x4ca707,{'showHidden':![],'depth':null}):'');return _0x439309(null);});}return _0x439309(null);});};exports[_0x150a('0x27')]=function(_0x143082,_0x504047){return moment(_0x143082)[_0x150a('0x28')](_0x504047,'seconds')[_0x150a('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0xb4e801,_0x4170d6){return moment(_0xb4e801)[_0x150a('0x2a')](_0x4170d6,_0x150a('0x2b'))[_0x150a('0x29')](_0x150a('0x2c'));};exports[_0x150a('0x2d')]=function(_0x3fbcde,_0x5a6924){return moment(_0x3fbcde)[_0x150a('0x2e')](moment(_0x5a6924),_0x150a('0x2b'));};exports[_0x150a('0x2f')]=function(_0x5e2b90,_0x56bbe4){return parseInt(_0x5e2b90,0xa)+parseInt(_0x56bbe4,0xa);};exports['now']=function(){return moment()[_0x150a('0x29')](_0x150a('0x2c'));};exports[_0x150a('0x30')]=function(_0x55abed,_0x39831c){if(_0x39831c){return moment(_0x55abed)[_0x150a('0x30')](_0x39831c);}return!![];};exports[_0x150a('0x31')]=function(_0x2cdb2a,_0x2b58db){if(_0x2b58db){return moment(_0x2cdb2a)['isBefore'](_0x2b58db);}else if(_0x2cdb2a){return!![];}return![];}; \ No newline at end of file +var _0x2b1b=['add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','info','debug','error','inspect','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b1b,0x11f));var _0xb2b1=function(_0x4221db,_0x522c82){_0x4221db=_0x4221db-0x0;var _0x9dbee2=_0x2b1b[_0x4221db];return _0x9dbee2;};'use strict';var BPromise=require(_0xb2b1('0x0'));var jayson=require(_0xb2b1('0x1'));var moment=require(_0xb2b1('0x2'));var util=require('util');var client=jayson[_0xb2b1('0x3')][_0xb2b1('0x4')]({'port':0x2329});var logger=require(_0xb2b1('0x5'))('xdr');exports['info']=function(_0x285c84,_0x24bdf1){logger[_0xb2b1('0x6')](_0x285c84,_0x24bdf1?util['inspect'](_0x24bdf1,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x172f19,_0x38a68e){logger[_0xb2b1('0x7')](_0x172f19,_0x38a68e?util['inspect'](_0x38a68e,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xaba099,_0x44454e){logger[_0xb2b1('0x8')](_0xaba099,_0x44454e?util[_0xb2b1('0x9')](_0x44454e,{'showHidden':![],'depth':null}):'');};exports[_0xb2b1('0xa')]=function(_0xfec2d3,_0x3aaa5a){return client[_0xb2b1('0xa')](_0xfec2d3,{'body':_0x3aaa5a})[_0xb2b1('0xb')](function(_0x4cff2f){logger[_0xb2b1('0x7')]('[utils][request]\x20name:%s',_0xfec2d3,_0x4cff2f?util[_0xb2b1('0x9')](_0x4cff2f,{'showHidden':![],'depth':null}):'');})[_0xb2b1('0xc')](function(_0x211788){logger[_0xb2b1('0x8')](_0xb2b1('0xd'),_0xfec2d3,_0x211788?util[_0xb2b1('0x9')](_0x211788,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1c5181){return client[_0xb2b1('0xa')](_0xb2b1('0xe'),{'options':{'raw':!![],'attributes':['id',_0xb2b1('0xf'),_0xb2b1('0x10'),'interface'],'where':_0x1c5181,'limit':0x1}})[_0xb2b1('0xb')](function(_0x5db0f3){logger[_0xb2b1('0x7')](_0xb2b1('0x11'),JSON[_0xb2b1('0x12')](_0x1c5181),_0x5db0f3?util['inspect'](_0x5db0f3,{'showHidden':![],'depth':null}):'');return _0x5db0f3[_0xb2b1('0x13')][_0xb2b1('0x14')]?_0x5db0f3['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x3c7f93){return new BPromise(function(_0x19561c,_0x152cf9){if(_0x3c7f93){return getUser({'internal':_0x3c7f93})['then'](function(_0x1911ae){logger[_0xb2b1('0x6')](_0xb2b1('0x15'),_0x3c7f93,_0x1911ae?'found':_0xb2b1('0x16'));return _0x19561c(_0x1911ae);})[_0xb2b1('0xc')](function(_0x2c84ba){logger[_0xb2b1('0x8')](_0xb2b1('0x17'),_0x2c84ba?util[_0xb2b1('0x9')](_0x2c84ba,{'showHidden':![],'depth':null}):'');return _0x19561c(null);});}return _0x19561c(null);});};exports['getUserByInterface']=function(_0x858550){return new BPromise(function(_0x55d3b3,_0x339d5b){if(_0x858550){return getUser({'interface':_0x858550})[_0xb2b1('0xb')](function(_0x4d0efb){logger[_0xb2b1('0x6')](_0xb2b1('0x18'),_0x858550,_0x4d0efb?_0xb2b1('0x19'):_0xb2b1('0x16'));return _0x55d3b3(_0x4d0efb);})[_0xb2b1('0xc')](function(_0x4bbd80){logger[_0xb2b1('0x8')](_0xb2b1('0x1a'),_0x4bbd80?util[_0xb2b1('0x9')](_0x4bbd80,{'showHidden':![],'depth':null}):'');return _0x55d3b3(null);});}return _0x55d3b3(null);});};exports['getUserByName']=function(_0x21a625){return new BPromise(function(_0x52c959,_0x4d239b){if(_0x21a625){return getUser({'name':_0x21a625})['then'](function(_0x45b967){logger[_0xb2b1('0x6')](_0xb2b1('0x1b'),_0x21a625,_0x45b967?_0xb2b1('0x19'):_0xb2b1('0x16'));return _0x52c959(_0x45b967);})['catch'](function(_0x540750){logger['error'](_0xb2b1('0x1c'),_0x540750?util[_0xb2b1('0x9')](_0x540750,{'showHidden':![],'depth':null}):'');return _0x52c959(null);});}return _0x52c959(null);});};exports[_0xb2b1('0x1d')]=function(_0x201d17){return new BPromise(function(_0x294af8,_0x25a6af){if(_0x201d17){return client[_0xb2b1('0xa')](_0xb2b1('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xb2b1('0x10'),_0xb2b1('0x1f'),_0xb2b1('0x20'),'acwTimeout'],'where':{'name':_0x201d17},'limit':0x1}})[_0xb2b1('0xb')](function(_0x3a661f){logger[_0xb2b1('0x7')](_0xb2b1('0x21'),_0x201d17,_0x3a661f?util[_0xb2b1('0x9')](_0x3a661f,{'showHidden':![],'depth':null}):'');logger[_0xb2b1('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x201d17,_0x3a661f?_0xb2b1('0x19'):_0xb2b1('0x16'));return _0x294af8(_0x3a661f['result'][_0xb2b1('0x14')]?_0x3a661f[_0xb2b1('0x13')][0x0]:null);})[_0xb2b1('0xc')](function(_0x55681c){logger[_0xb2b1('0x8')](_0xb2b1('0x22'),_0x55681c?util[_0xb2b1('0x9')](_0x55681c,{'showHidden':![],'depth':null}):'');return _0x294af8(null);});}return _0x294af8(null);});};exports['addTime']=function(_0x58fd62,_0x5da4cd){return moment(_0x58fd62)[_0xb2b1('0x23')](_0x5da4cd,_0xb2b1('0x24'))[_0xb2b1('0x25')](_0xb2b1('0x26'));};exports[_0xb2b1('0x27')]=function(_0x34c108,_0x56e387){return moment(_0x34c108)['subtract'](_0x56e387,_0xb2b1('0x24'))[_0xb2b1('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xb2b1('0x28')]=function(_0x1f6cd3,_0x14d1d0){return moment(_0x1f6cd3)[_0xb2b1('0x29')](moment(_0x14d1d0),_0xb2b1('0x24'));};exports[_0xb2b1('0x2a')]=function(_0x40b02d,_0x596575){return parseInt(_0x40b02d,0xa)+parseInt(_0x596575,0xa);};exports[_0xb2b1('0x2b')]=function(){return moment()['format'](_0xb2b1('0x26'));};exports[_0xb2b1('0x2c')]=function(_0x2c6ba3,_0x5d4474){if(_0x5d4474){return moment(_0x2c6ba3)['isAfter'](_0x5d4474);}return!![];};exports[_0xb2b1('0x2d')]=function(_0x1f5dc3,_0xd1fa6d){if(_0xd1fa6d){return moment(_0x1f5dc3)[_0xb2b1('0x2d')](_0xd1fa6d);}else if(_0x1f5dc3){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 d149b99..3e22333 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 _0xd9a8=['body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','statusCode','agent_name','test','setupLoggers','fs-extra','lodash','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','log','xcally','join','client','role','name','ensureDir','catch','user','no-user','data','api','auth','client-side-logger','use','logger','isEmpty'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xd9a8,0x13f));var _0x8d9a=function(_0x1ff58e,_0x59883f){_0x1ff58e=_0x1ff58e-0x0;var _0x365452=_0xd9a8[_0x1ff58e];return _0x365452;};var fs=require(_0x8d9a('0x0'));var _=require(_0x8d9a('0x1'));var ewinston=require('express-winston');var path=require(_0x8d9a('0x2'));var util=require(_0x8d9a('0x3'));var fileLogger=require('./loggers')[_0x8d9a('0x4')];var safeTemplate=require('./safe-template')[_0x8d9a('0x5')];var maskSensitiveData=require(_0x8d9a('0x6'))[_0x8d9a('0x7')];function ClientSideLogger(){function _0xdecaf7(_0x4fa0c3){var _0xfcc0cd=path['join']('/var',_0x8d9a('0x8'),_0x8d9a('0x9'));var _0x4b5bc8=path[_0x8d9a('0xa')](_0x8d9a('0xb'),_0x4fa0c3[_0x8d9a('0xc')]+'-'+_0x4fa0c3[_0x8d9a('0xd')]);return fs[_0x8d9a('0xe')](path[_0x8d9a('0xa')](_0xfcc0cd,_0x4b5bc8))['then'](function(){var _0x34e58e=fileLogger(_0x8d9a('0xb'),path['join'](_0xfcc0cd,_0x4b5bc8));return _0x34e58e;})[_0x8d9a('0xf')](function(_0x5e4ca8){throw _0x5e4ca8;});}this[_0x8d9a('0x8')]=function(_0xce9e57,_0x498848,_0x4fe7ae,_0x5a49e5){return _0xdecaf7(_0xce9e57[_0x8d9a('0x10')])['then'](function(_0x306e7a){var _0x3e917f=_0x306e7a[_0x498848];return _0x3e917f;})['then'](function(_0x1c9d3a){var _0x5dfbc5=_0xce9e57[_0x8d9a('0x10')]?_0xce9e57[_0x8d9a('0x10')]['id']:_0x8d9a('0x11');var _0x3dbf70=_0x5a49e5[_0x8d9a('0x12')];var _0x502260=_0x5a49e5['timestamp'];var _0x139409=new Date(Number(_0x502260));return _0x1c9d3a(_0x5dfbc5,_0x139409,_0x4fe7ae,_0x3dbf70);})[_0x8d9a('0xf')](function(_0x5a1415){fileLogger(_0x8d9a('0xb'))['error'](_0x5a1415);});};}function setupLoggers(_0xc8859f){return new Promise(function(_0x4b95b1){var _0x5f3476=new ClientSideLogger();var _0x39f53f=fileLogger(_0x8d9a('0x13'));var _0x374cc7=fileLogger(_0x8d9a('0x14'));_0xc8859f['set'](_0x8d9a('0x15'),_0x5f3476);_0xc8859f[_0x8d9a('0x16')](ewinston[_0x8d9a('0x17')]({'winstonInstance':_0x39f53f,'meta':![],'statusLevels':!![],'msg':function(_0x511ede,_0x4337b5){var _0x20dbdc='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x8d9a('0x18')](_0x511ede[_0x8d9a('0x19')])){_0x20dbdc+=_0x8d9a('0x1a');var _0x518fc4=_0x511ede[_0x8d9a('0x19')];maskSensitiveData(_0x518fc4);}return safeTemplate(util[_0x8d9a('0x1b')](_0x20dbdc,_0x511ede[_0x8d9a('0x1c')],_0x511ede[_0x8d9a('0x1d')][_0x8d9a('0x1e')]?_0x511ede['headers'][_0x8d9a('0x1e')]:_0x511ede['connection'][_0x8d9a('0x1f')]||_0x511ede['ip'],_0x511ede[_0x8d9a('0x20')],_0x4337b5['statusCode'],_0x4337b5['responseTime'],_0x511ede[_0x8d9a('0x10')]?_0x511ede[_0x8d9a('0x10')]['id']:null,_0x511ede[_0x8d9a('0x10')]?_0x511ede[_0x8d9a('0x10')]['name']:null,_0x511ede[_0x8d9a('0x10')]?_0x511ede[_0x8d9a('0x10')][_0x8d9a('0xc')]:null,_0x518fc4?util[_0x8d9a('0x21')](_0x518fc4,![],null):''));}}));_0xc8859f[_0x8d9a('0x16')](ewinston[_0x8d9a('0x17')]({'winstonInstance':_0x374cc7,'meta':![],'statusLevels':!![],'msg':function(_0xe31ba6,_0x4eda1c){var _0x4ef136=_0x8d9a('0x22');if(_0xe31ba6[_0x8d9a('0x19')]&&_0xe31ba6[_0x8d9a('0x19')][_0x8d9a('0x23')]&&_0xe31ba6[_0x8d9a('0x19')][_0x8d9a('0x24')]){_0x4ef136=_0x8d9a('0x25');}return util['format'](_0x4ef136,_0xe31ba6[_0x8d9a('0x1c')],_0xe31ba6[_0x8d9a('0x1d')][_0x8d9a('0x1e')]?_0xe31ba6[_0x8d9a('0x1d')][_0x8d9a('0x1e')]:_0xe31ba6[_0x8d9a('0x26')]['remoteAddress']||_0xe31ba6['ip'],_0xe31ba6[_0x8d9a('0x20')],_0x4eda1c[_0x8d9a('0x27')],_0x4eda1c['responseTime'],_0xe31ba6[_0x8d9a('0x10')]?_0xe31ba6[_0x8d9a('0x10')]['id']:null,_0xe31ba6[_0x8d9a('0x10')]?_0xe31ba6[_0x8d9a('0x10')]['name']:null,_0xe31ba6[_0x8d9a('0x10')]?_0xe31ba6[_0x8d9a('0x10')][_0x8d9a('0xc')]:null,_0xe31ba6[_0x8d9a('0x19')]&&_0xe31ba6[_0x8d9a('0x19')]['device']?_0xe31ba6[_0x8d9a('0x19')][_0x8d9a('0x23')]:'other',_0xe31ba6[_0x8d9a('0x19')]&&_0xe31ba6[_0x8d9a('0x19')][_0x8d9a('0x24')]?_0xe31ba6[_0x8d9a('0x19')][_0x8d9a('0x24')]:'',_0xe31ba6[_0x8d9a('0x19')]&&_0xe31ba6[_0x8d9a('0x19')][_0x8d9a('0x28')]?_0xe31ba6[_0x8d9a('0x19')][_0x8d9a('0x28')]:'');},'ignoreRoute':function(_0xa45d15){var _0xe59648=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xe59648[_0x8d9a('0x29')](_0xa45d15[_0x8d9a('0x20')]);}}));return _0x4b95b1();});}exports[_0x8d9a('0x2a')]=setupLoggers; \ No newline at end of file +var _0xec9c=['statusCode','responseTime','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','name','ensureDir','catch','user','then','no-user','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url'];(function(_0x2e83d1,_0x34b1fe){var _0x5a6545=function(_0x1bc43d){while(--_0x1bc43d){_0x2e83d1['push'](_0x2e83d1['shift']());}};_0x5a6545(++_0x34b1fe);}(_0xec9c,0x194));var _0xcec9=function(_0x45dbea,_0x5c1e3b){_0x45dbea=_0x45dbea-0x0;var _0x164c9e=_0xec9c[_0x45dbea];return _0x164c9e;};var fs=require(_0xcec9('0x0'));var _=require(_0xcec9('0x1'));var ewinston=require(_0xcec9('0x2'));var path=require(_0xcec9('0x3'));var util=require('util');var fileLogger=require(_0xcec9('0x4'))[_0xcec9('0x5')];var safeTemplate=require(_0xcec9('0x6'))[_0xcec9('0x7')];var maskSensitiveData=require(_0xcec9('0x8'))[_0xcec9('0x9')];function ClientSideLogger(){function _0x238d07(_0x3db4b9){var _0x55f350=path[_0xcec9('0xa')]('/var',_0xcec9('0xb'),_0xcec9('0xc'));var _0x2b5dd0=path[_0xcec9('0xa')](_0xcec9('0xd'),_0x3db4b9['role']+'-'+_0x3db4b9[_0xcec9('0xe')]);return fs[_0xcec9('0xf')](path[_0xcec9('0xa')](_0x55f350,_0x2b5dd0))['then'](function(){var _0x506b49=fileLogger(_0xcec9('0xd'),path[_0xcec9('0xa')](_0x55f350,_0x2b5dd0));return _0x506b49;})[_0xcec9('0x10')](function(_0x1883a8){throw _0x1883a8;});}this['log']=function(_0x1ba235,_0x5238ce,_0x557ee3,_0x1d5db1){return _0x238d07(_0x1ba235[_0xcec9('0x11')])[_0xcec9('0x12')](function(_0xde06a){var _0x2897c7=_0xde06a[_0x5238ce];return _0x2897c7;})[_0xcec9('0x12')](function(_0x5c1a40){var _0xa51b55=_0x1ba235['user']?_0x1ba235[_0xcec9('0x11')]['id']:_0xcec9('0x13');var _0x4a9154=_0x1d5db1['data'];var _0x2a63a0=_0x1d5db1['timestamp'];var _0x4e6e3a=new Date(Number(_0x2a63a0));return _0x5c1a40(_0xa51b55,_0x4e6e3a,_0x557ee3,_0x4a9154);})[_0xcec9('0x10')](function(_0x49556d){fileLogger(_0xcec9('0xd'))[_0xcec9('0x14')](_0x49556d);});};}function setupLoggers(_0x12f29a){return new Promise(function(_0x2d1b1a){var _0x5d392a=new ClientSideLogger();var _0x440f9e=fileLogger(_0xcec9('0x15'));var _0x27b545=fileLogger(_0xcec9('0x16'));_0x12f29a[_0xcec9('0x17')](_0xcec9('0x18'),_0x5d392a);_0x12f29a[_0xcec9('0x19')](ewinston['logger']({'winstonInstance':_0x440f9e,'meta':![],'statusLevels':!![],'msg':function(_0x2fa322,_0xfef392){var _0x669408=_0xcec9('0x1a');if(!_[_0xcec9('0x1b')](_0x2fa322[_0xcec9('0x1c')])){_0x669408+=_0xcec9('0x1d');var _0x5e160d=_0x2fa322[_0xcec9('0x1c')];maskSensitiveData(_0x5e160d);}return safeTemplate(util[_0xcec9('0x1e')](_0x669408,_0x2fa322[_0xcec9('0x1f')],_0x2fa322[_0xcec9('0x20')][_0xcec9('0x21')]?_0x2fa322[_0xcec9('0x20')][_0xcec9('0x21')]:_0x2fa322[_0xcec9('0x22')][_0xcec9('0x23')]||_0x2fa322['ip'],_0x2fa322[_0xcec9('0x24')],_0xfef392[_0xcec9('0x25')],_0xfef392[_0xcec9('0x26')],_0x2fa322[_0xcec9('0x11')]?_0x2fa322[_0xcec9('0x11')]['id']:null,_0x2fa322[_0xcec9('0x11')]?_0x2fa322['user'][_0xcec9('0xe')]:null,_0x2fa322[_0xcec9('0x11')]?_0x2fa322[_0xcec9('0x11')][_0xcec9('0x27')]:null,_0x5e160d?util['inspect'](_0x5e160d,![],null):''));}}));_0x12f29a[_0xcec9('0x19')](ewinston[_0xcec9('0x28')]({'winstonInstance':_0x27b545,'meta':![],'statusLevels':!![],'msg':function(_0x351326,_0x17b7a7){var _0x2c259f=_0xcec9('0x29');if(_0x351326['body']&&_0x351326[_0xcec9('0x1c')][_0xcec9('0x2a')]&&_0x351326[_0xcec9('0x1c')][_0xcec9('0x2b')]){_0x2c259f=_0xcec9('0x2c');}return util[_0xcec9('0x1e')](_0x2c259f,_0x351326[_0xcec9('0x1f')],_0x351326[_0xcec9('0x20')][_0xcec9('0x21')]?_0x351326[_0xcec9('0x20')]['x-forwarded-for']:_0x351326[_0xcec9('0x22')][_0xcec9('0x23')]||_0x351326['ip'],_0x351326[_0xcec9('0x24')],_0x17b7a7[_0xcec9('0x25')],_0x17b7a7[_0xcec9('0x26')],_0x351326[_0xcec9('0x11')]?_0x351326[_0xcec9('0x11')]['id']:null,_0x351326[_0xcec9('0x11')]?_0x351326[_0xcec9('0x11')]['name']:null,_0x351326[_0xcec9('0x11')]?_0x351326['user'][_0xcec9('0x27')]:null,_0x351326[_0xcec9('0x1c')]&&_0x351326[_0xcec9('0x1c')][_0xcec9('0x2a')]?_0x351326[_0xcec9('0x1c')][_0xcec9('0x2a')]:_0xcec9('0x2d'),_0x351326[_0xcec9('0x1c')]&&_0x351326[_0xcec9('0x1c')]['agent_id']?_0x351326[_0xcec9('0x1c')][_0xcec9('0x2b')]:'',_0x351326['body']&&_0x351326[_0xcec9('0x1c')][_0xcec9('0x2e')]?_0x351326['body']['agent_name']:'');},'ignoreRoute':function(_0x74ba82){var _0xba68f7=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xba68f7[_0xcec9('0x2f')](_0x74ba82[_0xcec9('0x24')]);}}));return _0x2d1b1a();});}exports[_0xcec9('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index ea33c7c..f120228 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3749=['map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf','slice','exports','circularDoWInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','dowCompare','daysInMonth','min','max','MMM','includes','monthCompare','guess','length','iftime','lodash'];(function(_0xe6095b,_0x17857d){var _0x106b8b=function(_0x1e0781){while(--_0x1e0781){_0xe6095b['push'](_0xe6095b['shift']());}};_0x106b8b(++_0x17857d);}(_0x3749,0xcb));var _0x9374=function(_0x4982a5,_0xad13ed){_0x4982a5=_0x4982a5-0x0;var _0x26f5ff=_0x3749[_0x4982a5];return _0x26f5ff;};var _=require(_0x9374('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9374('0x1')](function(_0x11e828){return _0x11e828[_0x9374('0x2')];})[_0x9374('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9374('0x4');var EINVALID_DATE=_0x9374('0x5');function throwIfDateNotValid(_0x54df9d){if(!_0x54df9d[_0x9374('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x31fbe9){var _0x2b1627=_0x31fbe9[_0x9374('0x7')](':')[_0x9374('0x1')](function(_0x6cf1fc){return parseInt(_0x6cf1fc,0xa);});var _0x302713=_0x2b1627[0x0];var _0x1ec4a7=_0x2b1627[0x1];if(_0x302713<0x0||_0x302713>0x17||_0x1ec4a7<0x0||_0x1ec4a7>0x3b){throw new Error(EINVALID_DATE);}return[_0x302713,_0x1ec4a7];}function circularDoWInterval(_0x5c11cc,_0x12dfb5){if(_0x5c11cc===_0x12dfb5){return[_0x5c11cc];}else{var _0xd0d62e=moment['locale']();moment[_0x9374('0x8')]('en');var _0x166990=moment['weekdaysShort']()['map'](function(_0x505d73){return _0x505d73[_0x9374('0x9')]();});moment[_0x9374('0x8')](_0xd0d62e);var _0x297c75=_0x166990[_0x9374('0xa')](_0x5c11cc);var _0x2e0d08=_0x166990['indexOf'](_0x12dfb5);if(_0x2e0d08>_0x297c75){return _0x166990['slice'](_0x297c75,_0x2e0d08+0x1);}else{var _0x28b273=_0x166990['slice'](0x0,_0x2e0d08+0x1);var _0x46de02=_0x166990[_0x9374('0xb')](_0x297c75);return _0x46de02['concat'](_0x28b273);}}}module[_0x9374('0xc')][_0x9374('0xd')]=circularDoWInterval;function circularMonthInterval(_0x7cf7a9,_0x1dad8e){if(_0x7cf7a9===_0x1dad8e){return[_0x7cf7a9];}else{var _0x3aa754=moment[_0x9374('0x8')]();moment['locale']('en');var _0x5e963d=moment['monthsShort']()['map'](function(_0x4ebdf3){return _0x4ebdf3[_0x9374('0x9')]();});moment[_0x9374('0x8')](_0x3aa754);var _0x28b84d=_0x5e963d['indexOf'](_0x7cf7a9);var _0x47bd14=_0x5e963d[_0x9374('0xa')](_0x1dad8e);if(_0x47bd14>_0x28b84d){return _0x5e963d[_0x9374('0xb')](_0x28b84d,_0x47bd14+0x1);}else{var _0x3645af=_0x5e963d[_0x9374('0xb')](0x0,_0x47bd14+0x1);var _0x3cbb79=_0x5e963d[_0x9374('0xb')](_0x28b84d);return _0x3cbb79['concat'](_0x3645af);}}}module[_0x9374('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x1f3d5c){var _0x32defc=parseInt(_0x1f3d5c,0xa);if(_0x32defc<0x1||_0x32defc>0x1f){throw new Error(EINVALID_DATE);}return _0x32defc;}function timeCompare(_0x310814,_0x39e085,_0x47fb66){var _0x6f961f=_0x310814[_0x9374('0xe')]();var _0x5f2ba6=extractTime(_0x39e085);var _0x2f8373=_0x5f2ba6[0x0];var _0x32eaf6=_0x5f2ba6[0x1];var _0x2e3b20=_0x310814[_0x9374('0xe')]()[_0x9374('0xf')](_0x2f8373)['minutes'](_0x32eaf6);throwIfDateNotValid(_0x2e3b20);var _0x27e5cd=extractTime(_0x47fb66);var _0x5e4af7=_0x27e5cd[0x0];var _0xca9a08=_0x27e5cd[0x1];var _0x3e6276=_0x310814[_0x9374('0xe')]()[_0x9374('0xf')](_0x5e4af7)[_0x9374('0x10')](_0xca9a08);throwIfDateNotValid(_0x3e6276);if(_0x3e6276[_0x9374('0x11')](_0x2e3b20)){var _0x42b0a9=_0x6f961f[_0x9374('0xe')]()[_0x9374('0x12')](_0x9374('0x13'));var _0x495182=_0x6f961f['clone']()['endOf'](_0x9374('0x13'));return _0x6f961f[_0x9374('0x14')](_0x2e3b20,_0x495182,undefined,'[]')||_0x6f961f[_0x9374('0x14')](_0x42b0a9,_0x3e6276,undefined,'[]');}else{return _0x6f961f[_0x9374('0x14')](_0x2e3b20,_0x3e6276,undefined,'[]');}}module['exports'][_0x9374('0x15')]=timeCompare;function dowCompare(_0x14d74f,_0x2ec0d0,_0x5584bd){var _0x262838=_0x14d74f[_0x9374('0x8')]('en')[_0x9374('0x16')](_0x9374('0x17'))[_0x9374('0x9')]();return circularDoWInterval(_0x2ec0d0,_0x5584bd)['includes'](_0x262838);}module['exports'][_0x9374('0x18')]=dowCompare;function domCompare(_0x5acd0f,_0x2dae05,_0x1ff56b){var _0x23cb7f=_0x5acd0f['date']();if(_0x2dae05===_0x1ff56b){return _0x23cb7f===_0x2dae05;}else{var _0x1195c4=_0x5acd0f[_0x9374('0x19')]();var _0x523060=_0x2dae05<_0x1ff56b;let _0x52e320=![];var _0x26e7d2=0x0;var _0xe1c7b2=0x0;if(_0x523060){_0x26e7d2=Math['max'](0x1,_0x2dae05);_0xe1c7b2=Math[_0x9374('0x1a')](_0x1ff56b,_0x1195c4);_0x52e320=_0x23cb7f>=_0x26e7d2&&_0x23cb7f<=_0xe1c7b2;}else{_0x26e7d2=Math[_0x9374('0x1a')](_0x2dae05,_0x1195c4);_0xe1c7b2=Math[_0x9374('0x1b')](0x1,_0x1ff56b);_0x52e320=_0x23cb7f>=_0x26e7d2||_0x23cb7f<=_0xe1c7b2;}return _0x52e320;}}module[_0x9374('0xc')]['domCompare']=domCompare;function monthCompare(_0x5ec56b,_0x2a94d3,_0x47728a){var _0xbc1824=_0x5ec56b[_0x9374('0x8')]('en')[_0x9374('0x16')](_0x9374('0x1c'))[_0x9374('0x9')]();return circularMonthInterval(_0x2a94d3,_0x47728a)[_0x9374('0x1d')](_0xbc1824);}module[_0x9374('0xc')][_0x9374('0x1e')]=monthCompare;function iftime(_0x2c5e33,_0x4bbe68=moment['tz'][_0x9374('0x1f')](),_0x422596=moment()){if(!validateRx['test'](_0x2c5e33)){throw new Error(EINVALID_STRING);}else{var _0x2a72ba=(moment['isMoment'](_0x422596)?_0x422596[_0x9374('0xe')]():moment(_0x422596))['tz'](_0x4bbe68)['locale']('en');throwIfDateNotValid(_0x2a72ba);var _0x5ce68e=_0x2c5e33['split'](',');var _0x1bb12b=_0x5ce68e[0x0];var _0x274337=_0x5ce68e[0x1];var _0x2e420d=_0x5ce68e[0x2];var _0x42a86b=_0x5ce68e[0x3];let _0x3d61d1=!![];if(_0x1bb12b!=='*'){var _0x4ea9fb=_0x1bb12b[_0x9374('0x7')]('-');var _0x2f4e4f=_['padStart'](_0x4ea9fb[0x0],0x5,'0');var _0x51925e=_0x4ea9fb[_0x9374('0x20')]===0x2?_['padStart'](_0x4ea9fb[0x1],0x5,'0'):_0x2f4e4f;_0x3d61d1=timeCompare(_0x2a72ba,_0x2f4e4f,_0x51925e);}let _0x3a3ce9=!![];if(_0x274337!=='*'){var _0x5e6170=_0x274337[_0x9374('0x7')]('-');var _0x5aa58b=_0x5e6170[0x0];var _0x1204ad=_0x5e6170[_0x9374('0x20')]===0x2?_0x5e6170[0x1]:_0x5aa58b;_0x3a3ce9=dowCompare(_0x2a72ba,_0x5aa58b,_0x1204ad);}let _0x25a0ad=!![];if(_0x2e420d!=='*'){var _0x4c1615=_0x2e420d[_0x9374('0x7')]('-');var _0x196f66=parseDom(_0x4c1615[0x0]);var _0x394fb7=_0x4c1615[_0x9374('0x20')]===0x2?parseDom(_0x4c1615[0x1]):_0x196f66;_0x25a0ad=domCompare(_0x2a72ba,_0x196f66,_0x394fb7);}let _0x1fffde=!![];if(_0x42a86b!=='*'){var _0x26f6cf=_0x42a86b[_0x9374('0x7')]('-');var _0x3b67f7=_0x26f6cf[0x0];var _0xbc3d6e=_0x26f6cf[_0x9374('0x20')]===0x2?_0x26f6cf[0x1]:_0x26f6cf[0x0];_0x1fffde=monthCompare(_0x2a72ba,_0x3b67f7,_0xbc3d6e);}return _0x3d61d1&&_0x3a3ce9&&_0x25a0ad&&_0x1fffde;}}module['exports'][_0x9374('0x21')]=iftime; \ No newline at end of file +var _0x2c39=['daysInMonth','max','min','domCompare','MMM','test','split','length','padStart','iftime','moment-timezone','map','source','join','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','minutes','hours','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date'];(function(_0x4bee61,_0x533f64){var _0x158b49=function(_0x58b05a){while(--_0x58b05a){_0x4bee61['push'](_0x4bee61['shift']());}};_0x158b49(++_0x533f64);}(_0x2c39,0x132));var _0x92c3=function(_0x34f46d,_0x1d6712){_0x34f46d=_0x34f46d-0x0;var _0x3a2d9e=_0x2c39[_0x34f46d];return _0x3a2d9e;};var _=require('lodash');var moment=require(_0x92c3('0x0'));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][_0x92c3('0x1')](function(_0x43d633){return _0x43d633[_0x92c3('0x2')];})[_0x92c3('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x5aaae8){if(!_0x5aaae8['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4027e1){var _0x4d2d96=_0x4027e1['split'](':')[_0x92c3('0x1')](function(_0x387397){return parseInt(_0x387397,0xa);});var _0x4d5856=_0x4d2d96[0x0];var _0x2bf015=_0x4d2d96[0x1];if(_0x4d5856<0x0||_0x4d5856>0x17||_0x2bf015<0x0||_0x2bf015>0x3b){throw new Error(EINVALID_DATE);}return[_0x4d5856,_0x2bf015];}function circularDoWInterval(_0x4288ea,_0x438fba){if(_0x4288ea===_0x438fba){return[_0x4288ea];}else{var _0x2ad79f=moment[_0x92c3('0x4')]();moment[_0x92c3('0x4')]('en');var _0x1ed92e=moment[_0x92c3('0x5')]()['map'](function(_0x1a26a7){return _0x1a26a7[_0x92c3('0x6')]();});moment[_0x92c3('0x4')](_0x2ad79f);var _0x3b4fe9=_0x1ed92e['indexOf'](_0x4288ea);var _0x452950=_0x1ed92e[_0x92c3('0x7')](_0x438fba);if(_0x452950>_0x3b4fe9){return _0x1ed92e[_0x92c3('0x8')](_0x3b4fe9,_0x452950+0x1);}else{var _0x94212f=_0x1ed92e[_0x92c3('0x8')](0x0,_0x452950+0x1);var _0x3efc38=_0x1ed92e['slice'](_0x3b4fe9);return _0x3efc38[_0x92c3('0x9')](_0x94212f);}}}module[_0x92c3('0xa')][_0x92c3('0xb')]=circularDoWInterval;function circularMonthInterval(_0x1e2b9f,_0x1fa0c2){if(_0x1e2b9f===_0x1fa0c2){return[_0x1e2b9f];}else{var _0x40466c=moment[_0x92c3('0x4')]();moment[_0x92c3('0x4')]('en');var _0x3fae68=moment['monthsShort']()[_0x92c3('0x1')](function(_0xce5792){return _0xce5792[_0x92c3('0x6')]();});moment[_0x92c3('0x4')](_0x40466c);var _0x4c4221=_0x3fae68[_0x92c3('0x7')](_0x1e2b9f);var _0x360f26=_0x3fae68[_0x92c3('0x7')](_0x1fa0c2);if(_0x360f26>_0x4c4221){return _0x3fae68[_0x92c3('0x8')](_0x4c4221,_0x360f26+0x1);}else{var _0x1a5f90=_0x3fae68['slice'](0x0,_0x360f26+0x1);var _0x358ffd=_0x3fae68['slice'](_0x4c4221);return _0x358ffd[_0x92c3('0x9')](_0x1a5f90);}}}module[_0x92c3('0xa')][_0x92c3('0xc')]=circularMonthInterval;function parseDom(_0x3bed12){var _0x3433fe=parseInt(_0x3bed12,0xa);if(_0x3433fe<0x1||_0x3433fe>0x1f){throw new Error(EINVALID_DATE);}return _0x3433fe;}function timeCompare(_0x3fa260,_0x34c9a9,_0x2622a2){var _0x4b0248=_0x3fa260[_0x92c3('0xd')]();var _0x37e5fd=extractTime(_0x34c9a9);var _0x1d7d18=_0x37e5fd[0x0];var _0x3f6954=_0x37e5fd[0x1];var _0x133b6f=_0x3fa260['clone']()['hours'](_0x1d7d18)[_0x92c3('0xe')](_0x3f6954);throwIfDateNotValid(_0x133b6f);var _0x351437=extractTime(_0x2622a2);var _0x4c5697=_0x351437[0x0];var _0x1892f1=_0x351437[0x1];var _0x1fc123=_0x3fa260[_0x92c3('0xd')]()[_0x92c3('0xf')](_0x4c5697)[_0x92c3('0xe')](_0x1892f1);throwIfDateNotValid(_0x1fc123);if(_0x1fc123[_0x92c3('0x10')](_0x133b6f)){var _0x350600=_0x4b0248[_0x92c3('0xd')]()[_0x92c3('0x11')]('day');var _0x21f067=_0x4b0248[_0x92c3('0xd')]()[_0x92c3('0x12')](_0x92c3('0x13'));return _0x4b0248[_0x92c3('0x14')](_0x133b6f,_0x21f067,undefined,'[]')||_0x4b0248[_0x92c3('0x14')](_0x350600,_0x1fc123,undefined,'[]');}else{return _0x4b0248[_0x92c3('0x14')](_0x133b6f,_0x1fc123,undefined,'[]');}}module[_0x92c3('0xa')][_0x92c3('0x15')]=timeCompare;function dowCompare(_0x425458,_0x200999,_0x356b3b){var _0x5189df=_0x425458['locale']('en')[_0x92c3('0x16')](_0x92c3('0x17'))[_0x92c3('0x6')]();return circularDoWInterval(_0x200999,_0x356b3b)[_0x92c3('0x18')](_0x5189df);}module[_0x92c3('0xa')][_0x92c3('0x19')]=dowCompare;function domCompare(_0x2727dd,_0x56a7bc,_0x3d089){var _0x2b8ad3=_0x2727dd[_0x92c3('0x1a')]();if(_0x56a7bc===_0x3d089){return _0x2b8ad3===_0x56a7bc;}else{var _0x16ab65=_0x2727dd[_0x92c3('0x1b')]();var _0xb1d6e7=_0x56a7bc<_0x3d089;let _0x52cbef=![];var _0x11bdf7=0x0;var _0xa72a8=0x0;if(_0xb1d6e7){_0x11bdf7=Math[_0x92c3('0x1c')](0x1,_0x56a7bc);_0xa72a8=Math['min'](_0x3d089,_0x16ab65);_0x52cbef=_0x2b8ad3>=_0x11bdf7&&_0x2b8ad3<=_0xa72a8;}else{_0x11bdf7=Math[_0x92c3('0x1d')](_0x56a7bc,_0x16ab65);_0xa72a8=Math[_0x92c3('0x1c')](0x1,_0x3d089);_0x52cbef=_0x2b8ad3>=_0x11bdf7||_0x2b8ad3<=_0xa72a8;}return _0x52cbef;}}module[_0x92c3('0xa')][_0x92c3('0x1e')]=domCompare;function monthCompare(_0x2584ae,_0x50849b,_0xbc4824){var _0x3d84ea=_0x2584ae[_0x92c3('0x4')]('en')[_0x92c3('0x16')](_0x92c3('0x1f'))[_0x92c3('0x6')]();return circularMonthInterval(_0x50849b,_0xbc4824)[_0x92c3('0x18')](_0x3d84ea);}module[_0x92c3('0xa')]['monthCompare']=monthCompare;function iftime(_0x29bf49,_0xcdeafd=moment['tz']['guess'](),_0x5e6504=moment()){if(!validateRx[_0x92c3('0x20')](_0x29bf49)){throw new Error(EINVALID_STRING);}else{var _0x5478b7=(moment['isMoment'](_0x5e6504)?_0x5e6504[_0x92c3('0xd')]():moment(_0x5e6504))['tz'](_0xcdeafd)[_0x92c3('0x4')]('en');throwIfDateNotValid(_0x5478b7);var _0x167344=_0x29bf49['split'](',');var _0x38e862=_0x167344[0x0];var _0xeec55a=_0x167344[0x1];var _0x2692c4=_0x167344[0x2];var _0x27f30b=_0x167344[0x3];let _0x18c9c3=!![];if(_0x38e862!=='*'){var _0x376f5c=_0x38e862[_0x92c3('0x21')]('-');var _0x546e7f=_['padStart'](_0x376f5c[0x0],0x5,'0');var _0x5b65b9=_0x376f5c[_0x92c3('0x22')]===0x2?_[_0x92c3('0x23')](_0x376f5c[0x1],0x5,'0'):_0x546e7f;_0x18c9c3=timeCompare(_0x5478b7,_0x546e7f,_0x5b65b9);}let _0x3f08e4=!![];if(_0xeec55a!=='*'){var _0x5bb7e5=_0xeec55a[_0x92c3('0x21')]('-');var _0x113ddb=_0x5bb7e5[0x0];var _0x343f4e=_0x5bb7e5['length']===0x2?_0x5bb7e5[0x1]:_0x113ddb;_0x3f08e4=dowCompare(_0x5478b7,_0x113ddb,_0x343f4e);}let _0x9528bf=!![];if(_0x2692c4!=='*'){var _0x3c5e0d=_0x2692c4[_0x92c3('0x21')]('-');var _0x31930f=parseDom(_0x3c5e0d[0x0]);var _0x348383=_0x3c5e0d['length']===0x2?parseDom(_0x3c5e0d[0x1]):_0x31930f;_0x9528bf=domCompare(_0x5478b7,_0x31930f,_0x348383);}let _0x864bc8=!![];if(_0x27f30b!=='*'){var _0x1377f0=_0x27f30b[_0x92c3('0x21')]('-');var _0x471c26=_0x1377f0[0x0];var _0x36fb40=_0x1377f0[_0x92c3('0x22')]===0x2?_0x1377f0[0x1]:_0x1377f0[0x0];_0x864bc8=monthCompare(_0x5478b7,_0x471c26,_0x36fb40);}return _0x18c9c3&&_0x3f08e4&&_0x9528bf&&_0x864bc8;}}module[_0x92c3('0xa')][_0x92c3('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b2210bc..1918a7f 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee6f=['addColors','join','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','%s-%s','error','transports','Console','consoleLogger','path','util','moment','../config/environment','debugLevel','info','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan'];(function(_0x5c67e1,_0x377eb7){var _0x34459e=function(_0x4ad33e){while(--_0x4ad33e){_0x5c67e1['push'](_0x5c67e1['shift']());}};_0x34459e(++_0x377eb7);}(_0xee6f,0xc5));var _0xfee6=function(_0x1ba8b2,_0x42adf4){_0x1ba8b2=_0x1ba8b2-0x0;var _0x3b3f2c=_0xee6f[_0x1ba8b2];return _0x3b3f2c;};'use strict';var path=require(_0xfee6('0x0'));var util=require(_0xfee6('0x1'));var moment=require(_0xfee6('0x2'));var winston=require('winston');var config=require(_0xfee6('0x3'));var debugLevel=config[_0xfee6('0x4')]?config['debugLevel']['toLowerCase']():_0xfee6('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xfee6('0x6'),'warn':'bold\x20yellow','info':_0xfee6('0x7'),'print':_0xfee6('0x8'),'success':_0xfee6('0x9'),'http':_0xfee6('0xa'),'verbose':_0xfee6('0xb'),'debug':'bold\x20blue','silly':_0xfee6('0xc')};winston[_0xfee6('0xd')](XC_LOG_COLORS);function getLogFileName(_0x846500,_0xc119b8,_0x2ab834){var _0x3a0681=_0x846500||'/var/log/xcally';return path[_0xfee6('0xe')](_0x3a0681,util['format'](_0xfee6('0xf'),_0xc119b8,_0x2ab834));}function formatter(_0x5bdf53,_0x3d4c07){_0x3d4c07[_0xfee6('0x10')]=_0x3d4c07[_0xfee6('0x10')][_0xfee6('0x11')](/@@{/g,_0xfee6('0x12'))['replace'](/}@@/g,_0xfee6('0x13'))[_0xfee6('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xfee6('0x14')](_0xfee6('0x15'),moment()[_0xfee6('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3d4c07[_0xfee6('0x16')]['toUpperCase'](),_0x5bdf53,_0x3d4c07[_0xfee6('0x10')]);}function fileFormat(_0x58e1f5,_0x4d4b53){_0x4d4b53[_0xfee6('0x10')]=_0x4d4b53[_0xfee6('0x10')][_0xfee6('0x11')](/@@{/g,_0xfee6('0x12'))[_0xfee6('0x11')](/}@@/g,_0xfee6('0x13'))[_0xfee6('0x11')](/@{/g,'{{')[_0xfee6('0x11')](/}@/g,'}}');var _0x4ec51f=_0x4d4b53[_0xfee6('0x17')]&&Object[_0xfee6('0x18')](_0x4d4b53[_0xfee6('0x17')])[_0xfee6('0x19')]?'\x0a\x09'+JSON[_0xfee6('0x1a')](_0x4d4b53['meta']):'';return util[_0xfee6('0x14')](_0xfee6('0x1b'),moment()[_0xfee6('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4d4b53[_0xfee6('0x16')][_0xfee6('0x1c')](),_0x58e1f5,_0x4d4b53[_0xfee6('0x10')],_0x4ec51f);}function consoleLogger(){var _0x105fea=new winston[(_0xfee6('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x303b4a){return formatter('',_0x303b4a);}})]});return _0x105fea;}function fileLogger(_0x400bd7,_0x46eee8){var _0x4509aa=new winston[(_0xfee6('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util['format'](_0xfee6('0x1e'),_0x400bd7,'error'),'filename':getLogFileName(_0x46eee8,_0x400bd7,_0xfee6('0x1f')),'level':_0xfee6('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a3ff8){return fileFormat(_0x400bd7,_0x5a3ff8);}}),new winston[(_0xfee6('0x20'))]['File']({'name':util[_0xfee6('0x14')](_0xfee6('0x1e'),_0x400bd7,debugLevel),'filename':getLogFileName(_0x46eee8,_0x400bd7,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f7121){return fileFormat(_0x400bd7,_0x4f7121);}}),new winston[(_0xfee6('0x20'))][(_0xfee6('0x21'))]({'level':'warn','json':![],'formatter':function(_0x4609a3){return fileFormat(_0x400bd7,_0x4609a3);}})]});return _0x4509aa;}exports[_0xfee6('0x22')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x4c0c=['winston','../config/environment','debugLevel','toLowerCase','info','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util'];(function(_0x35d74c,_0x2ccc08){var _0x100202=function(_0x4dff79){while(--_0x4dff79){_0x35d74c['push'](_0x35d74c['shift']());}};_0x100202(++_0x2ccc08);}(_0x4c0c,0x92));var _0xc4c0=function(_0x26d993,_0x559ddb){_0x26d993=_0x26d993-0x0;var _0x1807e0=_0x4c0c[_0x26d993];return _0x1807e0;};'use strict';var path=require(_0xc4c0('0x0'));var util=require(_0xc4c0('0x1'));var moment=require('moment');var winston=require(_0xc4c0('0x2'));var config=require(_0xc4c0('0x3'));var debugLevel=config[_0xc4c0('0x4')]?config[_0xc4c0('0x4')][_0xc4c0('0x5')]():_0xc4c0('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':'redBG\x20white','error':_0xc4c0('0x7'),'warn':'bold\x20yellow','info':_0xc4c0('0x8'),'print':_0xc4c0('0x9'),'success':'bold\x20green','http':_0xc4c0('0xa'),'verbose':_0xc4c0('0xb'),'debug':_0xc4c0('0xc'),'silly':_0xc4c0('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x1307eb,_0x3c227f,_0x129ade){var _0x12b09c=_0x1307eb||_0xc4c0('0xe');return path[_0xc4c0('0xf')](_0x12b09c,util[_0xc4c0('0x10')](_0xc4c0('0x11'),_0x3c227f,_0x129ade));}function formatter(_0x22a15b,_0x11ab22){_0x11ab22[_0xc4c0('0x12')]=_0x11ab22[_0xc4c0('0x12')]['replace'](/@@{/g,'{{{')[_0xc4c0('0x13')](/}@@/g,'}}}')[_0xc4c0('0x13')](/@{/g,'{{')[_0xc4c0('0x13')](/}@/g,'}}');return util[_0xc4c0('0x10')](_0xc4c0('0x14'),moment()['format'](_0xc4c0('0x15')),_0x11ab22[_0xc4c0('0x16')][_0xc4c0('0x17')](),_0x22a15b,_0x11ab22['message']);}function fileFormat(_0x2673ef,_0x27e6aa){_0x27e6aa['message']=_0x27e6aa[_0xc4c0('0x12')][_0xc4c0('0x13')](/@@{/g,'{{{')[_0xc4c0('0x13')](/}@@/g,'}}}')[_0xc4c0('0x13')](/@{/g,'{{')[_0xc4c0('0x13')](/}@/g,'}}');var _0x4fda18=_0x27e6aa[_0xc4c0('0x18')]&&Object[_0xc4c0('0x19')](_0x27e6aa[_0xc4c0('0x18')])['length']?'\x0a\x09'+JSON[_0xc4c0('0x1a')](_0x27e6aa[_0xc4c0('0x18')]):'';return util[_0xc4c0('0x10')](_0xc4c0('0x1b'),moment()[_0xc4c0('0x10')](_0xc4c0('0x15')),_0x27e6aa[_0xc4c0('0x16')][_0xc4c0('0x17')](),_0x2673ef,_0x27e6aa[_0xc4c0('0x12')],_0x4fda18);}function consoleLogger(){var _0x434934=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc4c0('0x1c'))][(_0xc4c0('0x1d'))]({'level':_0xc4c0('0x1e'),'json':![],'formatter':function(_0x40f4da){return formatter('',_0x40f4da);}})]});return _0x434934;}function fileLogger(_0x56f3dd,_0x3e9a7a){var _0x4b76fd=new winston[(_0xc4c0('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xc4c0('0x20'))]({'name':util[_0xc4c0('0x10')](_0xc4c0('0x21'),_0x56f3dd,'error'),'filename':getLogFileName(_0x3e9a7a,_0x56f3dd,'error'),'level':_0xc4c0('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3eab88){return fileFormat(_0x56f3dd,_0x3eab88);}}),new winston[(_0xc4c0('0x1c'))]['File']({'name':util['format'](_0xc4c0('0x21'),_0x56f3dd,debugLevel),'filename':getLogFileName(_0x3e9a7a,_0x56f3dd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3f925a){return fileFormat(_0x56f3dd,_0x3f925a);}}),new winston['transports'][(_0xc4c0('0x1d'))]({'level':_0xc4c0('0x1e'),'json':![],'formatter':function(_0x26cdec){return fileFormat(_0x56f3dd,_0x26cdec);}})]});return _0x4b76fd;}exports[_0xc4c0('0x23')]=consoleLogger;exports[_0xc4c0('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 11ab609..9ac0078 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 _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(_0x4d6622,_0x14debf){var _0x730fc5=function(_0x2201e5){while(--_0x2201e5){_0x4d6622['push'](_0x4d6622['shift']());}};_0x730fc5(++_0x14debf);}(_0x66fa,0x117));var _0xa66f=function(_0x2b7be1,_0x180183){_0x2b7be1=_0x2b7be1-0x0;var _0x3affd2=_0x66fa[_0x2b7be1];return _0x3affd2;};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 +var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x2773d8,_0x517e37){var _0x312604=function(_0x25fa0f){while(--_0x25fa0f){_0x2773d8['push'](_0x2773d8['shift']());}};_0x312604(++_0x517e37);}(_0x14a0,0x8e));var _0x014a=function(_0xe69141,_0x554822){_0xe69141=_0xe69141-0x0;var _0x214e55=_0x14a0[_0xe69141];return _0x214e55;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index ecfe5bc..3e3282f 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['\x5c$&','exports','replace'];(function(_0x3f5549,_0x1f7b34){var _0x261d86=function(_0x8cbfbe){while(--_0x8cbfbe){_0x3f5549['push'](_0x3f5549['shift']());}};_0x261d86(++_0x1f7b34);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};module[_0xac4a('0x0')]={'escapeRegExp'(_0x5a86db,_0x40a0d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x5a86db[_0xac4a('0x1')](_0x40a0d0,_0xac4a('0x2'));}}; \ No newline at end of file +var _0x57ca=['\x5c$&'];(function(_0x5a435c,_0x455012){var _0x31a14f=function(_0xa6ffcd){while(--_0xa6ffcd){_0x5a435c['push'](_0x5a435c['shift']());}};_0x31a14f(++_0x455012);}(_0x57ca,0x108));var _0xa57c=function(_0x4ac4fa,_0x4c215){_0x4ac4fa=_0x4ac4fa-0x0;var _0x1d692e=_0x57ca[_0x4ac4fa];return _0x1d692e;};module['exports']={'escapeRegExp'(_0x29cc65,_0x4ad696=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x29cc65['replace'](_0x4ad696,_0xa57c('0x0'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index fe4896e..20df4b3 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 _0x9c00=['isPlainObject','exports','safeTemplate','lodash','replace','isArray','map'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x9c00,0x1a0));var _0x09c0=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0x9c00[_0xf7f60a];return _0x2567ad;};var _=require(_0x09c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x170d8b){return _0x170d8b==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xe0d293){var _0x8c9907=_0xe0d293;if(typeof _0xe0d293==='string'){_0x8c9907=_0xe0d293[_0x09c0('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x09c0('0x2')](_0xe0d293)){_0x8c9907=_0xe0d293[_0x09c0('0x3')](function(_0x2fd03e){return safeTemplate(_0x2fd03e);});}else if(_[_0x09c0('0x4')](_0xe0d293)){_0x8c9907=Object['keys'](_0xe0d293)['reduce'](function(_0x1f3d7e,_0x17d11f){_0x1f3d7e[_0x17d11f]=safeTemplate(_0xe0d293[_0x17d11f]);return _0x1f3d7e;},{});}return _0x8c9907;}module[_0x09c0('0x5')][_0x09c0('0x6')]=safeTemplate; \ No newline at end of file +var _0x1a85=['{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x3f9510,_0x3e61fe){var _0x24ac5e=function(_0xce77ed){while(--_0xce77ed){_0x3f9510['push'](_0x3f9510['shift']());}};_0x24ac5e(++_0x3e61fe);}(_0x1a85,0x178));var _0x51a8=function(_0x64bbb9,_0x909c76){_0x64bbb9=_0x64bbb9-0x0;var _0x5c3707=_0x1a85[_0x64bbb9];return _0x5c3707;};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 ee54ea4..08a9edd 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 _0x374e=['info','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','string','NODE_PATH','pathExists','then'];(function(_0x1ab588,_0x15b086){var _0x41d5a9=function(_0x46d264){while(--_0x46d264){_0x1ab588['push'](_0x1ab588['shift']());}};_0x41d5a9(++_0x15b086);}(_0x374e,0x1d0));var _0xe374=function(_0x4c8bf8,_0x34e122){_0x4c8bf8=_0x4c8bf8-0x0;var _0x3f1056=_0x374e[_0x4c8bf8];return _0x3f1056;};var fs=require(_0xe374('0x0'));var path=require(_0xe374('0x1'));var config=require('../config/environment');var root=config[_0xe374('0x2')];var APP_JSON_PATH=path['resolve'](root,_0xe374('0x3'));var NODEPATH=path[_0xe374('0x4')](root,_0xe374('0x5'));function setLegacyLibsNodeEnvPath(_0x7e45ec){let _0x1adc37=![];if(Array[_0xe374('0x6')](_0x7e45ec[_0xe374('0x7')])){var _0x438bbf=_0x7e45ec[_0xe374('0x7')][_0xe374('0x8')](function(_0x4a994f){return _0x4a994f[_0xe374('0x9')]===_0xe374('0xa');});if(_0x438bbf>-0x1){var _0x1ed71d=_0x7e45ec[_0xe374('0x7')][_0x438bbf];if(typeof _0x1ed71d[_0xe374('0xb')]['NODE_PATH']!==_0xe374('0xc')){_0x1ed71d['env'][_0xe374('0xd')]=NODEPATH;_0x1adc37=!![];}}return{'appConfig':_0x7e45ec,'updated':_0x1adc37};}}function updateAppConfig(_0x313757){return fs[_0xe374('0xe')](APP_JSON_PATH)[_0xe374('0xf')](function(_0xc4fc10){if(_0xc4fc10){return fs['readJSON'](APP_JSON_PATH)[_0xe374('0xf')](function(_0x2b1946){var _0x432a24=setLegacyLibsNodeEnvPath(_0x2b1946);if(_0x432a24['updated']){_0x313757[_0xe374('0x10')](_0xe374('0x11'));return fs[_0xe374('0x12')](APP_JSON_PATH,_0x2b1946,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe374('0x4')]();}});}module[_0xe374('0x13')]=updateAppConfig; \ No newline at end of file +var _0x97b5=['resolve','legacy-libs','isArray','apps','findIndex','motion2','env','NODE_PATH','pathExists','readJSON','then','updated','Updating\x20app.json','exports','fs-extra','path','../config/environment','server/app.json'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x97b5,0x152));var _0x597b=function(_0x5ae11e,_0x52f33d){_0x5ae11e=_0x5ae11e-0x0;var _0x362203=_0x97b5[_0x5ae11e];return _0x362203;};var fs=require(_0x597b('0x0'));var path=require(_0x597b('0x1'));var config=require(_0x597b('0x2'));var root=config['root'];var APP_JSON_PATH=path['resolve'](root,_0x597b('0x3'));var NODEPATH=path[_0x597b('0x4')](root,_0x597b('0x5'));function setLegacyLibsNodeEnvPath(_0x1c959e){let _0x4969f0=![];if(Array[_0x597b('0x6')](_0x1c959e[_0x597b('0x7')])){var _0x3c52bb=_0x1c959e[_0x597b('0x7')][_0x597b('0x8')](function(_0x31a91c){return _0x31a91c['name']===_0x597b('0x9');});if(_0x3c52bb>-0x1){var _0x30e93a=_0x1c959e['apps'][_0x3c52bb];if(typeof _0x30e93a[_0x597b('0xa')][_0x597b('0xb')]!=='string'){_0x30e93a[_0x597b('0xa')][_0x597b('0xb')]=NODEPATH;_0x4969f0=!![];}}return{'appConfig':_0x1c959e,'updated':_0x4969f0};}}function updateAppConfig(_0x10ea24){return fs[_0x597b('0xc')](APP_JSON_PATH)['then'](function(_0x25a878){if(_0x25a878){return fs[_0x597b('0xd')](APP_JSON_PATH)[_0x597b('0xe')](function(_0x55da99){var _0x38ed8d=setLegacyLibsNodeEnvPath(_0x55da99);if(_0x38ed8d[_0x597b('0xf')]){_0x10ea24['info'](_0x597b('0x10'));return fs['writeJSON'](APP_JSON_PATH,_0x55da99,{'spaces':0x2});}else{return Promise[_0x597b('0x4')]();}});}else{return Promise[_0x597b('0x4')]();}});}module[_0x597b('0x11')]=updateAppConfig; \ No newline at end of file